/*! For license information please see main.js.LICENSE.txt */ !function(t){var e={};function i(n){if(e[n])return e[n].exports;var r=e[n]={i:n,l:!1,exports:{}};return t[n].call(r.exports,r,r.exports,i),r.l=!0,r.exports}i.m=t,i.c=e,i.d=function(t,e,n){i.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:n})},i.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},i.t=function(t,e){if(1&e&&(t=i(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var n=Object.create(null);if(i.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var r in t)i.d(n,r,function(e){return t[e]}.bind(null,r));return n},i.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return i.d(e,"a",e),e},i.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},i.p="",i(i.s=66)}([function(t,e,i){"use strict";i.r(e),i.d(e,"ACESFilmicToneMapping",(function(){return it})),i.d(e,"AddEquation",(function(){return E})),i.d(e,"AddOperation",(function(){return J})),i.d(e,"AdditiveAnimationBlendMode",(function(){return Ce})),i.d(e,"AdditiveBlending",(function(){return b})),i.d(e,"AlphaFormat",(function(){return Bt})),i.d(e,"AlwaysDepth",(function(){return H})),i.d(e,"AlwaysStencilFunc",(function(){return ii})),i.d(e,"AmbientLight",(function(){return zc})),i.d(e,"AmbientLightProbe",(function(){return id})),i.d(e,"AnimationClip",(function(){return uc})),i.d(e,"AnimationLoader",(function(){return yc})),i.d(e,"AnimationMixer",(function(){return Dd})),i.d(e,"AnimationObjectGroup",(function(){return Ld})),i.d(e,"AnimationUtils",(function(){return Ju})),i.d(e,"ArcCurve",(function(){return xl})),i.d(e,"ArrayCamera",(function(){return Za})),i.d(e,"ArrowHelper",(function(){return bp})),i.d(e,"Audio",(function(){return fd})),i.d(e,"AudioAnalyser",(function(){return wd})),i.d(e,"AudioContext",(function(){return $c})),i.d(e,"AudioListener",(function(){return pd})),i.d(e,"AudioLoader",(function(){return td})),i.d(e,"AxesHelper",(function(){return Ap})),i.d(e,"AxisHelper",(function(){return rf})),i.d(e,"BackSide",(function(){return m})),i.d(e,"BasicDepthPacking",(function(){return Be})),i.d(e,"BasicShadowMap",(function(){return u})),i.d(e,"BinaryTextureLoader",(function(){return lf})),i.d(e,"Bone",(function(){return Nh})),i.d(e,"BooleanKeyframeTrack",(function(){return nc})),i.d(e,"BoundingBoxHelper",(function(){return sf})),i.d(e,"Box2",(function(){return Gd})),i.d(e,"Box3",(function(){return ln})),i.d(e,"Box3Helper",(function(){return gp})),i.d(e,"BoxBufferGeometry",(function(){return ls})),i.d(e,"BoxGeometry",(function(){return ls})),i.d(e,"BoxHelper",(function(){return mp})),i.d(e,"BufferAttribute",(function(){return Er})),i.d(e,"BufferGeometry",(function(){return Gr})),i.d(e,"BufferGeometryLoader",(function(){return Xc})),i.d(e,"ByteType",(function(){return St})),i.d(e,"Cache",(function(){return dc})),i.d(e,"Camera",(function(){return fs})),i.d(e,"CameraHelper",(function(){return dp})),i.d(e,"CanvasRenderer",(function(){return cf})),i.d(e,"CanvasTexture",(function(){return gl})),i.d(e,"CapsuleBufferGeometry",(function(){return Ul})),i.d(e,"CapsuleGeometry",(function(){return Ul})),i.d(e,"CatmullRomCurve3",(function(){return El})),i.d(e,"CineonToneMapping",(function(){return et})),i.d(e,"CircleBufferGeometry",(function(){return Vl})),i.d(e,"CircleGeometry",(function(){return Vl})),i.d(e,"ClampToEdgeWrapping",(function(){return ct})),i.d(e,"Clock",(function(){return ad})),i.d(e,"Color",(function(){return Wi})),i.d(e,"ColorKeyframeTrack",(function(){return rc})),i.d(e,"ColorManagement",(function(){return ki})),i.d(e,"CompressedTexture",(function(){return ml})),i.d(e,"CompressedTextureLoader",(function(){return xc})),i.d(e,"ConeBufferGeometry",(function(){return Gl})),i.d(e,"ConeGeometry",(function(){return Gl})),i.d(e,"CubeCamera",(function(){return gs})),i.d(e,"CubeReflectionMapping",(function(){return st})),i.d(e,"CubeRefractionMapping",(function(){return ot})),i.d(e,"CubeTexture",(function(){return vs})),i.d(e,"CubeTextureLoader",(function(){return bc})),i.d(e,"CubeUVReflectionMapping",(function(){return lt})),i.d(e,"CubicBezierCurve",(function(){return Pl})),i.d(e,"CubicBezierCurve3",(function(){return Rl})),i.d(e,"CubicInterpolant",(function(){return $u})),i.d(e,"CullFaceBack",(function(){return a})),i.d(e,"CullFaceFront",(function(){return h})),i.d(e,"CullFaceFrontBack",(function(){return l})),i.d(e,"CullFaceNone",(function(){return o})),i.d(e,"Curve",(function(){return vl})),i.d(e,"CurvePath",(function(){return kl})),i.d(e,"CustomBlending",(function(){return S})),i.d(e,"CustomToneMapping",(function(){return nt})),i.d(e,"CylinderBufferGeometry",(function(){return Hl})),i.d(e,"CylinderGeometry",(function(){return Hl})),i.d(e,"Cylindrical",(function(){return Vd})),i.d(e,"Data3DTexture",(function(){return en})),i.d(e,"DataArrayTexture",(function(){return $i})),i.d(e,"DataTexture",(function(){return zh})),i.d(e,"DataTexture2DArray",(function(){return bf})),i.d(e,"DataTexture3D",(function(){return Af})),i.d(e,"DataTextureLoader",(function(){return Ac})),i.d(e,"DataUtils",(function(){return Sp})),i.d(e,"DecrementStencilOp",(function(){return Ye})),i.d(e,"DecrementWrapStencilOp",(function(){return je})),i.d(e,"DefaultLoadingManager",(function(){return fc})),i.d(e,"DepthFormat",(function(){return zt})),i.d(e,"DepthStencilFormat",(function(){return Ut})),i.d(e,"DepthTexture",(function(){return ih})),i.d(e,"DirectionalLight",(function(){return Nc})),i.d(e,"DirectionalLightHelper",(function(){return lp})),i.d(e,"DiscreteInterpolant",(function(){return ec})),i.d(e,"DodecahedronBufferGeometry",(function(){return Yl})),i.d(e,"DodecahedronGeometry",(function(){return Yl})),i.d(e,"DoubleSide",(function(){return g})),i.d(e,"DstAlphaFactor",(function(){return F})),i.d(e,"DstColorFactor",(function(){return N})),i.d(e,"DynamicBufferAttribute",(function(){return jp})),i.d(e,"DynamicCopyUsage",(function(){return ui})),i.d(e,"DynamicDrawUsage",(function(){return ri})),i.d(e,"DynamicReadUsage",(function(){return ai})),i.d(e,"EdgesGeometry",(function(){return Kl})),i.d(e,"EdgesHelper",(function(){return of})),i.d(e,"EllipseCurve",(function(){return yl})),i.d(e,"EqualDepth",(function(){return Y})),i.d(e,"EqualStencilFunc",(function(){return Je})),i.d(e,"EquirectangularReflectionMapping",(function(){return at})),i.d(e,"EquirectangularRefractionMapping",(function(){return ht})),i.d(e,"Euler",(function(){return jn})),i.d(e,"EventDispatcher",(function(){return mi})),i.d(e,"ExtrudeBufferGeometry",(function(){return Mu})),i.d(e,"ExtrudeGeometry",(function(){return Mu})),i.d(e,"FaceColors",(function(){return Fp})),i.d(e,"FileLoader",(function(){return vc})),i.d(e,"FlatShading",(function(){return v})),i.d(e,"Float16BufferAttribute",(function(){return Dr})),i.d(e,"Float32Attribute",(function(){return ef})),i.d(e,"Float32BufferAttribute",(function(){return Br})),i.d(e,"Float64Attribute",(function(){return nf})),i.d(e,"Float64BufferAttribute",(function(){return Ir})),i.d(e,"FloatType",(function(){return Pt})),i.d(e,"Fog",(function(){return hh})),i.d(e,"FogExp2",(function(){return ah})),i.d(e,"Font",(function(){return yf})),i.d(e,"FontLoader",(function(){return vf})),i.d(e,"FramebufferTexture",(function(){return fl})),i.d(e,"FrontSide",(function(){return f})),i.d(e,"Frustum",(function(){return Es})),i.d(e,"GLBufferAttribute",(function(){return Fd})),i.d(e,"GLSL1",(function(){return di})),i.d(e,"GLSL3",(function(){return pi})),i.d(e,"GreaterDepth",(function(){return j})),i.d(e,"GreaterEqualDepth",(function(){return X})),i.d(e,"GreaterEqualStencilFunc",(function(){return ei})),i.d(e,"GreaterStencilFunc",(function(){return $e})),i.d(e,"GridHelper",(function(){return rp})),i.d(e,"Group",(function(){return $a})),i.d(e,"HalfFloatType",(function(){return Rt})),i.d(e,"HemisphereLight",(function(){return Ec})),i.d(e,"HemisphereLightHelper",(function(){return np})),i.d(e,"HemisphereLightProbe",(function(){return ed})),i.d(e,"IcosahedronBufferGeometry",(function(){return Cu})),i.d(e,"IcosahedronGeometry",(function(){return Cu})),i.d(e,"ImageBitmapLoader",(function(){return Jc})),i.d(e,"ImageLoader",(function(){return wc})),i.d(e,"ImageUtils",(function(){return Xi})),i.d(e,"ImmediateRenderObject",(function(){return xf})),i.d(e,"IncrementStencilOp",(function(){return We})),i.d(e,"IncrementWrapStencilOp",(function(){return Xe})),i.d(e,"InstancedBufferAttribute",(function(){return Gh})),i.d(e,"InstancedBufferGeometry",(function(){return Yc})),i.d(e,"InstancedInterleavedBuffer",(function(){return Id})),i.d(e,"InstancedMesh",(function(){return qh})),i.d(e,"Int16Attribute",(function(){return Jp})),i.d(e,"Int16BufferAttribute",(function(){return Pr})),i.d(e,"Int32Attribute",(function(){return $p})),i.d(e,"Int32BufferAttribute",(function(){return Lr})),i.d(e,"Int8Attribute",(function(){return qp})),i.d(e,"Int8BufferAttribute",(function(){return Mr})),i.d(e,"IntType",(function(){return _t})),i.d(e,"InterleavedBuffer",(function(){return uh})),i.d(e,"InterleavedBufferAttribute",(function(){return dh})),i.d(e,"Interpolant",(function(){return Zu})),i.d(e,"InterpolateDiscrete",(function(){return be})),i.d(e,"InterpolateLinear",(function(){return Ae})),i.d(e,"InterpolateSmooth",(function(){return Te})),i.d(e,"InvertStencilOp",(function(){return qe})),i.d(e,"JSONLoader",(function(){return df})),i.d(e,"KeepStencilOp",(function(){return He})),i.d(e,"KeyframeTrack",(function(){return ic})),i.d(e,"LOD",(function(){return Lh})),i.d(e,"LatheBufferGeometry",(function(){return zl})),i.d(e,"LatheGeometry",(function(){return zl})),i.d(e,"Layers",(function(){return qn})),i.d(e,"LensFlare",(function(){return ff})),i.d(e,"LessDepth",(function(){return G})),i.d(e,"LessEqualDepth",(function(){return W})),i.d(e,"LessEqualStencilFunc",(function(){return Ze})),i.d(e,"LessStencilFunc",(function(){return Ke})),i.d(e,"Light",(function(){return Sc})),i.d(e,"LightProbe",(function(){return Hc})),i.d(e,"Line",(function(){return el})),i.d(e,"Line3",(function(){return Xd})),i.d(e,"LineBasicMaterial",(function(){return Qh})),i.d(e,"LineCurve",(function(){return Ll})),i.d(e,"LineCurve3",(function(){return Ol})),i.d(e,"LineDashedMaterial",(function(){return Qu})),i.d(e,"LineLoop",(function(){return sl})),i.d(e,"LinePieces",(function(){return Bp})),i.d(e,"LineSegments",(function(){return rl})),i.d(e,"LineStrip",(function(){return Dp})),i.d(e,"LinearEncoding",(function(){return Oe})),i.d(e,"LinearFilter",(function(){return yt})),i.d(e,"LinearInterpolant",(function(){return tc})),i.d(e,"LinearMipMapLinearFilter",(function(){return At})),i.d(e,"LinearMipMapNearestFilter",(function(){return wt})),i.d(e,"LinearMipmapLinearFilter",(function(){return bt})),i.d(e,"LinearMipmapNearestFilter",(function(){return xt})),i.d(e,"LinearSRGBColorSpace",(function(){return Ue})),i.d(e,"LinearToneMapping",(function(){return $})),i.d(e,"Loader",(function(){return mc})),i.d(e,"LoaderUtils",(function(){return Wc})),i.d(e,"LoadingManager",(function(){return pc})),i.d(e,"LoopOnce",(function(){return ye})),i.d(e,"LoopPingPong",(function(){return we})),i.d(e,"LoopRepeat",(function(){return xe})),i.d(e,"LuminanceAlphaFormat",(function(){return Nt})),i.d(e,"LuminanceFormat",(function(){return kt})),i.d(e,"MOUSE",(function(){return r})),i.d(e,"Material",(function(){return br})),i.d(e,"MaterialLoader",(function(){return Gc})),i.d(e,"Math",(function(){return _i})),i.d(e,"MathUtils",(function(){return _i})),i.d(e,"Matrix3",(function(){return Pi})),i.d(e,"Matrix4",(function(){return kn})),i.d(e,"MaxEquation",(function(){return P})),i.d(e,"Mesh",(function(){return as})),i.d(e,"MeshBasicMaterial",(function(){return Ar})),i.d(e,"MeshDepthMaterial",(function(){return Xa})),i.d(e,"MeshDistanceMaterial",(function(){return ja})),i.d(e,"MeshFaceMaterial",(function(){return Np})),i.d(e,"MeshLambertMaterial",(function(){return ju})),i.d(e,"MeshMatcapMaterial",(function(){return qu})),i.d(e,"MeshNormalMaterial",(function(){return Xu})),i.d(e,"MeshPhongMaterial",(function(){return Wu})),i.d(e,"MeshPhysicalMaterial",(function(){return Gu})),i.d(e,"MeshStandardMaterial",(function(){return Hu})),i.d(e,"MeshToonMaterial",(function(){return Yu})),i.d(e,"MinEquation",(function(){return C})),i.d(e,"MirroredRepeatWrapping",(function(){return dt})),i.d(e,"MixOperation",(function(){return K})),i.d(e,"MultiMaterial",(function(){return zp})),i.d(e,"MultiplyBlending",(function(){return T})),i.d(e,"MultiplyOperation",(function(){return Q})),i.d(e,"NearestFilter",(function(){return pt})),i.d(e,"NearestMipMapLinearFilter",(function(){return vt})),i.d(e,"NearestMipMapNearestFilter",(function(){return mt})),i.d(e,"NearestMipmapLinearFilter",(function(){return gt})),i.d(e,"NearestMipmapNearestFilter",(function(){return ft})),i.d(e,"NeverDepth",(function(){return V})),i.d(e,"NeverStencilFunc",(function(){return Qe})),i.d(e,"NoBlending",(function(){return x})),i.d(e,"NoColorSpace",(function(){return Ne})),i.d(e,"NoColors",(function(){return Ip})),i.d(e,"NoToneMapping",(function(){return Z})),i.d(e,"NormalAnimationBlendMode",(function(){return _e})),i.d(e,"NormalBlending",(function(){return w})),i.d(e,"NotEqualDepth",(function(){return q})),i.d(e,"NotEqualStencilFunc",(function(){return ti})),i.d(e,"NumberKeyframeTrack",(function(){return sc})),i.d(e,"Object3D",(function(){return hr})),i.d(e,"ObjectLoader",(function(){return jc})),i.d(e,"ObjectSpaceNormalMap",(function(){return ke})),i.d(e,"OctahedronBufferGeometry",(function(){return Pu})),i.d(e,"OctahedronGeometry",(function(){return Pu})),i.d(e,"OneFactor",(function(){return L})),i.d(e,"OneMinusDstAlphaFactor",(function(){return k})),i.d(e,"OneMinusDstColorFactor",(function(){return z})),i.d(e,"OneMinusSrcAlphaFactor",(function(){return I})),i.d(e,"OneMinusSrcColorFactor",(function(){return D})),i.d(e,"OrthographicCamera",(function(){return Ns})),i.d(e,"PCFShadowMap",(function(){return c})),i.d(e,"PCFSoftShadowMap",(function(){return d})),i.d(e,"PMREMGenerator",(function(){return Xs})),i.d(e,"ParametricGeometry",(function(){return mf})),i.d(e,"Particle",(function(){return Vp})),i.d(e,"ParticleBasicMaterial",(function(){return Wp})),i.d(e,"ParticleSystem",(function(){return Hp})),i.d(e,"ParticleSystemMaterial",(function(){return Yp})),i.d(e,"Path",(function(){return Nl})),i.d(e,"PerspectiveCamera",(function(){return ms})),i.d(e,"Plane",(function(){return As})),i.d(e,"PlaneBufferGeometry",(function(){return Cs})),i.d(e,"PlaneGeometry",(function(){return Cs})),i.d(e,"PlaneHelper",(function(){return vp})),i.d(e,"PointCloud",(function(){return Up})),i.d(e,"PointCloudMaterial",(function(){return Gp})),i.d(e,"PointLight",(function(){return Fc})),i.d(e,"PointLightHelper",(function(){return $d})),i.d(e,"Points",(function(){return cl})),i.d(e,"PointsMaterial",(function(){return ol})),i.d(e,"PolarGridHelper",(function(){return sp})),i.d(e,"PolyhedronBufferGeometry",(function(){return Wl})),i.d(e,"PolyhedronGeometry",(function(){return Wl})),i.d(e,"PositionalAudio",(function(){return xd})),i.d(e,"PropertyBinding",(function(){return Rd})),i.d(e,"PropertyMixer",(function(){return bd})),i.d(e,"QuadraticBezierCurve",(function(){return Dl})),i.d(e,"QuadraticBezierCurve3",(function(){return Bl})),i.d(e,"Quaternion",(function(){return sn})),i.d(e,"QuaternionKeyframeTrack",(function(){return ac})),i.d(e,"QuaternionLinearInterpolant",(function(){return oc})),i.d(e,"REVISION",(function(){return n})),i.d(e,"RGBADepthPacking",(function(){return Ie})),i.d(e,"RGBAFormat",(function(){return Ft})),i.d(e,"RGBAIntegerFormat",(function(){return Yt})),i.d(e,"RGBA_ASTC_10x10_Format",(function(){return fe})),i.d(e,"RGBA_ASTC_10x5_Format",(function(){return ce})),i.d(e,"RGBA_ASTC_10x6_Format",(function(){return de})),i.d(e,"RGBA_ASTC_10x8_Format",(function(){return pe})),i.d(e,"RGBA_ASTC_12x10_Format",(function(){return me})),i.d(e,"RGBA_ASTC_12x12_Format",(function(){return ge})),i.d(e,"RGBA_ASTC_4x4_Format",(function(){return ne})),i.d(e,"RGBA_ASTC_5x4_Format",(function(){return re})),i.d(e,"RGBA_ASTC_5x5_Format",(function(){return se})),i.d(e,"RGBA_ASTC_6x5_Format",(function(){return oe})),i.d(e,"RGBA_ASTC_6x6_Format",(function(){return ae})),i.d(e,"RGBA_ASTC_8x5_Format",(function(){return he})),i.d(e,"RGBA_ASTC_8x6_Format",(function(){return le})),i.d(e,"RGBA_ASTC_8x8_Format",(function(){return ue})),i.d(e,"RGBA_BPTC_Format",(function(){return ve})),i.d(e,"RGBA_ETC2_EAC_Format",(function(){return ie})),i.d(e,"RGBA_PVRTC_2BPPV1_Format",(function(){return $t})),i.d(e,"RGBA_PVRTC_4BPPV1_Format",(function(){return Zt})),i.d(e,"RGBA_S3TC_DXT1_Format",(function(){return jt})),i.d(e,"RGBA_S3TC_DXT3_Format",(function(){return qt})),i.d(e,"RGBA_S3TC_DXT5_Format",(function(){return Qt})),i.d(e,"RGBFormat",(function(){return It})),i.d(e,"RGB_ETC1_Format",(function(){return te})),i.d(e,"RGB_ETC2_Format",(function(){return ee})),i.d(e,"RGB_PVRTC_2BPPV1_Format",(function(){return Jt})),i.d(e,"RGB_PVRTC_4BPPV1_Format",(function(){return Kt})),i.d(e,"RGB_S3TC_DXT1_Format",(function(){return Xt})),i.d(e,"RGFormat",(function(){return Gt})),i.d(e,"RGIntegerFormat",(function(){return Wt})),i.d(e,"RawShaderMaterial",(function(){return Vu})),i.d(e,"Ray",(function(){return Fn})),i.d(e,"Raycaster",(function(){return kd})),i.d(e,"RectAreaLight",(function(){return Uc})),i.d(e,"RedFormat",(function(){return Vt})),i.d(e,"RedIntegerFormat",(function(){return Ht})),i.d(e,"ReinhardToneMapping",(function(){return tt})),i.d(e,"RepeatWrapping",(function(){return ut})),i.d(e,"ReplaceStencilOp",(function(){return Ge})),i.d(e,"ReverseSubtractEquation",(function(){return _})),i.d(e,"RingBufferGeometry",(function(){return Ru})),i.d(e,"RingGeometry",(function(){return Ru})),i.d(e,"SRGBColorSpace",(function(){return ze})),i.d(e,"Scene",(function(){return lh})),i.d(e,"SceneUtils",(function(){return pf})),i.d(e,"ShaderChunk",(function(){return Ps})),i.d(e,"ShaderLib",(function(){return Ls})),i.d(e,"ShaderMaterial",(function(){return ps})),i.d(e,"ShadowMaterial",(function(){return Uu})),i.d(e,"Shape",(function(){return Jl})),i.d(e,"ShapeBufferGeometry",(function(){return Lu})),i.d(e,"ShapeGeometry",(function(){return Lu})),i.d(e,"ShapePath",(function(){return Tp})),i.d(e,"ShapeUtils",(function(){return Tu})),i.d(e,"ShortType",(function(){return Et})),i.d(e,"Skeleton",(function(){return Hh})),i.d(e,"SkeletonHelper",(function(){return Zd})),i.d(e,"SkinnedMesh",(function(){return kh})),i.d(e,"SmoothShading",(function(){return y})),i.d(e,"Source",(function(){return ji})),i.d(e,"Sphere",(function(){return Cn})),i.d(e,"SphereBufferGeometry",(function(){return Ou})),i.d(e,"SphereGeometry",(function(){return Ou})),i.d(e,"Spherical",(function(){return Ud})),i.d(e,"SphericalHarmonics3",(function(){return Vc})),i.d(e,"SplineCurve",(function(){return Il})),i.d(e,"SpotLight",(function(){return Lc})),i.d(e,"SpotLightHelper",(function(){return qd})),i.d(e,"Sprite",(function(){return _h})),i.d(e,"SpriteMaterial",(function(){return ph})),i.d(e,"SrcAlphaFactor",(function(){return B})),i.d(e,"SrcAlphaSaturateFactor",(function(){return U})),i.d(e,"SrcColorFactor",(function(){return O})),i.d(e,"StaticCopyUsage",(function(){return li})),i.d(e,"StaticDrawUsage",(function(){return ni})),i.d(e,"StaticReadUsage",(function(){return oi})),i.d(e,"StereoCamera",(function(){return od})),i.d(e,"StreamCopyUsage",(function(){return ci})),i.d(e,"StreamDrawUsage",(function(){return si})),i.d(e,"StreamReadUsage",(function(){return hi})),i.d(e,"StringKeyframeTrack",(function(){return hc})),i.d(e,"SubtractEquation",(function(){return M})),i.d(e,"SubtractiveBlending",(function(){return A})),i.d(e,"TOUCH",(function(){return s})),i.d(e,"TangentSpaceNormalMap",(function(){return Fe})),i.d(e,"TetrahedronBufferGeometry",(function(){return Du})),i.d(e,"TetrahedronGeometry",(function(){return Du})),i.d(e,"TextGeometry",(function(){return gf})),i.d(e,"Texture",(function(){return Ki})),i.d(e,"TextureLoader",(function(){return Tc})),i.d(e,"TorusBufferGeometry",(function(){return Bu})),i.d(e,"TorusGeometry",(function(){return Bu})),i.d(e,"TorusKnotBufferGeometry",(function(){return Iu})),i.d(e,"TorusKnotGeometry",(function(){return Iu})),i.d(e,"Triangle",(function(){return xr})),i.d(e,"TriangleFanDrawMode",(function(){return Le})),i.d(e,"TriangleStripDrawMode",(function(){return Re})),i.d(e,"TrianglesDrawMode",(function(){return Pe})),i.d(e,"TubeBufferGeometry",(function(){return Fu})),i.d(e,"TubeGeometry",(function(){return Fu})),i.d(e,"UVMapping",(function(){return rt})),i.d(e,"Uint16Attribute",(function(){return Zp})),i.d(e,"Uint16BufferAttribute",(function(){return Rr})),i.d(e,"Uint32Attribute",(function(){return tf})),i.d(e,"Uint32BufferAttribute",(function(){return Or})),i.d(e,"Uint8Attribute",(function(){return Qp})),i.d(e,"Uint8BufferAttribute",(function(){return _r})),i.d(e,"Uint8ClampedAttribute",(function(){return Kp})),i.d(e,"Uint8ClampedBufferAttribute",(function(){return Cr})),i.d(e,"Uniform",(function(){return Bd})),i.d(e,"UniformsLib",(function(){return Rs})),i.d(e,"UniformsUtils",(function(){return ds})),i.d(e,"UnsignedByteType",(function(){return Tt})),i.d(e,"UnsignedInt248Type",(function(){return Dt})),i.d(e,"UnsignedIntType",(function(){return Ct})),i.d(e,"UnsignedShort4444Type",(function(){return Lt})),i.d(e,"UnsignedShort5551Type",(function(){return Ot})),i.d(e,"UnsignedShortType",(function(){return Mt})),i.d(e,"VSMShadowMap",(function(){return p})),i.d(e,"Vector2",(function(){return Ci})),i.d(e,"Vector3",(function(){return on})),i.d(e,"Vector4",(function(){return Ji})),i.d(e,"VectorKeyframeTrack",(function(){return lc})),i.d(e,"Vertex",(function(){return Xp})),i.d(e,"VertexColors",(function(){return kp})),i.d(e,"VideoTexture",(function(){return pl})),i.d(e,"WebGL1Renderer",(function(){return oh})),i.d(e,"WebGL3DRenderTarget",(function(){return nn})),i.d(e,"WebGLArrayRenderTarget",(function(){return tn})),i.d(e,"WebGLCubeRenderTarget",(function(){return ys})),i.d(e,"WebGLMultipleRenderTargets",(function(){return rn})),i.d(e,"WebGLMultisampleRenderTarget",(function(){return wf})),i.d(e,"WebGLRenderTarget",(function(){return Zi})),i.d(e,"WebGLRenderTargetCube",(function(){return uf})),i.d(e,"WebGLRenderer",(function(){return sh})),i.d(e,"WebGLUtils",(function(){return Ja})),i.d(e,"WireframeGeometry",(function(){return ku})),i.d(e,"WireframeHelper",(function(){return af})),i.d(e,"WrapAroundEnding",(function(){return Me})),i.d(e,"XHRLoader",(function(){return hf})),i.d(e,"ZeroCurvatureEnding",(function(){return Se})),i.d(e,"ZeroFactor",(function(){return R})),i.d(e,"ZeroSlopeEnding",(function(){return Ee})),i.d(e,"ZeroStencilOp",(function(){return Ve})),i.d(e,"_SRGBAFormat",(function(){return fi})),i.d(e,"sRGBEncoding",(function(){return De}));const n="140",r={LEFT:0,MIDDLE:1,RIGHT:2,ROTATE:0,DOLLY:1,PAN:2},s={ROTATE:0,PAN:1,DOLLY_PAN:2,DOLLY_ROTATE:3},o=0,a=1,h=2,l=3,u=0,c=1,d=2,p=3,f=0,m=1,g=2,v=1,y=2,x=0,w=1,b=2,A=3,T=4,S=5,E=100,M=101,_=102,C=103,P=104,R=200,L=201,O=202,D=203,B=204,I=205,F=206,k=207,N=208,z=209,U=210,V=0,H=1,G=2,W=3,Y=4,X=5,j=6,q=7,Q=0,K=1,J=2,Z=0,$=1,tt=2,et=3,it=4,nt=5,rt=300,st=301,ot=302,at=303,ht=304,lt=306,ut=1e3,ct=1001,dt=1002,pt=1003,ft=1004,mt=1004,gt=1005,vt=1005,yt=1006,xt=1007,wt=1007,bt=1008,At=1008,Tt=1009,St=1010,Et=1011,Mt=1012,_t=1013,Ct=1014,Pt=1015,Rt=1016,Lt=1017,Ot=1018,Dt=1020,Bt=1021,It=1022,Ft=1023,kt=1024,Nt=1025,zt=1026,Ut=1027,Vt=1028,Ht=1029,Gt=1030,Wt=1031,Yt=1033,Xt=33776,jt=33777,qt=33778,Qt=33779,Kt=35840,Jt=35841,Zt=35842,$t=35843,te=36196,ee=37492,ie=37496,ne=37808,re=37809,se=37810,oe=37811,ae=37812,he=37813,le=37814,ue=37815,ce=37816,de=37817,pe=37818,fe=37819,me=37820,ge=37821,ve=36492,ye=2200,xe=2201,we=2202,be=2300,Ae=2301,Te=2302,Se=2400,Ee=2401,Me=2402,_e=2500,Ce=2501,Pe=0,Re=1,Le=2,Oe=3e3,De=3001,Be=3200,Ie=3201,Fe=0,ke=1,Ne="",ze="srgb",Ue="srgb-linear",Ve=0,He=7680,Ge=7681,We=7682,Ye=7683,Xe=34055,je=34056,qe=5386,Qe=512,Ke=513,Je=514,Ze=515,$e=516,ti=517,ei=518,ii=519,ni=35044,ri=35048,si=35040,oi=35045,ai=35049,hi=35041,li=35046,ui=35050,ci=35042,di="100",pi="300 es",fi=1035;class mi{addEventListener(t,e){void 0===this._listeners&&(this._listeners={});const i=this._listeners;void 0===i[t]&&(i[t]=[]),-1===i[t].indexOf(e)&&i[t].push(e)}hasEventListener(t,e){if(void 0===this._listeners)return!1;const i=this._listeners;return void 0!==i[t]&&-1!==i[t].indexOf(e)}removeEventListener(t,e){if(void 0===this._listeners)return;const i=this._listeners[t];if(void 0!==i){const t=i.indexOf(e);-1!==t&&i.splice(t,1)}}dispatchEvent(t){if(void 0===this._listeners)return;const e=this._listeners[t.type];if(void 0!==e){t.target=this;const i=e.slice(0);for(let e=0,n=i.length;e>8&255]+gi[t>>16&255]+gi[t>>24&255]+"-"+gi[255&e]+gi[e>>8&255]+"-"+gi[e>>16&15|64]+gi[e>>24&255]+"-"+gi[63&i|128]+gi[i>>8&255]+"-"+gi[i>>16&255]+gi[i>>24&255]+gi[255&n]+gi[n>>8&255]+gi[n>>16&255]+gi[n>>24&255]).toLowerCase()}function bi(t,e,i){return Math.max(e,Math.min(i,t))}function Ai(t,e){return(t%e+e)%e}function Ti(t,e,i){return(1-i)*t+i*e}function Si(t){return 0==(t&t-1)&&0!==t}function Ei(t){return Math.pow(2,Math.ceil(Math.log(t)/Math.LN2))}function Mi(t){return Math.pow(2,Math.floor(Math.log(t)/Math.LN2))}var _i=Object.freeze({__proto__:null,DEG2RAD:yi,RAD2DEG:xi,generateUUID:wi,clamp:bi,euclideanModulo:Ai,mapLinear:function(t,e,i,n,r){return n+(t-e)*(r-n)/(i-e)},inverseLerp:function(t,e,i){return t!==e?(i-t)/(e-t):0},lerp:Ti,damp:function(t,e,i,n){return Ti(t,e,1-Math.exp(-i*n))},pingpong:function(t,e=1){return e-Math.abs(Ai(t,2*e)-e)},smoothstep:function(t,e,i){return t<=e?0:t>=i?1:(t=(t-e)/(i-e))*t*(3-2*t)},smootherstep:function(t,e,i){return t<=e?0:t>=i?1:(t=(t-e)/(i-e))*t*t*(t*(6*t-15)+10)},randInt:function(t,e){return t+Math.floor(Math.random()*(e-t+1))},randFloat:function(t,e){return t+Math.random()*(e-t)},randFloatSpread:function(t){return t*(.5-Math.random())},seededRandom:function(t){void 0!==t&&(vi=t);let e=vi+=1831565813;return e=Math.imul(e^e>>>15,1|e),e^=e+Math.imul(e^e>>>7,61|e),((e^e>>>14)>>>0)/4294967296},degToRad:function(t){return t*yi},radToDeg:function(t){return t*xi},isPowerOfTwo:Si,ceilPowerOfTwo:Ei,floorPowerOfTwo:Mi,setQuaternionFromProperEuler:function(t,e,i,n,r){const s=Math.cos,o=Math.sin,a=s(i/2),h=o(i/2),l=s((e+n)/2),u=o((e+n)/2),c=s((e-n)/2),d=o((e-n)/2),p=s((n-e)/2),f=o((n-e)/2);switch(r){case"XYX":t.set(a*u,h*c,h*d,a*l);break;case"YZY":t.set(h*d,a*u,h*c,a*l);break;case"ZXZ":t.set(h*c,h*d,a*u,a*l);break;case"XZX":t.set(a*u,h*f,h*p,a*l);break;case"YXY":t.set(h*p,a*u,h*f,a*l);break;case"ZYZ":t.set(h*f,h*p,a*u,a*l)}},normalize:function(t,e){switch(e.constructor){case Float32Array:return t;case Uint16Array:return Math.round(65535*t);case Uint8Array:return Math.round(255*t);case Int16Array:return Math.round(32767*t);case Int8Array:return Math.round(127*t);default:throw new Error("Invalid component type.")}},denormalize:function(t,e){switch(e.constructor){case Float32Array:return t;case Uint16Array:return t/65535;case Uint8Array:return t/255;case Int16Array:return Math.max(t/32767,-1);case Int8Array:return Math.max(t/127,-1);default:throw new Error("Invalid component type.")}}});class Ci{constructor(t=0,e=0){this.x=t,this.y=e}get width(){return this.x}set width(t){this.x=t}get height(){return this.y}set height(t){this.y=t}set(t,e){return this.x=t,this.y=e,this}setScalar(t){return this.x=t,this.y=t,this}setX(t){return this.x=t,this}setY(t){return this.y=t,this}setComponent(t,e){switch(t){case 0:this.x=e;break;case 1:this.y=e;break;default:throw new Error("index is out of range: "+t)}return this}getComponent(t){switch(t){case 0:return this.x;case 1:return this.y;default:throw new Error("index is out of range: "+t)}}clone(){return new this.constructor(this.x,this.y)}copy(t){return this.x=t.x,this.y=t.y,this}add(t,e){return void 0!==e?this.addVectors(t,e):(this.x+=t.x,this.y+=t.y,this)}addScalar(t){return this.x+=t,this.y+=t,this}addVectors(t,e){return this.x=t.x+e.x,this.y=t.y+e.y,this}addScaledVector(t,e){return this.x+=t.x*e,this.y+=t.y*e,this}sub(t,e){return void 0!==e?this.subVectors(t,e):(this.x-=t.x,this.y-=t.y,this)}subScalar(t){return this.x-=t,this.y-=t,this}subVectors(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this}multiply(t){return this.x*=t.x,this.y*=t.y,this}multiplyScalar(t){return this.x*=t,this.y*=t,this}divide(t){return this.x/=t.x,this.y/=t.y,this}divideScalar(t){return this.multiplyScalar(1/t)}applyMatrix3(t){const e=this.x,i=this.y,n=t.elements;return this.x=n[0]*e+n[3]*i+n[6],this.y=n[1]*e+n[4]*i+n[7],this}min(t){return this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y),this}max(t){return this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y),this}clamp(t,e){return this.x=Math.max(t.x,Math.min(e.x,this.x)),this.y=Math.max(t.y,Math.min(e.y,this.y)),this}clampScalar(t,e){return this.x=Math.max(t,Math.min(e,this.x)),this.y=Math.max(t,Math.min(e,this.y)),this}clampLength(t,e){const i=this.length();return this.divideScalar(i||1).multiplyScalar(Math.max(t,Math.min(e,i)))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}roundToZero(){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(){return this.x=-this.x,this.y=-this.y,this}dot(t){return this.x*t.x+this.y*t.y}cross(t){return this.x*t.y-this.y*t.x}lengthSq(){return this.x*this.x+this.y*this.y}length(){return Math.sqrt(this.x*this.x+this.y*this.y)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)}normalize(){return this.divideScalar(this.length()||1)}angle(){return Math.atan2(-this.y,-this.x)+Math.PI}distanceTo(t){return Math.sqrt(this.distanceToSquared(t))}distanceToSquared(t){const e=this.x-t.x,i=this.y-t.y;return e*e+i*i}manhattanDistanceTo(t){return Math.abs(this.x-t.x)+Math.abs(this.y-t.y)}setLength(t){return this.normalize().multiplyScalar(t)}lerp(t,e){return this.x+=(t.x-this.x)*e,this.y+=(t.y-this.y)*e,this}lerpVectors(t,e,i){return this.x=t.x+(e.x-t.x)*i,this.y=t.y+(e.y-t.y)*i,this}equals(t){return t.x===this.x&&t.y===this.y}fromArray(t,e=0){return this.x=t[e],this.y=t[e+1],this}toArray(t=[],e=0){return t[e]=this.x,t[e+1]=this.y,t}fromBufferAttribute(t,e,i){return this.x=t.getX(e),this.y=t.getY(e),this}rotateAround(t,e){const i=Math.cos(e),n=Math.sin(e),r=this.x-t.x,s=this.y-t.y;return this.x=r*i-s*n+t.x,this.y=r*n+s*i+t.y,this}random(){return this.x=Math.random(),this.y=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y}}Ci.prototype.isVector2=!0;class Pi{constructor(){this.elements=[1,0,0,0,1,0,0,0,1]}set(t,e,i,n,r,s,o,a,h){const l=this.elements;return l[0]=t,l[1]=n,l[2]=o,l[3]=e,l[4]=r,l[5]=a,l[6]=i,l[7]=s,l[8]=h,this}identity(){return this.set(1,0,0,0,1,0,0,0,1),this}copy(t){const e=this.elements,i=t.elements;return e[0]=i[0],e[1]=i[1],e[2]=i[2],e[3]=i[3],e[4]=i[4],e[5]=i[5],e[6]=i[6],e[7]=i[7],e[8]=i[8],this}extractBasis(t,e,i){return t.setFromMatrix3Column(this,0),e.setFromMatrix3Column(this,1),i.setFromMatrix3Column(this,2),this}setFromMatrix4(t){const e=t.elements;return this.set(e[0],e[4],e[8],e[1],e[5],e[9],e[2],e[6],e[10]),this}multiply(t){return this.multiplyMatrices(this,t)}premultiply(t){return this.multiplyMatrices(t,this)}multiplyMatrices(t,e){const i=t.elements,n=e.elements,r=this.elements,s=i[0],o=i[3],a=i[6],h=i[1],l=i[4],u=i[7],c=i[2],d=i[5],p=i[8],f=n[0],m=n[3],g=n[6],v=n[1],y=n[4],x=n[7],w=n[2],b=n[5],A=n[8];return r[0]=s*f+o*v+a*w,r[3]=s*m+o*y+a*b,r[6]=s*g+o*x+a*A,r[1]=h*f+l*v+u*w,r[4]=h*m+l*y+u*b,r[7]=h*g+l*x+u*A,r[2]=c*f+d*v+p*w,r[5]=c*m+d*y+p*b,r[8]=c*g+d*x+p*A,this}multiplyScalar(t){const e=this.elements;return e[0]*=t,e[3]*=t,e[6]*=t,e[1]*=t,e[4]*=t,e[7]*=t,e[2]*=t,e[5]*=t,e[8]*=t,this}determinant(){const t=this.elements,e=t[0],i=t[1],n=t[2],r=t[3],s=t[4],o=t[5],a=t[6],h=t[7],l=t[8];return e*s*l-e*o*h-i*r*l+i*o*a+n*r*h-n*s*a}invert(){const t=this.elements,e=t[0],i=t[1],n=t[2],r=t[3],s=t[4],o=t[5],a=t[6],h=t[7],l=t[8],u=l*s-o*h,c=o*a-l*r,d=h*r-s*a,p=e*u+i*c+n*d;if(0===p)return this.set(0,0,0,0,0,0,0,0,0);const f=1/p;return t[0]=u*f,t[1]=(n*h-l*i)*f,t[2]=(o*i-n*s)*f,t[3]=c*f,t[4]=(l*e-n*a)*f,t[5]=(n*r-o*e)*f,t[6]=d*f,t[7]=(i*a-h*e)*f,t[8]=(s*e-i*r)*f,this}transpose(){let t;const e=this.elements;return t=e[1],e[1]=e[3],e[3]=t,t=e[2],e[2]=e[6],e[6]=t,t=e[5],e[5]=e[7],e[7]=t,this}getNormalMatrix(t){return this.setFromMatrix4(t).invert().transpose()}transposeIntoArray(t){const e=this.elements;return t[0]=e[0],t[1]=e[3],t[2]=e[6],t[3]=e[1],t[4]=e[4],t[5]=e[7],t[6]=e[2],t[7]=e[5],t[8]=e[8],this}setUvTransform(t,e,i,n,r,s,o){const a=Math.cos(r),h=Math.sin(r);return this.set(i*a,i*h,-i*(a*s+h*o)+s+t,-n*h,n*a,-n*(-h*s+a*o)+o+e,0,0,1),this}scale(t,e){const i=this.elements;return i[0]*=t,i[3]*=t,i[6]*=t,i[1]*=e,i[4]*=e,i[7]*=e,this}rotate(t){const e=Math.cos(t),i=Math.sin(t),n=this.elements,r=n[0],s=n[3],o=n[6],a=n[1],h=n[4],l=n[7];return n[0]=e*r+i*a,n[3]=e*s+i*h,n[6]=e*o+i*l,n[1]=-i*r+e*a,n[4]=-i*s+e*h,n[7]=-i*o+e*l,this}translate(t,e){const i=this.elements;return i[0]+=t*i[2],i[3]+=t*i[5],i[6]+=t*i[8],i[1]+=e*i[2],i[4]+=e*i[5],i[7]+=e*i[8],this}equals(t){const e=this.elements,i=t.elements;for(let t=0;t<9;t++)if(e[t]!==i[t])return!1;return!0}fromArray(t,e=0){for(let i=0;i<9;i++)this.elements[i]=t[i+e];return this}toArray(t=[],e=0){const i=this.elements;return t[e]=i[0],t[e+1]=i[1],t[e+2]=i[2],t[e+3]=i[3],t[e+4]=i[4],t[e+5]=i[5],t[e+6]=i[6],t[e+7]=i[7],t[e+8]=i[8],t}clone(){return(new this.constructor).fromArray(this.elements)}}function Ri(t){for(let e=t.length-1;e>=0;--e)if(t[e]>65535)return!0;return!1}Pi.prototype.isMatrix3=!0;const Li={Int8Array:Int8Array,Uint8Array:Uint8Array,Uint8ClampedArray:Uint8ClampedArray,Int16Array:Int16Array,Uint16Array:Uint16Array,Int32Array:Int32Array,Uint32Array:Uint32Array,Float32Array:Float32Array,Float64Array:Float64Array};function Oi(t,e){return new Li[t](e)}function Di(t){return document.createElementNS("http://www.w3.org/1999/xhtml",t)}function Bi(t){return t<.04045?.0773993808*t:Math.pow(.9478672986*t+.0521327014,2.4)}function Ii(t){return t<.0031308?12.92*t:1.055*Math.pow(t,.41666)-.055}const Fi={[ze]:{[Ue]:Bi},[Ue]:{[ze]:Ii}},ki={legacyMode:!0,get workingColorSpace(){return Ue},set workingColorSpace(t){},convert:function(t,e,i){if(this.legacyMode||e===i||!e||!i)return t;if(Fi[e]&&void 0!==Fi[e][i]){const n=Fi[e][i];return t.r=n(t.r),t.g=n(t.g),t.b=n(t.b),t}throw new Error("Unsupported color space conversion.")},fromWorkingColorSpace:function(t,e){return this.convert(t,this.workingColorSpace,e)},toWorkingColorSpace:function(t,e){return this.convert(t,e,this.workingColorSpace)}},Ni={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},zi={r:0,g:0,b:0},Ui={h:0,s:0,l:0},Vi={h:0,s:0,l:0};function Hi(t,e,i){return i<0&&(i+=1),i>1&&(i-=1),i<1/6?t+6*(e-t)*i:i<.5?e:i<2/3?t+6*(e-t)*(2/3-i):t}function Gi(t,e){return e.r=t.r,e.g=t.g,e.b=t.b,e}class Wi{constructor(t,e,i){return void 0===e&&void 0===i?this.set(t):this.setRGB(t,e,i)}set(t){return t&&t.isColor?this.copy(t):"number"==typeof t?this.setHex(t):"string"==typeof t&&this.setStyle(t),this}setScalar(t){return this.r=t,this.g=t,this.b=t,this}setHex(t,e=ze){return t=Math.floor(t),this.r=(t>>16&255)/255,this.g=(t>>8&255)/255,this.b=(255&t)/255,ki.toWorkingColorSpace(this,e),this}setRGB(t,e,i,n=Ue){return this.r=t,this.g=e,this.b=i,ki.toWorkingColorSpace(this,n),this}setHSL(t,e,i,n=Ue){if(t=Ai(t,1),e=bi(e,0,1),i=bi(i,0,1),0===e)this.r=this.g=this.b=i;else{const n=i<=.5?i*(1+e):i+e-i*e,r=2*i-n;this.r=Hi(r,n,t+1/3),this.g=Hi(r,n,t),this.b=Hi(r,n,t-1/3)}return ki.toWorkingColorSpace(this,n),this}setStyle(t,e=ze){function i(t){void 0!==t&&parseFloat(t)}let n;if(n=/^((?:rgb|hsl)a?)\(([^\)]*)\)/.exec(t)){let t;const r=n[1],s=n[2];switch(r){case"rgb":case"rgba":if(t=/^\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(s))return this.r=Math.min(255,parseInt(t[1],10))/255,this.g=Math.min(255,parseInt(t[2],10))/255,this.b=Math.min(255,parseInt(t[3],10))/255,ki.toWorkingColorSpace(this,e),i(t[4]),this;if(t=/^\s*(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(s))return this.r=Math.min(100,parseInt(t[1],10))/100,this.g=Math.min(100,parseInt(t[2],10))/100,this.b=Math.min(100,parseInt(t[3],10))/100,ki.toWorkingColorSpace(this,e),i(t[4]),this;break;case"hsl":case"hsla":if(t=/^\s*(\d*\.?\d+)\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(s)){const n=parseFloat(t[1])/360,r=parseInt(t[2],10)/100,s=parseInt(t[3],10)/100;return i(t[4]),this.setHSL(n,r,s,e)}}}else if(n=/^\#([A-Fa-f\d]+)$/.exec(t)){const t=n[1],i=t.length;if(3===i)return this.r=parseInt(t.charAt(0)+t.charAt(0),16)/255,this.g=parseInt(t.charAt(1)+t.charAt(1),16)/255,this.b=parseInt(t.charAt(2)+t.charAt(2),16)/255,ki.toWorkingColorSpace(this,e),this;if(6===i)return this.r=parseInt(t.charAt(0)+t.charAt(1),16)/255,this.g=parseInt(t.charAt(2)+t.charAt(3),16)/255,this.b=parseInt(t.charAt(4)+t.charAt(5),16)/255,ki.toWorkingColorSpace(this,e),this}return t&&t.length>0?this.setColorName(t,e):this}setColorName(t,e=ze){const i=Ni[t.toLowerCase()];return void 0!==i&&this.setHex(i,e),this}clone(){return new this.constructor(this.r,this.g,this.b)}copy(t){return this.r=t.r,this.g=t.g,this.b=t.b,this}copySRGBToLinear(t){return this.r=Bi(t.r),this.g=Bi(t.g),this.b=Bi(t.b),this}copyLinearToSRGB(t){return this.r=Ii(t.r),this.g=Ii(t.g),this.b=Ii(t.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}getHex(t=ze){return ki.fromWorkingColorSpace(Gi(this,zi),t),bi(255*zi.r,0,255)<<16^bi(255*zi.g,0,255)<<8^bi(255*zi.b,0,255)<<0}getHexString(t=ze){return("000000"+this.getHex(t).toString(16)).slice(-6)}getHSL(t,e=Ue){ki.fromWorkingColorSpace(Gi(this,zi),e);const i=zi.r,n=zi.g,r=zi.b,s=Math.max(i,n,r),o=Math.min(i,n,r);let a,h;const l=(o+s)/2;if(o===s)a=0,h=0;else{const t=s-o;switch(h=l<=.5?t/(s+o):t/(2-s-o),s){case i:a=(n-r)/t+(n2048||e.height>2048?e.toDataURL("image/jpeg",.6):e.toDataURL("image/png")}static sRGBToLinear(t){if("undefined"!=typeof HTMLImageElement&&t instanceof HTMLImageElement||"undefined"!=typeof HTMLCanvasElement&&t instanceof HTMLCanvasElement||"undefined"!=typeof ImageBitmap&&t instanceof ImageBitmap){const e=Di("canvas");e.width=t.width,e.height=t.height;const i=e.getContext("2d");i.drawImage(t,0,0,t.width,t.height);const n=i.getImageData(0,0,t.width,t.height),r=n.data;for(let t=0;t1)switch(this.wrapS){case ut:t.x=t.x-Math.floor(t.x);break;case ct:t.x=t.x<0?0:1;break;case dt:1===Math.abs(Math.floor(t.x)%2)?t.x=Math.ceil(t.x)-t.x:t.x=t.x-Math.floor(t.x)}if(t.y<0||t.y>1)switch(this.wrapT){case ut:t.y=t.y-Math.floor(t.y);break;case ct:t.y=t.y<0?0:1;break;case dt:1===Math.abs(Math.floor(t.y)%2)?t.y=Math.ceil(t.y)-t.y:t.y=t.y-Math.floor(t.y)}return this.flipY&&(t.y=1-t.y),t}set needsUpdate(t){!0===t&&(this.version++,this.source.needsUpdate=!0)}}Ki.DEFAULT_IMAGE=null,Ki.DEFAULT_MAPPING=rt,Ki.prototype.isTexture=!0;class Ji{constructor(t=0,e=0,i=0,n=1){this.x=t,this.y=e,this.z=i,this.w=n}get width(){return this.z}set width(t){this.z=t}get height(){return this.w}set height(t){this.w=t}set(t,e,i,n){return this.x=t,this.y=e,this.z=i,this.w=n,this}setScalar(t){return this.x=t,this.y=t,this.z=t,this.w=t,this}setX(t){return this.x=t,this}setY(t){return this.y=t,this}setZ(t){return this.z=t,this}setW(t){return this.w=t,this}setComponent(t,e){switch(t){case 0:this.x=e;break;case 1:this.y=e;break;case 2:this.z=e;break;case 3:this.w=e;break;default:throw new Error("index is out of range: "+t)}return this}getComponent(t){switch(t){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: "+t)}}clone(){return new this.constructor(this.x,this.y,this.z,this.w)}copy(t){return this.x=t.x,this.y=t.y,this.z=t.z,this.w=void 0!==t.w?t.w:1,this}add(t,e){return void 0!==e?this.addVectors(t,e):(this.x+=t.x,this.y+=t.y,this.z+=t.z,this.w+=t.w,this)}addScalar(t){return this.x+=t,this.y+=t,this.z+=t,this.w+=t,this}addVectors(t,e){return this.x=t.x+e.x,this.y=t.y+e.y,this.z=t.z+e.z,this.w=t.w+e.w,this}addScaledVector(t,e){return this.x+=t.x*e,this.y+=t.y*e,this.z+=t.z*e,this.w+=t.w*e,this}sub(t,e){return void 0!==e?this.subVectors(t,e):(this.x-=t.x,this.y-=t.y,this.z-=t.z,this.w-=t.w,this)}subScalar(t){return this.x-=t,this.y-=t,this.z-=t,this.w-=t,this}subVectors(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this.z=t.z-e.z,this.w=t.w-e.w,this}multiply(t){return this.x*=t.x,this.y*=t.y,this.z*=t.z,this.w*=t.w,this}multiplyScalar(t){return this.x*=t,this.y*=t,this.z*=t,this.w*=t,this}applyMatrix4(t){const e=this.x,i=this.y,n=this.z,r=this.w,s=t.elements;return this.x=s[0]*e+s[4]*i+s[8]*n+s[12]*r,this.y=s[1]*e+s[5]*i+s[9]*n+s[13]*r,this.z=s[2]*e+s[6]*i+s[10]*n+s[14]*r,this.w=s[3]*e+s[7]*i+s[11]*n+s[15]*r,this}divideScalar(t){return this.multiplyScalar(1/t)}setAxisAngleFromQuaternion(t){this.w=2*Math.acos(t.w);const e=Math.sqrt(1-t.w*t.w);return e<1e-4?(this.x=1,this.y=0,this.z=0):(this.x=t.x/e,this.y=t.y/e,this.z=t.z/e),this}setAxisAngleFromRotationMatrix(t){let e,i,n,r;const s=t.elements,o=s[0],a=s[4],h=s[8],l=s[1],u=s[5],c=s[9],d=s[2],p=s[6],f=s[10];if(Math.abs(a-l)<.01&&Math.abs(h-d)<.01&&Math.abs(c-p)<.01){if(Math.abs(a+l)<.1&&Math.abs(h+d)<.1&&Math.abs(c+p)<.1&&Math.abs(o+u+f-3)<.1)return this.set(1,0,0,0),this;e=Math.PI;const t=(o+1)/2,s=(u+1)/2,m=(f+1)/2,g=(a+l)/4,v=(h+d)/4,y=(c+p)/4;return t>s&&t>m?t<.01?(i=0,n=.707106781,r=.707106781):(i=Math.sqrt(t),n=g/i,r=v/i):s>m?s<.01?(i=.707106781,n=0,r=.707106781):(n=Math.sqrt(s),i=g/n,r=y/n):m<.01?(i=.707106781,n=.707106781,r=0):(r=Math.sqrt(m),i=v/r,n=y/r),this.set(i,n,r,e),this}let m=Math.sqrt((p-c)*(p-c)+(h-d)*(h-d)+(l-a)*(l-a));return Math.abs(m)<.001&&(m=1),this.x=(p-c)/m,this.y=(h-d)/m,this.z=(l-a)/m,this.w=Math.acos((o+u+f-1)/2),this}min(t){return this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y),this.z=Math.min(this.z,t.z),this.w=Math.min(this.w,t.w),this}max(t){return this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y),this.z=Math.max(this.z,t.z),this.w=Math.max(this.w,t.w),this}clamp(t,e){return this.x=Math.max(t.x,Math.min(e.x,this.x)),this.y=Math.max(t.y,Math.min(e.y,this.y)),this.z=Math.max(t.z,Math.min(e.z,this.z)),this.w=Math.max(t.w,Math.min(e.w,this.w)),this}clampScalar(t,e){return this.x=Math.max(t,Math.min(e,this.x)),this.y=Math.max(t,Math.min(e,this.y)),this.z=Math.max(t,Math.min(e,this.z)),this.w=Math.max(t,Math.min(e,this.w)),this}clampLength(t,e){const i=this.length();return this.divideScalar(i||1).multiplyScalar(Math.max(t,Math.min(e,i)))}floor(){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(){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(){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(){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(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this.w=-this.w,this}dot(t){return this.x*t.x+this.y*t.y+this.z*t.z+this.w*t.w}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)+Math.abs(this.w)}normalize(){return this.divideScalar(this.length()||1)}setLength(t){return this.normalize().multiplyScalar(t)}lerp(t,e){return this.x+=(t.x-this.x)*e,this.y+=(t.y-this.y)*e,this.z+=(t.z-this.z)*e,this.w+=(t.w-this.w)*e,this}lerpVectors(t,e,i){return this.x=t.x+(e.x-t.x)*i,this.y=t.y+(e.y-t.y)*i,this.z=t.z+(e.z-t.z)*i,this.w=t.w+(e.w-t.w)*i,this}equals(t){return t.x===this.x&&t.y===this.y&&t.z===this.z&&t.w===this.w}fromArray(t,e=0){return this.x=t[e],this.y=t[e+1],this.z=t[e+2],this.w=t[e+3],this}toArray(t=[],e=0){return t[e]=this.x,t[e+1]=this.y,t[e+2]=this.z,t[e+3]=this.w,t}fromBufferAttribute(t,e,i){return this.x=t.getX(e),this.y=t.getY(e),this.z=t.getZ(e),this.w=t.getW(e),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this.w=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z,yield this.w}}Ji.prototype.isVector4=!0;class Zi extends mi{constructor(t,e,i={}){super(),this.width=t,this.height=e,this.depth=1,this.scissor=new Ji(0,0,t,e),this.scissorTest=!1,this.viewport=new Ji(0,0,t,e);const n={width:t,height:e,depth:1};this.texture=new Ki(n,i.mapping,i.wrapS,i.wrapT,i.magFilter,i.minFilter,i.format,i.type,i.anisotropy,i.encoding),this.texture.isRenderTargetTexture=!0,this.texture.flipY=!1,this.texture.generateMipmaps=void 0!==i.generateMipmaps&&i.generateMipmaps,this.texture.internalFormat=void 0!==i.internalFormat?i.internalFormat:null,this.texture.minFilter=void 0!==i.minFilter?i.minFilter:yt,this.depthBuffer=void 0===i.depthBuffer||i.depthBuffer,this.stencilBuffer=void 0!==i.stencilBuffer&&i.stencilBuffer,this.depthTexture=void 0!==i.depthTexture?i.depthTexture:null,this.samples=void 0!==i.samples?i.samples:0}setSize(t,e,i=1){this.width===t&&this.height===e&&this.depth===i||(this.width=t,this.height=e,this.depth=i,this.texture.image.width=t,this.texture.image.height=e,this.texture.image.depth=i,this.dispose()),this.viewport.set(0,0,t,e),this.scissor.set(0,0,t,e)}clone(){return(new this.constructor).copy(this)}copy(t){return this.width=t.width,this.height=t.height,this.depth=t.depth,this.viewport.copy(t.viewport),this.texture=t.texture.clone(),this.texture.isRenderTargetTexture=!0,this.texture.image=Object.assign({},t.texture.image),this.depthBuffer=t.depthBuffer,this.stencilBuffer=t.stencilBuffer,null!==t.depthTexture&&(this.depthTexture=t.depthTexture.clone()),this.samples=t.samples,this}dispose(){this.dispatchEvent({type:"dispose"})}}Zi.prototype.isWebGLRenderTarget=!0;class $i extends Ki{constructor(t=null,e=1,i=1,n=1){super(null),this.image={data:t,width:e,height:i,depth:n},this.magFilter=pt,this.minFilter=pt,this.wrapR=ct,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}}$i.prototype.isDataArrayTexture=!0;class tn extends Zi{constructor(t,e,i){super(t,e),this.depth=i,this.texture=new $i(null,t,e,i),this.texture.isRenderTargetTexture=!0}}tn.prototype.isWebGLArrayRenderTarget=!0;class en extends Ki{constructor(t=null,e=1,i=1,n=1){super(null),this.image={data:t,width:e,height:i,depth:n},this.magFilter=pt,this.minFilter=pt,this.wrapR=ct,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}}en.prototype.isData3DTexture=!0;class nn extends Zi{constructor(t,e,i){super(t,e),this.depth=i,this.texture=new en(null,t,e,i),this.texture.isRenderTargetTexture=!0}}nn.prototype.isWebGL3DRenderTarget=!0;class rn extends Zi{constructor(t,e,i,n={}){super(t,e,n);const r=this.texture;this.texture=[];for(let t=0;t=0?1:-1,n=1-e*e;if(n>Number.EPSILON){const r=Math.sqrt(n),s=Math.atan2(r,e*i);t=Math.sin(t*s)/r,o=Math.sin(o*s)/r}const r=o*i;if(a=a*t+c*r,h=h*t+d*r,l=l*t+p*r,u=u*t+f*r,t===1-o){const t=1/Math.sqrt(a*a+h*h+l*l+u*u);a*=t,h*=t,l*=t,u*=t}}t[e]=a,t[e+1]=h,t[e+2]=l,t[e+3]=u}static multiplyQuaternionsFlat(t,e,i,n,r,s){const o=i[n],a=i[n+1],h=i[n+2],l=i[n+3],u=r[s],c=r[s+1],d=r[s+2],p=r[s+3];return t[e]=o*p+l*u+a*d-h*c,t[e+1]=a*p+l*c+h*u-o*d,t[e+2]=h*p+l*d+o*c-a*u,t[e+3]=l*p-o*u-a*c-h*d,t}get x(){return this._x}set x(t){this._x=t,this._onChangeCallback()}get y(){return this._y}set y(t){this._y=t,this._onChangeCallback()}get z(){return this._z}set z(t){this._z=t,this._onChangeCallback()}get w(){return this._w}set w(t){this._w=t,this._onChangeCallback()}set(t,e,i,n){return this._x=t,this._y=e,this._z=i,this._w=n,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._w)}copy(t){return this._x=t.x,this._y=t.y,this._z=t.z,this._w=t.w,this._onChangeCallback(),this}setFromEuler(t,e){if(!t||!t.isEuler)throw new Error("THREE.Quaternion: .setFromEuler() now expects an Euler rotation rather than a Vector3 and order.");const i=t._x,n=t._y,r=t._z,s=t._order,o=Math.cos,a=Math.sin,h=o(i/2),l=o(n/2),u=o(r/2),c=a(i/2),d=a(n/2),p=a(r/2);switch(s){case"XYZ":this._x=c*l*u+h*d*p,this._y=h*d*u-c*l*p,this._z=h*l*p+c*d*u,this._w=h*l*u-c*d*p;break;case"YXZ":this._x=c*l*u+h*d*p,this._y=h*d*u-c*l*p,this._z=h*l*p-c*d*u,this._w=h*l*u+c*d*p;break;case"ZXY":this._x=c*l*u-h*d*p,this._y=h*d*u+c*l*p,this._z=h*l*p+c*d*u,this._w=h*l*u-c*d*p;break;case"ZYX":this._x=c*l*u-h*d*p,this._y=h*d*u+c*l*p,this._z=h*l*p-c*d*u,this._w=h*l*u+c*d*p;break;case"YZX":this._x=c*l*u+h*d*p,this._y=h*d*u+c*l*p,this._z=h*l*p-c*d*u,this._w=h*l*u-c*d*p;break;case"XZY":this._x=c*l*u-h*d*p,this._y=h*d*u-c*l*p,this._z=h*l*p+c*d*u,this._w=h*l*u+c*d*p}return!1!==e&&this._onChangeCallback(),this}setFromAxisAngle(t,e){const i=e/2,n=Math.sin(i);return this._x=t.x*n,this._y=t.y*n,this._z=t.z*n,this._w=Math.cos(i),this._onChangeCallback(),this}setFromRotationMatrix(t){const e=t.elements,i=e[0],n=e[4],r=e[8],s=e[1],o=e[5],a=e[9],h=e[2],l=e[6],u=e[10],c=i+o+u;if(c>0){const t=.5/Math.sqrt(c+1);this._w=.25/t,this._x=(l-a)*t,this._y=(r-h)*t,this._z=(s-n)*t}else if(i>o&&i>u){const t=2*Math.sqrt(1+i-o-u);this._w=(l-a)/t,this._x=.25*t,this._y=(n+s)/t,this._z=(r+h)/t}else if(o>u){const t=2*Math.sqrt(1+o-i-u);this._w=(r-h)/t,this._x=(n+s)/t,this._y=.25*t,this._z=(a+l)/t}else{const t=2*Math.sqrt(1+u-i-o);this._w=(s-n)/t,this._x=(r+h)/t,this._y=(a+l)/t,this._z=.25*t}return this._onChangeCallback(),this}setFromUnitVectors(t,e){let i=t.dot(e)+1;return iMath.abs(t.z)?(this._x=-t.y,this._y=t.x,this._z=0,this._w=i):(this._x=0,this._y=-t.z,this._z=t.y,this._w=i)):(this._x=t.y*e.z-t.z*e.y,this._y=t.z*e.x-t.x*e.z,this._z=t.x*e.y-t.y*e.x,this._w=i),this.normalize()}angleTo(t){return 2*Math.acos(Math.abs(bi(this.dot(t),-1,1)))}rotateTowards(t,e){const i=this.angleTo(t);if(0===i)return this;const n=Math.min(1,e/i);return this.slerp(t,n),this}identity(){return this.set(0,0,0,1)}invert(){return this.conjugate()}conjugate(){return this._x*=-1,this._y*=-1,this._z*=-1,this._onChangeCallback(),this}dot(t){return this._x*t._x+this._y*t._y+this._z*t._z+this._w*t._w}lengthSq(){return this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w}length(){return Math.sqrt(this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w)}normalize(){let t=this.length();return 0===t?(this._x=0,this._y=0,this._z=0,this._w=1):(t=1/t,this._x=this._x*t,this._y=this._y*t,this._z=this._z*t,this._w=this._w*t),this._onChangeCallback(),this}multiply(t,e){return void 0!==e?this.multiplyQuaternions(t,e):this.multiplyQuaternions(this,t)}premultiply(t){return this.multiplyQuaternions(t,this)}multiplyQuaternions(t,e){const i=t._x,n=t._y,r=t._z,s=t._w,o=e._x,a=e._y,h=e._z,l=e._w;return this._x=i*l+s*o+n*h-r*a,this._y=n*l+s*a+r*o-i*h,this._z=r*l+s*h+i*a-n*o,this._w=s*l-i*o-n*a-r*h,this._onChangeCallback(),this}slerp(t,e){if(0===e)return this;if(1===e)return this.copy(t);const i=this._x,n=this._y,r=this._z,s=this._w;let o=s*t._w+i*t._x+n*t._y+r*t._z;if(o<0?(this._w=-t._w,this._x=-t._x,this._y=-t._y,this._z=-t._z,o=-o):this.copy(t),o>=1)return this._w=s,this._x=i,this._y=n,this._z=r,this;const a=1-o*o;if(a<=Number.EPSILON){const t=1-e;return this._w=t*s+e*this._w,this._x=t*i+e*this._x,this._y=t*n+e*this._y,this._z=t*r+e*this._z,this.normalize(),this._onChangeCallback(),this}const h=Math.sqrt(a),l=Math.atan2(h,o),u=Math.sin((1-e)*l)/h,c=Math.sin(e*l)/h;return this._w=s*u+this._w*c,this._x=i*u+this._x*c,this._y=n*u+this._y*c,this._z=r*u+this._z*c,this._onChangeCallback(),this}slerpQuaternions(t,e,i){return this.copy(t).slerp(e,i)}random(){const t=Math.random(),e=Math.sqrt(1-t),i=Math.sqrt(t),n=2*Math.PI*Math.random(),r=2*Math.PI*Math.random();return this.set(e*Math.cos(n),i*Math.sin(r),i*Math.cos(r),e*Math.sin(n))}equals(t){return t._x===this._x&&t._y===this._y&&t._z===this._z&&t._w===this._w}fromArray(t,e=0){return this._x=t[e],this._y=t[e+1],this._z=t[e+2],this._w=t[e+3],this._onChangeCallback(),this}toArray(t=[],e=0){return t[e]=this._x,t[e+1]=this._y,t[e+2]=this._z,t[e+3]=this._w,t}fromBufferAttribute(t,e){return this._x=t.getX(e),this._y=t.getY(e),this._z=t.getZ(e),this._w=t.getW(e),this}_onChange(t){return this._onChangeCallback=t,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._w}}sn.prototype.isQuaternion=!0;class on{constructor(t=0,e=0,i=0){this.x=t,this.y=e,this.z=i}set(t,e,i){return void 0===i&&(i=this.z),this.x=t,this.y=e,this.z=i,this}setScalar(t){return this.x=t,this.y=t,this.z=t,this}setX(t){return this.x=t,this}setY(t){return this.y=t,this}setZ(t){return this.z=t,this}setComponent(t,e){switch(t){case 0:this.x=e;break;case 1:this.y=e;break;case 2:this.z=e;break;default:throw new Error("index is out of range: "+t)}return this}getComponent(t){switch(t){case 0:return this.x;case 1:return this.y;case 2:return this.z;default:throw new Error("index is out of range: "+t)}}clone(){return new this.constructor(this.x,this.y,this.z)}copy(t){return this.x=t.x,this.y=t.y,this.z=t.z,this}add(t,e){return void 0!==e?this.addVectors(t,e):(this.x+=t.x,this.y+=t.y,this.z+=t.z,this)}addScalar(t){return this.x+=t,this.y+=t,this.z+=t,this}addVectors(t,e){return this.x=t.x+e.x,this.y=t.y+e.y,this.z=t.z+e.z,this}addScaledVector(t,e){return this.x+=t.x*e,this.y+=t.y*e,this.z+=t.z*e,this}sub(t,e){return void 0!==e?this.subVectors(t,e):(this.x-=t.x,this.y-=t.y,this.z-=t.z,this)}subScalar(t){return this.x-=t,this.y-=t,this.z-=t,this}subVectors(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this.z=t.z-e.z,this}multiply(t,e){return void 0!==e?this.multiplyVectors(t,e):(this.x*=t.x,this.y*=t.y,this.z*=t.z,this)}multiplyScalar(t){return this.x*=t,this.y*=t,this.z*=t,this}multiplyVectors(t,e){return this.x=t.x*e.x,this.y=t.y*e.y,this.z=t.z*e.z,this}applyEuler(t){return!t||t.isEuler,this.applyQuaternion(hn.setFromEuler(t))}applyAxisAngle(t,e){return this.applyQuaternion(hn.setFromAxisAngle(t,e))}applyMatrix3(t){const e=this.x,i=this.y,n=this.z,r=t.elements;return this.x=r[0]*e+r[3]*i+r[6]*n,this.y=r[1]*e+r[4]*i+r[7]*n,this.z=r[2]*e+r[5]*i+r[8]*n,this}applyNormalMatrix(t){return this.applyMatrix3(t).normalize()}applyMatrix4(t){const e=this.x,i=this.y,n=this.z,r=t.elements,s=1/(r[3]*e+r[7]*i+r[11]*n+r[15]);return this.x=(r[0]*e+r[4]*i+r[8]*n+r[12])*s,this.y=(r[1]*e+r[5]*i+r[9]*n+r[13])*s,this.z=(r[2]*e+r[6]*i+r[10]*n+r[14])*s,this}applyQuaternion(t){const e=this.x,i=this.y,n=this.z,r=t.x,s=t.y,o=t.z,a=t.w,h=a*e+s*n-o*i,l=a*i+o*e-r*n,u=a*n+r*i-s*e,c=-r*e-s*i-o*n;return this.x=h*a+c*-r+l*-o-u*-s,this.y=l*a+c*-s+u*-r-h*-o,this.z=u*a+c*-o+h*-s-l*-r,this}project(t){return this.applyMatrix4(t.matrixWorldInverse).applyMatrix4(t.projectionMatrix)}unproject(t){return this.applyMatrix4(t.projectionMatrixInverse).applyMatrix4(t.matrixWorld)}transformDirection(t){const e=this.x,i=this.y,n=this.z,r=t.elements;return this.x=r[0]*e+r[4]*i+r[8]*n,this.y=r[1]*e+r[5]*i+r[9]*n,this.z=r[2]*e+r[6]*i+r[10]*n,this.normalize()}divide(t){return this.x/=t.x,this.y/=t.y,this.z/=t.z,this}divideScalar(t){return this.multiplyScalar(1/t)}min(t){return this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y),this.z=Math.min(this.z,t.z),this}max(t){return this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y),this.z=Math.max(this.z,t.z),this}clamp(t,e){return this.x=Math.max(t.x,Math.min(e.x,this.x)),this.y=Math.max(t.y,Math.min(e.y,this.y)),this.z=Math.max(t.z,Math.min(e.z,this.z)),this}clampScalar(t,e){return this.x=Math.max(t,Math.min(e,this.x)),this.y=Math.max(t,Math.min(e,this.y)),this.z=Math.max(t,Math.min(e,this.z)),this}clampLength(t,e){const i=this.length();return this.divideScalar(i||1).multiplyScalar(Math.max(t,Math.min(e,i)))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this}roundToZero(){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(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this}dot(t){return this.x*t.x+this.y*t.y+this.z*t.z}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)}normalize(){return this.divideScalar(this.length()||1)}setLength(t){return this.normalize().multiplyScalar(t)}lerp(t,e){return this.x+=(t.x-this.x)*e,this.y+=(t.y-this.y)*e,this.z+=(t.z-this.z)*e,this}lerpVectors(t,e,i){return this.x=t.x+(e.x-t.x)*i,this.y=t.y+(e.y-t.y)*i,this.z=t.z+(e.z-t.z)*i,this}cross(t,e){return void 0!==e?this.crossVectors(t,e):this.crossVectors(this,t)}crossVectors(t,e){const i=t.x,n=t.y,r=t.z,s=e.x,o=e.y,a=e.z;return this.x=n*a-r*o,this.y=r*s-i*a,this.z=i*o-n*s,this}projectOnVector(t){const e=t.lengthSq();if(0===e)return this.set(0,0,0);const i=t.dot(this)/e;return this.copy(t).multiplyScalar(i)}projectOnPlane(t){return an.copy(this).projectOnVector(t),this.sub(an)}reflect(t){return this.sub(an.copy(t).multiplyScalar(2*this.dot(t)))}angleTo(t){const e=Math.sqrt(this.lengthSq()*t.lengthSq());if(0===e)return Math.PI/2;const i=this.dot(t)/e;return Math.acos(bi(i,-1,1))}distanceTo(t){return Math.sqrt(this.distanceToSquared(t))}distanceToSquared(t){const e=this.x-t.x,i=this.y-t.y,n=this.z-t.z;return e*e+i*i+n*n}manhattanDistanceTo(t){return Math.abs(this.x-t.x)+Math.abs(this.y-t.y)+Math.abs(this.z-t.z)}setFromSpherical(t){return this.setFromSphericalCoords(t.radius,t.phi,t.theta)}setFromSphericalCoords(t,e,i){const n=Math.sin(e)*t;return this.x=n*Math.sin(i),this.y=Math.cos(e)*t,this.z=n*Math.cos(i),this}setFromCylindrical(t){return this.setFromCylindricalCoords(t.radius,t.theta,t.y)}setFromCylindricalCoords(t,e,i){return this.x=t*Math.sin(e),this.y=i,this.z=t*Math.cos(e),this}setFromMatrixPosition(t){const e=t.elements;return this.x=e[12],this.y=e[13],this.z=e[14],this}setFromMatrixScale(t){const e=this.setFromMatrixColumn(t,0).length(),i=this.setFromMatrixColumn(t,1).length(),n=this.setFromMatrixColumn(t,2).length();return this.x=e,this.y=i,this.z=n,this}setFromMatrixColumn(t,e){return this.fromArray(t.elements,4*e)}setFromMatrix3Column(t,e){return this.fromArray(t.elements,3*e)}setFromEuler(t){return this.x=t._x,this.y=t._y,this.z=t._z,this}equals(t){return t.x===this.x&&t.y===this.y&&t.z===this.z}fromArray(t,e=0){return this.x=t[e],this.y=t[e+1],this.z=t[e+2],this}toArray(t=[],e=0){return t[e]=this.x,t[e+1]=this.y,t[e+2]=this.z,t}fromBufferAttribute(t,e,i){return this.x=t.getX(e),this.y=t.getY(e),this.z=t.getZ(e),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this}randomDirection(){const t=2*(Math.random()-.5),e=Math.random()*Math.PI*2,i=Math.sqrt(1-t**2);return this.x=i*Math.cos(e),this.y=i*Math.sin(e),this.z=t,this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z}}on.prototype.isVector3=!0;const an=new on,hn=new sn;class ln{constructor(t=new on(1/0,1/0,1/0),e=new on(-1/0,-1/0,-1/0)){this.min=t,this.max=e}set(t,e){return this.min.copy(t),this.max.copy(e),this}setFromArray(t){let e=1/0,i=1/0,n=1/0,r=-1/0,s=-1/0,o=-1/0;for(let a=0,h=t.length;ar&&(r=h),l>s&&(s=l),u>o&&(o=u)}return this.min.set(e,i,n),this.max.set(r,s,o),this}setFromBufferAttribute(t){let e=1/0,i=1/0,n=1/0,r=-1/0,s=-1/0,o=-1/0;for(let a=0,h=t.count;ar&&(r=h),l>s&&(s=l),u>o&&(o=u)}return this.min.set(e,i,n),this.max.set(r,s,o),this}setFromPoints(t){this.makeEmpty();for(let e=0,i=t.length;ethis.max.x||t.ythis.max.y||t.zthis.max.z)}containsBox(t){return this.min.x<=t.min.x&&t.max.x<=this.max.x&&this.min.y<=t.min.y&&t.max.y<=this.max.y&&this.min.z<=t.min.z&&t.max.z<=this.max.z}getParameter(t,e){return e.set((t.x-this.min.x)/(this.max.x-this.min.x),(t.y-this.min.y)/(this.max.y-this.min.y),(t.z-this.min.z)/(this.max.z-this.min.z))}intersectsBox(t){return!(t.max.xthis.max.x||t.max.ythis.max.y||t.max.zthis.max.z)}intersectsSphere(t){return this.clampPoint(t.center,cn),cn.distanceToSquared(t.center)<=t.radius*t.radius}intersectsPlane(t){let e,i;return t.normal.x>0?(e=t.normal.x*this.min.x,i=t.normal.x*this.max.x):(e=t.normal.x*this.max.x,i=t.normal.x*this.min.x),t.normal.y>0?(e+=t.normal.y*this.min.y,i+=t.normal.y*this.max.y):(e+=t.normal.y*this.max.y,i+=t.normal.y*this.min.y),t.normal.z>0?(e+=t.normal.z*this.min.z,i+=t.normal.z*this.max.z):(e+=t.normal.z*this.max.z,i+=t.normal.z*this.min.z),e<=-t.constant&&i>=-t.constant}intersectsTriangle(t){if(this.isEmpty())return!1;this.getCenter(xn),wn.subVectors(this.max,xn),pn.subVectors(t.a,xn),fn.subVectors(t.b,xn),mn.subVectors(t.c,xn),gn.subVectors(fn,pn),vn.subVectors(mn,fn),yn.subVectors(pn,mn);let e=[0,-gn.z,gn.y,0,-vn.z,vn.y,0,-yn.z,yn.y,gn.z,0,-gn.x,vn.z,0,-vn.x,yn.z,0,-yn.x,-gn.y,gn.x,0,-vn.y,vn.x,0,-yn.y,yn.x,0];return!!Tn(e,pn,fn,mn,wn)&&(e=[1,0,0,0,1,0,0,0,1],!!Tn(e,pn,fn,mn,wn)&&(bn.crossVectors(gn,vn),e=[bn.x,bn.y,bn.z],Tn(e,pn,fn,mn,wn)))}clampPoint(t,e){return e.copy(t).clamp(this.min,this.max)}distanceToPoint(t){return cn.copy(t).clamp(this.min,this.max).sub(t).length()}getBoundingSphere(t){return this.getCenter(t.center),t.radius=.5*this.getSize(cn).length(),t}intersect(t){return this.min.max(t.min),this.max.min(t.max),this.isEmpty()&&this.makeEmpty(),this}union(t){return this.min.min(t.min),this.max.max(t.max),this}applyMatrix4(t){return this.isEmpty()||(un[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(t),un[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(t),un[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(t),un[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(t),un[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(t),un[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(t),un[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(t),un[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(t),this.setFromPoints(un)),this}translate(t){return this.min.add(t),this.max.add(t),this}equals(t){return t.min.equals(this.min)&&t.max.equals(this.max)}}ln.prototype.isBox3=!0;const un=[new on,new on,new on,new on,new on,new on,new on,new on],cn=new on,dn=new ln,pn=new on,fn=new on,mn=new on,gn=new on,vn=new on,yn=new on,xn=new on,wn=new on,bn=new on,An=new on;function Tn(t,e,i,n,r){for(let s=0,o=t.length-3;s<=o;s+=3){An.fromArray(t,s);const o=r.x*Math.abs(An.x)+r.y*Math.abs(An.y)+r.z*Math.abs(An.z),a=e.dot(An),h=i.dot(An),l=n.dot(An);if(Math.max(-Math.max(a,h,l),Math.min(a,h,l))>o)return!1}return!0}const Sn=new ln,En=new on,Mn=new on,_n=new on;class Cn{constructor(t=new on,e=-1){this.center=t,this.radius=e}set(t,e){return this.center.copy(t),this.radius=e,this}setFromPoints(t,e){const i=this.center;void 0!==e?i.copy(e):Sn.setFromPoints(t).getCenter(i);let n=0;for(let e=0,r=t.length;ethis.radius*this.radius&&(e.sub(this.center).normalize(),e.multiplyScalar(this.radius).add(this.center)),e}getBoundingBox(t){return this.isEmpty()?(t.makeEmpty(),t):(t.set(this.center,this.center),t.expandByScalar(this.radius),t)}applyMatrix4(t){return this.center.applyMatrix4(t),this.radius=this.radius*t.getMaxScaleOnAxis(),this}translate(t){return this.center.add(t),this}expandByPoint(t){_n.subVectors(t,this.center);const e=_n.lengthSq();if(e>this.radius*this.radius){const t=Math.sqrt(e),i=.5*(t-this.radius);this.center.add(_n.multiplyScalar(i/t)),this.radius+=i}return this}union(t){return!0===this.center.equals(t.center)?Mn.set(0,0,1).multiplyScalar(t.radius):Mn.subVectors(t.center,this.center).normalize().multiplyScalar(t.radius),this.expandByPoint(En.copy(t.center).add(Mn)),this.expandByPoint(En.copy(t.center).sub(Mn)),this}equals(t){return t.center.equals(this.center)&&t.radius===this.radius}clone(){return(new this.constructor).copy(this)}}const Pn=new on,Rn=new on,Ln=new on,On=new on,Dn=new on,Bn=new on,In=new on;class Fn{constructor(t=new on,e=new on(0,0,-1)){this.origin=t,this.direction=e}set(t,e){return this.origin.copy(t),this.direction.copy(e),this}copy(t){return this.origin.copy(t.origin),this.direction.copy(t.direction),this}at(t,e){return e.copy(this.direction).multiplyScalar(t).add(this.origin)}lookAt(t){return this.direction.copy(t).sub(this.origin).normalize(),this}recast(t){return this.origin.copy(this.at(t,Pn)),this}closestPointToPoint(t,e){e.subVectors(t,this.origin);const i=e.dot(this.direction);return i<0?e.copy(this.origin):e.copy(this.direction).multiplyScalar(i).add(this.origin)}distanceToPoint(t){return Math.sqrt(this.distanceSqToPoint(t))}distanceSqToPoint(t){const e=Pn.subVectors(t,this.origin).dot(this.direction);return e<0?this.origin.distanceToSquared(t):(Pn.copy(this.direction).multiplyScalar(e).add(this.origin),Pn.distanceToSquared(t))}distanceSqToSegment(t,e,i,n){Rn.copy(t).add(e).multiplyScalar(.5),Ln.copy(e).sub(t).normalize(),On.copy(this.origin).sub(Rn);const r=.5*t.distanceTo(e),s=-this.direction.dot(Ln),o=On.dot(this.direction),a=-On.dot(Ln),h=On.lengthSq(),l=Math.abs(1-s*s);let u,c,d,p;if(l>0)if(u=s*a-o,c=s*o-a,p=r*l,u>=0)if(c>=-p)if(c<=p){const t=1/l;u*=t,c*=t,d=u*(u+s*c+2*o)+c*(s*u+c+2*a)+h}else c=r,u=Math.max(0,-(s*c+o)),d=-u*u+c*(c+2*a)+h;else c=-r,u=Math.max(0,-(s*c+o)),d=-u*u+c*(c+2*a)+h;else c<=-p?(u=Math.max(0,-(-s*r+o)),c=u>0?-r:Math.min(Math.max(-r,-a),r),d=-u*u+c*(c+2*a)+h):c<=p?(u=0,c=Math.min(Math.max(-r,-a),r),d=c*(c+2*a)+h):(u=Math.max(0,-(s*r+o)),c=u>0?r:Math.min(Math.max(-r,-a),r),d=-u*u+c*(c+2*a)+h);else c=s>0?-r:r,u=Math.max(0,-(s*c+o)),d=-u*u+c*(c+2*a)+h;return i&&i.copy(this.direction).multiplyScalar(u).add(this.origin),n&&n.copy(Ln).multiplyScalar(c).add(Rn),d}intersectSphere(t,e){Pn.subVectors(t.center,this.origin);const i=Pn.dot(this.direction),n=Pn.dot(Pn)-i*i,r=t.radius*t.radius;if(n>r)return null;const s=Math.sqrt(r-n),o=i-s,a=i+s;return o<0&&a<0?null:o<0?this.at(a,e):this.at(o,e)}intersectsSphere(t){return this.distanceSqToPoint(t.center)<=t.radius*t.radius}distanceToPlane(t){const e=t.normal.dot(this.direction);if(0===e)return 0===t.distanceToPoint(this.origin)?0:null;const i=-(this.origin.dot(t.normal)+t.constant)/e;return i>=0?i:null}intersectPlane(t,e){const i=this.distanceToPlane(t);return null===i?null:this.at(i,e)}intersectsPlane(t){const e=t.distanceToPoint(this.origin);if(0===e)return!0;return t.normal.dot(this.direction)*e<0}intersectBox(t,e){let i,n,r,s,o,a;const h=1/this.direction.x,l=1/this.direction.y,u=1/this.direction.z,c=this.origin;return h>=0?(i=(t.min.x-c.x)*h,n=(t.max.x-c.x)*h):(i=(t.max.x-c.x)*h,n=(t.min.x-c.x)*h),l>=0?(r=(t.min.y-c.y)*l,s=(t.max.y-c.y)*l):(r=(t.max.y-c.y)*l,s=(t.min.y-c.y)*l),i>s||r>n?null:((r>i||i!=i)&&(i=r),(s=0?(o=(t.min.z-c.z)*u,a=(t.max.z-c.z)*u):(o=(t.max.z-c.z)*u,a=(t.min.z-c.z)*u),i>a||o>n?null:((o>i||i!=i)&&(i=o),(a=0?i:n,e)))}intersectsBox(t){return null!==this.intersectBox(t,Pn)}intersectTriangle(t,e,i,n,r){Dn.subVectors(e,t),Bn.subVectors(i,t),In.crossVectors(Dn,Bn);let s,o=this.direction.dot(In);if(o>0){if(n)return null;s=1}else{if(!(o<0))return null;s=-1,o=-o}On.subVectors(this.origin,t);const a=s*this.direction.dot(Bn.crossVectors(On,Bn));if(a<0)return null;const h=s*this.direction.dot(Dn.cross(On));if(h<0)return null;if(a+h>o)return null;const l=-s*On.dot(In);return l<0?null:this.at(l/o,r)}applyMatrix4(t){return this.origin.applyMatrix4(t),this.direction.transformDirection(t),this}equals(t){return t.origin.equals(this.origin)&&t.direction.equals(this.direction)}clone(){return(new this.constructor).copy(this)}}class kn{constructor(){this.elements=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1]}set(t,e,i,n,r,s,o,a,h,l,u,c,d,p,f,m){const g=this.elements;return g[0]=t,g[4]=e,g[8]=i,g[12]=n,g[1]=r,g[5]=s,g[9]=o,g[13]=a,g[2]=h,g[6]=l,g[10]=u,g[14]=c,g[3]=d,g[7]=p,g[11]=f,g[15]=m,this}identity(){return this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1),this}clone(){return(new kn).fromArray(this.elements)}copy(t){const e=this.elements,i=t.elements;return e[0]=i[0],e[1]=i[1],e[2]=i[2],e[3]=i[3],e[4]=i[4],e[5]=i[5],e[6]=i[6],e[7]=i[7],e[8]=i[8],e[9]=i[9],e[10]=i[10],e[11]=i[11],e[12]=i[12],e[13]=i[13],e[14]=i[14],e[15]=i[15],this}copyPosition(t){const e=this.elements,i=t.elements;return e[12]=i[12],e[13]=i[13],e[14]=i[14],this}setFromMatrix3(t){const e=t.elements;return this.set(e[0],e[3],e[6],0,e[1],e[4],e[7],0,e[2],e[5],e[8],0,0,0,0,1),this}extractBasis(t,e,i){return t.setFromMatrixColumn(this,0),e.setFromMatrixColumn(this,1),i.setFromMatrixColumn(this,2),this}makeBasis(t,e,i){return this.set(t.x,e.x,i.x,0,t.y,e.y,i.y,0,t.z,e.z,i.z,0,0,0,0,1),this}extractRotation(t){const e=this.elements,i=t.elements,n=1/Nn.setFromMatrixColumn(t,0).length(),r=1/Nn.setFromMatrixColumn(t,1).length(),s=1/Nn.setFromMatrixColumn(t,2).length();return e[0]=i[0]*n,e[1]=i[1]*n,e[2]=i[2]*n,e[3]=0,e[4]=i[4]*r,e[5]=i[5]*r,e[6]=i[6]*r,e[7]=0,e[8]=i[8]*s,e[9]=i[9]*s,e[10]=i[10]*s,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,this}makeRotationFromEuler(t){!t||t.isEuler;const e=this.elements,i=t.x,n=t.y,r=t.z,s=Math.cos(i),o=Math.sin(i),a=Math.cos(n),h=Math.sin(n),l=Math.cos(r),u=Math.sin(r);if("XYZ"===t.order){const t=s*l,i=s*u,n=o*l,r=o*u;e[0]=a*l,e[4]=-a*u,e[8]=h,e[1]=i+n*h,e[5]=t-r*h,e[9]=-o*a,e[2]=r-t*h,e[6]=n+i*h,e[10]=s*a}else if("YXZ"===t.order){const t=a*l,i=a*u,n=h*l,r=h*u;e[0]=t+r*o,e[4]=n*o-i,e[8]=s*h,e[1]=s*u,e[5]=s*l,e[9]=-o,e[2]=i*o-n,e[6]=r+t*o,e[10]=s*a}else if("ZXY"===t.order){const t=a*l,i=a*u,n=h*l,r=h*u;e[0]=t-r*o,e[4]=-s*u,e[8]=n+i*o,e[1]=i+n*o,e[5]=s*l,e[9]=r-t*o,e[2]=-s*h,e[6]=o,e[10]=s*a}else if("ZYX"===t.order){const t=s*l,i=s*u,n=o*l,r=o*u;e[0]=a*l,e[4]=n*h-i,e[8]=t*h+r,e[1]=a*u,e[5]=r*h+t,e[9]=i*h-n,e[2]=-h,e[6]=o*a,e[10]=s*a}else if("YZX"===t.order){const t=s*a,i=s*h,n=o*a,r=o*h;e[0]=a*l,e[4]=r-t*u,e[8]=n*u+i,e[1]=u,e[5]=s*l,e[9]=-o*l,e[2]=-h*l,e[6]=i*u+n,e[10]=t-r*u}else if("XZY"===t.order){const t=s*a,i=s*h,n=o*a,r=o*h;e[0]=a*l,e[4]=-u,e[8]=h*l,e[1]=t*u+r,e[5]=s*l,e[9]=i*u-n,e[2]=n*u-i,e[6]=o*l,e[10]=r*u+t}return e[3]=0,e[7]=0,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,this}makeRotationFromQuaternion(t){return this.compose(Un,t,Vn)}lookAt(t,e,i){const n=this.elements;return Wn.subVectors(t,e),0===Wn.lengthSq()&&(Wn.z=1),Wn.normalize(),Hn.crossVectors(i,Wn),0===Hn.lengthSq()&&(1===Math.abs(i.z)?Wn.x+=1e-4:Wn.z+=1e-4,Wn.normalize(),Hn.crossVectors(i,Wn)),Hn.normalize(),Gn.crossVectors(Wn,Hn),n[0]=Hn.x,n[4]=Gn.x,n[8]=Wn.x,n[1]=Hn.y,n[5]=Gn.y,n[9]=Wn.y,n[2]=Hn.z,n[6]=Gn.z,n[10]=Wn.z,this}multiply(t,e){return void 0!==e?this.multiplyMatrices(t,e):this.multiplyMatrices(this,t)}premultiply(t){return this.multiplyMatrices(t,this)}multiplyMatrices(t,e){const i=t.elements,n=e.elements,r=this.elements,s=i[0],o=i[4],a=i[8],h=i[12],l=i[1],u=i[5],c=i[9],d=i[13],p=i[2],f=i[6],m=i[10],g=i[14],v=i[3],y=i[7],x=i[11],w=i[15],b=n[0],A=n[4],T=n[8],S=n[12],E=n[1],M=n[5],_=n[9],C=n[13],P=n[2],R=n[6],L=n[10],O=n[14],D=n[3],B=n[7],I=n[11],F=n[15];return r[0]=s*b+o*E+a*P+h*D,r[4]=s*A+o*M+a*R+h*B,r[8]=s*T+o*_+a*L+h*I,r[12]=s*S+o*C+a*O+h*F,r[1]=l*b+u*E+c*P+d*D,r[5]=l*A+u*M+c*R+d*B,r[9]=l*T+u*_+c*L+d*I,r[13]=l*S+u*C+c*O+d*F,r[2]=p*b+f*E+m*P+g*D,r[6]=p*A+f*M+m*R+g*B,r[10]=p*T+f*_+m*L+g*I,r[14]=p*S+f*C+m*O+g*F,r[3]=v*b+y*E+x*P+w*D,r[7]=v*A+y*M+x*R+w*B,r[11]=v*T+y*_+x*L+w*I,r[15]=v*S+y*C+x*O+w*F,this}multiplyScalar(t){const e=this.elements;return e[0]*=t,e[4]*=t,e[8]*=t,e[12]*=t,e[1]*=t,e[5]*=t,e[9]*=t,e[13]*=t,e[2]*=t,e[6]*=t,e[10]*=t,e[14]*=t,e[3]*=t,e[7]*=t,e[11]*=t,e[15]*=t,this}determinant(){const t=this.elements,e=t[0],i=t[4],n=t[8],r=t[12],s=t[1],o=t[5],a=t[9],h=t[13],l=t[2],u=t[6],c=t[10],d=t[14];return t[3]*(+r*a*u-n*h*u-r*o*c+i*h*c+n*o*d-i*a*d)+t[7]*(+e*a*d-e*h*c+r*s*c-n*s*d+n*h*l-r*a*l)+t[11]*(+e*h*u-e*o*d-r*s*u+i*s*d+r*o*l-i*h*l)+t[15]*(-n*o*l-e*a*u+e*o*c+n*s*u-i*s*c+i*a*l)}transpose(){const t=this.elements;let e;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(t,e,i){const n=this.elements;return t.isVector3?(n[12]=t.x,n[13]=t.y,n[14]=t.z):(n[12]=t,n[13]=e,n[14]=i),this}invert(){const t=this.elements,e=t[0],i=t[1],n=t[2],r=t[3],s=t[4],o=t[5],a=t[6],h=t[7],l=t[8],u=t[9],c=t[10],d=t[11],p=t[12],f=t[13],m=t[14],g=t[15],v=u*m*h-f*c*h+f*a*d-o*m*d-u*a*g+o*c*g,y=p*c*h-l*m*h-p*a*d+s*m*d+l*a*g-s*c*g,x=l*f*h-p*u*h+p*o*d-s*f*d-l*o*g+s*u*g,w=p*u*a-l*f*a-p*o*c+s*f*c+l*o*m-s*u*m,b=e*v+i*y+n*x+r*w;if(0===b)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);const A=1/b;return t[0]=v*A,t[1]=(f*c*r-u*m*r-f*n*d+i*m*d+u*n*g-i*c*g)*A,t[2]=(o*m*r-f*a*r+f*n*h-i*m*h-o*n*g+i*a*g)*A,t[3]=(u*a*r-o*c*r-u*n*h+i*c*h+o*n*d-i*a*d)*A,t[4]=y*A,t[5]=(l*m*r-p*c*r+p*n*d-e*m*d-l*n*g+e*c*g)*A,t[6]=(p*a*r-s*m*r-p*n*h+e*m*h+s*n*g-e*a*g)*A,t[7]=(s*c*r-l*a*r+l*n*h-e*c*h-s*n*d+e*a*d)*A,t[8]=x*A,t[9]=(p*u*r-l*f*r-p*i*d+e*f*d+l*i*g-e*u*g)*A,t[10]=(s*f*r-p*o*r+p*i*h-e*f*h-s*i*g+e*o*g)*A,t[11]=(l*o*r-s*u*r-l*i*h+e*u*h+s*i*d-e*o*d)*A,t[12]=w*A,t[13]=(l*f*n-p*u*n+p*i*c-e*f*c-l*i*m+e*u*m)*A,t[14]=(p*o*n-s*f*n-p*i*a+e*f*a+s*i*m-e*o*m)*A,t[15]=(s*u*n-l*o*n+l*i*a-e*u*a-s*i*c+e*o*c)*A,this}scale(t){const e=this.elements,i=t.x,n=t.y,r=t.z;return e[0]*=i,e[4]*=n,e[8]*=r,e[1]*=i,e[5]*=n,e[9]*=r,e[2]*=i,e[6]*=n,e[10]*=r,e[3]*=i,e[7]*=n,e[11]*=r,this}getMaxScaleOnAxis(){const t=this.elements,e=t[0]*t[0]+t[1]*t[1]+t[2]*t[2],i=t[4]*t[4]+t[5]*t[5]+t[6]*t[6],n=t[8]*t[8]+t[9]*t[9]+t[10]*t[10];return Math.sqrt(Math.max(e,i,n))}makeTranslation(t,e,i){return this.set(1,0,0,t,0,1,0,e,0,0,1,i,0,0,0,1),this}makeRotationX(t){const e=Math.cos(t),i=Math.sin(t);return this.set(1,0,0,0,0,e,-i,0,0,i,e,0,0,0,0,1),this}makeRotationY(t){const e=Math.cos(t),i=Math.sin(t);return this.set(e,0,i,0,0,1,0,0,-i,0,e,0,0,0,0,1),this}makeRotationZ(t){const e=Math.cos(t),i=Math.sin(t);return this.set(e,-i,0,0,i,e,0,0,0,0,1,0,0,0,0,1),this}makeRotationAxis(t,e){const i=Math.cos(e),n=Math.sin(e),r=1-i,s=t.x,o=t.y,a=t.z,h=r*s,l=r*o;return this.set(h*s+i,h*o-n*a,h*a+n*o,0,h*o+n*a,l*o+i,l*a-n*s,0,h*a-n*o,l*a+n*s,r*a*a+i,0,0,0,0,1),this}makeScale(t,e,i){return this.set(t,0,0,0,0,e,0,0,0,0,i,0,0,0,0,1),this}makeShear(t,e,i,n,r,s){return this.set(1,i,r,0,t,1,s,0,e,n,1,0,0,0,0,1),this}compose(t,e,i){const n=this.elements,r=e._x,s=e._y,o=e._z,a=e._w,h=r+r,l=s+s,u=o+o,c=r*h,d=r*l,p=r*u,f=s*l,m=s*u,g=o*u,v=a*h,y=a*l,x=a*u,w=i.x,b=i.y,A=i.z;return n[0]=(1-(f+g))*w,n[1]=(d+x)*w,n[2]=(p-y)*w,n[3]=0,n[4]=(d-x)*b,n[5]=(1-(c+g))*b,n[6]=(m+v)*b,n[7]=0,n[8]=(p+y)*A,n[9]=(m-v)*A,n[10]=(1-(c+f))*A,n[11]=0,n[12]=t.x,n[13]=t.y,n[14]=t.z,n[15]=1,this}decompose(t,e,i){const n=this.elements;let r=Nn.set(n[0],n[1],n[2]).length();const s=Nn.set(n[4],n[5],n[6]).length(),o=Nn.set(n[8],n[9],n[10]).length();this.determinant()<0&&(r=-r),t.x=n[12],t.y=n[13],t.z=n[14],zn.copy(this);const a=1/r,h=1/s,l=1/o;return zn.elements[0]*=a,zn.elements[1]*=a,zn.elements[2]*=a,zn.elements[4]*=h,zn.elements[5]*=h,zn.elements[6]*=h,zn.elements[8]*=l,zn.elements[9]*=l,zn.elements[10]*=l,e.setFromRotationMatrix(zn),i.x=r,i.y=s,i.z=o,this}makePerspective(t,e,i,n,r,s){const o=this.elements,a=2*r/(e-t),h=2*r/(i-n),l=(e+t)/(e-t),u=(i+n)/(i-n),c=-(s+r)/(s-r),d=-2*s*r/(s-r);return o[0]=a,o[4]=0,o[8]=l,o[12]=0,o[1]=0,o[5]=h,o[9]=u,o[13]=0,o[2]=0,o[6]=0,o[10]=c,o[14]=d,o[3]=0,o[7]=0,o[11]=-1,o[15]=0,this}makeOrthographic(t,e,i,n,r,s){const o=this.elements,a=1/(e-t),h=1/(i-n),l=1/(s-r),u=(e+t)*a,c=(i+n)*h,d=(s+r)*l;return o[0]=2*a,o[4]=0,o[8]=0,o[12]=-u,o[1]=0,o[5]=2*h,o[9]=0,o[13]=-c,o[2]=0,o[6]=0,o[10]=-2*l,o[14]=-d,o[3]=0,o[7]=0,o[11]=0,o[15]=1,this}equals(t){const e=this.elements,i=t.elements;for(let t=0;t<16;t++)if(e[t]!==i[t])return!1;return!0}fromArray(t,e=0){for(let i=0;i<16;i++)this.elements[i]=t[i+e];return this}toArray(t=[],e=0){const i=this.elements;return t[e]=i[0],t[e+1]=i[1],t[e+2]=i[2],t[e+3]=i[3],t[e+4]=i[4],t[e+5]=i[5],t[e+6]=i[6],t[e+7]=i[7],t[e+8]=i[8],t[e+9]=i[9],t[e+10]=i[10],t[e+11]=i[11],t[e+12]=i[12],t[e+13]=i[13],t[e+14]=i[14],t[e+15]=i[15],t}}kn.prototype.isMatrix4=!0;const Nn=new on,zn=new kn,Un=new on(0,0,0),Vn=new on(1,1,1),Hn=new on,Gn=new on,Wn=new on,Yn=new kn,Xn=new sn;class jn{constructor(t=0,e=0,i=0,n=jn.DefaultOrder){this._x=t,this._y=e,this._z=i,this._order=n}get x(){return this._x}set x(t){this._x=t,this._onChangeCallback()}get y(){return this._y}set y(t){this._y=t,this._onChangeCallback()}get z(){return this._z}set z(t){this._z=t,this._onChangeCallback()}get order(){return this._order}set order(t){this._order=t,this._onChangeCallback()}set(t,e,i,n=this._order){return this._x=t,this._y=e,this._z=i,this._order=n,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._order)}copy(t){return this._x=t._x,this._y=t._y,this._z=t._z,this._order=t._order,this._onChangeCallback(),this}setFromRotationMatrix(t,e=this._order,i=!0){const n=t.elements,r=n[0],s=n[4],o=n[8],a=n[1],h=n[5],l=n[9],u=n[2],c=n[6],d=n[10];switch(e){case"XYZ":this._y=Math.asin(bi(o,-1,1)),Math.abs(o)<.9999999?(this._x=Math.atan2(-l,d),this._z=Math.atan2(-s,r)):(this._x=Math.atan2(c,h),this._z=0);break;case"YXZ":this._x=Math.asin(-bi(l,-1,1)),Math.abs(l)<.9999999?(this._y=Math.atan2(o,d),this._z=Math.atan2(a,h)):(this._y=Math.atan2(-u,r),this._z=0);break;case"ZXY":this._x=Math.asin(bi(c,-1,1)),Math.abs(c)<.9999999?(this._y=Math.atan2(-u,d),this._z=Math.atan2(-s,h)):(this._y=0,this._z=Math.atan2(a,r));break;case"ZYX":this._y=Math.asin(-bi(u,-1,1)),Math.abs(u)<.9999999?(this._x=Math.atan2(c,d),this._z=Math.atan2(a,r)):(this._x=0,this._z=Math.atan2(-s,h));break;case"YZX":this._z=Math.asin(bi(a,-1,1)),Math.abs(a)<.9999999?(this._x=Math.atan2(-l,h),this._y=Math.atan2(-u,r)):(this._x=0,this._y=Math.atan2(o,d));break;case"XZY":this._z=Math.asin(-bi(s,-1,1)),Math.abs(s)<.9999999?(this._x=Math.atan2(c,h),this._y=Math.atan2(o,r)):(this._x=Math.atan2(-l,d),this._y=0)}return this._order=e,!0===i&&this._onChangeCallback(),this}setFromQuaternion(t,e,i){return Yn.makeRotationFromQuaternion(t),this.setFromRotationMatrix(Yn,e,i)}setFromVector3(t,e=this._order){return this.set(t.x,t.y,t.z,e)}reorder(t){return Xn.setFromEuler(this),this.setFromQuaternion(Xn,t)}equals(t){return t._x===this._x&&t._y===this._y&&t._z===this._z&&t._order===this._order}fromArray(t){return this._x=t[0],this._y=t[1],this._z=t[2],void 0!==t[3]&&(this._order=t[3]),this._onChangeCallback(),this}toArray(t=[],e=0){return t[e]=this._x,t[e+1]=this._y,t[e+2]=this._z,t[e+3]=this._order,t}_onChange(t){return this._onChangeCallback=t,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._order}}jn.prototype.isEuler=!0,jn.DefaultOrder="XYZ",jn.RotationOrders=["XYZ","YZX","ZXY","XZY","YXZ","ZYX"];class qn{constructor(){this.mask=1}set(t){this.mask=(1<>>0}enable(t){this.mask|=1<1){for(let t=0;t1){for(let t=0;t0){n.children=[];for(let e=0;e0){n.animations=[];for(let e=0;e0&&(i.geometries=e),n.length>0&&(i.materials=n),r.length>0&&(i.textures=r),o.length>0&&(i.images=o),a.length>0&&(i.shapes=a),h.length>0&&(i.skeletons=h),l.length>0&&(i.animations=l),u.length>0&&(i.nodes=u)}return i.object=n,i;function s(t){const e=[];for(const i in t){const n=t[i];delete n.metadata,e.push(n)}return e}}clone(t){return(new this.constructor).copy(this,t)}copy(t,e=!0){if(this.name=t.name,this.up.copy(t.up),this.position.copy(t.position),this.rotation.order=t.rotation.order,this.quaternion.copy(t.quaternion),this.scale.copy(t.scale),this.matrix.copy(t.matrix),this.matrixWorld.copy(t.matrixWorld),this.matrixAutoUpdate=t.matrixAutoUpdate,this.matrixWorldNeedsUpdate=t.matrixWorldNeedsUpdate,this.layers.mask=t.layers.mask,this.visible=t.visible,this.castShadow=t.castShadow,this.receiveShadow=t.receiveShadow,this.frustumCulled=t.frustumCulled,this.renderOrder=t.renderOrder,this.userData=JSON.parse(JSON.stringify(t.userData)),!0===e)for(let e=0;e0?n.multiplyScalar(1/Math.sqrt(r)):n.set(0,0,0)}static getBarycoord(t,e,i,n,r){lr.subVectors(n,e),ur.subVectors(i,e),cr.subVectors(t,e);const s=lr.dot(lr),o=lr.dot(ur),a=lr.dot(cr),h=ur.dot(ur),l=ur.dot(cr),u=s*h-o*o;if(0===u)return r.set(-2,-1,-1);const c=1/u,d=(h*a-o*l)*c,p=(s*l-o*a)*c;return r.set(1-d-p,p,d)}static containsPoint(t,e,i,n){return this.getBarycoord(t,e,i,n,dr),dr.x>=0&&dr.y>=0&&dr.x+dr.y<=1}static getUV(t,e,i,n,r,s,o,a){return this.getBarycoord(t,e,i,n,dr),a.set(0,0),a.addScaledVector(r,dr.x),a.addScaledVector(s,dr.y),a.addScaledVector(o,dr.z),a}static isFrontFacing(t,e,i,n){return lr.subVectors(i,e),ur.subVectors(t,e),lr.cross(ur).dot(n)<0}set(t,e,i){return this.a.copy(t),this.b.copy(e),this.c.copy(i),this}setFromPointsAndIndices(t,e,i,n){return this.a.copy(t[e]),this.b.copy(t[i]),this.c.copy(t[n]),this}setFromAttributeAndIndices(t,e,i,n){return this.a.fromBufferAttribute(t,e),this.b.fromBufferAttribute(t,i),this.c.fromBufferAttribute(t,n),this}clone(){return(new this.constructor).copy(this)}copy(t){return this.a.copy(t.a),this.b.copy(t.b),this.c.copy(t.c),this}getArea(){return lr.subVectors(this.c,this.b),ur.subVectors(this.a,this.b),.5*lr.cross(ur).length()}getMidpoint(t){return t.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)}getNormal(t){return xr.getNormal(this.a,this.b,this.c,t)}getPlane(t){return t.setFromCoplanarPoints(this.a,this.b,this.c)}getBarycoord(t,e){return xr.getBarycoord(t,this.a,this.b,this.c,e)}getUV(t,e,i,n,r){return xr.getUV(t,this.a,this.b,this.c,e,i,n,r)}containsPoint(t){return xr.containsPoint(t,this.a,this.b,this.c)}isFrontFacing(t){return xr.isFrontFacing(this.a,this.b,this.c,t)}intersectsBox(t){return t.intersectsTriangle(this)}closestPointToPoint(t,e){const i=this.a,n=this.b,r=this.c;let s,o;pr.subVectors(n,i),fr.subVectors(r,i),gr.subVectors(t,i);const a=pr.dot(gr),h=fr.dot(gr);if(a<=0&&h<=0)return e.copy(i);vr.subVectors(t,n);const l=pr.dot(vr),u=fr.dot(vr);if(l>=0&&u<=l)return e.copy(n);const c=a*u-l*h;if(c<=0&&a>=0&&l<=0)return s=a/(a-l),e.copy(i).addScaledVector(pr,s);yr.subVectors(t,r);const d=pr.dot(yr),p=fr.dot(yr);if(p>=0&&d<=p)return e.copy(r);const f=d*h-a*p;if(f<=0&&h>=0&&p<=0)return o=h/(h-p),e.copy(i).addScaledVector(fr,o);const m=l*p-d*u;if(m<=0&&u-l>=0&&d-p>=0)return mr.subVectors(r,n),o=(u-l)/(u-l+(d-p)),e.copy(n).addScaledVector(mr,o);const g=1/(m+f+c);return s=f*g,o=c*g,e.copy(i).addScaledVector(pr,s).addScaledVector(fr,o)}equals(t){return t.a.equals(this.a)&&t.b.equals(this.b)&&t.c.equals(this.c)}}let wr=0;class br extends mi{constructor(){super(),Object.defineProperty(this,"id",{value:wr++}),this.uuid=wi(),this.name="",this.type="Material",this.blending=w,this.side=f,this.vertexColors=!1,this.opacity=1,this.transparent=!1,this.blendSrc=B,this.blendDst=I,this.blendEquation=E,this.blendSrcAlpha=null,this.blendDstAlpha=null,this.blendEquationAlpha=null,this.depthFunc=W,this.depthTest=!0,this.depthWrite=!0,this.stencilWriteMask=255,this.stencilFunc=ii,this.stencilRef=0,this.stencilFuncMask=255,this.stencilFail=He,this.stencilZFail=He,this.stencilZPass=He,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.alphaToCoverage=!1,this.premultipliedAlpha=!1,this.visible=!0,this.toneMapped=!0,this.userData={},this.version=0,this._alphaTest=0}get alphaTest(){return this._alphaTest}set alphaTest(t){this._alphaTest>0!=t>0&&this.version++,this._alphaTest=t}onBuild(){}onBeforeRender(){}onBeforeCompile(){}customProgramCacheKey(){return this.onBeforeCompile.toString()}setValues(t){if(void 0!==t)for(const e in t){const i=t[e];if(void 0===i)continue;if("shading"===e){this.flatShading=i===v;continue}const n=this[e];void 0!==n&&(n&&n.isColor?n.set(i):n&&n.isVector3&&i&&i.isVector3?n.copy(i):this[e]=i)}}toJSON(t){const e=void 0===t||"string"==typeof t;e&&(t={textures:{},images:{}});const i={metadata:{version:4.5,type:"Material",generator:"Material.toJSON"}};function n(t){const e=[];for(const i in t){const n=t[i];delete n.metadata,e.push(n)}return e}if(i.uuid=this.uuid,i.type=this.type,""!==this.name&&(i.name=this.name),this.color&&this.color.isColor&&(i.color=this.color.getHex()),void 0!==this.roughness&&(i.roughness=this.roughness),void 0!==this.metalness&&(i.metalness=this.metalness),void 0!==this.sheen&&(i.sheen=this.sheen),this.sheenColor&&this.sheenColor.isColor&&(i.sheenColor=this.sheenColor.getHex()),void 0!==this.sheenRoughness&&(i.sheenRoughness=this.sheenRoughness),this.emissive&&this.emissive.isColor&&(i.emissive=this.emissive.getHex()),this.emissiveIntensity&&1!==this.emissiveIntensity&&(i.emissiveIntensity=this.emissiveIntensity),this.specular&&this.specular.isColor&&(i.specular=this.specular.getHex()),void 0!==this.specularIntensity&&(i.specularIntensity=this.specularIntensity),this.specularColor&&this.specularColor.isColor&&(i.specularColor=this.specularColor.getHex()),void 0!==this.shininess&&(i.shininess=this.shininess),void 0!==this.clearcoat&&(i.clearcoat=this.clearcoat),void 0!==this.clearcoatRoughness&&(i.clearcoatRoughness=this.clearcoatRoughness),this.clearcoatMap&&this.clearcoatMap.isTexture&&(i.clearcoatMap=this.clearcoatMap.toJSON(t).uuid),this.clearcoatRoughnessMap&&this.clearcoatRoughnessMap.isTexture&&(i.clearcoatRoughnessMap=this.clearcoatRoughnessMap.toJSON(t).uuid),this.clearcoatNormalMap&&this.clearcoatNormalMap.isTexture&&(i.clearcoatNormalMap=this.clearcoatNormalMap.toJSON(t).uuid,i.clearcoatNormalScale=this.clearcoatNormalScale.toArray()),this.map&&this.map.isTexture&&(i.map=this.map.toJSON(t).uuid),this.matcap&&this.matcap.isTexture&&(i.matcap=this.matcap.toJSON(t).uuid),this.alphaMap&&this.alphaMap.isTexture&&(i.alphaMap=this.alphaMap.toJSON(t).uuid),this.lightMap&&this.lightMap.isTexture&&(i.lightMap=this.lightMap.toJSON(t).uuid,i.lightMapIntensity=this.lightMapIntensity),this.aoMap&&this.aoMap.isTexture&&(i.aoMap=this.aoMap.toJSON(t).uuid,i.aoMapIntensity=this.aoMapIntensity),this.bumpMap&&this.bumpMap.isTexture&&(i.bumpMap=this.bumpMap.toJSON(t).uuid,i.bumpScale=this.bumpScale),this.normalMap&&this.normalMap.isTexture&&(i.normalMap=this.normalMap.toJSON(t).uuid,i.normalMapType=this.normalMapType,i.normalScale=this.normalScale.toArray()),this.displacementMap&&this.displacementMap.isTexture&&(i.displacementMap=this.displacementMap.toJSON(t).uuid,i.displacementScale=this.displacementScale,i.displacementBias=this.displacementBias),this.roughnessMap&&this.roughnessMap.isTexture&&(i.roughnessMap=this.roughnessMap.toJSON(t).uuid),this.metalnessMap&&this.metalnessMap.isTexture&&(i.metalnessMap=this.metalnessMap.toJSON(t).uuid),this.emissiveMap&&this.emissiveMap.isTexture&&(i.emissiveMap=this.emissiveMap.toJSON(t).uuid),this.specularMap&&this.specularMap.isTexture&&(i.specularMap=this.specularMap.toJSON(t).uuid),this.specularIntensityMap&&this.specularIntensityMap.isTexture&&(i.specularIntensityMap=this.specularIntensityMap.toJSON(t).uuid),this.specularColorMap&&this.specularColorMap.isTexture&&(i.specularColorMap=this.specularColorMap.toJSON(t).uuid),this.envMap&&this.envMap.isTexture&&(i.envMap=this.envMap.toJSON(t).uuid,void 0!==this.combine&&(i.combine=this.combine)),void 0!==this.envMapIntensity&&(i.envMapIntensity=this.envMapIntensity),void 0!==this.reflectivity&&(i.reflectivity=this.reflectivity),void 0!==this.refractionRatio&&(i.refractionRatio=this.refractionRatio),this.gradientMap&&this.gradientMap.isTexture&&(i.gradientMap=this.gradientMap.toJSON(t).uuid),void 0!==this.transmission&&(i.transmission=this.transmission),this.transmissionMap&&this.transmissionMap.isTexture&&(i.transmissionMap=this.transmissionMap.toJSON(t).uuid),void 0!==this.thickness&&(i.thickness=this.thickness),this.thicknessMap&&this.thicknessMap.isTexture&&(i.thicknessMap=this.thicknessMap.toJSON(t).uuid),void 0!==this.attenuationDistance&&(i.attenuationDistance=this.attenuationDistance),void 0!==this.attenuationColor&&(i.attenuationColor=this.attenuationColor.getHex()),void 0!==this.size&&(i.size=this.size),null!==this.shadowSide&&(i.shadowSide=this.shadowSide),void 0!==this.sizeAttenuation&&(i.sizeAttenuation=this.sizeAttenuation),this.blending!==w&&(i.blending=this.blending),this.side!==f&&(i.side=this.side),this.vertexColors&&(i.vertexColors=!0),this.opacity<1&&(i.opacity=this.opacity),!0===this.transparent&&(i.transparent=this.transparent),i.depthFunc=this.depthFunc,i.depthTest=this.depthTest,i.depthWrite=this.depthWrite,i.colorWrite=this.colorWrite,i.stencilWrite=this.stencilWrite,i.stencilWriteMask=this.stencilWriteMask,i.stencilFunc=this.stencilFunc,i.stencilRef=this.stencilRef,i.stencilFuncMask=this.stencilFuncMask,i.stencilFail=this.stencilFail,i.stencilZFail=this.stencilZFail,i.stencilZPass=this.stencilZPass,void 0!==this.rotation&&0!==this.rotation&&(i.rotation=this.rotation),!0===this.polygonOffset&&(i.polygonOffset=!0),0!==this.polygonOffsetFactor&&(i.polygonOffsetFactor=this.polygonOffsetFactor),0!==this.polygonOffsetUnits&&(i.polygonOffsetUnits=this.polygonOffsetUnits),void 0!==this.linewidth&&1!==this.linewidth&&(i.linewidth=this.linewidth),void 0!==this.dashSize&&(i.dashSize=this.dashSize),void 0!==this.gapSize&&(i.gapSize=this.gapSize),void 0!==this.scale&&(i.scale=this.scale),!0===this.dithering&&(i.dithering=!0),this.alphaTest>0&&(i.alphaTest=this.alphaTest),!0===this.alphaToCoverage&&(i.alphaToCoverage=this.alphaToCoverage),!0===this.premultipliedAlpha&&(i.premultipliedAlpha=this.premultipliedAlpha),!0===this.wireframe&&(i.wireframe=this.wireframe),this.wireframeLinewidth>1&&(i.wireframeLinewidth=this.wireframeLinewidth),"round"!==this.wireframeLinecap&&(i.wireframeLinecap=this.wireframeLinecap),"round"!==this.wireframeLinejoin&&(i.wireframeLinejoin=this.wireframeLinejoin),!0===this.flatShading&&(i.flatShading=this.flatShading),!1===this.visible&&(i.visible=!1),!1===this.toneMapped&&(i.toneMapped=!1),!1===this.fog&&(i.fog=!1),"{}"!==JSON.stringify(this.userData)&&(i.userData=this.userData),e){const e=n(t.textures),r=n(t.images);e.length>0&&(i.textures=e),r.length>0&&(i.images=r)}return i}clone(){return(new this.constructor).copy(this)}copy(t){this.name=t.name,this.blending=t.blending,this.side=t.side,this.vertexColors=t.vertexColors,this.opacity=t.opacity,this.transparent=t.transparent,this.blendSrc=t.blendSrc,this.blendDst=t.blendDst,this.blendEquation=t.blendEquation,this.blendSrcAlpha=t.blendSrcAlpha,this.blendDstAlpha=t.blendDstAlpha,this.blendEquationAlpha=t.blendEquationAlpha,this.depthFunc=t.depthFunc,this.depthTest=t.depthTest,this.depthWrite=t.depthWrite,this.stencilWriteMask=t.stencilWriteMask,this.stencilFunc=t.stencilFunc,this.stencilRef=t.stencilRef,this.stencilFuncMask=t.stencilFuncMask,this.stencilFail=t.stencilFail,this.stencilZFail=t.stencilZFail,this.stencilZPass=t.stencilZPass,this.stencilWrite=t.stencilWrite;const e=t.clippingPlanes;let i=null;if(null!==e){const t=e.length;i=new Array(t);for(let n=0;n!==t;++n)i[n]=e[n].clone()}return this.clippingPlanes=i,this.clipIntersection=t.clipIntersection,this.clipShadows=t.clipShadows,this.shadowSide=t.shadowSide,this.colorWrite=t.colorWrite,this.precision=t.precision,this.polygonOffset=t.polygonOffset,this.polygonOffsetFactor=t.polygonOffsetFactor,this.polygonOffsetUnits=t.polygonOffsetUnits,this.dithering=t.dithering,this.alphaTest=t.alphaTest,this.alphaToCoverage=t.alphaToCoverage,this.premultipliedAlpha=t.premultipliedAlpha,this.visible=t.visible,this.toneMapped=t.toneMapped,this.userData=JSON.parse(JSON.stringify(t.userData)),this}dispose(){this.dispatchEvent({type:"dispose"})}set needsUpdate(t){!0===t&&this.version++}}br.prototype.isMaterial=!0,br.fromType=function(){return null};class Ar extends br{constructor(t){super(),this.type="MeshBasicMaterial",this.color=new Wi(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=Q,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.fog=!0,this.setValues(t)}copy(t){return super.copy(t),this.color.copy(t.color),this.map=t.map,this.lightMap=t.lightMap,this.lightMapIntensity=t.lightMapIntensity,this.aoMap=t.aoMap,this.aoMapIntensity=t.aoMapIntensity,this.specularMap=t.specularMap,this.alphaMap=t.alphaMap,this.envMap=t.envMap,this.combine=t.combine,this.reflectivity=t.reflectivity,this.refractionRatio=t.refractionRatio,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.wireframeLinecap=t.wireframeLinecap,this.wireframeLinejoin=t.wireframeLinejoin,this.fog=t.fog,this}}Ar.prototype.isMeshBasicMaterial=!0;const Tr=new on,Sr=new Ci;class Er{constructor(t,e,i){if(Array.isArray(t))throw new TypeError("THREE.BufferAttribute: array should be a Typed Array.");this.name="",this.array=t,this.itemSize=e,this.count=void 0!==t?t.length/e:0,this.normalized=!0===i,this.usage=ni,this.updateRange={offset:0,count:-1},this.version=0}onUploadCallback(){}set needsUpdate(t){!0===t&&this.version++}setUsage(t){return this.usage=t,this}copy(t){return this.name=t.name,this.array=new t.array.constructor(t.array),this.itemSize=t.itemSize,this.count=t.count,this.normalized=t.normalized,this.usage=t.usage,this}copyAt(t,e,i){t*=this.itemSize,i*=e.itemSize;for(let n=0,r=this.itemSize;n0&&(t.userData=this.userData),void 0!==this.parameters){const e=this.parameters;for(const i in e)void 0!==e[i]&&(t[i]=e[i]);return t}t.data={attributes:{}};const e=this.index;null!==e&&(t.data.index={type:e.array.constructor.name,array:Array.prototype.slice.call(e.array)});const i=this.attributes;for(const e in i){const n=i[e];t.data.attributes[e]=n.toJSON(t.data)}const n={};let r=!1;for(const e in this.morphAttributes){const i=this.morphAttributes[e],s=[];for(let e=0,n=i.length;e0&&(n[e]=s,r=!0)}r&&(t.data.morphAttributes=n,t.data.morphTargetsRelative=this.morphTargetsRelative);const s=this.groups;s.length>0&&(t.data.groups=JSON.parse(JSON.stringify(s)));const o=this.boundingSphere;return null!==o&&(t.data.boundingSphere={center:o.center.toArray(),radius:o.radius}),t}clone(){return(new this.constructor).copy(this)}copy(t){this.index=null,this.attributes={},this.morphAttributes={},this.groups=[],this.boundingBox=null,this.boundingSphere=null;const e={};this.name=t.name;const i=t.index;null!==i&&this.setIndex(i.clone(e));const n=t.attributes;for(const t in n){const i=n[t];this.setAttribute(t,i.clone(e))}const r=t.morphAttributes;for(const t in r){const i=[],n=r[t];for(let t=0,r=n.length;t0){const t=e[i[0]];if(void 0!==t){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let e=0,i=t.length;ei.far?null:{distance:l,point:os.clone(),object:t}}(t,e,i,n,jr,qr,Qr,ss);if(p){a&&(is.fromBufferAttribute(a,l),ns.fromBufferAttribute(a,u),rs.fromBufferAttribute(a,c),p.uv=xr.getUV(ss,jr,qr,Qr,is,ns,rs,new Ci)),h&&(is.fromBufferAttribute(h,l),ns.fromBufferAttribute(h,u),rs.fromBufferAttribute(h,c),p.uv2=xr.getUV(ss,jr,qr,Qr,is,ns,rs,new Ci));const t={a:l,b:u,c:c,normal:new on,materialIndex:0};xr.getNormal(jr,qr,Qr,t.normal),p.face=t}return p}as.prototype.isMesh=!0;class ls extends Gr{constructor(t=1,e=1,i=1,n=1,r=1,s=1){super(),this.type="BoxGeometry",this.parameters={width:t,height:e,depth:i,widthSegments:n,heightSegments:r,depthSegments:s};const o=this;n=Math.floor(n),r=Math.floor(r),s=Math.floor(s);const a=[],h=[],l=[],u=[];let c=0,d=0;function p(t,e,i,n,r,s,p,f,m,g,v){const y=s/m,x=p/g,w=s/2,b=p/2,A=f/2,T=m+1,S=g+1;let E=0,M=0;const _=new on;for(let s=0;s0?1:-1,l.push(_.x,_.y,_.z),u.push(a/m),u.push(1-s/g),E+=1}}for(let t=0;t0&&(e.defines=this.defines),e.vertexShader=this.vertexShader,e.fragmentShader=this.fragmentShader;const i={};for(const t in this.extensions)!0===this.extensions[t]&&(i[t]=!0);return Object.keys(i).length>0&&(e.extensions=i),e}}ps.prototype.isShaderMaterial=!0;class fs extends hr{constructor(){super(),this.type="Camera",this.matrixWorldInverse=new kn,this.projectionMatrix=new kn,this.projectionMatrixInverse=new kn}copy(t,e){return super.copy(t,e),this.matrixWorldInverse.copy(t.matrixWorldInverse),this.projectionMatrix.copy(t.projectionMatrix),this.projectionMatrixInverse.copy(t.projectionMatrixInverse),this}getWorldDirection(t){this.updateWorldMatrix(!0,!1);const e=this.matrixWorld.elements;return t.set(-e[8],-e[9],-e[10]).normalize()}updateMatrixWorld(t){super.updateMatrixWorld(t),this.matrixWorldInverse.copy(this.matrixWorld).invert()}updateWorldMatrix(t,e){super.updateWorldMatrix(t,e),this.matrixWorldInverse.copy(this.matrixWorld).invert()}clone(){return(new this.constructor).copy(this)}}fs.prototype.isCamera=!0;class ms extends fs{constructor(t=50,e=1,i=.1,n=2e3){super(),this.type="PerspectiveCamera",this.fov=t,this.zoom=1,this.near=i,this.far=n,this.focus=10,this.aspect=e,this.view=null,this.filmGauge=35,this.filmOffset=0,this.updateProjectionMatrix()}copy(t,e){return super.copy(t,e),this.fov=t.fov,this.zoom=t.zoom,this.near=t.near,this.far=t.far,this.focus=t.focus,this.aspect=t.aspect,this.view=null===t.view?null:Object.assign({},t.view),this.filmGauge=t.filmGauge,this.filmOffset=t.filmOffset,this}setFocalLength(t){const e=.5*this.getFilmHeight()/t;this.fov=2*xi*Math.atan(e),this.updateProjectionMatrix()}getFocalLength(){const t=Math.tan(.5*yi*this.fov);return.5*this.getFilmHeight()/t}getEffectiveFOV(){return 2*xi*Math.atan(Math.tan(.5*yi*this.fov)/this.zoom)}getFilmWidth(){return this.filmGauge*Math.min(this.aspect,1)}getFilmHeight(){return this.filmGauge/Math.max(this.aspect,1)}setViewOffset(t,e,i,n,r,s){this.aspect=t/e,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=t,this.view.fullHeight=e,this.view.offsetX=i,this.view.offsetY=n,this.view.width=r,this.view.height=s,this.updateProjectionMatrix()}clearViewOffset(){null!==this.view&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){const t=this.near;let e=t*Math.tan(.5*yi*this.fov)/this.zoom,i=2*e,n=this.aspect*i,r=-.5*n;const s=this.view;if(null!==this.view&&this.view.enabled){const t=s.fullWidth,o=s.fullHeight;r+=s.offsetX*n/t,e-=s.offsetY*i/o,n*=s.width/t,i*=s.height/o}const o=this.filmOffset;0!==o&&(r+=t*o/this.getFilmWidth()),this.projectionMatrix.makePerspective(r,r+n,e,e-i,t,this.far),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(t){const e=super.toJSON(t);return e.object.fov=this.fov,e.object.zoom=this.zoom,e.object.near=this.near,e.object.far=this.far,e.object.focus=this.focus,e.object.aspect=this.aspect,null!==this.view&&(e.object.view=Object.assign({},this.view)),e.object.filmGauge=this.filmGauge,e.object.filmOffset=this.filmOffset,e}}ms.prototype.isPerspectiveCamera=!0;class gs extends hr{constructor(t,e,i){if(super(),this.type="CubeCamera",!0!==i.isWebGLCubeRenderTarget)return;this.renderTarget=i;const n=new ms(90,1,t,e);n.layers=this.layers,n.up.set(0,-1,0),n.lookAt(new on(1,0,0)),this.add(n);const r=new ms(90,1,t,e);r.layers=this.layers,r.up.set(0,-1,0),r.lookAt(new on(-1,0,0)),this.add(r);const s=new ms(90,1,t,e);s.layers=this.layers,s.up.set(0,0,1),s.lookAt(new on(0,1,0)),this.add(s);const o=new ms(90,1,t,e);o.layers=this.layers,o.up.set(0,0,-1),o.lookAt(new on(0,-1,0)),this.add(o);const a=new ms(90,1,t,e);a.layers=this.layers,a.up.set(0,-1,0),a.lookAt(new on(0,0,1)),this.add(a);const h=new ms(90,1,t,e);h.layers=this.layers,h.up.set(0,-1,0),h.lookAt(new on(0,0,-1)),this.add(h)}update(t,e){null===this.parent&&this.updateMatrixWorld();const i=this.renderTarget,[n,r,s,o,a,h]=this.children,l=t.getRenderTarget(),u=t.toneMapping,c=t.xr.enabled;t.toneMapping=Z,t.xr.enabled=!1;const d=i.texture.generateMipmaps;i.texture.generateMipmaps=!1,t.setRenderTarget(i,0),t.render(e,n),t.setRenderTarget(i,1),t.render(e,r),t.setRenderTarget(i,2),t.render(e,s),t.setRenderTarget(i,3),t.render(e,o),t.setRenderTarget(i,4),t.render(e,a),i.texture.generateMipmaps=d,t.setRenderTarget(i,5),t.render(e,h),t.setRenderTarget(l),t.toneMapping=u,t.xr.enabled=c,i.texture.needsPMREMUpdate=!0}}class vs extends Ki{constructor(t,e,i,n,r,s,o,a,h,l){super(t=void 0!==t?t:[],e=void 0!==e?e:st,i,n,r,s,o,a,h,l),this.flipY=!1}get images(){return this.image}set images(t){this.image=t}}vs.prototype.isCubeTexture=!0;class ys extends Zi{constructor(t,e={}){super(t,t,e);const i={width:t,height:t,depth:1},n=[i,i,i,i,i,i];this.texture=new vs(n,e.mapping,e.wrapS,e.wrapT,e.magFilter,e.minFilter,e.format,e.type,e.anisotropy,e.encoding),this.texture.isRenderTargetTexture=!0,this.texture.generateMipmaps=void 0!==e.generateMipmaps&&e.generateMipmaps,this.texture.minFilter=void 0!==e.minFilter?e.minFilter:yt}fromEquirectangularTexture(t,e){this.texture.type=e.type,this.texture.encoding=e.encoding,this.texture.generateMipmaps=e.generateMipmaps,this.texture.minFilter=e.minFilter,this.texture.magFilter=e.magFilter;const i={uniforms:{tEquirect:{value:null}},vertexShader:"\n\n\t\t\t\tvarying vec3 vWorldDirection;\n\n\t\t\t\tvec3 transformDirection( in vec3 dir, in mat4 matrix ) {\n\n\t\t\t\t\treturn normalize( ( matrix * vec4( dir, 0.0 ) ).xyz );\n\n\t\t\t\t}\n\n\t\t\t\tvoid main() {\n\n\t\t\t\t\tvWorldDirection = transformDirection( position, modelMatrix );\n\n\t\t\t\t\t#include \n\t\t\t\t\t#include \n\n\t\t\t\t}\n\t\t\t",fragmentShader:"\n\n\t\t\t\tuniform sampler2D tEquirect;\n\n\t\t\t\tvarying vec3 vWorldDirection;\n\n\t\t\t\t#include \n\n\t\t\t\tvoid main() {\n\n\t\t\t\t\tvec3 direction = normalize( vWorldDirection );\n\n\t\t\t\t\tvec2 sampleUV = equirectUv( direction );\n\n\t\t\t\t\tgl_FragColor = texture2D( tEquirect, sampleUV );\n\n\t\t\t\t}\n\t\t\t"},n=new ls(5,5,5),r=new ps({name:"CubemapFromEquirect",uniforms:us(i.uniforms),vertexShader:i.vertexShader,fragmentShader:i.fragmentShader,side:m,blending:x});r.uniforms.tEquirect.value=e;const s=new as(n,r),o=e.minFilter;e.minFilter===bt&&(e.minFilter=yt);return new gs(1,10,this).update(t,s),e.minFilter=o,s.geometry.dispose(),s.material.dispose(),this}clear(t,e,i,n){const r=t.getRenderTarget();for(let r=0;r<6;r++)t.setRenderTarget(this,r),t.clear(e,i,n);t.setRenderTarget(r)}}ys.prototype.isWebGLCubeRenderTarget=!0;const xs=new on,ws=new on,bs=new Pi;class As{constructor(t=new on(1,0,0),e=0){this.normal=t,this.constant=e}set(t,e){return this.normal.copy(t),this.constant=e,this}setComponents(t,e,i,n){return this.normal.set(t,e,i),this.constant=n,this}setFromNormalAndCoplanarPoint(t,e){return this.normal.copy(t),this.constant=-e.dot(this.normal),this}setFromCoplanarPoints(t,e,i){const n=xs.subVectors(i,e).cross(ws.subVectors(t,e)).normalize();return this.setFromNormalAndCoplanarPoint(n,t),this}copy(t){return this.normal.copy(t.normal),this.constant=t.constant,this}normalize(){const t=1/this.normal.length();return this.normal.multiplyScalar(t),this.constant*=t,this}negate(){return this.constant*=-1,this.normal.negate(),this}distanceToPoint(t){return this.normal.dot(t)+this.constant}distanceToSphere(t){return this.distanceToPoint(t.center)-t.radius}projectPoint(t,e){return e.copy(this.normal).multiplyScalar(-this.distanceToPoint(t)).add(t)}intersectLine(t,e){const i=t.delta(xs),n=this.normal.dot(i);if(0===n)return 0===this.distanceToPoint(t.start)?e.copy(t.start):null;const r=-(t.start.dot(this.normal)+this.constant)/n;return r<0||r>1?null:e.copy(i).multiplyScalar(r).add(t.start)}intersectsLine(t){const e=this.distanceToPoint(t.start),i=this.distanceToPoint(t.end);return e<0&&i>0||i<0&&e>0}intersectsBox(t){return t.intersectsPlane(this)}intersectsSphere(t){return t.intersectsPlane(this)}coplanarPoint(t){return t.copy(this.normal).multiplyScalar(-this.constant)}applyMatrix4(t,e){const i=e||bs.getNormalMatrix(t),n=this.coplanarPoint(xs).applyMatrix4(t),r=this.normal.applyMatrix3(i).normalize();return this.constant=-n.dot(r),this}translate(t){return this.constant-=t.dot(this.normal),this}equals(t){return t.normal.equals(this.normal)&&t.constant===this.constant}clone(){return(new this.constructor).copy(this)}}As.prototype.isPlane=!0;const Ts=new Cn,Ss=new on;class Es{constructor(t=new As,e=new As,i=new As,n=new As,r=new As,s=new As){this.planes=[t,e,i,n,r,s]}set(t,e,i,n,r,s){const o=this.planes;return o[0].copy(t),o[1].copy(e),o[2].copy(i),o[3].copy(n),o[4].copy(r),o[5].copy(s),this}copy(t){const e=this.planes;for(let i=0;i<6;i++)e[i].copy(t.planes[i]);return this}setFromProjectionMatrix(t){const e=this.planes,i=t.elements,n=i[0],r=i[1],s=i[2],o=i[3],a=i[4],h=i[5],l=i[6],u=i[7],c=i[8],d=i[9],p=i[10],f=i[11],m=i[12],g=i[13],v=i[14],y=i[15];return e[0].setComponents(o-n,u-a,f-c,y-m).normalize(),e[1].setComponents(o+n,u+a,f+c,y+m).normalize(),e[2].setComponents(o+r,u+h,f+d,y+g).normalize(),e[3].setComponents(o-r,u-h,f-d,y-g).normalize(),e[4].setComponents(o-s,u-l,f-p,y-v).normalize(),e[5].setComponents(o+s,u+l,f+p,y+v).normalize(),this}intersectsObject(t){const e=t.geometry;return null===e.boundingSphere&&e.computeBoundingSphere(),Ts.copy(e.boundingSphere).applyMatrix4(t.matrixWorld),this.intersectsSphere(Ts)}intersectsSprite(t){return Ts.center.set(0,0,0),Ts.radius=.7071067811865476,Ts.applyMatrix4(t.matrixWorld),this.intersectsSphere(Ts)}intersectsSphere(t){const e=this.planes,i=t.center,n=-t.radius;for(let t=0;t<6;t++){if(e[t].distanceToPoint(i)0?t.max.x:t.min.x,Ss.y=n.normal.y>0?t.max.y:t.min.y,Ss.z=n.normal.z>0?t.max.z:t.min.z,n.distanceToPoint(Ss)<0)return!1}return!0}containsPoint(t){const e=this.planes;for(let i=0;i<6;i++)if(e[i].distanceToPoint(t)<0)return!1;return!0}clone(){return(new this.constructor).copy(this)}}function Ms(){let t=null,e=!1,i=null,n=null;function r(e,s){i(e,s),n=t.requestAnimationFrame(r)}return{start:function(){!0!==e&&null!==i&&(n=t.requestAnimationFrame(r),e=!0)},stop:function(){t.cancelAnimationFrame(n),e=!1},setAnimationLoop:function(t){i=t},setContext:function(e){t=e}}}function _s(t,e){const i=e.isWebGL2,n=new WeakMap;return{get:function(t){return t.isInterleavedBufferAttribute&&(t=t.data),n.get(t)},remove:function(e){e.isInterleavedBufferAttribute&&(e=e.data);const i=n.get(e);i&&(t.deleteBuffer(i.buffer),n.delete(e))},update:function(e,r){if(e.isGLBufferAttribute){const t=n.get(e);return void((!t||t.version 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}\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_BlinnPhong( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in vec3 specularColor, const in float shininess ) {\n\tvec3 halfDir = normalize( lightDir + viewDir );\n\tfloat dotNH = saturate( dot( normal, halfDir ) );\n\tfloat dotVH = saturate( dot( viewDir, halfDir ) );\n\tvec3 F = F_Schlick( specularColor, 1.0, dotVH );\n\tfloat G = G_BlinnPhong_Implicit( );\n\tfloat D = D_BlinnPhong( shininess, dotNH );\n\treturn F * ( G * D );\n}\n#if defined( USE_SHEEN )\nfloat D_Charlie( float roughness, float dotNH ) {\n\tfloat alpha = pow2( roughness );\n\tfloat invAlpha = 1.0 / alpha;\n\tfloat cos2h = dotNH * dotNH;\n\tfloat sin2h = max( 1.0 - cos2h, 0.0078125 );\n\treturn ( 2.0 + invAlpha ) * pow( sin2h, invAlpha * 0.5 ) / ( 2.0 * PI );\n}\nfloat V_Neubelt( float dotNV, float dotNL ) {\n\treturn saturate( 1.0 / ( 4.0 * ( dotNL + dotNV - dotNL * dotNV ) ) );\n}\nvec3 BRDF_Sheen( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, vec3 sheenColor, const in float sheenRoughness ) {\n\tvec3 halfDir = normalize( lightDir + viewDir );\n\tfloat dotNL = saturate( dot( normal, lightDir ) );\n\tfloat dotNV = saturate( dot( normal, viewDir ) );\n\tfloat dotNH = saturate( dot( normal, halfDir ) );\n\tfloat D = D_Charlie( sheenRoughness, dotNH );\n\tfloat V = V_Neubelt( dotNV, dotNL );\n\treturn sheenColor * ( D * V );\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, float faceDirection ) {\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 ) * faceDirection;\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:"#if defined( USE_COLOR_ALPHA )\n\tdiffuseColor *= vColor;\n#elif defined( USE_COLOR )\n\tdiffuseColor.rgb *= vColor;\n#endif",color_pars_fragment:"#if defined( USE_COLOR_ALPHA )\n\tvarying vec4 vColor;\n#elif defined( USE_COLOR )\n\tvarying vec3 vColor;\n#endif",color_pars_vertex:"#if defined( USE_COLOR_ALPHA )\n\tvarying vec4 vColor;\n#elif defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR )\n\tvarying vec3 vColor;\n#endif",color_vertex:"#if defined( USE_COLOR_ALPHA )\n\tvColor = vec4( 1.0 );\n#elif defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR )\n\tvColor = vec3( 1.0 );\n#endif\n#ifdef USE_COLOR\n\tvColor *= color;\n#endif\n#ifdef USE_INSTANCING_COLOR\n\tvColor.xyz *= instanceColor.xyz;\n#endif",common:"#define PI 3.141592653589793\n#define PI2 6.283185307179586\n#define PI_HALF 1.5707963267948966\n#define RECIPROCAL_PI 0.3183098861837907\n#define RECIPROCAL_PI2 0.15915494309189535\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 max3( const in vec3 v ) { return max( max( v.x, v.y ), v.z ); }\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 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 USE_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}\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\treturn 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\t#define cubeUV_minMipLevel 4.0\n\t#define cubeUV_minTileSize 16.0\n\tfloat getFace( vec3 direction ) {\n\t\tvec3 absDirection = abs( direction );\n\t\tfloat face = - 1.0;\n\t\tif ( absDirection.x > absDirection.z ) {\n\t\t\tif ( absDirection.x > absDirection.y )\n\t\t\t\tface = direction.x > 0.0 ? 0.0 : 3.0;\n\t\t\telse\n\t\t\t\tface = direction.y > 0.0 ? 1.0 : 4.0;\n\t\t} else {\n\t\t\tif ( absDirection.z > absDirection.y )\n\t\t\t\tface = direction.z > 0.0 ? 2.0 : 5.0;\n\t\t\telse\n\t\t\t\tface = direction.y > 0.0 ? 1.0 : 4.0;\n\t\t}\n\t\treturn face;\n\t}\n\tvec2 getUV( vec3 direction, float face ) {\n\t\tvec2 uv;\n\t\tif ( face == 0.0 ) {\n\t\t\tuv = vec2( direction.z, direction.y ) / abs( direction.x );\n\t\t} else if ( face == 1.0 ) {\n\t\t\tuv = vec2( - direction.x, - direction.z ) / abs( direction.y );\n\t\t} else if ( face == 2.0 ) {\n\t\t\tuv = vec2( - direction.x, direction.y ) / abs( direction.z );\n\t\t} else if ( face == 3.0 ) {\n\t\t\tuv = vec2( - direction.z, direction.y ) / abs( direction.x );\n\t\t} else if ( face == 4.0 ) {\n\t\t\tuv = vec2( - direction.x, direction.z ) / abs( direction.y );\n\t\t} else {\n\t\t\tuv = vec2( direction.x, direction.y ) / abs( direction.z );\n\t\t}\n\t\treturn 0.5 * ( uv + 1.0 );\n\t}\n\tvec3 bilinearCubeUV( sampler2D envMap, vec3 direction, float mipInt ) {\n\t\tfloat face = getFace( direction );\n\t\tfloat filterInt = max( cubeUV_minMipLevel - mipInt, 0.0 );\n\t\tmipInt = max( mipInt, cubeUV_minMipLevel );\n\t\tfloat faceSize = exp2( mipInt );\n\t\tvec2 uv = getUV( direction, face ) * ( faceSize - 2.0 ) + 1.0;\n\t\tif ( face > 2.0 ) {\n\t\t\tuv.y += faceSize;\n\t\t\tface -= 3.0;\n\t\t}\n\t\tuv.x += face * faceSize;\n\t\tuv.x += filterInt * 3.0 * cubeUV_minTileSize;\n\t\tuv.y += 4.0 * ( exp2( CUBEUV_MAX_MIP ) - faceSize );\n\t\tuv.x *= CUBEUV_TEXEL_WIDTH;\n\t\tuv.y *= CUBEUV_TEXEL_HEIGHT;\n\t\t#ifdef texture2DGradEXT\n\t\t\treturn texture2DGradEXT( envMap, uv, vec2( 0.0 ), vec2( 0.0 ) ).rgb;\n\t\t#else\n\t\t\treturn texture2D( envMap, uv ).rgb;\n\t\t#endif\n\t}\n\t#define r0 1.0\n\t#define v0 0.339\n\t#define m0 - 2.0\n\t#define r1 0.8\n\t#define v1 0.276\n\t#define m1 - 1.0\n\t#define r4 0.4\n\t#define v4 0.046\n\t#define m4 2.0\n\t#define r5 0.305\n\t#define v5 0.016\n\t#define m5 3.0\n\t#define r6 0.21\n\t#define v6 0.0038\n\t#define m6 4.0\n\tfloat roughnessToMip( float roughness ) {\n\t\tfloat mip = 0.0;\n\t\tif ( roughness >= r1 ) {\n\t\t\tmip = ( r0 - roughness ) * ( m1 - m0 ) / ( r0 - r1 ) + m0;\n\t\t} else if ( roughness >= r4 ) {\n\t\t\tmip = ( r1 - roughness ) * ( m4 - m1 ) / ( r1 - r4 ) + m1;\n\t\t} else if ( roughness >= r5 ) {\n\t\t\tmip = ( r4 - roughness ) * ( m5 - m4 ) / ( r4 - r5 ) + m4;\n\t\t} else if ( roughness >= r6 ) {\n\t\t\tmip = ( r5 - roughness ) * ( m6 - m5 ) / ( r5 - r6 ) + m5;\n\t\t} else {\n\t\t\tmip = - 2.0 * log2( 1.16 * roughness );\t\t}\n\t\treturn mip;\n\t}\n\tvec4 textureCubeUV( sampler2D envMap, vec3 sampleDir, float roughness ) {\n\t\tfloat mip = clamp( roughnessToMip( roughness ), m0, CUBEUV_MAX_MIP );\n\t\tfloat mipF = fract( mip );\n\t\tfloat mipInt = floor( mip );\n\t\tvec3 color0 = bilinearCubeUV( envMap, sampleDir, mipInt );\n\t\tif ( mipF == 0.0 ) {\n\t\t\treturn vec4( color0, 1.0 );\n\t\t} else {\n\t\t\tvec3 color1 = bilinearCubeUV( envMap, sampleDir, mipInt + 1.0 );\n\t\t\treturn vec4( mix( color0, color1, mipF ), 1.0 );\n\t\t}\n\t}\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\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:"vec4 LinearToLinear( in vec4 value ) {\n\treturn value;\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}",envmap_fragment:"#ifdef USE_ENVMAP\n\t#ifdef ENV_WORLDPOS\n\t\tvec3 cameraToFrag;\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#else\n\t\tvec4 envColor = vec4( 0.0 );\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\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\tvec3 getIBLIrradiance( const in vec3 normal ) {\n\t\t#if defined( ENVMAP_TYPE_CUBE_UV )\n\t\t\tvec3 worldNormal = inverseTransformDirection( normal, viewMatrix );\n\t\t\tvec4 envMapColor = textureCubeUV( envMap, worldNormal, 1.0 );\n\t\t\treturn PI * envMapColor.rgb * envMapIntensity;\n\t\t#else\n\t\t\treturn vec3( 0.0 );\n\t\t#endif\n\t}\n\tvec3 getIBLRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness ) {\n\t\t#if defined( ENVMAP_TYPE_CUBE_UV )\n\t\t\tvec3 reflectVec = reflect( - viewDir, normal );\n\t\t\treflectVec = normalize( mix( reflectVec, normal, roughness * roughness) );\n\t\t\treflectVec = inverseTransformDirection( reflectVec, viewMatrix );\n\t\t\tvec4 envMapColor = textureCubeUV( envMap, reflectVec, roughness );\n\t\t\treturn envMapColor.rgb * envMapIntensity;\n\t\t#else\n\t\t\treturn vec3( 0.0 );\n\t\t#endif\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\tvFogDepth = - mvPosition.z;\n#endif",fog_pars_vertex:"#ifdef USE_FOG\n\tvarying float vFogDepth;\n#endif",fog_fragment:"#ifdef USE_FOG\n\t#ifdef FOG_EXP2\n\t\tfloat fogFactor = 1.0 - exp( - fogDensity * fogDensity * vFogDepth * vFogDepth );\n\t#else\n\t\tfloat fogFactor = smoothstep( fogNear, fogFar, vFogDepth );\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 vFogDepth;\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 vec3( texture2D( gradientMap, coord ).r );\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\tvec3 lightMapIrradiance = lightMapTexel.rgb * lightMapIntensity;\n\treflectedLight.indirectDiffuse += lightMapIrradiance;\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.normal );\n#ifdef DOUBLE_SIDED\n\tvIndirectBack += getAmbientLightIrradiance( ambientLightColor );\n\tvIndirectBack += getLightProbeIrradiance( lightProbe, backGeometry.normal );\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\tgetPointLightInfo( pointLights[ i ], geometry, directLight );\n\t\tdotNL = dot( geometry.normal, directLight.direction );\n\t\tdirectLightColor_Diffuse = 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\tgetSpotLightInfo( spotLights[ i ], geometry, directLight );\n\t\tdotNL = dot( geometry.normal, directLight.direction );\n\t\tdirectLightColor_Diffuse = 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\tgetDirectionalLightInfo( directionalLights[ i ], geometry, directLight );\n\t\tdotNL = dot( geometry.normal, directLight.direction );\n\t\tdirectLightColor_Diffuse = 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.normal );\n\t\t#ifdef DOUBLE_SIDED\n\t\t\tvIndirectBack += getHemisphereLightIrradiance( hemisphereLights[ i ], backGeometry.normal );\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 vec3 normal ) {\n\tvec3 worldNormal = inverseTransformDirection( normal, viewMatrix );\n\tvec3 irradiance = shGetIrradianceAt( worldNormal, lightProbe );\n\treturn irradiance;\n}\nvec3 getAmbientLightIrradiance( const in vec3 ambientLightColor ) {\n\tvec3 irradiance = ambientLightColor;\n\treturn irradiance;\n}\nfloat getDistanceAttenuation( const in float lightDistance, const in float cutoffDistance, const in float decayExponent ) {\n\t#if defined ( PHYSICALLY_CORRECT_LIGHTS )\n\t\tfloat distanceFalloff = 1.0 / max( pow( lightDistance, decayExponent ), 0.01 );\n\t\tif ( cutoffDistance > 0.0 ) {\n\t\t\tdistanceFalloff *= pow2( saturate( 1.0 - pow4( lightDistance / cutoffDistance ) ) );\n\t\t}\n\t\treturn distanceFalloff;\n\t#else\n\t\tif ( cutoffDistance > 0.0 && decayExponent > 0.0 ) {\n\t\t\treturn pow( saturate( - lightDistance / cutoffDistance + 1.0 ), decayExponent );\n\t\t}\n\t\treturn 1.0;\n\t#endif\n}\nfloat getSpotAttenuation( const in float coneCosine, const in float penumbraCosine, const in float angleCosine ) {\n\treturn smoothstep( coneCosine, penumbraCosine, angleCosine );\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\tvoid getDirectionalLightInfo( const in DirectionalLight directionalLight, const in GeometricContext geometry, out IncidentLight light ) {\n\t\tlight.color = directionalLight.color;\n\t\tlight.direction = directionalLight.direction;\n\t\tlight.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\tvoid getPointLightInfo( const in PointLight pointLight, const in GeometricContext geometry, out IncidentLight light ) {\n\t\tvec3 lVector = pointLight.position - geometry.position;\n\t\tlight.direction = normalize( lVector );\n\t\tfloat lightDistance = length( lVector );\n\t\tlight.color = pointLight.color;\n\t\tlight.color *= getDistanceAttenuation( lightDistance, pointLight.distance, pointLight.decay );\n\t\tlight.visible = ( light.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\tvoid getSpotLightInfo( const in SpotLight spotLight, const in GeometricContext geometry, out IncidentLight light ) {\n\t\tvec3 lVector = spotLight.position - geometry.position;\n\t\tlight.direction = normalize( lVector );\n\t\tfloat angleCos = dot( light.direction, spotLight.direction );\n\t\tfloat spotAttenuation = getSpotAttenuation( spotLight.coneCos, spotLight.penumbraCos, angleCos );\n\t\tif ( spotAttenuation > 0.0 ) {\n\t\t\tfloat lightDistance = length( lVector );\n\t\t\tlight.color = spotLight.color * spotAttenuation;\n\t\t\tlight.color *= getDistanceAttenuation( lightDistance, spotLight.distance, spotLight.decay );\n\t\t\tlight.visible = ( light.color != vec3( 0.0 ) );\n\t\t} else {\n\t\t\tlight.color = vec3( 0.0 );\n\t\t\tlight.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 vec3 normal ) {\n\t\tfloat dotNL = dot( normal, hemiLight.direction );\n\t\tfloat hemiDiffuseWeight = 0.5 * dotNL + 0.5;\n\t\tvec3 irradiance = mix( hemiLight.groundColor, hemiLight.skyColor, hemiDiffuseWeight );\n\t\treturn irradiance;\n\t}\n#endif",lights_toon_fragment:"ToonMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb;",lights_toon_pars_fragment:"varying vec3 vViewPosition;\nstruct ToonMaterial {\n\tvec3 diffuseColor;\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\treflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\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_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;\nstruct BlinnPhongMaterial {\n\tvec3 diffuseColor;\n\tvec3 specularColor;\n\tfloat specularShininess;\n\tfloat specularStrength;\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\treflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n\treflectedLight.directSpecular += irradiance * BRDF_BlinnPhong( directLight.direction, geometry.viewDir, geometry.normal, 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_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.roughness = max( roughnessFactor, 0.0525 );material.roughness += geometryRoughness;\nmaterial.roughness = min( material.roughness, 1.0 );\n#ifdef IOR\n\t#ifdef SPECULAR\n\t\tfloat specularIntensityFactor = specularIntensity;\n\t\tvec3 specularColorFactor = specularColor;\n\t\t#ifdef USE_SPECULARINTENSITYMAP\n\t\t\tspecularIntensityFactor *= texture2D( specularIntensityMap, vUv ).a;\n\t\t#endif\n\t\t#ifdef USE_SPECULARCOLORMAP\n\t\t\tspecularColorFactor *= texture2D( specularColorMap, vUv ).rgb;\n\t\t#endif\n\t\tmaterial.specularF90 = mix( specularIntensityFactor, 1.0, metalnessFactor );\n\t#else\n\t\tfloat specularIntensityFactor = 1.0;\n\t\tvec3 specularColorFactor = vec3( 1.0 );\n\t\tmaterial.specularF90 = 1.0;\n\t#endif\n\tmaterial.specularColor = mix( min( pow2( ( ior - 1.0 ) / ( ior + 1.0 ) ) * specularColorFactor, vec3( 1.0 ) ) * specularIntensityFactor, diffuseColor.rgb, metalnessFactor );\n#else\n\tmaterial.specularColor = mix( vec3( 0.04 ), diffuseColor.rgb, metalnessFactor );\n\tmaterial.specularF90 = 1.0;\n#endif\n#ifdef USE_CLEARCOAT\n\tmaterial.clearcoat = clearcoat;\n\tmaterial.clearcoatRoughness = clearcoatRoughness;\n\tmaterial.clearcoatF0 = vec3( 0.04 );\n\tmaterial.clearcoatF90 = 1.0;\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 = sheenColor;\n\t#ifdef USE_SHEENCOLORMAP\n\t\tmaterial.sheenColor *= texture2D( sheenColorMap, vUv ).rgb;\n\t#endif\n\tmaterial.sheenRoughness = clamp( sheenRoughness, 0.07, 1.0 );\n\t#ifdef USE_SHEENROUGHNESSMAP\n\t\tmaterial.sheenRoughness *= texture2D( sheenRoughnessMap, vUv ).a;\n\t#endif\n#endif",lights_physical_pars_fragment:"struct PhysicalMaterial {\n\tvec3 diffuseColor;\n\tfloat roughness;\n\tvec3 specularColor;\n\tfloat specularF90;\n\t#ifdef USE_CLEARCOAT\n\t\tfloat clearcoat;\n\t\tfloat clearcoatRoughness;\n\t\tvec3 clearcoatF0;\n\t\tfloat clearcoatF90;\n\t#endif\n\t#ifdef USE_SHEEN\n\t\tvec3 sheenColor;\n\t\tfloat sheenRoughness;\n\t#endif\n};\nvec3 clearcoatSpecular = vec3( 0.0 );\nvec3 sheenSpecular = vec3( 0.0 );\nfloat IBLSheenBRDF( const in vec3 normal, const in vec3 viewDir, const in float roughness) {\n\tfloat dotNV = saturate( dot( normal, viewDir ) );\n\tfloat r2 = roughness * roughness;\n\tfloat a = roughness < 0.25 ? -339.2 * r2 + 161.4 * roughness - 25.9 : -8.48 * r2 + 14.3 * roughness - 9.95;\n\tfloat b = roughness < 0.25 ? 44.0 * r2 - 23.7 * roughness + 3.26 : 1.97 * r2 - 3.27 * roughness + 0.72;\n\tfloat DG = exp( a * dotNV + b ) + ( roughness < 0.25 ? 0.0 : 0.1 * ( roughness - 0.25 ) );\n\treturn saturate( DG * RECIPROCAL_PI );\n}\nvec2 DFGApprox( const in vec3 normal, const in vec3 viewDir, const in float roughness ) {\n\tfloat dotNV = saturate( dot( normal, viewDir ) );\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\tvec2 fab = vec2( - 1.04, 1.04 ) * a004 + r.zw;\n\treturn fab;\n}\nvec3 EnvironmentBRDF( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float roughness ) {\n\tvec2 fab = DFGApprox( normal, viewDir, roughness );\n\treturn specularColor * fab.x + specularF90 * fab.y;\n}\nvoid computeMultiscattering( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float roughness, inout vec3 singleScatter, inout vec3 multiScatter ) {\n\tvec2 fab = DFGApprox( normal, viewDir, roughness );\n\tvec3 FssEss = specularColor * fab.x + specularF90 * fab.y;\n\tfloat Ess = fab.x + fab.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}\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.roughness;\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#ifdef USE_CLEARCOAT\n\t\tfloat dotNLcc = saturate( dot( geometry.clearcoatNormal, directLight.direction ) );\n\t\tvec3 ccIrradiance = dotNLcc * directLight.color;\n\t\tclearcoatSpecular += ccIrradiance * BRDF_GGX( directLight.direction, geometry.viewDir, geometry.clearcoatNormal, material.clearcoatF0, material.clearcoatF90, material.clearcoatRoughness );\n\t#endif\n\t#ifdef USE_SHEEN\n\t\tsheenSpecular += irradiance * BRDF_Sheen( directLight.direction, geometry.viewDir, geometry.normal, material.sheenColor, material.sheenRoughness );\n\t#endif\n\treflectedLight.directSpecular += irradiance * BRDF_GGX( directLight.direction, geometry.viewDir, geometry.normal, material.specularColor, material.specularF90, material.roughness );\n\treflectedLight.directDiffuse += irradiance * BRDF_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_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 USE_CLEARCOAT\n\t\tclearcoatSpecular += clearcoatRadiance * EnvironmentBRDF( geometry.clearcoatNormal, geometry.viewDir, material.clearcoatF0, material.clearcoatF90, material.clearcoatRoughness );\n\t#endif\n\t#ifdef USE_SHEEN\n\t\tsheenSpecular += irradiance * material.sheenColor * IBLSheenBRDF( geometry.normal, geometry.viewDir, material.sheenRoughness );\n\t#endif\n\tvec3 singleScattering = vec3( 0.0 );\n\tvec3 multiScattering = vec3( 0.0 );\n\tvec3 cosineWeightedIrradiance = irradiance * RECIPROCAL_PI;\n\tcomputeMultiscattering( geometry.normal, geometry.viewDir, material.specularColor, material.specularF90, material.roughness, singleScattering, multiScattering );\n\tvec3 diffuse = material.diffuseColor * ( 1.0 - ( singleScattering + multiScattering ) );\n\treflectedLight.indirectSpecular += 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 USE_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\tgetPointLightInfo( 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\tgetSpotLightInfo( 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\tgetDirectionalLightInfo( 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.normal );\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.normal );\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 = lightMapTexel.rgb * lightMapIntensity;\n\t\tirradiance += lightMapIrradiance;\n\t#endif\n\t#if defined( USE_ENVMAP ) && defined( STANDARD ) && defined( ENVMAP_TYPE_CUBE_UV )\n\t\tiblIrradiance += getIBLIrradiance( geometry.normal );\n\t#endif\n#endif\n#if defined( USE_ENVMAP ) && defined( RE_IndirectSpecular )\n\tradiance += getIBLRadiance( geometry.viewDir, geometry.normal, material.roughness );\n\t#ifdef USE_CLEARCOAT\n\t\tclearcoatRadiance += getIBLRadiance( geometry.viewDir, geometry.clearcoatNormal, material.clearcoatRoughness );\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 sampledDiffuseColor = texture2D( map, vUv );\n\t#ifdef DECODE_VIDEO_TEXTURE\n\t\tsampledDiffuseColor = vec4( mix( pow( sampledDiffuseColor.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), sampledDiffuseColor.rgb * 0.0773993808, vec3( lessThanEqual( sampledDiffuseColor.rgb, vec3( 0.04045 ) ) ) ), sampledDiffuseColor.w );\n\t#endif\n\tdiffuseColor *= sampledDiffuseColor;\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\tdiffuseColor *= texture2D( map, uv );\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",morphcolor_vertex:"#if defined( USE_MORPHCOLORS ) && defined( MORPHTARGETS_TEXTURE )\n\tvColor *= morphTargetBaseInfluence;\n\tfor ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {\n\t\t#if defined( USE_COLOR_ALPHA )\n\t\t\tif ( morphTargetInfluences[ i ] != 0.0 ) vColor += getMorph( gl_VertexID, i, 2 ) * morphTargetInfluences[ i ];\n\t\t#elif defined( USE_COLOR )\n\t\t\tif ( morphTargetInfluences[ i ] != 0.0 ) vColor += getMorph( gl_VertexID, i, 2 ).rgb * morphTargetInfluences[ i ];\n\t\t#endif\n\t}\n#endif",morphnormal_vertex:"#ifdef USE_MORPHNORMALS\n\tobjectNormal *= morphTargetBaseInfluence;\n\t#ifdef MORPHTARGETS_TEXTURE\n\t\tfor ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {\n\t\t\tif ( morphTargetInfluences[ i ] != 0.0 ) objectNormal += getMorph( gl_VertexID, i, 1 ).xyz * morphTargetInfluences[ i ];\n\t\t}\n\t#else\n\t\tobjectNormal += morphNormal0 * morphTargetInfluences[ 0 ];\n\t\tobjectNormal += morphNormal1 * morphTargetInfluences[ 1 ];\n\t\tobjectNormal += morphNormal2 * morphTargetInfluences[ 2 ];\n\t\tobjectNormal += morphNormal3 * morphTargetInfluences[ 3 ];\n\t#endif\n#endif",morphtarget_pars_vertex:"#ifdef USE_MORPHTARGETS\n\tuniform float morphTargetBaseInfluence;\n\t#ifdef MORPHTARGETS_TEXTURE\n\t\tuniform float morphTargetInfluences[ MORPHTARGETS_COUNT ];\n\t\tuniform sampler2DArray morphTargetsTexture;\n\t\tuniform ivec2 morphTargetsTextureSize;\n\t\tvec4 getMorph( const in int vertexIndex, const in int morphTargetIndex, const in int offset ) {\n\t\t\tint texelIndex = vertexIndex * MORPHTARGETS_TEXTURE_STRIDE + offset;\n\t\t\tint y = texelIndex / morphTargetsTextureSize.x;\n\t\t\tint x = texelIndex - y * morphTargetsTextureSize.x;\n\t\t\tivec3 morphUV = ivec3( x, y, morphTargetIndex );\n\t\t\treturn texelFetch( morphTargetsTexture, morphUV, 0 );\n\t\t}\n\t#else\n\t\t#ifndef USE_MORPHNORMALS\n\t\t\tuniform float morphTargetInfluences[ 8 ];\n\t\t#else\n\t\t\tuniform float morphTargetInfluences[ 4 ];\n\t\t#endif\n\t#endif\n#endif",morphtarget_vertex:"#ifdef USE_MORPHTARGETS\n\ttransformed *= morphTargetBaseInfluence;\n\t#ifdef MORPHTARGETS_TEXTURE\n\t\tfor ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {\n\t\t\tif ( morphTargetInfluences[ i ] != 0.0 ) transformed += getMorph( gl_VertexID, i, 0 ).xyz * morphTargetInfluences[ i ];\n\t\t}\n\t#else\n\t\ttransformed += morphTarget0 * morphTargetInfluences[ 0 ];\n\t\ttransformed += morphTarget1 * morphTargetInfluences[ 1 ];\n\t\ttransformed += morphTarget2 * morphTargetInfluences[ 2 ];\n\t\ttransformed += morphTarget3 * morphTargetInfluences[ 3 ];\n\t\t#ifndef USE_MORPHNORMALS\n\t\t\ttransformed += morphTarget4 * morphTargetInfluences[ 4 ];\n\t\t\ttransformed += morphTarget5 * morphTargetInfluences[ 5 ];\n\t\t\ttransformed += morphTarget6 * morphTargetInfluences[ 6 ];\n\t\t\ttransformed += morphTarget7 * morphTargetInfluences[ 7 ];\n\t\t#endif\n\t#endif\n#endif",normal_fragment_begin:"float faceDirection = gl_FrontFacing ? 1.0 : - 1.0;\n#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 * faceDirection;\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 * faceDirection;\n\t\t\tbitangent = bitangent * faceDirection;\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 * faceDirection;\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, faceDirection );\n\t#endif\n#elif defined( USE_BUMPMAP )\n\tnormal = perturbNormalArb( - vViewPosition, normal, dHdxy_fwd(), faceDirection );\n#endif",normal_pars_fragment:"#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",normal_pars_vertex:"#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",normal_vertex:"#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",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, float faceDirection ) {\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\tvec3 N = surf_norm;\n\t\tvec3 q1perp = cross( q1, N );\n\t\tvec3 q0perp = cross( N, q0 );\n\t\tvec3 T = q1perp * st0.x + q0perp * st1.x;\n\t\tvec3 B = q1perp * st0.y + q0perp * st1.y;\n\t\tfloat det = max( dot( T, T ), dot( B, B ) );\n\t\tfloat scale = ( det == 0.0 ) ? 0.0 : faceDirection * inversesqrt( det );\n\t\treturn normalize( T * ( mapN.x * scale ) + B * ( mapN.y * scale ) + N * mapN.z );\n\t}\n#endif",clearcoat_normal_fragment_begin:"#ifdef USE_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, faceDirection );\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",output_fragment:"#ifdef OPAQUE\ndiffuseColor.a = 1.0;\n#endif\n#ifdef USE_TRANSMISSION\ndiffuseColor.a *= transmissionAlpha + 0.1;\n#endif\ngl_FragColor = vec4( outgoingLight, diffuseColor.a );",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\tstruct DirectionalLightShadow {\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\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\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\tstruct SpotLightShadow {\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\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\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\tstruct PointLightShadow {\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\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\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\tstruct DirectionalLightShadow {\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\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\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\tstruct SpotLightShadow {\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\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\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\tstruct PointLightShadow {\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\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#endif",shadowmap_vertex:"#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHT_SHADOWS > 0 || NUM_SPOT_LIGHT_SHADOWS > 0 || NUM_POINT_LIGHT_SHADOWS > 0\n\t\tvec3 shadowWorldNormal = inverseTransformDirection( transformedNormal, viewMatrix );\n\t\tvec4 shadowWorldPosition;\n\t#endif\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\tshadowWorldPosition = worldPosition + vec4( shadowWorldNormal * directionalLightShadows[ i ].shadowNormalBias, 0 );\n\t\tvDirectionalShadowCoord[ i ] = directionalShadowMatrix[ i ] * shadowWorldPosition;\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\tshadowWorldPosition = worldPosition + vec4( shadowWorldNormal * spotLightShadows[ i ].shadowNormalBias, 0 );\n\t\tvSpotShadowCoord[ i ] = spotShadowMatrix[ i ] * shadowWorldPosition;\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\tshadowWorldPosition = worldPosition + vec4( shadowWorldNormal * pointLightShadows[ i ].shadowNormalBias, 0 );\n\t\tvPointShadowCoord[ i ] = pointShadowMatrix[ i ] * shadowWorldPosition;\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\tuniform highp sampler2D boneTexture;\n\tuniform int boneTextureSize;\n\tmat4 getBoneMatrix( const in float i ) {\n\t\tfloat j = i * 4.0;\n\t\tfloat x = mod( j, float( boneTextureSize ) );\n\t\tfloat y = floor( j / float( boneTextureSize ) );\n\t\tfloat dx = 1.0 / float( boneTextureSize );\n\t\tfloat dy = 1.0 / float( boneTextureSize );\n\t\ty = dy * ( y + 0.5 );\n\t\tvec4 v1 = texture2D( boneTexture, vec2( dx * ( x + 0.5 ), y ) );\n\t\tvec4 v2 = texture2D( boneTexture, vec2( dx * ( x + 1.5 ), y ) );\n\t\tvec4 v3 = texture2D( boneTexture, vec2( dx * ( x + 2.5 ), y ) );\n\t\tvec4 v4 = texture2D( boneTexture, vec2( dx * ( x + 3.5 ), y ) );\n\t\tmat4 bone = mat4( v1, v2, v3, v4 );\n\t\treturn bone;\n\t}\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;\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}\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 RRTAndODTFit( vec3 v ) {\n\tvec3 a = v * ( v + 0.0245786 ) - 0.000090537;\n\tvec3 b = v * ( 0.983729 * v + 0.4329510 ) + 0.238081;\n\treturn a / b;\n}\nvec3 ACESFilmicToneMapping( vec3 color ) {\n\tconst mat3 ACESInputMat = mat3(\n\t\tvec3( 0.59719, 0.07600, 0.02840 ),\t\tvec3( 0.35458, 0.90834, 0.13383 ),\n\t\tvec3( 0.04823, 0.01566, 0.83777 )\n\t);\n\tconst mat3 ACESOutputMat = mat3(\n\t\tvec3( 1.60475, -0.10208, -0.00327 ),\t\tvec3( -0.53108, 1.10813, -0.07276 ),\n\t\tvec3( -0.07367, -0.00605, 1.07602 )\n\t);\n\tcolor *= toneMappingExposure / 0.6;\n\tcolor = ACESInputMat * color;\n\tcolor = RRTAndODTFit( color );\n\tcolor = ACESOutputMat * color;\n\treturn saturate( color );\n}\nvec3 CustomToneMapping( vec3 color ) { return color; }",transmission_fragment:"#ifdef USE_TRANSMISSION\n\tfloat transmissionAlpha = 1.0;\n\tfloat transmissionFactor = transmission;\n\tfloat thicknessFactor = thickness;\n\t#ifdef USE_TRANSMISSIONMAP\n\t\ttransmissionFactor *= texture2D( transmissionMap, vUv ).r;\n\t#endif\n\t#ifdef USE_THICKNESSMAP\n\t\tthicknessFactor *= texture2D( thicknessMap, vUv ).g;\n\t#endif\n\tvec3 pos = vWorldPosition;\n\tvec3 v = normalize( cameraPosition - pos );\n\tvec3 n = inverseTransformDirection( normal, viewMatrix );\n\tvec4 transmission = getIBLVolumeRefraction(\n\t\tn, v, roughnessFactor, material.diffuseColor, material.specularColor, material.specularF90,\n\t\tpos, modelMatrix, viewMatrix, projectionMatrix, ior, thicknessFactor,\n\t\tattenuationColor, attenuationDistance );\n\ttotalDiffuse = mix( totalDiffuse, transmission.rgb, transmissionFactor );\n\ttransmissionAlpha = mix( transmissionAlpha, transmission.a, transmissionFactor );\n#endif",transmission_pars_fragment:"#ifdef USE_TRANSMISSION\n\tuniform float transmission;\n\tuniform float thickness;\n\tuniform float attenuationDistance;\n\tuniform vec3 attenuationColor;\n\t#ifdef USE_TRANSMISSIONMAP\n\t\tuniform sampler2D transmissionMap;\n\t#endif\n\t#ifdef USE_THICKNESSMAP\n\t\tuniform sampler2D thicknessMap;\n\t#endif\n\tuniform vec2 transmissionSamplerSize;\n\tuniform sampler2D transmissionSamplerMap;\n\tuniform mat4 modelMatrix;\n\tuniform mat4 projectionMatrix;\n\tvarying vec3 vWorldPosition;\n\tvec3 getVolumeTransmissionRay( const in vec3 n, const in vec3 v, const in float thickness, const in float ior, const in mat4 modelMatrix ) {\n\t\tvec3 refractionVector = refract( - v, normalize( n ), 1.0 / ior );\n\t\tvec3 modelScale;\n\t\tmodelScale.x = length( vec3( modelMatrix[ 0 ].xyz ) );\n\t\tmodelScale.y = length( vec3( modelMatrix[ 1 ].xyz ) );\n\t\tmodelScale.z = length( vec3( modelMatrix[ 2 ].xyz ) );\n\t\treturn normalize( refractionVector ) * thickness * modelScale;\n\t}\n\tfloat applyIorToRoughness( const in float roughness, const in float ior ) {\n\t\treturn roughness * clamp( ior * 2.0 - 2.0, 0.0, 1.0 );\n\t}\n\tvec4 getTransmissionSample( const in vec2 fragCoord, const in float roughness, const in float ior ) {\n\t\tfloat framebufferLod = log2( transmissionSamplerSize.x ) * applyIorToRoughness( roughness, ior );\n\t\t#ifdef texture2DLodEXT\n\t\t\treturn texture2DLodEXT( transmissionSamplerMap, fragCoord.xy, framebufferLod );\n\t\t#else\n\t\t\treturn texture2D( transmissionSamplerMap, fragCoord.xy, framebufferLod );\n\t\t#endif\n\t}\n\tvec3 applyVolumeAttenuation( const in vec3 radiance, const in float transmissionDistance, const in vec3 attenuationColor, const in float attenuationDistance ) {\n\t\tif ( attenuationDistance == 0.0 ) {\n\t\t\treturn radiance;\n\t\t} else {\n\t\t\tvec3 attenuationCoefficient = -log( attenuationColor ) / attenuationDistance;\n\t\t\tvec3 transmittance = exp( - attenuationCoefficient * transmissionDistance );\t\t\treturn transmittance * radiance;\n\t\t}\n\t}\n\tvec4 getIBLVolumeRefraction( const in vec3 n, const in vec3 v, const in float roughness, const in vec3 diffuseColor,\n\t\tconst in vec3 specularColor, const in float specularF90, const in vec3 position, const in mat4 modelMatrix,\n\t\tconst in mat4 viewMatrix, const in mat4 projMatrix, const in float ior, const in float thickness,\n\t\tconst in vec3 attenuationColor, const in float attenuationDistance ) {\n\t\tvec3 transmissionRay = getVolumeTransmissionRay( n, v, thickness, ior, modelMatrix );\n\t\tvec3 refractedRayExit = position + transmissionRay;\n\t\tvec4 ndcPos = projMatrix * viewMatrix * vec4( refractedRayExit, 1.0 );\n\t\tvec2 refractionCoords = ndcPos.xy / ndcPos.w;\n\t\trefractionCoords += 1.0;\n\t\trefractionCoords /= 2.0;\n\t\tvec4 transmittedLight = getTransmissionSample( refractionCoords, roughness, ior );\n\t\tvec3 attenuatedColor = applyVolumeAttenuation( transmittedLight.rgb, length( transmissionRay ), attenuationColor, attenuationDistance );\n\t\tvec3 F = EnvironmentBRDF( n, v, specularColor, specularF90, roughness );\n\t\treturn vec4( ( 1.0 - F ) * attenuatedColor * diffuseColor, transmittedLight.a );\n\t}\n#endif",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 ) || defined ( USE_TRANSMISSION )\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_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}",background_frag:"uniform sampler2D t2D;\nvarying vec2 vUv;\nvoid main() {\n\tgl_FragColor = texture2D( t2D, vUv );\n\t#ifdef DECODE_VIDEO_TEXTURE\n\t\tgl_FragColor = vec4( mix( pow( gl_FragColor.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), gl_FragColor.rgb * 0.0773993808, vec3( lessThanEqual( gl_FragColor.rgb, vec3( 0.04045 ) ) ) ), gl_FragColor.w );\n\t#endif\n\t#include \n\t#include \n}",cube_vert:"varying vec3 vWorldDirection;\n#include \nvoid main() {\n\tvWorldDirection = transformDirection( position, modelMatrix );\n\t#include \n\t#include \n\tgl_Position.z = gl_Position.w;\n}",cube_frag:"#include \nuniform float opacity;\nvarying vec3 vWorldDirection;\n#include \nvoid main() {\n\tvec3 vReflect = vWorldDirection;\n\t#include \n\tgl_FragColor = envColor;\n\tgl_FragColor.a *= opacity;\n\t#include \n\t#include \n}",depth_vert:"#include \n#include \n#include \n#include \n#include \n#include \n#include \nvarying vec2 vHighPrecisionZW;\nvoid main() {\n\t#include \n\t#include \n\t#ifdef USE_DISPLACEMENTMAP\n\t\t#include \n\t\t#include \n\t\t#include \n\t#endif\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tvHighPrecisionZW = gl_Position.zw;\n}",depth_frag:"#if DEPTH_PACKING == 3200\n\tuniform float opacity;\n#endif\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvarying vec2 vHighPrecisionZW;\nvoid main() {\n\t#include \n\tvec4 diffuseColor = vec4( 1.0 );\n\t#if DEPTH_PACKING == 3200\n\t\tdiffuseColor.a = opacity;\n\t#endif\n\t#include \n\t#include \n\t#include \n\t#include \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}",distanceRGBA_vert:"#define DISTANCE\nvarying vec3 vWorldPosition;\n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#ifdef USE_DISPLACEMENTMAP\n\t\t#include \n\t\t#include \n\t\t#include \n\t#endif\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tvWorldPosition = worldPosition.xyz;\n}",distanceRGBA_frag:"#define DISTANCE\nuniform vec3 referencePosition;\nuniform float nearDistance;\nuniform float farDistance;\nvarying vec3 vWorldPosition;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main () {\n\t#include \n\tvec4 diffuseColor = vec4( 1.0 );\n\t#include \n\t#include \n\t#include \n\tfloat dist = length( vWorldPosition - referencePosition );\n\tdist = ( dist - nearDistance ) / ( farDistance - nearDistance );\n\tdist = saturate( dist );\n\tgl_FragColor = packDepthToRGBA( dist );\n}",equirect_vert:"varying vec3 vWorldDirection;\n#include \nvoid main() {\n\tvWorldDirection = transformDirection( position, modelMatrix );\n\t#include \n\t#include \n}",equirect_frag:"uniform sampler2D tEquirect;\nvarying vec3 vWorldDirection;\n#include \nvoid main() {\n\tvec3 direction = normalize( vWorldDirection );\n\tvec2 sampleUV = equirectUv( direction );\n\tgl_FragColor = texture2D( tEquirect, sampleUV );\n\t#include \n\t#include \n}",linedashed_vert:"uniform float scale;\nattribute float lineDistance;\nvarying float vLineDistance;\n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\tvLineDistance = scale * lineDistance;\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}",linedashed_frag:"uniform vec3 diffuse;\nuniform float opacity;\nuniform float dashSize;\nuniform float totalSize;\nvarying float vLineDistance;\n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \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 \n\t#include \n\toutgoingLight = diffuseColor.rgb;\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}",meshbasic_vert:"#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#include \n\t#include \n\t#if defined ( USE_ENVMAP ) || defined ( USE_SKINNING )\n\t\t#include \n\t\t#include \n\t\t#include \n\t\t#include \n\t\t#include \n\t#endif\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}",meshbasic_frag:"uniform vec3 diffuse;\nuniform float opacity;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\t#ifdef USE_LIGHTMAP\n\t\tvec4 lightMapTexel = texture2D( lightMap, vUv2 );\n\t\treflectedLight.indirectDiffuse += lightMapTexel.rgb * lightMapIntensity * RECIPROCAL_PI;\n\t#else\n\t\treflectedLight.indirectDiffuse += vec3( 1.0 );\n\t#endif\n\t#include \n\treflectedLight.indirectDiffuse *= diffuseColor.rgb;\n\tvec3 outgoingLight = reflectedLight.indirectDiffuse;\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \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 \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \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 \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \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 \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \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 \n\treflectedLight.indirectDiffuse *= BRDF_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_Lambert( diffuseColor.rgb ) * getShadowMask();\n\t#include \n\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}",meshmatcap_vert:"#define MATCAP\nvarying vec3 vViewPosition;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tvViewPosition = - mvPosition.xyz;\n}",meshmatcap_frag:"#define MATCAP\nuniform vec3 diffuse;\nuniform float opacity;\nuniform sampler2D matcap;\nvarying vec3 vViewPosition;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \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#else\n\t\tvec4 matcapColor = vec4( vec3( mix( 0.2, 0.8, uv.y ) ), 1.0 );\n\t#endif\n\tvec3 outgoingLight = diffuseColor.rgb * matcapColor.rgb;\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}",meshnormal_vert:"#define NORMAL\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( TANGENTSPACE_NORMALMAP )\n\tvarying vec3 vViewPosition;\n#endif\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( TANGENTSPACE_NORMALMAP )\n\tvViewPosition = - mvPosition.xyz;\n#endif\n}",meshnormal_frag:"#define NORMAL\nuniform float opacity;\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( TANGENTSPACE_NORMALMAP )\n\tvarying vec3 vViewPosition;\n#endif\n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#include \n\t#include \n\tgl_FragColor = vec4( packNormalToRGB( normal ), opacity );\n\t#ifdef OPAQUE\n\t\tgl_FragColor.a = 1.0;\n\t#endif\n}",meshphong_vert:"#define PHONG\nvarying vec3 vViewPosition;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tvViewPosition = - mvPosition.xyz;\n\t#include \n\t#include \n\t#include \n\t#include \n}",meshphong_frag:"#define PHONG\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform vec3 specular;\nuniform float shininess;\nuniform float opacity;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \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 \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveRadiance;\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}",meshphysical_vert:"#define STANDARD\nvarying vec3 vViewPosition;\n#ifdef USE_TRANSMISSION\n\tvarying vec3 vWorldPosition;\n#endif\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tvViewPosition = - mvPosition.xyz;\n\t#include \n\t#include \n\t#include \n#ifdef USE_TRANSMISSION\n\tvWorldPosition = worldPosition.xyz;\n#endif\n}",meshphysical_frag:"#define STANDARD\n#ifdef PHYSICAL\n\t#define IOR\n\t#define SPECULAR\n#endif\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float roughness;\nuniform float metalness;\nuniform float opacity;\n#ifdef IOR\n\tuniform float ior;\n#endif\n#ifdef SPECULAR\n\tuniform float specularIntensity;\n\tuniform vec3 specularColor;\n\t#ifdef USE_SPECULARINTENSITYMAP\n\t\tuniform sampler2D specularIntensityMap;\n\t#endif\n\t#ifdef USE_SPECULARCOLORMAP\n\t\tuniform sampler2D specularColorMap;\n\t#endif\n#endif\n#ifdef USE_CLEARCOAT\n\tuniform float clearcoat;\n\tuniform float clearcoatRoughness;\n#endif\n#ifdef USE_SHEEN\n\tuniform vec3 sheenColor;\n\tuniform float sheenRoughness;\n\t#ifdef USE_SHEENCOLORMAP\n\t\tuniform sampler2D sheenColorMap;\n\t#endif\n\t#ifdef USE_SHEENROUGHNESSMAP\n\t\tuniform sampler2D sheenRoughnessMap;\n\t#endif\n#endif\nvarying vec3 vViewPosition;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \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 \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tvec3 totalDiffuse = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse;\n\tvec3 totalSpecular = reflectedLight.directSpecular + reflectedLight.indirectSpecular;\n\t#include \n\tvec3 outgoingLight = totalDiffuse + totalSpecular + totalEmissiveRadiance;\n\t#ifdef USE_SHEEN\n\t\tfloat sheenEnergyComp = 1.0 - 0.157 * max3( material.sheenColor );\n\t\toutgoingLight = outgoingLight * sheenEnergyComp + sheenSpecular;\n\t#endif\n\t#ifdef USE_CLEARCOAT\n\t\tfloat dotNVcc = saturate( dot( geometry.clearcoatNormal, geometry.viewDir ) );\n\t\tvec3 Fcc = F_Schlick( material.clearcoatF0, material.clearcoatF90, dotNVcc );\n\t\toutgoingLight = outgoingLight * ( 1.0 - material.clearcoat * Fcc ) + clearcoatSpecular * material.clearcoat;\n\t#endif\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}",meshtoon_vert:"#define TOON\nvarying vec3 vViewPosition;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tvViewPosition = - mvPosition.xyz;\n\t#include \n\t#include \n\t#include \n}",meshtoon_frag:"#define TOON\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float opacity;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \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 \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}",points_vert:"uniform float size;\nuniform float scale;\n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \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 \n\t#include \n\t#include \n\t#include \n}",points_frag:"uniform vec3 diffuse;\nuniform float opacity;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\tvec3 outgoingLight = vec3( 0.0 );\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include \n\t#include \n\t#include \n\t#include \n\toutgoingLight = diffuseColor.rgb;\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}",shadow_vert:"#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}",shadow_frag:"uniform vec3 color;\nuniform float opacity;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\tgl_FragColor = vec4( color, opacity * ( 1.0 - getShadowMask() ) );\n\t#include \n\t#include \n\t#include \n}",sprite_vert:"uniform float rotation;\nuniform vec2 center;\n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \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 \n\t#include \n\t#include \n}",sprite_frag:"uniform vec3 diffuse;\nuniform float opacity;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\tvec3 outgoingLight = vec3( 0.0 );\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include \n\t#include \n\t#include \n\t#include \n\toutgoingLight = diffuseColor.rgb;\n\t#include \n\t#include \n\t#include \n\t#include \n}"},Rs={common:{diffuse:{value:new Wi(16777215)},opacity:{value:1},map:{value:null},uvTransform:{value:new Pi},uv2Transform:{value:new Pi},alphaMap:{value:null},alphaTest:{value:0}},specularmap:{specularMap:{value:null}},envmap:{envMap:{value:null},flipEnvMap:{value:-1},reflectivity:{value:1},ior:{value:1.5},refractionRatio:{value:.98}},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 Ci(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 Wi(16777215)}},lights:{ambientLightColor:{value:[]},lightProbe:{value:[]},directionalLights:{value:[],properties:{direction:{},color:{}}},directionalLightShadows:{value:[],properties:{shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},directionalShadowMap:{value:[]},directionalShadowMatrix:{value:[]},spotLights:{value:[],properties:{color:{},position:{},direction:{},distance:{},coneCos:{},penumbraCos:{},decay:{}}},spotLightShadows:{value:[],properties:{shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},spotShadowMap:{value:[]},spotShadowMatrix:{value:[]},pointLights:{value:[],properties:{color:{},position:{},decay:{},distance:{}}},pointLightShadows:{value:[],properties:{shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{},shadowCameraNear:{},shadowCameraFar:{}}},pointShadowMap:{value:[]},pointShadowMatrix:{value:[]},hemisphereLights:{value:[],properties:{direction:{},skyColor:{},groundColor:{}}},rectAreaLights:{value:[],properties:{color:{},position:{},width:{},height:{}}},ltc_1:{value:null},ltc_2:{value:null}},points:{diffuse:{value:new Wi(16777215)},opacity:{value:1},size:{value:1},scale:{value:1},map:{value:null},alphaMap:{value:null},alphaTest:{value:0},uvTransform:{value:new Pi}},sprite:{diffuse:{value:new Wi(16777215)},opacity:{value:1},center:{value:new Ci(.5,.5)},rotation:{value:0},map:{value:null},alphaMap:{value:null},alphaTest:{value:0},uvTransform:{value:new Pi}}},Ls={basic:{uniforms:cs([Rs.common,Rs.specularmap,Rs.envmap,Rs.aomap,Rs.lightmap,Rs.fog]),vertexShader:Ps.meshbasic_vert,fragmentShader:Ps.meshbasic_frag},lambert:{uniforms:cs([Rs.common,Rs.specularmap,Rs.envmap,Rs.aomap,Rs.lightmap,Rs.emissivemap,Rs.fog,Rs.lights,{emissive:{value:new Wi(0)}}]),vertexShader:Ps.meshlambert_vert,fragmentShader:Ps.meshlambert_frag},phong:{uniforms:cs([Rs.common,Rs.specularmap,Rs.envmap,Rs.aomap,Rs.lightmap,Rs.emissivemap,Rs.bumpmap,Rs.normalmap,Rs.displacementmap,Rs.fog,Rs.lights,{emissive:{value:new Wi(0)},specular:{value:new Wi(1118481)},shininess:{value:30}}]),vertexShader:Ps.meshphong_vert,fragmentShader:Ps.meshphong_frag},standard:{uniforms:cs([Rs.common,Rs.envmap,Rs.aomap,Rs.lightmap,Rs.emissivemap,Rs.bumpmap,Rs.normalmap,Rs.displacementmap,Rs.roughnessmap,Rs.metalnessmap,Rs.fog,Rs.lights,{emissive:{value:new Wi(0)},roughness:{value:1},metalness:{value:0},envMapIntensity:{value:1}}]),vertexShader:Ps.meshphysical_vert,fragmentShader:Ps.meshphysical_frag},toon:{uniforms:cs([Rs.common,Rs.aomap,Rs.lightmap,Rs.emissivemap,Rs.bumpmap,Rs.normalmap,Rs.displacementmap,Rs.gradientmap,Rs.fog,Rs.lights,{emissive:{value:new Wi(0)}}]),vertexShader:Ps.meshtoon_vert,fragmentShader:Ps.meshtoon_frag},matcap:{uniforms:cs([Rs.common,Rs.bumpmap,Rs.normalmap,Rs.displacementmap,Rs.fog,{matcap:{value:null}}]),vertexShader:Ps.meshmatcap_vert,fragmentShader:Ps.meshmatcap_frag},points:{uniforms:cs([Rs.points,Rs.fog]),vertexShader:Ps.points_vert,fragmentShader:Ps.points_frag},dashed:{uniforms:cs([Rs.common,Rs.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:Ps.linedashed_vert,fragmentShader:Ps.linedashed_frag},depth:{uniforms:cs([Rs.common,Rs.displacementmap]),vertexShader:Ps.depth_vert,fragmentShader:Ps.depth_frag},normal:{uniforms:cs([Rs.common,Rs.bumpmap,Rs.normalmap,Rs.displacementmap,{opacity:{value:1}}]),vertexShader:Ps.meshnormal_vert,fragmentShader:Ps.meshnormal_frag},sprite:{uniforms:cs([Rs.sprite,Rs.fog]),vertexShader:Ps.sprite_vert,fragmentShader:Ps.sprite_frag},background:{uniforms:{uvTransform:{value:new Pi},t2D:{value:null}},vertexShader:Ps.background_vert,fragmentShader:Ps.background_frag},cube:{uniforms:cs([Rs.envmap,{opacity:{value:1}}]),vertexShader:Ps.cube_vert,fragmentShader:Ps.cube_frag},equirect:{uniforms:{tEquirect:{value:null}},vertexShader:Ps.equirect_vert,fragmentShader:Ps.equirect_frag},distanceRGBA:{uniforms:cs([Rs.common,Rs.displacementmap,{referencePosition:{value:new on},nearDistance:{value:1},farDistance:{value:1e3}}]),vertexShader:Ps.distanceRGBA_vert,fragmentShader:Ps.distanceRGBA_frag},shadow:{uniforms:cs([Rs.lights,Rs.fog,{color:{value:new Wi(0)},opacity:{value:1}}]),vertexShader:Ps.shadow_vert,fragmentShader:Ps.shadow_frag}};function Os(t,e,i,n,r,s){const o=new Wi(0);let a,h,l=!0===r?0:1,u=null,c=0,d=null;function p(t,e){i.buffers.color.setClear(t.r,t.g,t.b,e,s)}return{getClearColor:function(){return o},setClearColor:function(t,e=1){o.set(t),l=e,p(o,l)},getClearAlpha:function(){return l},setClearAlpha:function(t){l=t,p(o,l)},render:function(i,r){let s=!1,g=!0===r.isScene?r.background:null;g&&g.isTexture&&(g=e.get(g));const v=t.xr,y=v.getSession&&v.getSession();y&&"additive"===y.environmentBlendMode&&(g=null),null===g?p(o,l):g&&g.isColor&&(p(g,1),s=!0),(t.autoClear||s)&&t.clear(t.autoClearColor,t.autoClearDepth,t.autoClearStencil),g&&(g.isCubeTexture||g.mapping===lt)?(void 0===h&&(h=new as(new ls(1,1,1),new ps({name:"BackgroundCubeMaterial",uniforms:us(Ls.cube.uniforms),vertexShader:Ls.cube.vertexShader,fragmentShader:Ls.cube.fragmentShader,side:m,depthTest:!1,depthWrite:!1,fog:!1})),h.geometry.deleteAttribute("normal"),h.geometry.deleteAttribute("uv"),h.onBeforeRender=function(t,e,i){this.matrixWorld.copyPosition(i.matrixWorld)},Object.defineProperty(h.material,"envMap",{get:function(){return this.uniforms.envMap.value}}),n.update(h)),h.material.uniforms.envMap.value=g,h.material.uniforms.flipEnvMap.value=g.isCubeTexture&&!1===g.isRenderTargetTexture?-1:1,u===g&&c===g.version&&d===t.toneMapping||(h.material.needsUpdate=!0,u=g,c=g.version,d=t.toneMapping),h.layers.enableAll(),i.unshift(h,h.geometry,h.material,0,0,null)):g&&g.isTexture&&(void 0===a&&(a=new as(new Cs(2,2),new ps({name:"BackgroundMaterial",uniforms:us(Ls.background.uniforms),vertexShader:Ls.background.vertexShader,fragmentShader:Ls.background.fragmentShader,side:f,depthTest:!1,depthWrite:!1,fog:!1})),a.geometry.deleteAttribute("normal"),Object.defineProperty(a.material,"map",{get:function(){return this.uniforms.t2D.value}}),n.update(a)),a.material.uniforms.t2D.value=g,!0===g.matrixAutoUpdate&&g.updateMatrix(),a.material.uniforms.uvTransform.value.copy(g.matrix),u===g&&c===g.version&&d===t.toneMapping||(a.material.needsUpdate=!0,u=g,c=g.version,d=t.toneMapping),a.layers.enableAll(),i.unshift(a,a.geometry,a.material,0,0,null))}}}function Ds(t,e,i,n){const r=t.getParameter(34921),s=n.isWebGL2?null:e.get("OES_vertex_array_object"),o=n.isWebGL2||null!==s,a={},h=p(null);let l=h,u=!1;function c(e){return n.isWebGL2?t.bindVertexArray(e):s.bindVertexArrayOES(e)}function d(e){return n.isWebGL2?t.deleteVertexArray(e):s.deleteVertexArrayOES(e)}function p(t){const e=[],i=[],n=[];for(let t=0;t=0){const i=r[e];let n=s[e];if(void 0===n&&("instanceMatrix"===e&&t.instanceMatrix&&(n=t.instanceMatrix),"instanceColor"===e&&t.instanceColor&&(n=t.instanceColor)),void 0===i)return!0;if(i.attribute!==n)return!0;if(n&&i.data!==n.data)return!0;o++}}return l.attributesNum!==o||l.index!==n}(r,x,d,w),b&&function(t,e,i,n){const r={},s=e.attributes;let o=0;const a=i.getAttributes();for(const e in a){if(a[e].location>=0){let i=s[e];void 0===i&&("instanceMatrix"===e&&t.instanceMatrix&&(i=t.instanceMatrix),"instanceColor"===e&&t.instanceColor&&(i=t.instanceColor));const n={};n.attribute=i,i&&i.data&&(n.data=i.data),r[e]=n,o++}}l.attributes=r,l.attributesNum=o,l.index=n}(r,x,d,w)}else{const t=!0===h.wireframe;l.geometry===x.id&&l.program===d.id&&l.wireframe===t||(l.geometry=x.id,l.program=d.id,l.wireframe=t,b=!0)}null!==w&&i.update(w,34963),(b||u)&&(u=!1,function(r,s,o,a){if(!1===n.isWebGL2&&(r.isInstancedMesh||a.isInstancedBufferGeometry)&&null===e.get("ANGLE_instanced_arrays"))return;f();const h=a.attributes,l=o.getAttributes(),u=s.defaultAttributeValues;for(const e in l){const n=l[e];if(n.location>=0){let s=h[e];if(void 0===s&&("instanceMatrix"===e&&r.instanceMatrix&&(s=r.instanceMatrix),"instanceColor"===e&&r.instanceColor&&(s=r.instanceColor)),void 0!==s){const e=s.normalized,o=s.itemSize,h=i.get(s);if(void 0===h)continue;const l=h.buffer,u=h.type,c=h.bytesPerElement;if(s.isInterleavedBufferAttribute){const i=s.data,h=i.stride,d=s.offset;if(i.isInstancedInterleavedBuffer){for(let t=0;t0&&t.getShaderPrecisionFormat(35632,36338).precision>0)return"highp";e="mediump"}return"mediump"===e&&t.getShaderPrecisionFormat(35633,36337).precision>0&&t.getShaderPrecisionFormat(35632,36337).precision>0?"mediump":"lowp"}const s="undefined"!=typeof WebGL2RenderingContext&&t instanceof WebGL2RenderingContext||"undefined"!=typeof WebGL2ComputeRenderingContext&&t instanceof WebGL2ComputeRenderingContext;let o=void 0!==i.precision?i.precision:"highp";const a=r(o);a!==o&&(o=a);const h=s||e.has("WEBGL_draw_buffers"),l=!0===i.logarithmicDepthBuffer,u=t.getParameter(34930),c=t.getParameter(35660),d=t.getParameter(3379),p=t.getParameter(34076),f=t.getParameter(34921),m=t.getParameter(36347),g=t.getParameter(36348),v=t.getParameter(36349),y=c>0,x=s||e.has("OES_texture_float");return{isWebGL2:s,drawBuffers:h,getMaxAnisotropy:function(){if(void 0!==n)return n;if(!0===e.has("EXT_texture_filter_anisotropic")){const i=e.get("EXT_texture_filter_anisotropic");n=t.getParameter(i.MAX_TEXTURE_MAX_ANISOTROPY_EXT)}else n=0;return n},getMaxPrecision:r,precision:o,logarithmicDepthBuffer:l,maxTextures:u,maxVertexTextures:c,maxTextureSize:d,maxCubemapSize:p,maxAttributes:f,maxVertexUniforms:m,maxVaryings:g,maxFragmentUniforms:v,vertexTextures:y,floatFragmentTextures:x,floatVertexTextures:y&&x,maxSamples:s?t.getParameter(36183):0}}function Fs(t){const e=this;let i=null,n=0,r=!1,s=!1;const o=new As,a=new Pi,h={value:null,needsUpdate:!1};function l(){h.value!==i&&(h.value=i,h.needsUpdate=n>0),e.numPlanes=n,e.numIntersection=0}function u(t,i,n,r){const s=null!==t?t.length:0;let l=null;if(0!==s){if(l=h.value,!0!==r||null===l){const e=n+4*s,r=i.matrixWorldInverse;a.getNormalMatrix(r),(null===l||l.length0){const o=new ys(s.height/2);return o.fromEquirectangularTexture(t,r),e.set(r,o),r.addEventListener("dispose",n),i(o.texture,r.mapping)}return null}}}return r},dispose:function(){e=new WeakMap}}}Ls.physical={uniforms:cs([Ls.standard.uniforms,{clearcoat:{value:0},clearcoatMap:{value:null},clearcoatRoughness:{value:0},clearcoatRoughnessMap:{value:null},clearcoatNormalScale:{value:new Ci(1,1)},clearcoatNormalMap:{value:null},sheen:{value:0},sheenColor:{value:new Wi(0)},sheenColorMap:{value:null},sheenRoughness:{value:1},sheenRoughnessMap:{value:null},transmission:{value:0},transmissionMap:{value:null},transmissionSamplerSize:{value:new Ci},transmissionSamplerMap:{value:null},thickness:{value:0},thicknessMap:{value:null},attenuationDistance:{value:0},attenuationColor:{value:new Wi(0)},specularIntensity:{value:1},specularIntensityMap:{value:null},specularColor:{value:new Wi(1,1,1)},specularColorMap:{value:null}}]),vertexShader:Ps.meshphysical_vert,fragmentShader:Ps.meshphysical_frag};class Ns extends fs{constructor(t=-1,e=1,i=1,n=-1,r=.1,s=2e3){super(),this.type="OrthographicCamera",this.zoom=1,this.view=null,this.left=t,this.right=e,this.top=i,this.bottom=n,this.near=r,this.far=s,this.updateProjectionMatrix()}copy(t,e){return super.copy(t,e),this.left=t.left,this.right=t.right,this.top=t.top,this.bottom=t.bottom,this.near=t.near,this.far=t.far,this.zoom=t.zoom,this.view=null===t.view?null:Object.assign({},t.view),this}setViewOffset(t,e,i,n,r,s){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=t,this.view.fullHeight=e,this.view.offsetX=i,this.view.offsetY=n,this.view.width=r,this.view.height=s,this.updateProjectionMatrix()}clearViewOffset(){null!==this.view&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){const t=(this.right-this.left)/(2*this.zoom),e=(this.top-this.bottom)/(2*this.zoom),i=(this.right+this.left)/2,n=(this.top+this.bottom)/2;let r=i-t,s=i+t,o=n+e,a=n-e;if(null!==this.view&&this.view.enabled){const t=(this.right-this.left)/this.view.fullWidth/this.zoom,e=(this.top-this.bottom)/this.view.fullHeight/this.zoom;r+=t*this.view.offsetX,s=r+t*this.view.width,o-=e*this.view.offsetY,a=o-e*this.view.height}this.projectionMatrix.makeOrthographic(r,s,o,a,this.near,this.far),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(t){const e=super.toJSON(t);return e.object.zoom=this.zoom,e.object.left=this.left,e.object.right=this.right,e.object.top=this.top,e.object.bottom=this.bottom,e.object.near=this.near,e.object.far=this.far,null!==this.view&&(e.object.view=Object.assign({},this.view)),e}}Ns.prototype.isOrthographicCamera=!0;const zs=[.125,.215,.35,.446,.526,.582],Us=new Ns,Vs=new Wi;let Hs=null;const Gs=(1+Math.sqrt(5))/2,Ws=1/Gs,Ys=[new on(1,1,1),new on(-1,1,1),new on(1,1,-1),new on(-1,1,-1),new on(0,Gs,Ws),new on(0,Gs,-Ws),new on(Ws,0,Gs),new on(-Ws,0,Gs),new on(Gs,Ws,0),new on(-Gs,Ws,0)];class Xs{constructor(t){this._renderer=t,this._pingPongRenderTarget=null,this._lodMax=0,this._cubeSize=0,this._lodPlanes=[],this._sizeLods=[],this._sigmas=[],this._blurMaterial=null,this._cubemapMaterial=null,this._equirectMaterial=null,this._compileMaterial(this._blurMaterial)}fromScene(t,e=0,i=.1,n=100){Hs=this._renderer.getRenderTarget(),this._setSize(256);const r=this._allocateTargets();return r.depthBuffer=!0,this._sceneToCubeUV(t,i,n,r),e>0&&this._blur(r,0,0,e),this._applyPMREM(r),this._cleanup(r),r}fromEquirectangular(t,e=null){return this._fromTexture(t,e)}fromCubemap(t,e=null){return this._fromTexture(t,e)}compileCubemapShader(){null===this._cubemapMaterial&&(this._cubemapMaterial=Ks(),this._compileMaterial(this._cubemapMaterial))}compileEquirectangularShader(){null===this._equirectMaterial&&(this._equirectMaterial=Qs(),this._compileMaterial(this._equirectMaterial))}dispose(){this._dispose(),null!==this._cubemapMaterial&&this._cubemapMaterial.dispose(),null!==this._equirectMaterial&&this._equirectMaterial.dispose()}_setSize(t){this._lodMax=Math.floor(Math.log2(t)),this._cubeSize=Math.pow(2,this._lodMax)}_dispose(){null!==this._blurMaterial&&this._blurMaterial.dispose(),null!==this._pingPongRenderTarget&&this._pingPongRenderTarget.dispose();for(let t=0;tt-4?a=zs[o-t+4-1]:0===o&&(a=0),n.push(a);const h=1/(s-2),l=-h,u=1+h,c=[l,l,u,l,u,u,l,l,u,u,l,u],d=6,p=6,f=3,m=2,g=1,v=new Float32Array(f*p*d),y=new Float32Array(m*p*d),x=new Float32Array(g*p*d);for(let t=0;t2?0:-1,n=[e,i,0,e+2/3,i,0,e+2/3,i+1,0,e,i,0,e+2/3,i+1,0,e,i+1,0];v.set(n,f*p*t),y.set(c,m*p*t);const r=[t,t,t,t,t,t];x.set(r,g*p*t)}const w=new Gr;w.setAttribute("position",new Er(v,f)),w.setAttribute("uv",new Er(y,m)),w.setAttribute("faceIndex",new Er(x,g)),e.push(w),r>4&&r--}return{lodPlanes:e,sizeLods:i,sigmas:n}}(n)),this._blurMaterial=function(t,e,i){const n=new Float32Array(20),r=new on(0,1,0);return new ps({name:"SphericalGaussianBlur",defines:{n:20,CUBEUV_TEXEL_WIDTH:1/e,CUBEUV_TEXEL_HEIGHT:1/i,CUBEUV_MAX_MIP:t+".0"},uniforms:{envMap:{value:null},samples:{value:1},weights:{value:n},latitudinal:{value:!1},dTheta:{value:0},mipInt:{value:0},poleAxis:{value:r}},vertexShader:Js(),fragmentShader:"\n\n\t\t\tprecision mediump float;\n\t\t\tprecision mediump int;\n\n\t\t\tvarying vec3 vOutputDirection;\n\n\t\t\tuniform sampler2D envMap;\n\t\t\tuniform int samples;\n\t\t\tuniform float weights[ n ];\n\t\t\tuniform bool latitudinal;\n\t\t\tuniform float dTheta;\n\t\t\tuniform float mipInt;\n\t\t\tuniform vec3 poleAxis;\n\n\t\t\t#define ENVMAP_TYPE_CUBE_UV\n\t\t\t#include \n\n\t\t\tvec3 getSample( float theta, vec3 axis ) {\n\n\t\t\t\tfloat cosTheta = cos( theta );\n\t\t\t\t// Rodrigues' axis-angle rotation\n\t\t\t\tvec3 sampleDirection = vOutputDirection * cosTheta\n\t\t\t\t\t+ cross( axis, vOutputDirection ) * sin( theta )\n\t\t\t\t\t+ axis * dot( axis, vOutputDirection ) * ( 1.0 - cosTheta );\n\n\t\t\t\treturn bilinearCubeUV( envMap, sampleDirection, mipInt );\n\n\t\t\t}\n\n\t\t\tvoid main() {\n\n\t\t\t\tvec3 axis = latitudinal ? poleAxis : cross( poleAxis, vOutputDirection );\n\n\t\t\t\tif ( all( equal( axis, vec3( 0.0 ) ) ) ) {\n\n\t\t\t\t\taxis = vec3( vOutputDirection.z, 0.0, - vOutputDirection.x );\n\n\t\t\t\t}\n\n\t\t\t\taxis = normalize( axis );\n\n\t\t\t\tgl_FragColor = vec4( 0.0, 0.0, 0.0, 1.0 );\n\t\t\t\tgl_FragColor.rgb += weights[ 0 ] * getSample( 0.0, axis );\n\n\t\t\t\tfor ( int i = 1; i < n; i++ ) {\n\n\t\t\t\t\tif ( i >= samples ) {\n\n\t\t\t\t\t\tbreak;\n\n\t\t\t\t\t}\n\n\t\t\t\t\tfloat theta = dTheta * float( i );\n\t\t\t\t\tgl_FragColor.rgb += weights[ i ] * getSample( -1.0 * theta, axis );\n\t\t\t\t\tgl_FragColor.rgb += weights[ i ] * getSample( theta, axis );\n\n\t\t\t\t}\n\n\t\t\t}\n\t\t",blending:x,depthTest:!1,depthWrite:!1})}(n,t,e)}return n}_compileMaterial(t){const e=new as(this._lodPlanes[0],t);this._renderer.compile(e,Us)}_sceneToCubeUV(t,e,i,n){const r=new ms(90,1,e,i),s=[1,-1,1,1,1,1],o=[1,1,1,-1,-1,-1],a=this._renderer,h=a.autoClear,l=a.toneMapping;a.getClearColor(Vs),a.toneMapping=Z,a.autoClear=!1;const u=new Ar({name:"PMREM.Background",side:m,depthWrite:!1,depthTest:!1}),c=new as(new ls,u);let d=!1;const p=t.background;p?p.isColor&&(u.color.copy(p),t.background=null,d=!0):(u.color.copy(Vs),d=!0);for(let e=0;e<6;e++){const i=e%3;0===i?(r.up.set(0,s[e],0),r.lookAt(o[e],0,0)):1===i?(r.up.set(0,0,s[e]),r.lookAt(0,o[e],0)):(r.up.set(0,s[e],0),r.lookAt(0,0,o[e]));const h=this._cubeSize;qs(n,i*h,e>2?h:0,h,h),a.setRenderTarget(n),d&&a.render(c,r),a.render(t,r)}c.geometry.dispose(),c.material.dispose(),a.toneMapping=l,a.autoClear=h,t.background=p}_textureToCubeUV(t,e){const i=this._renderer,n=t.mapping===st||t.mapping===ot;n?(null===this._cubemapMaterial&&(this._cubemapMaterial=Ks()),this._cubemapMaterial.uniforms.flipEnvMap.value=!1===t.isRenderTargetTexture?-1:1):null===this._equirectMaterial&&(this._equirectMaterial=Qs());const r=n?this._cubemapMaterial:this._equirectMaterial,s=new as(this._lodPlanes[0],r);r.uniforms.envMap.value=t;const o=this._cubeSize;qs(e,0,0,3*o,2*o),i.setRenderTarget(e),i.render(s,Us)}_applyPMREM(t){const e=this._renderer,i=e.autoClear;e.autoClear=!1;for(let e=1;ev-4?n-v+4:0),4*(this._cubeSize-y),3*y,2*y),a.setRenderTarget(e),a.render(l,Us)}}function js(t,e,i){const n=new Zi(t,e,i);return n.texture.mapping=lt,n.texture.name="PMREM.cubeUv",n.scissorTest=!0,n}function qs(t,e,i,n,r){t.viewport.set(e,i,n,r),t.scissor.set(e,i,n,r)}function Qs(){return new ps({name:"EquirectangularToCubeUV",uniforms:{envMap:{value:null}},vertexShader:Js(),fragmentShader:"\n\n\t\t\tprecision mediump float;\n\t\t\tprecision mediump int;\n\n\t\t\tvarying vec3 vOutputDirection;\n\n\t\t\tuniform sampler2D envMap;\n\n\t\t\t#include \n\n\t\t\tvoid main() {\n\n\t\t\t\tvec3 outputDirection = normalize( vOutputDirection );\n\t\t\t\tvec2 uv = equirectUv( outputDirection );\n\n\t\t\t\tgl_FragColor = vec4( texture2D ( envMap, uv ).rgb, 1.0 );\n\n\t\t\t}\n\t\t",blending:x,depthTest:!1,depthWrite:!1})}function Ks(){return new ps({name:"CubemapToCubeUV",uniforms:{envMap:{value:null},flipEnvMap:{value:-1}},vertexShader:Js(),fragmentShader:"\n\n\t\t\tprecision mediump float;\n\t\t\tprecision mediump int;\n\n\t\t\tuniform float flipEnvMap;\n\n\t\t\tvarying vec3 vOutputDirection;\n\n\t\t\tuniform samplerCube envMap;\n\n\t\t\tvoid main() {\n\n\t\t\t\tgl_FragColor = textureCube( envMap, vec3( flipEnvMap * vOutputDirection.x, vOutputDirection.yz ) );\n\n\t\t\t}\n\t\t",blending:x,depthTest:!1,depthWrite:!1})}function Js(){return"\n\n\t\tprecision mediump float;\n\t\tprecision mediump int;\n\n\t\tattribute float faceIndex;\n\n\t\tvarying vec3 vOutputDirection;\n\n\t\t// RH coordinate system; PMREM face-indexing convention\n\t\tvec3 getDirection( vec2 uv, float face ) {\n\n\t\t\tuv = 2.0 * uv - 1.0;\n\n\t\t\tvec3 direction = vec3( uv, 1.0 );\n\n\t\t\tif ( face == 0.0 ) {\n\n\t\t\t\tdirection = direction.zyx; // ( 1, v, u ) pos x\n\n\t\t\t} else if ( face == 1.0 ) {\n\n\t\t\t\tdirection = direction.xzy;\n\t\t\t\tdirection.xz *= -1.0; // ( -u, 1, -v ) pos y\n\n\t\t\t} else if ( face == 2.0 ) {\n\n\t\t\t\tdirection.x *= -1.0; // ( -u, v, 1 ) pos z\n\n\t\t\t} else if ( face == 3.0 ) {\n\n\t\t\t\tdirection = direction.zyx;\n\t\t\t\tdirection.xz *= -1.0; // ( -1, v, -u ) neg x\n\n\t\t\t} else if ( face == 4.0 ) {\n\n\t\t\t\tdirection = direction.xzy;\n\t\t\t\tdirection.xy *= -1.0; // ( -u, -1, v ) neg y\n\n\t\t\t} else if ( face == 5.0 ) {\n\n\t\t\t\tdirection.z *= -1.0; // ( u, v, -1 ) neg z\n\n\t\t\t}\n\n\t\t\treturn direction;\n\n\t\t}\n\n\t\tvoid main() {\n\n\t\t\tvOutputDirection = getDirection( uv, faceIndex );\n\t\t\tgl_Position = vec4( position, 1.0 );\n\n\t\t}\n\t"}function Zs(t){let e=new WeakMap,i=null;function n(t){const i=t.target;i.removeEventListener("dispose",n);const r=e.get(i);void 0!==r&&(e.delete(i),r.dispose())}return{get:function(r){if(r&&r.isTexture){const s=r.mapping,o=s===at||s===ht,a=s===st||s===ot;if(o||a){if(r.isRenderTargetTexture&&!0===r.needsPMREMUpdate){r.needsPMREMUpdate=!1;let n=e.get(r);return null===i&&(i=new Xs(t)),n=o?i.fromEquirectangular(r,n):i.fromCubemap(r,n),e.set(r,n),n.texture}if(e.has(r))return e.get(r).texture;{const s=r.image;if(o&&s&&s.height>0||a&&s&&function(t){let e=0;for(let i=0;i<6;i++)void 0!==t[i]&&e++;return 6===e}(s)){null===i&&(i=new Xs(t));const s=o?i.fromEquirectangular(r):i.fromCubemap(r);return e.set(r,s),r.addEventListener("dispose",n),s.texture}return null}}}return r},dispose:function(){e=new WeakMap,null!==i&&(i.dispose(),i=null)}}}function $s(t){const e={};function i(i){if(void 0!==e[i])return e[i];let n;switch(i){case"WEBGL_depth_texture":n=t.getExtension("WEBGL_depth_texture")||t.getExtension("MOZ_WEBGL_depth_texture")||t.getExtension("WEBKIT_WEBGL_depth_texture");break;case"EXT_texture_filter_anisotropic":n=t.getExtension("EXT_texture_filter_anisotropic")||t.getExtension("MOZ_EXT_texture_filter_anisotropic")||t.getExtension("WEBKIT_EXT_texture_filter_anisotropic");break;case"WEBGL_compressed_texture_s3tc":n=t.getExtension("WEBGL_compressed_texture_s3tc")||t.getExtension("MOZ_WEBGL_compressed_texture_s3tc")||t.getExtension("WEBKIT_WEBGL_compressed_texture_s3tc");break;case"WEBGL_compressed_texture_pvrtc":n=t.getExtension("WEBGL_compressed_texture_pvrtc")||t.getExtension("WEBKIT_WEBGL_compressed_texture_pvrtc");break;default:n=t.getExtension(i)}return e[i]=n,n}return{has:function(t){return null!==i(t)},init:function(t){t.isWebGL2?i("EXT_color_buffer_float"):(i("WEBGL_depth_texture"),i("OES_texture_float"),i("OES_texture_half_float"),i("OES_texture_half_float_linear"),i("OES_standard_derivatives"),i("OES_element_index_uint"),i("OES_vertex_array_object"),i("ANGLE_instanced_arrays")),i("OES_texture_float_linear"),i("EXT_color_buffer_half_float"),i("WEBGL_multisampled_render_to_texture")},get:function(t){const e=i(t);return e}}}function to(t,e,i,n){const r={},s=new WeakMap;function o(t){const a=t.target;null!==a.index&&e.remove(a.index);for(const t in a.attributes)e.remove(a.attributes[t]);a.removeEventListener("dispose",o),delete r[a.id];const h=s.get(a);h&&(e.remove(h),s.delete(a)),n.releaseStatesOfGeometry(a),!0===a.isInstancedBufferGeometry&&delete a._maxInstanceCount,i.memory.geometries--}function a(t){const i=[],n=t.index,r=t.attributes.position;let o=0;if(null!==n){const t=n.array;o=n.version;for(let e=0,n=t.length;ee.maxTextureSize&&(f=Math.ceil(p/e.maxTextureSize),p=e.maxTextureSize);const m=new Float32Array(p*f*4*r),g=new $i(m,p,f,r);g.type=Pt,g.needsUpdate=!0;const v=4*d;for(let e=0;e0)return t;const r=e*i;let s=po[r];if(void 0===s&&(s=new Float32Array(r),po[r]=s),0!==e){n.toArray(s,0);for(let n=1,r=0;n!==e;++n)r+=i,t[n].toArray(s,r)}return s}function xo(t,e){if(t.length!==e.length)return!1;for(let i=0,n=t.length;i/gm;function Aa(t){return t.replace(ba,Ta)}function Ta(t,e){const i=Ps[e];if(void 0===i)throw new Error("Can not resolve #include <"+e+">");return Aa(i)}const Sa=/#pragma unroll_loop[\s]+?for \( int i \= (\d+)\; i < (\d+)\; i \+\+ \) \{([\s\S]+?)(?=\})\}/g,Ea=/#pragma unroll_loop_start\s+for\s*\(\s*int\s+i\s*=\s*(\d+)\s*;\s*i\s*<\s*(\d+)\s*;\s*i\s*\+\+\s*\)\s*{([\s\S]+?)}\s+#pragma unroll_loop_end/g;function Ma(t){return t.replace(Ea,Ca).replace(Sa,_a)}function _a(t,e,i,n){return Ca(t,e,i,n)}function Ca(t,e,i,n){let r="";for(let t=parseInt(e);t0&&(x+="\n"),w=[g,v].filter(ya).join("\n"),w.length>0&&(w+="\n")):(x=[Pa(i),"#define SHADER_NAME "+i.shaderName,v,i.instancing?"#define USE_INSTANCING":"",i.instancingColor?"#define USE_INSTANCING_COLOR":"",i.supportsVertexTextures?"#define VERTEX_TEXTURES":"",i.useFog&&i.fog?"#define USE_FOG":"",i.useFog&&i.fogExp2?"#define FOG_EXP2":"",i.map?"#define USE_MAP":"",i.envMap?"#define USE_ENVMAP":"",i.envMap?"#define "+u:"",i.lightMap?"#define USE_LIGHTMAP":"",i.aoMap?"#define USE_AOMAP":"",i.emissiveMap?"#define USE_EMISSIVEMAP":"",i.bumpMap?"#define USE_BUMPMAP":"",i.normalMap?"#define USE_NORMALMAP":"",i.normalMap&&i.objectSpaceNormalMap?"#define OBJECTSPACE_NORMALMAP":"",i.normalMap&&i.tangentSpaceNormalMap?"#define TANGENTSPACE_NORMALMAP":"",i.clearcoatMap?"#define USE_CLEARCOATMAP":"",i.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",i.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",i.displacementMap&&i.supportsVertexTextures?"#define USE_DISPLACEMENTMAP":"",i.specularMap?"#define USE_SPECULARMAP":"",i.specularIntensityMap?"#define USE_SPECULARINTENSITYMAP":"",i.specularColorMap?"#define USE_SPECULARCOLORMAP":"",i.roughnessMap?"#define USE_ROUGHNESSMAP":"",i.metalnessMap?"#define USE_METALNESSMAP":"",i.alphaMap?"#define USE_ALPHAMAP":"",i.transmission?"#define USE_TRANSMISSION":"",i.transmissionMap?"#define USE_TRANSMISSIONMAP":"",i.thicknessMap?"#define USE_THICKNESSMAP":"",i.sheenColorMap?"#define USE_SHEENCOLORMAP":"",i.sheenRoughnessMap?"#define USE_SHEENROUGHNESSMAP":"",i.vertexTangents?"#define USE_TANGENT":"",i.vertexColors?"#define USE_COLOR":"",i.vertexAlphas?"#define USE_COLOR_ALPHA":"",i.vertexUvs?"#define USE_UV":"",i.uvsVertexOnly?"#define UVS_VERTEX_ONLY":"",i.flatShading?"#define FLAT_SHADED":"",i.skinning?"#define USE_SKINNING":"",i.morphTargets?"#define USE_MORPHTARGETS":"",i.morphNormals&&!1===i.flatShading?"#define USE_MORPHNORMALS":"",i.morphColors&&i.isWebGL2?"#define USE_MORPHCOLORS":"",i.morphTargetsCount>0&&i.isWebGL2?"#define MORPHTARGETS_TEXTURE":"",i.morphTargetsCount>0&&i.isWebGL2?"#define MORPHTARGETS_TEXTURE_STRIDE "+i.morphTextureStride:"",i.morphTargetsCount>0&&i.isWebGL2?"#define MORPHTARGETS_COUNT "+i.morphTargetsCount:"",i.doubleSided?"#define DOUBLE_SIDED":"",i.flipSided?"#define FLIP_SIDED":"",i.shadowMapEnabled?"#define USE_SHADOWMAP":"",i.shadowMapEnabled?"#define "+h:"",i.sizeAttenuation?"#define USE_SIZEATTENUATION":"",i.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",i.logarithmicDepthBuffer&&i.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","\tattribute mat4 instanceMatrix;","#endif","#ifdef USE_INSTANCING_COLOR","\tattribute vec3 instanceColor;","#endif","attribute vec3 position;","attribute vec3 normal;","attribute vec2 uv;","#ifdef USE_TANGENT","\tattribute vec4 tangent;","#endif","#if defined( USE_COLOR_ALPHA )","\tattribute vec4 color;","#elif defined( USE_COLOR )","\tattribute vec3 color;","#endif","#if ( defined( USE_MORPHTARGETS ) && ! defined( MORPHTARGETS_TEXTURE ) )","\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(ya).join("\n"),w=[g,Pa(i),"#define SHADER_NAME "+i.shaderName,v,i.useFog&&i.fog?"#define USE_FOG":"",i.useFog&&i.fogExp2?"#define FOG_EXP2":"",i.map?"#define USE_MAP":"",i.matcap?"#define USE_MATCAP":"",i.envMap?"#define USE_ENVMAP":"",i.envMap?"#define "+l:"",i.envMap?"#define "+u:"",i.envMap?"#define "+f:"",m?"#define CUBEUV_TEXEL_WIDTH "+m.texelWidth:"",m?"#define CUBEUV_TEXEL_HEIGHT "+m.texelHeight:"",m?"#define CUBEUV_MAX_MIP "+m.maxMip+".0":"",i.lightMap?"#define USE_LIGHTMAP":"",i.aoMap?"#define USE_AOMAP":"",i.emissiveMap?"#define USE_EMISSIVEMAP":"",i.bumpMap?"#define USE_BUMPMAP":"",i.normalMap?"#define USE_NORMALMAP":"",i.normalMap&&i.objectSpaceNormalMap?"#define OBJECTSPACE_NORMALMAP":"",i.normalMap&&i.tangentSpaceNormalMap?"#define TANGENTSPACE_NORMALMAP":"",i.clearcoat?"#define USE_CLEARCOAT":"",i.clearcoatMap?"#define USE_CLEARCOATMAP":"",i.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",i.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",i.specularMap?"#define USE_SPECULARMAP":"",i.specularIntensityMap?"#define USE_SPECULARINTENSITYMAP":"",i.specularColorMap?"#define USE_SPECULARCOLORMAP":"",i.roughnessMap?"#define USE_ROUGHNESSMAP":"",i.metalnessMap?"#define USE_METALNESSMAP":"",i.alphaMap?"#define USE_ALPHAMAP":"",i.alphaTest?"#define USE_ALPHATEST":"",i.sheen?"#define USE_SHEEN":"",i.sheenColorMap?"#define USE_SHEENCOLORMAP":"",i.sheenRoughnessMap?"#define USE_SHEENROUGHNESSMAP":"",i.transmission?"#define USE_TRANSMISSION":"",i.transmissionMap?"#define USE_TRANSMISSIONMAP":"",i.thicknessMap?"#define USE_THICKNESSMAP":"",i.decodeVideoTexture?"#define DECODE_VIDEO_TEXTURE":"",i.vertexTangents?"#define USE_TANGENT":"",i.vertexColors||i.instancingColor?"#define USE_COLOR":"",i.vertexAlphas?"#define USE_COLOR_ALPHA":"",i.vertexUvs?"#define USE_UV":"",i.uvsVertexOnly?"#define UVS_VERTEX_ONLY":"",i.gradientMap?"#define USE_GRADIENTMAP":"",i.flatShading?"#define FLAT_SHADED":"",i.doubleSided?"#define DOUBLE_SIDED":"",i.flipSided?"#define FLIP_SIDED":"",i.shadowMapEnabled?"#define USE_SHADOWMAP":"",i.shadowMapEnabled?"#define "+h:"",i.premultipliedAlpha?"#define PREMULTIPLIED_ALPHA":"",i.physicallyCorrectLights?"#define PHYSICALLY_CORRECT_LIGHTS":"",i.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",i.logarithmicDepthBuffer&&i.rendererExtensionFragDepth?"#define USE_LOGDEPTHBUF_EXT":"","uniform mat4 viewMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;",i.toneMapping!==Z?"#define TONE_MAPPING":"",i.toneMapping!==Z?Ps.tonemapping_pars_fragment:"",i.toneMapping!==Z?va("toneMapping",i.toneMapping):"",i.dithering?"#define DITHERING":"",i.opaque?"#define OPAQUE":"",Ps.encodings_pars_fragment,ga("linearToOutputTexel",i.outputEncoding),i.useDepthPacking?"#define DEPTH_PACKING "+i.depthPacking:"","\n"].filter(ya).join("\n")),o=Aa(o),o=xa(o,i),o=wa(o,i),a=Aa(a),a=xa(a,i),a=wa(a,i),o=Ma(o),a=Ma(a),i.isWebGL2&&!0!==i.isRawShaderMaterial&&(b="#version 300 es\n",x=["precision mediump sampler2DArray;","#define attribute in","#define varying out","#define texture2D texture"].join("\n")+"\n"+x,w=["#define varying in",i.glslVersion===pi?"":"layout(location = 0) out highp vec4 pc_fragColor;",i.glslVersion===pi?"":"#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"+w);const A=b+w+a,T=pa(r,35633,b+x+o),S=pa(r,35632,A);if(r.attachShader(y,T),r.attachShader(y,S),void 0!==i.index0AttributeName?r.bindAttribLocation(y,0,i.index0AttributeName):!0===i.morphTargets&&r.bindAttribLocation(y,0,"position"),r.linkProgram(y),t.debug.checkShaderErrors){const t=r.getProgramInfoLog(y).trim(),e=r.getShaderInfoLog(T).trim(),i=r.getShaderInfoLog(S).trim();let n=!0,s=!0;if(!1===r.getProgramParameter(y,35714)){n=!1;ma(r,T,"vertex"),ma(r,S,"fragment")}else""!==t||""!==e&&""!==i||(s=!1);s&&(this.diagnostics={runnable:n,programLog:t,vertexShader:{log:e,prefix:x},fragmentShader:{log:i,prefix:w}})}let E,M;return r.deleteShader(T),r.deleteShader(S),this.getUniforms=function(){return void 0===E&&(E=new da(r,y)),E},this.getAttributes=function(){return void 0===M&&(M=function(t,e){const i={},n=t.getProgramParameter(e,35721);for(let r=0;r0,I=s.clearcoat>0;return{isWebGL2:u,shaderID:E,shaderName:s.type,vertexShader:C,fragmentShader:P,defines:s.defines,customVertexShaderID:R,customFragmentShaderID:L,isRawShaderMaterial:!0===s.isRawShaderMaterial,glslVersion:s.glslVersion,precision:p,instancing:!0===y.isInstancedMesh,instancingColor:!0===y.isInstancedMesh&&null!==y.instanceColor,supportsVertexTextures:d,outputEncoding:null===D?t.outputEncoding:!0===D.isXRRenderTarget?D.texture.encoding:Oe,map:!!s.map,matcap:!!s.matcap,envMap:!!T,envMapMode:T&&T.mapping,envMapCubeUVHeight:S,lightMap:!!s.lightMap,aoMap:!!s.aoMap,emissiveMap:!!s.emissiveMap,bumpMap:!!s.bumpMap,normalMap:!!s.normalMap,objectSpaceNormalMap:s.normalMapType===ke,tangentSpaceNormalMap:s.normalMapType===Fe,decodeVideoTexture:!!s.map&&!0===s.map.isVideoTexture&&s.map.encoding===De,clearcoat:I,clearcoatMap:I&&!!s.clearcoatMap,clearcoatRoughnessMap:I&&!!s.clearcoatRoughnessMap,clearcoatNormalMap:I&&!!s.clearcoatNormalMap,displacementMap:!!s.displacementMap,roughnessMap:!!s.roughnessMap,metalnessMap:!!s.metalnessMap,specularMap:!!s.specularMap,specularIntensityMap:!!s.specularIntensityMap,specularColorMap:!!s.specularColorMap,opaque:!1===s.transparent&&s.blending===w,alphaMap:!!s.alphaMap,alphaTest:B,gradientMap:!!s.gradientMap,sheen:s.sheen>0,sheenColorMap:!!s.sheenColorMap,sheenRoughnessMap:!!s.sheenRoughnessMap,transmission:s.transmission>0,transmissionMap:!!s.transmissionMap,thicknessMap:!!s.thicknessMap,combine:s.combine,vertexTangents:!!s.normalMap&&!!b.attributes.tangent,vertexColors:s.vertexColors,vertexAlphas:!0===s.vertexColors&&!!b.attributes.color&&4===b.attributes.color.itemSize,vertexUvs:!!(s.map||s.bumpMap||s.normalMap||s.specularMap||s.alphaMap||s.emissiveMap||s.roughnessMap||s.metalnessMap||s.clearcoatMap||s.clearcoatRoughnessMap||s.clearcoatNormalMap||s.displacementMap||s.transmissionMap||s.thicknessMap||s.specularIntensityMap||s.specularColorMap||s.sheenColorMap||s.sheenRoughnessMap),uvsVertexOnly:!(s.map||s.bumpMap||s.normalMap||s.specularMap||s.alphaMap||s.emissiveMap||s.roughnessMap||s.metalnessMap||s.clearcoatNormalMap||s.transmission>0||s.transmissionMap||s.thicknessMap||s.specularIntensityMap||s.specularColorMap||s.sheen>0||s.sheenColorMap||s.sheenRoughnessMap||!s.displacementMap),fog:!!x,useFog:!0===s.fog,fogExp2:x&&x.isFogExp2,flatShading:!!s.flatShading,sizeAttenuation:s.sizeAttenuation,logarithmicDepthBuffer:c,skinning:!0===y.isSkinnedMesh,morphTargets:void 0!==b.morphAttributes.position,morphNormals:void 0!==b.morphAttributes.normal,morphColors:void 0!==b.morphAttributes.color,morphTargetsCount:_,morphTextureStride:O,numDirLights:a.directional.length,numPointLights:a.point.length,numSpotLights:a.spot.length,numRectAreaLights:a.rectArea.length,numHemiLights:a.hemi.length,numDirLightShadows:a.directionalShadowMap.length,numPointLightShadows:a.pointShadowMap.length,numSpotLightShadows:a.spotShadowMap.length,numClippingPlanes:o.numPlanes,numClipIntersection:o.numIntersection,dithering:s.dithering,shadowMapEnabled:t.shadowMap.enabled&&l.length>0,shadowMapType:t.shadowMap.type,toneMapping:s.toneMapped?t.toneMapping:Z,physicallyCorrectLights:t.physicallyCorrectLights,premultipliedAlpha:s.premultipliedAlpha,doubleSided:s.side===g,flipSided:s.side===m,useDepthPacking:!!s.depthPacking,depthPacking:s.depthPacking||0,index0AttributeName:s.index0AttributeName,extensionDerivatives:s.extensions&&s.extensions.derivatives,extensionFragDepth:s.extensions&&s.extensions.fragDepth,extensionDrawBuffers:s.extensions&&s.extensions.drawBuffers,extensionShaderTextureLOD:s.extensions&&s.extensions.shaderTextureLOD,rendererExtensionFragDepth:u||n.has("EXT_frag_depth"),rendererExtensionDrawBuffers:u||n.has("WEBGL_draw_buffers"),rendererExtensionShaderTextureLod:u||n.has("EXT_shader_texture_lod"),customProgramCacheKey:s.customProgramCacheKey()}},getProgramCacheKey:function(e){const i=[];if(e.shaderID?i.push(e.shaderID):(i.push(e.customVertexShaderID),i.push(e.customFragmentShaderID)),void 0!==e.defines)for(const t in e.defines)i.push(t),i.push(e.defines[t]);return!1===e.isRawShaderMaterial&&(!function(t,e){t.push(e.precision),t.push(e.outputEncoding),t.push(e.envMapMode),t.push(e.envMapCubeUVHeight),t.push(e.combine),t.push(e.vertexUvs),t.push(e.fogExp2),t.push(e.sizeAttenuation),t.push(e.morphTargetsCount),t.push(e.morphAttributeCount),t.push(e.numDirLights),t.push(e.numPointLights),t.push(e.numSpotLights),t.push(e.numHemiLights),t.push(e.numRectAreaLights),t.push(e.numDirLightShadows),t.push(e.numPointLightShadows),t.push(e.numSpotLightShadows),t.push(e.shadowMapType),t.push(e.toneMapping),t.push(e.numClippingPlanes),t.push(e.numClipIntersection),t.push(e.depthPacking)}(i,e),function(t,e){a.disableAll(),e.isWebGL2&&a.enable(0);e.supportsVertexTextures&&a.enable(1);e.instancing&&a.enable(2);e.instancingColor&&a.enable(3);e.map&&a.enable(4);e.matcap&&a.enable(5);e.envMap&&a.enable(6);e.lightMap&&a.enable(7);e.aoMap&&a.enable(8);e.emissiveMap&&a.enable(9);e.bumpMap&&a.enable(10);e.normalMap&&a.enable(11);e.objectSpaceNormalMap&&a.enable(12);e.tangentSpaceNormalMap&&a.enable(13);e.clearcoat&&a.enable(14);e.clearcoatMap&&a.enable(15);e.clearcoatRoughnessMap&&a.enable(16);e.clearcoatNormalMap&&a.enable(17);e.displacementMap&&a.enable(18);e.specularMap&&a.enable(19);e.roughnessMap&&a.enable(20);e.metalnessMap&&a.enable(21);e.gradientMap&&a.enable(22);e.alphaMap&&a.enable(23);e.alphaTest&&a.enable(24);e.vertexColors&&a.enable(25);e.vertexAlphas&&a.enable(26);e.vertexUvs&&a.enable(27);e.vertexTangents&&a.enable(28);e.uvsVertexOnly&&a.enable(29);e.fog&&a.enable(30);t.push(a.mask),a.disableAll(),e.useFog&&a.enable(0);e.flatShading&&a.enable(1);e.logarithmicDepthBuffer&&a.enable(2);e.skinning&&a.enable(3);e.morphTargets&&a.enable(4);e.morphNormals&&a.enable(5);e.morphColors&&a.enable(6);e.premultipliedAlpha&&a.enable(7);e.shadowMapEnabled&&a.enable(8);e.physicallyCorrectLights&&a.enable(9);e.doubleSided&&a.enable(10);e.flipSided&&a.enable(11);e.useDepthPacking&&a.enable(12);e.dithering&&a.enable(13);e.specularIntensityMap&&a.enable(14);e.specularColorMap&&a.enable(15);e.transmission&&a.enable(16);e.transmissionMap&&a.enable(17);e.thicknessMap&&a.enable(18);e.sheen&&a.enable(19);e.sheenColorMap&&a.enable(20);e.sheenRoughnessMap&&a.enable(21);e.decodeVideoTexture&&a.enable(22);e.opaque&&a.enable(23);t.push(a.mask)}(i,e),i.push(t.outputEncoding)),i.push(e.customProgramCacheKey),i.join()},getUniforms:function(t){const e=f[t.type];let i;if(e){const t=Ls[e];i=ds.clone(t.uniforms)}else i=t.uniforms;return i},acquireProgram:function(e,i){let n;for(let t=0,e=l.length;t0?n.push(u):!0===o.transparent?r.push(u):i.push(u)},unshift:function(t,e,o,a,h,l){const u=s(t,e,o,a,h,l);o.transmission>0?n.unshift(u):!0===o.transparent?r.unshift(u):i.unshift(u)},finish:function(){for(let i=e,n=t.length;i1&&i.sort(t||Fa),n.length>1&&n.sort(e||ka),r.length>1&&r.sort(e||ka)}}}function za(){let t=new WeakMap;return{get:function(e,i){let n;return!1===t.has(e)?(n=new Na,t.set(e,[n])):i>=t.get(e).length?(n=new Na,t.get(e).push(n)):n=t.get(e)[i],n},dispose:function(){t=new WeakMap}}}function Ua(){const t={};return{get:function(e){if(void 0!==t[e.id])return t[e.id];let i;switch(e.type){case"DirectionalLight":i={direction:new on,color:new Wi};break;case"SpotLight":i={position:new on,direction:new on,color:new Wi,distance:0,coneCos:0,penumbraCos:0,decay:0};break;case"PointLight":i={position:new on,color:new Wi,distance:0,decay:0};break;case"HemisphereLight":i={direction:new on,skyColor:new Wi,groundColor:new Wi};break;case"RectAreaLight":i={color:new Wi,position:new on,halfWidth:new on,halfHeight:new on}}return t[e.id]=i,i}}}let Va=0;function Ha(t,e){return(e.castShadow?1:0)-(t.castShadow?1:0)}function Ga(t,e){const i=new Ua,n=function(){const t={};return{get:function(e){if(void 0!==t[e.id])return t[e.id];let i;switch(e.type){case"DirectionalLight":case"SpotLight":i={shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new Ci};break;case"PointLight":i={shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new Ci,shadowCameraNear:1,shadowCameraFar:1e3}}return t[e.id]=i,i}}}(),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:[],rectAreaLTC1:null,rectAreaLTC2:null,point:[],pointShadow:[],pointShadowMap:[],pointShadowMatrix:[],hemi:[]};for(let t=0;t<9;t++)r.probe.push(new on);const s=new on,o=new kn,a=new kn;return{setup:function(s,o){let a=0,h=0,l=0;for(let t=0;t<9;t++)r.probe[t].set(0,0,0);let u=0,c=0,d=0,p=0,f=0,m=0,g=0,v=0;s.sort(Ha);const y=!0!==o?Math.PI:1;for(let t=0,e=s.length;t0&&(e.isWebGL2||!0===t.has("OES_texture_float_linear")?(r.rectAreaLTC1=Rs.LTC_FLOAT_1,r.rectAreaLTC2=Rs.LTC_FLOAT_2):!0===t.has("OES_texture_half_float_linear")&&(r.rectAreaLTC1=Rs.LTC_HALF_1,r.rectAreaLTC2=Rs.LTC_HALF_2)),r.ambient[0]=a,r.ambient[1]=h,r.ambient[2]=l;const x=r.hash;x.directionalLength===u&&x.pointLength===c&&x.spotLength===d&&x.rectAreaLength===p&&x.hemiLength===f&&x.numDirectionalShadows===m&&x.numPointShadows===g&&x.numSpotShadows===v||(r.directional.length=u,r.spot.length=d,r.rectArea.length=p,r.point.length=c,r.hemi.length=f,r.directionalShadow.length=m,r.directionalShadowMap.length=m,r.pointShadow.length=g,r.pointShadowMap.length=g,r.spotShadow.length=v,r.spotShadowMap.length=v,r.directionalShadowMatrix.length=m,r.pointShadowMatrix.length=g,r.spotShadowMatrix.length=v,x.directionalLength=u,x.pointLength=c,x.spotLength=d,x.rectAreaLength=p,x.hemiLength=f,x.numDirectionalShadows=m,x.numPointShadows=g,x.numSpotShadows=v,r.version=Va++)},setupView:function(t,e){let i=0,n=0,h=0,l=0,u=0;const c=e.matrixWorldInverse;for(let e=0,d=t.length;e=i.get(n).length?(s=new Wa(t,e),i.get(n).push(s)):s=i.get(n)[r],s},dispose:function(){i=new WeakMap}}}class Xa extends br{constructor(t){super(),this.type="MeshDepthMaterial",this.depthPacking=Be,this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.wireframe=!1,this.wireframeLinewidth=1,this.setValues(t)}copy(t){return super.copy(t),this.depthPacking=t.depthPacking,this.map=t.map,this.alphaMap=t.alphaMap,this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this}}Xa.prototype.isMeshDepthMaterial=!0;class ja extends br{constructor(t){super(),this.type="MeshDistanceMaterial",this.referencePosition=new on,this.nearDistance=1,this.farDistance=1e3,this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.setValues(t)}copy(t){return super.copy(t),this.referencePosition.copy(t.referencePosition),this.nearDistance=t.nearDistance,this.farDistance=t.farDistance,this.map=t.map,this.alphaMap=t.alphaMap,this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this}}ja.prototype.isMeshDistanceMaterial=!0;function qa(t,e,i){let n=new Es;const r=new Ci,s=new Ci,o=new Ji,a=new Xa({depthPacking:Ie}),h=new ja,l={},u=i.maxTextureSize,d={0:m,1:f,2:g},v=new ps({defines:{VSM_SAMPLES:8},uniforms:{shadow_pass:{value:null},resolution:{value:new Ci},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 \nvoid main() {\n\tconst float samples = float( VSM_SAMPLES );\n\tfloat mean = 0.0;\n\tfloat squared_mean = 0.0;\n\tfloat uvStride = samples <= 1.0 ? 0.0 : 2.0 / ( samples - 1.0 );\n\tfloat uvStart = samples <= 1.0 ? 0.0 : - 1.0;\n\tfor ( float i = 0.0; i < samples; i ++ ) {\n\t\tfloat uvOffset = uvStart + i * uvStride;\n\t\t#ifdef HORIZONTAL_PASS\n\t\t\tvec2 distribution = unpackRGBATo2Half( texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( uvOffset, 0.0 ) * radius ) / resolution ) );\n\t\t\tmean += distribution.x;\n\t\t\tsquared_mean += distribution.y * distribution.y + distribution.x * distribution.x;\n\t\t#else\n\t\t\tfloat depth = unpackRGBAToDepth( texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( 0.0, uvOffset ) * radius ) / resolution ) );\n\t\t\tmean += depth;\n\t\t\tsquared_mean += depth * depth;\n\t\t#endif\n\t}\n\tmean = mean / samples;\n\tsquared_mean = squared_mean / samples;\n\tfloat std_dev = sqrt( squared_mean - mean * mean );\n\tgl_FragColor = pack2HalfToRGBA( vec2( mean, std_dev ) );\n}"}),y=v.clone();y.defines.HORIZONTAL_PASS=1;const w=new Gr;w.setAttribute("position",new Er(new Float32Array([-1,-1,.5,3,-1,.5,-1,3,.5]),3));const b=new as(w,v),A=this;function T(i,n){const r=e.update(b);v.defines.VSM_SAMPLES!==i.blurSamples&&(v.defines.VSM_SAMPLES=i.blurSamples,y.defines.VSM_SAMPLES=i.blurSamples,v.needsUpdate=!0,y.needsUpdate=!0),v.uniforms.shadow_pass.value=i.map.texture,v.uniforms.resolution.value=i.mapSize,v.uniforms.radius.value=i.radius,t.setRenderTarget(i.mapPass),t.clear(),t.renderBufferDirect(n,null,r,v,b,null),y.uniforms.shadow_pass.value=i.mapPass.texture,y.uniforms.resolution.value=i.mapSize,y.uniforms.radius.value=i.radius,t.setRenderTarget(i.map),t.clear(),t.renderBufferDirect(n,null,r,y,b,null)}function S(e,i,n,r,s,o){let u=null;const c=!0===n.isPointLight?e.customDistanceMaterial:e.customDepthMaterial;if(u=void 0!==c?c:!0===n.isPointLight?h:a,t.localClippingEnabled&&!0===i.clipShadows&&0!==i.clippingPlanes.length||i.displacementMap&&0!==i.displacementScale||i.alphaMap&&i.alphaTest>0){const t=u.uuid,e=i.uuid;let n=l[t];void 0===n&&(n={},l[t]=n);let r=n[e];void 0===r&&(r=u.clone(),n[e]=r),u=r}return u.visible=i.visible,u.wireframe=i.wireframe,u.side=o===p?null!==i.shadowSide?i.shadowSide:i.side:null!==i.shadowSide?i.shadowSide:d[i.side],u.alphaMap=i.alphaMap,u.alphaTest=i.alphaTest,u.clipShadows=i.clipShadows,u.clippingPlanes=i.clippingPlanes,u.clipIntersection=i.clipIntersection,u.displacementMap=i.displacementMap,u.displacementScale=i.displacementScale,u.displacementBias=i.displacementBias,u.wireframeLinewidth=i.wireframeLinewidth,u.linewidth=i.linewidth,!0===n.isPointLight&&!0===u.isMeshDistanceMaterial&&(u.referencePosition.setFromMatrixPosition(n.matrixWorld),u.nearDistance=r,u.farDistance=s),u}function E(i,r,s,o,a){if(!1===i.visible)return;if(i.layers.test(r.layers)&&(i.isMesh||i.isLine||i.isPoints)&&(i.castShadow||i.receiveShadow&&a===p)&&(!i.frustumCulled||n.intersectsObject(i))){i.modelViewMatrix.multiplyMatrices(s.matrixWorldInverse,i.matrixWorld);const n=e.update(i),r=i.material;if(Array.isArray(r)){const e=n.groups;for(let h=0,l=e.length;hu||r.y>u)&&(r.x>u&&(s.x=Math.floor(u/f.x),r.x=s.x*f.x,c.mapSize.x=s.x),r.y>u&&(s.y=Math.floor(u/f.y),r.y=s.y*f.y,c.mapSize.y=s.y)),null!==c.map||c.isPointLightShadow||this.type!==p||(c.map=new Zi(r.x,r.y),c.map.texture.name=l.name+".shadowMap",c.mapPass=new Zi(r.x,r.y),c.camera.updateProjectionMatrix()),null===c.map){const t={minFilter:pt,magFilter:pt,format:Ft};c.map=new Zi(r.x,r.y,t),c.map.texture.name=l.name+".shadowMap",c.camera.updateProjectionMatrix()}t.setRenderTarget(c.map),t.clear();const m=c.getViewportCount();for(let t=0;t=1):-1!==ut.indexOf("OpenGL ES")&&(lt=parseFloat(/^OpenGL ES (\d)/.exec(ut)[1]),ht=lt>=2);let ct=null,dt={};const pt=t.getParameter(3088),ft=t.getParameter(2978),mt=(new Ji).fromArray(pt),gt=(new Ji).fromArray(ft);function vt(e,i,n){const r=new Uint8Array(4),s=t.createTexture();t.bindTexture(e,s),t.texParameteri(e,10241,9728),t.texParameteri(e,10240,9728);for(let e=0;en||t.height>n)&&(r=n/Math.max(t.width,t.height)),r<1||!0===e){if("undefined"!=typeof HTMLImageElement&&t instanceof HTMLImageElement||"undefined"!=typeof HTMLCanvasElement&&t instanceof HTMLCanvasElement||"undefined"!=typeof ImageBitmap&&t instanceof ImageBitmap){const n=e?Mi:Math.floor,s=n(r*t.width),o=n(r*t.height);void 0===f&&(f=v(s,o));const a=i?v(s,o):f;a.width=s,a.height=o;return a.getContext("2d").drawImage(t,0,0,s,o),a}return t}return t}function x(t){return Si(t.width)&&Si(t.height)}function w(t,e){return t.generateMipmaps&&e&&t.minFilter!==pt&&t.minFilter!==yt}function b(e){t.generateMipmap(e)}function A(i,n,r,s,o=!1){if(!1===a)return n;if(null!==i&&void 0!==t[i])return t[i];let h=n;return 6403===n&&(5126===r&&(h=33326),5131===r&&(h=33325),5121===r&&(h=33321)),33319===n&&(5126===r&&(h=33328),5131===r&&(h=33327),5121===r&&(h=33323)),6408===n&&(5126===r&&(h=34836),5131===r&&(h=34842),5121===r&&(h=s===De&&!1===o?35907:32856),32819===r&&(h=32854),32820===r&&(h=32855)),33325!==h&&33326!==h&&33327!==h&&33328!==h&&34842!==h&&34836!==h||e.get("EXT_color_buffer_float"),h}function T(t,e,i){return!0===w(t,i)||t.isFramebufferTexture&&t.minFilter!==pt&&t.minFilter!==yt?Math.log2(Math.max(e.width,e.height))+1:void 0!==t.mipmaps&&t.mipmaps.length>0?t.mipmaps.length:t.isCompressedTexture&&Array.isArray(t.image)?e.mipmaps.length:1}function S(t){return t===pt||t===ft||t===gt?9728:9729}function E(t){const e=t.target;e.removeEventListener("dispose",E),function(t){const e=n.get(t);if(void 0===e.__webglInit)return;const i=t.source,r=m.get(i);if(r){const n=r[e.__cacheKey];n.usedTimes--,0===n.usedTimes&&_(t),0===Object.keys(r).length&&m.delete(i)}n.remove(t)}(e),e.isVideoTexture&&p.delete(e)}function M(e){const i=e.target;i.removeEventListener("dispose",M),function(e){const i=e.texture,r=n.get(e),s=n.get(i);void 0!==s.__webglTexture&&(t.deleteTexture(s.__webglTexture),o.memory.textures--);e.depthTexture&&e.depthTexture.dispose();if(e.isWebGLCubeRenderTarget)for(let e=0;e<6;e++)t.deleteFramebuffer(r.__webglFramebuffer[e]),r.__webglDepthbuffer&&t.deleteRenderbuffer(r.__webglDepthbuffer[e]);else t.deleteFramebuffer(r.__webglFramebuffer),r.__webglDepthbuffer&&t.deleteRenderbuffer(r.__webglDepthbuffer),r.__webglMultisampledFramebuffer&&t.deleteFramebuffer(r.__webglMultisampledFramebuffer),r.__webglColorRenderbuffer&&t.deleteRenderbuffer(r.__webglColorRenderbuffer),r.__webglDepthRenderbuffer&&t.deleteRenderbuffer(r.__webglDepthRenderbuffer);if(e.isWebGLMultipleRenderTargets)for(let e=0,r=i.length;e0&&r.__version!==t.version){const i=t.image;if(null===i);else if(!1!==i.complete)return void B(r,t,e)}i.activeTexture(33984+e),i.bindTexture(3553,r.__webglTexture)}const R={[ut]:10497,[ct]:33071,[dt]:33648},L={[pt]:9728,[ft]:9984,[gt]:9986,[yt]:9729,[xt]:9985,[bt]:9987};function O(i,s,o){if(o?(t.texParameteri(i,10242,R[s.wrapS]),t.texParameteri(i,10243,R[s.wrapT]),32879!==i&&35866!==i||t.texParameteri(i,32882,R[s.wrapR]),t.texParameteri(i,10240,L[s.magFilter]),t.texParameteri(i,10241,L[s.minFilter])):(t.texParameteri(i,10242,33071),t.texParameteri(i,10243,33071),32879!==i&&35866!==i||t.texParameteri(i,32882,33071),s.wrapS!==ct||s.wrapT,t.texParameteri(i,10240,S(s.magFilter)),t.texParameteri(i,10241,S(s.minFilter)),s.minFilter!==pt&&s.minFilter),!0===e.has("EXT_texture_filter_anisotropic")){const o=e.get("EXT_texture_filter_anisotropic");if(s.type===Pt&&!1===e.has("OES_texture_float_linear"))return;if(!1===a&&s.type===Rt&&!1===e.has("OES_texture_half_float_linear"))return;(s.anisotropy>1||n.get(s).__currentAnisotropy)&&(t.texParameterf(i,o.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(s.anisotropy,r.getMaxAnisotropy())),n.get(s).__currentAnisotropy=s.anisotropy)}}function D(e,i){let n=!1;void 0===e.__webglInit&&(e.__webglInit=!0,i.addEventListener("dispose",E));const r=i.source;let s=m.get(r);void 0===s&&(s={},m.set(r,s));const a=function(t){const e=[];return e.push(t.wrapS),e.push(t.wrapT),e.push(t.magFilter),e.push(t.minFilter),e.push(t.anisotropy),e.push(t.internalFormat),e.push(t.format),e.push(t.type),e.push(t.generateMipmaps),e.push(t.premultiplyAlpha),e.push(t.flipY),e.push(t.unpackAlignment),e.push(t.encoding),e.join()}(i);if(a!==e.__cacheKey){void 0===s[a]&&(s[a]={texture:t.createTexture(),usedTimes:0},o.memory.textures++,n=!0),s[a].usedTimes++;const r=s[e.__cacheKey];void 0!==r&&(s[e.__cacheKey].usedTimes--,0===r.usedTimes&&_(i)),e.__cacheKey=a,e.__webglTexture=s[a].texture}return n}function B(e,n,r){let o=3553;n.isDataArrayTexture&&(o=35866),n.isData3DTexture&&(o=32879);const h=D(e,n),u=n.source;if(i.activeTexture(33984+r),i.bindTexture(o,e.__webglTexture),u.version!==u.__currentVersion||!0===h){t.pixelStorei(37440,n.flipY),t.pixelStorei(37441,n.premultiplyAlpha),t.pixelStorei(3317,n.unpackAlignment),t.pixelStorei(37443,0);const r=function(t){return!a&&(t.wrapS!==ct||t.wrapT!==ct||t.minFilter!==pt&&t.minFilter!==yt)}(n)&&!1===x(n.image);let c=y(n.image,r,!1,l);c=U(n,c);const d=x(c)||a,p=s.convert(n.format,n.encoding);let f,m=s.convert(n.type),g=A(n.internalFormat,p,m,n.encoding,n.isVideoTexture);O(o,n,d);const v=n.mipmaps,S=a&&!0!==n.isVideoTexture,E=void 0===e.__version||!0===h,M=T(n,c,d);if(n.isDepthTexture)g=6402,a?g=n.type===Pt?36012:n.type===Ct?33190:n.type===Dt?35056:33189:n.type,n.format===zt&&6402===g&&n.type!==Mt&&n.type!==Ct&&(n.type=Mt,m=s.convert(n.type)),n.format===Ut&&6402===g&&(g=34041,n.type!==Dt&&(n.type=Dt,m=s.convert(n.type))),E&&(S?i.texStorage2D(3553,1,g,c.width,c.height):i.texImage2D(3553,0,g,c.width,c.height,0,p,m,null));else if(n.isDataTexture)if(v.length>0&&d){S&&E&&i.texStorage2D(3553,M,g,v[0].width,v[0].height);for(let t=0,e=v.length;t>=1,e>>=1}}else if(v.length>0&&d){S&&E&&i.texStorage2D(3553,M,g,v[0].width,v[0].height);for(let t=0,e=v.length;t0&&!0===e.has("WEBGL_multisampled_render_to_texture")&&!1!==i.__useRenderToTexture}function U(t,i){const n=t.encoding,r=t.format;t.type;return!0===t.isCompressedTexture||!0===t.isVideoTexture||t.format===fi||n!==Oe&&n===De&&!1===a&&(!0===e.has("EXT_sRGB")&&r===Ft?(t.format=fi,t.minFilter=yt,t.generateMipmaps=!1):i=Xi.sRGBToLinear(i)),i}this.allocateTextureUnit=function(){const t=C;return C+=1,t},this.resetTextureUnits=function(){C=0},this.setTexture2D=P,this.setTexture2DArray=function(t,e){const r=n.get(t);t.version>0&&r.__version!==t.version?B(r,t,e):(i.activeTexture(33984+e),i.bindTexture(35866,r.__webglTexture))},this.setTexture3D=function(t,e){const r=n.get(t);t.version>0&&r.__version!==t.version?B(r,t,e):(i.activeTexture(33984+e),i.bindTexture(32879,r.__webglTexture))},this.setTextureCube=function(e,r){const o=n.get(e);e.version>0&&o.__version!==e.version?function(e,n,r){if(6!==n.image.length)return;const o=D(e,n),l=n.source;if(i.activeTexture(33984+r),i.bindTexture(34067,e.__webglTexture),l.version!==l.__currentVersion||!0===o){t.pixelStorei(37440,n.flipY),t.pixelStorei(37441,n.premultiplyAlpha),t.pixelStorei(3317,n.unpackAlignment),t.pixelStorei(37443,0);const r=n.isCompressedTexture||n.image[0].isCompressedTexture,o=n.image[0]&&n.image[0].isDataTexture,u=[];for(let t=0;t<6;t++)u[t]=r||o?o?n.image[t].image:n.image[t]:y(n.image[t],!1,!0,h),u[t]=U(n,u[t]);const c=u[0],d=x(c)||a,p=s.convert(n.format,n.encoding),f=s.convert(n.type),m=A(n.internalFormat,p,f,n.encoding),g=a&&!0!==n.isVideoTexture,v=void 0===e.__version;let S,E=T(n,c,d);if(O(34067,n,d),r){g&&v&&i.texStorage2D(34067,E,m,c.width,c.height);for(let t=0;t<6;t++){S=u[t].mipmaps;for(let e=0;e0&&E++,i.texStorage2D(34067,E,m,u[0].width,u[0].height));for(let t=0;t<6;t++)if(o){g?i.texSubImage2D(34069+t,0,0,0,u[t].width,u[t].height,p,f,u[t].data):i.texImage2D(34069+t,0,m,u[t].width,u[t].height,0,p,f,u[t].data);for(let e=0;e0&&!1===z(e)){l.__webglMultisampledFramebuffer=t.createFramebuffer(),l.__webglColorRenderbuffer=t.createRenderbuffer(),t.bindRenderbuffer(36161,l.__webglColorRenderbuffer);const n=s.convert(h.format,h.encoding),r=s.convert(h.type),o=A(h.internalFormat,n,r,h.encoding),a=N(e);t.renderbufferStorageMultisample(36161,a,o,e.width,e.height),i.bindFramebuffer(36160,l.__webglMultisampledFramebuffer),t.framebufferRenderbuffer(36160,36064,36161,l.__webglColorRenderbuffer),t.bindRenderbuffer(36161,null),e.depthBuffer&&(l.__webglDepthRenderbuffer=t.createRenderbuffer(),F(l.__webglDepthRenderbuffer,e,!0)),i.bindFramebuffer(36160,null)}if(c){i.bindTexture(34067,u.__webglTexture),O(34067,h,p);for(let t=0;t<6;t++)I(l.__webglFramebuffer[t],e,h,36064,34069+t);w(h,p)&&b(34067),i.unbindTexture()}else if(d){const t=e.texture;for(let r=0,s=t.length;r0&&!1===z(e)){const r=e.width,s=e.height;let o=16384;const a=[36064],h=e.stencilBuffer?33306:36096;e.depthBuffer&&a.push(h);const l=n.get(e),u=void 0!==l.__ignoreDepthValues&&l.__ignoreDepthValues;!1===u&&(e.depthBuffer&&(o|=256),e.stencilBuffer&&(o|=1024)),i.bindFramebuffer(36008,l.__webglMultisampledFramebuffer),i.bindFramebuffer(36009,l.__webglFramebuffer),!0===u&&(t.invalidateFramebuffer(36008,[h]),t.invalidateFramebuffer(36009,[h])),t.blitFramebuffer(0,0,r,s,0,0,r,s,o,9728),d&&t.invalidateFramebuffer(36008,a),i.bindFramebuffer(36008,null),i.bindFramebuffer(36009,l.__webglMultisampledFramebuffer)}},this.setupDepthRenderbuffer=k,this.setupFrameBufferTexture=I,this.useMultisampledRTT=z}function Ja(t,e,i){const n=i.isWebGL2;return{convert:function(i,r=null){let s;if(i===Tt)return 5121;if(i===Lt)return 32819;if(i===Ot)return 32820;if(i===St)return 5120;if(i===Et)return 5122;if(i===Mt)return 5123;if(i===_t)return 5124;if(i===Ct)return 5125;if(i===Pt)return 5126;if(i===Rt)return n?5131:(s=e.get("OES_texture_half_float"),null!==s?s.HALF_FLOAT_OES:null);if(i===Bt)return 6406;if(i===Ft)return 6408;if(i===kt)return 6409;if(i===Nt)return 6410;if(i===zt)return 6402;if(i===Ut)return 34041;if(i===Vt)return 6403;if(i===It)return 6408;if(i===fi)return s=e.get("EXT_sRGB"),null!==s?s.SRGB_ALPHA_EXT:null;if(i===Ht)return 36244;if(i===Gt)return 33319;if(i===Wt)return 33320;if(i===Yt)return 36249;if(i===Xt||i===jt||i===qt||i===Qt)if(r===De){if(s=e.get("WEBGL_compressed_texture_s3tc_srgb"),null===s)return null;if(i===Xt)return s.COMPRESSED_SRGB_S3TC_DXT1_EXT;if(i===jt)return s.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT;if(i===qt)return s.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT;if(i===Qt)return s.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT}else{if(s=e.get("WEBGL_compressed_texture_s3tc"),null===s)return null;if(i===Xt)return s.COMPRESSED_RGB_S3TC_DXT1_EXT;if(i===jt)return s.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(i===qt)return s.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(i===Qt)return s.COMPRESSED_RGBA_S3TC_DXT5_EXT}if(i===Kt||i===Jt||i===Zt||i===$t){if(s=e.get("WEBGL_compressed_texture_pvrtc"),null===s)return null;if(i===Kt)return s.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(i===Jt)return s.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(i===Zt)return s.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(i===$t)return s.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}if(i===te)return s=e.get("WEBGL_compressed_texture_etc1"),null!==s?s.COMPRESSED_RGB_ETC1_WEBGL:null;if(i===ee||i===ie){if(s=e.get("WEBGL_compressed_texture_etc"),null===s)return null;if(i===ee)return r===De?s.COMPRESSED_SRGB8_ETC2:s.COMPRESSED_RGB8_ETC2;if(i===ie)return r===De?s.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC:s.COMPRESSED_RGBA8_ETC2_EAC}if(i===ne||i===re||i===se||i===oe||i===ae||i===he||i===le||i===ue||i===ce||i===de||i===pe||i===fe||i===me||i===ge){if(s=e.get("WEBGL_compressed_texture_astc"),null===s)return null;if(i===ne)return r===De?s.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR:s.COMPRESSED_RGBA_ASTC_4x4_KHR;if(i===re)return r===De?s.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR:s.COMPRESSED_RGBA_ASTC_5x4_KHR;if(i===se)return r===De?s.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR:s.COMPRESSED_RGBA_ASTC_5x5_KHR;if(i===oe)return r===De?s.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR:s.COMPRESSED_RGBA_ASTC_6x5_KHR;if(i===ae)return r===De?s.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR:s.COMPRESSED_RGBA_ASTC_6x6_KHR;if(i===he)return r===De?s.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR:s.COMPRESSED_RGBA_ASTC_8x5_KHR;if(i===le)return r===De?s.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR:s.COMPRESSED_RGBA_ASTC_8x6_KHR;if(i===ue)return r===De?s.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR:s.COMPRESSED_RGBA_ASTC_8x8_KHR;if(i===ce)return r===De?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR:s.COMPRESSED_RGBA_ASTC_10x5_KHR;if(i===de)return r===De?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR:s.COMPRESSED_RGBA_ASTC_10x6_KHR;if(i===pe)return r===De?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR:s.COMPRESSED_RGBA_ASTC_10x8_KHR;if(i===fe)return r===De?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR:s.COMPRESSED_RGBA_ASTC_10x10_KHR;if(i===me)return r===De?s.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR:s.COMPRESSED_RGBA_ASTC_12x10_KHR;if(i===ge)return r===De?s.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR:s.COMPRESSED_RGBA_ASTC_12x12_KHR}if(i===ve){if(s=e.get("EXT_texture_compression_bptc"),null===s)return null;if(i===ve)return r===De?s.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT:s.COMPRESSED_RGBA_BPTC_UNORM_EXT}return i===Dt?n?34042:(s=e.get("WEBGL_depth_texture"),null!==s?s.UNSIGNED_INT_24_8_WEBGL:null):void 0!==t[i]?t[i]:null}}}class Za extends ms{constructor(t=[]){super(),this.cameras=t}}Za.prototype.isArrayCamera=!0;class $a extends hr{constructor(){super(),this.type="Group"}}$a.prototype.isGroup=!0;const th={type:"move"};class eh{constructor(){this._targetRay=null,this._grip=null,this._hand=null}getHandSpace(){return null===this._hand&&(this._hand=new $a,this._hand.matrixAutoUpdate=!1,this._hand.visible=!1,this._hand.joints={},this._hand.inputState={pinching:!1}),this._hand}getTargetRaySpace(){return null===this._targetRay&&(this._targetRay=new $a,this._targetRay.matrixAutoUpdate=!1,this._targetRay.visible=!1,this._targetRay.hasLinearVelocity=!1,this._targetRay.linearVelocity=new on,this._targetRay.hasAngularVelocity=!1,this._targetRay.angularVelocity=new on),this._targetRay}getGripSpace(){return null===this._grip&&(this._grip=new $a,this._grip.matrixAutoUpdate=!1,this._grip.visible=!1,this._grip.hasLinearVelocity=!1,this._grip.linearVelocity=new on,this._grip.hasAngularVelocity=!1,this._grip.angularVelocity=new on),this._grip}dispatchEvent(t){return null!==this._targetRay&&this._targetRay.dispatchEvent(t),null!==this._grip&&this._grip.dispatchEvent(t),null!==this._hand&&this._hand.dispatchEvent(t),this}disconnect(t){return this.dispatchEvent({type:"disconnected",data:t}),null!==this._targetRay&&(this._targetRay.visible=!1),null!==this._grip&&(this._grip.visible=!1),null!==this._hand&&(this._hand.visible=!1),this}update(t,e,i){let n=null,r=null,s=null;const o=this._targetRay,a=this._grip,h=this._hand;if(t&&"visible-blurred"!==e.session.visibilityState)if(null!==o&&(n=e.getPose(t.targetRaySpace,i),null!==n&&(o.matrix.fromArray(n.transform.matrix),o.matrix.decompose(o.position,o.rotation,o.scale),n.linearVelocity?(o.hasLinearVelocity=!0,o.linearVelocity.copy(n.linearVelocity)):o.hasLinearVelocity=!1,n.angularVelocity?(o.hasAngularVelocity=!0,o.angularVelocity.copy(n.angularVelocity)):o.hasAngularVelocity=!1,this.dispatchEvent(th))),h&&t.hand){s=!0;for(const n of t.hand.values()){const t=e.getJointPose(n,i);if(void 0===h.joints[n.jointName]){const t=new $a;t.matrixAutoUpdate=!1,t.visible=!1,h.joints[n.jointName]=t,h.add(t)}const r=h.joints[n.jointName];null!==t&&(r.matrix.fromArray(t.transform.matrix),r.matrix.decompose(r.position,r.rotation,r.scale),r.jointRadius=t.radius),r.visible=null!==t}const n=h.joints["index-finger-tip"],r=h.joints["thumb-tip"],o=n.position.distanceTo(r.position),a=.02,l=.005;h.inputState.pinching&&o>a+l?(h.inputState.pinching=!1,this.dispatchEvent({type:"pinchend",handedness:t.handedness,target:this})):!h.inputState.pinching&&o<=a-l&&(h.inputState.pinching=!0,this.dispatchEvent({type:"pinchstart",handedness:t.handedness,target:this}))}else null!==a&&t.gripSpace&&(r=e.getPose(t.gripSpace,i),null!==r&&(a.matrix.fromArray(r.transform.matrix),a.matrix.decompose(a.position,a.rotation,a.scale),r.linearVelocity?(a.hasLinearVelocity=!0,a.linearVelocity.copy(r.linearVelocity)):a.hasLinearVelocity=!1,r.angularVelocity?(a.hasAngularVelocity=!0,a.angularVelocity.copy(r.angularVelocity)):a.hasAngularVelocity=!1));return null!==o&&(o.visible=null!==n),null!==a&&(a.visible=null!==r),null!==h&&(h.visible=null!==s),this}}class ih extends Ki{constructor(t,e,i,n,r,s,o,a,h,l){if((l=void 0!==l?l:zt)!==zt&&l!==Ut)throw new Error("DepthTexture format must be either THREE.DepthFormat or THREE.DepthStencilFormat");void 0===i&&l===zt&&(i=Mt),void 0===i&&l===Ut&&(i=Dt),super(null,n,r,s,o,a,l,i,h),this.image={width:t,height:e},this.magFilter=void 0!==o?o:pt,this.minFilter=void 0!==a?a:pt,this.flipY=!1,this.generateMipmaps=!1}}ih.prototype.isDepthTexture=!0;class nh extends mi{constructor(t,e){super();const i=this;let n=null,r=1,s=null,o="local-floor",a=null,h=null,l=null,u=null,c=null,d=null;const p=e.getContextAttributes();let f=null,m=null;const g=[],v=new Map,y=new ms;y.layers.enable(1),y.viewport=new Ji;const x=new ms;x.layers.enable(2),x.viewport=new Ji;const w=[y,x],b=new Za;b.layers.enable(1),b.layers.enable(2);let A=null,T=null;function S(t){const e=v.get(t.inputSource);e&&e.dispatchEvent({type:t.type,data:t.inputSource})}function E(){v.forEach((function(t,e){t.disconnect(e)})),v.clear(),A=null,T=null,t.setRenderTarget(f),c=null,u=null,l=null,n=null,m=null,L.stop(),i.isPresenting=!1,i.dispatchEvent({type:"sessionend"})}function M(t){const e=n.inputSources;for(let t=0;t0&&(i.alphaTest.value=n.alphaTest);const r=e.get(n).envMap;if(r&&(i.envMap.value=r,i.flipEnvMap.value=r.isCubeTexture&&!1===r.isRenderTargetTexture?-1:1,i.reflectivity.value=n.reflectivity,i.ior.value=n.ior,i.refractionRatio.value=n.refractionRatio),n.lightMap){i.lightMap.value=n.lightMap;const e=!0!==t.physicallyCorrectLights?Math.PI:1;i.lightMapIntensity.value=n.lightMapIntensity*e}let s,o;n.aoMap&&(i.aoMap.value=n.aoMap,i.aoMapIntensity.value=n.aoMapIntensity),n.map?s=n.map:n.specularMap?s=n.specularMap:n.displacementMap?s=n.displacementMap:n.normalMap?s=n.normalMap:n.bumpMap?s=n.bumpMap:n.roughnessMap?s=n.roughnessMap:n.metalnessMap?s=n.metalnessMap:n.alphaMap?s=n.alphaMap:n.emissiveMap?s=n.emissiveMap:n.clearcoatMap?s=n.clearcoatMap:n.clearcoatNormalMap?s=n.clearcoatNormalMap:n.clearcoatRoughnessMap?s=n.clearcoatRoughnessMap:n.specularIntensityMap?s=n.specularIntensityMap:n.specularColorMap?s=n.specularColorMap:n.transmissionMap?s=n.transmissionMap:n.thicknessMap?s=n.thicknessMap:n.sheenColorMap?s=n.sheenColorMap:n.sheenRoughnessMap&&(s=n.sheenRoughnessMap),void 0!==s&&(s.isWebGLRenderTarget&&(s=s.texture),!0===s.matrixAutoUpdate&&s.updateMatrix(),i.uvTransform.value.copy(s.matrix)),n.aoMap?o=n.aoMap:n.lightMap&&(o=n.lightMap),void 0!==o&&(o.isWebGLRenderTarget&&(o=o.texture),!0===o.matrixAutoUpdate&&o.updateMatrix(),i.uv2Transform.value.copy(o.matrix))}return{refreshFogUniforms:function(t,e){t.fogColor.value.copy(e.color),e.isFog?(t.fogNear.value=e.near,t.fogFar.value=e.far):e.isFogExp2&&(t.fogDensity.value=e.density)},refreshMaterialUniforms:function(t,n,r,s,o){n.isMeshBasicMaterial||n.isMeshLambertMaterial?i(t,n):n.isMeshToonMaterial?(i(t,n),function(t,e){e.gradientMap&&(t.gradientMap.value=e.gradientMap)}(t,n)):n.isMeshPhongMaterial?(i(t,n),function(t,e){t.specular.value.copy(e.specular),t.shininess.value=Math.max(e.shininess,1e-4)}(t,n)):n.isMeshStandardMaterial?(i(t,n),function(t,i){t.roughness.value=i.roughness,t.metalness.value=i.metalness,i.roughnessMap&&(t.roughnessMap.value=i.roughnessMap);i.metalnessMap&&(t.metalnessMap.value=i.metalnessMap);e.get(i).envMap&&(t.envMapIntensity.value=i.envMapIntensity)}(t,n),n.isMeshPhysicalMaterial&&function(t,e,i){t.ior.value=e.ior,e.sheen>0&&(t.sheenColor.value.copy(e.sheenColor).multiplyScalar(e.sheen),t.sheenRoughness.value=e.sheenRoughness,e.sheenColorMap&&(t.sheenColorMap.value=e.sheenColorMap),e.sheenRoughnessMap&&(t.sheenRoughnessMap.value=e.sheenRoughnessMap));e.clearcoat>0&&(t.clearcoat.value=e.clearcoat,t.clearcoatRoughness.value=e.clearcoatRoughness,e.clearcoatMap&&(t.clearcoatMap.value=e.clearcoatMap),e.clearcoatRoughnessMap&&(t.clearcoatRoughnessMap.value=e.clearcoatRoughnessMap),e.clearcoatNormalMap&&(t.clearcoatNormalScale.value.copy(e.clearcoatNormalScale),t.clearcoatNormalMap.value=e.clearcoatNormalMap,e.side===m&&t.clearcoatNormalScale.value.negate()));e.transmission>0&&(t.transmission.value=e.transmission,t.transmissionSamplerMap.value=i.texture,t.transmissionSamplerSize.value.set(i.width,i.height),e.transmissionMap&&(t.transmissionMap.value=e.transmissionMap),t.thickness.value=e.thickness,e.thicknessMap&&(t.thicknessMap.value=e.thicknessMap),t.attenuationDistance.value=e.attenuationDistance,t.attenuationColor.value.copy(e.attenuationColor));t.specularIntensity.value=e.specularIntensity,t.specularColor.value.copy(e.specularColor),e.specularIntensityMap&&(t.specularIntensityMap.value=e.specularIntensityMap);e.specularColorMap&&(t.specularColorMap.value=e.specularColorMap)}(t,n,o)):n.isMeshMatcapMaterial?(i(t,n),function(t,e){e.matcap&&(t.matcap.value=e.matcap)}(t,n)):n.isMeshDepthMaterial?i(t,n):n.isMeshDistanceMaterial?(i(t,n),function(t,e){t.referencePosition.value.copy(e.referencePosition),t.nearDistance.value=e.nearDistance,t.farDistance.value=e.farDistance}(t,n)):n.isMeshNormalMaterial?i(t,n):n.isLineBasicMaterial?(function(t,e){t.diffuse.value.copy(e.color),t.opacity.value=e.opacity}(t,n),n.isLineDashedMaterial&&function(t,e){t.dashSize.value=e.dashSize,t.totalSize.value=e.dashSize+e.gapSize,t.scale.value=e.scale}(t,n)):n.isPointsMaterial?function(t,e,i,n){t.diffuse.value.copy(e.color),t.opacity.value=e.opacity,t.size.value=e.size*i,t.scale.value=.5*n,e.map&&(t.map.value=e.map);e.alphaMap&&(t.alphaMap.value=e.alphaMap);e.alphaTest>0&&(t.alphaTest.value=e.alphaTest);let r;e.map?r=e.map:e.alphaMap&&(r=e.alphaMap);void 0!==r&&(!0===r.matrixAutoUpdate&&r.updateMatrix(),t.uvTransform.value.copy(r.matrix))}(t,n,r,s):n.isSpriteMaterial?function(t,e){t.diffuse.value.copy(e.color),t.opacity.value=e.opacity,t.rotation.value=e.rotation,e.map&&(t.map.value=e.map);e.alphaMap&&(t.alphaMap.value=e.alphaMap);e.alphaTest>0&&(t.alphaTest.value=e.alphaTest);let i;e.map?i=e.map:e.alphaMap&&(i=e.alphaMap);void 0!==i&&(!0===i.matrixAutoUpdate&&i.updateMatrix(),t.uvTransform.value.copy(i.matrix))}(t,n):n.isShadowMaterial?(t.color.value.copy(n.color),t.opacity.value=n.opacity):n.isShaderMaterial&&(n.uniformsNeedUpdate=!1)}}}function sh(t={}){const e=void 0!==t.canvas?t.canvas:function(){const t=Di("canvas");return t.style.display="block",t}(),i=void 0!==t.context?t.context:null,r=void 0===t.depth||t.depth,s=void 0===t.stencil||t.stencil,o=void 0!==t.antialias&&t.antialias,a=void 0===t.premultipliedAlpha||t.premultipliedAlpha,h=void 0!==t.preserveDrawingBuffer&&t.preserveDrawingBuffer,l=void 0!==t.powerPreference?t.powerPreference:"default",u=void 0!==t.failIfMajorPerformanceCaveat&&t.failIfMajorPerformanceCaveat;let c;c=null!==i?i.getContextAttributes().alpha:void 0!==t.alpha&&t.alpha;let d=null,p=null;const v=[],y=[];this.domElement=e,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.outputEncoding=Oe,this.physicallyCorrectLights=!1,this.toneMapping=Z,this.toneMappingExposure=1;const x=this;let w=!1,b=0,A=0,T=null,S=-1,E=null;const M=new Ji,_=new Ji;let C=null,P=e.width,R=e.height,L=1,O=null,D=null;const B=new Ji(0,0,P,R),I=new Ji(0,0,P,R);let F=!1;const k=new Es;let N=!1,z=!1,U=null;const V=new kn,H=new Ci,G=new on,W={background:null,fog:null,environment:null,overrideMaterial:null,isScene:!0};function Y(){return null===T?L:1}let X,j,q,Q,K,J,$,tt,et,it,nt,rt,st,ot,at,ht,lt,ut,ct,dt,pt,ft,mt,gt=i;function vt(t,i){for(let n=0;n0&&function(t,e,i){const n=j.isWebGL2;null===U&&(U=new Zi(1,1,{generateMipmaps:!0,type:X.has("EXT_color_buffer_half_float")?Rt:Tt,minFilter:bt,samples:n&&!0===o?4:0}));x.getDrawingBufferSize(H),n?U.setSize(H.x,H.y):U.setSize(Mi(H.x),Mi(H.y));const r=x.getRenderTarget();x.setRenderTarget(U),x.clear();const s=x.toneMapping;x.toneMapping=Z,Ot(t,e,i),x.toneMapping=s,J.updateMultisampleRenderTarget(U),J.updateRenderTargetMipmap(U),x.setRenderTarget(r)}(r,e,i),n&&q.viewport(M.copy(n)),r.length>0&&Ot(r,e,i),s.length>0&&Ot(s,e,i),a.length>0&&Ot(a,e,i),q.buffers.depth.setTest(!0),q.buffers.depth.setMask(!0),q.buffers.color.setMask(!0),q.setPolygonOffset(!1)}function Ot(t,e,i){const n=!0===e.isScene?e.overrideMaterial:null;for(let r=0,s=t.length;r0?y[y.length-1]:null,v.pop(),d=v.length>0?v[v.length-1]:null},this.getActiveCubeFace=function(){return b},this.getActiveMipmapLevel=function(){return A},this.getRenderTarget=function(){return T},this.setRenderTargetTextures=function(t,e,i){K.get(t.texture).__webglTexture=e,K.get(t.depthTexture).__webglTexture=i;const n=K.get(t);n.__hasExternalTextures=!0,n.__hasExternalTextures&&(n.__autoAllocateDepthBuffer=void 0===i,n.__autoAllocateDepthBuffer||!0===X.has("WEBGL_multisampled_render_to_texture")&&(n.__useRenderToTexture=!1))},this.setRenderTargetFramebuffer=function(t,e){const i=K.get(t);i.__webglFramebuffer=e,i.__useDefaultFramebuffer=void 0===e},this.setRenderTarget=function(t,e=0,i=0){T=t,b=e,A=i;let n=!0;if(t){const e=K.get(t);void 0!==e.__useDefaultFramebuffer?(q.bindFramebuffer(36160,null),n=!1):void 0===e.__webglFramebuffer?J.setupRenderTarget(t):e.__hasExternalTextures&&J.rebindTextures(t,K.get(t.texture).__webglTexture,K.get(t.depthTexture).__webglTexture)}let r=null,s=!1,o=!1;if(t){const i=t.texture;(i.isData3DTexture||i.isDataArrayTexture)&&(o=!0);const n=K.get(t).__webglFramebuffer;t.isWebGLCubeRenderTarget?(r=n[e],s=!0):r=j.isWebGL2&&t.samples>0&&!1===J.useMultisampledRTT(t)?K.get(t).__webglMultisampledFramebuffer:n,M.copy(t.viewport),_.copy(t.scissor),C=t.scissorTest}else M.copy(B).multiplyScalar(L).floor(),_.copy(I).multiplyScalar(L).floor(),C=F;if(q.bindFramebuffer(36160,r)&&j.drawBuffers&&n&&q.drawBuffers(t,r),q.viewport(M),q.scissor(_),q.setScissorTest(C),s){const n=K.get(t.texture);gt.framebufferTexture2D(36160,36064,34069+e,n.__webglTexture,i)}else if(o){const n=K.get(t.texture),r=e||0;gt.framebufferTextureLayer(36160,36064,n.__webglTexture,i||0,r)}S=-1},this.readRenderTargetPixels=function(t,e,i,n,r,s,o){if(!t||!t.isWebGLRenderTarget)return;let a=K.get(t).__webglFramebuffer;if(t.isWebGLCubeRenderTarget&&void 0!==o&&(a=a[o]),a){q.bindFramebuffer(36160,a);try{const o=t.texture,a=o.format,h=o.type;if(a!==Ft&&ft.convert(a)!==gt.getParameter(35739))return;const l=h===Rt&&(X.has("EXT_color_buffer_half_float")||j.isWebGL2&&X.has("EXT_color_buffer_float"));if(!(h===Tt||ft.convert(h)===gt.getParameter(35738)||h===Pt&&(j.isWebGL2||X.has("OES_texture_float")||X.has("WEBGL_color_buffer_float"))||l))return;e>=0&&e<=t.width-n&&i>=0&&i<=t.height-r&>.readPixels(e,i,n,r,ft.convert(a),ft.convert(h),s)}finally{const t=null!==T?K.get(T).__webglFramebuffer:null;q.bindFramebuffer(36160,t)}}},this.copyFramebufferToTexture=function(t,e,i=0){if(!0!==e.isFramebufferTexture)return;const n=Math.pow(2,-i),r=Math.floor(e.image.width*n),s=Math.floor(e.image.height*n);J.setTexture2D(e,0),gt.copyTexSubImage2D(3553,i,0,0,t.x,t.y,r,s),q.unbindTexture()},this.copyTextureToTexture=function(t,e,i,n=0){const r=e.image.width,s=e.image.height,o=ft.convert(i.format),a=ft.convert(i.type);J.setTexture2D(i,0),gt.pixelStorei(37440,i.flipY),gt.pixelStorei(37441,i.premultiplyAlpha),gt.pixelStorei(3317,i.unpackAlignment),e.isDataTexture?gt.texSubImage2D(3553,n,t.x,t.y,r,s,o,a,e.image.data):e.isCompressedTexture?gt.compressedTexSubImage2D(3553,n,t.x,t.y,e.mipmaps[0].width,e.mipmaps[0].height,o,e.mipmaps[0].data):gt.texSubImage2D(3553,n,t.x,t.y,o,a,e.image),0===n&&i.generateMipmaps&>.generateMipmap(3553),q.unbindTexture()},this.copyTextureToTexture3D=function(t,e,i,n,r=0){if(x.isWebGL1Renderer)return;const s=t.max.x-t.min.x+1,o=t.max.y-t.min.y+1,a=t.max.z-t.min.z+1,h=ft.convert(n.format),l=ft.convert(n.type);let u;if(n.isData3DTexture)J.setTexture3D(n,0),u=32879;else{if(!n.isDataArrayTexture)return;J.setTexture2DArray(n,0),u=35866}gt.pixelStorei(37440,n.flipY),gt.pixelStorei(37441,n.premultiplyAlpha),gt.pixelStorei(3317,n.unpackAlignment);const c=gt.getParameter(3314),d=gt.getParameter(32878),p=gt.getParameter(3316),f=gt.getParameter(3315),m=gt.getParameter(32877),g=i.isCompressedTexture?i.mipmaps[0]:i.image;gt.pixelStorei(3314,g.width),gt.pixelStorei(32878,g.height),gt.pixelStorei(3316,t.min.x),gt.pixelStorei(3315,t.min.y),gt.pixelStorei(32877,t.min.z),i.isDataTexture||i.isData3DTexture?gt.texSubImage3D(u,r,e.x,e.y,e.z,s,o,a,h,l,g.data):i.isCompressedTexture?gt.compressedTexSubImage3D(u,r,e.x,e.y,e.z,s,o,a,h,g.data):gt.texSubImage3D(u,r,e.x,e.y,e.z,s,o,a,h,l,g),gt.pixelStorei(3314,c),gt.pixelStorei(32878,d),gt.pixelStorei(3316,p),gt.pixelStorei(3315,f),gt.pixelStorei(32877,m),0===r&&n.generateMipmaps&>.generateMipmap(u),q.unbindTexture()},this.initTexture=function(t){J.setTexture2D(t,0),q.unbindTexture()},this.resetState=function(){b=0,A=0,T=null,q.reset(),mt.reset()},"undefined"!=typeof __THREE_DEVTOOLS__&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}sh.prototype.isWebGLRenderer=!0;class oh extends sh{}oh.prototype.isWebGL1Renderer=!0;class ah{constructor(t,e=25e-5){this.name="",this.color=new Wi(t),this.density=e}clone(){return new ah(this.color,this.density)}toJSON(){return{type:"FogExp2",color:this.color.getHex(),density:this.density}}}ah.prototype.isFogExp2=!0;class hh{constructor(t,e=1,i=1e3){this.name="",this.color=new Wi(t),this.near=e,this.far=i}clone(){return new hh(this.color,this.near,this.far)}toJSON(){return{type:"Fog",color:this.color.getHex(),near:this.near,far:this.far}}}hh.prototype.isFog=!0;class lh extends hr{constructor(){super(),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}))}copy(t,e){return super.copy(t,e),null!==t.background&&(this.background=t.background.clone()),null!==t.environment&&(this.environment=t.environment.clone()),null!==t.fog&&(this.fog=t.fog.clone()),null!==t.overrideMaterial&&(this.overrideMaterial=t.overrideMaterial.clone()),this.autoUpdate=t.autoUpdate,this.matrixAutoUpdate=t.matrixAutoUpdate,this}toJSON(t){const e=super.toJSON(t);return null!==this.fog&&(e.object.fog=this.fog.toJSON()),e}}lh.prototype.isScene=!0;class uh{constructor(t,e){this.array=t,this.stride=e,this.count=void 0!==t?t.length/e:0,this.usage=ni,this.updateRange={offset:0,count:-1},this.version=0,this.uuid=wi()}onUploadCallback(){}set needsUpdate(t){!0===t&&this.version++}setUsage(t){return this.usage=t,this}copy(t){return this.array=new t.array.constructor(t.array),this.count=t.count,this.stride=t.stride,this.usage=t.usage,this}copyAt(t,e,i){t*=this.stride,i*=e.stride;for(let n=0,r=this.stride;nt.far||e.push({distance:a,point:mh.clone(),uv:xr.getUV(mh,bh,Ah,Th,Sh,Eh,Mh,new Ci),face:null,object:this})}copy(t){return super.copy(t),void 0!==t.center&&this.center.copy(t.center),this.material=t.material,this}}function Ch(t,e,i,n,r,s){yh.subVectors(t,i).addScalar(.5).multiply(n),void 0!==r?(xh.x=s*yh.x-r*yh.y,xh.y=r*yh.x+s*yh.y):xh.copy(yh),t.copy(e),t.x+=xh.x,t.y+=xh.y,t.applyMatrix4(wh)}_h.prototype.isSprite=!0;const Ph=new on,Rh=new on;class Lh extends hr{constructor(){super(),this._currentLevel=0,this.type="LOD",Object.defineProperties(this,{levels:{enumerable:!0,value:[]},isLOD:{value:!0}}),this.autoUpdate=!0}copy(t){super.copy(t,!1);const e=t.levels;for(let t=0,i=e.length;t0){let i,n;for(i=1,n=e.length;i0){Ph.setFromMatrixPosition(this.matrixWorld);const i=t.ray.origin.distanceTo(Ph);this.getObjectForDistance(i).raycast(t,e)}}update(t){const e=this.levels;if(e.length>1){Ph.setFromMatrixPosition(t.matrixWorld),Rh.setFromMatrixPosition(this.matrixWorld);const i=Ph.distanceTo(Rh)/t.zoom;let n,r;for(e[0].object.visible=!0,n=1,r=e.length;n=e[n].distance;n++)e[n-1].object.visible=!1,e[n].object.visible=!0;for(this._currentLevel=n-1;na)continue;c.applyMatrix4(this.matrixWorld);const d=t.ray.origin.distanceTo(c);dt.far||e.push({distance:d,point:u.clone().applyMatrix4(this.matrixWorld),index:i,face:null,faceIndex:null,object:this})}}else{for(let i=Math.max(0,s.start),n=Math.min(r.count,s.start+s.count)-1;ia)continue;c.applyMatrix4(this.matrixWorld);const n=t.ray.origin.distanceTo(c);nt.far||e.push({distance:n,point:u.clone().applyMatrix4(this.matrixWorld),index:i,face:null,faceIndex:null,object:this})}}}else i.isGeometry}updateMorphTargets(){const t=this.geometry;if(t.isBufferGeometry){const e=t.morphAttributes,i=Object.keys(e);if(i.length>0){const t=e[i[0]];if(void 0!==t){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let e=0,i=t.length;e0){const t=e[i[0]];if(void 0!==t){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let e=0,i=t.length;er.far)return;s.push({distance:h,distanceToRay:Math.sqrt(a),point:i,index:e,face:null,object:o})}}cl.prototype.isPoints=!0;class pl extends Ki{constructor(t,e,i,n,r,s,o,a,h){super(t,e,i,n,r,s,o,a,h),this.minFilter=void 0!==s?s:yt,this.magFilter=void 0!==r?r:yt,this.generateMipmaps=!1;const l=this;"requestVideoFrameCallback"in t&&t.requestVideoFrameCallback((function e(){l.needsUpdate=!0,t.requestVideoFrameCallback(e)}))}clone(){return new this.constructor(this.image).copy(this)}update(){const t=this.image;!1==="requestVideoFrameCallback"in t&&t.readyState>=t.HAVE_CURRENT_DATA&&(this.needsUpdate=!0)}}pl.prototype.isVideoTexture=!0;class fl extends Ki{constructor(t,e,i){super({width:t,height:e}),this.format=i,this.magFilter=pt,this.minFilter=pt,this.generateMipmaps=!1,this.needsUpdate=!0}}fl.prototype.isFramebufferTexture=!0;class ml extends Ki{constructor(t,e,i,n,r,s,o,a,h,l,u,c){super(null,s,o,a,h,l,n,r,u,c),this.image={width:e,height:i},this.mipmaps=t,this.flipY=!1,this.generateMipmaps=!1}}ml.prototype.isCompressedTexture=!0;class gl extends Ki{constructor(t,e,i,n,r,s,o,a,h){super(t,e,i,n,r,s,o,a,h),this.needsUpdate=!0}}gl.prototype.isCanvasTexture=!0;class vl{constructor(){this.type="Curve",this.arcLengthDivisions=200}getPoint(){return null}getPointAt(t,e){const i=this.getUtoTmapping(t);return this.getPoint(i,e)}getPoints(t=5){const e=[];for(let i=0;i<=t;i++)e.push(this.getPoint(i/t));return e}getSpacedPoints(t=5){const e=[];for(let i=0;i<=t;i++)e.push(this.getPointAt(i/t));return e}getLength(){const t=this.getLengths();return t[t.length-1]}getLengths(t=this.arcLengthDivisions){if(this.cacheArcLengths&&this.cacheArcLengths.length===t+1&&!this.needsUpdate)return this.cacheArcLengths;this.needsUpdate=!1;const e=[];let i,n=this.getPoint(0),r=0;e.push(0);for(let s=1;s<=t;s++)i=this.getPoint(s/t),r+=i.distanceTo(n),e.push(r),n=i;return this.cacheArcLengths=e,e}updateArcLengths(){this.needsUpdate=!0,this.getLengths()}getUtoTmapping(t,e){const i=this.getLengths();let n=0;const r=i.length;let s;s=e||t*i[r-1];let o,a=0,h=r-1;for(;a<=h;)if(n=Math.floor(a+(h-a)/2),o=i[n]-s,o<0)a=n+1;else{if(!(o>0)){h=n;break}h=n-1}if(n=h,i[n]===s)return n/(r-1);const l=i[n];return(n+(s-l)/(i[n+1]-l))/(r-1)}getTangent(t,e){let i=t-1e-4,n=t+1e-4;i<0&&(i=0),n>1&&(n=1);const r=this.getPoint(i),s=this.getPoint(n),o=e||(r.isVector2?new Ci:new on);return o.copy(s).sub(r).normalize(),o}getTangentAt(t,e){const i=this.getUtoTmapping(t);return this.getTangent(i,e)}computeFrenetFrames(t,e){const i=new on,n=[],r=[],s=[],o=new on,a=new kn;for(let e=0;e<=t;e++){const i=e/t;n[e]=this.getTangentAt(i,new on)}r[0]=new on,s[0]=new on;let h=Number.MAX_VALUE;const l=Math.abs(n[0].x),u=Math.abs(n[0].y),c=Math.abs(n[0].z);l<=h&&(h=l,i.set(1,0,0)),u<=h&&(h=u,i.set(0,1,0)),c<=h&&i.set(0,0,1),o.crossVectors(n[0],i).normalize(),r[0].crossVectors(n[0],o),s[0].crossVectors(n[0],r[0]);for(let e=1;e<=t;e++){if(r[e]=r[e-1].clone(),s[e]=s[e-1].clone(),o.crossVectors(n[e-1],n[e]),o.length()>Number.EPSILON){o.normalize();const t=Math.acos(bi(n[e-1].dot(n[e]),-1,1));r[e].applyMatrix4(a.makeRotationAxis(o,t))}s[e].crossVectors(n[e],r[e])}if(!0===e){let e=Math.acos(bi(r[0].dot(r[t]),-1,1));e/=t,n[0].dot(o.crossVectors(r[0],r[t]))>0&&(e=-e);for(let i=1;i<=t;i++)r[i].applyMatrix4(a.makeRotationAxis(n[i],e*i)),s[i].crossVectors(n[i],r[i])}return{tangents:n,normals:r,binormals:s}}clone(){return(new this.constructor).copy(this)}copy(t){return this.arcLengthDivisions=t.arcLengthDivisions,this}toJSON(){const t={metadata:{version:4.5,type:"Curve",generator:"Curve.toJSON"}};return t.arcLengthDivisions=this.arcLengthDivisions,t.type=this.type,t}fromJSON(t){return this.arcLengthDivisions=t.arcLengthDivisions,this}}class yl extends vl{constructor(t=0,e=0,i=1,n=1,r=0,s=2*Math.PI,o=!1,a=0){super(),this.type="EllipseCurve",this.aX=t,this.aY=e,this.xRadius=i,this.yRadius=n,this.aStartAngle=r,this.aEndAngle=s,this.aClockwise=o,this.aRotation=a}getPoint(t,e){const i=e||new Ci,n=2*Math.PI;let r=this.aEndAngle-this.aStartAngle;const s=Math.abs(r)n;)r-=n;r0?0:(Math.floor(Math.abs(h)/r)+1)*r:0===l&&h===r-1&&(h=r-2,l=1),this.closed||h>0?o=n[(h-1)%r]:(bl.subVectors(n[0],n[1]).add(n[0]),o=bl);const u=n[h%r],c=n[(h+1)%r];if(this.closed||h+2n.length-2?n.length-1:s+1],u=n[s>n.length-3?n.length-1:s+2];return i.set(Ml(o,a.x,h.x,l.x,u.x),Ml(o,a.y,h.y,l.y,u.y)),i}copy(t){super.copy(t),this.points=[];for(let e=0,i=t.points.length;e=i){const t=n[r]-i,s=this.curves[r],o=s.getLength(),a=0===o?0:1-t/o;return s.getPointAt(a,e)}r++}return null}getLength(){const t=this.getCurveLengths();return t[t.length-1]}updateArcLengths(){this.needsUpdate=!0,this.cacheLengths=null,this.getCurveLengths()}getCurveLengths(){if(this.cacheLengths&&this.cacheLengths.length===this.curves.length)return this.cacheLengths;const t=[];let e=0;for(let i=0,n=this.curves.length;i1&&!e[e.length-1].equals(e[0])&&e.push(e[0]),e}copy(t){super.copy(t),this.curves=[];for(let e=0,i=t.curves.length;e0){const t=h.getPoint(0);t.equals(this.currentPoint)||this.lineTo(t.x,t.y)}this.curves.push(h);const l=h.getPoint(1);return this.currentPoint.copy(l),this}copy(t){return super.copy(t),this.currentPoint.copy(t.currentPoint),this}toJSON(){const t=super.toJSON();return t.currentPoint=this.currentPoint.toArray(),t}fromJSON(t){return super.fromJSON(t),this.currentPoint.fromArray(t.currentPoint),this}}class zl extends Gr{constructor(t=[new Ci(0,.5),new Ci(.5,0),new Ci(0,-.5)],e=12,i=0,n=2*Math.PI){super(),this.type="LatheGeometry",this.parameters={points:t,segments:e,phiStart:i,phiLength:n},e=Math.floor(e),n=bi(n,0,2*Math.PI);const r=[],s=[],o=[],a=[],h=[],l=1/e,u=new on,c=new Ci,d=new on,p=new on,f=new on;let m=0,g=0;for(let e=0;e<=t.length-1;e++)switch(e){case 0:m=t[e+1].x-t[e].x,g=t[e+1].y-t[e].y,d.x=1*g,d.y=-m,d.z=0*g,f.copy(d),d.normalize(),a.push(d.x,d.y,d.z);break;case t.length-1:a.push(f.x,f.y,f.z);break;default:m=t[e+1].x-t[e].x,g=t[e+1].y-t[e].y,d.x=1*g,d.y=-m,d.z=0*g,p.copy(d),d.x+=f.x,d.y+=f.y,d.z+=f.z,d.normalize(),a.push(d.x,d.y,d.z),f.copy(p)}for(let r=0;r<=e;r++){const d=i+r*l*n,p=Math.sin(d),f=Math.cos(d);for(let i=0;i<=t.length-1;i++){u.x=t[i].x*p,u.y=t[i].y,u.z=t[i].x*f,s.push(u.x,u.y,u.z),c.x=r/e,c.y=i/(t.length-1),o.push(c.x,c.y);const n=a[3*i+0]*p,l=a[3*i+1],d=a[3*i+0]*f;h.push(n,l,d)}}for(let i=0;i0&&v(!0),e>0&&v(!1)),this.setIndex(l),this.setAttribute("position",new Br(u,3)),this.setAttribute("normal",new Br(c,3)),this.setAttribute("uv",new Br(d,2))}static fromJSON(t){return new Hl(t.radiusTop,t.radiusBottom,t.height,t.radialSegments,t.heightSegments,t.openEnded,t.thetaStart,t.thetaLength)}}class Gl extends Hl{constructor(t=1,e=1,i=8,n=1,r=!1,s=0,o=2*Math.PI){super(0,t,e,i,n,r,s,o),this.type="ConeGeometry",this.parameters={radius:t,height:e,radialSegments:i,heightSegments:n,openEnded:r,thetaStart:s,thetaLength:o}}static fromJSON(t){return new Gl(t.radius,t.height,t.radialSegments,t.heightSegments,t.openEnded,t.thetaStart,t.thetaLength)}}class Wl extends Gr{constructor(t=[],e=[],i=1,n=0){super(),this.type="PolyhedronGeometry",this.parameters={vertices:t,indices:e,radius:i,detail:n};const r=[],s=[];function o(t,e,i,n){const r=n+1,s=[];for(let n=0;n<=r;n++){s[n]=[];const o=t.clone().lerp(i,n/r),a=e.clone().lerp(i,n/r),h=r-n;for(let t=0;t<=h;t++)s[n][t]=0===t&&n===r?o:o.clone().lerp(a,t/h)}for(let t=0;t.9&&o<.1&&(e<.2&&(s[t+0]+=1),i<.2&&(s[t+2]+=1),n<.2&&(s[t+4]+=1))}}()}(),this.setAttribute("position",new Br(r,3)),this.setAttribute("normal",new Br(r.slice(),3)),this.setAttribute("uv",new Br(s,2)),0===n?this.computeVertexNormals():this.normalizeNormals()}static fromJSON(t){return new Wl(t.vertices,t.indices,t.radius,t.details)}}class Yl extends Wl{constructor(t=1,e=0){const i=(1+Math.sqrt(5))/2,n=1/i;super([-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,-n,-i,0,-n,i,0,n,-i,0,n,i,-n,-i,0,-n,i,0,n,-i,0,n,i,0,-i,0,-n,i,0,-n,-i,0,n,i,0,n],[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],t,e),this.type="DodecahedronGeometry",this.parameters={radius:t,detail:e}}static fromJSON(t){return new Yl(t.radius,t.detail)}}const Xl=new on,jl=new on,ql=new on,Ql=new xr;class Kl extends Gr{constructor(t=null,e=1){if(super(),this.type="EdgesGeometry",this.parameters={geometry:t,thresholdAngle:e},null!==t){const i=4,n=Math.pow(10,i),r=Math.cos(yi*e),s=t.getIndex(),o=t.getAttribute("position"),a=s?s.count:o.count,h=[0,0,0],l=["a","b","c"],u=new Array(3),c={},d=[];for(let t=0;t80*i){a=l=t[0],h=u=t[1];for(let e=i;el&&(l=c),d>u&&(u=d);p=Math.max(l-a,u-h),p=0!==p?1/p:0}return eu(s,o,i,a,h,p),o};function $l(t,e,i,n,r){let s,o;if(r===function(t,e,i,n){let r=0;for(let s=e,o=i-n;s0)for(s=e;s=e;s-=n)o=wu(s,t[s],t[s+1],o);return o&&fu(o,o.next)&&(bu(o),o=o.next),o}function tu(t,e){if(!t)return t;e||(e=t);let i,n=t;do{if(i=!1,n.steiner||!fu(n,n.next)&&0!==pu(n.prev,n,n.next))n=n.next;else{if(bu(n),n=e=n.prev,n===n.next)break;i=!0}}while(i||n!==e);return e}function eu(t,e,i,n,r,s,o){if(!t)return;!o&&s&&function(t,e,i,n){let r=t;do{null===r.z&&(r.z=lu(r.x,r.y,e,i,n)),r.prevZ=r.prev,r.nextZ=r.next,r=r.next}while(r!==t);r.prevZ.nextZ=null,r.prevZ=null,function(t){let e,i,n,r,s,o,a,h,l=1;do{for(i=t,t=null,s=null,o=0;i;){for(o++,n=i,a=0,e=0;e0||h>0&&n;)0!==a&&(0===h||!n||i.z<=n.z)?(r=i,i=i.nextZ,a--):(r=n,n=n.nextZ,h--),s?s.nextZ=r:t=r,r.prevZ=s,s=r;i=n}s.nextZ=null,l*=2}while(o>1)}(r)}(t,n,r,s);let a,h,l=t;for(;t.prev!==t.next;)if(a=t.prev,h=t.next,s?nu(t,n,r,s):iu(t))e.push(a.i/i),e.push(t.i/i),e.push(h.i/i),bu(t),t=h.next,l=h.next;else if((t=h)===l){o?1===o?eu(t=ru(tu(t),e,i),e,i,n,r,s,2):2===o&&su(t,e,i,n,r,s):eu(tu(t),e,i,n,r,s,1);break}}function iu(t){const e=t.prev,i=t,n=t.next;if(pu(e,i,n)>=0)return!1;let r=t.next.next;for(;r!==t.prev;){if(cu(e.x,e.y,i.x,i.y,n.x,n.y,r.x,r.y)&&pu(r.prev,r,r.next)>=0)return!1;r=r.next}return!0}function nu(t,e,i,n){const r=t.prev,s=t,o=t.next;if(pu(r,s,o)>=0)return!1;const a=r.xs.x?r.x>o.x?r.x:o.x:s.x>o.x?s.x:o.x,u=r.y>s.y?r.y>o.y?r.y:o.y:s.y>o.y?s.y:o.y,c=lu(a,h,e,i,n),d=lu(l,u,e,i,n);let p=t.prevZ,f=t.nextZ;for(;p&&p.z>=c&&f&&f.z<=d;){if(p!==t.prev&&p!==t.next&&cu(r.x,r.y,s.x,s.y,o.x,o.y,p.x,p.y)&&pu(p.prev,p,p.next)>=0)return!1;if(p=p.prevZ,f!==t.prev&&f!==t.next&&cu(r.x,r.y,s.x,s.y,o.x,o.y,f.x,f.y)&&pu(f.prev,f,f.next)>=0)return!1;f=f.nextZ}for(;p&&p.z>=c;){if(p!==t.prev&&p!==t.next&&cu(r.x,r.y,s.x,s.y,o.x,o.y,p.x,p.y)&&pu(p.prev,p,p.next)>=0)return!1;p=p.prevZ}for(;f&&f.z<=d;){if(f!==t.prev&&f!==t.next&&cu(r.x,r.y,s.x,s.y,o.x,o.y,f.x,f.y)&&pu(f.prev,f,f.next)>=0)return!1;f=f.nextZ}return!0}function ru(t,e,i){let n=t;do{const r=n.prev,s=n.next.next;!fu(r,s)&&mu(r,n,n.next,s)&&yu(r,s)&&yu(s,r)&&(e.push(r.i/i),e.push(n.i/i),e.push(s.i/i),bu(n),bu(n.next),n=t=s),n=n.next}while(n!==t);return tu(n)}function su(t,e,i,n,r,s){let o=t;do{let t=o.next.next;for(;t!==o.prev;){if(o.i!==t.i&&du(o,t)){let a=xu(o,t);return o=tu(o,o.next),a=tu(a,a.next),eu(o,e,i,n,r,s),void eu(a,e,i,n,r,s)}t=t.next}o=o.next}while(o!==t)}function ou(t,e){return t.x-e.x}function au(t,e){if(e=function(t,e){let i=e;const n=t.x,r=t.y;let s,o=-1/0;do{if(r<=i.y&&r>=i.next.y&&i.next.y!==i.y){const t=i.x+(r-i.y)*(i.next.x-i.x)/(i.next.y-i.y);if(t<=n&&t>o){if(o=t,t===n){if(r===i.y)return i;if(r===i.next.y)return i.next}s=i.x=i.x&&i.x>=h&&n!==i.x&&cu(rs.x||i.x===s.x&&hu(s,i)))&&(s=i,c=u)),i=i.next}while(i!==a);return s}(t,e)){const i=xu(e,t);tu(e,e.next),tu(i,i.next)}}function hu(t,e){return pu(t.prev,t,e.prev)<0&&pu(e.next,t,t.next)<0}function lu(t,e,i,n,r){return(t=1431655765&((t=858993459&((t=252645135&((t=16711935&((t=32767*(t-i)*r)|t<<8))|t<<4))|t<<2))|t<<1))|(e=1431655765&((e=858993459&((e=252645135&((e=16711935&((e=32767*(e-n)*r)|e<<8))|e<<4))|e<<2))|e<<1))<<1}function uu(t){let e=t,i=t;do{(e.x=0&&(t-o)*(n-a)-(i-o)*(e-a)>=0&&(i-o)*(s-a)-(r-o)*(n-a)>=0}function du(t,e){return t.next.i!==e.i&&t.prev.i!==e.i&&!function(t,e){let i=t;do{if(i.i!==t.i&&i.next.i!==t.i&&i.i!==e.i&&i.next.i!==e.i&&mu(i,i.next,t,e))return!0;i=i.next}while(i!==t);return!1}(t,e)&&(yu(t,e)&&yu(e,t)&&function(t,e){let i=t,n=!1;const r=(t.x+e.x)/2,s=(t.y+e.y)/2;do{i.y>s!=i.next.y>s&&i.next.y!==i.y&&r<(i.next.x-i.x)*(s-i.y)/(i.next.y-i.y)+i.x&&(n=!n),i=i.next}while(i!==t);return n}(t,e)&&(pu(t.prev,t,e.prev)||pu(t,e.prev,e))||fu(t,e)&&pu(t.prev,t,t.next)>0&&pu(e.prev,e,e.next)>0)}function pu(t,e,i){return(e.y-t.y)*(i.x-e.x)-(e.x-t.x)*(i.y-e.y)}function fu(t,e){return t.x===e.x&&t.y===e.y}function mu(t,e,i,n){const r=vu(pu(t,e,i)),s=vu(pu(t,e,n)),o=vu(pu(i,n,t)),a=vu(pu(i,n,e));return r!==s&&o!==a||(!(0!==r||!gu(t,i,e))||(!(0!==s||!gu(t,n,e))||(!(0!==o||!gu(i,t,n))||!(0!==a||!gu(i,e,n)))))}function gu(t,e,i){return e.x<=Math.max(t.x,i.x)&&e.x>=Math.min(t.x,i.x)&&e.y<=Math.max(t.y,i.y)&&e.y>=Math.min(t.y,i.y)}function vu(t){return t>0?1:t<0?-1:0}function yu(t,e){return pu(t.prev,t,t.next)<0?pu(t,e,t.next)>=0&&pu(t,t.prev,e)>=0:pu(t,e,t.prev)<0||pu(t,t.next,e)<0}function xu(t,e){const i=new Au(t.i,t.x,t.y),n=new Au(e.i,e.x,e.y),r=t.next,s=e.prev;return t.next=e,e.prev=t,i.next=r,r.prev=i,n.next=i,i.prev=n,s.next=n,n.prev=s,n}function wu(t,e,i,n){const r=new Au(t,e,i);return n?(r.next=n.next,r.prev=n,n.next.prev=r,n.next=r):(r.prev=r,r.next=r),r}function bu(t){t.next.prev=t.prev,t.prev.next=t.next,t.prevZ&&(t.prevZ.nextZ=t.nextZ),t.nextZ&&(t.nextZ.prevZ=t.prevZ)}function Au(t,e,i){this.i=t,this.x=e,this.y=i,this.prev=null,this.next=null,this.z=null,this.prevZ=null,this.nextZ=null,this.steiner=!1}class Tu{static area(t){const e=t.length;let i=0;for(let n=e-1,r=0;r2&&t[e-1].equals(t[0])&&t.pop()}function Eu(t,e){for(let i=0;iNumber.EPSILON){const c=Math.sqrt(u),d=Math.sqrt(h*h+l*l),p=e.x-a/c,f=e.y+o/c,m=((i.x-l/d-p)*l-(i.y+h/d-f)*h)/(o*l-a*h);n=p+o*m-t.x,r=f+a*m-t.y;const g=n*n+r*r;if(g<=2)return new Ci(n,r);s=Math.sqrt(g/2)}else{let t=!1;o>Number.EPSILON?h>Number.EPSILON&&(t=!0):o<-Number.EPSILON?h<-Number.EPSILON&&(t=!0):Math.sign(a)===Math.sign(l)&&(t=!0),t?(n=-a,r=o,s=Math.sqrt(u)):(n=o,r=a,s=Math.sqrt(u/2))}return new Ci(n/s,r/s)}const L=[];for(let t=0,e=M.length,i=e-1,n=t+1;t=0;t--){const e=t/p,i=u*Math.cos(e*Math.PI/2),n=c*Math.sin(e*Math.PI/2)+d;for(let t=0,e=M.length;t=0;){const n=i;let r=i-1;r<0&&(r=t.length-1);for(let t=0,i=a+2*p;t0)&&d.push(e,r,h),(t!==i-1||a0!=t>0&&this.version++,this._sheen=t}get clearcoat(){return this._clearcoat}set clearcoat(t){this._clearcoat>0!=t>0&&this.version++,this._clearcoat=t}get transmission(){return this._transmission}set transmission(t){this._transmission>0!=t>0&&this.version++,this._transmission=t}copy(t){return super.copy(t),this.defines={STANDARD:"",PHYSICAL:""},this.clearcoat=t.clearcoat,this.clearcoatMap=t.clearcoatMap,this.clearcoatRoughness=t.clearcoatRoughness,this.clearcoatRoughnessMap=t.clearcoatRoughnessMap,this.clearcoatNormalMap=t.clearcoatNormalMap,this.clearcoatNormalScale.copy(t.clearcoatNormalScale),this.ior=t.ior,this.sheen=t.sheen,this.sheenColor.copy(t.sheenColor),this.sheenColorMap=t.sheenColorMap,this.sheenRoughness=t.sheenRoughness,this.sheenRoughnessMap=t.sheenRoughnessMap,this.transmission=t.transmission,this.transmissionMap=t.transmissionMap,this.thickness=t.thickness,this.thicknessMap=t.thicknessMap,this.attenuationDistance=t.attenuationDistance,this.attenuationColor.copy(t.attenuationColor),this.specularIntensity=t.specularIntensity,this.specularIntensityMap=t.specularIntensityMap,this.specularColor.copy(t.specularColor),this.specularColorMap=t.specularColorMap,this}}Gu.prototype.isMeshPhysicalMaterial=!0;class Wu extends br{constructor(t){super(),this.type="MeshPhongMaterial",this.color=new Wi(16777215),this.specular=new Wi(1118481),this.shininess=30,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new Wi(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=Fe,this.normalScale=new Ci(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.combine=Q,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.flatShading=!1,this.fog=!0,this.setValues(t)}copy(t){return super.copy(t),this.color.copy(t.color),this.specular.copy(t.specular),this.shininess=t.shininess,this.map=t.map,this.lightMap=t.lightMap,this.lightMapIntensity=t.lightMapIntensity,this.aoMap=t.aoMap,this.aoMapIntensity=t.aoMapIntensity,this.emissive.copy(t.emissive),this.emissiveMap=t.emissiveMap,this.emissiveIntensity=t.emissiveIntensity,this.bumpMap=t.bumpMap,this.bumpScale=t.bumpScale,this.normalMap=t.normalMap,this.normalMapType=t.normalMapType,this.normalScale.copy(t.normalScale),this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this.specularMap=t.specularMap,this.alphaMap=t.alphaMap,this.envMap=t.envMap,this.combine=t.combine,this.reflectivity=t.reflectivity,this.refractionRatio=t.refractionRatio,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.wireframeLinecap=t.wireframeLinecap,this.wireframeLinejoin=t.wireframeLinejoin,this.flatShading=t.flatShading,this.fog=t.fog,this}}Wu.prototype.isMeshPhongMaterial=!0;class Yu extends br{constructor(t){super(),this.defines={TOON:""},this.type="MeshToonMaterial",this.color=new Wi(16777215),this.map=null,this.gradientMap=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new Wi(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=Fe,this.normalScale=new Ci(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.alphaMap=null,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.fog=!0,this.setValues(t)}copy(t){return super.copy(t),this.color.copy(t.color),this.map=t.map,this.gradientMap=t.gradientMap,this.lightMap=t.lightMap,this.lightMapIntensity=t.lightMapIntensity,this.aoMap=t.aoMap,this.aoMapIntensity=t.aoMapIntensity,this.emissive.copy(t.emissive),this.emissiveMap=t.emissiveMap,this.emissiveIntensity=t.emissiveIntensity,this.bumpMap=t.bumpMap,this.bumpScale=t.bumpScale,this.normalMap=t.normalMap,this.normalMapType=t.normalMapType,this.normalScale.copy(t.normalScale),this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this.alphaMap=t.alphaMap,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.wireframeLinecap=t.wireframeLinecap,this.wireframeLinejoin=t.wireframeLinejoin,this.fog=t.fog,this}}Yu.prototype.isMeshToonMaterial=!0;class Xu extends br{constructor(t){super(),this.type="MeshNormalMaterial",this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=Fe,this.normalScale=new Ci(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.wireframe=!1,this.wireframeLinewidth=1,this.flatShading=!1,this.setValues(t)}copy(t){return super.copy(t),this.bumpMap=t.bumpMap,this.bumpScale=t.bumpScale,this.normalMap=t.normalMap,this.normalMapType=t.normalMapType,this.normalScale.copy(t.normalScale),this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.flatShading=t.flatShading,this}}Xu.prototype.isMeshNormalMaterial=!0;class ju extends br{constructor(t){super(),this.type="MeshLambertMaterial",this.color=new Wi(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new Wi(0),this.emissiveIntensity=1,this.emissiveMap=null,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.combine=Q,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.fog=!0,this.setValues(t)}copy(t){return super.copy(t),this.color.copy(t.color),this.map=t.map,this.lightMap=t.lightMap,this.lightMapIntensity=t.lightMapIntensity,this.aoMap=t.aoMap,this.aoMapIntensity=t.aoMapIntensity,this.emissive.copy(t.emissive),this.emissiveMap=t.emissiveMap,this.emissiveIntensity=t.emissiveIntensity,this.specularMap=t.specularMap,this.alphaMap=t.alphaMap,this.envMap=t.envMap,this.combine=t.combine,this.reflectivity=t.reflectivity,this.refractionRatio=t.refractionRatio,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.wireframeLinecap=t.wireframeLinecap,this.wireframeLinejoin=t.wireframeLinejoin,this.fog=t.fog,this}}ju.prototype.isMeshLambertMaterial=!0;class qu extends br{constructor(t){super(),this.defines={MATCAP:""},this.type="MeshMatcapMaterial",this.color=new Wi(16777215),this.matcap=null,this.map=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=Fe,this.normalScale=new Ci(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.alphaMap=null,this.flatShading=!1,this.fog=!0,this.setValues(t)}copy(t){return super.copy(t),this.defines={MATCAP:""},this.color.copy(t.color),this.matcap=t.matcap,this.map=t.map,this.bumpMap=t.bumpMap,this.bumpScale=t.bumpScale,this.normalMap=t.normalMap,this.normalMapType=t.normalMapType,this.normalScale.copy(t.normalScale),this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this.alphaMap=t.alphaMap,this.flatShading=t.flatShading,this.fog=t.fog,this}}qu.prototype.isMeshMatcapMaterial=!0;class Qu extends Qh{constructor(t){super(),this.type="LineDashedMaterial",this.scale=1,this.dashSize=3,this.gapSize=1,this.setValues(t)}copy(t){return super.copy(t),this.scale=t.scale,this.dashSize=t.dashSize,this.gapSize=t.gapSize,this}}Qu.prototype.isLineDashedMaterial=!0;const Ku={ShadowMaterial:Uu,SpriteMaterial:ph,RawShaderMaterial:Vu,ShaderMaterial:ps,PointsMaterial:ol,MeshPhysicalMaterial:Gu,MeshStandardMaterial:Hu,MeshPhongMaterial:Wu,MeshToonMaterial:Yu,MeshNormalMaterial:Xu,MeshLambertMaterial:ju,MeshDepthMaterial:Xa,MeshDistanceMaterial:ja,MeshBasicMaterial:Ar,MeshMatcapMaterial:qu,LineDashedMaterial:Qu,LineBasicMaterial:Qh,Material:br};br.fromType=function(t){return new Ku[t]};const Ju={arraySlice:function(t,e,i){return Ju.isTypedArray(t)?new t.constructor(t.subarray(e,void 0!==i?i:t.length)):t.slice(e,i)},convertArray:function(t,e,i){return!t||!i&&t.constructor===e?t:"number"==typeof e.BYTES_PER_ELEMENT?new e(t):Array.prototype.slice.call(t)},isTypedArray:function(t){return ArrayBuffer.isView(t)&&!(t instanceof DataView)},getKeyframeOrder:function(t){const e=t.length,i=new Array(e);for(let t=0;t!==e;++t)i[t]=t;return i.sort((function(e,i){return t[e]-t[i]})),i},sortedArray:function(t,e,i){const n=t.length,r=new t.constructor(n);for(let s=0,o=0;o!==n;++s){const n=i[s]*e;for(let i=0;i!==e;++i)r[o++]=t[n+i]}return r},flattenJSON:function(t,e,i,n){let r=1,s=t[0];for(;void 0!==s&&void 0===s[n];)s=t[r++];if(void 0===s)return;let o=s[n];if(void 0!==o)if(Array.isArray(o))do{o=s[n],void 0!==o&&(e.push(s.time),i.push.apply(i,o)),s=t[r++]}while(void 0!==s);else if(void 0!==o.toArray)do{o=s[n],void 0!==o&&(e.push(s.time),o.toArray(i,i.length)),s=t[r++]}while(void 0!==s);else do{o=s[n],void 0!==o&&(e.push(s.time),i.push(o)),s=t[r++]}while(void 0!==s)},subclip:function(t,e,i,n,r=30){const s=t.clone();s.name=e;const o=[];for(let t=0;t=n)){h.push(e.times[t]);for(let i=0;is.tracks[t].times[0]&&(a=s.tracks[t].times[0]);for(let t=0;t=n.times[c]){const t=c*h+a,e=t+h-a;d=Ju.arraySlice(n.values,t,e)}else{const t=n.createInterpolant(),e=a,i=h-a;t.evaluate(s),d=Ju.arraySlice(t.resultBuffer,e,i)}if("quaternion"===r){(new sn).fromArray(d).normalize().conjugate().toArray(d)}const p=o.times.length;for(let t=0;t=r)break t;{const o=e[1];t=r)break e}s=i,i=0}}for(;i>>1;te;)--s;if(++s,0!==r||s!==n){r>=s&&(s=Math.max(s,1),r=s-1);const t=this.getValueSize();this.times=Ju.arraySlice(i,r,s),this.values=Ju.arraySlice(this.values,r*t,s*t)}return this}validate(){let t=!0;const e=this.getValueSize();e-Math.floor(e)!=0&&(t=!1);const i=this.times,n=this.values,r=i.length;0===r&&(t=!1);let s=null;for(let e=0;e!==r;e++){const n=i[e];if("number"==typeof n&&isNaN(n)){t=!1;break}if(null!==s&&s>n){t=!1;break}s=n}if(void 0!==n&&Ju.isTypedArray(n))for(let e=0,i=n.length;e!==i;++e){const i=n[e];if(isNaN(i)){t=!1;break}}return t}optimize(){const t=Ju.arraySlice(this.times),e=Ju.arraySlice(this.values),i=this.getValueSize(),n=this.getInterpolation()===Te,r=t.length-1;let s=1;for(let o=1;o0){t[s]=t[r];for(let t=r*i,n=s*i,o=0;o!==i;++o)e[n+o]=e[t+o];++s}return s!==t.length?(this.times=Ju.arraySlice(t,0,s),this.values=Ju.arraySlice(e,0,s*i)):(this.times=t,this.values=e),this}clone(){const t=Ju.arraySlice(this.times,0),e=Ju.arraySlice(this.values,0),i=new(0,this.constructor)(this.name,t,e);return i.createInterpolant=this.createInterpolant,i}}ic.prototype.TimeBufferType=Float32Array,ic.prototype.ValueBufferType=Float32Array,ic.prototype.DefaultInterpolation=Ae;class nc extends ic{}nc.prototype.ValueTypeName="bool",nc.prototype.ValueBufferType=Array,nc.prototype.DefaultInterpolation=be,nc.prototype.InterpolantFactoryMethodLinear=void 0,nc.prototype.InterpolantFactoryMethodSmooth=void 0;class rc extends ic{}rc.prototype.ValueTypeName="color";class sc extends ic{}sc.prototype.ValueTypeName="number";class oc extends Zu{constructor(t,e,i,n){super(t,e,i,n)}interpolate_(t,e,i,n){const r=this.resultBuffer,s=this.sampleValues,o=this.valueSize,a=(i-e)/(n-e);let h=t*o;for(let t=h+o;h!==t;h+=4)sn.slerpFlat(r,0,s,h-o,s,h,a);return r}}class ac extends ic{InterpolantFactoryMethodLinear(t){return new oc(this.times,this.values,this.getValueSize(),t)}}ac.prototype.ValueTypeName="quaternion",ac.prototype.DefaultInterpolation=Ae,ac.prototype.InterpolantFactoryMethodSmooth=void 0;class hc extends ic{}hc.prototype.ValueTypeName="string",hc.prototype.ValueBufferType=Array,hc.prototype.DefaultInterpolation=be,hc.prototype.InterpolantFactoryMethodLinear=void 0,hc.prototype.InterpolantFactoryMethodSmooth=void 0;class lc extends ic{}lc.prototype.ValueTypeName="vector";class uc{constructor(t,e=-1,i,n=_e){this.name=t,this.tracks=i,this.duration=e,this.blendMode=n,this.uuid=wi(),this.duration<0&&this.resetDuration()}static parse(t){const e=[],i=t.tracks,n=1/(t.fps||1);for(let t=0,r=i.length;t!==r;++t)e.push(cc(i[t]).scale(n));const r=new this(t.name,t.duration,e,t.blendMode);return r.uuid=t.uuid,r}static toJSON(t){const e=[],i=t.tracks,n={name:t.name,duration:t.duration,tracks:e,uuid:t.uuid,blendMode:t.blendMode};for(let t=0,n=i.length;t!==n;++t)e.push(ic.toJSON(i[t]));return n}static CreateFromMorphTargetSequence(t,e,i,n){const r=e.length,s=[];for(let t=0;t1){const t=s[1];let e=n[t];e||(n[t]=e=[]),e.push(i)}}const s=[];for(const t in n)s.push(this.CreateFromMorphTargetSequence(t,n[t],e,i));return s}static parseAnimation(t,e){if(!t)return null;const i=function(t,e,i,n,r){if(0!==i.length){const s=[],o=[];Ju.flattenJSON(i,s,o,n),0!==s.length&&r.push(new t(e,s,o))}},n=[],r=t.name||"default",s=t.fps||30,o=t.blendMode;let a=t.length||-1;const h=t.hierarchy||[];for(let t=0;t{e&&e(r),this.manager.itemEnd(t)},0),r;if(void 0!==gc[t])return void gc[t].push({onLoad:e,onProgress:i,onError:n});gc[t]=[],gc[t].push({onLoad:e,onProgress:i,onError:n});const s=new Request(t,{headers:new Headers(this.requestHeader),credentials:this.withCredentials?"include":"same-origin"}),o=this.mimeType,a=this.responseType;fetch(s).then(e=>{if(200===e.status||0===e.status){if(e.status,"undefined"==typeof ReadableStream||void 0===e.body||void 0===e.body.getReader)return e;const i=gc[t],n=e.body.getReader(),r=e.headers.get("Content-Length"),s=r?parseInt(r):0,o=0!==s;let a=0;const h=new ReadableStream({start(t){!function e(){n.read().then(({done:n,value:r})=>{if(n)t.close();else{a+=r.byteLength;const n=new ProgressEvent("progress",{lengthComputable:o,loaded:a,total:s});for(let t=0,e=i.length;t{switch(a){case"arraybuffer":return t.arrayBuffer();case"blob":return t.blob();case"document":return t.text().then(t=>(new DOMParser).parseFromString(t,o));case"json":return t.json();default:if(void 0===o)return t.text();{const e=/charset="?([^;"\s]*)"?/i.exec(o),i=e&&e[1]?e[1].toLowerCase():void 0,n=new TextDecoder(i);return t.arrayBuffer().then(t=>n.decode(t))}}}).then(e=>{dc.add(t,e);const i=gc[t];delete gc[t];for(let t=0,n=i.length;t{const i=gc[t];if(void 0===i)throw this.manager.itemError(t),e;delete gc[t];for(let t=0,n=i.length;t{this.manager.itemEnd(t)}),this.manager.itemStart(t)}setResponseType(t){return this.responseType=t,this}setMimeType(t){return this.mimeType=t,this}}class yc extends mc{constructor(t){super(t)}load(t,e,i,n){const r=this,s=new vc(this.manager);s.setPath(this.path),s.setRequestHeader(this.requestHeader),s.setWithCredentials(this.withCredentials),s.load(t,(function(i){try{e(r.parse(JSON.parse(i)))}catch(e){n&&n(e),r.manager.itemError(t)}}),i,n)}parse(t){const e=[];for(let i=0;i0:n.vertexColors=t.vertexColors),void 0!==t.uniforms)for(const e in t.uniforms){const r=t.uniforms[e];switch(n.uniforms[e]={},r.type){case"t":n.uniforms[e].value=i(r.value);break;case"c":n.uniforms[e].value=(new Wi).setHex(r.value);break;case"v2":n.uniforms[e].value=(new Ci).fromArray(r.value);break;case"v3":n.uniforms[e].value=(new on).fromArray(r.value);break;case"v4":n.uniforms[e].value=(new Ji).fromArray(r.value);break;case"m3":n.uniforms[e].value=(new Pi).fromArray(r.value);break;case"m4":n.uniforms[e].value=(new kn).fromArray(r.value);break;default:n.uniforms[e].value=r.value}}if(void 0!==t.defines&&(n.defines=t.defines),void 0!==t.vertexShader&&(n.vertexShader=t.vertexShader),void 0!==t.fragmentShader&&(n.fragmentShader=t.fragmentShader),void 0!==t.extensions)for(const e in t.extensions)n.extensions[e]=t.extensions[e];if(void 0!==t.shading&&(n.flatShading=1===t.shading),void 0!==t.size&&(n.size=t.size),void 0!==t.sizeAttenuation&&(n.sizeAttenuation=t.sizeAttenuation),void 0!==t.map&&(n.map=i(t.map)),void 0!==t.matcap&&(n.matcap=i(t.matcap)),void 0!==t.alphaMap&&(n.alphaMap=i(t.alphaMap)),void 0!==t.bumpMap&&(n.bumpMap=i(t.bumpMap)),void 0!==t.bumpScale&&(n.bumpScale=t.bumpScale),void 0!==t.normalMap&&(n.normalMap=i(t.normalMap)),void 0!==t.normalMapType&&(n.normalMapType=t.normalMapType),void 0!==t.normalScale){let e=t.normalScale;!1===Array.isArray(e)&&(e=[e,e]),n.normalScale=(new Ci).fromArray(e)}return void 0!==t.displacementMap&&(n.displacementMap=i(t.displacementMap)),void 0!==t.displacementScale&&(n.displacementScale=t.displacementScale),void 0!==t.displacementBias&&(n.displacementBias=t.displacementBias),void 0!==t.roughnessMap&&(n.roughnessMap=i(t.roughnessMap)),void 0!==t.metalnessMap&&(n.metalnessMap=i(t.metalnessMap)),void 0!==t.emissiveMap&&(n.emissiveMap=i(t.emissiveMap)),void 0!==t.emissiveIntensity&&(n.emissiveIntensity=t.emissiveIntensity),void 0!==t.specularMap&&(n.specularMap=i(t.specularMap)),void 0!==t.specularIntensityMap&&(n.specularIntensityMap=i(t.specularIntensityMap)),void 0!==t.specularColorMap&&(n.specularColorMap=i(t.specularColorMap)),void 0!==t.envMap&&(n.envMap=i(t.envMap)),void 0!==t.envMapIntensity&&(n.envMapIntensity=t.envMapIntensity),void 0!==t.reflectivity&&(n.reflectivity=t.reflectivity),void 0!==t.refractionRatio&&(n.refractionRatio=t.refractionRatio),void 0!==t.lightMap&&(n.lightMap=i(t.lightMap)),void 0!==t.lightMapIntensity&&(n.lightMapIntensity=t.lightMapIntensity),void 0!==t.aoMap&&(n.aoMap=i(t.aoMap)),void 0!==t.aoMapIntensity&&(n.aoMapIntensity=t.aoMapIntensity),void 0!==t.gradientMap&&(n.gradientMap=i(t.gradientMap)),void 0!==t.clearcoatMap&&(n.clearcoatMap=i(t.clearcoatMap)),void 0!==t.clearcoatRoughnessMap&&(n.clearcoatRoughnessMap=i(t.clearcoatRoughnessMap)),void 0!==t.clearcoatNormalMap&&(n.clearcoatNormalMap=i(t.clearcoatNormalMap)),void 0!==t.clearcoatNormalScale&&(n.clearcoatNormalScale=(new Ci).fromArray(t.clearcoatNormalScale)),void 0!==t.transmissionMap&&(n.transmissionMap=i(t.transmissionMap)),void 0!==t.thicknessMap&&(n.thicknessMap=i(t.thicknessMap)),void 0!==t.sheenColorMap&&(n.sheenColorMap=i(t.sheenColorMap)),void 0!==t.sheenRoughnessMap&&(n.sheenRoughnessMap=i(t.sheenRoughnessMap)),n}setTextures(t){return this.textures=t,this}}class Wc{static decodeText(t){if("undefined"!=typeof TextDecoder)return(new TextDecoder).decode(t);let e="";for(let i=0,n=t.length;i0){const i=new pc(e);r=new wc(i),r.setCrossOrigin(this.crossOrigin);for(let e=0,i=t.length;e0){n=new wc(this.manager),n.setCrossOrigin(this.crossOrigin);for(let e=0,n=t.length;e0){this.source.connect(this.filters[0]);for(let t=1,e=this.filters.length;t0){this.source.disconnect(this.filters[0]);for(let t=1,e=this.filters.length;t0&&this._mixBufferRegionAdditive(i,n,this._addIndex*e,1,e);for(let t=e,r=e+e;t!==r;++t)if(i[t]!==i[t+e]){o.setValue(i,n);break}}saveOriginalState(){const t=this.binding,e=this.buffer,i=this.valueSize,n=i*this._origIndex;t.getValue(e,n);for(let t=i,r=n;t!==r;++t)e[t]=e[n+t%i];this._setIdentity(),this.cumulativeWeight=0,this.cumulativeWeightAdditive=0}restoreOriginalState(){const t=3*this.valueSize;this.binding.setValue(this.buffer,t)}_setAdditiveIdentityNumeric(){const t=this._addIndex*this.valueSize,e=t+this.valueSize;for(let i=t;i=.5)for(let n=0;n!==r;++n)t[e+n]=t[i+n]}_slerp(t,e,i,n){sn.slerpFlat(t,e,t,e,t,i,n)}_slerpAdditive(t,e,i,n,r){const s=this._workIndex*r;sn.multiplyQuaternionsFlat(t,s,t,e,t,i),sn.slerpFlat(t,e,t,e,t,s,n)}_lerp(t,e,i,n,r){const s=1-n;for(let o=0;o!==r;++o){const r=e+o;t[r]=t[r]*s+t[i+o]*n}}_lerpAdditive(t,e,i,n,r){for(let s=0;s!==r;++s){const r=e+s;t[r]=t[r]+t[i+s]*n}}}const Ad=new RegExp("[\\[\\]\\.:\\/]","g"),Td="[^"+"\\[\\]\\.:\\/".replace("\\.","")+"]",Sd=/((?:WC+[\/:])*)/.source.replace("WC","[^\\[\\]\\.:\\/]"),Ed=/(WCOD+)?/.source.replace("WCOD",Td),Md=/(?:\.(WC+)(?:\[(.+)\])?)?/.source.replace("WC","[^\\[\\]\\.:\\/]"),_d=/\.(WC+)(?:\[(.+)\])?/.source.replace("WC","[^\\[\\]\\.:\\/]"),Cd=new RegExp("^"+Sd+Ed+Md+_d+"$"),Pd=["material","materials","bones"];class Rd{constructor(t,e,i){this.path=e,this.parsedPath=i||Rd.parseTrackName(e),this.node=Rd.findNode(t,this.parsedPath.nodeName)||t,this.rootNode=t,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}static create(t,e,i){return t&&t.isAnimationObjectGroup?new Rd.Composite(t,e,i):new Rd(t,e,i)}static sanitizeNodeName(t){return t.replace(/\s/g,"_").replace(Ad,"")}static parseTrackName(t){const e=Cd.exec(t);if(null===e)throw new Error("PropertyBinding: Cannot parse trackName: "+t);const i={nodeName:e[2],objectName:e[3],objectIndex:e[4],propertyName:e[5],propertyIndex:e[6]},n=i.nodeName&&i.nodeName.lastIndexOf(".");if(void 0!==n&&-1!==n){const t=i.nodeName.substring(n+1);-1!==Pd.indexOf(t)&&(i.nodeName=i.nodeName.substring(0,n),i.objectName=t)}if(null===i.propertyName||0===i.propertyName.length)throw new Error("PropertyBinding: can not parse propertyName from trackName: "+t);return i}static findNode(t,e){if(void 0===e||""===e||"."===e||-1===e||e===t.name||e===t.uuid)return t;if(t.skeleton){const i=t.skeleton.getBoneByName(e);if(void 0!==i)return i}if(t.children){const i=function(t){for(let n=0;n=r){const s=r++,l=t[s];e[l.uuid]=h,t[h]=l,e[a]=s,t[s]=o;for(let t=0,e=n;t!==e;++t){const e=i[t],n=e[s],r=e[h];e[h]=n,e[s]=r}}}this.nCachedObjects_=r}uncache(){const t=this._objects,e=this._indicesByUUID,i=this._bindings,n=i.length;let r=this.nCachedObjects_,s=t.length;for(let o=0,a=arguments.length;o!==a;++o){const a=arguments[o].uuid,h=e[a];if(void 0!==h)if(delete e[a],h0&&(e[o.uuid]=h),t[h]=o,t.pop();for(let t=0,e=n;t!==e;++t){const e=i[t];e[h]=e[r],e.pop()}}}this.nCachedObjects_=r}subscribe_(t,e){const i=this._bindingsIndicesByPath;let n=i[t];const r=this._bindings;if(void 0!==n)return r[n];const s=this._paths,o=this._parsedPaths,a=this._objects,h=a.length,l=this.nCachedObjects_,u=new Array(h);n=r.length,i[t]=n,s.push(t),o.push(e),r.push(u);for(let i=l,n=a.length;i!==n;++i){const n=a[i];u[i]=new Rd(n,t,e)}return u}unsubscribe_(t){const e=this._bindingsIndicesByPath,i=e[t];if(void 0!==i){const n=this._paths,r=this._parsedPaths,s=this._bindings,o=s.length-1,a=s[o];e[t[o]]=i,s[i]=a,s.pop(),r[i]=r[o],r.pop(),n[i]=n[o],n.pop()}}}Ld.prototype.isAnimationObjectGroup=!0;class Od{constructor(t,e,i=null,n=e.blendMode){this._mixer=t,this._clip=e,this._localRoot=i,this.blendMode=n;const r=e.tracks,s=r.length,o=new Array(s),a={endingStart:Se,endingEnd:Se};for(let t=0;t!==s;++t){const e=r[t].createInterpolant(null);o[t]=e,e.settings=a}this._interpolantSettings=a,this._interpolants=o,this._propertyBindings=new Array(s),this._cacheIndex=null,this._byClipCacheIndex=null,this._timeScaleInterpolant=null,this._weightInterpolant=null,this.loop=xe,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}play(){return this._mixer._activateAction(this),this}stop(){return this._mixer._deactivateAction(this),this.reset()}reset(){return this.paused=!1,this.enabled=!0,this.time=0,this._loopCount=-1,this._startTime=null,this.stopFading().stopWarping()}isRunning(){return this.enabled&&!this.paused&&0!==this.timeScale&&null===this._startTime&&this._mixer._isActiveAction(this)}isScheduled(){return this._mixer._isActiveAction(this)}startAt(t){return this._startTime=t,this}setLoop(t,e){return this.loop=t,this.repetitions=e,this}setEffectiveWeight(t){return this.weight=t,this._effectiveWeight=this.enabled?t:0,this.stopFading()}getEffectiveWeight(){return this._effectiveWeight}fadeIn(t){return this._scheduleFading(t,0,1)}fadeOut(t){return this._scheduleFading(t,1,0)}crossFadeFrom(t,e,i){if(t.fadeOut(e),this.fadeIn(e),i){const i=this._clip.duration,n=t._clip.duration,r=n/i,s=i/n;t.warp(1,r,e),this.warp(s,1,e)}return this}crossFadeTo(t,e,i){return t.crossFadeFrom(this,e,i)}stopFading(){const t=this._weightInterpolant;return null!==t&&(this._weightInterpolant=null,this._mixer._takeBackControlInterpolant(t)),this}setEffectiveTimeScale(t){return this.timeScale=t,this._effectiveTimeScale=this.paused?0:t,this.stopWarping()}getEffectiveTimeScale(){return this._effectiveTimeScale}setDuration(t){return this.timeScale=this._clip.duration/t,this.stopWarping()}syncWith(t){return this.time=t.time,this.timeScale=t.timeScale,this.stopWarping()}halt(t){return this.warp(this._effectiveTimeScale,0,t)}warp(t,e,i){const n=this._mixer,r=n.time,s=this.timeScale;let o=this._timeScaleInterpolant;null===o&&(o=n._lendControlInterpolant(),this._timeScaleInterpolant=o);const a=o.parameterPositions,h=o.sampleValues;return a[0]=r,a[1]=r+i,h[0]=t/s,h[1]=e/s,this}stopWarping(){const t=this._timeScaleInterpolant;return null!==t&&(this._timeScaleInterpolant=null,this._mixer._takeBackControlInterpolant(t)),this}getMixer(){return this._mixer}getClip(){return this._clip}getRoot(){return this._localRoot||this._mixer._root}_update(t,e,i,n){if(!this.enabled)return void this._updateWeight(t);const r=this._startTime;if(null!==r){const n=(t-r)*i;if(n<0||0===i)return;this._startTime=null,e=i*n}e*=this._updateTimeScale(t);const s=this._updateTime(e),o=this._updateWeight(t);if(o>0){const t=this._interpolants,e=this._propertyBindings;switch(this.blendMode){case Ce:for(let i=0,n=t.length;i!==n;++i)t[i].evaluate(s),e[i].accumulateAdditive(o);break;case _e:default:for(let i=0,r=t.length;i!==r;++i)t[i].evaluate(s),e[i].accumulate(n,o)}}}_updateWeight(t){let e=0;if(this.enabled){e=this.weight;const i=this._weightInterpolant;if(null!==i){const n=i.evaluate(t)[0];e*=n,t>i.parameterPositions[1]&&(this.stopFading(),0===n&&(this.enabled=!1))}}return this._effectiveWeight=e,e}_updateTimeScale(t){let e=0;if(!this.paused){e=this.timeScale;const i=this._timeScaleInterpolant;if(null!==i){e*=i.evaluate(t)[0],t>i.parameterPositions[1]&&(this.stopWarping(),0===e?this.paused=!0:this.timeScale=e)}}return this._effectiveTimeScale=e,e}_updateTime(t){const e=this._clip.duration,i=this.loop;let n=this.time+t,r=this._loopCount;const s=i===we;if(0===t)return-1===r?n:s&&1==(1&r)?e-n:n;if(i===ye){-1===r&&(this._loopCount=0,this._setEndings(!0,!0,!1));t:{if(n>=e)n=e;else{if(!(n<0)){this.time=n;break t}n=0}this.clampWhenFinished?this.paused=!0:this.enabled=!1,this.time=n,this._mixer.dispatchEvent({type:"finished",action:this,direction:t<0?-1:1})}}else{if(-1===r&&(t>=0?(r=0,this._setEndings(!0,0===this.repetitions,s)):this._setEndings(0===this.repetitions,!0,s)),n>=e||n<0){const i=Math.floor(n/e);n-=e*i,r+=Math.abs(i);const o=this.repetitions-r;if(o<=0)this.clampWhenFinished?this.paused=!0:this.enabled=!1,n=t>0?e:0,this.time=n,this._mixer.dispatchEvent({type:"finished",action:this,direction:t>0?1:-1});else{if(1===o){const e=t<0;this._setEndings(e,!e,s)}else this._setEndings(!1,!1,s);this._loopCount=r,this.time=n,this._mixer.dispatchEvent({type:"loop",action:this,loopDelta:i})}}else this.time=n;if(s&&1==(1&r))return e-n}return n}_setEndings(t,e,i){const n=this._interpolantSettings;i?(n.endingStart=Ee,n.endingEnd=Ee):(n.endingStart=t?this.zeroSlopeAtStart?Ee:Se:Me,n.endingEnd=e?this.zeroSlopeAtEnd?Ee:Se:Me)}_scheduleFading(t,e,i){const n=this._mixer,r=n.time;let s=this._weightInterpolant;null===s&&(s=n._lendControlInterpolant(),this._weightInterpolant=s);const o=s.parameterPositions,a=s.sampleValues;return o[0]=r,a[0]=e,o[1]=r+t,a[1]=i,this}}class Dd extends mi{constructor(t){super(),this._root=t,this._initMemoryManager(),this._accuIndex=0,this.time=0,this.timeScale=1}_bindAction(t,e){const i=t._localRoot||this._root,n=t._clip.tracks,r=n.length,s=t._propertyBindings,o=t._interpolants,a=i.uuid,h=this._bindingsByRootAndName;let l=h[a];void 0===l&&(l={},h[a]=l);for(let t=0;t!==r;++t){const r=n[t],h=r.name;let u=l[h];if(void 0!==u)++u.referenceCount,s[t]=u;else{if(u=s[t],void 0!==u){null===u._cacheIndex&&(++u.referenceCount,this._addInactiveBinding(u,a,h));continue}const n=e&&e._propertyBindings[t].binding.parsedPath;u=new bd(Rd.create(i,h,n),r.ValueTypeName,r.getValueSize()),++u.referenceCount,this._addInactiveBinding(u,a,h),s[t]=u}o[t].resultBuffer=u.buffer}}_activateAction(t){if(!this._isActiveAction(t)){if(null===t._cacheIndex){const e=(t._localRoot||this._root).uuid,i=t._clip.uuid,n=this._actionsByClip[i];this._bindAction(t,n&&n.knownActions[0]),this._addInactiveAction(t,i,e)}const e=t._propertyBindings;for(let t=0,i=e.length;t!==i;++t){const i=e[t];0==i.useCount++&&(this._lendBinding(i),i.saveOriginalState())}this._lendAction(t)}}_deactivateAction(t){if(this._isActiveAction(t)){const e=t._propertyBindings;for(let t=0,i=e.length;t!==i;++t){const i=e[t];0==--i.useCount&&(i.restoreOriginalState(),this._takeBackBinding(i))}this._takeBackAction(t)}}_initMemoryManager(){this._actions=[],this._nActiveActions=0,this._actionsByClip={},this._bindings=[],this._nActiveBindings=0,this._bindingsByRootAndName={},this._controlInterpolants=[],this._nActiveControlInterpolants=0;const t=this;this.stats={actions:{get total(){return t._actions.length},get inUse(){return t._nActiveActions}},bindings:{get total(){return t._bindings.length},get inUse(){return t._nActiveBindings}},controlInterpolants:{get total(){return t._controlInterpolants.length},get inUse(){return t._nActiveControlInterpolants}}}}_isActiveAction(t){const e=t._cacheIndex;return null!==e&&e=0;--e)t[e].stop();return this}update(t){t*=this.timeScale;const e=this._actions,i=this._nActiveActions,n=this.time+=t,r=Math.sign(t),s=this._accuIndex^=1;for(let o=0;o!==i;++o){e[o]._update(n,t,r,s)}const o=this._bindings,a=this._nActiveBindings;for(let t=0;t!==a;++t)o[t].apply(s);return this}setTime(t){this.time=0;for(let t=0;tthis.max.x||t.ythis.max.y)}containsBox(t){return this.min.x<=t.min.x&&t.max.x<=this.max.x&&this.min.y<=t.min.y&&t.max.y<=this.max.y}getParameter(t,e){return e.set((t.x-this.min.x)/(this.max.x-this.min.x),(t.y-this.min.y)/(this.max.y-this.min.y))}intersectsBox(t){return!(t.max.xthis.max.x||t.max.ythis.max.y)}clampPoint(t,e){return e.copy(t).clamp(this.min,this.max)}distanceToPoint(t){return Hd.copy(t).clamp(this.min,this.max).sub(t).length()}intersect(t){return this.min.max(t.min),this.max.min(t.max),this}union(t){return this.min.min(t.min),this.max.max(t.max),this}translate(t){return this.min.add(t),this.max.add(t),this}equals(t){return t.min.equals(this.min)&&t.max.equals(this.max)}}Gd.prototype.isBox2=!0;const Wd=new on,Yd=new on;class Xd{constructor(t=new on,e=new on){this.start=t,this.end=e}set(t,e){return this.start.copy(t),this.end.copy(e),this}copy(t){return this.start.copy(t.start),this.end.copy(t.end),this}getCenter(t){return t.addVectors(this.start,this.end).multiplyScalar(.5)}delta(t){return t.subVectors(this.end,this.start)}distanceSq(){return this.start.distanceToSquared(this.end)}distance(){return this.start.distanceTo(this.end)}at(t,e){return this.delta(e).multiplyScalar(t).add(this.start)}closestPointToPointParameter(t,e){Wd.subVectors(t,this.start),Yd.subVectors(this.end,this.start);const i=Yd.dot(Yd);let n=Yd.dot(Wd)/i;return e&&(n=bi(n,0,1)),n}closestPointToPoint(t,e,i){const n=this.closestPointToPointParameter(t,e);return this.delta(i).multiplyScalar(n).add(this.start)}applyMatrix4(t){return this.start.applyMatrix4(t),this.end.applyMatrix4(t),this}equals(t){return t.start.equals(this.start)&&t.end.equals(this.end)}clone(){return(new this.constructor).copy(this)}}const jd=new on;class qd extends hr{constructor(t,e){super(),this.light=t,this.light.updateMatrixWorld(),this.matrix=t.matrixWorld,this.matrixAutoUpdate=!1,this.color=e;const i=new Gr,n=[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];for(let t=0,e=1,i=32;t.99999)this.quaternion.set(0,0,0,1);else if(t.y<-.99999)this.quaternion.set(1,0,0,0);else{yp.set(t.z,0,-t.x).normalize();const e=Math.acos(t.y);this.quaternion.setFromAxisAngle(yp,e)}}setLength(t,e=.2*t,i=.2*e){this.line.scale.set(1,Math.max(1e-4,t-e),1),this.line.updateMatrix(),this.cone.scale.set(i,e,i),this.cone.position.y=t,this.cone.updateMatrix()}setColor(t){this.line.material.color.set(t),this.cone.material.color.set(t)}copy(t){return super.copy(t,!1),this.line.copy(t.line),this.cone.copy(t.cone),this}}class Ap extends rl{constructor(t=1){const e=[0,0,0,t,0,0,0,0,0,0,t,0,0,0,0,0,0,t],i=new Gr;i.setAttribute("position",new Br(e,3)),i.setAttribute("color",new Br([1,0,0,1,.6,0,0,1,0,.6,1,0,0,0,1,0,.6,1],3));super(i,new Qh({vertexColors:!0,toneMapped:!1})),this.type="AxesHelper"}setColors(t,e,i){const n=new Wi,r=this.geometry.attributes.color.array;return n.set(t),n.toArray(r,0),n.toArray(r,3),n.set(e),n.toArray(r,6),n.toArray(r,9),n.set(i),n.toArray(r,12),n.toArray(r,15),this.geometry.attributes.color.needsUpdate=!0,this}dispose(){this.geometry.dispose(),this.material.dispose()}}class Tp{constructor(){this.type="ShapePath",this.color=new Wi,this.subPaths=[],this.currentPath=null}moveTo(t,e){return this.currentPath=new Nl,this.subPaths.push(this.currentPath),this.currentPath.moveTo(t,e),this}lineTo(t,e){return this.currentPath.lineTo(t,e),this}quadraticCurveTo(t,e,i,n){return this.currentPath.quadraticCurveTo(t,e,i,n),this}bezierCurveTo(t,e,i,n,r,s){return this.currentPath.bezierCurveTo(t,e,i,n,r,s),this}splineThru(t){return this.currentPath.splineThru(t),this}toShapes(t,e){function i(t){const e=[];for(let i=0,n=t.length;iNumber.EPSILON){if(h<0&&(i=e[s],a=-a,o=e[r],h=-h),t.yo.y)continue;if(t.y===i.y){if(t.x===i.x)return!0}else{const e=h*(t.x-i.x)-a*(t.y-i.y);if(0===e)return!0;if(e<0)continue;n=!n}}else{if(t.y!==i.y)continue;if(o.x<=t.x&&t.x<=i.x||i.x<=t.x&&t.x<=o.x)return!0}}return n}const r=Tu.isClockWise,s=this.subPaths;if(0===s.length)return[];if(!0===e)return i(s);let o,a,h;const l=[];if(1===s.length)return a=s[0],h=new Jl,h.curves=a.curves,l.push(h),l;let u=!r(s[0].getPoints());u=t?!u:u;const c=[],d=[];let p,f,m=[],g=0;d[g]=void 0,m[g]=[];for(let e=0,i=s.length;e1){let t=!1,e=0;for(let t=0,e=d.length;t0&&!1===t&&(m=c)}for(let t=0,e=d.length;t>23&511;return Cp[i]+((8388607&e)>>Pp[i])}static fromHalfFloat(t){const e=t>>10;return _p[0]=Rp[Op[e]+(1023&t)]+Lp[e],Mp[0]}}const Ep=new ArrayBuffer(4),Mp=new Float32Array(Ep),_p=new Uint32Array(Ep),Cp=new Uint32Array(512),Pp=new Uint32Array(512);for(let t=0;t<256;++t){const e=t-127;e<-27?(Cp[t]=0,Cp[256|t]=32768,Pp[t]=24,Pp[256|t]=24):e<-14?(Cp[t]=1024>>-e-14,Cp[256|t]=1024>>-e-14|32768,Pp[t]=-e-1,Pp[256|t]=-e-1):e<=15?(Cp[t]=e+15<<10,Cp[256|t]=e+15<<10|32768,Pp[t]=13,Pp[256|t]=13):e<128?(Cp[t]=31744,Cp[256|t]=64512,Pp[t]=24,Pp[256|t]=24):(Cp[t]=31744,Cp[256|t]=64512,Pp[t]=13,Pp[256|t]=13)}const Rp=new Uint32Array(2048),Lp=new Uint32Array(64),Op=new Uint32Array(64);for(let t=1;t<1024;++t){let e=t<<13,i=0;for(;0==(8388608&e);)e<<=1,i-=8388608;e&=-8388609,i+=947912704,Rp[t]=e|i}for(let t=1024;t<2048;++t)Rp[t]=939524096+(t-1024<<13);for(let t=1;t<31;++t)Lp[t]=t<<23;Lp[31]=1199570944,Lp[32]=2147483648;for(let t=33;t<63;++t)Lp[t]=2147483648+(t-32<<23);Lp[63]=3347054592;for(let t=1;t<64;++t)32!==t&&(Op[t]=1024);const Dp=0,Bp=1,Ip=0,Fp=1,kp=2;function Np(t){return t}function zp(t=[]){return t.isMultiMaterial=!0,t.materials=t,t.clone=function(){return t.slice()},t}class Up extends cl{constructor(t,e){super(t,e)}}class Vp extends _h{constructor(t){super(t)}}class Hp extends cl{constructor(t,e){super(t,e)}}class Gp extends ol{constructor(t){super(t)}}class Wp extends ol{constructor(t){super(t)}}class Yp extends ol{constructor(t){super(t)}}class Xp extends on{constructor(t,e,i){super(t,e,i)}}class jp extends Er{constructor(t,e){super(t,e),this.setUsage(ri)}}class qp extends Mr{constructor(t,e){super(t,e)}}class Qp extends _r{constructor(t,e){super(t,e)}}class Kp extends Cr{constructor(t,e){super(t,e)}}class Jp extends Pr{constructor(t,e){super(t,e)}}class Zp extends Rr{constructor(t,e){super(t,e)}}class $p extends Lr{constructor(t,e){super(t,e)}}class tf extends Or{constructor(t,e){super(t,e)}}class ef extends Br{constructor(t,e){super(t,e)}}class nf extends Ir{constructor(t,e){super(t,e)}}vl.create=function(t,e){return t.prototype=Object.create(vl.prototype),t.prototype.constructor=t,t.prototype.getPoint=e,t},Nl.prototype.fromPoints=function(t){return this.setFromPoints(t)};class rf extends Ap{constructor(t){super(t)}}class sf extends mp{constructor(t,e){super(t,e)}}class of extends rl{constructor(t,e){super(new Kl(t.geometry),new Qh({color:void 0!==e?e:16777215}))}}rp.prototype.setColors=function(){},Zd.prototype.update=function(){};class af extends rl{constructor(t,e){super(new ku(t.geometry),new Qh({color:void 0!==e?e:16777215}))}}mc.prototype.extractUrlBase=function(t){return Wc.extractUrlBase(t)},mc.Handlers={add:function(){},get:function(){}};class hf extends vc{constructor(t){super(t)}}class lf extends Ac{constructor(t){super(t)}}Gd.prototype.center=function(t){return this.getCenter(t)},Gd.prototype.empty=function(){return this.isEmpty()},Gd.prototype.isIntersectionBox=function(t){return this.intersectsBox(t)},Gd.prototype.size=function(t){return this.getSize(t)},ln.prototype.center=function(t){return this.getCenter(t)},ln.prototype.empty=function(){return this.isEmpty()},ln.prototype.isIntersectionBox=function(t){return this.intersectsBox(t)},ln.prototype.isIntersectionSphere=function(t){return this.intersectsSphere(t)},ln.prototype.size=function(t){return this.getSize(t)},jn.prototype.toVector3=function(){},Cn.prototype.empty=function(){return this.isEmpty()},Es.prototype.setFromMatrix=function(t){return this.setFromProjectionMatrix(t)},Xd.prototype.center=function(t){return this.getCenter(t)},Pi.prototype.flattenToArrayOffset=function(t,e){return this.toArray(t,e)},Pi.prototype.multiplyVector3=function(t){return t.applyMatrix3(this)},Pi.prototype.multiplyVector3Array=function(){},Pi.prototype.applyToBufferAttribute=function(t){return t.applyMatrix3(this)},Pi.prototype.applyToVector3Array=function(){},Pi.prototype.getInverse=function(t){return this.copy(t).invert()},kn.prototype.extractPosition=function(t){return this.copyPosition(t)},kn.prototype.flattenToArrayOffset=function(t,e){return this.toArray(t,e)},kn.prototype.getPosition=function(){return(new on).setFromMatrixColumn(this,3)},kn.prototype.setRotationFromQuaternion=function(t){return this.makeRotationFromQuaternion(t)},kn.prototype.multiplyToArray=function(){},kn.prototype.multiplyVector3=function(t){return t.applyMatrix4(this)},kn.prototype.multiplyVector4=function(t){return t.applyMatrix4(this)},kn.prototype.multiplyVector3Array=function(){},kn.prototype.rotateAxis=function(t){t.transformDirection(this)},kn.prototype.crossVector=function(t){return t.applyMatrix4(this)},kn.prototype.translate=function(){},kn.prototype.rotateX=function(){},kn.prototype.rotateY=function(){},kn.prototype.rotateZ=function(){},kn.prototype.rotateByAxis=function(){},kn.prototype.applyToBufferAttribute=function(t){return t.applyMatrix4(this)},kn.prototype.applyToVector3Array=function(){},kn.prototype.makeFrustum=function(t,e,i,n,r,s){return this.makePerspective(t,e,n,i,r,s)},kn.prototype.getInverse=function(t){return this.copy(t).invert()},As.prototype.isIntersectionLine=function(t){return this.intersectsLine(t)},sn.prototype.multiplyVector3=function(t){return t.applyQuaternion(this)},sn.prototype.inverse=function(){return this.invert()},Fn.prototype.isIntersectionBox=function(t){return this.intersectsBox(t)},Fn.prototype.isIntersectionPlane=function(t){return this.intersectsPlane(t)},Fn.prototype.isIntersectionSphere=function(t){return this.intersectsSphere(t)},xr.prototype.area=function(){return this.getArea()},xr.prototype.barycoordFromPoint=function(t,e){return this.getBarycoord(t,e)},xr.prototype.midpoint=function(t){return this.getMidpoint(t)},xr.prototypenormal=function(t){return this.getNormal(t)},xr.prototype.plane=function(t){return this.getPlane(t)},xr.barycoordFromPoint=function(t,e,i,n,r){return xr.getBarycoord(t,e,i,n,r)},xr.normal=function(t,e,i,n){return xr.getNormal(t,e,i,n)},Jl.prototype.extractAllPoints=function(t){return this.extractPoints(t)},Jl.prototype.extrude=function(t){return new Mu(this,t)},Jl.prototype.makeGeometry=function(t){return new Lu(this,t)},Ci.prototype.fromAttribute=function(t,e,i){return this.fromBufferAttribute(t,e,i)},Ci.prototype.distanceToManhattan=function(t){return this.manhattanDistanceTo(t)},Ci.prototype.lengthManhattan=function(){return this.manhattanLength()},on.prototype.setEulerFromRotationMatrix=function(){},on.prototype.setEulerFromQuaternion=function(){},on.prototype.getPositionFromMatrix=function(t){return this.setFromMatrixPosition(t)},on.prototype.getScaleFromMatrix=function(t){return this.setFromMatrixScale(t)},on.prototype.getColumnFromMatrix=function(t,e){return this.setFromMatrixColumn(e,t)},on.prototype.applyProjection=function(t){return this.applyMatrix4(t)},on.prototype.fromAttribute=function(t,e,i){return this.fromBufferAttribute(t,e,i)},on.prototype.distanceToManhattan=function(t){return this.manhattanDistanceTo(t)},on.prototype.lengthManhattan=function(){return this.manhattanLength()},Ji.prototype.fromAttribute=function(t,e,i){return this.fromBufferAttribute(t,e,i)},Ji.prototype.lengthManhattan=function(){return this.manhattanLength()},hr.prototype.getChildByName=function(t){return this.getObjectByName(t)},hr.prototype.renderDepth=function(){},hr.prototype.translate=function(t,e){return this.translateOnAxis(e,t)},hr.prototype.getWorldRotation=function(){},hr.prototype.applyMatrix=function(t){return this.applyMatrix4(t)},Object.defineProperties(hr.prototype,{eulerOrder:{get:function(){return this.rotation.order},set:function(t){this.rotation.order=t}},useQuaternion:{get:function(){},set:function(){}}}),as.prototype.setDrawMode=function(){},Object.defineProperties(as.prototype,{drawMode:{get:function(){return Pe},set:function(){}}}),kh.prototype.initBones=function(){},ms.prototype.setLens=function(t,e){void 0!==e&&(this.filmGauge=e),this.setFocalLength(t)},Object.defineProperties(Sc.prototype,{onlyShadow:{set:function(){}},shadowCameraFov:{set:function(t){this.shadow.camera.fov=t}},shadowCameraLeft:{set:function(t){this.shadow.camera.left=t}},shadowCameraRight:{set:function(t){this.shadow.camera.right=t}},shadowCameraTop:{set:function(t){this.shadow.camera.top=t}},shadowCameraBottom:{set:function(t){this.shadow.camera.bottom=t}},shadowCameraNear:{set:function(t){this.shadow.camera.near=t}},shadowCameraFar:{set:function(t){this.shadow.camera.far=t}},shadowCameraVisible:{set:function(){}},shadowBias:{set:function(t){this.shadow.bias=t}},shadowDarkness:{set:function(){}},shadowMapWidth:{set:function(t){this.shadow.mapSize.width=t}},shadowMapHeight:{set:function(t){this.shadow.mapSize.height=t}}}),Object.defineProperties(Er.prototype,{length:{get:function(){return this.array.length}},dynamic:{get:function(){return this.usage===ri},set:function(){this.setUsage(ri)}}}),Er.prototype.setDynamic=function(t){return this.setUsage(!0===t?ri:ni),this},Er.prototype.copyIndicesArray=function(){},Er.prototype.setArray=function(){},Gr.prototype.addIndex=function(t){this.setIndex(t)},Gr.prototype.addAttribute=function(t,e){return e&&e.isBufferAttribute||e&&e.isInterleavedBufferAttribute?"index"===t?(this.setIndex(e),this):this.setAttribute(t,e):this.setAttribute(t,new Er(arguments[1],arguments[2]))},Gr.prototype.addDrawCall=function(t,e,i){this.addGroup(t,e)},Gr.prototype.clearDrawCalls=function(){this.clearGroups()},Gr.prototype.computeOffsets=function(){},Gr.prototype.removeAttribute=function(t){return this.deleteAttribute(t)},Gr.prototype.applyMatrix=function(t){return this.applyMatrix4(t)},Object.defineProperties(Gr.prototype,{drawcalls:{get:function(){return this.groups}},offsets:{get:function(){return this.groups}}}),uh.prototype.setDynamic=function(t){return this.setUsage(!0===t?ri:ni),this},uh.prototype.setArray=function(){},Mu.prototype.getArrays=function(){},Mu.prototype.addShapeList=function(){},Mu.prototype.addShape=function(){},lh.prototype.dispose=function(){},Bd.prototype.onUpdate=function(){return this},Object.defineProperties(br.prototype,{wrapAround:{get:function(){},set:function(){}},overdraw:{get:function(){},set:function(){}},wrapRGB:{get:function(){return new Wi}},shading:{get:function(){},set:function(t){this.flatShading=t===v}},stencilMask:{get:function(){return this.stencilFuncMask},set:function(t){this.stencilFuncMask=t}},vertexTangents:{get:function(){},set:function(){}}}),Object.defineProperties(ps.prototype,{derivatives:{get:function(){return this.extensions.derivatives},set:function(t){this.extensions.derivatives=t}}}),sh.prototype.clearTarget=function(t,e,i,n){this.setRenderTarget(t),this.clear(e,i,n)},sh.prototype.animate=function(t){this.setAnimationLoop(t)},sh.prototype.getCurrentRenderTarget=function(){return this.getRenderTarget()},sh.prototype.getMaxAnisotropy=function(){return this.capabilities.getMaxAnisotropy()},sh.prototype.getPrecision=function(){return this.capabilities.precision},sh.prototype.resetGLState=function(){return this.state.reset()},sh.prototype.supportsFloatTextures=function(){return this.extensions.get("OES_texture_float")},sh.prototype.supportsHalfFloatTextures=function(){return this.extensions.get("OES_texture_half_float")},sh.prototype.supportsStandardDerivatives=function(){return this.extensions.get("OES_standard_derivatives")},sh.prototype.supportsCompressedTextureS3TC=function(){return this.extensions.get("WEBGL_compressed_texture_s3tc")},sh.prototype.supportsCompressedTexturePVRTC=function(){return this.extensions.get("WEBGL_compressed_texture_pvrtc")},sh.prototype.supportsBlendMinMax=function(){return this.extensions.get("EXT_blend_minmax")},sh.prototype.supportsVertexTextures=function(){return this.capabilities.vertexTextures},sh.prototype.supportsInstancedArrays=function(){return this.extensions.get("ANGLE_instanced_arrays")},sh.prototype.enableScissorTest=function(t){this.setScissorTest(t)},sh.prototype.initMaterial=function(){},sh.prototype.addPrePlugin=function(){},sh.prototype.addPostPlugin=function(){},sh.prototype.updateShadowMap=function(){},sh.prototype.setFaceCulling=function(){},sh.prototype.allocTextureUnit=function(){},sh.prototype.setTexture=function(){},sh.prototype.setTexture2D=function(){},sh.prototype.setTextureCube=function(){},sh.prototype.getActiveMipMapLevel=function(){return this.getActiveMipmapLevel()},Object.defineProperties(sh.prototype,{shadowMapEnabled:{get:function(){return this.shadowMap.enabled},set:function(t){this.shadowMap.enabled=t}},shadowMapType:{get:function(){return this.shadowMap.type},set:function(t){this.shadowMap.type=t}},shadowMapCullFace:{get:function(){},set:function(){}},context:{get:function(){return this.getContext()}},vr:{get:function(){return this.xr}},gammaInput:{get:function(){return!1},set:function(){}},gammaOutput:{get:function(){return!1},set:function(t){this.outputEncoding=!0===t?De:Oe}},toneMappingWhitePoint:{get:function(){return 1},set:function(){}},gammaFactor:{get:function(){return 2},set:function(){}}}),Object.defineProperties(qa.prototype,{cullFace:{get:function(){},set:function(){}},renderReverseSided:{get:function(){},set:function(){}},renderSingleSided:{get:function(){},set:function(){}}});class uf extends ys{constructor(t,e,i){super(t,i)}}function cf(){}function df(){}Object.defineProperties(Zi.prototype,{wrapS:{get:function(){return this.texture.wrapS},set:function(t){this.texture.wrapS=t}},wrapT:{get:function(){return this.texture.wrapT},set:function(t){this.texture.wrapT=t}},magFilter:{get:function(){return this.texture.magFilter},set:function(t){this.texture.magFilter=t}},minFilter:{get:function(){return this.texture.minFilter},set:function(t){this.texture.minFilter=t}},anisotropy:{get:function(){return this.texture.anisotropy},set:function(t){this.texture.anisotropy=t}},offset:{get:function(){return this.texture.offset},set:function(t){this.texture.offset=t}},repeat:{get:function(){return this.texture.repeat},set:function(t){this.texture.repeat=t}},format:{get:function(){return this.texture.format},set:function(t){this.texture.format=t}},type:{get:function(){return this.texture.type},set:function(t){this.texture.type=t}},generateMipmaps:{get:function(){return this.texture.generateMipmaps},set:function(t){this.texture.generateMipmaps=t}}}),fd.prototype.load=function(t){const e=this;return(new td).load(t,(function(t){e.setBuffer(t)})),this},wd.prototype.getData=function(){return this.getFrequencyData()},gs.prototype.updateCubeMap=function(t,e){return this.update(t,e)},gs.prototype.clear=function(t,e,i,n){return this.renderTarget.clear(t,e,i,n)},Xi.crossOrigin=void 0,Xi.loadTexture=function(t,e,i,n){const r=new Tc;r.setCrossOrigin(this.crossOrigin);const s=r.load(t,i,void 0,n);return e&&(s.mapping=e),s},Xi.loadTextureCube=function(t,e,i,n){const r=new bc;r.setCrossOrigin(this.crossOrigin);const s=r.load(t,i,void 0,n);return e&&(s.mapping=e),s},Xi.loadCompressedTexture=function(){},Xi.loadCompressedTextureCube=function(){};const pf={createMultiMaterialObject:function(){},detach:function(){},attach:function(){}};function ff(){}class mf extends Gr{constructor(){super()}}class gf extends Gr{constructor(){super()}}function vf(){}function yf(){}function xf(){}class wf extends Zi{constructor(t,e,i){super(t,e,i),this.samples=4}}class bf extends $i{constructor(t,e,i,n){super(t,e,i,n)}}class Af extends en{constructor(t,e,i,n){super(t,e,i,n)}}"undefined"!=typeof __THREE_DEVTOOLS__&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("register",{detail:{revision:n}})),"undefined"!=typeof window&&(window.__THREE__||(window.__THREE__=n))},function(t,e,i){"use strict";i(34);var n=i(4),r=i(55),s=i.n(r),o={soundEnabled:!0,bgMusicEnabled:!1,soundVolume:1,bgMusicVolume:.5,bgMusicLoop:!0,playerSpeed:1,playerColor:"#42c0ff",enemySpeed:.75,enemyDiffRaise:.05,enemyColor:"#55C53E",playerArmColor:"#464346",levelCount:10,selectedLevel1:0,selectedLevel2:1,selectedLevel3:0,skipCountdown:!1,skipSearchingOpponent:!1,countdownStart:3,countdownSpeed:600,enableBgStars:!0,enableStarTrails:!1,level1_bgTop:"#807EFF",level1_bgBottom:"#F1E8FF",level2_bgTop:"#FFEBA5",level2_bgBottom:"#FFACA7",level3_bgTop:"#9CE479",level3_bgBottom:"#E3FFC8",level3_floorColor1:"#FD94FE",level3_floorColor2:"#ED53FD",level3_floorMetalness:.5,level4_bgTop:"#96E4FF",level4_bgBottom:"#44BDFD",level5_bgTop:"#F5FFAD",level5_bgBottom:"#7AFE70",level6_bgTop:"#FFB890",level6_bgBottom:"#FF627A",level6_coinPlacementType:2,level7_bgTop:"#FFF0AE",level7_bgBottom:"#FFB0AD",level7_floorColor1:"#FFFEFF",level7_floorColor2:"#DDDADD",level7_floorMetalness:.5,level8_bgTop:"#CCC3FF",level8_bgBottom:"#4BC5FD",level8_floorColor1:"#FFDE60",level8_floorColor2:"#F7A645",level8_floorMetalness:.5,level9_bgTop:"#FFFFA9",level9_bgBottom:"#E6E033",level10_bgTop:"#5CEF7F",level10_bgBottom:"#F4F3FB",level10_coinPlacementType:2};function a(t,e){for(var i=0;i1&&void 0!==arguments[1]?arguments[1]:1,i=d.models[t],n=i.scene.clone();return i.animations&&(n.animations=i.animations),n.scale.multiplyScalar(e),n}},{key:"cloneAssetSkeleton",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,i=d.models[t],n=THREE.SkeletonUtils.clone(i.scene);return n.animations=i.animations,n.scale.multiplyScalar(e),n}},{key:"getTexture",value:function(t){return d.textures[t]}}],(i=null)&&a(e.prototype,i),n&&a(e,n),Object.defineProperty(e,"prototype",{writable:!1}),t}(),l=i(12),u=i(56),c=(i(37),{phaserGame:null,phaserScene:null,threeScene:null,threeRenderer:null,threeCamera:null,uiScene:null,audioIcon:null,resolution:1.2,minResolution:1,lowEndDevice:!1,enableShadows:!1,antialiasDefault:!0,data:o,postprocessEnabled:!1,showGpuInfo:!1,showLevelButtons:!1,eventEmitter:new s.a,gpuTier:null,deltaMultiplier:1,locales:u,addToGame:n.a.addToGame,addToUpdate:n.a.addToUpdateables,guiHelper:l.a,cloneAsset:h.cloneAsset,cloneAssetSkeleton:h.cloneAssetSkeleton,getTexture:h.getTexture,vibrateOn:!0,soundOn:!0,currentCoin:0,currentScore:0,lastScore:0,lastCoin:0,playerData:{score:0,coin:0,level:0,speedUpgradeLevel:1,bestScore:0},saveData:{coin:0,level:0,speedUpgradeLevel:1,bestScore:0},bestScore:0,lastLevelIndex:0,upgrades:{speedUpgrade:{get name(){return c.locales.UPGRADE_SPEED},get level(){return c.playerData.speedUpgradeLevel},set level(t){c.playerData.speedUpgradeLevel=t},startingCost:15,get cost(){return this.startingCost+20*(this.level-1)}}},vibrateFeedback:function(t){c.vibrateOn&&H5SDK.getHapticModule().performHapticFeedBack(t)}}),d=e.a=c},function(t,e,i){"use strict";i.r(e),i.d(e,"AABB",(function(){return u})),i.d(e,"ArrayCollisionMatrix",(function(){return p})),i.d(e,"BODY_SLEEP_STATES",(function(){return L})),i.d(e,"BODY_TYPES",(function(){return R})),i.d(e,"Body",(function(){return O})),i.d(e,"Box",(function(){return _})),i.d(e,"Broadphase",(function(){return X})),i.d(e,"COLLISION_TYPES",(function(){return vn})),i.d(e,"ConeTwistConstraint",(function(){return ce})),i.d(e,"Constraint",(function(){return Ut})),i.d(e,"ContactEquation",(function(){return Qt})),i.d(e,"ContactMaterial",(function(){return be})),i.d(e,"ConvexPolyhedron",(function(){return A})),i.d(e,"Cylinder",(function(){return wi})),i.d(e,"DistanceConstraint",(function(){return de})),i.d(e,"Equation",(function(){return Ht})),i.d(e,"EventTarget",(function(){return f})),i.d(e,"FrictionEquation",(function(){return ye})),i.d(e,"GSSolver",(function(){return tn})),i.d(e,"GridBroadphase",(function(){return J})),i.d(e,"Heightfield",(function(){return Si})),i.d(e,"HingeConstraint",(function(){return me})),i.d(e,"JacobianElement",(function(){return Vt})),i.d(e,"LockConstraint",(function(){return pe})),i.d(e,"Mat3",(function(){return r})),i.d(e,"Material",(function(){return Ae})),i.d(e,"NaiveBroadphase",(function(){return $})),i.d(e,"Narrowphase",(function(){return yn})),i.d(e,"ObjectCollisionMatrix",(function(){return n})),i.d(e,"Particle",(function(){return bi})),i.d(e,"Plane",(function(){return Ai})),i.d(e,"PointToPointConstraint",(function(){return re})),i.d(e,"Pool",(function(){return mn})),i.d(e,"Quaternion",(function(){return m})),i.d(e,"RAY_MODES",(function(){return ht})),i.d(e,"Ray",(function(){return lt})),i.d(e,"RaycastResult",(function(){return tt})),i.d(e,"RaycastVehicle",(function(){return Ne})),i.d(e,"RigidVehicle",(function(){return li})),i.d(e,"RotationalEquation",(function(){return he})),i.d(e,"RotationalMotorEquation",(function(){return fe})),i.d(e,"SAPBroadphase",(function(){return Nt})),i.d(e,"SHAPE_TYPES",(function(){return y})),i.d(e,"SPHSystem",(function(){return di})),i.d(e,"Shape",(function(){return x})),i.d(e,"Solver",(function(){return $i})),i.d(e,"Sphere",(function(){return hi})),i.d(e,"SplitSolver",(function(){return sn})),i.d(e,"Spring",(function(){return Te})),i.d(e,"Transform",(function(){return w})),i.d(e,"Trimesh",(function(){return zi})),i.d(e,"Vec3",(function(){return o})),i.d(e,"Vec3Pool",(function(){return gn})),i.d(e,"WheelInfo",(function(){return Ie})),i.d(e,"World",(function(){return zr}));class n{constructor(){this.matrix={}}get(t,e){let{id:i}=t,{id:n}=e;if(n>i){const t=n;n=i,i=t}return`${i}-${n}`in this.matrix}set(t,e,i){let{id:n}=t,{id:r}=e;if(r>n){const t=r;r=n,n=t}i?this.matrix[`${n}-${r}`]=!0:delete this.matrix[`${n}-${r}`]}reset(){this.matrix={}}setNumObjects(t){}}class r{constructor(t){void 0===t&&(t=[0,0,0,0,0,0,0,0,0]),this.elements=t}identity(){const t=this.elements;t[0]=1,t[1]=0,t[2]=0,t[3]=0,t[4]=1,t[5]=0,t[6]=0,t[7]=0,t[8]=1}setZero(){const t=this.elements;t[0]=0,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=0,t[6]=0,t[7]=0,t[8]=0}setTrace(t){const e=this.elements;e[0]=t.x,e[4]=t.y,e[8]=t.z}getTrace(t){void 0===t&&(t=new o);const e=this.elements;return t.x=e[0],t.y=e[4],t.z=e[8],t}vmult(t,e){void 0===e&&(e=new o);const i=this.elements,n=t.x,r=t.y,s=t.z;return e.x=i[0]*n+i[1]*r+i[2]*s,e.y=i[3]*n+i[4]*r+i[5]*s,e.z=i[6]*n+i[7]*r+i[8]*s,e}smult(t){for(let e=0;e0){const t=1/n;this.x*=t,this.y*=t,this.z*=t}else this.x=0,this.y=0,this.z=0;return n}unit(t){void 0===t&&(t=new o);const e=this.x,i=this.y,n=this.z;let r=Math.sqrt(e*e+i*i+n*n);return r>0?(r=1/r,t.x=e*r,t.y=i*r,t.z=n*r):(t.x=1,t.y=0,t.z=0),t}length(){const t=this.x,e=this.y,i=this.z;return Math.sqrt(t*t+e*e+i*i)}lengthSquared(){return this.dot(this)}distanceTo(t){const e=this.x,i=this.y,n=this.z,r=t.x,s=t.y,o=t.z;return Math.sqrt((r-e)*(r-e)+(s-i)*(s-i)+(o-n)*(o-n))}distanceSquared(t){const e=this.x,i=this.y,n=this.z,r=t.x,s=t.y,o=t.z;return(r-e)*(r-e)+(s-i)*(s-i)+(o-n)*(o-n)}scale(t,e){void 0===e&&(e=new o);const i=this.x,n=this.y,r=this.z;return e.x=t*i,e.y=t*n,e.z=t*r,e}vmul(t,e){return void 0===e&&(e=new o),e.x=t.x*this.x,e.y=t.y*this.y,e.z=t.z*this.z,e}addScaledVector(t,e,i){return void 0===i&&(i=new o),i.x=this.x+t*e.x,i.y=this.y+t*e.y,i.z=this.z+t*e.z,i}dot(t){return this.x*t.x+this.y*t.y+this.z*t.z}isZero(){return 0===this.x&&0===this.y&&0===this.z}negate(t){return void 0===t&&(t=new o),t.x=-this.x,t.y=-this.y,t.z=-this.z,t}tangents(t,e){const i=this.length();if(i>0){const n=a,r=1/i;n.set(this.x*r,this.y*r,this.z*r);const s=h;Math.abs(n.x)<.9?(s.set(1,0,0),n.cross(s,t)):(s.set(0,1,0),n.cross(s,t)),n.cross(t,e)}else t.set(1,0,0),e.set(0,1,0)}toString(){return`${this.x},${this.y},${this.z}`}toArray(){return[this.x,this.y,this.z]}copy(t){return this.x=t.x,this.y=t.y,this.z=t.z,this}lerp(t,e,i){const n=this.x,r=this.y,s=this.z;i.x=n+(t.x-n)*e,i.y=r+(t.y-r)*e,i.z=s+(t.z-s)*e}almostEquals(t,e){return void 0===e&&(e=1e-6),!(Math.abs(this.x-t.x)>e||Math.abs(this.y-t.y)>e||Math.abs(this.z-t.z)>e)}almostZero(t){return void 0===t&&(t=1e-6),!(Math.abs(this.x)>t||Math.abs(this.y)>t||Math.abs(this.z)>t)}isAntiparallelTo(t,e){return this.negate(l),l.almostEquals(t,e)}clone(){return new o(this.x,this.y,this.z)}}o.ZERO=new o(0,0,0),o.UNIT_X=new o(1,0,0),o.UNIT_Y=new o(0,1,0),o.UNIT_Z=new o(0,0,1);const a=new o,h=new o,l=new o;class u{constructor(t){void 0===t&&(t={}),this.lowerBound=new o,this.upperBound=new o,t.lowerBound&&this.lowerBound.copy(t.lowerBound),t.upperBound&&this.upperBound.copy(t.upperBound)}setFromPoints(t,e,i,n){const r=this.lowerBound,s=this.upperBound,o=i;r.copy(t[0]),o&&o.vmult(r,r),s.copy(r);for(let e=1;es.x&&(s.x=i.x),i.xs.y&&(s.y=i.y),i.ys.z&&(s.z=i.z),i.z=r.x&&e.y<=n.y&&i.y>=r.y&&e.z<=n.z&&i.z>=r.z}getCorners(t,e,i,n,r,s,o,a){const h=this.lowerBound,l=this.upperBound;t.copy(h),e.set(l.x,h.y,h.z),i.set(l.x,l.y,h.z),n.set(h.x,l.y,l.z),r.set(l.x,h.y,l.z),s.set(h.x,l.y,h.z),o.set(h.x,h.y,l.z),a.copy(l)}toLocalFrame(t,e){const i=d,n=i[0],r=i[1],s=i[2],o=i[3],a=i[4],h=i[5],l=i[6],u=i[7];this.getCorners(n,r,s,o,a,h,l,u);for(let e=0;8!==e;e++){const n=i[e];t.pointToLocal(n,n)}return e.setFromPoints(i)}toWorldFrame(t,e){const i=d,n=i[0],r=i[1],s=i[2],o=i[3],a=i[4],h=i[5],l=i[6],u=i[7];this.getCorners(n,r,s,o,a,h,l,u);for(let e=0;8!==e;e++){const n=i[e];t.pointToWorld(n,n)}return e.setFromPoints(i)}overlapsRay(t){const{direction:e,from:i}=t,n=1/e.x,r=1/e.y,s=1/e.z,o=(this.lowerBound.x-i.x)*n,a=(this.upperBound.x-i.x)*n,h=(this.lowerBound.y-i.y)*r,l=(this.upperBound.y-i.y)*r,u=(this.lowerBound.z-i.z)*s,c=(this.upperBound.z-i.z)*s,d=Math.max(Math.max(Math.min(o,a),Math.min(h,l)),Math.min(u,c)),p=Math.min(Math.min(Math.max(o,a),Math.max(h,l)),Math.max(u,c));return!(p<0)&&!(d>p)}}const c=new o,d=[new o,new o,new o,new o,new o,new o,new o,new o];class p{constructor(){this.matrix=[]}get(t,e){let{index:i}=t,{index:n}=e;if(n>i){const t=n;n=i,i=t}return this.matrix[(i*(i+1)>>1)+n-1]}set(t,e,i){let{index:n}=t,{index:r}=e;if(r>n){const t=r;r=n,n=t}this.matrix[(n*(n+1)>>1)+r-1]=i?1:0}reset(){for(let t=0,e=this.matrix.length;t!==e;t++)this.matrix[t]=0}setNumObjects(t){this.matrix.length=t*(t-1)>>1}}class f{addEventListener(t,e){void 0===this._listeners&&(this._listeners={});const i=this._listeners;return void 0===i[t]&&(i[t]=[]),i[t].includes(e)||i[t].push(e),this}hasEventListener(t,e){if(void 0===this._listeners)return!1;const i=this._listeners;return!(void 0===i[t]||!i[t].includes(e))}hasAnyEventListener(t){if(void 0===this._listeners)return!1;return void 0!==this._listeners[t]}removeEventListener(t,e){if(void 0===this._listeners)return this;const i=this._listeners;if(void 0===i[t])return this;const n=i[t].indexOf(e);return-1!==n&&i[t].splice(n,1),this}dispatchEvent(t){if(void 0===this._listeners)return this;const e=this._listeners[t.type];if(void 0!==e){t.target=this;for(let i=0,n=e.length;i.499&&(i=2*Math.atan2(s,h),n=Math.PI/2,r=0),t<-.499&&(i=-2*Math.atan2(s,h),n=-Math.PI/2,r=0),void 0===i){const e=s*s,l=o*o,u=a*a;i=Math.atan2(2*o*h-2*s*a,1-2*l-2*u),n=Math.asin(2*t),r=Math.atan2(2*s*h-2*o*a,1-2*e-2*u)}break;default:throw new Error(`Euler order ${e} not supported yet.`)}t.y=i,t.z=n,t.x=r}setFromEuler(t,e,i,n){void 0===n&&(n="XYZ");const r=Math.cos(t/2),s=Math.cos(e/2),o=Math.cos(i/2),a=Math.sin(t/2),h=Math.sin(e/2),l=Math.sin(i/2);return"XYZ"===n?(this.x=a*s*o+r*h*l,this.y=r*h*o-a*s*l,this.z=r*s*l+a*h*o,this.w=r*s*o-a*h*l):"YXZ"===n?(this.x=a*s*o+r*h*l,this.y=r*h*o-a*s*l,this.z=r*s*l-a*h*o,this.w=r*s*o+a*h*l):"ZXY"===n?(this.x=a*s*o-r*h*l,this.y=r*h*o+a*s*l,this.z=r*s*l+a*h*o,this.w=r*s*o-a*h*l):"ZYX"===n?(this.x=a*s*o-r*h*l,this.y=r*h*o+a*s*l,this.z=r*s*l-a*h*o,this.w=r*s*o+a*h*l):"YZX"===n?(this.x=a*s*o+r*h*l,this.y=r*h*o+a*s*l,this.z=r*s*l-a*h*o,this.w=r*s*o-a*h*l):"XZY"===n&&(this.x=a*s*o-r*h*l,this.y=r*h*o-a*s*l,this.z=r*s*l+a*h*o,this.w=r*s*o+a*h*l),this}clone(){return new m(this.x,this.y,this.z,this.w)}slerp(t,e,i){void 0===i&&(i=new m);const n=this.x,r=this.y,s=this.z,o=this.w;let a,h,l,u,c,d=t.x,p=t.y,f=t.z,g=t.w;return h=n*d+r*p+s*f+o*g,h<0&&(h=-h,d=-d,p=-p,f=-f,g=-g),1-h>1e-6?(a=Math.acos(h),l=Math.sin(a),u=Math.sin((1-e)*a)/l,c=Math.sin(e*a)/l):(u=1-e,c=e),i.x=u*n+c*d,i.y=u*r+c*p,i.z=u*s+c*f,i.w=u*o+c*g,i}integrate(t,e,i,n){void 0===n&&(n=new m);const r=t.x*i.x,s=t.y*i.y,o=t.z*i.z,a=this.x,h=this.y,l=this.z,u=this.w,c=.5*e;return n.x+=c*(r*u+s*l-o*h),n.y+=c*(s*u+o*a-r*l),n.z+=c*(o*u+r*h-s*a),n.w+=c*(-r*a-s*h-o*l),n}}const g=new o,v=new o,y={SPHERE:1,PLANE:2,BOX:4,COMPOUND:8,CONVEXPOLYHEDRON:16,HEIGHTFIELD:32,PARTICLE:64,CYLINDER:128,TRIMESH:256};class x{constructor(t){void 0===t&&(t={}),this.id=x.idCounter++,this.type=t.type||0,this.boundingSphereRadius=0,this.collisionResponse=!t.collisionResponse||t.collisionResponse,this.collisionFilterGroup=void 0!==t.collisionFilterGroup?t.collisionFilterGroup:1,this.collisionFilterMask=void 0!==t.collisionFilterMask?t.collisionFilterMask:-1,this.material=t.material?t.material:null,this.body=null}updateBoundingSphereRadius(){throw"computeBoundingSphereRadius() not implemented for shape type "+this.type}volume(){throw"volume() not implemented for shape type "+this.type}calculateLocalInertia(t,e){throw"calculateLocalInertia() not implemented for shape type "+this.type}calculateWorldAABB(t,e,i,n){throw"calculateWorldAABB() not implemented for shape type "+this.type}}x.idCounter=0,x.types=y;class w{constructor(t){void 0===t&&(t={}),this.position=new o,this.quaternion=new m,t.position&&this.position.copy(t.position),t.quaternion&&this.quaternion.copy(t.quaternion)}pointToLocal(t,e){return w.pointToLocalFrame(this.position,this.quaternion,t,e)}pointToWorld(t,e){return w.pointToWorldFrame(this.position,this.quaternion,t,e)}vectorToWorldFrame(t,e){return void 0===e&&(e=new o),this.quaternion.vmult(t,e),e}static pointToLocalFrame(t,e,i,n){return void 0===n&&(n=new o),i.vsub(t,n),e.conjugate(b),b.vmult(n,n),n}static pointToWorldFrame(t,e,i,n){return void 0===n&&(n=new o),e.vmult(i,n),n.vadd(t,n),n}static vectorToWorldFrame(t,e,i){return void 0===i&&(i=new o),t.vmult(e,i),i}static vectorToLocalFrame(t,e,i,n){return void 0===n&&(n=new o),e.w*=-1,e.vmult(i,n),e.w*=-1,n}}const b=new m;class A extends x{constructor(t){void 0===t&&(t={});const{vertices:e=[],faces:i=[],normals:n=[],axes:r,boundingSphereRadius:s}=t;super({type:x.types.CONVEXPOLYHEDRON}),this.vertices=e,this.faces=i,this.faceNormals=n,0===this.faceNormals.length&&this.computeNormals(),s?this.boundingSphereRadius=s:this.updateBoundingSphereRadius(),this.worldVertices=[],this.worldVerticesNeedsUpdate=!0,this.worldFaceNormals=[],this.worldFaceNormalsNeedsUpdate=!0,this.uniqueAxes=r?r.slice():null,this.uniqueEdges=[],this.computeEdges()}computeEdges(){const t=this.faces,e=this.vertices,i=this.uniqueEdges;i.length=0;const n=new o;for(let r=0;r!==t.length;r++){const s=t[r],o=s.length;for(let t=0;t!==o;t++){const r=(t+1)%o;e[s[t]].vsub(e[s[r]],n),n.normalize();let a=!1;for(let t=0;t!==i.length;t++)if(i[t].almostEquals(n)||i[t].almostEquals(n)){a=!0;break}a||i.push(n.clone())}}}computeNormals(){this.faceNormals.length=this.faces.length;for(let t=0;td&&(d=e,c=t)}const p=[];for(let t=0;t=0&&this.clipFaceAgainstHull(s,t,e,p,a,h,l)}findSeparatingAxis(t,e,i,n,r,s,a,h){const l=new o,u=new o,c=new o,d=new o,p=new o,f=new o;let m=Number.MAX_VALUE;const g=this;if(g.uniqueAxes)for(let o=0;o!==g.uniqueAxes.length;o++){i.vmult(g.uniqueAxes[o],l);const a=g.testSepAxis(l,t,e,i,n,r);if(!1===a)return!1;a0&&s.negate(s),!0}testSepAxis(t,e,i,n,r,s){A.project(this,t,i,n,T),A.project(e,t,r,s,S);const o=T[0],a=T[1],h=S[0],l=S[1];if(oe.x&&(e.x=r.x),r.ye.y&&(e.y=r.y),r.ze.z&&(e.z=r.z)}}computeWorldFaceNormals(t){const e=this.faceNormals.length;for(;this.worldFaceNormals.lengtht&&(t=n)}this.boundingSphereRadius=Math.sqrt(t)}calculateWorldAABB(t,e,i,n){const r=this.vertices;let s,a,h,l,u,c,d=new o;for(let i=0;il)&&(l=n.x),(void 0===a||n.yu)&&(u=n.y),(void 0===h||n.zc)&&(c=n.z)}i.set(s,a,h),n.set(l,u,c)}volume(){return 4*Math.PI*this.boundingSphereRadius/3}getAveragePointLocal(t){void 0===t&&(t=new o);const e=this.vertices;for(let i=0;i0||u>0&&d<0)return!1}return-1}static project(t,e,i,n,r){const s=t.vertices.length,o=E;let a=0,h=0;const l=M,u=t.vertices;l.setZero(),w.vectorToLocalFrame(i,n,e,o),w.pointToLocalFrame(i,n,l,l);const c=l.dot(o);h=a=u[0].dot(o);for(let t=1;ta&&(a=e),ea){const t=h;h=a,a=t}r[0]=a,r[1]=h}}const T=[],S=[],E=(new o,new o),M=new o;class _ extends x{constructor(t){super({type:x.types.BOX}),this.halfExtents=t,this.convexPolyhedronRepresentation=null,this.updateConvexPolyhedronRepresentation(),this.updateBoundingSphereRadius()}updateConvexPolyhedronRepresentation(){const t=this.halfExtents.x,e=this.halfExtents.y,i=this.halfExtents.z,n=o,r=[new n(-t,-e,-i),new n(t,-e,-i),new n(t,e,-i),new n(-t,e,-i),new n(-t,-e,i),new n(t,-e,i),new n(t,e,i),new n(-t,e,i)],s=[new n(0,0,1),new n(0,1,0),new n(1,0,0)],a=new A({vertices:r,faces:[[3,2,1,0],[4,5,6,7],[5,4,0,1],[2,3,7,6],[0,4,7,3],[1,2,6,5]],axes:s});this.convexPolyhedronRepresentation=a,a.material=this.material}calculateLocalInertia(t,e){return void 0===e&&(e=new o),_.calculateInertia(this.halfExtents,t,e),e}static calculateInertia(t,e,i){const n=t;i.x=1/12*e*(2*n.y*2*n.y+2*n.z*2*n.z),i.y=1/12*e*(2*n.x*2*n.x+2*n.z*2*n.z),i.z=1/12*e*(2*n.y*2*n.y+2*n.x*2*n.x)}getSideNormals(t,e){const i=t,n=this.halfExtents;if(i[0].set(n.x,0,0),i[1].set(0,n.y,0),i[2].set(0,0,n.z),i[3].set(-n.x,0,0),i[4].set(0,-n.y,0),i[5].set(0,0,-n.z),void 0!==e)for(let t=0;t!==i.length;t++)e.vmult(i[t],i[t]);return i}volume(){return 8*this.halfExtents.x*this.halfExtents.y*this.halfExtents.z}updateBoundingSphereRadius(){this.boundingSphereRadius=this.halfExtents.length()}forEachWorldCorner(t,e,i){const n=this.halfExtents,r=[[n.x,n.y,n.z],[-n.x,n.y,n.z],[-n.x,-n.y,n.z],[-n.x,-n.y,-n.z],[n.x,-n.y,-n.z],[n.x,n.y,-n.z],[-n.x,n.y,-n.z],[n.x,-n.y,n.z]];for(let n=0;nn.x&&(n.x=o),a>n.y&&(n.y=a),h>n.z&&(n.z=h),o0?1/e:0,this.material=t.material||null,this.linearDamping="number"==typeof t.linearDamping?t.linearDamping:.01,this.type=e<=0?O.STATIC:O.DYNAMIC,typeof t.type==typeof O.STATIC&&(this.type=t.type),this.allowSleep=void 0===t.allowSleep||t.allowSleep,this.sleepState=O.AWAKE,this.sleepSpeedLimit=void 0!==t.sleepSpeedLimit?t.sleepSpeedLimit:.1,this.sleepTimeLimit=void 0!==t.sleepTimeLimit?t.sleepTimeLimit:1,this.timeLastSleepy=0,this.wakeUpAfterNarrowphase=!1,this.torque=new o,this.quaternion=new m,this.initQuaternion=new m,this.previousQuaternion=new m,this.interpolatedQuaternion=new m,t.quaternion&&(this.quaternion.copy(t.quaternion),this.initQuaternion.copy(t.quaternion),this.previousQuaternion.copy(t.quaternion),this.interpolatedQuaternion.copy(t.quaternion)),this.angularVelocity=new o,t.angularVelocity&&this.angularVelocity.copy(t.angularVelocity),this.initAngularVelocity=new o,this.shapes=[],this.shapeOffsets=[],this.shapeOrientations=[],this.inertia=new o,this.invInertia=new o,this.invInertiaWorld=new r,this.invMassSolve=0,this.invInertiaSolve=new o,this.invInertiaWorldSolve=new r,this.fixedRotation=void 0!==t.fixedRotation&&t.fixedRotation,this.angularDamping=void 0!==t.angularDamping?t.angularDamping:.01,this.linearFactor=new o(1,1,1),t.linearFactor&&this.linearFactor.copy(t.linearFactor),this.angularFactor=new o(1,1,1),t.angularFactor&&this.angularFactor.copy(t.angularFactor),this.aabb=new u,this.aabbNeedsUpdate=!0,this.boundingRadius=0,this.wlambda=new o,this.isTrigger=Boolean(t.isTrigger),t.shape&&this.addShape(t.shape),this.updateMassProperties()}wakeUp(){const t=this.sleepState;this.sleepState=O.AWAKE,this.wakeUpAfterNarrowphase=!1,t===O.SLEEPING&&this.dispatchEvent(O.wakeupEvent)}sleep(){this.sleepState=O.SLEEPING,this.velocity.set(0,0,0),this.angularVelocity.set(0,0,0),this.wakeUpAfterNarrowphase=!1}sleepTick(t){if(this.allowSleep){const e=this.sleepState,i=this.velocity.lengthSquared()+this.angularVelocity.lengthSquared(),n=this.sleepSpeedLimit**2;e===O.AWAKE&&in?this.wakeUp():e===O.SLEEPY&&t-this.timeLastSleepy>this.sleepTimeLimit&&(this.sleep(),this.dispatchEvent(O.sleepEvent))}}updateSolveMassProperties(){this.sleepState===O.SLEEPING||this.type===O.KINEMATIC?(this.invMassSolve=0,this.invInertiaSolve.setZero(),this.invInertiaWorldSolve.setZero()):(this.invMassSolve=this.invMass,this.invInertiaSolve.copy(this.invInertia),this.invInertiaWorldSolve.copy(this.invInertiaWorld))}pointToLocalFrame(t,e){return void 0===e&&(e=new o),t.vsub(this.position,e),this.quaternion.conjugate().vmult(e,e),e}vectorToLocalFrame(t,e){return void 0===e&&(e=new o),this.quaternion.conjugate().vmult(t,e),e}pointToWorldFrame(t,e){return void 0===e&&(e=new o),this.quaternion.vmult(t,e),e.vadd(this.position,e),e}vectorToWorldFrame(t,e){return void 0===e&&(e=new o),this.quaternion.vmult(t,e),e}addShape(t,e,i){const n=new o,r=new m;return e&&n.copy(e),i&&r.copy(i),this.shapes.push(t),this.shapeOffsets.push(n),this.shapeOrientations.push(r),this.updateMassProperties(),this.updateBoundingRadius(),this.aabbNeedsUpdate=!0,t.body=this,this}removeShape(t){const e=this.shapes.indexOf(t);return-1===e||(this.shapes.splice(e,1),this.shapeOffsets.splice(e,1),this.shapeOrientations.splice(e,1),this.updateMassProperties(),this.updateBoundingRadius(),this.aabbNeedsUpdate=!0,t.body=null),this}updateBoundingRadius(){const t=this.shapes,e=this.shapeOffsets,i=t.length;let n=0;for(let r=0;r!==i;r++){const i=t[r];i.updateBoundingSphereRadius();const s=e[r].length(),o=i.boundingSphereRadius;s+o>n&&(n=s+o)}this.boundingRadius=n}updateAABB(){const t=this.shapes,e=this.shapeOffsets,i=this.shapeOrientations,n=t.length,r=D,s=B,o=this.quaternion,a=this.aabb,h=I;for(let l=0;l!==n;l++){const n=t[l];o.vmult(e[l],r),r.vadd(this.position,r),o.mult(i[l],s),n.calculateWorldAABB(r,s,h.lowerBound,h.upperBound),0===l?a.copy(h):a.extend(h)}this.aabbNeedsUpdate=!1}updateInertiaWorld(t){const e=this.invInertia;if(e.x!==e.y||e.y!==e.z||t){const t=F,i=k;t.setRotationFromQuaternion(this.quaternion),t.transpose(i),t.scale(e,t),t.mmult(i,this.invInertiaWorld)}else;}applyForce(t,e){if(void 0===e&&(e=new o),this.type!==O.DYNAMIC)return;this.sleepState===O.SLEEPING&&this.wakeUp();const i=N;e.cross(t,i),this.force.vadd(t,this.force),this.torque.vadd(i,this.torque)}applyLocalForce(t,e){if(void 0===e&&(e=new o),this.type!==O.DYNAMIC)return;const i=z,n=U;this.vectorToWorldFrame(t,i),this.vectorToWorldFrame(e,n),this.applyForce(i,n)}applyTorque(t){this.type===O.DYNAMIC&&(this.sleepState===O.SLEEPING&&this.wakeUp(),this.torque.vadd(t,this.torque))}applyImpulse(t,e){if(void 0===e&&(e=new o),this.type!==O.DYNAMIC)return;this.sleepState===O.SLEEPING&&this.wakeUp();const i=e,n=V;n.copy(t),n.scale(this.invMass,n),this.velocity.vadd(n,this.velocity);const r=H;i.cross(t,r),this.invInertiaWorld.vmult(r,r),this.angularVelocity.vadd(r,this.angularVelocity)}applyLocalImpulse(t,e){if(void 0===e&&(e=new o),this.type!==O.DYNAMIC)return;const i=G,n=W;this.vectorToWorldFrame(t,i),this.vectorToWorldFrame(e,n),this.applyImpulse(i,n)}updateMassProperties(){const t=Y;this.invMass=this.mass>0?1/this.mass:0;const e=this.inertia,i=this.fixedRotation;this.updateAABB(),t.set((this.aabb.upperBound.x-this.aabb.lowerBound.x)/2,(this.aabb.upperBound.y-this.aabb.lowerBound.y)/2,(this.aabb.upperBound.z-this.aabb.lowerBound.z)/2),_.calculateInertia(t,this.mass,e),this.invInertia.set(e.x>0&&!i?1/e.x:0,e.y>0&&!i?1/e.y:0,e.z>0&&!i?1/e.z:0),this.updateInertiaWorld(!0)}getVelocityAtWorldPoint(t,e){const i=new o;return t.vsub(this.position,i),this.angularVelocity.cross(i,e),this.velocity.vadd(e,e),e}integrate(t,e,i){if(this.previousPosition.copy(this.position),this.previousQuaternion.copy(this.quaternion),this.type!==O.DYNAMIC&&this.type!==O.KINEMATIC||this.sleepState===O.SLEEPING)return;const n=this.velocity,r=this.angularVelocity,s=this.position,o=this.force,a=this.torque,h=this.quaternion,l=this.invMass,u=this.invInertiaWorld,c=this.linearFactor,d=l*t;n.x+=o.x*d*c.x,n.y+=o.y*d*c.y,n.z+=o.z*d*c.z;const p=u.elements,f=this.angularFactor,m=a.x*f.x,g=a.y*f.y,v=a.z*f.z;r.x+=t*(p[0]*m+p[1]*g+p[2]*v),r.y+=t*(p[3]*m+p[4]*g+p[5]*v),r.z+=t*(p[6]*m+p[7]*g+p[8]*v),s.x+=n.x*t,s.y+=n.y*t,s.z+=n.z*t,h.integrate(this.angularVelocity,t,this.angularFactor,h),e&&(i?h.normalizeFast():h.normalize()),this.aabbNeedsUpdate=!0,this.updateInertiaWorld()}}O.idCounter=0,O.COLLIDE_EVENT_NAME="collide",O.DYNAMIC=R.DYNAMIC,O.STATIC=R.STATIC,O.KINEMATIC=R.KINEMATIC,O.AWAKE=L.AWAKE,O.SLEEPY=L.SLEEPY,O.SLEEPING=L.SLEEPING,O.wakeupEvent={type:"wakeup"},O.sleepyEvent={type:"sleepy"},O.sleepEvent={type:"sleep"};const D=new o,B=new m,I=new u,F=new r,k=new r,N=(new r,new o),z=new o,U=new o,V=new o,H=new o,G=new o,W=new o,Y=new o;class X{constructor(){this.world=null,this.useBoundingBoxes=!1,this.dirty=!0}collisionPairs(t,e,i){throw new Error("collisionPairs not implemented for this BroadPhase class!")}needBroadphaseCollision(t,e){return 0!=(t.collisionFilterGroup&e.collisionFilterMask)&&0!=(e.collisionFilterGroup&t.collisionFilterMask)&&(0==(t.type&O.STATIC)&&t.sleepState!==O.SLEEPING||0==(e.type&O.STATIC)&&e.sleepState!==O.SLEEPING)}intersectionTest(t,e,i,n){this.useBoundingBoxes?this.doBoundingBoxBroadphase(t,e,i,n):this.doBoundingSphereBroadphase(t,e,i,n)}doBoundingSphereBroadphase(t,e,i,n){const r=j;e.position.vsub(t.position,r);const s=(t.boundingRadius+e.boundingRadius)**2;r.lengthSquared()i.lengthSquared()}aabbQuery(t,e,i){return[]}}const j=new o;new o,new m,new o;const q={keys:[]},Q=[],K=[];new o;class J extends X{constructor(t,e,i,n,r){void 0===t&&(t=new o(100,100,100)),void 0===e&&(e=new o(-100,-100,-100)),void 0===i&&(i=10),void 0===n&&(n=10),void 0===r&&(r=10),super(),this.nx=i,this.ny=n,this.nz=r,this.aabbMin=t,this.aabbMax=e;const s=this.nx*this.ny*this.nz;if(s<=0)throw"GridBroadphase: Each dimension's n must be >0";this.bins=[],this.binLengths=[],this.bins.length=s,this.binLengths.length=s;for(let t=0;t=a&&(d=a-1),p<0?p=0:p>=h&&(p=h-1),f<0?f=0:f>=l&&(f=l-1),x<0?x=0:x>=a&&(x=a-1),A<0?A=0:A>=h&&(A=h-1),T<0?T=0:T>=l&&(T=l-1),d*=u,p*=c,f*=1,x*=u,A*=c,T*=1;for(let t=d;t<=x;t+=u)for(let e=p;e<=A;e+=c)for(let i=f;i<=T;i+=1){const n=t+e+i;P[n][R[n]++]=o}}for(let t=0;t!==n;t++){const e=r[t],i=e.shapes[0];switch(i.type){case _:{const t=i,n=e.position.x,r=e.position.y,s=e.position.z,o=t.radius;D(n-o,r-o,s-o,n+o,r+o,s+o,e);break}case C:{const t=i;t.worldNormalNeedsUpdate&&t.computeWorldNormal(e.quaternion);const n=t.worldNormal,r=m+.5*A-e.position.x,s=g+.5*T-e.position.y,o=v+.5*S-e.position.z,d=Z;d.set(r,s,o);for(let t=0,i=0;t!==a;t++,i+=u,d.y=s,d.x+=A)for(let t=0,r=0;t!==h;t++,r+=c,d.z=o,d.y+=T)for(let t=0,s=0;t!==l;t++,s+=1,d.z+=S)if(d.dot(n)1){const r=P[t];for(let t=0;t!==n;t++){const n=r[t];for(let s=0;s!==t;s++){const t=r[s];this.needBroadphaseCollision(n,t)&&this.intersectionTest(n,t,e,i)}}}}this.makePairsUnique(e,i)}}const Z=new o;new o;class $ extends X{constructor(){super()}collisionPairs(t,e,i){const n=t.bodies,r=n.length;let s,o;for(let t=0;t!==r;t++)for(let r=0;r!==t;r++)s=n[t],o=n[r],this.needBroadphaseCollision(s,o)&&this.intersectionTest(s,o,e,i)}aabbQuery(t,e,i){void 0===i&&(i=[]);for(let n=0;n{}}intersectWorld(t,e){return this.mode=e.mode||lt.ANY,this.result=e.result||new tt,this.skipBackfaces=!!e.skipBackfaces,this.collisionFilterMask=void 0!==e.collisionFilterMask?e.collisionFilterMask:-1,this.collisionFilterGroup=void 0!==e.collisionFilterGroup?e.collisionFilterGroup:-1,this.checkCollisionResponse=void 0===e.checkCollisionResponse||e.checkCollisionResponse,e.from&&this.from.copy(e.from),e.to&&this.to.copy(e.to),this.callback=e.callback||(()=>{}),this.hasHit=!1,this.result.reset(),this.updateDirection(),this.getAABB(ut),ct.length=0,t.broadphase.aabbQuery(t,ut,ct),this.intersectBodies(ct),this.hasHit}intersectBody(t,e){e&&(this.result=e,this.updateDirection());const i=this.checkCollisionResponse;if(i&&!t.collisionResponse)return;if(0==(this.collisionFilterGroup&t.collisionFilterMask)||0==(t.collisionFilterGroup&this.collisionFilterMask))return;const n=ft,r=mt;for(let e=0,s=t.shapes.length;et.boundingSphereRadius)return;const r=this[t.type];r&&r.call(this,t,e,i,n,t)}_intersectBox(t,e,i,n,r){return this._intersectConvex(t.convexPolyhedronRepresentation,e,i,n,r)}_intersectPlane(t,e,i,n,r){const s=this.from,a=this.to,h=this.direction,l=new o(0,0,1);e.vmult(l,l);const u=new o;s.vsub(i,u);const c=u.dot(l);a.vsub(i,u);if(c*u.dot(l)>0)return;if(s.distanceTo(a)=0&&t<=1&&(s.lerp(o,t,c),c.vsub(i,d),d.normalize(),this.reportIntersection(d,c,r,n,-1)),this.result.shouldStop)return;e>=0&&e<=1&&(s.lerp(o,e,c),c.vsub(i,d),d.normalize(),this.reportIntersection(d,c,r,n,-1))}}_intersectConvex(t,e,i,n,r,s){const o=Mt,a=_t,h=s&&s.faceList||null,l=t.faces,u=t.vertices,c=t.faceNormals,d=this.direction,p=this.from,f=this.to,m=p.distanceTo(f),g=h?h.length:l.length,v=this.result;for(let t=0;!v.shouldStop&&tm||this.reportIntersection(o,gt,r,n,s)}}}}_intersectTrimesh(t,e,i,n,r,s){const o=Ct,a=Bt,h=It,l=_t,u=Pt,c=Rt,d=Lt,p=Dt,f=Ot,m=t.indices;t.vertices;const g=this.from,v=this.to,y=this.direction;h.position.copy(i),h.quaternion.copy(e),w.vectorToLocalFrame(i,e,y,u),w.pointToLocalFrame(i,e,g,c),w.pointToLocalFrame(i,e,v,d),d.x*=t.scale.x,d.y*=t.scale.y,d.z*=t.scale.z,c.x*=t.scale.x,c.y*=t.scale.y,c.z*=t.scale.z,d.vsub(c,u),u.normalize();const x=c.distanceSquared(d);t.tree.rayQuery(this,h,a);for(let s=0,h=a.length;!this.result.shouldStop&&s!==h;s++){const h=a[s];t.getNormal(h,o),t.getVertex(m[3*h],vt),vt.vsub(c,l);const d=u.dot(o),g=o.dot(l)/d;if(g<0)continue;u.scale(g,gt),gt.vadd(c,gt),t.getVertex(m[3*h+1],yt),t.getVertex(m[3*h+2],xt);const v=gt.distanceSquared(c);!lt.pointInTriangle(gt,yt,vt,xt)&&!lt.pointInTriangle(gt,vt,yt,xt)||v>x||(w.vectorToWorldFrame(e,o,f),w.pointToWorldFrame(i,e,gt,p),this.reportIntersection(f,p,r,n,h))}a.length=0}reportIntersection(t,e,i,n,r){const s=this.from,o=this.to,a=s.distanceTo(e),h=this.result;if(!(this.skipBackfaces&&t.dot(this.direction)>0))switch(h.hitFaceIndex=void 0!==r?r:-1,this.mode){case lt.ALL:this.hasHit=!0,h.set(s,o,t,e,i,n,a),h.hasHit=!0,this.callback(h);break;case lt.CLOSEST:(a=0&&(u=r*h-s*o)>=0&&l+u=0&&!(t[n].aabb.lowerBound.x<=i.aabb.lowerBound.x);n--)t[n+1]=t[n];t[n+1]=i}return t}static insertionSortY(t){for(let e=1,i=t.length;e=0&&!(t[n].aabb.lowerBound.y<=i.aabb.lowerBound.y);n--)t[n+1]=t[n];t[n+1]=i}return t}static insertionSortZ(t){for(let e=1,i=t.length;e=0&&!(t[n].aabb.lowerBound.z<=i.aabb.lowerBound.z);n--)t[n+1]=t[n];t[n+1]=i}return t}constructor(t){super(),this.axisList=[],this.world=null,this.axisIndex=0;const e=this.axisList;this._addBodyHandler=t=>{e.push(t.body)},this._removeBodyHandler=t=>{const i=e.indexOf(t.body);-1!==i&&e.splice(i,1)},t&&this.setWorld(t)}setWorld(t){this.axisList.length=0;for(let e=0;eu?l>c?0:2:u>c?1:2}aabbQuery(t,e,i){void 0===i&&(i=[]),this.dirty&&(this.sortList(),this.dirty=!1);const n=this.axisIndex;let r="x";1===n&&(r="y"),2===n&&(r="z");const s=this.axisList;e.lowerBound[r],e.upperBound[r];for(let t=0;t=-.1)this.suspensionRelativeVelocity=0,this.clippedInvContactDotSuspension=10;else{const t=-1/i;this.suspensionRelativeVelocity=n*t,this.clippedInvContactDotSuspension=t}}else e.suspensionLength=this.suspensionRestLength,this.suspensionRelativeVelocity=0,e.directionWorld.scale(-1,e.hitNormalWorld),this.clippedInvContactDotSuspension=1}}const Fe=new o,ke=new o;class Ne{constructor(t){this.chassisBody=t.chassisBody,this.wheelInfos=[],this.sliding=!1,this.world=null,this.indexRightAxis=void 0!==t.indexRightAxis?t.indexRightAxis:2,this.indexForwardAxis=void 0!==t.indexForwardAxis?t.indexForwardAxis:0,this.indexUpAxis=void 0!==t.indexUpAxis?t.indexUpAxis:1,this.constraints=[],this.preStepCallback=()=>{},this.currentVehicleSpeedKmHour=0,this.numWheelsOnGround=0}addWheel(t){void 0===t&&(t={});const e=new Ie(t),i=this.wheelInfos.length;return this.wheelInfos.push(e),i}setSteeringValue(t,e){this.wheelInfos[e].steering=t}applyEngineForce(t,e){this.wheelInfos[e].engineForce=t}setBrake(t,e){this.wheelInfos[e].brake=t}addToWorld(t){t.addBody(this.chassisBody);const e=this;this.preStepCallback=()=>{e.updateVehicle(t.dt)},t.addEventListener("preStep",this.preStepCallback),this.world=t}getVehicleAxisWorld(t,e){e.set(0===t?1:0,1===t?1:0,2===t?1:0),this.chassisBody.vectorToWorldFrame(e,e)}updateVehicle(t){const e=this.wheelInfos,i=e.length,n=this.chassisBody;for(let t=0;ti.maxSuspensionForce&&(o=i.maxSuspensionForce),i.raycastResult.hitNormalWorld.scale(o*t,s),i.raycastResult.hitPointWorld.vsub(n.position,a),n.applyImpulse(s,a)}this.updateFriction(t);const h=new o,l=new o,u=new o;for(let r=0;r0?1:-1)*i.customSlidingRotationalSpeed*t),Math.abs(i.brake)>Math.abs(i.engineForce)&&(i.deltaRotation=0),i.rotation+=i.deltaRotation,i.deltaRotation*=.99}}updateSuspension(t){const e=this.chassisBody.mass,i=this.wheelInfos,n=i.length;for(let t=0;ts&&(t.suspensionLength=s,t.raycastResult.reset());const a=t.raycastResult.hitNormalWorld.dot(t.directionWorld),l=new o;n.getVelocityAtWorldPoint(t.raycastResult.hitPointWorld,l);const u=t.raycastResult.hitNormalWorld.dot(l);if(a>=-.1)t.suspensionRelativeVelocity=0,t.clippedInvContactDotSuspension=10;else{const e=-1/a;t.suspensionRelativeVelocity=u*e,t.clippedInvContactDotSuspension=e}}else t.suspensionLength=t.suspensionRestLength+0*t.maxSuspensionTravel,t.suspensionRelativeVelocity=0,t.directionWorld.scale(-1,t.raycastResult.hitNormalWorld),t.clippedInvContactDotSuspension=1;return r}updateWheelTransformWorld(t){t.isInContact=!1;const e=this.chassisBody;e.pointToWorldFrame(t.chassisConnectionPointLocal,t.chassisConnectionPointWorld),e.vectorToWorldFrame(t.directionLocal,t.directionWorld),e.vectorToWorldFrame(t.axleLocal,t.axleWorld)}updateWheelTransform(t){const e=ze,i=Ue,n=Ve,r=this.wheelInfos[t];this.updateWheelTransformWorld(r),r.directionLocal.scale(-1,e),i.copy(r.axleLocal),e.cross(i,n),n.normalize(),i.normalize();const s=r.steering,o=new m;o.setFromAxisAngle(e,s);const a=new m;a.setFromAxisAngle(i,r.rotation);const h=r.worldTransform.quaternion;this.chassisBody.quaternion.mult(o,h),h.mult(a,h),h.normalize();const l=r.worldTransform.position;l.copy(r.directionWorld),l.scale(r.suspensionLength,l),l.vadd(r.chassisConnectionPointWorld,l)}getWheelTransformWorld(t){return this.wheelInfos[t].worldTransform}updateFriction(t){const e=Ye,i=this.wheelInfos,n=i.length,r=this.chassisBody,s=je,a=Xe;this.numWheelsOnGround=0;for(let t=0;ti){this.sliding=!0,n.sliding=!0;const t=e/Math.sqrt(o);n.skidInfo*=t}}}if(this.sliding)for(let t=0;t1.1)return 0;const s=ri,o=si,a=oi;t.getVelocityAtWorldPoint(e,s),i.getVelocityAtWorldPoint(n,o),s.vsub(o,a);return-.2*r.dot(a)*(1/(t.invMass+i.invMass))}class hi extends x{constructor(t){if(super({type:x.types.SPHERE}),this.radius=void 0!==t?t:1,this.radius<0)throw new Error("The sphere radius cannot be negative.");this.updateBoundingSphereRadius()}calculateLocalInertia(t,e){void 0===e&&(e=new o);const i=2*t*this.radius*this.radius/5;return e.x=i,e.y=i,e.z=i,e}volume(){return 4*Math.PI*Math.pow(this.radius,3)/3}updateBoundingSphereRadius(){this.boundingSphereRadius=this.radius}calculateWorldAABB(t,e,i,n){const r=this.radius,s=["x","y","z"];for(let e=0;ethis.particles.length&&this.neighbors.pop())}getNeighbors(t,e){const i=this.particles.length,n=t.id,r=this.smoothingRadius*this.smoothingRadius,s=pi;for(let o=0;o!==i;o++){const i=this.particles[o];i.position.vsub(t.position,s),n!==i.id&&s.lengthSquared()e&&(e=r)}this.maxValue=e}setHeightValueAtIndex(t,e,i){this.data[t][e]=i,this.clearCachedConvexTrianglePillar(t,e,!1),t>0&&(this.clearCachedConvexTrianglePillar(t-1,e,!0),this.clearCachedConvexTrianglePillar(t-1,e,!1)),e>0&&(this.clearCachedConvexTrianglePillar(t,e-1,!0),this.clearCachedConvexTrianglePillar(t,e-1,!1)),e>0&&t>0&&this.clearCachedConvexTrianglePillar(t-1,e-1,!0)}getRectMinMax(t,e,i,n,r){void 0===r&&(r=[]);const s=this.data;let o=this.minValue;for(let r=t;r<=i;r++)for(let t=e;t<=n;t++){const e=s[r][t];e>o&&(o=e)}r[0]=this.minValue,r[1]=o}getIndexOfPosition(t,e,i,n){const r=this.elementSize,s=this.data;let o=Math.floor(t/r),a=Math.floor(e/r);return i[0]=o,i[1]=a,n&&(o<0&&(o=0),a<0&&(a=0),o>=s.length-1&&(o=s.length-1),a>=s[0].length-1&&(a=s[0].length-1)),!(o<0||a<0||o>=s.length-1||a>=s[0].length-1)}getTriangleAt(t,e,i,n,r,s){const o=Ei;this.getIndexOfPosition(t,e,o,i);let a=o[0],h=o[1];const l=this.data;i&&(a=Math.min(l.length-2,Math.max(0,a)),h=Math.min(l[0].length-2,Math.max(0,h)));const u=this.elementSize,c=(t/u-a)**2+(e/u-h)**2>(t/u-(a+1))**2+(e/u-(h+1))**2;return this.getTriangle(a,h,c,n,r,s),c}getNormalAt(t,e,i,n){const r=Ri,s=Li,o=Oi,a=Di,h=Bi;this.getTriangleAt(t,e,i,r,s,o),s.vsub(r,a),o.vsub(r,h),a.cross(h,n),n.normalize()}getAabbAtIndex(t,e,i){let{lowerBound:n,upperBound:r}=i;const s=this.data,o=this.elementSize;n.set(t*o,e*o,s[t][e]),r.set((t+1)*o,(e+1)*o,s[t+1][e+1])}getHeightAt(t,e,i){const n=this.data,r=_i,s=Ci,o=Pi,a=Ei;this.getIndexOfPosition(t,e,a,i);let h=a[0],l=a[1];i&&(h=Math.min(n.length-2,Math.max(0,h)),l=Math.min(n[0].length-2,Math.max(0,l)));const u=this.getTriangleAt(t,e,i,r,s,o);!function(t,e,i,n,r,s,o,a,h){h.x=((s-a)*(t-o)+(o-r)*(e-a))/((s-a)*(i-o)+(o-r)*(n-a)),h.y=((a-n)*(t-o)+(i-o)*(e-a))/((s-a)*(i-o)+(o-r)*(n-a)),h.z=1-h.x-h.y}(t,e,r.x,r.y,s.x,s.y,o.x,o.y,Mi);const c=Mi;return u?n[h+1][l+1]*c.x+n[h][l+1]*c.y+n[h+1][l]*c.z:n[h][l]*c.x+n[h+1][l]*c.y+n[h][l+1]*c.z}getCacheConvexTrianglePillarKey(t,e,i){return`${t}_${e}_${i?1:0}`}getCachedConvexTrianglePillar(t,e,i){return this._cachedPillars[this.getCacheConvexTrianglePillarKey(t,e,i)]}setCachedConvexTrianglePillar(t,e,i,n,r){this._cachedPillars[this.getCacheConvexTrianglePillarKey(t,e,i)]={convex:n,offset:r}}clearCachedConvexTrianglePillar(t,e,i){delete this._cachedPillars[this.getCacheConvexTrianglePillarKey(t,e,i)]}getTriangle(t,e,i,n,r,s){const o=this.data,a=this.elementSize;i?(n.set((t+1)*a,(e+1)*a,o[t+1][e+1]),r.set(t*a,(e+1)*a,o[t][e+1]),s.set((t+1)*a,e*a,o[t+1][e])):(n.set(t*a,e*a,o[t][e]),r.set((t+1)*a,e*a,o[t+1][e]),s.set(t*a,(e+1)*a,o[t][e+1]))}getConvexTrianglePillar(t,e,i){let n=this.pillarConvex,r=this.pillarOffset;if(this.cacheEnabled){const s=this.getCachedConvexTrianglePillar(t,e,i);if(s)return this.pillarConvex=s.convex,void(this.pillarOffset=s.offset);n=new A,r=new o,this.pillarConvex=n,this.pillarOffset=r}const s=this.data,a=this.elementSize,h=n.faces;n.vertices.length=6;for(let t=0;t<6;t++)n.vertices[t]||(n.vertices[t]=new o);h.length=5;for(let t=0;t<5;t++)h[t]||(h[t]=[]);const l=n.vertices,u=(Math.min(s[t][e],s[t+1][e],s[t][e+1],s[t+1][e+1])-this.minValue)/2+this.minValue;i?(r.set((t+.75)*a,(e+.75)*a,u),l[0].set(.25*a,.25*a,s[t+1][e+1]-u),l[1].set(-.75*a,.25*a,s[t][e+1]-u),l[2].set(.25*a,-.75*a,s[t+1][e]-u),l[3].set(.25*a,.25*a,-Math.abs(u)-1),l[4].set(-.75*a,.25*a,-Math.abs(u)-1),l[5].set(.25*a,-.75*a,-Math.abs(u)-1),h[0][0]=0,h[0][1]=1,h[0][2]=2,h[1][0]=5,h[1][1]=4,h[1][2]=3,h[2][0]=2,h[2][1]=5,h[2][2]=3,h[2][3]=0,h[3][0]=3,h[3][1]=4,h[3][2]=1,h[3][3]=0,h[4][0]=1,h[4][1]=4,h[4][2]=5,h[4][3]=2):(r.set((t+.25)*a,(e+.25)*a,u),l[0].set(-.25*a,-.25*a,s[t][e]-u),l[1].set(.75*a,-.25*a,s[t+1][e]-u),l[2].set(-.25*a,.75*a,s[t][e+1]-u),l[3].set(-.25*a,-.25*a,-Math.abs(u)-1),l[4].set(.75*a,-.25*a,-Math.abs(u)-1),l[5].set(-.25*a,.75*a,-Math.abs(u)-1),h[0][0]=0,h[0][1]=1,h[0][2]=2,h[1][0]=5,h[1][1]=4,h[1][2]=3,h[2][0]=0,h[2][1]=2,h[2][2]=5,h[2][3]=3,h[3][0]=1,h[3][1]=0,h[3][2]=3,h[3][3]=4,h[4][0]=4,h[4][1]=5,h[4][2]=2,h[4][3]=1),n.computeNormals(),n.computeEdges(),n.updateBoundingSphereRadius(),this.setCachedConvexTrianglePillar(t,e,i,n,r)}calculateLocalInertia(t,e){return void 0===e&&(e=new o),e.set(0,0,0),e}volume(){return Number.MAX_VALUE}calculateWorldAABB(t,e,i,n){i.set(-Number.MAX_VALUE,-Number.MAX_VALUE,-Number.MAX_VALUE),n.set(Number.MAX_VALUE,Number.MAX_VALUE,Number.MAX_VALUE)}updateBoundingSphereRadius(){const t=this.data,e=this.elementSize;this.boundingSphereRadius=new o(t.length*e,t[0].length*e,Math.max(Math.abs(this.maxValue),Math.abs(this.minValue))).length()}setHeightsFromImage(t,e){const{x:i,z:n,y:r}=e,s=document.createElement("canvas");s.width=t.width,s.height=t.height;const o=s.getContext("2d");o.drawImage(t,0,0);const a=o.getImageData(0,0,t.width,t.height),h=this.data;h.length=0,this.elementSize=Math.abs(i)/a.width;for(let t=0;t=0;t--)this.children[t].removeEmptyNodes(),this.children[t].children.length||this.children[t].data.length||this.children.splice(t,1)}}class Fi extends Ii{constructor(t,e){void 0===e&&(e={}),super({root:null,aabb:t}),this.maxDepth=void 0!==e.maxDepth?e.maxDepth:8}}const ki=new o,Ni=new u;class zi extends x{constructor(t,e){super({type:x.types.TRIMESH}),this.vertices=new Float32Array(t),this.indices=new Int16Array(e),this.normals=new Float32Array(e.length),this.aabb=new u,this.edges=null,this.scale=new o(1,1,1),this.tree=new Fi,this.updateEdges(),this.updateNormals(),this.updateAABB(),this.updateBoundingSphereRadius(),this.updateTree()}updateTree(){const t=this.tree;t.reset(),t.aabb.copy(this.aabb);const e=this.scale;t.aabb.lowerBound.x*=1/e.x,t.aabb.lowerBound.y*=1/e.y,t.aabb.lowerBound.z*=1/e.z,t.aabb.upperBound.x*=1/e.x,t.aabb.upperBound.y*=1/e.y,t.aabb.upperBound.z*=1/e.z;const i=new u,n=new o,r=new o,s=new o,a=[n,r,s];for(let e=0;e{t[ei.x&&(i.x=r.x),r.yi.y&&(i.y=r.y),r.zi.z&&(i.z=r.z)}updateAABB(){this.computeLocalAABB(this.aabb)}updateBoundingSphereRadius(){let t=0;const e=this.vertices,i=new o;for(let n=0,r=e.length/3;n!==r;n++){this.getVertex(n,i);const e=i.lengthSquared();e>t&&(t=e)}this.boundingSphereRadius=Math.sqrt(t)}calculateWorldAABB(t,e,i,n){const r=Ji,s=Zi;r.position=t,r.quaternion=e,this.aabb.toWorldFrame(r,s),i.copy(s.lowerBound),n.copy(s.upperBound)}volume(){return 4*Math.PI*this.boundingSphereRadius/3}static createTorus(t,e,i,n,r){void 0===t&&(t=1),void 0===e&&(e=.5),void 0===i&&(i=8),void 0===n&&(n=6),void 0===r&&(r=2*Math.PI);const s=[],o=[];for(let o=0;o<=i;o++)for(let a=0;a<=n;a++){const h=a/n*r,l=o/i*Math.PI*2,u=(t+e*Math.cos(l))*Math.cos(h),c=(t+e*Math.cos(l))*Math.sin(h),d=e*Math.sin(l);s.push(u,c,d)}for(let t=1;t<=i;t++)for(let e=1;e<=n;e++){const i=(n+1)*t+e-1,r=(n+1)*(t-1)+e-1,s=(n+1)*(t-1)+e,a=(n+1)*t+e;o.push(i,r,a),o.push(r,s,a)}return new zi(s,o)}}const Ui=new o,Vi=new u,Hi=new o,Gi=new o,Wi=new o,Yi=new o,Xi=new o,ji=new o,qi=new o,Qi=new u,Ki=new o,Ji=new w,Zi=new u;class $i{constructor(){this.equations=[]}solve(t,e){return 0}addEquation(t){!t.enabled||t.bi.isTrigger||t.bj.isTrigger||this.equations.push(t)}removeEquation(t){const e=this.equations,i=e.indexOf(t);-1!==i&&e.splice(i,1)}removeAllEquations(){this.equations.length=0}}class tn extends $i{constructor(){super(),this.iterations=10,this.tolerance=1e-7}solve(t,e){let i=0;const n=this.iterations,r=this.tolerance*this.tolerance,s=this.equations,o=s.length,a=e.bodies,h=a.length,l=t;let u,c,d,p,f,m;if(0!==o)for(let t=0;t!==h;t++)a[t].updateSolveMassProperties();const g=nn,v=rn,y=en;g.length=o,v.length=o,y.length=o;for(let t=0;t!==o;t++){const e=s[t];y[t]=0,v[t]=e.computeB(l),g[t]=1/e.computeC()}if(0!==o){for(let t=0;t!==h;t++){const e=a[t],i=e.vlambda,n=e.wlambda;i.set(0,0,0),n.set(0,0,0)}for(i=0;i!==n;i++){p=0;for(let t=0;t!==o;t++){const e=s[t];u=v[t],c=g[t],m=y[t],f=e.computeGWlambda(),d=c*(u-f-e.eps*m),m+de.maxForce&&(d=e.maxForce-m),y[t]+=d,p+=d>0?d:-d,e.addToWlambda(d)}if(p*pt;)e.pop();for(;e.length=0&&l.restitution>=0&&(o.restitution=h.restitution*l.restitution),o.si=r||i,o.sj=s||n,o}createFrictionEquationsFromContact(t,e){const i=t.bi,n=t.bj,r=t.si,s=t.sj,o=this.world,a=this.currentContactMaterial;let h=a.friction;const l=r.material||i.material,u=s.material||n.material;if(l&&u&&l.friction>=0&&u.friction>=0&&(h=l.friction*u.friction),h>0){const r=h*o.gravity.length();let s=i.invMass+n.invMass;s>0&&(s=1/s);const l=this.frictionEquationPool,u=l.length?l.pop():new ye(i,n,r*s),c=l.length?l.pop():new ye(i,n,r*s);return u.bi=c.bi=i,u.bj=c.bj=n,u.minForce=c.minForce=-r*s,u.maxForce=c.maxForce=r*s,u.ri.copy(t.ri),u.rj.copy(t.rj),c.ri.copy(t.ri),c.rj.copy(t.rj),t.ni.tangents(u.t,c.t),u.setSpookParams(a.frictionEquationStiffness,a.frictionEquationRelaxation,o.dt),c.setSpookParams(a.frictionEquationStiffness,a.frictionEquationRelaxation,o.dt),u.enabled=c.enabled=t.enabled,e.push(u,c),!0}return!1}createFrictionFromAverage(t){let e=this.result[this.result.length-1];if(!this.createFrictionEquationsFromContact(e,this.frictionResult)||1===t)return;const i=this.frictionResult[this.frictionResult.length-2],n=this.frictionResult[this.frictionResult.length-1];xn.setZero(),wn.setZero(),bn.setZero();const r=e.bi;e.bj;for(let i=0;i!==t;i++)e=this.result[this.result.length-1-i],e.bi!==r?(xn.vadd(e.ni,xn),wn.vadd(e.ri,wn),bn.vadd(e.rj,bn)):(xn.vsub(e.ni,xn),wn.vadd(e.rj,wn),bn.vadd(e.ri,bn));const s=1/t;wn.scale(s,i.ri),bn.scale(s,i.rj),n.ri.copy(i.ri),n.rj.copy(i.rj),xn.normalize(),xn.tangents(i.t,n.t)}getContacts(t,e,i,n,r,s,o){this.contactPointPool=r,this.frictionEquationPool=o,this.result=n,this.frictionResult=s;const a=Sn,h=En,l=An,u=Tn;for(let n=0,r=t.length;n!==r;n++){const r=t[n],s=e[n];let o=null;r.material&&s.material&&(o=i.getContactMaterial(r.material,s.material)||null);const c=r.type&O.KINEMATIC&&s.type&O.STATIC||r.type&O.STATIC&&s.type&O.KINEMATIC||r.type&O.KINEMATIC&&s.type&O.KINEMATIC;for(let t=0;te.boundingSphereRadius+n.boundingSphereRadius)continue;let d=null;e.material&&n.material&&(d=i.getContactMaterial(e.material,n.material)||null),this.currentContactMaterial=d||o||i.defaultContactMaterial;const p=this[e.type|n.type];if(p){let t=!1;t=e.type0){const r=Zn,s=$n;r.copy(d[(t+1)%3]),s.copy(d[(t+2)%3]);const o=r.length(),a=s.length();r.normalize(),s.normalize();const h=Kn.dot(r),l=Kn.dot(s);if(h-o&&l-a){const t=Math.abs(n-i-p);if((null===A||tt.boundingSphereRadius+e.boundingSphereRadius)&&t.findSeparatingAxis(e,i,r,n,s,p,c,d)){const c=[],d=wr;t.clipAgainstHull(i,r,e,n,s,p,-100,100,c);let f=0;for(let r=0;r!==c.length;r++){if(u)return!0;const s=this.createContactEquation(o,a,t,e,h,l),m=s.ri,g=s.rj;p.negate(s.ni),c[r].normal.negate(d),d.scale(c[r].depth,d),c[r].point.vadd(d,m),g.copy(c[r].point),m.vsub(i,m),g.vsub(n,g),m.vadd(i,m),m.vsub(o.position,m),g.vadd(n,g),g.vsub(a.position,g),this.result.push(s),f++,this.enableFrictionReduction||this.createFrictionEquationsFromContact(s,this.frictionResult)}this.enableFrictionReduction&&f&&this.createFrictionFromAverage(f)}}sphereConvex(t,e,i,n,r,s,o,a,h,l,u){const c=this.v3pool;i.vsub(n,sr);const d=e.faceNormals,p=e.faces,f=e.vertices,m=t.radius;let g=!1;for(let r=0;r!==f.length;r++){const c=f[r],d=lr;s.vmult(c,d),n.vadd(d,d);const p=hr;if(d.vsub(i,p),p.lengthSquared()0){const r=[];for(let t=0,e=y.length;t!==e;t++){const e=c.get();s.vmult(f[y[t]],e),n.vadd(e,e),r.push(e)}if(Qn(r,x,i)){if(u)return!0;g=!0;const s=this.createContactEquation(o,a,t,e,h,l);x.scale(-m,s.ri),x.negate(s.ni);const d=c.get();x.scale(-T,d);const p=c.get();x.scale(-m,p),i.vsub(n,s.rj),s.rj.vadd(p,s.rj),s.rj.vadd(d,s.rj),s.rj.vadd(n,s.rj),s.rj.vsub(a.position,s.rj),s.ri.vadd(i,s.ri),s.ri.vsub(o.position,s.ri),c.release(d),c.release(p),this.result.push(s),this.createFrictionEquationsFromContact(s,this.frictionResult);for(let t=0,e=r.length;t!==e;t++)c.release(r[t]);return}for(let d=0;d!==y.length;d++){const p=c.get(),g=c.get();s.vmult(f[y[(d+1)%y.length]],p),s.vmult(f[y[(d+2)%y.length]],g),n.vadd(p,p),n.vadd(g,g);const v=or;g.vsub(p,v);const x=ar;v.unit(x);const w=c.get(),b=c.get();i.vsub(p,b);const A=b.dot(x);x.scale(A,w),w.vadd(p,w);const T=c.get();if(w.vsub(i,T),A>0&&A*Ac.length||y>c[0].length)return;g<0&&(g=0),v<0&&(v=0),y<0&&(y=0),x<0&&(x=0),g>=c.length&&(g=c.length-1),v>=c.length&&(v=c.length-1),x>=c[0].length&&(x=c[0].length-1),y>=c[0].length&&(y=c[0].length-1);const b=[];e.getRectMinMax(g,y,v,x,b);const A=b[0],T=b[1];if(m.z-d>T||m.z+d2)return}}boxHeightfield(t,e,i,n,r,s,o,a,h,l,u){return t.convexPolyhedronRepresentation.material=t.material,t.convexPolyhedronRepresentation.collisionResponse=t.collisionResponse,this.convexHeightfield(t.convexPolyhedronRepresentation,e,i,n,r,s,o,a,t,e,u)}convexHeightfield(t,e,i,n,r,s,o,a,h,l,u){const c=e.data,d=e.elementSize,p=t.boundingSphereRadius,f=Lr,m=Or,g=Rr;w.pointToLocalFrame(n,s,i,g);let v=Math.floor((g.x-p)/d)-1,y=Math.ceil((g.x+p)/d)+1,x=Math.floor((g.y-p)/d)-1,b=Math.ceil((g.y+p)/d)+1;if(y<0||b<0||v>c.length||x>c[0].length)return;v<0&&(v=0),y<0&&(y=0),x<0&&(x=0),b<0&&(b=0),v>=c.length&&(v=c.length-1),y>=c.length&&(y=c.length-1),b>=c[0].length&&(b=c[0].length-1),x>=c[0].length&&(x=c[0].length-1);const A=[];e.getRectMinMax(v,x,y,b,A);const T=A[0],S=A[1];if(!(g.z-p>S||g.z+p0&&y<0){m.vsub(c,g),f.copy(p),f.normalize(),x=g.dot(f),f.scale(x,g),g.vadd(c,g);if(g.distanceTo(m)0&&!0===n||u<=0&&!1===n))return!1;null===n&&(n=u>0)}return!0}const Kn=new o,Jn=new o,Zn=new o,$n=new o,tr=[new o,new o,new o,new o,new o,new o],er=new o,ir=new o,nr=new o,rr=new o,sr=new o,or=new o,ar=new o,hr=new o,lr=new o,ur=new o,cr=new o,dr=new o,pr=new o,fr=new o;new o,new o;const mr=new o,gr=new o,vr=new o,yr=new o,xr=new o,wr=new o,br=new o,Ar=new o,Tr=new o,Sr=new o,Er=new m,Mr=new o;new o;const _r=new o,Cr=new o,Pr=new o,Rr=new o,Lr=new o,Or=[0],Dr=new o,Br=new o;class Ir{constructor(){this.current=[],this.previous=[]}getKey(t,e){if(en[r];)r++;if(i!==n[r]){for(let t=n.length-1;t>=r;t--)n[t+1]=n[t];n[r]=i}}tick(){const t=this.current;this.current=this.previous,this.previous=t,this.current.length=0}getDiff(t,e){const i=this.current,n=this.previous,r=i.length,s=n.length;let o=0;for(let e=0;en[o];)o++;r=s===n[o],r||Fr(t,s)}o=0;for(let t=0;ti[o];)o++;r=i[o]===s,r||Fr(e,s)}}}function Fr(t,e){t.push((4294901760&e)>>16,65535&e)}const kr=(t,e)=>t0;){delete t[e.pop()]}}}class zr extends f{constructor(t){void 0===t&&(t={}),super(),this.dt=-1,this.allowSleep=!!t.allowSleep,this.contacts=[],this.frictionEquations=[],this.quatNormalizeSkip=void 0!==t.quatNormalizeSkip?t.quatNormalizeSkip:0,this.quatNormalizeFast=void 0!==t.quatNormalizeFast&&t.quatNormalizeFast,this.time=0,this.stepnumber=0,this.default_dt=1/60,this.nextId=0,this.gravity=new o,t.gravity&&this.gravity.copy(t.gravity),this.broadphase=void 0!==t.broadphase?t.broadphase:new $,this.bodies=[],this.hasActiveBodies=!1,this.solver=void 0!==t.solver?t.solver:new tn,this.constraints=[],this.narrowphase=new yn(this),this.collisionMatrix=new p,this.collisionMatrixPrevious=new p,this.bodyOverlapKeeper=new Ir,this.shapeOverlapKeeper=new Ir,this.contactmaterials=[],this.contactMaterialTable=new Nr,this.defaultMaterial=new Ae("default"),this.defaultContactMaterial=new be(this.defaultMaterial,this.defaultMaterial,{friction:.3,restitution:0}),this.doProfiling=!1,this.profile={solve:0,makeContactConstraints:0,broadphase:0,integrate:0,narrowphase:0},this.accumulator=0,this.subsystems=[],this.addBodyEvent={type:"addBody",body:null},this.removeBodyEvent={type:"removeBody",body:null},this.idToBodyMap={},this.broadphase.setWorld(this)}getContactMaterial(t,e){return this.contactMaterialTable.get(t.id,e.id)}collisionMatrixTick(){const t=this.collisionMatrixPrevious;this.collisionMatrixPrevious=this.collisionMatrix,this.collisionMatrix=t,this.collisionMatrix.reset(),this.bodyOverlapKeeper.tick(),this.shapeOverlapKeeper.tick()}addConstraint(t){this.constraints.push(t)}removeConstraint(t){const e=this.constraints.indexOf(t);-1!==e&&this.constraints.splice(e,1)}rayTest(t,e,i){i instanceof tt?this.raycastClosest(t,e,{skipBackfaces:!0},i):this.raycastAll(t,e,{skipBackfaces:!0},i)}raycastAll(t,e,i,n){return void 0===i&&(i={}),i.mode=lt.ALL,i.from=t,i.to=e,i.callback=n,Ur.intersectWorld(this,i)}raycastAny(t,e,i,n){return void 0===i&&(i={}),i.mode=lt.ANY,i.from=t,i.to=e,i.result=n,Ur.intersectWorld(this,i)}raycastClosest(t,e,i,n){return void 0===i&&(i={}),i.mode=lt.CLOSEST,i.from=t,i.to=e,i.result=n,Ur.intersectWorld(this,i)}addBody(t){this.bodies.includes(t)||(t.index=this.bodies.length,this.bodies.push(t),t.world=this,t.initPosition.copy(t.position),t.initVelocity.copy(t.velocity),t.timeLastSleepy=this.time,t instanceof O&&(t.initAngularVelocity.copy(t.angularVelocity),t.initQuaternion.copy(t.quaternion)),this.collisionMatrix.setNumObjects(this.bodies.length),this.addBodyEvent.body=t,this.idToBodyMap[t.id]=t,this.dispatchEvent(this.addBodyEvent))}removeBody(t){t.world=null;const e=this.bodies.length-1,i=this.bodies,n=i.indexOf(t);if(-1!==n){i.splice(n,1);for(let t=0;t!==i.length;t++)i[t].index=t;this.collisionMatrix.setNumObjects(e),this.removeBodyEvent.body=t,delete this.idToBodyMap[t.id],this.dispatchEvent(this.removeBodyEvent)}}getBodyById(t){return this.idToBodyMap[t]}getShapeById(t){const e=this.bodies;for(let i=0;i=t&&r1e3*t)););this.accumulator=this.accumulator%t;const s=this.accumulator/t;for(let t=0;t!==this.bodies.length;t++){const e=this.bodies[t];e.previousPosition.lerp(e.position,s,e.interpolatedPosition),e.previousQuaternion.slerp(e.quaternion,s,e.interpolatedQuaternion),e.previousQuaternion.normalize()}this.time+=e}}internalStep(t){this.dt=t;const e=this.contacts,i=jr,n=qr,r=this.bodies.length,s=this.bodies,o=this.solver,a=this.gravity,h=this.doProfiling,l=this.profile,u=O.DYNAMIC;let c=-1/0;const d=this.constraints,p=Xr;a.length();const f=a.x,m=a.y,g=a.z;let v=0;for(h&&(c=Vr.now()),v=0;v!==r;v++){const t=s[v];if(t.type===u){const e=t.force,i=t.mass;e.x+=i*f,e.y+=i*m,e.z+=i*g}}for(let t=0,e=this.subsystems.length;t!==e;t++)this.subsystems[t].update();h&&(c=Vr.now()),i.length=0,n.length=0,this.broadphase.collisionPairs(this,i,n),h&&(l.broadphase=Vr.now()-c);let y=d.length;for(v=0;v!==y;v++){const t=d[v];if(!t.collideConnected)for(let e=i.length-1;e>=0;e-=1)(t.bodyA===i[e]&&t.bodyB===n[e]||t.bodyB===i[e]&&t.bodyA===n[e])&&(i.splice(e,1),n.splice(e,1))}this.collisionMatrixTick(),h&&(c=Vr.now());const x=Yr,w=e.length;for(v=0;v!==w;v++)x.push(e[v]);e.length=0;const b=this.frictionEquations.length;for(v=0;v!==b;v++)p.push(this.frictionEquations[v]);for(this.frictionEquations.length=0,this.narrowphase.getContacts(i,n,this,e,x,this.frictionEquations,p),h&&(l.narrowphase=Vr.now()-c),h&&(c=Vr.now()),v=0;v=0&&r.material.friction>=0&&(n.material.friction,r.material.friction),n.material.restitution>=0&&r.material.restitution>=0&&(i.restitution=n.material.restitution*r.material.restitution)),o.addEquation(i),n.allowSleep&&n.type===O.DYNAMIC&&n.sleepState===O.SLEEPING&&r.sleepState===O.AWAKE&&r.type!==O.STATIC){r.velocity.lengthSquared()+r.angularVelocity.lengthSquared()>=2*r.sleepSpeedLimit**2&&(n.wakeUpAfterNarrowphase=!0)}if(r.allowSleep&&r.type===O.DYNAMIC&&r.sleepState===O.SLEEPING&&n.sleepState===O.AWAKE&&n.type!==O.STATIC){n.velocity.lengthSquared()+n.angularVelocity.lengthSquared()>=2*n.sleepSpeedLimit**2&&(r.wakeUpAfterNarrowphase=!0)}this.collisionMatrix.set(n,r,!0),this.collisionMatrixPrevious.get(n,r)||(Wr.body=r,Wr.contact=i,n.dispatchEvent(Wr),Wr.body=n,r.dispatchEvent(Wr)),this.bodyOverlapKeeper.set(n.id,r.id),this.shapeOverlapKeeper.set(s.id,a.id)}for(this.emitContactEvents(),h&&(l.makeContactConstraints=Vr.now()-c,c=Vr.now()),v=0;v!==r;v++){const t=s[v];t.wakeUpAfterNarrowphase&&(t.wakeUp(),t.wakeUpAfterNarrowphase=!1)}for(y=d.length,v=0;v!==y;v++){const t=d[v];t.update();for(let e=0,i=t.equations.length;e!==i;e++){const i=t.equations[e];o.addEquation(i)}}o.solve(t,this),h&&(l.solve=Vr.now()-c),o.removeAllEquations();const T=Math.pow;for(v=0;v!==r;v++){const e=s[v];if(e.type&u){const i=T(1-e.linearDamping,t),n=e.velocity;n.scale(i,n);const r=e.angularVelocity;if(r){const i=T(1-e.angularDamping,t);r.scale(i,r)}}}this.dispatchEvent(Gr),h&&(c=Vr.now());const S=this.stepnumber%(this.quatNormalizeSkip+1)==0,E=this.quatNormalizeFast;for(v=0;v!==r;v++)s[v].integrate(t,S,E);this.clearForces(),this.broadphase.dirty=!0,h&&(l.integrate=Vr.now()-c),this.stepnumber+=1,this.dispatchEvent(Hr);let M=!0;if(this.allowSleep)for(M=!1,v=0;v!==r;v++){const t=s[v];t.sleepTick(this.time),t.sleepState!==O.SLEEPING&&(M=!0)}this.hasActiveBodies=M}emitContactEvents(){const t=this.hasAnyEventListener("beginContact"),e=this.hasAnyEventListener("endContact");if((t||e)&&this.bodyOverlapKeeper.getDiff(Qr,Kr),t){for(let t=0,e=Qr.length;tDate.now()-t}new o;const Hr={type:"postStep"},Gr={type:"preStep"},Wr={type:O.COLLIDE_EVENT_NAME,body:null,contact:null},Yr=[],Xr=[],jr=[],qr=[],Qr=[],Kr=[],Jr={type:"beginContact",bodyA:null,bodyB:null},Zr={type:"endContact",bodyA:null,bodyB:null},$r={type:"beginShapeContact",bodyA:null,bodyB:null,shapeA:null,shapeB:null},ts={type:"endShapeContact",bodyA:null,bodyB:null,shapeA:null,shapeB:null}},function(t,e,i){"use strict";var n=i(1),r=i(24),s=i(2),o=i(7),a=i(0),h=i(45),l=i(27);function u(t,e){for(var i=0;i0&&void 0!==arguments[0]&&arguments[0];this.setState(this.stateManager.IntroState,t)}},{key:"setState",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];(t!==this.currentState||e)&&(this.currentState&&this.currentState.onExit(),this.currentState=t,this.currentState.onEnter())}},{key:"calculateScore",value:function(t,e,i){var n=e*(300-i)*t;return n=Math.round(n)}},{key:"update",value:function(t){this.currentState&&this.currentState.onUpdate(t);for(var e=0;e1&&void 0!==arguments[1]?arguments[1]:{},n=i.recycle,r=void 0===n||n;t.GameObjects.push(e),r||(e.noRecycle=!0)}},{key:"removeFromUpdate",value:function(t){o.a.removeItemFromArray(this.GameObjects,t)}},{key:"timeOutCallback",value:function(){this.gameEnded||(t.gameEnded=!0,this.gameOverState=this.GameOverStates.TIME_OUT,t.setState(t.stateManager.EndingState))}},{key:"levelWinCallback",value:function(){this.gameEnded||(t.gameEnded=!0,this.gameOverState=this.GameOverStates.WIN,t.setState(t.stateManager.EndingState))}},{key:"levelFailedCallback",value:function(){this.gameEnded||(t.gameEnded=!0,app.playSfx("Fail"),this.gameOverState=this.GameOverStates.GAME_OVER,t.setState(t.stateManager.EndingState))}},{key:"checkGameFinishedEvents",value:function(){this.gameOverState===this.GameOverStates.WIN?n.a.gameTotallyFinished=!0:this.runCount-1>=n.a.data.maxRetryLimit&&(this.gameOverState,this.GameOverStates.TIME_OUT,n.a.gameTotallyFinished=!0)}}],(i=null)&&l(e.prototype,i),u&&l(e,u),Object.defineProperty(e,"prototype",{writable:!1}),t}()},function(t,e,i){"use strict";i.d(e,"a",(function(){return v}));var n=i(4),r=i(0),s=i(7),o=i(1),a=i(8),h=i(30),l=i(36),u=i(3),c=i(29),d=i(15);function p(t,e){var i="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!i){if(Array.isArray(t)||(i=function(t,e){if(!t)return;if("string"==typeof t)return f(t,e);var i=Object.prototype.toString.call(t).slice(8,-1);"Object"===i&&t.constructor&&(i=t.constructor.name);if("Map"===i||"Set"===i)return Array.from(t);if("Arguments"===i||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i))return f(t,e)}(t))||e&&t&&"number"==typeof t.length){i&&(t=i);var n=0,r=function(){};return{s:r,n:function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(t){throw t},f:r}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var s,o=!0,a=!1;return{s:function(){i=i.call(t)},n:function(){var t=i.next();return o=t.done,t},e:function(t){a=!0,s=t},f:function(){try{o||null==i.return||i.return()}finally{if(a)throw s}}}}function f(t,e){(null==e||e>t.length)&&(e=t.length);for(var i=0,n=new Array(e);i=this.levelOrder.length){if(!t)return;this.currentLevelIndex=1}this.levelIndex++,o.a.playerData.level=this.levelIndex,o.a.saveGame(),this.initializeLevel()}},{key:"initializeLevel",value:function(){var t=this;this.reset(),n.a.gameEnded=!1,n.a.gameOverState=n.a.GameOverStates.NONE;var e=o.a.data.selectedLevel1+this.currentLevelIndex;e%=this.levelOrder.length,e+=1;var i=!1,r=!1;o.a.eventEmitter.once("phaserReady",(function(){i=!0,r&&(r=!1,i=!1,a.a.init(),n.a.startState(!0))})),c.a.loadModels([{name:"level"+e,path:"assets/modelsglb/level"+e+"/scene.glb"}],(function(){t.currentLevel=t.levelOrder[t.currentLevelIndex],t.currentLevel.init(),t.afterLevelLoaded(t.currentLevel),r=!0,i&&(i=!1,r=!1,a.a.init(),n.a.startState(!0))}))}},{key:"resetLevel",value:function(){n.a.resetCount++,n.a.gameEnded=!1,n.a.gameOverState=n.a.GameOverStates.NONE,this.reset(),o.a.playerData.coin=o.a.saveData.coin,this.currentLevel.init(),this.afterLevelLoaded(this.currentLevel),o.a.eventEmitter.once("phaserReady",(function(){a.a.init(),n.a.startState(!0)}))}},{key:"reset",value:function(){this.resetCount++;for(var t=[];n.a.GameObjects.length>0;){var e=n.a.GameObjects.pop();if(e){if(e.noRecycle)return void t.push(e);e.traverse((function(t){t.geometry&&t.geometry.dispose(),t.material&&(t.material.dispose(),t.material.map&&t.material.map.dispose())})),"function"==typeof e.removeObject&&e.removeObject(),o.a.main.scene.remove(e),e.body&&s.a.world.removeBody(e.body)}}for(;n.a.allGameObjects.length>0;){var i=n.a.allGameObjects.pop();"function"==typeof i.removeObject&&i.removeObject(),o.a.threeScene.remove(i),i.geometry&&i.geometry.dispose(),i.body&&s.a.world.removeBody(i.body)}this.resetCannonWorld(),o.a.phaserScene&&o.a.phaserScene.scene.restart(),t.forEach((function(t){n.a.GameObjects.push(t)})),n.a.gameEnded=!1,o.a.eventEmitter.removeAllListeners(),d.a.reset()}},{key:"resetCannonWorld",value:function(){var t=s.a.world;t.solver.removeAllEquations();for(var e=t.constraints,i=e.length;i--;)t.removeConstraint(e[i]);var n=t.bodies;for(i=n.length;i--;)t.removeBody(n[i])}},{key:"setGradientBgColor",value:function(t){var e,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[0,100],n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:180,r="linear-gradient("+n+"deg",s=0,o=p(t);try{for(o.s();!(e=o.n()).done;){var a=e.value;r+=", "+a+" "+i[s]+"%",s++}}catch(t){o.e(t)}finally{o.f()}document.body.style.background=r}},{key:"setSceneBgColor",value:function(t){o.a.main.scene.background=new THREE.Color(t)}},{key:"setCssImage",value:function(t){document.body.style.backgroundImage="url("+t+")",document.body.style.backgroundRepeat="no-repeat",document.body.style.backgroundPosition="center 70%",document.body.style.backgroundSize="cover"}},{key:"addOcean",value:function(){o.a.data.oceanEnabled&&new Ocean({w:500,h:800},new r.Vector3(0,-30,0),o.a.getTexture("waterLines"),o.a.data.oceanColor)}}],(f=null)&&m(e.prototype,f),g&&m(e,g),Object.defineProperty(e,"prototype",{writable:!1}),t}();g(v,"levelList",[]),g(v,"levelOrder",[]),g(v,"currentLevel",null)},function(t,e,i){"use strict";var n=i(0);function r(t,e){var i="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!i){if(Array.isArray(t)||(i=function(t,e){if(!t)return;if("string"==typeof t)return s(t,e);var i=Object.prototype.toString.call(t).slice(8,-1);"Object"===i&&t.constructor&&(i=t.constructor.name);if("Map"===i||"Set"===i)return Array.from(t);if("Arguments"===i||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i))return s(t,e)}(t))||e&&t&&"number"==typeof t.length){i&&(t=i);var n=0,r=function(){};return{s:r,n:function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(t){throw t},f:r}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,a=!0,h=!1;return{s:function(){i=i.call(t)},n:function(){var t=i.next();return a=t.done,t},e:function(t){h=!0,o=t},f:function(){try{a||null==i.return||i.return()}finally{if(h)throw o}}}}function s(t,e){(null==e||e>t.length)&&(e=t.length);for(var i=0,n=new Array(e);i0&&void 0!==arguments[0]?arguments[0]:{},i=e.w,r=void 0===i?1:i,s=e.h,o=void 0===s?1:s,a=e.d,h=void 0===a?1:a,l=e.x,u=void 0===l?0:l,c=e.y,d=void 0===c?0:c,p=e.z,f=void 0===p?0:p,m=e.color,g=void 0===m?"#ff0000":m,v=e.addToScene,y=void 0===v||v,x=e.customMat,w=new n.BoxBufferGeometry(r,o,h);t=x||new n.MeshLambertMaterial({color:g});var b=new n.Mesh(w,t);return b.position.set(u,d,f),b.initSize=new n.Vector3(r,o,h),y&&app.addToGame({obj:b}),b},createPlane:function(){var t,e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},i=e.w,r=void 0===i?1:i,s=e.h,o=void 0===s?1:s,a=e.x,h=void 0===a?0:a,l=e.y,u=void 0===l?0:l,c=e.z,d=void 0===c?0:c,p=e.color,f=void 0===p?"#ff0000":p,m=e.addToScene,g=void 0===m||m,v=e.customMat,y=new n.PlaneGeometry(r,o,10,10);t=v||new n.MeshBasicMaterial({color:f,side:n.DoubleSide});var x=new n.Mesh(y,t);return x.position.set(h,u,d),x.rotation.x=-Math.PI/2,x.initSize=new n.Vector2(r,o),g&&app.addToGame({obj:x}),x},createCylinder:function(t){t.w,t.h,t.x,t.y,t.z,t.color,t.addToScene},detectCollisionCubes:function(t,e){var i=t.geometry.boundingBox.clone();i.applyMatrix4(t.matrixWorld);var n=e.geometry.boundingBox.clone();return n.applyMatrix4(e.matrixWorld),i.intersectsBox(n)},detectCollisionWithBox3:function(t,e){var i=t.geometry.boundingBox.clone();i.applyMatrix4(t.matrixWorld);var n=e;return i.intersectsBox(n)},moveToScene:function(t){var e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];t.updateWorldMatrix(!0),t.getWorldPosition(t.position),t.getWorldScale(t.scale),t.getWorldQuaternion(t.quaternion),app.addToGame({obj:t,update:e,recycle:!0})},modelToBox3:function(t,e){t.updateWorldMatrix(!0);var i=(new n.Box3).setFromObject(t);if(e){var r=new Box3Helper(i);Globals.main.scene.add(r)}var s=(new n.Vector3).addVectors(i.min,i.max).multiplyScalar(.5),o=(new n.Vector3).subVectors(i.max,i.min);return t.dimensions=o,[s,o,i]},addTrail:function(t,e,i){var n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"#000000",r=arguments.length>4&&void 0!==arguments[4]?arguments[4]:1,s=arguments.length>5&&void 0!==arguments[5]?arguments[5]:0,o=arguments.length>6&&void 0!==arguments[6]?arguments[6]:60,a=new THREE.TrailRenderer(t,!0),h=THREE.TrailRenderer.createBaseMaterial(),l=new THREE.Color(n);return h.uniforms.headColor.value.set(l.r,l.g,l.b,r),h.uniforms.tailColor.value.set(l.r,l.g,l.b,s),a.initialize(h,o,!1,0,i,e),a.activate(),a},createRawMaterial:function(t){var e={uMap:{type:"t",value:t}},i=new THREE.ShaderMaterial({uniforms:e,vertexShader:"\n varying vec2 vUv;\n void main()\n {\n \n vUv = uv;\n gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n \n //vec4 v4 = modelViewMatrix * vec4 (position, 1.0);\n //float zOff = v4.z/10.0;\n //v4.y -= 0.1*zOff*zOff;\n //gl_Position = projectionMatrix * v4;\n }\n ",fragmentShader:" \n uniform sampler2D uMap;\n varying vec2 vUv;\n void main( void ) {\n vec4 tex1 = texture2D(uMap, vUv * 1.0);\n gl_FragColor = vec4(\n tex1.r, // R\n tex1.g, // R\n tex1.b, // R\n tex1.a\n );\n } \n ",lights:!1});return i.transparent=!0,i},setRawMatNoFog:function(t){var e=t.material.map,i=t.material.transparent,r={uMap:{type:"t",value:e}},s=new THREE.ShaderMaterial({uniforms:r,vertexShader:"\n varying vec2 vUv;\n void main()\n {\n \n vUv = uv;\n gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n \n //vec4 v4 = modelViewMatrix * vec4 (position, 1.0);\n //float zOff = v4.z/10.0;\n //v4.y -= 0.1*zOff*zOff;\n //gl_Position = projectionMatrix * v4;\n }\n ",fragmentShader:" \n uniform sampler2D uMap;\n varying vec2 vUv;\n void main( void ) {\n vec4 tex1 = texture2D(uMap, vUv * 1.0);\n gl_FragColor = vec4(\n tex1.r, // R\n tex1.g, // R\n tex1.b, // R\n tex1.a\n );\n } \n ",lights:!1,fog:!1,side:n.DoubleSide,transparent:i});t.material=s},setRawMaterial:function(t){var e=t.material.map,i=" \n uniform sampler2D uMap;\n varying vec2 vUv;\n ".concat(THREE.ShaderChunk.common,"\n ").concat(THREE.ShaderChunk.fog_pars_fragment,"\n void main( void ) {\n vec4 tex1 = texture2D(uMap, vUv * 1.0);\n gl_FragColor = vec4(\n tex1.r, // R\n tex1.g, // R\n tex1.b, // R\n tex1.a\n );\n #ifdef USE_FOG\n #ifdef USE_LOGDEPTHBUF_EXT\n float depth = gl_FragDepthEXT / gl_FragCoord.w;\n #else\n float depth = gl_FragCoord.z / gl_FragCoord.w;\n #endif\n float fogFactor = smoothstep( fogNear, fogFar, depth );\n gl_FragColor.rgb = mix( gl_FragColor.rgb, fogColor, fogFactor );\n #endif\n \n } \n "),n={uMap:{type:"t",value:e},topColor:{type:"c",value:new THREE.Color(30719)},bottomColor:{type:"c",value:new THREE.Color(16777215)},offset:{type:"f",value:33},exponent:{type:"f",value:.6},fogColor:{type:"c",value:Globals.main.scene.fog.color},fogNear:{type:"f",value:Globals.main.scene.fog.near},fogFar:{type:"f",value:Globals.main.scene.fog.far}},r=new THREE.ShaderMaterial({uniforms:n,vertexShader:"\n varying vec2 vUv;\n void main()\n {\n \n vUv = uv;\n gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n \n //vec4 v4 = modelViewMatrix * vec4 (position, 1.0);\n //float zOff = v4.z/10.0;\n //v4.y -= 0.1*zOff*zOff;\n //gl_Position = projectionMatrix * v4;\n }\n ",fragmentShader:i,lights:!1,fog:!0});r.transparent=!1,t.material=r},mergeModel:function(t){var e=[],i=[];t.traverse((function(t){if(t.material){var n=e.indexOf(t.material);n<0?(e.push(t.material),i.push([t])):i[n].push(t)}}));for(var n=[],r=0;rt.flatMap((t,n)=>[e*i,n*i,t])),s=[];for(let e=0;e0&&void 0!==arguments[0]?arguments[0]:{x:0,y:0,z:0},i=new n.World;return i.gravity.set(e.x,e.y,e.z),i.broadphase=new n.NaiveBroadphase,i.defaultContactMaterial.contactEquationStiffness=1e6,i.defaultContactMaterial.contactEquationRegularizationTime=3,i.solver.iterations=5,i.allowSleep=!0,i.add||(i.add=i.addBody),i.remove||(i.remove=i.removeBody),this.world=i,t.CANNON=n,app.cannonPhysics=this,i}},{key:"setWorld",value:function(e){t.CANNON=n,this.world=e}},{key:"initDebug",value:function(){var t=o.a.threeScene,e=this.world;this.debugRenderer=new s(t,e)}}],(i=null)&&a(e.prototype,i),r&&a(e,r),Object.defineProperty(e,"prototype",{writable:!1}),t}();e.a=h},function(t,e,i){"use strict";i.d(e,"a",(function(){return H}));var n=i(5),r=i(3),s=i(1),o=i(11),a=i(17);function h(t,e){var i="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!i){if(Array.isArray(t)||(i=function(t,e){if(!t)return;if("string"==typeof t)return l(t,e);var i=Object.prototype.toString.call(t).slice(8,-1);"Object"===i&&t.constructor&&(i=t.constructor.name);if("Map"===i||"Set"===i)return Array.from(t);if("Arguments"===i||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i))return l(t,e)}(t))||e&&t&&"number"==typeof t.length){i&&(t=i);var n=0,r=function(){};return{s:r,n:function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(t){throw t},f:r}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var s,o=!0,a=!1;return{s:function(){i=i.call(t)},n:function(){var t=i.next();return o=t.done,t},e:function(t){a=!0,s=t},f:function(){try{o||null==i.return||i.return()}finally{if(a)throw s}}}}function l(t,e){(null==e||e>t.length)&&(e=t.length);for(var i=0,n=new Array(e);in&&(r=.25);var s=n-t.topObj.getBottomCenter().y;i.scale=Math.min(.5*e/i.iW,s*r/i.iH),i.x=.5*e,i.y=t.topObj.getBottomCenter().y+.6*i.displayHeight,i.iS=i.scale},n.setOrigin(.5),l.setOrigin(.5,.75),l.y=n.y+.3*n.displayHeight,i.onResizeCallback(e.lastWidth,e.lastHeight);var u=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},i=t.imgName,n=t.topObj,a=t.coinTextColor,h=void 0===a?"#fff":a,l=t.enableXMult,u=void 0!==l&&l,c=t.coinTextSkal,d=void 0===c?1:c,p=t.offsetY,f=void 0===p?1:p,m=t.skal,g=void 0===m?1:m,v=t.textOffsetY,y=void 0===v?.3:v,x=t.clickFunc,w=o.a.addButton(e,"uiatlas",i,s.a.locales.CLAIM,(function(){x&&x()}),{xRatio:.5,yRatio:y,wRatio:.45,hRatio:.35,strokePower:4,strokeColor:"#000",hasStroke:!0,fntSize:32},"Arial");w.text.setFontStyle("bold");var b=r.a.bonusCollected,A=e.add.text(0,0,b,{fontFamily:"ui-font",fontSize:32,stroke:"#000",strokeThickness:5,color:h});A.setFontStyle("bold"),A.scale=1*d,A.x=0,A.y=.2*w.displayHeight,A.setOrigin(.5);var T=e.add.image(0,0,"uiatlas","coin");if(T.scale=.3*w.scale*d,T.y=A.y,T.x=A.x+.45*A.displayWidth+.8*T.displayWidth,w.add(A),w.add(T),u){var S=e.add.text(0,0,"X2",{fontFamily:"ui-font",fontSize:32,stroke:"#000",strokeThickness:5});S.setOrigin(.5,.5),S.setFontStyle("bold"),S.scale=.45*w.displayHeight/S.height,S.x=w.x+.45*w.displayWidth-.5*S.displayWidth,S.y=.1*w.displayHeight,w.add(S),w.multText=S}return w.onResizeCallback=function(t,e){w.scale=n.scale*g,w.x=.5*t,w.y=n.getBottomCenter().y+.5*w.displayHeight*f},w.onResizeCallback(e.lastWidth,e.lastHeight),w.koinText=A,w},c=u({imgName:"claimVidBtn",coinTextColor:"#EEE776",topObj:i,enableXMult:!0,clickFunc:function(){app.playSfx("Button"),s.a.phaserScene.tweens.killTweensOf(l),t.videoClaimBtnCallback(c)}}),d=u({imgName:"claimBtn",coinTextColor:"#fff",topObj:c,coinTextSkal:.75,offsetY:1.05,skal:1,textOffsetY:.35,clickFunc:function(){app.playSfx("Button"),s.a.phaserScene.tweens.killTweensOf(l),t.normalClaimBtnCallback(d)}});this.vidClaimBtn=c,this.normalClaimBtn=d,this.vidClaimBtn.setVisible(!1),c.text.scale>d.text.scale?d.text.scale=c.text.scale:c.text.scale=d.text.scale;var p=parseInt(d.koinText.text),f=[{start:.55*-Math.PI,end:.22*-Math.PI,val:2},{start:.55*-Math.PI,end:.1*Math.PI,val:3},{start:.55*-Math.PI,end:.35*Math.PI,val:4},{start:.55*-Math.PI,end:.55*Math.PI,val:5}];e.tweens.add({targets:l,rotation:{from:.55*-Math.PI,to:.55*Math.PI},duration:1e3,yoyo:!0,repeat:-1,ease:Phaser.Math.Easing.Sine.In,onUpdate:function(){var t,e=l.rotation,i=h(f);try{for(i.s();!(t=i.n()).done;){var n=t.value;if(e<=n.end){c.multText.text="X"+n.val;var r=n.val*p;c.koinText.text=r;break}}}catch(t){i.e(t)}finally{i.f()}}}),H5SDK.getPlatform().isYoutube()?(c.setVisible(!1),n.setVisible(!1),l.setVisible(!1),d.y=c.y):H5SDK.getAdsModule().preloadRewardedAd().then((function(e){e&&t.vidClaimBtn.setVisible(!0)}))}}])&&u(e.prototype,i),l&&u(e,l),Object.defineProperty(e,"prototype",{writable:!1}),t}(),d=i(4),p=i(18),f=i(14);function m(t,e){for(var i=0;i0&&g.textures.remove("drawAreaTop"+w-1);var i=g.textures.createCanvas("drawAreaTop"+w,.95*this.drawBg.displayWidth,.95*this.drawBg.displayHeight);this.canvas=i;var n=g.add.image(0,0,"drawAreaTop"+w);n.setInteractive(),w++,this.padCont.add([this.drawBg,n]),this.padCont.iW=this.padCont.getBounds().width,this.padCont.iH=this.padCont.getBounds().height,this.padCont.onResizeCallback=function(t,e){this.setScale(Math.min(.8*t/this.iW,.3*e/this.iH)),this.x=.5*t,this.y=.9*e-this.iH*this.scale*.6},this.padCont.onResizeCallback(g.lastWidth,g.lastHeight),this.circle=g.add.circle(0,0,10,0).setOrigin(.5).setVisible(!1),this.currentPoints=[],this.tutorialEnabled=!0,this.firstDrawEnded=!1,n.on("pointerdown",(function(){e.onDrawStarts(i),e.tutorialEnabled&&(e.tutorialEnabled=!1,e.onFirstDraw())})),n.on("pointermove",(function(t){e.onPointerMoves(t,i)})),g.input.on("pointerup",(function(){e.onDrawEnds(i)})),n.on("pointerout",(function(){e.onDrawEnds(i)})),this.show(!1),this.drawTutorial=new v(this)}var e,i,n;return e=t,(i=[{key:"onFirstDraw",value:function(){this.drawTutorial.stopDrawing(),this.hideDrawText()}},{key:"show",value:function(t,e){var i=this;this.padCont.visible!==t&&(s.a.deltaMultiplier=1,e?t?(this.padCont.visible=!1,g.tweens.add({targets:this.drawBg,scaleY:{from:0,to:1},duration:500,ease:"Sine.easeOut",onStart:function(){i.padCont.visible=!0}}),this.showDrawText()):g.tweens.add({targets:this.drawBg,scaleY:{from:1,to:0},duration:500,ease:"Sine.easeOut",onComplete:function(){i.padCont.visible=!1}}):this.padCont.visible=t)}},{key:"showDrawText",value:function(){this.drawTutorial.startDrawing();var t=p.a.createText(s.a.locales.DRAW,{customResize:!0,fontSize:120});t.alpha=0,t.scale=1,this.padCont.add(t),t.setShadow(0,.5,"#000",2,!1,!0),t.x=0,t.y=.5*-this.drawBg.displayHeight-.5*t.displayHeight,s.a.phaserScene.tweens.add({targets:t,scale:{from:0,to:1},alpha:1,ease:"Linear",duration:500,onComplete:function(){s.a.phaserScene.tweens.add({targets:t,scale:.8,ease:Phaser.Math.Easing.Sine.InOut,duration:600,yoyo:!0,repeat:-1})}}),this.drawText=t}},{key:"hideDrawText",value:function(){var t=this;return new Promise((function(e){s.a.phaserScene.tweens.killTweensOf(t.drawText),s.a.phaserScene.tweens.add({targets:t.drawText,scale:0,ease:Phaser.Math.Easing.Sine.Out,duration:500,onComplete:function(){t.drawText.visible=!1,e()}})}))}},{key:"showCountDown",value:function(){if(s.a.data.skipCountdown)return Promise.resolve();var t=p.a.createText("3",{customResize:!0,fontSize:120});this.padCont.add(t);var e=s.a.data.countdownStart;t.text=e,t.setShadow(0,.5,"#000",2,!1,!0),t.x=0,t.y=.5*-this.drawBg.displayHeight-.5*t.displayHeight;var i=!1;return new Promise((function(n){var r=s.a.phaserScene.tweens.add({targets:t,scale:{from:1,to:0},ease:"Linear",duration:s.a.data.countdownSpeed,loop:e,onStart:function(){app.playSfx("Race_Start")},onUpdate:function(){r.setTimeScale(s.a.deltaMultiplier)},onLoop:function(){0!=--e||i?app.playSfx("Race_Start"):(i=!0,e=s.a.locales.START,app.playSfx("Race_End"),n()),t.setText(e)},onComplete:function(){t.destroy()}})}))}},{key:"clearCanvas",value:function(){this.canvas.clear()}},{key:"drawOnCanvas",value:function(t){var e=this.canvas;e.context.beginPath(),this.getPosReleativeToDrawArea(t.x,t.y);var i=.5*this.drawBg.width,n=.5*this.drawBg.height;e.context.arc(t.x+i,t.y+n,10,0,2*Math.PI),e.context.fill()}},{key:"onDrawStarts",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.canvas;t.clear(),this.drawingStarts=!0,this.pointDistances=0,this.currentPoints=[],this.time=0,d.a.setDeltaMultiplier(.2),s.a.vibrateFeedback(100)}},{key:"onPointerMoves",value:function(t){var e=this,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.canvas;if(this.drawingStarts){var n=t.getInterpolatedPosition(15);i.context.fillStyle="#000",n.forEach((function(t){i.context.beginPath();var n=e.getPosReleativeToDrawArea(t.x,t.y);i.context.arc(n.x,n.y,10,0,2*Math.PI),i.context.fill()}));var r=this.getPosReleativeToDrawArea(t.x,t.y);if(r.x/=this.drawBg.displayWidth-32,r.y/=this.drawBg.displayHeight-32,this.currentPoints.push(r),this.time++,this.time>2&&(this.time=0,s.a.vibrateFeedback(10),app.playSfx("Drawing")),this.currentPoints.length>1){var o=this.currentPoints[this.currentPoints.length-2];this.pointDistances+=this.getDist(o,r)}}}},{key:"getPosReleativeToDrawArea",value:function(t,e){var i=(t-this.padCont.x)/this.padCont.scaleX+.5*this.drawBg.displayWidth,n=(e-this.padCont.y)/this.padCont.scaleY+.5*this.drawBg.displayHeight;return{x:i-=16,y:n-=16}}},{key:"getDist",value:function(t,e){return Math.sqrt(Math.pow(t.x-e.x,2)+Math.pow(t.y-e.y,2))}},{key:"onDrawEnds",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.canvas;this.drawingStarts&&(d.a.setDeltaMultiplier(1),this.drawingStarts=!1,t.clear(),this.currentPoints.length<5||this.pointDistances<.1||(this.firstDrawEnded||(this.firstDrawEnded=!0,this.onFirstDrawEnded()),s.a.eventEmitter.emit("drawingEnds",{pointList:this.currentPoints})))}},{key:"onFirstDrawEnded",value:function(){this.showCountDown().then((function(){s.a.eventEmitter.emit("gameStarts"),d.a.setState(y.a.GameplayState)}))}}])&&x(e.prototype,i),n&&x(e,n),Object.defineProperty(e,"prototype",{writable:!1}),t}();function A(t,e){for(var i=0;im.text.scale?f.text.scale=m.text.scale:m.text.scale=f.text.scale,e.onResizeCallback=function(t,i){e.scale=Math.min(.6*t/e.iW,.3*i/e.iH),e.x=.5*t,e.y=.36*i,e.iS=e.scale},e.onResizeCallback(t.lastWidth,t.lastHeight);var g=H5SDK.getPlatform().isFacebook(),v=.5;g||(v=.3),r.x=0,r.y=-e.bounds.height*v+.7*r.height,h.x=0,h.y=r.getBottomCenter().y+.3*h.height,r.visible=!1,h.visible=!1,l.y=-e.iH*v+.25*e.iH,u.y=l.getBottomCenter().y+.4*u.height,f.y=u.getBottomCenter().y+.75*f.height,m.y=f.y+.5*f.height+.9*m.height,this.container=e,this.container.setVisible(!1),this.show(!0),g||(f.setVisible(!1),m.setVisible(!1))}},{key:"show",value:function(t){var e=this;t?(this.container.setVisible(!0),s.a.phaserScene.tweens.add({targets:this.container,props:{scale:{dynamic:!0,value:{getStart:function(t){return 0},getEnd:function(t){return e.container.iS}}}},duration:300,ease:"Sine.easeInOut"})):this.container.setVisible(!1)}}])&&A(e.prototype,i),n&&A(e,n),Object.defineProperty(e,"prototype",{writable:!1}),t}();function E(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function M(t,e){for(var i=0;i0&&void 0!==arguments[0]?arguments[0]:{},i=e.openingScene,n=void 0!==i&&i;E(this,t),T=s.a.phaserScene,this.openingScene=n,this.init(),this.show(!1),this.rewardAdShown=!1,this.initEvents()}var e,i,n;return e=t,(i=[{key:"show",value:function(t){this.gameObjects.forEach((function(e){e.setVisible(t)}))}},{key:"destroy",value:function(){this.gameObjects.forEach((function(t){t.destroy(!0)}))}},{key:"initEvents",value:function(){s.a.eventEmitter.once("playBtnClicked",this.destroy.bind(this))}},{key:"init",value:function(){var t=this.initBox("speed",s.a.upgrades.speedUpgrade);t.onResizeCallback=function(e,i){t.scale=Math.min(.25*e/t.iW,.15*i/t.iH);var n=.8;e>i&&(n=.77),t.x=.5*e,t.y=i*n-1*t.displayHeight,t.iS=t.scale},t.onResizeCallback(T.lastWidth,T.lastHeight),this.gameObjects=[t]}},{key:"initBox",value:function(t,e){var i=this,n=new a.a,r=s.a.phaserScene.add.image(0,0,"uiatlas",t+"Btn");n.swapAdBg=function(o){var a=arguments.length>1&&void 0!==arguments[1]&&arguments[1];o?(r.setFrame(t+"_adoverlay"),l.setTextWithScale(s.a.locales.UPGRADE_FREE),n.alpha=1):(r.setFrame(t+"Btn"),l.setTextWithScale(e.cost),(s.a.playerData.coin=e.cost&&i.upgradeAttribute(n,e)})),n.swapAdBg(!1),window.H5SDK.getAdsModule().preloadRewardedAd().then((function(t){var o=H5SDK.getPlatform().isYoutube();t&&s.a.playerData.coin=e.cost);else{if(i.rewardAdShown)return;H.enableInput(!1),app.beforeAdShown(),window.H5SDK.getAdsModule().requestRewardedAd().then((function(t){H.enableInput(!0),app.afterAdShown(),t?(i.rewardAdShown=!0,i.upgradeAttribute(n,e,!0)):(r.disableInteractive(),i.rewardAdShown=!1,n.swapAdBg(!1))}))}})),n.swapAdBg(!0,t))})),n}},{key:"upgradeAttribute",value:function(t,e,i){i||(s.a.playerData.coin-=e.cost),s.a.playerData.coin<0&&(s.a.playerData.coin=0),e.level+=1,t.levelText.setText("LVL "+e.level),t.coinText.setTextWithScale(e.cost),t.swapAdBg(!1),s.a.saveData.speedUpgradeLevel=s.a.playerData.speedUpgradeLevel,s.a.saveData.coin=s.a.playerData.coin,s.a.saveGame(!0),s.a.eventEmitter.emit("upgradeBtnClicked",e),s.a.eventEmitter.emit("updateCoins"),s.a.vibrateFeedback(200),this.openingScene&&(H.enableInput(!1),H.introUI.show(!1),t.visible=!1,app.playSfx("Button"),r.a.player.doUpgradeAnim().then((function(){t.visible=!0,H.enableInput(!0),H.introUI.show(!0)}))),T.tweens.add({targets:t,props:{scale:{dynamic:!0,value:{getStart:function(t){return.9*t.iS},getEnd:function(t){return t.iS}}}},duration:800,ease:Phaser.Math.Easing.Back.Out})}},{key:"calculateCostValue",value:function(t){return t.startingCost*t.level}}])&&M(e.prototype,i),n&&M(e,n),Object.defineProperty(e,"prototype",{writable:!1}),t}();function P(t,e,i,n,r,s,o){try{var a=t[s](o),h=a.value}catch(t){return void i(t)}a.done?e(h):Promise.resolve(h).then(n,r)}function R(t,e){for(var i=0;ie&&(n=.9),i.y=e*n*.7,i.iS=i.scale},i.onResizeCallback(_.lastWidth,_.lastHeight),p.a.makePulse(i),r=H5SDK.getPlatform().isYoutube(),t.next=10,H5SDK.getAdsModule().preloadRewardedAd();case 10:t.sent&&!r?((a=o.a.addButton(s.a.phaserScene,"uiatlas","claimVidBtn",s.a.locales.SKIP_LEVEL,(function(){H.enableInput(!1),app.playSfx("Button"),app.beforeAdShown(),H5SDK.getAdsModule().requestRewardedAd().then((function(t){app.afterAdShown(),t?n.a.goNextLevel():(H.enableInput(!0),a.scale=0)}))}),{xRatio:.6,yRatio:.5,wRatio:.6,hRatio:.45,strokePower:5,strokeColor:"#000",hasStroke:!1})).text.setFontStyle("bold"),a.onResizeCallback=function(t,e){a.scale=Math.min(.35*t/a.width,.1*e/a.height),a.x=i.x,a.y=i.getBottomCenter().y+.75*a.displayHeight,a.iS=a.scale},a.onResizeCallback(_.lastWidth,_.lastHeight),h=[e,e.textObj,e.shimmerObj,i,a],this.showAnim(h,!1)):(l=[e,e.textObj,e.shimmerObj,i],this.showAnim(l,!1));case 12:case"end":return t.stop()}}),t,this)})),h=function(){var t=this,e=arguments;return new Promise((function(i,n){var r=a.apply(t,e);function s(t){P(r,i,n,s,o,"next",t)}function o(t){P(r,i,n,s,o,"throw",t)}s(void 0)}))},function(){return h.apply(this,arguments)})},{key:"createTitle",value:function(t,e){var i=_.add.image(0,0,"uiatlas",e);i.onResizeCallback=function(t,e){i.setScale(t/i.width,.1*e/i.height),i.x=.5*t,i.y=.15*e,i.iSY=i.scaleY,i.iSX=i.scaleX},i.onResizeCallback(_.lastWidth,_.lastHeight);var n=_.add.image(0,0,"uiatlas","ecShimmer");n.onResizeCallback=function(t,e){n.scale=i.displayHeight/n.height,n.x=i.x-.4*n.displayWidth,n.y=i.y,n.iPX=n.x},n.onResizeCallback(_.lastWidth,_.lastHeight);var r=_.add.text(0,0,t,{fontSize:60,fontFamily:"ui-font",color:"#ffffff",fontStyle:"bold"});return r.setOrigin(.5),r.onResizeCallback=function(t,e){r.scale=Math.min(.9*i.displayWidth/r.width,.7*i.displayHeight/r.height),r.x=i.x,r.y=i.y,r.iPX=r.x},r.onResizeCallback(_.lastWidth,_.lastHeight),i.textObj=r,i.shimmerObj=n,i}},{key:"addTitleAnim",value:function(t){t.alpha=1,_.tweens.add({targets:t,props:{scaleY:{dynamic:!0,value:{getStart:function(t){return 0*t.iSY},getEnd:function(t){return 1*t.iSY}}}},duration:1500,ease:Phaser.Math.Easing.Bounce.Out,easeParams:[2]}),_.tweens.add({targets:t.shimmerObj,props:{alpha:1,x:{dynamic:!0,value:{getStart:function(t){return 2*t.iPX},getEnd:function(t){return 1*t.iPX}}}},delay:1e3,duration:800,ease:Phaser.Math.Easing.Back.Out,easeParams:[3]}),_.tweens.add({targets:t.textObj,props:{alpha:1,x:{dynamic:!0,value:{getStart:function(t){return 2*-t.iPX},getEnd:function(t){return 1*t.iPX}}}},delay:1e3,duration:800,ease:Phaser.Math.Easing.Back.Out,easeParams:[3]})}},{key:"addScaleUpAnim",value:function(t,e,i){_.tweens.add({targets:t,delay:e,props:{alpha:1,scale:{dynamic:!0,value:{getStart:function(t){return 0*t.iS},getEnd:function(t){return 1*t.iS}}},y:{dynamic:!0,value:{getStart:function(t){return i.iPY},getEnd:function(t){return 1*t.iPY}}}},duration:800,ease:Phaser.Math.Easing.Back.Out,easeParams:[2]})}},{key:"addAlphaAnim",value:function(t,e){_.tweens.add({targets:t,alpha:1,delay:e,duration:800,ease:"Sine.easeInOut"})}},{key:"showAnim",value:function(t,e){if(t.forEach((function(t){t.alpha=0})),e){this.addTitleAnim(t[0]);for(var i=3;i3&&void 0!==arguments[3]?arguments[3]:.5,o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:.5,a=t.add.text(0,0,e,{fontSize:n,color:i,stroke:"#000",fontFamily:"ui-font"});return a.setAlign("center"),a.setFontStyle("bold"),a.setOrigin(.5),a.setScale(Math.min(r.displayWidth*s/a.width,r.displayHeight*o/a.height)),a};i.add(r),i.setInitials();var l=h(s.a.locales.EXIT_MSG,"#ffffff",60);l.y=.2*-r.displayHeight;var u=h(s.a.locales.EXIT_MSG_2,"#ffffff",60,.68,.6);u.y=.8*l.getBottomCenter().y+.5*u.displayHeight;var c=o.a.addButton(t,"uiatlas","Exit_Yes",s.a.locales.EXIT_MSG_YES,(function(){H.enableInput(!1),app.beforeAdShown(),H5SDK.getPlatform().notifyLevelEnd(n.a.levelIndex+1,s.a.playerData.bestScore,!1),H5SDK.getAdsModule().requestInterstitialAd().then((function(){app.afterAdShown(),i.hidePopup(),n.a.resetLevel()}))}),{wRatio:.7,hRatio:.7,fontSize:60});c.text.setFontStyle("bold");var d=o.a.addButton(t,"uiatlas","Exit_No",s.a.locales.EXIT_MSG_NO,(function(){i.hidePopup()}),{wRatio:.7,hRatio:.7,fontSize:60});d.text.setFontStyle("bold"),i.hidePopup=function(){app.pausegame=!1,i.destroy(),e.destroy()},c.x=.4*-r.width+.5*c.displayWidth,c.y=.4*r.height-.5*c.displayHeight,d.x=.4*r.width-.5*d.displayWidth,d.y=c.y,i.add([l,u,c,d]),i.setZ(100),i.onResizeCallback=function(t,e){i.setScale(Math.min(.7*t/i.width,.5*e/i.height)),i.x=.5*t,i.y=.5*e},i.onResizeCallback(t.lastWidth,t.lastHeight)}},{key:"showResetButton",value:function(t){this.settingsBtn.showThings(!1),this.resetBtn.visible=t,this.settingsBtn.visible=!1}},{key:"showSettings",value:function(){window.H5SDK.getPlatform().isYoutube()||this.container.showSettings()}},{key:"hideSettings",value:function(){this.container.hideSettings()}}])&&N(e.prototype,i),r&&N(e,r),Object.defineProperty(e,"prototype",{writable:!1}),t}();function U(t,e){for(var i=0;i",(function(){n.a.goNextLevel(!0)}),{customResize:function(t,e,i){t.x=e-.5*t.displayWidth,t.y=.05*i+.5*t.displayHeight}})}}],(i=null)&&U(e.prototype,i),a&&U(e,a),Object.defineProperty(e,"prototype",{writable:!1}),t}()},function(t,e,i){"use strict";i.d(e,"a",(function(){return F}));var n=i(2),r=i(0),s=i(1),o=i(10),a=i(3),h=i(6),l=i(8),u=i(7);function c(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function d(t,e){for(var i=0;i0&&void 0!==arguments[0]?arguments[0]:{},i=e.size,s=void 0===i?new r.Vector3(1,1,1):i,h=e.callback,l=e.removeOnTouch,d=void 0===l||l,p=e.pos,f=void 0===p?new r.Vector3:p,m=e.fromMesh,g=e.skal,v=void 0===g?new r.Vector3(1,1,1):g;c(this,t),m?this.triggerBody=o.a.createBodyFromObj(m,{sizeVecMult:v}):(this.triggerBody=new n.Body({mass:0,shape:new n.Box((new n.Vec3).copy(s)),type:n.Body.STATIC}),this.triggerBody.position.copy(f),u.a.world.addBody(this.triggerBody)),this.triggerBody.collisionResponse=!1,this.triggerBody.master=this,this.triggerBody.colType=a.a.colTypes.TRIGGER,h&&this.setCallback(h),this.removeOnTouch=d}var e,i,s;return e=t,(i=[{key:"setCallback",value:function(t){this.callback=t}},{key:"onTouch",value:function(t){this.removeOnTouch&&(this.triggerBody.colType=null),this.callback&&this.callback(t)}}])&&d(e.prototype,i),s&&d(e,s),Object.defineProperty(e,"prototype",{writable:!1}),t}(),f=i(4);function m(t,e){for(var i=0;i1&&void 0!==arguments[1]?arguments[1]:{},a=r.mass,h=void 0===a?.1:a,l=r.isSphere,c=void 0!==l&&l;M(this,t),this.isSphere=c,c?(i=new n.Body({mass:h,shape:new CANNON.Sphere(.4),type:n.Body.DYNAMIC}),u.a.world.addBody(i),i.position.copy(e.position)):(i=o.a.createBodyFromObj(e,{mass:h,type:n.Body.DYNAMIC})).sleep(),this.sleepTimer=0,this.sleepEnd=!1,this.model=e,this.body=i,this.model.body=i,s.a.addToUpdate(e),i.orgPos=i.position.clone(),e.update=this.update.bind(this)}var e,i,r;return e=t,(i=[{key:"update",value:function(t){var e=this.model.body,i=this.model;this.sleepEnd||this.isSphere&&(this.sleepTimer+=t,this.sleepTimer>2.1&&(e.sleep(),this.sleepEnd=!0),e.position.z=e.orgPos.z,i.position.copy(e.position),i.quaternion.copy(e.quaternion)),e.sleepState!==n.Body.SLEEPING&&e.type!==n.Body.STATIC&&(e.position.y<-50&&(e.sleep(),e.type=n.Body.STATIC,this.model.visible=!1),i.position.copy(e.position),i.quaternion.copy(e.quaternion))}}])&&_(e.prototype,i),r&&_(e,r),Object.defineProperty(e,"prototype",{writable:!1}),t}();i(36);function P(t,e){var i="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!i){if(Array.isArray(t)||(i=function(t,e){if(!t)return;if("string"==typeof t)return R(t,e);var i=Object.prototype.toString.call(t).slice(8,-1);"Object"===i&&t.constructor&&(i=t.constructor.name);if("Map"===i||"Set"===i)return Array.from(t);if("Arguments"===i||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i))return R(t,e)}(t))||e&&t&&"number"==typeof t.length){i&&(t=i);var n=0,r=function(){};return{s:r,n:function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(t){throw t},f:r}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var s,o=!0,a=!1;return{s:function(){i=i.call(t)},n:function(){var t=i.next();return o=t.done,t},e:function(t){a=!0,s=t},f:function(){try{o||null==i.return||i.return()}finally{if(a)throw s}}}}function R(t,e){(null==e||e>t.length)&&(e=t.length);for(var i=0,n=new Array(e);i1&&void 0!==arguments[1]?arguments[1]:0,o=arguments.length>2?arguments[2]:void 0;L(this,t),this.zOffset=n,this.colliderList=[],this.checkPointList=[],this.coinRef=[],this.keyRef=[];var l=[];this.ballsLocatorList=[],this.waterList=[],this.finalPlatformLocator,this.model=s.a.cloneAsset(e,1),this.model.position.z=this.zOffset,this.killzoneY=(new r.Box3).setFromObject(this.model).min.y-10,this.finishLine=null,s.a.addToGame({obj:this.model}),this.startObj,this.model.statik=!0,this.model.traverse((function(t){t.name.includes("Collider")&&(i.colliderList.push(t),t.visible=!1),"start"===t.name&&(t.visible=!1,i.startObj=t),t.name.includes("Floor")&&t.material&&(t.receiveShadow=!0,t.geometry.computeVertexNormals(),o&&o(t),a.a.rayableList.push(t)),t.name.includes("Winner")&&(i.finishLine=t,t.visible=!1),t.name.includes("_Locater")&&"Object3D"===t.type&&i.checkPointList.push(t),t.name.includes("Coin_ref")&&(i.coinRef.push(t),t.visible=!1),"Winner"===t.name&&(i.finalPlatformLocator=t),t.name.includes("Barriers")&&l.push(t),t.name.includes("Key_Locator")&&(i.keyRef.push(t),t.visible=!1),t.name.includes("Balls_Locator")&&i.ballsLocatorList.push(t),t.name.includes("Water")&&i.waterList.push(t)})),this.handleCollidersSeperate(this.colliderList),this.checkPointList.forEach((function(t){new g(t,i)})),this.addBarriers(l),this.addBalls(),this.initWater(),h.a.moveToScene(this.finishLine),h.a.moveToScene(this.startObj)}var e,i,l;return e=t,(i=[{key:"handleCollidersSeperate",value:function(t){var e=new r.Box3;this.seperateColliders=!0,t.forEach((function(t){var i=o.a.createBodyFromObj(t,{addToWorld:!1});i.material=a.a.kontakMaterials.hard,i.colType=a.a.colTypes.PLATFORM,t.parent.remove(t),t.body=i,e.setFromObject(t),t.curSize=e.getSize(new r.Vector3);var n=i.position.x-t.curSize.x,s=i.position.x+t.curSize.x;t.line={min:n,max:s}}))}},{key:"handleCollidersAsCompound",value:function(t){var e=new n.Body({mass:0,type:n.Body.STATIC,material:a.a.kontakMaterials.hard});e.colType=a.a.colTypes.PLATFORM,t.forEach((function(t){var i=o.a.getShape(t);e.addShape(i.shape,i.offset,i.qut),t.parent.remove(t),t.body=e})),o.a.updateCenterOfMass(e),u.a.world.addBody(e)}},{key:"setLevelPlayer",value:function(t){this.levelPlayer=t,t.setCurrentLevelPlatform(this)}},{key:"enableCollidersForNearestPos",value:function(t){var e,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,n=P(this.colliderList);try{for(n.s();!(e=n.n()).done;){var r=e.value,s=t.x-i,o=t.x+i,a=!(o1&&void 0!==arguments[1]?arguments[1]:{},i=e.sizeVecMult,s=void 0===i?new n.Vector3(1,1,1):i,o=e.spherical,h=void 0!==o&&o,l=new n.Box3,u=new n.Vector3,c=t.position.clone(),d=t.quaternion.clone(),p=t.scale.clone(),f=t.parent;a(t);var m=t.position.clone(),g=t.quaternion.clone();t.scale.clone();t.position.set(0,0,0),t.rotation.set(0,0,0),t.updateMatrixWorld(!0),l.setFromObject(t),l.getSize(u);var v;l.getCenter(new n.Vector3);u.multiplyScalar(.5),u.x*=s.x,u.y*=s.y,u.z*=s.z,u.y<.01&&(u.y=.01),v=h?new Sphere(u.x):new r.Box(new r.Vec3(u.x,u.y,u.z)),f&&f.add(t),t.position.copy(c),t.quaternion.copy(d),t.scale.copy(p);var y=(new r.Vec3).copy(m);return{shape:v,offset:y,qut:g}},o.createBodyFromObj=function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},i=e.mass,o=void 0===i?0:i,h=e.type,l=void 0===h?r.Body.STATIC:h,u=e.addToWorld,c=void 0===u||u,d=e.sizMult,p=void 0===d?1:d,f=e.sizeVecMult,m=void 0===f?new n.Vector3(1,1,1):f,g=e.leaveBodyAtScene,v=void 0!==g&&g,y=e.isTrigger,x=void 0!==y&&y,w=new n.Box3,b=new n.Vector3,A=t.position.clone(),T=t.quaternion.clone(),S=t.scale.clone(),E=t.parent;a(t);var M=t.position.clone(),_=t.quaternion.clone(),C=t.scale.clone();t.position.set(0,0,0),t.rotation.set(0,0,0),t.updateMatrixWorld(!0),w.setFromObject(t),w.getSize(b);var P=w.getCenter(new n.Vector3);b.multiplyScalar(.5*p),b.x*=m.x,b.y*=m.y,b.z*=m.z,b.y<.01&&(b.y=.01);var R=new r.Box(new r.Vec3(b.x,b.y,b.z)),L=new r.Body({mass:o,type:l,isTrigger:x});return x&&(L.collisionResponse=!1),L.bb8Size=b.clone(),L.offsetman=(new r.Vec3).copy(P),L.addShape(R,L.offsetman),L.position.copy(M),L.quaternion.copy(_),v?(t.position.copy(M),t.quaternion.copy(_),t.scale.copy(C)):(E&&E.add(t),t.position.copy(A),t.quaternion.copy(T),t.scale.copy(S)),c&&s.a.world.addBody(L),L},o.bodiesAreInContact=function(t,e){for(var i=0;i2&&void 0!==arguments[2]?arguments[2]:3,r=arguments.length>3?arguments[3]:void 0,s=new n.Vector3(t.x,t.y,t.z),o=new n.Vector3(e.x,e.y,e.z),a=o.sub(s),h=new n.Vector3(0,1,0).multiplyScalar(Math.sqrt(-2*r*i)),l=new n.Vector3(a.x/(Math.sqrt(-2*i/r)+Math.sqrt(2*(a.y-i)/r)),h.y,a.z/(Math.sqrt(-2*i/r)+Math.sqrt(2*(a.y-i)/r)));return l},e.a=o},function(t,e,i){"use strict";var n=i(17),r={};function s(t,e,i,n,r,s,o,a,h){var l=arguments.length>9&&void 0!==arguments[9]?arguments[9]:0,u=arguments.length>10&&void 0!==arguments[10]?arguments[10]:0;t.fillStyle(r,s),t.lineStyle(o,a,h);var c=.5*-e+l,d=.5*-i+u;if(0==n)t.fillRect(c,d,e,i),o&&t.strokeRect(c,d,e,i);else if(o)if(app.main.hasWebGL)t.fillRoundedRect(c,d,e,i,n,n),e+=.5*o,i+=.5*o,t.strokeRoundedRect(c,d,e,i,n,n);else{var p=e+o,f=i+o;t.fillStyle(a,h),t.fillRoundedRect(.5*-p,.5*-f,p,f,n,n),t.fillStyle(r,s),t.fillRoundedRect(.5*-e,.5*-i,e,i,n,n)}else t.fillRoundedRect(c,d,e,i,n,n)}r.addButton=function(t,e,i,r,s){var o=arguments.length>5&&void 0!==arguments[5]?arguments[5]:{},a=o.bgSkal,h=void 0===a?1:a,l=o.textColor,u=void 0===l?"#ffffff":l,c=o.xRatio,d=void 0===c?.5:c,p=o.yRatio,f=void 0===p?.5:p,m=o.wRatio,g=void 0===m?.8:m,v=o.hRatio,y=void 0===v?.8:v,x=o.hasStroke,w=void 0!==x&&x,b=o.strokeColor,A=void 0===b?"#000000":b,T=o.strokePower,S=void 0===T?6:T,E=o.hasShadow,M=void 0!==E&&E,_=o.shadowX,C=void 0===_?0:_,P=o.shadowY,R=void 0===P?8:P,L=o.shadowColor,O=void 0===L?"#333333":L,D=o.shadowBlur,B=void 0===D?2:D,I=o.padding,F=void 0===I?0:I,k=o.fntSize,N=void 0===k?64:k,z=arguments.length>6&&void 0!==arguments[6]?arguments[6]:"Arial",U=new n.a,V=t.add.image(0,0,e,i);V.scale=h;var H=t.add.text(0,0,r,{color:u,align:"center",fontSize:N,fontFamily:z,padding:F}).setOrigin(.5);return w&&H.setStroke(A,S),M&&H.setShadow(C,R,O,B,w,!w),H.setScale(Math.min(V.width*g/H.width,V.height*y/H.height)),H.x=V.width*(d-.5),H.y=V.height*(f-.5),U.add(V),U.setInitials(),U.add(H),U.bg=V,U.text=H,U.width=V.width,U.height=V.height,s&&(V.setInteractive(),V.on("pointerdown",(function(t,e,i,n){s()}))),U},r.addGraphicsButton=function(t,e){var i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"#ffffff",n=arguments.length>3?arguments[3]:void 0,r=arguments.length>4&&void 0!==arguments[4]?arguments[4]:{color:10027008,width:400,height:80,opacity:1,roundCorners:0,stroke:0,strokeColor:0,strokeOpacity:1,shadowX:0,shadowY:5,shadowColor:0,shadowOpacity:.5},o=arguments.length>5&&void 0!==arguments[5]?arguments[5]:{xRatio:.5,yRatio:.45,wRatio:.8,hRatio:.8,hasStroke:!0,strokeColor:"#000000",strokePower:6,hasShadow:!0,shadowX:0,shadowY:8,shadowColor:"#333333",shadowBlur:2};r.stroke=r.stroke||0;var a=t.add.container(),h=t.add.graphics();h.width=r.width,h.height=r.height,(r.shadowX||r.shadowY)&&s(h,r.width+2*r.stroke,r.height+2*r.stroke,r.roundCorners,r.shadowColor,r.shadowOpacity,null,0,0,r.shadowX,r.shadowY),s(h,r.width,r.height,r.roundCorners,r.color,r.opacity,r.stroke,r.strokeColor,r.strokeOpacity);var l=t.add.text(0,0,e,{color:i,align:"center",fontSize:64,fontFamily:"Arial"}).setOrigin(.5);o.hasStroke&&l.setStroke(o.strokeColor,o.strokePower),o.hasShadow&&l.setShadow(o.shadowX,o.shadowY,o.shadowColor,o.shadowBlur,o.hasStroke,!o.hasStroke);var u=o;return l.setScale(Math.min(h.width*u.wRatio/l.width,h.height*u.hRatio/l.height)),l.x=h.width*(u.xRatio-.5),l.y=h.height*(u.yRatio-.5),a.add(h),a.add(l),a.bg=h,a.text=l,a.width=h.width,a.height=h.height,n&&(a.setInteractive(new Phaser.Geom.Rectangle(0,0,r.width,r.height),Phaser.Geom.Rectangle.Contains),a.on("pointerdown",n)),a},e.a=r},function(t,e,i){"use strict";i.d(e,"a",(function(){return T}));class n{constructor(t,e,i,r,s="div"){this.parent=t,this.object=e,this.property=i,this._disabled=!1,this.initialValue=this.getValue(),this.domElement=document.createElement("div"),this.domElement.classList.add("controller"),this.domElement.classList.add(r),this.$name=document.createElement("div"),this.$name.classList.add("name"),n.nextNameID=n.nextNameID||0,this.$name.id="lil-gui-name-"+ ++n.nextNameID,this.$widget=document.createElement(s),this.$widget.classList.add("widget"),this.$disable=this.$widget,this.domElement.appendChild(this.$name),this.domElement.appendChild(this.$widget),this.parent.children.push(this),this.parent.controllers.push(this),this.parent.$children.appendChild(this.domElement),this._listenCallback=this._listenCallback.bind(this),this.name(i)}name(t){return this._name=t,this.$name.innerHTML=t,this}onChange(t){return this._onChange=t,this}_callOnChange(){this.parent._callOnChange(this),void 0!==this._onChange&&this._onChange.call(this,this.getValue()),this._changed=!0}onFinishChange(t){return this._onFinishChange=t,this}_callOnFinishChange(){this._changed&&(this.parent._callOnFinishChange(this),void 0!==this._onFinishChange&&this._onFinishChange.call(this,this.getValue())),this._changed=!1}reset(){return this.setValue(this.initialValue),this._callOnFinishChange(),this}enable(t=!0){return this.disable(!t)}disable(t=!0){return t===this._disabled||(this._disabled=t,this.domElement.classList.toggle("disabled",t),this.$disable.toggleAttribute("disabled",t)),this}options(t){const e=this.parent.add(this.object,this.property,t);return e.name(this._name),this.destroy(),e}min(t){return this}max(t){return this}step(t){return this}listen(t=!0){return this._listening=t,void 0!==this._listenCallbackID&&(cancelAnimationFrame(this._listenCallbackID),this._listenCallbackID=void 0),this._listening&&this._listenCallback(),this}_listenCallback(){this._listenCallbackID=requestAnimationFrame(this._listenCallback);const t=this.save();t!==this._listenPrevValue&&this.updateDisplay(),this._listenPrevValue=t}getValue(){return this.object[this.property]}setValue(t){return this.object[this.property]=t,this._callOnChange(),this.updateDisplay(),this}updateDisplay(){return this}load(t){return this.setValue(t),this._callOnFinishChange(),this}save(){return this.getValue()}destroy(){this.listen(!1),this.parent.children.splice(this.parent.children.indexOf(this),1),this.parent.controllers.splice(this.parent.controllers.indexOf(this),1),this.parent.$children.removeChild(this.domElement)}}class r extends n{constructor(t,e,i){super(t,e,i,"boolean","label"),this.$input=document.createElement("input"),this.$input.setAttribute("type","checkbox"),this.$input.setAttribute("aria-labelledby",this.$name.id),this.$widget.appendChild(this.$input),this.$input.addEventListener("change",()=>{this.setValue(this.$input.checked),this._callOnFinishChange()}),this.$disable=this.$input,this.updateDisplay()}updateDisplay(){return this.$input.checked=this.getValue(),this}}function s(t){let e,i;return(e=t.match(/(#|0x)?([a-f0-9]{6})/i))?i=e[2]:(e=t.match(/rgb\(\s*(\d*)\s*,\s*(\d*)\s*,\s*(\d*)\s*\)/))?i=parseInt(e[1]).toString(16).padStart(2,0)+parseInt(e[2]).toString(16).padStart(2,0)+parseInt(e[3]).toString(16).padStart(2,0):(e=t.match(/^#?([a-f0-9])([a-f0-9])([a-f0-9])$/i))&&(i=e[1]+e[1]+e[2]+e[2]+e[3]+e[3]),!!i&&"#"+i}const o={isPrimitive:!0,match:t=>"string"==typeof t,fromHexString:s,toHexString:s},a={isPrimitive:!0,match:t=>"number"==typeof t,fromHexString:t=>parseInt(t.substring(1),16),toHexString:t=>"#"+t.toString(16).padStart(6,0)},h={isPrimitive:!1,match:Array.isArray,fromHexString(t,e,i=1){const n=a.fromHexString(t);e[0]=(n>>16&255)/255*i,e[1]=(n>>8&255)/255*i,e[2]=(255&n)/255*i},toHexString:([t,e,i],n=1)=>a.toHexString(t*(n=255/n)<<16^e*n<<8^i*n<<0)},l={isPrimitive:!1,match:t=>Object(t)===t,fromHexString(t,e,i=1){const n=a.fromHexString(t);e.r=(n>>16&255)/255*i,e.g=(n>>8&255)/255*i,e.b=(255&n)/255*i},toHexString:({r:t,g:e,b:i},n=1)=>a.toHexString(t*(n=255/n)<<16^e*n<<8^i*n<<0)},u=[o,a,h,l];class c extends n{constructor(t,e,i,n){var r;super(t,e,i,"color"),this.$input=document.createElement("input"),this.$input.setAttribute("type","color"),this.$input.setAttribute("tabindex",-1),this.$input.setAttribute("aria-labelledby",this.$name.id),this.$text=document.createElement("input"),this.$text.setAttribute("type","text"),this.$text.setAttribute("spellcheck","false"),this.$text.setAttribute("aria-labelledby",this.$name.id),this.$display=document.createElement("div"),this.$display.classList.add("display"),this.$display.appendChild(this.$input),this.$widget.appendChild(this.$display),this.$widget.appendChild(this.$text),this._format=(r=this.initialValue,u.find(t=>t.match(r))),this._rgbScale=n,this._initialValueHexString=this.save(),this._textFocused=!1,this.$input.addEventListener("input",()=>{this._setValueFromHexString(this.$input.value)}),this.$input.addEventListener("blur",()=>{this._callOnFinishChange()}),this.$text.addEventListener("input",()=>{const t=s(this.$text.value);t&&this._setValueFromHexString(t)}),this.$text.addEventListener("focus",()=>{this._textFocused=!0,this.$text.select()}),this.$text.addEventListener("blur",()=>{this._textFocused=!1,this.updateDisplay(),this._callOnFinishChange()}),this.$disable=this.$text,this.updateDisplay()}reset(){return this._setValueFromHexString(this._initialValueHexString),this}_setValueFromHexString(t){if(this._format.isPrimitive){const e=this._format.fromHexString(t);this.setValue(e)}else this._format.fromHexString(t,this.getValue(),this._rgbScale),this._callOnChange(),this.updateDisplay()}save(){return this._format.toHexString(this.getValue(),this._rgbScale)}load(t){return this._setValueFromHexString(t),this._callOnFinishChange(),this}updateDisplay(){return this.$input.value=this._format.toHexString(this.getValue(),this._rgbScale),this._textFocused||(this.$text.value=this.$input.value.substring(1)),this.$display.style.backgroundColor=this.$input.value,this}}class d extends n{constructor(t,e,i){super(t,e,i,"function"),this.$button=document.createElement("button"),this.$button.appendChild(this.$name),this.$widget.appendChild(this.$button),this.$button.addEventListener("click",t=>{t.preventDefault(),this.getValue().call(this.object)}),this.$button.addEventListener("touchstart",()=>{},{passive:!0}),this.$disable=this.$button}}class p extends n{constructor(t,e,i,n,r,s){super(t,e,i,"number"),this._initInput(),this.min(n),this.max(r);const o=void 0!==s;this.step(o?s:this._getImplicitStep(),o),this.updateDisplay()}min(t){return this._min=t,this._onUpdateMinMax(),this}max(t){return this._max=t,this._onUpdateMinMax(),this}step(t,e=!0){return this._step=t,this._stepExplicit=e,this}updateDisplay(){const t=this.getValue();if(this._hasSlider){let e=(t-this._min)/(this._max-this._min);e=Math.max(0,Math.min(e,1)),this.$fill.style.width=100*e+"%"}return this._inputFocused||(this.$input.value=t),this}_initInput(){this.$input=document.createElement("input"),this.$input.setAttribute("type","number"),this.$input.setAttribute("step","any"),this.$input.setAttribute("aria-labelledby",this.$name.id),this.$widget.appendChild(this.$input),this.$disable=this.$input;const t=t=>{const e=parseFloat(this.$input.value);isNaN(e)||(this._snapClampSetValue(e+t),this.$input.value=this.getValue())};let e,i,n,r,s,o=!1;const a=t=>{if(o){const n=t.clientX-e,r=t.clientY-i;Math.abs(r)>5?(t.preventDefault(),this.$input.blur(),o=!1,this._setDraggingStyle(!0,"vertical")):Math.abs(n)>5&&h()}if(!o){const e=t.clientY-n;s-=e*this._step*this._arrowKeyMultiplier(t),r+s>this._max?s=this._max-r:r+s{this._setDraggingStyle(!1,"vertical"),this._callOnFinishChange(),window.removeEventListener("mousemove",a),window.removeEventListener("mouseup",h)};this.$input.addEventListener("input",()=>{const t=parseFloat(this.$input.value);isNaN(t)||this.setValue(this._clamp(t))}),this.$input.addEventListener("keydown",e=>{"Enter"===e.code&&this.$input.blur(),"ArrowUp"===e.code&&(e.preventDefault(),t(this._step*this._arrowKeyMultiplier(e))),"ArrowDown"===e.code&&(e.preventDefault(),t(this._step*this._arrowKeyMultiplier(e)*-1))}),this.$input.addEventListener("wheel",e=>{this._inputFocused&&(e.preventDefault(),t(this._step*this._normalizeMouseWheel(e)))},{passive:!1}),this.$input.addEventListener("mousedown",t=>{e=t.clientX,i=n=t.clientY,o=!0,r=this.getValue(),s=0,window.addEventListener("mousemove",a),window.addEventListener("mouseup",h)}),this.$input.addEventListener("focus",()=>{this._inputFocused=!0}),this.$input.addEventListener("blur",()=>{this._inputFocused=!1,this.updateDisplay(),this._callOnFinishChange()})}_initSlider(){this._hasSlider=!0,this.$slider=document.createElement("div"),this.$slider.classList.add("slider"),this.$fill=document.createElement("div"),this.$fill.classList.add("fill"),this.$slider.appendChild(this.$fill),this.$widget.insertBefore(this.$slider,this.$input),this.domElement.classList.add("hasSlider");const t=t=>{const e=this.$slider.getBoundingClientRect();let i=(n=t,r=e.left,s=e.right,o=this._min,a=this._max,(n-r)/(s-r)*(a-o)+o);var n,r,s,o,a;this._snapClampSetValue(i)},e=e=>{t(e.clientX)},i=()=>{this._callOnFinishChange(),this._setDraggingStyle(!1),window.removeEventListener("mousemove",e),window.removeEventListener("mouseup",i)};let n,r,s=!1;const o=e=>{e.preventDefault(),this._setDraggingStyle(!0),t(e.touches[0].clientX),s=!1},a=e=>{if(s){const t=e.touches[0].clientX-n,i=e.touches[0].clientY-r;Math.abs(t)>Math.abs(i)?o(e):(window.removeEventListener("touchmove",a),window.removeEventListener("touchend",h))}else e.preventDefault(),t(e.touches[0].clientX)},h=()=>{this._callOnFinishChange(),this._setDraggingStyle(!1),window.removeEventListener("touchmove",a),window.removeEventListener("touchend",h)},l=this._callOnFinishChange.bind(this);let u;this.$slider.addEventListener("mousedown",n=>{this._setDraggingStyle(!0),t(n.clientX),window.addEventListener("mousemove",e),window.addEventListener("mouseup",i)}),this.$slider.addEventListener("touchstart",t=>{t.touches.length>1||(this._hasScrollBar?(n=t.touches[0].clientX,r=t.touches[0].clientY,s=!0):o(t),window.addEventListener("touchmove",a),window.addEventListener("touchend",h))},{passive:!1}),this.$slider.addEventListener("wheel",t=>{if(Math.abs(t.deltaX)this._max&&(t=this._max),t}_snapClampSetValue(t){this.setValue(this._clamp(this._snap(t)))}get _hasScrollBar(){const t=this.parent.root.$children;return t.scrollHeight>t.clientHeight}get _hasMin(){return void 0!==this._min}get _hasMax(){return void 0!==this._max}}class f extends n{constructor(t,e,i,n){super(t,e,i,"option"),this.$select=document.createElement("select"),this.$select.setAttribute("aria-labelledby",this.$name.id),this.$display=document.createElement("div"),this.$display.classList.add("display"),this._values=Array.isArray(n)?n:Object.values(n),this._names=Array.isArray(n)?n:Object.keys(n),this._names.forEach(t=>{const e=document.createElement("option");e.innerHTML=t,this.$select.appendChild(e)}),this.$select.addEventListener("change",()=>{this.setValue(this._values[this.$select.selectedIndex]),this._callOnFinishChange()}),this.$select.addEventListener("focus",()=>{this.$display.classList.add("focus")}),this.$select.addEventListener("blur",()=>{this.$display.classList.remove("focus")}),this.$widget.appendChild(this.$select),this.$widget.appendChild(this.$display),this.$disable=this.$select,this.updateDisplay()}updateDisplay(){const t=this.getValue(),e=this._values.indexOf(t);return this.$select.selectedIndex=e,this.$display.innerHTML=-1===e?t:this._names[e],this}}class m extends n{constructor(t,e,i){super(t,e,i,"string"),this.$input=document.createElement("input"),this.$input.setAttribute("type","text"),this.$input.setAttribute("aria-labelledby",this.$name.id),this.$input.addEventListener("input",()=>{this.setValue(this.$input.value)}),this.$input.addEventListener("keydown",t=>{"Enter"===t.code&&this.$input.blur()}),this.$input.addEventListener("blur",()=>{this._callOnFinishChange()}),this.$widget.appendChild(this.$input),this.$disable=this.$input,this.updateDisplay()}updateDisplay(){return this.$input.value=this.getValue(),this}}let g=!1;class v{constructor({parent:t,autoPlace:e=void 0===t,container:i,width:n,title:r="Controls",injectStyles:s=!0,touchStyles:o=!0}={}){if(this.parent=t,this.root=t?t.root:this,this.children=[],this.controllers=[],this.folders=[],this._closed=!1,this._hidden=!1,this.domElement=document.createElement("div"),this.domElement.classList.add("lil-gui"),this.$title=document.createElement("div"),this.$title.classList.add("title"),this.$title.setAttribute("role","button"),this.$title.setAttribute("aria-expanded",!0),this.$title.setAttribute("tabindex",0),this.$title.addEventListener("click",()=>this.openAnimated(this._closed)),this.$title.addEventListener("keydown",t=>{"Enter"!==t.code&&"Space"!==t.code||(t.preventDefault(),this.$title.click())}),this.$title.addEventListener("touchstart",()=>{},{passive:!0}),this.$children=document.createElement("div"),this.$children.classList.add("children"),this.domElement.appendChild(this.$title),this.domElement.appendChild(this.$children),this.title(r),o&&this.domElement.classList.add("allow-touch-styles"),this.parent)return this.parent.children.push(this),this.parent.folders.push(this),void this.parent.$children.appendChild(this.domElement);this.domElement.classList.add("root"),!g&&s&&(!function(t){const e=document.createElement("style");e.innerHTML=t;const i=document.querySelector("head link[rel=stylesheet], head style");i?document.head.insertBefore(e,i):document.head.appendChild(e)}('.lil-gui {\n font-family: var(--font-family);\n font-size: var(--font-size);\n line-height: 1;\n font-weight: normal;\n font-style: normal;\n text-align: left;\n background-color: var(--background-color);\n color: var(--text-color);\n user-select: none;\n -webkit-user-select: none;\n touch-action: manipulation;\n --background-color: #1f1f1f;\n --text-color: #ebebeb;\n --title-background-color: #111111;\n --title-text-color: #ebebeb;\n --widget-color: #424242;\n --hover-color: #4f4f4f;\n --focus-color: #595959;\n --number-color: #2cc9ff;\n --string-color: #a2db3c;\n --font-size: 11px;\n --input-font-size: 11px;\n --font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;\n --font-family-mono: Menlo, Monaco, Consolas, "Droid Sans Mono", monospace;\n --padding: 4px;\n --spacing: 4px;\n --widget-height: 20px;\n --name-width: 45%;\n --slider-knob-width: 2px;\n --slider-input-width: 27%;\n --color-input-width: 27%;\n --slider-input-min-width: 45px;\n --color-input-min-width: 45px;\n --folder-indent: 7px;\n --widget-padding: 0 0 0 3px;\n --widget-border-radius: 2px;\n --checkbox-size: calc(0.75 * var(--widget-height));\n --scrollbar-width: 5px;\n}\n.lil-gui, .lil-gui * {\n box-sizing: border-box;\n margin: 0;\n padding: 0;\n}\n.lil-gui.root {\n width: var(--width, 245px);\n display: flex;\n flex-direction: column;\n}\n.lil-gui.root > .title {\n background: var(--title-background-color);\n color: var(--title-text-color);\n}\n.lil-gui.root > .children {\n overflow-x: hidden;\n overflow-y: auto;\n}\n.lil-gui.root > .children::-webkit-scrollbar {\n width: var(--scrollbar-width);\n height: var(--scrollbar-width);\n background: var(--background-color);\n}\n.lil-gui.root > .children::-webkit-scrollbar-thumb {\n border-radius: var(--scrollbar-width);\n background: var(--focus-color);\n}\n@media (pointer: coarse) {\n .lil-gui.allow-touch-styles {\n --widget-height: 28px;\n --padding: 6px;\n --spacing: 6px;\n --font-size: 13px;\n --input-font-size: 16px;\n --folder-indent: 10px;\n --scrollbar-width: 7px;\n --slider-input-min-width: 50px;\n --color-input-min-width: 65px;\n }\n}\n.lil-gui.force-touch-styles {\n --widget-height: 28px;\n --padding: 6px;\n --spacing: 6px;\n --font-size: 13px;\n --input-font-size: 16px;\n --folder-indent: 10px;\n --scrollbar-width: 7px;\n --slider-input-min-width: 50px;\n --color-input-min-width: 65px;\n}\n.lil-gui.autoPlace {\n max-height: 100%;\n position: fixed;\n top: 0;\n right: 15px;\n z-index: 1001;\n}\n\n.lil-gui .controller {\n display: flex;\n align-items: center;\n padding: 0 var(--padding);\n margin: var(--spacing) 0;\n}\n.lil-gui .controller.disabled {\n opacity: 0.5;\n}\n.lil-gui .controller.disabled, .lil-gui .controller.disabled * {\n pointer-events: none !important;\n}\n.lil-gui .controller > .name {\n min-width: var(--name-width);\n flex-shrink: 0;\n white-space: pre;\n padding-right: var(--spacing);\n line-height: var(--widget-height);\n}\n.lil-gui .controller .widget {\n position: relative;\n display: flex;\n align-items: center;\n width: 100%;\n min-height: var(--widget-height);\n}\n.lil-gui .controller.string input {\n color: var(--string-color);\n}\n.lil-gui .controller.boolean .widget {\n cursor: pointer;\n}\n.lil-gui .controller.color .display {\n width: 100%;\n height: var(--widget-height);\n border-radius: var(--widget-border-radius);\n position: relative;\n}\n@media (hover: hover) {\n .lil-gui .controller.color .display:hover:before {\n content: " ";\n display: block;\n position: absolute;\n border-radius: var(--widget-border-radius);\n border: 1px solid #fff9;\n top: 0;\n right: 0;\n bottom: 0;\n left: 0;\n }\n}\n.lil-gui .controller.color input[type=color] {\n opacity: 0;\n width: 100%;\n height: 100%;\n cursor: pointer;\n}\n.lil-gui .controller.color input[type=text] {\n margin-left: var(--spacing);\n font-family: var(--font-family-mono);\n min-width: var(--color-input-min-width);\n width: var(--color-input-width);\n flex-shrink: 0;\n}\n.lil-gui .controller.option select {\n opacity: 0;\n position: absolute;\n width: 100%;\n max-width: 100%;\n}\n.lil-gui .controller.option .display {\n position: relative;\n pointer-events: none;\n border-radius: var(--widget-border-radius);\n height: var(--widget-height);\n line-height: var(--widget-height);\n max-width: 100%;\n overflow: hidden;\n word-break: break-all;\n padding-left: 0.55em;\n padding-right: 1.75em;\n background: var(--widget-color);\n}\n@media (hover: hover) {\n .lil-gui .controller.option .display.focus {\n background: var(--focus-color);\n }\n}\n.lil-gui .controller.option .display.active {\n background: var(--focus-color);\n}\n.lil-gui .controller.option .display:after {\n font-family: "lil-gui";\n content: "↕";\n position: absolute;\n top: 0;\n right: 0;\n bottom: 0;\n padding-right: 0.375em;\n}\n.lil-gui .controller.option .widget,\n.lil-gui .controller.option select {\n cursor: pointer;\n}\n@media (hover: hover) {\n .lil-gui .controller.option .widget:hover .display {\n background: var(--hover-color);\n }\n}\n.lil-gui .controller.number input {\n color: var(--number-color);\n}\n.lil-gui .controller.number.hasSlider input {\n margin-left: var(--spacing);\n width: var(--slider-input-width);\n min-width: var(--slider-input-min-width);\n flex-shrink: 0;\n}\n.lil-gui .controller.number .slider {\n width: 100%;\n height: var(--widget-height);\n background-color: var(--widget-color);\n border-radius: var(--widget-border-radius);\n padding-right: var(--slider-knob-width);\n overflow: hidden;\n cursor: ew-resize;\n touch-action: pan-y;\n}\n@media (hover: hover) {\n .lil-gui .controller.number .slider:hover {\n background-color: var(--hover-color);\n }\n}\n.lil-gui .controller.number .slider.active {\n background-color: var(--focus-color);\n}\n.lil-gui .controller.number .slider.active .fill {\n opacity: 0.95;\n}\n.lil-gui .controller.number .fill {\n height: 100%;\n border-right: var(--slider-knob-width) solid var(--number-color);\n box-sizing: content-box;\n}\n\n.lil-gui-dragging .lil-gui {\n --hover-color: var(--widget-color);\n}\n.lil-gui-dragging * {\n cursor: ew-resize !important;\n}\n\n.lil-gui-dragging.lil-gui-vertical * {\n cursor: ns-resize !important;\n}\n\n.lil-gui .title {\n --title-height: calc(var(--widget-height) + var(--spacing) * 1.25);\n height: var(--title-height);\n line-height: calc(var(--title-height) - 4px);\n font-weight: 600;\n padding: 0 var(--padding);\n -webkit-tap-highlight-color: transparent;\n cursor: pointer;\n outline: none;\n text-decoration-skip: objects;\n}\n.lil-gui .title:before {\n font-family: "lil-gui";\n content: "▾";\n padding-right: 2px;\n display: inline-block;\n}\n.lil-gui .title:active {\n background: var(--title-background-color);\n opacity: 0.75;\n}\n@media (hover: hover) {\n body:not(.lil-gui-dragging) .lil-gui .title:hover {\n background: var(--title-background-color);\n opacity: 0.85;\n }\n .lil-gui .title:focus {\n text-decoration: underline var(--focus-color);\n }\n}\n.lil-gui.root > .title:focus {\n text-decoration: none !important;\n}\n.lil-gui.closed > .title:before {\n content: "▸";\n}\n.lil-gui.closed > .children {\n transform: translateY(-7px);\n opacity: 0;\n}\n.lil-gui.closed:not(.transition) > .children {\n display: none;\n}\n.lil-gui.transition > .children {\n transition-duration: 300ms;\n transition-property: height, opacity, transform;\n transition-timing-function: cubic-bezier(0.2, 0.6, 0.35, 1);\n overflow: hidden;\n pointer-events: none;\n}\n.lil-gui .children:empty:before {\n content: "Empty";\n padding: 0 var(--padding);\n margin: var(--spacing) 0;\n display: block;\n height: var(--widget-height);\n font-style: italic;\n line-height: var(--widget-height);\n opacity: 0.5;\n}\n.lil-gui.root > .children > .lil-gui > .title {\n border: 0 solid var(--widget-color);\n border-width: 1px 0;\n transition: border-color 300ms;\n}\n.lil-gui.root > .children > .lil-gui.closed > .title {\n border-bottom-color: transparent;\n}\n.lil-gui + .controller {\n border-top: 1px solid var(--widget-color);\n margin-top: 0;\n padding-top: var(--spacing);\n}\n.lil-gui .lil-gui .lil-gui > .title {\n border: none;\n}\n.lil-gui .lil-gui .lil-gui > .children {\n border: none;\n margin-left: var(--folder-indent);\n border-left: 2px solid var(--widget-color);\n}\n.lil-gui .lil-gui .controller {\n border: none;\n}\n\n.lil-gui input {\n -webkit-tap-highlight-color: transparent;\n border: 0;\n outline: none;\n font-family: var(--font-family);\n font-size: var(--input-font-size);\n border-radius: var(--widget-border-radius);\n height: var(--widget-height);\n background: var(--widget-color);\n color: var(--text-color);\n width: 100%;\n}\n@media (hover: hover) {\n .lil-gui input:hover {\n background: var(--hover-color);\n }\n .lil-gui input:active {\n background: var(--focus-color);\n }\n}\n.lil-gui input:disabled {\n opacity: 1;\n}\n.lil-gui input[type=text],\n.lil-gui input[type=number] {\n padding: var(--widget-padding);\n}\n.lil-gui input[type=text]:focus,\n.lil-gui input[type=number]:focus {\n background: var(--focus-color);\n}\n.lil-gui input::-webkit-outer-spin-button,\n.lil-gui input::-webkit-inner-spin-button {\n -webkit-appearance: none;\n margin: 0;\n}\n.lil-gui input[type=number] {\n -moz-appearance: textfield;\n}\n.lil-gui input[type=checkbox] {\n appearance: none;\n -webkit-appearance: none;\n height: var(--checkbox-size);\n width: var(--checkbox-size);\n border-radius: var(--widget-border-radius);\n text-align: center;\n cursor: pointer;\n}\n.lil-gui input[type=checkbox]:checked:before {\n font-family: "lil-gui";\n content: "✓";\n font-size: var(--checkbox-size);\n line-height: var(--checkbox-size);\n}\n@media (hover: hover) {\n .lil-gui input[type=checkbox]:focus {\n box-shadow: inset 0 0 0 1px var(--focus-color);\n }\n}\n.lil-gui button {\n -webkit-tap-highlight-color: transparent;\n outline: none;\n cursor: pointer;\n font-family: var(--font-family);\n font-size: var(--font-size);\n color: var(--text-color);\n width: 100%;\n height: var(--widget-height);\n text-transform: none;\n background: var(--widget-color);\n border-radius: var(--widget-border-radius);\n border: 1px solid var(--widget-color);\n text-align: center;\n line-height: calc(var(--widget-height) - 4px);\n}\n@media (hover: hover) {\n .lil-gui button:hover {\n background: var(--hover-color);\n border-color: var(--hover-color);\n }\n .lil-gui button:focus {\n border-color: var(--focus-color);\n }\n}\n.lil-gui button:active {\n background: var(--focus-color);\n}\n\n@font-face {\n font-family: "lil-gui";\n src: url("data:application/font-woff;charset=utf-8;base64,d09GRgABAAAAAAUsAAsAAAAACJwAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAABHU1VCAAABCAAAAH4AAADAImwmYE9TLzIAAAGIAAAAPwAAAGBKqH5SY21hcAAAAcgAAAD0AAACrukyyJBnbHlmAAACvAAAAF8AAACEIZpWH2hlYWQAAAMcAAAAJwAAADZfcj2zaGhlYQAAA0QAAAAYAAAAJAC5AHhobXR4AAADXAAAABAAAABMAZAAAGxvY2EAAANsAAAAFAAAACgCEgIybWF4cAAAA4AAAAAeAAAAIAEfABJuYW1lAAADoAAAASIAAAIK9SUU/XBvc3QAAATEAAAAZgAAAJCTcMc2eJxVjbEOgjAURU+hFRBK1dGRL+ALnAiToyMLEzFpnPz/eAshwSa97517c/MwwJmeB9kwPl+0cf5+uGPZXsqPu4nvZabcSZldZ6kfyWnomFY/eScKqZNWupKJO6kXN3K9uCVoL7iInPr1X5baXs3tjuMqCtzEuagm/AAlzQgPAAB4nGNgYRBlnMDAysDAYM/gBiT5oLQBAwuDJAMDEwMrMwNWEJDmmsJwgCFeXZghBcjlZMgFCzOiKOIFAB71Bb8AeJy1kjFuwkAQRZ+DwRAwBtNQRUGKQ8OdKCAWUhAgKLhIuAsVSpWz5Bbkj3dEgYiUIszqWdpZe+Z7/wB1oCYmIoboiwiLT2WjKl/jscrHfGg/pKdMkyklC5Zs2LEfHYpjcRoPzme9MWWmk3dWbK9ObkWkikOetJ554fWyoEsmdSlt+uR0pCJR34b6t/TVg1SY3sYvdf8vuiKrpyaDXDISiegp17p7579Gp3p++y7HPAiY9pmTibljrr85qSidtlg4+l25GLCaS8e6rRxNBmsnERunKbaOObRz7N72ju5vdAjYpBXHgJylOAVsMseDAPEP8LYoUHicY2BiAAEfhiAGJgZWBgZ7RnFRdnVJELCQlBSRlATJMoLV2DK4glSYs6ubq5vbKrJLSbGrgEmovDuDJVhe3VzcXFwNLCOILB/C4IuQ1xTn5FPilBTj5FPmBAB4WwoqAHicY2BkYGAA4sk1sR/j+W2+MnAzpDBgAyEMQUCSg4EJxAEAwUgFHgB4nGNgZGBgSGFggJMhDIwMqEAYAByHATJ4nGNgAIIUNEwmAABl3AGReJxjYAACIQYlBiMGJ3wQAEcQBEV4nGNgZGBgEGZgY2BiAAEQyQWEDAz/wXwGAAsPATIAAHicXdBNSsNAHAXwl35iA0UQXYnMShfS9GPZA7T7LgIu03SSpkwzYTIt1BN4Ak/gKTyAeCxfw39jZkjymzcvAwmAW/wgwHUEGDb36+jQQ3GXGot79L24jxCP4gHzF/EIr4jEIe7wxhOC3g2TMYy4Q7+Lu/SHuEd/ivt4wJd4wPxbPEKMX3GI5+DJFGaSn4qNzk8mcbKSR6xdXdhSzaOZJGtdapd4vVPbi6rP+cL7TGXOHtXKll4bY1Xl7EGnPtp7Xy2n00zyKLVHfkHBa4IcJ2oD3cgggWvt/V/FbDrUlEUJhTn/0azVWbNTNr0Ens8de1tceK9xZmfB1CPjOmPH4kitmvOubcNpmVTN3oFJyjzCvnmrwhJTzqzVj9jiSX911FjeAAB4nG3HMRKCMBBA0f0giiKi4DU8k0V2GWbIZDOh4PoWWvq6J5V8If9NVNQcaDhyouXMhY4rPTcG7jwYmXhKq8Wz+p762aNaeYXom2n3m2dLTVgsrCgFJ7OTmIkYbwIbC6vIB7WmFfAAAA==") format("woff");\n}'),g=!0),i?i.appendChild(this.domElement):e&&(this.domElement.classList.add("autoPlace"),document.body.appendChild(this.domElement)),n&&this.domElement.style.setProperty("--width",n+"px"),this.domElement.addEventListener("keydown",t=>t.stopPropagation()),this.domElement.addEventListener("keyup",t=>t.stopPropagation())}add(t,e,i,n,s){if(Object(i)===i)return new f(this,t,e,i);switch(typeof t[e]){case"number":return new p(this,t,e,i,n,s);case"boolean":return new r(this,t,e);case"string":return new m(this,t,e);case"function":return new d(this,t,e)}}addColor(t,e,i=1){return new c(this,t,e,i)}addFolder(t){return new v({parent:this,title:t})}load(t,e=!0){return t.controllers&&this.controllers.forEach(e=>{e instanceof d||e._name in t.controllers&&e.load(t.controllers[e._name])}),e&&t.folders&&this.folders.forEach(e=>{e._title in t.folders&&e.load(t.folders[e._title])}),this}save(t=!0){const e={controllers:{},folders:{}};return this.controllers.forEach(t=>{if(!(t instanceof d)){if(t._name in e.controllers)throw new Error(`Cannot save GUI with duplicate property "${t._name}"`);e.controllers[t._name]=t.save()}}),t&&this.folders.forEach(t=>{if(t._title in e.folders)throw new Error(`Cannot save GUI with duplicate folder "${t._title}"`);e.folders[t._title]=t.save()}),e}open(t=!0){return this._closed=!t,this.$title.setAttribute("aria-expanded",!this._closed),this.domElement.classList.toggle("closed",this._closed),this}close(){return this.open(!1)}show(t=!0){return this._hidden=!t,this.domElement.style.display=this._hidden?"none":"",this}hide(){return this.show(!1)}openAnimated(t=!0){return this._closed=!t,this.$title.setAttribute("aria-expanded",!this._closed),requestAnimationFrame(()=>{const e=this.$children.clientHeight;this.$children.style.height=e+"px",this.domElement.classList.add("transition");const i=t=>{t.target===this.$children&&(this.$children.style.height="",this.domElement.classList.remove("transition"),this.$children.removeEventListener("transitionend",i))};this.$children.addEventListener("transitionend",i);const n=t?this.$children.scrollHeight:0;this.domElement.classList.toggle("closed",!t),requestAnimationFrame(()=>{this.$children.style.height=n+"px"})}),this}title(t){return this._title=t,this.$title.innerHTML=t,this}reset(t=!0){return(t?this.controllersRecursive():this.controllers).forEach(t=>t.reset()),this}onChange(t){return this._onChange=t,this}_callOnChange(t){this.parent&&this.parent._callOnChange(t),void 0!==this._onChange&&this._onChange.call(this,{object:t.object,property:t.property,value:t.getValue(),controller:t})}onFinishChange(t){return this._onFinishChange=t,this}_callOnFinishChange(t){this.parent&&this.parent._callOnFinishChange(t),void 0!==this._onFinishChange&&this._onFinishChange.call(this,{object:t.object,property:t.property,value:t.getValue(),controller:t})}destroy(){this.parent&&(this.parent.children.splice(this.parent.children.indexOf(this),1),this.parent.folders.splice(this.parent.folders.indexOf(this),1)),this.domElement.parentElement&&this.domElement.parentElement.removeChild(this.domElement),Array.from(this.children).forEach(t=>t.destroy())}controllersRecursive(){let t=Array.from(this.controllers);return this.folders.forEach(e=>{t=t.concat(e.controllersRecursive())}),t}foldersRecursive(){let t=Array.from(this.folders);return this.folders.forEach(e=>{t=t.concat(e.foldersRecursive())}),t}}var y=v,x=i(54),w=i.n(x),b=i(6);function A(t,e){for(var i=0;i1&&void 0!==arguments[1]?arguments[1]:1,i=arguments.length>2?arguments[2]:void 0,n=t.name||"jondoe",r=this.gui.addFolder(n);i?(r.add(t.position,"x",-i,i,e),r.add(t.position,"y",-i,i,e),r.add(t.position,"z",-i,i,e)):(r.add(t.position,"x").step(e),r.add(t.position,"y").step(e),r.add(t.position,"z").step(e))}},{key:"addColorThree",value:function(t,e){var i={val:"#"+t.getHexString()};this.gui.addColor(i,"val").name(e).onChange((function(e){t.set(e),t.convertSRGBToLinear()}))}},{key:"addOriginBox",value:function(){var t=b.a.createBox();return t.material.transparent=!0,t.material.depthTest=!1,t.material.depthWrite=!1,t.material.opacity=.5,t}}],(i=null)&&A(e.prototype,i),n&&A(e,n),Object.defineProperty(e,"prototype",{writable:!1}),t}()},function(t,e,i){"use strict";i.d(e,"a",(function(){return dt}));var n=i(0),r=0,s="varying vec2 vUv;void main(){vUv=position.xy*0.5+0.5;gl_Position=vec4(position.xy,1.0,1.0);}";n.ShaderMaterial,n.ShaderMaterial;function o(t,e,i){return t*(e-i)-e}function a(t,e,i){return Math.min(Math.max((t+e)/(e-i),0),1)}n.ShaderMaterial,n.ShaderMaterial;var h=class extends n.ShaderMaterial{constructor(){super({name:"CopyMaterial",uniforms:{inputBuffer:new n.Uniform(null),opacity:new n.Uniform(1)},blending:n.NoBlending,depthWrite:!1,depthTest:!1,fragmentShader:"#ifdef FRAMEBUFFER_PRECISION_HIGH\nuniform mediump sampler2D inputBuffer;\n#else\nuniform lowp sampler2D inputBuffer;\n#endif\nuniform float opacity;varying vec2 vUv;void main(){vec4 texel=texture2D(inputBuffer,vUv);gl_FragColor=opacity*texel;\n#include \n}",vertexShader:s}),this.toneMapped=!1}set inputBuffer(t){this.uniforms.inputBuffer.value=t}setInputBuffer(t){this.uniforms.inputBuffer.value=t}getOpacity(t){return this.uniforms.opacity.value}setOpacity(t){this.uniforms.opacity.value=t}},l=(n.ShaderMaterial,0),u=(n.ShaderMaterial,n.ShaderMaterial,1),c=2,d=(n.ShaderMaterial,0),p=2,f=0,m=1,g=class extends n.ShaderMaterial{constructor(t=new n.Vector2,e=p){super({name:"EdgeDetectionMaterial",defines:{LOCAL_CONTRAST_ADAPTATION_FACTOR:"2.0",EDGE_THRESHOLD:"0.1",DEPTH_THRESHOLD:"0.01",PREDICATION_MODE:"0",PREDICATION_THRESHOLD:"0.01",PREDICATION_SCALE:"2.0",PREDICATION_STRENGTH:"1.0",DEPTH_PACKING:"0"},uniforms:{inputBuffer:new n.Uniform(null),depthBuffer:new n.Uniform(null),predicationBuffer:new n.Uniform(null),texelSize:new n.Uniform(t)},blending:n.NoBlending,depthWrite:!1,depthTest:!1,fragmentShader:"varying vec2 vUv;varying vec2 vUv0;varying vec2 vUv1;\n#if EDGE_DETECTION_MODE != 0\nvarying vec2 vUv2;varying vec2 vUv3;varying vec2 vUv4;varying vec2 vUv5;\n#endif\n#if EDGE_DETECTION_MODE == 1\n#include \n#endif\n#if EDGE_DETECTION_MODE == 0 || PREDICATION_MODE == 1\n#ifdef GL_FRAGMENT_PRECISION_HIGH\nuniform highp sampler2D depthBuffer;\n#else\nuniform mediump sampler2D depthBuffer;\n#endif\nfloat readDepth(const in vec2 uv){\n#if DEPTH_PACKING == 3201\nreturn unpackRGBAToDepth(texture2D(depthBuffer,uv));\n#else\nreturn texture2D(depthBuffer,uv).r;\n#endif\n}vec3 gatherNeighbors(){float p=readDepth(vUv);float pLeft=readDepth(vUv0);float pTop=readDepth(vUv1);return vec3(p,pLeft,pTop);}\n#elif PREDICATION_MODE == 2\nuniform sampler2D predicationBuffer;vec3 gatherNeighbors(){float p=texture2D(predicationBuffer,vUv).r;float pLeft=texture2D(predicationBuffer,vUv0).r;float pTop=texture2D(predicationBuffer,vUv1).r;return vec3(p,pLeft,pTop);}\n#endif\n#if PREDICATION_MODE != 0\nvec2 calculatePredicatedThreshold(){vec3 neighbours=gatherNeighbors();vec2 delta=abs(neighbours.xx-neighbours.yz);vec2 edges=step(PREDICATION_THRESHOLD,delta);return PREDICATION_SCALE*EDGE_THRESHOLD*(1.0-PREDICATION_STRENGTH*edges);}\n#endif\n#if EDGE_DETECTION_MODE != 0\nuniform sampler2D inputBuffer;\n#endif\nvoid main(){\n#if EDGE_DETECTION_MODE == 0\nconst vec2 threshold=vec2(DEPTH_THRESHOLD);\n#elif PREDICATION_MODE != 0\nvec2 threshold=calculatePredicatedThreshold();\n#else\nconst vec2 threshold=vec2(EDGE_THRESHOLD);\n#endif\n#if EDGE_DETECTION_MODE == 0\nvec3 neighbors=gatherNeighbors();vec2 delta=abs(neighbors.xx-vec2(neighbors.y,neighbors.z));vec2 edges=step(threshold,delta);if(dot(edges,vec2(1.0))==0.0){discard;}gl_FragColor=vec4(edges,0.0,1.0);\n#elif EDGE_DETECTION_MODE == 1\nfloat l=linearToRelativeLuminance(texture2D(inputBuffer,vUv).rgb);float lLeft=linearToRelativeLuminance(texture2D(inputBuffer,vUv0).rgb);float lTop=linearToRelativeLuminance(texture2D(inputBuffer,vUv1).rgb);vec4 delta;delta.xy=abs(l-vec2(lLeft,lTop));vec2 edges=step(threshold,delta.xy);if(dot(edges,vec2(1.0))==0.0){discard;}float lRight=linearToRelativeLuminance(texture2D(inputBuffer,vUv2).rgb);float lBottom=linearToRelativeLuminance(texture2D(inputBuffer,vUv3).rgb);delta.zw=abs(l-vec2(lRight,lBottom));vec2 maxDelta=max(delta.xy,delta.zw);float lLeftLeft=linearToRelativeLuminance(texture2D(inputBuffer,vUv4).rgb);float lTopTop=linearToRelativeLuminance(texture2D(inputBuffer,vUv5).rgb);delta.zw=abs(vec2(lLeft,lTop)-vec2(lLeftLeft,lTopTop));maxDelta=max(maxDelta.xy,delta.zw);float finalDelta=max(maxDelta.x,maxDelta.y);edges.xy*=step(finalDelta,LOCAL_CONTRAST_ADAPTATION_FACTOR*delta.xy);gl_FragColor=vec4(edges,0.0,1.0);\n#elif EDGE_DETECTION_MODE == 2\nvec4 delta;vec3 c=texture2D(inputBuffer,vUv).rgb;vec3 cLeft=texture2D(inputBuffer,vUv0).rgb;vec3 t=abs(c-cLeft);delta.x=max(max(t.r,t.g),t.b);vec3 cTop=texture2D(inputBuffer,vUv1).rgb;t=abs(c-cTop);delta.y=max(max(t.r,t.g),t.b);vec2 edges=step(threshold,delta.xy);if(dot(edges,vec2(1.0))==0.0){discard;}vec3 cRight=texture2D(inputBuffer,vUv2).rgb;t=abs(c-cRight);delta.z=max(max(t.r,t.g),t.b);vec3 cBottom=texture2D(inputBuffer,vUv3).rgb;t=abs(c-cBottom);delta.w=max(max(t.r,t.g),t.b);vec2 maxDelta=max(delta.xy,delta.zw);vec3 cLeftLeft=texture2D(inputBuffer,vUv4).rgb;t=abs(c-cLeftLeft);delta.z=max(max(t.r,t.g),t.b);vec3 cTopTop=texture2D(inputBuffer,vUv5).rgb;t=abs(c-cTopTop);delta.w=max(max(t.r,t.g),t.b);maxDelta=max(maxDelta.xy,delta.zw);float finalDelta=max(maxDelta.x,maxDelta.y);edges*=step(finalDelta,LOCAL_CONTRAST_ADAPTATION_FACTOR*delta.xy);gl_FragColor=vec4(edges,0.0,1.0);\n#endif\n}",vertexShader:"uniform vec2 texelSize;varying vec2 vUv;varying vec2 vUv0;varying vec2 vUv1;\n#if EDGE_DETECTION_MODE != 0\nvarying vec2 vUv2;varying vec2 vUv3;varying vec2 vUv4;varying vec2 vUv5;\n#endif\nvoid main(){vUv=position.xy*0.5+0.5;vUv0=vUv+texelSize*vec2(-1.0,0.0);vUv1=vUv+texelSize*vec2(0.0,-1.0);\n#if EDGE_DETECTION_MODE != 0\nvUv2=vUv+texelSize*vec2(1.0,0.0);vUv3=vUv+texelSize*vec2(0.0,1.0);vUv4=vUv+texelSize*vec2(-2.0,0.0);vUv5=vUv+texelSize*vec2(0.0,-2.0);\n#endif\ngl_Position=vec4(position.xy,1.0,1.0);}"}),this.toneMapped=!1,this.edgeDetectionMode=e}set depthBuffer(t){this.uniforms.depthBuffer.value=t}set depthPacking(t){this.defines.DEPTH_PACKING=t.toFixed(0),this.needsUpdate=!0}setDepthBuffer(t,e=n.BasicDepthPacking){this.depthBuffer=t,this.depthPacking=e}get edgeDetectionMode(){return Number(this.defines.EDGE_DETECTION_MODE)}set edgeDetectionMode(t){this.defines.EDGE_DETECTION_MODE=t.toFixed(0),this.needsUpdate=!0}getEdgeDetectionMode(){return this.edgeDetectionMode}setEdgeDetectionMode(t){this.edgeDetectionMode=t}get localContrastAdaptationFactor(){return Number(this.defines.LOCAL_CONTRAST_ADAPTATION_FACTOR)}set localContrastAdaptationFactor(t){this.defines.LOCAL_CONTRAST_ADAPTATION_FACTOR=t.toFixed("6"),this.needsUpdate=!0}getLocalContrastAdaptationFactor(){return this.localContrastAdaptationFactor}setLocalContrastAdaptationFactor(t){this.localContrastAdaptationFactor=t}get edgeDetectionThreshold(){return Number(this.defines.EDGE_THRESHOLD)}set edgeDetectionThreshold(t){this.defines.EDGE_THRESHOLD=t.toFixed("6"),this.defines.DEPTH_THRESHOLD=(.1*t).toFixed("6"),this.needsUpdate=!0}getEdgeDetectionThreshold(){return this.edgeDetectionThreshold}setEdgeDetectionThreshold(t){this.edgeDetectionThreshold=t}get predicationMode(){return Number(this.defines.PREDICATION_MODE)}set predicationMode(t){this.defines.PREDICATION_MODE=t.toFixed(0),this.needsUpdate=!0}getPredicationMode(){return this.predicationMode}setPredicationMode(t){this.predicationMode=t}set predicationBuffer(t){this.uniforms.predicationBuffer.value=t}setPredicationBuffer(t){this.uniforms.predicationBuffer.value=t}get predicationThreshold(){return Number(this.defines.PREDICATION_THRESHOLD)}set predicationThreshold(t){this.defines.PREDICATION_THRESHOLD=t.toFixed("6"),this.needsUpdate=!0}getPredicationThreshold(){return this.predicationThreshold}setPredicationThreshold(t){this.predicationThreshold=t}get predicationScale(){return Number(this.defines.PREDICATION_SCALE)}set predicationScale(t){this.defines.PREDICATION_SCALE=t.toFixed("6"),this.needsUpdate=!0}getPredicationScale(){return this.predicationScale}setPredicationScale(t){this.predicationScale=t}get predicationStrength(){return Number(this.defines.PREDICATION_STRENGTH)}set predicationStrength(t){this.defines.PREDICATION_STRENGTH=t.toFixed("6"),this.needsUpdate=!0}getPredicationStrength(){return this.predicationStrength}setPredicationStrength(t){this.predicationStrength=t}setSize(t,e){this.uniforms.texelSize.value.set(1/t,1/e)}},v={FRAGMENT_HEAD:"FRAGMENT_HEAD",FRAGMENT_MAIN_UV:"FRAGMENT_MAIN_UV",FRAGMENT_MAIN_IMAGE:"FRAGMENT_MAIN_IMAGE",VERTEX_HEAD:"VERTEX_HEAD",VERTEX_MAIN_SUPPORT:"VERTEX_MAIN_SUPPORT"},y=class extends n.ShaderMaterial{constructor(t,e,i,r,s=!1){super({name:"EffectMaterial",defines:{THREE_REVISION:n.REVISION.replace(/\D+/g,""),DEPTH_PACKING:"0",ENCODE_OUTPUT:"1"},uniforms:{inputBuffer:new n.Uniform(null),depthBuffer:new n.Uniform(null),resolution:new n.Uniform(new n.Vector2),texelSize:new n.Uniform(new n.Vector2),cameraNear:new n.Uniform(.3),cameraFar:new n.Uniform(1e3),aspect:new n.Uniform(1),time:new n.Uniform(0)},blending:n.NoBlending,depthWrite:!1,depthTest:!1,dithering:s}),this.toneMapped=!1,t&&this.setShaderParts(t),e&&this.setDefines(e),i&&this.setUniforms(i),this.adoptCameraSettings(r)}set inputBuffer(t){this.uniforms.inputBuffer.value=t}setInputBuffer(t){this.uniforms.inputBuffer.value=t}get depthBuffer(){return this.uniforms.depthBuffer.value}set depthBuffer(t){this.uniforms.depthBuffer.value=t}get depthPacking(){return Number(this.defines.DEPTH_PACKING)}set depthPacking(t){this.defines.DEPTH_PACKING=t.toFixed(0),this.needsUpdate=!0}setDepthBuffer(t,e=n.BasicDepthPacking){this.depthBuffer=t,this.depthPacking=e}setShaderParts(t){return this.fragmentShader="#include \n#include \n#include \n#define packFloatToRGBA(v) packDepthToRGBA(v)\n#define unpackRGBAToFloat(v) unpackRGBAToDepth(v)\n#ifdef FRAMEBUFFER_PRECISION_HIGH\nuniform mediump sampler2D inputBuffer;\n#else\nuniform lowp sampler2D inputBuffer;\n#endif\n#ifdef GL_FRAGMENT_PRECISION_HIGH\nuniform highp sampler2D depthBuffer;\n#else\nuniform mediump sampler2D depthBuffer;\n#endif\nuniform vec2 resolution;uniform vec2 texelSize;uniform float cameraNear;uniform float cameraFar;uniform float aspect;uniform float time;varying vec2 vUv;\n#if THREE_REVISION >= 137\nvec4 sRGBToLinear(const in vec4 value){return 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#endif\nfloat readDepth(const in vec2 uv){\n#if DEPTH_PACKING == 3201\nreturn unpackRGBAToDepth(texture2D(depthBuffer,uv));\n#else\nreturn texture2D(depthBuffer,uv).r;\n#endif\n}float getViewZ(const in float depth){\n#ifdef PERSPECTIVE_CAMERA\nreturn perspectiveDepthToViewZ(depth,cameraNear,cameraFar);\n#else\nreturn orthographicDepthToViewZ(depth,cameraNear,cameraFar);\n#endif\n}FRAGMENT_HEADvoid main(){FRAGMENT_MAIN_UVvec4 color0=texture2D(inputBuffer,UV);vec4 color1=vec4(0.0);FRAGMENT_MAIN_IMAGEgl_FragColor=color0;\n#ifdef ENCODE_OUTPUT\n#include \n#endif\n#include \n}".replace(v.FRAGMENT_HEAD,t.get(v.FRAGMENT_HEAD)).replace(v.FRAGMENT_MAIN_UV,t.get(v.FRAGMENT_MAIN_UV)).replace(v.FRAGMENT_MAIN_IMAGE,t.get(v.FRAGMENT_MAIN_IMAGE)),this.vertexShader="uniform vec2 resolution;uniform vec2 texelSize;uniform float cameraNear;uniform float cameraFar;uniform float aspect;uniform float time;varying vec2 vUv;VERTEX_HEADvoid main(){vUv=position.xy*0.5+0.5;VERTEX_MAIN_SUPPORTgl_Position=vec4(position.xy,1.0,1.0);}".replace(v.VERTEX_HEAD,t.get(v.VERTEX_HEAD)).replace(v.VERTEX_MAIN_SUPPORT,t.get(v.VERTEX_MAIN_SUPPORT)),this.needsUpdate=!0,this}setDefines(t){for(const e of t.entries())this.defines[e[0]]=e[1];return this.needsUpdate=!0,this}setUniforms(t){for(const e of t.entries())this.uniforms[e[0]]=e[1];return this}setExtensions(t){this.extensions={};for(const e of t)this.extensions[e]=!0;return this}get encodeOutput(){return void 0!==this.defines.ENCODE_OUTPUT}set encodeOutput(t){this.encodeOutput!==t&&(t?this.defines.ENCODE_OUTPUT="1":delete this.defines.ENCODE_OUTPUT,this.needsUpdate=!0)}isOutputEncodingEnabled(t){return this.encodeOutput}setOutputEncodingEnabled(t){this.encodeOutput=t}get time(){return this.uniforms.time.value}set time(t){this.uniforms.time.value=t}setDeltaTime(t){this.uniforms.time.value+=t}adoptCameraSettings(t){t&&(this.uniforms.cameraNear.value=t.near,this.uniforms.cameraFar.value=t.far,t instanceof n.PerspectiveCamera?this.defines.PERSPECTIVE_CAMERA="1":delete this.defines.PERSPECTIVE_CAMERA,this.needsUpdate=!0)}setSize(t,e){const i=this.uniforms;i.resolution.value.set(t,e),i.texelSize.value.set(1/t,1/e),i.aspect.value=t/e}static get Section(){return v}},x=(n.ShaderMaterial,n.ShaderMaterial,0),w=(n.ShaderMaterial,n.ShaderMaterial,class extends n.ShaderMaterial{constructor(t=new n.Vector2,e=new n.Vector2){super({name:"SMAAWeightsMaterial",defines:{MAX_SEARCH_STEPS_INT:"16",MAX_SEARCH_STEPS_FLOAT:"16.0",MAX_SEARCH_STEPS_DIAG_INT:"8",MAX_SEARCH_STEPS_DIAG_FLOAT:"8.0",CORNER_ROUNDING:"25",CORNER_ROUNDING_NORM:"0.25",AREATEX_MAX_DISTANCE:"16.0",AREATEX_MAX_DISTANCE_DIAG:"20.0",AREATEX_PIXEL_SIZE:"(1.0 / vec2(160.0, 560.0))",AREATEX_SUBTEX_SIZE:"(1.0 / 7.0)",SEARCHTEX_SIZE:"vec2(66.0, 33.0)",SEARCHTEX_PACKED_SIZE:"vec2(64.0, 16.0)"},uniforms:{inputBuffer:new n.Uniform(null),searchTexture:new n.Uniform(null),areaTexture:new n.Uniform(null),resolution:new n.Uniform(e),texelSize:new n.Uniform(t)},blending:n.NoBlending,depthWrite:!1,depthTest:!1,fragmentShader:"#define sampleLevelZeroOffset(t, coord, offset) texture2D(t, coord + offset * texelSize)\n#if __VERSION__ < 300\n#define round(v) floor(v + 0.5)\n#endif\n#ifdef FRAMEBUFFER_PRECISION_HIGH\nuniform mediump sampler2D inputBuffer;\n#else\nuniform lowp sampler2D inputBuffer;\n#endif\nuniform lowp sampler2D areaTexture;uniform lowp sampler2D searchTexture;uniform vec2 texelSize;uniform vec2 resolution;varying vec2 vUv;varying vec4 vOffset[3];varying vec2 vPixCoord;void movec(const in bvec2 c,inout vec2 variable,const in vec2 value){if(c.x){variable.x=value.x;}if(c.y){variable.y=value.y;}}void movec(const in bvec4 c,inout vec4 variable,const in vec4 value){movec(c.xy,variable.xy,value.xy);movec(c.zw,variable.zw,value.zw);}vec2 decodeDiagBilinearAccess(in vec2 e){e.r=e.r*abs(5.0*e.r-5.0*0.75);return round(e);}vec4 decodeDiagBilinearAccess(in vec4 e){e.rb=e.rb*abs(5.0*e.rb-5.0*0.75);return round(e);}vec2 searchDiag1(const in vec2 texCoord,const in vec2 dir,out vec2 e){vec4 coord=vec4(texCoord,-1.0,1.0);vec3 t=vec3(texelSize,1.0);for(int i=0;i0.9)){break;}coord.xyz=t*vec3(dir,1.0)+coord.xyz;e=texture2D(inputBuffer,coord.xy).rg;coord.w=dot(e,vec2(0.5));}return coord.zw;}vec2 searchDiag2(const in vec2 texCoord,const in vec2 dir,out vec2 e){vec4 coord=vec4(texCoord,-1.0,1.0);coord.x+=0.25*texelSize.x;vec3 t=vec3(texelSize,1.0);for(int i=0;i0.9)){break;}coord.xyz=t*vec3(dir,1.0)+coord.xyz;e=texture2D(inputBuffer,coord.xy).rg;e=decodeDiagBilinearAccess(e);coord.w=dot(e,vec2(0.5));}return coord.zw;}vec2 areaDiag(const in vec2 dist,const in vec2 e,const in float offset){vec2 texCoord=vec2(AREATEX_MAX_DISTANCE_DIAG,AREATEX_MAX_DISTANCE_DIAG)*e+dist;texCoord=AREATEX_PIXEL_SIZE*texCoord+0.5*AREATEX_PIXEL_SIZE;texCoord.x+=0.5;texCoord.y+=AREATEX_SUBTEX_SIZE*offset;return texture2D(areaTexture,texCoord).rg;}vec2 calculateDiagWeights(const in vec2 texCoord,const in vec2 e,const in vec4 subsampleIndices){vec2 weights=vec2(0.0);vec4 d;vec2 end;if(e.r>0.0){d.xz=searchDiag1(texCoord,vec2(-1.0,1.0),end);d.x+=float(end.y>0.9);}else{d.xz=vec2(0.0);}d.yw=searchDiag1(texCoord,vec2(1.0,-1.0),end);if(d.x+d.y>2.0){vec4 coords=vec4(-d.x+0.25,d.x,d.y,-d.y-0.25)*texelSize.xyxy+texCoord.xyxy;vec4 c;c.xy=sampleLevelZeroOffset(inputBuffer,coords.xy,vec2(-1,0)).rg;c.zw=sampleLevelZeroOffset(inputBuffer,coords.zw,vec2(1,0)).rg;c.yxwz=decodeDiagBilinearAccess(c.xyzw);vec2 cc=vec2(2.0)*c.xz+c.yw;movec(bvec2(step(0.9,d.zw)),cc,vec2(0.0));weights+=areaDiag(d.xy,cc,subsampleIndices.z);}d.xz=searchDiag2(texCoord,vec2(-1.0,-1.0),end);if(sampleLevelZeroOffset(inputBuffer,texCoord,vec2(1,0)).r>0.0){d.yw=searchDiag2(texCoord,vec2(1.0),end);d.y+=float(end.y>0.9);}else{d.yw=vec2(0.0);}if(d.x+d.y>2.0){vec4 coords=vec4(-d.x,-d.x,d.y,d.y)*texelSize.xyxy+texCoord.xyxy;vec4 c;c.x=sampleLevelZeroOffset(inputBuffer,coords.xy,vec2(-1,0)).g;c.y=sampleLevelZeroOffset(inputBuffer,coords.xy,vec2(0,-1)).r;c.zw=sampleLevelZeroOffset(inputBuffer,coords.zw,vec2(1,0)).gr;vec2 cc=vec2(2.0)*c.xz+c.yw;movec(bvec2(step(0.9,d.zw)),cc,vec2(0.0));weights+=areaDiag(d.xy,cc,subsampleIndices.w).gr;}return weights;}float searchLength(const in vec2 e,const in float offset){vec2 scale=SEARCHTEX_SIZE*vec2(0.5,-1.0);vec2 bias=SEARCHTEX_SIZE*vec2(offset,1.0);scale+=vec2(-1.0,1.0);bias+=vec2(0.5,-0.5);scale*=1.0/SEARCHTEX_PACKED_SIZE;bias*=1.0/SEARCHTEX_PACKED_SIZE;return texture2D(searchTexture,scale*e+bias).r;}float searchXLeft(in vec2 texCoord,const in float end){vec2 e=vec2(0.0,1.0);for(int i=0;iend&&e.g>0.8281&&e.r==0.0)){break;}e=texture2D(inputBuffer,texCoord).rg;texCoord=vec2(-2.0,0.0)*texelSize+texCoord;}float offset=-(255.0/127.0)*searchLength(e,0.0)+3.25;return texelSize.x*offset+texCoord.x;}float searchXRight(vec2 texCoord,const in float end){vec2 e=vec2(0.0,1.0);for(int i=0;i0.8281&&e.r==0.0)){break;}e=texture2D(inputBuffer,texCoord).rg;texCoord=vec2(2.0,0.0)*texelSize.xy+texCoord;}float offset=-(255.0/127.0)*searchLength(e,0.5)+3.25;return-texelSize.x*offset+texCoord.x;}float searchYUp(vec2 texCoord,const in float end){vec2 e=vec2(1.0,0.0);for(int i=0;iend&&e.r>0.8281&&e.g==0.0)){break;}e=texture2D(inputBuffer,texCoord).rg;texCoord=-vec2(0.0,2.0)*texelSize.xy+texCoord;}float offset=-(255.0/127.0)*searchLength(e.gr,0.0)+3.25;return texelSize.y*offset+texCoord.y;}float searchYDown(vec2 texCoord,const in float end){vec2 e=vec2(1.0,0.0);for(int i=0;i0.8281&&e.g==0.0)){break;}e=texture2D(inputBuffer,texCoord).rg;texCoord=vec2(0.0,2.0)*texelSize.xy+texCoord;}float offset=-(255.0/127.0)*searchLength(e.gr,0.5)+3.25;return-texelSize.y*offset+texCoord.y;}vec2 area(const in vec2 dist,const in float e1,const in float e2,const in float offset){vec2 texCoord=vec2(AREATEX_MAX_DISTANCE)*round(4.0*vec2(e1,e2))+dist;texCoord=AREATEX_PIXEL_SIZE*texCoord+0.5*AREATEX_PIXEL_SIZE;texCoord.y=AREATEX_SUBTEX_SIZE*offset+texCoord.y;return texture2D(areaTexture,texCoord).rg;}void detectHorizontalCornerPattern(inout vec2 weights,const in vec4 texCoord,const in vec2 d){\n#if !defined(DISABLE_CORNER_DETECTION)\nvec2 leftRight=step(d.xy,d.yx);vec2 rounding=(1.0-CORNER_ROUNDING_NORM)*leftRight;rounding/=leftRight.x+leftRight.y;vec2 factor=vec2(1.0);factor.x-=rounding.x*sampleLevelZeroOffset(inputBuffer,texCoord.xy,vec2(0,1)).r;factor.x-=rounding.y*sampleLevelZeroOffset(inputBuffer,texCoord.zw,vec2(1,1)).r;factor.y-=rounding.x*sampleLevelZeroOffset(inputBuffer,texCoord.xy,vec2(0,-2)).r;factor.y-=rounding.y*sampleLevelZeroOffset(inputBuffer,texCoord.zw,vec2(1,-2)).r;weights*=clamp(factor,0.0,1.0);\n#endif\n}void detectVerticalCornerPattern(inout vec2 weights,const in vec4 texCoord,const in vec2 d){\n#if !defined(DISABLE_CORNER_DETECTION)\nvec2 leftRight=step(d.xy,d.yx);vec2 rounding=(1.0-CORNER_ROUNDING_NORM)*leftRight;rounding/=leftRight.x+leftRight.y;vec2 factor=vec2(1.0);factor.x-=rounding.x*sampleLevelZeroOffset(inputBuffer,texCoord.xy,vec2(1,0)).g;factor.x-=rounding.y*sampleLevelZeroOffset(inputBuffer,texCoord.zw,vec2(1,1)).g;factor.y-=rounding.x*sampleLevelZeroOffset(inputBuffer,texCoord.xy,vec2(-2,0)).g;factor.y-=rounding.y*sampleLevelZeroOffset(inputBuffer,texCoord.zw,vec2(-2,1)).g;weights*=clamp(factor,0.0,1.0);\n#endif\n}void main(){vec4 weights=vec4(0.0);vec4 subsampleIndices=vec4(0.0);vec2 e=texture2D(inputBuffer,vUv).rg;if(e.g>0.0){\n#if !defined(DISABLE_DIAG_DETECTION)\nweights.rg=calculateDiagWeights(vUv,e,subsampleIndices);if(weights.r==-weights.g){\n#endif\nvec2 d;vec3 coords;coords.x=searchXLeft(vOffset[0].xy,vOffset[2].x);coords.y=vOffset[1].y;d.x=coords.x;float e1=texture2D(inputBuffer,coords.xy).r;coords.z=searchXRight(vOffset[0].zw,vOffset[2].y);d.y=coords.z;d=round(resolution.xx*d+-vPixCoord.xx);vec2 sqrtD=sqrt(abs(d));float e2=sampleLevelZeroOffset(inputBuffer,coords.zy,vec2(1,0)).r;weights.rg=area(sqrtD,e1,e2,subsampleIndices.y);coords.y=vUv.y;detectHorizontalCornerPattern(weights.rg,coords.xyzy,d);\n#if !defined(DISABLE_DIAG_DETECTION)\n}else{e.r=0.0;}\n#endif\n}if(e.r>0.0){vec2 d;vec3 coords;coords.y=searchYUp(vOffset[1].xy,vOffset[2].z);coords.x=vOffset[0].x;d.x=coords.y;float e1=texture2D(inputBuffer,coords.xy).g;coords.z=searchYDown(vOffset[1].zw,vOffset[2].w);d.y=coords.z;d=round(resolution.yy*d-vPixCoord.yy);vec2 sqrtD=sqrt(abs(d));float e2=sampleLevelZeroOffset(inputBuffer,coords.xz,vec2(0,1)).g;weights.ba=area(sqrtD,e1,e2,subsampleIndices.x);coords.x=vUv.x;detectVerticalCornerPattern(weights.ba,coords.xyxz,d);}gl_FragColor=weights;}",vertexShader:"uniform vec2 texelSize;uniform vec2 resolution;varying vec2 vUv;varying vec4 vOffset[3];varying vec2 vPixCoord;void main(){vUv=position.xy*0.5+0.5;vPixCoord=vUv*resolution;vOffset[0]=vUv.xyxy+texelSize.xyxy*vec4(-0.25,-0.125,1.25,-0.125);vOffset[1]=vUv.xyxy+texelSize.xyxy*vec4(-0.125,-0.25,-0.125,1.25);vOffset[2]=vec4(vOffset[0].xz,vOffset[1].yw)+vec4(-2.0,2.0,-2.0,2.0)*texelSize.xxyy*MAX_SEARCH_STEPS_FLOAT;gl_Position=vec4(position.xy,1.0,1.0);}"}),this.toneMapped=!1}set inputBuffer(t){this.uniforms.inputBuffer.value=t}setInputBuffer(t){this.uniforms.inputBuffer.value=t}get searchTexture(){return this.uniforms.searchTexture.value}set searchTexture(t){this.uniforms.searchTexture.value=t}get areaTexture(){return this.uniforms.areaTexture.value}set areaTexture(t){this.uniforms.areaTexture.value=t}setLookupTextures(t,e){this.searchTexture=t,this.areaTexture=e}get orthogonalSearchSteps(){return Number(this.defines.MAX_SEARCH_STEPS_INT)}set orthogonalSearchSteps(t){const e=Math.min(Math.max(t,0),112);this.defines.MAX_SEARCH_STEPS_INT=e.toFixed("0"),this.defines.MAX_SEARCH_STEPS_FLOAT=e.toFixed("1"),this.needsUpdate=!0}setOrthogonalSearchSteps(t){this.orthogonalSearchSteps=t}get diagonalSearchSteps(){return Number(this.defines.MAX_SEARCH_STEPS_DIAG_INT)}set diagonalSearchSteps(t){const e=Math.min(Math.max(t,0),20);this.defines.MAX_SEARCH_STEPS_DIAG_INT=e.toFixed("0"),this.defines.MAX_SEARCH_STEPS_DIAG_FLOAT=e.toFixed("1"),this.needsUpdate=!0}setDiagonalSearchSteps(t){this.diagonalSearchSteps=t}get diagonalDetection(){return void 0===this.defines.DISABLE_DIAG_DETECTION}set diagonalDetection(t){t?delete this.defines.DISABLE_DIAG_DETECTION:this.defines.DISABLE_DIAG_DETECTION="1",this.needsUpdate=!0}isDiagonalDetectionEnabled(){return this.diagonalDetection}setDiagonalDetectionEnabled(t){this.diagonalDetection=t}get cornerRounding(){return Number(this.defines.CORNER_ROUNDING)}set cornerRounding(t){const e=Math.min(Math.max(t,0),100);this.defines.CORNER_ROUNDING=e.toFixed("4"),this.defines.CORNER_ROUNDING_NORM=(e/100).toFixed("4"),this.needsUpdate=!0}setCornerRounding(t){this.cornerRounding=t}get cornerDetection(){return void 0===this.defines.DISABLE_CORNER_DETECTION}set cornerDetection(t){t?delete this.defines.DISABLE_CORNER_DETECTION:this.defines.DISABLE_CORNER_DETECTION="1",this.needsUpdate=!0}isCornerRoundingEnabled(){return this.cornerDetection}setCornerRoundingEnabled(t){this.cornerDetection=t}setSize(t,e){const i=this.uniforms;i.texelSize.value.set(1/t,1/e),i.resolution.value.set(t,e)}}),b=(n.ShaderMaterial,new n.Camera),A=null;var T=class{constructor(t="Pass",e=new n.Scene,i=b){this.name=t,this.renderer=null,this.scene=e,this.camera=i,this.screen=null,this.rtt=!0,this.needsSwap=!0,this.needsDepthTexture=!1,this.enabled=!0}get renderToScreen(){return!this.rtt}set renderToScreen(t){if(this.rtt===t){const e=this.getFullscreenMaterial();null!==e&&(e.needsUpdate=!0),this.rtt=!t}}setRenderer(t){this.renderer=t}isEnabled(){return this.enabled}setEnabled(t){this.enabled=t}get fullscreenMaterial(){return null!==this.screen?this.screen.material:null}set fullscreenMaterial(t){let e=this.screen;null!==e?e.material=t:(e=new n.Mesh(function(){if(null===A){const t=new Float32Array([-1,-1,0,3,-1,0,-1,3,0]),e=new Float32Array([0,0,2,0,0,2]);void 0!==(A=new n.BufferGeometry).setAttribute?(A.setAttribute("position",new n.BufferAttribute(t,3)),A.setAttribute("uv",new n.BufferAttribute(e,2))):(A.addAttribute("position",new n.BufferAttribute(t,3)),A.addAttribute("uv",new n.BufferAttribute(e,2)))}return A}(),t),e.frustumCulled=!1,null===this.scene&&(this.scene=new n.Scene),this.scene.add(e),this.screen=e)}getFullscreenMaterial(){return this.fullscreenMaterial}setFullscreenMaterial(t){this.fullscreenMaterial=t}getDepthTexture(){return null}setDepthTexture(t,e=n.BasicDepthPacking){}render(t,e,i,n,r){throw new Error("Render method not implemented!")}setSize(t,e){}initialize(t,e,i){}dispose(){for(const t of Object.keys(this)){const e=this[t];if(null!==e&&"function"==typeof e.dispose){if(e instanceof n.Scene||e===this.renderer)continue;this[t].dispose()}}}},S=class extends T{constructor(t,e=!0){super("CopyPass"),this.fullscreenMaterial=new h,this.needsSwap=!1,this.renderTarget=t,void 0===t&&(this.renderTarget=new n.WebGLRenderTarget(1,1,{minFilter:n.LinearFilter,magFilter:n.LinearFilter,stencilBuffer:!1,depthBuffer:!1}),this.renderTarget.texture.name="CopyPass.Target"),this.autoResize=e}get resize(){return this.autoResize}set resize(t){this.autoResize=t}get texture(){return this.renderTarget.texture}getTexture(){return this.renderTarget.texture}setAutoResizeEnabled(t){this.autoResize=t}render(t,e,i,n,r){this.fullscreenMaterial.inputBuffer=e.texture,t.setRenderTarget(this.renderToScreen?null:this.renderTarget),t.render(this.scene,this.camera)}setSize(t,e){this.autoResize&&this.renderTarget.setSize(t,e)}initialize(t,e,i){void 0!==i&&(this.renderTarget.texture.type=i,i!==n.UnsignedByteType?this.fullscreenMaterial.defines.FRAMEBUFFER_PRECISION_HIGH="1":t.outputEncoding===n.sRGBEncoding&&(this.renderTarget.texture.encoding=n.sRGBEncoding))}},E=class extends T{constructor(){super("ClearMaskPass",null,null),this.needsSwap=!1}render(t,e,i,n,r){const s=t.state.buffers.stencil;s.setLocked(!1),s.setTest(!1)}},M=new n.Color,_=class extends T{constructor(t=!0,e=!0,i=!1){super("ClearPass",null,null),this.needsSwap=!1,this.color=t,this.depth=e,this.stencil=i,this.overrideClearColor=null,this.overrideClearAlpha=-1}setClearFlags(t,e,i){this.color=t,this.depth=e,this.stencil=i}getOverrideClearColor(){return this.overrideClearColor}setOverrideClearColor(t){this.overrideClearColor=t}getOverrideClearAlpha(){return this.overrideClearAlpha}setOverrideClearAlpha(t){this.overrideClearAlpha=t}render(t,e,i,n,r){const s=this.overrideClearColor,o=this.overrideClearAlpha,a=t.getClearAlpha(),h=null!==s,l=o>=0;h?(M.copy(t.getClearColor(M)),t.setClearColor(s,l?o:a)):l&&t.setClearAlpha(o),t.setRenderTarget(this.renderToScreen?null:e),t.clear(this.color,this.depth,this.stencil),h?t.setClearColor(M,a):l&&t.setClearAlpha(a)}},C=(n.EventDispatcher,!1),P=class{constructor(t=null){this.originalMaterials=new Map,this.material=null,this.materials=null,this.materialsBackSide=null,this.materialsDoubleSide=null,this.materialsFlatShaded=null,this.materialsFlatShadedBackSide=null,this.materialsFlatShadedDoubleSide=null,this.setMaterial(t),this.meshCount=0,this.replaceMaterial=t=>{if(t.isMesh){let e;if(t.material.flatShading)switch(t.material.side){case n.DoubleSide:e=this.materialsFlatShadedDoubleSide;break;case n.BackSide:e=this.materialsFlatShadedBackSide;break;default:e=this.materialsFlatShaded}else switch(t.material.side){case n.DoubleSide:e=this.materialsDoubleSide;break;case n.BackSide:e=this.materialsBackSide;break;default:e=this.materials}this.originalMaterials.set(t,t.material),t.isSkinnedMesh?t.material=e[2]:t.isInstancedMesh?t.material=e[1]:t.material=e[0],++this.meshCount}}}setMaterial(t){if(this.disposeMaterials(),this.material=t,null!==t){const e=this.materials=[t.clone(),t.clone(),t.clone()];for(const i of e)i.uniforms=Object.assign({},t.uniforms),i.side=n.FrontSide;e[2].skinning=!0,this.materialsBackSide=e.map(e=>{const i=e.clone();return i.uniforms=Object.assign({},t.uniforms),i.side=n.BackSide,i}),this.materialsDoubleSide=e.map(e=>{const i=e.clone();return i.uniforms=Object.assign({},t.uniforms),i.side=n.DoubleSide,i}),this.materialsFlatShaded=e.map(e=>{const i=e.clone();return i.uniforms=Object.assign({},t.uniforms),i.flatShading=!0,i}),this.materialsFlatShadedBackSide=e.map(e=>{const i=e.clone();return i.uniforms=Object.assign({},t.uniforms),i.flatShading=!0,i.side=n.BackSide,i}),this.materialsFlatShadedDoubleSide=e.map(e=>{const i=e.clone();return i.uniforms=Object.assign({},t.uniforms),i.flatShading=!0,i.side=n.DoubleSide,i})}}render(t,e,i){const n=t.shadowMap.enabled;if(t.shadowMap.enabled=!1,C){const n=this.originalMaterials;this.meshCount=0,e.traverse(this.replaceMaterial),t.render(e,i);for(const t of n)t[0].material=t[1];this.meshCount!==n.size&&n.clear()}else{const n=e.overrideMaterial;e.overrideMaterial=this.material,t.render(e,i),e.overrideMaterial=n}t.shadowMap.enabled=n}disposeMaterials(){if(null!==this.material){const t=this.materials.concat(this.materialsBackSide).concat(this.materialsDoubleSide).concat(this.materialsFlatShaded).concat(this.materialsFlatShadedBackSide).concat(this.materialsFlatShadedDoubleSide);for(const e of t)e.dispose()}}dispose(){this.originalMaterials.clear(),this.disposeMaterials()}static get workaroundEnabled(){return C}static set workaroundEnabled(t){C=t}},R=class extends T{constructor(t,e,i=null){super("RenderPass",t,e),this.needsSwap=!1,this.clearPass=new _,this.overrideMaterialManager=null===i?null:new P(i),this.ignoreBackground=!1,this.skipShadowMapUpdate=!1,this.selection=null}get renderToScreen(){return super.renderToScreen}set renderToScreen(t){super.renderToScreen=t,this.clearPass.renderToScreen=t}get overrideMaterial(){const t=this.overrideMaterialManager;return null!==t?t.material:null}set overrideMaterial(t){const e=this.overrideMaterialManager;null!==t?null!==e?e.setMaterial(t):this.overrideMaterialManager=new P(t):null!==e&&(e.dispose(),this.overrideMaterialManager=null)}getOverrideMaterial(){return this.overrideMaterial}setOverrideMaterial(t){this.overrideMaterial=t}get clear(){return this.clearPass.enabled}set clear(t){this.clearPass.enabled=t}getSelection(){return this.selection}setSelection(t){this.selection=t}isBackgroundDisabled(){return this.ignoreBackground}setBackgroundDisabled(t){this.ignoreBackground=t}isShadowMapDisabled(){return this.skipShadowMapUpdate}setShadowMapDisabled(t){this.skipShadowMapUpdate=t}getClearPass(){return this.clearPass}render(t,e,i,n,r){const s=this.scene,o=this.camera,a=this.selection,h=o.layers.mask,l=s.background,u=t.shadowMap.autoUpdate,c=this.renderToScreen?null:e;null!==a&&o.layers.set(a.getLayer()),this.skipShadowMapUpdate&&(t.shadowMap.autoUpdate=!1),(this.ignoreBackground||null!==this.clearPass.overrideClearColor)&&(s.background=null),this.clearPass.enabled&&this.clearPass.render(t,e),t.setRenderTarget(c),null!==this.overrideMaterialManager?this.overrideMaterialManager.render(t,s,o):t.render(s,o),o.layers.mask=h,s.background=l,t.shadowMap.autoUpdate=u}};new Float32Array([255/256/256**3,255/256/65536,255/256/256,255/256]);var L=0,O=2,D=10,B=13,I=14,F=16,k=new Map([[L,null],[1,"vec4 blend(const in vec4 x,const in vec4 y,const in float opacity){return min(x+y,1.0)*opacity+x*(1.0-opacity);}"],[O,"vec3 blend(const in vec3 x,const in vec3 y,const in float opacity){return y*opacity+x*(1.0-opacity);}vec4 blend(const in vec4 x,const in vec4 y,const in float opacity){float a=min(y.a,opacity);return vec4(blend(x.rgb,y.rgb,a),max(x.a,a));}"],[3,"vec4 blend(const in vec4 x,const in vec4 y,const in float opacity){return(x+y)*0.5*opacity+x*(1.0-opacity);}"],[4,"float blend(const in float x,const in float y){return(y==0.0)?y:max(1.0-(1.0-x)/y,0.0);}vec4 blend(const in vec4 x,const in vec4 y,const in float opacity){vec4 z=vec4(blend(x.r,y.r),blend(x.g,y.g),blend(x.b,y.b),blend(x.a,y.a));return z*opacity+x*(1.0-opacity);}"],[5,"float blend(const in float x,const in float y){return(y==1.0)?y:min(x/(1.0-y),1.0);}vec4 blend(const in vec4 x,const in vec4 y,const in float opacity){vec4 z=vec4(blend(x.r,y.r),blend(x.g,y.g),blend(x.b,y.b),blend(x.a,y.a));return z*opacity+x*(1.0-opacity);}"],[6,"vec4 blend(const in vec4 x,const in vec4 y,const in float opacity){return min(x,y)*opacity+x*(1.0-opacity);}"],[7,"vec4 blend(const in vec4 x,const in vec4 y,const in float opacity){return abs(x-y)*opacity+x*(1.0-opacity);}"],[8,"vec4 blend(const in vec4 x,const in vec4 y,const in float opacity){return(x+y-2.0*x*y)*opacity+x*(1.0-opacity);}"],[9,"vec4 blend(const in vec4 x,const in vec4 y,const in float opacity){return max(x,y)*opacity+x*(1.0-opacity);}"],[D,"vec4 blend(const in vec4 x,const in vec4 y,const in float opacity){return x*y*opacity+x*(1.0-opacity);}"],[11,"float blend(const in float x,const in float y){return(y>0.0)?min(x/y,1.0):1.0;}vec4 blend(const in vec4 x,const in vec4 y,const in float opacity){vec4 z=vec4(blend(x.r,y.r),blend(x.g,y.g),blend(x.b,y.b),blend(x.a,y.a));return z*opacity+x*(1.0-opacity);}"],[12,"vec4 blend(const in vec4 x,const in vec4 y,const in float opacity){return(1.0-abs(1.0-x-y))*opacity+x*(1.0-opacity);}"],[B,"vec4 blend(const in vec4 x,const in vec4 y,const in float opacity){return y*opacity+x*(1.0-opacity);}"],[I,"float blend(const in float x,const in float y){return(x<0.5)?(2.0*x*y):(1.0-2.0*(1.0-x)*(1.0-y));}vec4 blend(const in vec4 x,const in vec4 y,const in float opacity){vec4 z=vec4(blend(x.r,y.r),blend(x.g,y.g),blend(x.b,y.b),blend(x.a,y.a));return z*opacity+x*(1.0-opacity);}"],[15,"float blend(const in float x,const in float y){return(y==1.0)?y:min(x*x/(1.0-y),1.0);}vec4 blend(const in vec4 x,const in vec4 y,const in float opacity){vec4 z=vec4(blend(x.r,y.r),blend(x.g,y.g),blend(x.b,y.b),blend(x.a,y.a));return z*opacity+x*(1.0-opacity);}"],[F,"vec4 blend(const in vec4 x,const in vec4 y,const in float opacity){return(1.0-(1.0-x)*(1.0-y))*opacity+x*(1.0-opacity);}"],[17,"float blend(const in float x,const in float y){return(y<0.5)?(2.0*x*y+x*x*(1.0-2.0*y)):(sqrt(x)*(2.0*y-1.0)+2.0*x*(1.0-y));}vec4 blend(const in vec4 x,const in vec4 y,const in float opacity){vec4 z=vec4(blend(x.r,y.r),blend(x.g,y.g),blend(x.b,y.b),blend(x.a,y.a));return z*opacity+x*(1.0-opacity);}"],[18,"vec4 blend(const in vec4 x,const in vec4 y,const in float opacity){return max(x+y-1.0,0.0)*opacity+x*(1.0-opacity);}"]]),N=class extends n.EventDispatcher{constructor(t,e=1){super(),this.f=t,this.opacity=new n.Uniform(e)}getOpacity(){return this.opacity.value}setOpacity(t){this.opacity.value=t}get blendFunction(){return this.f}set blendFunction(t){this.f=t,this.dispatchEvent({type:"change"})}getBlendFunction(){return this.blendFunction}setBlendFunction(t){this.blendFunction=t}getShaderCode(){return k.get(this.blendFunction)}},z=0,U=1,V=2,H=class extends n.EventDispatcher{constructor(t,e,{attributes:i=z,blendFunction:n=F,defines:r=new Map,uniforms:s=new Map,extensions:o=null,vertexShader:a=null}={}){super(),this.name=t,this.renderer=null,this.attributes=i,this.fragmentShader=e,this.vertexShader=a,this.defines=r,this.uniforms=s,this.extensions=o,this.blendMode=new N(n),this.blendMode.addEventListener("change",t=>this.setChanged())}getName(){return this.name}setRenderer(t){this.renderer=t}getDefines(){return this.defines}getUniforms(){return this.uniforms}getExtensions(){return this.extensions}getBlendMode(){return this.blendMode}getAttributes(){return this.attributes}setAttributes(t){this.attributes=t,this.setChanged()}getFragmentShader(){return this.fragmentShader}setFragmentShader(t){this.fragmentShader=t,this.setChanged()}getVertexShader(){return this.vertexShader}setVertexShader(t){this.vertexShader=t,this.setChanged()}setChanged(){this.dispatchEvent({type:"change"})}setDepthTexture(t,e=n.BasicDepthPacking){}update(t,e,i){}setSize(t,e){}initialize(t,e,i){}dispose(){for(const t of Object.keys(this)){const e=this[t];if(null!==e&&"function"==typeof e.dispose){if(e instanceof n.Scene||e===this.renderer)continue;this[t].dispose()}}}};function G(t,e,i){for(const n of e){const e="$1"+t+n.charAt(0).toUpperCase()+n.slice(1),r=new RegExp("([^\\.])(\\b"+n+"\\b)","g");for(const t of i.entries())null!==t[1]&&i.set(t[0],t[1].replace(r,e))}}function W(t,e,i,n,r,s,o){const a=new Map([["fragment",e.getFragmentShader()],["vertex",e.getVertexShader()]]),h=void 0!==a.get("fragment")&&/mainImage/.test(a.get("fragment")),l=void 0!==a.get("fragment")&&/mainUv/.test(a.get("fragment"));let u=[],c=[],d=!1,p=!1;if(void 0===a.get("fragment"));else if(l&&0!=(o&V));else if(h||l){const f=/(?:\w+\s+(\w+)\([\w\s,]*\)\s*{[^}]+})/g,m=y.Section;if(l){const e=`\t${t}MainUv(UV);\n`;i.set(m.FRAGMENT_MAIN_UV,i.get(m.FRAGMENT_MAIN_UV)+e),d=!0}if(null!==a.get("vertex")&&/mainSupport/.test(a.get("vertex"))){let e=`\t${t}MainSupport(`;e+=/mainSupport *\([\w\s]*?uv\s*?\)/.test(a.get("vertex"))?"vUv);\n":");\n",i.set(m.VERTEX_MAIN_SUPPORT,i.get(m.VERTEX_MAIN_SUPPORT)+e),u=u.concat([...a.get("vertex").matchAll(/(?:varying\s+\w+\s+(\w*))/g)].map(t=>t[1])),c=c.concat(u).concat([...a.get("vertex").matchAll(f)].map(t=>t[1]))}c=c.concat([...a.get("fragment").matchAll(f)].map(t=>t[1])),c=c.concat([...e.defines.keys()].map(t=>t.replace(/\([\w\s,]*\)/g,""))),c=c.concat([...e.uniforms.keys()]),e.uniforms.forEach((e,i)=>s.set(t+i.charAt(0).toUpperCase()+i.slice(1),e)),e.defines.forEach((e,i)=>r.set(t+i.charAt(0).toUpperCase()+i.slice(1),e)),G(t,c,r),G(t,c,a);const g=e.blendMode;if(n.set(g.blendFunction,g),h){const e=/MainImage *\([\w\s,]*?depth[\w\s,]*?\)/;let n=t+"MainImage(color0, UV, ";0!=(o&U)&&e.test(a.get("fragment"))&&(n+="depth, ",p=!0),n+="color1);\n\t";const r=t+"BlendOpacity";s.set(r,g.opacity),n+=`color0 = blend${g.blendFunction}(color0, color1, ${r});\n\n\t`,i.set(m.FRAGMENT_MAIN_IMAGE,i.get(m.FRAGMENT_MAIN_IMAGE)+n),n=`uniform float ${r};\n\n`,i.set(m.FRAGMENT_HEAD,i.get(m.FRAGMENT_HEAD)+n)}i.set(m.FRAGMENT_HEAD,i.get(m.FRAGMENT_HEAD)+a.get("fragment")+"\n"),null!==a.get("vertex")&&i.set(m.VERTEX_HEAD,i.get(m.VERTEX_HEAD)+a.get("vertex")+"\n")}else;return{varyings:u,transformedUv:d,readDepth:p}}var Y=class extends T{constructor(t,...e){super("EffectPass"),this.fullscreenMaterial=new y(null,null,null,t),this.effects=e.sort((t,e)=>e.attributes-t.attributes),this.skipRendering=!1,this.uniformCount=0,this.varyingCount=0,this.minTime=1,this.maxTime=Number.POSITIVE_INFINITY}get encodeOutput(){return this.fullscreenMaterial.encodeOutput}set encodeOutput(t){this.fullscreenMaterial.encodeOutput=t}get dithering(){return this.fullscreenMaterial.dithering}set dithering(t){const e=this.fullscreenMaterial;e.dithering=t,e.needsUpdate=!0}verifyResources(){const t=this.renderer.capabilities;let e=Math.min(t.maxFragmentUniforms,t.maxVertexUniforms);this.uniformCount,e=t.maxVaryings,this.varyingCount}updateMaterial(){const t=y.Section,e=new Map([[t.FRAGMENT_HEAD,""],[t.FRAGMENT_MAIN_UV,""],[t.FRAGMENT_MAIN_IMAGE,""],[t.VERTEX_HEAD,""],[t.VERTEX_MAIN_SUPPORT,""]]),i=new Map,n=new Map,r=new Map,s=new Set;let o=0,a=0,h=0,l=!1,u=!1;for(const t of this.effects)if(t.blendMode.blendFunction===L)h|=t.getAttributes()&U;else if(0!=(h&t.getAttributes()&V));else{h|=t.getAttributes();const c=W("e"+o++,t,e,i,n,r,h);if(a+=c.varyings.length,l=l||c.transformedUv,u=u||c.readDepth,null!==t.extensions)for(const e of t.extensions)s.add(e)}const c=/\bblend\b/g;for(const n of i.values()){const i=n.getShaderCode().replace(c,"blend"+n.blendFunction);e.set(t.FRAGMENT_HEAD,e.get(t.FRAGMENT_HEAD)+i+"\n")}if(0!=(h&U)){if(u){const i="float depth = readDepth(UV);\n\n\t";e.set(t.FRAGMENT_MAIN_IMAGE,i+e.get(t.FRAGMENT_MAIN_IMAGE))}this.needsDepthTexture=null===this.getDepthTexture()}else this.needsDepthTexture=!1;if(l){const i="vec2 transformedUv = vUv;\n";e.set(t.FRAGMENT_MAIN_UV,i+e.get(t.FRAGMENT_MAIN_UV)),n.set("UV","transformedUv")}else n.set("UV","vUv");e.forEach((t,e,i)=>i.set(e,t.trim().replace(/^#/,"\n#"))),this.uniformCount=r.size,this.varyingCount=a,this.skipRendering=0===o,this.needsSwap=!this.skipRendering,this.fullscreenMaterial.setShaderParts(e).setExtensions(s).setUniforms(r).setDefines(n)}recompile(){this.updateMaterial(),this.verifyResources()}getDepthTexture(){return this.fullscreenMaterial.depthBuffer}setDepthTexture(t,e=n.BasicDepthPacking){this.fullscreenMaterial.depthBuffer=t,this.fullscreenMaterial.depthPacking=e;for(const i of this.effects)i.setDepthTexture(t,e)}render(t,e,i,n,r){for(const i of this.effects)i.update(t,e,n);if(!this.skipRendering||this.renderToScreen){const r=this.fullscreenMaterial;r.inputBuffer=e.texture,r.time+=n,t.setRenderTarget(this.renderToScreen?null:i),t.render(this.scene,this.camera)}}setSize(t,e){this.fullscreenMaterial.setSize(t,e);for(const i of this.effects)i.setSize(t,e)}initialize(t,e,i){this.renderer=t;for(const n of this.effects)n.initialize(t,e,i),n.addEventListener("change",t=>this.handleEvent(t));this.updateMaterial(),this.verifyResources(),void 0!==i&&i!==n.UnsignedByteType&&(this.fullscreenMaterial.defines.FRAMEBUFFER_PRECISION_HIGH="1")}dispose(){super.dispose();for(const t of this.effects)t.dispose()}handleEvent(t){switch(t.type){case"change":this.recompile()}}},X=(new Float32Array([0,0]),new Float32Array([0,1,1]),new Float32Array([0,1,1,2]),new Float32Array([0,1,2,2,3]),new Float32Array([0,1,2,3,4,4,5]),new Float32Array([0,1,2,3,4,5,7,8,9,10]),class extends T{constructor(t,e){super("MaskPass",t,e),this.needsSwap=!1,this.clearPass=new _(!1,!1,!0),this.inverse=!1}get inverted(){return this.inverse}set inverted(t){this.inverse=t}get clear(){return this.clearPass.enabled}set clear(t){this.clearPass.enabled=t}getClearPass(){return this.clearPass}isInverted(){return this.inverted}setInverted(t){this.inverted=t}render(t,e,i,n,r){const s=t.getContext(),o=t.state.buffers,a=this.scene,h=this.camera,l=this.clearPass,u=this.inverted?0:1,c=1-u;o.color.setMask(!1),o.depth.setMask(!1),o.color.setLocked(!0),o.depth.setLocked(!0),o.stencil.setTest(!0),o.stencil.setOp(s.REPLACE,s.REPLACE,s.REPLACE),o.stencil.setFunc(s.ALWAYS,u,4294967295),o.stencil.setClear(c),o.stencil.setLocked(!0),this.clearPass.enabled&&(this.renderToScreen?l.render(t,null):(l.render(t,e),l.render(t,i))),this.renderToScreen?(t.setRenderTarget(null),t.render(a,h)):(t.setRenderTarget(e),t.render(a,h),t.setRenderTarget(i),t.render(a,h)),o.color.setLocked(!1),o.depth.setLocked(!1),o.stencil.setLocked(!1),o.stencil.setFunc(s.EQUAL,1,4294967295),o.stencil.setOp(s.KEEP,s.KEEP,s.KEEP),o.stencil.setLocked(!0)}}),j=class extends T{constructor(t,e="inputBuffer"){super("ShaderPass"),this.fullscreenMaterial=t,this.inputBufferUniform=null,this.setInput(e)}setInput(t){if(this.inputBufferUniform=null,null!==this.fullscreenMaterial){const e=this.fullscreenMaterial.uniforms;void 0!==e&&void 0!==e[t]&&(this.inputBufferUniform=e[t])}}render(t,e,i,n,r){null!==this.inputBufferUniform&&null!==e&&(this.inputBufferUniform.value=e.texture),t.setRenderTarget(this.renderToScreen?null:i),t.render(this.scene,this.camera)}initialize(t,e,i){void 0!==i&&i!==n.UnsignedByteType&&(this.fullscreenMaterial.defines.FRAMEBUFFER_PRECISION_HIGH="1")}},q=(Set,class extends H{constructor({blendFunction:t=B,brightness:e=0,contrast:i=0}={}){super("BrightnessContrastEffect","uniform float brightness;uniform float contrast;void mainImage(const in vec4 inputColor,const in vec2 uv,out vec4 outputColor){vec3 color=inputColor.rgb+vec3(brightness-0.5);if(contrast>0.0){color/=vec3(1.0-contrast);}else{color*=vec3(1.0+contrast);}outputColor=vec4(min(color+vec3(0.5),1.0),inputColor.a);}",{blendFunction:t,uniforms:new Map([["brightness",new n.Uniform(e)],["contrast",new n.Uniform(i)]])})}get brightness(){return this.uniforms.get("brightness").value}set brightness(t){this.uniforms.get("brightness").value=t}getBrightness(t){return this.brightness}setBrightness(t){this.brightness=t}get contrast(){return this.uniforms.get("contrast").value}set contrast(t){this.uniforms.get("contrast").value=t}getContrast(t){return this.contrast}setContrast(t){this.contrast=t}});n.DataTexture;new n.Vector3,new n.Matrix4;var Q=class extends H{constructor({blendFunction:t=B,hue:e=0,saturation:i=0}={}){super("HueSaturationEffect","uniform vec3 hue;uniform float saturation;void mainImage(const in vec4 inputColor,const in vec2 uv,out vec4 outputColor){vec3 color=vec3(dot(inputColor.rgb,hue.xyz),dot(inputColor.rgb,hue.zxy),dot(inputColor.rgb,hue.yzx));float average=(color.r+color.g+color.b)/3.0;vec3 diff=average-color;if(saturation>0.0){color+=diff*(1.0-1.0/(1.001-saturation));}else{color+=diff*-saturation;}outputColor=vec4(min(color,1.0),inputColor.a);}",{blendFunction:t,uniforms:new Map([["hue",new n.Uniform(new n.Vector3)],["saturation",new n.Uniform(i)]])}),this.hue=e}get saturation(){return this.uniforms.get("saturation").value}set saturation(t){this.uniforms.get("saturation").value=t}getSaturation(){return this.saturation}setSaturation(t){this.saturation=t}get hue(){const t=this.uniforms.get("hue").value;return Math.acos((3*t.x-1)/2)}set hue(t){const e=Math.sin(t),i=Math.cos(t);this.uniforms.get("hue").value.set((2*i+1)/3,(-Math.sqrt(3)*e-i+1)/3,(Math.sqrt(3)*e-i+1)/3)}getHue(){return this.hue}setHue(t){this.hue=t}};function K(t,e,i){const n=document.createElement("canvas"),r=n.getContext("2d");if(n.width=t,n.height=e,i instanceof Image)r.drawImage(i,0,0);else{const n=r.createImageData(t,e);n.data.set(i),r.putImageData(n,0,0)}return n}var J=class{constructor(t=0,e=0,i=null){this.width=t,this.height=e,this.data=i}toCanvas(){return"undefined"==typeof document?null:K(this.width,this.height,this.data)}static from(t){const{width:e,height:i}=t;let n;if(t instanceof Image){const r=K(e,i,t);if(null!==r){n=r.getContext("2d").getImageData(0,0,e,i).data}}else n=t.data;return new J(e,i,n)}},Z="lut.scaleup",$=new n.Color,tt=class extends n.DataTexture3D{constructor(t,e){super(t,e,e,e),this.type=n.FloatType,this.format=n.RGBAFormat,this.encoding=n.LinearEncoding,this.minFilter=n.LinearFilter,this.magFilter=n.LinearFilter,this.wrapS=n.ClampToEdgeWrapping,this.wrapT=n.ClampToEdgeWrapping,this.wrapR=n.ClampToEdgeWrapping,this.unpackAlignment=1,this.needsUpdate=!0,this.domainMin=new n.Vector3(0,0,0),this.domainMax=new n.Vector3(1,1,1)}get isLookupTexture3D(){return!0}scaleUp(t,e=!0){const i=this.image;let n;return n=t<=i.width?Promise.reject(new Error("The target size must be greater than the current size")):new Promise((n,r)=>{const s=URL.createObjectURL(new Blob(['(()=>{var E=Math.pow;var _={SCALE_UP:"lut.scaleup"};var k=[new Float32Array(3),new Float32Array(3)],n=[new Float32Array(3),new Float32Array(3),new Float32Array(3),new Float32Array(3)],Z=[[new Float32Array([0,0,0]),new Float32Array([1,0,0]),new Float32Array([1,1,0]),new Float32Array([1,1,1])],[new Float32Array([0,0,0]),new Float32Array([1,0,0]),new Float32Array([1,0,1]),new Float32Array([1,1,1])],[new Float32Array([0,0,0]),new Float32Array([0,0,1]),new Float32Array([1,0,1]),new Float32Array([1,1,1])],[new Float32Array([0,0,0]),new Float32Array([0,1,0]),new Float32Array([1,1,0]),new Float32Array([1,1,1])],[new Float32Array([0,0,0]),new Float32Array([0,1,0]),new Float32Array([0,1,1]),new Float32Array([1,1,1])],[new Float32Array([0,0,0]),new Float32Array([0,0,1]),new Float32Array([0,1,1]),new Float32Array([1,1,1])]];function S(a,t,r,m){let i=r[0]-t[0],e=r[1]-t[1],y=r[2]-t[2],h=a[0]-t[0],A=a[1]-t[1],w=a[2]-t[2],c=e*w-y*A,l=y*h-i*w,x=i*A-e*h,u=Math.sqrt(c*c+l*l+x*x),b=u*.5,s=c/u,F=l/u,f=x/u,p=-(a[0]*s+a[1]*F+a[2]*f),M=m[0]*s+m[1]*F+m[2]*f;return Math.abs(M+p)*b/3}function U(a,t,r,m,i,e){let y=(r+m*t+i*t*t)*4;e[0]=a[y+0],e[1]=a[y+1],e[2]=a[y+2]}function j(a,t,r,m,i,e){let y=r*(t-1),h=m*(t-1),A=i*(t-1),w=Math.floor(y),c=Math.floor(h),l=Math.floor(A),x=Math.ceil(y),u=Math.ceil(h),b=Math.ceil(A),s=y-w,F=h-c,f=A-l;if(w===y&&c===h&&l===A)U(a,t,y,h,A,e);else{let p;s>=F&&F>=f?p=Z[0]:s>=f&&f>=F?p=Z[1]:f>=s&&s>=F?p=Z[2]:F>=s&&s>=f?p=Z[3]:F>=f&&f>=s?p=Z[4]:f>=F&&F>=s&&(p=Z[5]);let[M,g,X,Y]=p,P=k[0];P[0]=s,P[1]=F,P[2]=f;let o=k[1],V=x-w,d=u-c,L=b-l;o[0]=V*M[0]+w,o[1]=d*M[1]+c,o[2]=L*M[2]+l,U(a,t,o[0],o[1],o[2],n[0]),o[0]=V*g[0]+w,o[1]=d*g[1]+c,o[2]=L*g[2]+l,U(a,t,o[0],o[1],o[2],n[1]),o[0]=V*X[0]+w,o[1]=d*X[1]+c,o[2]=L*X[2]+l,U(a,t,o[0],o[1],o[2],n[2]),o[0]=V*Y[0]+w,o[1]=d*Y[1]+c,o[2]=L*Y[2]+l,U(a,t,o[0],o[1],o[2],n[3]);let T=S(g,X,Y,P)*6,v=S(M,X,Y,P)*6,q=S(M,g,Y,P)*6,C=S(M,g,X,P)*6;n[0][0]*=T,n[0][1]*=T,n[0][2]*=T,n[1][0]*=v,n[1][1]*=v,n[1][2]*=v,n[2][0]*=q,n[2][1]*=q,n[2][2]*=q,n[3][0]*=C,n[3][1]*=C,n[3][2]*=C,e[0]=n[0][0]+n[1][0]+n[2][0]+n[3][0],e[1]=n[0][1]+n[1][1]+n[2][1]+n[3][1],e[2]=n[0][2]+n[1][2]+n[2][2]+n[3][2]}}var O=class{static expand(t,r){let m=Math.cbrt(t.length/4),i=new Float32Array(3),e=new t.constructor(E(r,3)*4),y=t instanceof Uint8Array?255:1,h=E(r,2),A=1/(r-1);for(let w=0;w{let t=a.data,r=t.data;switch(t.operation){case _.SCALE_UP:r=O.expand(r,t.size);break}postMessage(r,[r.buffer]),close()});})();\n'],{type:"text/javascript"})),o=new Worker(s);o.addEventListener("error",t=>r(t.error)),o.addEventListener("message",e=>{const i=new tt(e.data,t);i.encoding=this.encoding,i.type=this.type,i.name=this.name,URL.revokeObjectURL(s),n(i)});const a=e?[i.data.buffer]:[];o.postMessage({operation:Z,data:i.data,size:t},a)}),n}applyLUT(t){const e=this.image,i=t.image,r=Math.min(e.width,e.height,e.depth);if(r!==Math.min(i.width,i.height,i.depth));else if(t.type!==n.FloatType||this.type!==n.FloatType);else if(t.format!==n.RGBAFormat||this.format!==n.RGBAFormat);else{const t=e.data,n=i.data,s=r,o=s**2,a=s-1;for(let e=0,i=s**3;en){s=new Uint8Array(t.length);for(let e=0;e=1e-5){bool h=max(a.x,a.z)>max(a.y,a.w);vec4 blendingOffset=vec4(0.0,a.y,0.0,a.w);vec2 blendingWeight=a.yw;movec(bvec4(h),blendingOffset,vec4(a.x,0.0,a.z,0.0));movec(bvec2(h),blendingWeight,a.xz);blendingWeight/=dot(blendingWeight,vec2(1.0));vec4 blendingCoord=blendingOffset*vec4(texelSize,-texelSize)+uv.xyxy;color=blendingWeight.x*texture2D(inputBuffer,blendingCoord.xy);color+=blendingWeight.y*texture2D(inputBuffer,blendingCoord.zw);}outputColor=color;}",{vertexShader:"varying vec2 vOffset0;varying vec2 vOffset1;void mainSupport(const in vec2 uv){vOffset0=uv+texelSize*vec2(1.0,0.0);vOffset1=uv+texelSize*vec2(0.0,1.0);}",blendFunction:B,attributes:V|U,uniforms:new Map([["weightMap",new n.Uniform(null)]])}),arguments.length>1&&(r=arguments[0],s=arguments[1],arguments.length>2&&(t=arguments[2]),arguments.length>3&&(e=arguments[3])),this.renderTargetEdges=new n.WebGLRenderTarget(1,1,{minFilter:n.LinearFilter,stencilBuffer:!1,depthBuffer:!1}),this.renderTargetEdges.texture.name="SMAA.Edges",this.renderTargetWeights=this.renderTargetEdges.clone(),this.renderTargetWeights.texture.name="SMAA.Weights",this.uniforms.get("weightMap").value=this.renderTargetWeights.texture,this.clearPass=new _(!0,!1,!1),this.clearPass.overrideClearColor=new n.Color(0),this.clearPass.overrideClearAlpha=1,this.edgeDetectionPass=new j(new g),this.edgeDetectionMaterial.edgeDetectionMode=e,this.edgeDetectionMaterial.predicationMode=i,this.weightsPass=new j(new w);const o=new n.LoadingManager;o.onLoad=()=>{const t=new n.Texture(r);t.name="SMAA.Search",t.magFilter=n.NearestFilter,t.minFilter=n.NearestFilter,t.generateMipmaps=!1,t.needsUpdate=!0,t.flipY=!0,this.weightsMaterial.searchTexture=t;const e=new n.Texture(s);e.name="SMAA.Area",e.magFilter=n.LinearFilter,e.minFilter=n.LinearFilter,e.generateMipmaps=!1,e.needsUpdate=!0,e.flipY=!1,this.weightsMaterial.areaTexture=e,this.dispatchEvent({type:"load"})},o.itemStart("search"),o.itemStart("area"),void 0!==r&&void 0!==s?(o.itemEnd("search"),o.itemEnd("area")):"undefined"!=typeof Image&&(r=new Image,s=new Image,r.addEventListener("load",()=>o.itemEnd("search")),s.addEventListener("load",()=>o.itemEnd("area")),r.src=et,s.src=it),this.applyPreset(t)}get edgesTexture(){return this.renderTargetEdges.texture}getEdgesTexture(){return this.edgesTexture}get weightsTexture(){return this.renderTargetWeights.texture}getWeightsTexture(){return this.weightsTexture}get edgeDetectionMaterial(){return this.edgeDetectionPass.fullscreenMaterial}get colorEdgesMaterial(){return this.edgeDetectionMaterial}getEdgeDetectionMaterial(){return this.edgeDetectionMaterial}get weightsMaterial(){return this.weightsPass.fullscreenMaterial}getWeightsMaterial(){return this.weightsMaterial}setEdgeDetectionThreshold(t){this.edgeDetectionMaterial.edgeDetectionThreshold=t}setOrthogonalSearchSteps(t){this.weightsMaterial.orthogonalSearchSteps=t}applyPreset(t){const e=this.edgeDetectionMaterial,i=this.weightsMaterial;switch(t){case nt:e.edgeDetectionThreshold=.15,i.orthogonalSearchSteps=4,i.diagonalDetection=!1,i.cornerDetection=!1;break;case rt:e.edgeDetectionThreshold=.1,i.orthogonalSearchSteps=8,i.diagonalDetection=!1,i.cornerDetection=!1;break;case st:e.edgeDetectionThreshold=.1,i.orthogonalSearchSteps=16,i.diagonalSearchSteps=8,i.cornerRounding=25,i.diagonalDetection=!0,i.cornerDetection=!0;break;case ot:e.edgeDetectionThreshold=.05,i.orthogonalSearchSteps=32,i.diagonalSearchSteps=16,i.cornerRounding=25,i.diagonalDetection=!0,i.cornerDetection=!0}}setDepthTexture(t,e=n.BasicDepthPacking){this.edgeDetectionMaterial.depthBuffer=t,this.edgeDetectionMaterial.depthPacking=e}update(t,e,i){this.clearPass.render(t,this.renderTargetEdges),this.edgeDetectionPass.render(t,e,this.renderTargetEdges),this.weightsPass.render(t,this.renderTargetEdges,this.renderTargetWeights)}setSize(t,e){this.edgeDetectionMaterial.setSize(t,e),this.weightsMaterial.setSize(t,e),this.renderTargetEdges.setSize(t,e),this.renderTargetWeights.setSize(t,e)}dispose(){const{searchTexture:t,areaTexture:e}=this.weightsMaterial;null!==t&&null!==e&&(t.dispose(),e.dispose()),super.dispose()}static get searchImageDataURL(){return et}static get areaImageDataURL(){return it}};new Float32Array(3),new Float32Array(3),new Float32Array(3),new Float32Array(3),new Float32Array(3),new Float32Array(3),new Float32Array([0,0,0]),new Float32Array([1,0,0]),new Float32Array([1,1,0]),new Float32Array([1,1,1]),new Float32Array([0,0,0]),new Float32Array([1,0,0]),new Float32Array([1,0,1]),new Float32Array([1,1,1]),new Float32Array([0,0,0]),new Float32Array([0,0,1]),new Float32Array([1,0,1]),new Float32Array([1,1,1]),new Float32Array([0,0,0]),new Float32Array([0,1,0]),new Float32Array([1,1,0]),new Float32Array([1,1,1]),new Float32Array([0,0,0]),new Float32Array([0,1,0]),new Float32Array([0,1,1]),new Float32Array([1,1,1]),new Float32Array([0,0,0]),new Float32Array([0,0,1]),new Float32Array([0,1,1]),new Float32Array([1,1,1]);new Float32Array(2),new Float32Array(2),new Float32Array([0,-.25,.25,-.125,.125,-.375,.375]),new Float32Array([0,0]),new Float32Array([.25,-.25]),new Float32Array([-.25,.25]),new Float32Array([.125,-.125]),new Float32Array([-.125,.125]),new Uint8Array([0,0]),new Uint8Array([3,0]),new Uint8Array([0,3]),new Uint8Array([3,3]),new Uint8Array([1,0]),new Uint8Array([4,0]),new Uint8Array([1,3]),new Uint8Array([4,3]),new Uint8Array([0,1]),new Uint8Array([3,1]),new Uint8Array([0,4]),new Uint8Array([3,4]),new Uint8Array([1,1]),new Uint8Array([4,1]),new Uint8Array([1,4]),new Uint8Array([4,4]),new Uint8Array([0,0]),new Uint8Array([1,0]),new Uint8Array([0,2]),new Uint8Array([1,2]),new Uint8Array([2,0]),new Uint8Array([3,0]),new Uint8Array([2,2]),new Uint8Array([3,2]),new Uint8Array([0,1]),new Uint8Array([1,1]),new Uint8Array([0,3]),new Uint8Array([1,3]),new Uint8Array([2,1]),new Uint8Array([3,1]),new Uint8Array([2,3]),new Uint8Array([3,3]);lt(0,0,0,0),new Float32Array([0,0,0,0]),lt(0,0,0,1),new Float32Array([0,0,0,1]),lt(0,0,1,0),new Float32Array([0,0,1,0]),lt(0,0,1,1),new Float32Array([0,0,1,1]),lt(0,1,0,0),new Float32Array([0,1,0,0]),lt(0,1,0,1),new Float32Array([0,1,0,1]),lt(0,1,1,0),new Float32Array([0,1,1,0]),lt(0,1,1,1),new Float32Array([0,1,1,1]),lt(1,0,0,0),new Float32Array([1,0,0,0]),lt(1,0,0,1),new Float32Array([1,0,0,1]),lt(1,0,1,0),new Float32Array([1,0,1,0]),lt(1,0,1,1),new Float32Array([1,0,1,1]),lt(1,1,0,0),new Float32Array([1,1,0,0]),lt(1,1,0,1),new Float32Array([1,1,0,1]),lt(1,1,1,0),new Float32Array([1,1,1,0]),lt(1,1,1,1),new Float32Array([1,1,1,1]);function ht(t,e,i){return t+(e-t)*i}function lt(t,e,i,n){const r=ht(t,e,.75),s=ht(i,n,.75);return ht(r,s,.875)}n.Loader,n.Loader,n.Loader;var ut=i(12);function ct(t,e){for(var i=0;i0&&t>0?(this.inputBuffer.samples=t,this.outputBuffer.samples=t,this.inputBuffer.dispose(),this.outputBuffer.dispose()):i!==t&&(this.inputBuffer.dispose(),this.outputBuffer.dispose(),this.inputBuffer=this.createBuffer(e.depthBuffer,e.stencilBuffer,e.texture.type,t),this.inputBuffer.depthTexture=this.depthTexture,this.outputBuffer=this.inputBuffer.clone())}getTimer(){return this.timer}getRenderer(){return this.renderer}setRenderer(t){if(this.renderer=t,null!==t){const e=t.getSize(new n.Vector2),i=t.getContext().getContextAttributes().alpha,r=this.inputBuffer.texture.type;r===n.UnsignedByteType&&t.outputEncoding===n.sRGBEncoding&&(this.inputBuffer.texture.encoding=n.sRGBEncoding,this.outputBuffer.texture.encoding=n.sRGBEncoding,this.inputBuffer.dispose(),this.outputBuffer.dispose()),t.autoClear=!1,this.setSize(e.width,e.height);for(const e of this.passes)e.initialize(t,i,r)}}replaceRenderer(t,e=!0){const i=this.renderer,n=i.domElement.parentNode;return this.setRenderer(t),e&&null!==n&&(n.removeChild(i.domElement),n.appendChild(t.domElement)),i}createDepthTexture(){const t=this.depthTexture=new n.DepthTexture;return this.inputBuffer.depthTexture=t,this.inputBuffer.dispose(),this.inputBuffer.stencilBuffer?(t.format=n.DepthStencilFormat,t.type=n.UnsignedInt248Type):t.type=n.UnsignedIntType,t}deleteDepthTexture(){if(null!==this.depthTexture){this.depthTexture.dispose(),this.depthTexture=null,this.inputBuffer.depthTexture=null,this.inputBuffer.dispose();for(const t of this.passes)t.setDepthTexture(null)}}createBuffer(t,e,i,r){const s=this.renderer,o=null===s?new n.Vector2:s.getDrawingBufferSize(new n.Vector2),a={minFilter:n.LinearFilter,magFilter:n.LinearFilter,stencilBuffer:e,depthBuffer:t,type:i};let h;return r>0?(h=Number(n.REVISION.replace(/\D+/g,""))<138?new n.WebGLMultisampleRenderTarget(o.width,o.height,a):new n.WebGLRenderTarget(o.width,o.height,a),h.ignoreDepthForMultisampleCopy=!1,h.samples=r):h=new n.WebGLRenderTarget(o.width,o.height,a),i===n.UnsignedByteType&&null!==s&&s.outputEncoding===n.sRGBEncoding&&(h.texture.encoding=n.sRGBEncoding),h.texture.name="EffectComposer.Buffer",h.texture.generateMipmaps=!1,h}addPass(t,e){const i=this.passes,r=this.renderer,s=r.getDrawingBufferSize(new n.Vector2),o=r.getContext().getContextAttributes().alpha,a=this.inputBuffer.texture.type;if(t.setRenderer(r),t.setSize(s.width,s.height),t.initialize(r,o,a),this.autoRenderToScreen&&(i.length>0&&(i[i.length-1].renderToScreen=!1),t.renderToScreen&&(this.autoRenderToScreen=!1)),void 0!==e?i.splice(e,0,t):i.push(t),this.autoRenderToScreen&&(i[i.length-1].renderToScreen=!0),t.needsDepthTexture||null!==this.depthTexture)if(null===this.depthTexture){const e=this.createDepthTexture();for(t of i)t.setDepthTexture(e)}else t.setDepthTexture(this.depthTexture)}removePass(t){const e=this.passes,i=e.indexOf(t);if(-1!==i&&e.splice(i,1).length>0){if(null!==this.depthTexture){const i=(t,e)=>t||e.needsDepthTexture;e.reduce(i,!1)||(t.getDepthTexture()===this.depthTexture&&t.setDepthTexture(null),this.deleteDepthTexture())}this.autoRenderToScreen&&i===e.length&&(t.renderToScreen=!1,e.length>0&&(e[e.length-1].renderToScreen=!0))}}removeAllPasses(){const t=this.passes;this.deleteDepthTexture(),t.length>0&&(this.autoRenderToScreen&&(t[t.length-1].renderToScreen=!1),this.passes=[])}render(t){const e=this.renderer,i=this.copyPass;let n,r,s,o=this.inputBuffer,a=this.outputBuffer,h=!1;void 0===t&&(t=this.timer.update().getDelta());for(const l of this.passes)l.enabled&&(l.render(e,o,a,t,h),l.needsSwap&&(h&&(i.renderToScreen=l.renderToScreen,n=e.getContext(),r=e.state.buffers.stencil,r.setFunc(n.NOTEQUAL,1,4294967295),i.render(e,o,a,t,h),r.setFunc(n.EQUAL,1,4294967295)),s=o,o=a,a=s),l instanceof X?h=!0:l instanceof E&&(h=!1))}setSize(t,e,i){const r=this.renderer;if(void 0===t||void 0===e){const i=r.getSize(new n.Vector2);t=i.width,e=i.height}r.setSize(t,e,i);const s=r.getDrawingBufferSize(new n.Vector2);this.inputBuffer.setSize(s.width,s.height),this.outputBuffer.setSize(s.width,s.height);for(const t of this.passes)t.setSize(s.width,s.height)}reset(){const t=this.timer.isAutoResetEnabled();this.dispose(),this.autoRenderToScreen=!0,this.timer.setAutoResetEnabled(t)}dispose(){for(const t of this.passes)t.dispose();this.passes=[],null!==this.inputBuffer&&this.inputBuffer.dispose(),null!==this.outputBuffer&&this.outputBuffer.dispose(),this.deleteDepthTexture(),this.copyPass.dispose(),this.timer.dispose()}}(t.renderer);var e=new R(t.scene,t.camera);e.renderToScreen=!1,new at({preset:rt,edgeDetectionMode:d,predicationMode:m}).edgeDetectionMaterial.edgeDetectionThreshold=.001;var i=new Q({blendFunction:B,saturation:-.01,hue:0}),r=new q({blendFunction:B,brightness:-.01,contrast:.09});this.brightnessEffect=r,setTimeout((function(){if(ut.a.gui){var t={val:0};ut.a.gui.add(t,"val",-1,1,.01).onChange((function(){i.hue=t.val})),ut.a.gui.add(i,"saturation",-1,1,.01).onChange((function(){i.update()})),ut.a.gui.add(r,"brightness",-.3,.3,.01),ut.a.gui.add(r,"contrast",-1,1,.01)}}),10);var s=new Y(t.camera,i,r);t.composer.addPass(e),t.composer.addPass(s),this.inited=!0,this.main=t}},{key:"resize",value:function(t,e){this.inited&&this.main.composer.setSize(t,e)}},{key:"render",value:function(){this.inited&&this.main.composer.render()}}],(i=null)&&ct(e.prototype,i),r&&ct(e,r),Object.defineProperty(e,"prototype",{writable:!1}),t}()},function(t,e,i){"use strict";var n=i(0),r=i(48),s=i.n(r),o=i(2),a=(i(20),i(1)),h=i(49),l=i(50),u=i(51),c=i(52),d=i(53),p=i(3),f=i(15),m={};m.armDataList=[h,l,u,c,d],m.getArmData=function(t){var e=t;return void 0===e&&(e=n.MathUtils.randInt(0,m.armDataList.length-1)),m.armDataList[e]},m.createMesh=function(t,e){for(var i=arguments.length>2&&void 0!==arguments[2]&&arguments[2],r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"#000000",o=[],a=[],h=0;h=0;v--)s.lineTo(a[v].x,a[v].y);var y=new n.ExtrudeGeometry(s,{steps:1,depth:.1,bevelEnabled:!1});e.x,r[0].x,e.y,r[0].y;return i&&-1,y},m.animateMesh=function(t,e,i,r){var s={val:2},o=-1;e.visible=!0;var h=new n.CatmullRomCurve3(t).getSpacedPoints(100);r.createAnimStarted=!0;for(var l=[],u=0;u=a;c--){var d=s[c],p=d.offsetman;e.pointToWorldFrame(p,u),l=u,e.removeShape(d),s.pop()}for(var m=[],g=0;g1){t.destroyTim=0;var s=n[n.length-1].clone().add(t.parent.position);f.a.crumbleEffect.startSpawning(s,1)}}},m.createGeometry=function(t,e,i){for(this.dummyObjList||(this.dummyObjList=[]);this.dummyObjList.length>0;){var r=this.dummyObjList.pop();a.a.main.scene.remove(r)}var s=new n.CatmullRomCurve3(t),o=new n.TubeGeometry(s,60,.15,3);o.center(),o.scale(1,1,1);var h=o.getAttribute("position"),l=(new n.Vector3).fromBufferAttribute(h,0),u=e.x-l.x,c=e.y-l.y,d=.56;return i&&(d*=-1),o.translate(u,c,d),o.curTranslate=new n.Vector3(u,c,d),o},m.createBody=function(t,e,i){var r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:1,s=new n.CatmullRomCurve3(t),a=.56;i&&(a*=-1);var h=0-(t=s.getSpacedPoints(t.length-1))[0].x+0*Math.sign(a),l=0-t[0].y+0*Math.sign(a),u=new n.CatmullRomCurve3(t).getSpacedPoints(Math.floor(t.length*r));h=0-u[0].x;for(var c=.15,d=[],f=new n.Object3D,m=0;mt.length)&&(e=t.length);for(var i=0,n=new Array(e);i=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(t){throw t},f:r}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var s,o=!0,a=!1;return{s:function(){i=i.call(t)},n:function(){var t=i.next();return o=t.done,t},e:function(t){a=!0,s=t},f:function(){try{o||null==i.return||i.return()}finally{if(a)throw s}}}}var x=function(t){l(i,t);var e=f(i);function i(t){var n;return s(this,i),h(d(n=e.call(this)),"type","ParticleEmitter"),h(d(n),"system",void 0),n.system=t,n.visible=!1,n}return a(i,[{key:"clone",value:function(){return this.system.clone().emitter}},{key:"dispose",value:function(){}},{key:"extractFromCache",value:function(t){var e=[];for(var i in t){var n=t[i];delete n.metadata,e.push(n)}return e}},{key:"toJSON",value:function(t){var e=void 0===t||"string"==typeof t,i={};e&&(t={geometries:{},materials:{},textures:{},images:{},shapes:{}},i.metadata={version:4.5,type:"Object",generator:"Object3D.toJSON"});var n={};if(n.uuid=this.uuid,n.type=this.type,""!==this.name&&(n.name=this.name),!0===this.castShadow&&(n.castShadow=!0),!0===this.receiveShadow&&(n.receiveShadow=!0),!1===this.visible&&(n.visible=!1),!1===this.frustumCulled&&(n.frustumCulled=!1),0!==this.renderOrder&&(n.renderOrder=this.renderOrder),"{}"!==JSON.stringify(this.userData)&&(n.userData=this.userData),n.layers=this.layers.mask,n.matrix=this.matrix.toArray(),!1===this.matrixAutoUpdate&&(n.matrixAutoUpdate=!1),null!==this.system&&(n.ps=this.system.toJSON(t)),this.children.length>0){n.children=[];for(var r=0;r0&&(i.geometries=s),o.length>0&&(i.materials=o),a.length>0&&(i.textures=a),h.length>0&&(i.images=h)}return i.object=n,i}}]),i}(r.Object3D),w=function t(){s(this,t),h(this,"startSpeed",0),h(this,"startColor",new r.Vector4),h(this,"startSize",1),h(this,"velocity",new r.Vector3),h(this,"age",0),h(this,"life",1),h(this,"angularVelocity",void 0),h(this,"position",new r.Vector3),h(this,"rotation",0),h(this,"rotationQuat",void 0),h(this,"size",1),h(this,"color",new r.Vector4),h(this,"uvTile",0)},b=function(){function t(e){s(this,t),this.value=e,h(this,"type",void 0),this.type="value"}return a(t,[{key:"genValue",value:function(){return this.value}},{key:"toJSON",value:function(){return{type:"ConstantValue",value:this.value}}},{key:"clone",value:function(){return new t(this.value)}}],[{key:"fromJSON",value:function(e){return new t(e.value)}}]),t}(),A=function(){function t(e,i){s(this,t),this.a=e,this.b=i,h(this,"type",void 0),this.type="value"}return a(t,[{key:"genValue",value:function(){return r.MathUtils.lerp(this.a,this.b,Math.random())}},{key:"toJSON",value:function(){return{type:"IntervalValue",a:this.a,b:this.b}}},{key:"clone",value:function(){return new t(this.a,this.b)}}],[{key:"fromJSON",value:function(e){return new t(e.a,e.b)}}]),t}(),T=function(){function t(){s(this,t),h(this,"functions",void 0),this.functions=new Array}return a(t,[{key:"findFunction",value:function(t){for(var e=0,i=0,n=this.functions.length-1;i+1this.getEndX(e)))return e;i=e+1}for(var r=i;r<=n;r++)if(t>=this.functions[r][1]&&t<=this.getEndX(r))return r;return-1}},{key:"getStartX",value:function(t){return this.functions[t][1]}},{key:"setStartX",value:function(t,e){t>0&&(this.functions[t][1]=e)}},{key:"getEndX",value:function(t){return t+10;n--){for(var r=[],s=0;s1;){for(n=[],o=0,a=i.length-1;o0&&void 0!==arguments[0]?arguments[0]:[[new S(0,1/3,1/3*2,1),0]];return s(this,i),h(d(t=e.call(this)),"type",void 0),t.type="function",t.functions=n,t}return a(i,[{key:"genValue",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,e=this.findFunction(t);return-1===e?0:this.functions[e][0].genValue((t-this.getStartX(e))/(this.getEndX(e)-this.getStartX(e)))}},{key:"toSVG",value:function(t,e){if(e<1)return"";for(var i=["M",0,this.functions[0][0].p[0]].join(" "),n=1/e;n<=1;n+=1/e)i=[i,"L",n*t,this.genValue(n)].join(" ");return i}},{key:"toJSON",value:function(){return{type:"PiecewiseBezier",functions:this.functions.map((function(t){var e=m(t,2),i=e[0],n=e[1];return{function:i.toJSON(),start:n}}))}}},{key:"clone",value:function(){return new i(this.functions.map((function(t){var e=m(t,2),i=e[0],n=e[1];return[i.clone(),n]})))}}],[{key:"fromJSON",value:function(t){return new i(t.functions.map((function(t){return[S.fromJSON(t.function),t.start]})))}}]),i}(T);function M(t){switch(t.type){case"ConstantValue":return b.fromJSON(t);case"IntervalValue":return A.fromJSON(t);case"PiecewiseBezier":return E.fromJSON(t);default:return new b(0)}}var _=function(t){return{r:t.x,g:t.y,b:t.z,a:t.w}},C=function(t){return new r.Vector4(t.r,t.g,t.b,t.a)},P=function(){function t(e,i){s(this,t),this.a=e,this.b=i,h(this,"type",void 0),this.type="value"}return a(t,[{key:"genColor",value:function(t){var e=Math.random();return t.copy(this.a).lerp(this.b,e)}},{key:"toJSON",value:function(){return{type:"RandomColor",a:_(this.a),b:_(this.b)}}},{key:"clone",value:function(){return new t(this.a.clone(),this.b.clone())}}],[{key:"fromJSON",value:function(e){return new t(C(e.a),C(e.b))}}]),t}(),R=function(){function t(e,i){s(this,t),this.a=e,this.b=i,h(this,"type",void 0),this.type="function"}return a(t,[{key:"genColor",value:function(t,e){return t.copy(this.a).lerp(this.b,e)}},{key:"toJSON",value:function(){return{type:"ColorRange",a:_(this.a),b:_(this.b)}}},{key:"clone",value:function(){return new t(this.a.clone(),this.b.clone())}}],[{key:"fromJSON",value:function(e){return new t(C(e.a),C(e.b))}}]),t}(),L=function(){function t(e){s(this,t),this.color=e,h(this,"type",void 0),this.type="value"}return a(t,[{key:"genColor",value:function(t){return t.copy(this.color)}},{key:"toJSON",value:function(){return{type:"ConstantColor",color:_(this.color)}}},{key:"clone",value:function(){return new t(this.color.clone())}}],[{key:"fromJSON",value:function(e){return new t(C(e.color))}}]),t}();function O(t){switch(t.type){case"ConstantColor":return L.fromJSON(t);case"ColorRange":return R.fromJSON(t);case"RandomColor":return P.fromJSON(t);default:return new L(new r.Vector4(1,1,1,1))}}var D=function(){function t(e){s(this,t),this.func=e,h(this,"type","ColorOverLife")}return a(t,[{key:"initialize",value:function(t){}},{key:"update",value:function(t,e){this.func.genColor(t.color,t.age/t.life),t.color.x*=t.startColor.x,t.color.y*=t.startColor.y,t.color.z*=t.startColor.z,t.color.w*=t.startColor.w}},{key:"toJSON",value:function(){return{type:this.type,func:this.func.toJSON()}}},{key:"clone",value:function(){return new t(this.func.clone())}}]),t}(),B=function(){function t(e){s(this,t),this.angularVelocityFunc=e,h(this,"type","RotationOverLife")}return a(t,[{key:"initialize",value:function(t){"value"===this.angularVelocityFunc.type?t.angularVelocity=this.angularVelocityFunc.genValue():t.angularVelocity=0}},{key:"update",value:function(t,e){"value"===this.angularVelocityFunc.type?t.rotation+=e*t.angularVelocity:t.rotation+=e*this.angularVelocityFunc.genValue(t.age/t.life)}},{key:"toJSON",value:function(){return{type:this.type,func:this.angularVelocityFunc.toJSON()}}},{key:"clone",value:function(){return new t(this.angularVelocityFunc)}}]),t}(),I=function(){function t(e){s(this,t),this.func=e,h(this,"type","SizeOverLife")}return a(t,[{key:"initialize",value:function(t){}},{key:"update",value:function(t){t.size=t.startSize*this.func.genValue(t.age/t.life)}},{key:"toJSON",value:function(){return{type:this.type,func:this.func.toJSON()}}},{key:"clone",value:function(){return new t(this.func.clone())}}]),t}(),F=function(){function t(e){s(this,t),this.func=e,h(this,"type","SpeedOverLife")}return a(t,[{key:"initialize",value:function(t){}},{key:"update",value:function(t){t.velocity.normalize().multiplyScalar(t.startSpeed*this.func.genValue(t.age/t.life))}},{key:"toJSON",value:function(){return{type:this.type,func:this.func.toJSON()}}},{key:"clone",value:function(){return new t(this.func.clone())}}]),t}(),k=function(){function t(e){s(this,t),this.func=e,h(this,"type","FrameOverLife")}return a(t,[{key:"initialize",value:function(t){}},{key:"update",value:function(t,e){t.uvTile=Math.floor(this.func.genValue(t.age/t.life))}},{key:"toJSON",value:function(){return{type:this.type,func:this.func.toJSON()}}},{key:"clone",value:function(){return new t(this.func.clone())}}]),t}();new r.Vector3;var N=function(){function t(e){s(this,t),this.angularVelocityFunc=e,h(this,"type","OrbitOverLife")}return a(t,[{key:"initialize",value:function(t){"value"===this.angularVelocityFunc.type?t.angularVelocity=this.angularVelocityFunc.genValue():t.angularVelocity=0}},{key:"update",value:function(t,e){var i=Math.atan2(t.position.y,t.position.x),n=Math.sqrt(t.position.x*t.position.x+t.position.y*t.position.y);i+=this.angularVelocityFunc.genValue(t.age/t.life)*e,t.position.x=Math.cos(i)*n,t.position.y=Math.sin(i)*n}},{key:"toJSON",value:function(){return{type:this.type,func:this.angularVelocityFunc.toJSON()}}},{key:"clone",value:function(){return new t(this.angularVelocityFunc.clone())}}]),t}();var z,U=function(){function t(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};s(this,t),h(this,"radius",void 0),h(this,"arc",void 0),h(this,"thickness",void 0),h(this,"angle",void 0),this.radius=e.radius||10,this.arc=e.arc||2*Math.PI,this.thickness=e.thickness||1,this.angle=e.angle||Math.PI/6}return a(t,[{key:"initialize",value:function(t){var e=Math.random(),i=r.MathUtils.lerp(1-this.thickness,1,Math.random()),n=e*this.arc,s=Math.sqrt(i),o=Math.sin(n),a=Math.cos(n);t.position.x=s*a,t.position.y=s*o,t.position.z=0;var h=this.angle*s;t.velocity.set(0,0,Math.cos(h)).addScaledVector(t.position,Math.sin(h)).multiplyScalar(t.startSpeed),t.position.multiplyScalar(this.radius)}},{key:"toJSON",value:function(){return{type:"cone",radius:this.radius,arc:this.arc,thickness:this.thickness,angle:this.angle}}},{key:"clone",value:function(){return new t({radius:this.radius,arc:this.arc,thickness:this.thickness,angle:this.angle})}}]),t}(),V=function(){function t(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};s(this,t),h(this,"radius",void 0),h(this,"arc",void 0),h(this,"thickness",void 0),this.radius=e.radius||10,this.arc=e.arc||2*Math.PI,this.thickness=e.thickness||1}return a(t,[{key:"initialize",value:function(t){var e=Math.random(),i=Math.random(),n=r.MathUtils.lerp(1-this.thickness,1,Math.random()),s=e*this.arc,o=Math.acos(2*i-1),a=Math.cbrt(n),h=Math.sin(s),l=Math.cos(s),u=Math.sin(o),c=Math.cos(o);t.position.x=a*u*l,t.position.y=a*u*h,t.position.z=a*c,t.velocity.setScalar(0).addScaledVector(t.position,t.startSpeed),t.position.multiplyScalar(this.radius)}},{key:"toJSON",value:function(){return{type:"sphere",radius:this.radius,arc:this.arc,thickness:this.thickness}}},{key:"clone",value:function(){return new t({radius:this.radius,arc:this.arc,thickness:this.thickness})}}]),t}(),H=function(){function t(){s(this,t)}return a(t,[{key:"initialize",value:function(t){var e=Math.random(),i=Math.random(),n=e*Math.PI*2,r=Math.acos(2*i-1),s=Math.cbrt(Math.random()),o=Math.sin(n),a=Math.cos(n),h=Math.sin(r),l=Math.cos(r);t.velocity.x=s*h*a,t.velocity.y=s*h*o,t.velocity.z=s*l,t.velocity.multiplyScalar(t.startSpeed),t.position.setScalar(0)}},{key:"toJSON",value:function(){return{type:"point"}}},{key:"clone",value:function(){return new t}}]),t}(),G=function(){function t(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};s(this,t),h(this,"radius",void 0),h(this,"arc",void 0),h(this,"thickness",void 0),h(this,"angle",void 0),this.radius=e.radius||10,this.arc=e.arc||2*Math.PI,this.thickness=e.thickness||1,this.angle=e.angle||Math.PI/6}return a(t,[{key:"initialize",value:function(t){var e=Math.random(),i=r.MathUtils.lerp(this.thickness,1,Math.random()),n=e*this.arc,s=Math.sqrt(i),o=Math.sin(n),a=Math.cos(n);t.position.x=s*a,t.position.y=s*o,t.position.z=0;var h=this.angle*s;t.velocity.set(0,0,Math.cos(h)).addScaledVector(t.position,Math.sin(h)).multiplyScalar(t.startSpeed),t.position.multiplyScalar(this.radius)}},{key:"toJSON",value:function(){return{type:"donut",radius:this.radius,arc:this.arc,thickness:this.thickness,angle:this.angle}}},{key:"clone",value:function(){return new t({radius:this.radius,arc:this.arc,thickness:this.thickness,angle:this.angle})}}]),t}(),W="\n\n#include \n#include \n#include \n#include \n#include \n\nvarying vec4 vColor;\n\nvoid main() {\n\n #include \n \n vec3 outgoingLight = vec3( 0.0 );\n vec4 diffuseColor = vColor;\n \n #include \n \n #ifdef USE_MAP\n vec4 texelColor = texture2D( map, vUv);\n diffuseColor *= texelColor;\n #endif\n\n outgoingLight = diffuseColor.rgb;\n\n gl_FragColor = vec4( outgoingLight, diffuseColor.a );\n \n #include \n\n}\n";!function(t){t[t.BillBoard=0]="BillBoard",t[t.StretchedBillBoard=1]="StretchedBillBoard",t[t.LocalSpace=2]="LocalSpace"}(z||(z={}));var Y=new r.Vector3(0,0,1),X=function(t){l(i,t);var e=f(i);function i(t){var n;return s(this,i),h(d(n=e.call(this)),"type","ParticleSystemBatch"),h(d(n),"systems",void 0),h(d(n),"geometry",void 0),h(d(n),"material",void 0),h(d(n),"offsetBuffer",void 0),h(d(n),"rotationBuffer",void 0),h(d(n),"sizeBuffer",void 0),h(d(n),"colorBuffer",void 0),h(d(n),"uvTileBuffer",void 0),h(d(n),"velocityBuffer",void 0),h(d(n),"settings",void 0),h(d(n),"vector_",new r.Vector3),h(d(n),"quaternion_",new r.Quaternion),h(d(n),"quaternion2_",new r.Quaternion),h(d(n),"rotationMat_",new r.Matrix3),n.systems=new Set,n.geometry=new r.InstancedBufferGeometry,n.settings=t,n.geometry.setIndex(n.settings.instancingGeometry.getIndex()),n.geometry.setAttribute("position",n.settings.instancingGeometry.getAttribute("position")),n.geometry.setAttribute("uv",n.settings.instancingGeometry.getAttribute("uv")),n.offsetBuffer=new r.InstancedBufferAttribute(new Float32Array(3e3),3),n.offsetBuffer.setUsage(r.DynamicDrawUsage),n.geometry.setAttribute("offset",n.offsetBuffer),n.colorBuffer=new r.InstancedBufferAttribute(new Float32Array(4e3),4),n.colorBuffer.setUsage(r.DynamicDrawUsage),n.geometry.setAttribute("color",n.colorBuffer),t.renderMode===z.LocalSpace?n.rotationBuffer=new r.InstancedBufferAttribute(new Float32Array(4e3),4):n.rotationBuffer=new r.InstancedBufferAttribute(new Float32Array(1e3),1),n.rotationBuffer.setUsage(r.DynamicDrawUsage),n.geometry.setAttribute("rotation",n.rotationBuffer),n.sizeBuffer=new r.InstancedBufferAttribute(new Float32Array(1e3),1),n.sizeBuffer.setUsage(r.DynamicDrawUsage),n.geometry.setAttribute("size",n.sizeBuffer),n.uvTileBuffer=new r.InstancedBufferAttribute(new Float32Array(1e3),1),n.uvTileBuffer.setUsage(r.DynamicDrawUsage),n.geometry.setAttribute("uvTile",n.uvTileBuffer),n.rebuildMaterial(),n.frustumCulled=!1,n.renderOrder=n.settings.renderOrder,n}return a(i,[{key:"addSystem",value:function(t){this.systems.add(t)}},{key:"removeSystem",value:function(t){this.systems.delete(t)}},{key:"rebuildMaterial",value:function(){var t={},e={USE_MAP:"",USE_UV:""};t.map=new r.Uniform(this.settings.texture),t.uvTransform=new r.Uniform((new r.Matrix3).copy(this.settings.texture.matrix));var i=this.settings.uTileCount,n=this.settings.vTileCount;if(e.UV_TILE="",t.tileCount=new r.Uniform(new r.Vector2(i,n)),this.settings.renderMode===z.BillBoard||this.settings.renderMode===z.LocalSpace){var s,o;this.settings.renderMode===z.LocalSpace?(s="\n\n#include \n#include \n#include \n\nattribute vec3 offset;\nattribute vec4 rotation;\nattribute float size;\nattribute vec4 color;\nattribute float uvTile;\n\nvarying vec4 vColor;\n\n#ifdef UV_TILE\nuniform vec2 tileCount;\n#endif\n\nvoid main() {\n\n #ifdef UV_TILE\n vUv = vec2((mod(uvTile, tileCount.y) + uv.x) * (1.0 / tileCount.x), ((tileCount.y - floor(uvTile / tileCount.y) - 1.0) + uv.y) * (1.0 / tileCount.y));\n #else\n #include \n #endif\n \n float x2 = rotation.x + rotation.x, y2 = rotation.y + rotation.y, z2 = rotation.z + rotation.z;\n float xx = rotation.x * x2, xy = rotation.x * y2, xz = rotation.x * z2;\n float yy = rotation.y * y2, yz = rotation.y * z2, zz = rotation.z * z2;\n float wx = rotation.w * x2, wy = rotation.w * y2, wz = rotation.w * z2;\n float sx = size, sy = size, sz = size;\n \n mat4 matrix = mat4(( 1.0 - ( yy + zz ) ) * sx, ( xy + wz ) * sx, ( xz - wy ) * sx, 0.0, // 1. column\n ( xy - wz ) * sy, ( 1.0 - ( xx + zz ) ) * sy, ( yz + wx ) * sy, 0.0, // 2. column\n ( xz + wy ) * sz, ( yz - wx ) * sz, ( 1.0 - ( xx + yy ) ) * sz, 0.0, // 3. column\n offset.x, offset.y, offset.z, 1.0);\n \n vec4 mvPosition = modelViewMatrix * (matrix * vec4( position, 1.0 ));\n\n\tvColor = color;\n\n\tgl_Position = projectionMatrix * mvPosition;\n\n\t#include \n\t#include \n\n}\n",o=r.DoubleSide):(s="\n\n#include \n#include \n#include \n\nattribute vec3 offset;\nattribute float rotation;\nattribute float size;\nattribute vec4 color;\nattribute float uvTile;\n\nvarying vec4 vColor;\n\n#ifdef UV_TILE\nuniform vec2 tileCount;\n#endif\n\nvoid main() {\n\n #ifdef UV_TILE\n vUv = vec2((mod(uvTile, tileCount.y) + uv.x) * (1.0 / tileCount.x), ((tileCount.y - floor(uvTile / tileCount.y) - 1.0) + uv.y) * (1.0 / tileCount.y));\n #else\n #include \n #endif\n\t\n vec4 mvPosition = modelViewMatrix * vec4( offset, 1.0 );\n\t\n vec2 alignedPosition = ( position.xy ) * size;\n \n vec2 rotatedPosition;\n rotatedPosition.x = cos( rotation ) * alignedPosition.x - sin( rotation ) * alignedPosition.y;\n rotatedPosition.y = sin( rotation ) * alignedPosition.x + cos( rotation ) * alignedPosition.y;\n \n mvPosition.xy += rotatedPosition;\n\n\tvColor = color;\n\n\tgl_Position = projectionMatrix * mvPosition;\n\n\t#include \n\t#include \n\n}\n",o=r.FrontSide),this.material=new r.ShaderMaterial({uniforms:t,defines:e,vertexShader:s,fragmentShader:W,transparent:!0,depthWrite:!1,blending:this.settings.blending||r.AdditiveBlending,side:o})}else{if(this.settings.renderMode!==z.StretchedBillBoard)throw new Error("render mode unavailable");this.velocityBuffer=new r.InstancedBufferAttribute(new Float32Array(3e3),3),this.velocityBuffer.setUsage(r.DynamicDrawUsage),this.geometry.setAttribute("velocity",this.velocityBuffer),t.speedFactor=new r.Uniform(1),this.material=new r.ShaderMaterial({uniforms:t,defines:e,vertexShader:"\n\n#include \n#include \n#include \n\nattribute vec3 offset;\nattribute float rotation;\nattribute float size;\nattribute vec4 color;\nattribute vec3 velocity;\nattribute float uvTile;\n\nvarying vec4 vColor;\n\n#ifdef UV_TILE\nuniform vec2 tileCount;\n#endif\n\nuniform float speedFactor;\n\nvoid main() {\n\n #ifdef UV_TILE\n vUv = vec2((mod(uvTile, tileCount.y) + uv.x) * (1.0 / tileCount.x), ((tileCount.y - floor(uvTile / tileCount.y) - 1.0) + uv.y) * (1.0 / tileCount.y));\n #else\n #include \n #endif\n\t\n vec4 mvPosition = modelViewMatrix * vec4( offset, 1.0 );\n vec3 viewVelocity = normalMatrix * velocity;\n\n vec3 scaledPos = vec3(position.xy * size, position.z);\n mvPosition.xyz += scaledPos + dot(scaledPos, viewVelocity) * viewVelocity / length(viewVelocity) * speedFactor;\n\n\tvColor = color;\n\n\tgl_Position = projectionMatrix * mvPosition;\n\n\t#include \n\t#include \n\n}\n",fragmentShader:W,transparent:!0,depthWrite:!1,blending:this.settings.blending||r.AdditiveBlending})}}},{key:"update",value:function(){var t=this,e=0;this.systems.forEach((function(i){var n=i.particles,r=i.particleNum;t.quaternion2_.setFromRotationMatrix(i.emitter.matrixWorld),t.rotationMat_.setFromMatrix4(i.emitter.matrixWorld);for(var s=0;s0&&(this.offsetBuffer.updateRange.count=3*e,this.offsetBuffer.needsUpdate=!0,this.sizeBuffer.updateRange.count=e,this.sizeBuffer.needsUpdate=!0,this.colorBuffer.updateRange.count=4*e,this.colorBuffer.needsUpdate=!0,this.uvTileBuffer.updateRange.count=e,this.uvTileBuffer.needsUpdate=!0,this.settings.renderMode===z.StretchedBillBoard&&(this.velocityBuffer.updateRange.count=3*e,this.velocityBuffer.needsUpdate=!0),this.settings.renderMode===z.LocalSpace?this.rotationBuffer.updateRange.count=4*e:this.rotationBuffer.updateRange.count=e,this.rotationBuffer.needsUpdate=!0)}},{key:"dispose",value:function(){this.geometry.dispose()}}]),i}(r.Mesh),j=new r.Vector3(0,0,1),q=new r.PlaneBufferGeometry(1,1,1,1),Q=function(){function t(e,i){var n,o,a,l,u,c,d,p,f,m,g,v,y,w,A,T,S,E,M,_;s(this,t),h(this,"autoDestroy",void 0),h(this,"looping",void 0),h(this,"duration",void 0),h(this,"maxParticle",void 0),h(this,"startLife",void 0),h(this,"startSpeed",void 0),h(this,"startRotation",void 0),h(this,"startSize",void 0),h(this,"startColor",void 0),h(this,"startTileIndex",void 0),h(this,"emissionOverTime",void 0),h(this,"emissionOverDistance",void 0),h(this,"emissionBursts",void 0),h(this,"worldSpace",void 0),h(this,"speedFactor",void 0),h(this,"particleNum",void 0),h(this,"burstIndex",void 0),h(this,"burstWaveIndex",void 0),h(this,"time",void 0),h(this,"paused",void 0),h(this,"waitEmiting",void 0),h(this,"emitEnded",void 0),h(this,"markForDestroy",void 0),h(this,"behaviors",void 0),h(this,"particles",void 0),h(this,"emitterShape",void 0),h(this,"emitter",void 0),h(this,"rendererSettings",void 0),h(this,"renderer",void 0),h(this,"neededToUpdateRender",void 0),h(this,"oldWorldMatrix",new r.Matrix4),h(this,"normalMatrix",new r.Matrix3),h(this,"firstTimeUpdate",!0),this.renderer=e,this.autoDestroy=void 0!==i.autoDestroy&&i.autoDestroy,this.duration=null!==(n=i.duration)&&void 0!==n?n:1,this.maxParticle=null!==(o=i.maxParticle)&&void 0!==o?o:100,this.looping=void 0===i.looping||i.looping,this.startLife=null!==(a=i.startLife)&&void 0!==a?a:new b(5),this.startSpeed=null!==(l=i.startSpeed)&&void 0!==l?l:new b(0),this.startRotation=null!==(u=i.startRotation)&&void 0!==u?u:new b(0),this.startSize=null!==(c=i.startSize)&&void 0!==c?c:new b(1),this.startColor=null!==(d=i.startColor)&&void 0!==d?d:new L(new r.Vector4(1,1,1,1)),this.emissionOverTime=null!==(p=i.emissionOverTime)&&void 0!==p?p:new b(10),this.emissionOverDistance=null!==(f=i.emissionOverDistance)&&void 0!==f?f:new b(0),this.emissionBursts=null!==(m=i.emissionBursts)&&void 0!==m?m:[],this.emitterShape=null!==(g=i.shape)&&void 0!==g?g:new V,this.behaviors=null!==(v=i.behaviors)&&void 0!==v?v:new Array,this.worldSpace=null!==(y=i.worldSpace)&&void 0!==y&&y,this.speedFactor=null!==(w=i.speedFactor)&&void 0!==w?w:0,this.rendererSettings={blending:null!==(A=i.blending)&&void 0!==A?A:r.NormalBlending,instancingGeometry:null!==(T=i.instancingGeometry)&&void 0!==T?T:q,renderMode:null!==(S=i.renderMode)&&void 0!==S?S:z.BillBoard,renderOrder:null!==(E=i.renderOrder)&&void 0!==E?E:0,texture:i.texture,uTileCount:null!==(M=i.uTileCount)&&void 0!==M?M:1,vTileCount:null!==(_=i.vTileCount)&&void 0!==_?_:1},this.neededToUpdateRender=!0,this.particles=new Array,this.startTileIndex=i.startTileIndex||0,this.emitter=new x(this),this.particleNum=0,this.burstIndex=0,this.burstWaveIndex=0,this.time=0,this.paused=!1,this.waitEmiting=0,this.emitEnded=!1,this.markForDestroy=!1}return a(t,[{key:"texture",get:function(){return this.rendererSettings.texture},set:function(t){this.rendererSettings.texture=t,this.neededToUpdateRender=!0}},{key:"uTileCount",get:function(){return this.rendererSettings.uTileCount},set:function(t){this.rendererSettings.uTileCount=t,this.neededToUpdateRender=!0}},{key:"vTileCount",get:function(){return this.rendererSettings.vTileCount},set:function(t){this.rendererSettings.vTileCount=t,this.neededToUpdateRender=!0}},{key:"renderMode",get:function(){return this.rendererSettings.renderMode},set:function(t){this.rendererSettings.renderMode=t,this.neededToUpdateRender=!0}},{key:"renderOrder",get:function(){return this.rendererSettings.renderOrder},set:function(t){this.rendererSettings.renderOrder=t,this.neededToUpdateRender=!0}},{key:"blending",get:function(){return this.rendererSettings.blending},set:function(t){this.rendererSettings.blending=t,this.neededToUpdateRender=!0}},{key:"pause",value:function(){this.paused=!0}},{key:"play",value:function(){this.paused=!1}},{key:"spawn",value:function(t){for(var e=0;e.1&&(t=.1),!this.paused)if(this.emitEnded&&0===this.particleNum)this.markForDestroy&&this.emitter.parent&&this.dispose();else{this.time>this.duration&&(this.looping?this.time-=this.duration:this.emitEnded||this.endEmit()),this.neededToUpdateRender&&(this.renderer.updateSystem(this),this.neededToUpdateRender=!1),this.normalMatrix.getNormalMatrix(this.emitter.matrixWorld);for(var e=0;e=i.life&&(this.particles[e]=this.particles[this.particleNum-1],this.particles[this.particleNum-1]=i,this.particleNum--,e--)}if(!this.emitEnded){var n=Math.ceil(this.waitEmiting);this.spawn(n),this.waitEmiting-=n}for(;this.burstIndex0){var n=new r.LoadingManager(e),s=new r.ImageLoader(n);s.setCrossOrigin(this.crossOrigin);for(var o=0,a=t.length;o0&&void 0!==arguments[0]?arguments[0]:1,e=0;e0)for(var i=0;i=this.maxLifeTime&&this.reset())}}]),i}(r.Object3D),Lt=i(22);function Ot(t){return(Ot="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function Dt(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function Bt(t,e){for(var i=0;i=this.maxLifeTime&&this.reset()}}]),i}(r.Object3D);function Wt(t){return(Wt="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function Yt(t,e){for(var i=0;i2&&void 0!==arguments[2]?arguments[2]:{},r=n.color,s=void 0===r?"#ffffff":r,o=n.maxSpawnTime,a=void 0===o?2:o,h=n.speed,l=void 0===h?1:h,u=n.skal,c=void 0===u?1:u;n.gravY,this.visible=!0,s&&(this.mat.color.set(s),this.mat.color.convertSRGBToLinear()),this.mainSkal=c,this.mainSpeed=l,this.gravityY=1,this.bloodList.forEach((function(n){i.resetBloodParticle(n,t,e)})),this.bloodCounter=0,this.spawnTimer=0,this.stopSpawning=!1,this.maxSpawnTime=a}},{key:"update",value:function(t){var e=this;this.visible&&(this.stopSpawning||(this.spawnTimer+=t,this.maxSpawnTime>0&&this.spawnTimer>this.maxSpawnTime&&(this.stopSpawning=!0)),this.bloodList.forEach((function(i){if(i.visible){if(i.position.addScaledVector(i.velocity,t*i.moveSpeed),i.velocity.y-=t*e.gravityY,i.prevPos){var n=i.position.clone().sub(i.prevPos).normalize(),r=i.position.clone().add(n);i.lookAt(r)}else i.prevPos=i.position.clone();i.timer+=t,i.timer>i.delay&&(i.scale.multiplyScalar(.99),i.timer>=i.maxTime&&(e.stopSpawning?(i.visible=!1,e.bloodCounter++):e.resetBloodParticle(i),e.bloodCounter>=e.bloodList.length&&(e.visible=!1))),i.prevPos&&i.prevPos.copy(i.position)}})))}},{key:"reset",value:function(){this.visible=!1}}])&&Yt(e.prototype,i),n&&Yt(e,n),Object.defineProperty(e,"prototype",{writable:!1}),o}(r.Object3D);function Zt(t){return(Zt="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function $t(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function te(t,e){for(var i=0;i1&&void 0!==arguments[1]?arguments[1]:{};i.gravity,i.spherical,i.veloYMin,i.veloYMax;return $t(this,o),(e=s.call(this)).mesh=t.clone(),e.add(e.mesh),e.orgSkal=e.scale.clone(),e.lastSpawnDir=new r.Vector3,e}return e=o,(i=[{key:"reset",value:function(t){var e;this.position.set(0,0,0),this.velocity=new r.Vector3,this.lifeTime=0,this.scale.copy(this.orgSkal),t?(e=t,this.lastSpawnDir.copy(e)):e=this.lastSpawnDir;var i=(new r.Spherical).setFromVector3(e);Math.PI,i.theta+=r.MathUtils.randFloatSpread(1),i.phi=.4,this.velocity=(new r.Vector3).setFromSpherical(i),this.velocity.y+=r.MathUtils.randFloat(.6,1.3),this.moveSpeed=r.MathUtils.randFloat(3,7),this.maxLifeTime=r.MathUtils.randFloat(4,7),this.visible=!0}},{key:"update",value:function(t){if(this.visible){this.position.addScaledVector(this.velocity,t*this.moveSpeed),this.velocity.y<0?(this.velocity.y-=.2*t,this.velocity.z-=.5*t):this.velocity.y-=1.3*t;var e=this.lifeTime/this.maxLifeTime,i=Phaser.Math.Easing.Quadratic.Out(e);this.scale.copy(this.orgSkal),this.scale.multiplyScalar(1-i),this.rotation.y+=this.velocity.x*i*.5,this.rotation.z+=this.velocity.y*i*.5,this.rotation.x+=this.velocity.z*i*.5,this.lifeTime+=t,this.lifeTime>=this.maxLifeTime&&(this.visible=!1)}}}])&&te(e.prototype,i),n&&te(e,n),Object.defineProperty(e,"prototype",{writable:!1}),o}(r.Object3D);function oe(t){return(oe="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function ae(t,e){for(var i=0;i=t.maxLifeTime&&(t.visible=!1,t.killed=!0,t.active=!1)}},{key:"startSpawning",value:function(t,e){this.visible=!0;for(var i=0;i=this.poolList.length&&this.createModel();var n=this.poolList.pop();this.resetModel(n,t),this.activeList.push(n)}}},{key:"update",value:function(t){for(var e=this.activeList.length-1;e>=0;e--){var i=this.activeList[e];i.visible&&(this.updateModel(i,t),i.killed&&(this.poolList.push(i),this.activeList.splice(e,1)))}}}])&&ge(e.prototype,i),n&&ge(e,n),Object.defineProperty(e,"prototype",{writable:!1}),o}(r.Object3D);function Te(t,e){var i="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!i){if(Array.isArray(t)||(i=function(t,e){if(!t)return;if("string"==typeof t)return Se(t,e);var i=Object.prototype.toString.call(t).slice(8,-1);"Object"===i&&t.constructor&&(i=t.constructor.name);if("Map"===i||"Set"===i)return Array.from(t);if("Arguments"===i||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i))return Se(t,e)}(t))||e&&t&&"number"==typeof t.length){i&&(t=i);var n=0,r=function(){};return{s:r,n:function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(t){throw t},f:r}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var s,o=!0,a=!1;return{s:function(){i=i.call(t)},n:function(){var t=i.next();return o=t.done,t},e:function(t){a=!0,s=t},f:function(){try{o||null==i.return||i.return()}finally{if(a)throw s}}}}function Se(t,e){(null==e||e>t.length)&&(e=t.length);for(var i=0,n=new Array(e);i2&&(n=2),t>e&&(n*=.5),this.effectList[i].uniforms.aspectRat.value=n}}},{key:"update",value:function(t){for(var e=0;e2&&void 0!==arguments[2]?arguments[2]:0;return g(this,x),(i=m.call(this,t,e,n)).calculateSpeed(a.a.upgrades.speedUpgrade.level),i.mesh.traverse((function(t){t.material&&(t.material.color.set(a.a.data.playerColor),t.material.color.convertSRGBToLinear(),setTimeout((function(){}),10))})),i.isPlayer=!0,i.createMainBody(),i.initEvents(),i.dirLightOrgPos=a.a.main.directionalLight.position.clone(),a.a.main.directionalLight.target=T(i),i.initCamHelper(new r.Spherical(17,1.2,-.35),new r.Vector3(2,-2,0)),s.a.setfollowObject(T(i),!0),i}return e=x,(i=[{key:"calculateSpeed",value:function(t){var e=a.a.data.playerSpeed+.07*(t-1);e=r.MathUtils.clamp(e,a.a.data.playerSpeed,2),this.maxForce=this.orgMaxForce*e}},{key:"initEvents",value:function(){var t=this;a.a.eventEmitter.on("gameStarts",(function(e){t.canStart=!0,t.body.type=n.Body.DYNAMIC,t.body.updateMassProperties(),t.body.wakeUp(),t.armBody&&(t.armBody.type=n.Body.DYNAMIC,t.armBody.updateMassProperties(),t.armBody.wakeUp())})),a.a.eventEmitter.on("drawingEnds",(function(e){c.a.gameEnded||t.killed||t.lastJumpMode||t.prepareToJump||(t.pointerUp(e.pointList),t.canStart||(t.body.type=n.Body.STATIC,t.armBody.type=n.Body.STATIC),l.a.feedbacks.spawn())})),a.a.eventEmitter.once("levelfinished",(function(e){l.a.drawArea.show(!1,!0),l.a.progress.show(!1,!0),e!==t?t.diedActions():t.reachedEndFlag()})),this.raiseUpTime=0}},{key:"doUpgradeAnim",value:function(){var t=this;return new Promise((function(e){t.lastJumpMode?e():(setTimeout((function(){f.a.spawnSpeedUpgradeEffect()}),300),a.a.phaserScene.tweens.add({targets:t.spherical,radius:"-=4",duration:800,hold:500,yoyo:!0,ease:"Sine.easeInOut",onComplete:function(){e()}}))}))}},{key:"reachedEndFlag",value:function(){app.playSfx("Crowd_Fly"),a.a.phaserScene.tweens.add({targets:this.spherical,radius:13.5,theta:-1.2,duration:1e3,ease:Phaser.Math.Easing.Sine.InOut,onComplete:function(){}}),f.a.spawnEndingStars(),this.prepareToJump=!0}},{key:"onCoinCollected",value:function(t){d.a.spawn(t),a.a.playerData.coin++,a.a.eventEmitter.emit("coinCollected")}},{key:"doLastJump",value:function(){var t=this;this.lastJumpMode||(setTimeout((function(){var e=t.armFront;t.armBack.catmullPath.getLength()>t.armFront.catmullPath.getLength()&&(e=t.armBack);var i=e.catmullPath.getLength()/10;i=r.MathUtils.clamp(i,.2,1);var n=r.MathUtils.lerp(.3,2.25,i);t.body.position.y+=1,t.body.velocity.y+=900,t.body.velocity.x+=600*n,t.body.wakeUp()}),10),a.a.phaserScene.tweens.add({targets:a.a.main.camera,fov:"+=10",duration:500,ease:Phaser.Math.Easing.Sine.Out,onUpdate:function(){a.a.main.camera.updateProjectionMatrix()}}),a.a.phaserScene.tweens.add({targets:this.spherical,theta:-1.5,phi:.8,duration:1e3,ease:Phaser.Math.Easing.Sine.Out}),a.a.phaserScene.tweens.add({targets:this.spherical,radius:"+=5",duration:1e3,yoyo:!0,ease:Phaser.Math.Easing.Sine.InOut,onComplete:function(){a.a.phaserScene.tweens.add({targets:a.a.main.camera,fov:"-=10",duration:500,ease:Phaser.Math.Easing.Sine.Out,onUpdate:function(){a.a.main.camera.updateProjectionMatrix()}})}}),s.a.camera.setMoveRotSpeed(.1,.1),this.lastJumpMode=!0,this.lastJumpTimer=0,this.jumpPos=this.body.position.clone(),this.destoryArmsAnim())}},{key:"update",value:function(t){if(this.currentLevelPlatform.enableNearestColliders(t),this.camHelper&&(this.camHelper.position.setFromSpherical(this.spherical),this.camHelper.position.add(this.camLookHelper.position)),this.lastJumpMode){if(this.lastJumpTimer+=t,this.lastJumpTimer>.15&&this.body.velocity.x>3){var e=this.body.position.clone();e.x-=.5,u.a.spawn(e),this.lastJumpTimer=0}this.body.position.x>this.jumpPos.x+5&&Math.abs(this.body.velocity.x)-3<.1&&(this.lastJumpMode=!1,c.a.levelWinCallback())}y(S(x.prototype),"update",this).call(this,t),this.updateProgress(),this.canStart||this.armBody||(this.raiseUpTime+=6*t,this.body.position.y=this.initPosition.y+.2*Math.sin(this.raiseUpTime))}},{key:"updateProgress",value:function(){y(S(x.prototype),"updateProgress",this).call(this,!0)}},{key:"getCamHelperPos",value:function(){return this.camHelper.getWPos()}},{key:"getCamLookAtPos",value:function(){return this.camLookHelper.getWPos()}},{key:"initCamHelper",value:function(t){var e=this,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new r.Vector3;this.camHelper||(this.camHelper=h.a.createBox(),this.camHelper.scale.multiplyScalar(.2),this.camHelper.wPos=new r.Vector3,this.camLookHelper=this.camHelper.clone(),this.camLookHelper.position.copy(i),this.camLookHelper.wPos=new r.Vector3),this.camHelper.material.visible=!1,this.camLookHelper.material.visible=!1,this.add(this.camHelper),this.add(this.camLookHelper),this.spherical=(new r.Spherical).copy(t),this.camHelper.position.setFromSpherical(this.spherical),this.camHelper.position.add(this.camLookHelper.position),this.camHelper.getWPos=function(){return e.camHelper.getWorldPosition(e.camHelper.wPos)},this.camLookHelper.getWPos=function(){return e.camLookHelper.getWorldPosition(e.camLookHelper.wPos)}}},{key:"showDatguiCam",value:function(){a.a.guiHelper.addPosition(this.camLookHelper),a.a.guiHelper.addPosition(this.camHelper),a.a.guiHelper.gui.add(this.spherical,"radius").step(.01),a.a.guiHelper.gui.add(this.spherical,"phi").step(.01),a.a.guiHelper.gui.add(this.spherical,"theta").step(.01)}},{key:"getWPos",value:function(){return this.meshParent.getWorldPosition(this._wPos)}},{key:"getWQut",value:function(){return this.mesh.getWorldQuaternion(this._wQut)}},{key:"diedActions",value:function(){var t=this;this.killed||(this.killed=!0,a.a.camera.cameraMoveType=o.a.MoveType.FREE,setTimeout((function(){h.a.moveToScene(t.camLookHelper),c.a.levelFailedCallback()}),1e3))}},{key:"pointerDown",value:function(){}},{key:"pointerUp",value:function(t){var e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];y(S(x.prototype),"pointerUp",this).call(this,t,e)}}])&&v(e.prototype,i),p&&v(e,p),Object.defineProperty(e,"prototype",{writable:!1}),x}(p.a)},function(t,e,i){"use strict";i.d(e,"a",(function(){return f}));var n=i(1);function r(t){return(r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function s(t){return function(t){if(Array.isArray(t))return o(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||function(t,e){if(!t)return;if("string"==typeof t)return o(t,e);var i=Object.prototype.toString.call(t).slice(8,-1);"Object"===i&&t.constructor&&(i=t.constructor.name);if("Map"===i||"Set"===i)return Array.from(t);if("Arguments"===i||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i))return o(t,e)}(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function o(t,e){(null==e||e>t.length)&&(e=t.length);for(var i=0,n=new Array(e);i0&&void 0!==arguments[0]?arguments[0]:n.a.phaserScene,i=arguments.length>1?arguments[1]:void 0,r=arguments.length>2?arguments[2]:void 0,s=arguments.length>3?arguments[3]:void 0;return a(this,c),(t=o.call(this,e,i,r,s)).scene=e,t.scene.add.existing(d(t)),t.excludes=[],t}return e=c,(i=[{key:"addExcludes",value:function(t){var e;this.add(t),Array.isArray(t)?(e=this.excludes).push.apply(e,s(t)):this.excludes.push(t)}},{key:"setBoundaries",value:function(){this.width=this.getWidth(),this.height=this.getHeight()}},{key:"setInitials",value:function(){if(this.setScale(1),0===this.list.length)throw new Error("The container has no child, please add at least one child!");this.iW=this.getWidth(),this.iH=this.getHeight(),this.iW,this.setSize(this.iW,this.iH)}},{key:"drawDebug",value:function(){this.graphics||(this.graphics=this.scene.add.graphics()),this.addExcludes(this.graphics),this.graphics.clear(),this.graphics.lineStyle(5,16711935,1),this.graphics.strokeRect(-this.width/2+this.centerX(),-this.height/2+this.centerY(),this.width,this.height),this.graphics.lineStyle(5,16711935,1),this.graphics.strokeRect(-this.width/2-this.centerX(),this.centerY(),this.width,1),this.graphics.lineStyle(5,16711935,1),this.graphics.strokeRect(this.centerX(),-this.height/2+this.centerY(),1,this.height),this.graphics.depth=1e3}},{key:"drawDebug1",value:function(){this.debug?(this.debug.x=this.mostLeftChild.getTopLeft().x,this.debug.y=this.mostUpChild.getTopLeft().y,this.debug.width=this.width,this.debug.height=this.height):(this.debug=this.scene.add.rectangle(this.mostLeftChild.getTopLeft().x,this.mostUpChild.getTopLeft().y,this.width,this.height,0,.2).setOrigin(0),this.addExcludes(this.debug))}},{key:"findMaxAndMinX",value:function(){for(var t=this,e=1/0,i=0,n=function(n){var r=void 0,s=t.list[n];if(t.excludes.forEach((function(t){s==t&&(r=!0)})),r)return"continue";e>s.x-s.width*s.scaleX*s.originX&&(e=s.x-s.width*s.scaleX*s.originX),is.y-s.height*s.scaleY*s.originY&&(e=s.y-s.height*s.scaleY*s.originY),i0&&void 0!==arguments[0]?arguments[0]:0,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1,n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0,r=arguments.length>4&&void 0!==arguments[4]?arguments[4]:1,s=(t-e)/(i-e);return n+s*(r-n)}},function(t,e,i){"use strict";i.d(e,"a",(function(){return s}));var n=i(1);function r(t,e){for(var i=0;i1&&void 0!==arguments[1]?arguments[1]:{},i=e.dur,r=void 0===i?500:i,s=e.ease,o=void 0===s?"Sine.easeInOut":s,a=e.skalRatio,h=void 0===a?.9:a,l=e.delay,u=void 0===l?0:l,c=e.scene,d=void 0===c?n.a.phaserScene:c;d.tweens.add({targets:t,props:{scale:{dynamic:!0,value:{getStart:function(e){return t.iS},getEnd:function(e){return t.iS*h}}}},duration:r,yoyo:!0,repeat:-1,ease:o,delay:u})}},{key:"createText",value:function(t,e){var i=e.wRatio,r=void 0===i?.3:i,s=e.hRatio,o=void 0===s?.1:s,a=e.color,h=void 0===a?"#ffffff":a,l=e.xPos,u=void 0===l?.5:l,c=e.yPos,d=void 0===c?.1:c,p=e.scene,f=void 0===p?n.a.phaserScene:p,m=e.customResize,g=void 0!==m&&m,v=e.fontSize,y=void 0===v?60:v,x=f.add.text(0,0,t,{fontSize:y,fontFamily:"ui-font",color:h,align:"center"});return x.setOrigin(.5),g||(x.onResizeCallback=function(t,e){x.scale=Math.min(t*r/x.width,e*o/x.height),x.x=t*u,x.y=e*d,x.iS=x.scale},x.onResizeCallback(f.lastWidth,f.lastHeight)),x}}],(i=null)&&r(e.prototype,i),s&&r(e,s),Object.defineProperty(e,"prototype",{writable:!1}),t}()},function(t,e,i){"use strict";i.d(e,"a",(function(){return _}));i(20);var n=i(2),r=i(0),s=(i(25),i(28),i(5)),o=i(1),a=(i(6),i(14)),h=(i(31),i(21),i(8),i(22)),l=(i(4),i(3)),u=i(32),c=i(38);function d(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function p(t,e){for(var i=0;i6&&void 0!==arguments[6]&&arguments[6];d(this,t),e.tilesHorizontal=n,e.tilesVertical=r,e.material.map=i,this.texture=i,e.numberOfTiles=s,i.wrapS=i.wrapT=THREE.RepeatWrapping,a||i.repeat.set(1/e.tilesHorizontal,1/e.tilesVertical),e.tileDisplayDuration=o,e.currentDisplayTime=0,e.currentTile=0,i.center.x=0,i.center.y=1,e.live=!1,this.mesh=e,this.orgSpeed=o}var e,i,n;return e=t,(i=[{key:"play",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},i=(e.force,e.sped),n=void 0===i?1:i;this.stopped=!1,this.reset(),this.setSpeed(n),t&&this.setFinishedCallback(t)}},{key:"playLoopedWithDelay",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:.2,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:.5,i=arguments.length>2?arguments[2]:void 0;this.stopped=!1,this.delayTimer=0,this.minDelay=t,this.maxDelay=e,this.delayWaitTime=r.MathUtils.randFloat(t,e),this.delayEnabled=!0,this.delayedCallback=i,this.play()}},{key:"stop",value:function(){this.stopped=!0,this.delayEnabled=!1,this.delayedCallback=null,this.callback=null,this.reset()}},{key:"setDelayTimes",value:function(t,e){var i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1;t&&(this.minDelay=t),e&&(this.maxDelay=e),this.mesh.tileDisplayDuration=this.orgSpeed*i}},{key:"setSpeed",value:function(t){this.mesh.tileDisplayDuration=this.orgSpeed*t}},{key:"setFinishedCallback",value:function(t){t&&(this.callback=t)}},{key:"update",value:function(t){var e=this.mesh;if(!this.stopped&&(this.delayEnabled&&(this.delayTimer+=t,!e.live&&this.delayTimer>=this.delayWaitTime&&(this.delayTimer=0,this.delayWaitTime=r.MathUtils.randFloat(this.minDelay,this.maxDelay),this.delayedCallback&&this.delayedCallback(),this.play())),e.live&&(e.currentDisplayTime+=t,e.currentDisplayTime>e.tileDisplayDuration))){if(e.currentDisplayTime=0,e.currentTile++,e.currentTile==e.numberOfTiles)return e.live=!1,void(this.callback&&this.callback());var i=e.currentTile%e.tilesHorizontal;this.texture.offset.x=i/e.tilesHorizontal;var n=Math.floor(e.currentTile/e.tilesHorizontal);this.texture.offset.y=-n/e.tilesVertical}}},{key:"setTile",value:function(t){var e=this.mesh;this.mesh.currentTile=t;var i=e.currentTile%e.tilesHorizontal;this.texture.offset.x=i/e.tilesHorizontal;var n=Math.floor(e.currentTile/e.tilesHorizontal);this.texture.offset.y=-n/e.tilesVertical}},{key:"reset",value:function(){this.mesh.live=!0,this.mesh.currentTile=0}}])&&p(e.prototype,i),n&&p(e,n),Object.defineProperty(e,"prototype",{writable:!1}),t}(),m=i(24);function g(t,e){for(var i=0;i2&&void 0!==arguments[2]?arguments[2]:0;x(this,d),(i=c.call(this,t,e,n)).mesh.traverse((function(t){t.material&&(t.material=t.material.clone(),t.material.color.set(o.a.data.enemyColor))})),i.initPosition=(new r.Vector3).copy(t),i.armCreated=!1;var a=o.a.data.enemySpeed+s.a.levelIndex*o.a.data.enemyDiffRaise;a=r.MathUtils.clamp(a,1,1.6),i.maxForce*=a,i.touchedGround=!1,i.drawingCount=0,i.visible=!1,i.initEvents();var h=l.a.enemySettings[s.a.currentLevelIndex];return i.nameFlag=v.getNameFlagTag(h),i.nameFlag.position.y=2,i.nameFlag.position.z=-2,i.add(i.nameFlag),i}return e=d,(i=[{key:"initEvents",value:function(){var t=this;o.a.eventEmitter.on("gameStarts",(function(e){if(!t.body&&!t.visible){var i=a.a.getArmData();t.visible=!0,t.pointerUp(i),t.vehicle.chassisBody.type=n.Body.STATIC,t.vehicle.wheelBodies[0].type=n.Body.STATIC}t.canStart=!0,t.body.type=n.Body.DYNAMIC,t.body.updateMassProperties(),t.body.wakeUp(),t.armBody&&(t.armBody.type=n.Body.DYNAMIC,t.armBody.updateMassProperties(),t.armBody.wakeUp())})),o.a.eventEmitter.once("levelfinished",(function(e){e!==t&&t.diedActions()})),this.visible=!1,o.a.eventEmitter.once("opponentfound",(function(e){setTimeout((function(){var e=a.a.getArmData();t.visible=!0,t.pointerUp(e),t.vehicle.chassisBody.type=n.Body.STATIC,t.vehicle.wheelBodies[0].type=n.Body.STATIC}),100)}))}},{key:"doLastJump",value:function(){var t=this;this.lastJumpMode||(this.armBody.collisionResponse=!1,setTimeout((function(){t.body.position.y+=1,t.body.velocity.y+=900,t.body.velocity.x+=600,t.body.wakeUp()}),10),this.lastJumpMode=!0,this.lastJumpTimer=0,this.jumpPos=this.body.position.clone(),this.destoryArmsAnim())}},{key:"update",value:function(t){if(this.body){if(this.currentLevelPlatform.enableNearestColliders(t),this.lastJumpMode){if(this.lastJumpTimer+=t,this.lastJumpTimer>.2&&this.body.velocity.x>3){var e=this.body.position.clone();e.x-=.5,h.a.spawn(e),this.lastJumpTimer=0}this.body.position.x>this.jumpPos.x+5&&Math.abs(this.body.velocity.x)-3<.1&&(this.lastJumpMode=!1)}b(M(d.prototype),"update",this).call(this,t),this.updateProgress()}}},{key:"updateProgress",value:function(){b(M(d.prototype),"updateProgress",this).call(this,!1)}},{key:"diedActions",value:function(){this.killed||(this.killed=!0)}},{key:"pointerDown",value:function(){}},{key:"pointerUp",value:function(t){var e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];b(M(d.prototype),"pointerUp",this).call(this,t,e)}}])&&w(e.prototype,i),u&&w(e,u),Object.defineProperty(e,"prototype",{writable:!1}),d}(u.a)},function(t,e,i){"use strict";var n={update:null,begin:null,loopBegin:null,changeBegin:null,change:null,changeComplete:null,loopComplete:null,complete:null,loop:1,direction:"normal",autoplay:!0,timelineOffset:0},r={duration:1e3,delay:0,endDelay:0,easing:"easeOutElastic(1, .5)",round:0},s=["translateX","translateY","translateZ","rotate","rotateX","rotateY","rotateZ","scale","scaleX","scaleY","scaleZ","skew","skewX","skewY","perspective","matrix","matrix3d"],o={CSS:{},springs:{}};function a(t,e,i){return Math.min(Math.max(t,e),i)}function h(t,e){return t.indexOf(e)>-1}function l(t,e){return t.apply(null,e)}var u={arr:function(t){return Array.isArray(t)},obj:function(t){return h(Object.prototype.toString.call(t),"Object")},pth:function(t){return u.obj(t)&&t.hasOwnProperty("totalLength")},svg:function(t){return t instanceof SVGElement},inp:function(t){return t instanceof HTMLInputElement},dom:function(t){return t.nodeType||u.svg(t)},str:function(t){return"string"==typeof t},fnc:function(t){return"function"==typeof t},und:function(t){return void 0===t},nil:function(t){return u.und(t)||null===t},hex:function(t){return/(^#[0-9A-F]{6}$)|(^#[0-9A-F]{3}$)/i.test(t)},rgb:function(t){return/^rgb/.test(t)},hsl:function(t){return/^hsl/.test(t)},col:function(t){return u.hex(t)||u.rgb(t)||u.hsl(t)},key:function(t){return!n.hasOwnProperty(t)&&!r.hasOwnProperty(t)&&"targets"!==t&&"keyframes"!==t}};function c(t){var e=/\(([^)]+)\)/.exec(t);return e?e[1].split(",").map((function(t){return parseFloat(t)})):[]}function d(t,e){var i=c(t),n=a(u.und(i[0])?1:i[0],.1,100),r=a(u.und(i[1])?100:i[1],.1,100),s=a(u.und(i[2])?10:i[2],.1,100),h=a(u.und(i[3])?0:i[3],.1,100),l=Math.sqrt(r/n),d=s/(2*Math.sqrt(r*n)),p=d<1?l*Math.sqrt(1-d*d):0,f=d<1?(d*l-h)/p:-h+l;function m(t){var i=e?e*t/1e3:t;return i=d<1?Math.exp(-i*d*l)*(1*Math.cos(p*i)+f*Math.sin(p*i)):(1+f*i)*Math.exp(-i*l),0===t||1===t?t:1-i}return e?m:function(){var e=o.springs[t];if(e)return e;for(var i=0,n=0;;)if(1===m(i+=1/6)){if(++n>=16)break}else n=0;var r=i*(1/6)*1e3;return o.springs[t]=r,r}}function p(t){return void 0===t&&(t=10),function(e){return Math.ceil(a(e,1e-6,1)*t)*(1/t)}}var f,m,g=function(){function t(t,e){return 1-3*e+3*t}function e(t,e){return 3*e-6*t}function i(t){return 3*t}function n(n,r,s){return((t(r,s)*n+e(r,s))*n+i(r))*n}function r(n,r,s){return 3*t(r,s)*n*n+2*e(r,s)*n+i(r)}return function(t,e,i,s){if(0<=t&&t<=1&&0<=i&&i<=1){var o=new Float32Array(11);if(t!==e||i!==s)for(var a=0;a<11;++a)o[a]=n(.1*a,t,i);return function(r){return t===e&&i===s||0===r||1===r?r:n(h(r),e,s)}}function h(e){for(var s=0,a=1;10!==a&&o[a]<=e;++a)s+=.1;--a;var h=s+.1*((e-o[a])/(o[a+1]-o[a])),l=r(h,t,i);return l>=.001?function(t,e,i,s){for(var o=0;o<4;++o){var a=r(e,i,s);if(0===a)return e;e-=(n(e,i,s)-t)/a}return e}(e,h,t,i):0===l?h:function(t,e,i,r,s){var o,a,h=0;do{(o=n(a=e+(i-e)/2,r,s)-t)>0?i=a:e=a}while(Math.abs(o)>1e-7&&++h<10);return a}(e,s,s+.1,t,i)}}}(),v=(f={linear:function(){return function(t){return t}}},m={Sine:function(){return function(t){return 1-Math.cos(t*Math.PI/2)}},Circ:function(){return function(t){return 1-Math.sqrt(1-t*t)}},Back:function(){return function(t){return t*t*(3*t-2)}},Bounce:function(){return function(t){for(var e,i=4;t<((e=Math.pow(2,--i))-1)/11;);return 1/Math.pow(4,3-i)-7.5625*Math.pow((3*e-2)/22-t,2)}},Elastic:function(t,e){void 0===t&&(t=1),void 0===e&&(e=.5);var i=a(t,1,10),n=a(e,.1,2);return function(t){return 0===t||1===t?t:-i*Math.pow(2,10*(t-1))*Math.sin((t-1-n/(2*Math.PI)*Math.asin(1/i))*(2*Math.PI)/n)}}},["Quad","Cubic","Quart","Quint","Expo"].forEach((function(t,e){m[t]=function(){return function(t){return Math.pow(t,e+2)}}})),Object.keys(m).forEach((function(t){var e=m[t];f["easeIn"+t]=e,f["easeOut"+t]=function(t,i){return function(n){return 1-e(t,i)(1-n)}},f["easeInOut"+t]=function(t,i){return function(n){return n<.5?e(t,i)(2*n)/2:1-e(t,i)(-2*n+2)/2}},f["easeOutIn"+t]=function(t,i){return function(n){return n<.5?(1-e(t,i)(1-2*n))/2:(e(t,i)(2*n-1)+1)/2}}})),f);function y(t,e){if(u.fnc(t))return t;var i=t.split("(")[0],n=v[i],r=c(t);switch(i){case"spring":return d(t,e);case"cubicBezier":return l(g,r);case"steps":return l(p,r);default:return l(n,r)}}function x(t){try{return document.querySelectorAll(t)}catch(t){return}}function w(t,e){for(var i=t.length,n=arguments.length>=2?arguments[1]:void 0,r=[],s=0;s1&&(i-=1),i<1/6?t+6*(e-t)*i:i<.5?e:i<2/3?t+(e-t)*(2/3-i)*6:t}if(0==o)e=i=n=a;else{var u=a<.5?a*(1+o):a+o-a*o,c=2*a-u;e=l(c,u,s+1/3),i=l(c,u,s),n=l(c,u,s-1/3)}return"rgba("+255*e+","+255*i+","+255*n+","+h+")"}(t):void 0;var e,i}function C(t){var e=/[+-]?\d*\.?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?(%|px|pt|em|rem|in|cm|mm|ex|ch|pc|vw|vh|vmin|vmax|deg|rad|turn)?$/.exec(t);if(e)return e[1]}function P(t,e){return u.fnc(t)?t(e.target,e.id,e.total):t}function R(t,e){return t.getAttribute(e)}function L(t,e,i){if(T([i,"deg","rad","turn"],C(e)))return e;var n=o.CSS[e+i];if(!u.und(n))return n;var r=document.createElement(t.tagName),s=t.parentNode&&t.parentNode!==document?t.parentNode:document.body;s.appendChild(r),r.style.position="absolute",r.style.width=100+i;var a=100/r.offsetWidth;s.removeChild(r);var h=a*parseFloat(e);return o.CSS[e+i]=h,h}function O(t,e,i){if(e in t.style){var n=e.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase(),r=t.style[e]||getComputedStyle(t).getPropertyValue(n)||"0";return i?L(t,r,i):r}}function D(t,e){return u.dom(t)&&!u.inp(t)&&(!u.nil(R(t,e))||u.svg(t)&&t[e])?"attribute":u.dom(t)&&T(s,e)?"transform":u.dom(t)&&"transform"!==e&&O(t,e)?"css":null!=t[e]?"object":void 0}function B(t){if(u.dom(t)){for(var e,i=t.style.transform||"",n=/(\w+)\(([^)]*)\)/g,r=new Map;e=n.exec(i);)r.set(e[1],e[2]);return r}}function I(t,e,i,n){var r=h(e,"scale")?1:0+function(t){return h(t,"translate")||"perspective"===t?"px":h(t,"rotate")||h(t,"skew")?"deg":void 0}(e),s=B(t).get(e)||r;return i&&(i.transforms.list.set(e,s),i.transforms.last=e),n?L(t,s,n):s}function F(t,e,i,n){switch(D(t,e)){case"transform":return I(t,e,n,i);case"css":return O(t,e,i);case"attribute":return R(t,e);default:return t[e]||0}}function k(t,e){var i=/^(\*=|\+=|-=)/.exec(t);if(!i)return t;var n=C(t)||0,r=parseFloat(e),s=parseFloat(t.replace(i[0],""));switch(i[0][0]){case"+":return r+s+n;case"-":return r-s+n;case"*":return r*s+n}}function N(t,e){if(u.col(t))return _(t);if(/\s/g.test(t))return t;var i=C(t),n=i?t.substr(0,t.length-i.length):t;return e?n+e:n}function z(t,e){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function U(t){for(var e,i=t.points,n=0,r=0;r0&&(n+=z(e,s)),e=s}return n}function V(t){if(t.getTotalLength)return t.getTotalLength();switch(t.tagName.toLowerCase()){case"circle":return function(t){return 2*Math.PI*R(t,"r")}(t);case"rect":return function(t){return 2*R(t,"width")+2*R(t,"height")}(t);case"line":return function(t){return z({x:R(t,"x1"),y:R(t,"y1")},{x:R(t,"x2"),y:R(t,"y2")})}(t);case"polyline":return U(t);case"polygon":return function(t){var e=t.points;return U(t)+z(e.getItem(e.numberOfItems-1),e.getItem(0))}(t)}}function H(t,e){var i=e||{},n=i.el||function(t){for(var e=t.parentNode;u.svg(e)&&u.svg(e.parentNode);)e=e.parentNode;return e}(t),r=n.getBoundingClientRect(),s=R(n,"viewBox"),o=r.width,a=r.height,h=i.viewBox||(s?s.split(" "):[0,0,o,a]);return{el:n,viewBox:h,x:h[0]/1,y:h[1]/1,w:o,h:a,vW:h[2],vH:h[3]}}function G(t,e,i){function n(i){void 0===i&&(i=0);var n=e+i>=1?e+i:0;return t.el.getPointAtLength(n)}var r=H(t.el,t.svg),s=n(),o=n(-1),a=n(1),h=i?1:r.w/r.vW,l=i?1:r.h/r.vH;switch(t.property){case"x":return(s.x-r.x)*h;case"y":return(s.y-r.y)*l;case"angle":return 180*Math.atan2(a.y-o.y,a.x-o.x)/Math.PI}}function W(t,e){var i=/[+-]?\d*\.?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?/g,n=N(u.pth(t)?t.totalLength:t,e)+"";return{original:n,numbers:n.match(i)?n.match(i).map(Number):[0],strings:u.str(t)||e?n.split(i):[]}}function Y(t){return w(t?b(u.arr(t)?t.map(A):A(t)):[],(function(t,e,i){return i.indexOf(t)===e}))}function X(t){var e=Y(t);return e.map((function(t,i){return{target:t,id:i,total:e.length,transforms:{list:B(t)}}}))}function j(t,e){var i=S(e);if(/^spring/.test(i.easing)&&(i.duration=d(i.easing)),u.arr(t)){var n=t.length;2===n&&!u.obj(t[0])?t={value:t}:u.fnc(e.duration)||(i.duration=e.duration/n)}var r=u.arr(t)?t:[t];return r.map((function(t,i){var n=u.obj(t)&&!u.pth(t)?t:{value:t};return u.und(n.delay)&&(n.delay=i?0:e.delay),u.und(n.endDelay)&&(n.endDelay=i===r.length-1?e.endDelay:0),n})).map((function(t){return M(t,i)}))}function q(t,e){var i=[],n=e.keyframes;for(var r in n&&(e=M(function(t){for(var e=w(b(t.map((function(t){return Object.keys(t)}))),(function(t){return u.key(t)})).reduce((function(t,e){return t.indexOf(e)<0&&t.push(e),t}),[]),i={},n=function(n){var r=e[n];i[r]=t.map((function(t){var e={};for(var i in t)u.key(i)?i==r&&(e.value=t[i]):e[i]=t[i];return e}))},r=0;r0?requestAnimationFrame(e):void 0}return"undefined"!=typeof document&&document.addEventListener("visibilitychange",(function(){rt.suspendWhenDocumentHidden&&(nt()?t=cancelAnimationFrame(t):(et.forEach((function(t){return t._onDocumentVisibility()})),it()))})),function(){t||nt()&&rt.suspendWhenDocumentHidden||!(et.length>0)||(t=requestAnimationFrame(e))}}();function nt(){return!!document&&document.hidden}function rt(t){void 0===t&&(t={});var e,i=0,s=0,o=0,h=0,l=null;function u(t){var e=window.Promise&&new Promise((function(t){return l=t}));return t.finished=e,e}var c=function(t){var e=E(n,t),i=E(r,t),s=q(i,t),o=X(t.targets),a=Z(o,s),h=$(a,i),l=tt;return tt++,M(e,{id:l,children:[],animatables:o,animations:a,duration:h.duration,delay:h.delay,endDelay:h.endDelay})}(t);u(c);function d(){var t=c.direction;"alternate"!==t&&(c.direction="normal"!==t?"normal":"reverse"),c.reversed=!c.reversed,e.forEach((function(t){return t.reversed=c.reversed}))}function p(t){return c.reversed?c.duration-t:t}function f(){i=0,s=p(c.currentTime)*(1/rt.speed)}function m(t,e){e&&e.seek(t-e.timelineOffset)}function g(t){for(var e=0,i=c.animations,n=i.length;e2||(x=Math.round(x*f)/f)),m.push(x)}var T=p.length;if(T){v=p[0];for(var S=0;S0&&(c.began=!0,v("begin")),!c.loopBegan&&c.currentTime>0&&(c.loopBegan=!0,v("loopBegin")),y<=r&&0!==c.currentTime&&g(0),(y>=f&&c.currentTime!==n||!n)&&g(n),y>r&&y=n&&(s=0,c.remaining&&!0!==c.remaining&&c.remaining--,c.remaining?(i=o,v("loopComplete"),c.loopBegan=!1,"alternate"===c.direction&&d()):(c.paused=!0,c.completed||(c.completed=!0,v("loopComplete"),v("complete"),!c.passThrough&&"Promise"in window&&(l(),u(c)))))}return c.reset=function(){var t=c.direction;c.passThrough=!1,c.currentTime=0,c.progress=0,c.paused=!0,c.began=!1,c.loopBegan=!1,c.changeBegan=!1,c.completed=!1,c.changeCompleted=!1,c.reversePlayback=!1,c.reversed="reverse"===t,c.remaining=c.loop,e=c.children;for(var i=h=e.length;i--;)c.children[i].reset();(c.reversed&&!0!==c.loop||"alternate"===t&&1===c.loop)&&c.remaining++,g(c.reversed?c.duration:0)},c._onDocumentVisibility=f,c.set=function(t,e){return J(t,e),c},c.tick=function(t){o=t,i||(i=o),y((o+(s-i))*rt.speed)},c.seek=function(t){y(p(t))},c.pause=function(){c.paused=!0,f()},c.play=function(){c.paused&&(c.completed&&c.reset(),c.paused=!1,et.push(c),f(),it())},c.reverse=function(){d(),c.completed=!c.reversed,f()},c.restart=function(){c.reset(),c.play()},c.remove=function(t){ot(Y(t),c)},c.reset(),c.autoplay&&c.play(),c}function st(t,e){for(var i=e.length;i--;)T(t,e[i].animatable.target)&&e.splice(i,1)}function ot(t,e){var i=e.animations,n=e.children;st(t,i);for(var r=n.length;r--;){var s=n[r],o=s.animations;st(t,o),o.length||s.children.length||n.splice(r,1)}i.length||n.length||e.pause()}rt.version="3.2.1",rt.speed=1,rt.suspendWhenDocumentHidden=!0,rt.running=et,rt.remove=function(t){for(var e=Y(t),i=et.length;i--;){ot(e,et[i])}},rt.get=F,rt.set=J,rt.convertPx=L,rt.path=function(t,e){var i=u.str(t)?x(t)[0]:t,n=e||100;return function(t){return{property:t,el:i,svg:H(i),totalLength:V(i)*(n/100)}}},rt.setDashoffset=function(t){var e=V(t);return t.setAttribute("stroke-dasharray",e),e},rt.stagger=function(t,e){void 0===e&&(e={});var i=e.direction||"normal",n=e.easing?y(e.easing):null,r=e.grid,s=e.axis,o=e.from||0,a="first"===o,h="center"===o,l="last"===o,c=u.arr(t),d=c?parseFloat(t[0]):parseFloat(t),p=c?parseFloat(t[1]):0,f=C(c?t[1]:t)||0,m=e.start||0+(c?d:0),g=[],v=0;return function(t,e,u){if(a&&(o=0),h&&(o=(u-1)/2),l&&(o=u-1),!g.length){for(var y=0;y-1&&et.splice(s,1);for(var h=0;h1&&void 0!==arguments[1]?arguments[1]:new n.Vector3(0,1,0),r=arguments.length>2?arguments[2]:void 0;s(this,t),this.mouse=new n.Vector2,this.raycaster=new n.Raycaster,this.camera=e,this.plane=new n.Plane(i,0),this.planeVec3=new n.Vector3,r&&this.plane.translate(r)}var e,i,a;return e=t,a=[{key:"screenXYPhaser",value:function(t,e){var i=t.clone();return e.updateMatrixWorld(),i.project(e),{x:(.5*i.x+.5)*r.a.phaserScene.lastWidth,y:(-.5*i.y+.5)*r.a.phaserScene.lastHeight}}},{key:"ScreenToWorld",value:function(t,e,i){var s=e/r.a.phaserScene.lastWidth*2-1,o=-i/r.a.phaserScene.lastHeight*2+1,a=new n.Vector3(s,o,-1);return a.unproject(t),a}}],(i=[{key:"getMousePos",value:function(t,e){this.mouse.x=t/r.a.phaserScene.lastWidth*2-1,this.mouse.y=-e/r.a.phaserScene.lastHeight*2+1}},{key:"getIntersects",value:function(t,e,i){var n=!(arguments.length>3&&void 0!==arguments[3])||arguments[3];this.getMousePos(t,e),this.raycaster.setFromCamera(this.mouse,this.camera);var r=this.raycaster.intersectObjects(i,n);return r}},{key:"raycastFromObject",value:function(t,e,i,n){return this.raycaster.set(t,e),this.raycaster.far=i,this.raycaster.intersectObjects(n,!0)}},{key:"showArrow",value:function(){this.arrow||(this.arrow=new n.ArrowHelper(this.raycaster.ray.direction,this.raycaster.ray.origin,1,"#ff0000"),app.main.scene.add(this.arrow)),this.arrow.position.copy(this.raycaster.ray.origin),this.arrow.setDirection(this.raycaster.ray.direction),this.arrow.setLength(this.raycaster.far)}},{key:"getIntersect",value:function(t,e,i){return this.getMousePos(t,e),this.raycaster.setFromCamera(this.mouse,this.camera),this.raycaster.intersectObject(i,!0)}},{key:"getPlaneIntersection",value:function(t,e){return this.camera.updateProjectionMatrix(),this.getMousePos(t,e),this.raycaster.setFromCamera(this.mouse,this.camera),this.raycaster.ray.intersectPlane(this.plane,this.planeVec3),this.planeVec3}},{key:"screenXY",value:function(t,e){var i=t.clone();return e.updateMatrixWorld(),i.project(e),{x:(.5*i.x+.5)*r.a.screenWidth,y:(-.5*i.y+.5)*r.a.screenHeight}}}])&&o(e.prototype,i),a&&o(e,a),Object.defineProperty(e,"prototype",{writable:!1}),t}()},function(t,e,i){"use strict";i.d(e,"a",(function(){return h}));var n=i(1),r=i(24);i(3);function s(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function o(t,e){for(var i=0;i=this.pool.length&&(this.curIndex=0),this.pool[this.curIndex].playAnim(t)}}]),t}(),l=function(){function t(e){var i=this;s(this,t),this.mesh=e.clone(),n.a.addToGame({obj:this.mesh,recycle:!1}),this.mesh.visible=!1,this.mesh.rotation.y=.5*-Math.PI,this.innerMeshList=[],this.mainMat,this.matList=[],this.mesh.traverse((function(t){t.isMesh&&(t.material=t.material.clone(),i.innerMeshList.push(t))}))}return a(t,[{key:"playAnim",value:function(t){if(this.mesh.position.copy(t),this.mesh.visible=!0,this.twenList)this.twenList.forEach((function(t){t.restart()}));else{var e=[];this.innerMeshList.forEach((function(t,i){t.material.opacity=0;var r=n.a.phaserScene.tweens.addCounter({from:0,to:1,duration:850,ease:Phaser.Math.Easing.Sine.Out,onUpdate:function(e){t.morphTargetInfluences[0]=e.getValue()}});e.push(r);var s=n.a.phaserScene.tweens.createTimeline();s.add({targets:t.material,opacity:.8,duration:50}),s.add({targets:t.material,opacity:0,delay:100,duration:300}),s.play(),e.push(s)}))}}}]),t}()},function(t,e,i){"use strict";i.d(e,"a",(function(){return x}));var n=i(20),r=i(0),s=i(47),o=i.n(s);function a(t,e){for(var i=0;i=this.pool.length&&(this.curIndex=0),this.pool[this.curIndex].playAnim(t)}}]),t}(),w=function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&c(t,e)}(i,t);var e=d(i);function i(t){var n;return g(this,i),(n=e.call(this)).mesh=h.createSpriteText(t),n.add(n.mesh),n.mesh.scale.multiplyScalar(.03),n.initAnim(),n.visible=!1,l.a.addToGame({obj:f(n),recycle:!1}),n}return y(i,[{key:"initAnim",value:function(){var t=this;this.anim1=Object(n.a)({targets:this.mesh.position,y:[0,1],duration:1e3,easing:"linear",autoplay:!1}),this.anim2=n.a.timeline({targets:this.scale,autoplay:!1}),this.anim2.add({x:3,y:3,z:3,easing:"easeOutCubic",endDelay:200,duration:500}),this.anim2.add({targets:this.mesh.material,opacity:0,easing:"easeOutCubic",duration:300,complete:function(){t.visible=!1}})}},{key:"playAnim",value:function(t){this.mesh.material.opacity=1,this.visible=!0,this.position.copy(t),this.scale.set(1,1,1),this.anim1.restart(),this.anim2.restart()}}]),i}(r.Object3D)},function(t,e,i){"use strict";i.d(e,"a",(function(){return s}));var n=i(0);function r(t,e){for(var i=0;i1&&void 0!==arguments[1]&&arguments[1];t&&(this.currentState=t,this.onResize(!0),e&&this.teleportToTarget())}},{key:"teleportToTarget",value:function(){this.attachTarget&&(this.camera.cam.position.copy(this.attachTarget.getCamHelperPos()),this.camera.cam.lookAt(this.attachTarget.getCamLookAtPos()))}},{key:"setfollowObject",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];this.attachTarget=t,this.mainCamera.fov=this.defaultFov,this.mainCamera.updateProjectionMatrix(),this.setState(this.states.followState,e)}},{key:"onResize",value:function(){var t=app.innerWidth,e=app.innerHeight,i=this.currentState;if(this.camera&&r.a.main.camera&&i&&this.camera.enabled){i.landscapePos||(i.landscapePos=i.portraitPos),i.lrot||(i.lrot=i.prot);var n=null,s=null,o=this.defaultFov;return t>e?(n=i.landscapePos,s=i.lrot,o=this.defaultFovLand):(n=i.portraitPos,s=i.prot),i.onResize(n,s),this.camera.setFov(o),{pos:n,rot:s,fov:o}}}}],(i=null)&&o(e.prototype,i),a&&o(e,a),Object.defineProperty(e,"prototype",{writable:!1}),t}();a=u,h="states",l={defaultState:{portraitPos:new n.Vector3(0,7.5,10.5),prot:new n.Euler(-.56,0,0),onResize:function(t,e){u.camera.setMoveAndRotTarget(t,e,!1)}},followState:{portraitPos:new n.Vector3(0,0,0),prot:new n.Euler(-.6,.5,.4),onResize:function(t,e,i){u.attachTarget&&u.camera.setFollowTarget(u.attachTarget,t,e,!0,!1)}}},h in a?Object.defineProperty(a,h,{value:l,enumerable:!0,configurable:!0,writable:!0}):a[h]=l},function(t,e,i){"use strict";i.d(e,"a",(function(){return u}));i(5);var n,r=i(1),s=i(11),o=i(17),a=i(18),h=i(8);function l(t,e){for(var i=0;ii&&(n=.78),h.a.showUpgrades||(n=.7),e.playBtn.x=.5*t,e.playBtn.y=i*n,e.playBtn.iS=e.playBtn.scale},this.playBtn.onResizeCallback(n.lastWidth,n.lastHeight),a.a.makePulse(this.playBtn,{skalRatio:.9}),this.gameObjects=[this.levelTitle,this.playBtn],this.show(!1),t.initCoinBar()}var e,i,u;return e=t,u=[{key:"initCoinBar",value:function(){var t=this;this.coinBar=new o.a;var e=r.a.phaserScene,i=e.add.image(0,0,"uiatlas","coin");i.setOrigin(.5),i.scale=.5;var n=e.add.image(0,0,"uiatlas","goldbg");n.setOrigin(.5),this.coinBar.add(n),this.coinBar.setInitials();var s=e.add.text(0,0,"1000000000",{fontSize:60,fontFamily:"ui-font",color:"#ffffff"});s.setFontStyle("bold"),s.setOrigin(.5),s.setTextScale=function(t){s.text=t.toFixed(0),s.scale=Math.min(.6*n.displayWidth/s.width,.75*n.displayHeight/s.height)},s.setTextScale(r.a.playerData.coin),i.x=.5*n.displayWidth,s.x=0,s.y=0,this.coinBar.add(i),this.coinBar.add(s),this.coinBar.onResizeCallback=function(e,i){t.coinBar.scale=Math.min(.2*e/t.coinBar.iW,.05*i/t.coinBar.iH),t.coinBar.x=1*e-.85*t.coinBar.displayWidth,t.coinBar.y=0*i+1.2*t.coinBar.displayHeight,t.coinBar.iS=t.coinBar.scale},this.coinBar.onResizeCallback(e.lastWidth,e.lastHeight),r.a.eventEmitter.on("coinCollected",(function(t){s.setTextScale(r.a.playerData.coin)})),r.a.eventEmitter.on("updateCoins",(function(t){s.setTextScale(r.a.playerData.coin)})),this.coinBar.addCoinWithAnim=function(e){s.setTextScale(e),s.anim&&s.anim.remove(),s.anim=r.a.phaserScene.tweens.add({targets:t.coinBar,props:{scale:{dynamic:!0,value:{getStart:function(e){return 1.15*t.coinBar.iS},getEnd:function(e){return 1*t.coinBar.iS}}}},duration:100,ease:"Sine.easeInOut"})}}}],(i=[{key:"setLevelTitle",value:function(t){this.levelTitle.setText(r.a.locales.LEVEL+" "+t)}},{key:"show",value:function(t){this.gameObjects.forEach((function(e){e.visible=t}))}}])&&l(e.prototype,i),u&&l(e,u),Object.defineProperty(e,"prototype",{writable:!1}),t}()},function(t,e,i){"use strict";var n={shuffleArray:function(t){for(var e=t.length-1;e>0;e--){var i=Math.floor(Math.random()*(e+1)),n=[t[i],t[e]];t[e]=n[0],t[i]=n[1]}},convertRgbStringToHex:function(t){var e=n.rgbStringToRgbObj(t);return n.rgbToHex(e.r,e.g,e.b)},rgbStringToRgbObj:function(t){var e=t.split(",");return{r:Number.parseInt(e[0].substring(4)),g:Number.parseInt(e[1]),b:Number.parseInt(e[2])}},rgbToHex:function(t,e,i){return"#"+((1<<24)+(t<<16)+(e<<8)+i).toString(16).slice(1)},hexToRgb:function(t){var e=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(t);return e?{r:parseInt(e[1],16),g:parseInt(e[2],16),b:parseInt(e[3],16)}:null},lightenDarkenColor:function(t,e){var i=parseInt(t.replace("#",""),16),n=Math.round(2.55*e),r=(i>>16)+n,s=(i>>8&255)+n,o=(255&i)+n;return"#"+(16777216+65536*(r<255?r<1?0:r:255)+256*(s<255?s<1?0:s:255)+(o<255?o<1?0:o:255)).toString(16).slice(1)},getRandomColor:function(){return Math.floor(16777215*Math.random()).toString(16)},formattedTime:function(t){var e=t;Math.floor(e/3600);e%=3600;var i=Math.floor(e/60),n=Math.floor(e%60);return(i=String(i).padStart(2,"0"))+":"+(n=String(n).padStart(2,"0"))},removeItemFromArray:function(t,e){var i=t.indexOf(e);return!(i<0)&&(t.splice(i,1),!0)},orderByLastIndex:function(t,e){var i=this;t.sort((function(t,n){var r,s;if(e){var o=i.indexOfFirstDigit(t.name),a=i.indexOfFirstDigit(n.name);r=t.name.substr(o),s=n.name.substr(a)}else r=t.name.substr(t.name.lastIndexOf("_")+1),s=n.name.substr(t.name.lastIndexOf("_")+1);return Number.parseInt(r)>Number.parseInt(s)?1:-1}))},indexOfFirstDigit:function(t){for(var e=0;t[e]<"0"||t[e]>"9";e++);return e==t.length?-1:e}};e.a=n},function(t,e,i){"use strict";i.d(e,"a",(function(){return u}));var n=i(0),r=i(20),s=i(1);function o(t,e){for(var i=0;i0?(e.rotation.x+=n.MathUtils.randFloat(-1,1)*this.shakeForce,e.rotation.y+=n.MathUtils.randFloat(-1,1)*this.shakeForce,this.shakeTimer-=t):(this.shakeEnabled=!1,this.cam.position.copy(this.moveTarget))}}},{key:"setMoveRotSpeed",value:function(t,e){this.moveSpeed=t,this.rotationSpeed=e}},{key:"setPosition",value:function(t){this.cam.position.copy(t)}},{key:"setPosAndRot",value:function(t,e){this.cam.position.copy(t),this.cam.rotation.copy(e)}},{key:"setLookDir",value:function(t){var e=this.cam.quaternion.clone();this.cam.lookAt(t),this.lookQuaternion.copy(this.cam.quaternion),this.cam.quaternion.copy(e),this.lookPos=t}},{key:"setMoveTarget",value:function(e){var i=e.x,n=void 0===i?this.cam.position.x:i,r=e.y,s=void 0===r?this.cam.position.y:r,o=e.z,a=void 0===o?this.cam.position.z:o,h=e.keepOffset,l=void 0===h||h;e.lookPos,e.lookAlways,this.moveTarget.set(n,s,a),l&&(this.moveTarget.x+=this.initPosition.x,this.moveTarget.z+=this.initPosition.z),this.cameraMoveType=t.MoveType.LERP}},{key:"setFollowTargetStatic",value:function(e,i,n){var r=arguments.length>3&&void 0!==arguments[3]&&arguments[3],s=!(arguments.length>4&&void 0!==arguments[4])||arguments[4];this.target=e,this.offset.copy(i),this.initOffset.copy(this.offset),this.cameraMoveType=t.MoveType.FOLLOW,this.moveTarget.addVectors(this.target.position,this.offset),s&&(this.cam.position.copy(this.moveTarget),this.cam.rotation.copy(n)),this.setOffsetAndRot(i,n),this.lookAtAlways=r}},{key:"lockMovementAxis",value:function(t,e){this.enableLockAxis=e,this.selectedLockAxis=t,this.lockVector=this.moveTarget.clone()}},{key:"setMoveTargetScalar",value:function(t,e){this.movetargetSkalar=e,this.selectedSkalarAxis=t}},{key:"setFollowTarget",value:function(e,i,n){var r=arguments.length>3&&void 0!==arguments[3]&&arguments[3],s=arguments.length>4&&void 0!==arguments[4]&&arguments[4];this.target=e,this.offset.copy(i),this.initOffset.copy(this.offset),this.cameraMoveType=t.MoveType.FOLLOW,this.moveTarget.addVectors(this.target.getCamHelperPos(),this.offset),s&&this.cam.position.copy(this.moveTarget),this.lookPos.copy(n),this.lookAtAlways=r}},{key:"changeTarget",value:function(t,e){this.target=t,e&&this.offset.copy(e)}},{key:"goPosAndLookAt",value:function(e,i,r){this.target=e,this.cam.position.copy(i),this.cameraMoveType=t.MoveType.FREE,this.lookAtAlways=!0,r&&this.cam.lookAt(e.getWorldPosition(new n.Vector3))}},{key:"setMoveAndRotTarget",value:function(e,i){var n=arguments.length>2&&void 0!==arguments[2]&&arguments[2];this.moveTarget.copy(e),this.rotTarget.copy(i),n&&(this.cam.position.copy(e),this.cam.rotation.copy(i)),this.cameraMoveType=t.MoveType.LERP}},{key:"lerpToTarget",value:function(t){this.cam.position.lerp(this.moveTarget,this.moveSpeed*t),this.cam.rotation.x+=(this.rotTarget.x-this.cam.rotation.x)*this.moveSpeed*t,this.cam.rotation.y+=(this.rotTarget.y-this.cam.rotation.y)*this.moveSpeed*t,this.cam.rotation.z+=(this.rotTarget.z-this.cam.rotation.z)*this.moveSpeed*t}},{key:"checkLerpComplete",value:function(){return this.cam.position.manhattanDistanceTo(this.moveTarget)<.1}},{key:"followHelperObject",value:function(e){this.target=e,this.lookAtAlways=!1,this.cameraMoveType=t.MoveType.LOCK,this.lerpRotation=!0}},{key:"lerptoHelperTarget",value:function(t){this.target.getWorldPosition(this.moveTarget),this.cam.position.copy(this.moveTarget),this.target.getWorldQuaternion(this.cam.quaternion)}},{key:"setOffsetAndRot",value:function(t,e){this.offset.copy(t),this.rotTarget.copy(e),this.rotationQuaternion.setFromEuler(e)}},{key:"setOffset",value:function(t){this.offset.set(this.initOffset.x+t.x,this.initOffset.y+t.y,this.initOffset.z+t.z)}},{key:"shakeCamera",value:function(t,e,i){this.shakeEnabled=!0,this.shakeTimer=e,this.shakeForce=t,this.shakeTarget=i||this.cam}},{key:"setFov",value:function(t){this.cam.fov=t,this.cam.updateProjectionMatrix()}},{key:"setFovAnim",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1e3,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"linear",n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"none";return Object(r.a)({targets:this.cam,fov:t,duration:e,easing:i,direction:n,update:function(){s.a.main.camera.updateProjectionMatrix()}})}}])&&o(e.prototype,i),a&&o(e,a),Object.defineProperty(e,"prototype",{writable:!1}),t}();l={FREE:0,LERP:1,FOLLOW:2,LOCK:3},(h="MoveType")in(a=u)?Object.defineProperty(a,h,{value:l,enumerable:!0,configurable:!0,writable:!0}):a[h]=l},function(t,e,i){"use strict";var n=i(0);class r extends n.Loader{constructor(t){super(t),this.dracoLoader=null,this.ktx2Loader=null,this.meshoptDecoder=null,this.pluginCallbacks=[],this.register((function(t){return new u(t)})),this.register((function(t){return new g(t)})),this.register((function(t){return new v(t)})),this.register((function(t){return new c(t)})),this.register((function(t){return new d(t)})),this.register((function(t){return new p(t)})),this.register((function(t){return new f(t)})),this.register((function(t){return new l(t)})),this.register((function(t){return new m(t)})),this.register((function(t){return new a(t)})),this.register((function(t){return new y(t)}))}load(t,e,i,r){const s=this;let o;o=""!==this.resourcePath?this.resourcePath:""!==this.path?this.path:n.LoaderUtils.extractUrlBase(t),this.manager.itemStart(t);const a=function(e){r&&r(e),s.manager.itemError(t),s.manager.itemEnd(t)},h=new n.FileLoader(this.manager);h.setPath(this.path),h.setResponseType("arraybuffer"),h.setRequestHeader(this.requestHeader),h.setWithCredentials(this.withCredentials),h.load(t,(function(i){try{s.parse(i,o,(function(i){e(i),s.manager.itemEnd(t)}),a)}catch(t){a(t)}}),i,a)}setDRACOLoader(t){return this.dracoLoader=t,this}setDDSLoader(){throw new Error('THREE.GLTFLoader: "MSFT_texture_dds" no longer supported. Please update to "KHR_texture_basisu".')}setKTX2Loader(t){return this.ktx2Loader=t,this}setMeshoptDecoder(t){return this.meshoptDecoder=t,this}register(t){return-1===this.pluginCallbacks.indexOf(t)&&this.pluginCallbacks.push(t),this}unregister(t){return-1!==this.pluginCallbacks.indexOf(t)&&this.pluginCallbacks.splice(this.pluginCallbacks.indexOf(t),1),this}parse(t,e,i,r){let s;const a={},l={};if("string"==typeof t)s=t;else{if(n.LoaderUtils.decodeText(new Uint8Array(t,0,4))===x){try{a[o.KHR_BINARY_GLTF]=new A(t)}catch(t){return void(r&&r(t))}s=a[o.KHR_BINARY_GLTF].content}else s=n.LoaderUtils.decodeText(new Uint8Array(t))}const u=JSON.parse(s);if(void 0===u.asset||u.asset.version[0]<2)return void(r&&r(new Error("THREE.GLTFLoader: Unsupported asset. glTF versions >=2.0 are supported.")));const c=new tt(u,{path:e||this.resourcePath||"",crossOrigin:this.crossOrigin,requestHeader:this.requestHeader,manager:this.manager,ktx2Loader:this.ktx2Loader,meshoptDecoder:this.meshoptDecoder});c.fileLoader.setRequestHeader(this.requestHeader);for(let t=0;t=0&&l[e]}}c.setExtensions(a),c.setPlugins(l),c.parse(i,r)}parseAsync(t,e){const i=this;return new Promise((function(n,r){i.parse(t,e,n,r)}))}}function s(){let t={};return{get:function(e){return t[e]},add:function(e,i){t[e]=i},remove:function(e){delete t[e]},removeAll:function(){t={}}}}const o={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_IOR:"KHR_materials_ior",KHR_MATERIALS_PBR_SPECULAR_GLOSSINESS:"KHR_materials_pbrSpecularGlossiness",KHR_MATERIALS_SHEEN:"KHR_materials_sheen",KHR_MATERIALS_SPECULAR:"KHR_materials_specular",KHR_MATERIALS_TRANSMISSION:"KHR_materials_transmission",KHR_MATERIALS_UNLIT:"KHR_materials_unlit",KHR_MATERIALS_VOLUME:"KHR_materials_volume",KHR_TEXTURE_BASISU:"KHR_texture_basisu",KHR_TEXTURE_TRANSFORM:"KHR_texture_transform",KHR_MESH_QUANTIZATION:"KHR_mesh_quantization",KHR_MATERIALS_EMISSIVE_STRENGTH:"KHR_materials_emissive_strength",EXT_TEXTURE_WEBP:"EXT_texture_webp",EXT_MESHOPT_COMPRESSION:"EXT_meshopt_compression"};class a{constructor(t){this.parser=t,this.name=o.KHR_LIGHTS_PUNCTUAL,this.cache={refs:{},uses:{}}}_markDefs(){const t=this.parser,e=this.parser.json.nodes||[];for(let i=0,n=e.length;i=0)throw new Error("THREE.GLTFLoader: setKTX2Loader must be called before loading KTX2 textures");return null}return e.loadTextureImage(t,r.source,s)}}class v{constructor(t){this.parser=t,this.name=o.EXT_TEXTURE_WEBP,this.isSupported=null}loadTexture(t){const e=this.name,i=this.parser,n=i.json,r=n.textures[t];if(!r.extensions||!r.extensions[e])return null;const s=r.extensions[e],o=n.images[s.source];let a=i.textureLoader;if(o.uri){const t=i.options.manager.getHandler(o.uri);null!==t&&(a=t)}return this.detectSupport().then((function(r){if(r)return i.loadTextureImage(t,s.source,a);if(n.extensionsRequired&&n.extensionsRequired.indexOf(e)>=0)throw new Error("THREE.GLTFLoader: WebP required by asset but unsupported.");return i.loadTexture(t)}))}detectSupport(){return this.isSupported||(this.isSupported=new Promise((function(t){const e=new Image;e.src="data:image/webp;base64,UklGRiIAAABXRUJQVlA4IBYAAAAwAQCdASoBAAEADsD+JaQAA3AAAAAA",e.onload=e.onerror=function(){t(1===e.height)}}))),this.isSupported}}class y{constructor(t){this.name=o.EXT_MESHOPT_COMPRESSION,this.parser=t}loadBufferView(t){const e=this.parser.json,i=e.bufferViews[t];if(i.extensions&&i.extensions[this.name]){const t=i.extensions[this.name],n=this.parser.getDependency("buffer",t.buffer),r=this.parser.options.meshoptDecoder;if(!r||!r.supported){if(e.extensionsRequired&&e.extensionsRequired.indexOf(this.name)>=0)throw new Error("THREE.GLTFLoader: setMeshoptDecoder must be called before loading compressed files");return null}return Promise.all([n,r.ready]).then((function(e){const i=t.byteOffset||0,n=t.byteLength||0,s=t.count,o=t.byteStride,a=new ArrayBuffer(s*o),h=new Uint8Array(e[0],i,n);return r.decodeGltfBuffer(new Uint8Array(a),s,o,h,t.mode,t.filter),a}))}return null}}const x="glTF",w=1313821514,b=5130562;class A{constructor(t){this.name=o.KHR_BINARY_GLTF,this.content=null,this.body=null;const e=new DataView(t,0,12);if(this.header={magic:n.LoaderUtils.decodeText(new Uint8Array(t.slice(0,4))),version:e.getUint32(4,!0),length:e.getUint32(8,!0)},this.header.magic!==x)throw new Error("THREE.GLTFLoader: Unsupported glTF-Binary header.");if(this.header.version<2)throw new Error("THREE.GLTFLoader: Legacy binary file detected.");const i=this.header.length-12,r=new DataView(t,12);let s=0;for(;s",e).replace("#include ",i).replace("#include ",r).replace("#include ",s).replace("#include ",o)},Object.defineProperties(this,{specular:{get:function(){return a.specular.value},set:function(t){a.specular.value=t}},specularMap:{get:function(){return a.specularMap.value},set:function(t){a.specularMap.value=t,t?this.defines.USE_SPECULARMAP="":delete this.defines.USE_SPECULARMAP}},glossiness:{get:function(){return a.glossiness.value},set:function(t){a.glossiness.value=t}},glossinessMap:{get:function(){return a.glossinessMap.value},set:function(t){a.glossinessMap.value=t,t?(this.defines.USE_GLOSSINESSMAP="",this.defines.USE_UV=""):(delete this.defines.USE_GLOSSINESSMAP,delete this.defines.USE_UV)}}}),delete this.metalness,delete this.roughness,delete this.metalnessMap,delete this.roughnessMap,this.setValues(t)}copy(t){return super.copy(t),this.specularMap=t.specularMap,this.specular.copy(t.specular),this.glossinessMap=t.glossinessMap,this.glossiness=t.glossiness,delete this.metalness,delete this.roughness,delete this.metalnessMap,delete this.roughnessMap,this}}class M{constructor(){this.name=o.KHR_MATERIALS_PBR_SPECULAR_GLOSSINESS,this.specularGlossinessParams=["color","map","lightMap","lightMapIntensity","aoMap","aoMapIntensity","emissive","emissiveIntensity","emissiveMap","bumpMap","bumpScale","normalMap","normalMapType","displacementMap","displacementScale","displacementBias","specularMap","specular","glossinessMap","glossiness","alphaMap","envMap","envMapIntensity"]}getMaterialType(){return E}extendParams(t,e,i){const r=e.extensions[this.name];t.color=new n.Color(1,1,1),t.opacity=1;const s=[];if(Array.isArray(r.diffuseFactor)){const e=r.diffuseFactor;t.color.fromArray(e),t.opacity=e[3]}if(void 0!==r.diffuseTexture&&s.push(i.assignTexture(t,"map",r.diffuseTexture,n.sRGBEncoding)),t.emissive=new n.Color(0,0,0),t.glossiness=void 0!==r.glossinessFactor?r.glossinessFactor:1,t.specular=new n.Color(1,1,1),Array.isArray(r.specularFactor)&&t.specular.fromArray(r.specularFactor),void 0!==r.specularGlossinessTexture){const e=r.specularGlossinessTexture;s.push(i.assignTexture(t,"glossinessMap",e)),s.push(i.assignTexture(t,"specularMap",e,n.sRGBEncoding))}return Promise.all(s)}createMaterial(t){const e=new E(t);return e.fog=!0,e.color=t.color,e.map=void 0===t.map?null:t.map,e.lightMap=null,e.lightMapIntensity=1,e.aoMap=void 0===t.aoMap?null:t.aoMap,e.aoMapIntensity=1,e.emissive=t.emissive,e.emissiveIntensity=void 0===t.emissiveIntensity?1:t.emissiveIntensity,e.emissiveMap=void 0===t.emissiveMap?null:t.emissiveMap,e.bumpMap=void 0===t.bumpMap?null:t.bumpMap,e.bumpScale=1,e.normalMap=void 0===t.normalMap?null:t.normalMap,e.normalMapType=n.TangentSpaceNormalMap,t.normalScale&&(e.normalScale=t.normalScale),e.displacementMap=null,e.displacementScale=1,e.displacementBias=0,e.specularMap=void 0===t.specularMap?null:t.specularMap,e.specular=t.specular,e.glossinessMap=void 0===t.glossinessMap?null:t.glossinessMap,e.glossiness=t.glossiness,e.alphaMap=null,e.envMap=void 0===t.envMap?null:t.envMap,e.envMapIntensity=1,e}}class _{constructor(){this.name=o.KHR_MESH_QUANTIZATION}}class C extends n.Interpolant{constructor(t,e,i,n){super(t,e,i,n)}copySampleValue_(t){const e=this.resultBuffer,i=this.sampleValues,n=this.valueSize,r=t*n*3+n;for(let t=0;t!==n;t++)e[t]=i[r+t];return e}}C.prototype.beforeStart_=C.prototype.copySampleValue_,C.prototype.afterEnd_=C.prototype.copySampleValue_,C.prototype.interpolate_=function(t,e,i,n){const r=this.resultBuffer,s=this.sampleValues,o=this.valueSize,a=2*o,h=3*o,l=n-e,u=(i-e)/l,c=u*u,d=c*u,p=t*h,f=p-h,m=-2*d+3*c,g=d-c,v=1-m,y=g-c+u;for(let t=0;t!==o;t++){const e=s[f+t+o],i=s[f+t+a]*l,n=s[p+t+o],h=s[p+t]*l;r[t]=v*e+y*i+m*n+g*h}return r};const P=new n.Quaternion;class R extends C{interpolate_(t,e,i,n){const r=super.interpolate_(t,e,i,n);return P.fromArray(r).normalize().toArray(r),r}}const L=0,O=1,D=2,B=3,I=4,F=5,k=6,N={5120:Int8Array,5121:Uint8Array,5122:Int16Array,5123:Uint16Array,5125:Uint32Array,5126:Float32Array},z={9728:n.NearestFilter,9729:n.LinearFilter,9984:n.NearestMipmapNearestFilter,9985:n.LinearMipmapNearestFilter,9986:n.NearestMipmapLinearFilter,9987:n.LinearMipmapLinearFilter},U={33071:n.ClampToEdgeWrapping,33648:n.MirroredRepeatWrapping,10497:n.RepeatWrapping},V={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16},H={POSITION:"position",NORMAL:"normal",TANGENT:"tangent",TEXCOORD_0:"uv",TEXCOORD_1:"uv2",COLOR_0:"color",WEIGHTS_0:"skinWeight",JOINTS_0:"skinIndex"},G={scale:"scale",translation:"position",rotation:"quaternion",weights:"morphTargetInfluences"},W={CUBICSPLINE:void 0,LINEAR:n.InterpolateLinear,STEP:n.InterpolateDiscrete},Y="OPAQUE",X="MASK",j="BLEND";function q(t,e,i){for(const n in i.extensions)void 0===t[n]&&(e.userData.gltfExtensions=e.userData.gltfExtensions||{},e.userData.gltfExtensions[n]=i.extensions[n])}function Q(t,e){void 0!==e.extras&&"object"==typeof e.extras&&Object.assign(t.userData,e.extras)}function K(t,e){if(t.updateMorphTargets(),void 0!==e.weights)for(let i=0,n=e.weights.length;i-1,o=r?navigator.userAgent.match(/Firefox\/([0-9]+)\./)[1]:-1;"undefined"==typeof createImageBitmap||i||r&&o<98?this.textureLoader=new n.TextureLoader(this.options.manager):this.textureLoader=new n.ImageBitmapLoader(this.options.manager),this.textureLoader.setCrossOrigin(this.options.crossOrigin),this.textureLoader.setRequestHeader(this.options.requestHeader),this.fileLoader=new n.FileLoader(this.options.manager),this.fileLoader.setResponseType("arraybuffer"),"use-credentials"===this.options.crossOrigin&&this.fileLoader.setWithCredentials(!0)}setExtensions(t){this.extensions=t}setPlugins(t){this.plugins=t}parse(t,e){const i=this,n=this.json,r=this.extensions;this.cache.removeAll(),this._invokeAll((function(t){return t._markDefs&&t._markDefs()})),Promise.all(this._invokeAll((function(t){return t.beforeRoot&&t.beforeRoot()}))).then((function(){return Promise.all([i.getDependencies("scene"),i.getDependencies("animation"),i.getDependencies("camera")])})).then((function(e){const s={scene:e[0][n.scene||0],scenes:e[0],animations:e[1],cameras:e[2],asset:n.asset,parser:i,userData:{}};q(r,s,n),Q(s,n),Promise.all(i._invokeAll((function(t){return t.afterRoot&&t.afterRoot(s)}))).then((function(){t(s)}))})).catch(e)}_markDefs(){const t=this.json.nodes||[],e=this.json.skins||[],i=this.json.meshes||[];for(let i=0,n=e.length;i{const i=this.associations.get(t);null!=i&&this.associations.set(e,i);for(const[i,n]of t.children.entries())r(n,e.children[i])};return r(i,n),n.name+="_instance_"+t.uses[e]++,n}_invokeOne(t){const e=Object.values(this.plugins);e.push(this);for(let i=0;i=2&&f.setY(e,c[t*o+1]),o>=3&&f.setZ(e,c[t*o+2]),o>=4&&f.setW(e,c[t*o+3]),o>=5)throw new Error("THREE.GLTFLoader: Unsupported itemSize in sparse BufferAttribute.")}}return f}))}loadTexture(t){const e=this.json,i=this.options,n=e.textures[t].source,r=e.images[n];let s=this.textureLoader;if(r.uri){const t=i.manager.getHandler(r.uri);null!==t&&(s=t)}return this.loadTextureImage(t,n,s)}loadTextureImage(t,e,i){const r=this,s=this.json,o=s.textures[t],a=s.images[e],h=(a.uri||a.bufferView)+":"+o.sampler;if(this.textureCache[h])return this.textureCache[h];const l=this.loadImageSource(e,i).then((function(e){e.flipY=!1,o.name&&(e.name=o.name);const i=(s.samplers||{})[o.sampler]||{};return e.magFilter=z[i.magFilter]||n.LinearFilter,e.minFilter=z[i.minFilter]||n.LinearMipmapLinearFilter,e.wrapS=U[i.wrapS]||n.RepeatWrapping,e.wrapT=U[i.wrapT]||n.RepeatWrapping,r.associations.set(e,{textures:t}),e})).catch((function(){return null}));return this.textureCache[h]=l,l}loadImageSource(t,e){const i=this,r=this.json,s=this.options;if(void 0!==this.sourceCache[t])return this.sourceCache[t].then(t=>t.clone());const o=r.images[t],a=self.URL||self.webkitURL;let h=o.uri||"",l=!1;if(void 0!==o.bufferView)h=i.getDependency("bufferView",o.bufferView).then((function(t){l=!0;const e=new Blob([t],{type:o.mimeType});return h=a.createObjectURL(e),h}));else if(void 0===o.uri)throw new Error("THREE.GLTFLoader: Image "+t+" is missing URI and bufferView");const u=Promise.resolve(h).then((function(t){return new Promise((function(i,r){let o=i;!0===e.isImageBitmapLoader&&(o=function(t){const e=new n.Texture(t);e.needsUpdate=!0,i(e)}),e.load(n.LoaderUtils.resolveURL(t,s.path),o,void 0,r)}))})).then((function(t){var e;return!0===l&&a.revokeObjectURL(h),t.userData.mimeType=o.mimeType||((e=o.uri).search(/\.jpe?g($|\?)/i)>0||0===e.search(/^data\:image\/jpeg/)?"image/jpeg":e.search(/\.webp($|\?)/i)>0||0===e.search(/^data\:image\/webp/)?"image/webp":"image/png"),t})).catch((function(t){throw t}));return this.sourceCache[t]=u,u}assignTexture(t,e,i,n){const r=this;return this.getDependency("texture",i.index).then((function(s){if(void 0!==i.texCoord&&0!=i.texCoord&&("aoMap"!==e||i.texCoord),r.extensions[o.KHR_TEXTURE_TRANSFORM]){const t=void 0!==i.extensions?i.extensions[o.KHR_TEXTURE_TRANSFORM]:void 0;if(t){const e=r.associations.get(s);s=r.extensions[o.KHR_TEXTURE_TRANSFORM].extendTexture(s,t),r.associations.set(s,e)}}return void 0!==n&&(s.encoding=n),t[e]=s,s}))}assignFinalMaterial(t){const e=t.geometry;let i=t.material;const r=void 0===e.attributes.tangent,s=void 0!==e.attributes.color,o=void 0===e.attributes.normal;if(t.isPoints){const t="PointsMaterial:"+i.uuid;let e=this.cache.get(t);e||(e=new n.PointsMaterial,n.Material.prototype.copy.call(e,i),e.color.copy(i.color),e.map=i.map,e.sizeAttenuation=!1,this.cache.add(t,e)),i=e}else if(t.isLine){const t="LineBasicMaterial:"+i.uuid;let e=this.cache.get(t);e||(e=new n.LineBasicMaterial,n.Material.prototype.copy.call(e,i),e.color.copy(i.color),this.cache.add(t,e)),i=e}if(r||s||o){let t="ClonedMaterial:"+i.uuid+":";i.isGLTFSpecularGlossinessMaterial&&(t+="specular-glossiness:"),r&&(t+="derivative-tangents:"),s&&(t+="vertex-colors:"),o&&(t+="flat-shading:");let e=this.cache.get(t);e||(e=i.clone(),s&&(e.vertexColors=!0),o&&(e.flatShading=!0),r&&(e.normalScale&&(e.normalScale.y*=-1),e.clearcoatNormalScale&&(e.clearcoatNormalScale.y*=-1)),this.cache.add(t,e),this.associations.set(e,this.associations.get(i))),i=e}i.aoMap&&void 0===e.attributes.uv2&&void 0!==e.attributes.uv&&e.setAttribute("uv2",e.attributes.uv),t.material=i}getMaterialType(){return n.MeshStandardMaterial}loadMaterial(t){const e=this,i=this.json,r=this.extensions,s=i.materials[t];let a;const h={},l=s.extensions||{},u=[];if(l[o.KHR_MATERIALS_PBR_SPECULAR_GLOSSINESS]){const t=r[o.KHR_MATERIALS_PBR_SPECULAR_GLOSSINESS];a=t.getMaterialType(),u.push(t.extendParams(h,s,e))}else if(l[o.KHR_MATERIALS_UNLIT]){const t=r[o.KHR_MATERIALS_UNLIT];a=t.getMaterialType(),u.push(t.extendParams(h,s,e))}else{const i=s.pbrMetallicRoughness||{};if(h.color=new n.Color(1,1,1),h.opacity=1,Array.isArray(i.baseColorFactor)){const t=i.baseColorFactor;h.color.fromArray(t),h.opacity=t[3]}void 0!==i.baseColorTexture&&u.push(e.assignTexture(h,"map",i.baseColorTexture,n.sRGBEncoding)),h.metalness=void 0!==i.metallicFactor?i.metallicFactor:1,h.roughness=void 0!==i.roughnessFactor?i.roughnessFactor:1,void 0!==i.metallicRoughnessTexture&&(u.push(e.assignTexture(h,"metalnessMap",i.metallicRoughnessTexture)),u.push(e.assignTexture(h,"roughnessMap",i.metallicRoughnessTexture))),a=this._invokeOne((function(e){return e.getMaterialType&&e.getMaterialType(t)})),u.push(Promise.all(this._invokeAll((function(e){return e.extendMaterialParams&&e.extendMaterialParams(t,h)}))))}!0===s.doubleSided&&(h.side=n.DoubleSide);const c=s.alphaMode||Y;if(c===j?(h.transparent=!0,h.depthWrite=!1):(h.transparent=!1,c===X&&(h.alphaTest=void 0!==s.alphaCutoff?s.alphaCutoff:.5)),void 0!==s.normalTexture&&a!==n.MeshBasicMaterial&&(u.push(e.assignTexture(h,"normalMap",s.normalTexture)),h.normalScale=new n.Vector2(1,1),void 0!==s.normalTexture.scale)){const t=s.normalTexture.scale;h.normalScale.set(t,t)}return void 0!==s.occlusionTexture&&a!==n.MeshBasicMaterial&&(u.push(e.assignTexture(h,"aoMap",s.occlusionTexture)),void 0!==s.occlusionTexture.strength&&(h.aoMapIntensity=s.occlusionTexture.strength)),void 0!==s.emissiveFactor&&a!==n.MeshBasicMaterial&&(h.emissive=(new n.Color).fromArray(s.emissiveFactor)),void 0!==s.emissiveTexture&&a!==n.MeshBasicMaterial&&u.push(e.assignTexture(h,"emissiveMap",s.emissiveTexture,n.sRGBEncoding)),Promise.all(u).then((function(){let i;return i=a===E?r[o.KHR_MATERIALS_PBR_SPECULAR_GLOSSINESS].createMaterial(h):new a(h),s.name&&(i.name=s.name),Q(i,s),e.associations.set(i,{materials:t}),s.extensions&&q(r,i,s),i}))}createUniqueName(t){const e=n.PropertyBinding.sanitizeNodeName(t||"");let i=e;for(let t=1;this.nodeNamesUsed[i];++t)i=e+"_"+t;return this.nodeNamesUsed[i]=!0,i}loadGeometries(t){const e=this,i=this.extensions,r=this.primitiveCache;function s(t){return i[o.KHR_DRACO_MESH_COMPRESSION].decodePrimitive(t,e).then((function(i){return it(i,t,e)}))}const a=[];for(let i=0,h=t.length;i0&&K(d,s),d.name=e.createUniqueName(s.name||"mesh_"+t),Q(d,s),c.extensions&&q(r,d,c),e.assignFinalMaterial(d),l.push(d)}for(let i=0,n=l.length;i1?new n.Group:1===e.length?e[0]:new n.Object3D,a!==e[0])for(let t=0,i=e.length;t{const e=new Map;for(const[t,i]of s.associations)(t instanceof n.Material||t instanceof n.Texture)&&e.set(t,i);return t.traverse(t=>{const i=s.associations.get(t);null!=i&&e.set(t,i)}),e})(o),o}))}}function et(t,e,i,r){const s=i.nodes[t];return r.getDependency("node",t).then((function(t){if(void 0===s.skin)return t;let e;return r.getDependency("skin",s.skin).then((function(t){e=t;const i=[];for(let t=0,n=e.joints.length;t=t.length&&e()}),void 0,(function(t){}))}))}else e()}},{key:"loadModels",value:function(t,e){if(0!=t.length){rt.a.models||(rt.a.models={});var i=0,n=function(){++i>=t.length&&e()};t.forEach((function(t,e){rt.a.models[t.name]?n():at.load(t.path,(function(e){rt.a.models[t.name]=e,n()}),(function(t){}),(function(t){}))}))}else e()}}],(i=null)&&st(e.prototype,i),n&&st(e,n),Object.defineProperty(e,"prototype",{writable:!1}),t}();e.a=ht},function(t,e,i){"use strict";i.r(e),i.d(e,"default",(function(){return m}));var n=i(5),r=i(1),s=i(9),o=i(3),a=i(16),h=i(0),l=i(19),u=i(13),c=i(6),d=i(10),p=i(2);function f(t,e){for(var i=0;i.1&&(t.body.velocity.x=.1)):t.climbingNow=!1}))}},{key:"createArmCenterBody",value:function(){var t=this;this.armBody=new r.Body({shape:new r.Box(new r.Vec3(.1,.1,.1)),mass:.1,type:r.Body.DYNAMIC}),this.armBody.shapes[0].collisionResponse=!1,this.armBody.fixedRotation=!0,this.armBody.position.copy(this.position),h.a.world.add(this.armBody),this.armBody.material=o.a.kontakMaterials.normal;var e=new r.LockConstraint(this.body,this.armBody);h.a.world.addConstraint(e),this.currentConstraint=e,this.armBody.addEventListener("collide",(function(e){e.body.colType&&e.body.master&&e.body.master.onTouch(t)}))}},{key:"translatePointsToWorld",value:function(t){for(var e=[],i=0;ithis.firstWaitTime&&(this.armBreakingThings(t),this.firstWaitTime=.2,this.startTimer=0)}this.position.copy(this.body.position)}}},{key:"armBreakingThings",value:function(t){if(!this.armBody.createAnimStarted){var e=this.prevPos.distanceTo(this.body.position);this.prevPos.copy(this.body.position);var i=Math.abs(this.vehicle.getWheelSpeed(0));if(!(i>1&&e>.3)&&!(e<.3&&i>1)&&e<.3&&i<1)for(var n=0;n0){var d=c[0];i.copy(d.point);for(var p=new r.Vec3,f=-100,m=999999,g=l;g>=0;g--){h.shapes[g];var v=h.shapeOffsets[g];h.pointToWorldFrame(v,p);var y=p.distanceTo(i);m>y&&(m=y,f=g)}var x=new r.Vec3;this.armBody.pointToWorldFrame(this.armBody.shapeOffsets[f],x);var w=function(t){var e=t.bodyShapeList[t.bodyShapeList.length-1];if(!e)return null;var i=e.offsetman.clone(),n=new r.Vec3;return h.pointToWorldFrame(i,n),n},b=w(this.armBack),A=w(this.armFront);if(null!==b||null!==A){var T=(b?b.distanceTo(i):99999)<(A?A.distanceTo(i):99999)?this.armBack:this.armFront;this.lastArm===T&&this.doneman||(this.lastArm=T,a.a.destroyArm(T,this.armBody,.5),app.playSfx("Break_Leg"),this.doneman=!0,s.a.vibrateFeedback(200),this.prevTimeout&&clearTimeout(this.prevTimeout),this.prevTimeout=setTimeout(this.setDoneman,500))}}}},{key:"setDoneman",value:function(){this.doneman=!1}},{key:"updateProgress",value:function(t){if(this.body&&this.canStart){var e=this.body.position.x/(this.currentLevelPlatform.getFinishPos().x-0);e!==this.curPerc&&(this.curPerc=e,l.a.progress.updateProgression(t,e))}}},{key:"createArms",value:function(t,e){}},{key:"checkDied",value:function(){this.position.y0&&void 0!==arguments[0]?arguments[0]:4e3,i=this.armFront.scale.clone(),r=this.armBack.scale.clone(),o=function(t){var e=new n.Object3D;return t.parent.add(e),e.add(t),e},a=o(this.armFront),h=o(this.armBack);s.a.phaserScene.tweens.addCounter({from:1,to:0,duration:e,ease:Phaser.Math.Easing.Linear,onUpdate:function(e){var n=e.getValue();t.armFront.scale.copy(i),t.armBack.scale.copy(r),a.scale.setScalar(1),a.scale.multiplyScalar(n),h.scale.setScalar(1),h.scale.multiplyScalar(n),a.position.z=a.children[0].geometry.curTranslate.z*(1-n),h.position.z=h.children[0].geometry.curTranslate.z*(1-n),n>.99&&t.armBody.collisionResponse},onComplete:function(){t.armFront.visible=!1,t.armBack.visible=!1,t.armBody.collisionResponse=!1}})}},{key:"onWaterTouched",value:function(t){this.waterTouched=!0,this.waterMesh=t,this.onWaterAction()}},{key:"onWaterAction",value:function(){var t=this.waterMesh.box3d;t.containsPoint(this.position)?(this.insideWater=!0,this.body.velocity.y+=10,this.body.velocity.x<2&&(this.body.velocity.x+=10),this.vehicle.setWheelForce(.8*this.maxForce,0)):this.insideWater=!1,t.max.x0&&void 0!==arguments[0]?arguments[0]:1,e=h.a.createBodyFromObj(this.mesh,{mass:t,addToWorld:!1});return e.linearDamping=.9,e.angularDamping=1,e.fixedRotation=!0,this.vehicle=new n.RigidVehicle({chassisBody:e}),this.body=e,this.vehicle}},{key:"createArmCenterBody",value:function(){var t=this;this.armBody=new n.Body({shape:new n.Box(new n.Vec3(.1,.1,.1)),mass:.1,type:n.Body.DYNAMIC}),this.armBody.shapes[0].collisionResponse=!1,this.armBody.fixedRotation=!0,this.armBody.position.copy(this.position),this.armBody.material=s.a.kontakMaterials.normal,this.armBody.addEventListener("collide",(function(e){e.body.colType&&e.body.master&&e.body.master.onTouch(t)}))}},{key:"removeArms",value:function(){this.armFront&&(this.remove(this.armFront),this.remove(this.armBack),this.vehicle.removeFromWorld(a.a.world),a.a.world.removeBody(this.vehicle.chassisBody),this.vehicle.constraints=[],this.vehicle.wheelAxes=[],this.vehicle.wheelBodies=[],this.vehicle.wheelForces=[])}},{key:"pointerUp",value:function(t){var e,i=this,h=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],u=new n.Vec3,c=new n.Vec3;this.armBody&&c.copy(this.armBody.velocity),this.body&&(u.copy(this.body.velocity),this.removeArms()),this.createMainBody(this.mainBodyMass),this.dummyArms=!1,this.body.velocity.copy(u),e=h?this.translatePointsToWorld(t):t;var d,p=new n.Body({mass:this.armBodyMass,angularDamping:this.armDamping,material:s.a.kontakMaterials.normal});p.velocity.copy(c),p.addEventListener("collide",(function(t){t.body.colType&&(t.body.master&&t.body.master.onTouch(i),t.body.colType===s.a.colTypes.PLATFORM&&i.lastJumpMode&&(i.armBody.collisionResponse=!1))})),this.isPlayer&&(r.a.footstepEvent&&a.a.world.removeEventListener("beginContact",r.a.footstepEvent),r.a.footstepEvent=function(t){l.a.gameEnded||t.bodyB===p&&(t.bodyA.colType!==s.a.colTypes.PLATFORM&&t.bodyB.colType!==s.a.colTypes.OBSTACLE||d||(d=app.playSfx("Footstep"),r.a.phaserScene.time.delayedCall(200,(function(){d=null}))))},a.a.world.addEventListener("beginContact",r.a.footstepEvent)),this.armFront=o.a.createMesh(p,e,!1,r.a.data.playerArmColor),this.armBack=o.a.createMesh(p,e,!0,r.a.data.playerArmColor),this.armBody=p,this.armBody.isArms=!0,this.add(this.armFront),this.add(this.armBack),this.armCreated||(this.armCreated=!0),this.vehicle.addWheel({body:p,position:new n.Vec3(0,0,0),axis:new n.Vec3(0,0,1),direction:new n.Vec3(1,0,0)}),this.body.type=n.Body.DYNAMIC,this.body.updateMassProperties(),this.body.updateSolveMassProperties(),this.body.wakeUp(),this.armBody.type=n.Body.DYNAMIC,this.armBody.wakeUp(),this.vehicle.addToWorld(a.a.world);var f=this.maxSpeed,m=this.maxForce;this.vehicle.setMotorSpeed(f,0),this.vehicle.setWheelForce(m,0),o.a.animateMesh(this.armFront.pointList,this.armFront,!1,this.armBody).then((function(){i.drawingCount++})),o.a.animateMesh(this.armBack.pointList,this.armBack,!0,this.armBody)}}])&&d(e.prototype,i),u&&d(e,u),Object.defineProperty(e,"prototype",{writable:!1}),m}(u.a)},function(t,e,i){"use strict";i.d(e,"a",(function(){return u}));var n=i(1),r=i(8),s=i(5),o=i(4);function a(t,e){for(var i=0;i{if(o)return;const{userAgent:t,platform:e,maxTouchPoints:i}=window.navigator,n=/(iphone|ipod|ipad)/i.test(t),r="iPad"===e||"MacIntel"===e&&i>0&&!window.MSStream;return{isIpad:r,isMobile:/android/i.test(t)||n||r,isSafari12:/Version\/12.+Safari/.test(t)}})();const h=[],l=[];function u(t,e){if(t===e)return 0;const i=t;t.length>e.length&&(t=e,e=i);let n=t.length,r=e.length;for(;n>0&&t.charCodeAt(~-n)===e.charCodeAt(~-r);)n--,r--;let s,o=0;for(;oc?u>c?c+1:u:u>a?a+1:u;return c}function c(t){return null!=t}class d extends Error{constructor(t){super(t),Object.setPrototypeOf(this,new.target.prototype)}}const p=({mobileTiers:t=[0,15,30,60],desktopTiers:e=[0,15,30,60],override:i={},glContext:h,failIfMajorPerformanceCaveat:l=!1,benchmarksURL:p="https://unpkg.com/detect-gpu@4.0.22/dist/benchmarks"}={})=>n(void 0,void 0,void 0,(function*(){const f={};if(o)return{tier:0,type:"SSR"};const{isIpad:m=!!(null==a?void 0:a.isIpad),isMobile:g=!!(null==a?void 0:a.isMobile),screenSize:v=window.screen,loadBenchmarks:y=(t=>n(void 0,void 0,void 0,(function*(){const e=yield fetch(`${p}/${t}`).then(t=>t.json());if(parseInt(e.shift().split(".")[0],10)<4)throw new d("Detect GPU benchmark data is out of date. Please update to version 4x");return e})))}=i;let{renderer:x}=i;const w=(t,e,i,n,r)=>({device:r,fps:n,gpu:i,isMobile:g,tier:t,type:e});let b,A="";if(x)x=s(x),b=[x];else{const t=h||function(t,e=!1){const i={alpha:!1,antialias:!1,depth:!1,failIfMajorPerformanceCaveat:e,powerPreference:"high-performance",stencil:!1};t&&delete i.powerPreference;const n=window.document.createElement("canvas"),r=n.getContext("webgl",i)||n.getContext("experimental-webgl",i);return null!=r?r:void 0}(null==a?void 0:a.isSafari12,l);if(!t)return w(0,"WEBGL_UNSUPPORTED");const e=t.getExtension("WEBGL_debug_renderer_info");if(e&&(x=t.getParameter(e.UNMASKED_RENDERER_WEBGL)),!x)return w(1,"FALLBACK");A=x,x=s(x),b=function(t,e,i){return"apple gpu"===e?function(t,e,i){if(!i)return[e];const n=function(t){const e=t.createShader(35633),i=t.createShader(35632),n=t.createProgram();if(!(i&&e&&n))return;t.shaderSource(e,"\n precision highp float;\n attribute vec3 aPosition;\n varying float vvv;\n void main() {\n vvv = 0.31622776601683794;\n gl_Position = vec4(aPosition, 1.0);\n }\n "),t.shaderSource(i,"\n precision highp float;\n varying float vvv;\n void main() {\n vec4 enc = vec4(1.0, 255.0, 65025.0, 16581375.0) * vvv;\n enc = fract(enc);\n enc -= enc.yzww * vec4(1.0 / 255.0, 1.0 / 255.0, 1.0 / 255.0, 0.0);\n gl_FragColor = enc;\n }\n "),t.compileShader(e),t.compileShader(i),t.attachShader(n,e),t.attachShader(n,i),t.linkProgram(n),t.detachShader(n,e),t.detachShader(n,i),t.deleteShader(e),t.deleteShader(i),t.useProgram(n);const r=t.createBuffer();t.bindBuffer(34962,r),t.bufferData(34962,new Float32Array([-1,-1,0,3,-1,0,-1,3,0]),35044);const s=t.getAttribLocation(n,"aPosition");t.vertexAttribPointer(s,3,5126,!1,0,0),t.enableVertexAttribArray(s),t.clearColor(1,1,1,1),t.clear(16384),t.viewport(0,0,1,1),t.drawArrays(4,0,3);const o=new Uint8Array(4);return t.readPixels(0,0,1,1,6408,5121,o),t.deleteProgram(n),t.deleteBuffer(r),o.join("")}(t),r="801621810",s="8016218135",o="80162181161",h=(null==a?void 0:a.isIpad)?[["a7",o,12],["a8",s,15],["a8x",s,15],["a9",s,15],["a9x",s,15],["a10",s,15],["a10x",s,15],["a12",r,15],["a12x",r,15],["a12z",r,15],["a14",r,15],["m1",r,15]]:[["a7",o,12],["a8",s,12],["a9",s,15],["a10",s,15],["a11",r,15],["a12",r,15],["a13",r,15],["a14",r,15]];let l;return"80162181255"===n?l=h.filter(([,,t])=>t>=14):(l=h.filter(([,t])=>t===n),l.length||(l=h)),l.map(([t])=>`apple ${t} gpu`)}(t,e,i):[e]}(t,x,g)}const T=(yield Promise.all(b.map(t=>n(void 0,void 0,void 0,(function*(){var e;const i=(t=>{const e=g?["adreno","apple","mali-t","mali","nvidia","powervr"]:["intel","apple","amd","radeon","nvidia","geforce"];for(const i of e)if(t.includes(i))return i})(t);if(!i)return;const n=`${g?"m":"d"}-${i}${m?"-ipad":""}.json`,r=f[n]=null!==(e=f[n])&&void 0!==e?e:y(n);let s;try{s=yield r}catch(e){if(e instanceof d)throw e;return}const o=function(t){var e;const i=(t=t.replace(/\([^)]+\)/,"")).match(/\d+/)||t.match(/(\W|^)([A-Za-z]{1,3})(\W|$)/g);return null!==(e=null==i?void 0:i.join("").replace(/\W|amd/g,""))&&void 0!==e?e:""}(t);let a=s.filter(([,t])=>t===o);a.length||(a=s.filter(([e])=>e.includes(t)));const h=a.length;if(0===h)return;let l,[c,,,p]=h>1?a.map(e=>[e,u(t,e[0])]).sort(([,t],[,e])=>t-e)[0][0]:a[0],x=Number.MAX_VALUE;const{devicePixelRatio:w}=window,b=v.width*w*v.height*w;for(const t of p){const[e,i]=t,n=e*i,r=Math.abs(b-n);rt===i?e-n:t-i);if(!T.length){const t=r.find(t=>x.includes(t));return t?w(0,"BLOCKLISTED",t):w(1,"FALLBACK",`${x} (${A})`)}const[,S,E,M]=T[0];if(-1===S)return w(0,"BLOCKLISTED",E,S,M);const _=g?t:e;let C=0;for(let t=0;t<_.length;t++)S>=_[t]&&(C=t);return w(C,"BENCHMARK",E,S,M)}))},function(t,e,i){"use strict";var n=i(0);function r(t,e){var i="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!i){if(Array.isArray(t)||(i=function(t,e){if(!t)return;if("string"==typeof t)return s(t,e);var i=Object.prototype.toString.call(t).slice(8,-1);"Object"===i&&t.constructor&&(i=t.constructor.name);if("Map"===i||"Set"===i)return Array.from(t);if("Arguments"===i||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i))return s(t,e)}(t))||e&&t&&"number"==typeof t.length){i&&(t=i);var n=0,r=function(){};return{s:r,n:function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(t){throw t},f:r}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,a=!0,h=!1;return{s:function(){i=i.call(t)},n:function(){var t=i.next();return a=t.done,t},e:function(t){h=!0,o=t},f:function(){try{a||null==i.return||i.return()}finally{if(h)throw o}}}}function s(t,e){(null==e||e>t.length)&&(e=t.length);for(var i=0,n=new Array(e);i1&&void 0!==arguments[1])||arguments[1],i=arguments.length>2?arguments[2]:void 0,n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:1,s={antialias:!0,alpha:!0,preserveDrawingBuffer:!0},o=app.main,a=new THREE.Scene,h=new THREE.WebGLRenderer(s);h.outputEncoding=o.renderer.outputEncoding,h.gammaFactor=o.renderer.gammaFactor,h.setClearColor(0,0);var l=t;if(l){if(e)for(var u=0;u=0&&l.push(c)}}else l=o.scene.children.concat();var d,p=r(l);try{for(p.s();!(d=p.n()).done;){var f=d.value;a.add(f.clone())}}catch(t){p.e(t)}finally{p.f()}function m(t,e){var i=1/n;t.setAttribute("style"," -ms-transform: scale("+i+"); -webkit-transform: scale3d("+i+", 1); -moz-transform: scale("+i+"); -o-transform: scale("+i+"); transform: scale("+i+"); transform-origin: top left;");var r=window.innerWidth,s=window.innerHeight;document.body.style.maxWidth=r+"px",document.body.style.maxHeight=s+"px";var o=(r*=n)+"px",a=(s*=n)+"px";t.style.maxWidth=o,t.style.maxHeight=a,t.style.width=o,t.style.height=a,e.setSize(r,s)}m(h.domElement,h);var g=o.camera,v=g.position.clone();i&&g.position.copy(i),h.render(a,g);for(var y=h.domElement.toDataURL(),x=a.children.length-1;x>=0;x--)a.remove(a.children[x]);return g.position.copy(v),y}},{key:"addTrail",value:function(t,e){var i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"#000000",n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:1,r=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0,s=arguments.length>5&&void 0!==arguments[5]?arguments[5]:60,o=app.main.scene,a=new THREE.TrailRenderer(o,!0),h=THREE.TrailRenderer.createBaseMaterial(),l=new THREE.Color(i);return h.uniforms.headColor.value.set(l.r,l.g,l.b,n),h.uniforms.tailColor.value.set(l.r,l.g,l.b,r),a.initialize(h,s,!1,0,e,t),a.activate(),a}}],(i=[{key:"addSimpleOutline",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:.02,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,n=[];t.traverse((function(t){t.material&&n.push(t)})),n.forEach((function(t){var n=t.clone();t.parent.add(n),n.material=new MeshLambertMaterial({color:i,side:THREE.BackSide}),n.material.onBeforeCompile=function(t){var i="\n vec3 transformed = position + objectNormal*".concat(e,";\n ");t.vertexShader=t.vertexShader.replace("#include ",i)}}))}}])&&o(e.prototype,i),s&&o(e,s),Object.defineProperty(e,"prototype",{writable:!1}),t}();e.a=a},function(t,e,i){"use strict";i.d(e,"a",(function(){return f}));var n=i(0),r=i(1),s=i(6),o=i(3);function a(t){return(a="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function h(t,e){for(var i=0;ie.position.x&&(e=n)}this.currentMaster?this.currentMaster!==e&&this.swapToChar(e,this.yPos):this.spawnOrDie(e,!0)}},{key:"spawnOrDie",value:function(t,e){s.a.moveToScene(this),t.attach(this),this.position.copy(t.position),this.position.y=this.yPos;var i=1;e||(i=.001),r.a.phaserScene.tweens.add({targets:this.scale,x:i,y:i,z:i,duration:500,ease:Phaser.Math.Easing.Back.Out}),this.currentMaster=t}},{key:"swapToChar",value:function(t,e){s.a.moveToScene(this),t.attach(this),this.moveTween&&this.moveTween.remove(),this.moveTween=r.a.phaserScene.tweens.add({targets:this.position,x:0,y:this.yPos,z:0,duration:500,ease:Phaser.Math.Easing.Quadratic.Out}),this.currentMaster=t}}])&&h(e.prototype,i),n&&h(e,n),Object.defineProperty(e,"prototype",{writable:!1}),c}(n.Object3D)},function(t,e,i){"use strict";i.d(e,"a",(function(){return c}));var n=i(0),r=i(1),s=i(21),o=(i(8),i(26));function a(t,e){var i="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!i){if(Array.isArray(t)||(i=function(t,e){if(!t)return;if("string"==typeof t)return h(t,e);var i=Object.prototype.toString.call(t).slice(8,-1);"Object"===i&&t.constructor&&(i=t.constructor.name);if("Map"===i||"Set"===i)return Array.from(t);if("Arguments"===i||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i))return h(t,e)}(t))||e&&t&&"number"==typeof t.length){i&&(t=i);var n=0,r=function(){};return{s:r,n:function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(t){throw t},f:r}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var s,o=!0,a=!1;return{s:function(){i=i.call(t)},n:function(){var t=i.next();return o=t.done,t},e:function(t){a=!0,s=t},f:function(){try{o||null==i.return||i.return()}finally{if(a)throw s}}}}function h(t,e){(null==e||e>t.length)&&(e=t.length);for(var i=0,n=new Array(e);i0&&void 0!==arguments[0]?arguments[0]:{},i=e.renderer,r=e.camera;e.dirLight,e.ambientLight;l(this,t);var o=document.createElement("canvas");document.body.append(o),o.style.zIndex=300,o.style.transformOrigin="left top";var a=new n.Scene;this.canvas=o,this.context=o.getContext("2d"),this.canvas.style.pointerEvents="none",this.scene=a,this.renderer=i,this.camera=r.clone(),this.camera.position.set(0,0,10),this.camera.lookAt(a.position),this.dirLight=new n.DirectionalLight(16777215,.5),this.ambientLight=new n.AmbientLight(16777215,.5),this.dirLight.intensity=5.7,this.dirLight.position.set(41,66,-35),this.ambientLight.intensity=1.6,this.scene.add(this.dirLight),this.scene.add(this.ambientLight),this.toucher=new s.a(this.camera,new n.Vector3(0,0,-1)),this.addCoins()}var e,i,h;return e=t,(i=[{key:"addCoins",value:function(){for(var t=new n.Object3D,e=[],i=0;i<20;i++){var s=r.a.cloneAsset("coinSolo",1);s.position.set(n.MathUtils.randFloatSpread(4),n.MathUtils.randFloatSpread(4),n.MathUtils.randFloatSpread(1)),s.rotation.set(n.MathUtils.randFloatSpread(Math.PI),n.MathUtils.randFloatSpread(Math.PI),n.MathUtils.randFloatSpread(Math.PI)),s.scale.z*=2,s.orgSkal=s.scale.clone(),t.add(s),e.push(s)}this.coinList=e,this.coinContainer=t,this.scene.add(t),this.scene.visible=!1,this.scene.skipHack=!0,this.time=0}},{key:"resetCoins",value:function(){for(var t=0;ts+a&&(r.a.playerData.coin=s+a),o.a.coinBar.addCoinWithAnim(r.a.playerData.coin),n++,r.a.vibrateFeedback(100),app.playSfx("Coin"),n===e.coinList.length&&(r.a.playerData.coin=s+a,e.scene.visible=!1,e.context.clearRect(0,0,e.canvas.width,e.canvas.height),i())}})}))}))}},{key:"resize",value:function(t,e){if(this.scene.visible){this.canvas.width=t,this.canvas.height=e,this.canvas.style.transform=this.renderer.domElement.style.transform;var i=t/e;this.camera.aspect=i,this.camera.updateProjectionMatrix()}}},{key:"update",value:function(t){if(this.scene.visible){this.time+=t,this.time;var e,i=a(this.coinList);try{for(i.s();!(e=i.n()).done;)e.value.rotation.y+=2*Math.PI*t}catch(t){i.e(t)}finally{i.f()}this.renderer.autoClear=!1,this.useSameCanvas?(this.renderer.clearDepth(),this.renderer.render(this.scene,this.camera),this.renderer.clearDepth()):this.time>0&&(this.context.clearRect(0,0,this.canvas.width,this.canvas.height),this.renderer.render(this.scene,this.camera),this.context.drawImage(this.renderer.domElement,0,0,this.canvas.width,this.canvas.height,0,0,this.canvas.width,this.canvas.height),this.time=0)}}}])&&u(e.prototype,i),h&&u(e,h),Object.defineProperty(e,"prototype",{writable:!1}),t}()},function(t){t.exports=JSON.parse('[{"name":"sprite1","x":2,"y":12,"width":60,"height":40},{"name":"sprite2","x":66,"y":12,"width":60,"height":40},{"name":"sprite3","x":130,"y":12,"width":60,"height":40},{"name":"sprite4","x":194,"y":12,"width":60,"height":40},{"name":"sprite5","x":258,"y":12,"width":60,"height":40},{"name":"sprite6","x":322,"y":12,"width":60,"height":40},{"name":"sprite7","x":386,"y":12,"width":60,"height":40},{"name":"sprite8","x":450,"y":12,"width":60,"height":40},{"name":"sprite9","x":514,"y":12,"width":60,"height":40},{"name":"sprite10","x":578,"y":12,"width":60,"height":40},{"name":"sprite11","x":642,"y":12,"width":60,"height":40},{"name":"sprite12","x":706,"y":12,"width":60,"height":40},{"name":"sprite13","x":770,"y":12,"width":60,"height":40},{"name":"sprite14","x":834,"y":12,"width":60,"height":40},{"name":"sprite15","x":898,"y":12,"width":60,"height":40},{"name":"sprite16","x":962,"y":12,"width":60,"height":40},{"name":"sprite17","x":2,"y":76,"width":60,"height":40},{"name":"sprite18","x":66,"y":76,"width":60,"height":40},{"name":"sprite19","x":130,"y":76,"width":60,"height":40},{"name":"sprite20","x":194,"y":76,"width":60,"height":40},{"name":"sprite21","x":258,"y":76,"width":60,"height":40},{"name":"sprite22","x":322,"y":76,"width":60,"height":40},{"name":"sprite23","x":386,"y":76,"width":60,"height":40},{"name":"sprite24","x":450,"y":76,"width":60,"height":40},{"name":"sprite25","x":514,"y":76,"width":60,"height":40},{"name":"sprite26","x":578,"y":76,"width":60,"height":40},{"name":"sprite27","x":642,"y":76,"width":60,"height":40},{"name":"sprite28","x":706,"y":76,"width":60,"height":40},{"name":"sprite29","x":770,"y":76,"width":60,"height":40},{"name":"sprite30","x":834,"y":76,"width":60,"height":40},{"name":"sprite31","x":898,"y":76,"width":60,"height":40},{"name":"sprite32","x":962,"y":76,"width":60,"height":40},{"name":"sprite33","x":2,"y":140,"width":60,"height":40},{"name":"sprite34","x":66,"y":140,"width":60,"height":40},{"name":"sprite35","x":130,"y":140,"width":60,"height":40},{"name":"sprite36","x":194,"y":140,"width":60,"height":40},{"name":"sprite37","x":258,"y":140,"width":60,"height":40},{"name":"sprite38","x":322,"y":140,"width":60,"height":40},{"name":"sprite39","x":386,"y":140,"width":60,"height":40},{"name":"sprite40","x":450,"y":140,"width":60,"height":40},{"name":"sprite41","x":514,"y":140,"width":60,"height":40},{"name":"sprite42","x":588,"y":140,"width":40,"height":40},{"name":"sprite43","x":642,"y":140,"width":60,"height":40},{"name":"sprite44","x":706,"y":140,"width":60,"height":40},{"name":"sprite45","x":770,"y":140,"width":60,"height":40},{"name":"sprite46","x":834,"y":140,"width":60,"height":40},{"name":"sprite47","x":898,"y":140,"width":60,"height":40},{"name":"sprite48","x":962,"y":140,"width":60,"height":40},{"name":"sprite49","x":2,"y":204,"width":60,"height":40},{"name":"sprite50","x":66,"y":204,"width":60,"height":40},{"name":"sprite51","x":130,"y":204,"width":60,"height":40},{"name":"sprite52","x":194,"y":204,"width":60,"height":40},{"name":"sprite53","x":258,"y":204,"width":60,"height":40},{"name":"sprite54","x":322,"y":204,"width":60,"height":40},{"name":"sprite55","x":386,"y":204,"width":60,"height":40},{"name":"sprite56","x":450,"y":204,"width":60,"height":40},{"name":"sprite57","x":514,"y":204,"width":60,"height":40},{"name":"sprite58","x":578,"y":204,"width":60,"height":40},{"name":"sprite59","x":642,"y":204,"width":60,"height":40},{"name":"sprite60","x":706,"y":204,"width":60,"height":40},{"name":"sprite61","x":770,"y":204,"width":60,"height":40},{"name":"sprite62","x":834,"y":204,"width":60,"height":40},{"name":"sprite63","x":898,"y":204,"width":60,"height":40},{"name":"sprite64","x":962,"y":204,"width":60,"height":40},{"name":"sprite65","x":2,"y":268,"width":60,"height":40},{"name":"sprite66","x":66,"y":268,"width":60,"height":40},{"name":"sprite67","x":130,"y":268,"width":60,"height":40},{"name":"sprite68","x":194,"y":268,"width":60,"height":40},{"name":"sprite69","x":258,"y":268,"width":60,"height":40},{"name":"sprite70","x":322,"y":268,"width":60,"height":40},{"name":"sprite71","x":386,"y":268,"width":60,"height":40},{"name":"sprite72","x":450,"y":268,"width":60,"height":40},{"name":"sprite73","x":514,"y":268,"width":60,"height":40},{"name":"sprite74","x":578,"y":268,"width":60,"height":40},{"name":"sprite75","x":642,"y":268,"width":60,"height":40},{"name":"sprite76","x":706,"y":268,"width":60,"height":40},{"name":"sprite77","x":770,"y":268,"width":60,"height":40},{"name":"sprite78","x":834,"y":268,"width":60,"height":40},{"name":"sprite79","x":898,"y":268,"width":60,"height":40},{"name":"sprite80","x":962,"y":268,"width":60,"height":40},{"name":"sprite81","x":2,"y":332,"width":60,"height":40},{"name":"sprite82","x":66,"y":332,"width":60,"height":40},{"name":"sprite83","x":130,"y":332,"width":60,"height":40},{"name":"sprite84","x":194,"y":332,"width":60,"height":40},{"name":"sprite85","x":258,"y":332,"width":60,"height":40},{"name":"sprite86","x":322,"y":332,"width":60,"height":40},{"name":"sprite87","x":386,"y":332,"width":60,"height":40},{"name":"sprite88","x":450,"y":332,"width":60,"height":40},{"name":"sprite89","x":514,"y":332,"width":60,"height":40},{"name":"sprite90","x":578,"y":332,"width":60,"height":40},{"name":"sprite91","x":642,"y":332,"width":60,"height":40},{"name":"sprite92","x":706,"y":332,"width":60,"height":40},{"name":"sprite93","x":770,"y":332,"width":60,"height":40},{"name":"sprite94","x":834,"y":332,"width":60,"height":40},{"name":"sprite95","x":898,"y":332,"width":60,"height":40},{"name":"sprite96","x":962,"y":332,"width":60,"height":40},{"name":"sprite97","x":2,"y":396,"width":60,"height":40},{"name":"sprite98","x":66,"y":396,"width":60,"height":40},{"name":"sprite99","x":130,"y":396,"width":60,"height":40},{"name":"sprite100","x":194,"y":396,"width":60,"height":40},{"name":"sprite101","x":258,"y":396,"width":60,"height":40},{"name":"sprite102","x":322,"y":396,"width":60,"height":40},{"name":"sprite103","x":386,"y":396,"width":60,"height":40},{"name":"sprite104","x":450,"y":396,"width":60,"height":40},{"name":"sprite105","x":514,"y":396,"width":60,"height":40},{"name":"sprite106","x":578,"y":396,"width":60,"height":40},{"name":"sprite107","x":642,"y":396,"width":60,"height":40},{"name":"sprite108","x":706,"y":396,"width":60,"height":40},{"name":"sprite109","x":770,"y":396,"width":60,"height":40},{"name":"sprite110","x":834,"y":396,"width":60,"height":40},{"name":"sprite111","x":898,"y":396,"width":60,"height":40},{"name":"sprite112","x":962,"y":396,"width":60,"height":40},{"name":"sprite113","x":2,"y":460,"width":60,"height":40},{"name":"sprite114","x":66,"y":460,"width":60,"height":40},{"name":"sprite115","x":130,"y":460,"width":60,"height":40},{"name":"sprite116","x":194,"y":460,"width":60,"height":40},{"name":"sprite117","x":258,"y":460,"width":60,"height":40},{"name":"sprite118","x":322,"y":460,"width":60,"height":40},{"name":"sprite119","x":386,"y":460,"width":60,"height":40},{"name":"sprite120","x":450,"y":460,"width":60,"height":40},{"name":"sprite121","x":514,"y":460,"width":60,"height":40},{"name":"sprite122","x":578,"y":460,"width":60,"height":40},{"name":"sprite123","x":642,"y":460,"width":60,"height":40},{"name":"sprite124","x":706,"y":460,"width":60,"height":40},{"name":"sprite125","x":770,"y":460,"width":60,"height":40},{"name":"sprite126","x":834,"y":460,"width":60,"height":40},{"name":"sprite127","x":898,"y":460,"width":60,"height":40},{"name":"sprite128","x":962,"y":460,"width":60,"height":40},{"name":"sprite129","x":2,"y":524,"width":60,"height":40},{"name":"sprite130","x":66,"y":524,"width":60,"height":40},{"name":"sprite131","x":130,"y":524,"width":60,"height":40},{"name":"sprite132","x":194,"y":524,"width":60,"height":40},{"name":"sprite133","x":258,"y":524,"width":60,"height":40},{"name":"sprite134","x":322,"y":524,"width":60,"height":40},{"name":"sprite135","x":386,"y":524,"width":60,"height":40},{"name":"sprite136","x":450,"y":524,"width":60,"height":40},{"name":"sprite137","x":514,"y":524,"width":60,"height":40},{"name":"sprite138","x":578,"y":524,"width":60,"height":40},{"name":"sprite139","x":642,"y":524,"width":60,"height":40},{"name":"sprite140","x":706,"y":524,"width":60,"height":40},{"name":"sprite141","x":770,"y":524,"width":60,"height":40},{"name":"sprite142","x":834,"y":524,"width":60,"height":40},{"name":"sprite143","x":898,"y":524,"width":60,"height":40},{"name":"sprite144","x":962,"y":524,"width":60,"height":40},{"name":"sprite145","x":2,"y":588,"width":60,"height":40},{"name":"sprite146","x":66,"y":588,"width":60,"height":40},{"name":"sprite147","x":130,"y":588,"width":60,"height":40},{"name":"sprite148","x":194,"y":588,"width":60,"height":40},{"name":"sprite149","x":258,"y":588,"width":60,"height":40},{"name":"sprite150","x":322,"y":588,"width":60,"height":40},{"name":"sprite151","x":386,"y":588,"width":60,"height":40},{"name":"sprite152","x":450,"y":588,"width":60,"height":40},{"name":"sprite153","x":514,"y":588,"width":60,"height":40},{"name":"sprite154","x":578,"y":588,"width":60,"height":40},{"name":"sprite155","x":642,"y":588,"width":60,"height":40},{"name":"sprite156","x":706,"y":588,"width":60,"height":40},{"name":"sprite157","x":770,"y":588,"width":60,"height":40},{"name":"sprite158","x":834,"y":588,"width":60,"height":40},{"name":"sprite159","x":898,"y":588,"width":60,"height":40},{"name":"sprite160","x":962,"y":588,"width":60,"height":40},{"name":"sprite161","x":266,"y":645,"width":44,"height":54},{"name":"sprite162","x":2,"y":652,"width":60,"height":40},{"name":"sprite163","x":66,"y":652,"width":60,"height":40},{"name":"sprite164","x":130,"y":652,"width":60,"height":40},{"name":"sprite165","x":194,"y":652,"width":60,"height":40},{"name":"sprite166","x":322,"y":652,"width":60,"height":40},{"name":"sprite167","x":386,"y":652,"width":60,"height":40},{"name":"sprite168","x":450,"y":652,"width":60,"height":40},{"name":"sprite169","x":514,"y":652,"width":60,"height":40},{"name":"sprite170","x":578,"y":652,"width":60,"height":40},{"name":"sprite171","x":642,"y":652,"width":60,"height":40},{"name":"sprite172","x":706,"y":652,"width":60,"height":40},{"name":"sprite173","x":770,"y":652,"width":60,"height":40},{"name":"sprite174","x":834,"y":652,"width":60,"height":40},{"name":"sprite175","x":898,"y":652,"width":60,"height":40},{"name":"sprite176","x":962,"y":652,"width":60,"height":40},{"name":"sprite177","x":2,"y":716,"width":60,"height":40},{"name":"sprite178","x":66,"y":716,"width":60,"height":40},{"name":"sprite179","x":130,"y":716,"width":60,"height":40},{"name":"sprite180","x":194,"y":716,"width":60,"height":40},{"name":"sprite181","x":258,"y":716,"width":60,"height":40},{"name":"sprite182","x":322,"y":716,"width":60,"height":40},{"name":"sprite183","x":386,"y":716,"width":60,"height":40},{"name":"sprite184","x":450,"y":716,"width":60,"height":40},{"name":"sprite185","x":514,"y":716,"width":60,"height":40},{"name":"sprite186","x":578,"y":716,"width":60,"height":40},{"name":"sprite187","x":642,"y":716,"width":60,"height":40},{"name":"sprite188","x":706,"y":716,"width":60,"height":40},{"name":"sprite189","x":770,"y":716,"width":60,"height":40},{"name":"sprite190","x":834,"y":716,"width":60,"height":40},{"name":"sprite191","x":898,"y":716,"width":60,"height":40},{"name":"sprite192","x":962,"y":716,"width":60,"height":40},{"name":"sprite193","x":2,"y":780,"width":60,"height":40},{"name":"sprite194","x":66,"y":780,"width":60,"height":40},{"name":"sprite195","x":130,"y":780,"width":60,"height":40},{"name":"sprite196","x":194,"y":780,"width":60,"height":40},{"name":"sprite197","x":258,"y":780,"width":60,"height":40},{"name":"sprite198","x":322,"y":780,"width":60,"height":40},{"name":"sprite199","x":386,"y":780,"width":60,"height":40},{"name":"sprite200","x":450,"y":780,"width":60,"height":40},{"name":"sprite201","x":514,"y":780,"width":60,"height":40},{"name":"sprite202","x":578,"y":780,"width":60,"height":40},{"name":"sprite203","x":642,"y":780,"width":60,"height":40},{"name":"sprite204","x":706,"y":780,"width":60,"height":40},{"name":"sprite205","x":770,"y":780,"width":60,"height":40},{"name":"sprite206","x":834,"y":780,"width":60,"height":40},{"name":"sprite207","x":898,"y":780,"width":60,"height":40},{"name":"sprite208","x":962,"y":780,"width":60,"height":40},{"name":"sprite209","x":2,"y":844,"width":60,"height":40},{"name":"sprite210","x":66,"y":844,"width":60,"height":40},{"name":"sprite211","x":130,"y":844,"width":60,"height":40},{"name":"sprite212","x":194,"y":844,"width":60,"height":40},{"name":"sprite213","x":258,"y":844,"width":60,"height":40},{"name":"sprite214","x":322,"y":844,"width":60,"height":40},{"name":"sprite215","x":386,"y":844,"width":60,"height":40},{"name":"sprite216","x":450,"y":844,"width":60,"height":40},{"name":"sprite217","x":514,"y":844,"width":60,"height":40},{"name":"sprite218","x":578,"y":844,"width":60,"height":40},{"name":"sprite219","x":642,"y":844,"width":60,"height":40},{"name":"sprite220","x":706,"y":844,"width":60,"height":40},{"name":"sprite221","x":770,"y":844,"width":60,"height":40},{"name":"sprite222","x":834,"y":844,"width":60,"height":40},{"name":"sprite223","x":898,"y":844,"width":60,"height":40},{"name":"sprite224","x":962,"y":844,"width":60,"height":40},{"name":"sprite225","x":2,"y":908,"width":60,"height":40},{"name":"sprite226","x":66,"y":908,"width":60,"height":40},{"name":"sprite227","x":130,"y":908,"width":60,"height":40},{"name":"sprite228","x":204,"y":908,"width":40,"height":40},{"name":"sprite229","x":258,"y":908,"width":60,"height":40},{"name":"sprite230","x":322,"y":908,"width":60,"height":40},{"name":"sprite231","x":386,"y":908,"width":60,"height":40},{"name":"sprite232","x":450,"y":908,"width":60,"height":40},{"name":"sprite233","x":514,"y":908,"width":60,"height":40},{"name":"sprite234","x":578,"y":908,"width":60,"height":40},{"name":"sprite235","x":642,"y":908,"width":60,"height":40},{"name":"sprite236","x":706,"y":908,"width":60,"height":40},{"name":"sprite237","x":770,"y":908,"width":60,"height":40},{"name":"sprite238","x":834,"y":908,"width":60,"height":40},{"name":"sprite239","x":898,"y":908,"width":60,"height":40},{"name":"sprite240","x":962,"y":908,"width":60,"height":40},{"name":"sprite241","x":2,"y":972,"width":60,"height":40}]')},function(t,e,i){(function(i){var n;!function(){"use strict";var r=function(){this.init()};r.prototype={init:function(){var t=this||s;return t._counter=1e3,t._html5AudioPool=[],t.html5PoolSize=10,t._codecs={},t._howls=[],t._muted=!1,t._volume=1,t._canPlayEvent="canplaythrough",t._navigator="undefined"!=typeof window&&window.navigator?window.navigator:null,t.masterGain=null,t.noAudio=!1,t.usingWebAudio=!0,t.autoSuspend=!0,t.ctx=null,t.autoUnlock=!0,t._setup(),t},volume:function(t){var e=this||s;if(t=parseFloat(t),e.ctx||p(),void 0!==t&&t>=0&&t<=1){if(e._volume=t,e._muted)return e;e.usingWebAudio&&e.masterGain.gain.setValueAtTime(t,s.ctx.currentTime);for(var i=0;i=0;e--)t._howls[e].unload();return t.usingWebAudio&&t.ctx&&void 0!==t.ctx.close&&(t.ctx.close(),t.ctx=null,p()),t},codecs:function(t){return(this||s)._codecs[t.replace(/^x-/,"")]},_setup:function(){var t=this||s;if(t.state=t.ctx&&t.ctx.state||"suspended",t._autoSuspend(),!t.usingWebAudio)if("undefined"!=typeof Audio)try{void 0===(new Audio).oncanplaythrough&&(t._canPlayEvent="canplay")}catch(e){t.noAudio=!0}else t.noAudio=!0;try{(new Audio).muted&&(t.noAudio=!0)}catch(t){}return t.noAudio||t._setupCodecs(),t},_setupCodecs:function(){var t=this||s,e=null;try{e="undefined"!=typeof Audio?new Audio:null}catch(e){return t}if(!e||"function"!=typeof e.canPlayType)return t;var i=e.canPlayType("audio/mpeg;").replace(/^no$/,""),n=t._navigator?t._navigator.userAgent:"",r=n.match(/OPR\/([0-6].)/g),o=r&&parseInt(r[0].split("/")[1],10)<33,a=-1!==n.indexOf("Safari")&&-1===n.indexOf("Chrome"),h=n.match(/Version\/(.*?) /),l=a&&h&&parseInt(h[1],10)<15;return t._codecs={mp3:!(o||!i&&!e.canPlayType("audio/mp3;").replace(/^no$/,"")),mpeg:!!i,opus:!!e.canPlayType('audio/ogg; codecs="opus"').replace(/^no$/,""),ogg:!!e.canPlayType('audio/ogg; codecs="vorbis"').replace(/^no$/,""),oga:!!e.canPlayType('audio/ogg; codecs="vorbis"').replace(/^no$/,""),wav:!!(e.canPlayType('audio/wav; codecs="1"')||e.canPlayType("audio/wav")).replace(/^no$/,""),aac:!!e.canPlayType("audio/aac;").replace(/^no$/,""),caf:!!e.canPlayType("audio/x-caf;").replace(/^no$/,""),m4a:!!(e.canPlayType("audio/x-m4a;")||e.canPlayType("audio/m4a;")||e.canPlayType("audio/aac;")).replace(/^no$/,""),m4b:!!(e.canPlayType("audio/x-m4b;")||e.canPlayType("audio/m4b;")||e.canPlayType("audio/aac;")).replace(/^no$/,""),mp4:!!(e.canPlayType("audio/x-mp4;")||e.canPlayType("audio/mp4;")||e.canPlayType("audio/aac;")).replace(/^no$/,""),weba:!(l||!e.canPlayType('audio/webm; codecs="vorbis"').replace(/^no$/,"")),webm:!(l||!e.canPlayType('audio/webm; codecs="vorbis"').replace(/^no$/,"")),dolby:!!e.canPlayType('audio/mp4; codecs="ec-3"').replace(/^no$/,""),flac:!!(e.canPlayType("audio/x-flac;")||e.canPlayType("audio/flac;")).replace(/^no$/,"")},t},_unlockAudio:function(){var t=this||s;if(!t._audioUnlocked&&t.ctx){t._audioUnlocked=!1,t.autoUnlock=!1,t._mobileUnloaded||44100===t.ctx.sampleRate||(t._mobileUnloaded=!0,t.unload()),t._scratchBuffer=t.ctx.createBuffer(1,1,22050);var e=function(i){for(;t._html5AudioPool.length0?a._seek:i._sprite[t][0]/1e3),u=Math.max(0,(i._sprite[t][0]+i._sprite[t][1])/1e3-l),c=1e3*u/Math.abs(a._rate),d=i._sprite[t][0]/1e3,p=(i._sprite[t][0]+i._sprite[t][1])/1e3;a._sprite=t,a._ended=!1;var f=function(){a._paused=!1,a._seek=l,a._start=d,a._stop=p,a._loop=!(!a._loop&&!i._sprite[t][2])};if(!(l>=p)){var m=a._node;if(i._webAudio){var g=function(){i._playLock=!1,f(),i._refreshBuffer(a);var t=a._muted||i._muted?0:a._volume;m.gain.setValueAtTime(t,s.ctx.currentTime),a._playStart=s.ctx.currentTime,void 0===m.bufferSource.start?a._loop?m.bufferSource.noteGrainOn(0,l,86400):m.bufferSource.noteGrainOn(0,l,u):a._loop?m.bufferSource.start(0,l,86400):m.bufferSource.start(0,l,u),c!==1/0&&(i._endTimers[a._id]=setTimeout(i._ended.bind(i,a),c)),e||setTimeout((function(){i._emit("play",a._id),i._loadQueue()}),0)};"running"===s.state&&"interrupted"!==s.ctx.state?g():(i._playLock=!0,i.once("resume",g),i._clearTimer(a._id))}else{var v=function(){m.currentTime=l,m.muted=a._muted||i._muted||s._muted||m.muted,m.volume=a._volume*s.volume(),m.playbackRate=a._rate;try{var n=m.play();if(n&&"undefined"!=typeof Promise&&(n instanceof Promise||"function"==typeof n.then)?(i._playLock=!0,f(),n.then((function(){i._playLock=!1,m._unlocked=!0,e?i._loadQueue():i._emit("play",a._id)})).catch((function(){i._playLock=!1,i._emit("playerror",a._id,"Playback was unable to start. This is most commonly an issue on mobile devices and Chrome where playback was not within a user interaction."),a._ended=!0,a._paused=!0}))):e||(i._playLock=!1,f(),i._emit("play",a._id)),m.playbackRate=a._rate,m.paused)return void i._emit("playerror",a._id,"Playback was unable to start. This is most commonly an issue on mobile devices and Chrome where playback was not within a user interaction.");"__default"!==t||a._loop?i._endTimers[a._id]=setTimeout(i._ended.bind(i,a),c):(i._endTimers[a._id]=function(){i._ended(a),m.removeEventListener("ended",i._endTimers[a._id],!1)},m.addEventListener("ended",i._endTimers[a._id],!1))}catch(t){i._emit("playerror",a._id,t)}};"data:audio/wav;base64,UklGRigAAABXQVZFZm10IBIAAAABAAEARKwAAIhYAQACABAAAABkYXRhAgAAAAEA"===m.src&&(m.src=i._src,m.load());var y=window&&window.ejecta||!m.readyState&&s._navigator.isCocoonJS;if(m.readyState>=3||y)v();else{i._playLock=!0,i._state="loading";var x=function(){i._state="loaded",v(),m.removeEventListener(s._canPlayEvent,x,!1)};m.addEventListener(s._canPlayEvent,x,!1),i._clearTimer(a._id)}}return a._id}i._ended(a)},pause:function(t){var e=this;if("loaded"!==e._state||e._playLock)return e._queue.push({event:"pause",action:function(){e.pause(t)}}),e;for(var i=e._getSoundIds(t),n=0;n=0?e=parseInt(r[0],10):t=parseFloat(r[0])}else r.length>=2&&(t=parseFloat(r[0]),e=parseInt(r[1],10));if(!(void 0!==t&&t>=0&&t<=1))return(i=e?n._soundById(e):n._sounds[0])?i._volume:0;if("loaded"!==n._state||n._playLock)return n._queue.push({event:"volume",action:function(){n.volume.apply(n,r)}}),n;void 0===e&&(n._volume=t),e=n._getSoundIds(e);for(var h=0;h0?n/l:n),c=Date.now();t._fadeTo=i,t._interval=setInterval((function(){var r=(Date.now()-c)/n;c=Date.now(),a+=h*r,a=Math.round(100*a)/100,a=h<0?Math.max(i,a):Math.min(i,a),o._webAudio?t._volume=a:o.volume(a,t._id,!0),s&&(o._volume=a),(ie&&a>=i)&&(clearInterval(t._interval),t._interval=null,t._fadeTo=null,o.volume(i,t._id),o._emit("fade",t._id))}),u)},_stopFade:function(t){var e=this._soundById(t);return e&&e._interval&&(this._webAudio&&e._node.gain.cancelScheduledValues(s.ctx.currentTime),clearInterval(e._interval),e._interval=null,this.volume(e._fadeTo,t),e._fadeTo=null,this._emit("fade",t)),this},loop:function(){var t,e,i,n=this,r=arguments;if(0===r.length)return n._loop;if(1===r.length){if("boolean"!=typeof r[0])return!!(i=n._soundById(parseInt(r[0],10)))&&i._loop;t=r[0],n._loop=t}else 2===r.length&&(t=r[0],e=parseInt(r[1],10));for(var s=n._getSoundIds(e),o=0;o=0?e=parseInt(r[0],10):t=parseFloat(r[0])}else 2===r.length&&(t=parseFloat(r[0]),e=parseInt(r[1],10));if("number"!=typeof t)return(i=n._soundById(e))?i._rate:n._rate;if("loaded"!==n._state||n._playLock)return n._queue.push({event:"rate",action:function(){n.rate.apply(n,r)}}),n;void 0===e&&(n._rate=t),e=n._getSoundIds(e);for(var h=0;h=0?e=parseInt(n[0],10):i._sounds.length&&(e=i._sounds[0]._id,t=parseFloat(n[0]))}else 2===n.length&&(t=parseFloat(n[0]),e=parseInt(n[1],10));if(void 0===e)return 0;if("number"==typeof t&&("loaded"!==i._state||i._playLock))return i._queue.push({event:"seek",action:function(){i.seek.apply(i,n)}}),i;var a=i._soundById(e);if(a){if(!("number"==typeof t&&t>=0)){if(i._webAudio){var h=i.playing(e)?s.ctx.currentTime-a._playStart:0,l=a._rateSeek?a._rateSeek-a._seek:0;return a._seek+(l+h*Math.abs(a._rate))}return a._node.currentTime}var u=i.playing(e);u&&i.pause(e,!0),a._seek=t,a._ended=!1,i._clearTimer(e),i._webAudio||!a._node||isNaN(a._node.duration)||(a._node.currentTime=t);var c=function(){u&&i.play(e,!0),i._emit("seek",e)};if(u&&!i._webAudio){var d=function(){i._playLock?setTimeout(d,0):c()};setTimeout(d,0)}else c()}return i},playing:function(t){if("number"==typeof t){var e=this._soundById(t);return!!e&&!e._paused}for(var i=0;i=0&&s._howls.splice(n,1);var r=!0;for(i=0;i=0){r=!1;break}return h&&r&&delete h[t._src],s.noAudio=!1,t._state="unloaded",t._sounds=[],t=null,null},on:function(t,e,i,n){var r=this["_on"+t];return"function"==typeof e&&r.push(n?{id:i,fn:e,once:n}:{id:i,fn:e}),this},off:function(t,e,i){var n=this["_on"+t],r=0;if("number"==typeof e&&(i=e,e=null),e||i)for(r=0;r=0;r--)n[r].id&&n[r].id!==e&&"load"!==t||(setTimeout(function(t){t.call(this,e,i)}.bind(this,n[r].fn),0),n[r].once&&this.off(t,n[r].fn,n[r].id));return this._loadQueue(t),this},_loadQueue:function(t){if(this._queue.length>0){var e=this._queue[0];e.event===t&&(this._queue.shift(),this._loadQueue()),t||e.action()}return this},_ended:function(t){var e=t._sprite;if(!this._webAudio&&t._node&&!t._node.paused&&!t._node.ended&&t._node.currentTime=0;i--){if(e<=t)return;this._sounds[i]._ended&&(this._webAudio&&this._sounds[i]._node&&this._sounds[i]._node.disconnect(0),this._sounds.splice(i,1),e--)}}},_getSoundIds:function(t){if(void 0===t){for(var e=[],i=0;i=0;if(s._scratchBuffer&&t.bufferSource&&(t.bufferSource.onended=null,t.bufferSource.disconnect(0),e))try{t.bufferSource.buffer=s._scratchBuffer}catch(t){}return t.bufferSource=null,this},_clearSound:function(t){/MSIE |Trident\//.test(s._navigator&&s._navigator.userAgent)||(t.src="data:audio/wav;base64,UklGRigAAABXQVZFZm10IBIAAAABAAEARKwAAIhYAQACABAAAABkYXRhAgAAAAEA")}};var a=function(t){this._parent=t,this.init()};a.prototype={init:function(){var t=this._parent;return this._muted=t._muted,this._loop=t._loop,this._volume=t._volume,this._rate=t._rate,this._seek=0,this._paused=!0,this._ended=!0,this._sprite="__default",this._id=++s._counter,t._sounds.push(this),this.create(),this},create:function(){var t=this._parent,e=s._muted||this._muted||this._parent._muted?0:this._volume;return t._webAudio?(this._node=void 0===s.ctx.createGain?s.ctx.createGainNode():s.ctx.createGain(),this._node.gain.setValueAtTime(e,s.ctx.currentTime),this._node.paused=!0,this._node.connect(s.masterGain)):s.noAudio||(this._node=s._obtainHtml5Audio(),this._errorFn=this._errorListener.bind(this),this._node.addEventListener("error",this._errorFn,!1),this._loadFn=this._loadListener.bind(this),this._node.addEventListener(s._canPlayEvent,this._loadFn,!1),this._endFn=this._endListener.bind(this),this._node.addEventListener("ended",this._endFn,!1),this._node.src=t._src,this._node.preload=!0===t._preload?"auto":t._preload,this._node.volume=e*s.volume(),this._node.load()),this},reset:function(){var t=this._parent;return this._muted=t._muted,this._loop=t._loop,this._volume=t._volume,this._rate=t._rate,this._seek=0,this._rateSeek=0,this._paused=!0,this._ended=!0,this._sprite="__default",this._id=++s._counter,this},_errorListener:function(){this._parent._emit("loaderror",this._id,this._node.error?this._node.error.code:0),this._node.removeEventListener("error",this._errorFn,!1)},_loadListener:function(){var t=this._parent;t._duration=Math.ceil(10*this._node.duration)/10,0===Object.keys(t._sprite).length&&(t._sprite={__default:[0,1e3*t._duration]}),"loaded"!==t._state&&(t._state="loaded",t._emit("load"),t._loadQueue()),this._node.removeEventListener(s._canPlayEvent,this._loadFn,!1)},_endListener:function(){var t=this._parent;t._duration===1/0&&(t._duration=Math.ceil(10*this._node.duration)/10,t._sprite.__default[1]===1/0&&(t._sprite.__default[1]=1e3*t._duration),t._ended(this)),this._node.removeEventListener("ended",this._endFn,!1)}};var h={},l=function(t){var e=t._src;if(h[e])return t._duration=h[e].duration,void d(t);if(/^data:[^;]+;base64,/.test(e)){for(var i=atob(e.split(",")[1]),n=new Uint8Array(i.length),r=0;r0?(h[e._src]=t,d(e,t)):i()};"undefined"!=typeof Promise&&1===s.ctx.decodeAudioData.length?s.ctx.decodeAudioData(t).then(n).catch(i):s.ctx.decodeAudioData(t,n,i)},d=function(t,e){e&&!t._duration&&(t._duration=e.duration),0===Object.keys(t._sprite).length&&(t._sprite={__default:[0,1e3*t._duration]}),"loaded"!==t._state&&(t._state="loaded",t._emit("load"),t._loadQueue())},p=function(){if(s.usingWebAudio){try{"undefined"!=typeof AudioContext?s.ctx=new AudioContext:"undefined"!=typeof webkitAudioContext?s.ctx=new webkitAudioContext:s.usingWebAudio=!1}catch(t){s.usingWebAudio=!1}s.ctx||(s.usingWebAudio=!1);var t=/iP(hone|od|ad)/.test(s._navigator&&s._navigator.platform),e=s._navigator&&s._navigator.appVersion.match(/OS (\d+)_(\d+)_?(\d+)?/),i=e?parseInt(e[1],10):null;if(t&&i&&i<9){var n=/safari/.test(s._navigator&&s._navigator.userAgent.toLowerCase());s._navigator&&!n&&(s.usingWebAudio=!1)}s.usingWebAudio&&(s.masterGain=void 0===s.ctx.createGain?s.ctx.createGainNode():s.ctx.createGain(),s.masterGain.gain.setValueAtTime(s._muted?0:s._volume,s.ctx.currentTime),s.masterGain.connect(s.ctx.destination)),s._setup()}};void 0===(n=function(){return{Howler:s,Howl:o}}.apply(e,[]))||(t.exports=n),e.Howler=s,e.Howl=o,void 0!==i?(i.HowlerGlobal=r,i.Howler=s,i.Howl=o,i.Sound=a):"undefined"!=typeof window&&(window.HowlerGlobal=r,window.Howler=s,window.Howl=o,window.Sound=a)}(),function(){"use strict";var t;HowlerGlobal.prototype._pos=[0,0,0],HowlerGlobal.prototype._orientation=[0,0,-1,0,1,0],HowlerGlobal.prototype.stereo=function(t){if(!this.ctx||!this.ctx.listener)return this;for(var e=this._howls.length-1;e>=0;e--)this._howls[e].stereo(t);return this},HowlerGlobal.prototype.pos=function(t,e,i){return this.ctx&&this.ctx.listener?(e="number"!=typeof e?this._pos[1]:e,i="number"!=typeof i?this._pos[2]:i,"number"!=typeof t?this._pos:(this._pos=[t,e,i],void 0!==this.ctx.listener.positionX?(this.ctx.listener.positionX.setTargetAtTime(this._pos[0],Howler.ctx.currentTime,.1),this.ctx.listener.positionY.setTargetAtTime(this._pos[1],Howler.ctx.currentTime,.1),this.ctx.listener.positionZ.setTargetAtTime(this._pos[2],Howler.ctx.currentTime,.1)):this.ctx.listener.setPosition(this._pos[0],this._pos[1],this._pos[2]),this)):this},HowlerGlobal.prototype.orientation=function(t,e,i,n,r,s){if(!this.ctx||!this.ctx.listener)return this;var o=this._orientation;return e="number"!=typeof e?o[1]:e,i="number"!=typeof i?o[2]:i,n="number"!=typeof n?o[3]:n,r="number"!=typeof r?o[4]:r,s="number"!=typeof s?o[5]:s,"number"!=typeof t?o:(this._orientation=[t,e,i,n,r,s],void 0!==this.ctx.listener.forwardX?(this.ctx.listener.forwardX.setTargetAtTime(t,Howler.ctx.currentTime,.1),this.ctx.listener.forwardY.setTargetAtTime(e,Howler.ctx.currentTime,.1),this.ctx.listener.forwardZ.setTargetAtTime(i,Howler.ctx.currentTime,.1),this.ctx.listener.upX.setTargetAtTime(n,Howler.ctx.currentTime,.1),this.ctx.listener.upY.setTargetAtTime(r,Howler.ctx.currentTime,.1),this.ctx.listener.upZ.setTargetAtTime(s,Howler.ctx.currentTime,.1)):this.ctx.listener.setOrientation(t,e,i,n,r,s),this)},Howl.prototype.init=(t=Howl.prototype.init,function(e){return this._orientation=e.orientation||[1,0,0],this._stereo=e.stereo||null,this._pos=e.pos||null,this._pannerAttr={coneInnerAngle:void 0!==e.coneInnerAngle?e.coneInnerAngle:360,coneOuterAngle:void 0!==e.coneOuterAngle?e.coneOuterAngle:360,coneOuterGain:void 0!==e.coneOuterGain?e.coneOuterGain:0,distanceModel:void 0!==e.distanceModel?e.distanceModel:"inverse",maxDistance:void 0!==e.maxDistance?e.maxDistance:1e4,panningModel:void 0!==e.panningModel?e.panningModel:"HRTF",refDistance:void 0!==e.refDistance?e.refDistance:1,rolloffFactor:void 0!==e.rolloffFactor?e.rolloffFactor:1},this._onstereo=e.onstereo?[{fn:e.onstereo}]:[],this._onpos=e.onpos?[{fn:e.onpos}]:[],this._onorientation=e.onorientation?[{fn:e.onorientation}]:[],t.call(this,e)}),Howl.prototype.stereo=function(t,i){var n=this;if(!n._webAudio)return n;if("loaded"!==n._state)return n._queue.push({event:"stereo",action:function(){n.stereo(t,i)}}),n;var r=void 0===Howler.ctx.createStereoPanner?"spatial":"stereo";if(void 0===i){if("number"!=typeof t)return n._stereo;n._stereo=t,n._pos=[t,0,0]}for(var s=n._getSoundIds(i),o=0;ot.length)&&(e=t.length);for(var i=0,n=new Array(e);i0&&void 0!==arguments[0]?arguments[0]:"",n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:10,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"rgba(255, 255, 255, 1)";return e(this,d),(t=u.call(this,new c.SpriteMaterial))._text="".concat(i),t._textHeight=n,t._color=r,t._backgroundColor=!1,t._padding=0,t._borderWidth=0,t._borderRadius=0,t._borderColor="white",t._strokeWidth=0,t._strokeColor="white",t._fontFace="system-ui",t._fontSize=90,t._fontWeight="normal",t._canvas=document.createElement("canvas"),t._genCanvas(),t}return n=d,(s=[{key:"text",get:function(){return this._text},set:function(t){this._text=t,this._genCanvas()}},{key:"textHeight",get:function(){return this._textHeight},set:function(t){this._textHeight=t,this._genCanvas()}},{key:"color",get:function(){return this._color},set:function(t){this._color=t,this._genCanvas()}},{key:"backgroundColor",get:function(){return this._backgroundColor},set:function(t){this._backgroundColor=t,this._genCanvas()}},{key:"padding",get:function(){return this._padding},set:function(t){this._padding=t,this._genCanvas()}},{key:"borderWidth",get:function(){return this._borderWidth},set:function(t){this._borderWidth=t,this._genCanvas()}},{key:"borderRadius",get:function(){return this._borderRadius},set:function(t){this._borderRadius=t,this._genCanvas()}},{key:"borderColor",get:function(){return this._borderColor},set:function(t){this._borderColor=t,this._genCanvas()}},{key:"fontFace",get:function(){return this._fontFace},set:function(t){this._fontFace=t,this._genCanvas()}},{key:"fontSize",get:function(){return this._fontSize},set:function(t){this._fontSize=t,this._genCanvas()}},{key:"fontWeight",get:function(){return this._fontWeight},set:function(t){this._fontWeight=t,this._genCanvas()}},{key:"strokeWidth",get:function(){return this._strokeWidth},set:function(t){this._strokeWidth=t,this._genCanvas()}},{key:"strokeColor",get:function(){return this._strokeColor},set:function(t){this._strokeColor=t,this._genCanvas()}},{key:"_genCanvas",value:function(){var t=this,e=this._canvas,i=e.getContext("2d"),n=Array.isArray(this.borderWidth)?this.borderWidth:[this.borderWidth,this.borderWidth],r=n.map((function(e){return e*t.fontSize*.1})),s=(Array.isArray(this.borderRadius)?this.borderRadius:[this.borderRadius,this.borderRadius,this.borderRadius,this.borderRadius]).map((function(e){return e*t.fontSize*.1})),o=Array.isArray(this.padding)?this.padding:[this.padding,this.padding],l=o.map((function(e){return e*t.fontSize*.1})),u=this.text.split("\n"),d="".concat(this.fontWeight," ").concat(this.fontSize,"px ").concat(this.fontFace);i.font=d;var p=Math.max.apply(Math,h(u.map((function(t){return i.measureText(t).width})))),f=this.fontSize*u.length;if(e.width=p+2*r[0]+2*l[0],e.height=f+2*r[1]+2*l[1],this.borderWidth){if(i.strokeStyle=this.borderColor,r[0]){var m=r[0]/2;i.lineWidth=r[0],i.beginPath(),i.moveTo(m,s[0]),i.lineTo(m,e.height-s[3]),i.moveTo(e.width-m,s[1]),i.lineTo(e.width-m,e.height-s[2]),i.stroke()}if(r[1]){var g=r[1]/2;i.lineWidth=r[1],i.beginPath(),i.moveTo(Math.max(r[0],s[0]),g),i.lineTo(e.width-Math.max(r[0],s[1]),g),i.moveTo(Math.max(r[0],s[3]),e.height-g),i.lineTo(e.width-Math.max(r[0],s[2]),e.height-g),i.stroke()}if(this.borderRadius){var v=Math.max.apply(Math,h(r)),y=v/2;i.lineWidth=v,i.beginPath(),[!!s[0]&&[s[0],y,y,s[0]],!!s[1]&&[e.width-s[1],e.width-y,y,s[1]],!!s[2]&&[e.width-s[2],e.width-y,e.height-y,e.height-s[2]],!!s[3]&&[s[3],y,e.height-y,e.height-s[3]]].filter((function(t){return t})).forEach((function(t){var e=a(t,4),n=e[0],r=e[1],s=e[2],o=e[3];i.moveTo(n,s),i.quadraticCurveTo(r,s,r,o)})),i.stroke()}}this.backgroundColor&&(i.fillStyle=this.backgroundColor,this.borderRadius?(i.beginPath(),i.moveTo(r[0],s[0]),[[r[0],s[0],e.width-s[1],r[1],r[1],r[1]],[e.width-r[0],e.width-r[0],e.width-r[0],r[1],s[1],e.height-s[2]],[e.width-r[0],e.width-s[2],s[3],e.height-r[1],e.height-r[1],e.height-r[1]],[r[0],r[0],r[0],e.height-r[1],e.height-s[3],s[0]]].forEach((function(t){var e=a(t,6),n=e[0],r=e[1],s=e[2],o=e[3],h=e[4],l=e[5];i.quadraticCurveTo(n,o,r,h),i.lineTo(s,l)})),i.closePath(),i.fill()):i.fillRect(r[0],r[1],e.width-2*r[0],e.height-2*r[1])),i.translate.apply(i,h(r)),i.translate.apply(i,h(l)),i.font=d,i.fillStyle=this.color,i.textBaseline="bottom";var x=this.strokeWidth>0;x&&(i.lineWidth=this.strokeWidth*this.fontSize/10,i.strokeStyle=this.strokeColor),u.forEach((function(e,n){var r=(p-i.measureText(e).width)/2,s=(n+1)*t.fontSize;x&&i.strokeText(e,r,s),i.fillText(e,r,s)})),this.material.map&&this.material.map.dispose();var w=this.material.map=new c.Texture(e);w.minFilter=c.LinearFilter,w.colorSpace=c.SRGBColorSpace,w.needsUpdate=!0;var b=this.textHeight*u.length+2*n[1]+2*o[1];this.scale.set(b*e.width/e.height,b,0)}},{key:"clone",value:function(){return new this.constructor(this.text,this.textHeight,this.color).copy(this)}},{key:"copy",value:function(t){return c.Sprite.prototype.copy.call(this,t),this.color=t.color,this.backgroundColor=t.backgroundColor,this.padding=t.padding,this.borderWidth=t.borderWidth,this.borderColor=t.borderColor,this.fontFace=t.fontFace,this.fontSize=t.fontSize,this.fontWeight=t.fontWeight,this.strokeWidth=t.strokeWidth,this.strokeColor=t.strokeColor,this}}])&&i(n.prototype,s),l&&i(n,l),Object.defineProperty(n,"prototype",{writable:!1}),d}(c.Sprite)}(i(0))},function(t,e,i){var n;!function(){"use strict";function r(t,e,i){var n=e.x,r=e.y,s=i.x-n,o=i.y-r;if(0!==s||0!==o){var a=((t.x-n)*s+(t.y-r)*o)/(s*s+o*o);a>1?(n=i.x,r=i.y):a>0&&(n+=s*a,r+=o*a)}return(s=t.x-n)*s+(o=t.y-r)*o}function s(t,e){var i=t.length-1,n=[t[0]];return function t(e,i,n,s,o){for(var a,h=s,l=i+1;lh&&(a=l,h=u)}h>s&&(a-i>1&&t(e,i,a,s,o),o.push(e[a]),n-a>1&&t(e,a,n,s,o))}(t,0,i,e,n),n.push(t[i]),n}function o(t,e,i){if(t.length<=2)return t;var n=void 0!==e?e*e:1;return t=s(t=i?t:function(t,e){for(var i,n,r,s,o,a=t[0],h=[a],l=1,u=t.length;le&&(h.push(i),a=i);return a!==i&&h.push(i),h}(t,n),n)}void 0===(n=function(){return o}.call(e,i,e,t))||(t.exports=n)}()},function(t){t.exports=JSON.parse('[{"x":0.22380737227160408,"y":0.6079311870044597},{"x":0.23085358584733323,"y":0.6016401293499298},{"x":0.23085358584733323,"y":0.589058014040869},{"x":0.23789979942306236,"y":0.5638937834227478},{"x":0.24142290621092694,"y":0.5513116681136875},{"x":0.24494601299879154,"y":0.5261474374955664},{"x":0.2590384401502498,"y":0.5009832068774459},{"x":0.2696077605138435,"y":0.47581897625932473},{"x":0.2766539740895726,"y":0.45065474564120367},{"x":0.2872232944531663,"y":0.4129083997140222},{"x":0.3013157216046246,"y":0.39403522675043157},{"x":0.31540814875608286,"y":0.35628888082325016},{"x":0.322454362331812,"y":0.33741570785965946},{"x":0.33654678948327027,"y":0.3122514772415383},{"x":0.3435930030589994,"y":0.2996693619324774},{"x":0.3506392166347286,"y":0.28708724662341717},{"x":0.3576854302104577,"y":0.2745051313143569},{"x":0.3753009641497805,"y":0.25563195835076624},{"x":0.38234717772550963,"y":0.24934090069623577},{"x":0.38939339130123873,"y":0.24304984304170532},{"x":0.40348581845269704,"y":0.22417667007811462},{"x":0.41405513881629075,"y":0.21788561242358415},{"x":0.42110135239201985,"y":0.2115945547690544},{"x":0.43519377954347815,"y":0.20530349711452392},{"x":0.452809313482801,"y":0.18013926649640277},{"x":0.4633786338463947,"y":0.18013926649640277},{"x":0.4739479542099884,"y":0.173848208841873},{"x":0.4845172745735821,"y":0.16755715118734255},{"x":0.4880403813614467,"y":0.16755715118734255},{"x":0.49508659493717583,"y":0.1612660935328121},{"x":0.502132808512905,"y":0.15497503587828232},{"x":0.5091790220886342,"y":0.15497503587828232},{"x":0.5162252356643633,"y":0.15497503587828232},{"x":0.5197483424522278,"y":0.15497503587828232},{"x":0.5232714492400923,"y":0.15497503587828232},{"x":0.5267945560279569,"y":0.15497503587828232},{"x":0.533840769603686,"y":0.15497503587828232},{"x":0.533840769603686,"y":0.1612660935328121},{"x":0.5408869831794152,"y":0.18013926649640277},{"x":0.5479331967551443,"y":0.1927213818054637},{"x":0.5514563035430089,"y":0.21788561242358415},{"x":0.5620256239066026,"y":0.23675878538717554},{"x":0.5690718374823318,"y":0.26821407365982647},{"x":0.5761180510580608,"y":0.28708724662341717},{"x":0.5796411578459255,"y":0.2996693619324774},{"x":0.5866873714216545,"y":0.3122514772415383},{"x":0.5866873714216545,"y":0.33112465020512905},{"x":0.5902104782095192,"y":0.34370676551418927},{"x":0.5972566917852483,"y":0.35628888082325016},{"x":0.6043029053609774,"y":0.3688709961323104},{"x":0.6113491189367066,"y":0.37516205378684087},{"x":0.6113491189367066,"y":0.3814531114413706},{"x":0.6148722257245711,"y":0.39403522675043157},{"x":0.6183953325124357,"y":0.39403522675043157},{"x":0.6219184393003003,"y":0.40032628440496204},{"x":0.6219184393003003,"y":0.4066173420594918},{"x":0.6289646528760294,"y":0.4129083997140222},{"x":0.6360108664517586,"y":0.4191994573685527},{"x":0.6395339732396231,"y":0.4317815726776129},{"x":0.6465801868153522,"y":0.4380726303321434},{"x":0.6536264003910814,"y":0.45694580329573403},{"x":0.6606726139668105,"y":0.4695279186047943},{"x":0.6677188275425396,"y":0.47581897625932473},{"x":0.6677188275425396,"y":0.48211003391385454},{"x":0.6747650411182687,"y":0.48211003391385454},{"x":0.6782881479061333,"y":0.48211003391385454},{"x":0.6818112546939978,"y":0.4946921492229155},{"x":0.688857468269727,"y":0.4946921492229155},{"x":0.6923805750575915,"y":0.4946921492229155},{"x":0.6994267886333208,"y":0.5072742645319757},{"x":0.7029498954211852,"y":0.5072742645319757},{"x":0.70647300220905,"y":0.5072742645319757},{"x":0.713519215784779,"y":0.5135653221865062},{"x":0.7205654293605082,"y":0.5135653221865062},{"x":0.7311347497241019,"y":0.5135653221865062},{"x":0.7452271768755602,"y":0.5198563798410366},{"x":0.7557964972391538,"y":0.5198563798410366},{"x":0.7663658176027476,"y":0.5198563798410366},{"x":0.7804582447542059,"y":0.5198563798410366},{"x":0.7945506719056641,"y":0.5198563798410366},{"x":0.7980737786935287,"y":0.5198563798410366},{"x":0.8015968854813933,"y":0.5198563798410366},{"x":0.8051199922692579,"y":0.5198563798410366},{"x":0.8051199922692579,"y":0.5261474374955664},{"x":0.8051199922692579,"y":0.5324384951500969},{"x":0.8051199922692579,"y":0.5387295528046273},{"x":0.8051199922692579,"y":0.5450206104591572},{"x":0.8051199922692579,"y":0.5513116681136875},{"x":0.8051199922692579,"y":0.557602725768218},{"x":0.8051199922692579,"y":0.5638937834227478},{"x":0.8051199922692579,"y":0.5701848410772782},{"x":0.8051199922692579,"y":0.5764758987318087},{"x":0.8051199922692579,"y":0.5827669563863392},{"x":0.8051199922692579,"y":0.589058014040869},{"x":0.8051199922692579,"y":0.5953490716953994},{"x":0.8051199922692579,"y":0.6079311870044597},{"x":0.8051199922692579,"y":0.61422224465899}]')},function(t){t.exports=JSON.parse('[{"x":0.3390667890450394,"y":0.6266586661417938},{"x":0.3390667890450394,"y":0.6266586661417938},{"x":0.34117163310001053,"y":0.6266586661417938},{"x":0.3432764771549816,"y":0.6266586661417938},{"x":0.3474861652649238,"y":0.6266586661417938},{"x":0.3495910093198949,"y":0.6266586661417938},{"x":0.35169585337486603,"y":0.6266586661417938},{"x":0.3559055414848082,"y":0.6266586661417938},{"x":0.3580103855397793,"y":0.6266586661417938},{"x":0.36222007364972153,"y":0.6266586661417938},{"x":0.36432491770469255,"y":0.6266586661417938},{"x":0.36853460581463476,"y":0.6266586661417938},{"x":0.37063944986960584,"y":0.6266586661417938},{"x":0.372744293924577,"y":0.6266586661417938},{"x":0.37484913797954805,"y":0.6266586661417938},{"x":0.3769539820345192,"y":0.6266586661417938},{"x":0.37905882608949026,"y":0.6266586661417938},{"x":0.38116367014446134,"y":0.6228996200861865},{"x":0.3832685141994325,"y":0.6228996200861865},{"x":0.3853733582544035,"y":0.6228996200861865},{"x":0.38747820230937463,"y":0.6228996200861865},{"x":0.38958304636434576,"y":0.6228996200861865},{"x":0.3937927344742879,"y":0.6228996200861865},{"x":0.395897578529259,"y":0.6228996200861865},{"x":0.39800242258423013,"y":0.6228996200861865},{"x":0.4022121106941723,"y":0.6228996200861865},{"x":0.4043169547491434,"y":0.6228996200861865},{"x":0.40852664285908563,"y":0.6228996200861865},{"x":0.4106314869140567,"y":0.6228996200861865},{"x":0.4127363309690278,"y":0.6228996200861865},{"x":0.41694601907896994,"y":0.6228996200861865},{"x":0.4190508631339411,"y":0.6228996200861865},{"x":0.4232605512438833,"y":0.6228996200861865},{"x":0.4253653952988544,"y":0.6228996200861865},{"x":0.4316799274637677,"y":0.6228996200861865},{"x":0.43378477151873873,"y":0.6228996200861865},{"x":0.43799445962868094,"y":0.6228996200861865},{"x":0.4400993036836522,"y":0.6228996200861865},{"x":0.44430899179359434,"y":0.6191405740305792},{"x":0.4464138358485655,"y":0.6191405740305792},{"x":0.45062352395850763,"y":0.6191405740305792},{"x":0.45272836801347877,"y":0.6191405740305792},{"x":0.45483321206844984,"y":0.6191405740305792},{"x":0.456938056123421,"y":0.6191405740305792},{"x":0.4590429001783921,"y":0.6153815279749714},{"x":0.46114774423336313,"y":0.6153815279749714},{"x":0.46325258828833427,"y":0.6153815279749714},{"x":0.4653574323433053,"y":0.6153815279749714},{"x":0.4674622763982764,"y":0.6153815279749714},{"x":0.46956712045324756,"y":0.6153815279749714},{"x":0.47377680856318977,"y":0.6116224819193642},{"x":0.4758816526181608,"y":0.6116224819193642},{"x":0.4779864966731319,"y":0.6116224819193642},{"x":0.48009134072810306,"y":0.6116224819193642},{"x":0.4821961847830741,"y":0.6116224819193642},{"x":0.4864058728930163,"y":0.6116224819193642},{"x":0.4885107169479874,"y":0.6116224819193642},{"x":0.4927204050579296,"y":0.6116224819193642},{"x":0.4948252491129007,"y":0.6116224819193642},{"x":0.49693009316787173,"y":0.6116224819193642},{"x":0.49903493722284287,"y":0.6116224819193642},{"x":0.501139781277814,"y":0.6116224819193642},{"x":0.5053494693877562,"y":0.6116224819193642},{"x":0.5074543134427272,"y":0.6116224819193642},{"x":0.5116640015526696,"y":0.6116224819193642},{"x":0.5137688456076406,"y":0.6078634358637567},{"x":0.5158736896626117,"y":0.6078634358637567},{"x":0.5179785337175827,"y":0.6078634358637567},{"x":0.5200833777725539,"y":0.6078634358637567},{"x":0.522188221827525,"y":0.6078634358637567},{"x":0.5263979099374672,"y":0.6041043898081495},{"x":0.5285027539924382,"y":0.6041043898081495},{"x":0.5306075980474093,"y":0.6041043898081495},{"x":0.5327124421023804,"y":0.6041043898081495},{"x":0.5348172861573515,"y":0.6003453437525417},{"x":0.5369221302123226,"y":0.6003453437525417},{"x":0.5390269742672936,"y":0.6003453437525417},{"x":0.543236662377236,"y":0.6003453437525417},{"x":0.545341506432207,"y":0.6003453437525417},{"x":0.5474463504871782,"y":0.6003453437525417},{"x":0.5495511945421492,"y":0.5965862976969344},{"x":0.5516560385971203,"y":0.5965862976969344},{"x":0.5516560385971203,"y":0.5928272516413271},{"x":0.5537608826520914,"y":0.5928272516413271},{"x":0.5537608826520914,"y":0.5890682055857198},{"x":0.5558657267070625,"y":0.5890682055857198},{"x":0.5579705707620336,"y":0.5890682055857198},{"x":0.5600754148170046,"y":0.5890682055857198},{"x":0.5621802588719758,"y":0.5890682055857198},{"x":0.5642851029269469,"y":0.5890682055857198},{"x":0.5642851029269469,"y":0.585309159530112},{"x":0.5663899469819179,"y":0.5815501134745047},{"x":0.568494791036889,"y":0.5815501134745047},{"x":0.568494791036889,"y":0.5777910674188973},{"x":0.5705996350918602,"y":0.5777910674188973},{"x":0.5727044791468313,"y":0.5777910674188973},{"x":0.5727044791468313,"y":0.5740320213632901},{"x":0.5748093232018024,"y":0.5740320213632901},{"x":0.5769141672567735,"y":0.5702729753076823},{"x":0.5769141672567735,"y":0.5665139292520749},{"x":0.5790190113117446,"y":0.5665139292520749},{"x":0.5790190113117446,"y":0.5627548831964676},{"x":0.5811238553667156,"y":0.5627548831964676},{"x":0.5811238553667156,"y":0.5589958371408603},{"x":0.5811238553667156,"y":0.5552367910852526},{"x":0.5811238553667156,"y":0.5514777450296452},{"x":0.5811238553667156,"y":0.5477186989740379},{"x":0.5832286994216868,"y":0.5439596529184307},{"x":0.5832286994216868,"y":0.5402006068628228},{"x":0.5832286994216868,"y":0.5364415608072155},{"x":0.5832286994216868,"y":0.5326825147516082},{"x":0.5832286994216868,"y":0.5289234686960009},{"x":0.5832286994216868,"y":0.5251644226403931},{"x":0.5832286994216868,"y":0.5214053765847858},{"x":0.5832286994216868,"y":0.5176463305291785},{"x":0.5832286994216868,"y":0.5138872844735712},{"x":0.5832286994216868,"y":0.5101282384179634},{"x":0.5832286994216868,"y":0.5063691923623561},{"x":0.5832286994216868,"y":0.4988511002511415},{"x":0.5832286994216868,"y":0.4875739620843191},{"x":0.5832286994216868,"y":0.4762968239174967},{"x":0.5853335434766579,"y":0.46877873180628205},{"x":0.5853335434766579,"y":0.4650196857506743},{"x":0.5853335434766579,"y":0.461260639695067},{"x":0.5853335434766579,"y":0.4575015936394597},{"x":0.5853335434766579,"y":0.45374254758385235},{"x":0.5874383875316289,"y":0.45374254758385235},{"x":0.5874383875316289,"y":0.4462244554726373},{"x":0.5874383875316289,"y":0.44246540941703},{"x":0.5874383875316289,"y":0.43870636336142266},{"x":0.5874383875316289,"y":0.4349473173058149},{"x":0.5874383875316289,"y":0.4311882712502076},{"x":0.5895432315866,"y":0.4311882712502076},{"x":0.5895432315866,"y":0.42742922519460025},{"x":0.5895432315866,"y":0.42367017913899296},{"x":0.5895432315866,"y":0.4199111330833852},{"x":0.5895432315866,"y":0.4161520870277779},{"x":0.5895432315866,"y":0.41239304097217055},{"x":0.5895432315866,"y":0.40863399491656327},{"x":0.5895432315866,"y":0.4048749488609555},{"x":0.5895432315866,"y":0.40111590280534815},{"x":0.5895432315866,"y":0.39735685674974086},{"x":0.5895432315866,"y":0.3935978106941335},{"x":0.5895432315866,"y":0.3898387646385257},{"x":0.5895432315866,"y":0.38607971858291845},{"x":0.5895432315866,"y":0.38232067252731117},{"x":0.5895432315866,"y":0.3785616264717038},{"x":0.5895432315866,"y":0.3748025804160961},{"x":0.5916480756415711,"y":0.3748025804160961},{"x":0.5916480756415711,"y":0.37104353436048865},{"x":0.5916480756415711,"y":0.3672844883048814},{"x":0.5916480756415711,"y":0.3635254422492736},{"x":0.5916480756415711,"y":0.3597663961936663},{"x":0.5916480756415711,"y":0.35600735013805906},{"x":0.5937529196965422,"y":0.3522483040824517},{"x":0.5937529196965422,"y":0.3484892580268439},{"x":0.5937529196965422,"y":0.3447302119712366},{"x":0.5937529196965422,"y":0.3409711659156293},{"x":0.5937529196965422,"y":0.337212119860022},{"x":0.5937529196965422,"y":0.3334530738044142},{"x":0.5937529196965422,"y":0.32969402774880685},{"x":0.5937529196965422,"y":0.3259349816931996},{"x":0.5937529196965422,"y":0.3221759356375923},{"x":0.5937529196965422,"y":0.3184168895819845},{"x":0.5958577637515133,"y":0.31465784352637716},{"x":0.5958577637515133,"y":0.31089879747076987},{"x":0.5958577637515133,"y":0.30338070535955475},{"x":0.5958577637515133,"y":0.29962165930394746},{"x":0.5958577637515133,"y":0.2958626132483402},{"x":0.5958577637515133,"y":0.2921035671927329},{"x":0.5958577637515133,"y":0.28834452113712505},{"x":0.5979626078064844,"y":0.2808264290259105},{"x":0.5979626078064844,"y":0.27706738297030314},{"x":0.5979626078064844,"y":0.269549290859088},{"x":0.6000674518614555,"y":0.26579024480348074},{"x":0.6000674518614555,"y":0.26203119874787345},{"x":0.6000674518614555,"y":0.25827215269226567},{"x":0.6000674518614555,"y":0.2545131066366583},{"x":0.6021722959164266,"y":0.25075406058105104},{"x":0.6021722959164266,"y":0.24699501452544376},{"x":0.6021722959164266,"y":0.24323596846983594},{"x":0.6021722959164266,"y":0.23947692241422863},{"x":0.6042771399713978,"y":0.23571787635862132},{"x":0.6063819840263689,"y":0.231958830303014},{"x":0.6084868280813399,"y":0.22819978424740625},{"x":0.6084868280813399,"y":0.22444073819179894},{"x":0.6084868280813399,"y":0.22068169213619163},{"x":0.6084868280813399,"y":0.21692264608058429},{"x":0.610591672136311,"y":0.21692264608058429},{"x":0.6126965161912821,"y":0.20940455396936922},{"x":0.6126965161912821,"y":0.2056455079137619},{"x":0.6148013602462532,"y":0.2056455079137619},{"x":0.6148013602462532,"y":0.2018864618581546},{"x":0.6148013602462532,"y":0.19812741580254684},{"x":0.6169062043012243,"y":0.19436836974693952},{"x":0.6190110483561954,"y":0.19436836974693952},{"x":0.6190110483561954,"y":0.1868502776357249},{"x":0.6211158924111665,"y":0.1868502776357249},{"x":0.6211158924111665,"y":0.1830912315801171},{"x":0.6211158924111665,"y":0.1793321855245098},{"x":0.6232207364661375,"y":0.1793321855245098},{"x":0.6232207364661375,"y":0.1755731394689025},{"x":0.6253255805211086,"y":0.17181409341329518},{"x":0.6274304245760798,"y":0.17181409341329518},{"x":0.6274304245760798,"y":0.16805504735768736},{"x":0.6295352686310508,"y":0.16429600130208005},{"x":0.6295352686310508,"y":0.1605369552464728},{"x":0.6316401126860219,"y":0.1605369552464728},{"x":0.6337449567409931,"y":0.1605369552464728},{"x":0.6337449567409931,"y":0.15301886313525767},{"x":0.6358498007959642,"y":0.15301886313525767},{"x":0.6358498007959642,"y":0.14925981707965036},{"x":0.6379546448509353,"y":0.14925981707965036},{"x":0.6400594889059064,"y":0.14174172496843576},{"x":0.6421643329608775,"y":0.13798267891282798},{"x":0.6442691770158485,"y":0.13798267891282798},{"x":0.6463740210708196,"y":0.13046458680161332},{"x":0.6463740210708196,"y":0.12670554074600607},{"x":0.6484788651257908,"y":0.12670554074600607},{"x":0.6505837091807618,"y":0.12670554074600607},{"x":0.6526885532357329,"y":0.11918744863479094},{"x":0.6526885532357329,"y":0.11542840257918363},{"x":0.654793397290704,"y":0.11542840257918363},{"x":0.6568982413456751,"y":0.11542840257918363},{"x":0.6590030854006462,"y":0.11166935652357636},{"x":0.6590030854006462,"y":0.10791031046796855},{"x":0.6611079294556172,"y":0.10415126441236124},{"x":0.6632127735105884,"y":0.10415126441236124},{"x":0.6653176175655595,"y":0.10415126441236124},{"x":0.6653176175655595,"y":0.10039221835675392},{"x":0.6674224616205306,"y":0.10039221835675392},{"x":0.6695273056755018,"y":0.10039221835675392},{"x":0.6716321497304728,"y":0.10039221835675392},{"x":0.6737369937854439,"y":0.10039221835675392},{"x":0.675841837840415,"y":0.10039221835675392},{"x":0.6779466818953861,"y":0.10039221835675392},{"x":0.6800515259503572,"y":0.10039221835675392},{"x":0.6821563700053282,"y":0.10415126441236124},{"x":0.6842612140602994,"y":0.10415126441236124},{"x":0.6863660581152704,"y":0.10791031046796855},{"x":0.6884709021702415,"y":0.10791031046796855},{"x":0.6905757462252127,"y":0.11166935652357636},{"x":0.6926805902801837,"y":0.11542840257918363},{"x":0.696890278390126,"y":0.11918744863479094},{"x":0.696890278390126,"y":0.12294649469039826},{"x":0.7010999665000682,"y":0.12670554074600607},{"x":0.7032048105550393,"y":0.13046458680161332},{"x":0.7032048105550393,"y":0.13798267891282798},{"x":0.7053096546100104,"y":0.14174172496843576},{"x":0.7074144986649814,"y":0.14925981707965036},{"x":0.7095193427199525,"y":0.14925981707965036},{"x":0.7095193427199525,"y":0.15677790919086548},{"x":0.7095193427199525,"y":0.1605369552464728},{"x":0.7095193427199525,"y":0.16429600130208005},{"x":0.7095193427199525,"y":0.16805504735768736},{"x":0.7095193427199525,"y":0.17181409341329518},{"x":0.7095193427199525,"y":0.1755731394689025},{"x":0.7095193427199525,"y":0.1793321855245098},{"x":0.7095193427199525,"y":0.1830912315801171},{"x":0.7095193427199525,"y":0.1868502776357249},{"x":0.7095193427199525,"y":0.1906093236913322},{"x":0.7095193427199525,"y":0.19436836974693952},{"x":0.7074144986649814,"y":0.19436836974693952},{"x":0.7074144986649814,"y":0.19812741580254684},{"x":0.7053096546100104,"y":0.19812741580254684},{"x":0.7053096546100104,"y":0.2018864618581546},{"x":0.7032048105550393,"y":0.2056455079137619},{"x":0.6989951224450971,"y":0.20940455396936922},{"x":0.696890278390126,"y":0.21316360002497653},{"x":0.696890278390126,"y":0.21692264608058429},{"x":0.6947854343351548,"y":0.21692264608058429},{"x":0.6926805902801837,"y":0.21692264608058429},{"x":0.6905757462252127,"y":0.22068169213619163},{"x":0.6905757462252127,"y":0.22444073819179894},{"x":0.6884709021702415,"y":0.22444073819179894},{"x":0.6842612140602994,"y":0.22819978424740625},{"x":0.6800515259503572,"y":0.231958830303014},{"x":0.6779466818953861,"y":0.231958830303014},{"x":0.6779466818953861,"y":0.23571787635862132},{"x":0.675841837840415,"y":0.23571787635862132},{"x":0.6716321497304728,"y":0.23947692241422863},{"x":0.6695273056755018,"y":0.23947692241422863},{"x":0.6674224616205306,"y":0.23947692241422863},{"x":0.6653176175655595,"y":0.23947692241422863},{"x":0.6653176175655595,"y":0.24323596846983594},{"x":0.6632127735105884,"y":0.24323596846983594},{"x":0.6611079294556172,"y":0.24323596846983594},{"x":0.6590030854006462,"y":0.24323596846983594},{"x":0.6568982413456751,"y":0.24323596846983594},{"x":0.654793397290704,"y":0.24323596846983594},{"x":0.6526885532357329,"y":0.24323596846983594},{"x":0.6505837091807618,"y":0.24323596846983594},{"x":0.6484788651257908,"y":0.24323596846983594},{"x":0.6463740210708196,"y":0.24323596846983594},{"x":0.6442691770158485,"y":0.24323596846983594},{"x":0.6421643329608775,"y":0.24323596846983594},{"x":0.6400594889059064,"y":0.24323596846983594},{"x":0.6379546448509353,"y":0.24323596846983594},{"x":0.6337449567409931,"y":0.24323596846983594},{"x":0.6316401126860219,"y":0.23947692241422863},{"x":0.6295352686310508,"y":0.23947692241422863},{"x":0.6274304245760798,"y":0.23947692241422863},{"x":0.6253255805211086,"y":0.23947692241422863},{"x":0.6211158924111665,"y":0.23571787635862132},{"x":0.6190110483561954,"y":0.22819978424740625},{"x":0.6169062043012243,"y":0.22819978424740625},{"x":0.6148013602462532,"y":0.22068169213619163},{"x":0.6148013602462532,"y":0.21692264608058429},{"x":0.6126965161912821,"y":0.2056455079137619},{"x":0.610591672136311,"y":0.2018864618581546},{"x":0.610591672136311,"y":0.19812741580254684},{"x":0.6084868280813399,"y":0.1906093236913322},{"x":0.6084868280813399,"y":0.1868502776357249},{"x":0.6084868280813399,"y":0.1830912315801171},{"x":0.6084868280813399,"y":0.17181409341329518},{"x":0.6084868280813399,"y":0.16805504735768736},{"x":0.6084868280813399,"y":0.16429600130208005},{"x":0.6084868280813399,"y":0.15677790919086548},{"x":0.6084868280813399,"y":0.15301886313525767},{"x":0.6084868280813399,"y":0.14925981707965036},{"x":0.6084868280813399,"y":0.14174172496843576},{"x":0.6084868280813399,"y":0.13798267891282798},{"x":0.6084868280813399,"y":0.13046458680161332},{"x":0.6084868280813399,"y":0.12670554074600607},{"x":0.6084868280813399,"y":0.12294649469039826},{"x":0.6084868280813399,"y":0.11542840257918363},{"x":0.6084868280813399,"y":0.11166935652357636},{"x":0.6084868280813399,"y":0.10791031046796855},{"x":0.6084868280813399,"y":0.10415126441236124},{"x":0.6084868280813399,"y":0.10039221835675392},{"x":0.610591672136311,"y":0.09663317230114665},{"x":0.610591672136311,"y":0.0928741262455388},{"x":0.6126965161912821,"y":0.0928741262455388},{"x":0.6126965161912821,"y":0.08535603413432426},{"x":0.6148013602462532,"y":0.08159698807871694},{"x":0.6148013602462532,"y":0.07783794202310909},{"x":0.6169062043012243,"y":0.07783794202310909},{"x":0.6169062043012243,"y":0.07407889596750178},{"x":0.6190110483561954,"y":0.07031984991189456},{"x":0.6211158924111665,"y":0.07031984991189456},{"x":0.6211158924111665,"y":0.06656080385628724},{"x":0.6232207364661375,"y":0.06656080385628724},{"x":0.6253255805211086,"y":0.0628017578006794},{"x":0.6274304245760798,"y":0.0628017578006794},{"x":0.6274304245760798,"y":0.05904271174507208},{"x":0.6295352686310508,"y":0.05904271174507208},{"x":0.6316401126860219,"y":0.05904271174507208},{"x":0.6337449567409931,"y":0.05904271174507208},{"x":0.6358498007959642,"y":0.055283665689464766},{"x":0.6379546448509353,"y":0.055283665689464766},{"x":0.6400594889059064,"y":0.05152461963385754},{"x":0.6421643329608775,"y":0.05152461963385754},{"x":0.6442691770158485,"y":0.05152461963385754},{"x":0.6463740210708196,"y":0.05152461963385754},{"x":0.6484788651257908,"y":0.05152461963385754},{"x":0.6505837091807618,"y":0.05152461963385754},{"x":0.6526885532357329,"y":0.05152461963385754},{"x":0.654793397290704,"y":0.05152461963385754},{"x":0.6568982413456751,"y":0.05152461963385754},{"x":0.6590030854006462,"y":0.05152461963385754},{"x":0.6611079294556172,"y":0.05152461963385754},{"x":0.6632127735105884,"y":0.05152461963385754},{"x":0.6653176175655595,"y":0.05152461963385754},{"x":0.6653176175655595,"y":0.055283665689464766},{"x":0.6674224616205306,"y":0.055283665689464766},{"x":0.6695273056755018,"y":0.055283665689464766},{"x":0.6695273056755018,"y":0.05904271174507208},{"x":0.6716321497304728,"y":0.05904271174507208},{"x":0.6737369937854439,"y":0.0628017578006794},{"x":0.675841837840415,"y":0.0628017578006794},{"x":0.675841837840415,"y":0.06656080385628724},{"x":0.6779466818953861,"y":0.07031984991189456},{"x":0.6800515259503572,"y":0.07407889596750178},{"x":0.6821563700053282,"y":0.07407889596750178},{"x":0.6821563700053282,"y":0.08159698807871694},{"x":0.6842612140602994,"y":0.08159698807871694},{"x":0.6842612140602994,"y":0.08535603413432426},{"x":0.6863660581152704,"y":0.0928741262455388},{"x":0.6884709021702415,"y":0.0928741262455388},{"x":0.6884709021702415,"y":0.09663317230114665},{"x":0.6884709021702415,"y":0.10039221835675392},{"x":0.6905757462252127,"y":0.10791031046796855},{"x":0.6926805902801837,"y":0.11166935652357636},{"x":0.6926805902801837,"y":0.11542840257918363},{"x":0.6947854343351548,"y":0.11918744863479094},{"x":0.6947854343351548,"y":0.12294649469039826},{"x":0.696890278390126,"y":0.12670554074600607},{"x":0.696890278390126,"y":0.13046458680161332},{"x":0.696890278390126,"y":0.13422363285722064},{"x":0.696890278390126,"y":0.13798267891282798},{"x":0.696890278390126,"y":0.14174172496843576},{"x":0.696890278390126,"y":0.14550077102404307},{"x":0.696890278390126,"y":0.14925981707965036},{"x":0.696890278390126,"y":0.15301886313525767},{"x":0.696890278390126,"y":0.15677790919086548},{"x":0.696890278390126,"y":0.16429600130208005},{"x":0.696890278390126,"y":0.16805504735768736},{"x":0.696890278390126,"y":0.17181409341329518},{"x":0.696890278390126,"y":0.1755731394689025},{"x":0.696890278390126,"y":0.1793321855245098},{"x":0.696890278390126,"y":0.1868502776357249},{"x":0.696890278390126,"y":0.1906093236913322},{"x":0.696890278390126,"y":0.19436836974693952},{"x":0.6947854343351548,"y":0.19812741580254684},{"x":0.6947854343351548,"y":0.2018864618581546},{"x":0.6926805902801837,"y":0.2056455079137619},{"x":0.6926805902801837,"y":0.20940455396936922},{"x":0.6905757462252127,"y":0.21692264608058429},{"x":0.6884709021702415,"y":0.21692264608058429},{"x":0.6863660581152704,"y":0.22444073819179894},{"x":0.6842612140602994,"y":0.22819978424740625},{"x":0.6800515259503572,"y":0.231958830303014},{"x":0.6800515259503572,"y":0.23571787635862132},{"x":0.6779466818953861,"y":0.23947692241422863},{"x":0.6737369937854439,"y":0.23947692241422863},{"x":0.6716321497304728,"y":0.23947692241422863},{"x":0.6716321497304728,"y":0.24323596846983594},{"x":0.6674224616205306,"y":0.24699501452544376},{"x":0.6653176175655595,"y":0.25075406058105104},{"x":0.6632127735105884,"y":0.25075406058105104},{"x":0.6590030854006462,"y":0.2545131066366583},{"x":0.6568982413456751,"y":0.2545131066366583},{"x":0.654793397290704,"y":0.25827215269226567},{"x":0.6526885532357329,"y":0.25827215269226567},{"x":0.6463740210708196,"y":0.26203119874787345},{"x":0.6442691770158485,"y":0.26579024480348074},{"x":0.6400594889059064,"y":0.26579024480348074},{"x":0.6379546448509353,"y":0.26579024480348074},{"x":0.6358498007959642,"y":0.269549290859088},{"x":0.6337449567409931,"y":0.269549290859088},{"x":0.6316401126860219,"y":0.269549290859088},{"x":0.6295352686310508,"y":0.269549290859088},{"x":0.6274304245760798,"y":0.269549290859088},{"x":0.6253255805211086,"y":0.269549290859088},{"x":0.6232207364661375,"y":0.269549290859088},{"x":0.6211158924111665,"y":0.269549290859088},{"x":0.6190110483561954,"y":0.269549290859088},{"x":0.6169062043012243,"y":0.269549290859088},{"x":0.6148013602462532,"y":0.269549290859088},{"x":0.6126965161912821,"y":0.269549290859088},{"x":0.610591672136311,"y":0.269549290859088},{"x":0.6084868280813399,"y":0.269549290859088},{"x":0.6042771399713978,"y":0.269549290859088},{"x":0.6021722959164266,"y":0.269549290859088},{"x":0.6021722959164266,"y":0.26203119874787345},{"x":0.6000674518614555,"y":0.26203119874787345},{"x":0.5979626078064844,"y":0.26203119874787345},{"x":0.5979626078064844,"y":0.25827215269226567},{"x":0.5958577637515133,"y":0.25075406058105104},{"x":0.5958577637515133,"y":0.24323596846983594},{"x":0.5958577637515133,"y":0.23947692241422863},{"x":0.5958577637515133,"y":0.23571787635862132},{"x":0.5958577637515133,"y":0.22819978424740625},{"x":0.5958577637515133,"y":0.22444073819179894},{"x":0.5958577637515133,"y":0.22068169213619163},{"x":0.5958577637515133,"y":0.21692264608058429},{"x":0.5958577637515133,"y":0.21316360002497653},{"x":0.5958577637515133,"y":0.20940455396936922},{"x":0.5958577637515133,"y":0.2056455079137619},{"x":0.5958577637515133,"y":0.2018864618581546},{"x":0.5958577637515133,"y":0.19812741580254684},{"x":0.5958577637515133,"y":0.19436836974693952},{"x":0.5979626078064844,"y":0.1868502776357249},{"x":0.5979626078064844,"y":0.1830912315801171},{"x":0.6000674518614555,"y":0.1755731394689025},{"x":0.6021722959164266,"y":0.17181409341329518},{"x":0.6042771399713978,"y":0.1605369552464728},{"x":0.6063819840263689,"y":0.1605369552464728},{"x":0.6084868280813399,"y":0.15677790919086548},{"x":0.6084868280813399,"y":0.15301886313525767},{"x":0.610591672136311,"y":0.14925981707965036},{"x":0.6126965161912821,"y":0.14550077102404307},{"x":0.6148013602462532,"y":0.14174172496843576},{"x":0.6169062043012243,"y":0.13422363285722064},{"x":0.6190110483561954,"y":0.13422363285722064},{"x":0.6211158924111665,"y":0.13422363285722064},{"x":0.6232207364661375,"y":0.12670554074600607},{"x":0.6253255805211086,"y":0.12294649469039826},{"x":0.6274304245760798,"y":0.12294649469039826},{"x":0.6316401126860219,"y":0.11542840257918363},{"x":0.6337449567409931,"y":0.11542840257918363},{"x":0.6337449567409931,"y":0.11166935652357636},{"x":0.6379546448509353,"y":0.10791031046796855},{"x":0.6400594889059064,"y":0.10415126441236124},{"x":0.6463740210708196,"y":0.10415126441236124},{"x":0.6463740210708196,"y":0.10039221835675392},{"x":0.6526885532357329,"y":0.10039221835675392},{"x":0.654793397290704,"y":0.09663317230114665},{"x":0.6568982413456751,"y":0.09663317230114665},{"x":0.6590030854006462,"y":0.09663317230114665},{"x":0.6611079294556172,"y":0.09663317230114665},{"x":0.6632127735105884,"y":0.09663317230114665},{"x":0.6653176175655595,"y":0.09663317230114665},{"x":0.6653176175655595,"y":0.10039221835675392},{"x":0.6674224616205306,"y":0.10039221835675392},{"x":0.6695273056755018,"y":0.10415126441236124},{"x":0.6716321497304728,"y":0.10415126441236124},{"x":0.6716321497304728,"y":0.10791031046796855},{"x":0.6716321497304728,"y":0.11166935652357636},{"x":0.6716321497304728,"y":0.11542840257918363},{"x":0.6737369937854439,"y":0.11918744863479094},{"x":0.675841837840415,"y":0.12294649469039826},{"x":0.675841837840415,"y":0.12670554074600607},{"x":0.675841837840415,"y":0.13046458680161332},{"x":0.6779466818953861,"y":0.13046458680161332},{"x":0.6779466818953861,"y":0.13798267891282798},{"x":0.6800515259503572,"y":0.14174172496843576},{"x":0.6800515259503572,"y":0.14550077102404307},{"x":0.6821563700053282,"y":0.14925981707965036},{"x":0.6821563700053282,"y":0.15301886313525767},{"x":0.6821563700053282,"y":0.15677790919086548},{"x":0.6821563700053282,"y":0.1605369552464728},{"x":0.6842612140602994,"y":0.1605369552464728},{"x":0.6842612140602994,"y":0.16429600130208005},{"x":0.6842612140602994,"y":0.16805504735768736},{"x":0.6863660581152704,"y":0.17181409341329518},{"x":0.6863660581152704,"y":0.1755731394689025},{"x":0.6863660581152704,"y":0.1793321855245098},{"x":0.6863660581152704,"y":0.1830912315801171},{"x":0.6884709021702415,"y":0.1868502776357249},{"x":0.6884709021702415,"y":0.1906093236913322},{"x":0.6884709021702415,"y":0.19436836974693952},{"x":0.6884709021702415,"y":0.19812741580254684},{"x":0.6884709021702415,"y":0.2018864618581546},{"x":0.6884709021702415,"y":0.2056455079137619},{"x":0.6884709021702415,"y":0.20940455396936922},{"x":0.6884709021702415,"y":0.21316360002497653},{"x":0.6884709021702415,"y":0.21692264608058429},{"x":0.6884709021702415,"y":0.22068169213619163},{"x":0.6884709021702415,"y":0.22444073819179894},{"x":0.6842612140602994,"y":0.231958830303014},{"x":0.6842612140602994,"y":0.23947692241422863},{"x":0.6821563700053282,"y":0.23947692241422863},{"x":0.6800515259503572,"y":0.23947692241422863},{"x":0.6800515259503572,"y":0.24323596846983594},{"x":0.6779466818953861,"y":0.24323596846983594},{"x":0.6779466818953861,"y":0.24699501452544376},{"x":0.675841837840415,"y":0.24699501452544376},{"x":0.6737369937854439,"y":0.25075406058105104},{"x":0.6716321497304728,"y":0.25075406058105104},{"x":0.6695273056755018,"y":0.25075406058105104},{"x":0.6674224616205306,"y":0.25075406058105104},{"x":0.6653176175655595,"y":0.25075406058105104},{"x":0.6632127735105884,"y":0.25075406058105104},{"x":0.6611079294556172,"y":0.25075406058105104},{"x":0.6590030854006462,"y":0.25075406058105104},{"x":0.6568982413456751,"y":0.25075406058105104},{"x":0.654793397290704,"y":0.24699501452544376},{"x":0.6526885532357329,"y":0.24699501452544376},{"x":0.6526885532357329,"y":0.24323596846983594},{"x":0.6505837091807618,"y":0.23947692241422863},{"x":0.6484788651257908,"y":0.23947692241422863},{"x":0.6463740210708196,"y":0.23947692241422863},{"x":0.6463740210708196,"y":0.23571787635862132},{"x":0.6463740210708196,"y":0.231958830303014},{"x":0.6463740210708196,"y":0.22819978424740625},{"x":0.6442691770158485,"y":0.22819978424740625},{"x":0.6421643329608775,"y":0.22444073819179894},{"x":0.6421643329608775,"y":0.22068169213619163},{"x":0.6400594889059064,"y":0.21692264608058429},{"x":0.6379546448509353,"y":0.2056455079137619},{"x":0.6358498007959642,"y":0.2018864618581546},{"x":0.6337449567409931,"y":0.19436836974693952},{"x":0.6337449567409931,"y":0.1906093236913322},{"x":0.6337449567409931,"y":0.1868502776357249},{"x":0.6316401126860219,"y":0.1755731394689025},{"x":0.6295352686310508,"y":0.17181409341329518},{"x":0.6274304245760798,"y":0.1605369552464728},{"x":0.6274304245760798,"y":0.15677790919086548},{"x":0.6253255805211086,"y":0.14174172496843576},{"x":0.6253255805211086,"y":0.13798267891282798},{"x":0.6232207364661375,"y":0.12670554074600607},{"x":0.6232207364661375,"y":0.12294649469039826},{"x":0.6232207364661375,"y":0.11542840257918363},{"x":0.6232207364661375,"y":0.11166935652357636},{"x":0.6232207364661375,"y":0.10415126441236124},{"x":0.6232207364661375,"y":0.10039221835675392},{"x":0.6232207364661375,"y":0.09663317230114665},{"x":0.6232207364661375,"y":0.0928741262455388},{"x":0.6232207364661375,"y":0.08911508018993149},{"x":0.6232207364661375,"y":0.08159698807871694},{"x":0.6232207364661375,"y":0.07783794202310909},{"x":0.6253255805211086,"y":0.07783794202310909},{"x":0.6253255805211086,"y":0.07407889596750178},{"x":0.6274304245760798,"y":0.07031984991189456},{"x":0.6295352686310508,"y":0.07031984991189456},{"x":0.6316401126860219,"y":0.07031984991189456},{"x":0.6337449567409931,"y":0.07783794202310909},{"x":0.6358498007959642,"y":0.08159698807871694},{"x":0.6379546448509353,"y":0.08535603413432426},{"x":0.6379546448509353,"y":0.08911508018993149},{"x":0.6400594889059064,"y":0.08911508018993149},{"x":0.6400594889059064,"y":0.0928741262455388},{"x":0.6400594889059064,"y":0.10415126441236124},{"x":0.6421643329608775,"y":0.11542840257918363},{"x":0.6421643329608775,"y":0.11918744863479094},{"x":0.6442691770158485,"y":0.12294649469039826},{"x":0.6442691770158485,"y":0.13046458680161332},{"x":0.6463740210708196,"y":0.13422363285722064},{"x":0.6463740210708196,"y":0.13798267891282798},{"x":0.6463740210708196,"y":0.14550077102404307},{"x":0.6463740210708196,"y":0.14925981707965036},{"x":0.6463740210708196,"y":0.15677790919086548},{"x":0.6463740210708196,"y":0.1605369552464728},{"x":0.6463740210708196,"y":0.16429600130208005},{"x":0.6463740210708196,"y":0.16805504735768736},{"x":0.6484788651257908,"y":0.16805504735768736},{"x":0.6484788651257908,"y":0.17181409341329518},{"x":0.6484788651257908,"y":0.1755731394689025},{"x":0.6484788651257908,"y":0.1793321855245098},{"x":0.6484788651257908,"y":0.1830912315801171},{"x":0.6484788651257908,"y":0.1868502776357249},{"x":0.6484788651257908,"y":0.1906093236913322},{"x":0.6484788651257908,"y":0.19436836974693952},{"x":0.6484788651257908,"y":0.19812741580254684},{"x":0.6484788651257908,"y":0.2018864618581546},{"x":0.6484788651257908,"y":0.2056455079137619},{"x":0.6484788651257908,"y":0.20940455396936922},{"x":0.6463740210708196,"y":0.20940455396936922},{"x":0.6463740210708196,"y":0.21316360002497653},{"x":0.6463740210708196,"y":0.21692264608058429},{"x":0.6442691770158485,"y":0.21692264608058429},{"x":0.6421643329608775,"y":0.22444073819179894},{"x":0.6400594889059064,"y":0.22444073819179894},{"x":0.6400594889059064,"y":0.22819978424740625},{"x":0.6379546448509353,"y":0.22819978424740625},{"x":0.6358498007959642,"y":0.231958830303014},{"x":0.6337449567409931,"y":0.231958830303014},{"x":0.6316401126860219,"y":0.23571787635862132},{"x":0.6295352686310508,"y":0.23571787635862132},{"x":0.6274304245760798,"y":0.23947692241422863},{"x":0.6253255805211086,"y":0.23947692241422863},{"x":0.6211158924111665,"y":0.23947692241422863},{"x":0.6190110483561954,"y":0.23947692241422863},{"x":0.6148013602462532,"y":0.23947692241422863},{"x":0.6148013602462532,"y":0.24323596846983594},{"x":0.6126965161912821,"y":0.24323596846983594},{"x":0.610591672136311,"y":0.24323596846983594},{"x":0.6084868280813399,"y":0.24323596846983594},{"x":0.6063819840263689,"y":0.24323596846983594},{"x":0.6042771399713978,"y":0.24323596846983594},{"x":0.6021722959164266,"y":0.24323596846983594},{"x":0.6000674518614555,"y":0.24323596846983594},{"x":0.6000674518614555,"y":0.23947692241422863},{"x":0.5979626078064844,"y":0.23947692241422863},{"x":0.5958577637515133,"y":0.23947692241422863},{"x":0.5916480756415711,"y":0.23571787635862132},{"x":0.5916480756415711,"y":0.231958830303014},{"x":0.5895432315866,"y":0.231958830303014},{"x":0.5895432315866,"y":0.22819978424740625},{"x":0.5874383875316289,"y":0.22819978424740625},{"x":0.5853335434766579,"y":0.22068169213619163},{"x":0.5853335434766579,"y":0.21692264608058429},{"x":0.5832286994216868,"y":0.21692264608058429},{"x":0.5832286994216868,"y":0.20940455396936922},{"x":0.5832286994216868,"y":0.2056455079137619},{"x":0.5811238553667156,"y":0.19812741580254684},{"x":0.5790190113117446,"y":0.19436836974693952},{"x":0.5790190113117446,"y":0.1906093236913322},{"x":0.5769141672567735,"y":0.1830912315801171},{"x":0.5769141672567735,"y":0.1793321855245098},{"x":0.5769141672567735,"y":0.1755731394689025},{"x":0.5769141672567735,"y":0.17181409341329518},{"x":0.5769141672567735,"y":0.16805504735768736},{"x":0.5769141672567735,"y":0.16429600130208005},{"x":0.5769141672567735,"y":0.15677790919086548},{"x":0.5769141672567735,"y":0.15301886313525767},{"x":0.5769141672567735,"y":0.14550077102404307},{"x":0.5769141672567735,"y":0.14174172496843576},{"x":0.5769141672567735,"y":0.13798267891282798},{"x":0.5769141672567735,"y":0.13422363285722064},{"x":0.5769141672567735,"y":0.13046458680161332},{"x":0.5769141672567735,"y":0.12670554074600607},{"x":0.5769141672567735,"y":0.12294649469039826},{"x":0.5790190113117446,"y":0.11918744863479094},{"x":0.5811238553667156,"y":0.11542840257918363},{"x":0.5832286994216868,"y":0.11542840257918363},{"x":0.5832286994216868,"y":0.11166935652357636},{"x":0.5853335434766579,"y":0.11166935652357636},{"x":0.5853335434766579,"y":0.10791031046796855},{"x":0.5874383875316289,"y":0.10415126441236124},{"x":0.5895432315866,"y":0.10415126441236124},{"x":0.5916480756415711,"y":0.10415126441236124},{"x":0.5937529196965422,"y":0.10415126441236124},{"x":0.5958577637515133,"y":0.10415126441236124},{"x":0.6000674518614555,"y":0.10415126441236124},{"x":0.6021722959164266,"y":0.10415126441236124},{"x":0.6042771399713978,"y":0.10415126441236124},{"x":0.6063819840263689,"y":0.10415126441236124},{"x":0.6084868280813399,"y":0.10415126441236124},{"x":0.610591672136311,"y":0.10415126441236124},{"x":0.6126965161912821,"y":0.10415126441236124},{"x":0.6148013602462532,"y":0.10415126441236124},{"x":0.6169062043012243,"y":0.10791031046796855},{"x":0.6190110483561954,"y":0.10791031046796855},{"x":0.6211158924111665,"y":0.10791031046796855},{"x":0.6211158924111665,"y":0.11166935652357636},{"x":0.6232207364661375,"y":0.11166935652357636},{"x":0.6253255805211086,"y":0.11542840257918363},{"x":0.6274304245760798,"y":0.11542840257918363},{"x":0.6274304245760798,"y":0.11918744863479094},{"x":0.6295352686310508,"y":0.11918744863479094},{"x":0.6316401126860219,"y":0.11918744863479094},{"x":0.6337449567409931,"y":0.12294649469039826},{"x":0.6358498007959642,"y":0.12294649469039826},{"x":0.6379546448509353,"y":0.12670554074600607},{"x":0.6400594889059064,"y":0.12670554074600607},{"x":0.6400594889059064,"y":0.13046458680161332},{"x":0.6421643329608775,"y":0.13046458680161332},{"x":0.6442691770158485,"y":0.13046458680161332},{"x":0.6442691770158485,"y":0.13422363285722064},{"x":0.6463740210708196,"y":0.13422363285722064},{"x":0.6463740210708196,"y":0.13798267891282798}]')},function(t){t.exports=JSON.parse('[{"x":0.1885763043929584,"y":0.3499978231687197},{"x":0.1885763043929584,"y":0.35628888082325016},{"x":0.1885763043929584,"y":0.36257993847778},{"x":0.1885763043929584,"y":0.3688709961323104},{"x":0.1885763043929584,"y":0.37516205378684087},{"x":0.18505319760509384,"y":0.3814531114413706},{"x":0.18505319760509384,"y":0.39403522675043157},{"x":0.18153009081722926,"y":0.39403522675043157},{"x":0.18153009081722926,"y":0.40032628440496204},{"x":0.18153009081722926,"y":0.4066173420594918},{"x":0.18153009081722926,"y":0.4129083997140222},{"x":0.18153009081722926,"y":0.4254905150230825},{"x":0.18153009081722926,"y":0.4317815726776129},{"x":0.1780069840293647,"y":0.44436368798667314},{"x":0.1780069840293647,"y":0.45065474564120367},{"x":0.17448387724150013,"y":0.4695279186047943},{"x":0.17448387724150013,"y":0.47581897625932473},{"x":0.17448387724150013,"y":0.4946921492229155},{"x":0.17448387724150013,"y":0.5135653221865062},{"x":0.1709607704536356,"y":0.5261474374955664},{"x":0.1709607704536356,"y":0.5387295528046273},{"x":0.1709607704536356,"y":0.5513116681136875},{"x":0.1709607704536356,"y":0.557602725768218},{"x":0.167437663665771,"y":0.5638937834227478},{"x":0.167437663665771,"y":0.5764758987318087},{"x":0.167437663665771,"y":0.5827669563863392},{"x":0.167437663665771,"y":0.589058014040869},{"x":0.167437663665771,"y":0.5953490716953994},{"x":0.167437663665771,"y":0.6016401293499298},{"x":0.167437663665771,"y":0.6079311870044597},{"x":0.167437663665771,"y":0.61422224465899},{"x":0.167437663665771,"y":0.6205133023135205},{"x":0.1709607704536356,"y":0.6205133023135205},{"x":0.17448387724150013,"y":0.6205133023135205},{"x":0.18153009081722926,"y":0.6205133023135205},{"x":0.1885763043929584,"y":0.6205133023135205},{"x":0.1991456247565521,"y":0.6268043599680503},{"x":0.20266873154441667,"y":0.6268043599680503},{"x":0.21323805190801037,"y":0.6268043599680503},{"x":0.22380737227160408,"y":0.6330954176225808},{"x":0.23789979942306236,"y":0.6330954176225808},{"x":0.24494601299879154,"y":0.6330954176225808},{"x":0.2555153333623852,"y":0.6330954176225808},{"x":0.2625615469381143,"y":0.6330954176225808},{"x":0.273130867301708,"y":0.6330954176225808},{"x":0.2801770808774372,"y":0.6330954176225808},{"x":0.2872232944531663,"y":0.6330954176225808},{"x":0.29426950802889545,"y":0.6330954176225808},{"x":0.3013157216046246,"y":0.6330954176225808},{"x":0.3083619351803537,"y":0.6330954176225808},{"x":0.3118850419682183,"y":0.6330954176225808},{"x":0.31540814875608286,"y":0.6330954176225808},{"x":0.31540814875608286,"y":0.6205133023135205},{"x":0.31540814875608286,"y":0.61422224465899},{"x":0.31540814875608286,"y":0.6016401293499298},{"x":0.31540814875608286,"y":0.5953490716953994},{"x":0.31540814875608286,"y":0.5764758987318087},{"x":0.31540814875608286,"y":0.5701848410772782},{"x":0.31540814875608286,"y":0.557602725768218},{"x":0.31540814875608286,"y":0.5450206104591572},{"x":0.31540814875608286,"y":0.5387295528046273},{"x":0.31540814875608286,"y":0.5324384951500969},{"x":0.31540814875608286,"y":0.5198563798410366},{"x":0.3189312555439474,"y":0.5009832068774459},{"x":0.3189312555439474,"y":0.488401091568385},{"x":0.3189312555439474,"y":0.48211003391385454},{"x":0.3189312555439474,"y":0.46323686095026384},{"x":0.3189312555439474,"y":0.45065474564120367},{"x":0.322454362331812,"y":0.4191994573685527},{"x":0.3295005759075411,"y":0.4066173420594918},{"x":0.3295005759075411,"y":0.40032628440496204},{"x":0.3295005759075411,"y":0.39403522675043157},{"x":0.3330236826954057,"y":0.37516205378684087},{"x":0.33654678948327027,"y":0.37516205378684087},{"x":0.33654678948327027,"y":0.3688709961323104},{"x":0.3400698962711349,"y":0.36257993847778},{"x":0.3435930030589994,"y":0.36257993847778},{"x":0.347116109846864,"y":0.36257993847778},{"x":0.3506392166347286,"y":0.36257993847778},{"x":0.35416232342259313,"y":0.35628888082325016},{"x":0.3612085369983223,"y":0.35628888082325016},{"x":0.36825475057405127,"y":0.35628888082325016},{"x":0.3753009641497805,"y":0.35628888082325016},{"x":0.38939339130123873,"y":0.35628888082325016},{"x":0.40348581845269704,"y":0.34370676551418927},{"x":0.41405513881629075,"y":0.34370676551418927},{"x":0.42110135239201985,"y":0.34370676551418927},{"x":0.428147565967749,"y":0.34370676551418927},{"x":0.4422399931192073,"y":0.34370676551418927},{"x":0.44928620669493646,"y":0.34370676551418927},{"x":0.452809313482801,"y":0.34370676551418927},{"x":0.45633242027066556,"y":0.34370676551418927},{"x":0.45633242027066556,"y":0.35628888082325016},{"x":0.45633242027066556,"y":0.36257993847778},{"x":0.452809313482801,"y":0.37516205378684087},{"x":0.452809313482801,"y":0.38774416909590104},{"x":0.44928620669493646,"y":0.40032628440496204},{"x":0.44576309990707186,"y":0.4254905150230825},{"x":0.44576309990707186,"y":0.4317815726776129},{"x":0.44576309990707186,"y":0.4380726303321434},{"x":0.44576309990707186,"y":0.45065474564120367},{"x":0.4422399931192073,"y":0.4695279186047943},{"x":0.4422399931192073,"y":0.47581897625932473},{"x":0.4422399931192073,"y":0.48211003391385454},{"x":0.43519377954347815,"y":0.5072742645319757},{"x":0.43519377954347815,"y":0.5135653221865062},{"x":0.43519377954347815,"y":0.5261474374955664},{"x":0.43519377954347815,"y":0.5387295528046273},{"x":0.43519377954347815,"y":0.5513116681136875},{"x":0.43519377954347815,"y":0.557602725768218},{"x":0.43519377954347815,"y":0.5638937834227478},{"x":0.43519377954347815,"y":0.5701848410772782},{"x":0.43519377954347815,"y":0.5764758987318087},{"x":0.43519377954347815,"y":0.5827669563863392},{"x":0.43519377954347815,"y":0.589058014040869},{"x":0.43519377954347815,"y":0.5953490716953994},{"x":0.43519377954347815,"y":0.6016401293499298},{"x":0.43519377954347815,"y":0.6079311870044597},{"x":0.43519377954347815,"y":0.61422224465899},{"x":0.43519377954347815,"y":0.6205133023135205},{"x":0.4387168863313427,"y":0.6205133023135205},{"x":0.4422399931192073,"y":0.6205133023135205},{"x":0.44576309990707186,"y":0.6205133023135205},{"x":0.452809313482801,"y":0.6205133023135205},{"x":0.45985552705853017,"y":0.6205133023135205},{"x":0.4633786338463947,"y":0.6205133023135205},{"x":0.47747106099785297,"y":0.6205133023135205},{"x":0.4845172745735821,"y":0.6205133023135205},{"x":0.49508659493717583,"y":0.6205133023135205},{"x":0.5091790220886342,"y":0.6205133023135205},{"x":0.5267945560279569,"y":0.6205133023135205},{"x":0.5373638763915506,"y":0.6205133023135205},{"x":0.5479331967551443,"y":0.6205133023135205},{"x":0.5514563035430089,"y":0.6205133023135205},{"x":0.5585025171187381,"y":0.6205133023135205},{"x":0.5655487306944671,"y":0.6205133023135205},{"x":0.5690718374823318,"y":0.6205133023135205},{"x":0.5761180510580608,"y":0.6205133023135205},{"x":0.5796411578459255,"y":0.6205133023135205},{"x":0.58316426463379,"y":0.6205133023135205},{"x":0.5866873714216545,"y":0.6205133023135205},{"x":0.5866873714216545,"y":0.61422224465899},{"x":0.5866873714216545,"y":0.6079311870044597},{"x":0.5866873714216545,"y":0.6016401293499298},{"x":0.5866873714216545,"y":0.5953490716953994},{"x":0.5866873714216545,"y":0.589058014040869},{"x":0.5866873714216545,"y":0.5701848410772782},{"x":0.5866873714216545,"y":0.557602725768218},{"x":0.5866873714216545,"y":0.5513116681136875},{"x":0.5866873714216545,"y":0.5261474374955664},{"x":0.5866873714216545,"y":0.5198563798410366},{"x":0.5866873714216545,"y":0.5009832068774459},{"x":0.5866873714216545,"y":0.4946921492229155},{"x":0.5866873714216545,"y":0.48211003391385454},{"x":0.5902104782095192,"y":0.47581897625932473},{"x":0.5902104782095192,"y":0.4695279186047943},{"x":0.5902104782095192,"y":0.46323686095026384},{"x":0.5902104782095192,"y":0.45694580329573403},{"x":0.5902104782095192,"y":0.45065474564120367},{"x":0.5937335849973837,"y":0.44436368798667314},{"x":0.5937335849973837,"y":0.4317815726776129},{"x":0.5937335849973837,"y":0.4254905150230825},{"x":0.5937335849973837,"y":0.4191994573685527},{"x":0.5972566917852483,"y":0.4129083997140222},{"x":0.6007797985731129,"y":0.40032628440496204},{"x":0.6043029053609774,"y":0.38774416909590104},{"x":0.6043029053609774,"y":0.3814531114413706},{"x":0.6043029053609774,"y":0.37516205378684087},{"x":0.6078260121488419,"y":0.37516205378684087},{"x":0.6113491189367066,"y":0.37516205378684087},{"x":0.6219184393003003,"y":0.3688709961323104},{"x":0.6289646528760294,"y":0.3688709961323104},{"x":0.6395339732396231,"y":0.3688709961323104},{"x":0.6536264003910814,"y":0.36257993847778},{"x":0.657149507178946,"y":0.36257993847778},{"x":0.6641957207546751,"y":0.36257993847778},{"x":0.6712419343304041,"y":0.35628888082325016},{"x":0.6818112546939978,"y":0.35628888082325016},{"x":0.688857468269727,"y":0.35628888082325016},{"x":0.6994267886333208,"y":0.3499978231687197},{"x":0.7029498954211852,"y":0.3499978231687197},{"x":0.7099961089969145,"y":0.3499978231687197},{"x":0.7170423225726436,"y":0.3499978231687197},{"x":0.7205654293605082,"y":0.34370676551418927},{"x":0.7276116429362374,"y":0.34370676551418927},{"x":0.7311347497241019,"y":0.34370676551418927},{"x":0.7311347497241019,"y":0.3499978231687197},{"x":0.7276116429362374,"y":0.35628888082325016},{"x":0.7240885361483727,"y":0.3688709961323104},{"x":0.7205654293605082,"y":0.3814531114413706},{"x":0.7205654293605082,"y":0.39403522675043157},{"x":0.7205654293605082,"y":0.4129083997140222},{"x":0.7170423225726436,"y":0.4129083997140222},{"x":0.7170423225726436,"y":0.4380726303321434},{"x":0.713519215784779,"y":0.44436368798667314},{"x":0.713519215784779,"y":0.45065474564120367},{"x":0.713519215784779,"y":0.4695279186047943},{"x":0.713519215784779,"y":0.47581897625932473},{"x":0.713519215784779,"y":0.48211003391385454},{"x":0.713519215784779,"y":0.488401091568385},{"x":0.7099961089969145,"y":0.5009832068774459},{"x":0.7099961089969145,"y":0.5072742645319757},{"x":0.7099961089969145,"y":0.5261474374955664},{"x":0.7099961089969145,"y":0.5387295528046273},{"x":0.7099961089969145,"y":0.5450206104591572},{"x":0.7099961089969145,"y":0.5513116681136875},{"x":0.7099961089969145,"y":0.5638937834227478},{"x":0.7099961089969145,"y":0.5701848410772782},{"x":0.7099961089969145,"y":0.5764758987318087},{"x":0.7099961089969145,"y":0.5827669563863392},{"x":0.7099961089969145,"y":0.589058014040869},{"x":0.7099961089969145,"y":0.5953490716953994},{"x":0.7099961089969145,"y":0.6016401293499298},{"x":0.7099961089969145,"y":0.6079311870044597},{"x":0.7170423225726436,"y":0.61422224465899},{"x":0.7240885361483727,"y":0.61422224465899},{"x":0.7346578565119664,"y":0.61422224465899},{"x":0.7452271768755602,"y":0.61422224465899},{"x":0.7522733904512893,"y":0.61422224465899},{"x":0.7593196040270185,"y":0.61422224465899},{"x":0.7663658176027476,"y":0.61422224465899},{"x":0.7769351379663412,"y":0.61422224465899},{"x":0.7804582447542059,"y":0.61422224465899},{"x":0.787504458329935,"y":0.61422224465899},{"x":0.7910275651177996,"y":0.61422224465899},{"x":0.7945506719056641,"y":0.61422224465899},{"x":0.7980737786935287,"y":0.61422224465899},{"x":0.8015968854813933,"y":0.61422224465899},{"x":0.8051199922692579,"y":0.61422224465899},{"x":0.8086430990571224,"y":0.61422224465899},{"x":0.812166205844987,"y":0.61422224465899},{"x":0.8156893126328515,"y":0.6079311870044597},{"x":0.8156893126328515,"y":0.6016401293499298},{"x":0.8192124194207161,"y":0.5827669563863392},{"x":0.8192124194207161,"y":0.5638937834227478},{"x":0.8227355262085807,"y":0.5513116681136875},{"x":0.8262586329964453,"y":0.5324384951500969},{"x":0.8262586329964453,"y":0.5198563798410366},{"x":0.8262586329964453,"y":0.5135653221865062},{"x":0.8262586329964453,"y":0.4946921492229155},{"x":0.8262586329964453,"y":0.48211003391385454},{"x":0.8333048465721744,"y":0.4695279186047943},{"x":0.8333048465721744,"y":0.46323686095026384},{"x":0.8333048465721744,"y":0.44436368798667314},{"x":0.8333048465721744,"y":0.4317815726776129},{"x":0.8333048465721744,"y":0.4254905150230825},{"x":0.8368279533600389,"y":0.4066173420594918},{"x":0.8368279533600389,"y":0.40032628440496204},{"x":0.8403510601479035,"y":0.38774416909590104},{"x":0.8403510601479035,"y":0.3688709961323104},{"x":0.8403510601479035,"y":0.36257993847778}]')},function(t){t.exports=JSON.parse('[{"x":0.25199222657452064,"y":0.4129083997140222},{"x":0.2625615469381143,"y":0.40032628440496204},{"x":0.2660846537259789,"y":0.39403522675043157},{"x":0.273130867301708,"y":0.37516205378684087},{"x":0.28370018766530175,"y":0.3499978231687197},{"x":0.29779261481676,"y":0.33112465020512905},{"x":0.3118850419682183,"y":0.2996693619324774},{"x":0.3189312555439474,"y":0.29337830427794764},{"x":0.32597746911967657,"y":0.2745051313143569},{"x":0.3330236826954057,"y":0.25563195835076624},{"x":0.3400698962711349,"y":0.23675878538717554},{"x":0.35416232342259313,"y":0.2115945547690544},{"x":0.3612085369983223,"y":0.20530349711452392},{"x":0.36473164378618683,"y":0.19901243945999347},{"x":0.36825475057405127,"y":0.1927213818054637},{"x":0.37177785736191593,"y":0.1927213818054637},{"x":0.3753009641497805,"y":0.1927213818054637},{"x":0.37882407093764503,"y":0.1927213818054637},{"x":0.3858702845133742,"y":0.2115945547690544},{"x":0.40348581845269704,"y":0.23675878538717554},{"x":0.41053203202842614,"y":0.24934090069623577},{"x":0.42110135239201985,"y":0.2745051313143569},{"x":0.43519377954347815,"y":0.30596041958700787},{"x":0.44928620669493646,"y":0.33112465020512905},{"x":0.4633786338463947,"y":0.34370676551418927},{"x":0.47747106099785297,"y":0.3688709961323104},{"x":0.4880403813614467,"y":0.3814531114413706},{"x":0.4915634881493113,"y":0.38774416909590104},{"x":0.5056559153007696,"y":0.4066173420594918},{"x":0.5127021288764987,"y":0.4191994573685527},{"x":0.5197483424522278,"y":0.4317815726776129},{"x":0.5267945560279569,"y":0.44436368798667314},{"x":0.533840769603686,"y":0.4695279186047943},{"x":0.5444100899672797,"y":0.488401091568385},{"x":0.5585025171187381,"y":0.5198563798410366},{"x":0.5655487306944671,"y":0.5387295528046273},{"x":0.5761180510580608,"y":0.5764758987318087},{"x":0.5866873714216545,"y":0.5953490716953994},{"x":0.5937335849973837,"y":0.6205133023135205},{"x":0.6078260121488419,"y":0.645677532931641},{"x":0.6183953325124357,"y":0.6645507058952324},{"x":0.6219184393003003,"y":0.6771328212042926},{"x":0.6254415460881648,"y":0.683423878858823},{"x":0.6289646528760294,"y":0.683423878858823},{"x":0.632487759663894,"y":0.6897149365133528},{"x":0.6360108664517586,"y":0.6897149365133528},{"x":0.6395339732396231,"y":0.6897149365133528},{"x":0.6465801868153522,"y":0.6897149365133528},{"x":0.6501032936032168,"y":0.683423878858823},{"x":0.657149507178946,"y":0.6771328212042926},{"x":0.657149507178946,"y":0.6708417635497622},{"x":0.6677188275425396,"y":0.645677532931641},{"x":0.6712419343304041,"y":0.6330954176225808},{"x":0.6782881479061333,"y":0.6079311870044597},{"x":0.6853343614818626,"y":0.5827669563863392},{"x":0.6959036818454561,"y":0.5513116681136875},{"x":0.7029498954211852,"y":0.5072742645319757},{"x":0.7029498954211852,"y":0.47581897625932473},{"x":0.7099961089969145,"y":0.4380726303321434},{"x":0.713519215784779,"y":0.4066173420594918},{"x":0.7205654293605082,"y":0.38774416909590104},{"x":0.7205654293605082,"y":0.35628888082325016},{"x":0.7240885361483727,"y":0.33112465020512905},{"x":0.7276116429362374,"y":0.3122514772415383},{"x":0.7276116429362374,"y":0.30596041958700787},{"x":0.7276116429362374,"y":0.29337830427794764},{"x":0.7276116429362374,"y":0.28708724662341717},{"x":0.7276116429362374,"y":0.28079618896888675},{"x":0.7276116429362374,"y":0.2745051313143569},{"x":0.7276116429362374,"y":0.26821407365982647},{"x":0.7276116429362374,"y":0.261923016005296},{"x":0.7276116429362374,"y":0.25563195835076624},{"x":0.7240885361483727,"y":0.25563195835076624},{"x":0.7240885361483727,"y":0.24934090069623577},{"x":0.7170423225726436,"y":0.24934090069623577},{"x":0.713519215784779,"y":0.24934090069623577},{"x":0.70647300220905,"y":0.24934090069623577},{"x":0.7029498954211852,"y":0.24934090069623577},{"x":0.6994267886333208,"y":0.24934090069623577},{"x":0.6959036818454561,"y":0.24934090069623577},{"x":0.6923805750575915,"y":0.24934090069623577},{"x":0.688857468269727,"y":0.24934090069623577},{"x":0.6818112546939978,"y":0.24934090069623577},{"x":0.6782881479061333,"y":0.24934090069623577},{"x":0.6712419343304041,"y":0.25563195835076624},{"x":0.6641957207546751,"y":0.25563195835076624},{"x":0.6536264003910814,"y":0.261923016005296},{"x":0.6465801868153522,"y":0.26821407365982647},{"x":0.6360108664517586,"y":0.26821407365982647},{"x":0.6183953325124357,"y":0.28708724662341717},{"x":0.6113491189367066,"y":0.28708724662341717},{"x":0.5972566917852483,"y":0.29337830427794764},{"x":0.5866873714216545,"y":0.2996693619324774},{"x":0.5761180510580608,"y":0.30596041958700787},{"x":0.5620256239066026,"y":0.3122514772415383},{"x":0.5514563035430089,"y":0.3122514772415383},{"x":0.5408869831794152,"y":0.31854253489606876},{"x":0.533840769603686,"y":0.31854253489606876},{"x":0.5232714492400923,"y":0.31854253489606876},{"x":0.5197483424522278,"y":0.33112465020512905},{"x":0.5127021288764987,"y":0.33112465020512905},{"x":0.5056559153007696,"y":0.33741570785965946},{"x":0.502132808512905,"y":0.33741570785965946},{"x":0.49508659493717583,"y":0.34370676551418927},{"x":0.4915634881493113,"y":0.34370676551418927},{"x":0.4809941677857176,"y":0.3499978231687197},{"x":0.47042484742212387,"y":0.3499978231687197},{"x":0.4633786338463947,"y":0.35628888082325016},{"x":0.45985552705853017,"y":0.35628888082325016},{"x":0.44928620669493646,"y":0.3688709961323104},{"x":0.4422399931192073,"y":0.3688709961323104},{"x":0.4316706727556136,"y":0.37516205378684087},{"x":0.42110135239201985,"y":0.37516205378684087},{"x":0.41053203202842614,"y":0.3814531114413706},{"x":0.4070089252405616,"y":0.38774416909590104},{"x":0.3964396048769679,"y":0.39403522675043157},{"x":0.39291649808910334,"y":0.39403522675043157},{"x":0.3858702845133742,"y":0.39403522675043157},{"x":0.38234717772550963,"y":0.39403522675043157},{"x":0.37882407093764503,"y":0.40032628440496204},{"x":0.3753009641497805,"y":0.4066173420594918},{"x":0.37177785736191593,"y":0.4129083997140222},{"x":0.36825475057405127,"y":0.4129083997140222},{"x":0.3576854302104577,"y":0.4129083997140222},{"x":0.35416232342259313,"y":0.4191994573685527},{"x":0.347116109846864,"y":0.4254905150230825},{"x":0.3435930030589994,"y":0.4254905150230825},{"x":0.3400698962711349,"y":0.4254905150230825},{"x":0.33654678948327027,"y":0.4254905150230825},{"x":0.3295005759075411,"y":0.4317815726776129},{"x":0.32597746911967657,"y":0.4317815726776129},{"x":0.322454362331812,"y":0.4317815726776129},{"x":0.3189312555439474,"y":0.4317815726776129},{"x":0.3189312555439474,"y":0.44436368798667314},{"x":0.31540814875608286,"y":0.44436368798667314},{"x":0.3118850419682183,"y":0.45065474564120367},{"x":0.3083619351803537,"y":0.45065474564120367},{"x":0.30483882839248916,"y":0.45065474564120367},{"x":0.3013157216046246,"y":0.45065474564120367},{"x":0.29779261481676,"y":0.45065474564120367},{"x":0.2907464012410309,"y":0.45065474564120367},{"x":0.2872232944531663,"y":0.45065474564120367},{"x":0.28370018766530175,"y":0.45065474564120367},{"x":0.2801770808774372,"y":0.45694580329573403},{"x":0.2766539740895726,"y":0.45694580329573403},{"x":0.273130867301708,"y":0.45694580329573403},{"x":0.2696077605138435,"y":0.45694580329573403},{"x":0.2660846537259789,"y":0.45694580329573403},{"x":0.2625615469381143,"y":0.45065474564120367},{"x":0.2625615469381143,"y":0.44436368798667314},{"x":0.2590384401502498,"y":0.44436368798667314},{"x":0.2590384401502498,"y":0.4380726303321434},{"x":0.2590384401502498,"y":0.4317815726776129},{"x":0.2555153333623852,"y":0.4317815726776129},{"x":0.25199222657452064,"y":0.4254905150230825},{"x":0.24846911978665606,"y":0.4254905150230825}]')},function(t){t.exports=JSON.parse('[{"x":0.18505319760509384,"y":0.23675878538717554},{"x":0.18505319760509384,"y":0.23046772773264507},{"x":0.18153009081722926,"y":0.22417667007811462},{"x":0.17448387724150013,"y":0.22417667007811462},{"x":0.1709607704536356,"y":0.23046772773264507},{"x":0.167437663665771,"y":0.23675878538717554},{"x":0.16391455687790643,"y":0.24304984304170532},{"x":0.16039145009004185,"y":0.24934090069623577},{"x":0.15334523651431273,"y":0.26821407365982647},{"x":0.13925280936285445,"y":0.28708724662341717},{"x":0.13925280936285445,"y":0.2996693619324774},{"x":0.12868348899926074,"y":0.33112465020512905},{"x":0.12516038221139617,"y":0.34370676551418927},{"x":0.12163727542353162,"y":0.3688709961323104},{"x":0.11459106184780245,"y":0.39403522675043157},{"x":0.11106795505993791,"y":0.4129083997140222},{"x":0.11106795505993791,"y":0.4254905150230825},{"x":0.11106795505993791,"y":0.4380726303321434},{"x":0.11106795505993791,"y":0.45694580329573403},{"x":0.11106795505993791,"y":0.46323686095026384},{"x":0.11106795505993791,"y":0.48211003391385454},{"x":0.11106795505993791,"y":0.488401091568385},{"x":0.11106795505993791,"y":0.5009832068774459},{"x":0.11106795505993791,"y":0.5072742645319757},{"x":0.11106795505993791,"y":0.5135653221865062},{"x":0.11459106184780245,"y":0.5261474374955664},{"x":0.12163727542353162,"y":0.5261474374955664},{"x":0.12868348899926074,"y":0.5324384951500969},{"x":0.13925280936285445,"y":0.5324384951500969},{"x":0.15334523651431273,"y":0.5324384951500969},{"x":0.1780069840293647,"y":0.5387295528046273},{"x":0.19562251796868754,"y":0.5387295528046273},{"x":0.22380737227160408,"y":0.5387295528046273},{"x":0.2555153333623852,"y":0.5387295528046273},{"x":0.28370018766530175,"y":0.5387295528046273},{"x":0.3189312555439474,"y":0.5387295528046273},{"x":0.3435930030589994,"y":0.5324384951500969},{"x":0.3576854302104577,"y":0.5198563798410366},{"x":0.36473164378618683,"y":0.5135653221865062},{"x":0.37177785736191593,"y":0.5009832068774459},{"x":0.3753009641497805,"y":0.4946921492229155},{"x":0.37882407093764503,"y":0.48211003391385454},{"x":0.38234717772550963,"y":0.47581897625932473},{"x":0.38234717772550963,"y":0.46323686095026384},{"x":0.38234717772550963,"y":0.44436368798667314},{"x":0.38234717772550963,"y":0.4317815726776129},{"x":0.38234717772550963,"y":0.4066173420594918},{"x":0.38234717772550963,"y":0.39403522675043157},{"x":0.38234717772550963,"y":0.3814531114413706},{"x":0.38234717772550963,"y":0.36257993847778},{"x":0.38234717772550963,"y":0.3499978231687197},{"x":0.38234717772550963,"y":0.34370676551418927},{"x":0.37882407093764503,"y":0.33112465020512905},{"x":0.3753009641497805,"y":0.3122514772415383},{"x":0.37177785736191593,"y":0.30596041958700787},{"x":0.3612085369983223,"y":0.28708724662341717},{"x":0.35416232342259313,"y":0.2745051313143569},{"x":0.347116109846864,"y":0.261923016005296},{"x":0.3435930030589994,"y":0.24934090069623577},{"x":0.3400698962711349,"y":0.24304984304170532},{"x":0.3330236826954057,"y":0.23675878538717554},{"x":0.322454362331812,"y":0.23046772773264507},{"x":0.3118850419682183,"y":0.22417667007811462},{"x":0.3013157216046246,"y":0.21788561242358415},{"x":0.2907464012410309,"y":0.21788561242358415},{"x":0.2801770808774372,"y":0.21788561242358415},{"x":0.2696077605138435,"y":0.21788561242358415},{"x":0.2590384401502498,"y":0.21788561242358415},{"x":0.2555153333623852,"y":0.21788561242358415},{"x":0.24846911978665606,"y":0.21788561242358415},{"x":0.23789979942306236,"y":0.21788561242358415},{"x":0.23437669263519778,"y":0.21788561242358415},{"x":0.22380737227160408,"y":0.21788561242358415},{"x":0.21676115869587495,"y":0.21788561242358415},{"x":0.20619183833228125,"y":0.21788561242358415},{"x":0.20266873154441667,"y":0.22417667007811462},{"x":0.19562251796868754,"y":0.23046772773264507},{"x":0.1885763043929584,"y":0.23675878538717554},{"x":0.18505319760509384,"y":0.24304984304170532},{"x":0.18153009081722926,"y":0.24304984304170532},{"x":0.1780069840293647,"y":0.24934090069623577},{"x":0.1709607704536356,"y":0.261923016005296},{"x":0.167437663665771,"y":0.2745051313143569},{"x":0.167437663665771,"y":0.28079618896888675},{"x":0.17448387724150013,"y":0.28079618896888675},{"x":0.1885763043929584,"y":0.28079618896888675},{"x":0.20266873154441667,"y":0.26821407365982647},{"x":0.22028426548373953,"y":0.24934090069623577},{"x":0.24494601299879154,"y":0.24304984304170532},{"x":0.2625615469381143,"y":0.23046772773264507},{"x":0.28370018766530175,"y":0.2115945547690544},{"x":0.3013157216046246,"y":0.20530349711452392},{"x":0.3189312555439474,"y":0.20530349711452392},{"x":0.3295005759075411,"y":0.19901243945999347},{"x":0.347116109846864,"y":0.1927213818054637},{"x":0.3576854302104577,"y":0.1927213818054637},{"x":0.3753009641497805,"y":0.1927213818054637},{"x":0.38234717772550963,"y":0.18643032415093325},{"x":0.39996271166483244,"y":0.18643032415093325},{"x":0.41053203202842614,"y":0.18013926649640277},{"x":0.42462445917988445,"y":0.18013926649640277},{"x":0.44928620669493646,"y":0.16755715118734255},{"x":0.45985552705853017,"y":0.16755715118734255},{"x":0.47747106099785297,"y":0.16755715118734255},{"x":0.4915634881493113,"y":0.16755715118734255},{"x":0.5056559153007696,"y":0.16755715118734255},{"x":0.5162252356643633,"y":0.16755715118734255},{"x":0.5267945560279569,"y":0.16755715118734255},{"x":0.5479331967551443,"y":0.173848208841873},{"x":0.5514563035430089,"y":0.18013926649640277},{"x":0.5620256239066026,"y":0.18013926649640277},{"x":0.5761180510580608,"y":0.18643032415093325},{"x":0.5866873714216545,"y":0.18643032415093325},{"x":0.6078260121488419,"y":0.1927213818054637},{"x":0.6254415460881648,"y":0.1927213818054637},{"x":0.6360108664517586,"y":0.1927213818054637},{"x":0.6641957207546751,"y":0.1927213818054637},{"x":0.6782881479061333,"y":0.19901243945999347},{"x":0.7029498954211852,"y":0.19901243945999347},{"x":0.7170423225726436,"y":0.2115945547690544},{"x":0.7276116429362374,"y":0.2115945547690544},{"x":0.7346578565119664,"y":0.21788561242358415},{"x":0.7452271768755602,"y":0.21788561242358415},{"x":0.7522733904512893,"y":0.21788561242358415},{"x":0.7593196040270185,"y":0.21788561242358415},{"x":0.7663658176027476,"y":0.22417667007811462},{"x":0.7734120311784767,"y":0.23046772773264507},{"x":0.7769351379663412,"y":0.23046772773264507},{"x":0.7804582447542059,"y":0.23046772773264507},{"x":0.7804582447542059,"y":0.23675878538717554},{"x":0.787504458329935,"y":0.23675878538717554},{"x":0.7910275651177996,"y":0.24934090069623577},{"x":0.7945506719056641,"y":0.24934090069623577},{"x":0.7945506719056641,"y":0.25563195835076624},{"x":0.7980737786935287,"y":0.261923016005296},{"x":0.7980737786935287,"y":0.26821407365982647},{"x":0.8015968854813933,"y":0.26821407365982647},{"x":0.8051199922692579,"y":0.28079618896888675},{"x":0.8051199922692579,"y":0.29337830427794764},{"x":0.8086430990571224,"y":0.30596041958700787},{"x":0.812166205844987,"y":0.3248335925505985},{"x":0.8156893126328515,"y":0.33741570785965946},{"x":0.8156893126328515,"y":0.34370676551418927},{"x":0.8192124194207161,"y":0.35628888082325016},{"x":0.8227355262085807,"y":0.37516205378684087},{"x":0.8227355262085807,"y":0.3814531114413706},{"x":0.8262586329964453,"y":0.39403522675043157},{"x":0.8262586329964453,"y":0.4129083997140222},{"x":0.8262586329964453,"y":0.4254905150230825},{"x":0.8262586329964453,"y":0.4380726303321434},{"x":0.8262586329964453,"y":0.45694580329573403},{"x":0.8262586329964453,"y":0.4695279186047943},{"x":0.8262586329964453,"y":0.488401091568385},{"x":0.8262586329964453,"y":0.5009832068774459},{"x":0.8227355262085807,"y":0.5072742645319757},{"x":0.8156893126328515,"y":0.5198563798410366},{"x":0.812166205844987,"y":0.5324384951500969},{"x":0.8086430990571224,"y":0.5324384951500969},{"x":0.8051199922692579,"y":0.5450206104591572},{"x":0.7980737786935287,"y":0.5450206104591572},{"x":0.7945506719056641,"y":0.5450206104591572},{"x":0.7839813515420705,"y":0.5638937834227478},{"x":0.7769351379663412,"y":0.5638937834227478},{"x":0.7663658176027476,"y":0.5638937834227478},{"x":0.7557964972391538,"y":0.5701848410772782},{"x":0.7452271768755602,"y":0.5701848410772782},{"x":0.738180963299831,"y":0.5701848410772782},{"x":0.7276116429362374,"y":0.5701848410772782},{"x":0.7170423225726436,"y":0.5701848410772782},{"x":0.713519215784779,"y":0.5701848410772782},{"x":0.6994267886333208,"y":0.5701848410772782},{"x":0.6923805750575915,"y":0.5701848410772782},{"x":0.6818112546939978,"y":0.5638937834227478},{"x":0.6677188275425396,"y":0.557602725768218},{"x":0.6501032936032168,"y":0.5450206104591572},{"x":0.6395339732396231,"y":0.5387295528046273},{"x":0.6289646528760294,"y":0.5324384951500969},{"x":0.6183953325124357,"y":0.5198563798410366},{"x":0.6113491189367066,"y":0.5135653221865062},{"x":0.5972566917852483,"y":0.5009832068774459},{"x":0.5902104782095192,"y":0.5009832068774459},{"x":0.5866873714216545,"y":0.488401091568385},{"x":0.58316426463379,"y":0.488401091568385},{"x":0.5796411578459255,"y":0.47581897625932473},{"x":0.5796411578459255,"y":0.46323686095026384},{"x":0.5761180510580608,"y":0.45694580329573403},{"x":0.5761180510580608,"y":0.45065474564120367},{"x":0.5761180510580608,"y":0.4380726303321434},{"x":0.5761180510580608,"y":0.4317815726776129},{"x":0.5761180510580608,"y":0.4129083997140222},{"x":0.5761180510580608,"y":0.38774416909590104},{"x":0.58316426463379,"y":0.36257993847778},{"x":0.5937335849973837,"y":0.33741570785965946},{"x":0.5972566917852483,"y":0.3248335925505985},{"x":0.6078260121488419,"y":0.30596041958700787},{"x":0.6148722257245711,"y":0.29337830427794764},{"x":0.6219184393003003,"y":0.28708724662341717},{"x":0.6289646528760294,"y":0.28079618896888675},{"x":0.632487759663894,"y":0.261923016005296},{"x":0.6395339732396231,"y":0.25563195835076624},{"x":0.657149507178946,"y":0.23675878538717554},{"x":0.6606726139668105,"y":0.23046772773264507},{"x":0.6747650411182687,"y":0.2115945547690544},{"x":0.688857468269727,"y":0.19901243945999347},{"x":0.7029498954211852,"y":0.18643032415093325},{"x":0.713519215784779,"y":0.18013926649640277},{"x":0.7205654293605082,"y":0.173848208841873},{"x":0.7240885361483727,"y":0.1612660935328121},{"x":0.7311347497241019,"y":0.1612660935328121},{"x":0.738180963299831,"y":0.1612660935328121},{"x":0.7417040700876956,"y":0.1612660935328121},{"x":0.7452271768755602,"y":0.1612660935328121},{"x":0.7487502836634248,"y":0.1612660935328121},{"x":0.7522733904512893,"y":0.1612660935328121},{"x":0.7557964972391538,"y":0.1612660935328121},{"x":0.7593196040270185,"y":0.1612660935328121},{"x":0.762842710814883,"y":0.173848208841873},{"x":0.7663658176027476,"y":0.18013926649640277},{"x":0.7663658176027476,"y":0.1927213818054637},{"x":0.7698889243906122,"y":0.2115945547690544},{"x":0.7734120311784767,"y":0.2115945547690544},{"x":0.7769351379663412,"y":0.21788561242358415},{"x":0.7839813515420705,"y":0.23675878538717554},{"x":0.7910275651177996,"y":0.24934090069623577},{"x":0.7910275651177996,"y":0.25563195835076624},{"x":0.7980737786935287,"y":0.2745051313143569},{"x":0.8015968854813933,"y":0.28079618896888675},{"x":0.8015968854813933,"y":0.2996693619324774},{"x":0.8086430990571224,"y":0.30596041958700787},{"x":0.8086430990571224,"y":0.3122514772415383},{"x":0.8086430990571224,"y":0.33112465020512905},{"x":0.8086430990571224,"y":0.33741570785965946},{"x":0.812166205844987,"y":0.34370676551418927},{"x":0.8156893126328515,"y":0.35628888082325016},{"x":0.8156893126328515,"y":0.3688709961323104},{"x":0.8156893126328515,"y":0.37516205378684087},{"x":0.8156893126328515,"y":0.3814531114413706},{"x":0.8156893126328515,"y":0.38774416909590104},{"x":0.8192124194207161,"y":0.40032628440496204},{"x":0.8227355262085807,"y":0.40032628440496204},{"x":0.8227355262085807,"y":0.4066173420594918},{"x":0.8262586329964453,"y":0.4129083997140222},{"x":0.8262586329964453,"y":0.4191994573685527},{"x":0.8262586329964453,"y":0.4254905150230825},{"x":0.8262586329964453,"y":0.4317815726776129},{"x":0.8262586329964453,"y":0.4380726303321434},{"x":0.8262586329964453,"y":0.44436368798667314},{"x":0.8262586329964453,"y":0.45065474564120367},{"x":0.8262586329964453,"y":0.45694580329573403},{"x":0.8227355262085807,"y":0.4695279186047943},{"x":0.8227355262085807,"y":0.47581897625932473},{"x":0.8156893126328515,"y":0.488401091568385},{"x":0.8086430990571224,"y":0.4946921492229155},{"x":0.8015968854813933,"y":0.5135653221865062},{"x":0.7945506719056641,"y":0.5135653221865062},{"x":0.7839813515420705,"y":0.5198563798410366},{"x":0.7734120311784767,"y":0.5261474374955664},{"x":0.762842710814883,"y":0.5324384951500969},{"x":0.7557964972391538,"y":0.5387295528046273},{"x":0.7522733904512893,"y":0.5387295528046273},{"x":0.7417040700876956,"y":0.5513116681136875},{"x":0.7346578565119664,"y":0.5513116681136875},{"x":0.7276116429362374,"y":0.557602725768218},{"x":0.7240885361483727,"y":0.557602725768218},{"x":0.7170423225726436,"y":0.557602725768218},{"x":0.7099961089969145,"y":0.557602725768218},{"x":0.70647300220905,"y":0.557602725768218},{"x":0.6959036818454561,"y":0.557602725768218},{"x":0.6923805750575915,"y":0.557602725768218},{"x":0.6853343614818626,"y":0.557602725768218},{"x":0.6782881479061333,"y":0.557602725768218},{"x":0.6712419343304041,"y":0.557602725768218},{"x":0.6641957207546751,"y":0.557602725768218},{"x":0.6536264003910814,"y":0.557602725768218},{"x":0.6501032936032168,"y":0.5513116681136875},{"x":0.6501032936032168,"y":0.5450206104591572},{"x":0.6430570800274877,"y":0.5387295528046273},{"x":0.6395339732396231,"y":0.5324384951500969},{"x":0.6360108664517586,"y":0.5324384951500969},{"x":0.6360108664517586,"y":0.5261474374955664},{"x":0.632487759663894,"y":0.5198563798410366},{"x":0.6289646528760294,"y":0.5198563798410366},{"x":0.6254415460881648,"y":0.5198563798410366},{"x":0.6219184393003003,"y":0.5198563798410366},{"x":0.6183953325124357,"y":0.5198563798410366},{"x":0.6148722257245711,"y":0.5198563798410366},{"x":0.6113491189367066,"y":0.5198563798410366},{"x":0.6078260121488419,"y":0.5198563798410366},{"x":0.6007797985731129,"y":0.5198563798410366},{"x":0.5972566917852483,"y":0.5198563798410366},{"x":0.5972566917852483,"y":0.5135653221865062},{"x":0.5937335849973837,"y":0.5135653221865062},{"x":0.5902104782095192,"y":0.5135653221865062},{"x":0.5866873714216545,"y":0.5135653221865062},{"x":0.5796411578459255,"y":0.5135653221865062},{"x":0.5761180510580608,"y":0.5135653221865062},{"x":0.5690718374823318,"y":0.5135653221865062},{"x":0.5655487306944671,"y":0.5135653221865062},{"x":0.5620256239066026,"y":0.5135653221865062},{"x":0.5585025171187381,"y":0.5135653221865062},{"x":0.5549794103308734,"y":0.5135653221865062},{"x":0.5479331967551443,"y":0.5135653221865062},{"x":0.5444100899672797,"y":0.5135653221865062},{"x":0.5408869831794152,"y":0.5135653221865062},{"x":0.533840769603686,"y":0.5135653221865062},{"x":0.5303176628158215,"y":0.5198563798410366},{"x":0.5267945560279569,"y":0.5198563798410366},{"x":0.5232714492400923,"y":0.5261474374955664},{"x":0.5197483424522278,"y":0.5324384951500969},{"x":0.5127021288764987,"y":0.5324384951500969},{"x":0.5127021288764987,"y":0.5387295528046273},{"x":0.5056559153007696,"y":0.5387295528046273},{"x":0.502132808512905,"y":0.5387295528046273},{"x":0.4986097017250404,"y":0.5513116681136875},{"x":0.49508659493717583,"y":0.5513116681136875},{"x":0.4915634881493113,"y":0.557602725768218},{"x":0.4845172745735821,"y":0.5638937834227478},{"x":0.4845172745735821,"y":0.5701848410772782},{"x":0.4809941677857176,"y":0.5701848410772782},{"x":0.47747106099785297,"y":0.5701848410772782},{"x":0.4739479542099884,"y":0.5764758987318087},{"x":0.4739479542099884,"y":0.5827669563863392},{"x":0.47042484742212387,"y":0.589058014040869},{"x":0.46690174063425927,"y":0.589058014040869},{"x":0.4633786338463947,"y":0.5953490716953994},{"x":0.45985552705853017,"y":0.6016401293499298},{"x":0.45633242027066556,"y":0.6079311870044597},{"x":0.452809313482801,"y":0.6205133023135205},{"x":0.44928620669493646,"y":0.6330954176225808},{"x":0.44576309990707186,"y":0.6393864752771112},{"x":0.4387168863313427,"y":0.645677532931641},{"x":0.43519377954347815,"y":0.6645507058952324},{"x":0.428147565967749,"y":0.6708417635497622},{"x":0.42462445917988445,"y":0.683423878858823},{"x":0.41405513881629075,"y":0.7022970518224138},{"x":0.41053203202842614,"y":0.714879167131474},{"x":0.39996271166483244,"y":0.7337523400950647},{"x":0.38939339130123873,"y":0.7526255130586553},{"x":0.3858702845133742,"y":0.7589165707131859},{"x":0.38234717772550963,"y":0.7652076283677164},{"x":0.37882407093764503,"y":0.7777897436767764},{"x":0.36825475057405127,"y":0.7903718589858367},{"x":0.36473164378618683,"y":0.7966629166403673},{"x":0.3576854302104577,"y":0.8092450319494274},{"x":0.35416232342259313,"y":0.815536089603958},{"x":0.347116109846864,"y":0.8281182049130188},{"x":0.33654678948327027,"y":0.8469913778766095},{"x":0.3330236826954057,"y":0.8532824355311394},{"x":0.32597746911967657,"y":0.8595734931856698},{"x":0.322454362331812,"y":0.8784466661492604},{"x":0.3118850419682183,"y":0.8910287814583207},{"x":0.30483882839248916,"y":0.8973198391128512},{"x":0.29779261481676,"y":0.9099019544219121},{"x":0.29426950802889545,"y":0.9161930120764419},{"x":0.2907464012410309,"y":0.9161930120764419},{"x":0.2801770808774372,"y":0.9287751273855027},{"x":0.2766539740895726,"y":0.9287751273855027},{"x":0.273130867301708,"y":0.941357242694563},{"x":0.2696077605138435,"y":0.9476483003490933},{"x":0.2660846537259789,"y":0.9539393580036231},{"x":0.2625615469381143,"y":0.9539393580036231},{"x":0.2625615469381143,"y":0.9602304156581536},{"x":0.2590384401502498,"y":0.9602304156581536},{"x":0.2590384401502498,"y":0.9665214733126841},{"x":0.2555153333623852,"y":0.9728125309672139},{"x":0.25199222657452064,"y":0.9791035886217444},{"x":0.24846911978665606,"y":0.9853946462762748},{"x":0.24846911978665606,"y":0.9791035886217444},{"x":0.2555153333623852,"y":0.9665214733126841},{"x":0.2590384401502498,"y":0.9602304156581536},{"x":0.2625615469381143,"y":0.941357242694563},{"x":0.273130867301708,"y":0.9287751273855027},{"x":0.2801770808774372,"y":0.9161930120764419},{"x":0.2872232944531663,"y":0.8973198391128512},{"x":0.29779261481676,"y":0.87215560849473},{"x":0.3083619351803537,"y":0.8469913778766095},{"x":0.3295005759075411,"y":0.8281182049130188},{"x":0.3435930030589994,"y":0.8029539742948977},{"x":0.3506392166347286,"y":0.784080801331307},{"x":0.3576854302104577,"y":0.784080801331307},{"x":0.36473164378618683,"y":0.7714986860222461},{"x":0.3753009641497805,"y":0.7526255130586553},{"x":0.37882407093764503,"y":0.7463344554041256},{"x":0.38234717772550963,"y":0.7463344554041256},{"x":0.38939339130123873,"y":0.7337523400950647},{"x":0.3964396048769679,"y":0.714879167131474},{"x":0.39996271166483244,"y":0.7085881094769435},{"x":0.4070089252405616,"y":0.6960059941678833},{"x":0.4175782456041553,"y":0.683423878858823},{"x":0.42462445917988445,"y":0.6645507058952324},{"x":0.428147565967749,"y":0.6582596482407019},{"x":0.43519377954347815,"y":0.6519685905861715},{"x":0.4387168863313427,"y":0.6519685905861715},{"x":0.4422399931192073,"y":0.645677532931641},{"x":0.44576309990707186,"y":0.645677532931641},{"x":0.452809313482801,"y":0.6330954176225808},{"x":0.45633242027066556,"y":0.6330954176225808},{"x":0.45985552705853017,"y":0.6393864752771112},{"x":0.45985552705853017,"y":0.645677532931641},{"x":0.45985552705853017,"y":0.6519685905861715},{"x":0.4633786338463947,"y":0.6645507058952324},{"x":0.4633786338463947,"y":0.6708417635497622},{"x":0.4633786338463947,"y":0.6771328212042926},{"x":0.4633786338463947,"y":0.683423878858823},{"x":0.46690174063425927,"y":0.6897149365133528},{"x":0.46690174063425927,"y":0.7085881094769435},{"x":0.47042484742212387,"y":0.7211702247860045},{"x":0.47042484742212387,"y":0.7337523400950647},{"x":0.4739479542099884,"y":0.7463344554041256},{"x":0.47747106099785297,"y":0.7526255130586553},{"x":0.47747106099785297,"y":0.7589165707131859},{"x":0.4809941677857176,"y":0.7652076283677164},{"x":0.4845172745735821,"y":0.7777897436767764},{"x":0.4845172745735821,"y":0.784080801331307},{"x":0.4880403813614467,"y":0.7903718589858367},{"x":0.49508659493717583,"y":0.7966629166403673},{"x":0.49508659493717583,"y":0.8029539742948977},{"x":0.4986097017250404,"y":0.8029539742948977},{"x":0.502132808512905,"y":0.8092450319494274},{"x":0.5091790220886342,"y":0.8218271472584885},{"x":0.5127021288764987,"y":0.8281182049130188},{"x":0.5197483424522278,"y":0.8344092625675485},{"x":0.5232714492400923,"y":0.8407003202220791},{"x":0.5267945560279569,"y":0.8407003202220791},{"x":0.5373638763915506,"y":0.8469913778766095},{"x":0.5408869831794152,"y":0.8532824355311394},{"x":0.5444100899672797,"y":0.8532824355311394},{"x":0.5514563035430089,"y":0.8658645508402001},{"x":0.5549794103308734,"y":0.8658645508402001},{"x":0.5585025171187381,"y":0.8658645508402001},{"x":0.5620256239066026,"y":0.8658645508402001},{"x":0.5725949442701963,"y":0.87215560849473},{"x":0.5761180510580608,"y":0.8784466661492604},{"x":0.5796411578459255,"y":0.8784466661492604},{"x":0.5866873714216545,"y":0.8784466661492604},{"x":0.5972566917852483,"y":0.8847377238037909},{"x":0.6043029053609774,"y":0.8973198391128512},{"x":0.6078260121488419,"y":0.8973198391128512},{"x":0.6183953325124357,"y":0.8973198391128512},{"x":0.6254415460881648,"y":0.9036108967673817},{"x":0.632487759663894,"y":0.9036108967673817},{"x":0.6395339732396231,"y":0.9036108967673817},{"x":0.6430570800274877,"y":0.9099019544219121},{"x":0.6536264003910814,"y":0.9099019544219121},{"x":0.6712419343304041,"y":0.9099019544219121},{"x":0.6853343614818626,"y":0.9099019544219121},{"x":0.6994267886333208,"y":0.9099019544219121},{"x":0.7205654293605082,"y":0.9099019544219121},{"x":0.738180963299831,"y":0.9099019544219121},{"x":0.7522733904512893,"y":0.9099019544219121},{"x":0.7698889243906122,"y":0.9099019544219121},{"x":0.7804582447542059,"y":0.9099019544219121},{"x":0.7910275651177996,"y":0.9099019544219121},{"x":0.7945506719056641,"y":0.9099019544219121},{"x":0.7980737786935287,"y":0.9036108967673817},{"x":0.8051199922692579,"y":0.9036108967673817},{"x":0.812166205844987,"y":0.8973198391128512},{"x":0.8156893126328515,"y":0.8910287814583207},{"x":0.8192124194207161,"y":0.8847377238037909},{"x":0.8227355262085807,"y":0.8784466661492604},{"x":0.8262586329964453,"y":0.8784466661492604},{"x":0.8297817397843098,"y":0.8658645508402001},{"x":0.8297817397843098,"y":0.8595734931856698},{"x":0.8333048465721744,"y":0.8595734931856698},{"x":0.8333048465721744,"y":0.8469913778766095},{"x":0.8368279533600389,"y":0.8407003202220791},{"x":0.8368279533600389,"y":0.8281182049130188},{"x":0.8368279533600389,"y":0.8218271472584885},{"x":0.8403510601479035,"y":0.815536089603958},{"x":0.8473972737236327,"y":0.8092450319494274},{"x":0.8544434872993618,"y":0.784080801331307},{"x":0.8544434872993618,"y":0.7777897436767764},{"x":0.8544434872993618,"y":0.7714986860222461},{"x":0.8614897008750909,"y":0.7652076283677164},{"x":0.8614897008750909,"y":0.7526255130586553},{"x":0.8614897008750909,"y":0.7463344554041256},{"x":0.8650128076629555,"y":0.7463344554041256},{"x":0.8650128076629555,"y":0.740043397749595},{"x":0.8685359144508201,"y":0.740043397749595},{"x":0.8720590212386846,"y":0.7337523400950647}]')},function(t,e,i){var n;t.exports=((n=function(){function t(t){return r.appendChild(t.dom),t}function e(t){for(var e=0;eo+1e3&&(h.update(1e3*a/(t-o),100),o=t,a=0,u)){var e=performance.memory;u.update(e.usedJSHeapSize/1048576,e.jsHeapSizeLimit/1048576)}return t},update:function(){s=this.end()},domElement:r,setMode:e}}).Panel=function(t,e,i){var n=1/0,r=0,s=Math.round,o=s(window.devicePixelRatio||1),a=80*o,h=48*o,l=3*o,u=2*o,c=3*o,d=15*o,p=74*o,f=30*o,m=document.createElement("canvas");m.width=a,m.height=h,m.style.cssText="width:80px;height:48px";var g=m.getContext("2d");return g.font="bold "+9*o+"px Helvetica,Arial,sans-serif",g.textBaseline="top",g.fillStyle=i,g.fillRect(0,0,a,h),g.fillStyle=e,g.fillText(t,l,u),g.fillRect(c,d,p,f),g.fillStyle=i,g.globalAlpha=.9,g.fillRect(c,d,p,f),{dom:m,update:function(h,v){n=Math.min(n,h),r=Math.max(r,h),g.fillStyle=i,g.globalAlpha=1,g.fillRect(0,0,a,d),g.fillStyle=e,g.fillText(s(h)+" "+t+" ("+s(n)+"-"+s(r)+")",l,u),g.drawImage(m,c+o,d,p-o,f,c,d,p-o,f),g.fillRect(c+p-o,d,o,f),g.fillStyle=i,g.globalAlpha=.9,g.fillRect(c+p-o,d,o,s((1-h/v)*f))}}},n)},function(t,e,i){"use strict";var n=Object.prototype.hasOwnProperty,r="~";function s(){}function o(t,e,i){this.fn=t,this.context=e,this.once=i||!1}function a(t,e,i,n,s){if("function"!=typeof i)throw new TypeError("The listener must be a function");var a=new o(i,n||t,s),h=r?r+e:e;return t._events[h]?t._events[h].fn?t._events[h]=[t._events[h],a]:t._events[h].push(a):(t._events[h]=a,t._eventsCount++),t}function h(t,e){0==--t._eventsCount?t._events=new s:delete t._events[e]}function l(){this._events=new s,this._eventsCount=0}Object.create&&(s.prototype=Object.create(null),(new s).__proto__||(r=!1)),l.prototype.eventNames=function(){var t,e,i=[];if(0===this._eventsCount)return i;for(e in t=this._events)n.call(t,e)&&i.push(r?e.slice(1):e);return Object.getOwnPropertySymbols?i.concat(Object.getOwnPropertySymbols(t)):i},l.prototype.listeners=function(t){var e=r?r+t:t,i=this._events[e];if(!i)return[];if(i.fn)return[i.fn];for(var n=0,s=i.length,o=new Array(s);ni?this.grow(t):void 0},a.TypedArrayHelper.prototype.shrink=function(t){"use strict";return this.array=this.array.subarray(0,t),this.size=t,this},a.TypedArrayHelper.prototype.grow=function(t){"use strict";var e=this.array,i=new this.TypedArrayConstructor(t);return i.set(e),this.array=i,this.size=t,this},a.TypedArrayHelper.prototype.splice=function(t,e){"use strict";t*=this.componentSize,e*=this.componentSize;for(var i=[],n=this.array,r=n.length,s=0;s=e)&&i.push(n[s]);return this.setFromArray(0,i),this},a.TypedArrayHelper.prototype.setFromArray=function(t,e){"use strict";var i=t+e.length;return i>this.array.length?this.grow(i):i=81&&(this.bufferAttribute.count=this.bufferAttribute.array.length/this.bufferAttribute.itemSize),void(this.bufferAttribute.needsUpdate=!0);this.bufferAttribute=new o.BufferAttribute(this.typedArray.array,this.componentSize),this.bufferAttribute.usage=this.dynamicBuffer?o.DynamicDrawUsage:o.StaticDrawUsage},a.ShaderAttribute.prototype.getLength=function(){"use strict";return null===this.typedArray?0:this.typedArray.array.length},a.shaderChunks={defines:["#define PACKED_COLOR_SIZE 256.0","#define PACKED_COLOR_DIVISOR 255.0"].join("\n"),uniforms:["uniform float deltaTime;","uniform float runTime;","uniform sampler2D tex;","uniform vec4 textureAnimation;","uniform float scale;","uniform float aspectRat;"].join("\n"),attributes:["attribute vec4 acceleration;","attribute vec3 velocity;","attribute vec4 rotation;","attribute vec3 rotationCenter;","attribute vec4 params;","attribute vec4 size;","attribute vec4 angle;","attribute vec4 color;","attribute vec4 opacity;"].join("\n"),varyings:["varying vec4 vColor;","#ifdef SHOULD_ROTATE_TEXTURE"," varying float vAngle;","#endif","#ifdef SHOULD_CALCULATE_SPRITE"," varying vec4 vSpriteSheet;","#endif"].join("\n"),branchAvoidanceFunctions:["float when_gt(float x, float y) {"," return max(sign(x - y), 0.0);","}","float when_lt(float x, float y) {"," return min( max(1.0 - sign(x - y), 0.0), 1.0 );","}","float when_eq( float x, float y ) {"," return 1.0 - abs( sign( x - y ) );","}","float when_ge(float x, float y) {"," return 1.0 - when_lt(x, y);","}","float when_le(float x, float y) {"," return 1.0 - when_gt(x, y);","}","float and(float a, float b) {"," return a * b;","}","float or(float a, float b) {"," return min(a + b, 1.0);","}"].join("\n"),unpackColor:["vec3 unpackColor( in float hex ) {"," vec3 c = vec3( 0.0 );"," float r = mod( (hex / PACKED_COLOR_SIZE / PACKED_COLOR_SIZE), PACKED_COLOR_SIZE );"," float g = mod( (hex / PACKED_COLOR_SIZE), PACKED_COLOR_SIZE );"," float b = mod( hex, PACKED_COLOR_SIZE );"," c.r = r / PACKED_COLOR_DIVISOR;"," c.g = g / PACKED_COLOR_DIVISOR;"," c.b = b / PACKED_COLOR_DIVISOR;"," return c;","}"].join("\n"),unpackRotationAxis:["vec3 unpackRotationAxis( in float hex ) {"," vec3 c = vec3( 0.0 );"," float r = mod( (hex / PACKED_COLOR_SIZE / PACKED_COLOR_SIZE), PACKED_COLOR_SIZE );"," float g = mod( (hex / PACKED_COLOR_SIZE), PACKED_COLOR_SIZE );"," float b = mod( hex, PACKED_COLOR_SIZE );"," c.r = r / PACKED_COLOR_DIVISOR;"," c.g = g / PACKED_COLOR_DIVISOR;"," c.b = b / PACKED_COLOR_DIVISOR;"," c *= vec3( 2.0 );"," c -= vec3( 1.0 );"," return c;","}"].join("\n"),floatOverLifetime:["float getFloatOverLifetime( in float positionInTime, in vec4 attr ) {"," float value = 0.0;"," float deltaAge = positionInTime * float( VALUE_OVER_LIFETIME_LENGTH - 1 );"," float fIndex = 0.0;"," float shouldApplyValue = 0.0;"," value += attr[ 0 ] * when_eq( deltaAge, 0.0 );",""," for( int i = 0; i < VALUE_OVER_LIFETIME_LENGTH; ++i ) {"," fIndex = float( i );"," shouldApplyValue = when_gt( deltaAge, fIndex ) * when_le( deltaAge, fIndex + 1.0 );"," value += shouldApplyValue * mix( attr[ i ], attr[ i + 1 ], deltaAge - fIndex );"," }",""," return value;","}"].join("\n"),colorOverLifetime:["vec3 getColorOverLifetime( in float positionInTime, in vec3 color1, in vec3 color2, in vec3 color3, in vec3 color4 ) {"," vec3 value = vec3( 0.0 );"," value.x = getFloatOverLifetime( positionInTime, vec4( color1.x, color2.x, color3.x, color4.x ) );"," value.y = getFloatOverLifetime( positionInTime, vec4( color1.y, color2.y, color3.y, color4.y ) );"," value.z = getFloatOverLifetime( positionInTime, vec4( color1.z, color2.z, color3.z, color4.z ) );"," return value;","}"].join("\n"),paramFetchingFunctions:["float getAlive() {"," return params.x;","}","float getAge() {"," return params.y;","}","float getMaxAge() {"," return params.z;","}","float getWiggle() {"," return params.w;","}"].join("\n"),forceFetchingFunctions:["vec4 getPosition( in float age ) {"," return modelViewMatrix * vec4( position, 1.0 );","}","vec3 getVelocity( in float age ) {"," return velocity * age;","}","vec3 getAcceleration( in float age ) {"," return acceleration.xyz * age;","}"].join("\n"),rotationFunctions:["#ifdef SHOULD_ROTATE_PARTICLES"," mat4 getRotationMatrix( in vec3 axis, in float angle) {"," axis = normalize(axis);"," float s = sin(angle);"," float c = cos(angle);"," float oc = 1.0 - c;",""," return mat4(oc * axis.x * axis.x + c, oc * axis.x * axis.y - axis.z * s, oc * axis.z * axis.x + axis.y * s, 0.0,"," oc * axis.x * axis.y + axis.z * s, oc * axis.y * axis.y + c, oc * axis.y * axis.z - axis.x * s, 0.0,"," oc * axis.z * axis.x - axis.y * s, oc * axis.y * axis.z + axis.x * s, oc * axis.z * axis.z + c, 0.0,"," 0.0, 0.0, 0.0, 1.0);"," }",""," vec3 getRotation( in vec3 pos, in float positionInTime ) {"," if( rotation.y == 0.0 ) {"," return pos;"," }",""," vec3 axis = unpackRotationAxis( rotation.x );"," vec3 center = rotationCenter;"," vec3 translated;"," mat4 rotationMatrix;"," float angle = 0.0;"," angle += when_eq( rotation.z, 0.0 ) * rotation.y;"," angle += when_gt( rotation.z, 0.0 ) * mix( 0.0, rotation.y, positionInTime );"," translated = rotationCenter - pos;"," rotationMatrix = getRotationMatrix( axis, angle );"," return center - vec3( rotationMatrix * vec4( translated, 0.0 ) );"," }","#endif"].join("\n"),rotateTexture:[" vec2 vUv = vec2( gl_PointCoord.x, 1.0 - gl_PointCoord.y );",""," #ifdef SHOULD_ROTATE_TEXTURE"," float x = gl_PointCoord.x - 0.5;"," float y = 1.0 - gl_PointCoord.y - 0.5;"," float c = cos( -vAngle );"," float s = sin( -vAngle );"," vUv = vec2( c * x + s * y + 0.5, c * y - s * x + 0.5 );"," #endif",""," #ifdef SHOULD_CALCULATE_SPRITE"," float framesX = vSpriteSheet.x;"," float framesY = vSpriteSheet.y;"," float columnNorm = vSpriteSheet.z;"," float rowNorm = vSpriteSheet.w;"," vUv.x = gl_PointCoord.x * framesX + columnNorm;"," vUv.y = 1.0 - (gl_PointCoord.y * framesY + rowNorm);"," #endif",""," vec4 rotatedTexture = texture2D( tex, vUv );"].join("\n")},a.shaders={vertex:[a.shaderChunks.defines,a.shaderChunks.uniforms,a.shaderChunks.attributes,a.shaderChunks.varyings,o.ShaderChunk.common,o.ShaderChunk.logdepthbuf_pars_vertex,o.ShaderChunk.fog_pars_vertex,a.shaderChunks.branchAvoidanceFunctions,a.shaderChunks.unpackColor,a.shaderChunks.unpackRotationAxis,a.shaderChunks.floatOverLifetime,a.shaderChunks.colorOverLifetime,a.shaderChunks.paramFetchingFunctions,a.shaderChunks.forceFetchingFunctions,a.shaderChunks.rotationFunctions,"void main() {"," float age = getAge();"," float alive = getAlive();"," float maxAge = getMaxAge();"," float positionInTime = (age / maxAge);"," float isAlive = when_gt( alive, 0.0 );"," #ifdef SHOULD_WIGGLE_PARTICLES"," float wiggleAmount = positionInTime * getWiggle();"," float wiggleSin = isAlive * sin( wiggleAmount );"," float wiggleCos = isAlive * cos( wiggleAmount );"," #endif"," vec3 vel = getVelocity( age );"," vec3 accel = getAcceleration( age );"," vec3 force = vec3( 0.0 );"," vec3 pos = vec3( position );"," float drag = 1.0 - (positionInTime * 0.5) * acceleration.w;"," force += vel;"," force *= drag;"," force += accel * age;"," pos += force;"," #ifdef SHOULD_WIGGLE_PARTICLES"," pos.x += wiggleSin;"," pos.y += wiggleCos;"," pos.z += wiggleSin;"," #endif"," #ifdef SHOULD_ROTATE_PARTICLES"," pos = getRotation( pos, positionInTime );"," #endif"," vec4 mvPosition = modelViewMatrix * vec4( pos, 1.0 );"," float pointSize = getFloatOverLifetime( positionInTime, size ) * isAlive;"," #ifdef HAS_PERSPECTIVE"," float aspek = aspectRat;"," float perspective = scale / length( mvPosition.xyz ) * (aspek);"," #else"," float perspective = 1.0;"," #endif"," float pointSizePerspective = pointSize * perspective;"," #ifdef COLORIZE"," vec3 c = isAlive * getColorOverLifetime("," positionInTime,"," unpackColor( color.x ),"," unpackColor( color.y ),"," unpackColor( color.z ),"," unpackColor( color.w )"," );"," #else"," vec3 c = vec3(1.0);"," #endif"," float o = isAlive * getFloatOverLifetime( positionInTime, opacity );"," vColor = vec4( c, o );"," #ifdef SHOULD_ROTATE_TEXTURE"," vAngle = isAlive * getFloatOverLifetime( positionInTime, angle );"," #endif"," #ifdef SHOULD_CALCULATE_SPRITE"," float framesX = textureAnimation.x;"," float framesY = textureAnimation.y;"," float loopCount = textureAnimation.w;"," float totalFrames = textureAnimation.z;"," float frameNumber = mod( (positionInTime * loopCount) * totalFrames, totalFrames );"," float column = floor(mod( frameNumber, framesX ));"," float row = floor( (frameNumber - column) / framesX );"," float columnNorm = column / framesX;"," float rowNorm = row / framesY;"," vSpriteSheet.x = 1.0 / framesX;"," vSpriteSheet.y = 1.0 / framesY;"," vSpriteSheet.z = columnNorm;"," vSpriteSheet.w = rowNorm;"," #endif"," gl_PointSize = pointSizePerspective;"," gl_Position = projectionMatrix * mvPosition;",o.ShaderChunk.logdepthbuf_vertex,o.ShaderChunk.fog_vertex,"}"].join("\n"),fragment:[a.shaderChunks.uniforms,o.ShaderChunk.common,o.ShaderChunk.fog_pars_fragment,o.ShaderChunk.logdepthbuf_pars_fragment,a.shaderChunks.varyings,a.shaderChunks.branchAvoidanceFunctions,"void main() {"," vec3 outgoingLight = vColor.xyz;"," "," #ifdef ALPHATEST"," if ( vColor.w < float(ALPHATEST) ) discard;"," #endif",a.shaderChunks.rotateTexture,o.ShaderChunk.logdepthbuf_fragment," outgoingLight = vColor.xyz * rotatedTexture.xyz;"," gl_FragColor = vec4( outgoingLight.xyz, rotatedTexture.w * vColor.w );",o.ShaderChunk.fog_fragment,"}"].join("\n")},a.utils={types:{BOOLEAN:"boolean",STRING:"string",NUMBER:"number",OBJECT:"object"},ensureTypedArg:function(t,e,i){"use strict";return s(t)===e?t:i},ensureArrayTypedArg:function(t,e,i){"use strict";if(Array.isArray(t)){for(var n=t.length-1;n>=0;--n)if(s(t[n])!==e)return i;return t}return this.ensureTypedArg(t,e,i)},ensureInstanceOf:function(t,e,i){"use strict";return void 0!==e&&t instanceof e?t:i},ensureArrayInstanceOf:function(t,e,i){"use strict";if(Array.isArray(t)){for(var n=t.length-1;n>=0;--n)if(void 0!==e&&t[n]instanceof e==!1)return i;return t}return this.ensureInstanceOf(t,e,i)},ensureValueOverLifetimeCompliance:function(t,e,i){"use strict";e=e||3,i=i||3,!1===Array.isArray(t._value)&&(t._value=[t._value]),!1===Array.isArray(t._spread)&&(t._spread=[t._spread]);var n=this.clamp(t._value.length,e,i),r=this.clamp(t._spread.length,e,i),s=Math.max(n,r);t._value.length!==s&&(t._value=this.interpolateArray(t._value,s)),t._spread.length!==s&&(t._spread=this.interpolateArray(t._spread,s))},interpolateArray:function(t,e){"use strict";for(var i=t.length,n=["function"==typeof t[0].clone?t[0].clone():t[0]],r=(i-1)/(e-1),s=1;s-1e-5&&(i=-i),i},lerpTypeAgnostic:function(t,e,i){"use strict";var n,r=this.types;return s(t)===r.NUMBER&&s(e)===r.NUMBER?t+(e-t)*i:t instanceof o.Vector2&&e instanceof o.Vector2?((n=t.clone()).x=this.lerp(t.x,e.x,i),n.y=this.lerp(t.y,e.y,i),n):t instanceof o.Vector3&&e instanceof o.Vector3?((n=t.clone()).x=this.lerp(t.x,e.x,i),n.y=this.lerp(t.y,e.y,i),n.z=this.lerp(t.z,e.z,i),n):t instanceof o.Vector4&&e instanceof o.Vector4?((n=t.clone()).x=this.lerp(t.x,e.x,i),n.y=this.lerp(t.y,e.y,i),n.z=this.lerp(t.z,e.z,i),n.w=this.lerp(t.w,e.w,i),n):t instanceof o.Color&&e instanceof o.Color?((n=t.clone()).r=this.lerp(t.r,e.r,i),n.g=this.lerp(t.g,e.g,i),n.b=this.lerp(t.b,e.b,i),n):void 0},lerp:function(t,e,i){"use strict";return t+(e-t)*i},roundToNearestMultiple:function(t,e){"use strict";var i;return 0===e||0===(i=Math.abs(t)%e)?t:t<0?-(Math.abs(t)-i):t+e-i},arrayValuesAreEqual:function(t){"use strict";for(var e=0;e1||this.textureFrames.y>1},this.attributes={position:new a.ShaderAttribute("v3",!0),acceleration:new a.ShaderAttribute("v4",!0),velocity:new a.ShaderAttribute("v3",!0),rotation:new a.ShaderAttribute("v4",!0),rotationCenter:new a.ShaderAttribute("v3",!0),params:new a.ShaderAttribute("v4",!0),size:new a.ShaderAttribute("v4",!0),angle:new a.ShaderAttribute("v4",!0),color:new a.ShaderAttribute("v4",!0),opacity:new a.ShaderAttribute("v4",!0)},this.attributeKeys=Object.keys(this.attributes),this.attributeCount=this.attributeKeys.length,this.material=new o.ShaderMaterial({uniforms:this.uniforms,vertexShader:a.shaders.vertex,fragmentShader:a.shaders.fragment,blending:this.blending,transparent:this.transparent,alphaTest:this.alphaTest,depthWrite:this.depthWrite,depthTest:this.depthTest,defines:this.defines,fog:this.fog}),this.geometry=new o.BufferGeometry,this.mesh=new o.Points(this.geometry,this.material),this.maxParticleCount},a.Group.constructor=a.Group,a.Group.prototype._updateDefines=function(){"use strict";for(var t,e=this.emitters,i=e.length-1,n=this.defines;i>=0;--i)t=e[i],n.SHOULD_CALCULATE_SPRITE||(n.SHOULD_ROTATE_TEXTURE=n.SHOULD_ROTATE_TEXTURE||!!Math.max(Math.max.apply(null,t.angle.value),Math.max.apply(null,t.angle.spread))),n.SHOULD_ROTATE_PARTICLES=n.SHOULD_ROTATE_PARTICLES||!!Math.max(t.rotation.angle,t.rotation.angleSpread),n.SHOULD_WIGGLE_PARTICLES=n.SHOULD_WIGGLE_PARTICLES||!!Math.max(t.wiggle.value,t.wiggle.spread);this.material.needsUpdate=!0},a.Group.prototype._applyAttributesToGeometry=function(){"use strict";var t,e,i=this.attributes,n=this.geometry,r=n.attributes;for(var s in i)i.hasOwnProperty(s)&&(t=i[s],(e=r[s])?e.array=t.typedArray.array:n.setAttribute(s,t.bufferAttribute),t.bufferAttribute.needsUpdate=!0);this.geometry.setDrawRange(0,this.particleCount)},a.Group.prototype.addEmitter=function(t){"use strict";if(t instanceof a.Emitter!=!1&&!(this.emitterIDs.indexOf(t.uuid)>-1)&&null===t.group){var e=this.attributes,i=this.particleCount,n=i+t.particleCount;for(var r in this.particleCount=n,null!==this.maxParticleCount&&(this.particleCount,this.maxParticleCount),t._calculatePPSValue(t.maxAge._value+t.maxAge._spread),t._setBufferUpdateRanges(this.attributeKeys),t._setAttributeOffset(i),t.group=this,t.attributes=this.attributes,e)e.hasOwnProperty(r)&&e[r]._createBufferAttribute(null!==this.maxParticleCount?this.maxParticleCount:this.particleCount);for(var s=i;s1)for(var i=0;i=0;--e)i[t[e]].resetUpdateRange()},a.Group.prototype._updateBuffers=function(t){"use strict";for(var e,i,n,r=this.attributeKeys,s=this.attributeCount-1,o=this.attributes,a=t.bufferUpdateRanges;s>=0;--s)i=a[e=r[s]],(n=o[e]).setUpdateRange(i.min,i.max),n.flagUpdate()},a.Group.prototype.tick=function(t){"use strict";var e=this.emitters,i=e.length,n=t||this.fixedTimeStep,r=this.attributeKeys,s=this.attributes;if(this._updateUniforms(n),this._resetBufferRanges(),0!==i||!1!==this._attributesNeedRefresh||!1!==this._attributesNeedDynamicReset){for(var o,a=0;a=0;--a)s[r[a]].resetDynamic();this._attributesNeedDynamicReset=!1}if(!0===this._attributesNeedRefresh){for(a=this.attributeCount-1;a>=0;--a)s[r[a]].forceUpdateAll();this._attributesNeedRefresh=!1,this._attributesNeedDynamicReset=!0}}},a.Group.prototype.dispose=function(){"use strict";return this.geometry.dispose(),this.material.dispose(),this},a.Emitter=function(t){"use strict";var e=a.utils,i=e.types,n=a.valueOverLifetimeLength;for(var r in(t=e.ensureTypedArg(t,i.OBJECT,{})).position=e.ensureTypedArg(t.position,i.OBJECT,{}),t.velocity=e.ensureTypedArg(t.velocity,i.OBJECT,{}),t.acceleration=e.ensureTypedArg(t.acceleration,i.OBJECT,{}),t.radius=e.ensureTypedArg(t.radius,i.OBJECT,{}),t.drag=e.ensureTypedArg(t.drag,i.OBJECT,{}),t.rotation=e.ensureTypedArg(t.rotation,i.OBJECT,{}),t.color=e.ensureTypedArg(t.color,i.OBJECT,{}),t.opacity=e.ensureTypedArg(t.opacity,i.OBJECT,{}),t.size=e.ensureTypedArg(t.size,i.OBJECT,{}),t.angle=e.ensureTypedArg(t.angle,i.OBJECT,{}),t.wiggle=e.ensureTypedArg(t.wiggle,i.OBJECT,{}),t.maxAge=e.ensureTypedArg(t.maxAge,i.OBJECT,{}),t.onParticleSpawn,this.uuid=o.Math.generateUUID(),this.type=e.ensureTypedArg(t.type,i.NUMBER,a.distributions.BOX),this.position={_value:e.ensureInstanceOf(t.position.value,o.Vector3,new o.Vector3),_spread:e.ensureInstanceOf(t.position.spread,o.Vector3,new o.Vector3),_spreadClamp:e.ensureInstanceOf(t.position.spreadClamp,o.Vector3,new o.Vector3),_distribution:e.ensureTypedArg(t.position.distribution,i.NUMBER,this.type),_randomise:e.ensureTypedArg(t.position.randomise,i.BOOLEAN,!1),_radius:e.ensureTypedArg(t.position.radius,i.NUMBER,10),_radiusScale:e.ensureInstanceOf(t.position.radiusScale,o.Vector3,new o.Vector3(1,1,1)),_distributionClamp:e.ensureTypedArg(t.position.distributionClamp,i.NUMBER,0)},this.velocity={_value:e.ensureInstanceOf(t.velocity.value,o.Vector3,new o.Vector3),_spread:e.ensureInstanceOf(t.velocity.spread,o.Vector3,new o.Vector3),_distribution:e.ensureTypedArg(t.velocity.distribution,i.NUMBER,this.type),_randomise:e.ensureTypedArg(t.position.randomise,i.BOOLEAN,!1)},this.acceleration={_value:e.ensureInstanceOf(t.acceleration.value,o.Vector3,new o.Vector3),_spread:e.ensureInstanceOf(t.acceleration.spread,o.Vector3,new o.Vector3),_distribution:e.ensureTypedArg(t.acceleration.distribution,i.NUMBER,this.type),_randomise:e.ensureTypedArg(t.position.randomise,i.BOOLEAN,!1)},this.drag={_value:e.ensureTypedArg(t.drag.value,i.NUMBER,0),_spread:e.ensureTypedArg(t.drag.spread,i.NUMBER,0),_randomise:e.ensureTypedArg(t.position.randomise,i.BOOLEAN,!1)},this.wiggle={_value:e.ensureTypedArg(t.wiggle.value,i.NUMBER,0),_spread:e.ensureTypedArg(t.wiggle.spread,i.NUMBER,0)},this.rotation={_axis:e.ensureInstanceOf(t.rotation.axis,o.Vector3,new o.Vector3(0,1,0)),_axisSpread:e.ensureInstanceOf(t.rotation.axisSpread,o.Vector3,new o.Vector3),_angle:e.ensureTypedArg(t.rotation.angle,i.NUMBER,0),_angleSpread:e.ensureTypedArg(t.rotation.angleSpread,i.NUMBER,0),_static:e.ensureTypedArg(t.rotation.static,i.BOOLEAN,!1),_center:e.ensureInstanceOf(t.rotation.center,o.Vector3,this.position._value.clone()),_randomise:e.ensureTypedArg(t.position.randomise,i.BOOLEAN,!1)},this.maxAge={_value:e.ensureTypedArg(t.maxAge.value,i.NUMBER,2),_spread:e.ensureTypedArg(t.maxAge.spread,i.NUMBER,0)},this.color={_value:e.ensureArrayInstanceOf(t.color.value,o.Color,new o.Color),_spread:e.ensureArrayInstanceOf(t.color.spread,o.Vector3,new o.Vector3),_randomise:e.ensureTypedArg(t.position.randomise,i.BOOLEAN,!1)},this.opacity={_value:e.ensureArrayTypedArg(t.opacity.value,i.NUMBER,1),_spread:e.ensureArrayTypedArg(t.opacity.spread,i.NUMBER,0),_randomise:e.ensureTypedArg(t.position.randomise,i.BOOLEAN,!1)},this.size={_value:e.ensureArrayTypedArg(t.size.value,i.NUMBER,1),_spread:e.ensureArrayTypedArg(t.size.spread,i.NUMBER,0),_randomise:e.ensureTypedArg(t.position.randomise,i.BOOLEAN,!1)},this.angle={_value:e.ensureArrayTypedArg(t.angle.value,i.NUMBER,0),_spread:e.ensureArrayTypedArg(t.angle.spread,i.NUMBER,0),_randomise:e.ensureTypedArg(t.position.randomise,i.BOOLEAN,!1)},this.particleCount=e.ensureTypedArg(t.particleCount,i.NUMBER,100),this.duration=e.ensureTypedArg(t.duration,i.NUMBER,null),this.isStatic=e.ensureTypedArg(t.isStatic,i.BOOLEAN,!1),this.activeMultiplier=e.ensureTypedArg(t.activeMultiplier,i.NUMBER,1),this.direction=e.ensureTypedArg(t.direction,i.NUMBER,1),this.alive=e.ensureTypedArg(t.alive,i.BOOLEAN,!0),this.particlesPerSecond=0,this.activationIndex=0,this.attributeOffset=0,this.attributeEnd=0,this.age=0,this.activeParticleCount=0,this.group=null,this.attributes=null,this.paramsArray=null,this.resetFlags={position:e.ensureTypedArg(t.position.randomise,i.BOOLEAN,!1)||e.ensureTypedArg(t.radius.randomise,i.BOOLEAN,!1),velocity:e.ensureTypedArg(t.velocity.randomise,i.BOOLEAN,!1),acceleration:e.ensureTypedArg(t.acceleration.randomise,i.BOOLEAN,!1)||e.ensureTypedArg(t.drag.randomise,i.BOOLEAN,!1),rotation:e.ensureTypedArg(t.rotation.randomise,i.BOOLEAN,!1),rotationCenter:e.ensureTypedArg(t.rotation.randomise,i.BOOLEAN,!1),size:e.ensureTypedArg(t.size.randomise,i.BOOLEAN,!1),color:e.ensureTypedArg(t.color.randomise,i.BOOLEAN,!1),opacity:e.ensureTypedArg(t.opacity.randomise,i.BOOLEAN,!1),angle:e.ensureTypedArg(t.angle.randomise,i.BOOLEAN,!1)},this.updateFlags={},this.updateCounts={},this.updateMap={maxAge:"params",position:"position",velocity:"velocity",acceleration:"acceleration",drag:"acceleration",wiggle:"params",rotation:"rotation",size:"size",color:"color",opacity:"opacity",angle:"angle"},this.updateMap)this.updateMap.hasOwnProperty(r)&&(this.updateCounts[this.updateMap[r]]=0,this.updateFlags[this.updateMap[r]]=!1,this._createGetterSetters(this[r],r));this.bufferUpdateRanges={},this.attributeKeys=null,this.attributeCount=0,e.ensureValueOverLifetimeCompliance(this.color,n,n),e.ensureValueOverLifetimeCompliance(this.opacity,n,n),e.ensureValueOverLifetimeCompliance(this.size,n,n),e.ensureValueOverLifetimeCompliance(this.angle,n,n)},a.Emitter.constructor=a.Emitter,a.Emitter.prototype._createGetterSetters=function(t,e){"use strict";var i=this;for(var n in t)if(t.hasOwnProperty(n)){var r=n.replace("_","");Object.defineProperty(t,r,{get:function(t){return function(){return this[t]}}(n),set:function(t){return function(n){var r=i.updateMap[e],s=this[t],o=a.valueOverLifetimeLength;"_rotationCenter"===t?(i.updateFlags.rotationCenter=!0,i.updateCounts.rotationCenter=0):"_randomise"===t?i.resetFlags[r]=n:(i.updateFlags[r]=!0,i.updateCounts[r]=0),i.group._updateDefines(),this[t]=n,Array.isArray(s)&&a.utils.ensureValueOverLifetimeCompliance(i[e],o,o)}}(n)})}},a.Emitter.prototype._setBufferUpdateRanges=function(t){"use strict";this.attributeKeys=t,this.attributeCount=t.length;for(var e=this.attributeCount-1;e>=0;--e)this.bufferUpdateRanges[t[e]]={min:Number.POSITIVE_INFINITY,max:Number.NEGATIVE_INFINITY}},a.Emitter.prototype._calculatePPSValue=function(t){"use strict";var e=this.particleCount;this.duration?this.particlesPerSecond=e/(t=0;--a)i=r[e=o[a]],!0!==n[e]&&!0!==i||(this._assignValue(e,t),this._updateAttributeUpdateRange(e,t),!0===i&&s[e]===this.particleCount?(r[e]=!1,s[e]=0):1==i&&++s[e])},a.Emitter.prototype._updateAttributeUpdateRange=function(t,e){"use strict";var i=this.bufferUpdateRanges[t];i.min=Math.min(e,i.min),i.max=Math.max(e,i.max)},a.Emitter.prototype._resetBufferRanges=function(){"use strict";for(var t,e=this.bufferUpdateRanges,i=this.bufferUpdateKeys,n=this.bufferUpdateCount-1;n>=0;--n)e[t=i[n]].min=Number.POSITIVE_INFINITY,e[t].max=Number.NEGATIVE_INFINITY},a.Emitter.prototype._onRemove=function(){"use strict";this.particlesPerSecond=0,this.attributeOffset=0,this.activationIndex=0,this.activeParticleCount=0,this.group=null,this.attributes=null,this.paramsArray=null,this.age=0},a.Emitter.prototype._decrementParticleCount=function(){"use strict";--this.activeParticleCount},a.Emitter.prototype._incrementParticleCount=function(){"use strict";++this.activeParticleCount},a.Emitter.prototype._checkParticleAges=function(t,e,i,n){"use strict";for(var r,s,o,a,h=e-1;h>=t;--h)0!==(a=i[r=4*h])&&(o=i[r+1],s=i[r+2],1===this.direction?(o+=n)>=s&&(o=0,a=0,this._decrementParticleCount()):(o-=n)<=0&&(o=s,a=0,this._decrementParticleCount()),i[r]=a,i[r+1]=o,this._updateAttributeUpdateRange("params",h))},a.Emitter.prototype._activateParticles=function(t,e,i,n){"use strict";for(var r,s,o=this.direction,a=t;athis.duration)return this.alive=!1,void(this.age=0);var o=1===this.particleCount?s:0|s,a=Math.min(o+r,this.activationEnd),h=a-this.activationIndex|0,l=h>0?t/h:0;this._activateParticles(o,a,n,l),this.activationIndex+=r,this.activationIndex>i&&(this.activationIndex=e),this.age+=t}else this.age=0}},a.Emitter.prototype.sendParticles=function(t){"use strict";if(!this.isStatic){null===this.paramsArray&&(this.paramsArray=this.attributes.params.typedArray.array);var e=this.attributeOffset,i=e+this.particleCount,n=this.paramsArray,r=this.particlesPerSecond*this.activeMultiplier*t,s=this.activationIndex,o=1===this.particleCount?s:0|s,a=Math.min(o+r,this.activationEnd),h=a-this.activationIndex|0,l=h>0?t/h:0;this._activateParticles(o,a,n,l),this.activationIndex+=r,this.activationIndex>i&&(this.activationIndex=e)}},a.Emitter.prototype.reset=function(t){"use strict";if(this.age=0,this.alive=!1,!0===t){for(var e,i=this.attributeOffset,n=i+this.particleCount,r=this.paramsArray,s=this.attributes.params.bufferAttribute,o=n-1;o>=i;--o)r[e=4*o]=0,r[e+1]=0;s.updateRange.offset=0,s.updateRange.count=-1,s.needsUpdate=!0}return this},a.Emitter.prototype.enable=function(){"use strict";return this.alive=!0,this},a.Emitter.prototype.disable=function(){"use strict";return this.alive=!1,this},a.Emitter.prototype.remove=function(){"use strict";return null!==this.group&&this.group.removeEmitter(this),this}},function(t,e,i){var n={"./level1":40,"./level1.js":40,"./level2":41,"./level2.js":41,"./level3":42,"./level3.js":42,"./level4":43,"./level4.js":43,"./level5":44,"./level5.js":44,"./levelX":30,"./levelX.js":30};function r(t){var e=s(t);return i(e)}function s(t){if(!i.o(n,t)){var e=new Error("Cannot find module '"+t+"'");throw e.code="MODULE_NOT_FOUND",e}return n[t]}r.keys=function(){return Object.keys(n)},r.resolve=s,t.exports=r,r.id=60},function(t,e,i){var n;n=function(){return function(t){var e={};function i(n){if(e[n])return e[n].exports;var r=e[n]={i:n,l:!1,exports:{}};return t[n].call(r.exports,r,r.exports,i),r.l=!0,r.exports}return i.m=t,i.c=e,i.d=function(t,e,n){i.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:n})},i.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},i.t=function(t,e){if(1&e&&(t=i(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var n=Object.create(null);if(i.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var r in t)i.d(n,r,function(e){return t[e]}.bind(null,r));return n},i.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return i.d(e,"a",e),e},i.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},i.p="",i(i.s=1528)}([function(t,e){function i(t,e,i){var n=i?t[e]:Object.getOwnPropertyDescriptor(t,e);return!i&&n.value&&"object"==typeof n.value&&(n=n.value),!(!n||!function(t){return!!t.get&&"function"==typeof t.get||!!t.set&&"function"==typeof t.set}(n))&&(void 0===n.enumerable&&(n.enumerable=!0),void 0===n.configurable&&(n.configurable=!0),n)}function n(t,e){var i=Object.getOwnPropertyDescriptor(t,e);return!!i&&(i.value&&"object"==typeof i.value&&(i=i.value),!1===i.configurable)}function r(t,e,r,s){for(var a in e)if(e.hasOwnProperty(a)){var h=i(e,a,r);if(!1!==h){if(n((s||t).prototype,a)){if(o.ignoreFinals)continue;throw new Error("cannot override final property '"+a+"', set Class.ignoreFinals = true to skip")}Object.defineProperty(t.prototype,a,h)}else t.prototype[a]=e[a]}}function s(t,e){if(e){Array.isArray(e)||(e=[e]);for(var i=0;i0&&(i=1/Math.sqrt(i),this.x=t*i,this.y=e*i),this},normalizeRightHand:function(){var t=this.x;return this.x=-1*this.y,this.y=t,this},normalizeLeftHand:function(){var t=this.x;return this.x=this.y,this.y=-1*t,this},dot:function(t){return this.x*t.x+this.y*t.y},cross:function(t){return this.x*t.y-this.y*t.x},lerp:function(t,e){void 0===e&&(e=0);var i=this.x,n=this.y;return this.x=i+e*(t.x-i),this.y=n+e*(t.y-n),this},transformMat3:function(t){var e=this.x,i=this.y,n=t.val;return this.x=n[0]*e+n[3]*i+n[6],this.y=n[1]*e+n[4]*i+n[7],this},transformMat4:function(t){var e=this.x,i=this.y,n=t.val;return this.x=n[0]*e+n[4]*i+n[12],this.y=n[1]*e+n[5]*i+n[13],this},reset:function(){return this.x=0,this.y=0,this},limit:function(t){var e=this.length();return e&&e>t&&this.scale(t/e),this},reflect:function(t){return t=t.clone().normalize(),this.subtract(t.scale(2*this.dot(t)))},mirror:function(t){return this.reflect(t).negate()},rotate:function(t){var e=Math.cos(t),i=Math.sin(t);return this.set(e*this.x-i*this.y,i*this.x+e*this.y)}});s.ZERO=new s,s.RIGHT=new s(1,0),s.LEFT=new s(-1,0),s.UP=new s(0,-1),s.DOWN=new s(0,1),s.ONE=new s(1,1),t.exports=s},function(t,e,i){var n=i(0),r=i(56),s=new n({initialize:function(t,e){void 0===t&&(t=0),void 0===e&&(e=t),this.type=r.POINT,this.x=t,this.y=e},setTo:function(t,e){return void 0===t&&(t=0),void 0===e&&(e=t),this.x=t,this.y=e,this}});t.exports=s},function(t,e,i){var n=i(0),r=i(24),s=i(20),o=new n({initialize:function(t){this.scene=t,this.systems=t.sys,this.events=t.sys.events,this.displayList,this.updateList,this.events.once(s.BOOT,this.boot,this),this.events.on(s.START,this.start,this)},boot:function(){this.displayList=this.systems.displayList,this.updateList=this.systems.updateList,this.events.once(s.DESTROY,this.destroy,this)},start:function(){this.events.once(s.SHUTDOWN,this.shutdown,this)},existing:function(t){return(t.renderCanvas||t.renderWebGL)&&this.displayList.add(t),t.preUpdate&&this.updateList.add(t),t},shutdown:function(){this.events.off(s.SHUTDOWN,this.shutdown,this)},destroy:function(){this.shutdown(),this.events.off(s.START,this.start,this),this.scene=null,this.systems=null,this.events=null,this.displayList=null,this.updateList=null}});o.register=function(t,e){o.prototype.hasOwnProperty(t)||(o.prototype[t]=e)},o.remove=function(t){o.prototype.hasOwnProperty(t)&&delete o.prototype[t]},r.register("GameObjectFactory",o,"add"),t.exports=o},function(t,e){t.exports=function(t,e,i){if(t&&"number"!=typeof t){if(t.hasOwnProperty(e))return t[e];if(-1!==e.indexOf(".")){for(var n=e.split("."),r=t,s=i,o=0;o=this.right?this.width=0:this.width=this.right-t,this.x=t}},right:{get:function(){return this.x+this.width},set:function(t){t<=this.x?this.width=0:this.width=t-this.x}},top:{get:function(){return this.y},set:function(t){t>=this.bottom?this.height=0:this.height=this.bottom-t,this.y=t}},bottom:{get:function(){return this.y+this.height},set:function(t){t<=this.y?this.height=0:this.height=t-this.y}},centerX:{get:function(){return this.x+this.width/2},set:function(t){this.x=t-this.width/2}},centerY:{get:function(){return this.y+this.height/2},set:function(t){this.y=t-this.height/2}}});t.exports=u},function(t,e,i){t.exports={Alpha:i(607),AlphaSingle:i(303),BlendMode:i(304),ComputedSize:i(608),Crop:i(609),Depth:i(305),Flip:i(610),GetBounds:i(611),Mask:i(309),Origin:i(632),PathFollower:i(633),Pipeline:i(167),ScrollFactor:i(312),Size:i(634),Texture:i(635),TextureCrop:i(636),Tint:i(637),ToJSON:i(176),Transform:i(313),TransformMatrix:i(25),Visible:i(314)}},function(t,e){function i(t){for(var e="",i=0;i0&&(e+="\nelse "),i>>0},getTintAppendFloatAlpha:function(t,e){return((255&(255*e|0))<<24|t)>>>0},getTintAppendFloatAlphaAndSwap:function(t,e){return((255&(255*e|0))<<24|(255&(0|t))<<16|(255&(t>>8|0))<<8|255&(t>>16|0))>>>0},getFloatsFromUintRGB:function(t){return[(255&(t>>16|0))/255,(255&(t>>8|0))/255,(255&(0|t))/255]},checkShaderMax:function(t,e){e&&-1!==e||(e=t.getParameter(t.MAX_TEXTURE_IMAGE_UNITS));for(var n=t.createShader(t.FRAGMENT_SHADER),r=["precision mediump float;","void main(void){","float test = 0.1;","%forloop%","gl_FragColor = vec4(0.0);","}"].join("\n");;){var s=r.replace(/%forloop%/gi,i(e));if(t.shaderSource(n,s),t.compileShader(n),t.getShaderParameter(n,t.COMPILE_STATUS))break;e=e/2|0}return e},parseFragmentShaderMaxTextures:function(t,e){if(!t)return"";for(var i="",n=0;n0&&(i+="\n\telse "),n=400&&t.status<=599&&(n=!1),this.state=r.FILE_LOADED,this.resetXHR(),this.loader.nextFile(this,n)},onError:function(){this.resetXHR(),this.loader.nextFile(this,!1)},onProgress:function(t){t.lengthComputable&&(this.bytesLoaded=t.loaded,this.bytesTotal=t.total,this.percentComplete=Math.min(this.bytesLoaded/this.bytesTotal,1),this.loader.emit(s.FILE_PROGRESS,this,this.percentComplete))},onProcess:function(){this.state=r.FILE_PROCESSING,this.onProcessComplete()},onProcessComplete:function(){this.state=r.FILE_COMPLETE,this.multiFile&&this.multiFile.onFileComplete(this),this.loader.fileProcessComplete(this)},onProcessError:function(){this.state=r.FILE_ERRORED,this.multiFile&&this.multiFile.onFileFailed(this),this.loader.fileProcessComplete(this)},hasCacheConflict:function(){return this.cache&&this.cache.exists(this.key)},addToCache:function(){this.cache&&this.cache.add(this.key,this.data),this.pendingDestroy()},pendingDestroy:function(t){void 0===t&&(t=this.data);var e=this.key,i=this.type;this.loader.emit(s.FILE_COMPLETE,e,i,t),this.loader.emit(s.FILE_KEY_COMPLETE+i+"-"+e,e,i,t),this.loader.flagForRemoval(this)},destroy:function(){this.loader=null,this.cache=null,this.xhrSettings=null,this.multiFile=null,this.linkFile=null,this.data=null}});c.createObjectURL=function(t,e,i){if("function"==typeof URL)t.src=URL.createObjectURL(e);else{var n=new FileReader;n.onload=function(){t.removeAttribute("crossOrigin"),t.src="data:"+(e.type||i)+";base64,"+n.result.split(",")[1]},n.onerror=t.onerror,n.readAsDataURL(e)}},c.revokeObjectURL=function(t){"function"==typeof URL&&URL.revokeObjectURL(t.src)},t.exports=c},function(t,e){var i={},n={},r={register:function(t,e,n,r){void 0===r&&(r=!1),i[t]={plugin:e,mapping:n,custom:r}},registerCustom:function(t,e,i,r){n[t]={plugin:e,mapping:i,data:r}},hasCore:function(t){return i.hasOwnProperty(t)},hasCustom:function(t){return n.hasOwnProperty(t)},getCore:function(t){return i[t]},getCustom:function(t){return n[t]},getCustomClass:function(t){return n.hasOwnProperty(t)?n[t].plugin:null},remove:function(t){i.hasOwnProperty(t)&&delete i[t]},removeCustom:function(t){n.hasOwnProperty(t)&&delete n[t]},destroyCorePlugins:function(){for(var t in i)i.hasOwnProperty(t)&&delete i[t]},destroyCustomPlugins:function(){for(var t in n)n.hasOwnProperty(t)&&delete n[t]}};t.exports=r},function(t,e,i){var n=i(0),r=i(14),s=i(3),o=new n({initialize:function(t,e,i,n,r,s){void 0===t&&(t=1),void 0===e&&(e=0),void 0===i&&(i=0),void 0===n&&(n=1),void 0===r&&(r=0),void 0===s&&(s=0),this.matrix=new Float32Array([t,e,i,n,r,s,0,0,1]),this.decomposedMatrix={translateX:0,translateY:0,scaleX:1,scaleY:1,rotation:0}},a:{get:function(){return this.matrix[0]},set:function(t){this.matrix[0]=t}},b:{get:function(){return this.matrix[1]},set:function(t){this.matrix[1]=t}},c:{get:function(){return this.matrix[2]},set:function(t){this.matrix[2]=t}},d:{get:function(){return this.matrix[3]},set:function(t){this.matrix[3]=t}},e:{get:function(){return this.matrix[4]},set:function(t){this.matrix[4]=t}},f:{get:function(){return this.matrix[5]},set:function(t){this.matrix[5]=t}},tx:{get:function(){return this.matrix[4]},set:function(t){this.matrix[4]=t}},ty:{get:function(){return this.matrix[5]},set:function(t){this.matrix[5]=t}},rotation:{get:function(){return Math.acos(this.a/this.scaleX)*(Math.atan(-this.c/this.a)<0?-1:1)}},rotationNormalized:{get:function(){var t=this.matrix,e=t[0],i=t[1],n=t[2],s=t[3];return e||i?i>0?Math.acos(e/this.scaleX):-Math.acos(e/this.scaleX):n||s?r.TAU-(s>0?Math.acos(-n/this.scaleY):-Math.acos(n/this.scaleY)):0}},scaleX:{get:function(){return Math.sqrt(this.a*this.a+this.b*this.b)}},scaleY:{get:function(){return Math.sqrt(this.c*this.c+this.d*this.d)}},loadIdentity:function(){var t=this.matrix;return t[0]=1,t[1]=0,t[2]=0,t[3]=1,t[4]=0,t[5]=0,this},translate:function(t,e){var i=this.matrix;return i[4]=i[0]*t+i[2]*e+i[4],i[5]=i[1]*t+i[3]*e+i[5],this},scale:function(t,e){var i=this.matrix;return i[0]*=t,i[1]*=t,i[2]*=e,i[3]*=e,this},rotate:function(t){var e=Math.sin(t),i=Math.cos(t),n=this.matrix,r=n[0],s=n[1],o=n[2],a=n[3];return n[0]=r*i+o*e,n[1]=s*i+a*e,n[2]=r*-e+o*i,n[3]=s*-e+a*i,this},multiply:function(t,e){var i=this.matrix,n=t.matrix,r=i[0],s=i[1],o=i[2],a=i[3],h=i[4],l=i[5],u=n[0],c=n[1],d=n[2],p=n[3],f=n[4],m=n[5],g=void 0===e?this:e;return g.a=u*r+c*o,g.b=u*s+c*a,g.c=d*r+p*o,g.d=d*s+p*a,g.e=f*r+m*o+h,g.f=f*s+m*a+l,g},multiplyWithOffset:function(t,e,i){var n=this.matrix,r=t.matrix,s=n[0],o=n[1],a=n[2],h=n[3],l=e*s+i*a+n[4],u=e*o+i*h+n[5],c=r[0],d=r[1],p=r[2],f=r[3],m=r[4],g=r[5];return n[0]=c*s+d*a,n[1]=c*o+d*h,n[2]=p*s+f*a,n[3]=p*o+f*h,n[4]=m*s+g*a+l,n[5]=m*o+g*h+u,this},transform:function(t,e,i,n,r,s){var o=this.matrix,a=o[0],h=o[1],l=o[2],u=o[3],c=o[4],d=o[5];return o[0]=t*a+e*l,o[1]=t*h+e*u,o[2]=i*a+n*l,o[3]=i*h+n*u,o[4]=r*a+s*l+c,o[5]=r*h+s*u+d,this},transformPoint:function(t,e,i){void 0===i&&(i={x:0,y:0});var n=this.matrix,r=n[0],s=n[1],o=n[2],a=n[3],h=n[4],l=n[5];return i.x=t*r+e*o+h,i.y=t*s+e*a+l,i},invert:function(){var t=this.matrix,e=t[0],i=t[1],n=t[2],r=t[3],s=t[4],o=t[5],a=e*r-i*n;return t[0]=r/a,t[1]=-i/a,t[2]=-n/a,t[3]=e/a,t[4]=(n*o-r*s)/a,t[5]=-(e*o-i*s)/a,this},copyFrom:function(t){var e=this.matrix;return e[0]=t.a,e[1]=t.b,e[2]=t.c,e[3]=t.d,e[4]=t.e,e[5]=t.f,this},copyFromArray:function(t){var e=this.matrix;return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e[4]=t[4],e[5]=t[5],this},copyToContext:function(t){var e=this.matrix;return t.transform(e[0],e[1],e[2],e[3],e[4],e[5]),t},setToContext:function(t){var e=this.matrix;return t.setTransform(e[0],e[1],e[2],e[3],e[4],e[5]),t},copyToArray:function(t){var e=this.matrix;return void 0===t?t=[e[0],e[1],e[2],e[3],e[4],e[5]]:(t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[4]=e[4],t[5]=e[5]),t},setTransform:function(t,e,i,n,r,s){var o=this.matrix;return o[0]=t,o[1]=e,o[2]=i,o[3]=n,o[4]=r,o[5]=s,this},decomposeMatrix:function(){var t=this.decomposedMatrix,e=this.matrix,i=e[0],n=e[1],r=e[2],s=e[3],o=i*s-n*r;if(t.translateX=e[4],t.translateY=e[5],i||n){var a=Math.sqrt(i*i+n*n);t.rotation=n>0?Math.acos(i/a):-Math.acos(i/a),t.scaleX=a,t.scaleY=o/a}else if(r||s){var h=Math.sqrt(r*r+s*s);t.rotation=.5*Math.PI-(s>0?Math.acos(-r/h):-Math.acos(r/h)),t.scaleX=o/h,t.scaleY=h}else t.rotation=0,t.scaleX=0,t.scaleY=0;return t},applyITRS:function(t,e,i,n,r){var s=this.matrix,o=Math.sin(i),a=Math.cos(i);return s[4]=t,s[5]=e,s[0]=a*n,s[1]=o*n,s[2]=-o*r,s[3]=a*r,this},applyInverse:function(t,e,i){void 0===i&&(i=new s);var n=this.matrix,r=n[0],o=n[1],a=n[2],h=n[3],l=n[4],u=n[5],c=1/(r*h+a*-o);return i.x=h*c*t+-a*c*e+(u*a-l*h)*c,i.y=r*c*e+-o*c*t+(-u*r+l*o)*c,i},getX:function(t,e){return t*this.a+e*this.c+this.e},getY:function(t,e){return t*this.b+e*this.d+this.f},getXRound:function(t,e,i){var n=this.getX(t,e);return i&&(n=Math.round(n)),n},getYRound:function(t,e,i){var n=this.getY(t,e);return i&&(n=Math.round(n)),n},getCSSMatrix:function(){var t=this.matrix;return"matrix("+t[0]+","+t[1]+","+t[2]+","+t[3]+","+t[4]+","+t[5]+")"},destroy:function(){this.matrix=null,this.decomposedMatrix=null}});t.exports=o},function(t,e,i){var n=i(2);t.exports=function(t,e,i,r,s,o){void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i=o.width),void 0===r&&(r=o.height),s||(s={});var a=n(s,"isNotEmpty",!1),h=n(s,"isColliding",!1),l=n(s,"hasInterestingFace",!1);t<0&&(i+=t,t=0),e<0&&(r+=e,e=0),t+i>o.width&&(i=Math.max(o.width-t,0)),e+r>o.height&&(r=Math.max(o.height-e,0));for(var u=[],c=e;c=0;o--)t[o][e]=i+a*n,a++;return t}},function(t,e,i){var n=i(35),r=i(13);t.exports=function(t,e,i){e.x=r(i,"x",0),e.y=r(i,"y",0),e.depth=r(i,"depth",0),e.flipX=r(i,"flipX",!1),e.flipY=r(i,"flipY",!1);var s=r(i,"scale",null);"number"==typeof s?e.setScale(s):null!==s&&(e.scaleX=r(s,"x",1),e.scaleY=r(s,"y",1));var o=r(i,"scrollFactor",null);"number"==typeof o?e.setScrollFactor(o):null!==o&&(e.scrollFactorX=r(o,"x",1),e.scrollFactorY=r(o,"y",1)),e.rotation=r(i,"rotation",0);var a=r(i,"angle",null);null!==a&&(e.angle=a),e.alpha=r(i,"alpha",1);var h=r(i,"origin",null);if("number"==typeof h)e.setOrigin(h);else if(null!==h){var l=r(h,"x",.5),u=r(h,"y",.5);e.setOrigin(l,u)}return e.blendMode=r(i,"blendMode",n.NORMAL),e.visible=r(i,"visible",!0),r(i,"add",!0)&&t.sys.displayList.add(e),e.preUpdate&&t.sys.updateList.add(e),e}},function(t,e){t.exports={ORTHOGONAL:0,ISOMETRIC:1,STAGGERED:2,HEXAGONAL:3}},function(t,e,i){var n=i(19);t.exports=function(t,e,i,r,s){var o=r.alpha*i.alpha;if(o<=0)return!1;var a=n(i,r,s).calc;return e.globalCompositeOperation=t.blendModes[i.blendMode],e.globalAlpha=o,e.save(),a.setToContext(e),e.imageSmoothingEnabled=!(!t.antialias||i.frame&&i.frame.source.scaleMode),!0}},function(t,e,i){var n,r,s,o=i(33),a=i(192),h=[],l=!1;t.exports=(s=function(){var t=0;return h.forEach((function(e){e.parent&&t++})),t},{create2D:function(t,e,i){return n(t,e,i,o.CANVAS)},create:n=function(t,e,i,n,s){var u;void 0===e&&(e=1),void 0===i&&(i=1),void 0===n&&(n=o.CANVAS),void 0===s&&(s=!1);var c=r(n);return null===c?(c={parent:t,canvas:document.createElement("canvas"),type:n},n===o.CANVAS&&h.push(c),u=c.canvas):(c.parent=t,u=c.canvas),s&&(c.parent=u),u.width=e,u.height=i,l&&n===o.CANVAS&&a.disable(u.getContext("2d")),u},createWebGL:function(t,e,i){return n(t,e,i,o.WEBGL)},disableSmoothing:function(){l=!0},enableSmoothing:function(){l=!1},first:r=function(t){if(void 0===t&&(t=o.CANVAS),t===o.WEBGL)return null;for(var e=0;e0;e--){var n=Math.floor(i.random()*(e+1)),r=t[e];t[e]=t[n],t[n]=r}return t},i.choose=function(t){return t[Math.floor(i.random()*t.length)]},i.isElement=function(t){return"undefined"!=typeof HTMLElement?t instanceof HTMLElement:!!(t&&t.nodeType&&t.nodeName)},i.isArray=function(t){return"[object Array]"===Object.prototype.toString.call(t)},i.isFunction=function(t){return"function"==typeof t},i.isPlainObject=function(t){return"object"==typeof t&&t.constructor===Object},i.isString=function(t){return"[object String]"===Object.prototype.toString.call(t)},i.clamp=function(t,e,i){return ti?i:t},i.sign=function(t){return t<0?-1:1},i.now=function(){if("undefined"!=typeof window&&window.performance){if(window.performance.now)return window.performance.now();if(window.performance.webkitNow)return window.performance.webkitNow()}return new Date-i._nowStartTime},i.random=function(e,i){return i=void 0!==i?i:1,(e=void 0!==e?e:0)+t()*(i-e)};var t=function(){return i._seed=(9301*i._seed+49297)%233280,i._seed/233280};i.colorToNumber=function(t){return 3==(t=t.replace("#","")).length&&(t=t.charAt(0)+t.charAt(0)+t.charAt(1)+t.charAt(1)+t.charAt(2)+t.charAt(2)),parseInt(t,16)},i.logLevel=1,i.log=function(){console&&i.logLevel>0&&i.logLevel},i.info=function(){console&&i.logLevel>0&&i.logLevel},i.warn=function(){console&&i.logLevel>0&&i.logLevel},i.nextId=function(){return i._nextId++},i.indexOf=function(t,e){if(t.indexOf)return t.indexOf(e);for(var i=0;i0&&(n=1/Math.sqrt(n),this.x=t*n,this.y=e*n,this.z=i*n),this},dot:function(t){return this.x*t.x+this.y*t.y+this.z*t.z},cross:function(t){var e=this.x,i=this.y,n=this.z,r=t.x,s=t.y,o=t.z;return this.x=i*o-n*s,this.y=n*r-e*o,this.z=e*s-i*r,this},lerp:function(t,e){void 0===e&&(e=0);var i=this.x,n=this.y,r=this.z;return this.x=i+e*(t.x-i),this.y=n+e*(t.y-n),this.z=r+e*(t.z-r),this},applyMatrix3:function(t){var e=this.x,i=this.y,n=this.z,r=t.val;return this.x=r[0]*e+r[3]*i+r[6]*n,this.y=r[1]*e+r[4]*i+r[7]*n,this.z=r[2]*e+r[5]*i+r[8]*n,this},applyMatrix4:function(t){var e=this.x,i=this.y,n=this.z,r=t.val,s=1/(r[3]*e+r[7]*i+r[11]*n+r[15]);return this.x=(r[0]*e+r[4]*i+r[8]*n+r[12])*s,this.y=(r[1]*e+r[5]*i+r[9]*n+r[13])*s,this.z=(r[2]*e+r[6]*i+r[10]*n+r[14])*s,this},transformMat3:function(t){var e=this.x,i=this.y,n=this.z,r=t.val;return this.x=e*r[0]+i*r[3]+n*r[6],this.y=e*r[1]+i*r[4]+n*r[7],this.z=e*r[2]+i*r[5]+n*r[8],this},transformMat4:function(t){var e=this.x,i=this.y,n=this.z,r=t.val;return this.x=r[0]*e+r[4]*i+r[8]*n+r[12],this.y=r[1]*e+r[5]*i+r[9]*n+r[13],this.z=r[2]*e+r[6]*i+r[10]*n+r[14],this},transformCoordinates:function(t){var e=this.x,i=this.y,n=this.z,r=t.val,s=e*r[0]+i*r[4]+n*r[8]+r[12],o=e*r[1]+i*r[5]+n*r[9]+r[13],a=e*r[2]+i*r[6]+n*r[10]+r[14],h=e*r[3]+i*r[7]+n*r[11]+r[15];return this.x=s/h,this.y=o/h,this.z=a/h,this},transformQuat:function(t){var e=this.x,i=this.y,n=this.z,r=t.x,s=t.y,o=t.z,a=t.w,h=a*e+s*n-o*i,l=a*i+o*e-r*n,u=a*n+r*i-s*e,c=-r*e-s*i-o*n;return this.x=h*a+c*-r+l*-o-u*-s,this.y=l*a+c*-s+u*-r-h*-o,this.z=u*a+c*-o+h*-s-l*-r,this},project:function(t){var e=this.x,i=this.y,n=this.z,r=t.val,s=r[0],o=r[1],a=r[2],h=r[3],l=r[4],u=r[5],c=r[6],d=r[7],p=r[8],f=r[9],m=r[10],g=r[11],v=r[12],y=r[13],x=r[14],w=1/(e*h+i*d+n*g+r[15]);return this.x=(e*s+i*l+n*p+v)*w,this.y=(e*o+i*u+n*f+y)*w,this.z=(e*a+i*c+n*m+x)*w,this},projectViewMatrix:function(t,e){return this.applyMatrix4(t).applyMatrix4(e)},unprojectViewMatrix:function(t,e){return this.applyMatrix4(t).applyMatrix4(e)},unproject:function(t,e){var i=t.x,n=t.y,r=t.z,s=t.w,o=this.x-i,a=s-this.y-1-n,h=this.z;return this.x=2*o/r-1,this.y=2*a/s-1,this.z=2*h-1,this.project(e)},reset:function(){return this.x=0,this.y=0,this.z=0,this}});n.ZERO=new n,n.RIGHT=new n(1,0,0),n.LEFT=new n(-1,0,0),n.UP=new n(0,-1,0),n.DOWN=new n(0,1,0),n.FORWARD=new n(0,0,1),n.BACK=new n(0,0,-1),n.ONE=new n(1,1,1),t.exports=n},function(t,e){t.exports={CSV:0,TILED_JSON:1,ARRAY_2D:2,WELTMEISTER:3}},function(t,e,i){var n={};t.exports=n;var r=i(64),s=i(83),o=i(165),a=i(32),h=i(84),l=i(271);!function(){n._inertiaScale=4,n._nextCollidingGroupId=1,n._nextNonCollidingGroupId=-1,n._nextCategory=1,n.create=function(e){var i={id:a.nextId(),type:"body",label:"Body",parts:[],plugin:{},angle:0,vertices:null,position:{x:0,y:0},force:{x:0,y:0},torque:0,positionImpulse:{x:0,y:0},previousPositionImpulse:{x:0,y:0},constraintImpulse:{x:0,y:0,angle:0},totalContacts:0,speed:0,angularSpeed:0,velocity:{x:0,y:0},angularVelocity:0,isSensor:!1,isStatic:!1,isSleeping:!1,motion:0,sleepThreshold:60,density:.001,restitution:0,friction:.1,frictionStatic:.5,frictionAir:.01,collisionFilter:{category:1,mask:4294967295,group:0},slop:.05,timeScale:1,events:null,bounds:null,chamfer:null,circleRadius:0,positionPrev:null,anglePrev:0,parent:null,axes:null,area:0,mass:0,inverseMass:0,inertia:0,inverseInertia:0,_original:null,render:{visible:!0,opacity:1,sprite:{xOffset:0,yOffset:0},fillColor:null,fillOpacity:null,lineColor:null,lineOpacity:null,lineThickness:null},gameObject:null,scale:{x:1,y:1},centerOfMass:{x:0,y:0},centerOffset:{x:0,y:0},gravityScale:{x:1,y:1},ignoreGravity:!1,ignorePointer:!1,onCollideCallback:null,onCollideEndCallback:null,onCollideActiveCallback:null,onCollideWith:{}};!e.hasOwnProperty("position")&&e.hasOwnProperty("vertices")?e.position=r.centre(e.vertices):e.hasOwnProperty("vertices")||(i.vertices=r.fromPath("L 0 0 L 40 0 L 40 40 L 0 40"));var n=a.extend(i,e);return t(n,e),n.setOnCollideWith=function(t,e){return e?this.onCollideWith[t.id]=e:delete this.onCollideWith[t.id],this},n},n.nextGroup=function(t){return t?n._nextNonCollidingGroupId--:n._nextCollidingGroupId++},n.nextCategory=function(){return n._nextCategory=n._nextCategory<<1,n._nextCategory};var t=function(t,e){e=e||{},n.set(t,{bounds:t.bounds||h.create(t.vertices),positionPrev:t.positionPrev||s.clone(t.position),anglePrev:t.anglePrev||t.angle,vertices:t.vertices,parts:t.parts||[t],isStatic:t.isStatic,isSleeping:t.isSleeping,parent:t.parent||t});var i=t.bounds;if(r.rotate(t.vertices,t.angle,t.position),l.rotate(t.axes,t.angle),h.update(i,t.vertices,t.velocity),n.set(t,{axes:e.axes||t.axes,area:e.area||t.area,mass:e.mass||t.mass,inertia:e.inertia||t.inertia}),1===t.parts.length){var o=t.centerOfMass,a=t.centerOffset,u=i.max.x-i.min.x,c=i.max.y-i.min.y;o.x=-(i.min.x-t.position.x)/u,o.y=-(i.min.y-t.position.y)/c,a.x=u*o.x,a.y=c*o.y}};n.set=function(t,e,i){var r;for(r in"string"==typeof e&&(r=e,(e={})[r]=i),e)if(Object.prototype.hasOwnProperty.call(e,r))switch(i=e[r],r){case"isStatic":n.setStatic(t,i);break;case"isSleeping":o.set(t,i);break;case"mass":n.setMass(t,i);break;case"density":n.setDensity(t,i);break;case"inertia":n.setInertia(t,i);break;case"vertices":n.setVertices(t,i);break;case"position":n.setPosition(t,i);break;case"angle":n.setAngle(t,i);break;case"velocity":n.setVelocity(t,i);break;case"angularVelocity":n.setAngularVelocity(t,i);break;case"parts":n.setParts(t,i);break;case"centre":n.setCentre(t,i);break;default:t[r]=i}},n.setStatic=function(t,e){for(var i=0;i0&&s.rotateAbout(o.position,i,t.position,o.position)}},n.setVelocity=function(t,e){t.positionPrev.x=t.position.x-e.x,t.positionPrev.y=t.position.y-e.y,t.velocity.x=e.x,t.velocity.y=e.y,t.speed=s.magnitude(t.velocity)},n.setAngularVelocity=function(t,e){t.anglePrev=t.angle-e,t.angularVelocity=e,t.angularSpeed=Math.abs(t.angularVelocity)},n.translate=function(t,e){n.setPosition(t,s.add(t.position,e))},n.rotate=function(t,e,i){if(i){var r=Math.cos(e),s=Math.sin(e),o=t.position.x-i.x,a=t.position.y-i.y;n.setPosition(t,{x:i.x+(o*r-a*s),y:i.y+(o*s+a*r)}),n.setAngle(t,t.angle+e)}else n.setAngle(t,t.angle+e)},n.scale=function(t,e,i,s){var o=0,a=0;s=s||t.position;for(var u=0;u0&&(o+=c.area,a+=c.inertia),c.position.x=s.x+(c.position.x-s.x)*e,c.position.y=s.y+(c.position.y-s.y)*i,h.update(c.bounds,c.vertices,t.velocity)}t.parts.length>1&&(t.area=o,t.isStatic||(n.setMass(t,t.density*o),n.setInertia(t,a))),t.circleRadius&&(e===i?t.circleRadius*=e:t.circleRadius=null)},n.update=function(t,e,i,n){var o=Math.pow(e*i*t.timeScale,2),a=1-t.frictionAir*i*t.timeScale,u=t.position.x-t.positionPrev.x,c=t.position.y-t.positionPrev.y;t.velocity.x=u*a*n+t.force.x/t.mass*o,t.velocity.y=c*a*n+t.force.y/t.mass*o,t.positionPrev.x=t.position.x,t.positionPrev.y=t.position.y,t.position.x+=t.velocity.x,t.position.y+=t.velocity.y,t.angularVelocity=(t.angle-t.anglePrev)*a*n+t.torque/t.inertia*o,t.anglePrev=t.angle,t.angle+=t.angularVelocity,t.speed=s.magnitude(t.velocity),t.angularSpeed=Math.abs(t.angularVelocity);for(var d=0;d0&&(p.position.x+=t.velocity.x,p.position.y+=t.velocity.y),0!==t.angularVelocity&&(r.rotate(p.vertices,t.angularVelocity,t.position),l.rotate(p.axes,t.angularVelocity),d>0&&s.rotateAbout(p.position,t.angularVelocity,t.position,p.position)),h.update(p.bounds,p.vertices,t.velocity)}},n.applyForce=function(t,e,i){t.force.x+=i.x,t.force.y+=i.y;var n=e.x-t.position.x,r=e.y-t.position.y;t.torque+=n*i.y-r*i.x},n._totalProperties=function(t){for(var e={mass:0,area:0,inertia:0,centre:{x:0,y:0}},i=1===t.parts.length?0:1;i=0;o--)t[o][e]+=i+a*n,a++;return t}},function(t,e,i){var n=i(0),r=i(307),s=i(172),o=i(56),a=i(173),h=i(3),l=new n({initialize:function(t,e,i,n){void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i=0),void 0===n&&(n=0),this.type=o.LINE,this.x1=t,this.y1=e,this.x2=i,this.y2=n},getPoint:function(t,e){return r(this,t,e)},getPoints:function(t,e,i){return s(this,t,e,i)},getRandomPoint:function(t){return a(this,t)},setTo:function(t,e,i,n){return void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i=0),void 0===n&&(n=0),this.x1=t,this.y1=e,this.x2=i,this.y2=n,this},getPointA:function(t){return void 0===t&&(t=new h),t.set(this.x1,this.y1),t},getPointB:function(t){return void 0===t&&(t=new h),t.set(this.x2,this.y2),t},left:{get:function(){return Math.min(this.x1,this.x2)},set:function(t){this.x1<=this.x2?this.x1=t:this.x2=t}},right:{get:function(){return Math.max(this.x1,this.x2)},set:function(t){this.x1>this.x2?this.x1=t:this.x2=t}},top:{get:function(){return Math.min(this.y1,this.y2)},set:function(t){this.y1<=this.y2?this.y1=t:this.y2=t}},bottom:{get:function(){return Math.max(this.y1,this.y2)},set:function(t){this.y1>this.y2?this.y1=t:this.y2=t}}});t.exports=l},function(t,e){t.exports=function(t,e,i,n){var r=i||e.fillColor,s=n||e.fillAlpha,o=(16711680&r)>>>16,a=(65280&r)>>>8,h=255&r;t.fillStyle="rgba("+o+","+a+","+h+","+s+")"}},function(t,e,i){var n=new(i(0))({initialize:function(t,e,i,n){var r=[];n.forEach((function(t){t&&r.push(t)})),this.loader=t,this.type=e,this.key=i,this.multiKeyIndex=t.multiKeyIndex++,this.files=r,this.complete=!1,this.pending=r.length,this.failed=0,this.config={},this.baseURL=t.baseURL,this.path=t.path,this.prefix=t.prefix;for(var s=0;s=e&&t.y<=i&&t.y+t.height>=i}},function(t,e,i){var n=i(0),r=i(175),s=i(9),o=i(374),a=i(2),h=i(69),l=i(91),u=i(141),c=i(12),d=i(375),p=new n({Extends:s,initialize:function(t){s.call(this);var e=t.game,i=e.renderer,n=i.gl;this.name=a(t,"name","WebGLPipeline"),this.game=e,this.renderer=i,this.manager,this.gl=n,this.view=e.canvas,this.width=0,this.height=0,this.vertexCount=0,this.vertexCapacity=0,this.vertexData,this.vertexBuffer,this.topology=a(t,"topology",n.TRIANGLES),this.bytes,this.vertexViewF32,this.vertexViewU32,this.active=!0,this.currentUnit=0,this.forceZero=a(t,"forceZero",!1),this.hasBooted=!1,this.isPostFX=!1,this.renderTargets=[],this.currentRenderTarget,this.shaders=[],this.currentShader,this.projectionMatrix,this.projectionWidth=0,this.projectionHeight=0,this.config=t,this.glReset=!1},boot:function(){var t,e=this.gl,i=this.config,n=this.renderer;this.isPostFX||(this.projectionMatrix=(new h).identity());var r=this.renderTargets,s=a(i,"renderTarget",!1);"boolean"==typeof s&&s&&(s=1);var c=n.width,d=n.height;if("number"==typeof s)for(t=0;tv&&(v=g[t].vertexSize);var y=a(i,"batchSize",n.config.batchSize);this.vertexCapacity=6*y;var x=new ArrayBuffer(this.vertexCapacity*v);this.vertexData=x,this.bytes=new Uint8Array(x),this.vertexViewF32=new Float32Array(x),this.vertexViewU32=new Uint32Array(x);var w=a(i,"vertices",null);for(w?(this.vertexViewF32.set(w),this.vertexBuffer=n.createVertexBuffer(x,e.STATIC_DRAW)):this.vertexBuffer=n.createVertexBuffer(x.byteLength,e.DYNAMIC_DRAW),this.setVertexBuffer(),t=g.length-1;t>=0;t--)g[t].rebind();this.hasBooted=!0,n.on(l.RESIZE,this.resize,this),n.on(l.PRE_RENDER,this.onPreRender,this),n.on(l.RENDER,this.onRender,this),n.on(l.POST_RENDER,this.onPostRender,this),this.emit(o.BOOT,this),this.onBoot()},onBoot:function(){},onResize:function(){},setShader:function(t,e){var i=this.renderer;return t===this.currentShader&&i.currentProgram===this.currentShader.program||(this.flush(),i.resetTextures(),this.setVertexBuffer()&&!e&&(e=!0),t.bind(e,!1),this.currentShader=t),this},getShaderByName:function(t){for(var e=this.shaders,i=0;ithis.vertexCapacity},resize:function(t,e){t===this.width&&e===this.height||this.flush(),this.width=t,this.height=e;for(var i=this.renderTargets,n=0;n=0;i--){var n=e[i].rebind();t&&n!==t||(this.currentShader=n)}return this.emit(o.REBIND,this.currentShader),this.onActive(this.currentShader),this.onRebind(),this.glReset=!1,this},setVertexBuffer:function(){var t=this.gl,e=this.vertexBuffer;return t.getParameter(t.ARRAY_BUFFER_BINDING)!==e&&(t.bindBuffer(t.ARRAY_BUFFER,e),!0)},preBatch:function(t){return this.currentRenderTarget&&this.currentRenderTarget.bind(),this.onPreBatch(t),this},postBatch:function(t){return this.onDraw(this.currentRenderTarget),this.onPostBatch(t),this},onDraw:function(){},unbind:function(){this.currentRenderTarget&&this.currentRenderTarget.unbind()},flush:function(t){if(void 0===t&&(t=!1),this.vertexCount>0){this.emit(o.BEFORE_FLUSH,this,t),this.onBeforeFlush(t);var e=this.gl,i=this.vertexCount,n=this.currentShader.vertexSize;this.active&&(this.setVertexBuffer(),i===this.vertexCapacity?e.bufferData(e.ARRAY_BUFFER,this.vertexData,e.DYNAMIC_DRAW):e.bufferSubData(e.ARRAY_BUFFER,0,this.bytes.subarray(0,i*n)),e.drawArrays(this.topology,0,i)),this.vertexCount=0,this.emit(o.AFTER_FLUSH,this,t),this.onAfterFlush(t)}return this},onActive:function(){},onBind:function(){},onRebind:function(){},onBatch:function(){},onPreBatch:function(){},onPostBatch:function(){},onPreRender:function(){},onRender:function(){},onPostRender:function(){},onBeforeFlush:function(){},onAfterFlush:function(){},batchVert:function(t,e,i,n,r,s,o){var a=this.vertexViewF32,h=this.vertexViewU32,l=this.vertexCount*this.currentShader.vertexComponentCount-1;a[++l]=t,a[++l]=e,a[++l]=i,a[++l]=n,a[++l]=r,a[++l]=s,h[++l]=o,this.vertexCount++},batchQuad:function(t,e,i,n,r,s,o,a,h,l,u,c,d,p,f,m,g,v,y,x){void 0===x&&(x=this.currentUnit);var w=!1;return this.shouldFlush(6)&&(this.flush(),w=!0,x=this.setTexture2D(y)),this.batchVert(e,i,l,u,x,v,p),this.batchVert(n,r,l,d,x,v,m),this.batchVert(s,o,c,d,x,v,g),this.batchVert(e,i,l,u,x,v,p),this.batchVert(s,o,c,d,x,v,g),this.batchVert(a,h,c,u,x,v,f),this.onBatch(t),w},batchTri:function(t,e,i,n,r,s,o,a,h,l,u,c,d,p,f,m,g){void 0===g&&(g=this.currentUnit);var v=!1;return this.shouldFlush(3)&&(this.flush(),v=!0,g=this.setTexture2D(m)),this.batchVert(e,i,a,h,g,f,c),this.batchVert(n,r,a,u,g,f,d),this.batchVert(s,o,l,u,g,f,p),this.onBatch(t),v},drawFillRect:function(t,e,i,n,r,s,o,a){void 0===o&&(o=this.renderer.whiteTexture.glTexture),void 0===a&&(a=!0),t=Math.floor(t),e=Math.floor(e);var h=Math.floor(t+i),l=Math.floor(e+n),u=this.setTexture2D(o),d=c.getTintAppendFloatAlphaAndSwap(r,s),p=0,f=1;a&&(p=1,f=0),this.batchQuad(null,t,e,t,l,h,l,h,e,0,p,1,f,d,d,d,d,0,o,u)},setTexture2D:function(t){return void 0===t&&(t=this.renderer.whiteTexture.glTexture),this.currentUnit=this.renderer.setTexture2D(t),this.currentUnit},bindTexture:function(t,e){void 0===e&&(e=0);var i=this.gl;return i.activeTexture(i.TEXTURE0+e),i.bindTexture(i.TEXTURE_2D,t),this},bindRenderTarget:function(t,e){return this.bindTexture(t.texture,e)},setTime:function(t){return this.set1f(t,this.game.loop.getDuration()),this},set1f:function(t,e,i){return void 0===i&&(i=this.currentShader),i.set1f(t,e),this},set2f:function(t,e,i,n){return void 0===n&&(n=this.currentShader),n.set2f(t,e,i),this},set3f:function(t,e,i,n,r){return void 0===r&&(r=this.currentShader),r.set3f(t,e,i,n),this},set4f:function(t,e,i,n,r,s){return void 0===s&&(s=this.currentShader),s.set4f(t,e,i,n,r),this},set1fv:function(t,e,i){return void 0===i&&(i=this.currentShader),i.set1fv(t,e),this},set2fv:function(t,e,i){return void 0===i&&(i=this.currentShader),i.set2fv(t,e),this},set3fv:function(t,e,i){return void 0===i&&(i=this.currentShader),i.set3fv(t,e),this},set4fv:function(t,e,i){return void 0===i&&(i=this.currentShader),i.set4fv(t,e),this},set1iv:function(t,e,i){return void 0===i&&(i=this.currentShader),i.set1iv(t,e),this},set2iv:function(t,e,i){return void 0===i&&(i=this.currentShader),i.set2iv(t,e),this},set3iv:function(t,e,i){return void 0===i&&(i=this.currentShader),i.set3iv(t,e),this},set4iv:function(t,e,i){return void 0===i&&(i=this.currentShader),i.set4iv(t,e),this},set1i:function(t,e,i){return void 0===i&&(i=this.currentShader),i.set1i(t,e),this},set2i:function(t,e,i,n){return void 0===n&&(n=this.currentShader),n.set2i(t,e,i),this},set3i:function(t,e,i,n,r){return void 0===r&&(r=this.currentShader),r.set3i(t,e,i,n),this},set4i:function(t,e,i,n,r,s){return void 0===s&&(s=this.currentShader),s.set4i(t,e,i,n,r),this},setMatrix2fv:function(t,e,i,n){return void 0===n&&(n=this.currentShader),n.setMatrix2fv(t,e,i),this},setMatrix3fv:function(t,e,i,n){return void 0===n&&(n=this.currentShader),n.setMatrix3fv(t,e,i),this},setMatrix4fv:function(t,e,i,n){return void 0===n&&(n=this.currentShader),n.setMatrix4fv(t,e,i),this},destroy:function(){var t;this.emit(o.DESTROY,this);var e=this.shaders;for(t=0;t80*i){n=h=t[0],a=l=t[1];for(var w=i;wh&&(h=u),p>l&&(l=p);f=0!==(f=Math.max(h-n,l-a))?1/f:0}return o(y,x,i,n,a,f),x}function r(t,e,i,n,r){var s,o;if(r===C(t,e,i,n)>0)for(s=e;s=e;s-=n)o=E(s,t[s],t[s+1],o);return o&&x(o,o.next)&&(M(o),o=o.next),o}function s(t,e){if(!t)return t;e||(e=t);var i,n=t;do{if(i=!1,n.steiner||!x(n,n.next)&&0!==y(n.prev,n,n.next))n=n.next;else{if(M(n),(n=e=n.prev)===n.next)break;i=!0}}while(i||n!==e);return e}function o(t,e,i,n,r,c,d){if(t){!d&&c&&function(t,e,i,n){var r=t;do{null===r.z&&(r.z=f(r.x,r.y,e,i,n)),r.prevZ=r.prev,r.nextZ=r.next,r=r.next}while(r!==t);r.prevZ.nextZ=null,r.prevZ=null,function(t){var e,i,n,r,s,o,a,h,l=1;do{for(i=t,t=null,s=null,o=0;i;){for(o++,n=i,a=0,e=0;e0||h>0&&n;)0!==a&&(0===h||!n||i.z<=n.z)?(r=i,i=i.nextZ,a--):(r=n,n=n.nextZ,h--),s?s.nextZ=r:t=r,r.prevZ=s,s=r;i=n}s.nextZ=null,l*=2}while(o>1)}(r)}(t,n,r,c);for(var p,m,g=t;t.prev!==t.next;)if(p=t.prev,m=t.next,c?h(t,n,r,c):a(t))e.push(p.i/i),e.push(t.i/i),e.push(m.i/i),M(t),t=m.next,g=m.next;else if((t=m)===g){d?1===d?o(t=l(s(t),e,i),e,i,n,r,c,2):2===d&&u(t,e,i,n,r,c):o(s(t),e,i,n,r,c,1);break}}}function a(t){var e=t.prev,i=t,n=t.next;if(y(e,i,n)>=0)return!1;for(var r=t.next.next;r!==t.prev;){if(g(e.x,e.y,i.x,i.y,n.x,n.y,r.x,r.y)&&y(r.prev,r,r.next)>=0)return!1;r=r.next}return!0}function h(t,e,i,n){var r=t.prev,s=t,o=t.next;if(y(r,s,o)>=0)return!1;for(var a=r.xs.x?r.x>o.x?r.x:o.x:s.x>o.x?s.x:o.x,u=r.y>s.y?r.y>o.y?r.y:o.y:s.y>o.y?s.y:o.y,c=f(a,h,e,i,n),d=f(l,u,e,i,n),p=t.prevZ,m=t.nextZ;p&&p.z>=c&&m&&m.z<=d;){if(p!==t.prev&&p!==t.next&&g(r.x,r.y,s.x,s.y,o.x,o.y,p.x,p.y)&&y(p.prev,p,p.next)>=0)return!1;if(p=p.prevZ,m!==t.prev&&m!==t.next&&g(r.x,r.y,s.x,s.y,o.x,o.y,m.x,m.y)&&y(m.prev,m,m.next)>=0)return!1;m=m.nextZ}for(;p&&p.z>=c;){if(p!==t.prev&&p!==t.next&&g(r.x,r.y,s.x,s.y,o.x,o.y,p.x,p.y)&&y(p.prev,p,p.next)>=0)return!1;p=p.prevZ}for(;m&&m.z<=d;){if(m!==t.prev&&m!==t.next&&g(r.x,r.y,s.x,s.y,o.x,o.y,m.x,m.y)&&y(m.prev,m,m.next)>=0)return!1;m=m.nextZ}return!0}function l(t,e,i){var n=t;do{var r=n.prev,o=n.next.next;!x(r,o)&&w(r,n,n.next,o)&&T(r,o)&&T(o,r)&&(e.push(r.i/i),e.push(n.i/i),e.push(o.i/i),M(n),M(n.next),n=t=o),n=n.next}while(n!==t);return s(n)}function u(t,e,i,n,r,a){var h=t;do{for(var l=h.next.next;l!==h.prev;){if(h.i!==l.i&&v(h,l)){var u=S(h,l);return h=s(h,h.next),u=s(u,u.next),o(h,e,i,n,r,a),void o(u,e,i,n,r,a)}l=l.next}h=h.next}while(h!==t)}function c(t,e){return t.x-e.x}function d(t,e){if(e=function(t,e){var i,n=e,r=t.x,s=t.y,o=-1/0;do{if(s<=n.y&&s>=n.next.y&&n.next.y!==n.y){var a=n.x+(s-n.y)*(n.next.x-n.x)/(n.next.y-n.y);if(a<=r&&a>o){if(o=a,a===r){if(s===n.y)return n;if(s===n.next.y)return n.next}i=n.x=n.x&&n.x>=u&&r!==n.x&&g(si.x||n.x===i.x&&p(i,n)))&&(i=n,d=h)),n=n.next}while(n!==l);return i}(t,e)){var i=S(e,t);s(e,e.next),s(i,i.next)}}function p(t,e){return y(t.prev,t,e.prev)<0&&y(e.next,t,t.next)<0}function f(t,e,i,n,r){return(t=1431655765&((t=858993459&((t=252645135&((t=16711935&((t=32767*(t-i)*r)|t<<8))|t<<4))|t<<2))|t<<1))|(e=1431655765&((e=858993459&((e=252645135&((e=16711935&((e=32767*(e-n)*r)|e<<8))|e<<4))|e<<2))|e<<1))<<1}function m(t){var e=t,i=t;do{(e.x=0&&(t-o)*(n-a)-(i-o)*(e-a)>=0&&(i-o)*(s-a)-(r-o)*(n-a)>=0}function v(t,e){return t.next.i!==e.i&&t.prev.i!==e.i&&!function(t,e){var i=t;do{if(i.i!==t.i&&i.next.i!==t.i&&i.i!==e.i&&i.next.i!==e.i&&w(i,i.next,t,e))return!0;i=i.next}while(i!==t);return!1}(t,e)&&(T(t,e)&&T(e,t)&&function(t,e){var i=t,n=!1,r=(t.x+e.x)/2,s=(t.y+e.y)/2;do{i.y>s!=i.next.y>s&&i.next.y!==i.y&&r<(i.next.x-i.x)*(s-i.y)/(i.next.y-i.y)+i.x&&(n=!n),i=i.next}while(i!==t);return n}(t,e)&&(y(t.prev,t,e.prev)||y(t,e.prev,e))||x(t,e)&&y(t.prev,t,t.next)>0&&y(e.prev,e,e.next)>0)}function y(t,e,i){return(e.y-t.y)*(i.x-e.x)-(e.x-t.x)*(i.y-e.y)}function x(t,e){return t.x===e.x&&t.y===e.y}function w(t,e,i,n){var r=A(y(t,e,i)),s=A(y(t,e,n)),o=A(y(i,n,t)),a=A(y(i,n,e));return r!==s&&o!==a||!(0!==r||!b(t,i,e))||!(0!==s||!b(t,n,e))||!(0!==o||!b(i,t,n))||!(0!==a||!b(i,e,n))}function b(t,e,i){return e.x<=Math.max(t.x,i.x)&&e.x>=Math.min(t.x,i.x)&&e.y<=Math.max(t.y,i.y)&&e.y>=Math.min(t.y,i.y)}function A(t){return t>0?1:t<0?-1:0}function T(t,e){return y(t.prev,t,t.next)<0?y(t,e,t.next)>=0&&y(t,t.prev,e)>=0:y(t,e,t.prev)<0||y(t,t.next,e)<0}function S(t,e){var i=new _(t.i,t.x,t.y),n=new _(e.i,e.x,e.y),r=t.next,s=e.prev;return t.next=e,e.prev=t,i.next=r,r.prev=i,n.next=i,i.prev=n,s.next=n,n.prev=s,n}function E(t,e,i,n){var r=new _(t,e,i);return n?(r.next=n.next,r.prev=n,n.next.prev=r,n.next=r):(r.prev=r,r.next=r),r}function M(t){t.next.prev=t.prev,t.prev.next=t.next,t.prevZ&&(t.prevZ.nextZ=t.nextZ),t.nextZ&&(t.nextZ.prevZ=t.prevZ)}function _(t,e,i){this.i=t,this.x=e,this.y=i,this.prev=null,this.next=null,this.z=null,this.prevZ=null,this.nextZ=null,this.steiner=!1}function C(t,e,i,n){for(var r=0,s=e,o=i-n;s0&&(n+=t[r-1].length,i.holes.push(n))}return i},t.exports=n},function(t,e){t.exports=function(t,e,i,n){var r=i||e.strokeColor,s=n||e.strokeAlpha,o=(16711680&r)>>>16,a=(65280&r)>>>8,h=255&r;t.strokeStyle="rgba("+o+","+a+","+h+","+s+")",t.lineWidth=e.lineWidth}},function(t,e,i){var n=i(0),r=i(21),s=i(23),o=i(8),a=i(2),h=i(6),l=i(7),u=new n({Extends:s,initialize:function(t,e,i,n,o){var u="json";if(l(e)){var c=e;e=a(c,"key"),i=a(c,"url"),n=a(c,"xhrSettings"),u=a(c,"extension",u),o=a(c,"dataKey",o)}var d={type:"json",cache:t.cacheManager.json,extension:u,responseType:"text",key:e,url:i,xhrSettings:n,config:o};s.call(this,t,d),l(i)&&(this.data=o?h(i,o):i,this.state=r.FILE_POPULATED)},onProcess:function(){if(this.state!==r.FILE_POPULATED){this.state=r.FILE_PROCESSING;try{var t=JSON.parse(this.xhrLoader.responseText)}catch(t){throw this.onProcessError(),t}var e=this.config;this.data="string"==typeof e?h(t,e,t):t}this.onProcessComplete()}});o.register("json",(function(t,e,i,n){if(Array.isArray(t))for(var r=0;r0)return!1}return!0},n.scale=function(t,e,i,s){if(1===e&&1===i)return t;var o,a;s=s||n.centre(t);for(var h=0;h=0?h-1:t.length-1],u=t[h],c=t[(h+1)%t.length],d=e[h0&&(s|=2),3===s)return!1;return 0!==s||null},n.hull=function(t){var e,i,n=[],s=[];for((t=t.slice(0)).sort((function(t,e){var i=t.x-e.x;return 0!==i?i:t.y-e.y})),i=0;i=2&&r.cross3(s[s.length-2],s[s.length-1],e)<=0;)s.pop();s.push(e)}for(i=t.length-1;i>=0;i-=1){for(e=t[i];n.length>=2&&r.cross3(n[n.length-2],n[n.length-1],e)<=0;)n.pop();n.push(e)}return n.pop(),s.pop(),n.concat(s)}},function(t,e,i){var n=i(0),r=i(66),s=i(300),o=i(301),a=i(56),h=i(170),l=new n({initialize:function(t,e,i){void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i=0),this.type=a.CIRCLE,this.x=t,this.y=e,this._radius=i,this._diameter=2*i},contains:function(t,e){return r(this,t,e)},getPoint:function(t,e){return s(this,t,e)},getPoints:function(t,e,i){return o(this,t,e,i)},getRandomPoint:function(t){return h(this,t)},setTo:function(t,e,i){return this.x=t,this.y=e,this._radius=i,this._diameter=2*i,this},setEmpty:function(){return this._radius=0,this._diameter=0,this},setPosition:function(t,e){return void 0===e&&(e=t),this.x=t,this.y=e,this},isEmpty:function(){return this._radius<=0},radius:{get:function(){return this._radius},set:function(t){this._radius=t,this._diameter=2*t}},diameter:{get:function(){return this._diameter},set:function(t){this._diameter=t,this._radius=.5*t}},left:{get:function(){return this.x-this._radius},set:function(t){this.x=t+this._radius}},right:{get:function(){return this.x+this._radius},set:function(t){this.x=t-this._radius}},top:{get:function(){return this.y-this._radius},set:function(t){this.y=t+this._radius}},bottom:{get:function(){return this.y+this._radius},set:function(t){this.y=t-this._radius}}});t.exports=l},function(t,e){t.exports=function(t,e,i){return t.radius>0&&e>=t.left&&e<=t.right&&i>=t.top&&i<=t.bottom&&(t.x-e)*(t.x-e)+(t.y-i)*(t.y-i)<=t.radius*t.radius}},function(t,e){t.exports=function(t){return Math.sqrt((t.x2-t.x1)*(t.x2-t.x1)+(t.y2-t.y1)*(t.y2-t.y1))}},function(t,e){t.exports=function(t,e,i){var n=i-e;return e+((t-e)%n+n)%n}},function(t,e,i){var n=i(0),r=i(39),s=new n({initialize:function(t){this.val=new Float32Array(16),t?this.copy(t):this.identity()},clone:function(){return new s(this)},set:function(t){return this.copy(t)},setValues:function(t,e,i,n,r,s,o,a,h,l,u,c,d,p,f,m){var g=this.val;return g[0]=t,g[1]=e,g[2]=i,g[3]=n,g[4]=r,g[5]=s,g[6]=o,g[7]=a,g[8]=h,g[9]=l,g[10]=u,g[11]=c,g[12]=d,g[13]=p,g[14]=f,g[15]=m,this},copy:function(t){var e=t.val;return this.setValues(e[0],e[1],e[2],e[3],e[4],e[5],e[6],e[7],e[8],e[9],e[10],e[11],e[12],e[13],e[14],e[15])},fromArray:function(t){return this.setValues(t[0],t[1],t[2],t[3],t[4],t[5],t[6],t[7],t[8],t[9],t[10],t[11],t[12],t[13],t[14],t[15])},zero:function(){return this.setValues(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0)},transform:function(t,e,i){var n=o.fromQuat(i).val,r=e.x,s=e.y,a=e.z;return this.setValues(n[0]*r,n[1]*r,n[2]*r,0,n[4]*s,n[5]*s,n[6]*s,0,n[8]*a,n[9]*a,n[10]*a,0,t.x,t.y,t.z,1)},xyz:function(t,e,i){this.identity();var n=this.val;return n[12]=t,n[13]=e,n[14]=i,this},scaling:function(t,e,i){this.zero();var n=this.val;return n[0]=t,n[5]=e,n[10]=i,n[15]=1,this},identity:function(){return this.setValues(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1)},transpose:function(){var t=this.val,e=t[1],i=t[2],n=t[3],r=t[6],s=t[7],o=t[11];return t[1]=t[4],t[2]=t[8],t[3]=t[12],t[4]=e,t[6]=t[9],t[7]=t[13],t[8]=i,t[9]=r,t[11]=t[14],t[12]=n,t[13]=s,t[14]=o,this},getInverse:function(t){return this.copy(t),this.invert()},invert:function(){var t=this.val,e=t[0],i=t[1],n=t[2],r=t[3],s=t[4],o=t[5],a=t[6],h=t[7],l=t[8],u=t[9],c=t[10],d=t[11],p=t[12],f=t[13],m=t[14],g=t[15],v=e*o-i*s,y=e*a-n*s,x=e*h-r*s,w=i*a-n*o,b=i*h-r*o,A=n*h-r*a,T=l*f-u*p,S=l*m-c*p,E=l*g-d*p,M=u*m-c*f,_=u*g-d*f,C=c*g-d*m,P=v*C-y*_+x*M+w*E-b*S+A*T;return P?(P=1/P,this.setValues((o*C-a*_+h*M)*P,(n*_-i*C-r*M)*P,(f*A-m*b+g*w)*P,(c*b-u*A-d*w)*P,(a*E-s*C-h*S)*P,(e*C-n*E+r*S)*P,(m*x-p*A-g*y)*P,(l*A-c*x+d*y)*P,(s*_-o*E+h*T)*P,(i*E-e*_-r*T)*P,(p*b-f*x+g*v)*P,(u*x-l*b-d*v)*P,(o*S-s*M-a*T)*P,(e*M-i*S+n*T)*P,(f*y-p*w-m*v)*P,(l*w-u*y+c*v)*P)):this},adjoint:function(){var t=this.val,e=t[0],i=t[1],n=t[2],r=t[3],s=t[4],o=t[5],a=t[6],h=t[7],l=t[8],u=t[9],c=t[10],d=t[11],p=t[12],f=t[13],m=t[14],g=t[15];return this.setValues(o*(c*g-d*m)-u*(a*g-h*m)+f*(a*d-h*c),-(i*(c*g-d*m)-u*(n*g-r*m)+f*(n*d-r*c)),i*(a*g-h*m)-o*(n*g-r*m)+f*(n*h-r*a),-(i*(a*d-h*c)-o*(n*d-r*c)+u*(n*h-r*a)),-(s*(c*g-d*m)-l*(a*g-h*m)+p*(a*d-h*c)),e*(c*g-d*m)-l*(n*g-r*m)+p*(n*d-r*c),-(e*(a*g-h*m)-s*(n*g-r*m)+p*(n*h-r*a)),e*(a*d-h*c)-s*(n*d-r*c)+l*(n*h-r*a),s*(u*g-d*f)-l*(o*g-h*f)+p*(o*d-h*u),-(e*(u*g-d*f)-l*(i*g-r*f)+p*(i*d-r*u)),e*(o*g-h*f)-s*(i*g-r*f)+p*(i*h-r*o),-(e*(o*d-h*u)-s*(i*d-r*u)+l*(i*h-r*o)),-(s*(u*m-c*f)-l*(o*m-a*f)+p*(o*c-a*u)),e*(u*m-c*f)-l*(i*m-n*f)+p*(i*c-n*u),-(e*(o*m-a*f)-s*(i*m-n*f)+p*(i*a-n*o)),e*(o*c-a*u)-s*(i*c-n*u)+l*(i*a-n*o))},determinant:function(){var t=this.val,e=t[0],i=t[1],n=t[2],r=t[3],s=t[4],o=t[5],a=t[6],h=t[7],l=t[8],u=t[9],c=t[10],d=t[11],p=t[12],f=t[13],m=t[14],g=t[15];return(e*o-i*s)*(c*g-d*m)-(e*a-n*s)*(u*g-d*f)+(e*h-r*s)*(u*m-c*f)+(i*a-n*o)*(l*g-d*p)-(i*h-r*o)*(l*m-c*p)+(n*h-r*a)*(l*f-u*p)},multiply:function(t){var e=this.val,i=e[0],n=e[1],r=e[2],s=e[3],o=e[4],a=e[5],h=e[6],l=e[7],u=e[8],c=e[9],d=e[10],p=e[11],f=e[12],m=e[13],g=e[14],v=e[15],y=t.val,x=y[0],w=y[1],b=y[2],A=y[3];return e[0]=x*i+w*o+b*u+A*f,e[1]=x*n+w*a+b*c+A*m,e[2]=x*r+w*h+b*d+A*g,e[3]=x*s+w*l+b*p+A*v,x=y[4],w=y[5],b=y[6],A=y[7],e[4]=x*i+w*o+b*u+A*f,e[5]=x*n+w*a+b*c+A*m,e[6]=x*r+w*h+b*d+A*g,e[7]=x*s+w*l+b*p+A*v,x=y[8],w=y[9],b=y[10],A=y[11],e[8]=x*i+w*o+b*u+A*f,e[9]=x*n+w*a+b*c+A*m,e[10]=x*r+w*h+b*d+A*g,e[11]=x*s+w*l+b*p+A*v,x=y[12],w=y[13],b=y[14],A=y[15],e[12]=x*i+w*o+b*u+A*f,e[13]=x*n+w*a+b*c+A*m,e[14]=x*r+w*h+b*d+A*g,e[15]=x*s+w*l+b*p+A*v,this},multiplyLocal:function(t){var e=this.val,i=t.val;return this.setValues(e[0]*i[0]+e[1]*i[4]+e[2]*i[8]+e[3]*i[12],e[0]*i[1]+e[1]*i[5]+e[2]*i[9]+e[3]*i[13],e[0]*i[2]+e[1]*i[6]+e[2]*i[10]+e[3]*i[14],e[0]*i[3]+e[1]*i[7]+e[2]*i[11]+e[3]*i[15],e[4]*i[0]+e[5]*i[4]+e[6]*i[8]+e[7]*i[12],e[4]*i[1]+e[5]*i[5]+e[6]*i[9]+e[7]*i[13],e[4]*i[2]+e[5]*i[6]+e[6]*i[10]+e[7]*i[14],e[4]*i[3]+e[5]*i[7]+e[6]*i[11]+e[7]*i[15],e[8]*i[0]+e[9]*i[4]+e[10]*i[8]+e[11]*i[12],e[8]*i[1]+e[9]*i[5]+e[10]*i[9]+e[11]*i[13],e[8]*i[2]+e[9]*i[6]+e[10]*i[10]+e[11]*i[14],e[8]*i[3]+e[9]*i[7]+e[10]*i[11]+e[11]*i[15],e[12]*i[0]+e[13]*i[4]+e[14]*i[8]+e[15]*i[12],e[12]*i[1]+e[13]*i[5]+e[14]*i[9]+e[15]*i[13],e[12]*i[2]+e[13]*i[6]+e[14]*i[10]+e[15]*i[14],e[12]*i[3]+e[13]*i[7]+e[14]*i[11]+e[15]*i[15])},premultiply:function(t){return this.multiplyMatrices(t,this)},multiplyMatrices:function(t,e){var i=t.val,n=e.val,r=i[0],s=i[4],o=i[8],a=i[12],h=i[1],l=i[5],u=i[9],c=i[13],d=i[2],p=i[6],f=i[10],m=i[14],g=i[3],v=i[7],y=i[11],x=i[15],w=n[0],b=n[4],A=n[8],T=n[12],S=n[1],E=n[5],M=n[9],_=n[13],C=n[2],P=n[6],R=n[10],L=n[14],O=n[3],D=n[7],B=n[11],I=n[15];return this.setValues(r*w+s*S+o*C+a*O,h*w+l*S+u*C+c*O,d*w+p*S+f*C+m*O,g*w+v*S+y*C+x*O,r*b+s*E+o*P+a*D,h*b+l*E+u*P+c*D,d*b+p*E+f*P+m*D,g*b+v*E+y*P+x*D,r*A+s*M+o*R+a*B,h*A+l*M+u*R+c*B,d*A+p*M+f*R+m*B,g*A+v*M+y*R+x*B,r*T+s*_+o*L+a*I,h*T+l*_+u*L+c*I,d*T+p*_+f*L+m*I,g*T+v*_+y*L+x*I)},translate:function(t){return this.translateXYZ(t.x,t.y,t.z)},translateXYZ:function(t,e,i){var n=this.val;return n[12]=n[0]*t+n[4]*e+n[8]*i+n[12],n[13]=n[1]*t+n[5]*e+n[9]*i+n[13],n[14]=n[2]*t+n[6]*e+n[10]*i+n[14],n[15]=n[3]*t+n[7]*e+n[11]*i+n[15],this},scale:function(t){return this.scaleXYZ(t.x,t.y,t.z)},scaleXYZ:function(t,e,i){var n=this.val;return n[0]=n[0]*t,n[1]=n[1]*t,n[2]=n[2]*t,n[3]=n[3]*t,n[4]=n[4]*e,n[5]=n[5]*e,n[6]=n[6]*e,n[7]=n[7]*e,n[8]=n[8]*i,n[9]=n[9]*i,n[10]=n[10]*i,n[11]=n[11]*i,this},makeRotationAxis:function(t,e){var i=Math.cos(e),n=Math.sin(e),r=1-i,s=t.x,o=t.y,a=t.z,h=r*s,l=r*o;return this.setValues(h*s+i,h*o-n*a,h*a+n*o,0,h*o+n*a,l*o+i,l*a-n*s,0,h*a-n*o,l*a+n*s,r*a*a+i,0,0,0,0,1)},rotate:function(t,e){var i=this.val,n=e.x,r=e.y,s=e.z,o=Math.sqrt(n*n+r*r+s*s);if(Math.abs(o)<1e-6)return this;n*=o=1/o,r*=o,s*=o;var a=Math.sin(t),h=Math.cos(t),l=1-h,u=i[0],c=i[1],d=i[2],p=i[3],f=i[4],m=i[5],g=i[6],v=i[7],y=i[8],x=i[9],w=i[10],b=i[11],A=i[12],T=i[13],S=i[14],E=i[15],M=n*n*l+h,_=r*n*l+s*a,C=s*n*l-r*a,P=n*r*l-s*a,R=r*r*l+h,L=s*r*l+n*a,O=n*s*l+r*a,D=r*s*l-n*a,B=s*s*l+h;return this.setValues(u*M+f*_+y*C,c*M+m*_+x*C,d*M+g*_+w*C,p*M+v*_+b*C,u*P+f*R+y*L,c*P+m*R+x*L,d*P+g*R+w*L,p*P+v*R+b*L,u*O+f*D+y*B,c*O+m*D+x*B,d*O+g*D+w*B,p*O+v*D+b*B,A,T,S,E)},rotateX:function(t){var e=this.val,i=Math.sin(t),n=Math.cos(t),r=e[4],s=e[5],o=e[6],a=e[7],h=e[8],l=e[9],u=e[10],c=e[11];return e[4]=r*n+h*i,e[5]=s*n+l*i,e[6]=o*n+u*i,e[7]=a*n+c*i,e[8]=h*n-r*i,e[9]=l*n-s*i,e[10]=u*n-o*i,e[11]=c*n-a*i,this},rotateY:function(t){var e=this.val,i=Math.sin(t),n=Math.cos(t),r=e[0],s=e[1],o=e[2],a=e[3],h=e[8],l=e[9],u=e[10],c=e[11];return e[0]=r*n-h*i,e[1]=s*n-l*i,e[2]=o*n-u*i,e[3]=a*n-c*i,e[8]=r*i+h*n,e[9]=s*i+l*n,e[10]=o*i+u*n,e[11]=a*i+c*n,this},rotateZ:function(t){var e=this.val,i=Math.sin(t),n=Math.cos(t),r=e[0],s=e[1],o=e[2],a=e[3],h=e[4],l=e[5],u=e[6],c=e[7];return e[0]=r*n+h*i,e[1]=s*n+l*i,e[2]=o*n+u*i,e[3]=a*n+c*i,e[4]=h*n-r*i,e[5]=l*n-s*i,e[6]=u*n-o*i,e[7]=c*n-a*i,this},fromRotationTranslation:function(t,e){var i=t.x,n=t.y,r=t.z,s=t.w,o=i+i,a=n+n,h=r+r,l=i*o,u=i*a,c=i*h,d=n*a,p=n*h,f=r*h,m=s*o,g=s*a,v=s*h;return this.setValues(1-(d+f),u+v,c-g,0,u-v,1-(l+f),p+m,0,c+g,p-m,1-(l+d),0,e.x,e.y,e.z,1)},fromQuat:function(t){var e=t.x,i=t.y,n=t.z,r=t.w,s=e+e,o=i+i,a=n+n,h=e*s,l=e*o,u=e*a,c=i*o,d=i*a,p=n*a,f=r*s,m=r*o,g=r*a;return this.setValues(1-(c+p),l+g,u-m,0,l-g,1-(h+p),d+f,0,u+m,d-f,1-(h+c),0,0,0,0,1)},frustum:function(t,e,i,n,r,s){var o=1/(e-t),a=1/(n-i),h=1/(r-s);return this.setValues(2*r*o,0,0,0,0,2*r*a,0,0,(e+t)*o,(n+i)*a,(s+r)*h,-1,0,0,s*r*2*h,0)},perspective:function(t,e,i,n){var r=1/Math.tan(t/2),s=1/(i-n);return this.setValues(r/e,0,0,0,0,r,0,0,0,0,(n+i)*s,-1,0,0,2*n*i*s,0)},perspectiveLH:function(t,e,i,n){return this.setValues(2*i/t,0,0,0,0,2*i/e,0,0,0,0,-n/(i-n),1,0,0,i*n/(i-n),0)},ortho:function(t,e,i,n,r,s){var o=t-e,a=i-n,h=r-s;return o=0===o?o:1/o,a=0===a?a:1/a,h=0===h?h:1/h,this.setValues(-2*o,0,0,0,0,-2*a,0,0,0,0,2*h,0,(t+e)*o,(n+i)*a,(s+r)*h,1)},lookAtRH:function(t,e,i){var n=this.val;return u.subVectors(t,e),0===u.getLengthSquared()&&(u.z=1),u.normalize(),h.crossVectors(i,u),0===h.getLengthSquared()&&(1===Math.abs(i.z)?u.x+=1e-4:u.z+=1e-4,u.normalize(),h.crossVectors(i,u)),h.normalize(),l.crossVectors(u,h),n[0]=h.x,n[1]=h.y,n[2]=h.z,n[4]=l.x,n[5]=l.y,n[6]=l.z,n[8]=u.x,n[9]=u.y,n[10]=u.z,this},lookAt:function(t,e,i){var n=t.x,r=t.y,s=t.z,o=i.x,a=i.y,h=i.z,l=e.x,u=e.y,c=e.z;if(Math.abs(n-l)<1e-6&&Math.abs(r-u)<1e-6&&Math.abs(s-c)<1e-6)return this.identity();var d=n-l,p=r-u,f=s-c,m=1/Math.sqrt(d*d+p*p+f*f),g=a*(f*=m)-h*(p*=m),v=h*(d*=m)-o*f,y=o*p-a*d;(m=Math.sqrt(g*g+v*v+y*y))?(g*=m=1/m,v*=m,y*=m):(g=0,v=0,y=0);var x=p*y-f*v,w=f*g-d*y,b=d*v-p*g;return(m=Math.sqrt(x*x+w*w+b*b))?(x*=m=1/m,w*=m,b*=m):(x=0,w=0,b=0),this.setValues(g,x,d,0,v,w,p,0,y,b,f,0,-(g*n+v*r+y*s),-(x*n+w*r+b*s),-(d*n+p*r+f*s),1)},yawPitchRoll:function(t,e,i){this.zero(),o.zero(),a.zero();var n=this.val,r=o.val,s=a.val,h=Math.sin(i),l=Math.cos(i);return n[10]=1,n[15]=1,n[0]=l,n[1]=h,n[4]=-h,n[5]=l,h=Math.sin(e),l=Math.cos(e),r[0]=1,r[15]=1,r[5]=l,r[10]=l,r[9]=-h,r[6]=h,h=Math.sin(t),l=Math.cos(t),s[5]=1,s[15]=1,s[0]=l,s[2]=-h,s[8]=h,s[10]=l,this.multiplyLocal(o),this.multiplyLocal(a),this},setWorldMatrix:function(t,e,i,n,r){return this.yawPitchRoll(t.y,t.x,t.z),o.scaling(i.x,i.y,i.z),a.xyz(e.x,e.y,e.z),this.multiplyLocal(o),this.multiplyLocal(a),n&&this.multiplyLocal(n),r&&this.multiplyLocal(r),this},multiplyToMat4:function(t,e){var i=this.val,n=t.val,r=i[0],s=i[1],o=i[2],a=i[3],h=i[4],l=i[5],u=i[6],c=i[7],d=i[8],p=i[9],f=i[10],m=i[11],g=i[12],v=i[13],y=i[14],x=i[15],w=n[0],b=n[1],A=n[2],T=n[3],S=n[4],E=n[5],M=n[6],_=n[7],C=n[8],P=n[9],R=n[10],L=n[11],O=n[12],D=n[13],B=n[14],I=n[15];return e.setValues(w*r+b*h+A*d+T*g,b*s+b*l+A*p+T*v,A*o+b*u+A*f+T*y,T*a+b*c+A*m+T*x,S*r+E*h+M*d+_*g,S*s+E*l+M*p+_*v,S*o+E*u+M*f+_*y,S*a+E*c+M*m+_*x,C*r+P*h+R*d+L*g,C*s+P*l+R*p+L*v,C*o+P*u+R*f+L*y,C*a+P*c+R*m+L*x,O*r+D*h+B*d+I*g,O*s+D*l+B*p+I*v,O*o+D*u+B*f+I*y,O*a+D*c+B*m+I*x)},fromRotationXYTranslation:function(t,e,i){var n=e.x,r=e.y,s=e.z,o=Math.sin(t.x),a=Math.cos(t.x),h=Math.sin(t.y),l=Math.cos(t.y),u=n,c=r,d=s,p=-o,f=0-p*h,m=0-a*h,g=p*l,v=a*l;return i||(u=l*n+h*s,c=f*n+a*r+g*s,d=m*n+o*r+v*s),this.setValues(l,f,m,0,0,a,o,0,h,g,v,0,u,c,d,1)},getMaxScaleOnAxis:function(){var t=this.val,e=t[0]*t[0]+t[1]*t[1]+t[2]*t[2],i=t[4]*t[4]+t[5]*t[5]+t[6]*t[6],n=t[8]*t[8]+t[9]*t[9]+t[10]*t[10];return Math.sqrt(Math.max(e,i,n))}}),o=new s,a=new s,h=new r,l=new r,u=new r;t.exports=s},function(t,e,i){t.exports={COMPLETE:i(987),DECODED:i(988),DECODED_ALL:i(989),DESTROY:i(990),DETUNE:i(991),GLOBAL_DETUNE:i(992),GLOBAL_MUTE:i(993),GLOBAL_RATE:i(994),GLOBAL_VOLUME:i(995),LOOP:i(996),LOOPED:i(997),MUTE:i(998),PAN:i(999),PAUSE_ALL:i(1e3),PAUSE:i(1001),PLAY:i(1002),RATE:i(1003),RESUME_ALL:i(1004),RESUME:i(1005),SEEK:i(1006),STOP_ALL:i(1007),STOP:i(1008),UNLOCKED:i(1009),VOLUME:i(1010)}},function(t,e,i){var n=i(0),r=i(21),s=i(23),o=i(8),a=i(2),h=i(7),l=new n({Extends:s,initialize:function t(e,i,n,r,o){var l,u="png";if(h(i)){var c=i;i=a(c,"key"),n=a(c,"url"),l=a(c,"normalMap"),r=a(c,"xhrSettings"),u=a(c,"extension",u),o=a(c,"frameConfig")}Array.isArray(n)&&(l=n[1],n=n[0]);var d={type:"image",cache:e.textureManager,extension:u,responseType:"blob",key:i,url:n,xhrSettings:r,config:o};if(s.call(this,e,d),l){var p=new t(e,this.key,l,r,o);p.type="normalMap",this.setLink(p),e.addFile(p)}},onProcess:function(){this.state=r.FILE_PROCESSING,this.data=new Image,this.data.crossOrigin=this.crossOrigin;var t=this;this.data.onload=function(){s.revokeObjectURL(t.data),t.onProcessComplete()},this.data.onerror=function(){s.revokeObjectURL(t.data),t.onProcessError()},s.createObjectURL(this.data,this.xhrLoader.response,"image/png")},addToCache:function(){var t,e=this.linkFile;e&&e.state===r.FILE_COMPLETE?(t="image"===this.type?this.cache.addImage(this.key,this.data,e.data):this.cache.addImage(e.key,e.data,this.data),this.pendingDestroy(t),e.pendingDestroy(t)):e||(t=this.cache.addImage(this.key,this.data),this.pendingDestroy(t))}});o.register("image",(function(t,e,i){if(Array.isArray(t))for(var n=0;n=t.length)){for(var i=t.length-1,n=t[e],r=e;rr||e>=i||i>r||e+i>r){if(n)throw new Error("Range Error: Values outside acceptable range");return!1}return!0}},function(t,e){function i(t,e){return String(t).localeCompare(e)}function n(t,e,i,n){var r,s,o,a,h,l=t.length,u=0,c=2*i;for(r=0;rl&&(s=l),o>l&&(o=l),a=r,h=s;;)if(a=this.x2&&this.x1>=this.x3?this.x1-t:this.x2>=this.x1&&this.x2>=this.x3?this.x2-t:this.x3-t,this.x1-=e,this.x2-=e,this.x3-=e}},top:{get:function(){return Math.min(this.y1,this.y2,this.y3)},set:function(t){var e=0;e=this.y1<=this.y2&&this.y1<=this.y3?this.y1-t:this.y2<=this.y1&&this.y2<=this.y3?this.y2-t:this.y3-t,this.y1-=e,this.y2-=e,this.y3-=e}},bottom:{get:function(){return Math.max(this.y1,this.y2,this.y3)},set:function(t){var e=0;e=this.y1>=this.y2&&this.y1>=this.y3?this.y1-t:this.y2>=this.y1&&this.y2>=this.y3?this.y2-t:this.y3-t,this.y1-=e,this.y2-=e,this.y3-=e}}});t.exports=u},function(t,e){var i={};t.exports=i,i.create=function(t,e){return{x:t||0,y:e||0}},i.clone=function(t){return{x:t.x,y:t.y}},i.magnitude=function(t){return Math.sqrt(t.x*t.x+t.y*t.y)},i.magnitudeSquared=function(t){return t.x*t.x+t.y*t.y},i.rotate=function(t,e,i){var n=Math.cos(e),r=Math.sin(e);i||(i={});var s=t.x*n-t.y*r;return i.y=t.x*r+t.y*n,i.x=s,i},i.rotateAbout=function(t,e,i,n){var r=Math.cos(e),s=Math.sin(e);n||(n={});var o=i.x+((t.x-i.x)*r-(t.y-i.y)*s);return n.y=i.y+((t.x-i.x)*s+(t.y-i.y)*r),n.x=o,n},i.normalise=function(t){var e=i.magnitude(t);return 0===e?{x:0,y:0}:{x:t.x/e,y:t.y/e}},i.dot=function(t,e){return t.x*e.x+t.y*e.y},i.cross=function(t,e){return t.x*e.y-t.y*e.x},i.cross3=function(t,e,i){return(e.x-t.x)*(i.y-t.y)-(e.y-t.y)*(i.x-t.x)},i.add=function(t,e,i){return i||(i={}),i.x=t.x+e.x,i.y=t.y+e.y,i},i.sub=function(t,e,i){return i||(i={}),i.x=t.x-e.x,i.y=t.y-e.y,i},i.mult=function(t,e){return{x:t.x*e,y:t.y*e}},i.div=function(t,e){return{x:t.x/e,y:t.y/e}},i.perp=function(t,e){return{x:(e=!0===e?-1:1)*-t.y,y:e*t.x}},i.neg=function(t){return{x:-t.x,y:-t.y}},i.angle=function(t,e){return Math.atan2(e.y-t.y,e.x-t.x)},i._temp=[i.create(),i.create(),i.create(),i.create(),i.create(),i.create()]},function(t,e){var i={};t.exports=i,i.create=function(t){var e={min:{x:0,y:0},max:{x:0,y:0}};return t&&i.update(e,t),e},i.update=function(t,e,i){t.min.x=1/0,t.max.x=-1/0,t.min.y=1/0,t.max.y=-1/0;for(var n=0;nt.max.x&&(t.max.x=r.x),r.xt.max.y&&(t.max.y=r.y),r.y0?t.max.x+=i.x:t.min.x+=i.x,i.y>0?t.max.y+=i.y:t.min.y+=i.y)},i.contains=function(t,e){return e.x>=t.min.x&&e.x<=t.max.x&&e.y>=t.min.y&&e.y<=t.max.y},i.overlaps=function(t,e){return t.min.x<=e.max.x&&t.max.x>=e.min.x&&t.max.y>=e.min.y&&t.min.y<=e.max.y},i.translate=function(t,e){t.min.x+=e.x,t.max.x+=e.x,t.min.y+=e.y,t.max.y+=e.y},i.shift=function(t,e){var i=t.max.x-t.min.x,n=t.max.y-t.min.y;t.min.x=e.x,t.max.x=e.x+i,t.min.y=e.y,t.max.y=e.y+n}},function(t,e,i){var n=i(29),r=i(0),s=i(11),o=i(502),a=new r({Mixins:[s.Alpha,s.Flip,s.Visible],initialize:function(t,e,i,n,r,s,o,a){this.layer=t,this.index=e,this.x=i,this.y=n,this.width=r,this.height=s,this.right,this.bottom,this.baseWidth=void 0!==o?o:r,this.baseHeight=void 0!==a?a:s,this.pixelX=0,this.pixelY=0,this.updatePixelXY(),this.properties={},this.rotation=0,this.collideLeft=!1,this.collideRight=!1,this.collideUp=!1,this.collideDown=!1,this.faceLeft=!1,this.faceRight=!1,this.faceTop=!1,this.faceBottom=!1,this.collisionCallback=void 0,this.collisionCallbackContext=this,this.tint=16777215,this.physics={}},containsPoint:function(t,e){return!(tthis.right||e>this.bottom)},copy:function(t){return this.index=t.index,this.alpha=t.alpha,this.properties=t.properties,this.visible=t.visible,this.setFlip(t.flipX,t.flipY),this.tint=t.tint,this.rotation=t.rotation,this.collideUp=t.collideUp,this.collideDown=t.collideDown,this.collideLeft=t.collideLeft,this.collideRight=t.collideRight,this.collisionCallback=t.collisionCallback,this.collisionCallbackContext=t.collisionCallbackContext,this},getCollisionGroup:function(){return this.tileset?this.tileset.getTileCollisionGroup(this.index):null},getTileData:function(){return this.tileset?this.tileset.getTileData(this.index):null},getLeft:function(t){var e=this.tilemapLayer;return e?e.tileToWorldX(this.x,t):this.x*this.baseWidth},getRight:function(t){var e=this.tilemapLayer;return e?this.getLeft(t)+this.width*e.scaleX:this.getLeft(t)+this.width},getTop:function(t){var e=this.tilemapLayer;return e?e.tileToWorldY(this.y,t)-(this.height-this.baseHeight)*e.scaleY:this.y*this.baseHeight-(this.height-this.baseHeight)},getBottom:function(t){var e=this.tilemapLayer;return e?this.getTop(t)+this.height*e.scaleY:this.getTop(t)+this.height},getBounds:function(t,e){return void 0===e&&(e=new o),e.x=this.getLeft(),e.y=this.getTop(),e.width=this.getRight()-e.x,e.height=this.getBottom()-e.y,e},getCenterX:function(t){return(this.getLeft(t)+this.getRight(t))/2},getCenterY:function(t){return(this.getTop(t)+this.getBottom(t))/2},intersects:function(t,e,i,n){return!(i<=this.pixelX||n<=this.pixelY||t>=this.right||e>=this.bottom)},isInteresting:function(t,e){return t&&e?this.canCollide||this.hasInterestingFace:t?this.collides:!!e&&this.hasInterestingFace},resetCollision:function(t){return void 0===t&&(t=!0),this.collideLeft=!1,this.collideRight=!1,this.collideUp=!1,this.collideDown=!1,this.faceTop=!1,this.faceBottom=!1,this.faceLeft=!1,this.faceRight=!1,t&&this.tilemapLayer&&this.tilemapLayer.calculateFacesAt(this.x,this.y),this},resetFaces:function(){return this.faceTop=!1,this.faceBottom=!1,this.faceLeft=!1,this.faceRight=!1,this},setCollision:function(t,e,i,n,r){return void 0===e&&(e=t),void 0===i&&(i=t),void 0===n&&(n=t),void 0===r&&(r=!0),this.collideLeft=t,this.collideRight=e,this.collideUp=i,this.collideDown=n,this.faceLeft=t,this.faceRight=e,this.faceTop=i,this.faceBottom=n,r&&this.tilemapLayer&&this.tilemapLayer.calculateFacesAt(this.x,this.y),this},setCollisionCallback:function(t,e){return null===t?(this.collisionCallback=void 0,this.collisionCallbackContext=void 0):(this.collisionCallback=t,this.collisionCallbackContext=e),this},setSize:function(t,e,i,n){return void 0!==t&&(this.width=t),void 0!==e&&(this.height=e),void 0!==i&&(this.baseWidth=i),void 0!==n&&(this.baseHeight=n),this.updatePixelXY(),this},updatePixelXY:function(){var t=this.layer.orientation;if(t===n.ORTHOGONAL)this.pixelX=this.x*this.baseWidth,this.pixelY=this.y*this.baseHeight;else if(t===n.ISOMETRIC)this.pixelX=(this.x-this.y)*this.baseWidth*.5,this.pixelY=(this.x+this.y)*this.baseHeight*.5;else if(t===n.STAGGERED)this.pixelX=this.x*this.baseWidth+this.y%2*(this.baseWidth/2),this.pixelY=this.y*(this.baseHeight/2);else if(t===n.HEXAGONAL){var e=this.layer.hexSideLength,i=(this.baseHeight-e)/2+e;this.pixelX=this.x*this.baseWidth+this.y%2*(this.baseWidth/2),this.pixelY=this.y*i}return this.right=this.pixelX+this.baseWidth,this.bottom=this.pixelY+this.baseHeight,this},destroy:function(){this.collisionCallback=void 0,this.collisionCallbackContext=void 0,this.properties=void 0},canCollide:{get:function(){return this.collideLeft||this.collideRight||this.collideUp||this.collideDown||void 0!==this.collisionCallback}},collides:{get:function(){return this.collideLeft||this.collideRight||this.collideUp||this.collideDown}},hasInterestingFace:{get:function(){return this.faceTop||this.faceBottom||this.faceLeft||this.faceRight}},tileset:{get:function(){var t=this.layer.tilemapLayer;if(t){var e=t.gidMap[this.index];if(e)return e}return null}},tilemapLayer:{get:function(){return this.layer.tilemapLayer}},tilemap:{get:function(){var t=this.tilemapLayer;return t?t.tilemap:null}}});t.exports=a},function(t,e,i){var n={};t.exports=n;var r=i(64),s=i(32),o=i(41),a=i(84),h=i(83),l=i(1393);n.rectangle=function(t,e,i,n,a){a=a||{};var h={label:"Rectangle Body",position:{x:t,y:e},vertices:r.fromPath("L 0 0 L "+i+" 0 L "+i+" "+n+" L 0 "+n)};if(a.chamfer){var l=a.chamfer;h.vertices=r.chamfer(h.vertices,l.radius,l.quality,l.qualityMin,l.qualityMax),delete a.chamfer}return o.create(s.extend({},h,a))},n.trapezoid=function(t,e,i,n,a,h){h=h||{};var l,u=i*(a*=.5),c=u+(1-2*a)*i,d=c+u;l=a<.5?"L 0 0 L "+u+" "+-n+" L "+c+" "+-n+" L "+d+" 0":"L 0 0 L "+c+" "+-n+" L "+d+" 0";var p={label:"Trapezoid Body",position:{x:t,y:e},vertices:r.fromPath(l)};if(h.chamfer){var f=h.chamfer;p.vertices=r.chamfer(p.vertices,f.radius,f.quality,f.qualityMin,f.qualityMax),delete h.chamfer}return o.create(s.extend({},p,h))},n.circle=function(t,e,i,r,o){r=r||{};var a={label:"Circle Body",circleRadius:i};o=o||25;var h=Math.ceil(Math.max(10,Math.min(o,i)));return h%2==1&&(h+=1),n.polygon(t,e,h,i,s.extend({},a,r))},n.polygon=function(t,e,i,a,h){if(h=h||{},i<3)return n.circle(t,e,a,h);for(var l=2*Math.PI/i,u="",c=.5*l,d=0;d0&&r.area(w)1?(d=o.create(s.extend({parts:p.slice(0)},a)),o.setPosition(d,{x:t,y:e}),d):p[0]},n.flagCoincidentParts=function(t,e){void 0===e&&(e=5);for(var i=0;i=0;){var h=e[o];-1!==(s=t.indexOf(h))&&(n(t,s),a.push(h),i&&i.call(r,h)),o--}return a}},function(t,e,i){var n=i(0),r=i(199),s=i(10),o=i(3),a=new n({initialize:function(t){this.type=t,this.defaultDivisions=5,this.arcLengthDivisions=100,this.cacheArcLengths=[],this.needsUpdate=!0,this.active=!0,this._tmpVec2A=new o,this._tmpVec2B=new o},draw:function(t,e){return void 0===e&&(e=32),t.strokePoints(this.getPoints(e))},getBounds:function(t,e){t||(t=new s),void 0===e&&(e=16);var i=this.getLength();e>i&&(e=i/2);var n=Math.max(1,Math.round(i/e));return r(this.getSpacedPoints(n),t)},getDistancePoints:function(t){var e=this.getLength(),i=Math.max(1,e/t);return this.getSpacedPoints(i)},getEndPoint:function(t){return void 0===t&&(t=new o),this.getPointAt(1,t)},getLength:function(){var t=this.getLengths();return t[t.length-1]},getLengths:function(t){if(void 0===t&&(t=this.arcLengthDivisions),this.cacheArcLengths.length===t+1&&!this.needsUpdate)return this.cacheArcLengths;this.needsUpdate=!1;var e,i=[],n=this.getPoint(0,this._tmpVec2A),r=0;i.push(0);for(var s=1;s<=t;s++)r+=(e=this.getPoint(s/t,this._tmpVec2B)).distance(n),i.push(r),n.copy(e);return this.cacheArcLengths=i,i},getPointAt:function(t,e){var i=this.getUtoTmapping(t);return this.getPoint(i,e)},getPoints:function(t,e,i){void 0===i&&(i=[]),t||(t=e?this.getLength()/e:this.defaultDivisions);for(var n=0;n<=t;n++)i.push(this.getPoint(n/t));return i},getRandomPoint:function(t){return void 0===t&&(t=new o),this.getPoint(Math.random(),t)},getSpacedPoints:function(t,e,i){void 0===i&&(i=[]),t||(t=e?this.getLength()/e:this.defaultDivisions);for(var n=0;n<=t;n++){var r=this.getUtoTmapping(n/t,null,t);i.push(this.getPoint(r))}return i},getStartPoint:function(t){return void 0===t&&(t=new o),this.getPointAt(0,t)},getTangent:function(t,e){void 0===e&&(e=new o);var i=t-1e-4,n=t+1e-4;return i<0&&(i=0),n>1&&(n=1),this.getPoint(i,this._tmpVec2A),this.getPoint(n,e),e.subtract(this._tmpVec2A).normalize()},getTangentAt:function(t,e){var i=this.getUtoTmapping(t);return this.getTangent(i,e)},getTFromDistance:function(t,e){return t<=0?0:this.getUtoTmapping(0,t,e)},getUtoTmapping:function(t,e,i){var n,r=this.getLengths(i),s=0,o=r.length;n=e?Math.min(e,r[o-1]):t*r[o-1];for(var a,h=0,l=o-1;h<=l;)if((a=r[s=Math.floor(h+(l-h)/2)]-n)<0)h=s+1;else{if(!(a>0)){l=s;break}l=s-1}if(r[s=l]===n)return s/(o-1);var u=r[s];return(s+(n-u)/(r[s+1]-u))/(o-1)},updateArcLengths:function(){this.needsUpdate=!0,this.getLengths()}});t.exports=a},function(t,e,i){t.exports={ADD:i(968),COMPLETE:i(969),FILE_COMPLETE:i(970),FILE_KEY_COMPLETE:i(971),FILE_LOAD_ERROR:i(972),FILE_LOAD:i(973),FILE_PROGRESS:i(974),POST_PROCESS:i(975),PROGRESS:i(976),START:i(977)}},function(t,e,i){var n=i(4);t.exports=function(t,e,i){void 0===i&&(i=new n);var r=t.x1,s=t.y1,o=t.x2,a=t.y2,h=e.x1,l=e.y1,u=e.x2,c=e.y2,d=(c-l)*(o-r)-(u-h)*(a-s);if(0===d)return!1;var p=((u-h)*(s-l)-(c-l)*(r-h))/d,f=((o-r)*(s-l)-(a-s)*(r-h))/d;return p>=0&&p<=1&&f>=0&&f<=1&&(i.x=r+p*(o-r),i.y=s+p*(a-s),!0)}},function(t,e){t.exports=function(t){return Math.atan2(t.y2-t.y1,t.x2-t.x1)}},function(t,e,i){var n=i(18);t.exports=function(t,e,i){return(i-e)*(t=n(t,0,1))+e}},function(t,e){t.exports=function(t,e,i){return t&&t.hasOwnProperty(e)?t[e]:i}},function(t,e){t.exports={CREATED:0,INIT:1,DELAY:2,OFFSET_DELAY:3,PENDING_RENDER:4,PLAYING_FORWARD:5,PLAYING_BACKWARD:6,HOLD_DELAY:7,REPEAT_DELAY:8,COMPLETE:9,PENDING_ADD:20,PAUSED:21,LOOP_DELAY:22,ACTIVE:23,COMPLETE_DELAY:24,PENDING_REMOVE:25,REMOVED:26}},function(t,e,i){var n=i(0),r=i(315),s=new n({initialize:function(t,e){this.parent=t,this.events=e,e||(this.events=t.events?t.events:t),this.list={},this.values={},this._frozen=!1,!t.hasOwnProperty("sys")&&this.events&&this.events.once(r.DESTROY,this.destroy,this)},get:function(t){var e=this.list;if(Array.isArray(t)){for(var i=[],n=0;n2?(i.iOS=!0,i.iPad=!0,navigator.appVersion.match(/Version\/(\d+)/),i.iOSVersion=parseInt(RegExp.$1,10)):i.macOS=!0:/Android/.test(t)?i.android=!0:/Linux/.test(t)?i.linux=!0:/iP[ao]d|iPhone/i.test(t)?(i.iOS=!0,navigator.appVersion.match(/OS (\d+)/),i.iOSVersion=parseInt(RegExp.$1,10),i.iPhone=-1!==t.toLowerCase().indexOf("iphone"),i.iPad=-1!==t.toLowerCase().indexOf("ipad")):/Kindle/.test(t)||/\bKF[A-Z][A-Z]+/.test(t)||/Silk.*Mobile Safari/.test(t)?i.kindle=!0:/CrOS/.test(t)&&(i.chromeOS=!0),(/Windows Phone/i.test(t)||/IEMobile/i.test(t))&&(i.android=!1,i.iOS=!1,i.macOS=!1,i.windows=!0,i.windowsPhone=!0);var n=/Silk/.test(t);return(i.windows||i.macOS||i.linux&&!n||i.chromeOS)&&(i.desktop=!0),(i.windowsPhone||/Windows NT/i.test(t)&&/Touch/i.test(t))&&(i.desktop=!1),navigator.standalone&&(i.webApp=!0),"function"!=typeof importScripts&&(void 0!==window.cordova&&(i.cordova=!0),void 0!==window.ejecta&&(i.ejecta=!0)),void 0!==e&&e.versions&&e.versions.node&&(i.node=!0),i.node&&"object"==typeof e.versions&&(i.nodeWebkit=!!e.versions["node-webkit"],i.electron=!!e.versions.electron),/Crosswalk/.test(t)&&(i.crosswalk=!0),i.pixelRatio=window.devicePixelRatio||1,i}()}).call(this,i(807))},function(t,e,i){t.exports={ADD:i(861),ERROR:i(862),LOAD:i(863),READY:i(864),REMOVE:i(865)}},function(t,e){t.exports={BYTE:{enum:5120,size:1},UNSIGNED_BYTE:{enum:5121,size:1},SHORT:{enum:5122,size:2},UNSIGNED_SHORT:{enum:5123,size:2},INT:{enum:5124,size:4},UNSIGNED_INT:{enum:5125,size:4},FLOAT:{enum:5126,size:4}}},function(t,e,i){var n=i(0),r=i(59),s=i(2),o=i(878),a=i(879),h=i(25),l=i(12),u=i(107),c=i(58),d=new n({Extends:c,initialize:function(t){var e=t.game.renderer,i=s(t,"fragShader",o);t.fragShader=l.parseFragmentShaderMaxTextures(i,e.maxTextures),t.vertShader=s(t,"vertShader",a),t.attributes=s(t,"attributes",[{name:"inPosition",size:2},{name:"inTexCoord",size:2},{name:"inTexId"},{name:"inTintEffect"},{name:"inTint",size:4,type:u.UNSIGNED_BYTE,normalized:!0}]),c.call(this,t),this._tempMatrix1=new h,this._tempMatrix2=new h,this._tempMatrix3=new h,this.calcMatrix=new h,this.tempTriangle=[{x:0,y:0,width:0},{x:0,y:0,width:0},{x:0,y:0,width:0},{x:0,y:0,width:0}],this.strokeTint={TL:0,TR:0,BL:0,BR:0},this.fillTint={TL:0,TR:0,BL:0,BR:0},this.currentFrame={u0:0,v0:0,u1:1,v1:1},this.firstQuad=[0,0,0,0,0],this.prevQuad=[0,0,0,0,0],this.polygonCache=[]},boot:function(){c.prototype.boot.call(this),this.currentShader.set1iv("uMainSampler",this.renderer.textureIndexes)},batchSprite:function(t,e,i){this.manager.set(this,t);var n=this._tempMatrix1,r=this._tempMatrix2,s=this._tempMatrix3,o=t.frame,a=o.glTexture,h=o.u0,u=o.v0,c=o.u1,d=o.v1,p=o.x,f=o.y,m=o.cutWidth,g=o.cutHeight,v=o.customPivot,y=t.displayOriginX,x=t.displayOriginY,w=-y+p,b=-x+f;if(t.isCropped){var A=t._crop;A.flipX===t.flipX&&A.flipY===t.flipY||o.updateCropUVs(A,t.flipX,t.flipY),h=A.u0,u=A.v0,c=A.u1,d=A.v1,m=A.width,g=A.height,w=-y+(p=A.x),b=-x+(f=A.y)}var T=1,S=1;t.flipX&&(v||(w+=-o.realWidth+2*y),T=-1),(t.flipY||o.source.isGLTexture&&!a.flipY)&&(v||(b+=-o.realHeight+2*x),S=-1),r.applyITRS(t.x,t.y,t.rotation,t.scaleX*T,t.scaleY*S),n.copyFrom(e.matrix),i?(n.multiplyWithOffset(i,-e.scrollX*t.scrollFactorX,-e.scrollY*t.scrollFactorY),r.e=t.x,r.f=t.y):(r.e-=e.scrollX*t.scrollFactorX,r.f-=e.scrollY*t.scrollFactorY),n.multiply(r,s);var E=w+m,M=b+g,_=e.roundPixels,C=s.getXRound(w,b,_),P=s.getYRound(w,b,_),R=s.getXRound(w,M,_),L=s.getYRound(w,M,_),O=s.getXRound(E,M,_),D=s.getYRound(E,M,_),B=s.getXRound(E,b,_),I=s.getYRound(E,b,_),F=l.getTintAppendFloatAlpha,k=e.alpha,N=F(t.tintTopLeft,k*t._alphaTL),z=F(t.tintTopRight,k*t._alphaTR),U=F(t.tintBottomLeft,k*t._alphaBL),V=F(t.tintBottomRight,k*t._alphaBR);this.shouldFlush(6)&&this.flush();var H=this.setGameObject(t,o);this.manager.preBatch(t),this.batchQuad(t,C,P,R,L,O,D,B,I,h,u,c,d,N,z,U,V,t.tintFill,a,H),this.manager.postBatch(t)},batchTexture:function(t,e,i,n,r,s,o,a,h,l,u,c,d,p,f,m,g,v,y,x,w,b,A,T,S,E,M,_,C,P,R,L){this.manager.set(this,t);var O=this._tempMatrix1,D=this._tempMatrix2,B=this._tempMatrix3,I=v/i+M,F=y/n+_,k=(v+x)/i+M,N=(y+w)/n+_,z=o,U=a,V=-m,H=-g;if(t.isCropped){var G=t._crop,W=G.width,Y=G.height;z=W,U=Y,o=W,a=Y;var X=v=G.x,j=y=G.y;c&&(X=x-G.x-W),d&&(j=w-G.y-Y),I=X/i+M,F=j/n+_,k=(X+W)/i+M,N=(j+Y)/n+_,V=-m+v,H=-g+y}c&&(z*=-1,V+=o),(d^=!R&&e.isRenderTexture?1:0)&&(U*=-1,H+=a);var q=V+z,Q=H+U;D.applyITRS(r,s,u,h,l),O.copyFrom(C.matrix),P?(O.multiplyWithOffset(P,-C.scrollX*p,-C.scrollY*f),D.e=r,D.f=s):(D.e-=C.scrollX*p,D.f-=C.scrollY*f),O.multiply(D,B);var K=C.roundPixels,J=B.getXRound(V,H,K),Z=B.getYRound(V,H,K),$=B.getXRound(V,Q,K),tt=B.getYRound(V,Q,K),et=B.getXRound(q,Q,K),it=B.getYRound(q,Q,K),nt=B.getXRound(q,H,K),rt=B.getYRound(q,H,K);void 0===L&&(L=this.renderer.setTexture2D(e)),t&&this.manager.preBatch(t),this.batchQuad(t,J,Z,$,tt,et,it,nt,rt,I,F,k,N,b,A,T,S,E,e,L),t&&this.manager.postBatch(t)},batchTextureFrame:function(t,e,i,n,r,s,o){this.manager.set(this);var a=this._tempMatrix1.copyFrom(s),h=this._tempMatrix2,u=e+t.width,c=i+t.height;o?a.multiply(o,h):h=a;var d=h.getX(e,i),p=h.getY(e,i),f=h.getX(e,c),m=h.getY(e,c),g=h.getX(u,c),v=h.getY(u,c),y=h.getX(u,i),x=h.getY(u,i),w=this.renderer.setTextureSource(t.source);n=l.getTintAppendFloatAlpha(n,r),this.batchQuad(null,d,p,f,m,g,v,y,x,t.u0,t.v0,t.u1,t.v1,n,n,n,n,0,t.glTexture,w)},batchFillRect:function(t,e,i,n,r,s){this.renderer.pipelines.set(this);var o=this.calcMatrix;s&&s.multiply(r,o);var a=t+i,h=e+n,l=o.getX(t,e),u=o.getY(t,e),c=o.getX(t,h),d=o.getY(t,h),p=o.getX(a,h),f=o.getY(a,h),m=o.getX(a,e),g=o.getY(a,e),v=this.fillTint;this.batchQuad(null,l,u,c,d,p,f,m,g,0,0,1,1,v.TL,v.TR,v.BL,v.BR,2)},batchFillTriangle:function(t,e,i,n,r,s,o,a){this.renderer.pipelines.set(this);var h=this.calcMatrix;a&&a.multiply(o,h);var l=h.getX(t,e),u=h.getY(t,e),c=h.getX(i,n),d=h.getY(i,n),p=h.getX(r,s),f=h.getY(r,s),m=this.fillTint;this.batchTri(null,l,u,c,d,p,f,0,0,1,1,m.TL,m.TR,m.BL,2)},batchStrokeTriangle:function(t,e,i,n,r,s,o,a,h){var l=this.tempTriangle;l[0].x=t,l[0].y=e,l[0].width=o,l[1].x=i,l[1].y=n,l[1].width=o,l[2].x=r,l[2].y=s,l[2].width=o,l[3].x=t,l[3].y=e,l[3].width=o,this.batchStrokePath(l,o,!1,a,h)},batchFillPath:function(t,e,i){this.renderer.pipelines.set(this);var n=this.calcMatrix;i&&i.multiply(e,n);for(var s,o,a=t.length,h=this.polygonCache,l=this.fillTint.TL,u=this.fillTint.TR,c=this.fillTint.BL,d=0;d0&&U[4]?this.batchQuad(null,D,B,P,R,U[0],U[1],U[2],U[3],0,0,1,1,F,k,N,z,2):(V[0]=D,V[1]=B,V[2]=P,V[3]=R,V[4]=1),h&&V[4]?this.batchQuad(null,_,C,L,O,V[0],V[1],V[2],V[3],0,0,1,1,F,k,N,z,2):(U[0]=_,U[1]=C,U[2]=L,U[3]=O,U[4]=1)}}});t.exports=d},function(t,e,i){var n=i(0),r=i(18),s=i(17),o=new n({initialize:function(t,e,i,n,r,s,o){this.texture=t,this.name=e,this.source=t.source[i],this.sourceIndex=i,this.glTexture=this.source.glTexture,this.cutX,this.cutY,this.cutWidth,this.cutHeight,this.x=0,this.y=0,this.width,this.height,this.halfWidth,this.halfHeight,this.centerX,this.centerY,this.pivotX=0,this.pivotY=0,this.customPivot=!1,this.rotated=!1,this.autoRound=-1,this.customData={},this.u0=0,this.v0=0,this.u1=0,this.v1=0,this.data={cut:{x:0,y:0,w:0,h:0,r:0,b:0},trim:!1,sourceSize:{w:0,h:0},spriteSourceSize:{x:0,y:0,w:0,h:0,r:0,b:0},radius:0,drawImage:{x:0,y:0,width:0,height:0}},this.setSize(s,o,n,r)},setSize:function(t,e,i,n){void 0===i&&(i=0),void 0===n&&(n=0),this.cutX=i,this.cutY=n,this.cutWidth=t,this.cutHeight=e,this.width=t,this.height=e,this.halfWidth=Math.floor(.5*t),this.halfHeight=Math.floor(.5*e),this.centerX=Math.floor(t/2),this.centerY=Math.floor(e/2);var r=this.data,s=r.cut;s.x=i,s.y=n,s.w=t,s.h=e,s.r=i+t,s.b=n+e,r.sourceSize.w=t,r.sourceSize.h=e,r.spriteSourceSize.w=t,r.spriteSourceSize.h=e,r.radius=.5*Math.sqrt(t*t+e*e);var o=r.drawImage;return o.x=i,o.y=n,o.width=t,o.height=e,this.updateUVs()},setTrim:function(t,e,i,n,r,s){var o=this.data,a=o.spriteSourceSize;return o.trim=!0,o.sourceSize.w=t,o.sourceSize.h=e,a.x=i,a.y=n,a.w=r,a.h=s,a.r=i+r,a.b=n+s,this.x=i,this.y=n,this.width=r,this.height=s,this.halfWidth=.5*r,this.halfHeight=.5*s,this.centerX=Math.floor(r/2),this.centerY=Math.floor(s/2),this.updateUVs()},setCropUVs:function(t,e,i,n,s,o,a){var h=this.cutX,l=this.cutY,u=this.cutWidth,c=this.cutHeight,d=this.realWidth,p=this.realHeight,f=h+(e=r(e,0,d)),m=l+(i=r(i,0,p)),g=n=r(n,0,d-e),v=s=r(s,0,p-i),y=this.data;if(y.trim){var x=y.spriteSourceSize,w=e+(n=r(n,0,u-e)),b=i+(s=r(s,0,c-i));if(x.rw||x.y>b)f=0,m=0,g=0,v=0;else{var A=Math.max(x.x,e),T=Math.max(x.y,i),S=Math.min(x.r,w)-A,E=Math.min(x.b,b)-T;g=S,v=E,f=o?h+(u-(A-x.x)-S):h+(A-x.x),m=a?l+(c-(T-x.y)-E):l+(T-x.y),e=A,i=T,n=S,s=E}}else o&&(f=h+(u-e-n)),a&&(m=l+(c-i-s));var M=this.source.width,_=this.source.height;return t.u0=Math.max(0,f/M),t.v0=Math.max(0,m/_),t.u1=Math.min(1,(f+g)/M),t.v1=Math.min(1,(m+v)/_),t.x=e,t.y=i,t.cx=f,t.cy=m,t.cw=g,t.ch=v,t.width=n,t.height=s,t.flipX=o,t.flipY=a,t},updateCropUVs:function(t,e,i){return this.setCropUVs(t,t.x,t.y,t.width,t.height,e,i)},setUVs:function(t,e,i,n,r,s){var o=this.data.drawImage;return o.width=t,o.height=e,this.u0=i,this.v0=n,this.u1=r,this.v1=s,this},updateUVs:function(){var t=this.cutX,e=this.cutY,i=this.cutWidth,n=this.cutHeight,r=this.data.drawImage;r.width=i,r.height=n;var s=this.source.width,o=this.source.height;return this.u0=t/s,this.v0=e/o,this.u1=(t+i)/s,this.v1=(e+n)/o,this},updateUVsInverted:function(){var t=this.source.width,e=this.source.height;return this.u0=(this.cutX+this.cutHeight)/t,this.v0=this.cutY/e,this.u1=this.cutX/t,this.v1=(this.cutY+this.cutWidth)/e,this},clone:function(){var t=new o(this.texture,this.name,this.sourceIndex);return t.cutX=this.cutX,t.cutY=this.cutY,t.cutWidth=this.cutWidth,t.cutHeight=this.cutHeight,t.x=this.x,t.y=this.y,t.width=this.width,t.height=this.height,t.halfWidth=this.halfWidth,t.halfHeight=this.halfHeight,t.centerX=this.centerX,t.centerY=this.centerY,t.rotated=this.rotated,t.data=s(!0,t.data,this.data),t.updateUVs(),t},destroy:function(){this.source=null,this.texture=null,this.glTexture=null,this.customData=null,this.data=null},realWidth:{get:function(){return this.data.sourceSize.w}},realHeight:{get:function(){return this.data.sourceSize.h}},radius:{get:function(){return this.data.radius}},trimmed:{get:function(){return this.data.trim}},canvasData:{get:function(){return this.data.drawImage}}});t.exports=o},function(t,e,i){var n=i(208),r=i(0),s=i(1),o=i(79),a=new r({initialize:function(t){this.parent=t,this.list=[],this.position=0,this.addCallback=s,this.removeCallback=s,this._sortKey=""},add:function(t,e){return e?n.Add(this.list,t):n.Add(this.list,t,0,this.addCallback,this)},addAt:function(t,e,i){return i?n.AddAt(this.list,t,e):n.AddAt(this.list,t,e,0,this.addCallback,this)},getAt:function(t){return this.list[t]},getIndex:function(t){return this.list.indexOf(t)},sort:function(t,e){return t?(void 0===e&&(e=function(e,i){return e[t]-i[t]}),o(this.list,e),this):this},getByName:function(t){return n.GetFirst(this.list,"name",t)},getRandom:function(t,e){return n.GetRandom(this.list,t,e)},getFirst:function(t,e,i,r){return n.GetFirst(this.list,t,e,i,r)},getAll:function(t,e,i,r){return n.GetAll(this.list,t,e,i,r)},count:function(t,e){return n.CountAllMatching(this.list,t,e)},swap:function(t,e){n.Swap(this.list,t,e)},moveTo:function(t,e){return n.MoveTo(this.list,t,e)},moveAbove:function(t,e){return n.MoveAbove(this.list,t,e)},moveBelow:function(t,e){return n.MoveBelow(this.list,t,e)},remove:function(t,e){return e?n.Remove(this.list,t):n.Remove(this.list,t,this.removeCallback,this)},removeAt:function(t,e){return e?n.RemoveAt(this.list,t):n.RemoveAt(this.list,t,this.removeCallback,this)},removeBetween:function(t,e,i){return i?n.RemoveBetween(this.list,t,e):n.RemoveBetween(this.list,t,e,this.removeCallback,this)},removeAll:function(t){for(var e=this.list.length;e--;)this.remove(this.list[e],t);return this},bringToTop:function(t){return n.BringToTop(this.list,t)},sendToBack:function(t){return n.SendToBack(this.list,t)},moveUp:function(t){return n.MoveUp(this.list,t),t},moveDown:function(t){return n.MoveDown(this.list,t),t},reverse:function(){return this.list.reverse(),this},shuffle:function(){return n.Shuffle(this.list),this},replace:function(t,e){return n.Replace(this.list,t,e)},exists:function(t){return this.list.indexOf(t)>-1},setAll:function(t,e,i,r){return n.SetAll(this.list,t,e,i,r),this},each:function(t,e){for(var i=[null],n=2;n0?this.list[0]:null}},last:{get:function(){return this.list.length>0?(this.position=this.list.length-1,this.list[this.position]):null}},next:{get:function(){return this.position0?(this.position--,this.list[this.position]):null}}});t.exports=a},function(t,e,i){var n=i(0),r=i(112),s=i(445),o=i(446),a=i(56),h=i(180),l=new n({initialize:function(t,e,i,n){void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i=0),void 0===n&&(n=0),this.type=a.ELLIPSE,this.x=t,this.y=e,this.width=i,this.height=n},contains:function(t,e){return r(this,t,e)},getPoint:function(t,e){return s(this,t,e)},getPoints:function(t,e,i){return o(this,t,e,i)},getRandomPoint:function(t){return h(this,t)},setTo:function(t,e,i,n){return this.x=t,this.y=e,this.width=i,this.height=n,this},setEmpty:function(){return this.width=0,this.height=0,this},setPosition:function(t,e){return void 0===e&&(e=t),this.x=t,this.y=e,this},setSize:function(t,e){return void 0===e&&(e=t),this.width=t,this.height=e,this},isEmpty:function(){return this.width<=0||this.height<=0},getMinorRadius:function(){return Math.min(this.width,this.height)/2},getMajorRadius:function(){return Math.max(this.width,this.height)/2},left:{get:function(){return this.x-this.width/2},set:function(t){this.x=t+this.width/2}},right:{get:function(){return this.x+this.width/2},set:function(t){this.x=t-this.width/2}},top:{get:function(){return this.y-this.height/2},set:function(t){this.y=t+this.height/2}},bottom:{get:function(){return this.y+this.height/2},set:function(t){this.y=t-this.height/2}}});t.exports=l},function(t,e){t.exports=function(t,e,i){if(t.width<=0||t.height<=0)return!1;var n=(e-t.x)/t.width,r=(i-t.y)/t.height;return(n*=n)+(r*=r)<.25}},function(t,e,i){var n=i(275),r=i(0),s=i(75),o=i(9),a=i(207),h=i(2),l=i(6),u=i(7),c=i(437),d=i(149),p=i(73),f=new r({Extends:o,initialize:function(t,e,i){o.call(this),i?e&&!Array.isArray(e)&&(e=[e]):Array.isArray(e)?u(e[0])&&(i=e,e=null):u(e)&&(i=e,e=null),this.scene=t,this.children=new d,this.isParent=!0,this.type="Group",this.classType=h(i,"classType",p),this.name=h(i,"name",""),this.active=h(i,"active",!0),this.maxSize=h(i,"maxSize",-1),this.defaultKey=h(i,"defaultKey",null),this.defaultFrame=h(i,"defaultFrame",null),this.runChildUpdate=h(i,"runChildUpdate",!1),this.createCallback=h(i,"createCallback",null),this.removeCallback=h(i,"removeCallback",null),this.createMultipleCallback=h(i,"createMultipleCallback",null),this.internalCreateCallback=h(i,"internalCreateCallback",null),this.internalRemoveCallback=h(i,"internalRemoveCallback",null),e&&this.addMultiple(e),i&&this.createMultiple(i),this.on(s.ADDED_TO_SCENE,this.addedToScene,this),this.on(s.REMOVED_FROM_SCENE,this.removedFromScene,this)},addedToScene:function(){this.scene.sys.updateList.add(this)},removedFromScene:function(){this.scene.sys.updateList.remove(this)},create:function(t,e,i,n,r,s){if(void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i=this.defaultKey),void 0===n&&(n=this.defaultFrame),void 0===r&&(r=!0),void 0===s&&(s=!0),this.isFull())return null;var o=new this.classType(this.scene,t,e,i,n);return o.addToDisplayList(this.scene.sys.displayList),o.addToUpdateList(),o.visible=r,o.setActive(s),this.add(o),o},createMultiple:function(t){if(this.isFull())return[];Array.isArray(t)||(t=[t]);var e=[];if(t[0].key)for(var i=0;i=0;u--)if((l=d[u]).active===i){if(++c===e)break}else l=null;return l?("number"==typeof r&&(l.x=r),"number"==typeof s&&(l.y=s),l):n?this.create(r,s,o,a,h):null},get:function(t,e,i,n,r){return this.getFirst(!1,!0,t,e,i,n,r)},getFirstAlive:function(t,e,i,n,r,s){return this.getFirst(!0,t,e,i,n,r,s)},getFirstDead:function(t,e,i,n,r,s){return this.getFirst(!1,t,e,i,n,r,s)},playAnimation:function(t,e){return n.PlayAnimation(this.children.entries,t,e),this},isFull:function(){return-1!==this.maxSize&&this.children.size>=this.maxSize},countActive:function(t){void 0===t&&(t=!0);for(var e=0,i=0;i=0&&v>=0&&g+v<1}},function(t,e,i){var n=i(0),r=i(10),s=i(3);function o(t,e,i,n){var r=t-i,s=e-n,o=r*r+s*s;return Math.sqrt(o)}var a=new n({initialize:function(t,e,i){this.vertex1=t,this.vertex2=e,this.vertex3=i,this.bounds=new r,this._inCenter=new s},getInCenter:function(t){void 0===t&&(t=!0);var e,i,n,r,s,a,h=this.vertex1,l=this.vertex2,u=this.vertex3;t?(e=h.x,i=h.y,n=l.x,r=l.y,s=u.x,a=u.y):(e=h.vx,i=h.vy,n=l.vx,r=l.vy,s=u.vx,a=u.vy);var c=o(s,a,n,r),d=o(e,i,s,a),p=o(n,r,e,i),f=c+d+p;return this._inCenter.set((e*c+n*d+s*p)/f,(i*c+r*d+a*p)/f)},contains:function(t,e,i){var n=this.vertex1,r=this.vertex2,s=this.vertex3,o=n.vx,a=n.vy,h=r.vx,l=r.vy,u=s.vx,c=s.vy;if(i){var d=i.a,p=i.b,f=i.c,m=i.d,g=i.e,v=i.f;o=n.vx*d+n.vy*f+g,a=n.vx*p+n.vy*m+v,h=r.vx*d+r.vy*f+g,l=r.vx*p+r.vy*m+v,u=s.vx*d+s.vy*f+g,c=s.vx*p+s.vy*m+v}var y=u-o,x=c-a,w=h-o,b=l-a,A=t-o,T=e-a,S=y*y+x*x,E=y*w+x*b,M=y*A+x*T,_=w*w+b*b,C=w*A+b*T,P=S*_-E*E,R=0===P?0:1/P,L=(_*M-E*C)*R,O=(S*C-E*M)*R;return L>=0&&O>=0&&L+O<1},isCounterClockwise:function(t){var e=this.vertex1,i=this.vertex2,n=this.vertex3,r=(i.vx-e.vx)*(n.vy-e.vy)-(i.vy-e.vy)*(n.vx-e.vx);return t<=0?r>=0:r<0},load:function(t,e,i,n,r){return i=this.vertex1.load(t,e,i,n,r),i=this.vertex2.load(t,e,i,n,r),i=this.vertex3.load(t,e,i,n,r)},transformCoordinatesLocal:function(t,e,i,n){return this.vertex1.transformCoordinatesLocal(t,e,i,n),this.vertex2.transformCoordinatesLocal(t,e,i,n),this.vertex3.transformCoordinatesLocal(t,e,i,n),this},updateBounds:function(){var t=this.vertex1,e=this.vertex2,i=this.vertex3,n=this.bounds;return n.x=Math.min(t.vx,e.vx,i.vx),n.y=Math.min(t.vy,e.vy,i.vy),n.width=Math.max(t.vx,e.vx,i.vx)-n.x,n.height=Math.max(t.vy,e.vy,i.vy)-n.y,this},isInView:function(t,e,i,n,r,s,o,a,h,l,u){var c=this.vertex1.update(r,s,o,a,h,l,u,n),d=this.vertex2.update(r,s,o,a,h,l,u,n),p=this.vertex3.update(r,s,o,a,h,l,u,n);if(c.ta<=0&&d.ta<=0&&p.ta<=0)return!1;if(e&&!this.isCounterClockwise(i))return!1;var f=this.bounds;f.x=Math.min(c.tx,d.tx,p.tx),f.y=Math.min(c.ty,d.ty,p.ty),f.width=Math.max(c.tx,d.tx,p.tx)-f.x,f.height=Math.max(c.ty,d.ty,p.ty)-f.y;var m=t.x+t.width,g=t.y+t.height;return!(f.width<=0||f.height<=0||t.width<=0||t.height<=0||f.rightm||f.y>g)},translate:function(t,e){void 0===e&&(e=0);var i=this.vertex1,n=this.vertex2,r=this.vertex3;return i.x+=t,i.y+=e,n.x+=t,n.y+=e,r.x+=t,r.y+=e,this},x:{get:function(){return this.getInCenter().x},set:function(t){var e=this.getInCenter();this.translate(t-e.x,0)}},y:{get:function(){return this.getInCenter().y},set:function(t){var e=this.getInCenter();this.translate(0,t-e.y)}},alpha:{get:function(){var t=this.vertex1,e=this.vertex2,i=this.vertex3;return(t.alpha+e.alpha+i.alpha)/3},set:function(t){this.vertex1.alpha=t,this.vertex2.alpha=t,this.vertex3.alpha=t}},depth:{get:function(){var t=this.vertex1,e=this.vertex2,i=this.vertex3;return(t.vz+e.vz+i.vz)/3}},destroy:function(){this.vertex1=null,this.vertex2=null,this.vertex3=null}});t.exports=a},function(t,e,i){var n=i(0),r=i(12),s=i(39),o=new n({Extends:s,initialize:function(t,e,i,n,r,o,a,h,l,u){void 0===o&&(o=16777215),void 0===a&&(a=1),void 0===h&&(h=0),void 0===l&&(l=0),void 0===u&&(u=0),s.call(this,t,e,i),this.vx=0,this.vy=0,this.vz=0,this.nx=h,this.ny=l,this.nz=u,this.u=n,this.v=r,this.color=o,this.alpha=a,this.tx=0,this.ty=0,this.ta=0},setUVs:function(t,e){return this.u=t,this.v=e,this},transformCoordinatesLocal:function(t,e,i,n){var r=this.x,s=this.y,o=this.z,a=t.val,h=r*a[0]+s*a[4]+o*a[8]+a[12],l=r*a[1]+s*a[5]+o*a[9]+a[13],u=r*a[2]+s*a[6]+o*a[10]+a[14],c=r*a[3]+s*a[7]+o*a[11]+a[15];this.vx=h/c*e,this.vy=-l/c*i,this.vz=n<=0?u/c:-u/c},update:function(t,e,i,n,r,s,o,a){var h=this.vx*t+this.vy*i+r,l=this.vx*e+this.vy*n+s;return o&&(h=Math.round(h),l=Math.round(l)),this.tx=h,this.ty=l,this.ta=this.alpha*a,this},load:function(t,e,i,n,s){return t[++i]=this.tx,t[++i]=this.ty,t[++i]=this.u,t[++i]=this.v,t[++i]=n,t[++i]=s,e[++i]=r.getTintAppendFloatAlpha(this.color,this.ta),i}});t.exports=o},function(t,e,i){var n={};t.exports=n;var r=i(166),s=i(32),o=i(84),a=i(41);n.create=function(t){return s.extend({id:s.nextId(),type:"composite",parent:null,isModified:!1,bodies:[],constraints:[],composites:[],label:"Composite",plugin:{}},t)},n.setModified=function(t,e,i,s){if(r.trigger(t,"compositeModified",t),t.isModified=e,i&&t.parent&&n.setModified(t.parent,e,i,s),s)for(var o=0;o=0&&t=0&&e=this.firstgid&&t0?1:.7),e.damping=e.damping||0,e.angularStiffness=e.angularStiffness||0,e.angleA=e.bodyA?e.bodyA.angle:e.angleA,e.angleB=e.bodyB?e.bodyB.angle:e.angleB,e.plugin={};var o={visible:!0,type:"line",anchors:!0,lineColor:null,lineOpacity:null,lineThickness:null,pinSize:null,anchorColor:null,anchorSize:null};return 0===e.length&&e.stiffness>.1?(o.type="pin",o.anchors=!1):e.stiffness<.9&&(o.type="spring"),e.render=l.extend(o,e.render),e},n.preSolveAll=function(t){for(var e=0;e0&&(c.position.x+=l.x,c.position.y+=l.y),0!==l.angle&&(r.rotate(c.vertices,l.angle,i.position),h.rotate(c.axes,l.angle),u>0&&s.rotateAbout(c.position,l.angle,i.position,c.position)),a.update(c.bounds,c.vertices,i.velocity)}l.angle*=n._warming,l.x*=n._warming,l.y*=n._warming}}},n.pointAWorld=function(t){return{x:(t.bodyA?t.bodyA.position.x:0)+t.pointA.x,y:(t.bodyA?t.bodyA.position.y:0)+t.pointA.y}},n.pointBWorld=function(t){return{x:(t.bodyB?t.bodyB.position.x:0)+t.pointB.x,y:(t.bodyB?t.bodyB.position.y:0)+t.pointB.y}}},function(t,e,i){var n=i(35),r=i(65),s=i(66),o=i(0),a=i(11),h=i(15),l=i(10),u=i(57),c=new o({Extends:h,Mixins:[a.Depth,a.GetBounds,a.Origin,a.Transform,a.ScrollFactor,a.Visible],initialize:function(t,e,i,r,s){void 0===r&&(r=1),void 0===s&&(s=r),h.call(this,t,"Zone"),this.setPosition(e,i),this.width=r,this.height=s,this.blendMode=n.NORMAL,this.updateDisplayOrigin()},displayWidth:{get:function(){return this.scaleX*this.width},set:function(t){this.scaleX=t/this.width}},displayHeight:{get:function(){return this.scaleY*this.height},set:function(t){this.scaleY=t/this.height}},setSize:function(t,e,i){void 0===i&&(i=!0),this.width=t,this.height=e,this.updateDisplayOrigin();var n=this.input;return i&&n&&!n.customHitArea&&(n.hitArea.width=t,n.hitArea.height=e),this},setDisplaySize:function(t,e){return this.displayWidth=t,this.displayHeight=e,this},setCircleDropZone:function(t){return this.setDropZone(new r(0,0,t),s)},setRectangleDropZone:function(t,e){return this.setDropZone(new l(0,0,t,e),u)},setDropZone:function(t,e){return void 0===t?this.setRectangleDropZone(this.width,this.height):this.input||this.setInteractive(t,e,!0),this},setAlpha:function(){},setBlendMode:function(){},renderCanvas:function(t,e,i){i.addToRenderList(e)},renderWebGL:function(t,e,i){i.addToRenderList(e)}});t.exports=c},function(t,e){t.exports=function(t){return 2*(t.width+t.height)}},function(t,e){t.exports=function(t){for(var e=t.length-1;e>0;e--){var i=Math.floor(Math.random()*(e+1)),n=t[e];t[e]=t[i],t[i]=n}return t}},function(t,e,i){t.exports={ADD_ANIMATION:i(724),ANIMATION_COMPLETE:i(725),ANIMATION_COMPLETE_KEY:i(726),ANIMATION_REPEAT:i(727),ANIMATION_RESTART:i(728),ANIMATION_START:i(729),ANIMATION_STOP:i(730),ANIMATION_UPDATE:i(731),PAUSE_ALL:i(732),REMOVE_ANIMATION:i(733),RESUME_ALL:i(734)}},function(t,e,i){var n=i(0),r=i(11),s=i(36),o=i(9),a=i(37),h=i(10),l=i(25),u=i(187),c=i(3),d=new n({Extends:o,Mixins:[r.Alpha,r.Visible],initialize:function(t,e,i,n){void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i=0),void 0===n&&(n=0),o.call(this),this.scene,this.sceneManager,this.scaleManager,this.cameraManager,this.id=0,this.name="",this.roundPixels=!1,this.useBounds=!1,this.worldView=new h,this.dirty=!0,this._x=t,this._y=e,this._width=i,this._height=n,this._bounds=new h,this._scrollX=0,this._scrollY=0,this._zoomX=1,this._zoomY=1,this._rotation=0,this.matrix=new l,this.transparent=!0,this.backgroundColor=u("rgba(0,0,0,0)"),this.disableCull=!1,this.culledObjects=[],this.midPoint=new c(i/2,n/2),this.originX=.5,this.originY=.5,this._customViewport=!1,this.mask=null,this._maskCamera=null,this.renderList=[]},addToRenderList:function(t){this.renderList.push(t)},setOrigin:function(t,e){return void 0===t&&(t=.5),void 0===e&&(e=t),this.originX=t,this.originY=e,this},getScroll:function(t,e,i){void 0===i&&(i=new c);var n=.5*this.width,r=.5*this.height;return i.x=t-n,i.y=e-r,this.useBounds&&(i.x=this.clampX(i.x),i.y=this.clampY(i.y)),i},centerOnX:function(t){var e=.5*this.width;return this.midPoint.x=t,this.scrollX=t-e,this.useBounds&&(this.scrollX=this.clampX(this.scrollX)),this},centerOnY:function(t){var e=.5*this.height;return this.midPoint.y=t,this.scrollY=t-e,this.useBounds&&(this.scrollY=this.clampY(this.scrollY)),this},centerOn:function(t,e){return this.centerOnX(t),this.centerOnY(e),this},centerToBounds:function(){if(this.useBounds){var t=this._bounds,e=.5*this.width,i=.5*this.height;this.midPoint.set(t.centerX,t.centerY),this.scrollX=t.centerX-e,this.scrollY=t.centerY-i}return this},centerToSize:function(){return this.scrollX=.5*this.width,this.scrollY=.5*this.height,this},cull:function(t){if(this.disableCull)return t;var e=this.matrix.matrix,i=e[0],n=e[1],r=e[2],s=e[3],o=i*s-n*r;if(!o)return t;var a=e[4],h=e[5],l=this.scrollX,u=this.scrollY,c=this.width,d=this.height,p=this.y,f=p+d,m=this.x,g=m+c,v=this.culledObjects,y=t.length;o=1/o,v.length=0;for(var x=0;xm&&T*i+S*r+ap&&T*n+S*s+hr&&(t=r),t},clampY:function(t){var e=this._bounds,i=this.displayHeight,n=e.y+(i-this.height)/2,r=Math.max(n,n+e.height-i);return tr&&(t=r),t},removeBounds:function(){return this.useBounds=!1,this.dirty=!0,this._bounds.setEmpty(),this},setAngle:function(t){return void 0===t&&(t=0),this.rotation=s(t),this},setBackgroundColor:function(t){return void 0===t&&(t="rgba(0,0,0,0)"),this.backgroundColor=u(t),this.transparent=0===this.backgroundColor.alpha,this},setBounds:function(t,e,i,n,r){return void 0===r&&(r=!1),this._bounds.setTo(t,e,i,n),this.dirty=!0,this.useBounds=!0,r?this.centerToBounds():(this.scrollX=this.clampX(this.scrollX),this.scrollY=this.clampY(this.scrollY)),this},getBounds:function(t){void 0===t&&(t=new h);var e=this._bounds;return t.setTo(e.x,e.y,e.width,e.height),t},setName:function(t){return void 0===t&&(t=""),this.name=t,this},setPosition:function(t,e){return void 0===e&&(e=t),this.x=t,this.y=e,this},setRotation:function(t){return void 0===t&&(t=0),this.rotation=t,this},setRoundPixels:function(t){return this.roundPixels=t,this},setScene:function(t){this.scene&&this._customViewport&&this.sceneManager.customViewports--,this.scene=t;var e=t.sys;return this.sceneManager=e.game.scene,this.scaleManager=e.scale,this.cameraManager=e.cameras,this.updateSystem(),this},setScroll:function(t,e){return void 0===e&&(e=t),this.scrollX=t,this.scrollY=e,this},setSize:function(t,e){return void 0===e&&(e=t),this.width=t,this.height=e,this},setViewport:function(t,e,i,n){return this.x=t,this.y=e,this.width=i,this.height=n,this},setZoom:function(t,e){return void 0===t&&(t=1),void 0===e&&(e=t),0===t&&(t=.001),0===e&&(e=.001),this.zoomX=t,this.zoomY=e,this},setMask:function(t,e){return void 0===e&&(e=!0),this.mask=t,this._maskCamera=e?this.cameraManager.default:this,this},clearMask:function(t){return void 0===t&&(t=!1),t&&this.mask&&this.mask.destroy(),this.mask=null,this},toJSON:function(){var t={name:this.name,x:this.x,y:this.y,width:this.width,height:this.height,zoom:this.zoom,rotation:this.rotation,roundPixels:this.roundPixels,scrollX:this.scrollX,scrollY:this.scrollY,backgroundColor:this.backgroundColor.rgba};return this.useBounds&&(t.bounds={x:this._bounds.x,y:this._bounds.y,width:this._bounds.width,height:this._bounds.height}),t},update:function(){},updateSystem:function(){if(this.scaleManager){var t=0!==this._x||0!==this._y||this.scaleManager.width!==this._width||this.scaleManager.height!==this._height,e=this.sceneManager;t&&!this._customViewport?e.customViewports++:!t&&this._customViewport&&e.customViewports--,this.dirty=!0,this._customViewport=t}},destroy:function(){this.emit(a.DESTROY,this),this.removeAllListeners(),this.matrix.destroy(),this.culledObjects=[],this._customViewport&&this.sceneManager.customViewports--,this.renderList=[],this._bounds=null,this.scene=null,this.scaleManager=null,this.sceneManager=null,this.cameraManager=null},x:{get:function(){return this._x},set:function(t){this._x=t,this.updateSystem()}},y:{get:function(){return this._y},set:function(t){this._y=t,this.updateSystem()}},width:{get:function(){return this._width},set:function(t){this._width=t,this.updateSystem()}},height:{get:function(){return this._height},set:function(t){this._height=t,this.updateSystem()}},scrollX:{get:function(){return this._scrollX},set:function(t){this._scrollX=t,this.dirty=!0}},scrollY:{get:function(){return this._scrollY},set:function(t){this._scrollY=t,this.dirty=!0}},zoom:{get:function(){return(this._zoomX+this._zoomY)/2},set:function(t){this._zoomX=t,this._zoomY=t,this.dirty=!0}},zoomX:{get:function(){return this._zoomX},set:function(t){this._zoomX=t,this.dirty=!0}},zoomY:{get:function(){return this._zoomY},set:function(t){this._zoomY=t,this.dirty=!0}},rotation:{get:function(){return this._rotation},set:function(t){this._rotation=t,this.dirty=!0}},centerX:{get:function(){return this.x+.5*this.width}},centerY:{get:function(){return this.y+.5*this.height}},displayWidth:{get:function(){return this.width/this.zoomX}},displayHeight:{get:function(){return this.height/this.zoomY}}});t.exports=d},function(t,e,i){var n=i(334),r=i(335),s=i(336),o=i(337),a=i(338),h=i(339),l=i(340),u=i(341),c=i(342),d=i(343),p=i(344),f=i(345);t.exports={Power0:l,Power1:u.Out,Power2:o.Out,Power3:c.Out,Power4:d.Out,Linear:l,Quad:u.Out,Cubic:o.Out,Quart:c.Out,Quint:d.Out,Sine:p.Out,Expo:h.Out,Circ:s.Out,Elastic:a.Out,Back:n.Out,Bounce:r.Out,Stepped:f,"Quad.easeIn":u.In,"Cubic.easeIn":o.In,"Quart.easeIn":c.In,"Quint.easeIn":d.In,"Sine.easeIn":p.In,"Expo.easeIn":h.In,"Circ.easeIn":s.In,"Elastic.easeIn":a.In,"Back.easeIn":n.In,"Bounce.easeIn":r.In,"Quad.easeOut":u.Out,"Cubic.easeOut":o.Out,"Quart.easeOut":c.Out,"Quint.easeOut":d.Out,"Sine.easeOut":p.Out,"Expo.easeOut":h.Out,"Circ.easeOut":s.Out,"Elastic.easeOut":a.Out,"Back.easeOut":n.Out,"Bounce.easeOut":r.Out,"Quad.easeInOut":u.InOut,"Cubic.easeInOut":o.InOut,"Quart.easeInOut":c.InOut,"Quint.easeInOut":d.InOut,"Sine.easeInOut":p.InOut,"Expo.easeInOut":h.InOut,"Circ.easeInOut":s.InOut,"Elastic.easeInOut":a.InOut,"Back.easeInOut":n.InOut,"Bounce.easeInOut":r.InOut}},function(t,e){t.exports=function(t,e,i){return(e-t)*i+t}},function(t,e,i){var n,r=i(105),s={chrome:!1,chromeVersion:0,edge:!1,firefox:!1,firefoxVersion:0,ie:!1,ieVersion:0,mobileSafari:!1,opera:!1,safari:!1,safariVersion:0,silk:!1,trident:!1,tridentVersion:0};t.exports=(n=navigator.userAgent,/Edge\/\d+/.test(n)?s.edge=!0:/Chrome\/(\d+)/.test(n)&&!r.windowsPhone?(s.chrome=!0,s.chromeVersion=parseInt(RegExp.$1,10)):/Firefox\D+(\d+)/.test(n)?(s.firefox=!0,s.firefoxVersion=parseInt(RegExp.$1,10)):/AppleWebKit/.test(n)&&r.iOS?s.mobileSafari=!0:/MSIE (\d+\.\d+);/.test(n)?(s.ie=!0,s.ieVersion=parseInt(RegExp.$1,10)):/Opera/.test(n)?s.opera=!0:/Safari/.test(n)&&!r.windowsPhone?s.safari=!0:/Trident\/(\d+\.\d+)(.*)rv:(\d+\.\d+)/.test(n)&&(s.ie=!0,s.trident=!0,s.tridentVersion=parseInt(RegExp.$1,10),s.ieVersion=parseInt(RegExp.$3,10)),/Silk/.test(n)&&(s.silk=!0),s)},function(t,e){t.exports=function(t,e){return Math.random()*(e-t)+t}},function(t,e){t.exports=function(t,e){return t>0&&0==(t&t-1)&&e>0&&0==(e&e-1)}},function(t,e){t.exports=function(t,e,i,n){return void 0===i&&(i=0),0===e?t:(t-=i,t=e*Math.ceil(t/e),n?(i+t)/e:i+t)}},function(t,e,i){var n=new(i(0))({initialize:function(t,e,i,n){this.x=0,this.y=0,this.z=0,this.w=0,"object"==typeof t?(this.x=t.x||0,this.y=t.y||0,this.z=t.z||0,this.w=t.w||0):(this.x=t||0,this.y=e||0,this.z=i||0,this.w=n||0)},clone:function(){return new n(this.x,this.y,this.z,this.w)},copy:function(t){return this.x=t.x,this.y=t.y,this.z=t.z||0,this.w=t.w||0,this},equals:function(t){return this.x===t.x&&this.y===t.y&&this.z===t.z&&this.w===t.w},set:function(t,e,i,n){return"object"==typeof t?(this.x=t.x||0,this.y=t.y||0,this.z=t.z||0,this.w=t.w||0):(this.x=t||0,this.y=e||0,this.z=i||0,this.w=n||0),this},add:function(t){return this.x+=t.x,this.y+=t.y,this.z+=t.z||0,this.w+=t.w||0,this},subtract:function(t){return this.x-=t.x,this.y-=t.y,this.z-=t.z||0,this.w-=t.w||0,this},scale:function(t){return this.x*=t,this.y*=t,this.z*=t,this.w*=t,this},length:function(){var t=this.x,e=this.y,i=this.z,n=this.w;return Math.sqrt(t*t+e*e+i*i+n*n)},lengthSq:function(){var t=this.x,e=this.y,i=this.z,n=this.w;return t*t+e*e+i*i+n*n},normalize:function(){var t=this.x,e=this.y,i=this.z,n=this.w,r=t*t+e*e+i*i+n*n;return r>0&&(r=1/Math.sqrt(r),this.x=t*r,this.y=e*r,this.z=i*r,this.w=n*r),this},dot:function(t){return this.x*t.x+this.y*t.y+this.z*t.z+this.w*t.w},lerp:function(t,e){void 0===e&&(e=0);var i=this.x,n=this.y,r=this.z,s=this.w;return this.x=i+e*(t.x-i),this.y=n+e*(t.y-n),this.z=r+e*(t.z-r),this.w=s+e*(t.w-s),this},multiply:function(t){return this.x*=t.x,this.y*=t.y,this.z*=t.z||1,this.w*=t.w||1,this},divide:function(t){return this.x/=t.x,this.y/=t.y,this.z/=t.z||1,this.w/=t.w||1,this},distance:function(t){var e=t.x-this.x,i=t.y-this.y,n=t.z-this.z||0,r=t.w-this.w||0;return Math.sqrt(e*e+i*i+n*n+r*r)},distanceSq:function(t){var e=t.x-this.x,i=t.y-this.y,n=t.z-this.z||0,r=t.w-this.w||0;return e*e+i*i+n*n+r*r},negate:function(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this.w=-this.w,this},transformMat4:function(t){var e=this.x,i=this.y,n=this.z,r=this.w,s=t.val;return this.x=s[0]*e+s[4]*i+s[8]*n+s[12]*r,this.y=s[1]*e+s[5]*i+s[9]*n+s[13]*r,this.z=s[2]*e+s[6]*i+s[10]*n+s[14]*r,this.w=s[3]*e+s[7]*i+s[11]*n+s[15]*r,this},transformQuat:function(t){var e=this.x,i=this.y,n=this.z,r=t.x,s=t.y,o=t.z,a=t.w,h=a*e+s*n-o*i,l=a*i+o*e-r*n,u=a*n+r*i-s*e,c=-r*e-s*i-o*n;return this.x=h*a+c*-r+l*-o-u*-s,this.y=l*a+c*-s+u*-r-h*-o,this.z=u*a+c*-o+h*-s-l*-r,this},reset:function(){return this.x=0,this.y=0,this.z=0,this.w=0,this}});n.prototype.sub=n.prototype.subtract,n.prototype.mul=n.prototype.multiply,n.prototype.div=n.prototype.divide,n.prototype.dist=n.prototype.distance,n.prototype.distSq=n.prototype.distanceSq,n.prototype.len=n.prototype.length,n.prototype.lenSq=n.prototype.lengthSq,t.exports=n},function(t,e,i){var n=i(0),r=i(91),s=new n({initialize:function(t,e,i,n,r,s,o){void 0===n&&(n=1),void 0===r&&(r=0),void 0===s&&(s=!0),void 0===o&&(o=!1),this.renderer=t,this.framebuffer=null,this.texture=null,this.width=0,this.height=0,this.scale=n,this.minFilter=r,this.autoClear=s,this.autoResize=!1,this.resize(e,i),o&&this.setAutoResize(!0)},setAutoResize:function(t){return t&&!this.autoResize?(this.renderer.on(r.RESIZE,this.resize,this),this.autoResize=!0):!t&&this.autoResize&&(this.renderer.off(r.RESIZE,this.resize,this),this.autoResize=!1),this},resize:function(t,e){var i=t*this.scale,n=e*this.scale;if(i!==this.width||n!==this.height){var r=this.renderer;r.deleteFramebuffer(this.framebuffer),r.deleteTexture(this.texture),t*=this.scale,e*=this.scale,(t=Math.round(t))<=0&&(t=1),(e=Math.round(e))<=0&&(e=1),this.texture=r.createTextureFromSource(null,t,e,this.minFilter),this.framebuffer=r.createFramebuffer(t,e,this.texture,!1),this.width=t,this.height=e}return this},bind:function(t,e,i){if(void 0===t&&(t=!1),t&&this.renderer.flush(),e&&i&&this.resize(e,i),this.renderer.pushFramebuffer(this.framebuffer,!1,!1,!1),t&&this.adjustViewport(),this.autoClear){var n=this.renderer.gl;n.clearColor(0,0,0,0),n.clear(n.COLOR_BUFFER_BIT)}},adjustViewport:function(){var t=this.renderer.gl;t.viewport(0,0,this.width,this.height),t.disable(t.SCISSOR_TEST)},clear:function(){var t=this.renderer,e=t.gl;t.pushFramebuffer(this.framebuffer),e.disable(e.SCISSOR_TEST),e.clearColor(0,0,0,0),e.clear(e.COLOR_BUFFER_BIT),t.popFramebuffer(),t.resetScissor()},unbind:function(t){void 0===t&&(t=!1);var e=this.renderer;return t&&e.flush(),e.popFramebuffer()},destroy:function(){var t=this.renderer;t.deleteFramebuffer(this.framebuffer),t.deleteTexture(this.texture),t.off(r.RESIZE,this.resize,this),this.renderer=null,this.framebuffer=null,this.texture=null}});t.exports=s},function(t,e){t.exports=function(t,e){var i;if(e)"string"==typeof e?i=document.getElementById(e):"object"==typeof e&&1===e.nodeType&&(i=e);else if(t.parentElement||null===e)return t;return i||(i=document.body),i.appendChild(t),t}},function(t,e){t.exports={BACKSPACE:8,TAB:9,ENTER:13,SHIFT:16,CTRL:17,ALT:18,PAUSE:19,CAPS_LOCK:20,ESC:27,SPACE:32,PAGE_UP:33,PAGE_DOWN:34,END:35,HOME:36,LEFT:37,UP:38,RIGHT:39,DOWN:40,PRINT_SCREEN:42,INSERT:45,DELETE:46,ZERO:48,ONE:49,TWO:50,THREE:51,FOUR:52,FIVE:53,SIX:54,SEVEN:55,EIGHT:56,NINE:57,NUMPAD_ZERO:96,NUMPAD_ONE:97,NUMPAD_TWO:98,NUMPAD_THREE:99,NUMPAD_FOUR:100,NUMPAD_FIVE:101,NUMPAD_SIX:102,NUMPAD_SEVEN:103,NUMPAD_EIGHT:104,NUMPAD_NINE:105,NUMPAD_ADD:107,NUMPAD_SUBTRACT:109,A:65,B:66,C:67,D:68,E:69,F:70,G:71,H:72,I:73,J:74,K:75,L:76,M:77,N:78,O:79,P:80,Q:81,R:82,S:83,T:84,U:85,V:86,W:87,X:88,Y:89,Z:90,F1:112,F2:113,F3:114,F4:115,F5:116,F6:117,F7:118,F8:119,F9:120,F10:121,F11:122,F12:123,SEMICOLON:186,PLUS:187,COMMA:188,MINUS:189,PERIOD:190,FORWARD_SLASH:191,BACK_SLASH:220,QUOTES:222,BACKTICK:192,OPEN_BRACKET:219,CLOSED_BRACKET:221,SEMICOLON_FIREFOX:59,COLON:58,COMMA_FIREFOX_WINDOWS:60,COMMA_FIREFOX:62,BRACKET_RIGHT_FIREFOX:174,BRACKET_LEFT_FIREFOX:175}},function(t,e){t.exports={PENDING:0,INIT:1,START:2,LOADING:3,CREATING:4,RUNNING:5,PAUSED:6,SLEEPING:7,SHUTDOWN:8,DESTROYED:9}},function(t,e,i){var n=i(0),r=i(77),s=i(9),o=i(70),a=i(22),h=i(1),l=i(207),u=i(428),c=new n({Extends:s,initialize:function(t){s.call(this),this.game=t,this.jsonCache=t.cache.json,this.sounds=[],this.mute=!1,this.volume=1,this.pauseOnBlur=!0,this._rate=1,this._detune=0,this.locked=this.locked||!1,this.unlocked=!1,t.events.on(a.BLUR,this.onGameBlur,this),t.events.on(a.FOCUS,this.onGameFocus,this),t.events.on(a.PRE_STEP,this.update,this),t.events.once(a.DESTROY,this.destroy,this)},add:h,addAudioSprite:function(t,e){void 0===e&&(e={});var i=this.add(t,e);for(var n in i.spritemap=this.jsonCache.get(t).spritemap,i.spritemap)if(i.spritemap.hasOwnProperty(n)){var s=r(e),o=i.spritemap[n];s.loop=!!o.hasOwnProperty("loop")&&o.loop,i.addMarker({name:n,start:o.start,duration:o.end-o.start,config:s})}return i},get:function(t){return u(this.sounds,"key",t)},getAll:function(t){return l(this.sounds,"key",t)},play:function(t,e){var i=this.add(t);return i.once(o.COMPLETE,i.destroy,i),e?e.name?(i.addMarker(e),i.play(e.name)):i.play(e):i.play()},playAudioSprite:function(t,e,i){var n=this.addAudioSprite(t);return n.once(o.COMPLETE,n.destroy,n),n.play(e,i)},remove:function(t){var e=this.sounds.indexOf(t);return-1!==e&&(t.destroy(),this.sounds.splice(e,1),!0)},removeAll:function(){this.sounds.forEach((function(t){t.destroy()})),this.sounds.length=0},removeByKey:function(t){for(var e=0,i=this.sounds.length-1;i>=0;i--){var n=this.sounds[i];n.key===t&&(n.destroy(),this.sounds.splice(i,1),e++)}return e},pauseAll:function(){this.forEachActiveSound((function(t){t.pause()})),this.emit(o.PAUSE_ALL,this)},resumeAll:function(){this.forEachActiveSound((function(t){t.resume()})),this.emit(o.RESUME_ALL,this)},stopAll:function(){this.forEachActiveSound((function(t){t.stop()})),this.emit(o.STOP_ALL,this)},stopByKey:function(t){var e=0;return this.getAll(t).forEach((function(t){t.stop()&&e++})),e},unlock:h,onBlur:h,onFocus:h,onGameBlur:function(){this.pauseOnBlur&&this.onBlur()},onGameFocus:function(){this.pauseOnBlur&&this.onFocus()},update:function(t,e){this.unlocked&&(this.unlocked=!1,this.locked=!1,this.emit(o.UNLOCKED,this));for(var i=this.sounds.length-1;i>=0;i--)this.sounds[i].pendingRemove&&this.sounds.splice(i,1);this.sounds.forEach((function(i){i.update(t,e)}))},destroy:function(){this.game.events.off(a.BLUR,this.onGameBlur,this),this.game.events.off(a.FOCUS,this.onGameFocus,this),this.game.events.off(a.PRE_STEP,this.update,this),this.removeAllListeners(),this.removeAll(),this.sounds.length=0,this.sounds=null,this.game=null},forEachActiveSound:function(t,e){var i=this;this.sounds.forEach((function(n,r){n&&!n.pendingRemove&&t.call(e||i,n,r,i.sounds)}))},setRate:function(t){return this.rate=t,this},rate:{get:function(){return this._rate},set:function(t){this._rate=t,this.forEachActiveSound((function(t){t.calculateRate()})),this.emit(o.GLOBAL_RATE,this,t)}},setDetune:function(t){return this.detune=t,this},detune:{get:function(){return this._detune},set:function(t){this._detune=t,this.forEachActiveSound((function(t){t.calculateRate()})),this.emit(o.GLOBAL_DETUNE,this,t)}}});t.exports=c},function(t,e,i){var n=i(0),r=i(9),s=i(70),o=i(17),a=i(1),h=new n({Extends:r,initialize:function(t,e,i){r.call(this),this.manager=t,this.key=e,this.isPlaying=!1,this.isPaused=!1,this.totalRate=1,this.duration=this.duration||0,this.totalDuration=this.totalDuration||0,this.config={mute:!1,volume:1,rate:1,detune:0,seek:0,loop:!1,delay:0,pan:0},this.currentConfig=this.config,this.config=o(this.config,i),this.markers={},this.currentMarker=null,this.pendingRemove=!1},addMarker:function(t){return!(!t||!t.name||"string"!=typeof t.name||this.markers[t.name]||(t=o(!0,{name:"",start:0,duration:this.totalDuration-(t.start||0),config:{mute:!1,volume:1,rate:1,detune:0,seek:0,loop:!1,delay:0,pan:0}},t),this.markers[t.name]=t,0))},updateMarker:function(t){return!(!t||!t.name||"string"!=typeof t.name||!this.markers[t.name]||(this.markers[t.name]=o(!0,this.markers[t.name],t),0))},removeMarker:function(t){var e=this.markers[t];return e?(this.markers[t]=null,e):null},play:function(t,e){if(void 0===t&&(t=""),"object"==typeof t&&(e=t,t=""),"string"!=typeof t)return!1;if(t){if(!this.markers[t])return!1;this.currentMarker=this.markers[t],this.currentConfig=this.currentMarker.config,this.duration=this.currentMarker.duration}else this.currentMarker=null,this.currentConfig=this.config,this.duration=this.totalDuration;return this.resetConfig(),this.currentConfig=o(this.currentConfig,e),this.isPlaying=!0,this.isPaused=!1,!0},pause:function(){return!(this.isPaused||!this.isPlaying||(this.isPlaying=!1,this.isPaused=!0,0))},resume:function(){return!(!this.isPaused||this.isPlaying||(this.isPlaying=!0,this.isPaused=!1,0))},stop:function(){return!(!this.isPaused&&!this.isPlaying||(this.isPlaying=!1,this.isPaused=!1,this.resetConfig(),0))},applyConfig:function(){this.mute=this.currentConfig.mute,this.volume=this.currentConfig.volume,this.rate=this.currentConfig.rate,this.detune=this.currentConfig.detune,this.loop=this.currentConfig.loop,this.pan=this.currentConfig.pan},resetConfig:function(){this.currentConfig.seek=0,this.currentConfig.delay=0},update:a,calculateRate:function(){var t=this.currentConfig.detune+this.manager.detune,e=Math.pow(1.0005777895065548,t);this.totalRate=this.currentConfig.rate*this.manager.rate*e},destroy:function(){this.pendingRemove||(this.emit(s.DESTROY,this),this.pendingRemove=!0,this.manager=null,this.key="",this.removeAllListeners(),this.isPlaying=!1,this.isPaused=!1,this.config=null,this.currentConfig=null,this.markers=null,this.currentMarker=null)}});t.exports=h},function(t,e,i){var n=i(209),r=i(435);t.exports=function(t,e){if(void 0===e&&(e=90),!n(t))return null;if("string"!=typeof e&&(e=(e%360+360)%360),90===e||-270===e||"rotateLeft"===e)(t=r(t)).reverse();else if(-90===e||270===e||"rotateRight"===e)t.reverse(),t=r(t);else if(180===Math.abs(e)||"rotate180"===e){for(var i=0;i-1&&this.entries.splice(e,1),this},dump:function(){for(var t=0;t-1},union:function(t){var e=new n;return t.entries.forEach((function(t){e.set(t)})),this.entries.forEach((function(t){e.set(t)})),e},intersect:function(t){var e=new n;return this.entries.forEach((function(i){t.contains(i)&&e.set(i)})),e},difference:function(t){var e=new n;return this.entries.forEach((function(i){t.contains(i)||e.set(i)})),e},size:{get:function(){return this.entries.length},set:function(t){return to||s>a)return!1;if(r<=i||s<=n)return!0;var h=r-i,l=s-n;return h*h+l*l<=t.radius*t.radius}},function(t,e){t.exports=function(t,e){return!(t.width<=0||t.height<=0||e.width<=0||e.height<=0||t.righte.right||t.y>e.bottom)}},function(t,e,i){var n=i(6),r={},s={register:function(t,e,i,n,s){r[t]={plugin:e,mapping:i,settingsKey:n,configKey:s}},getPlugin:function(t){return r[t]},install:function(t){var e=t.scene.sys,i=e.settings.input,s=e.game.config;for(var o in r){var a=r[o].plugin,h=r[o].mapping,l=r[o].settingsKey,u=r[o].configKey;n(i,l,s[u])&&(t[h]=new a(t))}},remove:function(t){r.hasOwnProperty(t)&&delete r[t]}};t.exports=s},function(t,e,i){t.exports={ANY_KEY_DOWN:i(1323),ANY_KEY_UP:i(1324),COMBO_MATCH:i(1325),DOWN:i(1326),KEY_DOWN:i(1327),KEY_UP:i(1328),UP:i(1329)}},function(t,e){t.exports=function(t,e){return!!t.url&&(t.url.match(/^(?:blob:|data:|http:\/\/|https:\/\/|\/\/)/)?t.url:e+t.url)}},function(t,e){t.exports=function(t,e,i,n,r,s){return void 0===t&&(t=""),void 0===e&&(e=!0),void 0===i&&(i=""),void 0===n&&(n=""),void 0===r&&(r=0),void 0===s&&(s=!1),{responseType:t,async:e,user:i,password:n,timeout:r,headers:void 0,header:void 0,headerValue:void 0,requestedWith:!1,overrideMimeType:void 0,withCredentials:s}}},function(t,e,i){var n=i(0),r=i(243),s=i(73),o=new n({Extends:s,Mixins:[r.Acceleration,r.Angular,r.Bounce,r.Debug,r.Drag,r.Enable,r.Friction,r.Gravity,r.Immovable,r.Mass,r.Pushable,r.Size,r.Velocity],initialize:function(t,e,i,n,r){s.call(this,t,e,i,n,r),this.body=null}});t.exports=o},function(t,e,i){var n=i(119);t.exports=function(t,e,i,r){if(void 0===i&&(i=!1),n(t,e,r)){var s=r.data[e][t]||null;return s?-1===s.index?i?s:null:s:null}return null}},function(t,e){t.exports=function(t,e,i,n){var r,s,o,a=t.data,h=t.width,l=t.height,u=t.tilemapLayer,c=Math.max(0,e.left),d=Math.min(h,e.right),p=Math.max(0,e.top),f=Math.min(l,e.bottom);if(0===i)for(s=p;s=c;r--)(o=a[s][r])&&-1!==o.index&&o.visible&&0!==o.alpha&&n.push(o);else if(2===i)for(s=f;s>=p;s--)for(r=c;a[s]&&r=p;s--)for(r=d;a[s]&&r>=c;r--)(o=a[s][r])&&-1!==o.index&&o.visible&&0!==o.alpha&&n.push(o);return u.tilesDrawn=n.length,u.tilesTotal=h*l,n}},function(t,e){t.exports=function(t,e,i){var n=i.collideIndexes.indexOf(t);e&&-1===n?i.collideIndexes.push(t):e||-1===n||i.collideIndexes.splice(n,1)}},function(t,e,i){var n=i(2);t.exports=function(t,e,i){if(!e)return{i:0,layers:t.layers,name:"",opacity:1,visible:!0,x:0,y:0};var r=e.x+n(e,"startx",0)*t.tilewidth+n(e,"offsetx",0),s=e.y+n(e,"starty",0)*t.tileheight+n(e,"offsety",0);return{i:0,layers:e.layers,name:i.name+e.name+"/",opacity:i.opacity*e.opacity,visible:i.visible&&e.visible,x:i.x+r,y:i.y+s}}},function(t,e){t.exports=function(t,e,i){return t.hasOwnProperty(e)?"function"==typeof t[e]?function(i,n,r,s,o,a){return t[e](i,n,r,s,o,a)}:function(){return t[e]}:"function"==typeof i?i:function(){return i}}},function(t,e,i){var n=i(265),r=i(13),s=i(99),o=i(80),a=i(162),h=i(583),l=i(263),u=i(6),c=i(264),d=i(266),p=i(268);t.exports=function(t,e,i){void 0===i&&(i=n);for(var f=i.targets?i.targets:l(e),m=h(e),g=a(e,"delay",i.delay),v=a(e,"duration",i.duration),y=u(e,"easeParams",i.easeParams),x=o(u(e,"ease",i.ease),y),w=a(e,"hold",i.hold),b=a(e,"repeat",i.repeat),A=a(e,"repeatDelay",i.repeatDelay),T=s(e,"yoyo",i.yoyo),S=s(e,"flipX",i.flipX),E=s(e,"flipY",i.flipY),M=[],_=0;_n.getTotalFrames()&&(h=0);var l=n.frames[h];0!==h||this.forward||(l=n.getLastFrame()),this.currentFrame=l}return this.parent},pause:function(t){return this._paused||(this._paused=!0,this._wasPlaying=this.isPlaying,this.isPlaying=!1),void 0!==t&&this.setCurrentFrame(t),this.parent},resume:function(t){return this._paused&&(this._paused=!1,this.isPlaying=this._wasPlaying),void 0!==t&&this.setCurrentFrame(t),this.parent},playAfterDelay:function(t,e){if(this.isPlaying){var i=this.nextAnim,n=this.nextAnimsQueue;i&&n.unshift(i),this.nextAnim=t,this._pendingStop=1,this._pendingStopValue=e}else this.delayCounter=e,this.play(t,!0);return this.parent},playAfterRepeat:function(t,e){if(void 0===e&&(e=1),this.isPlaying){var i=this.nextAnim,n=this.nextAnimsQueue;i&&n.unshift(i),-1!==this.repeatCounter&&e>this.repeatCounter&&(e=this.repeatCounter),this.nextAnim=t,this._pendingStop=2,this._pendingStopValue=e}else this.play(t);return this.parent},play:function(t,e){void 0===e&&(e=!1);var i=this.currentAnim,n=this.parent,r="string"==typeof t?t:t.key;if(e&&this.isPlaying&&i.key===r)return n;if(i&&this.isPlaying){var s=this.animationManager.getMix(i.key,t);if(s>0)return this.playAfterDelay(t,s)}return this.forward=!0,this.inReverse=!1,this._paused=!1,this._wasPlaying=!0,this.startAnimation(t)},playReverse:function(t,e){void 0===e&&(e=!1);var i="string"==typeof t?t:t.key;return e&&this.isPlaying&&this.currentAnim.key===i?this.parent:(this.forward=!1,this.inReverse=!0,this._paused=!1,this._wasPlaying=!0,this.startAnimation(t))},startAnimation:function(t){this.load(t);var e=this.currentAnim,i=this.parent;return e?(this.repeatCounter=-1===this.repeat?Number.MAX_VALUE:this.repeat,e.getFirstTick(this),this.isPlaying=!0,this.pendingRepeat=!1,this.hasStarted=!1,this._pendingStop=0,this._pendingStopValue=0,this._paused=!1,this.delayCounter+=this.delay,0===this.delayCounter&&this.handleStart(),i):i},handleStart:function(){this.showOnStart&&this.parent.setVisible(!0),this.setCurrentFrame(this.currentFrame),this.hasStarted=!0,this.emitEvents(o.ANIMATION_START)},handleRepeat:function(){this.pendingRepeat=!1,this.emitEvents(o.ANIMATION_REPEAT)},handleStop:function(){this._pendingStop=0,this.isPlaying=!1,this.emitEvents(o.ANIMATION_STOP)},handleComplete:function(){this._pendingStop=0,this.isPlaying=!1,this.hideOnComplete&&this.parent.setVisible(!1),this.emitEvents(o.ANIMATION_COMPLETE,o.ANIMATION_COMPLETE_KEY)},emitEvents:function(t,e){var i=this.currentAnim,n=this.currentFrame,r=this.parent,s=n.textureFrame;r.emit(t,i,n,r,s),e&&r.emit(e+i.key,i,n,r,s)},reverse:function(){return this.isPlaying&&(this.inReverse=!this.inReverse,this.forward=!this.forward),this.parent},getProgress:function(){var t=this.currentFrame;if(!t)return 0;var e=t.progress;return this.inReverse&&(e*=-1),e},setProgress:function(t){return this.forward||(t=1-t),this.setCurrentFrame(this.currentAnim.getFrameByProgress(t)),this.parent},setRepeat:function(t){return this.repeatCounter=-1===t?Number.MAX_VALUE:t,this.parent},globalRemove:function(t,e){void 0===e&&(e=this.currentAnim),this.isPlaying&&e.key===this.currentAnim.key&&(this.stop(),this.setCurrentFrame(this.currentAnim.frames[0]))},restart:function(t,e){void 0===t&&(t=!1),void 0===e&&(e=!1);var i=this.currentAnim,n=this.parent;return i?(e&&(this.repeatCounter=-1===this.repeat?Number.MAX_VALUE:this.repeat),i.getFirstTick(this),this.emitEvents(o.ANIMATION_RESTART),this.isPlaying=!0,this.pendingRepeat=!1,this.hasStarted=!t,this._pendingStop=0,this._pendingStopValue=0,this._paused=!1,this.setCurrentFrame(i.frames[0]),this.parent):n},complete:function(){if(this._pendingStop=0,this.isPlaying=!1,this.currentAnim&&this.handleComplete(),this.nextAnim){var t=this.nextAnim;this.nextAnim=this.nextAnimsQueue.length>0?this.nextAnimsQueue.shift():null,this.play(t)}return this.parent},stop:function(){if(this._pendingStop=0,this.isPlaying=!1,this.currentAnim&&this.handleStop(),this.nextAnim){var t=this.nextAnim;this.nextAnim=this.nextAnimsQueue.shift(),this.play(t)}return this.parent},stopAfterDelay:function(t){return this._pendingStop=1,this._pendingStopValue=t,this.parent},stopAfterRepeat:function(t){return void 0===t&&(t=1),-1!==this.repeatCounter&&t>this.repeatCounter&&(t=this.repeatCounter),this._pendingStop=2,this._pendingStopValue=t,this.parent},stopOnFrame:function(t){return this._pendingStop=3,this._pendingStopValue=t,this.parent},getTotalFrames:function(){return this.currentAnim?this.currentAnim.getTotalFrames():0},update:function(t,e){var i=this.currentAnim;if(this.isPlaying&&i&&!i.paused){if(this.accumulator+=e*this.timeScale,1===this._pendingStop&&(this._pendingStopValue-=e,this._pendingStopValue<=0))return this.stop();if(this.hasStarted){if(this.accumulator>=this.nextTick&&(this.forward?i.nextFrame(this):i.previousFrame(this),this.isPlaying&&0===this._pendingStop&&this.skipMissedFrames&&this.accumulator>this.nextTick)){var n=0;do{this.forward?i.nextFrame(this):i.previousFrame(this),n++}while(this.isPlaying&&this.accumulator>this.nextTick&&n<60)}}else this.accumulator>=this.delayCounter&&(this.accumulator-=this.delayCounter,this.handleStart())}},setCurrentFrame:function(t){var e=this.parent;return this.currentFrame=t,e.texture=t.frame.texture,e.frame=t.frame,e.isCropped&&e.frame.updateCropUVs(e._crop,e.flipX,e.flipY),t.setAlpha&&(e.alpha=t.alpha),e.setSizeToFrame(),e._originComponent&&(t.frame.customPivot?e.setOrigin(t.frame.pivotX,t.frame.pivotY):e.updateDisplayOrigin()),this.isPlaying&&this.hasStarted&&(this.emitEvents(o.ANIMATION_UPDATE),3===this._pendingStop&&this._pendingStopValue===t&&this.stop()),e},nextFrame:function(){return this.currentAnim&&this.currentAnim.nextFrame(this),this.parent},previousFrame:function(){return this.currentAnim&&this.currentAnim.previousFrame(this),this.parent},get:function(t){return this.anims?this.anims.get(t):null},exists:function(t){return!!this.anims&&this.anims.has(t)},create:function(t){var e=t.key,i=!1;return e&&((i=this.get(e))||(i=new a(this,e,t),this.anims||(this.anims=new r),this.anims.set(e,i))),i},generateFrameNames:function(t,e){return this.animationManager.generateFrameNames(t,e)},generateFrameNumbers:function(t,e){return this.animationManager.generateFrameNumbers(t,e)},remove:function(t){var e=this.get(t);return e&&(this.currentAnim===e&&this.stop(),this.anims.delete(t)),e},destroy:function(){this.animationManager.off(o.REMOVE_ANIMATION,this.globalRemove,this),this.anims&&this.anims.clear(),this.animationManager=null,this.parent=null,this.nextAnim=null,this.nextAnimsQueue.length=0,this.currentAnim=null,this.currentFrame=null},isPaused:{get:function(){return this._paused}}});t.exports=h},function(t,e,i){var n={};t.exports=n;var r=i(166);n._motionWakeThreshold=.18,n._motionSleepThreshold=.08,n._minBias=.9,n.update=function(t,e){for(var i=e*e*e,r=0;r0&&s.motion=s.sleepThreshold&&n.set(s,!0)):s.sleepCounter>0&&(s.sleepCounter-=1)}else n.set(s,!1)}},n.afterCollisions=function(t,e){for(var i=e*e*e,r=0;rn._motionWakeThreshold*i&&n.set(l,!1)}}}},n.set=function(t,e){var i=t.isSleeping;e?(t.isSleeping=!0,t.sleepCounter=t.sleepThreshold,t.positionImpulse.x=0,t.positionImpulse.y=0,t.positionPrev.x=t.position.x,t.positionPrev.y=t.position.y,t.anglePrev=t.angle,t.speed=0,t.angularSpeed=0,t.motion=0,i||r.trigger(t,"sleepStart")):(t.isSleeping=!1,t.sleepCounter=0,i&&r.trigger(t,"sleepEnd"))}},function(t,e,i){var n={};t.exports=n;var r=i(32);n.on=function(t,e,i){for(var n,r=e.split(" "),s=0;s0){i||(i={}),n=e.split(" ");for(var l=0;l0,this},setPipelineData:function(t,e){var i=this.pipelineData;return void 0===e?delete i[t]:i[t]=e,this},getPostPipeline:function(t){for(var e=this.postPipelines,i=[],n=0;n=0;i--){var n=e[i];("string"==typeof t&&n.name===t||"string"!=typeof t&&n instanceof t)&&(n.destroy(),s(e,i))}return this.hasPostPipeline=this.postPipelines.length>0,this},getPipelineName:function(){return this.pipeline.name}};t.exports=o},function(t,e){t.exports={DEFAULT:0,LINEAR:0,NEAREST:1}},function(t,e,i){var n=i(4);t.exports=function(t,e,i){return void 0===i&&(i=new n),i.x=t.x+t.radius*Math.cos(e),i.y=t.y+t.radius*Math.sin(e),i}},function(t,e,i){var n=i(4);t.exports=function(t,e){void 0===e&&(e=new n);var i=2*Math.PI*Math.random(),r=Math.random()+Math.random(),s=r>1?2-r:r,o=s*Math.cos(i),a=s*Math.sin(i);return e.x=t.x+o*t.radius,e.y=t.y+a*t.radius,e}},function(t,e,i){var n=i(130),r=i(4);t.exports=function(t,e,i){if(void 0===i&&(i=new r),e<=0||e>=1)return i.x=t.x,i.y=t.y,i;var s=n(t)*e;return e>.5?(s-=t.width+t.height)<=t.width?(i.x=t.right-s,i.y=t.bottom):(i.x=t.x,i.y=t.bottom-(s-t.width)):s<=t.width?(i.x=t.x+s,i.y=t.y):(i.x=t.right,i.y=t.y+(s-t.width)),i}},function(t,e,i){var n=i(67),r=i(4);t.exports=function(t,e,i,s){void 0===s&&(s=[]),!e&&i>0&&(e=n(t)/i);for(var o=t.x1,a=t.y1,h=t.x2,l=t.y2,u=0;u=1&&(a=1-a,h=1-h),e.x=t.x1+(i*a+s*h),e.y=t.y1+(r*a+o*h),e}},function(t,e){t.exports=function(t,e,i,n,r){var s=n+Math.atan2(t.y-i,t.x-e);return t.x=e+r*Math.cos(s),t.y=i+r*Math.sin(s),t}},function(t,e){t.exports=function(t,e,i){return(t=Math.max(0,Math.min(1,(t-e)/(i-e))))*t*t*(t*(6*t-15)+10)}},function(t,e){t.exports=function(t,e,i){return t<=e?0:t>=i?1:(t=(t-e)/(i-e))*t*(3-2*t)}},function(t,e,i){var n=i(18),r=i(0),s=i(132),o=i(318),a=i(319),h=i(6),l=i(320),u=new r({initialize:function(t,e,i){this.manager=t,this.key=e,this.type="frame",this.frames=this.getFrames(t.textureManager,h(i,"frames",[]),h(i,"defaultTextureKey",null),h(i,"sortFrames",!0)),this.frameRate=h(i,"frameRate",null),this.duration=h(i,"duration",null),this.msPerFrame,this.skipMissedFrames=h(i,"skipMissedFrames",!0),this.delay=h(i,"delay",0),this.repeat=h(i,"repeat",0),this.repeatDelay=h(i,"repeatDelay",0),this.yoyo=h(i,"yoyo",!1),this.showOnStart=h(i,"showOnStart",!1),this.hideOnComplete=h(i,"hideOnComplete",!1),this.paused=!1,this.calculateDuration(this,this.getTotalFrames(),this.duration,this.frameRate),this.manager.on&&(this.manager.on(s.PAUSE_ALL,this.pause,this),this.manager.on(s.RESUME_ALL,this.resume,this))},getTotalFrames:function(){return this.frames.length},calculateDuration:function(t,e,i,n){null===i&&null===n?(t.frameRate=24,t.duration=24/e*1e3):i&&null===n?(t.duration=i,t.frameRate=e/(i/1e3)):(t.frameRate=n,t.duration=e/n*1e3),t.msPerFrame=1e3/t.frameRate},addFrame:function(t){return this.addFrameAt(this.frames.length,t)},addFrameAt:function(t,e){var i=this.getFrames(this.manager.textureManager,e);if(i.length>0){if(0===t)this.frames=i.concat(this.frames);else if(t===this.frames.length)this.frames=this.frames.concat(i);else{var n=this.frames.slice(0,t),r=this.frames.slice(t);this.frames=n.concat(i,r)}this.updateFrameSequence()}return this},checkFrame:function(t){return t>=0&&t0){s.isLast=!0,s.nextFrame=c[0],c[0].prevFrame=s;var y=1/(c.length-1);for(o=0;o0?t.inReverse&&t.forward?t.forward=!1:this.repeatAnimation(t):t.complete():this.updateAndGetNextTick(t,e.nextFrame)},handleYoyoFrame:function(t,e){if(e||(e=!1),t.inReverse===!e&&t.repeatCounter>0)return(0===t.repeatDelay||t.pendingRepeat)&&(t.forward=e),void this.repeatAnimation(t);if(t.inReverse===e||0!==t.repeatCounter){t.forward=e;var i=e?t.currentFrame.nextFrame:t.currentFrame.prevFrame;this.updateAndGetNextTick(t,i)}else t.complete()},getLastFrame:function(){return this.frames[this.frames.length-1]},previousFrame:function(t){var e=t.currentFrame;e.isFirst?t.yoyo?this.handleYoyoFrame(t,!0):t.repeatCounter>0?(t.inReverse&&!t.forward||(t.forward=!0),this.repeatAnimation(t)):t.complete():this.updateAndGetNextTick(t,e.prevFrame)},updateAndGetNextTick:function(t,e){t.setCurrentFrame(e),this.getNextTick(t)},removeFrame:function(t){var e=this.frames.indexOf(t);return-1!==e&&this.removeFrameAt(e),this},removeFrameAt:function(t){return this.frames.splice(t,1),this.updateFrameSequence(),this},repeatAnimation:function(t){if(2===t._pendingStop){if(0===t._pendingStopValue)return t.stop();t._pendingStopValue--}t.repeatDelay>0&&!t.pendingRepeat?(t.pendingRepeat=!0,t.accumulator-=t.nextTick,t.nextTick+=t.repeatDelay):(t.repeatCounter--,t.forward?t.setCurrentFrame(t.currentFrame.nextFrame):t.setCurrentFrame(t.currentFrame.prevFrame),t.isPlaying&&(this.getNextTick(t),t.handleRepeat()))},toJSON:function(){var t={key:this.key,type:this.type,frames:[],frameRate:this.frameRate,duration:this.duration,skipMissedFrames:this.skipMissedFrames,delay:this.delay,repeat:this.repeat,repeatDelay:this.repeatDelay,yoyo:this.yoyo,showOnStart:this.showOnStart,hideOnComplete:this.hideOnComplete};return this.frames.forEach((function(e){t.frames.push(e.toJSON())})),t},updateFrameSequence:function(){for(var t,e=this.frames.length,i=1/(e-1),n=0;n1?(t.isLast=!0,t.prevFrame=this.frames[e-2],t.nextFrame=this.frames[0]):e>1&&(t.prevFrame=this.frames[n-1],t.nextFrame=this.frames[n+1]);return this},pause:function(){return this.paused=!0,this},resume:function(){return this.paused=!1,this},destroy:function(){this.manager.off&&(this.manager.off(s.PAUSE_ALL,this.pause,this),this.manager.off(s.RESUME_ALL,this.resume,this)),this.manager.remove(this.key);for(var t=0;t=(t=t.toString()).length)switch(n){case 1:t=new Array(e+1-t.length).join(i)+t;break;case 3:var s=Math.ceil((r=e-t.length)/2);t=new Array(r-s+1).join(i)+t+new Array(s+1).join(i);break;default:t+=new Array(e+1-t.length).join(i)}return t}},function(t,e,i){var n=i(327),r=i(189),s=i(331),o=i(332);t.exports=function(t){switch(typeof t){case"string":return"rgb"===t.substr(0,3).toLowerCase()?o(t):n(t);case"number":return r(t);case"object":return s(t)}}},function(t,e,i){var n=i(103);function r(t,e,i,n){var r=(t+6*e)%6,s=Math.min(r,4-r,1);return Math.round(255*(n-n*i*Math.max(0,s)))}t.exports=function(t,e,i,s){void 0===e&&(e=1),void 0===i&&(i=1);var o=r(5,t,e,i),a=r(3,t,e,i),h=r(1,t,e,i);return s?s.setTo?s.setTo(o,a,h,s.alpha,!1):(s.r=o,s.g=a,s.b=h,s.color=n(o,a,h),s):{r:o,g:a,b:h,color:n(o,a,h)}}},function(t,e,i){var n=i(38),r=i(330);t.exports=function(t){var e=r(t);return new n(e.r,e.g,e.b,e.a)}},function(t,e){t.exports=function(t,e,i){return t.x=e-t.width/2,t.y=i-t.height/2,t}},function(t,e,i){var n=i(105),r=i(136),s=i(31),o={canvas:!1,canvasBitBltShift:null,file:!1,fileSystem:!1,getUserMedia:!0,littleEndian:!1,localStorage:!1,pointerLock:!1,support32bit:!1,vibration:!1,webGL:!1,worker:!1};t.exports=function(){if("function"==typeof importScripts)return o;o.canvas=!!window.CanvasRenderingContext2D;try{o.localStorage=!!localStorage.getItem}catch(t){o.localStorage=!1}o.file=!!(window.File&&window.FileReader&&window.FileList&&window.Blob),o.fileSystem=!!window.requestFileSystem;var t,e,i,a=!1;return o.webGL=function(){if(window.WebGLRenderingContext)try{var t=s.createWebGL(this),e=t.getContext("webgl")||t.getContext("experimental-webgl"),i=s.create2D(this),n=i.getContext("2d").createImageData(1,1);return a=n.data instanceof Uint8ClampedArray,s.remove(t),s.remove(i),!!e}catch(t){return!1}return!1}(),o.worker=!!window.Worker,o.pointerLock="pointerLockElement"in document||"mozPointerLockElement"in document||"webkitPointerLockElement"in document,navigator.getUserMedia=navigator.getUserMedia||navigator.webkitGetUserMedia||navigator.mozGetUserMedia||navigator.msGetUserMedia||navigator.oGetUserMedia,window.URL=window.URL||window.webkitURL||window.mozURL||window.msURL,o.getUserMedia=o.getUserMedia&&!!navigator.getUserMedia&&!!window.URL,r.firefox&&r.firefoxVersion<21&&(o.getUserMedia=!1),!n.iOS&&(r.ie||r.firefox||r.chrome)&&(o.canvasBitBltShift=!0),(r.safari||r.mobileSafari)&&(o.canvasBitBltShift=!1),navigator.vibrate=navigator.vibrate||navigator.webkitVibrate||navigator.mozVibrate||navigator.msVibrate,navigator.vibrate&&(o.vibration=!0),"undefined"!=typeof ArrayBuffer&&"undefined"!=typeof Uint8Array&&"undefined"!=typeof Uint32Array&&(o.littleEndian=(t=new ArrayBuffer(4),e=new Uint8Array(t),i=new Uint32Array(t),e[0]=161,e[1]=178,e[2]=195,e[3]=212,3569595041===i[0]||2712847316!==i[0]&&null)),o.support32bit="undefined"!=typeof ArrayBuffer&&"undefined"!=typeof Uint8ClampedArray&&"undefined"!=typeof Int32Array&&null!==o.littleEndian&&a,o}()},function(t,e){var i,n="";t.exports={disable:function(t){return""===n&&(n=i(t)),n&&(t[n]=!1),t},enable:function(t){return""===n&&(n=i(t)),n&&(t[n]=!0),t},getPrefix:i=function(t){for(var e=["i","webkitI","msI","mozI","oI"],i=0;i0},isTransitionIn:function(){return this.settings.isTransition},isVisible:function(){return this.settings.visible},setVisible:function(t){return this.settings.visible=t,this},setActive:function(t,e){return t?this.resume(e):this.pause(e)},start:function(t){var e=this.events,i=this.settings;t&&(i.data=t),i.status=r.START,i.active=!0,i.visible=!0,e.emit(o.START,this),e.emit(o.READY,this,t)},shutdown:function(t){var e=this.events,i=this.settings;e.off(o.TRANSITION_INIT),e.off(o.TRANSITION_START),e.off(o.TRANSITION_COMPLETE),e.off(o.TRANSITION_OUT),i.status=r.SHUTDOWN,i.active=!1,i.visible=!1,this.renderer===l.WEBGL&&this.renderer.resetTextures(!0),e.emit(o.SHUTDOWN,this,t)},destroy:function(){var t=this.events,e=this.settings;e.status=r.DESTROYED,e.active=!1,e.visible=!1,t.emit(o.DESTROY,this),t.removeAllListeners();for(var i=["scene","game","anims","cache","plugins","registry","sound","textures","add","camera","displayList","events","make","scenePlugin","updateList"],n=0;n0},getRenderList:function(){return this.dirty&&(this.renderList=this.children.list.filter(this.childCanRender,this),this.dirty=!1),this.renderList},clear:function(){this.children.removeAll(),this.dirty=!0},preDestroy:function(){this.children.destroy(),this.renderList=[]}});t.exports=u},function(t,e,i){var n=i(208),r=i(35),s=i(0),o=i(11),a=i(75),h=i(15),l=i(10),u=i(1052),c=i(441),d=i(3),p=new s({Extends:h,Mixins:[o.AlphaSingle,o.BlendMode,o.ComputedSize,o.Depth,o.Mask,o.Pipeline,o.Transform,o.Visible,u],initialize:function(t,e,i,n){h.call(this,t,"Container"),this.list=[],this.exclusive=!0,this.maxSize=-1,this.position=0,this.localTransform=new o.TransformMatrix,this.tempTransformMatrix=new o.TransformMatrix,this._sortKey="",this._sysEvents=t.sys.events,this.scrollFactorX=1,this.scrollFactorY=1,this.initPipeline(),this.setPosition(e,i),this.clearAlpha(),this.setBlendMode(r.SKIP_CHECK),n&&this.add(n)},originX:{get:function(){return.5}},originY:{get:function(){return.5}},displayOriginX:{get:function(){return.5*this.width}},displayOriginY:{get:function(){return.5*this.height}},setExclusive:function(t){return void 0===t&&(t=!0),this.exclusive=t,this},getBounds:function(t){if(void 0===t&&(t=new l),t.setTo(this.x,this.y,0,0),this.parentContainer){var e=this.parentContainer.getBoundsTransformMatrix().transformPoint(this.x,this.y);t.setTo(e.x,e.y,0,0)}if(this.list.length>0){var i=this.list,n=new l,r=!1;t.setEmpty();for(var s=0;s-1},setAll:function(t,e,i,r){return n.SetAll(this.list,t,e,i,r),this},each:function(t,e){var i,n=[null],r=this.list.slice(),s=r.length;for(i=2;i0?this.list[0]:null}},last:{get:function(){return this.list.length>0?(this.position=this.list.length-1,this.list[this.position]):null}},next:{get:function(){return this.position0?(this.position--,this.list[this.position]):null}},preDestroy:function(){this.removeAll(!!this.exclusive),this.localTransform.destroy(),this.tempTransformMatrix.destroy(),this.list=[]}});t.exports=p},function(t,e,i){var n=i(148),r=i(0),s=i(1057),o=new r({Extends:n,Mixins:[s],initialize:function(t,e,i,r,s,o,a){n.call(this,t,e,i,r,s,o,a),this.type="DynamicBitmapText",this.scrollX=0,this.scrollY=0,this.cropWidth=0,this.cropHeight=0,this.displayCallback,this.callbackData={parent:this,color:0,tint:{topLeft:0,topRight:0,bottomLeft:0,bottomRight:0},index:0,charCode:0,x:0,y:0,scale:0,rotation:0,data:0}},setSize:function(t,e){return this.cropWidth=t,this.cropHeight=e,this},setDisplayCallback:function(t){return this.displayCallback=t,this},setScrollX:function(t){return this.scrollX=t,this},setScrollY:function(t){return this.scrollY=t,this}});t.exports=o},function(t,e,i){var n=i(133),r=i(0),s=i(217),o=i(303),a=i(304),h=i(305),l=i(309),u=i(167),c=i(312),d=i(313),p=i(314),f=i(111),m=i(15),g=i(2),v=i(6),y=i(14),x=i(1063),w=new r({Extends:m,Mixins:[o,a,h,l,u,d,p,c,x],initialize:function(t,e){var i=v(e,"x",0),n=v(e,"y",0);m.call(this,t,"Graphics"),this.setPosition(i,n),this.initPipeline(),this.displayOriginX=0,this.displayOriginY=0,this.commandBuffer=[],this.defaultFillColor=-1,this.defaultFillAlpha=1,this.defaultStrokeWidth=1,this.defaultStrokeColor=-1,this.defaultStrokeAlpha=1,this._lineWidth=1,this.setDefaultStyles(e)},setDefaultStyles:function(t){return v(t,"lineStyle",null)&&(this.defaultStrokeWidth=v(t,"lineStyle.width",1),this.defaultStrokeColor=v(t,"lineStyle.color",16777215),this.defaultStrokeAlpha=v(t,"lineStyle.alpha",1),this.lineStyle(this.defaultStrokeWidth,this.defaultStrokeColor,this.defaultStrokeAlpha)),v(t,"fillStyle",null)&&(this.defaultFillColor=v(t,"fillStyle.color",16777215),this.defaultFillAlpha=v(t,"fillStyle.alpha",1),this.fillStyle(this.defaultFillColor,this.defaultFillAlpha)),this},lineStyle:function(t,e,i){return void 0===i&&(i=1),this.commandBuffer.push(s.LINE_STYLE,t,e,i),this._lineWidth=t,this},fillStyle:function(t,e){return void 0===e&&(e=1),this.commandBuffer.push(s.FILL_STYLE,t,e),this},fillGradientStyle:function(t,e,i,n,r,o,a,h){return void 0===r&&(r=1),void 0===o&&(o=r),void 0===a&&(a=r),void 0===h&&(h=r),this.commandBuffer.push(s.GRADIENT_FILL_STYLE,r,o,a,h,t,e,i,n),this},lineGradientStyle:function(t,e,i,n,r,o){return void 0===o&&(o=1),this.commandBuffer.push(s.GRADIENT_LINE_STYLE,t,o,e,i,n,r),this},beginPath:function(){return this.commandBuffer.push(s.BEGIN_PATH),this},closePath:function(){return this.commandBuffer.push(s.CLOSE_PATH),this},fillPath:function(){return this.commandBuffer.push(s.FILL_PATH),this},fill:function(){return this.commandBuffer.push(s.FILL_PATH),this},strokePath:function(){return this.commandBuffer.push(s.STROKE_PATH),this},stroke:function(){return this.commandBuffer.push(s.STROKE_PATH),this},fillCircleShape:function(t){return this.fillCircle(t.x,t.y,t.radius)},strokeCircleShape:function(t){return this.strokeCircle(t.x,t.y,t.radius)},fillCircle:function(t,e,i){return this.beginPath(),this.arc(t,e,i,0,y.PI2),this.fillPath(),this},strokeCircle:function(t,e,i){return this.beginPath(),this.arc(t,e,i,0,y.PI2),this.strokePath(),this},fillRectShape:function(t){return this.fillRect(t.x,t.y,t.width,t.height)},strokeRectShape:function(t){return this.strokeRect(t.x,t.y,t.width,t.height)},fillRect:function(t,e,i,n){return this.commandBuffer.push(s.FILL_RECT,t,e,i,n),this},strokeRect:function(t,e,i,n){var r=this._lineWidth/2,s=t-r,o=t+r;return this.beginPath(),this.moveTo(t,e),this.lineTo(t,e+n),this.strokePath(),this.beginPath(),this.moveTo(t+i,e),this.lineTo(t+i,e+n),this.strokePath(),this.beginPath(),this.moveTo(s,e),this.lineTo(o+i,e),this.strokePath(),this.beginPath(),this.moveTo(s,e+n),this.lineTo(o+i,e+n),this.strokePath(),this},fillRoundedRect:function(t,e,i,n,r){void 0===r&&(r=20);var s=r,o=r,a=r,h=r;return"number"!=typeof r&&(s=g(r,"tl",20),o=g(r,"tr",20),a=g(r,"bl",20),h=g(r,"br",20)),this.beginPath(),this.moveTo(t+s,e),this.lineTo(t+i-o,e),this.arc(t+i-o,e+o,o,-y.TAU,0),this.lineTo(t+i,e+n-h),this.arc(t+i-h,e+n-h,h,0,y.TAU),this.lineTo(t+a,e+n),this.arc(t+a,e+n-a,a,y.TAU,Math.PI),this.lineTo(t,e+s),this.arc(t+s,e+s,s,-Math.PI,-y.TAU),this.fillPath(),this},strokeRoundedRect:function(t,e,i,n,r){void 0===r&&(r=20);var s=r,o=r,a=r,h=r;return"number"!=typeof r&&(s=g(r,"tl",20),o=g(r,"tr",20),a=g(r,"bl",20),h=g(r,"br",20)),this.beginPath(),this.moveTo(t+s,e),this.lineTo(t+i-o,e),this.moveTo(t+i-o,e),this.arc(t+i-o,e+o,o,-y.TAU,0),this.lineTo(t+i,e+n-h),this.moveTo(t+i,e+n-h),this.arc(t+i-h,e+n-h,h,0,y.TAU),this.lineTo(t+a,e+n),this.moveTo(t+a,e+n),this.arc(t+a,e+n-a,a,y.TAU,Math.PI),this.lineTo(t,e+s),this.moveTo(t,e+s),this.arc(t+s,e+s,s,-Math.PI,-y.TAU),this.strokePath(),this},fillPointShape:function(t,e){return this.fillPoint(t.x,t.y,e)},fillPoint:function(t,e,i){return!i||i<1?i=1:(t-=i/2,e-=i/2),this.commandBuffer.push(s.FILL_RECT,t,e,i,i),this},fillTriangleShape:function(t){return this.fillTriangle(t.x1,t.y1,t.x2,t.y2,t.x3,t.y3)},strokeTriangleShape:function(t){return this.strokeTriangle(t.x1,t.y1,t.x2,t.y2,t.x3,t.y3)},fillTriangle:function(t,e,i,n,r,o){return this.commandBuffer.push(s.FILL_TRIANGLE,t,e,i,n,r,o),this},strokeTriangle:function(t,e,i,n,r,o){return this.commandBuffer.push(s.STROKE_TRIANGLE,t,e,i,n,r,o),this},strokeLineShape:function(t){return this.lineBetween(t.x1,t.y1,t.x2,t.y2)},lineBetween:function(t,e,i,n){return this.beginPath(),this.moveTo(t,e),this.lineTo(i,n),this.strokePath(),this},lineTo:function(t,e){return this.commandBuffer.push(s.LINE_TO,t,e),this},moveTo:function(t,e){return this.commandBuffer.push(s.MOVE_TO,t,e),this},strokePoints:function(t,e,i,n){void 0===e&&(e=!1),void 0===i&&(i=!1),void 0===n&&(n=t.length),this.beginPath(),this.moveTo(t[0].x,t[0].y);for(var r=1;r-1&&this.fillStyle(this.defaultFillColor,this.defaultFillAlpha),this.defaultStrokeColor>-1&&this.lineStyle(this.defaultStrokeWidth,this.defaultStrokeColor,this.defaultStrokeAlpha),this},generateTexture:function(t,e,i){var n,r,s=this.scene.sys,o=s.game.renderer;if(void 0===e&&(e=s.scale.width),void 0===i&&(i=s.scale.height),w.TargetCamera.setScene(this.scene),w.TargetCamera.setViewport(0,0,e,i),w.TargetCamera.scrollX=this.x,w.TargetCamera.scrollY=this.y,"string"==typeof t)if(s.textures.exists(t)){var a=(n=s.textures.get(t)).getSourceImage();a instanceof HTMLCanvasElement&&(r=a.getContext("2d"))}else r=(n=s.textures.createCanvas(t,e,i)).getSourceImage().getContext("2d");else t instanceof HTMLCanvasElement&&(r=t.getContext("2d"));return r&&(this.renderCanvas(o,this,w.TargetCamera,null,r,!1),n&&n.refresh()),this},preDestroy:function(){this.commandBuffer=[]}});w.TargetCamera=new n,t.exports=w},function(t,e){t.exports={ARC:0,BEGIN_PATH:1,CLOSE_PATH:2,FILL_RECT:3,LINE_TO:4,MOVE_TO:5,LINE_STYLE:6,FILL_STYLE:7,FILL_PATH:8,STROKE_PATH:9,FILL_TRIANGLE:10,STROKE_TRIANGLE:11,SAVE:14,RESTORE:15,TRANSLATE:16,SCALE:17,ROTATE:18,GRADIENT_FILL_STYLE:21,GRADIENT_LINE_STYLE:22}},function(t,e,i){var n=i(4);t.exports=function(t,e,i){void 0===i&&(i=new n);var r=t.width/2,s=t.height/2;return i.x=t.x+r*Math.cos(e),i.y=t.y+s*Math.sin(e),i}},function(t,e,i){var n=i(35),r=i(0),s=i(11),o=i(176),a=i(101),h=i(9),l=i(75),u=i(110),c=i(1071),d=i(20),p=i(79),f=new r({Extends:u,Mixins:[s.AlphaSingle,s.BlendMode,s.Depth,s.Mask,s.Pipeline,s.Visible,h,c],initialize:function(t,e){u.call(this,t),h.call(this),this.scene=t,this.displayList=null,this.type="Layer",this.state=0,this.parentContainer=null,this.name="",this.active=!0,this.tabIndex=-1,this.data=null,this.renderFlags=15,this.cameraFilter=0,this.input=null,this.body=null,this.ignoreDestroy=!1,this.systems=t.sys,this.events=t.sys.events,this.sortChildrenFlag=!1,this.addCallback=this.addChildCallback,this.removeCallback=this.removeChildCallback,this.initPipeline(),this.clearAlpha(),this.setBlendMode(n.SKIP_CHECK),e&&this.add(e),t.sys.queueDepthSort()},setActive:function(t){return this.active=t,this},setName:function(t){return this.name=t,this},setState:function(t){return this.state=t,this},setDataEnabled:function(){return this.data||(this.data=new a(this)),this},setData:function(t,e){return this.data||(this.data=new a(this)),this.data.set(t,e),this},incData:function(t,e){return this.data||(this.data=new a(this)),this.data.inc(t,e),this},toggleData:function(t){return this.data||(this.data=new a(this)),this.data.toggle(t),this},getData:function(t){return this.data||(this.data=new a(this)),this.data.get(t)},setInteractive:function(){return this},disableInteractive:function(){return this},removeInteractive:function(){return this},addedToScene:function(){},removedFromScene:function(){},update:function(){},toJSON:function(){return o(this)},willRender:function(t){return!(15!==this.renderFlags||0===this.list.length||0!==this.cameraFilter&&this.cameraFilter&t.id)},getIndexList:function(){for(var t=this,e=this.parentContainer,i=[];e&&(i.unshift(e.getIndex(t)),t=e,e.parentContainer);)e=e.parentContainer;return i.unshift(this.displayList.getIndex(t)),i},addChildCallback:function(t){t.displayList&&t.displayList!==this&&t.removeFromDisplayList(),t.displayList||(this.queueDepthSort(),t.displayList=this,t.emit(l.ADDED_TO_SCENE,t,this.scene),this.events.emit(d.ADDED_TO_SCENE,t,this.scene))},removeChildCallback:function(t){this.queueDepthSort(),t.displayList=null,t.emit(l.REMOVED_FROM_SCENE,t,this.scene),this.events.emit(d.REMOVED_FROM_SCENE,t,this.scene)},queueDepthSort:function(){this.sortChildrenFlag=!0},depthSort:function(){this.sortChildrenFlag&&(p(this.list,this.sortByDepth),this.sortChildrenFlag=!1)},sortByDepth:function(t,e){return t._depth-e._depth},getChildren:function(){return this.list},destroy:function(){if(this.scene&&!this.ignoreDestroy){this.emit(l.DESTROY,this);for(var t=this.list.length;t--;)this.list[t].destroy();this.removeAllListeners(),this.resetPostPipeline(!0),this.displayList&&(this.displayList.remove(this,!0),this.displayList.queueDepthSort()),this.data&&(this.data.destroy(),this.data=void 0),this.active=!1,this.visible=!1,this.list=void 0,this.scene=void 0,this.displayList=void 0,this.systems=void 0,this.events=void 0}}});t.exports=f},function(t,e,i){var n=i(0),r=i(11),s=i(15),o=i(450),a=i(110),h=i(452),l=i(1075),u=new n({Extends:s,Mixins:[r.Depth,r.Mask,r.Pipeline,r.Transform,r.Visible,l],initialize:function(t,e,i,n){if(s.call(this,t,"ParticleEmitterManager"),this.blendMode=-1,this.timeScale=1,this.texture=null,this.frame=null,this.frameNames=[],null===i||"object"!=typeof i&&!Array.isArray(i)||(n=i,i=null),this.setTexture(e,i),this.initPipeline(),this.emitters=new a(this),this.wells=new a(this),n){Array.isArray(n)||(n=[n]);for(var r=0;r0?e.defaultFrame=i[0]:e.defaultFrame=this.defaultFrame,this},addEmitter:function(t){return this.emitters.add(t)},createEmitter:function(t){return this.addEmitter(new h(this,t))},removeEmitter:function(t){return this.emitters.remove(t,!0)},addGravityWell:function(t){return this.wells.add(t)},createGravityWell:function(t){return this.addGravityWell(new o(t))},emitParticle:function(t,e,i){for(var n=this.emitters.list,r=0;rr.width&&(t=r.width-i.cutX),i.cutY+e>r.height&&(e=r.height-i.cutY),i.setSize(t,e,i.cutX,i.cutY)}this.updateDisplayOrigin();var s=this.input;return s&&!s.customHitArea&&(s.hitArea.width=t,s.hitArea.height=e),this},setGlobalTint:function(t){return this.globalTint=t,this},setGlobalAlpha:function(t){return this.globalAlpha=t,this},saveTexture:function(t){return this.textureManager.renameTexture(this.texture.key,t),this._saved=!0,this.texture},fill:function(t,e,i,n,r,s){var o=this.frame,a=this.camera,h=this.renderer;void 0===e&&(e=1),void 0===i&&(i=0),void 0===n&&(n=0),void 0===r&&(r=o.cutWidth),void 0===s&&(s=o.cutHeight);var l=(t>>16&255)/255,u=(t>>8&255)/255,c=(255&t)/255,d=this.renderTarget;if(a.preRender(),d){d.bind(!0);var p=this.pipeline;p.manager.set(p);var f=d.width,g=d.height,v=h.width/f,y=h.height/g;p.drawFillRect(i*v,n*y,r*v,s*y,m.getTintFromFloats(c,u,l,1),e),d.unbind(!0)}else{var x=this.context;h.setContext(x),x.fillStyle="rgba("+l+","+u+","+c+","+e+")",x.fillRect(i+o.cutX,n+o.cutY,r,s),h.setContext()}return this.dirty=!0,this},clear:function(){if(this.dirty){var t=this.renderTarget;if(t)t.clear();else{var e=this.context;e.save(),e.setTransform(1,0,0,1,0,0),e.clearRect(this.frame.cutX,this.frame.cutY,this.frame.cutWidth,this.frame.cutHeight),e.restore()}this.dirty=!1}return this},erase:function(t,e,i){return this._eraseMode=!0,this.draw(t,e,i,1,16777215),this._eraseMode=!1,this},draw:function(t,e,i,n,r){return this.beginDraw(),this.batchDraw(t,e,i,n,r),this.endDraw(),this},drawFrame:function(t,e,i,n,r,s){return this.beginDraw(),this.batchDrawFrame(t,e,i,n,r,s),this.endDraw(),this},beginDraw:function(){var t=this.camera,e=this.renderer,i=this.renderTarget;return t.preRender(),i?e.beginCapture(i.width,i.height):e.setContext(this.context),this},batchDraw:function(t,e,i,n,r){return void 0===n&&(n=this.globalAlpha),r=void 0===r?(this.globalTint>>16)+(65280&this.globalTint)+((255&this.globalTint)<<16):(r>>16)+(65280&r)+((255&r)<<16),Array.isArray(t)||(t=[t]),this.batchList(t,e,i,n,r),this},batchDrawFrame:function(t,e,i,n,r,s){void 0===i&&(i=0),void 0===n&&(n=0),void 0===r&&(r=this.globalAlpha),s=void 0===s?(this.globalTint>>16)+(65280&this.globalTint)+((255&this.globalTint)<<16):(s>>16)+(65280&s)+((255&s)<<16);var o=this.textureManager.getFrame(t,e);return o&&(this.renderTarget?this.pipeline.batchTextureFrame(o,i,n,s,r,this.camera.matrix,null):this.batchTextureFrame(o,i+this.frame.cutX,n+this.frame.cutY,r,s)),this},endDraw:function(t){void 0===t&&(t=this._eraseMode);var e=this.renderer,i=this.renderTarget;if(i){var n=e.endCapture();e.pipelines.setUtility().blitFrame(n,i,1,!1,!1,t),e.resetScissor(),e.resetViewport()}else e.setContext();return this.dirty=!0,this},batchList:function(t,e,i,n,r){for(var s=0;ss&&(o=t[s]),r[s]=o,t.length>s+1&&(o=t[s+1]),r[s+1]=o}return this},setColors:function(t){var e=this.points.length;if(e<1)return this;var i,n=this.colors;void 0===t?t=[16777215]:Array.isArray(t)||(t=[t]);var r=0;if(t.length===e)for(i=0;ir&&(s=t[r]),n[r]=s,t.length>r+1&&(s=t[r+1]),n[r+1]=s}return this},setPoints:function(t,e,i){if(void 0===t&&(t=2),"number"==typeof t){var n,r,s,o=t;if(o<2&&(o=2),t=[],this.horizontal)for(s=-this.frame.halfWidth,r=this.frame.width/(o-1),n=0;nl){if(0===c){for(var m=p;m.length&&(m=m.slice(0,-1),!((f=e.measureText(m).width)<=l)););if(!m.length)throw new Error("This text's wordWrapWidth setting is less than a single character!");var g=d.substr(m.length);u[c]=g,h+=m}var v=u[c].length?c:c+1,y=u.slice(v).join(" ").replace(/[ \n]*$/gi,"");r[o+1]=y+" "+(r[o+1]||""),s=r.length;break}h+=p,l-=f}n+=h.replace(/[ \n]*$/gi,"")+"\n"}}return n=n.replace(/[\s|\n]*$/gi,"")},basicWordWrap:function(t,e,i){for(var n="",r=t.split(this.splitRegExp),s=r.length-1,o=e.measureText(" ").width,a=0;a<=s;a++){for(var h=i,l=r[a].split(" "),u=l.length-1,c=0;c<=u;c++){var d=l[c],p=e.measureText(d).width,f=p;ch&&c>0&&(n+="\n",h=i),n+=d,c0&&(d+=h.lineSpacing*m),i.rtl)c=p-c;else if("right"===i.align)c+=o-h.lineWidths[m];else if("center"===i.align)c+=(o-h.lineWidths[m])/2;else if("justify"===i.align&&h.lineWidths[m]/h.width>=.85){var g=h.width-h.lineWidths[m],v=e.measureText(" ").width,y=a[m].trim(),x=y.split(" ");g+=(a[m].length-y.length)*v;for(var w=Math.floor(g/v),b=0;w>0;)x[b]+=" ",b=(b+1)%(x.length-1||1),--w;a[m]=x.join(" ")}this.autoRound&&(c=Math.round(c),d=Math.round(d)),i.strokeThickness&&(this.style.syncShadow(e,i.shadowStroke),e.strokeText(a[m],c,d)),i.color&&(this.style.syncShadow(e,i.shadowFill),e.fillText(a[m],c,d))}e.restore(),this.renderer&&this.renderer.gl&&(this.frame.source.glTexture=this.renderer.canvasToTexture(t,this.frame.source.glTexture,!0),this.frame.glTexture=this.frame.source.glTexture),this.dirty=!0;var A=this.input;return A&&!A.customHitArea&&(A.hitArea.width=this.width,A.hitArea.height=this.height),this},getTextMetrics:function(){return this.style.getTextMetrics()},text:{get:function(){return this._text},set:function(t){this.setText(t)}},toJSON:function(){var t=o.ToJSON(this),e={autoRound:this.autoRound,text:this._text,style:this.style.toJSON(),padding:{left:this.padding.left,right:this.padding.right,top:this.padding.top,bottom:this.padding.bottom}};return t.data=e,t},preDestroy:function(){this.style.rtl&&c(this.canvas),r.remove(this.canvas),this.texture.destroy()}});t.exports=f},function(t,e,i){var n=i(31),r=i(0),s=i(11),o=i(22),a=i(15),h=i(361),l=i(192),u=i(1091),c=i(3),d=new r({Extends:a,Mixins:[s.Alpha,s.BlendMode,s.ComputedSize,s.Crop,s.Depth,s.Flip,s.GetBounds,s.Mask,s.Origin,s.Pipeline,s.ScrollFactor,s.Tint,s.Transform,s.Visible,u],initialize:function(t,e,i,r,s,l,u){var d=t.sys.renderer;a.call(this,t,"TileSprite");var p=t.sys.textures.get(l),f=p.get(u);r&&s?(r=Math.floor(r),s=Math.floor(s)):(r=f.width,s=f.height),this._tilePosition=new c,this._tileScale=new c(1,1),this.dirty=!1,this.renderer=d,this.canvas=n.create(this,r,s),this.context=this.canvas.getContext("2d"),this.displayTexture=p,this.displayFrame=f,this._crop=this.resetCropObject(),this.texture=t.sys.textures.addCanvas(null,this.canvas,!0),this.frame=this.texture.get(),this.potWidth=h(f.width),this.potHeight=h(f.height),this.fillCanvas=n.create2D(this,this.potWidth,this.potHeight),this.fillContext=this.fillCanvas.getContext("2d"),this.fillPattern=null,this.setPosition(e,i),this.setSize(r,s),this.setFrame(u),this.setOriginFromFrame(),this.initPipeline(),t.sys.game.events.on(o.CONTEXT_RESTORED,(function(t){if(t){var e=t.gl;this.dirty=!0,this.fillPattern=null,this.fillPattern=t.createTexture2D(0,e.LINEAR,e.LINEAR,e.REPEAT,e.REPEAT,e.RGBA,this.fillCanvas,this.potWidth,this.potHeight)}}),this)},setTexture:function(t,e){return this.displayTexture=this.scene.sys.textures.get(t),this.setFrame(e)},setFrame:function(t){var e=this.displayTexture.get(t);return this.potWidth=h(e.width),this.potHeight=h(e.height),this.canvas.width=0,e.cutWidth&&e.cutHeight?this.renderFlags|=8:this.renderFlags&=-9,this.displayFrame=e,this.dirty=!0,this.updateTileTexture(),this},setTilePosition:function(t,e){return void 0!==t&&(this.tilePositionX=t),void 0!==e&&(this.tilePositionY=e),this},setTileScale:function(t,e){return void 0===t&&(t=this.tileScaleX),void 0===e&&(e=t),this.tileScaleX=t,this.tileScaleY=e,this},updateTileTexture:function(){if(this.dirty&&this.renderer){var t=this.displayFrame;if(t.source.isRenderTexture||t.source.isGLTexture)this.dirty=!1;else{var e=this.fillContext,i=this.fillCanvas,n=this.potWidth,r=this.potHeight;this.renderer&&this.renderer.gl||(n=t.cutWidth,r=t.cutHeight),e.clearRect(0,0,n,r),i.width=n,i.height=r,e.drawImage(t.source.image,t.cutX,t.cutY,t.cutWidth,t.cutHeight,0,0,n,r),this.renderer&&this.renderer.gl?this.fillPattern=this.renderer.canvasToTexture(i,this.fillPattern):this.fillPattern=e.createPattern(i,"repeat"),this.updateCanvas(),this.dirty=!1}}},updateCanvas:function(){var t=this.canvas;if(t.width===this.width&&t.height===this.height||(t.width=this.width,t.height=this.height,this.frame.setSize(this.width,this.height),this.updateDisplayOrigin(),this.dirty=!0),!this.dirty||this.renderer&&this.renderer.gl)this.dirty=!1;else{var e=this.context;this.scene.sys.game.config.antialias||l.disable(e);var i=this._tileScale.x,n=this._tileScale.y,r=this._tilePosition.x,s=this._tilePosition.y;e.clearRect(0,0,this.width,this.height),e.save(),e.scale(i,n),e.translate(-r,-s),e.fillStyle=this.fillPattern,e.fillRect(r,s,this.width/i,this.height/n),e.restore(),this.dirty=!1}},preDestroy:function(){this.renderer&&this.renderer.gl&&this.renderer.deleteTexture(this.fillPattern),n.remove(this.canvas),n.remove(this.fillCanvas),this.fillPattern=null,this.fillContext=null,this.fillCanvas=null,this.displayTexture=null,this.displayFrame=null,this.texture.destroy(),this.renderer=null},tilePositionX:{get:function(){return this._tilePosition.x},set:function(t){this._tilePosition.x=t,this.dirty=!0}},tilePositionY:{get:function(){return this._tilePosition.y},set:function(t){this._tilePosition.y=t,this.dirty=!0}},tileScaleX:{get:function(){return this._tileScale.x},set:function(t){this._tileScale.x=t,this.dirty=!0}},tileScaleY:{get:function(){return this._tileScale.y},set:function(t){this._tileScale.y=t,this.dirty=!0}}});t.exports=d},function(t,e,i){var n=i(0),r=i(18),s=i(11),o=i(75),a=i(22),h=i(51),l=i(15),u=i(70),c=i(222),d=i(1094),p=i(14),f=new n({Extends:l,Mixins:[s.Alpha,s.BlendMode,s.Depth,s.Flip,s.GetBounds,s.Mask,s.Origin,s.Pipeline,s.ScrollFactor,s.Size,s.TextureCrop,s.Tint,s.Transform,s.Visible,d],initialize:function(t,e,i,n){l.call(this,t,"Video"),this.video=null,this.videoTexture=null,this.videoTextureSource=null,this.snapshotTexture=null,this.flipY=!1,this._key=c(),this.touchLocked=!0,this.playWhenUnlocked=!1,this.retryLimit=20,this.retry=0,this.retryInterval=500,this._retryID=null,this._systemMuted=!1,this._codeMuted=!1,this._systemPaused=!1,this._codePaused=!1,this._callbacks={play:this.playHandler.bind(this),error:this.loadErrorHandler.bind(this),end:this.completeHandler.bind(this),time:this.timeUpdateHandler.bind(this),seeking:this.seekingHandler.bind(this),seeked:this.seekedHandler.bind(this)},this._crop=this.resetCropObject(),this.markers={},this._markerIn=-1,this._markerOut=p.MAX_SAFE_INTEGER,this._lastUpdate=0,this._cacheKey="",this._isSeeking=!1,this.removeVideoElementOnDestroy=!1,this.setPosition(e,i),this.initPipeline(),n&&this.changeSource(n,!1);var r=t.sys.game.events;r.on(a.PAUSE,this.globalPause,this),r.on(a.RESUME,this.globalResume,this);var s=t.sys.sound;s&&s.on(u.GLOBAL_MUTE,this.globalMute,this)},addedToScene:function(){this.scene.sys.updateList.add(this)},removedFromScene:function(){this.scene.sys.updateList.remove(this)},play:function(t,e,i){if(this.touchLocked&&this.playWhenUnlocked||this.isPlaying())return this;var n=this.video;if(!n)return this;void 0===t&&(t=n.loop);var r=this.scene.sys.sound;r&&r.mute&&this.setMute(!0),isNaN(e)||(this._markerIn=e),!isNaN(i)&&i>e&&(this._markerOut=i),n.loop=t;var s=this._callbacks,o=n.play();return void 0!==o?o.then(this.playPromiseSuccessHandler.bind(this)).catch(this.playPromiseErrorHandler.bind(this)):(n.addEventListener("playing",s.play,!0),n.readyState<2&&(this.retry=this.retryLimit,this._retryID=window.setTimeout(this.checkVideoProgress.bind(this),this.retryInterval))),n.addEventListener("ended",s.end,!0),n.addEventListener("timeupdate",s.time,!0),n.addEventListener("seeking",s.seeking,!0),n.addEventListener("seeked",s.seeked,!0),this},changeSource:function(t,e,i,n,r){void 0===e&&(e=!0),this.video&&this.stop();var s=this.scene.sys.cache.video.get(t);return s?(this.video=s,this._cacheKey=t,this._codePaused=s.paused,this._codeMuted=s.muted,this.videoTexture?(this.scene.sys.textures.remove(this._key),this.videoTexture=this.scene.sys.textures.create(this._key,s,s.videoWidth,s.videoHeight),this.videoTextureSource=this.videoTexture.source[0],this.videoTexture.add("__BASE",0,0,0,s.videoWidth,s.videoHeight),this.setTexture(this.videoTexture),this.setSizeToFrame(),this.updateDisplayOrigin(),this.emit(o.VIDEO_CREATED,this,s.videoWidth,s.videoHeight)):this.updateTexture(),s.currentTime=0,this._lastUpdate=0,e&&this.play(i,n,r)):this.video=null,this},addMarker:function(t,e,i){return!isNaN(e)&&e>=0&&!isNaN(i)&&(this.markers[t]=[e,i]),this},playMarker:function(t,e){var i=this.markers[t];return i&&this.play(e,i[0],i[1]),this},removeMarker:function(t){return delete this.markers[t],this},snapshot:function(t,e){return void 0===t&&(t=this.width),void 0===e&&(e=this.height),this.snapshotArea(0,0,this.width,this.height,t,e)},snapshotArea:function(t,e,i,n,r,s){void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i=this.width),void 0===n&&(n=this.height),void 0===r&&(r=i),void 0===s&&(s=n);var o=this.video,a=this.snapshotTexture;return a?(a.setSize(r,s),o&&a.context.drawImage(o,t,e,i,n,0,0,r,s)):(a=this.scene.sys.textures.createCanvas(c(),r,s),this.snapshotTexture=a,o&&a.context.drawImage(o,t,e,i,n,0,0,r,s)),a.update()},saveSnapshotTexture:function(t){return this.snapshotTexture?this.scene.sys.textures.renameTexture(this.snapshotTexture.key,t):this.snapshotTexture=this.scene.sys.textures.createCanvas(t,this.width,this.height),this.snapshotTexture},loadURL:function(t,e,i){void 0===e&&(e="loadeddata"),void 0===i&&(i=!1),this.video&&this.stop(),this.videoTexture&&this.scene.sys.textures.remove(this._key);var n=document.createElement("video");return n.controls=!1,i&&(n.muted=!0,n.defaultMuted=!0,n.setAttribute("autoplay","autoplay")),n.setAttribute("playsinline","playsinline"),n.setAttribute("preload","auto"),n.addEventListener("error",this._callbacks.error,!0),n.src=t,n.load(),this.video=n,this},loadMediaStream:function(t,e,i){void 0===e&&(e="loadeddata"),void 0===i&&(i=!1),this.video&&this.stop(),this.videoTexture&&this.scene.sys.textures.remove(this._key);var n=document.createElement("video");n.controls=!1,i&&(n.muted=!0,n.defaultMuted=!0,n.setAttribute("autoplay","autoplay")),n.setAttribute("playsinline","playsinline"),n.setAttribute("preload","auto"),n.addEventListener("error",this._callbacks.error,!0);try{n.srcObject=t}catch(e){n.src=window.URL.createObjectURL(t)}return n.load(),this.video=n,this},playPromiseSuccessHandler:function(){this._codePaused=!1,this.touchLocked=!1,this.emit(o.VIDEO_PLAY,this),this._markerIn>-1&&(this.video.currentTime=this._markerIn)},playPromiseErrorHandler:function(t){this.scene.sys.input.once(h.POINTER_DOWN,this.unlockHandler,this),this.touchLocked=!0,this.playWhenUnlocked=!0,this.emit(o.VIDEO_ERROR,this,t)},playHandler:function(){this._codePaused=!1,this.touchLocked=!1,this.emit(o.VIDEO_PLAY,this),this.video.removeEventListener("playing",this._callbacks.play,!0)},loadErrorHandler:function(t){this.stop(),this.emit(o.VIDEO_ERROR,this,t)},unlockHandler:function(){this.touchLocked=!1,this.playWhenUnlocked=!1,this.emit(o.VIDEO_UNLOCKED,this),this._markerIn>-1&&(this.video.currentTime=this._markerIn),this.video.play(),this.emit(o.VIDEO_PLAY,this)},completeHandler:function(){this.emit(o.VIDEO_COMPLETE,this)},timeUpdateHandler:function(){this.video&&this.video.currentTime=this._markerOut&&(t.loop?(t.currentTime=this._markerIn,this.updateTexture(),this._lastUpdate=e,this.emit(o.VIDEO_LOOP,this)):(this.emit(o.VIDEO_COMPLETE,this),this.stop())))}},checkVideoProgress:function(){this.video.readyState>=2?this.updateTexture():(this.retry--,this.retry>0?this._retryID=window.setTimeout(this.checkVideoProgress.bind(this),this.retryInterval):this.emit(o.VIDEO_TIMEOUT,this))},updateTexture:function(){var t=this.video,e=t.videoWidth,i=t.videoHeight;if(this.videoTexture){var n=this.videoTextureSource;n.source!==t&&(n.source=t,n.width=e,n.height=i),n.update()}else this.videoTexture=this.scene.sys.textures.create(this._key,t,e,i),this.videoTextureSource=this.videoTexture.source[0],this.videoTexture.add("__BASE",0,0,0,e,i),this.setTexture(this.videoTexture),this.setSizeToFrame(),this.updateDisplayOrigin(),this.emit(o.VIDEO_CREATED,this,e,i)},getVideoKey:function(){return this._cacheKey},seekTo:function(t){var e=this.video;if(e){var i=e.duration;if(i!==1/0&&!isNaN(i)){var n=i*t;this.setCurrentTime(n)}}return this},getCurrentTime:function(){return this.video?this.video.currentTime:0},setCurrentTime:function(t){var e=this.video;if(e){if("string"==typeof t){var i=t[0],n=parseFloat(t.substr(1));"+"===i?t=e.currentTime+n:"-"===i&&(t=e.currentTime-n)}e.currentTime=t,this._lastUpdate=t}return this},isSeeking:function(){return this._isSeeking},seekingHandler:function(){this._isSeeking=!0,this.emit(o.VIDEO_SEEKING,this)},seekedHandler:function(){this._isSeeking=!1,this.emit(o.VIDEO_SEEKED,this),this.video&&this.updateTexture()},getProgress:function(){var t=this.video;if(t){var e=t.currentTime,i=t.duration;if(i!==1/0&&!isNaN(i))return e/i}return 0},getDuration:function(){return this.video?this.video.duration:0},setMute:function(t){void 0===t&&(t=!0),this._codeMuted=t;var e=this.video;return e&&(e.muted=!!this._systemMuted||t),this},isMuted:function(){return this._codeMuted},globalMute:function(t,e){this._systemMuted=e;var i=this.video;i&&(i.muted=!!this._codeMuted||e)},globalPause:function(){this._systemPaused=!0,this.video&&this.video.pause()},globalResume:function(){this._systemPaused=!1,this.video&&!this._codePaused&&this.video.play()},setPaused:function(t){void 0===t&&(t=!0);var e=this.video;return this._codePaused=t,e&&(t?e.paused||e.pause():t||e.paused&&!this._systemPaused&&e.play()),this},getVolume:function(){return this.video?this.video.volume:1},setVolume:function(t){return void 0===t&&(t=1),this.video&&(this.video.volume=r(t,0,1)),this},getPlaybackRate:function(){return this.video?this.video.playbackRate:1},setPlaybackRate:function(t){return this.video&&(this.video.playbackRate=t),this},getLoop:function(){return!!this.video&&this.video.loop},setLoop:function(t){return void 0===t&&(t=!0),this.video&&(this.video.loop=t),this},isPlaying:function(){return!!this.video&&!(this.video.paused||this.video.ended)},isPaused:function(){return this.video&&this.video.paused||this._codePaused||this._systemPaused},saveTexture:function(t,e){return void 0===e&&(e=!1),this.videoTexture&&this.scene.sys.textures.renameTexture(this._key,t),this._key=t,this.flipY=e,this.videoTextureSource&&this.videoTextureSource.setFlipY(e),this.videoTexture},stop:function(){var t=this.video;if(t){var e=this._callbacks;for(var i in e)t.removeEventListener(i,e[i],!0);t.pause()}return this._retryID&&window.clearTimeout(this._retryID),this.emit(o.VIDEO_STOP,this),this},removeVideoElement:function(){var t=this.video;if(t){for(t.parentNode&&t.parentNode.removeChild(t);t.hasChildNodes();)t.removeChild(t.firstChild);t.removeAttribute("autoplay"),t.removeAttribute("src"),this.video=null}},preDestroy:function(){this.stop(),this.removeVideoElementOnDestroy&&this.removeVideoElement();var t=this.scene.sys.game.events;t.off(a.PAUSE,this.globalPause,this),t.off(a.RESUME,this.globalResume,this);var e=this.scene.sys.sound;e&&e.off(u.GLOBAL_MUTE,this.globalMute,this),this._retryID&&window.clearTimeout(this._retryID)}});t.exports=f},function(t,e,i){var n=i(0),r=i(228),s=i(470),o=i(56),a=new n({initialize:function(t){this.type=o.POLYGON,this.area=0,this.points=[],t&&this.setTo(t)},contains:function(t,e){return r(this,t,e)},setTo:function(t){if(this.area=0,this.points=[],"string"==typeof t&&(t=t.split(" ")),!Array.isArray(t))return this;for(var e,i=Number.MAX_VALUE,n=0;n=0&&b<=1&&i.push(new n(s,o))}else if(w>0){var A=(-x-Math.sqrt(w))/(2*y);s=a+A*f,o=h+A*m,A>=0&&A<=1&&i.push(new n(s,o));var T=(-x+Math.sqrt(w))/(2*y);s=a+T*f,o=h+T*m,T>=0&&T<=1&&i.push(new n(s,o))}}return i}},function(t,e,i){var n=i(66),r=new(i(4));t.exports=function(t,e,i){if(void 0===i&&(i=r),n(e,t.x1,t.y1))return i.x=t.x1,i.y=t.y1,!0;if(n(e,t.x2,t.y2))return i.x=t.x2,i.y=t.y2,!0;var s=t.x2-t.x1,o=t.y2-t.y1,a=e.x-t.x1,h=e.y-t.y1,l=s*s+o*o,u=s,c=o;if(l>0){var d=(a*s+h*o)/l;u*=d,c*=d}return i.x=t.x1+u,i.y=t.y1+c,u*u+c*c<=l&&u*s+c*o>=0&&n(e,i.x,i.y)}},function(t,e,i){var n=i(4),r=i(96),s=i(488);t.exports=function(t,e,i){if(void 0===i&&(i=[]),s(t,e))for(var o=e.getLineA(),a=e.getLineB(),h=e.getLineC(),l=e.getLineD(),u=[new n,new n,new n,new n],c=[r(o,t,u[0]),r(a,t,u[1]),r(h,t,u[2]),r(l,t,u[3])],d=0;d<4;d++)c[d]&&i.push(u[d]);return i}},function(t,e){t.exports=function(t,e,i,n){void 0===i&&(i=!1),void 0===n&&(n=[]);for(var r,s,o,a,h,l,u=t.x3-t.x1,c=t.y3-t.y1,d=t.x2-t.x1,p=t.y2-t.y1,f=u*u+c*c,m=u*d+c*p,g=d*d+p*p,v=f*g-m*m,y=0===v?0:1/v,x=t.x1,w=t.y1,b=0;b=0&&s>=0&&r+s<1&&(n.push({x:e[b].x,y:e[b].y}),i)));b++);return n}},function(t,e){t.exports=function(t,e,i,n){var r=Math.cos(n),s=Math.sin(n),o=t.x1-e,a=t.y1-i;return t.x1=o*r-a*s+e,t.y1=o*s+a*r+i,o=t.x2-e,a=t.y2-i,t.x2=o*r-a*s+e,t.y2=o*s+a*r+i,t}},function(t,e){t.exports=function(t){return 0===t.height?NaN:t.width/t.height}},function(t,e){t.exports=function(t,e,i,n){var r=Math.cos(n),s=Math.sin(n),o=t.x1-e,a=t.y1-i;return t.x1=o*r-a*s+e,t.y1=o*s+a*r+i,o=t.x2-e,a=t.y2-i,t.x2=o*r-a*s+e,t.y2=o*s+a*r+i,o=t.x3-e,a=t.y3-i,t.x3=o*r-a*s+e,t.y3=o*s+a*r+i,t}},function(t,e,i){t.exports={BUTTON_DOWN:i(1310),BUTTON_UP:i(1311),CONNECTED:i(1312),DISCONNECTED:i(1313),GAMEPAD_BUTTON_DOWN:i(1314),GAMEPAD_BUTTON_UP:i(1315)}},function(t,e,i){var n=i(17),r=i(156);t.exports=function(t,e){var i=void 0===t?r():n({},t);if(e)for(var s in e)void 0!==e[s]&&(i[s]=e[s]);return i}},function(t,e,i){var n=i(0),r=i(21),s=i(23),o=i(8),a=i(2),h=i(7),l=i(408),u=new n({Extends:s,initialize:function(t,e,i,n){var r="xml";if(h(e)){var o=e;e=a(o,"key"),i=a(o,"url"),n=a(o,"xhrSettings"),r=a(o,"extension",r)}var l={type:"xml",cache:t.cacheManager.xml,extension:r,responseType:"text",key:e,url:i,xhrSettings:n};s.call(this,t,l)},onProcess:function(){this.state=r.FILE_PROCESSING,this.data=l(this.xhrLoader.responseText),this.data?this.onProcessComplete():this.onProcessError()}});o.register("xml",(function(t,e,i){if(Array.isArray(t))for(var n=0;ne._dx?(s=t.right-e.x)>o&&!i||!1===t.checkCollision.right||!1===e.checkCollision.left?s=0:(t.touching.none=!1,t.touching.right=!0,e.touching.none=!1,e.touching.left=!0,e.physicsType!==n.STATIC_BODY||i||(t.blocked.none=!1,t.blocked.right=!0),t.physicsType!==n.STATIC_BODY||i||(e.blocked.none=!1,e.blocked.left=!0)):t._dxo&&!i||!1===t.checkCollision.left||!1===e.checkCollision.right?s=0:(t.touching.none=!1,t.touching.left=!0,e.touching.none=!1,e.touching.right=!0,e.physicsType!==n.STATIC_BODY||i||(t.blocked.none=!1,t.blocked.left=!0),t.physicsType!==n.STATIC_BODY||i||(e.blocked.none=!1,e.blocked.right=!0))),t.overlapX=s,e.overlapX=s,s}},function(t,e,i){var n=i(62);t.exports=function(t,e,i,r){var s=0,o=t.deltaAbsY()+e.deltaAbsY()+r;return 0===t._dy&&0===e._dy?(t.embedded=!0,e.embedded=!0):t._dy>e._dy?(s=t.bottom-e.y)>o&&!i||!1===t.checkCollision.down||!1===e.checkCollision.up?s=0:(t.touching.none=!1,t.touching.down=!0,e.touching.none=!1,e.touching.up=!0,e.physicsType!==n.STATIC_BODY||i||(t.blocked.none=!1,t.blocked.down=!0),t.physicsType!==n.STATIC_BODY||i||(e.blocked.none=!1,e.blocked.up=!0)):t._dyo&&!i||!1===t.checkCollision.up||!1===e.checkCollision.down?s=0:(t.touching.none=!1,t.touching.up=!0,e.touching.none=!1,e.touching.down=!0,e.physicsType!==n.STATIC_BODY||i||(t.blocked.none=!1,t.blocked.up=!0),t.physicsType!==n.STATIC_BODY||i||(e.blocked.none=!1,e.blocked.down=!0))),t.overlapY=s,e.overlapY=s,s}},function(t,e){t.exports=function(t,e){return!(e.right<=t.left||e.bottom<=t.top||e.position.x>=t.right||e.position.y>=t.bottom)}},function(t,e,i){t.exports={Bounce:i(1495),Collision:i(1496),Force:i(1497),Friction:i(1498),Gravity:i(1499),Mass:i(1500),Sensor:i(1501),SetBody:i(1502),Sleep:i(1503),Static:i(1520),Transform:i(1521),Velocity:i(1522)}},function(t,e){var i={};t.exports=i,i.create=function(t,e){var n=t.bodyA,r=t.bodyB,s={id:i.id(n,r),bodyA:n,bodyB:r,activeContacts:[],separation:0,isActive:!0,confirmedActive:!0,isSensor:n.isSensor||r.isSensor,timeCreated:e,timeUpdated:e,collision:null,inverseMass:0,friction:0,frictionStatic:0,restitution:0,slop:0};return i.update(s,t,e),s},i.update=function(t,e,n){if(t.collision=e,e.collided){var r=e.supports,s=t.activeContacts,o=e.parentA,a=e.parentB;t.inverseMass=o.inverseMass+a.inverseMass,t.friction=Math.min(o.friction,a.friction),t.frictionStatic=Math.max(o.frictionStatic,a.frictionStatic),t.restitution=Math.max(o.restitution,a.restitution),t.slop=Math.max(o.slop,a.slop);for(var h=0;h0&&(r.totalDuration+=r.t2*r.repeat),r.totalDuration>t&&(t=r.totalDuration),r.delay0?this.totalDuration=this.duration+this.completeDelay+(this.duration+this.loopDelay)*this.loopCounter:this.totalDuration=this.duration+this.completeDelay,this.startDelay=e},init:function(){if(this.paused&&!this.parentIsTimeline)return this.state=h.PENDING_ADD,this._pausedState=h.INIT,!1;for(var t=this.data,e=this.totalTargets,i=0;i0?(this.elapsed=0,this.progress=0,this.loopCounter--,this.resetTweenData(!0),this.loopDelay>0?(this.countdown=this.loopDelay,this.state=h.LOOP_DELAY):(this.state=h.ACTIVE,this.dispatchTweenEvent(s.TWEEN_LOOP,this.callbacks.onLoop))):this.completeDelay>0?(this.state=h.COMPLETE_DELAY,this.countdown=this.completeDelay):(this.state=h.PENDING_REMOVE,this.dispatchTweenEvent(s.TWEEN_COMPLETE,this.callbacks.onComplete))},pause:function(){return this.state===h.PAUSED||(this.paused=!0,this._pausedState=this.state,this.state=h.PAUSED),this},play:function(t){void 0===t&&(t=!1);var e=this.state;return e!==h.INIT||this.parentIsTimeline?e===h.ACTIVE||e===h.PENDING_ADD&&this._pausedState===h.PENDING_ADD?this:this.parentIsTimeline||e!==h.PENDING_REMOVE&&e!==h.REMOVED?(this.parentIsTimeline?(this.resetTweenData(t),0===this.calculatedOffset?this.state=h.ACTIVE:(this.countdown=this.calculatedOffset,this.state=h.OFFSET_DELAY)):this.paused?(this.paused=!1,this.makeActive()):(this.resetTweenData(t),this.state=h.ACTIVE,this.makeActive()),this):(this.seek(0),this.parent.makeActive(this),this):(this.resetTweenData(!1),this.state=h.ACTIVE,this)},resetTweenData:function(t){for(var e=this.data,i=this.totalData,n=this.totalTargets,r=0;r0&&(s.elapsed=s.delay,s.state=h.DELAY),s.getActiveValue&&(o[a]=s.getActiveValue(s.target,s.key,s.start))}},resume:function(){return this.state===h.PAUSED?(this.paused=!1,this.state=this._pausedState):this.play(),this},seek:function(t,e){void 0===e&&(e=16.6),this.state===h.REMOVED&&this.makeActive(),this.elapsed=0,this.progress=0,this.totalElapsed=0,this.totalProgress=0;for(var i=this.data,n=this.totalTargets,r=0;r0&&(s.elapsed=s.delay,s.state=h.DELAY)}this.calcDuration();var c=!1;this.state===h.PAUSED&&(c=!0,this.state=h.ACTIVE),this.isSeeking=!0;do{this.update(0,e)}while(this.totalProgress0?(e.repeatCounter--,e.elapsed=i,e.progress=i/e.duration,e.flipX&&e.target.toggleFlipX(),e.flipY&&e.target.toggleFlipY(),e.start=e.getStartValue(e.target,e.key,e.start,e.index,t.totalTargets,t),e.end=e.getEndValue(e.target,e.key,e.start,e.index,t.totalTargets,t),e.repeatDelay>0?(e.elapsed=e.repeatDelay-i,e.current=e.start,e.target[e.key]=e.current,h.REPEAT_DELAY):(this.dispatchTweenDataEvent(s.TWEEN_REPEAT,t.callbacks.onRepeat,e),h.PLAYING_FORWARD)):h.COMPLETE},setStateFromStart:function(t,e,i){return e.repeatCounter>0?(e.repeatCounter--,e.elapsed=i,e.progress=i/e.duration,e.flipX&&e.target.toggleFlipX(),e.flipY&&e.target.toggleFlipY(),e.end=e.getEndValue(e.target,e.key,e.start,e.index,t.totalTargets,t),e.repeatDelay>0?(e.elapsed=e.repeatDelay-i,e.current=e.start,e.target[e.key]=e.current,h.REPEAT_DELAY):(this.dispatchTweenDataEvent(s.TWEEN_REPEAT,t.callbacks.onRepeat,e),h.PLAYING_FORWARD)):h.COMPLETE},updateTweenData:function(t,e,i){var n=e.target;switch(e.state){case h.PLAYING_FORWARD:case h.PLAYING_BACKWARD:if(!n){e.state=h.COMPLETE;break}var r=e.elapsed,o=e.duration,a=0;(r+=i)>o&&(a=r-o,r=o);var l=e.state===h.PLAYING_FORWARD,u=r/o;if(e.elapsed=r,e.progress=u,e.previous=e.current,1===u)l?(e.current=e.end,n[e.key]=e.end,e.hold>0?(e.elapsed=e.hold-a,e.state=h.HOLD_DELAY):e.state=this.setStateFromEnd(t,e,a)):(e.current=e.start,n[e.key]=e.start,e.state=this.setStateFromStart(t,e,a));else{var c=l?e.ease(u):e.ease(1-u);e.current=e.start+(e.end-e.start)*c,n[e.key]=e.current}this.dispatchTweenDataEvent(s.TWEEN_UPDATE,t.callbacks.onUpdate,e);break;case h.DELAY:e.elapsed-=i,e.elapsed<=0&&(e.elapsed=Math.abs(e.elapsed),e.state=h.PENDING_RENDER);break;case h.REPEAT_DELAY:e.elapsed-=i,e.elapsed<=0&&(e.elapsed=Math.abs(e.elapsed),e.state=h.PLAYING_FORWARD,this.dispatchTweenDataEvent(s.TWEEN_REPEAT,t.callbacks.onRepeat,e));break;case h.HOLD_DELAY:e.elapsed-=i,e.elapsed<=0&&(e.state=this.setStateFromEnd(t,e,Math.abs(e.elapsed)));break;case h.PENDING_RENDER:n?(e.start=e.getStartValue(n,e.key,n[e.key],e.index,t.totalTargets,t),e.end=e.getEndValue(n,e.key,e.start,e.index,t.totalTargets,t),e.current=e.start,n[e.key]=e.start,e.state=h.PLAYING_FORWARD):e.state=h.COMPLETE}return e.state!==h.COMPLETE}});u.TYPES=["onActive","onComplete","onLoop","onRepeat","onStart","onStop","onUpdate","onYoyo"],a.register("tween",(function(t){return this.scene.sys.tweens.add(t)})),o.register("tween",(function(t){return this.scene.sys.tweens.create(t)})),t.exports=u},function(t,e,i){t.exports={TIMELINE_COMPLETE:i(1466),TIMELINE_LOOP:i(1467),TIMELINE_PAUSE:i(1468),TIMELINE_RESUME:i(1469),TIMELINE_START:i(1470),TIMELINE_UPDATE:i(1471),TWEEN_ACTIVE:i(1472),TWEEN_COMPLETE:i(1473),TWEEN_LOOP:i(1474),TWEEN_REPEAT:i(1475),TWEEN_START:i(1476),TWEEN_STOP:i(1477),TWEEN_UPDATE:i(1478),TWEEN_YOYO:i(1479)}},function(t,e){t.exports=function(t,e,i,n,r,s,o,a,h,l,u,c,d,p,f){return{target:t,index:e,key:i,getActiveValue:s,getEndValue:n,getStartValue:r,ease:o,duration:0,totalDuration:0,delay:0,yoyo:l,hold:0,repeat:0,repeatDelay:0,flipX:p,flipY:f,progress:0,elapsed:0,repeatCounter:0,start:0,previous:0,current:0,end:0,t1:0,t2:0,gen:{delay:a,duration:h,hold:u,repeat:c,repeatDelay:d},state:0}}},function(t,e,i){var n=i(68);t.exports=function(t){return n(t,-Math.PI,Math.PI)}},function(t,e,i){var n=i(68);t.exports=function(t){return n(t,-180,180)}},function(t,e,i){var n={};t.exports=n;var r=i(83),s=i(32);n.fromVertices=function(t){for(var e={},i=0;i1?1:0;d1?1:0;f0:0!=(t.mask&e.category)&&0!=(e.mask&t.category)}},function(t,e,i){var n={};t.exports=n;var r=i(64),s=i(83);n.collides=function(t,e,i){var o,a,h,l,u=!1;if(i){var c=t.parent,d=e.parent,p=c.speed*c.speed+c.angularSpeed*c.angularSpeed+d.speed*d.speed+d.angularSpeed*d.angularSpeed;u=i&&i.collided&&p<.2,l=i}else l={collided:!1,bodyA:t,bodyB:e};if(i&&u){var f=l.axisBody,m=f===t?e:t,g=[f.axes[i.axisNumber]];if(h=n._overlapAxes(f.vertices,m.vertices,g),l.reused=!0,h.overlap<=0)return l.collided=!1,l}else{if((o=n._overlapAxes(t.vertices,e.vertices,t.axes)).overlap<=0)return l.collided=!1,l;if((a=n._overlapAxes(e.vertices,t.vertices,e.axes)).overlap<=0)return l.collided=!1,l;o.overlapr?r=a:a=0?o.index-1:u.length-1],l.x=r.x-c.x,l.y=r.y-c.y,h=-s.dot(i,l),a=r,r=u[(o.index+1)%u.length],l.x=r.x-c.x,l.y=r.y-c.y,(n=-s.dot(i,l))0&&(e=n(t)/i);for(var h=0;h=-1&&(this._blendMode=t)}},setBlendMode:function(t){return this.blendMode=t,this}};t.exports=r},function(t,e){var i={_depth:0,depth:{get:function(){return this._depth},set:function(t){this.displayList&&this.displayList.queueDepthSort(),this._depth=t}},setDepth:function(t){return void 0===t&&(t=0),this.depth=t,this}};t.exports=i},function(t,e,i){var n=i(171),r=i(130);t.exports=function(t,e,i,s){void 0===s&&(s=[]),!e&&i>0&&(e=r(t)/i);for(var o=0;o=t.right&&(h=1,a+=o-t.right,o=t.right);break;case 1:(a+=e)>=t.bottom&&(h=2,o-=a-t.bottom,a=t.bottom);break;case 2:(o-=e)<=t.left&&(h=3,a-=t.left-o,o=t.left);break;case 3:(a-=e)<=t.top&&(h=0,a=t.top)}return s}},function(t,e){t.exports=function(t,e,i){void 0===e&&(e=1),void 0===i&&(i=[]);var n=Math.round(t.x1),r=Math.round(t.y1),s=Math.round(t.x2),o=Math.round(t.y2),a=Math.abs(s-n),h=Math.abs(o-r),l=n-h&&(c-=h,n+=l),pe.length&&(s=e.length),i?(n=e[s-1][i],(r=e[s][i])-t<=t-n?e[s]:e[s-1]):(n=e[s-1],(r=e[s])-t<=t-n?r:n)}},function(t,e,i){var n=new(i(0))({initialize:function(t,e,i,n,r){void 0===r&&(r=!1),this.textureKey=t,this.textureFrame=e,this.index=i,this.frame=n,this.isFirst=!1,this.isLast=!1,this.prevFrame=null,this.nextFrame=null,this.duration=0,this.progress=0,this.isKeyFrame=r},toJSON:function(){return{key:this.textureKey,frame:this.textureFrame,duration:this.duration,keyframe:this.isKeyFrame}},destroy:function(){this.frame=void 0}});t.exports=n},function(t,e){t.exports=function(t){var e=/\D/g;return t.sort((function(t,i){return parseInt(t.replace(e,""),10)-parseInt(i.replace(e,""),10)})),t}},function(t,e,i){var n=i(185),r=i(0),s=i(102),o=i(9),a=i(132),h=i(22),l=i(2),u=i(6),c=i(186),d=i(322),p=new r({Extends:o,initialize:function(t){o.call(this),this.game=t,this.textureManager=null,this.globalTimeScale=1,this.anims=new s,this.mixes=new s,this.paused=!1,this.name="AnimationManager",t.events.once(h.BOOT,this.boot,this)},boot:function(){this.textureManager=this.game.textures,this.game.events.once(h.DESTROY,this.destroy,this)},addMix:function(t,e,i){var n=this.anims,r=this.mixes,s="string"==typeof t?t:t.key,o="string"==typeof e?e:e.key;if(n.has(s)&&n.has(o)){var a=r.get(s);a||(a={}),a[o]=i,r.set(s,a)}return this},removeMix:function(t,e){var i=this.mixes,n="string"==typeof t?t:t.key,r=i.get(n);if(r)if(e){var s="string"==typeof e?e:e.key;r.hasOwnProperty(s)&&delete r[s]}else e||i.delete(n);return this},getMix:function(t,e){var i=this.mixes,n="string"==typeof t?t:t.key,r="string"==typeof e?e:e.key,s=i.get(n);return s&&s.hasOwnProperty(r)?s[r]:0},add:function(t,e){return this.anims.has(t)||(e.key=t,this.anims.set(t,e),this.emit(a.ADD_ANIMATION,t,e)),this},exists:function(t){return this.anims.has(t)},createFromAseprite:function(t,e){var i=[],n=this.game.cache.json.get(t);if(!n)return i;var r=this,s=u(n,"meta",null),o=u(n,"frames",null);return s&&o&&u(s,"frameTags",[]).forEach((function(n){var s=[],a=l(n,"name",null),h=l(n,"from",0),u=l(n,"to",0),c=l(n,"direction","forward");if(a&&(!e||e&&e.indexOf(a)>-1)){for(var d=[],p=Number.MAX_SAFE_INTEGER,f=h;f<=u;f++){var m=f.toString(),g=o[m];if(g){var v=l(g,"duration",Number.MAX_SAFE_INTEGER);v=e;r--)o?s.push(i+r.toString()+n):s.push(r);else for(r=t;r<=e;r++)o?s.push(i+r.toString()+n):s.push(r);return s}},function(t,e,i){var n=i(0),r=i(102),s=i(9),o=i(324),a=new n({initialize:function(){this.entries=new r,this.events=new s},add:function(t,e){return this.entries.set(t,e),this.events.emit(o.ADD,this,t,e),this},has:function(t){return this.entries.has(t)},exists:function(t){return this.entries.has(t)},get:function(t){return this.entries.get(t)},remove:function(t){var e=this.get(t);return e&&(this.entries.delete(t),this.events.emit(o.REMOVE,this,t,e.data)),this},getKeys:function(){return this.entries.keys()},destroy:function(){this.entries.clear(),this.events.removeAllListeners(),this.entries=null,this.events=null}});t.exports=a},function(t,e,i){t.exports={ADD:i(736),REMOVE:i(737)}},function(t,e,i){var n=i(323),r=i(0),s=i(22),o=new r({initialize:function(t){this.game=t,this.binary=new n,this.bitmapFont=new n,this.json=new n,this.physics=new n,this.shader=new n,this.audio=new n,this.video=new n,this.text=new n,this.html=new n,this.obj=new n,this.tilemap=new n,this.xml=new n,this.custom={},this.game.events.once(s.DESTROY,this.destroy,this)},addCustom:function(t){return this.custom.hasOwnProperty(t)||(this.custom[t]=new n),this.custom[t]},destroy:function(){for(var t=["binary","bitmapFont","json","physics","shader","audio","video","text","html","obj","tilemap","xml"],e=0;ed.right&&(p=u(p,p+(g-d.right),this.lerp.x)),vd.bottom&&(f=u(f,f+(v-d.bottom),this.lerp.y))):(p=u(p,g-a,this.lerp.x),f=u(f,v-h,this.lerp.y)),m=!0}this.useBounds&&(p=this.clampX(p),f=this.clampY(f)),this.roundPixels&&(a=Math.round(a),h=Math.round(h),p=Math.round(p),f=Math.round(f)),this.scrollX=p,this.scrollY=f;var y=p+i,x=f+n;this.midPoint.set(y,x);var w=t/s,b=e/s,A=y-w/2,T=x-b/2;this.roundPixels&&(A=Math.round(A),T=Math.round(T)),this.worldView.setTo(A,T,w,b),o.applyITRS(this.x+a,this.y+h,this.rotation,s,s),o.translate(-a,-h),this.shakeEffect.preRender(),m&&this.emit(l.FOLLOW_UPDATE,this,c)},setLerp:function(t,e){return void 0===t&&(t=1),void 0===e&&(e=t),this.lerp.set(t,e),this},setFollowOffset:function(t,e){return void 0===t&&(t=0),void 0===e&&(e=0),this.followOffset.set(t,e),this},startFollow:function(t,e,i,n,r,o){void 0===e&&(e=!1),void 0===i&&(i=1),void 0===n&&(n=i),void 0===r&&(r=0),void 0===o&&(o=r),this._follow=t,this.roundPixels=e,i=s(i,0,1),n=s(n,0,1),this.lerp.set(i,n),this.followOffset.set(r,o);var a=this.width/2,h=this.height/2,l=t.x-r,u=t.y-o;return this.midPoint.set(l,u),this.scrollX=l-a,this.scrollY=u-h,this.useBounds&&(this.scrollX=this.clampX(this.scrollX),this.scrollY=this.clampY(this.scrollY)),this},stopFollow:function(){return this._follow=null,this},resetFX:function(){return this.rotateToEffect.reset(),this.panEffect.reset(),this.shakeEffect.reset(),this.flashEffect.reset(),this.fadeEffect.reset(),this},update:function(t,e){this.visible&&(this.rotateToEffect.update(t,e),this.panEffect.update(t,e),this.zoomEffect.update(t,e),this.shakeEffect.update(t,e),this.flashEffect.update(t,e),this.fadeEffect.update(t,e))},destroy:function(){this.resetFX(),n.prototype.destroy.call(this),this._follow=null,this.deadzone=null}});t.exports=p},function(t,e,i){var n=i(38);t.exports=function(t){var e=new n;t=t.replace(/^(?:#|0x)?([a-f\d])([a-f\d])([a-f\d])$/i,(function(t,e,i,n){return e+e+i+i+n+n}));var i=/^(?:#|0x)?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(t);if(i){var r=parseInt(i[1],16),s=parseInt(i[2],16),o=parseInt(i[3],16);e.setTo(r,s,o)}return e}},function(t,e){t.exports=function(t,e,i,n){return n<<24|t<<16|e<<8|i}},function(t,e){t.exports=function(t,e,i,n){void 0===n&&(n={h:0,s:0,v:0}),t/=255,e/=255,i/=255;var r=Math.min(t,e,i),s=Math.max(t,e,i),o=s-r,a=0,h=0===s?0:o/s,l=s;return s!==r&&(s===t?a=(e-i)/o+(e16777215?{a:t>>>24,r:t>>16&255,g:t>>8&255,b:255&t}:{a:255,r:t>>16&255,g:t>>8&255,b:255&t}}},function(t,e,i){var n=i(38);t.exports=function(t){return new n(t.r,t.g,t.b,t.a)}},function(t,e,i){var n=i(38);t.exports=function(t){var e=new n,i=/^rgba?\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*(\d+(?:\.\d+)?))?\s*\)$/.exec(t.toLowerCase());if(i){var r=parseInt(i[1],10),s=parseInt(i[2],10),o=parseInt(i[3],10),a=void 0!==i[4]?parseFloat(i[4]):1;e.setTo(r,s,o,255*a)}return e}},function(t,e,i){t.exports={Fade:i(761),Flash:i(762),Pan:i(763),Shake:i(796),RotateTo:i(797),Zoom:i(798)}},function(t,e,i){t.exports={In:i(764),Out:i(765),InOut:i(766)}},function(t,e,i){t.exports={In:i(767),Out:i(768),InOut:i(769)}},function(t,e,i){t.exports={In:i(770),Out:i(771),InOut:i(772)}},function(t,e,i){t.exports={In:i(773),Out:i(774),InOut:i(775)}},function(t,e,i){t.exports={In:i(776),Out:i(777),InOut:i(778)}},function(t,e,i){t.exports={In:i(779),Out:i(780),InOut:i(781)}},function(t,e,i){t.exports=i(782)},function(t,e,i){t.exports={In:i(783),Out:i(784),InOut:i(785)}},function(t,e,i){t.exports={In:i(786),Out:i(787),InOut:i(788)}},function(t,e,i){t.exports={In:i(789),Out:i(790),InOut:i(791)}},function(t,e,i){t.exports={In:i(792),Out:i(793),InOut:i(794)}},function(t,e,i){t.exports=i(795)},function(t,e,i){var n=i(0),r=i(33),s=i(347),o=i(2),a=i(6),h=i(7),l=i(193),u=i(1),c=i(197),d=i(187),p=new n({initialize:function(t){void 0===t&&(t={}),this.width=a(t,"width",1024),this.height=a(t,"height",768),this.zoom=a(t,"zoom",1),this.parent=a(t,"parent",void 0),this.scaleMode=a(t,"scaleMode",0),this.expandParent=a(t,"expandParent",!0),this.autoRound=a(t,"autoRound",!1),this.autoCenter=a(t,"autoCenter",0),this.resizeInterval=a(t,"resizeInterval",500),this.fullscreenTarget=a(t,"fullscreenTarget",null),this.minWidth=a(t,"minWidth",0),this.maxWidth=a(t,"maxWidth",0),this.minHeight=a(t,"minHeight",0),this.maxHeight=a(t,"maxHeight",0);var e=a(t,"scale",null);e&&(this.width=a(e,"width",this.width),this.height=a(e,"height",this.height),this.zoom=a(e,"zoom",this.zoom),this.parent=a(e,"parent",this.parent),this.scaleMode=a(e,"mode",this.scaleMode),this.expandParent=a(e,"expandParent",this.expandParent),this.autoRound=a(e,"autoRound",this.autoRound),this.autoCenter=a(e,"autoCenter",this.autoCenter),this.resizeInterval=a(e,"resizeInterval",this.resizeInterval),this.fullscreenTarget=a(e,"fullscreenTarget",this.fullscreenTarget),this.minWidth=a(e,"min.width",this.minWidth),this.maxWidth=a(e,"max.width",this.maxWidth),this.minHeight=a(e,"min.height",this.minHeight),this.maxHeight=a(e,"max.height",this.maxHeight)),this.renderType=a(t,"type",r.AUTO),this.canvas=a(t,"canvas",null),this.context=a(t,"context",null),this.canvasStyle=a(t,"canvasStyle",null),this.customEnvironment=a(t,"customEnvironment",!1),this.sceneConfig=a(t,"scene",null),this.seed=a(t,"seed",[(Date.now()*Math.random()).toString()]),l.RND=new l.RandomDataGenerator(this.seed),this.gameTitle=a(t,"title",""),this.gameURL=a(t,"url","https://phaser.io"),this.gameVersion=a(t,"version",""),this.autoFocus=a(t,"autoFocus",!0),this.domCreateContainer=a(t,"dom.createContainer",!1),this.domBehindCanvas=a(t,"dom.behindCanvas",!1),this.domPointerEvents=a(t,"dom.pointerEvents","none"),this.inputKeyboard=a(t,"input.keyboard",!0),this.inputKeyboardEventTarget=a(t,"input.keyboard.target",window),this.inputKeyboardCapture=a(t,"input.keyboard.capture",[]),this.inputMouse=a(t,"input.mouse",!0),this.inputMouseEventTarget=a(t,"input.mouse.target",null),this.inputMousePreventDefaultDown=a(t,"input.mouse.preventDefaultDown",!0),this.inputMousePreventDefaultUp=a(t,"input.mouse.preventDefaultUp",!0),this.inputMousePreventDefaultMove=a(t,"input.mouse.preventDefaultMove",!0),this.inputMousePreventDefaultWheel=a(t,"input.mouse.preventDefaultWheel",!0),this.inputTouch=a(t,"input.touch",s.input.touch),this.inputTouchEventTarget=a(t,"input.touch.target",null),this.inputTouchCapture=a(t,"input.touch.capture",!0),this.inputActivePointers=a(t,"input.activePointers",1),this.inputSmoothFactor=a(t,"input.smoothFactor",0),this.inputWindowEvents=a(t,"input.windowEvents",!0),this.inputGamepad=a(t,"input.gamepad",!1),this.inputGamepadEventTarget=a(t,"input.gamepad.target",window),this.disableContextMenu=a(t,"disableContextMenu",!1),this.audio=a(t,"audio",{}),this.hideBanner=!1===a(t,"banner",null),this.hidePhaser=a(t,"banner.hidePhaser",!1),this.bannerTextColor=a(t,"banner.text","#ffffff"),this.bannerBackgroundColor=a(t,"banner.background",["#ff0000","#ffff00","#00ff00","#00ffff","#000000"]),""===this.gameTitle&&this.hidePhaser&&(this.hideBanner=!0),this.fps=a(t,"fps",null);var i=a(t,"render",t);this.pipeline=a(i,"pipeline",null),this.antialias=a(i,"antialias",!0),this.antialiasGL=a(i,"antialiasGL",!0),this.mipmapFilter=a(i,"mipmapFilter","LINEAR"),this.desynchronized=a(i,"desynchronized",!1),this.roundPixels=a(i,"roundPixels",!1),this.pixelArt=a(i,"pixelArt",1!==this.zoom),this.pixelArt&&(this.antialias=!1,this.antialiasGL=!1,this.roundPixels=!0),this.transparent=a(i,"transparent",!1),this.clearBeforeRender=a(i,"clearBeforeRender",!0),this.preserveDrawingBuffer=a(i,"preserveDrawingBuffer",!1),this.premultipliedAlpha=a(i,"premultipliedAlpha",!0),this.failIfMajorPerformanceCaveat=a(i,"failIfMajorPerformanceCaveat",!1),this.powerPreference=a(i,"powerPreference","default"),this.batchSize=a(i,"batchSize",4096),this.maxTextures=a(i,"maxTextures",-1),this.maxLights=a(i,"maxLights",10);var n=a(t,"backgroundColor",0);this.backgroundColor=d(n),this.transparent&&(this.backgroundColor=d(0),this.backgroundColor.alpha=0),this.preBoot=a(t,"callbacks.preBoot",u),this.postBoot=a(t,"callbacks.postBoot",u),this.physics=a(t,"physics",{}),this.defaultPhysicsSystem=a(this.physics,"default",!1),this.loaderBaseURL=a(t,"loader.baseURL",""),this.loaderPath=a(t,"loader.path","");var p=s.os.android?6:32;this.loaderMaxParallelDownloads=a(t,"loader.maxParallelDownloads",p),this.loaderCrossOrigin=a(t,"loader.crossOrigin",void 0),this.loaderResponseType=a(t,"loader.responseType",""),this.loaderAsync=a(t,"loader.async",!0),this.loaderUser=a(t,"loader.user",""),this.loaderPassword=a(t,"loader.password",""),this.loaderTimeout=a(t,"loader.timeout",0),this.loaderWithCredentials=a(t,"loader.withCredentials",!1),this.installGlobalPlugins=[],this.installScenePlugins=[];var f=a(t,"plugins",null),m=c.DefaultScene;f&&(Array.isArray(f)?this.defaultPlugins=f:h(f)&&(this.installGlobalPlugins=o(f,"global",[]),this.installScenePlugins=o(f,"scene",[]),Array.isArray(f.default)?m=f.default:Array.isArray(f.defaultMerge)&&(m=m.concat(f.defaultMerge)))),this.defaultPlugins=m;var g="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAg";this.defaultImage=a(t,"images.default",g+"AQMAAABJtOi3AAAAA1BMVEX///+nxBvIAAAAAXRSTlMAQObYZgAAABVJREFUeF7NwIEAAAAAgKD9qdeocAMAoAABm3DkcAAAAABJRU5ErkJggg=="),this.missingImage=a(t,"images.missing",g+"CAIAAAD8GO2jAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAJ9JREFUeNq01ssOwyAMRFG46v//Mt1ESmgh+DFmE2GPOBARKb2NVjo+17PXLD8a1+pl5+A+wSgFygymWYHBb0FtsKhJDdZlncG2IzJ4ayoMDv20wTmSMzClEgbWYNTAkQ0Z+OJ+A/eWnAaR9+oxCF4Os0H8htsMUp+pwcgBBiMNnAwF8GqIgL2hAzaGFFgZauDPKABmowZ4GL369/0rwACp2yA/ttmvsQAAAABJRU5ErkJggg=="),this.whiteImage=a(t,"images.white","data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAQAAAAECAIAAAAmkwkpAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAABdJREFUeNpi/P//PwMMMDEgAdwcgAADAJZuAwXJYZOzAAAAAElFTkSuQmCC"),window&&(window.FORCE_WEBGL?this.renderType=r.WEBGL:window.FORCE_CANVAS&&(this.renderType=r.CANVAS))}});t.exports=p},function(t,e,i){t.exports={os:i(105),browser:i(136),features:i(191),input:i(808),audio:i(809),video:i(810),fullscreen:i(811),canvasFeatures:i(348)}},function(t,e,i){var n,r,s,o=i(31),a={supportInverseAlpha:!1,supportNewBlendModes:!1};t.exports=("function"!=typeof importScripts&&void 0!==document&&(a.supportNewBlendModes=(n="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAQAAAABAQMAAADD8p2OAAAAA1BMVEX/",r="AAAACklEQVQI12NgAAAAAgAB4iG8MwAAAABJRU5ErkJggg==",(s=new Image).onload=function(){var t=new Image;t.onload=function(){var e=o.create(t,6,1).getContext("2d");if(e.globalCompositeOperation="multiply",e.drawImage(s,0,0),e.drawImage(t,2,0),!e.getImageData(2,0,1,1))return!1;var i=e.getImageData(2,0,1,1).data;o.remove(t),a.supportNewBlendModes=255===i[0]&&0===i[1]&&0===i[2]},t.src=n+"/wCKxvRF"+r},s.src=n+"AP804Oa6"+r,!1),a.supportInverseAlpha=function(){var t=o.create(this,2,1).getContext("2d");t.fillStyle="rgba(10, 20, 30, 0.5)",t.fillRect(0,0,1,1);var e=t.getImageData(0,0,1,1);if(null===e)return!1;t.putImageData(e,1,0);var i=t.getImageData(1,0,1,1);return i.data[0]===e.data[0]&&i.data[1]===e.data[1]&&i.data[2]===e.data[2]&&i.data[3]===e.data[3]}()),a)},function(t,e){t.exports=function(t,e,i,n){return Math.atan2(n-e,i-t)}},function(t,e){t.exports=function(t,e){return Math.atan2(e.y-t.y,e.x-t.x)}},function(t,e){t.exports=function(t){return(t%=2*Math.PI)>=0?t:t+2*Math.PI}},function(t,e){t.exports=function(t,e){var i=t.x-e.x,n=t.y-e.y;return Math.sqrt(i*i+n*n)}},function(t,e){t.exports=function(t,e,i,n){var r=t-i,s=e-n;return r*r+s*s}},function(t,e){t.exports=function(t,e,i){return void 0===i&&(i=1e-4),t>e-i}},function(t,e){t.exports=function(t,e,i){return void 0===i&&(i=1e-4),t0?Math.ceil(t):Math.floor(t)}},function(t,e,i){var n=new(i(0))({initialize:function(t){this.val=new Float32Array(9),t?this.copy(t):this.identity()},clone:function(){return new n(this)},set:function(t){return this.copy(t)},copy:function(t){var e=this.val,i=t.val;return e[0]=i[0],e[1]=i[1],e[2]=i[2],e[3]=i[3],e[4]=i[4],e[5]=i[5],e[6]=i[6],e[7]=i[7],e[8]=i[8],this},fromMat4:function(t){var e=t.val,i=this.val;return i[0]=e[0],i[1]=e[1],i[2]=e[2],i[3]=e[4],i[4]=e[5],i[5]=e[6],i[6]=e[8],i[7]=e[9],i[8]=e[10],this},fromArray:function(t){var e=this.val;return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e[4]=t[4],e[5]=t[5],e[6]=t[6],e[7]=t[7],e[8]=t[8],this},identity:function(){var t=this.val;return t[0]=1,t[1]=0,t[2]=0,t[3]=0,t[4]=1,t[5]=0,t[6]=0,t[7]=0,t[8]=1,this},transpose:function(){var t=this.val,e=t[1],i=t[2],n=t[5];return t[1]=t[3],t[2]=t[6],t[3]=e,t[5]=t[7],t[6]=i,t[7]=n,this},invert:function(){var t=this.val,e=t[0],i=t[1],n=t[2],r=t[3],s=t[4],o=t[5],a=t[6],h=t[7],l=t[8],u=l*s-o*h,c=-l*r+o*a,d=h*r-s*a,p=e*u+i*c+n*d;return p?(p=1/p,t[0]=u*p,t[1]=(-l*i+n*h)*p,t[2]=(o*i-n*s)*p,t[3]=c*p,t[4]=(l*e-n*a)*p,t[5]=(-o*e+n*r)*p,t[6]=d*p,t[7]=(-h*e+i*a)*p,t[8]=(s*e-i*r)*p,this):null},adjoint:function(){var t=this.val,e=t[0],i=t[1],n=t[2],r=t[3],s=t[4],o=t[5],a=t[6],h=t[7],l=t[8];return t[0]=s*l-o*h,t[1]=n*h-i*l,t[2]=i*o-n*s,t[3]=o*a-r*l,t[4]=e*l-n*a,t[5]=n*r-e*o,t[6]=r*h-s*a,t[7]=i*a-e*h,t[8]=e*s-i*r,this},determinant:function(){var t=this.val,e=t[0],i=t[1],n=t[2],r=t[3],s=t[4],o=t[5],a=t[6],h=t[7],l=t[8];return e*(l*s-o*h)+i*(-l*r+o*a)+n*(h*r-s*a)},multiply:function(t){var e=this.val,i=e[0],n=e[1],r=e[2],s=e[3],o=e[4],a=e[5],h=e[6],l=e[7],u=e[8],c=t.val,d=c[0],p=c[1],f=c[2],m=c[3],g=c[4],v=c[5],y=c[6],x=c[7],w=c[8];return e[0]=d*i+p*s+f*h,e[1]=d*n+p*o+f*l,e[2]=d*r+p*a+f*u,e[3]=m*i+g*s+v*h,e[4]=m*n+g*o+v*l,e[5]=m*r+g*a+v*u,e[6]=y*i+x*s+w*h,e[7]=y*n+x*o+w*l,e[8]=y*r+x*a+w*u,this},translate:function(t){var e=this.val,i=t.x,n=t.y;return e[6]=i*e[0]+n*e[3]+e[6],e[7]=i*e[1]+n*e[4]+e[7],e[8]=i*e[2]+n*e[5]+e[8],this},rotate:function(t){var e=this.val,i=e[0],n=e[1],r=e[2],s=e[3],o=e[4],a=e[5],h=Math.sin(t),l=Math.cos(t);return e[0]=l*i+h*s,e[1]=l*n+h*o,e[2]=l*r+h*a,e[3]=l*s-h*i,e[4]=l*o-h*n,e[5]=l*a-h*r,this},scale:function(t){var e=this.val,i=t.x,n=t.y;return e[0]=i*e[0],e[1]=i*e[1],e[2]=i*e[2],e[3]=n*e[3],e[4]=n*e[4],e[5]=n*e[5],this},fromQuat:function(t){var e=t.x,i=t.y,n=t.z,r=t.w,s=e+e,o=i+i,a=n+n,h=e*s,l=e*o,u=e*a,c=i*o,d=i*a,p=n*a,f=r*s,m=r*o,g=r*a,v=this.val;return v[0]=1-(c+p),v[3]=l+g,v[6]=u-m,v[1]=l-g,v[4]=1-(h+p),v[7]=d+f,v[2]=u+m,v[5]=d-f,v[8]=1-(h+c),this},normalFromMat4:function(t){var e=t.val,i=this.val,n=e[0],r=e[1],s=e[2],o=e[3],a=e[4],h=e[5],l=e[6],u=e[7],c=e[8],d=e[9],p=e[10],f=e[11],m=e[12],g=e[13],v=e[14],y=e[15],x=n*h-r*a,w=n*l-s*a,b=n*u-o*a,A=r*l-s*h,T=r*u-o*h,S=s*u-o*l,E=c*g-d*m,M=c*v-p*m,_=c*y-f*m,C=d*v-p*g,P=d*y-f*g,R=p*y-f*v,L=x*R-w*P+b*C+A*_-T*M+S*E;return L?(L=1/L,i[0]=(h*R-l*P+u*C)*L,i[1]=(l*_-a*R-u*M)*L,i[2]=(a*P-h*_+u*E)*L,i[3]=(s*P-r*R-o*C)*L,i[4]=(n*R-s*_+o*M)*L,i[5]=(r*_-n*P-o*E)*L,i[6]=(g*S-v*T+y*A)*L,i[7]=(v*b-m*S-y*w)*L,i[8]=(m*T-g*b+y*x)*L,this):null}});t.exports=n},function(t,e,i){var n=i(0),r=i(364),s=i(1),o=i(39),a=new Int8Array([1,2,0]),h=new Float32Array([0,0,0]),l=new o(1,0,0),u=new o(0,1,0),c=new o,d=new r,p=new n({initialize:function(t,e,i,n){this.onChangeCallback=s,this.set(t,e,i,n)},x:{get:function(){return this._x},set:function(t){this._x=t,this.onChangeCallback(this)}},y:{get:function(){return this._y},set:function(t){this._y=t,this.onChangeCallback(this)}},z:{get:function(){return this._z},set:function(t){this._z=t,this.onChangeCallback(this)}},w:{get:function(){return this._w},set:function(t){this._w=t,this.onChangeCallback(this)}},copy:function(t){return this.set(t)},set:function(t,e,i,n,r){return void 0===r&&(r=!0),"object"==typeof t?(this._x=t.x||0,this._y=t.y||0,this._z=t.z||0,this._w=t.w||0):(this._x=t||0,this._y=e||0,this._z=i||0,this._w=n||0),r&&this.onChangeCallback(this),this},add:function(t){return this._x+=t.x,this._y+=t.y,this._z+=t.z,this._w+=t.w,this.onChangeCallback(this),this},subtract:function(t){return this._x-=t.x,this._y-=t.y,this._z-=t.z,this._w-=t.w,this.onChangeCallback(this),this},scale:function(t){return this._x*=t,this._y*=t,this._z*=t,this._w*=t,this.onChangeCallback(this),this},length:function(){var t=this.x,e=this.y,i=this.z,n=this.w;return Math.sqrt(t*t+e*e+i*i+n*n)},lengthSq:function(){var t=this.x,e=this.y,i=this.z,n=this.w;return t*t+e*e+i*i+n*n},normalize:function(){var t=this.x,e=this.y,i=this.z,n=this.w,r=t*t+e*e+i*i+n*n;return r>0&&(r=1/Math.sqrt(r),this._x=t*r,this._y=e*r,this._z=i*r,this._w=n*r),this.onChangeCallback(this),this},dot:function(t){return this.x*t.x+this.y*t.y+this.z*t.z+this.w*t.w},lerp:function(t,e){void 0===e&&(e=0);var i=this.x,n=this.y,r=this.z,s=this.w;return this.set(i+e*(t.x-i),n+e*(t.y-n),r+e*(t.z-r),s+e*(t.w-s))},rotationTo:function(t,e){var i=t.x*e.x+t.y*e.y+t.z*e.z;return i<-.999999?(c.copy(l).cross(t).length()<1e-6&&c.copy(u).cross(t),c.normalize(),this.setAxisAngle(c,Math.PI)):i>.999999?this.set(0,0,0,1):(c.copy(t).cross(e),this._x=c.x,this._y=c.y,this._z=c.z,this._w=1+i,this.normalize())},setAxes:function(t,e,i){var n=d.val;return n[0]=e.x,n[3]=e.y,n[6]=e.z,n[1]=i.x,n[4]=i.y,n[7]=i.z,n[2]=-t.x,n[5]=-t.y,n[8]=-t.z,this.fromMat3(d).normalize()},identity:function(){return this.set(0,0,0,1)},setAxisAngle:function(t,e){e*=.5;var i=Math.sin(e);return this.set(i*t.x,i*t.y,i*t.z,Math.cos(e))},multiply:function(t){var e=this.x,i=this.y,n=this.z,r=this.w,s=t.x,o=t.y,a=t.z,h=t.w;return this.set(e*h+r*s+i*a-n*o,i*h+r*o+n*s-e*a,n*h+r*a+e*o-i*s,r*h-e*s-i*o-n*a)},slerp:function(t,e){var i=this.x,n=this.y,r=this.z,s=this.w,o=t.x,a=t.y,h=t.z,l=t.w,u=i*o+n*a+r*h+s*l;u<0&&(u=-u,o=-o,a=-a,h=-h,l=-l);var c=1-e,d=e;if(1-u>1e-6){var p=Math.acos(u),f=Math.sin(p);c=Math.sin((1-e)*p)/f,d=Math.sin(e*p)/f}return this.set(c*i+d*o,c*n+d*a,c*r+d*h,c*s+d*l)},invert:function(){var t=this.x,e=this.y,i=this.z,n=this.w,r=t*t+e*e+i*i+n*n,s=r?1/r:0;return this.set(-t*s,-e*s,-i*s,n*s)},conjugate:function(){return this._x=-this.x,this._y=-this.y,this._z=-this.z,this.onChangeCallback(this),this},rotateX:function(t){t*=.5;var e=this.x,i=this.y,n=this.z,r=this.w,s=Math.sin(t),o=Math.cos(t);return this.set(e*o+r*s,i*o+n*s,n*o-i*s,r*o-e*s)},rotateY:function(t){t*=.5;var e=this.x,i=this.y,n=this.z,r=this.w,s=Math.sin(t),o=Math.cos(t);return this.set(e*o-n*s,i*o+r*s,n*o+e*s,r*o-i*s)},rotateZ:function(t){t*=.5;var e=this.x,i=this.y,n=this.z,r=this.w,s=Math.sin(t),o=Math.cos(t);return this.set(e*o+i*s,i*o-e*s,n*o+r*s,r*o-n*s)},calculateW:function(){var t=this.x,e=this.y,i=this.z;return this.w=-Math.sqrt(1-t*t-e*e-i*i),this},setFromEuler:function(t,e){var i=t.x/2,n=t.y/2,r=t.z/2,s=Math.cos(i),o=Math.cos(n),a=Math.cos(r),h=Math.sin(i),l=Math.sin(n),u=Math.sin(r);switch(t.order){case"XYZ":this.set(h*o*a+s*l*u,s*l*a-h*o*u,s*o*u+h*l*a,s*o*a-h*l*u,e);break;case"YXZ":this.set(h*o*a+s*l*u,s*l*a-h*o*u,s*o*u-h*l*a,s*o*a+h*l*u,e);break;case"ZXY":this.set(h*o*a-s*l*u,s*l*a+h*o*u,s*o*u+h*l*a,s*o*a-h*l*u,e);break;case"ZYX":this.set(h*o*a-s*l*u,s*l*a+h*o*u,s*o*u-h*l*a,s*o*a+h*l*u,e);break;case"YZX":this.set(h*o*a+s*l*u,s*l*a+h*o*u,s*o*u-h*l*a,s*o*a-h*l*u,e);break;case"XZY":this.set(h*o*a-s*l*u,s*l*a-h*o*u,s*o*u+h*l*a,s*o*a+h*l*u,e)}return this},setFromRotationMatrix:function(t){var e,i=t.val,n=i[0],r=i[4],s=i[8],o=i[1],a=i[5],h=i[9],l=i[2],u=i[6],c=i[10],d=n+a+c;return d>0?(e=.5/Math.sqrt(d+1),this.set((u-h)*e,(s-l)*e,(o-r)*e,.25/e)):n>a&&n>c?(e=2*Math.sqrt(1+n-a-c),this.set(.25*e,(r+o)/e,(s+l)/e,(u-h)/e)):a>c?(e=2*Math.sqrt(1+a-n-c),this.set((r+o)/e,.25*e,(h+u)/e,(s-l)/e)):(e=2*Math.sqrt(1+c-n-a),this.set((s+l)/e,(h+u)/e,.25*e,(o-r)/e)),this},fromMat3:function(t){var e,i=t.val,n=i[0]+i[4]+i[8];if(n>0)e=Math.sqrt(n+1),this.w=.5*e,e=.5/e,this._x=(i[7]-i[5])*e,this._y=(i[2]-i[6])*e,this._z=(i[3]-i[1])*e;else{var r=0;i[4]>i[0]&&(r=1),i[8]>i[3*r+r]&&(r=2);var s=a[r],o=a[s];e=Math.sqrt(i[3*r+r]-i[3*s+s]-i[3*o+o]+1),h[r]=.5*e,e=.5/e,h[s]=(i[3*s+r]+i[3*r+s])*e,h[o]=(i[3*o+r]+i[3*r+o])*e,this._x=h[0],this._y=h[1],this._z=h[2],this._w=(i[3*o+s]-i[3*s+o])*e}return this.onChangeCallback(this),this}});t.exports=p},function(t,e,i){var n=i(367),r=i(31),s=i(33),o=i(191);t.exports=function(t){var e=t.config;if((e.customEnvironment||e.canvas)&&e.renderType===s.AUTO)throw new Error("Must set explicit renderType in custom environment");if(!e.customEnvironment&&!e.canvas&&e.renderType!==s.HEADLESS)if(e.renderType===s.CANVAS||e.renderType!==s.CANVAS&&!o.webGL){if(!o.canvas)throw new Error("Cannot create Canvas or WebGL context, aborting.");e.renderType=s.CANVAS}else e.renderType=s.WEBGL;e.antialias||r.disableSmoothing();var a,h,l=t.scale.baseSize,u=l.width,c=l.height;e.canvas?(t.canvas=e.canvas,t.canvas.width=u,t.canvas.height=c):t.canvas=r.create(t,u,c,e.renderType),e.canvasStyle&&(t.canvas.style=e.canvasStyle),e.antialias||n.setCrisp(t.canvas),e.renderType!==s.HEADLESS&&(a=i(368),h=i(371),e.renderType===s.WEBGL?t.renderer=new h(t):(t.renderer=new a(t),t.context=t.renderer.gameContext))}},function(t,e){t.exports={setCrisp:function(t){return["optimizeSpeed","-moz-crisp-edges","-o-crisp-edges","-webkit-optimize-contrast","optimize-contrast","crisp-edges","pixelated"].forEach((function(e){t.style["image-rendering"]=e})),t.style.msInterpolationMode="nearest-neighbor",t},setBicubic:function(t){return t.style["image-rendering"]="auto",t.style.msInterpolationMode="bicubic",t}}},function(t,e,i){var n=i(37),r=i(369),s=i(0),o=i(33),a=i(9),h=i(91),l=i(370),u=i(104),c=i(106),d=i(25),p=new s({Extends:a,initialize:function(t){a.call(this);var e=t.config;this.config={clearBeforeRender:e.clearBeforeRender,backgroundColor:e.backgroundColor,antialias:e.antialias,roundPixels:e.roundPixels},this.game=t,this.type=o.CANVAS,this.drawCount=0,this.width=0,this.height=0,this.gameCanvas=t.canvas;var i={alpha:t.config.transparent,desynchronized:t.config.desynchronized};this.gameContext=e.context?e.context:this.gameCanvas.getContext("2d",i),this.currentContext=this.gameContext,this.antialias=t.config.antialias,this.blendModes=l(),this.snapshotState={x:0,y:0,width:1,height:1,getPixel:!1,callback:null,type:"image/png",encoder:.92},this._tempMatrix1=new d,this._tempMatrix2=new d,this._tempMatrix3=new d,this.isBooted=!1,this.init()},init:function(){this.game.textures.once(c.READY,this.boot,this)},boot:function(){var t=this.game,e=t.scale.baseSize;this.width=e.width,this.height=e.height,this.isBooted=!0,t.scale.on(u.RESIZE,this.onResize,this),this.resize(e.width,e.height)},onResize:function(t,e){e.width===this.width&&e.height===this.height||this.resize(e.width,e.height)},resize:function(t,e){this.width=t,this.height=e,this.emit(h.RESIZE,t,e)},resetTransform:function(){this.currentContext.setTransform(1,0,0,1,0,0)},setBlendMode:function(t){return this.currentContext.globalCompositeOperation=t,this},setContext:function(t){return this.currentContext=t||this.gameContext,this},setAlpha:function(t){return this.currentContext.globalAlpha=t,this},preRender:function(){var t=this.gameContext,e=this.config,i=this.width,n=this.height;t.globalAlpha=1,t.globalCompositeOperation="source-over",t.setTransform(1,0,0,1,0,0),e.clearBeforeRender&&(t.clearRect(0,0,i,n),e.transparent||(t.fillStyle=e.backgroundColor.rgba,t.fillRect(0,0,i,n))),t.save(),this.drawCount=0,this.emit(h.PRE_RENDER)},render:function(t,e,i){var r=e.length;this.emit(h.RENDER,t,i);var s=i.x,o=i.y,a=i.width,l=i.height,u=i.renderToTexture?i.context:t.sys.context;u.save(),this.game.scene.customViewports&&(u.beginPath(),u.rect(s,o,a,l),u.clip()),this.currentContext=u;var c=i.mask;c&&c.preRenderCanvas(this,null,i._maskCamera),i.transparent||(u.fillStyle=i.backgroundColor.rgba,u.fillRect(s,o,a,l)),u.globalAlpha=i.alpha,u.globalCompositeOperation="source-over",this.drawCount+=r,i.renderToTexture&&i.emit(n.PRE_RENDER,i),i.matrix.copyToContext(u);for(var d=0;d=0?v=-(v+c):v<0&&(v=Math.abs(v)-c)),t.flipY&&(y>=0?y=-(y+d):y<0&&(y=Math.abs(y)-d))}var w=1,b=1;t.flipX&&(p||(v+=-e.realWidth+2*m),w=-1),t.flipY&&(p||(y+=-e.realHeight+2*g),b=-1),a.applyITRS(t.x,t.y,t.rotation,t.scaleX*w,t.scaleY*b),o.copyFrom(i.matrix),n?(o.multiplyWithOffset(n,-i.scrollX*t.scrollFactorX,-i.scrollY*t.scrollFactorY),a.e=t.x,a.f=t.y):(a.e-=i.scrollX*t.scrollFactorX,a.f-=i.scrollY*t.scrollFactorY),o.multiply(a),s.save(),o.setToContext(s),s.globalCompositeOperation=this.blendModes[t.blendMode],s.globalAlpha=r,s.imageSmoothingEnabled=!(!this.antialias||e.source.scaleMode),t.mask&&t.mask.preRenderCanvas(this,t,i),s.drawImage(e.source.image,l,u,c,d,v,y,c/f,d/f),t.mask&&t.mask.postRenderCanvas(this,t,i),s.restore()}},destroy:function(){this.removeAllListeners(),this.game=null,this.gameCanvas=null,this.gameContext=null}});t.exports=p},function(t,e,i){var n=i(31),r=i(38),s=i(2);t.exports=function(t,e){var i=s(e,"callback"),o=s(e,"type","image/png"),a=s(e,"encoder",.92),h=Math.abs(Math.round(s(e,"x",0))),l=Math.abs(Math.round(s(e,"y",0))),u=s(e,"width",t.width),c=s(e,"height",t.height);if(s(e,"getPixel",!1)){var d=t.getContext("2d").getImageData(h,l,1,1).data;i.call(null,new r(d[0],d[1],d[2],d[3]/255))}else if(0!==h||0!==l||u!==t.width||c!==t.height){var p=n.createWebGL(this,u,c);p.getContext("2d").drawImage(t,h,l,u,c,0,0,u,c);var f=new Image;f.onerror=function(){i.call(null),n.remove(p)},f.onload=function(){i.call(null,f),n.remove(p)},f.src=p.toDataURL(o,a)}else{var m=new Image;m.onerror=function(){i.call(null)},m.onload=function(){i.call(null,m)},m.src=t.toDataURL(o,a)}}},function(t,e,i){var n=i(35),r=i(348);t.exports=function(){var t=[],e=r.supportNewBlendModes,i="source-over";return t[n.NORMAL]=i,t[n.ADD]="lighter",t[n.MULTIPLY]=e?"multiply":i,t[n.SCREEN]=e?"screen":i,t[n.OVERLAY]=e?"overlay":i,t[n.DARKEN]=e?"darken":i,t[n.LIGHTEN]=e?"lighten":i,t[n.COLOR_DODGE]=e?"color-dodge":i,t[n.COLOR_BURN]=e?"color-burn":i,t[n.HARD_LIGHT]=e?"hard-light":i,t[n.SOFT_LIGHT]=e?"soft-light":i,t[n.DIFFERENCE]=e?"difference":i,t[n.EXCLUSION]=e?"exclusion":i,t[n.HUE]=e?"hue":i,t[n.SATURATION]=e?"saturation":i,t[n.COLOR]=e?"color":i,t[n.LUMINOSITY]=e?"luminosity":i,t[n.ERASE]="destination-out",t[n.SOURCE_IN]="source-in",t[n.SOURCE_OUT]="source-out",t[n.SOURCE_ATOP]="source-atop",t[n.DESTINATION_OVER]="destination-over",t[n.DESTINATION_IN]="destination-in",t[n.DESTINATION_OUT]="destination-out",t[n.DESTINATION_ATOP]="destination-atop",t[n.LIGHTER]="lighter",t[n.COPY]="copy",t[n.XOR]="xor",t}},function(t,e,i){var n=i(93),r=i(37),s=i(0),o=i(33),a=i(9),h=i(91),l=i(22),u=i(138),c=i(69),d=i(1),p=i(372),f=i(141),m=i(104),g=i(106),v=i(12),y=i(383),x=new s({Extends:a,initialize:function(t){a.call(this);var e=t.config,i={alpha:e.transparent,desynchronized:e.desynchronized,depth:!1,antialias:e.antialiasGL,premultipliedAlpha:e.premultipliedAlpha,stencil:!0,failIfMajorPerformanceCaveat:e.failIfMajorPerformanceCaveat,powerPreference:e.powerPreference,preserveDrawingBuffer:e.preserveDrawingBuffer};this.config={clearBeforeRender:e.clearBeforeRender,antialias:e.antialias,backgroundColor:e.backgroundColor,contextCreation:i,roundPixels:e.roundPixels,maxTextures:e.maxTextures,maxTextureSize:e.maxTextureSize,batchSize:e.batchSize,maxLights:e.maxLights,mipmapFilter:e.mipmapFilter},this.game=t,this.type=o.WEBGL,this.pipelines=null,this.width=0,this.height=0,this.canvas=t.canvas,this.blendModes=[],this.contextLost=!1,this.snapshotState={x:0,y:0,width:1,height:1,getPixel:!1,callback:null,type:"image/png",encoder:.92,isFramebuffer:!1,bufferWidth:0,bufferHeight:0},this.currentActiveTexture=0,this.startActiveTexture=0,this.maxTextures=0,this.textureIndexes,this.tempTextures,this.textureZero,this.normalTexture,this.currentFramebuffer=null,this.fboStack=[],this.currentProgram=null,this.currentBlendMode=1/0,this.currentScissorEnabled=!1,this.currentScissor=null,this.scissorStack=[],this.contextLostHandler=d,this.contextRestoredHandler=d,this.gl=null,this.supportedExtensions=null,this.instancedArraysExtension=null,this.vaoExtension=null,this.extensions={},this.glFormats=[],this.compression={ETC1:!1,PVRTC:!1,S3TC:!1},this.drawingBufferHeight=0,this.blankTexture=null,this.whiteTexture=null,this.maskCount=0,this.maskStack=[],this.currentMask={mask:null,camera:null},this.currentCameraMask={mask:null,camera:null},this.glFuncMap=null,this.currentType="",this.newType=!1,this.nextTypeMatch=!1,this.finalType=!1,this.mipmapFilter=null,this.textureFlush=0,this.isTextureClean=!1,this.defaultScissor=[0,0,0,0],this.isBooted=!1,this.renderTarget=null,this.projectionMatrix,this.projectionWidth=0,this.projectionHeight=0,this.init(this.config)},init:function(t){var e,i=this.game,n=this.canvas,r=t.backgroundColor;if(!(e=i.config.context?i.config.context:n.getContext("webgl",t.contextCreation)||n.getContext("experimental-webgl",t.contextCreation))||e.isContextLost())throw this.contextLost=!0,new Error("WebGL unsupported");this.gl=e;var s=this;this.contextLostHandler=function(t){s.contextLost=!0,s.game.events.emit(l.CONTEXT_LOST,s),t.preventDefault()},this.contextRestoredHandler=function(){s.contextLost=!1,s.init(s.config),s.game.events.emit(l.CONTEXT_RESTORED,s)},n.addEventListener("webglcontextlost",this.contextLostHandler,!1),n.addEventListener("webglcontextrestored",this.contextRestoredHandler,!1),i.context=e;for(var a=0;a<=27;a++)this.blendModes.push({func:[e.ONE,e.ONE_MINUS_SRC_ALPHA],equation:e.FUNC_ADD});this.blendModes[1].func=[e.ONE,e.DST_ALPHA],this.blendModes[2].func=[e.DST_COLOR,e.ONE_MINUS_SRC_ALPHA],this.blendModes[3].func=[e.ONE,e.ONE_MINUS_SRC_COLOR],this.blendModes[17]={func:[e.ZERO,e.ONE_MINUS_SRC_ALPHA],equation:e.FUNC_REVERSE_SUBTRACT},this.glFormats[0]=e.BYTE,this.glFormats[1]=e.SHORT,this.glFormats[2]=e.UNSIGNED_BYTE,this.glFormats[3]=e.UNSIGNED_SHORT,this.glFormats[4]=e.FLOAT,this.glFuncMap={mat2:{func:e.uniformMatrix2fv,length:1,matrix:!0},mat3:{func:e.uniformMatrix3fv,length:1,matrix:!0},mat4:{func:e.uniformMatrix4fv,length:1,matrix:!0},"1f":{func:e.uniform1f,length:1},"1fv":{func:e.uniform1fv,length:1},"1i":{func:e.uniform1i,length:1},"1iv":{func:e.uniform1iv,length:1},"2f":{func:e.uniform2f,length:2},"2fv":{func:e.uniform2fv,length:1},"2i":{func:e.uniform2i,length:2},"2iv":{func:e.uniform2iv,length:1},"3f":{func:e.uniform3f,length:3},"3fv":{func:e.uniform3fv,length:1},"3i":{func:e.uniform3i,length:3},"3iv":{func:e.uniform3iv,length:1},"4f":{func:e.uniform4f,length:4},"4fv":{func:e.uniform4fv,length:1},"4i":{func:e.uniform4i,length:4},"4iv":{func:e.uniform4iv,length:1}};var h=e.getSupportedExtensions();t.maxTextures&&-1!==t.maxTextures||(t.maxTextures=e.getParameter(e.MAX_TEXTURE_IMAGE_UNITS)),t.maxTextureSize||(t.maxTextureSize=e.getParameter(e.MAX_TEXTURE_SIZE));var u="WEBGL_compressed_texture_",d="WEBKIT_"+u;this.compression.ETC1=e.getExtension(u+"etc1")||e.getExtension(d+"etc1"),this.compression.PVRTC=e.getExtension(u+"pvrtc")||e.getExtension(d+"pvrtc"),this.compression.S3TC=e.getExtension(u+"s3tc")||e.getExtension(d+"s3tc"),this.supportedExtensions=h,this.instancedArraysExtension=h.indexOf("ANGLE_instanced_arrays")>-1?e.getExtension("ANGLE_instanced_arrays"):null,this.vaoExtension=h.indexOf("OES_vertex_array_object")>-1?e.getExtension("OES_vertex_array_object"):null,e.disable(e.DEPTH_TEST),e.disable(e.CULL_FACE),e.enable(e.BLEND),e.clearColor(r.redGL,r.greenGL,r.blueGL,r.alphaGL),this.mipmapFilter=e[t.mipmapFilter],this.maxTextures=v.checkShaderMax(e,t.maxTextures),this.textureIndexes=[];var f=this.tempTextures;if(Array.isArray(f))for(var m=0;a0&&n>0;if(o&&a){var h=o[0],l=o[1],u=o[2],c=o[3];a=h!==t||l!==e||u!==i||c!==n}a&&(this.flush(),s.scissor(t,r-e-n,i,n))},resetScissor:function(){var t=this.gl;t.enable(t.SCISSOR_TEST);var e=this.currentScissor;if(e){var i=e[0],n=e[1],r=e[2],s=e[3];r>0&&s>0&&t.scissor(i,this.drawingBufferHeight-n-s,r,s)}},popScissor:function(){var t=this.scissorStack;t.pop();var e=t[t.length-1];e&&this.setScissor(e[0],e[1],e[2],e[3]),this.currentScissor=e},hasActiveStencilMask:function(){var t=this.currentMask.mask,e=this.currentCameraMask.mask;return t&&t.isStencil||e&&e.isStencil},resetViewport:function(){var t=this.gl;t.viewport(0,0,this.width,this.height),this.drawingBufferHeight=t.drawingBufferHeight},setBlendMode:function(t,e){void 0===e&&(e=!1);var i=this.gl,n=this.blendModes[t];return!!(e||t!==o.BlendModes.SKIP_CHECK&&this.currentBlendMode!==t)&&(this.flush(),i.enable(i.BLEND),i.blendEquation(n.equation),n.func.length>2?i.blendFuncSeparate(n.func[0],n.func[1],n.func[2],n.func[3]):i.blendFunc(n.func[0],n.func[1]),this.currentBlendMode=t,!0)},addBlendMode:function(t,e){return this.blendModes.push({func:t,equation:e})-1},updateBlendMode:function(t,e,i){return this.blendModes[t]&&(this.blendModes[t].func=e,i&&(this.blendModes[t].equation=i)),this},removeBlendMode:function(t){return t>17&&this.blendModes[t]&&this.blendModes.splice(t,1),this},setBlankTexture:function(){this.setTexture2D(this.blankTexture.glTexture)},setTextureSource:function(t){if(this.pipelines.forceZero())return this.setTextureZero(t.glTexture,!0),0;var e=this.gl,i=this.currentActiveTexture;return t.glIndexCounter0&&this.pipelines.setMulti().drawFillRect(e,i,n,s,v.getTintFromFloats(o.blueGL,o.greenGL,o.redGL,1),o.alphaGL)},getCurrentStencilMask:function(){var t=null,e=this.maskStack,i=this.currentCameraMask;return e.length>0?t=e[e.length-1]:i.mask&&i.mask.isStencil&&(t=i),t},postRenderCamera:function(t){var e=t.flashEffect,i=t.fadeEffect;if(e.isRunning||i.isRunning||i.isComplete){var n=this.pipelines.setMulti();e.postRenderWebGL(n,v.getTintFromFloats),i.postRenderWebGL(n,v.getTintFromFloats)}t.dirty=!1,this.popScissor(),t.mask&&(this.currentCameraMask.mask=null,t.mask.postRenderWebGL(this,t._maskCamera)),this.pipelines.postBatchCamera(t),t.emit(r.POST_RENDER,t)},preRender:function(){if(!this.contextLost){var t=this.gl;if(t.bindFramebuffer(t.FRAMEBUFFER,null),this.config.clearBeforeRender){var e=this.config.backgroundColor;t.clearColor(e.redGL,e.greenGL,e.blueGL,e.alphaGL),t.clear(t.COLOR_BUFFER_BIT|t.DEPTH_BUFFER_BIT|t.STENCIL_BUFFER_BIT)}t.enable(t.SCISSOR_TEST),this.currentScissor=this.defaultScissor,this.scissorStack.length=0,this.scissorStack.push(this.currentScissor),this.game.scene.customViewports&&t.scissor(0,this.drawingBufferHeight-this.height,this.width,this.height),this.currentMask.mask=null,this.currentCameraMask.mask=null,this.maskStack.length=0,this.textureFlush=0,this.emit(h.PRE_RENDER)}},render:function(t,e,i){if(!this.contextLost){var n=e.length;if(this.emit(h.RENDER,t,i),this.preRenderCamera(i),0===n)return this.setBlendMode(o.BlendModes.NORMAL),void this.postRenderCamera(i);this.currentType="";for(var r=this.currentMask,s=0;s0&&(this.startActiveTexture++,this.currentActiveTexture=1)}},snapshot:function(t,e,i){return this.snapshotArea(0,0,this.gl.drawingBufferWidth,this.gl.drawingBufferHeight,t,e,i)},snapshotArea:function(t,e,i,n,r,s,o){var a=this.snapshotState;return a.callback=r,a.type=s,a.encoder=o,a.getPixel=!1,a.x=t,a.y=e,a.width=Math.min(i,this.gl.drawingBufferWidth),a.height=Math.min(n,this.gl.drawingBufferHeight),this},snapshotPixel:function(t,e,i){return this.snapshotArea(t,e,1,1,i),this.snapshotState.getPixel=!0,this},snapshotFramebuffer:function(t,e,i,n,r,s,o,a,h,l,u){void 0===r&&(r=!1),void 0===s&&(s=0),void 0===o&&(o=0),void 0===a&&(a=e),void 0===h&&(h=i);var c=this.currentFramebuffer;this.snapshotArea(s,o,a,h,n,l,u);var d=this.snapshotState;return d.getPixel=r,d.isFramebuffer=!0,d.bufferWidth=e,d.bufferHeight=i,this.setFramebuffer(t),y(this.canvas,d),this.setFramebuffer(c),d.callback=null,d.isFramebuffer=!1,this},canvasToTexture:function(t,e,i,n){return void 0===i&&(i=!1),void 0===n&&(n=!1),e?this.updateCanvasTexture(t,e,n):this.createCanvasTexture(t,i,n)},createCanvasTexture:function(t,e,i){void 0===e&&(e=!1),void 0===i&&(i=!1);var n=this.gl,r=n.NEAREST,s=n.NEAREST,o=t.width,a=t.height,h=n.CLAMP_TO_EDGE,l=u(o,a);return!e&&l&&(h=n.REPEAT),this.config.antialias&&(r=l?this.mipmapFilter:n.LINEAR,s=n.LINEAR),this.createTexture2D(0,r,s,h,h,n.RGBA,t,o,a,!0,!1,i)},updateCanvasTexture:function(t,e,i){void 0===i&&(i=!1);var n=this.gl,r=t.width,s=t.height;if(r>0&&s>0){n.activeTexture(n.TEXTURE0);var o=n.getParameter(n.TEXTURE_BINDING_2D);n.bindTexture(n.TEXTURE_2D,e),n.pixelStorei(n.UNPACK_FLIP_Y_WEBGL,i),n.pixelStorei(n.UNPACK_PREMULTIPLY_ALPHA_WEBGL,!0),n.texImage2D(n.TEXTURE_2D,0,n.RGBA,n.RGBA,n.UNSIGNED_BYTE,t),e.width=r,e.height=s,o&&n.bindTexture(n.TEXTURE_2D,o)}return e},createVideoTexture:function(t,e,i){void 0===e&&(e=!1),void 0===i&&(i=!1);var n=this.gl,r=n.NEAREST,s=n.NEAREST,o=t.videoWidth,a=t.videoHeight,h=n.CLAMP_TO_EDGE,l=u(o,a);return!e&&l&&(h=n.REPEAT),this.config.antialias&&(r=l?this.mipmapFilter:n.LINEAR,s=n.LINEAR),this.createTexture2D(0,r,s,h,h,n.RGBA,t,o,a,!0,!0,i)},updateVideoTexture:function(t,e,i){void 0===i&&(i=!1);var n=this.gl,r=t.videoWidth,s=t.videoHeight;if(r>0&&s>0){n.activeTexture(n.TEXTURE0);var o=n.getParameter(n.TEXTURE_BINDING_2D);n.bindTexture(n.TEXTURE_2D,e),n.pixelStorei(n.UNPACK_FLIP_Y_WEBGL,i),n.texImage2D(n.TEXTURE_2D,0,n.RGBA,n.RGBA,n.UNSIGNED_BYTE,t),e.width=r,e.height=s,o&&n.bindTexture(n.TEXTURE_2D,o)}return e},setTextureFilter:function(t,e){var i=this.gl,n=[i.LINEAR,i.NEAREST][e];i.activeTexture(i.TEXTURE0);var r=i.getParameter(i.TEXTURE_BINDING_2D);return i.bindTexture(i.TEXTURE_2D,t),i.texParameteri(i.TEXTURE_2D,i.TEXTURE_MIN_FILTER,n),i.texParameteri(i.TEXTURE_2D,i.TEXTURE_MAG_FILTER,n),r&&i.bindTexture(i.TEXTURE_2D,r),this},getMaxTextureSize:function(){return this.config.maxTextureSize},destroy:function(){this.canvas.removeEventListener("webglcontextlost",this.contextLostHandler,!1),this.canvas.removeEventListener("webglcontextrestored",this.contextRestoredHandler,!1);for(var t=this.gl,e=this.tempTextures,i=0;i=0;i--){var n=e[i];n.active&&n.preBatch(t)}}},postBatch:function(t){if(t.hasPostPipeline){this.flush();for(var e=t.postPipelines,i=0;i=0;i--){var n=e[i];n.active&&n.preBatch(t)}}},postBatchCamera:function(t){if(t.hasPostPipeline){this.flush();for(var e=t.postPipelines,i=0;i=0?(e.enableVertexAttribArray(p),e.vertexAttribPointer(p,a,h,d,i,l),o.enabled=!0,o.location=p):-1!==p&&e.disableVertexAttribArray(p)}else u?e.vertexAttribPointer(c,a,h,d,i,l):!u&&c>-1&&(e.disableVertexAttribArray(c),o.location=-1)}return this},createUniforms:function(){var t,e,i,n=this.gl,r=this.program,s=this.uniforms,o=n.getProgramParameter(r,n.ACTIVE_UNIFORMS);for(t=0;t0&&(e=e.substr(0,h),s.hasOwnProperty(e)||null!==(i=n.getUniformLocation(r,e))&&(s[e]={name:e,location:i,value1:null,value2:null,value3:null,value4:null}))}}return this},hasUniform:function(t){return this.uniforms.hasOwnProperty(t)},resetUniform:function(t){var e=this.uniforms[t];return e&&(e.value1=null,e.value2=null,e.value3=null,e.value4=null),this},setUniform1:function(t,e,i,n){var r=this.uniforms[e];return r?((n||r.value1!==i)&&(r.value1=i,this.renderer.setProgram(this.program),t.call(this.gl,r.location,i),this.pipeline.currentShader=this),this):this},setUniform2:function(t,e,i,n,r){var s=this.uniforms[e];return s?((r||s.value1!==i||s.value2!==n)&&(s.value1=i,s.value2=n,this.renderer.setProgram(this.program),t.call(this.gl,s.location,i,n),this.pipeline.currentShader=this),this):this},setUniform3:function(t,e,i,n,r,s){var o=this.uniforms[e];return o?((s||o.value1!==i||o.value2!==n||o.value3!==r)&&(o.value1=i,o.value2=n,o.value3=r,this.renderer.setProgram(this.program),t.call(this.gl,o.location,i,n,r),this.pipeline.currentShader=this),this):this},setUniform4:function(t,e,i,n,r,s,o){var a=this.uniforms[e];return a?((o||a.value1!==i||a.value2!==n||a.value3!==r||a.value4!==s)&&(a.value1=i,a.value2=n,a.value3=r,a.value4=s,this.renderer.setProgram(this.program),t.call(this.gl,a.location,i,n,r,s),this.pipeline.currentShader=this),this):this},set1f:function(t,e){return this.setUniform1(this.gl.uniform1f,t,e)},set2f:function(t,e,i){return this.setUniform2(this.gl.uniform2f,t,e,i)},set3f:function(t,e,i,n){return this.setUniform3(this.gl.uniform3f,t,e,i,n)},set4f:function(t,e,i,n,r){return this.setUniform4(this.gl.uniform4f,t,e,i,n,r)},set1fv:function(t,e){return this.setUniform1(this.gl.uniform1fv,t,e,!0)},set2fv:function(t,e){return this.setUniform1(this.gl.uniform2fv,t,e,!0)},set3fv:function(t,e){return this.setUniform1(this.gl.uniform3fv,t,e,!0)},set4fv:function(t,e){return this.setUniform1(this.gl.uniform4fv,t,e,!0)},set1iv:function(t,e){return this.setUniform1(this.gl.uniform1iv,t,e,!0)},set2iv:function(t,e){return this.setUniform1(this.gl.uniform2iv,t,e,!0)},set3iv:function(t,e){return this.setUniform1(this.gl.uniform3iv,t,e,!0)},set4iv:function(t,e){return this.setUniform1(this.gl.uniform4iv,t,e,!0)},set1i:function(t,e){return this.setUniform1(this.gl.uniform1i,t,e)},set2i:function(t,e,i){return this.setUniform2(this.gl.uniform2i,t,e,i)},set3i:function(t,e,i,n){return this.setUniform3(this.gl.uniform3i,t,e,i,n)},set4i:function(t,e,i,n,r){return this.setUniform4(this.gl.uniform4i,t,e,i,n,r)},setMatrix2fv:function(t,e,i){return this.setUniform2(this.gl.uniformMatrix2fv,t,e,i,!0)},setMatrix3fv:function(t,e,i){return this.setUniform2(this.gl.uniformMatrix3fv,t,e,i,!0)},setMatrix4fv:function(t,e,i){return this.setUniform2(this.gl.uniformMatrix4fv,t,e,i,!0)},destroy:function(){this.gl.deleteProgram(this.program),this.pipeline=null,this.renderer=null,this.gl=null,this.program=null,this.attributes=null,this.uniforms=null}});t.exports=o},function(t,e,i){var n=i(0),r=i(59),s=i(2),o=i(875),a=i(876),h=i(25),l=i(107),u=i(58),c=new n({Extends:u,initialize:function(t){t.fragShader=s(t,"fragShader",o),t.vertShader=s(t,"vertShader",a),t.attributes=s(t,"attributes",[{name:"inPosition",size:2},{name:"inColor",size:4,type:l.UNSIGNED_BYTE,normalized:!0}]),u.call(this,t),this.calcMatrix=new h,this.tempTriangle=[{x:0,y:0,width:0},{x:0,y:0,width:0},{x:0,y:0,width:0},{x:0,y:0,width:0}],this.strokeTint={TL:0,TR:0,BL:0,BR:0},this.fillTint={TL:0,TR:0,BL:0,BR:0},this.currentFrame={u0:0,v0:0,u1:1,v1:1},this.firstQuad=[0,0,0,0,0],this.prevQuad=[0,0,0,0,0],this.polygonCache=[]},batchFillRect:function(t,e,i,n,r,s){this.renderer.pipelines.set(this);var o=this.calcMatrix;s&&s.multiply(r,o);var a=t+i,h=e+n,l=o.getX(t,e),u=o.getY(t,e),c=o.getX(t,h),d=o.getY(t,h),p=o.getX(a,h),f=o.getY(a,h),m=o.getX(a,e),g=o.getY(a,e),v=this.fillTint;this.batchQuad(l,u,c,d,p,f,m,g,v.TL,v.TR,v.BL,v.BR)},batchFillTriangle:function(t,e,i,n,r,s,o,a){this.renderer.pipelines.set(this);var h=this.calcMatrix;a&&a.multiply(o,h);var l=h.getX(t,e),u=h.getY(t,e),c=h.getX(i,n),d=h.getY(i,n),p=h.getX(r,s),f=h.getY(r,s),m=this.fillTint;this.batchTri(l,u,c,d,p,f,m.TL,m.TR,m.BL)},batchStrokeTriangle:function(t,e,i,n,r,s,o,a,h){var l=this.tempTriangle;l[0].x=t,l[0].y=e,l[0].width=o,l[1].x=i,l[1].y=n,l[1].width=o,l[2].x=r,l[2].y=s,l[2].width=o,l[3].x=t,l[3].y=e,l[3].width=o,this.batchStrokePath(l,o,!1,a,h)},batchFillPath:function(t,e,i){this.renderer.pipelines.set(this);var n=this.calcMatrix;i&&i.multiply(e,n);for(var s,o,a=t.length,h=this.polygonCache,l=this.fillTint.TL,u=this.fillTint.TR,c=this.fillTint.BL,d=0;d0&&U[4]?this.batchQuad(D,B,P,R,U[0],U[1],U[2],U[3],F,k,N,z):(V[0]=D,V[1]=B,V[2]=P,V[3]=R,V[4]=1),h&&V[4]?this.batchQuad(_,C,L,O,V[0],V[1],V[2],V[3],F,k,N,z):(U[0]=_,U[1]=C,U[2]=L,U[3]=O,U[4]=1)}},batchVert:function(t,e,i){var n=this.vertexViewF32,r=this.vertexViewU32,s=this.vertexCount*this.currentShader.vertexComponentCount-1;n[++s]=t,n[++s]=e,r[++s]=i,this.vertexCount++},batchQuad:function(t,e,i,n,r,s,o,a,h,l,u,c){var d=!1;return this.shouldFlush(6)&&(this.flush(),d=!0),this.batchVert(t,e,h),this.batchVert(i,n,u),this.batchVert(r,s,c),this.batchVert(t,e,h),this.batchVert(r,s,c),this.batchVert(o,a,l),d},batchTri:function(t,e,i,n,r,s,o,a,h){var l=!1;return this.shouldFlush(3)&&(this.flush(),l=!0),this.batchVert(t,e,o),this.batchVert(i,n,a),this.batchVert(r,s,h),l},destroy:function(){return u.prototype.destroy.call(this),this.polygonCache=null,this}});t.exports=c},function(t,e,i){var n=i(0),r=i(2),s=i(877),o=i(108),a=i(3),h=i(58),l=10,u=new a,c=new n({Extends:o,initialize:function(t){l=t.game.renderer.config.maxLights;for(var e=r(t,"fragShader",s),i=[],n=1;n<=l;n++)i.push({name:"lights"+n,fragShader:e.replace("%LIGHT_COUNT%",n.toString())});t.shaders=i,o.call(this,t),this.inverseRotationMatrix=new Float32Array([1,0,0,0,1,0,0,0,1]),this.defaultNormalMap,this.lightsActive=!0},boot:function(){h.prototype.boot.call(this);var t=this.gl,e=t.createTexture();t.activeTexture(t.TEXTURE0),t.bindTexture(t.TEXTURE_2D,e),t.texImage2D(t.TEXTURE_2D,0,t.RGBA,1,1,0,t.RGBA,t.UNSIGNED_BYTE,new Uint8Array([127,127,255,255])),this.defaultNormalMap={glTexture:e};for(var i=0;i0&&this.flush();var e=this.inverseRotationMatrix;if(t){var i=-t,n=Math.cos(i),r=Math.sin(i);e[1]=r,e[3]=-r,e[0]=e[4]=n}else e[0]=e[4]=1,e[1]=e[3]=0;this.setMatrix3fv("uInverseRotationMatrix",!1,e),this.currentNormalMapRotation=t}},setTexture2D:function(t,e){var i=this.renderer;void 0===t&&(t=i.tempTextures[0]);var n=this.getNormalMap(e);i.isNewNormalMap(t,n)&&(this.flush(),i.setTextureZero(t),i.setNormalMap(n));var r=e?e.rotation:0;return this.setNormalMapRotation(r),this.currentUnit=0,0},setGameObject:function(t,e){void 0===e&&(e=t.frame);var i=this.renderer,n=e.glTexture,r=this.getNormalMap(t);return i.isNewNormalMap()&&(this.flush(),i.setTextureZero(n),i.setNormalMap(r)),this.setNormalMapRotation(t.rotation),this.currentUnit=0,0},getNormalMap:function(t){var e;return t?t.displayTexture?e=t.displayTexture.dataSource[t.displayFrame.sourceIndex]:t.texture?e=t.texture.dataSource[t.frame.sourceIndex]:t.tileset&&(e=Array.isArray(t.tileset)?t.tileset[0].image.dataSource[0]:t.tileset.image.dataSource[0]):e=this.defaultNormalMap,e||(e=this.defaultNormalMap),e.glTexture},batchSprite:function(t,e,i){this.lightsActive&&o.prototype.batchSprite.call(this,t,e,i)},batchTexture:function(t,e,i,n,r,s,a,h,l,u,c,d,p,f,m,g,v,y,x,w,b,A,T,S,E,M,_,C,P,R,L,O){this.lightsActive&&o.prototype.batchTexture.call(this,t,e,i,n,r,s,a,h,l,u,c,d,p,f,m,g,v,y,x,w,b,A,T,S,E,M,_,C,P,R,L,O)},batchTextureFrame:function(t,e,i,n,r,s,a){this.lightsActive&&o.prototype.batchTextureFrame.call(this,t,e,i,n,r,s,a)}});c.LIGHT_COUNT=l,t.exports=c},function(t,e,i){var n=i(0),r=i(2),s=i(880),o=i(881),a=i(58),h=new n({Extends:a,initialize:function(t){t.vertShader=r(t,"vertShader",o),t.fragShader=r(t,"fragShader",s),t.attributes=r(t,"attributes",[{name:"inPosition",size:2},{name:"inLightPosition",size:2},{name:"inLightRadius"},{name:"inLightAttenuation"},{name:"inLightColor",size:4}]),a.call(this,t)},onRender:function(t,e){this.set2f("uResolution",this.width,this.height),this.set1f("uCameraZoom",e.zoom)},batchPointLight:function(t,e,i,n,r,s,o,a,h,l,u,c){var d=t.color,p=t.intensity,f=t.radius,m=t.attenuation,g=d.r*p,v=d.g*p,y=d.b*p,x=e.alpha*t.alpha;this.shouldFlush(6)&&this.flush(),this.batchLightVert(i,n,u,c,f,m,g,v,y,x),this.batchLightVert(r,s,u,c,f,m,g,v,y,x),this.batchLightVert(o,a,u,c,f,m,g,v,y,x),this.batchLightVert(i,n,u,c,f,m,g,v,y,x),this.batchLightVert(o,a,u,c,f,m,g,v,y,x),this.batchLightVert(h,l,u,c,f,m,g,v,y,x)},batchLightVert:function(t,e,i,n,r,s,o,a,h,l){var u=this.vertexViewF32,c=this.vertexCount*this.currentShader.vertexComponentCount-1;u[++c]=t,u[++c]=e,u[++c]=i,u[++c]=n,u[++c]=r,u[++c]=s,u[++c]=o,u[++c]=a,u[++c]=h,u[++c]=l,this.vertexCount++}});t.exports=h},function(t,e,i){var n=i(0),r=i(2),s=i(108),o=new n({Extends:s,initialize:function(t){t.topology=5,t.batchSize=r(t,"batchSize",256),s.call(this,t)}});t.exports=o},function(t,e,i){var n=i(0),r=i(2),s=i(108),o=i(882),a=i(883),h=i(58),l=new n({Extends:s,initialize:function(t){t.fragShader=r(t,"fragShader",o),t.vertShader=r(t,"vertShader",a),t.forceZero=!0,s.call(this,t)},boot:function(){h.prototype.boot.call(this),this.set1i("uMainSampler",0)}});t.exports=l},function(t,e,i){var n=i(884),r=i(35),s=i(0),o=i(198),a=i(885),h=i(886),l=i(2),u=i(887),c=i(382),d=i(58),p=new s({Extends:d,initialize:function(t){t.renderTarget=l(t,"renderTarget",[{scale:1},{scale:1},{scale:.5},{scale:.5}]),t.vertShader=l(t,"vertShader",c),t.shaders=l(t,"shaders",[{name:"Copy",fragShader:h},{name:"AddBlend",fragShader:n},{name:"LinearBlend",fragShader:u},{name:"ColorMatrix",fragShader:a}]),t.attributes=l(t,"attributes",[{name:"inPosition",size:2},{name:"inTexCoord",size:2}]),t.vertices=[-1,-1,0,0,-1,1,0,1,1,1,1,1,-1,-1,0,0,1,1,1,1,1,-1,1,0],t.batchSize=1,d.call(this,t),this.colorMatrix=new o,this.copyShader,this.addShader,this.linearShader,this.colorMatrixShader,this.fullFrame1,this.fullFrame2,this.halfFrame1,this.halfFrame2},boot:function(){d.prototype.boot.call(this);var t=this.shaders,e=this.renderTargets;this.copyShader=t[0],this.addShader=t[1],this.linearShader=t[2],this.colorMatrixShader=t[3],this.fullFrame1=e[0],this.fullFrame2=e[1],this.halfFrame1=e[2],this.halfFrame2=e[3]},copyFrame:function(t,e,i,n,r){void 0===i&&(i=1),void 0===n&&(n=!0),void 0===r&&(r=!0);var s=this.gl;this.setShader(this.copyShader),this.set1i("uMainSampler",0),this.set1f("uBrightness",i),s.activeTexture(s.TEXTURE0),s.bindTexture(s.TEXTURE_2D,t.texture),e?(s.viewport(0,0,e.width,e.height),s.bindFramebuffer(s.FRAMEBUFFER,e.framebuffer),s.framebufferTexture2D(s.FRAMEBUFFER,s.COLOR_ATTACHMENT0,s.TEXTURE_2D,e.texture,0)):s.viewport(0,0,t.width,t.height),n&&(r?s.clearColor(0,0,0,0):s.clearColor(0,0,0,1),s.clear(s.COLOR_BUFFER_BIT)),s.bufferData(s.ARRAY_BUFFER,this.vertexData,s.STATIC_DRAW),s.drawArrays(s.TRIANGLES,0,6),s.bindFramebuffer(s.FRAMEBUFFER,null),s.bindTexture(s.TEXTURE_2D,null)},blitFrame:function(t,e,i,n,s,o){void 0===i&&(i=1),void 0===n&&(n=!0),void 0===s&&(s=!0),void 0===o&&(o=!1);var a=this.gl;if(this.setShader(this.copyShader),this.set1i("uMainSampler",0),this.set1f("uBrightness",i),a.activeTexture(a.TEXTURE0),a.bindTexture(a.TEXTURE_2D,t.texture),t.height>e.height)a.viewport(0,0,t.width,t.height),this.setTargetUVs(t,e);else{var h=e.height-t.height;a.viewport(0,h,t.width,t.height)}if(a.bindFramebuffer(a.FRAMEBUFFER,e.framebuffer),a.framebufferTexture2D(a.FRAMEBUFFER,a.COLOR_ATTACHMENT0,a.TEXTURE_2D,e.texture,0),n&&(s?a.clearColor(0,0,0,0):a.clearColor(0,0,0,1),a.clear(a.COLOR_BUFFER_BIT)),o){var l=this.renderer.currentBlendMode;this.renderer.setBlendMode(r.ERASE)}a.bufferData(a.ARRAY_BUFFER,this.vertexData,a.STATIC_DRAW),a.drawArrays(a.TRIANGLES,0,6),o&&this.renderer.setBlendMode(l),a.bindFramebuffer(a.FRAMEBUFFER,null),a.bindTexture(a.TEXTURE_2D,null),this.resetUVs()},copyFrameRect:function(t,e,i,n,r,s,o,a){void 0===o&&(o=!0),void 0===a&&(a=!0);var h=this.gl;h.bindFramebuffer(h.FRAMEBUFFER,t.framebuffer),h.framebufferTexture2D(h.FRAMEBUFFER,h.COLOR_ATTACHMENT0,h.TEXTURE_2D,t.texture,0),o&&(a?h.clearColor(0,0,0,0):h.clearColor(0,0,0,1),h.clear(h.COLOR_BUFFER_BIT)),h.activeTexture(h.TEXTURE0),h.bindTexture(h.TEXTURE_2D,e.texture),h.copyTexSubImage2D(h.TEXTURE_2D,0,0,0,i,n,r,s),h.bindFramebuffer(h.FRAMEBUFFER,null),h.bindTexture(h.TEXTURE_2D,null)},copyToGame:function(t){var e=this.gl;this.setShader(this.copyShader),this.set1i("uMainSampler",0),this.set1f("uBrightness",1),this.renderer.popFramebuffer(),e.activeTexture(e.TEXTURE0),e.bindTexture(e.TEXTURE_2D,t.texture),e.bufferData(e.ARRAY_BUFFER,this.vertexData,e.STATIC_DRAW),e.drawArrays(e.TRIANGLES,0,6),this.renderer.resetTextures()},drawFrame:function(t,e,i,n){void 0===i&&(i=!0),void 0===n&&(n=this.colorMatrix);var r=this.gl;this.setShader(this.colorMatrixShader),this.set1i("uMainSampler",0),this.set1fv("uColorMatrix",n.getData()),this.set1f("uAlpha",n.alpha),r.activeTexture(r.TEXTURE0),r.bindTexture(r.TEXTURE_2D,t.texture),e?(r.viewport(0,0,e.width,e.height),r.bindFramebuffer(r.FRAMEBUFFER,e.framebuffer),r.framebufferTexture2D(r.FRAMEBUFFER,r.COLOR_ATTACHMENT0,r.TEXTURE_2D,e.texture,0)):r.viewport(0,0,t.width,t.height),i?r.clearColor(0,0,0,0):r.clearColor(0,0,0,1),r.clear(r.COLOR_BUFFER_BIT),r.bufferData(r.ARRAY_BUFFER,this.vertexData,r.STATIC_DRAW),r.drawArrays(r.TRIANGLES,0,6),r.bindFramebuffer(r.FRAMEBUFFER,null),r.bindTexture(r.TEXTURE_2D,null)},blendFrames:function(t,e,i,n,r,s){void 0===n&&(n=1),void 0===r&&(r=!0),void 0===s&&(s=this.linearShader);var o=this.gl;this.setShader(s),this.set1i("uMainSampler1",0),this.set1i("uMainSampler2",1),this.set1f("uStrength",n),o.activeTexture(o.TEXTURE0),o.bindTexture(o.TEXTURE_2D,t.texture),o.activeTexture(o.TEXTURE1),o.bindTexture(o.TEXTURE_2D,e.texture),i?(o.bindFramebuffer(o.FRAMEBUFFER,i.framebuffer),o.framebufferTexture2D(o.FRAMEBUFFER,o.COLOR_ATTACHMENT0,o.TEXTURE_2D,i.texture,0),o.viewport(0,0,i.width,i.height)):o.viewport(0,0,t.width,t.height),r?o.clearColor(0,0,0,0):o.clearColor(0,0,0,1),o.clear(o.COLOR_BUFFER_BIT),o.bufferData(o.ARRAY_BUFFER,this.vertexData,o.STATIC_DRAW),o.drawArrays(o.TRIANGLES,0,6),o.bindFramebuffer(o.FRAMEBUFFER,null),o.bindTexture(o.TEXTURE_2D,null)},blendFramesAdditive:function(t,e,i,n,r){this.blendFrames(t,e,i,n,r,this.addShader)},clearFrame:function(t,e){void 0===e&&(e=!0);var i=this.gl;i.viewport(0,0,t.width,t.height),i.bindFramebuffer(i.FRAMEBUFFER,t.framebuffer),e?i.clearColor(0,0,0,0):i.clearColor(0,0,0,1),i.clear(i.COLOR_BUFFER_BIT);var n=this.renderer.currentFramebuffer;i.bindFramebuffer(i.FRAMEBUFFER,n)},setUVs:function(t,e,i,n,r,s,o,a){var h=this.vertexViewF32;h[2]=t,h[3]=e,h[6]=i,h[7]=n,h[10]=r,h[11]=s,h[14]=t,h[15]=e,h[18]=r,h[19]=s,h[22]=o,h[23]=a},setTargetUVs:function(t,e){var i=e.height/t.height;i=i>.5?.5-(i-.5):.5-i+.5,this.setUVs(0,i,0,1+i,1,1+i,1,i)},flipX:function(){this.setUVs(1,0,1,1,0,1,0,0)},flipY:function(){this.setUVs(0,1,0,0,1,0,1,1)},resetUVs:function(){this.setUVs(0,0,0,1,1,1,1,0)}});t.exports=p},function(t,e){t.exports=["#define SHADER_NAME PHASER_QUAD_VS","","precision mediump float;","","attribute vec2 inPosition;","attribute vec2 inTexCoord;","","varying vec2 outFragCoord;","varying vec2 outTexCoord;","","void main ()","{"," outFragCoord = inPosition.xy * 0.5 + 0.5;"," outTexCoord = inTexCoord;",""," gl_Position = vec4(inPosition, 0, 1);","}",""].join("\n")},function(t,e,i){var n=i(31),r=i(38),s=i(2);t.exports=function(t,e){var i=t.getContext("experimental-webgl"),o=s(e,"callback"),a=s(e,"type","image/png"),h=s(e,"encoder",.92),l=s(e,"x",0),u=s(e,"y",0),c=s(e,"getPixel",!1),d=s(e,"isFramebuffer",!1),p=d?s(e,"bufferWidth",1):i.drawingBufferWidth,f=d?s(e,"bufferHeight",1):i.drawingBufferHeight;if(c){var m=new Uint8Array(4),g=d?u:f-u;i.readPixels(l,g,1,1,i.RGBA,i.UNSIGNED_BYTE,m),o.call(null,new r(m[0],m[1],m[2],m[3]/255))}else{var v=s(e,"width",p),y=s(e,"height",f),x=new Uint8Array(v*y*4);i.readPixels(l,f-u-y,v,y,i.RGBA,i.UNSIGNED_BYTE,x);for(var w=n.createWebGL(this,v,y),b=w.getContext("2d"),A=b.getImageData(0,0,v,y),T=A.data,S=0;S0||!this.inFocus)&&(this._coolDown--,s=Math.min(s,this._target)),s>this._min&&(s=n[i],s=Math.min(s,this._min)),n[i]=s,this.deltaIndex++,this.deltaIndex>r&&(this.deltaIndex=0),o=0;for(var a=0;athis.nextFpsUpdate&&(this.actualFps=.25*this.framesThisSecond+.75*this.actualFps,this.nextFpsUpdate=t+1e3,this.framesThisSecond=0),this.framesThisSecond++;var h=o/this._target;this.callback(t,o,h),this.lastTime=t,this.frame++},tick:function(){this.step()},sleep:function(){this.running&&(this.raf.stop(),this.running=!1)},wake:function(t){this.running||(t&&(this.startTime+=-this.lastTime+(this.lastTime+window.performance.now())),this.raf.start(this.step.bind(this),this.useRAF),this.running=!0,this.step())},getDuration:function(){return Math.round(this.lastTime-this.startTime)/1e3},getDurationMS:function(){return Math.round(this.lastTime-this.startTime)},stop:function(){return this.running=!1,this.started=!1,this.raf.stop(),this},destroy:function(){this.stop(),this.callback=s,this.raf=null,this.game=null}});t.exports=a},function(t,e,i){var n=i(0),r=i(1),s=new n({initialize:function(){this.isRunning=!1,this.callback=r,this.tick=0,this.isSetTimeOut=!1,this.timeOutID=null,this.lastTime=0,this.target=0;var t=this;this.step=function e(){var i=window.performance.now();t.lastTime=t.tick,t.tick=i,t.callback(i),t.timeOutID=window.requestAnimationFrame(e)},this.stepTimeout=function e(){var i=Date.now(),n=Math.min(Math.max(2*t.target+t.tick-i,0),t.target);t.lastTime=t.tick,t.tick=i,t.callback(i),t.timeOutID=window.setTimeout(e,n)}},start:function(t,e,i){this.isRunning||(this.callback=t,this.isSetTimeOut=e,this.target=i,this.isRunning=!0,this.timeOutID=e?window.setTimeout(this.stepTimeout,0):window.requestAnimationFrame(this.step))},stop:function(){this.isRunning=!1,this.isSetTimeOut?clearTimeout(this.timeOutID):window.cancelAnimationFrame(this.timeOutID)},destroy:function(){this.stop(),this.callback=r}});t.exports=s},function(t,e,i){var n=i(22);t.exports=function(t){var e,i=t.events;void 0!==document.hidden?e="visibilitychange":["webkit","moz","ms"].forEach((function(t){void 0!==document[t+"Hidden"]&&(document.hidden=function(){return document[t+"Hidden"]},e=t+"visibilitychange")})),e&&document.addEventListener(e,(function(t){document.hidden||"pause"===t.type?i.emit(n.HIDDEN):i.emit(n.VISIBLE)}),!1),window.onblur=function(){i.emit(n.BLUR)},window.onfocus=function(){i.emit(n.FOCUS)},window.focus&&t.config.autoFocus&&window.focus()}},function(t,e,i){var n=i(389),r=i(31),s=i(6);t.exports=function(t){var e=s(t,"data",[]),i=s(t,"canvas",null),o=s(t,"palette",n),a=s(t,"pixelWidth",1),h=s(t,"pixelHeight",a),l=s(t,"resizeCanvas",!0),u=s(t,"clearCanvas",!0),c=s(t,"preRender",null),d=s(t,"postRender",null),p=Math.floor(Math.abs(e[0].length*a)),f=Math.floor(Math.abs(e.length*h));i||(i=r.create2D(this,p,f),l=!1,u=!1),l&&(i.width=p,i.height=f);var m=i.getContext("2d");u&&m.clearRect(0,0,p,f),c&&c(i,m);for(var g=0;gi;)n-=i;ni.length-2?i.length-1:s+1],c=i[s>i.length-3?i.length-1:s+2];return e.set(n(a,h.x,l.x,u.x,c.x),n(a,h.y,l.y,u.y,c.y))},toJSON:function(){for(var t=[],e=0;e1&&(i-=1),i<1/6?t+6*(e-t)*i:i<.5?e:i<2/3?t+(e-t)*(2/3-i)*6:t}},function(t,e,i){var n=i(105);t.exports=function(t){if("complete"!==document.readyState&&"interactive"!==document.readyState){var e=function(){document.removeEventListener("deviceready",e,!0),document.removeEventListener("DOMContentLoaded",e,!0),window.removeEventListener("load",e,!0),t()};document.body?n.cordova?document.addEventListener("deviceready",e,!1):(document.addEventListener("DOMContentLoaded",e,!0),window.addEventListener("load",e,!0)):window.setTimeout(e,20)}else t()}},function(t,e){t.exports=function(t){if(!t)return window.innerHeight;var e=Math.abs(window.orientation),i={w:0,h:0},n=document.createElement("div");return n.setAttribute("style","position: fixed; height: 100vh; width: 0; top: 0"),document.documentElement.appendChild(n),i.w=90===e?n.offsetHeight:window.innerWidth,i.h=90===e?window.innerWidth:n.offsetHeight,document.documentElement.removeChild(n),n=null,90!==Math.abs(window.orientation)?i.h:i.w}},function(t,e,i){var n=i(201);t.exports=function(t,e){var i=window.screen,r=!!i&&(i.orientation||i.mozOrientation||i.msOrientation);return r&&"string"==typeof r.type?r.type:"string"==typeof r?r:"number"==typeof window.orientation?0===window.orientation||180===window.orientation?n.ORIENTATION.PORTRAIT:n.ORIENTATION.LANDSCAPE:window.matchMedia?window.matchMedia("(orientation: portrait)").matches?n.ORIENTATION.PORTRAIT:window.matchMedia("(orientation: landscape)").matches?n.ORIENTATION.LANDSCAPE:void 0:e>t?n.ORIENTATION.PORTRAIT:n.ORIENTATION.LANDSCAPE}},function(t,e){t.exports={NO_CENTER:0,CENTER_BOTH:1,CENTER_HORIZONTALLY:2,CENTER_VERTICALLY:3}},function(t,e){t.exports={LANDSCAPE:"landscape-primary",PORTRAIT:"portrait-primary"}},function(t,e){t.exports={NONE:0,WIDTH_CONTROLS_HEIGHT:1,HEIGHT_CONTROLS_WIDTH:2,FIT:3,ENVELOP:4,RESIZE:5}},function(t,e){t.exports={NO_ZOOM:1,ZOOM_2X:2,ZOOM_4X:4,MAX_ZOOM:-1}},function(t,e){t.exports=function(t){var e;return""!==t&&("string"==typeof t?e=document.getElementById(t):t&&1===t.nodeType&&(e=t)),e||(e=document.body),e}},function(t,e){t.exports=function(t){var e="";try{window.DOMParser?e=(new DOMParser).parseFromString(t,"text/xml"):(e=new ActiveXObject("Microsoft.XMLDOM")).loadXML(t)}catch(t){e=null}return e&&e.documentElement&&!e.getElementsByTagName("parsererror").length?e:null}},function(t,e,i){var n=i(0),r=i(203),s=i(9),o=i(51),a=i(22),h=i(410),l=i(411),u=i(412),c=i(413),d=i(25),p=i(177),f=new n({initialize:function(t,e){this.game=t,this.scaleManager,this.canvas,this.config=e,this.enabled=!0,this.events=new s,this.isOver=!0,this.defaultCursor="",this.keyboard=e.inputKeyboard?new h(this):null,this.mouse=e.inputMouse?new l(this):null,this.touch=e.inputTouch?new c(this):null,this.pointers=[],this.pointersTotal=e.inputActivePointers,e.inputTouch&&1===this.pointersTotal&&(this.pointersTotal=2);for(var i=0;i<=this.pointersTotal;i++){var n=new u(this,i);n.smoothFactor=e.inputSmoothFactor,this.pointers.push(n)}this.mousePointer=e.inputMouse?this.pointers[0]:null,this.activePointer=this.pointers[0],this.globalTopOnly=!0,this.time=0,this._tempPoint={x:0,y:0},this._tempHitTest=[],this._tempMatrix=new d,this._tempMatrix2=new d,this._tempSkip=!1,this.mousePointerContainer=[this.mousePointer],t.events.once(a.BOOT,this.boot,this)},boot:function(){this.canvas=this.game.canvas,this.scaleManager=this.game.scale,this.events.emit(o.MANAGER_BOOT),this.game.events.on(a.PRE_RENDER,this.preRender,this),this.game.events.once(a.DESTROY,this.destroy,this)},setCanvasOver:function(t){this.isOver=!0,this.events.emit(o.GAME_OVER,t)},setCanvasOut:function(t){this.isOver=!1,this.events.emit(o.GAME_OUT,t)},preRender:function(){var t=this.game.loop.now,e=this.game.loop.delta,i=this.game.scene.getScenes(!0,!0);this.time=t,this.events.emit(o.MANAGER_UPDATE);for(var n=0;n10&&(t=10-this.pointersTotal);for(var i=0;i-1&&e.preventDefault()}},this.onKeyUp=function(e){if(!e.defaultPrevented&&t.enabled&&t.manager){t.queue.push(e),t.manager.events.emit(o.MANAGER_PROCESS);var i=e.altKey||e.ctrlKey||e.shiftKey||e.metaKey;t.preventDefault&&!i&&t.captures.indexOf(e.keyCode)>-1&&e.preventDefault()}};var e=this.target;e&&(e.addEventListener("keydown",this.onKeyDown,!1),e.addEventListener("keyup",this.onKeyUp,!1),this.enabled=!0)},stopListeners:function(){var t=this.target;t.removeEventListener("keydown",this.onKeyDown,!1),t.removeEventListener("keyup",this.onKeyUp,!1),this.enabled=!1},postUpdate:function(){this.queue=[]},addCapture:function(t){"string"==typeof t&&(t=t.split(",")),Array.isArray(t)||(t=[t]);for(var e=this.captures,i=0;i0},removeCapture:function(t){"string"==typeof t&&(t=t.split(",")),Array.isArray(t)||(t=[t]);for(var e=this.captures,i=0;i0},clearCaptures:function(){this.captures=[],this.preventDefault=!1},destroy:function(){this.stopListeners(),this.clearCaptures(),this.queue=[],this.manager.game.events.off(s.POST_RENDER,this.postUpdate,this),this.target=null,this.enabled=!1,this.manager=null}});t.exports=l},function(t,e,i){var n=i(0),r=i(191),s=i(51),o=i(1),a=new n({initialize:function(t){this.manager=t,this.preventDefaultDown=!0,this.preventDefaultUp=!0,this.preventDefaultMove=!0,this.preventDefaultWheel=!1,this.enabled=!1,this.target,this.locked=!1,this.onMouseMove=o,this.onMouseDown=o,this.onMouseUp=o,this.onMouseDownWindow=o,this.onMouseUpWindow=o,this.onMouseOver=o,this.onMouseOut=o,this.onMouseWheel=o,this.pointerLockChange=o,this.isTop=!0,t.events.once(s.MANAGER_BOOT,this.boot,this)},boot:function(){var t=this.manager.config;this.enabled=t.inputMouse,this.target=t.inputMouseEventTarget,this.passive=t.inputMousePassive,this.preventDefaultDown=t.inputMousePreventDefaultDown,this.preventDefaultUp=t.inputMousePreventDefaultUp,this.preventDefaultMove=t.inputMousePreventDefaultMove,this.preventDefaultWheel=t.inputMousePreventDefaultWheel,this.target?"string"==typeof this.target&&(this.target=document.getElementById(this.target)):this.target=this.manager.game.canvas,t.disableContextMenu&&this.disableContextMenu(),this.enabled&&this.target&&this.startListeners()},disableContextMenu:function(){return document.body.addEventListener("contextmenu",(function(t){return t.preventDefault(),!1})),this},requestPointerLock:function(){if(r.pointerLock){var t=this.target;t.requestPointerLock=t.requestPointerLock||t.mozRequestPointerLock||t.webkitRequestPointerLock,t.requestPointerLock()}},releasePointerLock:function(){r.pointerLock&&(document.exitPointerLock=document.exitPointerLock||document.mozExitPointerLock||document.webkitExitPointerLock,document.exitPointerLock())},startListeners:function(){var t=this.target;if(t){var e=this,i=this.manager,n=i.canvas,s=window&&window.focus&&i.game.config.autoFocus;this.onMouseMove=function(t){!t.defaultPrevented&&e.enabled&&i&&i.enabled&&(i.onMouseMove(t),e.preventDefaultMove&&t.preventDefault())},this.onMouseDown=function(t){s&&window.focus(),!t.defaultPrevented&&e.enabled&&i&&i.enabled&&(i.onMouseDown(t),e.preventDefaultDown&&t.target===n&&t.preventDefault())},this.onMouseDownWindow=function(t){!t.defaultPrevented&&e.enabled&&i&&i.enabled&&t.target!==n&&i.onMouseDown(t)},this.onMouseUp=function(t){!t.defaultPrevented&&e.enabled&&i&&i.enabled&&(i.onMouseUp(t),e.preventDefaultUp&&t.target===n&&t.preventDefault())},this.onMouseUpWindow=function(t){!t.defaultPrevented&&e.enabled&&i&&i.enabled&&t.target!==n&&i.onMouseUp(t)},this.onMouseOver=function(t){!t.defaultPrevented&&e.enabled&&i&&i.enabled&&i.setCanvasOver(t)},this.onMouseOut=function(t){!t.defaultPrevented&&e.enabled&&i&&i.enabled&&i.setCanvasOut(t)},this.onMouseWheel=function(t){!t.defaultPrevented&&e.enabled&&i&&i.enabled&&i.onMouseWheel(t),e.preventDefaultWheel&&t.target===n&&t.preventDefault()};var o={passive:!0};if(t.addEventListener("mousemove",this.onMouseMove),t.addEventListener("mousedown",this.onMouseDown),t.addEventListener("mouseup",this.onMouseUp),t.addEventListener("mouseover",this.onMouseOver,o),t.addEventListener("mouseout",this.onMouseOut,o),this.preventDefaultWheel?t.addEventListener("wheel",this.onMouseWheel,{passive:!1}):t.addEventListener("wheel",this.onMouseWheel,o),window&&i.game.config.inputWindowEvents)try{window.top.addEventListener("mousedown",this.onMouseDownWindow,o),window.top.addEventListener("mouseup",this.onMouseUpWindow,o)}catch(t){window.addEventListener("mousedown",this.onMouseDownWindow,o),window.addEventListener("mouseup",this.onMouseUpWindow,o),this.isTop=!1}r.pointerLock&&(this.pointerLockChange=function(t){var n=e.target;e.locked=document.pointerLockElement===n||document.mozPointerLockElement===n||document.webkitPointerLockElement===n,i.onPointerLockChange(t)},document.addEventListener("pointerlockchange",this.pointerLockChange,!0),document.addEventListener("mozpointerlockchange",this.pointerLockChange,!0),document.addEventListener("webkitpointerlockchange",this.pointerLockChange,!0)),this.enabled=!0}},stopListeners:function(){var t=this.target;t.removeEventListener("mousemove",this.onMouseMove),t.removeEventListener("mousedown",this.onMouseDown),t.removeEventListener("mouseup",this.onMouseUp),t.removeEventListener("mouseover",this.onMouseOver),t.removeEventListener("mouseout",this.onMouseOut),window&&((t=this.isTop?window.top:window).removeEventListener("mousedown",this.onMouseDownWindow),t.removeEventListener("mouseup",this.onMouseUpWindow)),r.pointerLock&&(document.removeEventListener("pointerlockchange",this.pointerLockChange,!0),document.removeEventListener("mozpointerlockchange",this.pointerLockChange,!0),document.removeEventListener("webkitpointerlockchange",this.pointerLockChange,!0))},destroy:function(){this.stopListeners(),this.target=null,this.enabled=!1,this.manager=null}});t.exports=a},function(t,e,i){var n=i(349),r=i(0),s=i(50),o=i(124),a=i(360),h=i(3),l=i(105),u=new r({initialize:function(t,e){this.manager=t,this.id=e,this.event,this.downElement,this.upElement,this.camera=null,this.button=0,this.buttons=0,this.position=new h,this.prevPosition=new h,this.midPoint=new h(-1,-1),this.velocity=new h,this.angle=0,this.distance=0,this.smoothFactor=0,this.motionFactor=.2,this.worldX=0,this.worldY=0,this.moveTime=0,this.downX=0,this.downY=0,this.downTime=0,this.upX=0,this.upY=0,this.upTime=0,this.primaryDown=!1,this.isDown=!1,this.wasTouch=!1,this.wasCanceled=!1,this.movementX=0,this.movementY=0,this.identifier=0,this.pointerId=null,this.active=0===e,this.locked=!1,this.deltaX=0,this.deltaY=0,this.deltaZ=0},updateWorldPoint:function(t){var e=t.getWorldPoint(this.x,this.y);return this.worldX=e.x,this.worldY=e.y,this},positionToCamera:function(t,e){return t.getWorldPoint(this.x,this.y,e)},updateMotion:function(){var t=this.position.x,e=this.position.y,i=this.midPoint.x,r=this.midPoint.y;if(t!==i||e!==r){var s=a(this.motionFactor,i,t),h=a(this.motionFactor,r,e);o(s,t,.1)&&(s=t),o(h,e,.1)&&(h=e),this.midPoint.set(s,h);var l=t-s,u=e-h;this.velocity.set(l,u),this.angle=n(s,h,t,e),this.distance=Math.sqrt(l*l+u*u)}},up:function(t){"buttons"in t&&(this.buttons=t.buttons),this.event=t,this.button=t.button,this.upElement=t.target,this.manager.transformPointer(this,t.pageX,t.pageY,!1),0===t.button&&(this.primaryDown=!1,this.upX=this.x,this.upY=this.y),0===this.buttons&&(this.isDown=!1,this.upTime=t.timeStamp,this.wasTouch=!1)},down:function(t){"buttons"in t&&(this.buttons=t.buttons),this.event=t,this.button=t.button,this.downElement=t.target,this.manager.transformPointer(this,t.pageX,t.pageY,!1),0===t.button&&(this.primaryDown=!0,this.downX=this.x,this.downY=this.y),l.macOS&&t.ctrlKey&&(this.buttons=2,this.primaryDown=!1),this.isDown||(this.isDown=!0,this.downTime=t.timeStamp),this.wasTouch=!1},move:function(t){"buttons"in t&&(this.buttons=t.buttons),this.event=t,this.manager.transformPointer(this,t.pageX,t.pageY,!0),this.locked&&(this.movementX=t.movementX||t.mozMovementX||t.webkitMovementX||0,this.movementY=t.movementY||t.mozMovementY||t.webkitMovementY||0),this.moveTime=t.timeStamp,this.wasTouch=!1},wheel:function(t){"buttons"in t&&(this.buttons=t.buttons),this.event=t,this.manager.transformPointer(this,t.pageX,t.pageY,!1),this.deltaX=t.deltaX,this.deltaY=t.deltaY,this.deltaZ=t.deltaZ,this.wasTouch=!1},touchstart:function(t,e){t.pointerId&&(this.pointerId=t.pointerId),this.identifier=t.identifier,this.target=t.target,this.active=!0,this.buttons=1,this.event=e,this.downElement=t.target,this.manager.transformPointer(this,t.pageX,t.pageY,!1),this.primaryDown=!0,this.downX=this.x,this.downY=this.y,this.downTime=e.timeStamp,this.isDown=!0,this.wasTouch=!0,this.wasCanceled=!1,this.updateMotion()},touchmove:function(t,e){this.event=e,this.manager.transformPointer(this,t.pageX,t.pageY,!0),this.moveTime=e.timeStamp,this.wasTouch=!0,this.updateMotion()},touchend:function(t,e){this.buttons=0,this.event=e,this.upElement=t.target,this.manager.transformPointer(this,t.pageX,t.pageY,!1),this.primaryDown=!1,this.upX=this.x,this.upY=this.y,this.upTime=e.timeStamp,this.isDown=!1,this.wasTouch=!0,this.wasCanceled=!1,this.active=!1,this.updateMotion()},touchcancel:function(t,e){this.buttons=0,this.event=e,this.upElement=t.target,this.manager.transformPointer(this,t.pageX,t.pageY,!1),this.primaryDown=!1,this.upX=this.x,this.upY=this.y,this.upTime=e.timeStamp,this.isDown=!1,this.wasTouch=!0,this.wasCanceled=!0,this.active=!1},noButtonDown:function(){return 0===this.buttons},leftButtonDown:function(){return!!(1&this.buttons)},rightButtonDown:function(){return!!(2&this.buttons)},middleButtonDown:function(){return!!(4&this.buttons)},backButtonDown:function(){return!!(8&this.buttons)},forwardButtonDown:function(){return!!(16&this.buttons)},leftButtonReleased:function(){return 0===this.button&&!this.isDown},rightButtonReleased:function(){return 2===this.button&&!this.isDown},middleButtonReleased:function(){return 1===this.button&&!this.isDown},backButtonReleased:function(){return 3===this.button&&!this.isDown},forwardButtonReleased:function(){return 4===this.button&&!this.isDown},getDistance:function(){return this.isDown?s(this.downX,this.downY,this.x,this.y):s(this.downX,this.downY,this.upX,this.upY)},getDistanceX:function(){return this.isDown?Math.abs(this.downX-this.x):Math.abs(this.downX-this.upX)},getDistanceY:function(){return this.isDown?Math.abs(this.downY-this.y):Math.abs(this.downY-this.upY)},getDuration:function(){return this.isDown?this.manager.time-this.downTime:this.upTime-this.downTime},getAngle:function(){return this.isDown?n(this.downX,this.downY,this.x,this.y):n(this.downX,this.downY,this.upX,this.upY)},getInterpolatedPosition:function(t,e){void 0===t&&(t=10),void 0===e&&(e=[]);for(var i=this.prevPosition.x,n=this.prevPosition.y,r=this.position.x,s=this.position.y,o=0;o0&&this.parentSize.height>0&&this.displaySize.setParent(this.parentSize),this.refresh()),t.events.on(a.PRE_STEP,this.step,this),t.events.once(a.READY,this.refresh,this),t.events.once(a.DESTROY,this.destroy,this),this.startListeners()},parseConfig:function(t){this.getParent(t),this.getParentBounds();var e=t.width,i=t.height,r=t.scaleMode,s=t.zoom,o=t.autoRound;if("string"==typeof e){var a=this.parentSize.width;0===a&&(a=window.innerWidth);var h=parseInt(e,10)/100;e=Math.floor(a*h)}if("string"==typeof i){var l=this.parentSize.height;0===l&&(l=window.innerHeight);var c=parseInt(i,10)/100;i=Math.floor(l*c)}this.scaleMode=r,this.autoRound=o,this.autoCenter=t.autoCenter,this.resizeInterval=t.resizeInterval,o&&(e=Math.floor(e),i=Math.floor(i)),this.gameSize.setSize(e,i),s===n.ZOOM.MAX_ZOOM&&(s=this.getMaxZoom()),this.zoom=s,1!==s&&(this._resetZoom=!0),this.baseSize.setSize(e,i),o&&(this.baseSize.width=Math.floor(this.baseSize.width),this.baseSize.height=Math.floor(this.baseSize.height)),t.minWidth>0&&this.displaySize.setMin(t.minWidth*s,t.minHeight*s),t.maxWidth>0&&this.displaySize.setMax(t.maxWidth*s,t.maxHeight*s),this.displaySize.setSize(e,i),this.orientation=u(e,i)},getParent:function(t){var e=t.parent;if(null!==e){if(this.parent=l(e),this.parentIsWindow=this.parent===document.body,t.expandParent&&t.scaleMode!==n.SCALE_MODE.NONE){var i=this.parent.getBoundingClientRect();(this.parentIsWindow||0===i.height)&&(document.documentElement.style.height="100%",document.body.style.height="100%",i=this.parent.getBoundingClientRect(),this.parentIsWindow||0!==i.height||(this.parent.style.overflow="hidden",this.parent.style.width="100%",this.parent.style.height="100%"))}t.fullscreenTarget&&!this.fullscreenTarget&&(this.fullscreenTarget=l(t.fullscreenTarget))}},getParentBounds:function(){if(!this.parent)return!1;var t=this.parentSize,e=this.parent.getBoundingClientRect();this.parentIsWindow&&this.game.device.os.iOS&&(e.height=h(!0));var i=e.width,n=e.height;return(t.width!==i||t.height!==n)&&(t.setSize(i,n),!0)},lockOrientation:function(t){var e=screen.lockOrientation||screen.mozLockOrientation||screen.msLockOrientation;return!!e&&e.call(screen,t)},setParentSize:function(t,e){return this.parentSize.setSize(t,e),this.refresh()},setGameSize:function(t,e){var i=this.autoRound;i&&(t=Math.floor(t),e=Math.floor(e));var n=this.width,r=this.height;return this.gameSize.resize(t,e),this.baseSize.resize(t,e),i&&(this.baseSize.width=Math.floor(this.baseSize.width),this.baseSize.height=Math.floor(this.baseSize.height)),this.displaySize.setAspectRatio(t/e),this.canvas.width=this.baseSize.width,this.canvas.height=this.baseSize.height,this.refresh(n,r)},resize:function(t,e){var i=this.zoom,n=this.autoRound;n&&(t=Math.floor(t),e=Math.floor(e));var r=this.width,s=this.height;this.gameSize.resize(t,e),this.baseSize.resize(t,e),n&&(this.baseSize.width=Math.floor(this.baseSize.width),this.baseSize.height=Math.floor(this.baseSize.height)),this.displaySize.setSize(t*i,e*i),this.canvas.width=this.baseSize.width,this.canvas.height=this.baseSize.height;var o=this.canvas.style,a=t*i,h=e*i;return n&&(a=Math.floor(a),h=Math.floor(h)),a===t&&h===e||(o.width=a+"px",o.height=h+"px"),this.refresh(r,s)},setZoom:function(t){return this.zoom=t,this._resetZoom=!0,this.refresh()},setMaxZoom:function(){return this.zoom=this.getMaxZoom(),this._resetZoom=!0,this.refresh()},refresh:function(t,e){void 0===t&&(t=this.width),void 0===e&&(e=this.height),this.updateScale(),this.updateBounds(),this.updateOrientation(),this.displayScale.set(this.baseSize.width/this.canvasBounds.width,this.baseSize.height/this.canvasBounds.height);var i=this.game.domContainer;if(i){this.baseSize.setCSS(i);var n=this.canvas.style,r=i.style;r.transform="scale("+this.displaySize.width/this.baseSize.width+","+this.displaySize.height/this.baseSize.height+")",r.marginLeft=n.marginLeft,r.marginTop=n.marginTop}return this.emit(o.RESIZE,this.gameSize,this.baseSize,this.displaySize,t,e),this},updateOrientation:function(){if(this._checkOrientation){this._checkOrientation=!1;var t=u(this.width,this.height);t!==this.orientation&&(this.orientation=t,this.emit(o.ORIENTATION_CHANGE,t))}},updateScale:function(){var t,e,i=this.canvas.style,r=this.gameSize.width,s=this.gameSize.height,o=this.zoom,a=this.autoRound;this.scaleMode===n.SCALE_MODE.NONE?(this.displaySize.setSize(r*o,s*o),t=this.displaySize.width,e=this.displaySize.height,a&&(t=Math.floor(t),e=Math.floor(e)),this._resetZoom&&(i.width=t+"px",i.height=e+"px",this._resetZoom=!1)):this.scaleMode===n.SCALE_MODE.RESIZE?(this.displaySize.setSize(this.parentSize.width,this.parentSize.height),this.gameSize.setSize(this.displaySize.width,this.displaySize.height),this.baseSize.setSize(this.displaySize.width,this.displaySize.height),t=this.displaySize.width,e=this.displaySize.height,a&&(t=Math.floor(t),e=Math.floor(e)),this.canvas.width=t,this.canvas.height=e):(this.displaySize.setSize(this.parentSize.width,this.parentSize.height),t=this.displaySize.width,e=this.displaySize.height,a&&(t=Math.floor(t),e=Math.floor(e)),i.width=t+"px",i.height=e+"px"),this.getParentBounds(),this.updateCenter()},getMaxZoom:function(){var t=f(this.parentSize.width,this.gameSize.width,0,!0),e=f(this.parentSize.height,this.gameSize.height,0,!0);return Math.max(Math.min(t,e),1)},updateCenter:function(){var t=this.autoCenter;if(t!==n.CENTER.NO_CENTER){var e=this.canvas,i=e.style,r=e.getBoundingClientRect(),s=r.width,o=r.height,a=Math.floor((this.parentSize.width-s)/2),h=Math.floor((this.parentSize.height-o)/2);t===n.CENTER.CENTER_HORIZONTALLY?h=0:t===n.CENTER.CENTER_VERTICALLY&&(a=0),i.marginLeft=a+"px",i.marginTop=h+"px"}},updateBounds:function(){var t=this.canvasBounds,e=this.canvas.getBoundingClientRect();t.x=e.left+(window.pageXOffset||0)-(document.documentElement.clientLeft||0),t.y=e.top+(window.pageYOffset||0)-(document.documentElement.clientTop||0),t.width=e.width,t.height=e.height},transformX:function(t){return(t-this.canvasBounds.left)*this.displayScale.x},transformY:function(t){return(t-this.canvasBounds.top)*this.displayScale.y},startFullscreen:function(t){void 0===t&&(t={navigationUI:"hide"});var e=this.fullscreen;if(e.available){if(!e.active){var i=this.getFullscreenTarget();e.keyboard?i[e.request](Element.ALLOW_KEYBOARD_INPUT):i[e.request](t)}}else this.emit(o.FULLSCREEN_UNSUPPORTED)},fullscreenSuccessHandler:function(){this.getParentBounds(),this.refresh(),this.emit(o.ENTER_FULLSCREEN)},fullscreenErrorHandler:function(t){this.removeFullscreenTarget(),this.emit(o.FULLSCREEN_FAILED,t)},getFullscreenTarget:function(){if(!this.fullscreenTarget){var t=document.createElement("div");t.style.margin="0",t.style.padding="0",t.style.width="100%",t.style.height="100%",this.fullscreenTarget=t,this._createdFullscreenTarget=!0}return this._createdFullscreenTarget&&(this.canvas.parentNode.insertBefore(this.fullscreenTarget,this.canvas),this.fullscreenTarget.appendChild(this.canvas)),this.fullscreenTarget},removeFullscreenTarget:function(){if(this._createdFullscreenTarget){var t=this.fullscreenTarget;if(t&&t.parentNode){var e=t.parentNode;e.insertBefore(this.canvas,t),e.removeChild(t)}}},stopFullscreen:function(){var t=this.fullscreen;if(!t.available)return this.emit(o.FULLSCREEN_UNSUPPORTED),!1;t.active&&document[t.cancel](),this.removeFullscreenTarget(),this.getParentBounds(),this.emit(o.LEAVE_FULLSCREEN),this.refresh()},toggleFullscreen:function(t){this.fullscreen.active?this.stopFullscreen():this.startFullscreen(t)},startListeners:function(){var t=this,e=this.listeners;e.orientationChange=function(){t.updateBounds(),t._checkOrientation=!0,t.dirty=!0},e.windowResize=function(){t.updateBounds(),t.dirty=!0},window.addEventListener("orientationchange",e.orientationChange,!1),window.addEventListener("resize",e.windowResize,!1),this.fullscreen.available&&(e.fullScreenChange=function(e){return t.onFullScreenChange(e)},e.fullScreenError=function(e){return t.onFullScreenError(e)},["webkit","moz",""].forEach((function(t){document.addEventListener(t+"fullscreenchange",e.fullScreenChange,!1),document.addEventListener(t+"fullscreenerror",e.fullScreenError,!1)})),document.addEventListener("MSFullscreenChange",e.fullScreenChange,!1),document.addEventListener("MSFullscreenError",e.fullScreenError,!1))},onFullScreenChange:function(){document.fullscreenElement||document.webkitFullscreenElement||document.msFullscreenElement||document.mozFullScreenElement?this.fullscreenSuccessHandler():this.stopFullscreen()},onFullScreenError:function(){this.removeFullscreenTarget()},step:function(t,e){this.parent&&(this._lastCheck+=e,(this.dirty||this._lastCheck>this.resizeInterval)&&(this.getParentBounds()&&this.refresh(),this.dirty=!1,this._lastCheck=0))},stopListeners:function(){var t=this.listeners;window.removeEventListener("orientationchange",t.orientationChange,!1),window.removeEventListener("resize",t.windowResize,!1),["webkit","moz",""].forEach((function(e){document.removeEventListener(e+"fullscreenchange",t.fullScreenChange,!1),document.removeEventListener(e+"fullscreenerror",t.fullScreenError,!1)})),document.removeEventListener("MSFullscreenChange",t.fullScreenChange,!1),document.removeEventListener("MSFullscreenError",t.fullScreenError,!1)},destroy:function(){this.removeAllListeners(),this.stopListeners(),this.game=null,this.canvas=null,this.canvasBounds=null,this.parent=null,this.fullscreenTarget=null,this.parentSize.destroy(),this.gameSize.destroy(),this.baseSize.destroy(),this.displaySize.destroy()},isFullscreen:{get:function(){return this.fullscreen.active}},width:{get:function(){return this.gameSize.width}},height:{get:function(){return this.gameSize.height}},isPortrait:{get:function(){return this.orientation===n.ORIENTATION.PORTRAIT}},isLandscape:{get:function(){return this.orientation===n.ORIENTATION.LANDSCAPE}},isGamePortrait:{get:function(){return this.height>this.width}},isGameLandscape:{get:function(){return this.width>this.height}}});t.exports=g},function(t,e,i){var n=i(18),r=i(0),s=i(76),o=i(3),a=new r({initialize:function(t,e,i,n){void 0===t&&(t=0),void 0===e&&(e=t),void 0===i&&(i=0),void 0===n&&(n=null),this._width=t,this._height=e,this._parent=n,this.aspectMode=i,this.aspectRatio=0===e?1:t/e,this.minWidth=0,this.minHeight=0,this.maxWidth=Number.MAX_VALUE,this.maxHeight=Number.MAX_VALUE,this.snapTo=new o},setAspectMode:function(t){return void 0===t&&(t=0),this.aspectMode=t,this.setSize(this._width,this._height)},setSnap:function(t,e){return void 0===t&&(t=0),void 0===e&&(e=t),this.snapTo.set(t,e),this.setSize(this._width,this._height)},setParent:function(t){return this._parent=t,this.setSize(this._width,this._height)},setMin:function(t,e){return void 0===t&&(t=0),void 0===e&&(e=t),this.minWidth=n(t,0,this.maxWidth),this.minHeight=n(e,0,this.maxHeight),this.setSize(this._width,this._height)},setMax:function(t,e){return void 0===t&&(t=Number.MAX_VALUE),void 0===e&&(e=t),this.maxWidth=n(t,this.minWidth,Number.MAX_VALUE),this.maxHeight=n(e,this.minHeight,Number.MAX_VALUE),this.setSize(this._width,this._height)},setSize:function(t,e){switch(void 0===t&&(t=0),void 0===e&&(e=t),this.aspectMode){case a.NONE:this._width=this.getNewWidth(s(t,this.snapTo.x)),this._height=this.getNewHeight(s(e,this.snapTo.y)),this.aspectRatio=0===this._height?1:this._width/this._height;break;case a.WIDTH_CONTROLS_HEIGHT:this._width=this.getNewWidth(s(t,this.snapTo.x)),this._height=this.getNewHeight(this._width*(1/this.aspectRatio),!1);break;case a.HEIGHT_CONTROLS_WIDTH:this._height=this.getNewHeight(s(e,this.snapTo.y)),this._width=this.getNewWidth(this._height*this.aspectRatio,!1);break;case a.FIT:this.constrain(t,e,!0);break;case a.ENVELOP:this.constrain(t,e,!1)}return this},setAspectRatio:function(t){return this.aspectRatio=t,this.setSize(this._width,this._height)},resize:function(t,e){return this._width=this.getNewWidth(s(t,this.snapTo.x)),this._height=this.getNewHeight(s(e,this.snapTo.y)),this.aspectRatio=0===this._height?1:this._width/this._height,this},getNewWidth:function(t,e){return void 0===e&&(e=!0),t=n(t,this.minWidth,this.maxWidth),e&&this._parent&&t>this._parent.width&&(t=Math.max(this.minWidth,this._parent.width)),t},getNewHeight:function(t,e){return void 0===e&&(e=!0),t=n(t,this.minHeight,this.maxHeight),e&&this._parent&&t>this._parent.height&&(t=Math.max(this.minHeight,this._parent.height)),t},constrain:function(t,e,i){void 0===t&&(t=0),void 0===e&&(e=t),void 0===i&&(i=!0),t=this.getNewWidth(t),e=this.getNewHeight(e);var n=this.snapTo,r=0===e?1:t/e;return i&&this.aspectRatio>r||!i&&this.aspectRatio0&&(t=(e=s(e,n.y))*this.aspectRatio)):(i&&this.aspectRatior)&&(t=(e=s(e,n.y))*this.aspectRatio,n.x>0&&(e=(t=s(t,n.x))*(1/this.aspectRatio))),this._width=t,this._height=e,this},fitTo:function(t,e){return this.constrain(t,e,!0)},envelop:function(t,e){return this.constrain(t,e,!1)},setWidth:function(t){return this.setSize(t,this._height)},setHeight:function(t){return this.setSize(this._width,t)},toString:function(){return"[{ Size (width="+this._width+" height="+this._height+" aspectRatio="+this.aspectRatio+" aspectMode="+this.aspectMode+") }]"},setCSS:function(t){t&&t.style&&(t.style.width=this._width+"px",t.style.height=this._height+"px")},copy:function(t){return t.setAspectMode(this.aspectMode),t.aspectRatio=this.aspectRatio,t.setSize(this.width,this.height)},destroy:function(){this._parent=null,this.snapTo=null},width:{get:function(){return this._width},set:function(t){this.setSize(t,this._height)}},height:{get:function(){return this._height},set:function(t){this.setSize(this._width,t)}}});a.NONE=0,a.WIDTH_CONTROLS_HEIGHT=1,a.HEIGHT_CONTROLS_WIDTH=2,a.FIT=3,a.ENVELOP=4,t.exports=a},function(t,e,i){var n=i(0),r=i(144),s=i(20),o=i(22),a=i(6),h=i(95),l=i(1),u=i(418),c=i(204),d=new n({initialize:function(t,e){if(this.game=t,this.keys={},this.scenes=[],this._pending=[],this._start=[],this._queue=[],this._data={},this.isProcessing=!1,this.isBooted=!1,this.customViewports=0,e){Array.isArray(e)||(e=[e]);for(var i=0;i-1&&(delete this.keys[n],this.scenes.splice(i,1),this._start.indexOf(n)>-1&&(i=this._start.indexOf(n),this._start.splice(i,1)),e.sys.destroy())}return this},bootScene:function(t){var e,i=t.sys,n=i.settings;i.sceneUpdate=l,t.init&&(t.init.call(t,n.data),n.status=r.INIT,n.isTransition&&i.events.emit(s.TRANSITION_INIT,n.transitionFrom,n.transitionDuration)),i.load&&(e=i.load).reset(),e&&t.preload?(t.preload.call(t),0===e.list.size?this.create(t):(n.status=r.LOADING,e.once(h.COMPLETE,this.loadComplete,this),e.start())):this.create(t)},loadComplete:function(t){this.create(t.scene)},payloadComplete:function(t){this.bootScene(t.scene)},update:function(t,e){this.processQueue(),this.isProcessing=!0;for(var i=this.scenes.length-1;i>=0;i--){var n=this.scenes[i].sys;n.settings.status>r.START&&n.settings.status<=r.RUNNING&&n.step(t,e)}},render:function(t){for(var e=0;e=r.LOADING&&i.settings.status0){var i=this.getScene(t);this.scenes.splice(e,1),this.scenes.unshift(i)}}return this},moveDown:function(t){if(this.isProcessing)this._queue.push({op:"moveDown",keyA:t,keyB:null});else{var e=this.getIndex(t);if(e>0){var i=e-1,n=this.getScene(t),r=this.getAt(i);this.scenes[e]=r,this.scenes[i]=n}}return this},moveUp:function(t){if(this.isProcessing)this._queue.push({op:"moveUp",keyA:t,keyB:null});else{var e=this.getIndex(t);if(e=s.x&&t=s.y&&e=s.x&&t=s.y&&e-1){var o=this.context.getImageData(t,e,1,1);o.data[0]=i,o.data[1]=n,o.data[2]=r,o.data[3]=s,this.context.putImageData(o,t,e)}return this},putData:function(t,e,i,n,r,s,o){return void 0===n&&(n=0),void 0===r&&(r=0),void 0===s&&(s=t.width),void 0===o&&(o=t.height),this.context.putImageData(t,e,i,n,r,s,o),this},getData:function(t,e,i,n){return t=r(Math.floor(t),0,this.width-1),e=r(Math.floor(e),0,this.height-1),i=r(i,1,this.width-t),n=r(n,1,this.height-e),this.context.getImageData(t,e,i,n)},getPixel:function(t,e,i){i||(i=new s);var n=this.getIndex(t,e);if(n>-1){var r=this.data,o=r[n+0],a=r[n+1],h=r[n+2],l=r[n+3];i.setTo(o,a,h,l)}return i},getPixels:function(t,e,i,n){void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i=this.width),void 0===n&&(n=i),t=Math.abs(Math.round(t)),e=Math.abs(Math.round(e));for(var o=r(t,0,this.width),a=r(t+i,0,this.width),h=r(e,0,this.height),l=r(e+n,0,this.height),u=new s,c=[],d=h;d0||!n.prototype.pause.call(this)||(this.currentConfig.seek=this.audio.currentTime-(this.currentMarker?this.currentMarker.start:0),this.stopAndReleaseAudioTag(),this.emit(s.PAUSE,this),0))},resume:function(){return!(this.manager.isLocked(this,"resume")||this.startTime>0||!n.prototype.resume.call(this)||!this.pickAndPlayAudioTag()||(this.emit(s.RESUME,this),0))},stop:function(){return!this.manager.isLocked(this,"stop")&&!!n.prototype.stop.call(this)&&(this.stopAndReleaseAudioTag(),this.emit(s.STOP,this),!0)},pickAndPlayAudioTag:function(){if(!this.pickAudioTag())return this.reset(),!1;var t=this.currentConfig.seek,e=this.currentConfig.delay,i=(this.currentMarker?this.currentMarker.start:0)+t;return this.previousTime=i,this.audio.currentTime=i,this.applyConfig(),0===e?(this.startTime=0,this.audio.paused&&this.playCatchPromise()):(this.startTime=window.performance.now()+1e3*e,this.audio.paused||this.audio.pause()),this.resetConfig(),!0},pickAudioTag:function(){if(this.audio)return!0;for(var t=0;t0)this.startTime=i-this.manager.loopEndOffset?(this.audio.currentTime=e+Math.max(0,n-i),n=this.audio.currentTime):n=i)return this.reset(),this.stopAndReleaseAudioTag(),void this.emit(s.COMPLETE,this);this.previousTime=n}},destroy:function(){n.prototype.destroy.call(this),this.tags=null,this.audio&&this.stopAndReleaseAudioTag()},updateMute:function(){this.audio&&(this.audio.muted=this.currentConfig.mute||this.manager.mute)},updateVolume:function(){this.audio&&(this.audio.volume=o(this.currentConfig.volume*this.manager.volume,0,1))},calculateRate:function(){n.prototype.calculateRate.call(this),this.audio&&(this.audio.playbackRate=this.totalRate)},mute:{get:function(){return this.currentConfig.mute},set:function(t){this.currentConfig.mute=t,this.manager.isLocked(this,"mute",t)||(this.updateMute(),this.emit(s.MUTE,this,t))}},setMute:function(t){return this.mute=t,this},volume:{get:function(){return this.currentConfig.volume},set:function(t){this.currentConfig.volume=t,this.manager.isLocked(this,"volume",t)||(this.updateVolume(),this.emit(s.VOLUME,this,t))}},setVolume:function(t){return this.volume=t,this},rate:{get:function(){return this.currentConfig.rate},set:function(t){this.currentConfig.rate=t,this.manager.isLocked(this,s.RATE,t)||(this.calculateRate(),this.emit(s.RATE,this,t))}},setRate:function(t){return this.rate=t,this},detune:{get:function(){return this.currentConfig.detune},set:function(t){this.currentConfig.detune=t,this.manager.isLocked(this,s.DETUNE,t)||(this.calculateRate(),this.emit(s.DETUNE,this,t))}},setDetune:function(t){return this.detune=t,this},seek:{get:function(){return this.isPlaying?this.audio.currentTime-(this.currentMarker?this.currentMarker.start:0):this.isPaused?this.currentConfig.seek:0},set:function(t){this.manager.isLocked(this,"seek",t)||this.startTime>0||(this.isPlaying||this.isPaused)&&(t=Math.min(Math.max(0,t),this.duration),this.isPlaying?(this.previousTime=t,this.audio.currentTime=t):this.isPaused&&(this.currentConfig.seek=t),this.emit(s.SEEK,this,t))}},setSeek:function(t){return this.seek=t,this},loop:{get:function(){return this.currentConfig.loop},set:function(t){this.currentConfig.loop=t,this.manager.isLocked(this,"loop",t)||(this.audio&&(this.audio.loop=t),this.emit(s.LOOP,this,t))}},setLoop:function(t){return this.loop=t,this},pan:{get:function(){return this.currentConfig.pan},set:function(t){this.currentConfig.pan=t,this.emit(s.PAN,this,t)}},setPan:function(t){return this.pan=t,this}});t.exports=a},function(t,e,i){var n=i(145),r=i(0),s=i(9),o=i(431),a=i(1),h=new r({Extends:s,initialize:function(t){s.call(this),this.game=t,this.sounds=[],this.mute=!1,this.volume=1,this.rate=1,this.detune=0,this.pauseOnBlur=!0,this.locked=!1},add:function(t,e){var i=new o(this,t,e);return this.sounds.push(i),i},addAudioSprite:function(t,e){var i=this.add(t,e);return i.spritemap={},i},play:function(t,e){return!1},playAudioSprite:function(t,e,i){return!1},remove:function(t){return n.prototype.remove.call(this,t)},removeByKey:function(t){return n.prototype.removeByKey.call(this,t)},pauseAll:a,resumeAll:a,stopAll:a,update:a,setRate:a,setDetune:a,setMute:a,setVolume:a,forEachActiveSound:function(t,e){n.prototype.forEachActiveSound.call(this,t,e)},destroy:function(){n.prototype.destroy.call(this)}});t.exports=h},function(t,e,i){var n=i(146),r=i(0),s=i(9),o=i(17),a=function(){return!1},h=function(){return this},l=new r({Extends:s,initialize:function(t,e,i){void 0===i&&(i={}),s.call(this),this.manager=t,this.key=e,this.isPlaying=!1,this.isPaused=!1,this.totalRate=1,this.duration=0,this.totalDuration=0,this.config=o({mute:!1,volume:1,rate:1,detune:0,seek:0,loop:!1,delay:0,pan:0},i),this.currentConfig=this.config,this.mute=!1,this.volume=1,this.rate=1,this.detune=0,this.seek=0,this.loop=!1,this.pan=0,this.markers={},this.currentMarker=null,this.pendingRemove=!1},addMarker:a,updateMarker:a,removeMarker:function(){return null},play:a,pause:a,resume:a,stop:a,destroy:function(){n.prototype.destroy.call(this)},setMute:h,setVolume:h,setRate:h,setDetune:h,setSeek:h,setLoop:h,setPan:h});t.exports=l},function(t,e,i){var n=i(433),r=i(145),s=i(0),o=i(70),a=i(22),h=i(434),l=new s({Extends:r,initialize:function(t){this.context=this.createAudioContext(t),this.masterMuteNode=this.context.createGain(),this.masterVolumeNode=this.context.createGain(),this.masterMuteNode.connect(this.masterVolumeNode),this.masterVolumeNode.connect(this.context.destination),this.destination=this.masterMuteNode,this.locked="suspended"===this.context.state&&("ontouchstart"in window||"onclick"in window),r.call(this,t),this.locked&&t.isBooted?this.unlock():t.events.once(a.BOOT,this.unlock,this)},createAudioContext:function(t){var e=t.config.audio;return e.context?(e.context.resume(),e.context):window.hasOwnProperty("AudioContext")?new AudioContext:window.hasOwnProperty("webkitAudioContext")?new window.webkitAudioContext:void 0},setAudioContext:function(t){return this.context&&this.context.close(),this.masterMuteNode&&this.masterMuteNode.disconnect(),this.masterVolumeNode&&this.masterVolumeNode.disconnect(),this.context=t,this.masterMuteNode=t.createGain(),this.masterVolumeNode=t.createGain(),this.masterMuteNode.connect(this.masterVolumeNode),this.masterVolumeNode.connect(t.destination),this.destination=this.masterMuteNode,this},add:function(t,e){var i=new h(this,t,e);return this.sounds.push(i),i},decodeAudio:function(t,e){var i;i=Array.isArray(t)?t:[{key:t,data:e}];for(var r=this.game.cache.audio,s=i.length,a=0;a>4,u[h++]=(15&i)<<4|r>>2,u[h++]=(3&r)<<6|63&s;return l}},function(t,e,i){var n=i(146),r=i(0),s=i(70),o=new r({Extends:n,initialize:function(t,e,i){if(void 0===i&&(i={}),this.audioBuffer=t.game.cache.audio.get(e),!this.audioBuffer)throw new Error('Audio key "'+e+'" missing from cache');this.source=null,this.loopSource=null,this.muteNode=t.context.createGain(),this.volumeNode=t.context.createGain(),this.pannerNode=null,this.playTime=0,this.startTime=0,this.loopTime=0,this.rateUpdates=[],this.hasEnded=!1,this.hasLooped=!1,this.muteNode.connect(this.volumeNode),t.context.createStereoPanner?(this.pannerNode=t.context.createStereoPanner(),this.volumeNode.connect(this.pannerNode),this.pannerNode.connect(t.destination)):this.volumeNode.connect(t.destination),this.duration=this.audioBuffer.duration,this.totalDuration=this.audioBuffer.duration,n.call(this,t,e,i)},play:function(t,e){return!!n.prototype.play.call(this,t,e)&&(this.stopAndRemoveBufferSource(),this.createAndStartBufferSource(),this.emit(s.PLAY,this),!0)},pause:function(){return!(this.manager.context.currentTime-1;s--)n[r][s]=t[s][r]}return n}},function(t,e){function i(t,e,i){var n=t[e];t[e]=t[i],t[i]=n}function n(t,e){return te?1:0}var r=function(t,e,s,o,a){for(void 0===s&&(s=0),void 0===o&&(o=t.length-1),void 0===a&&(a=n);o>s;){if(o-s>600){var h=o-s+1,l=e-s+1,u=Math.log(h),c=.5*Math.exp(2*u/3),d=.5*Math.sqrt(u*c*(h-c)/h)*(l-h/2<0?-1:1),p=Math.max(s,Math.floor(e-l*c/h+d)),f=Math.min(o,Math.floor(e+(h-l)*c/h+d));r(t,e,p,f,a)}var m=t[e],g=s,v=o;for(i(t,s,e),a(t[o],m)>0&&i(t,s,o);g0;)v--}0===a(t[s],m)?i(t,s,v):i(t,++v,o),v<=e&&(s=v+1),e<=v&&(o=v-1)}};t.exports=r},function(t,e,i){var n=i(6),r=i(131),s=function(t,e,i){for(var n=[],r=0;r0?r.playAfterDelay(p,d):r.load(p)}}return t}},function(t,e,i){var n=i(0),r=i(109),s=new n({initialize:function(t,e,i,n,r){this.parent=t,this.x=e,this.y=i,this.frame=n,this.data={},this.tint=16777215,this._visible=r,this._alpha=1,this.flipX=!1,this.flipY=!1},setFrame:function(t){return void 0===t?this.frame=this.parent.frame:t instanceof r&&t.texture===this.parent.texture?this.frame=t:this.frame=this.parent.texture.get(t),this},resetFlip:function(){return this.flipX=!1,this.flipY=!1,this},reset:function(t,e,i){return this.x=t,this.y=e,this.flipX=!1,this.flipY=!1,this._alpha=1,this._visible=!0,this.parent.dirty=!0,i&&this.setFrame(i),this},setPosition:function(t,e){return this.x=t,this.y=e,this},setFlipX:function(t){return this.flipX=t,this},setFlipY:function(t){return this.flipY=t,this},setFlip:function(t,e){return this.flipX=t,this.flipY=e,this},setVisible:function(t){return this.visible=t,this},setAlpha:function(t){return this.alpha=t,this},setTint:function(t){return this.tint=t,this},destroy:function(){this.parent.dirty=!0,this.parent.children.remove(this),this.parent=void 0,this.frame=void 0,this.data=void 0},visible:{get:function(){return this._visible},set:function(t){this.parent.dirty|=this._visible!==t,this._visible=t}},alpha:{get:function(){return this._alpha},set:function(t){this.parent.dirty|=this._alpha>0!=t>0,this._alpha=t}}});t.exports=s},function(t,e,i){var n=i(10);t.exports=function(t,e,i){void 0===i&&(i=new n);var r=Math.min(t.x,e.x),s=Math.min(t.y,e.y),o=Math.max(t.right,e.right)-r,a=Math.max(t.bottom,e.bottom)-s;return i.setTo(r,s,o,a)}},function(t,e,i){var n=i(0),r=i(11),s=i(1055),o=i(15),a=i(7),h=i(202),l=i(20),u=i(140),c=new n({Extends:o,Mixins:[r.AlphaSingle,r.BlendMode,r.Depth,r.Origin,r.ScrollFactor,r.Transform,r.Visible,s],initialize:function(t,e,i,n,r,s){o.call(this,t,"DOMElement"),this.parent=t.sys.game.domContainer,this.cache=t.sys.cache.html,this.node,this.transformOnly=!1,this.skewX=0,this.skewY=0,this.rotate3d=new u,this.rotate3dAngle="deg",this.pointerEvents="auto",this.width=0,this.height=0,this.displayWidth=0,this.displayHeight=0,this.handler=this.dispatchNativeEvent.bind(this),this.setPosition(e,i),"string"==typeof n?"#"===n[0]?this.setElement(n.substr(1),r,s):this.createElement(n,r,s):n&&this.setElement(n,r,s),t.sys.events.on(l.SLEEP,this.handleSceneEvent,this),t.sys.events.on(l.WAKE,this.handleSceneEvent,this)},addedToScene:function(){this.scene.sys.updateList.add(this)},removedFromScene:function(){this.scene.sys.updateList.remove(this)},handleSceneEvent:function(t){var e=this.node,i=e.style;e&&(i.display=t.settings.visible?"block":"none")},setSkew:function(t,e){return void 0===t&&(t=0),void 0===e&&(e=t),this.skewX=t,this.skewY=e,this},setPerspective:function(t){return this.parent.style.perspective=t+"px",this},perspective:{get:function(){return parseFloat(this.parent.style.perspective)},set:function(t){this.parent.style.perspective=t+"px"}},addListener:function(t){if(this.node){t=t.split(" ");for(var e=0;e0&&(e=n(t)/i);for(var h=0;h>>16,v=(65280&p)>>>8,y=255&p,u.strokeStyle="rgba("+g+","+v+","+y+","+c+")",u.lineWidth=m,x+=3;break;case n.FILL_STYLE:f=h[x+1],d=h[x+2],g=(16711680&f)>>>16,v=(65280&f)>>>8,y=255&f,u.fillStyle="rgba("+g+","+v+","+y+","+d+")",x+=2;break;case n.BEGIN_PATH:u.beginPath();break;case n.CLOSE_PATH:u.closePath();break;case n.FILL_PATH:a||u.fill();break;case n.STROKE_PATH:a||u.stroke();break;case n.FILL_RECT:a?u.rect(h[x+1],h[x+2],h[x+3],h[x+4]):u.fillRect(h[x+1],h[x+2],h[x+3],h[x+4]),x+=4;break;case n.FILL_TRIANGLE:u.beginPath(),u.moveTo(h[x+1],h[x+2]),u.lineTo(h[x+3],h[x+4]),u.lineTo(h[x+5],h[x+6]),u.closePath(),a||u.fill(),x+=6;break;case n.STROKE_TRIANGLE:u.beginPath(),u.moveTo(h[x+1],h[x+2]),u.lineTo(h[x+3],h[x+4]),u.lineTo(h[x+5],h[x+6]),u.closePath(),a||u.stroke(),x+=6;break;case n.LINE_TO:u.lineTo(h[x+1],h[x+2]),x+=2;break;case n.MOVE_TO:u.moveTo(h[x+1],h[x+2]),x+=2;break;case n.LINE_FX_TO:u.lineTo(h[x+1],h[x+2]),x+=5;break;case n.MOVE_FX_TO:u.moveTo(h[x+1],h[x+2]),x+=5;break;case n.SAVE:u.save();break;case n.RESTORE:u.restore();break;case n.TRANSLATE:u.translate(h[x+1],h[x+2]),x+=2;break;case n.SCALE:u.scale(h[x+1],h[x+2]),x+=2;break;case n.ROTATE:u.rotate(h[x+1]),x+=1;break;case n.GRADIENT_FILL_STYLE:x+=5;break;case n.GRADIENT_LINE_STYLE:x+=6}u.restore()}}},function(t,e,i){var n=i(0),r=i(137),s=i(80),o=i(2),a=i(68),h=new n({initialize:function(t,e,i,n){void 0===n&&(n=!1),this.propertyKey=e,this.propertyValue=i,this.defaultValue=i,this.steps=0,this.counter=0,this.start=0,this.end=0,this.ease,this.emitOnly=n,this.onEmit=this.defaultEmit,this.onUpdate=this.defaultUpdate,this.loadConfig(t)},loadConfig:function(t,e){void 0===t&&(t={}),e&&(this.propertyKey=e),this.propertyValue=o(t,this.propertyKey,this.defaultValue),this.setMethods(),this.emitOnly&&(this.onUpdate=this.defaultUpdate)},toJSON:function(){return this.propertyValue},onChange:function(t){return this.propertyValue=t,this.setMethods()},setMethods:function(){var t=this.propertyValue,e=typeof t;if(this.onEmit=this.defaultEmit,this.onUpdate=this.defaultUpdate,"number"===e)this.onEmit=this.staticValueEmit,this.onUpdate=this.staticValueUpdate;else if(Array.isArray(t))this.onEmit=this.randomStaticValueEmit;else if("function"===e)this.emitOnly?this.onEmit=t:this.onUpdate=t;else if("object"===e&&this.hasBoth(t,"start","end")){this.start=t.start,this.end=t.end;var i=this.has(t,"random");if(i&&(this.onEmit=this.randomRangedValueEmit),this.has(t,"steps"))this.steps=t.steps,this.counter=this.start,this.onEmit=this.steppedEmit;else{var n=this.has(t,"ease")?t.ease:"Linear";this.ease=s(n,t.easeParams),i||(this.onEmit=this.easedValueEmit),this.onUpdate=this.easeValueUpdate}}else if("object"===e&&this.hasBoth(t,"min","max"))this.start=t.min,this.end=t.max,this.onEmit=this.randomRangedValueEmit;else if("object"===e&&this.has(t,"random")){var r=t.random;Array.isArray(r)&&(this.start=r[0],this.end=r[1]),this.onEmit=this.randomRangedValueEmit}else"object"===e&&this.hasEither(t,"onEmit","onUpdate")&&(this.has(t,"onEmit")&&(this.onEmit=t.onEmit),this.has(t,"onUpdate")&&(this.onUpdate=t.onUpdate));return this},has:function(t,e){return t.hasOwnProperty(e)},hasBoth:function(t,e,i){return t.hasOwnProperty(e)&&t.hasOwnProperty(i)},hasEither:function(t,e,i){return t.hasOwnProperty(e)||t.hasOwnProperty(i)},defaultEmit:function(t,e,i){return i},defaultUpdate:function(t,e,i,n){return n},staticValueEmit:function(){return this.propertyValue},staticValueUpdate:function(){return this.propertyValue},randomStaticValueEmit:function(){var t=Math.floor(Math.random()*this.propertyValue.length);return this.propertyValue[t]},randomRangedValueEmit:function(t,e){var i=r(this.start,this.end);return t&&t.data[e]&&(t.data[e].min=i),i},steppedEmit:function(){var t=this.counter,e=this.counter+(this.end-this.start)/this.steps;return this.counter=a(e,this.start,this.end),t},easedValueEmit:function(t,e){if(t&&t.data[e]){var i=t.data[e];i.min=this.start,i.max=this.end}return this.start},easeValueUpdate:function(t,e,i){var n=t.data[e];return(n.max-n.min)*this.ease(i)+n.min}});t.exports=h},function(t,e,i){var n=i(0),r=i(2),s=new n({initialize:function(t,e,i,n,s){if("object"==typeof t){var o=t;t=r(o,"x",0),e=r(o,"y",0),i=r(o,"power",0),n=r(o,"epsilon",100),s=r(o,"gravity",50)}else void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i=0),void 0===n&&(n=100),void 0===s&&(s=50);this.x=t,this.y=e,this.active=!0,this._gravity=s,this._power=0,this._epsilon=0,this.power=i,this.epsilon=n},update:function(t,e){var i=this.x-t.x,n=this.y-t.y,r=i*i+n*n;if(0!==r){var s=Math.sqrt(r);r0},resetPosition:function(){this.x=0,this.y=0},fire:function(t,e){var i=this.emitter;this.frame=i.getFrame(),i.emitZone&&i.emitZone.getPoint(this),this.x+=void 0===t?i.x.onEmit(this,"x"):t,this.y+=void 0===e?i.y.onEmit(this,"y"):e,this.life=i.lifespan.onEmit(this,"lifespan"),this.lifeCurrent=this.life,this.lifeT=0;var n=i.speedX.onEmit(this,"speedX"),o=i.speedY?i.speedY.onEmit(this,"speedY"):n;if(i.radial){var a=r(i.angle.onEmit(this,"angle"));this.velocityX=Math.cos(a)*Math.abs(n),this.velocityY=Math.sin(a)*Math.abs(o)}else if(i.moveTo){var h=i.moveToX.onEmit(this,"moveToX"),l=i.moveToY?i.moveToY.onEmit(this,"moveToY"):h,u=Math.atan2(l-this.y,h-this.x),c=s(this.x,this.y,h,l)/(this.life/1e3);this.velocityX=Math.cos(u)*c,this.velocityY=Math.sin(u)*c}else this.velocityX=n,this.velocityY=o;i.acceleration&&(this.accelerationX=i.accelerationX.onEmit(this,"accelerationX"),this.accelerationY=i.accelerationY.onEmit(this,"accelerationY")),this.maxVelocityX=i.maxVelocityX.onEmit(this,"maxVelocityX"),this.maxVelocityY=i.maxVelocityY.onEmit(this,"maxVelocityY"),this.delayCurrent=i.delay.onEmit(this,"delay"),this.scaleX=i.scaleX.onEmit(this,"scaleX"),this.scaleY=i.scaleY?i.scaleY.onEmit(this,"scaleY"):this.scaleX,this.angle=i.rotate.onEmit(this,"rotate"),this.rotation=r(this.angle),this.bounce=i.bounce.onEmit(this,"bounce"),this.alpha=i.alpha.onEmit(this,"alpha"),this.tint=i.tint.onEmit(this,"tint")},computeVelocity:function(t,e,i,n){var r=this.velocityX,s=this.velocityY,o=this.accelerationX,a=this.accelerationY,h=this.maxVelocityX,l=this.maxVelocityY;r+=t.gravityX*i,s+=t.gravityY*i,o&&(r+=o*i),a&&(s+=a*i),r>h?r=h:r<-h&&(r=-h),s>l?s=l:s<-l&&(s=-l),this.velocityX=r,this.velocityY=s;for(var u=0;ue.right&&t.collideRight&&(this.x=e.right,this.velocityX*=i),this.ye.bottom&&t.collideBottom&&(this.y=e.bottom,this.velocityY*=i)},update:function(t,e,i){if(this.delayCurrent>0)return this.delayCurrent-=t,!1;var n=this.emitter,s=1-this.lifeCurrent/this.life;return this.lifeT=s,this.computeVelocity(n,t,e,i),this.x+=this.velocityX*e,this.y+=this.velocityY*e,n.bounds&&this.checkBounds(n),n.deathZone&&n.deathZone.willKill(this)?(this.lifeCurrent=0,!0):(this.scaleX=n.scaleX.onUpdate(this,"scaleX",s,this.scaleX),n.scaleY?this.scaleY=n.scaleY.onUpdate(this,"scaleY",s,this.scaleY):this.scaleY=this.scaleX,this.angle=n.rotate.onUpdate(this,"rotate",s,this.angle),this.rotation=r(this.angle),this.alpha=n.alpha.onUpdate(this,"alpha",s,this.alpha),this.tint=n.tint.onUpdate(this,"tint",s,this.tint),this.lifeCurrent-=t,this.lifeCurrent<=0)}});t.exports=o},function(t,e,i){var n=i(35),r=i(0),s=i(11),o=i(453),a=i(454),h=i(449),l=i(2),u=i(210),c=i(455),d=i(126),p=i(451),f=i(456),m=i(10),g=i(79),v=i(3),y=i(68),x=new r({Mixins:[s.BlendMode,s.Mask,s.ScrollFactor,s.Visible],initialize:function(t,e){this.manager=t,this.texture=t.texture,this.frames=[t.defaultFrame],this.defaultFrame=t.defaultFrame,this.configFastMap=["active","blendMode","collideBottom","collideLeft","collideRight","collideTop","deathCallback","deathCallbackScope","emitCallback","emitCallbackScope","follow","frequency","gravityX","gravityY","maxParticles","name","on","particleBringToTop","particleClass","radial","timeScale","trackVisible","visible"],this.configOpMap=["accelerationX","accelerationY","angle","alpha","bounce","delay","lifespan","maxVelocityX","maxVelocityY","moveToX","moveToY","quantity","rotate","scaleX","scaleY","speedX","speedY","tint","x","y"],this.name="",this.particleClass=p,this.x=new h(e,"x",0,!0),this.y=new h(e,"y",0,!0),this.radial=!0,this.gravityX=0,this.gravityY=0,this.acceleration=!1,this.accelerationX=new h(e,"accelerationX",0,!0),this.accelerationY=new h(e,"accelerationY",0,!0),this.maxVelocityX=new h(e,"maxVelocityX",1e4,!0),this.maxVelocityY=new h(e,"maxVelocityY",1e4,!0),this.speedX=new h(e,"speedX",0,!0),this.speedY=new h(e,"speedY",0,!0),this.moveTo=!1,this.moveToX=new h(e,"moveToX",0,!0),this.moveToY=new h(e,"moveToY",0,!0),this.bounce=new h(e,"bounce",0,!0),this.scaleX=new h(e,"scaleX",1),this.scaleY=new h(e,"scaleY",1),this.tint=new h(e,"tint",16777215),this.alpha=new h(e,"alpha",1),this.lifespan=new h(e,"lifespan",1e3,!0),this.angle=new h(e,"angle",{min:0,max:360},!0),this.rotate=new h(e,"rotate",0),this.emitCallback=null,this.emitCallbackScope=null,this.deathCallback=null,this.deathCallbackScope=null,this.maxParticles=0,this.quantity=new h(e,"quantity",1,!0),this.delay=new h(e,"delay",0,!0),this.frequency=0,this.on=!0,this.particleBringToTop=!0,this.timeScale=1,this.emitZone=null,this.deathZone=null,this.bounds=null,this.collideLeft=!0,this.collideRight=!0,this.collideTop=!0,this.collideBottom=!0,this.active=!0,this.visible=!0,this.blendMode=n.NORMAL,this.follow=null,this.followOffset=new v,this.trackVisible=!1,this.currentFrame=0,this.randomFrame=!0,this.frameQuantity=1,this.dead=[],this.alive=[],this._counter=0,this._frameCounter=0,e&&this.fromJSON(e)},fromJSON:function(t){if(!t)return this;var e=0,i="";for(e=0;e0&&this.getParticleCount()===this.maxParticles},onParticleEmit:function(t,e){return void 0===t?(this.emitCallback=null,this.emitCallbackScope=null):"function"==typeof t&&(this.emitCallback=t,e&&(this.emitCallbackScope=e)),this},onParticleDeath:function(t,e){return void 0===t?(this.deathCallback=null,this.deathCallbackScope=null):"function"==typeof t&&(this.deathCallback=t,e&&(this.deathCallbackScope=e)),this},killAll:function(){for(var t=this.dead,e=this.alive;e.length>0;)t.push(e.pop());return this},forEachAlive:function(t,e){for(var i=this.alive,n=i.length,r=0;r0){var u=this.deathCallback,c=this.deathCallbackScope;for(o=h-1;o>=0;o--){var d=a[o];r.splice(d.index,1),s.push(d.particle),u&&u.call(c,d.particle),d.particle.resetPosition()}}this.on&&(0===this.frequency?this.emitParticle():this.frequency>0&&(this._counter-=e,this._counter<=0&&(this.emitParticle(),this._counter=this.frequency-Math.abs(this._counter))))},depthSortCallback:function(t,e){return t.y-e.y}});t.exports=x},function(t,e,i){var n=new(i(0))({initialize:function(t,e){this.source=t,this.killOnEnter=e},willKill:function(t){var e=this.source.contains(t.x,t.y);return e&&this.killOnEnter||!e&&!this.killOnEnter}});t.exports=n},function(t,e,i){var n=new(i(0))({initialize:function(t,e,i,n,r){void 0===n&&(n=!1),void 0===r&&(r=!0),this.source=t,this.points=[],this.quantity=e,this.stepRate=i,this.yoyo=n,this.counter=-1,this.seamless=r,this._length=0,this._direction=0,this.updateSource()},updateSource:function(){if(this.points=this.source.getPoints(this.quantity,this.stepRate),this.seamless){var t=this.points[0],e=this.points[this.points.length-1];t.x===e.x&&t.y===e.y&&this.points.pop()}var i=this._length;return this._length=this.points.length,this._lengththis._length&&(this.counter=this._length-1),this},changeSource:function(t){return this.source=t,this.updateSource()},getPoint:function(t){0===this._direction?(this.counter++,this.counter>=this._length&&(this.yoyo?(this._direction=1,this.counter=this._length-1):this.counter=0)):(this.counter--,-1===this.counter&&(this.yoyo?(this._direction=0,this.counter=0):this.counter=this._length-1));var e=this.points[this.counter];e&&(t.x=e.x,t.y=e.y)}});t.exports=n},function(t,e){t.exports=function(t,e){for(var i=0;i0&&s.maxLines1&&(d+=p*(h-1)),{width:a,height:d,lines:h,lineWidths:o,lineSpacing:p,lineHeight:c}}},function(t,e,i){var n=i(0),r=i(13),s=i(6),o=i(460),a={fontFamily:["fontFamily","Courier"],fontSize:["fontSize","16px"],fontStyle:["fontStyle",""],backgroundColor:["backgroundColor",null],color:["color","#fff"],stroke:["stroke","#fff"],strokeThickness:["strokeThickness",0],shadowOffsetX:["shadow.offsetX",0],shadowOffsetY:["shadow.offsetY",0],shadowColor:["shadow.color","#000"],shadowBlur:["shadow.blur",0],shadowStroke:["shadow.stroke",!1],shadowFill:["shadow.fill",!1],align:["align","left"],maxLines:["maxLines",0],fixedWidth:["fixedWidth",0],fixedHeight:["fixedHeight",0],resolution:["resolution",0],rtl:["rtl",!1],testString:["testString","|MÉqgy"],baselineX:["baselineX",1.2],baselineY:["baselineY",1.4],wordWrapWidth:["wordWrap.width",null],wordWrapCallback:["wordWrap.callback",null],wordWrapCallbackScope:["wordWrap.callbackScope",null],wordWrapUseAdvanced:["wordWrap.useAdvancedWrap",!1]},h=new n({initialize:function(t,e){this.parent=t,this.fontFamily,this.fontSize,this.fontStyle,this.backgroundColor,this.color,this.stroke,this.strokeThickness,this.shadowOffsetX,this.shadowOffsetY,this.shadowColor,this.shadowBlur,this.shadowStroke,this.shadowFill,this.align,this.maxLines,this.fixedWidth,this.fixedHeight,this.resolution,this.rtl,this.testString,this.baselineX,this.baselineY,this.wordWrapWidth,this.wordWrapCallback,this.wordWrapCallbackScope,this.wordWrapUseAdvanced,this._font,this.setStyle(e,!1,!0);var i=s(e,"metrics",!1);this.metrics=i?{ascent:s(i,"ascent",0),descent:s(i,"descent",0),fontSize:s(i,"fontSize",0)}:o(this)},setStyle:function(t,e,i){for(var n in void 0===e&&(e=!0),void 0===i&&(i=!1),t&&t.hasOwnProperty("fontSize")&&"number"==typeof t.fontSize&&(t.fontSize=t.fontSize.toString()+"px"),a){var o=i?a[n][1]:this[n];this[n]="wordWrapCallback"===n||"wordWrapCallbackScope"===n?s(t,a[n][0],o):r(t,a[n][0],o)}var h=s(t,"font",null);null!==h&&this.setFont(h,!1),this._font=[this.fontStyle,this.fontSize,this.fontFamily].join(" ").trim();var l=s(t,"fill",null);return null!==l&&(this.color=l),e?this.update(!0):this.parent},syncFont:function(t,e){e.font=this._font},syncStyle:function(t,e){e.textBaseline="alphabetic",e.fillStyle=this.color,e.strokeStyle=this.stroke,e.lineWidth=this.strokeThickness,e.lineCap="round",e.lineJoin="round"},syncShadow:function(t,e){e?(t.shadowOffsetX=this.shadowOffsetX,t.shadowOffsetY=this.shadowOffsetY,t.shadowColor=this.shadowColor,t.shadowBlur=this.shadowBlur):(t.shadowOffsetX=0,t.shadowOffsetY=0,t.shadowColor=0,t.shadowBlur=0)},update:function(t){return t&&(this._font=[this.fontStyle,this.fontSize,this.fontFamily].join(" ").trim(),this.metrics=o(this)),this.parent.updateText()},setFont:function(t,e){void 0===e&&(e=!0);var i=t,n="",r="";if("string"!=typeof t)i=s(t,"fontFamily","Courier"),n=s(t,"fontSize","16px"),r=s(t,"fontStyle","");else{var o=t.split(" "),a=0;r=o.length>2?o[a++]:"",n=o[a++]||"16px",i=o[a++]||"Courier"}return i===this.fontFamily&&n===this.fontSize&&r===this.fontStyle||(this.fontFamily=i,this.fontSize=n,this.fontStyle=r,e&&this.update(!0)),this.parent},setFontFamily:function(t){return this.fontFamily!==t&&(this.fontFamily=t,this.update(!0)),this.parent},setFontStyle:function(t){return this.fontStyle!==t&&(this.fontStyle=t,this.update(!0)),this.parent},setFontSize:function(t){return"number"==typeof t&&(t=t.toString()+"px"),this.fontSize!==t&&(this.fontSize=t,this.update(!0)),this.parent},setTestString:function(t){return this.testString=t,this.update(!0)},setFixedSize:function(t,e){return this.fixedWidth=t,this.fixedHeight=e,t&&(this.parent.width=t),e&&(this.parent.height=e),this.update(!1)},setBackgroundColor:function(t){return this.backgroundColor=t,this.update(!1)},setFill:function(t){return this.color=t,this.update(!1)},setColor:function(t){return this.color=t,this.update(!1)},setResolution:function(t){return this.resolution=t,this.update(!1)},setStroke:function(t,e){return void 0===e&&(e=this.strokeThickness),void 0===t&&0!==this.strokeThickness?(this.strokeThickness=0,this.update(!0)):this.stroke===t&&this.strokeThickness===e||(this.stroke=t,this.strokeThickness=e,this.update(!0)),this.parent},setShadow:function(t,e,i,n,r,s){return void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i="#000"),void 0===n&&(n=0),void 0===r&&(r=!1),void 0===s&&(s=!0),this.shadowOffsetX=t,this.shadowOffsetY=e,this.shadowColor=i,this.shadowBlur=n,this.shadowStroke=r,this.shadowFill=s,this.update(!1)},setShadowOffset:function(t,e){return void 0===t&&(t=0),void 0===e&&(e=t),this.shadowOffsetX=t,this.shadowOffsetY=e,this.update(!1)},setShadowColor:function(t){return void 0===t&&(t="#000"),this.shadowColor=t,this.update(!1)},setShadowBlur:function(t){return void 0===t&&(t=0),this.shadowBlur=t,this.update(!1)},setShadowStroke:function(t){return this.shadowStroke=t,this.update(!1)},setShadowFill:function(t){return this.shadowFill=t,this.update(!1)},setWordWrapWidth:function(t,e){return void 0===e&&(e=!1),this.wordWrapWidth=t,this.wordWrapUseAdvanced=e,this.update(!1)},setWordWrapCallback:function(t,e){return void 0===e&&(e=null),this.wordWrapCallback=t,this.wordWrapCallbackScope=e,this.update(!1)},setAlign:function(t){return void 0===t&&(t="left"),this.align=t,this.update(!1)},setMaxLines:function(t){return void 0===t&&(t=0),this.maxLines=t,this.update(!1)},getTextMetrics:function(){var t=this.metrics;return{ascent:t.ascent,descent:t.descent,fontSize:t.fontSize}},toJSON:function(){var t={};for(var e in a)t[e]=this[e];return t.metrics=this.getTextMetrics(),t},destroy:function(){this.parent=void 0}});t.exports=h},function(t,e,i){var n=i(31);t.exports=function(t){var e=n.create(this),i=e.getContext("2d");t.syncFont(e,i);var r=i.measureText(t.testString);if("actualBoundingBoxAscent"in r){var s=r.actualBoundingBoxAscent,o=r.actualBoundingBoxDescent;return n.remove(e),{ascent:s,descent:o,fontSize:s+o}}var a=Math.ceil(r.width*t.baselineX),h=a,l=2*h;h=h*t.baselineY|0,e.width=a,e.height=l,i.fillStyle="#f00",i.fillRect(0,0,a,l),i.font=t._font,i.textBaseline="alphabetic",i.fillStyle="#000",i.fillText(t.testString,0,h);var u={ascent:0,descent:0,fontSize:0},c=i.getImageData(0,0,a,l);if(!c)return u.ascent=h,u.descent=h+6,u.fontSize=u.ascent+u.descent,n.remove(e),u;var d,p,f=c.data,m=f.length,g=4*a,v=0,y=!1;for(d=0;dh;d--){for(p=0;p0&&(r=-h.PI2+r%h.PI2):r>h.PI2?r=h.PI2:r<0&&(r=h.PI2+r%h.PI2);for(var u,c=[a+Math.cos(n)*i,l+Math.sin(n)*i];e<1;)u=r*e+n,c.push(a+Math.cos(u)*i,l+Math.sin(u)*i),e+=t;return u=r+n,c.push(a+Math.cos(u)*i,l+Math.sin(u)*i),c.push(a+Math.cos(n)*i,l+Math.sin(n)*i),this.pathIndexes=o(c),this.pathData=c,this}});t.exports=u},function(t,e,i){var n=i(0),r=i(1100),s=i(59),o=i(10),a=i(34),h=new n({Extends:a,Mixins:[r],initialize:function(t,e,i,n,r,s){void 0===e&&(e=0),void 0===i&&(i=0),a.call(this,t,"Curve",n),this._smoothness=32,this._curveBounds=new o,this.closePath=!1,this.setPosition(e,i),void 0!==r&&this.setFillStyle(r,s),this.updateData()},smoothness:{get:function(){return this._smoothness},set:function(t){this._smoothness=t,this.updateData()}},setSmoothness:function(t){return this._smoothness=t,this.updateData()},updateData:function(){var t=this._curveBounds,e=this._smoothness;this.geom.getBounds(t,e),this.setSize(t.width,t.height),this.updateDisplayOrigin();for(var i=[],n=this.geom.getPoints(e),r=0;r0&&(e=h/i);for(var l=0;lc+g)){var v=m.getPoint((u-c)/g);o.push(v);break}c+=g}return o}},function(t,e,i){var n=i(67),r=i(47);t.exports=function(t){for(var e=t.points,i=0,s=0;s0&&s.push(i([0,0],n[0])),e=0;e1&&s.push(i([0,0],n[n.length-1])),t.setTo(s)}},function(t,e,i){var n=i(0),r=i(10),s=i(34),o=i(1121),a=new n({Extends:s,Mixins:[o],initialize:function(t,e,i,n,o,a,h){void 0===e&&(e=0),void 0===i&&(i=0),void 0===n&&(n=128),void 0===o&&(o=128),s.call(this,t,"Rectangle",new r(0,0,n,o)),this.setPosition(e,i),this.setSize(n,o),void 0!==a&&this.setFillStyle(a,h),this.updateDisplayOrigin(),this.updateData()},setSize:function(t,e){return this.width=t,this.height=e,this.geom.setSize(t,e),this.updateData(),this},updateData:function(){var t=[],e=this.geom,i=this._tempLine;return e.getLineA(i),t.push(i.x1,i.y1,i.x2,i.y2),e.getLineB(i),t.push(i.x2,i.y2),e.getLineC(i),t.push(i.x2,i.y2),e.getLineD(i),t.push(i.x2,i.y2),this.pathData=t,this}});t.exports=a},function(t,e,i){var n=i(1124),r=i(0),s=i(59),o=i(34),a=new r({Extends:o,Mixins:[n],initialize:function(t,e,i,n,r,s,a,h){void 0===e&&(e=0),void 0===i&&(i=0),void 0===n&&(n=5),void 0===r&&(r=32),void 0===s&&(s=64),o.call(this,t,"Star",null),this._points=n,this._innerRadius=r,this._outerRadius=s,this.setPosition(e,i),this.setSize(2*s,2*s),void 0!==a&&this.setFillStyle(a,h),this.updateDisplayOrigin(),this.updateData()},setPoints:function(t){return this._points=t,this.updateData()},setInnerRadius:function(t){return this._innerRadius=t,this.updateData()},setOuterRadius:function(t){return this._outerRadius=t,this.updateData()},points:{get:function(){return this._points},set:function(t){this._points=t,this.updateData()}},innerRadius:{get:function(){return this._innerRadius},set:function(t){this._innerRadius=t,this.updateData()}},outerRadius:{get:function(){return this._outerRadius},set:function(t){this._outerRadius=t,this.updateData()}},updateData:function(){var t=[],e=this._points,i=this._innerRadius,n=this._outerRadius,r=Math.PI/2*3,o=Math.PI/e,a=n,h=n;t.push(a,h+-n);for(var l=0;l=1)return i.x=s.x1,i.y=s.y1,i;var h=r(s),l=r(o),u=r(a),c=(h+l+u)*e,d=0;return ch+l?(d=(c-=h+l)/u,i.x=a.x1+(a.x2-a.x1)*d,i.y=a.y1+(a.y2-a.y1)*d):(d=(c-=h)/l,i.x=o.x1+(o.x2-o.x1)*d,i.y=o.y1+(o.y2-o.y1)*d),i}},function(t,e,i){var n=i(67),r=i(4);t.exports=function(t,e,i,s){void 0===s&&(s=[]);var o=t.getLineA(),a=t.getLineB(),h=t.getLineC(),l=n(o),u=n(a),c=n(h),d=l+u+c;!e&&i>0&&(e=d/i);for(var p=0;pl+u?(m=(f-=l+u)/c,g.x=h.x1+(h.x2-h.x1)*m,g.y=h.y1+(h.y2-h.y1)*m):(m=(f-=l)/u,g.x=a.x1+(a.x2-a.x1)*m,g.y=a.y1+(a.y2-a.y1)*m),s.push(g)}return s}},function(t,e){t.exports=function(t,e,i){if(!t||"number"==typeof t)return!1;if(t.hasOwnProperty(e))return t[e]=i,!0;if(-1!==e.indexOf(".")){for(var n=e.split("."),r=t,s=t,o=0;o0)for(l=0;lthis.maxLights&&(u(r,this.sortByDistance),r=r.slice(0,this.maxLights)),this.visibleLights=r.length,r},sortByDistance:function(t,e){return t.distance>=e.distance},setAmbientColor:function(t){var e=c.getFloatsFromUintRGB(t);return this.ambientColor.set(e[0],e[1],e[2]),this},getMaxVisibleLights:function(){return this.maxLights},getLightCount:function(){return this.lights.length},addLight:function(t,e,i,n,r){void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i=128),void 0===n&&(n=16777215),void 0===r&&(r=1);var s=c.getFloatsFromUintRGB(n),a=new o(t,e,i,s[0],s[1],s[2],r);return this.lights.push(a),a},removeLight:function(t){var e=this.lights.indexOf(t);return e>=0&&l(this.lights,e),this},shutdown:function(){this.lights.length=0},destroy:function(){this.shutdown()}});t.exports=d},function(t,e,i){var n=i(56),r=i(17),s={Circle:i(1191),Ellipse:i(1201),Intersects:i(484),Line:i(1221),Mesh:i(1243),Point:i(1246),Polygon:i(1260),Rectangle:i(502),Triangle:i(1293)};s=r(!1,s,n),t.exports=s},function(t,e,i){t.exports={CircleToCircle:i(231),CircleToRectangle:i(151),GetCircleToCircle:i(1211),GetCircleToRectangle:i(1212),GetLineToCircle:i(232),GetLineToLine:i(485),GetLineToPoints:i(486),GetLineToPolygon:i(487),GetLineToRectangle:i(234),GetRaysFromPointToPolygon:i(1213),GetRectangleIntersection:i(1214),GetRectangleToRectangle:i(1215),GetRectangleToTriangle:i(1216),GetTriangleToCircle:i(1217),GetTriangleToLine:i(492),GetTriangleToTriangle:i(1218),LineToCircle:i(233),LineToLine:i(96),LineToRectangle:i(488),PointToLine:i(496),PointToLineSegment:i(1219),RectangleToRectangle:i(152),RectangleToTriangle:i(489),RectangleToValues:i(1220),TriangleToCircle:i(491),TriangleToLine:i(493),TriangleToTriangle:i(494)}},function(t,e,i){var n=i(39);t.exports=function(t,e,i){var r=t.x1,s=t.y1,o=t.x2,a=t.y2,h=e.x1,l=e.y1,u=o-r,c=a-s,d=e.x2-h,p=e.y2-l;if(0===u||0==p*u-d*c)return!1;var f=(u*(l-s)+c*(r-h))/(d*c-p*u),m=(h+d*f-r)/u;return m<0||f<0||f>1?null:(void 0===i&&(i=new n),i.set(r+u*m,s+c*m,m))}},function(t,e,i){var n=i(39),r=i(485),s=new(i(47)),o=new n;t.exports=function(t,e,i){void 0===i&&(i=new n);var a=!1;i.set(),o.set();for(var h=e[0],l=1;l=o&&i<=h&&n>=a&&n<=l||r>=o&&r<=h&&s>=a&&s<=l)return!0;if(i=o){if((u=n+(s-n)*(o-i)/(r-i))>a&&u<=l)return!0}else if(i>h&&r<=h&&(u=n+(s-n)*(h-i)/(r-i))>=a&&u<=l)return!0;if(n=a){if((u=i+(r-i)*(a-n)/(s-n))>=o&&u<=h)return!0}else if(n>l&&s<=l&&(u=i+(r-i)*(l-n)/(s-n))>=o&&u<=h)return!0;return!1}},function(t,e,i){var n=i(96),r=i(57),s=i(235),o=i(490);t.exports=function(t,e){if(e.left>t.right||e.rightt.bottom||e.bottom0}},function(t,e){t.exports=function(t,e){return void 0===e&&(e=[]),e.push({x:t.x,y:t.y}),e.push({x:t.right,y:t.y}),e.push({x:t.right,y:t.bottom}),e.push({x:t.x,y:t.bottom}),e}},function(t,e,i){var n=i(233),r=i(115);t.exports=function(t,e){return!(t.left>e.right||t.righte.bottom||t.bottome.right||t.righte.bottom||t.bottom0||(c=r(e),(d=n(t,c,!0)).length>0)}},function(t,e){t.exports=function(t,e){return void 0===e&&(e=[]),e.push({x:t.x1,y:t.y1}),e.push({x:t.x2,y:t.y2}),e.push({x:t.x3,y:t.y3}),e}},function(t,e){t.exports=function(t,e,i){void 0===i&&(i=1);var n=e.x1,r=e.y1,s=e.x2,o=e.y2,a=t.x,h=t.y,l=(s-n)*(s-n)+(o-r)*(o-r);if(0===l)return!1;var u=((a-n)*(s-n)+(h-r)*(o-r))/l;if(u<0)return Math.sqrt((n-a)*(n-a)+(r-h)*(r-h))<=i;if(u>=0&&u<=1){var c=((r-h)*(s-n)-(n-a)*(o-r))/l;return Math.abs(c)*Math.sqrt(l)<=i}return Math.sqrt((s-a)*(s-a)+(o-h)*(o-h))<=i}},function(t,e,i){var n=i(14),r=i(68),s=i(97);t.exports=function(t){var e=s(t)-n.TAU;return r(e,-Math.PI,Math.PI)}},function(t,e){var i=!0,n="",r="";function s(t){var e=t.indexOf("#");return e>-1?t.substring(0,e):t}function o(t){return 0===t.models.length&&t.models.push({faces:[],name:"untitled",textureCoords:[],vertexNormals:[],vertices:[]}),n="",t.models[t.models.length-1]}function a(t,e){var i=t.length>=2?t[1]:"untitled";e.models.push({faces:[],name:i,textureCoords:[],vertexNormals:[],vertices:[]}),n=""}function h(t){2===t.length&&(n=t[1])}function l(t,e){var i=t.length,n=i>=2?parseFloat(t[1]):0,r=i>=3?parseFloat(t[2]):0,s=i>=4?parseFloat(t[3]):0;o(e).vertices.push({x:n,y:r,z:s})}function u(t,e){var n=t.length,r=n>=2?parseFloat(t[1]):0,s=n>=3?parseFloat(t[2]):0,a=n>=4?parseFloat(t[3]):0;isNaN(r)&&(r=0),isNaN(s)&&(s=0),isNaN(a)&&(a=0),i&&(s=1-s),o(e).textureCoords.push({u:r,v:s,w:a})}function c(t,e){var i=t.length,n=i>=2?parseFloat(t[1]):0,r=i>=3?parseFloat(t[2]):0,s=i>=4?parseFloat(t[3]):0;o(e).vertexNormals.push({x:n,y:r,z:s})}function d(t,e){var i=t.length-1;if(!(i<3)){for(var s={group:n,material:r,vertices:[]},a=0;a3)){var u=0,c=0,d=0;u=parseInt(h[0],10),l>1&&""!==h[1]&&(c=parseInt(h[1],10)),l>2&&(d=parseInt(h[2],10)),0!==u&&(u<0&&(u=o(e).vertices.length+1+u),c-=1,u-=1,d-=1,s.vertices.push({textureCoordsIndex:c,vertexIndex:u,vertexNormalIndex:d}))}}o(e).faces.push(s)}}function p(t,e){t.length>=2&&e.materialLibraries.push(t[1])}function f(t){t.length>=2&&(r=t[1])}t.exports=function(t,e){void 0===e&&(e=!0),i=e;var o={materials:{},materialLibraries:[],models:[]};n="",r="";for(var m=t.split("\n"),g=0;g=2?Math.floor(255*a[2]):h,u=a.length>=3?Math.floor(255*a[3]):h;e[r]=n(h,l,u)}}}return e}},function(t,e){t.exports=function(t){return Math.sqrt(t.x*t.x+t.y*t.y)}},function(t,e){t.exports=function(t){return t.x*t.x+t.y*t.y}},function(t,e,i){var n=i(10);n.Area=i(1267),n.Ceil=i(1268),n.CeilAll=i(1269),n.CenterOn=i(190),n.Clone=i(1270),n.Contains=i(57),n.ContainsPoint=i(1271),n.ContainsRect=i(503),n.CopyFrom=i(1272),n.Decompose=i(490),n.Equals=i(1273),n.FitInside=i(1274),n.FitOutside=i(1275),n.Floor=i(1276),n.FloorAll=i(1277),n.FromPoints=i(199),n.FromXY=i(1278),n.GetAspectRatio=i(237),n.GetCenter=i(1279),n.GetPoint=i(171),n.GetPoints=i(306),n.GetSize=i(1280),n.Inflate=i(1281),n.Intersection=i(1282),n.MarchingAnts=i(316),n.MergePoints=i(1283),n.MergeRect=i(1284),n.MergeXY=i(1285),n.Offset=i(1286),n.OffsetPoint=i(1287),n.Overlaps=i(1288),n.Perimeter=i(130),n.PerimeterPoint=i(1289),n.Random=i(174),n.RandomOutside=i(1290),n.SameDimensions=i(1291),n.Scale=i(1292),n.Union=i(441),t.exports=n},function(t,e){t.exports=function(t,e){return!(e.width*e.height>t.width*t.height)&&e.x>t.x&&e.xt.x&&e.rightt.y&&e.yt.y&&e.bottom=e}}},function(t,e){t.exports=function(t,e,i){return{gameObject:t,enabled:!0,alwaysEnabled:!1,draggable:!1,dropZone:!1,cursor:!1,target:null,camera:null,hitArea:e,hitAreaCallback:i,hitAreaDebug:null,customHitArea:!1,localX:0,localY:0,dragState:0,dragStartX:0,dragStartY:0,dragStartXGlobal:0,dragStartYGlobal:0,dragX:0,dragY:0}}},function(t,e,i){var n=new(i(0))({initialize:function(t,e){this.pad=t,this.events=t.events,this.index=e,this.value=0,this.threshold=.1},update:function(t){this.value=t},getValue:function(){return Math.abs(this.value)=this.threshold?this.pressed||(this.pressed=!0,this.events.emit(r.BUTTON_DOWN,e,this,t),this.pad.emit(r.GAMEPAD_BUTTON_DOWN,i,t,this)):this.pressed&&(this.pressed=!1,this.events.emit(r.BUTTON_UP,e,this,t),this.pad.emit(r.GAMEPAD_BUTTON_UP,i,t,this))},destroy:function(){this.pad=null,this.events=null}});t.exports=s},function(t,e,i){var n=i(509),r=i(510),s=i(0),o=i(9),a=i(3),h=new s({Extends:o,initialize:function(t,e){o.call(this),this.manager=t,this.pad=e,this.id=e.id,this.index=e.index;for(var i=[],s=0;s=2&&(this.leftStick.set(s[0].getValue(),s[1].getValue()),r>=4&&this.rightStick.set(s[2].getValue(),s[3].getValue()))}},destroy:function(){var t;for(this.removeAllListeners(),this.manager=null,this.pad=null,t=0;t0&&e.maxKeyDelay>0){var s=e.timeLastMatched+e.maxKeyDelay;t.timeStamp<=s&&(r=!0,i=n(t,e))}else r=!0,i=n(t,e);return!r&&e.resetOnWrongKey&&(e.index=0,e.current=e.keyCodes[0]),i&&(e.timeLastMatched=t.timeStamp,e.matched=!0,e.timeMatched=t.timeStamp),i}},function(t,e){t.exports=function(t,e){return e.timeLastMatched=t.timeStamp,e.index++,e.index===e.size||(e.current=e.keyCodes[e.index],!1)}},function(t,e){t.exports=function(t){return t.current=t.keyCodes[0],t.index=0,t.timeLastMatched=0,t.matched=!1,t.timeMatched=0,t}},function(t,e,i){var n=i(240);t.exports=function(t,e){var i=n(e,t.xhrSettings),r=new XMLHttpRequest;if(r.open("GET",t.src,i.async,i.user,i.password),r.responseType=t.xhrSettings.responseType,r.timeout=i.timeout,i.headers)for(var s in i.headers)r.setRequestHeader(s,i.headers[s]);return i.header&&i.headerValue&&r.setRequestHeader(i.header,i.headerValue),i.requestedWith&&r.setRequestHeader("X-Requested-With",i.requestedWith),i.overrideMimeType&&r.overrideMimeType(i.overrideMimeType),i.withCredentials&&(r.withCredentials=!0),r.onload=t.onLoad.bind(t,r),r.onerror=t.onError.bind(t,r),r.onprogress=t.onProgress.bind(t),r.send(),r}},function(t,e,i){var n=i(0),r=i(21),s=i(23),o=i(8),a=i(2),h=i(519),l=i(7),u=new n({Extends:s,initialize:function(t,e,i,n,r){if(l(e)){var o=e;e=a(o,"key"),n=a(o,"xhrSettings"),r=a(o,"context",r)}var h={type:"audio",cache:t.cacheManager.audio,extension:i.type,responseType:"arraybuffer",key:e,url:i.url,xhrSettings:n,config:{context:r}};s.call(this,t,h)},onProcess:function(){this.state=r.FILE_PROCESSING;var t=this;this.config.context.decodeAudioData(this.xhrLoader.response,(function(e){t.data=e,t.onProcessComplete()}),(function(e){t.onProcessError()})),this.config.context=null}});u.create=function(t,e,i,n,r){var s=t.systems.game,o=s.config.audio,c=s.device.audio;l(e)&&(i=a(e,"url",[]),n=a(e,"config",{}));var d=u.getAudioURL(s,i);return d?c.webAudio&&!o.disableWebAudio?new u(t,e,d,r,s.sound.context):new h(t,e,d,n):null},u.getAudioURL=function(t,e){Array.isArray(e)||(e=[e]);for(var i=0;i=s;for(this.fixedStep||(r=.001*e,a=!0,this._elapsed=0),i=0;i=s;)this._elapsed-=s,this.step(r)}},step:function(t){var e,i,n=this.bodies.entries,r=n.length;for(e=0;e0){var l=this.tree,u=this.staticTree;for(n=(i=a.entries).length,t=0;t-1&&c>m&&(t.velocity.normalize().scale(m),c=m),t.speed=c},separate:function(t,e,i,n,r,s){if(!s&&!t.enable||!e.enable||t.checkCollision.none||e.checkCollision.none||!this.intersects(t,e))return!1;if(i&&!1===i.call(n,t.gameObject,e.gameObject))return!1;if(t.isCircle&&e.isCircle)return this.separateCircle(t,e,r);if(t.isCircle!==e.isCircle){var o=t.isCircle?e:t,a=t.isCircle?t:e,h={x:o.x,y:o.y,right:o.right,bottom:o.bottom},l=a.center;if((l.yh.bottom)&&(l.xh.right))return this.separateCircle(t,e,r)}var u=!1,d=!1;r?(u=E(t,e,r,this.OVERLAP_BIAS),d=M(t,e,r,this.OVERLAP_BIAS)):this.forceX||Math.abs(this.gravity.y+t.gravity.y)o.right&&(s=l(a.x,a.y,o.right,o.y)-a.radius):a.y>o.bottom&&(a.xo.right&&(s=l(a.x,a.y,o.right,o.bottom)-a.radius)),s*=-1}else s=t.halfWidth+e.halfWidth-l(t.center.x,t.center.y,e.center.x,e.center.y);if(t.overlapR=s,e.overlapR=s,i||0===s||t.immovable&&e.immovable||t.customSeparateX||e.customSeparateX)return 0!==s&&(t.onOverlap||e.onOverlap)&&this.emit(c.OVERLAP,t.gameObject,e.gameObject,t,e),0!==s;var h=t.center.x-e.center.x,u=t.center.y-e.center.y,d=Math.sqrt(Math.pow(h,2)+Math.pow(u,2)),p=(e.center.x-t.center.x)/d||0,f=(e.center.y-t.center.y)/d||0,v=2*(t.velocity.x*p+t.velocity.y*f-e.velocity.x*p-e.velocity.y*f)/(t.mass+e.mass);(t.immovable||e.immovable)&&(v*=2),t.immovable||(t.velocity.x=t.velocity.x-v/t.mass*p,t.velocity.y=t.velocity.y-v/t.mass*f),e.immovable||(e.velocity.x=e.velocity.x+v/e.mass*p,e.velocity.y=e.velocity.y+v/e.mass*f),t.immovable||e.immovable||(s/=2);var y=n(t.center,e.center),w=(s+x.EPSILON)*Math.cos(y),b=(s+x.EPSILON)*Math.sin(y);return t.immovable||(t.x-=w,t.y-=b,t.updateCenter()),e.immovable||(e.x+=w,e.y+=b,e.updateCenter()),t.velocity.x*=t.bounce.x,t.velocity.y*=t.bounce.y,e.velocity.x*=e.bounce.x,e.velocity.y*=e.bounce.y,(t.onCollide||e.onCollide)&&this.emit(c.COLLIDE,t.gameObject,e.gameObject,t,e),!0},intersects:function(t,e){return t!==e&&(t.isCircle||e.isCircle?t.isCircle?e.isCircle?l(t.center.x,t.center.y,e.center.x,e.center.y)<=t.halfWidth+e.halfWidth:this.circleBodyIntersects(t,e):this.circleBodyIntersects(e,t):!(t.right<=e.position.x||t.bottom<=e.position.y||t.position.x>=e.right||t.position.y>=e.bottom))},circleBodyIntersects:function(t,e){var i=s(t.center.x,e.left,e.right),n=s(t.center.y,e.top,e.bottom);return(t.center.x-i)*(t.center.x-i)+(t.center.y-n)*(t.center.y-n)<=t.halfWidth*t.halfWidth},overlap:function(t,e,i,n,r){return void 0===i&&(i=null),void 0===n&&(n=null),void 0===r&&(r=i),this.collideObjects(t,e,i,n,r,!0)},collide:function(t,e,i,n,r){return void 0===i&&(i=null),void 0===n&&(n=null),void 0===r&&(r=i),this.collideObjects(t,e,i,n,r,!1)},collideObjects:function(t,e,i,n,r,s){var o,a;t.isParent&&void 0===t.physicsType&&(t=t.children.entries),e&&e.isParent&&void 0===e.physicsType&&(e=e.children.entries);var h=Array.isArray(t),l=Array.isArray(e);if(this._total=0,h||l)if(!h&&l)for(o=0;o0},collideHandler:function(t,e,i,n,r,s){if(void 0===e&&t.isParent)return this.collideGroupVsGroup(t,t,i,n,r,s);if(!t||!e)return!1;if(t.body){if(e.body)return this.collideSpriteVsSprite(t,e,i,n,r,s);if(e.isParent)return this.collideSpriteVsGroup(t,e,i,n,r,s);if(e.isTilemap)return this.collideSpriteVsTilemapLayer(t,e,i,n,r,s)}else if(t.isParent){if(e.body)return this.collideSpriteVsGroup(e,t,i,n,r,s);if(e.isParent)return this.collideGroupVsGroup(t,e,i,n,r,s);if(e.isTilemap)return this.collideGroupVsTilemapLayer(t,e,i,n,r,s)}else if(t.isTilemap){if(e.body)return this.collideSpriteVsTilemapLayer(e,t,i,n,r,s);if(e.isParent)return this.collideGroupVsTilemapLayer(e,t,i,n,r,s)}},collideSpriteVsSprite:function(t,e,i,n,r,s){return!(!t.body||!e.body||(this.separate(t.body,e.body,n,r,s)&&(i&&i.call(r,t,e),this._total++),0))},collideSpriteVsGroup:function(t,e,i,n,r,s){var o,a,l,u=t.body;if(0!==e.length&&u&&u.enable&&!u.checkCollision.none)if(this.useTree||e.physicsType===h.STATIC_BODY){var c=this.treeMinMax;c.minX=u.left,c.minY=u.top,c.maxX=u.right,c.maxY=u.bottom;var d=e.physicsType===h.DYNAMIC_BODY?this.tree.search(c):this.staticTree.search(c);for(a=d.length,o=0;oc.baseTileWidth){var d=(c.tileWidth-c.baseTileWidth)*e.scaleX;a-=d,l+=d}c.tileHeight>c.baseTileHeight&&(u+=(c.tileHeight-c.baseTileHeight)*e.scaleY);var p=v(a,h,l,u,null,e.scene.cameras.main,e.layer);return 0!==p.length&&this.collideSpriteVsTilesHandler(t,p,i,n,r,s,!0)},collideSpriteVsTilesHandler:function(t,e,i,n,r,s,o){for(var a,h,l=t.body,u={left:0,right:0,top:0,bottom:0},d=!1,p=0;p0&&t>i&&(t=i)),0!==n&&0!==e&&(e<0&&e<-n?e=-n:e>0&&e>n&&(e=n)),this.gameObject.x+=t,this.gameObject.y+=e}t<0?this.facing=r.FACING_LEFT:t>0&&(this.facing=r.FACING_RIGHT),e<0?this.facing=r.FACING_UP:e>0&&(this.facing=r.FACING_DOWN),this.allowRotation&&(this.gameObject.angle+=this.deltaZ()),this._tx=t,this._ty=e},setBoundsRectangle:function(t){return this.customBoundsRectangle=t||this.world.bounds,this},checkWorldBounds:function(){var t=this.position,e=this.customBoundsRectangle,i=this.world.checkCollision,n=this.worldBounce?-this.worldBounce.x:-this.bounce.x,r=this.worldBounce?-this.worldBounce.y:-this.bounce.y,s=!1;return t.xe.right&&i.right&&(t.x=e.right-this.width,this.velocity.x*=n,this.blocked.right=!0,s=!0),t.ye.bottom&&i.down&&(t.y=e.bottom-this.height,this.velocity.y*=r,this.blocked.down=!0,s=!0),s&&(this.blocked.none=!1,this.updateCenter()),s},setOffset:function(t,e){return void 0===e&&(e=t),this.offset.set(t,e),this},setSize:function(t,e,i){void 0===i&&(i=!0);var n=this.gameObject;if(!t&&n.frame&&(t=n.frame.realWidth),!e&&n.frame&&(e=n.frame.realHeight),this.sourceWidth=t,this.sourceHeight=e,this.width=this.sourceWidth*this._sx,this.height=this.sourceHeight*this._sy,this.halfWidth=Math.floor(this.width/2),this.halfHeight=Math.floor(this.height/2),this.updateCenter(),i&&n.getCenter){var r=(n.width-t)/2,s=(n.height-e)/2;this.offset.set(r,s)}return this.isCircle=!1,this.radius=0,this},setCircle:function(t,e,i){return void 0===e&&(e=this.offset.x),void 0===i&&(i=this.offset.y),t>0?(this.isCircle=!0,this.radius=t,this.sourceWidth=2*t,this.sourceHeight=2*t,this.width=this.sourceWidth*this._sx,this.height=this.sourceHeight*this._sy,this.halfWidth=Math.floor(this.width/2),this.halfHeight=Math.floor(this.height/2),this.offset.set(e,i),this.updateCenter()):this.isCircle=!1,this},reset:function(t,e){this.stop();var i=this.gameObject;i.setPosition(t,e),i.getTopLeft?i.getTopLeft(this.position):this.position.set(t,e),this.prev.copy(this.position),this.prevFrame.copy(this.position),this.rotation=i.angle,this.preRotation=i.angle,this.updateBounds(),this.updateCenter(),this.resetFlags(!0)},stop:function(){return this.velocity.set(0),this.acceleration.set(0),this.speed=0,this.angularVelocity=0,this.angularAcceleration=0,this},getBounds:function(t){return t.x=this.x,t.y=this.y,t.right=this.right,t.bottom=this.bottom,t},hitTest:function(t,e){return this.isCircle?this.radius>0&&t>=this.left&&t<=this.right&&e>=this.top&&e<=this.bottom&&(this.center.x-t)*(this.center.x-t)+(this.center.y-e)*(this.center.y-e)<=this.radius*this.radius:h(this,t,e)},onFloor:function(){return this.blocked.down},onCeiling:function(){return this.blocked.up},onWall:function(){return this.blocked.left||this.blocked.right},deltaAbsX:function(){return this._dx>0?this._dx:-this._dx},deltaAbsY:function(){return this._dy>0?this._dy:-this._dy},deltaX:function(){return this._dx},deltaY:function(){return this._dy},deltaXFinal:function(){return this._tx},deltaYFinal:function(){return this._ty},deltaZ:function(){return this.rotation-this.preRotation},destroy:function(){this.enable=!1,this.world&&this.world.pendingDestroy.set(this)},drawDebug:function(t){var e=this.position,i=e.x+this.halfWidth,n=e.y+this.halfHeight;this.debugShowBody&&(t.lineStyle(t.defaultStrokeWidth,this.debugBodyColor),this.isCircle?t.strokeCircle(i,n,this.width/2):(this.checkCollision.up&&t.lineBetween(e.x,e.y,e.x+this.width,e.y),this.checkCollision.right&&t.lineBetween(e.x+this.width,e.y,e.x+this.width,e.y+this.height),this.checkCollision.down&&t.lineBetween(e.x,e.y+this.height,e.x+this.width,e.y+this.height),this.checkCollision.left&&t.lineBetween(e.x,e.y,e.x,e.y+this.height))),this.debugShowVelocity&&(t.lineStyle(t.defaultStrokeWidth,this.world.defaults.velocityDebugColor,1),t.lineBetween(i,n,i+this.velocity.x/2,n+this.velocity.y/2))},willDrawDebug:function(){return this.debugShowBody||this.debugShowVelocity},setCollideWorldBounds:function(t,e,i,n){void 0===t&&(t=!0),this.collideWorldBounds=t;var r=void 0!==e,s=void 0!==i;return(r||s)&&(this.worldBounce||(this.worldBounce=new l),r&&(this.worldBounce.x=e),s&&(this.worldBounce.y=i)),void 0!==n&&(this.onWorldBounds=n),this},setVelocity:function(t,e){return this.velocity.set(t,e),t=this.velocity.x,e=this.velocity.y,this.speed=Math.sqrt(t*t+e*e),this},setVelocityX:function(t){this.velocity.x=t;var e=t,i=this.velocity.y;return this.speed=Math.sqrt(e*e+i*i),this},setVelocityY:function(t){this.velocity.y=t;var e=this.velocity.x,i=t;return this.speed=Math.sqrt(e*e+i*i),this},setMaxVelocity:function(t,e){return this.maxVelocity.set(t,e),this},setMaxVelocityX:function(t){return this.maxVelocity.x=t,this},setMaxVelocityY:function(t){return this.maxVelocity.y=t,this},setMaxSpeed:function(t){return this.maxSpeed=t,this},setBounce:function(t,e){return this.bounce.set(t,e),this},setBounceX:function(t){return this.bounce.x=t,this},setBounceY:function(t){return this.bounce.y=t,this},setAcceleration:function(t,e){return this.acceleration.set(t,e),this},setAccelerationX:function(t){return this.acceleration.x=t,this},setAccelerationY:function(t){return this.acceleration.y=t,this},setAllowDrag:function(t){return void 0===t&&(t=!0),this.allowDrag=t,this},setAllowGravity:function(t){return void 0===t&&(t=!0),this.allowGravity=t,this},setAllowRotation:function(t){return void 0===t&&(t=!0),this.allowRotation=t,this},setDrag:function(t,e){return this.drag.set(t,e),this},setDamping:function(t){return this.useDamping=t,this},setDragX:function(t){return this.drag.x=t,this},setDragY:function(t){return this.drag.y=t,this},setGravity:function(t,e){return this.gravity.set(t,e),this},setGravityX:function(t){return this.gravity.x=t,this},setGravityY:function(t){return this.gravity.y=t,this},setFriction:function(t,e){return this.friction.set(t,e),this},setFrictionX:function(t){return this.friction.x=t,this},setFrictionY:function(t){return this.friction.y=t,this},setAngularVelocity:function(t){return this.angularVelocity=t,this},setAngularAcceleration:function(t){return this.angularAcceleration=t,this},setAngularDrag:function(t){return this.angularDrag=t,this},setMass:function(t){return this.mass=t,this},setImmovable:function(t){return void 0===t&&(t=!0),this.immovable=t,this},setEnable:function(t){return void 0===t&&(t=!0),this.enable=t,this},processX:function(t,e,i,n){this.x+=t,this.updateCenter(),null!==e&&(this.velocity.x=e);var r=this.blocked;i&&(r.left=!0),n&&(r.right=!0)},processY:function(t,e,i,n){this.y+=t,this.updateCenter(),null!==e&&(this.velocity.y=e);var r=this.blocked;i&&(r.up=!0),n&&(r.down=!0)},x:{get:function(){return this.position.x},set:function(t){this.position.x=t}},y:{get:function(){return this.position.y},set:function(t){this.position.y=t}},left:{get:function(){return this.position.x}},right:{get:function(){return this.position.x+this.width}},top:{get:function(){return this.position.y}},bottom:{get:function(){return this.position.y+this.height}}});t.exports=u},function(t,e,i){var n=new(i(0))({initialize:function(t,e,i,n,r,s,o){this.world=t,this.name="",this.active=!0,this.overlapOnly=e,this.object1=i,this.object2=n,this.collideCallback=r,this.processCallback=s,this.callbackContext=o},setName:function(t){return this.name=t,this},update:function(){this.world.collideObjects(this.object1,this.object2,this.collideCallback,this.processCallback,this.callbackContext,this.overlapOnly)},destroy:function(){this.world.removeCollider(this),this.active=!1,this.world=null,this.object1=null,this.object2=null,this.collideCallback=null,this.processCallback=null,this.callbackContext=null}});t.exports=n},function(t,e,i){var n=i(26),r=i(3),s=new r,o=new r;t.exports=function(t,e,i,r,a,h,l){var u=l.tilemapLayer.tilemap._convert.WorldToTileXY;u(t,e,!0,s,h,l);var c=s.x,d=s.y;u(t+i,e+r,!1,o,h,l);var p=Math.ceil(o.x),f=Math.ceil(o.y);return n(c,d,p-c,f-d,a,l)}},function(t,e){t.exports=function(t,e){return t.collisionCallback?!t.collisionCallback.call(t.collisionCallbackContext,e,t):!t.layer.callbacks[t.index]||!t.layer.callbacks[t.index].callback.call(t.layer.callbacks[t.index].callbackContext,e,t)}},function(t,e,i){var n=i(436);function r(t){if(!(this instanceof r))return new r(t,[".left",".top",".right",".bottom"]);this._maxEntries=Math.max(4,t||9),this._minEntries=Math.max(2,Math.ceil(.4*this._maxEntries)),this.clear()}function s(t,e,i){if(!i)return e.indexOf(t);for(var n=0;n=t.minX&&e.maxY>=t.minY}function m(t){return{children:t,height:1,leaf:!0,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0}}function g(t,e,i,r,s){for(var o,a=[e,i];a.length;)(i=a.pop())-(e=a.pop())<=r||(o=e+Math.ceil((i-e)/r/2)*r,n(t,o,e,i,s),a.push(e,o,o,i))}r.prototype={all:function(){return this._all(this.data,[])},search:function(t){var e=this.data,i=[],n=this.toBBox;if(!f(t,e))return i;for(var r,s,o,a,h=[];e;){for(r=0,s=e.children.length;r=0&&s[e].children.length>this._maxEntries;)this._split(s,e),e--;this._adjustParentBBoxes(r,s,e)},_split:function(t,e){var i=t[e],n=i.children.length,r=this._minEntries;this._chooseSplitAxis(i,r,n);var s=this._chooseSplitIndex(i,r,n),a=m(i.children.splice(s,i.children.length-s));a.height=i.height,a.leaf=i.leaf,o(i,this.toBBox),o(a,this.toBBox),e?t[e-1].children.push(a):this._splitRoot(i,a)},_splitRoot:function(t,e){this.data=m([t,e]),this.data.height=t.height+1,this.data.leaf=!1,o(this.data,this.toBBox)},_chooseSplitIndex:function(t,e,i){var n,r,s,o,h,l,u,d,p,f,m,g,v,y;for(l=u=1/0,n=e;n<=i-e;n++)r=a(t,0,n,this.toBBox),s=a(t,n,i,this.toBBox),p=r,f=s,m=void 0,g=void 0,v=void 0,y=void 0,m=Math.max(p.minX,f.minX),g=Math.max(p.minY,f.minY),v=Math.min(p.maxX,f.maxX),y=Math.min(p.maxY,f.maxY),o=Math.max(0,v-m)*Math.max(0,y-g),h=c(r)+c(s),o=e;r--)s=t.children[r],h(u,t.leaf?o(s):s),c+=d(u);return c},_adjustParentBBoxes:function(t,e,i){for(var n=i;n>=0;n--)h(e[n],t)},_condense:function(t){for(var e,i=t.length-1;i>=0;i--)0===t[i].children.length?i>0?(e=t[i-1].children).splice(e.indexOf(t[i]),1):this.clear():o(t[i],this.toBBox)},compareMinX:function(t,e){return t.left-e.left},compareMinY:function(t,e){return t.top-e.top},toBBox:function(t){return{minX:t.left,minY:t.top,maxX:t.right,maxY:t.bottom}}},t.exports=r},function(t,e,i){var n=i(533),r=i(535),s=i(248);t.exports=function(t,e,i,o,a,h,l){var u=o.left,c=o.top,d=o.right,p=o.bottom,f=i.faceLeft||i.faceRight,m=i.faceTop||i.faceBottom;if(l||(f=!0,m=!0),!f&&!m)return!1;var g=0,v=0,y=0,x=1;if(e.deltaAbsX()>e.deltaAbsY()?y=-1:e.deltaAbsX()0&&u&&t.checkCollision.right&&h&&t.right>i&&(a=t.right-i)>s&&(a=0),0!==a&&(t.customSeparateX?t.overlapX=a:n(t,a)),a}},function(t,e){t.exports=function(t,e){e<0?(t.blocked.none=!1,t.blocked.left=!0):e>0&&(t.blocked.none=!1,t.blocked.right=!0),t.position.x-=e,0===t.bounce.x?t.velocity.x=0:t.velocity.x=-t.velocity.x*t.bounce.x}},function(t,e,i){var n=i(536);t.exports=function(t,e,i,r,s,o){var a=0,h=e.faceTop,l=e.faceBottom,u=e.collideUp,c=e.collideDown;return o||(h=!0,l=!0,u=!0,c=!0),t.deltaY()<0&&c&&t.checkCollision.up?l&&t.y0&&u&&t.checkCollision.down&&h&&t.bottom>i&&(a=t.bottom-i)>s&&(a=0),0!==a&&(t.customSeparateY?t.overlapY=a:n(t,a)),a}},function(t,e){t.exports=function(t,e){e<0?(t.blocked.none=!1,t.blocked.up=!0):e>0&&(t.blocked.none=!1,t.blocked.down=!0),t.position.y-=e,0===t.bounce.y?t.velocity.y=0:t.velocity.y=-t.velocity.y*t.bounce.y}},function(t,e,i){var n=i(246),r=i(1389);t.exports=function(t,e,i,s){var o=n(t,e,i,s),a=t.immovable,h=e.immovable;if(i||0===o||a&&h||t.customSeparateX||e.customSeparateX)return 0!==o||t.embedded&&e.embedded;var l=r.Set(t,e,o);return a||h?(a?r.RunImmovableBody1(l):h&&r.RunImmovableBody2(l),!0):l>0||r.Check()}},function(t,e,i){var n=i(247),r=i(1390);t.exports=function(t,e,i,s){var o=n(t,e,i,s),a=t.immovable,h=e.immovable;if(i||0===o||a&&h||t.customSeparateY||e.customSeparateY)return 0!==o||t.embedded&&e.embedded;var l=r.Set(t,e,o);return a||h?(a?r.RunImmovableBody1(l):h&&r.RunImmovableBody2(l),!0):l>0||r.Check()}},function(t,e,i){var n=i(66),r=i(0),s=i(62),o=i(57),a=i(3),h=new r({initialize:function(t,e){var i=e.displayWidth?e.displayWidth:64,n=e.displayHeight?e.displayHeight:64;this.world=t,this.gameObject=e,this.debugShowBody=t.defaults.debugShowStaticBody,this.debugBodyColor=t.defaults.staticBodyDebugColor,this.enable=!0,this.isCircle=!1,this.radius=0,this.offset=new a,this.position=new a(e.x-i*e.originX,e.y-n*e.originY),this.width=i,this.height=n,this.halfWidth=Math.abs(this.width/2),this.halfHeight=Math.abs(this.height/2),this.center=new a(this.position.x+this.halfWidth,this.position.y+this.halfHeight),this.velocity=a.ZERO,this.allowGravity=!1,this.gravity=a.ZERO,this.bounce=a.ZERO,this.onWorldBounds=!1,this.onCollide=!1,this.onOverlap=!1,this.mass=1,this.immovable=!0,this.pushable=!1,this.customSeparateX=!1,this.customSeparateY=!1,this.overlapX=0,this.overlapY=0,this.overlapR=0,this.embedded=!1,this.collideWorldBounds=!1,this.checkCollision={none:!1,up:!0,down:!0,left:!0,right:!0},this.touching={none:!0,up:!1,down:!1,left:!1,right:!1},this.wasTouching={none:!0,up:!1,down:!1,left:!1,right:!1},this.blocked={none:!0,up:!1,down:!1,left:!1,right:!1},this.physicsType=s.STATIC_BODY,this._dx=0,this._dy=0},setGameObject:function(t,e){return t&&t!==this.gameObject&&(this.gameObject.body=null,t.body=this,this.gameObject=t),e&&this.updateFromGameObject(),this},updateFromGameObject:function(){this.world.staticTree.remove(this);var t=this.gameObject;return t.getTopLeft(this.position),this.width=t.displayWidth,this.height=t.displayHeight,this.halfWidth=Math.abs(this.width/2),this.halfHeight=Math.abs(this.height/2),this.center.set(this.position.x+this.halfWidth,this.position.y+this.halfHeight),this.world.staticTree.insert(this),this},setOffset:function(t,e){return void 0===e&&(e=t),this.world.staticTree.remove(this),this.position.x-=this.offset.x,this.position.y-=this.offset.y,this.offset.set(t,e),this.position.x+=this.offset.x,this.position.y+=this.offset.y,this.updateCenter(),this.world.staticTree.insert(this),this},setSize:function(t,e,i){void 0===i&&(i=!0);var n=this.gameObject;if(!t&&n.frame&&(t=n.frame.realWidth),!e&&n.frame&&(e=n.frame.realHeight),this.world.staticTree.remove(this),this.width=t,this.height=e,this.halfWidth=Math.floor(t/2),this.halfHeight=Math.floor(e/2),i&&n.getCenter){var r=n.displayWidth/2,s=n.displayHeight/2;this.position.x-=this.offset.x,this.position.y-=this.offset.y,this.offset.set(r-this.halfWidth,s-this.halfHeight),this.position.x+=this.offset.x,this.position.y+=this.offset.y}return this.updateCenter(),this.isCircle=!1,this.radius=0,this.world.staticTree.insert(this),this},setCircle:function(t,e,i){return void 0===e&&(e=this.offset.x),void 0===i&&(i=this.offset.y),t>0?(this.world.staticTree.remove(this),this.isCircle=!0,this.radius=t,this.width=2*t,this.height=2*t,this.halfWidth=Math.floor(this.width/2),this.halfHeight=Math.floor(this.height/2),this.offset.set(e,i),this.updateCenter(),this.world.staticTree.insert(this)):this.isCircle=!1,this},updateCenter:function(){this.center.set(this.position.x+this.halfWidth,this.position.y+this.halfHeight)},reset:function(t,e){var i=this.gameObject;void 0===t&&(t=i.x),void 0===e&&(e=i.y),this.world.staticTree.remove(this),i.setPosition(t,e),i.getTopLeft(this.position),this.updateCenter(),this.world.staticTree.insert(this)},stop:function(){return this},getBounds:function(t){return t.x=this.x,t.y=this.y,t.right=this.right,t.bottom=this.bottom,t},hitTest:function(t,e){return this.isCircle?n(this,t,e):o(this,t,e)},postUpdate:function(){},deltaAbsX:function(){return 0},deltaAbsY:function(){return 0},deltaX:function(){return 0},deltaY:function(){return 0},deltaZ:function(){return 0},destroy:function(){this.enable=!1,this.world.pendingDestroy.set(this)},drawDebug:function(t){var e=this.position,i=e.x+this.halfWidth,n=e.y+this.halfHeight;this.debugShowBody&&(t.lineStyle(t.defaultStrokeWidth,this.debugBodyColor,1),this.isCircle?t.strokeCircle(i,n,this.width/2):t.strokeRect(e.x,e.y,this.width,this.height))},willDrawDebug:function(){return this.debugShowBody},setMass:function(t){return t<=0&&(t=.1),this.mass=t,this},x:{get:function(){return this.position.x},set:function(t){this.world.staticTree.remove(this),this.position.x=t,this.world.staticTree.insert(this)}},y:{get:function(){return this.position.y},set:function(t){this.world.staticTree.remove(this),this.position.y=t,this.world.staticTree.insert(this)}},left:{get:function(){return this.position.x}},right:{get:function(){return this.position.x+this.width}},top:{get:function(){return this.position.y}},bottom:{get:function(){return this.position.y+this.height}}});t.exports=h},function(t,e,i){var n=new(i(0))({initialize:function(t){this.pluginManager=t,this.game=t.game},init:function(){},start:function(){},stop:function(){},destroy:function(){this.pluginManager=null,this.game=null,this.scene=null,this.systems=null}});t.exports=n},function(t,e,i){var n=new(i(3));t.exports=function(t,e,i,r){var s=i.tilemapLayer,o=s.cullPaddingX,a=s.cullPaddingY,h=s.tilemap.tileToWorldXY(t,e,n,r,s);return h.x>r.worldView.x+s.scaleX*i.tileWidth*(-o-.5)&&h.xr.worldView.y+s.scaleY*i.tileHeight*(-a-1)&&h.y=0;s--)if(n(s,o,t,e)){if(!(a=l[o][s])||-1===a.index||!a.visible||0===a.alpha)continue;i.push(a)}}else if(2===r){for(o=p;o>=0;o--)for(s=0;l[o]&&s=0;o--)for(s=d;l[o]&&s>=0;s--)if(n(s,o,t,e)){if(!(a=l[o][s])||-1===a.index||!a.visible||0===a.alpha)continue;i.push(a)}return h.tilesDrawn=i.length,h.tilesTotal=u*c,i}},function(t,e,i){var n=i(549),r=i(159);t.exports=function(t,e,i,s){void 0===i&&(i=[]),void 0===s&&(s=0),i.length=0;var o=t.tilemapLayer;if(!o.skipCull&&1===o.scrollFactorX&&1===o.scrollFactorY){var a=n(t,e);r(t,a,s,i)}return i}},function(t,e,i){var n=i(139),r=i(76);t.exports=function(t,e){var i=t.tilemapLayer.tilemap,s=t.tilemapLayer,o=Math.floor(i.tileWidth*s.scaleX),a=Math.floor(i.tileHeight*s.scaleY);return{left:r(e.worldView.x-s.x,o,0,!0)-s.cullPaddingX,right:n(e.worldView.right-s.x,o,0,!0)+s.cullPaddingX,top:r(e.worldView.y-s.y,a/2,0,!0)-s.cullPaddingY,bottom:n(e.worldView.bottom-s.y,a/2,0,!0)+s.cullPaddingY}}},function(t,e,i){var n=i(3);t.exports=function(t,e,i,r,s){i||(i=new n);var o=s.baseTileWidth,a=s.baseTileHeight,h=s.tilemapLayer,l=0,u=0;h&&(r||(r=h.scene.cameras.main),l=h.x+r.scrollX*(1-h.scrollFactorX),o*=h.scaleX,u=h.y+r.scrollY*(1-h.scrollFactorY),a*=h.scaleY);var c=s.hexSideLength,d=l+t*o+e%2*(o/2),p=u+e*((a-c)/2+c);return i.set(d,p)}},function(t,e,i){var n=i(3);t.exports=function(t,e,i,r,s){i||(i=new n);var o=s.baseTileWidth,a=s.baseTileHeight,h=s.tilemapLayer,l=0,u=0;h&&(r||(r=h.scene.cameras.main),l=h.x+r.scrollX*(1-h.scrollFactorX),o*=h.scaleX,u=h.y+r.scrollY*(1-h.scrollFactorY),a*=h.scaleY);var c=l+o/2*(t-e),d=u+(t+e)*(a/2);return i.set(c,d)}},function(t,e,i){var n=i(3);t.exports=function(t,e,i,r,s){i||(i=new n);var o=s.baseTileWidth,a=s.baseTileHeight,h=s.tilemapLayer,l=0,u=0;h&&(r||(r=h.scene.cameras.main),l=h.x+r.scrollX*(1-h.scrollFactorX),o*=h.scaleX,u=h.y+r.scrollY*(1-h.scrollFactorY),a*=h.scaleY);var c=l+t*o+e%2*(o/2),d=u+e*(a/2);return i.set(c,d)}},function(t,e,i){var n=i(253),r=i(254),s=i(3);t.exports=function(t,e,i,o,a){return i||(i=new s(0,0)),i.x=n(t,o,a),i.y=r(e,o,a),i}},function(t,e){t.exports=function(t,e,i){var n=i.baseTileHeight,r=i.tilemapLayer,s=0;r&&(void 0===e&&(e=r.scene.cameras.main),s=r.y+e.scrollY*(1-r.scrollFactorY),n*=r.scaleY);var o=r.tilemap.hexSideLength;return s+t*((n-o)/2+o)}},function(t,e){t.exports=function(t,e,i){var n=i.baseTileHeight,r=i.tilemapLayer,s=0;return r&&(void 0===e&&(e=r.scene.cameras.main),s=r.y+e.scrollY*(1-r.scrollFactorY),n*=r.scaleY),s+t*(n/2)}},function(t,e,i){var n=i(3);t.exports=function(t,e,i,r,s,o){r||(r=new n);var a=o.baseTileWidth,h=o.baseTileHeight,l=o.tilemapLayer;l&&(s||(s=l.scene.cameras.main),e-=l.y+s.scrollY*(1-l.scrollFactorY),h*=l.scaleY,t-=l.x+s.scrollX*(1-l.scrollFactorX),a*=l.scaleX);var u=o.hexSideLength,c=(h-u)/2+u,d=i?Math.floor(e/c):e/c,p=i?Math.floor((t-d%2*.5*a)/a):(t-d%2*.5*a)/a;return r.set(p,d)}},function(t,e,i){var n=i(3);t.exports=function(t,e,i,r,s,o){r||(r=new n);var a=o.baseTileWidth,h=o.baseTileHeight,l=o.tilemapLayer;l&&(s||(s=l.scene.cameras.main),e-=l.y+s.scrollY*(1-l.scrollFactorY),h*=l.scaleY,t-=l.x+s.scrollX*(1-l.scrollFactorX),a*=l.scaleX);var u=i?Math.floor((t/(a/2)+e/(h/2))/2):(t/(a/2)+e/(h/2))/2,c=i?Math.floor((e/(h/2)-t/(a/2))/2):(e/(h/2)-t/(a/2))/2;return r.set(u,c)}},function(t,e,i){var n=i(3);t.exports=function(t,e,i,r,s,o){r||(r=new n);var a=o.baseTileWidth,h=o.baseTileHeight,l=o.tilemapLayer;l&&(s||(s=l.scene.cameras.main),e-=l.y+s.scrollY*(1-l.scrollFactorY),h*=l.scaleY,t-=l.x+s.scrollX*(1-l.scrollFactorX),a*=l.scaleX);var u=i?Math.floor(e/(h/2)):e/(h/2),c=i?Math.floor((t+u%2*.5*a)/a):(t+u%2*.5*a)/a;return r.set(c,u)}},function(t,e,i){var n=i(255),r=i(256),s=i(3);t.exports=function(t,e,i,o,a,h){return void 0===i&&(i=!0),o||(o=new s(0,0)),o.x=n(t,i,a,h),o.y=r(e,i,a,h),o}},function(t,e){t.exports=function(t,e,i,n){var r=n.baseTileHeight,s=n.tilemapLayer;s&&(i||(i=s.scene.cameras.main),t-=s.y+i.scrollY*(1-s.scrollFactorY),r*=s.scaleY);var o=n.hexSideLength,a=(r-o)/2+o;return e?Math.floor(t/a):t/a}},function(t,e){t.exports=function(t,e,i,n){var r=n.baseTileHeight,s=n.tilemapLayer;return s&&(i||(i=s.scene.cameras.main),t-=s.y+i.scrollY*(1-s.scrollFactorY),r*=s.scaleY),e?Math.floor(t/(r/2)):t/(r/2)}},function(t,e,i){var n=i(119);t.exports=function(t,e,i){if(n(t,e,i)){var r=i.data[e][t];return null!==r&&r.index>-1}return!1}},function(t,e,i){var n=i(85),r=i(119),s=i(252);t.exports=function(t,e,i,o,a){if(void 0===i&&(i=!0),void 0===o&&(o=!0),!r(t,e,a))return null;var h=a.data[e][t];return h?(a.data[e][t]=i?null:new n(a,-1,t,e,a.tileWidth,a.tileHeight),o&&h&&h.collides&&s(t,e,a),h):null}},function(t,e,i){var n=i(40),r=i(259),s=i(565),o=i(566),a=i(577);t.exports=function(t,e,i,h,l,u){var c;switch(e){case n.ARRAY_2D:c=r(t,i,h,l,u);break;case n.CSV:c=s(t,i,h,l,u);break;case n.TILED_JSON:c=o(t,i,u);break;case n.WELTMEISTER:c=a(t,i,u);break;default:c=null}return c}},function(t,e,i){var n=i(40),r=i(259);t.exports=function(t,e,i,s,o){var a=e.trim().split("\n").map((function(t){return t.split(",")})),h=r(t,a,i,s,o);return h.format=n.CSV,h}},function(t,e,i){var n=i(567),r=i(568),s=i(29),o=i(40),a=i(258),h=i(121),l=i(569),u=i(570),c=i(573),d=i(575);t.exports=function(t,e,i){var p=new h({width:e.width,height:e.height,name:t,tileWidth:e.tilewidth,tileHeight:e.tileheight,orientation:a(e.orientation),format:o.TILED_JSON,version:e.version,properties:e.properties,renderOrder:e.renderorder,infinite:e.infinite});p.orientation===s.HEXAGONAL&&(p.hexSideLength=e.hexsidelength),p.layers=c(e,i),p.images=l(e);var f=d(e);return p.tilesets=f.tilesets,p.imageCollections=f.imageCollections,p.objects=u(e),p.tiles=r(p),n(p),p}},function(t,e,i){var n=i(17);t.exports=function(t){for(var e,i,r,s,o,a=0;a0;)if(s.i>=s.layers.length){if(i.length<1)break;s=i.pop()}else{var o=s.layers[s.i];if(s.i++,"imagelayer"===o.type){var a=n(o,"offsetx",0)+n(o,"startx",0),h=n(o,"offsety",0)+n(o,"starty",0);e.push({name:s.name+o.name,image:o.image,x:s.x+a+o.x,y:s.y+h+o.y,alpha:s.opacity*o.opacity,visible:s.visible&&o.visible,properties:n(o,"properties",{})})}else if("group"===o.type){var l=r(t,o,s);i.push(s),s=l}}return e}},function(t,e,i){var n=i(2),r=i(260),s=i(572),o=i(161);t.exports=function(t){for(var e=[],i=[],a=o(t);a.i0;)if(a.i>=a.layers.length){if(i.length<1)break;a=i.pop()}else{var h=a.layers[a.i];if(a.i++,h.opacity*=a.opacity,h.visible=a.visible&&h.visible,"objectgroup"===h.type){h.name=a.name+h.name;for(var l=a.x+n(h,"startx",0)+n(h,"offsetx",0),u=a.y+n(h,"starty",0)+n(h,"offsety",0),c=[],d=0;d0;)if(p.i>=p.layers.length){if(d.length<1)break;p=d.pop()}else{var f=p.layers[p.i];if(p.i++,"tilelayer"===f.type){if(!f.compression){if(f.encoding&&"base64"===f.encoding){if(f.chunks)for(var m=0;m0?((y=new u(g,v.gid,O,D,t.tilewidth,t.tileheight)).rotation=v.rotation,y.flipX=v.flipped,w[D][O]=y):(x=e?null:new u(g,-1,O,D,t.tilewidth,t.tileheight),w[D][O]=x),++b===M.width&&(P++,b=0)}}else{(g=new h({name:p.name+f.name,x:p.x+a(f,"offsetx",0)+f.x,y:p.y+a(f,"offsety",0)+f.y,width:f.width,height:f.height,tileWidth:t.tilewidth,tileHeight:t.tileheight,alpha:p.opacity*f.opacity,visible:p.visible&&f.visible,properties:a(f,"properties",[]),orientation:o(t.orientation)})).orientation===r.HEXAGONAL&&(g.hexSideLength=t.hexsidelength);for(var B=[],I=0,F=f.data.length;I0?((y=new u(g,v.gid,b,w.length,t.tilewidth,t.tileheight)).rotation=v.rotation,y.flipX=v.flipped,B.push(y)):(x=e?null:new u(g,-1,b,w.length,t.tilewidth,t.tileheight),B.push(x)),++b===f.width&&(w.push(B),b=0,B=[])}g.data=w,c.push(g)}}else if("group"===f.type){var k=s(t,f,p);d.push(p),p=k}}return c}},function(t,e){t.exports=function(t){for(var e=window.atob(t),i=e.length,n=new Array(i/4),r=0;r>>0;return n}},function(t,e,i){var n=i(122),r=i(576),s=i(260),o=i(1453);t.exports=function(t){for(var e,i=[],a=[],h=null,l=0;l1){var d=void 0,p=void 0;if(Array.isArray(u.tiles)){d=d||{},p=p||{};for(var f=0;f=this.firstgid&&ta&&(a=e.layer[l].width),e.layer[l].height>h&&(h=e.layer[l].height);var u=new r({width:a,height:h,name:t,tileWidth:e.layer[0].tilesize,tileHeight:e.layer[0].tilesize,format:n.WELTMEISTER});return u.layers=s(e,i),u.tilesets=o(e),u}},function(t,e,i){var n=i(120),r=i(85);t.exports=function(t,e){for(var i=[],s=0;s-1?new r(a,p,c,u,o.tilesize,o.tilesize):e?null:new r(a,-1,c,u,o.tilesize,o.tilesize),h.push(d)}l.push(h),h=[]}a.data=l,i.push(a)}return i}},function(t,e,i){var n=i(122);t.exports=function(t){for(var e=[],i=[],r=0;r-1&&(this.renderOrder=t),this},addTilesetImage:function(t,e,i,n,r,o,a){if(void 0===t)return null;if(null==e&&(e=t),!this.scene.sys.textures.exists(e))return null;var h=this.scene.sys.textures.get(e),l=this.getTilesetIndex(t);if(null===l&&this.format===s.TILED_JSON)return null;var u=this.tilesets[l];return u?(u.setTileSize(i,n),u.setSpacing(r,o),u.setImage(h),u):(void 0===i&&(i=this.tileWidth),void 0===n&&(n=this.tileHeight),void 0===r&&(r=0),void 0===o&&(o=0),void 0===a&&(a=0),(u=new m(t,a,i,n,r,o)).setImage(h),this.tilesets.push(u),u)},copy:function(t,e,i,n,r,s,o,a){return null!==(a=this.getLayer(a))?(p.Copy(t,e,i,n,r,s,o,a),this):null},createBlankLayer:function(t,e,i,n,r,s,o,h){if(void 0===i&&(i=0),void 0===n&&(n=0),void 0===r&&(r=this.width),void 0===s&&(s=this.height),void 0===o&&(o=this.tileWidth),void 0===h&&(h=this.tileHeight),null!==this.getLayerIndex(t))return null;for(var l,u=new a({name:t,tileWidth:o,tileHeight:h,width:r,height:s,orientation:this.orientation}),c=0;c-1&&this.putTileAt(e,s.x,s.y,i,s.tilemapLayer)}return n},removeTileAt:function(t,e,i,n,r){return void 0===i&&(i=!0),void 0===n&&(n=!0),null===(r=this.getLayer(r))?null:p.RemoveTileAt(t,e,i,n,r)},removeTileAtWorldXY:function(t,e,i,n,r,s){return void 0===i&&(i=!0),void 0===n&&(n=!0),null===(s=this.getLayer(s))?null:p.RemoveTileAtWorldXY(t,e,i,n,r,s)},renderDebug:function(t,e,i){return null===(i=this.getLayer(i))?null:(this.orientation===h.ORTHOGONAL&&p.RenderDebug(t,e,i),this)},renderDebugFull:function(t,e){for(var i=this.layers,n=0;n=0&&t<4&&(this._renderOrder=t),this},calculateFacesAt:function(t,e){return o.CalculateFacesAt(t,e,this.layer),this},calculateFacesWithin:function(t,e,i,n){return o.CalculateFacesWithin(t,e,i,n,this.layer),this},createFromTiles:function(t,e,i,n,r){return o.CreateFromTiles(t,e,i,n,r,this.layer)},cull:function(t){return this.cullCallback(this.layer,t,this.culledTiles,this._renderOrder)},copy:function(t,e,i,n,r,s,a){return o.Copy(t,e,i,n,r,s,a,this.layer),this},fill:function(t,e,i,n,r,s){return o.Fill(t,e,i,n,r,s,this.layer),this},filterTiles:function(t,e,i,n,r,s,a){return o.FilterTiles(t,e,i,n,r,s,a,this.layer)},findByIndex:function(t,e,i){return o.FindByIndex(t,e,i,this.layer)},findTile:function(t,e,i,n,r,s,a){return o.FindTile(t,e,i,n,r,s,a,this.layer)},forEachTile:function(t,e,i,n,r,s,a){return o.ForEachTile(t,e,i,n,r,s,a,this.layer),this},getTileAt:function(t,e,i){return o.GetTileAt(t,e,i,this.layer)},getTileAtWorldXY:function(t,e,i,n){return o.GetTileAtWorldXY(t,e,i,n,this.layer)},getTilesWithin:function(t,e,i,n,r){return o.GetTilesWithin(t,e,i,n,r,this.layer)},getTilesWithinShape:function(t,e,i){return o.GetTilesWithinShape(t,e,i,this.layer)},getTilesWithinWorldXY:function(t,e,i,n,r,s){return o.GetTilesWithinWorldXY(t,e,i,n,r,s,this.layer)},hasTileAt:function(t,e){return o.HasTileAt(t,e,this.layer)},hasTileAtWorldXY:function(t,e,i){return o.HasTileAtWorldXY(t,e,i,this.layer)},putTileAt:function(t,e,i,n){return o.PutTileAt(t,e,i,n,this.layer)},putTileAtWorldXY:function(t,e,i,n,r){return o.PutTileAtWorldXY(t,e,i,n,r,this.layer)},putTilesAt:function(t,e,i,n){return o.PutTilesAt(t,e,i,n,this.layer),this},randomize:function(t,e,i,n,r){return o.Randomize(t,e,i,n,r,this.layer),this},removeTileAt:function(t,e,i,n){return o.RemoveTileAt(t,e,i,n,this.layer)},removeTileAtWorldXY:function(t,e,i,n,r){return o.RemoveTileAtWorldXY(t,e,i,n,r,this.layer)},renderDebug:function(t,e){return o.RenderDebug(t,e,this.layer),this},replaceByIndex:function(t,e,i,n,r,s){return o.ReplaceByIndex(t,e,i,n,r,s,this.layer),this},setSkipCull:function(t){return void 0===t&&(t=!0),this.skipCull=t,this},setCullPadding:function(t,e){return void 0===t&&(t=1),void 0===e&&(e=1),this.cullPaddingX=t,this.cullPaddingY=e,this},setCollision:function(t,e,i,n){return o.SetCollision(t,e,i,this.layer,n),this},setCollisionBetween:function(t,e,i,n){return o.SetCollisionBetween(t,e,i,n,this.layer),this},setCollisionByProperty:function(t,e,i){return o.SetCollisionByProperty(t,e,i,this.layer),this},setCollisionByExclusion:function(t,e,i){return o.SetCollisionByExclusion(t,e,i,this.layer),this},setCollisionFromCollisionGroup:function(t,e){return o.SetCollisionFromCollisionGroup(t,e,this.layer),this},setTileIndexCallback:function(t,e,i){return o.SetTileIndexCallback(t,e,i,this.layer),this},setTileLocationCallback:function(t,e,i,n,r,s){return o.SetTileLocationCallback(t,e,i,n,r,s,this.layer),this},shuffle:function(t,e,i,n){return o.Shuffle(t,e,i,n,this.layer),this},swapByIndex:function(t,e,i,n,r,s){return o.SwapByIndex(t,e,i,n,r,s,this.layer),this},tileToWorldX:function(t,e){return this.tilemap.tileToWorldX(t,e,this)},tileToWorldY:function(t,e){return this.tilemap.tileToWorldY(t,e,this)},tileToWorldXY:function(t,e,i,n){return this.tilemap.tileToWorldXY(t,e,i,n,this)},weightedRandomize:function(t,e,i,n,r){return o.WeightedRandomize(e,i,n,r,t,this.layer),this},worldToTileX:function(t,e,i){return this.tilemap.worldToTileX(t,e,i,this)},worldToTileY:function(t,e,i){return this.tilemap.worldToTileY(t,e,i,this)},worldToTileXY:function(t,e,i,n,r){return this.tilemap.worldToTileXY(t,e,i,n,r,this)},destroy:function(t){void 0===t&&(t=!0),this.tilemap&&(this.layer.tilemapLayer===this&&(this.layer.tilemapLayer=void 0),t&&this.tilemap.removeLayer(this),this.tilemap=void 0,this.layer=void 0,this.culledTiles.length=0,this.cullCallback=null,this.gidMap=[],this.tileset=[],s.prototype.destroy.call(this))}});t.exports=h},function(t,e,i){var n=i(0),r=i(2),s=new n({initialize:function(t){this.delay=0,this.repeat=0,this.repeatCount=0,this.loop=!1,this.callback,this.callbackScope,this.args,this.timeScale=1,this.startAt=0,this.elapsed=0,this.paused=!1,this.hasDispatched=!1,this.reset(t)},reset:function(t){return this.delay=r(t,"delay",0),this.repeat=r(t,"repeat",0),this.loop=r(t,"loop",!1),this.callback=r(t,"callback",void 0),this.callbackScope=r(t,"callbackScope",this.callback),this.args=r(t,"args",[]),this.timeScale=r(t,"timeScale",1),this.startAt=r(t,"startAt",0),this.paused=r(t,"paused",!1),this.elapsed=this.startAt,this.hasDispatched=!1,this.repeatCount=-1===this.repeat||this.loop?999999999999:this.repeat,this},getProgress:function(){return this.elapsed/this.delay},getOverallProgress:function(){if(this.repeat>0){var t=this.delay+this.delay*this.repeat;return(this.elapsed+this.delay*(this.repeat-this.repeatCount))/t}return this.getProgress()},getRepeatCount:function(){return this.repeatCount},getElapsed:function(){return this.elapsed},getElapsedSeconds:function(){return.001*this.elapsed},getRemaining:function(){return this.delay-this.elapsed},getRemainingSeconds:function(){return.001*this.getRemaining()},getOverallRemaining:function(){return this.delay*(1+this.repeatCount)-this.elapsed},getOverallRemainingSeconds:function(){return.001*this.getOverallRemaining()},remove:function(t){void 0===t&&(t=!1),this.elapsed=this.delay,this.hasDispatched=!t,this.repeatCount=0},destroy:function(){this.callback=void 0,this.callbackScope=void 0,this.args=[]}});t.exports=s},function(t,e,i){var n=i(1465);t.exports=function(t){var e,i=[];if(t.hasOwnProperty("props"))for(e in t.props)"_"!==e.substr(0,1)&&i.push({key:e,value:t.props[e]});else for(e in t)-1===n.indexOf(e)&&"_"!==e.substr(0,1)&&i.push({key:e,value:t[e]});return i}},function(t,e,i){var n=i(6);t.exports=function(t){var e=n(t,"tweens",null);return null===e?[]:("function"==typeof e&&(e=e.call()),Array.isArray(e)||(e=[e]),e)}},function(t,e,i){var n=i(265),r=i(13),s=i(99),o=i(80),a=i(162),h=i(6),l=i(264),u=i(266),c=i(268);t.exports=function(t,e,i){void 0===i&&(i=n);var d=h(e,"from",0),p=h(e,"to",1),f=[{value:d}],m=a(e,"delay",i.delay),g=a(e,"duration",i.duration),v=h(e,"easeParams",i.easeParams),y=o(h(e,"ease",i.ease),v),x=a(e,"hold",i.hold),w=a(e,"repeat",i.repeat),b=a(e,"repeatDelay",i.repeatDelay),A=s(e,"yoyo",i.yoyo),T=[],S=l("value",p),E=c(f[0],0,"value",S.getEnd,S.getStart,S.getActive,y,m,g,A,x,w,b,!1,!1);E.start=d,E.current=d,E.to=p,T.push(E);var M=new u(t,T,f);M.offset=r(e,"offset",null),M.completeDelay=r(e,"completeDelay",0),M.loop=Math.round(r(e,"loop",0)),M.loopDelay=Math.round(r(e,"loopDelay",0)),M.paused=s(e,"paused",!1),M.useFrames=s(e,"useFrames",!1);for(var _=h(e,"callbackScope",M),C=[M,null],P=u.TYPES,R=0;RS&&(S=_),T[E][M]=_}}}var C=o?n(o):null;return a?function(t,e,n,r){var s,o=0,a=r%v,h=Math.floor(r/v);if(a>=0&&a=0&&h0?Math.floor(D/L.length):h(e,"duration",O.duration),O.delay=h(e,"delay",O.delay),O.easeParams=c(e,"easeParams",O.easeParams),O.ease=a(c(e,"ease",O.ease),O.easeParams),O.hold=h(e,"hold",O.hold),O.repeat=h(e,"repeat",O.repeat),O.repeatDelay=h(e,"repeatDelay",O.repeatDelay),O.yoyo=o(e,"yoyo",O.yoyo),O.flipX=o(e,"flipX",O.flipX),O.flipY=o(e,"flipY",O.flipY);for(var B=0;B0?this.totalDuration=this.duration+this.completeDelay+(this.duration+this.loopDelay)*this.loopCounter:this.totalDuration=this.duration+this.completeDelay},init:function(){return this.calcDuration(),this.progress=0,this.totalProgress=0,!this.paused||(this.state=a.PAUSED,!1)},resetTweens:function(t){for(var e=0;e0?(this.elapsed=0,this.progress=0,this.loopCounter--,this.resetTweens(!0),this.loopDelay>0?(this.countdown=this.loopDelay,this.state=a.LOOP_DELAY):(this.state=a.ACTIVE,this.dispatchTimelineEvent(s.TIMELINE_LOOP,this.callbacks.onLoop))):this.completeDelay>0?(this.state=a.COMPLETE_DELAY,this.countdown=this.completeDelay):(this.state=a.PENDING_REMOVE,this.dispatchTimelineEvent(s.TIMELINE_COMPLETE,this.callbacks.onComplete))},update:function(t,e){if(this.state!==a.PAUSED){switch(this.useFrames&&(e=1*this.manager.timeScale),e*=this.timeScale,this.elapsed+=e,this.progress=Math.min(this.elapsed/this.duration,1),this.totalElapsed+=e,this.totalProgress=Math.min(this.totalElapsed/this.totalDuration,1),this.state){case a.ACTIVE:for(var i=this.totalData,n=0;nm&&(m=y),a.translate(v,{x:.5*x,y:.5*y}),c=v.bounds.max.x+s,r.addBody(u,v),l=v,p+=1}else c+=s}d+=m+o,c=t}return u},n.chain=function(t,e,i,n,a,h){for(var l=t.bodies,u=1;u0)for(l=0;l0&&(d=p[l-1+(h-1)*e],r.addConstraint(t,s.create(o.extend({bodyA:d,bodyB:c},a)))),n&&ld||o<(l=d-l)||o>i-1-l))return 1===c&&a.translate(u,{x:(o+(i%2==1?1:-1))*p,y:0}),h(t+(u?o*p:0)+o*s,n,o,l,u,c)}))},n.newtonsCradle=function(t,e,i,n,o){for(var a=r.create({label:"Newtons Cradle"}),l=0;l1;if(!d||t!=d.x||e!=d.y){d&&n?(p=d.x,f=d.y):(p=0,f=0);var r={x:p+t,y:f+e};!n&&d||(d=r),m.push(r),v=p+t,y=f+e}},w=function(t){var e=t.pathSegTypeAsLetter.toUpperCase();if("Z"!==e){switch(e){case"M":case"L":case"T":case"C":case"S":case"Q":v=t.x,y=t.y;break;case"H":v=t.x;break;case"V":y=t.y}x(v,y,t.pathSegType)}};for(n._svgPathToAbsolute(t),o=t.getTotalLength(),l=[],i=0;i0?this.setFromTileCollision(i):this.setFromTileRectangle(i)}},setFromTileRectangle:function(t){void 0===t&&(t={}),l(t,"isStatic")||(t.isStatic=!0),l(t,"addToWorld")||(t.addToWorld=!0);var e=this.tile.getBounds(),i=e.x+e.width/2,r=e.y+e.height/2,s=n.rectangle(i,r,e.width,e.height,t);return this.setBody(s,t.addToWorld),this},setFromTileCollision:function(t){void 0===t&&(t={}),l(t,"isStatic")||(t.isStatic=!0),l(t,"addToWorld")||(t.addToWorld=!0);for(var e=this.tile.tilemapLayer.scaleX,i=this.tile.tilemapLayer.scaleY,s=this.tile.getLeft(),o=this.tile.getTop(),a=this.tile.getCollisionGroup(),c=h(a,"objects",[]),d=[],p=0;p1&&(t.parts=d,this.setBody(r.create(t),t.addToWorld)),this},setBody:function(t,e){return void 0===e&&(e=!0),this.body&&this.removeBody(),this.body=t,this.body.gameObject=this,e&&this.world.add(this.body),this},removeBody:function(){return this.body&&(this.world.remove(this.body),this.body.gameObject=void 0,this.body=void 0),this},destroy:function(){this.removeBody(),this.tile.physics.matterBody=void 0,this.removeAllListeners()}});t.exports=c},function(t,e,i){var n=i(1399);n.Body=i(41),n.Composite=i(118),n.World=i(596),n.Detector=i(273),n.Grid=i(597),n.Pairs=i(598),n.Pair=i(250),n.Query=i(1400),n.Resolver=i(599),n.SAT=i(274),n.Constraint=i(128),n.Common=i(32),n.Engine=i(1401),n.Events=i(166),n.Sleeping=i(165),n.Plugin=i(595),n.Bodies=i(86),n.Composites=i(591),n.Axes=i(271),n.Bounds=i(84),n.Svg=i(592),n.Vector=i(83),n.Vertices=i(64),n.World.add=n.Composite.add,n.World.remove=n.Composite.remove,n.World.addComposite=n.Composite.addComposite,n.World.addBody=n.Composite.addBody,n.World.addConstraint=n.Composite.addConstraint,n.World.clear=n.Composite.clear,t.exports=n},function(t,e,i){var n={};t.exports=n;var r=i(32);n._registry={},n.register=function(t){if(n.isPlugin(t)||r.warn("Plugin.register:",n.toString(t),"does not implement all required fields."),t.name in n._registry){var e=n._registry[t.name],i=n.versionParse(t.version).number,s=n.versionParse(e.version).number;i>s?(r.warn("Plugin.register:",n.toString(e),"was upgraded to",n.toString(t)),n._registry[t.name]=t):i-1},n.isFor=function(t,e){var i=t.for&&n.dependencyParse(t.for);return!t.for||e.name===i.name&&n.versionSatisfies(e.version,i.range)},n.use=function(t,e){if(t.uses=(t.uses||[]).concat(e||[]),0!==t.uses.length){for(var i=n.dependencies(t),s=r.topologicalSort(i),o=[],a=0;a0&&!h.silent&&r.info(o.join(" "))}else r.warn("Plugin.use:",n.toString(t),"does not specify any dependencies to install.")},n.dependencies=function(t,e){var i=n.dependencyParse(t),s=i.name;if(!(s in(e=e||{}))){t=n.resolve(t)||t,e[s]=r.map(t.uses||[],(function(e){n.isPlugin(e)&&n.register(e);var s=n.dependencyParse(e),o=n.resolve(e);return o&&!n.versionSatisfies(o.version,s.range)?(r.warn("Plugin.dependencies:",n.toString(o),"does not satisfy",n.toString(s),"used by",n.toString(i)+"."),o._warned=!0,t._warned=!0):o||(r.warn("Plugin.dependencies:",n.toString(e),"used by",n.toString(i),"could not be resolved."),t._warned=!0),s.name}));for(var o=0;o=r[2];if("^"===i.operator)return r[0]>0?o[0]===r[0]&&s.number>=i.number:r[1]>0?o[1]===r[1]&&o[2]>=r[2]:o[2]===r[2]}return t===e||"*"===t}},function(t,e,i){var n={};t.exports=n;var r=i(118),s=(i(128),i(32));n.create=function(t){var e=r.create(),i={label:"World",gravity:{x:0,y:1,scale:.001},bounds:{min:{x:-1/0,y:-1/0},max:{x:1/0,y:1/0}}};return s.extend(e,i,t)}},function(t,e,i){var n={};t.exports=n;var r=i(250),s=i(273),o=i(32);n.create=function(t){var e={controller:n,detector:s.collisions,buckets:{},pairs:{},pairsList:[],bucketWidth:48,bucketHeight:48};return o.extend(e,t)},n.update=function(t,e,i,r){var s,o,a,h,l,u=i.world,c=t.buckets,d=!1,p=i.metrics;for(p.broadphaseTests=0,s=0;su.bounds.max.x||f.bounds.max.yu.bounds.max.y)){var m=n._getRegion(t,f);if(!f.region||m.id!==f.region.id||r){p.broadphaseTests+=1,f.region&&!r||(f.region=m);var g=n._regionUnion(m,f.region);for(o=g.startCol;o<=g.endCol;o++)for(a=g.startRow;a<=g.endRow;a++){h=c[l=n._getBucketId(o,a)];var v=o>=m.startCol&&o<=m.endCol&&a>=m.startRow&&a<=m.endRow,y=o>=f.region.startCol&&o<=f.region.endCol&&a>=f.region.startRow&&a<=f.region.endRow;!v&&y&&y&&h&&n._bucketRemoveBody(t,h,f),(f.region===m||v&&!y||r)&&(h||(h=n._createBucket(c,l)),n._bucketAddBody(t,h,f))}f.region=m,d=!0}}}d&&(t.pairsList=n._createActivePairsList(t))},n.clear=function(t){t.buckets={},t.pairs={},t.pairsList=[]},n._regionUnion=function(t,e){var i=Math.min(t.startCol,e.startCol),r=Math.max(t.endCol,e.endCol),s=Math.min(t.startRow,e.startRow),o=Math.max(t.endRow,e.endRow);return n._createRegion(i,r,s,o)},n._getRegion=function(t,e){var i=e.bounds,r=Math.floor(i.min.x/t.bucketWidth),s=Math.floor(i.max.x/t.bucketWidth),o=Math.floor(i.min.y/t.bucketHeight),a=Math.floor(i.max.y/t.bucketHeight);return n._createRegion(r,s,o,a)},n._createRegion=function(t,e,i,n){return{id:t+","+e+","+i+","+n,startCol:t,endCol:e,startRow:i,endRow:n}},n._getBucketId=function(t,e){return"C"+t+"R"+e},n._createBucket=function(t,e){return t[e]=[]},n._bucketAddBody=function(t,e,i){for(var n=0;n0?n.push(i):delete t.pairs[e[r]];return n}},function(t,e,i){var n={};t.exports=n;var r=i(250),s=i(32);n._pairMaxIdleLife=1e3,n.create=function(t){return s.extend({table:{},list:[],collisionStart:[],collisionActive:[],collisionEnd:[]},t)},n.update=function(t,e,i){var n,s,o,a,h=t.list,l=t.table,u=t.collisionStart,c=t.collisionEnd,d=t.collisionActive;for(u.length=0,c.length=0,d.length=0,a=0;an._pairMaxIdleLife&&l.push(o);for(o=0;op.friction*p.frictionStatic*B*i&&(F=L,I=o.clamp(p.friction*O*i,-F,F));var k=s.cross(S,v),N=s.cross(E,v),z=w/(m.inverseMass+g.inverseMass+m.inverseInertia*k*k+g.inverseInertia*N*N);if(D*=z,I*=z,P<0&&P*P>n._restingThresh*i)A.normalImpulse=0;else{var U=A.normalImpulse;A.normalImpulse=Math.min(A.normalImpulse+D,0),D=A.normalImpulse-U}if(R*R>n._restingThreshTangent*i)A.tangentImpulse=0;else{var V=A.tangentImpulse;A.tangentImpulse=o.clamp(A.tangentImpulse+I,-F,F),I=A.tangentImpulse-V}r.x=v.x*D+y.x*I,r.y=v.y*D+y.y*I,m.isStatic||m.isSleeping||(m.positionPrev.x+=r.x*m.inverseMass,m.positionPrev.y+=r.y*m.inverseMass,m.anglePrev+=s.cross(S,r)*m.inverseInertia),g.isStatic||g.isSleeping||(g.positionPrev.x-=r.x*g.inverseMass,g.positionPrev.y-=r.y*g.inverseMass,g.anglePrev-=s.cross(E,r)*g.inverseInertia)}}}}},function(t,e){var i;i=function(){return this}();try{i=i||new Function("return this")()}catch(t){"object"==typeof window&&(i=window)}t.exports=i},function(t,e,i){var n=i(276);t.exports=function(t,e,i,r){for(var s=t[0],o=1;o0?r(o,i):i<0&&s(o,Math.abs(i));for(var a=0;a1)if(0===r){var d=t.length-1;for(o=t[d].x,a=t[d].y,h=d-1;h>=0;h--)l=(c=t[h]).x,u=c.y,c.x=o,c.y=a,o=l,a=u;t[d].x=e,t[d].y=i}else{for(o=t[0].x,a=t[0].y,h=1;hthis.maxZoom&&(e.zoom=this.maxZoom))}},destroy:function(){this.camera=null,this.left=null,this.right=null,this.up=null,this.down=null,this.zoomIn=null,this.zoomOut=null}});t.exports=s},function(t,e,i){var n=i(0),r=i(6),s=new n({initialize:function(t){this.camera=r(t,"camera",null),this.left=r(t,"left",null),this.right=r(t,"right",null),this.up=r(t,"up",null),this.down=r(t,"down",null),this.zoomIn=r(t,"zoomIn",null),this.zoomOut=r(t,"zoomOut",null),this.zoomSpeed=r(t,"zoomSpeed",.01),this.minZoom=r(t,"minZoom",.001),this.maxZoom=r(t,"maxZoom",1e3),this.accelX=0,this.accelY=0;var e=r(t,"acceleration",null);"number"==typeof e?(this.accelX=e,this.accelY=e):(this.accelX=r(t,"acceleration.x",0),this.accelY=r(t,"acceleration.y",0)),this.dragX=0,this.dragY=0;var i=r(t,"drag",null);"number"==typeof i?(this.dragX=i,this.dragY=i):(this.dragX=r(t,"drag.x",0),this.dragY=r(t,"drag.y",0)),this.maxSpeedX=0,this.maxSpeedY=0;var n=r(t,"maxSpeed",null);"number"==typeof n?(this.maxSpeedX=n,this.maxSpeedY=n):(this.maxSpeedX=r(t,"maxSpeed.x",0),this.maxSpeedY=r(t,"maxSpeed.y",0)),this._speedX=0,this._speedY=0,this._zoom=0,this.active=null!==this.camera},start:function(){return this.active=null!==this.camera,this},stop:function(){return this.active=!1,this},setCamera:function(t){return this.camera=t,this},update:function(t){if(this.active){void 0===t&&(t=1);var e=this.camera;this._speedX>0?(this._speedX-=this.dragX*t,this._speedX<0&&(this._speedX=0)):this._speedX<0&&(this._speedX+=this.dragX*t,this._speedX>0&&(this._speedX=0)),this._speedY>0?(this._speedY-=this.dragY*t,this._speedY<0&&(this._speedY=0)):this._speedY<0&&(this._speedY+=this.dragY*t,this._speedY>0&&(this._speedY=0)),this.up&&this.up.isDown?(this._speedY+=this.accelY,this._speedY>this.maxSpeedY&&(this._speedY=this.maxSpeedY)):this.down&&this.down.isDown&&(this._speedY-=this.accelY,this._speedY<-this.maxSpeedY&&(this._speedY=-this.maxSpeedY)),this.left&&this.left.isDown?(this._speedX+=this.accelX,this._speedX>this.maxSpeedX&&(this._speedX=this.maxSpeedX)):this.right&&this.right.isDown&&(this._speedX-=this.accelX,this._speedX<-this.maxSpeedX&&(this._speedX=-this.maxSpeedX)),this.zoomIn&&this.zoomIn.isDown?this._zoom=-this.zoomSpeed:this.zoomOut&&this.zoomOut.isDown?this._zoom=this.zoomSpeed:this._zoom=0,0!==this._speedX&&(e.scrollX-=this._speedX*t|0),0!==this._speedY&&(e.scrollY-=this._speedY*t|0),0!==this._zoom&&(e.zoom+=this._zoom,e.zoomthis.maxZoom&&(e.zoom=this.maxZoom))}},destroy:function(){this.camera=null,this.left=null,this.right=null,this.up=null,this.down=null,this.zoomIn=null,this.zoomOut=null}});t.exports=s},function(t,e,i){t.exports={Camera:i(326),BaseCamera:i(133),CameraManager:i(799),Effects:i(333),Events:i(37)}},function(t,e){t.exports="cameradestroy"},function(t,e){t.exports="camerafadeincomplete"},function(t,e){t.exports="camerafadeinstart"},function(t,e){t.exports="camerafadeoutcomplete"},function(t,e){t.exports="camerafadeoutstart"},function(t,e){t.exports="cameraflashcomplete"},function(t,e){t.exports="cameraflashstart"},function(t,e){t.exports="followupdate"},function(t,e){t.exports="camerapancomplete"},function(t,e){t.exports="camerapanstart"},function(t,e){t.exports="postrender"},function(t,e){t.exports="prerender"},function(t,e){t.exports="camerarotatecomplete"},function(t,e){t.exports="camerarotatestart"},function(t,e){t.exports="camerashakecomplete"},function(t,e){t.exports="camerashakestart"},function(t,e){t.exports="camerazoomcomplete"},function(t,e){t.exports="camerazoomstart"},function(t,e,i){var n=i(18),r=i(0),s=i(37),o=new r({initialize:function(t){this.camera=t,this.isRunning=!1,this.isComplete=!1,this.direction=!0,this.duration=0,this.red=0,this.green=0,this.blue=0,this.alpha=0,this.progress=0,this._elapsed=0,this._onUpdate,this._onUpdateScope},start:function(t,e,i,n,r,o,a,h){if(void 0===t&&(t=!0),void 0===e&&(e=1e3),void 0===i&&(i=0),void 0===n&&(n=0),void 0===r&&(r=0),void 0===o&&(o=!1),void 0===a&&(a=null),void 0===h&&(h=this.camera.scene),!o&&this.isRunning)return this.camera;this.isRunning=!0,this.isComplete=!1,this.duration=e,this.direction=t,this.progress=0,this.red=i,this.green=n,this.blue=r,this.alpha=t?Number.MIN_VALUE:1,this._elapsed=0,this._onUpdate=a,this._onUpdateScope=h;var l=t?s.FADE_OUT_START:s.FADE_IN_START;return this.camera.emit(l,this.camera,this,e,i,n,r),this.camera},update:function(t,e){this.isRunning&&(this._elapsed+=e,this.progress=n(this._elapsed/this.duration,0,1),this._onUpdate&&this._onUpdate.call(this._onUpdateScope,this.camera,this.progress),this._elapsed=1?1:1/e*(1+(e*t|0))}},function(t,e,i){var n=i(18),r=i(0),s=i(37),o=i(3),a=new r({initialize:function(t){this.camera=t,this.isRunning=!1,this.duration=0,this.intensity=new o,this.progress=0,this._elapsed=0,this._offsetX=0,this._offsetY=0,this._onUpdate,this._onUpdateScope},start:function(t,e,i,n,r){return void 0===t&&(t=100),void 0===e&&(e=.05),void 0===i&&(i=!1),void 0===n&&(n=null),void 0===r&&(r=this.camera.scene),!i&&this.isRunning||(this.isRunning=!0,this.duration=t,this.progress=0,"number"==typeof e?this.intensity.set(e):this.intensity.set(e.x,e.y),this._elapsed=0,this._offsetX=0,this._offsetY=0,this._onUpdate=n,this._onUpdateScope=r,this.camera.emit(s.SHAKE_START,this.camera,this,t,e)),this.camera},preRender:function(){this.isRunning&&this.camera.matrix.translate(this._offsetX,this._offsetY)},update:function(t,e){if(this.isRunning)if(this._elapsed+=e,this.progress=n(this._elapsed/this.duration,0,1),this._onUpdate&&this._onUpdate.call(this._onUpdateScope,this.camera,this.progress),this._elapsedthis.source?Math.abs(this.destination-this.source):Math.abs(this.destination+u)-this.source)<(p=this.source>this.destination?Math.abs(this.source-this.destination):Math.abs(this.source+u)-this.destination)?this.clockwise=!0:d>p&&(this.clockwise=!1)}return this.camera.emit(s.ROTATE_START,this.camera,this,i,l),c},update:function(t,e){if(this.isRunning){this._elapsed+=e;var i=n(this._elapsed/this.duration,0,1);this.progress=i;var r=this.camera;if(this._elapsed=l?Math.abs(h-l):Math.abs(h+a)-l;var u=0;u=this.clockwise?r.rotation+o*s:r.rotation-o*s,r.rotation=u,this._onUpdate&&this._onUpdate.call(this._onUpdateScope,r,i,u)}else r.rotation=this.destination,this._onUpdate&&this._onUpdate.call(this._onUpdateScope,r,i,this.destination),this.effectComplete()}},effectComplete:function(){this._onUpdate=null,this._onUpdateScope=null,this.isRunning=!1,this.camera.emit(s.ROTATE_COMPLETE,this.camera,this)},reset:function(){this.isRunning=!1,this._onUpdate=null,this._onUpdateScope=null},destroy:function(){this.reset(),this.camera=null,this.source=null,this.destination=null}});t.exports=a},function(t,e,i){var n=i(18),r=i(0),s=i(134),o=i(37),a=new r({initialize:function(t){this.camera=t,this.isRunning=!1,this.duration=0,this.source=1,this.destination=1,this.ease,this.progress=0,this._elapsed=0,this._onUpdate,this._onUpdateScope},start:function(t,e,i,n,r,a){void 0===e&&(e=1e3),void 0===i&&(i=s.Linear),void 0===n&&(n=!1),void 0===r&&(r=null),void 0===a&&(a=this.camera.scene);var h=this.camera;return!n&&this.isRunning||(this.isRunning=!0,this.duration=e,this.progress=0,this.source=h.zoom,this.destination=t,"string"==typeof i&&s.hasOwnProperty(i)?this.ease=s[i]:"function"==typeof i&&(this.ease=i),this._elapsed=0,this._onUpdate=r,this._onUpdateScope=a,this.camera.emit(o.ZOOM_START,this.camera,this,e,t)),h},update:function(t,e){this.isRunning&&(this._elapsed+=e,this.progress=n(this._elapsed/this.duration,0,1),this._elapsed0){s.preRender();var o=this.getVisibleChildren(e.getChildren(),s);t.render(i,o,s)}}},getVisibleChildren:function(t,e){for(var i=[],n=0;n1)for(var i=1;i=1)&&(r.touch=!0),(navigator.msPointerEnabled||navigator.pointerEnabled)&&(r.mspointer=!0),navigator.getGamepads&&(r.gamepads=!0),"onwheel"in window||n.ie&&"WheelEvent"in window?r.wheelEvent="wheel":"onmousewheel"in window?r.wheelEvent="mousewheel":n.firefox&&"MouseScrollEvent"in window&&(r.wheelEvent="DOMMouseScroll")),r)},function(t,e,i){var n=i(136),r={audioData:!1,dolby:!1,m4a:!1,mp3:!1,ogg:!1,opus:!1,wav:!1,webAudio:!1,webm:!1};t.exports=function(){if("function"==typeof importScripts)return r;r.audioData=!!window.Audio,r.webAudio=!(!window.AudioContext&&!window.webkitAudioContext);var t=document.createElement("audio"),e=!!t.canPlayType;try{if(e&&(t.canPlayType('audio/ogg; codecs="vorbis"').replace(/^no$/,"")&&(r.ogg=!0),(t.canPlayType('audio/ogg; codecs="opus"').replace(/^no$/,"")||t.canPlayType("audio/opus;").replace(/^no$/,""))&&(r.opus=!0),t.canPlayType("audio/mpeg;").replace(/^no$/,"")&&(r.mp3=!0),t.canPlayType("audio/wav").replace(/^no$/,"")&&(r.wav=!0),(t.canPlayType("audio/x-m4a;")||t.canPlayType("audio/aac;").replace(/^no$/,""))&&(r.m4a=!0),t.canPlayType('audio/webm; codecs="vorbis"').replace(/^no$/,"")&&(r.webm=!0),""!==t.canPlayType('audio/mp4;codecs="ec-3"')))if(n.edge)r.dolby=!0;else if(n.safari&&n.safariVersion>=9&&/Mac OS X (\d+)_(\d+)/.test(navigator.userAgent)){var i=parseInt(RegExp.$1,10),s=parseInt(RegExp.$2,10);(10===i&&s>=11||i>10)&&(r.dolby=!0)}}catch(t){}return r}()},function(t,e){var i={h264:!1,hls:!1,mp4:!1,ogg:!1,vp9:!1,webm:!1};t.exports=function(){if("function"==typeof importScripts)return i;var t=document.createElement("video"),e=!!t.canPlayType;try{e&&(t.canPlayType('video/ogg; codecs="theora"').replace(/^no$/,"")&&(i.ogg=!0),t.canPlayType('video/mp4; codecs="avc1.42E01E"').replace(/^no$/,"")&&(i.h264=!0,i.mp4=!0),t.canPlayType('video/webm; codecs="vp8, vorbis"').replace(/^no$/,"")&&(i.webm=!0),t.canPlayType('video/webm; codecs="vp9"').replace(/^no$/,"")&&(i.vp9=!0),t.canPlayType('application/x-mpegURL; codecs="avc1.42E01E"').replace(/^no$/,"")&&(i.hls=!0))}catch(t){}return i}()},function(t,e){var i={available:!1,cancel:"",keyboard:!1,request:""};t.exports=function(){if("function"==typeof importScripts)return i;var t,e="Fullscreen",n="FullScreen",r=["request"+e,"request"+n,"webkitRequest"+e,"webkitRequest"+n,"msRequest"+e,"msRequest"+n,"mozRequest"+n,"mozRequest"+e];for(t=0;tMath.PI&&(t-=n.PI2),Math.abs(((t+n.TAU)%n.PI2-n.PI2)%n.PI2)}},function(t,e,i){var n=i(137);t.exports=function(){return n(-Math.PI,Math.PI)}},function(t,e,i){var n=i(137);t.exports=function(){return n(-180,180)}},function(t,e,i){var n=i(351);t.exports=function(t){return n(t+Math.PI)}},function(t,e,i){var n=i(14);t.exports=function(t,e,i){return void 0===i&&(i=.05),t===e||(Math.abs(e-t)<=i||Math.abs(e-t)>=n.PI2-i?t=e:(Math.abs(e-t)>Math.PI&&(et?t+=i:e1?t[i]-(n(r-i,t[i],t[i],t[i-1],t[i-1])-t[i]):n(r-s,t[s?s-1:0],t[s],t[i1?n(t[i],t[i-1],i-r):n(t[s],t[s+1>i?i:s+1],r-s)}},function(t,e,i){var n=i(183);t.exports=function(t,e,i){return e+(i-e)*n(t,0,1)}},function(t,e,i){t.exports={GetNext:i(361),IsSize:i(138),IsValue:i(836)}},function(t,e){t.exports=function(t){return t>0&&0==(t&t-1)}},function(t,e,i){t.exports={Ceil:i(139),Floor:i(76),To:i(838)}},function(t,e){t.exports=function(t,e,i,n){return void 0===i&&(i=0),0===e?t:(t-=i,t=e*Math.round(t/e),n?(i+t)/e:i+t)}},function(t,e,i){var n=new(i(0))({initialize:function(t){void 0===t&&(t=[(Date.now()*Math.random()).toString()]),this.c=1,this.s0=0,this.s1=0,this.s2=0,this.n=0,this.signs=[-1,1],t&&this.init(t)},rnd:function(){var t=2091639*this.s0+2.3283064365386963e-10*this.c;return this.c=0|t,this.s0=this.s1,this.s1=this.s2,this.s2=t-this.c,this.s2},hash:function(t){var e,i=this.n;t=t.toString();for(var n=0;n>>0,i=(e*=i)>>>0,i+=4294967296*(e-=i);return this.n=i,2.3283064365386963e-10*(i>>>0)},init:function(t){"string"==typeof t?this.state(t):this.sow(t)},sow:function(t){if(this.n=4022871197,this.s0=this.hash(" "),this.s1=this.hash(" "),this.s2=this.hash(" "),this.c=1,t)for(var e=0;e0;e--){var i=Math.floor(this.frac()*(e+1)),n=t[i];t[i]=t[e],t[e]=n}return t}});t.exports=n},function(t,e){t.exports=function(t){for(var e=0,i=0;i1?void 0!==n?(r=(n-t)/(n-i))<0&&(r=0):r=1:r<0&&(r=0),r}},function(t,e){t.exports=function(t,e){void 0===e&&(e=1);var i=2*Math.random()*Math.PI;return t.x=Math.cos(i)*e,t.y=Math.sin(i)*e,t}},function(t,e){t.exports=function(t,e){void 0===e&&(e=1);var i=2*Math.random()*Math.PI,n=2*Math.random()-1,r=Math.sqrt(1-n*n)*e;return t.x=Math.cos(i)*r,t.y=Math.sin(i)*r,t.z=n*e,t}},function(t,e){t.exports=function(t,e){return void 0===e&&(e=1),t.x=(2*Math.random()-1)*e,t.y=(2*Math.random()-1)*e,t.z=(2*Math.random()-1)*e,t.w=(2*Math.random()-1)*e,t}},function(t,e){t.exports=function(t,e,i,n,r){return t.x=e+r*Math.cos(n),t.y=i+r*Math.sin(n),t}},function(t,e){t.exports=function(t,e,i){void 0===e&&(e=0),void 0===i&&(i=10);var n=Math.pow(i,-e);return Math.round(t*n)/n}},function(t,e){t.exports=function(t,e,i,n){void 0===e&&(e=1),void 0===i&&(i=1),void 0===n&&(n=1),n*=Math.PI/t;for(var r=[],s=[],o=0;o0&&t<=e*i&&(s=t>e-1?t-(o=Math.floor(t/e))*e:t),r.set(s,o)}},function(t,e){t.exports=function(t,e,i){return Math.abs(t-e)<=i}},function(t,e,i){var n=i(39),r=i(69),s=i(365),o=new r,a=new s,h=new n;t.exports=function(t,e,i){return a.setAxisAngle(e,i),o.fromRotationTranslation(a,h.set(0,0,0)),t.transformMat4(o)}},function(t,e){t.exports="addtexture"},function(t,e){t.exports="onerror"},function(t,e){t.exports="onload"},function(t,e){t.exports="ready"},function(t,e){t.exports="removetexture"},function(t,e){t.exports=["#define SHADER_NAME PHASER_BITMAP_MASK_FS","","precision mediump float;","","uniform vec2 uResolution;","uniform sampler2D uMainSampler;","uniform sampler2D uMaskSampler;","uniform bool uInvertMaskAlpha;","","void main ()","{"," vec2 uv = gl_FragCoord.xy / uResolution;"," vec4 mainColor = texture2D(uMainSampler, uv);"," vec4 maskColor = texture2D(uMaskSampler, uv);"," float alpha = mainColor.a;",""," if (!uInvertMaskAlpha)"," {"," alpha *= (maskColor.a);"," }"," else"," {"," alpha *= (1.0 - maskColor.a);"," }",""," gl_FragColor = vec4(mainColor.rgb * alpha, alpha);","}",""].join("\n")},function(t,e){t.exports=["#define SHADER_NAME PHASER_BITMAP_MASK_VS","","precision mediump float;","","attribute vec2 inPosition;","","void main ()","{"," gl_Position = vec4(inPosition, 0.0, 1.0);","}",""].join("\n")},function(t,e){t.exports="pipelineafterflush"},function(t,e){t.exports="pipelinebeforeflush"},function(t,e){t.exports="pipelinebind"},function(t,e){t.exports="pipelineboot"},function(t,e){t.exports="pipelinedestroy"},function(t,e){t.exports="pipelinerebind"},function(t,e){t.exports="pipelineresize"},function(t,e){t.exports=["#define SHADER_NAME PHASER_GRAPHICS_FS","","precision mediump float;","","varying vec4 outColor;","","void main ()","{"," gl_FragColor = vec4(outColor.bgr * outColor.a, outColor.a);","}",""].join("\n")},function(t,e){t.exports=["#define SHADER_NAME PHASER_GRAPHICS_VS","","precision mediump float;","","uniform mat4 uProjectionMatrix;","","attribute vec2 inPosition;","attribute vec4 inColor;","","varying vec4 outColor;","","void main ()","{"," gl_Position = uProjectionMatrix * vec4(inPosition, 1.0, 1.0);",""," outColor = inColor;","}",""].join("\n")},function(t,e){t.exports=["#define SHADER_NAME PHASER_LIGHT_FS","","precision mediump float;","","struct Light","{"," vec2 position;"," vec3 color;"," float intensity;"," float radius;","};","","const int kMaxLights = %LIGHT_COUNT%;","","uniform vec4 uCamera; /* x, y, rotation, zoom */","uniform vec2 uResolution;","uniform sampler2D uMainSampler;","uniform sampler2D uNormSampler;","uniform vec3 uAmbientLightColor;","uniform Light uLights[kMaxLights];","uniform mat3 uInverseRotationMatrix;","","varying vec2 outTexCoord;","varying vec4 outTint;","","void main()","{"," vec3 finalColor = vec3(0.0, 0.0, 0.0);"," vec4 color = texture2D(uMainSampler, outTexCoord) * vec4(outTint.bgr * outTint.a, outTint.a);"," vec3 normalMap = texture2D(uNormSampler, outTexCoord).rgb;"," vec3 normal = normalize(uInverseRotationMatrix * vec3(normalMap * 2.0 - 1.0));"," vec2 res = vec2(min(uResolution.x, uResolution.y)) * uCamera.w;",""," for (int index = 0; index < kMaxLights; ++index)"," {"," Light light = uLights[index];"," vec3 lightDir = vec3((light.position.xy / res) - (gl_FragCoord.xy / res), 0.1);"," vec3 lightNormal = normalize(lightDir);"," float distToSurf = length(lightDir) * uCamera.w;"," float diffuseFactor = max(dot(normal, lightNormal), 0.0);"," float radius = (light.radius / res.x * uCamera.w) * uCamera.w;"," float attenuation = clamp(1.0 - distToSurf * distToSurf / (radius * radius), 0.0, 1.0);"," vec3 diffuse = light.color * diffuseFactor;"," finalColor += (attenuation * diffuse) * light.intensity;"," }",""," vec4 colorOutput = vec4(uAmbientLightColor + finalColor, 1.0);",""," gl_FragColor = color * vec4(colorOutput.rgb * colorOutput.a, colorOutput.a);","}",""].join("\n")},function(t,e){t.exports=["#define SHADER_NAME PHASER_MULTI_FS","","precision mediump float;","","uniform sampler2D uMainSampler[%count%];","","varying vec2 outTexCoord;","varying float outTexId;","varying float outTintEffect;","varying vec4 outTint;","","void main ()","{"," vec4 texture;",""," %forloop%",""," vec4 texel = vec4(outTint.bgr * outTint.a, outTint.a);",""," // Multiply texture tint"," vec4 color = texture * texel;",""," if (outTintEffect == 1.0)"," {"," // Solid color + texture alpha"," color.rgb = mix(texture.rgb, outTint.bgr * outTint.a, texture.a);"," }"," else if (outTintEffect == 2.0)"," {"," // Solid color, no texture"," color = texel;"," }",""," gl_FragColor = color;","}",""].join("\n")},function(t,e){t.exports=["#define SHADER_NAME PHASER_MULTI_VS","","precision mediump float;","","uniform mat4 uProjectionMatrix;","","attribute vec2 inPosition;","attribute vec2 inTexCoord;","attribute float inTexId;","attribute float inTintEffect;","attribute vec4 inTint;","","varying vec2 outTexCoord;","varying float outTexId;","varying float outTintEffect;","varying vec4 outTint;","","void main ()","{"," gl_Position = uProjectionMatrix * vec4(inPosition, 1.0, 1.0);",""," outTexCoord = inTexCoord;"," outTexId = inTexId;"," outTint = inTint;"," outTintEffect = inTintEffect;","}",""].join("\n")},function(t,e){t.exports=["#define SHADER_NAME PHASER_POINTLIGHT_FS","","precision mediump float;","","uniform vec2 uResolution;","uniform float uCameraZoom;","","varying vec4 lightPosition;","varying vec4 lightColor;","varying float lightRadius;","varying float lightAttenuation;","","void main ()","{"," vec2 center = (lightPosition.xy + 1.0) * (uResolution.xy * 0.5);",""," float distToSurf = length(center - gl_FragCoord.xy);",""," float radius = 1.0 - distToSurf / (lightRadius * uCameraZoom);",""," float intensity = smoothstep(0.0, 1.0, radius * lightAttenuation);",""," vec4 color = vec4(intensity, intensity, intensity, 0.0) * lightColor;",""," gl_FragColor = vec4(color.rgb * lightColor.a, color.a);","}",""].join("\n")},function(t,e){t.exports=["#define SHADER_NAME PHASER_POINTLIGHT_VS","","precision mediump float;","","uniform mat4 uProjectionMatrix;","","attribute vec2 inPosition;","attribute vec2 inLightPosition;","attribute vec4 inLightColor;","attribute float inLightRadius;","attribute float inLightAttenuation;","","varying vec4 lightPosition;","varying vec4 lightColor;","varying float lightRadius;","varying float lightAttenuation;","","void main ()","{"," lightColor = inLightColor;"," lightRadius = inLightRadius;"," lightAttenuation = inLightAttenuation;"," lightPosition = uProjectionMatrix * vec4(inLightPosition, 1.0, 1.0);",""," gl_Position = uProjectionMatrix * vec4(inPosition, 1.0, 1.0);","}",""].join("\n")},function(t,e){t.exports=["#define SHADER_NAME PHASER_SINGLE_FS","","precision mediump float;","","uniform sampler2D uMainSampler;","","varying vec2 outTexCoord;","varying float outTintEffect;","varying vec4 outTint;","","void main ()","{"," vec4 texture = texture2D(uMainSampler, outTexCoord);"," vec4 texel = vec4(outTint.bgr * outTint.a, outTint.a);",""," // Multiply texture tint"," vec4 color = texture * texel;",""," if (outTintEffect == 1.0)"," {"," // Solid color + texture alpha"," color.rgb = mix(texture.rgb, outTint.bgr * outTint.a, texture.a);"," }"," else if (outTintEffect == 2.0)"," {"," // Solid color, no texture"," color = texel;"," }",""," gl_FragColor = color;","}",""].join("\n")},function(t,e){t.exports=["#define SHADER_NAME PHASER_SINGLE_VS","","precision mediump float;","","uniform mat4 uProjectionMatrix;","","attribute vec2 inPosition;","attribute vec2 inTexCoord;","attribute float inTexId;","attribute float inTintEffect;","attribute vec4 inTint;","","varying vec2 outTexCoord;","varying float outTintEffect;","varying vec4 outTint;","","void main ()","{"," gl_Position = uProjectionMatrix * vec4(inPosition, 1.0, 1.0);",""," outTexCoord = inTexCoord;"," outTint = inTint;"," outTintEffect = inTintEffect;","}",""].join("\n")},function(t,e){t.exports=["#define SHADER_NAME PHASER_ADD_BLEND_FS","","precision mediump float;","","uniform sampler2D uMainSampler1;","uniform sampler2D uMainSampler2;","uniform float uStrength;","","varying vec2 outTexCoord;","","void main ()","{"," vec4 frame1 = texture2D(uMainSampler1, outTexCoord);"," vec4 frame2 = texture2D(uMainSampler2, outTexCoord);",""," gl_FragColor = frame1 + frame2 * uStrength;","}",""].join("\n")},function(t,e){t.exports=["#define SHADER_NAME PHASER_COLORMATRIX_FS","","precision mediump float;","","uniform sampler2D uMainSampler;","uniform float uColorMatrix[20];","uniform float uAlpha;","","varying vec2 outTexCoord;","","void main ()","{"," vec4 c = texture2D(uMainSampler, outTexCoord);",""," if (uAlpha == 0.0)"," {"," gl_FragColor = c;",""," return;"," }",""," if (c.a > 0.0)"," {"," c.rgb /= c.a;"," }",""," vec4 result;",""," result.r = (uColorMatrix[0] * c.r) + (uColorMatrix[1] * c.g) + (uColorMatrix[2] * c.b) + (uColorMatrix[3] * c.a) + uColorMatrix[4];"," result.g = (uColorMatrix[5] * c.r) + (uColorMatrix[6] * c.g) + (uColorMatrix[7] * c.b) + (uColorMatrix[8] * c.a) + uColorMatrix[9];"," result.b = (uColorMatrix[10] * c.r) + (uColorMatrix[11] * c.g) + (uColorMatrix[12] * c.b) + (uColorMatrix[13] * c.a) + uColorMatrix[14];"," result.a = (uColorMatrix[15] * c.r) + (uColorMatrix[16] * c.g) + (uColorMatrix[17] * c.b) + (uColorMatrix[18] * c.a) + uColorMatrix[19];",""," vec3 rgb = mix(c.rgb, result.rgb, uAlpha);",""," rgb *= result.a;",""," gl_FragColor = vec4(rgb, result.a);","}",""].join("\n")},function(t,e){t.exports=["#define SHADER_NAME PHASER_COPY_FS","","precision mediump float;","","uniform sampler2D uMainSampler;","uniform float uBrightness;","","varying vec2 outTexCoord;","","void main ()","{"," gl_FragColor = texture2D(uMainSampler, outTexCoord) * uBrightness;","}",""].join("\n")},function(t,e){t.exports=["#define SHADER_NAME PHASER_LINEAR_BLEND_FS","","precision mediump float;","","uniform sampler2D uMainSampler1;","uniform sampler2D uMainSampler2;","uniform float uStrength;","","varying vec2 outTexCoord;","","void main ()","{"," vec4 frame1 = texture2D(uMainSampler1, outTexCoord);"," vec4 frame2 = texture2D(uMainSampler2, outTexCoord);",""," gl_FragColor = mix(frame1, frame2 * uStrength, 0.5);","}",""].join("\n")},function(t,e,i){t.exports={GenerateTexture:i(388),Palettes:i(889)}},function(t,e,i){t.exports={ARNE16:i(389),C64:i(890),CGA:i(891),JMP:i(892),MSX:i(893)}},function(t,e){t.exports={0:"#000",1:"#fff",2:"#8b4131",3:"#7bbdc5",4:"#8b41ac",5:"#6aac41",6:"#3931a4",7:"#d5de73",8:"#945a20",9:"#5a4100",A:"#bd736a",B:"#525252",C:"#838383",D:"#acee8b",E:"#7b73de",F:"#acacac"}},function(t,e){t.exports={0:"#000",1:"#2234d1",2:"#0c7e45",3:"#44aacc",4:"#8a3622",5:"#5c2e78",6:"#aa5c3d",7:"#b5b5b5",8:"#5e606e",9:"#4c81fb",A:"#6cd947",B:"#7be2f9",C:"#eb8a60",D:"#e23d69",E:"#ffd93f",F:"#fff"}},function(t,e){t.exports={0:"#000",1:"#191028",2:"#46af45",3:"#a1d685",4:"#453e78",5:"#7664fe",6:"#833129",7:"#9ec2e8",8:"#dc534b",9:"#e18d79",A:"#d6b97b",B:"#e9d8a1",C:"#216c4b",D:"#d365c8",E:"#afaab9",F:"#f5f4eb"}},function(t,e){t.exports={0:"#000",1:"#191028",2:"#46af45",3:"#a1d685",4:"#453e78",5:"#7664fe",6:"#833129",7:"#9ec2e8",8:"#dc534b",9:"#e18d79",A:"#d6b97b",B:"#e9d8a1",C:"#216c4b",D:"#d365c8",E:"#afaab9",F:"#fff"}},function(t,e,i){t.exports={Path:i(895),MoveTo:i(393),CubicBezier:i(390),Curve:i(94),Ellipse:i(391),Line:i(392),QuadraticBezier:i(394),Spline:i(395)}},function(t,e,i){var n=i(0),r=i(390),s=i(391),o=i(5),a=i(392),h=i(393),l=i(394),u=i(10),c=i(395),d=i(3),p=i(14),f=new n({initialize:function(t,e){void 0===t&&(t=0),void 0===e&&(e=0),this.name="",this.curves=[],this.cacheLengths=[],this.autoClose=!1,this.startPoint=new d,this._tmpVec2A=new d,this._tmpVec2B=new d,"object"==typeof t?this.fromJSON(t):this.startPoint.set(t,e)},add:function(t){return this.curves.push(t),this},circleTo:function(t,e,i){return void 0===e&&(e=!1),this.ellipseTo(t,t,0,360,e,i)},closePath:function(){var t=this.curves[0].getPoint(0),e=this.curves[this.curves.length-1].getPoint(1);return t.equals(e)||this.curves.push(new a(e,t)),this},cubicBezierTo:function(t,e,i,n,s,o){var a,h,l,u=this.getEndPoint();return t instanceof d?(a=t,h=e,l=i):(a=new d(i,n),h=new d(s,o),l=new d(t,e)),this.add(new r(u,a,h,l))},quadraticBezierTo:function(t,e,i,n){var r,s,o=this.getEndPoint();return t instanceof d?(r=t,s=e):(r=new d(i,n),s=new d(t,e)),this.add(new l(o,r,s))},draw:function(t,e){for(var i=0;i0?this.curves[this.curves.length-1].getPoint(1,t):t.copy(this.startPoint),t},getLength:function(){var t=this.getCurveLengths();return t[t.length-1]},getPoint:function(t,e){void 0===e&&(e=new d);for(var i=t*this.getLength(),n=this.getCurveLengths(),r=0;r=i){var s=n[r]-i,o=this.curves[r],a=o.getLength(),h=0===a?0:1-s/a;return o.getPointAt(h,e)}r++}return null},getPoints:function(t){void 0===t&&(t=12);for(var e,i=[],n=0;n1&&!i[i.length-1].equals(i[0])&&i.push(i[0]),i},getRandomPoint:function(t){return void 0===t&&(t=new d),this.getPoint(Math.random(),t)},getSpacedPoints:function(t){void 0===t&&(t=40);for(var e=[],i=0;i<=t;i++)e.push(this.getPoint(i/t));return this.autoClose&&e.push(e[0]),e},getStartPoint:function(t){return void 0===t&&(t=new d),t.copy(this.startPoint)},getTangent:function(t,e){void 0===e&&(e=new d);for(var i=t*this.getLength(),n=this.getCurveLengths(),r=0;r=i){var s=n[r]-i,o=this.curves[r],a=o.getLength(),h=0===a?0:1-s/a;return o.getTangentAt(h,e)}r++}return null},lineTo:function(t,e){t instanceof d?this._tmpVec2B.copy(t):this._tmpVec2B.set(t,e);var i=this.getEndPoint(this._tmpVec2A);return this.add(new a([i.x,i.y,this._tmpVec2B.x,this._tmpVec2B.y]))},splineTo:function(t){return t.unshift(this.getEndPoint()),this.add(new c(t))},moveTo:function(t,e){return t instanceof d?this.add(new h(t.x,t.y)):this.add(new h(t,e))},toJSON:function(){for(var t=[],e=0;e=0;e--)i.push({r:e,g:s,b:o,color:n(e,s,o)});for(r=0,e=0;e<=255;e++,s--)i.push({r:r,g:s,b:e,color:n(r,s,e)});for(s=0,o=255,e=0;e<=255;e++,o--,r++)i.push({r:r,g:s,b:o,color:n(r,s,o)});if(1024===t)return i;var a=[],h=0,l=1024/t;for(e=0;e>16&255,g:t>>8&255,b:255&t,a:255};return t>16777215&&(e.a=t>>>24),e}},function(t,e,i){var n=i(38),r=i(399);t.exports=function(t,e,i){var s=i,o=i,a=i;if(0!==e){var h=i<.5?i*(1+e):i+e-i*e,l=2*i-h;s=r(l,h,t+1/3),o=r(l,h,t),a=r(l,h,t-1/3)}return(new n).setGLTo(s,o,a,1)}},function(t,e,i){var n=i(188);t.exports=function(t,e){void 0===t&&(t=1),void 0===e&&(e=1);for(var i=[],r=0;r<=359;r++)i.push(n(r/359,t,e));return i}},function(t,e,i){var n=i(135),r=function(t,e,i,r,s,o,a,h){void 0===a&&(a=100),void 0===h&&(h=0);var l=h/a;return{r:n(t,r,l),g:n(e,s,l),b:n(i,o,l)}};t.exports={RGBWithRGB:r,ColorWithRGB:function(t,e,i,n,s,o){return void 0===s&&(s=100),void 0===o&&(o=0),r(t.r,t.g,t.b,e,i,n,s,o)},ColorWithColor:function(t,e,i,n){return void 0===i&&(i=100),void 0===n&&(n=0),r(t.r,t.g,t.b,e.r,e.g,e.b,i,n)}}},function(t,e,i){var n=i(195),r=i(38);t.exports=function(t,e){return void 0===t&&(t=0),void 0===e&&(e=255),new r(n(t,e),n(t,e),n(t,e))}},function(t,e,i){var n=i(398);t.exports=function(t,e,i,r,s){return void 0===r&&(r=255),void 0===s&&(s="#"),"#"===s?"#"+((1<<24)+(t<<16)+(e<<8)+i).toString(16).slice(1,7):"0x"+n(r)+n(t)+n(e)+n(i)}},function(t,e,i){t.exports={BitmapMask:i(310),GeometryMask:i(311)}},function(t,e,i){var n={AddToDOM:i(142),DOMContentLoaded:i(400),GetInnerHeight:i(401),GetScreenOrientation:i(402),GetTarget:i(407),ParseXML:i(408),RemoveFromDOM:i(202),RequestAnimationFrame:i(386)};t.exports=n},function(t,e,i){t.exports={EventEmitter:i(919)}},function(t,e,i){var n=i(0),r=i(9),s=i(24),o=new n({Extends:r,initialize:function(){r.call(this)},shutdown:function(){this.removeAllListeners()},destroy:function(){this.removeAllListeners()}});s.register("EventEmitter",o,"events"),t.exports=o},function(t,e,i){var n=i(142),r=i(321),s=i(325),o=i(31),a=i(0),h=i(346),l=i(921),u=i(366),c=i(101),d=i(384),p=i(347),f=i(400),m=i(9),g=i(22),v=i(409),y=i(24),x=i(414),w=i(415),b=i(417),A=i(106),T=i(422),S=i(385),E=i(387),M=i(426),_=new a({initialize:function(t){this.config=new h(t),this.renderer=null,this.domContainer=null,this.canvas=null,this.context=null,this.isBooted=!1,this.isRunning=!1,this.events=new m,this.anims=new r(this),this.textures=new T(this),this.cache=new s(this),this.registry=new c(this),this.input=new v(this,this.config),this.scene=new b(this,this.config.sceneConfig),this.device=p,this.scale=new w(this,this.config),this.sound=null,this.sound=M.create(this),this.loop=new S(this,this.config.fps),this.plugins=new x(this,this.config),this.pendingDestroy=!1,this.removeCanvas=!1,this.noReturn=!1,this.hasFocus=!1,f(this.boot.bind(this))},boot:function(){y.hasCore("EventEmitter")&&(this.isBooted=!0,this.config.preBoot(this),this.scale.preBoot(),u(this),l(this),d(this),n(this.canvas,this.config.parent),this.textures.once(A.READY,this.texturesReady,this),this.events.emit(g.BOOT))},texturesReady:function(){this.events.emit(g.READY),this.start()},start:function(){this.isRunning=!0,this.config.postBoot(this),this.renderer?this.loop.start(this.step.bind(this)):this.loop.start(this.headlessStep.bind(this)),E(this);var t=this.events;t.on(g.HIDDEN,this.onHidden,this),t.on(g.VISIBLE,this.onVisible,this),t.on(g.BLUR,this.onBlur,this),t.on(g.FOCUS,this.onFocus,this)},step:function(t,e){if(this.pendingDestroy)return this.runDestroy();var i=this.events;i.emit(g.PRE_STEP,t,e),i.emit(g.STEP,t,e),this.scene.update(t,e),i.emit(g.POST_STEP,t,e);var n=this.renderer;n.preRender(),i.emit(g.PRE_RENDER,n,t,e),this.scene.render(n),n.postRender(),i.emit(g.POST_RENDER,n,t,e)},headlessStep:function(t,e){if(this.pendingDestroy)return this.runDestroy();var i=this.events;i.emit(g.PRE_STEP,t,e),i.emit(g.STEP,t,e),this.scene.update(t,e),i.emit(g.POST_STEP,t,e),i.emit(g.PRE_RENDER),i.emit(g.POST_RENDER)},onHidden:function(){this.loop.pause(),this.events.emit(g.PAUSE)},onVisible:function(){this.loop.resume(),this.events.emit(g.RESUME)},onBlur:function(){this.hasFocus=!1,this.loop.blur()},onFocus:function(){this.hasFocus=!0,this.loop.focus()},getFrame:function(){return this.loop.frame},getTime:function(){return this.loop.now},destroy:function(t,e){void 0===e&&(e=!1),this.pendingDestroy=!0,this.removeCanvas=t,this.noReturn=e},runDestroy:function(){this.scene.destroy(),this.events.emit(g.DESTROY),this.events.removeAllListeners(),this.renderer&&this.renderer.destroy(),this.removeCanvas&&this.canvas&&(o.remove(this.canvas),this.canvas.parentNode&&this.canvas.parentNode.removeChild(this.canvas)),this.domContainer&&this.domContainer.parentNode.removeChild(this.domContainer),this.loop.destroy(),this.pendingDestroy=!1}});t.exports=_},function(t,e,i){var n=i(142);t.exports=function(t){var e=t.config;if(e.parent&&e.domCreateContainer){var i=document.createElement("div");i.style.cssText=["display: block;","width: "+t.scale.width+"px;","height: "+t.scale.height+"px;","padding: 0; margin: 0;","position: absolute;","overflow: hidden;","pointer-events: "+e.domPointerEvents+";","transform: scale(1);","transform-origin: left top;"].join(" "),t.domContainer=i,n(i,e.parent)}}},function(t,e){t.exports="boot"},function(t,e){t.exports="destroy"},function(t,e){t.exports="dragend"},function(t,e){t.exports="dragenter"},function(t,e){t.exports="drag"},function(t,e){t.exports="dragleave"},function(t,e){t.exports="dragover"},function(t,e){t.exports="dragstart"},function(t,e){t.exports="drop"},function(t,e){t.exports="gameout"},function(t,e){t.exports="gameover"},function(t,e){t.exports="gameobjectdown"},function(t,e){t.exports="dragend"},function(t,e){t.exports="dragenter"},function(t,e){t.exports="drag"},function(t,e){t.exports="dragleave"},function(t,e){t.exports="dragover"},function(t,e){t.exports="dragstart"},function(t,e){t.exports="drop"},function(t,e){t.exports="gameobjectmove"},function(t,e){t.exports="gameobjectout"},function(t,e){t.exports="gameobjectover"},function(t,e){t.exports="pointerdown"},function(t,e){t.exports="pointermove"},function(t,e){t.exports="pointerout"},function(t,e){t.exports="pointerover"},function(t,e){t.exports="pointerup"},function(t,e){t.exports="wheel"},function(t,e){t.exports="gameobjectup"},function(t,e){t.exports="gameobjectwheel"},function(t,e){t.exports="boot"},function(t,e){t.exports="process"},function(t,e){t.exports="update"},function(t,e){t.exports="pointerdown"},function(t,e){t.exports="pointerdownoutside"},function(t,e){t.exports="pointermove"},function(t,e){t.exports="pointerout"},function(t,e){t.exports="pointerover"},function(t,e){t.exports="pointerup"},function(t,e){t.exports="pointerupoutside"},function(t,e){t.exports="wheel"},function(t,e){t.exports="pointerlockchange"},function(t,e){t.exports="preupdate"},function(t,e){t.exports="shutdown"},function(t,e){t.exports="start"},function(t,e){t.exports="update"},function(t,e){t.exports="addfile"},function(t,e){t.exports="complete"},function(t,e){t.exports="filecomplete"},function(t,e){t.exports="filecomplete-"},function(t,e){t.exports="loaderror"},function(t,e){t.exports="load"},function(t,e){t.exports="fileprogress"},function(t,e){t.exports="postprocess"},function(t,e){t.exports="progress"},function(t,e){t.exports="start"},function(t,e,i){t.exports={game:"game",renderer:"renderer",anims:"anims",cache:"cache",plugins:"plugins",registry:"registry",scale:"scale",sound:"sound",textures:"textures",events:"events",cameras:"cameras",add:"add",make:"make",scenePlugin:"scene",displayList:"children",lights:"lights",data:"data",input:"input",load:"load",time:"time",tweens:"tweens",arcadePhysics:"physics",impactPhysics:"impact",matterPhysics:"matter"}},function(t,e){t.exports=function(t,e,i){if(i.getElementsByTagName("TextureAtlas")){var n=t.source[e];t.add("__BASE",e,0,0,n.width,n.height);for(var r,s=i.getElementsByTagName("SubTexture"),o=0;om||c<-m)&&(c=0),c<0&&(c=m+c),-1!==d&&(m=c+(d+1));for(var g=p,v=p,y=0,x=0,w=0;ws&&(y=b-s),A>o&&(x=A-o),t.add(w,e,i+g,r+v,h-y,l-x),(g+=h+f)+h>s&&(g=p,v+=l+f)}return t}},function(t,e,i){var n=i(2);t.exports=function(t,e,i){var r=n(i,"frameWidth",null),s=n(i,"frameHeight",r);if(!r)throw new Error("TextureManager.SpriteSheetFromAtlas: Invalid frameWidth given.");var o=t.source[0];t.add("__BASE",0,0,0,o.width,o.height);var a,h=n(i,"startFrame",0),l=n(i,"endFrame",-1),u=n(i,"margin",0),c=n(i,"spacing",0),d=e.cutX,p=e.cutY,f=e.cutWidth,m=e.cutHeight,g=e.realWidth,v=e.realHeight,y=Math.floor((g-u+c)/(r+c)),x=Math.floor((v-u+c)/(s+c)),w=y*x,b=e.x,A=r-b,T=r-(g-f-b),S=e.y,E=s-S,M=s-(v-m-S);(h>w||h<-w)&&(h=0),h<0&&(h=w+h),-1!==l&&(w=h+(l+1));for(var _=u,C=u,P=0,R=e.sourceIndex,L=0;L0){var s=i-t.length;if(s<=0)return null}if(!Array.isArray(e))return-1===t.indexOf(e)?(t.push(e),n&&n.call(r,e),e):null;for(var o=e.length-1;o>=0;)-1!==t.indexOf(e[o])&&e.splice(o,1),o--;if(0===(o=e.length))return null;i>0&&o>s&&(e.splice(s),o=s);for(var a=0;a0){var o=n-t.length;if(o<=0)return null}if(!Array.isArray(e))return-1===t.indexOf(e)?(t.splice(i,0,e),r&&r.call(s,e),e):null;for(var a=e.length-1;a>=0;)-1!==t.indexOf(e[a])&&e.pop(),a--;if(0===(a=e.length))return null;n>0&&a>o&&(e.splice(o),a=o);for(var h=a-1;h>=0;h--){var l=e[h];t.splice(i,0,l),r&&r.call(s,l)}return e}},function(t,e){t.exports=function(t,e){var i=t.indexOf(e);return-1!==i&&i0){var n=t[i-1],r=t.indexOf(n);t[i]=n,t[r]=e}return t}},function(t,e){t.exports=function(t,e,i){var n=t.indexOf(e);if(-1===n||i<0||i>=t.length)throw new Error("Supplied index out of bounds");return n!==i&&(t.splice(n,1),t.splice(i,0,e)),e}},function(t,e){t.exports=function(t,e){var i=t.indexOf(e);if(-1!==i&&ir||(t.splice(n,1),r===t.length-1?t.push(e):t.splice(r,0,e)),t}},function(t,e){t.exports=function(t,e,i){if(e===i)return t;var n=t.indexOf(e),r=t.indexOf(i);if(n<0||r<0)throw new Error("Supplied items must be elements of the same array");return nt.length-1)throw new Error("Index out of bounds");var s=n(t,e);return i&&i.call(r,s),s}},function(t,e,i){var n=i(78);t.exports=function(t,e,i,r,s){if(void 0===e&&(e=0),void 0===i&&(i=t.length),void 0===s&&(s=t),n(t,e,i)){var o=i-e,a=t.splice(e,o);if(r)for(var h=0;h0&&(t.splice(i,1),t.unshift(e)),e}},function(t,e,i){var n=i(78);t.exports=function(t,e,i,r,s){if(void 0===r&&(r=0),void 0===s&&(s=t.length),n(t,r,s))for(var o=r;o0){for(r=0;ru||Y-V>u?(H.push(G.i-1),G.cr?(H.push(G.i+G.word.length),V=0,U=null):U=G):G.cr&&(H.push(G.i+G.word.length),V=0,U=null)}for(r=H.length-1;r>=0;r--)s=h,o=H[r],a="\n",h=s.substr(0,o)+a+s.substr(o+1);n.wrappedText=h,l=h.length,F=[],N=null}var X=0;for(r=0;rS&&(d=S),p>E&&(p=E);var q=S+A.xAdvance,Q=E+v;fD&&(D=I),ID&&(D=I),I0)for(var J=0;J0&&(o=(s=L.wrappedText).length);var O=e._bounds.lines;1===C?R=(O.longest-O.lengths[0])/2:2===C&&(R=O.longest-O.lengths[0]),a.translate(-e.displayOriginX,-e.displayOriginY);for(var D=i.roundPixels,B=0;B0||e.cropHeight>0;f&&(l.flush(),t.pushScissor(d.tx,d.ty,e.cropWidth*d.scaleX,e.cropHeight*d.scaleY));var m,g,v=e.frame.glTexture,y=e.tintFill,x=s.getTintAppendFloatAlpha(e.tintTopLeft,i.alpha*e._alphaTL),w=s.getTintAppendFloatAlpha(e.tintTopRight,i.alpha*e._alphaTR),b=s.getTintAppendFloatAlpha(e.tintBottomLeft,i.alpha*e._alphaBL),A=s.getTintAppendFloatAlpha(e.tintBottomRight,i.alpha*e._alphaBR),T=l.setGameObject(e),S=0,E=0,M=0,_=0,C=e.letterSpacing,P=0,R=0,L=e.scrollX,O=e.scrollY,D=e.fontData,B=D.chars,I=D.lineHeight,F=e.fontSize/D.size,k=0,N=e._align,z=0,U=0,V=e.getTextBounds(!1);e.maxWidth>0&&(h=(a=V.wrappedText).length);var H=e._bounds.lines;1===N?U=(H.longest-H.lengths[0])/2:2===N&&(U=H.longest-H.lengths[0]);var G=i.roundPixels,W=e.displayCallback,Y=e.callbackData;t.pipelines.preBatch(e);for(var X=0;X0&&e.cropHeight>0&&(a.beginPath(),a.rect(0,0,e.cropWidth,e.cropHeight),a.clip());for(var k=0;k0&&(V=V%A-A):V>A?V=A:V<0&&(V=A+V%A),null===M&&(M=new h(k+Math.cos(U)*z,N+Math.sin(U)*z,g),T.push(M),F+=.01);F<1+G;)b=V*F+U,x=k+Math.cos(b)*z,w=N+Math.sin(b)*z,M.points.push(new a(x,w,g)),F+=.01;b=V+U,x=k+Math.cos(b)*z,w=N+Math.sin(b)*z,M.points.push(new a(x,w,g));break;case n.FILL_RECT:c.batchFillRect(f[++C],f[++C],f[++C],f[++C],p,d);break;case n.FILL_TRIANGLE:c.batchFillTriangle(f[++C],f[++C],f[++C],f[++C],f[++C],f[++C],p,d);break;case n.STROKE_TRIANGLE:c.batchStrokeTriangle(f[++C],f[++C],f[++C],f[++C],f[++C],f[++C],g,p,d);break;case n.LINE_TO:null!==M?M.points.push(new a(f[++C],f[++C],g)):(M=new h(f[++C],f[++C],g),T.push(M));break;case n.MOVE_TO:M=new h(f[++C],f[++C],g),T.push(M);break;case n.SAVE:l.push(p.copyToArray());break;case n.RESTORE:p.copyFromArray(l.pop());break;case n.TRANSLATE:k=f[++C],N=f[++C],p.translate(k,N);break;case n.SCALE:k=f[++C],N=f[++C],p.scale(k,N);break;case n.ROTATE:p.rotate(f[++C])}t.pipelines.postBatch(e)}}},function(t,e,i){var n=i(1),r=i(1);n=i(1066),r=i(1067),t.exports={renderWebGL:n,renderCanvas:r}},function(t,e){t.exports=function(t,e,i,n){i.addToRenderList(e),e.pipeline.batchSprite(e,i,n)}},function(t,e){t.exports=function(t,e,i,n){i.addToRenderList(e),t.batchSprite(e,e.frame,i,n)}},function(t,e,i){var n=i(1),r=i(1);n=i(1069),r=i(1070),t.exports={renderWebGL:n,renderCanvas:r}},function(t,e){t.exports=function(t,e,i,n){i.addToRenderList(e),this.pipeline.batchSprite(e,i,n)}},function(t,e){t.exports=function(t,e,i,n){i.addToRenderList(e),t.batchSprite(e,e.frame,i,n)}},function(t,e,i){var n=i(1),r=i(1);n=i(1072),r=i(1073),t.exports={renderWebGL:n,renderCanvas:r}},function(t,e){t.exports=function(t,e,i){var n=e.list,r=n.length;if(0!==r){e.depthSort(),t.pipelines.preBatch(e);var s=-1!==e.blendMode;s||t.setBlendMode(0);for(var o=e.alpha,a=0;a?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~",TEXT_SET2:" !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ",TEXT_SET3:"ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789 ",TEXT_SET4:"ABCDEFGHIJKLMNOPQRSTUVWXYZ 0123456789",TEXT_SET5:"ABCDEFGHIJKLMNOPQRSTUVWXYZ.,/() '!?-*:0123456789",TEXT_SET6:"ABCDEFGHIJKLMNOPQRSTUVWXYZ!?:;0123456789\"(),-.' ",TEXT_SET7:"AGMSY+:4BHNTZ!;5CIOU.?06DJPV,(17EKQW\")28FLRX-'39",TEXT_SET8:"0123456789 .ABCDEFGHIJKLMNOPQRSTUVWXYZ",TEXT_SET9:"ABCDEFGHIJKLMNOPQRSTUVWXYZ()-0123456789.:,'\"?!",TEXT_SET10:"ABCDEFGHIJKLMNOPQRSTUVWXYZ",TEXT_SET11:"ABCDEFGHIJKLMNOPQRSTUVWXYZ.,\"-+!?()':;0123456789"}},function(t,e,i){var n=i(6);t.exports=function(t,e){var i=e.width,r=e.height,s=Math.floor(i/2),o=Math.floor(r/2),a=n(e,"chars","");if(""!==a){var h=n(e,"image",""),l=t.sys.textures.getFrame(h),u=l.cutX,c=l.cutY,d=l.source.width,p=l.source.height,f=n(e,"offset.x",0),m=n(e,"offset.y",0),g=n(e,"spacing.x",0),v=n(e,"spacing.y",0),y=n(e,"lineSpacing",0),x=n(e,"charsPerRow",null);null===x&&(x=d/i)>a.length&&(x=a.length);for(var w=f,b=m,A={retroFont:!0,font:h,size:i,lineHeight:r+y,chars:{}},T=0,S=0;S0)for(h=o.fillTint,l=r.getTintAppendFloatAlpha(e.fillColor,e.fillAlpha*u),h.TL=l,h.TR=l,h.BL=l,h.BR=l,E=0;E0)for(h=o.fillTint,l=r.getTintAppendFloatAlpha(e.altFillColor,e.altFillAlpha*u),h.TL=l,h.TR=l,h.BL=l,h.BR=l,E=0;E0){var P=o.strokeTint,R=r.getTintAppendFloatAlpha(e.outlineFillColor,e.outlineFillAlpha*u);for(P.TL=R,P.TR=R,P.BL=R,P.BR=R,S=1;S0)for(n(a,e),E=0;E0)for(n(a,e,e.altFillColor,e.altFillAlpha*u),E=0;E0){for(r(a,e,e.outlineFillColor,e.outlineFillAlpha*u),S=1;S0?Math.PI*t.radius*t.radius:0}},function(t,e,i){var n=i(65);t.exports=function(t){return new n(t.x,t.y,t.radius)}},function(t,e,i){var n=i(66);t.exports=function(t,e){return n(t,e.x,e.y)}},function(t,e,i){var n=i(66);t.exports=function(t,e){return n(t,e.x,e.y)&&n(t,e.right,e.y)&&n(t,e.x,e.bottom)&&n(t,e.right,e.bottom)}},function(t,e){t.exports=function(t,e){return e.setTo(t.x,t.y,t.radius)}},function(t,e){t.exports=function(t,e){return t.x===e.x&&t.y===e.y&&t.radius===e.radius}},function(t,e,i){var n=i(10);t.exports=function(t,e){return void 0===e&&(e=new n),e.x=t.left,e.y=t.top,e.width=t.diameter,e.height=t.diameter,e}},function(t,e){t.exports=function(t,e,i){return t.x+=e,t.y+=i,t}},function(t,e){t.exports=function(t,e){return t.x+=e.x,t.y+=e.y,t}},function(t,e,i){var n=i(111);n.Area=i(1202),n.Circumference=i(447),n.CircumferencePoint=i(218),n.Clone=i(1203),n.Contains=i(112),n.ContainsPoint=i(1204),n.ContainsRect=i(1205),n.CopyFrom=i(1206),n.Equals=i(1207),n.GetBounds=i(1208),n.GetPoint=i(445),n.GetPoints=i(446),n.Offset=i(1209),n.OffsetPoint=i(1210),n.Random=i(180),t.exports=n},function(t,e){t.exports=function(t){return t.isEmpty()?0:t.getMajorRadius()*t.getMinorRadius()*Math.PI}},function(t,e,i){var n=i(111);t.exports=function(t){return new n(t.x,t.y,t.width,t.height)}},function(t,e,i){var n=i(112);t.exports=function(t,e){return n(t,e.x,e.y)}},function(t,e,i){var n=i(112);t.exports=function(t,e){return n(t,e.x,e.y)&&n(t,e.right,e.y)&&n(t,e.x,e.bottom)&&n(t,e.right,e.bottom)}},function(t,e){t.exports=function(t,e){return e.setTo(t.x,t.y,t.width,t.height)}},function(t,e){t.exports=function(t,e){return t.x===e.x&&t.y===e.y&&t.width===e.width&&t.height===e.height}},function(t,e,i){var n=i(10);t.exports=function(t,e){return void 0===e&&(e=new n),e.x=t.left,e.y=t.top,e.width=t.width,e.height=t.height,e}},function(t,e){t.exports=function(t,e,i){return t.x+=e,t.y+=i,t}},function(t,e){t.exports=function(t,e){return t.x+=e.x,t.y+=e.y,t}},function(t,e,i){var n=i(4),r=i(231);t.exports=function(t,e,i){if(void 0===i&&(i=[]),r(t,e)){var s,o,a,h,l=t.x,u=t.y,c=t.radius,d=e.x,p=e.y,f=e.radius;if(u===p)0==(a=(o=-2*p)*o-4*(s=1)*(d*d+(h=(f*f-c*c-d*d+l*l)/(2*(l-d)))*h-2*d*h+p*p-f*f))?i.push(new n(h,-o/(2*s))):a>0&&(i.push(new n(h,(-o+Math.sqrt(a))/(2*s))),i.push(new n(h,(-o-Math.sqrt(a))/(2*s))));else{var m=(l-d)/(u-p),g=(f*f-c*c-d*d+l*l-p*p+u*u)/(2*(u-p));0==(a=(o=2*u*m-2*g*m-2*l)*o-4*(s=m*m+1)*(l*l+u*u+g*g-c*c-2*u*g))?(h=-o/(2*s),i.push(new n(h,g-h*m))):a>0&&(h=(-o+Math.sqrt(a))/(2*s),i.push(new n(h,g-h*m)),h=(-o-Math.sqrt(a))/(2*s),i.push(new n(h,g-h*m)))}}return i}},function(t,e,i){var n=i(232),r=i(151);t.exports=function(t,e,i){if(void 0===i&&(i=[]),r(t,e)){var s=e.getLineA(),o=e.getLineB(),a=e.getLineC(),h=e.getLineD();n(s,t,i),n(o,t,i),n(a,t,i),n(h,t,i)}return i}},function(t,e,i){var n=i(140),r=i(487),s=new(i(47));function o(t,e,i,o,a){var h=Math.cos(t),l=Math.sin(t);s.setTo(e,i,e+h,i+l);var u=r(s,o);u&&a.push(new n(u.x,u.y,t,u.w))}function a(t,e){return t.z-e.z}t.exports=function(t,e,i){Array.isArray(i)||(i=[i]);for(var n=[],r=[],s=0;s=i&&t.x<=r&&t.y>=s&&t.y<=o}},function(t,e){t.exports=function(t,e,i,n,r,s){return void 0===s&&(s=0),!(e>t.right+s||it.bottom+s||r0){var v=u[0],y=[v];for(h=1;h=o&&(y.push(x),v=x)}var w=u[u.length-1];return n(v,w)i&&(i=h.x),h.xs&&(s=h.y),h.y1?(n=i.x,r=i.y):a>0&&(n+=s*a,r+=o*a)}return(s=t.x-n)*s+(o=t.y-r)*o}function n(t,e){var n=t.length-1,r=[t[0]];return function t(e,n,r,s,o){for(var a,h=s,l=n+1;lh&&(a=l,h=u)}h>s&&(a-n>1&&t(e,n,a,s,o),o.push(e[a]),r-a>1&&t(e,a,r,s,o))}(t,0,n,e,r),r.push(t[n]),r}t.exports=function(t,e,i){void 0===e&&(e=1),void 0===i&&(i=!1);var r=t.points;if(r.length>2){var s=e*e;i||(r=function(t,e){for(var i,n,r,s,o,a=t[0],h=[a],l=1,u=t.length;le&&(h.push(i),a=i);return a!==i&&h.push(i),h}(r,s)),t.setTo(n(r,s))}return t}},function(t,e){t.exports=function(t,e,i){for(var n=t.points,r=0;rn(e)?t.setSize(e.height*i,e.height):t.setSize(e.width,e.width/i),t.setPosition(e.centerX-t.width/2,e.centerY-t.height/2)}},function(t,e){t.exports=function(t){return t.x=Math.floor(t.x),t.y=Math.floor(t.y),t}},function(t,e){t.exports=function(t){return t.x=Math.floor(t.x),t.y=Math.floor(t.y),t.width=Math.floor(t.width),t.height=Math.floor(t.height),t}},function(t,e,i){var n=i(10);t.exports=function(t,e,i,r,s){return void 0===s&&(s=new n),s.setTo(Math.min(t,i),Math.min(e,r),Math.abs(t-i),Math.abs(e-r))}},function(t,e,i){var n=i(4);t.exports=function(t,e){return void 0===e&&(e=new n),e.x=t.centerX,e.y=t.centerY,e}},function(t,e,i){var n=i(4);t.exports=function(t,e){return void 0===e&&(e=new n),e.x=t.width,e.y=t.height,e}},function(t,e,i){var n=i(190);t.exports=function(t,e,i){var r=t.centerX,s=t.centerY;return t.setSize(t.width+2*e,t.height+2*i),n(t,r,s)}},function(t,e,i){var n=i(10),r=i(152);t.exports=function(t,e,i){return void 0===i&&(i=new n),r(t,e)?(i.x=Math.max(t.x,e.x),i.y=Math.max(t.y,e.y),i.width=Math.min(t.right,e.right)-i.x,i.height=Math.min(t.bottom,e.bottom)-i.y):i.setEmpty(),i}},function(t,e){t.exports=function(t,e){for(var i=t.x,n=t.right,r=t.y,s=t.bottom,o=0;oe.x&&t.ye.y}},function(t,e,i){var n=i(4),r=i(36);t.exports=function(t,e,i){void 0===i&&(i=new n),e=r(e);var s=Math.sin(e),o=Math.cos(e),a=o>0?t.width/2:t.width/-2,h=s>0?t.height/2:t.height/-2;return Math.abs(a*s)-1&&(r.splice(a,1),this.clear(o,!0))}t.length=0,this._pendingRemoval.length=0,this._list=r.concat(e.splice(0))}},isActive:function(){return this.enabled&&this.scene.sys.isActive()},updatePoll:function(t,e){if(!this.isActive())return!1;if(this.pluginEvents.emit(d.UPDATE,t,e),this._updatedThisFrame)return this._updatedThisFrame=!1,!1;var i,n=this.manager,r=n.pointers,s=n.pointersTotal;for(i=0;i0){if(this._pollTimer-=e,!(this._pollTimer<0))return!1;this._pollTimer=this.pollRate}var a=!1;for(i=0;i0&&(a=!0)}return a},update:function(t,e){if(!this.isActive())return!1;for(var i=e.length,n=!1,r=0;r0&&(n=!0)}return this._updatedThisFrame=!0,n},clear:function(t,e){void 0===e&&(e=!1);var i=t.input;if(i){e||this.queueForRemoval(t),i.gameObject=void 0,i.target=void 0,i.hitArea=void 0,i.hitAreaCallback=void 0,i.callbackContext=void 0,t.input=null;var n=this._draggable.indexOf(t);return n>-1&&this._draggable.splice(n,1),(n=this._drag[0].indexOf(t))>-1&&this._drag[0].splice(n,1),(n=this._over[0].indexOf(t))>-1&&(this._over[0].splice(n,1),this.manager.resetCursor(i)),t}},disable:function(t){t.input.enabled=!1},enable:function(t,e,i,n){return void 0===n&&(n=!1),t.input?t.input.enabled=!0:this.setHitArea(t,e,i),t.input&&n&&!t.input.dropZone&&(t.input.dropZone=n),this},hitTestPointer:function(t){for(var e=this.cameras.getCamerasBelowPointer(t),i=0;i0)return t.camera=n,r}return t.camera=e[0],[]},processDownEvents:function(t){var e=0,i=this._temp,n=this._eventData,r=this._eventContainer;n.cancelled=!1;for(var s=!1,o=0;o0&&l(t.x,t.y,t.downX,t.downY)>=r||n>0&&e>=t.downTime+n)&&(i=!0),i)return this.setDragState(t,3),this.processDragStartList(t)},processDragStartList:function(t){if(3!==this.getDragState(t))return 0;for(var e=this._drag[t.id],i=0;i1&&(this.sortGameObjects(i,t),this.topOnly&&i.splice(1)),this._drag[t.id]=i,0===this.dragDistanceThreshold&&0===this.dragTimeThreshold?(this.setDragState(t,3),this.processDragStartList(t)):(this.setDragState(t,2),0))},processDragMoveEvent:function(t){if(2===this.getDragState(t)&&this.processDragThresholdEvent(t,this.manager.game.loop.now),4!==this.getDragState(t))return 0;for(var e=this._tempZones,i=this._drag[t.id],n=0;n0?(o.emit(d.GAMEOBJECT_DRAG_LEAVE,t,h),this.emit(d.DRAG_LEAVE,t,o,h),a.target=e[0],h=a.target,o.emit(d.GAMEOBJECT_DRAG_ENTER,t,h),this.emit(d.DRAG_ENTER,t,o,h)):(o.emit(d.GAMEOBJECT_DRAG_LEAVE,t,h),this.emit(d.DRAG_LEAVE,t,o,h),e[0]?(a.target=e[0],h=a.target,o.emit(d.GAMEOBJECT_DRAG_ENTER,t,h),this.emit(d.DRAG_ENTER,t,o,h)):a.target=null)}else!h&&e[0]&&(a.target=e[0],h=a.target,o.emit(d.GAMEOBJECT_DRAG_ENTER,t,h),this.emit(d.DRAG_ENTER,t,o,h));if(o.parentContainer){var u=t.worldX-a.dragStartXGlobal,c=t.worldY-a.dragStartYGlobal,p=o.getParentRotation(),f=u*Math.cos(p)+c*Math.sin(p),m=c*Math.cos(p)-u*Math.sin(p);f*=1/o.parentContainer.scaleX,m*=1/o.parentContainer.scaleY,r=f+a.dragStartX,s=m+a.dragStartY}else r=t.worldX-a.dragX,s=t.worldY-a.dragY;o.emit(d.GAMEOBJECT_DRAG,t,r,s),this.emit(d.DRAG,t,o,r,s)}return i.length},processDragUpEvent:function(t){for(var e=this._drag[t.id],i=0;i0){var s=this.manager,o=this._eventData,a=this._eventContainer;o.cancelled=!1;for(var h=!1,l=0;l0){var r=this.manager,s=this._eventData,o=this._eventContainer;s.cancelled=!1;var a=!1;this.sortGameObjects(e,t);for(var h=0;h0){for(this.sortGameObjects(r,t),e=0;e0){for(this.sortGameObjects(s,t),e=0;e-1&&this._draggable.splice(r,1)}return this},makePixelPerfect:function(t){void 0===t&&(t=1);var e=this.systems.textures;return h(e,t)},setHitArea:function(t,e,i){if(void 0===e)return this.setHitAreaFromTexture(t);Array.isArray(t)||(t=[t]);var n=!1,r=!1,s=!1,o=!1,h=!1,l=!0;if(v(e)){var u=e;e=f(u,"hitArea",null),i=f(u,"hitAreaCallback",null),n=f(u,"draggable",!1),r=f(u,"dropZone",!1),s=f(u,"cursor",!1),o=f(u,"useHandCursor",!1),h=f(u,"pixelPerfect",!1);var c=f(u,"alphaTolerance",1);h&&(e={},i=this.makePixelPerfect(c)),e&&i||(this.setHitAreaFromTexture(t),l=!1)}else"function"!=typeof e||i||(i=e,e={});for(var d=0;d-1?n[r]=t:n[t.keyCode]=t,e&&this.addCapture(t.keyCode),t.setEmitOnRepeat(i),t}return"string"==typeof t&&(t=c[t.toUpperCase()]),n[t]||(n[t]=new u(this,t),e&&this.addCapture(t),n[t].setEmitOnRepeat(i)),n[t]},removeKey:function(t,e){void 0===e&&(e=!1);var i,n=this.keys;if(t instanceof u){var r=n.indexOf(t);r>-1&&(i=this.keys[r],this.keys[r]=void 0)}else"string"==typeof t&&(t=c[t.toUpperCase()]);return n[t]&&(i=n[t],n[t]=void 0),i&&(i.plugin=null,e&&i.destroy()),this},removeAllKeys:function(t){for(var e=this.keys,i=0;it._tick)return t._tick=i,!0}return!1},update:function(){var t=this.manager.queue,e=t.length;if(this.isActive()&&0!==e)for(var i=this.keys,n=0;n'),i.push(''),i.push(''),i.push(this.xhrLoader.responseText),i.push(""),i.push(""),i.push("");var n=[i.join("\n")],o=this;try{var a=new window.Blob(n,{type:"image/svg+xml;charset=utf-8"})}catch(t){return o.state=r.FILE_ERRORED,void o.onProcessComplete()}this.data=new Image,this.data.crossOrigin=this.crossOrigin,this.data.onload=function(){s.revokeObjectURL(o.data),o.onProcessComplete()},this.data.onerror=function(){s.revokeObjectURL(o.data),o.onProcessError()},s.createObjectURL(this.data,a,"image/svg+xml")},addToCache:function(){var t=this.cache.addImage(this.key,this.data);this.pendingDestroy(t)}});o.register("htmlTexture",(function(t,e,i,n,r){if(Array.isArray(t))for(var s=0;s0},isLoading:function(){return this.state===r.LOADER_LOADING||this.state===r.LOADER_PROCESSING},isReady:function(){return this.state===r.LOADER_IDLE||this.state===r.LOADER_COMPLETE},start:function(){this.isReady()&&(this.progress=0,this.totalFailed=0,this.totalComplete=0,this.totalToLoad=this.list.size,this.emit(a.START,this),0===this.list.size?this.loadComplete():(this.state=r.LOADER_LOADING,this.inflight.clear(),this.queue.clear(),this.updateProgress(),this.checkLoadQueue(),this.systems.events.on(c.UPDATE,this.update,this)))},updateProgress:function(){this.progress=1-(this.list.size+this.inflight.size)/this.totalToLoad,this.emit(a.PROGRESS,this.progress)},update:function(){this.state===r.LOADER_LOADING&&this.list.size>0&&this.inflight.sizei&&(n=l,i=c)}}return n},moveTo:function(t,e,i,n,r){void 0===n&&(n=60),void 0===r&&(r=0);var o=Math.atan2(i-t.y,e-t.x);return r>0&&(n=s(t.x,t.y,e,i)/(r/1e3)),t.body.velocity.setToPolar(o,n),o},moveToObject:function(t,e,i,n){return this.moveTo(t,e.x,e.y,i,n)},velocityFromAngle:function(t,e,i){return void 0===e&&(e=60),void 0===i&&(i=new f),i.setToPolar(r(t),e)},velocityFromRotation:function(t,e,i){return void 0===e&&(e=60),void 0===i&&(i=new f),i.setToPolar(t,e)},overlapRect:function(t,e,i,n,r,s){return c(this.world,t,e,i,n,r,s)},overlapCirc:function(t,e,i,n,r){return u(this.world,t,e,i,n,r)},shutdown:function(){if(this.world){var t=this.systems.events;t.off(p.UPDATE,this.world.update,this.world),t.off(p.POST_UPDATE,this.world.postUpdate,this.world),t.off(p.SHUTDOWN,this.shutdown,this),this.add.destroy(),this.world.destroy(),this.add=null,this.world=null}},destroy:function(){this.shutdown(),this.scene.sys.events.off(p.START,this.start,this),this.scene=null,this.systems=null}});d.register("ArcadePhysics",g,"arcadePhysics"),t.exports=g},function(t,e){t.exports={setAcceleration:function(t,e){return this.body.acceleration.set(t,e),this},setAccelerationX:function(t){return this.body.acceleration.x=t,this},setAccelerationY:function(t){return this.body.acceleration.y=t,this}}},function(t,e){t.exports={setAngularVelocity:function(t){return this.body.angularVelocity=t,this},setAngularAcceleration:function(t){return this.body.angularAcceleration=t,this},setAngularDrag:function(t){return this.body.angularDrag=t,this}}},function(t,e){t.exports={setBounce:function(t,e){return this.body.bounce.set(t,e),this},setBounceX:function(t){return this.body.bounce.x=t,this},setBounceY:function(t){return this.body.bounce.y=t,this},setCollideWorldBounds:function(t,e,i){return this.body.setCollideWorldBounds(t,e,i),this}}},function(t,e){t.exports={setDebug:function(t,e,i){return this.debugShowBody=t,this.debugShowVelocity=e,this.debugBodyColor=i,this},setDebugBodyColor:function(t){return this.body.debugBodyColor=t,this},debugShowBody:{get:function(){return this.body.debugShowBody},set:function(t){this.body.debugShowBody=t}},debugShowVelocity:{get:function(){return this.body.debugShowVelocity},set:function(t){this.body.debugShowVelocity=t}},debugBodyColor:{get:function(){return this.body.debugBodyColor},set:function(t){this.body.debugBodyColor=t}}}},function(t,e){t.exports={setDrag:function(t,e){return this.body.drag.set(t,e),this},setDragX:function(t){return this.body.drag.x=t,this},setDragY:function(t){return this.body.drag.y=t,this},setDamping:function(t){return this.body.useDamping=t,this}}},function(t,e){var i={enableBody:function(t,e,i,n,r){return t&&this.body.reset(e,i),n&&(this.body.gameObject.active=!0),r&&(this.body.gameObject.visible=!0),this.body.enable=!0,this},disableBody:function(t,e){return void 0===t&&(t=!1),void 0===e&&(e=!1),this.body.stop(),this.body.enable=!1,t&&(this.body.gameObject.active=!1),e&&(this.body.gameObject.visible=!1),this},refreshBody:function(){return this.body.updateFromGameObject(),this}};t.exports=i},function(t,e){t.exports={setFriction:function(t,e){return this.body.friction.set(t,e),this},setFrictionX:function(t){return this.body.friction.x=t,this},setFrictionY:function(t){return this.body.friction.y=t,this}}},function(t,e){t.exports={setGravity:function(t,e){return this.body.gravity.set(t,e),this},setGravityX:function(t){return this.body.gravity.x=t,this},setGravityY:function(t){return this.body.gravity.y=t,this}}},function(t,e){var i={setImmovable:function(t){return void 0===t&&(t=!0),this.body.immovable=t,this}};t.exports=i},function(t,e){t.exports={setMass:function(t){return this.body.mass=t,this}}},function(t,e){var i={setPushable:function(t){return void 0===t&&(t=!0),this.body.pushable=t,this}};t.exports=i},function(t,e){t.exports={setOffset:function(t,e){return this.body.setOffset(t,e),this},setSize:function(t,e,i){return this.body.setSize(t,e,i),this},setBodySize:function(t,e,i){return this.body.setSize(t,e,i),this},setCircle:function(t,e,i){return this.body.setCircle(t,e,i),this}}},function(t,e){t.exports={setVelocity:function(t,e){return this.body.setVelocity(t,e),this},setVelocityX:function(t){return this.body.setVelocityX(t),this},setVelocityY:function(t){return this.body.setVelocityY(t),this},setMaxVelocity:function(t,e){return this.body.maxVelocity.set(t,e),this}}},function(t,e){t.exports="collide"},function(t,e){t.exports="overlap"},function(t,e){t.exports="pause"},function(t,e){t.exports="resume"},function(t,e){t.exports="tilecollide"},function(t,e){t.exports="tileoverlap"},function(t,e){t.exports="worldbounds"},function(t,e){t.exports="worldstep"},function(t,e){var i,n,r,s,o,a,h,l,u,c,d,p,f,m,g,v,y,x=function(){return c&&g&&n.blocked.right?(i.processX(-y,h,!1,!0),1):u&&v&&n.blocked.left?(i.processX(y,h,!0),1):f&&v&&i.blocked.right?(n.processX(-y,l,!1,!0),2):p&&g&&i.blocked.left?(n.processX(y,l,!0),2):0},w=function(t){if(r&&s)y*=.5,0===t||3===t?(i.processX(y,o),n.processX(-y,a)):(i.processX(-y,o),n.processX(y,a));else if(r&&!s)0===t||3===t?i.processX(y,h,!0):i.processX(-y,h,!1,!0);else if(!r&&s)0===t||3===t?n.processX(-y,l,!1,!0):n.processX(y,l,!0);else{var e=.5*y;0===t?m?(i.processX(y,0,!0),n.processX(0,null,!1,!0)):f?(i.processX(e,0,!0),n.processX(-e,0,!1,!0)):(i.processX(e,n.velocity.x,!0),n.processX(-e,null,!1,!0)):1===t?d?(i.processX(0,null,!1,!0),n.processX(y,0,!0)):c?(i.processX(-e,0,!1,!0),n.processX(e,0,!0)):(i.processX(-e,null,!1,!0),n.processX(e,i.velocity.x,!0)):2===t?m?(i.processX(-y,0,!1,!0),n.processX(0,null,!0)):p?(i.processX(-e,0,!1,!0),n.processX(e,0,!0)):(i.processX(-e,n.velocity.x,!1,!0),n.processX(e,null,!0)):3===t&&(d?(i.processX(0,null,!0),n.processX(-y,0,!1,!0)):u?(i.processX(e,0,!0),n.processX(-e,0,!1,!0)):(i.processX(e,n.velocity.y,!0),n.processX(-e,null,!1,!0)))}return!0};t.exports={BlockCheck:x,Check:function(){var t=i.velocity.x,e=n.velocity.x,r=Math.sqrt(e*e*n.mass/i.mass)*(e>0?1:-1),s=Math.sqrt(t*t*i.mass/n.mass)*(t>0?1:-1),h=.5*(r+s);return s-=h,o=h+(r-=h)*i.bounce.x,a=h+s*n.bounce.x,u&&v?w(0):p&&g?w(1):c&&g?w(2):!(!f||!v)&&w(3)},Set:function(t,e,o){n=e;var a=(i=t).velocity.x,w=n.velocity.x;return r=i.pushable,u=i._dx<0,c=i._dx>0,d=0===i._dx,g=Math.abs(i.right-n.x)<=Math.abs(n.right-i.x),h=w-a*i.bounce.x,s=n.pushable,p=n._dx<0,f=n._dx>0,m=0===n._dx,v=!g,l=a-w*n.bounce.x,y=Math.abs(o),x()},Run:w,RunImmovableBody1:function(t){1===t?n.velocity.x=0:g?n.processX(y,l,!0):n.processX(-y,l,!1,!0),i.moves&&(n.y+=(i.y-i.prev.y)*i.friction.y,n._dy=n.y-n.prev.y)},RunImmovableBody2:function(t){2===t?i.velocity.x=0:v?i.processX(y,h,!0):i.processX(-y,h,!1,!0),n.moves&&(i.y+=(n.y-n.prev.y)*n.friction.y,i._dy=i.y-i.prev.y)}}},function(t,e){var i,n,r,s,o,a,h,l,u,c,d,p,f,m,g,v,y,x=function(){return c&&g&&n.blocked.down?(i.processY(-y,h,!1,!0),1):u&&v&&n.blocked.up?(i.processY(y,h,!0),1):f&&v&&i.blocked.down?(n.processY(-y,l,!1,!0),2):p&&g&&i.blocked.up?(n.processY(y,l,!0),2):0},w=function(t){if(r&&s)y*=.5,0===t||3===t?(i.processY(y,o),n.processY(-y,a)):(i.processY(-y,o),n.processY(y,a));else if(r&&!s)0===t||3===t?i.processY(y,h,!0):i.processY(-y,h,!1,!0);else if(!r&&s)0===t||3===t?n.processY(-y,l,!1,!0):n.processY(y,l,!0);else{var e=.5*y;0===t?m?(i.processY(y,0,!0),n.processY(0,null,!1,!0)):f?(i.processY(e,0,!0),n.processY(-e,0,!1,!0)):(i.processY(e,n.velocity.y,!0),n.processY(-e,null,!1,!0)):1===t?d?(i.processY(0,null,!1,!0),n.processY(y,0,!0)):c?(i.processY(-e,0,!1,!0),n.processY(e,0,!0)):(i.processY(-e,null,!1,!0),n.processY(e,i.velocity.y,!0)):2===t?m?(i.processY(-y,0,!1,!0),n.processY(0,null,!0)):p?(i.processY(-e,0,!1,!0),n.processY(e,0,!0)):(i.processY(-e,n.velocity.y,!1,!0),n.processY(e,null,!0)):3===t&&(d?(i.processY(0,null,!0),n.processY(-y,0,!1,!0)):u?(i.processY(e,0,!0),n.processY(-e,0,!1,!0)):(i.processY(e,n.velocity.y,!0),n.processY(-e,null,!1,!0)))}return!0};t.exports={BlockCheck:x,Check:function(){var t=i.velocity.y,e=n.velocity.y,r=Math.sqrt(e*e*n.mass/i.mass)*(e>0?1:-1),s=Math.sqrt(t*t*i.mass/n.mass)*(t>0?1:-1),h=.5*(r+s);return s-=h,o=h+(r-=h)*i.bounce.y,a=h+s*n.bounce.y,u&&v?w(0):p&&g?w(1):c&&g?w(2):!(!f||!v)&&w(3)},Set:function(t,e,o){n=e;var a=(i=t).velocity.y,w=n.velocity.y;return r=i.pushable,u=i._dy<0,c=i._dy>0,d=0===i._dy,g=Math.abs(i.bottom-n.y)<=Math.abs(n.bottom-i.y),h=w-a*i.bounce.y,s=n.pushable,p=n._dy<0,f=n._dy>0,m=0===n._dy,v=!g,l=a-w*n.bounce.y,y=Math.abs(o),x()},Run:w,RunImmovableBody1:function(t){1===t?n.velocity.y=0:g?n.processY(y,l,!0):n.processY(-y,l,!1,!0),i.moves&&(n.x+=(i.x-i.prev.x)*i.friction.x,n._dx=n.x-n.prev.x)},RunImmovableBody2:function(t){2===t?i.velocity.y=0:v?i.processY(y,h,!0):i.processY(-y,h,!1,!0),n.moves&&(i.x+=(n.x-n.prev.x)*n.friction.x,i._dx=i.x-i.prev.x)}}},function(t,e,i){var n={ProcessTileCallbacks:i(530),ProcessTileSeparationX:i(534),ProcessTileSeparationY:i(536),SeparateTile:i(532),TileCheckX:i(533),TileCheckY:i(535),TileIntersectsBody:i(248)};t.exports=n},function(t,e,i){var n=i(0),r=i(3),s=new n({initialize:function(){this.boundsCenter=new r,this.centerDiff=new r},parseBody:function(t){if(!(t=t.hasOwnProperty("body")?t.body:t).hasOwnProperty("bounds")||!t.hasOwnProperty("centerOfMass"))return!1;var e=this.boundsCenter,i=this.centerDiff,n=t.bounds.max.x-t.bounds.min.x,r=t.bounds.max.y-t.bounds.min.y,s=n*t.centerOfMass.x,o=r*t.centerOfMass.y;return e.set(n/2,r/2),i.set(s-e.x,o-e.y),!0},getTopLeft:function(t,e,i){if(void 0===e&&(e=0),void 0===i&&(i=0),this.parseBody(t)){var n=this.boundsCenter,s=this.centerDiff;return new r(e+n.x+s.x,i+n.y+s.y)}return!1},getTopCenter:function(t,e,i){if(void 0===e&&(e=0),void 0===i&&(i=0),this.parseBody(t)){var n=this.boundsCenter,s=this.centerDiff;return new r(e+s.x,i+n.y+s.y)}return!1},getTopRight:function(t,e,i){if(void 0===e&&(e=0),void 0===i&&(i=0),this.parseBody(t)){var n=this.boundsCenter,s=this.centerDiff;return new r(e-(n.x-s.x),i+n.y+s.y)}return!1},getLeftCenter:function(t,e,i){if(void 0===e&&(e=0),void 0===i&&(i=0),this.parseBody(t)){var n=this.boundsCenter,s=this.centerDiff;return new r(e+n.x+s.x,i+s.y)}return!1},getCenter:function(t,e,i){if(void 0===e&&(e=0),void 0===i&&(i=0),this.parseBody(t)){var n=this.centerDiff;return new r(e+n.x,i+n.y)}return!1},getRightCenter:function(t,e,i){if(void 0===e&&(e=0),void 0===i&&(i=0),this.parseBody(t)){var n=this.boundsCenter,s=this.centerDiff;return new r(e-(n.x-s.x),i+s.y)}return!1},getBottomLeft:function(t,e,i){if(void 0===e&&(e=0),void 0===i&&(i=0),this.parseBody(t)){var n=this.boundsCenter,s=this.centerDiff;return new r(e+n.x+s.x,i-(n.y-s.y))}return!1},getBottomCenter:function(t,e,i){if(void 0===e&&(e=0),void 0===i&&(i=0),this.parseBody(t)){var n=this.boundsCenter,s=this.centerDiff;return new r(e+s.x,i-(n.y-s.y))}return!1},getBottomRight:function(t,e,i){if(void 0===e&&(e=0),void 0===i&&(i=0),this.parseBody(t)){var n=this.boundsCenter,s=this.centerDiff;return new r(e-(n.x-s.x),i-(n.y-s.y))}return!1}});t.exports=s},function(t,e){function i(t,e,i){i=i||0;var n,r,s,o,a,h,l,u=[0,0];return n=t[1][1]-t[0][1],r=t[0][0]-t[1][0],s=n*t[0][0]+r*t[0][1],o=e[1][1]-e[0][1],a=e[0][0]-e[1][0],h=o*e[0][0]+a*e[0][1],A(l=n*a-o*r,0,i)||(u[0]=(a*s-r*h)/l,u[1]=(n*h-o*s)/l),u}function n(t,e,i,n){var r=e[0]-t[0],s=e[1]-t[1],o=n[0]-i[0],a=n[1]-i[1];if(o*s-a*r==0)return!1;var h=(r*(i[1]-t[1])+s*(t[0]-i[0]))/(o*s-a*r),l=(o*(t[1]-i[1])+a*(i[0]-t[0]))/(a*r-o*s);return h>=0&&h<=1&&l>=0&&l<=1}function r(t,e,i){return(e[0]-t[0])*(i[1]-t[1])-(i[0]-t[0])*(e[1]-t[1])}function s(t,e,i){return r(t,e,i)>0}function o(t,e,i){return r(t,e,i)>=0}function a(t,e,i){return r(t,e,i)<0}function h(t,e,i){return r(t,e,i)<=0}t.exports={decomp:function(t){var e=function t(e){for(var i=[],n=[],r=[],s=[],o=Number.MAX_VALUE,a=0;a0?function t(e,i){if(0===i.length)return[e];if(i instanceof Array&&i.length&&i[0]instanceof Array&&2===i[0].length&&i[0][0]instanceof Array){for(var n=[e],r=0;ru)return i;for(var O=0;OE&&(E+=e.length),S=Number.MAX_VALUE,E3&&n>=0;--n)c(p(t,n-1),p(t,n),p(t,n+1),e)&&(t.splice(n%t.length,1),i++);return i},removeDuplicatePoints:function(t,e){for(var i=t.length-1;i>=1;--i)for(var n=t[i],r=i-1;r>=0;--r)T(n,t[r],e)&&t.splice(i,1)},makeCCW:function(t){for(var e=0,i=t,n=1;ni[e][0])&&(e=n);return!s(p(t,e-1),p(t,e),p(t,e+1))&&(function(t){for(var e=[],i=t.length,n=0;n!==i;n++)e.push(t.pop());for(n=0;n!==i;n++)t[n]=e[n]}(t),!0)}};var l=[],u=[];function c(t,e,i,n){if(n){var s=l,o=u;s[0]=e[0]-t[0],s[1]=e[1]-t[1],o[0]=i[0]-e[0],o[1]=i[1]-e[1];var a=s[0]*o[0]+s[1]*o[1],h=Math.sqrt(s[0]*s[0]+s[1]*s[1]),c=Math.sqrt(o[0]*o[0]+o[1]*o[1]);return Math.acos(a/(h*c))1?1:0;r0&&u.trigger(t,"collisionStart",{pairs:w.collisionStart}),o.preSolvePosition(w.list),r=0;r0&&u.trigger(t,"collisionActive",{pairs:w.collisionActive}),w.collisionEnd.length>0&&u.trigger(t,"collisionEnd",{pairs:w.collisionEnd}),h.update(t.metrics,t),n._bodiesClearForces(v),u.trigger(t,"afterUpdate",g),t},n.merge=function(t,e){if(p.extend(t,e),e.world){t.world=e.world,n.clear(t);for(var i=c.allBodies(t.world),r=0;r0&&(i=r[0].bodyA,n=r[0].bodyB),t.emit(u.COLLISION_START,e,i,n)})),f.on(e,"collisionActive",(function(e){var i,n,r=e.pairs;r.length>0&&(i=r[0].bodyA,n=r[0].bodyB),t.emit(u.COLLISION_ACTIVE,e,i,n)})),f.on(e,"collisionEnd",(function(e){var i,n,r=e.pairs;r.length>0&&(i=r[0].bodyA,n=r[0].bodyB),t.emit(u.COLLISION_END,e,i,n)}))},setBounds:function(t,e,i,n,r,s,o,a,h){return void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i=this.scene.sys.scale.width),void 0===n&&(n=this.scene.sys.scale.height),void 0===r&&(r=64),void 0===s&&(s=!0),void 0===o&&(o=!0),void 0===a&&(a=!0),void 0===h&&(h=!0),this.updateWall(s,"left",t-r,e-r,r,n+2*r),this.updateWall(o,"right",t+i,e-r,r,n+2*r),this.updateWall(a,"top",t,e-r,i,r),this.updateWall(h,"bottom",t,e+n,i,r),this},updateWall:function(t,e,i,n,r,s){var o=this.walls[e];t?(o&&g.remove(this.localWorld,o),i+=r/2,n+=s/2,this.walls[e]=this.create(i,n,r,s,{isStatic:!0,friction:0,frictionStatic:0})):(o&&g.remove(this.localWorld,o),this.walls[e]=null)},createDebugGraphic:function(){var t=this.scene.sys.add.graphics({x:0,y:0});return t.setDepth(Number.MAX_VALUE),this.debugGraphic=t,this.drawDebug=!0,t},disableGravity:function(){return this.localWorld.gravity.x=0,this.localWorld.gravity.y=0,this.localWorld.gravity.scale=0,this},setGravity:function(t,e,i){return void 0===t&&(t=0),void 0===e&&(e=1),this.localWorld.gravity.x=t,this.localWorld.gravity.y=e,void 0!==i&&(this.localWorld.gravity.scale=i),this},create:function(t,e,i,r,s){var o=n.rectangle(t,e,i,r,s);return g.add(this.localWorld,o),o},add:function(t){return g.add(this.localWorld,t),this},remove:function(t,e){Array.isArray(t)||(t=[t]);for(var i=0;in.deltaMax?n.deltaMax:e)/n.delta,n.delta=e),0!==n.timeScalePrev&&(s*=r.timeScale/n.timeScalePrev),0===r.timeScale&&(s=0),n.timeScalePrev=r.timeScale,n.correction=s,n.frameCounter+=1,t-n.counterTimestamp>=1e3&&(n.fps=n.frameCounter*((t-n.counterTimestamp)/1e3),n.counterTimestamp=t,n.frameCounter=0),h.update(i,e,s)}},step:function(t,e){h.update(this.engine,t,e)},update60Hz:function(){return 1e3/60},update30Hz:function(){return 1e3/30},has:function(t){var e=t.hasOwnProperty("body")?t.body:t;return null!==a.get(this.localWorld,e.id,e.type)},getAllBodies:function(){return a.allBodies(this.localWorld)},getAllConstraints:function(){return a.allConstraints(this.localWorld)},getAllComposites:function(){return a.allComposites(this.localWorld)},postUpdate:function(){if(this.drawDebug){var t=this.debugConfig,e=this.engine,i=this.debugGraphic,n=a.allBodies(this.localWorld);this.debugGraphic.clear(),t.showBroadphase&&e.broadphase.controller&&this.renderGrid(e.broadphase,i,t.broadphaseColor,.5),t.showBounds&&this.renderBodyBounds(n,i,t.boundsColor,.5),(t.showBody||t.showStaticBody)&&this.renderBodies(n),t.showJoint&&this.renderJoints(),(t.showAxes||t.showAngleIndicator)&&this.renderBodyAxes(n,i,t.showAxes,t.angleColor,.5),t.showVelocity&&this.renderBodyVelocity(n,i,t.velocityColor,1,2),t.showSeparations&&this.renderSeparations(e.pairs.list,i,t.separationColor),t.showCollisions&&this.renderCollisions(e.pairs.list,i,t.collisionColor)}},renderGrid:function(t,e,i,n){e.lineStyle(1,i,n);for(var r=o.keys(t.buckets),s=0;s0){var l=h[0].vertex.x,u=h[0].vertex.y;2===h.length&&(l=(h[0].vertex.x+h[1].vertex.x)/2,u=(h[0].vertex.y+h[1].vertex.y)/2),a.bodyB===a.supports[0].body||a.bodyA.isStatic?e.lineBetween(l-8*a.normal.x,u-8*a.normal.y,l,u):e.lineBetween(l+8*a.normal.x,u+8*a.normal.y,l,u)}}return this},renderBodyBounds:function(t,e,i,n){e.lineStyle(1,i,n);for(var r=0;r1?1:0;h1?1:0;a1?1:0;a1&&this.renderConvexHull(m,e,p,y)}}},renderBody:function(t,e,i,n,r,s,o,a){void 0===n&&(n=null),void 0===r&&(r=null),void 0===s&&(s=1),void 0===o&&(o=null),void 0===a&&(a=null);for(var h=this.debugConfig,l=h.sensorFillColor,u=h.sensorLineColor,c=t.parts,d=c.length,p=d>1?1:0;p1){var r=t.vertices;e.lineStyle(n,i),e.beginPath(),e.moveTo(r[0].x,r[0].y);for(var s=1;s0&&(e.fillStyle(a),e.fillCircle(u.x,u.y,h),e.fillCircle(c.x,c.y,h)),this},resetCollisionIDs:function(){return r._nextCollidingGroupId=1,r._nextNonCollidingGroupId=-1,r._nextCategory=1,this},shutdown:function(){f.off(this.engine),this.removeAllListeners(),g.clear(this.localWorld,!1),h.clear(this.engine),this.drawDebug&&this.debugGraphic.destroy()},destroy:function(){this.shutdown()}});t.exports=y},function(t,e,i){t.exports={BasePlugin:i(540),DefaultPlugins:i(197),PluginCache:i(24),PluginManager:i(414),ScenePlugin:i(1404)}},function(t,e,i){var n=i(540),r=i(0),s=i(20),o=new r({Extends:n,initialize:function(t,e,i){n.call(this,e),this.scene=t,this.systems=t.sys,this.pluginKey=i,t.sys.events.once(s.BOOT,this.boot,this)},boot:function(){},destroy:function(){this.pluginManager=null,this.game=null,this.scene=null,this.systems=null}});t.exports=o},function(t,e,i){t.exports={Canvas:i(1406),Events:i(91),Snapshot:i(1407),WebGL:i(1408)}},function(t,e,i){t.exports={CanvasRenderer:i(368),GetBlendModes:i(370),SetTransform:i(30)}},function(t,e,i){t.exports={Canvas:i(369),WebGL:i(383)}},function(t,e,i){var n=i(107),r=i(17),s={PipelineManager:i(372),Pipelines:i(1409),RenderTarget:i(141),Utils:i(12),WebGLPipeline:i(58),WebGLRenderer:i(371),WebGLShader:i(375)};s=r(!1,s,n),t.exports=s},function(t,e,i){var n=i(92),r=i(17),s={BitmapMaskPipeline:i(373),Events:i(374),GraphicsPipeline:i(376),LightPipeline:i(377),MultiPipeline:i(108),PointLightPipeline:i(378),PostFXPipeline:i(1410),RopePipeline:i(379),SinglePipeline:i(380),UtilityPipeline:i(381)};s=r(!1,s,n),t.exports=s},function(t,e,i){var n=i(0),r=i(198),s=i(2),o=i(1411),a=i(382),h=i(58),l=new n({Extends:h,initialize:function(t){t.renderTarget=s(t,"renderTarget",1),t.fragShader=s(t,"fragShader",o),t.vertShader=s(t,"vertShader",a),t.attributes=s(t,"attributes",[{name:"inPosition",size:2},{name:"inTexCoord",size:2}]),t.batchSize=1,t.vertices=[-1,-1,0,0,-1,1,0,1,1,1,1,1,-1,-1,0,0,1,1,1,1,1,-1,1,0],h.call(this,t),this.isPostFX=!0,this.gameObject,this.colorMatrix=new r,this.fullFrame1,this.fullFrame2,this.halfFrame1,this.halfFrame2,this.renderer.isBooted&&(this.manager=this.renderer.pipelines,this.boot())},boot:function(){h.prototype.boot.call(this);var t=this.manager.UTILITY_PIPELINE;this.fullFrame1=t.fullFrame1,this.fullFrame2=t.fullFrame2,this.halfFrame1=t.halfFrame1,this.halfFrame2=t.halfFrame2,this.set1i("uMainSampler",0)},onDraw:function(t){this.bindAndDraw(t)},copyFrame:function(t,e,i,n,r){this.manager.copyFrame(t,e,i,n,r)},copyToGame:function(t){this.manager.copyToGame(t)},drawFrame:function(t,e,i){this.manager.drawFrame(t,e,i,this.colorMatrix)},blendFrames:function(t,e,i,n,r){this.manager.blendFrames(t,e,i,n,r)},blendFramesAdditive:function(t,e,i,n,r){this.manager.blendFramesAdditive(t,e,i,n,r)},clearFrame:function(t,e){this.manager.clearFrame(t,e)},blitFrame:function(t,e,i,n,r,s){this.manager.blitFrame(t,e,i,n,r,s)},copyFrameRect:function(t,e,i,n,r,s,o,a){this.manager.copyFrameRect(t,e,i,n,r,s,o,a)},bindAndDraw:function(t,e,i,n,r){void 0===i&&(i=!0),void 0===n&&(n=!0);var s=this.gl,o=this.renderer;this.bind(r),this.set1i("uMainSampler",0),e?(s.viewport(0,0,e.width,e.height),s.bindFramebuffer(s.FRAMEBUFFER,e.framebuffer),s.framebufferTexture2D(s.FRAMEBUFFER,s.COLOR_ATTACHMENT0,s.TEXTURE_2D,e.texture,0),i&&(n?s.clearColor(0,0,0,0):s.clearColor(0,0,0,1),s.clear(s.COLOR_BUFFER_BIT))):(o.popFramebuffer(!1,!1,!1),o.currentFramebuffer||s.viewport(0,0,o.width,o.height)),s.activeTexture(s.TEXTURE0),s.bindTexture(s.TEXTURE_2D,t.texture),s.bufferData(s.ARRAY_BUFFER,this.vertexData,s.STATIC_DRAW),s.drawArrays(s.TRIANGLES,0,6),e?(s.bindTexture(s.TEXTURE_2D,null),s.bindFramebuffer(s.FRAMEBUFFER,null)):o.resetTextures()}});t.exports=l},function(t,e){t.exports=["#define SHADER_NAME PHASER_POSTFX_FS","","precision mediump float;","","uniform sampler2D uMainSampler;","","varying vec2 outTexCoord;","","void main ()","{"," gl_FragColor = texture2D(uMainSampler, outTexCoord);","}",""].join("\n")},function(t,e,i){var n=i(17),r=i(201),s={Center:i(403),Events:i(104),Orientation:i(404),ScaleManager:i(415),ScaleModes:i(405),Zoom:i(406)};s=n(!1,s,r.CENTER),s=n(!1,s,r.ORIENTATION),s=n(!1,s,r.SCALE_MODE),s=n(!1,s,r.ZOOM),t.exports=s},function(t,e,i){var n=i(144),r=i(17),s={Events:i(20),GetPhysicsPlugins:i(419),GetScenePlugins:i(420),SceneManager:i(417),ScenePlugin:i(1414),Settings:i(421),Systems:i(204)};s=r(!1,s,n),t.exports=s},function(t,e,i){var n=i(18),r=i(0),s=i(20),o=i(2),a=i(24),h=new r({initialize:function(t){this.scene=t,this.systems=t.sys,this.settings=t.sys.settings,this.key=t.sys.settings.key,this.manager=t.sys.game.scene,this.transitionProgress=0,this._elapsed=0,this._target=null,this._duration=0,this._onUpdate,this._onUpdateScope,this._willSleep=!1,this._willRemove=!1,t.sys.events.once(s.BOOT,this.boot,this),t.sys.events.on(s.START,this.pluginStart,this)},boot:function(){this.systems.events.once(s.DESTROY,this.destroy,this)},pluginStart:function(){this._target=null,this.systems.events.once(s.SHUTDOWN,this.shutdown,this)},start:function(t,e){return void 0===t&&(t=this.key),this.manager.queueOp("stop",this.key),this.manager.queueOp("start",t,e),this},restart:function(t){var e=this.key;return this.manager.queueOp("stop",e),this.manager.queueOp("start",e,t),this},transition:function(t){void 0===t&&(t={});var e=o(t,"target",!1),i=this.manager.getScene(e);if(!e||!this.checkValidTransition(i))return!1;var n=o(t,"duration",1e3);this._elapsed=0,this._target=i,this._duration=n,this._willSleep=o(t,"sleep",!1),this._willRemove=o(t,"remove",!1);var r=o(t,"onUpdate",null);r&&(this._onUpdate=r,this._onUpdateScope=o(t,"onUpdateScope",this.scene));var a=o(t,"allowInput",!1);this.settings.transitionAllowInput=a;var h=i.sys.settings;return h.isTransition=!0,h.transitionFrom=this.scene,h.transitionDuration=n,h.transitionAllowInput=a,o(t,"moveAbove",!1)?this.manager.moveAbove(this.key,e):o(t,"moveBelow",!1)&&this.manager.moveBelow(this.key,e),i.sys.isSleeping()?i.sys.wake(o(t,"data")):this.manager.start(e,o(t,"data")),this.systems.events.emit(s.TRANSITION_OUT,i,n),this.systems.events.on(s.UPDATE,this.step,this),!0},checkValidTransition:function(t){return!(!t||t.sys.isActive()||t.sys.isTransitioning()||t===this.scene||this.systems.isTransitioning())},step:function(t,e){this._elapsed+=e,this.transitionProgress=n(this._elapsed/this._duration,0,1),this._onUpdate&&this._onUpdate.call(this._onUpdateScope,this.transitionProgress),this._elapsed>=this._duration&&this.transitionComplete()},transitionComplete:function(){var t=this._target.sys,e=this._target.sys.settings;this.systems.events.off(s.UPDATE,this.step,this),t.events.emit(s.TRANSITION_COMPLETE,this.scene),e.isTransition=!1,e.transitionFrom=null,this._duration=0,this._target=null,this._onUpdate=null,this._onUpdateScope=null,this._willRemove?this.manager.remove(this.key):this._willSleep?this.systems.sleep():this.manager.stop(this.key)},add:function(t,e,i,n){return this.manager.add(t,e,i,n)},launch:function(t,e){return t&&t!==this.key&&this.manager.queueOp("start",t,e),this},run:function(t,e){return t&&t!==this.key&&this.manager.queueOp("run",t,e),this},pause:function(t,e){return void 0===t&&(t=this.key),this.manager.queueOp("pause",t,e),this},resume:function(t,e){return void 0===t&&(t=this.key),this.manager.queueOp("resume",t,e),this},sleep:function(t,e){return void 0===t&&(t=this.key),this.manager.queueOp("sleep",t,e),this},wake:function(t,e){return void 0===t&&(t=this.key),this.manager.queueOp("wake",t,e),this},switch:function(t){return t!==this.key&&this.manager.queueOp("switch",this.key,t),this},stop:function(t,e){return void 0===t&&(t=this.key),this.manager.queueOp("stop",t,e),this},setActive:function(t,e,i){void 0===e&&(e=this.key);var n=this.manager.getScene(e);return n&&n.sys.setActive(t,i),this},setVisible:function(t,e){void 0===e&&(e=this.key);var i=this.manager.getScene(e);return i&&i.sys.setVisible(t),this},isSleeping:function(t){return void 0===t&&(t=this.key),this.manager.isSleeping(t)},isActive:function(t){return void 0===t&&(t=this.key),this.manager.isActive(t)},isPaused:function(t){return void 0===t&&(t=this.key),this.manager.isPaused(t)},isVisible:function(t){return void 0===t&&(t=this.key),this.manager.isVisible(t)},swapPosition:function(t,e){return void 0===e&&(e=this.key),t!==e&&this.manager.swapPosition(t,e),this},moveAbove:function(t,e){return void 0===e&&(e=this.key),t!==e&&this.manager.moveAbove(t,e),this},moveBelow:function(t,e){return void 0===e&&(e=this.key),t!==e&&this.manager.moveBelow(t,e),this},remove:function(t){return void 0===t&&(t=this.key),this.manager.remove(t),this},moveUp:function(t){return void 0===t&&(t=this.key),this.manager.moveUp(t),this},moveDown:function(t){return void 0===t&&(t=this.key),this.manager.moveDown(t),this},bringToTop:function(t){return void 0===t&&(t=this.key),this.manager.bringToTop(t),this},sendToBack:function(t){return void 0===t&&(t=this.key),this.manager.sendToBack(t),this},get:function(t){return this.manager.getScene(t)},getIndex:function(t){return void 0===t&&(t=this.key),this.manager.getIndex(t)},shutdown:function(){var t=this.systems.events;t.off(s.SHUTDOWN,this.shutdown,this),t.off(s.POST_UPDATE,this.step,this),t.off(s.TRANSITION_OUT)},destroy:function(){this.shutdown(),this.scene.sys.events.off(s.START,this.start,this),this.scene=null,this.systems=null,this.settings=null,this.manager=null}});a.register("ScenePlugin",h,"scenePlugin"),t.exports=h},function(t,e,i){t.exports={Events:i(438),List:i(110),Map:i(102),ProcessQueue:i(211),RTree:i(531),Set:i(149),Size:i(416)}},function(t,e,i){var n=i(17),r=i(1417),s={CanvasTexture:i(423),Events:i(106),FilterMode:r,Frame:i(109),Parsers:i(425),Texture:i(206),TextureManager:i(422),TextureSource:i(424)};s=n(!1,s,r),t.exports=s},function(t,e){t.exports={LINEAR:0,NEAREST:1}},function(t,e,i){var n=i(17),r=i(1419),s={Components:i(251),Parsers:i(1452),Formats:i(40),ImageCollection:i(576),ParseToTilemap:i(262),Tile:i(85),Tilemap:i(580),TilemapCreator:i(1459),TilemapFactory:i(1460),Tileset:i(122),TilemapLayer:i(581),Orientation:i(29),LayerData:i(120),MapData:i(121),ObjectLayer:i(572)};s=n(!1,s,r.ORIENTATION),t.exports=s},function(t,e,i){var n={ORIENTATION:i(29)};t.exports=n},function(t,e,i){var n=i(26),r=i(63);t.exports=function(t,e,i,s,o,a,h,l){void 0===h&&(h=!0),t<0&&(t=0),e<0&&(e=0);for(var u=n(t,e,i,s,null,l),c=o-t,d=a-e,p=0;p=0&&f=0&&m=0;s--)for(r=n.width-1;r>=0;r--)if((o=n.data[s][r])&&o.index===t){if(a===e)return o;a+=1}}else for(s=0;se)){for(var l=t;l<=e;l++)s(l,i,a);if(h)for(var u=0;u=t&&d.index<=e&&n(d,i)}o&&r(0,0,a.width,a.height,a)}}},function(t,e,i){var n=i(72),r=i(63),s=i(160);t.exports=function(t,e,i,o){void 0===e&&(e=!0),void 0===i&&(i=!0),Array.isArray(t)||(t=[t]);for(var a=0;a0&&n(a,t)}}e&&r(0,0,i.width,i.height,i)}},function(t,e){t.exports=function(t,e,i,n){if("number"==typeof t)n.callbacks[t]=null!==e?{callback:e,callbackContext:i}:void 0;else for(var r=0,s=t.length;r0){var s,o,a,h={},l={};if(Array.isArray(n.edgecolors))for(s=0;s1||e.scaleY>1)&&(p.imageSmoothingEnabled=!1);for(var m=0;m-1&&this._active.splice(r,1),n.destroy()}for(i=0;i=n.delay)){var r=n.elapsed-n.delay;n.elapsed=n.delay,!n.hasDispatched&&n.callback&&(n.hasDispatched=!0,n.callback.apply(n.callbackScope,n.args)),n.repeatCount>0?(n.repeatCount--,n.elapsed=r,n.hasDispatched=!1):this._pendingRemoval.push(n)}}}},shutdown:function(){var t;for(t=0;t-1&&(e.state=u.REMOVED,r.splice(s,1)):(e.state=u.REMOVED,n.splice(s,1))}for(i.length=0,i=this._add,t=0;t>2],s+=i[(3&n[o])<<4|n[o+1]>>4],s+=i[(15&n[o+1])<<2|n[o+2]>>6],s+=i[63&n[o+2]];return r%3==2?s=s.substring(0,s.length-1)+"=":r%3==1&&(s=s.substring(0,s.length-2)+"=="),s}},function(t,e,i){t.exports={Clone:i(77),DeepCopy:i(175),Extend:i(17),GetAdvancedValue:i(13),GetFastValue:i(2),GetMinMaxValue:i(1485),GetValue:i(6),HasAll:i(1486),HasAny:i(455),HasValue:i(126),IsPlainObject:i(7),Merge:i(127),MergeRight:i(1487),Pick:i(571),SetValue:i(478)}},function(t,e,i){var n=i(6),r=i(18);t.exports=function(t,e,i,s,o){void 0===o&&(o=i);var a=n(t,e,o);return r(a,i,s)}},function(t,e){t.exports=function(t,e){for(var i=0;i0},intersectPoint:function(t,e,i){i=this.getMatterBodies(i);var n=D.create(t,e),r=[];return C.point(i,n).forEach((function(t){-1===r.indexOf(t)&&r.push(t)})),r},intersectRect:function(t,e,i,n,r,s){void 0===r&&(r=!1),s=this.getMatterBodies(s);var o={min:{x:t,y:e},max:{x:t+i,y:e+n}},a=[];return C.region(s,o,r).forEach((function(t){-1===a.indexOf(t)&&a.push(t)})),a},intersectRay:function(t,e,i,n,r,s){void 0===r&&(r=1),s=this.getMatterBodies(s);for(var o=[],a=C.ray(s,D.create(t,e),D.create(i,n),r),h=0;h0)for(var o=0;oe.max.x?i=e.min.x-t.max.x:t.max.xe.max.y?n=e.min.y-t.max.y:t.max.y0?e+1:0,this.dragTexture=i?1:0,this.targetObject=s,this.initializeLocalHeadGeometry(n,r),this.nodeIDs=[],this.nodeCenters=[];for(var o=0;o=this.length?0:this.currentEnd+1;if(e?this.updateNodePositionsFromTransformMatrix(i,e):this.updateNodePositionsFromOrientationTangent(i,t.position,t.tangent),this.currentLength>=1){this.connectNodes(this.currentEnd,i);if(this.currentLength>=this.length){var n=this.currentEnd+1>=this.length?0:this.currentEnd+1;this.disconnectNodes(n)}}this.currentLength=this.length&&(this.currentEnd=0),this.currentLength>=1&&(this.currentLength1e-4)){this.lastOrientationDir||(this.lastOrientationDir=new THREE.Vector3),e.setFromUnitVectors(r,s),n.copy(this.currentNodeCenter);for(d=0;d0,e}}],(i=null)&&s(e.prototype,i),n&&s(e,n),Object.defineProperty(e,"prototype",{writable:!1}),t}();function l(t,e){for(var i=0;i0||(u++,o=this,r.a.phaserScene=this,this.load.atlas("atlas","assets/ui/atlas.png","assets/ui/atlas.json"),this.load.atlas("uiatlas","assets/uiatlas/uiatlas.png","assets/uiatlas/uiatlas.json"),this.load.image("drawArea","assets/ui/draw_kanvas.png"),h.upgradePhaser())},create:function(){a.canvas.style.zIndex=2,e&&e(),r.a.eventEmitter.emit("phaserReady")},update:function(){}}};a=new Phaser.Game(i),r.a.phaserGame=a}var e,i,n;return e=t,(i=[{key:"resize",value:function(t,e){var i=a.config.width,n=a.config.height,r=Math.min(t/i,e/n)+.0015,s=t/r,h=e/r;a.canvas.style["-ms-transform"]="scale("+r+")",a.canvas.style["-webkit-transform"]="scale3d("+r+", 1)",a.canvas.style["-moz-transform"]="scale("+r+")",a.canvas.style["-o-transform"]="scale("+r+")",a.canvas.style.transform="scale("+r+")",a.canvas.style.transformOrigin="top left",o.lastWidth=s,o.lastHeight=h,a.scale.resize(s,h),a.scene.scenes.forEach((function(t){t.cameras.resize(s,h),t.children.list.forEach((function(t){t.onResizeCallback&&t.onResizeCallback(s,h)}))}))}}])&&l(e.prototype,i),n&&l(e,n),Object.defineProperty(e,"prototype",{writable:!1}),t}(),d={isWebGLAvailable:function(){try{var t=document.createElement("canvas");return!(!window.WebGLRenderingContext||!t.getContext("webgl")&&!t.getContext("experimental-webgl"))}catch(t){return!1}},isWebGL2Available:function(){try{var t=document.createElement("canvas");return!(!window.WebGL2RenderingContext||!t.getContext("webgl2"))}catch(t){return!1}},getWebGLErrorMessage:function(){return this.getErrorMessage(1)},getWebGL2ErrorMessage:function(){return this.getErrorMessage(2)},getErrorMessage:function(t){var e={1:window.WebGLRenderingContext,2:window.WebGL2RenderingContext},i='Your $0 does not seem to support $1',n=document.createElement("div");return n.id="webglmessage",n.style.fontFamily="monospace",n.style.fontSize="13px",n.style.fontWeight="normal",n.style.textAlign="center",n.style.background="#fff",n.style.color="#000",n.style.padding="1.5em",n.style.width="400px",n.style.margin="5em auto 0",i=(i=e[t]?i.replace("$0","graphics card"):i.replace("$0","browser")).replace("$1",{1:"WebGL",2:"WebGL 2"}[t]),n.innerHTML=i,n}},p=i(0);const f={type:"change"},m={type:"start"},g={type:"end"};class v extends p.EventDispatcher{constructor(t,e){super(),document,this.object=t,this.domElement=e,this.domElement.style.touchAction="none",this.enabled=!0,this.target=new p.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=!0,this.keyPanSpeed=7,this.autoRotate=!1,this.autoRotateSpeed=2,this.keys={LEFT:"ArrowLeft",UP:"ArrowUp",RIGHT:"ArrowRight",BOTTOM:"ArrowDown"},this.mouseButtons={LEFT:p.MOUSE.ROTATE,MIDDLE:p.MOUSE.DOLLY,RIGHT:p.MOUSE.PAN},this.touches={ONE:p.TOUCH.ROTATE,TWO:p.TOUCH.DOLLY_PAN},this.target0=this.target.clone(),this.position0=this.object.position.clone(),this.zoom0=this.object.zoom,this._domElementKeyEvents=null,this.getPolarAngle=function(){return o.phi},this.getAzimuthalAngle=function(){return o.theta},this.getDistance=function(){return this.object.position.distanceTo(this.target)},this.listenToKeyEvents=function(t){t.addEventListener("keydown",j),this._domElementKeyEvents=t},this.saveState=function(){i.target0.copy(i.target),i.position0.copy(i.object.position),i.zoom0=i.object.zoom},this.reset=function(){i.target.copy(i.target0),i.object.position.copy(i.position0),i.object.zoom=i.zoom0,i.object.updateProjectionMatrix(),i.dispatchEvent(f),i.update(),r=n.NONE},this.update=function(){const e=new p.Vector3,c=(new p.Quaternion).setFromUnitVectors(t.up,new p.Vector3(0,1,0)),d=c.clone().invert(),m=new p.Vector3,g=new p.Quaternion,v=2*Math.PI;return function(){const t=i.object.position;e.copy(t).sub(i.target),e.applyQuaternion(c),o.setFromVector3(e),i.autoRotate&&r===n.NONE&&_(2*Math.PI/60/60*i.autoRotateSpeed),i.enableDamping?(o.theta+=a.theta*i.dampingFactor,o.phi+=a.phi*i.dampingFactor):(o.theta+=a.theta,o.phi+=a.phi);let p=i.minAzimuthAngle,y=i.maxAzimuthAngle;return isFinite(p)&&isFinite(y)&&(p<-Math.PI?p+=v:p>Math.PI&&(p-=v),y<-Math.PI?y+=v:y>Math.PI&&(y-=v),o.theta=p<=y?Math.max(p,Math.min(y,o.theta)):o.theta>(p+y)/2?Math.max(p,o.theta):Math.min(y,o.theta)),o.phi=Math.max(i.minPolarAngle,Math.min(i.maxPolarAngle,o.phi)),o.makeSafe(),o.radius*=h,o.radius=Math.max(i.minDistance,Math.min(i.maxDistance,o.radius)),!0===i.enableDamping?i.target.addScaledVector(l,i.dampingFactor):i.target.add(l),e.setFromSpherical(o),e.applyQuaternion(d),t.copy(i.target).add(e),i.object.lookAt(i.target),!0===i.enableDamping?(a.theta*=1-i.dampingFactor,a.phi*=1-i.dampingFactor,l.multiplyScalar(1-i.dampingFactor)):(a.set(0,0,0),l.set(0,0,0)),h=1,!!(u||m.distanceToSquared(i.object.position)>s||8*(1-g.dot(i.object.quaternion))>s)&&(i.dispatchEvent(f),m.copy(i.object.position),g.copy(i.object.quaternion),u=!1,!0)}}(),this.dispose=function(){i.domElement.removeEventListener("contextmenu",q),i.domElement.removeEventListener("pointerdown",H),i.domElement.removeEventListener("pointercancel",Y),i.domElement.removeEventListener("wheel",X),i.domElement.removeEventListener("pointermove",G),i.domElement.removeEventListener("pointerup",W),null!==i._domElementKeyEvents&&i._domElementKeyEvents.removeEventListener("keydown",j)};const i=this,n={NONE:-1,ROTATE:0,DOLLY:1,PAN:2,TOUCH_ROTATE:3,TOUCH_PAN:4,TOUCH_DOLLY_PAN:5,TOUCH_DOLLY_ROTATE:6};let r=n.NONE;const s=1e-6,o=new p.Spherical,a=new p.Spherical;let h=1;const l=new p.Vector3;let u=!1;const c=new p.Vector2,d=new p.Vector2,v=new p.Vector2,y=new p.Vector2,x=new p.Vector2,w=new p.Vector2,b=new p.Vector2,A=new p.Vector2,T=new p.Vector2,S=[],E={};function M(){return Math.pow(.95,i.zoomSpeed)}function _(t){a.theta-=t}function C(t){a.phi-=t}const P=function(){const t=new p.Vector3;return function(e,i){t.setFromMatrixColumn(i,0),t.multiplyScalar(-e),l.add(t)}}(),R=function(){const t=new p.Vector3;return function(e,n){!0===i.screenSpacePanning?t.setFromMatrixColumn(n,1):(t.setFromMatrixColumn(n,0),t.crossVectors(i.object.up,t)),t.multiplyScalar(e),l.add(t)}}(),L=function(){const t=new p.Vector3;return function(e,n){const r=i.domElement;if(i.object.isPerspectiveCamera){const s=i.object.position;t.copy(s).sub(i.target);let o=t.length();o*=Math.tan(i.object.fov/2*Math.PI/180),P(2*e*o/r.clientHeight,i.object.matrix),R(2*n*o/r.clientHeight,i.object.matrix)}else i.object.isOrthographicCamera?(P(e*(i.object.right-i.object.left)/i.object.zoom/r.clientWidth,i.object.matrix),R(n*(i.object.top-i.object.bottom)/i.object.zoom/r.clientHeight,i.object.matrix)):i.enablePan=!1}}();function O(t){i.object.isPerspectiveCamera?h/=t:i.object.isOrthographicCamera?(i.object.zoom=Math.max(i.minZoom,Math.min(i.maxZoom,i.object.zoom*t)),i.object.updateProjectionMatrix(),u=!0):i.enableZoom=!1}function D(t){i.object.isPerspectiveCamera?h*=t:i.object.isOrthographicCamera?(i.object.zoom=Math.max(i.minZoom,Math.min(i.maxZoom,i.object.zoom/t)),i.object.updateProjectionMatrix(),u=!0):i.enableZoom=!1}function B(t){c.set(t.clientX,t.clientY)}function I(t){y.set(t.clientX,t.clientY)}function F(){if(1===S.length)c.set(S[0].pageX,S[0].pageY);else{const t=.5*(S[0].pageX+S[1].pageX),e=.5*(S[0].pageY+S[1].pageY);c.set(t,e)}}function k(){if(1===S.length)y.set(S[0].pageX,S[0].pageY);else{const t=.5*(S[0].pageX+S[1].pageX),e=.5*(S[0].pageY+S[1].pageY);y.set(t,e)}}function N(){const t=S[0].pageX-S[1].pageX,e=S[0].pageY-S[1].pageY,i=Math.sqrt(t*t+e*e);b.set(0,i)}function z(t){if(1==S.length)d.set(t.pageX,t.pageY);else{const e=J(t),i=.5*(t.pageX+e.x),n=.5*(t.pageY+e.y);d.set(i,n)}v.subVectors(d,c).multiplyScalar(i.rotateSpeed);const e=i.domElement;_(2*Math.PI*v.x/e.clientHeight),C(2*Math.PI*v.y/e.clientHeight),c.copy(d)}function U(t){if(1===S.length)x.set(t.pageX,t.pageY);else{const e=J(t),i=.5*(t.pageX+e.x),n=.5*(t.pageY+e.y);x.set(i,n)}w.subVectors(x,y).multiplyScalar(i.panSpeed),L(w.x,w.y),y.copy(x)}function V(t){const e=J(t),n=t.pageX-e.x,r=t.pageY-e.y,s=Math.sqrt(n*n+r*r);A.set(0,s),T.set(0,Math.pow(A.y/b.y,i.zoomSpeed)),O(T.y),b.copy(A)}function H(t){!1!==i.enabled&&(0===S.length&&(i.domElement.setPointerCapture(t.pointerId),i.domElement.addEventListener("pointermove",G),i.domElement.addEventListener("pointerup",W)),function(t){S.push(t)}(t),"touch"===t.pointerType?function(t){switch(K(t),S.length){case 1:switch(i.touches.ONE){case p.TOUCH.ROTATE:if(!1===i.enableRotate)return;F(),r=n.TOUCH_ROTATE;break;case p.TOUCH.PAN:if(!1===i.enablePan)return;k(),r=n.TOUCH_PAN;break;default:r=n.NONE}break;case 2:switch(i.touches.TWO){case p.TOUCH.DOLLY_PAN:if(!1===i.enableZoom&&!1===i.enablePan)return;i.enableZoom&&N(),i.enablePan&&k(),r=n.TOUCH_DOLLY_PAN;break;case p.TOUCH.DOLLY_ROTATE:if(!1===i.enableZoom&&!1===i.enableRotate)return;i.enableZoom&&N(),i.enableRotate&&F(),r=n.TOUCH_DOLLY_ROTATE;break;default:r=n.NONE}break;default:r=n.NONE}r!==n.NONE&&i.dispatchEvent(m)}(t):function(t){let e;switch(t.button){case 0:e=i.mouseButtons.LEFT;break;case 1:e=i.mouseButtons.MIDDLE;break;case 2:e=i.mouseButtons.RIGHT;break;default:e=-1}switch(e){case p.MOUSE.DOLLY:if(!1===i.enableZoom)return;!function(t){b.set(t.clientX,t.clientY)}(t),r=n.DOLLY;break;case p.MOUSE.ROTATE:if(t.ctrlKey||t.metaKey||t.shiftKey){if(!1===i.enablePan)return;I(t),r=n.PAN}else{if(!1===i.enableRotate)return;B(t),r=n.ROTATE}break;case p.MOUSE.PAN:if(t.ctrlKey||t.metaKey||t.shiftKey){if(!1===i.enableRotate)return;B(t),r=n.ROTATE}else{if(!1===i.enablePan)return;I(t),r=n.PAN}break;default:r=n.NONE}r!==n.NONE&&i.dispatchEvent(m)}(t))}function G(t){!1!==i.enabled&&("touch"===t.pointerType?function(t){switch(K(t),r){case n.TOUCH_ROTATE:if(!1===i.enableRotate)return;z(t),i.update();break;case n.TOUCH_PAN:if(!1===i.enablePan)return;U(t),i.update();break;case n.TOUCH_DOLLY_PAN:if(!1===i.enableZoom&&!1===i.enablePan)return;!function(t){i.enableZoom&&V(t),i.enablePan&&U(t)}(t),i.update();break;case n.TOUCH_DOLLY_ROTATE:if(!1===i.enableZoom&&!1===i.enableRotate)return;!function(t){i.enableZoom&&V(t),i.enableRotate&&z(t)}(t),i.update();break;default:r=n.NONE}}(t):function(t){if(!1===i.enabled)return;switch(r){case n.ROTATE:if(!1===i.enableRotate)return;!function(t){d.set(t.clientX,t.clientY),v.subVectors(d,c).multiplyScalar(i.rotateSpeed);const e=i.domElement;_(2*Math.PI*v.x/e.clientHeight),C(2*Math.PI*v.y/e.clientHeight),c.copy(d),i.update()}(t);break;case n.DOLLY:if(!1===i.enableZoom)return;!function(t){A.set(t.clientX,t.clientY),T.subVectors(A,b),T.y>0?O(M()):T.y<0&&D(M()),b.copy(A),i.update()}(t);break;case n.PAN:if(!1===i.enablePan)return;!function(t){x.set(t.clientX,t.clientY),w.subVectors(x,y).multiplyScalar(i.panSpeed),L(w.x,w.y),y.copy(x),i.update()}(t)}}(t))}function W(t){Q(t),0===S.length&&(i.domElement.releasePointerCapture(t.pointerId),i.domElement.removeEventListener("pointermove",G),i.domElement.removeEventListener("pointerup",W)),i.dispatchEvent(g),r=n.NONE}function Y(t){Q(t)}function X(t){!1!==i.enabled&&!1!==i.enableZoom&&r===n.NONE&&(t.preventDefault(),i.dispatchEvent(m),function(t){t.deltaY<0?D(M()):t.deltaY>0&&O(M()),i.update()}(t),i.dispatchEvent(g))}function j(t){!1!==i.enabled&&!1!==i.enablePan&&function(t){let e=!1;switch(t.code){case i.keys.UP:L(0,i.keyPanSpeed),e=!0;break;case i.keys.BOTTOM:L(0,-i.keyPanSpeed),e=!0;break;case i.keys.LEFT:L(i.keyPanSpeed,0),e=!0;break;case i.keys.RIGHT:L(-i.keyPanSpeed,0),e=!0}e&&(t.preventDefault(),i.update())}(t)}function q(t){!1!==i.enabled&&t.preventDefault()}function Q(t){delete E[t.pointerId];for(let e=0;e=3||!r.a.gpuTier.isMobile)?(n.antialias=!0,r.a.enableShadows=!0,i.resolution=1.4):(r.a.lowEndDevice=!0,r.a.enableShadows=!1,i.resolution=r.a.minResolution);var s=new w.WebGLRenderer(n);n.canvas||document.body.appendChild(s.domElement),s.setClearColor("#ff00ff",0);var o=new w.PerspectiveCamera(i.FOV||75,i.width/i.height,i.cameraNear||1,i.cameraFar||1500),a=new w.Scene,h=r.a.main;h.scene=a,h.camera=o,h.renderer=s,r.a.threeScene=a,r.a.threeRenderer=s,r.a.threeCamera=o,e.renderer=s,e.camera=o,e.scene=a,s.setSize(i.width,i.height),s.getContext().canvas.addEventListener("webglcontextlost",(function(t){t.preventDefault(),e.contextLost=!0}),!1),s.getContext().canvas.addEventListener("webglcontextrestored",(function(t){e.contextLost=!1}),!1);var l=e.initControls();r.a.controls=l,e.inited=!0,t()}():setTimeout((function(){n()}),250)};setTimeout((function(){n()}),50)}},{key:"resize",value:function(t,e){var i,n,s=r.a.threeCamera,o=r.a.threeRenderer,a=r.a.threeRenderer.domElement,h=this.config,l=h.resolution||1,u=1/l;if(h.maxDimension&&t*l>h.maxDimension&&e*l>h.maxDimension){var c=h.maxDimension;u=Math.min(t/c,e/c)+.0015,l=1,i=Math.ceil(t/u),n=Math.ceil(e/u)}else i=t*l,n=e*l;r.a.threeScene.lastWidth=i,r.a.threeScene.lastHeight=n,a.style["-ms-transform"]="scale("+u+")",a.style["-webkit-transform"]="scale3d("+u+", 1)",a.style["-moz-transform"]="scale("+u+")",a.style["-o-transform"]="scale("+u+")",a.style.transform="scale("+u+")",a.style.transformOrigin="top left";var d=i/n;s.aspect=d,s.updateProjectionMatrix(),y.a.inited?y.a.resize(i,n):o.setSize(i,n)}},{key:"update",value:function(t,e){this.inited&&!this.contextLost&&(r.a.lowEndDevice?(this.renderer.render(this.scene,this.camera),r.a.uiScene&&r.a.uiScene.update(e)):(r.a.uiScene&&r.a.uiScene.update(e),this.renderer.render(this.scene,this.camera)))}},{key:"initTestControls",value:function(){var t,e=this;this.isTest=!1,window.onkeydown=function(i){if("a"==i.key&&!e.isTest){e.isTest=!0;var n=r.a.main.camera.position.clone(),s=new w.Vector3(0,0,-100);s.applyQuaternion(r.a.main.camera.quaternion),n.add(s),(t=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:500,n=arguments.length>2?arguments[2]:void 0,r=new v(e.camera,document.body);return r.enableDamping=!0,r.dampingFactor=.25,r.screenSpacePanning=!1,void 0!==n&&(r.maxPolarAngle=n),r.minDistance=t,r.maxDistance=i,r}(0,1500)).minDistance=0,t.maxDistance=1e3,t.target=new w.Vector3(n.x,n.y,n.z),t.update(),r.a.camera.enabled=!1}"s"==i.key&&e.isTest&&(e.isTest=!1,t.dispose&&t.dispose()),"c"==i.key&&e.isTest&&(r.a.camera.enabled=!r.a.camera.enabled),r.a.main.isTest=e.isTest}}},{key:"initControls",value:function(){var t={isDown:!1},e=document.body;function i(e){t.prevX=t.mouseX,t.prevY=t.mouseY,t.mouseX=e.pageX,t.mouseY=e.pageY}function n(r){t.isDown=!1,e.removeEventListener("mouseup",n),e.removeEventListener("mousemove",i)}function r(e){t.prevX=t.mouseX,t.prevY=t.mouseY,t.mouseX=e.touches[0].pageX,t.mouseY=e.touches[0].pageY}function s(i){t.isDown=!1,e.removeEventListener("touchend",s),e.removeEventListener("touchmove",r)}return e.addEventListener("mousedown",(function(r){t.downX=r.pageX,t.downY=r.pageY,t.mouseX=r.pageX,t.mouseY=r.pageY,t.prevX=r.pageX,t.prevY=r.pageY,t.isDown=!0,e.addEventListener("mouseup",n),e.addEventListener("mousemove",i)})),e.addEventListener("touchstart",(function(i){t.downX=i.touches[0].pageX,t.downY=i.touches[0].pageY,t.mouseX=i.touches[0].pageX,t.mouseY=i.touches[0].pageY,t.prevX=i.touches[0].pageX,t.prevY=i.touches[0].pageY,t.isDown=!0,e.addEventListener("touchend",s),e.addEventListener("touchmove",r)})),t}}])&&x(e.prototype,i),n&&x(e,n),Object.defineProperty(e,"prototype",{writable:!1}),t}(),T=i(8),S=i(12),E=i(4),M=i(7),_=i(37);function C(t,e){for(var i=0;i=1/60;)M.a.world.step(i),E.a.update(i),P-=1/60}}},{key:"addDebugTeam",value:function(){!0,S.a.init(b),S.a.initStats(),S.a.addLights(),setTimeout((function(){S.a.gui.hide(),S.a.stats.dom.style.bottom=0,S.a.stats.dom.style.top="unset",S.a.stats.dom.childNodes.forEach((function(t){t.style.position="relative"}))}),10),setTimeout((function(){}),10)}}])&&C(e.prototype,i),n&&C(e,n),Object.defineProperty(e,"prototype",{writable:!1}),t}(),L=i(29);function O(t,e){var i="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!i){if(Array.isArray(t)||(i=function(t,e){if(!t)return;if("string"==typeof t)return D(t,e);var i=Object.prototype.toString.call(t).slice(8,-1);"Object"===i&&t.constructor&&(i=t.constructor.name);if("Map"===i||"Set"===i)return Array.from(t);if("Arguments"===i||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i))return D(t,e)}(t))||e&&t&&"number"==typeof t.length){i&&(t=i);var n=0,r=function(){};return{s:r,n:function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(t){throw t},f:r}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var s,o=!0,a=!1;return{s:function(){i=i.call(t)},n:function(){var t=i.next();return o=t.done,t},e:function(t){a=!0,s=t},f:function(){try{o||null==i.return||i.return()}finally{if(a)throw s}}}}function D(t,e){(null==e||e>t.length)&&(e=t.length);for(var i=0,n=new Array(e);i=n&&(e&&e(),e=null)}var s,o=O(t);try{for(o.s();!(s=o.n()).done;){var a=s.value;n++,"font"==a.type&&this.loadFont(a.key,a.src,r)}}catch(t){o.e(t)}finally{o.f()}0==t.length&&setTimeout((function(){e&&e(),e=null}),100)}},{key:"loadFont",value:function(t,e,i){new FontFace(t,"url(".concat(e,")")).load().then((function(t){document.fonts.add(t),i()})).catch((function(t){return t}))}}],(i=null)&&B(e.prototype,i),n&&B(e,n),Object.defineProperty(e,"prototype",{writable:!1}),t}(),F=i(39),k=i(57);function N(t,e){for(var i=0;i1&&void 0!==arguments[1]?arguments[1]:1,i=arguments.length>2&&void 0!==arguments[2]&&arguments[2],n=arguments.length>3&&void 0!==arguments[3]&&arguments[3];if(r.a.data.soundEnabled&&(!i||t!==app.lastPlayedName)){var s=u.play(t);return u.rate(e,s),app.lastPlayed=s,app.lastPlayedName=t,n&&(app.lastPlayed=null,app.lastPlayedName=null),s}},app.setSoundRate=function(t,e){r.a.data.soundEnabled&&u.rate(e,t)},app.getSound=function(){if(r.a.data.soundEnabled)return u},app.checkSoundPlaying=function(t){if(r.a.data.soundEnabled)return u.playing(t)},app.seekSound=function(t){if(r.a.data.soundEnabled)return u.seek(t)},app.getSoundDuration=function(t){if(r.a.data.soundEnabled)return u.duration(t)},app.stopSfx=function(t){r.a.data.soundEnabled&&t&&u.stop(t)},app.stopLastPlayed=function(){r.a.data.soundEnabled&&app.lastPlayed&&(u.stop(app.lastPlayed),app.lastPlayed=null,app.lastPlayedName=null)},app.setVolume=function(t,e){r.a.data.soundEnabled&&u.volume(e,t)},app.sfxFade=function(t,e,i,n){r.a.data.soundEnabled&&u.fade(e,i,n,t)}}}}],(i=null)&&N(e.prototype,i),n&&N(e,n),Object.defineProperty(e,"prototype",{writable:!1}),t}();function U(t,e){for(var i=0;it.length)&&(e=t.length);for(var i=0,n=new Array(e);i.03&&(e=.03);var i=60*e;j.update(i,e),q.update(i,e)},it=function(){X.gamePaused=!0,ht()},nt=function(){document.hidden||r.a.adShowing||(X.gamePaused=!1,lt())},rt=window.H5SDK;function st(){return ot.apply(this,arguments)}function ot(){return(ot=Y(regeneratorRuntime.mark((function t(){var e,i;return regeneratorRuntime.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,rt.getStoreModule().get(["saveData"]);case 2:if((e=t.sent)&&e.saveData){for(i in r.a.saveData=e.saveData,r.a.saveData)void 0!==r.a.playerData[i]&&(r.a.playerData[i]=r.a.saveData[i]);r.a.data.selectedLevel1=r.a.saveData.level%10}case 5:case"end":return t.stop()}}),t)})))).apply(this,arguments)}function at(){return(at=Y(regeneratorRuntime.mark((function t(e){var i;return regeneratorRuntime.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(!e)for(i in r.a.saveData)void 0!==r.a.saveData[i]&&(r.a.saveData[i]=r.a.playerData[i]);return t.next=3,rt.getStoreModule().save("saveData",r.a.saveData);case 3:case"end":return t.stop()}}),t)})))).apply(this,arguments)}r.a.saveGame=function(){!function(t){at.apply(this,arguments)}()},r.a.showFacebookTournament=function(t){rt.getPlatform().isFacebook()?rt.getPlatform().showTournamentCreatorPopup().then((function(){t(!0)})):t(!1)};var ht=function(){window.Howler&&window.Howler.mute(!0)},lt=function(){document.hidden||r.a.adShowing||window.Howler&&window.Howler.mute(!r.a.soundOn)};X.pauseGameHandler=it,X.resumeGameHandler=nt,X.muteGameHandler=ht,X.unmuteGameHandler=lt,X.beforeAdShown=function(){r.a.adShowing=!0,X.muteGameHandler&&X.muteGameHandler()},X.afterAdShown=function(){r.a.adShowing=!1,X.unmuteGameHandler&&X.unmuteGameHandler()},X.beforeAdShown(),X.afterAdShown(),z.initDefault();var ut=function(){var t=function(t){K++;var e=Math.round(K/6*100);rt.getPlatform().notifyLoadingProgress(e),$.setLoadingPerc(e),K>=6&&!J&&(window.addEventListener("resize",tt),rt.getPlatform().notifyLoadingComplete(),$.hide(),j=new R,J=!0,tt(),requestAnimationFrame(et))};L.a.loadTextures([{name:"logo",path:"assets/textures/Logo.png"},{name:"star",path:"assets/textures/star2.png"},{name:"endstar",path:"assets/textures/endstar.png"},{name:"flags",path:"assets/textures/spritesheet.png"},{name:"namebg",path:"assets/textures/name_bar.png"},{name:"textures/texture1.png",path:"assets/textures/texture1.png"}],(function(){t()}));var e=[{name:"coin4",path:"assets/modelsglb/coin/scene.glb"},{name:"coinSolo",path:"assets/modelsglb/coinSolo/scene.glb"},{name:"char",path:"assets/modelsglb/char/scene.glb"},{name:"crown",path:"assets/modelsglb/crown/scene.glb"},{name:"finalPlatform",path:"assets/modelsglb/finalplatform/scene.glb"},{name:"dashFx",path:"assets/modelsglb/blowfx/scene.glb"},{name:"flagplane",path:"assets/modelsglb/flagplane/scene.glb"},{name:"ballsV",path:"assets/modelsglb/ballsV/scene.glb"}],s=r.a.data.selectedLevel1+1;e.push({name:"level"+s,path:"assets/modelsglb/level"+s+"/scene.glb"}),L.a.loadModels(e,(function(){t()})),I.load([{type:"font",src:i(65),key:"ui-font"}],(function(){t()})),Object(n.a)().then((function(e){if(r.a.gpuTier=e,r.a.showGpuInfo){var i=document.createElement("div");Object.entries(e).forEach((function(t){var e=H(t,2),n=e[0],r=e[1];i.innerHTML+="
".concat(n,": ").concat(r,"
")})),i.innerHTML+="
Pixel Ratio: "+window.devicePixelRatio+"
",document.body.append(i),i.style.display="block",i.style.position="absolute",i.style.bottom=0,i.style.zIndex=1e4,i.style.fontSize="7vmin",i.style.touchAction="none",i.style.pointerEvents="none"}t(),q=new A((function(){t()}))})),Q=new c((function(){(function(){return ct.apply(this,arguments)})().then((function(){t()}))}))};function ct(){return(ct=Y(regeneratorRuntime.mark((function t(){var e;return regeneratorRuntime.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:t.t0=regeneratorRuntime.keys(r.a.locales);case 1:if((t.t1=t.t0()).done){t.next=8;break}return e=t.t1.value,t.next=5,rt.getI18nModule().getTranslation(e);case 5:r.a.locales[e]=t.sent,t.next=1;break;case 8:case"end":return t.stop()}}),t)})))).apply(this,arguments)}function dt(){return(dt=Y(regeneratorRuntime.mark((function t(){return regeneratorRuntime.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return rt.addEventListener("pause",it),rt.addEventListener("resume",nt),rt.addEventListener("mute",ht),rt.addEventListener("unmute",lt),rt.getPlatform().isYoutube()||(window.addEventListener("blur",it),window.addEventListener("focus",nt)),window.replayEvent=function(){return LevelManager.resetLevel()},window.nextLevelEvent=function(){return LevelManager.goNextLevel(!0)},window.gotoHomeEvent=function(){return LevelManager.resetLevel()},t.next=10,rt.getPlatform().init();case 10:return t.next=12,st();case 12:ut();case 13:case"end":return t.stop()}}),t)})))).apply(this,arguments)}window.addEventListener("load",(function(){return dt.apply(this,arguments)}))}]);