forked from MozillaReality/hello-webxr
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbundle.js
101 lines (101 loc) · 980 KB
/
bundle.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
!function(e){var t={};function r(n){if(t[n])return t[n].exports;var i=t[n]={i:n,l:!1,exports:{}};return e[n].call(i.exports,i,i.exports,r),i.l=!0,i.exports}r.m=e,r.c=t,r.d=function(e,t,n){r.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:n})},r.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},r.t=function(e,t){if(1&t&&(e=r(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(r.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var i in e)r.d(n,i,function(t){return e[t]}.bind(null,i));return n},r.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return r.d(t,"a",t),t},r.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r.p="",r(r.s=6)}([function(e,t,r){"use strict";r.r(t),r.d(t,"ACESFilmicToneMapping",(function(){return le})),r.d(t,"AddEquation",(function(){return C})),r.d(t,"AddOperation",(function(){return re})),r.d(t,"AdditiveBlending",(function(){return E})),r.d(t,"AlphaFormat",(function(){return He})),r.d(t,"AlwaysDepth",(function(){return X})),r.d(t,"AlwaysStencilFunc",(function(){return ur})),r.d(t,"AmbientLight",(function(){return rh})),r.d(t,"AmbientLightProbe",(function(){return Sh})),r.d(t,"AnimationClip",(function(){return cu})),r.d(t,"AnimationLoader",(function(){return gu})),r.d(t,"AnimationMixer",(function(){return td})),r.d(t,"AnimationObjectGroup",(function(){return $h})),r.d(t,"AnimationUtils",(function(){return Zc})),r.d(t,"ArcCurve",(function(){return Su})),r.d(t,"ArrayCamera",(function(){return bs})),r.d(t,"ArrowHelper",(function(){return Vd})),r.d(t,"Audio",(function(){return Bh})),r.d(t,"AudioAnalyser",(function(){return kh})),r.d(t,"AudioContext",(function(){return bh})),r.d(t,"AudioListener",(function(){return Oh})),r.d(t,"AudioLoader",(function(){return Ah})),r.d(t,"AxesHelper",(function(){return jd})),r.d(t,"AxisHelper",(function(){return Kp})),r.d(t,"BackSide",(function(){return g})),r.d(t,"BasicDepthPacking",(function(){return Wt})),r.d(t,"BasicShadowMap",(function(){return d})),r.d(t,"BinaryTextureLoader",(function(){return nf})),r.d(t,"Bone",(function(){return Ks})),r.d(t,"BooleanKeyframeTrack",(function(){return ru})),r.d(t,"BoundingBoxHelper",(function(){return $p})),r.d(t,"Box2",(function(){return ud})),r.d(t,"Box3",(function(){return Sn})),r.d(t,"Box3Helper",(function(){return Nd})),r.d(t,"BoxBufferGeometry",(function(){return ra})),r.d(t,"BoxGeometry",(function(){return ta})),r.d(t,"BoxHelper",(function(){return Ud})),r.d(t,"BufferAttribute",(function(){return ui})),r.d(t,"BufferGeometry",(function(){return Li})),r.d(t,"BufferGeometryLoader",(function(){return lh})),r.d(t,"ByteType",(function(){return Pe})),r.d(t,"Cache",(function(){return hu})),r.d(t,"Camera",(function(){return ca})),r.d(t,"CameraHelper",(function(){return Od})),r.d(t,"CanvasRenderer",(function(){return of})),r.d(t,"CanvasTexture",(function(){return Ml})),r.d(t,"CatmullRomCurve3",(function(){return Pu})),r.d(t,"CineonToneMapping",(function(){return se})),r.d(t,"CircleBufferGeometry",(function(){return Uc})),r.d(t,"CircleGeometry",(function(){return Fc})),r.d(t,"ClampToEdgeWrapping",(function(){return ye})),r.d(t,"Clock",(function(){return Lh})),r.d(t,"ClosedSplineCurve3",(function(){return Qp})),r.d(t,"Color",(function(){return ti})),r.d(t,"ColorKeyframeTrack",(function(){return nu})),r.d(t,"CompressedTexture",(function(){return _l})),r.d(t,"CompressedTextureLoader",(function(){return yu})),r.d(t,"ConeBufferGeometry",(function(){return Bc})),r.d(t,"ConeGeometry",(function(){return Oc})),r.d(t,"CubeCamera",(function(){return pa})),r.d(t,"CubeGeometry",(function(){return ta})),r.d(t,"CubeReflectionMapping",(function(){return ue})),r.d(t,"CubeRefractionMapping",(function(){return he})),r.d(t,"CubeTexture",(function(){return Ua})),r.d(t,"CubeTextureLoader",(function(){return Au})),r.d(t,"CubeUVReflectionMapping",(function(){return me})),r.d(t,"CubeUVRefractionMapping",(function(){return ve})),r.d(t,"CubicBezierCurve",(function(){return Bu})),r.d(t,"CubicBezierCurve3",(function(){return Fu})),r.d(t,"CubicInterpolant",(function(){return Kc})),r.d(t,"CullFaceBack",(function(){return s})),r.d(t,"CullFaceFront",(function(){return l})),r.d(t,"CullFaceFrontBack",(function(){return c})),r.d(t,"CullFaceNone",(function(){return o})),r.d(t,"Curve",(function(){return _u})),r.d(t,"CurvePath",(function(){return Vu})),r.d(t,"CustomBlending",(function(){return L})),r.d(t,"CylinderBufferGeometry",(function(){return Ic})),r.d(t,"CylinderGeometry",(function(){return Dc})),r.d(t,"Cylindrical",(function(){return ld})),r.d(t,"DataTexture",(function(){return ma})),r.d(t,"DataTexture2DArray",(function(){return Na})),r.d(t,"DataTexture3D",(function(){return Ga})),r.d(t,"DataTextureLoader",(function(){return xu})),r.d(t,"DecrementStencilOp",(function(){return $t})),r.d(t,"DecrementWrapStencilOp",(function(){return tr})),r.d(t,"DefaultLoadingManager",(function(){return pu})),r.d(t,"DepthFormat",(function(){return Ye})),r.d(t,"DepthStencilFormat",(function(){return Qe})),r.d(t,"DepthTexture",(function(){return Sl})),r.d(t,"DirectionalLight",(function(){return th})),r.d(t,"DirectionalLightHelper",(function(){return Pd})),r.d(t,"DirectionalLightShadow",(function(){return eh})),r.d(t,"DiscreteInterpolant",(function(){return eu})),r.d(t,"DodecahedronBufferGeometry",(function(){return Nl})),r.d(t,"DodecahedronGeometry",(function(){return Ul})),r.d(t,"DoubleSide",(function(){return y})),r.d(t,"DstAlphaFactor",(function(){return k})),r.d(t,"DstColorFactor",(function(){return V})),r.d(t,"DynamicBufferAttribute",(function(){return Gp})),r.d(t,"DynamicCopyUsage",(function(){return yr})),r.d(t,"DynamicDrawUsage",(function(){return dr})),r.d(t,"DynamicReadUsage",(function(){return mr})),r.d(t,"EdgesGeometry",(function(){return Pc})),r.d(t,"EdgesHelper",(function(){return ef})),r.d(t,"EllipseCurve",(function(){return Mu})),r.d(t,"EqualDepth",(function(){return Z})),r.d(t,"EqualStencilFunc",(function(){return ar})),r.d(t,"EquirectangularReflectionMapping",(function(){return de})),r.d(t,"EquirectangularRefractionMapping",(function(){return pe})),r.d(t,"Euler",(function(){return Yr})),r.d(t,"EventDispatcher",(function(){return br})),r.d(t,"ExtrudeBufferGeometry",(function(){return gc})),r.d(t,"ExtrudeGeometry",(function(){return vc})),r.d(t,"Face3",(function(){return ai})),r.d(t,"Face4",(function(){return Tp})),r.d(t,"FaceColors",(function(){return w})),r.d(t,"FileLoader",(function(){return vu})),r.d(t,"FlatShading",(function(){return x})),r.d(t,"Float32Attribute",(function(){return Xp})),r.d(t,"Float32BufferAttribute",(function(){return yi})),r.d(t,"Float64Attribute",(function(){return Yp})),r.d(t,"Float64BufferAttribute",(function(){return xi})),r.d(t,"FloatType",(function(){return Fe})),r.d(t,"Fog",(function(){return Ss})),r.d(t,"FogExp2",(function(){return Ms})),r.d(t,"Font",(function(){return gh})),r.d(t,"FontLoader",(function(){return xh})),r.d(t,"FrontFaceDirectionCCW",(function(){return h})),r.d(t,"FrontFaceDirectionCW",(function(){return u})),r.d(t,"FrontSide",(function(){return v})),r.d(t,"Frustum",(function(){return ya})),r.d(t,"GammaEncoding",(function(){return Gt})),r.d(t,"Geometry",(function(){return ea})),r.d(t,"GeometryUtils",(function(){return af})),r.d(t,"GreaterDepth",(function(){return K})),r.d(t,"GreaterEqualDepth",(function(){return J})),r.d(t,"GreaterEqualStencilFunc",(function(){return cr})),r.d(t,"GreaterStencilFunc",(function(){return sr})),r.d(t,"GridHelper",(function(){return Ed})),r.d(t,"Group",(function(){return As})),r.d(t,"HalfFloatType",(function(){return Ue})),r.d(t,"HemisphereLight",(function(){return Xu})),r.d(t,"HemisphereLightHelper",(function(){return Sd})),r.d(t,"HemisphereLightProbe",(function(){return Mh})),r.d(t,"IcosahedronBufferGeometry",(function(){return Fl})),r.d(t,"IcosahedronGeometry",(function(){return Bl})),r.d(t,"ImageBitmapLoader",(function(){return mh})),r.d(t,"ImageLoader",(function(){return bu})),r.d(t,"ImageUtils",(function(){return Dr})),r.d(t,"ImmediateRenderObject",(function(){return fd})),r.d(t,"IncrementStencilOp",(function(){return Kt})),r.d(t,"IncrementWrapStencilOp",(function(){return er})),r.d(t,"InstancedBufferAttribute",(function(){return sh})),r.d(t,"InstancedBufferGeometry",(function(){return oh})),r.d(t,"InstancedInterleavedBuffer",(function(){return nd})),r.d(t,"InstancedMesh",(function(){return nl})),r.d(t,"Int16Attribute",(function(){return Vp})),r.d(t,"Int16BufferAttribute",(function(){return fi})),r.d(t,"Int32Attribute",(function(){return Wp})),r.d(t,"Int32BufferAttribute",(function(){return vi})),r.d(t,"Int8Attribute",(function(){return zp})),r.d(t,"Int8BufferAttribute",(function(){return hi})),r.d(t,"IntType",(function(){return Oe})),r.d(t,"InterleavedBuffer",(function(){return Es})),r.d(t,"InterleavedBufferAttribute",(function(){return Ls})),r.d(t,"Interpolant",(function(){return Jc})),r.d(t,"InterpolateDiscrete",(function(){return Rt})),r.d(t,"InterpolateLinear",(function(){return Lt})),r.d(t,"InterpolateSmooth",(function(){return Ct})),r.d(t,"InvertStencilOp",(function(){return rr})),r.d(t,"JSONLoader",(function(){return sf})),r.d(t,"KeepStencilOp",(function(){return Zt})),r.d(t,"KeyframeTrack",(function(){return tu})),r.d(t,"LOD",(function(){return Xs})),r.d(t,"LatheBufferGeometry",(function(){return Tc})),r.d(t,"LatheGeometry",(function(){return Ec})),r.d(t,"Layers",(function(){return Qr})),r.d(t,"LensFlare",(function(){return cf})),r.d(t,"LessDepth",(function(){return Y})),r.d(t,"LessEqualDepth",(function(){return Q})),r.d(t,"LessEqualStencilFunc",(function(){return or})),r.d(t,"LessStencilFunc",(function(){return ir})),r.d(t,"Light",(function(){return qu})),r.d(t,"LightProbe",(function(){return _h})),r.d(t,"LightShadow",(function(){return Yu})),r.d(t,"Line",(function(){return ul})),r.d(t,"Line3",(function(){return pd})),r.d(t,"LineBasicMaterial",(function(){return il})),r.d(t,"LineCurve",(function(){return Uu})),r.d(t,"LineCurve3",(function(){return Nu})),r.d(t,"LineDashedMaterial",(function(){return Yc})),r.d(t,"LineLoop",(function(){return fl})),r.d(t,"LinePieces",(function(){return Lp})),r.d(t,"LineSegments",(function(){return pl})),r.d(t,"LineStrip",(function(){return Rp})),r.d(t,"LinearEncoding",(function(){return Ut})),r.d(t,"LinearFilter",(function(){return Se})),r.d(t,"LinearInterpolant",(function(){return $c})),r.d(t,"LinearMipMapLinearFilter",(function(){return Le})),r.d(t,"LinearMipMapNearestFilter",(function(){return Te})),r.d(t,"LinearMipmapLinearFilter",(function(){return Re})),r.d(t,"LinearMipmapNearestFilter",(function(){return Ee})),r.d(t,"LinearToneMapping",(function(){return ie})),r.d(t,"Loader",(function(){return fu})),r.d(t,"LoaderUtils",(function(){return ah})),r.d(t,"LoadingManager",(function(){return du})),r.d(t,"LogLuvEncoding",(function(){return kt})),r.d(t,"LoopOnce",(function(){return St})),r.d(t,"LoopPingPong",(function(){return Tt})),r.d(t,"LoopRepeat",(function(){return Et})),r.d(t,"LuminanceAlphaFormat",(function(){return qe})),r.d(t,"LuminanceFormat",(function(){return We})),r.d(t,"MOUSE",(function(){return i})),r.d(t,"Material",(function(){return si})),r.d(t,"MaterialLoader",(function(){return ih})),r.d(t,"Math",(function(){return _r})),r.d(t,"Matrix3",(function(){return Pr})),r.d(t,"Matrix4",(function(){return Wr})),r.d(t,"MaxEquation",(function(){return O})),r.d(t,"Mesh",(function(){return Xi})),r.d(t,"MeshBasicMaterial",(function(){return li})),r.d(t,"MeshDepthMaterial",(function(){return us})),r.d(t,"MeshDistanceMaterial",(function(){return hs})),r.d(t,"MeshFaceMaterial",(function(){return Cp})),r.d(t,"MeshLambertMaterial",(function(){return qc})),r.d(t,"MeshMatcapMaterial",(function(){return Xc})),r.d(t,"MeshNormalMaterial",(function(){return Wc})),r.d(t,"MeshPhongMaterial",(function(){return Vc})),r.d(t,"MeshPhysicalMaterial",(function(){return Hc})),r.d(t,"MeshStandardMaterial",(function(){return kc})),r.d(t,"MeshToonMaterial",(function(){return jc})),r.d(t,"MinEquation",(function(){return I})),r.d(t,"MirroredRepeatWrapping",(function(){return xe})),r.d(t,"MixOperation",(function(){return te})),r.d(t,"MultiMaterial",(function(){return Pp})),r.d(t,"MultiplyBlending",(function(){return R})),r.d(t,"MultiplyOperation",(function(){return ee})),r.d(t,"NearestFilter",(function(){return be})),r.d(t,"NearestMipMapLinearFilter",(function(){return Me})),r.d(t,"NearestMipMapNearestFilter",(function(){return we})),r.d(t,"NearestMipmapLinearFilter",(function(){return _e})),r.d(t,"NearestMipmapNearestFilter",(function(){return Ae})),r.d(t,"NeverDepth",(function(){return q})),r.d(t,"NeverStencilFunc",(function(){return nr})),r.d(t,"NoBlending",(function(){return M})),r.d(t,"NoColors",(function(){return A})),r.d(t,"NoToneMapping",(function(){return ne})),r.d(t,"NormalBlending",(function(){return S})),r.d(t,"NotEqualDepth",(function(){return $})),r.d(t,"NotEqualStencilFunc",(function(){return lr})),r.d(t,"NumberKeyframeTrack",(function(){return iu})),r.d(t,"Object3D",(function(){return un})),r.d(t,"ObjectLoader",(function(){return uh})),r.d(t,"ObjectSpaceNormalMap",(function(){return Yt})),r.d(t,"OctahedronBufferGeometry",(function(){return Ol})),r.d(t,"OctahedronGeometry",(function(){return Il})),r.d(t,"OneFactor",(function(){return F})),r.d(t,"OneMinusDstAlphaFactor",(function(){return H})),r.d(t,"OneMinusDstColorFactor",(function(){return j})),r.d(t,"OneMinusSrcAlphaFactor",(function(){return z})),r.d(t,"OneMinusSrcColorFactor",(function(){return N})),r.d(t,"OrthographicCamera",(function(){return $u})),r.d(t,"PCFShadowMap",(function(){return p})),r.d(t,"PCFSoftShadowMap",(function(){return f})),r.d(t,"PMREMGenerator",(function(){return fp})),r.d(t,"ParametricBufferGeometry",(function(){return Rl})),r.d(t,"ParametricGeometry",(function(){return Tl})),r.d(t,"Particle",(function(){return Ip})),r.d(t,"ParticleBasicMaterial",(function(){return Fp})),r.d(t,"ParticleSystem",(function(){return Op})),r.d(t,"ParticleSystemMaterial",(function(){return Up})),r.d(t,"Path",(function(){return ju})),r.d(t,"PerspectiveCamera",(function(){return ua})),r.d(t,"Plane",(function(){return zn})),r.d(t,"PlaneBufferGeometry",(function(){return Sa})),r.d(t,"PlaneGeometry",(function(){return Ma})),r.d(t,"PlaneHelper",(function(){return Gd})),r.d(t,"PointCloud",(function(){return Dp})),r.d(t,"PointCloudMaterial",(function(){return Bp})),r.d(t,"PointLight",(function(){return Ku})),r.d(t,"PointLightHelper",(function(){return Ad})),r.d(t,"Points",(function(){return bl})),r.d(t,"PointsMaterial",(function(){return ml})),r.d(t,"PolarGridHelper",(function(){return Td})),r.d(t,"PolyhedronBufferGeometry",(function(){return Cl})),r.d(t,"PolyhedronGeometry",(function(){return Ll})),r.d(t,"PositionalAudio",(function(){return zh})),r.d(t,"PropertyBinding",(function(){return Kh})),r.d(t,"PropertyMixer",(function(){return Hh})),r.d(t,"QuadraticBezierCurve",(function(){return Gu})),r.d(t,"QuadraticBezierCurve3",(function(){return zu})),r.d(t,"Quaternion",(function(){return Sr})),r.d(t,"QuaternionKeyframeTrack",(function(){return ou})),r.d(t,"QuaternionLinearInterpolant",(function(){return au})),r.d(t,"REVISION",(function(){return n})),r.d(t,"RGBADepthPacking",(function(){return qt})),r.d(t,"RGBAFormat",(function(){return je})),r.d(t,"RGBAIntegerFormat",(function(){return tt})),r.d(t,"RGBA_ASTC_10x10_Format",(function(){return wt})),r.d(t,"RGBA_ASTC_10x5_Format",(function(){return xt})),r.d(t,"RGBA_ASTC_10x6_Format",(function(){return bt})),r.d(t,"RGBA_ASTC_10x8_Format",(function(){return At})),r.d(t,"RGBA_ASTC_12x10_Format",(function(){return _t})),r.d(t,"RGBA_ASTC_12x12_Format",(function(){return Mt})),r.d(t,"RGBA_ASTC_4x4_Format",(function(){return ht})),r.d(t,"RGBA_ASTC_5x4_Format",(function(){return dt})),r.d(t,"RGBA_ASTC_5x5_Format",(function(){return pt})),r.d(t,"RGBA_ASTC_6x5_Format",(function(){return ft})),r.d(t,"RGBA_ASTC_6x6_Format",(function(){return mt})),r.d(t,"RGBA_ASTC_8x5_Format",(function(){return vt})),r.d(t,"RGBA_ASTC_8x6_Format",(function(){return gt})),r.d(t,"RGBA_ASTC_8x8_Format",(function(){return yt})),r.d(t,"RGBA_PVRTC_2BPPV1_Format",(function(){return ct})),r.d(t,"RGBA_PVRTC_4BPPV1_Format",(function(){return lt})),r.d(t,"RGBA_S3TC_DXT1_Format",(function(){return nt})),r.d(t,"RGBA_S3TC_DXT3_Format",(function(){return it})),r.d(t,"RGBA_S3TC_DXT5_Format",(function(){return at})),r.d(t,"RGBDEncoding",(function(){return jt})),r.d(t,"RGBEEncoding",(function(){return zt})),r.d(t,"RGBEFormat",(function(){return Xe})),r.d(t,"RGBFormat",(function(){return Ve})),r.d(t,"RGBIntegerFormat",(function(){return et})),r.d(t,"RGBM16Encoding",(function(){return Vt})),r.d(t,"RGBM7Encoding",(function(){return Ht})),r.d(t,"RGB_ETC1_Format",(function(){return ut})),r.d(t,"RGB_PVRTC_2BPPV1_Format",(function(){return st})),r.d(t,"RGB_PVRTC_4BPPV1_Format",(function(){return ot})),r.d(t,"RGB_S3TC_DXT1_Format",(function(){return rt})),r.d(t,"RGFormat",(function(){return Ke})),r.d(t,"RGIntegerFormat",(function(){return $e})),r.d(t,"RawShaderMaterial",(function(){return zc})),r.d(t,"Ray",(function(){return Fn})),r.d(t,"Raycaster",(function(){return id})),r.d(t,"RectAreaLight",(function(){return nh})),r.d(t,"RedFormat",(function(){return Ze})),r.d(t,"RedIntegerFormat",(function(){return Je})),r.d(t,"ReinhardToneMapping",(function(){return ae})),r.d(t,"RepeatWrapping",(function(){return ge})),r.d(t,"ReplaceStencilOp",(function(){return Jt})),r.d(t,"ReverseSubtractEquation",(function(){return D})),r.d(t,"RingBufferGeometry",(function(){return Sc})),r.d(t,"RingGeometry",(function(){return Mc})),r.d(t,"Scene",(function(){return hn})),r.d(t,"SceneUtils",(function(){return lf})),r.d(t,"ShaderChunk",(function(){return xa})),r.d(t,"ShaderLib",(function(){return Aa})),r.d(t,"ShaderMaterial",(function(){return la})),r.d(t,"ShadowMaterial",(function(){return Gc})),r.d(t,"Shape",(function(){return Wu})),r.d(t,"ShapeBufferGeometry",(function(){return Lc})),r.d(t,"ShapeGeometry",(function(){return Rc})),r.d(t,"ShapePath",(function(){return vh})),r.d(t,"ShapeUtils",(function(){return pc})),r.d(t,"ShortType",(function(){return De})),r.d(t,"Skeleton",(function(){return Js})),r.d(t,"SkeletonHelper",(function(){return bd})),r.d(t,"SkinnedMesh",(function(){return Ys})),r.d(t,"SmoothShading",(function(){return b})),r.d(t,"Sphere",(function(){return Rn})),r.d(t,"SphereBufferGeometry",(function(){return _c})),r.d(t,"SphereGeometry",(function(){return wc})),r.d(t,"Spherical",(function(){return sd})),r.d(t,"SphericalHarmonics3",(function(){return wh})),r.d(t,"SphericalReflectionMapping",(function(){return fe})),r.d(t,"Spline",(function(){return Jp})),r.d(t,"SplineCurve",(function(){return ku})),r.d(t,"SplineCurve3",(function(){return Zp})),r.d(t,"SpotLight",(function(){return Zu})),r.d(t,"SpotLightHelper",(function(){return vd})),r.d(t,"SpotLightShadow",(function(){return Qu})),r.d(t,"Sprite",(function(){return Vs})),r.d(t,"SpriteMaterial",(function(){return Cs})),r.d(t,"SrcAlphaFactor",(function(){return G})),r.d(t,"SrcAlphaSaturateFactor",(function(){return W})),r.d(t,"SrcColorFactor",(function(){return U})),r.d(t,"StaticCopyUsage",(function(){return gr})),r.d(t,"StaticDrawUsage",(function(){return hr})),r.d(t,"StaticReadUsage",(function(){return fr})),r.d(t,"StereoCamera",(function(){return Rh})),r.d(t,"StreamCopyUsage",(function(){return xr})),r.d(t,"StreamDrawUsage",(function(){return pr})),r.d(t,"StreamReadUsage",(function(){return vr})),r.d(t,"StringKeyframeTrack",(function(){return su})),r.d(t,"SubtractEquation",(function(){return P})),r.d(t,"SubtractiveBlending",(function(){return T})),r.d(t,"TOUCH",(function(){return a})),r.d(t,"TangentSpaceNormalMap",(function(){return Xt})),r.d(t,"TetrahedronBufferGeometry",(function(){return Dl})),r.d(t,"TetrahedronGeometry",(function(){return Pl})),r.d(t,"TextBufferGeometry",(function(){return Ac})),r.d(t,"TextGeometry",(function(){return bc})),r.d(t,"Texture",(function(){return Or})),r.d(t,"TextureLoader",(function(){return wu})),r.d(t,"TorusBufferGeometry",(function(){return jl})),r.d(t,"TorusGeometry",(function(){return Vl})),r.d(t,"TorusKnotBufferGeometry",(function(){return Hl})),r.d(t,"TorusKnotGeometry",(function(){return kl})),r.d(t,"Triangle",(function(){return Jn})),r.d(t,"TriangleFanDrawMode",(function(){return Ft})),r.d(t,"TriangleStripDrawMode",(function(){return Bt})),r.d(t,"TrianglesDrawMode",(function(){return Ot})),r.d(t,"TubeBufferGeometry",(function(){return zl})),r.d(t,"TubeGeometry",(function(){return Gl})),r.d(t,"UVMapping",(function(){return ce})),r.d(t,"Uint16Attribute",(function(){return jp})),r.d(t,"Uint16BufferAttribute",(function(){return mi})),r.d(t,"Uint32Attribute",(function(){return qp})),r.d(t,"Uint32BufferAttribute",(function(){return gi})),r.d(t,"Uint8Attribute",(function(){return kp})),r.d(t,"Uint8BufferAttribute",(function(){return di})),r.d(t,"Uint8ClampedAttribute",(function(){return Hp})),r.d(t,"Uint8ClampedBufferAttribute",(function(){return pi})),r.d(t,"Uncharted2ToneMapping",(function(){return oe})),r.d(t,"Uniform",(function(){return rd})),r.d(t,"UniformsLib",(function(){return ba})),r.d(t,"UniformsUtils",(function(){return aa})),r.d(t,"UnsignedByteType",(function(){return Ce})),r.d(t,"UnsignedInt248Type",(function(){return ke})),r.d(t,"UnsignedIntType",(function(){return Be})),r.d(t,"UnsignedShort4444Type",(function(){return Ne})),r.d(t,"UnsignedShort5551Type",(function(){return Ge})),r.d(t,"UnsignedShort565Type",(function(){return ze})),r.d(t,"UnsignedShortType",(function(){return Ie})),r.d(t,"VSMShadowMap",(function(){return m})),r.d(t,"Vector2",(function(){return Mr})),r.d(t,"Vector3",(function(){return Rr})),r.d(t,"Vector4",(function(){return Br})),r.d(t,"VectorKeyframeTrack",(function(){return lu})),r.d(t,"Vertex",(function(){return Np})),r.d(t,"VertexColors",(function(){return _})),r.d(t,"VideoTexture",(function(){return wl})),r.d(t,"WebGLMultisampleRenderTarget",(function(){return Ur})),r.d(t,"WebGLRenderTarget",(function(){return Fr})),r.d(t,"WebGLRenderTargetCube",(function(){return fa})),r.d(t,"WebGLRenderer",(function(){return _s})),r.d(t,"WebGLUtils",(function(){return gs})),r.d(t,"WireframeGeometry",(function(){return El})),r.d(t,"WireframeHelper",(function(){return tf})),r.d(t,"WrapAroundEnding",(function(){return It})),r.d(t,"XHRLoader",(function(){return rf})),r.d(t,"ZeroCurvatureEnding",(function(){return Pt})),r.d(t,"ZeroFactor",(function(){return B})),r.d(t,"ZeroSlopeEnding",(function(){return Dt})),r.d(t,"ZeroStencilOp",(function(){return Qt})),r.d(t,"sRGBEncoding",(function(){return Nt})),void 0===Number.EPSILON&&(Number.EPSILON=Math.pow(2,-52)),void 0===Number.isInteger&&(Number.isInteger=function(e){return"number"==typeof e&&isFinite(e)&&Math.floor(e)===e}),void 0===Math.sign&&(Math.sign=function(e){return e<0?-1:e>0?1:+e}),"name"in Function.prototype==!1&&Object.defineProperty(Function.prototype,"name",{get:function(){return this.toString().match(/^\s*function\s*([^\(\s]*)/)[1]}}),void 0===Object.assign&&(Object.assign=function(e){if(null==e)throw new TypeError("Cannot convert undefined or null to object");for(var t=Object(e),r=1;r<arguments.length;r++){var n=arguments[r];if(null!=n)for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(t[i]=n[i])}return t});var n="112",i={LEFT:0,MIDDLE:1,RIGHT:2,ROTATE:0,DOLLY:1,PAN:2},a={ROTATE:0,PAN:1,DOLLY_PAN:2,DOLLY_ROTATE:3},o=0,s=1,l=2,c=3,u=0,h=1,d=0,p=1,f=2,m=3,v=0,g=1,y=2,x=1,b=2,A=0,w=1,_=2,M=0,S=1,E=2,T=3,R=4,L=5,C=100,P=101,D=102,I=103,O=104,B=200,F=201,U=202,N=203,G=204,z=205,k=206,H=207,V=208,j=209,W=210,q=0,X=1,Y=2,Q=3,Z=4,J=5,K=6,$=7,ee=0,te=1,re=2,ne=0,ie=1,ae=2,oe=3,se=4,le=5,ce=300,ue=301,he=302,de=303,pe=304,fe=305,me=306,ve=307,ge=1e3,ye=1001,xe=1002,be=1003,Ae=1004,we=1004,_e=1005,Me=1005,Se=1006,Ee=1007,Te=1007,Re=1008,Le=1008,Ce=1009,Pe=1010,De=1011,Ie=1012,Oe=1013,Be=1014,Fe=1015,Ue=1016,Ne=1017,Ge=1018,ze=1019,ke=1020,He=1021,Ve=1022,je=1023,We=1024,qe=1025,Xe=je,Ye=1026,Qe=1027,Ze=1028,Je=1029,Ke=1030,$e=1031,et=1032,tt=1033,rt=33776,nt=33777,it=33778,at=33779,ot=35840,st=35841,lt=35842,ct=35843,ut=36196,ht=37808,dt=37809,pt=37810,ft=37811,mt=37812,vt=37813,gt=37814,yt=37815,xt=37816,bt=37817,At=37818,wt=37819,_t=37820,Mt=37821,St=2200,Et=2201,Tt=2202,Rt=2300,Lt=2301,Ct=2302,Pt=2400,Dt=2401,It=2402,Ot=0,Bt=1,Ft=2,Ut=3e3,Nt=3001,Gt=3007,zt=3002,kt=3003,Ht=3004,Vt=3005,jt=3006,Wt=3200,qt=3201,Xt=0,Yt=1,Qt=0,Zt=7680,Jt=7681,Kt=7682,$t=7683,er=34055,tr=34056,rr=5386,nr=512,ir=513,ar=514,or=515,sr=516,lr=517,cr=518,ur=519,hr=35044,dr=35048,pr=35040,fr=35045,mr=35049,vr=35041,gr=35046,yr=35050,xr=35042;function br(){}Object.assign(br.prototype,{addEventListener:function(e,t){void 0===this._listeners&&(this._listeners={});var r=this._listeners;void 0===r[e]&&(r[e]=[]),-1===r[e].indexOf(t)&&r[e].push(t)},hasEventListener:function(e,t){if(void 0===this._listeners)return!1;var r=this._listeners;return void 0!==r[e]&&-1!==r[e].indexOf(t)},removeEventListener:function(e,t){if(void 0!==this._listeners){var r=this._listeners[e];if(void 0!==r){var n=r.indexOf(t);-1!==n&&r.splice(n,1)}}},dispatchEvent:function(e){if(void 0!==this._listeners){var t=this._listeners[e.type];if(void 0!==t){e.target=this;for(var r=t.slice(0),n=0,i=r.length;n<i;n++)r[n].call(this,e)}}}});for(var Ar=[],wr=0;wr<256;wr++)Ar[wr]=(wr<16?"0":"")+wr.toString(16);var _r={DEG2RAD:Math.PI/180,RAD2DEG:180/Math.PI,generateUUID:function(){var e=4294967295*Math.random()|0,t=4294967295*Math.random()|0,r=4294967295*Math.random()|0,n=4294967295*Math.random()|0;return(Ar[255&e]+Ar[e>>8&255]+Ar[e>>16&255]+Ar[e>>24&255]+"-"+Ar[255&t]+Ar[t>>8&255]+"-"+Ar[t>>16&15|64]+Ar[t>>24&255]+"-"+Ar[63&r|128]+Ar[r>>8&255]+"-"+Ar[r>>16&255]+Ar[r>>24&255]+Ar[255&n]+Ar[n>>8&255]+Ar[n>>16&255]+Ar[n>>24&255]).toUpperCase()},clamp:function(e,t,r){return Math.max(t,Math.min(r,e))},euclideanModulo:function(e,t){return(e%t+t)%t},mapLinear:function(e,t,r,n,i){return n+(e-t)*(i-n)/(r-t)},lerp:function(e,t,r){return(1-r)*e+r*t},smoothstep:function(e,t,r){return e<=t?0:e>=r?1:(e=(e-t)/(r-t))*e*(3-2*e)},smootherstep:function(e,t,r){return e<=t?0:e>=r?1:(e=(e-t)/(r-t))*e*e*(e*(6*e-15)+10)},randInt:function(e,t){return e+Math.floor(Math.random()*(t-e+1))},randFloat:function(e,t){return e+Math.random()*(t-e)},randFloatSpread:function(e){return e*(.5-Math.random())},degToRad:function(e){return e*_r.DEG2RAD},radToDeg:function(e){return e*_r.RAD2DEG},isPowerOfTwo:function(e){return 0==(e&e-1)&&0!==e},ceilPowerOfTwo:function(e){return Math.pow(2,Math.ceil(Math.log(e)/Math.LN2))},floorPowerOfTwo:function(e){return Math.pow(2,Math.floor(Math.log(e)/Math.LN2))}};function Mr(e,t){this.x=e||0,this.y=t||0}function Sr(e,t,r,n){this._x=e||0,this._y=t||0,this._z=r||0,this._w=void 0!==n?n:1}Object.defineProperties(Mr.prototype,{width:{get:function(){return this.x},set:function(e){this.x=e}},height:{get:function(){return this.y},set:function(e){this.y=e}}}),Object.assign(Mr.prototype,{isVector2:!0,set:function(e,t){return this.x=e,this.y=t,this},setScalar:function(e){return this.x=e,this.y=e,this},setX:function(e){return this.x=e,this},setY:function(e){return this.y=e,this},setComponent:function(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;default:throw new Error("index is out of range: "+e)}return this},getComponent:function(e){switch(e){case 0:return this.x;case 1:return this.y;default:throw new Error("index is out of range: "+e)}},clone:function(){return new this.constructor(this.x,this.y)},copy:function(e){return this.x=e.x,this.y=e.y,this},add:function(e,t){return void 0!==t?(console.warn("THREE.Vector2: .add() now only accepts one argument. Use .addVectors( a, b ) instead."),this.addVectors(e,t)):(this.x+=e.x,this.y+=e.y,this)},addScalar:function(e){return this.x+=e,this.y+=e,this},addVectors:function(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this},addScaledVector:function(e,t){return this.x+=e.x*t,this.y+=e.y*t,this},sub:function(e,t){return void 0!==t?(console.warn("THREE.Vector2: .sub() now only accepts one argument. Use .subVectors( a, b ) instead."),this.subVectors(e,t)):(this.x-=e.x,this.y-=e.y,this)},subScalar:function(e){return this.x-=e,this.y-=e,this},subVectors:function(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this},multiply:function(e){return this.x*=e.x,this.y*=e.y,this},multiplyScalar:function(e){return this.x*=e,this.y*=e,this},divide:function(e){return this.x/=e.x,this.y/=e.y,this},divideScalar:function(e){return this.multiplyScalar(1/e)},applyMatrix3:function(e){var t=this.x,r=this.y,n=e.elements;return this.x=n[0]*t+n[3]*r+n[6],this.y=n[1]*t+n[4]*r+n[7],this},min:function(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this},max:function(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this},clamp:function(e,t){return this.x=Math.max(e.x,Math.min(t.x,this.x)),this.y=Math.max(e.y,Math.min(t.y,this.y)),this},clampScalar:function(e,t){return this.x=Math.max(e,Math.min(t,this.x)),this.y=Math.max(e,Math.min(t,this.y)),this},clampLength:function(e,t){var r=this.length();return this.divideScalar(r||1).multiplyScalar(Math.max(e,Math.min(t,r)))},floor:function(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this},ceil:function(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this},round:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this},roundToZero:function(){return this.x=this.x<0?Math.ceil(this.x):Math.floor(this.x),this.y=this.y<0?Math.ceil(this.y):Math.floor(this.y),this},negate:function(){return this.x=-this.x,this.y=-this.y,this},dot:function(e){return this.x*e.x+this.y*e.y},cross:function(e){return this.x*e.y-this.y*e.x},lengthSq:function(){return this.x*this.x+this.y*this.y},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y)},manhattanLength:function(){return Math.abs(this.x)+Math.abs(this.y)},normalize:function(){return this.divideScalar(this.length()||1)},angle:function(){var e=Math.atan2(this.y,this.x);return e<0&&(e+=2*Math.PI),e},distanceTo:function(e){return Math.sqrt(this.distanceToSquared(e))},distanceToSquared:function(e){var t=this.x-e.x,r=this.y-e.y;return t*t+r*r},manhattanDistanceTo:function(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)},setLength:function(e){return this.normalize().multiplyScalar(e)},lerp:function(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this},lerpVectors:function(e,t,r){return this.subVectors(t,e).multiplyScalar(r).add(e)},equals:function(e){return e.x===this.x&&e.y===this.y},fromArray:function(e,t){return void 0===t&&(t=0),this.x=e[t],this.y=e[t+1],this},toArray:function(e,t){return void 0===e&&(e=[]),void 0===t&&(t=0),e[t]=this.x,e[t+1]=this.y,e},fromBufferAttribute:function(e,t,r){return void 0!==r&&console.warn("THREE.Vector2: offset has been removed from .fromBufferAttribute()."),this.x=e.getX(t),this.y=e.getY(t),this},rotateAround:function(e,t){var r=Math.cos(t),n=Math.sin(t),i=this.x-e.x,a=this.y-e.y;return this.x=i*r-a*n+e.x,this.y=i*n+a*r+e.y,this}}),Object.assign(Sr,{slerp:function(e,t,r,n){return r.copy(e).slerp(t,n)},slerpFlat:function(e,t,r,n,i,a,o){var s=r[n+0],l=r[n+1],c=r[n+2],u=r[n+3],h=i[a+0],d=i[a+1],p=i[a+2],f=i[a+3];if(u!==f||s!==h||l!==d||c!==p){var m=1-o,v=s*h+l*d+c*p+u*f,g=v>=0?1:-1,y=1-v*v;if(y>Number.EPSILON){var x=Math.sqrt(y),b=Math.atan2(x,v*g);m=Math.sin(m*b)/x,o=Math.sin(o*b)/x}var A=o*g;if(s=s*m+h*A,l=l*m+d*A,c=c*m+p*A,u=u*m+f*A,m===1-o){var w=1/Math.sqrt(s*s+l*l+c*c+u*u);s*=w,l*=w,c*=w,u*=w}}e[t]=s,e[t+1]=l,e[t+2]=c,e[t+3]=u}}),Object.defineProperties(Sr.prototype,{x:{get:function(){return this._x},set:function(e){this._x=e,this._onChangeCallback()}},y:{get:function(){return this._y},set:function(e){this._y=e,this._onChangeCallback()}},z:{get:function(){return this._z},set:function(e){this._z=e,this._onChangeCallback()}},w:{get:function(){return this._w},set:function(e){this._w=e,this._onChangeCallback()}}}),Object.assign(Sr.prototype,{isQuaternion:!0,set:function(e,t,r,n){return this._x=e,this._y=t,this._z=r,this._w=n,this._onChangeCallback(),this},clone:function(){return new this.constructor(this._x,this._y,this._z,this._w)},copy:function(e){return this._x=e.x,this._y=e.y,this._z=e.z,this._w=e.w,this._onChangeCallback(),this},setFromEuler:function(e,t){if(!e||!e.isEuler)throw new Error("THREE.Quaternion: .setFromEuler() now expects an Euler rotation rather than a Vector3 and order.");var r=e._x,n=e._y,i=e._z,a=e.order,o=Math.cos,s=Math.sin,l=o(r/2),c=o(n/2),u=o(i/2),h=s(r/2),d=s(n/2),p=s(i/2);return"XYZ"===a?(this._x=h*c*u+l*d*p,this._y=l*d*u-h*c*p,this._z=l*c*p+h*d*u,this._w=l*c*u-h*d*p):"YXZ"===a?(this._x=h*c*u+l*d*p,this._y=l*d*u-h*c*p,this._z=l*c*p-h*d*u,this._w=l*c*u+h*d*p):"ZXY"===a?(this._x=h*c*u-l*d*p,this._y=l*d*u+h*c*p,this._z=l*c*p+h*d*u,this._w=l*c*u-h*d*p):"ZYX"===a?(this._x=h*c*u-l*d*p,this._y=l*d*u+h*c*p,this._z=l*c*p-h*d*u,this._w=l*c*u+h*d*p):"YZX"===a?(this._x=h*c*u+l*d*p,this._y=l*d*u+h*c*p,this._z=l*c*p-h*d*u,this._w=l*c*u-h*d*p):"XZY"===a&&(this._x=h*c*u-l*d*p,this._y=l*d*u-h*c*p,this._z=l*c*p+h*d*u,this._w=l*c*u+h*d*p),!1!==t&&this._onChangeCallback(),this},setFromAxisAngle:function(e,t){var r=t/2,n=Math.sin(r);return this._x=e.x*n,this._y=e.y*n,this._z=e.z*n,this._w=Math.cos(r),this._onChangeCallback(),this},setFromRotationMatrix:function(e){var t,r=e.elements,n=r[0],i=r[4],a=r[8],o=r[1],s=r[5],l=r[9],c=r[2],u=r[6],h=r[10],d=n+s+h;return d>0?(t=.5/Math.sqrt(d+1),this._w=.25/t,this._x=(u-l)*t,this._y=(a-c)*t,this._z=(o-i)*t):n>s&&n>h?(t=2*Math.sqrt(1+n-s-h),this._w=(u-l)/t,this._x=.25*t,this._y=(i+o)/t,this._z=(a+c)/t):s>h?(t=2*Math.sqrt(1+s-n-h),this._w=(a-c)/t,this._x=(i+o)/t,this._y=.25*t,this._z=(l+u)/t):(t=2*Math.sqrt(1+h-n-s),this._w=(o-i)/t,this._x=(a+c)/t,this._y=(l+u)/t,this._z=.25*t),this._onChangeCallback(),this},setFromUnitVectors:function(e,t){var r=e.dot(t)+1;return r<1e-6?(r=0,Math.abs(e.x)>Math.abs(e.z)?(this._x=-e.y,this._y=e.x,this._z=0,this._w=r):(this._x=0,this._y=-e.z,this._z=e.y,this._w=r)):(this._x=e.y*t.z-e.z*t.y,this._y=e.z*t.x-e.x*t.z,this._z=e.x*t.y-e.y*t.x,this._w=r),this.normalize()},angleTo:function(e){return 2*Math.acos(Math.abs(_r.clamp(this.dot(e),-1,1)))},rotateTowards:function(e,t){var r=this.angleTo(e);if(0===r)return this;var n=Math.min(1,t/r);return this.slerp(e,n),this},inverse:function(){return this.conjugate()},conjugate:function(){return this._x*=-1,this._y*=-1,this._z*=-1,this._onChangeCallback(),this},dot:function(e){return this._x*e._x+this._y*e._y+this._z*e._z+this._w*e._w},lengthSq:function(){return this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w},length:function(){return Math.sqrt(this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w)},normalize:function(){var e=this.length();return 0===e?(this._x=0,this._y=0,this._z=0,this._w=1):(e=1/e,this._x=this._x*e,this._y=this._y*e,this._z=this._z*e,this._w=this._w*e),this._onChangeCallback(),this},multiply:function(e,t){return void 0!==t?(console.warn("THREE.Quaternion: .multiply() now only accepts one argument. Use .multiplyQuaternions( a, b ) instead."),this.multiplyQuaternions(e,t)):this.multiplyQuaternions(this,e)},premultiply:function(e){return this.multiplyQuaternions(e,this)},multiplyQuaternions:function(e,t){var r=e._x,n=e._y,i=e._z,a=e._w,o=t._x,s=t._y,l=t._z,c=t._w;return this._x=r*c+a*o+n*l-i*s,this._y=n*c+a*s+i*o-r*l,this._z=i*c+a*l+r*s-n*o,this._w=a*c-r*o-n*s-i*l,this._onChangeCallback(),this},slerp:function(e,t){if(0===t)return this;if(1===t)return this.copy(e);var r=this._x,n=this._y,i=this._z,a=this._w,o=a*e._w+r*e._x+n*e._y+i*e._z;if(o<0?(this._w=-e._w,this._x=-e._x,this._y=-e._y,this._z=-e._z,o=-o):this.copy(e),o>=1)return this._w=a,this._x=r,this._y=n,this._z=i,this;var s=1-o*o;if(s<=Number.EPSILON){var l=1-t;return this._w=l*a+t*this._w,this._x=l*r+t*this._x,this._y=l*n+t*this._y,this._z=l*i+t*this._z,this.normalize(),this._onChangeCallback(),this}var c=Math.sqrt(s),u=Math.atan2(c,o),h=Math.sin((1-t)*u)/c,d=Math.sin(t*u)/c;return this._w=a*h+this._w*d,this._x=r*h+this._x*d,this._y=n*h+this._y*d,this._z=i*h+this._z*d,this._onChangeCallback(),this},equals:function(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._w===this._w},fromArray:function(e,t){return void 0===t&&(t=0),this._x=e[t],this._y=e[t+1],this._z=e[t+2],this._w=e[t+3],this._onChangeCallback(),this},toArray:function(e,t){return void 0===e&&(e=[]),void 0===t&&(t=0),e[t]=this._x,e[t+1]=this._y,e[t+2]=this._z,e[t+3]=this._w,e},_onChange:function(e){return this._onChangeCallback=e,this},_onChangeCallback:function(){}});var Er=new Rr,Tr=new Sr;function Rr(e,t,r){this.x=e||0,this.y=t||0,this.z=r||0}Object.assign(Rr.prototype,{isVector3:!0,set:function(e,t,r){return this.x=e,this.y=t,this.z=r,this},setScalar:function(e){return this.x=e,this.y=e,this.z=e,this},setX:function(e){return this.x=e,this},setY:function(e){return this.y=e,this},setZ:function(e){return this.z=e,this},setComponent:function(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;case 2:this.z=t;break;default:throw new Error("index is out of range: "+e)}return this},getComponent:function(e){switch(e){case 0:return this.x;case 1:return this.y;case 2:return this.z;default:throw new Error("index is out of range: "+e)}},clone:function(){return new this.constructor(this.x,this.y,this.z)},copy:function(e){return this.x=e.x,this.y=e.y,this.z=e.z,this},add:function(e,t){return void 0!==t?(console.warn("THREE.Vector3: .add() now only accepts one argument. Use .addVectors( a, b ) instead."),this.addVectors(e,t)):(this.x+=e.x,this.y+=e.y,this.z+=e.z,this)},addScalar:function(e){return this.x+=e,this.y+=e,this.z+=e,this},addVectors:function(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this.z=e.z+t.z,this},addScaledVector:function(e,t){return this.x+=e.x*t,this.y+=e.y*t,this.z+=e.z*t,this},sub:function(e,t){return void 0!==t?(console.warn("THREE.Vector3: .sub() now only accepts one argument. Use .subVectors( a, b ) instead."),this.subVectors(e,t)):(this.x-=e.x,this.y-=e.y,this.z-=e.z,this)},subScalar:function(e){return this.x-=e,this.y-=e,this.z-=e,this},subVectors:function(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this.z=e.z-t.z,this},multiply:function(e,t){return void 0!==t?(console.warn("THREE.Vector3: .multiply() now only accepts one argument. Use .multiplyVectors( a, b ) instead."),this.multiplyVectors(e,t)):(this.x*=e.x,this.y*=e.y,this.z*=e.z,this)},multiplyScalar:function(e){return this.x*=e,this.y*=e,this.z*=e,this},multiplyVectors:function(e,t){return this.x=e.x*t.x,this.y=e.y*t.y,this.z=e.z*t.z,this},applyEuler:function(e){return e&&e.isEuler||console.error("THREE.Vector3: .applyEuler() now expects an Euler rotation rather than a Vector3 and order."),this.applyQuaternion(Tr.setFromEuler(e))},applyAxisAngle:function(e,t){return this.applyQuaternion(Tr.setFromAxisAngle(e,t))},applyMatrix3:function(e){var t=this.x,r=this.y,n=this.z,i=e.elements;return this.x=i[0]*t+i[3]*r+i[6]*n,this.y=i[1]*t+i[4]*r+i[7]*n,this.z=i[2]*t+i[5]*r+i[8]*n,this},applyNormalMatrix:function(e){return this.applyMatrix3(e).normalize()},applyMatrix4:function(e){var t=this.x,r=this.y,n=this.z,i=e.elements,a=1/(i[3]*t+i[7]*r+i[11]*n+i[15]);return this.x=(i[0]*t+i[4]*r+i[8]*n+i[12])*a,this.y=(i[1]*t+i[5]*r+i[9]*n+i[13])*a,this.z=(i[2]*t+i[6]*r+i[10]*n+i[14])*a,this},applyQuaternion:function(e){var t=this.x,r=this.y,n=this.z,i=e.x,a=e.y,o=e.z,s=e.w,l=s*t+a*n-o*r,c=s*r+o*t-i*n,u=s*n+i*r-a*t,h=-i*t-a*r-o*n;return this.x=l*s+h*-i+c*-o-u*-a,this.y=c*s+h*-a+u*-i-l*-o,this.z=u*s+h*-o+l*-a-c*-i,this},project:function(e){return this.applyMatrix4(e.matrixWorldInverse).applyMatrix4(e.projectionMatrix)},unproject:function(e){return this.applyMatrix4(e.projectionMatrixInverse).applyMatrix4(e.matrixWorld)},transformDirection:function(e){var t=this.x,r=this.y,n=this.z,i=e.elements;return this.x=i[0]*t+i[4]*r+i[8]*n,this.y=i[1]*t+i[5]*r+i[9]*n,this.z=i[2]*t+i[6]*r+i[10]*n,this.normalize()},divide:function(e){return this.x/=e.x,this.y/=e.y,this.z/=e.z,this},divideScalar:function(e){return this.multiplyScalar(1/e)},min:function(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this.z=Math.min(this.z,e.z),this},max:function(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this.z=Math.max(this.z,e.z),this},clamp:function(e,t){return this.x=Math.max(e.x,Math.min(t.x,this.x)),this.y=Math.max(e.y,Math.min(t.y,this.y)),this.z=Math.max(e.z,Math.min(t.z,this.z)),this},clampScalar:function(e,t){return this.x=Math.max(e,Math.min(t,this.x)),this.y=Math.max(e,Math.min(t,this.y)),this.z=Math.max(e,Math.min(t,this.z)),this},clampLength:function(e,t){var r=this.length();return this.divideScalar(r||1).multiplyScalar(Math.max(e,Math.min(t,r)))},floor:function(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this},ceil:function(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this},round:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this},roundToZero:function(){return this.x=this.x<0?Math.ceil(this.x):Math.floor(this.x),this.y=this.y<0?Math.ceil(this.y):Math.floor(this.y),this.z=this.z<0?Math.ceil(this.z):Math.floor(this.z),this},negate:function(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this},dot:function(e){return this.x*e.x+this.y*e.y+this.z*e.z},lengthSq:function(){return this.x*this.x+this.y*this.y+this.z*this.z},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)},manhattanLength:function(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)},normalize:function(){return this.divideScalar(this.length()||1)},setLength:function(e){return this.normalize().multiplyScalar(e)},lerp:function(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this.z+=(e.z-this.z)*t,this},lerpVectors:function(e,t,r){return this.subVectors(t,e).multiplyScalar(r).add(e)},cross:function(e,t){return void 0!==t?(console.warn("THREE.Vector3: .cross() now only accepts one argument. Use .crossVectors( a, b ) instead."),this.crossVectors(e,t)):this.crossVectors(this,e)},crossVectors:function(e,t){var r=e.x,n=e.y,i=e.z,a=t.x,o=t.y,s=t.z;return this.x=n*s-i*o,this.y=i*a-r*s,this.z=r*o-n*a,this},projectOnVector:function(e){var t=e.dot(this)/e.lengthSq();return this.copy(e).multiplyScalar(t)},projectOnPlane:function(e){return Er.copy(this).projectOnVector(e),this.sub(Er)},reflect:function(e){return this.sub(Er.copy(e).multiplyScalar(2*this.dot(e)))},angleTo:function(e){var t=Math.sqrt(this.lengthSq()*e.lengthSq());0===t&&console.error("THREE.Vector3: angleTo() can't handle zero length vectors.");var r=this.dot(e)/t;return Math.acos(_r.clamp(r,-1,1))},distanceTo:function(e){return Math.sqrt(this.distanceToSquared(e))},distanceToSquared:function(e){var t=this.x-e.x,r=this.y-e.y,n=this.z-e.z;return t*t+r*r+n*n},manhattanDistanceTo:function(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)+Math.abs(this.z-e.z)},setFromSpherical:function(e){return this.setFromSphericalCoords(e.radius,e.phi,e.theta)},setFromSphericalCoords:function(e,t,r){var n=Math.sin(t)*e;return this.x=n*Math.sin(r),this.y=Math.cos(t)*e,this.z=n*Math.cos(r),this},setFromCylindrical:function(e){return this.setFromCylindricalCoords(e.radius,e.theta,e.y)},setFromCylindricalCoords:function(e,t,r){return this.x=e*Math.sin(t),this.y=r,this.z=e*Math.cos(t),this},setFromMatrixPosition:function(e){var t=e.elements;return this.x=t[12],this.y=t[13],this.z=t[14],this},setFromMatrixScale:function(e){var t=this.setFromMatrixColumn(e,0).length(),r=this.setFromMatrixColumn(e,1).length(),n=this.setFromMatrixColumn(e,2).length();return this.x=t,this.y=r,this.z=n,this},setFromMatrixColumn:function(e,t){return this.fromArray(e.elements,4*t)},equals:function(e){return e.x===this.x&&e.y===this.y&&e.z===this.z},fromArray:function(e,t){return void 0===t&&(t=0),this.x=e[t],this.y=e[t+1],this.z=e[t+2],this},toArray:function(e,t){return void 0===e&&(e=[]),void 0===t&&(t=0),e[t]=this.x,e[t+1]=this.y,e[t+2]=this.z,e},fromBufferAttribute:function(e,t,r){return void 0!==r&&console.warn("THREE.Vector3: offset has been removed from .fromBufferAttribute()."),this.x=e.getX(t),this.y=e.getY(t),this.z=e.getZ(t),this}});var Lr,Cr=new Rr;function Pr(){this.elements=[1,0,0,0,1,0,0,0,1],arguments.length>0&&console.error("THREE.Matrix3: the constructor no longer reads arguments. use .set() instead.")}Object.assign(Pr.prototype,{isMatrix3:!0,set:function(e,t,r,n,i,a,o,s,l){var c=this.elements;return c[0]=e,c[1]=n,c[2]=o,c[3]=t,c[4]=i,c[5]=s,c[6]=r,c[7]=a,c[8]=l,this},identity:function(){return this.set(1,0,0,0,1,0,0,0,1),this},clone:function(){return(new this.constructor).fromArray(this.elements)},copy:function(e){var t=this.elements,r=e.elements;return t[0]=r[0],t[1]=r[1],t[2]=r[2],t[3]=r[3],t[4]=r[4],t[5]=r[5],t[6]=r[6],t[7]=r[7],t[8]=r[8],this},setFromMatrix4:function(e){var t=e.elements;return this.set(t[0],t[4],t[8],t[1],t[5],t[9],t[2],t[6],t[10]),this},applyToBufferAttribute:function(e){for(var t=0,r=e.count;t<r;t++)Cr.x=e.getX(t),Cr.y=e.getY(t),Cr.z=e.getZ(t),Cr.applyMatrix3(this),e.setXYZ(t,Cr.x,Cr.y,Cr.z);return e},multiply:function(e){return this.multiplyMatrices(this,e)},premultiply:function(e){return this.multiplyMatrices(e,this)},multiplyMatrices:function(e,t){var r=e.elements,n=t.elements,i=this.elements,a=r[0],o=r[3],s=r[6],l=r[1],c=r[4],u=r[7],h=r[2],d=r[5],p=r[8],f=n[0],m=n[3],v=n[6],g=n[1],y=n[4],x=n[7],b=n[2],A=n[5],w=n[8];return i[0]=a*f+o*g+s*b,i[3]=a*m+o*y+s*A,i[6]=a*v+o*x+s*w,i[1]=l*f+c*g+u*b,i[4]=l*m+c*y+u*A,i[7]=l*v+c*x+u*w,i[2]=h*f+d*g+p*b,i[5]=h*m+d*y+p*A,i[8]=h*v+d*x+p*w,this},multiplyScalar:function(e){var t=this.elements;return t[0]*=e,t[3]*=e,t[6]*=e,t[1]*=e,t[4]*=e,t[7]*=e,t[2]*=e,t[5]*=e,t[8]*=e,this},determinant:function(){var e=this.elements,t=e[0],r=e[1],n=e[2],i=e[3],a=e[4],o=e[5],s=e[6],l=e[7],c=e[8];return t*a*c-t*o*l-r*i*c+r*o*s+n*i*l-n*a*s},getInverse:function(e,t){e&&e.isMatrix4&&console.error("THREE.Matrix3: .getInverse() no longer takes a Matrix4 argument.");var r=e.elements,n=this.elements,i=r[0],a=r[1],o=r[2],s=r[3],l=r[4],c=r[5],u=r[6],h=r[7],d=r[8],p=d*l-c*h,f=c*u-d*s,m=h*s-l*u,v=i*p+a*f+o*m;if(0===v){var g="THREE.Matrix3: .getInverse() can't invert matrix, determinant is 0";if(!0===t)throw new Error(g);return console.warn(g),this.identity()}var y=1/v;return n[0]=p*y,n[1]=(o*h-d*a)*y,n[2]=(c*a-o*l)*y,n[3]=f*y,n[4]=(d*i-o*u)*y,n[5]=(o*s-c*i)*y,n[6]=m*y,n[7]=(a*u-h*i)*y,n[8]=(l*i-a*s)*y,this},transpose:function(){var e,t=this.elements;return e=t[1],t[1]=t[3],t[3]=e,e=t[2],t[2]=t[6],t[6]=e,e=t[5],t[5]=t[7],t[7]=e,this},getNormalMatrix:function(e){return this.setFromMatrix4(e).getInverse(this).transpose()},transposeIntoArray:function(e){var t=this.elements;return e[0]=t[0],e[1]=t[3],e[2]=t[6],e[3]=t[1],e[4]=t[4],e[5]=t[7],e[6]=t[2],e[7]=t[5],e[8]=t[8],this},setUvTransform:function(e,t,r,n,i,a,o){var s=Math.cos(i),l=Math.sin(i);this.set(r*s,r*l,-r*(s*a+l*o)+a+e,-n*l,n*s,-n*(-l*a+s*o)+o+t,0,0,1)},scale:function(e,t){var r=this.elements;return r[0]*=e,r[3]*=e,r[6]*=e,r[1]*=t,r[4]*=t,r[7]*=t,this},rotate:function(e){var t=Math.cos(e),r=Math.sin(e),n=this.elements,i=n[0],a=n[3],o=n[6],s=n[1],l=n[4],c=n[7];return n[0]=t*i+r*s,n[3]=t*a+r*l,n[6]=t*o+r*c,n[1]=-r*i+t*s,n[4]=-r*a+t*l,n[7]=-r*o+t*c,this},translate:function(e,t){var r=this.elements;return r[0]+=e*r[2],r[3]+=e*r[5],r[6]+=e*r[8],r[1]+=t*r[2],r[4]+=t*r[5],r[7]+=t*r[8],this},equals:function(e){for(var t=this.elements,r=e.elements,n=0;n<9;n++)if(t[n]!==r[n])return!1;return!0},fromArray:function(e,t){void 0===t&&(t=0);for(var r=0;r<9;r++)this.elements[r]=e[r+t];return this},toArray:function(e,t){void 0===e&&(e=[]),void 0===t&&(t=0);var r=this.elements;return e[t]=r[0],e[t+1]=r[1],e[t+2]=r[2],e[t+3]=r[3],e[t+4]=r[4],e[t+5]=r[5],e[t+6]=r[6],e[t+7]=r[7],e[t+8]=r[8],e}});var Dr={getDataURL:function(e){var t;if("undefined"==typeof HTMLCanvasElement)return e.src;if(e instanceof HTMLCanvasElement)t=e;else{void 0===Lr&&(Lr=document.createElementNS("http://www.w3.org/1999/xhtml","canvas")),Lr.width=e.width,Lr.height=e.height;var r=Lr.getContext("2d");e instanceof ImageData?r.putImageData(e,0,0):r.drawImage(e,0,0,e.width,e.height),t=Lr}return t.width>2048||t.height>2048?t.toDataURL("image/jpeg",.6):t.toDataURL("image/png")}},Ir=0;function Or(e,t,r,n,i,a,o,s,l,c){Object.defineProperty(this,"id",{value:Ir++}),this.uuid=_r.generateUUID(),this.name="",this.image=void 0!==e?e:Or.DEFAULT_IMAGE,this.mipmaps=[],this.mapping=void 0!==t?t:Or.DEFAULT_MAPPING,this.wrapS=void 0!==r?r:ye,this.wrapT=void 0!==n?n:ye,this.magFilter=void 0!==i?i:Se,this.minFilter=void 0!==a?a:Re,this.anisotropy=void 0!==l?l:1,this.format=void 0!==o?o:je,this.internalFormat=null,this.type=void 0!==s?s:Ce,this.offset=new Mr(0,0),this.repeat=new Mr(1,1),this.center=new Mr(0,0),this.rotation=0,this.matrixAutoUpdate=!0,this.matrix=new Pr,this.generateMipmaps=!0,this.premultiplyAlpha=!1,this.flipY=!0,this.unpackAlignment=4,this.encoding=void 0!==c?c:Ut,this.version=0,this.onUpdate=null}function Br(e,t,r,n){this.x=e||0,this.y=t||0,this.z=r||0,this.w=void 0!==n?n:1}function Fr(e,t,r){this.width=e,this.height=t,this.scissor=new Br(0,0,e,t),this.scissorTest=!1,this.viewport=new Br(0,0,e,t),r=r||{},this.texture=new Or(void 0,void 0,r.wrapS,r.wrapT,r.magFilter,r.minFilter,r.format,r.type,r.anisotropy,r.encoding),this.texture.image={},this.texture.image.width=e,this.texture.image.height=t,this.texture.generateMipmaps=void 0!==r.generateMipmaps&&r.generateMipmaps,this.texture.minFilter=void 0!==r.minFilter?r.minFilter:Se,this.depthBuffer=void 0===r.depthBuffer||r.depthBuffer,this.stencilBuffer=void 0===r.stencilBuffer||r.stencilBuffer,this.depthTexture=void 0!==r.depthTexture?r.depthTexture:null}function Ur(e,t,r){Fr.call(this,e,t,r),this.samples=4}Or.DEFAULT_IMAGE=void 0,Or.DEFAULT_MAPPING=ce,Or.prototype=Object.assign(Object.create(br.prototype),{constructor:Or,isTexture:!0,updateMatrix:function(){this.matrix.setUvTransform(this.offset.x,this.offset.y,this.repeat.x,this.repeat.y,this.rotation,this.center.x,this.center.y)},clone:function(){return(new this.constructor).copy(this)},copy:function(e){return this.name=e.name,this.image=e.image,this.mipmaps=e.mipmaps.slice(0),this.mapping=e.mapping,this.wrapS=e.wrapS,this.wrapT=e.wrapT,this.magFilter=e.magFilter,this.minFilter=e.minFilter,this.anisotropy=e.anisotropy,this.format=e.format,this.internalFormat=e.internalFormat,this.type=e.type,this.offset.copy(e.offset),this.repeat.copy(e.repeat),this.center.copy(e.center),this.rotation=e.rotation,this.matrixAutoUpdate=e.matrixAutoUpdate,this.matrix.copy(e.matrix),this.generateMipmaps=e.generateMipmaps,this.premultiplyAlpha=e.premultiplyAlpha,this.flipY=e.flipY,this.unpackAlignment=e.unpackAlignment,this.encoding=e.encoding,this},toJSON:function(e){var t=void 0===e||"string"==typeof e;if(!t&&void 0!==e.textures[this.uuid])return e.textures[this.uuid];var r={metadata:{version:4.5,type:"Texture",generator:"Texture.toJSON"},uuid:this.uuid,name:this.name,mapping:this.mapping,repeat:[this.repeat.x,this.repeat.y],offset:[this.offset.x,this.offset.y],center:[this.center.x,this.center.y],rotation:this.rotation,wrap:[this.wrapS,this.wrapT],format:this.format,type:this.type,encoding:this.encoding,minFilter:this.minFilter,magFilter:this.magFilter,anisotropy:this.anisotropy,flipY:this.flipY,premultiplyAlpha:this.premultiplyAlpha,unpackAlignment:this.unpackAlignment};if(void 0!==this.image){var n=this.image;if(void 0===n.uuid&&(n.uuid=_r.generateUUID()),!t&&void 0===e.images[n.uuid]){var i;if(Array.isArray(n)){i=[];for(var a=0,o=n.length;a<o;a++)i.push(Dr.getDataURL(n[a]))}else i=Dr.getDataURL(n);e.images[n.uuid]={uuid:n.uuid,url:i}}r.image=n.uuid}return t||(e.textures[this.uuid]=r),r},dispose:function(){this.dispatchEvent({type:"dispose"})},transformUv:function(e){if(this.mapping!==ce)return e;if(e.applyMatrix3(this.matrix),e.x<0||e.x>1)switch(this.wrapS){case ge:e.x=e.x-Math.floor(e.x);break;case ye:e.x=e.x<0?0:1;break;case xe:1===Math.abs(Math.floor(e.x)%2)?e.x=Math.ceil(e.x)-e.x:e.x=e.x-Math.floor(e.x)}if(e.y<0||e.y>1)switch(this.wrapT){case ge:e.y=e.y-Math.floor(e.y);break;case ye:e.y=e.y<0?0:1;break;case xe:1===Math.abs(Math.floor(e.y)%2)?e.y=Math.ceil(e.y)-e.y:e.y=e.y-Math.floor(e.y)}return this.flipY&&(e.y=1-e.y),e}}),Object.defineProperty(Or.prototype,"needsUpdate",{set:function(e){!0===e&&this.version++}}),Object.defineProperties(Br.prototype,{width:{get:function(){return this.z},set:function(e){this.z=e}},height:{get:function(){return this.w},set:function(e){this.w=e}}}),Object.assign(Br.prototype,{isVector4:!0,set:function(e,t,r,n){return this.x=e,this.y=t,this.z=r,this.w=n,this},setScalar:function(e){return this.x=e,this.y=e,this.z=e,this.w=e,this},setX:function(e){return this.x=e,this},setY:function(e){return this.y=e,this},setZ:function(e){return this.z=e,this},setW:function(e){return this.w=e,this},setComponent:function(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;case 2:this.z=t;break;case 3:this.w=t;break;default:throw new Error("index is out of range: "+e)}return this},getComponent:function(e){switch(e){case 0:return this.x;case 1:return this.y;case 2:return this.z;case 3:return this.w;default:throw new Error("index is out of range: "+e)}},clone:function(){return new this.constructor(this.x,this.y,this.z,this.w)},copy:function(e){return this.x=e.x,this.y=e.y,this.z=e.z,this.w=void 0!==e.w?e.w:1,this},add:function(e,t){return void 0!==t?(console.warn("THREE.Vector4: .add() now only accepts one argument. Use .addVectors( a, b ) instead."),this.addVectors(e,t)):(this.x+=e.x,this.y+=e.y,this.z+=e.z,this.w+=e.w,this)},addScalar:function(e){return this.x+=e,this.y+=e,this.z+=e,this.w+=e,this},addVectors:function(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this.z=e.z+t.z,this.w=e.w+t.w,this},addScaledVector:function(e,t){return this.x+=e.x*t,this.y+=e.y*t,this.z+=e.z*t,this.w+=e.w*t,this},sub:function(e,t){return void 0!==t?(console.warn("THREE.Vector4: .sub() now only accepts one argument. Use .subVectors( a, b ) instead."),this.subVectors(e,t)):(this.x-=e.x,this.y-=e.y,this.z-=e.z,this.w-=e.w,this)},subScalar:function(e){return this.x-=e,this.y-=e,this.z-=e,this.w-=e,this},subVectors:function(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this.z=e.z-t.z,this.w=e.w-t.w,this},multiplyScalar:function(e){return this.x*=e,this.y*=e,this.z*=e,this.w*=e,this},applyMatrix4:function(e){var t=this.x,r=this.y,n=this.z,i=this.w,a=e.elements;return this.x=a[0]*t+a[4]*r+a[8]*n+a[12]*i,this.y=a[1]*t+a[5]*r+a[9]*n+a[13]*i,this.z=a[2]*t+a[6]*r+a[10]*n+a[14]*i,this.w=a[3]*t+a[7]*r+a[11]*n+a[15]*i,this},divideScalar:function(e){return this.multiplyScalar(1/e)},setAxisAngleFromQuaternion:function(e){this.w=2*Math.acos(e.w);var t=Math.sqrt(1-e.w*e.w);return t<1e-4?(this.x=1,this.y=0,this.z=0):(this.x=e.x/t,this.y=e.y/t,this.z=e.z/t),this},setAxisAngleFromRotationMatrix:function(e){var t,r,n,i,a=e.elements,o=a[0],s=a[4],l=a[8],c=a[1],u=a[5],h=a[9],d=a[2],p=a[6],f=a[10];if(Math.abs(s-c)<.01&&Math.abs(l-d)<.01&&Math.abs(h-p)<.01){if(Math.abs(s+c)<.1&&Math.abs(l+d)<.1&&Math.abs(h+p)<.1&&Math.abs(o+u+f-3)<.1)return this.set(1,0,0,0),this;t=Math.PI;var m=(o+1)/2,v=(u+1)/2,g=(f+1)/2,y=(s+c)/4,x=(l+d)/4,b=(h+p)/4;return m>v&&m>g?m<.01?(r=0,n=.707106781,i=.707106781):(n=y/(r=Math.sqrt(m)),i=x/r):v>g?v<.01?(r=.707106781,n=0,i=.707106781):(r=y/(n=Math.sqrt(v)),i=b/n):g<.01?(r=.707106781,n=.707106781,i=0):(r=x/(i=Math.sqrt(g)),n=b/i),this.set(r,n,i,t),this}var A=Math.sqrt((p-h)*(p-h)+(l-d)*(l-d)+(c-s)*(c-s));return Math.abs(A)<.001&&(A=1),this.x=(p-h)/A,this.y=(l-d)/A,this.z=(c-s)/A,this.w=Math.acos((o+u+f-1)/2),this},min:function(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this.z=Math.min(this.z,e.z),this.w=Math.min(this.w,e.w),this},max:function(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this.z=Math.max(this.z,e.z),this.w=Math.max(this.w,e.w),this},clamp:function(e,t){return this.x=Math.max(e.x,Math.min(t.x,this.x)),this.y=Math.max(e.y,Math.min(t.y,this.y)),this.z=Math.max(e.z,Math.min(t.z,this.z)),this.w=Math.max(e.w,Math.min(t.w,this.w)),this},clampScalar:function(e,t){return this.x=Math.max(e,Math.min(t,this.x)),this.y=Math.max(e,Math.min(t,this.y)),this.z=Math.max(e,Math.min(t,this.z)),this.w=Math.max(e,Math.min(t,this.w)),this},clampLength:function(e,t){var r=this.length();return this.divideScalar(r||1).multiplyScalar(Math.max(e,Math.min(t,r)))},floor:function(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this.w=Math.floor(this.w),this},ceil:function(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this.w=Math.ceil(this.w),this},round:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this.w=Math.round(this.w),this},roundToZero:function(){return this.x=this.x<0?Math.ceil(this.x):Math.floor(this.x),this.y=this.y<0?Math.ceil(this.y):Math.floor(this.y),this.z=this.z<0?Math.ceil(this.z):Math.floor(this.z),this.w=this.w<0?Math.ceil(this.w):Math.floor(this.w),this},negate:function(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this.w=-this.w,this},dot:function(e){return this.x*e.x+this.y*e.y+this.z*e.z+this.w*e.w},lengthSq:function(){return this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)},manhattanLength:function(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)+Math.abs(this.w)},normalize:function(){return this.divideScalar(this.length()||1)},setLength:function(e){return this.normalize().multiplyScalar(e)},lerp:function(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this.z+=(e.z-this.z)*t,this.w+=(e.w-this.w)*t,this},lerpVectors:function(e,t,r){return this.subVectors(t,e).multiplyScalar(r).add(e)},equals:function(e){return e.x===this.x&&e.y===this.y&&e.z===this.z&&e.w===this.w},fromArray:function(e,t){return void 0===t&&(t=0),this.x=e[t],this.y=e[t+1],this.z=e[t+2],this.w=e[t+3],this},toArray:function(e,t){return void 0===e&&(e=[]),void 0===t&&(t=0),e[t]=this.x,e[t+1]=this.y,e[t+2]=this.z,e[t+3]=this.w,e},fromBufferAttribute:function(e,t,r){return void 0!==r&&console.warn("THREE.Vector4: offset has been removed from .fromBufferAttribute()."),this.x=e.getX(t),this.y=e.getY(t),this.z=e.getZ(t),this.w=e.getW(t),this}}),Fr.prototype=Object.assign(Object.create(br.prototype),{constructor:Fr,isWebGLRenderTarget:!0,setSize:function(e,t){this.width===e&&this.height===t||(this.width=e,this.height=t,this.texture.image.width=e,this.texture.image.height=t,this.dispose()),this.viewport.set(0,0,e,t),this.scissor.set(0,0,e,t)},clone:function(){return(new this.constructor).copy(this)},copy:function(e){return this.width=e.width,this.height=e.height,this.viewport.copy(e.viewport),this.texture=e.texture.clone(),this.depthBuffer=e.depthBuffer,this.stencilBuffer=e.stencilBuffer,this.depthTexture=e.depthTexture,this},dispose:function(){this.dispatchEvent({type:"dispose"})}}),Ur.prototype=Object.assign(Object.create(Fr.prototype),{constructor:Ur,isWebGLMultisampleRenderTarget:!0,copy:function(e){return Fr.prototype.copy.call(this,e),this.samples=e.samples,this}});var Nr=new Rr,Gr=new Wr,zr=new Rr(0,0,0),kr=new Rr(1,1,1),Hr=new Rr,Vr=new Rr,jr=new Rr;function Wr(){this.elements=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],arguments.length>0&&console.error("THREE.Matrix4: the constructor no longer reads arguments. use .set() instead.")}Object.assign(Wr.prototype,{isMatrix4:!0,set:function(e,t,r,n,i,a,o,s,l,c,u,h,d,p,f,m){var v=this.elements;return v[0]=e,v[4]=t,v[8]=r,v[12]=n,v[1]=i,v[5]=a,v[9]=o,v[13]=s,v[2]=l,v[6]=c,v[10]=u,v[14]=h,v[3]=d,v[7]=p,v[11]=f,v[15]=m,this},identity:function(){return this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1),this},clone:function(){return(new Wr).fromArray(this.elements)},copy:function(e){var t=this.elements,r=e.elements;return t[0]=r[0],t[1]=r[1],t[2]=r[2],t[3]=r[3],t[4]=r[4],t[5]=r[5],t[6]=r[6],t[7]=r[7],t[8]=r[8],t[9]=r[9],t[10]=r[10],t[11]=r[11],t[12]=r[12],t[13]=r[13],t[14]=r[14],t[15]=r[15],this},copyPosition:function(e){var t=this.elements,r=e.elements;return t[12]=r[12],t[13]=r[13],t[14]=r[14],this},extractBasis:function(e,t,r){return e.setFromMatrixColumn(this,0),t.setFromMatrixColumn(this,1),r.setFromMatrixColumn(this,2),this},makeBasis:function(e,t,r){return this.set(e.x,t.x,r.x,0,e.y,t.y,r.y,0,e.z,t.z,r.z,0,0,0,0,1),this},extractRotation:function(e){var t=this.elements,r=e.elements,n=1/Nr.setFromMatrixColumn(e,0).length(),i=1/Nr.setFromMatrixColumn(e,1).length(),a=1/Nr.setFromMatrixColumn(e,2).length();return t[0]=r[0]*n,t[1]=r[1]*n,t[2]=r[2]*n,t[3]=0,t[4]=r[4]*i,t[5]=r[5]*i,t[6]=r[6]*i,t[7]=0,t[8]=r[8]*a,t[9]=r[9]*a,t[10]=r[10]*a,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this},makeRotationFromEuler:function(e){e&&e.isEuler||console.error("THREE.Matrix4: .makeRotationFromEuler() now expects a Euler rotation rather than a Vector3 and order.");var t=this.elements,r=e.x,n=e.y,i=e.z,a=Math.cos(r),o=Math.sin(r),s=Math.cos(n),l=Math.sin(n),c=Math.cos(i),u=Math.sin(i);if("XYZ"===e.order){var h=a*c,d=a*u,p=o*c,f=o*u;t[0]=s*c,t[4]=-s*u,t[8]=l,t[1]=d+p*l,t[5]=h-f*l,t[9]=-o*s,t[2]=f-h*l,t[6]=p+d*l,t[10]=a*s}else if("YXZ"===e.order){var m=s*c,v=s*u,g=l*c,y=l*u;t[0]=m+y*o,t[4]=g*o-v,t[8]=a*l,t[1]=a*u,t[5]=a*c,t[9]=-o,t[2]=v*o-g,t[6]=y+m*o,t[10]=a*s}else if("ZXY"===e.order){m=s*c,v=s*u,g=l*c,y=l*u;t[0]=m-y*o,t[4]=-a*u,t[8]=g+v*o,t[1]=v+g*o,t[5]=a*c,t[9]=y-m*o,t[2]=-a*l,t[6]=o,t[10]=a*s}else if("ZYX"===e.order){h=a*c,d=a*u,p=o*c,f=o*u;t[0]=s*c,t[4]=p*l-d,t[8]=h*l+f,t[1]=s*u,t[5]=f*l+h,t[9]=d*l-p,t[2]=-l,t[6]=o*s,t[10]=a*s}else if("YZX"===e.order){var x=a*s,b=a*l,A=o*s,w=o*l;t[0]=s*c,t[4]=w-x*u,t[8]=A*u+b,t[1]=u,t[5]=a*c,t[9]=-o*c,t[2]=-l*c,t[6]=b*u+A,t[10]=x-w*u}else if("XZY"===e.order){x=a*s,b=a*l,A=o*s,w=o*l;t[0]=s*c,t[4]=-u,t[8]=l*c,t[1]=x*u+w,t[5]=a*c,t[9]=b*u-A,t[2]=A*u-b,t[6]=o*c,t[10]=w*u+x}return t[3]=0,t[7]=0,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this},makeRotationFromQuaternion:function(e){return this.compose(zr,e,kr)},lookAt:function(e,t,r){var n=this.elements;return jr.subVectors(e,t),0===jr.lengthSq()&&(jr.z=1),jr.normalize(),Hr.crossVectors(r,jr),0===Hr.lengthSq()&&(1===Math.abs(r.z)?jr.x+=1e-4:jr.z+=1e-4,jr.normalize(),Hr.crossVectors(r,jr)),Hr.normalize(),Vr.crossVectors(jr,Hr),n[0]=Hr.x,n[4]=Vr.x,n[8]=jr.x,n[1]=Hr.y,n[5]=Vr.y,n[9]=jr.y,n[2]=Hr.z,n[6]=Vr.z,n[10]=jr.z,this},multiply:function(e,t){return void 0!==t?(console.warn("THREE.Matrix4: .multiply() now only accepts one argument. Use .multiplyMatrices( a, b ) instead."),this.multiplyMatrices(e,t)):this.multiplyMatrices(this,e)},premultiply:function(e){return this.multiplyMatrices(e,this)},multiplyMatrices:function(e,t){var r=e.elements,n=t.elements,i=this.elements,a=r[0],o=r[4],s=r[8],l=r[12],c=r[1],u=r[5],h=r[9],d=r[13],p=r[2],f=r[6],m=r[10],v=r[14],g=r[3],y=r[7],x=r[11],b=r[15],A=n[0],w=n[4],_=n[8],M=n[12],S=n[1],E=n[5],T=n[9],R=n[13],L=n[2],C=n[6],P=n[10],D=n[14],I=n[3],O=n[7],B=n[11],F=n[15];return i[0]=a*A+o*S+s*L+l*I,i[4]=a*w+o*E+s*C+l*O,i[8]=a*_+o*T+s*P+l*B,i[12]=a*M+o*R+s*D+l*F,i[1]=c*A+u*S+h*L+d*I,i[5]=c*w+u*E+h*C+d*O,i[9]=c*_+u*T+h*P+d*B,i[13]=c*M+u*R+h*D+d*F,i[2]=p*A+f*S+m*L+v*I,i[6]=p*w+f*E+m*C+v*O,i[10]=p*_+f*T+m*P+v*B,i[14]=p*M+f*R+m*D+v*F,i[3]=g*A+y*S+x*L+b*I,i[7]=g*w+y*E+x*C+b*O,i[11]=g*_+y*T+x*P+b*B,i[15]=g*M+y*R+x*D+b*F,this},multiplyScalar:function(e){var t=this.elements;return t[0]*=e,t[4]*=e,t[8]*=e,t[12]*=e,t[1]*=e,t[5]*=e,t[9]*=e,t[13]*=e,t[2]*=e,t[6]*=e,t[10]*=e,t[14]*=e,t[3]*=e,t[7]*=e,t[11]*=e,t[15]*=e,this},applyToBufferAttribute:function(e){for(var t=0,r=e.count;t<r;t++)Nr.x=e.getX(t),Nr.y=e.getY(t),Nr.z=e.getZ(t),Nr.applyMatrix4(this),e.setXYZ(t,Nr.x,Nr.y,Nr.z);return e},determinant:function(){var e=this.elements,t=e[0],r=e[4],n=e[8],i=e[12],a=e[1],o=e[5],s=e[9],l=e[13],c=e[2],u=e[6],h=e[10],d=e[14];return e[3]*(+i*s*u-n*l*u-i*o*h+r*l*h+n*o*d-r*s*d)+e[7]*(+t*s*d-t*l*h+i*a*h-n*a*d+n*l*c-i*s*c)+e[11]*(+t*l*u-t*o*d-i*a*u+r*a*d+i*o*c-r*l*c)+e[15]*(-n*o*c-t*s*u+t*o*h+n*a*u-r*a*h+r*s*c)},transpose:function(){var e,t=this.elements;return e=t[1],t[1]=t[4],t[4]=e,e=t[2],t[2]=t[8],t[8]=e,e=t[6],t[6]=t[9],t[9]=e,e=t[3],t[3]=t[12],t[12]=e,e=t[7],t[7]=t[13],t[13]=e,e=t[11],t[11]=t[14],t[14]=e,this},setPosition:function(e,t,r){var n=this.elements;return e.isVector3?(n[12]=e.x,n[13]=e.y,n[14]=e.z):(n[12]=e,n[13]=t,n[14]=r),this},getInverse:function(e,t){var r=this.elements,n=e.elements,i=n[0],a=n[1],o=n[2],s=n[3],l=n[4],c=n[5],u=n[6],h=n[7],d=n[8],p=n[9],f=n[10],m=n[11],v=n[12],g=n[13],y=n[14],x=n[15],b=p*y*h-g*f*h+g*u*m-c*y*m-p*u*x+c*f*x,A=v*f*h-d*y*h-v*u*m+l*y*m+d*u*x-l*f*x,w=d*g*h-v*p*h+v*c*m-l*g*m-d*c*x+l*p*x,_=v*p*u-d*g*u-v*c*f+l*g*f+d*c*y-l*p*y,M=i*b+a*A+o*w+s*_;if(0===M){var S="THREE.Matrix4: .getInverse() can't invert matrix, determinant is 0";if(!0===t)throw new Error(S);return console.warn(S),this.identity()}var E=1/M;return r[0]=b*E,r[1]=(g*f*s-p*y*s-g*o*m+a*y*m+p*o*x-a*f*x)*E,r[2]=(c*y*s-g*u*s+g*o*h-a*y*h-c*o*x+a*u*x)*E,r[3]=(p*u*s-c*f*s-p*o*h+a*f*h+c*o*m-a*u*m)*E,r[4]=A*E,r[5]=(d*y*s-v*f*s+v*o*m-i*y*m-d*o*x+i*f*x)*E,r[6]=(v*u*s-l*y*s-v*o*h+i*y*h+l*o*x-i*u*x)*E,r[7]=(l*f*s-d*u*s+d*o*h-i*f*h-l*o*m+i*u*m)*E,r[8]=w*E,r[9]=(v*p*s-d*g*s-v*a*m+i*g*m+d*a*x-i*p*x)*E,r[10]=(l*g*s-v*c*s+v*a*h-i*g*h-l*a*x+i*c*x)*E,r[11]=(d*c*s-l*p*s-d*a*h+i*p*h+l*a*m-i*c*m)*E,r[12]=_*E,r[13]=(d*g*o-v*p*o+v*a*f-i*g*f-d*a*y+i*p*y)*E,r[14]=(v*c*o-l*g*o-v*a*u+i*g*u+l*a*y-i*c*y)*E,r[15]=(l*p*o-d*c*o+d*a*u-i*p*u-l*a*f+i*c*f)*E,this},scale:function(e){var t=this.elements,r=e.x,n=e.y,i=e.z;return t[0]*=r,t[4]*=n,t[8]*=i,t[1]*=r,t[5]*=n,t[9]*=i,t[2]*=r,t[6]*=n,t[10]*=i,t[3]*=r,t[7]*=n,t[11]*=i,this},getMaxScaleOnAxis:function(){var e=this.elements,t=e[0]*e[0]+e[1]*e[1]+e[2]*e[2],r=e[4]*e[4]+e[5]*e[5]+e[6]*e[6],n=e[8]*e[8]+e[9]*e[9]+e[10]*e[10];return Math.sqrt(Math.max(t,r,n))},makeTranslation:function(e,t,r){return this.set(1,0,0,e,0,1,0,t,0,0,1,r,0,0,0,1),this},makeRotationX:function(e){var t=Math.cos(e),r=Math.sin(e);return this.set(1,0,0,0,0,t,-r,0,0,r,t,0,0,0,0,1),this},makeRotationY:function(e){var t=Math.cos(e),r=Math.sin(e);return this.set(t,0,r,0,0,1,0,0,-r,0,t,0,0,0,0,1),this},makeRotationZ:function(e){var t=Math.cos(e),r=Math.sin(e);return this.set(t,-r,0,0,r,t,0,0,0,0,1,0,0,0,0,1),this},makeRotationAxis:function(e,t){var r=Math.cos(t),n=Math.sin(t),i=1-r,a=e.x,o=e.y,s=e.z,l=i*a,c=i*o;return this.set(l*a+r,l*o-n*s,l*s+n*o,0,l*o+n*s,c*o+r,c*s-n*a,0,l*s-n*o,c*s+n*a,i*s*s+r,0,0,0,0,1),this},makeScale:function(e,t,r){return this.set(e,0,0,0,0,t,0,0,0,0,r,0,0,0,0,1),this},makeShear:function(e,t,r){return this.set(1,t,r,0,e,1,r,0,e,t,1,0,0,0,0,1),this},compose:function(e,t,r){var n=this.elements,i=t._x,a=t._y,o=t._z,s=t._w,l=i+i,c=a+a,u=o+o,h=i*l,d=i*c,p=i*u,f=a*c,m=a*u,v=o*u,g=s*l,y=s*c,x=s*u,b=r.x,A=r.y,w=r.z;return n[0]=(1-(f+v))*b,n[1]=(d+x)*b,n[2]=(p-y)*b,n[3]=0,n[4]=(d-x)*A,n[5]=(1-(h+v))*A,n[6]=(m+g)*A,n[7]=0,n[8]=(p+y)*w,n[9]=(m-g)*w,n[10]=(1-(h+f))*w,n[11]=0,n[12]=e.x,n[13]=e.y,n[14]=e.z,n[15]=1,this},decompose:function(e,t,r){var n=this.elements,i=Nr.set(n[0],n[1],n[2]).length(),a=Nr.set(n[4],n[5],n[6]).length(),o=Nr.set(n[8],n[9],n[10]).length();this.determinant()<0&&(i=-i),e.x=n[12],e.y=n[13],e.z=n[14],Gr.copy(this);var s=1/i,l=1/a,c=1/o;return Gr.elements[0]*=s,Gr.elements[1]*=s,Gr.elements[2]*=s,Gr.elements[4]*=l,Gr.elements[5]*=l,Gr.elements[6]*=l,Gr.elements[8]*=c,Gr.elements[9]*=c,Gr.elements[10]*=c,t.setFromRotationMatrix(Gr),r.x=i,r.y=a,r.z=o,this},makePerspective:function(e,t,r,n,i,a){void 0===a&&console.warn("THREE.Matrix4: .makePerspective() has been redefined and has a new signature. Please check the docs.");var o=this.elements,s=2*i/(t-e),l=2*i/(r-n),c=(t+e)/(t-e),u=(r+n)/(r-n),h=-(a+i)/(a-i),d=-2*a*i/(a-i);return o[0]=s,o[4]=0,o[8]=c,o[12]=0,o[1]=0,o[5]=l,o[9]=u,o[13]=0,o[2]=0,o[6]=0,o[10]=h,o[14]=d,o[3]=0,o[7]=0,o[11]=-1,o[15]=0,this},makeOrthographic:function(e,t,r,n,i,a){var o=this.elements,s=1/(t-e),l=1/(r-n),c=1/(a-i),u=(t+e)*s,h=(r+n)*l,d=(a+i)*c;return o[0]=2*s,o[4]=0,o[8]=0,o[12]=-u,o[1]=0,o[5]=2*l,o[9]=0,o[13]=-h,o[2]=0,o[6]=0,o[10]=-2*c,o[14]=-d,o[3]=0,o[7]=0,o[11]=0,o[15]=1,this},equals:function(e){for(var t=this.elements,r=e.elements,n=0;n<16;n++)if(t[n]!==r[n])return!1;return!0},fromArray:function(e,t){void 0===t&&(t=0);for(var r=0;r<16;r++)this.elements[r]=e[r+t];return this},toArray:function(e,t){void 0===e&&(e=[]),void 0===t&&(t=0);var r=this.elements;return e[t]=r[0],e[t+1]=r[1],e[t+2]=r[2],e[t+3]=r[3],e[t+4]=r[4],e[t+5]=r[5],e[t+6]=r[6],e[t+7]=r[7],e[t+8]=r[8],e[t+9]=r[9],e[t+10]=r[10],e[t+11]=r[11],e[t+12]=r[12],e[t+13]=r[13],e[t+14]=r[14],e[t+15]=r[15],e}});var qr=new Wr,Xr=new Sr;function Yr(e,t,r,n){this._x=e||0,this._y=t||0,this._z=r||0,this._order=n||Yr.DefaultOrder}function Qr(){this.mask=1}Yr.RotationOrders=["XYZ","YZX","ZXY","XZY","YXZ","ZYX"],Yr.DefaultOrder="XYZ",Object.defineProperties(Yr.prototype,{x:{get:function(){return this._x},set:function(e){this._x=e,this._onChangeCallback()}},y:{get:function(){return this._y},set:function(e){this._y=e,this._onChangeCallback()}},z:{get:function(){return this._z},set:function(e){this._z=e,this._onChangeCallback()}},order:{get:function(){return this._order},set:function(e){this._order=e,this._onChangeCallback()}}}),Object.assign(Yr.prototype,{isEuler:!0,set:function(e,t,r,n){return this._x=e,this._y=t,this._z=r,this._order=n||this._order,this._onChangeCallback(),this},clone:function(){return new this.constructor(this._x,this._y,this._z,this._order)},copy:function(e){return this._x=e._x,this._y=e._y,this._z=e._z,this._order=e._order,this._onChangeCallback(),this},setFromRotationMatrix:function(e,t,r){var n=_r.clamp,i=e.elements,a=i[0],o=i[4],s=i[8],l=i[1],c=i[5],u=i[9],h=i[2],d=i[6],p=i[10];return"XYZ"===(t=t||this._order)?(this._y=Math.asin(n(s,-1,1)),Math.abs(s)<.9999999?(this._x=Math.atan2(-u,p),this._z=Math.atan2(-o,a)):(this._x=Math.atan2(d,c),this._z=0)):"YXZ"===t?(this._x=Math.asin(-n(u,-1,1)),Math.abs(u)<.9999999?(this._y=Math.atan2(s,p),this._z=Math.atan2(l,c)):(this._y=Math.atan2(-h,a),this._z=0)):"ZXY"===t?(this._x=Math.asin(n(d,-1,1)),Math.abs(d)<.9999999?(this._y=Math.atan2(-h,p),this._z=Math.atan2(-o,c)):(this._y=0,this._z=Math.atan2(l,a))):"ZYX"===t?(this._y=Math.asin(-n(h,-1,1)),Math.abs(h)<.9999999?(this._x=Math.atan2(d,p),this._z=Math.atan2(l,a)):(this._x=0,this._z=Math.atan2(-o,c))):"YZX"===t?(this._z=Math.asin(n(l,-1,1)),Math.abs(l)<.9999999?(this._x=Math.atan2(-u,c),this._y=Math.atan2(-h,a)):(this._x=0,this._y=Math.atan2(s,p))):"XZY"===t?(this._z=Math.asin(-n(o,-1,1)),Math.abs(o)<.9999999?(this._x=Math.atan2(d,c),this._y=Math.atan2(s,a)):(this._x=Math.atan2(-u,p),this._y=0)):console.warn("THREE.Euler: .setFromRotationMatrix() given unsupported order: "+t),this._order=t,!1!==r&&this._onChangeCallback(),this},setFromQuaternion:function(e,t,r){return qr.makeRotationFromQuaternion(e),this.setFromRotationMatrix(qr,t,r)},setFromVector3:function(e,t){return this.set(e.x,e.y,e.z,t||this._order)},reorder:function(e){return Xr.setFromEuler(this),this.setFromQuaternion(Xr,e)},equals:function(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._order===this._order},fromArray:function(e){return this._x=e[0],this._y=e[1],this._z=e[2],void 0!==e[3]&&(this._order=e[3]),this._onChangeCallback(),this},toArray:function(e,t){return void 0===e&&(e=[]),void 0===t&&(t=0),e[t]=this._x,e[t+1]=this._y,e[t+2]=this._z,e[t+3]=this._order,e},toVector3:function(e){return e?e.set(this._x,this._y,this._z):new Rr(this._x,this._y,this._z)},_onChange:function(e){return this._onChangeCallback=e,this},_onChangeCallback:function(){}}),Object.assign(Qr.prototype,{set:function(e){this.mask=1<<e|0},enable:function(e){this.mask|=1<<e|0},enableAll:function(){this.mask=-1},toggle:function(e){this.mask^=1<<e|0},disable:function(e){this.mask&=~(1<<e|0)},disableAll:function(){this.mask=0},test:function(e){return 0!=(this.mask&e.mask)}});var Zr=0,Jr=new Rr,Kr=new Sr,$r=new Wr,en=new Rr,tn=new Rr,rn=new Rr,nn=new Sr,an=new Rr(1,0,0),on=new Rr(0,1,0),sn=new Rr(0,0,1),ln={type:"added"},cn={type:"removed"};function un(){Object.defineProperty(this,"id",{value:Zr++}),this.uuid=_r.generateUUID(),this.name="",this.type="Object3D",this.parent=null,this.children=[],this.up=un.DefaultUp.clone();var e=new Rr,t=new Yr,r=new Sr,n=new Rr(1,1,1);t._onChange((function(){r.setFromEuler(t,!1)})),r._onChange((function(){t.setFromQuaternion(r,void 0,!1)})),Object.defineProperties(this,{position:{configurable:!0,enumerable:!0,value:e},rotation:{configurable:!0,enumerable:!0,value:t},quaternion:{configurable:!0,enumerable:!0,value:r},scale:{configurable:!0,enumerable:!0,value:n},modelViewMatrix:{value:new Wr},normalMatrix:{value:new Pr}}),this.matrix=new Wr,this.matrixWorld=new Wr,this.matrixAutoUpdate=un.DefaultMatrixAutoUpdate,this.matrixWorldNeedsUpdate=!1,this.layers=new Qr,this.visible=!0,this.castShadow=!1,this.receiveShadow=!1,this.frustumCulled=!0,this.renderOrder=0,this.userData={}}function hn(){un.call(this),this.type="Scene",this.background=null,this.environment=null,this.fog=null,this.overrideMaterial=null,this.autoUpdate=!0,"undefined"!=typeof __THREE_DEVTOOLS__&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}un.DefaultUp=new Rr(0,1,0),un.DefaultMatrixAutoUpdate=!0,un.prototype=Object.assign(Object.create(br.prototype),{constructor:un,isObject3D:!0,onBeforeRender:function(){},onAfterRender:function(){},applyMatrix:function(e){this.matrixAutoUpdate&&this.updateMatrix(),this.matrix.premultiply(e),this.matrix.decompose(this.position,this.quaternion,this.scale)},applyQuaternion:function(e){return this.quaternion.premultiply(e),this},setRotationFromAxisAngle:function(e,t){this.quaternion.setFromAxisAngle(e,t)},setRotationFromEuler:function(e){this.quaternion.setFromEuler(e,!0)},setRotationFromMatrix:function(e){this.quaternion.setFromRotationMatrix(e)},setRotationFromQuaternion:function(e){this.quaternion.copy(e)},rotateOnAxis:function(e,t){return Kr.setFromAxisAngle(e,t),this.quaternion.multiply(Kr),this},rotateOnWorldAxis:function(e,t){return Kr.setFromAxisAngle(e,t),this.quaternion.premultiply(Kr),this},rotateX:function(e){return this.rotateOnAxis(an,e)},rotateY:function(e){return this.rotateOnAxis(on,e)},rotateZ:function(e){return this.rotateOnAxis(sn,e)},translateOnAxis:function(e,t){return Jr.copy(e).applyQuaternion(this.quaternion),this.position.add(Jr.multiplyScalar(t)),this},translateX:function(e){return this.translateOnAxis(an,e)},translateY:function(e){return this.translateOnAxis(on,e)},translateZ:function(e){return this.translateOnAxis(sn,e)},localToWorld:function(e){return e.applyMatrix4(this.matrixWorld)},worldToLocal:function(e){return e.applyMatrix4($r.getInverse(this.matrixWorld))},lookAt:function(e,t,r){e.isVector3?en.copy(e):en.set(e,t,r);var n=this.parent;this.updateWorldMatrix(!0,!1),tn.setFromMatrixPosition(this.matrixWorld),this.isCamera||this.isLight?$r.lookAt(tn,en,this.up):$r.lookAt(en,tn,this.up),this.quaternion.setFromRotationMatrix($r),n&&($r.extractRotation(n.matrixWorld),Kr.setFromRotationMatrix($r),this.quaternion.premultiply(Kr.inverse()))},add:function(e){if(arguments.length>1){for(var t=0;t<arguments.length;t++)this.add(arguments[t]);return this}return e===this?(console.error("THREE.Object3D.add: object can't be added as a child of itself.",e),this):(e&&e.isObject3D?(null!==e.parent&&e.parent.remove(e),e.parent=this,this.children.push(e),e.dispatchEvent(ln)):console.error("THREE.Object3D.add: object not an instance of THREE.Object3D.",e),this)},remove:function(e){if(arguments.length>1){for(var t=0;t<arguments.length;t++)this.remove(arguments[t]);return this}var r=this.children.indexOf(e);return-1!==r&&(e.parent=null,this.children.splice(r,1),e.dispatchEvent(cn)),this},attach:function(e){return this.updateWorldMatrix(!0,!1),$r.getInverse(this.matrixWorld),null!==e.parent&&(e.parent.updateWorldMatrix(!0,!1),$r.multiply(e.parent.matrixWorld)),e.applyMatrix($r),e.updateWorldMatrix(!1,!1),this.add(e),this},getObjectById:function(e){return this.getObjectByProperty("id",e)},getObjectByName:function(e){return this.getObjectByProperty("name",e)},getObjectByProperty:function(e,t){if(this[e]===t)return this;for(var r=0,n=this.children.length;r<n;r++){var i=this.children[r].getObjectByProperty(e,t);if(void 0!==i)return i}},getWorldPosition:function(e){return void 0===e&&(console.warn("THREE.Object3D: .getWorldPosition() target is now required"),e=new Rr),this.updateMatrixWorld(!0),e.setFromMatrixPosition(this.matrixWorld)},getWorldQuaternion:function(e){return void 0===e&&(console.warn("THREE.Object3D: .getWorldQuaternion() target is now required"),e=new Sr),this.updateMatrixWorld(!0),this.matrixWorld.decompose(tn,e,rn),e},getWorldScale:function(e){return void 0===e&&(console.warn("THREE.Object3D: .getWorldScale() target is now required"),e=new Rr),this.updateMatrixWorld(!0),this.matrixWorld.decompose(tn,nn,e),e},getWorldDirection:function(e){void 0===e&&(console.warn("THREE.Object3D: .getWorldDirection() target is now required"),e=new Rr),this.updateMatrixWorld(!0);var t=this.matrixWorld.elements;return e.set(t[8],t[9],t[10]).normalize()},raycast:function(){},traverse:function(e){e(this);for(var t=this.children,r=0,n=t.length;r<n;r++)t[r].traverse(e)},traverseVisible:function(e){if(!1!==this.visible){e(this);for(var t=this.children,r=0,n=t.length;r<n;r++)t[r].traverseVisible(e)}},traverseAncestors:function(e){var t=this.parent;null!==t&&(e(t),t.traverseAncestors(e))},updateMatrix:function(){this.matrix.compose(this.position,this.quaternion,this.scale),this.matrixWorldNeedsUpdate=!0},updateMatrixWorld:function(e){this.matrixAutoUpdate&&this.updateMatrix(),(this.matrixWorldNeedsUpdate||e)&&(null===this.parent?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix),this.matrixWorldNeedsUpdate=!1,e=!0);for(var t=this.children,r=0,n=t.length;r<n;r++)t[r].updateMatrixWorld(e)},updateWorldMatrix:function(e,t){var r=this.parent;if(!0===e&&null!==r&&r.updateWorldMatrix(!0,!1),this.matrixAutoUpdate&&this.updateMatrix(),null===this.parent?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix),!0===t)for(var n=this.children,i=0,a=n.length;i<a;i++)n[i].updateWorldMatrix(!1,!0)},toJSON:function(e){var t=void 0===e||"string"==typeof e,r={};t&&(e={geometries:{},materials:{},textures:{},images:{},shapes:{}},r.metadata={version:4.5,type:"Object",generator:"Object3D.toJSON"});var n={};function i(t,r){return void 0===t[r.uuid]&&(t[r.uuid]=r.toJSON(e)),r.uuid}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),this.isInstancedMesh&&(n.type="InstancedMesh",n.count=this.count,n.instanceMatrix=this.instanceMatrix.toJSON()),this.isMesh||this.isLine||this.isPoints){n.geometry=i(e.geometries,this.geometry);var a=this.geometry.parameters;if(void 0!==a&&void 0!==a.shapes){var o=a.shapes;if(Array.isArray(o))for(var s=0,l=o.length;s<l;s++){var c=o[s];i(e.shapes,c)}else i(e.shapes,o)}}if(void 0!==this.material)if(Array.isArray(this.material)){var u=[];for(s=0,l=this.material.length;s<l;s++)u.push(i(e.materials,this.material[s]));n.material=u}else n.material=i(e.materials,this.material);if(this.children.length>0){n.children=[];for(s=0;s<this.children.length;s++)n.children.push(this.children[s].toJSON(e).object)}if(t){var h=m(e.geometries),d=m(e.materials),p=m(e.textures),f=m(e.images);o=m(e.shapes);h.length>0&&(r.geometries=h),d.length>0&&(r.materials=d),p.length>0&&(r.textures=p),f.length>0&&(r.images=f),o.length>0&&(r.shapes=o)}return r.object=n,r;function m(e){var t=[];for(var r in e){var n=e[r];delete n.metadata,t.push(n)}return t}},clone:function(e){return(new this.constructor).copy(this,e)},copy:function(e,t){if(void 0===t&&(t=!0),this.name=e.name,this.up.copy(e.up),this.position.copy(e.position),this.quaternion.copy(e.quaternion),this.scale.copy(e.scale),this.matrix.copy(e.matrix),this.matrixWorld.copy(e.matrixWorld),this.matrixAutoUpdate=e.matrixAutoUpdate,this.matrixWorldNeedsUpdate=e.matrixWorldNeedsUpdate,this.layers.mask=e.layers.mask,this.visible=e.visible,this.castShadow=e.castShadow,this.receiveShadow=e.receiveShadow,this.frustumCulled=e.frustumCulled,this.renderOrder=e.renderOrder,this.userData=JSON.parse(JSON.stringify(e.userData)),!0===t)for(var r=0;r<e.children.length;r++){var n=e.children[r];this.add(n.clone())}return this}}),hn.prototype=Object.assign(Object.create(un.prototype),{constructor:hn,isScene:!0,copy:function(e,t){return un.prototype.copy.call(this,e,t),null!==e.background&&(this.background=e.background.clone()),null!==e.environment&&(this.environment=e.environment.clone()),null!==e.fog&&(this.fog=e.fog.clone()),null!==e.overrideMaterial&&(this.overrideMaterial=e.overrideMaterial.clone()),this.autoUpdate=e.autoUpdate,this.matrixAutoUpdate=e.matrixAutoUpdate,this},toJSON:function(e){var t=un.prototype.toJSON.call(this,e);return null!==this.background&&(t.object.background=this.background.toJSON(e)),null!==this.environment&&(t.object.environment=this.environment.toJSON(e)),null!==this.fog&&(t.object.fog=this.fog.toJSON()),t},dispose:function(){this.dispatchEvent({type:"dispose"})}});var dn=[new Rr,new Rr,new Rr,new Rr,new Rr,new Rr,new Rr,new Rr],pn=new Rr,fn=new Sn,mn=new Rr,vn=new Rr,gn=new Rr,yn=new Rr,xn=new Rr,bn=new Rr,An=new Rr,wn=new Rr,_n=new Rr,Mn=new Rr;function Sn(e,t){this.min=void 0!==e?e:new Rr(1/0,1/0,1/0),this.max=void 0!==t?t:new Rr(-1/0,-1/0,-1/0)}function En(e,t,r,n,i){var a,o;for(a=0,o=e.length-3;a<=o;a+=3){Mn.fromArray(e,a);var s=i.x*Math.abs(Mn.x)+i.y*Math.abs(Mn.y)+i.z*Math.abs(Mn.z),l=t.dot(Mn),c=r.dot(Mn),u=n.dot(Mn);if(Math.max(-Math.max(l,c,u),Math.min(l,c,u))>s)return!1}return!0}Object.assign(Sn.prototype,{isBox3:!0,set:function(e,t){return this.min.copy(e),this.max.copy(t),this},setFromArray:function(e){for(var t=1/0,r=1/0,n=1/0,i=-1/0,a=-1/0,o=-1/0,s=0,l=e.length;s<l;s+=3){var c=e[s],u=e[s+1],h=e[s+2];c<t&&(t=c),u<r&&(r=u),h<n&&(n=h),c>i&&(i=c),u>a&&(a=u),h>o&&(o=h)}return this.min.set(t,r,n),this.max.set(i,a,o),this},setFromBufferAttribute:function(e){for(var t=1/0,r=1/0,n=1/0,i=-1/0,a=-1/0,o=-1/0,s=0,l=e.count;s<l;s++){var c=e.getX(s),u=e.getY(s),h=e.getZ(s);c<t&&(t=c),u<r&&(r=u),h<n&&(n=h),c>i&&(i=c),u>a&&(a=u),h>o&&(o=h)}return this.min.set(t,r,n),this.max.set(i,a,o),this},setFromPoints:function(e){this.makeEmpty();for(var t=0,r=e.length;t<r;t++)this.expandByPoint(e[t]);return this},setFromCenterAndSize:function(e,t){var r=pn.copy(t).multiplyScalar(.5);return this.min.copy(e).sub(r),this.max.copy(e).add(r),this},setFromObject:function(e){return this.makeEmpty(),this.expandByObject(e)},clone:function(){return(new this.constructor).copy(this)},copy:function(e){return this.min.copy(e.min),this.max.copy(e.max),this},makeEmpty:function(){return this.min.x=this.min.y=this.min.z=1/0,this.max.x=this.max.y=this.max.z=-1/0,this},isEmpty:function(){return this.max.x<this.min.x||this.max.y<this.min.y||this.max.z<this.min.z},getCenter:function(e){return void 0===e&&(console.warn("THREE.Box3: .getCenter() target is now required"),e=new Rr),this.isEmpty()?e.set(0,0,0):e.addVectors(this.min,this.max).multiplyScalar(.5)},getSize:function(e){return void 0===e&&(console.warn("THREE.Box3: .getSize() target is now required"),e=new Rr),this.isEmpty()?e.set(0,0,0):e.subVectors(this.max,this.min)},expandByPoint:function(e){return this.min.min(e),this.max.max(e),this},expandByVector:function(e){return this.min.sub(e),this.max.add(e),this},expandByScalar:function(e){return this.min.addScalar(-e),this.max.addScalar(e),this},expandByObject:function(e){e.updateWorldMatrix(!1,!1);var t=e.geometry;void 0!==t&&(null===t.boundingBox&&t.computeBoundingBox(),fn.copy(t.boundingBox),fn.applyMatrix4(e.matrixWorld),this.expandByPoint(fn.min),this.expandByPoint(fn.max));for(var r=e.children,n=0,i=r.length;n<i;n++)this.expandByObject(r[n]);return this},containsPoint:function(e){return!(e.x<this.min.x||e.x>this.max.x||e.y<this.min.y||e.y>this.max.y||e.z<this.min.z||e.z>this.max.z)},containsBox:function(e){return this.min.x<=e.min.x&&e.max.x<=this.max.x&&this.min.y<=e.min.y&&e.max.y<=this.max.y&&this.min.z<=e.min.z&&e.max.z<=this.max.z},getParameter:function(e,t){return void 0===t&&(console.warn("THREE.Box3: .getParameter() target is now required"),t=new Rr),t.set((e.x-this.min.x)/(this.max.x-this.min.x),(e.y-this.min.y)/(this.max.y-this.min.y),(e.z-this.min.z)/(this.max.z-this.min.z))},intersectsBox:function(e){return!(e.max.x<this.min.x||e.min.x>this.max.x||e.max.y<this.min.y||e.min.y>this.max.y||e.max.z<this.min.z||e.min.z>this.max.z)},intersectsSphere:function(e){return this.clampPoint(e.center,pn),pn.distanceToSquared(e.center)<=e.radius*e.radius},intersectsPlane:function(e){var t,r;return e.normal.x>0?(t=e.normal.x*this.min.x,r=e.normal.x*this.max.x):(t=e.normal.x*this.max.x,r=e.normal.x*this.min.x),e.normal.y>0?(t+=e.normal.y*this.min.y,r+=e.normal.y*this.max.y):(t+=e.normal.y*this.max.y,r+=e.normal.y*this.min.y),e.normal.z>0?(t+=e.normal.z*this.min.z,r+=e.normal.z*this.max.z):(t+=e.normal.z*this.max.z,r+=e.normal.z*this.min.z),t<=-e.constant&&r>=-e.constant},intersectsTriangle:function(e){if(this.isEmpty())return!1;this.getCenter(An),wn.subVectors(this.max,An),mn.subVectors(e.a,An),vn.subVectors(e.b,An),gn.subVectors(e.c,An),yn.subVectors(vn,mn),xn.subVectors(gn,vn),bn.subVectors(mn,gn);var t=[0,-yn.z,yn.y,0,-xn.z,xn.y,0,-bn.z,bn.y,yn.z,0,-yn.x,xn.z,0,-xn.x,bn.z,0,-bn.x,-yn.y,yn.x,0,-xn.y,xn.x,0,-bn.y,bn.x,0];return!!En(t,mn,vn,gn,wn)&&(!!En(t=[1,0,0,0,1,0,0,0,1],mn,vn,gn,wn)&&(_n.crossVectors(yn,xn),En(t=[_n.x,_n.y,_n.z],mn,vn,gn,wn)))},clampPoint:function(e,t){return void 0===t&&(console.warn("THREE.Box3: .clampPoint() target is now required"),t=new Rr),t.copy(e).clamp(this.min,this.max)},distanceToPoint:function(e){return pn.copy(e).clamp(this.min,this.max).sub(e).length()},getBoundingSphere:function(e){return void 0===e&&console.error("THREE.Box3: .getBoundingSphere() target is now required"),this.getCenter(e.center),e.radius=.5*this.getSize(pn).length(),e},intersect:function(e){return this.min.max(e.min),this.max.min(e.max),this.isEmpty()&&this.makeEmpty(),this},union:function(e){return this.min.min(e.min),this.max.max(e.max),this},applyMatrix4:function(e){return this.isEmpty()?this:(dn[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(e),dn[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(e),dn[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(e),dn[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(e),dn[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(e),dn[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(e),dn[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(e),dn[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(e),this.setFromPoints(dn),this)},translate:function(e){return this.min.add(e),this.max.add(e),this},equals:function(e){return e.min.equals(this.min)&&e.max.equals(this.max)}});var Tn=new Sn;function Rn(e,t){this.center=void 0!==e?e:new Rr,this.radius=void 0!==t?t:0}Object.assign(Rn.prototype,{set:function(e,t){return this.center.copy(e),this.radius=t,this},setFromPoints:function(e,t){var r=this.center;void 0!==t?r.copy(t):Tn.setFromPoints(e).getCenter(r);for(var n=0,i=0,a=e.length;i<a;i++)n=Math.max(n,r.distanceToSquared(e[i]));return this.radius=Math.sqrt(n),this},clone:function(){return(new this.constructor).copy(this)},copy:function(e){return this.center.copy(e.center),this.radius=e.radius,this},empty:function(){return this.radius<=0},containsPoint:function(e){return e.distanceToSquared(this.center)<=this.radius*this.radius},distanceToPoint:function(e){return e.distanceTo(this.center)-this.radius},intersectsSphere:function(e){var t=this.radius+e.radius;return e.center.distanceToSquared(this.center)<=t*t},intersectsBox:function(e){return e.intersectsSphere(this)},intersectsPlane:function(e){return Math.abs(e.distanceToPoint(this.center))<=this.radius},clampPoint:function(e,t){var r=this.center.distanceToSquared(e);return void 0===t&&(console.warn("THREE.Sphere: .clampPoint() target is now required"),t=new Rr),t.copy(e),r>this.radius*this.radius&&(t.sub(this.center).normalize(),t.multiplyScalar(this.radius).add(this.center)),t},getBoundingBox:function(e){return void 0===e&&(console.warn("THREE.Sphere: .getBoundingBox() target is now required"),e=new Sn),e.set(this.center,this.center),e.expandByScalar(this.radius),e},applyMatrix4:function(e){return this.center.applyMatrix4(e),this.radius=this.radius*e.getMaxScaleOnAxis(),this},translate:function(e){return this.center.add(e),this},equals:function(e){return e.center.equals(this.center)&&e.radius===this.radius}});var Ln=new Rr,Cn=new Rr,Pn=new Rr,Dn=new Rr,In=new Rr,On=new Rr,Bn=new Rr;function Fn(e,t){this.origin=void 0!==e?e:new Rr,this.direction=void 0!==t?t:new Rr(0,0,-1)}Object.assign(Fn.prototype,{set:function(e,t){return this.origin.copy(e),this.direction.copy(t),this},clone:function(){return(new this.constructor).copy(this)},copy:function(e){return this.origin.copy(e.origin),this.direction.copy(e.direction),this},at:function(e,t){return void 0===t&&(console.warn("THREE.Ray: .at() target is now required"),t=new Rr),t.copy(this.direction).multiplyScalar(e).add(this.origin)},lookAt:function(e){return this.direction.copy(e).sub(this.origin).normalize(),this},recast:function(e){return this.origin.copy(this.at(e,Ln)),this},closestPointToPoint:function(e,t){void 0===t&&(console.warn("THREE.Ray: .closestPointToPoint() target is now required"),t=new Rr),t.subVectors(e,this.origin);var r=t.dot(this.direction);return r<0?t.copy(this.origin):t.copy(this.direction).multiplyScalar(r).add(this.origin)},distanceToPoint:function(e){return Math.sqrt(this.distanceSqToPoint(e))},distanceSqToPoint:function(e){var t=Ln.subVectors(e,this.origin).dot(this.direction);return t<0?this.origin.distanceToSquared(e):(Ln.copy(this.direction).multiplyScalar(t).add(this.origin),Ln.distanceToSquared(e))},distanceSqToSegment:function(e,t,r,n){Cn.copy(e).add(t).multiplyScalar(.5),Pn.copy(t).sub(e).normalize(),Dn.copy(this.origin).sub(Cn);var i,a,o,s,l=.5*e.distanceTo(t),c=-this.direction.dot(Pn),u=Dn.dot(this.direction),h=-Dn.dot(Pn),d=Dn.lengthSq(),p=Math.abs(1-c*c);if(p>0)if(a=c*u-h,s=l*p,(i=c*h-u)>=0)if(a>=-s)if(a<=s){var f=1/p;o=(i*=f)*(i+c*(a*=f)+2*u)+a*(c*i+a+2*h)+d}else a=l,o=-(i=Math.max(0,-(c*a+u)))*i+a*(a+2*h)+d;else a=-l,o=-(i=Math.max(0,-(c*a+u)))*i+a*(a+2*h)+d;else a<=-s?o=-(i=Math.max(0,-(-c*l+u)))*i+(a=i>0?-l:Math.min(Math.max(-l,-h),l))*(a+2*h)+d:a<=s?(i=0,o=(a=Math.min(Math.max(-l,-h),l))*(a+2*h)+d):o=-(i=Math.max(0,-(c*l+u)))*i+(a=i>0?l:Math.min(Math.max(-l,-h),l))*(a+2*h)+d;else a=c>0?-l:l,o=-(i=Math.max(0,-(c*a+u)))*i+a*(a+2*h)+d;return r&&r.copy(this.direction).multiplyScalar(i).add(this.origin),n&&n.copy(Pn).multiplyScalar(a).add(Cn),o},intersectSphere:function(e,t){Ln.subVectors(e.center,this.origin);var r=Ln.dot(this.direction),n=Ln.dot(Ln)-r*r,i=e.radius*e.radius;if(n>i)return null;var a=Math.sqrt(i-n),o=r-a,s=r+a;return o<0&&s<0?null:o<0?this.at(s,t):this.at(o,t)},intersectsSphere:function(e){return this.distanceSqToPoint(e.center)<=e.radius*e.radius},distanceToPlane:function(e){var t=e.normal.dot(this.direction);if(0===t)return 0===e.distanceToPoint(this.origin)?0:null;var r=-(this.origin.dot(e.normal)+e.constant)/t;return r>=0?r:null},intersectPlane:function(e,t){var r=this.distanceToPlane(e);return null===r?null:this.at(r,t)},intersectsPlane:function(e){var t=e.distanceToPoint(this.origin);return 0===t||e.normal.dot(this.direction)*t<0},intersectBox:function(e,t){var r,n,i,a,o,s,l=1/this.direction.x,c=1/this.direction.y,u=1/this.direction.z,h=this.origin;return l>=0?(r=(e.min.x-h.x)*l,n=(e.max.x-h.x)*l):(r=(e.max.x-h.x)*l,n=(e.min.x-h.x)*l),c>=0?(i=(e.min.y-h.y)*c,a=(e.max.y-h.y)*c):(i=(e.max.y-h.y)*c,a=(e.min.y-h.y)*c),r>a||i>n?null:((i>r||r!=r)&&(r=i),(a<n||n!=n)&&(n=a),u>=0?(o=(e.min.z-h.z)*u,s=(e.max.z-h.z)*u):(o=(e.max.z-h.z)*u,s=(e.min.z-h.z)*u),r>s||o>n?null:((o>r||r!=r)&&(r=o),(s<n||n!=n)&&(n=s),n<0?null:this.at(r>=0?r:n,t)))},intersectsBox:function(e){return null!==this.intersectBox(e,Ln)},intersectTriangle:function(e,t,r,n,i){In.subVectors(t,e),On.subVectors(r,e),Bn.crossVectors(In,On);var a,o=this.direction.dot(Bn);if(o>0){if(n)return null;a=1}else{if(!(o<0))return null;a=-1,o=-o}Dn.subVectors(this.origin,e);var s=a*this.direction.dot(On.crossVectors(Dn,On));if(s<0)return null;var l=a*this.direction.dot(In.cross(Dn));if(l<0)return null;if(s+l>o)return null;var c=-a*Dn.dot(Bn);return c<0?null:this.at(c/o,i)},applyMatrix4:function(e){return this.origin.applyMatrix4(e),this.direction.transformDirection(e),this},equals:function(e){return e.origin.equals(this.origin)&&e.direction.equals(this.direction)}});var Un=new Rr,Nn=new Rr,Gn=new Pr;function zn(e,t){this.normal=void 0!==e?e:new Rr(1,0,0),this.constant=void 0!==t?t:0}Object.assign(zn.prototype,{isPlane:!0,set:function(e,t){return this.normal.copy(e),this.constant=t,this},setComponents:function(e,t,r,n){return this.normal.set(e,t,r),this.constant=n,this},setFromNormalAndCoplanarPoint:function(e,t){return this.normal.copy(e),this.constant=-t.dot(this.normal),this},setFromCoplanarPoints:function(e,t,r){var n=Un.subVectors(r,t).cross(Nn.subVectors(e,t)).normalize();return this.setFromNormalAndCoplanarPoint(n,e),this},clone:function(){return(new this.constructor).copy(this)},copy:function(e){return this.normal.copy(e.normal),this.constant=e.constant,this},normalize:function(){var e=1/this.normal.length();return this.normal.multiplyScalar(e),this.constant*=e,this},negate:function(){return this.constant*=-1,this.normal.negate(),this},distanceToPoint:function(e){return this.normal.dot(e)+this.constant},distanceToSphere:function(e){return this.distanceToPoint(e.center)-e.radius},projectPoint:function(e,t){return void 0===t&&(console.warn("THREE.Plane: .projectPoint() target is now required"),t=new Rr),t.copy(this.normal).multiplyScalar(-this.distanceToPoint(e)).add(e)},intersectLine:function(e,t){void 0===t&&(console.warn("THREE.Plane: .intersectLine() target is now required"),t=new Rr);var r=e.delta(Un),n=this.normal.dot(r);if(0===n)return 0===this.distanceToPoint(e.start)?t.copy(e.start):void 0;var i=-(e.start.dot(this.normal)+this.constant)/n;return i<0||i>1?void 0:t.copy(r).multiplyScalar(i).add(e.start)},intersectsLine:function(e){var t=this.distanceToPoint(e.start),r=this.distanceToPoint(e.end);return t<0&&r>0||r<0&&t>0},intersectsBox:function(e){return e.intersectsPlane(this)},intersectsSphere:function(e){return e.intersectsPlane(this)},coplanarPoint:function(e){return void 0===e&&(console.warn("THREE.Plane: .coplanarPoint() target is now required"),e=new Rr),e.copy(this.normal).multiplyScalar(-this.constant)},applyMatrix4:function(e,t){var r=t||Gn.getNormalMatrix(e),n=this.coplanarPoint(Un).applyMatrix4(e),i=this.normal.applyMatrix3(r).normalize();return this.constant=-n.dot(i),this},translate:function(e){return this.constant-=e.dot(this.normal),this},equals:function(e){return e.normal.equals(this.normal)&&e.constant===this.constant}});var kn=new Rr,Hn=new Rr,Vn=new Rr,jn=new Rr,Wn=new Rr,qn=new Rr,Xn=new Rr,Yn=new Rr,Qn=new Rr,Zn=new Rr;function Jn(e,t,r){this.a=void 0!==e?e:new Rr,this.b=void 0!==t?t:new Rr,this.c=void 0!==r?r:new Rr}Object.assign(Jn,{getNormal:function(e,t,r,n){void 0===n&&(console.warn("THREE.Triangle: .getNormal() target is now required"),n=new Rr),n.subVectors(r,t),kn.subVectors(e,t),n.cross(kn);var i=n.lengthSq();return i>0?n.multiplyScalar(1/Math.sqrt(i)):n.set(0,0,0)},getBarycoord:function(e,t,r,n,i){kn.subVectors(n,t),Hn.subVectors(r,t),Vn.subVectors(e,t);var a=kn.dot(kn),o=kn.dot(Hn),s=kn.dot(Vn),l=Hn.dot(Hn),c=Hn.dot(Vn),u=a*l-o*o;if(void 0===i&&(console.warn("THREE.Triangle: .getBarycoord() target is now required"),i=new Rr),0===u)return i.set(-2,-1,-1);var h=1/u,d=(l*s-o*c)*h,p=(a*c-o*s)*h;return i.set(1-d-p,p,d)},containsPoint:function(e,t,r,n){return Jn.getBarycoord(e,t,r,n,jn),jn.x>=0&&jn.y>=0&&jn.x+jn.y<=1},getUV:function(e,t,r,n,i,a,o,s){return this.getBarycoord(e,t,r,n,jn),s.set(0,0),s.addScaledVector(i,jn.x),s.addScaledVector(a,jn.y),s.addScaledVector(o,jn.z),s},isFrontFacing:function(e,t,r,n){return kn.subVectors(r,t),Hn.subVectors(e,t),kn.cross(Hn).dot(n)<0}}),Object.assign(Jn.prototype,{set:function(e,t,r){return this.a.copy(e),this.b.copy(t),this.c.copy(r),this},setFromPointsAndIndices:function(e,t,r,n){return this.a.copy(e[t]),this.b.copy(e[r]),this.c.copy(e[n]),this},clone:function(){return(new this.constructor).copy(this)},copy:function(e){return this.a.copy(e.a),this.b.copy(e.b),this.c.copy(e.c),this},getArea:function(){return kn.subVectors(this.c,this.b),Hn.subVectors(this.a,this.b),.5*kn.cross(Hn).length()},getMidpoint:function(e){return void 0===e&&(console.warn("THREE.Triangle: .getMidpoint() target is now required"),e=new Rr),e.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)},getNormal:function(e){return Jn.getNormal(this.a,this.b,this.c,e)},getPlane:function(e){return void 0===e&&(console.warn("THREE.Triangle: .getPlane() target is now required"),e=new zn),e.setFromCoplanarPoints(this.a,this.b,this.c)},getBarycoord:function(e,t){return Jn.getBarycoord(e,this.a,this.b,this.c,t)},getUV:function(e,t,r,n,i){return Jn.getUV(e,this.a,this.b,this.c,t,r,n,i)},containsPoint:function(e){return Jn.containsPoint(e,this.a,this.b,this.c)},isFrontFacing:function(e){return Jn.isFrontFacing(this.a,this.b,this.c,e)},intersectsBox:function(e){return e.intersectsTriangle(this)},closestPointToPoint:function(e,t){void 0===t&&(console.warn("THREE.Triangle: .closestPointToPoint() target is now required"),t=new Rr);var r,n,i=this.a,a=this.b,o=this.c;Wn.subVectors(a,i),qn.subVectors(o,i),Yn.subVectors(e,i);var s=Wn.dot(Yn),l=qn.dot(Yn);if(s<=0&&l<=0)return t.copy(i);Qn.subVectors(e,a);var c=Wn.dot(Qn),u=qn.dot(Qn);if(c>=0&&u<=c)return t.copy(a);var h=s*u-c*l;if(h<=0&&s>=0&&c<=0)return r=s/(s-c),t.copy(i).addScaledVector(Wn,r);Zn.subVectors(e,o);var d=Wn.dot(Zn),p=qn.dot(Zn);if(p>=0&&d<=p)return t.copy(o);var f=d*l-s*p;if(f<=0&&l>=0&&p<=0)return n=l/(l-p),t.copy(i).addScaledVector(qn,n);var m=c*p-d*u;if(m<=0&&u-c>=0&&d-p>=0)return Xn.subVectors(o,a),n=(u-c)/(u-c+(d-p)),t.copy(a).addScaledVector(Xn,n);var v=1/(m+f+h);return r=f*v,n=h*v,t.copy(i).addScaledVector(Wn,r).addScaledVector(qn,n)},equals:function(e){return e.a.equals(this.a)&&e.b.equals(this.b)&&e.c.equals(this.c)}});var Kn={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},$n={h:0,s:0,l:0},ei={h:0,s:0,l:0};function ti(e,t,r){return void 0===t&&void 0===r?this.set(e):this.setRGB(e,t,r)}function ri(e,t,r){return r<0&&(r+=1),r>1&&(r-=1),r<1/6?e+6*(t-e)*r:r<.5?t:r<2/3?e+6*(t-e)*(2/3-r):e}function ni(e){return e<.04045?.0773993808*e:Math.pow(.9478672986*e+.0521327014,2.4)}function ii(e){return e<.0031308?12.92*e:1.055*Math.pow(e,.41666)-.055}function ai(e,t,r,n,i,a){this.a=e,this.b=t,this.c=r,this.normal=n&&n.isVector3?n:new Rr,this.vertexNormals=Array.isArray(n)?n:[],this.color=i&&i.isColor?i:new ti,this.vertexColors=Array.isArray(i)?i:[],this.materialIndex=void 0!==a?a:0}Object.assign(ti.prototype,{isColor:!0,r:1,g:1,b:1,set:function(e){return e&&e.isColor?this.copy(e):"number"==typeof e?this.setHex(e):"string"==typeof e&&this.setStyle(e),this},setScalar:function(e){return this.r=e,this.g=e,this.b=e,this},setHex:function(e){return e=Math.floor(e),this.r=(e>>16&255)/255,this.g=(e>>8&255)/255,this.b=(255&e)/255,this},setRGB:function(e,t,r){return this.r=e,this.g=t,this.b=r,this},setHSL:function(e,t,r){if(e=_r.euclideanModulo(e,1),t=_r.clamp(t,0,1),r=_r.clamp(r,0,1),0===t)this.r=this.g=this.b=r;else{var n=r<=.5?r*(1+t):r+t-r*t,i=2*r-n;this.r=ri(i,n,e+1/3),this.g=ri(i,n,e),this.b=ri(i,n,e-1/3)}return this},setStyle:function(e){function t(t){void 0!==t&&parseFloat(t)<1&&console.warn("THREE.Color: Alpha component of "+e+" will be ignored.")}var r;if(r=/^((?:rgb|hsl)a?)\(\s*([^\)]*)\)/.exec(e)){var n,i=r[1],a=r[2];switch(i){case"rgb":case"rgba":if(n=/^(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(,\s*([0-9]*\.?[0-9]+)\s*)?$/.exec(a))return this.r=Math.min(255,parseInt(n[1],10))/255,this.g=Math.min(255,parseInt(n[2],10))/255,this.b=Math.min(255,parseInt(n[3],10))/255,t(n[5]),this;if(n=/^(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(,\s*([0-9]*\.?[0-9]+)\s*)?$/.exec(a))return this.r=Math.min(100,parseInt(n[1],10))/100,this.g=Math.min(100,parseInt(n[2],10))/100,this.b=Math.min(100,parseInt(n[3],10))/100,t(n[5]),this;break;case"hsl":case"hsla":if(n=/^([0-9]*\.?[0-9]+)\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(,\s*([0-9]*\.?[0-9]+)\s*)?$/.exec(a)){var o=parseFloat(n[1])/360,s=parseInt(n[2],10)/100,l=parseInt(n[3],10)/100;return t(n[5]),this.setHSL(o,s,l)}}}else if(r=/^\#([A-Fa-f0-9]+)$/.exec(e)){var c=r[1],u=c.length;if(3===u)return this.r=parseInt(c.charAt(0)+c.charAt(0),16)/255,this.g=parseInt(c.charAt(1)+c.charAt(1),16)/255,this.b=parseInt(c.charAt(2)+c.charAt(2),16)/255,this;if(6===u)return this.r=parseInt(c.charAt(0)+c.charAt(1),16)/255,this.g=parseInt(c.charAt(2)+c.charAt(3),16)/255,this.b=parseInt(c.charAt(4)+c.charAt(5),16)/255,this}return e&&e.length>0?this.setColorName(e):this},setColorName:function(e){var t=Kn[e];return void 0!==t?this.setHex(t):console.warn("THREE.Color: Unknown color "+e),this},clone:function(){return new this.constructor(this.r,this.g,this.b)},copy:function(e){return this.r=e.r,this.g=e.g,this.b=e.b,this},copyGammaToLinear:function(e,t){return void 0===t&&(t=2),this.r=Math.pow(e.r,t),this.g=Math.pow(e.g,t),this.b=Math.pow(e.b,t),this},copyLinearToGamma:function(e,t){void 0===t&&(t=2);var r=t>0?1/t:1;return this.r=Math.pow(e.r,r),this.g=Math.pow(e.g,r),this.b=Math.pow(e.b,r),this},convertGammaToLinear:function(e){return this.copyGammaToLinear(this,e),this},convertLinearToGamma:function(e){return this.copyLinearToGamma(this,e),this},copySRGBToLinear:function(e){return this.r=ni(e.r),this.g=ni(e.g),this.b=ni(e.b),this},copyLinearToSRGB:function(e){return this.r=ii(e.r),this.g=ii(e.g),this.b=ii(e.b),this},convertSRGBToLinear:function(){return this.copySRGBToLinear(this),this},convertLinearToSRGB:function(){return this.copyLinearToSRGB(this),this},getHex:function(){return 255*this.r<<16^255*this.g<<8^255*this.b<<0},getHexString:function(){return("000000"+this.getHex().toString(16)).slice(-6)},getHSL:function(e){void 0===e&&(console.warn("THREE.Color: .getHSL() target is now required"),e={h:0,s:0,l:0});var t,r,n=this.r,i=this.g,a=this.b,o=Math.max(n,i,a),s=Math.min(n,i,a),l=(s+o)/2;if(s===o)t=0,r=0;else{var c=o-s;switch(r=l<=.5?c/(o+s):c/(2-o-s),o){case n:t=(i-a)/c+(i<a?6:0);break;case i:t=(a-n)/c+2;break;case a:t=(n-i)/c+4}t/=6}return e.h=t,e.s=r,e.l=l,e},getStyle:function(){return"rgb("+(255*this.r|0)+","+(255*this.g|0)+","+(255*this.b|0)+")"},offsetHSL:function(e,t,r){return this.getHSL($n),$n.h+=e,$n.s+=t,$n.l+=r,this.setHSL($n.h,$n.s,$n.l),this},add:function(e){return this.r+=e.r,this.g+=e.g,this.b+=e.b,this},addColors:function(e,t){return this.r=e.r+t.r,this.g=e.g+t.g,this.b=e.b+t.b,this},addScalar:function(e){return this.r+=e,this.g+=e,this.b+=e,this},sub:function(e){return this.r=Math.max(0,this.r-e.r),this.g=Math.max(0,this.g-e.g),this.b=Math.max(0,this.b-e.b),this},multiply:function(e){return this.r*=e.r,this.g*=e.g,this.b*=e.b,this},multiplyScalar:function(e){return this.r*=e,this.g*=e,this.b*=e,this},lerp:function(e,t){return this.r+=(e.r-this.r)*t,this.g+=(e.g-this.g)*t,this.b+=(e.b-this.b)*t,this},lerpHSL:function(e,t){this.getHSL($n),e.getHSL(ei);var r=_r.lerp($n.h,ei.h,t),n=_r.lerp($n.s,ei.s,t),i=_r.lerp($n.l,ei.l,t);return this.setHSL(r,n,i),this},equals:function(e){return e.r===this.r&&e.g===this.g&&e.b===this.b},fromArray:function(e,t){return void 0===t&&(t=0),this.r=e[t],this.g=e[t+1],this.b=e[t+2],this},toArray:function(e,t){return void 0===e&&(e=[]),void 0===t&&(t=0),e[t]=this.r,e[t+1]=this.g,e[t+2]=this.b,e},toJSON:function(){return this.getHex()}}),ti.NAMES=Kn,Object.assign(ai.prototype,{clone:function(){return(new this.constructor).copy(this)},copy:function(e){this.a=e.a,this.b=e.b,this.c=e.c,this.normal.copy(e.normal),this.color.copy(e.color),this.materialIndex=e.materialIndex;for(var t=0,r=e.vertexNormals.length;t<r;t++)this.vertexNormals[t]=e.vertexNormals[t].clone();for(t=0,r=e.vertexColors.length;t<r;t++)this.vertexColors[t]=e.vertexColors[t].clone();return this}});var oi=0;function si(){Object.defineProperty(this,"id",{value:oi++}),this.uuid=_r.generateUUID(),this.name="",this.type="Material",this.fog=!0,this.blending=S,this.side=v,this.flatShading=!1,this.vertexTangents=!1,this.vertexColors=A,this.opacity=1,this.transparent=!1,this.blendSrc=G,this.blendDst=z,this.blendEquation=C,this.blendSrcAlpha=null,this.blendDstAlpha=null,this.blendEquationAlpha=null,this.depthFunc=Q,this.depthTest=!0,this.depthWrite=!0,this.stencilWriteMask=255,this.stencilFunc=ur,this.stencilRef=0,this.stencilFuncMask=255,this.stencilFail=Zt,this.stencilZFail=Zt,this.stencilZPass=Zt,this.stencilWrite=!1,this.clippingPlanes=null,this.clipIntersection=!1,this.clipShadows=!1,this.shadowSide=null,this.colorWrite=!0,this.precision=null,this.polygonOffset=!1,this.polygonOffsetFactor=0,this.polygonOffsetUnits=0,this.dithering=!1,this.alphaTest=0,this.premultipliedAlpha=!1,this.visible=!0,this.toneMapped=!0,this.userData={},this.version=0}function li(e){si.call(this),this.type="MeshBasicMaterial",this.color=new ti(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=ee,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.skinning=!1,this.morphTargets=!1,this.setValues(e)}si.prototype=Object.assign(Object.create(br.prototype),{constructor:si,isMaterial:!0,onBeforeCompile:function(){},setValues:function(e){if(void 0!==e)for(var t in e){var r=e[t];if(void 0!==r)if("shading"!==t){var n=this[t];void 0!==n?n&&n.isColor?n.set(r):n&&n.isVector3&&r&&r.isVector3?n.copy(r):this[t]=r:console.warn("THREE."+this.type+": '"+t+"' is not a property of this material.")}else console.warn("THREE."+this.type+": .shading has been removed. Use the boolean .flatShading instead."),this.flatShading=r===x;else console.warn("THREE.Material: '"+t+"' parameter is undefined.")}},toJSON:function(e){var t=void 0===e||"string"==typeof e;t&&(e={textures:{},images:{}});var r={metadata:{version:4.5,type:"Material",generator:"Material.toJSON"}};function n(e){var t=[];for(var r in e){var n=e[r];delete n.metadata,t.push(n)}return t}if(r.uuid=this.uuid,r.type=this.type,""!==this.name&&(r.name=this.name),this.color&&this.color.isColor&&(r.color=this.color.getHex()),void 0!==this.roughness&&(r.roughness=this.roughness),void 0!==this.metalness&&(r.metalness=this.metalness),this.sheen&&this.sheen.isColor&&(r.sheen=this.sheen.getHex()),this.emissive&&this.emissive.isColor&&(r.emissive=this.emissive.getHex()),this.emissiveIntensity&&1!==this.emissiveIntensity&&(r.emissiveIntensity=this.emissiveIntensity),this.specular&&this.specular.isColor&&(r.specular=this.specular.getHex()),void 0!==this.shininess&&(r.shininess=this.shininess),void 0!==this.clearcoat&&(r.clearcoat=this.clearcoat),void 0!==this.clearcoatRoughness&&(r.clearcoatRoughness=this.clearcoatRoughness),this.clearcoatNormalMap&&this.clearcoatNormalMap.isTexture&&(r.clearcoatNormalMap=this.clearcoatNormalMap.toJSON(e).uuid,r.clearcoatNormalScale=this.clearcoatNormalScale.toArray()),this.map&&this.map.isTexture&&(r.map=this.map.toJSON(e).uuid),this.matcap&&this.matcap.isTexture&&(r.matcap=this.matcap.toJSON(e).uuid),this.alphaMap&&this.alphaMap.isTexture&&(r.alphaMap=this.alphaMap.toJSON(e).uuid),this.lightMap&&this.lightMap.isTexture&&(r.lightMap=this.lightMap.toJSON(e).uuid),this.aoMap&&this.aoMap.isTexture&&(r.aoMap=this.aoMap.toJSON(e).uuid,r.aoMapIntensity=this.aoMapIntensity),this.bumpMap&&this.bumpMap.isTexture&&(r.bumpMap=this.bumpMap.toJSON(e).uuid,r.bumpScale=this.bumpScale),this.normalMap&&this.normalMap.isTexture&&(r.normalMap=this.normalMap.toJSON(e).uuid,r.normalMapType=this.normalMapType,r.normalScale=this.normalScale.toArray()),this.displacementMap&&this.displacementMap.isTexture&&(r.displacementMap=this.displacementMap.toJSON(e).uuid,r.displacementScale=this.displacementScale,r.displacementBias=this.displacementBias),this.roughnessMap&&this.roughnessMap.isTexture&&(r.roughnessMap=this.roughnessMap.toJSON(e).uuid),this.metalnessMap&&this.metalnessMap.isTexture&&(r.metalnessMap=this.metalnessMap.toJSON(e).uuid),this.emissiveMap&&this.emissiveMap.isTexture&&(r.emissiveMap=this.emissiveMap.toJSON(e).uuid),this.specularMap&&this.specularMap.isTexture&&(r.specularMap=this.specularMap.toJSON(e).uuid),this.envMap&&this.envMap.isTexture&&(r.envMap=this.envMap.toJSON(e).uuid,r.reflectivity=this.reflectivity,r.refractionRatio=this.refractionRatio,void 0!==this.combine&&(r.combine=this.combine),void 0!==this.envMapIntensity&&(r.envMapIntensity=this.envMapIntensity)),this.gradientMap&&this.gradientMap.isTexture&&(r.gradientMap=this.gradientMap.toJSON(e).uuid),void 0!==this.size&&(r.size=this.size),void 0!==this.sizeAttenuation&&(r.sizeAttenuation=this.sizeAttenuation),this.blending!==S&&(r.blending=this.blending),!0===this.flatShading&&(r.flatShading=this.flatShading),this.side!==v&&(r.side=this.side),this.vertexColors!==A&&(r.vertexColors=this.vertexColors),this.opacity<1&&(r.opacity=this.opacity),!0===this.transparent&&(r.transparent=this.transparent),r.depthFunc=this.depthFunc,r.depthTest=this.depthTest,r.depthWrite=this.depthWrite,r.stencilWrite=this.stencilWrite,r.stencilWriteMask=this.stencilWriteMask,r.stencilFunc=this.stencilFunc,r.stencilRef=this.stencilRef,r.stencilFuncMask=this.stencilFuncMask,r.stencilFail=this.stencilFail,r.stencilZFail=this.stencilZFail,r.stencilZPass=this.stencilZPass,this.rotation&&0!==this.rotation&&(r.rotation=this.rotation),!0===this.polygonOffset&&(r.polygonOffset=!0),0!==this.polygonOffsetFactor&&(r.polygonOffsetFactor=this.polygonOffsetFactor),0!==this.polygonOffsetUnits&&(r.polygonOffsetUnits=this.polygonOffsetUnits),this.linewidth&&1!==this.linewidth&&(r.linewidth=this.linewidth),void 0!==this.dashSize&&(r.dashSize=this.dashSize),void 0!==this.gapSize&&(r.gapSize=this.gapSize),void 0!==this.scale&&(r.scale=this.scale),!0===this.dithering&&(r.dithering=!0),this.alphaTest>0&&(r.alphaTest=this.alphaTest),!0===this.premultipliedAlpha&&(r.premultipliedAlpha=this.premultipliedAlpha),!0===this.wireframe&&(r.wireframe=this.wireframe),this.wireframeLinewidth>1&&(r.wireframeLinewidth=this.wireframeLinewidth),"round"!==this.wireframeLinecap&&(r.wireframeLinecap=this.wireframeLinecap),"round"!==this.wireframeLinejoin&&(r.wireframeLinejoin=this.wireframeLinejoin),!0===this.morphTargets&&(r.morphTargets=!0),!0===this.morphNormals&&(r.morphNormals=!0),!0===this.skinning&&(r.skinning=!0),!1===this.visible&&(r.visible=!1),!1===this.toneMapped&&(r.toneMapped=!1),"{}"!==JSON.stringify(this.userData)&&(r.userData=this.userData),t){var i=n(e.textures),a=n(e.images);i.length>0&&(r.textures=i),a.length>0&&(r.images=a)}return r},clone:function(){return(new this.constructor).copy(this)},copy:function(e){this.name=e.name,this.fog=e.fog,this.blending=e.blending,this.side=e.side,this.flatShading=e.flatShading,this.vertexTangents=e.vertexTangents,this.vertexColors=e.vertexColors,this.opacity=e.opacity,this.transparent=e.transparent,this.blendSrc=e.blendSrc,this.blendDst=e.blendDst,this.blendEquation=e.blendEquation,this.blendSrcAlpha=e.blendSrcAlpha,this.blendDstAlpha=e.blendDstAlpha,this.blendEquationAlpha=e.blendEquationAlpha,this.depthFunc=e.depthFunc,this.depthTest=e.depthTest,this.depthWrite=e.depthWrite,this.stencilWriteMask=e.stencilWriteMask,this.stencilFunc=e.stencilFunc,this.stencilRef=e.stencilRef,this.stencilFuncMask=e.stencilFuncMask,this.stencilFail=e.stencilFail,this.stencilZFail=e.stencilZFail,this.stencilZPass=e.stencilZPass,this.stencilWrite=e.stencilWrite;var t=e.clippingPlanes,r=null;if(null!==t){var n=t.length;r=new Array(n);for(var i=0;i!==n;++i)r[i]=t[i].clone()}return this.clippingPlanes=r,this.clipIntersection=e.clipIntersection,this.clipShadows=e.clipShadows,this.shadowSide=e.shadowSide,this.colorWrite=e.colorWrite,this.precision=e.precision,this.polygonOffset=e.polygonOffset,this.polygonOffsetFactor=e.polygonOffsetFactor,this.polygonOffsetUnits=e.polygonOffsetUnits,this.dithering=e.dithering,this.alphaTest=e.alphaTest,this.premultipliedAlpha=e.premultipliedAlpha,this.visible=e.visible,this.toneMapped=e.toneMapped,this.userData=JSON.parse(JSON.stringify(e.userData)),this},dispose:function(){this.dispatchEvent({type:"dispose"})}}),Object.defineProperty(si.prototype,"needsUpdate",{set:function(e){!0===e&&this.version++}}),li.prototype=Object.create(si.prototype),li.prototype.constructor=li,li.prototype.isMeshBasicMaterial=!0,li.prototype.copy=function(e){return si.prototype.copy.call(this,e),this.color.copy(e.color),this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.combine=e.combine,this.reflectivity=e.reflectivity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.skinning=e.skinning,this.morphTargets=e.morphTargets,this};var ci=new Rr;function ui(e,t,r){if(Array.isArray(e))throw new TypeError("THREE.BufferAttribute: array should be a Typed Array.");this.name="",this.array=e,this.itemSize=t,this.count=void 0!==e?e.length/t:0,this.normalized=!0===r,this.usage=hr,this.updateRange={offset:0,count:-1},this.version=0}function hi(e,t,r){ui.call(this,new Int8Array(e),t,r)}function di(e,t,r){ui.call(this,new Uint8Array(e),t,r)}function pi(e,t,r){ui.call(this,new Uint8ClampedArray(e),t,r)}function fi(e,t,r){ui.call(this,new Int16Array(e),t,r)}function mi(e,t,r){ui.call(this,new Uint16Array(e),t,r)}function vi(e,t,r){ui.call(this,new Int32Array(e),t,r)}function gi(e,t,r){ui.call(this,new Uint32Array(e),t,r)}function yi(e,t,r){ui.call(this,new Float32Array(e),t,r)}function xi(e,t,r){ui.call(this,new Float64Array(e),t,r)}function bi(){this.vertices=[],this.normals=[],this.colors=[],this.uvs=[],this.uvs2=[],this.groups=[],this.morphTargets={},this.skinWeights=[],this.skinIndices=[],this.boundingBox=null,this.boundingSphere=null,this.verticesNeedUpdate=!1,this.normalsNeedUpdate=!1,this.colorsNeedUpdate=!1,this.uvsNeedUpdate=!1,this.groupsNeedUpdate=!1}function Ai(e){if(0===e.length)return-1/0;for(var t=e[0],r=1,n=e.length;r<n;++r)e[r]>t&&(t=e[r]);return t}Object.defineProperty(ui.prototype,"needsUpdate",{set:function(e){!0===e&&this.version++}}),Object.assign(ui.prototype,{isBufferAttribute:!0,onUploadCallback:function(){},setUsage:function(e){return this.usage=e,this},copy:function(e){return this.name=e.name,this.array=new e.array.constructor(e.array),this.itemSize=e.itemSize,this.count=e.count,this.normalized=e.normalized,this.usage=e.usage,this},copyAt:function(e,t,r){e*=this.itemSize,r*=t.itemSize;for(var n=0,i=this.itemSize;n<i;n++)this.array[e+n]=t.array[r+n];return this},copyArray:function(e){return this.array.set(e),this},copyColorsArray:function(e){for(var t=this.array,r=0,n=0,i=e.length;n<i;n++){var a=e[n];void 0===a&&(console.warn("THREE.BufferAttribute.copyColorsArray(): color is undefined",n),a=new ti),t[r++]=a.r,t[r++]=a.g,t[r++]=a.b}return this},copyVector2sArray:function(e){for(var t=this.array,r=0,n=0,i=e.length;n<i;n++){var a=e[n];void 0===a&&(console.warn("THREE.BufferAttribute.copyVector2sArray(): vector is undefined",n),a=new Mr),t[r++]=a.x,t[r++]=a.y}return this},copyVector3sArray:function(e){for(var t=this.array,r=0,n=0,i=e.length;n<i;n++){var a=e[n];void 0===a&&(console.warn("THREE.BufferAttribute.copyVector3sArray(): vector is undefined",n),a=new Rr),t[r++]=a.x,t[r++]=a.y,t[r++]=a.z}return this},copyVector4sArray:function(e){for(var t=this.array,r=0,n=0,i=e.length;n<i;n++){var a=e[n];void 0===a&&(console.warn("THREE.BufferAttribute.copyVector4sArray(): vector is undefined",n),a=new Br),t[r++]=a.x,t[r++]=a.y,t[r++]=a.z,t[r++]=a.w}return this},applyMatrix3:function(e){for(var t=0,r=this.count;t<r;t++)ci.x=this.getX(t),ci.y=this.getY(t),ci.z=this.getZ(t),ci.applyMatrix3(e),this.setXYZ(t,ci.x,ci.y,ci.z);return this},applyMatrix4:function(e){for(var t=0,r=this.count;t<r;t++)ci.x=this.getX(t),ci.y=this.getY(t),ci.z=this.getZ(t),ci.applyMatrix4(e),this.setXYZ(t,ci.x,ci.y,ci.z);return this},applyNormalMatrix:function(e){for(var t=0,r=this.count;t<r;t++)ci.x=this.getX(t),ci.y=this.getY(t),ci.z=this.getZ(t),ci.applyNormalMatrix(e),this.setXYZ(t,ci.x,ci.y,ci.z);return this},transformDirection:function(e){for(var t=0,r=this.count;t<r;t++)ci.x=this.getX(t),ci.y=this.getY(t),ci.z=this.getZ(t),ci.transformDirection(e),this.setXYZ(t,ci.x,ci.y,ci.z);return this},set:function(e,t){return void 0===t&&(t=0),this.array.set(e,t),this},getX:function(e){return this.array[e*this.itemSize]},setX:function(e,t){return this.array[e*this.itemSize]=t,this},getY:function(e){return this.array[e*this.itemSize+1]},setY:function(e,t){return this.array[e*this.itemSize+1]=t,this},getZ:function(e){return this.array[e*this.itemSize+2]},setZ:function(e,t){return this.array[e*this.itemSize+2]=t,this},getW:function(e){return this.array[e*this.itemSize+3]},setW:function(e,t){return this.array[e*this.itemSize+3]=t,this},setXY:function(e,t,r){return e*=this.itemSize,this.array[e+0]=t,this.array[e+1]=r,this},setXYZ:function(e,t,r,n){return e*=this.itemSize,this.array[e+0]=t,this.array[e+1]=r,this.array[e+2]=n,this},setXYZW:function(e,t,r,n,i){return e*=this.itemSize,this.array[e+0]=t,this.array[e+1]=r,this.array[e+2]=n,this.array[e+3]=i,this},onUpload:function(e){return this.onUploadCallback=e,this},clone:function(){return new this.constructor(this.array,this.itemSize).copy(this)},toJSON:function(){return{itemSize:this.itemSize,type:this.array.constructor.name,array:Array.prototype.slice.call(this.array),normalized:this.normalized}}}),hi.prototype=Object.create(ui.prototype),hi.prototype.constructor=hi,di.prototype=Object.create(ui.prototype),di.prototype.constructor=di,pi.prototype=Object.create(ui.prototype),pi.prototype.constructor=pi,fi.prototype=Object.create(ui.prototype),fi.prototype.constructor=fi,mi.prototype=Object.create(ui.prototype),mi.prototype.constructor=mi,vi.prototype=Object.create(ui.prototype),vi.prototype.constructor=vi,gi.prototype=Object.create(ui.prototype),gi.prototype.constructor=gi,yi.prototype=Object.create(ui.prototype),yi.prototype.constructor=yi,xi.prototype=Object.create(ui.prototype),xi.prototype.constructor=xi,Object.assign(bi.prototype,{computeGroups:function(e){for(var t,r=[],n=void 0,i=e.faces,a=0;a<i.length;a++){var o=i[a];o.materialIndex!==n&&(n=o.materialIndex,void 0!==t&&(t.count=3*a-t.start,r.push(t)),t={start:3*a,materialIndex:n})}void 0!==t&&(t.count=3*a-t.start,r.push(t)),this.groups=r},fromGeometry:function(e){var t,r=e.faces,n=e.vertices,i=e.faceVertexUvs,a=i[0]&&i[0].length>0,o=i[1]&&i[1].length>0,s=e.morphTargets,l=s.length;if(l>0){t=[];for(var c=0;c<l;c++)t[c]={name:s[c].name,data:[]};this.morphTargets.position=t}var u,h=e.morphNormals,d=h.length;if(d>0){u=[];for(c=0;c<d;c++)u[c]={name:h[c].name,data:[]};this.morphTargets.normal=u}var p=e.skinIndices,f=e.skinWeights,m=p.length===n.length,v=f.length===n.length;n.length>0&&0===r.length&&console.error("THREE.DirectGeometry: Faceless geometries are not supported.");for(c=0;c<r.length;c++){var g=r[c];this.vertices.push(n[g.a],n[g.b],n[g.c]);var y=g.vertexNormals;if(3===y.length)this.normals.push(y[0],y[1],y[2]);else{var x=g.normal;this.normals.push(x,x,x)}var b,A=g.vertexColors;if(3===A.length)this.colors.push(A[0],A[1],A[2]);else{var w=g.color;this.colors.push(w,w,w)}if(!0===a)void 0!==(b=i[0][c])?this.uvs.push(b[0],b[1],b[2]):(console.warn("THREE.DirectGeometry.fromGeometry(): Undefined vertexUv ",c),this.uvs.push(new Mr,new Mr,new Mr));if(!0===o)void 0!==(b=i[1][c])?this.uvs2.push(b[0],b[1],b[2]):(console.warn("THREE.DirectGeometry.fromGeometry(): Undefined vertexUv2 ",c),this.uvs2.push(new Mr,new Mr,new Mr));for(var _=0;_<l;_++){var M=s[_].vertices;t[_].data.push(M[g.a],M[g.b],M[g.c])}for(_=0;_<d;_++){var S=h[_].vertexNormals[c];u[_].data.push(S.a,S.b,S.c)}m&&this.skinIndices.push(p[g.a],p[g.b],p[g.c]),v&&this.skinWeights.push(f[g.a],f[g.b],f[g.c])}return this.computeGroups(e),this.verticesNeedUpdate=e.verticesNeedUpdate,this.normalsNeedUpdate=e.normalsNeedUpdate,this.colorsNeedUpdate=e.colorsNeedUpdate,this.uvsNeedUpdate=e.uvsNeedUpdate,this.groupsNeedUpdate=e.groupsNeedUpdate,null!==e.boundingSphere&&(this.boundingSphere=e.boundingSphere.clone()),null!==e.boundingBox&&(this.boundingBox=e.boundingBox.clone()),this}});var wi=1,_i=new Wr,Mi=new un,Si=new Rr,Ei=new Sn,Ti=new Sn,Ri=new Rr;function Li(){Object.defineProperty(this,"id",{value:wi+=2}),this.uuid=_r.generateUUID(),this.name="",this.type="BufferGeometry",this.index=null,this.attributes={},this.morphAttributes={},this.morphTargetsRelative=!1,this.groups=[],this.boundingBox=null,this.boundingSphere=null,this.drawRange={start:0,count:1/0},this.userData={}}Li.prototype=Object.assign(Object.create(br.prototype),{constructor:Li,isBufferGeometry:!0,getIndex:function(){return this.index},setIndex:function(e){Array.isArray(e)?this.index=new(Ai(e)>65535?gi:mi)(e,1):this.index=e},getAttribute:function(e){return this.attributes[e]},setAttribute:function(e,t){return this.attributes[e]=t,this},deleteAttribute:function(e){return delete this.attributes[e],this},addGroup:function(e,t,r){this.groups.push({start:e,count:t,materialIndex:void 0!==r?r:0})},clearGroups:function(){this.groups=[]},setDrawRange:function(e,t){this.drawRange.start=e,this.drawRange.count=t},applyMatrix:function(e){var t=this.attributes.position;void 0!==t&&(t.applyMatrix4(e),t.needsUpdate=!0);var r=this.attributes.normal;if(void 0!==r){var n=(new Pr).getNormalMatrix(e);r.applyNormalMatrix(n),r.needsUpdate=!0}var i=this.attributes.tangent;return void 0!==i&&(i.transformDirection(e),i.needsUpdate=!0),null!==this.boundingBox&&this.computeBoundingBox(),null!==this.boundingSphere&&this.computeBoundingSphere(),this},rotateX:function(e){return _i.makeRotationX(e),this.applyMatrix(_i),this},rotateY:function(e){return _i.makeRotationY(e),this.applyMatrix(_i),this},rotateZ:function(e){return _i.makeRotationZ(e),this.applyMatrix(_i),this},translate:function(e,t,r){return _i.makeTranslation(e,t,r),this.applyMatrix(_i),this},scale:function(e,t,r){return _i.makeScale(e,t,r),this.applyMatrix(_i),this},lookAt:function(e){return Mi.lookAt(e),Mi.updateMatrix(),this.applyMatrix(Mi.matrix),this},center:function(){return this.computeBoundingBox(),this.boundingBox.getCenter(Si).negate(),this.translate(Si.x,Si.y,Si.z),this},setFromObject:function(e){var t=e.geometry;if(e.isPoints||e.isLine){var r=new yi(3*t.vertices.length,3),n=new yi(3*t.colors.length,3);if(this.setAttribute("position",r.copyVector3sArray(t.vertices)),this.setAttribute("color",n.copyColorsArray(t.colors)),t.lineDistances&&t.lineDistances.length===t.vertices.length){var i=new yi(t.lineDistances.length,1);this.setAttribute("lineDistance",i.copyArray(t.lineDistances))}null!==t.boundingSphere&&(this.boundingSphere=t.boundingSphere.clone()),null!==t.boundingBox&&(this.boundingBox=t.boundingBox.clone())}else e.isMesh&&t&&t.isGeometry&&this.fromGeometry(t);return this},setFromPoints:function(e){for(var t=[],r=0,n=e.length;r<n;r++){var i=e[r];t.push(i.x,i.y,i.z||0)}return this.setAttribute("position",new yi(t,3)),this},updateFromObject:function(e){var t,r=e.geometry;if(e.isMesh){var n=r.__directGeometry;if(!0===r.elementsNeedUpdate&&(n=void 0,r.elementsNeedUpdate=!1),void 0===n)return this.fromGeometry(r);n.verticesNeedUpdate=r.verticesNeedUpdate,n.normalsNeedUpdate=r.normalsNeedUpdate,n.colorsNeedUpdate=r.colorsNeedUpdate,n.uvsNeedUpdate=r.uvsNeedUpdate,n.groupsNeedUpdate=r.groupsNeedUpdate,r.verticesNeedUpdate=!1,r.normalsNeedUpdate=!1,r.colorsNeedUpdate=!1,r.uvsNeedUpdate=!1,r.groupsNeedUpdate=!1,r=n}return!0===r.verticesNeedUpdate&&(void 0!==(t=this.attributes.position)&&(t.copyVector3sArray(r.vertices),t.needsUpdate=!0),r.verticesNeedUpdate=!1),!0===r.normalsNeedUpdate&&(void 0!==(t=this.attributes.normal)&&(t.copyVector3sArray(r.normals),t.needsUpdate=!0),r.normalsNeedUpdate=!1),!0===r.colorsNeedUpdate&&(void 0!==(t=this.attributes.color)&&(t.copyColorsArray(r.colors),t.needsUpdate=!0),r.colorsNeedUpdate=!1),r.uvsNeedUpdate&&(void 0!==(t=this.attributes.uv)&&(t.copyVector2sArray(r.uvs),t.needsUpdate=!0),r.uvsNeedUpdate=!1),r.lineDistancesNeedUpdate&&(void 0!==(t=this.attributes.lineDistance)&&(t.copyArray(r.lineDistances),t.needsUpdate=!0),r.lineDistancesNeedUpdate=!1),r.groupsNeedUpdate&&(r.computeGroups(e.geometry),this.groups=r.groups,r.groupsNeedUpdate=!1),this},fromGeometry:function(e){return e.__directGeometry=(new bi).fromGeometry(e),this.fromDirectGeometry(e.__directGeometry)},fromDirectGeometry:function(e){var t=new Float32Array(3*e.vertices.length);if(this.setAttribute("position",new ui(t,3).copyVector3sArray(e.vertices)),e.normals.length>0){var r=new Float32Array(3*e.normals.length);this.setAttribute("normal",new ui(r,3).copyVector3sArray(e.normals))}if(e.colors.length>0){var n=new Float32Array(3*e.colors.length);this.setAttribute("color",new ui(n,3).copyColorsArray(e.colors))}if(e.uvs.length>0){var i=new Float32Array(2*e.uvs.length);this.setAttribute("uv",new ui(i,2).copyVector2sArray(e.uvs))}if(e.uvs2.length>0){var a=new Float32Array(2*e.uvs2.length);this.setAttribute("uv2",new ui(a,2).copyVector2sArray(e.uvs2))}for(var o in this.groups=e.groups,e.morphTargets){for(var s=[],l=e.morphTargets[o],c=0,u=l.length;c<u;c++){var h=l[c],d=new yi(3*h.data.length,3);d.name=h.name,s.push(d.copyVector3sArray(h.data))}this.morphAttributes[o]=s}if(e.skinIndices.length>0){var p=new yi(4*e.skinIndices.length,4);this.setAttribute("skinIndex",p.copyVector4sArray(e.skinIndices))}if(e.skinWeights.length>0){var f=new yi(4*e.skinWeights.length,4);this.setAttribute("skinWeight",f.copyVector4sArray(e.skinWeights))}return null!==e.boundingSphere&&(this.boundingSphere=e.boundingSphere.clone()),null!==e.boundingBox&&(this.boundingBox=e.boundingBox.clone()),this},computeBoundingBox:function(){null===this.boundingBox&&(this.boundingBox=new Sn);var e=this.attributes.position,t=this.morphAttributes.position;if(void 0!==e){if(this.boundingBox.setFromBufferAttribute(e),t)for(var r=0,n=t.length;r<n;r++){var i=t[r];Ei.setFromBufferAttribute(i),this.morphTargetsRelative?(Ri.addVectors(this.boundingBox.min,Ei.min),this.boundingBox.expandByPoint(Ri),Ri.addVectors(this.boundingBox.max,Ei.max),this.boundingBox.expandByPoint(Ri)):(this.boundingBox.expandByPoint(Ei.min),this.boundingBox.expandByPoint(Ei.max))}}else this.boundingBox.makeEmpty();(isNaN(this.boundingBox.min.x)||isNaN(this.boundingBox.min.y)||isNaN(this.boundingBox.min.z))&&console.error('THREE.BufferGeometry.computeBoundingBox: Computed min/max have NaN values. The "position" attribute is likely to have NaN values.',this)},computeBoundingSphere:function(){null===this.boundingSphere&&(this.boundingSphere=new Rn);var e=this.attributes.position,t=this.morphAttributes.position;if(e){var r=this.boundingSphere.center;if(Ei.setFromBufferAttribute(e),t)for(var n=0,i=t.length;n<i;n++){var a=t[n];Ti.setFromBufferAttribute(a),this.morphTargetsRelative?(Ri.addVectors(Ei.min,Ti.min),Ei.expandByPoint(Ri),Ri.addVectors(Ei.max,Ti.max),Ei.expandByPoint(Ri)):(Ei.expandByPoint(Ti.min),Ei.expandByPoint(Ti.max))}Ei.getCenter(r);var o=0;for(n=0,i=e.count;n<i;n++)Ri.fromBufferAttribute(e,n),o=Math.max(o,r.distanceToSquared(Ri));if(t)for(n=0,i=t.length;n<i;n++){a=t[n];for(var s=this.morphTargetsRelative,l=0,c=a.count;l<c;l++)Ri.fromBufferAttribute(a,l),s&&(Si.fromBufferAttribute(e,l),Ri.add(Si)),o=Math.max(o,r.distanceToSquared(Ri))}this.boundingSphere.radius=Math.sqrt(o),isNaN(this.boundingSphere.radius)&&console.error('THREE.BufferGeometry.computeBoundingSphere(): Computed radius is NaN. The "position" attribute is likely to have NaN values.',this)}},computeFaceNormals:function(){},computeVertexNormals:function(){var e=this.index,t=this.attributes;if(t.position){var r=t.position.array;if(void 0===t.normal)this.setAttribute("normal",new ui(new Float32Array(r.length),3));else for(var n=t.normal.array,i=0,a=n.length;i<a;i++)n[i]=0;var o,s,l,c=t.normal.array,u=new Rr,h=new Rr,d=new Rr,p=new Rr,f=new Rr;if(e){var m=e.array;for(i=0,a=e.count;i<a;i+=3)o=3*m[i+0],s=3*m[i+1],l=3*m[i+2],u.fromArray(r,o),h.fromArray(r,s),d.fromArray(r,l),p.subVectors(d,h),f.subVectors(u,h),p.cross(f),c[o]+=p.x,c[o+1]+=p.y,c[o+2]+=p.z,c[s]+=p.x,c[s+1]+=p.y,c[s+2]+=p.z,c[l]+=p.x,c[l+1]+=p.y,c[l+2]+=p.z}else for(i=0,a=r.length;i<a;i+=9)u.fromArray(r,i),h.fromArray(r,i+3),d.fromArray(r,i+6),p.subVectors(d,h),f.subVectors(u,h),p.cross(f),c[i]=p.x,c[i+1]=p.y,c[i+2]=p.z,c[i+3]=p.x,c[i+4]=p.y,c[i+5]=p.z,c[i+6]=p.x,c[i+7]=p.y,c[i+8]=p.z;this.normalizeNormals(),t.normal.needsUpdate=!0}},merge:function(e,t){if(e&&e.isBufferGeometry){void 0===t&&(t=0,console.warn("THREE.BufferGeometry.merge(): Overwriting original geometry, starting at offset=0. Use BufferGeometryUtils.mergeBufferGeometries() for lossless merge."));var r=this.attributes;for(var n in r)if(void 0!==e.attributes[n])for(var i=r[n].array,a=e.attributes[n],o=a.array,s=a.itemSize*t,l=Math.min(o.length,i.length-s),c=0,u=s;c<l;c++,u++)i[u]=o[c];return this}console.error("THREE.BufferGeometry.merge(): geometry not an instance of THREE.BufferGeometry.",e)},normalizeNormals:function(){for(var e=this.attributes.normal,t=0,r=e.count;t<r;t++)Ri.x=e.getX(t),Ri.y=e.getY(t),Ri.z=e.getZ(t),Ri.normalize(),e.setXYZ(t,Ri.x,Ri.y,Ri.z)},toNonIndexed:function(){function e(e,t){for(var r=e.array,n=e.itemSize,i=new r.constructor(t.length*n),a=0,o=0,s=0,l=t.length;s<l;s++){a=t[s]*n;for(var c=0;c<n;c++)i[o++]=r[a++]}return new ui(i,n)}if(null===this.index)return console.warn("THREE.BufferGeometry.toNonIndexed(): Geometry is already non-indexed."),this;var t=new Li,r=this.index.array,n=this.attributes;for(var i in n){var a=e(n[i],r);t.setAttribute(i,a)}var o=this.morphAttributes;for(i in o){for(var s=[],l=o[i],c=0,u=l.length;c<u;c++){a=e(l[c],r);s.push(a)}t.morphAttributes[i]=s}t.morphTargetsRelative=this.morphTargetsRelative;for(var h=this.groups,d=(c=0,h.length);c<d;c++){var p=h[c];t.addGroup(p.start,p.count,p.materialIndex)}return t},toJSON:function(){var e={metadata:{version:4.5,type:"BufferGeometry",generator:"BufferGeometry.toJSON"}};if(e.uuid=this.uuid,e.type=this.type,""!==this.name&&(e.name=this.name),Object.keys(this.userData).length>0&&(e.userData=this.userData),void 0!==this.parameters){var t=this.parameters;for(var r in t)void 0!==t[r]&&(e[r]=t[r]);return e}e.data={attributes:{}};var n=this.index;null!==n&&(e.data.index={type:n.array.constructor.name,array:Array.prototype.slice.call(n.array)});var i=this.attributes;for(var r in i){var a=(d=i[r]).toJSON();""!==d.name&&(a.name=d.name),e.data.attributes[r]=a}var o={},s=!1;for(var r in this.morphAttributes){for(var l=this.morphAttributes[r],c=[],u=0,h=l.length;u<h;u++){var d;a=(d=l[u]).toJSON();""!==d.name&&(a.name=d.name),c.push(a)}c.length>0&&(o[r]=c,s=!0)}s&&(e.data.morphAttributes=o,e.data.morphTargetsRelative=this.morphTargetsRelative);var p=this.groups;p.length>0&&(e.data.groups=JSON.parse(JSON.stringify(p)));var f=this.boundingSphere;return null!==f&&(e.data.boundingSphere={center:f.center.toArray(),radius:f.radius}),e},clone:function(){return(new Li).copy(this)},copy:function(e){var t,r,n;this.index=null,this.attributes={},this.morphAttributes={},this.groups=[],this.boundingBox=null,this.boundingSphere=null,this.name=e.name;var i=e.index;null!==i&&this.setIndex(i.clone());var a=e.attributes;for(t in a){var o=a[t];this.setAttribute(t,o.clone())}var s=e.morphAttributes;for(t in s){var l=[],c=s[t];for(r=0,n=c.length;r<n;r++)l.push(c[r].clone());this.morphAttributes[t]=l}this.morphTargetsRelative=e.morphTargetsRelative;var u=e.groups;for(r=0,n=u.length;r<n;r++){var h=u[r];this.addGroup(h.start,h.count,h.materialIndex)}var d=e.boundingBox;null!==d&&(this.boundingBox=d.clone());var p=e.boundingSphere;return null!==p&&(this.boundingSphere=p.clone()),this.drawRange.start=e.drawRange.start,this.drawRange.count=e.drawRange.count,this.userData=e.userData,this},dispose:function(){this.dispatchEvent({type:"dispose"})}});var Ci=new Wr,Pi=new Fn,Di=new Rn,Ii=new Rr,Oi=new Rr,Bi=new Rr,Fi=new Rr,Ui=new Rr,Ni=new Rr,Gi=new Rr,zi=new Rr,ki=new Rr,Hi=new Mr,Vi=new Mr,ji=new Mr,Wi=new Rr,qi=new Rr;function Xi(e,t){un.call(this),this.type="Mesh",this.geometry=void 0!==e?e:new Li,this.material=void 0!==t?t:new li({color:16777215*Math.random()}),this.updateMorphTargets()}function Yi(e,t,r,n,i,a,o,s){if(null===(t.side===g?n.intersectTriangle(o,a,i,!0,s):n.intersectTriangle(i,a,o,t.side!==y,s)))return null;qi.copy(s),qi.applyMatrix4(e.matrixWorld);var l=r.ray.origin.distanceTo(qi);return l<r.near||l>r.far?null:{distance:l,point:qi.clone(),object:e}}function Qi(e,t,r,n,i,a,o,s,l,c,u,h){Ii.fromBufferAttribute(i,c),Oi.fromBufferAttribute(i,u),Bi.fromBufferAttribute(i,h);var d=e.morphTargetInfluences;if(t.morphTargets&&a&&d){Gi.set(0,0,0),zi.set(0,0,0),ki.set(0,0,0);for(var p=0,f=a.length;p<f;p++){var m=d[p],v=a[p];0!==m&&(Fi.fromBufferAttribute(v,c),Ui.fromBufferAttribute(v,u),Ni.fromBufferAttribute(v,h),o?(Gi.addScaledVector(Fi,m),zi.addScaledVector(Ui,m),ki.addScaledVector(Ni,m)):(Gi.addScaledVector(Fi.sub(Ii),m),zi.addScaledVector(Ui.sub(Oi),m),ki.addScaledVector(Ni.sub(Bi),m)))}Ii.add(Gi),Oi.add(zi),Bi.add(ki)}var g=Yi(e,t,r,n,Ii,Oi,Bi,Wi);if(g){s&&(Hi.fromBufferAttribute(s,c),Vi.fromBufferAttribute(s,u),ji.fromBufferAttribute(s,h),g.uv=Jn.getUV(Wi,Ii,Oi,Bi,Hi,Vi,ji,new Mr)),l&&(Hi.fromBufferAttribute(l,c),Vi.fromBufferAttribute(l,u),ji.fromBufferAttribute(l,h),g.uv2=Jn.getUV(Wi,Ii,Oi,Bi,Hi,Vi,ji,new Mr));var y=new ai(c,u,h);Jn.getNormal(Ii,Oi,Bi,y.normal),g.face=y}return g}Xi.prototype=Object.assign(Object.create(un.prototype),{constructor:Xi,isMesh:!0,copy:function(e){return un.prototype.copy.call(this,e),void 0!==e.morphTargetInfluences&&(this.morphTargetInfluences=e.morphTargetInfluences.slice()),void 0!==e.morphTargetDictionary&&(this.morphTargetDictionary=Object.assign({},e.morphTargetDictionary)),this},updateMorphTargets:function(){var e,t,r,n=this.geometry;if(n.isBufferGeometry){var i=n.morphAttributes,a=Object.keys(i);if(a.length>0){var o=i[a[0]];if(void 0!==o)for(this.morphTargetInfluences=[],this.morphTargetDictionary={},e=0,t=o.length;e<t;e++)r=o[e].name||String(e),this.morphTargetInfluences.push(0),this.morphTargetDictionary[r]=e}}else{var s=n.morphTargets;void 0!==s&&s.length>0&&console.error("THREE.Mesh.updateMorphTargets() no longer supports THREE.Geometry. Use THREE.BufferGeometry instead.")}},raycast:function(e,t){var r,n=this.geometry,i=this.material,a=this.matrixWorld;if(void 0!==i&&(null===n.boundingSphere&&n.computeBoundingSphere(),Di.copy(n.boundingSphere),Di.applyMatrix4(a),!1!==e.ray.intersectsSphere(Di)&&(Ci.getInverse(a),Pi.copy(e.ray).applyMatrix4(Ci),null===n.boundingBox||!1!==Pi.intersectsBox(n.boundingBox))))if(n.isBufferGeometry){var o,s,l,c,u,h,d,p,f,m=n.index,v=n.attributes.position,g=n.morphAttributes.position,y=n.morphTargetsRelative,x=n.attributes.uv,b=n.attributes.uv2,A=n.groups,w=n.drawRange;if(null!==m)if(Array.isArray(i))for(c=0,h=A.length;c<h;c++)for(f=i[(p=A[c]).materialIndex],u=Math.max(p.start,w.start),d=Math.min(p.start+p.count,w.start+w.count);u<d;u+=3)o=m.getX(u),s=m.getX(u+1),l=m.getX(u+2),(r=Qi(this,f,e,Pi,v,g,y,x,b,o,s,l))&&(r.faceIndex=Math.floor(u/3),r.face.materialIndex=p.materialIndex,t.push(r));else for(c=Math.max(0,w.start),h=Math.min(m.count,w.start+w.count);c<h;c+=3)o=m.getX(c),s=m.getX(c+1),l=m.getX(c+2),(r=Qi(this,i,e,Pi,v,g,y,x,b,o,s,l))&&(r.faceIndex=Math.floor(c/3),t.push(r));else if(void 0!==v)if(Array.isArray(i))for(c=0,h=A.length;c<h;c++)for(f=i[(p=A[c]).materialIndex],u=Math.max(p.start,w.start),d=Math.min(p.start+p.count,w.start+w.count);u<d;u+=3)(r=Qi(this,f,e,Pi,v,g,y,x,b,o=u,s=u+1,l=u+2))&&(r.faceIndex=Math.floor(u/3),r.face.materialIndex=p.materialIndex,t.push(r));else for(c=Math.max(0,w.start),h=Math.min(v.count,w.start+w.count);c<h;c+=3)(r=Qi(this,i,e,Pi,v,g,y,x,b,o=c,s=c+1,l=c+2))&&(r.faceIndex=Math.floor(c/3),t.push(r))}else if(n.isGeometry){var _,M,S,E,T=Array.isArray(i),R=n.vertices,L=n.faces,C=n.faceVertexUvs[0];C.length>0&&(E=C);for(var P=0,D=L.length;P<D;P++){var I=L[P],O=T?i[I.materialIndex]:i;if(void 0!==O&&(_=R[I.a],M=R[I.b],S=R[I.c],r=Yi(this,O,e,Pi,_,M,S,Wi))){if(E&&E[P]){var B=E[P];Hi.copy(B[0]),Vi.copy(B[1]),ji.copy(B[2]),r.uv=Jn.getUV(Wi,_,M,S,Hi,Vi,ji,new Mr)}r.face=I,r.faceIndex=P,t.push(r)}}}},clone:function(){return new this.constructor(this.geometry,this.material).copy(this)}});var Zi=0,Ji=new Wr,Ki=new un,$i=new Rr;function ea(){Object.defineProperty(this,"id",{value:Zi+=2}),this.uuid=_r.generateUUID(),this.name="",this.type="Geometry",this.vertices=[],this.colors=[],this.faces=[],this.faceVertexUvs=[[]],this.morphTargets=[],this.morphNormals=[],this.skinWeights=[],this.skinIndices=[],this.lineDistances=[],this.boundingBox=null,this.boundingSphere=null,this.elementsNeedUpdate=!1,this.verticesNeedUpdate=!1,this.uvsNeedUpdate=!1,this.normalsNeedUpdate=!1,this.colorsNeedUpdate=!1,this.lineDistancesNeedUpdate=!1,this.groupsNeedUpdate=!1}ea.prototype=Object.assign(Object.create(br.prototype),{constructor:ea,isGeometry:!0,applyMatrix:function(e){for(var t=(new Pr).getNormalMatrix(e),r=0,n=this.vertices.length;r<n;r++){this.vertices[r].applyMatrix4(e)}for(r=0,n=this.faces.length;r<n;r++){var i=this.faces[r];i.normal.applyMatrix3(t).normalize();for(var a=0,o=i.vertexNormals.length;a<o;a++)i.vertexNormals[a].applyMatrix3(t).normalize()}return null!==this.boundingBox&&this.computeBoundingBox(),null!==this.boundingSphere&&this.computeBoundingSphere(),this.verticesNeedUpdate=!0,this.normalsNeedUpdate=!0,this},rotateX:function(e){return Ji.makeRotationX(e),this.applyMatrix(Ji),this},rotateY:function(e){return Ji.makeRotationY(e),this.applyMatrix(Ji),this},rotateZ:function(e){return Ji.makeRotationZ(e),this.applyMatrix(Ji),this},translate:function(e,t,r){return Ji.makeTranslation(e,t,r),this.applyMatrix(Ji),this},scale:function(e,t,r){return Ji.makeScale(e,t,r),this.applyMatrix(Ji),this},lookAt:function(e){return Ki.lookAt(e),Ki.updateMatrix(),this.applyMatrix(Ki.matrix),this},fromBufferGeometry:function(e){var t=this,r=null!==e.index?e.index.array:void 0,n=e.attributes;if(void 0===n.position)return console.error("THREE.Geometry.fromBufferGeometry(): Position attribute required for conversion."),this;var i=n.position.array,a=void 0!==n.normal?n.normal.array:void 0,o=void 0!==n.color?n.color.array:void 0,s=void 0!==n.uv?n.uv.array:void 0,l=void 0!==n.uv2?n.uv2.array:void 0;void 0!==l&&(this.faceVertexUvs[1]=[]);for(var c=0;c<i.length;c+=3)t.vertices.push((new Rr).fromArray(i,c)),void 0!==o&&t.colors.push((new ti).fromArray(o,c));function u(e,r,n,i){var c=void 0===o?[]:[t.colors[e].clone(),t.colors[r].clone(),t.colors[n].clone()],u=new ai(e,r,n,void 0===a?[]:[(new Rr).fromArray(a,3*e),(new Rr).fromArray(a,3*r),(new Rr).fromArray(a,3*n)],c,i);t.faces.push(u),void 0!==s&&t.faceVertexUvs[0].push([(new Mr).fromArray(s,2*e),(new Mr).fromArray(s,2*r),(new Mr).fromArray(s,2*n)]),void 0!==l&&t.faceVertexUvs[1].push([(new Mr).fromArray(l,2*e),(new Mr).fromArray(l,2*r),(new Mr).fromArray(l,2*n)])}var h=e.groups;if(h.length>0)for(c=0;c<h.length;c++)for(var d=h[c],p=d.start,f=p,m=p+d.count;f<m;f+=3)void 0!==r?u(r[f],r[f+1],r[f+2],d.materialIndex):u(f,f+1,f+2,d.materialIndex);else if(void 0!==r)for(c=0;c<r.length;c+=3)u(r[c],r[c+1],r[c+2]);else for(c=0;c<i.length/3;c+=3)u(c,c+1,c+2);return this.computeFaceNormals(),null!==e.boundingBox&&(this.boundingBox=e.boundingBox.clone()),null!==e.boundingSphere&&(this.boundingSphere=e.boundingSphere.clone()),this},center:function(){return this.computeBoundingBox(),this.boundingBox.getCenter($i).negate(),this.translate($i.x,$i.y,$i.z),this},normalize:function(){this.computeBoundingSphere();var e=this.boundingSphere.center,t=this.boundingSphere.radius,r=0===t?1:1/t,n=new Wr;return n.set(r,0,0,-r*e.x,0,r,0,-r*e.y,0,0,r,-r*e.z,0,0,0,1),this.applyMatrix(n),this},computeFaceNormals:function(){for(var e=new Rr,t=new Rr,r=0,n=this.faces.length;r<n;r++){var i=this.faces[r],a=this.vertices[i.a],o=this.vertices[i.b],s=this.vertices[i.c];e.subVectors(s,o),t.subVectors(a,o),e.cross(t),e.normalize(),i.normal.copy(e)}},computeVertexNormals:function(e){var t,r,n,i,a,o;for(void 0===e&&(e=!0),o=new Array(this.vertices.length),t=0,r=this.vertices.length;t<r;t++)o[t]=new Rr;if(e){var s,l,c,u=new Rr,h=new Rr;for(n=0,i=this.faces.length;n<i;n++)a=this.faces[n],s=this.vertices[a.a],l=this.vertices[a.b],c=this.vertices[a.c],u.subVectors(c,l),h.subVectors(s,l),u.cross(h),o[a.a].add(u),o[a.b].add(u),o[a.c].add(u)}else for(this.computeFaceNormals(),n=0,i=this.faces.length;n<i;n++)o[(a=this.faces[n]).a].add(a.normal),o[a.b].add(a.normal),o[a.c].add(a.normal);for(t=0,r=this.vertices.length;t<r;t++)o[t].normalize();for(n=0,i=this.faces.length;n<i;n++){var d=(a=this.faces[n]).vertexNormals;3===d.length?(d[0].copy(o[a.a]),d[1].copy(o[a.b]),d[2].copy(o[a.c])):(d[0]=o[a.a].clone(),d[1]=o[a.b].clone(),d[2]=o[a.c].clone())}this.faces.length>0&&(this.normalsNeedUpdate=!0)},computeFlatVertexNormals:function(){var e,t,r;for(this.computeFaceNormals(),e=0,t=this.faces.length;e<t;e++){var n=(r=this.faces[e]).vertexNormals;3===n.length?(n[0].copy(r.normal),n[1].copy(r.normal),n[2].copy(r.normal)):(n[0]=r.normal.clone(),n[1]=r.normal.clone(),n[2]=r.normal.clone())}this.faces.length>0&&(this.normalsNeedUpdate=!0)},computeMorphNormals:function(){var e,t,r,n,i;for(r=0,n=this.faces.length;r<n;r++)for((i=this.faces[r]).__originalFaceNormal?i.__originalFaceNormal.copy(i.normal):i.__originalFaceNormal=i.normal.clone(),i.__originalVertexNormals||(i.__originalVertexNormals=[]),e=0,t=i.vertexNormals.length;e<t;e++)i.__originalVertexNormals[e]?i.__originalVertexNormals[e].copy(i.vertexNormals[e]):i.__originalVertexNormals[e]=i.vertexNormals[e].clone();var a=new ea;for(a.faces=this.faces,e=0,t=this.morphTargets.length;e<t;e++){if(!this.morphNormals[e]){this.morphNormals[e]={},this.morphNormals[e].faceNormals=[],this.morphNormals[e].vertexNormals=[];var o=this.morphNormals[e].faceNormals,s=this.morphNormals[e].vertexNormals;for(r=0,n=this.faces.length;r<n;r++)l=new Rr,c={a:new Rr,b:new Rr,c:new Rr},o.push(l),s.push(c)}var l,c,u=this.morphNormals[e];for(a.vertices=this.morphTargets[e].vertices,a.computeFaceNormals(),a.computeVertexNormals(),r=0,n=this.faces.length;r<n;r++)i=this.faces[r],l=u.faceNormals[r],c=u.vertexNormals[r],l.copy(i.normal),c.a.copy(i.vertexNormals[0]),c.b.copy(i.vertexNormals[1]),c.c.copy(i.vertexNormals[2])}for(r=0,n=this.faces.length;r<n;r++)(i=this.faces[r]).normal=i.__originalFaceNormal,i.vertexNormals=i.__originalVertexNormals},computeBoundingBox:function(){null===this.boundingBox&&(this.boundingBox=new Sn),this.boundingBox.setFromPoints(this.vertices)},computeBoundingSphere:function(){null===this.boundingSphere&&(this.boundingSphere=new Rn),this.boundingSphere.setFromPoints(this.vertices)},merge:function(e,t,r){if(e&&e.isGeometry){var n,i=this.vertices.length,a=this.vertices,o=e.vertices,s=this.faces,l=e.faces,c=this.colors,u=e.colors;void 0===r&&(r=0),void 0!==t&&(n=(new Pr).getNormalMatrix(t));for(var h=0,d=o.length;h<d;h++){var p=o[h].clone();void 0!==t&&p.applyMatrix4(t),a.push(p)}for(h=0,d=u.length;h<d;h++)c.push(u[h].clone());for(h=0,d=l.length;h<d;h++){var f,m,v,g=l[h],y=g.vertexNormals,x=g.vertexColors;(f=new ai(g.a+i,g.b+i,g.c+i)).normal.copy(g.normal),void 0!==n&&f.normal.applyMatrix3(n).normalize();for(var b=0,A=y.length;b<A;b++)m=y[b].clone(),void 0!==n&&m.applyMatrix3(n).normalize(),f.vertexNormals.push(m);f.color.copy(g.color);for(b=0,A=x.length;b<A;b++)v=x[b],f.vertexColors.push(v.clone());f.materialIndex=g.materialIndex+r,s.push(f)}for(h=0,d=e.faceVertexUvs.length;h<d;h++){var w=e.faceVertexUvs[h];void 0===this.faceVertexUvs[h]&&(this.faceVertexUvs[h]=[]);for(b=0,A=w.length;b<A;b++){for(var _=w[b],M=[],S=0,E=_.length;S<E;S++)M.push(_[S].clone());this.faceVertexUvs[h].push(M)}}}else console.error("THREE.Geometry.merge(): geometry not an instance of THREE.Geometry.",e)},mergeMesh:function(e){e&&e.isMesh?(e.matrixAutoUpdate&&e.updateMatrix(),this.merge(e.geometry,e.matrix)):console.error("THREE.Geometry.mergeMesh(): mesh not an instance of THREE.Mesh.",e)},mergeVertices:function(){var e,t,r,n,i,a,o,s,l={},c=[],u=[],h=Math.pow(10,4);for(r=0,n=this.vertices.length;r<n;r++)e=this.vertices[r],void 0===l[t=Math.round(e.x*h)+"_"+Math.round(e.y*h)+"_"+Math.round(e.z*h)]?(l[t]=r,c.push(this.vertices[r]),u[r]=c.length-1):u[r]=u[l[t]];var d=[];for(r=0,n=this.faces.length;r<n;r++){(i=this.faces[r]).a=u[i.a],i.b=u[i.b],i.c=u[i.c],a=[i.a,i.b,i.c];for(var p=0;p<3;p++)if(a[p]===a[(p+1)%3]){d.push(r);break}}for(r=d.length-1;r>=0;r--){var f=d[r];for(this.faces.splice(f,1),o=0,s=this.faceVertexUvs.length;o<s;o++)this.faceVertexUvs[o].splice(f,1)}var m=this.vertices.length-c.length;return this.vertices=c,m},setFromPoints:function(e){this.vertices=[];for(var t=0,r=e.length;t<r;t++){var n=e[t];this.vertices.push(new Rr(n.x,n.y,n.z||0))}return this},sortFacesByMaterialIndex:function(){for(var e=this.faces,t=e.length,r=0;r<t;r++)e[r]._id=r;e.sort((function(e,t){return e.materialIndex-t.materialIndex}));var n,i,a=this.faceVertexUvs[0],o=this.faceVertexUvs[1];a&&a.length===t&&(n=[]),o&&o.length===t&&(i=[]);for(r=0;r<t;r++){var s=e[r]._id;n&&n.push(a[s]),i&&i.push(o[s])}n&&(this.faceVertexUvs[0]=n),i&&(this.faceVertexUvs[1]=i)},toJSON:function(){var e={metadata:{version:4.5,type:"Geometry",generator:"Geometry.toJSON"}};if(e.uuid=this.uuid,e.type=this.type,""!==this.name&&(e.name=this.name),void 0!==this.parameters){var t=this.parameters;for(var r in t)void 0!==t[r]&&(e[r]=t[r]);return e}for(var n=[],i=0;i<this.vertices.length;i++){var a=this.vertices[i];n.push(a.x,a.y,a.z)}var o=[],s=[],l={},c=[],u={},h=[],d={};for(i=0;i<this.faces.length;i++){var p=this.faces[i],f=void 0!==this.faceVertexUvs[0][i],m=p.normal.length()>0,v=p.vertexNormals.length>0,g=1!==p.color.r||1!==p.color.g||1!==p.color.b,y=p.vertexColors.length>0,x=0;if(x=_(x,0,0),x=_(x,1,!0),x=_(x,2,!1),x=_(x,3,f),x=_(x,4,m),x=_(x,5,v),x=_(x,6,g),x=_(x,7,y),o.push(x),o.push(p.a,p.b,p.c),o.push(p.materialIndex),f){var b=this.faceVertexUvs[0][i];o.push(E(b[0]),E(b[1]),E(b[2]))}if(m&&o.push(M(p.normal)),v){var A=p.vertexNormals;o.push(M(A[0]),M(A[1]),M(A[2]))}if(g&&o.push(S(p.color)),y){var w=p.vertexColors;o.push(S(w[0]),S(w[1]),S(w[2]))}}function _(e,t,r){return r?e|1<<t:e&~(1<<t)}function M(e){var t=e.x.toString()+e.y.toString()+e.z.toString();return void 0!==l[t]?l[t]:(l[t]=s.length/3,s.push(e.x,e.y,e.z),l[t])}function S(e){var t=e.r.toString()+e.g.toString()+e.b.toString();return void 0!==u[t]?u[t]:(u[t]=c.length,c.push(e.getHex()),u[t])}function E(e){var t=e.x.toString()+e.y.toString();return void 0!==d[t]?d[t]:(d[t]=h.length/2,h.push(e.x,e.y),d[t])}return e.data={},e.data.vertices=n,e.data.normals=s,c.length>0&&(e.data.colors=c),h.length>0&&(e.data.uvs=[h]),e.data.faces=o,e},clone:function(){return(new ea).copy(this)},copy:function(e){var t,r,n,i,a,o;this.vertices=[],this.colors=[],this.faces=[],this.faceVertexUvs=[[]],this.morphTargets=[],this.morphNormals=[],this.skinWeights=[],this.skinIndices=[],this.lineDistances=[],this.boundingBox=null,this.boundingSphere=null,this.name=e.name;var s=e.vertices;for(t=0,r=s.length;t<r;t++)this.vertices.push(s[t].clone());var l=e.colors;for(t=0,r=l.length;t<r;t++)this.colors.push(l[t].clone());var c=e.faces;for(t=0,r=c.length;t<r;t++)this.faces.push(c[t].clone());for(t=0,r=e.faceVertexUvs.length;t<r;t++){var u=e.faceVertexUvs[t];for(void 0===this.faceVertexUvs[t]&&(this.faceVertexUvs[t]=[]),n=0,i=u.length;n<i;n++){var h=u[n],d=[];for(a=0,o=h.length;a<o;a++){var p=h[a];d.push(p.clone())}this.faceVertexUvs[t].push(d)}}var f=e.morphTargets;for(t=0,r=f.length;t<r;t++){var m={};if(m.name=f[t].name,void 0!==f[t].vertices)for(m.vertices=[],n=0,i=f[t].vertices.length;n<i;n++)m.vertices.push(f[t].vertices[n].clone());if(void 0!==f[t].normals)for(m.normals=[],n=0,i=f[t].normals.length;n<i;n++)m.normals.push(f[t].normals[n].clone());this.morphTargets.push(m)}var v=e.morphNormals;for(t=0,r=v.length;t<r;t++){var g={};if(void 0!==v[t].vertexNormals)for(g.vertexNormals=[],n=0,i=v[t].vertexNormals.length;n<i;n++){var y=v[t].vertexNormals[n],x={};x.a=y.a.clone(),x.b=y.b.clone(),x.c=y.c.clone(),g.vertexNormals.push(x)}if(void 0!==v[t].faceNormals)for(g.faceNormals=[],n=0,i=v[t].faceNormals.length;n<i;n++)g.faceNormals.push(v[t].faceNormals[n].clone());this.morphNormals.push(g)}var b=e.skinWeights;for(t=0,r=b.length;t<r;t++)this.skinWeights.push(b[t].clone());var A=e.skinIndices;for(t=0,r=A.length;t<r;t++)this.skinIndices.push(A[t].clone());var w=e.lineDistances;for(t=0,r=w.length;t<r;t++)this.lineDistances.push(w[t]);var _=e.boundingBox;null!==_&&(this.boundingBox=_.clone());var M=e.boundingSphere;return null!==M&&(this.boundingSphere=M.clone()),this.elementsNeedUpdate=e.elementsNeedUpdate,this.verticesNeedUpdate=e.verticesNeedUpdate,this.uvsNeedUpdate=e.uvsNeedUpdate,this.normalsNeedUpdate=e.normalsNeedUpdate,this.colorsNeedUpdate=e.colorsNeedUpdate,this.lineDistancesNeedUpdate=e.lineDistancesNeedUpdate,this.groupsNeedUpdate=e.groupsNeedUpdate,this},dispose:function(){this.dispatchEvent({type:"dispose"})}});class ta extends ea{constructor(e,t,r,n,i,a){super(),this.type="BoxGeometry",this.parameters={width:e,height:t,depth:r,widthSegments:n,heightSegments:i,depthSegments:a},this.fromBufferGeometry(new ra(e,t,r,n,i,a)),this.mergeVertices()}}class ra extends Li{constructor(e,t,r,n,i,a){super(),this.type="BoxBufferGeometry",this.parameters={width:e,height:t,depth:r,widthSegments:n,heightSegments:i,depthSegments:a};var o=this;e=e||1,t=t||1,r=r||1,n=Math.floor(n)||1,i=Math.floor(i)||1,a=Math.floor(a)||1;var s=[],l=[],c=[],u=[],h=0,d=0;function p(e,t,r,n,i,a,p,f,m,v,g){var y,x,b=a/m,A=p/v,w=a/2,_=p/2,M=f/2,S=m+1,E=v+1,T=0,R=0,L=new Rr;for(x=0;x<E;x++){var C=x*A-_;for(y=0;y<S;y++){var P=y*b-w;L[e]=P*n,L[t]=C*i,L[r]=M,l.push(L.x,L.y,L.z),L[e]=0,L[t]=0,L[r]=f>0?1:-1,c.push(L.x,L.y,L.z),u.push(y/m),u.push(1-x/v),T+=1}}for(x=0;x<v;x++)for(y=0;y<m;y++){var D=h+y+S*x,I=h+y+S*(x+1),O=h+(y+1)+S*(x+1),B=h+(y+1)+S*x;s.push(D,I,B),s.push(I,O,B),R+=6}o.addGroup(d,R,g),d+=R,h+=T}p("z","y","x",-1,-1,r,t,e,a,i,0),p("z","y","x",1,-1,r,t,-e,a,i,1),p("x","z","y",1,1,e,r,t,n,a,2),p("x","z","y",1,-1,e,r,-t,n,a,3),p("x","y","z",1,-1,e,t,r,n,i,4),p("x","y","z",-1,-1,e,t,-r,n,i,5),this.setIndex(s),this.setAttribute("position",new yi(l,3)),this.setAttribute("normal",new yi(c,3)),this.setAttribute("uv",new yi(u,2))}}function na(e){var t={};for(var r in e)for(var n in t[r]={},e[r]){var i=e[r][n];i&&(i.isColor||i.isMatrix3||i.isMatrix4||i.isVector2||i.isVector3||i.isVector4||i.isTexture)?t[r][n]=i.clone():Array.isArray(i)?t[r][n]=i.slice():t[r][n]=i}return t}function ia(e){for(var t={},r=0;r<e.length;r++){var n=na(e[r]);for(var i in n)t[i]=n[i]}return t}var aa={clone:na,merge:ia},oa="void main() {\n\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",sa="void main() {\n\tgl_FragColor = vec4( 1.0, 0.0, 0.0, 1.0 );\n}";function la(e){si.call(this),this.type="ShaderMaterial",this.defines={},this.uniforms={},this.vertexShader=oa,this.fragmentShader=sa,this.linewidth=1,this.wireframe=!1,this.wireframeLinewidth=1,this.fog=!1,this.lights=!1,this.clipping=!1,this.skinning=!1,this.morphTargets=!1,this.morphNormals=!1,this.extensions={derivatives:!1,fragDepth:!1,drawBuffers:!1,shaderTextureLOD:!1},this.defaultAttributeValues={color:[1,1,1],uv:[0,0],uv2:[0,0]},this.index0AttributeName=void 0,this.uniformsNeedUpdate=!1,void 0!==e&&(void 0!==e.attributes&&console.error("THREE.ShaderMaterial: attributes should now be defined in THREE.BufferGeometry instead."),this.setValues(e))}function ca(){un.call(this),this.type="Camera",this.matrixWorldInverse=new Wr,this.projectionMatrix=new Wr,this.projectionMatrixInverse=new Wr}function ua(e,t,r,n){ca.call(this),this.type="PerspectiveCamera",this.fov=void 0!==e?e:50,this.zoom=1,this.near=void 0!==r?r:.1,this.far=void 0!==n?n:2e3,this.focus=10,this.aspect=void 0!==t?t:1,this.view=null,this.filmGauge=35,this.filmOffset=0,this.updateProjectionMatrix()}la.prototype=Object.create(si.prototype),la.prototype.constructor=la,la.prototype.isShaderMaterial=!0,la.prototype.copy=function(e){return si.prototype.copy.call(this,e),this.fragmentShader=e.fragmentShader,this.vertexShader=e.vertexShader,this.uniforms=na(e.uniforms),this.defines=Object.assign({},e.defines),this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.lights=e.lights,this.clipping=e.clipping,this.skinning=e.skinning,this.morphTargets=e.morphTargets,this.morphNormals=e.morphNormals,this.extensions=e.extensions,this},la.prototype.toJSON=function(e){var t=si.prototype.toJSON.call(this,e);for(var r in t.uniforms={},this.uniforms){var n=this.uniforms[r].value;n&&n.isTexture?t.uniforms[r]={type:"t",value:n.toJSON(e).uuid}:n&&n.isColor?t.uniforms[r]={type:"c",value:n.getHex()}:n&&n.isVector2?t.uniforms[r]={type:"v2",value:n.toArray()}:n&&n.isVector3?t.uniforms[r]={type:"v3",value:n.toArray()}:n&&n.isVector4?t.uniforms[r]={type:"v4",value:n.toArray()}:n&&n.isMatrix3?t.uniforms[r]={type:"m3",value:n.toArray()}:n&&n.isMatrix4?t.uniforms[r]={type:"m4",value:n.toArray()}:t.uniforms[r]={value:n}}Object.keys(this.defines).length>0&&(t.defines=this.defines),t.vertexShader=this.vertexShader,t.fragmentShader=this.fragmentShader;var i={};for(var a in this.extensions)!0===this.extensions[a]&&(i[a]=!0);return Object.keys(i).length>0&&(t.extensions=i),t},ca.prototype=Object.assign(Object.create(un.prototype),{constructor:ca,isCamera:!0,copy:function(e,t){return un.prototype.copy.call(this,e,t),this.matrixWorldInverse.copy(e.matrixWorldInverse),this.projectionMatrix.copy(e.projectionMatrix),this.projectionMatrixInverse.copy(e.projectionMatrixInverse),this},getWorldDirection:function(e){void 0===e&&(console.warn("THREE.Camera: .getWorldDirection() target is now required"),e=new Rr),this.updateMatrixWorld(!0);var t=this.matrixWorld.elements;return e.set(-t[8],-t[9],-t[10]).normalize()},updateMatrixWorld:function(e){un.prototype.updateMatrixWorld.call(this,e),this.matrixWorldInverse.getInverse(this.matrixWorld)},clone:function(){return(new this.constructor).copy(this)}}),ua.prototype=Object.assign(Object.create(ca.prototype),{constructor:ua,isPerspectiveCamera:!0,copy:function(e,t){return ca.prototype.copy.call(this,e,t),this.fov=e.fov,this.zoom=e.zoom,this.near=e.near,this.far=e.far,this.focus=e.focus,this.aspect=e.aspect,this.view=null===e.view?null:Object.assign({},e.view),this.filmGauge=e.filmGauge,this.filmOffset=e.filmOffset,this},setFocalLength:function(e){var t=.5*this.getFilmHeight()/e;this.fov=2*_r.RAD2DEG*Math.atan(t),this.updateProjectionMatrix()},getFocalLength:function(){var e=Math.tan(.5*_r.DEG2RAD*this.fov);return.5*this.getFilmHeight()/e},getEffectiveFOV:function(){return 2*_r.RAD2DEG*Math.atan(Math.tan(.5*_r.DEG2RAD*this.fov)/this.zoom)},getFilmWidth:function(){return this.filmGauge*Math.min(this.aspect,1)},getFilmHeight:function(){return this.filmGauge/Math.max(this.aspect,1)},setViewOffset:function(e,t,r,n,i,a){this.aspect=e/t,null===this.view&&(this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1}),this.view.enabled=!0,this.view.fullWidth=e,this.view.fullHeight=t,this.view.offsetX=r,this.view.offsetY=n,this.view.width=i,this.view.height=a,this.updateProjectionMatrix()},clearViewOffset:function(){null!==this.view&&(this.view.enabled=!1),this.updateProjectionMatrix()},updateProjectionMatrix:function(){var e=this.near,t=e*Math.tan(.5*_r.DEG2RAD*this.fov)/this.zoom,r=2*t,n=this.aspect*r,i=-.5*n,a=this.view;if(null!==this.view&&this.view.enabled){var o=a.fullWidth,s=a.fullHeight;i+=a.offsetX*n/o,t-=a.offsetY*r/s,n*=a.width/o,r*=a.height/s}var l=this.filmOffset;0!==l&&(i+=e*l/this.getFilmWidth()),this.projectionMatrix.makePerspective(i,i+n,t,t-r,e,this.far),this.projectionMatrixInverse.getInverse(this.projectionMatrix)},toJSON:function(e){var t=un.prototype.toJSON.call(this,e);return t.object.fov=this.fov,t.object.zoom=this.zoom,t.object.near=this.near,t.object.far=this.far,t.object.focus=this.focus,t.object.aspect=this.aspect,null!==this.view&&(t.object.view=Object.assign({},this.view)),t.object.filmGauge=this.filmGauge,t.object.filmOffset=this.filmOffset,t}});var ha=90,da=1;function pa(e,t,r,n){un.call(this),this.type="CubeCamera";var i=new ua(ha,da,e,t);i.up.set(0,-1,0),i.lookAt(new Rr(1,0,0)),this.add(i);var a=new ua(ha,da,e,t);a.up.set(0,-1,0),a.lookAt(new Rr(-1,0,0)),this.add(a);var o=new ua(ha,da,e,t);o.up.set(0,0,1),o.lookAt(new Rr(0,1,0)),this.add(o);var s=new ua(ha,da,e,t);s.up.set(0,0,-1),s.lookAt(new Rr(0,-1,0)),this.add(s);var l=new ua(ha,da,e,t);l.up.set(0,-1,0),l.lookAt(new Rr(0,0,1)),this.add(l);var c=new ua(ha,da,e,t);c.up.set(0,-1,0),c.lookAt(new Rr(0,0,-1)),this.add(c),n=n||{format:Ve,magFilter:Se,minFilter:Se},this.renderTarget=new fa(r,r,n),this.renderTarget.texture.name="CubeCamera",this.update=function(e,t){null===this.parent&&this.updateMatrixWorld();var r=e.getRenderTarget(),n=this.renderTarget,u=n.texture.generateMipmaps;n.texture.generateMipmaps=!1,e.setRenderTarget(n,0),e.render(t,i),e.setRenderTarget(n,1),e.render(t,a),e.setRenderTarget(n,2),e.render(t,o),e.setRenderTarget(n,3),e.render(t,s),e.setRenderTarget(n,4),e.render(t,l),n.texture.generateMipmaps=u,e.setRenderTarget(n,5),e.render(t,c),e.setRenderTarget(r)},this.clear=function(e,t,r,n){for(var i=e.getRenderTarget(),a=this.renderTarget,o=0;o<6;o++)e.setRenderTarget(a,o),e.clear(t,r,n);e.setRenderTarget(i)}}function fa(e,t,r){Fr.call(this,e,t,r)}function ma(e,t,r,n,i,a,o,s,l,c,u,h){Or.call(this,null,a,o,s,l,c,n,i,u,h),this.image={data:e||null,width:t||1,height:r||1},this.magFilter=void 0!==l?l:be,this.minFilter=void 0!==c?c:be,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1,this.needsUpdate=!0}pa.prototype=Object.create(un.prototype),pa.prototype.constructor=pa,fa.prototype=Object.create(Fr.prototype),fa.prototype.constructor=fa,fa.prototype.isWebGLRenderTargetCube=!0,fa.prototype.fromEquirectangularTexture=function(e,t){this.texture.type=t.type,this.texture.format=t.format,this.texture.encoding=t.encoding;var r=new hn,n={uniforms:{tEquirect:{value:null}},vertexShader:["varying vec3 vWorldDirection;","vec3 transformDirection( in vec3 dir, in mat4 matrix ) {","\treturn normalize( ( matrix * vec4( dir, 0.0 ) ).xyz );","}","void main() {","\tvWorldDirection = transformDirection( position, modelMatrix );","\t#include <begin_vertex>","\t#include <project_vertex>","}"].join("\n"),fragmentShader:["uniform sampler2D tEquirect;","varying vec3 vWorldDirection;","#define RECIPROCAL_PI 0.31830988618","#define RECIPROCAL_PI2 0.15915494","void main() {","\tvec3 direction = normalize( vWorldDirection );","\tvec2 sampleUV;","\tsampleUV.y = asin( clamp( direction.y, - 1.0, 1.0 ) ) * RECIPROCAL_PI + 0.5;","\tsampleUV.x = atan( direction.z, direction.x ) * RECIPROCAL_PI2 + 0.5;","\tgl_FragColor = texture2D( tEquirect, sampleUV );","}"].join("\n")},i=new la({type:"CubemapFromEquirect",uniforms:na(n.uniforms),vertexShader:n.vertexShader,fragmentShader:n.fragmentShader,side:g,blending:M});i.uniforms.tEquirect.value=t;var a=new Xi(new ra(5,5,5),i);r.add(a);var o=new pa(1,10,1);return o.renderTarget=this,o.renderTarget.texture.name="CubeCameraTexture",o.update(e,r),a.geometry.dispose(),a.material.dispose(),this},ma.prototype=Object.create(Or.prototype),ma.prototype.constructor=ma,ma.prototype.isDataTexture=!0;var va=new Rn,ga=new Rr;function ya(e,t,r,n,i,a){this.planes=[void 0!==e?e:new zn,void 0!==t?t:new zn,void 0!==r?r:new zn,void 0!==n?n:new zn,void 0!==i?i:new zn,void 0!==a?a:new zn]}Object.assign(ya.prototype,{set:function(e,t,r,n,i,a){var o=this.planes;return o[0].copy(e),o[1].copy(t),o[2].copy(r),o[3].copy(n),o[4].copy(i),o[5].copy(a),this},clone:function(){return(new this.constructor).copy(this)},copy:function(e){for(var t=this.planes,r=0;r<6;r++)t[r].copy(e.planes[r]);return this},setFromMatrix:function(e){var t=this.planes,r=e.elements,n=r[0],i=r[1],a=r[2],o=r[3],s=r[4],l=r[5],c=r[6],u=r[7],h=r[8],d=r[9],p=r[10],f=r[11],m=r[12],v=r[13],g=r[14],y=r[15];return t[0].setComponents(o-n,u-s,f-h,y-m).normalize(),t[1].setComponents(o+n,u+s,f+h,y+m).normalize(),t[2].setComponents(o+i,u+l,f+d,y+v).normalize(),t[3].setComponents(o-i,u-l,f-d,y-v).normalize(),t[4].setComponents(o-a,u-c,f-p,y-g).normalize(),t[5].setComponents(o+a,u+c,f+p,y+g).normalize(),this},intersectsObject:function(e){var t=e.geometry;return null===t.boundingSphere&&t.computeBoundingSphere(),va.copy(t.boundingSphere).applyMatrix4(e.matrixWorld),this.intersectsSphere(va)},intersectsSprite:function(e){return va.center.set(0,0,0),va.radius=.7071067811865476,va.applyMatrix4(e.matrixWorld),this.intersectsSphere(va)},intersectsSphere:function(e){for(var t=this.planes,r=e.center,n=-e.radius,i=0;i<6;i++){if(t[i].distanceToPoint(r)<n)return!1}return!0},intersectsBox:function(e){for(var t=this.planes,r=0;r<6;r++){var n=t[r];if(ga.x=n.normal.x>0?e.max.x:e.min.x,ga.y=n.normal.y>0?e.max.y:e.min.y,ga.z=n.normal.z>0?e.max.z:e.min.z,n.distanceToPoint(ga)<0)return!1}return!0},containsPoint:function(e){for(var t=this.planes,r=0;r<6;r++)if(t[r].distanceToPoint(e)<0)return!1;return!0}});var xa={alphamap_fragment:"#ifdef USE_ALPHAMAP\n\tdiffuseColor.a *= texture2D( alphaMap, vUv ).g;\n#endif",alphamap_pars_fragment:"#ifdef USE_ALPHAMAP\n\tuniform sampler2D alphaMap;\n#endif",alphatest_fragment:"#ifdef ALPHATEST\n\tif ( diffuseColor.a < ALPHATEST ) discard;\n#endif",aomap_fragment:"#ifdef USE_AOMAP\n\tfloat ambientOcclusion = ( texture2D( aoMap, vUv2 ).r - 1.0 ) * aoMapIntensity + 1.0;\n\treflectedLight.indirectDiffuse *= ambientOcclusion;\n\t#if defined( USE_ENVMAP ) && defined( STANDARD )\n\t\tfloat dotNV = saturate( dot( geometry.normal, geometry.viewDir ) );\n\t\treflectedLight.indirectSpecular *= computeSpecularOcclusion( dotNV, ambientOcclusion, material.specularRoughness );\n\t#endif\n#endif",aomap_pars_fragment:"#ifdef USE_AOMAP\n\tuniform sampler2D aoMap;\n\tuniform float aoMapIntensity;\n#endif",begin_vertex:"vec3 transformed = vec3( position );",beginnormal_vertex:"vec3 objectNormal = vec3( normal );\n#ifdef USE_TANGENT\n\tvec3 objectTangent = vec3( tangent.xyz );\n#endif",bsdfs:"vec2 integrateSpecularBRDF( const in float dotNV, const in float roughness ) {\n\tconst vec4 c0 = vec4( - 1, - 0.0275, - 0.572, 0.022 );\n\tconst vec4 c1 = vec4( 1, 0.0425, 1.04, - 0.04 );\n\tvec4 r = roughness * c0 + c1;\n\tfloat a004 = min( r.x * r.x, exp2( - 9.28 * dotNV ) ) * r.x + r.y;\n\treturn vec2( -1.04, 1.04 ) * a004 + r.zw;\n}\nfloat punctualLightIntensityToIrradianceFactor( const in float lightDistance, const in float cutoffDistance, const in float decayExponent ) {\n#if defined ( PHYSICALLY_CORRECT_LIGHTS )\n\tfloat distanceFalloff = 1.0 / max( pow( lightDistance, decayExponent ), 0.01 );\n\tif( cutoffDistance > 0.0 ) {\n\t\tdistanceFalloff *= pow2( saturate( 1.0 - pow4( lightDistance / cutoffDistance ) ) );\n\t}\n\treturn distanceFalloff;\n#else\n\tif( cutoffDistance > 0.0 && decayExponent > 0.0 ) {\n\t\treturn pow( saturate( -lightDistance / cutoffDistance + 1.0 ), decayExponent );\n\t}\n\treturn 1.0;\n#endif\n}\nvec3 BRDF_Diffuse_Lambert( const in vec3 diffuseColor ) {\n\treturn RECIPROCAL_PI * diffuseColor;\n}\nvec3 F_Schlick( const in vec3 specularColor, const in float dotLH ) {\n\tfloat fresnel = exp2( ( -5.55473 * dotLH - 6.98316 ) * dotLH );\n\treturn ( 1.0 - specularColor ) * fresnel + specularColor;\n}\nvec3 F_Schlick_RoughnessDependent( const in vec3 F0, const in float dotNV, const in float roughness ) {\n\tfloat fresnel = exp2( ( -5.55473 * dotNV - 6.98316 ) * dotNV );\n\tvec3 Fr = max( vec3( 1.0 - roughness ), F0 ) - F0;\n\treturn Fr * fresnel + F0;\n}\nfloat G_GGX_Smith( const in float alpha, const in float dotNL, const in float dotNV ) {\n\tfloat a2 = pow2( alpha );\n\tfloat gl = dotNL + sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNL ) );\n\tfloat gv = dotNV + sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNV ) );\n\treturn 1.0 / ( gl * gv );\n}\nfloat G_GGX_SmithCorrelated( const in float alpha, const in float dotNL, const in float dotNV ) {\n\tfloat a2 = pow2( alpha );\n\tfloat gv = dotNL * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNV ) );\n\tfloat gl = dotNV * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNL ) );\n\treturn 0.5 / max( gv + gl, EPSILON );\n}\nfloat D_GGX( const in float alpha, const in float dotNH ) {\n\tfloat a2 = pow2( alpha );\n\tfloat denom = pow2( dotNH ) * ( a2 - 1.0 ) + 1.0;\n\treturn RECIPROCAL_PI * a2 / pow2( denom );\n}\nvec3 BRDF_Specular_GGX( const in IncidentLight incidentLight, const in vec3 viewDir, const in vec3 normal, const in vec3 specularColor, const in float roughness ) {\n\tfloat alpha = pow2( roughness );\n\tvec3 halfDir = normalize( incidentLight.direction + viewDir );\n\tfloat dotNL = saturate( dot( normal, incidentLight.direction ) );\n\tfloat dotNV = saturate( dot( normal, viewDir ) );\n\tfloat dotNH = saturate( dot( normal, halfDir ) );\n\tfloat dotLH = saturate( dot( incidentLight.direction, halfDir ) );\n\tvec3 F = F_Schlick( specularColor, dotLH );\n\tfloat G = G_GGX_SmithCorrelated( alpha, dotNL, dotNV );\n\tfloat D = D_GGX( alpha, dotNH );\n\treturn F * ( G * D );\n}\nvec2 LTC_Uv( const in vec3 N, const in vec3 V, const in float roughness ) {\n\tconst float LUT_SIZE = 64.0;\n\tconst float LUT_SCALE = ( LUT_SIZE - 1.0 ) / LUT_SIZE;\n\tconst float LUT_BIAS = 0.5 / LUT_SIZE;\n\tfloat dotNV = saturate( dot( N, V ) );\n\tvec2 uv = vec2( roughness, sqrt( 1.0 - dotNV ) );\n\tuv = uv * LUT_SCALE + LUT_BIAS;\n\treturn uv;\n}\nfloat LTC_ClippedSphereFormFactor( const in vec3 f ) {\n\tfloat l = length( f );\n\treturn max( ( l * l + f.z ) / ( l + 1.0 ), 0.0 );\n}\nvec3 LTC_EdgeVectorFormFactor( const in vec3 v1, const in vec3 v2 ) {\n\tfloat x = dot( v1, v2 );\n\tfloat y = abs( x );\n\tfloat a = 0.8543985 + ( 0.4965155 + 0.0145206 * y ) * y;\n\tfloat b = 3.4175940 + ( 4.1616724 + y ) * y;\n\tfloat v = a / b;\n\tfloat theta_sintheta = ( x > 0.0 ) ? v : 0.5 * inversesqrt( max( 1.0 - x * x, 1e-7 ) ) - v;\n\treturn cross( v1, v2 ) * theta_sintheta;\n}\nvec3 LTC_Evaluate( const in vec3 N, const in vec3 V, const in vec3 P, const in mat3 mInv, const in vec3 rectCoords[ 4 ] ) {\n\tvec3 v1 = rectCoords[ 1 ] - rectCoords[ 0 ];\n\tvec3 v2 = rectCoords[ 3 ] - rectCoords[ 0 ];\n\tvec3 lightNormal = cross( v1, v2 );\n\tif( dot( lightNormal, P - rectCoords[ 0 ] ) < 0.0 ) return vec3( 0.0 );\n\tvec3 T1, T2;\n\tT1 = normalize( V - N * dot( V, N ) );\n\tT2 = - cross( N, T1 );\n\tmat3 mat = mInv * transposeMat3( mat3( T1, T2, N ) );\n\tvec3 coords[ 4 ];\n\tcoords[ 0 ] = mat * ( rectCoords[ 0 ] - P );\n\tcoords[ 1 ] = mat * ( rectCoords[ 1 ] - P );\n\tcoords[ 2 ] = mat * ( rectCoords[ 2 ] - P );\n\tcoords[ 3 ] = mat * ( rectCoords[ 3 ] - P );\n\tcoords[ 0 ] = normalize( coords[ 0 ] );\n\tcoords[ 1 ] = normalize( coords[ 1 ] );\n\tcoords[ 2 ] = normalize( coords[ 2 ] );\n\tcoords[ 3 ] = normalize( coords[ 3 ] );\n\tvec3 vectorFormFactor = vec3( 0.0 );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 0 ], coords[ 1 ] );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 1 ], coords[ 2 ] );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 2 ], coords[ 3 ] );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 3 ], coords[ 0 ] );\n\tfloat result = LTC_ClippedSphereFormFactor( vectorFormFactor );\n\treturn vec3( result );\n}\nvec3 BRDF_Specular_GGX_Environment( const in vec3 viewDir, const in vec3 normal, const in vec3 specularColor, const in float roughness ) {\n\tfloat dotNV = saturate( dot( normal, viewDir ) );\n\tvec2 brdf = integrateSpecularBRDF( dotNV, roughness );\n\treturn specularColor * brdf.x + brdf.y;\n}\nvoid BRDF_Specular_Multiscattering_Environment( const in GeometricContext geometry, const in vec3 specularColor, const in float roughness, inout vec3 singleScatter, inout vec3 multiScatter ) {\n\tfloat dotNV = saturate( dot( geometry.normal, geometry.viewDir ) );\n\tvec3 F = F_Schlick_RoughnessDependent( specularColor, dotNV, roughness );\n\tvec2 brdf = integrateSpecularBRDF( dotNV, roughness );\n\tvec3 FssEss = F * brdf.x + brdf.y;\n\tfloat Ess = brdf.x + brdf.y;\n\tfloat Ems = 1.0 - Ess;\n\tvec3 Favg = specularColor + ( 1.0 - specularColor ) * 0.047619;\tvec3 Fms = FssEss * Favg / ( 1.0 - Ems * Favg );\n\tsingleScatter += FssEss;\n\tmultiScatter += Fms * Ems;\n}\nfloat G_BlinnPhong_Implicit( ) {\n\treturn 0.25;\n}\nfloat D_BlinnPhong( const in float shininess, const in float dotNH ) {\n\treturn RECIPROCAL_PI * ( shininess * 0.5 + 1.0 ) * pow( dotNH, shininess );\n}\nvec3 BRDF_Specular_BlinnPhong( const in IncidentLight incidentLight, const in GeometricContext geometry, const in vec3 specularColor, const in float shininess ) {\n\tvec3 halfDir = normalize( incidentLight.direction + geometry.viewDir );\n\tfloat dotNH = saturate( dot( geometry.normal, halfDir ) );\n\tfloat dotLH = saturate( dot( incidentLight.direction, halfDir ) );\n\tvec3 F = F_Schlick( specularColor, dotLH );\n\tfloat G = G_BlinnPhong_Implicit( );\n\tfloat D = D_BlinnPhong( shininess, dotNH );\n\treturn F * ( G * D );\n}\nfloat GGXRoughnessToBlinnExponent( const in float ggxRoughness ) {\n\treturn ( 2.0 / pow2( ggxRoughness + 0.0001 ) - 2.0 );\n}\nfloat BlinnExponentToGGXRoughness( const in float blinnExponent ) {\n\treturn sqrt( 2.0 / ( blinnExponent + 2.0 ) );\n}\n#if defined( USE_SHEEN )\nfloat D_Charlie(float roughness, float NoH) {\n\tfloat invAlpha = 1.0 / roughness;\n\tfloat cos2h = NoH * NoH;\n\tfloat sin2h = max(1.0 - cos2h, 0.0078125);\treturn (2.0 + invAlpha) * pow(sin2h, invAlpha * 0.5) / (2.0 * PI);\n}\nfloat V_Neubelt(float NoV, float NoL) {\n\treturn saturate(1.0 / (4.0 * (NoL + NoV - NoL * NoV)));\n}\nvec3 BRDF_Specular_Sheen( const in float roughness, const in vec3 L, const in GeometricContext geometry, vec3 specularColor ) {\n\tvec3 N = geometry.normal;\n\tvec3 V = geometry.viewDir;\n\tvec3 H = normalize( V + L );\n\tfloat dotNH = saturate( dot( N, H ) );\n\treturn specularColor * D_Charlie( roughness, dotNH ) * V_Neubelt( dot(N, V), dot(N, L) );\n}\n#endif",bumpmap_pars_fragment:"#ifdef USE_BUMPMAP\n\tuniform sampler2D bumpMap;\n\tuniform float bumpScale;\n\tvec2 dHdxy_fwd() {\n\t\tvec2 dSTdx = dFdx( vUv );\n\t\tvec2 dSTdy = dFdy( vUv );\n\t\tfloat Hll = bumpScale * texture2D( bumpMap, vUv ).x;\n\t\tfloat dBx = bumpScale * texture2D( bumpMap, vUv + dSTdx ).x - Hll;\n\t\tfloat dBy = bumpScale * texture2D( bumpMap, vUv + dSTdy ).x - Hll;\n\t\treturn vec2( dBx, dBy );\n\t}\n\tvec3 perturbNormalArb( vec3 surf_pos, vec3 surf_norm, vec2 dHdxy ) {\n\t\tvec3 vSigmaX = vec3( dFdx( surf_pos.x ), dFdx( surf_pos.y ), dFdx( surf_pos.z ) );\n\t\tvec3 vSigmaY = vec3( dFdy( surf_pos.x ), dFdy( surf_pos.y ), dFdy( surf_pos.z ) );\n\t\tvec3 vN = surf_norm;\n\t\tvec3 R1 = cross( vSigmaY, vN );\n\t\tvec3 R2 = cross( vN, vSigmaX );\n\t\tfloat fDet = dot( vSigmaX, R1 );\n\t\tfDet *= ( float( gl_FrontFacing ) * 2.0 - 1.0 );\n\t\tvec3 vGrad = sign( fDet ) * ( dHdxy.x * R1 + dHdxy.y * R2 );\n\t\treturn normalize( abs( fDet ) * surf_norm - vGrad );\n\t}\n#endif",clipping_planes_fragment:"#if NUM_CLIPPING_PLANES > 0\n\tvec4 plane;\n\t#pragma unroll_loop\n\tfor ( int i = 0; i < UNION_CLIPPING_PLANES; i ++ ) {\n\t\tplane = clippingPlanes[ i ];\n\t\tif ( dot( vViewPosition, plane.xyz ) > plane.w ) discard;\n\t}\n\t#if UNION_CLIPPING_PLANES < NUM_CLIPPING_PLANES\n\t\tbool clipped = true;\n\t\t#pragma unroll_loop\n\t\tfor ( int i = UNION_CLIPPING_PLANES; i < NUM_CLIPPING_PLANES; i ++ ) {\n\t\t\tplane = clippingPlanes[ i ];\n\t\t\tclipped = ( dot( vViewPosition, plane.xyz ) > plane.w ) && clipped;\n\t\t}\n\t\tif ( clipped ) discard;\n\t#endif\n#endif",clipping_planes_pars_fragment:"#if NUM_CLIPPING_PLANES > 0\n\t#if ! defined( STANDARD ) && ! defined( PHONG ) && ! defined( MATCAP )\n\t\tvarying vec3 vViewPosition;\n\t#endif\n\tuniform vec4 clippingPlanes[ NUM_CLIPPING_PLANES ];\n#endif",clipping_planes_pars_vertex:"#if NUM_CLIPPING_PLANES > 0 && ! defined( STANDARD ) && ! defined( PHONG ) && ! defined( MATCAP )\n\tvarying vec3 vViewPosition;\n#endif",clipping_planes_vertex:"#if NUM_CLIPPING_PLANES > 0 && ! defined( STANDARD ) && ! defined( PHONG ) && ! defined( MATCAP )\n\tvViewPosition = - mvPosition.xyz;\n#endif",color_fragment:"#ifdef USE_COLOR\n\tdiffuseColor.rgb *= vColor;\n#endif",color_pars_fragment:"#ifdef USE_COLOR\n\tvarying vec3 vColor;\n#endif",color_pars_vertex:"#ifdef USE_COLOR\n\tvarying vec3 vColor;\n#endif",color_vertex:"#ifdef USE_COLOR\n\tvColor.xyz = color.xyz;\n#endif",common:"#define PI 3.14159265359\n#define PI2 6.28318530718\n#define PI_HALF 1.5707963267949\n#define RECIPROCAL_PI 0.31830988618\n#define RECIPROCAL_PI2 0.15915494\n#define LOG2 1.442695\n#define EPSILON 1e-6\n#ifndef saturate\n#define saturate(a) clamp( a, 0.0, 1.0 )\n#endif\n#define whiteComplement(a) ( 1.0 - saturate( a ) )\nfloat pow2( const in float x ) { return x*x; }\nfloat pow3( const in float x ) { return x*x*x; }\nfloat pow4( const in float x ) { float x2 = x*x; return x2*x2; }\nfloat average( const in vec3 color ) { return dot( color, vec3( 0.3333 ) ); }\nhighp float rand( const in vec2 uv ) {\n\tconst highp float a = 12.9898, b = 78.233, c = 43758.5453;\n\thighp float dt = dot( uv.xy, vec2( a,b ) ), sn = mod( dt, PI );\n\treturn fract(sin(sn) * c);\n}\n#ifdef HIGH_PRECISION\n\tfloat precisionSafeLength( vec3 v ) { return length( v ); }\n#else\n\tfloat max3( vec3 v ) { return max( max( v.x, v.y ), v.z ); }\n\tfloat precisionSafeLength( vec3 v ) {\n\t\tfloat maxComponent = max3( abs( v ) );\n\t\treturn length( v / maxComponent ) * maxComponent;\n\t}\n#endif\nstruct IncidentLight {\n\tvec3 color;\n\tvec3 direction;\n\tbool visible;\n};\nstruct ReflectedLight {\n\tvec3 directDiffuse;\n\tvec3 directSpecular;\n\tvec3 indirectDiffuse;\n\tvec3 indirectSpecular;\n};\nstruct GeometricContext {\n\tvec3 position;\n\tvec3 normal;\n\tvec3 viewDir;\n#ifdef CLEARCOAT\n\tvec3 clearcoatNormal;\n#endif\n};\nvec3 transformDirection( in vec3 dir, in mat4 matrix ) {\n\treturn normalize( ( matrix * vec4( dir, 0.0 ) ).xyz );\n}\nvec3 inverseTransformDirection( in vec3 dir, in mat4 matrix ) {\n\treturn normalize( ( vec4( dir, 0.0 ) * matrix ).xyz );\n}\nvec3 projectOnPlane(in vec3 point, in vec3 pointOnPlane, in vec3 planeNormal ) {\n\tfloat distance = dot( planeNormal, point - pointOnPlane );\n\treturn - distance * planeNormal + point;\n}\nfloat sideOfPlane( in vec3 point, in vec3 pointOnPlane, in vec3 planeNormal ) {\n\treturn sign( dot( point - pointOnPlane, planeNormal ) );\n}\nvec3 linePlaneIntersect( in vec3 pointOnLine, in vec3 lineDirection, in vec3 pointOnPlane, in vec3 planeNormal ) {\n\treturn lineDirection * ( dot( planeNormal, pointOnPlane - pointOnLine ) / dot( planeNormal, lineDirection ) ) + pointOnLine;\n}\nmat3 transposeMat3( const in mat3 m ) {\n\tmat3 tmp;\n\ttmp[ 0 ] = vec3( m[ 0 ].x, m[ 1 ].x, m[ 2 ].x );\n\ttmp[ 1 ] = vec3( m[ 0 ].y, m[ 1 ].y, m[ 2 ].y );\n\ttmp[ 2 ] = vec3( m[ 0 ].z, m[ 1 ].z, m[ 2 ].z );\n\treturn tmp;\n}\nfloat linearToRelativeLuminance( const in vec3 color ) {\n\tvec3 weights = vec3( 0.2126, 0.7152, 0.0722 );\n\treturn dot( weights, color.rgb );\n}\nbool isPerspectiveMatrix( mat4 m ) {\n return m[ 2 ][ 3 ] == - 1.0;\n}",cube_uv_reflection_fragment:"#ifdef ENVMAP_TYPE_CUBE_UV\n#define cubeUV_maxMipLevel 8.0\n#define cubeUV_minMipLevel 4.0\n#define cubeUV_maxTileSize 256.0\n#define cubeUV_minTileSize 16.0\nfloat getFace(vec3 direction) {\n vec3 absDirection = abs(direction);\n float face = -1.0;\n if (absDirection.x > absDirection.z) {\n if (absDirection.x > absDirection.y)\n face = direction.x > 0.0 ? 0.0 : 3.0;\n else\n face = direction.y > 0.0 ? 1.0 : 4.0;\n } else {\n if (absDirection.z > absDirection.y)\n face = direction.z > 0.0 ? 2.0 : 5.0;\n else\n face = direction.y > 0.0 ? 1.0 : 4.0;\n }\n return face;\n}\nvec2 getUV(vec3 direction, float face) {\n vec2 uv;\n if (face == 0.0) {\n uv = vec2(-direction.z, direction.y) / abs(direction.x);\n } else if (face == 1.0) {\n uv = vec2(direction.x, -direction.z) / abs(direction.y);\n } else if (face == 2.0) {\n uv = direction.xy / abs(direction.z);\n } else if (face == 3.0) {\n uv = vec2(direction.z, direction.y) / abs(direction.x);\n } else if (face == 4.0) {\n uv = direction.xz / abs(direction.y);\n } else {\n uv = vec2(-direction.x, direction.y) / abs(direction.z);\n }\n return 0.5 * (uv + 1.0);\n}\nvec3 bilinearCubeUV(sampler2D envMap, vec3 direction, float mipInt) {\n float face = getFace(direction);\n float filterInt = max(cubeUV_minMipLevel - mipInt, 0.0);\n mipInt = max(mipInt, cubeUV_minMipLevel);\n float faceSize = exp2(mipInt);\n float texelSize = 1.0 / (3.0 * cubeUV_maxTileSize);\n vec2 uv = getUV(direction, face) * (faceSize - 1.0);\n vec2 f = fract(uv);\n uv += 0.5 - f;\n if (face > 2.0) {\n uv.y += faceSize;\n face -= 3.0;\n }\n uv.x += face * faceSize;\n if(mipInt < cubeUV_maxMipLevel){\n uv.y += 2.0 * cubeUV_maxTileSize;\n }\n uv.y += filterInt * 2.0 * cubeUV_minTileSize;\n uv.x += 3.0 * max(0.0, cubeUV_maxTileSize - 2.0 * faceSize);\n uv *= texelSize;\n vec3 tl = envMapTexelToLinear(texture2D(envMap, uv)).rgb;\n uv.x += texelSize;\n vec3 tr = envMapTexelToLinear(texture2D(envMap, uv)).rgb;\n uv.y += texelSize;\n vec3 br = envMapTexelToLinear(texture2D(envMap, uv)).rgb;\n uv.x -= texelSize;\n vec3 bl = envMapTexelToLinear(texture2D(envMap, uv)).rgb;\n vec3 tm = mix(tl, tr, f.x);\n vec3 bm = mix(bl, br, f.x);\n return mix(tm, bm, f.y);\n}\n#define r0 1.0\n#define v0 0.339\n#define m0 -2.0\n#define r1 0.8\n#define v1 0.276\n#define m1 -1.0\n#define r4 0.4\n#define v4 0.046\n#define m4 2.0\n#define r5 0.305\n#define v5 0.016\n#define m5 3.0\n#define r6 0.21\n#define v6 0.0038\n#define m6 4.0\nfloat roughnessToMip(float roughness) {\n float mip = 0.0;\n if (roughness >= r1) {\n mip = (r0 - roughness) * (m1 - m0) / (r0 - r1) + m0;\n } else if (roughness >= r4) {\n mip = (r1 - roughness) * (m4 - m1) / (r1 - r4) + m1;\n } else if (roughness >= r5) {\n mip = (r4 - roughness) * (m5 - m4) / (r4 - r5) + m4;\n } else if (roughness >= r6) {\n mip = (r5 - roughness) * (m6 - m5) / (r5 - r6) + m5;\n } else {\n mip = -2.0 * log2(1.16 * roughness); }\n return mip;\n}\nvec4 textureCubeUV(sampler2D envMap, vec3 sampleDir, float roughness) {\n float mip = clamp(roughnessToMip(roughness), m0, cubeUV_maxMipLevel);\n float mipF = fract(mip);\n float mipInt = floor(mip);\n vec3 color0 = bilinearCubeUV(envMap, sampleDir, mipInt);\n if (mipF == 0.0) {\n return vec4(color0, 1.0);\n } else {\n vec3 color1 = bilinearCubeUV(envMap, sampleDir, mipInt + 1.0);\n return vec4(mix(color0, color1, mipF), 1.0);\n }\n}\n#endif",defaultnormal_vertex:"vec3 transformedNormal = objectNormal;\n#ifdef USE_INSTANCING\n\ttransformedNormal = mat3( instanceMatrix ) * transformedNormal;\n#endif\ntransformedNormal = normalMatrix * transformedNormal;\n#ifdef FLIP_SIDED\n\ttransformedNormal = - transformedNormal;\n#endif\n#ifdef USE_TANGENT\n\tvec3 transformedTangent = ( modelViewMatrix * vec4( objectTangent, 0.0 ) ).xyz;\n\t#ifdef FLIP_SIDED\n\t\ttransformedTangent = - transformedTangent;\n\t#endif\n#endif",displacementmap_pars_vertex:"#ifdef USE_DISPLACEMENTMAP\n\tuniform sampler2D displacementMap;\n\tuniform float displacementScale;\n\tuniform float displacementBias;\n#endif",displacementmap_vertex:"#ifdef USE_DISPLACEMENTMAP\n\ttransformed += normalize( objectNormal ) * ( texture2D( displacementMap, vUv ).x * displacementScale + displacementBias );\n#endif",emissivemap_fragment:"#ifdef USE_EMISSIVEMAP\n\tvec4 emissiveColor = texture2D( emissiveMap, vUv );\n\temissiveColor.rgb = emissiveMapTexelToLinear( emissiveColor ).rgb;\n\ttotalEmissiveRadiance *= emissiveColor.rgb;\n#endif",emissivemap_pars_fragment:"#ifdef USE_EMISSIVEMAP\n\tuniform sampler2D emissiveMap;\n#endif",encodings_fragment:"gl_FragColor = linearToOutputTexel( gl_FragColor );",encodings_pars_fragment:"\nvec4 LinearToLinear( in vec4 value ) {\n\treturn value;\n}\nvec4 GammaToLinear( in vec4 value, in float gammaFactor ) {\n\treturn vec4( pow( value.rgb, vec3( gammaFactor ) ), value.a );\n}\nvec4 LinearToGamma( in vec4 value, in float gammaFactor ) {\n\treturn vec4( pow( value.rgb, vec3( 1.0 / gammaFactor ) ), value.a );\n}\nvec4 sRGBToLinear( in vec4 value ) {\n\treturn vec4( mix( pow( value.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), value.rgb * 0.0773993808, vec3( lessThanEqual( value.rgb, vec3( 0.04045 ) ) ) ), value.a );\n}\nvec4 LinearTosRGB( in vec4 value ) {\n\treturn vec4( mix( pow( value.rgb, vec3( 0.41666 ) ) * 1.055 - vec3( 0.055 ), value.rgb * 12.92, vec3( lessThanEqual( value.rgb, vec3( 0.0031308 ) ) ) ), value.a );\n}\nvec4 RGBEToLinear( in vec4 value ) {\n\treturn vec4( value.rgb * exp2( value.a * 255.0 - 128.0 ), 1.0 );\n}\nvec4 LinearToRGBE( in vec4 value ) {\n\tfloat maxComponent = max( max( value.r, value.g ), value.b );\n\tfloat fExp = clamp( ceil( log2( maxComponent ) ), -128.0, 127.0 );\n\treturn vec4( value.rgb / exp2( fExp ), ( fExp + 128.0 ) / 255.0 );\n}\nvec4 RGBMToLinear( in vec4 value, in float maxRange ) {\n\treturn vec4( value.rgb * value.a * maxRange, 1.0 );\n}\nvec4 LinearToRGBM( in vec4 value, in float maxRange ) {\n\tfloat maxRGB = max( value.r, max( value.g, value.b ) );\n\tfloat M = clamp( maxRGB / maxRange, 0.0, 1.0 );\n\tM = ceil( M * 255.0 ) / 255.0;\n\treturn vec4( value.rgb / ( M * maxRange ), M );\n}\nvec4 RGBDToLinear( in vec4 value, in float maxRange ) {\n\treturn vec4( value.rgb * ( ( maxRange / 255.0 ) / value.a ), 1.0 );\n}\nvec4 LinearToRGBD( in vec4 value, in float maxRange ) {\n\tfloat maxRGB = max( value.r, max( value.g, value.b ) );\n\tfloat D = max( maxRange / maxRGB, 1.0 );\n\tD = min( floor( D ) / 255.0, 1.0 );\n\treturn vec4( value.rgb * ( D * ( 255.0 / maxRange ) ), D );\n}\nconst mat3 cLogLuvM = mat3( 0.2209, 0.3390, 0.4184, 0.1138, 0.6780, 0.7319, 0.0102, 0.1130, 0.2969 );\nvec4 LinearToLogLuv( in vec4 value ) {\n\tvec3 Xp_Y_XYZp = cLogLuvM * value.rgb;\n\tXp_Y_XYZp = max( Xp_Y_XYZp, vec3( 1e-6, 1e-6, 1e-6 ) );\n\tvec4 vResult;\n\tvResult.xy = Xp_Y_XYZp.xy / Xp_Y_XYZp.z;\n\tfloat Le = 2.0 * log2(Xp_Y_XYZp.y) + 127.0;\n\tvResult.w = fract( Le );\n\tvResult.z = ( Le - ( floor( vResult.w * 255.0 ) ) / 255.0 ) / 255.0;\n\treturn vResult;\n}\nconst mat3 cLogLuvInverseM = mat3( 6.0014, -2.7008, -1.7996, -1.3320, 3.1029, -5.7721, 0.3008, -1.0882, 5.6268 );\nvec4 LogLuvToLinear( in vec4 value ) {\n\tfloat Le = value.z * 255.0 + value.w;\n\tvec3 Xp_Y_XYZp;\n\tXp_Y_XYZp.y = exp2( ( Le - 127.0 ) / 2.0 );\n\tXp_Y_XYZp.z = Xp_Y_XYZp.y / value.y;\n\tXp_Y_XYZp.x = value.x * Xp_Y_XYZp.z;\n\tvec3 vRGB = cLogLuvInverseM * Xp_Y_XYZp.rgb;\n\treturn vec4( max( vRGB, 0.0 ), 1.0 );\n}",envmap_fragment:"#ifdef USE_ENVMAP\n\t#ifdef ENV_WORLDPOS\n\t\tvec3 cameraToFrag;\n\t\t\n\t\tif ( isOrthographic ) {\n\t\t\tcameraToFrag = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) );\n\t\t} else {\n\t\t\tcameraToFrag = normalize( vWorldPosition - cameraPosition );\n\t\t}\n\t\tvec3 worldNormal = inverseTransformDirection( normal, viewMatrix );\n\t\t#ifdef ENVMAP_MODE_REFLECTION\n\t\t\tvec3 reflectVec = reflect( cameraToFrag, worldNormal );\n\t\t#else\n\t\t\tvec3 reflectVec = refract( cameraToFrag, worldNormal, refractionRatio );\n\t\t#endif\n\t#else\n\t\tvec3 reflectVec = vReflect;\n\t#endif\n\t#ifdef ENVMAP_TYPE_CUBE\n\t\tvec4 envColor = textureCube( envMap, vec3( flipEnvMap * reflectVec.x, reflectVec.yz ) );\n\t#elif defined( ENVMAP_TYPE_CUBE_UV )\n\t\tvec4 envColor = textureCubeUV( envMap, vec3( flipEnvMap * reflectVec.x, reflectVec.yz ), 0.0 );\n\t#elif defined( ENVMAP_TYPE_EQUIREC )\n\t\tvec2 sampleUV;\n\t\treflectVec = normalize( reflectVec );\n\t\tsampleUV.y = asin( clamp( reflectVec.y, - 1.0, 1.0 ) ) * RECIPROCAL_PI + 0.5;\n\t\tsampleUV.x = atan( reflectVec.z, reflectVec.x ) * RECIPROCAL_PI2 + 0.5;\n\t\tvec4 envColor = texture2D( envMap, sampleUV );\n\t#elif defined( ENVMAP_TYPE_SPHERE )\n\t\treflectVec = normalize( reflectVec );\n\t\tvec3 reflectView = normalize( ( viewMatrix * vec4( reflectVec, 0.0 ) ).xyz + vec3( 0.0, 0.0, 1.0 ) );\n\t\tvec4 envColor = texture2D( envMap, reflectView.xy * 0.5 + 0.5 );\n\t#else\n\t\tvec4 envColor = vec4( 0.0 );\n\t#endif\n\t#ifndef ENVMAP_TYPE_CUBE_UV\n\t\tenvColor = envMapTexelToLinear( envColor );\n\t#endif\n\t#ifdef ENVMAP_BLENDING_MULTIPLY\n\t\toutgoingLight = mix( outgoingLight, outgoingLight * envColor.xyz, specularStrength * reflectivity );\n\t#elif defined( ENVMAP_BLENDING_MIX )\n\t\toutgoingLight = mix( outgoingLight, envColor.xyz, specularStrength * reflectivity );\n\t#elif defined( ENVMAP_BLENDING_ADD )\n\t\toutgoingLight += envColor.xyz * specularStrength * reflectivity;\n\t#endif\n#endif",envmap_common_pars_fragment:"#ifdef USE_ENVMAP\n\tuniform float envMapIntensity;\n\tuniform float flipEnvMap;\n\tuniform int maxMipLevel;\n\t#ifdef ENVMAP_TYPE_CUBE\n\t\tuniform samplerCube envMap;\n\t#else\n\t\tuniform sampler2D envMap;\n\t#endif\n\t\n#endif",envmap_pars_fragment:"#ifdef USE_ENVMAP\n\tuniform float reflectivity;\n\t#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG )\n\t\t#define ENV_WORLDPOS\n\t#endif\n\t#ifdef ENV_WORLDPOS\n\t\tvarying vec3 vWorldPosition;\n\t\tuniform float refractionRatio;\n\t#else\n\t\tvarying vec3 vReflect;\n\t#endif\n#endif",envmap_pars_vertex:"#ifdef USE_ENVMAP\n\t#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) ||defined( PHONG )\n\t\t#define ENV_WORLDPOS\n\t#endif\n\t#ifdef ENV_WORLDPOS\n\t\t\n\t\tvarying vec3 vWorldPosition;\n\t#else\n\t\tvarying vec3 vReflect;\n\t\tuniform float refractionRatio;\n\t#endif\n#endif",envmap_physical_pars_fragment:"#if defined( USE_ENVMAP )\n\t#ifdef ENVMAP_MODE_REFRACTION\n\t\tuniform float refractionRatio;\n\t#endif\n\tvec3 getLightProbeIndirectIrradiance( const in GeometricContext geometry, const in int maxMIPLevel ) {\n\t\tvec3 worldNormal = inverseTransformDirection( geometry.normal, viewMatrix );\n\t\t#ifdef ENVMAP_TYPE_CUBE\n\t\t\tvec3 queryVec = vec3( flipEnvMap * worldNormal.x, worldNormal.yz );\n\t\t\t#ifdef TEXTURE_LOD_EXT\n\t\t\t\tvec4 envMapColor = textureCubeLodEXT( envMap, queryVec, float( maxMIPLevel ) );\n\t\t\t#else\n\t\t\t\tvec4 envMapColor = textureCube( envMap, queryVec, float( maxMIPLevel ) );\n\t\t\t#endif\n\t\t\tenvMapColor.rgb = envMapTexelToLinear( envMapColor ).rgb;\n\t\t#elif defined( ENVMAP_TYPE_CUBE_UV )\n\t\t\tvec3 queryVec = vec3( flipEnvMap * worldNormal.x, worldNormal.yz );\n\t\t\tvec4 envMapColor = textureCubeUV( envMap, queryVec, 1.0 );\n\t\t#else\n\t\t\tvec4 envMapColor = vec4( 0.0 );\n\t\t#endif\n\t\treturn PI * envMapColor.rgb * envMapIntensity;\n\t}\n\tfloat getSpecularMIPLevel( const in float roughness, const in int maxMIPLevel ) {\n\t\tfloat maxMIPLevelScalar = float( maxMIPLevel );\n\t\tfloat sigma = PI * roughness * roughness / ( 1.0 + roughness );\n\t\tfloat desiredMIPLevel = maxMIPLevelScalar + log2( sigma );\n\t\treturn clamp( desiredMIPLevel, 0.0, maxMIPLevelScalar );\n\t}\n\tvec3 getLightProbeIndirectRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness, const in int maxMIPLevel ) {\n\t\t#ifdef ENVMAP_MODE_REFLECTION\n\t\t vec3 reflectVec = reflect( -viewDir, normal );\n\t\t reflectVec = normalize( mix( reflectVec, normal, roughness * roughness) );\n\t\t#else\n\t\t vec3 reflectVec = refract( -viewDir, normal, refractionRatio );\n\t\t#endif\n\t\treflectVec = inverseTransformDirection( reflectVec, viewMatrix );\n\t\tfloat specularMIPLevel = getSpecularMIPLevel( roughness, maxMIPLevel );\n\t\t#ifdef ENVMAP_TYPE_CUBE\n\t\t\tvec3 queryReflectVec = vec3( flipEnvMap * reflectVec.x, reflectVec.yz );\n\t\t\t#ifdef TEXTURE_LOD_EXT\n\t\t\t\tvec4 envMapColor = textureCubeLodEXT( envMap, queryReflectVec, specularMIPLevel );\n\t\t\t#else\n\t\t\t\tvec4 envMapColor = textureCube( envMap, queryReflectVec, specularMIPLevel );\n\t\t\t#endif\n\t\t\tenvMapColor.rgb = envMapTexelToLinear( envMapColor ).rgb;\n\t\t#elif defined( ENVMAP_TYPE_CUBE_UV )\n\t\t\tvec3 queryReflectVec = vec3( flipEnvMap * reflectVec.x, reflectVec.yz );\n\t\t\tvec4 envMapColor = textureCubeUV( envMap, queryReflectVec, roughness );\n\t\t#elif defined( ENVMAP_TYPE_EQUIREC )\n\t\t\tvec2 sampleUV;\n\t\t\tsampleUV.y = asin( clamp( reflectVec.y, - 1.0, 1.0 ) ) * RECIPROCAL_PI + 0.5;\n\t\t\tsampleUV.x = atan( reflectVec.z, reflectVec.x ) * RECIPROCAL_PI2 + 0.5;\n\t\t\t#ifdef TEXTURE_LOD_EXT\n\t\t\t\tvec4 envMapColor = texture2DLodEXT( envMap, sampleUV, specularMIPLevel );\n\t\t\t#else\n\t\t\t\tvec4 envMapColor = texture2D( envMap, sampleUV, specularMIPLevel );\n\t\t\t#endif\n\t\t\tenvMapColor.rgb = envMapTexelToLinear( envMapColor ).rgb;\n\t\t#elif defined( ENVMAP_TYPE_SPHERE )\n\t\t\tvec3 reflectView = normalize( ( viewMatrix * vec4( reflectVec, 0.0 ) ).xyz + vec3( 0.0,0.0,1.0 ) );\n\t\t\t#ifdef TEXTURE_LOD_EXT\n\t\t\t\tvec4 envMapColor = texture2DLodEXT( envMap, reflectView.xy * 0.5 + 0.5, specularMIPLevel );\n\t\t\t#else\n\t\t\t\tvec4 envMapColor = texture2D( envMap, reflectView.xy * 0.5 + 0.5, specularMIPLevel );\n\t\t\t#endif\n\t\t\tenvMapColor.rgb = envMapTexelToLinear( envMapColor ).rgb;\n\t\t#endif\n\t\treturn envMapColor.rgb * envMapIntensity;\n\t}\n#endif",envmap_vertex:"#ifdef USE_ENVMAP\n\t#ifdef ENV_WORLDPOS\n\t\tvWorldPosition = worldPosition.xyz;\n\t#else\n\t\tvec3 cameraToVertex;\n\t\tif ( isOrthographic ) { \n\t\t\tcameraToVertex = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) );\n\t\t} else {\n\t\t\tcameraToVertex = normalize( worldPosition.xyz - cameraPosition );\n\t\t}\n\t\tvec3 worldNormal = inverseTransformDirection( transformedNormal, viewMatrix );\n\t\t#ifdef ENVMAP_MODE_REFLECTION\n\t\t\tvReflect = reflect( cameraToVertex, worldNormal );\n\t\t#else\n\t\t\tvReflect = refract( cameraToVertex, worldNormal, refractionRatio );\n\t\t#endif\n\t#endif\n#endif",fog_vertex:"#ifdef USE_FOG\n\tfogDepth = -mvPosition.z;\n#endif",fog_pars_vertex:"#ifdef USE_FOG\n\tvarying float fogDepth;\n#endif",fog_fragment:"#ifdef USE_FOG\n\t#ifdef FOG_EXP2\n\t\tfloat fogFactor = 1.0 - exp( - fogDensity * fogDensity * fogDepth * fogDepth );\n\t#else\n\t\tfloat fogFactor = smoothstep( fogNear, fogFar, fogDepth );\n\t#endif\n\tgl_FragColor.rgb = mix( gl_FragColor.rgb, fogColor, fogFactor );\n#endif",fog_pars_fragment:"#ifdef USE_FOG\n\tuniform vec3 fogColor;\n\tvarying float fogDepth;\n\t#ifdef FOG_EXP2\n\t\tuniform float fogDensity;\n\t#else\n\t\tuniform float fogNear;\n\t\tuniform float fogFar;\n\t#endif\n#endif",gradientmap_pars_fragment:"#ifdef USE_GRADIENTMAP\n\tuniform sampler2D gradientMap;\n#endif\nvec3 getGradientIrradiance( vec3 normal, vec3 lightDirection ) {\n\tfloat dotNL = dot( normal, lightDirection );\n\tvec2 coord = vec2( dotNL * 0.5 + 0.5, 0.0 );\n\t#ifdef USE_GRADIENTMAP\n\t\treturn texture2D( gradientMap, coord ).rgb;\n\t#else\n\t\treturn ( coord.x < 0.7 ) ? vec3( 0.7 ) : vec3( 1.0 );\n\t#endif\n}",lightmap_fragment:"#ifdef USE_LIGHTMAP\n\tvec4 lightMapTexel= texture2D( lightMap, vUv2 );\n\treflectedLight.indirectDiffuse += PI * lightMapTexelToLinear( lightMapTexel ).rgb * lightMapIntensity;\n#endif",lightmap_pars_fragment:"#ifdef USE_LIGHTMAP\n\tuniform sampler2D lightMap;\n\tuniform float lightMapIntensity;\n#endif",lights_lambert_vertex:"vec3 diffuse = vec3( 1.0 );\nGeometricContext geometry;\ngeometry.position = mvPosition.xyz;\ngeometry.normal = normalize( transformedNormal );\ngeometry.viewDir = ( isOrthographic ) ? vec3( 0, 0, 1 ) : normalize( -mvPosition.xyz );\nGeometricContext backGeometry;\nbackGeometry.position = geometry.position;\nbackGeometry.normal = -geometry.normal;\nbackGeometry.viewDir = geometry.viewDir;\nvLightFront = vec3( 0.0 );\nvIndirectFront = vec3( 0.0 );\n#ifdef DOUBLE_SIDED\n\tvLightBack = vec3( 0.0 );\n\tvIndirectBack = vec3( 0.0 );\n#endif\nIncidentLight directLight;\nfloat dotNL;\nvec3 directLightColor_Diffuse;\n#if NUM_POINT_LIGHTS > 0\n\t#pragma unroll_loop\n\tfor ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {\n\t\tgetPointDirectLightIrradiance( pointLights[ i ], geometry, directLight );\n\t\tdotNL = dot( geometry.normal, directLight.direction );\n\t\tdirectLightColor_Diffuse = PI * directLight.color;\n\t\tvLightFront += saturate( dotNL ) * directLightColor_Diffuse;\n\t\t#ifdef DOUBLE_SIDED\n\t\t\tvLightBack += saturate( -dotNL ) * directLightColor_Diffuse;\n\t\t#endif\n\t}\n#endif\n#if NUM_SPOT_LIGHTS > 0\n\t#pragma unroll_loop\n\tfor ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {\n\t\tgetSpotDirectLightIrradiance( spotLights[ i ], geometry, directLight );\n\t\tdotNL = dot( geometry.normal, directLight.direction );\n\t\tdirectLightColor_Diffuse = PI * directLight.color;\n\t\tvLightFront += saturate( dotNL ) * directLightColor_Diffuse;\n\t\t#ifdef DOUBLE_SIDED\n\t\t\tvLightBack += saturate( -dotNL ) * directLightColor_Diffuse;\n\t\t#endif\n\t}\n#endif\n#if NUM_DIR_LIGHTS > 0\n\t#pragma unroll_loop\n\tfor ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {\n\t\tgetDirectionalDirectLightIrradiance( directionalLights[ i ], geometry, directLight );\n\t\tdotNL = dot( geometry.normal, directLight.direction );\n\t\tdirectLightColor_Diffuse = PI * directLight.color;\n\t\tvLightFront += saturate( dotNL ) * directLightColor_Diffuse;\n\t\t#ifdef DOUBLE_SIDED\n\t\t\tvLightBack += saturate( -dotNL ) * directLightColor_Diffuse;\n\t\t#endif\n\t}\n#endif\n#if NUM_HEMI_LIGHTS > 0\n\t#pragma unroll_loop\n\tfor ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) {\n\t\tvIndirectFront += getHemisphereLightIrradiance( hemisphereLights[ i ], geometry );\n\t\t#ifdef DOUBLE_SIDED\n\t\t\tvIndirectBack += getHemisphereLightIrradiance( hemisphereLights[ i ], backGeometry );\n\t\t#endif\n\t}\n#endif",lights_pars_begin:"uniform bool receiveShadow;\nuniform vec3 ambientLightColor;\nuniform vec3 lightProbe[ 9 ];\nvec3 shGetIrradianceAt( in vec3 normal, in vec3 shCoefficients[ 9 ] ) {\n\tfloat x = normal.x, y = normal.y, z = normal.z;\n\tvec3 result = shCoefficients[ 0 ] * 0.886227;\n\tresult += shCoefficients[ 1 ] * 2.0 * 0.511664 * y;\n\tresult += shCoefficients[ 2 ] * 2.0 * 0.511664 * z;\n\tresult += shCoefficients[ 3 ] * 2.0 * 0.511664 * x;\n\tresult += shCoefficients[ 4 ] * 2.0 * 0.429043 * x * y;\n\tresult += shCoefficients[ 5 ] * 2.0 * 0.429043 * y * z;\n\tresult += shCoefficients[ 6 ] * ( 0.743125 * z * z - 0.247708 );\n\tresult += shCoefficients[ 7 ] * 2.0 * 0.429043 * x * z;\n\tresult += shCoefficients[ 8 ] * 0.429043 * ( x * x - y * y );\n\treturn result;\n}\nvec3 getLightProbeIrradiance( const in vec3 lightProbe[ 9 ], const in GeometricContext geometry ) {\n\tvec3 worldNormal = inverseTransformDirection( geometry.normal, viewMatrix );\n\tvec3 irradiance = shGetIrradianceAt( worldNormal, lightProbe );\n\treturn irradiance;\n}\nvec3 getAmbientLightIrradiance( const in vec3 ambientLightColor ) {\n\tvec3 irradiance = ambientLightColor;\n\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\t\tirradiance *= PI;\n\t#endif\n\treturn irradiance;\n}\n#if NUM_DIR_LIGHTS > 0\n\tstruct DirectionalLight {\n\t\tvec3 direction;\n\t\tvec3 color;\n\t\tint shadow;\n\t\tfloat shadowBias;\n\t\tfloat shadowRadius;\n\t\tvec2 shadowMapSize;\n\t};\n\tuniform DirectionalLight directionalLights[ NUM_DIR_LIGHTS ];\n\tvoid getDirectionalDirectLightIrradiance( const in DirectionalLight directionalLight, const in GeometricContext geometry, out IncidentLight directLight ) {\n\t\tdirectLight.color = directionalLight.color;\n\t\tdirectLight.direction = directionalLight.direction;\n\t\tdirectLight.visible = true;\n\t}\n#endif\n#if NUM_POINT_LIGHTS > 0\n\tstruct PointLight {\n\t\tvec3 position;\n\t\tvec3 color;\n\t\tfloat distance;\n\t\tfloat decay;\n\t\tint shadow;\n\t\tfloat shadowBias;\n\t\tfloat shadowRadius;\n\t\tvec2 shadowMapSize;\n\t\tfloat shadowCameraNear;\n\t\tfloat shadowCameraFar;\n\t};\n\tuniform PointLight pointLights[ NUM_POINT_LIGHTS ];\n\tvoid getPointDirectLightIrradiance( const in PointLight pointLight, const in GeometricContext geometry, out IncidentLight directLight ) {\n\t\tvec3 lVector = pointLight.position - geometry.position;\n\t\tdirectLight.direction = normalize( lVector );\n\t\tfloat lightDistance = length( lVector );\n\t\tdirectLight.color = pointLight.color;\n\t\tdirectLight.color *= punctualLightIntensityToIrradianceFactor( lightDistance, pointLight.distance, pointLight.decay );\n\t\tdirectLight.visible = ( directLight.color != vec3( 0.0 ) );\n\t}\n#endif\n#if NUM_SPOT_LIGHTS > 0\n\tstruct SpotLight {\n\t\tvec3 position;\n\t\tvec3 direction;\n\t\tvec3 color;\n\t\tfloat distance;\n\t\tfloat decay;\n\t\tfloat coneCos;\n\t\tfloat penumbraCos;\n\t\tint shadow;\n\t\tfloat shadowBias;\n\t\tfloat shadowRadius;\n\t\tvec2 shadowMapSize;\n\t};\n\tuniform SpotLight spotLights[ NUM_SPOT_LIGHTS ];\n\tvoid getSpotDirectLightIrradiance( const in SpotLight spotLight, const in GeometricContext geometry, out IncidentLight directLight ) {\n\t\tvec3 lVector = spotLight.position - geometry.position;\n\t\tdirectLight.direction = normalize( lVector );\n\t\tfloat lightDistance = length( lVector );\n\t\tfloat angleCos = dot( directLight.direction, spotLight.direction );\n\t\tif ( angleCos > spotLight.coneCos ) {\n\t\t\tfloat spotEffect = smoothstep( spotLight.coneCos, spotLight.penumbraCos, angleCos );\n\t\t\tdirectLight.color = spotLight.color;\n\t\t\tdirectLight.color *= spotEffect * punctualLightIntensityToIrradianceFactor( lightDistance, spotLight.distance, spotLight.decay );\n\t\t\tdirectLight.visible = true;\n\t\t} else {\n\t\t\tdirectLight.color = vec3( 0.0 );\n\t\t\tdirectLight.visible = false;\n\t\t}\n\t}\n#endif\n#if NUM_RECT_AREA_LIGHTS > 0\n\tstruct RectAreaLight {\n\t\tvec3 color;\n\t\tvec3 position;\n\t\tvec3 halfWidth;\n\t\tvec3 halfHeight;\n\t};\n\tuniform sampler2D ltc_1;\tuniform sampler2D ltc_2;\n\tuniform RectAreaLight rectAreaLights[ NUM_RECT_AREA_LIGHTS ];\n#endif\n#if NUM_HEMI_LIGHTS > 0\n\tstruct HemisphereLight {\n\t\tvec3 direction;\n\t\tvec3 skyColor;\n\t\tvec3 groundColor;\n\t};\n\tuniform HemisphereLight hemisphereLights[ NUM_HEMI_LIGHTS ];\n\tvec3 getHemisphereLightIrradiance( const in HemisphereLight hemiLight, const in GeometricContext geometry ) {\n\t\tfloat dotNL = dot( geometry.normal, hemiLight.direction );\n\t\tfloat hemiDiffuseWeight = 0.5 * dotNL + 0.5;\n\t\tvec3 irradiance = mix( hemiLight.groundColor, hemiLight.skyColor, hemiDiffuseWeight );\n\t\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\t\t\tirradiance *= PI;\n\t\t#endif\n\t\treturn irradiance;\n\t}\n#endif",lights_toon_fragment:"ToonMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb;\nmaterial.specularColor = specular;\nmaterial.specularShininess = shininess;\nmaterial.specularStrength = specularStrength;",lights_toon_pars_fragment:"varying vec3 vViewPosition;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\nstruct ToonMaterial {\n\tvec3\tdiffuseColor;\n\tvec3\tspecularColor;\n\tfloat\tspecularShininess;\n\tfloat\tspecularStrength;\n};\nvoid RE_Direct_Toon( const in IncidentLight directLight, const in GeometricContext geometry, const in ToonMaterial material, inout ReflectedLight reflectedLight ) {\n\tvec3 irradiance = getGradientIrradiance( geometry.normal, directLight.direction ) * directLight.color;\n\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\t\tirradiance *= PI;\n\t#endif\n\treflectedLight.directDiffuse += irradiance * BRDF_Diffuse_Lambert( material.diffuseColor );\n\treflectedLight.directSpecular += irradiance * BRDF_Specular_BlinnPhong( directLight, geometry, material.specularColor, material.specularShininess ) * material.specularStrength;\n}\nvoid RE_IndirectDiffuse_Toon( const in vec3 irradiance, const in GeometricContext geometry, const in ToonMaterial material, inout ReflectedLight reflectedLight ) {\n\treflectedLight.indirectDiffuse += irradiance * BRDF_Diffuse_Lambert( material.diffuseColor );\n}\n#define RE_Direct\t\t\t\tRE_Direct_Toon\n#define RE_IndirectDiffuse\t\tRE_IndirectDiffuse_Toon\n#define Material_LightProbeLOD( material )\t(0)",lights_phong_fragment:"BlinnPhongMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb;\nmaterial.specularColor = specular;\nmaterial.specularShininess = shininess;\nmaterial.specularStrength = specularStrength;",lights_phong_pars_fragment:"varying vec3 vViewPosition;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\nstruct BlinnPhongMaterial {\n\tvec3\tdiffuseColor;\n\tvec3\tspecularColor;\n\tfloat\tspecularShininess;\n\tfloat\tspecularStrength;\n};\nvoid RE_Direct_BlinnPhong( const in IncidentLight directLight, const in GeometricContext geometry, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {\n\tfloat dotNL = saturate( dot( geometry.normal, directLight.direction ) );\n\tvec3 irradiance = dotNL * directLight.color;\n\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\t\tirradiance *= PI;\n\t#endif\n\treflectedLight.directDiffuse += irradiance * BRDF_Diffuse_Lambert( material.diffuseColor );\n\treflectedLight.directSpecular += irradiance * BRDF_Specular_BlinnPhong( directLight, geometry, material.specularColor, material.specularShininess ) * material.specularStrength;\n}\nvoid RE_IndirectDiffuse_BlinnPhong( const in vec3 irradiance, const in GeometricContext geometry, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {\n\treflectedLight.indirectDiffuse += irradiance * BRDF_Diffuse_Lambert( material.diffuseColor );\n}\n#define RE_Direct\t\t\t\tRE_Direct_BlinnPhong\n#define RE_IndirectDiffuse\t\tRE_IndirectDiffuse_BlinnPhong\n#define Material_LightProbeLOD( material )\t(0)",lights_physical_fragment:"PhysicalMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb * ( 1.0 - metalnessFactor );\nvec3 dxy = max( abs( dFdx( geometryNormal ) ), abs( dFdy( geometryNormal ) ) );\nfloat geometryRoughness = max( max( dxy.x, dxy.y ), dxy.z );\nmaterial.specularRoughness = max( roughnessFactor, 0.0525 );material.specularRoughness += geometryRoughness;\nmaterial.specularRoughness = min( material.specularRoughness, 1.0 );\n#ifdef REFLECTIVITY\n\tmaterial.specularColor = mix( vec3( MAXIMUM_SPECULAR_COEFFICIENT * pow2( reflectivity ) ), diffuseColor.rgb, metalnessFactor );\n#else\n\tmaterial.specularColor = mix( vec3( DEFAULT_SPECULAR_COEFFICIENT ), diffuseColor.rgb, metalnessFactor );\n#endif\n#ifdef CLEARCOAT\n\tmaterial.clearcoat = saturate( clearcoat );\tmaterial.clearcoatRoughness = max( clearcoatRoughness, 0.0525 );\n\tmaterial.clearcoatRoughness += geometryRoughness;\n\tmaterial.clearcoatRoughness = min( material.clearcoatRoughness, 1.0 );\n#endif\n#ifdef USE_SHEEN\n\tmaterial.sheenColor = sheen;\n#endif",lights_physical_pars_fragment:"struct PhysicalMaterial {\n\tvec3\tdiffuseColor;\n\tfloat\tspecularRoughness;\n\tvec3\tspecularColor;\n#ifdef CLEARCOAT\n\tfloat clearcoat;\n\tfloat clearcoatRoughness;\n#endif\n#ifdef USE_SHEEN\n\tvec3 sheenColor;\n#endif\n};\n#define MAXIMUM_SPECULAR_COEFFICIENT 0.16\n#define DEFAULT_SPECULAR_COEFFICIENT 0.04\nfloat clearcoatDHRApprox( const in float roughness, const in float dotNL ) {\n\treturn DEFAULT_SPECULAR_COEFFICIENT + ( 1.0 - DEFAULT_SPECULAR_COEFFICIENT ) * ( pow( 1.0 - dotNL, 5.0 ) * pow( 1.0 - roughness, 2.0 ) );\n}\n#if NUM_RECT_AREA_LIGHTS > 0\n\tvoid RE_Direct_RectArea_Physical( const in RectAreaLight rectAreaLight, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n\t\tvec3 normal = geometry.normal;\n\t\tvec3 viewDir = geometry.viewDir;\n\t\tvec3 position = geometry.position;\n\t\tvec3 lightPos = rectAreaLight.position;\n\t\tvec3 halfWidth = rectAreaLight.halfWidth;\n\t\tvec3 halfHeight = rectAreaLight.halfHeight;\n\t\tvec3 lightColor = rectAreaLight.color;\n\t\tfloat roughness = material.specularRoughness;\n\t\tvec3 rectCoords[ 4 ];\n\t\trectCoords[ 0 ] = lightPos + halfWidth - halfHeight;\t\trectCoords[ 1 ] = lightPos - halfWidth - halfHeight;\n\t\trectCoords[ 2 ] = lightPos - halfWidth + halfHeight;\n\t\trectCoords[ 3 ] = lightPos + halfWidth + halfHeight;\n\t\tvec2 uv = LTC_Uv( normal, viewDir, roughness );\n\t\tvec4 t1 = texture2D( ltc_1, uv );\n\t\tvec4 t2 = texture2D( ltc_2, uv );\n\t\tmat3 mInv = mat3(\n\t\t\tvec3( t1.x, 0, t1.y ),\n\t\t\tvec3( 0, 1, 0 ),\n\t\t\tvec3( t1.z, 0, t1.w )\n\t\t);\n\t\tvec3 fresnel = ( material.specularColor * t2.x + ( vec3( 1.0 ) - material.specularColor ) * t2.y );\n\t\treflectedLight.directSpecular += lightColor * fresnel * LTC_Evaluate( normal, viewDir, position, mInv, rectCoords );\n\t\treflectedLight.directDiffuse += lightColor * material.diffuseColor * LTC_Evaluate( normal, viewDir, position, mat3( 1.0 ), rectCoords );\n\t}\n#endif\nvoid RE_Direct_Physical( const in IncidentLight directLight, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n\tfloat dotNL = saturate( dot( geometry.normal, directLight.direction ) );\n\tvec3 irradiance = dotNL * directLight.color;\n\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\t\tirradiance *= PI;\n\t#endif\n\t#ifdef CLEARCOAT\n\t\tfloat ccDotNL = saturate( dot( geometry.clearcoatNormal, directLight.direction ) );\n\t\tvec3 ccIrradiance = ccDotNL * directLight.color;\n\t\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\t\t\tccIrradiance *= PI;\n\t\t#endif\n\t\tfloat clearcoatDHR = material.clearcoat * clearcoatDHRApprox( material.clearcoatRoughness, ccDotNL );\n\t\treflectedLight.directSpecular += ccIrradiance * material.clearcoat * BRDF_Specular_GGX( directLight, geometry.viewDir, geometry.clearcoatNormal, vec3( DEFAULT_SPECULAR_COEFFICIENT ), material.clearcoatRoughness );\n\t#else\n\t\tfloat clearcoatDHR = 0.0;\n\t#endif\n\t#ifdef USE_SHEEN\n\t\treflectedLight.directSpecular += ( 1.0 - clearcoatDHR ) * irradiance * BRDF_Specular_Sheen(\n\t\t\tmaterial.specularRoughness,\n\t\t\tdirectLight.direction,\n\t\t\tgeometry,\n\t\t\tmaterial.sheenColor\n\t\t);\n\t#else\n\t\treflectedLight.directSpecular += ( 1.0 - clearcoatDHR ) * irradiance * BRDF_Specular_GGX( directLight, geometry.viewDir, geometry.normal, material.specularColor, material.specularRoughness);\n\t#endif\n\treflectedLight.directDiffuse += ( 1.0 - clearcoatDHR ) * irradiance * BRDF_Diffuse_Lambert( material.diffuseColor );\n}\nvoid RE_IndirectDiffuse_Physical( const in vec3 irradiance, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n\treflectedLight.indirectDiffuse += irradiance * BRDF_Diffuse_Lambert( material.diffuseColor );\n}\nvoid RE_IndirectSpecular_Physical( const in vec3 radiance, const in vec3 irradiance, const in vec3 clearcoatRadiance, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight) {\n\t#ifdef CLEARCOAT\n\t\tfloat ccDotNV = saturate( dot( geometry.clearcoatNormal, geometry.viewDir ) );\n\t\treflectedLight.indirectSpecular += clearcoatRadiance * material.clearcoat * BRDF_Specular_GGX_Environment( geometry.viewDir, geometry.clearcoatNormal, vec3( DEFAULT_SPECULAR_COEFFICIENT ), material.clearcoatRoughness );\n\t\tfloat ccDotNL = ccDotNV;\n\t\tfloat clearcoatDHR = material.clearcoat * clearcoatDHRApprox( material.clearcoatRoughness, ccDotNL );\n\t#else\n\t\tfloat clearcoatDHR = 0.0;\n\t#endif\n\tfloat clearcoatInv = 1.0 - clearcoatDHR;\n\tvec3 singleScattering = vec3( 0.0 );\n\tvec3 multiScattering = vec3( 0.0 );\n\tvec3 cosineWeightedIrradiance = irradiance * RECIPROCAL_PI;\n\tBRDF_Specular_Multiscattering_Environment( geometry, material.specularColor, material.specularRoughness, singleScattering, multiScattering );\n\tvec3 diffuse = material.diffuseColor * ( 1.0 - ( singleScattering + multiScattering ) );\n\treflectedLight.indirectSpecular += clearcoatInv * radiance * singleScattering;\n\treflectedLight.indirectSpecular += multiScattering * cosineWeightedIrradiance;\n\treflectedLight.indirectDiffuse += diffuse * cosineWeightedIrradiance;\n}\n#define RE_Direct\t\t\t\tRE_Direct_Physical\n#define RE_Direct_RectArea\t\tRE_Direct_RectArea_Physical\n#define RE_IndirectDiffuse\t\tRE_IndirectDiffuse_Physical\n#define RE_IndirectSpecular\t\tRE_IndirectSpecular_Physical\nfloat computeSpecularOcclusion( const in float dotNV, const in float ambientOcclusion, const in float roughness ) {\n\treturn saturate( pow( dotNV + ambientOcclusion, exp2( - 16.0 * roughness - 1.0 ) ) - 1.0 + ambientOcclusion );\n}",lights_fragment_begin:"\nGeometricContext geometry;\ngeometry.position = - vViewPosition;\ngeometry.normal = normal;\ngeometry.viewDir = ( isOrthographic ) ? vec3( 0, 0, 1 ) : normalize( vViewPosition );\n#ifdef CLEARCOAT\n\tgeometry.clearcoatNormal = clearcoatNormal;\n#endif\nIncidentLight directLight;\n#if ( NUM_POINT_LIGHTS > 0 ) && defined( RE_Direct )\n\tPointLight pointLight;\n\t#pragma unroll_loop\n\tfor ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {\n\t\tpointLight = pointLights[ i ];\n\t\tgetPointDirectLightIrradiance( pointLight, geometry, directLight );\n\t\t#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_POINT_LIGHT_SHADOWS )\n\t\tdirectLight.color *= all( bvec3( pointLight.shadow, directLight.visible, receiveShadow ) ) ? getPointShadow( pointShadowMap[ i ], pointLight.shadowMapSize, pointLight.shadowBias, pointLight.shadowRadius, vPointShadowCoord[ i ], pointLight.shadowCameraNear, pointLight.shadowCameraFar ) : 1.0;\n\t\t#endif\n\t\tRE_Direct( directLight, geometry, material, reflectedLight );\n\t}\n#endif\n#if ( NUM_SPOT_LIGHTS > 0 ) && defined( RE_Direct )\n\tSpotLight spotLight;\n\t#pragma unroll_loop\n\tfor ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {\n\t\tspotLight = spotLights[ i ];\n\t\tgetSpotDirectLightIrradiance( spotLight, geometry, directLight );\n\t\t#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )\n\t\tdirectLight.color *= all( bvec3( spotLight.shadow, directLight.visible, receiveShadow ) ) ? getShadow( spotShadowMap[ i ], spotLight.shadowMapSize, spotLight.shadowBias, spotLight.shadowRadius, vSpotShadowCoord[ i ] ) : 1.0;\n\t\t#endif\n\t\tRE_Direct( directLight, geometry, material, reflectedLight );\n\t}\n#endif\n#if ( NUM_DIR_LIGHTS > 0 ) && defined( RE_Direct )\n\tDirectionalLight directionalLight;\n\t#pragma unroll_loop\n\tfor ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {\n\t\tdirectionalLight = directionalLights[ i ];\n\t\tgetDirectionalDirectLightIrradiance( directionalLight, geometry, directLight );\n\t\t#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_DIR_LIGHT_SHADOWS )\n\t\tdirectLight.color *= all( bvec3( directionalLight.shadow, directLight.visible, receiveShadow ) ) ? getShadow( directionalShadowMap[ i ], directionalLight.shadowMapSize, directionalLight.shadowBias, directionalLight.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;\n\t\t#endif\n\t\tRE_Direct( directLight, geometry, material, reflectedLight );\n\t}\n#endif\n#if ( NUM_RECT_AREA_LIGHTS > 0 ) && defined( RE_Direct_RectArea )\n\tRectAreaLight rectAreaLight;\n\t#pragma unroll_loop\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#endif\n#if defined( RE_IndirectDiffuse )\n\tvec3 iblIrradiance = vec3( 0.0 );\n\tvec3 irradiance = getAmbientLightIrradiance( ambientLightColor );\n\tirradiance += getLightProbeIrradiance( lightProbe, geometry );\n\t#if ( NUM_HEMI_LIGHTS > 0 )\n\t\t#pragma unroll_loop\n\t\tfor ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) {\n\t\t\tirradiance += getHemisphereLightIrradiance( hemisphereLights[ i ], geometry );\n\t\t}\n\t#endif\n#endif\n#if defined( RE_IndirectSpecular )\n\tvec3 radiance = vec3( 0.0 );\n\tvec3 clearcoatRadiance = vec3( 0.0 );\n#endif",lights_fragment_maps:"#if defined( RE_IndirectDiffuse )\n\t#ifdef USE_LIGHTMAP\n\t\tvec4 lightMapTexel= texture2D( lightMap, vUv2 );\n\t\tvec3 lightMapIrradiance = lightMapTexelToLinear( lightMapTexel ).rgb * lightMapIntensity;\n\t\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\t\t\tlightMapIrradiance *= PI;\n\t\t#endif\n\t\tirradiance += lightMapIrradiance;\n\t#endif\n\t#if defined( USE_ENVMAP ) && defined( STANDARD ) && defined( ENVMAP_TYPE_CUBE_UV )\n\t\tiblIrradiance += getLightProbeIndirectIrradiance( geometry, maxMipLevel );\n\t#endif\n#endif\n#if defined( USE_ENVMAP ) && defined( RE_IndirectSpecular )\n\tradiance += getLightProbeIndirectRadiance( geometry.viewDir, geometry.normal, material.specularRoughness, maxMipLevel );\n\t#ifdef CLEARCOAT\n\t\tclearcoatRadiance += getLightProbeIndirectRadiance( geometry.viewDir, geometry.clearcoatNormal, material.clearcoatRoughness, maxMipLevel );\n\t#endif\n#endif",lights_fragment_end:"#if defined( RE_IndirectDiffuse )\n\tRE_IndirectDiffuse( irradiance, geometry, material, reflectedLight );\n#endif\n#if defined( RE_IndirectSpecular )\n\tRE_IndirectSpecular( radiance, iblIrradiance, clearcoatRadiance, geometry, material, reflectedLight );\n#endif",logdepthbuf_fragment:"#if defined( USE_LOGDEPTHBUF ) && defined( USE_LOGDEPTHBUF_EXT )\n\tgl_FragDepthEXT = vIsPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;\n#endif",logdepthbuf_pars_fragment:"#if defined( USE_LOGDEPTHBUF ) && defined( USE_LOGDEPTHBUF_EXT )\n\tuniform float logDepthBufFC;\n\tvarying float vFragDepth;\n\tvarying float vIsPerspective;\n#endif",logdepthbuf_pars_vertex:"#ifdef USE_LOGDEPTHBUF\n\t#ifdef USE_LOGDEPTHBUF_EXT\n\t\tvarying float vFragDepth;\n\t\tvarying float vIsPerspective;\n\t#else\n\t\tuniform float logDepthBufFC;\n\t#endif\n#endif",logdepthbuf_vertex:"#ifdef USE_LOGDEPTHBUF\n\t#ifdef USE_LOGDEPTHBUF_EXT\n\t\tvFragDepth = 1.0 + gl_Position.w;\n\t\tvIsPerspective = float( isPerspectiveMatrix( projectionMatrix ) );\n\t#else\n\t\tif ( isPerspectiveMatrix( projectionMatrix ) ) {\n\t\t\tgl_Position.z = log2( max( EPSILON, gl_Position.w + 1.0 ) ) * logDepthBufFC - 1.0;\n\t\t\tgl_Position.z *= gl_Position.w;\n\t\t}\n\t#endif\n#endif",map_fragment:"#ifdef USE_MAP\n\tvec4 texelColor = texture2D( map, vUv );\n\ttexelColor = mapTexelToLinear( texelColor );\n\tdiffuseColor *= texelColor;\n#endif",map_pars_fragment:"#ifdef USE_MAP\n\tuniform sampler2D map;\n#endif",map_particle_fragment:"#if defined( USE_MAP ) || defined( USE_ALPHAMAP )\n\tvec2 uv = ( uvTransform * vec3( gl_PointCoord.x, 1.0 - gl_PointCoord.y, 1 ) ).xy;\n#endif\n#ifdef USE_MAP\n\tvec4 mapTexel = texture2D( map, uv );\n\tdiffuseColor *= mapTexelToLinear( mapTexel );\n#endif\n#ifdef USE_ALPHAMAP\n\tdiffuseColor.a *= texture2D( alphaMap, uv ).g;\n#endif",map_particle_pars_fragment:"#if defined( USE_MAP ) || defined( USE_ALPHAMAP )\n\tuniform mat3 uvTransform;\n#endif\n#ifdef USE_MAP\n\tuniform sampler2D map;\n#endif\n#ifdef USE_ALPHAMAP\n\tuniform sampler2D alphaMap;\n#endif",metalnessmap_fragment:"float metalnessFactor = metalness;\n#ifdef USE_METALNESSMAP\n\tvec4 texelMetalness = texture2D( metalnessMap, vUv );\n\tmetalnessFactor *= texelMetalness.b;\n#endif",metalnessmap_pars_fragment:"#ifdef USE_METALNESSMAP\n\tuniform sampler2D metalnessMap;\n#endif",morphnormal_vertex:"#ifdef USE_MORPHNORMALS\n\tobjectNormal *= morphTargetBaseInfluence;\n\tobjectNormal += morphNormal0 * morphTargetInfluences[ 0 ];\n\tobjectNormal += morphNormal1 * morphTargetInfluences[ 1 ];\n\tobjectNormal += morphNormal2 * morphTargetInfluences[ 2 ];\n\tobjectNormal += morphNormal3 * morphTargetInfluences[ 3 ];\n#endif",morphtarget_pars_vertex:"#ifdef USE_MORPHTARGETS\n\tuniform float morphTargetBaseInfluence;\n\t#ifndef USE_MORPHNORMALS\n\tuniform float morphTargetInfluences[ 8 ];\n\t#else\n\tuniform float morphTargetInfluences[ 4 ];\n\t#endif\n#endif",morphtarget_vertex:"#ifdef USE_MORPHTARGETS\n\ttransformed *= morphTargetBaseInfluence;\n\ttransformed += morphTarget0 * morphTargetInfluences[ 0 ];\n\ttransformed += morphTarget1 * morphTargetInfluences[ 1 ];\n\ttransformed += morphTarget2 * morphTargetInfluences[ 2 ];\n\ttransformed += morphTarget3 * morphTargetInfluences[ 3 ];\n\t#ifndef USE_MORPHNORMALS\n\ttransformed += morphTarget4 * morphTargetInfluences[ 4 ];\n\ttransformed += morphTarget5 * morphTargetInfluences[ 5 ];\n\ttransformed += morphTarget6 * morphTargetInfluences[ 6 ];\n\ttransformed += morphTarget7 * morphTargetInfluences[ 7 ];\n\t#endif\n#endif",normal_fragment_begin:"#ifdef FLAT_SHADED\n\tvec3 fdx = vec3( dFdx( vViewPosition.x ), dFdx( vViewPosition.y ), dFdx( vViewPosition.z ) );\n\tvec3 fdy = vec3( dFdy( vViewPosition.x ), dFdy( vViewPosition.y ), dFdy( vViewPosition.z ) );\n\tvec3 normal = normalize( cross( fdx, fdy ) );\n#else\n\tvec3 normal = normalize( vNormal );\n\t#ifdef DOUBLE_SIDED\n\t\tnormal = normal * ( float( gl_FrontFacing ) * 2.0 - 1.0 );\n\t#endif\n\t#ifdef USE_TANGENT\n\t\tvec3 tangent = normalize( vTangent );\n\t\tvec3 bitangent = normalize( vBitangent );\n\t\t#ifdef DOUBLE_SIDED\n\t\t\ttangent = tangent * ( float( gl_FrontFacing ) * 2.0 - 1.0 );\n\t\t\tbitangent = bitangent * ( float( gl_FrontFacing ) * 2.0 - 1.0 );\n\t\t#endif\n\t\t#if defined( TANGENTSPACE_NORMALMAP ) || defined( USE_CLEARCOAT_NORMALMAP )\n\t\t\tmat3 vTBN = mat3( tangent, bitangent, normal );\n\t\t#endif\n\t#endif\n#endif\nvec3 geometryNormal = normal;",normal_fragment_maps:"#ifdef OBJECTSPACE_NORMALMAP\n\tnormal = texture2D( normalMap, vUv ).xyz * 2.0 - 1.0;\n\t#ifdef FLIP_SIDED\n\t\tnormal = - normal;\n\t#endif\n\t#ifdef DOUBLE_SIDED\n\t\tnormal = normal * ( float( gl_FrontFacing ) * 2.0 - 1.0 );\n\t#endif\n\tnormal = normalize( normalMatrix * normal );\n#elif defined( TANGENTSPACE_NORMALMAP )\n\tvec3 mapN = texture2D( normalMap, vUv ).xyz * 2.0 - 1.0;\n\tmapN.xy *= normalScale;\n\t#ifdef USE_TANGENT\n\t\tnormal = normalize( vTBN * mapN );\n\t#else\n\t\tnormal = perturbNormal2Arb( -vViewPosition, normal, mapN );\n\t#endif\n#elif defined( USE_BUMPMAP )\n\tnormal = perturbNormalArb( -vViewPosition, normal, dHdxy_fwd() );\n#endif",normalmap_pars_fragment:"#ifdef USE_NORMALMAP\n\tuniform sampler2D normalMap;\n\tuniform vec2 normalScale;\n#endif\n#ifdef OBJECTSPACE_NORMALMAP\n\tuniform mat3 normalMatrix;\n#endif\n#if ! defined ( USE_TANGENT ) && ( defined ( TANGENTSPACE_NORMALMAP ) || defined ( USE_CLEARCOAT_NORMALMAP ) )\n\tvec3 perturbNormal2Arb( vec3 eye_pos, vec3 surf_norm, vec3 mapN ) {\n\t\tvec3 q0 = vec3( dFdx( eye_pos.x ), dFdx( eye_pos.y ), dFdx( eye_pos.z ) );\n\t\tvec3 q1 = vec3( dFdy( eye_pos.x ), dFdy( eye_pos.y ), dFdy( eye_pos.z ) );\n\t\tvec2 st0 = dFdx( vUv.st );\n\t\tvec2 st1 = dFdy( vUv.st );\n\t\tfloat scale = sign( st1.t * st0.s - st0.t * st1.s );\n\t\tvec3 S = normalize( ( q0 * st1.t - q1 * st0.t ) * scale );\n\t\tvec3 T = normalize( ( - q0 * st1.s + q1 * st0.s ) * scale );\n\t\tvec3 N = normalize( surf_norm );\n\t\tmat3 tsn = mat3( S, T, N );\n\t\tmapN.xy *= ( float( gl_FrontFacing ) * 2.0 - 1.0 );\n\t\treturn normalize( tsn * mapN );\n\t}\n#endif",clearcoat_normal_fragment_begin:"#ifdef CLEARCOAT\n\tvec3 clearcoatNormal = geometryNormal;\n#endif",clearcoat_normal_fragment_maps:"#ifdef USE_CLEARCOAT_NORMALMAP\n\tvec3 clearcoatMapN = texture2D( clearcoatNormalMap, vUv ).xyz * 2.0 - 1.0;\n\tclearcoatMapN.xy *= clearcoatNormalScale;\n\t#ifdef USE_TANGENT\n\t\tclearcoatNormal = normalize( vTBN * clearcoatMapN );\n\t#else\n\t\tclearcoatNormal = perturbNormal2Arb( - vViewPosition, clearcoatNormal, clearcoatMapN );\n\t#endif\n#endif",clearcoat_normalmap_pars_fragment:"#ifdef USE_CLEARCOAT_NORMALMAP\n\tuniform sampler2D clearcoatNormalMap;\n\tuniform vec2 clearcoatNormalScale;\n#endif",packing:"vec3 packNormalToRGB( const in vec3 normal ) {\n\treturn normalize( normal ) * 0.5 + 0.5;\n}\nvec3 unpackRGBToNormal( const in vec3 rgb ) {\n\treturn 2.0 * rgb.xyz - 1.0;\n}\nconst float PackUpscale = 256. / 255.;const float UnpackDownscale = 255. / 256.;\nconst vec3 PackFactors = vec3( 256. * 256. * 256., 256. * 256., 256. );\nconst vec4 UnpackFactors = UnpackDownscale / vec4( PackFactors, 1. );\nconst float ShiftRight8 = 1. / 256.;\nvec4 packDepthToRGBA( const in float v ) {\n\tvec4 r = vec4( fract( v * PackFactors ), v );\n\tr.yzw -= r.xyz * ShiftRight8;\treturn r * PackUpscale;\n}\nfloat unpackRGBAToDepth( const in vec4 v ) {\n\treturn dot( v, UnpackFactors );\n}\nvec4 pack2HalfToRGBA( vec2 v ) {\n\tvec4 r = vec4( v.x, fract( v.x * 255.0 ), v.y, fract( v.y * 255.0 ));\n\treturn vec4( r.x - r.y / 255.0, r.y, r.z - r.w / 255.0, r.w);\n}\nvec2 unpackRGBATo2Half( vec4 v ) {\n\treturn vec2( v.x + ( v.y / 255.0 ), v.z + ( v.w / 255.0 ) );\n}\nfloat viewZToOrthographicDepth( const in float viewZ, const in float near, const in float far ) {\n\treturn ( viewZ + near ) / ( near - far );\n}\nfloat orthographicDepthToViewZ( const in float linearClipZ, const in float near, const in float far ) {\n\treturn linearClipZ * ( near - far ) - near;\n}\nfloat viewZToPerspectiveDepth( const in float viewZ, const in float near, const in float far ) {\n\treturn (( near + viewZ ) * far ) / (( far - near ) * viewZ );\n}\nfloat perspectiveDepthToViewZ( const in float invClipZ, const in float near, const in float far ) {\n\treturn ( near * far ) / ( ( far - near ) * invClipZ - far );\n}",premultiplied_alpha_fragment:"#ifdef PREMULTIPLIED_ALPHA\n\tgl_FragColor.rgb *= gl_FragColor.a;\n#endif",project_vertex:"vec4 mvPosition = vec4( transformed, 1.0 );\n#ifdef USE_INSTANCING\n\tmvPosition = instanceMatrix * mvPosition;\n#endif\nmvPosition = modelViewMatrix * mvPosition;\ngl_Position = projectionMatrix * mvPosition;",dithering_fragment:"#ifdef DITHERING\n\tgl_FragColor.rgb = dithering( gl_FragColor.rgb );\n#endif",dithering_pars_fragment:"#ifdef DITHERING\n\tvec3 dithering( vec3 color ) {\n\t\tfloat grid_position = rand( gl_FragCoord.xy );\n\t\tvec3 dither_shift_RGB = vec3( 0.25 / 255.0, -0.25 / 255.0, 0.25 / 255.0 );\n\t\tdither_shift_RGB = mix( 2.0 * dither_shift_RGB, -2.0 * dither_shift_RGB, grid_position );\n\t\treturn color + dither_shift_RGB;\n\t}\n#endif",roughnessmap_fragment:"float roughnessFactor = roughness;\n#ifdef USE_ROUGHNESSMAP\n\tvec4 texelRoughness = texture2D( roughnessMap, vUv );\n\troughnessFactor *= texelRoughness.g;\n#endif",roughnessmap_pars_fragment:"#ifdef USE_ROUGHNESSMAP\n\tuniform sampler2D roughnessMap;\n#endif",shadowmap_pars_fragment:"#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHT_SHADOWS > 0\n\t\tuniform sampler2D directionalShadowMap[ NUM_DIR_LIGHT_SHADOWS ];\n\t\tvarying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ];\n\t#endif\n\t#if NUM_SPOT_LIGHT_SHADOWS > 0\n\t\tuniform sampler2D spotShadowMap[ NUM_SPOT_LIGHT_SHADOWS ];\n\t\tvarying vec4 vSpotShadowCoord[ NUM_SPOT_LIGHT_SHADOWS ];\n\t#endif\n\t#if NUM_POINT_LIGHT_SHADOWS > 0\n\t\tuniform sampler2D pointShadowMap[ NUM_POINT_LIGHT_SHADOWS ];\n\t\tvarying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ];\n\t#endif\n\tfloat texture2DCompare( sampler2D depths, vec2 uv, float compare ) {\n\t\treturn step( compare, unpackRGBAToDepth( texture2D( depths, uv ) ) );\n\t}\n\tvec2 texture2DDistribution( sampler2D shadow, vec2 uv ) {\n\t\treturn unpackRGBATo2Half( texture2D( shadow, uv ) );\n\t}\n\tfloat VSMShadow (sampler2D shadow, vec2 uv, float compare ){\n\t\tfloat occlusion = 1.0;\n\t\tvec2 distribution = texture2DDistribution( shadow, uv );\n\t\tfloat hard_shadow = step( compare , distribution.x );\n\t\tif (hard_shadow != 1.0 ) {\n\t\t\tfloat distance = compare - distribution.x ;\n\t\t\tfloat variance = max( 0.00000, distribution.y * distribution.y );\n\t\t\tfloat softness_probability = variance / (variance + distance * distance );\t\t\tsoftness_probability = clamp( ( softness_probability - 0.3 ) / ( 0.95 - 0.3 ), 0.0, 1.0 );\t\t\tocclusion = clamp( max( hard_shadow, softness_probability ), 0.0, 1.0 );\n\t\t}\n\t\treturn occlusion;\n\t}\n\tfloat texture2DShadowLerp( sampler2D depths, vec2 size, vec2 uv, float compare ) {\n\t\tconst vec2 offset = vec2( 0.0, 1.0 );\n\t\tvec2 texelSize = vec2( 1.0 ) / size;\n\t\tvec2 centroidUV = ( floor( uv * size - 0.5 ) + 0.5 ) * texelSize;\n\t\tfloat lb = texture2DCompare( depths, centroidUV + texelSize * offset.xx, compare );\n\t\tfloat lt = texture2DCompare( depths, centroidUV + texelSize * offset.xy, compare );\n\t\tfloat rb = texture2DCompare( depths, centroidUV + texelSize * offset.yx, compare );\n\t\tfloat rt = texture2DCompare( depths, centroidUV + texelSize * offset.yy, compare );\n\t\tvec2 f = fract( uv * size + 0.5 );\n\t\tfloat a = mix( lb, lt, f.y );\n\t\tfloat b = mix( rb, rt, f.y );\n\t\tfloat c = mix( a, b, f.x );\n\t\treturn c;\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 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\tshadow = (\n\t\t\t\ttexture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy + vec2( dx0, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy + vec2( 0.0, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy + vec2( dx1, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy + vec2( dx0, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy, shadowCoord.z ) +\n\t\t\t\ttexture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy + vec2( dx1, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy + vec2( dx0, dy1 ), shadowCoord.z ) +\n\t\t\t\ttexture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy + vec2( 0.0, dy1 ), shadowCoord.z ) +\n\t\t\t\ttexture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy + vec2( dx1, dy1 ), shadowCoord.z )\n\t\t\t) * ( 1.0 / 9.0 );\n\t\t#elif defined( SHADOWMAP_TYPE_VSM )\n\t\t\tshadow = VSMShadow( shadowMap, shadowCoord.xy, shadowCoord.z );\n\t\t#else\n\t\t\tshadow = texture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z );\n\t\t#endif\n\t\t}\n\t\treturn shadow;\n\t}\n\tvec2 cubeToUV( vec3 v, float texelSizeY ) {\n\t\tvec3 absV = abs( v );\n\t\tfloat scaleToCube = 1.0 / max( absV.x, max( absV.y, absV.z ) );\n\t\tabsV *= scaleToCube;\n\t\tv *= scaleToCube * ( 1.0 - 2.0 * texelSizeY );\n\t\tvec2 planar = v.xy;\n\t\tfloat almostATexel = 1.5 * texelSizeY;\n\t\tfloat almostOne = 1.0 - almostATexel;\n\t\tif ( absV.z >= almostOne ) {\n\t\t\tif ( v.z > 0.0 )\n\t\t\t\tplanar.x = 4.0 - v.x;\n\t\t} else if ( absV.x >= almostOne ) {\n\t\t\tfloat signX = sign( v.x );\n\t\t\tplanar.x = v.z * signX + 2.0 * signX;\n\t\t} else if ( absV.y >= almostOne ) {\n\t\t\tfloat signY = sign( v.y );\n\t\t\tplanar.x = v.x + 2.0 * signY + 2.0;\n\t\t\tplanar.y = v.z * signY - 2.0;\n\t\t}\n\t\treturn vec2( 0.125, 0.25 ) * planar + vec2( 0.375, 0.75 );\n\t}\n\tfloat getPointShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowBias, float shadowRadius, vec4 shadowCoord, float shadowCameraNear, float shadowCameraFar ) {\n\t\tvec2 texelSize = vec2( 1.0 ) / ( shadowMapSize * vec2( 4.0, 2.0 ) );\n\t\tvec3 lightToPosition = shadowCoord.xyz;\n\t\tfloat dp = ( length( lightToPosition ) - shadowCameraNear ) / ( shadowCameraFar - shadowCameraNear );\t\tdp += shadowBias;\n\t\tvec3 bd3D = normalize( lightToPosition );\n\t\t#if defined( SHADOWMAP_TYPE_PCF ) || defined( SHADOWMAP_TYPE_PCF_SOFT ) || defined( SHADOWMAP_TYPE_VSM )\n\t\t\tvec2 offset = vec2( - 1, 1 ) * shadowRadius * texelSize.y;\n\t\t\treturn (\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyy, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyy, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyx, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyx, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxy, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxy, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxx, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxx, texelSize.y ), dp )\n\t\t\t) * ( 1.0 / 9.0 );\n\t\t#else\n\t\t\treturn texture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp );\n\t\t#endif\n\t}\n#endif",shadowmap_pars_vertex:"#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHT_SHADOWS > 0\n\t\tuniform mat4 directionalShadowMatrix[ NUM_DIR_LIGHT_SHADOWS ];\n\t\tvarying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ];\n\t#endif\n\t#if NUM_SPOT_LIGHT_SHADOWS > 0\n\t\tuniform mat4 spotShadowMatrix[ NUM_SPOT_LIGHT_SHADOWS ];\n\t\tvarying vec4 vSpotShadowCoord[ NUM_SPOT_LIGHT_SHADOWS ];\n\t#endif\n\t#if NUM_POINT_LIGHT_SHADOWS > 0\n\t\tuniform mat4 pointShadowMatrix[ NUM_POINT_LIGHT_SHADOWS ];\n\t\tvarying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ];\n\t#endif\n#endif",shadowmap_vertex:"#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHT_SHADOWS > 0\n\t#pragma unroll_loop\n\tfor ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) {\n\t\tvDirectionalShadowCoord[ i ] = directionalShadowMatrix[ i ] * worldPosition;\n\t}\n\t#endif\n\t#if NUM_SPOT_LIGHT_SHADOWS > 0\n\t#pragma unroll_loop\n\tfor ( int i = 0; i < NUM_SPOT_LIGHT_SHADOWS; i ++ ) {\n\t\tvSpotShadowCoord[ i ] = spotShadowMatrix[ i ] * worldPosition;\n\t}\n\t#endif\n\t#if NUM_POINT_LIGHT_SHADOWS > 0\n\t#pragma unroll_loop\n\tfor ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) {\n\t\tvPointShadowCoord[ i ] = pointShadowMatrix[ i ] * worldPosition;\n\t}\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\tDirectionalLight directionalLight;\n\t#pragma unroll_loop\n\tfor ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) {\n\t\tdirectionalLight = directionalLights[ i ];\n\t\tshadow *= all( bvec2( directionalLight.shadow, receiveShadow ) ) ? getShadow( directionalShadowMap[ i ], directionalLight.shadowMapSize, directionalLight.shadowBias, directionalLight.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;\n\t}\n\t#endif\n\t#if NUM_SPOT_LIGHT_SHADOWS > 0\n\tSpotLight spotLight;\n\t#pragma unroll_loop\n\tfor ( int i = 0; i < NUM_SPOT_LIGHT_SHADOWS; i ++ ) {\n\t\tspotLight = spotLights[ i ];\n\t\tshadow *= all( bvec2( spotLight.shadow, receiveShadow ) ) ? getShadow( spotShadowMap[ i ], spotLight.shadowMapSize, spotLight.shadowBias, spotLight.shadowRadius, vSpotShadowCoord[ i ] ) : 1.0;\n\t}\n\t#endif\n\t#if NUM_POINT_LIGHT_SHADOWS > 0\n\tPointLight pointLight;\n\t#pragma unroll_loop\n\tfor ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) {\n\t\tpointLight = pointLights[ i ];\n\t\tshadow *= all( bvec2( pointLight.shadow, receiveShadow ) ) ? getPointShadow( pointShadowMap[ i ], pointLight.shadowMapSize, pointLight.shadowBias, pointLight.shadowRadius, vPointShadowCoord[ i ], pointLight.shadowCameraNear, pointLight.shadowCameraFar ) : 1.0;\n\t}\n\t#endif\n\t#endif\n\treturn shadow;\n}",skinbase_vertex:"#ifdef USE_SKINNING\n\tmat4 boneMatX = getBoneMatrix( skinIndex.x );\n\tmat4 boneMatY = getBoneMatrix( skinIndex.y );\n\tmat4 boneMatZ = getBoneMatrix( skinIndex.z );\n\tmat4 boneMatW = getBoneMatrix( skinIndex.w );\n#endif",skinning_pars_vertex:"#ifdef USE_SKINNING\n\tuniform mat4 bindMatrix;\n\tuniform mat4 bindMatrixInverse;\n\t#ifdef BONE_TEXTURE\n\t\tuniform highp sampler2D boneTexture;\n\t\tuniform int boneTextureSize;\n\t\tmat4 getBoneMatrix( const in float i ) {\n\t\t\tfloat j = i * 4.0;\n\t\t\tfloat x = mod( j, float( boneTextureSize ) );\n\t\t\tfloat y = floor( j / float( boneTextureSize ) );\n\t\t\tfloat dx = 1.0 / float( boneTextureSize );\n\t\t\tfloat dy = 1.0 / float( boneTextureSize );\n\t\t\ty = dy * ( y + 0.5 );\n\t\t\tvec4 v1 = texture2D( boneTexture, vec2( dx * ( x + 0.5 ), y ) );\n\t\t\tvec4 v2 = texture2D( boneTexture, vec2( dx * ( x + 1.5 ), y ) );\n\t\t\tvec4 v3 = texture2D( boneTexture, vec2( dx * ( x + 2.5 ), y ) );\n\t\t\tvec4 v4 = texture2D( boneTexture, vec2( dx * ( x + 3.5 ), y ) );\n\t\t\tmat4 bone = mat4( v1, v2, v3, v4 );\n\t\t\treturn bone;\n\t\t}\n\t#else\n\t\tuniform mat4 boneMatrices[ MAX_BONES ];\n\t\tmat4 getBoneMatrix( const in float i ) {\n\t\t\tmat4 bone = boneMatrices[ int(i) ];\n\t\t\treturn bone;\n\t\t}\n\t#endif\n#endif",skinning_vertex:"#ifdef USE_SKINNING\n\tvec4 skinVertex = bindMatrix * vec4( transformed, 1.0 );\n\tvec4 skinned = vec4( 0.0 );\n\tskinned += boneMatX * skinVertex * skinWeight.x;\n\tskinned += boneMatY * skinVertex * skinWeight.y;\n\tskinned += boneMatZ * skinVertex * skinWeight.z;\n\tskinned += boneMatW * skinVertex * skinWeight.w;\n\ttransformed = ( bindMatrixInverse * skinned ).xyz;\n#endif",skinnormal_vertex:"#ifdef USE_SKINNING\n\tmat4 skinMatrix = mat4( 0.0 );\n\tskinMatrix += skinWeight.x * boneMatX;\n\tskinMatrix += skinWeight.y * boneMatY;\n\tskinMatrix += skinWeight.z * boneMatZ;\n\tskinMatrix += skinWeight.w * boneMatW;\n\tskinMatrix = bindMatrixInverse * skinMatrix * bindMatrix;\n\tobjectNormal = vec4( skinMatrix * vec4( objectNormal, 0.0 ) ).xyz;\n\t#ifdef USE_TANGENT\n\t\tobjectTangent = vec4( skinMatrix * vec4( objectTangent, 0.0 ) ).xyz;\n\t#endif\n#endif",specularmap_fragment:"float specularStrength;\n#ifdef USE_SPECULARMAP\n\tvec4 texelSpecular = texture2D( specularMap, vUv );\n\tspecularStrength = texelSpecular.r;\n#else\n\tspecularStrength = 1.0;\n#endif",specularmap_pars_fragment:"#ifdef USE_SPECULARMAP\n\tuniform sampler2D specularMap;\n#endif",tonemapping_fragment:"#if defined( TONE_MAPPING )\n\tgl_FragColor.rgb = toneMapping( gl_FragColor.rgb );\n#endif",tonemapping_pars_fragment:"#ifndef saturate\n#define saturate(a) clamp( a, 0.0, 1.0 )\n#endif\nuniform float toneMappingExposure;\nuniform float toneMappingWhitePoint;\nvec3 LinearToneMapping( vec3 color ) {\n\treturn toneMappingExposure * color;\n}\nvec3 ReinhardToneMapping( vec3 color ) {\n\tcolor *= toneMappingExposure;\n\treturn saturate( color / ( vec3( 1.0 ) + color ) );\n}\n#define Uncharted2Helper( x ) max( ( ( x * ( 0.15 * x + 0.10 * 0.50 ) + 0.20 * 0.02 ) / ( x * ( 0.15 * x + 0.50 ) + 0.20 * 0.30 ) ) - 0.02 / 0.30, vec3( 0.0 ) )\nvec3 Uncharted2ToneMapping( vec3 color ) {\n\tcolor *= toneMappingExposure;\n\treturn saturate( Uncharted2Helper( color ) / Uncharted2Helper( vec3( toneMappingWhitePoint ) ) );\n}\nvec3 OptimizedCineonToneMapping( vec3 color ) {\n\tcolor *= toneMappingExposure;\n\tcolor = max( vec3( 0.0 ), color - 0.004 );\n\treturn pow( ( color * ( 6.2 * color + 0.5 ) ) / ( color * ( 6.2 * color + 1.7 ) + 0.06 ), vec3( 2.2 ) );\n}\nvec3 ACESFilmicToneMapping( vec3 color ) {\n\tcolor *= toneMappingExposure;\n\treturn saturate( ( color * ( 2.51 * color + 0.03 ) ) / ( color * ( 2.43 * color + 0.59 ) + 0.14 ) );\n}",uv_pars_fragment:"#if ( defined( USE_UV ) && ! defined( UVS_VERTEX_ONLY ) )\n\tvarying vec2 vUv;\n#endif",uv_pars_vertex:"#ifdef USE_UV\n\t#ifdef UVS_VERTEX_ONLY\n\t\tvec2 vUv;\n\t#else\n\t\tvarying vec2 vUv;\n\t#endif\n\tuniform mat3 uvTransform;\n#endif",uv_vertex:"#ifdef USE_UV\n\tvUv = ( uvTransform * vec3( uv, 1 ) ).xy;\n#endif",uv2_pars_fragment:"#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP )\n\tvarying vec2 vUv2;\n#endif",uv2_pars_vertex:"#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP )\n\tattribute vec2 uv2;\n\tvarying vec2 vUv2;\n\tuniform mat3 uv2Transform;\n#endif",uv2_vertex:"#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP )\n\tvUv2 = ( uv2Transform * vec3( uv2, 1 ) ).xy;\n#endif",worldpos_vertex:"#if defined( USE_ENVMAP ) || defined( DISTANCE ) || defined ( USE_SHADOWMAP )\n\tvec4 worldPosition = vec4( transformed, 1.0 );\n\t#ifdef USE_INSTANCING\n\t\tworldPosition = instanceMatrix * worldPosition;\n\t#endif\n\tworldPosition = modelMatrix * worldPosition;\n#endif",background_frag:"uniform sampler2D t2D;\nvarying vec2 vUv;\nvoid main() {\n\tvec4 texColor = texture2D( t2D, vUv );\n\tgl_FragColor = mapTexelToLinear( texColor );\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n}",background_vert:"varying vec2 vUv;\nuniform mat3 uvTransform;\nvoid main() {\n\tvUv = ( uvTransform * vec3( uv, 1 ) ).xy;\n\tgl_Position = vec4( position.xy, 1.0, 1.0 );\n}",cube_frag:"#include <envmap_common_pars_fragment>\nuniform float opacity;\nvarying vec3 vWorldDirection;\n#include <cube_uv_reflection_fragment>\nvoid main() {\n\tvec3 vReflect = vWorldDirection;\n\t#include <envmap_fragment>\n\tgl_FragColor = envColor;\n\tgl_FragColor.a *= opacity;\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n}",cube_vert:"varying vec3 vWorldDirection;\n#include <common>\nvoid main() {\n\tvWorldDirection = transformDirection( position, modelMatrix );\n\t#include <begin_vertex>\n\t#include <project_vertex>\n\tgl_Position.z = gl_Position.w;\n}",depth_frag:"#if DEPTH_PACKING == 3200\n\tuniform float opacity;\n#endif\n#include <common>\n#include <packing>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tvec4 diffuseColor = vec4( 1.0 );\n\t#if DEPTH_PACKING == 3200\n\t\tdiffuseColor.a = opacity;\n\t#endif\n\t#include <map_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <logdepthbuf_fragment>\n\t#if DEPTH_PACKING == 3200\n\t\tgl_FragColor = vec4( vec3( 1.0 - gl_FragCoord.z ), opacity );\n\t#elif DEPTH_PACKING == 3201\n\t\tgl_FragColor = packDepthToRGBA( gl_FragCoord.z );\n\t#endif\n}",depth_vert:"#include <common>\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <skinbase_vertex>\n\t#ifdef USE_DISPLACEMENTMAP\n\t\t#include <beginnormal_vertex>\n\t\t#include <morphnormal_vertex>\n\t\t#include <skinnormal_vertex>\n\t#endif\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n}",distanceRGBA_frag:"#define DISTANCE\nuniform vec3 referencePosition;\nuniform float nearDistance;\nuniform float farDistance;\nvarying vec3 vWorldPosition;\n#include <common>\n#include <packing>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main () {\n\t#include <clipping_planes_fragment>\n\tvec4 diffuseColor = vec4( 1.0 );\n\t#include <map_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\tfloat dist = length( vWorldPosition - referencePosition );\n\tdist = ( dist - nearDistance ) / ( farDistance - nearDistance );\n\tdist = saturate( dist );\n\tgl_FragColor = packDepthToRGBA( dist );\n}",distanceRGBA_vert:"#define DISTANCE\nvarying vec3 vWorldPosition;\n#include <common>\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <skinbase_vertex>\n\t#ifdef USE_DISPLACEMENTMAP\n\t\t#include <beginnormal_vertex>\n\t\t#include <morphnormal_vertex>\n\t\t#include <skinnormal_vertex>\n\t#endif\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <worldpos_vertex>\n\t#include <clipping_planes_vertex>\n\tvWorldPosition = worldPosition.xyz;\n}",equirect_frag:"uniform sampler2D tEquirect;\nvarying vec3 vWorldDirection;\n#include <common>\nvoid main() {\n\tvec3 direction = normalize( vWorldDirection );\n\tvec2 sampleUV;\n\tsampleUV.y = asin( clamp( direction.y, - 1.0, 1.0 ) ) * RECIPROCAL_PI + 0.5;\n\tsampleUV.x = atan( direction.z, direction.x ) * RECIPROCAL_PI2 + 0.5;\n\tvec4 texColor = texture2D( tEquirect, sampleUV );\n\tgl_FragColor = mapTexelToLinear( texColor );\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n}",equirect_vert:"varying vec3 vWorldDirection;\n#include <common>\nvoid main() {\n\tvWorldDirection = transformDirection( position, modelMatrix );\n\t#include <begin_vertex>\n\t#include <project_vertex>\n}",linedashed_frag:"uniform vec3 diffuse;\nuniform float opacity;\nuniform float dashSize;\nuniform float totalSize;\nvarying float vLineDistance;\n#include <common>\n#include <color_pars_fragment>\n#include <fog_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tif ( mod( vLineDistance, totalSize ) > dashSize ) {\n\t\tdiscard;\n\t}\n\tvec3 outgoingLight = vec3( 0.0 );\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <logdepthbuf_fragment>\n\t#include <color_fragment>\n\toutgoingLight = diffuseColor.rgb;\n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include <premultiplied_alpha_fragment>\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n}",linedashed_vert:"uniform float scale;\nattribute float lineDistance;\nvarying float vLineDistance;\n#include <common>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <color_vertex>\n\tvLineDistance = scale * lineDistance;\n\tvec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );\n\tgl_Position = projectionMatrix * mvPosition;\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\t#include <fog_vertex>\n}",meshbasic_frag:"uniform vec3 diffuse;\nuniform float opacity;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\n#include <common>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <uv2_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <envmap_common_pars_fragment>\n#include <envmap_pars_fragment>\n#include <cube_uv_reflection_fragment>\n#include <fog_pars_fragment>\n#include <specularmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <specularmap_fragment>\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\t#ifdef USE_LIGHTMAP\n\t\n\t\tvec4 lightMapTexel= texture2D( lightMap, vUv2 );\n\t\treflectedLight.indirectDiffuse += lightMapTexelToLinear( lightMapTexel ).rgb * lightMapIntensity;\n\t#else\n\t\treflectedLight.indirectDiffuse += vec3( 1.0 );\n\t#endif\n\t#include <aomap_fragment>\n\treflectedLight.indirectDiffuse *= diffuseColor.rgb;\n\tvec3 outgoingLight = reflectedLight.indirectDiffuse;\n\t#include <envmap_fragment>\n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include <premultiplied_alpha_fragment>\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n}",meshbasic_vert:"#include <common>\n#include <uv_pars_vertex>\n#include <uv2_pars_vertex>\n#include <envmap_pars_vertex>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <uv2_vertex>\n\t#include <color_vertex>\n\t#include <skinbase_vertex>\n\t#ifdef USE_ENVMAP\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n\t#endif\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <worldpos_vertex>\n\t#include <clipping_planes_vertex>\n\t#include <envmap_vertex>\n\t#include <fog_vertex>\n}",meshlambert_frag:"uniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float opacity;\nvarying vec3 vLightFront;\nvarying vec3 vIndirectFront;\n#ifdef DOUBLE_SIDED\n\tvarying vec3 vLightBack;\n\tvarying vec3 vIndirectBack;\n#endif\n#include <common>\n#include <packing>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <uv2_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <emissivemap_pars_fragment>\n#include <envmap_common_pars_fragment>\n#include <envmap_pars_fragment>\n#include <cube_uv_reflection_fragment>\n#include <bsdfs>\n#include <lights_pars_begin>\n#include <fog_pars_fragment>\n#include <shadowmap_pars_fragment>\n#include <shadowmask_pars_fragment>\n#include <specularmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <specularmap_fragment>\n\t#include <emissivemap_fragment>\n\treflectedLight.indirectDiffuse = getAmbientLightIrradiance( ambientLightColor );\n\t#ifdef DOUBLE_SIDED\n\t\treflectedLight.indirectDiffuse += ( gl_FrontFacing ) ? vIndirectFront : vIndirectBack;\n\t#else\n\t\treflectedLight.indirectDiffuse += vIndirectFront;\n\t#endif\n\t#include <lightmap_fragment>\n\treflectedLight.indirectDiffuse *= BRDF_Diffuse_Lambert( diffuseColor.rgb );\n\t#ifdef DOUBLE_SIDED\n\t\treflectedLight.directDiffuse = ( gl_FrontFacing ) ? vLightFront : vLightBack;\n\t#else\n\t\treflectedLight.directDiffuse = vLightFront;\n\t#endif\n\treflectedLight.directDiffuse *= BRDF_Diffuse_Lambert( diffuseColor.rgb ) * getShadowMask();\n\t#include <aomap_fragment>\n\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;\n\t#include <envmap_fragment>\n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n\t#include <dithering_fragment>\n}",meshlambert_vert:"#define LAMBERT\nvarying vec3 vLightFront;\nvarying vec3 vIndirectFront;\n#ifdef DOUBLE_SIDED\n\tvarying vec3 vLightBack;\n\tvarying vec3 vIndirectBack;\n#endif\n#include <common>\n#include <uv_pars_vertex>\n#include <uv2_pars_vertex>\n#include <envmap_pars_vertex>\n#include <bsdfs>\n#include <lights_pars_begin>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <shadowmap_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <uv2_vertex>\n\t#include <color_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\t#include <worldpos_vertex>\n\t#include <envmap_vertex>\n\t#include <lights_lambert_vertex>\n\t#include <shadowmap_vertex>\n\t#include <fog_vertex>\n}",meshmatcap_frag:"#define MATCAP\nuniform vec3 diffuse;\nuniform float opacity;\nuniform sampler2D matcap;\nvarying vec3 vViewPosition;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\n#include <common>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <fog_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <normal_fragment_begin>\n\t#include <normal_fragment_maps>\n\tvec3 viewDir = normalize( vViewPosition );\n\tvec3 x = normalize( vec3( viewDir.z, 0.0, - viewDir.x ) );\n\tvec3 y = cross( viewDir, x );\n\tvec2 uv = vec2( dot( x, normal ), dot( y, normal ) ) * 0.495 + 0.5;\n\t#ifdef USE_MATCAP\n\t\tvec4 matcapColor = texture2D( matcap, uv );\n\t\tmatcapColor = matcapTexelToLinear( matcapColor );\n\t#else\n\t\tvec4 matcapColor = vec4( 1.0 );\n\t#endif\n\tvec3 outgoingLight = diffuseColor.rgb * matcapColor.rgb;\n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include <premultiplied_alpha_fragment>\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n}",meshmatcap_vert:"#define MATCAP\nvarying vec3 vViewPosition;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\n#include <common>\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n\t#ifndef FLAT_SHADED\n\t\tvNormal = normalize( transformedNormal );\n\t#endif\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\t#include <fog_vertex>\n\tvViewPosition = - mvPosition.xyz;\n}",meshtoon_frag:"#define TOON\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform vec3 specular;\nuniform float shininess;\nuniform float opacity;\n#include <common>\n#include <packing>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <uv2_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <emissivemap_pars_fragment>\n#include <gradientmap_pars_fragment>\n#include <fog_pars_fragment>\n#include <bsdfs>\n#include <lights_pars_begin>\n#include <lights_toon_pars_fragment>\n#include <shadowmap_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <specularmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <specularmap_fragment>\n\t#include <normal_fragment_begin>\n\t#include <normal_fragment_maps>\n\t#include <emissivemap_fragment>\n\t#include <lights_toon_fragment>\n\t#include <lights_fragment_begin>\n\t#include <lights_fragment_maps>\n\t#include <lights_fragment_end>\n\t#include <aomap_fragment>\n\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveRadiance;\n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n\t#include <dithering_fragment>\n}",meshtoon_vert:"#define TOON\nvarying vec3 vViewPosition;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\n#include <common>\n#include <uv_pars_vertex>\n#include <uv2_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <shadowmap_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <uv2_vertex>\n\t#include <color_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n#ifndef FLAT_SHADED\n\tvNormal = normalize( transformedNormal );\n#endif\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\tvViewPosition = - mvPosition.xyz;\n\t#include <worldpos_vertex>\n\t#include <shadowmap_vertex>\n\t#include <fog_vertex>\n}",meshphong_frag:"#define PHONG\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform vec3 specular;\nuniform float shininess;\nuniform float opacity;\n#include <common>\n#include <packing>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <uv2_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <emissivemap_pars_fragment>\n#include <envmap_common_pars_fragment>\n#include <envmap_pars_fragment>\n#include <cube_uv_reflection_fragment>\n#include <fog_pars_fragment>\n#include <bsdfs>\n#include <lights_pars_begin>\n#include <lights_phong_pars_fragment>\n#include <shadowmap_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <specularmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <specularmap_fragment>\n\t#include <normal_fragment_begin>\n\t#include <normal_fragment_maps>\n\t#include <emissivemap_fragment>\n\t#include <lights_phong_fragment>\n\t#include <lights_fragment_begin>\n\t#include <lights_fragment_maps>\n\t#include <lights_fragment_end>\n\t#include <aomap_fragment>\n\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveRadiance;\n\t#include <envmap_fragment>\n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n\t#include <dithering_fragment>\n}",meshphong_vert:"#define PHONG\nvarying vec3 vViewPosition;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\n#include <common>\n#include <uv_pars_vertex>\n#include <uv2_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <envmap_pars_vertex>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <shadowmap_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <uv2_vertex>\n\t#include <color_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n#ifndef FLAT_SHADED\n\tvNormal = normalize( transformedNormal );\n#endif\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\tvViewPosition = - mvPosition.xyz;\n\t#include <worldpos_vertex>\n\t#include <envmap_vertex>\n\t#include <shadowmap_vertex>\n\t#include <fog_vertex>\n}",meshphysical_frag:"#define STANDARD\n#ifdef PHYSICAL\n\t#define REFLECTIVITY\n\t#define CLEARCOAT\n\t#define TRANSPARENCY\n#endif\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float roughness;\nuniform float metalness;\nuniform float opacity;\n#ifdef TRANSPARENCY\n\tuniform float transparency;\n#endif\n#ifdef REFLECTIVITY\n\tuniform float reflectivity;\n#endif\n#ifdef CLEARCOAT\n\tuniform float clearcoat;\n\tuniform float clearcoatRoughness;\n#endif\n#ifdef USE_SHEEN\n\tuniform vec3 sheen;\n#endif\nvarying vec3 vViewPosition;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n\t#ifdef USE_TANGENT\n\t\tvarying vec3 vTangent;\n\t\tvarying vec3 vBitangent;\n\t#endif\n#endif\n#include <common>\n#include <packing>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <uv2_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <emissivemap_pars_fragment>\n#include <bsdfs>\n#include <cube_uv_reflection_fragment>\n#include <envmap_common_pars_fragment>\n#include <envmap_physical_pars_fragment>\n#include <fog_pars_fragment>\n#include <lights_pars_begin>\n#include <lights_physical_pars_fragment>\n#include <shadowmap_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <clearcoat_normalmap_pars_fragment>\n#include <roughnessmap_pars_fragment>\n#include <metalnessmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <roughnessmap_fragment>\n\t#include <metalnessmap_fragment>\n\t#include <normal_fragment_begin>\n\t#include <normal_fragment_maps>\n\t#include <clearcoat_normal_fragment_begin>\n\t#include <clearcoat_normal_fragment_maps>\n\t#include <emissivemap_fragment>\n\t#include <lights_physical_fragment>\n\t#include <lights_fragment_begin>\n\t#include <lights_fragment_maps>\n\t#include <lights_fragment_end>\n\t#include <aomap_fragment>\n\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveRadiance;\n\t#ifdef TRANSPARENCY\n\t\tdiffuseColor.a *= saturate( 1. - transparency + linearToRelativeLuminance( reflectedLight.directSpecular + reflectedLight.indirectSpecular ) );\n\t#endif\n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n\t#include <dithering_fragment>\n}",meshphysical_vert:"#define STANDARD\nvarying vec3 vViewPosition;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n\t#ifdef USE_TANGENT\n\t\tvarying vec3 vTangent;\n\t\tvarying vec3 vBitangent;\n\t#endif\n#endif\n#include <common>\n#include <uv_pars_vertex>\n#include <uv2_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <shadowmap_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <uv2_vertex>\n\t#include <color_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n#ifndef FLAT_SHADED\n\tvNormal = normalize( transformedNormal );\n\t#ifdef USE_TANGENT\n\t\tvTangent = normalize( transformedTangent );\n\t\tvBitangent = normalize( cross( vNormal, vTangent ) * tangent.w );\n\t#endif\n#endif\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\tvViewPosition = - mvPosition.xyz;\n\t#include <worldpos_vertex>\n\t#include <shadowmap_vertex>\n\t#include <fog_vertex>\n}",normal_frag:"#define NORMAL\nuniform float opacity;\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( TANGENTSPACE_NORMALMAP )\n\tvarying vec3 vViewPosition;\n#endif\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n\t#ifdef USE_TANGENT\n\t\tvarying vec3 vTangent;\n\t\tvarying vec3 vBitangent;\n\t#endif\n#endif\n#include <packing>\n#include <uv_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\t#include <logdepthbuf_fragment>\n\t#include <normal_fragment_begin>\n\t#include <normal_fragment_maps>\n\tgl_FragColor = vec4( packNormalToRGB( normal ), opacity );\n}",normal_vert:"#define NORMAL\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( TANGENTSPACE_NORMALMAP )\n\tvarying vec3 vViewPosition;\n#endif\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n\t#ifdef USE_TANGENT\n\t\tvarying vec3 vTangent;\n\t\tvarying vec3 vBitangent;\n\t#endif\n#endif\n#include <common>\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n#ifndef FLAT_SHADED\n\tvNormal = normalize( transformedNormal );\n\t#ifdef USE_TANGENT\n\t\tvTangent = normalize( transformedTangent );\n\t\tvBitangent = normalize( cross( vNormal, vTangent ) * tangent.w );\n\t#endif\n#endif\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( TANGENTSPACE_NORMALMAP )\n\tvViewPosition = - mvPosition.xyz;\n#endif\n}",points_frag:"uniform vec3 diffuse;\nuniform float opacity;\n#include <common>\n#include <color_pars_fragment>\n#include <map_particle_pars_fragment>\n#include <fog_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tvec3 outgoingLight = vec3( 0.0 );\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <logdepthbuf_fragment>\n\t#include <map_particle_fragment>\n\t#include <color_fragment>\n\t#include <alphatest_fragment>\n\toutgoingLight = diffuseColor.rgb;\n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include <premultiplied_alpha_fragment>\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n}",points_vert:"uniform float size;\nuniform float scale;\n#include <common>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <color_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <project_vertex>\n\tgl_PointSize = size;\n\t#ifdef USE_SIZEATTENUATION\n\t\tbool isPerspective = isPerspectiveMatrix( projectionMatrix );\n\t\tif ( isPerspective ) gl_PointSize *= ( scale / - mvPosition.z );\n\t#endif\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\t#include <worldpos_vertex>\n\t#include <fog_vertex>\n}",shadow_frag:"uniform vec3 color;\nuniform float opacity;\n#include <common>\n#include <packing>\n#include <fog_pars_fragment>\n#include <bsdfs>\n#include <lights_pars_begin>\n#include <shadowmap_pars_fragment>\n#include <shadowmask_pars_fragment>\nvoid main() {\n\tgl_FragColor = vec4( color, opacity * ( 1.0 - getShadowMask() ) );\n\t#include <fog_fragment>\n}",shadow_vert:"#include <fog_pars_vertex>\n#include <shadowmap_pars_vertex>\nvoid main() {\n\t#include <begin_vertex>\n\t#include <project_vertex>\n\t#include <worldpos_vertex>\n\t#include <shadowmap_vertex>\n\t#include <fog_vertex>\n}",sprite_frag:"uniform vec3 diffuse;\nuniform float opacity;\n#include <common>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <fog_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tvec3 outgoingLight = vec3( 0.0 );\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\toutgoingLight = diffuseColor.rgb;\n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n}",sprite_vert:"uniform float rotation;\nuniform vec2 center;\n#include <common>\n#include <uv_pars_vertex>\n#include <fog_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\tvec4 mvPosition = modelViewMatrix * vec4( 0.0, 0.0, 0.0, 1.0 );\n\tvec2 scale;\n\tscale.x = length( vec3( modelMatrix[ 0 ].x, modelMatrix[ 0 ].y, modelMatrix[ 0 ].z ) );\n\tscale.y = length( vec3( modelMatrix[ 1 ].x, modelMatrix[ 1 ].y, modelMatrix[ 1 ].z ) );\n\t#ifndef USE_SIZEATTENUATION\n\t\tbool isPerspective = isPerspectiveMatrix( projectionMatrix );\n\t\tif ( isPerspective ) scale *= - mvPosition.z;\n\t#endif\n\tvec2 alignedPosition = ( position.xy - ( center - vec2( 0.5 ) ) ) * scale;\n\tvec2 rotatedPosition;\n\trotatedPosition.x = cos( rotation ) * alignedPosition.x - sin( rotation ) * alignedPosition.y;\n\trotatedPosition.y = sin( rotation ) * alignedPosition.x + cos( rotation ) * alignedPosition.y;\n\tmvPosition.xy += rotatedPosition;\n\tgl_Position = projectionMatrix * mvPosition;\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\t#include <fog_vertex>\n}"},ba={common:{diffuse:{value:new ti(15658734)},opacity:{value:1},map:{value:null},uvTransform:{value:new Pr},uv2Transform:{value:new Pr},alphaMap:{value:null}},specularmap:{specularMap:{value:null}},envmap:{envMap:{value:null},flipEnvMap:{value:-1},reflectivity:{value:1},refractionRatio:{value:.98},maxMipLevel:{value:0}},aomap:{aoMap:{value:null},aoMapIntensity:{value:1}},lightmap:{lightMap:{value:null},lightMapIntensity:{value:1}},emissivemap:{emissiveMap:{value:null}},bumpmap:{bumpMap:{value:null},bumpScale:{value:1}},normalmap:{normalMap:{value:null},normalScale:{value:new Mr(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 ti(16777215)}},lights:{ambientLightColor:{value:[]},lightProbe:{value:[]},directionalLights:{value:[],properties:{direction:{},color:{},shadow:{},shadowBias:{},shadowRadius:{},shadowMapSize:{}}},directionalShadowMap:{value:[]},directionalShadowMatrix:{value:[]},spotLights:{value:[],properties:{color:{},position:{},direction:{},distance:{},coneCos:{},penumbraCos:{},decay:{},shadow:{},shadowBias:{},shadowRadius:{},shadowMapSize:{}}},spotShadowMap:{value:[]},spotShadowMatrix:{value:[]},pointLights:{value:[],properties:{color:{},position:{},decay:{},distance:{},shadow:{},shadowBias:{},shadowRadius:{},shadowMapSize:{},shadowCameraNear:{},shadowCameraFar:{}}},pointShadowMap:{value:[]},pointShadowMatrix:{value:[]},hemisphereLights:{value:[],properties:{direction:{},skyColor:{},groundColor:{}}},rectAreaLights:{value:[],properties:{color:{},position:{},width:{},height:{}}}},points:{diffuse:{value:new ti(15658734)},opacity:{value:1},size:{value:1},scale:{value:1},map:{value:null},alphaMap:{value:null},uvTransform:{value:new Pr}},sprite:{diffuse:{value:new ti(15658734)},opacity:{value:1},center:{value:new Mr(.5,.5)},rotation:{value:0},map:{value:null},alphaMap:{value:null},uvTransform:{value:new Pr}}},Aa={basic:{uniforms:ia([ba.common,ba.specularmap,ba.envmap,ba.aomap,ba.lightmap,ba.fog]),vertexShader:xa.meshbasic_vert,fragmentShader:xa.meshbasic_frag},lambert:{uniforms:ia([ba.common,ba.specularmap,ba.envmap,ba.aomap,ba.lightmap,ba.emissivemap,ba.fog,ba.lights,{emissive:{value:new ti(0)}}]),vertexShader:xa.meshlambert_vert,fragmentShader:xa.meshlambert_frag},phong:{uniforms:ia([ba.common,ba.specularmap,ba.envmap,ba.aomap,ba.lightmap,ba.emissivemap,ba.bumpmap,ba.normalmap,ba.displacementmap,ba.fog,ba.lights,{emissive:{value:new ti(0)},specular:{value:new ti(1118481)},shininess:{value:30}}]),vertexShader:xa.meshphong_vert,fragmentShader:xa.meshphong_frag},standard:{uniforms:ia([ba.common,ba.envmap,ba.aomap,ba.lightmap,ba.emissivemap,ba.bumpmap,ba.normalmap,ba.displacementmap,ba.roughnessmap,ba.metalnessmap,ba.fog,ba.lights,{emissive:{value:new ti(0)},roughness:{value:.5},metalness:{value:.5},envMapIntensity:{value:1}}]),vertexShader:xa.meshphysical_vert,fragmentShader:xa.meshphysical_frag},toon:{uniforms:ia([ba.common,ba.specularmap,ba.aomap,ba.lightmap,ba.emissivemap,ba.bumpmap,ba.normalmap,ba.displacementmap,ba.gradientmap,ba.fog,ba.lights,{emissive:{value:new ti(0)},specular:{value:new ti(1118481)},shininess:{value:30}}]),vertexShader:xa.meshtoon_vert,fragmentShader:xa.meshtoon_frag},matcap:{uniforms:ia([ba.common,ba.bumpmap,ba.normalmap,ba.displacementmap,ba.fog,{matcap:{value:null}}]),vertexShader:xa.meshmatcap_vert,fragmentShader:xa.meshmatcap_frag},points:{uniforms:ia([ba.points,ba.fog]),vertexShader:xa.points_vert,fragmentShader:xa.points_frag},dashed:{uniforms:ia([ba.common,ba.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:xa.linedashed_vert,fragmentShader:xa.linedashed_frag},depth:{uniforms:ia([ba.common,ba.displacementmap]),vertexShader:xa.depth_vert,fragmentShader:xa.depth_frag},normal:{uniforms:ia([ba.common,ba.bumpmap,ba.normalmap,ba.displacementmap,{opacity:{value:1}}]),vertexShader:xa.normal_vert,fragmentShader:xa.normal_frag},sprite:{uniforms:ia([ba.sprite,ba.fog]),vertexShader:xa.sprite_vert,fragmentShader:xa.sprite_frag},background:{uniforms:{uvTransform:{value:new Pr},t2D:{value:null}},vertexShader:xa.background_vert,fragmentShader:xa.background_frag},cube:{uniforms:ia([ba.envmap,{opacity:{value:1}}]),vertexShader:xa.cube_vert,fragmentShader:xa.cube_frag},equirect:{uniforms:{tEquirect:{value:null}},vertexShader:xa.equirect_vert,fragmentShader:xa.equirect_frag},distanceRGBA:{uniforms:ia([ba.common,ba.displacementmap,{referencePosition:{value:new Rr},nearDistance:{value:1},farDistance:{value:1e3}}]),vertexShader:xa.distanceRGBA_vert,fragmentShader:xa.distanceRGBA_frag},shadow:{uniforms:ia([ba.lights,ba.fog,{color:{value:new ti(0)},opacity:{value:1}}]),vertexShader:xa.shadow_vert,fragmentShader:xa.shadow_frag}};function wa(){var e=null,t=!1,r=null;function n(i,a){!1!==t&&(r(i,a),e.requestAnimationFrame(n))}return{start:function(){!0!==t&&null!==r&&(e.requestAnimationFrame(n),t=!0)},stop:function(){t=!1},setAnimationLoop:function(e){r=e},setContext:function(t){e=t}}}function _a(e){var t=new WeakMap;return{get:function(e){return e.isInterleavedBufferAttribute&&(e=e.data),t.get(e)},remove:function(r){r.isInterleavedBufferAttribute&&(r=r.data);var n=t.get(r);n&&(e.deleteBuffer(n.buffer),t.delete(r))},update:function(r,n){r.isInterleavedBufferAttribute&&(r=r.data);var i=t.get(r);void 0===i?t.set(r,function(t,r){var n=t.array,i=t.usage,a=e.createBuffer();e.bindBuffer(r,a),e.bufferData(r,n,i),t.onUploadCallback();var o=5126;return n instanceof Float32Array?o=5126:n instanceof Float64Array?console.warn("THREE.WebGLAttributes: Unsupported data buffer format: Float64Array."):n instanceof Uint16Array?o=5123:n instanceof Int16Array?o=5122:n instanceof Uint32Array?o=5125:n instanceof Int32Array?o=5124:n instanceof Int8Array?o=5120:n instanceof Uint8Array&&(o=5121),{buffer:a,type:o,bytesPerElement:n.BYTES_PER_ELEMENT,version:t.version}}(r,n)):i.version<r.version&&(!function(t,r,n){var i=r.array,a=r.updateRange;e.bindBuffer(n,t),-1===a.count?e.bufferSubData(n,0,i):(e.bufferSubData(n,a.offset*i.BYTES_PER_ELEMENT,i.subarray(a.offset,a.offset+a.count)),a.count=-1)}(i.buffer,r,n),i.version=r.version)}}}function Ma(e,t,r,n){ea.call(this),this.type="PlaneGeometry",this.parameters={width:e,height:t,widthSegments:r,heightSegments:n},this.fromBufferGeometry(new Sa(e,t,r,n)),this.mergeVertices()}function Sa(e,t,r,n){Li.call(this),this.type="PlaneBufferGeometry",this.parameters={width:e,height:t,widthSegments:r,heightSegments:n};var i,a,o=(e=e||1)/2,s=(t=t||1)/2,l=Math.floor(r)||1,c=Math.floor(n)||1,u=l+1,h=c+1,d=e/l,p=t/c,f=[],m=[],v=[],g=[];for(a=0;a<h;a++){var y=a*p-s;for(i=0;i<u;i++){var x=i*d-o;m.push(x,-y,0),v.push(0,0,1),g.push(i/l),g.push(1-a/c)}}for(a=0;a<c;a++)for(i=0;i<l;i++){var b=i+u*a,A=i+u*(a+1),w=i+1+u*(a+1),_=i+1+u*a;f.push(b,A,_),f.push(A,w,_)}this.setIndex(f),this.setAttribute("position",new yi(m,3)),this.setAttribute("normal",new yi(v,3)),this.setAttribute("uv",new yi(g,2))}function Ea(e,t,r,n){var i,a,o=new ti(0),s=0,l=null,c=0;function u(e,r){t.buffers.color.setClear(e.r,e.g,e.b,r,n)}return{getClearColor:function(){return o},setClearColor:function(e,t){o.set(e),u(o,s=void 0!==t?t:1)},getClearAlpha:function(){return s},setClearAlpha:function(e){u(o,s=e)},render:function(t,n,h,d){var p=n.background,f=e.xr,m=f.getSession&&f.getSession();if(m&&"additive"===m.environmentBlendMode&&(p=null),null===p?(u(o,s),l=null,c=0):p&&p.isColor&&(u(p,1),d=!0,l=null,c=0),(e.autoClear||d)&&e.clear(e.autoClearColor,e.autoClearDepth,e.autoClearStencil),p&&(p.isCubeTexture||p.isWebGLRenderTargetCube||p.mapping===me)){void 0===a&&((a=new Xi(new ra(1,1,1),new la({type:"BackgroundCubeMaterial",uniforms:na(Aa.cube.uniforms),vertexShader:Aa.cube.vertexShader,fragmentShader:Aa.cube.fragmentShader,side:g,depthTest:!1,depthWrite:!1,fog:!1}))).geometry.deleteAttribute("normal"),a.geometry.deleteAttribute("uv"),a.onBeforeRender=function(e,t,r){this.matrixWorld.copyPosition(r.matrixWorld)},Object.defineProperty(a.material,"envMap",{get:function(){return this.uniforms.envMap.value}}),r.update(a));var y=p.isWebGLRenderTargetCube?p.texture:p;a.material.uniforms.envMap.value=y,a.material.uniforms.flipEnvMap.value=y.isCubeTexture?-1:1,l===p&&c===y.version||(a.material.needsUpdate=!0,l=p,c=y.version),t.unshift(a,a.geometry,a.material,0,0,null)}else p&&p.isTexture&&(void 0===i&&((i=new Xi(new Sa(2,2),new la({type:"BackgroundMaterial",uniforms:na(Aa.background.uniforms),vertexShader:Aa.background.vertexShader,fragmentShader:Aa.background.fragmentShader,side:v,depthTest:!1,depthWrite:!1,fog:!1}))).geometry.deleteAttribute("normal"),Object.defineProperty(i.material,"map",{get:function(){return this.uniforms.t2D.value}}),r.update(i)),i.material.uniforms.t2D.value=p,!0===p.matrixAutoUpdate&&p.updateMatrix(),i.material.uniforms.uvTransform.value.copy(p.matrix),l===p&&c===p.version||(i.material.needsUpdate=!0,l=p,c=p.version),t.unshift(i,i.geometry,i.material,0,0,null))}}}function Ta(e,t,r,n){var i,a=n.isWebGL2;this.setMode=function(e){i=e},this.render=function(t,n){e.drawArrays(i,t,n),r.update(n,i)},this.renderInstances=function(n,o,s,l){if(0!==l){var c,u;if(a)c=e,u="drawArraysInstanced";else if(u="drawArraysInstancedANGLE",null===(c=t.get("ANGLE_instanced_arrays")))return void console.error("THREE.WebGLBufferRenderer: using THREE.InstancedBufferGeometry but hardware does not support extension ANGLE_instanced_arrays.");c[u](i,o,s,l),r.update(s,i,l)}}}function Ra(e,t,r){var n;function i(t){if("highp"===t){if(e.getShaderPrecisionFormat(35633,36338).precision>0&&e.getShaderPrecisionFormat(35632,36338).precision>0)return"highp";t="mediump"}return"mediump"===t&&e.getShaderPrecisionFormat(35633,36337).precision>0&&e.getShaderPrecisionFormat(35632,36337).precision>0?"mediump":"lowp"}var a="undefined"!=typeof WebGL2RenderingContext&&e instanceof WebGL2RenderingContext||"undefined"!=typeof WebGL2ComputeRenderingContext&&e instanceof WebGL2ComputeRenderingContext,o=void 0!==r.precision?r.precision:"highp",s=i(o);s!==o&&(console.warn("THREE.WebGLRenderer:",o,"not supported, using",s,"instead."),o=s);var l=!0===r.logarithmicDepthBuffer,c=e.getParameter(34930),u=e.getParameter(35660),h=e.getParameter(3379),d=e.getParameter(34076),p=e.getParameter(34921),f=e.getParameter(36347),m=e.getParameter(36348),v=e.getParameter(36349),g=u>0,y=a||!!t.get("OES_texture_float");return{isWebGL2:a,getMaxAnisotropy:function(){if(void 0!==n)return n;var r=t.get("EXT_texture_filter_anisotropic");return n=null!==r?e.getParameter(r.MAX_TEXTURE_MAX_ANISOTROPY_EXT):0},getMaxPrecision:i,precision:o,logarithmicDepthBuffer:l,maxTextures:c,maxVertexTextures:u,maxTextureSize:h,maxCubemapSize:d,maxAttributes:p,maxVertexUniforms:f,maxVaryings:m,maxFragmentUniforms:v,vertexTextures:g,floatFragmentTextures:y,floatVertexTextures:g&&y,maxSamples:a?e.getParameter(36183):0}}function La(){var e=this,t=null,r=0,n=!1,i=!1,a=new zn,o=new Pr,s={value:null,needsUpdate:!1};function l(){s.value!==t&&(s.value=t,s.needsUpdate=r>0),e.numPlanes=r,e.numIntersection=0}function c(t,r,n,i){var l=null!==t?t.length:0,c=null;if(0!==l){if(c=s.value,!0!==i||null===c){var u=n+4*l,h=r.matrixWorldInverse;o.getNormalMatrix(h),(null===c||c.length<u)&&(c=new Float32Array(u));for(var d=0,p=n;d!==l;++d,p+=4)a.copy(t[d]).applyMatrix4(h,o),a.normal.toArray(c,p),c[p+3]=a.constant}s.value=c,s.needsUpdate=!0}return e.numPlanes=l,c}this.uniform=s,this.numPlanes=0,this.numIntersection=0,this.init=function(e,i,a){var o=0!==e.length||i||0!==r||n;return n=i,t=c(e,a,0),r=e.length,o},this.beginShadows=function(){i=!0,c(null)},this.endShadows=function(){i=!1,l()},this.setState=function(e,a,o,u,h,d){if(!n||null===e||0===e.length||i&&!o)i?c(null):l();else{var p=i?0:r,f=4*p,m=h.clippingState||null;s.value=m,m=c(e,u,f,d);for(var v=0;v!==f;++v)m[v]=t[v];h.clippingState=m,this.numIntersection=a?this.numPlanes:0,this.numPlanes+=p}}}function Ca(e){var t={};return{get:function(r){if(void 0!==t[r])return t[r];var n;switch(r){case"WEBGL_depth_texture":n=e.getExtension("WEBGL_depth_texture")||e.getExtension("MOZ_WEBGL_depth_texture")||e.getExtension("WEBKIT_WEBGL_depth_texture");break;case"EXT_texture_filter_anisotropic":n=e.getExtension("EXT_texture_filter_anisotropic")||e.getExtension("MOZ_EXT_texture_filter_anisotropic")||e.getExtension("WEBKIT_EXT_texture_filter_anisotropic");break;case"WEBGL_compressed_texture_s3tc":n=e.getExtension("WEBGL_compressed_texture_s3tc")||e.getExtension("MOZ_WEBGL_compressed_texture_s3tc")||e.getExtension("WEBKIT_WEBGL_compressed_texture_s3tc");break;case"WEBGL_compressed_texture_pvrtc":n=e.getExtension("WEBGL_compressed_texture_pvrtc")||e.getExtension("WEBKIT_WEBGL_compressed_texture_pvrtc");break;default:n=e.getExtension(r)}return null===n&&console.warn("THREE.WebGLRenderer: "+r+" extension not supported."),t[r]=n,n}}}function Pa(e,t,r){var n=new WeakMap,i=new WeakMap;function a(e){var o=e.target,s=n.get(o);for(var l in null!==s.index&&t.remove(s.index),s.attributes)t.remove(s.attributes[l]);o.removeEventListener("dispose",a),n.delete(o);var c=i.get(s);c&&(t.remove(c),i.delete(s)),r.memory.geometries--}function o(e){var r=[],n=e.index,a=e.attributes.position,o=0;if(null!==n){var s=n.array;o=n.version;for(var l=0,c=s.length;l<c;l+=3){var u=s[l+0],h=s[l+1],d=s[l+2];r.push(u,h,h,d,d,u)}}else{s=a.array;o=a.version;for(l=0,c=s.length/3-1;l<c;l+=3){u=l+0,h=l+1,d=l+2;r.push(u,h,h,d,d,u)}}var p=new(Ai(r)>65535?gi:mi)(r,1);p.version=o,t.update(p,34963);var f=i.get(e);f&&t.remove(f),i.set(e,p)}return{get:function(e,t){var i=n.get(t);return i||(t.addEventListener("dispose",a),t.isBufferGeometry?i=t:t.isGeometry&&(void 0===t._bufferGeometry&&(t._bufferGeometry=(new Li).setFromObject(e)),i=t._bufferGeometry),n.set(t,i),r.memory.geometries++,i)},update:function(e){var r=e.index,n=e.attributes;for(var i in null!==r&&t.update(r,34963),n)t.update(n[i],34962);var a=e.morphAttributes;for(var i in a)for(var o=a[i],s=0,l=o.length;s<l;s++)t.update(o[s],34962)},getWireframeAttribute:function(e){var t=i.get(e);if(t){var r=e.index;null!==r&&t.version<r.version&&o(e)}else o(e);return i.get(e)}}}function Da(e,t,r,n){var i,a,o,s=n.isWebGL2;this.setMode=function(e){i=e},this.setIndex=function(e){a=e.type,o=e.bytesPerElement},this.render=function(t,n){e.drawElements(i,n,a,t*o),r.update(n,i)},this.renderInstances=function(n,l,c,u){if(0!==u){var h,d;if(s)h=e,d="drawElementsInstanced";else if(d="drawElementsInstancedANGLE",null===(h=t.get("ANGLE_instanced_arrays")))return void console.error("THREE.WebGLIndexedBufferRenderer: using THREE.InstancedBufferGeometry but hardware does not support extension ANGLE_instanced_arrays.");h[d](i,c,a,l*o,u),r.update(c,i,u)}}}function Ia(e){var t={frame:0,calls:0,triangles:0,points:0,lines:0};return{memory:{geometries:0,textures:0},render:t,programs:null,autoReset:!0,reset:function(){t.frame++,t.calls=0,t.triangles=0,t.points=0,t.lines=0},update:function(e,r,n){switch(n=n||1,t.calls++,r){case 4:t.triangles+=n*(e/3);break;case 1:t.lines+=n*(e/2);break;case 3:t.lines+=n*(e-1);break;case 2:t.lines+=n*e;break;case 0:t.points+=n*e;break;default:console.error("THREE.WebGLInfo: Unknown draw mode:",r)}}}}function Oa(e,t){return Math.abs(t[1])-Math.abs(e[1])}function Ba(e){var t={},r=new Float32Array(8);return{update:function(n,i,a,o){var s=n.morphTargetInfluences,l=void 0===s?0:s.length,c=t[i.id];if(void 0===c){c=[];for(var u=0;u<l;u++)c[u]=[u,0];t[i.id]=c}var h=a.morphTargets&&i.morphAttributes.position,d=a.morphNormals&&i.morphAttributes.normal;for(u=0;u<l;u++){0!==(f=c[u])[1]&&(h&&i.deleteAttribute("morphTarget"+u),d&&i.deleteAttribute("morphNormal"+u))}for(u=0;u<l;u++){(f=c[u])[0]=u,f[1]=s[u]}c.sort(Oa);var p=0;for(u=0;u<8;u++){var f;if(f=c[u]){var m=f[0],v=f[1];if(v){h&&i.setAttribute("morphTarget"+u,h[m]),d&&i.setAttribute("morphNormal"+u,d[m]),r[u]=v,p+=v;continue}}r[u]=0}var g=i.morphTargetsRelative?1:1-p;o.getUniforms().setValue(e,"morphTargetBaseInfluence",g),o.getUniforms().setValue(e,"morphTargetInfluences",r)}}}function Fa(e,t,r,n){var i={};return{update:function(e){var a=n.render.frame,o=e.geometry,s=t.get(e,o);return i[s.id]!==a&&(o.isGeometry&&s.updateFromObject(e),t.update(s),i[s.id]=a),e.isInstancedMesh&&r.update(e.instanceMatrix,34962),s},dispose:function(){i={}}}}function Ua(e,t,r,n,i,a,o,s,l,c){e=void 0!==e?e:[],t=void 0!==t?t:ue,o=void 0!==o?o:Ve,Or.call(this,e,t,r,n,i,a,o,s,l,c),this.flipY=!1}function Na(e,t,r,n){Or.call(this,null),this.image={data:e||null,width:t||1,height:r||1,depth:n||1},this.magFilter=be,this.minFilter=be,this.wrapR=ye,this.generateMipmaps=!1,this.flipY=!1,this.needsUpdate=!0}function Ga(e,t,r,n){Or.call(this,null),this.image={data:e||null,width:t||1,height:r||1,depth:n||1},this.magFilter=be,this.minFilter=be,this.wrapR=ye,this.generateMipmaps=!1,this.flipY=!1,this.needsUpdate=!0}Aa.physical={uniforms:ia([Aa.standard.uniforms,{transparency:{value:0},clearcoat:{value:0},clearcoatRoughness:{value:0},sheen:{value:new ti(0)},clearcoatNormalScale:{value:new Mr(1,1)},clearcoatNormalMap:{value:null}}]),vertexShader:xa.meshphysical_vert,fragmentShader:xa.meshphysical_frag},Ma.prototype=Object.create(ea.prototype),Ma.prototype.constructor=Ma,Sa.prototype=Object.create(Li.prototype),Sa.prototype.constructor=Sa,Ua.prototype=Object.create(Or.prototype),Ua.prototype.constructor=Ua,Ua.prototype.isCubeTexture=!0,Object.defineProperty(Ua.prototype,"images",{get:function(){return this.image},set:function(e){this.image=e}}),Na.prototype=Object.create(Or.prototype),Na.prototype.constructor=Na,Na.prototype.isDataTexture2DArray=!0,Ga.prototype=Object.create(Or.prototype),Ga.prototype.constructor=Ga,Ga.prototype.isDataTexture3D=!0;var za=new Or,ka=new Na,Ha=new Ga,Va=new Ua,ja=[],Wa=[],qa=new Float32Array(16),Xa=new Float32Array(9),Ya=new Float32Array(4);function Qa(e,t,r){var n=e[0];if(n<=0||n>0)return e;var i=t*r,a=ja[i];if(void 0===a&&(a=new Float32Array(i),ja[i]=a),0!==t){n.toArray(a,0);for(var o=1,s=0;o!==t;++o)s+=r,e[o].toArray(a,s)}return a}function Za(e,t){if(e.length!==t.length)return!1;for(var r=0,n=e.length;r<n;r++)if(e[r]!==t[r])return!1;return!0}function Ja(e,t){for(var r=0,n=t.length;r<n;r++)e[r]=t[r]}function Ka(e,t){var r=Wa[t];void 0===r&&(r=new Int32Array(t),Wa[t]=r);for(var n=0;n!==t;++n)r[n]=e.allocateTextureUnit();return r}function $a(e,t){var r=this.cache;r[0]!==t&&(e.uniform1f(this.addr,t),r[0]=t)}function eo(e,t){var r=this.cache;if(void 0!==t.x)r[0]===t.x&&r[1]===t.y||(e.uniform2f(this.addr,t.x,t.y),r[0]=t.x,r[1]=t.y);else{if(Za(r,t))return;e.uniform2fv(this.addr,t),Ja(r,t)}}function to(e,t){var r=this.cache;if(void 0!==t.x)r[0]===t.x&&r[1]===t.y&&r[2]===t.z||(e.uniform3f(this.addr,t.x,t.y,t.z),r[0]=t.x,r[1]=t.y,r[2]=t.z);else if(void 0!==t.r)r[0]===t.r&&r[1]===t.g&&r[2]===t.b||(e.uniform3f(this.addr,t.r,t.g,t.b),r[0]=t.r,r[1]=t.g,r[2]=t.b);else{if(Za(r,t))return;e.uniform3fv(this.addr,t),Ja(r,t)}}function ro(e,t){var r=this.cache;if(void 0!==t.x)r[0]===t.x&&r[1]===t.y&&r[2]===t.z&&r[3]===t.w||(e.uniform4f(this.addr,t.x,t.y,t.z,t.w),r[0]=t.x,r[1]=t.y,r[2]=t.z,r[3]=t.w);else{if(Za(r,t))return;e.uniform4fv(this.addr,t),Ja(r,t)}}function no(e,t){var r=this.cache,n=t.elements;if(void 0===n){if(Za(r,t))return;e.uniformMatrix2fv(this.addr,!1,t),Ja(r,t)}else{if(Za(r,n))return;Ya.set(n),e.uniformMatrix2fv(this.addr,!1,Ya),Ja(r,n)}}function io(e,t){var r=this.cache,n=t.elements;if(void 0===n){if(Za(r,t))return;e.uniformMatrix3fv(this.addr,!1,t),Ja(r,t)}else{if(Za(r,n))return;Xa.set(n),e.uniformMatrix3fv(this.addr,!1,Xa),Ja(r,n)}}function ao(e,t){var r=this.cache,n=t.elements;if(void 0===n){if(Za(r,t))return;e.uniformMatrix4fv(this.addr,!1,t),Ja(r,t)}else{if(Za(r,n))return;qa.set(n),e.uniformMatrix4fv(this.addr,!1,qa),Ja(r,n)}}function oo(e,t,r){var n=this.cache,i=r.allocateTextureUnit();n[0]!==i&&(e.uniform1i(this.addr,i),n[0]=i),r.safeSetTexture2D(t||za,i)}function so(e,t,r){var n=this.cache,i=r.allocateTextureUnit();n[0]!==i&&(e.uniform1i(this.addr,i),n[0]=i),r.setTexture2DArray(t||ka,i)}function lo(e,t,r){var n=this.cache,i=r.allocateTextureUnit();n[0]!==i&&(e.uniform1i(this.addr,i),n[0]=i),r.setTexture3D(t||Ha,i)}function co(e,t,r){var n=this.cache,i=r.allocateTextureUnit();n[0]!==i&&(e.uniform1i(this.addr,i),n[0]=i),r.safeSetTextureCube(t||Va,i)}function uo(e,t){var r=this.cache;r[0]!==t&&(e.uniform1i(this.addr,t),r[0]=t)}function ho(e,t){var r=this.cache;Za(r,t)||(e.uniform2iv(this.addr,t),Ja(r,t))}function po(e,t){var r=this.cache;Za(r,t)||(e.uniform3iv(this.addr,t),Ja(r,t))}function fo(e,t){var r=this.cache;Za(r,t)||(e.uniform4iv(this.addr,t),Ja(r,t))}function mo(e,t){e.uniform1fv(this.addr,t)}function vo(e,t){e.uniform1iv(this.addr,t)}function go(e,t){e.uniform2iv(this.addr,t)}function yo(e,t){e.uniform3iv(this.addr,t)}function xo(e,t){e.uniform4iv(this.addr,t)}function bo(e,t){var r=Qa(t,this.size,2);e.uniform2fv(this.addr,r)}function Ao(e,t){var r=Qa(t,this.size,3);e.uniform3fv(this.addr,r)}function wo(e,t){var r=Qa(t,this.size,4);e.uniform4fv(this.addr,r)}function _o(e,t){var r=Qa(t,this.size,4);e.uniformMatrix2fv(this.addr,!1,r)}function Mo(e,t){var r=Qa(t,this.size,9);e.uniformMatrix3fv(this.addr,!1,r)}function So(e,t){var r=Qa(t,this.size,16);e.uniformMatrix4fv(this.addr,!1,r)}function Eo(e,t,r){var n=t.length,i=Ka(r,n);e.uniform1iv(this.addr,i);for(var a=0;a!==n;++a)r.safeSetTexture2D(t[a]||za,i[a])}function To(e,t,r){var n=t.length,i=Ka(r,n);e.uniform1iv(this.addr,i);for(var a=0;a!==n;++a)r.safeSetTextureCube(t[a]||Va,i[a])}function Ro(e,t,r){this.id=e,this.addr=r,this.cache=[],this.setValue=function(e){switch(e){case 5126:return $a;case 35664:return eo;case 35665:return to;case 35666:return ro;case 35674:return no;case 35675:return io;case 35676:return ao;case 35678:case 36198:return oo;case 35679:return lo;case 35680:return co;case 36289:return so;case 5124:case 35670:return uo;case 35667:case 35671:return ho;case 35668:case 35672:return po;case 35669:case 35673:return fo}}(t.type)}function Lo(e,t,r){this.id=e,this.addr=r,this.cache=[],this.size=t.size,this.setValue=function(e){switch(e){case 5126:return mo;case 35664:return bo;case 35665:return Ao;case 35666:return wo;case 35674:return _o;case 35675:return Mo;case 35676:return So;case 35678:case 36198:case 36298:case 36306:return Eo;case 35680:case 36300:case 36308:return To;case 5124:case 35670:return vo;case 35667:case 35671:return go;case 35668:case 35672:return yo;case 35669:case 35673:return xo}}(t.type)}function Co(e){this.id=e,this.seq=[],this.map={}}Lo.prototype.updateCache=function(e){var t=this.cache;e instanceof Float32Array&&t.length!==e.length&&(this.cache=new Float32Array(e.length)),Ja(t,e)},Co.prototype.setValue=function(e,t,r){for(var n=this.seq,i=0,a=n.length;i!==a;++i){var o=n[i];o.setValue(e,t[o.id],r)}};var Po=/([\w\d_]+)(\])?(\[|\.)?/g;function Do(e,t){e.seq.push(t),e.map[t.id]=t}function Io(e,t,r){var n=e.name,i=n.length;for(Po.lastIndex=0;;){var a=Po.exec(n),o=Po.lastIndex,s=a[1],l="]"===a[2],c=a[3];if(l&&(s|=0),void 0===c||"["===c&&o+2===i){Do(r,void 0===c?new Ro(s,e,t):new Lo(s,e,t));break}var u=r.map[s];void 0===u&&Do(r,u=new Co(s)),r=u}}function Oo(e,t){this.seq=[],this.map={};for(var r=e.getProgramParameter(t,35718),n=0;n<r;++n){var i=e.getActiveUniform(t,n);Io(i,e.getUniformLocation(t,i.name),this)}}function Bo(e,t,r){var n=e.createShader(t);return e.shaderSource(n,r),e.compileShader(n),n}Oo.prototype.setValue=function(e,t,r,n){var i=this.map[t];void 0!==i&&i.setValue(e,r,n)},Oo.prototype.setOptional=function(e,t,r){var n=t[r];void 0!==n&&this.setValue(e,r,n)},Oo.upload=function(e,t,r,n){for(var i=0,a=t.length;i!==a;++i){var o=t[i],s=r[o.id];!1!==s.needsUpdate&&o.setValue(e,s.value,n)}},Oo.seqWithValue=function(e,t){for(var r=[],n=0,i=e.length;n!==i;++n){var a=e[n];a.id in t&&r.push(a)}return r};var Fo=0;function Uo(e){switch(e){case Ut:return["Linear","( value )"];case Nt:return["sRGB","( value )"];case zt:return["RGBE","( value )"];case Ht:return["RGBM","( value, 7.0 )"];case Vt:return["RGBM","( value, 16.0 )"];case jt:return["RGBD","( value, 256.0 )"];case Gt:return["Gamma","( value, float( GAMMA_FACTOR ) )"];case kt:return["LogLuv","( value )"];default:throw new Error("unsupported encoding: "+e)}}function No(e,t,r){var n=e.getShaderParameter(t,35713),i=e.getShaderInfoLog(t).trim();return n&&""===i?"":"THREE.WebGLShader: gl.getShaderInfoLog() "+r+"\n"+i+function(e){for(var t=e.split("\n"),r=0;r<t.length;r++)t[r]=r+1+": "+t[r];return t.join("\n")}(e.getShaderSource(t))}function Go(e,t){var r=Uo(t);return"vec4 "+e+"( vec4 value ) { return "+r[0]+"ToLinear"+r[1]+"; }"}function zo(e,t){var r;switch(t){case ie:r="Linear";break;case ae:r="Reinhard";break;case oe:r="Uncharted2";break;case se:r="OptimizedCineon";break;case le:r="ACESFilmic";break;default:throw new Error("unsupported toneMapping: "+t)}return"vec3 "+e+"( vec3 color ) { return "+r+"ToneMapping( color ); }"}function ko(e){return""!==e}function Ho(e,t){return e.replace(/NUM_DIR_LIGHTS/g,t.numDirLights).replace(/NUM_SPOT_LIGHTS/g,t.numSpotLights).replace(/NUM_RECT_AREA_LIGHTS/g,t.numRectAreaLights).replace(/NUM_POINT_LIGHTS/g,t.numPointLights).replace(/NUM_HEMI_LIGHTS/g,t.numHemiLights).replace(/NUM_DIR_LIGHT_SHADOWS/g,t.numDirLightShadows).replace(/NUM_SPOT_LIGHT_SHADOWS/g,t.numSpotLightShadows).replace(/NUM_POINT_LIGHT_SHADOWS/g,t.numPointLightShadows)}function Vo(e,t){return e.replace(/NUM_CLIPPING_PLANES/g,t.numClippingPlanes).replace(/UNION_CLIPPING_PLANES/g,t.numClippingPlanes-t.numClipIntersection)}var jo=/^[ \t]*#include +<([\w\d./]+)>/gm;function Wo(e){return e.replace(jo,qo)}function qo(e,t){var r=xa[t];if(void 0===r)throw new Error("Can not resolve #include <"+t+">");return Wo(r)}var Xo=/#pragma unroll_loop[\s]+?for \( int i \= (\d+)\; i < (\d+)\; i \+\+ \) \{([\s\S]+?)(?=\})\}/g;function Yo(e){return e.replace(Xo,Qo)}function Qo(e,t,r,n){for(var i="",a=parseInt(t);a<parseInt(r);a++)i+=n.replace(/\[ i \]/g,"[ "+a+" ]").replace(/UNROLLED_LOOP_INDEX/g,a);return i}function Zo(e){var t="precision "+e.precision+" float;\nprecision "+e.precision+" int;";return"highp"===e.precision?t+="\n#define HIGH_PRECISION":"mediump"===e.precision?t+="\n#define MEDIUM_PRECISION":"lowp"===e.precision&&(t+="\n#define LOW_PRECISION"),t}function Jo(e,t,r,n,i,a){var o,s,l,c,u,h=e.getContext(),d=n.defines,v=i.vertexShader,g=i.fragmentShader,y=function(e){var t="SHADOWMAP_TYPE_BASIC";return e.shadowMapType===p?t="SHADOWMAP_TYPE_PCF":e.shadowMapType===f?t="SHADOWMAP_TYPE_PCF_SOFT":e.shadowMapType===m&&(t="SHADOWMAP_TYPE_VSM"),t}(a),x=function(e){var t="ENVMAP_TYPE_CUBE";if(e.envMap)switch(e.envMapMode){case ue:case he:t="ENVMAP_TYPE_CUBE";break;case me:case ve:t="ENVMAP_TYPE_CUBE_UV";break;case de:case pe:t="ENVMAP_TYPE_EQUIREC";break;case fe:t="ENVMAP_TYPE_SPHERE"}return t}(a),b=function(e){var t="ENVMAP_MODE_REFLECTION";if(e.envMap)switch(e.envMapMode){case he:case pe:t="ENVMAP_MODE_REFRACTION"}return t}(a),A=function(e){var t="ENVMAP_BLENDING_NONE";if(e.envMap)switch(e.combine){case ee:t="ENVMAP_BLENDING_MULTIPLY";break;case te:t="ENVMAP_BLENDING_MIX";break;case re:t="ENVMAP_BLENDING_ADD"}return t}(a),w=e.gammaFactor>0?e.gammaFactor:1,_=a.isWebGL2?"":function(e,t,r){return[(e=e||{}).derivatives||t.envMapCubeUV||t.bumpMap||t.tangentSpaceNormalMap||t.clearcoatNormalMap||t.flatShading||"physical"===t.shaderID?"#extension GL_OES_standard_derivatives : enable":"",(e.fragDepth||t.logarithmicDepthBuffer)&&r.get("EXT_frag_depth")?"#extension GL_EXT_frag_depth : enable":"",e.drawBuffers&&r.get("WEBGL_draw_buffers")?"#extension GL_EXT_draw_buffers : require":"",(e.shaderTextureLOD||t.envMap)&&r.get("EXT_shader_texture_lod")?"#extension GL_EXT_shader_texture_lod : enable":""].filter(ko).join("\n")}(n.extensions,a,t),M=function(e){var t=[];for(var r in e){var n=e[r];!1!==n&&t.push("#define "+r+" "+n)}return t.join("\n")}(d),S=h.createProgram(),E=a.numMultiviewViews;if(n.isRawShaderMaterial?((o=[M].filter(ko).join("\n")).length>0&&(o+="\n"),(s=[_,M].filter(ko).join("\n")).length>0&&(s+="\n")):(o=[Zo(a),"#define SHADER_NAME "+i.name,M,a.instancing?"#define USE_INSTANCING":"",a.supportsVertexTextures?"#define VERTEX_TEXTURES":"","#define GAMMA_FACTOR "+w,"#define MAX_BONES "+a.maxBones,a.useFog&&a.fog?"#define USE_FOG":"",a.useFog&&a.fogExp2?"#define FOG_EXP2":"",a.map?"#define USE_MAP":"",a.envMap?"#define USE_ENVMAP":"",a.envMap?"#define "+b:"",a.lightMap?"#define USE_LIGHTMAP":"",a.aoMap?"#define USE_AOMAP":"",a.emissiveMap?"#define USE_EMISSIVEMAP":"",a.bumpMap?"#define USE_BUMPMAP":"",a.normalMap?"#define USE_NORMALMAP":"",a.normalMap&&a.objectSpaceNormalMap?"#define OBJECTSPACE_NORMALMAP":"",a.normalMap&&a.tangentSpaceNormalMap?"#define TANGENTSPACE_NORMALMAP":"",a.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",a.displacementMap&&a.supportsVertexTextures?"#define USE_DISPLACEMENTMAP":"",a.specularMap?"#define USE_SPECULARMAP":"",a.roughnessMap?"#define USE_ROUGHNESSMAP":"",a.metalnessMap?"#define USE_METALNESSMAP":"",a.alphaMap?"#define USE_ALPHAMAP":"",a.vertexTangents?"#define USE_TANGENT":"",a.vertexColors?"#define USE_COLOR":"",a.vertexUvs?"#define USE_UV":"",a.uvsVertexOnly?"#define UVS_VERTEX_ONLY":"",a.flatShading?"#define FLAT_SHADED":"",a.skinning?"#define USE_SKINNING":"",a.useVertexTexture?"#define BONE_TEXTURE":"",a.morphTargets?"#define USE_MORPHTARGETS":"",a.morphNormals&&!1===a.flatShading?"#define USE_MORPHNORMALS":"",a.doubleSided?"#define DOUBLE_SIDED":"",a.flipSided?"#define FLIP_SIDED":"",a.shadowMapEnabled?"#define USE_SHADOWMAP":"",a.shadowMapEnabled?"#define "+y:"",a.sizeAttenuation?"#define USE_SIZEATTENUATION":"",a.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",a.logarithmicDepthBuffer&&(a.isWebGL2||t.get("EXT_frag_depth"))?"#define USE_LOGDEPTHBUF_EXT":"","uniform mat4 modelMatrix;","uniform mat4 modelViewMatrix;","uniform mat4 projectionMatrix;","uniform mat4 viewMatrix;","uniform mat3 normalMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;","#ifdef USE_INSTANCING"," attribute mat4 instanceMatrix;","#endif","attribute vec3 position;","attribute vec3 normal;","attribute vec2 uv;","#ifdef USE_TANGENT","\tattribute vec4 tangent;","#endif","#ifdef USE_COLOR","\tattribute vec3 color;","#endif","#ifdef USE_MORPHTARGETS","\tattribute vec3 morphTarget0;","\tattribute vec3 morphTarget1;","\tattribute vec3 morphTarget2;","\tattribute vec3 morphTarget3;","\t#ifdef USE_MORPHNORMALS","\t\tattribute vec3 morphNormal0;","\t\tattribute vec3 morphNormal1;","\t\tattribute vec3 morphNormal2;","\t\tattribute vec3 morphNormal3;","\t#else","\t\tattribute vec3 morphTarget4;","\t\tattribute vec3 morphTarget5;","\t\tattribute vec3 morphTarget6;","\t\tattribute vec3 morphTarget7;","\t#endif","#endif","#ifdef USE_SKINNING","\tattribute vec4 skinIndex;","\tattribute vec4 skinWeight;","#endif","\n"].filter(ko).join("\n"),s=[_,Zo(a),"#define SHADER_NAME "+i.name,M,a.alphaTest?"#define ALPHATEST "+a.alphaTest+(a.alphaTest%1?"":".0"):"","#define GAMMA_FACTOR "+w,a.useFog&&a.fog?"#define USE_FOG":"",a.useFog&&a.fogExp2?"#define FOG_EXP2":"",a.map?"#define USE_MAP":"",a.matcap?"#define USE_MATCAP":"",a.envMap?"#define USE_ENVMAP":"",a.envMap?"#define "+x:"",a.envMap?"#define "+b:"",a.envMap?"#define "+A:"",a.lightMap?"#define USE_LIGHTMAP":"",a.aoMap?"#define USE_AOMAP":"",a.emissiveMap?"#define USE_EMISSIVEMAP":"",a.bumpMap?"#define USE_BUMPMAP":"",a.normalMap?"#define USE_NORMALMAP":"",a.normalMap&&a.objectSpaceNormalMap?"#define OBJECTSPACE_NORMALMAP":"",a.normalMap&&a.tangentSpaceNormalMap?"#define TANGENTSPACE_NORMALMAP":"",a.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",a.specularMap?"#define USE_SPECULARMAP":"",a.roughnessMap?"#define USE_ROUGHNESSMAP":"",a.metalnessMap?"#define USE_METALNESSMAP":"",a.alphaMap?"#define USE_ALPHAMAP":"",a.sheen?"#define USE_SHEEN":"",a.vertexTangents?"#define USE_TANGENT":"",a.vertexColors?"#define USE_COLOR":"",a.vertexUvs?"#define USE_UV":"",a.uvsVertexOnly?"#define UVS_VERTEX_ONLY":"",a.gradientMap?"#define USE_GRADIENTMAP":"",a.flatShading?"#define FLAT_SHADED":"",a.doubleSided?"#define DOUBLE_SIDED":"",a.flipSided?"#define FLIP_SIDED":"",a.shadowMapEnabled?"#define USE_SHADOWMAP":"",a.shadowMapEnabled?"#define "+y:"",a.premultipliedAlpha?"#define PREMULTIPLIED_ALPHA":"",a.physicallyCorrectLights?"#define PHYSICALLY_CORRECT_LIGHTS":"",a.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",a.logarithmicDepthBuffer&&(a.isWebGL2||t.get("EXT_frag_depth"))?"#define USE_LOGDEPTHBUF_EXT":"",(n.extensions&&n.extensions.shaderTextureLOD||a.envMap)&&(a.isWebGL2||t.get("EXT_shader_texture_lod"))?"#define TEXTURE_LOD_EXT":"","uniform mat4 viewMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;",a.toneMapping!==ne?"#define TONE_MAPPING":"",a.toneMapping!==ne?xa.tonemapping_pars_fragment:"",a.toneMapping!==ne?zo("toneMapping",a.toneMapping):"",a.dithering?"#define DITHERING":"",a.outputEncoding||a.mapEncoding||a.matcapEncoding||a.envMapEncoding||a.emissiveMapEncoding||a.lightMapEncoding?xa.encodings_pars_fragment:"",a.mapEncoding?Go("mapTexelToLinear",a.mapEncoding):"",a.matcapEncoding?Go("matcapTexelToLinear",a.matcapEncoding):"",a.envMapEncoding?Go("envMapTexelToLinear",a.envMapEncoding):"",a.emissiveMapEncoding?Go("emissiveMapTexelToLinear",a.emissiveMapEncoding):"",a.lightMapEncoding?Go("lightMapTexelToLinear",a.lightMapEncoding):"",a.outputEncoding?(l="linearToOutputTexel",c=a.outputEncoding,u=Uo(c),"vec4 "+l+"( vec4 value ) { return LinearTo"+u[0]+u[1]+"; }"):"",a.depthPacking?"#define DEPTH_PACKING "+n.depthPacking:"","\n"].filter(ko).join("\n")),v=Vo(v=Ho(v=Wo(v),a),a),g=Vo(g=Ho(g=Wo(g),a),a),v=Yo(v),g=Yo(g),a.isWebGL2&&!n.isRawShaderMaterial){var T=!1,R=/^\s*#version\s+300\s+es\s*\n/;n.isShaderMaterial&&null!==v.match(R)&&null!==g.match(R)&&(T=!0,v=v.replace(R,""),g=g.replace(R,"")),o=["#version 300 es\n","#define attribute in","#define varying out","#define texture2D texture"].join("\n")+"\n"+o,s=["#version 300 es\n","#define varying in",T?"":"out highp vec4 pc_fragColor;",T?"":"#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"+s,E>0&&(o=(o=o.replace("#version 300 es\n",["#version 300 es\n","#extension GL_OVR_multiview2 : require","layout(num_views = "+E+") in;","#define VIEW_ID gl_ViewID_OVR"].join("\n"))).replace(["uniform mat4 modelViewMatrix;","uniform mat4 projectionMatrix;","uniform mat4 viewMatrix;","uniform mat3 normalMatrix;"].join("\n"),["uniform mat4 modelViewMatrices["+E+"];","uniform mat4 projectionMatrices["+E+"];","uniform mat4 viewMatrices["+E+"];","uniform mat3 normalMatrices["+E+"];","#define modelViewMatrix modelViewMatrices[VIEW_ID]","#define projectionMatrix projectionMatrices[VIEW_ID]","#define viewMatrix viewMatrices[VIEW_ID]","#define normalMatrix normalMatrices[VIEW_ID]"].join("\n")),s=(s=s.replace("#version 300 es\n",["#version 300 es\n","#extension GL_OVR_multiview2 : require","#define VIEW_ID gl_ViewID_OVR"].join("\n"))).replace("uniform mat4 viewMatrix;",["uniform mat4 viewMatrices["+E+"];","#define viewMatrix viewMatrices[VIEW_ID]"].join("\n")))}var L,C,P=s+g,D=Bo(h,35633,o+v),I=Bo(h,35632,P);if(h.attachShader(S,D),h.attachShader(S,I),void 0!==n.index0AttributeName?h.bindAttribLocation(S,0,n.index0AttributeName):!0===a.morphTargets&&h.bindAttribLocation(S,0,"position"),h.linkProgram(S),e.debug.checkShaderErrors){var O=h.getProgramInfoLog(S).trim(),B=h.getShaderInfoLog(D).trim(),F=h.getShaderInfoLog(I).trim(),U=!0,N=!0;if(!1===h.getProgramParameter(S,35714)){U=!1;var G=No(h,D,"vertex"),z=No(h,I,"fragment");console.error("THREE.WebGLProgram: shader error: ",h.getError(),"35715",h.getProgramParameter(S,35715),"gl.getProgramInfoLog",O,G,z)}else""!==O?console.warn("THREE.WebGLProgram: gl.getProgramInfoLog()",O):""!==B&&""!==F||(N=!1);N&&(this.diagnostics={runnable:U,material:n,programLog:O,vertexShader:{log:B,prefix:o},fragmentShader:{log:F,prefix:s}})}return h.deleteShader(D),h.deleteShader(I),this.getUniforms=function(){return void 0===L&&(L=new Oo(h,S)),L},this.getAttributes=function(){return void 0===C&&(C=function(e,t){for(var r={},n=e.getProgramParameter(t,35721),i=0;i<n;i++){var a=e.getActiveAttrib(t,i).name;r[a]=e.getAttribLocation(t,a)}return r}(h,S)),C},this.destroy=function(){h.deleteProgram(S),this.program=void 0},this.name=i.name,this.id=Fo++,this.cacheKey=r,this.usedTimes=1,this.program=S,this.vertexShader=D,this.fragmentShader=I,this.numMultiviewViews=E,this}function Ko(e,t,r){var n=[],i=r.isWebGL2,a=r.logarithmicDepthBuffer,o=r.floatVertexTextures,s=r.precision,l=r.maxVertexUniforms,c=r.vertexTextures,u={MeshDepthMaterial:"depth",MeshDistanceMaterial:"distanceRGBA",MeshNormalMaterial:"normal",MeshBasicMaterial:"basic",MeshLambertMaterial:"lambert",MeshPhongMaterial:"phong",MeshToonMaterial:"toon",MeshStandardMaterial:"physical",MeshPhysicalMaterial:"physical",MeshMatcapMaterial:"matcap",LineBasicMaterial:"basic",LineDashedMaterial:"dashed",PointsMaterial:"points",ShadowMaterial:"shadow",SpriteMaterial:"sprite"},h=["precision","isWebGL2","supportsVertexTextures","outputEncoding","instancing","numMultiviewViews","map","mapEncoding","matcap","matcapEncoding","envMap","envMapMode","envMapEncoding","envMapCubeUV","lightMap","lightMapEncoding","aoMap","emissiveMap","emissiveMapEncoding","bumpMap","normalMap","objectSpaceNormalMap","tangentSpaceNormalMap","clearcoatNormalMap","displacementMap","specularMap","roughnessMap","metalnessMap","gradientMap","alphaMap","combine","vertexColors","vertexTangents","vertexUvs","uvsVertexOnly","fog","useFog","fogExp2","flatShading","sizeAttenuation","logarithmicDepthBuffer","skinning","maxBones","useVertexTexture","morphTargets","morphNormals","maxMorphTargets","maxMorphNormals","premultipliedAlpha","numDirLights","numPointLights","numSpotLights","numHemiLights","numRectAreaLights","numDirLightShadows","numPointLightShadows","numSpotLightShadows","shadowMapEnabled","shadowMapType","toneMapping","physicallyCorrectLights","alphaTest","doubleSided","flipSided","numClippingPlanes","numClipIntersection","depthPacking","dithering","sheen"];function d(e){var t;return e?e.isTexture?t=e.encoding:e.isWebGLRenderTarget&&(console.warn("THREE.WebGLPrograms.getTextureEncodingFromMap: don't use render targets as textures. Use their .texture property instead."),t=e.texture.encoding):t=Ut,t}this.getParameters=function(t,n,h,p,f,m,v){var x=p.fog,b=t.isMeshStandardMaterial?p.environment:null,A=t.envMap||b,w=u[t.type],_=v.isSkinnedMesh?function(e){var t=e.skeleton.bones;if(o)return 1024;var r=l,n=Math.floor((r-20)/4),i=Math.min(n,t.length);return i<t.length?(console.warn("THREE.WebGLRenderer: Skeleton has "+t.length+" bones. This GPU supports "+i+"."),0):i}(v):0;null!==t.precision&&(s=r.getMaxPrecision(t.precision))!==t.precision&&console.warn("THREE.WebGLProgram.getParameters:",t.precision,"not supported, using",s,"instead.");var M=e.getRenderTarget(),S=M&&M.isWebGLMultiviewRenderTarget?M.numViews:0;return{isWebGL2:i,shaderID:w,precision:s,instancing:!0===v.isInstancedMesh,supportsVertexTextures:c,numMultiviewViews:S,outputEncoding:null!==M?d(M.texture):e.outputEncoding,map:!!t.map,mapEncoding:d(t.map),matcap:!!t.matcap,matcapEncoding:d(t.matcap),envMap:!!A,envMapMode:A&&A.mapping,envMapEncoding:d(A),envMapCubeUV:!!A&&(A.mapping===me||A.mapping===ve),lightMap:!!t.lightMap,lightMapEncoding:d(t.lightMap),aoMap:!!t.aoMap,emissiveMap:!!t.emissiveMap,emissiveMapEncoding:d(t.emissiveMap),bumpMap:!!t.bumpMap,normalMap:!!t.normalMap,objectSpaceNormalMap:t.normalMapType===Yt,tangentSpaceNormalMap:t.normalMapType===Xt,clearcoatNormalMap:!!t.clearcoatNormalMap,displacementMap:!!t.displacementMap,roughnessMap:!!t.roughnessMap,metalnessMap:!!t.metalnessMap,specularMap:!!t.specularMap,alphaMap:!!t.alphaMap,gradientMap:!!t.gradientMap,sheen:!!t.sheen,combine:t.combine,vertexTangents:t.normalMap&&t.vertexTangents,vertexColors:t.vertexColors,vertexUvs:!!(t.map||t.bumpMap||t.normalMap||t.specularMap||t.alphaMap||t.emissiveMap||t.roughnessMap||t.metalnessMap||t.clearcoatNormalMap||t.displacementMap),uvsVertexOnly:!(t.map||t.bumpMap||t.normalMap||t.specularMap||t.alphaMap||t.emissiveMap||t.roughnessMap||t.metalnessMap||t.clearcoatNormalMap||!t.displacementMap),fog:!!x,useFog:t.fog,fogExp2:x&&x.isFogExp2,flatShading:t.flatShading,sizeAttenuation:t.sizeAttenuation,logarithmicDepthBuffer:a,skinning:t.skinning&&_>0,maxBones:_,useVertexTexture:o,morphTargets:t.morphTargets,morphNormals:t.morphNormals,maxMorphTargets:e.maxMorphTargets,maxMorphNormals:e.maxMorphNormals,numDirLights:n.directional.length,numPointLights:n.point.length,numSpotLights:n.spot.length,numRectAreaLights:n.rectArea.length,numHemiLights:n.hemi.length,numDirLightShadows:n.directionalShadowMap.length,numPointLightShadows:n.pointShadowMap.length,numSpotLightShadows:n.spotShadowMap.length,numClippingPlanes:f,numClipIntersection:m,dithering:t.dithering,shadowMapEnabled:e.shadowMap.enabled&&h.length>0,shadowMapType:e.shadowMap.type,toneMapping:t.toneMapped?e.toneMapping:ne,physicallyCorrectLights:e.physicallyCorrectLights,premultipliedAlpha:t.premultipliedAlpha,alphaTest:t.alphaTest,doubleSided:t.side===y,flipSided:t.side===g,depthPacking:void 0!==t.depthPacking&&t.depthPacking}},this.getProgramCacheKey=function(t,r){var n=[];if(r.shaderID?n.push(r.shaderID):(n.push(t.fragmentShader),n.push(t.vertexShader)),void 0!==t.defines)for(var i in t.defines)n.push(i),n.push(t.defines[i]);if(void 0===t.isRawShaderMaterial){for(var a=0;a<h.length;a++)n.push(r[h[a]]);n.push(e.outputEncoding),n.push(e.gammaFactor)}return n.push(t.onBeforeCompile.toString()),n.join()},this.acquireProgram=function(r,i,a,o){for(var s,l=0,c=n.length;l<c;l++){var u=n[l];if(u.cacheKey===o){++(s=u).usedTimes;break}}return void 0===s&&(s=new Jo(e,t,o,r,i,a),n.push(s)),s},this.releaseProgram=function(e){if(0==--e.usedTimes){var t=n.indexOf(e);n[t]=n[n.length-1],n.pop(),e.destroy()}},this.programs=n}function $o(){var e=new WeakMap;return{get:function(t){var r=e.get(t);return void 0===r&&(r={},e.set(t,r)),r},remove:function(t){e.delete(t)},update:function(t,r,n){e.get(t)[r]=n},dispose:function(){e=new WeakMap}}}function es(e,t){return e.groupOrder!==t.groupOrder?e.groupOrder-t.groupOrder:e.renderOrder!==t.renderOrder?e.renderOrder-t.renderOrder:e.program!==t.program?e.program.id-t.program.id:e.material.id!==t.material.id?e.material.id-t.material.id:e.z!==t.z?e.z-t.z:e.id-t.id}function ts(e,t){return e.groupOrder!==t.groupOrder?e.groupOrder-t.groupOrder:e.renderOrder!==t.renderOrder?e.renderOrder-t.renderOrder:e.z!==t.z?t.z-e.z:e.id-t.id}function rs(){var e=[],t=0,r=[],n=[],i={id:-1};function a(r,n,a,o,s,l){var c=e[t];return void 0===c?(c={id:r.id,object:r,geometry:n,material:a,program:a.program||i,groupOrder:o,renderOrder:r.renderOrder,z:s,group:l},e[t]=c):(c.id=r.id,c.object=r,c.geometry=n,c.material=a,c.program=a.program||i,c.groupOrder=o,c.renderOrder=r.renderOrder,c.z=s,c.group=l),t++,c}return{opaque:r,transparent:n,init:function(){t=0,r.length=0,n.length=0},push:function(e,t,i,o,s,l){var c=a(e,t,i,o,s,l);(!0===i.transparent?n:r).push(c)},unshift:function(e,t,i,o,s,l){var c=a(e,t,i,o,s,l);(!0===i.transparent?n:r).unshift(c)},sort:function(e,t){r.length>1&&r.sort(e||es),n.length>1&&n.sort(t||ts)}}}function ns(){var e=new WeakMap;function t(r){var n=r.target;n.removeEventListener("dispose",t),e.delete(n)}return{get:function(r,n){var i,a=e.get(r);return void 0===a?(i=new rs,e.set(r,new WeakMap),e.get(r).set(n,i),r.addEventListener("dispose",t)):void 0===(i=a.get(n))&&(i=new rs,a.set(n,i)),i},dispose:function(){e=new WeakMap}}}function is(){var e={};return{get:function(t){if(void 0!==e[t.id])return e[t.id];var r;switch(t.type){case"DirectionalLight":r={direction:new Rr,color:new ti,shadow:!1,shadowBias:0,shadowRadius:1,shadowMapSize:new Mr};break;case"SpotLight":r={position:new Rr,direction:new Rr,color:new ti,distance:0,coneCos:0,penumbraCos:0,decay:0,shadow:!1,shadowBias:0,shadowRadius:1,shadowMapSize:new Mr};break;case"PointLight":r={position:new Rr,color:new ti,distance:0,decay:0,shadow:!1,shadowBias:0,shadowRadius:1,shadowMapSize:new Mr,shadowCameraNear:1,shadowCameraFar:1e3};break;case"HemisphereLight":r={direction:new Rr,skyColor:new ti,groundColor:new ti};break;case"RectAreaLight":r={color:new ti,position:new Rr,halfWidth:new Rr,halfHeight:new Rr}}return e[t.id]=r,r}}}var as=0;function os(e,t){return(t.castShadow?1:0)-(e.castShadow?1:0)}function ss(){for(var e=new is,t={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:[],directionalShadowMap:[],directionalShadowMatrix:[],spot:[],spotShadowMap:[],spotShadowMatrix:[],rectArea:[],point:[],pointShadowMap:[],pointShadowMatrix:[],hemi:[],numDirectionalShadows:-1,numPointShadows:-1,numSpotShadows:-1},r=0;r<9;r++)t.probe.push(new Rr);var n=new Rr,i=new Wr,a=new Wr;return{setup:function(r,o,s){for(var l=0,c=0,u=0,h=0;h<9;h++)t.probe[h].set(0,0,0);var d=0,p=0,f=0,m=0,v=0,g=0,y=0,x=0,b=s.matrixWorldInverse;r.sort(os),h=0;for(var A=r.length;h<A;h++){var w=r[h],_=w.color,M=w.intensity,S=w.distance,E=w.shadow&&w.shadow.map?w.shadow.map.texture:null;if(w.isAmbientLight)l+=_.r*M,c+=_.g*M,u+=_.b*M;else if(w.isLightProbe)for(var T=0;T<9;T++)t.probe[T].addScaledVector(w.sh.coefficients[T],M);else if(w.isDirectionalLight){if((L=e.get(w)).color.copy(w.color).multiplyScalar(w.intensity),L.direction.setFromMatrixPosition(w.matrixWorld),n.setFromMatrixPosition(w.target.matrixWorld),L.direction.sub(n),L.direction.transformDirection(b),L.shadow=w.castShadow,w.castShadow){var R=w.shadow;L.shadowBias=R.bias,L.shadowRadius=R.radius,L.shadowMapSize=R.mapSize,t.directionalShadowMap[d]=E,t.directionalShadowMatrix[d]=w.shadow.matrix,g++}t.directional[d]=L,d++}else if(w.isSpotLight){if((L=e.get(w)).position.setFromMatrixPosition(w.matrixWorld),L.position.applyMatrix4(b),L.color.copy(_).multiplyScalar(M),L.distance=S,L.direction.setFromMatrixPosition(w.matrixWorld),n.setFromMatrixPosition(w.target.matrixWorld),L.direction.sub(n),L.direction.transformDirection(b),L.coneCos=Math.cos(w.angle),L.penumbraCos=Math.cos(w.angle*(1-w.penumbra)),L.decay=w.decay,L.shadow=w.castShadow,w.castShadow){R=w.shadow;L.shadowBias=R.bias,L.shadowRadius=R.radius,L.shadowMapSize=R.mapSize,t.spotShadowMap[f]=E,t.spotShadowMatrix[f]=w.shadow.matrix,x++}t.spot[f]=L,f++}else if(w.isRectAreaLight){(L=e.get(w)).color.copy(_).multiplyScalar(M),L.position.setFromMatrixPosition(w.matrixWorld),L.position.applyMatrix4(b),a.identity(),i.copy(w.matrixWorld),i.premultiply(b),a.extractRotation(i),L.halfWidth.set(.5*w.width,0,0),L.halfHeight.set(0,.5*w.height,0),L.halfWidth.applyMatrix4(a),L.halfHeight.applyMatrix4(a),t.rectArea[m]=L,m++}else if(w.isPointLight){if((L=e.get(w)).position.setFromMatrixPosition(w.matrixWorld),L.position.applyMatrix4(b),L.color.copy(w.color).multiplyScalar(w.intensity),L.distance=w.distance,L.decay=w.decay,L.shadow=w.castShadow,w.castShadow){R=w.shadow;L.shadowBias=R.bias,L.shadowRadius=R.radius,L.shadowMapSize=R.mapSize,L.shadowCameraNear=R.camera.near,L.shadowCameraFar=R.camera.far,t.pointShadowMap[p]=E,t.pointShadowMatrix[p]=w.shadow.matrix,y++}t.point[p]=L,p++}else if(w.isHemisphereLight){var L;(L=e.get(w)).direction.setFromMatrixPosition(w.matrixWorld),L.direction.transformDirection(b),L.direction.normalize(),L.skyColor.copy(w.color).multiplyScalar(M),L.groundColor.copy(w.groundColor).multiplyScalar(M),t.hemi[v]=L,v++}}t.ambient[0]=l,t.ambient[1]=c,t.ambient[2]=u;var C=t.hash;C.directionalLength===d&&C.pointLength===p&&C.spotLength===f&&C.rectAreaLength===m&&C.hemiLength===v&&C.numDirectionalShadows===g&&C.numPointShadows===y&&C.numSpotShadows===x||(t.directional.length=d,t.spot.length=f,t.rectArea.length=m,t.point.length=p,t.hemi.length=v,t.directionalShadowMap.length=g,t.pointShadowMap.length=y,t.spotShadowMap.length=x,t.directionalShadowMatrix.length=g,t.pointShadowMatrix.length=y,t.spotShadowMatrix.length=x,C.directionalLength=d,C.pointLength=p,C.spotLength=f,C.rectAreaLength=m,C.hemiLength=v,C.numDirectionalShadows=g,C.numPointShadows=y,C.numSpotShadows=x,t.version=as++)},state:t}}function ls(){var e=new ss,t=[],r=[];return{init:function(){t.length=0,r.length=0},state:{lightsArray:t,shadowsArray:r,lights:e},setupLights:function(n){e.setup(t,r,n)},pushLight:function(e){t.push(e)},pushShadow:function(e){r.push(e)}}}function cs(){var e=new WeakMap;function t(r){var n=r.target;n.removeEventListener("dispose",t),e.delete(n)}return{get:function(r,n){var i;return!1===e.has(r)?(i=new ls,e.set(r,new WeakMap),e.get(r).set(n,i),r.addEventListener("dispose",t)):!1===e.get(r).has(n)?(i=new ls,e.get(r).set(n,i)):i=e.get(r).get(n),i},dispose:function(){e=new WeakMap}}}function us(e){si.call(this),this.type="MeshDepthMaterial",this.depthPacking=Wt,this.skinning=!1,this.morphTargets=!1,this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.wireframe=!1,this.wireframeLinewidth=1,this.fog=!1,this.setValues(e)}function hs(e){si.call(this),this.type="MeshDistanceMaterial",this.referencePosition=new Rr,this.nearDistance=1,this.farDistance=1e3,this.skinning=!1,this.morphTargets=!1,this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.fog=!1,this.setValues(e)}us.prototype=Object.create(si.prototype),us.prototype.constructor=us,us.prototype.isMeshDepthMaterial=!0,us.prototype.copy=function(e){return si.prototype.copy.call(this,e),this.depthPacking=e.depthPacking,this.skinning=e.skinning,this.morphTargets=e.morphTargets,this.map=e.map,this.alphaMap=e.alphaMap,this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this},hs.prototype=Object.create(si.prototype),hs.prototype.constructor=hs,hs.prototype.isMeshDistanceMaterial=!0,hs.prototype.copy=function(e){return si.prototype.copy.call(this,e),this.referencePosition.copy(e.referencePosition),this.nearDistance=e.nearDistance,this.farDistance=e.farDistance,this.skinning=e.skinning,this.morphTargets=e.morphTargets,this.map=e.map,this.alphaMap=e.alphaMap,this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this};var ds="uniform sampler2D shadow_pass;\nuniform vec2 resolution;\nuniform float radius;\n#include <packing>\nvoid main() {\n float mean = 0.0;\n float squared_mean = 0.0;\n\tfloat depth = unpackRGBAToDepth( texture2D( shadow_pass, ( gl_FragCoord.xy ) / resolution ) );\n for ( float i = -1.0; i < 1.0 ; i += SAMPLE_RATE) {\n #ifdef HORIZONAL_PASS\n vec2 distribution = unpackRGBATo2Half( texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( i, 0.0 ) * radius ) / resolution ) );\n mean += distribution.x;\n squared_mean += distribution.y * distribution.y + distribution.x * distribution.x;\n #else\n float depth = unpackRGBAToDepth( texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( 0.0, i ) * radius ) / resolution ) );\n mean += depth;\n squared_mean += depth * depth;\n #endif\n }\n mean = mean * HALF_SAMPLE_RATE;\n squared_mean = squared_mean * HALF_SAMPLE_RATE;\n float std_dev = sqrt( squared_mean - mean * mean );\n gl_FragColor = pack2HalfToRGBA( vec2( mean, std_dev ) );\n}",ps="void main() {\n\tgl_Position = vec4( position, 1.0 );\n}";function fs(e,t,r){var n=new ya,i=new Mr,a=new Mr,o=new Br,s=[],l=[],c={},u={0:g,1:v,2:y},h=new la({defines:{SAMPLE_RATE:.25,HALF_SAMPLE_RATE:1/8},uniforms:{shadow_pass:{value:null},resolution:{value:new Mr},radius:{value:4}},vertexShader:ps,fragmentShader:ds}),d=h.clone();d.defines.HORIZONAL_PASS=1;var f=new Li;f.setAttribute("position",new ui(new Float32Array([-1,-1,.5,3,-1,.5,-1,3,.5]),3));var x=new Xi(f,h),b=this;function A(r,n){var i=t.update(x);h.uniforms.shadow_pass.value=r.map.texture,h.uniforms.resolution.value=r.mapSize,h.uniforms.radius.value=r.radius,e.setRenderTarget(r.mapPass),e.clear(),e.renderBufferDirect(n,null,i,h,x,null),d.uniforms.shadow_pass.value=r.mapPass.texture,d.uniforms.resolution.value=r.mapSize,d.uniforms.radius.value=r.radius,e.setRenderTarget(r.map),e.clear(),e.renderBufferDirect(n,null,i,d,x,null)}function w(e,t,r){var n=e<<0|t<<1|r<<2,i=s[n];return void 0===i&&(i=new us({depthPacking:qt,morphTargets:e,skinning:t}),s[n]=i),i}function _(e,t,r){var n=e<<0|t<<1|r<<2,i=l[n];return void 0===i&&(i=new hs({morphTargets:e,skinning:t}),l[n]=i),i}function S(t,r,n,i,a,o){var s=t.geometry,l=null,h=w,d=t.customDepthMaterial;if(!0===n.isPointLight&&(h=_,d=t.customDistanceMaterial),void 0===d){var p=!1;!0===r.morphTargets&&(!0===s.isBufferGeometry?p=s.morphAttributes&&s.morphAttributes.position&&s.morphAttributes.position.length>0:!0===s.isGeometry&&(p=s.morphTargets&&s.morphTargets.length>0));var f=!1;!0===t.isSkinnedMesh&&(!0===r.skinning?f=!0:console.warn("THREE.WebGLShadowMap: THREE.SkinnedMesh with material.skinning set to false:",t)),l=h(p,f,!0===t.isInstancedMesh)}else l=d;if(e.localClippingEnabled&&!0===r.clipShadows&&0!==r.clippingPlanes.length){var v=l.uuid,g=r.uuid,y=c[v];void 0===y&&(y={},c[v]=y);var x=y[g];void 0===x&&(x=l.clone(),y[g]=x),l=x}return l.visible=r.visible,l.wireframe=r.wireframe,l.side=o===m?null!==r.shadowSide?r.shadowSide:r.side:null!==r.shadowSide?r.shadowSide:u[r.side],l.clipShadows=r.clipShadows,l.clippingPlanes=r.clippingPlanes,l.clipIntersection=r.clipIntersection,l.wireframeLinewidth=r.wireframeLinewidth,l.linewidth=r.linewidth,!0===n.isPointLight&&!0===l.isMeshDistanceMaterial&&(l.referencePosition.setFromMatrixPosition(n.matrixWorld),l.nearDistance=i,l.farDistance=a),l}function E(r,i,a,o,s){if(!1!==r.visible){if(r.layers.test(i.layers)&&(r.isMesh||r.isLine||r.isPoints)&&(r.castShadow||r.receiveShadow&&s===m)&&(!r.frustumCulled||n.intersectsObject(r))){r.modelViewMatrix.multiplyMatrices(a.matrixWorldInverse,r.matrixWorld);var l=t.update(r),c=r.material;if(Array.isArray(c))for(var u=l.groups,h=0,d=u.length;h<d;h++){var p=u[h],f=c[p.materialIndex];if(f&&f.visible){var v=S(r,f,o,a.near,a.far,s);e.renderBufferDirect(a,null,l,v,r,p)}}else if(c.visible){v=S(r,c,o,a.near,a.far,s);e.renderBufferDirect(a,null,l,v,r,null)}}for(var g=r.children,y=0,x=g.length;y<x;y++)E(g[y],i,a,o,s)}}this.enabled=!1,this.autoUpdate=!0,this.needsUpdate=!1,this.type=p,this.render=function(t,s,l){if(!1!==b.enabled&&(!1!==b.autoUpdate||!1!==b.needsUpdate)&&0!==t.length){var c=e.getRenderTarget(),u=e.getActiveCubeFace(),h=e.getActiveMipmapLevel(),d=e.state;d.setBlending(M),d.buffers.color.setClear(1,1,1,1),d.buffers.depth.setTest(!0),d.setScissorTest(!1);for(var p=0,f=t.length;p<f;p++){var v=t[p],g=v.shadow;if(void 0!==g){i.copy(g.mapSize);var y=g.getFrameExtents();if(i.multiply(y),a.copy(g.mapSize),(i.x>r||i.y>r)&&(console.warn("THREE.WebGLShadowMap:",v,"has shadow exceeding max texture size, reducing"),i.x>r&&(a.x=Math.floor(r/y.x),i.x=a.x*y.x,g.mapSize.x=a.x),i.y>r&&(a.y=Math.floor(r/y.y),i.y=a.y*y.y,g.mapSize.y=a.y)),null===g.map&&!g.isPointLightShadow&&this.type===m){var x={minFilter:Se,magFilter:Se,format:je};g.map=new Fr(i.x,i.y,x),g.map.texture.name=v.name+".shadowMap",g.mapPass=new Fr(i.x,i.y,x),g.camera.updateProjectionMatrix()}if(null===g.map){x={minFilter:be,magFilter:be,format:je};g.map=new Fr(i.x,i.y,x),g.map.texture.name=v.name+".shadowMap",g.camera.updateProjectionMatrix()}e.setRenderTarget(g.map),e.clear();for(var w=g.getViewportCount(),_=0;_<w;_++){var S=g.getViewport(_);o.set(a.x*S.x,a.y*S.y,a.x*S.z,a.y*S.w),d.viewport(o),g.updateMatrices(v,_),n=g.getFrustum(),E(s,l,g.camera,v,this.type)}g.isPointLightShadow||this.type!==m||A(g,l)}else console.warn("THREE.WebGLShadowMap:",v,"has no shadow.")}b.needsUpdate=!1,e.setRenderTarget(c,u,h)}}}function ms(e,t,r){var n=r.isWebGL2;var i=new function(){var t=!1,r=new Br,n=null,i=new Br(0,0,0,0);return{setMask:function(r){n===r||t||(e.colorMask(r,r,r,r),n=r)},setLocked:function(e){t=e},setClear:function(t,n,a,o,s){!0===s&&(t*=o,n*=o,a*=o),r.set(t,n,a,o),!1===i.equals(r)&&(e.clearColor(t,n,a,o),i.copy(r))},reset:function(){t=!1,n=null,i.set(-1,0,0,0)}}},a=new function(){var t=!1,r=null,n=null,i=null;return{setTest:function(e){e?xe(2929):be(2929)},setMask:function(n){r===n||t||(e.depthMask(n),r=n)},setFunc:function(t){if(n!==t){if(t)switch(t){case q:e.depthFunc(512);break;case X:e.depthFunc(519);break;case Y:e.depthFunc(513);break;case Q:e.depthFunc(515);break;case Z:e.depthFunc(514);break;case J:e.depthFunc(518);break;case K:e.depthFunc(516);break;case $:e.depthFunc(517);break;default:e.depthFunc(515)}else e.depthFunc(515);n=t}},setLocked:function(e){t=e},setClear:function(t){i!==t&&(e.clearDepth(t),i=t)},reset:function(){t=!1,r=null,n=null,i=null}}},c=new function(){var t=!1,r=null,n=null,i=null,a=null,o=null,s=null,l=null,c=null;return{setTest:function(e){t||(e?xe(2960):be(2960))},setMask:function(n){r===n||t||(e.stencilMask(n),r=n)},setFunc:function(t,r,o){n===t&&i===r&&a===o||(e.stencilFunc(t,r,o),n=t,i=r,a=o)},setOp:function(t,r,n){o===t&&s===r&&l===n||(e.stencilOp(t,r,n),o=t,s=r,l=n)},setLocked:function(e){t=e},setClear:function(t){c!==t&&(e.clearStencil(t),c=t)},reset:function(){t=!1,r=null,n=null,i=null,a=null,o=null,s=null,l=null,c=null}}},u=e.getParameter(34921),h=new Uint8Array(u),d=new Uint8Array(u),p=new Uint8Array(u),f={},m=null,v=null,x=null,b=null,A=null,w=null,_=null,ee=null,te=null,re=!1,ne=null,ie=null,ae=null,oe=null,se=null,le=e.getParameter(35661),ce=!1,ue=0,he=e.getParameter(7938);-1!==he.indexOf("WebGL")?(ue=parseFloat(/^WebGL\ ([0-9])/.exec(he)[1]),ce=ue>=1):-1!==he.indexOf("OpenGL ES")&&(ue=parseFloat(/^OpenGL\ ES\ ([0-9])/.exec(he)[1]),ce=ue>=2);var de=null,pe={},fe=new Br,me=new Br;function ve(t,r,n){var i=new Uint8Array(4),a=e.createTexture();e.bindTexture(t,a),e.texParameteri(t,10241,9728),e.texParameteri(t,10240,9728);for(var o=0;o<n;o++)e.texImage2D(r+o,0,6408,1,1,0,6408,5121,i);return a}var ge={};function ye(r,i){(h[r]=1,0===d[r]&&(e.enableVertexAttribArray(r),d[r]=1),p[r]!==i)&&((n?e:t.get("ANGLE_instanced_arrays"))[n?"vertexAttribDivisor":"vertexAttribDivisorANGLE"](r,i),p[r]=i)}function xe(t){!0!==f[t]&&(e.enable(t),f[t]=!0)}function be(t){!1!==f[t]&&(e.disable(t),f[t]=!1)}ge[3553]=ve(3553,3553,1),ge[34067]=ve(34067,34069,6),i.setClear(0,0,0,1),a.setClear(1),c.setClear(0),xe(2929),a.setFunc(Q),Se(!1),Ee(s),xe(2884),Me(M);var Ae={[C]:32774,[P]:32778,[D]:32779};if(n)Ae[I]=32775,Ae[O]=32776;else{var we=t.get("EXT_blend_minmax");null!==we&&(Ae[I]=we.MIN_EXT,Ae[O]=we.MAX_EXT)}var _e={[B]:0,[F]:1,[U]:768,[G]:770,[W]:776,[V]:774,[k]:772,[N]:769,[z]:771,[j]:775,[H]:773};function Me(t,r,n,i,a,o,s,l){if(t!==M){if(v||(xe(3042),v=!0),t===L)a=a||r,o=o||n,s=s||i,r===b&&a===_||(e.blendEquationSeparate(Ae[r],Ae[a]),b=r,_=a),n===A&&i===w&&o===ee&&s===te||(e.blendFuncSeparate(_e[n],_e[i],_e[o],_e[s]),A=n,w=i,ee=o,te=s),x=t,re=null;else if(t!==x||l!==re){if(b===C&&_===C||(e.blendEquation(32774),b=C,_=C),l)switch(t){case S:e.blendFuncSeparate(1,771,1,771);break;case E:e.blendFunc(1,1);break;case T:e.blendFuncSeparate(0,0,769,771);break;case R:e.blendFuncSeparate(0,768,0,770);break;default:console.error("THREE.WebGLState: Invalid blending: ",t)}else switch(t){case S:e.blendFuncSeparate(770,771,1,771);break;case E:e.blendFunc(770,1);break;case T:e.blendFunc(0,769);break;case R:e.blendFunc(0,768);break;default:console.error("THREE.WebGLState: Invalid blending: ",t)}A=null,w=null,ee=null,te=null,x=t,re=l}}else v&&(be(3042),v=!1)}function Se(t){ne!==t&&(t?e.frontFace(2304):e.frontFace(2305),ne=t)}function Ee(t){t!==o?(xe(2884),t!==ie&&(t===s?e.cullFace(1029):t===l?e.cullFace(1028):e.cullFace(1032))):be(2884),ie=t}function Te(t,r,n){t?(xe(32823),oe===r&&se===n||(e.polygonOffset(r,n),oe=r,se=n)):be(32823)}function Re(t){void 0===t&&(t=33984+le-1),de!==t&&(e.activeTexture(t),de=t)}return{buffers:{color:i,depth:a,stencil:c},initAttributes:function(){for(var e=0,t=h.length;e<t;e++)h[e]=0},enableAttribute:function(e){ye(e,0)},enableAttributeAndDivisor:ye,disableUnusedAttributes:function(){for(var t=0,r=d.length;t!==r;++t)d[t]!==h[t]&&(e.disableVertexAttribArray(t),d[t]=0)},enable:xe,disable:be,useProgram:function(t){return m!==t&&(e.useProgram(t),m=t,!0)},setBlending:Me,setMaterial:function(e,t){e.side===y?be(2884):xe(2884);var r=e.side===g;t&&(r=!r),Se(r),e.blending===S&&!1===e.transparent?Me(M):Me(e.blending,e.blendEquation,e.blendSrc,e.blendDst,e.blendEquationAlpha,e.blendSrcAlpha,e.blendDstAlpha,e.premultipliedAlpha),a.setFunc(e.depthFunc),a.setTest(e.depthTest),a.setMask(e.depthWrite),i.setMask(e.colorWrite);var n=e.stencilWrite;c.setTest(n),n&&(c.setMask(e.stencilWriteMask),c.setFunc(e.stencilFunc,e.stencilRef,e.stencilFuncMask),c.setOp(e.stencilFail,e.stencilZFail,e.stencilZPass)),Te(e.polygonOffset,e.polygonOffsetFactor,e.polygonOffsetUnits)},setFlipSided:Se,setCullFace:Ee,setLineWidth:function(t){t!==ae&&(ce&&e.lineWidth(t),ae=t)},setPolygonOffset:Te,setScissorTest:function(e){e?xe(3089):be(3089)},activeTexture:Re,bindTexture:function(t,r){null===de&&Re();var n=pe[de];void 0===n&&(n={type:void 0,texture:void 0},pe[de]=n),n.type===t&&n.texture===r||(e.bindTexture(t,r||ge[t]),n.type=t,n.texture=r)},unbindTexture:function(){var t=pe[de];void 0!==t&&void 0!==t.type&&(e.bindTexture(t.type,null),t.type=void 0,t.texture=void 0)},compressedTexImage2D:function(){try{e.compressedTexImage2D.apply(e,arguments)}catch(e){console.error("THREE.WebGLState:",e)}},texImage2D:function(){try{e.texImage2D.apply(e,arguments)}catch(e){console.error("THREE.WebGLState:",e)}},texImage3D:function(){try{e.texImage3D.apply(e,arguments)}catch(e){console.error("THREE.WebGLState:",e)}},scissor:function(t){!1===fe.equals(t)&&(e.scissor(t.x,t.y,t.z,t.w),fe.copy(t))},viewport:function(t){!1===me.equals(t)&&(e.viewport(t.x,t.y,t.z,t.w),me.copy(t))},reset:function(){for(var t=0;t<d.length;t++)1===d[t]&&(e.disableVertexAttribArray(t),d[t]=0);f={},de=null,pe={},m=null,x=null,ne=null,ie=null,i.reset(),a.reset(),c.reset()}}}function vs(e,t,r,n,i,a,o){var s,l=i.isWebGL2,c=i.maxTextures,u=i.maxCubemapSize,h=i.maxTextureSize,d=i.maxSamples,p=new WeakMap,f=!1;try{f="undefined"!=typeof OffscreenCanvas&&null!==new OffscreenCanvas(1,1).getContext("2d")}catch(e){}function m(e,t){return f?new OffscreenCanvas(e,t):document.createElementNS("http://www.w3.org/1999/xhtml","canvas")}function v(e,t,r,n){var i=1;if((e.width>n||e.height>n)&&(i=n/Math.max(e.width,e.height)),i<1||!0===t){if("undefined"!=typeof HTMLImageElement&&e instanceof HTMLImageElement||"undefined"!=typeof HTMLCanvasElement&&e instanceof HTMLCanvasElement||"undefined"!=typeof ImageBitmap&&e instanceof ImageBitmap){var a=t?_r.floorPowerOfTwo:Math.floor,o=a(i*e.width),l=a(i*e.height);void 0===s&&(s=m(o,l));var c=r?m(o,l):s;return c.width=o,c.height=l,c.getContext("2d").drawImage(e,0,0,o,l),console.warn("THREE.WebGLRenderer: Texture has been resized from ("+e.width+"x"+e.height+") to ("+o+"x"+l+")."),c}return"data"in e&&console.warn("THREE.WebGLRenderer: Image in DataTexture is too big ("+e.width+"x"+e.height+")."),e}return e}function g(e){return _r.isPowerOfTwo(e.width)&&_r.isPowerOfTwo(e.height)}function y(e,t){return e.generateMipmaps&&t&&e.minFilter!==be&&e.minFilter!==Se}function x(t,r,i,a){e.generateMipmap(t),n.get(r).__maxMipLevel=Math.log(Math.max(i,a))*Math.LOG2E}function b(r,n,i){if(!1===l)return n;if(null!==r){if(void 0!==e[r])return e[r];console.warn("THREE.WebGLRenderer: Attempt to use non-existing WebGL internal format '"+r+"'")}var a=n;return 6403===n&&(5126===i&&(a=33326),5131===i&&(a=33325),5121===i&&(a=33321)),6407===n&&(5126===i&&(a=34837),5131===i&&(a=34843),5121===i&&(a=32849)),6408===n&&(5126===i&&(a=34836),5131===i&&(a=34842),5121===i&&(a=32856)),33325===a||33326===a||34842===a||34836===a?t.get("EXT_color_buffer_float"):34843!==a&&34837!==a||console.warn("THREE.WebGLRenderer: Floating point textures with RGB format not supported. Please use RGBA instead."),a}function A(e){return e===be||e===Ae||e===_e?9728:9729}function w(t){var r=t.target;r.removeEventListener("dispose",w),function(t){var r=n.get(t);if(void 0===r.__webglInit)return;e.deleteTexture(r.__webglTexture),n.remove(t)}(r),r.isVideoTexture&&p.delete(r),o.memory.textures--}function _(t){var r=t.target;r.removeEventListener("dispose",_),function(t){var r=n.get(t),i=n.get(t.texture);if(!t)return;void 0!==i.__webglTexture&&e.deleteTexture(i.__webglTexture);t.depthTexture&&t.depthTexture.dispose();if(t.isWebGLRenderTargetCube)for(var a=0;a<6;a++)e.deleteFramebuffer(r.__webglFramebuffer[a]),r.__webglDepthbuffer&&e.deleteRenderbuffer(r.__webglDepthbuffer[a]);else e.deleteFramebuffer(r.__webglFramebuffer),r.__webglDepthbuffer&&e.deleteRenderbuffer(r.__webglDepthbuffer);if(t.isWebGLMultiviewRenderTarget){e.deleteTexture(r.__webglColorTexture),e.deleteTexture(r.__webglDepthStencilTexture),o.memory.textures-=2;a=0;for(var s=r.__webglViewFramebuffers.length;a<s;a++)e.deleteFramebuffer(r.__webglViewFramebuffers[a])}n.remove(t.texture),n.remove(t)}(r),o.memory.textures--}var M=0;function S(e,t){var i=n.get(e);if(e.isVideoTexture&&function(e){var t=o.render.frame;p.get(e)!==t&&(p.set(e,t),e.update())}(e),e.version>0&&i.__version!==e.version){var a=e.image;if(void 0===a)console.warn("THREE.WebGLRenderer: Texture marked for update but image is undefined");else{if(!1!==a.complete)return void D(i,e,t);console.warn("THREE.WebGLRenderer: Texture marked for update but image is incomplete")}}r.activeTexture(33984+t),r.bindTexture(3553,i.__webglTexture)}function E(t,i){if(6===t.image.length){var o=n.get(t);if(t.version>0&&o.__version!==t.version){P(o,t),r.activeTexture(33984+i),r.bindTexture(34067,o.__webglTexture),e.pixelStorei(37440,t.flipY);for(var s=t&&t.isCompressedTexture,c=t.image[0]&&t.image[0].isDataTexture,h=[],d=0;d<6;d++)h[d]=s||c?c?t.image[d].image:t.image[d]:v(t.image[d],!1,!0,u);var p,f=h[0],m=g(f)||l,A=a.convert(t.format),w=a.convert(t.type),_=b(t.internalFormat,A,w);if(C(34067,t,m),s){for(d=0;d<6;d++){p=h[d].mipmaps;for(var M=0;M<p.length;M++){var S=p[M];t.format!==je&&t.format!==Ve?null!==A?r.compressedTexImage2D(34069+d,M,_,S.width,S.height,0,S.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .setTextureCube()"):r.texImage2D(34069+d,M,_,S.width,S.height,0,A,w,S.data)}}o.__maxMipLevel=p.length-1}else{p=t.mipmaps;for(d=0;d<6;d++)if(c){r.texImage2D(34069+d,0,_,h[d].width,h[d].height,0,A,w,h[d].data);for(M=0;M<p.length;M++){var E=(S=p[M]).image[d].image;r.texImage2D(34069+d,M+1,_,E.width,E.height,0,A,w,E.data)}}else{r.texImage2D(34069+d,0,_,A,w,h[d]);for(M=0;M<p.length;M++){S=p[M];r.texImage2D(34069+d,M+1,_,A,w,S.image[d])}}o.__maxMipLevel=p.length}y(t,m)&&x(34067,t,f.width,f.height),o.__version=t.version,t.onUpdate&&t.onUpdate(t)}else r.activeTexture(33984+i),r.bindTexture(34067,o.__webglTexture)}}function T(e,t){r.activeTexture(33984+t),r.bindTexture(34067,n.get(e).__webglTexture)}var R={[ge]:10497,[ye]:33071,[xe]:33648},L={[be]:9728,[Ae]:9984,[_e]:9986,[Se]:9729,[Ee]:9985,[Re]:9987};function C(r,a,o){o?(e.texParameteri(r,10242,R[a.wrapS]),e.texParameteri(r,10243,R[a.wrapT]),32879!==r&&35866!==r||e.texParameteri(r,32882,R[a.wrapR]),e.texParameteri(r,10240,L[a.magFilter]),e.texParameteri(r,10241,L[a.minFilter])):(e.texParameteri(r,10242,33071),e.texParameteri(r,10243,33071),32879!==r&&35866!==r||e.texParameteri(r,32882,33071),a.wrapS===ye&&a.wrapT===ye||console.warn("THREE.WebGLRenderer: Texture is not power of two. Texture.wrapS and Texture.wrapT should be set to THREE.ClampToEdgeWrapping."),e.texParameteri(r,10240,A(a.magFilter)),e.texParameteri(r,10241,A(a.minFilter)),a.minFilter!==be&&a.minFilter!==Se&&console.warn("THREE.WebGLRenderer: Texture is not power of two. Texture.minFilter should be set to THREE.NearestFilter or THREE.LinearFilter."));var s=t.get("EXT_texture_filter_anisotropic");if(s){if(a.type===Fe&&null===t.get("OES_texture_float_linear"))return;if(a.type===Ue&&null===(l||t.get("OES_texture_half_float_linear")))return;(a.anisotropy>1||n.get(a).__currentAnisotropy)&&(e.texParameterf(r,s.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(a.anisotropy,i.getMaxAnisotropy())),n.get(a).__currentAnisotropy=a.anisotropy)}}function P(t,r){void 0===t.__webglInit&&(t.__webglInit=!0,r.addEventListener("dispose",w),t.__webglTexture=e.createTexture(),o.memory.textures++)}function D(t,n,i){var o=3553;n.isDataTexture2DArray&&(o=35866),n.isDataTexture3D&&(o=32879),P(t,n),r.activeTexture(33984+i),r.bindTexture(o,t.__webglTexture),e.pixelStorei(37440,n.flipY),e.pixelStorei(37441,n.premultiplyAlpha),e.pixelStorei(3317,n.unpackAlignment);var s=function(e){return!l&&(e.wrapS!==ye||e.wrapT!==ye||e.minFilter!==be&&e.minFilter!==Se)}(n)&&!1===g(n.image),c=v(n.image,s,!1,h),u=g(c)||l,d=a.convert(n.format),p=a.convert(n.type),f=b(n.internalFormat,d,p);C(o,n,u);var m,A=n.mipmaps;if(n.isDepthTexture){if(f=6402,n.type===Fe){if(!1===l)throw new Error("Float Depth Texture only supported in WebGL2.0");f=36012}else l&&(f=33189);n.format===Ye&&6402===f&&n.type!==Ie&&n.type!==Be&&(console.warn("THREE.WebGLRenderer: Use UnsignedShortType or UnsignedIntType for DepthFormat DepthTexture."),n.type=Ie,p=a.convert(n.type)),n.format===Qe&&(f=34041,n.type!==ke&&(console.warn("THREE.WebGLRenderer: Use UnsignedInt248Type for DepthStencilFormat DepthTexture."),n.type=ke,p=a.convert(n.type))),r.texImage2D(3553,0,f,c.width,c.height,0,d,p,null)}else if(n.isDataTexture)if(A.length>0&&u){for(var w=0,_=A.length;w<_;w++)m=A[w],r.texImage2D(3553,w,f,m.width,m.height,0,d,p,m.data);n.generateMipmaps=!1,t.__maxMipLevel=A.length-1}else r.texImage2D(3553,0,f,c.width,c.height,0,d,p,c.data),t.__maxMipLevel=0;else if(n.isCompressedTexture){for(w=0,_=A.length;w<_;w++)m=A[w],n.format!==je&&n.format!==Ve?null!==d?r.compressedTexImage2D(3553,w,f,m.width,m.height,0,m.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()"):r.texImage2D(3553,w,f,m.width,m.height,0,d,p,m.data);t.__maxMipLevel=A.length-1}else if(n.isDataTexture2DArray)r.texImage3D(35866,0,f,c.width,c.height,c.depth,0,d,p,c.data),t.__maxMipLevel=0;else if(n.isDataTexture3D)r.texImage3D(32879,0,f,c.width,c.height,c.depth,0,d,p,c.data),t.__maxMipLevel=0;else if(A.length>0&&u){for(w=0,_=A.length;w<_;w++)m=A[w],r.texImage2D(3553,w,f,d,p,m);n.generateMipmaps=!1,t.__maxMipLevel=A.length-1}else r.texImage2D(3553,0,f,d,p,c),t.__maxMipLevel=0;y(n,u)&&x(o,n,c.width,c.height),t.__version=n.version,n.onUpdate&&n.onUpdate(n)}function I(t,i,o,s){var l=a.convert(i.texture.format),c=a.convert(i.texture.type),u=b(i.texture.internalFormat,l,c);r.texImage2D(s,0,u,i.width,i.height,0,l,c,null),e.bindFramebuffer(36160,t),e.framebufferTexture2D(36160,o,s,n.get(i.texture).__webglTexture,0),e.bindFramebuffer(36160,null)}function O(t,r,n){if(e.bindRenderbuffer(36161,t),r.depthBuffer&&!r.stencilBuffer){if(n){var i=F(r);e.renderbufferStorageMultisample(36161,i,33189,r.width,r.height)}else e.renderbufferStorage(36161,33189,r.width,r.height);e.framebufferRenderbuffer(36160,36096,36161,t)}else if(r.depthBuffer&&r.stencilBuffer){if(n){i=F(r);e.renderbufferStorageMultisample(36161,i,35056,r.width,r.height)}else e.renderbufferStorage(36161,34041,r.width,r.height);e.framebufferRenderbuffer(36160,33306,36161,t)}else{var o=a.convert(r.texture.format),s=a.convert(r.texture.type),l=b(r.texture.internalFormat,o,s);if(n){i=F(r);e.renderbufferStorageMultisample(36161,i,l,r.width,r.height)}else e.renderbufferStorage(36161,l,r.width,r.height)}e.bindRenderbuffer(36161,null)}function B(t){var r=n.get(t),i=!0===t.isWebGLRenderTargetCube;if(t.depthTexture){if(i)throw new Error("target.depthTexture not supported in Cube render targets");!function(t,r){if(r&&r.isWebGLRenderTargetCube)throw new Error("Depth Texture with cube render targets is not supported");if(e.bindFramebuffer(36160,t),!r.depthTexture||!r.depthTexture.isDepthTexture)throw new Error("renderTarget.depthTexture must be an instance of THREE.DepthTexture");n.get(r.depthTexture).__webglTexture&&r.depthTexture.image.width===r.width&&r.depthTexture.image.height===r.height||(r.depthTexture.image.width=r.width,r.depthTexture.image.height=r.height,r.depthTexture.needsUpdate=!0),S(r.depthTexture,0);var i=n.get(r.depthTexture).__webglTexture;if(r.depthTexture.format===Ye)e.framebufferTexture2D(36160,36096,3553,i,0);else{if(r.depthTexture.format!==Qe)throw new Error("Unknown depthTexture format");e.framebufferTexture2D(36160,33306,3553,i,0)}}(r.__webglFramebuffer,t)}else if(i){r.__webglDepthbuffer=[];for(var a=0;a<6;a++)e.bindFramebuffer(36160,r.__webglFramebuffer[a]),r.__webglDepthbuffer[a]=e.createRenderbuffer(),O(r.__webglDepthbuffer[a],t)}else e.bindFramebuffer(36160,r.__webglFramebuffer),r.__webglDepthbuffer=e.createRenderbuffer(),O(r.__webglDepthbuffer,t);e.bindFramebuffer(36160,null)}function F(e){return l&&e.isWebGLMultisampleRenderTarget?Math.min(d,e.samples):0}var U=!1,N=!1;this.allocateTextureUnit=function(){var e=M;return e>=c&&console.warn("THREE.WebGLTextures: Trying to use "+e+" texture units while this GPU supports only "+c),M+=1,e},this.resetTextureUnits=function(){M=0},this.setTexture2D=S,this.setTexture2DArray=function(e,t){var i=n.get(e);e.version>0&&i.__version!==e.version?D(i,e,t):(r.activeTexture(33984+t),r.bindTexture(35866,i.__webglTexture))},this.setTexture3D=function(e,t){var i=n.get(e);e.version>0&&i.__version!==e.version?D(i,e,t):(r.activeTexture(33984+t),r.bindTexture(32879,i.__webglTexture))},this.setTextureCube=E,this.setTextureCubeDynamic=T,this.setupRenderTarget=function(i){var s=n.get(i),c=n.get(i.texture);i.addEventListener("dispose",_),c.__webglTexture=e.createTexture(),o.memory.textures++;var u=!0===i.isWebGLRenderTargetCube,h=!0===i.isWebGLMultisampleRenderTarget,d=!0===i.isWebGLMultiviewRenderTarget,p=g(i)||l;if(u){s.__webglFramebuffer=[];for(var f=0;f<6;f++)s.__webglFramebuffer[f]=e.createFramebuffer()}else if(s.__webglFramebuffer=e.createFramebuffer(),h)if(l){s.__webglMultisampledFramebuffer=e.createFramebuffer(),s.__webglColorRenderbuffer=e.createRenderbuffer(),e.bindRenderbuffer(36161,s.__webglColorRenderbuffer);var m=a.convert(i.texture.format),v=a.convert(i.texture.type),A=b(i.texture.internalFormat,m,v),w=F(i);e.renderbufferStorageMultisample(36161,w,A,i.width,i.height),e.bindFramebuffer(36160,s.__webglMultisampledFramebuffer),e.framebufferRenderbuffer(36160,36064,36161,s.__webglColorRenderbuffer),e.bindRenderbuffer(36161,null),i.depthBuffer&&(s.__webglDepthRenderbuffer=e.createRenderbuffer(),O(s.__webglDepthRenderbuffer,i,!0)),e.bindFramebuffer(36160,null)}else console.warn("THREE.WebGLRenderer: WebGLMultisampleRenderTarget can only be used with WebGL2.");else if(d){var M=i.width,S=i.height,E=i.numViews;e.bindFramebuffer(36160,s.__webglFramebuffer);var T=t.get("OVR_multiview2");o.memory.textures+=2;var R=e.createTexture();e.bindTexture(35866,R),e.texParameteri(35866,10240,9728),e.texParameteri(35866,10241,9728),e.texImage3D(35866,0,32856,M,S,E,0,6408,5121,null),T.framebufferTextureMultiviewOVR(36160,36064,R,0,0,E);var L=e.createTexture();e.bindTexture(35866,L),e.texParameteri(35866,10240,9728),e.texParameteri(35866,10241,9728),e.texImage3D(35866,0,35056,M,S,E,0,34041,34042,null),T.framebufferTextureMultiviewOVR(36160,33306,L,0,0,E);var P=new Array(E);for(f=0;f<E;++f)P[f]=e.createFramebuffer(),e.bindFramebuffer(36160,P[f]),e.framebufferTextureLayer(36160,36064,R,0,f);s.__webglColorTexture=R,s.__webglDepthStencilTexture=L,s.__webglViewFramebuffers=P,e.bindFramebuffer(36160,null),e.bindTexture(35866,null)}if(u){r.bindTexture(34067,c.__webglTexture),C(34067,i.texture,p);for(f=0;f<6;f++)I(s.__webglFramebuffer[f],i,36064,34069+f);y(i.texture,p)&&x(34067,i.texture,i.width,i.height),r.bindTexture(34067,null)}else d||(r.bindTexture(3553,c.__webglTexture),C(3553,i.texture,p),I(s.__webglFramebuffer,i,36064,3553),y(i.texture,p)&&x(3553,i.texture,i.width,i.height),r.bindTexture(3553,null));i.depthBuffer&&B(i)},this.updateRenderTargetMipmap=function(e){var t=e.texture;if(y(t,g(e)||l)){var i=e.isWebGLRenderTargetCube?34067:3553,a=n.get(t).__webglTexture;r.bindTexture(i,a),x(i,t,e.width,e.height),r.bindTexture(i,null)}},this.updateMultisampleRenderTarget=function(t){if(t.isWebGLMultisampleRenderTarget)if(l){var r=n.get(t);e.bindFramebuffer(36008,r.__webglMultisampledFramebuffer),e.bindFramebuffer(36009,r.__webglFramebuffer);var i=t.width,a=t.height,o=16384;t.depthBuffer&&(o|=256),t.stencilBuffer&&(o|=1024),e.blitFramebuffer(0,0,i,a,0,0,i,a,o,9728)}else console.warn("THREE.WebGLRenderer: WebGLMultisampleRenderTarget can only be used with WebGL2.")},this.safeSetTexture2D=function(e,t){e&&e.isWebGLRenderTarget&&(!1===U&&(console.warn("THREE.WebGLTextures.safeSetTexture2D: don't use render targets as textures. Use their .texture property instead."),U=!0),e=e.texture),S(e,t)},this.safeSetTextureCube=function(e,t){e&&e.isWebGLRenderTargetCube&&(!1===N&&(console.warn("THREE.WebGLTextures.safeSetTextureCube: don't use cube render targets as textures. Use their .texture property instead."),N=!0),e=e.texture),e&&e.isCubeTexture||Array.isArray(e.image)&&6===e.image.length?E(e,t):T(e,t)}}function gs(e,t,r){var n=r.isWebGL2;return{convert:function(e){var r;if(e===Ce)return 5121;if(e===Ne)return 32819;if(e===Ge)return 32820;if(e===ze)return 33635;if(e===Pe)return 5120;if(e===De)return 5122;if(e===Ie)return 5123;if(e===Oe)return 5124;if(e===Be)return 5125;if(e===Fe)return 5126;if(e===Ue)return n?5131:null!==(r=t.get("OES_texture_half_float"))?r.HALF_FLOAT_OES:null;if(e===He)return 6406;if(e===Ve)return 6407;if(e===je)return 6408;if(e===We)return 6409;if(e===qe)return 6410;if(e===Ye)return 6402;if(e===Qe)return 34041;if(e===Ze)return 6403;if(e===Je)return 36244;if(e===Ke)return 33319;if(e===$e)return 33320;if(e===et)return 36248;if(e===tt)return 36249;if(e===rt||e===nt||e===it||e===at){if(null===(r=t.get("WEBGL_compressed_texture_s3tc")))return null;if(e===rt)return r.COMPRESSED_RGB_S3TC_DXT1_EXT;if(e===nt)return r.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(e===it)return r.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(e===at)return r.COMPRESSED_RGBA_S3TC_DXT5_EXT}if(e===ot||e===st||e===lt||e===ct){if(null===(r=t.get("WEBGL_compressed_texture_pvrtc")))return null;if(e===ot)return r.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(e===st)return r.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(e===lt)return r.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(e===ct)return r.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}return e===ut?null!==(r=t.get("WEBGL_compressed_texture_etc1"))?r.COMPRESSED_RGB_ETC1_WEBGL:null:e===ht||e===dt||e===pt||e===ft||e===mt||e===vt||e===gt||e===yt||e===xt||e===bt||e===At||e===wt||e===_t||e===Mt?null!==(r=t.get("WEBGL_compressed_texture_astc"))?e:null:e===ke?n?34042:null!==(r=t.get("WEBGL_depth_texture"))?r.UNSIGNED_INT_24_8_WEBGL:null:void 0}}}function ys(e,t,r,n){Fr.call(this,e,t,n),this.depthBuffer=!1,this.stencilBuffer=!1,this.numViews=r}function xs(e,t){var r,n,i,a,o,s,l,c=2,u=e.extensions,h=e.properties,d=0;function p(e){return e.isArrayCamera?e.cameras:(o[0]=e,o)}this.isAvailable=function(){if(void 0===l){var e=u.get("OVR_multiview2");if(l=null!==e&&!1===t.getContextAttributes().antialias){d=t.getParameter(e.MAX_VIEWS_OVR),r=new ys(0,0,c),s=new Mr,a=[],i=[],o=[];for(var n=0;n<d;n++)a[n]=new Wr,i[n]=new Pr}}return l},this.attachCamera=function(t){!1!==function(e){if(void 0===e.isArrayCamera)return!0;var t=e.cameras;if(t.length>d)return!1;for(var r=1,n=t.length;r<n;r++)if(t[0].viewport.z!==t[r].viewport.z||t[0].viewport.w!==t[r].viewport.w)return!1;return!0}(t)&&(n=e.getRenderTarget(),function(t){if(n?s.set(n.width,n.height):e.getDrawingBufferSize(s),t.isArrayCamera){var i=t.cameras[0].viewport;r.setSize(i.z,i.w),r.setNumViews(t.cameras.length)}else r.setSize(s.x,s.y),r.setNumViews(c)}(t),e.setRenderTarget(r))},this.detachCamera=function(i){r===e.getRenderTarget()&&(e.setRenderTarget(n),function(e){var n=r,i=n.numViews,a=h.get(n).__webglViewFramebuffers,o=n.width,l=n.height;if(e.isArrayCamera)for(var c=0;c<i;c++){var u=e.cameras[c].viewport,d=u.x,p=u.y,f=d+u.z,m=p+u.w;t.bindFramebuffer(36008,a[c]),t.blitFramebuffer(0,0,o,l,d,p,f,m,16384,9728)}else t.bindFramebuffer(36008,a[0]),t.blitFramebuffer(0,0,o,l,0,0,s.x,s.y,16384,9728)}(i))},this.updateCameraProjectionMatricesUniform=function(e,r){for(var n=p(e),i=0;i<n.length;i++)a[i].copy(n[i].projectionMatrix);r.setValue(t,"projectionMatrices",a)},this.updateCameraViewMatricesUniform=function(e,r){for(var n=p(e),i=0;i<n.length;i++)a[i].copy(n[i].matrixWorldInverse);r.setValue(t,"viewMatrices",a)},this.updateObjectMatricesUniforms=function(e,r,n){for(var o=p(r),s=0;s<o.length;s++)a[s].multiplyMatrices(o[s].matrixWorldInverse,e.matrixWorld),i[s].getNormalMatrix(a[s]);n.setValue(t,"modelViewMatrices",a),n.setValue(t,"normalMatrices",i)}}function bs(e){ua.call(this),this.cameras=e||[]}function As(){un.call(this),this.type="Group"}function ws(e,t){var r=this,n=null,i=null,a="local-floor",o=null,s=[],l=new Map,c=new ua;c.layers.enable(1),c.viewport=new Br;var u=new ua;u.layers.enable(2),u.viewport=new Br;var h=new bs([c,u]);function d(e){var t=l.get(e.inputSource);t&&t.dispatchEvent({type:e.type})}function p(){l.forEach((function(e,t){e.dispatchEvent({type:"disconnected",data:t}),e.visible=!1})),l.clear(),e.setFramebuffer(null),e.setRenderTarget(e.getRenderTarget()),b.stop(),r.dispatchEvent({type:"sessionend"}),r.isPresenting=!1}function f(e){i=e,b.setContext(n),b.start(),r.dispatchEvent({type:"sessionstart"}),r.isPresenting=!0}function m(e){for(var t=n.inputSources,r=0;r<s.length;r++)l.set(t[r],s[r]);for(r=0;r<e.removed.length;r++){var i=e.removed[r];(a=l.get(i))&&(a.dispatchEvent({type:"disconnected",data:i}),l.delete(i))}for(r=0;r<e.added.length;r++){var a;i=e.added[r];(a=l.get(i))&&a.dispatchEvent({type:"connected",data:i})}}h.layers.enable(1),h.layers.enable(2),this.enabled=!1,this.isPresenting=!1,this.getController=function(e){var t=s[e];return void 0===t&&((t=new As).matrixAutoUpdate=!1,t.visible=!1,s[e]=t),t},this.setFramebufferScaleFactor=function(){},this.setReferenceSpaceType=function(e){a=e},this.getReferenceSpace=function(){return i},this.getSession=function(){return n},this.setSession=function(e){if(null!==(n=e)){n.addEventListener("select",d),n.addEventListener("selectstart",d),n.addEventListener("selectend",d),n.addEventListener("squeeze",d),n.addEventListener("squeezestart",d),n.addEventListener("squeezeend",d),n.addEventListener("end",p);var r=t.getContextAttributes(),i={antialias:r.antialias,alpha:r.alpha,depth:r.depth,stencil:r.stencil},o=new XRWebGLLayer(n,t,i);n.updateRenderState({baseLayer:o}),n.requestReferenceSpace(a).then(f),n.addEventListener("inputsourceschange",m)}};var v=new Rr,g=new Rr;function y(e,t){null===t?e.matrixWorld.copy(e.matrix):e.matrixWorld.multiplyMatrices(t.matrixWorld,e.matrix),e.matrixWorldInverse.getInverse(e.matrixWorld)}this.getCamera=function(e){var t=e.parent,r=h.cameras;y(h,t);for(var n=0;n<r.length;n++)y(r[n],t);e.matrixWorld.copy(h.matrixWorld);for(var i=e.children,a=(n=0,i.length);n<a;n++)i[n].updateMatrixWorld(!0);return function(e,t,r){v.setFromMatrixPosition(t.matrixWorld),g.setFromMatrixPosition(r.matrixWorld);var n=v.distanceTo(g),i=t.projectionMatrix.elements,a=r.projectionMatrix.elements,o=i[14]/(i[10]-1),s=i[14]/(i[10]+1),l=(i[9]+1)/i[5],c=(i[9]-1)/i[5],u=(i[8]-1)/i[0],h=(a[8]+1)/a[0],d=o*u,p=o*h,f=n/(-u+h),m=f*-u;t.matrixWorld.decompose(e.position,e.quaternion,e.scale),e.translateX(m),e.translateZ(f),e.matrixWorld.compose(e.position,e.quaternion,e.scale),e.matrixWorldInverse.getInverse(e.matrixWorld);var y=o+f,x=s+f,b=d-m,A=p+(n-m),w=l*s/x*y,_=c*s/x*y;e.projectionMatrix.makePerspective(b,A,w,_,y,x)}(h,c,u),h};var x=null;var b=new wa;b.setAnimationLoop((function(t,r){if(null!==(o=r.getViewerPose(i))){var a=o.views,l=n.renderState.baseLayer;e.setFramebuffer(l.framebuffer);for(var c=0;c<a.length;c++){var u=a[c],d=l.getViewport(u),p=u.transform.inverse.matrix,f=h.cameras[c];f.matrix.fromArray(p).getInverse(f.matrix),f.projectionMatrix.fromArray(u.projectionMatrix),f.viewport.set(d.x,d.y,d.width,d.height),0===c&&h.matrix.copy(f.matrix)}}var m=n.inputSources;for(c=0;c<s.length;c++){var v=s[c],g=m[c];if(g){var y=r.getPose(g.targetRaySpace,i);if(null!==y){v.matrix.fromArray(y.transform.matrix),v.matrix.decompose(v.position,v.rotation,v.scale),v.visible=!0;continue}}v.visible=!1}x&&x(t,r)})),this.setAnimationLoop=function(e){x=e},this.dispose=function(){}}function _s(e){var t=void 0!==(e=e||{}).canvas?e.canvas:document.createElementNS("http://www.w3.org/1999/xhtml","canvas"),r=void 0!==e.context?e.context:null,n=void 0!==e.alpha&&e.alpha,i=void 0===e.depth||e.depth,a=void 0===e.stencil||e.stencil,o=void 0!==e.antialias&&e.antialias,s=void 0===e.premultipliedAlpha||e.premultipliedAlpha,l=void 0!==e.preserveDrawingBuffer&&e.preserveDrawingBuffer,c=void 0!==e.powerPreference?e.powerPreference:"default",u=void 0!==e.failIfMajorPerformanceCaveat&&e.failIfMajorPerformanceCaveat,h=null,d=null;this.domElement=t,this.debug={checkShaderErrors:!0},this.autoClear=!0,this.autoClearColor=!0,this.autoClearDepth=!0,this.autoClearStencil=!0,this.sortObjects=!0,this.clippingPlanes=[],this.localClippingEnabled=!1,this.gammaFactor=2,this.outputEncoding=Ut,this.physicallyCorrectLights=!1,this.toneMapping=ie,this.toneMappingExposure=1,this.toneMappingWhitePoint=1,this.maxMorphTargets=8,this.maxMorphNormals=4;var p,f,m,v,y,x,b,A,w,_,M,S,E,T,R,L,C,P,D=this,I=!1,O=null,B=0,F=0,U=null,N=null,G=-1,z={geometry:null,program:null,wireframe:!1},k=null,H=null,V=new Br,j=new Br,W=null,q=t.width,X=t.height,Y=1,Q=null,Z=null,J=new Br(0,0,q,X),K=new Br(0,0,q,X),$=!1,ee=new ya,te=new La,re=!1,ne=!1,ae=new Wr,oe=new Rr;function se(){return null===U?Y:1}try{var le={alpha:n,depth:i,stencil:a,antialias:o,premultipliedAlpha:s,preserveDrawingBuffer:l,powerPreference:c,failIfMajorPerformanceCaveat:u,xrCompatible:!0};if(t.addEventListener("webglcontextlost",pe,!1),t.addEventListener("webglcontextrestored",fe,!1),null===(p=r||t.getContext("webgl",le)||t.getContext("experimental-webgl",le)))throw null!==t.getContext("webgl")?new Error("Error creating WebGL context with your selected attributes."):new Error("Error creating WebGL context.");void 0===p.getShaderPrecisionFormat&&(p.getShaderPrecisionFormat=function(){return{rangeMin:1,rangeMax:1,precision:1}})}catch(e){throw console.error("THREE.WebGLRenderer: "+e.message),e}function ce(){f=new Ca(p),!1===(m=new Ra(p,f,e)).isWebGL2&&(f.get("WEBGL_depth_texture"),f.get("OES_texture_float"),f.get("OES_texture_half_float"),f.get("OES_texture_half_float_linear"),f.get("OES_standard_derivatives"),f.get("OES_element_index_uint"),f.get("ANGLE_instanced_arrays")),f.get("OES_texture_float_linear"),P=new gs(p,f,m),(v=new ms(p,f,m)).scissor(j.copy(K).multiplyScalar(Y).floor()),v.viewport(V.copy(J).multiplyScalar(Y).floor()),y=new Ia(p),x=new $o,b=new vs(p,f,v,x,m,P,y),A=new _a(p),w=new Pa(p,A,y),_=new Fa(p,w,A,y),R=new Ba(p),M=new Ko(D,f,m),S=new ns,E=new cs,T=new Ea(D,v,_,s),L=new Ta(p,f,y,m),C=new Da(p,f,y,m),y.programs=M.programs,D.capabilities=m,D.extensions=f,D.properties=x,D.renderLists=S,D.state=v,D.info=y}ce();var ue=new ws(D,p);this.xr=ue;var he=new xs(D,p),de=new fs(D,_,m.maxTextureSize);function pe(e){e.preventDefault(),console.log("THREE.WebGLRenderer: Context Lost."),I=!0}function fe(){console.log("THREE.WebGLRenderer: Context Restored."),I=!1,ce()}function me(e){var t=e.target;t.removeEventListener("dispose",me),function(e){ve(e),x.remove(e)}(t)}function ve(e){var t=x.get(e).program;e.program=void 0,void 0!==t&&M.releaseProgram(t)}this.shadowMap=de,this.getContext=function(){return p},this.getContextAttributes=function(){return p.getContextAttributes()},this.forceContextLoss=function(){var e=f.get("WEBGL_lose_context");e&&e.loseContext()},this.forceContextRestore=function(){var e=f.get("WEBGL_lose_context");e&&e.restoreContext()},this.getPixelRatio=function(){return Y},this.setPixelRatio=function(e){void 0!==e&&(Y=e,this.setSize(q,X,!1))},this.getSize=function(e){return void 0===e&&(console.warn("WebGLRenderer: .getsize() now requires a Vector2 as an argument"),e=new Mr),e.set(q,X)},this.setSize=function(e,r,n){ue.isPresenting?console.warn("THREE.WebGLRenderer: Can't change size while VR device is presenting."):(q=e,X=r,t.width=Math.floor(e*Y),t.height=Math.floor(r*Y),!1!==n&&(t.style.width=e+"px",t.style.height=r+"px"),this.setViewport(0,0,e,r))},this.getDrawingBufferSize=function(e){return void 0===e&&(console.warn("WebGLRenderer: .getdrawingBufferSize() now requires a Vector2 as an argument"),e=new Mr),e.set(q*Y,X*Y).floor()},this.setDrawingBufferSize=function(e,r,n){q=e,X=r,Y=n,t.width=Math.floor(e*n),t.height=Math.floor(r*n),this.setViewport(0,0,e,r)},this.getCurrentViewport=function(e){return void 0===e&&(console.warn("WebGLRenderer: .getCurrentViewport() now requires a Vector4 as an argument"),e=new Br),e.copy(V)},this.getViewport=function(e){return e.copy(J)},this.setViewport=function(e,t,r,n){e.isVector4?J.set(e.x,e.y,e.z,e.w):J.set(e,t,r,n),v.viewport(V.copy(J).multiplyScalar(Y).floor())},this.getScissor=function(e){return e.copy(K)},this.setScissor=function(e,t,r,n){e.isVector4?K.set(e.x,e.y,e.z,e.w):K.set(e,t,r,n),v.scissor(j.copy(K).multiplyScalar(Y).floor())},this.getScissorTest=function(){return $},this.setScissorTest=function(e){v.setScissorTest($=e)},this.setOpaqueSort=function(e){Q=e},this.setTransparentSort=function(e){Z=e},this.getClearColor=function(){return T.getClearColor()},this.setClearColor=function(){T.setClearColor.apply(T,arguments)},this.getClearAlpha=function(){return T.getClearAlpha()},this.setClearAlpha=function(){T.setClearAlpha.apply(T,arguments)},this.clear=function(e,t,r){var n=0;(void 0===e||e)&&(n|=16384),(void 0===t||t)&&(n|=256),(void 0===r||r)&&(n|=1024),p.clear(n)},this.clearColor=function(){this.clear(!0,!1,!1)},this.clearDepth=function(){this.clear(!1,!0,!1)},this.clearStencil=function(){this.clear(!1,!1,!0)},this.dispose=function(){t.removeEventListener("webglcontextlost",pe,!1),t.removeEventListener("webglcontextrestored",fe,!1),S.dispose(),E.dispose(),x.dispose(),_.dispose(),ue.dispose(),xe.stop()},this.renderBufferImmediate=function(e,t){v.initAttributes();var r=x.get(e);e.hasPositions&&!r.position&&(r.position=p.createBuffer()),e.hasNormals&&!r.normal&&(r.normal=p.createBuffer()),e.hasUvs&&!r.uv&&(r.uv=p.createBuffer()),e.hasColors&&!r.color&&(r.color=p.createBuffer());var n=t.getAttributes();e.hasPositions&&(p.bindBuffer(34962,r.position),p.bufferData(34962,e.positionArray,35048),v.enableAttribute(n.position),p.vertexAttribPointer(n.position,3,5126,!1,0,0)),e.hasNormals&&(p.bindBuffer(34962,r.normal),p.bufferData(34962,e.normalArray,35048),v.enableAttribute(n.normal),p.vertexAttribPointer(n.normal,3,5126,!1,0,0)),e.hasUvs&&(p.bindBuffer(34962,r.uv),p.bufferData(34962,e.uvArray,35048),v.enableAttribute(n.uv),p.vertexAttribPointer(n.uv,2,5126,!1,0,0)),e.hasColors&&(p.bindBuffer(34962,r.color),p.bufferData(34962,e.colorArray,35048),v.enableAttribute(n.color),p.vertexAttribPointer(n.color,3,5126,!1,0,0)),v.disableUnusedAttributes(),p.drawArrays(4,0,e.count),e.count=0};var ge=new hn;this.renderBufferDirect=function(e,t,r,n,i,a){null===t&&(t=ge);var o=i.isMesh&&i.matrixWorld.determinant()<0,s=Me(e,t,n,i);v.setMaterial(n,o);var l=!1;z.geometry===r.id&&z.program===s.id&&z.wireframe===(!0===n.wireframe)||(z.geometry=r.id,z.program=s.id,z.wireframe=!0===n.wireframe,l=!0),(n.morphTargets||n.morphNormals)&&(R.update(i,r,n,s),l=!0);var c=r.index,u=r.attributes.position;if(null===c){if(void 0===u||0===u.count)return}else if(0===c.count)return;var h,d=1;!0===n.wireframe&&(c=w.getWireframeAttribute(r),d=2);var g=L;null!==c&&(h=A.get(c),(g=C).setIndex(h)),l&&(!function(e,t,r,n){if(!1===m.isWebGL2&&(e.isInstancedMesh||t.isInstancedBufferGeometry)&&null===f.get("ANGLE_instanced_arrays"))return;v.initAttributes();var i=t.attributes,a=n.getAttributes(),o=r.defaultAttributeValues;for(var s in a){var l=a[s];if(l>=0){var c=i[s];if(void 0!==c){var u=c.normalized,h=c.itemSize;if(void 0===(_=A.get(c)))continue;var d=_.buffer,g=_.type,y=_.bytesPerElement;if(c.isInterleavedBufferAttribute){var x=c.data,b=x.stride,w=c.offset;x&&x.isInstancedInterleavedBuffer?(v.enableAttributeAndDivisor(l,x.meshPerAttribute),void 0===t.maxInstancedCount&&(t.maxInstancedCount=x.meshPerAttribute*x.count)):v.enableAttribute(l),p.bindBuffer(34962,d),p.vertexAttribPointer(l,h,g,u,b*y,w*y)}else c.isInstancedBufferAttribute?(v.enableAttributeAndDivisor(l,c.meshPerAttribute),void 0===t.maxInstancedCount&&(t.maxInstancedCount=c.meshPerAttribute*c.count)):v.enableAttribute(l),p.bindBuffer(34962,d),p.vertexAttribPointer(l,h,g,u,0,0)}else if("instanceMatrix"===s){var _;if(void 0===(_=A.get(e.instanceMatrix)))continue;d=_.buffer,g=_.type;v.enableAttributeAndDivisor(l+0,1),v.enableAttributeAndDivisor(l+1,1),v.enableAttributeAndDivisor(l+2,1),v.enableAttributeAndDivisor(l+3,1),p.bindBuffer(34962,d),p.vertexAttribPointer(l+0,4,g,!1,64,0),p.vertexAttribPointer(l+1,4,g,!1,64,16),p.vertexAttribPointer(l+2,4,g,!1,64,32),p.vertexAttribPointer(l+3,4,g,!1,64,48)}else if(void 0!==o){var M=o[s];if(void 0!==M)switch(M.length){case 2:p.vertexAttrib2fv(l,M);break;case 3:p.vertexAttrib3fv(l,M);break;case 4:p.vertexAttrib4fv(l,M);break;default:p.vertexAttrib1fv(l,M)}}}}v.disableUnusedAttributes()}(i,r,n,s),null!==c&&p.bindBuffer(34963,h.buffer));var y=null!==c?c.count:u.count,x=r.drawRange.start*d,b=r.drawRange.count*d,_=null!==a?a.start*d:0,M=null!==a?a.count*d:1/0,S=Math.max(x,_),E=Math.min(y,x+b,_+M)-1,T=Math.max(0,E-S+1);if(0!==T){if(i.isMesh)!0===n.wireframe?(v.setLineWidth(n.wireframeLinewidth*se()),g.setMode(1)):g.setMode(4);else if(i.isLine){var P=n.linewidth;void 0===P&&(P=1),v.setLineWidth(P*se()),i.isLineSegments?g.setMode(1):i.isLineLoop?g.setMode(2):g.setMode(3)}else i.isPoints?g.setMode(0):i.isSprite&&g.setMode(4);i.isInstancedMesh?g.renderInstances(r,S,T,i.count):r.isInstancedBufferGeometry?g.renderInstances(r,S,T,r.maxInstancedCount):g.render(S,T)}},this.compile=function(e,t){(d=E.get(e,t)).init(),e.traverse((function(e){e.isLight&&(d.pushLight(e),e.castShadow&&d.pushShadow(e))})),d.setupLights(t),e.traverse((function(t){if(t.material)if(Array.isArray(t.material))for(var r=0;r<t.material.length;r++)_e(t.material[r],e,t);else _e(t.material,e,t)}))};var ye=null;var xe=new wa;function be(e,t,r,n){if(!1!==e.visible){if(e.layers.test(t.layers))if(e.isGroup)r=e.renderOrder;else if(e.isLOD)!0===e.autoUpdate&&e.update(t);else if(e.isLight)d.pushLight(e),e.castShadow&&d.pushShadow(e);else if(e.isSprite){if(!e.frustumCulled||ee.intersectsSprite(e)){n&&oe.setFromMatrixPosition(e.matrixWorld).applyMatrix4(ae);var i=_.update(e);(a=e.material).visible&&h.push(e,i,a,r,oe.z,null)}}else if(e.isImmediateRenderObject)n&&oe.setFromMatrixPosition(e.matrixWorld).applyMatrix4(ae),h.push(e,null,e.material,r,oe.z,null);else if((e.isMesh||e.isLine||e.isPoints)&&(e.isSkinnedMesh&&e.skeleton.frame!==y.render.frame&&(e.skeleton.update(),e.skeleton.frame=y.render.frame),!e.frustumCulled||ee.intersectsObject(e))){n&&oe.setFromMatrixPosition(e.matrixWorld).applyMatrix4(ae);i=_.update(e);var a=e.material;if(Array.isArray(a))for(var o=i.groups,s=0,l=o.length;s<l;s++){var c=o[s],u=a[c.materialIndex];u&&u.visible&&h.push(e,i,u,r,oe.z,c)}else a.visible&&h.push(e,i,a,r,oe.z,null)}var p=e.children;for(s=0,l=p.length;s<l;s++)be(p[s],t,r,n)}}function Ae(e,t,r,n){for(var i=0,a=e.length;i<a;i++){var o=e[i],s=o.object,l=o.geometry,c=void 0===n?o.material:n,u=o.group;if(r.isArrayCamera)if(H=r,ue.enabled&&he.isAvailable())we(s,t,r,l,c,u);else for(var h=r.cameras,p=0,f=h.length;p<f;p++){var m=h[p];s.layers.test(m.layers)&&(v.viewport(V.copy(m.viewport)),d.setupLights(m),we(s,t,m,l,c,u))}else H=null,we(s,t,r,l,c,u)}}function we(e,t,r,n,i,a){if(e.onBeforeRender(D,t,r,n,i,a),d=E.get(t,H||r),e.modelViewMatrix.multiplyMatrices(r.matrixWorldInverse,e.matrixWorld),e.normalMatrix.getNormalMatrix(e.modelViewMatrix),e.isImmediateRenderObject){var o=Me(r,t,i,e);v.setMaterial(i),z.geometry=null,z.program=null,z.wireframe=!1,function(e,t){e.render((function(e){D.renderBufferImmediate(e,t)}))}(e,o)}else D.renderBufferDirect(r,t,n,i,e,a);e.onAfterRender(D,t,r,n,i,a),d=E.get(t,H||r)}function _e(e,t,r){var n=x.get(e),i=d.state.lights,a=d.state.shadowsArray,o=i.state.version,s=M.getParameters(e,i.state,a,t,te.numPlanes,te.numIntersection,r),l=M.getProgramCacheKey(e,s),c=n.program,u=!0;if(void 0===c)e.addEventListener("dispose",me);else if(c.cacheKey!==l)ve(e);else if(n.lightsStateVersion!==o)n.lightsStateVersion=o,u=!1;else{if(void 0!==s.shaderID)return;u=!1}if(u){if(s.shaderID){var h=Aa[s.shaderID];n.shader={name:e.type,uniforms:na(h.uniforms),vertexShader:h.vertexShader,fragmentShader:h.fragmentShader}}else n.shader={name:e.type,uniforms:e.uniforms,vertexShader:e.vertexShader,fragmentShader:e.fragmentShader};e.onBeforeCompile(n.shader,D),l=M.getProgramCacheKey(e,s),c=M.acquireProgram(e,n.shader,s,l),n.program=c,n.environment=e.isMeshStandardMaterial?t.environment:null,n.outputEncoding=D.outputEncoding,e.program=c}var p=c.getAttributes();if(e.morphTargets){e.numSupportedMorphTargets=0;for(var f=0;f<D.maxMorphTargets;f++)p["morphTarget"+f]>=0&&e.numSupportedMorphTargets++}if(e.morphNormals){e.numSupportedMorphNormals=0;for(f=0;f<D.maxMorphNormals;f++)p["morphNormal"+f]>=0&&e.numSupportedMorphNormals++}var m=n.shader.uniforms;(e.isShaderMaterial||e.isRawShaderMaterial)&&!0!==e.clipping||(n.numClippingPlanes=te.numPlanes,n.numIntersection=te.numIntersection,m.clippingPlanes=te.uniform),n.fog=t.fog,n.needsLights=function(e){return e.isMeshLambertMaterial||e.isMeshToonMaterial||e.isMeshPhongMaterial||e.isMeshStandardMaterial||e.isShadowMaterial||e.isShaderMaterial&&!0===e.lights}(e),n.lightsStateVersion=o,n.needsLights&&(m.ambientLightColor.value=i.state.ambient,m.lightProbe.value=i.state.probe,m.directionalLights.value=i.state.directional,m.spotLights.value=i.state.spot,m.rectAreaLights.value=i.state.rectArea,m.pointLights.value=i.state.point,m.hemisphereLights.value=i.state.hemi,m.directionalShadowMap.value=i.state.directionalShadowMap,m.directionalShadowMatrix.value=i.state.directionalShadowMatrix,m.spotShadowMap.value=i.state.spotShadowMap,m.spotShadowMatrix.value=i.state.spotShadowMatrix,m.pointShadowMap.value=i.state.pointShadowMap,m.pointShadowMatrix.value=i.state.pointShadowMatrix);var v=n.program.getUniforms(),g=Oo.seqWithValue(v.seq,m);n.uniformsList=g}function Me(e,t,r,n){b.resetTextureUnits();var i=t.fog,a=r.isMeshStandardMaterial?t.environment:null,o=x.get(r),s=d.state.lights;if(re&&(ne||e!==k)){var l=e===k&&r.id===G;te.setState(r.clippingPlanes,r.clipIntersection,r.clipShadows,e,o,l)}r.version===o.__version&&(void 0===o.program?r.needsUpdate=!0:r.fog&&o.fog!==i?r.needsUpdate=!0:o.environment!==a?r.needsUpdate=!0:o.needsLights&&o.lightsStateVersion!==s.state.version?r.needsUpdate=!0:void 0===o.numClippingPlanes||o.numClippingPlanes===te.numPlanes&&o.numIntersection===te.numIntersection?o.outputEncoding!==D.outputEncoding&&(r.needsUpdate=!0):r.needsUpdate=!0),r.version!==o.__version&&(_e(r,t,n),o.__version=r.version);var c,u,h=!1,f=!1,y=!1,A=o.program,w=A.getUniforms(),_=o.shader.uniforms;if(v.useProgram(A.program)&&(h=!0,f=!0,y=!0),r.id!==G&&(G=r.id,f=!0),h||k!==e){if(A.numMultiviewViews>0?he.updateCameraProjectionMatricesUniform(e,w):w.setValue(p,"projectionMatrix",e.projectionMatrix),m.logarithmicDepthBuffer&&w.setValue(p,"logDepthBufFC",2/(Math.log(e.far+1)/Math.LN2)),k!==e&&(k=e,f=!0,y=!0),r.isShaderMaterial||r.isMeshPhongMaterial||r.isMeshToonMaterial||r.isMeshStandardMaterial||r.envMap){var M=w.map.cameraPosition;void 0!==M&&M.setValue(p,oe.setFromMatrixPosition(e.matrixWorld))}(r.isMeshPhongMaterial||r.isMeshToonMaterial||r.isMeshLambertMaterial||r.isMeshBasicMaterial||r.isMeshStandardMaterial||r.isShaderMaterial)&&w.setValue(p,"isOrthographic",!0===e.isOrthographicCamera),(r.isMeshPhongMaterial||r.isMeshToonMaterial||r.isMeshLambertMaterial||r.isMeshBasicMaterial||r.isMeshStandardMaterial||r.isShaderMaterial||r.skinning)&&(A.numMultiviewViews>0?he.updateCameraViewMatricesUniform(e,w):w.setValue(p,"viewMatrix",e.matrixWorldInverse))}if(r.skinning){w.setOptional(p,n,"bindMatrix"),w.setOptional(p,n,"bindMatrixInverse");var S=n.skeleton;if(S){var E=S.bones;if(m.floatVertexTextures){if(void 0===S.boneTexture){var T=Math.sqrt(4*E.length);T=_r.ceilPowerOfTwo(T),T=Math.max(T,4);var R=new Float32Array(T*T*4);R.set(S.boneMatrices);var L=new ma(R,T,T,je,Fe);S.boneMatrices=R,S.boneTexture=L,S.boneTextureSize=T}w.setValue(p,"boneTexture",S.boneTexture,b),w.setValue(p,"boneTextureSize",S.boneTextureSize)}else w.setOptional(p,S,"boneMatrices")}}return(f||o.receiveShadow!==n.receiveShadow)&&(o.receiveShadow=n.receiveShadow,w.setValue(p,"receiveShadow",n.receiveShadow)),f&&(w.setValue(p,"toneMappingExposure",D.toneMappingExposure),w.setValue(p,"toneMappingWhitePoint",D.toneMappingWhitePoint),o.needsLights&&(u=y,(c=_).ambientLightColor.needsUpdate=u,c.lightProbe.needsUpdate=u,c.directionalLights.needsUpdate=u,c.pointLights.needsUpdate=u,c.spotLights.needsUpdate=u,c.rectAreaLights.needsUpdate=u,c.hemisphereLights.needsUpdate=u),i&&r.fog&&function(e,t){e.fogColor.value.copy(t.color),t.isFog?(e.fogNear.value=t.near,e.fogFar.value=t.far):t.isFogExp2&&(e.fogDensity.value=t.density)}(_,i),r.isMeshBasicMaterial?Se(_,r):r.isMeshLambertMaterial?(Se(_,r),function(e,t){t.emissiveMap&&(e.emissiveMap.value=t.emissiveMap)}(_,r)):r.isMeshToonMaterial?(Se(_,r),function(e,t){e.specular.value.copy(t.specular),e.shininess.value=Math.max(t.shininess,1e-4),t.gradientMap&&(e.gradientMap.value=t.gradientMap);t.emissiveMap&&(e.emissiveMap.value=t.emissiveMap);t.bumpMap&&(e.bumpMap.value=t.bumpMap,e.bumpScale.value=t.bumpScale,t.side===g&&(e.bumpScale.value*=-1));t.normalMap&&(e.normalMap.value=t.normalMap,e.normalScale.value.copy(t.normalScale),t.side===g&&e.normalScale.value.negate());t.displacementMap&&(e.displacementMap.value=t.displacementMap,e.displacementScale.value=t.displacementScale,e.displacementBias.value=t.displacementBias)}(_,r)):r.isMeshPhongMaterial?(Se(_,r),function(e,t){e.specular.value.copy(t.specular),e.shininess.value=Math.max(t.shininess,1e-4),t.emissiveMap&&(e.emissiveMap.value=t.emissiveMap);t.bumpMap&&(e.bumpMap.value=t.bumpMap,e.bumpScale.value=t.bumpScale,t.side===g&&(e.bumpScale.value*=-1));t.normalMap&&(e.normalMap.value=t.normalMap,e.normalScale.value.copy(t.normalScale),t.side===g&&e.normalScale.value.negate());t.displacementMap&&(e.displacementMap.value=t.displacementMap,e.displacementScale.value=t.displacementScale,e.displacementBias.value=t.displacementBias)}(_,r)):r.isMeshStandardMaterial?(Se(_,r,a),r.isMeshPhysicalMaterial?function(e,t,r){Ee(e,t,r),e.reflectivity.value=t.reflectivity,e.clearcoat.value=t.clearcoat,e.clearcoatRoughness.value=t.clearcoatRoughness,t.sheen&&e.sheen.value.copy(t.sheen);t.clearcoatNormalMap&&(e.clearcoatNormalScale.value.copy(t.clearcoatNormalScale),e.clearcoatNormalMap.value=t.clearcoatNormalMap,t.side===g&&e.clearcoatNormalScale.value.negate());e.transparency.value=t.transparency}(_,r,a):Ee(_,r,a)):r.isMeshMatcapMaterial?(Se(_,r),function(e,t){t.matcap&&(e.matcap.value=t.matcap);t.bumpMap&&(e.bumpMap.value=t.bumpMap,e.bumpScale.value=t.bumpScale,t.side===g&&(e.bumpScale.value*=-1));t.normalMap&&(e.normalMap.value=t.normalMap,e.normalScale.value.copy(t.normalScale),t.side===g&&e.normalScale.value.negate());t.displacementMap&&(e.displacementMap.value=t.displacementMap,e.displacementScale.value=t.displacementScale,e.displacementBias.value=t.displacementBias)}(_,r)):r.isMeshDepthMaterial?(Se(_,r),function(e,t){t.displacementMap&&(e.displacementMap.value=t.displacementMap,e.displacementScale.value=t.displacementScale,e.displacementBias.value=t.displacementBias)}(_,r)):r.isMeshDistanceMaterial?(Se(_,r),function(e,t){t.displacementMap&&(e.displacementMap.value=t.displacementMap,e.displacementScale.value=t.displacementScale,e.displacementBias.value=t.displacementBias);e.referencePosition.value.copy(t.referencePosition),e.nearDistance.value=t.nearDistance,e.farDistance.value=t.farDistance}(_,r)):r.isMeshNormalMaterial?(Se(_,r),function(e,t){t.bumpMap&&(e.bumpMap.value=t.bumpMap,e.bumpScale.value=t.bumpScale,t.side===g&&(e.bumpScale.value*=-1));t.normalMap&&(e.normalMap.value=t.normalMap,e.normalScale.value.copy(t.normalScale),t.side===g&&e.normalScale.value.negate());t.displacementMap&&(e.displacementMap.value=t.displacementMap,e.displacementScale.value=t.displacementScale,e.displacementBias.value=t.displacementBias)}(_,r)):r.isLineBasicMaterial?(function(e,t){e.diffuse.value.copy(t.color),e.opacity.value=t.opacity}(_,r),r.isLineDashedMaterial&&function(e,t){e.dashSize.value=t.dashSize,e.totalSize.value=t.dashSize+t.gapSize,e.scale.value=t.scale}(_,r)):r.isPointsMaterial?function(e,t){e.diffuse.value.copy(t.color),e.opacity.value=t.opacity,e.size.value=t.size*Y,e.scale.value=.5*X,t.map&&(e.map.value=t.map);t.alphaMap&&(e.alphaMap.value=t.alphaMap);var r;t.map?r=t.map:t.alphaMap&&(r=t.alphaMap);void 0!==r&&(!0===r.matrixAutoUpdate&&r.updateMatrix(),e.uvTransform.value.copy(r.matrix))}(_,r):r.isSpriteMaterial?function(e,t){e.diffuse.value.copy(t.color),e.opacity.value=t.opacity,e.rotation.value=t.rotation,t.map&&(e.map.value=t.map);t.alphaMap&&(e.alphaMap.value=t.alphaMap);var r;t.map?r=t.map:t.alphaMap&&(r=t.alphaMap);void 0!==r&&(!0===r.matrixAutoUpdate&&r.updateMatrix(),e.uvTransform.value.copy(r.matrix))}(_,r):r.isShadowMaterial&&(_.color.value.copy(r.color),_.opacity.value=r.opacity),void 0!==_.ltc_1&&(_.ltc_1.value=ba.LTC_1),void 0!==_.ltc_2&&(_.ltc_2.value=ba.LTC_2),Oo.upload(p,o.uniformsList,_,b),r.isShaderMaterial&&(r.uniformsNeedUpdate=!1)),r.isShaderMaterial&&!0===r.uniformsNeedUpdate&&(Oo.upload(p,o.uniformsList,_,b),r.uniformsNeedUpdate=!1),r.isSpriteMaterial&&w.setValue(p,"center",n.center),A.numMultiviewViews>0?he.updateObjectMatricesUniforms(n,e,w):(w.setValue(p,"modelViewMatrix",n.modelViewMatrix),w.setValue(p,"normalMatrix",n.normalMatrix)),w.setValue(p,"modelMatrix",n.matrixWorld),A}function Se(e,t,r){e.opacity.value=t.opacity,t.color&&e.diffuse.value.copy(t.color),t.emissive&&e.emissive.value.copy(t.emissive).multiplyScalar(t.emissiveIntensity),t.map&&(e.map.value=t.map),t.alphaMap&&(e.alphaMap.value=t.alphaMap),t.specularMap&&(e.specularMap.value=t.specularMap);var n,i,a=t.envMap||r;a&&(e.envMap.value=a,e.flipEnvMap.value=a.isCubeTexture?-1:1,e.reflectivity.value=t.reflectivity,e.refractionRatio.value=t.refractionRatio,e.maxMipLevel.value=x.get(a).__maxMipLevel),t.lightMap&&(e.lightMap.value=t.lightMap,e.lightMapIntensity.value=t.lightMapIntensity),t.aoMap&&(e.aoMap.value=t.aoMap,e.aoMapIntensity.value=t.aoMapIntensity),t.map?n=t.map:t.specularMap?n=t.specularMap:t.displacementMap?n=t.displacementMap:t.normalMap?n=t.normalMap:t.bumpMap?n=t.bumpMap:t.roughnessMap?n=t.roughnessMap:t.metalnessMap?n=t.metalnessMap:t.alphaMap?n=t.alphaMap:t.emissiveMap&&(n=t.emissiveMap),void 0!==n&&(n.isWebGLRenderTarget&&(n=n.texture),!0===n.matrixAutoUpdate&&n.updateMatrix(),e.uvTransform.value.copy(n.matrix)),t.aoMap?i=t.aoMap:t.lightMap&&(i=t.lightMap),void 0!==i&&(i.isWebGLRenderTarget&&(i=i.texture),!0===i.matrixAutoUpdate&&i.updateMatrix(),e.uv2Transform.value.copy(i.matrix))}function Ee(e,t,r){e.roughness.value=t.roughness,e.metalness.value=t.metalness,t.roughnessMap&&(e.roughnessMap.value=t.roughnessMap),t.metalnessMap&&(e.metalnessMap.value=t.metalnessMap),t.emissiveMap&&(e.emissiveMap.value=t.emissiveMap),t.bumpMap&&(e.bumpMap.value=t.bumpMap,e.bumpScale.value=t.bumpScale,t.side===g&&(e.bumpScale.value*=-1)),t.normalMap&&(e.normalMap.value=t.normalMap,e.normalScale.value.copy(t.normalScale),t.side===g&&e.normalScale.value.negate()),t.displacementMap&&(e.displacementMap.value=t.displacementMap,e.displacementScale.value=t.displacementScale,e.displacementBias.value=t.displacementBias),(t.envMap||r)&&(e.envMapIntensity.value=t.envMapIntensity)}xe.setAnimationLoop((function(e){ue.isPresenting||ye&&ye(e)})),"undefined"!=typeof window&&xe.setContext(window),this.setAnimationLoop=function(e){ye=e,ue.setAnimationLoop(e),xe.start()},this.render=function(e,t){var r,n;if(void 0!==arguments[2]&&(console.warn("THREE.WebGLRenderer.render(): the renderTarget argument has been removed. Use .setRenderTarget() instead."),r=arguments[2]),void 0!==arguments[3]&&(console.warn("THREE.WebGLRenderer.render(): the forceClear argument has been removed. Use .clear() instead."),n=arguments[3]),t&&t.isCamera){if(!I){z.geometry=null,z.program=null,z.wireframe=!1,G=-1,k=null,!0===e.autoUpdate&&e.updateMatrixWorld(),null===t.parent&&t.updateMatrixWorld(),ue.enabled&&ue.isPresenting&&(t=ue.getCamera(t)),(d=E.get(e,t)).init(),e.onBeforeRender(D,e,t,r||U),ae.multiplyMatrices(t.projectionMatrix,t.matrixWorldInverse),ee.setFromMatrix(ae),ne=this.localClippingEnabled,re=te.init(this.clippingPlanes,ne,t),(h=S.get(e,t)).init(),be(e,t,0,D.sortObjects),!0===D.sortObjects&&h.sort(Q,Z),re&&te.beginShadows();var i=d.state.shadowsArray;de.render(i,e,t),d.setupLights(t),re&&te.endShadows(),this.info.autoReset&&this.info.reset(),void 0!==r&&this.setRenderTarget(r),ue.enabled&&he.isAvailable()&&he.attachCamera(t),T.render(h,e,t,n);var a=h.opaque,o=h.transparent;if(e.overrideMaterial){var s=e.overrideMaterial;a.length&&Ae(a,e,t,s),o.length&&Ae(o,e,t,s)}else a.length&&Ae(a,e,t),o.length&&Ae(o,e,t);e.onAfterRender(D,e,t),null!==U&&(b.updateRenderTargetMipmap(U),b.updateMultisampleRenderTarget(U)),v.buffers.depth.setTest(!0),v.buffers.depth.setMask(!0),v.buffers.color.setMask(!0),v.setPolygonOffset(!1),ue.enabled&&he.isAvailable()&&he.detachCamera(t),h=null,d=null}}else console.error("THREE.WebGLRenderer.render: camera is not an instance of THREE.Camera.")},this.setFramebuffer=function(e){O!==e&&null===U&&p.bindFramebuffer(36160,e),O=e},this.getActiveCubeFace=function(){return B},this.getActiveMipmapLevel=function(){return F},this.getRenderTarget=function(){return U},this.setRenderTarget=function(e,t,r){U=e,B=t,F=r,e&&void 0===x.get(e).__webglFramebuffer&&b.setupRenderTarget(e);var n=O,i=!1;if(e){var a=x.get(e).__webglFramebuffer;e.isWebGLRenderTargetCube?(n=a[t||0],i=!0):n=e.isWebGLMultisampleRenderTarget?x.get(e).__webglMultisampledFramebuffer:a,V.copy(e.viewport),j.copy(e.scissor),W=e.scissorTest}else V.copy(J).multiplyScalar(Y).floor(),j.copy(K).multiplyScalar(Y).floor(),W=$;if(N!==n&&(p.bindFramebuffer(36160,n),N=n),v.viewport(V),v.scissor(j),v.setScissorTest(W),i){var o=x.get(e.texture);p.framebufferTexture2D(36160,36064,34069+(t||0),o.__webglTexture,r||0)}},this.readRenderTargetPixels=function(e,t,r,n,i,a,o){if(e&&e.isWebGLRenderTarget){var s=x.get(e).__webglFramebuffer;if(e.isWebGLRenderTargetCube&&void 0!==o&&(s=s[o]),s){var l=!1;s!==N&&(p.bindFramebuffer(36160,s),l=!0);try{var c=e.texture,u=c.format,h=c.type;if(u!==je&&P.convert(u)!==p.getParameter(35739))return void console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.");if(!(h===Ce||P.convert(h)===p.getParameter(35738)||h===Fe&&(m.isWebGL2||f.get("OES_texture_float")||f.get("WEBGL_color_buffer_float"))||h===Ue&&(m.isWebGL2?f.get("EXT_color_buffer_float"):f.get("EXT_color_buffer_half_float"))))return void console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.");36053===p.checkFramebufferStatus(36160)?t>=0&&t<=e.width-n&&r>=0&&r<=e.height-i&&p.readPixels(t,r,n,i,P.convert(u),P.convert(h),a):console.error("THREE.WebGLRenderer.readRenderTargetPixels: readPixels from renderTarget failed. Framebuffer not complete.")}finally{l&&p.bindFramebuffer(36160,N)}}}else console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.")},this.copyFramebufferToTexture=function(e,t,r){void 0===r&&(r=0);var n=Math.pow(2,-r),i=Math.floor(t.image.width*n),a=Math.floor(t.image.height*n),o=P.convert(t.format);b.setTexture2D(t,0),p.copyTexImage2D(3553,r,o,e.x,e.y,i,a,0),v.unbindTexture()},this.copyTextureToTexture=function(e,t,r,n){var i=t.image.width,a=t.image.height,o=P.convert(r.format),s=P.convert(r.type);b.setTexture2D(r,0),t.isDataTexture?p.texSubImage2D(3553,n||0,e.x,e.y,i,a,o,s,t.image.data):p.texSubImage2D(3553,n||0,e.x,e.y,o,s,t.image),v.unbindTexture()},this.initTexture=function(e){b.setTexture2D(e,0),v.unbindTexture()},"undefined"!=typeof __THREE_DEVTOOLS__&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}function Ms(e,t){this.name="",this.color=new ti(e),this.density=void 0!==t?t:25e-5}function Ss(e,t,r){this.name="",this.color=new ti(e),this.near=void 0!==t?t:1,this.far=void 0!==r?r:1e3}function Es(e,t){this.array=e,this.stride=t,this.count=void 0!==e?e.length/t:0,this.usage=hr,this.updateRange={offset:0,count:-1},this.version=0}ys.prototype=Object.assign(Object.create(Fr.prototype),{constructor:ys,isWebGLMultiviewRenderTarget:!0,copy:function(e){return Fr.prototype.copy.call(this,e),this.numViews=e.numViews,this},setNumViews:function(e){return this.numViews!==e&&(this.numViews=e,this.dispose()),this}}),bs.prototype=Object.assign(Object.create(ua.prototype),{constructor:bs,isArrayCamera:!0}),As.prototype=Object.assign(Object.create(un.prototype),{constructor:As,isGroup:!0}),Object.assign(ws.prototype,br.prototype),Object.assign(Ms.prototype,{isFogExp2:!0,clone:function(){return new Ms(this.color,this.density)},toJSON:function(){return{type:"FogExp2",color:this.color.getHex(),density:this.density}}}),Object.assign(Ss.prototype,{isFog:!0,clone:function(){return new Ss(this.color,this.near,this.far)},toJSON:function(){return{type:"Fog",color:this.color.getHex(),near:this.near,far:this.far}}}),Object.defineProperty(Es.prototype,"needsUpdate",{set:function(e){!0===e&&this.version++}}),Object.assign(Es.prototype,{isInterleavedBuffer:!0,onUploadCallback:function(){},setUsage:function(e){return this.usage=e,this},copy:function(e){return this.array=new e.array.constructor(e.array),this.count=e.count,this.stride=e.stride,this.usage=e.usage,this},copyAt:function(e,t,r){e*=this.stride,r*=t.stride;for(var n=0,i=this.stride;n<i;n++)this.array[e+n]=t.array[r+n];return this},set:function(e,t){return void 0===t&&(t=0),this.array.set(e,t),this},clone:function(){return(new this.constructor).copy(this)},onUpload:function(e){return this.onUploadCallback=e,this}});var Ts,Rs=new Rr;function Ls(e,t,r,n){this.data=e,this.itemSize=t,this.offset=r,this.normalized=!0===n}function Cs(e){si.call(this),this.type="SpriteMaterial",this.color=new ti(16777215),this.map=null,this.alphaMap=null,this.rotation=0,this.sizeAttenuation=!0,this.transparent=!0,this.setValues(e)}Object.defineProperties(Ls.prototype,{count:{get:function(){return this.data.count}},array:{get:function(){return this.data.array}}}),Object.assign(Ls.prototype,{isInterleavedBufferAttribute:!0,applyMatrix4:function(e){for(var t=0,r=this.data.count;t<r;t++)Rs.x=this.getX(t),Rs.y=this.getY(t),Rs.z=this.getZ(t),Rs.applyMatrix4(e),this.setXYZ(t,Rs.x,Rs.y,Rs.z);return this},setX:function(e,t){return this.data.array[e*this.data.stride+this.offset]=t,this},setY:function(e,t){return this.data.array[e*this.data.stride+this.offset+1]=t,this},setZ:function(e,t){return this.data.array[e*this.data.stride+this.offset+2]=t,this},setW:function(e,t){return this.data.array[e*this.data.stride+this.offset+3]=t,this},getX:function(e){return this.data.array[e*this.data.stride+this.offset]},getY:function(e){return this.data.array[e*this.data.stride+this.offset+1]},getZ:function(e){return this.data.array[e*this.data.stride+this.offset+2]},getW:function(e){return this.data.array[e*this.data.stride+this.offset+3]},setXY:function(e,t,r){return e=e*this.data.stride+this.offset,this.data.array[e+0]=t,this.data.array[e+1]=r,this},setXYZ:function(e,t,r,n){return e=e*this.data.stride+this.offset,this.data.array[e+0]=t,this.data.array[e+1]=r,this.data.array[e+2]=n,this},setXYZW:function(e,t,r,n,i){return e=e*this.data.stride+this.offset,this.data.array[e+0]=t,this.data.array[e+1]=r,this.data.array[e+2]=n,this.data.array[e+3]=i,this}}),Cs.prototype=Object.create(si.prototype),Cs.prototype.constructor=Cs,Cs.prototype.isSpriteMaterial=!0,Cs.prototype.copy=function(e){return si.prototype.copy.call(this,e),this.color.copy(e.color),this.map=e.map,this.alphaMap=e.alphaMap,this.rotation=e.rotation,this.sizeAttenuation=e.sizeAttenuation,this};var Ps=new Rr,Ds=new Rr,Is=new Rr,Os=new Mr,Bs=new Mr,Fs=new Wr,Us=new Rr,Ns=new Rr,Gs=new Rr,zs=new Mr,ks=new Mr,Hs=new Mr;function Vs(e){if(un.call(this),this.type="Sprite",void 0===Ts){Ts=new Li;var t=new Es(new Float32Array([-.5,-.5,0,0,0,.5,-.5,0,1,0,.5,.5,0,1,1,-.5,.5,0,0,1]),5);Ts.setIndex([0,1,2,0,2,3]),Ts.setAttribute("position",new Ls(t,3,0,!1)),Ts.setAttribute("uv",new Ls(t,2,3,!1))}this.geometry=Ts,this.material=void 0!==e?e:new Cs,this.center=new Mr(.5,.5)}function js(e,t,r,n,i,a){Os.subVectors(e,r).addScalar(.5).multiply(n),void 0!==i?(Bs.x=a*Os.x-i*Os.y,Bs.y=i*Os.x+a*Os.y):Bs.copy(Os),e.copy(t),e.x+=Bs.x,e.y+=Bs.y,e.applyMatrix4(Fs)}Vs.prototype=Object.assign(Object.create(un.prototype),{constructor:Vs,isSprite:!0,raycast:function(e,t){null===e.camera&&console.error('THREE.Sprite: "Raycaster.camera" needs to be set in order to raycast against sprites.'),Ds.setFromMatrixScale(this.matrixWorld),Fs.copy(e.camera.matrixWorld),this.modelViewMatrix.multiplyMatrices(e.camera.matrixWorldInverse,this.matrixWorld),Is.setFromMatrixPosition(this.modelViewMatrix),e.camera.isPerspectiveCamera&&!1===this.material.sizeAttenuation&&Ds.multiplyScalar(-Is.z);var r,n,i=this.material.rotation;0!==i&&(n=Math.cos(i),r=Math.sin(i));var a=this.center;js(Us.set(-.5,-.5,0),Is,a,Ds,r,n),js(Ns.set(.5,-.5,0),Is,a,Ds,r,n),js(Gs.set(.5,.5,0),Is,a,Ds,r,n),zs.set(0,0),ks.set(1,0),Hs.set(1,1);var o=e.ray.intersectTriangle(Us,Ns,Gs,!1,Ps);if(null!==o||(js(Ns.set(-.5,.5,0),Is,a,Ds,r,n),ks.set(0,1),null!==(o=e.ray.intersectTriangle(Us,Gs,Ns,!1,Ps)))){var s=e.ray.origin.distanceTo(Ps);s<e.near||s>e.far||t.push({distance:s,point:Ps.clone(),uv:Jn.getUV(Ps,Us,Ns,Gs,zs,ks,Hs,new Mr),face:null,object:this})}},clone:function(){return new this.constructor(this.material).copy(this)},copy:function(e){return un.prototype.copy.call(this,e),void 0!==e.center&&this.center.copy(e.center),this}});var Ws=new Rr,qs=new Rr;function Xs(){un.call(this),this.type="LOD",Object.defineProperties(this,{levels:{enumerable:!0,value:[]}}),this.autoUpdate=!0}function Ys(e,t){e&&e.isGeometry&&console.error("THREE.SkinnedMesh no longer supports THREE.Geometry. Use THREE.BufferGeometry instead."),Xi.call(this,e,t),this.type="SkinnedMesh",this.bindMode="attached",this.bindMatrix=new Wr,this.bindMatrixInverse=new Wr}Xs.prototype=Object.assign(Object.create(un.prototype),{constructor:Xs,isLOD:!0,copy:function(e){un.prototype.copy.call(this,e,!1);for(var t=e.levels,r=0,n=t.length;r<n;r++){var i=t[r];this.addLevel(i.object.clone(),i.distance)}return this.autoUpdate=e.autoUpdate,this},addLevel:function(e,t){void 0===t&&(t=0),t=Math.abs(t);for(var r=this.levels,n=0;n<r.length&&!(t<r[n].distance);n++);return r.splice(n,0,{distance:t,object:e}),this.add(e),this},getObjectForDistance:function(e){var t=this.levels;if(t.length>0){for(var r=1,n=t.length;r<n&&!(e<t[r].distance);r++);return t[r-1].object}return null},raycast:function(e,t){if(this.levels.length>0){Ws.setFromMatrixPosition(this.matrixWorld);var r=e.ray.origin.distanceTo(Ws);this.getObjectForDistance(r).raycast(e,t)}},update:function(e){var t=this.levels;if(t.length>1){Ws.setFromMatrixPosition(e.matrixWorld),qs.setFromMatrixPosition(this.matrixWorld);var r=Ws.distanceTo(qs);t[0].object.visible=!0;for(var n=1,i=t.length;n<i&&r>=t[n].distance;n++)t[n-1].object.visible=!1,t[n].object.visible=!0;for(;n<i;n++)t[n].object.visible=!1}},toJSON:function(e){var t=un.prototype.toJSON.call(this,e);!1===this.autoUpdate&&(t.object.autoUpdate=!1),t.object.levels=[];for(var r=this.levels,n=0,i=r.length;n<i;n++){var a=r[n];t.object.levels.push({object:a.object.uuid,distance:a.distance})}return t}}),Ys.prototype=Object.assign(Object.create(Xi.prototype),{constructor:Ys,isSkinnedMesh:!0,bind:function(e,t){this.skeleton=e,void 0===t&&(this.updateMatrixWorld(!0),this.skeleton.calculateInverses(),t=this.matrixWorld),this.bindMatrix.copy(t),this.bindMatrixInverse.getInverse(t)},pose:function(){this.skeleton.pose()},normalizeSkinWeights:function(){for(var e=new Br,t=this.geometry.attributes.skinWeight,r=0,n=t.count;r<n;r++){e.x=t.getX(r),e.y=t.getY(r),e.z=t.getZ(r),e.w=t.getW(r);var i=1/e.manhattanLength();i!==1/0?e.multiplyScalar(i):e.set(1,0,0,0),t.setXYZW(r,e.x,e.y,e.z,e.w)}},updateMatrixWorld:function(e){Xi.prototype.updateMatrixWorld.call(this,e),"attached"===this.bindMode?this.bindMatrixInverse.getInverse(this.matrixWorld):"detached"===this.bindMode?this.bindMatrixInverse.getInverse(this.bindMatrix):console.warn("THREE.SkinnedMesh: Unrecognized bindMode: "+this.bindMode)},clone:function(){return new this.constructor(this.geometry,this.material).copy(this)}});var Qs=new Wr,Zs=new Wr;function Js(e,t){if(e=e||[],this.bones=e.slice(0),this.boneMatrices=new Float32Array(16*this.bones.length),this.frame=-1,void 0===t)this.calculateInverses();else if(this.bones.length===t.length)this.boneInverses=t.slice(0);else{console.warn("THREE.Skeleton boneInverses is the wrong length."),this.boneInverses=[];for(var r=0,n=this.bones.length;r<n;r++)this.boneInverses.push(new Wr)}}function Ks(){un.call(this),this.type="Bone"}Object.assign(Js.prototype,{calculateInverses:function(){this.boneInverses=[];for(var e=0,t=this.bones.length;e<t;e++){var r=new Wr;this.bones[e]&&r.getInverse(this.bones[e].matrixWorld),this.boneInverses.push(r)}},pose:function(){var e,t,r;for(t=0,r=this.bones.length;t<r;t++)(e=this.bones[t])&&e.matrixWorld.getInverse(this.boneInverses[t]);for(t=0,r=this.bones.length;t<r;t++)(e=this.bones[t])&&(e.parent&&e.parent.isBone?(e.matrix.getInverse(e.parent.matrixWorld),e.matrix.multiply(e.matrixWorld)):e.matrix.copy(e.matrixWorld),e.matrix.decompose(e.position,e.quaternion,e.scale))},update:function(){for(var e=this.bones,t=this.boneInverses,r=this.boneMatrices,n=this.boneTexture,i=0,a=e.length;i<a;i++){var o=e[i]?e[i].matrixWorld:Zs;Qs.multiplyMatrices(o,t[i]),Qs.toArray(r,16*i)}void 0!==n&&(n.needsUpdate=!0)},clone:function(){return new Js(this.bones,this.boneInverses)},getBoneByName:function(e){for(var t=0,r=this.bones.length;t<r;t++){var n=this.bones[t];if(n.name===e)return n}}}),Ks.prototype=Object.assign(Object.create(un.prototype),{constructor:Ks,isBone:!0});var $s=new Wr,el=new Wr,tl=[],rl=new Xi;function nl(e,t,r){Xi.call(this,e,t),this.instanceMatrix=new ui(new Float32Array(16*r),16),this.count=r}function il(e){si.call(this),this.type="LineBasicMaterial",this.color=new ti(16777215),this.linewidth=1,this.linecap="round",this.linejoin="round",this.setValues(e)}nl.prototype=Object.assign(Object.create(Xi.prototype),{constructor:nl,isInstancedMesh:!0,getMatrixAt:function(e,t){t.fromArray(this.instanceMatrix.array,16*e)},raycast:function(e,t){var r=this.matrixWorld,n=this.count;if(rl.geometry=this.geometry,rl.material=this.material,void 0!==rl.material)for(var i=0;i<n;i++)this.getMatrixAt(i,$s),el.multiplyMatrices(r,$s),rl.matrixWorld=el,rl.raycast(e,tl),tl.length>0&&(tl[0].instanceId=i,tl[0].object=this,t.push(tl[0]),tl.length=0)},setMatrixAt:function(e,t){t.toArray(this.instanceMatrix.array,16*e)},updateMorphTargets:function(){}}),il.prototype=Object.create(si.prototype),il.prototype.constructor=il,il.prototype.isLineBasicMaterial=!0,il.prototype.copy=function(e){return si.prototype.copy.call(this,e),this.color.copy(e.color),this.linewidth=e.linewidth,this.linecap=e.linecap,this.linejoin=e.linejoin,this};var al=new Rr,ol=new Rr,sl=new Wr,ll=new Fn,cl=new Rn;function ul(e,t,r){1===r&&console.error("THREE.Line: parameter THREE.LinePieces no longer supported. Use THREE.LineSegments instead."),un.call(this),this.type="Line",this.geometry=void 0!==e?e:new Li,this.material=void 0!==t?t:new il({color:16777215*Math.random()})}ul.prototype=Object.assign(Object.create(un.prototype),{constructor:ul,isLine:!0,computeLineDistances:function(){var e=this.geometry;if(e.isBufferGeometry)if(null===e.index){for(var t=e.attributes.position,r=[0],n=1,i=t.count;n<i;n++)al.fromBufferAttribute(t,n-1),ol.fromBufferAttribute(t,n),r[n]=r[n-1],r[n]+=al.distanceTo(ol);e.setAttribute("lineDistance",new yi(r,1))}else console.warn("THREE.Line.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");else if(e.isGeometry){var a=e.vertices;(r=e.lineDistances)[0]=0;for(n=1,i=a.length;n<i;n++)r[n]=r[n-1],r[n]+=a[n-1].distanceTo(a[n])}return this},raycast:function(e,t){var r=e.linePrecision,n=this.geometry,i=this.matrixWorld;if(null===n.boundingSphere&&n.computeBoundingSphere(),cl.copy(n.boundingSphere),cl.applyMatrix4(i),cl.radius+=r,!1!==e.ray.intersectsSphere(cl)){sl.getInverse(i),ll.copy(e.ray).applyMatrix4(sl);var a=r/((this.scale.x+this.scale.y+this.scale.z)/3),o=a*a,s=new Rr,l=new Rr,c=new Rr,u=new Rr,h=this&&this.isLineSegments?2:1;if(n.isBufferGeometry){var d=n.index,p=n.attributes.position.array;if(null!==d)for(var f=d.array,m=0,v=f.length-1;m<v;m+=h){var g=f[m],y=f[m+1];if(s.fromArray(p,3*g),l.fromArray(p,3*y),!(ll.distanceSqToSegment(s,l,u,c)>o))u.applyMatrix4(this.matrixWorld),(A=e.ray.origin.distanceTo(u))<e.near||A>e.far||t.push({distance:A,point:c.clone().applyMatrix4(this.matrixWorld),index:m,face:null,faceIndex:null,object:this})}else for(m=0,v=p.length/3-1;m<v;m+=h){if(s.fromArray(p,3*m),l.fromArray(p,3*m+3),!(ll.distanceSqToSegment(s,l,u,c)>o))u.applyMatrix4(this.matrixWorld),(A=e.ray.origin.distanceTo(u))<e.near||A>e.far||t.push({distance:A,point:c.clone().applyMatrix4(this.matrixWorld),index:m,face:null,faceIndex:null,object:this})}}else if(n.isGeometry){var x=n.vertices,b=x.length;for(m=0;m<b-1;m+=h){var A;if(!(ll.distanceSqToSegment(x[m],x[m+1],u,c)>o))u.applyMatrix4(this.matrixWorld),(A=e.ray.origin.distanceTo(u))<e.near||A>e.far||t.push({distance:A,point:c.clone().applyMatrix4(this.matrixWorld),index:m,face:null,faceIndex:null,object:this})}}}},clone:function(){return new this.constructor(this.geometry,this.material).copy(this)}});var hl=new Rr,dl=new Rr;function pl(e,t){ul.call(this,e,t),this.type="LineSegments"}function fl(e,t){ul.call(this,e,t),this.type="LineLoop"}function ml(e){si.call(this),this.type="PointsMaterial",this.color=new ti(16777215),this.map=null,this.alphaMap=null,this.size=1,this.sizeAttenuation=!0,this.morphTargets=!1,this.setValues(e)}pl.prototype=Object.assign(Object.create(ul.prototype),{constructor:pl,isLineSegments:!0,computeLineDistances:function(){var e=this.geometry;if(e.isBufferGeometry)if(null===e.index){for(var t=e.attributes.position,r=[],n=0,i=t.count;n<i;n+=2)hl.fromBufferAttribute(t,n),dl.fromBufferAttribute(t,n+1),r[n]=0===n?0:r[n-1],r[n+1]=r[n]+hl.distanceTo(dl);e.setAttribute("lineDistance",new yi(r,1))}else console.warn("THREE.LineSegments.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");else if(e.isGeometry){var a=e.vertices;for(r=e.lineDistances,n=0,i=a.length;n<i;n+=2)hl.copy(a[n]),dl.copy(a[n+1]),r[n]=0===n?0:r[n-1],r[n+1]=r[n]+hl.distanceTo(dl)}return this}}),fl.prototype=Object.assign(Object.create(ul.prototype),{constructor:fl,isLineLoop:!0}),ml.prototype=Object.create(si.prototype),ml.prototype.constructor=ml,ml.prototype.isPointsMaterial=!0,ml.prototype.copy=function(e){return si.prototype.copy.call(this,e),this.color.copy(e.color),this.map=e.map,this.alphaMap=e.alphaMap,this.size=e.size,this.sizeAttenuation=e.sizeAttenuation,this.morphTargets=e.morphTargets,this};var vl=new Wr,gl=new Fn,yl=new Rn,xl=new Rr;function bl(e,t){un.call(this),this.type="Points",this.geometry=void 0!==e?e:new Li,this.material=void 0!==t?t:new ml({color:16777215*Math.random()}),this.updateMorphTargets()}function Al(e,t,r,n,i,a,o){var s=gl.distanceSqToPoint(e);if(s<r){var l=new Rr;gl.closestPointToPoint(e,l),l.applyMatrix4(n);var c=i.ray.origin.distanceTo(l);if(c<i.near||c>i.far)return;a.push({distance:c,distanceToRay:Math.sqrt(s),point:l,index:t,face:null,object:o})}}function wl(e,t,r,n,i,a,o,s,l){Or.call(this,e,t,r,n,i,a,o,s,l),this.format=void 0!==o?o:Ve,this.minFilter=void 0!==a?a:Se,this.magFilter=void 0!==i?i:Se,this.generateMipmaps=!1}function _l(e,t,r,n,i,a,o,s,l,c,u,h){Or.call(this,null,a,o,s,l,c,n,i,u,h),this.image={width:t,height:r},this.mipmaps=e,this.flipY=!1,this.generateMipmaps=!1}function Ml(e,t,r,n,i,a,o,s,l){Or.call(this,e,t,r,n,i,a,o,s,l),this.needsUpdate=!0}function Sl(e,t,r,n,i,a,o,s,l,c){if((c=void 0!==c?c:Ye)!==Ye&&c!==Qe)throw new Error("DepthTexture format must be either THREE.DepthFormat or THREE.DepthStencilFormat");void 0===r&&c===Ye&&(r=Ie),void 0===r&&c===Qe&&(r=ke),Or.call(this,null,n,i,a,o,s,c,r,l),this.image={width:e,height:t},this.magFilter=void 0!==o?o:be,this.minFilter=void 0!==s?s:be,this.flipY=!1,this.generateMipmaps=!1}function El(e){Li.call(this),this.type="WireframeGeometry";var t,r,n,i,a,o,s,l,c,u,h=[],d=[0,0],p={},f=["a","b","c"];if(e&&e.isGeometry){var m=e.faces;for(t=0,n=m.length;t<n;t++){var v=m[t];for(r=0;r<3;r++)s=v[f[r]],l=v[f[(r+1)%3]],d[0]=Math.min(s,l),d[1]=Math.max(s,l),void 0===p[c=d[0]+","+d[1]]&&(p[c]={index1:d[0],index2:d[1]})}for(c in p)o=p[c],u=e.vertices[o.index1],h.push(u.x,u.y,u.z),u=e.vertices[o.index2],h.push(u.x,u.y,u.z)}else if(e&&e.isBufferGeometry){var g,y,x,b,A,w,_;if(u=new Rr,null!==e.index){for(g=e.attributes.position,y=e.index,0===(x=e.groups).length&&(x=[{start:0,count:y.count,materialIndex:0}]),i=0,a=x.length;i<a;++i)for(t=A=(b=x[i]).start,n=A+b.count;t<n;t+=3)for(r=0;r<3;r++)s=y.getX(t+r),l=y.getX(t+(r+1)%3),d[0]=Math.min(s,l),d[1]=Math.max(s,l),void 0===p[c=d[0]+","+d[1]]&&(p[c]={index1:d[0],index2:d[1]});for(c in p)o=p[c],u.fromBufferAttribute(g,o.index1),h.push(u.x,u.y,u.z),u.fromBufferAttribute(g,o.index2),h.push(u.x,u.y,u.z)}else for(t=0,n=(g=e.attributes.position).count/3;t<n;t++)for(r=0;r<3;r++)w=3*t+r,u.fromBufferAttribute(g,w),h.push(u.x,u.y,u.z),_=3*t+(r+1)%3,u.fromBufferAttribute(g,_),h.push(u.x,u.y,u.z)}this.setAttribute("position",new yi(h,3))}function Tl(e,t,r){ea.call(this),this.type="ParametricGeometry",this.parameters={func:e,slices:t,stacks:r},this.fromBufferGeometry(new Rl(e,t,r)),this.mergeVertices()}function Rl(e,t,r){Li.call(this),this.type="ParametricBufferGeometry",this.parameters={func:e,slices:t,stacks:r};var n,i,a=[],o=[],s=[],l=[],c=new Rr,u=new Rr,h=new Rr,d=new Rr,p=new Rr;e.length<3&&console.error("THREE.ParametricGeometry: Function must now modify a Vector3 as third parameter.");var f=t+1;for(n=0;n<=r;n++){var m=n/r;for(i=0;i<=t;i++){var v=i/t;e(v,m,u),o.push(u.x,u.y,u.z),v-1e-5>=0?(e(v-1e-5,m,h),d.subVectors(u,h)):(e(v+1e-5,m,h),d.subVectors(h,u)),m-1e-5>=0?(e(v,m-1e-5,h),p.subVectors(u,h)):(e(v,m+1e-5,h),p.subVectors(h,u)),c.crossVectors(d,p).normalize(),s.push(c.x,c.y,c.z),l.push(v,m)}}for(n=0;n<r;n++)for(i=0;i<t;i++){var g=n*f+i,y=n*f+i+1,x=(n+1)*f+i+1,b=(n+1)*f+i;a.push(g,y,b),a.push(y,x,b)}this.setIndex(a),this.setAttribute("position",new yi(o,3)),this.setAttribute("normal",new yi(s,3)),this.setAttribute("uv",new yi(l,2))}function Ll(e,t,r,n){ea.call(this),this.type="PolyhedronGeometry",this.parameters={vertices:e,indices:t,radius:r,detail:n},this.fromBufferGeometry(new Cl(e,t,r,n)),this.mergeVertices()}function Cl(e,t,r,n){Li.call(this),this.type="PolyhedronBufferGeometry",this.parameters={vertices:e,indices:t,radius:r,detail:n},r=r||1;var i=[],a=[];function o(e,t,r,n){var i,a,o=Math.pow(2,n),l=[];for(i=0;i<=o;i++){l[i]=[];var c=e.clone().lerp(r,i/o),u=t.clone().lerp(r,i/o),h=o-i;for(a=0;a<=h;a++)l[i][a]=0===a&&i===o?c:c.clone().lerp(u,a/h)}for(i=0;i<o;i++)for(a=0;a<2*(o-i)-1;a++){var d=Math.floor(a/2);a%2==0?(s(l[i][d+1]),s(l[i+1][d]),s(l[i][d])):(s(l[i][d+1]),s(l[i+1][d+1]),s(l[i+1][d]))}}function s(e){i.push(e.x,e.y,e.z)}function l(t,r){var n=3*t;r.x=e[n+0],r.y=e[n+1],r.z=e[n+2]}function c(e,t,r,n){n<0&&1===e.x&&(a[t]=e.x-1),0===r.x&&0===r.z&&(a[t]=n/2/Math.PI+.5)}function u(e){return Math.atan2(e.z,-e.x)}!function(e){for(var r=new Rr,n=new Rr,i=new Rr,a=0;a<t.length;a+=3)l(t[a+0],r),l(t[a+1],n),l(t[a+2],i),o(r,n,i,e)}(n=n||0),function(e){for(var t=new Rr,r=0;r<i.length;r+=3)t.x=i[r+0],t.y=i[r+1],t.z=i[r+2],t.normalize().multiplyScalar(e),i[r+0]=t.x,i[r+1]=t.y,i[r+2]=t.z}(r),function(){for(var e=new Rr,t=0;t<i.length;t+=3){e.x=i[t+0],e.y=i[t+1],e.z=i[t+2];var r=u(e)/2/Math.PI+.5,n=(o=e,Math.atan2(-o.y,Math.sqrt(o.x*o.x+o.z*o.z))/Math.PI+.5);a.push(r,1-n)}var o;(function(){for(var e=new Rr,t=new Rr,r=new Rr,n=new Rr,o=new Mr,s=new Mr,l=new Mr,h=0,d=0;h<i.length;h+=9,d+=6){e.set(i[h+0],i[h+1],i[h+2]),t.set(i[h+3],i[h+4],i[h+5]),r.set(i[h+6],i[h+7],i[h+8]),o.set(a[d+0],a[d+1]),s.set(a[d+2],a[d+3]),l.set(a[d+4],a[d+5]),n.copy(e).add(t).add(r).divideScalar(3);var p=u(n);c(o,d+0,e,p),c(s,d+2,t,p),c(l,d+4,r,p)}})(),function(){for(var e=0;e<a.length;e+=6){var t=a[e+0],r=a[e+2],n=a[e+4],i=Math.max(t,r,n),o=Math.min(t,r,n);i>.9&&o<.1&&(t<.2&&(a[e+0]+=1),r<.2&&(a[e+2]+=1),n<.2&&(a[e+4]+=1))}}()}(),this.setAttribute("position",new yi(i,3)),this.setAttribute("normal",new yi(i.slice(),3)),this.setAttribute("uv",new yi(a,2)),0===n?this.computeVertexNormals():this.normalizeNormals()}function Pl(e,t){ea.call(this),this.type="TetrahedronGeometry",this.parameters={radius:e,detail:t},this.fromBufferGeometry(new Dl(e,t)),this.mergeVertices()}function Dl(e,t){Cl.call(this,[1,1,1,-1,-1,1,-1,1,-1,1,-1,-1],[2,1,0,0,3,2,1,3,0,2,3,1],e,t),this.type="TetrahedronBufferGeometry",this.parameters={radius:e,detail:t}}function Il(e,t){ea.call(this),this.type="OctahedronGeometry",this.parameters={radius:e,detail:t},this.fromBufferGeometry(new Ol(e,t)),this.mergeVertices()}function Ol(e,t){Cl.call(this,[1,0,0,-1,0,0,0,1,0,0,-1,0,0,0,1,0,0,-1],[0,2,4,0,4,3,0,3,5,0,5,2,1,2,5,1,5,3,1,3,4,1,4,2],e,t),this.type="OctahedronBufferGeometry",this.parameters={radius:e,detail:t}}function Bl(e,t){ea.call(this),this.type="IcosahedronGeometry",this.parameters={radius:e,detail:t},this.fromBufferGeometry(new Fl(e,t)),this.mergeVertices()}function Fl(e,t){var r=(1+Math.sqrt(5))/2,n=[-1,r,0,1,r,0,-1,-r,0,1,-r,0,0,-1,r,0,1,r,0,-1,-r,0,1,-r,r,0,-1,r,0,1,-r,0,-1,-r,0,1];Cl.call(this,n,[0,11,5,0,5,1,0,1,7,0,7,10,0,10,11,1,5,9,5,11,4,11,10,2,10,7,6,7,1,8,3,9,4,3,4,2,3,2,6,3,6,8,3,8,9,4,9,5,2,4,11,6,2,10,8,6,7,9,8,1],e,t),this.type="IcosahedronBufferGeometry",this.parameters={radius:e,detail:t}}function Ul(e,t){ea.call(this),this.type="DodecahedronGeometry",this.parameters={radius:e,detail:t},this.fromBufferGeometry(new Nl(e,t)),this.mergeVertices()}function Nl(e,t){var r=(1+Math.sqrt(5))/2,n=1/r,i=[-1,-1,-1,-1,-1,1,-1,1,-1,-1,1,1,1,-1,-1,1,-1,1,1,1,-1,1,1,1,0,-n,-r,0,-n,r,0,n,-r,0,n,r,-n,-r,0,-n,r,0,n,-r,0,n,r,0,-r,0,-n,r,0,-n,-r,0,n,r,0,n];Cl.call(this,i,[3,11,7,3,7,15,3,15,13,7,19,17,7,17,6,7,6,15,17,4,8,17,8,10,17,10,6,8,0,16,8,16,2,8,2,10,0,12,1,0,1,18,0,18,16,6,10,2,6,2,13,6,13,15,2,16,18,2,18,3,2,3,13,18,1,9,18,9,11,18,11,3,4,14,12,4,12,0,4,0,8,11,9,5,11,5,19,11,19,7,19,5,14,19,14,4,19,4,17,1,12,14,1,14,5,1,5,9],e,t),this.type="DodecahedronBufferGeometry",this.parameters={radius:e,detail:t}}function Gl(e,t,r,n,i,a){ea.call(this),this.type="TubeGeometry",this.parameters={path:e,tubularSegments:t,radius:r,radialSegments:n,closed:i},void 0!==a&&console.warn("THREE.TubeGeometry: taper has been removed.");var o=new zl(e,t,r,n,i);this.tangents=o.tangents,this.normals=o.normals,this.binormals=o.binormals,this.fromBufferGeometry(o),this.mergeVertices()}function zl(e,t,r,n,i){Li.call(this),this.type="TubeBufferGeometry",this.parameters={path:e,tubularSegments:t,radius:r,radialSegments:n,closed:i},t=t||64,r=r||1,n=n||8,i=i||!1;var a=e.computeFrenetFrames(t,i);this.tangents=a.tangents,this.normals=a.normals,this.binormals=a.binormals;var o,s,l=new Rr,c=new Rr,u=new Mr,h=new Rr,d=[],p=[],f=[],m=[];function v(i){h=e.getPointAt(i/t,h);var o=a.normals[i],u=a.binormals[i];for(s=0;s<=n;s++){var f=s/n*Math.PI*2,m=Math.sin(f),v=-Math.cos(f);c.x=v*o.x+m*u.x,c.y=v*o.y+m*u.y,c.z=v*o.z+m*u.z,c.normalize(),p.push(c.x,c.y,c.z),l.x=h.x+r*c.x,l.y=h.y+r*c.y,l.z=h.z+r*c.z,d.push(l.x,l.y,l.z)}}!function(){for(o=0;o<t;o++)v(o);v(!1===i?t:0),function(){for(o=0;o<=t;o++)for(s=0;s<=n;s++)u.x=o/t,u.y=s/n,f.push(u.x,u.y)}(),function(){for(s=1;s<=t;s++)for(o=1;o<=n;o++){var e=(n+1)*(s-1)+(o-1),r=(n+1)*s+(o-1),i=(n+1)*s+o,a=(n+1)*(s-1)+o;m.push(e,r,a),m.push(r,i,a)}}()}(),this.setIndex(m),this.setAttribute("position",new yi(d,3)),this.setAttribute("normal",new yi(p,3)),this.setAttribute("uv",new yi(f,2))}function kl(e,t,r,n,i,a,o){ea.call(this),this.type="TorusKnotGeometry",this.parameters={radius:e,tube:t,tubularSegments:r,radialSegments:n,p:i,q:a},void 0!==o&&console.warn("THREE.TorusKnotGeometry: heightScale has been deprecated. Use .scale( x, y, z ) instead."),this.fromBufferGeometry(new Hl(e,t,r,n,i,a)),this.mergeVertices()}function Hl(e,t,r,n,i,a){Li.call(this),this.type="TorusKnotBufferGeometry",this.parameters={radius:e,tube:t,tubularSegments:r,radialSegments:n,p:i,q:a},e=e||1,t=t||.4,r=Math.floor(r)||64,n=Math.floor(n)||8,i=i||2,a=a||3;var o,s,l=[],c=[],u=[],h=[],d=new Rr,p=new Rr,f=new Rr,m=new Rr,v=new Rr,g=new Rr,y=new Rr;for(o=0;o<=r;++o){var x=o/r*i*Math.PI*2;for(T(x,i,a,e,f),T(x+.01,i,a,e,m),g.subVectors(m,f),y.addVectors(m,f),v.crossVectors(g,y),y.crossVectors(v,g),v.normalize(),y.normalize(),s=0;s<=n;++s){var b=s/n*Math.PI*2,A=-t*Math.cos(b),w=t*Math.sin(b);d.x=f.x+(A*y.x+w*v.x),d.y=f.y+(A*y.y+w*v.y),d.z=f.z+(A*y.z+w*v.z),c.push(d.x,d.y,d.z),p.subVectors(d,f).normalize(),u.push(p.x,p.y,p.z),h.push(o/r),h.push(s/n)}}for(s=1;s<=r;s++)for(o=1;o<=n;o++){var _=(n+1)*(s-1)+(o-1),M=(n+1)*s+(o-1),S=(n+1)*s+o,E=(n+1)*(s-1)+o;l.push(_,M,E),l.push(M,S,E)}function T(e,t,r,n,i){var a=Math.cos(e),o=Math.sin(e),s=r/t*e,l=Math.cos(s);i.x=n*(2+l)*.5*a,i.y=n*(2+l)*o*.5,i.z=n*Math.sin(s)*.5}this.setIndex(l),this.setAttribute("position",new yi(c,3)),this.setAttribute("normal",new yi(u,3)),this.setAttribute("uv",new yi(h,2))}function Vl(e,t,r,n,i){ea.call(this),this.type="TorusGeometry",this.parameters={radius:e,tube:t,radialSegments:r,tubularSegments:n,arc:i},this.fromBufferGeometry(new jl(e,t,r,n,i)),this.mergeVertices()}function jl(e,t,r,n,i){Li.call(this),this.type="TorusBufferGeometry",this.parameters={radius:e,tube:t,radialSegments:r,tubularSegments:n,arc:i},e=e||1,t=t||.4,r=Math.floor(r)||8,n=Math.floor(n)||6,i=i||2*Math.PI;var a,o,s=[],l=[],c=[],u=[],h=new Rr,d=new Rr,p=new Rr;for(a=0;a<=r;a++)for(o=0;o<=n;o++){var f=o/n*i,m=a/r*Math.PI*2;d.x=(e+t*Math.cos(m))*Math.cos(f),d.y=(e+t*Math.cos(m))*Math.sin(f),d.z=t*Math.sin(m),l.push(d.x,d.y,d.z),h.x=e*Math.cos(f),h.y=e*Math.sin(f),p.subVectors(d,h).normalize(),c.push(p.x,p.y,p.z),u.push(o/n),u.push(a/r)}for(a=1;a<=r;a++)for(o=1;o<=n;o++){var v=(n+1)*a+o-1,g=(n+1)*(a-1)+o-1,y=(n+1)*(a-1)+o,x=(n+1)*a+o;s.push(v,g,x),s.push(g,y,x)}this.setIndex(s),this.setAttribute("position",new yi(l,3)),this.setAttribute("normal",new yi(c,3)),this.setAttribute("uv",new yi(u,2))}bl.prototype=Object.assign(Object.create(un.prototype),{constructor:bl,isPoints:!0,raycast:function(e,t){var r=this.geometry,n=this.matrixWorld,i=e.params.Points.threshold;if(null===r.boundingSphere&&r.computeBoundingSphere(),yl.copy(r.boundingSphere),yl.applyMatrix4(n),yl.radius+=i,!1!==e.ray.intersectsSphere(yl)){vl.getInverse(n),gl.copy(e.ray).applyMatrix4(vl);var a=i/((this.scale.x+this.scale.y+this.scale.z)/3),o=a*a;if(r.isBufferGeometry){var s=r.index,l=r.attributes.position.array;if(null!==s)for(var c=s.array,u=0,h=c.length;u<h;u++){var d=c[u];xl.fromArray(l,3*d),Al(xl,d,o,n,e,t,this)}else{u=0;for(var p=l.length/3;u<p;u++)xl.fromArray(l,3*u),Al(xl,u,o,n,e,t,this)}}else{var f=r.vertices;for(u=0,p=f.length;u<p;u++)Al(f[u],u,o,n,e,t,this)}}},updateMorphTargets:function(){var e,t,r,n=this.geometry;if(n.isBufferGeometry){var i=n.morphAttributes,a=Object.keys(i);if(a.length>0){var o=i[a[0]];if(void 0!==o)for(this.morphTargetInfluences=[],this.morphTargetDictionary={},e=0,t=o.length;e<t;e++)r=o[e].name||String(e),this.morphTargetInfluences.push(0),this.morphTargetDictionary[r]=e}}else{var s=n.morphTargets;void 0!==s&&s.length>0&&console.error("THREE.Points.updateMorphTargets() does not support THREE.Geometry. Use THREE.BufferGeometry instead.")}},clone:function(){return new this.constructor(this.geometry,this.material).copy(this)}}),wl.prototype=Object.assign(Object.create(Or.prototype),{constructor:wl,isVideoTexture:!0,update:function(){var e=this.image;e.readyState>=e.HAVE_CURRENT_DATA&&(this.needsUpdate=!0)}}),_l.prototype=Object.create(Or.prototype),_l.prototype.constructor=_l,_l.prototype.isCompressedTexture=!0,Ml.prototype=Object.create(Or.prototype),Ml.prototype.constructor=Ml,Ml.prototype.isCanvasTexture=!0,Sl.prototype=Object.create(Or.prototype),Sl.prototype.constructor=Sl,Sl.prototype.isDepthTexture=!0,El.prototype=Object.create(Li.prototype),El.prototype.constructor=El,Tl.prototype=Object.create(ea.prototype),Tl.prototype.constructor=Tl,Rl.prototype=Object.create(Li.prototype),Rl.prototype.constructor=Rl,Ll.prototype=Object.create(ea.prototype),Ll.prototype.constructor=Ll,Cl.prototype=Object.create(Li.prototype),Cl.prototype.constructor=Cl,Pl.prototype=Object.create(ea.prototype),Pl.prototype.constructor=Pl,Dl.prototype=Object.create(Cl.prototype),Dl.prototype.constructor=Dl,Il.prototype=Object.create(ea.prototype),Il.prototype.constructor=Il,Ol.prototype=Object.create(Cl.prototype),Ol.prototype.constructor=Ol,Bl.prototype=Object.create(ea.prototype),Bl.prototype.constructor=Bl,Fl.prototype=Object.create(Cl.prototype),Fl.prototype.constructor=Fl,Ul.prototype=Object.create(ea.prototype),Ul.prototype.constructor=Ul,Nl.prototype=Object.create(Cl.prototype),Nl.prototype.constructor=Nl,Gl.prototype=Object.create(ea.prototype),Gl.prototype.constructor=Gl,zl.prototype=Object.create(Li.prototype),zl.prototype.constructor=zl,zl.prototype.toJSON=function(){var e=Li.prototype.toJSON.call(this);return e.path=this.parameters.path.toJSON(),e},kl.prototype=Object.create(ea.prototype),kl.prototype.constructor=kl,Hl.prototype=Object.create(Li.prototype),Hl.prototype.constructor=Hl,Vl.prototype=Object.create(ea.prototype),Vl.prototype.constructor=Vl,jl.prototype=Object.create(Li.prototype),jl.prototype.constructor=jl;var Wl=function(e,t,r){r=r||2;var n,i,a,o,s,l,c,u=t&&t.length,h=u?t[0]*r:e.length,d=ql(e,0,h,r,!0),p=[];if(!d||d.next===d.prev)return p;if(u&&(d=function(e,t,r,n){var i,a,o,s,l,c=[];for(i=0,a=t.length;i<a;i++)o=t[i]*n,s=i<a-1?t[i+1]*n:e.length,(l=ql(e,o,s,n,!1))===l.next&&(l.steiner=!0),c.push(rc(l));for(c.sort($l),i=0;i<c.length;i++)ec(c[i],r),r=Xl(r,r.next);return r}(e,t,d,r)),e.length>80*r){n=a=e[0],i=o=e[1];for(var f=r;f<h;f+=r)(s=e[f])<n&&(n=s),(l=e[f+1])<i&&(i=l),s>a&&(a=s),l>o&&(o=l);c=0!==(c=Math.max(a-n,o-i))?1/c:0}return Yl(d,p,r,n,i,c),p};function ql(e,t,r,n,i){var a,o;if(i===function(e,t,r,n){for(var i=0,a=t,o=r-n;a<r;a+=n)i+=(e[o]-e[a])*(e[a+1]+e[o+1]),o=a;return i}(e,t,r,n)>0)for(a=t;a<r;a+=n)o=uc(a,e[a],e[a+1],o);else for(a=r-n;a>=t;a-=n)o=uc(a,e[a],e[a+1],o);return o&&oc(o,o.next)&&(hc(o),o=o.next),o}function Xl(e,t){if(!e)return e;t||(t=e);var r,n=e;do{if(r=!1,n.steiner||!oc(n,n.next)&&0!==ac(n.prev,n,n.next))n=n.next;else{if(hc(n),(n=t=n.prev)===n.next)break;r=!0}}while(r||n!==t);return t}function Yl(e,t,r,n,i,a,o){if(e){!o&&a&&function(e,t,r,n){var i=e;do{null===i.z&&(i.z=tc(i.x,i.y,t,r,n)),i.prevZ=i.prev,i.nextZ=i.next,i=i.next}while(i!==e);i.prevZ.nextZ=null,i.prevZ=null,function(e){var t,r,n,i,a,o,s,l,c=1;do{for(r=e,e=null,a=null,o=0;r;){for(o++,n=r,s=0,t=0;t<c&&(s++,n=n.nextZ);t++);for(l=c;s>0||l>0&&n;)0!==s&&(0===l||!n||r.z<=n.z)?(i=r,r=r.nextZ,s--):(i=n,n=n.nextZ,l--),a?a.nextZ=i:e=i,i.prevZ=a,a=i;r=n}a.nextZ=null,c*=2}while(o>1)}(i)}(e,n,i,a);for(var s,l,c=e;e.prev!==e.next;)if(s=e.prev,l=e.next,a?Zl(e,n,i,a):Ql(e))t.push(s.i/r),t.push(e.i/r),t.push(l.i/r),hc(e),e=l.next,c=l.next;else if((e=l)===c){o?1===o?Yl(e=Jl(e,t,r),t,r,n,i,a,2):2===o&&Kl(e,t,r,n,i,a):Yl(Xl(e),t,r,n,i,a,1);break}}}function Ql(e){var t=e.prev,r=e,n=e.next;if(ac(t,r,n)>=0)return!1;for(var i=e.next.next;i!==e.prev;){if(nc(t.x,t.y,r.x,r.y,n.x,n.y,i.x,i.y)&&ac(i.prev,i,i.next)>=0)return!1;i=i.next}return!0}function Zl(e,t,r,n){var i=e.prev,a=e,o=e.next;if(ac(i,a,o)>=0)return!1;for(var s=i.x<a.x?i.x<o.x?i.x:o.x:a.x<o.x?a.x:o.x,l=i.y<a.y?i.y<o.y?i.y:o.y:a.y<o.y?a.y:o.y,c=i.x>a.x?i.x>o.x?i.x:o.x:a.x>o.x?a.x:o.x,u=i.y>a.y?i.y>o.y?i.y:o.y:a.y>o.y?a.y:o.y,h=tc(s,l,t,r,n),d=tc(c,u,t,r,n),p=e.prevZ,f=e.nextZ;p&&p.z>=h&&f&&f.z<=d;){if(p!==e.prev&&p!==e.next&&nc(i.x,i.y,a.x,a.y,o.x,o.y,p.x,p.y)&&ac(p.prev,p,p.next)>=0)return!1;if(p=p.prevZ,f!==e.prev&&f!==e.next&&nc(i.x,i.y,a.x,a.y,o.x,o.y,f.x,f.y)&&ac(f.prev,f,f.next)>=0)return!1;f=f.nextZ}for(;p&&p.z>=h;){if(p!==e.prev&&p!==e.next&&nc(i.x,i.y,a.x,a.y,o.x,o.y,p.x,p.y)&&ac(p.prev,p,p.next)>=0)return!1;p=p.prevZ}for(;f&&f.z<=d;){if(f!==e.prev&&f!==e.next&&nc(i.x,i.y,a.x,a.y,o.x,o.y,f.x,f.y)&&ac(f.prev,f,f.next)>=0)return!1;f=f.nextZ}return!0}function Jl(e,t,r){var n=e;do{var i=n.prev,a=n.next.next;!oc(i,a)&&sc(i,n,n.next,a)&&lc(i,a)&&lc(a,i)&&(t.push(i.i/r),t.push(n.i/r),t.push(a.i/r),hc(n),hc(n.next),n=e=a),n=n.next}while(n!==e);return n}function Kl(e,t,r,n,i,a){var o=e;do{for(var s=o.next.next;s!==o.prev;){if(o.i!==s.i&&ic(o,s)){var l=cc(o,s);return o=Xl(o,o.next),l=Xl(l,l.next),Yl(o,t,r,n,i,a),void Yl(l,t,r,n,i,a)}s=s.next}o=o.next}while(o!==e)}function $l(e,t){return e.x-t.x}function ec(e,t){if(t=function(e,t){var r,n=t,i=e.x,a=e.y,o=-1/0;do{if(a<=n.y&&a>=n.next.y&&n.next.y!==n.y){var s=n.x+(a-n.y)*(n.next.x-n.x)/(n.next.y-n.y);if(s<=i&&s>o){if(o=s,s===i){if(a===n.y)return n;if(a===n.next.y)return n.next}r=n.x<n.next.x?n:n.next}}n=n.next}while(n!==t);if(!r)return null;if(i===o)return r.prev;var l,c=r,u=r.x,h=r.y,d=1/0;n=r.next;for(;n!==c;)i>=n.x&&n.x>=u&&i!==n.x&&nc(a<h?i:o,a,u,h,a<h?o:i,a,n.x,n.y)&&((l=Math.abs(a-n.y)/(i-n.x))<d||l===d&&n.x>r.x)&&lc(n,e)&&(r=n,d=l),n=n.next;return r}(e,t)){var r=cc(t,e);Xl(r,r.next)}}function tc(e,t,r,n,i){return(e=1431655765&((e=858993459&((e=252645135&((e=16711935&((e=32767*(e-r)*i)|e<<8))|e<<4))|e<<2))|e<<1))|(t=1431655765&((t=858993459&((t=252645135&((t=16711935&((t=32767*(t-n)*i)|t<<8))|t<<4))|t<<2))|t<<1))<<1}function rc(e){var t=e,r=e;do{(t.x<r.x||t.x===r.x&&t.y<r.y)&&(r=t),t=t.next}while(t!==e);return r}function nc(e,t,r,n,i,a,o,s){return(i-o)*(t-s)-(e-o)*(a-s)>=0&&(e-o)*(n-s)-(r-o)*(t-s)>=0&&(r-o)*(a-s)-(i-o)*(n-s)>=0}function ic(e,t){return e.next.i!==t.i&&e.prev.i!==t.i&&!function(e,t){var r=e;do{if(r.i!==e.i&&r.next.i!==e.i&&r.i!==t.i&&r.next.i!==t.i&&sc(r,r.next,e,t))return!0;r=r.next}while(r!==e);return!1}(e,t)&&lc(e,t)&&lc(t,e)&&function(e,t){var r=e,n=!1,i=(e.x+t.x)/2,a=(e.y+t.y)/2;do{r.y>a!=r.next.y>a&&r.next.y!==r.y&&i<(r.next.x-r.x)*(a-r.y)/(r.next.y-r.y)+r.x&&(n=!n),r=r.next}while(r!==e);return n}(e,t)}function ac(e,t,r){return(t.y-e.y)*(r.x-t.x)-(t.x-e.x)*(r.y-t.y)}function oc(e,t){return e.x===t.x&&e.y===t.y}function sc(e,t,r,n){return!!(oc(e,r)&&oc(t,n)||oc(e,n)&&oc(r,t))||ac(e,t,r)>0!=ac(e,t,n)>0&&ac(r,n,e)>0!=ac(r,n,t)>0}function lc(e,t){return ac(e.prev,e,e.next)<0?ac(e,t,e.next)>=0&&ac(e,e.prev,t)>=0:ac(e,t,e.prev)<0||ac(e,e.next,t)<0}function cc(e,t){var r=new dc(e.i,e.x,e.y),n=new dc(t.i,t.x,t.y),i=e.next,a=t.prev;return e.next=t,t.prev=e,r.next=i,i.prev=r,n.next=r,r.prev=n,a.next=n,n.prev=a,n}function uc(e,t,r,n){var i=new dc(e,t,r);return n?(i.next=n.next,i.prev=n,n.next.prev=i,n.next=i):(i.prev=i,i.next=i),i}function hc(e){e.next.prev=e.prev,e.prev.next=e.next,e.prevZ&&(e.prevZ.nextZ=e.nextZ),e.nextZ&&(e.nextZ.prevZ=e.prevZ)}function dc(e,t,r){this.i=e,this.x=t,this.y=r,this.prev=null,this.next=null,this.z=null,this.prevZ=null,this.nextZ=null,this.steiner=!1}var pc={area:function(e){for(var t=e.length,r=0,n=t-1,i=0;i<t;n=i++)r+=e[n].x*e[i].y-e[i].x*e[n].y;return.5*r},isClockWise:function(e){return pc.area(e)<0},triangulateShape:function(e,t){var r=[],n=[],i=[];fc(e),mc(r,e);var a=e.length;t.forEach(fc);for(var o=0;o<t.length;o++)n.push(a),a+=t[o].length,mc(r,t[o]);var s=Wl(r,n);for(o=0;o<s.length;o+=3)i.push(s.slice(o,o+3));return i}};function fc(e){var t=e.length;t>2&&e[t-1].equals(e[0])&&e.pop()}function mc(e,t){for(var r=0;r<t.length;r++)e.push(t[r].x),e.push(t[r].y)}function vc(e,t){ea.call(this),this.type="ExtrudeGeometry",this.parameters={shapes:e,options:t},this.fromBufferGeometry(new gc(e,t)),this.mergeVertices()}function gc(e,t){Li.call(this),this.type="ExtrudeBufferGeometry",this.parameters={shapes:e,options:t},e=Array.isArray(e)?e:[e];for(var r=this,n=[],i=[],a=0,o=e.length;a<o;a++){s(e[a])}function s(e){var a=[],o=void 0!==t.curveSegments?t.curveSegments:12,s=void 0!==t.steps?t.steps:1,l=void 0!==t.depth?t.depth:100,c=void 0===t.bevelEnabled||t.bevelEnabled,u=void 0!==t.bevelThickness?t.bevelThickness:6,h=void 0!==t.bevelSize?t.bevelSize:u-2,d=void 0!==t.bevelOffset?t.bevelOffset:0,p=void 0!==t.bevelSegments?t.bevelSegments:3,f=t.extrudePath,m=void 0!==t.UVGenerator?t.UVGenerator:yc;void 0!==t.amount&&(console.warn("THREE.ExtrudeBufferGeometry: amount has been renamed to depth."),l=t.amount);var v,g,y,x,b,A,w,_,M=!1;f&&(v=f.getSpacedPoints(s),M=!0,c=!1,g=f.computeFrenetFrames(s,!1),y=new Rr,x=new Rr,b=new Rr),c||(p=0,u=0,h=0,d=0);var S=e.extractPoints(o),E=S.shape,T=S.holes;if(!pc.isClockWise(E))for(E=E.reverse(),w=0,_=T.length;w<_;w++)A=T[w],pc.isClockWise(A)&&(T[w]=A.reverse());var R=pc.triangulateShape(E,T),L=E;for(w=0,_=T.length;w<_;w++)A=T[w],E=E.concat(A);function C(e,t,r){return t||console.error("THREE.ExtrudeGeometry: vec does not exist"),t.clone().multiplyScalar(r).add(e)}var P,D,I,O,B,F,U=E.length,N=R.length;function G(e,t,r){var n,i,a,o=e.x-t.x,s=e.y-t.y,l=r.x-e.x,c=r.y-e.y,u=o*o+s*s,h=o*c-s*l;if(Math.abs(h)>Number.EPSILON){var d=Math.sqrt(u),p=Math.sqrt(l*l+c*c),f=t.x-s/d,m=t.y+o/d,v=((r.x-c/p-f)*c-(r.y+l/p-m)*l)/(o*c-s*l),g=(n=f+o*v-e.x)*n+(i=m+s*v-e.y)*i;if(g<=2)return new Mr(n,i);a=Math.sqrt(g/2)}else{var y=!1;o>Number.EPSILON?l>Number.EPSILON&&(y=!0):o<-Number.EPSILON?l<-Number.EPSILON&&(y=!0):Math.sign(s)===Math.sign(c)&&(y=!0),y?(n=-s,i=o,a=Math.sqrt(u)):(n=o,i=s,a=Math.sqrt(u/2))}return new Mr(n/a,i/a)}for(var z=[],k=0,H=L.length,V=H-1,j=k+1;k<H;k++,V++,j++)V===H&&(V=0),j===H&&(j=0),z[k]=G(L[k],L[V],L[j]);var W,q,X=[],Y=z.concat();for(w=0,_=T.length;w<_;w++){for(A=T[w],W=[],k=0,V=(H=A.length)-1,j=k+1;k<H;k++,V++,j++)V===H&&(V=0),j===H&&(j=0),W[k]=G(A[k],A[V],A[j]);X.push(W),Y=Y.concat(W)}for(P=0;P<p;P++){for(I=P/p,O=u*Math.cos(I*Math.PI/2),D=h*Math.sin(I*Math.PI/2)+d,k=0,H=L.length;k<H;k++)Z((B=C(L[k],z[k],D)).x,B.y,-O);for(w=0,_=T.length;w<_;w++)for(A=T[w],W=X[w],k=0,H=A.length;k<H;k++)Z((B=C(A[k],W[k],D)).x,B.y,-O)}for(D=h+d,k=0;k<U;k++)B=c?C(E[k],Y[k],D):E[k],M?(x.copy(g.normals[0]).multiplyScalar(B.x),y.copy(g.binormals[0]).multiplyScalar(B.y),b.copy(v[0]).add(x).add(y),Z(b.x,b.y,b.z)):Z(B.x,B.y,0);for(q=1;q<=s;q++)for(k=0;k<U;k++)B=c?C(E[k],Y[k],D):E[k],M?(x.copy(g.normals[q]).multiplyScalar(B.x),y.copy(g.binormals[q]).multiplyScalar(B.y),b.copy(v[q]).add(x).add(y),Z(b.x,b.y,b.z)):Z(B.x,B.y,l/s*q);for(P=p-1;P>=0;P--){for(I=P/p,O=u*Math.cos(I*Math.PI/2),D=h*Math.sin(I*Math.PI/2)+d,k=0,H=L.length;k<H;k++)Z((B=C(L[k],z[k],D)).x,B.y,l+O);for(w=0,_=T.length;w<_;w++)for(A=T[w],W=X[w],k=0,H=A.length;k<H;k++)B=C(A[k],W[k],D),M?Z(B.x,B.y+v[s-1].y,v[s-1].x+O):Z(B.x,B.y,l+O)}function Q(e,t){var r,n;for(k=e.length;--k>=0;){r=k,(n=k-1)<0&&(n=e.length-1);var i=0,a=s+2*p;for(i=0;i<a;i++){var o=U*i,l=U*(i+1);K(t+r+o,t+n+o,t+n+l,t+r+l)}}}function Z(e,t,r){a.push(e),a.push(t),a.push(r)}function J(e,t,i){$(e),$(t),$(i);var a=n.length/3,o=m.generateTopUV(r,n,a-3,a-2,a-1);ee(o[0]),ee(o[1]),ee(o[2])}function K(e,t,i,a){$(e),$(t),$(a),$(t),$(i),$(a);var o=n.length/3,s=m.generateSideWallUV(r,n,o-6,o-3,o-2,o-1);ee(s[0]),ee(s[1]),ee(s[3]),ee(s[1]),ee(s[2]),ee(s[3])}function $(e){n.push(a[3*e+0]),n.push(a[3*e+1]),n.push(a[3*e+2])}function ee(e){i.push(e.x),i.push(e.y)}!function(){var e=n.length/3;if(c){var t=0,i=U*t;for(k=0;k<N;k++)J((F=R[k])[2]+i,F[1]+i,F[0]+i);for(i=U*(t=s+2*p),k=0;k<N;k++)J((F=R[k])[0]+i,F[1]+i,F[2]+i)}else{for(k=0;k<N;k++)J((F=R[k])[2],F[1],F[0]);for(k=0;k<N;k++)J((F=R[k])[0]+U*s,F[1]+U*s,F[2]+U*s)}r.addGroup(e,n.length/3-e,0)}(),function(){var e=n.length/3,t=0;for(Q(L,t),t+=L.length,w=0,_=T.length;w<_;w++)Q(A=T[w],t),t+=A.length;r.addGroup(e,n.length/3-e,1)}()}this.setAttribute("position",new yi(n,3)),this.setAttribute("uv",new yi(i,2)),this.computeVertexNormals()}vc.prototype=Object.create(ea.prototype),vc.prototype.constructor=vc,vc.prototype.toJSON=function(){var e=ea.prototype.toJSON.call(this);return xc(this.parameters.shapes,this.parameters.options,e)},gc.prototype=Object.create(Li.prototype),gc.prototype.constructor=gc,gc.prototype.toJSON=function(){var e=Li.prototype.toJSON.call(this);return xc(this.parameters.shapes,this.parameters.options,e)};var yc={generateTopUV:function(e,t,r,n,i){var a=t[3*r],o=t[3*r+1],s=t[3*n],l=t[3*n+1],c=t[3*i],u=t[3*i+1];return[new Mr(a,o),new Mr(s,l),new Mr(c,u)]},generateSideWallUV:function(e,t,r,n,i,a){var o=t[3*r],s=t[3*r+1],l=t[3*r+2],c=t[3*n],u=t[3*n+1],h=t[3*n+2],d=t[3*i],p=t[3*i+1],f=t[3*i+2],m=t[3*a],v=t[3*a+1],g=t[3*a+2];return Math.abs(s-u)<.01?[new Mr(o,1-l),new Mr(c,1-h),new Mr(d,1-f),new Mr(m,1-g)]:[new Mr(s,1-l),new Mr(u,1-h),new Mr(p,1-f),new Mr(v,1-g)]}};function xc(e,t,r){if(r.shapes=[],Array.isArray(e))for(var n=0,i=e.length;n<i;n++){var a=e[n];r.shapes.push(a.uuid)}else r.shapes.push(e.uuid);return void 0!==t.extrudePath&&(r.options.extrudePath=t.extrudePath.toJSON()),r}function bc(e,t){ea.call(this),this.type="TextGeometry",this.parameters={text:e,parameters:t},this.fromBufferGeometry(new Ac(e,t)),this.mergeVertices()}function Ac(e,t){var r=(t=t||{}).font;if(!r||!r.isFont)return console.error("THREE.TextGeometry: font parameter is not an instance of THREE.Font."),new ea;var n=r.generateShapes(e,t.size);t.depth=void 0!==t.height?t.height:50,void 0===t.bevelThickness&&(t.bevelThickness=10),void 0===t.bevelSize&&(t.bevelSize=8),void 0===t.bevelEnabled&&(t.bevelEnabled=!1),gc.call(this,n,t),this.type="TextBufferGeometry"}function wc(e,t,r,n,i,a,o){ea.call(this),this.type="SphereGeometry",this.parameters={radius:e,widthSegments:t,heightSegments:r,phiStart:n,phiLength:i,thetaStart:a,thetaLength:o},this.fromBufferGeometry(new _c(e,t,r,n,i,a,o)),this.mergeVertices()}function _c(e,t,r,n,i,a,o){Li.call(this),this.type="SphereBufferGeometry",this.parameters={radius:e,widthSegments:t,heightSegments:r,phiStart:n,phiLength:i,thetaStart:a,thetaLength:o},e=e||1,t=Math.max(3,Math.floor(t)||8),r=Math.max(2,Math.floor(r)||6),n=void 0!==n?n:0,i=void 0!==i?i:2*Math.PI,a=void 0!==a?a:0,o=void 0!==o?o:Math.PI;var s,l,c=Math.min(a+o,Math.PI),u=0,h=[],d=new Rr,p=new Rr,f=[],m=[],v=[],g=[];for(l=0;l<=r;l++){var y=[],x=l/r,b=0;for(0==l&&0==a?b=.5/t:l==r&&c==Math.PI&&(b=-.5/t),s=0;s<=t;s++){var A=s/t;d.x=-e*Math.cos(n+A*i)*Math.sin(a+x*o),d.y=e*Math.cos(a+x*o),d.z=e*Math.sin(n+A*i)*Math.sin(a+x*o),m.push(d.x,d.y,d.z),p.copy(d).normalize(),v.push(p.x,p.y,p.z),g.push(A+b,1-x),y.push(u++)}h.push(y)}for(l=0;l<r;l++)for(s=0;s<t;s++){var w=h[l][s+1],_=h[l][s],M=h[l+1][s],S=h[l+1][s+1];(0!==l||a>0)&&f.push(w,_,S),(l!==r-1||c<Math.PI)&&f.push(_,M,S)}this.setIndex(f),this.setAttribute("position",new yi(m,3)),this.setAttribute("normal",new yi(v,3)),this.setAttribute("uv",new yi(g,2))}function Mc(e,t,r,n,i,a){ea.call(this),this.type="RingGeometry",this.parameters={innerRadius:e,outerRadius:t,thetaSegments:r,phiSegments:n,thetaStart:i,thetaLength:a},this.fromBufferGeometry(new Sc(e,t,r,n,i,a)),this.mergeVertices()}function Sc(e,t,r,n,i,a){Li.call(this),this.type="RingBufferGeometry",this.parameters={innerRadius:e,outerRadius:t,thetaSegments:r,phiSegments:n,thetaStart:i,thetaLength:a},e=e||.5,t=t||1,i=void 0!==i?i:0,a=void 0!==a?a:2*Math.PI,r=void 0!==r?Math.max(3,r):8;var o,s,l,c=[],u=[],h=[],d=[],p=e,f=(t-e)/(n=void 0!==n?Math.max(1,n):1),m=new Rr,v=new Mr;for(s=0;s<=n;s++){for(l=0;l<=r;l++)o=i+l/r*a,m.x=p*Math.cos(o),m.y=p*Math.sin(o),u.push(m.x,m.y,m.z),h.push(0,0,1),v.x=(m.x/t+1)/2,v.y=(m.y/t+1)/2,d.push(v.x,v.y);p+=f}for(s=0;s<n;s++){var g=s*(r+1);for(l=0;l<r;l++){var y=o=l+g,x=o+r+1,b=o+r+2,A=o+1;c.push(y,x,A),c.push(x,b,A)}}this.setIndex(c),this.setAttribute("position",new yi(u,3)),this.setAttribute("normal",new yi(h,3)),this.setAttribute("uv",new yi(d,2))}function Ec(e,t,r,n){ea.call(this),this.type="LatheGeometry",this.parameters={points:e,segments:t,phiStart:r,phiLength:n},this.fromBufferGeometry(new Tc(e,t,r,n)),this.mergeVertices()}function Tc(e,t,r,n){Li.call(this),this.type="LatheBufferGeometry",this.parameters={points:e,segments:t,phiStart:r,phiLength:n},t=Math.floor(t)||12,r=r||0,n=n||2*Math.PI,n=_r.clamp(n,0,2*Math.PI);var i,a,o,s=[],l=[],c=[],u=1/t,h=new Rr,d=new Mr;for(a=0;a<=t;a++){var p=r+a*u*n,f=Math.sin(p),m=Math.cos(p);for(o=0;o<=e.length-1;o++)h.x=e[o].x*f,h.y=e[o].y,h.z=e[o].x*m,l.push(h.x,h.y,h.z),d.x=a/t,d.y=o/(e.length-1),c.push(d.x,d.y)}for(a=0;a<t;a++)for(o=0;o<e.length-1;o++){var v=i=o+a*e.length,g=i+e.length,y=i+e.length+1,x=i+1;s.push(v,g,x),s.push(g,y,x)}if(this.setIndex(s),this.setAttribute("position",new yi(l,3)),this.setAttribute("uv",new yi(c,2)),this.computeVertexNormals(),n===2*Math.PI){var b=this.attributes.normal.array,A=new Rr,w=new Rr,_=new Rr;for(i=t*e.length*3,a=0,o=0;a<e.length;a++,o+=3)A.x=b[o+0],A.y=b[o+1],A.z=b[o+2],w.x=b[i+o+0],w.y=b[i+o+1],w.z=b[i+o+2],_.addVectors(A,w).normalize(),b[o+0]=b[i+o+0]=_.x,b[o+1]=b[i+o+1]=_.y,b[o+2]=b[i+o+2]=_.z}}function Rc(e,t){ea.call(this),this.type="ShapeGeometry","object"==typeof t&&(console.warn("THREE.ShapeGeometry: Options parameter has been removed."),t=t.curveSegments),this.parameters={shapes:e,curveSegments:t},this.fromBufferGeometry(new Lc(e,t)),this.mergeVertices()}function Lc(e,t){Li.call(this),this.type="ShapeBufferGeometry",this.parameters={shapes:e,curveSegments:t},t=t||12;var r=[],n=[],i=[],a=[],o=0,s=0;if(!1===Array.isArray(e))c(e);else for(var l=0;l<e.length;l++)c(e[l]),this.addGroup(o,s,l),o+=s,s=0;function c(e){var o,l,c,u=n.length/3,h=e.extractPoints(t),d=h.shape,p=h.holes;for(!1===pc.isClockWise(d)&&(d=d.reverse()),o=0,l=p.length;o<l;o++)c=p[o],!0===pc.isClockWise(c)&&(p[o]=c.reverse());var f=pc.triangulateShape(d,p);for(o=0,l=p.length;o<l;o++)c=p[o],d=d.concat(c);for(o=0,l=d.length;o<l;o++){var m=d[o];n.push(m.x,m.y,0),i.push(0,0,1),a.push(m.x,m.y)}for(o=0,l=f.length;o<l;o++){var v=f[o],g=v[0]+u,y=v[1]+u,x=v[2]+u;r.push(g,y,x),s+=3}}this.setIndex(r),this.setAttribute("position",new yi(n,3)),this.setAttribute("normal",new yi(i,3)),this.setAttribute("uv",new yi(a,2))}function Cc(e,t){if(t.shapes=[],Array.isArray(e))for(var r=0,n=e.length;r<n;r++){var i=e[r];t.shapes.push(i.uuid)}else t.shapes.push(e.uuid);return t}function Pc(e,t){Li.call(this),this.type="EdgesGeometry",this.parameters={thresholdAngle:t},t=void 0!==t?t:1;var r,n,i,a,o=[],s=Math.cos(_r.DEG2RAD*t),l=[0,0],c={},u=["a","b","c"];e.isBufferGeometry?(a=new ea).fromBufferGeometry(e):a=e.clone(),a.mergeVertices(),a.computeFaceNormals();for(var h=a.vertices,d=a.faces,p=0,f=d.length;p<f;p++)for(var m=d[p],v=0;v<3;v++)r=m[u[v]],n=m[u[(v+1)%3]],l[0]=Math.min(r,n),l[1]=Math.max(r,n),void 0===c[i=l[0]+","+l[1]]?c[i]={index1:l[0],index2:l[1],face1:p,face2:void 0}:c[i].face2=p;for(i in c){var g=c[i];if(void 0===g.face2||d[g.face1].normal.dot(d[g.face2].normal)<=s){var y=h[g.index1];o.push(y.x,y.y,y.z),y=h[g.index2],o.push(y.x,y.y,y.z)}}this.setAttribute("position",new yi(o,3))}function Dc(e,t,r,n,i,a,o,s){ea.call(this),this.type="CylinderGeometry",this.parameters={radiusTop:e,radiusBottom:t,height:r,radialSegments:n,heightSegments:i,openEnded:a,thetaStart:o,thetaLength:s},this.fromBufferGeometry(new Ic(e,t,r,n,i,a,o,s)),this.mergeVertices()}function Ic(e,t,r,n,i,a,o,s){Li.call(this),this.type="CylinderBufferGeometry",this.parameters={radiusTop:e,radiusBottom:t,height:r,radialSegments:n,heightSegments:i,openEnded:a,thetaStart:o,thetaLength:s};var l=this;e=void 0!==e?e:1,t=void 0!==t?t:1,r=r||1,n=Math.floor(n)||8,i=Math.floor(i)||1,a=void 0!==a&&a,o=void 0!==o?o:0,s=void 0!==s?s:2*Math.PI;var c=[],u=[],h=[],d=[],p=0,f=[],m=r/2,v=0;function g(r){var i,a,f,g=new Mr,y=new Rr,x=0,b=!0===r?e:t,A=!0===r?1:-1;for(a=p,i=1;i<=n;i++)u.push(0,m*A,0),h.push(0,A,0),d.push(.5,.5),p++;for(f=p,i=0;i<=n;i++){var w=i/n*s+o,_=Math.cos(w),M=Math.sin(w);y.x=b*M,y.y=m*A,y.z=b*_,u.push(y.x,y.y,y.z),h.push(0,A,0),g.x=.5*_+.5,g.y=.5*M*A+.5,d.push(g.x,g.y),p++}for(i=0;i<n;i++){var S=a+i,E=f+i;!0===r?c.push(E,E+1,S):c.push(E+1,E,S),x+=3}l.addGroup(v,x,!0===r?1:2),v+=x}!function(){var a,g,y=new Rr,x=new Rr,b=0,A=(t-e)/r;for(g=0;g<=i;g++){var w=[],_=g/i,M=_*(t-e)+e;for(a=0;a<=n;a++){var S=a/n,E=S*s+o,T=Math.sin(E),R=Math.cos(E);x.x=M*T,x.y=-_*r+m,x.z=M*R,u.push(x.x,x.y,x.z),y.set(T,A,R).normalize(),h.push(y.x,y.y,y.z),d.push(S,1-_),w.push(p++)}f.push(w)}for(a=0;a<n;a++)for(g=0;g<i;g++){var L=f[g][a],C=f[g+1][a],P=f[g+1][a+1],D=f[g][a+1];c.push(L,C,D),c.push(C,P,D),b+=6}l.addGroup(v,b,0),v+=b}(),!1===a&&(e>0&&g(!0),t>0&&g(!1)),this.setIndex(c),this.setAttribute("position",new yi(u,3)),this.setAttribute("normal",new yi(h,3)),this.setAttribute("uv",new yi(d,2))}function Oc(e,t,r,n,i,a,o){Dc.call(this,0,e,t,r,n,i,a,o),this.type="ConeGeometry",this.parameters={radius:e,height:t,radialSegments:r,heightSegments:n,openEnded:i,thetaStart:a,thetaLength:o}}function Bc(e,t,r,n,i,a,o){Ic.call(this,0,e,t,r,n,i,a,o),this.type="ConeBufferGeometry",this.parameters={radius:e,height:t,radialSegments:r,heightSegments:n,openEnded:i,thetaStart:a,thetaLength:o}}function Fc(e,t,r,n){ea.call(this),this.type="CircleGeometry",this.parameters={radius:e,segments:t,thetaStart:r,thetaLength:n},this.fromBufferGeometry(new Uc(e,t,r,n)),this.mergeVertices()}function Uc(e,t,r,n){Li.call(this),this.type="CircleBufferGeometry",this.parameters={radius:e,segments:t,thetaStart:r,thetaLength:n},e=e||1,t=void 0!==t?Math.max(3,t):8,r=void 0!==r?r:0,n=void 0!==n?n:2*Math.PI;var i,a,o=[],s=[],l=[],c=[],u=new Rr,h=new Mr;for(s.push(0,0,0),l.push(0,0,1),c.push(.5,.5),a=0,i=3;a<=t;a++,i+=3){var d=r+a/t*n;u.x=e*Math.cos(d),u.y=e*Math.sin(d),s.push(u.x,u.y,u.z),l.push(0,0,1),h.x=(s[i]/e+1)/2,h.y=(s[i+1]/e+1)/2,c.push(h.x,h.y)}for(i=1;i<=t;i++)o.push(i,i+1,0);this.setIndex(o),this.setAttribute("position",new yi(s,3)),this.setAttribute("normal",new yi(l,3)),this.setAttribute("uv",new yi(c,2))}bc.prototype=Object.create(ea.prototype),bc.prototype.constructor=bc,Ac.prototype=Object.create(gc.prototype),Ac.prototype.constructor=Ac,wc.prototype=Object.create(ea.prototype),wc.prototype.constructor=wc,_c.prototype=Object.create(Li.prototype),_c.prototype.constructor=_c,Mc.prototype=Object.create(ea.prototype),Mc.prototype.constructor=Mc,Sc.prototype=Object.create(Li.prototype),Sc.prototype.constructor=Sc,Ec.prototype=Object.create(ea.prototype),Ec.prototype.constructor=Ec,Tc.prototype=Object.create(Li.prototype),Tc.prototype.constructor=Tc,Rc.prototype=Object.create(ea.prototype),Rc.prototype.constructor=Rc,Rc.prototype.toJSON=function(){var e=ea.prototype.toJSON.call(this);return Cc(this.parameters.shapes,e)},Lc.prototype=Object.create(Li.prototype),Lc.prototype.constructor=Lc,Lc.prototype.toJSON=function(){var e=Li.prototype.toJSON.call(this);return Cc(this.parameters.shapes,e)},Pc.prototype=Object.create(Li.prototype),Pc.prototype.constructor=Pc,Dc.prototype=Object.create(ea.prototype),Dc.prototype.constructor=Dc,Ic.prototype=Object.create(Li.prototype),Ic.prototype.constructor=Ic,Oc.prototype=Object.create(Dc.prototype),Oc.prototype.constructor=Oc,Bc.prototype=Object.create(Ic.prototype),Bc.prototype.constructor=Bc,Fc.prototype=Object.create(ea.prototype),Fc.prototype.constructor=Fc,Uc.prototype=Object.create(Li.prototype),Uc.prototype.constructor=Uc;var Nc=Object.freeze({__proto__:null,WireframeGeometry:El,ParametricGeometry:Tl,ParametricBufferGeometry:Rl,TetrahedronGeometry:Pl,TetrahedronBufferGeometry:Dl,OctahedronGeometry:Il,OctahedronBufferGeometry:Ol,IcosahedronGeometry:Bl,IcosahedronBufferGeometry:Fl,DodecahedronGeometry:Ul,DodecahedronBufferGeometry:Nl,PolyhedronGeometry:Ll,PolyhedronBufferGeometry:Cl,TubeGeometry:Gl,TubeBufferGeometry:zl,TorusKnotGeometry:kl,TorusKnotBufferGeometry:Hl,TorusGeometry:Vl,TorusBufferGeometry:jl,TextGeometry:bc,TextBufferGeometry:Ac,SphereGeometry:wc,SphereBufferGeometry:_c,RingGeometry:Mc,RingBufferGeometry:Sc,PlaneGeometry:Ma,PlaneBufferGeometry:Sa,LatheGeometry:Ec,LatheBufferGeometry:Tc,ShapeGeometry:Rc,ShapeBufferGeometry:Lc,ExtrudeGeometry:vc,ExtrudeBufferGeometry:gc,EdgesGeometry:Pc,ConeGeometry:Oc,ConeBufferGeometry:Bc,CylinderGeometry:Dc,CylinderBufferGeometry:Ic,CircleGeometry:Fc,CircleBufferGeometry:Uc,BoxGeometry:ta,BoxBufferGeometry:ra});function Gc(e){si.call(this),this.type="ShadowMaterial",this.color=new ti(0),this.transparent=!0,this.setValues(e)}function zc(e){la.call(this,e),this.type="RawShaderMaterial"}function kc(e){si.call(this),this.defines={STANDARD:""},this.type="MeshStandardMaterial",this.color=new ti(16777215),this.roughness=1,this.metalness=0,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new ti(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=Xt,this.normalScale=new Mr(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.roughnessMap=null,this.metalnessMap=null,this.alphaMap=null,this.envMap=null,this.envMapIntensity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.skinning=!1,this.morphTargets=!1,this.morphNormals=!1,this.setValues(e)}function Hc(e){kc.call(this),this.defines={STANDARD:"",PHYSICAL:""},this.type="MeshPhysicalMaterial",this.reflectivity=.5,this.clearcoat=0,this.clearcoatRoughness=0,this.sheen=null,this.clearcoatNormalScale=new Mr(1,1),this.clearcoatNormalMap=null,this.transparency=0,this.setValues(e)}function Vc(e){si.call(this),this.type="MeshPhongMaterial",this.color=new ti(16777215),this.specular=new ti(1118481),this.shininess=30,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new ti(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=Xt,this.normalScale=new Mr(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.combine=ee,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.skinning=!1,this.morphTargets=!1,this.morphNormals=!1,this.setValues(e)}function jc(e){si.call(this),this.defines={TOON:""},this.type="MeshToonMaterial",this.color=new ti(16777215),this.specular=new ti(1118481),this.shininess=30,this.map=null,this.gradientMap=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new ti(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=Xt,this.normalScale=new Mr(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.skinning=!1,this.morphTargets=!1,this.morphNormals=!1,this.setValues(e)}function Wc(e){si.call(this),this.type="MeshNormalMaterial",this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=Xt,this.normalScale=new Mr(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.wireframe=!1,this.wireframeLinewidth=1,this.fog=!1,this.skinning=!1,this.morphTargets=!1,this.morphNormals=!1,this.setValues(e)}function qc(e){si.call(this),this.type="MeshLambertMaterial",this.color=new ti(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new ti(0),this.emissiveIntensity=1,this.emissiveMap=null,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.combine=ee,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.skinning=!1,this.morphTargets=!1,this.morphNormals=!1,this.setValues(e)}function Xc(e){si.call(this),this.defines={MATCAP:""},this.type="MeshMatcapMaterial",this.color=new ti(16777215),this.matcap=null,this.map=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=Xt,this.normalScale=new Mr(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.alphaMap=null,this.skinning=!1,this.morphTargets=!1,this.morphNormals=!1,this.setValues(e)}function Yc(e){il.call(this),this.type="LineDashedMaterial",this.scale=1,this.dashSize=3,this.gapSize=1,this.setValues(e)}Gc.prototype=Object.create(si.prototype),Gc.prototype.constructor=Gc,Gc.prototype.isShadowMaterial=!0,Gc.prototype.copy=function(e){return si.prototype.copy.call(this,e),this.color.copy(e.color),this},zc.prototype=Object.create(la.prototype),zc.prototype.constructor=zc,zc.prototype.isRawShaderMaterial=!0,kc.prototype=Object.create(si.prototype),kc.prototype.constructor=kc,kc.prototype.isMeshStandardMaterial=!0,kc.prototype.copy=function(e){return si.prototype.copy.call(this,e),this.defines={STANDARD:""},this.color.copy(e.color),this.roughness=e.roughness,this.metalness=e.metalness,this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.roughnessMap=e.roughnessMap,this.metalnessMap=e.metalnessMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.envMapIntensity=e.envMapIntensity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.skinning=e.skinning,this.morphTargets=e.morphTargets,this.morphNormals=e.morphNormals,this},Hc.prototype=Object.create(kc.prototype),Hc.prototype.constructor=Hc,Hc.prototype.isMeshPhysicalMaterial=!0,Hc.prototype.copy=function(e){return kc.prototype.copy.call(this,e),this.defines={STANDARD:"",PHYSICAL:""},this.reflectivity=e.reflectivity,this.clearcoat=e.clearcoat,this.clearcoatRoughness=e.clearcoatRoughness,e.sheen?this.sheen=(this.sheen||new ti).copy(e.sheen):this.sheen=null,this.clearcoatNormalMap=e.clearcoatNormalMap,this.clearcoatNormalScale.copy(e.clearcoatNormalScale),this.transparency=e.transparency,this},Vc.prototype=Object.create(si.prototype),Vc.prototype.constructor=Vc,Vc.prototype.isMeshPhongMaterial=!0,Vc.prototype.copy=function(e){return si.prototype.copy.call(this,e),this.color.copy(e.color),this.specular.copy(e.specular),this.shininess=e.shininess,this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.combine=e.combine,this.reflectivity=e.reflectivity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.skinning=e.skinning,this.morphTargets=e.morphTargets,this.morphNormals=e.morphNormals,this},jc.prototype=Object.create(si.prototype),jc.prototype.constructor=jc,jc.prototype.isMeshToonMaterial=!0,jc.prototype.copy=function(e){return si.prototype.copy.call(this,e),this.color.copy(e.color),this.specular.copy(e.specular),this.shininess=e.shininess,this.map=e.map,this.gradientMap=e.gradientMap,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.skinning=e.skinning,this.morphTargets=e.morphTargets,this.morphNormals=e.morphNormals,this},Wc.prototype=Object.create(si.prototype),Wc.prototype.constructor=Wc,Wc.prototype.isMeshNormalMaterial=!0,Wc.prototype.copy=function(e){return si.prototype.copy.call(this,e),this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.skinning=e.skinning,this.morphTargets=e.morphTargets,this.morphNormals=e.morphNormals,this},qc.prototype=Object.create(si.prototype),qc.prototype.constructor=qc,qc.prototype.isMeshLambertMaterial=!0,qc.prototype.copy=function(e){return si.prototype.copy.call(this,e),this.color.copy(e.color),this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.combine=e.combine,this.reflectivity=e.reflectivity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.skinning=e.skinning,this.morphTargets=e.morphTargets,this.morphNormals=e.morphNormals,this},Xc.prototype=Object.create(si.prototype),Xc.prototype.constructor=Xc,Xc.prototype.isMeshMatcapMaterial=!0,Xc.prototype.copy=function(e){return si.prototype.copy.call(this,e),this.defines={MATCAP:""},this.color.copy(e.color),this.matcap=e.matcap,this.map=e.map,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.alphaMap=e.alphaMap,this.skinning=e.skinning,this.morphTargets=e.morphTargets,this.morphNormals=e.morphNormals,this},Yc.prototype=Object.create(il.prototype),Yc.prototype.constructor=Yc,Yc.prototype.isLineDashedMaterial=!0,Yc.prototype.copy=function(e){return il.prototype.copy.call(this,e),this.scale=e.scale,this.dashSize=e.dashSize,this.gapSize=e.gapSize,this};var Qc=Object.freeze({__proto__:null,ShadowMaterial:Gc,SpriteMaterial:Cs,RawShaderMaterial:zc,ShaderMaterial:la,PointsMaterial:ml,MeshPhysicalMaterial:Hc,MeshStandardMaterial:kc,MeshPhongMaterial:Vc,MeshToonMaterial:jc,MeshNormalMaterial:Wc,MeshLambertMaterial:qc,MeshDepthMaterial:us,MeshDistanceMaterial:hs,MeshBasicMaterial:li,MeshMatcapMaterial:Xc,LineDashedMaterial:Yc,LineBasicMaterial:il,Material:si}),Zc={arraySlice:function(e,t,r){return Zc.isTypedArray(e)?new e.constructor(e.subarray(t,void 0!==r?r:e.length)):e.slice(t,r)},convertArray:function(e,t,r){return!e||!r&&e.constructor===t?e:"number"==typeof t.BYTES_PER_ELEMENT?new t(e):Array.prototype.slice.call(e)},isTypedArray:function(e){return ArrayBuffer.isView(e)&&!(e instanceof DataView)},getKeyframeOrder:function(e){for(var t=e.length,r=new Array(t),n=0;n!==t;++n)r[n]=n;return r.sort((function(t,r){return e[t]-e[r]})),r},sortedArray:function(e,t,r){for(var n=e.length,i=new e.constructor(n),a=0,o=0;o!==n;++a)for(var s=r[a]*t,l=0;l!==t;++l)i[o++]=e[s+l];return i},flattenJSON:function(e,t,r,n){for(var i=1,a=e[0];void 0!==a&&void 0===a[n];)a=e[i++];if(void 0!==a){var o=a[n];if(void 0!==o)if(Array.isArray(o))do{void 0!==(o=a[n])&&(t.push(a.time),r.push.apply(r,o)),a=e[i++]}while(void 0!==a);else if(void 0!==o.toArray)do{void 0!==(o=a[n])&&(t.push(a.time),o.toArray(r,r.length)),a=e[i++]}while(void 0!==a);else do{void 0!==(o=a[n])&&(t.push(a.time),r.push(o)),a=e[i++]}while(void 0!==a)}},subclip:function(e,t,r,n,i){i=i||30;var a=e.clone();a.name=t;for(var o=[],s=0;s<a.tracks.length;++s){for(var l=a.tracks[s],c=l.getValueSize(),u=[],h=[],d=0;d<l.times.length;++d){var p=l.times[d]*i;if(!(p<r||p>=n)){u.push(l.times[d]);for(var f=0;f<c;++f)h.push(l.values[d*c+f])}}0!==u.length&&(l.times=Zc.convertArray(u,l.times.constructor),l.values=Zc.convertArray(h,l.values.constructor),o.push(l))}a.tracks=o;var m=1/0;for(s=0;s<a.tracks.length;++s)m>a.tracks[s].times[0]&&(m=a.tracks[s].times[0]);for(s=0;s<a.tracks.length;++s)a.tracks[s].shift(-1*m);return a.resetDuration(),a}};function Jc(e,t,r,n){this.parameterPositions=e,this._cachedIndex=0,this.resultBuffer=void 0!==n?n:new t.constructor(r),this.sampleValues=t,this.valueSize=r}function Kc(e,t,r,n){Jc.call(this,e,t,r,n),this._weightPrev=-0,this._offsetPrev=-0,this._weightNext=-0,this._offsetNext=-0}function $c(e,t,r,n){Jc.call(this,e,t,r,n)}function eu(e,t,r,n){Jc.call(this,e,t,r,n)}function tu(e,t,r,n){if(void 0===e)throw new Error("THREE.KeyframeTrack: track name is undefined");if(void 0===t||0===t.length)throw new Error("THREE.KeyframeTrack: no keyframes in track named "+e);this.name=e,this.times=Zc.convertArray(t,this.TimeBufferType),this.values=Zc.convertArray(r,this.ValueBufferType),this.setInterpolation(n||this.DefaultInterpolation)}function ru(e,t,r){tu.call(this,e,t,r)}function nu(e,t,r,n){tu.call(this,e,t,r,n)}function iu(e,t,r,n){tu.call(this,e,t,r,n)}function au(e,t,r,n){Jc.call(this,e,t,r,n)}function ou(e,t,r,n){tu.call(this,e,t,r,n)}function su(e,t,r,n){tu.call(this,e,t,r,n)}function lu(e,t,r,n){tu.call(this,e,t,r,n)}function cu(e,t,r){this.name=e,this.tracks=r,this.duration=void 0!==t?t:-1,this.uuid=_r.generateUUID(),this.duration<0&&this.resetDuration()}function uu(e){if(void 0===e.type)throw new Error("THREE.KeyframeTrack: track type undefined, can not parse");var t=function(e){switch(e.toLowerCase()){case"scalar":case"double":case"float":case"number":case"integer":return iu;case"vector":case"vector2":case"vector3":case"vector4":return lu;case"color":return nu;case"quaternion":return ou;case"bool":case"boolean":return ru;case"string":return su}throw new Error("THREE.KeyframeTrack: Unsupported typeName: "+e)}(e.type);if(void 0===e.times){var r=[],n=[];Zc.flattenJSON(e.keys,r,n,"value"),e.times=r,e.values=n}return void 0!==t.parse?t.parse(e):new t(e.name,e.times,e.values,e.interpolation)}Object.assign(Jc.prototype,{evaluate:function(e){var t=this.parameterPositions,r=this._cachedIndex,n=t[r],i=t[r-1];e:{t:{var a;r:{n:if(!(e<n)){for(var o=r+2;;){if(void 0===n){if(e<i)break n;return r=t.length,this._cachedIndex=r,this.afterEnd_(r-1,e,i)}if(r===o)break;if(i=n,e<(n=t[++r]))break t}a=t.length;break r}if(e>=i)break e;var s=t[1];e<s&&(r=2,i=s);for(o=r-2;;){if(void 0===i)return this._cachedIndex=0,this.beforeStart_(0,e,n);if(r===o)break;if(n=i,e>=(i=t[--r-1]))break t}a=r,r=0}for(;r<a;){var l=r+a>>>1;e<t[l]?a=l:r=l+1}if(n=t[r],void 0===(i=t[r-1]))return this._cachedIndex=0,this.beforeStart_(0,e,n);if(void 0===n)return r=t.length,this._cachedIndex=r,this.afterEnd_(r-1,i,e)}this._cachedIndex=r,this.intervalChanged_(r,i,n)}return this.interpolate_(r,i,e,n)},settings:null,DefaultSettings_:{},getSettings_:function(){return this.settings||this.DefaultSettings_},copySampleValue_:function(e){for(var t=this.resultBuffer,r=this.sampleValues,n=this.valueSize,i=e*n,a=0;a!==n;++a)t[a]=r[i+a];return t},interpolate_:function(){throw new Error("call to abstract method")},intervalChanged_:function(){}}),
//!\ DECLARE ALIAS AFTER assign prototype !
Object.assign(Jc.prototype,{beforeStart_:Jc.prototype.copySampleValue_,afterEnd_:Jc.prototype.copySampleValue_}),Kc.prototype=Object.assign(Object.create(Jc.prototype),{constructor:Kc,DefaultSettings_:{endingStart:Pt,endingEnd:Pt},intervalChanged_:function(e,t,r){var n=this.parameterPositions,i=e-2,a=e+1,o=n[i],s=n[a];if(void 0===o)switch(this.getSettings_().endingStart){case Dt:i=e,o=2*t-r;break;case It:o=t+n[i=n.length-2]-n[i+1];break;default:i=e,o=r}if(void 0===s)switch(this.getSettings_().endingEnd){case Dt:a=e,s=2*r-t;break;case It:a=1,s=r+n[1]-n[0];break;default:a=e-1,s=t}var l=.5*(r-t),c=this.valueSize;this._weightPrev=l/(t-o),this._weightNext=l/(s-r),this._offsetPrev=i*c,this._offsetNext=a*c},interpolate_:function(e,t,r,n){for(var i=this.resultBuffer,a=this.sampleValues,o=this.valueSize,s=e*o,l=s-o,c=this._offsetPrev,u=this._offsetNext,h=this._weightPrev,d=this._weightNext,p=(r-t)/(n-t),f=p*p,m=f*p,v=-h*m+2*h*f-h*p,g=(1+h)*m+(-1.5-2*h)*f+(-.5+h)*p+1,y=(-1-d)*m+(1.5+d)*f+.5*p,x=d*m-d*f,b=0;b!==o;++b)i[b]=v*a[c+b]+g*a[l+b]+y*a[s+b]+x*a[u+b];return i}}),$c.prototype=Object.assign(Object.create(Jc.prototype),{constructor:$c,interpolate_:function(e,t,r,n){for(var i=this.resultBuffer,a=this.sampleValues,o=this.valueSize,s=e*o,l=s-o,c=(r-t)/(n-t),u=1-c,h=0;h!==o;++h)i[h]=a[l+h]*u+a[s+h]*c;return i}}),eu.prototype=Object.assign(Object.create(Jc.prototype),{constructor:eu,interpolate_:function(e){return this.copySampleValue_(e-1)}}),Object.assign(tu,{toJSON:function(e){var t,r=e.constructor;if(void 0!==r.toJSON)t=r.toJSON(e);else{t={name:e.name,times:Zc.convertArray(e.times,Array),values:Zc.convertArray(e.values,Array)};var n=e.getInterpolation();n!==e.DefaultInterpolation&&(t.interpolation=n)}return t.type=e.ValueTypeName,t}}),Object.assign(tu.prototype,{constructor:tu,TimeBufferType:Float32Array,ValueBufferType:Float32Array,DefaultInterpolation:Lt,InterpolantFactoryMethodDiscrete:function(e){return new eu(this.times,this.values,this.getValueSize(),e)},InterpolantFactoryMethodLinear:function(e){return new $c(this.times,this.values,this.getValueSize(),e)},InterpolantFactoryMethodSmooth:function(e){return new Kc(this.times,this.values,this.getValueSize(),e)},setInterpolation:function(e){var t;switch(e){case Rt:t=this.InterpolantFactoryMethodDiscrete;break;case Lt:t=this.InterpolantFactoryMethodLinear;break;case Ct:t=this.InterpolantFactoryMethodSmooth}if(void 0===t){var r="unsupported interpolation for "+this.ValueTypeName+" keyframe track named "+this.name;if(void 0===this.createInterpolant){if(e===this.DefaultInterpolation)throw new Error(r);this.setInterpolation(this.DefaultInterpolation)}return console.warn("THREE.KeyframeTrack:",r),this}return this.createInterpolant=t,this},getInterpolation:function(){switch(this.createInterpolant){case this.InterpolantFactoryMethodDiscrete:return Rt;case this.InterpolantFactoryMethodLinear:return Lt;case this.InterpolantFactoryMethodSmooth:return Ct}},getValueSize:function(){return this.values.length/this.times.length},shift:function(e){if(0!==e)for(var t=this.times,r=0,n=t.length;r!==n;++r)t[r]+=e;return this},scale:function(e){if(1!==e)for(var t=this.times,r=0,n=t.length;r!==n;++r)t[r]*=e;return this},trim:function(e,t){for(var r=this.times,n=r.length,i=0,a=n-1;i!==n&&r[i]<e;)++i;for(;-1!==a&&r[a]>t;)--a;if(++a,0!==i||a!==n){i>=a&&(i=(a=Math.max(a,1))-1);var o=this.getValueSize();this.times=Zc.arraySlice(r,i,a),this.values=Zc.arraySlice(this.values,i*o,a*o)}return this},validate:function(){var e=!0,t=this.getValueSize();t-Math.floor(t)!=0&&(console.error("THREE.KeyframeTrack: Invalid value size in track.",this),e=!1);var r=this.times,n=this.values,i=r.length;0===i&&(console.error("THREE.KeyframeTrack: Track is empty.",this),e=!1);for(var a=null,o=0;o!==i;o++){var s=r[o];if("number"==typeof s&&isNaN(s)){console.error("THREE.KeyframeTrack: Time is not a valid number.",this,o,s),e=!1;break}if(null!==a&&a>s){console.error("THREE.KeyframeTrack: Out of order keys.",this,o,s,a),e=!1;break}a=s}if(void 0!==n&&Zc.isTypedArray(n)){o=0;for(var l=n.length;o!==l;++o){var c=n[o];if(isNaN(c)){console.error("THREE.KeyframeTrack: Value is not a valid number.",this,o,c),e=!1;break}}}return e},optimize:function(){for(var e=this.times,t=this.values,r=this.getValueSize(),n=this.getInterpolation()===Ct,i=1,a=e.length-1,o=1;o<a;++o){var s=!1,l=e[o];if(l!==e[o+1]&&(1!==o||l!==l[0]))if(n)s=!0;else for(var c=o*r,u=c-r,h=c+r,d=0;d!==r;++d){var p=t[c+d];if(p!==t[u+d]||p!==t[h+d]){s=!0;break}}if(s){if(o!==i){e[i]=e[o];var f=o*r,m=i*r;for(d=0;d!==r;++d)t[m+d]=t[f+d]}++i}}if(a>0){e[i]=e[a];for(f=a*r,m=i*r,d=0;d!==r;++d)t[m+d]=t[f+d];++i}return i!==e.length&&(this.times=Zc.arraySlice(e,0,i),this.values=Zc.arraySlice(t,0,i*r)),this},clone:function(){var e=Zc.arraySlice(this.times,0),t=Zc.arraySlice(this.values,0),r=new(0,this.constructor)(this.name,e,t);return r.createInterpolant=this.createInterpolant,r}}),ru.prototype=Object.assign(Object.create(tu.prototype),{constructor:ru,ValueTypeName:"bool",ValueBufferType:Array,DefaultInterpolation:Rt,InterpolantFactoryMethodLinear:void 0,InterpolantFactoryMethodSmooth:void 0}),nu.prototype=Object.assign(Object.create(tu.prototype),{constructor:nu,ValueTypeName:"color"}),iu.prototype=Object.assign(Object.create(tu.prototype),{constructor:iu,ValueTypeName:"number"}),au.prototype=Object.assign(Object.create(Jc.prototype),{constructor:au,interpolate_:function(e,t,r,n){for(var i=this.resultBuffer,a=this.sampleValues,o=this.valueSize,s=e*o,l=(r-t)/(n-t),c=s+o;s!==c;s+=4)Sr.slerpFlat(i,0,a,s-o,a,s,l);return i}}),ou.prototype=Object.assign(Object.create(tu.prototype),{constructor:ou,ValueTypeName:"quaternion",DefaultInterpolation:Lt,InterpolantFactoryMethodLinear:function(e){return new au(this.times,this.values,this.getValueSize(),e)},InterpolantFactoryMethodSmooth:void 0}),su.prototype=Object.assign(Object.create(tu.prototype),{constructor:su,ValueTypeName:"string",ValueBufferType:Array,DefaultInterpolation:Rt,InterpolantFactoryMethodLinear:void 0,InterpolantFactoryMethodSmooth:void 0}),lu.prototype=Object.assign(Object.create(tu.prototype),{constructor:lu,ValueTypeName:"vector"}),Object.assign(cu,{parse:function(e){for(var t=[],r=e.tracks,n=1/(e.fps||1),i=0,a=r.length;i!==a;++i)t.push(uu(r[i]).scale(n));return new cu(e.name,e.duration,t)},toJSON:function(e){for(var t=[],r=e.tracks,n={name:e.name,duration:e.duration,tracks:t,uuid:e.uuid},i=0,a=r.length;i!==a;++i)t.push(tu.toJSON(r[i]));return n},CreateFromMorphTargetSequence:function(e,t,r,n){for(var i=t.length,a=[],o=0;o<i;o++){var s=[],l=[];s.push((o+i-1)%i,o,(o+1)%i),l.push(0,1,0);var c=Zc.getKeyframeOrder(s);s=Zc.sortedArray(s,1,c),l=Zc.sortedArray(l,1,c),n||0!==s[0]||(s.push(i),l.push(l[0])),a.push(new iu(".morphTargetInfluences["+t[o].name+"]",s,l).scale(1/r))}return new cu(e,-1,a)},findByName:function(e,t){var r=e;if(!Array.isArray(e)){var n=e;r=n.geometry&&n.geometry.animations||n.animations}for(var i=0;i<r.length;i++)if(r[i].name===t)return r[i];return null},CreateClipsFromMorphTargetSequences:function(e,t,r){for(var n={},i=/^([\w-]*?)([\d]+)$/,a=0,o=e.length;a<o;a++){var s=e[a],l=s.name.match(i);if(l&&l.length>1){var c=n[h=l[1]];c||(n[h]=c=[]),c.push(s)}}var u=[];for(var h in n)u.push(cu.CreateFromMorphTargetSequence(h,n[h],t,r));return u},parseAnimation:function(e,t){if(!e)return console.error("THREE.AnimationClip: No animation in JSONLoader data."),null;for(var r=function(e,t,r,n,i){if(0!==r.length){var a=[],o=[];Zc.flattenJSON(r,a,o,n),0!==a.length&&i.push(new e(t,a,o))}},n=[],i=e.name||"default",a=e.length||-1,o=e.fps||30,s=e.hierarchy||[],l=0;l<s.length;l++){var c=s[l].keys;if(c&&0!==c.length)if(c[0].morphTargets){for(var u={},h=0;h<c.length;h++)if(c[h].morphTargets)for(var d=0;d<c[h].morphTargets.length;d++)u[c[h].morphTargets[d]]=-1;for(var p in u){var f=[],m=[];for(d=0;d!==c[h].morphTargets.length;++d){var v=c[h];f.push(v.time),m.push(v.morphTarget===p?1:0)}n.push(new iu(".morphTargetInfluence["+p+"]",f,m))}a=u.length*(o||1)}else{var g=".bones["+t[l].name+"]";r(lu,g+".position",c,"pos",n),r(ou,g+".quaternion",c,"rot",n),r(lu,g+".scale",c,"scl",n)}}return 0===n.length?null:new cu(i,a,n)}}),Object.assign(cu.prototype,{resetDuration:function(){for(var e=0,t=0,r=this.tracks.length;t!==r;++t){var n=this.tracks[t];e=Math.max(e,n.times[n.times.length-1])}return this.duration=e,this},trim:function(){for(var e=0;e<this.tracks.length;e++)this.tracks[e].trim(0,this.duration);return this},validate:function(){for(var e=!0,t=0;t<this.tracks.length;t++)e=e&&this.tracks[t].validate();return e},optimize:function(){for(var e=0;e<this.tracks.length;e++)this.tracks[e].optimize();return this},clone:function(){for(var e=[],t=0;t<this.tracks.length;t++)e.push(this.tracks[t].clone());return new cu(this.name,this.duration,e)}});var hu={enabled:!1,files:{},add:function(e,t){!1!==this.enabled&&(this.files[e]=t)},get:function(e){if(!1!==this.enabled)return this.files[e]},remove:function(e){delete this.files[e]},clear:function(){this.files={}}};function du(e,t,r){var n=this,i=!1,a=0,o=0,s=void 0,l=[];this.onStart=void 0,this.onLoad=e,this.onProgress=t,this.onError=r,this.itemStart=function(e){o++,!1===i&&void 0!==n.onStart&&n.onStart(e,a,o),i=!0},this.itemEnd=function(e){a++,void 0!==n.onProgress&&n.onProgress(e,a,o),a===o&&(i=!1,void 0!==n.onLoad&&n.onLoad())},this.itemError=function(e){void 0!==n.onError&&n.onError(e)},this.resolveURL=function(e){return s?s(e):e},this.setURLModifier=function(e){return s=e,this},this.addHandler=function(e,t){return l.push(e,t),this},this.removeHandler=function(e){var t=l.indexOf(e);return-1!==t&&l.splice(t,2),this},this.getHandler=function(e){for(var t=0,r=l.length;t<r;t+=2){var n=l[t],i=l[t+1];if(n.global&&(n.lastIndex=0),n.test(e))return i}return null}}var pu=new du;function fu(e){this.manager=void 0!==e?e:pu,this.crossOrigin="anonymous",this.path="",this.resourcePath=""}Object.assign(fu.prototype,{load:function(){},parse:function(){},setCrossOrigin:function(e){return this.crossOrigin=e,this},setPath:function(e){return this.path=e,this},setResourcePath:function(e){return this.resourcePath=e,this}});var mu={};function vu(e){fu.call(this,e)}function gu(e){fu.call(this,e)}function yu(e){fu.call(this,e)}function xu(e){fu.call(this,e)}function bu(e){fu.call(this,e)}function Au(e){fu.call(this,e)}function wu(e){fu.call(this,e)}function _u(){this.type="Curve",this.arcLengthDivisions=200}function Mu(e,t,r,n,i,a,o,s){_u.call(this),this.type="EllipseCurve",this.aX=e||0,this.aY=t||0,this.xRadius=r||1,this.yRadius=n||1,this.aStartAngle=i||0,this.aEndAngle=a||2*Math.PI,this.aClockwise=o||!1,this.aRotation=s||0}function Su(e,t,r,n,i,a){Mu.call(this,e,t,r,r,n,i,a),this.type="ArcCurve"}function Eu(){var e=0,t=0,r=0,n=0;function i(i,a,o,s){e=i,t=o,r=-3*i+3*a-2*o-s,n=2*i-2*a+o+s}return{initCatmullRom:function(e,t,r,n,a){i(t,r,a*(r-e),a*(n-t))},initNonuniformCatmullRom:function(e,t,r,n,a,o,s){var l=(t-e)/a-(r-e)/(a+o)+(r-t)/o,c=(r-t)/o-(n-t)/(o+s)+(n-r)/s;i(t,r,l*=o,c*=o)},calc:function(i){var a=i*i;return e+t*i+r*a+n*(a*i)}}}vu.prototype=Object.assign(Object.create(fu.prototype),{constructor:vu,load:function(e,t,r,n){void 0===e&&(e=""),void 0!==this.path&&(e=this.path+e),e=this.manager.resolveURL(e);var i=this,a=hu.get(e);if(void 0!==a)return i.manager.itemStart(e),setTimeout((function(){t&&t(a),i.manager.itemEnd(e)}),0),a;if(void 0===mu[e]){var o=e.match(/^data:(.*?)(;base64)?,(.*)$/);if(o){var s=o[1],l=!!o[2],c=o[3];c=decodeURIComponent(c),l&&(c=atob(c));try{var u,h=(this.responseType||"").toLowerCase();switch(h){case"arraybuffer":case"blob":for(var d=new Uint8Array(c.length),p=0;p<c.length;p++)d[p]=c.charCodeAt(p);u="blob"===h?new Blob([d.buffer],{type:s}):d.buffer;break;case"document":var f=new DOMParser;u=f.parseFromString(c,s);break;case"json":u=JSON.parse(c);break;default:u=c}setTimeout((function(){t&&t(u),i.manager.itemEnd(e)}),0)}catch(t){setTimeout((function(){n&&n(t),i.manager.itemError(e),i.manager.itemEnd(e)}),0)}}else{mu[e]=[],mu[e].push({onLoad:t,onProgress:r,onError:n});var m=new XMLHttpRequest;for(var v in m.open("GET",e,!0),m.addEventListener("load",(function(t){var r=this.response,n=mu[e];if(delete mu[e],200===this.status||0===this.status){0===this.status&&console.warn("THREE.FileLoader: HTTP Status 0 received."),hu.add(e,r);for(var a=0,o=n.length;a<o;a++){(s=n[a]).onLoad&&s.onLoad(r)}i.manager.itemEnd(e)}else{for(a=0,o=n.length;a<o;a++){var s;(s=n[a]).onError&&s.onError(t)}i.manager.itemError(e),i.manager.itemEnd(e)}}),!1),m.addEventListener("progress",(function(t){for(var r=mu[e],n=0,i=r.length;n<i;n++){var a=r[n];a.onProgress&&a.onProgress(t)}}),!1),m.addEventListener("error",(function(t){var r=mu[e];delete mu[e];for(var n=0,a=r.length;n<a;n++){var o=r[n];o.onError&&o.onError(t)}i.manager.itemError(e),i.manager.itemEnd(e)}),!1),m.addEventListener("abort",(function(t){var r=mu[e];delete mu[e];for(var n=0,a=r.length;n<a;n++){var o=r[n];o.onError&&o.onError(t)}i.manager.itemError(e),i.manager.itemEnd(e)}),!1),void 0!==this.responseType&&(m.responseType=this.responseType),void 0!==this.withCredentials&&(m.withCredentials=this.withCredentials),m.overrideMimeType&&m.overrideMimeType(void 0!==this.mimeType?this.mimeType:"text/plain"),this.requestHeader)m.setRequestHeader(v,this.requestHeader[v]);m.send(null)}return i.manager.itemStart(e),m}mu[e].push({onLoad:t,onProgress:r,onError:n})},setResponseType:function(e){return this.responseType=e,this},setWithCredentials:function(e){return this.withCredentials=e,this},setMimeType:function(e){return this.mimeType=e,this},setRequestHeader:function(e){return this.requestHeader=e,this}}),gu.prototype=Object.assign(Object.create(fu.prototype),{constructor:gu,load:function(e,t,r,n){var i=this,a=new vu(i.manager);a.setPath(i.path),a.load(e,(function(e){t(i.parse(JSON.parse(e)))}),r,n)},parse:function(e){for(var t=[],r=0;r<e.length;r++){var n=cu.parse(e[r]);t.push(n)}return t}}),yu.prototype=Object.assign(Object.create(fu.prototype),{constructor:yu,load:function(e,t,r,n){var i=this,a=[],o=new _l;o.image=a;var s=new vu(this.manager);function l(l){s.load(e[l],(function(e){var r=i.parse(e,!0);a[l]={width:r.width,height:r.height,format:r.format,mipmaps:r.mipmaps},6===(c+=1)&&(1===r.mipmapCount&&(o.minFilter=Se),o.format=r.format,o.needsUpdate=!0,t&&t(o))}),r,n)}if(s.setPath(this.path),s.setResponseType("arraybuffer"),Array.isArray(e))for(var c=0,u=0,h=e.length;u<h;++u)l(u);else s.load(e,(function(e){var r=i.parse(e,!0);if(r.isCubemap)for(var n=r.mipmaps.length/r.mipmapCount,s=0;s<n;s++){a[s]={mipmaps:[]};for(var l=0;l<r.mipmapCount;l++)a[s].mipmaps.push(r.mipmaps[s*r.mipmapCount+l]),a[s].format=r.format,a[s].width=r.width,a[s].height=r.height}else o.image.width=r.width,o.image.height=r.height,o.mipmaps=r.mipmaps;1===r.mipmapCount&&(o.minFilter=Se),o.format=r.format,o.needsUpdate=!0,t&&t(o)}),r,n);return o}}),xu.prototype=Object.assign(Object.create(fu.prototype),{constructor:xu,load:function(e,t,r,n){var i=this,a=new ma,o=new vu(this.manager);return o.setResponseType("arraybuffer"),o.setPath(this.path),o.load(e,(function(e){var r=i.parse(e);r&&(void 0!==r.image?a.image=r.image:void 0!==r.data&&(a.image.width=r.width,a.image.height=r.height,a.image.data=r.data),a.wrapS=void 0!==r.wrapS?r.wrapS:ye,a.wrapT=void 0!==r.wrapT?r.wrapT:ye,a.magFilter=void 0!==r.magFilter?r.magFilter:Se,a.minFilter=void 0!==r.minFilter?r.minFilter:Se,a.anisotropy=void 0!==r.anisotropy?r.anisotropy:1,void 0!==r.format&&(a.format=r.format),void 0!==r.type&&(a.type=r.type),void 0!==r.mipmaps&&(a.mipmaps=r.mipmaps,a.minFilter=Re),1===r.mipmapCount&&(a.minFilter=Se),a.needsUpdate=!0,t&&t(a,r))}),r,n),a}}),bu.prototype=Object.assign(Object.create(fu.prototype),{constructor:bu,load:function(e,t,r,n){void 0!==this.path&&(e=this.path+e),e=this.manager.resolveURL(e);var i=this,a=hu.get(e);if(void 0!==a)return i.manager.itemStart(e),setTimeout((function(){t&&t(a),i.manager.itemEnd(e)}),0),a;var o=document.createElementNS("http://www.w3.org/1999/xhtml","img");function s(){o.removeEventListener("load",s,!1),o.removeEventListener("error",l,!1),hu.add(e,this),t&&t(this),i.manager.itemEnd(e)}function l(t){o.removeEventListener("load",s,!1),o.removeEventListener("error",l,!1),n&&n(t),i.manager.itemError(e),i.manager.itemEnd(e)}return o.addEventListener("load",s,!1),o.addEventListener("error",l,!1),"data:"!==e.substr(0,5)&&void 0!==this.crossOrigin&&(o.crossOrigin=this.crossOrigin),i.manager.itemStart(e),o.src=e,o}}),Au.prototype=Object.assign(Object.create(fu.prototype),{constructor:Au,load:function(e,t,r,n){var i=new Ua,a=new bu(this.manager);a.setCrossOrigin(this.crossOrigin),a.setPath(this.path);var o=0;function s(r){a.load(e[r],(function(e){i.images[r]=e,6===++o&&(i.needsUpdate=!0,t&&t(i))}),void 0,n)}for(var l=0;l<e.length;++l)s(l);return i}}),wu.prototype=Object.assign(Object.create(fu.prototype),{constructor:wu,load:function(e,t,r,n){var i=new Or,a=new bu(this.manager);return a.setCrossOrigin(this.crossOrigin),a.setPath(this.path),a.load(e,(function(r){i.image=r;var n=e.search(/\.jpe?g($|\?)/i)>0||0===e.search(/^data\:image\/jpeg/);i.format=n?Ve:je,i.needsUpdate=!0,void 0!==t&&t(i)}),r,n),i}}),Object.assign(_u.prototype,{getPoint:function(){return console.warn("THREE.Curve: .getPoint() not implemented."),null},getPointAt:function(e,t){var r=this.getUtoTmapping(e);return this.getPoint(r,t)},getPoints:function(e){void 0===e&&(e=5);for(var t=[],r=0;r<=e;r++)t.push(this.getPoint(r/e));return t},getSpacedPoints:function(e){void 0===e&&(e=5);for(var t=[],r=0;r<=e;r++)t.push(this.getPointAt(r/e));return t},getLength:function(){var e=this.getLengths();return e[e.length-1]},getLengths:function(e){if(void 0===e&&(e=this.arcLengthDivisions),this.cacheArcLengths&&this.cacheArcLengths.length===e+1&&!this.needsUpdate)return this.cacheArcLengths;this.needsUpdate=!1;var t,r,n=[],i=this.getPoint(0),a=0;for(n.push(0),r=1;r<=e;r++)a+=(t=this.getPoint(r/e)).distanceTo(i),n.push(a),i=t;return this.cacheArcLengths=n,n},updateArcLengths:function(){this.needsUpdate=!0,this.getLengths()},getUtoTmapping:function(e,t){var r,n=this.getLengths(),i=0,a=n.length;r=t||e*n[a-1];for(var o,s=0,l=a-1;s<=l;)if((o=n[i=Math.floor(s+(l-s)/2)]-r)<0)s=i+1;else{if(!(o>0)){l=i;break}l=i-1}if(n[i=l]===r)return i/(a-1);var c=n[i];return(i+(r-c)/(n[i+1]-c))/(a-1)},getTangent:function(e){var t=e-1e-4,r=e+1e-4;t<0&&(t=0),r>1&&(r=1);var n=this.getPoint(t);return this.getPoint(r).clone().sub(n).normalize()},getTangentAt:function(e){var t=this.getUtoTmapping(e);return this.getTangent(t)},computeFrenetFrames:function(e,t){var r,n,i,a=new Rr,o=[],s=[],l=[],c=new Rr,u=new Wr;for(r=0;r<=e;r++)n=r/e,o[r]=this.getTangentAt(n),o[r].normalize();s[0]=new Rr,l[0]=new Rr;var h=Number.MAX_VALUE,d=Math.abs(o[0].x),p=Math.abs(o[0].y),f=Math.abs(o[0].z);for(d<=h&&(h=d,a.set(1,0,0)),p<=h&&(h=p,a.set(0,1,0)),f<=h&&a.set(0,0,1),c.crossVectors(o[0],a).normalize(),s[0].crossVectors(o[0],c),l[0].crossVectors(o[0],s[0]),r=1;r<=e;r++)s[r]=s[r-1].clone(),l[r]=l[r-1].clone(),c.crossVectors(o[r-1],o[r]),c.length()>Number.EPSILON&&(c.normalize(),i=Math.acos(_r.clamp(o[r-1].dot(o[r]),-1,1)),s[r].applyMatrix4(u.makeRotationAxis(c,i))),l[r].crossVectors(o[r],s[r]);if(!0===t)for(i=Math.acos(_r.clamp(s[0].dot(s[e]),-1,1)),i/=e,o[0].dot(c.crossVectors(s[0],s[e]))>0&&(i=-i),r=1;r<=e;r++)s[r].applyMatrix4(u.makeRotationAxis(o[r],i*r)),l[r].crossVectors(o[r],s[r]);return{tangents:o,normals:s,binormals:l}},clone:function(){return(new this.constructor).copy(this)},copy:function(e){return this.arcLengthDivisions=e.arcLengthDivisions,this},toJSON:function(){var e={metadata:{version:4.5,type:"Curve",generator:"Curve.toJSON"}};return e.arcLengthDivisions=this.arcLengthDivisions,e.type=this.type,e},fromJSON:function(e){return this.arcLengthDivisions=e.arcLengthDivisions,this}}),Mu.prototype=Object.create(_u.prototype),Mu.prototype.constructor=Mu,Mu.prototype.isEllipseCurve=!0,Mu.prototype.getPoint=function(e,t){for(var r=t||new Mr,n=2*Math.PI,i=this.aEndAngle-this.aStartAngle,a=Math.abs(i)<Number.EPSILON;i<0;)i+=n;for(;i>n;)i-=n;i<Number.EPSILON&&(i=a?0:n),!0!==this.aClockwise||a||(i===n?i=-n:i-=n);var o=this.aStartAngle+e*i,s=this.aX+this.xRadius*Math.cos(o),l=this.aY+this.yRadius*Math.sin(o);if(0!==this.aRotation){var c=Math.cos(this.aRotation),u=Math.sin(this.aRotation),h=s-this.aX,d=l-this.aY;s=h*c-d*u+this.aX,l=h*u+d*c+this.aY}return r.set(s,l)},Mu.prototype.copy=function(e){return _u.prototype.copy.call(this,e),this.aX=e.aX,this.aY=e.aY,this.xRadius=e.xRadius,this.yRadius=e.yRadius,this.aStartAngle=e.aStartAngle,this.aEndAngle=e.aEndAngle,this.aClockwise=e.aClockwise,this.aRotation=e.aRotation,this},Mu.prototype.toJSON=function(){var e=_u.prototype.toJSON.call(this);return e.aX=this.aX,e.aY=this.aY,e.xRadius=this.xRadius,e.yRadius=this.yRadius,e.aStartAngle=this.aStartAngle,e.aEndAngle=this.aEndAngle,e.aClockwise=this.aClockwise,e.aRotation=this.aRotation,e},Mu.prototype.fromJSON=function(e){return _u.prototype.fromJSON.call(this,e),this.aX=e.aX,this.aY=e.aY,this.xRadius=e.xRadius,this.yRadius=e.yRadius,this.aStartAngle=e.aStartAngle,this.aEndAngle=e.aEndAngle,this.aClockwise=e.aClockwise,this.aRotation=e.aRotation,this},Su.prototype=Object.create(Mu.prototype),Su.prototype.constructor=Su,Su.prototype.isArcCurve=!0;var Tu=new Rr,Ru=new Eu,Lu=new Eu,Cu=new Eu;function Pu(e,t,r,n){_u.call(this),this.type="CatmullRomCurve3",this.points=e||[],this.closed=t||!1,this.curveType=r||"centripetal",this.tension=n||.5}function Du(e,t,r,n,i){var a=.5*(n-t),o=.5*(i-r),s=e*e;return(2*r-2*n+a+o)*(e*s)+(-3*r+3*n-2*a-o)*s+a*e+r}function Iu(e,t,r,n){return function(e,t){var r=1-e;return r*r*t}(e,t)+function(e,t){return 2*(1-e)*e*t}(e,r)+function(e,t){return e*e*t}(e,n)}function Ou(e,t,r,n,i){return function(e,t){var r=1-e;return r*r*r*t}(e,t)+function(e,t){var r=1-e;return 3*r*r*e*t}(e,r)+function(e,t){return 3*(1-e)*e*e*t}(e,n)+function(e,t){return e*e*e*t}(e,i)}function Bu(e,t,r,n){_u.call(this),this.type="CubicBezierCurve",this.v0=e||new Mr,this.v1=t||new Mr,this.v2=r||new Mr,this.v3=n||new Mr}function Fu(e,t,r,n){_u.call(this),this.type="CubicBezierCurve3",this.v0=e||new Rr,this.v1=t||new Rr,this.v2=r||new Rr,this.v3=n||new Rr}function Uu(e,t){_u.call(this),this.type="LineCurve",this.v1=e||new Mr,this.v2=t||new Mr}function Nu(e,t){_u.call(this),this.type="LineCurve3",this.v1=e||new Rr,this.v2=t||new Rr}function Gu(e,t,r){_u.call(this),this.type="QuadraticBezierCurve",this.v0=e||new Mr,this.v1=t||new Mr,this.v2=r||new Mr}function zu(e,t,r){_u.call(this),this.type="QuadraticBezierCurve3",this.v0=e||new Rr,this.v1=t||new Rr,this.v2=r||new Rr}function ku(e){_u.call(this),this.type="SplineCurve",this.points=e||[]}Pu.prototype=Object.create(_u.prototype),Pu.prototype.constructor=Pu,Pu.prototype.isCatmullRomCurve3=!0,Pu.prototype.getPoint=function(e,t){var r,n,i,a,o=t||new Rr,s=this.points,l=s.length,c=(l-(this.closed?0:1))*e,u=Math.floor(c),h=c-u;if(this.closed?u+=u>0?0:(Math.floor(Math.abs(u)/l)+1)*l:0===h&&u===l-1&&(u=l-2,h=1),this.closed||u>0?r=s[(u-1)%l]:(Tu.subVectors(s[0],s[1]).add(s[0]),r=Tu),n=s[u%l],i=s[(u+1)%l],this.closed||u+2<l?a=s[(u+2)%l]:(Tu.subVectors(s[l-1],s[l-2]).add(s[l-1]),a=Tu),"centripetal"===this.curveType||"chordal"===this.curveType){var d="chordal"===this.curveType?.5:.25,p=Math.pow(r.distanceToSquared(n),d),f=Math.pow(n.distanceToSquared(i),d),m=Math.pow(i.distanceToSquared(a),d);f<1e-4&&(f=1),p<1e-4&&(p=f),m<1e-4&&(m=f),Ru.initNonuniformCatmullRom(r.x,n.x,i.x,a.x,p,f,m),Lu.initNonuniformCatmullRom(r.y,n.y,i.y,a.y,p,f,m),Cu.initNonuniformCatmullRom(r.z,n.z,i.z,a.z,p,f,m)}else"catmullrom"===this.curveType&&(Ru.initCatmullRom(r.x,n.x,i.x,a.x,this.tension),Lu.initCatmullRom(r.y,n.y,i.y,a.y,this.tension),Cu.initCatmullRom(r.z,n.z,i.z,a.z,this.tension));return o.set(Ru.calc(h),Lu.calc(h),Cu.calc(h)),o},Pu.prototype.copy=function(e){_u.prototype.copy.call(this,e),this.points=[];for(var t=0,r=e.points.length;t<r;t++){var n=e.points[t];this.points.push(n.clone())}return this.closed=e.closed,this.curveType=e.curveType,this.tension=e.tension,this},Pu.prototype.toJSON=function(){var e=_u.prototype.toJSON.call(this);e.points=[];for(var t=0,r=this.points.length;t<r;t++){var n=this.points[t];e.points.push(n.toArray())}return e.closed=this.closed,e.curveType=this.curveType,e.tension=this.tension,e},Pu.prototype.fromJSON=function(e){_u.prototype.fromJSON.call(this,e),this.points=[];for(var t=0,r=e.points.length;t<r;t++){var n=e.points[t];this.points.push((new Rr).fromArray(n))}return this.closed=e.closed,this.curveType=e.curveType,this.tension=e.tension,this},Bu.prototype=Object.create(_u.prototype),Bu.prototype.constructor=Bu,Bu.prototype.isCubicBezierCurve=!0,Bu.prototype.getPoint=function(e,t){var r=t||new Mr,n=this.v0,i=this.v1,a=this.v2,o=this.v3;return r.set(Ou(e,n.x,i.x,a.x,o.x),Ou(e,n.y,i.y,a.y,o.y)),r},Bu.prototype.copy=function(e){return _u.prototype.copy.call(this,e),this.v0.copy(e.v0),this.v1.copy(e.v1),this.v2.copy(e.v2),this.v3.copy(e.v3),this},Bu.prototype.toJSON=function(){var e=_u.prototype.toJSON.call(this);return e.v0=this.v0.toArray(),e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e.v3=this.v3.toArray(),e},Bu.prototype.fromJSON=function(e){return _u.prototype.fromJSON.call(this,e),this.v0.fromArray(e.v0),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this.v3.fromArray(e.v3),this},Fu.prototype=Object.create(_u.prototype),Fu.prototype.constructor=Fu,Fu.prototype.isCubicBezierCurve3=!0,Fu.prototype.getPoint=function(e,t){var r=t||new Rr,n=this.v0,i=this.v1,a=this.v2,o=this.v3;return r.set(Ou(e,n.x,i.x,a.x,o.x),Ou(e,n.y,i.y,a.y,o.y),Ou(e,n.z,i.z,a.z,o.z)),r},Fu.prototype.copy=function(e){return _u.prototype.copy.call(this,e),this.v0.copy(e.v0),this.v1.copy(e.v1),this.v2.copy(e.v2),this.v3.copy(e.v3),this},Fu.prototype.toJSON=function(){var e=_u.prototype.toJSON.call(this);return e.v0=this.v0.toArray(),e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e.v3=this.v3.toArray(),e},Fu.prototype.fromJSON=function(e){return _u.prototype.fromJSON.call(this,e),this.v0.fromArray(e.v0),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this.v3.fromArray(e.v3),this},Uu.prototype=Object.create(_u.prototype),Uu.prototype.constructor=Uu,Uu.prototype.isLineCurve=!0,Uu.prototype.getPoint=function(e,t){var r=t||new Mr;return 1===e?r.copy(this.v2):(r.copy(this.v2).sub(this.v1),r.multiplyScalar(e).add(this.v1)),r},Uu.prototype.getPointAt=function(e,t){return this.getPoint(e,t)},Uu.prototype.getTangent=function(){return this.v2.clone().sub(this.v1).normalize()},Uu.prototype.copy=function(e){return _u.prototype.copy.call(this,e),this.v1.copy(e.v1),this.v2.copy(e.v2),this},Uu.prototype.toJSON=function(){var e=_u.prototype.toJSON.call(this);return e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e},Uu.prototype.fromJSON=function(e){return _u.prototype.fromJSON.call(this,e),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this},Nu.prototype=Object.create(_u.prototype),Nu.prototype.constructor=Nu,Nu.prototype.isLineCurve3=!0,Nu.prototype.getPoint=function(e,t){var r=t||new Rr;return 1===e?r.copy(this.v2):(r.copy(this.v2).sub(this.v1),r.multiplyScalar(e).add(this.v1)),r},Nu.prototype.getPointAt=function(e,t){return this.getPoint(e,t)},Nu.prototype.copy=function(e){return _u.prototype.copy.call(this,e),this.v1.copy(e.v1),this.v2.copy(e.v2),this},Nu.prototype.toJSON=function(){var e=_u.prototype.toJSON.call(this);return e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e},Nu.prototype.fromJSON=function(e){return _u.prototype.fromJSON.call(this,e),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this},Gu.prototype=Object.create(_u.prototype),Gu.prototype.constructor=Gu,Gu.prototype.isQuadraticBezierCurve=!0,Gu.prototype.getPoint=function(e,t){var r=t||new Mr,n=this.v0,i=this.v1,a=this.v2;return r.set(Iu(e,n.x,i.x,a.x),Iu(e,n.y,i.y,a.y)),r},Gu.prototype.copy=function(e){return _u.prototype.copy.call(this,e),this.v0.copy(e.v0),this.v1.copy(e.v1),this.v2.copy(e.v2),this},Gu.prototype.toJSON=function(){var e=_u.prototype.toJSON.call(this);return e.v0=this.v0.toArray(),e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e},Gu.prototype.fromJSON=function(e){return _u.prototype.fromJSON.call(this,e),this.v0.fromArray(e.v0),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this},zu.prototype=Object.create(_u.prototype),zu.prototype.constructor=zu,zu.prototype.isQuadraticBezierCurve3=!0,zu.prototype.getPoint=function(e,t){var r=t||new Rr,n=this.v0,i=this.v1,a=this.v2;return r.set(Iu(e,n.x,i.x,a.x),Iu(e,n.y,i.y,a.y),Iu(e,n.z,i.z,a.z)),r},zu.prototype.copy=function(e){return _u.prototype.copy.call(this,e),this.v0.copy(e.v0),this.v1.copy(e.v1),this.v2.copy(e.v2),this},zu.prototype.toJSON=function(){var e=_u.prototype.toJSON.call(this);return e.v0=this.v0.toArray(),e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e},zu.prototype.fromJSON=function(e){return _u.prototype.fromJSON.call(this,e),this.v0.fromArray(e.v0),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this},ku.prototype=Object.create(_u.prototype),ku.prototype.constructor=ku,ku.prototype.isSplineCurve=!0,ku.prototype.getPoint=function(e,t){var r=t||new Mr,n=this.points,i=(n.length-1)*e,a=Math.floor(i),o=i-a,s=n[0===a?a:a-1],l=n[a],c=n[a>n.length-2?n.length-1:a+1],u=n[a>n.length-3?n.length-1:a+2];return r.set(Du(o,s.x,l.x,c.x,u.x),Du(o,s.y,l.y,c.y,u.y)),r},ku.prototype.copy=function(e){_u.prototype.copy.call(this,e),this.points=[];for(var t=0,r=e.points.length;t<r;t++){var n=e.points[t];this.points.push(n.clone())}return this},ku.prototype.toJSON=function(){var e=_u.prototype.toJSON.call(this);e.points=[];for(var t=0,r=this.points.length;t<r;t++){var n=this.points[t];e.points.push(n.toArray())}return e},ku.prototype.fromJSON=function(e){_u.prototype.fromJSON.call(this,e),this.points=[];for(var t=0,r=e.points.length;t<r;t++){var n=e.points[t];this.points.push((new Mr).fromArray(n))}return this};var Hu=Object.freeze({__proto__:null,ArcCurve:Su,CatmullRomCurve3:Pu,CubicBezierCurve:Bu,CubicBezierCurve3:Fu,EllipseCurve:Mu,LineCurve:Uu,LineCurve3:Nu,QuadraticBezierCurve:Gu,QuadraticBezierCurve3:zu,SplineCurve:ku});function Vu(){_u.call(this),this.type="CurvePath",this.curves=[],this.autoClose=!1}function ju(e){Vu.call(this),this.type="Path",this.currentPoint=new Mr,e&&this.setFromPoints(e)}function Wu(e){ju.call(this,e),this.uuid=_r.generateUUID(),this.type="Shape",this.holes=[]}function qu(e,t){un.call(this),this.type="Light",this.color=new ti(e),this.intensity=void 0!==t?t:1,this.receiveShadow=void 0}function Xu(e,t,r){qu.call(this,e,r),this.type="HemisphereLight",this.castShadow=void 0,this.position.copy(un.DefaultUp),this.updateMatrix(),this.groundColor=new ti(t)}function Yu(e){this.camera=e,this.bias=0,this.radius=1,this.mapSize=new Mr(512,512),this.map=null,this.mapPass=null,this.matrix=new Wr,this._frustum=new ya,this._frameExtents=new Mr(1,1),this._viewportCount=1,this._viewports=[new Br(0,0,1,1)]}function Qu(){Yu.call(this,new ua(50,1,.5,500))}function Zu(e,t,r,n,i,a){qu.call(this,e,t),this.type="SpotLight",this.position.copy(un.DefaultUp),this.updateMatrix(),this.target=new un,Object.defineProperty(this,"power",{get:function(){return this.intensity*Math.PI},set:function(e){this.intensity=e/Math.PI}}),this.distance=void 0!==r?r:0,this.angle=void 0!==n?n:Math.PI/3,this.penumbra=void 0!==i?i:0,this.decay=void 0!==a?a:1,this.shadow=new Qu}function Ju(){Yu.call(this,new ua(90,1,.5,500)),this._frameExtents=new Mr(4,2),this._viewportCount=6,this._viewports=[new Br(2,1,1,1),new Br(0,1,1,1),new Br(3,1,1,1),new Br(1,1,1,1),new Br(3,0,1,1),new Br(1,0,1,1)],this._cubeDirections=[new Rr(1,0,0),new Rr(-1,0,0),new Rr(0,0,1),new Rr(0,0,-1),new Rr(0,1,0),new Rr(0,-1,0)],this._cubeUps=[new Rr(0,1,0),new Rr(0,1,0),new Rr(0,1,0),new Rr(0,1,0),new Rr(0,0,1),new Rr(0,0,-1)]}function Ku(e,t,r,n){qu.call(this,e,t),this.type="PointLight",Object.defineProperty(this,"power",{get:function(){return 4*this.intensity*Math.PI},set:function(e){this.intensity=e/(4*Math.PI)}}),this.distance=void 0!==r?r:0,this.decay=void 0!==n?n:1,this.shadow=new Ju}function $u(e,t,r,n,i,a){ca.call(this),this.type="OrthographicCamera",this.zoom=1,this.view=null,this.left=void 0!==e?e:-1,this.right=void 0!==t?t:1,this.top=void 0!==r?r:1,this.bottom=void 0!==n?n:-1,this.near=void 0!==i?i:.1,this.far=void 0!==a?a:2e3,this.updateProjectionMatrix()}function eh(){Yu.call(this,new $u(-5,5,5,-5,.5,500))}function th(e,t){qu.call(this,e,t),this.type="DirectionalLight",this.position.copy(un.DefaultUp),this.updateMatrix(),this.target=new un,this.shadow=new eh}function rh(e,t){qu.call(this,e,t),this.type="AmbientLight",this.castShadow=void 0}function nh(e,t,r,n){qu.call(this,e,t),this.type="RectAreaLight",this.width=void 0!==r?r:10,this.height=void 0!==n?n:10}function ih(e){fu.call(this,e),this.textures={}}Vu.prototype=Object.assign(Object.create(_u.prototype),{constructor:Vu,add:function(e){this.curves.push(e)},closePath:function(){var e=this.curves[0].getPoint(0),t=this.curves[this.curves.length-1].getPoint(1);e.equals(t)||this.curves.push(new Uu(t,e))},getPoint:function(e){for(var t=e*this.getLength(),r=this.getCurveLengths(),n=0;n<r.length;){if(r[n]>=t){var i=r[n]-t,a=this.curves[n],o=a.getLength(),s=0===o?0:1-i/o;return a.getPointAt(s)}n++}return null},getLength:function(){var e=this.getCurveLengths();return e[e.length-1]},updateArcLengths:function(){this.needsUpdate=!0,this.cacheLengths=null,this.getCurveLengths()},getCurveLengths:function(){if(this.cacheLengths&&this.cacheLengths.length===this.curves.length)return this.cacheLengths;for(var e=[],t=0,r=0,n=this.curves.length;r<n;r++)t+=this.curves[r].getLength(),e.push(t);return this.cacheLengths=e,e},getSpacedPoints:function(e){void 0===e&&(e=40);for(var t=[],r=0;r<=e;r++)t.push(this.getPoint(r/e));return this.autoClose&&t.push(t[0]),t},getPoints:function(e){e=e||12;for(var t,r=[],n=0,i=this.curves;n<i.length;n++)for(var a=i[n],o=a&&a.isEllipseCurve?2*e:a&&(a.isLineCurve||a.isLineCurve3)?1:a&&a.isSplineCurve?e*a.points.length:e,s=a.getPoints(o),l=0;l<s.length;l++){var c=s[l];t&&t.equals(c)||(r.push(c),t=c)}return this.autoClose&&r.length>1&&!r[r.length-1].equals(r[0])&&r.push(r[0]),r},copy:function(e){_u.prototype.copy.call(this,e),this.curves=[];for(var t=0,r=e.curves.length;t<r;t++){var n=e.curves[t];this.curves.push(n.clone())}return this.autoClose=e.autoClose,this},toJSON:function(){var e=_u.prototype.toJSON.call(this);e.autoClose=this.autoClose,e.curves=[];for(var t=0,r=this.curves.length;t<r;t++){var n=this.curves[t];e.curves.push(n.toJSON())}return e},fromJSON:function(e){_u.prototype.fromJSON.call(this,e),this.autoClose=e.autoClose,this.curves=[];for(var t=0,r=e.curves.length;t<r;t++){var n=e.curves[t];this.curves.push((new Hu[n.type]).fromJSON(n))}return this}}),ju.prototype=Object.assign(Object.create(Vu.prototype),{constructor:ju,setFromPoints:function(e){this.moveTo(e[0].x,e[0].y);for(var t=1,r=e.length;t<r;t++)this.lineTo(e[t].x,e[t].y);return this},moveTo:function(e,t){return this.currentPoint.set(e,t),this},lineTo:function(e,t){var r=new Uu(this.currentPoint.clone(),new Mr(e,t));return this.curves.push(r),this.currentPoint.set(e,t),this},quadraticCurveTo:function(e,t,r,n){var i=new Gu(this.currentPoint.clone(),new Mr(e,t),new Mr(r,n));return this.curves.push(i),this.currentPoint.set(r,n),this},bezierCurveTo:function(e,t,r,n,i,a){var o=new Bu(this.currentPoint.clone(),new Mr(e,t),new Mr(r,n),new Mr(i,a));return this.curves.push(o),this.currentPoint.set(i,a),this},splineThru:function(e){var t=new ku([this.currentPoint.clone()].concat(e));return this.curves.push(t),this.currentPoint.copy(e[e.length-1]),this},arc:function(e,t,r,n,i,a){var o=this.currentPoint.x,s=this.currentPoint.y;return this.absarc(e+o,t+s,r,n,i,a),this},absarc:function(e,t,r,n,i,a){return this.absellipse(e,t,r,r,n,i,a),this},ellipse:function(e,t,r,n,i,a,o,s){var l=this.currentPoint.x,c=this.currentPoint.y;return this.absellipse(e+l,t+c,r,n,i,a,o,s),this},absellipse:function(e,t,r,n,i,a,o,s){var l=new Mu(e,t,r,n,i,a,o,s);if(this.curves.length>0){var c=l.getPoint(0);c.equals(this.currentPoint)||this.lineTo(c.x,c.y)}this.curves.push(l);var u=l.getPoint(1);return this.currentPoint.copy(u),this},copy:function(e){return Vu.prototype.copy.call(this,e),this.currentPoint.copy(e.currentPoint),this},toJSON:function(){var e=Vu.prototype.toJSON.call(this);return e.currentPoint=this.currentPoint.toArray(),e},fromJSON:function(e){return Vu.prototype.fromJSON.call(this,e),this.currentPoint.fromArray(e.currentPoint),this}}),Wu.prototype=Object.assign(Object.create(ju.prototype),{constructor:Wu,getPointsHoles:function(e){for(var t=[],r=0,n=this.holes.length;r<n;r++)t[r]=this.holes[r].getPoints(e);return t},extractPoints:function(e){return{shape:this.getPoints(e),holes:this.getPointsHoles(e)}},copy:function(e){ju.prototype.copy.call(this,e),this.holes=[];for(var t=0,r=e.holes.length;t<r;t++){var n=e.holes[t];this.holes.push(n.clone())}return this},toJSON:function(){var e=ju.prototype.toJSON.call(this);e.uuid=this.uuid,e.holes=[];for(var t=0,r=this.holes.length;t<r;t++){var n=this.holes[t];e.holes.push(n.toJSON())}return e},fromJSON:function(e){ju.prototype.fromJSON.call(this,e),this.uuid=e.uuid,this.holes=[];for(var t=0,r=e.holes.length;t<r;t++){var n=e.holes[t];this.holes.push((new ju).fromJSON(n))}return this}}),qu.prototype=Object.assign(Object.create(un.prototype),{constructor:qu,isLight:!0,copy:function(e){return un.prototype.copy.call(this,e),this.color.copy(e.color),this.intensity=e.intensity,this},toJSON:function(e){var t=un.prototype.toJSON.call(this,e);return t.object.color=this.color.getHex(),t.object.intensity=this.intensity,void 0!==this.groundColor&&(t.object.groundColor=this.groundColor.getHex()),void 0!==this.distance&&(t.object.distance=this.distance),void 0!==this.angle&&(t.object.angle=this.angle),void 0!==this.decay&&(t.object.decay=this.decay),void 0!==this.penumbra&&(t.object.penumbra=this.penumbra),void 0!==this.shadow&&(t.object.shadow=this.shadow.toJSON()),t}}),Xu.prototype=Object.assign(Object.create(qu.prototype),{constructor:Xu,isHemisphereLight:!0,copy:function(e){return qu.prototype.copy.call(this,e),this.groundColor.copy(e.groundColor),this}}),Object.assign(Yu.prototype,{_projScreenMatrix:new Wr,_lightPositionWorld:new Rr,_lookTarget:new Rr,getViewportCount:function(){return this._viewportCount},getFrustum:function(){return this._frustum},updateMatrices:function(e){var t=this.camera,r=this.matrix,n=this._projScreenMatrix,i=this._lookTarget,a=this._lightPositionWorld;a.setFromMatrixPosition(e.matrixWorld),t.position.copy(a),i.setFromMatrixPosition(e.target.matrixWorld),t.lookAt(i),t.updateMatrixWorld(),n.multiplyMatrices(t.projectionMatrix,t.matrixWorldInverse),this._frustum.setFromMatrix(n),r.set(.5,0,0,.5,0,.5,0,.5,0,0,.5,.5,0,0,0,1),r.multiply(t.projectionMatrix),r.multiply(t.matrixWorldInverse)},getViewport:function(e){return this._viewports[e]},getFrameExtents:function(){return this._frameExtents},copy:function(e){return this.camera=e.camera.clone(),this.bias=e.bias,this.radius=e.radius,this.mapSize.copy(e.mapSize),this},clone:function(){return(new this.constructor).copy(this)},toJSON:function(){var e={};return 0!==this.bias&&(e.bias=this.bias),1!==this.radius&&(e.radius=this.radius),512===this.mapSize.x&&512===this.mapSize.y||(e.mapSize=this.mapSize.toArray()),e.camera=this.camera.toJSON(!1).object,delete e.camera.matrix,e}}),Qu.prototype=Object.assign(Object.create(Yu.prototype),{constructor:Qu,isSpotLightShadow:!0,updateMatrices:function(e){var t=this.camera,r=2*_r.RAD2DEG*e.angle,n=this.mapSize.width/this.mapSize.height,i=e.distance||t.far;r===t.fov&&n===t.aspect&&i===t.far||(t.fov=r,t.aspect=n,t.far=i,t.updateProjectionMatrix()),Yu.prototype.updateMatrices.call(this,e)}}),Zu.prototype=Object.assign(Object.create(qu.prototype),{constructor:Zu,isSpotLight:!0,copy:function(e){return qu.prototype.copy.call(this,e),this.distance=e.distance,this.angle=e.angle,this.penumbra=e.penumbra,this.decay=e.decay,this.target=e.target.clone(),this.shadow=e.shadow.clone(),this}}),Ju.prototype=Object.assign(Object.create(Yu.prototype),{constructor:Ju,isPointLightShadow:!0,updateMatrices:function(e,t){void 0===t&&(t=0);var r=this.camera,n=this.matrix,i=this._lightPositionWorld,a=this._lookTarget,o=this._projScreenMatrix;i.setFromMatrixPosition(e.matrixWorld),r.position.copy(i),a.copy(r.position),a.add(this._cubeDirections[t]),r.up.copy(this._cubeUps[t]),r.lookAt(a),r.updateMatrixWorld(),n.makeTranslation(-i.x,-i.y,-i.z),o.multiplyMatrices(r.projectionMatrix,r.matrixWorldInverse),this._frustum.setFromMatrix(o)}}),Ku.prototype=Object.assign(Object.create(qu.prototype),{constructor:Ku,isPointLight:!0,copy:function(e){return qu.prototype.copy.call(this,e),this.distance=e.distance,this.decay=e.decay,this.shadow=e.shadow.clone(),this}}),$u.prototype=Object.assign(Object.create(ca.prototype),{constructor:$u,isOrthographicCamera:!0,copy:function(e,t){return ca.prototype.copy.call(this,e,t),this.left=e.left,this.right=e.right,this.top=e.top,this.bottom=e.bottom,this.near=e.near,this.far=e.far,this.zoom=e.zoom,this.view=null===e.view?null:Object.assign({},e.view),this},setViewOffset:function(e,t,r,n,i,a){null===this.view&&(this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1}),this.view.enabled=!0,this.view.fullWidth=e,this.view.fullHeight=t,this.view.offsetX=r,this.view.offsetY=n,this.view.width=i,this.view.height=a,this.updateProjectionMatrix()},clearViewOffset:function(){null!==this.view&&(this.view.enabled=!1),this.updateProjectionMatrix()},updateProjectionMatrix:function(){var e=(this.right-this.left)/(2*this.zoom),t=(this.top-this.bottom)/(2*this.zoom),r=(this.right+this.left)/2,n=(this.top+this.bottom)/2,i=r-e,a=r+e,o=n+t,s=n-t;if(null!==this.view&&this.view.enabled){var l=this.zoom/(this.view.width/this.view.fullWidth),c=this.zoom/(this.view.height/this.view.fullHeight),u=(this.right-this.left)/this.view.width,h=(this.top-this.bottom)/this.view.height;a=(i+=u*(this.view.offsetX/l))+u*(this.view.width/l),s=(o-=h*(this.view.offsetY/c))-h*(this.view.height/c)}this.projectionMatrix.makeOrthographic(i,a,o,s,this.near,this.far),this.projectionMatrixInverse.getInverse(this.projectionMatrix)},toJSON:function(e){var t=un.prototype.toJSON.call(this,e);return t.object.zoom=this.zoom,t.object.left=this.left,t.object.right=this.right,t.object.top=this.top,t.object.bottom=this.bottom,t.object.near=this.near,t.object.far=this.far,null!==this.view&&(t.object.view=Object.assign({},this.view)),t}}),eh.prototype=Object.assign(Object.create(Yu.prototype),{constructor:eh,isDirectionalLightShadow:!0,updateMatrices:function(e){Yu.prototype.updateMatrices.call(this,e)}}),th.prototype=Object.assign(Object.create(qu.prototype),{constructor:th,isDirectionalLight:!0,copy:function(e){return qu.prototype.copy.call(this,e),this.target=e.target.clone(),this.shadow=e.shadow.clone(),this}}),rh.prototype=Object.assign(Object.create(qu.prototype),{constructor:rh,isAmbientLight:!0}),nh.prototype=Object.assign(Object.create(qu.prototype),{constructor:nh,isRectAreaLight:!0,copy:function(e){return qu.prototype.copy.call(this,e),this.width=e.width,this.height=e.height,this},toJSON:function(e){var t=qu.prototype.toJSON.call(this,e);return t.object.width=this.width,t.object.height=this.height,t}}),ih.prototype=Object.assign(Object.create(fu.prototype),{constructor:ih,load:function(e,t,r,n){var i=this,a=new vu(i.manager);a.setPath(i.path),a.load(e,(function(e){t(i.parse(JSON.parse(e)))}),r,n)},parse:function(e){var t=this.textures;function r(e){return void 0===t[e]&&console.warn("THREE.MaterialLoader: Undefined texture",e),t[e]}var n=new Qc[e.type];if(void 0!==e.uuid&&(n.uuid=e.uuid),void 0!==e.name&&(n.name=e.name),void 0!==e.color&&n.color.setHex(e.color),void 0!==e.roughness&&(n.roughness=e.roughness),void 0!==e.metalness&&(n.metalness=e.metalness),void 0!==e.sheen&&(n.sheen=(new ti).setHex(e.sheen)),void 0!==e.emissive&&n.emissive.setHex(e.emissive),void 0!==e.specular&&n.specular.setHex(e.specular),void 0!==e.shininess&&(n.shininess=e.shininess),void 0!==e.clearcoat&&(n.clearcoat=e.clearcoat),void 0!==e.clearcoatRoughness&&(n.clearcoatRoughness=e.clearcoatRoughness),void 0!==e.vertexColors&&(n.vertexColors=e.vertexColors),void 0!==e.fog&&(n.fog=e.fog),void 0!==e.flatShading&&(n.flatShading=e.flatShading),void 0!==e.blending&&(n.blending=e.blending),void 0!==e.combine&&(n.combine=e.combine),void 0!==e.side&&(n.side=e.side),void 0!==e.opacity&&(n.opacity=e.opacity),void 0!==e.transparent&&(n.transparent=e.transparent),void 0!==e.alphaTest&&(n.alphaTest=e.alphaTest),void 0!==e.depthTest&&(n.depthTest=e.depthTest),void 0!==e.depthWrite&&(n.depthWrite=e.depthWrite),void 0!==e.colorWrite&&(n.colorWrite=e.colorWrite),void 0!==e.stencilWrite&&(n.stencilWrite=e.stencilWrite),void 0!==e.stencilWriteMask&&(n.stencilWriteMask=e.stencilWriteMask),void 0!==e.stencilFunc&&(n.stencilFunc=e.stencilFunc),void 0!==e.stencilRef&&(n.stencilRef=e.stencilRef),void 0!==e.stencilFuncMask&&(n.stencilFuncMask=e.stencilFuncMask),void 0!==e.stencilFail&&(n.stencilFail=e.stencilFail),void 0!==e.stencilZFail&&(n.stencilZFail=e.stencilZFail),void 0!==e.stencilZPass&&(n.stencilZPass=e.stencilZPass),void 0!==e.wireframe&&(n.wireframe=e.wireframe),void 0!==e.wireframeLinewidth&&(n.wireframeLinewidth=e.wireframeLinewidth),void 0!==e.wireframeLinecap&&(n.wireframeLinecap=e.wireframeLinecap),void 0!==e.wireframeLinejoin&&(n.wireframeLinejoin=e.wireframeLinejoin),void 0!==e.rotation&&(n.rotation=e.rotation),1!==e.linewidth&&(n.linewidth=e.linewidth),void 0!==e.dashSize&&(n.dashSize=e.dashSize),void 0!==e.gapSize&&(n.gapSize=e.gapSize),void 0!==e.scale&&(n.scale=e.scale),void 0!==e.polygonOffset&&(n.polygonOffset=e.polygonOffset),void 0!==e.polygonOffsetFactor&&(n.polygonOffsetFactor=e.polygonOffsetFactor),void 0!==e.polygonOffsetUnits&&(n.polygonOffsetUnits=e.polygonOffsetUnits),void 0!==e.skinning&&(n.skinning=e.skinning),void 0!==e.morphTargets&&(n.morphTargets=e.morphTargets),void 0!==e.morphNormals&&(n.morphNormals=e.morphNormals),void 0!==e.dithering&&(n.dithering=e.dithering),void 0!==e.visible&&(n.visible=e.visible),void 0!==e.toneMapped&&(n.toneMapped=e.toneMapped),void 0!==e.userData&&(n.userData=e.userData),void 0!==e.uniforms)for(var i in e.uniforms){var a=e.uniforms[i];switch(n.uniforms[i]={},a.type){case"t":n.uniforms[i].value=r(a.value);break;case"c":n.uniforms[i].value=(new ti).setHex(a.value);break;case"v2":n.uniforms[i].value=(new Mr).fromArray(a.value);break;case"v3":n.uniforms[i].value=(new Rr).fromArray(a.value);break;case"v4":n.uniforms[i].value=(new Br).fromArray(a.value);break;case"m3":n.uniforms[i].value=(new Pr).fromArray(a.value);case"m4":n.uniforms[i].value=(new Wr).fromArray(a.value);break;default:n.uniforms[i].value=a.value}}if(void 0!==e.defines&&(n.defines=e.defines),void 0!==e.vertexShader&&(n.vertexShader=e.vertexShader),void 0!==e.fragmentShader&&(n.fragmentShader=e.fragmentShader),void 0!==e.extensions)for(var o in e.extensions)n.extensions[o]=e.extensions[o];if(void 0!==e.shading&&(n.flatShading=1===e.shading),void 0!==e.size&&(n.size=e.size),void 0!==e.sizeAttenuation&&(n.sizeAttenuation=e.sizeAttenuation),void 0!==e.map&&(n.map=r(e.map)),void 0!==e.matcap&&(n.matcap=r(e.matcap)),void 0!==e.alphaMap&&(n.alphaMap=r(e.alphaMap),n.transparent=!0),void 0!==e.bumpMap&&(n.bumpMap=r(e.bumpMap)),void 0!==e.bumpScale&&(n.bumpScale=e.bumpScale),void 0!==e.normalMap&&(n.normalMap=r(e.normalMap)),void 0!==e.normalMapType&&(n.normalMapType=e.normalMapType),void 0!==e.normalScale){var s=e.normalScale;!1===Array.isArray(s)&&(s=[s,s]),n.normalScale=(new Mr).fromArray(s)}return void 0!==e.displacementMap&&(n.displacementMap=r(e.displacementMap)),void 0!==e.displacementScale&&(n.displacementScale=e.displacementScale),void 0!==e.displacementBias&&(n.displacementBias=e.displacementBias),void 0!==e.roughnessMap&&(n.roughnessMap=r(e.roughnessMap)),void 0!==e.metalnessMap&&(n.metalnessMap=r(e.metalnessMap)),void 0!==e.emissiveMap&&(n.emissiveMap=r(e.emissiveMap)),void 0!==e.emissiveIntensity&&(n.emissiveIntensity=e.emissiveIntensity),void 0!==e.specularMap&&(n.specularMap=r(e.specularMap)),void 0!==e.envMap&&(n.envMap=r(e.envMap)),void 0!==e.envMapIntensity&&(n.envMapIntensity=e.envMapIntensity),void 0!==e.reflectivity&&(n.reflectivity=e.reflectivity),void 0!==e.refractionRatio&&(n.refractionRatio=e.refractionRatio),void 0!==e.lightMap&&(n.lightMap=r(e.lightMap)),void 0!==e.lightMapIntensity&&(n.lightMapIntensity=e.lightMapIntensity),void 0!==e.aoMap&&(n.aoMap=r(e.aoMap)),void 0!==e.aoMapIntensity&&(n.aoMapIntensity=e.aoMapIntensity),void 0!==e.gradientMap&&(n.gradientMap=r(e.gradientMap)),void 0!==e.clearcoatNormalMap&&(n.clearcoatNormalMap=r(e.clearcoatNormalMap)),void 0!==e.clearcoatNormalScale&&(n.clearcoatNormalScale=(new Mr).fromArray(e.clearcoatNormalScale)),n},setTextures:function(e){return this.textures=e,this}});var ah={decodeText:function(e){if("undefined"!=typeof TextDecoder)return(new TextDecoder).decode(e);for(var t="",r=0,n=e.length;r<n;r++)t+=String.fromCharCode(e[r]);try{return decodeURIComponent(escape(t))}catch(e){return t}},extractUrlBase:function(e){var t=e.lastIndexOf("/");return-1===t?"./":e.substr(0,t+1)}};function oh(){Li.call(this),this.type="InstancedBufferGeometry",this.maxInstancedCount=void 0}function sh(e,t,r,n){"number"==typeof r&&(n=r,r=!1,console.error("THREE.InstancedBufferAttribute: The constructor now expects normalized as the third argument.")),ui.call(this,e,t,r),this.meshPerAttribute=n||1}function lh(e){fu.call(this,e)}oh.prototype=Object.assign(Object.create(Li.prototype),{constructor:oh,isInstancedBufferGeometry:!0,copy:function(e){return Li.prototype.copy.call(this,e),this.maxInstancedCount=e.maxInstancedCount,this},clone:function(){return(new this.constructor).copy(this)},toJSON:function(){var e=Li.prototype.toJSON.call(this);return e.maxInstancedCount=this.maxInstancedCount,e.isInstancedBufferGeometry=!0,e}}),sh.prototype=Object.assign(Object.create(ui.prototype),{constructor:sh,isInstancedBufferAttribute:!0,copy:function(e){return ui.prototype.copy.call(this,e),this.meshPerAttribute=e.meshPerAttribute,this},toJSON:function(){var e=ui.prototype.toJSON.call(this);return e.meshPerAttribute=this.meshPerAttribute,e.isInstancedBufferAttribute=!0,e}}),lh.prototype=Object.assign(Object.create(fu.prototype),{constructor:lh,load:function(e,t,r,n){var i=this,a=new vu(i.manager);a.setPath(i.path),a.load(e,(function(e){t(i.parse(JSON.parse(e)))}),r,n)},parse:function(e){var t=e.isInstancedBufferGeometry?new oh:new Li,r=e.data.index;if(void 0!==r){var n=new ch[r.type](r.array);t.setIndex(new ui(n,1))}var i=e.data.attributes;for(var a in i){var o=i[a],s=(n=new ch[o.type](o.array),new(o.isInstancedBufferAttribute?sh:ui)(n,o.itemSize,o.normalized));void 0!==o.name&&(s.name=o.name),t.setAttribute(a,s)}var l=e.data.morphAttributes;if(l)for(var a in l){for(var c=l[a],u=[],h=0,d=c.length;h<d;h++){o=c[h],s=new ui(n=new ch[o.type](o.array),o.itemSize,o.normalized);void 0!==o.name&&(s.name=o.name),u.push(s)}t.morphAttributes[a]=u}e.data.morphTargetsRelative&&(t.morphTargetsRelative=!0);var p=e.data.groups||e.data.drawcalls||e.data.offsets;if(void 0!==p){h=0;for(var f=p.length;h!==f;++h){var m=p[h];t.addGroup(m.start,m.count,m.materialIndex)}}var v=e.data.boundingSphere;if(void 0!==v){var g=new Rr;void 0!==v.center&&g.fromArray(v.center),t.boundingSphere=new Rn(g,v.radius)}return e.name&&(t.name=e.name),e.userData&&(t.userData=e.userData),t}});var ch={Int8Array:Int8Array,Uint8Array:Uint8Array,Uint8ClampedArray:"undefined"!=typeof Uint8ClampedArray?Uint8ClampedArray:Uint8Array,Int16Array:Int16Array,Uint16Array:Uint16Array,Int32Array:Int32Array,Uint32Array:Uint32Array,Float32Array:Float32Array,Float64Array:Float64Array};function uh(e){fu.call(this,e)}uh.prototype=Object.assign(Object.create(fu.prototype),{constructor:uh,load:function(e,t,r,n){var i=this,a=""===this.path?ah.extractUrlBase(e):this.path;this.resourcePath=this.resourcePath||a;var o=new vu(i.manager);o.setPath(this.path),o.load(e,(function(r){var a=null;try{a=JSON.parse(r)}catch(t){return void 0!==n&&n(t),void console.error("THREE:ObjectLoader: Can't parse "+e+".",t.message)}var o=a.metadata;void 0!==o&&void 0!==o.type&&"geometry"!==o.type.toLowerCase()?i.parse(a,t):console.error("THREE.ObjectLoader: Can't load "+e)}),r,n)},parse:function(e,t){var r=this.parseShape(e.shapes),n=this.parseGeometries(e.geometries,r),i=this.parseImages(e.images,(function(){void 0!==t&&t(s)})),a=this.parseTextures(e.textures,i),o=this.parseMaterials(e.materials,a),s=this.parseObject(e.object,n,o);return e.animations&&(s.animations=this.parseAnimations(e.animations)),void 0!==e.images&&0!==e.images.length||void 0!==t&&t(s),s},parseShape:function(e){var t={};if(void 0!==e)for(var r=0,n=e.length;r<n;r++){var i=(new Wu).fromJSON(e[r]);t[i.uuid]=i}return t},parseGeometries:function(e,t){var r={};if(void 0!==e)for(var n=new lh,i=0,a=e.length;i<a;i++){var o,s=e[i];switch(s.type){case"PlaneGeometry":case"PlaneBufferGeometry":o=new Nc[s.type](s.width,s.height,s.widthSegments,s.heightSegments);break;case"BoxGeometry":case"BoxBufferGeometry":case"CubeGeometry":o=new Nc[s.type](s.width,s.height,s.depth,s.widthSegments,s.heightSegments,s.depthSegments);break;case"CircleGeometry":case"CircleBufferGeometry":o=new Nc[s.type](s.radius,s.segments,s.thetaStart,s.thetaLength);break;case"CylinderGeometry":case"CylinderBufferGeometry":o=new Nc[s.type](s.radiusTop,s.radiusBottom,s.height,s.radialSegments,s.heightSegments,s.openEnded,s.thetaStart,s.thetaLength);break;case"ConeGeometry":case"ConeBufferGeometry":o=new Nc[s.type](s.radius,s.height,s.radialSegments,s.heightSegments,s.openEnded,s.thetaStart,s.thetaLength);break;case"SphereGeometry":case"SphereBufferGeometry":o=new Nc[s.type](s.radius,s.widthSegments,s.heightSegments,s.phiStart,s.phiLength,s.thetaStart,s.thetaLength);break;case"DodecahedronGeometry":case"DodecahedronBufferGeometry":case"IcosahedronGeometry":case"IcosahedronBufferGeometry":case"OctahedronGeometry":case"OctahedronBufferGeometry":case"TetrahedronGeometry":case"TetrahedronBufferGeometry":o=new Nc[s.type](s.radius,s.detail);break;case"RingGeometry":case"RingBufferGeometry":o=new Nc[s.type](s.innerRadius,s.outerRadius,s.thetaSegments,s.phiSegments,s.thetaStart,s.thetaLength);break;case"TorusGeometry":case"TorusBufferGeometry":o=new Nc[s.type](s.radius,s.tube,s.radialSegments,s.tubularSegments,s.arc);break;case"TorusKnotGeometry":case"TorusKnotBufferGeometry":o=new Nc[s.type](s.radius,s.tube,s.tubularSegments,s.radialSegments,s.p,s.q);break;case"TubeGeometry":case"TubeBufferGeometry":o=new Nc[s.type]((new Hu[s.path.type]).fromJSON(s.path),s.tubularSegments,s.radius,s.radialSegments,s.closed);break;case"LatheGeometry":case"LatheBufferGeometry":o=new Nc[s.type](s.points,s.segments,s.phiStart,s.phiLength);break;case"PolyhedronGeometry":case"PolyhedronBufferGeometry":o=new Nc[s.type](s.vertices,s.indices,s.radius,s.details);break;case"ShapeGeometry":case"ShapeBufferGeometry":for(var l=[],c=0,u=s.shapes.length;c<u;c++){var h=t[s.shapes[c]];l.push(h)}o=new Nc[s.type](l,s.curveSegments);break;case"ExtrudeGeometry":case"ExtrudeBufferGeometry":for(l=[],c=0,u=s.shapes.length;c<u;c++){h=t[s.shapes[c]];l.push(h)}var d=s.options.extrudePath;void 0!==d&&(s.options.extrudePath=(new Hu[d.type]).fromJSON(d)),o=new Nc[s.type](l,s.options);break;case"BufferGeometry":case"InstancedBufferGeometry":o=n.parse(s);break;case"Geometry":if("THREE"in window&&"LegacyJSONLoader"in THREE)o=(new THREE.LegacyJSONLoader).parse(s,this.resourcePath).geometry;else console.error('THREE.ObjectLoader: You have to import LegacyJSONLoader in order load geometry data of type "Geometry".');break;default:console.warn('THREE.ObjectLoader: Unsupported geometry type "'+s.type+'"');continue}o.uuid=s.uuid,void 0!==s.name&&(o.name=s.name),!0===o.isBufferGeometry&&void 0!==s.userData&&(o.userData=s.userData),r[s.uuid]=o}return r},parseMaterials:function(e,t){var r={},n={};if(void 0!==e){var i=new ih;i.setTextures(t);for(var a=0,o=e.length;a<o;a++){var s=e[a];if("MultiMaterial"===s.type){for(var l=[],c=0;c<s.materials.length;c++){var u=s.materials[c];void 0===r[u.uuid]&&(r[u.uuid]=i.parse(u)),l.push(r[u.uuid])}n[s.uuid]=l}else void 0===r[s.uuid]&&(r[s.uuid]=i.parse(s)),n[s.uuid]=r[s.uuid]}}return n},parseAnimations:function(e){for(var t=[],r=0;r<e.length;r++){var n=e[r],i=cu.parse(n);void 0!==n.uuid&&(i.uuid=n.uuid),t.push(i)}return t},parseImages:function(e,t){var r=this,n={};function i(e){return r.manager.itemStart(e),a.load(e,(function(){r.manager.itemEnd(e)}),void 0,(function(){r.manager.itemError(e),r.manager.itemEnd(e)}))}if(void 0!==e&&e.length>0){var a=new bu(new du(t));a.setCrossOrigin(this.crossOrigin);for(var o=0,s=e.length;o<s;o++){var l=e[o],c=l.url;if(Array.isArray(c)){n[l.uuid]=[];for(var u=0,h=c.length;u<h;u++){var d=c[u],p=/^(\/\/)|([a-z]+:(\/\/)?)/i.test(d)?d:r.resourcePath+d;n[l.uuid].push(i(p))}}else{p=/^(\/\/)|([a-z]+:(\/\/)?)/i.test(l.url)?l.url:r.resourcePath+l.url;n[l.uuid]=i(p)}}}return n},parseTextures:function(e,t){function r(e,t){return"number"==typeof e?e:(console.warn("THREE.ObjectLoader.parseTexture: Constant should be in numeric form.",e),t[e])}var n={};if(void 0!==e)for(var i=0,a=e.length;i<a;i++){var o,s=e[i];void 0===s.image&&console.warn('THREE.ObjectLoader: No "image" specified for',s.uuid),void 0===t[s.image]&&console.warn("THREE.ObjectLoader: Undefined image",s.image),(o=Array.isArray(t[s.image])?new Ua(t[s.image]):new Or(t[s.image])).needsUpdate=!0,o.uuid=s.uuid,void 0!==s.name&&(o.name=s.name),void 0!==s.mapping&&(o.mapping=r(s.mapping,dh)),void 0!==s.offset&&o.offset.fromArray(s.offset),void 0!==s.repeat&&o.repeat.fromArray(s.repeat),void 0!==s.center&&o.center.fromArray(s.center),void 0!==s.rotation&&(o.rotation=s.rotation),void 0!==s.wrap&&(o.wrapS=r(s.wrap[0],ph),o.wrapT=r(s.wrap[1],ph)),void 0!==s.format&&(o.format=s.format),void 0!==s.type&&(o.type=s.type),void 0!==s.encoding&&(o.encoding=s.encoding),void 0!==s.minFilter&&(o.minFilter=r(s.minFilter,fh)),void 0!==s.magFilter&&(o.magFilter=r(s.magFilter,fh)),void 0!==s.anisotropy&&(o.anisotropy=s.anisotropy),void 0!==s.flipY&&(o.flipY=s.flipY),void 0!==s.premultiplyAlpha&&(o.premultiplyAlpha=s.premultiplyAlpha),void 0!==s.unpackAlignment&&(o.unpackAlignment=s.unpackAlignment),n[s.uuid]=o}return n},parseObject:function(e,t,r){var n;function i(e){return void 0===t[e]&&console.warn("THREE.ObjectLoader: Undefined geometry",e),t[e]}function a(e){if(void 0!==e){if(Array.isArray(e)){for(var t=[],n=0,i=e.length;n<i;n++){var a=e[n];void 0===r[a]&&console.warn("THREE.ObjectLoader: Undefined material",a),t.push(r[a])}return t}return void 0===r[e]&&console.warn("THREE.ObjectLoader: Undefined material",e),r[e]}}switch(e.type){case"Scene":n=new hn,void 0!==e.background&&Number.isInteger(e.background)&&(n.background=new ti(e.background)),void 0!==e.fog&&("Fog"===e.fog.type?n.fog=new Ss(e.fog.color,e.fog.near,e.fog.far):"FogExp2"===e.fog.type&&(n.fog=new Ms(e.fog.color,e.fog.density)));break;case"PerspectiveCamera":n=new ua(e.fov,e.aspect,e.near,e.far),void 0!==e.focus&&(n.focus=e.focus),void 0!==e.zoom&&(n.zoom=e.zoom),void 0!==e.filmGauge&&(n.filmGauge=e.filmGauge),void 0!==e.filmOffset&&(n.filmOffset=e.filmOffset),void 0!==e.view&&(n.view=Object.assign({},e.view));break;case"OrthographicCamera":n=new $u(e.left,e.right,e.top,e.bottom,e.near,e.far),void 0!==e.zoom&&(n.zoom=e.zoom),void 0!==e.view&&(n.view=Object.assign({},e.view));break;case"AmbientLight":n=new rh(e.color,e.intensity);break;case"DirectionalLight":n=new th(e.color,e.intensity);break;case"PointLight":n=new Ku(e.color,e.intensity,e.distance,e.decay);break;case"RectAreaLight":n=new nh(e.color,e.intensity,e.width,e.height);break;case"SpotLight":n=new Zu(e.color,e.intensity,e.distance,e.angle,e.penumbra,e.decay);break;case"HemisphereLight":n=new Xu(e.color,e.groundColor,e.intensity);break;case"SkinnedMesh":console.warn("THREE.ObjectLoader.parseObject() does not support SkinnedMesh yet.");case"Mesh":var o=i(e.geometry),s=a(e.material);n=o.bones&&o.bones.length>0?new Ys(o,s):new Xi(o,s);break;case"InstancedMesh":o=i(e.geometry),s=a(e.material);var l=e.count,c=e.instanceMatrix;(n=new nl(o,s,l)).instanceMatrix=new ui(new Float32Array(c.array),16);break;case"LOD":n=new Xs;break;case"Line":n=new ul(i(e.geometry),a(e.material),e.mode);break;case"LineLoop":n=new fl(i(e.geometry),a(e.material));break;case"LineSegments":n=new pl(i(e.geometry),a(e.material));break;case"PointCloud":case"Points":n=new bl(i(e.geometry),a(e.material));break;case"Sprite":n=new Vs(a(e.material));break;case"Group":n=new As;break;default:n=new un}if(n.uuid=e.uuid,void 0!==e.name&&(n.name=e.name),void 0!==e.matrix?(n.matrix.fromArray(e.matrix),void 0!==e.matrixAutoUpdate&&(n.matrixAutoUpdate=e.matrixAutoUpdate),n.matrixAutoUpdate&&n.matrix.decompose(n.position,n.quaternion,n.scale)):(void 0!==e.position&&n.position.fromArray(e.position),void 0!==e.rotation&&n.rotation.fromArray(e.rotation),void 0!==e.quaternion&&n.quaternion.fromArray(e.quaternion),void 0!==e.scale&&n.scale.fromArray(e.scale)),void 0!==e.castShadow&&(n.castShadow=e.castShadow),void 0!==e.receiveShadow&&(n.receiveShadow=e.receiveShadow),e.shadow&&(void 0!==e.shadow.bias&&(n.shadow.bias=e.shadow.bias),void 0!==e.shadow.radius&&(n.shadow.radius=e.shadow.radius),void 0!==e.shadow.mapSize&&n.shadow.mapSize.fromArray(e.shadow.mapSize),void 0!==e.shadow.camera&&(n.shadow.camera=this.parseObject(e.shadow.camera))),void 0!==e.visible&&(n.visible=e.visible),void 0!==e.frustumCulled&&(n.frustumCulled=e.frustumCulled),void 0!==e.renderOrder&&(n.renderOrder=e.renderOrder),void 0!==e.userData&&(n.userData=e.userData),void 0!==e.layers&&(n.layers.mask=e.layers),void 0!==e.children)for(var u=e.children,h=0;h<u.length;h++)n.add(this.parseObject(u[h],t,r));if("LOD"===e.type){void 0!==e.autoUpdate&&(n.autoUpdate=e.autoUpdate);for(var d=e.levels,p=0;p<d.length;p++){var f=d[p],m=n.getObjectByProperty("uuid",f.object);void 0!==m&&n.addLevel(m,f.distance)}}return n}});var hh,dh={UVMapping:ce,CubeReflectionMapping:ue,CubeRefractionMapping:he,EquirectangularReflectionMapping:de,EquirectangularRefractionMapping:pe,SphericalReflectionMapping:fe,CubeUVReflectionMapping:me,CubeUVRefractionMapping:ve},ph={RepeatWrapping:ge,ClampToEdgeWrapping:ye,MirroredRepeatWrapping:xe},fh={NearestFilter:be,NearestMipmapNearestFilter:Ae,NearestMipmapLinearFilter:_e,LinearFilter:Se,LinearMipmapNearestFilter:Ee,LinearMipmapLinearFilter:Re};function mh(e){"undefined"==typeof createImageBitmap&&console.warn("THREE.ImageBitmapLoader: createImageBitmap() not supported."),"undefined"==typeof fetch&&console.warn("THREE.ImageBitmapLoader: fetch() not supported."),fu.call(this,e),this.options=void 0}function vh(){this.type="ShapePath",this.color=new ti,this.subPaths=[],this.currentPath=null}function gh(e){this.type="Font",this.data=e}function yh(e,t,r,n,i){var a=i.glyphs[e]||i.glyphs["?"];if(a){var o,s,l,c,u,h,d,p,f=new vh;if(a.o)for(var m=a._cachedOutline||(a._cachedOutline=a.o.split(" ")),v=0,g=m.length;v<g;){switch(m[v++]){case"m":o=m[v++]*t+r,s=m[v++]*t+n,f.moveTo(o,s);break;case"l":o=m[v++]*t+r,s=m[v++]*t+n,f.lineTo(o,s);break;case"q":l=m[v++]*t+r,c=m[v++]*t+n,u=m[v++]*t+r,h=m[v++]*t+n,f.quadraticCurveTo(u,h,l,c);break;case"b":l=m[v++]*t+r,c=m[v++]*t+n,u=m[v++]*t+r,h=m[v++]*t+n,d=m[v++]*t+r,p=m[v++]*t+n,f.bezierCurveTo(u,h,d,p,l,c)}}return{offsetX:a.ha*t,path:f}}console.error('THREE.Font: character "'+e+'" does not exists in font family '+i.familyName+".")}function xh(e){fu.call(this,e)}mh.prototype=Object.assign(Object.create(fu.prototype),{constructor:mh,setOptions:function(e){return this.options=e,this},load:function(e,t,r,n){void 0===e&&(e=""),void 0!==this.path&&(e=this.path+e),e=this.manager.resolveURL(e);var i=this,a=hu.get(e);if(void 0!==a)return i.manager.itemStart(e),setTimeout((function(){t&&t(a),i.manager.itemEnd(e)}),0),a;fetch(e).then((function(e){return e.blob()})).then((function(e){return void 0===i.options?createImageBitmap(e):createImageBitmap(e,i.options)})).then((function(r){hu.add(e,r),t&&t(r),i.manager.itemEnd(e)})).catch((function(t){n&&n(t),i.manager.itemError(e),i.manager.itemEnd(e)})),i.manager.itemStart(e)}}),Object.assign(vh.prototype,{moveTo:function(e,t){return this.currentPath=new ju,this.subPaths.push(this.currentPath),this.currentPath.moveTo(e,t),this},lineTo:function(e,t){return this.currentPath.lineTo(e,t),this},quadraticCurveTo:function(e,t,r,n){return this.currentPath.quadraticCurveTo(e,t,r,n),this},bezierCurveTo:function(e,t,r,n,i,a){return this.currentPath.bezierCurveTo(e,t,r,n,i,a),this},splineThru:function(e){return this.currentPath.splineThru(e),this},toShapes:function(e,t){function r(e){for(var t=[],r=0,n=e.length;r<n;r++){var i=e[r],a=new Wu;a.curves=i.curves,t.push(a)}return t}function n(e,t){for(var r=t.length,n=!1,i=r-1,a=0;a<r;i=a++){var o=t[i],s=t[a],l=s.x-o.x,c=s.y-o.y;if(Math.abs(c)>Number.EPSILON){if(c<0&&(o=t[a],l=-l,s=t[i],c=-c),e.y<o.y||e.y>s.y)continue;if(e.y===o.y){if(e.x===o.x)return!0}else{var u=c*(e.x-o.x)-l*(e.y-o.y);if(0===u)return!0;if(u<0)continue;n=!n}}else{if(e.y!==o.y)continue;if(s.x<=e.x&&e.x<=o.x||o.x<=e.x&&e.x<=s.x)return!0}}return n}var i=pc.isClockWise,a=this.subPaths;if(0===a.length)return[];if(!0===t)return r(a);var o,s,l,c=[];if(1===a.length)return s=a[0],(l=new Wu).curves=s.curves,c.push(l),c;var u=!i(a[0].getPoints());u=e?!u:u;var h,d,p=[],f=[],m=[],v=0;f[v]=void 0,m[v]=[];for(var g=0,y=a.length;g<y;g++)o=i(h=(s=a[g]).getPoints()),(o=e?!o:o)?(!u&&f[v]&&v++,f[v]={s:new Wu,p:h},f[v].s.curves=s.curves,u&&v++,m[v]=[]):m[v].push({h:s,p:h[0]});if(!f[0])return r(a);if(f.length>1){for(var x=!1,b=[],A=0,w=f.length;A<w;A++)p[A]=[];for(A=0,w=f.length;A<w;A++)for(var _=m[A],M=0;M<_.length;M++){for(var S=_[M],E=!0,T=0;T<f.length;T++)n(S.p,f[T].p)&&(A!==T&&b.push({froms:A,tos:T,hole:M}),E?(E=!1,p[T].push(S)):x=!0);E&&p[A].push(S)}b.length>0&&(x||(m=p))}g=0;for(var R=f.length;g<R;g++){l=f[g].s,c.push(l);for(var L=0,C=(d=m[g]).length;L<C;L++)l.holes.push(d[L].h)}return c}}),Object.assign(gh.prototype,{isFont:!0,generateShapes:function(e,t){void 0===t&&(t=100);for(var r=[],n=function(e,t,r){for(var n=Array.from?Array.from(e):String(e).split(""),i=t/r.resolution,a=(r.boundingBox.yMax-r.boundingBox.yMin+r.underlineThickness)*i,o=[],s=0,l=0,c=0;c<n.length;c++){var u=n[c];if("\n"===u)s=0,l-=a;else{var h=yh(u,i,s,l,r);s+=h.offsetX,o.push(h.path)}}return o}(e,t,this.data),i=0,a=n.length;i<a;i++)Array.prototype.push.apply(r,n[i].toShapes());return r}}),xh.prototype=Object.assign(Object.create(fu.prototype),{constructor:xh,load:function(e,t,r,n){var i=this,a=new vu(this.manager);a.setPath(this.path),a.load(e,(function(e){var r;try{r=JSON.parse(e)}catch(t){console.warn("THREE.FontLoader: typeface.js support is being deprecated. Use typeface.json instead."),r=JSON.parse(e.substring(65,e.length-2))}var n=i.parse(r);t&&t(n)}),r,n)},parse:function(e){return new gh(e)}});var bh={getContext:function(){return void 0===hh&&(hh=new(window.AudioContext||window.webkitAudioContext)),hh},setContext:function(e){hh=e}};function Ah(e){fu.call(this,e)}function wh(){this.coefficients=[];for(var e=0;e<9;e++)this.coefficients.push(new Rr)}function _h(e,t){qu.call(this,void 0,t),this.sh=void 0!==e?e:new wh}function Mh(e,t,r){_h.call(this,void 0,r);var n=(new ti).set(e),i=(new ti).set(t),a=new Rr(n.r,n.g,n.b),o=new Rr(i.r,i.g,i.b),s=Math.sqrt(Math.PI),l=s*Math.sqrt(.75);this.sh.coefficients[0].copy(a).add(o).multiplyScalar(s),this.sh.coefficients[1].copy(a).sub(o).multiplyScalar(l)}function Sh(e,t){_h.call(this,void 0,t);var r=(new ti).set(e);this.sh.coefficients[0].set(r.r,r.g,r.b).multiplyScalar(2*Math.sqrt(Math.PI))}Ah.prototype=Object.assign(Object.create(fu.prototype),{constructor:Ah,load:function(e,t,r,n){var i=new vu(this.manager);i.setResponseType("arraybuffer"),i.setPath(this.path),i.load(e,(function(e){var r=e.slice(0);bh.getContext().decodeAudioData(r,(function(e){t(e)}))}),r,n)}}),Object.assign(wh.prototype,{isSphericalHarmonics3:!0,set:function(e){for(var t=0;t<9;t++)this.coefficients[t].copy(e[t]);return this},zero:function(){for(var e=0;e<9;e++)this.coefficients[e].set(0,0,0);return this},getAt:function(e,t){var r=e.x,n=e.y,i=e.z,a=this.coefficients;return t.copy(a[0]).multiplyScalar(.282095),t.addScale(a[1],.488603*n),t.addScale(a[2],.488603*i),t.addScale(a[3],.488603*r),t.addScale(a[4],r*n*1.092548),t.addScale(a[5],n*i*1.092548),t.addScale(a[6],.315392*(3*i*i-1)),t.addScale(a[7],r*i*1.092548),t.addScale(a[8],.546274*(r*r-n*n)),t},getIrradianceAt:function(e,t){var r=e.x,n=e.y,i=e.z,a=this.coefficients;return t.copy(a[0]).multiplyScalar(.886227),t.addScale(a[1],1.023328*n),t.addScale(a[2],1.023328*i),t.addScale(a[3],1.023328*r),t.addScale(a[4],.858086*r*n),t.addScale(a[5],.858086*n*i),t.addScale(a[6],.743125*i*i-.247708),t.addScale(a[7],.858086*r*i),t.addScale(a[8],.429043*(r*r-n*n)),t},add:function(e){for(var t=0;t<9;t++)this.coefficients[t].add(e.coefficients[t]);return this},scale:function(e){for(var t=0;t<9;t++)this.coefficients[t].multiplyScalar(e);return this},lerp:function(e,t){for(var r=0;r<9;r++)this.coefficients[r].lerp(e.coefficients[r],t);return this},equals:function(e){for(var t=0;t<9;t++)if(!this.coefficients[t].equals(e.coefficients[t]))return!1;return!0},copy:function(e){return this.set(e.coefficients)},clone:function(){return(new this.constructor).copy(this)},fromArray:function(e,t){void 0===t&&(t=0);for(var r=this.coefficients,n=0;n<9;n++)r[n].fromArray(e,t+3*n);return this},toArray:function(e,t){void 0===e&&(e=[]),void 0===t&&(t=0);for(var r=this.coefficients,n=0;n<9;n++)r[n].toArray(e,t+3*n);return e}}),Object.assign(wh,{getBasisAt:function(e,t){var r=e.x,n=e.y,i=e.z;t[0]=.282095,t[1]=.488603*n,t[2]=.488603*i,t[3]=.488603*r,t[4]=1.092548*r*n,t[5]=1.092548*n*i,t[6]=.315392*(3*i*i-1),t[7]=1.092548*r*i,t[8]=.546274*(r*r-n*n)}}),_h.prototype=Object.assign(Object.create(qu.prototype),{constructor:_h,isLightProbe:!0,copy:function(e){return qu.prototype.copy.call(this,e),this.sh.copy(e.sh),this.intensity=e.intensity,this},toJSON:function(e){return qu.prototype.toJSON.call(this,e)}}),Mh.prototype=Object.assign(Object.create(_h.prototype),{constructor:Mh,isHemisphereLightProbe:!0,copy:function(e){return _h.prototype.copy.call(this,e),this},toJSON:function(e){return _h.prototype.toJSON.call(this,e)}}),Sh.prototype=Object.assign(Object.create(_h.prototype),{constructor:Sh,isAmbientLightProbe:!0,copy:function(e){return _h.prototype.copy.call(this,e),this},toJSON:function(e){return _h.prototype.toJSON.call(this,e)}});var Eh=new Wr,Th=new Wr;function Rh(){this.type="StereoCamera",this.aspect=1,this.eyeSep=.064,this.cameraL=new ua,this.cameraL.layers.enable(1),this.cameraL.matrixAutoUpdate=!1,this.cameraR=new ua,this.cameraR.layers.enable(2),this.cameraR.matrixAutoUpdate=!1,this._cache={focus:null,fov:null,aspect:null,near:null,far:null,zoom:null,eyeSep:null}}function Lh(e){this.autoStart=void 0===e||e,this.startTime=0,this.oldTime=0,this.elapsedTime=0,this.running=!1}Object.assign(Rh.prototype,{update:function(e){var t=this._cache;if(t.focus!==e.focus||t.fov!==e.fov||t.aspect!==e.aspect*this.aspect||t.near!==e.near||t.far!==e.far||t.zoom!==e.zoom||t.eyeSep!==this.eyeSep){t.focus=e.focus,t.fov=e.fov,t.aspect=e.aspect*this.aspect,t.near=e.near,t.far=e.far,t.zoom=e.zoom,t.eyeSep=this.eyeSep;var r,n,i=e.projectionMatrix.clone(),a=t.eyeSep/2,o=a*t.near/t.focus,s=t.near*Math.tan(_r.DEG2RAD*t.fov*.5)/t.zoom;Th.elements[12]=-a,Eh.elements[12]=a,r=-s*t.aspect+o,n=s*t.aspect+o,i.elements[0]=2*t.near/(n-r),i.elements[8]=(n+r)/(n-r),this.cameraL.projectionMatrix.copy(i),r=-s*t.aspect-o,n=s*t.aspect-o,i.elements[0]=2*t.near/(n-r),i.elements[8]=(n+r)/(n-r),this.cameraR.projectionMatrix.copy(i)}this.cameraL.matrixWorld.copy(e.matrixWorld).multiply(Th),this.cameraR.matrixWorld.copy(e.matrixWorld).multiply(Eh)}}),Object.assign(Lh.prototype,{start:function(){this.startTime=("undefined"==typeof performance?Date:performance).now(),this.oldTime=this.startTime,this.elapsedTime=0,this.running=!0},stop:function(){this.getElapsedTime(),this.running=!1,this.autoStart=!1},getElapsedTime:function(){return this.getDelta(),this.elapsedTime},getDelta:function(){var e=0;if(this.autoStart&&!this.running)return this.start(),0;if(this.running){var t=("undefined"==typeof performance?Date:performance).now();e=(t-this.oldTime)/1e3,this.oldTime=t,this.elapsedTime+=e}return e}});var Ch=new Rr,Ph=new Sr,Dh=new Rr,Ih=new Rr;function Oh(){un.call(this),this.type="AudioListener",this.context=bh.getContext(),this.gain=this.context.createGain(),this.gain.connect(this.context.destination),this.filter=null,this.timeDelta=0,this._clock=new Lh}function Bh(e){un.call(this),this.type="Audio",this.listener=e,this.context=e.context,this.gain=this.context.createGain(),this.gain.connect(e.getInput()),this.autoplay=!1,this.buffer=null,this.detune=0,this.loop=!1,this.loopStart=0,this.loopEnd=0,this.offset=0,this.duration=void 0,this.playbackRate=1,this.isPlaying=!1,this.hasPlaybackControl=!0,this.sourceType="empty",this._startedAt=0,this._pausedAt=0,this.filters=[]}Oh.prototype=Object.assign(Object.create(un.prototype),{constructor:Oh,getInput:function(){return this.gain},removeFilter:function(){return null!==this.filter&&(this.gain.disconnect(this.filter),this.filter.disconnect(this.context.destination),this.gain.connect(this.context.destination),this.filter=null),this},getFilter:function(){return this.filter},setFilter:function(e){return null!==this.filter?(this.gain.disconnect(this.filter),this.filter.disconnect(this.context.destination)):this.gain.disconnect(this.context.destination),this.filter=e,this.gain.connect(this.filter),this.filter.connect(this.context.destination),this},getMasterVolume:function(){return this.gain.gain.value},setMasterVolume:function(e){return this.gain.gain.setTargetAtTime(e,this.context.currentTime,.01),this},updateMatrixWorld:function(e){un.prototype.updateMatrixWorld.call(this,e);var t=this.context.listener,r=this.up;if(this.timeDelta=this._clock.getDelta(),this.matrixWorld.decompose(Ch,Ph,Dh),Ih.set(0,0,-1).applyQuaternion(Ph),t.positionX){var n=this.context.currentTime+this.timeDelta;t.positionX.linearRampToValueAtTime(Ch.x,n),t.positionY.linearRampToValueAtTime(Ch.y,n),t.positionZ.linearRampToValueAtTime(Ch.z,n),t.forwardX.linearRampToValueAtTime(Ih.x,n),t.forwardY.linearRampToValueAtTime(Ih.y,n),t.forwardZ.linearRampToValueAtTime(Ih.z,n),t.upX.linearRampToValueAtTime(r.x,n),t.upY.linearRampToValueAtTime(r.y,n),t.upZ.linearRampToValueAtTime(r.z,n)}else t.setPosition(Ch.x,Ch.y,Ch.z),t.setOrientation(Ih.x,Ih.y,Ih.z,r.x,r.y,r.z)}}),Bh.prototype=Object.assign(Object.create(un.prototype),{constructor:Bh,getOutput:function(){return this.gain},setNodeSource:function(e){return this.hasPlaybackControl=!1,this.sourceType="audioNode",this.source=e,this.connect(),this},setMediaElementSource:function(e){return this.hasPlaybackControl=!1,this.sourceType="mediaNode",this.source=this.context.createMediaElementSource(e),this.connect(),this},setMediaStreamSource:function(e){return this.hasPlaybackControl=!1,this.sourceType="mediaStreamNode",this.source=this.context.createMediaStreamSource(e),this.connect(),this},setBuffer:function(e){return this.buffer=e,this.sourceType="buffer",this.autoplay&&this.play(),this},play:function(e){if(void 0===e&&(e=0),!0!==this.isPlaying){if(!1!==this.hasPlaybackControl){this._startedAt=this.context.currentTime+e;var t=this.context.createBufferSource();return t.buffer=this.buffer,t.loop=this.loop,t.loopStart=this.loopStart,t.loopEnd=this.loopEnd,t.onended=this.onEnded.bind(this),t.start(this._startedAt,this._pausedAt+this.offset,this.duration),this.isPlaying=!0,this.source=t,this.setDetune(this.detune),this.setPlaybackRate(this.playbackRate),this.connect()}console.warn("THREE.Audio: this Audio has no playback control.")}else console.warn("THREE.Audio: Audio is already playing.")},pause:function(){if(!1!==this.hasPlaybackControl)return!0===this.isPlaying&&(this._pausedAt=(this.context.currentTime-this._startedAt)*this.playbackRate,this.source.stop(),this.source.onended=null,this.isPlaying=!1),this;console.warn("THREE.Audio: this Audio has no playback control.")},stop:function(){if(!1!==this.hasPlaybackControl)return this._pausedAt=0,this.source.stop(),this.source.onended=null,this.isPlaying=!1,this;console.warn("THREE.Audio: this Audio has no playback control.")},connect:function(){if(this.filters.length>0){this.source.connect(this.filters[0]);for(var e=1,t=this.filters.length;e<t;e++)this.filters[e-1].connect(this.filters[e]);this.filters[this.filters.length-1].connect(this.getOutput())}else this.source.connect(this.getOutput());return this},disconnect:function(){if(this.filters.length>0){this.source.disconnect(this.filters[0]);for(var e=1,t=this.filters.length;e<t;e++)this.filters[e-1].disconnect(this.filters[e]);this.filters[this.filters.length-1].disconnect(this.getOutput())}else this.source.disconnect(this.getOutput());return this},getFilters:function(){return this.filters},setFilters:function(e){return e||(e=[]),!0===this.isPlaying?(this.disconnect(),this.filters=e,this.connect()):this.filters=e,this},setDetune:function(e){if(this.detune=e,void 0!==this.source.detune)return!0===this.isPlaying&&this.source.detune.setTargetAtTime(this.detune,this.context.currentTime,.01),this},getDetune:function(){return this.detune},getFilter:function(){return this.getFilters()[0]},setFilter:function(e){return this.setFilters(e?[e]:[])},setPlaybackRate:function(e){if(!1!==this.hasPlaybackControl)return this.playbackRate=e,!0===this.isPlaying&&this.source.playbackRate.setTargetAtTime(this.playbackRate,this.context.currentTime,.01),this;console.warn("THREE.Audio: this Audio has no playback control.")},getPlaybackRate:function(){return this.playbackRate},onEnded:function(){this.isPlaying=!1},getLoop:function(){return!1===this.hasPlaybackControl?(console.warn("THREE.Audio: this Audio has no playback control."),!1):this.loop},setLoop:function(e){if(!1!==this.hasPlaybackControl)return this.loop=e,!0===this.isPlaying&&(this.source.loop=this.loop),this;console.warn("THREE.Audio: this Audio has no playback control.")},setLoopStart:function(e){return this.loopStart=e,this},setLoopEnd:function(e){return this.loopEnd=e,this},getVolume:function(){return this.gain.gain.value},setVolume:function(e){return this.gain.gain.setTargetAtTime(e,this.context.currentTime,.01),this}});var Fh=new Rr,Uh=new Sr,Nh=new Rr,Gh=new Rr;function zh(e){Bh.call(this,e),this.panner=this.context.createPanner(),this.panner.panningModel="HRTF",this.panner.connect(this.gain)}function kh(e,t){this.analyser=e.context.createAnalyser(),this.analyser.fftSize=void 0!==t?t:2048,this.data=new Uint8Array(this.analyser.frequencyBinCount),e.getOutput().connect(this.analyser)}function Hh(e,t,r){this.binding=e,this.valueSize=r;var n,i=Float64Array;switch(t){case"quaternion":n=this._slerp;break;case"string":case"bool":i=Array,n=this._select;break;default:n=this._lerp}this.buffer=new i(4*r),this._mixBufferRegion=n,this.cumulativeWeight=0,this.useCount=0,this.referenceCount=0}zh.prototype=Object.assign(Object.create(Bh.prototype),{constructor:zh,getOutput:function(){return this.panner},getRefDistance:function(){return this.panner.refDistance},setRefDistance:function(e){return this.panner.refDistance=e,this},getRolloffFactor:function(){return this.panner.rolloffFactor},setRolloffFactor:function(e){return this.panner.rolloffFactor=e,this},getDistanceModel:function(){return this.panner.distanceModel},setDistanceModel:function(e){return this.panner.distanceModel=e,this},getMaxDistance:function(){return this.panner.maxDistance},setMaxDistance:function(e){return this.panner.maxDistance=e,this},setDirectionalCone:function(e,t,r){return this.panner.coneInnerAngle=e,this.panner.coneOuterAngle=t,this.panner.coneOuterGain=r,this},updateMatrixWorld:function(e){if(un.prototype.updateMatrixWorld.call(this,e),!0!==this.hasPlaybackControl||!1!==this.isPlaying){this.matrixWorld.decompose(Fh,Uh,Nh),Gh.set(0,0,1).applyQuaternion(Uh);var t=this.panner;if(t.positionX){var r=this.context.currentTime+this.listener.timeDelta;t.positionX.linearRampToValueAtTime(Fh.x,r),t.positionY.linearRampToValueAtTime(Fh.y,r),t.positionZ.linearRampToValueAtTime(Fh.z,r),t.orientationX.linearRampToValueAtTime(Gh.x,r),t.orientationY.linearRampToValueAtTime(Gh.y,r),t.orientationZ.linearRampToValueAtTime(Gh.z,r)}else t.setPosition(Fh.x,Fh.y,Fh.z),t.setOrientation(Gh.x,Gh.y,Gh.z)}}}),Object.assign(kh.prototype,{getFrequencyData:function(){return this.analyser.getByteFrequencyData(this.data),this.data},getAverageFrequency:function(){for(var e=0,t=this.getFrequencyData(),r=0;r<t.length;r++)e+=t[r];return e/t.length}}),Object.assign(Hh.prototype,{accumulate:function(e,t){var r=this.buffer,n=this.valueSize,i=e*n+n,a=this.cumulativeWeight;if(0===a){for(var o=0;o!==n;++o)r[i+o]=r[o];a=t}else{var s=t/(a+=t);this._mixBufferRegion(r,i,0,s,n)}this.cumulativeWeight=a},apply:function(e){var t=this.valueSize,r=this.buffer,n=e*t+t,i=this.cumulativeWeight,a=this.binding;if(this.cumulativeWeight=0,i<1){var o=3*t;this._mixBufferRegion(r,n,o,1-i,t)}for(var s=t,l=t+t;s!==l;++s)if(r[s]!==r[s+t]){a.setValue(r,n);break}},saveOriginalState:function(){var e=this.binding,t=this.buffer,r=this.valueSize,n=3*r;e.getValue(t,n);for(var i=r,a=n;i!==a;++i)t[i]=t[n+i%r];this.cumulativeWeight=0},restoreOriginalState:function(){var e=3*this.valueSize;this.binding.setValue(this.buffer,e)},_select:function(e,t,r,n,i){if(n>=.5)for(var a=0;a!==i;++a)e[t+a]=e[r+a]},_slerp:function(e,t,r,n){Sr.slerpFlat(e,t,e,t,e,r,n)},_lerp:function(e,t,r,n,i){for(var a=1-n,o=0;o!==i;++o){var s=t+o;e[s]=e[s]*a+e[r+o]*n}}});var Vh=new RegExp("[\\[\\]\\.:\\/]","g"),jh="[^"+"\\[\\]\\.:\\/".replace("\\.","")+"]",Wh=/((?:WC+[\/:])*)/.source.replace("WC","[^\\[\\]\\.:\\/]"),qh=/(WCOD+)?/.source.replace("WCOD",jh),Xh=/(?:\.(WC+)(?:\[(.+)\])?)?/.source.replace("WC","[^\\[\\]\\.:\\/]"),Yh=/\.(WC+)(?:\[(.+)\])?/.source.replace("WC","[^\\[\\]\\.:\\/]"),Qh=new RegExp("^"+Wh+qh+Xh+Yh+"$"),Zh=["material","materials","bones"];function Jh(e,t,r){var n=r||Kh.parseTrackName(t);this._targetGroup=e,this._bindings=e.subscribe_(t,n)}function Kh(e,t,r){this.path=t,this.parsedPath=r||Kh.parseTrackName(t),this.node=Kh.findNode(e,this.parsedPath.nodeName)||e,this.rootNode=e}function $h(){this.uuid=_r.generateUUID(),this._objects=Array.prototype.slice.call(arguments),this.nCachedObjects_=0;var e={};this._indicesByUUID=e;for(var t=0,r=arguments.length;t!==r;++t)e[arguments[t].uuid]=t;this._paths=[],this._parsedPaths=[],this._bindings=[],this._bindingsIndicesByPath={};var n=this;this.stats={objects:{get total(){return n._objects.length},get inUse(){return this.total-n.nCachedObjects_}},get bindingsPerObject(){return n._bindings.length}}}function ed(e,t,r){this._mixer=e,this._clip=t,this._localRoot=r||null;for(var n=t.tracks,i=n.length,a=new Array(i),o={endingStart:Pt,endingEnd:Pt},s=0;s!==i;++s){var l=n[s].createInterpolant(null);a[s]=l,l.settings=o}this._interpolantSettings=o,this._interpolants=a,this._propertyBindings=new Array(i),this._cacheIndex=null,this._byClipCacheIndex=null,this._timeScaleInterpolant=null,this._weightInterpolant=null,this.loop=Et,this._loopCount=-1,this._startTime=null,this.time=0,this.timeScale=1,this._effectiveTimeScale=1,this.weight=1,this._effectiveWeight=1,this.repetitions=1/0,this.paused=!1,this.enabled=!0,this.clampWhenFinished=!1,this.zeroSlopeAtStart=!0,this.zeroSlopeAtEnd=!0}function td(e){this._root=e,this._initMemoryManager(),this._accuIndex=0,this.time=0,this.timeScale=1}function rd(e){"string"==typeof e&&(console.warn("THREE.Uniform: Type parameter is no longer needed."),e=arguments[1]),this.value=e}function nd(e,t,r){Es.call(this,e,t),this.meshPerAttribute=r||1}function id(e,t,r,n){this.ray=new Fn(e,t),this.near=r||0,this.far=n||1/0,this.camera=null,this.params={Mesh:{},Line:{},LOD:{},Points:{threshold:1},Sprite:{}},Object.defineProperties(this.params,{PointCloud:{get:function(){return console.warn("THREE.Raycaster: params.PointCloud has been renamed to params.Points."),this.Points}}})}function ad(e,t){return e.distance-t.distance}function od(e,t,r,n){if(!1!==e.visible&&(e.raycast(t,r),!0===n))for(var i=e.children,a=0,o=i.length;a<o;a++)od(i[a],t,r,!0)}function sd(e,t,r){return this.radius=void 0!==e?e:1,this.phi=void 0!==t?t:0,this.theta=void 0!==r?r:0,this}function ld(e,t,r){return this.radius=void 0!==e?e:1,this.theta=void 0!==t?t:0,this.y=void 0!==r?r:0,this}Object.assign(Jh.prototype,{getValue:function(e,t){this.bind();var r=this._targetGroup.nCachedObjects_,n=this._bindings[r];void 0!==n&&n.getValue(e,t)},setValue:function(e,t){for(var r=this._bindings,n=this._targetGroup.nCachedObjects_,i=r.length;n!==i;++n)r[n].setValue(e,t)},bind:function(){for(var e=this._bindings,t=this._targetGroup.nCachedObjects_,r=e.length;t!==r;++t)e[t].bind()},unbind:function(){for(var e=this._bindings,t=this._targetGroup.nCachedObjects_,r=e.length;t!==r;++t)e[t].unbind()}}),Object.assign(Kh,{Composite:Jh,create:function(e,t,r){return e&&e.isAnimationObjectGroup?new Kh.Composite(e,t,r):new Kh(e,t,r)},sanitizeNodeName:function(e){return e.replace(/\s/g,"_").replace(Vh,"")},parseTrackName:function(e){var t=Qh.exec(e);if(!t)throw new Error("PropertyBinding: Cannot parse trackName: "+e);var r={nodeName:t[2],objectName:t[3],objectIndex:t[4],propertyName:t[5],propertyIndex:t[6]},n=r.nodeName&&r.nodeName.lastIndexOf(".");if(void 0!==n&&-1!==n){var i=r.nodeName.substring(n+1);-1!==Zh.indexOf(i)&&(r.nodeName=r.nodeName.substring(0,n),r.objectName=i)}if(null===r.propertyName||0===r.propertyName.length)throw new Error("PropertyBinding: can not parse propertyName from trackName: "+e);return r},findNode:function(e,t){if(!t||""===t||"root"===t||"."===t||-1===t||t===e.name||t===e.uuid)return e;if(e.skeleton){var r=e.skeleton.getBoneByName(t);if(void 0!==r)return r}if(e.children){var n=function(e){for(var r=0;r<e.length;r++){var i=e[r];if(i.name===t||i.uuid===t)return i;var a=n(i.children);if(a)return a}return null},i=n(e.children);if(i)return i}return null}}),Object.assign(Kh.prototype,{_getValue_unavailable:function(){},_setValue_unavailable:function(){},BindingType:{Direct:0,EntireArray:1,ArrayElement:2,HasFromToArray:3},Versioning:{None:0,NeedsUpdate:1,MatrixWorldNeedsUpdate:2},GetterByBindingType:[function(e,t){e[t]=this.node[this.propertyName]},function(e,t){for(var r=this.resolvedProperty,n=0,i=r.length;n!==i;++n)e[t++]=r[n]},function(e,t){e[t]=this.resolvedProperty[this.propertyIndex]},function(e,t){this.resolvedProperty.toArray(e,t)}],SetterByBindingTypeAndVersioning:[[function(e,t){this.targetObject[this.propertyName]=e[t]},function(e,t){this.targetObject[this.propertyName]=e[t],this.targetObject.needsUpdate=!0},function(e,t){this.targetObject[this.propertyName]=e[t],this.targetObject.matrixWorldNeedsUpdate=!0}],[function(e,t){for(var r=this.resolvedProperty,n=0,i=r.length;n!==i;++n)r[n]=e[t++]},function(e,t){for(var r=this.resolvedProperty,n=0,i=r.length;n!==i;++n)r[n]=e[t++];this.targetObject.needsUpdate=!0},function(e,t){for(var r=this.resolvedProperty,n=0,i=r.length;n!==i;++n)r[n]=e[t++];this.targetObject.matrixWorldNeedsUpdate=!0}],[function(e,t){this.resolvedProperty[this.propertyIndex]=e[t]},function(e,t){this.resolvedProperty[this.propertyIndex]=e[t],this.targetObject.needsUpdate=!0},function(e,t){this.resolvedProperty[this.propertyIndex]=e[t],this.targetObject.matrixWorldNeedsUpdate=!0}],[function(e,t){this.resolvedProperty.fromArray(e,t)},function(e,t){this.resolvedProperty.fromArray(e,t),this.targetObject.needsUpdate=!0},function(e,t){this.resolvedProperty.fromArray(e,t),this.targetObject.matrixWorldNeedsUpdate=!0}]],getValue:function(e,t){this.bind(),this.getValue(e,t)},setValue:function(e,t){this.bind(),this.setValue(e,t)},bind:function(){var e=this.node,t=this.parsedPath,r=t.objectName,n=t.propertyName,i=t.propertyIndex;if(e||(e=Kh.findNode(this.rootNode,t.nodeName)||this.rootNode,this.node=e),this.getValue=this._getValue_unavailable,this.setValue=this._setValue_unavailable,e){if(r){var a=t.objectIndex;switch(r){case"materials":if(!e.material)return void console.error("THREE.PropertyBinding: Can not bind to material as node does not have a material.",this);if(!e.material.materials)return void console.error("THREE.PropertyBinding: Can not bind to material.materials as node.material does not have a materials array.",this);e=e.material.materials;break;case"bones":if(!e.skeleton)return void console.error("THREE.PropertyBinding: Can not bind to bones as node does not have a skeleton.",this);e=e.skeleton.bones;for(var o=0;o<e.length;o++)if(e[o].name===a){a=o;break}break;default:if(void 0===e[r])return void console.error("THREE.PropertyBinding: Can not bind to objectName of node undefined.",this);e=e[r]}if(void 0!==a){if(void 0===e[a])return void console.error("THREE.PropertyBinding: Trying to bind to objectIndex of objectName, but is undefined.",this,e);e=e[a]}}var s=e[n];if(void 0!==s){var l=this.Versioning.None;this.targetObject=e,void 0!==e.needsUpdate?l=this.Versioning.NeedsUpdate:void 0!==e.matrixWorldNeedsUpdate&&(l=this.Versioning.MatrixWorldNeedsUpdate);var c=this.BindingType.Direct;if(void 0!==i){if("morphTargetInfluences"===n){if(!e.geometry)return void console.error("THREE.PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.",this);if(e.geometry.isBufferGeometry){if(!e.geometry.morphAttributes)return void console.error("THREE.PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.morphAttributes.",this);for(o=0;o<this.node.geometry.morphAttributes.position.length;o++)if(e.geometry.morphAttributes.position[o].name===i){i=o;break}}else{if(!e.geometry.morphTargets)return void console.error("THREE.PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.morphTargets.",this);for(o=0;o<this.node.geometry.morphTargets.length;o++)if(e.geometry.morphTargets[o].name===i){i=o;break}}}c=this.BindingType.ArrayElement,this.resolvedProperty=s,this.propertyIndex=i}else void 0!==s.fromArray&&void 0!==s.toArray?(c=this.BindingType.HasFromToArray,this.resolvedProperty=s):Array.isArray(s)?(c=this.BindingType.EntireArray,this.resolvedProperty=s):this.propertyName=n;this.getValue=this.GetterByBindingType[c],this.setValue=this.SetterByBindingTypeAndVersioning[c][l]}else{var u=t.nodeName;console.error("THREE.PropertyBinding: Trying to update property for track: "+u+"."+n+" but it wasn't found.",e)}}else console.error("THREE.PropertyBinding: Trying to update node for track: "+this.path+" but it wasn't found.")},unbind:function(){this.node=null,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}}),
//!\ DECLARE ALIAS AFTER assign prototype !
Object.assign(Kh.prototype,{_getValue_unbound:Kh.prototype.getValue,_setValue_unbound:Kh.prototype.setValue}),Object.assign($h.prototype,{isAnimationObjectGroup:!0,add:function(){for(var e=this._objects,t=e.length,r=this.nCachedObjects_,n=this._indicesByUUID,i=this._paths,a=this._parsedPaths,o=this._bindings,s=o.length,l=void 0,c=0,u=arguments.length;c!==u;++c){var h=arguments[c],d=h.uuid,p=n[d];if(void 0===p){p=t++,n[d]=p,e.push(h);for(var f=0,m=s;f!==m;++f)o[f].push(new Kh(h,i[f],a[f]))}else if(p<r){l=e[p];var v=--r,g=e[v];n[g.uuid]=p,e[p]=g,n[d]=v,e[v]=h;for(f=0,m=s;f!==m;++f){var y=o[f],x=y[v],b=y[p];y[p]=x,void 0===b&&(b=new Kh(h,i[f],a[f])),y[v]=b}}else e[p]!==l&&console.error("THREE.AnimationObjectGroup: Different objects with the same UUID detected. Clean the caches or recreate your infrastructure when reloading scenes.")}this.nCachedObjects_=r},remove:function(){for(var e=this._objects,t=this.nCachedObjects_,r=this._indicesByUUID,n=this._bindings,i=n.length,a=0,o=arguments.length;a!==o;++a){var s=arguments[a],l=s.uuid,c=r[l];if(void 0!==c&&c>=t){var u=t++,h=e[u];r[h.uuid]=c,e[c]=h,r[l]=u,e[u]=s;for(var d=0,p=i;d!==p;++d){var f=n[d],m=f[u],v=f[c];f[c]=m,f[u]=v}}}this.nCachedObjects_=t},uncache:function(){for(var e=this._objects,t=e.length,r=this.nCachedObjects_,n=this._indicesByUUID,i=this._bindings,a=i.length,o=0,s=arguments.length;o!==s;++o){var l=arguments[o],c=l.uuid,u=n[c];if(void 0!==u)if(delete n[c],u<r){var h=--r,d=e[h],p=e[y=--t];n[d.uuid]=u,e[u]=d,n[p.uuid]=h,e[h]=p,e.pop();for(var f=0,m=a;f!==m;++f){var v=(x=i[f])[h],g=x[y];x[u]=v,x[h]=g,x.pop()}}else{var y;n[(p=e[y=--t]).uuid]=u,e[u]=p,e.pop();for(f=0,m=a;f!==m;++f){var x;(x=i[f])[u]=x[y],x.pop()}}}this.nCachedObjects_=r},subscribe_:function(e,t){var r=this._bindingsIndicesByPath,n=r[e],i=this._bindings;if(void 0!==n)return i[n];var a=this._paths,o=this._parsedPaths,s=this._objects,l=s.length,c=this.nCachedObjects_,u=new Array(l);n=i.length,r[e]=n,a.push(e),o.push(t),i.push(u);for(var h=c,d=s.length;h!==d;++h){var p=s[h];u[h]=new Kh(p,e,t)}return u},unsubscribe_:function(e){var t=this._bindingsIndicesByPath,r=t[e];if(void 0!==r){var n=this._paths,i=this._parsedPaths,a=this._bindings,o=a.length-1,s=a[o];t[e[o]]=r,a[r]=s,a.pop(),i[r]=i[o],i.pop(),n[r]=n[o],n.pop()}}}),Object.assign(ed.prototype,{play:function(){return this._mixer._activateAction(this),this},stop:function(){return this._mixer._deactivateAction(this),this.reset()},reset:function(){return this.paused=!1,this.enabled=!0,this.time=0,this._loopCount=-1,this._startTime=null,this.stopFading().stopWarping()},isRunning:function(){return this.enabled&&!this.paused&&0!==this.timeScale&&null===this._startTime&&this._mixer._isActiveAction(this)},isScheduled:function(){return this._mixer._isActiveAction(this)},startAt:function(e){return this._startTime=e,this},setLoop:function(e,t){return this.loop=e,this.repetitions=t,this},setEffectiveWeight:function(e){return this.weight=e,this._effectiveWeight=this.enabled?e:0,this.stopFading()},getEffectiveWeight:function(){return this._effectiveWeight},fadeIn:function(e){return this._scheduleFading(e,0,1)},fadeOut:function(e){return this._scheduleFading(e,1,0)},crossFadeFrom:function(e,t,r){if(e.fadeOut(t),this.fadeIn(t),r){var n=this._clip.duration,i=e._clip.duration,a=i/n,o=n/i;e.warp(1,a,t),this.warp(o,1,t)}return this},crossFadeTo:function(e,t,r){return e.crossFadeFrom(this,t,r)},stopFading:function(){var e=this._weightInterpolant;return null!==e&&(this._weightInterpolant=null,this._mixer._takeBackControlInterpolant(e)),this},setEffectiveTimeScale:function(e){return this.timeScale=e,this._effectiveTimeScale=this.paused?0:e,this.stopWarping()},getEffectiveTimeScale:function(){return this._effectiveTimeScale},setDuration:function(e){return this.timeScale=this._clip.duration/e,this.stopWarping()},syncWith:function(e){return this.time=e.time,this.timeScale=e.timeScale,this.stopWarping()},halt:function(e){return this.warp(this._effectiveTimeScale,0,e)},warp:function(e,t,r){var n=this._mixer,i=n.time,a=this._timeScaleInterpolant,o=this.timeScale;null===a&&(a=n._lendControlInterpolant(),this._timeScaleInterpolant=a);var s=a.parameterPositions,l=a.sampleValues;return s[0]=i,s[1]=i+r,l[0]=e/o,l[1]=t/o,this},stopWarping:function(){var e=this._timeScaleInterpolant;return null!==e&&(this._timeScaleInterpolant=null,this._mixer._takeBackControlInterpolant(e)),this},getMixer:function(){return this._mixer},getClip:function(){return this._clip},getRoot:function(){return this._localRoot||this._mixer._root},_update:function(e,t,r,n){if(this.enabled){var i=this._startTime;if(null!==i){var a=(e-i)*r;if(a<0||0===r)return;this._startTime=null,t=r*a}t*=this._updateTimeScale(e);var o=this._updateTime(t),s=this._updateWeight(e);if(s>0)for(var l=this._interpolants,c=this._propertyBindings,u=0,h=l.length;u!==h;++u)l[u].evaluate(o),c[u].accumulate(n,s)}else this._updateWeight(e)},_updateWeight:function(e){var t=0;if(this.enabled){t=this.weight;var r=this._weightInterpolant;if(null!==r){var n=r.evaluate(e)[0];t*=n,e>r.parameterPositions[1]&&(this.stopFading(),0===n&&(this.enabled=!1))}}return this._effectiveWeight=t,t},_updateTimeScale:function(e){var t=0;if(!this.paused){t=this.timeScale;var r=this._timeScaleInterpolant;if(null!==r)t*=r.evaluate(e)[0],e>r.parameterPositions[1]&&(this.stopWarping(),0===t?this.paused=!0:this.timeScale=t)}return this._effectiveTimeScale=t,t},_updateTime:function(e){var t=this.time+e,r=this._clip.duration,n=this.loop,i=this._loopCount,a=n===Tt;if(0===e)return-1===i?t:a&&1==(1&i)?r-t:t;if(n===St){-1===i&&(this._loopCount=0,this._setEndings(!0,!0,!1));e:{if(t>=r)t=r;else{if(!(t<0)){this.time=t;break e}t=0}this.clampWhenFinished?this.paused=!0:this.enabled=!1,this.time=t,this._mixer.dispatchEvent({type:"finished",action:this,direction:e<0?-1:1})}}else{if(-1===i&&(e>=0?(i=0,this._setEndings(!0,0===this.repetitions,a)):this._setEndings(0===this.repetitions,!0,a)),t>=r||t<0){var o=Math.floor(t/r);t-=r*o,i+=Math.abs(o);var s=this.repetitions-i;if(s<=0)this.clampWhenFinished?this.paused=!0:this.enabled=!1,t=e>0?r:0,this.time=t,this._mixer.dispatchEvent({type:"finished",action:this,direction:e>0?1:-1});else{if(1===s){var l=e<0;this._setEndings(l,!l,a)}else this._setEndings(!1,!1,a);this._loopCount=i,this.time=t,this._mixer.dispatchEvent({type:"loop",action:this,loopDelta:o})}}else this.time=t;if(a&&1==(1&i))return r-t}return t},_setEndings:function(e,t,r){var n=this._interpolantSettings;r?(n.endingStart=Dt,n.endingEnd=Dt):(n.endingStart=e?this.zeroSlopeAtStart?Dt:Pt:It,n.endingEnd=t?this.zeroSlopeAtEnd?Dt:Pt:It)},_scheduleFading:function(e,t,r){var n=this._mixer,i=n.time,a=this._weightInterpolant;null===a&&(a=n._lendControlInterpolant(),this._weightInterpolant=a);var o=a.parameterPositions,s=a.sampleValues;return o[0]=i,s[0]=t,o[1]=i+e,s[1]=r,this}}),td.prototype=Object.assign(Object.create(br.prototype),{constructor:td,_bindAction:function(e,t){var r=e._localRoot||this._root,n=e._clip.tracks,i=n.length,a=e._propertyBindings,o=e._interpolants,s=r.uuid,l=this._bindingsByRootAndName,c=l[s];void 0===c&&(c={},l[s]=c);for(var u=0;u!==i;++u){var h=n[u],d=h.name,p=c[d];if(void 0!==p)a[u]=p;else{if(void 0!==(p=a[u])){null===p._cacheIndex&&(++p.referenceCount,this._addInactiveBinding(p,s,d));continue}var f=t&&t._propertyBindings[u].binding.parsedPath;++(p=new Hh(Kh.create(r,d,f),h.ValueTypeName,h.getValueSize())).referenceCount,this._addInactiveBinding(p,s,d),a[u]=p}o[u].resultBuffer=p.buffer}},_activateAction:function(e){if(!this._isActiveAction(e)){if(null===e._cacheIndex){var t=(e._localRoot||this._root).uuid,r=e._clip.uuid,n=this._actionsByClip[r];this._bindAction(e,n&&n.knownActions[0]),this._addInactiveAction(e,r,t)}for(var i=e._propertyBindings,a=0,o=i.length;a!==o;++a){var s=i[a];0==s.useCount++&&(this._lendBinding(s),s.saveOriginalState())}this._lendAction(e)}},_deactivateAction:function(e){if(this._isActiveAction(e)){for(var t=e._propertyBindings,r=0,n=t.length;r!==n;++r){var i=t[r];0==--i.useCount&&(i.restoreOriginalState(),this._takeBackBinding(i))}this._takeBackAction(e)}},_initMemoryManager:function(){this._actions=[],this._nActiveActions=0,this._actionsByClip={},this._bindings=[],this._nActiveBindings=0,this._bindingsByRootAndName={},this._controlInterpolants=[],this._nActiveControlInterpolants=0;var e=this;this.stats={actions:{get total(){return e._actions.length},get inUse(){return e._nActiveActions}},bindings:{get total(){return e._bindings.length},get inUse(){return e._nActiveBindings}},controlInterpolants:{get total(){return e._controlInterpolants.length},get inUse(){return e._nActiveControlInterpolants}}}},_isActiveAction:function(e){var t=e._cacheIndex;return null!==t&&t<this._nActiveActions},_addInactiveAction:function(e,t,r){var n=this._actions,i=this._actionsByClip,a=i[t];if(void 0===a)a={knownActions:[e],actionByRoot:{}},e._byClipCacheIndex=0,i[t]=a;else{var o=a.knownActions;e._byClipCacheIndex=o.length,o.push(e)}e._cacheIndex=n.length,n.push(e),a.actionByRoot[r]=e},_removeInactiveAction:function(e){var t=this._actions,r=t[t.length-1],n=e._cacheIndex;r._cacheIndex=n,t[n]=r,t.pop(),e._cacheIndex=null;var i=e._clip.uuid,a=this._actionsByClip,o=a[i],s=o.knownActions,l=s[s.length-1],c=e._byClipCacheIndex;l._byClipCacheIndex=c,s[c]=l,s.pop(),e._byClipCacheIndex=null,delete o.actionByRoot[(e._localRoot||this._root).uuid],0===s.length&&delete a[i],this._removeInactiveBindingsForAction(e)},_removeInactiveBindingsForAction:function(e){for(var t=e._propertyBindings,r=0,n=t.length;r!==n;++r){var i=t[r];0==--i.referenceCount&&this._removeInactiveBinding(i)}},_lendAction:function(e){var t=this._actions,r=e._cacheIndex,n=this._nActiveActions++,i=t[n];e._cacheIndex=n,t[n]=e,i._cacheIndex=r,t[r]=i},_takeBackAction:function(e){var t=this._actions,r=e._cacheIndex,n=--this._nActiveActions,i=t[n];e._cacheIndex=n,t[n]=e,i._cacheIndex=r,t[r]=i},_addInactiveBinding:function(e,t,r){var n=this._bindingsByRootAndName,i=n[t],a=this._bindings;void 0===i&&(i={},n[t]=i),i[r]=e,e._cacheIndex=a.length,a.push(e)},_removeInactiveBinding:function(e){var t=this._bindings,r=e.binding,n=r.rootNode.uuid,i=r.path,a=this._bindingsByRootAndName,o=a[n],s=t[t.length-1],l=e._cacheIndex;s._cacheIndex=l,t[l]=s,t.pop(),delete o[i],0===Object.keys(o).length&&delete a[n]},_lendBinding:function(e){var t=this._bindings,r=e._cacheIndex,n=this._nActiveBindings++,i=t[n];e._cacheIndex=n,t[n]=e,i._cacheIndex=r,t[r]=i},_takeBackBinding:function(e){var t=this._bindings,r=e._cacheIndex,n=--this._nActiveBindings,i=t[n];e._cacheIndex=n,t[n]=e,i._cacheIndex=r,t[r]=i},_lendControlInterpolant:function(){var e=this._controlInterpolants,t=this._nActiveControlInterpolants++,r=e[t];return void 0===r&&((r=new $c(new Float32Array(2),new Float32Array(2),1,this._controlInterpolantsResultBuffer)).__cacheIndex=t,e[t]=r),r},_takeBackControlInterpolant:function(e){var t=this._controlInterpolants,r=e.__cacheIndex,n=--this._nActiveControlInterpolants,i=t[n];e.__cacheIndex=n,t[n]=e,i.__cacheIndex=r,t[r]=i},_controlInterpolantsResultBuffer:new Float32Array(1),clipAction:function(e,t){var r=t||this._root,n=r.uuid,i="string"==typeof e?cu.findByName(r,e):e,a=null!==i?i.uuid:e,o=this._actionsByClip[a],s=null;if(void 0!==o){var l=o.actionByRoot[n];if(void 0!==l)return l;s=o.knownActions[0],null===i&&(i=s._clip)}if(null===i)return null;var c=new ed(this,i,t);return this._bindAction(c,s),this._addInactiveAction(c,a,n),c},existingAction:function(e,t){var r=t||this._root,n=r.uuid,i="string"==typeof e?cu.findByName(r,e):e,a=i?i.uuid:e,o=this._actionsByClip[a];return void 0!==o&&o.actionByRoot[n]||null},stopAllAction:function(){var e=this._actions,t=this._nActiveActions,r=this._bindings,n=this._nActiveBindings;this._nActiveActions=0,this._nActiveBindings=0;for(var i=0;i!==t;++i)e[i].reset();for(i=0;i!==n;++i)r[i].useCount=0;return this},update:function(e){e*=this.timeScale;for(var t=this._actions,r=this._nActiveActions,n=this.time+=e,i=Math.sign(e),a=this._accuIndex^=1,o=0;o!==r;++o){t[o]._update(n,e,i,a)}var s=this._bindings,l=this._nActiveBindings;for(o=0;o!==l;++o)s[o].apply(a);return this},setTime:function(e){this.time=0;for(var t=0;t<this._actions.length;t++)this._actions[t].time=0;return this.update(e)},getRoot:function(){return this._root},uncacheClip:function(e){var t=this._actions,r=e.uuid,n=this._actionsByClip,i=n[r];if(void 0!==i){for(var a=i.knownActions,o=0,s=a.length;o!==s;++o){var l=a[o];this._deactivateAction(l);var c=l._cacheIndex,u=t[t.length-1];l._cacheIndex=null,l._byClipCacheIndex=null,u._cacheIndex=c,t[c]=u,t.pop(),this._removeInactiveBindingsForAction(l)}delete n[r]}},uncacheRoot:function(e){var t=e.uuid,r=this._actionsByClip;for(var n in r){var i=r[n].actionByRoot[t];void 0!==i&&(this._deactivateAction(i),this._removeInactiveAction(i))}var a=this._bindingsByRootAndName[t];if(void 0!==a)for(var o in a){var s=a[o];s.restoreOriginalState(),this._removeInactiveBinding(s)}},uncacheAction:function(e,t){var r=this.existingAction(e,t);null!==r&&(this._deactivateAction(r),this._removeInactiveAction(r))}}),rd.prototype.clone=function(){return new rd(void 0===this.value.clone?this.value:this.value.clone())},nd.prototype=Object.assign(Object.create(Es.prototype),{constructor:nd,isInstancedInterleavedBuffer:!0,copy:function(e){return Es.prototype.copy.call(this,e),this.meshPerAttribute=e.meshPerAttribute,this}}),Object.assign(id.prototype,{linePrecision:1,set:function(e,t){this.ray.set(e,t)},setFromCamera:function(e,t){t&&t.isPerspectiveCamera?(this.ray.origin.setFromMatrixPosition(t.matrixWorld),this.ray.direction.set(e.x,e.y,.5).unproject(t).sub(this.ray.origin).normalize(),this.camera=t):t&&t.isOrthographicCamera?(this.ray.origin.set(e.x,e.y,(t.near+t.far)/(t.near-t.far)).unproject(t),this.ray.direction.set(0,0,-1).transformDirection(t.matrixWorld),this.camera=t):console.error("THREE.Raycaster: Unsupported camera type.")},intersectObject:function(e,t,r){var n=r||[];return od(e,this,n,t),n.sort(ad),n},intersectObjects:function(e,t,r){var n=r||[];if(!1===Array.isArray(e))return console.warn("THREE.Raycaster.intersectObjects: objects is not an Array."),n;for(var i=0,a=e.length;i<a;i++)od(e[i],this,n,t);return n.sort(ad),n}}),Object.assign(sd.prototype,{set:function(e,t,r){return this.radius=e,this.phi=t,this.theta=r,this},clone:function(){return(new this.constructor).copy(this)},copy:function(e){return this.radius=e.radius,this.phi=e.phi,this.theta=e.theta,this},makeSafe:function(){return this.phi=Math.max(1e-6,Math.min(Math.PI-1e-6,this.phi)),this},setFromVector3:function(e){return this.setFromCartesianCoords(e.x,e.y,e.z)},setFromCartesianCoords:function(e,t,r){return this.radius=Math.sqrt(e*e+t*t+r*r),0===this.radius?(this.theta=0,this.phi=0):(this.theta=Math.atan2(e,r),this.phi=Math.acos(_r.clamp(t/this.radius,-1,1))),this}}),Object.assign(ld.prototype,{set:function(e,t,r){return this.radius=e,this.theta=t,this.y=r,this},clone:function(){return(new this.constructor).copy(this)},copy:function(e){return this.radius=e.radius,this.theta=e.theta,this.y=e.y,this},setFromVector3:function(e){return this.setFromCartesianCoords(e.x,e.y,e.z)},setFromCartesianCoords:function(e,t,r){return this.radius=Math.sqrt(e*e+r*r),this.theta=Math.atan2(e,r),this.y=t,this}});var cd=new Mr;function ud(e,t){this.min=void 0!==e?e:new Mr(1/0,1/0),this.max=void 0!==t?t:new Mr(-1/0,-1/0)}Object.assign(ud.prototype,{set:function(e,t){return this.min.copy(e),this.max.copy(t),this},setFromPoints:function(e){this.makeEmpty();for(var t=0,r=e.length;t<r;t++)this.expandByPoint(e[t]);return this},setFromCenterAndSize:function(e,t){var r=cd.copy(t).multiplyScalar(.5);return this.min.copy(e).sub(r),this.max.copy(e).add(r),this},clone:function(){return(new this.constructor).copy(this)},copy:function(e){return this.min.copy(e.min),this.max.copy(e.max),this},makeEmpty:function(){return this.min.x=this.min.y=1/0,this.max.x=this.max.y=-1/0,this},isEmpty:function(){return this.max.x<this.min.x||this.max.y<this.min.y},getCenter:function(e){return void 0===e&&(console.warn("THREE.Box2: .getCenter() target is now required"),e=new Mr),this.isEmpty()?e.set(0,0):e.addVectors(this.min,this.max).multiplyScalar(.5)},getSize:function(e){return void 0===e&&(console.warn("THREE.Box2: .getSize() target is now required"),e=new Mr),this.isEmpty()?e.set(0,0):e.subVectors(this.max,this.min)},expandByPoint:function(e){return this.min.min(e),this.max.max(e),this},expandByVector:function(e){return this.min.sub(e),this.max.add(e),this},expandByScalar:function(e){return this.min.addScalar(-e),this.max.addScalar(e),this},containsPoint:function(e){return!(e.x<this.min.x||e.x>this.max.x||e.y<this.min.y||e.y>this.max.y)},containsBox:function(e){return this.min.x<=e.min.x&&e.max.x<=this.max.x&&this.min.y<=e.min.y&&e.max.y<=this.max.y},getParameter:function(e,t){return void 0===t&&(console.warn("THREE.Box2: .getParameter() target is now required"),t=new Mr),t.set((e.x-this.min.x)/(this.max.x-this.min.x),(e.y-this.min.y)/(this.max.y-this.min.y))},intersectsBox:function(e){return!(e.max.x<this.min.x||e.min.x>this.max.x||e.max.y<this.min.y||e.min.y>this.max.y)},clampPoint:function(e,t){return void 0===t&&(console.warn("THREE.Box2: .clampPoint() target is now required"),t=new Mr),t.copy(e).clamp(this.min,this.max)},distanceToPoint:function(e){return cd.copy(e).clamp(this.min,this.max).sub(e).length()},intersect:function(e){return this.min.max(e.min),this.max.min(e.max),this},union:function(e){return this.min.min(e.min),this.max.max(e.max),this},translate:function(e){return this.min.add(e),this.max.add(e),this},equals:function(e){return e.min.equals(this.min)&&e.max.equals(this.max)}});var hd=new Rr,dd=new Rr;function pd(e,t){this.start=void 0!==e?e:new Rr,this.end=void 0!==t?t:new Rr}function fd(e){un.call(this),this.material=e,this.render=function(){}}Object.assign(pd.prototype,{set:function(e,t){return this.start.copy(e),this.end.copy(t),this},clone:function(){return(new this.constructor).copy(this)},copy:function(e){return this.start.copy(e.start),this.end.copy(e.end),this},getCenter:function(e){return void 0===e&&(console.warn("THREE.Line3: .getCenter() target is now required"),e=new Rr),e.addVectors(this.start,this.end).multiplyScalar(.5)},delta:function(e){return void 0===e&&(console.warn("THREE.Line3: .delta() target is now required"),e=new Rr),e.subVectors(this.end,this.start)},distanceSq:function(){return this.start.distanceToSquared(this.end)},distance:function(){return this.start.distanceTo(this.end)},at:function(e,t){return void 0===t&&(console.warn("THREE.Line3: .at() target is now required"),t=new Rr),this.delta(t).multiplyScalar(e).add(this.start)},closestPointToPointParameter:function(e,t){hd.subVectors(e,this.start),dd.subVectors(this.end,this.start);var r=dd.dot(dd),n=dd.dot(hd)/r;return t&&(n=_r.clamp(n,0,1)),n},closestPointToPoint:function(e,t,r){var n=this.closestPointToPointParameter(e,t);return void 0===r&&(console.warn("THREE.Line3: .closestPointToPoint() target is now required"),r=new Rr),this.delta(r).multiplyScalar(n).add(this.start)},applyMatrix4:function(e){return this.start.applyMatrix4(e),this.end.applyMatrix4(e),this},equals:function(e){return e.start.equals(this.start)&&e.end.equals(this.end)}}),fd.prototype=Object.create(un.prototype),fd.prototype.constructor=fd,fd.prototype.isImmediateRenderObject=!0;var md=new Rr;function vd(e,t){un.call(this),this.light=e,this.light.updateMatrixWorld(),this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1,this.color=t;for(var r=new Li,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],i=0,a=1;i<32;i++,a++){var o=i/32*Math.PI*2,s=a/32*Math.PI*2;n.push(Math.cos(o),Math.sin(o),1,Math.cos(s),Math.sin(s),1)}r.setAttribute("position",new yi(n,3));var l=new il({fog:!1});this.cone=new pl(r,l),this.add(this.cone),this.update()}vd.prototype=Object.create(un.prototype),vd.prototype.constructor=vd,vd.prototype.dispose=function(){this.cone.geometry.dispose(),this.cone.material.dispose()},vd.prototype.update=function(){this.light.updateMatrixWorld();var e=this.light.distance?this.light.distance:1e3,t=e*Math.tan(this.light.angle);this.cone.scale.set(t,t,e),md.setFromMatrixPosition(this.light.target.matrixWorld),this.cone.lookAt(md),void 0!==this.color?this.cone.material.color.set(this.color):this.cone.material.color.copy(this.light.color)};var gd=new Rr,yd=new Wr,xd=new Wr;function bd(e){for(var t=function e(t){var r=[];t&&t.isBone&&r.push(t);for(var n=0;n<t.children.length;n++)r.push.apply(r,e(t.children[n]));return r}(e),r=new Li,n=[],i=[],a=new ti(0,0,1),o=new ti(0,1,0),s=0;s<t.length;s++){var l=t[s];l.parent&&l.parent.isBone&&(n.push(0,0,0),n.push(0,0,0),i.push(a.r,a.g,a.b),i.push(o.r,o.g,o.b))}r.setAttribute("position",new yi(n,3)),r.setAttribute("color",new yi(i,3));var c=new il({vertexColors:_,depthTest:!1,depthWrite:!1,transparent:!0});pl.call(this,r,c),this.root=e,this.bones=t,this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1}function Ad(e,t,r){this.light=e,this.light.updateMatrixWorld(),this.color=r;var n=new _c(t,4,2),i=new li({wireframe:!0,fog:!1});Xi.call(this,n,i),this.matrix=this.light.matrixWorld,this.matrixAutoUpdate=!1,this.update()}bd.prototype=Object.create(pl.prototype),bd.prototype.constructor=bd,bd.prototype.updateMatrixWorld=function(e){var t=this.bones,r=this.geometry,n=r.getAttribute("position");xd.getInverse(this.root.matrixWorld);for(var i=0,a=0;i<t.length;i++){var o=t[i];o.parent&&o.parent.isBone&&(yd.multiplyMatrices(xd,o.matrixWorld),gd.setFromMatrixPosition(yd),n.setXYZ(a,gd.x,gd.y,gd.z),yd.multiplyMatrices(xd,o.parent.matrixWorld),gd.setFromMatrixPosition(yd),n.setXYZ(a+1,gd.x,gd.y,gd.z),a+=2)}r.getAttribute("position").needsUpdate=!0,un.prototype.updateMatrixWorld.call(this,e)},Ad.prototype=Object.create(Xi.prototype),Ad.prototype.constructor=Ad,Ad.prototype.dispose=function(){this.geometry.dispose(),this.material.dispose()},Ad.prototype.update=function(){void 0!==this.color?this.material.color.set(this.color):this.material.color.copy(this.light.color)};var wd=new Rr,_d=new ti,Md=new ti;function Sd(e,t,r){un.call(this),this.light=e,this.light.updateMatrixWorld(),this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1,this.color=r;var n=new Ol(t);n.rotateY(.5*Math.PI),this.material=new li({wireframe:!0,fog:!1}),void 0===this.color&&(this.material.vertexColors=_);var i=n.getAttribute("position"),a=new Float32Array(3*i.count);n.setAttribute("color",new ui(a,3)),this.add(new Xi(n,this.material)),this.update()}function Ed(e,t,r,n){e=e||10,t=t||10,r=new ti(void 0!==r?r:4473924),n=new ti(void 0!==n?n:8947848);for(var i=t/2,a=e/t,o=e/2,s=[],l=[],c=0,u=0,h=-o;c<=t;c++,h+=a){s.push(-o,0,h,o,0,h),s.push(h,0,-o,h,0,o);var d=c===i?r:n;d.toArray(l,u),u+=3,d.toArray(l,u),u+=3,d.toArray(l,u),u+=3,d.toArray(l,u),u+=3}var p=new Li;p.setAttribute("position",new yi(s,3)),p.setAttribute("color",new yi(l,3));var f=new il({vertexColors:_});pl.call(this,p,f)}function Td(e,t,r,n,i,a){e=e||10,t=t||16,r=r||8,n=n||64,i=new ti(void 0!==i?i:4473924),a=new ti(void 0!==a?a:8947848);var o,s,l,c,u,h,d,p=[],f=[];for(c=0;c<=t;c++)l=c/t*(2*Math.PI),o=Math.sin(l)*e,s=Math.cos(l)*e,p.push(0,0,0),p.push(o,0,s),d=1&c?i:a,f.push(d.r,d.g,d.b),f.push(d.r,d.g,d.b);for(c=0;c<=r;c++)for(d=1&c?i:a,h=e-e/r*c,u=0;u<n;u++)l=u/n*(2*Math.PI),o=Math.sin(l)*h,s=Math.cos(l)*h,p.push(o,0,s),f.push(d.r,d.g,d.b),l=(u+1)/n*(2*Math.PI),o=Math.sin(l)*h,s=Math.cos(l)*h,p.push(o,0,s),f.push(d.r,d.g,d.b);var m=new Li;m.setAttribute("position",new yi(p,3)),m.setAttribute("color",new yi(f,3));var v=new il({vertexColors:_});pl.call(this,m,v)}Sd.prototype=Object.create(un.prototype),Sd.prototype.constructor=Sd,Sd.prototype.dispose=function(){this.children[0].geometry.dispose(),this.children[0].material.dispose()},Sd.prototype.update=function(){var e=this.children[0];if(void 0!==this.color)this.material.color.set(this.color);else{var t=e.geometry.getAttribute("color");_d.copy(this.light.color),Md.copy(this.light.groundColor);for(var r=0,n=t.count;r<n;r++){var i=r<n/2?_d:Md;t.setXYZ(r,i.r,i.g,i.b)}t.needsUpdate=!0}e.lookAt(wd.setFromMatrixPosition(this.light.matrixWorld).negate())},Ed.prototype=Object.assign(Object.create(pl.prototype),{constructor:Ed,copy:function(e){return pl.prototype.copy.call(this,e),this.geometry.copy(e.geometry),this.material.copy(e.material),this},clone:function(){return(new this.constructor).copy(this)}}),Td.prototype=Object.create(pl.prototype),Td.prototype.constructor=Td;var Rd=new Rr,Ld=new Rr,Cd=new Rr;function Pd(e,t,r){un.call(this),this.light=e,this.light.updateMatrixWorld(),this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1,this.color=r,void 0===t&&(t=1);var n=new Li;n.setAttribute("position",new yi([-t,t,0,t,t,0,t,-t,0,-t,-t,0,-t,t,0],3));var i=new il({fog:!1});this.lightPlane=new ul(n,i),this.add(this.lightPlane),(n=new Li).setAttribute("position",new yi([0,0,0,0,0,1],3)),this.targetLine=new ul(n,i),this.add(this.targetLine),this.update()}Pd.prototype=Object.create(un.prototype),Pd.prototype.constructor=Pd,Pd.prototype.dispose=function(){this.lightPlane.geometry.dispose(),this.lightPlane.material.dispose(),this.targetLine.geometry.dispose(),this.targetLine.material.dispose()},Pd.prototype.update=function(){Rd.setFromMatrixPosition(this.light.matrixWorld),Ld.setFromMatrixPosition(this.light.target.matrixWorld),Cd.subVectors(Ld,Rd),this.lightPlane.lookAt(Ld),void 0!==this.color?(this.lightPlane.material.color.set(this.color),this.targetLine.material.color.set(this.color)):(this.lightPlane.material.color.copy(this.light.color),this.targetLine.material.color.copy(this.light.color)),this.targetLine.lookAt(Ld),this.targetLine.scale.z=Cd.length()};var Dd=new Rr,Id=new ca;function Od(e){var t=new Li,r=new il({color:16777215,vertexColors:w}),n=[],i=[],a={},o=new ti(16755200),s=new ti(16711680),l=new ti(43775),c=new ti(16777215),u=new ti(3355443);function h(e,t,r){d(e,r),d(t,r)}function d(e,t){n.push(0,0,0),i.push(t.r,t.g,t.b),void 0===a[e]&&(a[e]=[]),a[e].push(n.length/3-1)}h("n1","n2",o),h("n2","n4",o),h("n4","n3",o),h("n3","n1",o),h("f1","f2",o),h("f2","f4",o),h("f4","f3",o),h("f3","f1",o),h("n1","f1",o),h("n2","f2",o),h("n3","f3",o),h("n4","f4",o),h("p","n1",s),h("p","n2",s),h("p","n3",s),h("p","n4",s),h("u1","u2",l),h("u2","u3",l),h("u3","u1",l),h("c","t",c),h("p","c",u),h("cn1","cn2",u),h("cn3","cn4",u),h("cf1","cf2",u),h("cf3","cf4",u),t.setAttribute("position",new yi(n,3)),t.setAttribute("color",new yi(i,3)),pl.call(this,t,r),this.camera=e,this.camera.updateProjectionMatrix&&this.camera.updateProjectionMatrix(),this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1,this.pointMap=a,this.update()}function Bd(e,t,r,n,i,a,o){Dd.set(i,a,o).unproject(n);var s=t[e];if(void 0!==s)for(var l=r.getAttribute("position"),c=0,u=s.length;c<u;c++)l.setXYZ(s[c],Dd.x,Dd.y,Dd.z)}Od.prototype=Object.create(pl.prototype),Od.prototype.constructor=Od,Od.prototype.update=function(){var e=this.geometry,t=this.pointMap;Id.projectionMatrixInverse.copy(this.camera.projectionMatrixInverse),Bd("c",t,e,Id,0,0,-1),Bd("t",t,e,Id,0,0,1),Bd("n1",t,e,Id,-1,-1,-1),Bd("n2",t,e,Id,1,-1,-1),Bd("n3",t,e,Id,-1,1,-1),Bd("n4",t,e,Id,1,1,-1),Bd("f1",t,e,Id,-1,-1,1),Bd("f2",t,e,Id,1,-1,1),Bd("f3",t,e,Id,-1,1,1),Bd("f4",t,e,Id,1,1,1),Bd("u1",t,e,Id,.7,1.1,-1),Bd("u2",t,e,Id,-.7,1.1,-1),Bd("u3",t,e,Id,0,2,-1),Bd("cf1",t,e,Id,-1,0,1),Bd("cf2",t,e,Id,1,0,1),Bd("cf3",t,e,Id,0,-1,1),Bd("cf4",t,e,Id,0,1,1),Bd("cn1",t,e,Id,-1,0,-1),Bd("cn2",t,e,Id,1,0,-1),Bd("cn3",t,e,Id,0,-1,-1),Bd("cn4",t,e,Id,0,1,-1),e.getAttribute("position").needsUpdate=!0};var Fd=new Sn;function Ud(e,t){this.object=e,void 0===t&&(t=16776960);var r=new Uint16Array([0,1,1,2,2,3,3,0,4,5,5,6,6,7,7,4,0,4,1,5,2,6,3,7]),n=new Float32Array(24),i=new Li;i.setIndex(new ui(r,1)),i.setAttribute("position",new ui(n,3)),pl.call(this,i,new il({color:t})),this.matrixAutoUpdate=!1,this.update()}function Nd(e,t){this.type="Box3Helper",this.box=e,t=t||16776960;var r=new Uint16Array([0,1,1,2,2,3,3,0,4,5,5,6,6,7,7,4,0,4,1,5,2,6,3,7]),n=new Li;n.setIndex(new ui(r,1)),n.setAttribute("position",new yi([1,1,1,-1,1,1,-1,-1,1,1,-1,1,1,1,-1,-1,1,-1,-1,-1,-1,1,-1,-1],3)),pl.call(this,n,new il({color:t})),this.geometry.computeBoundingSphere()}function Gd(e,t,r){this.type="PlaneHelper",this.plane=e,this.size=void 0===t?1:t;var n=void 0!==r?r:16776960,i=new Li;i.setAttribute("position",new yi([1,-1,1,-1,1,1,-1,-1,1,1,1,1,-1,1,1,-1,-1,1,1,-1,1,1,1,1,0,0,1,0,0,0],3)),i.computeBoundingSphere(),ul.call(this,i,new il({color:n}));var a=new Li;a.setAttribute("position",new yi([1,1,1,-1,1,1,-1,-1,1,1,1,1,-1,-1,1,1,-1,1],3)),a.computeBoundingSphere(),this.add(new Xi(a,new li({color:n,opacity:.2,transparent:!0,depthWrite:!1})))}Ud.prototype=Object.create(pl.prototype),Ud.prototype.constructor=Ud,Ud.prototype.update=function(e){if(void 0!==e&&console.warn("THREE.BoxHelper: .update() has no longer arguments."),void 0!==this.object&&Fd.setFromObject(this.object),!Fd.isEmpty()){var t=Fd.min,r=Fd.max,n=this.geometry.attributes.position,i=n.array;i[0]=r.x,i[1]=r.y,i[2]=r.z,i[3]=t.x,i[4]=r.y,i[5]=r.z,i[6]=t.x,i[7]=t.y,i[8]=r.z,i[9]=r.x,i[10]=t.y,i[11]=r.z,i[12]=r.x,i[13]=r.y,i[14]=t.z,i[15]=t.x,i[16]=r.y,i[17]=t.z,i[18]=t.x,i[19]=t.y,i[20]=t.z,i[21]=r.x,i[22]=t.y,i[23]=t.z,n.needsUpdate=!0,this.geometry.computeBoundingSphere()}},Ud.prototype.setFromObject=function(e){return this.object=e,this.update(),this},Ud.prototype.copy=function(e){return pl.prototype.copy.call(this,e),this.object=e.object,this},Ud.prototype.clone=function(){return(new this.constructor).copy(this)},Nd.prototype=Object.create(pl.prototype),Nd.prototype.constructor=Nd,Nd.prototype.updateMatrixWorld=function(e){var t=this.box;t.isEmpty()||(t.getCenter(this.position),t.getSize(this.scale),this.scale.multiplyScalar(.5),un.prototype.updateMatrixWorld.call(this,e))},Gd.prototype=Object.create(ul.prototype),Gd.prototype.constructor=Gd,Gd.prototype.updateMatrixWorld=function(e){var t=-this.plane.constant;Math.abs(t)<1e-8&&(t=1e-8),this.scale.set(.5*this.size,.5*this.size,t),this.children[0].material.side=t<0?g:v,this.lookAt(this.plane.normal),un.prototype.updateMatrixWorld.call(this,e)};var zd,kd,Hd=new Rr;function Vd(e,t,r,n,i,a){un.call(this),void 0===e&&(e=new Rr(0,0,1)),void 0===t&&(t=new Rr(0,0,0)),void 0===r&&(r=1),void 0===n&&(n=16776960),void 0===i&&(i=.2*r),void 0===a&&(a=.2*i),void 0===zd&&((zd=new Li).setAttribute("position",new yi([0,0,0,0,1,0],3)),(kd=new Ic(0,.5,1,5,1)).translate(0,-.5,0)),this.position.copy(t),this.line=new ul(zd,new il({color:n})),this.line.matrixAutoUpdate=!1,this.add(this.line),this.cone=new Xi(kd,new li({color:n})),this.cone.matrixAutoUpdate=!1,this.add(this.cone),this.setDirection(e),this.setLength(r,i,a)}function jd(e){var t=[0,0,0,e=e||1,0,0,0,0,0,0,e,0,0,0,0,0,0,e],r=new Li;r.setAttribute("position",new yi(t,3)),r.setAttribute("color",new yi([1,0,0,1,.6,0,0,1,0,.6,1,0,0,0,1,0,.6,1],3));var n=new il({vertexColors:_});pl.call(this,r,n)}Vd.prototype=Object.create(un.prototype),Vd.prototype.constructor=Vd,Vd.prototype.setDirection=function(e){if(e.y>.99999)this.quaternion.set(0,0,0,1);else if(e.y<-.99999)this.quaternion.set(1,0,0,0);else{Hd.set(e.z,0,-e.x).normalize();var t=Math.acos(e.y);this.quaternion.setFromAxisAngle(Hd,t)}},Vd.prototype.setLength=function(e,t,r){void 0===t&&(t=.2*e),void 0===r&&(r=.2*t),this.line.scale.set(1,Math.max(1e-4,e-t),1),this.line.updateMatrix(),this.cone.scale.set(r,t,r),this.cone.position.y=e,this.cone.updateMatrix()},Vd.prototype.setColor=function(e){this.line.material.color.set(e),this.cone.material.color.set(e)},Vd.prototype.copy=function(e){return un.prototype.copy.call(this,e,!1),this.line.copy(e.line),this.cone.copy(e.cone),this},Vd.prototype.clone=function(){return(new this.constructor).copy(this)},jd.prototype=Object.create(pl.prototype),jd.prototype.constructor=jd;var Wd,qd,Xd,Yd,Qd=4,Zd=8,Jd=Math.pow(2,Zd),Kd=[.125,.215,.35,.446,.526,.582],$d=Zd-Qd+1+Kd.length,ep=20,tp={[Ut]:0,[Nt]:1,[zt]:2,[Ht]:3,[Vt]:4,[jt]:5,[Gt]:6},rp=new $u,np=(Wd=ep,qd=new Float32Array(Wd),Xd=new Rr(0,1,0),(Yd=new zc({defines:{n:Wd},uniforms:{envMap:{value:null},samples:{value:1},weights:{value:qd},latitudinal:{value:!1},dTheta:{value:0},mipInt:{value:0},poleAxis:{value:Xd},inputEncoding:{value:tp[Ut]},outputEncoding:{value:tp[Ut]}},vertexShader:Sp(),fragmentShader:`\nprecision mediump float;\nprecision mediump int;\nvarying vec3 vOutputDirection;\nuniform sampler2D envMap;\nuniform int samples;\nuniform float weights[n];\nuniform bool latitudinal;\nuniform float dTheta;\nuniform float mipInt;\nuniform vec3 poleAxis;\n\n${Ep()}\n\n#define ENVMAP_TYPE_CUBE_UV\n#include <cube_uv_reflection_fragment>\n\nvoid main() {\n\tgl_FragColor = vec4(0.0);\n\tfor (int i = 0; i < n; i++) {\n\t\tif (i >= samples)\n\t\t\tbreak;\n\t\tfor (int dir = -1; dir < 2; dir += 2) {\n\t\t\tif (i == 0 && dir == 1)\n\t\t\t\tcontinue;\n\t\t\tvec3 axis = latitudinal ? poleAxis : cross(poleAxis, vOutputDirection);\n\t\t\tif (all(equal(axis, vec3(0.0))))\n\t\t\t\taxis = cross(vec3(0.0, 1.0, 0.0), vOutputDirection);\n\t\t\taxis = normalize(axis);\n\t\t\tfloat theta = dTheta * float(dir * i);\n\t\t\tfloat cosTheta = cos(theta);\n\t\t\t// Rodrigues' axis-angle rotation\n\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\t\t\tgl_FragColor.rgb +=\n\t\t\t\t\tweights[i] * bilinearCubeUV(envMap, sampleDirection, mipInt);\n\t\t}\n\t}\n\tgl_FragColor = linearToOutputTexel(gl_FragColor);\n}\n\t\t`,blending:M,depthTest:!1,depthWrite:!1})).type="SphericalGaussianBlur",Yd),ip=null,ap=null,{_lodPlanes:op,_sizeLods:sp,_sigmas:lp}=function(){for(var e=[],t=[],r=[],n=Zd,i=0;i<$d;i++){var a=Math.pow(2,n);t.push(a);var o=1/a;i>Zd-Qd?o=Kd[i-Zd+Qd-1]:0==i&&(o=0),r.push(o);for(var s=1/(a-1),l=-s/2,c=1+s/2,u=[l,l,c,l,c,c,l,l,c,c,l,c],h=new Float32Array(108),d=new Float32Array(72),p=new Float32Array(36),f=0;f<6;f++){var m=f%3*2/3-1,v=f>2?0:-1,g=[m,v,0,m+2/3,v,0,m+2/3,v+1,0,m,v,0,m+2/3,v+1,0,m,v+1,0];h.set(g,18*f),d.set(u,12*f);var y=[f,f,f,f,f,f];p.set(y,6*f)}var x=new Li;x.setAttribute("position",new ui(h,3)),x.setAttribute("uv",new ui(d,2)),x.setAttribute("faceIndex",new ui(p,1)),e.push(x),n>Qd&&n--}return{_lodPlanes:e,_sizeLods:t,_sigmas:r}}(),cp=null,up=null,hp=(1+Math.sqrt(5))/2,dp=1/hp,pp=[new Rr(1,1,1),new Rr(-1,1,1),new Rr(1,1,-1),new Rr(-1,1,-1),new Rr(0,hp,dp),new Rr(0,hp,-dp),new Rr(dp,0,hp),new Rr(-dp,0,hp),new Rr(hp,dp,0),new Rr(-hp,dp,0)];function fp(e){up=e,gp(np)}function mp(e){var t={magFilter:be,minFilter:be,generateMipmaps:!1,type:e?e.type:Ce,format:e?e.format:Xe,encoding:e?e.encoding:zt,depthBuffer:!1,stencilBuffer:!1},r=yp(t);return r.depthBuffer=!e,cp=yp(t),r}function vp(){cp.dispose(),up.setRenderTarget(null);var e=up.getSize(new Mr);up.setViewport(0,0,e.x,e.y)}function gp(e){var t=new hn;t.add(new Xi(op[0],e)),up.compile(t,rp)}function yp(e){var t=new Fr(3*Jd,3*Jd,e);return t.texture.mapping=me,t.texture.name="PMREM.cubeUv",t.scissorTest=!0,t}function xp(e,t,r,n){var i=1/up.getPixelRatio();e*=i,t*=i,r*=i,n*=i,up.setViewport(e,t,r,n),up.setScissor(e,t,r,n)}function bp(e){var t=up.autoClear;up.autoClear=!1;for(var r=1;r<$d;r++){Ap(e,r-1,r,Math.sqrt(lp[r]*lp[r]-lp[r-1]*lp[r-1]),pp[(r-1)%pp.length])}up.autoClear=t}function Ap(e,t,r,n,i){wp(e,cp,t,r,n,"latitudinal",i),wp(cp,e,r,r,n,"longitudinal",i)}function wp(e,t,r,n,i,a,o){"latitudinal"!==a&&"longitudinal"!==a&&console.error("blur direction must be either latitudinal or longitudinal!");var s=new hn;s.add(new Xi(op[n],np));var l=np.uniforms,c=sp[r]-1,u=isFinite(i)?Math.PI/(2*c):2*Math.PI/(2*ep-1),h=i/u,d=isFinite(i)?1+Math.floor(3*h):ep;d>ep&&console.warn(`sigmaRadians, ${i}, is too large and will clip, as it requested ${d} samples when the maximum is set to ${ep}`);for(var p=[],f=0,m=0;m<ep;++m){var v=m/h,g=Math.exp(-v*v/2);p.push(g),0==m?f+=g:m<d&&(f+=2*g)}for(m=0;m<p.length;m++)p[m]=p[m]/f;l.envMap.value=e.texture,l.samples.value=d,l.weights.value=p,l.latitudinal.value="latitudinal"===a,o&&(l.poleAxis.value=o),l.dTheta.value=u,l.mipInt.value=Zd-r,l.inputEncoding.value=tp[e.texture.encoding],l.outputEncoding.value=tp[e.texture.encoding];var y=sp[n],x=(v=3*Math.max(0,Jd-2*y),(0===n?0:2*Jd)+2*y*(n>Zd-Qd?n-Zd+Qd:0));up.setRenderTarget(t),xp(v,x,3*y,2*y),up.render(s,rp)}function _p(){var e=new zc({uniforms:{envMap:{value:null},texelSize:{value:new Mr(1,1)},inputEncoding:{value:tp[Ut]},outputEncoding:{value:tp[Ut]}},vertexShader:Sp(),fragmentShader:`\nprecision mediump float;\nprecision mediump int;\nvarying vec3 vOutputDirection;\nuniform sampler2D envMap;\nuniform vec2 texelSize;\n\n${Ep()}\n\n#define RECIPROCAL_PI 0.31830988618\n#define RECIPROCAL_PI2 0.15915494\n\nvoid main() {\n\tgl_FragColor = vec4(0.0);\n\tvec3 outputDirection = normalize(vOutputDirection);\n\tvec2 uv;\n\tuv.y = asin(clamp(outputDirection.y, -1.0, 1.0)) * RECIPROCAL_PI + 0.5;\n\tuv.x = atan(outputDirection.z, outputDirection.x) * RECIPROCAL_PI2 + 0.5;\n\tvec2 f = fract(uv / texelSize - 0.5);\n\tuv -= f * texelSize;\n\tvec3 tl = envMapTexelToLinear(texture2D(envMap, uv)).rgb;\n\tuv.x += texelSize.x;\n\tvec3 tr = envMapTexelToLinear(texture2D(envMap, uv)).rgb;\n\tuv.y += texelSize.y;\n\tvec3 br = envMapTexelToLinear(texture2D(envMap, uv)).rgb;\n\tuv.x -= texelSize.x;\n\tvec3 bl = envMapTexelToLinear(texture2D(envMap, uv)).rgb;\n\tvec3 tm = mix(tl, tr, f.x);\n\tvec3 bm = mix(bl, br, f.x);\n\tgl_FragColor.rgb = mix(tm, bm, f.y);\n\tgl_FragColor = linearToOutputTexel(gl_FragColor);\n}\n\t\t`,blending:M,depthTest:!1,depthWrite:!1});return e.type="EquirectangularToCubeUV",e}function Mp(){var e=new zc({uniforms:{envMap:{value:null},inputEncoding:{value:tp[Ut]},outputEncoding:{value:tp[Ut]}},vertexShader:Sp(),fragmentShader:`\nprecision mediump float;\nprecision mediump int;\nvarying vec3 vOutputDirection;\nuniform samplerCube envMap;\n\n${Ep()}\n\nvoid main() {\n\tgl_FragColor = vec4(0.0);\n\tgl_FragColor.rgb = envMapTexelToLinear(textureCube(envMap, vec3( - vOutputDirection.x, vOutputDirection.yz ))).rgb;\n\tgl_FragColor = linearToOutputTexel(gl_FragColor);\n}\n\t\t`,blending:M,depthTest:!1,depthWrite:!1});return e.type="CubemapToCubeUV",e}function Sp(){return"\nprecision mediump float;\nprecision mediump int;\nattribute vec3 position;\nattribute vec2 uv;\nattribute float faceIndex;\nvarying vec3 vOutputDirection;\nvec3 getDirection(vec2 uv, float face) {\n\tuv = 2.0 * uv - 1.0;\n\tvec3 direction = vec3(uv, 1.0);\n\tif (face == 0.0) {\n\t\tdirection = direction.zyx;\n\t\tdirection.z *= -1.0;\n\t} else if (face == 1.0) {\n\t\tdirection = direction.xzy;\n\t\tdirection.z *= -1.0;\n\t} else if (face == 3.0) {\n\t\tdirection = direction.zyx;\n\t\tdirection.x *= -1.0;\n\t} else if (face == 4.0) {\n\t\tdirection = direction.xzy;\n\t\tdirection.y *= -1.0;\n\t} else if (face == 5.0) {\n\t\tdirection.xz *= -1.0;\n\t}\n\treturn direction;\n}\nvoid main() {\n\tvOutputDirection = getDirection(uv, faceIndex);\n\tgl_Position = vec4( position, 1.0 );\n}\n\t"}function Ep(){return"\nuniform int inputEncoding;\nuniform int outputEncoding;\n\n#include <encodings_pars_fragment>\n\nvec4 inputTexelToLinear(vec4 value){\n\tif(inputEncoding == 0){\n\t\treturn value;\n\t}else if(inputEncoding == 1){\n\t\treturn sRGBToLinear(value);\n\t}else if(inputEncoding == 2){\n\t\treturn RGBEToLinear(value);\n\t}else if(inputEncoding == 3){\n\t\treturn RGBMToLinear(value, 7.0);\n\t}else if(inputEncoding == 4){\n\t\treturn RGBMToLinear(value, 16.0);\n\t}else if(inputEncoding == 5){\n\t\treturn RGBDToLinear(value, 256.0);\n\t}else{\n\t\treturn GammaToLinear(value, 2.2);\n\t}\n}\n\nvec4 linearToOutputTexel(vec4 value){\n\tif(outputEncoding == 0){\n\t\treturn value;\n\t}else if(outputEncoding == 1){\n\t\treturn LinearTosRGB(value);\n\t}else if(outputEncoding == 2){\n\t\treturn LinearToRGBE(value);\n\t}else if(outputEncoding == 3){\n\t\treturn LinearToRGBM(value, 7.0);\n\t}else if(outputEncoding == 4){\n\t\treturn LinearToRGBM(value, 16.0);\n\t}else if(outputEncoding == 5){\n\t\treturn LinearToRGBD(value, 256.0);\n\t}else{\n\t\treturn LinearToGamma(value, 2.2);\n\t}\n}\n\nvec4 envMapTexelToLinear(vec4 color) {\n\treturn inputTexelToLinear(color);\n}\n\t"}function Tp(e,t,r,n,i,a,o){return console.warn("THREE.Face4 has been removed. A THREE.Face3 will be created instead."),new ai(e,t,r,i,a,o)}fp.prototype={constructor:fp,fromScene:function(e,t=0,r=.1,n=100){var i=mp();return function(e,t,r,n){var i=new ua(90,1,t,r),a=[1,1,1,1,-1,1],o=[1,1,-1,-1,-1,1],s=up.outputEncoding,l=up.toneMapping,c=up.toneMappingExposure,u=up.getClearColor(),h=up.getClearAlpha();up.toneMapping=ie,up.toneMappingExposure=1,up.outputEncoding=Ut,e.scale.z*=-1;var d=e.background;if(d&&d.isColor){d.convertSRGBToLinear();var p=Math.max(d.r,d.g,d.b),f=Math.min(Math.max(Math.ceil(Math.log2(p)),-128),127);d=d.multiplyScalar(Math.pow(2,-f));var m=(f+128)/255;up.setClearColor(d,m),e.background=null}up.setRenderTarget(n);for(var v=0;v<6;v++){var g=v%3;0==g?(i.up.set(0,a[v],0),i.lookAt(o[v],0,0)):1==g?(i.up.set(0,0,a[v]),i.lookAt(0,o[v],0)):(i.up.set(0,a[v],0),i.lookAt(0,0,o[v])),xp(g*Jd,v>2?Jd:0,Jd,Jd),up.render(e,i)}up.toneMapping=l,up.toneMappingExposure=c,up.outputEncoding=s,up.setClearColor(u,h),e.scale.z*=-1}(e,r,n,i),t>0&&Ap(i,0,0,t),bp(i),vp(),i.scissorTest=!1,i},fromEquirectangular:function(e){return e.magFilter=be,e.minFilter=be,e.generateMipmaps=!1,this.fromCubemap(e)},fromCubemap:function(e){var t=mp(e);return function(e,t){var r=new hn;e.isCubeTexture?null==ap&&(ap=Mp()):null==ip&&(ip=_p());var n=e.isCubeTexture?ap:ip;r.add(new Xi(op[0],n));var i=n.uniforms;i.envMap.value=e,e.isCubeTexture||i.texelSize.value.set(1/e.image.width,1/e.image.height);i.inputEncoding.value=tp[e.encoding],i.outputEncoding.value=tp[e.encoding],up.setRenderTarget(t),xp(0,0,3*Jd,2*Jd),up.render(r,rp)}(e,t),bp(t),vp(),t.scissorTest=!1,t},compileCubemapShader:function(){null==ap&&gp(ap=Mp())},compileEquirectangularShader:function(){null==ip&&gp(ip=_p())},dispose:function(){np.dispose(),null!=ap&&ap.dispose(),null!=ip&&ip.dispose();for(var e=0;e<op.length;e++)op[e].dispose()}};var Rp=0,Lp=1;function Cp(e){return console.warn("THREE.MeshFaceMaterial has been removed. Use an Array instead."),e}function Pp(e){return void 0===e&&(e=[]),console.warn("THREE.MultiMaterial has been removed. Use an Array instead."),e.isMultiMaterial=!0,e.materials=e,e.clone=function(){return e.slice()},e}function Dp(e,t){return console.warn("THREE.PointCloud has been renamed to THREE.Points."),new bl(e,t)}function Ip(e){return console.warn("THREE.Particle has been renamed to THREE.Sprite."),new Vs(e)}function Op(e,t){return console.warn("THREE.ParticleSystem has been renamed to THREE.Points."),new bl(e,t)}function Bp(e){return console.warn("THREE.PointCloudMaterial has been renamed to THREE.PointsMaterial."),new ml(e)}function Fp(e){return console.warn("THREE.ParticleBasicMaterial has been renamed to THREE.PointsMaterial."),new ml(e)}function Up(e){return console.warn("THREE.ParticleSystemMaterial has been renamed to THREE.PointsMaterial."),new ml(e)}function Np(e,t,r){return console.warn("THREE.Vertex has been removed. Use THREE.Vector3 instead."),new Rr(e,t,r)}function Gp(e,t){return console.warn("THREE.DynamicBufferAttribute has been removed. Use new THREE.BufferAttribute().setDynamic( true ) instead."),new ui(e,t).setDynamic(!0)}function zp(e,t){return console.warn("THREE.Int8Attribute has been removed. Use new THREE.Int8BufferAttribute() instead."),new hi(e,t)}function kp(e,t){return console.warn("THREE.Uint8Attribute has been removed. Use new THREE.Uint8BufferAttribute() instead."),new di(e,t)}function Hp(e,t){return console.warn("THREE.Uint8ClampedAttribute has been removed. Use new THREE.Uint8ClampedBufferAttribute() instead."),new pi(e,t)}function Vp(e,t){return console.warn("THREE.Int16Attribute has been removed. Use new THREE.Int16BufferAttribute() instead."),new fi(e,t)}function jp(e,t){return console.warn("THREE.Uint16Attribute has been removed. Use new THREE.Uint16BufferAttribute() instead."),new mi(e,t)}function Wp(e,t){return console.warn("THREE.Int32Attribute has been removed. Use new THREE.Int32BufferAttribute() instead."),new vi(e,t)}function qp(e,t){return console.warn("THREE.Uint32Attribute has been removed. Use new THREE.Uint32BufferAttribute() instead."),new gi(e,t)}function Xp(e,t){return console.warn("THREE.Float32Attribute has been removed. Use new THREE.Float32BufferAttribute() instead."),new yi(e,t)}function Yp(e,t){return console.warn("THREE.Float64Attribute has been removed. Use new THREE.Float64BufferAttribute() instead."),new xi(e,t)}function Qp(e){console.warn("THREE.ClosedSplineCurve3 has been deprecated. Use THREE.CatmullRomCurve3 instead."),Pu.call(this,e),this.type="catmullrom",this.closed=!0}function Zp(e){console.warn("THREE.SplineCurve3 has been deprecated. Use THREE.CatmullRomCurve3 instead."),Pu.call(this,e),this.type="catmullrom"}function Jp(e){console.warn("THREE.Spline has been removed. Use THREE.CatmullRomCurve3 instead."),Pu.call(this,e),this.type="catmullrom"}function Kp(e){return console.warn("THREE.AxisHelper has been renamed to THREE.AxesHelper."),new jd(e)}function $p(e,t){return console.warn("THREE.BoundingBoxHelper has been deprecated. Creating a THREE.BoxHelper instead."),new Ud(e,t)}function ef(e,t){return console.warn("THREE.EdgesHelper has been removed. Use THREE.EdgesGeometry instead."),new pl(new Pc(e.geometry),new il({color:void 0!==t?t:16777215}))}function tf(e,t){return console.warn("THREE.WireframeHelper has been removed. Use THREE.WireframeGeometry instead."),new pl(new El(e.geometry),new il({color:void 0!==t?t:16777215}))}function rf(e){return console.warn("THREE.XHRLoader has been renamed to THREE.FileLoader."),new vu(e)}function nf(e){return console.warn("THREE.BinaryTextureLoader has been renamed to THREE.DataTextureLoader."),new xu(e)}_u.create=function(e,t){return console.log("THREE.Curve.create() has been deprecated"),e.prototype=Object.create(_u.prototype),e.prototype.constructor=e,e.prototype.getPoint=t,e},Object.assign(Vu.prototype,{createPointsGeometry:function(e){console.warn("THREE.CurvePath: .createPointsGeometry() has been removed. Use new THREE.Geometry().setFromPoints( points ) instead.");var t=this.getPoints(e);return this.createGeometry(t)},createSpacedPointsGeometry:function(e){console.warn("THREE.CurvePath: .createSpacedPointsGeometry() has been removed. Use new THREE.Geometry().setFromPoints( points ) instead.");var t=this.getSpacedPoints(e);return this.createGeometry(t)},createGeometry:function(e){console.warn("THREE.CurvePath: .createGeometry() has been removed. Use new THREE.Geometry().setFromPoints( points ) instead.");for(var t=new ea,r=0,n=e.length;r<n;r++){var i=e[r];t.vertices.push(new Rr(i.x,i.y,i.z||0))}return t}}),Object.assign(ju.prototype,{fromPoints:function(e){return console.warn("THREE.Path: .fromPoints() has been renamed to .setFromPoints()."),this.setFromPoints(e)}}),Qp.prototype=Object.create(Pu.prototype),Zp.prototype=Object.create(Pu.prototype),Jp.prototype=Object.create(Pu.prototype),Object.assign(Jp.prototype,{initFromArray:function(){console.error("THREE.Spline: .initFromArray() has been removed.")},getControlPointsArray:function(){console.error("THREE.Spline: .getControlPointsArray() has been removed.")},reparametrizeByArcLength:function(){console.error("THREE.Spline: .reparametrizeByArcLength() has been removed.")}}),Ed.prototype.setColors=function(){console.error("THREE.GridHelper: setColors() has been deprecated, pass them in the constructor instead.")},bd.prototype.update=function(){console.error("THREE.SkeletonHelper: update() no longer needs to be called.")},Object.assign(fu.prototype,{extractUrlBase:function(e){return console.warn("THREE.Loader: .extractUrlBase() has been deprecated. Use THREE.LoaderUtils.extractUrlBase() instead."),ah.extractUrlBase(e)}}),fu.Handlers={add:function(){console.error("THREE.Loader: Handlers.add() has been removed. Use LoadingManager.addHandler() instead.")},get:function(){console.error("THREE.Loader: Handlers.get() has been removed. Use LoadingManager.getHandler() instead.")}},Object.assign(uh.prototype,{setTexturePath:function(e){return console.warn("THREE.ObjectLoader: .setTexturePath() has been renamed to .setResourcePath()."),this.setResourcePath(e)}}),Object.assign(ud.prototype,{center:function(e){return console.warn("THREE.Box2: .center() has been renamed to .getCenter()."),this.getCenter(e)},empty:function(){return console.warn("THREE.Box2: .empty() has been renamed to .isEmpty()."),this.isEmpty()},isIntersectionBox:function(e){return console.warn("THREE.Box2: .isIntersectionBox() has been renamed to .intersectsBox()."),this.intersectsBox(e)},size:function(e){return console.warn("THREE.Box2: .size() has been renamed to .getSize()."),this.getSize(e)}}),Object.assign(Sn.prototype,{center:function(e){return console.warn("THREE.Box3: .center() has been renamed to .getCenter()."),this.getCenter(e)},empty:function(){return console.warn("THREE.Box3: .empty() has been renamed to .isEmpty()."),this.isEmpty()},isIntersectionBox:function(e){return console.warn("THREE.Box3: .isIntersectionBox() has been renamed to .intersectsBox()."),this.intersectsBox(e)},isIntersectionSphere:function(e){return console.warn("THREE.Box3: .isIntersectionSphere() has been renamed to .intersectsSphere()."),this.intersectsSphere(e)},size:function(e){return console.warn("THREE.Box3: .size() has been renamed to .getSize()."),this.getSize(e)}}),pd.prototype.center=function(e){return console.warn("THREE.Line3: .center() has been renamed to .getCenter()."),this.getCenter(e)},Object.assign(_r,{random16:function(){return console.warn("THREE.Math: .random16() has been deprecated. Use Math.random() instead."),Math.random()},nearestPowerOfTwo:function(e){return console.warn("THREE.Math: .nearestPowerOfTwo() has been renamed to .floorPowerOfTwo()."),_r.floorPowerOfTwo(e)},nextPowerOfTwo:function(e){return console.warn("THREE.Math: .nextPowerOfTwo() has been renamed to .ceilPowerOfTwo()."),_r.ceilPowerOfTwo(e)}}),Object.assign(Pr.prototype,{flattenToArrayOffset:function(e,t){return console.warn("THREE.Matrix3: .flattenToArrayOffset() has been deprecated. Use .toArray() instead."),this.toArray(e,t)},multiplyVector3:function(e){return console.warn("THREE.Matrix3: .multiplyVector3() has been removed. Use vector.applyMatrix3( matrix ) instead."),e.applyMatrix3(this)},multiplyVector3Array:function(){console.error("THREE.Matrix3: .multiplyVector3Array() has been removed.")},applyToBuffer:function(e){return console.warn("THREE.Matrix3: .applyToBuffer() has been removed. Use matrix.applyToBufferAttribute( attribute ) instead."),this.applyToBufferAttribute(e)},applyToVector3Array:function(){console.error("THREE.Matrix3: .applyToVector3Array() has been removed.")}}),Object.assign(Wr.prototype,{extractPosition:function(e){return console.warn("THREE.Matrix4: .extractPosition() has been renamed to .copyPosition()."),this.copyPosition(e)},flattenToArrayOffset:function(e,t){return console.warn("THREE.Matrix4: .flattenToArrayOffset() has been deprecated. Use .toArray() instead."),this.toArray(e,t)},getPosition:function(){return console.warn("THREE.Matrix4: .getPosition() has been removed. Use Vector3.setFromMatrixPosition( matrix ) instead."),(new Rr).setFromMatrixColumn(this,3)},setRotationFromQuaternion:function(e){return console.warn("THREE.Matrix4: .setRotationFromQuaternion() has been renamed to .makeRotationFromQuaternion()."),this.makeRotationFromQuaternion(e)},multiplyToArray:function(){console.warn("THREE.Matrix4: .multiplyToArray() has been removed.")},multiplyVector3:function(e){return console.warn("THREE.Matrix4: .multiplyVector3() has been removed. Use vector.applyMatrix4( matrix ) instead."),e.applyMatrix4(this)},multiplyVector4:function(e){return console.warn("THREE.Matrix4: .multiplyVector4() has been removed. Use vector.applyMatrix4( matrix ) instead."),e.applyMatrix4(this)},multiplyVector3Array:function(){console.error("THREE.Matrix4: .multiplyVector3Array() has been removed.")},rotateAxis:function(e){console.warn("THREE.Matrix4: .rotateAxis() has been removed. Use Vector3.transformDirection( matrix ) instead."),e.transformDirection(this)},crossVector:function(e){return console.warn("THREE.Matrix4: .crossVector() has been removed. Use vector.applyMatrix4( matrix ) instead."),e.applyMatrix4(this)},translate:function(){console.error("THREE.Matrix4: .translate() has been removed.")},rotateX:function(){console.error("THREE.Matrix4: .rotateX() has been removed.")},rotateY:function(){console.error("THREE.Matrix4: .rotateY() has been removed.")},rotateZ:function(){console.error("THREE.Matrix4: .rotateZ() has been removed.")},rotateByAxis:function(){console.error("THREE.Matrix4: .rotateByAxis() has been removed.")},applyToBuffer:function(e){return console.warn("THREE.Matrix4: .applyToBuffer() has been removed. Use matrix.applyToBufferAttribute( attribute ) instead."),this.applyToBufferAttribute(e)},applyToVector3Array:function(){console.error("THREE.Matrix4: .applyToVector3Array() has been removed.")},makeFrustum:function(e,t,r,n,i,a){return console.warn("THREE.Matrix4: .makeFrustum() has been removed. Use .makePerspective( left, right, top, bottom, near, far ) instead."),this.makePerspective(e,t,n,r,i,a)}}),zn.prototype.isIntersectionLine=function(e){return console.warn("THREE.Plane: .isIntersectionLine() has been renamed to .intersectsLine()."),this.intersectsLine(e)},Sr.prototype.multiplyVector3=function(e){return console.warn("THREE.Quaternion: .multiplyVector3() has been removed. Use is now vector.applyQuaternion( quaternion ) instead."),e.applyQuaternion(this)},Object.assign(Fn.prototype,{isIntersectionBox:function(e){return console.warn("THREE.Ray: .isIntersectionBox() has been renamed to .intersectsBox()."),this.intersectsBox(e)},isIntersectionPlane:function(e){return console.warn("THREE.Ray: .isIntersectionPlane() has been renamed to .intersectsPlane()."),this.intersectsPlane(e)},isIntersectionSphere:function(e){return console.warn("THREE.Ray: .isIntersectionSphere() has been renamed to .intersectsSphere()."),this.intersectsSphere(e)}}),Object.assign(Jn.prototype,{area:function(){return console.warn("THREE.Triangle: .area() has been renamed to .getArea()."),this.getArea()},barycoordFromPoint:function(e,t){return console.warn("THREE.Triangle: .barycoordFromPoint() has been renamed to .getBarycoord()."),this.getBarycoord(e,t)},midpoint:function(e){return console.warn("THREE.Triangle: .midpoint() has been renamed to .getMidpoint()."),this.getMidpoint(e)},normal:function(e){return console.warn("THREE.Triangle: .normal() has been renamed to .getNormal()."),this.getNormal(e)},plane:function(e){return console.warn("THREE.Triangle: .plane() has been renamed to .getPlane()."),this.getPlane(e)}}),Object.assign(Jn,{barycoordFromPoint:function(e,t,r,n,i){return console.warn("THREE.Triangle: .barycoordFromPoint() has been renamed to .getBarycoord()."),Jn.getBarycoord(e,t,r,n,i)},normal:function(e,t,r,n){return console.warn("THREE.Triangle: .normal() has been renamed to .getNormal()."),Jn.getNormal(e,t,r,n)}}),Object.assign(Wu.prototype,{extractAllPoints:function(e){return console.warn("THREE.Shape: .extractAllPoints() has been removed. Use .extractPoints() instead."),this.extractPoints(e)},extrude:function(e){return console.warn("THREE.Shape: .extrude() has been removed. Use ExtrudeGeometry() instead."),new vc(this,e)},makeGeometry:function(e){return console.warn("THREE.Shape: .makeGeometry() has been removed. Use ShapeGeometry() instead."),new Rc(this,e)}}),Object.assign(Mr.prototype,{fromAttribute:function(e,t,r){return console.warn("THREE.Vector2: .fromAttribute() has been renamed to .fromBufferAttribute()."),this.fromBufferAttribute(e,t,r)},distanceToManhattan:function(e){return console.warn("THREE.Vector2: .distanceToManhattan() has been renamed to .manhattanDistanceTo()."),this.manhattanDistanceTo(e)},lengthManhattan:function(){return console.warn("THREE.Vector2: .lengthManhattan() has been renamed to .manhattanLength()."),this.manhattanLength()}}),Object.assign(Rr.prototype,{setEulerFromRotationMatrix:function(){console.error("THREE.Vector3: .setEulerFromRotationMatrix() has been removed. Use Euler.setFromRotationMatrix() instead.")},setEulerFromQuaternion:function(){console.error("THREE.Vector3: .setEulerFromQuaternion() has been removed. Use Euler.setFromQuaternion() instead.")},getPositionFromMatrix:function(e){return console.warn("THREE.Vector3: .getPositionFromMatrix() has been renamed to .setFromMatrixPosition()."),this.setFromMatrixPosition(e)},getScaleFromMatrix:function(e){return console.warn("THREE.Vector3: .getScaleFromMatrix() has been renamed to .setFromMatrixScale()."),this.setFromMatrixScale(e)},getColumnFromMatrix:function(e,t){return console.warn("THREE.Vector3: .getColumnFromMatrix() has been renamed to .setFromMatrixColumn()."),this.setFromMatrixColumn(t,e)},applyProjection:function(e){return console.warn("THREE.Vector3: .applyProjection() has been removed. Use .applyMatrix4( m ) instead."),this.applyMatrix4(e)},fromAttribute:function(e,t,r){return console.warn("THREE.Vector3: .fromAttribute() has been renamed to .fromBufferAttribute()."),this.fromBufferAttribute(e,t,r)},distanceToManhattan:function(e){return console.warn("THREE.Vector3: .distanceToManhattan() has been renamed to .manhattanDistanceTo()."),this.manhattanDistanceTo(e)},lengthManhattan:function(){return console.warn("THREE.Vector3: .lengthManhattan() has been renamed to .manhattanLength()."),this.manhattanLength()}}),Object.assign(Br.prototype,{fromAttribute:function(e,t,r){return console.warn("THREE.Vector4: .fromAttribute() has been renamed to .fromBufferAttribute()."),this.fromBufferAttribute(e,t,r)},lengthManhattan:function(){return console.warn("THREE.Vector4: .lengthManhattan() has been renamed to .manhattanLength()."),this.manhattanLength()}}),Object.assign(ea.prototype,{computeTangents:function(){console.error("THREE.Geometry: .computeTangents() has been removed.")},computeLineDistances:function(){console.error("THREE.Geometry: .computeLineDistances() has been removed. Use THREE.Line.computeLineDistances() instead.")}}),Object.assign(un.prototype,{getChildByName:function(e){return console.warn("THREE.Object3D: .getChildByName() has been renamed to .getObjectByName()."),this.getObjectByName(e)},renderDepth:function(){console.warn("THREE.Object3D: .renderDepth has been removed. Use .renderOrder, instead.")},translate:function(e,t){return console.warn("THREE.Object3D: .translate() has been removed. Use .translateOnAxis( axis, distance ) instead."),this.translateOnAxis(t,e)},getWorldRotation:function(){console.error("THREE.Object3D: .getWorldRotation() has been removed. Use THREE.Object3D.getWorldQuaternion( target ) instead.")}}),Object.defineProperties(un.prototype,{eulerOrder:{get:function(){return console.warn("THREE.Object3D: .eulerOrder is now .rotation.order."),this.rotation.order},set:function(e){console.warn("THREE.Object3D: .eulerOrder is now .rotation.order."),this.rotation.order=e}},useQuaternion:{get:function(){console.warn("THREE.Object3D: .useQuaternion has been removed. The library now uses quaternions by default.")},set:function(){console.warn("THREE.Object3D: .useQuaternion has been removed. The library now uses quaternions by default.")}}}),Object.assign(Xi.prototype,{setDrawMode:function(){console.error("THREE.Mesh: .setDrawMode() has been removed. The renderer now always assumes THREE.TrianglesDrawMode. Transform your geometry via BufferGeometryUtils.toTrianglesDrawMode() if necessary.")}}),Object.defineProperties(Xi.prototype,{drawMode:{get:function(){return console.error("THREE.Mesh: .drawMode has been removed. The renderer now always assumes THREE.TrianglesDrawMode."),Ot},set:function(){console.error("THREE.Mesh: .drawMode has been removed. The renderer now always assumes THREE.TrianglesDrawMode. Transform your geometry via BufferGeometryUtils.toTrianglesDrawMode() if necessary.")}}}),Object.defineProperties(Xs.prototype,{objects:{get:function(){return console.warn("THREE.LOD: .objects has been renamed to .levels."),this.levels}}}),Object.defineProperty(Js.prototype,"useVertexTexture",{get:function(){console.warn("THREE.Skeleton: useVertexTexture has been removed.")},set:function(){console.warn("THREE.Skeleton: useVertexTexture has been removed.")}}),Ys.prototype.initBones=function(){console.error("THREE.SkinnedMesh: initBones() has been removed.")},Object.defineProperty(_u.prototype,"__arcLengthDivisions",{get:function(){return console.warn("THREE.Curve: .__arcLengthDivisions is now .arcLengthDivisions."),this.arcLengthDivisions},set:function(e){console.warn("THREE.Curve: .__arcLengthDivisions is now .arcLengthDivisions."),this.arcLengthDivisions=e}}),ua.prototype.setLens=function(e,t){console.warn("THREE.PerspectiveCamera.setLens is deprecated. Use .setFocalLength and .filmGauge for a photographic setup."),void 0!==t&&(this.filmGauge=t),this.setFocalLength(e)},Object.defineProperties(qu.prototype,{onlyShadow:{set:function(){console.warn("THREE.Light: .onlyShadow has been removed.")}},shadowCameraFov:{set:function(e){console.warn("THREE.Light: .shadowCameraFov is now .shadow.camera.fov."),this.shadow.camera.fov=e}},shadowCameraLeft:{set:function(e){console.warn("THREE.Light: .shadowCameraLeft is now .shadow.camera.left."),this.shadow.camera.left=e}},shadowCameraRight:{set:function(e){console.warn("THREE.Light: .shadowCameraRight is now .shadow.camera.right."),this.shadow.camera.right=e}},shadowCameraTop:{set:function(e){console.warn("THREE.Light: .shadowCameraTop is now .shadow.camera.top."),this.shadow.camera.top=e}},shadowCameraBottom:{set:function(e){console.warn("THREE.Light: .shadowCameraBottom is now .shadow.camera.bottom."),this.shadow.camera.bottom=e}},shadowCameraNear:{set:function(e){console.warn("THREE.Light: .shadowCameraNear is now .shadow.camera.near."),this.shadow.camera.near=e}},shadowCameraFar:{set:function(e){console.warn("THREE.Light: .shadowCameraFar is now .shadow.camera.far."),this.shadow.camera.far=e}},shadowCameraVisible:{set:function(){console.warn("THREE.Light: .shadowCameraVisible has been removed. Use new THREE.CameraHelper( light.shadow.camera ) instead.")}},shadowBias:{set:function(e){console.warn("THREE.Light: .shadowBias is now .shadow.bias."),this.shadow.bias=e}},shadowDarkness:{set:function(){console.warn("THREE.Light: .shadowDarkness has been removed.")}},shadowMapWidth:{set:function(e){console.warn("THREE.Light: .shadowMapWidth is now .shadow.mapSize.width."),this.shadow.mapSize.width=e}},shadowMapHeight:{set:function(e){console.warn("THREE.Light: .shadowMapHeight is now .shadow.mapSize.height."),this.shadow.mapSize.height=e}}}),Object.defineProperties(ui.prototype,{length:{get:function(){return console.warn("THREE.BufferAttribute: .length has been deprecated. Use .count instead."),this.array.length}},dynamic:{get:function(){return console.warn("THREE.BufferAttribute: .dynamic has been deprecated. Use .usage instead."),this.usage===dr},set:function(){console.warn("THREE.BufferAttribute: .dynamic has been deprecated. Use .usage instead."),this.setUsage(dr)}}}),Object.assign(ui.prototype,{setDynamic:function(e){return console.warn("THREE.BufferAttribute: .setDynamic() has been deprecated. Use .setUsage() instead."),this.setUsage(!0===e?dr:hr),this},copyIndicesArray:function(){console.error("THREE.BufferAttribute: .copyIndicesArray() has been removed.")},setArray:function(){console.error("THREE.BufferAttribute: .setArray has been removed. Use BufferGeometry .setAttribute to replace/resize attribute buffers")}}),Object.assign(Li.prototype,{addIndex:function(e){console.warn("THREE.BufferGeometry: .addIndex() has been renamed to .setIndex()."),this.setIndex(e)},addAttribute:function(e,t){return console.warn("THREE.BufferGeometry: .addAttribute() has been renamed to .setAttribute()."),t&&t.isBufferAttribute||t&&t.isInterleavedBufferAttribute?"index"===e?(console.warn("THREE.BufferGeometry.addAttribute: Use .setIndex() for index attribute."),this.setIndex(t),this):this.setAttribute(e,t):(console.warn("THREE.BufferGeometry: .addAttribute() now expects ( name, attribute )."),this.setAttribute(e,new ui(arguments[1],arguments[2])))},addDrawCall:function(e,t,r){void 0!==r&&console.warn("THREE.BufferGeometry: .addDrawCall() no longer supports indexOffset."),console.warn("THREE.BufferGeometry: .addDrawCall() is now .addGroup()."),this.addGroup(e,t)},clearDrawCalls:function(){console.warn("THREE.BufferGeometry: .clearDrawCalls() is now .clearGroups()."),this.clearGroups()},computeTangents:function(){console.warn("THREE.BufferGeometry: .computeTangents() has been removed.")},computeOffsets:function(){console.warn("THREE.BufferGeometry: .computeOffsets() has been removed.")},removeAttribute:function(e){return console.warn("THREE.BufferGeometry: .removeAttribute() has been renamed to .deleteAttribute()."),this.deleteAttribute(e)}}),Object.defineProperties(Li.prototype,{drawcalls:{get:function(){return console.error("THREE.BufferGeometry: .drawcalls has been renamed to .groups."),this.groups}},offsets:{get:function(){return console.warn("THREE.BufferGeometry: .offsets has been renamed to .groups."),this.groups}}}),Object.defineProperties(Es.prototype,{dynamic:{get:function(){return console.warn("THREE.InterleavedBuffer: .length has been deprecated. Use .usage instead."),this.usage===dr},set:function(e){console.warn("THREE.InterleavedBuffer: .length has been deprecated. Use .usage instead."),this.setUsage(e)}}}),Object.assign(Es.prototype,{setDynamic:function(e){return console.warn("THREE.InterleavedBuffer: .setDynamic() has been deprecated. Use .setUsage() instead."),this.setUsage(!0===e?dr:hr),this},setArray:function(){console.error("THREE.InterleavedBuffer: .setArray has been removed. Use BufferGeometry .setAttribute to replace/resize attribute buffers")}}),Object.assign(gc.prototype,{getArrays:function(){console.error("THREE.ExtrudeBufferGeometry: .getArrays() has been removed.")},addShapeList:function(){console.error("THREE.ExtrudeBufferGeometry: .addShapeList() has been removed.")},addShape:function(){console.error("THREE.ExtrudeBufferGeometry: .addShape() has been removed.")}}),Object.defineProperties(rd.prototype,{dynamic:{set:function(){console.warn("THREE.Uniform: .dynamic has been removed. Use object.onBeforeRender() instead.")}},onUpdate:{value:function(){return console.warn("THREE.Uniform: .onUpdate() has been removed. Use object.onBeforeRender() instead."),this}}}),Object.defineProperties(si.prototype,{wrapAround:{get:function(){console.warn("THREE.Material: .wrapAround has been removed.")},set:function(){console.warn("THREE.Material: .wrapAround has been removed.")}},overdraw:{get:function(){console.warn("THREE.Material: .overdraw has been removed.")},set:function(){console.warn("THREE.Material: .overdraw has been removed.")}},wrapRGB:{get:function(){return console.warn("THREE.Material: .wrapRGB has been removed."),new ti}},shading:{get:function(){console.error("THREE."+this.type+": .shading has been removed. Use the boolean .flatShading instead.")},set:function(e){console.warn("THREE."+this.type+": .shading has been removed. Use the boolean .flatShading instead."),this.flatShading=e===x}},stencilMask:{get:function(){return console.warn("THREE."+this.type+": .stencilMask has been removed. Use .stencilFuncMask instead."),this.stencilFuncMask},set:function(e){console.warn("THREE."+this.type+": .stencilMask has been removed. Use .stencilFuncMask instead."),this.stencilFuncMask=e}}}),Object.defineProperties(Vc.prototype,{metal:{get:function(){return console.warn("THREE.MeshPhongMaterial: .metal has been removed. Use THREE.MeshStandardMaterial instead."),!1},set:function(){console.warn("THREE.MeshPhongMaterial: .metal has been removed. Use THREE.MeshStandardMaterial instead")}}}),Object.defineProperties(la.prototype,{derivatives:{get:function(){return console.warn("THREE.ShaderMaterial: .derivatives has been moved to .extensions.derivatives."),this.extensions.derivatives},set:function(e){console.warn("THREE. ShaderMaterial: .derivatives has been moved to .extensions.derivatives."),this.extensions.derivatives=e}}}),Object.assign(_s.prototype,{clearTarget:function(e,t,r,n){console.warn("THREE.WebGLRenderer: .clearTarget() has been deprecated. Use .setRenderTarget() and .clear() instead."),this.setRenderTarget(e),this.clear(t,r,n)},animate:function(e){console.warn("THREE.WebGLRenderer: .animate() is now .setAnimationLoop()."),this.setAnimationLoop(e)},getCurrentRenderTarget:function(){return console.warn("THREE.WebGLRenderer: .getCurrentRenderTarget() is now .getRenderTarget()."),this.getRenderTarget()},getMaxAnisotropy:function(){return console.warn("THREE.WebGLRenderer: .getMaxAnisotropy() is now .capabilities.getMaxAnisotropy()."),this.capabilities.getMaxAnisotropy()},getPrecision:function(){return console.warn("THREE.WebGLRenderer: .getPrecision() is now .capabilities.precision."),this.capabilities.precision},resetGLState:function(){return console.warn("THREE.WebGLRenderer: .resetGLState() is now .state.reset()."),this.state.reset()},supportsFloatTextures:function(){return console.warn("THREE.WebGLRenderer: .supportsFloatTextures() is now .extensions.get( 'OES_texture_float' )."),this.extensions.get("OES_texture_float")},supportsHalfFloatTextures:function(){return console.warn("THREE.WebGLRenderer: .supportsHalfFloatTextures() is now .extensions.get( 'OES_texture_half_float' )."),this.extensions.get("OES_texture_half_float")},supportsStandardDerivatives:function(){return console.warn("THREE.WebGLRenderer: .supportsStandardDerivatives() is now .extensions.get( 'OES_standard_derivatives' )."),this.extensions.get("OES_standard_derivatives")},supportsCompressedTextureS3TC:function(){return console.warn("THREE.WebGLRenderer: .supportsCompressedTextureS3TC() is now .extensions.get( 'WEBGL_compressed_texture_s3tc' )."),this.extensions.get("WEBGL_compressed_texture_s3tc")},supportsCompressedTexturePVRTC:function(){return console.warn("THREE.WebGLRenderer: .supportsCompressedTexturePVRTC() is now .extensions.get( 'WEBGL_compressed_texture_pvrtc' )."),this.extensions.get("WEBGL_compressed_texture_pvrtc")},supportsBlendMinMax:function(){return console.warn("THREE.WebGLRenderer: .supportsBlendMinMax() is now .extensions.get( 'EXT_blend_minmax' )."),this.extensions.get("EXT_blend_minmax")},supportsVertexTextures:function(){return console.warn("THREE.WebGLRenderer: .supportsVertexTextures() is now .capabilities.vertexTextures."),this.capabilities.vertexTextures},supportsInstancedArrays:function(){return console.warn("THREE.WebGLRenderer: .supportsInstancedArrays() is now .extensions.get( 'ANGLE_instanced_arrays' )."),this.extensions.get("ANGLE_instanced_arrays")},enableScissorTest:function(e){console.warn("THREE.WebGLRenderer: .enableScissorTest() is now .setScissorTest()."),this.setScissorTest(e)},initMaterial:function(){console.warn("THREE.WebGLRenderer: .initMaterial() has been removed.")},addPrePlugin:function(){console.warn("THREE.WebGLRenderer: .addPrePlugin() has been removed.")},addPostPlugin:function(){console.warn("THREE.WebGLRenderer: .addPostPlugin() has been removed.")},updateShadowMap:function(){console.warn("THREE.WebGLRenderer: .updateShadowMap() has been removed.")},setFaceCulling:function(){console.warn("THREE.WebGLRenderer: .setFaceCulling() has been removed.")},allocTextureUnit:function(){console.warn("THREE.WebGLRenderer: .allocTextureUnit() has been removed.")},setTexture:function(){console.warn("THREE.WebGLRenderer: .setTexture() has been removed.")},setTexture2D:function(){console.warn("THREE.WebGLRenderer: .setTexture2D() has been removed.")},setTextureCube:function(){console.warn("THREE.WebGLRenderer: .setTextureCube() has been removed.")},getActiveMipMapLevel:function(){return console.warn("THREE.WebGLRenderer: .getActiveMipMapLevel() is now .getActiveMipmapLevel()."),this.getActiveMipmapLevel()}}),Object.defineProperties(_s.prototype,{shadowMapEnabled:{get:function(){return this.shadowMap.enabled},set:function(e){console.warn("THREE.WebGLRenderer: .shadowMapEnabled is now .shadowMap.enabled."),this.shadowMap.enabled=e}},shadowMapType:{get:function(){return this.shadowMap.type},set:function(e){console.warn("THREE.WebGLRenderer: .shadowMapType is now .shadowMap.type."),this.shadowMap.type=e}},shadowMapCullFace:{get:function(){console.warn("THREE.WebGLRenderer: .shadowMapCullFace has been removed. Set Material.shadowSide instead.")},set:function(){console.warn("THREE.WebGLRenderer: .shadowMapCullFace has been removed. Set Material.shadowSide instead.")}},context:{get:function(){return console.warn("THREE.WebGLRenderer: .context has been removed. Use .getContext() instead."),this.getContext()}},vr:{get:function(){return console.warn("THREE.WebGLRenderer: .vr has been renamed to .xr"),this.xr}},gammaInput:{get:function(){return console.warn("THREE.WebGLRenderer: .gammaInput has been removed. Set the encoding for textures via Texture.encoding instead."),!1},set:function(){console.warn("THREE.WebGLRenderer: .gammaInput has been removed. Set the encoding for textures via Texture.encoding instead.")}},gammaOutput:{get:function(){return console.warn("THREE.WebGLRenderer: .gammaOutput has been removed. Set WebGLRenderer.outputEncoding instead."),!1},set:function(e){console.warn("THREE.WebGLRenderer: .gammaOutput has been removed. Set WebGLRenderer.outputEncoding instead."),this.outputEncoding=!0===e?Nt:Ut}}}),Object.defineProperties(fs.prototype,{cullFace:{get:function(){console.warn("THREE.WebGLRenderer: .shadowMap.cullFace has been removed. Set Material.shadowSide instead.")},set:function(){console.warn("THREE.WebGLRenderer: .shadowMap.cullFace has been removed. Set Material.shadowSide instead.")}},renderReverseSided:{get:function(){console.warn("THREE.WebGLRenderer: .shadowMap.renderReverseSided has been removed. Set Material.shadowSide instead.")},set:function(){console.warn("THREE.WebGLRenderer: .shadowMap.renderReverseSided has been removed. Set Material.shadowSide instead.")}},renderSingleSided:{get:function(){console.warn("THREE.WebGLRenderer: .shadowMap.renderSingleSided has been removed. Set Material.shadowSide instead.")},set:function(){console.warn("THREE.WebGLRenderer: .shadowMap.renderSingleSided has been removed. Set Material.shadowSide instead.")}}}),Object.defineProperties(fa.prototype,{activeCubeFace:{set:function(){console.warn("THREE.WebGLRenderTargetCube: .activeCubeFace has been removed. It is now the second parameter of WebGLRenderer.setRenderTarget().")}},activeMipMapLevel:{set:function(){console.warn("THREE.WebGLRenderTargetCube: .activeMipMapLevel has been removed. It is now the third parameter of WebGLRenderer.setRenderTarget().")}}}),Object.defineProperties(Fr.prototype,{wrapS:{get:function(){return console.warn("THREE.WebGLRenderTarget: .wrapS is now .texture.wrapS."),this.texture.wrapS},set:function(e){console.warn("THREE.WebGLRenderTarget: .wrapS is now .texture.wrapS."),this.texture.wrapS=e}},wrapT:{get:function(){return console.warn("THREE.WebGLRenderTarget: .wrapT is now .texture.wrapT."),this.texture.wrapT},set:function(e){console.warn("THREE.WebGLRenderTarget: .wrapT is now .texture.wrapT."),this.texture.wrapT=e}},magFilter:{get:function(){return console.warn("THREE.WebGLRenderTarget: .magFilter is now .texture.magFilter."),this.texture.magFilter},set:function(e){console.warn("THREE.WebGLRenderTarget: .magFilter is now .texture.magFilter."),this.texture.magFilter=e}},minFilter:{get:function(){return console.warn("THREE.WebGLRenderTarget: .minFilter is now .texture.minFilter."),this.texture.minFilter},set:function(e){console.warn("THREE.WebGLRenderTarget: .minFilter is now .texture.minFilter."),this.texture.minFilter=e}},anisotropy:{get:function(){return console.warn("THREE.WebGLRenderTarget: .anisotropy is now .texture.anisotropy."),this.texture.anisotropy},set:function(e){console.warn("THREE.WebGLRenderTarget: .anisotropy is now .texture.anisotropy."),this.texture.anisotropy=e}},offset:{get:function(){return console.warn("THREE.WebGLRenderTarget: .offset is now .texture.offset."),this.texture.offset},set:function(e){console.warn("THREE.WebGLRenderTarget: .offset is now .texture.offset."),this.texture.offset=e}},repeat:{get:function(){return console.warn("THREE.WebGLRenderTarget: .repeat is now .texture.repeat."),this.texture.repeat},set:function(e){console.warn("THREE.WebGLRenderTarget: .repeat is now .texture.repeat."),this.texture.repeat=e}},format:{get:function(){return console.warn("THREE.WebGLRenderTarget: .format is now .texture.format."),this.texture.format},set:function(e){console.warn("THREE.WebGLRenderTarget: .format is now .texture.format."),this.texture.format=e}},type:{get:function(){return console.warn("THREE.WebGLRenderTarget: .type is now .texture.type."),this.texture.type},set:function(e){console.warn("THREE.WebGLRenderTarget: .type is now .texture.type."),this.texture.type=e}},generateMipmaps:{get:function(){return console.warn("THREE.WebGLRenderTarget: .generateMipmaps is now .texture.generateMipmaps."),this.texture.generateMipmaps},set:function(e){console.warn("THREE.WebGLRenderTarget: .generateMipmaps is now .texture.generateMipmaps."),this.texture.generateMipmaps=e}}}),Object.defineProperties(Bh.prototype,{load:{value:function(e){console.warn("THREE.Audio: .load has been deprecated. Use THREE.AudioLoader instead.");var t=this;return(new Ah).load(e,(function(e){t.setBuffer(e)})),this}},startTime:{set:function(){console.warn("THREE.Audio: .startTime is now .play( delay ).")}}}),kh.prototype.getData=function(){return console.warn("THREE.AudioAnalyser: .getData() is now .getFrequencyData()."),this.getFrequencyData()},pa.prototype.updateCubeMap=function(e,t){return console.warn("THREE.CubeCamera: .updateCubeMap() is now .update()."),this.update(e,t)};var af={merge:function(e,t,r){var n;console.warn("THREE.GeometryUtils: .merge() has been moved to Geometry. Use geometry.merge( geometry2, matrix, materialIndexOffset ) instead."),t.isMesh&&(t.matrixAutoUpdate&&t.updateMatrix(),n=t.matrix,t=t.geometry),e.merge(t,n,r)},center:function(e){return console.warn("THREE.GeometryUtils: .center() has been moved to Geometry. Use geometry.center() instead."),e.center()}};function of(){console.error("THREE.CanvasRenderer has been removed")}function sf(){console.error("THREE.JSONLoader has been removed.")}Dr.crossOrigin=void 0,Dr.loadTexture=function(e,t,r,n){console.warn("THREE.ImageUtils.loadTexture has been deprecated. Use THREE.TextureLoader() instead.");var i=new wu;i.setCrossOrigin(this.crossOrigin);var a=i.load(e,r,void 0,n);return t&&(a.mapping=t),a},Dr.loadTextureCube=function(e,t,r,n){console.warn("THREE.ImageUtils.loadTextureCube has been deprecated. Use THREE.CubeTextureLoader() instead.");var i=new Au;i.setCrossOrigin(this.crossOrigin);var a=i.load(e,r,void 0,n);return t&&(a.mapping=t),a},Dr.loadCompressedTexture=function(){console.error("THREE.ImageUtils.loadCompressedTexture has been removed. Use THREE.DDSLoader instead.")},Dr.loadCompressedTextureCube=function(){console.error("THREE.ImageUtils.loadCompressedTextureCube has been removed. Use THREE.DDSLoader instead.")};var lf={createMultiMaterialObject:function(){console.error("THREE.SceneUtils has been moved to /examples/js/utils/SceneUtils.js")},detach:function(){console.error("THREE.SceneUtils has been moved to /examples/js/utils/SceneUtils.js")},attach:function(){console.error("THREE.SceneUtils has been moved to /examples/js/utils/SceneUtils.js")}};function cf(){console.error("THREE.LensFlare has been moved to /examples/js/objects/Lensflare.js")}"undefined"!=typeof __THREE_DEVTOOLS__&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("register",{detail:{revision:n}}))},function(module,__webpack_exports__,__webpack_require__){"use strict";__webpack_require__.d(__webpack_exports__,"a",(function(){return Not})),__webpack_require__.d(__webpack_exports__,"b",(function(){return System})),__webpack_require__.d(__webpack_exports__,"c",(function(){return SystemStateComponent})),__webpack_require__.d(__webpack_exports__,"d",(function(){return TagComponent})),__webpack_require__.d(__webpack_exports__,"e",(function(){return World}));class SystemManager{constructor(e){this._systems=[],this._executeSystems=[],this.world=e,this.lastExecutedSystem=null}registerSystem(e,t){if(void 0!==this._systems.find(t=>t.constructor.name===e.name))return console.warn(`System '${e.name}' already registered.`),this;var r=new e(this.world,t);return r.init&&r.init(),r.order=this._systems.length,this._systems.push(r),r.execute&&(this._executeSystems.push(r),this.sortSystems()),this}sortSystems(){this._executeSystems.sort((e,t)=>e.priority-t.priority||e.order-t.order)}getSystem(e){return this._systems.find(t=>t instanceof e)}getSystems(){return this._systems}removeSystem(e){var t=this._systems.indexOf(e);~t&&this._systems.splice(t,1)}executeSystem(e,t,r){if(e.initialized&&e.canExecute()){let n=performance.now();e.execute(t,r),e.executeTime=performance.now()-n,this.lastExecutedSystem=e,e.clearEvents()}}stop(){this._executeSystems.forEach(e=>e.stop())}execute(e,t,r){this._executeSystems.forEach(n=>(r||n.enabled)&&this.executeSystem(n,e,t))}stats(){for(var e={numSystems:this._systems.length,systems:{}},t=0;t<this._systems.length;t++){var r=this._systems[t],n=e.systems[r.constructor.name]={queries:{}};for(var i in r.ctx)n.queries[i]=r.ctx[i].stats()}return e}}class EventDispatcher{constructor(){this._listeners={},this.stats={fired:0,handled:0}}addEventListener(e,t){let r=this._listeners;void 0===r[e]&&(r[e]=[]),-1===r[e].indexOf(t)&&r[e].push(t)}hasEventListener(e,t){return void 0!==this._listeners[e]&&-1!==this._listeners[e].indexOf(t)}removeEventListener(e,t){var r=this._listeners[e];if(void 0!==r){var n=r.indexOf(t);-1!==n&&r.splice(n,1)}}dispatchEvent(e,t,r){this.stats.fired++;var n=this._listeners[e];if(void 0!==n)for(var i=n.slice(0),a=0;a<i.length;a++)i[a].call(this,t,r)}resetCounters(){this.stats.fired=this.stats.handled=0}}function getName(e){return e.name}function componentPropertyName(e){var t=getName(e);return t.charAt(0).toLowerCase()+t.slice(1)}function queryKey(e){for(var t=[],r=0;r<e.length;r++){var n=e[r];if("object"==typeof n){var i="not"===n.operator?"!":n.operator;t.push(i+getName(n.Component))}else t.push(getName(n))}return t.sort().join("-")}class Query{constructor(e,t){if(this.Components=[],this.NotComponents=[],e.forEach(e=>{"object"==typeof e?this.NotComponents.push(e.Component):this.Components.push(e)}),0===this.Components.length)throw new Error("Can't create a query without components");this.entities=[],this.eventDispatcher=new EventDispatcher,this.reactive=!1,this.key=queryKey(e);for(var r=0;r<t._entities.length;r++){var n=t._entities[r];this.match(n)&&(n.queries.push(this),this.entities.push(n))}}addEntity(e){e.queries.push(this),this.entities.push(e),this.eventDispatcher.dispatchEvent(Query.prototype.ENTITY_ADDED,e)}removeEntity(e){let t=this.entities.indexOf(e);~t&&(this.entities.splice(t,1),t=e.queries.indexOf(this),e.queries.splice(t,1),this.eventDispatcher.dispatchEvent(Query.prototype.ENTITY_REMOVED,e))}match(e){return e.hasAllComponents(this.Components)&&!e.hasAnyComponents(this.NotComponents)}toJSON(){return{key:this.key,reactive:this.reactive,components:{included:this.Components.map(e=>e.name),not:this.NotComponents.map(e=>e.name)},numEntities:this.entities.length}}stats(){return{numComponents:this.Components.length,numEntities:this.entities.length}}}Query.prototype.ENTITY_ADDED="Query#ENTITY_ADDED",Query.prototype.ENTITY_REMOVED="Query#ENTITY_REMOVED",Query.prototype.COMPONENT_CHANGED="Query#COMPONENT_CHANGED";var nextId=0;class Entity{constructor(e){this._world=e||null,this.id=nextId++,this._ComponentTypes=[],this._components={},this._componentsToRemove={},this.queries=[],this._ComponentTypesToRemove=[],this.alive=!1}getComponent(e,t){var r=this._components[e.name];return r||!0!==t||(r=this._componentsToRemove[e.name]),r}getRemovedComponent(e){return this._componentsToRemove[e.name]}getComponents(){return this._components}getComponentsToRemove(){return this._componentsToRemove}getComponentTypes(){return this._ComponentTypes}getMutableComponent(e){for(var t=this._components[e.name],r=0;r<this.queries.length;r++){var n=this.queries[r];n.reactive&&-1!==n.Components.indexOf(e)&&n.eventDispatcher.dispatchEvent(Query.prototype.COMPONENT_CHANGED,this,t)}return t}addComponent(e,t){return this._world.entityAddComponent(this,e,t),this}removeComponent(e,t){return this._world.entityRemoveComponent(this,e,t),this}hasComponent(e,t){return!!~this._ComponentTypes.indexOf(e)||!0===t&&this.hasRemovedComponent(e)}hasRemovedComponent(e){return!!~this._ComponentTypesToRemove.indexOf(e)}hasAllComponents(e){for(var t=0;t<e.length;t++)if(!this.hasComponent(e[t]))return!1;return!0}hasAnyComponents(e){for(var t=0;t<e.length;t++)if(this.hasComponent(e[t]))return!0;return!1}removeAllComponents(e){return this._world.entityRemoveAllComponents(this,e)}reset(){this.id=nextId++,this._world=null,this._ComponentTypes.length=0,this.queries.length=0,this._components={}}remove(e){return this._world.removeEntity(this,e)}}class ObjectPool{constructor(e,t){this.freeList=[],this.count=0,this.T=e,this.isObjectPool=!0;var r=null;arguments.length>1&&(r=Array.prototype.slice.call(arguments)).shift(),this.createElement=r?()=>new e(...r):()=>new e,void 0!==t&&this.expand(t)}aquire(){return this.freeList.length<=0&&this.expand(Math.round(.2*this.count)+1),this.freeList.pop()}release(e){e.reset(),this.freeList.push(e)}expand(e){for(var t=0;t<e;t++)this.freeList.push(this.createElement());this.count+=e}totalSize(){return this.count}totalFree(){return this.freeList.length}totalUsed(){return this.count-this.freeList.length}}class QueryManager{constructor(e){this._world=e,this._queries={}}onEntityRemoved(e){for(var t in this._queries){var r=this._queries[t];-1!==e.queries.indexOf(r)&&r.removeEntity(e)}}onEntityComponentAdded(e,t){for(var r in this._queries){var n=this._queries[r];~n.NotComponents.indexOf(t)&&~n.entities.indexOf(e)?n.removeEntity(e):~n.Components.indexOf(t)&&n.match(e)&&!~n.entities.indexOf(e)&&n.addEntity(e)}}onEntityComponentRemoved(e,t){for(var r in this._queries){var n=this._queries[r];~n.NotComponents.indexOf(t)&&!~n.entities.indexOf(e)&&n.match(e)?n.addEntity(e):~n.Components.indexOf(t)&&~n.entities.indexOf(e)&&!n.match(e)&&n.removeEntity(e)}}getQuery(e){var t=queryKey(e),r=this._queries[t];return r||(this._queries[t]=r=new Query(e,this._world)),r}stats(){var e={};for(var t in this._queries)e[t]=this._queries[t].stats();return e}}class SystemStateComponent{}SystemStateComponent.isSystemStateComponent=!0;class EntityManager{constructor(e){this.world=e,this.componentsManager=e.componentsManager,this._entities=[],this._queryManager=new QueryManager(this),this.eventDispatcher=new EventDispatcher,this._entityPool=new ObjectPool(Entity),this.entitiesWithComponentsToRemove=[],this.entitiesToRemove=[],this.deferredRemovalEnabled=!0,this.numStateComponents=0}createEntity(){var e=this._entityPool.aquire();return e.alive=!0,e._world=this,this._entities.push(e),this.eventDispatcher.dispatchEvent(ENTITY_CREATED,e),e}entityAddComponent(e,t,r){if(!~e._ComponentTypes.indexOf(t)){e._ComponentTypes.push(t),t.__proto__===SystemStateComponent&&this.numStateComponents++;var n=this.world.componentsManager.getComponentsPool(t).aquire();if(e._components[t.name]=n,r)if(n.copy)n.copy(r);else for(var i in r)n[i]=r[i];this._queryManager.onEntityComponentAdded(e,t),this.world.componentsManager.componentAddedToEntity(t),this.eventDispatcher.dispatchEvent(COMPONENT_ADDED,e,t)}}entityRemoveComponent(e,t,r){var n=e._ComponentTypes.indexOf(t);if(~n){if(this.eventDispatcher.dispatchEvent(COMPONENT_REMOVE,e,t),r)this._entityRemoveComponentSync(e,t,n);else{0===e._ComponentTypesToRemove.length&&this.entitiesWithComponentsToRemove.push(e),e._ComponentTypes.splice(n,1),e._ComponentTypesToRemove.push(t);var i=getName(t);e._componentsToRemove[i]=e._components[i],delete e._components[i]}this._queryManager.onEntityComponentRemoved(e,t),t.__proto__===SystemStateComponent&&(this.numStateComponents--,0!==this.numStateComponents||e.alive||e.remove())}}_entityRemoveComponentSync(e,t,r){e._ComponentTypes.splice(r,1);var n=componentPropertyName(t),i=getName(t),a=e._components[i];delete e._components[i],this.componentsManager._componentPool[n].release(a),this.world.componentsManager.componentRemovedFromEntity(t)}entityRemoveAllComponents(e,t){let r=e._ComponentTypes;for(let n=r.length-1;n>=0;n--)r[n].__proto__!==SystemStateComponent&&this.entityRemoveComponent(e,r[n],t)}removeEntity(e,t){var r=this._entities.indexOf(e);if(!~r)throw new Error("Tried to remove entity not in list");e.alive=!1,0===this.numStateComponents&&(this.eventDispatcher.dispatchEvent(ENTITY_REMOVED,e),this._queryManager.onEntityRemoved(e),!0===t?this._releaseEntity(e,r):this.entitiesToRemove.push(e)),this.entityRemoveAllComponents(e,t)}_releaseEntity(e,t){this._entities.splice(t,1),e._world=null,this._entityPool.release(e)}removeAllEntities(){for(var e=this._entities.length-1;e>=0;e--)this.removeEntity(this._entities[e])}processDeferredRemoval(){if(this.deferredRemovalEnabled){for(let e=0;e<this.entitiesToRemove.length;e++){let t=this.entitiesToRemove[e],r=this._entities.indexOf(t);this._releaseEntity(t,r)}this.entitiesToRemove.length=0;for(let n=0;n<this.entitiesWithComponentsToRemove.length;n++){let i=this.entitiesWithComponentsToRemove[n];for(;i._ComponentTypesToRemove.length>0;){let n=i._ComponentTypesToRemove.pop();var e=componentPropertyName(n),t=getName(n),r=i._componentsToRemove[t];delete i._componentsToRemove[t],this.componentsManager._componentPool[e].release(r),this.world.componentsManager.componentRemovedFromEntity(n)}}this.entitiesWithComponentsToRemove.length=0}}queryComponents(e){return this._queryManager.getQuery(e)}count(){return this._entities.length}stats(){var e={numEntities:this._entities.length,numQueries:Object.keys(this._queryManager._queries).length,queries:this._queryManager.stats(),numComponentPool:Object.keys(this.componentsManager._componentPool).length,componentPool:{},eventDispatcher:this.eventDispatcher.stats};for(var t in this.componentsManager._componentPool){var r=this.componentsManager._componentPool[t];e.componentPool[t]={used:r.totalUsed(),size:r.count}}return e}}const ENTITY_CREATED="EntityManager#ENTITY_CREATE",ENTITY_REMOVED="EntityManager#ENTITY_REMOVED",COMPONENT_ADDED="EntityManager#COMPONENT_ADDED",COMPONENT_REMOVE="EntityManager#COMPONENT_REMOVE";class DummyObjectPool{constructor(e){this.isDummyObjectPool=!0,this.count=0,this.used=0,this.T=e}aquire(){return this.used++,this.count++,new this.T}release(){this.used--}totalSize(){return this.count}totalFree(){return 1/0}totalUsed(){return this.used}}class ComponentManager{constructor(){this.Components={},this._componentPool={},this.numComponents={}}registerComponent(e){this.Components[e.name]?console.warn(`Component type: '${e.name}' already registered.`):(this.Components[e.name]=e,this.numComponents[e.name]=0)}componentAddedToEntity(e){this.Components[e.name]||this.registerComponent(e),this.numComponents[e.name]++}componentRemovedFromEntity(e){this.numComponents[e.name]--}getComponentsPool(e){var t=componentPropertyName(e);return this._componentPool[t]||(e.prototype.reset?this._componentPool[t]=new ObjectPool(e):(console.warn(`Component '${e.name}' won't benefit from pooling because 'reset' method was not implemeneted.`),this._componentPool[t]=new DummyObjectPool(e))),this._componentPool[t]}}var name="ecsy",version="0.2.2",description="Entity Component System in JS",main="build/ecsy.js",module="build/ecsy.module.js",types="src/index.d.ts",scripts={build:"rollup -c && npm run docs",docs:"rm docs/api/_sidebar.md; typedoc --readme none --mode file --excludeExternals --plugin typedoc-plugin-markdown --theme docs/theme --hideSources --hideBreadcrumbs --out docs/api/ --includeDeclarations --includes 'src/**/*.d.ts' src; touch docs/api/_sidebar.md","dev:docs":"nodemon -e ts -x 'npm run docs' -w src",dev:"concurrently --names 'ROLLUP,DOCS,HTTP' -c 'bgBlue.bold,bgYellow.bold,bgGreen.bold' 'rollup -c -w -m inline' 'npm run dev:docs' 'npm run dev:server'","dev:server":"http-server -c-1 -p 8080 --cors",lint:"eslint src test examples",start:"npm run dev",test:"ava",travis:"npm run lint && npm run test && npm run build","watch:test":"ava --watch"},repository={type:"git",url:"git+https://github.com/fernandojsg/ecsy.git"},keywords=["ecs","entity component system"],author="Fernando Serrano <[email protected]> (http://fernandojsg.com)",license="MIT",bugs={url:"https://github.com/fernandojsg/ecsy/issues"},ava={files:["test/**/*.test.js"],sources:["src/**/*.js"],require:["babel-register","esm"]},jspm={files:["package.json","LICENSE","README.md","build/ecsy.js","build/ecsy.min.js","build/ecsy.module.js"],directories:{}},homepage="https://github.com/fernandojsg/ecsy#readme",devDependencies={ava:"^1.4.1","babel-cli":"^6.26.0","babel-core":"^6.26.3","babel-eslint":"^10.0.3","babel-loader":"^8.0.6",concurrently:"^4.1.2","docsify-cli":"^4.4.0",eslint:"^5.16.0","eslint-config-prettier":"^4.3.0","eslint-plugin-prettier":"^3.1.2","http-server":"^0.11.1",nodemon:"^1.19.4",prettier:"^1.19.1",rollup:"^1.29.0","rollup-plugin-json":"^4.0.0","rollup-plugin-terser":"^5.2.0",typedoc:"^0.15.8","typedoc-plugin-markdown":"^2.2.16",typescript:"^3.7.5"},pjson={name:name,version:version,description:description,main:main,"jsnext:main":"build/ecsy.module.js",module:module,types:types,scripts:scripts,repository:repository,keywords:keywords,author:author,license:license,bugs:bugs,ava:ava,jspm:jspm,homepage:homepage,devDependencies:devDependencies};const Version=pjson.version;class World{constructor(){if(this.componentsManager=new ComponentManager(this),this.entityManager=new EntityManager(this),this.systemManager=new SystemManager(this),this.enabled=!0,this.eventQueues={},"undefined"!=typeof CustomEvent){var e=new CustomEvent("ecsy-world-created",{detail:{world:this,version:Version}});window.dispatchEvent(e)}this.lastTime=performance.now()}registerComponent(e){return this.componentsManager.registerComponent(e),this}registerSystem(e,t){return this.systemManager.registerSystem(e,t),this}getSystem(e){return this.systemManager.getSystem(e)}getSystems(){return this.systemManager.getSystems()}execute(e,t){if(!e){let t=performance.now();e=t-this.lastTime,this.lastTime=t}this.enabled&&(this.systemManager.execute(e,t),this.entityManager.processDeferredRemoval())}stop(){this.enabled=!1}play(){this.enabled=!0}createEntity(){return this.entityManager.createEntity()}stats(){var e={entities:this.entityManager.stats(),system:this.systemManager.stats()};console.log(JSON.stringify(e,null,2))}}class System{canExecute(){if(0===this._mandatoryQueries.length)return!0;for(let e=0;e<this._mandatoryQueries.length;e++){if(0===this._mandatoryQueries[e].entities.length)return!1}return!0}constructor(e,t){if(this.world=e,this.enabled=!0,this._queries={},this.queries={},this.priority=0,this.executeTime=0,t&&t.priority&&(this.priority=t.priority),this._mandatoryQueries=[],this.initialized=!0,this.constructor.queries)for(var r in this.constructor.queries){var n=this.constructor.queries[r],i=n.components;if(!i||0===i.length)throw new Error("'components' attribute can't be empty in a query");var a=this.world.entityManager.queryComponents(i);this._queries[r]=a,!0===n.mandatory&&this._mandatoryQueries.push(a),this.queries[r]={results:a.entities};const e={added:Query.prototype.ENTITY_ADDED,removed:Query.prototype.ENTITY_REMOVED,changed:Query.prototype.COMPONENT_CHANGED};n.listen&&["added","removed","changed"].forEach(t=>{if(n.listen[t]){let i=n.listen[t];if("changed"===t){if(a.reactive=!0,!0===i){let e=this.queries[r][t]=[];a.eventDispatcher.addEventListener(Query.prototype.COMPONENT_CHANGED,t=>{-1===e.indexOf(t)&&e.push(t)})}else if(Array.isArray(i)){let e=this.queries[r][t]=[];a.eventDispatcher.addEventListener(Query.prototype.COMPONENT_CHANGED,(t,r)=>{-1!==i.indexOf(r.constructor)&&-1===e.indexOf(t)&&e.push(t)})}}else{let n=this.queries[r][t]=[];a.eventDispatcher.addEventListener(e[t],e=>{-1===n.indexOf(e)&&n.push(e)})}}})}}stop(){this.executeTime=0,this.enabled=!1}play(){this.enabled=!0}clearEvents(){for(let t in this.queries){var e=this.queries[t];if(e.added&&(e.added.length=0),e.removed&&(e.removed.length=0),e.changed)if(Array.isArray(e.changed))e.changed.length=0;else for(let t in e.changed)e.changed[t].length=0}}toJSON(){var e={name:this.constructor.name,enabled:this.enabled,executeTime:this.executeTime,priority:this.priority,queries:{}};if(this.constructor.queries){var t=this.constructor.queries;for(let r in t){let n=this.queries[r],i=t[r],a=e.queries[r]={key:this._queries[r].key};if(a.mandatory=!0===i.mandatory,a.reactive=i.listen&&(!0===i.listen.added||!0===i.listen.removed||!0===i.listen.changed||Array.isArray(i.listen.changed)),a.reactive){a.listen={},["added","removed","changed"].forEach(e=>{n[e]&&(a.listen[e]={entities:n[e].length})})}}}return e}}function Not(e){return{operator:"not",Component:e}}class Component{}Component.isComponent=!0;class TagComponent{reset(){}}function createType(e){var t=["create","reset","clear"].filter(t=>!e[t]);if(t.length>0)throw new Error(`createType expect type definition to implements the following functions: ${t.join(", ")}`);return e.isType=!0,e}TagComponent.isTagComponent=!0;var Types={};Types.Number=createType({baseType:Number,isSimpleType:!0,create:e=>void 0!==e?e:0,reset:(e,t,r)=>{e[t]=void 0!==r?r:0},clear:(e,t)=>{e[t]=0}}),Types.Boolean=createType({baseType:Boolean,isSimpleType:!0,create:e=>void 0!==e&&e,reset:(e,t,r)=>{e[t]=void 0!==r&&r},clear:(e,t)=>{e[t]=!1}}),Types.String=createType({baseType:String,isSimpleType:!0,create:e=>void 0!==e?e:"",reset:(e,t,r)=>{e[t]=void 0!==r?r:""},clear:(e,t)=>{e[t]=""}}),Types.Array=createType({baseType:Array,create:e=>void 0!==e?e.slice():[],reset:(e,t,r)=>{void 0!==r?e[t]=r.slice():e[t].length=0},clear:(e,t)=>{e[t].length=0},copy:(e,t,r)=>{e[r]=t[r].slice()}});var standardTypes={number:Types.Number,boolean:Types.Boolean,string:Types.String};function inferType(e){return Array.isArray(e)?Types.Array:standardTypes[typeof e]?standardTypes[typeof e]:null}function createComponentClass(e,t){for(let t in e){e[t].type||(e[t].type=inferType(e[t].default))}var r=function(){for(let r in e){var t=e[r];let n=t.type;n&&n.isType?this[r]=n.create(t.default):this[r]=t.default}};void 0!==t&&Object.defineProperty(r,"name",{value:t}),r.prototype.schema=e;var n=!0;for(let t in e){var i=e[t];i.type||(i.type=inferType(i.default)),i.type||(console.warn(`Unknown type definition for attribute '${t}'`),n=!1)}if(n){r.prototype.copy=function(t){for(let r in e)if(t[r]){let n=e[r].type;n.isSimpleType?this[r]=t[r]:n.copy?n.copy(this,t,r):console.warn(`Unknown copy function for attribute '${r}' data type`)}},r.prototype.reset=function(){for(let t in e){let r=e[t],n=r.type;n.reset&&n.reset(this,t,r.default)}},r.prototype.clear=function(){for(let t in e){let r=e[t].type;r.clear&&r.clear(this,t)}};for(let t in e){let n=e[t],i=n.type;r.prototype[t]=n.default,i.reset&&i.reset(r.prototype,t,n.default)}}else for(var a in console.warn("This component can't use pooling because some data types are not registered. Please provide a type created with 'createType'"),e){let t=e[a];r.prototype[a]=t.default}return r}function generateId(e){for(var t="",r="ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789",n=r.length,i=0;i<e;i++)t+=r.charAt(Math.floor(Math.random()*n));return t}function injectScript(e,t){var r=document.createElement("script");r.src=e,r.onload=t,(document.head||document.documentElement).appendChild(r)}function hookConsoleAndErrors(e){["error","warning","log"].forEach(t=>{if("function"==typeof console[t]){var r=console[t].bind(console);console[t]=(...n)=>(e.send({method:"console",type:t,args:JSON.stringify(n)}),r.apply(null,n))}}),window.addEventListener("error",t=>{e.send({method:"error",error:JSON.stringify({message:t.error.message,stack:t.error.stack})})})}function includeRemoteIdHTML(e){let t=document.createElement("div");return t.style.cssText="\n align-items: center;\n background-color: #333;\n color: #aaa;\n display:flex;\n font-family: Arial;\n font-size: 1.1em;\n height: 40px;\n justify-content: center;\n left: 0;\n opacity: 0.9;\n position: absolute;\n right: 0;\n text-align: center;\n top: 0;\n ",t.innerHTML=`Open ECSY devtools to connect to this page using the code: <b style="color: #fff">${e}</b> <button onClick="generateNewCode()">Generate new code</button>`,document.body.appendChild(t),t}function enableRemoteDevtools(remoteId){window.generateNewCode=()=>{window.localStorage.clear(),remoteId=generateId(6),window.localStorage.setItem("ecsyRemoteId",remoteId),window.location.reload(!1)},remoteId=remoteId||window.localStorage.getItem("ecsyRemoteId"),remoteId||(remoteId=generateId(6),window.localStorage.setItem("ecsyRemoteId",remoteId));let infoDiv=includeRemoteIdHTML(remoteId);window.__ECSY_REMOTE_DEVTOOLS_INJECTED=!0,window.__ECSY_REMOTE_DEVTOOLS={};let Version="",worldsBeforeLoading=[],onWorldCreated=e=>{var t=e.detail.world;Version=e.detail.version,worldsBeforeLoading.push(t)};window.addEventListener("ecsy-world-created",onWorldCreated);let onLoaded=()=>{var peer=new Peer(remoteId);peer.on("open",()=>{peer.on("connection",connection=>{window.__ECSY_REMOTE_DEVTOOLS.connection=connection,connection.on("open",(function(){infoDiv.innerHTML="Connected",connection.on("data",(function(data){if("init"===data.type){var script=document.createElement("script");script.setAttribute("type","text/javascript"),script.onload=()=>{script.parentNode.removeChild(script),window.removeEventListener("ecsy-world-created",onWorldCreated),worldsBeforeLoading.forEach(e=>{var t=new CustomEvent("ecsy-world-created",{detail:{world:e,version:Version}});window.dispatchEvent(t)})},script.innerHTML=data.script,(document.head||document.documentElement).appendChild(script),script.onload(),hookConsoleAndErrors(connection)}else if("executeScript"===data.type){let value=eval(data.script);data.returnEval&&connection.send({method:"evalReturn",value:value})}}))}))})})};injectScript("https://cdn.jsdelivr.net/npm/[email protected]/dist/peer.min.js",onLoaded)}const urlParams=new URLSearchParams(window.location.search);urlParams.has("enable-remote-devtools")&&enableRemoteDevtools()},function(e,t,r){!function(e){"use strict";var t="function"==typeof Promise?function(){var e,t,r=new Promise((function(r,n){e=r,t=n}));return{then:r.then.bind(r),resolve:e,reject:t}}:function e(){var t,r=0,n=[],i=0,a=0,o=p((function(e){a||l(1,e)})),s=p((function(e){a||l(-1,e)}));function l(e,n){a++;var i=0;try{n===v&&f();var o=e>0&&d(n);o?o.call(n,p((function(e){i++,l(1,e)})),p((function(e){i++,l(-1,e)}))):(r=e,t=n,c())}catch(e){r||i||l(-1,e)}}function c(){i||(setTimeout(u,0),i=1)}function u(){var e=n;i=0,n=[],e.forEach(h)}function h(e){e()}function d(e){var t=e&&(m(e)||"object"==typeof e)&&e.then;return m(t)&&t}function p(e){var t=0;return function(){for(var r=[],n=arguments.length;n--;)r[n]=arguments[n];t++||e.apply(this,r)}}function f(){throw new TypeError("Chaining cycle detected")}var m=function(e){return"function"==typeof e},v={then:function(i,a){var o=e();return n.push((function(){var e=r>0?i:a;if(m(e))try{var n=e(t);n===o&&f();var s=d(n);s?s.call(n,o.resolve,o.reject):o.resolve(n)}catch(e){o.reject(e)}else o[r>0?"resolve":"reject"](t)})),r&&c(),o},resolve:o,reject:s};return v},r=0,n=0,i=Object.create(null),a=Object.create(null);function o(e){if(!e||"function"!=typeof e.init)throw new Error("requires `options.init` function");var t=e.dependencies,n=e.init,i=e.getTransferables,a=e.workerId;null==a&&(a="#default");var l="workerModule"+ ++r,u=null;function h(){for(var e=[],t=arguments.length;t--;)e[t]=arguments[t];return u||(u=c(a,"registerModule",h.workerModuleData)),u.then((function(t){if(t.isCallable)return c(a,"callModule",{id:l,args:e});throw new Error("Worker module function was called but `init` did not return a callable function")}))}return t=t&&t.map((function(e){return"function"!=typeof e||e.workerModuleData||(e=o({workerId:a,init:new Function("return function(){return ("+s(e)+")}")()})),e&&e.workerModuleData&&(e=e.workerModuleData),e})),h.workerModuleData={isWorkerModule:!0,id:l,dependencies:t,init:s(n),getTransferables:i&&s(i)},h}function s(e){var t=e.toString();return!/^function/.test(t)&&/^\w+\s*\(/.test(t)&&(t="function "+t),t}function l(e){var t=i[e];if(!t){var r=function(){var e=Object.create(null);self.addEventListener("message",(function(t){var r=t.data,n=r.messageId,i=r.action,a=r.data;try{"registerModule"===i&&function t(r,n){var i=r.id,a=r.dependencies;void 0===a&&(a=[]);var o=r.init;void 0===o&&(o=function(){});var s=r.getTransferables;if(void 0===s&&(s=null),!e[i])try{a=a.map((function(r){return r&&r.isWorkerModule&&(t(r,(function(e){if(e instanceof Error)throw e})),r=e[r.id].value),r})),o=new Function("return ("+o+")")(),s&&(s=new Function("return ("+s+")")());var l=o.apply(void 0,a);e[i]={id:i,value:l,getTransferables:s},n(l)}catch(e){e&&e.noLog||console.error(e),n(e)}}(a,(function(e){e instanceof Error?postMessage({messageId:n,success:!1,error:e.message}):postMessage({messageId:n,success:!0,result:{isCallable:"function"==typeof e}})})),"callModule"===i&&function(t,r){var n,i=t.id,a=t.args;e[i]&&"function"==typeof e[i].value||r(new Error("Worker module "+i+": not found or its 'init' did not return a function"));try{var o=(n=e[i]).value.apply(n,a);o&&"function"==typeof o.then?o.then(s,(function(e){return r(e instanceof Error?e:new Error(""+e))})):s(o)}catch(e){r(e)}function s(t){try{var n=e[i].getTransferables&&e[i].getTransferables(t);n&&Array.isArray(n)&&n.length||(n=void 0),r(t,n)}catch(e){console.error(e),r(e)}}}(a,(function(e,t){e instanceof Error?postMessage({messageId:n,success:!1,error:e.message}):postMessage({messageId:n,success:!0,result:e},t||void 0)}))}catch(e){postMessage({messageId:n,success:!1,error:e.stack})}}))}.toString();(t=i[e]=new Worker(URL.createObjectURL(new Blob([";("+r+")()"],{type:"application/javascript"})))).onmessage=function(e){var t=e.data,r=t.messageId,n=a[r];if(!n)throw new Error("WorkerModule response with empty or unknown messageId");delete a[r],a.count--,n(t)}}return t}function c(e,r,i){var o=t(),s=++n;return a[s]=function(e){e.success?o.resolve(e.result):o.reject(new Error("Error in worker "+r+" call: "+e.error))},a._count++,a.count>1e3&&console.warn("Large number of open WorkerModule requests, some may not be returning"),l(e).postMessage({messageId:s,action:r,data:i}),o}a._count=0;var u=o({dependencies:[t],init:function(e){return e}});e.Thenable=t,e.ThenableWorkerModule=u,e.defineWorkerModule=o,Object.defineProperty(e,"__esModule",{value:!0})}(t)},function(e,t,r){!function(e,t){"use strict";var r=/\bvoid\s+main\s*\(\s*\)\s*{/g;function n(e){return e.replace(/^[ \t]*#include +<([\w\d./]+)>/gm,(function(e,r){var i=t.ShaderChunk[r];return i?n(i):e}))}var i=Object.assign||function(){for(var e=arguments,t=arguments[0],r=1,n=arguments.length;r<n;r++){var i=e[r];if(i)for(var a in i)i.hasOwnProperty(a)&&(t[a]=i[a])}return t},a=0,o=Date.now(),s=new WeakMap;function l(e,u){var h=function(e){return JSON.stringify(e,c)}(u),d=s.get(e);if(d||(d=Object.create(null),s.set(e,d)),d[h])return d[h].clone();var p,f,m=++a,v="_derivedShaders"+m,g="_onBeforeCompile"+m;function y(t){e.onBeforeCompile.call(this,t);var a=this[v]||(this[v]={vertex:{},fragment:{}}),s=a.vertex,l=a.fragment;if(s.source!==t.vertexShader||l.source!==t.fragmentShader){var c=function(e,t,i){var a=e.vertexShader,o=e.fragmentShader,s=t.vertexDefs,l=t.vertexMainIntro,c=t.vertexTransform,u=t.fragmentDefs,h=t.fragmentMainIntro,d=t.fragmentColorTransform,p=t.timeUniform;if(p){var f="\nuniform float "+p+";\n";s=(s||"")+f,u=(u||"")+f}return(s||l||c)&&(c&&(a=n(a),s=(s||"")+"\nvoid troikaVertexTransform"+i+"(inout vec3 position, inout vec3 normal, inout vec2 uv) {\n "+c+"\n}\n",a=a.replace(/\b(position|normal|uv)\b/g,(function(e,t,r,n){return/\battribute\s+vec[23]\s+$/.test(n.substr(0,r))?t:"troika_"+t+"_"+i})),l="\nvec3 troika_position_"+i+" = vec3(position);\nvec3 troika_normal_"+i+" = vec3(normal);\nvec2 troika_uv_"+i+" = vec2(uv);\ntroikaVertexTransform"+i+"(troika_position_"+i+", troika_normal_"+i+", troika_uv_"+i+");\n"+(l||"")+"\n"),a=a.replace(r,(s||"")+"\n\n$&\n\n"+(l||""))),(u||h||d)&&(o=(o=n(o)).replace(r,"\n"+(u||"")+"\nvoid troikaOrigMain"+i+"() {\n"+(h||"")+"\n"),o+="\nvoid main() {\n troikaOrigMain"+i+"();\n "+(d||"")+"\n}"),{vertexShader:a,fragmentShader:o}}(t,u,m);s.source=t.vertexShader,s.result=c.vertexShader,l.source=t.fragmentShader,l.result=c.fragmentShader}t.vertexShader=s.result,t.fragmentShader=l.result,i(t.uniforms,this.uniforms),u.timeUniform&&(t.uniforms[u.timeUniform]={get value(){return Date.now()-o}}),this[g]&&this[g](t)}function x(){e.constructor.apply(this,arguments),this._listeners=void 0}x.prototype=Object.create(e,{constructor:{value:x},isDerivedMaterial:{value:!0},baseMaterial:{value:e},onBeforeCompile:{get:function(){return y},set:function(e){this[g]=e}},copy:{value:function(r){return e.copy.call(this,r),e.isShaderMaterial||e.isDerivedMaterial||(this.extensions=i({},r.extensions),this.defines=i({},r.defines),this.uniforms=t.UniformsUtils.clone(r.uniforms)),this}},getDepthMaterial:{value:function(){var r=this._depthMaterial;return r||(f||((f=l(e.isDerivedMaterial?e.getDepthMaterial():new t.MeshDepthMaterial({depthPacking:t.RGBADepthPacking}),u)).defines.IS_DEPTH_MATERIAL=""),r=this._depthMaterial=f.clone()),r}},getDistanceMaterial:{value:function(){var r=this._distanceMaterial;return r||(p||((p=l(e.isDerivedMaterial?e.getDistanceMaterial():new t.MeshDistanceMaterial,u)).defines.IS_DISTANCE_MATERIAL=""),r=this._distanceMaterial=p.clone()),r}},dispose:{value:function(){var t=this._depthMaterial,r=this._distanceMaterial;t&&t.dispose(),r&&r.dispose(),e.dispose.call(this)}}});var b=new x;return b.copy(e),b.uniforms=i(t.UniformsUtils.clone(e.uniforms||{}),u.uniforms),b.defines=i({},e.defines,u.defines),b.defines.TROIKA_DERIVED_MATERIAL=m,b.extensions=i({},e.extensions,u.extensions),d[h]=b,b.clone()}function c(e,t){return"uniforms"===e?void 0:t}var u={MeshDepthMaterial:"depth",MeshDistanceMaterial:"distanceRGBA",MeshNormalMaterial:"normal",MeshBasicMaterial:"basic",MeshLambertMaterial:"lambert",MeshPhongMaterial:"phong",MeshToonMaterial:"phong",MeshStandardMaterial:"physical",MeshPhysicalMaterial:"physical",MeshMatcapMaterial:"matcap",LineBasicMaterial:"basic",LineDashedMaterial:"dashed",PointsMaterial:"points",ShadowMaterial:"shadow",SpriteMaterial:"sprite"},h=function(e){this.name=e,this.textureUniform="dataTex_"+e,this.textureSizeUniform="dataTexSize_"+e,this.multiplierUniform="dataMultiplier_"+e,this.dataSizeUniform="dataSize_"+e,this.readFunction="readData_"+e,this._raw=new Float32Array(0),this._texture=new t.DataTexture(new Uint8Array(0),0,1),this._length=0,this._multiplier=1},d={length:{configurable:!0}};function p(e,t,r){var n=255*e,i=n%1*255,a=i%1*255,o=a%1*255;return n&=255,i&=255,a&=255,o=255&Math.round(o),t[r]=n,t[r+1]=i,t[r+2]=a,t[r+3]=o,t}d.length.set=function(e){if(e!==this._length){var t=Math.pow(2,Math.ceil(Math.log2(e))),r=this._raw;t<r.length?this._raw=r.subarray(0,t):t>r.length&&(this._raw=new Float32Array(t),this._raw.set(r)),this._length=e}},d.length.get=function(){return this._length},h.prototype.push=function(e){return this.set(this.length++,e)},h.prototype.setArray=function(e){this.length=e.length,this._raw.set(e),this._needsRepack=!0},h.prototype.get=function(e){return this._raw[e]},h.prototype.set=function(e,t){e+1>this._length&&(this.length=e+1),t!==this._raw[e]&&(this._raw[e]=t,p(t/this._multiplier,this._texture.image.data,4*e),this._needsMultCheck=!0)},h.prototype.clone=function(){var e=new h(this.name);return e.setArray(this._raw),e},h.prototype.getShaderUniforms=function(){var e,t=this;return(e={})[this.textureUniform]={get value(){return t._sync(),t._texture}},e[this.textureSizeUniform]={get value(){return t._sync(),t._texture.image.width}},e[this.dataSizeUniform]={get value(){return t._sync(),t.length}},e[this.multiplierUniform]={get value(){return t._sync(),t._multiplier}},e},h.prototype.getShaderHeaderCode=function(){var e=this.textureUniform,t=this.textureSizeUniform,r=this.dataSizeUniform,n=this.multiplierUniform;return"\nuniform sampler2D "+e+";\nuniform float "+t+";\nuniform float "+r+";\nuniform float "+n+";\n\nfloat "+this.readFunction+"(float index) {\n vec2 texUV = vec2((index + 0.5) / "+t+", 0.5);\n vec4 pixel = texture2D("+e+", texUV);\n return dot(pixel, 1.0 / vec4(1.0, 255.0, 65025.0, 16581375.0)) * "+n+";\n}\n"},h.prototype._sync=function(){var e=this._texture,t=this._raw,r=this._needsRepack;if(t.length!==e.image.width&&(e.image={data:new Uint8Array(4*t.length),width:t.length,height:1},r=!0),r||this._needsMultCheck){var n=this._raw.reduce((function(e,t){return Math.max(e,t)}),0),i=Math.pow(2,Math.ceil(Math.log2(n)));i!==this._multiplier&&(this._multiplier=i,r=!0),e.needsUpdate=!0,this._needsMultCheck=!1}if(r){for(var a=0,o=t.length,s=this._multiplier;a<o;a++)p(t[a]/s,e.image.data,4*a);this._needsRepack=!1}},Object.defineProperties(h.prototype,d);var f="\nuniform vec3 pointA;\nuniform vec3 controlA;\nuniform vec3 controlB;\nuniform vec3 pointB;\nuniform float radius;\nvarying float bezierT;\n\nvec3 cubicBezier(vec3 p1, vec3 c1, vec3 c2, vec3 p2, float t) {\n float t2 = 1.0 - t;\n float b0 = t2 * t2 * t2;\n float b1 = 3.0 * t * t2 * t2;\n float b2 = 3.0 * t * t * t2;\n float b3 = t * t * t;\n return b0 * p1 + b1 * c1 + b2 * c2 + b3 * p2;\n}\n\nvec3 cubicBezierDerivative(vec3 p1, vec3 c1, vec3 c2, vec3 p2, float t) {\n float t2 = 1.0 - t;\n return -3.0 * p1 * t2 * t2 +\n c1 * (3.0 * t2 * t2 - 6.0 * t2 * t) +\n c2 * (6.0 * t2 * t - 3.0 * t * t) +\n 3.0 * p2 * t * t;\n}\n",m='\nfloat t = position.y;\nbezierT = t;\nvec3 bezierCenterPos = cubicBezier(pointA, controlA, controlB, pointB, t);\nvec3 bezierDir = normalize(cubicBezierDerivative(pointA, controlA, controlB, pointB, t));\n\n// Make "sideways" always perpendicular to the camera ray; this ensures that any twists\n// in the cylinder occur where you won\'t see them: \nvec3 viewDirection = normalMatrix * vec3(0.0, 0.0, 1.0);\nif (bezierDir == viewDirection) {\n bezierDir = normalize(cubicBezierDerivative(pointA, controlA, controlB, pointB, t == 1.0 ? t - 0.0001 : t + 0.0001));\n}\nvec3 sideways = normalize(cross(bezierDir, viewDirection));\nvec3 upish = normalize(cross(sideways, bezierDir));\n\n// Build a matrix for transforming this disc in the cylinder:\nmat4 discTx;\ndiscTx[0].xyz = sideways * radius;\ndiscTx[1].xyz = bezierDir * radius;\ndiscTx[2].xyz = upish * radius;\ndiscTx[3].xyz = bezierCenterPos;\ndiscTx[3][3] = 1.0;\n\n// Apply transform, ignoring original y\nposition = (discTx * vec4(position.x, 0.0, position.z, 1.0)).xyz;\nnormal = normalize(mat3(discTx) * normal);\n',v="\nuniform vec3 dashing;\nvarying float bezierT;\n",g="\nif (dashing.x + dashing.y > 0.0) {\n float dashFrac = mod(bezierT - dashing.z, dashing.x + dashing.y);\n if (dashFrac > dashing.x) {\n discard;\n }\n}\n",y=null,x=new t.MeshStandardMaterial({color:16777215,side:t.DoubleSide}),b=function(e){function r(){e.call(this,y||(y=new t.CylinderBufferGeometry(1,1,1,6,64).translate(0,.5,0)),x),this.pointA=new t.Vector3,this.controlA=new t.Vector3,this.controlB=new t.Vector3,this.pointB=new t.Vector3,this.radius=.01,this.dashArray=new t.Vector2,this.dashOffset=0,this.frustumCulled=!1}e&&(r.__proto__=e),r.prototype=Object.create(e&&e.prototype),r.prototype.constructor=r;var n={material:{configurable:!0},customDepthMaterial:{configurable:!0},customDistanceMaterial:{configurable:!0}};return n.material.get=function(){var e=this._derivedMaterial,r=this._baseMaterial||x;return e&&e.baseMaterial===r||(e&&e.dispose(),e=this._derivedMaterial=function(e){return l(e,{uniforms:{pointA:{value:new t.Vector3},controlA:{value:new t.Vector3},controlB:{value:new t.Vector3},pointB:{value:new t.Vector3},radius:{value:.01},dashing:{value:new t.Vector3}},vertexDefs:f,vertexTransform:m,fragmentDefs:v,fragmentMainIntro:g})}(r),r.addEventListener("dispose",(function t(){r.removeEventListener("dispose",t),e.dispose()}))),e},n.material.set=function(e){this._baseMaterial=e},n.customDepthMaterial.get=function(){return this._updateBezierUniforms(this.material.getDepthMaterial())},n.customDistanceMaterial.get=function(){return this._updateBezierUniforms(this.material.getDistanceMaterial())},r.prototype.onBeforeRender=function(e){this._updateBezierUniforms(this.material)},r.prototype._updateBezierUniforms=function(e){var t=e.uniforms,r=this.pointA,n=this.controlA,i=this.controlB,a=this.pointB,o=this.radius,s=this.dashArray,l=this.dashOffset;return t.pointA.value.copy(r),t.controlA.value.copy(n),t.controlB.value.copy(i),t.pointB.value.copy(a),t.radius.value=o,t.dashing.value.set(s.x,s.y,l||0),e},r.prototype.raycast=function(e,t){},Object.defineProperties(r.prototype,n),r}(t.Mesh);e.BezierMesh=b,e.ShaderFloatArray=h,e.createDerivedMaterial=l,e.expandShaderIncludes=n,e.getShaderUniformTypes=function(e){for(var t,r=/\buniform\s+(int|float|vec[234])\s+([A-Za-z_][\w]*)/g,n=Object.create(null);null!==(t=r.exec(e));)n[t[2]]=t[1];return n},e.getShadersForMaterial=function(e){var r=u[e.type];return r?t.ShaderLib[r]:e},e.voidMainRegExp=r,Object.defineProperty(e,"__esModule",{value:!0})}(t,r(0))},function(e,t,r){"use strict";(function(e){
/**
* @license
* webxr-polyfill
* Copyright (c) 2017 Google
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/**
* @license
* cardboard-vr-display
* Copyright (c) 2015-2017 Google
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/**
* @license
* webvr-polyfill-dpdb
* Copyright (c) 2017 Google
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/**
* @license
* wglu-preserve-state
* Copyright (c) 2016, Brandon Jones.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
/**
* @license
* nosleep.js
* Copyright (c) 2017, Rich Tibbett
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
const r=void 0!==e?e:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},n=Symbol("@@webxr-polyfill/EventTarget");class i{constructor(){this[n]={listeners:new Map}}addEventListener(e,t){if("string"!=typeof e)throw new Error("`type` must be a string");if("function"!=typeof t)throw new Error("`listener` must be a function");const r=this[n].listeners.get(e)||[];r.push(t),this[n].listeners.set(e,r)}removeEventListener(e,t){if("string"!=typeof e)throw new Error("`type` must be a string");if("function"!=typeof t)throw new Error("`listener` must be a function");const r=this[n].listeners.get(e)||[];for(let e=r.length;e>=0;e--)r[e]===t&&r.pop()}dispatchEvent(e,t){const r=this[n].listeners.get(e)||[],i=[];for(let e=0;e<r.length;e++)i[e]=r[e];for(let e of i)e(t);"function"==typeof this[`on${e}`]&&this[`on${e}`](t)}}const a=1e-6;let o="undefined"!=typeof Float32Array?Float32Array:Array;Math.PI;function s(){let e=new o(16);return o!=Float32Array&&(e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[11]=0,e[12]=0,e[13]=0,e[14]=0),e[0]=1,e[5]=1,e[10]=1,e[15]=1,e}function l(e){return e[0]=1,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=1,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=1,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e}function c(e,t){let r=t[0],n=t[1],i=t[2],a=t[3],o=t[4],s=t[5],l=t[6],c=t[7],u=t[8],h=t[9],d=t[10],p=t[11],f=t[12],m=t[13],v=t[14],g=t[15],y=r*s-n*o,x=r*l-i*o,b=r*c-a*o,A=n*l-i*s,w=n*c-a*s,_=i*c-a*l,M=u*m-h*f,S=u*v-d*f,E=u*g-p*f,T=h*v-d*m,R=h*g-p*m,L=d*g-p*v,C=y*L-x*R+b*T+A*E-w*S+_*M;return C?(C=1/C,e[0]=(s*L-l*R+c*T)*C,e[1]=(i*R-n*L-a*T)*C,e[2]=(m*_-v*w+g*A)*C,e[3]=(d*w-h*_-p*A)*C,e[4]=(l*E-o*L-c*S)*C,e[5]=(r*L-i*E+a*S)*C,e[6]=(v*b-f*_-g*x)*C,e[7]=(u*_-d*b+p*x)*C,e[8]=(o*R-s*E+c*M)*C,e[9]=(n*E-r*R-a*M)*C,e[10]=(f*w-m*b+g*y)*C,e[11]=(h*b-u*w-p*y)*C,e[12]=(s*S-o*T-l*M)*C,e[13]=(r*T-n*S+i*M)*C,e[14]=(m*x-f*A-v*y)*C,e[15]=(u*A-h*x+d*y)*C,e):null}function u(e,t,r){let n=t[0],i=t[1],a=t[2],o=t[3],s=t[4],l=t[5],c=t[6],u=t[7],h=t[8],d=t[9],p=t[10],f=t[11],m=t[12],v=t[13],g=t[14],y=t[15],x=r[0],b=r[1],A=r[2],w=r[3];return e[0]=x*n+b*s+A*h+w*m,e[1]=x*i+b*l+A*d+w*v,e[2]=x*a+b*c+A*p+w*g,e[3]=x*o+b*u+A*f+w*y,x=r[4],b=r[5],A=r[6],w=r[7],e[4]=x*n+b*s+A*h+w*m,e[5]=x*i+b*l+A*d+w*v,e[6]=x*a+b*c+A*p+w*g,e[7]=x*o+b*u+A*f+w*y,x=r[8],b=r[9],A=r[10],w=r[11],e[8]=x*n+b*s+A*h+w*m,e[9]=x*i+b*l+A*d+w*v,e[10]=x*a+b*c+A*p+w*g,e[11]=x*o+b*u+A*f+w*y,x=r[12],b=r[13],A=r[14],w=r[15],e[12]=x*n+b*s+A*h+w*m,e[13]=x*i+b*l+A*d+w*v,e[14]=x*a+b*c+A*p+w*g,e[15]=x*o+b*u+A*f+w*y,e}function h(e,t,r){let n=t[0],i=t[1],a=t[2],o=t[3],s=n+n,l=i+i,c=a+a,u=n*s,h=n*l,d=n*c,p=i*l,f=i*c,m=a*c,v=o*s,g=o*l,y=o*c;return e[0]=1-(p+m),e[1]=h+y,e[2]=d-g,e[3]=0,e[4]=h-y,e[5]=1-(u+m),e[6]=f+v,e[7]=0,e[8]=d+g,e[9]=f-v,e[10]=1-(u+p),e[11]=0,e[12]=r[0],e[13]=r[1],e[14]=r[2],e[15]=1,e}function d(e,t){return e[0]=t[12],e[1]=t[13],e[2]=t[14],e}function p(e,t){let r=t[0]+t[5]+t[10],n=0;return r>0?(n=2*Math.sqrt(r+1),e[3]=.25*n,e[0]=(t[6]-t[9])/n,e[1]=(t[8]-t[2])/n,e[2]=(t[1]-t[4])/n):t[0]>t[5]&&t[0]>t[10]?(n=2*Math.sqrt(1+t[0]-t[5]-t[10]),e[3]=(t[6]-t[9])/n,e[0]=.25*n,e[1]=(t[1]+t[4])/n,e[2]=(t[8]+t[2])/n):t[5]>t[10]?(n=2*Math.sqrt(1+t[5]-t[0]-t[10]),e[3]=(t[8]-t[2])/n,e[0]=(t[1]+t[4])/n,e[1]=.25*n,e[2]=(t[6]+t[9])/n):(n=2*Math.sqrt(1+t[10]-t[0]-t[5]),e[3]=(t[1]-t[4])/n,e[0]=(t[8]+t[2])/n,e[1]=(t[6]+t[9])/n,e[2]=.25*n),e}function f(e,t,r,n,i){let a,o=1/Math.tan(t/2);return e[0]=o/r,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=o,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[11]=-1,e[12]=0,e[13]=0,e[15]=0,null!=i&&i!==1/0?(a=1/(n-i),e[10]=(i+n)*a,e[14]=2*i*n*a):(e[10]=-1,e[14]=-2*n),e}function m(){let e=new o(3);return o!=Float32Array&&(e[0]=0,e[1]=0,e[2]=0),e}function v(e){var t=new o(3);return t[0]=e[0],t[1]=e[1],t[2]=e[2],t}function g(e,t,r){let n=new o(3);return n[0]=e,n[1]=t,n[2]=r,n}function y(e,t){return e[0]=t[0],e[1]=t[1],e[2]=t[2],e}function x(e,t,r){return e[0]=t[0]+r[0],e[1]=t[1]+r[1],e[2]=t[2]+r[2],e}function b(e,t,r){return e[0]=t[0]*r,e[1]=t[1]*r,e[2]=t[2]*r,e}function A(e,t){let r=t[0],n=t[1],i=t[2],a=r*r+n*n+i*i;return a>0&&(a=1/Math.sqrt(a),e[0]=t[0]*a,e[1]=t[1]*a,e[2]=t[2]*a),e}function w(e,t){return e[0]*t[0]+e[1]*t[1]+e[2]*t[2]}function _(e,t,r){let n=t[0],i=t[1],a=t[2],o=r[0],s=r[1],l=r[2];return e[0]=i*l-a*s,e[1]=a*o-n*l,e[2]=n*s-i*o,e}function M(e,t,r){let n=r[0],i=r[1],a=r[2],o=r[3],s=t[0],l=t[1],c=t[2],u=i*c-a*l,h=a*s-n*c,d=n*l-i*s,p=i*d-a*h,f=a*u-n*d,m=n*h-i*u,v=2*o;return u*=v,h*=v,d*=v,p*=2,f*=2,m*=2,e[0]=s+u+p,e[1]=l+h+f,e[2]=c+d+m,e}const S=function(e){let t=e[0],r=e[1],n=e[2];return Math.sqrt(t*t+r*r+n*n)};!function(){let e=m()}();!function(){let e=function(){let e=new o(4);return o!=Float32Array&&(e[0]=0,e[1]=0,e[2]=0,e[3]=0),e}()}();function E(){let e=new o(4);return o!=Float32Array&&(e[0]=0,e[1]=0,e[2]=0),e[3]=1,e}function T(e,t,r){let n=t[0],i=t[1],a=t[2],o=t[3],s=r[0],l=r[1],c=r[2],u=r[3];return e[0]=n*u+o*s+i*c-a*l,e[1]=i*u+o*l+a*s-n*c,e[2]=a*u+o*c+n*l-i*s,e[3]=o*u-n*s-i*l-a*c,e}function R(e,t,r,n){let i,o,s,l,c,u=t[0],h=t[1],d=t[2],p=t[3],f=r[0],m=r[1],v=r[2],g=r[3];return(o=u*f+h*m+d*v+p*g)<0&&(o=-o,f=-f,m=-m,v=-v,g=-g),1-o>a?(i=Math.acos(o),s=Math.sin(i),l=Math.sin((1-n)*i)/s,c=Math.sin(n*i)/s):(l=1-n,c=n),e[0]=l*u+c*f,e[1]=l*h+c*m,e[2]=l*d+c*v,e[3]=l*p+c*g,e}function L(e,t){let r=t[0],n=t[1],i=t[2],a=t[3],o=r*r+n*n+i*i+a*a,s=o?1/o:0;return e[0]=-r*s,e[1]=-n*s,e[2]=-i*s,e[3]=a*s,e}const C=function(e){let t=new o(4);return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t},P=function(e,t,r,n){let i=new o(4);return i[0]=e,i[1]=t,i[2]=r,i[3]=n,i},D=function(e,t){return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e},I=function(e,t){let r=t[0],n=t[1],i=t[2],a=t[3],o=r*r+n*n+i*i+a*a;return o>0&&(o=1/Math.sqrt(o),e[0]=r*o,e[1]=n*o,e[2]=i*o,e[3]=a*o),e},O=(function(){let e=m(),t=g(1,0,0),r=g(0,1,0)}(),function(){let e=E(),t=E()}(),function(){let e=function(){let e=new o(9);return o!=Float32Array&&(e[1]=0,e[2]=0,e[3]=0,e[5]=0,e[6]=0,e[7]=0),e[0]=1,e[4]=1,e[8]=1,e}()}(),Symbol("@@webxr-polyfill/XRRigidTransform"));class B{constructor(){if(this[O]={matrix:null,position:null,orientation:null,inverse:null},0===arguments.length)this[O].matrix=l(new Float32Array(16));else if(1===arguments.length)arguments[0]instanceof Float32Array?this[O].matrix=arguments[0]:(this[O].position=this._getPoint(arguments[0]),this[O].orientation=DOMPointReadOnly.fromPoint({x:0,y:0,z:0,w:1}));else{if(2!==arguments.length)throw new Error("Too many arguments!");this[O].position=this._getPoint(arguments[0]),this[O].orientation=this._getPoint(arguments[1])}if(this[O].matrix){let e=m();d(e,this[O].matrix),this[O].position=DOMPointReadOnly.fromPoint({x:e[0],y:e[1],z:e[2]});let t=E();p(t,this[O].matrix),this[O].orientation=DOMPointReadOnly.fromPoint({x:t[0],y:t[1],z:t[2],w:t[3]})}else this[O].matrix=l(new Float32Array(16)),h(this[O].matrix,P(this[O].orientation.x,this[O].orientation.y,this[O].orientation.z,this[O].orientation.w),g(this[O].position.x,this[O].position.y,this[O].position.z))}_getPoint(e){return e instanceof DOMPointReadOnly?e:DOMPointReadOnly.fromPoint(e)}get matrix(){return this[O].matrix}get position(){return this[O].position}get orientation(){return this[O].orientation}get inverse(){if(null===this[O].inverse){let e=l(new Float32Array(16));c(e,this[O].matrix),this[O].inverse=new B(e),this[O].inverse[O].inverse=this}return this[O].inverse}}const F=Symbol("@@webxr-polyfill/XRSpace");class U{constructor(e=null,t=null){this[F]={specialType:e,inputSource:t,baseMatrix:null,inverseBaseMatrix:null,lastFrameId:-1}}get _specialType(){return this[F].specialType}get _inputSource(){return this[F].inputSource}_ensurePoseUpdated(e,t){t!=this[F].lastFrameId&&(this[F].lastFrameId=t,this._onPoseUpdate(e))}_onPoseUpdate(e){"viewer"==this[F].specialType&&(this._baseMatrix=e.getBasePoseMatrix())}set _baseMatrix(e){this[F].baseMatrix=e,this[F].inverseBaseMatrix=null}get _baseMatrix(){return this[F].baseMatrix||this[F].inverseBaseMatrix&&(this[F].baseMatrix=new Float32Array(16),c(this[F].baseMatrix,this[F].inverseBaseMatrix)),this[F].baseMatrix}set _inverseBaseMatrix(e){this[F].inverseBaseMatrix=e,this[F].baseMatrix=null}get _inverseBaseMatrix(){return this[F].inverseBaseMatrix||this[F].baseMatrix&&(this[F].inverseBaseMatrix=new Float32Array(16),c(this[F].inverseBaseMatrix,this[F].baseMatrix)),this[F].inverseBaseMatrix}_getSpaceRelativeTransform(e){if(!this._inverseBaseMatrix||!e._baseMatrix)return null;let t=new Float32Array(16);return u(t,this._inverseBaseMatrix,e._baseMatrix),new B(t)}}const N=1.6,G=Symbol("@@webxr-polyfill/XRReferenceSpace"),z=["viewer","local","local-floor","bounded-floor","unbounded"];class k extends U{constructor(e,t=null){if(!z.includes(e))throw new Error(`XRReferenceSpaceType must be one of ${z}`);if(super(e),"bounded-floor"===e&&!t)throw new Error("XRReferenceSpace cannot use 'bounded-floor' type if the platform does not provide the floor level");(function(e){return"bounded-floor"===e||"local-floor"===e})(e)&&!t&&((t=l(new Float32Array(16)))[13]=N),this._inverseBaseMatrix=t||l(new Float32Array(16)),this[G]={type:e,transform:t,originOffset:l(new Float32Array(16))}}_transformBasePoseMatrix(e,t){u(e,this._inverseBaseMatrix,t)}_originOffsetMatrix(){return this[G].originOffset}_adjustForOriginOffset(e){let t=new Float32Array(16);c(t,this[G].originOffset),u(e,t,e)}_getSpaceRelativeTransform(e){let t=super._getSpaceRelativeTransform(e);return this._adjustForOriginOffset(t.matrix),new XRRigidTransform(t.matrix)}getOffsetReferenceSpace(e){let t=new k(this[G].type,this[G].transform,this[G].bounds);return u(t[G].originOffset,this[G].originOffset,e.matrix),t}}const H=Symbol("@@webxr-polyfill/XR"),V=["inline","immersive-vr","immersive-ar"],j={inline:{requiredFeatures:["viewer"],optionalFeatures:[]},"immersive-vr":{requiredFeatures:["viewer","local"],optionalFeatures:[]},"immersive-ar":{requiredFeatures:["viewer","local"],optionalFeatures:[]}},W="Polyfill Error: Must call navigator.xr.isSessionSupported() with any XRSessionMode\nor navigator.xr.requestSession('inline') prior to requesting an immersive\nsession. This is a limitation specific to the WebXR Polyfill and does not apply\nto native implementations of the API.";let q;if("performance"in r==!1){let e=Date.now();q=()=>Date.now()-e}else q=()=>performance.now();var X=q;const Y=Symbol("@@webxr-polyfill/XRPose");class Q{constructor(e,t){this[Y]={transform:e,emulatedPosition:t}}get transform(){return this[Y].transform}get emulatedPosition(){return this[Y].emulatedPosition}}const Z=Symbol("@@webxr-polyfill/XRViewerPose");class J extends Q{constructor(e,t,r=!1){super(e,r),this[Z]={views:t}}get views(){return this[Z].views}}const K=Symbol("@@webxr-polyfill/XRViewport");class ${constructor(e){this[K]={target:e}}get x(){return this[K].target.x}get y(){return this[K].target.y}get width(){return this[K].target.width}get height(){return this[K].target.height}}const ee=["left","right","none"],te=Symbol("@@webxr-polyfill/XRView");class re{constructor(e,t,r,n){if(!ee.includes(r))throw new Error(`XREye must be one of: ${ee}`);const i=Object.create(null),a=new $(i);this[te]={device:e,eye:r,viewport:a,temp:i,sessionId:n,transform:t}}get eye(){return this[te].eye}get projectionMatrix(){return this[te].device.getProjectionMatrix(this.eye)}get transform(){return this[te].transform}_getViewport(e){if(this[te].device.getViewport(this[te].sessionId,this.eye,e,this[te].temp))return this[te].viewport}}const ne=Symbol("@@webxr-polyfill/XRFrame"),ie="XRFrame access outside the callback that produced it is invalid.",ae="getViewerPose can only be called on XRFrame objects passed to XRSession.requestAnimationFrame callbacks.";let oe=0;class se{constructor(e,t,r){this[ne]={id:++oe,active:!1,animationFrame:!1,device:e,session:t,sessionId:r}}get session(){return this[ne].session}getViewerPose(e){if(!this[ne].animationFrame)throw new DOMException(ae,"InvalidStateError");if(!this[ne].active)throw new DOMException(ie,"InvalidStateError");const t=this[ne].device,r=this[ne].session;r[Ae].viewerSpace._ensurePoseUpdated(t,this[ne].id),e._ensurePoseUpdated(t,this[ne].id);let n=e._getSpaceRelativeTransform(r[Ae].viewerSpace);const i=[];for(let n of r[Ae].viewSpaces){n._ensurePoseUpdated(t,this[ne].id);let r=e._getSpaceRelativeTransform(n),a=new re(t,r,n.eye,this[ne].sessionId);i.push(a)}return new J(n,i,!1)}getPose(e,t){if(!this[ne].active)throw new DOMException(ie,"InvalidStateError");const r=this[ne].device;if("target-ray"===e._specialType||"grip"===e._specialType)return r.getInputPose(e._inputSource,t,e._specialType);{e._ensurePoseUpdated(r,this[ne].id),t._ensurePoseUpdated(r,this[ne].id);let n=t._getSpaceRelativeTransform(e);return n?new XRPose(n,!1):null}}}const le=Symbol("@@webxr-polyfill/XRRenderState"),ce=Object.freeze({depthNear:.1,depthFar:1e3,inlineVerticalFieldOfView:null,baseLayer:null});class ue{constructor(e={}){const t=Object.assign({},ce,e);this[le]={config:t}}get depthNear(){return this[le].config.depthNear}get depthFar(){return this[le].config.depthFar}get inlineVerticalFieldOfView(){return this[le].config.inlineVerticalFieldOfView}get baseLayer(){return this[le].config.baseLayer}}const he=Symbol("@@webxr-polyfill/polyfilled-xr-compatible"),de=Symbol("@@webxr-polyfill/xr-compatible"),pe=Symbol("@@webxr-polyfill/XRWebGLLayer"),fe=Object.freeze({antialias:!0,depth:!1,stencil:!1,alpha:!0,multiview:!1,ignoreDepthValues:!1,framebufferScaleFactor:1});const me=Symbol("@@webxr-polyfill/XRInputSourceEvent");class ve extends Event{constructor(e,t){super(e,t),this[me]={frame:t.frame,inputSource:t.inputSource}}get frame(){return this[me].frame}get inputSource(){return this[me].inputSource}}const ge=Symbol("@@webxr-polyfill/XRSessionEvent");class ye extends Event{constructor(e,t){super(e,t),this[ge]={session:t.session}}get session(){return this[ge].session}}const xe=Symbol("@@webxr-polyfill/XRInputSourcesChangeEvent");class be extends Event{constructor(e,t){super(e,t),this[xe]={session:t.session,added:t.added,removed:t.removed}}get session(){return this[xe].session}get added(){return this[xe].added}get removed(){return this[xe].removed}}const Ae=Symbol("@@webxr-polyfill/XRSession");class we extends U{constructor(e){super(e)}get eye(){return this._specialType}_onPoseUpdate(e){this._inverseBaseMatrix=e.getBaseViewMatrix(this._specialType)}}class _e extends i{constructor(e,t,r){super();let n="inline"!=t,i=new ue({inlineVerticalFieldOfView:n?null:.5*Math.PI});this[Ae]={device:e,mode:t,immersive:n,ended:!1,suspended:!1,frameCallbacks:[],currentFrameCallbacks:null,frameHandle:0,deviceFrameHandle:null,id:r,activeRenderState:i,pendingRenderState:null,viewerSpace:new k("viewer"),viewSpaces:[],currentInputSources:[]},n?this[Ae].viewSpaces.push(new we("left"),new we("right")):this[Ae].viewSpaces.push(new we("none")),this[Ae].onDeviceFrame=()=>{if(this[Ae].ended||this[Ae].suspended)return;if(this[Ae].deviceFrameHandle=null,this[Ae].startDeviceFrameLoop(),null!==this[Ae].pendingRenderState&&(this[Ae].activeRenderState=new ue(this[Ae].pendingRenderState),this[Ae].pendingRenderState=null,this[Ae].activeRenderState.baseLayer&&this[Ae].device.onBaseLayerSet(this[Ae].id,this[Ae].activeRenderState.baseLayer)),null===this[Ae].activeRenderState.baseLayer)return;const t=new se(e,this,this[Ae].id),r=this[Ae].currentFrameCallbacks=this[Ae].frameCallbacks;this[Ae].frameCallbacks=[],t[ne].active=!0,t[ne].animationFrame=!0,this[Ae].device.onFrameStart(this[Ae].id,this[Ae].activeRenderState),this._checkInputSourcesChange();const n=X();for(let e=0;e<r.length;e++)try{r[e].cancelled||"function"!=typeof r[e].callback||r[e].callback(n,t)}catch(e){console.error(e)}this[Ae].currentFrameCallbacks=null,t[ne].active=!1,this[Ae].device.onFrameEnd(this[Ae].id)},this[Ae].startDeviceFrameLoop=()=>{null===this[Ae].deviceFrameHandle&&(this[Ae].deviceFrameHandle=this[Ae].device.requestAnimationFrame(this[Ae].onDeviceFrame))},this[Ae].stopDeviceFrameLoop=()=>{const e=this[Ae].deviceFrameHandle;null!==e&&(this[Ae].device.cancelAnimationFrame(e),this[Ae].deviceFrameHandle=null)},this[Ae].onPresentationEnd=t=>{if(t!==this[Ae].id)return this[Ae].suspended=!1,this[Ae].startDeviceFrameLoop(),void this.dispatchEvent("focus",{session:this});this[Ae].ended=!0,this[Ae].stopDeviceFrameLoop(),e.removeEventListener("@webvr-polyfill/vr-present-end",this[Ae].onPresentationEnd),e.removeEventListener("@webvr-polyfill/vr-present-start",this[Ae].onPresentationStart),e.removeEventListener("@@webvr-polyfill/input-select-start",this[Ae].onSelectStart),e.removeEventListener("@@webvr-polyfill/input-select-end",this[Ae].onSelectEnd),this.dispatchEvent("end",new ye("end",{session:this}))},e.addEventListener("@@webxr-polyfill/vr-present-end",this[Ae].onPresentationEnd),this[Ae].onPresentationStart=e=>{e!==this[Ae].id&&(this[Ae].suspended=!0,this[Ae].stopDeviceFrameLoop(),this.dispatchEvent("blur",{session:this}))},e.addEventListener("@@webxr-polyfill/vr-present-start",this[Ae].onPresentationStart),this[Ae].onSelectStart=e=>{e.sessionId===this[Ae].id&&this[Ae].dispatchInputSourceEvent("selectstart",e.inputSource)},e.addEventListener("@@webxr-polyfill/input-select-start",this[Ae].onSelectStart),this[Ae].onSelectEnd=e=>{e.sessionId===this[Ae].id&&(this[Ae].dispatchInputSourceEvent("selectend",e.inputSource),this[Ae].dispatchInputSourceEvent("select",e.inputSource))},e.addEventListener("@@webxr-polyfill/input-select-end",this[Ae].onSelectEnd),this[Ae].onSqueezeStart=e=>{e.sessionId===this[Ae].id&&this[Ae].dispatchInputSourceEvent("squeezestart",e.inputSource)},e.addEventListener("@@webxr-polyfill/input-squeeze-start",this[Ae].onSqueezeStart),this[Ae].onSqueezeEnd=e=>{e.sessionId===this[Ae].id&&(this[Ae].dispatchInputSourceEvent("squeezeend",e.inputSource),this[Ae].dispatchInputSourceEvent("squeeze",e.inputSource))},e.addEventListener("@@webxr-polyfill/input-squeeze-end",this[Ae].onSqueezeEnd),this[Ae].dispatchInputSourceEvent=(t,r)=>{const n=new se(e,this,this[Ae].id),i=new ve(t,{frame:n,inputSource:r});n[ne].active=!0,this.dispatchEvent(t,i),n[ne].active=!1},this[Ae].startDeviceFrameLoop(),this.onblur=void 0,this.onfocus=void 0,this.onresetpose=void 0,this.onend=void 0,this.onselect=void 0,this.onselectstart=void 0,this.onselectend=void 0}get renderState(){return this[Ae].activeRenderState}get environmentBlendMode(){return this[Ae].device.environmentBlendMode||"opaque"}async requestReferenceSpace(e){if(this[Ae].ended)return;if(!z.includes(e))throw new TypeError(`XRReferenceSpaceType must be one of ${z}`);if(!this[Ae].device.doesSessionSupportReferenceSpace(this[Ae].id,e))throw new DOMException(`The ${e} reference space is not supported by this session.`,"NotSupportedError");if("viewer"===e)return this[Ae].viewerSpace;let t=await this[Ae].device.requestFrameOfReferenceTransform(e);if("bounded-floor"===e){if(!t)throw new DOMException(`${e} XRReferenceSpace not supported by this device.`,"NotSupportedError");if(!this[Ae].device.requestStageBounds())throw new DOMException(`${e} XRReferenceSpace not supported by this device.`,"NotSupportedError");throw new DOMException(`The WebXR polyfill does not support the ${e} reference space yet.`,"NotSupportedError")}return new k(e,t)}requestAnimationFrame(e){if(this[Ae].ended)return;const t=++this[Ae].frameHandle;return this[Ae].frameCallbacks.push({handle:t,callback:e,cancelled:!1}),t}cancelAnimationFrame(e){let t=this[Ae].frameCallbacks,r=t.findIndex(t=>t&&t.handle===e);r>-1&&(t[r].cancelled=!0,t.splice(r,1)),(t=this[Ae].currentFrameCallbacks)&&(r=t.findIndex(t=>t&&t.handle===e))>-1&&(t[r].cancelled=!0)}get inputSources(){return this[Ae].device.getInputSources()}async end(){if(!this[Ae].ended)return this.immersive&&(this[Ae].ended=!0,this[Ae].device.removeEventListener("@@webvr-polyfill/vr-present-start",this[Ae].onPresentationStart),this[Ae].device.removeEventListener("@@webvr-polyfill/vr-present-end",this[Ae].onPresentationEnd),this[Ae].device.removeEventListener("@@webvr-polyfill/input-select-start",this[Ae].onSelectStart),this[Ae].device.removeEventListener("@@webvr-polyfill/input-select-end",this[Ae].onSelectEnd),this.dispatchEvent("end",new ye("end",{session:this}))),this[Ae].stopDeviceFrameLoop(),this[Ae].device.endSession(this[Ae].id)}updateRenderState(e){if(this[Ae].ended){throw new Error("Can't call updateRenderState on an XRSession that has already ended.")}if(e.baseLayer&&e.baseLayer._session!==this){throw new Error("Called updateRenderState with a base layer that was created by a different session.")}if(null!==e.inlineVerticalFieldOfView&&void 0!==e.inlineVerticalFieldOfView){if(this[Ae].immersive){throw new Error("inlineVerticalFieldOfView must not be set for an XRRenderState passed to updateRenderState for an immersive session.")}e.inlineVerticalFieldOfView=Math.min(3.13,Math.max(.01,e.inlineVerticalFieldOfView))}if(null===this[Ae].pendingRenderState){const e=this[Ae].activeRenderState;this[Ae].pendingRenderState={depthNear:e.depthNear,depthFar:e.depthFar,inlineVerticalFieldOfView:e.inlineVerticalFieldOfView,baseLayer:e.baseLayer}}Object.assign(this[Ae].pendingRenderState,e)}_checkInputSourcesChange(){const e=[],t=[],r=this.inputSources,n=this[Ae].currentInputSources;for(const t of r)n.includes(t)||e.push(t);for(const e of n)r.includes(e)||t.push(e);(e.length>0||t.length>0)&&this.dispatchEvent("inputsourceschange",new be("inputsourceschange",{session:this,added:e,removed:t})),this[Ae].currentInputSources.length=0;for(const e of r)this[Ae].currentInputSources.push(e)}}const Me=Symbol("@@webxr-polyfill/XRInputSource");class Se{constructor(e){this[Me]={impl:e,gripSpace:new U("grip",this),targetRaySpace:new U("target-ray",this)}}get handedness(){return this[Me].impl.handedness}get targetRayMode(){return this[Me].impl.targetRayMode}get gripSpace(){let e=this[Me].impl.targetRayMode;return"gaze"===e||"screen"===e?null:this[Me].gripSpace}get targetRaySpace(){return this[Me].targetRaySpace}get profiles(){return this[Me].impl.profiles}get gamepad(){return this[Me].impl.gamepad}}const Ee=Symbol("@@webxr-polyfill/XRReferenceSpaceEvent");class Te extends Event{constructor(e,t){super(e,t),this[Ee]={referenceSpace:t.referenceSpace,transform:t.transform||null}}get referenceSpace(){return this[Ee].referenceSpace}get transform(){return this[Ee].transform}}var Re={XR:class extends i{constructor(e){super(),this[H]={device:null,devicePromise:e,immersiveSession:null,inlineSessions:new Set},e.then(e=>{this[H].device=e})}async isSessionSupported(e){return this[H].device||await this[H].devicePromise,"inline"!=e?Promise.resolve(this[H].device.isSessionSupported(e)):Promise.resolve(!0)}async requestSession(e,t){if(!this[H].device){if("inline"!=e)throw new Error(W);await this[H].devicePromise}if(!V.includes(e))throw new TypeError(`The provided value '${e}' is not a valid enum value of type XRSessionMode`);const r=j[e],n=r.requiredFeatures.concat(t&&t.requiredFeatures?t.requiredFeatures:[]),i=r.optionalFeatures.concat(t&&t.optionalFeatures?t.optionalFeatures:[]),a=new Set;let o=!1;for(let e of n)this[H].device.isFeatureSupported(e)?a.add(e):(console.error(`The required feature '${e}' is not supported`),o=!0);if(o)throw new DOMException("Session does not support some required features","NotSupportedError");for(let e of i)this[H].device.isFeatureSupported(e)?a.add(e):console.log(`The optional feature '${e}' is not supported`);const s=await this[H].device.requestSession(e,a),l=new XRSession(this[H].device,e,s);"inline"==e?this[H].inlineSessions.add(l):this[H].immersiveSession=l;const c=()=>{"inline"==e?this[H].inlineSessions.delete(l):this[H].immersiveSession=null,l.removeEventListener("end",c)};return l.addEventListener("end",c),l}},XRSession:_e,XRSessionEvent:ye,XRFrame:se,XRView:re,XRViewport:$,XRViewerPose:J,XRWebGLLayer:class{constructor(e,t,r={}){const n=Object.assign({},fe,r);if(!(e instanceof _e))throw new Error("session must be a XRSession");if(e.ended)throw new Error("InvalidStateError");if(t[he]&&!0!==t[de])throw new Error("InvalidStateError");const i=t.getParameter(t.FRAMEBUFFER_BINDING);this[pe]={context:t,config:n,framebuffer:i,session:e}}get context(){return this[pe].context}get antialias(){return this[pe].config.antialias}get ignoreDepthValues(){return!0}get framebuffer(){return this[pe].framebuffer}get framebufferWidth(){return this[pe].context.drawingBufferWidth}get framebufferHeight(){return this[pe].context.drawingBufferHeight}get _session(){return this[pe].session}getViewport(e){return e._getViewport(this)}static getNativeFramebufferScaleFactor(e){if(!e)throw new TypeError("getNativeFramebufferScaleFactor must be passed a session.");return e[Ae].ended?0:1}},XRSpace:U,XRReferenceSpace:k,XRReferenceSpaceEvent:Te,XRInputSource:Se,XRInputSourceEvent:ve,XRInputSourcesChangeEvent:be,XRRenderState:ue,XRRigidTransform:B,XRPose:Q};const Le=e=>"function"!=typeof e.prototype.makeXRCompatible&&(e.prototype.makeXRCompatible=function(){return this[de]=!0,Promise.resolve()},!0),Ce=e=>{const t=e.prototype.getContext;e.prototype.getContext=function(e,r){const n=t.call(this,e,r);return n&&(n[he]=!0,r&&"xrCompatible"in r&&(n[de]=r.xrCompatible)),n}},Pe=e=>!(!e.ImageBitmapRenderingContext||!e.createImageBitmap),De=e=>{e.style.display="block",e.style.position="absolute",e.style.width=e.style.height="1px",e.style.top=e.style.left="0px"};var Ie="undefined"!=typeof window?window:void 0!==e?e:"undefined"!=typeof self?self:{};var Oe,Be=function(e,t){return e(t={exports:{}},t.exports),t.exports}((function(e,t){e.exports=function(){var e,t,r,n=function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")},i=function(){function e(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),t}}(),a=function(e,t){if(Array.isArray(e))return e;if(Symbol.iterator in Object(e))return function(e,t){var r=[],n=!0,i=!1,a=void 0;try{for(var o,s=e[Symbol.iterator]();!(n=(o=s.next()).done)&&(r.push(o.value),!t||r.length!==t);n=!0);}catch(e){i=!0,a=e}finally{try{!n&&s.return&&s.return()}finally{if(i)throw a}}return r}(e,t);throw new TypeError("Invalid attempt to destructure non-iterable instance")},o=function(e,t,r){return e+(t-e)*r},s=function(){var e=/iPad|iPhone|iPod/.test(navigator.platform);return function(){return e}}(),l=function(){var e=-1!==navigator.userAgent.indexOf("Version")&&-1!==navigator.userAgent.indexOf("Android")&&-1!==navigator.userAgent.indexOf("Chrome");return function(){return e}}(),c=(/^((?!chrome|android).)*safari/i.test(navigator.userAgent),function(){var e=-1!==navigator.userAgent.indexOf("Firefox")&&-1!==navigator.userAgent.indexOf("Android");return function(){return e}}()),u=(t=navigator.userAgent.match(/.*Chrome\/([0-9]+)/),r=t?parseInt(t[1],10):null,function(){return r}),h=function(){var e=!1;if(65===u()){var t=navigator.userAgent.match(/.*Chrome\/([0-9\.]*)/);if(t){var r=t[1].split("."),n=a(r,4),i=(n[0],n[1],n[2]),o=n[3];e=3325===parseInt(i,10)&&parseInt(o,10)<148}}return function(){return e}}(),d=function(){var e=-1!==navigator.userAgent.indexOf("R7 Build");return function(){return e}}(),p=function(){var e=90==window.orientation||-90==window.orientation;return d()?!e:e},f=function(){return Math.max(window.screen.width,window.screen.height)*window.devicePixelRatio},m=function(){return Math.min(window.screen.width,window.screen.height)*window.devicePixelRatio},v=function(){if(document.exitFullscreen)document.exitFullscreen();else if(document.webkitExitFullscreen)document.webkitExitFullscreen();else if(document.mozCancelFullScreen)document.mozCancelFullScreen();else{if(!document.msExitFullscreen)return!1;document.msExitFullscreen()}return!0},g=function(e,t,r,n){var i=e.createShader(e.VERTEX_SHADER);e.shaderSource(i,t),e.compileShader(i);var a=e.createShader(e.FRAGMENT_SHADER);e.shaderSource(a,r),e.compileShader(a);var o=e.createProgram();for(var s in e.attachShader(o,i),e.attachShader(o,a),n)e.bindAttribLocation(o,n[s],s);return e.linkProgram(o),e.deleteShader(i),e.deleteShader(a),o},y=function(e,t){for(var r={},n=e.getProgramParameter(t,e.ACTIVE_UNIFORMS),i="",a=0;a<n;a++)r[i=e.getActiveUniform(t,a).name.replace("[0]","")]=e.getUniformLocation(t,i);return r},x=function(){var e,t=!1;return e=navigator.userAgent||navigator.vendor||window.opera,(/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows ce|xda|xiino/i.test(e)||/1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc\-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|\-[a-w])|libw|lynx|m1\-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m\-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\-2|po(ck|rt|se)|prox|psio|pt\-g|qa\-a|qc(07|12|21|32|60|\-[2-7]|i\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\-|oo|p\-)|sdk\/|se(c(\-|0|1)|47|mc|nd|ri)|sgh\-|shar|sie(\-|m)|sk\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\-|v\-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\-|tdg\-|tel(i|m)|tim\-|t\-mo|to(pl|sh)|ts(70|m\-|m3|m5)|tx\-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas\-|your|zeto|zte\-/i.test(e.substr(0,4)))&&(t=!0),t},b=function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r]);return e},A=function(e){if(s()){var t=e.style.width,r=e.style.height;e.style.width=parseInt(t)+1+"px",e.style.height=parseInt(r)+"px",setTimeout((function(){e.style.width=t,e.style.height=r}),100)}window.canvas=e},w=function(){var e=Math.PI/180,t=.25*Math.PI,r=new Float32Array([0,0,0,1]),n=new Float32Array([0,0,0]);function i(i,a,o,s,l,c){!function(r,n,i,a){var o=Math.tan(n?n.upDegrees*e:t),s=Math.tan(n?n.downDegrees*e:t),l=Math.tan(n?n.leftDegrees*e:t),c=Math.tan(n?n.rightDegrees*e:t),u=2/(l+c),h=2/(o+s);r[0]=u,r[1]=0,r[2]=0,r[3]=0,r[4]=0,r[5]=h,r[6]=0,r[7]=0,r[8]=-(l-c)*u*.5,r[9]=(o-s)*h*.5,r[10]=a/(i-a),r[11]=-1,r[12]=0,r[13]=0,r[14]=a*i/(i-a),r[15]=0}(i,s||null,c.depthNear,c.depthFar);var u,h,d,p,f,m,v,g,y,x,b,A,w,_,M,S,E,T,R,L=o.orientation||r,C=o.position||n;u=a,d=C,p=(h=L)[0],f=h[1],m=h[2],v=h[3],b=p*(g=p+p),A=p*(y=f+f),w=p*(x=m+m),_=f*y,M=f*x,S=m*x,E=v*g,T=v*y,R=v*x,u[0]=1-(_+S),u[1]=A+R,u[2]=w-T,u[3]=0,u[4]=A-R,u[5]=1-(b+S),u[6]=M+E,u[7]=0,u[8]=w+T,u[9]=M-E,u[10]=1-(b+_),u[11]=0,u[12]=d[0],u[13]=d[1],u[14]=d[2],u[15]=1,l&&function(e,t,r){var n,i,a,o,s,l,c,u,h,d,p,f,m=r[0],v=r[1],g=r[2];t===e?(e[12]=t[0]*m+t[4]*v+t[8]*g+t[12],e[13]=t[1]*m+t[5]*v+t[9]*g+t[13],e[14]=t[2]*m+t[6]*v+t[10]*g+t[14],e[15]=t[3]*m+t[7]*v+t[11]*g+t[15]):(n=t[0],i=t[1],a=t[2],o=t[3],s=t[4],l=t[5],c=t[6],u=t[7],h=t[8],d=t[9],p=t[10],f=t[11],e[0]=n,e[1]=i,e[2]=a,e[3]=o,e[4]=s,e[5]=l,e[6]=c,e[7]=u,e[8]=h,e[9]=d,e[10]=p,e[11]=f,e[12]=n*m+s*v+h*g+t[12],e[13]=i*m+l*v+d*g+t[13],e[14]=a*m+c*v+p*g+t[14],e[15]=o*m+u*v+f*g+t[15])}(a,a,l),function(e,t){var r=t[0],n=t[1],i=t[2],a=t[3],o=t[4],s=t[5],l=t[6],c=t[7],u=t[8],h=t[9],d=t[10],p=t[11],f=t[12],m=t[13],v=t[14],g=t[15],y=r*s-n*o,x=r*l-i*o,b=r*c-a*o,A=n*l-i*s,w=n*c-a*s,_=i*c-a*l,M=u*m-h*f,S=u*v-d*f,E=u*g-p*f,T=h*v-d*m,R=h*g-p*m,L=d*g-p*v,C=y*L-x*R+b*T+A*E-w*S+_*M;C&&(C=1/C,e[0]=(s*L-l*R+c*T)*C,e[1]=(i*R-n*L-a*T)*C,e[2]=(m*_-v*w+g*A)*C,e[3]=(d*w-h*_-p*A)*C,e[4]=(l*E-o*L-c*S)*C,e[5]=(r*L-i*E+a*S)*C,e[6]=(v*b-f*_-g*x)*C,e[7]=(u*_-d*b+p*x)*C,e[8]=(o*R-s*E+c*M)*C,e[9]=(n*E-r*R-a*M)*C,e[10]=(f*w-m*b+g*y)*C,e[11]=(h*b-u*w-p*y)*C,e[12]=(s*S-o*T-l*M)*C,e[13]=(r*T-n*S+i*M)*C,e[14]=(m*x-f*A-v*y)*C,e[15]=(u*A-h*x+d*y)*C)}(a,a)}return function(e,t,r){return!(!e||!t||(e.pose=t,e.timestamp=t.timestamp,i(e.leftProjectionMatrix,e.leftViewMatrix,t,r._getFieldOfView("left"),r._getEyeOffset("left"),r),i(e.rightProjectionMatrix,e.rightViewMatrix,t,r._getFieldOfView("right"),r._getEyeOffset("right"),r),0))}}(),_=function(e){var t,r=e.indexOf("://");t=-1!==r?r+3:0;var n=e.indexOf("/",t);return-1===n&&(n=e.length),e.substring(0,n)},M=(e={},function(t,r){void 0===e[t]&&(console.warn("webvr-polyfill: "+r),e[t]=!0)}),S=function(e,t){M(e,e+" has been deprecated. This may not work on native WebVR displays. "+(t?"Please use "+t+" instead.":""))},E=function(e,t,r){if(t){for(var n=[],i=null,a=0;a<t.length;++a)switch(o=t[a]){case e.TEXTURE_BINDING_2D:case e.TEXTURE_BINDING_CUBE_MAP:if((l=t[++a])<e.TEXTURE0||l>e.TEXTURE31){console.error("TEXTURE_BINDING_2D or TEXTURE_BINDING_CUBE_MAP must be followed by a valid texture unit"),n.push(null,null);break}i||(i=e.getParameter(e.ACTIVE_TEXTURE)),e.activeTexture(l),n.push(e.getParameter(o),null);break;case e.ACTIVE_TEXTURE:i=e.getParameter(e.ACTIVE_TEXTURE),n.push(null);break;default:n.push(e.getParameter(o))}for(r(e),a=0;a<t.length;++a){var o=t[a],s=n[a];switch(o){case e.ACTIVE_TEXTURE:break;case e.ARRAY_BUFFER_BINDING:e.bindBuffer(e.ARRAY_BUFFER,s);break;case e.COLOR_CLEAR_VALUE:e.clearColor(s[0],s[1],s[2],s[3]);break;case e.COLOR_WRITEMASK:e.colorMask(s[0],s[1],s[2],s[3]);break;case e.CURRENT_PROGRAM:e.useProgram(s);break;case e.ELEMENT_ARRAY_BUFFER_BINDING:e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,s);break;case e.FRAMEBUFFER_BINDING:e.bindFramebuffer(e.FRAMEBUFFER,s);break;case e.RENDERBUFFER_BINDING:e.bindRenderbuffer(e.RENDERBUFFER,s);break;case e.TEXTURE_BINDING_2D:if((l=t[++a])<e.TEXTURE0||l>e.TEXTURE31)break;e.activeTexture(l),e.bindTexture(e.TEXTURE_2D,s);break;case e.TEXTURE_BINDING_CUBE_MAP:var l;if((l=t[++a])<e.TEXTURE0||l>e.TEXTURE31)break;e.activeTexture(l),e.bindTexture(e.TEXTURE_CUBE_MAP,s);break;case e.VIEWPORT:e.viewport(s[0],s[1],s[2],s[3]);break;case e.BLEND:case e.CULL_FACE:case e.DEPTH_TEST:case e.SCISSOR_TEST:case e.STENCIL_TEST:s?e.enable(o):e.disable(o);break;default:console.log("No GL restore behavior for 0x"+o.toString(16))}i&&e.activeTexture(i)}}else r(e)},T=["attribute vec2 position;","attribute vec3 texCoord;","varying vec2 vTexCoord;","uniform vec4 viewportOffsetScale[2];","void main() {"," vec4 viewport = viewportOffsetScale[int(texCoord.z)];"," vTexCoord = (texCoord.xy * viewport.zw) + viewport.xy;"," gl_Position = vec4( position, 1.0, 1.0 );","}"].join("\n"),R=["precision mediump float;","uniform sampler2D diffuse;","varying vec2 vTexCoord;","void main() {"," gl_FragColor = texture2D(diffuse, vTexCoord);","}"].join("\n");function L(e,t,r,n){this.gl=e,this.cardboardUI=t,this.bufferScale=r,this.dirtySubmitFrameBindings=n,this.ctxAttribs=e.getContextAttributes(),this.meshWidth=20,this.meshHeight=20,this.bufferWidth=e.drawingBufferWidth,this.bufferHeight=e.drawingBufferHeight,this.realBindFramebuffer=e.bindFramebuffer,this.realEnable=e.enable,this.realDisable=e.disable,this.realColorMask=e.colorMask,this.realClearColor=e.clearColor,this.realViewport=e.viewport,s()||(this.realCanvasWidth=Object.getOwnPropertyDescriptor(e.canvas.__proto__,"width"),this.realCanvasHeight=Object.getOwnPropertyDescriptor(e.canvas.__proto__,"height")),this.isPatched=!1,this.lastBoundFramebuffer=null,this.cullFace=!1,this.depthTest=!1,this.blend=!1,this.scissorTest=!1,this.stencilTest=!1,this.viewport=[0,0,0,0],this.colorMask=[!0,!0,!0,!0],this.clearColor=[0,0,0,0],this.attribs={position:0,texCoord:1},this.program=g(e,T,R,this.attribs),this.uniforms=y(e,this.program),this.viewportOffsetScale=new Float32Array(8),this.setTextureBounds(),this.vertexBuffer=e.createBuffer(),this.indexBuffer=e.createBuffer(),this.indexCount=0,this.renderTarget=e.createTexture(),this.framebuffer=e.createFramebuffer(),this.depthStencilBuffer=null,this.depthBuffer=null,this.stencilBuffer=null,this.ctxAttribs.depth&&this.ctxAttribs.stencil?this.depthStencilBuffer=e.createRenderbuffer():this.ctxAttribs.depth?this.depthBuffer=e.createRenderbuffer():this.ctxAttribs.stencil&&(this.stencilBuffer=e.createRenderbuffer()),this.patch(),this.onResize()}L.prototype.destroy=function(){var e=this.gl;this.unpatch(),e.deleteProgram(this.program),e.deleteBuffer(this.vertexBuffer),e.deleteBuffer(this.indexBuffer),e.deleteTexture(this.renderTarget),e.deleteFramebuffer(this.framebuffer),this.depthStencilBuffer&&e.deleteRenderbuffer(this.depthStencilBuffer),this.depthBuffer&&e.deleteRenderbuffer(this.depthBuffer),this.stencilBuffer&&e.deleteRenderbuffer(this.stencilBuffer),this.cardboardUI&&this.cardboardUI.destroy()},L.prototype.onResize=function(){var e=this.gl,t=this,r=[e.RENDERBUFFER_BINDING,e.TEXTURE_BINDING_2D,e.TEXTURE0];E(e,r,(function(e){t.realBindFramebuffer.call(e,e.FRAMEBUFFER,null),t.scissorTest&&t.realDisable.call(e,e.SCISSOR_TEST),t.realColorMask.call(e,!0,!0,!0,!0),t.realViewport.call(e,0,0,e.drawingBufferWidth,e.drawingBufferHeight),t.realClearColor.call(e,0,0,0,1),e.clear(e.COLOR_BUFFER_BIT),t.realBindFramebuffer.call(e,e.FRAMEBUFFER,t.framebuffer),e.bindTexture(e.TEXTURE_2D,t.renderTarget),e.texImage2D(e.TEXTURE_2D,0,t.ctxAttribs.alpha?e.RGBA:e.RGB,t.bufferWidth,t.bufferHeight,0,t.ctxAttribs.alpha?e.RGBA:e.RGB,e.UNSIGNED_BYTE,null),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MAG_FILTER,e.LINEAR),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MIN_FILTER,e.LINEAR),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_S,e.CLAMP_TO_EDGE),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_T,e.CLAMP_TO_EDGE),e.framebufferTexture2D(e.FRAMEBUFFER,e.COLOR_ATTACHMENT0,e.TEXTURE_2D,t.renderTarget,0),t.ctxAttribs.depth&&t.ctxAttribs.stencil?(e.bindRenderbuffer(e.RENDERBUFFER,t.depthStencilBuffer),e.renderbufferStorage(e.RENDERBUFFER,e.DEPTH_STENCIL,t.bufferWidth,t.bufferHeight),e.framebufferRenderbuffer(e.FRAMEBUFFER,e.DEPTH_STENCIL_ATTACHMENT,e.RENDERBUFFER,t.depthStencilBuffer)):t.ctxAttribs.depth?(e.bindRenderbuffer(e.RENDERBUFFER,t.depthBuffer),e.renderbufferStorage(e.RENDERBUFFER,e.DEPTH_COMPONENT16,t.bufferWidth,t.bufferHeight),e.framebufferRenderbuffer(e.FRAMEBUFFER,e.DEPTH_ATTACHMENT,e.RENDERBUFFER,t.depthBuffer)):t.ctxAttribs.stencil&&(e.bindRenderbuffer(e.RENDERBUFFER,t.stencilBuffer),e.renderbufferStorage(e.RENDERBUFFER,e.STENCIL_INDEX8,t.bufferWidth,t.bufferHeight),e.framebufferRenderbuffer(e.FRAMEBUFFER,e.STENCIL_ATTACHMENT,e.RENDERBUFFER,t.stencilBuffer)),!e.checkFramebufferStatus(e.FRAMEBUFFER)===e.FRAMEBUFFER_COMPLETE&&console.error("Framebuffer incomplete!"),t.realBindFramebuffer.call(e,e.FRAMEBUFFER,t.lastBoundFramebuffer),t.scissorTest&&t.realEnable.call(e,e.SCISSOR_TEST),t.realColorMask.apply(e,t.colorMask),t.realViewport.apply(e,t.viewport),t.realClearColor.apply(e,t.clearColor)})),this.cardboardUI&&this.cardboardUI.onResize()},L.prototype.patch=function(){if(!this.isPatched){var e=this,t=this.gl.canvas,r=this.gl;s()||(t.width=f()*this.bufferScale,t.height=m()*this.bufferScale,Object.defineProperty(t,"width",{configurable:!0,enumerable:!0,get:function(){return e.bufferWidth},set:function(r){e.bufferWidth=r,e.realCanvasWidth.set.call(t,r),e.onResize()}}),Object.defineProperty(t,"height",{configurable:!0,enumerable:!0,get:function(){return e.bufferHeight},set:function(r){e.bufferHeight=r,e.realCanvasHeight.set.call(t,r),e.onResize()}})),this.lastBoundFramebuffer=r.getParameter(r.FRAMEBUFFER_BINDING),null==this.lastBoundFramebuffer&&(this.lastBoundFramebuffer=this.framebuffer,this.gl.bindFramebuffer(r.FRAMEBUFFER,this.framebuffer)),this.gl.bindFramebuffer=function(t,n){e.lastBoundFramebuffer=n||e.framebuffer,e.realBindFramebuffer.call(r,t,e.lastBoundFramebuffer)},this.cullFace=r.getParameter(r.CULL_FACE),this.depthTest=r.getParameter(r.DEPTH_TEST),this.blend=r.getParameter(r.BLEND),this.scissorTest=r.getParameter(r.SCISSOR_TEST),this.stencilTest=r.getParameter(r.STENCIL_TEST),r.enable=function(t){switch(t){case r.CULL_FACE:e.cullFace=!0;break;case r.DEPTH_TEST:e.depthTest=!0;break;case r.BLEND:e.blend=!0;break;case r.SCISSOR_TEST:e.scissorTest=!0;break;case r.STENCIL_TEST:e.stencilTest=!0}e.realEnable.call(r,t)},r.disable=function(t){switch(t){case r.CULL_FACE:e.cullFace=!1;break;case r.DEPTH_TEST:e.depthTest=!1;break;case r.BLEND:e.blend=!1;break;case r.SCISSOR_TEST:e.scissorTest=!1;break;case r.STENCIL_TEST:e.stencilTest=!1}e.realDisable.call(r,t)},this.colorMask=r.getParameter(r.COLOR_WRITEMASK),r.colorMask=function(t,n,i,a){e.colorMask[0]=t,e.colorMask[1]=n,e.colorMask[2]=i,e.colorMask[3]=a,e.realColorMask.call(r,t,n,i,a)},this.clearColor=r.getParameter(r.COLOR_CLEAR_VALUE),r.clearColor=function(t,n,i,a){e.clearColor[0]=t,e.clearColor[1]=n,e.clearColor[2]=i,e.clearColor[3]=a,e.realClearColor.call(r,t,n,i,a)},this.viewport=r.getParameter(r.VIEWPORT),r.viewport=function(t,n,i,a){e.viewport[0]=t,e.viewport[1]=n,e.viewport[2]=i,e.viewport[3]=a,e.realViewport.call(r,t,n,i,a)},this.isPatched=!0,A(t)}},L.prototype.unpatch=function(){if(this.isPatched){var e=this.gl,t=this.gl.canvas;s()||(Object.defineProperty(t,"width",this.realCanvasWidth),Object.defineProperty(t,"height",this.realCanvasHeight)),t.width=this.bufferWidth,t.height=this.bufferHeight,e.bindFramebuffer=this.realBindFramebuffer,e.enable=this.realEnable,e.disable=this.realDisable,e.colorMask=this.realColorMask,e.clearColor=this.realClearColor,e.viewport=this.realViewport,this.lastBoundFramebuffer==this.framebuffer&&e.bindFramebuffer(e.FRAMEBUFFER,null),this.isPatched=!1,setTimeout((function(){A(t)}),1)}},L.prototype.setTextureBounds=function(e,t){e||(e=[0,0,.5,1]),t||(t=[.5,0,.5,1]),this.viewportOffsetScale[0]=e[0],this.viewportOffsetScale[1]=e[1],this.viewportOffsetScale[2]=e[2],this.viewportOffsetScale[3]=e[3],this.viewportOffsetScale[4]=t[0],this.viewportOffsetScale[5]=t[1],this.viewportOffsetScale[6]=t[2],this.viewportOffsetScale[7]=t[3]},L.prototype.submitFrame=function(){var e=this.gl,t=this,r=[];if(this.dirtySubmitFrameBindings||r.push(e.CURRENT_PROGRAM,e.ARRAY_BUFFER_BINDING,e.ELEMENT_ARRAY_BUFFER_BINDING,e.TEXTURE_BINDING_2D,e.TEXTURE0),E(e,r,(function(e){t.realBindFramebuffer.call(e,e.FRAMEBUFFER,null),t.cullFace&&t.realDisable.call(e,e.CULL_FACE),t.depthTest&&t.realDisable.call(e,e.DEPTH_TEST),t.blend&&t.realDisable.call(e,e.BLEND),t.scissorTest&&t.realDisable.call(e,e.SCISSOR_TEST),t.stencilTest&&t.realDisable.call(e,e.STENCIL_TEST),t.realColorMask.call(e,!0,!0,!0,!0),t.realViewport.call(e,0,0,e.drawingBufferWidth,e.drawingBufferHeight),(t.ctxAttribs.alpha||s())&&(t.realClearColor.call(e,0,0,0,1),e.clear(e.COLOR_BUFFER_BIT)),e.useProgram(t.program),e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,t.indexBuffer),e.bindBuffer(e.ARRAY_BUFFER,t.vertexBuffer),e.enableVertexAttribArray(t.attribs.position),e.enableVertexAttribArray(t.attribs.texCoord),e.vertexAttribPointer(t.attribs.position,2,e.FLOAT,!1,20,0),e.vertexAttribPointer(t.attribs.texCoord,3,e.FLOAT,!1,20,8),e.activeTexture(e.TEXTURE0),e.uniform1i(t.uniforms.diffuse,0),e.bindTexture(e.TEXTURE_2D,t.renderTarget),e.uniform4fv(t.uniforms.viewportOffsetScale,t.viewportOffsetScale),e.drawElements(e.TRIANGLES,t.indexCount,e.UNSIGNED_SHORT,0),t.cardboardUI&&t.cardboardUI.renderNoState(),t.realBindFramebuffer.call(t.gl,e.FRAMEBUFFER,t.framebuffer),t.ctxAttribs.preserveDrawingBuffer||(t.realClearColor.call(e,0,0,0,0),e.clear(e.COLOR_BUFFER_BIT)),t.dirtySubmitFrameBindings||t.realBindFramebuffer.call(e,e.FRAMEBUFFER,t.lastBoundFramebuffer),t.cullFace&&t.realEnable.call(e,e.CULL_FACE),t.depthTest&&t.realEnable.call(e,e.DEPTH_TEST),t.blend&&t.realEnable.call(e,e.BLEND),t.scissorTest&&t.realEnable.call(e,e.SCISSOR_TEST),t.stencilTest&&t.realEnable.call(e,e.STENCIL_TEST),t.realColorMask.apply(e,t.colorMask),t.realViewport.apply(e,t.viewport),!t.ctxAttribs.alpha&&t.ctxAttribs.preserveDrawingBuffer||t.realClearColor.apply(e,t.clearColor)})),s()){var n=e.canvas;n.width==t.bufferWidth&&n.height==t.bufferHeight||(t.bufferWidth=n.width,t.bufferHeight=n.height,t.onResize())}},L.prototype.updateDeviceInfo=function(e){var t=this.gl,r=this,n=[t.ARRAY_BUFFER_BINDING,t.ELEMENT_ARRAY_BUFFER_BINDING];E(t,n,(function(t){var n=r.computeMeshVertices_(r.meshWidth,r.meshHeight,e);if(t.bindBuffer(t.ARRAY_BUFFER,r.vertexBuffer),t.bufferData(t.ARRAY_BUFFER,n,t.STATIC_DRAW),!r.indexCount){var i=r.computeMeshIndices_(r.meshWidth,r.meshHeight);t.bindBuffer(t.ELEMENT_ARRAY_BUFFER,r.indexBuffer),t.bufferData(t.ELEMENT_ARRAY_BUFFER,i,t.STATIC_DRAW),r.indexCount=i.length}}))},L.prototype.computeMeshVertices_=function(e,t,r){for(var n=new Float32Array(2*e*t*5),i=r.getLeftEyeVisibleTanAngles(),a=r.getLeftEyeNoLensTanAngles(),s=r.getLeftEyeVisibleScreenRect(a),l=0,c=0;c<2;c++){for(var u=0;u<t;u++)for(var h=0;h<e;h++,l++){var d=h/(e-1),p=u/(t-1),f=d,m=p,v=o(i[0],i[2],d),g=o(i[3],i[1],p),y=Math.sqrt(v*v+g*g),x=r.distortion.distortInverse(y),b=g*x/y;d=(v*x/y-a[0])/(a[2]-a[0]),p=(b-a[3])/(a[1]-a[3]),d=2*(s.x+d*s.width-.5),p=2*(s.y+p*s.height-.5),n[5*l+0]=d,n[5*l+1]=p,n[5*l+2]=f,n[5*l+3]=m,n[5*l+4]=c}var A=i[2]-i[0];i[0]=-(A+i[0]),i[2]=A-i[2],A=a[2]-a[0],a[0]=-(A+a[0]),a[2]=A-a[2],s.x=1-(s.x+s.width)}return n},L.prototype.computeMeshIndices_=function(e,t){for(var r=new Uint16Array(2*(e-1)*(t-1)*6),n=e/2,i=t/2,a=0,o=0,s=0;s<2;s++)for(var l=0;l<t;l++)for(var c=0;c<e;c++,a++)0!=c&&0!=l&&(c<=n==l<=i?(r[o++]=a,r[o++]=a-e-1,r[o++]=a-e,r[o++]=a-e-1,r[o++]=a,r[o++]=a-1):(r[o++]=a-1,r[o++]=a-e,r[o++]=a,r[o++]=a-e,r[o++]=a-1,r[o++]=a-e-1));return r},L.prototype.getOwnPropertyDescriptor_=function(e,t){var r=Object.getOwnPropertyDescriptor(e,t);return void 0!==r.get&&void 0!==r.set||(r.configurable=!0,r.enumerable=!0,r.get=function(){return this.getAttribute(t)},r.set=function(e){this.setAttribute(t,e)}),r};var C=["attribute vec2 position;","uniform mat4 projectionMat;","void main() {"," gl_Position = projectionMat * vec4( position, -1.0, 1.0 );","}"].join("\n"),P=["precision mediump float;","uniform vec4 color;","void main() {"," gl_FragColor = color;","}"].join("\n"),D=Math.PI/180,I=.3125;function O(e){this.gl=e,this.attribs={position:0},this.program=g(e,C,P,this.attribs),this.uniforms=y(e,this.program),this.vertexBuffer=e.createBuffer(),this.gearOffset=0,this.gearVertexCount=0,this.arrowOffset=0,this.arrowVertexCount=0,this.projMat=new Float32Array(16),this.listener=null,this.onResize()}function B(e){this.coefficients=e}O.prototype.destroy=function(){var e=this.gl;this.listener&&e.canvas.removeEventListener("click",this.listener,!1),e.deleteProgram(this.program),e.deleteBuffer(this.vertexBuffer)},O.prototype.listen=function(e,t){var r=this.gl.canvas;this.listener=function(n){var i=r.clientWidth/2;n.clientX>i-42&&n.clientX<i+42&&n.clientY>r.clientHeight-42?e(n):n.clientX<42&&n.clientY<42&&t(n)},r.addEventListener("click",this.listener,!1)},O.prototype.onResize=function(){var e=this.gl,t=this,r=[e.ARRAY_BUFFER_BINDING];E(e,r,(function(e){var r=[],n=e.drawingBufferWidth/2,i=Math.max(screen.width,screen.height)*window.devicePixelRatio,a=e.drawingBufferWidth/i*window.devicePixelRatio,o=4*a/2,s=42*a,l=28*a/2,c=14*a;function u(e,t){var i=(90-e)*D,a=Math.cos(i),o=Math.sin(i);r.push(I*a*l+n,I*o*l+l),r.push(t*a*l+n,t*o*l+l)}r.push(n-o,s),r.push(n-o,e.drawingBufferHeight),r.push(n+o,s),r.push(n+o,e.drawingBufferHeight),t.gearOffset=r.length/2;for(var h=0;h<=6;h++){var d=60*h;u(d,1),u(d+12,1),u(d+20,.75),u(d+40,.75),u(d+48,1)}function p(t,n){r.push(c+t,e.drawingBufferHeight-c-n)}t.gearVertexCount=r.length/2-t.gearOffset,t.arrowOffset=r.length/2;var f=o/Math.sin(45*D);p(0,l),p(l,0),p(l+f,f),p(f,l+f),p(f,l-f),p(0,l),p(l,2*l),p(l+f,2*l-f),p(f,l-f),p(0,l),p(f,l-o),p(28*a,l-o),p(f,l+o),p(28*a,l+o),t.arrowVertexCount=r.length/2-t.arrowOffset,e.bindBuffer(e.ARRAY_BUFFER,t.vertexBuffer),e.bufferData(e.ARRAY_BUFFER,new Float32Array(r),e.STATIC_DRAW)}))},O.prototype.render=function(){var e=this.gl,t=this,r=[e.CULL_FACE,e.DEPTH_TEST,e.BLEND,e.SCISSOR_TEST,e.STENCIL_TEST,e.COLOR_WRITEMASK,e.VIEWPORT,e.CURRENT_PROGRAM,e.ARRAY_BUFFER_BINDING];E(e,r,(function(e){e.disable(e.CULL_FACE),e.disable(e.DEPTH_TEST),e.disable(e.BLEND),e.disable(e.SCISSOR_TEST),e.disable(e.STENCIL_TEST),e.colorMask(!0,!0,!0,!0),e.viewport(0,0,e.drawingBufferWidth,e.drawingBufferHeight),t.renderNoState()}))},O.prototype.renderNoState=function(){var e,t,r,n,i,a,o,s,l,c,u=this.gl;u.useProgram(this.program),u.bindBuffer(u.ARRAY_BUFFER,this.vertexBuffer),u.enableVertexAttribArray(this.attribs.position),u.vertexAttribPointer(this.attribs.position,2,u.FLOAT,!1,8,0),u.uniform4f(this.uniforms.color,1,1,1,1),e=this.projMat,t=0,r=u.drawingBufferWidth,n=0,i=u.drawingBufferHeight,s=1/(t-r),l=1/(n-i),c=1/((a=.1)-(o=1024)),e[0]=-2*s,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=-2*l,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=2*c,e[11]=0,e[12]=(t+r)*s,e[13]=(i+n)*l,e[14]=(o+a)*c,e[15]=1,u.uniformMatrix4fv(this.uniforms.projectionMat,!1,this.projMat),u.drawArrays(u.TRIANGLE_STRIP,0,4),u.drawArrays(u.TRIANGLE_STRIP,this.gearOffset,this.gearVertexCount),u.drawArrays(u.TRIANGLE_STRIP,this.arrowOffset,this.arrowVertexCount)},B.prototype.distortInverse=function(e){for(var t=0,r=1,n=e-this.distort(t);Math.abs(r-t)>1e-4;){var i=e-this.distort(r),a=r-i*((r-t)/(i-n));t=r,r=a,n=i}return r},B.prototype.distort=function(e){for(var t=e*e,r=0,n=0;n<this.coefficients.length;n++)r=t*(r+this.coefficients[n]);return(r+1)*e};var F=Math.PI/180,U=180/Math.PI,N=function(e,t,r){this.x=e||0,this.y=t||0,this.z=r||0};N.prototype={constructor:N,set:function(e,t,r){return this.x=e,this.y=t,this.z=r,this},copy:function(e){return this.x=e.x,this.y=e.y,this.z=e.z,this},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)},normalize:function(){var e=this.length();if(0!==e){var t=1/e;this.multiplyScalar(t)}else this.x=0,this.y=0,this.z=0;return this},multiplyScalar:function(e){this.x*=e,this.y*=e,this.z*=e},applyQuaternion:function(e){var t=this.x,r=this.y,n=this.z,i=e.x,a=e.y,o=e.z,s=e.w,l=s*t+a*n-o*r,c=s*r+o*t-i*n,u=s*n+i*r-a*t,h=-i*t-a*r-o*n;return this.x=l*s+h*-i+c*-o-u*-a,this.y=c*s+h*-a+u*-i-l*-o,this.z=u*s+h*-o+l*-a-c*-i,this},dot:function(e){return this.x*e.x+this.y*e.y+this.z*e.z},crossVectors:function(e,t){var r=e.x,n=e.y,i=e.z,a=t.x,o=t.y,s=t.z;return this.x=n*s-i*o,this.y=i*a-r*s,this.z=r*o-n*a,this}};var G,z,k=function(e,t,r,n){this.x=e||0,this.y=t||0,this.z=r||0,this.w=void 0!==n?n:1};function H(e){this.width=e.width||f(),this.height=e.height||m(),this.widthMeters=e.widthMeters,this.heightMeters=e.heightMeters,this.bevelMeters=e.bevelMeters}k.prototype={constructor:k,set:function(e,t,r,n){return this.x=e,this.y=t,this.z=r,this.w=n,this},copy:function(e){return this.x=e.x,this.y=e.y,this.z=e.z,this.w=e.w,this},setFromEulerXYZ:function(e,t,r){var n=Math.cos(e/2),i=Math.cos(t/2),a=Math.cos(r/2),o=Math.sin(e/2),s=Math.sin(t/2),l=Math.sin(r/2);return this.x=o*i*a+n*s*l,this.y=n*s*a-o*i*l,this.z=n*i*l+o*s*a,this.w=n*i*a-o*s*l,this},setFromEulerYXZ:function(e,t,r){var n=Math.cos(e/2),i=Math.cos(t/2),a=Math.cos(r/2),o=Math.sin(e/2),s=Math.sin(t/2),l=Math.sin(r/2);return this.x=o*i*a+n*s*l,this.y=n*s*a-o*i*l,this.z=n*i*l-o*s*a,this.w=n*i*a+o*s*l,this},setFromAxisAngle:function(e,t){var r=t/2,n=Math.sin(r);return this.x=e.x*n,this.y=e.y*n,this.z=e.z*n,this.w=Math.cos(r),this},multiply:function(e){return this.multiplyQuaternions(this,e)},multiplyQuaternions:function(e,t){var r=e.x,n=e.y,i=e.z,a=e.w,o=t.x,s=t.y,l=t.z,c=t.w;return this.x=r*c+a*o+n*l-i*s,this.y=n*c+a*s+i*o-r*l,this.z=i*c+a*l+r*s-n*o,this.w=a*c-r*o-n*s-i*l,this},inverse:function(){return this.x*=-1,this.y*=-1,this.z*=-1,this.normalize(),this},normalize:function(){var e=Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w);return 0===e?(this.x=0,this.y=0,this.z=0,this.w=1):(e=1/e,this.x=this.x*e,this.y=this.y*e,this.z=this.z*e,this.w=this.w*e),this},slerp:function(e,t){if(0===t)return this;if(1===t)return this.copy(e);var r=this.x,n=this.y,i=this.z,a=this.w,o=a*e.w+r*e.x+n*e.y+i*e.z;if(o<0?(this.w=-e.w,this.x=-e.x,this.y=-e.y,this.z=-e.z,o=-o):this.copy(e),o>=1)return this.w=a,this.x=r,this.y=n,this.z=i,this;var s=Math.acos(o),l=Math.sqrt(1-o*o);if(Math.abs(l)<.001)return this.w=.5*(a+this.w),this.x=.5*(r+this.x),this.y=.5*(n+this.y),this.z=.5*(i+this.z),this;var c=Math.sin((1-t)*s)/l,u=Math.sin(t*s)/l;return this.w=a*c+this.w*u,this.x=r*c+this.x*u,this.y=n*c+this.y*u,this.z=i*c+this.z*u,this},setFromUnitVectors:function(e,t){return void 0===G&&(G=new N),(z=e.dot(t)+1)<1e-6?(z=0,Math.abs(e.x)>Math.abs(e.z)?G.set(-e.y,e.x,0):G.set(0,-e.z,e.y)):G.crossVectors(e,t),this.x=G.x,this.y=G.y,this.z=G.z,this.w=z,this.normalize(),this}};var V=new H({widthMeters:.11,heightMeters:.062,bevelMeters:.004}),j=new H({widthMeters:.1038,heightMeters:.0584,bevelMeters:.004}),W={CardboardV1:new X({id:"CardboardV1",label:"Cardboard I/O 2014",fov:40,interLensDistance:.06,baselineLensDistance:.035,screenLensDistance:.042,distortionCoefficients:[.441,.156],inverseCoefficients:[-.4410035,.42756155,-.4804439,.5460139,-.58821183,.5733938,-.48303202,.33299083,-.17573841,.0651772,-.01488963,.001559834]}),CardboardV2:new X({id:"CardboardV2",label:"Cardboard I/O 2015",fov:60,interLensDistance:.064,baselineLensDistance:.035,screenLensDistance:.039,distortionCoefficients:[.34,.55],inverseCoefficients:[-.33836704,-.18162185,.862655,-1.2462051,1.0560602,-.58208317,.21609078,-.05444823,.009177956,-.0009904169,6183535e-11,-16981803e-13]})};function q(e,t){this.viewer=W.CardboardV2,this.updateDeviceParams(e),this.distortion=new B(this.viewer.distortionCoefficients);for(var r=0;r<t.length;r++){var n=t[r];W[n.id]=new X(n)}}function X(e){this.id=e.id,this.label=e.label,this.fov=e.fov,this.interLensDistance=e.interLensDistance,this.baselineLensDistance=e.baselineLensDistance,this.screenLensDistance=e.screenLensDistance,this.distortionCoefficients=e.distortionCoefficients,this.inverseCoefficients=e.inverseCoefficients}q.prototype.updateDeviceParams=function(e){this.device=this.determineDevice_(e)||this.device},q.prototype.getDevice=function(){return this.device},q.prototype.setViewer=function(e){this.viewer=e,this.distortion=new B(this.viewer.distortionCoefficients)},q.prototype.determineDevice_=function(e){if(!e)return s()?(console.warn("Using fallback iOS device measurements."),j):(console.warn("Using fallback Android device measurements."),V);var t=.0254/e.xdpi,r=.0254/e.ydpi;return new H({widthMeters:t*f(),heightMeters:r*m(),bevelMeters:.001*e.bevelMm})},q.prototype.getDistortedFieldOfViewLeftEye=function(){var e=this.viewer,t=this.device,r=this.distortion,n=e.screenLensDistance,i=(t.widthMeters-e.interLensDistance)/2,a=e.interLensDistance/2,o=e.baselineLensDistance-t.bevelMeters,s=t.heightMeters-o,l=U*Math.atan(r.distort(i/n)),c=U*Math.atan(r.distort(a/n)),u=U*Math.atan(r.distort(o/n)),h=U*Math.atan(r.distort(s/n));return{leftDegrees:Math.min(l,e.fov),rightDegrees:Math.min(c,e.fov),downDegrees:Math.min(u,e.fov),upDegrees:Math.min(h,e.fov)}},q.prototype.getLeftEyeVisibleTanAngles=function(){var e=this.viewer,t=this.device,r=this.distortion,n=Math.tan(-F*e.fov),i=Math.tan(F*e.fov),a=Math.tan(F*e.fov),o=Math.tan(-F*e.fov),s=t.widthMeters/4,l=t.heightMeters/2,c=e.baselineLensDistance-t.bevelMeters-l,u=e.interLensDistance/2-s,h=-c,d=e.screenLensDistance,p=r.distort((u-s)/d),f=r.distort((h+l)/d),m=r.distort((u+s)/d),v=r.distort((h-l)/d),g=new Float32Array(4);return g[0]=Math.max(n,p),g[1]=Math.min(i,f),g[2]=Math.min(a,m),g[3]=Math.max(o,v),g},q.prototype.getLeftEyeNoLensTanAngles=function(){var e=this.viewer,t=this.device,r=this.distortion,n=new Float32Array(4),i=r.distortInverse(Math.tan(-F*e.fov)),a=r.distortInverse(Math.tan(F*e.fov)),o=r.distortInverse(Math.tan(F*e.fov)),s=r.distortInverse(Math.tan(-F*e.fov)),l=t.widthMeters/4,c=t.heightMeters/2,u=e.baselineLensDistance-t.bevelMeters-c,h=e.interLensDistance/2-l,d=-u,p=e.screenLensDistance,f=(h-l)/p,m=(d+c)/p,v=(h+l)/p,g=(d-c)/p;return n[0]=Math.max(i,f),n[1]=Math.min(a,m),n[2]=Math.min(o,v),n[3]=Math.max(s,g),n},q.prototype.getLeftEyeVisibleScreenRect=function(e){var t=this.viewer,r=this.device,n=t.screenLensDistance,i=(r.widthMeters-t.interLensDistance)/2,a=t.baselineLensDistance-r.bevelMeters,o=(e[0]*n+i)/r.widthMeters,s=(e[1]*n+a)/r.heightMeters,l=(e[2]*n+i)/r.widthMeters,c=(e[3]*n+a)/r.heightMeters;return{x:o,y:c,width:l-o,height:s-c}},q.prototype.getFieldOfViewLeftEye=function(e){return e?this.getUndistortedFieldOfViewLeftEye():this.getDistortedFieldOfViewLeftEye()},q.prototype.getFieldOfViewRightEye=function(e){var t=this.getFieldOfViewLeftEye(e);return{leftDegrees:t.rightDegrees,rightDegrees:t.leftDegrees,upDegrees:t.upDegrees,downDegrees:t.downDegrees}},q.prototype.getUndistortedFieldOfViewLeftEye=function(){var e=this.getUndistortedParams_();return{leftDegrees:U*Math.atan(e.outerDist),rightDegrees:U*Math.atan(e.innerDist),downDegrees:U*Math.atan(e.bottomDist),upDegrees:U*Math.atan(e.topDist)}},q.prototype.getUndistortedViewportLeftEye=function(){var e=this.getUndistortedParams_(),t=this.viewer,r=this.device,n=t.screenLensDistance,i=r.widthMeters/n,a=r.heightMeters/n,o=r.width/i,s=r.height/a,l=Math.round((e.eyePosX-e.outerDist)*o),c=Math.round((e.eyePosY-e.bottomDist)*s);return{x:l,y:c,width:Math.round((e.eyePosX+e.innerDist)*o)-l,height:Math.round((e.eyePosY+e.topDist)*s)-c}},q.prototype.getUndistortedParams_=function(){var e=this.viewer,t=this.device,r=this.distortion,n=e.screenLensDistance,i=e.interLensDistance/2/n,a=t.widthMeters/n,o=t.heightMeters/n,s=a/2-i,l=(e.baselineLensDistance-t.bevelMeters)/n,c=e.fov,u=r.distortInverse(Math.tan(F*c)),h=Math.min(s,u),d=Math.min(i,u),p=Math.min(l,u);return{outerDist:h,innerDist:d,topDist:Math.min(o-l,u),bottomDist:p,eyePosX:s,eyePosY:l}},q.Viewers=W;var Y={format:1,last_updated:"2018-12-10T17:01:42Z",devices:[{type:"android",rules:[{mdmh:"asus/*/Nexus 7/*"},{ua:"Nexus 7"}],dpi:[320.8,323],bw:3,ac:500},{type:"android",rules:[{mdmh:"asus/*/ASUS_Z00AD/*"},{ua:"ASUS_Z00AD"}],dpi:[403,404.6],bw:3,ac:1e3},{type:"android",rules:[{mdmh:"Google/*/Pixel 2 XL/*"},{ua:"Pixel 2 XL"}],dpi:537.9,bw:3,ac:1e3},{type:"android",rules:[{mdmh:"Google/*/Pixel 3 XL/*"},{ua:"Pixel 3 XL"}],dpi:[558.5,553.8],bw:3,ac:1e3},{type:"android",rules:[{mdmh:"Google/*/Pixel XL/*"},{ua:"Pixel XL"}],dpi:[537.9,533],bw:3,ac:1e3},{type:"android",rules:[{mdmh:"Google/*/Pixel 3/*"},{ua:"Pixel 3"}],dpi:442.4,bw:3,ac:1e3},{type:"android",rules:[{mdmh:"Google/*/Pixel 2/*"},{ua:"Pixel 2"}],dpi:441,bw:3,ac:500},{type:"android",rules:[{mdmh:"Google/*/Pixel/*"},{ua:"Pixel"}],dpi:[432.6,436.7],bw:3,ac:1e3},{type:"android",rules:[{mdmh:"HTC/*/HTC6435LVW/*"},{ua:"HTC6435LVW"}],dpi:[449.7,443.3],bw:3,ac:1e3},{type:"android",rules:[{mdmh:"HTC/*/HTC One XL/*"},{ua:"HTC One XL"}],dpi:[315.3,314.6],bw:3,ac:1e3},{type:"android",rules:[{mdmh:"htc/*/Nexus 9/*"},{ua:"Nexus 9"}],dpi:289,bw:3,ac:500},{type:"android",rules:[{mdmh:"HTC/*/HTC One M9/*"},{ua:"HTC One M9"}],dpi:[442.5,443.3],bw:3,ac:500},{type:"android",rules:[{mdmh:"HTC/*/HTC One_M8/*"},{ua:"HTC One_M8"}],dpi:[449.7,447.4],bw:3,ac:500},{type:"android",rules:[{mdmh:"HTC/*/HTC One/*"},{ua:"HTC One"}],dpi:472.8,bw:3,ac:1e3},{type:"android",rules:[{mdmh:"Huawei/*/Nexus 6P/*"},{ua:"Nexus 6P"}],dpi:[515.1,518],bw:3,ac:1e3},{type:"android",rules:[{mdmh:"Huawei/*/BLN-L24/*"},{ua:"HONORBLN-L24"}],dpi:480,bw:4,ac:500},{type:"android",rules:[{mdmh:"Huawei/*/BKL-L09/*"},{ua:"BKL-L09"}],dpi:403,bw:3.47,ac:500},{type:"android",rules:[{mdmh:"LENOVO/*/Lenovo PB2-690Y/*"},{ua:"Lenovo PB2-690Y"}],dpi:[457.2,454.713],bw:3,ac:500},{type:"android",rules:[{mdmh:"LGE/*/Nexus 5X/*"},{ua:"Nexus 5X"}],dpi:[422,419.9],bw:3,ac:1e3},{type:"android",rules:[{mdmh:"LGE/*/LGMS345/*"},{ua:"LGMS345"}],dpi:[221.7,219.1],bw:3,ac:500},{type:"android",rules:[{mdmh:"LGE/*/LG-D800/*"},{ua:"LG-D800"}],dpi:[422,424.1],bw:3,ac:500},{type:"android",rules:[{mdmh:"LGE/*/LG-D850/*"},{ua:"LG-D850"}],dpi:[537.9,541.9],bw:3,ac:500},{type:"android",rules:[{mdmh:"LGE/*/VS985 4G/*"},{ua:"VS985 4G"}],dpi:[537.9,535.6],bw:3,ac:1e3},{type:"android",rules:[{mdmh:"LGE/*/Nexus 5/*"},{ua:"Nexus 5 B"}],dpi:[442.4,444.8],bw:3,ac:1e3},{type:"android",rules:[{mdmh:"LGE/*/Nexus 4/*"},{ua:"Nexus 4"}],dpi:[319.8,318.4],bw:3,ac:1e3},{type:"android",rules:[{mdmh:"LGE/*/LG-P769/*"},{ua:"LG-P769"}],dpi:[240.6,247.5],bw:3,ac:1e3},{type:"android",rules:[{mdmh:"LGE/*/LGMS323/*"},{ua:"LGMS323"}],dpi:[206.6,204.6],bw:3,ac:1e3},{type:"android",rules:[{mdmh:"LGE/*/LGLS996/*"},{ua:"LGLS996"}],dpi:[403.4,401.5],bw:3,ac:1e3},{type:"android",rules:[{mdmh:"Micromax/*/4560MMX/*"},{ua:"4560MMX"}],dpi:[240,219.4],bw:3,ac:1e3},{type:"android",rules:[{mdmh:"Micromax/*/A250/*"},{ua:"Micromax A250"}],dpi:[480,446.4],bw:3,ac:1e3},{type:"android",rules:[{mdmh:"Micromax/*/Micromax AQ4501/*"},{ua:"Micromax AQ4501"}],dpi:240,bw:3,ac:500},{type:"android",rules:[{mdmh:"motorola/*/G5/*"},{ua:"Moto G (5) Plus"}],dpi:[403.4,403],bw:3,ac:1e3},{type:"android",rules:[{mdmh:"motorola/*/DROID RAZR/*"},{ua:"DROID RAZR"}],dpi:[368.1,256.7],bw:3,ac:1e3},{type:"android",rules:[{mdmh:"motorola/*/XT830C/*"},{ua:"XT830C"}],dpi:[254,255.9],bw:3,ac:1e3},{type:"android",rules:[{mdmh:"motorola/*/XT1021/*"},{ua:"XT1021"}],dpi:[254,256.7],bw:3,ac:500},{type:"android",rules:[{mdmh:"motorola/*/XT1023/*"},{ua:"XT1023"}],dpi:[254,256.7],bw:3,ac:500},{type:"android",rules:[{mdmh:"motorola/*/XT1028/*"},{ua:"XT1028"}],dpi:[326.6,327.6],bw:3,ac:1e3},{type:"android",rules:[{mdmh:"motorola/*/XT1034/*"},{ua:"XT1034"}],dpi:[326.6,328.4],bw:3,ac:500},{type:"android",rules:[{mdmh:"motorola/*/XT1053/*"},{ua:"XT1053"}],dpi:[315.3,316.1],bw:3,ac:1e3},{type:"android",rules:[{mdmh:"motorola/*/XT1562/*"},{ua:"XT1562"}],dpi:[403.4,402.7],bw:3,ac:1e3},{type:"android",rules:[{mdmh:"motorola/*/Nexus 6/*"},{ua:"Nexus 6 B"}],dpi:[494.3,489.7],bw:3,ac:1e3},{type:"android",rules:[{mdmh:"motorola/*/XT1063/*"},{ua:"XT1063"}],dpi:[295,296.6],bw:3,ac:1e3},{type:"android",rules:[{mdmh:"motorola/*/XT1064/*"},{ua:"XT1064"}],dpi:[295,295.6],bw:3,ac:500},{type:"android",rules:[{mdmh:"motorola/*/XT1092/*"},{ua:"XT1092"}],dpi:[422,424.1],bw:3,ac:500},{type:"android",rules:[{mdmh:"motorola/*/XT1095/*"},{ua:"XT1095"}],dpi:[422,423.4],bw:3,ac:1e3},{type:"android",rules:[{mdmh:"motorola/*/G4/*"},{ua:"Moto G (4)"}],dpi:401,bw:4,ac:1e3},{type:"android",rules:[{mdmh:"OnePlus/*/A0001/*"},{ua:"A0001"}],dpi:[403.4,401],bw:3,ac:1e3},{type:"android",rules:[{mdmh:"OnePlus/*/ONE E1005/*"},{ua:"ONE E1005"}],dpi:[442.4,441.4],bw:3,ac:1e3},{type:"android",rules:[{mdmh:"OnePlus/*/ONE A2005/*"},{ua:"ONE A2005"}],dpi:[391.9,405.4],bw:3,ac:1e3},{type:"android",rules:[{mdmh:"OnePlus/*/ONEPLUS A5000/*"},{ua:"ONEPLUS A5000 "}],dpi:[403.411,399.737],bw:3,ac:1e3},{type:"android",rules:[{mdmh:"OnePlus/*/ONE A5010/*"},{ua:"ONEPLUS A5010"}],dpi:[403,400],bw:2,ac:1e3},{type:"android",rules:[{mdmh:"OPPO/*/X909/*"},{ua:"X909"}],dpi:[442.4,444.1],bw:3,ac:1e3},{type:"android",rules:[{mdmh:"samsung/*/GT-I9082/*"},{ua:"GT-I9082"}],dpi:[184.7,185.4],bw:3,ac:1e3},{type:"android",rules:[{mdmh:"samsung/*/SM-G360P/*"},{ua:"SM-G360P"}],dpi:[196.7,205.4],bw:3,ac:1e3},{type:"android",rules:[{mdmh:"samsung/*/Nexus S/*"},{ua:"Nexus S"}],dpi:[234.5,229.8],bw:3,ac:1e3},{type:"android",rules:[{mdmh:"samsung/*/GT-I9300/*"},{ua:"GT-I9300"}],dpi:[304.8,303.9],bw:5,ac:500},{type:"android",rules:[{mdmh:"samsung/*/SM-T230NU/*"},{ua:"SM-T230NU"}],dpi:216,bw:3,ac:500},{type:"android",rules:[{mdmh:"samsung/*/SGH-T399/*"},{ua:"SGH-T399"}],dpi:[217.7,231.4],bw:3,ac:1e3},{type:"android",rules:[{mdmh:"samsung/*/SGH-M919/*"},{ua:"SGH-M919"}],dpi:[440.8,437.7],bw:3,ac:1e3},{type:"android",rules:[{mdmh:"samsung/*/SM-N9005/*"},{ua:"SM-N9005"}],dpi:[386.4,387],bw:3,ac:500},{type:"android",rules:[{mdmh:"samsung/*/SAMSUNG-SM-N900A/*"},{ua:"SAMSUNG-SM-N900A"}],dpi:[386.4,387.7],bw:3,ac:1e3},{type:"android",rules:[{mdmh:"samsung/*/GT-I9500/*"},{ua:"GT-I9500"}],dpi:[442.5,443.3],bw:3,ac:500},{type:"android",rules:[{mdmh:"samsung/*/GT-I9505/*"},{ua:"GT-I9505"}],dpi:439.4,bw:4,ac:1e3},{type:"android",rules:[{mdmh:"samsung/*/SM-G900F/*"},{ua:"SM-G900F"}],dpi:[415.6,431.6],bw:5,ac:1e3},{type:"android",rules:[{mdmh:"samsung/*/SM-G900M/*"},{ua:"SM-G900M"}],dpi:[415.6,431.6],bw:5,ac:1e3},{type:"android",rules:[{mdmh:"samsung/*/SM-G800F/*"},{ua:"SM-G800F"}],dpi:326.8,bw:3,ac:1e3},{type:"android",rules:[{mdmh:"samsung/*/SM-G906S/*"},{ua:"SM-G906S"}],dpi:[562.7,572.4],bw:3,ac:1e3},{type:"android",rules:[{mdmh:"samsung/*/GT-I9300/*"},{ua:"GT-I9300"}],dpi:[306.7,304.8],bw:5,ac:1e3},{type:"android",rules:[{mdmh:"samsung/*/SM-T535/*"},{ua:"SM-T535"}],dpi:[142.6,136.4],bw:3,ac:500},{type:"android",rules:[{mdmh:"samsung/*/SM-N920C/*"},{ua:"SM-N920C"}],dpi:[515.1,518.4],bw:3,ac:1e3},{type:"android",rules:[{mdmh:"samsung/*/SM-N920P/*"},{ua:"SM-N920P"}],dpi:[386.3655,390.144],bw:3,ac:1e3},{type:"android",rules:[{mdmh:"samsung/*/SM-N920W8/*"},{ua:"SM-N920W8"}],dpi:[515.1,518.4],bw:3,ac:1e3},{type:"android",rules:[{mdmh:"samsung/*/GT-I9300I/*"},{ua:"GT-I9300I"}],dpi:[304.8,305.8],bw:3,ac:1e3},{type:"android",rules:[{mdmh:"samsung/*/GT-I9195/*"},{ua:"GT-I9195"}],dpi:[249.4,256.7],bw:3,ac:500},{type:"android",rules:[{mdmh:"samsung/*/SPH-L520/*"},{ua:"SPH-L520"}],dpi:[249.4,255.9],bw:3,ac:1e3},{type:"android",rules:[{mdmh:"samsung/*/SAMSUNG-SGH-I717/*"},{ua:"SAMSUNG-SGH-I717"}],dpi:285.8,bw:3,ac:1e3},{type:"android",rules:[{mdmh:"samsung/*/SPH-D710/*"},{ua:"SPH-D710"}],dpi:[217.7,204.2],bw:3,ac:1e3},{type:"android",rules:[{mdmh:"samsung/*/GT-N7100/*"},{ua:"GT-N7100"}],dpi:265.1,bw:3,ac:1e3},{type:"android",rules:[{mdmh:"samsung/*/SCH-I605/*"},{ua:"SCH-I605"}],dpi:265.1,bw:3,ac:1e3},{type:"android",rules:[{mdmh:"samsung/*/Galaxy Nexus/*"},{ua:"Galaxy Nexus"}],dpi:[315.3,314.2],bw:3,ac:1e3},{type:"android",rules:[{mdmh:"samsung/*/SM-N910H/*"},{ua:"SM-N910H"}],dpi:[515.1,518],bw:3,ac:1e3},{type:"android",rules:[{mdmh:"samsung/*/SM-N910C/*"},{ua:"SM-N910C"}],dpi:[515.2,520.2],bw:3,ac:500},{type:"android",rules:[{mdmh:"samsung/*/SM-G130M/*"},{ua:"SM-G130M"}],dpi:[165.9,164.8],bw:3,ac:500},{type:"android",rules:[{mdmh:"samsung/*/SM-G928I/*"},{ua:"SM-G928I"}],dpi:[515.1,518.4],bw:3,ac:1e3},{type:"android",rules:[{mdmh:"samsung/*/SM-G920F/*"},{ua:"SM-G920F"}],dpi:580.6,bw:3,ac:500},{type:"android",rules:[{mdmh:"samsung/*/SM-G920P/*"},{ua:"SM-G920P"}],dpi:[522.5,577],bw:3,ac:1e3},{type:"android",rules:[{mdmh:"samsung/*/SM-G925F/*"},{ua:"SM-G925F"}],dpi:580.6,bw:3,ac:500},{type:"android",rules:[{mdmh:"samsung/*/SM-G925V/*"},{ua:"SM-G925V"}],dpi:[522.5,576.6],bw:3,ac:1e3},{type:"android",rules:[{mdmh:"samsung/*/SM-G930F/*"},{ua:"SM-G930F"}],dpi:576.6,bw:3,ac:1e3},{type:"android",rules:[{mdmh:"samsung/*/SM-G935F/*"},{ua:"SM-G935F"}],dpi:533,bw:3,ac:500},{type:"android",rules:[{mdmh:"samsung/*/SM-G950F/*"},{ua:"SM-G950F"}],dpi:[562.707,565.293],bw:3,ac:500},{type:"android",rules:[{mdmh:"samsung/*/SM-G955U/*"},{ua:"SM-G955U"}],dpi:[522.514,525.762],bw:3,ac:500},{type:"android",rules:[{mdmh:"samsung/*/SM-G955F/*"},{ua:"SM-G955F"}],dpi:[522.514,525.762],bw:3,ac:500},{type:"android",rules:[{mdmh:"Sony/*/C6903/*"},{ua:"C6903"}],dpi:[442.5,443.3],bw:3,ac:500},{type:"android",rules:[{mdmh:"Sony/*/D6653/*"},{ua:"D6653"}],dpi:[428.6,427.6],bw:3,ac:1e3},{type:"android",rules:[{mdmh:"Sony/*/E6653/*"},{ua:"E6653"}],dpi:[428.6,425.7],bw:3,ac:1e3},{type:"android",rules:[{mdmh:"Sony/*/E6853/*"},{ua:"E6853"}],dpi:[403.4,401.9],bw:3,ac:1e3},{type:"android",rules:[{mdmh:"Sony/*/SGP321/*"},{ua:"SGP321"}],dpi:[224.7,224.1],bw:3,ac:500},{type:"android",rules:[{mdmh:"TCT/*/ALCATEL ONE TOUCH Fierce/*"},{ua:"ALCATEL ONE TOUCH Fierce"}],dpi:[240,247.5],bw:3,ac:1e3},{type:"android",rules:[{mdmh:"THL/*/thl 5000/*"},{ua:"thl 5000"}],dpi:[480,443.3],bw:3,ac:1e3},{type:"android",rules:[{mdmh:"Fly/*/IQ4412/*"},{ua:"IQ4412"}],dpi:307.9,bw:3,ac:1e3},{type:"android",rules:[{mdmh:"ZTE/*/ZTE Blade L2/*"},{ua:"ZTE Blade L2"}],dpi:240,bw:3,ac:500},{type:"android",rules:[{mdmh:"BENEVE/*/VR518/*"},{ua:"VR518"}],dpi:480,bw:3,ac:500},{type:"ios",rules:[{res:[640,960]}],dpi:[325.1,328.4],bw:4,ac:1e3},{type:"ios",rules:[{res:[640,1136]}],dpi:[317.1,320.2],bw:3,ac:1e3},{type:"ios",rules:[{res:[750,1334]}],dpi:326.4,bw:4,ac:1e3},{type:"ios",rules:[{res:[1242,2208]}],dpi:[453.6,458.4],bw:4,ac:1e3},{type:"ios",rules:[{res:[1125,2001]}],dpi:[410.9,415.4],bw:4,ac:1e3},{type:"ios",rules:[{res:[1125,2436]}],dpi:458,bw:4,ac:1e3}]};function Q(e,t){if(this.dpdb=Y,this.recalculateDeviceParams_(),e){this.onDeviceParamsUpdated=t;var r=new XMLHttpRequest,n=this;r.open("GET",e,!0),r.addEventListener("load",(function(){n.loading=!1,r.status>=200&&r.status<=299?(n.dpdb=JSON.parse(r.response),n.recalculateDeviceParams_()):console.error("Error loading online DPDB!")})),r.send()}}function Z(e){this.xdpi=e.xdpi,this.ydpi=e.ydpi,this.bevelMm=e.bevelMm}function J(e,t){this.set(e,t)}function K(e,t){this.kFilter=e,this.isDebug=t,this.currentAccelMeasurement=new J,this.currentGyroMeasurement=new J,this.previousGyroMeasurement=new J,s()?this.filterQ=new k(-1,0,0,1):this.filterQ=new k(1,0,0,1),this.previousFilterQ=new k,this.previousFilterQ.copy(this.filterQ),this.accelQ=new k,this.isOrientationInitialized=!1,this.estimatedGravity=new N,this.measuredGravity=new N,this.gyroIntegralQ=new k}function $(e,t){this.predictionTimeS=e,this.isDebug=t,this.previousQ=new k,this.previousTimestampS=null,this.deltaQ=new k,this.outQ=new k}function ee(e,t,r,n){this.yawOnly=r,this.accelerometer=new N,this.gyroscope=new N,this.filter=new K(e,n),this.posePredictor=new $(t,n),this.isFirefoxAndroid=c(),this.isIOS=s();var i=u();this.isDeviceMotionInRadians=!this.isIOS&&i&&i<66,this.isWithoutDeviceMotion=h(),this.filterToWorldQ=new k,s()?this.filterToWorldQ.setFromAxisAngle(new N(1,0,0),Math.PI/2):this.filterToWorldQ.setFromAxisAngle(new N(1,0,0),-Math.PI/2),this.inverseWorldToScreenQ=new k,this.worldToScreenQ=new k,this.originalPoseAdjustQ=new k,this.originalPoseAdjustQ.setFromAxisAngle(new N(0,0,1),-window.orientation*Math.PI/180),this.setScreenTransform_(),p()&&this.filterToWorldQ.multiply(this.inverseWorldToScreenQ),this.resetQ=new k,this.orientationOut_=new Float32Array(4),this.start()}Q.prototype.getDeviceParams=function(){return this.deviceParams},Q.prototype.recalculateDeviceParams_=function(){var e=this.calcDeviceParams_();e?(this.deviceParams=e,this.onDeviceParamsUpdated&&this.onDeviceParamsUpdated(this.deviceParams)):console.error("Failed to recalculate device parameters.")},Q.prototype.calcDeviceParams_=function(){var e=this.dpdb;if(!e)return console.error("DPDB not available."),null;if(1!=e.format)return console.error("DPDB has unexpected format version."),null;if(!e.devices||!e.devices.length)return console.error("DPDB does not have a devices section."),null;var t=navigator.userAgent||navigator.vendor||window.opera,r=f(),n=m();if(!e.devices)return console.error("DPDB has no devices section."),null;for(var i=0;i<e.devices.length;i++){var a=e.devices[i];if(a.rules)if("ios"==a.type||"android"==a.type){if(s()==("ios"==a.type)){for(var o=!1,l=0;l<a.rules.length;l++){var c=a.rules[l];if(this.ruleMatches_(c,t,r,n)){o=!0;break}}if(o)return new Z({xdpi:a.dpi[0]||a.dpi,ydpi:a.dpi[1]||a.dpi,bevelMm:a.bw})}}else console.warn("Device["+i+"] has invalid type.");else console.warn("Device["+i+"] has no rules section.")}return console.warn("No DPDB device match."),null},Q.prototype.ruleMatches_=function(e,t,r,n){if(!e.ua&&!e.res)return!1;if(e.ua&&"SM"===e.ua.substring(0,2)&&(e.ua=e.ua.substring(0,7)),e.ua&&t.indexOf(e.ua)<0)return!1;if(e.res){if(!e.res[0]||!e.res[1])return!1;var i=e.res[0],a=e.res[1];if(Math.min(r,n)!=Math.min(i,a)||Math.max(r,n)!=Math.max(i,a))return!1}return!0},J.prototype.set=function(e,t){this.sample=e,this.timestampS=t},J.prototype.copy=function(e){this.set(e.sample,e.timestampS)},K.prototype.addAccelMeasurement=function(e,t){this.currentAccelMeasurement.set(e,t)},K.prototype.addGyroMeasurement=function(e,t){this.currentGyroMeasurement.set(e,t);var r,n=t-this.previousGyroMeasurement.timestampS;r=n,isNaN(r)||r<=.001||r>1||this.run_(),this.previousGyroMeasurement.copy(this.currentGyroMeasurement)},K.prototype.run_=function(){if(!this.isOrientationInitialized)return this.accelQ=this.accelToQuaternion_(this.currentAccelMeasurement.sample),this.previousFilterQ.copy(this.accelQ),void(this.isOrientationInitialized=!0);var e=this.currentGyroMeasurement.timestampS-this.previousGyroMeasurement.timestampS,t=this.gyroToQuaternionDelta_(this.currentGyroMeasurement.sample,e);this.gyroIntegralQ.multiply(t),this.filterQ.copy(this.previousFilterQ),this.filterQ.multiply(t);var r=new k;r.copy(this.filterQ),r.inverse(),this.estimatedGravity.set(0,0,-1),this.estimatedGravity.applyQuaternion(r),this.estimatedGravity.normalize(),this.measuredGravity.copy(this.currentAccelMeasurement.sample),this.measuredGravity.normalize();var n,i=new k;i.setFromUnitVectors(this.estimatedGravity,this.measuredGravity),i.inverse(),this.isDebug&&console.log("Delta: %d deg, G_est: (%s, %s, %s), G_meas: (%s, %s, %s)",U*((n=i).w>1?(console.warn("getQuaternionAngle: w > 1"),0):2*Math.acos(n.w)),this.estimatedGravity.x.toFixed(1),this.estimatedGravity.y.toFixed(1),this.estimatedGravity.z.toFixed(1),this.measuredGravity.x.toFixed(1),this.measuredGravity.y.toFixed(1),this.measuredGravity.z.toFixed(1));var a=new k;a.copy(this.filterQ),a.multiply(i),this.filterQ.slerp(a,1-this.kFilter),this.previousFilterQ.copy(this.filterQ)},K.prototype.getOrientation=function(){return this.filterQ},K.prototype.accelToQuaternion_=function(e){var t=new N;t.copy(e),t.normalize();var r=new k;return r.setFromUnitVectors(new N(0,0,-1),t),r.inverse(),r},K.prototype.gyroToQuaternionDelta_=function(e,t){var r=new k,n=new N;return n.copy(e),n.normalize(),r.setFromAxisAngle(n,e.length()*t),r},$.prototype.getPrediction=function(e,t,r){if(!this.previousTimestampS)return this.previousQ.copy(e),this.previousTimestampS=r,e;var n=new N;n.copy(t),n.normalize();var i=t.length();if(i<20*F)return this.isDebug&&console.log("Moving slowly, at %s deg/s: no prediction",(U*i).toFixed(1)),this.outQ.copy(e),this.previousQ.copy(e),this.outQ;var a=i*this.predictionTimeS;return this.deltaQ.setFromAxisAngle(n,a),this.outQ.copy(this.previousQ),this.outQ.multiply(this.deltaQ),this.previousQ.copy(e),this.previousTimestampS=r,this.outQ},ee.prototype.getPosition=function(){return null},ee.prototype.getOrientation=function(){var e=void 0;if(this.isWithoutDeviceMotion&&this._deviceOrientationQ)return this.deviceOrientationFixQ=this.deviceOrientationFixQ||(r=(new k).setFromAxisAngle(new N(0,0,-1),0),n=new k,-90===window.orientation?n.setFromAxisAngle(new N(0,1,0),Math.PI/-2):n.setFromAxisAngle(new N(0,1,0),Math.PI/2),r.multiply(n)),this.deviceOrientationFilterToWorldQ=this.deviceOrientationFilterToWorldQ||((t=new k).setFromAxisAngle(new N(1,0,0),-Math.PI/2),t),e=this._deviceOrientationQ,(i=new k).copy(e),i.multiply(this.deviceOrientationFilterToWorldQ),i.multiply(this.resetQ),i.multiply(this.worldToScreenQ),i.multiplyQuaternions(this.deviceOrientationFixQ,i),this.yawOnly&&(i.x=0,i.z=0,i.normalize()),this.orientationOut_[0]=i.x,this.orientationOut_[1]=i.y,this.orientationOut_[2]=i.z,this.orientationOut_[3]=i.w,this.orientationOut_;var t,r,n,i,a=this.filter.getOrientation();return e=this.posePredictor.getPrediction(a,this.gyroscope,this.previousTimestampS),(i=new k).copy(this.filterToWorldQ),i.multiply(this.resetQ),i.multiply(e),i.multiply(this.worldToScreenQ),this.yawOnly&&(i.x=0,i.z=0,i.normalize()),this.orientationOut_[0]=i.x,this.orientationOut_[1]=i.y,this.orientationOut_[2]=i.z,this.orientationOut_[3]=i.w,this.orientationOut_},ee.prototype.resetPose=function(){this.resetQ.copy(this.filter.getOrientation()),this.resetQ.x=0,this.resetQ.y=0,this.resetQ.z*=-1,this.resetQ.normalize(),p()&&this.resetQ.multiply(this.inverseWorldToScreenQ),this.resetQ.multiply(this.originalPoseAdjustQ)},ee.prototype.onDeviceOrientation_=function(e){this._deviceOrientationQ=this._deviceOrientationQ||new k;var t=e.alpha,r=e.beta,n=e.gamma;t=(t||0)*Math.PI/180,r=(r||0)*Math.PI/180,n=(n||0)*Math.PI/180,this._deviceOrientationQ.setFromEulerYXZ(r,t,-n)},ee.prototype.onDeviceMotion_=function(e){this.updateDeviceMotion_(e)},ee.prototype.updateDeviceMotion_=function(e){var t=e.accelerationIncludingGravity,r=e.rotationRate,n=e.timeStamp/1e3,i=n-this.previousTimestampS;return i<0?(M("fusion-pose-sensor:invalid:non-monotonic","Invalid timestamps detected: non-monotonic timestamp from devicemotion"),void(this.previousTimestampS=n)):i<=.001||i>1?(M("fusion-pose-sensor:invalid:outside-threshold","Invalid timestamps detected: Timestamp from devicemotion outside expected range."),void(this.previousTimestampS=n)):(this.accelerometer.set(-t.x,-t.y,-t.z),d()?this.gyroscope.set(-r.beta,r.alpha,r.gamma):this.gyroscope.set(r.alpha,r.beta,r.gamma),this.isDeviceMotionInRadians||this.gyroscope.multiplyScalar(Math.PI/180),this.filter.addAccelMeasurement(this.accelerometer,n),this.filter.addGyroMeasurement(this.gyroscope,n),void(this.previousTimestampS=n))},ee.prototype.onOrientationChange_=function(e){this.setScreenTransform_()},ee.prototype.onMessage_=function(e){var t=e.data;t&&t.type&&"devicemotion"===t.type.toLowerCase()&&this.updateDeviceMotion_(t.deviceMotionEvent)},ee.prototype.setScreenTransform_=function(){switch(this.worldToScreenQ.set(0,0,0,1),window.orientation){case 0:break;case 90:this.worldToScreenQ.setFromAxisAngle(new N(0,0,1),-Math.PI/2);break;case-90:this.worldToScreenQ.setFromAxisAngle(new N(0,0,1),Math.PI/2)}this.inverseWorldToScreenQ.copy(this.worldToScreenQ),this.inverseWorldToScreenQ.inverse()},ee.prototype.start=function(){var e,t,r;this.onDeviceMotionCallback_=this.onDeviceMotion_.bind(this),this.onOrientationChangeCallback_=this.onOrientationChange_.bind(this),this.onMessageCallback_=this.onMessage_.bind(this),this.onDeviceOrientationCallback_=this.onDeviceOrientation_.bind(this),s()&&(e=window.self!==window.top,t=_(document.referrer),r=_(window.location.href),e&&t!==r)&&window.addEventListener("message",this.onMessageCallback_),window.addEventListener("orientationchange",this.onOrientationChangeCallback_),this.isWithoutDeviceMotion?window.addEventListener("deviceorientation",this.onDeviceOrientationCallback_):window.addEventListener("devicemotion",this.onDeviceMotionCallback_)},ee.prototype.stop=function(){window.removeEventListener("devicemotion",this.onDeviceMotionCallback_),window.removeEventListener("deviceorientation",this.onDeviceOrientationCallback_),window.removeEventListener("orientationchange",this.onOrientationChangeCallback_),window.removeEventListener("message",this.onMessageCallback_)};var te=new N(1,0,0),re=new N(0,0,1),ne=new k;ne.setFromAxisAngle(te,-Math.PI/2),ne.multiply((new k).setFromAxisAngle(re,Math.PI/2));var ie=function(){function e(t){n(this,e),this.config=t,this.sensor=null,this.fusionSensor=null,this._out=new Float32Array(4),this.api=null,this.errors=[],this._sensorQ=new k,this._outQ=new k,this._onSensorRead=this._onSensorRead.bind(this),this._onSensorError=this._onSensorError.bind(this),this.init()}return i(e,[{key:"init",value:function(){var e=null;try{(e=new RelativeOrientationSensor({frequency:60,referenceFrame:"screen"})).addEventListener("error",this._onSensorError)}catch(e){this.errors.push(e),"SecurityError"===e.name?(console.error("Cannot construct sensors due to the Feature Policy"),console.warn('Attempting to fall back using "devicemotion"; however this will fail in the future without correct permissions.'),this.useDeviceMotion()):"ReferenceError"===e.name?this.useDeviceMotion():console.error(e)}e&&(this.api="sensor",this.sensor=e,this.sensor.addEventListener("reading",this._onSensorRead),this.sensor.start())}},{key:"useDeviceMotion",value:function(){this.api="devicemotion",this.fusionSensor=new ee(this.config.K_FILTER,this.config.PREDICTION_TIME_S,this.config.YAW_ONLY,this.config.DEBUG),this.sensor&&(this.sensor.removeEventListener("reading",this._onSensorRead),this.sensor.removeEventListener("error",this._onSensorError),this.sensor=null)}},{key:"getOrientation",value:function(){if(this.fusionSensor)return this.fusionSensor.getOrientation();if(!this.sensor||!this.sensor.quaternion)return this._out[0]=this._out[1]=this._out[2]=0,this._out[3]=1,this._out;var e=this.sensor.quaternion;this._sensorQ.set(e[0],e[1],e[2],e[3]);var t=this._outQ;return t.copy(ne),t.multiply(this._sensorQ),this.config.YAW_ONLY&&(t.x=t.z=0,t.normalize()),this._out[0]=t.x,this._out[1]=t.y,this._out[2]=t.z,this._out[3]=t.w,this._out}},{key:"_onSensorError",value:function(e){this.errors.push(e.error),"NotAllowedError"===e.error.name?console.error("Permission to access sensor was denied"):"NotReadableError"===e.error.name?console.error("Sensor could not be read"):console.error(e.error),this.useDeviceMotion()}},{key:"_onSensorRead",value:function(){}}]),e}();function ae(){this.loadIcon_();var e=document.createElement("div");(a=e.style).position="fixed",a.top=0,a.right=0,a.bottom=0,a.left=0,a.backgroundColor="gray",a.fontFamily="sans-serif",a.zIndex=1e6;var t=document.createElement("img");t.src=this.icon,(a=t.style).marginLeft="25%",a.marginTop="25%",a.width="50%",e.appendChild(t);var r=document.createElement("div");(a=r.style).textAlign="center",a.fontSize="16px",a.lineHeight="24px",a.margin="24px 25%",a.width="50%",r.innerHTML="Place your phone into your Cardboard viewer.",e.appendChild(r);var n=document.createElement("div");(a=n.style).backgroundColor="#CFD8DC",a.position="fixed",a.bottom=0,a.width="100%",a.height="48px",a.padding="14px 24px",a.boxSizing="border-box",a.color="#656A6B",e.appendChild(n);var i=document.createElement("div");i.style.float="left",i.innerHTML="No Cardboard viewer?";var a,o=document.createElement("a");o.href="https://www.google.com/get/cardboard/get-cardboard/",o.innerHTML="get one",o.target="_blank",(a=o.style).float="right",a.fontWeight=600,a.textTransform="uppercase",a.borderLeft="1px solid gray",a.paddingLeft="24px",a.textDecoration="none",a.color="#656A6B",n.appendChild(i),n.appendChild(o),this.overlay=e,this.text=r,this.hide()}ae.prototype.show=function(e){e||this.overlay.parentElement?e&&(this.overlay.parentElement&&this.overlay.parentElement!=e&&this.overlay.parentElement.removeChild(this.overlay),e.appendChild(this.overlay)):document.body.appendChild(this.overlay),this.overlay.style.display="block";var t=this.overlay.querySelector("img").style;p()?(t.width="20%",t.marginLeft="40%",t.marginTop="3%"):(t.width="50%",t.marginLeft="25%",t.marginTop="25%")},ae.prototype.hide=function(){this.overlay.style.display="none"},ae.prototype.showTemporarily=function(e,t){this.show(t),this.timer=setTimeout(this.hide.bind(this),e)},ae.prototype.disableShowTemporarily=function(){clearTimeout(this.timer)},ae.prototype.update=function(){this.disableShowTemporarily(),!p()&&x()?this.show():this.hide()},ae.prototype.loadIcon_=function(){this.icon="data:image/svg+xml,"+encodeURIComponent("<svg width='198' height='240' viewBox='0 0 198 240' xmlns='http://www.w3.org/2000/svg'><g fill='none' fill-rule='evenodd'><path d='M149.625 109.527l6.737 3.891v.886c0 .177.013.36.038.549.01.081.02.162.027.242.14 1.415.974 2.998 2.105 3.999l5.72 5.062.081-.09s4.382-2.53 5.235-3.024l25.97 14.993v54.001c0 .771-.386 1.217-.948 1.217-.233 0-.495-.076-.772-.236l-23.967-13.838-.014.024-27.322 15.775-.85-1.323c-4.731-1.529-9.748-2.74-14.951-3.61a.27.27 0 0 0-.007.024l-5.067 16.961-7.891 4.556-.037-.063v27.59c0 .772-.386 1.217-.948 1.217-.232 0-.495-.076-.772-.236l-42.473-24.522c-.95-.549-1.72-1.877-1.72-2.967v-1.035l-.021.047a5.111 5.111 0 0 0-1.816-.399 5.682 5.682 0 0 0-.546.001 13.724 13.724 0 0 1-1.918-.041c-1.655-.153-3.2-.6-4.404-1.296l-46.576-26.89.005.012-10.278-18.75c-1.001-1.827-.241-4.216 1.698-5.336l56.011-32.345a4.194 4.194 0 0 1 2.099-.572c1.326 0 2.572.659 3.227 1.853l.005-.003.227.413-.006.004a9.63 9.63 0 0 0 1.477 2.018l.277.27c1.914 1.85 4.468 2.801 7.113 2.801 1.949 0 3.948-.517 5.775-1.572.013 0 7.319-4.219 7.319-4.219a4.194 4.194 0 0 1 2.099-.572c1.326 0 2.572.658 3.226 1.853l3.25 5.928.022-.018 6.785 3.917-.105-.182 46.881-26.965m0-1.635c-.282 0-.563.073-.815.218l-46.169 26.556-5.41-3.124-3.005-5.481c-.913-1.667-2.699-2.702-4.66-2.703-1.011 0-2.02.274-2.917.792a3825 3825 0 0 1-7.275 4.195l-.044.024a9.937 9.937 0 0 1-4.957 1.353c-2.292 0-4.414-.832-5.976-2.342l-.252-.245a7.992 7.992 0 0 1-1.139-1.534 1.379 1.379 0 0 0-.06-.122l-.227-.414a1.718 1.718 0 0 0-.095-.154c-.938-1.574-2.673-2.545-4.571-2.545-1.011 0-2.02.274-2.917.792L3.125 155.502c-2.699 1.559-3.738 4.94-2.314 7.538l10.278 18.75c.177.323.448.563.761.704l46.426 26.804c1.403.81 3.157 1.332 5.072 1.508a15.661 15.661 0 0 0 2.146.046 4.766 4.766 0 0 1 .396 0c.096.004.19.011.283.022.109 1.593 1.159 3.323 2.529 4.114l42.472 24.522c.524.302 1.058.455 1.59.455 1.497 0 2.583-1.2 2.583-2.852v-26.562l7.111-4.105a1.64 1.64 0 0 0 .749-.948l4.658-15.593c4.414.797 8.692 1.848 12.742 3.128l.533.829a1.634 1.634 0 0 0 2.193.531l26.532-15.317L193 192.433c.523.302 1.058.455 1.59.455 1.497 0 2.583-1.199 2.583-2.852v-54.001c0-.584-.312-1.124-.818-1.416l-25.97-14.993a1.633 1.633 0 0 0-1.636.001c-.606.351-2.993 1.73-4.325 2.498l-4.809-4.255c-.819-.725-1.461-1.933-1.561-2.936a7.776 7.776 0 0 0-.033-.294 2.487 2.487 0 0 1-.023-.336v-.886c0-.584-.312-1.123-.817-1.416l-6.739-3.891a1.633 1.633 0 0 0-.817-.219' fill='#455A64'/><path d='M96.027 132.636l46.576 26.891c1.204.695 1.979 1.587 2.242 2.541l-.01.007-81.374 46.982h-.001c-1.654-.152-3.199-.6-4.403-1.295l-46.576-26.891 83.546-48.235' fill='#FAFAFA'/><path d='M63.461 209.174c-.008 0-.015 0-.022-.002-1.693-.156-3.228-.609-4.441-1.309l-46.576-26.89a.118.118 0 0 1 0-.203l83.546-48.235a.117.117 0 0 1 .117 0l46.576 26.891c1.227.708 2.021 1.612 2.296 2.611a.116.116 0 0 1-.042.124l-.021.016-81.375 46.981a.11.11 0 0 1-.058.016zm-50.747-28.303l46.401 26.79c1.178.68 2.671 1.121 4.32 1.276l81.272-46.922c-.279-.907-1.025-1.73-2.163-2.387l-46.517-26.857-83.313 48.1z' fill='#607D8B'/><path d='M148.327 165.471a5.85 5.85 0 0 1-.546.001c-1.894-.083-3.302-1.038-3.145-2.132a2.693 2.693 0 0 0-.072-1.105l-81.103 46.822c.628.058 1.272.073 1.918.042.182-.009.364-.009.546-.001 1.894.083 3.302 1.038 3.145 2.132l79.257-45.759' fill='#FFF'/><path d='M69.07 211.347a.118.118 0 0 1-.115-.134c.045-.317-.057-.637-.297-.925-.505-.61-1.555-1.022-2.738-1.074a5.966 5.966 0 0 0-.535.001 14.03 14.03 0 0 1-1.935-.041.117.117 0 0 1-.103-.092.116.116 0 0 1 .055-.126l81.104-46.822a.117.117 0 0 1 .171.07c.104.381.129.768.074 1.153-.045.316.057.637.296.925.506.61 1.555 1.021 2.739 1.073.178.008.357.008.535-.001a.117.117 0 0 1 .064.218l-79.256 45.759a.114.114 0 0 1-.059.016zm-3.405-2.372c.089 0 .177.002.265.006 1.266.056 2.353.488 2.908 1.158.227.274.35.575.36.882l78.685-45.429c-.036 0-.072-.001-.107-.003-1.267-.056-2.354-.489-2.909-1.158-.282-.34-.402-.724-.347-1.107a2.604 2.604 0 0 0-.032-.91L63.846 208.97a13.91 13.91 0 0 0 1.528.012c.097-.005.194-.007.291-.007z' fill='#607D8B'/><path d='M2.208 162.134c-1.001-1.827-.241-4.217 1.698-5.337l56.011-32.344c1.939-1.12 4.324-.546 5.326 1.281l.232.41a9.344 9.344 0 0 0 1.47 2.021l.278.27c3.325 3.214 8.583 3.716 12.888 1.23l7.319-4.22c1.94-1.119 4.324-.546 5.325 1.282l3.25 5.928-83.519 48.229-10.278-18.75z' fill='#FAFAFA'/><path d='M12.486 181.001a.112.112 0 0 1-.031-.005.114.114 0 0 1-.071-.056L2.106 162.19c-1.031-1.88-.249-4.345 1.742-5.494l56.01-32.344a4.328 4.328 0 0 1 2.158-.588c1.415 0 2.65.702 3.311 1.882.01.008.018.017.024.028l.227.414a.122.122 0 0 1 .013.038 9.508 9.508 0 0 0 1.439 1.959l.275.266c1.846 1.786 4.344 2.769 7.031 2.769 1.977 0 3.954-.538 5.717-1.557a.148.148 0 0 1 .035-.013l7.284-4.206a4.321 4.321 0 0 1 2.157-.588c1.427 0 2.672.716 3.329 1.914l3.249 5.929a.116.116 0 0 1-.044.157l-83.518 48.229a.116.116 0 0 1-.059.016zm49.53-57.004c-.704 0-1.41.193-2.041.557l-56.01 32.345c-1.882 1.086-2.624 3.409-1.655 5.179l10.221 18.645 83.317-48.112-3.195-5.829c-.615-1.122-1.783-1.792-3.124-1.792a4.08 4.08 0 0 0-2.04.557l-7.317 4.225a.148.148 0 0 1-.035.013 11.7 11.7 0 0 1-5.801 1.569c-2.748 0-5.303-1.007-7.194-2.835l-.278-.27a9.716 9.716 0 0 1-1.497-2.046.096.096 0 0 1-.013-.037l-.191-.347a.11.11 0 0 1-.023-.029c-.615-1.123-1.783-1.793-3.124-1.793z' fill='#607D8B'/><path d='M42.434 155.808c-2.51-.001-4.697-1.258-5.852-3.365-1.811-3.304-.438-7.634 3.059-9.654l12.291-7.098a7.599 7.599 0 0 1 3.789-1.033c2.51 0 4.697 1.258 5.852 3.365 1.811 3.304.439 7.634-3.059 9.654l-12.291 7.098a7.606 7.606 0 0 1-3.789 1.033zm13.287-20.683a7.128 7.128 0 0 0-3.555.971l-12.291 7.098c-3.279 1.893-4.573 5.942-2.883 9.024 1.071 1.955 3.106 3.122 5.442 3.122a7.13 7.13 0 0 0 3.556-.97l12.291-7.098c3.279-1.893 4.572-5.942 2.883-9.024-1.072-1.955-3.106-3.123-5.443-3.123z' fill='#607D8B'/><path d='M149.588 109.407l6.737 3.89v.887c0 .176.013.36.037.549.011.081.02.161.028.242.14 1.415.973 2.998 2.105 3.999l7.396 6.545c.177.156.358.295.541.415 1.579 1.04 2.95.466 3.062-1.282.049-.784.057-1.595.023-2.429l-.003-.16v-1.151l25.987 15.003v54c0 1.09-.77 1.53-1.72.982l-42.473-24.523c-.95-.548-1.72-1.877-1.72-2.966v-34.033' fill='#FAFAFA'/><path d='M194.553 191.25c-.257 0-.54-.085-.831-.253l-42.472-24.521c-.981-.567-1.779-1.943-1.779-3.068v-34.033h.234v34.033c0 1.051.745 2.336 1.661 2.866l42.473 24.521c.424.245.816.288 1.103.122.285-.164.442-.52.442-1.002v-53.933l-25.753-14.868.003 1.106c.034.832.026 1.654-.024 2.439-.054.844-.396 1.464-.963 1.746-.619.309-1.45.173-2.28-.373a5.023 5.023 0 0 1-.553-.426l-7.397-6.544c-1.158-1.026-1.999-2.625-2.143-4.076a9.624 9.624 0 0 0-.027-.238 4.241 4.241 0 0 1-.038-.564v-.82l-6.68-3.856.117-.202 6.738 3.89.058.034v.954c0 .171.012.351.036.533.011.083.021.165.029.246.138 1.395.948 2.935 2.065 3.923l7.397 6.545c.173.153.35.289.527.406.758.499 1.504.63 2.047.359.49-.243.786-.795.834-1.551.05-.778.057-1.591.024-2.417l-.004-.163v-1.355l.175.1 25.987 15.004.059.033v54.068c0 .569-.198.996-.559 1.204a1.002 1.002 0 0 1-.506.131' fill='#607D8B'/><path d='M145.685 163.161l24.115 13.922-25.978 14.998-1.462-.307c-6.534-2.17-13.628-3.728-21.019-4.616-4.365-.524-8.663 1.096-9.598 3.62a2.746 2.746 0 0 0-.011 1.928c1.538 4.267 4.236 8.363 7.995 12.135l.532.845-25.977 14.997-24.115-13.922 75.518-43.6' fill='#FFF'/><path d='M94.282 220.818l-.059-.033-24.29-14.024.175-.101 75.577-43.634.058.033 24.29 14.024-26.191 15.122-.045-.01-1.461-.307c-6.549-2.174-13.613-3.725-21.009-4.614a13.744 13.744 0 0 0-1.638-.097c-3.758 0-7.054 1.531-7.837 3.642a2.62 2.62 0 0 0-.01 1.848c1.535 4.258 4.216 8.326 7.968 12.091l.016.021.526.835.006.01.064.102-.105.061-25.977 14.998-.058.033zm-23.881-14.057l23.881 13.788 24.802-14.32c.546-.315.846-.489 1.017-.575l-.466-.74c-3.771-3.787-6.467-7.881-8.013-12.168a2.851 2.851 0 0 1 .011-2.008c.815-2.199 4.203-3.795 8.056-3.795.557 0 1.117.033 1.666.099 7.412.891 14.491 2.445 21.041 4.621.836.175 1.215.254 1.39.304l25.78-14.884-23.881-13.788-75.284 43.466z' fill='#607D8B'/><path d='M167.23 125.979v50.871l-27.321 15.773-6.461-14.167c-.91-1.996-3.428-1.738-5.624.574a10.238 10.238 0 0 0-2.33 4.018l-6.46 21.628-27.322 15.774v-50.871l75.518-43.6' fill='#FFF'/><path d='M91.712 220.567a.127.127 0 0 1-.059-.016.118.118 0 0 1-.058-.101v-50.871c0-.042.023-.08.058-.101l75.519-43.6a.117.117 0 0 1 .175.101v50.871c0 .041-.023.08-.059.1l-27.321 15.775a.118.118 0 0 1-.094.01.12.12 0 0 1-.071-.063l-6.46-14.168c-.375-.822-1.062-1.275-1.934-1.275-1.089 0-2.364.686-3.5 1.881a10.206 10.206 0 0 0-2.302 3.972l-6.46 21.627a.118.118 0 0 1-.054.068L91.77 220.551a.12.12 0 0 1-.058.016zm.117-50.92v50.601l27.106-15.65 6.447-21.583a10.286 10.286 0 0 1 2.357-4.065c1.18-1.242 2.517-1.954 3.669-1.954.969 0 1.731.501 2.146 1.411l6.407 14.051 27.152-15.676v-50.601l-75.284 43.466z' fill='#607D8B'/><path d='M168.543 126.213v50.87l-27.322 15.774-6.46-14.168c-.91-1.995-3.428-1.738-5.624.574a10.248 10.248 0 0 0-2.33 4.019l-6.461 21.627-27.321 15.774v-50.87l75.518-43.6' fill='#FFF'/><path d='M93.025 220.8a.123.123 0 0 1-.059-.015.12.12 0 0 1-.058-.101v-50.871c0-.042.023-.08.058-.101l75.518-43.6a.112.112 0 0 1 .117 0c.036.02.059.059.059.1v50.871a.116.116 0 0 1-.059.101l-27.321 15.774a.111.111 0 0 1-.094.01.115.115 0 0 1-.071-.062l-6.46-14.168c-.375-.823-1.062-1.275-1.935-1.275-1.088 0-2.363.685-3.499 1.881a10.19 10.19 0 0 0-2.302 3.971l-6.461 21.628a.108.108 0 0 1-.053.067l-27.322 15.775a.12.12 0 0 1-.058.015zm.117-50.919v50.6l27.106-15.649 6.447-21.584a10.293 10.293 0 0 1 2.357-4.065c1.179-1.241 2.516-1.954 3.668-1.954.969 0 1.732.502 2.147 1.412l6.407 14.051 27.152-15.676v-50.601l-75.284 43.466z' fill='#607D8B'/><path d='M169.8 177.083l-27.322 15.774-6.46-14.168c-.91-1.995-3.428-1.738-5.625.574a10.246 10.246 0 0 0-2.329 4.019l-6.461 21.627-27.321 15.774v-50.87l75.518-43.6v50.87z' fill='#FAFAFA'/><path d='M94.282 220.917a.234.234 0 0 1-.234-.233v-50.871c0-.083.045-.161.117-.202l75.518-43.601a.234.234 0 1 1 .35.202v50.871a.233.233 0 0 1-.116.202l-27.322 15.775a.232.232 0 0 1-.329-.106l-6.461-14.168c-.36-.789-.992-1.206-1.828-1.206-1.056 0-2.301.672-3.415 1.844a10.099 10.099 0 0 0-2.275 3.924l-6.46 21.628a.235.235 0 0 1-.107.136l-27.322 15.774a.23.23 0 0 1-.116.031zm.233-50.969v50.331l26.891-15.525 6.434-21.539a10.41 10.41 0 0 1 2.384-4.112c1.201-1.265 2.569-1.991 3.753-1.991 1.018 0 1.818.526 2.253 1.48l6.354 13.934 26.982-15.578v-50.331l-75.051 43.331z' fill='#607D8B'/><path d='M109.894 199.943c-1.774 0-3.241-.725-4.244-2.12a.224.224 0 0 1 .023-.294.233.233 0 0 1 .301-.023c.78.547 1.705.827 2.75.827 1.323 0 2.754-.439 4.256-1.306 5.311-3.067 9.631-10.518 9.631-16.611 0-1.927-.442-3.56-1.278-4.724a.232.232 0 0 1 .323-.327c1.671 1.172 2.591 3.381 2.591 6.219 0 6.242-4.426 13.863-9.865 17.003-1.574.908-3.084 1.356-4.488 1.356zm-2.969-1.542c.813.651 1.82.877 2.968.877h.001c1.321 0 2.753-.327 4.254-1.194 5.311-3.067 9.632-10.463 9.632-16.556 0-1.979-.463-3.599-1.326-4.761.411 1.035.625 2.275.625 3.635 0 6.243-4.426 13.883-9.865 17.023-1.574.909-3.084 1.317-4.49 1.317-.641 0-1.243-.149-1.799-.341z' fill='#607D8B'/><path d='M113.097 197.23c5.384-3.108 9.748-10.636 9.748-16.814 0-2.051-.483-3.692-1.323-4.86-1.784-1.252-4.374-1.194-7.257.47-5.384 3.108-9.748 10.636-9.748 16.814 0 2.051.483 3.692 1.323 4.86 1.784 1.252 4.374 1.194 7.257-.47' fill='#FAFAFA'/><path d='M108.724 198.614c-1.142 0-2.158-.213-3.019-.817-.021-.014-.04.014-.055-.007-.894-1.244-1.367-2.948-1.367-4.973 0-6.242 4.426-13.864 9.865-17.005 1.574-.908 3.084-1.363 4.49-1.363 1.142 0 2.158.309 3.018.913a.23.23 0 0 1 .056.056c.894 1.244 1.367 2.972 1.367 4.997 0 6.243-4.426 13.783-9.865 16.923-1.574.909-3.084 1.276-4.49 1.276zm-2.718-1.109c.774.532 1.688.776 2.718.776 1.323 0 2.754-.413 4.256-1.28 5.311-3.066 9.631-10.505 9.631-16.598 0-1.909-.434-3.523-1.255-4.685-.774-.533-1.688-.799-2.718-.799-1.323 0-2.755.441-4.256 1.308-5.311 3.066-9.631 10.506-9.631 16.599 0 1.909.434 3.517 1.255 4.679z' fill='#607D8B'/><path d='M149.318 114.262l-9.984 8.878 15.893 11.031 5.589-6.112-11.498-13.797' fill='#FAFAFA'/><path d='M169.676 120.84l-9.748 5.627c-3.642 2.103-9.528 2.113-13.147.024-3.62-2.089-3.601-5.488.041-7.591l9.495-5.608-6.729-3.885-81.836 47.071 45.923 26.514 3.081-1.779c.631-.365.869-.898.618-1.39-2.357-4.632-2.593-9.546-.683-14.262 5.638-13.92 24.509-24.815 48.618-28.07 8.169-1.103 16.68-.967 24.704.394.852.145 1.776.008 2.407-.357l3.081-1.778-25.825-14.91' fill='#FAFAFA'/><path d='M113.675 183.459a.47.47 0 0 1-.233-.062l-45.924-26.515a.468.468 0 0 1 .001-.809l81.836-47.071a.467.467 0 0 1 .466 0l6.729 3.885a.467.467 0 0 1-.467.809l-6.496-3.75-80.9 46.533 44.988 25.973 2.848-1.644c.192-.111.62-.409.435-.773-2.416-4.748-2.658-9.814-.7-14.65 2.806-6.927 8.885-13.242 17.582-18.263 8.657-4.998 19.518-8.489 31.407-10.094 8.198-1.107 16.79-.97 24.844.397.739.125 1.561.007 2.095-.301l2.381-1.374-25.125-14.506a.467.467 0 0 1 .467-.809l25.825 14.91a.467.467 0 0 1 0 .809l-3.081 1.779c-.721.417-1.763.575-2.718.413-7.963-1.351-16.457-1.486-24.563-.392-11.77 1.589-22.512 5.039-31.065 9.977-8.514 4.916-14.456 11.073-17.183 17.805-1.854 4.578-1.623 9.376.666 13.875.37.725.055 1.513-.8 2.006l-3.081 1.78a.476.476 0 0 1-.234.062' fill='#455A64'/><path d='M153.316 128.279c-2.413 0-4.821-.528-6.652-1.586-1.818-1.049-2.82-2.461-2.82-3.975 0-1.527 1.016-2.955 2.861-4.02l9.493-5.607a.233.233 0 1 1 .238.402l-9.496 5.609c-1.696.979-2.628 2.263-2.628 3.616 0 1.34.918 2.608 2.585 3.571 3.549 2.049 9.343 2.038 12.914-.024l9.748-5.628a.234.234 0 0 1 .234.405l-9.748 5.628c-1.858 1.072-4.296 1.609-6.729 1.609' fill='#607D8B'/><path d='M113.675 182.992l-45.913-26.508M113.675 183.342a.346.346 0 0 1-.175-.047l-45.913-26.508a.35.35 0 1 1 .35-.607l45.913 26.508a.35.35 0 0 1-.175.654' fill='#455A64'/><path d='M67.762 156.484v54.001c0 1.09.77 2.418 1.72 2.967l42.473 24.521c.95.549 1.72.11 1.72-.98v-54.001' fill='#FAFAFA'/><path d='M112.727 238.561c-.297 0-.62-.095-.947-.285l-42.473-24.521c-1.063-.613-1.895-2.05-1.895-3.27v-54.001a.35.35 0 1 1 .701 0v54.001c0 .96.707 2.18 1.544 2.663l42.473 24.522c.344.198.661.243.87.122.206-.119.325-.411.325-.799v-54.001a.35.35 0 1 1 .7 0v54.001c0 .655-.239 1.154-.675 1.406a1.235 1.235 0 0 1-.623.162' fill='#455A64'/><path d='M112.86 147.512h-.001c-2.318 0-4.499-.522-6.142-1.471-1.705-.984-2.643-2.315-2.643-3.749 0-1.445.952-2.791 2.68-3.788l12.041-6.953c1.668-.962 3.874-1.493 6.212-1.493 2.318 0 4.499.523 6.143 1.472 1.704.984 2.643 2.315 2.643 3.748 0 1.446-.952 2.791-2.68 3.789l-12.042 6.952c-1.668.963-3.874 1.493-6.211 1.493zm12.147-16.753c-2.217 0-4.298.497-5.861 1.399l-12.042 6.952c-1.502.868-2.33 1.998-2.33 3.182 0 1.173.815 2.289 2.293 3.142 1.538.889 3.596 1.378 5.792 1.378h.001c2.216 0 4.298-.497 5.861-1.399l12.041-6.953c1.502-.867 2.33-1.997 2.33-3.182 0-1.172-.814-2.288-2.292-3.142-1.539-.888-3.596-1.377-5.793-1.377z' fill='#607D8B'/><path d='M165.63 123.219l-5.734 3.311c-3.167 1.828-8.286 1.837-11.433.02-3.147-1.817-3.131-4.772.036-6.601l5.734-3.31 11.397 6.58' fill='#FAFAFA'/><path d='M154.233 117.448l9.995 5.771-4.682 2.704c-1.434.827-3.352 1.283-5.399 1.283-2.029 0-3.923-.449-5.333-1.263-1.29-.744-2-1.694-2-2.674 0-.991.723-1.955 2.036-2.713l5.383-3.108m0-.809l-5.734 3.31c-3.167 1.829-3.183 4.784-.036 6.601 1.568.905 3.623 1.357 5.684 1.357 2.077 0 4.159-.46 5.749-1.377l5.734-3.311-11.397-6.58M145.445 179.667c-1.773 0-3.241-.85-4.243-2.245-.067-.092-.057-.275.023-.356.08-.081.207-.12.3-.055.781.548 1.706.812 2.751.811 1.322 0 2.754-.446 4.256-1.313 5.31-3.066 9.631-10.522 9.631-16.615 0-1.927-.442-3.562-1.279-4.726a.235.235 0 0 1 .024-.301.232.232 0 0 1 .3-.027c1.67 1.172 2.59 3.38 2.59 6.219 0 6.242-4.425 13.987-9.865 17.127-1.573.908-3.083 1.481-4.488 1.481zM142.476 178c.814.651 1.82 1.002 2.969 1.002 1.322 0 2.753-.452 4.255-1.32 5.31-3.065 9.631-10.523 9.631-16.617 0-1.98-.463-3.63-1.325-4.793.411 1.035.624 2.26.624 3.62 0 6.242-4.425 13.875-9.865 17.015-1.573.909-3.084 1.376-4.489 1.376a5.49 5.49 0 0 1-1.8-.283z' fill='#607D8B'/><path d='M148.648 176.704c5.384-3.108 9.748-10.636 9.748-16.813 0-2.052-.483-3.693-1.322-4.861-1.785-1.252-4.375-1.194-7.258.471-5.383 3.108-9.748 10.636-9.748 16.813 0 2.051.484 3.692 1.323 4.86 1.785 1.253 4.374 1.195 7.257-.47' fill='#FAFAFA'/><path d='M144.276 178.276c-1.143 0-2.158-.307-3.019-.911a.217.217 0 0 1-.055-.054c-.895-1.244-1.367-2.972-1.367-4.997 0-6.241 4.425-13.875 9.865-17.016 1.573-.908 3.084-1.369 4.489-1.369 1.143 0 2.158.307 3.019.91a.24.24 0 0 1 .055.055c.894 1.244 1.367 2.971 1.367 4.997 0 6.241-4.425 13.875-9.865 17.016-1.573.908-3.084 1.369-4.489 1.369zm-2.718-1.172c.773.533 1.687.901 2.718.901 1.322 0 2.754-.538 4.256-1.405 5.31-3.066 9.631-10.567 9.631-16.661 0-1.908-.434-3.554-1.256-4.716-.774-.532-1.688-.814-2.718-.814-1.322 0-2.754.433-4.256 1.3-5.31 3.066-9.631 10.564-9.631 16.657 0 1.91.434 3.576 1.256 4.738z' fill='#607D8B'/><path d='M150.72 172.361l-.363-.295a24.105 24.105 0 0 0 2.148-3.128 24.05 24.05 0 0 0 1.977-4.375l.443.149a24.54 24.54 0 0 1-2.015 4.46 24.61 24.61 0 0 1-2.19 3.189M115.917 191.514l-.363-.294a24.174 24.174 0 0 0 2.148-3.128 24.038 24.038 0 0 0 1.976-4.375l.443.148a24.48 24.48 0 0 1-2.015 4.461 24.662 24.662 0 0 1-2.189 3.188M114 237.476V182.584 237.476' fill='#607D8B'/><g><path d='M81.822 37.474c.017-.135-.075-.28-.267-.392-.327-.188-.826-.21-1.109-.045l-6.012 3.471c-.131.076-.194.178-.191.285.002.132.002.461.002.578v.043l-.007.128-6.591 3.779c-.001 0-2.077 1.046-2.787 5.192 0 0-.912 6.961-.898 19.745.015 12.57.606 17.07 1.167 21.351.22 1.684 3.001 2.125 3.001 2.125.331.04.698-.027 1.08-.248l75.273-43.551c1.808-1.069 2.667-3.719 3.056-6.284 1.213-7.99 1.675-32.978-.275-39.878-.196-.693-.51-1.083-.868-1.282l-2.086-.79c-.727.028-1.416.467-1.534.535L82.032 37.072l-.21.402' fill='#FFF'/><path d='M144.311 1.701l2.085.79c.358.199.672.589.868 1.282 1.949 6.9 1.487 31.887.275 39.878-.39 2.565-1.249 5.215-3.056 6.284L69.21 93.486a1.78 1.78 0 0 1-.896.258l-.183-.011c0 .001-2.782-.44-3.003-2.124-.56-4.282-1.151-8.781-1.165-21.351-.015-12.784.897-19.745.897-19.745.71-4.146 2.787-5.192 2.787-5.192l6.591-3.779.007-.128v-.043c0-.117 0-.446-.002-.578-.003-.107.059-.21.191-.285l6.012-3.472a.98.98 0 0 1 .481-.11c.218 0 .449.053.627.156.193.112.285.258.268.392l.211-.402 60.744-34.836c.117-.068.806-.507 1.534-.535m0-.997l-.039.001c-.618.023-1.283.244-1.974.656l-.021.012-60.519 34.706a2.358 2.358 0 0 0-.831-.15c-.365 0-.704.084-.98.244l-6.012 3.471c-.442.255-.699.69-.689 1.166l.001.15-6.08 3.487c-.373.199-2.542 1.531-3.29 5.898l-.006.039c-.009.07-.92 7.173-.906 19.875.014 12.62.603 17.116 1.172 21.465l.002.015c.308 2.355 3.475 2.923 3.836 2.98l.034.004c.101.013.204.019.305.019a2.77 2.77 0 0 0 1.396-.392l75.273-43.552c1.811-1.071 2.999-3.423 3.542-6.997 1.186-7.814 1.734-33.096-.301-40.299-.253-.893-.704-1.527-1.343-1.882l-.132-.062-2.085-.789a.973.973 0 0 0-.353-.065' fill='#455A64'/><path d='M128.267 11.565l1.495.434-56.339 32.326' fill='#FFF'/><path d='M74.202 90.545a.5.5 0 0 1-.25-.931l18.437-10.645a.499.499 0 1 1 .499.864L74.451 90.478l-.249.067M75.764 42.654l-.108-.062.046-.171 5.135-2.964.17.045-.045.171-5.135 2.964-.063.017M70.52 90.375V46.421l.063-.036L137.84 7.554v43.954l-.062.036L70.52 90.375zm.25-43.811v43.38l66.821-38.579V7.985L70.77 46.564z' fill='#607D8B'/><path d='M86.986 83.182c-.23.149-.612.384-.849.523l-11.505 6.701c-.237.139-.206.252.068.252h.565c.275 0 .693-.113.93-.252L87.7 83.705c.237-.139.428-.253.425-.256a11.29 11.29 0 0 1-.006-.503c0-.274-.188-.377-.418-.227l-.715.463' fill='#607D8B'/><path d='M75.266 90.782H74.7c-.2 0-.316-.056-.346-.166-.03-.11.043-.217.215-.317l11.505-6.702c.236-.138.615-.371.844-.519l.715-.464a.488.488 0 0 1 .266-.089c.172 0 .345.13.345.421 0 .214.001.363.003.437l.006.004-.004.069c-.003.075-.003.075-.486.356l-11.505 6.702a2.282 2.282 0 0 1-.992.268zm-.6-.25l.034.001h.566c.252 0 .649-.108.866-.234l11.505-6.702c.168-.098.294-.173.361-.214-.004-.084-.004-.218-.004-.437l-.095-.171-.131.049-.714.463c-.232.15-.616.386-.854.525l-11.505 6.702-.029.018z' fill='#607D8B'/><path d='M75.266 89.871H74.7c-.2 0-.316-.056-.346-.166-.03-.11.043-.217.215-.317l11.505-6.702c.258-.151.694-.268.993-.268h.565c.2 0 .316.056.346.166.03.11-.043.217-.215.317l-11.505 6.702a2.282 2.282 0 0 1-.992.268zm-.6-.25l.034.001h.566c.252 0 .649-.107.866-.234l11.505-6.702.03-.018-.035-.001h-.565c-.252 0-.649.108-.867.234l-11.505 6.702-.029.018zM74.37 90.801v-1.247 1.247' fill='#607D8B'/><path d='M68.13 93.901c-.751-.093-1.314-.737-1.439-1.376-.831-4.238-1.151-8.782-1.165-21.352-.015-12.784.897-19.745.897-19.745.711-4.146 2.787-5.192 2.787-5.192l74.859-43.219c.223-.129 2.487-1.584 3.195.923 1.95 6.9 1.488 31.887.275 39.878-.389 2.565-1.248 5.215-3.056 6.283L69.21 93.653c-.382.221-.749.288-1.08.248 0 0-2.781-.441-3.001-2.125-.561-4.281-1.152-8.781-1.167-21.351-.014-12.784.898-19.745.898-19.745.71-4.146 2.787-5.191 2.787-5.191l6.598-3.81.871-.119 6.599-3.83.046-.461L68.13 93.901' fill='#FAFAFA'/><path d='M68.317 94.161l-.215-.013h-.001l-.244-.047c-.719-.156-2.772-.736-2.976-2.292-.568-4.34-1.154-8.813-1.168-21.384-.014-12.654.891-19.707.9-19.777.725-4.231 2.832-5.338 2.922-5.382l6.628-3.827.87-.119 6.446-3.742.034-.334a.248.248 0 0 1 .273-.223.248.248 0 0 1 .223.272l-.059.589-6.752 3.919-.87.118-6.556 3.785c-.031.016-1.99 1.068-2.666 5.018-.007.06-.908 7.086-.894 19.702.014 12.539.597 16.996 1.161 21.305.091.691.689 1.154 1.309 1.452a1.95 1.95 0 0 1-.236-.609c-.781-3.984-1.155-8.202-1.17-21.399-.014-12.653.891-19.707.9-19.777.725-4.231 2.832-5.337 2.922-5.382-.004.001 74.444-42.98 74.846-43.212l.028-.017c.904-.538 1.72-.688 2.36-.433.555.221.949.733 1.172 1.52 2.014 7.128 1.46 32.219.281 39.983-.507 3.341-1.575 5.515-3.175 6.462L69.335 93.869a2.023 2.023 0 0 1-1.018.292zm-.147-.507c.293.036.604-.037.915-.217l75.273-43.551c1.823-1.078 2.602-3.915 2.934-6.106 1.174-7.731 1.731-32.695-.268-39.772-.178-.631-.473-1.032-.876-1.192-.484-.193-1.166-.052-1.921.397l-.034.021-74.858 43.218c-.031.017-1.989 1.069-2.666 5.019-.007.059-.908 7.085-.894 19.702.015 13.155.386 17.351 1.161 21.303.09.461.476.983 1.037 1.139.114.025.185.037.196.039h.001z' fill='#455A64'/><path d='M69.317 68.982c.489-.281.885-.056.885.505 0 .56-.396 1.243-.885 1.525-.488.282-.884.057-.884-.504 0-.56.396-1.243.884-1.526' fill='#FFF'/><path d='M68.92 71.133c-.289 0-.487-.228-.487-.625 0-.56.396-1.243.884-1.526a.812.812 0 0 1 .397-.121c.289 0 .488.229.488.626 0 .56-.396 1.243-.885 1.525a.812.812 0 0 1-.397.121m.794-2.459a.976.976 0 0 0-.49.147c-.548.317-.978 1.058-.978 1.687 0 .486.271.812.674.812a.985.985 0 0 0 .491-.146c.548-.317.978-1.057.978-1.687 0-.486-.272-.813-.675-.813' fill='#8097A2'/><path d='M68.92 70.947c-.271 0-.299-.307-.299-.439 0-.491.361-1.116.79-1.363a.632.632 0 0 1 .303-.096c.272 0 .301.306.301.438 0 .491-.363 1.116-.791 1.364a.629.629 0 0 1-.304.096m.794-2.086a.812.812 0 0 0-.397.121c-.488.283-.884.966-.884 1.526 0 .397.198.625.487.625a.812.812 0 0 0 .397-.121c.489-.282.885-.965.885-1.525 0-.397-.199-.626-.488-.626' fill='#8097A2'/><path d='M69.444 85.35c.264-.152.477-.031.477.272 0 .303-.213.67-.477.822-.263.153-.477.031-.477-.271 0-.302.214-.671.477-.823' fill='#FFF'/><path d='M69.23 86.51c-.156 0-.263-.123-.263-.337 0-.302.214-.671.477-.823a.431.431 0 0 1 .214-.066c.156 0 .263.124.263.338 0 .303-.213.67-.477.822a.431.431 0 0 1-.214.066m.428-1.412c-.1 0-.203.029-.307.09-.32.185-.57.618-.57.985 0 .309.185.524.449.524a.63.63 0 0 0 .308-.09c.32-.185.57-.618.57-.985 0-.309-.185-.524-.45-.524' fill='#8097A2'/><path d='M69.23 86.322l-.076-.149c0-.235.179-.544.384-.661l.12-.041.076.151c0 .234-.179.542-.383.66l-.121.04m.428-1.038a.431.431 0 0 0-.214.066c-.263.152-.477.521-.477.823 0 .214.107.337.263.337a.431.431 0 0 0 .214-.066c.264-.152.477-.519.477-.822 0-.214-.107-.338-.263-.338' fill='#8097A2'/><path d='M139.278 7.769v43.667L72.208 90.16V46.493l67.07-38.724' fill='#455A64'/><path d='M72.083 90.375V46.421l.063-.036 67.257-38.831v43.954l-.062.036-67.258 38.831zm.25-43.811v43.38l66.821-38.579V7.985L72.333 46.564z' fill='#607D8B'/></g><path d='M125.737 88.647l-7.639 3.334V84l-11.459 4.713v8.269L99 100.315l13.369 3.646 13.368-15.314' fill='#455A64'/></g></svg>")};var oe="CardboardV1",se="WEBVR_CARDBOARD_VIEWER";function le(e){try{this.selectedKey=localStorage.getItem(se)}catch(e){console.error("Failed to load viewer profile: %s",e)}this.selectedKey||(this.selectedKey=e||oe),this.dialog=this.createDialog_(q.Viewers),this.root=null,this.onChangeCallbacks_=[]}le.prototype.show=function(e){this.root=e,e.appendChild(this.dialog),this.dialog.querySelector("#"+this.selectedKey).checked=!0,this.dialog.style.display="block"},le.prototype.hide=function(){this.root&&this.root.contains(this.dialog)&&this.root.removeChild(this.dialog),this.dialog.style.display="none"},le.prototype.getCurrentViewer=function(){return q.Viewers[this.selectedKey]},le.prototype.getSelectedKey_=function(){var e=this.dialog.querySelector("input[name=field]:checked");return e?e.id:null},le.prototype.onChange=function(e){this.onChangeCallbacks_.push(e)},le.prototype.fireOnChange_=function(e){for(var t=0;t<this.onChangeCallbacks_.length;t++)this.onChangeCallbacks_[t](e)},le.prototype.onSave_=function(){if(this.selectedKey=this.getSelectedKey_(),this.selectedKey&&q.Viewers[this.selectedKey]){this.fireOnChange_(q.Viewers[this.selectedKey]);try{localStorage.setItem(se,this.selectedKey)}catch(e){console.error("Failed to save viewer profile: %s",e)}this.hide()}else console.error("ViewerSelector.onSave_: this should never happen!")},le.prototype.createDialog_=function(e){var t=document.createElement("div");t.classList.add("webvr-polyfill-viewer-selector"),t.style.display="none";var r=document.createElement("div");(i=r.style).position="fixed",i.left=0,i.top=0,i.width="100%",i.height="100%",i.background="rgba(0, 0, 0, 0.3)",r.addEventListener("click",this.hide.bind(this));var n=document.createElement("div"),i=n.style;for(var a in i.boxSizing="border-box",i.position="fixed",i.top="24px",i.left="50%",i.marginLeft="-140px",i.width="280px",i.padding="24px",i.overflow="hidden",i.background="#fafafa",i.fontFamily="'Roboto', sans-serif",i.boxShadow="0px 5px 20px #666",n.appendChild(this.createH1_("Select your viewer")),e)n.appendChild(this.createChoice_(a,e[a].label));return n.appendChild(this.createButton_("Save",this.onSave_.bind(this))),t.appendChild(r),t.appendChild(n),t},le.prototype.createH1_=function(e){var t=document.createElement("h1"),r=t.style;return r.color="black",r.fontSize="20px",r.fontWeight="bold",r.marginTop=0,r.marginBottom="24px",t.innerHTML=e,t},le.prototype.createChoice_=function(e,t){var r=document.createElement("div");r.style.marginTop="8px",r.style.color="black";var n=document.createElement("input");n.style.fontSize="30px",n.setAttribute("id",e),n.setAttribute("type","radio"),n.setAttribute("value",e),n.setAttribute("name","field");var i=document.createElement("label");return i.style.marginLeft="4px",i.setAttribute("for",e),i.innerHTML=t,r.appendChild(n),r.appendChild(i),r},le.prototype.createButton_=function(e,t){var r=document.createElement("button");r.innerHTML=e;var n=r.style;return n.float="right",n.textTransform="uppercase",n.color="#1094f7",n.fontSize="14px",n.letterSpacing=0,n.border=0,n.background="none",n.marginTop="16px",r.addEventListener("click",t),r},"undefined"!=typeof window?window:void 0!==Ie||"undefined"!=typeof self&&self;var ce,ue=(ce=function(e,t){return e(t={exports:{}},t.exports),t.exports}((function(e,t){var r;r=function(){return function(e){var t={};function r(n){if(t[n])return t[n].exports;var i=t[n]={i:n,l:!1,exports:{}};return e[n].call(i.exports,i,i.exports,r),i.l=!0,i.exports}return r.m=e,r.c=t,r.d=function(e,t,n){r.o(e,t)||Object.defineProperty(e,t,{configurable:!1,enumerable:!0,get:n})},r.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return r.d(t,"a",t),t},r.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r.p="",r(r.s=0)}([function(e,t,r){var n=function(){function e(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),t}}(),i=r(1),a="undefined"!=typeof navigator&&parseFloat((""+(/CPU.*OS ([0-9_]{3,4})[0-9_]{0,1}|(CPU like).*AppleWebKit.*Mobile/i.exec(navigator.userAgent)||[0,""])[1]).replace("undefined","3_2").replace("_",".").replace("_",""))<10&&!window.MSStream,o=function(){function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),a?this.noSleepTimer=null:(this.noSleepVideo=document.createElement("video"),this.noSleepVideo.setAttribute("playsinline",""),this.noSleepVideo.setAttribute("src",i),this.noSleepVideo.addEventListener("timeupdate",function(e){this.noSleepVideo.currentTime>.5&&(this.noSleepVideo.currentTime=Math.random())}.bind(this)))}return n(e,[{key:"enable",value:function(){a?(this.disable(),this.noSleepTimer=window.setInterval((function(){window.location.href="/",window.setTimeout(window.stop,0)}),15e3)):this.noSleepVideo.play()}},{key:"disable",value:function(){a?this.noSleepTimer&&(window.clearInterval(this.noSleepTimer),this.noSleepTimer=null):this.noSleepVideo.pause()}}]),e}();e.exports=o},function(e,t,r){e.exports="data:video/mp4;base64,AAAAIGZ0eXBtcDQyAAACAGlzb21pc28yYXZjMW1wNDEAAAAIZnJlZQAACKBtZGF0AAAC8wYF///v3EXpvebZSLeWLNgg2SPu73gyNjQgLSBjb3JlIDE0MiByMjQ3OSBkZDc5YTYxIC0gSC4yNjQvTVBFRy00IEFWQyBjb2RlYyAtIENvcHlsZWZ0IDIwMDMtMjAxNCAtIGh0dHA6Ly93d3cudmlkZW9sYW4ub3JnL3gyNjQuaHRtbCAtIG9wdGlvbnM6IGNhYmFjPTEgcmVmPTEgZGVibG9jaz0xOjA6MCBhbmFseXNlPTB4MToweDExMSBtZT1oZXggc3VibWU9MiBwc3k9MSBwc3lfcmQ9MS4wMDowLjAwIG1peGVkX3JlZj0wIG1lX3JhbmdlPTE2IGNocm9tYV9tZT0xIHRyZWxsaXM9MCA4eDhkY3Q9MCBjcW09MCBkZWFkem9uZT0yMSwxMSBmYXN0X3Bza2lwPTEgY2hyb21hX3FwX29mZnNldD0wIHRocmVhZHM9NiBsb29rYWhlYWRfdGhyZWFkcz0xIHNsaWNlZF90aHJlYWRzPTAgbnI9MCBkZWNpbWF0ZT0xIGludGVybGFjZWQ9MCBibHVyYXlfY29tcGF0PTAgY29uc3RyYWluZWRfaW50cmE9MCBiZnJhbWVzPTMgYl9weXJhbWlkPTIgYl9hZGFwdD0xIGJfYmlhcz0wIGRpcmVjdD0xIHdlaWdodGI9MSBvcGVuX2dvcD0wIHdlaWdodHA9MSBrZXlpbnQ9MzAwIGtleWludF9taW49MzAgc2NlbmVjdXQ9NDAgaW50cmFfcmVmcmVzaD0wIHJjX2xvb2thaGVhZD0xMCByYz1jcmYgbWJ0cmVlPTEgY3JmPTIwLjAgcWNvbXA9MC42MCBxcG1pbj0wIHFwbWF4PTY5IHFwc3RlcD00IHZidl9tYXhyYXRlPTIwMDAwIHZidl9idWZzaXplPTI1MDAwIGNyZl9tYXg9MC4wIG5hbF9ocmQ9bm9uZSBmaWxsZXI9MCBpcF9yYXRpbz0xLjQwIGFxPTE6MS4wMACAAAAAOWWIhAA3//p+C7v8tDDSTjf97w55i3SbRPO4ZY+hkjD5hbkAkL3zpJ6h/LR1CAABzgB1kqqzUorlhQAAAAxBmiQYhn/+qZYADLgAAAAJQZ5CQhX/AAj5IQADQGgcIQADQGgcAAAACQGeYUQn/wALKCEAA0BoHAAAAAkBnmNEJ/8ACykhAANAaBwhAANAaBwAAAANQZpoNExDP/6plgAMuSEAA0BoHAAAAAtBnoZFESwr/wAI+SEAA0BoHCEAA0BoHAAAAAkBnqVEJ/8ACykhAANAaBwAAAAJAZ6nRCf/AAsoIQADQGgcIQADQGgcAAAADUGarDRMQz/+qZYADLghAANAaBwAAAALQZ7KRRUsK/8ACPkhAANAaBwAAAAJAZ7pRCf/AAsoIQADQGgcIQADQGgcAAAACQGe60Qn/wALKCEAA0BoHAAAAA1BmvA0TEM//qmWAAy5IQADQGgcIQADQGgcAAAAC0GfDkUVLCv/AAj5IQADQGgcAAAACQGfLUQn/wALKSEAA0BoHCEAA0BoHAAAAAkBny9EJ/8ACyghAANAaBwAAAANQZs0NExDP/6plgAMuCEAA0BoHAAAAAtBn1JFFSwr/wAI+SEAA0BoHCEAA0BoHAAAAAkBn3FEJ/8ACyghAANAaBwAAAAJAZ9zRCf/AAsoIQADQGgcIQADQGgcAAAADUGbeDRMQz/+qZYADLkhAANAaBwAAAALQZ+WRRUsK/8ACPghAANAaBwhAANAaBwAAAAJAZ+1RCf/AAspIQADQGgcAAAACQGft0Qn/wALKSEAA0BoHCEAA0BoHAAAAA1Bm7w0TEM//qmWAAy4IQADQGgcAAAAC0Gf2kUVLCv/AAj5IQADQGgcAAAACQGf+UQn/wALKCEAA0BoHCEAA0BoHAAAAAkBn/tEJ/8ACykhAANAaBwAAAANQZvgNExDP/6plgAMuSEAA0BoHCEAA0BoHAAAAAtBnh5FFSwr/wAI+CEAA0BoHAAAAAkBnj1EJ/8ACyghAANAaBwhAANAaBwAAAAJAZ4/RCf/AAspIQADQGgcAAAADUGaJDRMQz/+qZYADLghAANAaBwAAAALQZ5CRRUsK/8ACPkhAANAaBwhAANAaBwAAAAJAZ5hRCf/AAsoIQADQGgcAAAACQGeY0Qn/wALKSEAA0BoHCEAA0BoHAAAAA1Bmmg0TEM//qmWAAy5IQADQGgcAAAAC0GehkUVLCv/AAj5IQADQGgcIQADQGgcAAAACQGepUQn/wALKSEAA0BoHAAAAAkBnqdEJ/8ACyghAANAaBwAAAANQZqsNExDP/6plgAMuCEAA0BoHCEAA0BoHAAAAAtBnspFFSwr/wAI+SEAA0BoHAAAAAkBnulEJ/8ACyghAANAaBwhAANAaBwAAAAJAZ7rRCf/AAsoIQADQGgcAAAADUGa8DRMQz/+qZYADLkhAANAaBwhAANAaBwAAAALQZ8ORRUsK/8ACPkhAANAaBwAAAAJAZ8tRCf/AAspIQADQGgcIQADQGgcAAAACQGfL0Qn/wALKCEAA0BoHAAAAA1BmzQ0TEM//qmWAAy4IQADQGgcAAAAC0GfUkUVLCv/AAj5IQADQGgcIQADQGgcAAAACQGfcUQn/wALKCEAA0BoHAAAAAkBn3NEJ/8ACyghAANAaBwhAANAaBwAAAANQZt4NExC//6plgAMuSEAA0BoHAAAAAtBn5ZFFSwr/wAI+CEAA0BoHCEAA0BoHAAAAAkBn7VEJ/8ACykhAANAaBwAAAAJAZ+3RCf/AAspIQADQGgcAAAADUGbuzRMQn/+nhAAYsAhAANAaBwhAANAaBwAAAAJQZ/aQhP/AAspIQADQGgcAAAACQGf+UQn/wALKCEAA0BoHCEAA0BoHCEAA0BoHCEAA0BoHCEAA0BoHCEAA0BoHAAACiFtb292AAAAbG12aGQAAAAA1YCCX9WAgl8AAAPoAAAH/AABAAABAAAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADAAAAGGlvZHMAAAAAEICAgAcAT////v7/AAAF+XRyYWsAAABcdGtoZAAAAAPVgIJf1YCCXwAAAAEAAAAAAAAH0AAAAAAAAAAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAEAAAAAAygAAAMoAAAAAACRlZHRzAAAAHGVsc3QAAAAAAAAAAQAAB9AAABdwAAEAAAAABXFtZGlhAAAAIG1kaGQAAAAA1YCCX9WAgl8AAV+QAAK/IFXEAAAAAAAtaGRscgAAAAAAAAAAdmlkZQAAAAAAAAAAAAAAAFZpZGVvSGFuZGxlcgAAAAUcbWluZgAAABR2bWhkAAAAAQAAAAAAAAAAAAAAJGRpbmYAAAAcZHJlZgAAAAAAAAABAAAADHVybCAAAAABAAAE3HN0YmwAAACYc3RzZAAAAAAAAAABAAAAiGF2YzEAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAygDKAEgAAABIAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAY//8AAAAyYXZjQwFNQCj/4QAbZ01AKOyho3ySTUBAQFAAAAMAEAAr8gDxgxlgAQAEaO+G8gAAABhzdHRzAAAAAAAAAAEAAAA8AAALuAAAABRzdHNzAAAAAAAAAAEAAAABAAAB8GN0dHMAAAAAAAAAPAAAAAEAABdwAAAAAQAAOpgAAAABAAAXcAAAAAEAAAAAAAAAAQAAC7gAAAABAAA6mAAAAAEAABdwAAAAAQAAAAAAAAABAAALuAAAAAEAADqYAAAAAQAAF3AAAAABAAAAAAAAAAEAAAu4AAAAAQAAOpgAAAABAAAXcAAAAAEAAAAAAAAAAQAAC7gAAAABAAA6mAAAAAEAABdwAAAAAQAAAAAAAAABAAALuAAAAAEAADqYAAAAAQAAF3AAAAABAAAAAAAAAAEAAAu4AAAAAQAAOpgAAAABAAAXcAAAAAEAAAAAAAAAAQAAC7gAAAABAAA6mAAAAAEAABdwAAAAAQAAAAAAAAABAAALuAAAAAEAADqYAAAAAQAAF3AAAAABAAAAAAAAAAEAAAu4AAAAAQAAOpgAAAABAAAXcAAAAAEAAAAAAAAAAQAAC7gAAAABAAA6mAAAAAEAABdwAAAAAQAAAAAAAAABAAALuAAAAAEAADqYAAAAAQAAF3AAAAABAAAAAAAAAAEAAAu4AAAAAQAAOpgAAAABAAAXcAAAAAEAAAAAAAAAAQAAC7gAAAABAAA6mAAAAAEAABdwAAAAAQAAAAAAAAABAAALuAAAAAEAAC7gAAAAAQAAF3AAAAABAAAAAAAAABxzdHNjAAAAAAAAAAEAAAABAAAAAQAAAAEAAAEEc3RzegAAAAAAAAAAAAAAPAAAAzQAAAAQAAAADQAAAA0AAAANAAAAEQAAAA8AAAANAAAADQAAABEAAAAPAAAADQAAAA0AAAARAAAADwAAAA0AAAANAAAAEQAAAA8AAAANAAAADQAAABEAAAAPAAAADQAAAA0AAAARAAAADwAAAA0AAAANAAAAEQAAAA8AAAANAAAADQAAABEAAAAPAAAADQAAAA0AAAARAAAADwAAAA0AAAANAAAAEQAAAA8AAAANAAAADQAAABEAAAAPAAAADQAAAA0AAAARAAAADwAAAA0AAAANAAAAEQAAAA8AAAANAAAADQAAABEAAAANAAAADQAAAQBzdGNvAAAAAAAAADwAAAAwAAADZAAAA3QAAAONAAADoAAAA7kAAAPQAAAD6wAAA/4AAAQXAAAELgAABEMAAARcAAAEbwAABIwAAAShAAAEugAABM0AAATkAAAE/wAABRIAAAUrAAAFQgAABV0AAAVwAAAFiQAABaAAAAW1AAAFzgAABeEAAAX+AAAGEwAABiwAAAY/AAAGVgAABnEAAAaEAAAGnQAABrQAAAbPAAAG4gAABvUAAAcSAAAHJwAAB0AAAAdTAAAHcAAAB4UAAAeeAAAHsQAAB8gAAAfjAAAH9gAACA8AAAgmAAAIQQAACFQAAAhnAAAIhAAACJcAAAMsdHJhawAAAFx0a2hkAAAAA9WAgl/VgIJfAAAAAgAAAAAAAAf8AAAAAAAAAAAAAAABAQAAAAABAAAAAAAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAAAACsm1kaWEAAAAgbWRoZAAAAADVgIJf1YCCXwAArEQAAWAAVcQAAAAAACdoZGxyAAAAAAAAAABzb3VuAAAAAAAAAAAAAAAAU3RlcmVvAAAAAmNtaW5mAAAAEHNtaGQAAAAAAAAAAAAAACRkaW5mAAAAHGRyZWYAAAAAAAAAAQAAAAx1cmwgAAAAAQAAAidzdGJsAAAAZ3N0c2QAAAAAAAAAAQAAAFdtcDRhAAAAAAAAAAEAAAAAAAAAAAACABAAAAAArEQAAAAAADNlc2RzAAAAAAOAgIAiAAIABICAgBRAFQAAAAADDUAAAAAABYCAgAISEAaAgIABAgAAABhzdHRzAAAAAAAAAAEAAABYAAAEAAAAABxzdHNjAAAAAAAAAAEAAAABAAAAAQAAAAEAAAAUc3RzegAAAAAAAAAGAAAAWAAAAXBzdGNvAAAAAAAAAFgAAAOBAAADhwAAA5oAAAOtAAADswAAA8oAAAPfAAAD5QAAA/gAAAQLAAAEEQAABCgAAAQ9AAAEUAAABFYAAARpAAAEgAAABIYAAASbAAAErgAABLQAAATHAAAE3gAABPMAAAT5AAAFDAAABR8AAAUlAAAFPAAABVEAAAVXAAAFagAABX0AAAWDAAAFmgAABa8AAAXCAAAFyAAABdsAAAXyAAAF+AAABg0AAAYgAAAGJgAABjkAAAZQAAAGZQAABmsAAAZ+AAAGkQAABpcAAAauAAAGwwAABskAAAbcAAAG7wAABwYAAAcMAAAHIQAABzQAAAc6AAAHTQAAB2QAAAdqAAAHfwAAB5IAAAeYAAAHqwAAB8IAAAfXAAAH3QAAB/AAAAgDAAAICQAACCAAAAg1AAAIOwAACE4AAAhhAAAIeAAACH4AAAiRAAAIpAAACKoAAAiwAAAItgAACLwAAAjCAAAAFnVkdGEAAAAObmFtZVN0ZXJlbwAAAHB1ZHRhAAAAaG1ldGEAAAAAAAAAIWhkbHIAAAAAAAAAAG1kaXJhcHBsAAAAAAAAAAAAAAAAO2lsc3QAAAAzqXRvbwAAACtkYXRhAAAAAQAAAABIYW5kQnJha2UgMC4xMC4yIDIwMTUwNjExMDA="}])},e.exports=r()})))&&ce.__esModule&&Object.prototype.hasOwnProperty.call(ce,"default")?ce.default:ce,he=1e3,de=[0,0,.5,1],pe=[.5,0,.5,1],fe=window.requestAnimationFrame,me=window.cancelAnimationFrame;function ve(e){Object.defineProperties(this,{hasPosition:{writable:!1,enumerable:!0,value:e.hasPosition},hasExternalDisplay:{writable:!1,enumerable:!0,value:e.hasExternalDisplay},canPresent:{writable:!1,enumerable:!0,value:e.canPresent},maxLayers:{writable:!1,enumerable:!0,value:e.maxLayers},hasOrientation:{enumerable:!0,get:function(){return S("VRDisplayCapabilities.prototype.hasOrientation","VRDisplay.prototype.getFrameData"),e.hasOrientation}}})}function ge(e){var t=!("wakelock"in(e=e||{}))||e.wakelock;this.isPolyfilled=!0,this.displayId=he++,this.displayName="",this.depthNear=.01,this.depthFar=1e4,this.isPresenting=!1,Object.defineProperty(this,"isConnected",{get:function(){return S("VRDisplay.prototype.isConnected","VRDisplayCapabilities.prototype.hasExternalDisplay"),!1}}),this.capabilities=new ve({hasPosition:!1,hasOrientation:!1,hasExternalDisplay:!1,canPresent:!1,maxLayers:1}),this.stageParameters=null,this.waitingForPresent_=!1,this.layer_=null,this.originalParent_=null,this.fullscreenElement_=null,this.fullscreenWrapper_=null,this.fullscreenElementCachedStyle_=null,this.fullscreenEventTarget_=null,this.fullscreenChangeHandler_=null,this.fullscreenErrorHandler_=null,t&&x()&&(this.wakelock_=new ue)}ge.prototype.getFrameData=function(e){return w(e,this._getPose(),this)},ge.prototype.getPose=function(){return S("VRDisplay.prototype.getPose","VRDisplay.prototype.getFrameData"),this._getPose()},ge.prototype.resetPose=function(){return S("VRDisplay.prototype.resetPose"),this._resetPose()},ge.prototype.getImmediatePose=function(){return S("VRDisplay.prototype.getImmediatePose","VRDisplay.prototype.getFrameData"),this._getPose()},ge.prototype.requestAnimationFrame=function(e){return fe(e)},ge.prototype.cancelAnimationFrame=function(e){return me(e)},ge.prototype.wrapForFullscreen=function(e){if(s())return e;if(!this.fullscreenWrapper_){this.fullscreenWrapper_=document.createElement("div");var t=["height: "+Math.min(screen.height,screen.width)+"px !important","top: 0 !important","left: 0 !important","right: 0 !important","border: 0","margin: 0","padding: 0","z-index: 999999 !important","position: fixed"];this.fullscreenWrapper_.setAttribute("style",t.join("; ")+";"),this.fullscreenWrapper_.classList.add("webvr-polyfill-fullscreen-wrapper")}if(this.fullscreenElement_==e)return this.fullscreenWrapper_;if(this.fullscreenElement_&&(this.originalParent_?this.originalParent_.appendChild(this.fullscreenElement_):this.fullscreenElement_.parentElement.removeChild(this.fullscreenElement_)),this.fullscreenElement_=e,this.originalParent_=e.parentElement,this.originalParent_||document.body.appendChild(e),!this.fullscreenWrapper_.parentElement){var r=this.fullscreenElement_.parentElement;r.insertBefore(this.fullscreenWrapper_,this.fullscreenElement_),r.removeChild(this.fullscreenElement_)}this.fullscreenWrapper_.insertBefore(this.fullscreenElement_,this.fullscreenWrapper_.firstChild),this.fullscreenElementCachedStyle_=this.fullscreenElement_.getAttribute("style");var n=this;return function(){if(n.fullscreenElement_){var e=["position: absolute","top: 0","left: 0","width: "+Math.max(screen.width,screen.height)+"px","height: "+Math.min(screen.height,screen.width)+"px","border: 0","margin: 0","padding: 0"];n.fullscreenElement_.setAttribute("style",e.join("; ")+";")}}(),this.fullscreenWrapper_},ge.prototype.removeFullscreenWrapper=function(){if(this.fullscreenElement_){var e=this.fullscreenElement_;this.fullscreenElementCachedStyle_?e.setAttribute("style",this.fullscreenElementCachedStyle_):e.removeAttribute("style"),this.fullscreenElement_=null,this.fullscreenElementCachedStyle_=null;var t=this.fullscreenWrapper_.parentElement;return this.fullscreenWrapper_.removeChild(e),this.originalParent_===t?t.insertBefore(e,this.fullscreenWrapper_):this.originalParent_&&this.originalParent_.appendChild(e),t.removeChild(this.fullscreenWrapper_),e}},ge.prototype.requestPresent=function(e){var t=this.isPresenting,r=this;return e instanceof Array||(S("VRDisplay.prototype.requestPresent with non-array argument","an array of VRLayers as the first argument"),e=[e]),new Promise((function(n,i){if(r.capabilities.canPresent)if(0==e.length||e.length>r.capabilities.maxLayers)i(new Error("Invalid number of layers."));else{var a=e[0];if(a.source){var o=a.leftBounds||de,c=a.rightBounds||pe;if(t){var u=r.layer_;u.source!==a.source&&(u.source=a.source);for(var h=0;h<4;h++)u.leftBounds[h]=o[h],u.rightBounds[h]=c[h];return r.wrapForFullscreen(r.layer_.source),r.updatePresent_(),void n()}if(r.layer_={predistorted:a.predistorted,source:a.source,leftBounds:o.slice(0),rightBounds:c.slice(0)},r.waitingForPresent_=!1,r.layer_&&r.layer_.source){var d=r.wrapForFullscreen(r.layer_.source);r.addFullscreenListeners_(d,(function(){var e=document.fullscreenElement||document.webkitFullscreenElement||document.mozFullScreenElement||document.msFullscreenElement;r.isPresenting=d===e,r.isPresenting?(screen.orientation&&screen.orientation.lock&&screen.orientation.lock("landscape-primary").catch((function(e){console.error("screen.orientation.lock() failed due to",e.message)})),r.waitingForPresent_=!1,r.beginPresent_(),n()):(screen.orientation&&screen.orientation.unlock&&screen.orientation.unlock(),r.removeFullscreenWrapper(),r.disableWakeLock(),r.endPresent_(),r.removeFullscreenListeners_()),r.fireVRDisplayPresentChange_()}),(function(){r.waitingForPresent_&&(r.removeFullscreenWrapper(),r.removeFullscreenListeners_(),r.disableWakeLock(),r.waitingForPresent_=!1,r.isPresenting=!1,i(new Error("Unable to present.")))})),function(e){if(l())return!1;if(e.requestFullscreen)e.requestFullscreen();else if(e.webkitRequestFullscreen)e.webkitRequestFullscreen();else if(e.mozRequestFullScreen)e.mozRequestFullScreen();else{if(!e.msRequestFullscreen)return!1;e.msRequestFullscreen()}return!0}(d)?(r.enableWakeLock(),r.waitingForPresent_=!0):(s()||l())&&(r.enableWakeLock(),r.isPresenting=!0,r.beginPresent_(),r.fireVRDisplayPresentChange_(),n())}r.waitingForPresent_||s()||(v(),i(new Error("Unable to present.")))}else n()}else i(new Error("VRDisplay is not capable of presenting."))}))},ge.prototype.exitPresent=function(){var e=this.isPresenting,t=this;return this.isPresenting=!1,this.layer_=null,this.disableWakeLock(),new Promise((function(r,n){e?(!v()&&s()&&(t.endPresent_(),t.fireVRDisplayPresentChange_()),l()&&(t.removeFullscreenWrapper(),t.removeFullscreenListeners_(),t.endPresent_(),t.fireVRDisplayPresentChange_()),r()):n(new Error("Was not presenting to VRDisplay."))}))},ge.prototype.getLayers=function(){return this.layer_?[this.layer_]:[]},ge.prototype.fireVRDisplayPresentChange_=function(){var e=new CustomEvent("vrdisplaypresentchange",{detail:{display:this}});window.dispatchEvent(e)},ge.prototype.fireVRDisplayConnect_=function(){var e=new CustomEvent("vrdisplayconnect",{detail:{display:this}});window.dispatchEvent(e)},ge.prototype.addFullscreenListeners_=function(e,t,r){this.removeFullscreenListeners_(),this.fullscreenEventTarget_=e,this.fullscreenChangeHandler_=t,this.fullscreenErrorHandler_=r,t&&(document.fullscreenEnabled?e.addEventListener("fullscreenchange",t,!1):document.webkitFullscreenEnabled?e.addEventListener("webkitfullscreenchange",t,!1):document.mozFullScreenEnabled?document.addEventListener("mozfullscreenchange",t,!1):document.msFullscreenEnabled&&e.addEventListener("msfullscreenchange",t,!1)),r&&(document.fullscreenEnabled?e.addEventListener("fullscreenerror",r,!1):document.webkitFullscreenEnabled?e.addEventListener("webkitfullscreenerror",r,!1):document.mozFullScreenEnabled?document.addEventListener("mozfullscreenerror",r,!1):document.msFullscreenEnabled&&e.addEventListener("msfullscreenerror",r,!1))},ge.prototype.removeFullscreenListeners_=function(){if(this.fullscreenEventTarget_){var e=this.fullscreenEventTarget_;if(this.fullscreenChangeHandler_){var t=this.fullscreenChangeHandler_;e.removeEventListener("fullscreenchange",t,!1),e.removeEventListener("webkitfullscreenchange",t,!1),document.removeEventListener("mozfullscreenchange",t,!1),e.removeEventListener("msfullscreenchange",t,!1)}if(this.fullscreenErrorHandler_){var r=this.fullscreenErrorHandler_;e.removeEventListener("fullscreenerror",r,!1),e.removeEventListener("webkitfullscreenerror",r,!1),document.removeEventListener("mozfullscreenerror",r,!1),e.removeEventListener("msfullscreenerror",r,!1)}this.fullscreenEventTarget_=null,this.fullscreenChangeHandler_=null,this.fullscreenErrorHandler_=null}},ge.prototype.enableWakeLock=function(){this.wakelock_&&this.wakelock_.enable()},ge.prototype.disableWakeLock=function(){this.wakelock_&&this.wakelock_.disable()},ge.prototype.beginPresent_=function(){},ge.prototype.endPresent_=function(){},ge.prototype.submitFrame=function(e){},ge.prototype.getEyeParameters=function(e){return null};var ye={ADDITIONAL_VIEWERS:[],DEFAULT_VIEWER:"",MOBILE_WAKE_LOCK:!0,DEBUG:!1,DPDB_URL:"https://dpdb.webvr.rocks/dpdb.json",K_FILTER:.98,PREDICTION_TIME_S:.04,CARDBOARD_UI_DISABLED:!1,ROTATE_INSTRUCTIONS_DISABLED:!1,YAW_ONLY:!1,BUFFER_SCALE:.5,DIRTY_SUBMIT_FRAME_BINDINGS:!1},xe="left",be="right";function Ae(e){var t=b({},ye);e=b(t,e||{}),ge.call(this,{wakelock:e.MOBILE_WAKE_LOCK}),this.config=e,this.displayName="Cardboard VRDisplay",this.capabilities=new ve({hasPosition:!1,hasOrientation:!0,hasExternalDisplay:!1,canPresent:!0,maxLayers:1}),this.stageParameters=null,this.bufferScale_=this.config.BUFFER_SCALE,this.poseSensor_=new ie(this.config),this.distorter_=null,this.cardboardUI_=null,this.dpdb_=new Q(this.config.DPDB_URL,this.onDeviceParamsUpdated_.bind(this)),this.deviceInfo_=new q(this.dpdb_.getDeviceParams(),e.ADDITIONAL_VIEWERS),this.viewerSelector_=new le(e.DEFAULT_VIEWER),this.viewerSelector_.onChange(this.onViewerChanged_.bind(this)),this.deviceInfo_.setViewer(this.viewerSelector_.getCurrentViewer()),this.config.ROTATE_INSTRUCTIONS_DISABLED||(this.rotateInstructions_=new ae),s()&&window.addEventListener("resize",this.onResize_.bind(this))}return Ae.prototype=Object.create(ge.prototype),Ae.prototype._getPose=function(){return{position:null,orientation:this.poseSensor_.getOrientation(),linearVelocity:null,linearAcceleration:null,angularVelocity:null,angularAcceleration:null}},Ae.prototype._resetPose=function(){this.poseSensor_.resetPose&&this.poseSensor_.resetPose()},Ae.prototype._getFieldOfView=function(e){var t;if(e==xe)t=this.deviceInfo_.getFieldOfViewLeftEye();else{if(e!=be)return console.error("Invalid eye provided: %s",e),null;t=this.deviceInfo_.getFieldOfViewRightEye()}return t},Ae.prototype._getEyeOffset=function(e){var t;if(e==xe)t=[.5*-this.deviceInfo_.viewer.interLensDistance,0,0];else{if(e!=be)return console.error("Invalid eye provided: %s",e),null;t=[.5*this.deviceInfo_.viewer.interLensDistance,0,0]}return t},Ae.prototype.getEyeParameters=function(e){var t=this._getEyeOffset(e),r=this._getFieldOfView(e),n={offset:t,renderWidth:.5*this.deviceInfo_.device.width*this.bufferScale_,renderHeight:this.deviceInfo_.device.height*this.bufferScale_};return Object.defineProperty(n,"fieldOfView",{enumerable:!0,get:function(){return S("VRFieldOfView","VRFrameData's projection matrices"),r}}),n},Ae.prototype.onDeviceParamsUpdated_=function(e){this.config.DEBUG&&console.log("DPDB reported that device params were updated."),this.deviceInfo_.updateDeviceParams(e),this.distorter_&&this.distorter_.updateDeviceInfo(this.deviceInfo_)},Ae.prototype.updateBounds_=function(){this.layer_&&this.distorter_&&(this.layer_.leftBounds||this.layer_.rightBounds)&&this.distorter_.setTextureBounds(this.layer_.leftBounds,this.layer_.rightBounds)},Ae.prototype.beginPresent_=function(){var e=this.layer_.source.getContext("webgl");e||(e=this.layer_.source.getContext("experimental-webgl")),e||(e=this.layer_.source.getContext("webgl2")),e&&(this.layer_.predistorted?this.config.CARDBOARD_UI_DISABLED||(e.canvas.width=f()*this.bufferScale_,e.canvas.height=m()*this.bufferScale_,this.cardboardUI_=new O(e)):(this.config.CARDBOARD_UI_DISABLED||(this.cardboardUI_=new O(e)),this.distorter_=new L(e,this.cardboardUI_,this.config.BUFFER_SCALE,this.config.DIRTY_SUBMIT_FRAME_BINDINGS),this.distorter_.updateDeviceInfo(this.deviceInfo_)),this.cardboardUI_&&this.cardboardUI_.listen(function(e){this.viewerSelector_.show(this.layer_.source.parentElement),e.stopPropagation(),e.preventDefault()}.bind(this),function(e){this.exitPresent(),e.stopPropagation(),e.preventDefault()}.bind(this)),this.rotateInstructions_&&(p()&&x()?this.rotateInstructions_.showTemporarily(3e3,this.layer_.source.parentElement):this.rotateInstructions_.update()),this.orientationHandler=this.onOrientationChange_.bind(this),window.addEventListener("orientationchange",this.orientationHandler),this.vrdisplaypresentchangeHandler=this.updateBounds_.bind(this),window.addEventListener("vrdisplaypresentchange",this.vrdisplaypresentchangeHandler),this.fireVRDisplayDeviceParamsChange_())},Ae.prototype.endPresent_=function(){this.distorter_&&(this.distorter_.destroy(),this.distorter_=null),this.cardboardUI_&&(this.cardboardUI_.destroy(),this.cardboardUI_=null),this.rotateInstructions_&&this.rotateInstructions_.hide(),this.viewerSelector_.hide(),window.removeEventListener("orientationchange",this.orientationHandler),window.removeEventListener("vrdisplaypresentchange",this.vrdisplaypresentchangeHandler)},Ae.prototype.updatePresent_=function(){this.endPresent_(),this.beginPresent_()},Ae.prototype.submitFrame=function(e){if(this.distorter_)this.updateBounds_(),this.distorter_.submitFrame();else if(this.cardboardUI_&&this.layer_){var t=this.layer_.source.getContext("webgl").canvas;t.width==this.lastWidth&&t.height==this.lastHeight||this.cardboardUI_.onResize(),this.lastWidth=t.width,this.lastHeight=t.height,this.cardboardUI_.render()}},Ae.prototype.onOrientationChange_=function(e){this.viewerSelector_.hide(),this.rotateInstructions_&&this.rotateInstructions_.update(),this.onResize_()},Ae.prototype.onResize_=function(e){if(this.layer_){var t=this.layer_.source.getContext("webgl");t.canvas.setAttribute("style",["position: absolute","top: 0","left: 0","width: 100vw","height: 100vh","border: 0","margin: 0","padding: 0px","box-sizing: content-box"].join("; ")+";"),A(t.canvas)}},Ae.prototype.onViewerChanged_=function(e){this.deviceInfo_.setViewer(e),this.distorter_&&this.distorter_.updateDeviceInfo(this.deviceInfo_),this.fireVRDisplayDeviceParamsChange_()},Ae.prototype.fireVRDisplayDeviceParamsChange_=function(){var e=new CustomEvent("vrdisplaydeviceparamschange",{detail:{vrdisplay:this,deviceInfo:this.deviceInfo_}});window.dispatchEvent(e)},Ae.VRFrameData=function(){this.leftProjectionMatrix=new Float32Array(16),this.leftViewMatrix=new Float32Array(16),this.rightProjectionMatrix=new Float32Array(16),this.rightViewMatrix=new Float32Array(16),this.pose=null},Ae.VRDisplay=ge,Ae}()})),Fe=(Oe=Be)&&Oe.__esModule&&Object.prototype.hasOwnProperty.call(Oe,"default")?Oe.default:Oe;class Ue extends i{constructor(e){super(),this.global=e,this.onWindowResize=this.onWindowResize.bind(this),this.global.window.addEventListener("resize",this.onWindowResize),this.environmentBlendMode="opaque"}onBaseLayerSet(e,t){throw new Error("Not implemented")}isSessionSupported(e){throw new Error("Not implemented")}isFeatureSupported(e){throw new Error("Not implemented")}async requestSession(e,t){throw new Error("Not implemented")}requestAnimationFrame(e){throw new Error("Not implemented")}onFrameStart(e){throw new Error("Not implemented")}onFrameEnd(e){throw new Error("Not implemented")}doesSessionSupportReferenceSpace(e,t){throw new Error("Not implemented")}requestStageBounds(){throw new Error("Not implemented")}async requestFrameOfReferenceTransform(e,t){}cancelAnimationFrame(e){throw new Error("Not implemented")}endSession(e){throw new Error("Not implemented")}getViewport(e,t,r,n){throw new Error("Not implemented")}getProjectionMatrix(e){throw new Error("Not implemented")}getBasePoseMatrix(){throw new Error("Not implemented")}getBaseViewMatrix(e){throw new Error("Not implemented")}getInputSources(){throw new Error("Not implemented")}getInputPose(e,t,r){throw new Error("Not implemented")}onWindowResize(){this.onWindowResize()}}let Ne={mapping:"xr-standard",profiles:["oculus-go","generic-trigger-touchpad"],buttons:{length:3,0:1,1:null,2:0},gripTransform:{orientation:[.11*Math.PI,0,0,1]}},Ge={mapping:"xr-standard",displayProfiles:{"Oculus Quest":["oculus-touch-v2","oculus-touch","generic-trigger-squeeze-thumbstick"]},profiles:["oculus-touch","generic-trigger-squeeze-thumbstick"],axes:{length:4,0:null,1:null,2:0,3:1},buttons:{length:7,0:1,1:2,2:null,3:0,4:3,5:4,6:null},gripTransform:{position:[0,-.02,.04,1],orientation:[.11*Math.PI,0,0,1]}},ze={mapping:"xr-standard",profiles:["htc-vive","generic-trigger-squeeze-touchpad"],displayProfiles:{"HTC Vive":["htc-vive","generic-trigger-squeeze-touchpad"],"HTC Vive DVT":["htc-vive","generic-trigger-squeeze-touchpad"],"Valve Index":["valve-index","generic-trigger-squeeze-touchpad-thumbstick"]},buttons:{length:3,0:1,1:2,2:0},gripTransform:{position:[0,0,.05,1]},targetRayTransform:{orientation:[-.08*Math.PI,0,0,1]},userAgentOverrides:{Firefox:{axes:{invert:[1,3]}}}},ke={mapping:"xr-standard",profiles:["samsung-gearvr","generic-trigger-touchpad"],buttons:{length:3,0:1,1:null,2:0},gripTransform:{orientation:[.11*Math.PI,0,0,1]}},He={mapping:"xr-standard",profiles:["samsung-odyssey","microsoft-mixed-reality","generic-trigger-squeeze-touchpad-thumbstick"],buttons:{length:4,0:1,1:0,2:2,3:4},gripTransform:{position:[0,-.02,.04,1],orientation:[.11*Math.PI,0,0,1]}},Ve={mapping:"xr-standard",profiles:["microsoft-mixed-reality","generic-trigger-squeeze-touchpad-thumbstick"],buttons:{length:4,0:1,1:0,2:2,3:4},gripTransform:{position:[0,-.02,.04,1],orientation:[.11*Math.PI,0,0,1]}},je={"Daydream Controller":{mapping:"",profiles:["google-daydream","generic-trigger-touchpad"],buttons:{length:3,0:null,1:null,2:0}},"Gear VR Controller":ke,"HTC Vive Focus Controller":{mapping:"xr-standard",profiles:["htc-vive-focus","generic-trigger-touchpad"],buttons:{length:3,0:1,1:null,2:0}},"Oculus Go Controller":Ne,"Oculus Touch (Right)":Ge,"Oculus Touch (Left)":Ge,"OpenVR Gamepad":ze,"Spatial Controller (Spatial Interaction Source) 045E-065A":Ve,"Spatial Controller (Spatial Interaction Source) 045E-065D":He,"Windows Mixed Reality (Right)":Ve,"Windows Mixed Reality (Left)":Ve};const We=g(.155,-.465,-.15),qe=g(-.155,-.465,-.15),Xe=g(0,0,-.25),Ye=g(0,0,.05),Qe=g(-.08,.14,.08),Ze=.4,Je=.4,Ke=.61,$e=.175,et=.12,tt=.87,rt=180/Math.PI;class nt{constructor(){this.hand="right",this.headElbowOffset=We,this.controllerQ=E(),this.lastControllerQ=E(),this.headQ=E(),this.headPos=m(),this.elbowPos=m(),this.wristPos=m(),this.time=null,this.lastTime=null,this.rootQ=E(),this.position=m()}setHandedness(e){this.hand!=e&&(this.hand=e,"left"==this.hand?this.headElbowOffset=qe:this.headElbowOffset=We)}update(e,t){this.time=X(),e&&(D(this.lastControllerQ,this.controllerQ),D(this.controllerQ,e)),t&&(d(this.headPos,t),p(this.headQ,t));let r=this.getHeadYawOrientation_(),n=this.quatAngle_(this.lastControllerQ,this.controllerQ);n/((this.time-this.lastTime)/1e3)>Ke?R(this.rootQ,this.rootQ,r,Math.min(n/$e,1)):D(this.rootQ,r);let i=g(0,0,-1);M(i,i,this.controllerQ);let a=w(i,[0,1,0]),o=this.clamp_((a-et)/tt,0,1),s=C(this.rootQ);L(s,s),T(s,s,this.controllerQ);let l=this.elbowPos;y(l,this.headPos),x(l,l,this.headElbowOffset);let c=v(Qe);b(c,c,o),x(l,l,c);let u=this.quatAngle_(s,E())*rt,h=(1-Math.pow(u/180,4))*(Ze+(1-Ze)*o*Je),f=E();R(f,f,s,h);let m=L(E(),f),A=C(s);T(A,A,m);let _=this.wristPos;y(_,Ye),M(_,_,f),x(_,_,Xe),M(_,_,A),x(_,_,l);let S=v(Qe);b(S,S,o),x(this.position,this.wristPos,S),M(this.position,this.position,this.rootQ),this.lastTime=this.time}getPosition(){return this.position}getHeadYawOrientation_(){let e=m();return function(e,t,r){function n(e,t,r){return e<t?t:e>r?r:e}var i=t[0]*t[0],a=t[1]*t[1],o=t[2]*t[2],s=t[3]*t[3];if("XYZ"===r)e[0]=Math.atan2(2*(t[0]*t[3]-t[1]*t[2]),s-i-a+o),e[1]=Math.asin(n(2*(t[0]*t[2]+t[1]*t[3]),-1,1)),e[2]=Math.atan2(2*(t[2]*t[3]-t[0]*t[1]),s+i-a-o);else if("YXZ"===r)e[0]=Math.asin(n(2*(t[0]*t[3]-t[1]*t[2]),-1,1)),e[1]=Math.atan2(2*(t[0]*t[2]+t[1]*t[3]),s-i-a+o),e[2]=Math.atan2(2*(t[0]*t[1]+t[2]*t[3]),s-i+a-o);else if("ZXY"===r)e[0]=Math.asin(n(2*(t[0]*t[3]+t[1]*t[2]),-1,1)),e[1]=Math.atan2(2*(t[1]*t[3]-t[2]*t[0]),s-i-a+o),e[2]=Math.atan2(2*(t[2]*t[3]-t[0]*t[1]),s-i+a-o);else if("ZYX"===r)e[0]=Math.atan2(2*(t[0]*t[3]+t[2]*t[1]),s-i-a+o),e[1]=Math.asin(n(2*(t[1]*t[3]-t[0]*t[2]),-1,1)),e[2]=Math.atan2(2*(t[0]*t[1]+t[2]*t[3]),s+i-a-o);else if("YZX"===r)e[0]=Math.atan2(2*(t[0]*t[3]-t[2]*t[1]),s-i+a-o),e[1]=Math.atan2(2*(t[1]*t[3]-t[0]*t[2]),s+i-a-o),e[2]=Math.asin(n(2*(t[0]*t[1]+t[2]*t[3]),-1,1));else{if("XZY"!==r)return void console.log("No order given for quaternion to euler conversion.");e[0]=Math.atan2(2*(t[0]*t[3]+t[1]*t[2]),s-i+a-o),e[1]=Math.atan2(2*(t[0]*t[2]+t[1]*t[3]),s+i-a-o),e[2]=Math.asin(n(2*(t[2]*t[3]-t[0]*t[1]),-1,1))}}(e,this.headQ,"YXZ"),function(e,t,r,n){let i=.5*Math.PI/180;t*=i,r*=i,n*=i;let a=Math.sin(t),o=Math.cos(t),s=Math.sin(r),l=Math.cos(r),c=Math.sin(n),u=Math.cos(n);return e[0]=a*l*u-o*s*c,e[1]=o*s*u+a*l*c,e[2]=o*l*c-a*s*u,e[3]=o*l*u+a*s*c,e}(E(),0,e[1]*rt,0)}clamp_(e,t,r){return Math.min(Math.max(e,t),r)}quatAngle_(e,t){let r=[0,0,-1],n=[0,0,-1];return M(r,r,e),M(n,n,t),function(e,t){let r=g(e[0],e[1],e[2]),n=g(t[0],t[1],t[2]);A(r,r),A(n,n);let i=w(r,n);return i>1?0:i<-1?Math.PI:Math.acos(i)}(r,n)}}const it=Symbol("@@webxr-polyfill/XRRemappedGamepad"),at={pressed:!1,touched:!1,value:0};Object.freeze(at);class ot{constructor(e,t,r){if(r||(r={}),r.userAgentOverrides)for(let e in r.userAgentOverrides)if(navigator.userAgent.includes(e)){let t=r.userAgentOverrides[e];for(let e in t)e in r?Object.assign(r[e],t[e]):r[e]=t[e];break}let n=new Array(r.axes&&r.axes.length?r.axes.length:e.axes.length),i=new Array(r.buttons&&r.buttons.length?r.buttons.length:e.buttons.length),a=null;if(r.gripTransform){let e=r.gripTransform.orientation||[0,0,0,1];h(a=s(),I(e,e),r.gripTransform.position||[0,0,0])}let o=null;if(r.targetRayTransform){let e=r.targetRayTransform.orientation||[0,0,0,1];h(o=s(),I(e,e),r.targetRayTransform.position||[0,0,0])}let l=r.profiles;r.displayProfiles&&t.displayName in r.displayProfiles&&(l=r.displayProfiles[t.displayName]),this[it]={gamepad:e,map:r,profiles:l||[e.id],mapping:r.mapping||e.mapping,axes:n,buttons:i,gripTransform:a,targetRayTransform:o},this._update()}_update(){let e=this[it].gamepad,t=this[it].map,r=this[it].axes;for(let n=0;n<r.length;++n)t.axes&&n in t.axes?null===t.axes[n]?r[n]=0:r[n]=e.axes[t.axes[n]]:r[n]=e.axes[n];if(t.axes&&t.axes.invert)for(let e of t.axes.invert)e<r.length&&(r[e]*=-1);let n=this[it].buttons;for(let r=0;r<n.length;++r)t.buttons&&r in t.buttons?null===t.buttons[r]?n[r]=at:n[r]=e.buttons[t.buttons[r]]:n[r]=e.buttons[r]}get id(){return""}get _profiles(){return this[it].profiles}get index(){return-1}get connected(){return this[it].gamepad.connected}get timestamp(){return this[it].gamepad.timestamp}get mapping(){return this[it].mapping}get axes(){return this[it].axes}get buttons(){return this[it].buttons}get hapticActuators(){return this[it].gamepad.hapticActuators}}class st{constructor(e,t,r=0,n=-1){this.polyfill=e,this.display=t,this.nativeGamepad=null,this.gamepad=null,this.inputSource=new Se(this),this.lastPosition=m(),this.emulatedPosition=!1,this.basePoseMatrix=s(),this.outputMatrix=s(),this.primaryButtonIndex=r,this.primaryActionPressed=!1,this.primarySqueezeButtonIndex=n,this.primarySqueezeActionPressed=!1,this.handedness="",this.targetRayMode="gaze",this.armModel=null}get profiles(){return this.gamepad?this.gamepad._profiles:[]}updateFromGamepad(e){this.nativeGamepad!==e&&(this.nativeGamepad=e,this.gamepad=e?new ot(e,this.display,je[e.id]):null),this.handedness=""===e.hand?"none":e.hand,this.gamepad&&this.gamepad._update(),e.pose?(this.targetRayMode="tracked-pointer",this.emulatedPosition=!e.pose.hasPosition):""===e.hand&&(this.targetRayMode="gaze",this.emulatedPosition=!1)}updateBasePoseMatrix(){if(this.nativeGamepad&&this.nativeGamepad.pose){let e=this.nativeGamepad.pose,t=e.position,r=e.orientation;if(!t&&!r)return;t?(this.lastPosition[0]=t[0],this.lastPosition[1]=t[1],this.lastPosition[2]=t[2]):e.hasPosition?t=this.lastPosition:(this.armModel||(this.armModel=new nt),this.armModel.setHandedness(this.nativeGamepad.hand),this.armModel.update(r,this.polyfill.getBasePoseMatrix()),t=this.armModel.getPosition()),h(this.basePoseMatrix,r,t)}else e=this.basePoseMatrix,t=this.polyfill.getBasePoseMatrix(),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],e[9]=t[9],e[10]=t[10],e[11]=t[11],e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15];var e,t;return this.basePoseMatrix}getXRPose(e,t){switch(this.updateBasePoseMatrix(),t){case"target-ray":e._transformBasePoseMatrix(this.outputMatrix,this.basePoseMatrix),this.gamepad&&this.gamepad[it].targetRayTransform&&u(this.outputMatrix,this.outputMatrix,this.gamepad[it].targetRayTransform);break;case"grip":if(!this.nativeGamepad||!this.nativeGamepad.pose)return null;e._transformBasePoseMatrix(this.outputMatrix,this.basePoseMatrix),this.gamepad&&this.gamepad[it].gripTransform&&u(this.outputMatrix,this.outputMatrix,this.gamepad[it].gripTransform);break;default:return null}return e._adjustForOriginOffset(this.outputMatrix),new XRPose(new XRRigidTransform(this.outputMatrix),this.emulatedPosition)}}const lt=!1,ct={highRefreshRate:!0},ut={oculus:1,openvr:1,"spatial controller (spatial interaction source)":1};let ht=0;class dt{constructor(e,t,r={}){if(this.mode=e,this.enabledFeatures=t,this.outputContext=null,this.immersive="immersive-vr"==e||"immersive-ar"==e,this.ended=null,this.baseLayer=null,this.id=++ht,this.modifiedCanvasLayer=!1,this.outputContext&&!lt){const e=r.renderContextType||"2d";this.renderContext=this.outputContext.canvas.getContext(e)}}}class pt extends Ue{constructor(e,t){const{canPresent:r}=t.capabilities;super(e),this.display=t,this.frame=new e.VRFrameData,this.sessions=new Map,this.immersiveSession=null,this.canPresent=r,this.baseModelMatrix=s(),this.gamepadInputSources={},this.tempVec3=new Float32Array(3),this.onVRDisplayPresentChange=this.onVRDisplayPresentChange.bind(this),e.window.addEventListener("vrdisplaypresentchange",this.onVRDisplayPresentChange),this.CAN_USE_GAMEPAD=e.navigator&&"getGamepads"in e.navigator,this.HAS_BITMAP_SUPPORT=Pe(e)}get depthNear(){return this.display.depthNear}set depthNear(e){this.display.depthNear=e}get depthFar(){return this.display.depthFar}set depthFar(e){this.display.depthFar=e}onBaseLayerSet(e,t){const r=this.sessions.get(e),n=t.context.canvas;if(r.immersive){const e=this.display.getEyeParameters("left"),i=this.display.getEyeParameters("right");n.width=2*Math.max(e.renderWidth,i.renderWidth),n.height=Math.max(e.renderHeight,i.renderHeight),this.display.requestPresent([{source:n,attributes:ct}]).then(()=>{lt||this.global.document.body.contains(n)||(r.modifiedCanvasLayer=!0,this.global.document.body.appendChild(n),De(n)),r.baseLayer=t})}else r.baseLayer=t}isSessionSupported(e){return"immersive-ar"!=e&&("immersive-vr"!=e||!1!==this.canPresent)}isFeatureSupported(e){switch(e){case"viewer":case"local":case"local-floor":return!0;case"bounded":case"unbounded":default:return!1}}async requestSession(e,t){if(!this.isSessionSupported(e))return Promise.reject();let r="immersive-vr"==e;if(r){const e=this.global.document.createElement("canvas");if(!lt){e.getContext("webgl")}await this.display.requestPresent([{source:e,attributes:ct}])}const n=new dt(e,t,{renderContextType:this.HAS_BITMAP_SUPPORT?"bitmaprenderer":"2d"});return this.sessions.set(n.id,n),r&&(this.immersiveSession=n,this.dispatchEvent("@@webxr-polyfill/vr-present-start",n.id)),Promise.resolve(n.id)}requestAnimationFrame(e){return this.display.requestAnimationFrame(e)}getPrimaryButtonIndex(e){let t=0,r=e.id.toLowerCase();for(let e in ut)if(r.includes(e)){t=ut[e];break}return Math.min(t,e.buttons.length-1)}onFrameStart(e,t){this.display.depthNear=t.depthNear,this.display.depthFar=t.depthFar,this.display.getFrameData(this.frame);const r=this.sessions.get(e);if(r.immersive&&this.CAN_USE_GAMEPAD){let e=this.gamepadInputSources;this.gamepadInputSources={};let t=this.global.navigator.getGamepads();for(let n=0;n<t.length;++n){let i=t[n];if(i&&i.displayId>0){let t=e[n];if(t||(t=new st(this,this.display,this.getPrimaryButtonIndex(i))),t.updateFromGamepad(i),this.gamepadInputSources[n]=t,-1!=t.primaryButtonIndex){let e=i.buttons[t.primaryButtonIndex].pressed;e&&!t.primaryActionPressed?this.dispatchEvent("@@webxr-polyfill/input-select-start",{sessionId:r.id,inputSource:t.inputSource}):!e&&t.primaryActionPressed&&this.dispatchEvent("@@webxr-polyfill/input-select-end",{sessionId:r.id,inputSource:t.inputSource}),t.primaryActionPressed=e}if(-1!=t.primarySqueezeButtonIndex){let e=i.buttons[t.primarySqueezeButtonIndex].pressed;e&&!t.primarySqueezeActionPressed?this.dispatchEvent("@@webxr-polyfill/input-squeeze-start",{sessionId:r.id,inputSource:t.inputSource}):!e&&t.primarySqueezeActionPressed&&this.dispatchEvent("@@webxr-polyfill/input-squeeze-end",{sessionId:r.id,inputSource:t.inputSource}),t.primarySqueezeActionPressed=e}}}}if(!lt&&!r.immersive&&r.baseLayer){const e=r.baseLayer.context.canvas;f(this.frame.leftProjectionMatrix,t.inlineVerticalFieldOfView,e.width/e.height,t.depthNear,t.depthFar)}}onFrameEnd(e){const t=this.sessions.get(e);if(!t.ended&&t.baseLayer){if(t.outputContext&&(!t.immersive||this.display.capabilities.hasExternalDisplay)){const e=t.immersive&&this.display.capabilities.hasExternalDisplay,r=t.baseLayer.context.canvas,n=e?r.width/2:r.width,i=r.height;if(!lt){const e=t.outputContext.canvas,a=e.width,o=e.height,s=t.renderContext;this.HAS_BITMAP_SUPPORT?r.transferToImageBitmap?s.transferFromImageBitmap(r.transferToImageBitmap()):this.global.createImageBitmap(r,0,0,n,i,{resizeWidth:a,resizeHeight:o}).then(e=>s.transferFromImageBitmap(e)):s.drawImage(r,0,0,n,i,0,0,a,o)}}t.immersive&&t.baseLayer&&this.display.submitFrame()}}cancelAnimationFrame(e){this.display.cancelAnimationFrame(e)}async endSession(e){const t=this.sessions.get(e);if(!t.ended)return t.immersive?this.display.exitPresent():void(t.ended=!0)}doesSessionSupportReferenceSpace(e,t){const r=this.sessions.get(e);return!r.ended&&r.enabledFeatures.has(t)}requestStageBounds(){if(this.display.stageParameters){const e=this.display.stageParameters.sizeX,t=this.display.stageParameters.sizeZ,r=[];return r.push(-e/2),r.push(-t/2),r.push(e/2),r.push(-t/2),r.push(e/2),r.push(t/2),r.push(-e/2),r.push(t/2),r}return null}async requestFrameOfReferenceTransform(e,t){return("local-floor"===e||"bounded-floor"===e)&&this.display.stageParameters&&this.display.stageParameters.sittingToStandingTransform?this.display.stageParameters.sittingToStandingTransform:null}getProjectionMatrix(e){if("left"===e)return this.frame.leftProjectionMatrix;if("right"===e)return this.frame.rightProjectionMatrix;if("none"===e)return this.frame.leftProjectionMatrix;throw new Error("eye must be of type 'left' or 'right'")}getViewport(e,t,r,n){const i=this.sessions.get(e),{width:a,height:o}=r.context.canvas;if(!i.immersive)return n.x=n.y=0,n.width=a,n.height=o,!0;if("left"===t||"none"===t)n.x=0;else{if("right"!==t)return!1;n.x=a/2}return n.y=0,n.width=a/2,n.height=o,!0}getBasePoseMatrix(){let{position:e,orientation:t}=this.frame.pose;return e||t?(e||((e=this.tempVec3)[0]=e[1]=e[2]=0),h(this.baseModelMatrix,t,e),this.baseModelMatrix):this.baseModelMatrix}getBaseViewMatrix(e){if("left"===e||"none"===e)return this.frame.leftViewMatrix;if("right"===e)return this.frame.rightViewMatrix;throw new Error("eye must be of type 'left' or 'right'")}getInputSources(){let e=[];for(let t in this.gamepadInputSources)e.push(this.gamepadInputSources[t].inputSource);return e}getInputPose(e,t,r){if(!t)return null;for(let n in this.gamepadInputSources){let i=this.gamepadInputSources[n];if(i.inputSource===e)return i.getXRPose(t,r)}return null}onWindowResize(){}onVRDisplayPresentChange(e){this.display.isPresenting||this.sessions.forEach(e=>{if(e.immersive&&!e.ended){if(e.modifiedCanvasLayer){const t=e.baseLayer.context.canvas;document.body.removeChild(t),t.setAttribute("style","")}this.immersiveSession===e&&(this.immersiveSession=null),this.dispatchEvent("@@webxr-polyfill/vr-present-end",e.id)}})}}class ft extends pt{constructor(e,t){const r=new Fe(t||{});super(e,r),this.display=r,this.frame={rightViewMatrix:new Float32Array(16),leftViewMatrix:new Float32Array(16),rightProjectionMatrix:new Float32Array(16),leftProjectionMatrix:new Float32Array(16),pose:null,timestamp:null}}}const mt=!1;let vt=0;class gt{constructor(e,t){this.mode=e,this.enabledFeatures=t,this.ended=null,this.baseLayer=null,this.id=++vt}}class yt extends Ue{constructor(e){super(e),this.sessions=new Map,this.projectionMatrix=s(),this.identityMatrix=s()}onBaseLayerSet(e,t){this.sessions.get(e).baseLayer=t}isSessionSupported(e){return"inline"==e}isFeatureSupported(e){switch(e){case"viewer":return!0;default:return!1}}async requestSession(e,t){if(!this.isSessionSupported(e))return Promise.reject();const r=new gt(e,t);return this.sessions.set(r.id,r),Promise.resolve(r.id)}requestAnimationFrame(e){return window.requestAnimationFrame(e)}cancelAnimationFrame(e){window.cancelAnimationFrame(e)}onFrameStart(e,t){if(mt)return;const r=this.sessions.get(e);if(r.baseLayer){const e=r.baseLayer.context.canvas;f(this.projectionMatrix,t.inlineVerticalFieldOfView,e.width/e.height,t.depthNear,t.depthFar)}}onFrameEnd(e){}async endSession(e){this.sessions.get(e).ended=!0}doesSessionSupportReferenceSpace(e,t){const r=this.sessions.get(e);return!r.ended&&r.enabledFeatures.has(t)}requestStageBounds(){return null}async requestFrameOfReferenceTransform(e,t){return null}getProjectionMatrix(e){return this.projectionMatrix}getViewport(e,t,r,n){this.sessions.get(e);const{width:i,height:a}=r.context.canvas;return n.x=n.y=0,n.width=i,n.height=a,!0}getBasePoseMatrix(){return this.identityMatrix}getBaseViewMatrix(e){return this.identityMatrix}getInputSources(){return[]}getInputPose(e,t,r){return null}onWindowResize(){}}const xt=async function(e,t){if(t.webvr){let t=await async function(e){let t=null;if("getVRDisplays"in e.navigator)try{const r=await e.navigator.getVRDisplays();r&&r.length&&(t=new pt(e,r[0]))}catch(e){}return t}(e);if(t)return t}let r=(e=>{var t=!1;return function(e){(/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows ce|xda|xiino/i.test(e)||/1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc\-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|\-[a-w])|libw|lynx|m1\-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m\-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\-2|po(ck|rt|se)|prox|psio|pt\-g|qa\-a|qc(07|12|21|32|60|\-[2-7]|i\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\-|oo|p\-)|sdk\/|se(c(\-|0|1)|47|mc|nd|ri)|sgh\-|shar|sie(\-|m)|sk\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\-|v\-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\-|tdg\-|tel(i|m)|tim\-|t\-mo|to(pl|sh)|ts(70|m\-|m3|m5)|tx\-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas\-|your|zeto|zte\-/i.test(e.substr(0,4)))&&(t=!0)}(e.navigator.userAgent||e.navigator.vendor||e.opera),t})(e);return r&&t.cardboard||!r&&t.allowCardboardOnDesktop?(e.VRFrameData||(e.VRFrameData=function(){this.rightViewMatrix=new Float32Array(16),this.leftViewMatrix=new Float32Array(16),this.rightProjectionMatrix=new Float32Array(16),this.leftProjectionMatrix=new Float32Array(16),this.pose=null}),new ft(e,t.cardboardConfig)):new yt(e)},bt={global:r,webvr:!0,cardboard:!0,cardboardConfig:null,allowCardboardOnDesktop:!1},At=["navigator","HTMLCanvasElement","WebGLRenderingContext"];t.a=class{constructor(e={}){this.config=Object.freeze(Object.assign({},bt,e)),this.global=this.config.global,this.nativeWebXR="xr"in this.global.navigator,this.injected=!1,this.nativeWebXR?this._injectCompatibilityShims(this.global):this._injectPolyfill(this.global)}_injectPolyfill(e){if(!At.every(t=>!!e[t]))throw new Error(`Global must have the following attributes : ${At}`);for(const t of Object.keys(Re))void 0!==e[t]?console.warn(`${t} already defined on global.`):e[t]=Re[t];Le(e.WebGLRenderingContext)&&(Ce(e.HTMLCanvasElement),e.OffscreenCanvas&&Ce(e.OffscreenCanvas),e.WebGL2RenderingContext&&Le(e.WebGL2RenderingContext));this.injected=!0,this._patchNavigatorXR()}_patchNavigatorXR(){let e=xt(this.global,this.config);this.xr=new Re.XR(e),Object.defineProperty(this.global.navigator,"xr",{value:this.xr,configurable:!0})}_injectCompatibilityShims(e){if(!At.every(t=>!!e[t]))throw new Error(`Global must have the following attributes : ${At}`);if(e.navigator.xr&&"supportsSession"in e.navigator.xr&&!("isSessionSupported"in e.navigator.xr)){let t=e.navigator.xr.supportsSession;e.navigator.xr.isSessionSupported=function(e){return t.call(this,e).then(()=>!0).catch(()=>!1)},e.navigator.xr.supportsSession=function(e){return console.warn("navigator.xr.supportsSession() is deprecated. Please call navigator.xr.isSessionSupported() instead and check the boolean value returned when the promise resolves."),t.call(this,e)}}}}}).call(this,r(5))},function(e,t){var r;r=function(){return this}();try{r=r||new Function("return this")()}catch(e){"object"==typeof window&&(r=window)}e.exports=r},function(e,t,r){"use strict";r.r(t);var n={};r.r(n),r.d(n,"setup",(function(){return _t})),r.d(n,"enter",(function(){return Mt})),r.d(n,"exit",(function(){return St})),r.d(n,"execute",(function(){return Et}));var i={};r.r(i),r.d(i,"setup",(function(){return Qt})),r.d(i,"enter",(function(){return Zt})),r.d(i,"exit",(function(){return Jt})),r.d(i,"execute",(function(){return Kt})),r.d(i,"onSelectEnd",(function(){return $t}));var a={};r.r(a),r.d(a,"setup",(function(){return er})),r.d(a,"enter",(function(){return tr})),r.d(a,"exit",(function(){return rr})),r.d(a,"execute",(function(){return nr})),r.d(a,"onSelectEnd",(function(){return ir}));var o={};r.r(o),r.d(o,"setup",(function(){return ar})),r.d(o,"enter",(function(){return or})),r.d(o,"exit",(function(){return sr})),r.d(o,"execute",(function(){return lr}));var s={};r.r(s),r.d(s,"setup",(function(){return cr})),r.d(s,"enter",(function(){return ur})),r.d(s,"exit",(function(){return hr})),r.d(s,"execute",(function(){return dr}));var l={};r.r(l),r.d(l,"setup",(function(){return gr})),r.d(l,"enter",(function(){return br})),r.d(l,"exit",(function(){return Ar})),r.d(l,"execute",(function(){return wr}));var c=r(0),u=function(e,t){void 0===t&&(console.warn('THREE.PointerLockControls: The second parameter "domElement" is now mandatory.'),t=document.body),this.domElement=t,this.isLocked=!1;var r,n=this,i={type:"change"},a={type:"lock"},o={type:"unlock"},s=new c.Euler(0,0,0,"YXZ"),l=Math.PI/2,u=new c.Vector3;function h(t){if(!1!==n.isLocked){var r=t.movementX||t.mozMovementX||t.webkitMovementX||0,a=t.movementY||t.mozMovementY||t.webkitMovementY||0;s.setFromQuaternion(e.quaternion),s.y-=.002*r,s.x-=.002*a,s.x=Math.max(-l,Math.min(l,s.x)),e.quaternion.setFromEuler(s),n.dispatchEvent(i)}}function d(){document.pointerLockElement===n.domElement?(n.dispatchEvent(a),n.isLocked=!0):(n.dispatchEvent(o),n.isLocked=!1)}function p(){console.error("THREE.PointerLockControls: Unable to use Pointer Lock API")}this.connect=function(){document.addEventListener("mousemove",h,!1),document.addEventListener("pointerlockchange",d,!1),document.addEventListener("pointerlockerror",p,!1)},this.disconnect=function(){document.removeEventListener("mousemove",h,!1),document.removeEventListener("pointerlockchange",d,!1),document.removeEventListener("pointerlockerror",p,!1)},this.dispose=function(){this.disconnect()},this.getObject=function(){return e},this.getDirection=(r=new c.Vector3(0,0,-1),function(t){return t.copy(r).applyQuaternion(e.quaternion)}),this.moveForward=function(t){u.setFromMatrixColumn(e.matrix,0),u.crossVectors(e.up,u),e.position.addScaledVector(u,t)},this.moveRight=function(t){u.setFromMatrixColumn(e.matrix,0),e.position.addScaledVector(u,t)},this.lock=function(){this.domElement.requestPointerLock()},this.unlock=function(){document.exitPointerLock()},this.connect()};u.prototype=Object.create(c.EventDispatcher.prototype),u.prototype.constructor=u;var h={createButton:function(e,t){function r(){i.style.display="",i.style.cursor="auto",i.style.left="calc(50% - 75px)",i.style.width="150px",i.onmouseenter=null,i.onmouseleave=null,i.onclick=null,i.textContent="VR NOT SUPPORTED"}function n(e){e.style.position="absolute",e.style.bottom="20px",e.style.padding="12px 6px",e.style.border="1px solid #fff",e.style.borderRadius="4px",e.style.background="rgba(0,0,0,0.1)",e.style.color="#fff",e.style.font="normal 13px sans-serif",e.style.textAlign="center",e.style.opacity="0.5",e.style.outline="none",e.style.zIndex="999"}if(t&&t.referenceSpaceType&&e.xr.setReferenceSpaceType(t.referenceSpaceType),"xr"in navigator){var i=document.createElement("button");return i.style.display="none",n(i),navigator.xr.isSessionSupported("immersive-vr").then((function(t){t?function(){var t=null;function r(r){r.addEventListener("end",n),e.xr.setSession(r),i.textContent="EXIT VR",t=r}function n(){t.removeEventListener("end",n),i.textContent="ENTER VR",t=null}i.style.display="",i.style.cursor="pointer",i.style.left="calc(50% - 50px)",i.style.width="100px",i.textContent="ENTER VR",i.onmouseenter=function(){i.style.opacity="1.0"},i.onmouseleave=function(){i.style.opacity="0.5"},i.onclick=function(){if(null===t){navigator.xr.requestSession("immersive-vr",{optionalFeatures:["local-floor","bounded-floor"]}).then(r)}else t.end()}}():r()})),i}var a=document.createElement("a");return a.href="https://immersiveweb.dev/",!1===window.isSecureContext?a.innerHTML="WEBXR NEEDS HTTPS":a.innerHTML="WEBXR NOT AVAILABLE",a.style.left="calc(50% - 90px)",a.style.width="180px",a.style.textDecoration="none",n(a),a}},d=function(e){c.Loader.call(this,e),this.transcoderPath="",this.transcoderBinary=null,this.transcoderPending=null,this.workerLimit=4,this.workerPool=[],this.workerNextTaskID=1,this.workerSourceURL="",this.workerConfig={format:null,astcSupported:!1,etcSupported:!1,dxtSupported:!1,pvrtcSupported:!1}};d.prototype=Object.assign(Object.create(c.Loader.prototype),{constructor:d,setTranscoderPath:function(e){return this.transcoderPath=e,this},setWorkerLimit:function(e){return this.workerLimit=e,this},detectSupport:function(e){var t=this.workerConfig;if(t.astcSupported=!!e.extensions.get("WEBGL_compressed_texture_astc"),t.etcSupported=!!e.extensions.get("WEBGL_compressed_texture_etc1"),t.dxtSupported=!!e.extensions.get("WEBGL_compressed_texture_s3tc"),t.pvrtcSupported=!!e.extensions.get("WEBGL_compressed_texture_pvrtc")||!!e.extensions.get("WEBKIT_WEBGL_compressed_texture_pvrtc"),t.astcSupported)t.format=d.BASIS_FORMAT.cTFASTC_4x4;else if(t.dxtSupported)t.format=d.BASIS_FORMAT.cTFBC3;else if(t.pvrtcSupported)t.format=d.BASIS_FORMAT.cTFPVRTC1_4_RGBA;else{if(!t.etcSupported)throw new Error("THREE.BasisTextureLoader: No suitable compressed texture format found.");t.format=d.BASIS_FORMAT.cTFETC1}return this},load:function(e,t,r,n){var i=new c.FileLoader(this.manager);i.setResponseType("arraybuffer"),i.load(e,e=>{this._createTexture(e).then(t).catch(n)},r,n)},_createTexture:function(e){var t,r,n=e.byteLength,i=this._allocateWorker(n).then(n=>(t=n,r=this.workerNextTaskID++,new Promise((n,i)=>{t._callbacks[r]={resolve:n,reject:i},t.postMessage({type:"transcode",id:r,buffer:e},[e])}))).then(e=>{var t,r=this.workerConfig,{width:n,height:i,mipmaps:a,format:o}=e;switch(o){case d.BASIS_FORMAT.cTFASTC_4x4:t=new c.CompressedTexture(a,n,i,c.RGBA_ASTC_4x4_Format);break;case d.BASIS_FORMAT.cTFBC1:case d.BASIS_FORMAT.cTFBC3:t=new c.CompressedTexture(a,n,i,d.DXT_FORMAT_MAP[r.format],c.UnsignedByteType);break;case d.BASIS_FORMAT.cTFETC1:t=new c.CompressedTexture(a,n,i,c.RGB_ETC1_Format);break;case d.BASIS_FORMAT.cTFPVRTC1_4_RGB:t=new c.CompressedTexture(a,n,i,c.RGB_PVRTC_4BPPV1_Format);break;case d.BASIS_FORMAT.cTFPVRTC1_4_RGBA:t=new c.CompressedTexture(a,n,i,c.RGBA_PVRTC_4BPPV1_Format);break;default:throw new Error("THREE.BasisTextureLoader: No supported format available.")}return t.minFilter=1===a.length?c.LinearFilter:c.LinearMipmapLinearFilter,t.magFilter=c.LinearFilter,t.generateMipmaps=!1,t.needsUpdate=!0,t});return i.finally(()=>{t&&r&&(t._taskLoad-=n,delete t._callbacks[r])}),i},_initTranscoder:function(){if(!this.transcoderPending){var e=new c.FileLoader(this.manager);e.setPath(this.transcoderPath);var t=new Promise((t,r)=>{e.load("basis_transcoder.js",t,void 0,r)}),r=new c.FileLoader(this.manager);r.setPath(this.transcoderPath),r.setResponseType("arraybuffer");var n=new Promise((e,t)=>{r.load("basis_transcoder.wasm",e,void 0,t)});this.transcoderPending=Promise.all([t,n]).then(([e,t])=>{var r=d.BasisWorker.toString(),n=["/* basis_transcoder.js */",e,"/* worker */",r.substring(r.indexOf("{")+1,r.lastIndexOf("}"))].join("\n");this.workerSourceURL=URL.createObjectURL(new Blob([n])),this.transcoderBinary=t})}return this.transcoderPending},_allocateWorker:function(e){return this._initTranscoder().then(()=>{var t;this.workerPool.length<this.workerLimit?((t=new Worker(this.workerSourceURL))._callbacks={},t._taskLoad=0,t.postMessage({type:"init",config:this.workerConfig,transcoderBinary:this.transcoderBinary}),t.onmessage=function(e){var r=e.data;switch(r.type){case"transcode":t._callbacks[r.id].resolve(r);break;case"error":t._callbacks[r.id].reject(r);break;default:console.error('THREE.BasisTextureLoader: Unexpected message, "'+r.type+'"')}},this.workerPool.push(t)):this.workerPool.sort((function(e,t){return e._taskLoad>t._taskLoad?-1:1}));return(t=this.workerPool[this.workerPool.length-1])._taskLoad+=e,t})},dispose:function(){for(var e=0;e<this.workerPool.length;e++)this.workerPool[e].terminate();return this.workerPool.length=0,this}}),d.BASIS_FORMAT={cTFETC1:0,cTFETC2:1,cTFBC1:2,cTFBC3:3,cTFBC4:4,cTFBC5:5,cTFBC7_M6_OPAQUE_ONLY:6,cTFBC7_M5:7,cTFPVRTC1_4_RGB:8,cTFPVRTC1_4_RGBA:9,cTFASTC_4x4:10,cTFATC_RGB:11,cTFATC_RGBA_INTERPOLATED_ALPHA:12,cTFRGBA32:13,cTFRGB565:14,cTFBGR565:15,cTFRGBA4444:16},d.DXT_FORMAT={COMPRESSED_RGB_S3TC_DXT1_EXT:33776,COMPRESSED_RGBA_S3TC_DXT1_EXT:33777,COMPRESSED_RGBA_S3TC_DXT3_EXT:33778,COMPRESSED_RGBA_S3TC_DXT5_EXT:33779},d.DXT_FORMAT_MAP={},d.DXT_FORMAT_MAP[d.BASIS_FORMAT.cTFBC1]=d.DXT_FORMAT.COMPRESSED_RGB_S3TC_DXT1_EXT,d.DXT_FORMAT_MAP[d.BASIS_FORMAT.cTFBC3]=d.DXT_FORMAT.COMPRESSED_RGBA_S3TC_DXT5_EXT,d.BasisWorker=function(){var e,t,r;onmessage=function(n){var i,a,o=n.data;switch(o.type){case"init":e=o.config,i=o.transcoderBinary,t=new Promise(e=>{a={wasmBinary:i,onRuntimeInitialized:e},BASIS(a)}).then(()=>{var{BasisFile:e,initializeBasis:t}=a;r=e,t()});break;case"transcode":t.then(()=>{try{for(var{width:t,height:n,hasAlpha:i,mipmaps:a,format:s}=function(t){var n=new r(new Uint8Array(t)),i=n.getImageWidth(0,0),a=n.getImageHeight(0,0),o=n.getNumLevels(0),s=n.getHasAlpha();function l(){n.close(),n.delete()}if(!s)switch(e.format){case 9:e.format=8}if(!i||!a||!o)throw l(),new Error("THREE.BasisTextureLoader: Invalid .basis file");if(!n.startTranscoding())throw l(),new Error("THREE.BasisTextureLoader: .startTranscoding failed");for(var c=[],u=0;u<o;u++){var h=n.getImageWidth(0,u),d=n.getImageHeight(0,u),p=new Uint8Array(n.getImageTranscodedSizeInBytes(0,u,e.format));if(!n.transcodeImage(p,0,u,e.format,0,s))throw l(),new Error("THREE.BasisTextureLoader: .transcodeImage failed.");c.push({data:p,width:h,height:d})}return l(),{width:i,height:a,hasAlpha:s,mipmaps:c,format:e.format}}(o.buffer),l=[],c=0;c<a.length;++c)l.push(a[c].data.buffer);self.postMessage({type:"transcode",id:o.id,width:t,height:n,hasAlpha:i,mipmaps:a,format:s},l)}catch(e){console.error(e),self.postMessage({type:"error",id:o.id,error:e.message})}})}}};var p=function(){function e(e){c.Loader.call(this,e),this.dracoLoader=null,this.ddsLoader=null}function t(){var e={};return{get:function(t){return e[t]},add:function(t,r){e[t]=r},remove:function(t){delete e[t]},removeAll:function(){e={}}}}e.prototype=Object.assign(Object.create(c.Loader.prototype),{constructor:e,load:function(e,t,r,n){var i,a=this;i=""!==this.resourcePath?this.resourcePath:""!==this.path?this.path:c.LoaderUtils.extractUrlBase(e),a.manager.itemStart(e);var o=function(t){n?n(t):console.error(t),a.manager.itemError(e),a.manager.itemEnd(e)},s=new c.FileLoader(a.manager);s.setPath(this.path),s.setResponseType("arraybuffer"),"use-credentials"===a.crossOrigin&&s.setWithCredentials(!0),s.load(e,(function(r){try{a.parse(r,i,(function(r){t(r),a.manager.itemEnd(e)}),o)}catch(e){o(e)}}),r,o)},setDRACOLoader:function(e){return this.dracoLoader=e,this},setDDSLoader:function(e){return this.ddsLoader=e,this},parse:function(e,t,s,l){var m,v={};if("string"==typeof e)m=e;else if(c.LoaderUtils.decodeText(new Uint8Array(e,0,4))===o){try{v[r.KHR_BINARY_GLTF]=new u(e)}catch(e){return void(l&&l(e))}m=v[r.KHR_BINARY_GLTF].content}else m=c.LoaderUtils.decodeText(new Uint8Array(e));var g=JSON.parse(m);if(void 0===g.asset||g.asset.version[0]<2)l&&l(new Error("THREE.GLTFLoader: Unsupported asset. glTF versions >=2.0 are supported."));else{if(g.extensionsUsed)for(var y=0;y<g.extensionsUsed.length;++y){var x=g.extensionsUsed[y],b=g.extensionsRequired||[];switch(x){case r.KHR_LIGHTS_PUNCTUAL:v[x]=new i(g);break;case r.KHR_MATERIALS_UNLIT:v[x]=new a;break;case r.KHR_MATERIALS_PBR_SPECULAR_GLOSSINESS:v[x]=new p;break;case r.KHR_DRACO_MESH_COMPRESSION:v[x]=new h(g,this.dracoLoader);break;case r.MSFT_TEXTURE_DDS:v[x]=new n(this.ddsLoader);break;case r.KHR_TEXTURE_TRANSFORM:v[x]=new d;break;case r.KHR_MESH_QUANTIZATION:v[x]=new f;break;default:b.indexOf(x)>=0&&console.warn('THREE.GLTFLoader: Unknown extension "'+x+'".')}}new G(g,v,{path:t||this.resourcePath||"",crossOrigin:this.crossOrigin,manager:this.manager}).parse(s,l)}}});var r={KHR_BINARY_GLTF:"KHR_binary_glTF",KHR_DRACO_MESH_COMPRESSION:"KHR_draco_mesh_compression",KHR_LIGHTS_PUNCTUAL:"KHR_lights_punctual",KHR_MATERIALS_PBR_SPECULAR_GLOSSINESS:"KHR_materials_pbrSpecularGlossiness",KHR_MATERIALS_UNLIT:"KHR_materials_unlit",KHR_TEXTURE_TRANSFORM:"KHR_texture_transform",KHR_MESH_QUANTIZATION:"KHR_mesh_quantization",MSFT_TEXTURE_DDS:"MSFT_texture_dds"};function n(e){if(!e)throw new Error("THREE.GLTFLoader: Attempting to load .dds texture without importing DDSLoader");this.name=r.MSFT_TEXTURE_DDS,this.ddsLoader=e}function i(e){this.name=r.KHR_LIGHTS_PUNCTUAL;var t=e.extensions&&e.extensions[r.KHR_LIGHTS_PUNCTUAL]||{};this.lightDefs=t.lights||[]}function a(){this.name=r.KHR_MATERIALS_UNLIT}i.prototype.loadLight=function(e){var t,r=this.lightDefs[e],n=new c.Color(16777215);void 0!==r.color&&n.fromArray(r.color);var i=void 0!==r.range?r.range:0;switch(r.type){case"directional":(t=new c.DirectionalLight(n)).target.position.set(0,0,-1),t.add(t.target);break;case"point":(t=new c.PointLight(n)).distance=i;break;case"spot":(t=new c.SpotLight(n)).distance=i,r.spot=r.spot||{},r.spot.innerConeAngle=void 0!==r.spot.innerConeAngle?r.spot.innerConeAngle:0,r.spot.outerConeAngle=void 0!==r.spot.outerConeAngle?r.spot.outerConeAngle:Math.PI/4,t.angle=r.spot.outerConeAngle,t.penumbra=1-r.spot.innerConeAngle/r.spot.outerConeAngle,t.target.position.set(0,0,-1),t.add(t.target);break;default:throw new Error('THREE.GLTFLoader: Unexpected light type, "'+r.type+'".')}return t.position.set(0,0,0),t.decay=2,void 0!==r.intensity&&(t.intensity=r.intensity),t.name=r.name||"light_"+e,Promise.resolve(t)},a.prototype.getMaterialType=function(){return c.MeshBasicMaterial},a.prototype.extendParams=function(e,t,r){var n=[];e.color=new c.Color(1,1,1),e.opacity=1;var i=t.pbrMetallicRoughness;if(i){if(Array.isArray(i.baseColorFactor)){var a=i.baseColorFactor;e.color.fromArray(a),e.opacity=a[3]}void 0!==i.baseColorTexture&&n.push(r.assignTexture(e,"map",i.baseColorTexture))}return Promise.all(n)};var o="glTF",s=12,l={JSON:1313821514,BIN:5130562};function u(e){this.name=r.KHR_BINARY_GLTF,this.content=null,this.body=null;var t=new DataView(e,0,s);if(this.header={magic:c.LoaderUtils.decodeText(new Uint8Array(e.slice(0,4))),version:t.getUint32(4,!0),length:t.getUint32(8,!0)},this.header.magic!==o)throw new Error("THREE.GLTFLoader: Unsupported glTF-Binary header.");if(this.header.version<2)throw new Error("THREE.GLTFLoader: Legacy binary file detected.");for(var n=new DataView(e,s),i=0;i<n.byteLength;){var a=n.getUint32(i,!0);i+=4;var u=n.getUint32(i,!0);if(i+=4,u===l.JSON){var h=new Uint8Array(e,s+i,a);this.content=c.LoaderUtils.decodeText(h)}else if(u===l.BIN){var d=s+i;this.body=e.slice(d,d+a)}i+=a}if(null===this.content)throw new Error("THREE.GLTFLoader: JSON content not found.")}function h(e,t){if(!t)throw new Error("THREE.GLTFLoader: No DRACOLoader instance provided.");this.name=r.KHR_DRACO_MESH_COMPRESSION,this.json=e,this.dracoLoader=t,this.dracoLoader.preload()}function d(){this.name=r.KHR_TEXTURE_TRANSFORM}function p(){return{name:r.KHR_MATERIALS_PBR_SPECULAR_GLOSSINESS,specularGlossinessParams:["color","map","lightMap","lightMapIntensity","aoMap","aoMapIntensity","emissive","emissiveIntensity","emissiveMap","bumpMap","bumpScale","normalMap","displacementMap","displacementScale","displacementBias","specularMap","specular","glossinessMap","glossiness","alphaMap","envMap","envMapIntensity","refractionRatio"],getMaterialType:function(){return c.ShaderMaterial},extendParams:function(e,t,r){var n=t.extensions[this.name],i=c.ShaderLib.standard,a=c.UniformsUtils.clone(i.uniforms),o=["#ifdef USE_SPECULARMAP","\tuniform sampler2D specularMap;","#endif"].join("\n"),s=["#ifdef USE_GLOSSINESSMAP","\tuniform sampler2D glossinessMap;","#endif"].join("\n"),l=["vec3 specularFactor = specular;","#ifdef USE_SPECULARMAP","\tvec4 texelSpecular = texture2D( specularMap, vUv );","\ttexelSpecular = sRGBToLinear( texelSpecular );","\t// reads channel RGB, compatible with a glTF Specular-Glossiness (RGBA) texture","\tspecularFactor *= texelSpecular.rgb;","#endif"].join("\n"),u=["float glossinessFactor = glossiness;","#ifdef USE_GLOSSINESSMAP","\tvec4 texelGlossiness = texture2D( glossinessMap, vUv );","\t// reads channel A, compatible with a glTF Specular-Glossiness (RGBA) texture","\tglossinessFactor *= texelGlossiness.a;","#endif"].join("\n"),h=["PhysicalMaterial material;","material.diffuseColor = diffuseColor.rgb;","material.specularRoughness = clamp( 1.0 - glossinessFactor, 0.04, 1.0 );","material.specularColor = specularFactor.rgb;"].join("\n"),d=i.fragmentShader.replace("uniform float roughness;","uniform vec3 specular;").replace("uniform float metalness;","uniform float glossiness;").replace("#include <roughnessmap_pars_fragment>",o).replace("#include <metalnessmap_pars_fragment>",s).replace("#include <roughnessmap_fragment>",l).replace("#include <metalnessmap_fragment>",u).replace("#include <lights_physical_fragment>",h);delete a.roughness,delete a.metalness,delete a.roughnessMap,delete a.metalnessMap,a.specular={value:(new c.Color).setHex(1118481)},a.glossiness={value:.5},a.specularMap={value:null},a.glossinessMap={value:null},e.vertexShader=i.vertexShader,e.fragmentShader=d,e.uniforms=a,e.defines={STANDARD:""},e.color=new c.Color(1,1,1),e.opacity=1;var p=[];if(Array.isArray(n.diffuseFactor)){var f=n.diffuseFactor;e.color.fromArray(f),e.opacity=f[3]}if(void 0!==n.diffuseTexture&&p.push(r.assignTexture(e,"map",n.diffuseTexture)),e.emissive=new c.Color(0,0,0),e.glossiness=void 0!==n.glossinessFactor?n.glossinessFactor:1,e.specular=new c.Color(1,1,1),Array.isArray(n.specularFactor)&&e.specular.fromArray(n.specularFactor),void 0!==n.specularGlossinessTexture){var m=n.specularGlossinessTexture;p.push(r.assignTexture(e,"glossinessMap",m)),p.push(r.assignTexture(e,"specularMap",m))}return Promise.all(p)},createMaterial:function(e){var t=new c.ShaderMaterial({defines:e.defines,vertexShader:e.vertexShader,fragmentShader:e.fragmentShader,uniforms:e.uniforms,fog:!0,lights:!0,opacity:e.opacity,transparent:e.transparent});return t.isGLTFSpecularGlossinessMaterial=!0,t.color=e.color,t.map=void 0===e.map?null:e.map,t.lightMap=null,t.lightMapIntensity=1,t.aoMap=void 0===e.aoMap?null:e.aoMap,t.aoMapIntensity=1,t.emissive=e.emissive,t.emissiveIntensity=1,t.emissiveMap=void 0===e.emissiveMap?null:e.emissiveMap,t.bumpMap=void 0===e.bumpMap?null:e.bumpMap,t.bumpScale=1,t.normalMap=void 0===e.normalMap?null:e.normalMap,e.normalScale&&(t.normalScale=e.normalScale),t.displacementMap=null,t.displacementScale=1,t.displacementBias=0,t.specularMap=void 0===e.specularMap?null:e.specularMap,t.specular=e.specular,t.glossinessMap=void 0===e.glossinessMap?null:e.glossinessMap,t.glossiness=e.glossiness,t.alphaMap=null,t.envMap=void 0===e.envMap?null:e.envMap,t.envMapIntensity=1,t.refractionRatio=.98,t.extensions.derivatives=!0,t},cloneMaterial:function(e){var t=e.clone();t.isGLTFSpecularGlossinessMaterial=!0;for(var r=this.specularGlossinessParams,n=0,i=r.length;n<i;n++){var a=e[r[n]];t[r[n]]=a&&a.isColor?a.clone():a}return t},refreshUniforms:function(e,t,r,n,i){if(!0===i.isGLTFSpecularGlossinessMaterial){var a,o=i.uniforms,s=i.defines;o.opacity.value=i.opacity,o.diffuse.value.copy(i.color),o.emissive.value.copy(i.emissive).multiplyScalar(i.emissiveIntensity),o.map.value=i.map,o.specularMap.value=i.specularMap,o.alphaMap.value=i.alphaMap,o.lightMap.value=i.lightMap,o.lightMapIntensity.value=i.lightMapIntensity,o.aoMap.value=i.aoMap,o.aoMapIntensity.value=i.aoMapIntensity,i.map?a=i.map:i.specularMap?a=i.specularMap:i.displacementMap?a=i.displacementMap:i.normalMap?a=i.normalMap:i.bumpMap?a=i.bumpMap:i.glossinessMap?a=i.glossinessMap:i.alphaMap?a=i.alphaMap:i.emissiveMap&&(a=i.emissiveMap),void 0!==a&&(a.isWebGLRenderTarget&&(a=a.texture),!0===a.matrixAutoUpdate&&a.updateMatrix(),o.uvTransform.value.copy(a.matrix)),i.envMap&&(o.envMap.value=i.envMap,o.envMapIntensity.value=i.envMapIntensity,o.flipEnvMap.value=i.envMap.isCubeTexture?-1:1,o.reflectivity.value=i.reflectivity,o.refractionRatio.value=i.refractionRatio,o.maxMipLevel.value=e.properties.get(i.envMap).__maxMipLevel),o.specular.value.copy(i.specular),o.glossiness.value=i.glossiness,o.glossinessMap.value=i.glossinessMap,o.emissiveMap.value=i.emissiveMap,o.bumpMap.value=i.bumpMap,o.normalMap.value=i.normalMap,o.displacementMap.value=i.displacementMap,o.displacementScale.value=i.displacementScale,o.displacementBias.value=i.displacementBias,null!==o.glossinessMap.value&&void 0===s.USE_GLOSSINESSMAP&&(s.USE_GLOSSINESSMAP="",s.USE_ROUGHNESSMAP=""),null===o.glossinessMap.value&&void 0!==s.USE_GLOSSINESSMAP&&(delete s.USE_GLOSSINESSMAP,delete s.USE_ROUGHNESSMAP)}}}}function f(){this.name=r.KHR_MESH_QUANTIZATION}function m(e,t,r,n){c.Interpolant.call(this,e,t,r,n)}h.prototype.decodePrimitive=function(e,t){var r=this.json,n=this.dracoLoader,i=e.extensions[this.name].bufferView,a=e.extensions[this.name].attributes,o={},s={},l={};for(var c in a){var u=T[c]||c.toLowerCase();o[u]=a[c]}for(c in e.attributes){u=T[c]||c.toLowerCase();if(void 0!==a[c]){var h=r.accessors[e.attributes[c]],d=_[h.componentType];l[u]=d,s[u]=!0===h.normalized}}return t.getDependency("bufferView",i).then((function(e){return new Promise((function(t){n.decodeDracoFile(e,(function(e){for(var r in e.attributes){var n=e.attributes[r],i=s[r];void 0!==i&&(n.normalized=i)}t(e)}),o,l)}))}))},d.prototype.extendTexture=function(e,t){return e=e.clone(),void 0!==t.offset&&e.offset.fromArray(t.offset),void 0!==t.rotation&&(e.rotation=t.rotation),void 0!==t.scale&&e.repeat.fromArray(t.scale),void 0!==t.texCoord&&console.warn('THREE.GLTFLoader: Custom UV sets in "'+this.name+'" extension not yet supported.'),e.needsUpdate=!0,e},m.prototype=Object.create(c.Interpolant.prototype),m.prototype.constructor=m,m.prototype.copySampleValue_=function(e){for(var t=this.resultBuffer,r=this.sampleValues,n=this.valueSize,i=e*n*3+n,a=0;a!==n;a++)t[a]=r[i+a];return t},m.prototype.beforeStart_=m.prototype.copySampleValue_,m.prototype.afterEnd_=m.prototype.copySampleValue_,m.prototype.interpolate_=function(e,t,r,n){for(var i=this.resultBuffer,a=this.sampleValues,o=this.valueSize,s=2*o,l=3*o,c=n-t,u=(r-t)/c,h=u*u,d=h*u,p=e*l,f=p-l,m=-2*d+3*h,v=d-h,g=1-m,y=v-h+u,x=0;x!==o;x++){var b=a[f+x+o],A=a[f+x+s]*c,w=a[p+x+o],_=a[p+x]*c;i[x]=g*b+y*A+m*w+v*_}return i};var v=0,g=1,y=2,x=3,b=4,A=5,w=6,_={5120:Int8Array,5121:Uint8Array,5122:Int16Array,5123:Uint16Array,5125:Uint32Array,5126:Float32Array},M={9728:c.NearestFilter,9729:c.LinearFilter,9984:c.NearestMipmapNearestFilter,9985:c.LinearMipmapNearestFilter,9986:c.NearestMipmapLinearFilter,9987:c.LinearMipmapLinearFilter},S={33071:c.ClampToEdgeWrapping,33648:c.MirroredRepeatWrapping,10497:c.RepeatWrapping},E={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16},T={POSITION:"position",NORMAL:"normal",TANGENT:"tangent",TEXCOORD_0:"uv",TEXCOORD_1:"uv2",COLOR_0:"color",WEIGHTS_0:"skinWeight",JOINTS_0:"skinIndex"},R={scale:"scale",translation:"position",rotation:"quaternion",weights:"morphTargetInfluences"},L={CUBICSPLINE:void 0,LINEAR:c.InterpolateLinear,STEP:c.InterpolateDiscrete},C="OPAQUE",P="MASK",D="BLEND",I={"image/png":c.RGBAFormat,"image/jpeg":c.RGBFormat};function O(e,t){return"string"!=typeof e||""===e?"":(/^https?:\/\//i.test(t)&&/^\//.test(e)&&(t=t.replace(/(^https?:\/\/[^\/]+).*/i,"$1")),/^(https?:)?\/\//i.test(e)?e:/^data:.*,.*$/i.test(e)?e:/^blob:.*$/i.test(e)?e:t+e)}function B(e,t,r){for(var n in r.extensions)void 0===e[n]&&(t.userData.gltfExtensions=t.userData.gltfExtensions||{},t.userData.gltfExtensions[n]=r.extensions[n])}function F(e,t){void 0!==t.extras&&("object"==typeof t.extras?Object.assign(e.userData,t.extras):console.warn("THREE.GLTFLoader: Ignoring primitive type .extras, "+t.extras))}function U(e,t){if(e.updateMorphTargets(),void 0!==t.weights)for(var r=0,n=t.weights.length;r<n;r++)e.morphTargetInfluences[r]=t.weights[r];if(t.extras&&Array.isArray(t.extras.targetNames)){var i=t.extras.targetNames;if(e.morphTargetInfluences.length===i.length){e.morphTargetDictionary={};for(r=0,n=i.length;r<n;r++)e.morphTargetDictionary[i[r]]=r}else console.warn("THREE.GLTFLoader: Invalid extras.targetNames length. Ignoring names.")}}function N(e){for(var t="",r=Object.keys(e).sort(),n=0,i=r.length;n<i;n++)t+=r[n]+":"+e[r[n]]+";";return t}function G(e,r,n){this.json=e||{},this.extensions=r||{},this.options=n||{},this.cache=new t,this.primitiveCache={},this.textureLoader=new c.TextureLoader(this.options.manager),this.textureLoader.setCrossOrigin(this.options.crossOrigin),this.fileLoader=new c.FileLoader(this.options.manager),this.fileLoader.setResponseType("arraybuffer"),"use-credentials"===this.options.crossOrigin&&this.fileLoader.setWithCredentials(!0)}function z(e,t,r){var n=t.attributes,i=[];function a(t,n){return r.getDependency("accessor",t).then((function(t){e.setAttribute(n,t)}))}for(var o in n){var s=T[o]||o.toLowerCase();s in e.attributes||i.push(a(n[o],s))}if(void 0!==t.indices&&!e.index){var l=r.getDependency("accessor",t.indices).then((function(t){e.setIndex(t)}));i.push(l)}return F(e,t),function(e,t,r){var n=t.attributes,i=new c.Box3;if(void 0!==n.POSITION){var a=(p=r.json.accessors[n.POSITION]).min,o=p.max;if(void 0!==a&&void 0!==o){i.set(new c.Vector3(a[0],a[1],a[2]),new c.Vector3(o[0],o[1],o[2]));var s=t.targets;if(void 0!==s)for(var l=new c.Vector3,u=0,h=s.length;u<h;u++){var d=s[u];if(void 0!==d.POSITION){var p;a=(p=r.json.accessors[d.POSITION]).min,o=p.max;void 0!==a&&void 0!==o?(l.setX(Math.max(Math.abs(a[0]),Math.abs(o[0]))),l.setY(Math.max(Math.abs(a[1]),Math.abs(o[1]))),l.setZ(Math.max(Math.abs(a[2]),Math.abs(o[2]))),i.expandByVector(l)):console.warn("THREE.GLTFLoader: Missing min/max properties for accessor POSITION.")}}e.boundingBox=i;var f=new c.Sphere;i.getCenter(f.center),f.radius=i.min.distanceTo(i.max)/2,e.boundingSphere=f}else console.warn("THREE.GLTFLoader: Missing min/max properties for accessor POSITION.")}}(e,t,r),Promise.all(i).then((function(){return void 0!==t.targets?function(e,t,r){for(var n=!1,i=!1,a=0,o=t.length;a<o;a++){if(void 0!==(c=t[a]).POSITION&&(n=!0),void 0!==c.NORMAL&&(i=!0),n&&i)break}if(!n&&!i)return Promise.resolve(e);var s=[],l=[];for(a=0,o=t.length;a<o;a++){var c=t[a];if(n){var u=void 0!==c.POSITION?r.getDependency("accessor",c.POSITION):e.attributes.position;s.push(u)}if(i){u=void 0!==c.NORMAL?r.getDependency("accessor",c.NORMAL):e.attributes.normal;l.push(u)}}return Promise.all([Promise.all(s),Promise.all(l)]).then((function(t){var r=t[0],a=t[1];return n&&(e.morphAttributes.position=r),i&&(e.morphAttributes.normal=a),e.morphTargetsRelative=!0,e}))}(e,t.targets,r):e}))}function k(e,t){var r=e.getIndex();if(null===r){var n=[],i=e.getAttribute("position");if(void 0===i)return console.error("THREE.GLTFLoader.toTrianglesDrawMode(): Undefined position attribute. Processing not possible."),e;for(var a=0;a<i.count;a++)n.push(a);e.setIndex(n),r=e.getIndex()}var o=r.count-2,s=[];if(t===c.TriangleFanDrawMode)for(a=1;a<=o;a++)s.push(r.getX(0)),s.push(r.getX(a)),s.push(r.getX(a+1));else for(a=0;a<o;a++)a%2==0?(s.push(r.getX(a)),s.push(r.getX(a+1)),s.push(r.getX(a+2))):(s.push(r.getX(a+2)),s.push(r.getX(a+1)),s.push(r.getX(a)));s.length/3!==o&&console.error("THREE.GLTFLoader.toTrianglesDrawMode(): Unable to generate correct amount of triangles.");var l=e.clone();return l.setIndex(s),l}return G.prototype.parse=function(e,t){var r=this,n=this.json,i=this.extensions;this.cache.removeAll(),this.markDefs(),Promise.all([this.getDependencies("scene"),this.getDependencies("animation"),this.getDependencies("camera")]).then((function(t){var a={scene:t[0][n.scene||0],scenes:t[0],animations:t[1],cameras:t[2],asset:n.asset,parser:r,userData:{}};B(i,a,n),F(a,n),e(a)})).catch(t)},G.prototype.markDefs=function(){for(var e=this.json.nodes||[],t=this.json.skins||[],r=this.json.meshes||[],n={},i={},a=0,o=t.length;a<o;a++)for(var s=t[a].joints,l=0,c=s.length;l<c;l++)e[s[l]].isBone=!0;for(var u=0,h=e.length;u<h;u++){var d=e[u];void 0!==d.mesh&&(void 0===n[d.mesh]&&(n[d.mesh]=i[d.mesh]=0),n[d.mesh]++,void 0!==d.skin&&(r[d.mesh].isSkinnedMesh=!0))}this.json.meshReferences=n,this.json.meshUses=i},G.prototype.getDependency=function(e,t){var n=e+":"+t,i=this.cache.get(n);if(!i){switch(e){case"scene":i=this.loadScene(t);break;case"node":i=this.loadNode(t);break;case"mesh":i=this.loadMesh(t);break;case"accessor":i=this.loadAccessor(t);break;case"bufferView":i=this.loadBufferView(t);break;case"buffer":i=this.loadBuffer(t);break;case"material":i=this.loadMaterial(t);break;case"texture":i=this.loadTexture(t);break;case"skin":i=this.loadSkin(t);break;case"animation":i=this.loadAnimation(t);break;case"camera":i=this.loadCamera(t);break;case"light":i=this.extensions[r.KHR_LIGHTS_PUNCTUAL].loadLight(t);break;default:throw new Error("Unknown type: "+e)}this.cache.add(n,i)}return i},G.prototype.getDependencies=function(e){var t=this.cache.get(e);if(!t){var r=this,n=this.json[e+("mesh"===e?"es":"s")]||[];t=Promise.all(n.map((function(t,n){return r.getDependency(e,n)}))),this.cache.add(e,t)}return t},G.prototype.loadBuffer=function(e){var t=this.json.buffers[e],n=this.fileLoader;if(t.type&&"arraybuffer"!==t.type)throw new Error("THREE.GLTFLoader: "+t.type+" buffer type is not supported.");if(void 0===t.uri&&0===e)return Promise.resolve(this.extensions[r.KHR_BINARY_GLTF].body);var i=this.options;return new Promise((function(e,r){n.load(O(t.uri,i.path),e,void 0,(function(){r(new Error('THREE.GLTFLoader: Failed to load buffer "'+t.uri+'".'))}))}))},G.prototype.loadBufferView=function(e){var t=this.json.bufferViews[e];return this.getDependency("buffer",t.buffer).then((function(e){var r=t.byteLength||0,n=t.byteOffset||0;return e.slice(n,n+r)}))},G.prototype.loadAccessor=function(e){var t=this,r=this.json,n=this.json.accessors[e];if(void 0===n.bufferView&&void 0===n.sparse)return Promise.resolve(null);var i=[];return void 0!==n.bufferView?i.push(this.getDependency("bufferView",n.bufferView)):i.push(null),void 0!==n.sparse&&(i.push(this.getDependency("bufferView",n.sparse.indices.bufferView)),i.push(this.getDependency("bufferView",n.sparse.values.bufferView))),Promise.all(i).then((function(e){var i,a,o=e[0],s=E[n.type],l=_[n.componentType],u=l.BYTES_PER_ELEMENT,h=u*s,d=n.byteOffset||0,p=void 0!==n.bufferView?r.bufferViews[n.bufferView].byteStride:void 0,f=!0===n.normalized;if(p&&p!==h){var m=Math.floor(d/p),v="InterleavedBuffer:"+n.bufferView+":"+n.componentType+":"+m+":"+n.count,g=t.cache.get(v);g||(i=new l(o,m*p,n.count*p/u),g=new c.InterleavedBuffer(i,p/u),t.cache.add(v,g)),a=new c.InterleavedBufferAttribute(g,s,d%p/u,f)}else i=null===o?new l(n.count*s):new l(o,d,n.count*s),a=new c.BufferAttribute(i,s,f);if(void 0!==n.sparse){var y=E.SCALAR,x=_[n.sparse.indices.componentType],b=n.sparse.indices.byteOffset||0,A=n.sparse.values.byteOffset||0,w=new x(e[1],b,n.sparse.count*y),M=new l(e[2],A,n.sparse.count*s);null!==o&&(a=new c.BufferAttribute(a.array.slice(),a.itemSize,a.normalized));for(var S=0,T=w.length;S<T;S++){var R=w[S];if(a.setX(R,M[S*s]),s>=2&&a.setY(R,M[S*s+1]),s>=3&&a.setZ(R,M[S*s+2]),s>=4&&a.setW(R,M[S*s+3]),s>=5)throw new Error("THREE.GLTFLoader: Unsupported itemSize in sparse BufferAttribute.")}}return a}))},G.prototype.loadTexture=function(e){var t,n=this,i=this.json,a=this.options,o=this.textureLoader,s=window.URL||window.webkitURL,l=i.textures[e],u=l.extensions||{},h=(t=u[r.MSFT_TEXTURE_DDS]?i.images[u[r.MSFT_TEXTURE_DDS].source]:i.images[l.source]).uri,d=!1;return void 0!==t.bufferView&&(h=n.getDependency("bufferView",t.bufferView).then((function(e){d=!0;var r=new Blob([e],{type:t.mimeType});return h=s.createObjectURL(r)}))),Promise.resolve(h).then((function(e){var t=a.manager.getHandler(e);return t||(t=u[r.MSFT_TEXTURE_DDS]?n.extensions[r.MSFT_TEXTURE_DDS].ddsLoader:o),new Promise((function(r,n){t.load(O(e,a.path),r,void 0,n)}))})).then((function(e){!0===d&&s.revokeObjectURL(h),e.flipY=!1,void 0!==l.name&&(e.name=l.name),t.mimeType in I&&(e.format=I[t.mimeType]);var r=(i.samplers||{})[l.sampler]||{};return e.magFilter=M[r.magFilter]||c.LinearFilter,e.minFilter=M[r.minFilter]||c.LinearMipmapLinearFilter,e.wrapS=S[r.wrapS]||c.RepeatWrapping,e.wrapT=S[r.wrapT]||c.RepeatWrapping,e}))},G.prototype.assignTexture=function(e,t,n){var i=this;return this.getDependency("texture",n.index).then((function(a){if(!a.isCompressedTexture)switch(t){case"aoMap":case"emissiveMap":case"metalnessMap":case"normalMap":case"roughnessMap":a.format=c.RGBFormat}if(void 0===n.texCoord||0==n.texCoord||"aoMap"===t&&1==n.texCoord||console.warn("THREE.GLTFLoader: Custom UV set "+n.texCoord+" for texture "+t+" not yet supported."),i.extensions[r.KHR_TEXTURE_TRANSFORM]){var o=void 0!==n.extensions?n.extensions[r.KHR_TEXTURE_TRANSFORM]:void 0;o&&(a=i.extensions[r.KHR_TEXTURE_TRANSFORM].extendTexture(a,o))}e[t]=a}))},G.prototype.assignFinalMaterial=function(e){var t=e.geometry,n=e.material,i=this.extensions,a=void 0!==t.attributes.tangent,o=void 0!==t.attributes.color,s=void 0===t.attributes.normal,l=!0===e.isSkinnedMesh,u=Object.keys(t.morphAttributes).length>0,h=u&&void 0!==t.morphAttributes.normal;if(e.isPoints){var d="PointsMaterial:"+n.uuid,p=this.cache.get(d);p||(p=new c.PointsMaterial,c.Material.prototype.copy.call(p,n),p.color.copy(n.color),p.map=n.map,p.sizeAttenuation=!1,this.cache.add(d,p)),n=p}else if(e.isLine){d="LineBasicMaterial:"+n.uuid;var f=this.cache.get(d);f||(f=new c.LineBasicMaterial,c.Material.prototype.copy.call(f,n),f.color.copy(n.color),this.cache.add(d,f)),n=f}if(a||o||s||l||u){d="ClonedMaterial:"+n.uuid+":";n.isGLTFSpecularGlossinessMaterial&&(d+="specular-glossiness:"),l&&(d+="skinning:"),a&&(d+="vertex-tangents:"),o&&(d+="vertex-colors:"),s&&(d+="flat-shading:"),u&&(d+="morph-targets:"),h&&(d+="morph-normals:");var m=this.cache.get(d);m||(m=n.isGLTFSpecularGlossinessMaterial?i[r.KHR_MATERIALS_PBR_SPECULAR_GLOSSINESS].cloneMaterial(n):n.clone(),l&&(m.skinning=!0),a&&(m.vertexTangents=!0),o&&(m.vertexColors=c.VertexColors),s&&(m.flatShading=!0),u&&(m.morphTargets=!0),h&&(m.morphNormals=!0),this.cache.add(d,m)),n=m}n.aoMap&&void 0===t.attributes.uv2&&void 0!==t.attributes.uv&&t.setAttribute("uv2",new c.BufferAttribute(t.attributes.uv.array,2)),n.isGLTFSpecularGlossinessMaterial&&(e.onBeforeRender=i[r.KHR_MATERIALS_PBR_SPECULAR_GLOSSINESS].refreshUniforms),n.normalScale&&!a&&(n.normalScale.y=-n.normalScale.y),e.material=n},G.prototype.loadMaterial=function(e){var t,n=this.json,i=this.extensions,a=n.materials[e],o={},s=a.extensions||{},l=[];if(s[r.KHR_MATERIALS_PBR_SPECULAR_GLOSSINESS]){var u=i[r.KHR_MATERIALS_PBR_SPECULAR_GLOSSINESS];t=u.getMaterialType(),l.push(u.extendParams(o,a,this))}else if(s[r.KHR_MATERIALS_UNLIT]){var h=i[r.KHR_MATERIALS_UNLIT];t=h.getMaterialType(),l.push(h.extendParams(o,a,this))}else{t=c.MeshStandardMaterial;var d=a.pbrMetallicRoughness||{};if(o.color=new c.Color(1,1,1),o.opacity=1,Array.isArray(d.baseColorFactor)){var p=d.baseColorFactor;o.color.fromArray(p),o.opacity=p[3]}void 0!==d.baseColorTexture&&l.push(this.assignTexture(o,"map",d.baseColorTexture)),o.metalness=void 0!==d.metallicFactor?d.metallicFactor:1,o.roughness=void 0!==d.roughnessFactor?d.roughnessFactor:1,void 0!==d.metallicRoughnessTexture&&(l.push(this.assignTexture(o,"metalnessMap",d.metallicRoughnessTexture)),l.push(this.assignTexture(o,"roughnessMap",d.metallicRoughnessTexture)))}!0===a.doubleSided&&(o.side=c.DoubleSide);var f=a.alphaMode||C;return f===D?o.transparent=!0:(o.transparent=!1,f===P&&(o.alphaTest=void 0!==a.alphaCutoff?a.alphaCutoff:.5)),void 0!==a.normalTexture&&t!==c.MeshBasicMaterial&&(l.push(this.assignTexture(o,"normalMap",a.normalTexture)),o.normalScale=new c.Vector2(1,1),void 0!==a.normalTexture.scale&&o.normalScale.set(a.normalTexture.scale,a.normalTexture.scale)),void 0!==a.occlusionTexture&&t!==c.MeshBasicMaterial&&(l.push(this.assignTexture(o,"aoMap",a.occlusionTexture)),void 0!==a.occlusionTexture.strength&&(o.aoMapIntensity=a.occlusionTexture.strength)),void 0!==a.emissiveFactor&&t!==c.MeshBasicMaterial&&(o.emissive=(new c.Color).fromArray(a.emissiveFactor)),void 0!==a.emissiveTexture&&t!==c.MeshBasicMaterial&&l.push(this.assignTexture(o,"emissiveMap",a.emissiveTexture)),Promise.all(l).then((function(){var e;return e=t===c.ShaderMaterial?i[r.KHR_MATERIALS_PBR_SPECULAR_GLOSSINESS].createMaterial(o):new t(o),void 0!==a.name&&(e.name=a.name),e.map&&(e.map.encoding=c.sRGBEncoding),e.emissiveMap&&(e.emissiveMap.encoding=c.sRGBEncoding),e.specularMap&&(e.specularMap.encoding=c.sRGBEncoding),F(e,a),a.extensions&&B(i,e,a),e}))},G.prototype.loadGeometries=function(e){var t=this,n=this.extensions,i=this.primitiveCache;function a(e){return n[r.KHR_DRACO_MESH_COMPRESSION].decodePrimitive(e,t).then((function(r){return z(r,e,t)}))}for(var o,s,l=[],u=0,h=e.length;u<h;u++){var d,p=e[u],f=(s=void 0,(s=(o=p).extensions&&o.extensions[r.KHR_DRACO_MESH_COMPRESSION])?"draco:"+s.bufferView+":"+s.indices+":"+N(s.attributes):o.indices+":"+N(o.attributes)+":"+o.mode),m=i[f];if(m)l.push(m.promise);else d=p.extensions&&p.extensions[r.KHR_DRACO_MESH_COMPRESSION]?a(p):z(new c.BufferGeometry,p,t),i[f]={primitive:p,promise:d},l.push(d)}return Promise.all(l)},G.prototype.loadMesh=function(e){for(var t,r=this,n=this.json.meshes[e],i=n.primitives,a=[],o=0,s=i.length;o<s;o++){var l=void 0===i[o].material?(void 0===(t=this.cache).DefaultMaterial&&(t.DefaultMaterial=new c.MeshStandardMaterial({color:16777215,emissive:0,metalness:1,roughness:1,transparent:!1,depthTest:!0,side:c.FrontSide})),t.DefaultMaterial):this.getDependency("material",i[o].material);a.push(l)}return a.push(r.loadGeometries(i)),Promise.all(a).then((function(t){for(var a=t.slice(0,t.length-1),o=t[t.length-1],s=[],l=0,u=o.length;l<u;l++){var h,d=o[l],p=i[l],f=a[l];if(p.mode===b||p.mode===A||p.mode===w||void 0===p.mode)!0!==(h=!0===n.isSkinnedMesh?new c.SkinnedMesh(d,f):new c.Mesh(d,f)).isSkinnedMesh||h.geometry.attributes.skinWeight.normalized||h.normalizeSkinWeights(),p.mode===A?h.geometry=k(h.geometry,c.TriangleStripDrawMode):p.mode===w&&(h.geometry=k(h.geometry,c.TriangleFanDrawMode));else if(p.mode===g)h=new c.LineSegments(d,f);else if(p.mode===x)h=new c.Line(d,f);else if(p.mode===y)h=new c.LineLoop(d,f);else{if(p.mode!==v)throw new Error("THREE.GLTFLoader: Primitive mode unsupported: "+p.mode);h=new c.Points(d,f)}Object.keys(h.geometry.morphAttributes).length>0&&U(h,n),h.name=n.name||"mesh_"+e,o.length>1&&(h.name+="_"+l),F(h,n),r.assignFinalMaterial(h),s.push(h)}if(1===s.length)return s[0];var m=new c.Group;for(l=0,u=s.length;l<u;l++)m.add(s[l]);return m}))},G.prototype.loadCamera=function(e){var t,r=this.json.cameras[e],n=r[r.type];if(n)return"perspective"===r.type?t=new c.PerspectiveCamera(c.Math.radToDeg(n.yfov),n.aspectRatio||1,n.znear||1,n.zfar||2e6):"orthographic"===r.type&&(t=new c.OrthographicCamera(n.xmag/-2,n.xmag/2,n.ymag/2,n.ymag/-2,n.znear,n.zfar)),void 0!==r.name&&(t.name=r.name),F(t,r),Promise.resolve(t);console.warn("THREE.GLTFLoader: Missing camera parameters.")},G.prototype.loadSkin=function(e){var t=this.json.skins[e],r={joints:t.joints};return void 0===t.inverseBindMatrices?Promise.resolve(r):this.getDependency("accessor",t.inverseBindMatrices).then((function(e){return r.inverseBindMatrices=e,r}))},G.prototype.loadAnimation=function(e){for(var t=this.json.animations[e],r=[],n=[],i=[],a=[],o=[],s=0,l=t.channels.length;s<l;s++){var u=t.channels[s],h=t.samplers[u.sampler],d=u.target,p=void 0!==d.node?d.node:d.id,f=void 0!==t.parameters?t.parameters[h.input]:h.input,v=void 0!==t.parameters?t.parameters[h.output]:h.output;r.push(this.getDependency("node",p)),n.push(this.getDependency("accessor",f)),i.push(this.getDependency("accessor",v)),a.push(h),o.push(d)}return Promise.all([Promise.all(r),Promise.all(n),Promise.all(i),Promise.all(a),Promise.all(o)]).then((function(r){for(var n=r[0],i=r[1],a=r[2],o=r[3],s=r[4],l=[],u=0,h=n.length;u<h;u++){var d=n[u],p=i[u],f=a[u],v=o[u],g=s[u];if(void 0!==d){var y;switch(d.updateMatrix(),d.matrixAutoUpdate=!0,R[g.path]){case R.weights:y=c.NumberKeyframeTrack;break;case R.rotation:y=c.QuaternionKeyframeTrack;break;case R.position:case R.scale:default:y=c.VectorKeyframeTrack}var x=d.name?d.name:d.uuid,b=void 0!==v.interpolation?L[v.interpolation]:c.InterpolateLinear,A=[];R[g.path]===R.weights?d.traverse((function(e){!0===e.isMesh&&e.morphTargetInfluences&&A.push(e.name?e.name:e.uuid)})):A.push(x);var w=f.array;if(f.normalized){var _;if(w.constructor===Int8Array)_=1/127;else if(w.constructor===Uint8Array)_=1/255;else if(w.constructor==Int16Array)_=1/32767;else{if(w.constructor!==Uint16Array)throw new Error("THREE.GLTFLoader: Unsupported output accessor component type.");_=1/65535}for(var M=new Float32Array(w.length),S=0,E=w.length;S<E;S++)M[S]=w[S]*_;w=M}for(S=0,E=A.length;S<E;S++){var T=new y(A[S]+"."+R[g.path],p.array,w,b);"CUBICSPLINE"===v.interpolation&&(T.createInterpolant=function(e){return new m(this.times,this.values,this.getValueSize()/3,e)},T.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline=!0),l.push(T)}}}var C=void 0!==t.name?t.name:"animation_"+e;return new c.AnimationClip(C,void 0,l)}))},G.prototype.loadNode=function(e){var t,n=this.json,i=this.extensions,a=this,o=n.meshReferences,s=n.meshUses,l=n.nodes[e];return(t=[],void 0!==l.mesh&&t.push(a.getDependency("mesh",l.mesh).then((function(e){var t;if(o[l.mesh]>1){var r=s[l.mesh]++;(t=e.clone()).name+="_instance_"+r,t.onBeforeRender=e.onBeforeRender;for(var n=0,i=t.children.length;n<i;n++)t.children[n].name+="_instance_"+r,t.children[n].onBeforeRender=e.children[n].onBeforeRender}else t=e;return void 0!==l.weights&&t.traverse((function(e){if(e.isMesh)for(var t=0,r=l.weights.length;t<r;t++)e.morphTargetInfluences[t]=l.weights[t]})),t}))),void 0!==l.camera&&t.push(a.getDependency("camera",l.camera)),l.extensions&&l.extensions[r.KHR_LIGHTS_PUNCTUAL]&&void 0!==l.extensions[r.KHR_LIGHTS_PUNCTUAL].light&&t.push(a.getDependency("light",l.extensions[r.KHR_LIGHTS_PUNCTUAL].light)),Promise.all(t)).then((function(e){var t;if((t=!0===l.isBone?new c.Bone:e.length>1?new c.Group:1===e.length?e[0]:new c.Object3D)!==e[0])for(var r=0,n=e.length;r<n;r++)t.add(e[r]);if(void 0!==l.name&&(t.userData.name=l.name,t.name=c.PropertyBinding.sanitizeNodeName(l.name)),F(t,l),l.extensions&&B(i,t,l),void 0!==l.matrix){var a=new c.Matrix4;a.fromArray(l.matrix),t.applyMatrix(a)}else void 0!==l.translation&&t.position.fromArray(l.translation),void 0!==l.rotation&&t.quaternion.fromArray(l.rotation),void 0!==l.scale&&t.scale.fromArray(l.scale);return t}))},G.prototype.loadScene=function(){function e(t,r,n,i){var a=n.nodes[t];return i.getDependency("node",t).then((function(e){return void 0===a.skin?e:i.getDependency("skin",a.skin).then((function(e){for(var r=[],n=0,a=(t=e).joints.length;n<a;n++)r.push(i.getDependency("node",t.joints[n]));return Promise.all(r)})).then((function(r){return e.traverse((function(e){if(e.isMesh){for(var n=[],i=[],a=0,o=r.length;a<o;a++){var s=r[a];if(s){n.push(s);var l=new c.Matrix4;void 0!==t.inverseBindMatrices&&l.fromArray(t.inverseBindMatrices.array,16*a),i.push(l)}else console.warn('THREE.GLTFLoader: Joint "%s" could not be found.',t.joints[a])}e.bind(new c.Skeleton(n,i),e.matrixWorld)}})),e}));var t})).then((function(t){r.add(t);var o=[];if(a.children)for(var s=a.children,l=0,c=s.length;l<c;l++){var u=s[l];o.push(e(u,t,n,i))}return Promise.all(o)}))}return function(t){var r=this.json,n=this.extensions,i=this.json.scenes[t],a=new c.Scene;void 0!==i.name&&(a.name=i.name),F(a,i),i.extensions&&B(n,a,i);for(var o=i.nodes||[],s=[],l=0,u=o.length;l<u;l++)s.push(e(o[l],a,r,this));return Promise.all(s).then((function(){return a}))}}(),e}(),f=function(){var e=/^[og]\s*(.+)?/,t=/^mtllib /,r=/^usemtl /,n=/^usemap /;function i(){var e={objects:[],object:{},vertices:[],normals:[],colors:[],uvs:[],materialLibraries:[],startObject:function(e,t){if(this.object&&!1===this.object.fromDeclaration)return this.object.name=e,void(this.object.fromDeclaration=!1!==t);var r=this.object&&"function"==typeof this.object.currentMaterial?this.object.currentMaterial():void 0;if(this.object&&"function"==typeof this.object._finalize&&this.object._finalize(!0),this.object={name:e||"",fromDeclaration:!1!==t,geometry:{vertices:[],normals:[],colors:[],uvs:[]},materials:[],smooth:!0,startMaterial:function(e,t){var r=this._finalize(!1);r&&(r.inherited||r.groupCount<=0)&&this.materials.splice(r.index,1);var n={index:this.materials.length,name:e||"",mtllib:Array.isArray(t)&&t.length>0?t[t.length-1]:"",smooth:void 0!==r?r.smooth:this.smooth,groupStart:void 0!==r?r.groupEnd:0,groupEnd:-1,groupCount:-1,inherited:!1,clone:function(e){var t={index:"number"==typeof e?e:this.index,name:this.name,mtllib:this.mtllib,smooth:this.smooth,groupStart:0,groupEnd:-1,groupCount:-1,inherited:!1};return t.clone=this.clone.bind(t),t}};return this.materials.push(n),n},currentMaterial:function(){if(this.materials.length>0)return this.materials[this.materials.length-1]},_finalize:function(e){var t=this.currentMaterial();if(t&&-1===t.groupEnd&&(t.groupEnd=this.geometry.vertices.length/3,t.groupCount=t.groupEnd-t.groupStart,t.inherited=!1),e&&this.materials.length>1)for(var r=this.materials.length-1;r>=0;r--)this.materials[r].groupCount<=0&&this.materials.splice(r,1);return e&&0===this.materials.length&&this.materials.push({name:"",smooth:this.smooth}),t}},r&&r.name&&"function"==typeof r.clone){var n=r.clone(0);n.inherited=!0,this.object.materials.push(n)}this.objects.push(this.object)},finalize:function(){this.object&&"function"==typeof this.object._finalize&&this.object._finalize(!0)},parseVertexIndex:function(e,t){var r=parseInt(e,10);return 3*(r>=0?r-1:r+t/3)},parseNormalIndex:function(e,t){var r=parseInt(e,10);return 3*(r>=0?r-1:r+t/3)},parseUVIndex:function(e,t){var r=parseInt(e,10);return 2*(r>=0?r-1:r+t/2)},addVertex:function(e,t,r){var n=this.vertices,i=this.object.geometry.vertices;i.push(n[e+0],n[e+1],n[e+2]),i.push(n[t+0],n[t+1],n[t+2]),i.push(n[r+0],n[r+1],n[r+2])},addVertexPoint:function(e){var t=this.vertices;this.object.geometry.vertices.push(t[e+0],t[e+1],t[e+2])},addVertexLine:function(e){var t=this.vertices;this.object.geometry.vertices.push(t[e+0],t[e+1],t[e+2])},addNormal:function(e,t,r){var n=this.normals,i=this.object.geometry.normals;i.push(n[e+0],n[e+1],n[e+2]),i.push(n[t+0],n[t+1],n[t+2]),i.push(n[r+0],n[r+1],n[r+2])},addColor:function(e,t,r){var n=this.colors,i=this.object.geometry.colors;i.push(n[e+0],n[e+1],n[e+2]),i.push(n[t+0],n[t+1],n[t+2]),i.push(n[r+0],n[r+1],n[r+2])},addUV:function(e,t,r){var n=this.uvs,i=this.object.geometry.uvs;i.push(n[e+0],n[e+1]),i.push(n[t+0],n[t+1]),i.push(n[r+0],n[r+1])},addUVLine:function(e){var t=this.uvs;this.object.geometry.uvs.push(t[e+0],t[e+1])},addFace:function(e,t,r,n,i,a,o,s,l){var c=this.vertices.length,u=this.parseVertexIndex(e,c),h=this.parseVertexIndex(t,c),d=this.parseVertexIndex(r,c);if(this.addVertex(u,h,d),this.colors.length>0&&this.addColor(u,h,d),void 0!==n&&""!==n){var p=this.uvs.length;u=this.parseUVIndex(n,p),h=this.parseUVIndex(i,p),d=this.parseUVIndex(a,p),this.addUV(u,h,d)}if(void 0!==o&&""!==o){var f=this.normals.length;u=this.parseNormalIndex(o,f),h=o===s?u:this.parseNormalIndex(s,f),d=o===l?u:this.parseNormalIndex(l,f),this.addNormal(u,h,d)}},addPointGeometry:function(e){this.object.geometry.type="Points";for(var t=this.vertices.length,r=0,n=e.length;r<n;r++)this.addVertexPoint(this.parseVertexIndex(e[r],t))},addLineGeometry:function(e,t){this.object.geometry.type="Line";for(var r=this.vertices.length,n=this.uvs.length,i=0,a=e.length;i<a;i++)this.addVertexLine(this.parseVertexIndex(e[i],r));var o=0;for(a=t.length;o<a;o++)this.addUVLine(this.parseUVIndex(t[o],n))}};return e.startObject("",!1),e}function a(e){c.Loader.call(this,e),this.materials=null}return a.prototype=Object.assign(Object.create(c.Loader.prototype),{constructor:a,load:function(e,t,r,n){var i=this,a=new c.FileLoader(i.manager);a.setPath(this.path),a.load(e,(function(e){t(i.parse(e))}),r,n)},setMaterials:function(e){return this.materials=e,this},parse:function(a){console.time("OBJLoader");var o=new i;-1!==a.indexOf("\r\n")&&(a=a.replace(/\r\n/g,"\n")),-1!==a.indexOf("\\\n")&&(a=a.replace(/\\\n/g,""));for(var s=a.split("\n"),l="",u="",h=[],d="function"==typeof"".trimLeft,p=0,f=s.length;p<f;p++)if(l=s[p],0!==(l=d?l.trimLeft():l.trim()).length&&"#"!==(u=l.charAt(0)))if("v"===u){var m=l.split(/\s+/);switch(m[0]){case"v":o.vertices.push(parseFloat(m[1]),parseFloat(m[2]),parseFloat(m[3])),m.length>=7&&o.colors.push(parseFloat(m[4]),parseFloat(m[5]),parseFloat(m[6]));break;case"vn":o.normals.push(parseFloat(m[1]),parseFloat(m[2]),parseFloat(m[3]));break;case"vt":o.uvs.push(parseFloat(m[1]),parseFloat(m[2]))}}else if("f"===u){for(var v=l.substr(1).trim().split(/\s+/),g=[],y=0,x=v.length;y<x;y++){var b=v[y];if(b.length>0){var A=b.split("/");g.push(A)}}var w=g[0];for(y=1,x=g.length-1;y<x;y++){var _=g[y],M=g[y+1];o.addFace(w[0],_[0],M[0],w[1],_[1],M[1],w[2],_[2],M[2])}}else if("l"===u){var S=l.substring(1).trim().split(" "),E=[],T=[];if(-1===l.indexOf("/"))E=S;else for(var R=0,L=S.length;R<L;R++){var C=S[R].split("/");""!==C[0]&&E.push(C[0]),""!==C[1]&&T.push(C[1])}o.addLineGeometry(E,T)}else if("p"===u){var P=l.substr(1).trim().split(" ");o.addPointGeometry(P)}else if(null!==(h=e.exec(l))){var D=(" "+h[0].substr(1).trim()).substr(1);o.startObject(D)}else if(r.test(l))o.object.startMaterial(l.substring(7).trim(),o.materialLibraries);else if(t.test(l))o.materialLibraries.push(l.substring(7).trim());else if(n.test(l))console.warn('THREE.OBJLoader: Rendering identifier "usemap" not supported. Textures must be defined in MTL files.');else if("s"===u){if((h=l.split(" ")).length>1){var I=h[1].trim().toLowerCase();o.object.smooth="0"!==I&&"off"!==I}else o.object.smooth=!0;(X=o.object.currentMaterial())&&(X.smooth=o.object.smooth)}else{if("\0"===l)continue;console.warn('THREE.OBJLoader: Unexpected line: "'+l+'"')}o.finalize();var O=new c.Group;O.materialLibraries=[].concat(o.materialLibraries);for(p=0,f=o.objects.length;p<f;p++){var B=o.objects[p],F=B.geometry,U=B.materials,N="Line"===F.type,G="Points"===F.type,z=!1;if(0!==F.vertices.length){var k=new c.BufferGeometry;k.setAttribute("position",new c.Float32BufferAttribute(F.vertices,3)),F.normals.length>0?k.setAttribute("normal",new c.Float32BufferAttribute(F.normals,3)):k.computeVertexNormals(),F.colors.length>0&&(z=!0,k.setAttribute("color",new c.Float32BufferAttribute(F.colors,3))),F.uvs.length>0&&k.setAttribute("uv",new c.Float32BufferAttribute(F.uvs,2));for(var H,V=[],j=0,W=U.length;j<W;j++){var q=U[j],X=void 0;if(null!==this.materials)if(X=this.materials.create(q.name),!N||!X||X instanceof c.LineBasicMaterial){if(G&&X&&!(X instanceof c.PointsMaterial)){var Y=new c.PointsMaterial({size:10,sizeAttenuation:!1});c.Material.prototype.copy.call(Y,X),Y.color.copy(X.color),Y.map=X.map,X=Y}}else{var Q=new c.LineBasicMaterial;c.Material.prototype.copy.call(Q,X),Q.color.copy(X.color),X=Q}X||((X=N?new c.LineBasicMaterial:G?new c.PointsMaterial({size:1,sizeAttenuation:!1}):new c.MeshPhongMaterial).name=q.name),X.flatShading=!q.smooth,X.vertexColors=z?c.VertexColors:c.NoColors,V.push(X)}if(V.length>1){for(j=0,W=U.length;j<W;j++){q=U[j];k.addGroup(q.groupStart,q.groupCount,j)}H=N?new c.LineSegments(k,V):G?new c.Points(k,V):new c.Mesh(k,V)}else H=N?new c.LineSegments(k,V[0]):G?new c.Points(k,V[0]):new c.Mesh(k,V[0]);H.name=B.name,O.add(H)}}return console.timeEnd("OBJLoader"),O}}),a}(),m=function(e){c.Loader.call(this,e),this.decoderPath="",this.decoderConfig={},this.decoderBinary=null,this.decoderPending=null,this.workerLimit=4,this.workerPool=[],this.workerNextTaskID=1,this.workerSourceURL="",this.defaultAttributeIDs={position:"POSITION",normal:"NORMAL",color:"COLOR",uv:"TEX_COORD"},this.defaultAttributeTypes={position:"Float32Array",normal:"Float32Array",color:"Float32Array",uv:"Float32Array"}};m.prototype=Object.assign(Object.create(c.Loader.prototype),{constructor:m,setDecoderPath:function(e){return this.decoderPath=e,this},setDecoderConfig:function(e){return this.decoderConfig=e,this},setWorkerLimit:function(e){return this.workerLimit=e,this},setVerbosity:function(){console.warn("THREE.DRACOLoader: The .setVerbosity() method has been removed.")},setDrawMode:function(){console.warn("THREE.DRACOLoader: The .setDrawMode() method has been removed.")},setSkipDequantization:function(){console.warn("THREE.DRACOLoader: The .setSkipDequantization() method has been removed.")},load:function(e,t,r,n){var i=new c.FileLoader(this.manager);i.setPath(this.path),i.setResponseType("arraybuffer"),"use-credentials"===this.crossOrigin&&i.setWithCredentials(!0),i.load(e,e=>{var r={attributeIDs:this.defaultAttributeIDs,attributeTypes:this.defaultAttributeTypes,useUniqueIDs:!1};this.decodeGeometry(e,r).then(t).catch(n)},r,n)},decodeDracoFile:function(e,t,r,n){var i={attributeIDs:r||this.defaultAttributeIDs,attributeTypes:n||this.defaultAttributeTypes,useUniqueIDs:!!r};this.decodeGeometry(e,i).then(t)},decodeGeometry:function(e,t){for(var r in t.attributeTypes){var n=t.attributeTypes[r];void 0!==n.BYTES_PER_ELEMENT&&(t.attributeTypes[r]=n.name)}var i,a=JSON.stringify(t);if(m.taskCache.has(e)){var o=m.taskCache.get(e);if(o.key===a)return o.promise;if(0===e.byteLength)throw new Error("THREE.DRACOLoader: Unable to re-decode a buffer with different settings. Buffer has already been transferred.")}var s=this.workerNextTaskID++,l=e.byteLength,c=this._getWorker(s,l).then(r=>(i=r,new Promise((r,n)=>{i._callbacks[s]={resolve:r,reject:n},i.postMessage({type:"decode",id:s,taskConfig:t,buffer:e},[e])}))).then(e=>this._createGeometry(e.geometry));return c.finally(()=>{i&&s&&this._releaseTask(i,s)}),m.taskCache.set(e,{key:a,promise:c}),c},_createGeometry:function(e){var t=new c.BufferGeometry;e.index&&t.setIndex(new c.BufferAttribute(e.index.array,1));for(var r=0;r<e.attributes.length;r++){var n=e.attributes[r],i=n.name,a=n.array,o=n.itemSize;t.setAttribute(i,new c.BufferAttribute(a,o))}return t},_loadLibrary:function(e,t){var r=new c.FileLoader(this.manager);return r.setPath(this.decoderPath),r.setResponseType(t),new Promise((t,n)=>{r.load(e,t,void 0,n)})},preload:function(){return this._initDecoder(),this},_initDecoder:function(){if(this.decoderPending)return this.decoderPending;var e="object"!=typeof WebAssembly||"js"===this.decoderConfig.type,t=[];return e?t.push(this._loadLibrary("draco_decoder.js","text")):(t.push(this._loadLibrary("draco_wasm_wrapper.js","text")),t.push(this._loadLibrary("draco_decoder.wasm","arraybuffer"))),this.decoderPending=Promise.all(t).then(t=>{var r=t[0];e||(this.decoderConfig.wasmBinary=t[1]);var n=m.DRACOWorker.toString(),i=["/* draco decoder */",r,"","/* worker */",n.substring(n.indexOf("{")+1,n.lastIndexOf("}"))].join("\n");this.workerSourceURL=URL.createObjectURL(new Blob([i]))}),this.decoderPending},_getWorker:function(e,t){return this._initDecoder().then(()=>{var r;this.workerPool.length<this.workerLimit?((r=new Worker(this.workerSourceURL))._callbacks={},r._taskCosts={},r._taskLoad=0,r.postMessage({type:"init",decoderConfig:this.decoderConfig}),r.onmessage=function(e){var t=e.data;switch(t.type){case"decode":r._callbacks[t.id].resolve(t);break;case"error":r._callbacks[t.id].reject(t);break;default:console.error('THREE.DRACOLoader: Unexpected message, "'+t.type+'"')}},this.workerPool.push(r)):this.workerPool.sort((function(e,t){return e._taskLoad>t._taskLoad?-1:1}));return(r=this.workerPool[this.workerPool.length-1])._taskCosts[e]=t,r._taskLoad+=t,r})},_releaseTask:function(e,t){e._taskLoad-=e._taskCosts[t],delete e._callbacks[t],delete e._taskCosts[t]},debug:function(){console.log("Task load: ",this.workerPool.map(e=>e._taskLoad))},dispose:function(){for(var e=0;e<this.workerPool.length;++e)this.workerPool[e].terminate();return this.workerPool.length=0,this}}),m.DRACOWorker=function(){var e,t;function r(e,t,r,n,i,a){var o,s,l=a.num_components(),c=r.num_points()*l;switch(i){case Float32Array:o=new e.DracoFloat32Array,t.GetAttributeFloatForAllPoints(r,a,o),s=new Float32Array(c);break;case Int8Array:o=new e.DracoInt8Array,t.GetAttributeInt8ForAllPoints(r,a,o),s=new Int8Array(c);break;case Int16Array:o=new e.DracoInt16Array,t.GetAttributeInt16ForAllPoints(r,a,o),s=new Int16Array(c);break;case Int32Array:o=new e.DracoInt32Array,t.GetAttributeInt32ForAllPoints(r,a,o),s=new Int32Array(c);break;case Uint8Array:o=new e.DracoUInt8Array,t.GetAttributeUInt8ForAllPoints(r,a,o),s=new Uint8Array(c);break;case Uint16Array:o=new e.DracoUInt16Array,t.GetAttributeUInt16ForAllPoints(r,a,o),s=new Uint16Array(c);break;case Uint32Array:o=new e.DracoUInt32Array,t.GetAttributeUInt32ForAllPoints(r,a,o),s=new Uint32Array(c);break;default:throw new Error("THREE.DRACOLoader: Unexpected attribute type.")}for(var u=0;u<c;u++)s[u]=o.GetValue(u);return e.destroy(o),{name:n,array:s,itemSize:l}}onmessage=function(n){var i=n.data;switch(i.type){case"init":e=i.decoderConfig,t=new Promise((function(t){e.onModuleLoaded=function(e){t({draco:e})},DracoDecoderModule(e)}));break;case"decode":var a=i.buffer,o=i.taskConfig;t.then(e=>{var t=e.draco,n=new t.Decoder,s=new t.DecoderBuffer;s.Init(new Int8Array(a),a.byteLength);try{var l=function(e,t,n,i){var a,o,s=i.attributeIDs,l=i.attributeTypes,c=t.GetEncodedGeometryType(n);if(c===e.TRIANGULAR_MESH)a=new e.Mesh,o=t.DecodeBufferToMesh(n,a);else{if(c!==e.POINT_CLOUD)throw new Error("THREE.DRACOLoader: Unexpected geometry type.");a=new e.PointCloud,o=t.DecodeBufferToPointCloud(n,a)}if(!o.ok()||0===a.ptr)throw new Error("THREE.DRACOLoader: Decoding failed: "+o.error_msg());var u={index:null,attributes:[]};for(var h in s){var d,p,f=self[l[h]];if(i.useUniqueIDs)p=s[h],d=t.GetAttributeByUniqueId(a,p);else{if(-1===(p=t.GetAttributeId(a,e[s[h]])))continue;d=t.GetAttribute(a,p)}u.attributes.push(r(e,t,a,h,f,d))}if(c===e.TRIANGULAR_MESH){for(var m=a.num_faces(),v=new Uint32Array(3*m),g=new e.DracoInt32Array,y=0;y<m;++y){t.GetFaceFromMesh(a,y,g);for(var x=0;x<3;++x)v[3*y+x]=g.GetValue(x)}u.index={array:v,itemSize:1},e.destroy(g)}return e.destroy(a),u}(t,n,s,o),c=l.attributes.map(e=>e.array.buffer);l.index&&c.push(l.index.array.buffer),self.postMessage({type:"decode",id:i.id,geometry:l},c)}catch(e){console.error(e),self.postMessage({type:"error",id:i.id,error:e.message})}finally{t.destroy(s),t.destroy(n)}})}}},m.taskCache=new WeakMap,m.setDecoderPath=function(){console.warn("THREE.DRACOLoader: The .setDecoderPath() method has been removed. Use instance methods.")},m.setDecoderConfig=function(){console.warn("THREE.DRACOLoader: The .setDecoderConfig() method has been removed. Use instance methods.")},m.releaseDecoderModule=function(){console.warn("THREE.DRACOLoader: The .releaseDecoderModule() method has been removed. Use instance methods.")},m.getDecoderModule=function(){console.warn("THREE.DRACOLoader: The .getDecoderModule() method has been removed. Use instance methods.")};const v="src/vendor/",g="src/vendor/";function y(e){let t=0;for(var r in e)!0!==e[r].loading&&t++;return t}function x(e){for(var t in e)if(!0===e[t].loading)return!1;return!0}var b=r(1),A=r(2),w=r(3);var _=Object(A.defineWorkerModule)({dependencies:[function(){var e=self,t={parse:function(e){var r=t._bin,n=new Uint8Array(e);if("ttcf"==r.readASCII(n,0,4)){var i=4;r.readUshort(n,i);i+=2;r.readUshort(n,i);i+=2;var a=r.readUint(n,i);i+=4;for(var o=[],s=0;s<a;s++){var l=r.readUint(n,i);i+=4,o.push(t._readFont(n,l))}return o}return[t._readFont(n,0)]},_readFont:function(e,r){var n=t._bin,i=r;n.readFixed(e,r);r+=4;var a=n.readUshort(e,r);r+=2;n.readUshort(e,r);r+=2;n.readUshort(e,r);r+=2;n.readUshort(e,r);r+=2;for(var o=["cmap","head","hhea","maxp","hmtx","name","OS/2","post","loca","glyf","kern","CFF ","GPOS","GSUB","SVG "],s={_data:e,_offset:i},l={},c=0;c<a;c++){var u=n.readASCII(e,r,4);r+=4;n.readUint(e,r);r+=4;var h=n.readUint(e,r);r+=4;var d=n.readUint(e,r);r+=4,l[u]={offset:h,length:d}}for(c=0;c<o.length;c++){var p=o[c];l[p]&&(s[p.trim()]=t[p.trim()].parse(e,l[p].offset,l[p].length,s))}return s},_tabOffset:function(e,r,n){for(var i=t._bin,a=i.readUshort(e,n+4),o=n+12,s=0;s<a;s++){var l=i.readASCII(e,o,4);o+=4;i.readUint(e,o);o+=4;var c=i.readUint(e,o);o+=4;i.readUint(e,o);if(o+=4,l==r)return c}return 0}};return t._bin={readFixed:function(e,t){return(e[t]<<8|e[t+1])+(e[t+2]<<8|e[t+3])/65540},readF2dot14:function(e,r){return t._bin.readShort(e,r)/16384},readInt:function(e,r){var n=t._bin.t.uint8;return n[0]=e[r+3],n[1]=e[r+2],n[2]=e[r+1],n[3]=e[r],t._bin.t.int32[0]},readInt8:function(e,r){return t._bin.t.uint8[0]=e[r],t._bin.t.int8[0]},readShort:function(e,r){var n=t._bin.t.uint8;return n[1]=e[r],n[0]=e[r+1],t._bin.t.int16[0]},readUshort:function(e,t){return e[t]<<8|e[t+1]},readUshorts:function(e,r,n){for(var i=[],a=0;a<n;a++)i.push(t._bin.readUshort(e,r+2*a));return i},readUint:function(e,r){var n=t._bin.t.uint8;return n[3]=e[r],n[2]=e[r+1],n[1]=e[r+2],n[0]=e[r+3],t._bin.t.uint32[0]},readUint64:function(e,r){return 4294967296*t._bin.readUint(e,r)+t._bin.readUint(e,r+4)},readASCII:function(e,t,r){for(var n="",i=0;i<r;i++)n+=String.fromCharCode(e[t+i]);return n},readUnicode:function(e,t,r){for(var n="",i=0;i<r;i++){var a=e[t++]<<8|e[t++];n+=String.fromCharCode(a)}return n},_tdec:e.TextDecoder?new e.TextDecoder:null,readUTF8:function(e,r,n){var i=t._bin._tdec;return i&&0==r&&n==e.length?i.decode(e):t._bin.readASCII(e,r,n)},readBytes:function(e,t,r){for(var n=[],i=0;i<r;i++)n.push(e[t+i]);return n},readASCIIArray:function(e,t,r){for(var n=[],i=0;i<r;i++)n.push(String.fromCharCode(e[t+i]));return n}},t._bin.t={buff:new ArrayBuffer(8)},t._bin.t.int8=new Int8Array(t._bin.t.buff),t._bin.t.uint8=new Uint8Array(t._bin.t.buff),t._bin.t.int16=new Int16Array(t._bin.t.buff),t._bin.t.uint16=new Uint16Array(t._bin.t.buff),t._bin.t.int32=new Int32Array(t._bin.t.buff),t._bin.t.uint32=new Uint32Array(t._bin.t.buff),t._lctf={},t._lctf.parse=function(e,r,n,i,a){var o=t._bin,s={},l=r;o.readFixed(e,r);r+=4;var c=o.readUshort(e,r);r+=2;var u=o.readUshort(e,r);r+=2;var h=o.readUshort(e,r);return r+=2,s.scriptList=t._lctf.readScriptList(e,l+c),s.featureList=t._lctf.readFeatureList(e,l+u),s.lookupList=t._lctf.readLookupList(e,l+h,a),s},t._lctf.readLookupList=function(e,r,n){var i=t._bin,a=r,o=[],s=i.readUshort(e,r);r+=2;for(var l=0;l<s;l++){var c=i.readUshort(e,r);r+=2;var u=t._lctf.readLookupTable(e,a+c,n);o.push(u)}return o},t._lctf.readLookupTable=function(e,r,n){var i=t._bin,a=r,o={tabs:[]};o.ltype=i.readUshort(e,r),r+=2,o.flag=i.readUshort(e,r),r+=2;var s=i.readUshort(e,r);r+=2;for(var l=0;l<s;l++){var c=i.readUshort(e,r);r+=2;var u=n(e,o.ltype,a+c);o.tabs.push(u)}return o},t._lctf.numOfOnes=function(e){for(var t=0,r=0;r<32;r++)0!=(e>>>r&1)&&t++;return t},t._lctf.readClassDef=function(e,r){var n=t._bin,i=[],a=n.readUshort(e,r);if(r+=2,1==a){var o=n.readUshort(e,r);r+=2;var s=n.readUshort(e,r);r+=2;for(var l=0;l<s;l++)i.push(o+l),i.push(o+l),i.push(n.readUshort(e,r)),r+=2}if(2==a){var c=n.readUshort(e,r);r+=2;for(l=0;l<c;l++)i.push(n.readUshort(e,r)),r+=2,i.push(n.readUshort(e,r)),r+=2,i.push(n.readUshort(e,r)),r+=2}return i},t._lctf.getInterval=function(e,t){for(var r=0;r<e.length;r+=3){var n=e[r],i=e[r+1];e[r+2];if(n<=t&&t<=i)return r}return-1},t._lctf.readCoverage=function(e,r){var n=t._bin,i={};i.fmt=n.readUshort(e,r),r+=2;var a=n.readUshort(e,r);return r+=2,1==i.fmt&&(i.tab=n.readUshorts(e,r,a)),2==i.fmt&&(i.tab=n.readUshorts(e,r,3*a)),i},t._lctf.coverageIndex=function(e,r){var n=e.tab;if(1==e.fmt)return n.indexOf(r);if(2==e.fmt){var i=t._lctf.getInterval(n,r);if(-1!=i)return n[i+2]+(r-n[i])}return-1},t._lctf.readFeatureList=function(e,r){var n=t._bin,i=r,a=[],o=n.readUshort(e,r);r+=2;for(var s=0;s<o;s++){var l=n.readASCII(e,r,4);r+=4;var c=n.readUshort(e,r);r+=2,a.push({tag:l.trim(),tab:t._lctf.readFeatureTable(e,i+c)})}return a},t._lctf.readFeatureTable=function(e,r){var n=t._bin;n.readUshort(e,r);r+=2;var i=n.readUshort(e,r);r+=2;for(var a=[],o=0;o<i;o++)a.push(n.readUshort(e,r+2*o));return a},t._lctf.readScriptList=function(e,r){var n=t._bin,i=r,a={},o=n.readUshort(e,r);r+=2;for(var s=0;s<o;s++){var l=n.readASCII(e,r,4);r+=4;var c=n.readUshort(e,r);r+=2,a[l.trim()]=t._lctf.readScriptTable(e,i+c)}return a},t._lctf.readScriptTable=function(e,r){var n=t._bin,i=r,a={},o=n.readUshort(e,r);r+=2,a.default=t._lctf.readLangSysTable(e,i+o);var s=n.readUshort(e,r);r+=2;for(var l=0;l<s;l++){var c=n.readASCII(e,r,4);r+=4;var u=n.readUshort(e,r);r+=2,a[c.trim()]=t._lctf.readLangSysTable(e,i+u)}return a},t._lctf.readLangSysTable=function(e,r){var n=t._bin,i={};n.readUshort(e,r);r+=2,i.reqFeature=n.readUshort(e,r),r+=2;var a=n.readUshort(e,r);return r+=2,i.features=n.readUshorts(e,r,a),i},t.CFF={},t.CFF.parse=function(e,r,n){var i=t._bin;(e=new Uint8Array(e.buffer,r,n))[r=0],e[++r],e[++r],e[++r];r++;var a=[];r=t.CFF.readIndex(e,r,a);for(var o=[],s=0;s<a.length-1;s++)o.push(i.readASCII(e,r+a[s],a[s+1]-a[s]));r+=a[a.length-1];var l=[];r=t.CFF.readIndex(e,r,l);var c=[];for(s=0;s<l.length-1;s++)c.push(t.CFF.readDict(e,r+l[s],r+l[s+1]));r+=l[l.length-1];var u=c[0],h=[];r=t.CFF.readIndex(e,r,h);var d=[];for(s=0;s<h.length-1;s++)d.push(i.readASCII(e,r+h[s],h[s+1]-h[s]));if(r+=h[h.length-1],t.CFF.readSubrs(e,r,u),u.CharStrings){r=u.CharStrings;h=[];r=t.CFF.readIndex(e,r,h);var p=[];for(s=0;s<h.length-1;s++)p.push(i.readBytes(e,r+h[s],h[s+1]-h[s]));u.CharStrings=p}if(u.ROS){r=u.FDArray;var f=[];r=t.CFF.readIndex(e,r,f),u.FDArray=[];for(s=0;s<f.length-1;s++){var m=t.CFF.readDict(e,r+f[s],r+f[s+1]);t.CFF._readFDict(e,m,d),u.FDArray.push(m)}r+=f[f.length-1],r=u.FDSelect,u.FDSelect=[];var v=e[r];if(r++,3!=v)throw v;var g=i.readUshort(e,r);r+=2;for(s=0;s<g+1;s++)u.FDSelect.push(i.readUshort(e,r),e[r+2]),r+=3}return u.Encoding&&(u.Encoding=t.CFF.readEncoding(e,u.Encoding,u.CharStrings.length)),u.charset&&(u.charset=t.CFF.readCharset(e,u.charset,u.CharStrings.length)),t.CFF._readFDict(e,u,d),u},t.CFF._readFDict=function(e,r,n){var i;for(var a in r.Private&&(i=r.Private[1],r.Private=t.CFF.readDict(e,i,i+r.Private[0]),r.Private.Subrs&&t.CFF.readSubrs(e,i+r.Private.Subrs,r.Private)),r)-1!=["FamilyName","FontName","FullName","Notice","version","Copyright"].indexOf(a)&&(r[a]=n[r[a]-426+35])},t.CFF.readSubrs=function(e,r,n){var i=t._bin,a=[];r=t.CFF.readIndex(e,r,a);var o,s=a.length;o=s<1240?107:s<33900?1131:32768,n.Bias=o,n.Subrs=[];for(var l=0;l<a.length-1;l++)n.Subrs.push(i.readBytes(e,r+a[l],a[l+1]-a[l]))},t.CFF.tableSE=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,0,111,112,113,114,0,115,116,117,118,119,120,121,122,0,123,0,124,125,126,127,128,129,130,131,0,132,133,0,134,135,136,137,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,138,0,139,0,0,0,0,140,141,142,143,0,0,0,0,0,144,0,0,0,145,0,0,146,147,148,149,0,0,0,0],t.CFF.glyphByUnicode=function(e,t){for(var r=0;r<e.charset.length;r++)if(e.charset[r]==t)return r;return-1},t.CFF.glyphBySE=function(e,r){return r<0||r>255?-1:t.CFF.glyphByUnicode(e,t.CFF.tableSE[r])},t.CFF.readEncoding=function(e,r,n){t._bin;var i=[".notdef"],a=e[r];if(0!=a)throw"error: unknown encoding format: "+a;var o=e[++r];r++;for(var s=0;s<o;s++)i.push(e[r+s]);return i},t.CFF.readCharset=function(e,r,n){var i=t._bin,a=[".notdef"],o=e[r];if(r++,0==o)for(var s=0;s<n;s++){var l=i.readUshort(e,r);r+=2,a.push(l)}else{if(1!=o&&2!=o)throw"error: format: "+o;for(;a.length<n;){l=i.readUshort(e,r);r+=2;var c=0;1==o?(c=e[r],r++):(c=i.readUshort(e,r),r+=2);for(s=0;s<=c;s++)a.push(l),l++}}return a},t.CFF.readIndex=function(e,r,n){var i=t._bin,a=i.readUshort(e,r)+1,o=e[r+=2];if(r++,1==o)for(var s=0;s<a;s++)n.push(e[r+s]);else if(2==o)for(s=0;s<a;s++)n.push(i.readUshort(e,r+2*s));else if(3==o)for(s=0;s<a;s++)n.push(16777215&i.readUint(e,r+3*s-1));else if(1!=a)throw"unsupported offset size: "+o+", count: "+a;return(r+=a*o)-1},t.CFF.getCharString=function(e,r,n){var i=t._bin,a=e[r],o=e[r+1],s=(e[r+2],e[r+3],e[r+4],1),l=null,c=null;a<=20&&(l=a,s=1),12==a&&(l=100*a+o,s=2),21<=a&&a<=27&&(l=a,s=1),28==a&&(c=i.readShort(e,r+1),s=3),29<=a&&a<=31&&(l=a,s=1),32<=a&&a<=246&&(c=a-139,s=1),247<=a&&a<=250&&(c=256*(a-247)+o+108,s=2),251<=a&&a<=254&&(c=256*-(a-251)-o-108,s=2),255==a&&(c=i.readInt(e,r+1)/65535,s=5),n.val=null!=c?c:"o"+l,n.size=s},t.CFF.readCharString=function(e,r,n){for(var i=r+n,a=t._bin,o=[];r<i;){var s=e[r],l=e[r+1],c=(e[r+2],e[r+3],e[r+4],1),u=null,h=null;s<=20&&(u=s,c=1),12==s&&(u=100*s+l,c=2),19!=s&&20!=s||(u=s,c=2),21<=s&&s<=27&&(u=s,c=1),28==s&&(h=a.readShort(e,r+1),c=3),29<=s&&s<=31&&(u=s,c=1),32<=s&&s<=246&&(h=s-139,c=1),247<=s&&s<=250&&(h=256*(s-247)+l+108,c=2),251<=s&&s<=254&&(h=256*-(s-251)-l-108,c=2),255==s&&(h=a.readInt(e,r+1)/65535,c=5),o.push(null!=h?h:"o"+u),r+=c}return o},t.CFF.readDict=function(e,r,n){for(var i=t._bin,a={},o=[];r<n;){var s=e[r],l=e[r+1],c=(e[r+2],e[r+3],e[r+4],1),u=null,h=null;if(28==s&&(h=i.readShort(e,r+1),c=3),29==s&&(h=i.readInt(e,r+1),c=5),32<=s&&s<=246&&(h=s-139,c=1),247<=s&&s<=250&&(h=256*(s-247)+l+108,c=2),251<=s&&s<=254&&(h=256*-(s-251)-l-108,c=2),255==s)throw h=i.readInt(e,r+1)/65535,c=5,"unknown number";if(30==s){var d=[];for(c=1;;){var p=e[r+c];c++;var f=p>>4,m=15&p;if(15!=f&&d.push(f),15!=m&&d.push(m),15==m)break}for(var v="",g=[0,1,2,3,4,5,6,7,8,9,".","e","e-","reserved","-","endOfNumber"],y=0;y<d.length;y++)v+=g[d[y]];h=parseFloat(v)}if(s<=21)if(u=["version","Notice","FullName","FamilyName","Weight","FontBBox","BlueValues","OtherBlues","FamilyBlues","FamilyOtherBlues","StdHW","StdVW","escape","UniqueID","XUID","charset","Encoding","CharStrings","Private","Subrs","defaultWidthX","nominalWidthX"][s],c=1,12==s)u=["Copyright","isFixedPitch","ItalicAngle","UnderlinePosition","UnderlineThickness","PaintType","CharstringType","FontMatrix","StrokeWidth","BlueScale","BlueShift","BlueFuzz","StemSnapH","StemSnapV","ForceBold",0,0,"LanguageGroup","ExpansionFactor","initialRandomSeed","SyntheticBase","PostScript","BaseFontName","BaseFontBlend",0,0,0,0,0,0,"ROS","CIDFontVersion","CIDFontRevision","CIDFontType","CIDCount","UIDBase","FDArray","FDSelect","FontName"][l],c=2;null!=u?(a[u]=1==o.length?o[0]:o,o=[]):o.push(h),r+=c}return a},t.cmap={},t.cmap.parse=function(e,r,n){e=new Uint8Array(e.buffer,r,n),r=0;var i=t._bin,a={};i.readUshort(e,r);r+=2;var o=i.readUshort(e,r);r+=2;var s=[];a.tables=[];for(var l=0;l<o;l++){var c=i.readUshort(e,r);r+=2;var u=i.readUshort(e,r);r+=2;var h=i.readUint(e,r);r+=4;var d="p"+c+"e"+u,p=s.indexOf(h);if(-1==p){var f;p=a.tables.length,s.push(h);var m=i.readUshort(e,h);0==m?f=t.cmap.parse0(e,h):4==m?f=t.cmap.parse4(e,h):6==m?f=t.cmap.parse6(e,h):12==m?f=t.cmap.parse12(e,h):console.log("unknown format: "+m,c,u,h),a.tables.push(f)}if(null!=a[d])throw"multiple tables for one platform+encoding";a[d]=p}return a},t.cmap.parse0=function(e,r){var n=t._bin,i={};i.format=n.readUshort(e,r),r+=2;var a=n.readUshort(e,r);r+=2;n.readUshort(e,r);r+=2,i.map=[];for(var o=0;o<a-6;o++)i.map.push(e[r+o]);return i},t.cmap.parse4=function(e,r){var n=t._bin,i=r,a={};a.format=n.readUshort(e,r),r+=2;var o=n.readUshort(e,r);r+=2;n.readUshort(e,r);r+=2;var s=n.readUshort(e,r);r+=2;var l=s/2;a.searchRange=n.readUshort(e,r),r+=2,a.entrySelector=n.readUshort(e,r),r+=2,a.rangeShift=n.readUshort(e,r),r+=2,a.endCount=n.readUshorts(e,r,l),r+=2*l,r+=2,a.startCount=n.readUshorts(e,r,l),r+=2*l,a.idDelta=[];for(var c=0;c<l;c++)a.idDelta.push(n.readShort(e,r)),r+=2;for(a.idRangeOffset=n.readUshorts(e,r,l),r+=2*l,a.glyphIdArray=[];r<i+o;)a.glyphIdArray.push(n.readUshort(e,r)),r+=2;return a},t.cmap.parse6=function(e,r){var n=t._bin,i={};i.format=n.readUshort(e,r),r+=2;n.readUshort(e,r);r+=2;n.readUshort(e,r);r+=2,i.firstCode=n.readUshort(e,r),r+=2;var a=n.readUshort(e,r);r+=2,i.glyphIdArray=[];for(var o=0;o<a;o++)i.glyphIdArray.push(n.readUshort(e,r)),r+=2;return i},t.cmap.parse12=function(e,r){var n=t._bin,i={};i.format=n.readUshort(e,r),r+=2,r+=2;n.readUint(e,r);r+=4;n.readUint(e,r);r+=4;var a=n.readUint(e,r);r+=4,i.groups=[];for(var o=0;o<a;o++){var s=r+12*o,l=n.readUint(e,s+0),c=n.readUint(e,s+4),u=n.readUint(e,s+8);i.groups.push([l,c,u])}return i},t.glyf={},t.glyf.parse=function(e,t,r,n){for(var i=[],a=0;a<n.maxp.numGlyphs;a++)i.push(null);return i},t.glyf._parseGlyf=function(e,r){var n=t._bin,i=e._data,a=t._tabOffset(i,"glyf",e._offset)+e.loca[r];if(e.loca[r]==e.loca[r+1])return null;var o={};if(o.noc=n.readShort(i,a),a+=2,o.xMin=n.readShort(i,a),a+=2,o.yMin=n.readShort(i,a),a+=2,o.xMax=n.readShort(i,a),a+=2,o.yMax=n.readShort(i,a),a+=2,o.xMin>=o.xMax||o.yMin>=o.yMax)return null;if(o.noc>0){o.endPts=[];for(var s=0;s<o.noc;s++)o.endPts.push(n.readUshort(i,a)),a+=2;var l=n.readUshort(i,a);if(a+=2,i.length-a<l)return null;o.instructions=n.readBytes(i,a,l),a+=l;var c=o.endPts[o.noc-1]+1;o.flags=[];for(s=0;s<c;s++){var u=i[a];if(a++,o.flags.push(u),0!=(8&u)){var h=i[a];a++;for(var d=0;d<h;d++)o.flags.push(u),s++}}o.xs=[];for(s=0;s<c;s++){var p=0!=(2&o.flags[s]),f=0!=(16&o.flags[s]);p?(o.xs.push(f?i[a]:-i[a]),a++):f?o.xs.push(0):(o.xs.push(n.readShort(i,a)),a+=2)}o.ys=[];for(s=0;s<c;s++){p=0!=(4&o.flags[s]),f=0!=(32&o.flags[s]);p?(o.ys.push(f?i[a]:-i[a]),a++):f?o.ys.push(0):(o.ys.push(n.readShort(i,a)),a+=2)}var m=0,v=0;for(s=0;s<c;s++)m+=o.xs[s],v+=o.ys[s],o.xs[s]=m,o.ys[s]=v}else{var g;o.parts=[];do{g=n.readUshort(i,a),a+=2;var y={m:{a:1,b:0,c:0,d:1,tx:0,ty:0},p1:-1,p2:-1};if(o.parts.push(y),y.glyphIndex=n.readUshort(i,a),a+=2,1&g){var x=n.readShort(i,a);a+=2;var b=n.readShort(i,a);a+=2}else{x=n.readInt8(i,a);a++;b=n.readInt8(i,a);a++}2&g?(y.m.tx=x,y.m.ty=b):(y.p1=x,y.p2=b),8&g?(y.m.a=y.m.d=n.readF2dot14(i,a),a+=2):64&g?(y.m.a=n.readF2dot14(i,a),a+=2,y.m.d=n.readF2dot14(i,a),a+=2):128&g&&(y.m.a=n.readF2dot14(i,a),a+=2,y.m.b=n.readF2dot14(i,a),a+=2,y.m.c=n.readF2dot14(i,a),a+=2,y.m.d=n.readF2dot14(i,a),a+=2)}while(32&g);if(256&g){var A=n.readUshort(i,a);a+=2,o.instr=[];for(s=0;s<A;s++)o.instr.push(i[a]),a++}}return o},t.GPOS={},t.GPOS.parse=function(e,r,n,i){return t._lctf.parse(e,r,n,i,t.GPOS.subt)},t.GPOS.subt=function(e,r,n){var i=t._bin,a=n,o={};if(o.fmt=i.readUshort(e,n),n+=2,1==r||2==r||3==r||7==r||8==r&&o.fmt<=2){var s=i.readUshort(e,n);n+=2,o.coverage=t._lctf.readCoverage(e,s+a)}if(1==r&&1==o.fmt){var l=i.readUshort(e,n);n+=2;var c=t._lctf.numOfOnes(l);0!=l&&(o.pos=t.GPOS.readValueRecord(e,n,l))}else if(2==r){l=i.readUshort(e,n);n+=2;var u=i.readUshort(e,n);n+=2;c=t._lctf.numOfOnes(l);var h=t._lctf.numOfOnes(u);if(1==o.fmt){o.pairsets=[];var d=i.readUshort(e,n);n+=2;for(var p=0;p<d;p++){var f=a+i.readUshort(e,n);n+=2;var m=i.readUshort(e,f);f+=2;for(var v=[],g=0;g<m;g++){var y=i.readUshort(e,f);f+=2,0!=l&&(M=t.GPOS.readValueRecord(e,f,l),f+=2*c),0!=u&&(S=t.GPOS.readValueRecord(e,f,u),f+=2*h),v.push({gid2:y,val1:M,val2:S})}o.pairsets.push(v)}}if(2==o.fmt){var x=i.readUshort(e,n);n+=2;var b=i.readUshort(e,n);n+=2;var A=i.readUshort(e,n);n+=2;var w=i.readUshort(e,n);n+=2,o.classDef1=t._lctf.readClassDef(e,a+x),o.classDef2=t._lctf.readClassDef(e,a+b),o.matrix=[];for(p=0;p<A;p++){var _=[];for(g=0;g<w;g++){var M=null,S=null;0!=o.valFmt1&&(M=t.GPOS.readValueRecord(e,n,o.valFmt1),n+=2*c),0!=o.valFmt2&&(S=t.GPOS.readValueRecord(e,n,o.valFmt2),n+=2*h),_.push({val1:M,val2:S})}o.matrix.push(_)}}}return o},t.GPOS.readValueRecord=function(e,r,n){var i=t._bin,a=[];return a.push(1&n?i.readShort(e,r):0),r+=1&n?2:0,a.push(2&n?i.readShort(e,r):0),r+=2&n?2:0,a.push(4&n?i.readShort(e,r):0),r+=4&n?2:0,a.push(8&n?i.readShort(e,r):0),r+=8&n?2:0,a},t.GSUB={},t.GSUB.parse=function(e,r,n,i){return t._lctf.parse(e,r,n,i,t.GSUB.subt)},t.GSUB.subt=function(e,r,n){var i=t._bin,a=n,o={};if(o.fmt=i.readUshort(e,n),n+=2,1!=r&&4!=r&&5!=r&&6!=r)return null;if(1==r||4==r||5==r&&o.fmt<=2||6==r&&o.fmt<=2){var s=i.readUshort(e,n);n+=2,o.coverage=t._lctf.readCoverage(e,a+s)}if(1==r){if(1==o.fmt)o.delta=i.readShort(e,n),n+=2;else if(2==o.fmt){var l=i.readUshort(e,n);n+=2,o.newg=i.readUshorts(e,n,l),n+=2*o.newg.length}}else if(4==r){o.vals=[];l=i.readUshort(e,n);n+=2;for(var c=0;c<l;c++){var u=i.readUshort(e,n);n+=2,o.vals.push(t.GSUB.readLigatureSet(e,a+u))}}else if(5==r){if(2==o.fmt){var h=i.readUshort(e,n);n+=2,o.cDef=t._lctf.readClassDef(e,a+h),o.scset=[];var d=i.readUshort(e,n);n+=2;for(c=0;c<d;c++){var p=i.readUshort(e,n);n+=2,o.scset.push(0==p?null:t.GSUB.readSubClassSet(e,a+p))}}}else if(6==r&&3==o.fmt){for(c=0;c<3;c++){l=i.readUshort(e,n);n+=2;for(var f=[],m=0;m<l;m++)f.push(t._lctf.readCoverage(e,a+i.readUshort(e,n+2*m)));n+=2*l,0==c&&(o.backCvg=f),1==c&&(o.inptCvg=f),2==c&&(o.ahedCvg=f)}l=i.readUshort(e,n);n+=2,o.lookupRec=t.GSUB.readSubstLookupRecords(e,n,l)}return o},t.GSUB.readSubClassSet=function(e,r){var n=t._bin.readUshort,i=r,a=[],o=n(e,r);r+=2;for(var s=0;s<o;s++){var l=n(e,r);r+=2,a.push(t.GSUB.readSubClassRule(e,i+l))}return a},t.GSUB.readSubClassRule=function(e,r){var n=t._bin.readUshort,i={},a=n(e,r),o=n(e,r+=2);r+=2,i.input=[];for(var s=0;s<a-1;s++)i.input.push(n(e,r)),r+=2;return i.substLookupRecords=t.GSUB.readSubstLookupRecords(e,r,o),i},t.GSUB.readSubstLookupRecords=function(e,r,n){for(var i=t._bin.readUshort,a=[],o=0;o<n;o++)a.push(i(e,r),i(e,r+2)),r+=4;return a},t.GSUB.readChainSubClassSet=function(e,r){var n=t._bin,i=r,a=[],o=n.readUshort(e,r);r+=2;for(var s=0;s<o;s++){var l=n.readUshort(e,r);r+=2,a.push(t.GSUB.readChainSubClassRule(e,i+l))}return a},t.GSUB.readChainSubClassRule=function(e,r){for(var n=t._bin,i={},a=["backtrack","input","lookahead"],o=0;o<a.length;o++){var s=n.readUshort(e,r);r+=2,1==o&&s--,i[a[o]]=n.readUshorts(e,r,s),r+=2*i[a[o]].length}s=n.readUshort(e,r);return r+=2,i.subst=n.readUshorts(e,r,2*s),r+=2*i.subst.length,i},t.GSUB.readLigatureSet=function(e,r){var n=t._bin,i=r,a=[],o=n.readUshort(e,r);r+=2;for(var s=0;s<o;s++){var l=n.readUshort(e,r);r+=2,a.push(t.GSUB.readLigature(e,i+l))}return a},t.GSUB.readLigature=function(e,r){var n=t._bin,i={chain:[]};i.nglyph=n.readUshort(e,r),r+=2;var a=n.readUshort(e,r);r+=2;for(var o=0;o<a-1;o++)i.chain.push(n.readUshort(e,r)),r+=2;return i},t.head={},t.head.parse=function(e,r,n){var i=t._bin,a={};i.readFixed(e,r);r+=4,a.fontRevision=i.readFixed(e,r),r+=4;i.readUint(e,r);r+=4;i.readUint(e,r);return r+=4,a.flags=i.readUshort(e,r),r+=2,a.unitsPerEm=i.readUshort(e,r),r+=2,a.created=i.readUint64(e,r),r+=8,a.modified=i.readUint64(e,r),r+=8,a.xMin=i.readShort(e,r),r+=2,a.yMin=i.readShort(e,r),r+=2,a.xMax=i.readShort(e,r),r+=2,a.yMax=i.readShort(e,r),r+=2,a.macStyle=i.readUshort(e,r),r+=2,a.lowestRecPPEM=i.readUshort(e,r),r+=2,a.fontDirectionHint=i.readShort(e,r),r+=2,a.indexToLocFormat=i.readShort(e,r),r+=2,a.glyphDataFormat=i.readShort(e,r),r+=2,a},t.hhea={},t.hhea.parse=function(e,r,n){var i=t._bin,a={};i.readFixed(e,r);return r+=4,a.ascender=i.readShort(e,r),r+=2,a.descender=i.readShort(e,r),r+=2,a.lineGap=i.readShort(e,r),r+=2,a.advanceWidthMax=i.readUshort(e,r),r+=2,a.minLeftSideBearing=i.readShort(e,r),r+=2,a.minRightSideBearing=i.readShort(e,r),r+=2,a.xMaxExtent=i.readShort(e,r),r+=2,a.caretSlopeRise=i.readShort(e,r),r+=2,a.caretSlopeRun=i.readShort(e,r),r+=2,a.caretOffset=i.readShort(e,r),r+=2,r+=8,a.metricDataFormat=i.readShort(e,r),r+=2,a.numberOfHMetrics=i.readUshort(e,r),r+=2,a},t.hmtx={},t.hmtx.parse=function(e,r,n,i){for(var a=t._bin,o={aWidth:[],lsBearing:[]},s=0,l=0,c=0;c<i.maxp.numGlyphs;c++)c<i.hhea.numberOfHMetrics&&(s=a.readUshort(e,r),r+=2,l=a.readShort(e,r),r+=2),o.aWidth.push(s),o.lsBearing.push(l);return o},t.kern={},t.kern.parse=function(e,r,n,i){var a=t._bin,o=a.readUshort(e,r);if(r+=2,1==o)return t.kern.parseV1(e,r-2,n,i);var s=a.readUshort(e,r);r+=2;for(var l={glyph1:[],rval:[]},c=0;c<s;c++){r+=2;n=a.readUshort(e,r);r+=2;var u=a.readUshort(e,r);r+=2;var h=u>>>8;if(0!=(h&=15))throw"unknown kern table format: "+h;r=t.kern.readFormat0(e,r,l)}return l},t.kern.parseV1=function(e,r,n,i){var a=t._bin;a.readFixed(e,r);r+=4;var o=a.readUint(e,r);r+=4;for(var s={glyph1:[],rval:[]},l=0;l<o;l++){a.readUint(e,r);r+=4;var c=a.readUshort(e,r);r+=2;a.readUshort(e,r);r+=2;var u=c>>>8;if(0!=(u&=15))throw"unknown kern table format: "+u;r=t.kern.readFormat0(e,r,s)}return s},t.kern.readFormat0=function(e,r,n){var i=t._bin,a=-1,o=i.readUshort(e,r);r+=2;i.readUshort(e,r);r+=2;i.readUshort(e,r);r+=2;i.readUshort(e,r);r+=2;for(var s=0;s<o;s++){var l=i.readUshort(e,r);r+=2;var c=i.readUshort(e,r);r+=2;var u=i.readShort(e,r);r+=2,l!=a&&(n.glyph1.push(l),n.rval.push({glyph2:[],vals:[]}));var h=n.rval[n.rval.length-1];h.glyph2.push(c),h.vals.push(u),a=l}return r},t.loca={},t.loca.parse=function(e,r,n,i){var a=t._bin,o=[],s=i.head.indexToLocFormat,l=i.maxp.numGlyphs+1;if(0==s)for(var c=0;c<l;c++)o.push(a.readUshort(e,r+(c<<1))<<1);if(1==s)for(c=0;c<l;c++)o.push(a.readUint(e,r+(c<<2)));return o},t.maxp={},t.maxp.parse=function(e,r,n){var i=t._bin,a={},o=i.readUint(e,r);return r+=4,a.numGlyphs=i.readUshort(e,r),r+=2,65536==o&&(a.maxPoints=i.readUshort(e,r),r+=2,a.maxContours=i.readUshort(e,r),r+=2,a.maxCompositePoints=i.readUshort(e,r),r+=2,a.maxCompositeContours=i.readUshort(e,r),r+=2,a.maxZones=i.readUshort(e,r),r+=2,a.maxTwilightPoints=i.readUshort(e,r),r+=2,a.maxStorage=i.readUshort(e,r),r+=2,a.maxFunctionDefs=i.readUshort(e,r),r+=2,a.maxInstructionDefs=i.readUshort(e,r),r+=2,a.maxStackElements=i.readUshort(e,r),r+=2,a.maxSizeOfInstructions=i.readUshort(e,r),r+=2,a.maxComponentElements=i.readUshort(e,r),r+=2,a.maxComponentDepth=i.readUshort(e,r),r+=2),a},t.name={},t.name.parse=function(e,r,n){var i=t._bin,a={};i.readUshort(e,r);r+=2;var o=i.readUshort(e,r);r+=2;i.readUshort(e,r);for(var s,l=["copyright","fontFamily","fontSubfamily","ID","fullName","version","postScriptName","trademark","manufacturer","designer","description","urlVendor","urlDesigner","licence","licenceURL","---","typoFamilyName","typoSubfamilyName","compatibleFull","sampleText","postScriptCID","wwsFamilyName","wwsSubfamilyName","lightPalette","darkPalette"],c=r+=2,u=0;u<o;u++){var h=i.readUshort(e,r);r+=2;var d=i.readUshort(e,r);r+=2;var p=i.readUshort(e,r);r+=2;var f=i.readUshort(e,r);r+=2;var m=i.readUshort(e,r);r+=2;var v=i.readUshort(e,r);r+=2;var g,y=l[f],x=c+12*o+v;if(0==h)g=i.readUnicode(e,x,m/2);else if(3==h&&0==d)g=i.readUnicode(e,x,m/2);else if(0==d)g=i.readASCII(e,x,m);else if(1==d)g=i.readUnicode(e,x,m/2);else if(3==d)g=i.readUnicode(e,x,m/2);else{if(1!=h)throw"unknown encoding "+d+", platformID: "+h;g=i.readASCII(e,x,m),console.log("reading unknown MAC encoding "+d+" as ASCII")}var b="p"+h+","+p.toString(16);null==a[b]&&(a[b]={}),a[b][y]=g,a[b]._lang=p}for(var A in a)if(null!=a[A].postScriptName&&1033==a[A]._lang)return a[A];for(var A in a)if(null!=a[A].postScriptName&&0==a[A]._lang)return a[A];for(var A in a)if(null!=a[A].postScriptName&&3084==a[A]._lang)return a[A];for(var A in a)if(null!=a[A].postScriptName)return a[A];for(var A in a){s=A;break}return console.log("returning name table with languageID "+a[s]._lang),a[s]},t["OS/2"]={},t["OS/2"].parse=function(e,r,n){var i=t._bin.readUshort(e,r);r+=2;var a={};if(0==i)t["OS/2"].version0(e,r,a);else if(1==i)t["OS/2"].version1(e,r,a);else if(2==i||3==i||4==i)t["OS/2"].version2(e,r,a);else{if(5!=i)throw"unknown OS/2 table version: "+i;t["OS/2"].version5(e,r,a)}return a},t["OS/2"].version0=function(e,r,n){var i=t._bin;return n.xAvgCharWidth=i.readShort(e,r),r+=2,n.usWeightClass=i.readUshort(e,r),r+=2,n.usWidthClass=i.readUshort(e,r),r+=2,n.fsType=i.readUshort(e,r),r+=2,n.ySubscriptXSize=i.readShort(e,r),r+=2,n.ySubscriptYSize=i.readShort(e,r),r+=2,n.ySubscriptXOffset=i.readShort(e,r),r+=2,n.ySubscriptYOffset=i.readShort(e,r),r+=2,n.ySuperscriptXSize=i.readShort(e,r),r+=2,n.ySuperscriptYSize=i.readShort(e,r),r+=2,n.ySuperscriptXOffset=i.readShort(e,r),r+=2,n.ySuperscriptYOffset=i.readShort(e,r),r+=2,n.yStrikeoutSize=i.readShort(e,r),r+=2,n.yStrikeoutPosition=i.readShort(e,r),r+=2,n.sFamilyClass=i.readShort(e,r),r+=2,n.panose=i.readBytes(e,r,10),r+=10,n.ulUnicodeRange1=i.readUint(e,r),r+=4,n.ulUnicodeRange2=i.readUint(e,r),r+=4,n.ulUnicodeRange3=i.readUint(e,r),r+=4,n.ulUnicodeRange4=i.readUint(e,r),r+=4,n.achVendID=[i.readInt8(e,r),i.readInt8(e,r+1),i.readInt8(e,r+2),i.readInt8(e,r+3)],r+=4,n.fsSelection=i.readUshort(e,r),r+=2,n.usFirstCharIndex=i.readUshort(e,r),r+=2,n.usLastCharIndex=i.readUshort(e,r),r+=2,n.sTypoAscender=i.readShort(e,r),r+=2,n.sTypoDescender=i.readShort(e,r),r+=2,n.sTypoLineGap=i.readShort(e,r),r+=2,n.usWinAscent=i.readUshort(e,r),r+=2,n.usWinDescent=i.readUshort(e,r),r+=2},t["OS/2"].version1=function(e,r,n){var i=t._bin;return r=t["OS/2"].version0(e,r,n),n.ulCodePageRange1=i.readUint(e,r),r+=4,n.ulCodePageRange2=i.readUint(e,r),r+=4},t["OS/2"].version2=function(e,r,n){var i=t._bin;return r=t["OS/2"].version1(e,r,n),n.sxHeight=i.readShort(e,r),r+=2,n.sCapHeight=i.readShort(e,r),r+=2,n.usDefault=i.readUshort(e,r),r+=2,n.usBreak=i.readUshort(e,r),r+=2,n.usMaxContext=i.readUshort(e,r),r+=2},t["OS/2"].version5=function(e,r,n){var i=t._bin;return r=t["OS/2"].version2(e,r,n),n.usLowerOpticalPointSize=i.readUshort(e,r),r+=2,n.usUpperOpticalPointSize=i.readUshort(e,r),r+=2},t.post={},t.post.parse=function(e,r,n){var i=t._bin,a={};return a.version=i.readFixed(e,r),r+=4,a.italicAngle=i.readFixed(e,r),r+=4,a.underlinePosition=i.readShort(e,r),r+=2,a.underlineThickness=i.readShort(e,r),r+=2,a},t.SVG={},t.SVG.parse=function(e,r,n){var i=t._bin,a={entries:[]},o=r;i.readUshort(e,r);r+=2;var s=i.readUint(e,r);r+=4;i.readUint(e,r);r+=4,r=s+o;var l=i.readUshort(e,r);r+=2;for(var c=0;c<l;c++){var u=i.readUshort(e,r);r+=2;var h=i.readUshort(e,r);r+=2;var d=i.readUint(e,r);r+=4;var p=i.readUint(e,r);r+=4;for(var f=new Uint8Array(e.buffer,o+d+s,p),m=i.readUTF8(f,0,f.length),v=u;v<=h;v++)a.entries[v]=m}return a},t.SVG.toPath=function(e){var r={cmds:[],crds:[]};if(null==e)return r;for(var n=(new DOMParser).parseFromString(e,"image/svg+xml").firstChild;"svg"!=n.tagName;)n=n.nextSibling;var i=n.getAttribute("viewBox");i=i?i.trim().split(" ").map(parseFloat):[0,0,1e3,1e3],t.SVG._toPath(n.children,r);for(var a=0;a<r.crds.length;a+=2){var o=r.crds[a],s=r.crds[a+1];o-=i[0],s=-(s-=i[1]),r.crds[a]=o,r.crds[a+1]=s}return r},t.SVG._toPath=function(e,r,n){for(var i=0;i<e.length;i++){var a=e[i],o=a.tagName,s=a.getAttribute("fill");if(null==s&&(s=n),"g"==o)t.SVG._toPath(a.children,r,s);else if("path"==o){r.cmds.push(s||"#000000");var l=a.getAttribute("d"),c=t.SVG._tokens(l);t.SVG._toksToPath(c,r),r.cmds.push("X")}else"defs"==o||console.log(o,a)}},t.SVG._tokens=function(e){for(var t=[],r=0,n=!1,i="";r<e.length;){var a=e.charCodeAt(r),o=e.charAt(r);r++;var s=48<=a&&a<=57||"."==o||"-"==o;n?"-"==o?(t.push(parseFloat(i)),i=o):s?i+=o:(t.push(parseFloat(i)),","!=o&&" "!=o&&t.push(o),n=!1):s?(i=o,n=!0):","!=o&&" "!=o&&t.push(o)}return n&&t.push(parseFloat(i)),t},t.SVG._toksToPath=function(e,r){for(var n=0,i=0,a=0,o=0,s=0,l={M:2,L:2,H:1,V:1,S:4,C:6},c=r.cmds,u=r.crds;n<e.length;){var h=e[n];if(n++,"z"==h)c.push("Z"),i=o,a=s;else for(var d=h.toUpperCase(),p=l[d],f=t.SVG._reps(e,n,p),m=0;m<f;m++){var v=0,g=0;if(h!=d&&(v=i,g=a),"M"==d)i=v+e[n++],a=g+e[n++],c.push("M"),u.push(i,a),o=i,s=a;else if("L"==d)i=v+e[n++],a=g+e[n++],c.push("L"),u.push(i,a);else if("H"==d)i=v+e[n++],c.push("L"),u.push(i,a);else if("V"==d)a=g+e[n++],c.push("L"),u.push(i,a);else if("C"==d){var y=v+e[n++],x=g+e[n++],b=v+e[n++],A=g+e[n++],w=v+e[n++],_=g+e[n++];c.push("C"),u.push(y,x,b,A,w,_),i=w,a=_}else if("S"==d){var M=Math.max(u.length-4,0);y=i+i-u[M],x=a+a-u[M+1],b=v+e[n++],A=g+e[n++],w=v+e[n++],_=g+e[n++];c.push("C"),u.push(y,x,b,A,w,_),i=w,a=_}else console.log("Unknown SVG command "+h)}}},t.SVG._reps=function(e,t,r){for(var n=t;n<e.length&&"string"!=typeof e[n];)n+=r;return(n-t)/r},null==t&&(t={}),null==t.U&&(t.U={}),t.U.codeToGlyph=function(e,t){var r=e.cmap,n=-1;if(null!=r.p0e4?n=r.p0e4:null!=r.p3e1?n=r.p3e1:null!=r.p1e0?n=r.p1e0:null!=r.p0e3&&(n=r.p0e3),-1==n)throw"no familiar platform and encoding!";var i=r.tables[n];if(0==i.format)return t>=i.map.length?0:i.map[t];if(4==i.format){for(var a=-1,o=0;o<i.endCount.length;o++)if(t<=i.endCount[o]){a=o;break}if(-1==a)return 0;if(i.startCount[a]>t)return 0;return 65535&(0!=i.idRangeOffset[a]?i.glyphIdArray[t-i.startCount[a]+(i.idRangeOffset[a]>>1)-(i.idRangeOffset.length-a)]:t+i.idDelta[a])}if(12==i.format){if(t>i.groups[i.groups.length-1][1])return 0;for(o=0;o<i.groups.length;o++){var s=i.groups[o];if(s[0]<=t&&t<=s[1])return s[2]+(t-s[0])}return 0}throw"unknown cmap table format "+i.format},t.U.glyphToPath=function(e,r){var n={cmds:[],crds:[]};if(e.SVG&&e.SVG.entries[r]){var i=e.SVG.entries[r];return null==i?n:("string"==typeof i&&(i=t.SVG.toPath(i),e.SVG.entries[r]=i),i)}if(e.CFF){var a={x:0,y:0,stack:[],nStems:0,haveWidth:!1,width:e.CFF.Private?e.CFF.Private.defaultWidthX:0,open:!1},o=e.CFF,s=e.CFF.Private;if(o.ROS){for(var l=0;o.FDSelect[l+2]<=r;)l+=2;s=o.FDArray[o.FDSelect[l+1]].Private}t.U._drawCFF(e.CFF.CharStrings[r],a,o,s,n)}else e.glyf&&t.U._drawGlyf(r,e,n);return n},t.U._drawGlyf=function(e,r,n){var i=r.glyf[e];null==i&&(i=r.glyf[e]=t.glyf._parseGlyf(r,e)),null!=i&&(i.noc>-1?t.U._simpleGlyph(i,n):t.U._compoGlyph(i,r,n))},t.U._simpleGlyph=function(e,r){for(var n=0;n<e.noc;n++){for(var i=0==n?0:e.endPts[n-1]+1,a=e.endPts[n],o=i;o<=a;o++){var s=o==i?a:o-1,l=o==a?i:o+1,c=1&e.flags[o],u=1&e.flags[s],h=1&e.flags[l],d=e.xs[o],p=e.ys[o];if(o==i)if(c){if(!u){t.U.P.moveTo(r,d,p);continue}t.U.P.moveTo(r,e.xs[s],e.ys[s])}else u?t.U.P.moveTo(r,e.xs[s],e.ys[s]):t.U.P.moveTo(r,(e.xs[s]+d)/2,(e.ys[s]+p)/2);c?u&&t.U.P.lineTo(r,d,p):h?t.U.P.qcurveTo(r,d,p,e.xs[l],e.ys[l]):t.U.P.qcurveTo(r,d,p,(d+e.xs[l])/2,(p+e.ys[l])/2)}t.U.P.closePath(r)}},t.U._compoGlyph=function(e,r,n){for(var i=0;i<e.parts.length;i++){var a={cmds:[],crds:[]},o=e.parts[i];t.U._drawGlyf(o.glyphIndex,r,a);for(var s=o.m,l=0;l<a.crds.length;l+=2){var c=a.crds[l],u=a.crds[l+1];n.crds.push(c*s.a+u*s.b+s.tx),n.crds.push(c*s.c+u*s.d+s.ty)}for(l=0;l<a.cmds.length;l++)n.cmds.push(a.cmds[l])}},t.U._getGlyphClass=function(e,r){var n=t._lctf.getInterval(r,e);return-1==n?0:r[n+2]},t.U.getPairAdjustment=function(e,r,n){if(e.GPOS)for(var i=e.GPOS,a=i.lookupList,o=i.featureList,s=[],l=0;l<o.length;l++){var c=o[l];if("kern"==c.tag)for(var u=0;u<c.tab.length;u++)if(!s[c.tab[u]]){s[c.tab[u]]=!0;for(var h=a[c.tab[u]],d=0;d<h.tabs.length;d++)if(null!=h.tabs[l]){var p,f=h.tabs[d];if(!f.coverage||-1!=(p=t._lctf.coverageIndex(f.coverage,r)))if(1==h.ltype);else if(2==h.ltype){var m;if(1==f.fmt){var v=f.pairsets[p];for(l=0;l<v.length;l++)v[l].gid2==n&&(m=v[l])}else if(2==f.fmt){var g=t.U._getGlyphClass(r,f.classDef1),y=t.U._getGlyphClass(n,f.classDef2);m=f.matrix[g][y]}if(m&&m.val2)return m.val2[2]}}}}if(e.kern){var x=e.kern.glyph1.indexOf(r);if(-1!=x){var b=e.kern.rval[x].glyph2.indexOf(n);if(-1!=b)return e.kern.rval[x].vals[b]}}return 0},t.U.stringToGlyphs=function(e,r){for(var n=[],i=0;i<r.length;i++){(a=r.codePointAt(i))>65535&&i++,n.push(t.U.codeToGlyph(e,a))}for(i=0;i<r.length;i++){var a;if(2367==(a=r.codePointAt(i))){var o=n[i-1];n[i-1]=n[i],n[i]=o}a>65535&&i++}var s=e.GSUB;if(null==s)return n;for(var l=s.lookupList,c=s.featureList,u=["rlig","liga","mset","isol","init","fina","medi","half","pres","blws"],h=[],d=0;d<c.length;d++){var p=c[d];if(-1!=u.indexOf(p.tag))for(var f=0;f<p.tab.length;f++)if(!h[p.tab[f]]){h[p.tab[f]]=!0;for(var m=l[p.tab[f]],v=0;v<n.length;v++){var g=t.U._getWPfeature(r,v);-1!="isol,init,fina,medi".indexOf(p.tag)&&p.tag!=g||t.U._applySubs(n,v,m,l)}}}return n},t.U._getWPfeature=function(e,t){var r='\n\t" ,.:;!?() ،',n="آأؤإاةدذرزوٱٲٳٵٶٷڈډڊڋڌڍڎڏڐڑڒړڔڕږڗژڙۀۃۄۅۆۇۈۉۊۋۍۏےۓەۮۯܐܕܖܗܘܙܞܨܪܬܯݍݙݚݛݫݬݱݳݴݸݹࡀࡆࡇࡉࡔࡧࡩࡪࢪࢫࢬࢮࢱࢲࢹૅેૉૐૡ૯ஃஅஉஎஏனப",i=0==t||-1!=r.indexOf(e[t-1]),a=t==e.length-1||-1!=r.indexOf(e[t+1]);i||-1==n.indexOf(e[t-1])||(i=!0),a||-1==n.indexOf(e[t])||(a=!0),a||-1=="ꡲ્".indexOf(e[t+1])||(a=!0),i||-1=="ꡲ્".indexOf(e[t])||(i=!0);return i?a?"isol":"init":a?"fina":"medi"},t.U._applySubs=function(e,r,n,i){for(var a=e.length-r-1,o=0;o<n.tabs.length;o++)if(null!=n.tabs[o]){var s,l=n.tabs[o];if(!l.coverage||-1!=(s=t._lctf.coverageIndex(l.coverage,e[r])))if(1==n.ltype){e[r];1==l.fmt?e[r]=e[r]+l.delta:e[r]=l.newg[s]}else if(4==n.ltype)for(var c=l.vals[s],u=0;u<c.length;u++){var h=c[u],d=h.chain.length;if(!(d>a)){for(var p=!0,f=0,m=0;m<d;m++){for(;-1==e[r+f+(1+m)];)f++;h.chain[m]!=e[r+f+(1+m)]&&(p=!1)}if(p){e[r]=h.nglyph;for(m=0;m<d+f;m++)e[r+m+1]=-1;break}}}else if(5==n.ltype&&2==l.fmt)for(var v=t._lctf.getInterval(l.cDef,e[r]),g=l.cDef[v+2],y=l.scset[g],x=0;x<y.length;x++){var b=y[x],A=b.input;if(!(A.length>a)){for(p=!0,m=0;m<A.length;m++){var w=t._lctf.getInterval(l.cDef,e[r+1+m]);if(-1==v&&l.cDef[w+2]!=A[m]){p=!1;break}}if(p){var _=b.substLookupRecords;for(u=0;u<_.length;u+=2)_[u],_[u+1]}}}else if(6==n.ltype&&3==l.fmt){if(!t.U._glsCovered(e,l.backCvg,r-l.backCvg.length))continue;if(!t.U._glsCovered(e,l.inptCvg,r))continue;if(!t.U._glsCovered(e,l.ahedCvg,r+l.inptCvg.length))continue;var M=l.lookupRec;for(x=0;x<M.length;x+=2){v=M[x];var S=i[M[x+1]];t.U._applySubs(e,r+v,S,i)}}}},t.U._glsCovered=function(e,r,n){for(var i=0;i<r.length;i++){if(-1==t._lctf.coverageIndex(r[i],e[n+i]))return!1}return!0},t.U.glyphsToPath=function(e,r,n){for(var i={cmds:[],crds:[]},a=0,o=0;o<r.length;o++){var s=r[o];if(-1!=s){for(var l=o<r.length-1&&-1!=r[o+1]?r[o+1]:0,c=t.U.glyphToPath(e,s),u=0;u<c.crds.length;u+=2)i.crds.push(c.crds[u]+a),i.crds.push(c.crds[u+1]);n&&i.cmds.push(n);for(u=0;u<c.cmds.length;u++)i.cmds.push(c.cmds[u]);n&&i.cmds.push("X"),a+=e.hmtx.aWidth[s],o<r.length-1&&(a+=t.U.getPairAdjustment(e,s,l))}}return i},t.U.pathToSVG=function(e,t){null==t&&(t=5);for(var r=[],n=0,i={M:2,L:2,Q:4,C:6},a=0;a<e.cmds.length;a++){var o=e.cmds[a],s=n+(i[o]?i[o]:0);for(r.push(o);n<s;){var l=e.crds[n++];r.push(parseFloat(l.toFixed(t))+(n==s?"":" "))}}return r.join("")},t.U.pathToContext=function(e,t){for(var r=0,n=e.crds,i=0;i<e.cmds.length;i++){var a=e.cmds[i];"M"==a?(t.moveTo(n[r],n[r+1]),r+=2):"L"==a?(t.lineTo(n[r],n[r+1]),r+=2):"C"==a?(t.bezierCurveTo(n[r],n[r+1],n[r+2],n[r+3],n[r+4],n[r+5]),r+=6):"Q"==a?(t.quadraticCurveTo(n[r],n[r+1],n[r+2],n[r+3]),r+=4):"#"==a.charAt(0)?(t.beginPath(),t.fillStyle=a):"Z"==a?t.closePath():"X"==a&&t.fill()}},t.U.P={},t.U.P.moveTo=function(e,t,r){e.cmds.push("M"),e.crds.push(t,r)},t.U.P.lineTo=function(e,t,r){e.cmds.push("L"),e.crds.push(t,r)},t.U.P.curveTo=function(e,t,r,n,i,a,o){e.cmds.push("C"),e.crds.push(t,r,n,i,a,o)},t.U.P.qcurveTo=function(e,t,r,n,i){e.cmds.push("Q"),e.crds.push(t,r,n,i)},t.U.P.closePath=function(e){e.cmds.push("Z")},t.U._drawCFF=function(e,r,n,i,a){for(var o=r.stack,s=r.nStems,l=r.haveWidth,c=r.width,u=r.open,h=0,d=r.x,p=r.y,f=0,m=0,v=0,g=0,y=0,x=0,b=0,A=0,w=0,_=0,M={val:0,size:0};h<e.length;){t.CFF.getCharString(e,h,M);var S=M.val;if(h+=M.size,"o1"==S||"o18"==S)o.length%2!=0&&!l&&(c=o.shift()+i.nominalWidthX),s+=o.length>>1,o.length=0,l=!0;else if("o3"==S||"o23"==S){o.length%2!=0&&!l&&(c=o.shift()+i.nominalWidthX),s+=o.length>>1,o.length=0,l=!0}else if("o4"==S)o.length>1&&!l&&(c=o.shift()+i.nominalWidthX,l=!0),u&&t.U.P.closePath(a),p+=o.pop(),t.U.P.moveTo(a,d,p),u=!0;else if("o5"==S)for(;o.length>0;)d+=o.shift(),p+=o.shift(),t.U.P.lineTo(a,d,p);else if("o6"==S||"o7"==S)for(var E=o.length,T="o6"==S,R=0;R<E;R++){var L=o.shift();T?d+=L:p+=L,T=!T,t.U.P.lineTo(a,d,p)}else if("o8"==S||"o24"==S){E=o.length;for(var C=0;C+6<=E;)f=d+o.shift(),m=p+o.shift(),v=f+o.shift(),g=m+o.shift(),d=v+o.shift(),p=g+o.shift(),t.U.P.curveTo(a,f,m,v,g,d,p),C+=6;"o24"==S&&(d+=o.shift(),p+=o.shift(),t.U.P.lineTo(a,d,p))}else{if("o11"==S)break;if("o1234"==S||"o1235"==S||"o1236"==S||"o1237"==S)"o1234"==S&&(m=p,v=(f=d+o.shift())+o.shift(),_=g=m+o.shift(),x=g,A=p,d=(b=(y=(w=v+o.shift())+o.shift())+o.shift())+o.shift(),t.U.P.curveTo(a,f,m,v,g,w,_),t.U.P.curveTo(a,y,x,b,A,d,p)),"o1235"==S&&(f=d+o.shift(),m=p+o.shift(),v=f+o.shift(),g=m+o.shift(),w=v+o.shift(),_=g+o.shift(),y=w+o.shift(),x=_+o.shift(),b=y+o.shift(),A=x+o.shift(),d=b+o.shift(),p=A+o.shift(),o.shift(),t.U.P.curveTo(a,f,m,v,g,w,_),t.U.P.curveTo(a,y,x,b,A,d,p)),"o1236"==S&&(f=d+o.shift(),m=p+o.shift(),v=f+o.shift(),_=g=m+o.shift(),x=g,b=(y=(w=v+o.shift())+o.shift())+o.shift(),A=x+o.shift(),d=b+o.shift(),t.U.P.curveTo(a,f,m,v,g,w,_),t.U.P.curveTo(a,y,x,b,A,d,p)),"o1237"==S&&(f=d+o.shift(),m=p+o.shift(),v=f+o.shift(),g=m+o.shift(),w=v+o.shift(),_=g+o.shift(),y=w+o.shift(),x=_+o.shift(),b=y+o.shift(),A=x+o.shift(),Math.abs(b-d)>Math.abs(A-p)?d=b+o.shift():p=A+o.shift(),t.U.P.curveTo(a,f,m,v,g,w,_),t.U.P.curveTo(a,y,x,b,A,d,p));else if("o14"==S){if(o.length>0&&!l&&(c=o.shift()+n.nominalWidthX,l=!0),4==o.length){var P=o.shift(),D=o.shift(),I=o.shift(),O=o.shift(),B=t.CFF.glyphBySE(n,I),F=t.CFF.glyphBySE(n,O);t.U._drawCFF(n.CharStrings[B],r,n,i,a),r.x=P,r.y=D,t.U._drawCFF(n.CharStrings[F],r,n,i,a)}u&&(t.U.P.closePath(a),u=!1)}else if("o19"==S||"o20"==S){o.length%2!=0&&!l&&(c=o.shift()+i.nominalWidthX),s+=o.length>>1,o.length=0,l=!0,h+=s+7>>3}else if("o21"==S)o.length>2&&!l&&(c=o.shift()+i.nominalWidthX,l=!0),p+=o.pop(),d+=o.pop(),u&&t.U.P.closePath(a),t.U.P.moveTo(a,d,p),u=!0;else if("o22"==S)o.length>1&&!l&&(c=o.shift()+i.nominalWidthX,l=!0),d+=o.pop(),u&&t.U.P.closePath(a),t.U.P.moveTo(a,d,p),u=!0;else if("o25"==S){for(;o.length>6;)d+=o.shift(),p+=o.shift(),t.U.P.lineTo(a,d,p);f=d+o.shift(),m=p+o.shift(),v=f+o.shift(),g=m+o.shift(),d=v+o.shift(),p=g+o.shift(),t.U.P.curveTo(a,f,m,v,g,d,p)}else if("o26"==S)for(o.length%2&&(d+=o.shift());o.length>0;)f=d,m=p+o.shift(),d=v=f+o.shift(),p=(g=m+o.shift())+o.shift(),t.U.P.curveTo(a,f,m,v,g,d,p);else if("o27"==S)for(o.length%2&&(p+=o.shift());o.length>0;)m=p,v=(f=d+o.shift())+o.shift(),g=m+o.shift(),d=v+o.shift(),p=g,t.U.P.curveTo(a,f,m,v,g,d,p);else if("o10"==S||"o29"==S){var U="o10"==S?i:n;if(0==o.length)console.log("error: empty stack");else{var N=o.pop(),G=U.Subrs[N+U.Bias];r.x=d,r.y=p,r.nStems=s,r.haveWidth=l,r.width=c,r.open=u,t.U._drawCFF(G,r,n,i,a),d=r.x,p=r.y,s=r.nStems,l=r.haveWidth,c=r.width,u=r.open}}else if("o30"==S||"o31"==S){var z=o.length,k=(C=0,"o31"==S);for(C+=z-(E=-3&z);C<E;)k?(m=p,v=(f=d+o.shift())+o.shift(),p=(g=m+o.shift())+o.shift(),E-C==5?(d=v+o.shift(),C++):d=v,k=!1):(f=d,m=p+o.shift(),v=f+o.shift(),g=m+o.shift(),d=v+o.shift(),E-C==5?(p=g+o.shift(),C++):p=g,k=!0),t.U.P.curveTo(a,f,m,v,g,d,p),C+=4}else{if("o"==(S+"").charAt(0))throw console.log("Unknown operation: "+S,e),S;o.push(S)}}}r.x=d,r.y=p,r.nStems=s,r.haveWidth=l,r.width=c,r.open=u},t},function(){var e=function(){var e={},t=0,r=-3;function n(){this.table=new Uint16Array(16),this.trans=new Uint16Array(288)}function i(e,t){this.source=e,this.sourceIndex=0,this.tag=0,this.bitcount=0,this.dest=t,this.destLen=0,this.ltree=new n,this.dtree=new n}var a=new n,o=new n,s=new Uint8Array(30),l=new Uint16Array(30),c=new Uint8Array(30),u=new Uint16Array(30),h=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),d=new n,p=new Uint8Array(320);function f(e,t,r,n){var i,a;for(i=0;i<r;++i)e[i]=0;for(i=0;i<30-r;++i)e[i+r]=i/r|0;for(a=n,i=0;i<30;++i)t[i]=a,a+=1<<e[i]}var m=new Uint16Array(16);function v(e,t,r,n){var i,a;for(i=0;i<16;++i)e.table[i]=0;for(i=0;i<n;++i)e.table[t[r+i]]++;for(e.table[0]=0,a=0,i=0;i<16;++i)m[i]=a,a+=e.table[i];for(i=0;i<n;++i)t[r+i]&&(e.trans[m[t[r+i]]++]=i)}function g(e){e.bitcount--||(e.tag=e.source[e.sourceIndex++],e.bitcount=7);var t=1&e.tag;return e.tag>>>=1,t}function y(e,t,r){if(!t)return r;for(;e.bitcount<24;)e.tag|=e.source[e.sourceIndex++]<<e.bitcount,e.bitcount+=8;var n=e.tag&65535>>>16-t;return e.tag>>>=t,e.bitcount-=t,n+r}function x(e,t){for(;e.bitcount<24;)e.tag|=e.source[e.sourceIndex++]<<e.bitcount,e.bitcount+=8;var r=0,n=0,i=0,a=e.tag;do{n=2*n+(1&a),a>>>=1,++i,r+=t.table[i],n-=t.table[i]}while(n>=0);return e.tag=a,e.bitcount-=i,t.trans[r+n]}function b(e,t,r){var n,i,a,o,s,l;for(n=y(e,5,257),i=y(e,5,1),a=y(e,4,4),o=0;o<19;++o)p[o]=0;for(o=0;o<a;++o){var c=y(e,3,0);p[h[o]]=c}for(v(d,p,0,19),s=0;s<n+i;){var u=x(e,d);switch(u){case 16:var f=p[s-1];for(l=y(e,2,3);l;--l)p[s++]=f;break;case 17:for(l=y(e,3,3);l;--l)p[s++]=0;break;case 18:for(l=y(e,7,11);l;--l)p[s++]=0;break;default:p[s++]=u}}v(t,p,0,n),v(r,p,n,i)}function A(e,r,n){for(;;){var i,a,o,h,d=x(e,r);if(256===d)return t;if(d<256)e.dest[e.destLen++]=d;else for(i=y(e,s[d-=257],l[d]),a=x(e,n),h=o=e.destLen-y(e,c[a],u[a]);h<o+i;++h)e.dest[e.destLen++]=e.dest[h]}}function w(e){for(var n,i;e.bitcount>8;)e.sourceIndex--,e.bitcount-=8;if((n=256*(n=e.source[e.sourceIndex+1])+e.source[e.sourceIndex])!==(65535&~(256*e.source[e.sourceIndex+3]+e.source[e.sourceIndex+2])))return r;for(e.sourceIndex+=4,i=n;i;--i)e.dest[e.destLen++]=e.source[e.sourceIndex++];return e.bitcount=0,t}return function(e,t){var r;for(r=0;r<7;++r)e.table[r]=0;for(e.table[7]=24,e.table[8]=152,e.table[9]=112,r=0;r<24;++r)e.trans[r]=256+r;for(r=0;r<144;++r)e.trans[24+r]=r;for(r=0;r<8;++r)e.trans[168+r]=280+r;for(r=0;r<112;++r)e.trans[176+r]=144+r;for(r=0;r<5;++r)t.table[r]=0;for(t.table[5]=32,r=0;r<32;++r)t.trans[r]=r}(a,o),f(s,l,4,3),f(c,u,2,1),s[28]=0,l[28]=258,e.exports=function(e,n){var s,l,c=new i(e,n);do{switch(s=g(c),y(c,2,0)){case 0:l=w(c);break;case 1:l=A(c,a,o);break;case 2:b(c,c.ltree,c.dtree),l=A(c,c.ltree,c.dtree);break;default:l=r}if(l!==t)throw new Error("Data error")}while(!s);return c.destLen<c.dest.length?"function"==typeof c.dest.slice?c.dest.slice(0,c.destLen):c.dest.subarray(0,c.destLen):c.dest},e.exports}();return function(t){return function(e,t){var r=new DataView(e),n=0;function i(){var e=r.getUint16(n);return n+=2,e}function a(){var e=r.getUint32(n);return n+=4,e}function o(e){y.setUint16(x,e),x+=2}function s(e){y.setUint32(x,e),x+=4}for(var l={signature:a(),flavor:a(),length:a(),numTables:i(),reserved:i(),totalSfntSize:a(),majorVersion:i(),minorVersion:i(),metaOffset:a(),metaLength:a(),metaOrigLength:a(),privOffset:a(),privLength:a()},c=0;Math.pow(2,c)<=l.numTables;)c++;c--;for(var u=16*Math.pow(2,c),h=16*l.numTables-u,d=12,p=[],f=0;f<l.numTables;f++)p.push({tag:a(),offset:a(),compLength:a(),origLength:a(),origChecksum:a()}),d+=16;var m,v=new Uint8Array(12+16*p.length+p.reduce((function(e,t){return e+t.origLength+4}),0)),g=v.buffer,y=new DataView(g),x=0;return s(l.flavor),o(l.numTables),o(u),o(c),o(h),p.forEach((function(e){s(e.tag),s(e.origChecksum),s(d),s(e.origLength),e.outOffset=d,(d+=e.origLength)%4!=0&&(d+=4-d%4)})),p.forEach((function(r){var n=e.slice(r.offset,r.offset+r.compLength);if(r.compLength!=r.origLength){var i=new Uint8Array(r.origLength);t(new Uint8Array(n,2),i)}else i=new Uint8Array(n);v.set(i,r.outOffset);var a=0;(d=r.outOffset+r.origLength)%4!=0&&(a=4-d%4),v.set(new Uint8Array(a).buffer,r.outOffset+r.origLength),m=d+a})),g.slice(0,m)}(t,e)}},function(e,t){var r={M:2,L:2,Q:4,C:6,Z:0};return function(n){var i,a,o,s,l=new Uint8Array(n,0,4),c=e._bin.readASCII(l,0,4);if("wOFF"===c)n=t(n);else if("wOF2"===c)throw new Error("woff2 fonts not supported");return i=e.parse(n),a=i[0],o=Object.create(null),s={unitsPerEm:a.head.unitsPerEm,ascender:a.hhea.ascender,descender:a.hhea.descender,forEachGlyph:function(t,n,i,l){var c=0,u=1/s.unitsPerEm*n,h=e.U.stringToGlyphs(a,t),d=0;return h.forEach((function(s){if(-1!==s){var h=o[s];if(!h){var p=e.glyf._parseGlyf(a,s)||{xMin:0,xMax:0,yMin:0,yMax:0},f=e.U.glyphToPath(a,s),m=f.cmds,v=f.crds;h=o[s]={index:s,advanceWidth:a.hmtx.aWidth[s],xMin:p.xMin,yMin:p.yMin,xMax:p.xMax,yMax:p.yMax,pathCommandCount:m.length,forEachPathCommand:function(e){for(var t=0,n=[],i=0,a=m.length;i<a;i++){var o=r[m[i]];n.length=1+o,n[0]=m[i];for(var s=1;s<=o;s++)n[s]=v[t++];e.apply(null,n)}}}}l.call(null,h,c,d),h.advanceWidth&&(c+=h.advanceWidth*u),i&&(c+=i*n)}d+=t.codePointAt(d)>65535?2:1})),c}}}}],init:function(e,t,r){return r(e(),t())}}),M={defaultFontURL:"https://fonts.gstatic.com/s/roboto/v18/KFOmCnqEu92Fr1Mu4mxM.woff",sdfGlyphSize:64,textureWidth:2048},S=document.createElement("a");var E=1/8,T=Object.create(null);function R(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r]);return e}var L=Object(A.defineWorkerModule)({dependencies:[M,E,_,function(e){var t=e.sdfTextureSize,r=e.sdfDistancePercent,n=16;function i(e,t,r,n,i,a,o){var s=1-o;return{x:s*s*e+2*s*o*r+o*o*i,y:s*s*t+2*s*o*n+o*o*a}}function a(e,t,r,n,i,a,o,s,l){var c=1-l;return{x:c*c*c*e+3*c*c*l*r+3*c*l*l*i+l*l*l*o,y:c*c*c*t+3*c*c*l*n+3*c*l*l*a+l*l*l*s}}function o(e){return e*e}function s(e,t,r,n,i,a){var s=i-r,l=a-n,c=o(s)+o(l),u=c?Math.max(0,Math.min(1,((e-r)*s+(t-n)*l)/c)):0;return Math.sqrt(o(e-(r+u*s))+o(t-(n+u*l)))}var l=function(e){var t=e.xMin,r=e.yMin,n=e.xMax-t,i=e.yMax-r,a=Math.round(t+n/2),o=Math.round(r+i/2),s=Math.pow(2,Math.floor(Math.log(Math.max(n,i))*Math.LOG2E));this._root={0:null,1:null,2:null,3:null,data:null,cx:a,cy:o,r:s,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0}};return l.prototype.addLineSegment=function(e,t,r,n){var i={x0:e,y0:t,x1:r,y1:n,cx:(e+r)/2,cy:(t+n)/2,minX:Math.min(e,r),minY:Math.min(t,n),maxX:Math.max(e,r),maxY:Math.max(t,n),next:null};this._insertSegment(i,this._root)},l.prototype._insertSegment=function(e,t){var r=e.minX,n=e.minY,i=e.maxX,a=e.maxY,o=e.cx,s=e.cy;r<t.minX&&(t.minX=r),n<t.minY&&(t.minY=n),i>t.maxX&&(t.maxX=i),a>t.maxY&&(t.maxY=a);var l=t.data;if(l)if(l.cx===o&&l.cy===s){for(;l.next;)l=l.next;l.next=e}else t.data=null,this._insertSegment(l,t),this._insertSegment(e,t);else{var c=(s<t.cy?0:2)+(o<t.cx?0:1);t[c]?this._insertSegment(e,t[c]):t[c]={0:null,1:null,2:null,3:null,data:e,cx:t.cx+t.r/2*(c%2?1:-1),cy:t.cy+t.r/2*(c<2?-1:1),r:t.r/2,minX:r,minY:n,maxX:i,maxY:a}}},l.prototype.walkTree=function(e){this.walkBranch(this._root,e)},l.prototype.walkBranch=function(e,t){if(!1!==t(e)&&!e.data)for(var r=0;r<4;r++)null!==e[r]&&this.walkBranch(e[r],t)},l.prototype.findNearestSignedDistance=function(e,t,r){var n=r;return this.walkTree((function(r){if(e-n>r.maxX||e+n<r.minX||t-n>r.maxY||t+n<r.minY)return!1;if(r.data)for(var i=r.data;i;i=i.next)if(e-n<i.maxX||e+n>i.minX||t-n<i.maxY||t+n>i.minY){var a=s(e,t,i.x0,i.y0,i.x1,i.y1);a<n&&(n=a)}})),this.isPointInPoly(e,t)||(n=-n),n},l.prototype.isPointInPoly=function(e,t){var r=!1;return this.walkTree((function(n){if(n.maxX<e||n.minY>t||n.maxY<t)return!1;if(n.data)for(var i=n.data;i;i=i.next){var a=i.x0,o=i.y0,s=i.x1,l=i.y1;o>t!=l>t&&e<(s-a)*(t-o)/(l-o)+a&&(r=!r)}})),r},function(e){var s=new Uint8Array(o(t)),c=e.xMax-e.xMin,u=e.yMax-e.yMin,h=Math.max(c,u)*r,d=(c+2*h)/t,p=(u+2*h)/t,f=e.xMin-h-d,m=e.yMin-h-p,v=e.xMax+h+d,g=e.yMax+h+p;if(e.pathCommandCount){var y,x,b,A,w=new l(e);e.forEachPathCommand((function(e,t,r,o,s,l,c){switch(e){case"M":b=y=t,A=x=r;break;case"L":t===b&&r===A||w.addLineSegment(b,A,b=t,A=r);break;case"Q":for(var u={x:b,y:A},h=1;h<n;h++){var d=i(b,A,t,r,o,s,h/(n-1));w.addLineSegment(u.x,u.y,d.x,d.y),u=d}b=o,A=s;break;case"C":for(var p={x:b,y:A},f=1;f<n;f++){var m=a(b,A,t,r,o,s,l,c,f/(n-1));w.addLineSegment(p.x,p.y,m.x,m.y),p=m}b=l,A=c;break;case"Z":b===y&&A===x||w.addLineSegment(b,A,y,x)}}));for(var _=0;_<t;_++)for(var M=0;M<t;M++){var S=w.findNearestSignedDistance(f+(v-f)*(_+.5)/t,m+(g-m)*(M+.5)/t,h),E=isFinite(S)?Math.round(255*(1+S/h)*.5):S;E=Math.max(0,Math.min(255,E)),s[M*t+_]=E}}return{textureData:s,renderingBounds:[f,m,v,g]}}},function(e,t,r){var n=r.defaultFontUrl,i=Object.create(null),a=1/0;function o(t,r){t||(t=n);var a=i[t];if(a)a.onload?a.onload.push(r):r();else{var o=i[t]={onload:[r]};!function(t,r){!function i(){var a=function(e){console.error("Failure loading font "+t+(t===n?"":"; trying fallback"),e),t!==n&&(t=n,i())};try{var o=new XMLHttpRequest;o.open("get",t,!0),o.responseType="arraybuffer",o.onload=function(){if(o.status>=400)a(new Error(o.statusText));else if(o.status>0)try{var t=e(o.response);r(t)}catch(e){a(e)}},o.onerror=a,o.send()}catch(e){a(e)}}()}(t,(function(e){a=i[t]={fontObj:e,glyphs:{},glyphCount:0},o.onload.forEach((function(e){return e()}))}))}}function s(e,r,s){var l=e.text;void 0===l&&(l="");var c=e.font;void 0===c&&(c=n);var u=e.fontSize;void 0===u&&(u=1);var h=e.letterSpacing;void 0===h&&(h=0);var d=e.lineHeight;void 0===d&&(d="normal");var p=e.maxWidth;void 0===p&&(p=a);var f=e.textAlign;void 0===f&&(f="left");var m=e.whiteSpace;void 0===m&&(m="normal");var v=e.overflowWrap;void 0===v&&(v="normal");var g=e.anchor,y=e.includeCaretPositions;void 0===y&&(y=!1),void 0===s&&(s=!1),l.indexOf("\r")>-1&&(console.warn("FontProcessor.process: got text with \\r chars; normalizing to \\n"),l=l.replace(/\r\n/g,"\n").replace(/\r/g,"\n")),function(e,t){e||(e=n),o(e,(function(){t(i[e])}))}(c,(function(e){var n=e.fontObj,i=isFinite(p),o=null,c=null,x=null,b=null,A=null,w=0,_="nowrap"!==m,M=n.ascender,S=n.descender,E=n.unitsPerEm,T=u/E;"normal"===d&&(d=(M-S)/E);var R=((d*=u)-(M-S)*T)/2,L=Math.min(d,(M-S)*T),C=(M+S)/2*T-L/2,P=0,D={glyphs:[],width:0},I=[D];if(n.forEachGlyph(l,u,h,(function(e,t,r){var n,a=l.charAt(r),o=e.advanceWidth*T,s=!!a&&/\s/.test(a),c=D.glyphs;if(_&&i&&!s&&t+o+P>p&&c.length){if(c[c.length-1].isWhitespace)n=[],P=-t;else for(var u=c.length;u--;){if(0===u&&"break-word"===v){n=[],P=-t;break}if(c[u].isWhitespace){var h=(n=c.splice(u+1))[0].x;P-=h;for(var d=0;d<n.length;d++)n[d].x-=h;break}}n&&(D.isSoftWrapped=!0,D={glyphs:n,width:0},I.push(D),w=p)}D.glyphs.push({glyphObj:e,x:t+P,y:0,width:o,char:a,charIndex:r,isWhitespace:s,isEmpty:e.xMin===e.xMax||e.yMin===e.yMax,atlasInfo:null}),"\n"===a&&(D={glyphs:[],width:0},I.push(D),P=-(t+o))})),I.forEach((function(e){for(var t=e.glyphs,r=t.length;r--;){var n=t[r];if(!n.isWhitespace)return e.width=n.x+n.width,void(e.width>w&&(w=e.width))}})),!s){var O=[],B=-(u+R);y&&(b=new Float32Array(3*l.length));var F=-1;I.forEach((function(r){var n=r.glyphs,i=r.width;if(n.length){var a=0,s=0;if("center"===f)a=(w-i)/2;else if("right"===f)a=w-i;else if("justify"===f)for(var l=n.length;l--;)if(!n[l].isWhitespace){for(;l--;)n[l].isWhitespace&&s++;break}for(var c=0,u=n.length;c<u;c++){var h=n[c];if(a&&(h.x+=a),h.y=B,h.isWhitespace&&"justify"===f&&r.isSoftWrapped){var p=(w-i)/s;a+=p,h.width+=p}if(y){var m=h.charIndex;for(b[3*m]=h.x,b[3*m+1]=h.x+h.width,b[3*m+2]=h.y+C;m-F>1;)b[3*(F+1)]=b[3*F+1],b[3*(F+1)+1]=b[3*F+1],b[3*(F+1)+2]=b[3*F+2],F++;F=m}if(!h.isWhitespace&&!h.isEmpty){var v=h.glyphObj,g=e.glyphs[v.index];if(!g){var x=t(v);x.atlasIndex=e.glyphCount++,o||(o=[]),o.push(x),g=e.glyphs[v.index]={atlasIndex:x.atlasIndex,glyphObj:v,renderingBounds:x.renderingBounds}}h.atlasInfo=g,O.push(h)}}}B-=d}));var U=0,N=0;if(g&&(g[0]&&(U=-w*g[0]),g[1]&&(N=I.length*d*g[1])),y&&(U||N))for(var G=0,z=b.length;G<z;G+=3)b[G]+=U,b[G+1]+=U,b[G+2]+=N;c=new Float32Array(4*O.length),x=new Float32Array(O.length),A=[a,a,-a,-a],O.forEach((function(e,t){var r=e.atlasInfo,n=r.renderingBounds,i=r.atlasIndex,a=c[4*t]=e.x+n[0]*T+U,o=c[4*t+1]=e.y+n[1]*T+N,s=c[4*t+2]=e.x+n[2]*T+U,l=c[4*t+3]=e.y+n[3]*T+N;a<A[0]&&(A[0]=a),o<A[1]&&(A[1]=o),s>A[2]&&(A[2]=s),l>A[3]&&(A[3]=l),x[t]=i}))}r({glyphBounds:c,glyphAtlasIndices:x,caretPositions:b,caretHeight:L,totalBounds:A,totalBlockSize:[w,I.length*d],newGlyphSDFs:o})}))}return{process:s,measure:function(e,t){s(e,(function(e){t({width:e.totalBlockSize[0],height:e.totalBlockSize[1]})}),{metricsOnly:!0})},loadFont:o}}],init:function(e,t,r,n,i){return i(r,n({sdfTextureSize:e.sdfGlyphSize,sdfDistancePercent:t}),{defaultFontUrl:e.defaultFontURL})}}),C=Object(A.defineWorkerModule)({dependencies:[L,A.ThenableWorkerModule],init:function(e,t){return function(r){var n=new t;return e.process(r,n.resolve),n}},getTransferables:function(e){var t=[e.glyphBounds.buffer,e.glyphAtlasIndices.buffer];return e.caretPositions&&t.push(e.caretPositions.buffer),e.newGlyphSDFs&&e.newGlyphSDFs.forEach((function(e){t.push(e.textureData.buffer)})),t}}),P=new c.PlaneBufferGeometry(1,1).translate(.5,.5,0),D=new c.Vector3,I=function(e){function t(){e.call(this),this.copy(P),this.boundingSphere=new c.Sphere}return e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t,t.prototype.computeBoundingSphere=function(){},t.prototype.updateGlyphs=function(e,t,r){O(this,"aTroikaGlyphBounds",e,4),O(this,"aTroikaGlyphIndex",t,1),this.maxInstancedCount=t.length;var n=this.boundingSphere;n.center.set((r[0]+r[2])/2,(r[1]+r[3])/2,0),n.radius=n.center.distanceTo(D.set(r[0],r[1],0))},t}(c.InstancedBufferGeometry);function O(e,t,r,n){var i=e.getAttribute(t);i&&i.array.length===r.length?(i.array.set(r),i.needsUpdate=!0):e.setAttribute(t,new c.InstancedBufferAttribute(r,n))}I.prototype.setAttribute||(I.prototype.setAttribute=function(e,t){return this.attributes[e]=t,this});var B="\nuniform vec2 uTroikaSDFTextureSize;\nuniform float uTroikaSDFGlyphSize;\nuniform vec4 uTroikaTotalBounds;\nattribute vec4 aTroikaGlyphBounds;\nattribute float aTroikaGlyphIndex;\nvarying vec2 vTroikaSDFTextureUV;\nvarying vec2 vTroikaGlyphUV;\nvarying vec3 vTroikaLocalPos;\n",F="\nvTroikaGlyphUV = vec2(position);\n\nvec2 colsAndRows = uTroikaSDFTextureSize / uTroikaSDFGlyphSize;\nvTroikaSDFTextureUV = vec2(\n mod(aTroikaGlyphIndex, colsAndRows.x) + position.x,\n floor(aTroikaGlyphIndex / colsAndRows.x) + position.y\n) * uTroikaSDFGlyphSize / uTroikaSDFTextureSize;\n\nposition = vec3(\n mix(aTroikaGlyphBounds.x, aTroikaGlyphBounds.z, position.x),\n mix(aTroikaGlyphBounds.y, aTroikaGlyphBounds.w, position.y),\n position.z\n);\nvTroikaLocalPos = vec3(position);\n\nuv = vec2(\n (position.x - uTroikaTotalBounds.x) / (uTroikaTotalBounds.z - uTroikaTotalBounds.x),\n (position.y - uTroikaTotalBounds.y) / (uTroikaTotalBounds.w - uTroikaTotalBounds.y)\n);\n",U="\nuniform sampler2D uTroikaSDFTexture;\nuniform float uTroikaSDFMinDistancePct;\nuniform bool uTroikaSDFDebug;\nuniform vec4 uTroikaClipRect;\nvarying vec2 vTroikaSDFTextureUV;\nvarying vec2 vTroikaGlyphUV;\nvarying vec3 vTroikaLocalPos;\n\nfloat troikaGetClipAlpha() {\n vec4 clip = uTroikaClipRect;\n vec3 pos = vTroikaLocalPos;\n float dClip = min(\n min(pos.x - min(clip.x, clip.z), max(clip.x, clip.z) - pos.x),\n min(pos.y - min(clip.y, clip.w), max(clip.y, clip.w) - pos.y)\n );\n #if defined(GL_OES_standard_derivatives) || __VERSION__ >= 300\n float aa = length(fwidth(pos)) * 0.5;\n return smoothstep(-aa, aa, dClip);\n #else\n return step(0.0, dClip);\n #endif\n}\n\nfloat troikaGetTextAlpha() {\n float troikaSDFValue = texture2D(uTroikaSDFTexture, vTroikaSDFTextureUV).r;\n \n #if defined(IS_DEPTH_MATERIAL) || defined(IS_DISTANCE_MATERIAL)\n float alpha = step(0.5, troikaSDFValue);\n #else\n \n #if defined(GL_OES_standard_derivatives) || __VERSION__ >= 300\n float aaDist = min(\n 0.5,\n 0.5 * min(\n fwidth(vTroikaGlyphUV.x),\n fwidth(vTroikaGlyphUV.y)\n )\n ) / uTroikaSDFMinDistancePct;\n #else\n float aaDist = 0.01;\n #endif\n \n float alpha = uTroikaSDFDebug ? troikaSDFValue : smoothstep(\n 0.5 - aaDist,\n 0.5 + aaDist,\n troikaSDFValue\n );\n #endif\n \n return min(alpha, troikaGetClipAlpha());\n}\n",N="\nfloat troikaAlphaMult = troikaGetTextAlpha();\nif (troikaAlphaMult == 0.0) {\n discard;\n} else {\n gl_FragColor.a *= troikaAlphaMult;\n}\n";var G=new c.MeshBasicMaterial({color:16777215,side:c.DoubleSide,transparent:!0}),z=new c.Matrix4,k=new c.Mesh(new c.PlaneBufferGeometry(1,1).translate(.5,.5,0),G),H=function(e){function t(t){var r=new I;e.call(this,r,null),this.text="",this.anchor=null,this.font=null,this.fontSize=.1,this.letterSpacing=0,this.lineHeight="normal",this.maxWidth=1/0,this.overflowWrap="normal",this.textAlign="left",this.whiteSpace="normal",this.material=null,this.color=null,this.depthOffset=0,this.clipRect=null,this.debugSDF=!1}e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t;var r={textRenderInfo:{configurable:!0},material:{configurable:!0},customDepthMaterial:{configurable:!0},customDistanceMaterial:{configurable:!0}};return t.prototype.sync=function(e){var t=this;this._needsSync&&(this._needsSync=!1,this._isSyncing?(this._queuedSyncs||(this._queuedSyncs=[])).push(e):(this._isSyncing=!0,function(e,t){e=R({},e),S.href=e.font||M.defaultFontURL,e.font=S.href,e.text=""+e.text;var r=M.sdfGlyphSize,n=M.textureWidth,i=T[e.font];i||((i=T[e.font]={sdfTexture:new c.DataTexture(new Uint8Array(r*n),n,r,c.LuminanceFormat,void 0,void 0,void 0,void 0,c.LinearFilter,c.LinearFilter)}).sdfTexture.font=e.font),C(e).then((function(e){e.newGlyphSDFs&&(e.newGlyphSDFs.forEach((function(e){for(var t=e.textureData,n=e.atlasIndex,a=i.sdfTexture.image;a.data.length<(n+1)*r*r;){var o=new Uint8Array(2*a.data.length);o.set(a.data),a.data=o,a.height*=2}for(var s=a.width/r,l=0;l<r;l++)for(var c=l*r,u=a.width*r*Math.floor(n/s)+n%s*r+l*a.width,h=0;h<r;h++)a.data[u+h]=t[c+h]})),i.sdfTexture.needsUpdate=!0),t(Object.freeze({sdfTexture:i.sdfTexture,sdfGlyphSize:r,sdfMinDistancePercent:E,glyphBounds:e.glyphBounds,glyphAtlasIndices:e.glyphAtlasIndices,caretPositions:e.caretPositions,caretHeight:e.caretHeight,totalBounds:e.totalBounds,totalBlockSize:e.totalBlockSize}))}))}({text:this.text,font:this.font,fontSize:this.fontSize,letterSpacing:this.letterSpacing,lineHeight:this.lineHeight,maxWidth:this.maxWidth,textAlign:this.textAlign,whiteSpace:this.whiteSpace,overflowWrap:this.overflowWrap,anchor:this.anchor,includeCaretPositions:!0},(function(r){t._isSyncing=!1,t._textRenderInfo=r,t.geometry.updateGlyphs(r.glyphBounds,r.glyphAtlasIndices,r.totalBounds);var n=t._queuedSyncs;n&&(t._queuedSyncs=null,t._needsSync=!0,t.sync((function(){n.forEach((function(e){return e&&e()}))}))),e&&e()}))))},t.prototype.onBeforeRender=function(){this.sync(),this._prepareMaterial()},t.prototype.dispose=function(){this.geometry.dispose()},r.textRenderInfo.get=function(){return this._textRenderInfo||null},r.material.get=function(){var e=this._derivedMaterial,t=this._baseMaterial||G;return e&&e.baseMaterial===t||(e&&e.dispose(),e=this._derivedMaterial=function(e){var t=Object(w.createDerivedMaterial)(e,{extensions:{derivatives:!0},uniforms:{uTroikaSDFTexture:{value:null},uTroikaSDFTextureSize:{value:new c.Vector2},uTroikaSDFGlyphSize:{value:0},uTroikaSDFMinDistancePct:{value:0},uTroikaTotalBounds:{value:new c.Vector4},uTroikaClipRect:{value:new c.Vector4},uTroikaSDFDebug:{value:!1}},vertexDefs:B,vertexTransform:F,fragmentDefs:U,fragmentColorTransform:N});return t.transparent=!0,Object.defineProperty(t,"shadowSide",{get:function(){return this.side}}),t}(t),t.addEventListener("dispose",(function r(){t.removeEventListener("dispose",r),e.dispose()}))),e},r.material.set=function(e){this._baseMaterial=e},r.customDepthMaterial.get=function(){return this._updateLayoutUniforms(this.material.getDepthMaterial())},r.customDistanceMaterial.get=function(){return this._updateLayoutUniforms(this.material.getDistanceMaterial())},t.prototype._prepareMaterial=function(){var e=this._derivedMaterial;this._updateLayoutUniforms(e),e.uniforms.uTroikaSDFDebug.value=!!this.debugSDF,e.polygonOffset=!!this.depthOffset,e.polygonOffsetFactor=e.polygonOffsetUnits=this.depthOffset||0;var t=this.color;null!=t&&e.color&&e.color.isColor&&t!==e._troikaColor&&e.color.set(e._troikaColor=t)},t.prototype._updateLayoutUniforms=function(e){var t=this.textRenderInfo,r=e.uniforms;if(t){var n=t.sdfTexture,i=t.totalBounds;r.uTroikaSDFTexture.value=n,r.uTroikaSDFTextureSize.value.set(n.image.width,n.image.height),r.uTroikaSDFGlyphSize.value=t.sdfGlyphSize,r.uTroikaSDFMinDistancePct.value=t.sdfMinDistancePercent,r.uTroikaTotalBounds.value.fromArray(i);var a=this.clipRect;a&&Array.isArray(a)&&4===a.length?r.uTroikaClipRect.value.set(Math.max(i[0],a[0]),Math.max(i[1],a[1]),Math.min(i[2],a[2]),Math.min(i[3],a[3])):r.uTroikaClipRect.value.fromArray(i)}return e},t.prototype.raycast=function(e,t){var r=this.textRenderInfo;if(r){var n=r.totalBounds;k.matrixWorld.multiplyMatrices(this.matrixWorld,z.set(n[2]-n[0],0,0,n[0],0,n[3]-n[1],0,n[1],0,0,1,0,0,0,0,1)),k.raycast(e,t)}},Object.defineProperties(t.prototype,r),t}(c.Mesh);["font","fontSize","letterSpacing","lineHeight","maxWidth","overflowWrap","text","textAlign","whiteSpace","anchor"].forEach((function(e){var t="_private_"+e;Object.defineProperty(H.prototype,e,{get:function(){return this[t]},set:"anchor"===e?function(e){JSON.stringify(e)!==JSON.stringify(this[t])&&(this[t]=e,this._needsSync=!0)}:function(e){e!==this[t]&&(this[t]=e,this._needsSync=!0)}})}));class V{constructor(){this.value=null}reset(){this.value=null}}class j{constructor(){this.rotation=new c.Vector3}reset(){}}class W{constructor(){this.position=new c.Vector3}reset(){}}class q{constructor(){this.value=null}reset(){this.value=null}}class X{constructor(){this.text="",this.textAlign="left",this.anchor="center",this.baseline="center",this.color="#FFF",this.font="https://code.cdn.mozilla.net/fonts/ttf/ZillaSlab-SemiBold.ttf",this.fontSize=.2,this.letterSpacing=0,this.lineHeight=0,this.maxWidth=1/0,this.overflowWrap="normal",this.whiteSpace="normal",this.opacity=1}reset(){this.text=""}}class Y{constructor(){this.min=new c.Vector3,this.max=new c.Vector3}reset(){this.min.set(0,0,0),this.max.set(0,0,0)}}class Q{constructor(){}reset(){}}b.d;b.d;class Z extends b.d{}class J{constructor(){}reset(){}}const K=()=>{};class ${constructor(){this.reset()}reset(){this.onEntering=K,this.onExiting=K}}class ee extends b.d{}class te{constructor(){this.camera3D=null}reset(){this.camera3D=null}}class re{constructor(){this.value=[]}reset(){this.value.array.length=0}}const ne={left:0,center:.5,right:1},ie={top:0,center:.5,bottom:1};class ae extends b.b{updateText(e,t){e.text=t.text,e.textAlign=t.textAlign,e.anchor[0]=ne[t.anchor],e.anchor[1]=ie[t.baseline],e.color=t.color,e.font=t.font,e.fontSize=t.fontSize,e.letterSpacing=t.letterSpacing||0,e.lineHeight=t.lineHeight||null,e.overflowWrap=t.overflowWrap,e.whiteSpace=t.whiteSpace,e.maxWidth=t.maxWidth,e.material.opacity=t.opacity,e.sync()}execute(e,t){var r=this.queries.entities;r.added.forEach(e=>{var t=e.getComponent(X);const r=new H;r.name="textMesh",r.anchor=[0,0],r.renderOrder=1,this.updateText(r,t),e.addComponent(V,{value:r})}),r.removed.forEach(e=>{var t=e.getComponent(V).value,r=t.getObjectByName("textMesh");r.dispose(),t.remove(r)}),r.changed.forEach(e=>{var t=e.getComponent(V).value;if(t instanceof H){var r=e.getComponent(X);this.updateText(t,r)}})}}ae.queries={entities:{components:[X],listen:{added:!0,removed:!0,changed:[X]}}},c.BoxHelper.prototype.setFromMinMax=function(e,t){var r=this.geometry.attributes.position,n=r.array;n[0]=t.x,n[1]=t.y,n[2]=t.z,n[3]=e.x,n[4]=t.y,n[5]=t.z,n[6]=e.x,n[7]=e.y,n[8]=t.z,n[9]=t.x,n[10]=e.y,n[11]=t.z,n[12]=t.x,n[13]=t.y,n[14]=e.z,n[15]=e.x,n[16]=t.y,n[17]=e.z,n[18]=e.x,n[19]=e.y,n[20]=e.z,n[21]=t.x,n[22]=e.y,n[23]=e.z,r.needsUpdate=!0,this.geometry.computeBoundingSphere()};class oe extends b.c{constructor(){super(),this.boxHelper=new c.BoxHelper}}class se extends b.b{execute(e,t){this.queries.added.results.forEach(e=>{e.addComponent(oe);var t=e.getComponent(Y);let r=e.getMutableComponent(oe);r.boxHelper.setFromMinMax(t.min,t.max),e.addComponent(V,{value:r.boxHelper})}),this.queries.removed.results.forEach(e=>{e.removeComponent(V).removeComponent(oe)})}}se.queries={added:{components:[ee,Object(b.a)(oe)]},removed:{components:[Object(b.a)(ee),oe]}};class le extends b.b{execute(e,t){const r=this.queries.areas.results,n=this.queries.checkers.results;for(let e=0;e<r.length;e++){const t=r[e].getComponent(Y);for(let e=0;e<n.length;e++){const r=n[e];r.getComponent(V).value.boundingBox.intersectsBox(t)?r.addComponent(Z):r.removeComponent(Z)}}}}le.queries={areas:{components:[Q,Y]},checkers:{components:[J,V]}};class ce extends b.b{execute(e,t){const r=this.queries.checkers.added,n=this.queries.checkers.removed;for(let e=0;e<r.length;e++){const t=r[e];t.getComponent($).onEntering(t)}for(let e=0;e<n.length;e++){const t=n[e];t.getComponent($).onExiting(t)}}}ce.queries={checkers:{components:[J,V,Z],listen:{added:!0,removed:!0}}};class ue extends b.b{execute(e,t){this.queries.entities.added.forEach(e=>{const t=e.getComponent(q).value,r=e.getComponent(V).value;t.add(r)}),this.queries.entities.changed.forEach(e=>{const t=e.getComponent(q).value,r=e.getComponent(V).value;t.add(r)}),this.queries.entities.removed.forEach(e=>{e.getComponent(q,!0).value.remove(e.getComponent(V,!0).value)})}}ue.queries={entities:{components:[V,q],listen:{added:!0,removed:!0,changed:!0}}};let he=e=>{const t=e.getComponent(j);e.getComponent(V).value.rotation.set(t.x,t.y,t.z)},de=e=>{const t=e.getComponent(W);e.getComponent(V).value.position.copy(t)};class pe extends b.b{execute(e,t){this.queries.position.added.forEach(de),this.queries.position.changed.forEach(de),this.queries.rotation.added.forEach(he),this.queries.rotation.changed.forEach(he)}}pe.queries={position:{components:[W,V],listen:{added:!0,changed:!0}},rotation:{components:[j,V],listen:{added:!0,changed:!0}}};const fe=4;var me=new c.Vector3;class ve extends b.b{execute(e,t){window.context.camera.getWorldPosition(me),this.queries.entities.results.forEach(e=>{const t=e.getComponent(V).value,r=me.distanceTo(t.position);let n=0;r<fe&&(n=c.Math.clamp(Math.sqrt(fe-r),0,1),t.lookAt(me)),t.material.opacity=n,e.hasComponent(re)&&e.getComponent(re).value.forEach(e=>{e.getComponent(X).opacity!==n&&(e.getMutableComponent(X).opacity=n)})})}}ve.queries={entities:{components:[te,V]}};class ge{constructor(e,t){this.Systems=t,this.world=e}play(){this.Systems.forEach(e=>this.world.getSystem(e).play())}stop(){this.Systems.forEach(e=>this.world.getSystem(e).stop())}}var ye={foxr_tex:{url:"foxr.png",options:{encoding:c.sRGBEncoding,flipY:!1}},hall_model:{url:"hall.glb"},generic_controller_model:{url:"generic_controller.glb"},lightmap_tex:{url:"lightmap.jpg",options:{encoding:c.sRGBEncoding,flipY:!1}},controller_tex:{url:"controller.basis"},doorfx_tex:{url:"doorfx.basis",options:{wrapT:c.RepeatWrapping,wrapS:c.RepeatWrapping}},sky_tex:{url:"sky.png",options:{encoding:c.sRGBEncoding,flipY:!1}},clouds_tex:{url:"clouds.basis",options:{encoding:c.sRGBEncoding,flipY:!1}},teleport_model:{url:"teleport.glb"},beam_tex:{url:"beamfx.png"},glow_tex:{url:"glow.basis",options:{encoding:c.sRGBEncoding}},newsticker_tex:{url:"newsticker.jpg",options:{encoding:c.sRGBEncoding,flipY:!1}},mozillamr_tex:{url:"mozillamr.basis",options:{encoding:c.sRGBEncoding,flipY:!1}},zoomicon_tex:{url:"zoomicon.png",options:{encoding:c.sRGBEncoding}},panoballfx_tex:{url:"ballfx.basis",options:{wrapT:c.RepeatWrapping,wrapS:c.RepeatWrapping}},stereopanoL:{url:"stereopanoL.basis",options:{encoding:c.sRGBEncoding}},stereopanoR:{url:"stereopanoR.basis",options:{encoding:c.sRGBEncoding}},pano1small:{url:"stereopano_small.basis",options:{encoding:c.sRGBEncoding}},pano2:{url:"tigerturtle.basis",options:{encoding:c.sRGBEncoding,flipY:!1}},pano3:{url:"lakebyllesby.basis",options:{encoding:c.sRGBEncoding,flipY:!1}},pano4:{url:"haldezollern.basis",options:{encoding:c.sRGBEncoding,flipY:!1}},pano5:{url:"zapporthorn.basis",options:{encoding:c.sRGBEncoding,flipY:!1}},pano6:{url:"thuringen.basis",options:{encoding:c.sRGBEncoding,flipY:!1}},pano2small:{url:"tigerturtle_small.basis",options:{encoding:c.sRGBEncoding}},pano3small:{url:"lakebyllesby_small.basis",options:{encoding:c.sRGBEncoding}},pano4small:{url:"haldezollern_small.basis",options:{encoding:c.sRGBEncoding}},pano5small:{url:"zapporthorn_small.basis",options:{encoding:c.sRGBEncoding}},pano6small:{url:"thuringen_small.basis",options:{encoding:c.sRGBEncoding}},spray_model:{url:"spray.glb"},spray_tex:{url:"spray.basis",options:{encoding:c.sRGBEncoding,flipY:!1}},vertigo_model:{url:"vertigo.glb"},vertigo_door_lm_tex:{url:"vertigo_door_lm.jpg",options:{encoding:c.sRGBEncoding,flipY:!1}},vertigo_lm_tex:{url:"vertigo_lm.basis",options:{encoding:c.sRGBEncoding,flipY:!1}},checkboard_tex:{url:"checkboard.basis",options:{wrapT:c.RepeatWrapping,wrapS:c.RepeatWrapping,repeat:[4,4]}},sound_model:{url:"sound.glb"},sound_door_model:{url:"sound_door.glb"},sound_shadow_tex:{url:"sound_shadow.png"},sound_door_lm_tex:{url:"sound_door_lm.jpg",options:{wrapT:c.RepeatWrapping,wrapS:c.RepeatWrapping}},grid_tex:{url:"grid.png",options:{wrapT:c.RepeatWrapping,wrapS:c.RepeatWrapping,repeat:[20,20]}},pg_floor_tex:{url:"travertine2.basis",options:{encoding:c.sRGBEncoding,flipY:!1,wrapT:c.RepeatWrapping,wrapS:c.RepeatWrapping}},pg_floor_lm_tex:{url:"pg_floor_lm.jpg",options:{encoding:c.sRGBEncoding,flipY:!1}},pg_door_lm_tex:{url:"pg_door_lm.jpg",options:{encoding:c.sRGBEncoding,flipY:!1}},pg_object_tex:{url:"angel.basis",options:{encoding:c.sRGBEncoding,flipY:!1}},pg_object_model:{url:"angel.min.glb"},pg_bg_tex:{url:"pg_bg.jpg",options:{encoding:c.sRGBEncoding,flipY:!1}},pg_flare_tex:{url:"flare.jpg",options:{encoding:c.sRGBEncoding,flipY:!1}},pg_panel_tex:{url:"panel.basis",options:{encoding:c.sRGBEncoding,flipY:!1}},painting_seurat_tex:{url:"paintings/seurat.basis",options:{encoding:c.sRGBEncoding,flipY:!1}},painting_sorolla_tex:{url:"paintings/sorolla.basis",options:{encoding:c.sRGBEncoding,flipY:!1}},painting_bosch_tex:{url:"paintings/bosch.basis",options:{encoding:c.sRGBEncoding,flipY:!1}},painting_degas_tex:{url:"paintings/degas.basis",options:{encoding:c.sRGBEncoding,flipY:!1}},painting_rembrandt_tex:{url:"paintings/rembrandt.basis",options:{encoding:c.sRGBEncoding,flipY:!1}},birds_snd:{url:"ogg/birds.ogg"},chopin_snd:{url:"ogg/chopin.ogg"},forest_snd:{url:"ogg/forest.ogg"},wind_snd:{url:"ogg/wind.ogg"},teleport_a_snd:{url:"ogg/teleport_a.ogg"},teleport_b_snd:{url:"ogg/teleport_b.ogg"}};class xe{constructor(){this._listeners={},this.stats={fired:0,handled:0}}addEventListener(e,t){let r=this._listeners;void 0===r[e]&&(r[e]=[]),-1===r[e].indexOf(t)&&r[e].push(t)}hasEventListener(e,t){return void 0!==this._listeners[e]&&-1!==this._listeners[e].indexOf(t)}removeEventListener(e,t){var r=this._listeners[e];if(void 0!==r){var n=r.indexOf(t);-1!==n&&r.splice(n,1)}}dispatchEvent(e,t){this.stats.fired++;var r=this._listeners[e];if(void 0!==r)for(var n=r.slice(0),i=0;i<n.length;i++)n[i].call(this,t)}resetCounters(){this.stats.fired=this.stats.handled=0}}var be,Ae=new c.Matrix4;const we=["primary","secondary","both","left","right"];class _e extends xe{enable(){this.setLineStyle(this.previousLineStyle),this.enabled=!0}_sort(){this.currentStates=this.currentStates.sort((e,t)=>{return(e.order||0)-(t.order||0)})}disable(){this.lineBasic.visible=this.line0.visible=!1,this.enabled=!1,this.controllers.forEach(e=>e.active=!1)}changeHandedness(e){e!==this.primary&&(this.primary=e,this.secondary="right"===e?"left":"right",this.dispatchEvent("handednessChanged",{primary:this.primary,secondary:this.secondary}))}addState(e,t,r){if(!this.states[e])return t.name=e,void 0===t.raycaster&&(t.raycaster=!0),void 0===t.controller?t.controller="primary":we.includes(t.controller)||(console.warn("Invalid controller selector:",t.controller),t.controller="primary"),this.states[e]=t,!0===r&&this.currentStates.push(t),t;console.error(`RayControl state '${e}' already exist, please use a different name.`)}activateState(e){this.states[e]&&(this.currentStates.push(this.states[e]),this._sort())}deactivateAll(e){this.currentStates=[],this.controllers.forEach(e=>{this.currentStates.forEach(t=>{e.intersections[t.name]&&(e.intersections[t.name]=null)})})}deactivateState(e){this.currentStates.splice(this.currentStates.indexOf(e),1),this.controllers.forEach(t=>{t.intersections[e]&&(t.intersections[e]=null)}),this._sort()}addController(e,t){let r={controller:e,inputSource:t,active:!1,stateHit:{},intersections:{},currentIntersection:null,hit:!1};this.controllers.push(r),this.matchController(r,"primary")&&e.add(this.raycasterContext),this.dispatchEvent("controllerConnected",r)}removeController(e){const t=this.controllers.findIndex(t=>t.controller===e),r=this.controllers.find(t=>t.controller===e);this.controllers.splice(t,1),this.dispatchEvent("controllerDisconnected",r)}constructor(e,t){super(),this.ctx=e,void 0===t?(this.primary="right",this.secondary="left"):(this.primary=t,this.secondary="right"===t?"left":"right"),this.controllers=[],this.previousLineStyle="pretty",this.enabled=!0,this.raycaster=new c.Raycaster,this.states={},this.currentStates=[];var r=e.assets.teleport_model.scene.getObjectByName("beam");e.assets.beam_tex.wrapT=c.RepeatWrapping,e.assets.beam_tex.wrapS=c.RepeatWrapping,be=r.material=new c.ShaderMaterial({uniforms:{time:{value:0},active:{value:0},tex:{value:e.assets.beam_tex}},vertexShader:e.shaders.basic_vert,fragmentShader:e.shaders.beam_frag,blending:c.AdditiveBlending,transparent:!0}),r.renderOrder=10,r.name="line",this.rayLength=5,r.scale.z=this.rayLength,this.line0=r.clone(),this.line0.visible=!0,this.raycasterContext=new c.Group,this.raycasterContext.add(this.line0),this.raycasterContext.name="raycasterContext";var n=(new c.BufferGeometry).setFromPoints([new c.Vector3(0,0,0),new c.Vector3(0,0,-1)]);this.lineBasic=new c.Line(n),this.lineBasic.name="line",this.lineBasic.scale.z=5,this.lineBasic.visible=!1,this.raycasterContext.add(this.lineBasic)}setLineStyle(e){const t="basic"===e;this.lineBasic.visible=t,this.line0.visible=!t,this.previousLineStyle=e}matchController(e,t){const r=e.inputSource.handedness;return t===r||"both"===t&&("right"===r||"left"===r)||"primary"===t&&this.primary===r||"secondary"===t&&this.secondary===r}onSelectStart(e){if(!this.enabled)return;let t=e.target,r=this.controllers.find(e=>e.controller===t);if(r){if(r.active=!0,r.currentIntersection){const e=r.currentIntersection.state;e.onSelectStart&&e.onSelectStart(r.currentIntersection.intersection,r.controller)}this.currentStates.forEach(e=>{e.onSelectStart&&!e.raycaster&&e.onSelectStart(r.intersections[e.name],t)})}}execute(e,t,r){if(!this.enabled||0===this.currentStates.length)return;be.uniforms.time.value=r;for(var n=0;n<this.controllers.length;n++){let e=this.controllers[n];for(var i=0;i<this.currentStates.length;i++){let t=this.currentStates[i];if(!t.raycaster)continue;if(!this.matchController(e,t.controller))continue;let r=e.controller,n=(e.active,this.getIntersections(r,t.colliderMesh));n.length>0?(e.intersections[t.name]=n[0],e.stateHit[t.name]=!0):e.intersections[t.name]=null}}this.line0.scale.z=Math.min(this.rayLength,1),this.lineBasic.scale.z=Math.min(this.rayLength,1);for(n=0;n<this.controllers.length;n++){let e=this.controllers[n],t=Object.entries(e.intersections).filter(e=>null!==e[1]);if(t.length>0){t.sort((e,t)=>e[1].distance-t[1].distance);const r=t[0],n=r[1],i=this.states[r[0]];e.prevIntersection=e.currentIntersection,e.currentIntersection={state:i,intersection:n},i.lineStyleOnIntersection?this.setLineStyle(i.lineStyleOnIntersection):this.setLineStyle("advanced"),i.onHover&&i.onHover(n,e.active,e.controller),this.line0.scale.z=Math.min(n.distance,1),this.lineBasic.scale.z=Math.min(n.distance,1)}else e.currentIntersection=null}for(n=0;n<this.controllers.length;n++){let e=this.controllers[n];e.prevIntersection&&(this.controllers.find(t=>{let r=e.prevIntersection,n=t.currentIntersection;return n&&r.state.name===n.state.name&&r.intersection.object===n.intersection.object})||(e.prevIntersection.state.onHoverLeave(e.prevIntersection.intersection,!1,e.controller),e.prevIntersection=null))}}getIntersections(e,t){let r=e.getObjectByName("raycasterContext");return r?(Ae.identity().extractRotation(r.matrixWorld),this.raycaster.ray.origin.setFromMatrixPosition(r.matrixWorld),this.raycaster.ray.direction.set(0,0,-1).applyMatrix4(Ae),Array.isArray(t)?this.raycaster.intersectObjects(t,!0):this.raycaster.intersectObject(t,!0)):(console.warn("No raycasterContext found for this controller",e),[])}onSelectEnd(e){if(!this.enabled)return;let t=this.controllers.find(t=>t.controller===e.target);if(t&&t.active){if(t){if(t.currentIntersection){const e=t.currentIntersection.state;e.onSelectEnd&&e.onSelectEnd(t.currentIntersection.intersection,t.controller)}this.currentStates.forEach(e=>{e.onSelectEnd&&!e.raycaster&&e.onSelectEnd(null,t.controller)})}t.active=!1}}}new c.Matrix4;class Me{constructor(e,t){this.ctx=e,this.teleportEntity=new c.Group,this.active=!1,this.teleportHitGeometry=e.assets.teleport_model.scene.getObjectByName("goal"),this.teleportHitGeometry.material=be,this.teleportHitGeometry.renderOrder=10,this.ballColliding=e.assets.teleport_model.scene.getObjectByName("glow"),this.ballColliding.material=new c.MeshBasicMaterial({color:9595,map:e.assets.glow_tex,transparent:!0,blending:c.AdditiveBlending}),this.ballColliding.renderOrder=10,this.ballColliding.visible=!1,this.teleportEntity.add(this.ballColliding),this.teleportHitGeometry.visible=!1,this.teleportHitGeometry.position.set(-2,0,-2),this.teleportEntity.add(this.teleportHitGeometry),this.ctx.scene.add(this.teleportEntity),this.startSound=new c.Audio(e.audioListener),this.startSound.setBuffer(e.assets.teleport_a_snd),this.startSound.setLoop(!0),this.startSound.pause(),this.endSound=new c.Audio(e.audioListener),this.endSound.setBuffer(e.assets.teleport_b_snd),this.endSound.setLoop(!1),this.endSound.pause()}onSelectStart(e){this.active=!0,this.endSound.pause(),this.startSound.play()}onHoverLeave(){this.ballColliding.visible=!1,this.teleportHitGeometry.visible=!1,this.startSound.pause()}onHover(e,t){t?(this.teleportHitGeometry.visible=!0,this.teleportHitGeometry.position.copy(e),this.hit=!0,this.ballColliding.visible=!1):(this.ballColliding.visible=!0,this.ballColliding.position.copy(e))}onSelectEnd(e){const t=this.ctx.renderer.xr.getCamera(this.ctx.camera).position,r=e.sub(t);r.y=0,this.ctx.cameraRig.position.add(r),this.teleportHitGeometry.visible=!1,this.active=!1,this.startSound.pause(),this.endSound.play()}}var Se=[],Ee=new c.Object3D;new c.Box3,new c.Vector3;const Te=6;var Re={object:null,widget:null,controller:null,animation:0,icon:null};const Le=["seurat","sorolla","bosch","degas","rembrandt"],Ce=[1,1,.5,.5,1],Pe=[.4,.2,.2,.4,.25];new c.Vector2,new c.Vector2;function De(e){Re.widget.position.copy(e.point),Re.widget.position.x-=.5*Re.animation;Re.widget.geometry.faceVertexUvs[0];Re.widget.material.uniforms.zoomPos.value.copy(e.uv),Re.widget.material.uniforms.zoomAmount.value=Pe[e.object.userData.paintingId]}var Ie,Oe={url:"assets/tweets.json",hashtag:"#helloWebXR",hashtagText:null,authorText:null,messageText:null,news:[],current:0};function Be(){const e=Oe;e.authorText.getMutableComponent(X).text=e.news[e.current].author,e.messageText.getMutableComponent(X).text=e.news[e.current].message,e.current=(e.current+1)%e.news.length,setTimeout(Be,3e3)}class Fe extends c.Object3D{constructor(e,t){super(),this.listener=e,this.context=e.context,this.poolSize=t||5;for(var r=0;r<this.poolSize;r++)this.children.push(new c.PositionalAudio(e))}setBuffer(e){this.children.forEach(t=>{t.setBuffer(e)})}play(){var e=!1;for(let t=0;t<this.children.length;t++){let r=this.children[t];r.isPlaying||!r.buffer||e||(r.play(),r.isPaused=!1,e=!0)}e||console.warn("All the sounds are playing. If you need to play more sounds simultaneously consider increasing the pool size")}}var Ue,Ne,Ge,ze,ke,He=[null,null],Ve=[null,null],je=new Array(13),We=new c.Box3,qe=null,Xe=new c.Vector3,Ye=13,Qe=[new Array(Ye).fill(!1),new Array(Ye).fill(!1)],Ze=null;function Je(e,t){return We.setFromObject(t),!!e.boundingBox.intersectsBox(We)}function Ke(e,t){Ve[e].material.color.set(t)}function $e(e){let t=e.target;if(null===t.userData.grabbing){for(let e=0;e<2;e++)if(We.setFromObject(He[e]),t.boundingBox.intersectsBox(We))return Ke(e,11184810),Ze.raycontrol.disable(),He[e].userData.grabbedBy&&(He[e].userData.grabbedBy.userData.grabbing=null),He[e].position.set(0,0,0),He[e].rotation.set(0,0,0),t.add(He[e]),He[e].userData.animation=0,t.userData.grabbing=He[e],He[e].userData.grabbedBy=t,!1;return!0}}function et(e){Ze.raycontrol.enable();let t=e.target;if(null!==t.userData.grabbing){let e=t.userData.grabbing;return e.getWorldPosition(Xe),qe.add(e),e.position.copy(Xe),e.rotation.copy(e.userData.resetRotation),e.userData.grabbedBy=null,e.userData.animation=1,t.userData.grabbing=null,!1}return!0}function tt(e,t,r){return Math.min(Math.max(e,t),r)}class rt{constructor(e,t,r){this.ctx=e,this.radius=.1,this.hsv={h:0,s:0,v:1},this.rgb={r:0,g:0,b:0},this.onColorChanged=r;const n=new c.CircleBufferGeometry(this.radius,12);var i=new c.ShaderMaterial({uniforms:{brightness:{type:"f",value:this.hsv.v}},vertexShader:" varying vec2 vUv; void main() { vUv = uv; vec4 mvPosition = modelViewMatrix * vec4(position, 1.0); gl_Position = projectionMatrix * mvPosition; } ",fragmentShader:" #define M_PI2 6.28318530718\n uniform float brightness; varying vec2 vUv; vec3 hsb2rgb(in vec3 c){ vec3 rgb = clamp(abs(mod(c.x * 6.0 + vec3(0.0, 4.0, 2.0), 6.0) - 3.0) - 1.0, 0.0, 1.0 ); rgb = rgb * rgb * (3.0 - 2.0 * rgb); return c.z * mix( vec3(1.0), rgb, c.y); } void main() { vec2 toCenter = vec2(0.5) - vUv; float angle = atan(toCenter.y, toCenter.x); float radius = length(toCenter) * 2.0; vec3 color = hsb2rgb(vec3((angle / M_PI2) + 0.5, radius, brightness)); gl_FragColor = vec4(color, 1.0); } "});this.mesh=new c.Mesh(n,i),this.mesh.name="colorWheel",this.controller=t;const a=new c.CircleBufferGeometry(.025,12);let o=new c.MeshBasicMaterial({color:0});this.blackMesh=new c.Mesh(a,o),this.blackMesh.name="black",this.blackMesh.position.set(0,.15,0),this.ui=new c.Group,this.ui.add(this.mesh),this.ui.add(this.blackMesh);var s=new c.RingGeometry(.005,.01,32),l=new c.MeshBasicMaterial({color:16776960,side:c.DoubleSide});this.colorSelector=new c.Mesh(s,l),this.colorSelector.position.z=.01,this.colorSelector.name="colorSelector",this.ui.add(this.colorSelector),this.ui.name="ColorWheel",this.ui.visible=!1,this.ui.position.y=.1,t.add(this.ui),e.raycontrol.addState("colorwheel",{colliderMesh:this.ui,order:-1,onHover:(e,t,r)=>{if(t){var n=e.point.clone();this.mesh.worldToLocal(n),this.colorSelector.position.x=n.x,this.colorSelector.position.y=n.y}},onHoverLeave:e=>{},onSelectStart:(e,t)=>{if("colorWheel"===e.object.name){var r=e.point.clone();this.mesh.updateMatrixWorld(),this.mesh.worldToLocal(r);let t=e.uv.clone();t.x=2*t.x-1,t.y=2*t.y-1;let i={r:this.radius*Math.sqrt(t.x*t.x+t.y*t.y),theta:Math.PI+Math.atan2(t.y,t.x)};var n=(i.theta*(180/Math.PI)+180)%360;this.hsv.h=n/360,this.hsv.s=i.r/this.radius,this.updateColor()}else this.onColorChanged(e.object.material.color.clone().multiplyScalar(255))},onSelectEnd:e=>{}})}updateColor(){this.rgb=function(e){var t,r,n,i,a,o,s,l,c=tt(e.h,0,1),u=tt(e.s,0,1),h=e.v;switch(o=h*(1-u),s=h*(1-(a=6*c-(i=Math.floor(6*c)))*u),l=h*(1-(1-a)*u),i%6){case 0:t=h,r=l,n=o;break;case 1:t=s,r=h,n=o;break;case 2:t=o,r=h,n=l;break;case 3:t=o,r=s,n=h;break;case 4:t=l,r=o,n=h;break;case 5:t=h,r=o,n=s}return{r:Math.round(255*t),g:Math.round(255*r),b:Math.round(255*n)}}(this.hsv),this.colorSelector.material.color.setRGB(this.rgb.r/255,this.rgb.g/255,this.rgb.b/255),this.onColorChanged(this.rgb)}enter(){this.ctx.raycontrol.activateState("colorwheel")}exit(){this.ctx.raycontrol.deactivateState("colorwheel")}}function nt(e,t){return Math.floor(Math.random()*(t-e))+e}var it,at,ot,st,lt=new c.Vector2,ct=new Image;function ut(e,t,r){ot.clearRect(0,0,at.width,at.height),ot.drawImage(it,0,0);let n=ot.getImageData(0,0,at.width,at.height);for(var i=0;i<n.data.length;i+=4)n.data[i]=e*n.data[i]/255,n.data[i+1]=t*n.data[i+1]/255,n.data[i+2]=r*n.data[i+2]/255;ot.putImageData(n,0,0),ct.src=at.toDataURL()}function ht(e,t){let r=e.world.createEntity();r.name="area",r.addComponent(Y).addComponent(q,{value:t}).addComponent(Q);let n=r.getMutableComponent(Y);n.min.set(-5,0,4.4),n.max.set(3,3,7);let i=e.world.createEntity(),a=e.world.createEntity(),o=e.assets.spray_model.scene;e.raycontrol.addEventListener("controllerConnected",t=>{e.raycontrol.matchController(t,"primary")?(!function(t){let r=t.controller;const n=t.inputSource.handedness;let i=new c.AudioListener;const a=new c.PositionalAudio(i);a.loop=!0,(new c.AudioLoader).load("assets/ogg/spray.ogg",e=>{a.setBuffer(e),a.name="spraySound",r.add(a)}),o.getObjectByName("spraycan").geometry.rotateY("right"===n?Math.PI/2:-Math.PI/2),o.name="spray",o.visible=!1;const s=e.assets.spray_tex;o.getObjectByName("spraycan").material=new c.MeshPhongMaterial({map:s}),o.getObjectByName("spraycolor").material=new c.MeshLambertMaterial({color:16711680}),r.add(o)}(t),a.addComponent(J).addComponent(V,{value:t.controller}).addComponent($,{onEntering:r=>{const n=r.getComponent(V).value;n.getObjectByName("Scene").visible=!1,n.getObjectByName("spray").visible=!0;let i=n.getObjectByName("raycasterContext");i.rotation.set(-Math.PI/2,("right"===t.inputSource.handedness?1:-1)*Math.PI/2,0),i.position.set(0,-.015,-.025),e.raycontrol.setLineStyle("basic"),e.raycontrol.activateState("graffiti")},onExiting:t=>{const r=t.getComponent(V).value;r.getObjectByName("Scene").visible=!0,r.getObjectByName("spray").visible=!1;let n=r.getObjectByName("raycasterContext");n.rotation.set(0,0,0),n.position.set(0,0,0),e.raycontrol.setLineStyle("advanced"),e.raycontrol.deactivateState("graffiti")}})):(!function(t){let r=t.controller;(Ne=new rt(e,r,e=>{ut(e.r,e.g,e.b),o.getObjectByName("spraycolor").material.color.setRGB(e.r/255,e.g/255,e.b/255)})).enter()}(t),i.addComponent(J).addComponent(V,{value:t.controller}).addComponent($,{onEntering:e=>{const t=e.getComponent(V).value;t.getObjectByName("Scene").visible=!1,t.getObjectByName("ColorWheel").visible=!0},onExiting:e=>{const t=e.getComponent(V).value;t.getObjectByName("Scene").visible=!0,t.getObjectByName("ColorWheel").visible=!1}}))});it=new Image,at=document.createElement("canvas"),ot=at.getContext("2d"),it.onload=()=>{at.width=it.width,at.height=it.height,ut(0,0,0)},it.src="assets/spray_brush.png";var s=document.createElement("canvas");s.width=2048,s.height=1024,(ke=s.getContext("2d")).clearRect(0,0,2048,1024),ke.fillStyle="#fff",ke.fillRect(0,0,2048,1024);let l=new c.CanvasTexture(s);Ge=new c.MeshBasicMaterial({color:16777215,lightMap:e.assets.lightmap_tex,map:l}),(ze=t.getObjectByName("graffiti")).material=Ge;var u=new c.Vector2;e.raycontrol.addState("graffiti",{colliderMesh:ze,lineStyleOnIntersection:"basic",onHover:(e,t,r)=>{if(t){var n=e.distance;if(n>1)return;let t=2048*e.uv.x,r=1024-1024*e.uv.y;u.set(t,r),ke.imageSmoothingEnabled=!0,ke.fillStyle="#f00",ke.strokeStyle="#0f0";var i=lt.distanceTo(u),a=function(e,t){return Math.atan2(t.x-e.x,t.y-e.y)}(lt,u);let h=c.Math.clamp(1-n,0,1);ke.globalAlpha=h;for(var o=0;o<i;o++){var s=lt.x+Math.sin(a)*o,l=lt.y+Math.cos(a)*o;ke.save(),ke.translate(s,l);let e=c.Math.lerp(.001,.2,n);ke.scale(e,e),ke.rotate(180*Math.PI/nt(0,180)),ke.drawImage(ct,-it.width/2,-it.height/2),ke.restore()}lt.set(t,r),Ge.map.needsUpdate=!0}},onHoverLeave:e=>{},onSelectStart:(e,t)=>{if(e.distance>1)return;st=t,t.getObjectByName("spraySound").play();let r=2048*e.uv.x,n=1024-1024*e.uv.y;lt.set(r,n)},onSelectEnd:e=>{st&&st.getObjectByName("spraySound").stop()}})}var dt=[{title:"360 Panoramas",description:"Photographs wrapped around spheres provide an environment, but without stereo effect nor depth.",offsety:.04},{title:"Xylophone Toy",description:"Example of object grabbing and simple interaction.",offsety:.04},{title:"360 Stereo Panorama",description:"By using one photo for each eye, panoramas can have some depth and stereo effect.",offsety:.03},{title:"Photogrammetry Room",description:"Example of an object created out of photographs using an automated software.",offsety:.04},{title:"Twitter Feed",description:"Bringing external realtime data to an XR environment.",offsety:.02},{title:"Vertigo Room",description:"An example of how this new medium can play with your perception and senses.",offsety:.04},{title:"Hello WebXR!",description:"A small compendium of interactions and little experiences introducing and celebrating the final specification of the WebXR API.\n \nMade by the Mozilla Mixed Reality team\nmixedreality.mozilla.org",offsety:.06},{title:"The Pink Robe. After the Bath",description:"Joaquín Sorolla, 1916\n208 x 126.5 cm. Oil on canvas."},{title:"The Garden of Earthly Delights",description:"Hieronymus Bosch, 1490 - 1510\n205.5 x 384.9 cm. Oil on oak panels."},{title:"Self-Portrait",description:"Rembrandt van Rijn, 1659\n84.5 x 66 cm. Oil on canvas."},{title:"The Dance Lesson",description:"Edgar Degas, 1879\n38 x 88 cm. Oil on canvas."},{title:"Gray Weather, Grande Jatte",description:"Georges Seurat, 1888\n71 x 66 cm. Oil on canvas.",offsety:.04},{title:"Sound Room",description:"Showcase of positional audio, very useful on XR experiences.\nTry to find where the sounds come from!.",offsety:.04},{title:"Graffiti Wall",description:"Get close and spray the wall!.\nLet's collaborate on a full masterpiece.",offsety:.04},{title:"Paintings",description:"Real-scale paintings that can be inspected very closely using the controller.",offsety:.04},{title:"WELCOME!",description:"Aim your controller and press the trigger to teleport around and interact with objects.\n\nWe currently have 3 rooms and 5 experiences to explore. Try them all!",offsety:.06}],pt=[],ft=[],mt=[];var vt,gt,yt,xt,bt,At=[];new c.Vector3;function wt(e){return new c.ShaderMaterial({uniforms:{time:{value:0},selected:{value:0},tex:{value:e.assets.doorfx_tex}},vertexShader:e.shaders.basic_vert,fragmentShader:e.shaders.door_frag})}function _t(e){const t=e.assets;vt=new c.Object3D;const r=t.lightmap_tex,n=t.sky_tex,i=t.clouds_tex,a=t.foxr_tex,o=t.newsticker_tex,s=t.mozillamr_tex,l=new c.MeshBasicMaterial({map:r});bt={hall:l,screen:new c.MeshBasicMaterial({map:o}),xylophone:l,"xylostick-left":l,"xylostick-right":l,"xylostickball-left":l.clone(),"xylostickball-right":l.clone(),lightpanels:new c.MeshBasicMaterial,doorA:wt(e),doorB:wt(e),doorC:wt(e),doorD:wt(e),sky:new c.MeshBasicMaterial({map:n}),clouds:new c.MeshBasicMaterial({map:i,transparent:!0}),foxr:new c.MeshBasicMaterial({map:a,transparent:!0}),mozillamr:new c.MeshBasicMaterial({map:s,transparent:!0})},(gt=t.hall_model.scene).traverse(e=>{if("teleport"==e.name)return yt=e,void(e.material.visible=!1);e.name.startsWith("door")&&At.push(e),"Mesh"==e.type&&bt[e.name]&&(e.material=bt[e.name])}),function(e,t){for(let r in Le){let n=Le[r],i=t.getObjectByName(n);if(!i)continue;let a=e.assets[`painting_${n}_tex`];i.material=new c.MeshBasicMaterial({map:a}),i.userData.paintingId=r}t.getObjectByName("paintings"),Re.widget=new c.Mesh(new c.PlaneGeometry,new c.ShaderMaterial({uniforms:{time:{value:0},tex:{value:null},zoomPos:{value:new c.Vector2},zoomAmount:{value:0},zoomRatio:{value:1}},vertexShader:e.shaders.basic_vert,fragmentShader:e.shaders.zoom_frag,transparent:!0,depthTest:!1,depthWrite:!1})),Re.widget.geometry.rotateY(-Math.PI/2),Re.widget.visible=!1,Re.icon=new c.Mesh(new c.PlaneGeometry(.2,.2),new c.MeshBasicMaterial({map:e.assets.zoomicon_tex,transparent:!0})),Re.icon.geometry.rotateY(-Math.PI/2),Re.icon.visible=!1,e.scene.add(Re.icon),e.scene.add(Re.widget),e.raycontrol.addState("paintings",{colliderMesh:t.getObjectByName("paintings"),onHover:(e,t,r)=>{e.distance>3||(t?(Re.painting=e.object,Re.controller=r,Re.widget.material.uniforms.tex.value=Re.painting.material.map,Re.widget.material.uniforms.zoomRatio.value=Ce[e.object.userData.paintingId],Re.widget.visible=!0,De(e)):(Re.icon.visible=!0,Re.icon.position.copy(e.point),Re.icon.position.x-=.01))},onHoverLeave:e=>{Re.painting=null,Re.animation=0,Re.widget.visible=!1,Re.icon.visible=!1},onSelectStart:(e,t)=>{e.distance<3&&(Re.painting=e.object,Re.controller=t,Re.widget.material.uniforms.tex.value=Re.painting.material.map,Re.widget.material.uniforms.zoomRatio.value=Ce[e.object.userData.paintingId],Re.widget.visible=!0,Re.icon.visible=!1,De(e))},onSelectEnd:e=>{Re.painting=null,Re.animation=0,Re.widget.visible=!1}})}(e,gt),function(e,t){Ze=e;const r=new c.AudioLoader;Ue=new c.AudioListener,qe=t;for(let e=0;e<Ye;e++){let n="xnote0"+(e<10?"0"+e:e),i=t.getObjectByName(n);i.geometry.computeBoundingBox(),i.geometry.boundingBox.translate(i.position).translate(i.parent.position),i.material=new c.MeshLambertMaterial,i.material.color.setHSL(e/13,.9,.2),i.material.emissive=i.material.color.clone(),i.material.emissiveIntensity=0,je[e]=i,i.userData.animation=0,i.userData.resetY=i.position.y,i.userData.sound=new Fe(Ue,10),r.load("assets/ogg/xylophone"+(e+1)+".ogg",e=>{i.userData.sound.setBuffer(e)})}He[0]=t.getObjectByName("xylostick-left"),He[1]=t.getObjectByName("xylostick-right"),He[0].userData.resetPosition=He[0].position.clone(),He[1].userData.resetPosition=He[1].position.clone(),He[0].userData.resetRotation=He[0].rotation.clone(),He[1].userData.resetRotation=He[1].rotation.clone(),He[0].userData.grabbedBy=null,He[1].userData.grabbedBy=null,He[0].userData.animation=0,He[1].userData.animation=0,Ve[0]=t.getObjectByName("xylostickball-left"),Ve[1]=t.getObjectByName("xylostickball-right"),Ve[0].geometry.computeBoundingBox(),Ve[1].geometry.computeBoundingBox()}(e,gt),ht(e,gt),function(e,t){const r=t.getObjectByName("newsticker");e.world.createEntity(),Ie=t.getObjectByName("screen").material,Oe.hashtagText=e.world.createEntity(),Oe.hashtagText.addComponent(X,{color:"#f6cdde",fontSize:.1,anchor:"right",textAlign:"right"}).addComponent(q,{value:r}),Oe.authorText=e.world.createEntity(),Oe.authorText.addComponent(X,{color:"#7f0c38",fontSize:.1,anchor:"left"}).addComponent(q,{value:r}),Oe.messageText=e.world.createEntity(),Oe.messageText.addComponent(X,{color:0,fontSize:.13,maxWidth:2.3,lineHeight:1,textAlign:"left",baseline:"top",anchor:"left"}).addComponent(q,{value:r}),["hashtag","author","message"].forEach(e=>{Oe[`${e}Text`].addComponent(W,t.getObjectByName(e).position),Oe[`${e}Text`].addComponent(j,{x:0,y:Math.PI,z:0})}),Oe.hashtagText.getMutableComponent(X).text=Oe.hashtag,fetch(Oe.url).then(e=>e.json()).then(e=>{Oe.news=e,Be()})}(e,gt),function(e,t){const r=e.assets;t,new c.SphereBufferGeometry(.15,30,20);for(var n=0;n<Te;n++){let a=r[`pano${n+1}small`];var i=new c.Mesh(new c.SphereBufferGeometry(.15,30,20),new c.ShaderMaterial({uniforms:{time:{value:0},tex:{value:a},texfx:{value:r.panoballfx_tex},selected:{value:0}},vertexShader:e.shaders.panoball_vert,fragmentShader:e.shaders.panoball_frag,side:c.BackSide}));i.rotation.set(Math.PI,0,0),i.position.copy(t.getObjectByName(`panoball${n+1}`).position),i.userData.floatY=i.position.y,i.userData.panoId=4+n,i.userData.selected=0,Se.push(i),Ee.add(i)}t.add(Ee),e.raycontrol.addState("panoballs",{colliderMesh:Ee,onHover:(e,t,r)=>{Se.forEach(e=>e.userData.selected=0),e.object.userData.selected=1},onHoverLeave:e=>{e.object.userData.selected=0},onSelectStart:(e,t)=>{},onSelectEnd:t=>{e.goto=t.object.userData.panoId,t.object.userData.selected=0}})}(e,gt),function(e,t){for(var r=0;r<dt.length;r++){const n=r<10?"0"+r:r;pt[r]=t.getObjectByName("infopanel0"+n),pt[r].geometry.computeBoundingBox();const i=pt[r].geometry.boundingBox.max.x-pt[r].geometry.boundingBox.min.x,a=pt[r].geometry.boundingBox.max.y-pt[r].geometry.boundingBox.min.y,o=dt[r].offsety||0;pt[r].material=new c.MeshBasicMaterial({color:263172,transparent:!0}),ft[r]=e.world.createEntity(),ft[r].addComponent(X,{color:"#ffffff",fontSize:.05,anchor:"left",textAlign:"left",baseline:"top",maxWidth:.8*i,lineHeight:1.3,text:dt[r].title+"\n \n"+dt[r].description}).addComponent(q,{value:pt[r]}).addComponent(W,{x:-i/2*.82,y:a/2*.65+o,z:.01}),mt[r]=e.world.createEntity(),mt[r].addComponent(V,{value:pt[r]}).addComponent(te,{camera3D:e.camera}).addComponent(re,{value:[ft[r]]})}}(e,gt),e.raycontrol.addState("teleport",{colliderMesh:yt,onHover:(t,r)=>{e.teleport.onHover(t.point,r)},onHoverLeave:()=>{e.teleport.onHoverLeave()},onSelectStart:(t,r)=>{e.teleport.onSelectStart(r)},onSelectEnd:t=>{e.teleport.onSelectEnd(t.point)}}),e.raycontrol.addState("doors",{colliderMesh:At,onHover:(e,t)=>{const r=e.object.scale;r.z=Math.min(r.z+.05*(5.5-r.z),5)},onHoverLeave:e=>{},onSelectStart:t=>{e.goto={doorA:1,doorB:2,doorC:3,doorD:4}[t.object.name]},onSelectEnd:e=>{}}),(xt=new c.Mesh(new c.PlaneBufferGeometry,new c.MeshBasicMaterial({color:0,transparent:!0,depthTest:!1}))).position.z=-.1,xt.material.opacity=0,vt.add(gt),e.camera.add(xt)}function Mt(e){e.systemsGroup.roomHall.play(),e.renderer.setClearColor(12640251),e.scene.add(vt),function(e){e.camera.add(Ue);let t=$e.bind(this),r=et.bind(this);e.controllers[0].addEventListener("selectstart",t),e.controllers[1].addEventListener("selectstart",t),e.controllers[0].addEventListener("selectend",r),e.controllers[1].addEventListener("selectend",r)}(e),Ne&&Ne.enter(),e.raycontrol.activateState("doors"),e.raycontrol.activateState("teleport"),function(e){e.raycontrol.activateState("paintings")}(e),function(e){e.raycontrol.activateState("panoballs")}(e)}function St(e){e.systemsGroup.roomHall.stop(),e.scene.remove(vt),e.raycontrol.deactivateState("doors"),e.raycontrol.deactivateState("teleport"),function(e){e.camera.remove(Ue);let t=$e.bind(this),r=et.bind(this);e.controllers[0].removeEventListener("selectstart",t),e.controllers[1].removeEventListener("selectstart",t),e.controllers[0].removeEventListener("selectend",r),e.controllers[1].removeEventListener("selectend",r)}(e)}function Et(e,t,r){!function(e,t,r){for(let e=0;e<Se.length;e++){const t=Se[e];t.position.y=t.userData.floatY+.02*Math.cos(e+3*r)}}(0,0,r),function(e,t,r){Re.painting&&(Re.animation<1&&(Re.animation+=(1-Re.animation)*t*4),Re.widget.material.uniforms.time.value=r)}(0,t,r),function(e,t,r){let n=e.controllers;if(n)for(let r=0;r<2;r++){if(null===n[r].userData.grabbing){let t=Je(n[0],He[0]),r=Je(n[0],He[1]);t||r?e.raycontrol.disable():e.raycontrol.enable(),He[0].userData.grabbedBy||(t||(t=Je(n[1],He[0])),Ke(0,t?16777215:11184810)),He[1].userData.grabbedBy||(r||(r=Je(n[1],He[1])),Ke(1,r?16777215:11184810))}else{let e=n[r].userData.grabbing.children[0];We.setFromObject(e).expandByScalar(-.01);for(let e=0;e<je.length;e++){let n=je[e];n.userData.animation>0&&(n.userData.animation=Math.max(0,n.userData.animation-4*t),n.material.emissiveIntensity=n.userData.animation,n.position.y=n.userData.resetY-.005*n.userData.animation),We.intersectsBox(n.geometry.boundingBox)?Qe[r][e]||(Qe[r][e]=!0,n.userData.sound.play(),n.userData.animation=1,Ke(r,16777215)):Qe[r][e]&&(Qe[r][e]=!1,Ke(r,11184810))}}He[r].userData.animation>0&&(Xe.copy(He[r].userData.resetPosition).sub(He[r].position),Xe.multiplyScalar(.1),He[r].position.add(Xe),Xe.length<.01&&(He[r].userData.animation=0))}}(e,t),function(e,t,r){var n=.98+.02*Math.sin(40*r);Ie.color.setRGB(n,n,n)}(0,0,r),function(e){bt.doorA.uniforms.time.value=e,bt.doorB.uniforms.time.value=e,bt.doorC.uniforms.time.value=e,bt.doorD.uniforms.time.value=e,bt.doorD.uniforms.selected.value=1,function(e){for(let t=0;t<Se.length;t++)Se[t].material.uniforms.time.value=t+e,Se[t].material.uniforms.selected.value+=.1*(Se[t].userData.selected-Se[t].material.uniforms.selected.value)}(e)}(r);for(var n=0;n<At.length;n++)At[n].scale.z>1&&(At[n].scale.z=Math.max(At[n].scale.z-t*At[n].scale.z,1))}var Tt,Rt,Lt,Ct=null;const Pt=5,Dt=["Tiger and Turtle - Magic Mountain\nArt installation in Agerpark, Germany.","Hiking trail at Lake Byllesby Regional Park near Cannon Falls, USA.","Dellwiger Bach natural reserve in Dortmund, Germany.","Zapporthorn summit in Lepontine Alps, Switzerland.","Ruin of romanesque Paulinzella abbey (1106) in Thuringia, Germany."];var It,Ot,Bt,Ft,Ut,Nt,Gt,zt,kt,Ht,Vt,jt,Wt,qt,Xt,Yt=[];function Qt(e){const t=e.assets,r=new c.SphereBufferGeometry(500,60,40);for(var n=0;n<Pt;n++){const e="pano"+(n+2);Yt[n]=new c.MeshBasicMaterial({map:t[e],side:c.BackSide})}Ct=new c.Mesh(r,Yt[0]),(Rt=t.hall_model.scene.getObjectByName("infopanel")).material=new c.MeshBasicMaterial({color:263172}),Rt.position.set(0,.1,0),Rt.parent.remove(Rt),(Lt=e.world.createEntity()).addComponent(X,{color:"#ffffff",fontSize:.02,anchor:"left",textAlign:"left",baseline:"center",maxWidth:.34,lineHeight:1.3,text:Dt[n]}).addComponent(q,{value:Rt}).addComponent(W,{x:-.17,y:.003,z:.01}),e.raycontrol.addState("panorama",{raycaster:!1,onSelectEnd:$t})}function Zt(e){e.renderer.setClearColor(0);const t=e.room-5;Lt.getMutableComponent(X).text=Dt[t],Ct.material=Yt[t],e.scene.add(Ct),e.controllers[1].add(Rt),e.raycontrol.activateState("panorama"),Tt=e}function Jt(e){e.scene.remove(Ct),e.controllers[1].remove(Rt),e.raycontrol.deactivateState("panorama")}function Kt(e,t,r){}function $t(e){Tt.goto=0}function er(e){const t=e.assets,r=new c.SphereBufferGeometry(500,60,40),n=new c.MeshBasicMaterial({map:t.stereopanoR,side:c.BackSide}),i=new c.MeshBasicMaterial({map:t.stereopanoL,side:c.BackSide});(It=new c.Mesh(r,n)).layers.set(1),(Ot=new c.Mesh(r,i)).layers.set(2),e.raycontrol.addState("panoramaStereo",{raycaster:!1,onSelectEnd:ir})}function tr(e){e.renderer.setClearColor(0),e.scene.add(It),e.scene.add(Ot),e.camera.layers.enable(1),Bt=e,e.raycontrol.activateState("panoramaStereo")}function rr(e){e.scene.remove(It),e.scene.remove(Ot),e.camera.layers.disable(1),e.raycontrol.deactivateState("panoramaStereo")}function nr(e,t,r){}function ir(e){Bt.goto=0}function ar(e){const t=e.assets;(Ft=t.pg_object_model.scene).rotation.y=-Math.PI/2,Ft.getObjectByName("object").material=new c.MeshBasicMaterial({map:t.pg_object_tex}),Ft.getObjectByName("floor").material=new c.MeshBasicMaterial({map:t.pg_floor_tex,lightMap:t.pg_floor_lm_tex}),Ft.getObjectByName("bg").material=new c.MeshBasicMaterial({map:t.pg_bg_tex}),Ft.getObjectByName("flare").material=new c.MeshBasicMaterial({map:t.pg_flare_tex,blending:c.AdditiveBlending}),Ft.getObjectByName("panel").material=new c.MeshBasicMaterial({map:t.pg_panel_tex}),Ft.getObjectByName("door_frame").material=new c.MeshBasicMaterial({map:t.pg_door_lm_tex}),Ut=function(e){return new c.ShaderMaterial({uniforms:{time:{value:0},selected:{value:0},tex:{value:e.assets.doorfx_tex}},vertexShader:e.shaders.basic_vert,fragmentShader:e.shaders.door_frag})}(e),(Nt=Ft.getObjectByName("door")).material=Ut,Ft.getObjectByName("teleport").visible=!1,e.raycontrol.addState("doorPhotogrammetry",{colliderMesh:Ft.getObjectByName("door"),onHover:(e,t)=>{const r=e.object.scale;r.z=Math.min(r.z+.05*(2-Nt.scale.z),1.5)},onHoverLeave:()=>{},onSelectStart:(t,r)=>{e.goto=0},onSelectEnd:e=>{}});let r=Ft.getObjectByName("teleport");r.visible=!0,r.material.visible=!1,e.raycontrol.addState("teleportPhotogrammetry",{colliderMesh:r,onHover:(t,r)=>{e.teleport.onHover(t.point,r)},onHoverLeave:()=>{e.teleport.onHoverLeave()},onSelectStart:(t,r)=>{e.teleport.onSelectStart(r)},onSelectEnd:t=>{e.teleport.onSelectEnd(t.point)}})}function or(e){e.renderer.setClearColor(0),e.scene.add(Ft),e.raycontrol.activateState("doorPhotogrammetry"),e.raycontrol.activateState("teleportPhotogrammetry")}function sr(e){e.raycontrol.deactivateState("doorPhotogrammetry"),e.raycontrol.deactivateState("teleportPhotogrammetry"),e.scene.remove(Ft)}function lr(e,t,r){Ut.uniforms.time.value=r,Nt.scale.z>.5&&(Nt.scale.z=Math.max(Nt.scale.z-t*Nt.scale.z,.5))}function cr(e){const t=e.assets;var r=t.checkboard_tex,n=t.vertigo_lm_tex;const i=new c.MeshBasicMaterial({color:16777215,map:r,lightMap:n});(Gt=t.vertigo_model.scene).getObjectByName("city").material=i,Gt.getObjectByName("teleport").visible=!1,Gt.getObjectByName("door_frame").material=new c.MeshBasicMaterial({map:t.vertigo_door_lm_tex}),zt=function(e){return new c.ShaderMaterial({uniforms:{time:{value:0},selected:{value:0},tex:{value:e.assets.doorfx_tex}},vertexShader:e.shaders.basic_vert,fragmentShader:e.shaders.door_frag})}(e),(kt=Gt.getObjectByName("door")).material=zt,e.raycontrol.addState("doorVertigo",{colliderMesh:Gt.getObjectByName("door"),onHover:(e,t)=>{const r=e.object.scale;r.z=Math.min(r.z+.02*(2-kt.scale.z),.8)},onHoverLeave:()=>{},onSelectStart:(t,r)=>{e.goto=0},onSelectEnd:e=>{}});let a=Gt.getObjectByName("teleport");a.visible=!0,a.material.visible=!1,e.raycontrol.addState("teleportVertigo",{colliderMesh:a,onHover:(t,r)=>{e.teleport.onHover(t.point,r)},onHoverLeave:()=>{e.teleport.onHoverLeave()},onSelectStart:(t,r)=>{e.teleport.onSelectStart(r)},onSelectEnd:t=>{e.teleport.onSelectEnd(t.point)}})}function ur(e){e.renderer.setClearColor(6782887),e.scene.add(Gt),e.scene.parent.fog=new c.FogExp2(6782887,.004),e.raycontrol.activateState("teleportVertigo"),e.raycontrol.activateState("doorVertigo")}function hr(e){e.scene.remove(Gt),e.scene.parent.fog=null,e.raycontrol.deactivateState("teleportVertigo"),e.raycontrol.deactivateState("doorVertigo")}function dr(e,t,r){zt.uniforms.time.value=r,kt.scale.z>.2&&(kt.scale.z=Math.max(kt.scale.z-t*kt.scale.z,.2))}const pr=["bells","horn","cowbell","guiro","mandolin","squeaker","train","whistle","motorhorn","surdo","trumpet"];var fr={};pr.forEach(e=>{fr[e]={animations:[],mesh:null,player:null,shadow:null}});const mr=3;var vr=mr-1;function gr(e){const t=e.assets;Ht=t.sound_model.scene,(qt=t.sound_door_model.scene).getObjectByName("door_frame").material=new c.MeshBasicMaterial({map:t.sound_door_lm_tex}),Xt=function(e){return new c.ShaderMaterial({uniforms:{time:{value:0},selected:{value:0},tex:{value:e.assets.doorfx_tex}},vertexShader:e.shaders.basic_vert,fragmentShader:e.shaders.door_frag})}(e),qt.getObjectByName("door").material=Xt,qt.scale.set(.5,.5,.5),qt.position.set(.4,.6,1),qt.rotation.set(0,.4,0),Vt=new c.AudioListener,Wt=new c.AnimationMixer(Ht);for(let e in fr){const r=Ht.getObjectByName(e);if(!r)continue;const n=new c.PositionalAudio(Vt);(new c.AudioLoader).load("assets/ogg/"+e+".ogg",e=>{n.setBuffer(e)}),fr[e].player=n,fr[e].mesh=r,r.visible=!1,r.add(n);const i=c.AnimationClip.findByName(t.sound_model.animations,e);if(i){const t=Wt.clipAction(i,r);t.loop=c.LoopOnce,fr[e].animations.push(t)}for(let n=0;n<r.children.length;n++){const i=r.children[n],a=c.AnimationClip.findByName(t.sound_model.animations,`${e}_${i.name}`);if(!a)continue;const o=Wt.clipAction(a,r);o.loop=c.LoopOnce,fr[e].animations.push(o)}let a=new c.Mesh(new c.PlaneBufferGeometry(3,3),new c.MeshBasicMaterial({color:r.children[0].material.color,map:t.sound_shadow_tex,transparent:!0,opacity:0,depthTest:!1,blending:c.AdditiveBlending}));a.position.set(r.position.x,.001,r.position.z),a.rotation.x=-Math.PI/2,Ht.add(a),fr[e].shadow=a}e.raycontrol.addState("sound",{colliderMesh:qt.getObjectByName("door"),onHover:(e,t)=>{const r=e.object.scale;r.z=Math.min(r.z+.05*(2-qt.scale.z),1.5)},onHoverLeave:()=>{},onSelectStart:(t,r)=>{e.goto=0},onSelectEnd:e=>{}});const r=t.grid_tex,n=new c.Mesh(new c.PlaneBufferGeometry(20,20),new c.MeshBasicMaterial({map:r}));Ht.add(n),n.rotation.x=-Math.PI/2,e.raycontrol.addState("teleportSound",{colliderMesh:n,onHover:(t,r)=>{e.teleport.onHover(t.point,r)},onHoverLeave:()=>{e.teleport.onHoverLeave()},onSelectStart:(t,r)=>{e.teleport.onSelectStart(r)},onSelectEnd:t=>{e.teleport.onSelectEnd(t.point)}})}var yr=-1;function xr(){let e;if(yr>=0&&((e=fr[pr[yr]]).player.stop(),e.animations.length&&(e.mesh.visible=!1,e.animations.forEach(e=>{e.stop()}))),++vr==mr){vr=0;do{yr=(yr+1)%pr.length,e=fr[pr[yr]]}while(!e.mesh)}e.player.play(),e.animations.length&&(e.mesh.visible=!0,e.animations.forEach(e=>{e.play()})),e.shadow.material.opacity=1,jt=setTimeout(xr,2e3)}function br(e){e.renderer.setClearColor(0),e.scene.add(Ht),e.scene.add(qt),e.camera.add(Vt),jt=setTimeout(xr,2e3),e.raycontrol.activateState("teleportSound"),e.raycontrol.activateState("sound")}function Ar(e){e.scene.remove(Ht),e.scene.remove(qt),e.camera.remove(Vt),e.raycontrol.deactivateState("teleportSound"),e.raycontrol.deactivateState("sound"),clearTimeout(jt)}function wr(e,t,r){Wt.update(t);const n=fr[pr[yr]];n&&n.shadow.material.opacity>0&&(n.shadow.material.opacity-=.5*t),Xt.uniforms.time.value=r,qt.scale.z>.5&&(qt.scale.z=Math.max(qt.scale.z-t*qt.scale.z,.5))}var _r={door_frag:"\nuniform float time;\nuniform float selected;\nuniform sampler2D tex;\nvarying vec2 vUv;\n\nvoid main( void ) {\n float t = time;\n vec2 uv = vUv * 2.0 - 1.0;\n vec2 puv = vec2(length(uv.xy), atan(uv.x, uv.y));\n vec4 col = texture2D(tex, vec2(log(puv.x) + t / 5.0, puv.y / 3.1415926 ));\n float glow = (1.0 - puv.x) * (0.5 + (sin(t) + 2.0 ) / 4.0);\n // blue glow\n col += vec4(118.0/255.0, 144.0/255.0, 219.0/255.0, 1.0) * (0.4 + glow * 1.0);\n // white glow\n col += vec4(0.2) * smoothstep(0.0, 2.0, glow * glow);\n gl_FragColor = col;\n\n}\n",zoom_frag:"\nuniform float time;\nuniform sampler2D tex;\nuniform vec2 zoomPos;\nuniform float zoomAmount;\nuniform float zoomRatio;\nvarying vec2 vUv;\n\nvoid main( void ) {\n float t = time;\n vec2 uv = vec2(vUv.x - 0.5, (1.0 - vUv.y) - 0.5);\n vec2 texUv = uv * vec2(zoomRatio, 1.0);\n vec4 col = texture2D(tex, zoomPos + texUv * zoomAmount);\n float dist = length(uv) * 2.0;\n col.a = smoothstep(0.0, 0.1, 1.0 - dist);\n float aura = smoothstep(0.80, 1.0, dist);\n col.rgb += aura * 0.3;\n gl_FragColor = col;\n}\n",basic_vert:"\nvarying vec2 vUv;\nvarying vec3 vPosition;\nvoid main()\n{\n vUv = uv;\n vPosition = position;\n vec4 mvPosition = modelViewMatrix * vec4(position, 1.0);\n gl_Position = projectionMatrix * mvPosition;\n}\n",panoball_vert:"\nvarying vec2 vUv;\nvarying vec3 vPosition;\nvarying vec3 vNormal;\nvarying vec3 vWorldPos;\nuniform float time;\nuniform float selected;\n\nmat4 inverse(mat4 m) {\n float\n a00 = m[0][0], a01 = m[0][1], a02 = m[0][2], a03 = m[0][3],\n a10 = m[1][0], a11 = m[1][1], a12 = m[1][2], a13 = m[1][3],\n a20 = m[2][0], a21 = m[2][1], a22 = m[2][2], a23 = m[2][3],\n a30 = m[3][0], a31 = m[3][1], a32 = m[3][2], a33 = m[3][3],\n\n b00 = a00 * a11 - a01 * a10,\n b01 = a00 * a12 - a02 * a10,\n b02 = a00 * a13 - a03 * a10,\n b03 = a01 * a12 - a02 * a11,\n b04 = a01 * a13 - a03 * a11,\n b05 = a02 * a13 - a03 * a12,\n b06 = a20 * a31 - a21 * a30,\n b07 = a20 * a32 - a22 * a30,\n b08 = a20 * a33 - a23 * a30,\n b09 = a21 * a32 - a22 * a31,\n b10 = a21 * a33 - a23 * a31,\n b11 = a22 * a33 - a23 * a32,\n\n det = b00 * b11 - b01 * b10 + b02 * b09 + b03 * b08 - b04 * b07 + b05 * b06;\n\n return mat4(\n a11 * b11 - a12 * b10 + a13 * b09,\n a02 * b10 - a01 * b11 - a03 * b09,\n a31 * b05 - a32 * b04 + a33 * b03,\n a22 * b04 - a21 * b05 - a23 * b03,\n a12 * b08 - a10 * b11 - a13 * b07,\n a00 * b11 - a02 * b08 + a03 * b07,\n a32 * b02 - a30 * b05 - a33 * b01,\n a20 * b05 - a22 * b02 + a23 * b01,\n a10 * b10 - a11 * b08 + a13 * b06,\n a01 * b08 - a00 * b10 - a03 * b06,\n a30 * b04 - a31 * b02 + a33 * b00,\n a21 * b02 - a20 * b04 - a23 * b00,\n a11 * b07 - a10 * b09 - a12 * b06,\n a00 * b09 - a01 * b07 + a02 * b06,\n a31 * b01 - a30 * b03 - a32 * b00,\n a20 * b03 - a21 * b01 + a22 * b00) / det;\n}\n\n\nmat4 transpose(in mat4 m) {\n vec4 i0 = m[0];\n vec4 i1 = m[1];\n vec4 i2 = m[2];\n vec4 i3 = m[3];\n\n return mat4(\n vec4(i0.x, i1.x, i2.x, i3.x),\n vec4(i0.y, i1.y, i2.y, i3.y),\n vec4(i0.z, i1.z, i2.z, i3.z),\n vec4(i0.w, i1.w, i2.w, i3.w)\n );\n}\n\nvoid main()\n{\n vUv = uv;\n\n vPosition = position;\n\n vec3 offset = vec3(\n sin(position.x * 50.0 + time),\n sin(position.y * 10.0 + time * 2.0),\n cos(position.z * 40.0 + time)\n ) * 0.003;\n\n vPosition *= 1.0 + selected * 0.2;\n\n vNormal = normalize(inverse(transpose(modelMatrix)) * vec4(normalize(normal), 1.0)).xyz;\n vWorldPos = (modelMatrix * vec4(vPosition, 1.0)).xyz;\n\n vec4 mvPosition = modelViewMatrix * vec4(vPosition + offset, 1.0);\n gl_Position = projectionMatrix * mvPosition;\n}\n",panoball_frag:"\nuniform sampler2D tex, texfx;\nuniform float time;\nuniform float selected;\nvarying vec2 vUv;\nvarying vec3 vPosition;\nvarying vec3 vNormal;\nvarying vec3 vWorldPos;\n\n\nvoid main( void ) {\n vec2 uv = vUv;\n //uv.y = 1.0 - uv.y;\n\n vec3 eye = normalize(cameraPosition - vWorldPos);\n float fresnel = abs(dot(eye, vNormal));\n float shift = pow((1.0 - fresnel), 4.0) * 0.05;\n\n vec3 col = vec3(\n texture2D(tex, uv - shift).r,\n texture2D(tex, uv).g,\n texture2D(tex, uv + shift).b\n );\n\n col = mix(col * 0.7, vec3(1.0), 0.7 - fresnel);\n\n col += selected * 0.3;\n\n float t = time * 0.4 + vPosition.x + vPosition.z;\n uv = vec2(vUv.x + t * 0.2, vUv.y + t);\n vec3 fx = texture2D(texfx, uv).rgb * 0.4;\n\n\n gl_FragColor = vec4(col + fx, 1.0);\n}\n",beam_frag:"\nuniform float time;\nuniform sampler2D tex;\nvarying vec2 vUv;\n\nvoid main( void ) {\n float t = time;\n vec4 col = texture2D(tex, vec2(vUv.x, vUv.y * 3.0 + time * 2.0));\n col *= vUv.y;\n gl_FragColor = col;\n}\n"},Mr=r(4);r.d(t,"init",(function(){return Yr}));new Mr.a;var Sr,Er,Tr,Rr,Lr,Cr,Pr,Dr,Ir,Or=new c.Clock,Br={},Fr=[],Ur=[n,l,o,s,a,i,i,i,i,i];const Nr=["hall","sound","photogrammetry","vertigo","panoramastereo","panorama1","panorama2","panorama3","panorama4","panorama5"],Gr=[!1,!1,"chopin_snd","wind_snd",!1,"birds_snd","birds_snd","forest_snd","wind_snd","birds_snd"],zr=new URL(window.location),kr=zr.searchParams.get("room");Br.room=-1!==Nr.indexOf(kr)?Nr.indexOf(kr):0;const Hr=zr.searchParams.has("debug"),Vr=zr.searchParams.has("handedness")?zr.searchParams.get("handedness"):"right",jr={hall:{sound:new c.Vector3(0,0,0),photogrammetry:new c.Vector3(1,0,0),vertigo:new c.Vector3(0,0,0)},photogrammetry:{hall:new c.Vector3(-3.6,0,2.8)},sound:{hall:new c.Vector3(4.4,0,4.8)},vertigo:{hall:new c.Vector3(-1.8,0,-5)}};function Wr(e){Ur[Br.room].exit(Br),Cr.deactivateAll();const t=Nr[Br.room],r=Nr[e];if(jr[t]&&jr[t][r]){let e=new c.Vector3;const i=jr[t][r];var n=Tr.xr.getCamera(Br.camera);e.x=n.position.x-i.x,e.z=n.position.z-i.z,Br.cameraRig.position.sub(e)}Br.room=e,function(e){Ir.source&&Ir.stop();const t=Gr[e];if(!t)return;Ir.setBuffer(ye[t]),Ir.setLoop(!0),Ir.setVolume(1),Ir.offset=60*Math.random(),Ir.play()}(e),Ur[Br.room].enter(Br)}var qr,Xr={};function Yr(){document.getElementById(Vr+"hand").classList.add("activehand"),"xr"in navigator?navigator.xr.isSessionSupported("immersive-vr").then(e=>{e||document.getElementById("no-webxr").classList.remove("hidden")}):document.getElementById("no-webxr").classList.remove("hidden");(qr=new b.e).registerSystem(ae).registerSystem(le).registerSystem(ce).registerSystem(se).registerSystem(pe).registerSystem(ve).registerSystem(ue),Xr.roomHall=new ge(qr,[le,ce,se]),(Tr=new c.WebGLRenderer({antialias:!0,logarithmicDepthBuffer:!1})).gammaFactor=2.2,Tr.outputEncoding=c.sRGBEncoding,Tr.setPixelRatio(window.devicePixelRatio),Tr.setSize(window.innerWidth,window.innerHeight),Tr.xr.enabled=!0,Sr=new c.Scene,(Rr=new c.PerspectiveCamera(80,window.innerWidth/window.innerHeight,.005,1e4)).position.set(0,1.6,0),Dr=new c.AudioListener,Rr.add(Dr),Ir=new c.Audio(Dr),Lr=new u(Rr,Tr.domElement),document.body.addEventListener("click",()=>Lr.lock()),Hr&&document.body.addEventListener("keydown",e=>{switch(e.keyCode){case 87:Lr.moveForward(.2);break;case 65:Lr.moveRight(-.2);break;case 83:Lr.moveForward(-.2);break;case 68:Lr.moveRight(.2);break;case 78:Wr((Br.room+1)%Ur.length);break;default:var t=e.keyCode-48;!e.metaKey&&t>=0&&t<Ur.length&&Wr(t)}}),Sr.add(Lr.getObject()),Er=new c.Object3D,Sr.add(Er),window.addEventListener("resize",en,!1);for(let e=0;e<2;e++)Fr[e]=Tr.xr.getController(e),Fr[e].raycaster=new c.Raycaster,Fr[e].raycaster.near=.1,Fr[e].addEventListener("selectstart",Kr),Fr[e].addEventListener("selectend",$r);const e=new c.DirectionalLight(15663103);e.name="sun",e.position.set(.2,1,.1);const t=new c.DirectionalLight(16773358,.3);t.name="fillLight",t.position.set(-.2,-1,-.1),Sr.add(e,t);var r=new c.Group;r.add(Rr),r.add(Fr[0]),r.add(Fr[1]),r.position.set(0,0,2),Sr.add(r),Br.assets=ye,Br.shaders=_r,Br.scene=Er,Br.renderer=Tr,Br.camera=Rr,Br.audioListener=Dr,Br.goto=null,Br.cameraRig=r,Br.controllers=Fr,Br.world=qr,Br.systemsGroup=Xr,Br.handedness=Vr,window.context=Br;const n=Object.keys(ye).length;!function(e,t,r,n,i,a){t&&"/"!=t[t.length-1]&&(t+="/");var o=new d;o.setTranscoderPath(v),o.detectSupport(e);var s=new p,l=new m;l.setDecoderPath(g),s.setDRACOLoader(l);var u=new c.TextureLoader,h={gltf:s,glb:s,obj:new f,gif:u,png:u,jpg:u,basis:o,font:new c.FontLoader,ogg:new c.AudioLoader};for(var b in r){let e=b,o=r[b].url;r[b].loading=!0;let s=o.substr(o.lastIndexOf(".")+1).toLowerCase();h[s].load(t+o,t=>{a&&console.info(`%c ${o} loaded`,"color:green");var l=r[e].options;if(r[e]="font"==s?t.data:t,void 0!==l){void 0!==l.repeat&&(r[e].repeat.set(l.repeat[0],l.repeat[1]),delete l.repeat);for(let t in l)r[e][t]=l[t];i&&i(y(r))}n&&x(r)&&n()},()=>{},e=>{console.error("Error loading asset",e)})}}(Tr,"assets/",ye,()=>{Cr=new _e(Br,Vr),Br.raycontrol=Cr,Pr=new Me(Br),Br.teleport=Pr,function(){var e=ye.generic_controller_model.scene,t=new c.MeshLambertMaterial({map:ye.controller_tex});e.getObjectByName("body").material=t,e.getObjectByName("trigger").material=t;for(let t=0;t<2;t++){let r=Fr[t];r.boundingBox=new c.Box3,r.userData.grabbing=null,r.addEventListener("connected",(function(t){this.add(e.clone()),Cr.addController(this,t.data)})),r.addEventListener("disconnect",(function(){this.remove(this.children[0]),Cr.removeController(this,event.data)}))}}(),_t(Br),Qt(Br),er(Br),ar(Br),cr(Br),gr(Br),Ur[Br.room].enter(Br),document.body.appendChild(Tr.domElement),document.body.appendChild(h.createButton(Tr)),Tr.setAnimationLoop(tn),document.getElementById("loading").style.display="none"},e=>{document.querySelector("#progressbar").setAttribute("stroke-dashoffset",-(282-Math.floor(e/n*282)))},Hr)}var Qr={},Zr={},Jr=-1!==navigator.userAgent.indexOf("OculusBrowser")&&parseInt(navigator.userAgent.match(/OculusBrowser\/([0-9]+)./)[1])<8;function Kr(e){if(Jr){const t=e.target;if(!Qr[t])return void(Qr[t]=!0);Qr[t]=!1}e.target.getObjectByName("trigger").rotation.x=-.3,Cr.onSelectStart(e)}function $r(e){if(Jr){const t=e.target;if(!Zr[t])return void(Zr[t]=!0);Zr[t]=!1}e.target.getObjectByName("trigger").rotation.x=0,Cr.onSelectEnd(e)}function en(){Rr.aspect=window.innerWidth/window.innerHeight,Rr.updateProjectionMatrix(),Tr.setSize(window.innerWidth,window.innerHeight)}function tn(){var e=Or.getDelta(),t=Or.elapsedTime;qr.execute(e,t);for(let e=0;e<Fr.length;e++){const t=Fr[e].getObjectByName("Scene");t&&Fr[e].boundingBox.setFromObject(t)}Br.raycontrol.execute(Br,e,t),Ur[Br.room].execute(Br,e,t),Tr.render(Sr,Rr),null!==Br.goto&&(Wr(Br.goto),Br.goto=null)}window.onload=()=>{Yr()}}]);
//# sourceMappingURL=bundle.js.map