From 3624c32f93f9c819899ccdb17adc1e5fdf413189 Mon Sep 17 00:00:00 2001 From: siyangy Date: Wed, 13 Sep 2017 13:14:47 -0700 Subject: [PATCH] Dreamview: Improve ipad frontend perf --- modules/dreamview/frontend/dist/app.bundle.js | 22 ++++--------------- .../dreamview/frontend/dist/app.bundle.js.map | 2 +- .../dreamview/frontend/src/renderer/index.js | 14 +++++++++++- 3 files changed, 18 insertions(+), 20 deletions(-) diff --git a/modules/dreamview/frontend/dist/app.bundle.js b/modules/dreamview/frontend/dist/app.bundle.js index 8d2bf9d564..1bb18e34c7 100644 --- a/modules/dreamview/frontend/dist/app.bundle.js +++ b/modules/dreamview/frontend/dist/app.bundle.js @@ -1,28 +1,14 @@ -!function(t){function e(r){if(n[r])return n[r].exports;var i=n[r]={i:r,l:!1,exports:{}};return t[r].call(i.exports,i,i.exports,e),i.l=!0,i.exports}var n={};e.m=t,e.c=n,e.i=function(t){return t},e.d=function(t,n,r){e.o(t,n)||Object.defineProperty(t,n,{configurable:!1,enumerable:!0,get:r})},e.n=function(t){var n=t&&t.__esModule?function(){return t.default}:function(){return t};return e.d(n,"a",n),n},e.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},e.p="/",e(e.s=152)}([function(t,e,n){"use strict";function r(t,e,n,r,o,a,s,u){if(i(e),!t){var c;if(void 0===e)c=new Error("Minified exception occurred; use the non-minified dev environment for the full error message and additional helpful warnings.");else{var l=[n,r,o,a,s,u],h=0;c=new Error(e.replace(/%s/g,function(){return l[h++]})),c.name="Invariant Violation"}throw c.framesToPop=1,c}}var i=function(t){};t.exports=r},function(t,e,n){"use strict";e.__esModule=!0,e.default=function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}},function(t,e,n){"use strict";e.__esModule=!0;var r=n(30),i=function(t){return t&&t.__esModule?t:{default:t}}(r);e.default=function(){function t(t,e){for(var n=0;n0&&console.error("THREE.Matrix4: the constructor no longer reads arguments. use .set() instead.")}function p(t,e,n,r,i,a,s,u,c,l){t=void 0!==t?t:[],e=void 0!==e?e:ta,o.call(this,t,e,n,r,i,a,s,u,c,l),this.flipY=!1}function f(){this.seq=[],this.map={}}function d(t,e,n){var r=t[0];if(r<=0||r>0)return t;var i=e*n,o=gs[i];if(void 0===o&&(o=new Float32Array(i),gs[i]=o),0!==e){r.toArray(o,0);for(var a=1,s=0;a!==e;++a)s+=n,t[a].toArray(o,s)}return o}function m(t,e){var n=ys[e];void 0===n&&(n=new Int32Array(e),ys[e]=n);for(var r=0;r!==e;++r)n[r]=t.allocTextureUnit();return n}function v(t,e){t.uniform1f(this.addr,e)}function g(t,e){t.uniform1i(this.addr,e)}function y(t,e){void 0===e.x?t.uniform2fv(this.addr,e):t.uniform2f(this.addr,e.x,e.y)}function b(t,e){void 0!==e.x?t.uniform3f(this.addr,e.x,e.y,e.z):void 0!==e.r?t.uniform3f(this.addr,e.r,e.g,e.b):t.uniform3fv(this.addr,e)}function x(t,e){void 0===e.x?t.uniform4fv(this.addr,e):t.uniform4f(this.addr,e.x,e.y,e.z,e.w)}function _(t,e){t.uniformMatrix2fv(this.addr,!1,e.elements||e)}function w(t,e){t.uniformMatrix3fv(this.addr,!1,e.elements||e)}function E(t,e){t.uniformMatrix4fv(this.addr,!1,e.elements||e)}function M(t,e,n){var r=n.allocTextureUnit();t.uniform1i(this.addr,r),n.setTexture2D(e||ms,r)}function T(t,e,n){var r=n.allocTextureUnit();t.uniform1i(this.addr,r),n.setTextureCube(e||vs,r)}function S(t,e){t.uniform2iv(this.addr,e)}function A(t,e){t.uniform3iv(this.addr,e)}function C(t,e){t.uniform4iv(this.addr,e)}function P(t){switch(t){case 5126:return v;case 35664:return y;case 35665:return b;case 35666:return x;case 35674:return _;case 35675:return w;case 35676:return E;case 35678:return M;case 35680:return T;case 5124:case 35670:return g;case 35667:case 35671:return S;case 35668:case 35672:return A;case 35669:case 35673:return C}}function R(t,e){t.uniform1fv(this.addr,e)}function L(t,e){t.uniform1iv(this.addr,e)}function O(t,e){t.uniform2fv(this.addr,d(e,this.size,2))}function I(t,e){t.uniform3fv(this.addr,d(e,this.size,3))}function N(t,e){t.uniform4fv(this.addr,d(e,this.size,4))}function D(t,e){t.uniformMatrix2fv(this.addr,!1,d(e,this.size,4))}function k(t,e){t.uniformMatrix3fv(this.addr,!1,d(e,this.size,9))}function U(t,e){t.uniformMatrix4fv(this.addr,!1,d(e,this.size,16))}function F(t,e,n){var r=e.length,i=m(n,r);t.uniform1iv(this.addr,i);for(var o=0;o!==r;++o)n.setTexture2D(e[o]||ms,i[o])}function B(t,e,n){var r=e.length,i=m(n,r);t.uniform1iv(this.addr,i);for(var o=0;o!==r;++o)n.setTextureCube(e[o]||vs,i[o])}function z(t){switch(t){case 5126:return R;case 35664:return O;case 35665:return I;case 35666:return N;case 35674:return D;case 35675:return k;case 35676:return U;case 35678:return F;case 35680:return B;case 5124:case 35670:return L;case 35667:case 35671:return S;case 35668:case 35672:return A;case 35669:case 35673:return C}}function j(t,e,n){this.id=t,this.addr=n,this.setValue=P(e.type)}function V(t,e,n){this.id=t,this.addr=n,this.size=e.size,this.setValue=z(e.type)}function H(t){this.id=t,f.call(this)}function G(t,e){t.seq.push(e),t.map[e.id]=e}function W(t,e,n){var r=t.name,i=r.length;for(bs.lastIndex=0;;){var o=bs.exec(r),a=bs.lastIndex,s=o[1],u="]"===o[2],c=o[3];if(u&&(s|=0),void 0===c||"["===c&&a+2===i){G(n,void 0===c?new j(s,t,e):new V(s,t,e));break}var l=n.map,h=l[s];void 0===h&&(h=new H(s),G(n,h)),n=h}}function X(t,e,n){f.call(this),this.renderer=n;for(var r=t.getProgramParameter(e,t.ACTIVE_UNIFORMS),i=0;i.001&&L.scale>.001&&(E.x=L.x,E.y=L.y,E.z=L.z,_=L.size*L.scale/v.w,w.x=_*y,w.y=_,d.uniform3f(h.screenPosition,E.x,E.y,E.z),d.uniform2f(h.scale,w.x,w.y),d.uniform1f(h.rotation,L.rotation),d.uniform1f(h.opacity,L.opacity),d.uniform3f(h.color,L.color.r,L.color.g,L.color.b),m.setBlending(L.blending,L.blendEquation,L.blendSrc,L.blendDst),t.setTexture2D(L.texture,1),d.drawElements(d.TRIANGLES,6,d.UNSIGNED_SHORT,0))}}}m.enable(d.CULL_FACE),m.enable(d.DEPTH_TEST),m.setDepthWrite(!0),t.resetGLState()}}}function J(t,e){function n(){var t=new Float32Array([-.5,-.5,0,0,.5,-.5,1,0,.5,.5,1,1,-.5,.5,0,1]),e=new Uint16Array([0,1,2,0,2,3]);a=d.createBuffer(),s=d.createBuffer(),d.bindBuffer(d.ARRAY_BUFFER,a),d.bufferData(d.ARRAY_BUFFER,t,d.STATIC_DRAW),d.bindBuffer(d.ELEMENT_ARRAY_BUFFER,s),d.bufferData(d.ELEMENT_ARRAY_BUFFER,e,d.STATIC_DRAW),u=r(),h={position:d.getAttribLocation(u,"position"),uv:d.getAttribLocation(u,"uv")},p={uvOffset:d.getUniformLocation(u,"uvOffset"),uvScale:d.getUniformLocation(u,"uvScale"),rotation:d.getUniformLocation(u,"rotation"),scale:d.getUniformLocation(u,"scale"),color:d.getUniformLocation(u,"color"),map:d.getUniformLocation(u,"map"),opacity:d.getUniformLocation(u,"opacity"),modelViewMatrix:d.getUniformLocation(u,"modelViewMatrix"),projectionMatrix:d.getUniformLocation(u,"projectionMatrix"),fogType:d.getUniformLocation(u,"fogType"),fogDensity:d.getUniformLocation(u,"fogDensity"),fogNear:d.getUniformLocation(u,"fogNear"),fogFar:d.getUniformLocation(u,"fogFar"),fogColor:d.getUniformLocation(u,"fogColor"),alphaTest:d.getUniformLocation(u,"alphaTest")};var n=document.createElementNS("http://www.w3.org/1999/xhtml","canvas");n.width=8,n.height=8;var i=n.getContext("2d");i.fillStyle="white",i.fillRect(0,0,8,8),f=new o(n),f.needsUpdate=!0}function r(){var e=d.createProgram(),n=d.createShader(d.VERTEX_SHADER),r=d.createShader(d.FRAGMENT_SHADER);return d.shaderSource(n,["precision "+t.getPrecision()+" float;","uniform mat4 modelViewMatrix;","uniform mat4 projectionMatrix;","uniform float rotation;","uniform vec2 scale;","uniform vec2 uvOffset;","uniform vec2 uvScale;","attribute vec2 position;","attribute vec2 uv;","varying vec2 vUV;","void main() {","vUV = uvOffset + uv * uvScale;","vec2 alignedPosition = position * scale;","vec2 rotatedPosition;","rotatedPosition.x = cos( rotation ) * alignedPosition.x - sin( rotation ) * alignedPosition.y;","rotatedPosition.y = sin( rotation ) * alignedPosition.x + cos( rotation ) * alignedPosition.y;","vec4 finalPosition;","finalPosition = modelViewMatrix * vec4( 0.0, 0.0, 0.0, 1.0 );","finalPosition.xy += rotatedPosition;","finalPosition = projectionMatrix * finalPosition;","gl_Position = finalPosition;","}"].join("\n")),d.shaderSource(r,["precision "+t.getPrecision()+" float;","uniform vec3 color;","uniform sampler2D map;","uniform float opacity;","uniform int fogType;","uniform vec3 fogColor;","uniform float fogDensity;","uniform float fogNear;","uniform float fogFar;","uniform float alphaTest;","varying vec2 vUV;","void main() {","vec4 texture = texture2D( map, vUV );","if ( texture.a < alphaTest ) discard;","gl_FragColor = vec4( color * texture.xyz, texture.a * opacity );","if ( fogType > 0 ) {","float depth = gl_FragCoord.z / gl_FragCoord.w;","float fogFactor = 0.0;","if ( fogType == 1 ) {","fogFactor = smoothstep( fogNear, fogFar, depth );","} else {","const float LOG2 = 1.442695;","fogFactor = exp2( - fogDensity * fogDensity * depth * depth * LOG2 );","fogFactor = 1.0 - clamp( fogFactor, 0.0, 1.0 );","}","gl_FragColor = mix( gl_FragColor, vec4( fogColor, gl_FragColor.w ), fogFactor );","}","}"].join("\n")),d.compileShader(n),d.compileShader(r),d.attachShader(e,n),d.attachShader(e,r),d.linkProgram(e),e}function i(t,e){return t.renderOrder!==e.renderOrder?t.renderOrder-e.renderOrder:t.z!==e.z?e.z-t.z:e.id-t.id}var a,s,u,h,p,f,d=t.context,m=t.state,v=new l,g=new c,y=new l;this.render=function(r,o){if(0!==e.length){void 0===u&&n(),d.useProgram(u),m.initAttributes(),m.enableAttribute(h.position),m.enableAttribute(h.uv),m.disableUnusedAttributes(),m.disable(d.CULL_FACE),m.enable(d.BLEND),d.bindBuffer(d.ARRAY_BUFFER,a),d.vertexAttribPointer(h.position,2,d.FLOAT,!1,16,0),d.vertexAttribPointer(h.uv,2,d.FLOAT,!1,16,8),d.bindBuffer(d.ELEMENT_ARRAY_BUFFER,s),d.uniformMatrix4fv(p.projectionMatrix,!1,o.projectionMatrix.elements),m.activeTexture(d.TEXTURE0),d.uniform1i(p.map,0);var c=0,l=0,b=r.fog;b?(d.uniform3f(p.fogColor,b.color.r,b.color.g,b.color.b),b.isFog?(d.uniform1f(p.fogNear,b.near),d.uniform1f(p.fogFar,b.far),d.uniform1i(p.fogType,1),c=1,l=1):b.isFogExp2&&(d.uniform1f(p.fogDensity,b.density),d.uniform1i(p.fogType,2),c=2,l=2)):(d.uniform1i(p.fogType,0),c=0,l=0);for(var x=0,_=e.length;x<_;x++){var w=e[x];w.modelViewMatrix.multiplyMatrices(o.matrixWorldInverse,w.matrixWorld),w.z=-w.modelViewMatrix.elements[14]}e.sort(i);for(var E=[],x=0,_=e.length;x<_;x++){var w=e[x],M=w.material;if(!1!==M.visible){d.uniform1f(p.alphaTest,M.alphaTest),d.uniformMatrix4fv(p.modelViewMatrix,!1,w.modelViewMatrix.elements),w.matrixWorld.decompose(v,g,y),E[0]=y.x,E[1]=y.y;var T=0;r.fog&&M.fog&&(T=l),c!==T&&(d.uniform1i(p.fogType,T),c=T),null!==M.map?(d.uniform2f(p.uvOffset,M.map.offset.x,M.map.offset.y),d.uniform2f(p.uvScale,M.map.repeat.x,M.map.repeat.y)):(d.uniform2f(p.uvOffset,0,0),d.uniform2f(p.uvScale,1,1)),d.uniform1f(p.opacity,M.opacity),d.uniform3f(p.color,M.color.r,M.color.g,M.color.b),d.uniform1f(p.rotation,M.rotation),d.uniform2fv(p.scale,E),m.setBlending(M.blending,M.blendEquation,M.blendSrc,M.blendDst),m.setDepthTest(M.depthTest),m.setDepthWrite(M.depthWrite),M.map?t.setTexture2D(M.map,0):t.setTexture2D(f,0),d.drawElements(d.TRIANGLES,6,d.UNSIGNED_SHORT,0)}}m.enable(d.CULL_FACE),t.resetGLState()}}}function $(){Object.defineProperty(this,"id",{value:Ts++}),this.uuid=fs.generateUUID(),this.name="",this.type="Material",this.fog=!0,this.lights=!0,this.blending=vo,this.side=ao,this.shading=lo,this.vertexColors=ho,this.opacity=1,this.transparent=!1,this.blendSrc=Ro,this.blendDst=Lo,this.blendEquation=_o,this.blendSrcAlpha=null,this.blendDstAlpha=null,this.blendEquationAlpha=null,this.depthFunc=zo,this.depthTest=!0,this.depthWrite=!0,this.clippingPlanes=null,this.clipIntersection=!1,this.clipShadows=!1,this.colorWrite=!0,this.precision=null,this.polygonOffset=!1,this.polygonOffsetFactor=0,this.polygonOffsetUnits=0,this.alphaTest=0,this.premultipliedAlpha=!1,this.overdraw=0,this.visible=!0,this._needsUpdate=!0}function Q(t){$.call(this),this.type="ShaderMaterial",this.defines={},this.uniforms={},this.vertexShader="void main() {\n\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",this.fragmentShader="void main() {\n\tgl_FragColor = vec4( 1.0, 0.0, 0.0, 1.0 );\n}",this.linewidth=1,this.wireframe=!1,this.wireframeLinewidth=1,this.fog=!1,this.lights=!1,this.clipping=!1,this.skinning=!1,this.morphTargets=!1,this.morphNormals=!1,this.extensions={derivatives:!1,fragDepth:!1,drawBuffers:!1,shaderTextureLOD:!1},this.defaultAttributeValues={color:[1,1,1],uv:[0,0],uv2:[0,0]},this.index0AttributeName=void 0,void 0!==t&&(void 0!==t.attributes&&console.error("THREE.ShaderMaterial: attributes should now be defined in THREE.BufferGeometry instead."),this.setValues(t))}function tt(t){$.call(this),this.type="MeshDepthMaterial",this.depthPacking=hs,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.lights=!1,this.setValues(t)}function et(t,e){this.min=void 0!==t?t:new l(1/0,1/0,1/0),this.max=void 0!==e?e:new l(-1/0,-1/0,-1/0)}function nt(t,e){this.center=void 0!==t?t:new l,this.radius=void 0!==e?e:0}function rt(){this.elements=new Float32Array([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.")}function it(t,e){this.normal=void 0!==t?t:new l(1,0,0),this.constant=void 0!==e?e:0}function ot(t,e,n,r,i,o){this.planes=[void 0!==t?t:new it,void 0!==e?e:new it,void 0!==n?n:new it,void 0!==r?r:new it,void 0!==i?i:new it,void 0!==o?o:new it]}function at(t,e,n,r){function o(e,n,r,i){var o=e.geometry,a=null,s=M,u=e.customDepthMaterial;if(r&&(s=T,u=e.customDistanceMaterial),u)a=u;else{var c=!1;n.morphTargets&&(o&&o.isBufferGeometry?c=o.morphAttributes&&o.morphAttributes.position&&o.morphAttributes.position.length>0:o&&o.isGeometry&&(c=o.morphTargets&&o.morphTargets.length>0));var l=e.isSkinnedMesh&&n.skinning,h=0;c&&(h|=_),l&&(h|=w),a=s[h]}if(t.localClippingEnabled&&!0===n.clipShadows&&0!==n.clippingPlanes.length){var p=a.uuid,f=n.uuid,d=S[p];void 0===d&&(d={},S[p]=d);var m=d[f];void 0===m&&(m=a.clone(),d[f]=m),a=m}a.visible=n.visible,a.wireframe=n.wireframe;var v=n.side;return F.renderSingleSided&&v==uo&&(v=ao),F.renderReverseSided&&(v===ao?v=so:v===so&&(v=ao)),a.side=v,a.clipShadows=n.clipShadows,a.clippingPlanes=n.clippingPlanes,a.wireframeLinewidth=n.wireframeLinewidth,a.linewidth=n.linewidth,r&&void 0!==a.uniforms.lightPos&&a.uniforms.lightPos.value.copy(i),a}function u(t,e,n){if(!1!==t.visible){if(0!=(t.layers.mask&e.layers.mask)&&(t.isMesh||t.isLine||t.isPoints)&&t.castShadow&&(!1===t.frustumCulled||!0===f.intersectsObject(t))){!0===t.material.visible&&(t.modelViewMatrix.multiplyMatrices(n.matrixWorldInverse,t.matrixWorld),x.push(t))}for(var r=t.children,i=0,o=r.length;in&&(n=t[e]);return n}function At(){return As++}function Ct(){Object.defineProperty(this,"id",{value:At()}),this.uuid=fs.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}function Pt(){Object.defineProperty(this,"id",{value:At()}),this.uuid=fs.generateUUID(),this.name="",this.type="BufferGeometry",this.index=null,this.attributes={},this.morphAttributes={},this.groups=[],this.boundingBox=null,this.boundingSphere=null,this.drawRange={start:0,count:1/0}}function Rt(t,e){lt.call(this),this.type="Mesh",this.geometry=void 0!==t?t:new Pt,this.material=void 0!==e?e:new dt({color:16777215*Math.random()}),this.drawMode=ts,this.updateMorphTargets()}function Lt(t,e,n,r,i,o){Ct.call(this),this.type="BoxGeometry",this.parameters={width:t,height:e,depth:n,widthSegments:r,heightSegments:i,depthSegments:o},this.fromBufferGeometry(new Ot(t,e,n,r,i,o)),this.mergeVertices()}function Ot(t,e,n,r,i,o){function a(t,e,n,r,i,o,a,m,v,g,y){var b,x,_=o/v,w=a/g,E=o/2,M=a/2,T=m/2,S=v+1,A=g+1,C=0,P=0,R=new l;for(x=0;x0?1:-1,h.push(R.x,R.y,R.z),p.push(b/v),p.push(1-x/g),C+=1}}for(x=0;x");return $t(n)}var n=/#include +<([\w\d.]+)>/g;return t.replace(n,e)}function Qt(t){function e(t,e,n,r){for(var i="",o=parseInt(e);o0?t.gammaFactor:1,v=qt(o,r,t.extensions),g=Yt(a),y=i.createProgram();n.isRawShaderMaterial?(f=[g,"\n"].filter(Kt).join("\n"),d=[v,g,"\n"].filter(Kt).join("\n")):(f=["precision "+r.precision+" float;","precision "+r.precision+" int;","#define SHADER_NAME "+n.__webglShader.name,g,r.supportsVertexTextures?"#define VERTEX_TEXTURES":"","#define GAMMA_FACTOR "+m,"#define MAX_BONES "+r.maxBones,r.useFog&&r.fog?"#define USE_FOG":"",r.useFog&&r.fogExp?"#define FOG_EXP2":"",r.map?"#define USE_MAP":"",r.envMap?"#define USE_ENVMAP":"",r.envMap?"#define "+h:"",r.lightMap?"#define USE_LIGHTMAP":"",r.aoMap?"#define USE_AOMAP":"",r.emissiveMap?"#define USE_EMISSIVEMAP":"",r.bumpMap?"#define USE_BUMPMAP":"",r.normalMap?"#define USE_NORMALMAP":"",r.displacementMap&&r.supportsVertexTextures?"#define USE_DISPLACEMENTMAP":"",r.specularMap?"#define USE_SPECULARMAP":"",r.roughnessMap?"#define USE_ROUGHNESSMAP":"",r.metalnessMap?"#define USE_METALNESSMAP":"",r.alphaMap?"#define USE_ALPHAMAP":"",r.vertexColors?"#define USE_COLOR":"",r.flatShading?"#define FLAT_SHADED":"",r.skinning?"#define USE_SKINNING":"",r.useVertexTexture?"#define BONE_TEXTURE":"",r.morphTargets?"#define USE_MORPHTARGETS":"",r.morphNormals&&!1===r.flatShading?"#define USE_MORPHNORMALS":"",r.doubleSided?"#define DOUBLE_SIDED":"",r.flipSided?"#define FLIP_SIDED":"","#define NUM_CLIPPING_PLANES "+r.numClippingPlanes,r.shadowMapEnabled?"#define USE_SHADOWMAP":"",r.shadowMapEnabled?"#define "+c:"",r.sizeAttenuation?"#define USE_SIZEATTENUATION":"",r.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",r.logarithmicDepthBuffer&&t.extensions.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;","attribute vec3 position;","attribute vec3 normal;","attribute vec2 uv;","#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(Kt).join("\n"),d=[v,"precision "+r.precision+" float;","precision "+r.precision+" int;","#define SHADER_NAME "+n.__webglShader.name,g,r.alphaTest?"#define ALPHATEST "+r.alphaTest:"","#define GAMMA_FACTOR "+m,r.useFog&&r.fog?"#define USE_FOG":"",r.useFog&&r.fogExp?"#define FOG_EXP2":"",r.map?"#define USE_MAP":"",r.envMap?"#define USE_ENVMAP":"",r.envMap?"#define "+l:"",r.envMap?"#define "+h:"",r.envMap?"#define "+p:"",r.lightMap?"#define USE_LIGHTMAP":"",r.aoMap?"#define USE_AOMAP":"",r.emissiveMap?"#define USE_EMISSIVEMAP":"",r.bumpMap?"#define USE_BUMPMAP":"",r.normalMap?"#define USE_NORMALMAP":"",r.specularMap?"#define USE_SPECULARMAP":"",r.roughnessMap?"#define USE_ROUGHNESSMAP":"",r.metalnessMap?"#define USE_METALNESSMAP":"",r.alphaMap?"#define USE_ALPHAMAP":"",r.vertexColors?"#define USE_COLOR":"",r.gradientMap?"#define USE_GRADIENTMAP":"",r.flatShading?"#define FLAT_SHADED":"",r.doubleSided?"#define DOUBLE_SIDED":"",r.flipSided?"#define FLIP_SIDED":"","#define NUM_CLIPPING_PLANES "+r.numClippingPlanes,"#define UNION_CLIPPING_PLANES "+(r.numClippingPlanes-r.numClipIntersection),r.shadowMapEnabled?"#define USE_SHADOWMAP":"",r.shadowMapEnabled?"#define "+c:"",r.premultipliedAlpha?"#define PREMULTIPLIED_ALPHA":"",r.physicallyCorrectLights?"#define PHYSICALLY_CORRECT_LIGHTS":"",r.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",r.logarithmicDepthBuffer&&t.extensions.get("EXT_frag_depth")?"#define USE_LOGDEPTHBUF_EXT":"",r.envMap&&t.extensions.get("EXT_shader_texture_lod")?"#define TEXTURE_LOD_EXT":"","uniform mat4 viewMatrix;","uniform vec3 cameraPosition;",r.toneMapping!==Yo?"#define TONE_MAPPING":"",r.toneMapping!==Yo?_s.tonemapping_pars_fragment:"",r.toneMapping!==Yo?Xt("toneMapping",r.toneMapping):"",r.outputEncoding||r.mapEncoding||r.envMapEncoding||r.emissiveMapEncoding?_s.encodings_pars_fragment:"",r.mapEncoding?Gt("mapTexelToLinear",r.mapEncoding):"",r.envMapEncoding?Gt("envMapTexelToLinear",r.envMapEncoding):"",r.emissiveMapEncoding?Gt("emissiveMapTexelToLinear",r.emissiveMapEncoding):"",r.outputEncoding?Wt("linearToOutputTexel",r.outputEncoding):"",r.depthPacking?"#define DEPTH_PACKING "+n.depthPacking:"","\n"].filter(Kt).join("\n")),s=$t(s,r),s=Jt(s,r),u=$t(u,r),u=Jt(u,r),n.isShaderMaterial||(s=Qt(s),u=Qt(u));var b=f+s,x=d+u,_=Vt(i,i.VERTEX_SHADER,b),w=Vt(i,i.FRAGMENT_SHADER,x);i.attachShader(y,_),i.attachShader(y,w),void 0!==n.index0AttributeName?i.bindAttribLocation(y,0,n.index0AttributeName):!0===r.morphTargets&&i.bindAttribLocation(y,0,"position"),i.linkProgram(y);var E=i.getProgramInfoLog(y),M=i.getShaderInfoLog(_),T=i.getShaderInfoLog(w),S=!0,A=!0;!1===i.getProgramParameter(y,i.LINK_STATUS)?(S=!1,console.error("THREE.WebGLProgram: shader error: ",i.getError(),"gl.VALIDATE_STATUS",i.getProgramParameter(y,i.VALIDATE_STATUS),"gl.getProgramInfoLog",E,M,T)):""!==E?console.warn("THREE.WebGLProgram: gl.getProgramInfoLog()",E):""!==M&&""!==T||(A=!1),A&&(this.diagnostics={runnable:S,material:n,programLog:E,vertexShader:{log:M,prefix:f},fragmentShader:{log:T,prefix:d}}),i.deleteShader(_),i.deleteShader(w);var C;this.getUniforms=function(){return void 0===C&&(C=new X(i,y,t)),C};var P;return this.getAttributes=function(){return void 0===P&&(P=Zt(i,y)),P},this.destroy=function(){i.deleteProgram(y),this.program=void 0},Object.defineProperties(this,{uniforms:{get:function(){return console.warn("THREE.WebGLProgram: .uniforms is now .getUniforms()."),this.getUniforms()}},attributes:{get:function(){return console.warn("THREE.WebGLProgram: .attributes is now .getAttributes()."),this.getAttributes()}}}),this.id=Cs++,this.code=e,this.usedTimes=1,this.program=y,this.vertexShader=_,this.fragmentShader=w,this}function ee(t,e){function n(t){if(e.floatVertexTextures&&t&&t.skeleton&&t.skeleton.useVertexTexture)return 1024;var n=e.maxVertexUniforms,r=Math.floor((n-20)/4),i=r;return void 0!==t&&t&&t.isSkinnedMesh&&(i=Math.min(t.skeleton.bones.length,i))0,shadowMapType:t.shadowMap.type,toneMapping:t.toneMapping,physicallyCorrectLights:t.physicallyCorrectLights,premultipliedAlpha:i.premultipliedAlpha,alphaTest:i.alphaTest,doubleSided:i.side===uo,flipSided:i.side===so,depthPacking:void 0!==i.depthPacking&&i.depthPacking}},this.getProgramCode=function(t,e){var n=[];if(e.shaderID?n.push(e.shaderID):(n.push(t.fragmentShader),n.push(t.vertexShader)),void 0!==t.defines)for(var r in t.defines)n.push(r),n.push(t.defines[r]);for(var i=0;i65535?wt:xt)(o,1);return i(d,t.ELEMENT_ARRAY_BUFFER),r.wireframe=d,d}var l=new ne(t,e,n);return{getAttributeBuffer:s,getAttributeProperties:u,getWireframeAttribute:c,update:r}}function ie(t,e,n,r,i,o,a){function s(t,e){if(t.width>e||t.height>e){var n=e/Math.max(t.width,t.height),r=document.createElementNS("http://www.w3.org/1999/xhtml","canvas");r.width=Math.floor(t.width*n),r.height=Math.floor(t.height*n);return r.getContext("2d").drawImage(t,0,0,t.width,t.height,0,0,r.width,r.height),console.warn("THREE.WebGLRenderer: image is too big ("+t.width+"x"+t.height+"). Resized to "+r.width+"x"+r.height,t),r}return t}function u(t){return fs.isPowerOfTwo(t.width)&&fs.isPowerOfTwo(t.height)}function c(t){if(t instanceof HTMLImageElement||t instanceof HTMLCanvasElement){var e=document.createElementNS("http://www.w3.org/1999/xhtml","canvas");e.width=fs.nearestPowerOfTwo(t.width),e.height=fs.nearestPowerOfTwo(t.height);return e.getContext("2d").drawImage(t,0,0,e.width,e.height),console.warn("THREE.WebGLRenderer: image is not power of two ("+t.width+"x"+t.height+"). Resized to "+e.width+"x"+e.height,t),e}return t}function l(t){return t.wrapS!==ua||t.wrapT!==ua||t.minFilter!==la&&t.minFilter!==fa}function h(e){return e===la||e===ha||e===pa?t.NEAREST:t.LINEAR}function p(t){var e=t.target;e.removeEventListener("dispose",p),d(e),A.textures--}function f(t){var e=t.target;e.removeEventListener("dispose",f),m(e),A.textures--}function d(e){var n=r.get(e);if(e.image&&n.__image__webglTextureCube)t.deleteTexture(n.__image__webglTextureCube);else{if(void 0===n.__webglInit)return;t.deleteTexture(n.__webglTexture)}r.delete(e)}function m(e){var n=r.get(e),i=r.get(e.texture);if(e){if(void 0!==i.__webglTexture&&t.deleteTexture(i.__webglTexture),e.depthTexture&&e.depthTexture.dispose(),e.isWebGLRenderTargetCube)for(var o=0;o<6;o++)t.deleteFramebuffer(n.__webglFramebuffer[o]),n.__webglDepthbuffer&&t.deleteRenderbuffer(n.__webglDepthbuffer[o]);else t.deleteFramebuffer(n.__webglFramebuffer),n.__webglDepthbuffer&&t.deleteRenderbuffer(n.__webglDepthbuffer);r.delete(e.texture),r.delete(e)}}function v(e,i){var o=r.get(e);if(e.version>0&&o.__version!==e.version){var a=e.image;if(void 0===a)console.warn("THREE.WebGLRenderer: Texture marked for update but image is undefined",e);else{if(!1!==a.complete)return void x(o,e,i);console.warn("THREE.WebGLRenderer: Texture marked for update but image is incomplete",e)}}n.activeTexture(t.TEXTURE0+i),n.bindTexture(t.TEXTURE_2D,o.__webglTexture)}function g(e,a){var c=r.get(e);if(6===e.image.length)if(e.version>0&&c.__version!==e.version){c.__image__webglTextureCube||(e.addEventListener("dispose",p),c.__image__webglTextureCube=t.createTexture(),A.textures++),n.activeTexture(t.TEXTURE0+a),n.bindTexture(t.TEXTURE_CUBE_MAP,c.__image__webglTextureCube),t.pixelStorei(t.UNPACK_FLIP_Y_WEBGL,e.flipY);for(var l=e&&e.isCompressedTexture,h=e.image[0]&&e.image[0].isDataTexture,f=[],d=0;d<6;d++)f[d]=l||h?h?e.image[d].image:e.image[d]:s(e.image[d],i.maxCubemapSize);var m=f[0],v=u(m),g=o(e.format),y=o(e.type);b(t.TEXTURE_CUBE_MAP,e,v);for(var d=0;d<6;d++)if(l)for(var x,_=f[d].mipmaps,w=0,E=_.length;w-1?n.compressedTexImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+d,w,g,x.width,x.height,0,x.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .setTextureCube()"):n.texImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+d,w,g,x.width,x.height,0,g,y,x.data);else h?n.texImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+d,0,g,f[d].width,f[d].height,0,g,y,f[d].data):n.texImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+d,0,g,g,y,f[d]);e.generateMipmaps&&v&&t.generateMipmap(t.TEXTURE_CUBE_MAP),c.__version=e.version,e.onUpdate&&e.onUpdate(e)}else n.activeTexture(t.TEXTURE0+a),n.bindTexture(t.TEXTURE_CUBE_MAP,c.__image__webglTextureCube)}function y(e,i){n.activeTexture(t.TEXTURE0+i),n.bindTexture(t.TEXTURE_CUBE_MAP,r.get(e).__webglTexture)}function b(n,a,s){var u;if(s?(t.texParameteri(n,t.TEXTURE_WRAP_S,o(a.wrapS)),t.texParameteri(n,t.TEXTURE_WRAP_T,o(a.wrapT)),t.texParameteri(n,t.TEXTURE_MAG_FILTER,o(a.magFilter)),t.texParameteri(n,t.TEXTURE_MIN_FILTER,o(a.minFilter))):(t.texParameteri(n,t.TEXTURE_WRAP_S,t.CLAMP_TO_EDGE),t.texParameteri(n,t.TEXTURE_WRAP_T,t.CLAMP_TO_EDGE),a.wrapS===ua&&a.wrapT===ua||console.warn("THREE.WebGLRenderer: Texture is not power of two. Texture.wrapS and Texture.wrapT should be set to THREE.ClampToEdgeWrapping.",a),t.texParameteri(n,t.TEXTURE_MAG_FILTER,h(a.magFilter)),t.texParameteri(n,t.TEXTURE_MIN_FILTER,h(a.minFilter)),a.minFilter!==la&&a.minFilter!==fa&&console.warn("THREE.WebGLRenderer: Texture is not power of two. Texture.minFilter should be set to THREE.NearestFilter or THREE.LinearFilter.",a)),u=e.get("EXT_texture_filter_anisotropic")){if(a.type===wa&&null===e.get("OES_texture_float_linear"))return;if(a.type===Ea&&null===e.get("OES_texture_half_float_linear"))return;(a.anisotropy>1||r.get(a).__currentAnisotropy)&&(t.texParameterf(n,u.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(a.anisotropy,i.getMaxAnisotropy())),r.get(a).__currentAnisotropy=a.anisotropy)}}function x(e,r,a){void 0===e.__webglInit&&(e.__webglInit=!0,r.addEventListener("dispose",p),e.__webglTexture=t.createTexture(),A.textures++),n.activeTexture(t.TEXTURE0+a),n.bindTexture(t.TEXTURE_2D,e.__webglTexture),t.pixelStorei(t.UNPACK_FLIP_Y_WEBGL,r.flipY),t.pixelStorei(t.UNPACK_PREMULTIPLY_ALPHA_WEBGL,r.premultiplyAlpha),t.pixelStorei(t.UNPACK_ALIGNMENT,r.unpackAlignment);var h=s(r.image,i.maxTextureSize);l(r)&&!1===u(h)&&(h=c(h));var f=u(h),d=o(r.format),m=o(r.type);b(t.TEXTURE_2D,r,f);var v,g=r.mipmaps;if(r.isDepthTexture){var y=t.DEPTH_COMPONENT;if(r.type===wa){if(!C)throw new Error("Float Depth Texture only supported in WebGL2.0");y=t.DEPTH_COMPONENT32F}else C&&(y=t.DEPTH_COMPONENT16);r.format===Na&&y===t.DEPTH_COMPONENT&&r.type!==ba&&r.type!==_a&&(console.warn("THREE.WebGLRenderer: Use UnsignedShortType or UnsignedIntType for DepthFormat DepthTexture."),r.type=ba,m=o(r.type)),r.format===Da&&(y=t.DEPTH_STENCIL,r.type!==Aa&&(console.warn("THREE.WebGLRenderer: Use UnsignedInt248Type for DepthStencilFormat DepthTexture."),r.type=Aa,m=o(r.type))),n.texImage2D(t.TEXTURE_2D,0,y,h.width,h.height,0,d,m,null)}else if(r.isDataTexture)if(g.length>0&&f){for(var x=0,_=g.length;x<_;x++)v=g[x],n.texImage2D(t.TEXTURE_2D,x,d,v.width,v.height,0,d,m,v.data);r.generateMipmaps=!1}else n.texImage2D(t.TEXTURE_2D,0,d,h.width,h.height,0,d,m,h.data);else if(r.isCompressedTexture)for(var x=0,_=g.length;x<_;x++)v=g[x],r.format!==Ra&&r.format!==Pa?n.getCompressedTextureFormats().indexOf(d)>-1?n.compressedTexImage2D(t.TEXTURE_2D,x,d,v.width,v.height,0,v.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()"):n.texImage2D(t.TEXTURE_2D,x,d,v.width,v.height,0,d,m,v.data);else if(g.length>0&&f){for(var x=0,_=g.length;x<_;x++)v=g[x],n.texImage2D(t.TEXTURE_2D,x,d,d,m,v);r.generateMipmaps=!1}else n.texImage2D(t.TEXTURE_2D,0,d,d,m,h);r.generateMipmaps&&f&&t.generateMipmap(t.TEXTURE_2D),e.__version=r.version,r.onUpdate&&r.onUpdate(r)}function _(e,i,a,s){var u=o(i.texture.format),c=o(i.texture.type);n.texImage2D(s,0,u,i.width,i.height,0,u,c,null),t.bindFramebuffer(t.FRAMEBUFFER,e),t.framebufferTexture2D(t.FRAMEBUFFER,a,s,r.get(i.texture).__webglTexture,0),t.bindFramebuffer(t.FRAMEBUFFER,null)}function w(e,n){t.bindRenderbuffer(t.RENDERBUFFER,e),n.depthBuffer&&!n.stencilBuffer?(t.renderbufferStorage(t.RENDERBUFFER,t.DEPTH_COMPONENT16,n.width,n.height),t.framebufferRenderbuffer(t.FRAMEBUFFER,t.DEPTH_ATTACHMENT,t.RENDERBUFFER,e)):n.depthBuffer&&n.stencilBuffer?(t.renderbufferStorage(t.RENDERBUFFER,t.DEPTH_STENCIL,n.width,n.height),t.framebufferRenderbuffer(t.FRAMEBUFFER,t.DEPTH_STENCIL_ATTACHMENT,t.RENDERBUFFER,e)):t.renderbufferStorage(t.RENDERBUFFER,t.RGBA4,n.width,n.height),t.bindRenderbuffer(t.RENDERBUFFER,null)}function E(e,n){if(n&&n.isWebGLRenderTargetCube)throw new Error("Depth Texture with cube render targets is not supported!");if(t.bindFramebuffer(t.FRAMEBUFFER,e),!n.depthTexture||!n.depthTexture.isDepthTexture)throw new Error("renderTarget.depthTexture must be an instance of THREE.DepthTexture");r.get(n.depthTexture).__webglTexture&&n.depthTexture.image.width===n.width&&n.depthTexture.image.height===n.height||(n.depthTexture.image.width=n.width,n.depthTexture.image.height=n.height,n.depthTexture.needsUpdate=!0),v(n.depthTexture,0);var i=r.get(n.depthTexture).__webglTexture;if(n.depthTexture.format===Na)t.framebufferTexture2D(t.FRAMEBUFFER,t.DEPTH_ATTACHMENT,t.TEXTURE_2D,i,0);else{if(n.depthTexture.format!==Da)throw new Error("Unknown depthTexture format");t.framebufferTexture2D(t.FRAMEBUFFER,t.DEPTH_STENCIL_ATTACHMENT,t.TEXTURE_2D,i,0)}}function M(e){var n=r.get(e),i=!0===e.isWebGLRenderTargetCube;if(e.depthTexture){if(i)throw new Error("target.depthTexture not supported in Cube render targets");E(n.__webglFramebuffer,e)}else if(i){n.__webglDepthbuffer=[];for(var o=0;o<6;o++)t.bindFramebuffer(t.FRAMEBUFFER,n.__webglFramebuffer[o]),n.__webglDepthbuffer[o]=t.createRenderbuffer(),w(n.__webglDepthbuffer[o],e)}else t.bindFramebuffer(t.FRAMEBUFFER,n.__webglFramebuffer),n.__webglDepthbuffer=t.createRenderbuffer(),w(n.__webglDepthbuffer,e);t.bindFramebuffer(t.FRAMEBUFFER,null)}function T(e){var i=r.get(e),o=r.get(e.texture);e.addEventListener("dispose",f),o.__webglTexture=t.createTexture(),A.textures++;var a=!0===e.isWebGLRenderTargetCube,s=u(e);if(a){i.__webglFramebuffer=[];for(var c=0;c<6;c++)i.__webglFramebuffer[c]=t.createFramebuffer()}else i.__webglFramebuffer=t.createFramebuffer();if(a){n.bindTexture(t.TEXTURE_CUBE_MAP,o.__webglTexture),b(t.TEXTURE_CUBE_MAP,e.texture,s);for(var c=0;c<6;c++)_(i.__webglFramebuffer[c],e,t.COLOR_ATTACHMENT0,t.TEXTURE_CUBE_MAP_POSITIVE_X+c);e.texture.generateMipmaps&&s&&t.generateMipmap(t.TEXTURE_CUBE_MAP),n.bindTexture(t.TEXTURE_CUBE_MAP,null)}else n.bindTexture(t.TEXTURE_2D,o.__webglTexture),b(t.TEXTURE_2D,e.texture,s),_(i.__webglFramebuffer,e,t.COLOR_ATTACHMENT0,t.TEXTURE_2D),e.texture.generateMipmaps&&s&&t.generateMipmap(t.TEXTURE_2D),n.bindTexture(t.TEXTURE_2D,null);e.depthBuffer&&M(e)}function S(e){var i=e.texture;if(i.generateMipmaps&&u(e)&&i.minFilter!==la&&i.minFilter!==fa){var o=e&&e.isWebGLRenderTargetCube?t.TEXTURE_CUBE_MAP:t.TEXTURE_2D,a=r.get(i).__webglTexture;n.bindTexture(o,a),t.generateMipmap(o),n.bindTexture(o,null)}}var A=a.memory,C="undefined"!=typeof WebGL2RenderingContext&&t instanceof WebGL2RenderingContext;this.setTexture2D=v,this.setTextureCube=g,this.setTextureCubeDynamic=y,this.setupRenderTarget=T,this.updateRenderTargetMipmap=S}function oe(){var t={};return{get:function(e){var n=e.uuid,r=t[n];return void 0===r&&(r={},t[n]=r),r},delete:function(e){delete t[e.uuid]},clear:function(){t={}}}}function ae(t,e,n){function r(){var e=!1,n=new a,r=null,i=new a;return{setMask:function(n){r===n||e||(t.colorMask(n,n,n,n),r=n)},setLocked:function(t){e=t},setClear:function(e,r,o,a,s){!0===s&&(e*=a,r*=a,o*=a),n.set(e,r,o,a),!1===i.equals(n)&&(t.clearColor(e,r,o,a),i.copy(n))},reset:function(){e=!1,r=null,i.set(0,0,0,1)}}}function i(){var e=!1,n=null,r=null,i=null;return{setTest:function(e){e?f(t.DEPTH_TEST):d(t.DEPTH_TEST)},setMask:function(r){n===r||e||(t.depthMask(r),n=r)},setFunc:function(e){if(r!==e){if(e)switch(e){case Uo:t.depthFunc(t.NEVER);break;case Fo:t.depthFunc(t.ALWAYS);break;case Bo:t.depthFunc(t.LESS);break;case zo:t.depthFunc(t.LEQUAL);break;case jo:t.depthFunc(t.EQUAL);break;case Vo:t.depthFunc(t.GEQUAL);break;case Ho:t.depthFunc(t.GREATER);break;case Go:t.depthFunc(t.NOTEQUAL);break;default:t.depthFunc(t.LEQUAL)}else t.depthFunc(t.LEQUAL);r=e}},setLocked:function(t){e=t},setClear:function(e){i!==e&&(t.clearDepth(e),i=e)},reset:function(){e=!1,n=null,r=null,i=null}}}function o(){var e=!1,n=null,r=null,i=null,o=null,a=null,s=null,u=null,c=null;return{setTest:function(e){e?f(t.STENCIL_TEST):d(t.STENCIL_TEST)},setMask:function(r){n===r||e||(t.stencilMask(r),n=r)},setFunc:function(e,n,a){r===e&&i===n&&o===a||(t.stencilFunc(e,n,a),r=e,i=n,o=a)},setOp:function(e,n,r){a===e&&s===n&&u===r||(t.stencilOp(e,n,r),a=e,s=n,u=r)},setLocked:function(t){e=t},setClear:function(e){c!==e&&(t.clearStencil(e),c=e)},reset:function(){e=!1,n=null,r=null,i=null,o=null,a=null,s=null,u=null,c=null}}}function s(e,n,r){var i=new Uint8Array(4),o=t.createTexture();t.bindTexture(e,o),t.texParameteri(e,t.TEXTURE_MIN_FILTER,t.NEAREST),t.texParameteri(e,t.TEXTURE_MAG_FILTER,t.NEAREST);for(var a=0;a=1,lt=null,ht={},pt=new a,ft=new a,dt={};return dt[t.TEXTURE_2D]=s(t.TEXTURE_2D,t.TEXTURE_2D,1),dt[t.TEXTURE_CUBE_MAP]=s(t.TEXTURE_CUBE_MAP,t.TEXTURE_CUBE_MAP_POSITIVE_X,6),{buffers:{color:F,depth:B,stencil:z},init:u,initAttributes:c,enableAttribute:l,enableAttributeAndDivisor:h,disableUnusedAttributes:p,enable:f,disable:d,getCompressedTextureFormats:m,setBlending:v,setColorWrite:g,setDepthTest:y,setDepthWrite:b,setDepthFunc:x,setStencilTest:_,setStencilWrite:w,setStencilFunc:E,setStencilOp:M,setFlipSided:T,setCullFace:S,setLineWidth:A,setPolygonOffset:C,getScissorTest:P,setScissorTest:R,activeTexture:L,bindTexture:O,compressedTexImage2D:I,texImage2D:N,scissor:D,viewport:k,reset:U}}function se(t,e,n){function r(){if(void 0!==o)return o;var n=e.get("EXT_texture_filter_anisotropic");return o=null!==n?t.getParameter(n.MAX_TEXTURE_MAX_ANISOTROPY_EXT):0}function i(e){if("highp"===e){if(t.getShaderPrecisionFormat(t.VERTEX_SHADER,t.HIGH_FLOAT).precision>0&&t.getShaderPrecisionFormat(t.FRAGMENT_SHADER,t.HIGH_FLOAT).precision>0)return"highp";e="mediump"}return"mediump"===e&&t.getShaderPrecisionFormat(t.VERTEX_SHADER,t.MEDIUM_FLOAT).precision>0&&t.getShaderPrecisionFormat(t.FRAGMENT_SHADER,t.MEDIUM_FLOAT).precision>0?"mediump":"lowp"}var o,a=void 0!==n.precision?n.precision:"highp",s=i(a);s!==a&&(console.warn("THREE.WebGLRenderer:",a,"not supported, using",s,"instead."),a=s);var u=!0===n.logarithmicDepthBuffer&&!!e.get("EXT_frag_depth"),c=t.getParameter(t.MAX_TEXTURE_IMAGE_UNITS),l=t.getParameter(t.MAX_VERTEX_TEXTURE_IMAGE_UNITS),h=t.getParameter(t.MAX_TEXTURE_SIZE),p=t.getParameter(t.MAX_CUBE_MAP_TEXTURE_SIZE),f=t.getParameter(t.MAX_VERTEX_ATTRIBS),d=t.getParameter(t.MAX_VERTEX_UNIFORM_VECTORS),m=t.getParameter(t.MAX_VARYING_VECTORS),v=t.getParameter(t.MAX_FRAGMENT_UNIFORM_VECTORS),g=l>0,y=!!e.get("OES_texture_float");return{getMaxAnisotropy:r,getMaxPrecision:i,precision:a,logarithmicDepthBuffer:u,maxTextures:c,maxVertexTextures:l,maxTextureSize:h,maxCubemapSize:p,maxAttributes:f,maxVertexUniforms:d,maxVaryings:m,maxFragmentUniforms:v,vertexTextures:g,floatFragmentTextures:y,floatVertexTextures:g&&y}}function ue(t){var e={};return{get:function(n){if(void 0!==e[n])return e[n];var r;switch(n){case"WEBGL_depth_texture":r=t.getExtension("WEBGL_depth_texture")||t.getExtension("MOZ_WEBGL_depth_texture")||t.getExtension("WEBKIT_WEBGL_depth_texture");break;case"EXT_texture_filter_anisotropic":r=t.getExtension("EXT_texture_filter_anisotropic")||t.getExtension("MOZ_EXT_texture_filter_anisotropic")||t.getExtension("WEBKIT_EXT_texture_filter_anisotropic");break;case"WEBGL_compressed_texture_s3tc":r=t.getExtension("WEBGL_compressed_texture_s3tc")||t.getExtension("MOZ_WEBGL_compressed_texture_s3tc")||t.getExtension("WEBKIT_WEBGL_compressed_texture_s3tc");break;case"WEBGL_compressed_texture_pvrtc":r=t.getExtension("WEBGL_compressed_texture_pvrtc")||t.getExtension("WEBKIT_WEBGL_compressed_texture_pvrtc");break;case"WEBGL_compressed_texture_etc1":r=t.getExtension("WEBGL_compressed_texture_etc1");break;default:r=t.getExtension(n)}return null===r&&console.warn("THREE.WebGLRenderer: "+n+" extension not supported."),e[n]=r,r}}}function ce(){function t(){c.value!==r&&(c.value=r,c.needsUpdate=i>0),n.numPlanes=i,n.numIntersection=0}function e(t,e,r,i){var o=null!==t?t.length:0,a=null;if(0!==o){if(a=c.value,!0!==i||null===a){var l=r+4*o,h=e.matrixWorldInverse;u.getNormalMatrix(h),(null===a||a.length=0){var l=o[u];if(void 0!==l){var h=l.normalized,p=l.itemSize,f=he.getAttributeProperties(l),d=f.__webglBuffer,m=f.type,v=f.bytesPerElement;if(l.isInterleavedBufferAttribute){var g=l.data,y=g.stride,b=l.offset;g&&g.isInstancedInterleavedBuffer?(te.enableAttributeAndDivisor(c,g.meshPerAttribute,i),void 0===n.maxInstancedCount&&(n.maxInstancedCount=g.meshPerAttribute*g.count)):te.enableAttribute(c),Kt.bindBuffer(Kt.ARRAY_BUFFER,d),Kt.vertexAttribPointer(c,p,m,h,y*v,(r*y+b)*v)}else l.isInstancedBufferAttribute?(te.enableAttributeAndDivisor(c,l.meshPerAttribute,i),void 0===n.maxInstancedCount&&(n.maxInstancedCount=l.meshPerAttribute*l.count)):te.enableAttribute(c),Kt.bindBuffer(Kt.ARRAY_BUFFER,d),Kt.vertexAttribPointer(c,p,m,h,0,r*p*v)}else if(void 0!==s){var x=s[u];if(void 0!==x)switch(x.length){case 2:Kt.vertexAttrib2fv(c,x);break;case 3:Kt.vertexAttrib3fv(c,x);break;case 4:Kt.vertexAttrib4fv(c,x);break;default:Kt.vertexAttrib1fv(c,x)}}}}te.disableUnusedAttributes()}function p(t,e){return Math.abs(e[0])-Math.abs(t[0])}function f(t,e){return t.object.renderOrder!==e.object.renderOrder?t.object.renderOrder-e.object.renderOrder:t.material.program&&e.material.program&&t.material.program!==e.material.program?t.material.program.id-e.material.program.id:t.material.id!==e.material.id?t.material.id-e.material.id:t.z!==e.z?t.z-e.z:t.id-e.id}function d(t,e){return t.object.renderOrder!==e.object.renderOrder?t.object.renderOrder-e.object.renderOrder:t.z!==e.z?e.z-t.z:t.id-e.id}function m(t,e,n,r,i){var o,a;n.transparent?(o=rt,a=++it):(o=tt,a=++et);var s=o[a];void 0!==s?(s.id=t.id,s.object=t,s.geometry=e,s.material=n,s.z=Wt.z,s.group=i):(s={id:t.id,object:t,geometry:e,material:n,z:Wt.z,group:i},o.push(s))}function v(t){var e=t.geometry;return null===e.boundingSphere&&e.computeBoundingSphere(),Ht.copy(e.boundingSphere).applyMatrix4(t.matrixWorld),y(Ht)}function g(t){return Ht.center.set(0,0,0),Ht.radius=.7071067811865476,Ht.applyMatrix4(t.matrixWorld),y(Ht)}function y(t){if(!It.intersectsSphere(t))return!1;var e=Dt.numPlanes;if(0===e)return!0;var n=lt.clippingPlanes,r=t.center,i=-t.radius,o=0;do{if(n[o].distanceToPoint(r)=0&&t.numSupportedMorphTargets++}if(t.morphNormals){t.numSupportedMorphNormals=0;for(var p=0;p=0&&t.numSupportedMorphNormals++}var f=r.__webglShader.uniforms;(t.isShaderMaterial||t.isRawShaderMaterial)&&!0!==t.clipping||(r.numClippingPlanes=Dt.numPlanes,r.numIntersection=Dt.numIntersection,f.clippingPlanes=Dt.uniform),r.fog=e,r.lightsHash=Yt.hash,t.lights&&(f.ambientLightColor.value=Yt.ambient,f.directionalLights.value=Yt.directional,f.spotLights.value=Yt.spot,f.rectAreaLights.value=Yt.rectArea,f.pointLights.value=Yt.point,f.hemisphereLights.value=Yt.hemi,f.directionalShadowMap.value=Yt.directionalShadowMap,f.directionalShadowMatrix.value=Yt.directionalShadowMatrix,f.spotShadowMap.value=Yt.spotShadowMap,f.spotShadowMatrix.value=Yt.spotShadowMatrix,f.pointShadowMap.value=Yt.pointShadowMap,f.pointShadowMatrix.value=Yt.pointShadowMatrix);var d=r.program.getUniforms(),m=X.seqWithValue(d.seq,f);r.uniformsList=m}function w(t){t.side===uo?te.disable(Kt.CULL_FACE):te.enable(Kt.CULL_FACE),te.setFlipSided(t.side===so),!0===t.transparent?te.setBlending(t.blending,t.blendEquation,t.blendSrc,t.blendDst,t.blendEquationAlpha,t.blendSrcAlpha,t.blendDstAlpha,t.premultipliedAlpha):te.setBlending(mo),te.setDepthFunc(t.depthFunc),te.setDepthTest(t.depthTest),te.setDepthWrite(t.depthWrite),te.setColorWrite(t.colorWrite),te.setPolygonOffset(t.polygonOffset,t.polygonOffsetFactor,t.polygonOffsetUnits)}function E(t,e,n,r){_t=0;var i=ne.get(n);if(jt&&(Vt||t!==gt)){var o=t===gt&&n.id===mt;Dt.setState(n.clippingPlanes,n.clipIntersection,n.clipShadows,t,i,o)}!1===n.needsUpdate&&(void 0===i.program?n.needsUpdate=!0:n.fog&&i.fog!==e?n.needsUpdate=!0:n.lights&&i.lightsHash!==Yt.hash?n.needsUpdate=!0:void 0===i.numClippingPlanes||i.numClippingPlanes===Dt.numPlanes&&i.numIntersection===Dt.numIntersection||(n.needsUpdate=!0)),n.needsUpdate&&(_(n,e,r),n.needsUpdate=!1);var a=!1,s=!1,u=!1,c=i.program,l=c.getUniforms(),h=i.__webglShader.uniforms;if(c.id!==ht&&(Kt.useProgram(c.program),ht=c.id,a=!0,s=!0,u=!0),n.id!==mt&&(mt=n.id,s=!0),a||t!==gt){if(l.set(Kt,t,"projectionMatrix"),Qt.logarithmicDepthBuffer&&l.setValue(Kt,"logDepthBufFC",2/(Math.log(t.far+1)/Math.LN2)),t!==gt&&(gt=t,s=!0,u=!0),n.isShaderMaterial||n.isMeshPhongMaterial||n.isMeshStandardMaterial||n.envMap){var p=l.map.cameraPosition;void 0!==p&&p.setValue(Kt,Wt.setFromMatrixPosition(t.matrixWorld))}(n.isMeshPhongMaterial||n.isMeshLambertMaterial||n.isMeshBasicMaterial||n.isMeshStandardMaterial||n.isShaderMaterial||n.skinning)&&l.setValue(Kt,"viewMatrix",t.matrixWorldInverse),l.set(Kt,lt,"toneMappingExposure"),l.set(Kt,lt,"toneMappingWhitePoint")}if(n.skinning){l.setOptional(Kt,r,"bindMatrix"),l.setOptional(Kt,r,"bindMatrixInverse");var f=r.skeleton;f&&(Qt.floatVertexTextures&&f.useVertexTexture?(l.set(Kt,f,"boneTexture"),l.set(Kt,f,"boneTextureWidth"),l.set(Kt,f,"boneTextureHeight")):l.setOptional(Kt,f,"boneMatrices"))}return s&&(n.lights&&D(h,u),e&&n.fog&&C(h,e),(n.isMeshBasicMaterial||n.isMeshLambertMaterial||n.isMeshPhongMaterial||n.isMeshStandardMaterial||n.isMeshNormalMaterial||n.isMeshDepthMaterial)&&M(h,n),n.isLineBasicMaterial?T(h,n):n.isLineDashedMaterial?(T(h,n),S(h,n)):n.isPointsMaterial?A(h,n):n.isMeshLambertMaterial?P(h,n):n.isMeshToonMaterial?L(h,n):n.isMeshPhongMaterial?R(h,n):n.isMeshPhysicalMaterial?I(h,n):n.isMeshStandardMaterial?O(h,n):n.isMeshDepthMaterial?n.displacementMap&&(h.displacementMap.value=n.displacementMap,h.displacementScale.value=n.displacementScale,h.displacementBias.value=n.displacementBias):n.isMeshNormalMaterial&&N(h,n),void 0!==h.ltcMat&&(h.ltcMat.value=THREE.UniformsLib.LTC_MAT_TEXTURE),void 0!==h.ltcMag&&(h.ltcMag.value=THREE.UniformsLib.LTC_MAG_TEXTURE),X.upload(Kt,i.uniformsList,h,lt)),l.set(Kt,r,"modelViewMatrix"),l.set(Kt,r,"normalMatrix"),l.setValue(Kt,"modelMatrix",r.matrixWorld),c}function M(t,e){t.opacity.value=e.opacity,t.diffuse.value=e.color,e.emissive&&t.emissive.value.copy(e.emissive).multiplyScalar(e.emissiveIntensity),t.map.value=e.map,t.specularMap.value=e.specularMap,t.alphaMap.value=e.alphaMap,e.lightMap&&(t.lightMap.value=e.lightMap,t.lightMapIntensity.value=e.lightMapIntensity),e.aoMap&&(t.aoMap.value=e.aoMap,t.aoMapIntensity.value=e.aoMapIntensity);var n;if(e.map?n=e.map:e.specularMap?n=e.specularMap:e.displacementMap?n=e.displacementMap:e.normalMap?n=e.normalMap:e.bumpMap?n=e.bumpMap:e.roughnessMap?n=e.roughnessMap:e.metalnessMap?n=e.metalnessMap:e.alphaMap?n=e.alphaMap:e.emissiveMap&&(n=e.emissiveMap),void 0!==n){n.isWebGLRenderTarget&&(n=n.texture);var r=n.offset,i=n.repeat;t.offsetRepeat.value.set(r.x,r.y,i.x,i.y)}t.envMap.value=e.envMap,t.flipEnvMap.value=e.envMap&&e.envMap.isCubeTexture?-1:1,t.reflectivity.value=e.reflectivity,t.refractionRatio.value=e.refractionRatio}function T(t,e){t.diffuse.value=e.color,t.opacity.value=e.opacity}function S(t,e){t.dashSize.value=e.dashSize,t.totalSize.value=e.dashSize+e.gapSize,t.scale.value=e.scale}function A(t,e){if(t.diffuse.value=e.color,t.opacity.value=e.opacity,t.size.value=e.size*St,t.scale.value=.5*Tt,t.map.value=e.map,null!==e.map){var n=e.map.offset,r=e.map.repeat;t.offsetRepeat.value.set(n.x,n.y,r.x,r.y)}}function C(t,e){t.fogColor.value=e.color,e.isFog?(t.fogNear.value=e.near,t.fogFar.value=e.far):e.isFogExp2&&(t.fogDensity.value=e.density)}function P(t,e){e.emissiveMap&&(t.emissiveMap.value=e.emissiveMap)}function R(t,e){t.specular.value=e.specular,t.shininess.value=Math.max(e.shininess,1e-4),e.emissiveMap&&(t.emissiveMap.value=e.emissiveMap),e.bumpMap&&(t.bumpMap.value=e.bumpMap,t.bumpScale.value=e.bumpScale),e.normalMap&&(t.normalMap.value=e.normalMap,t.normalScale.value.copy(e.normalScale)),e.displacementMap&&(t.displacementMap.value=e.displacementMap,t.displacementScale.value=e.displacementScale,t.displacementBias.value=e.displacementBias)}function L(t,e){R(t,e),e.gradientMap&&(t.gradientMap.value=e.gradientMap)}function O(t,e){t.roughness.value=e.roughness,t.metalness.value=e.metalness,e.roughnessMap&&(t.roughnessMap.value=e.roughnessMap),e.metalnessMap&&(t.metalnessMap.value=e.metalnessMap),e.emissiveMap&&(t.emissiveMap.value=e.emissiveMap),e.bumpMap&&(t.bumpMap.value=e.bumpMap,t.bumpScale.value=e.bumpScale),e.normalMap&&(t.normalMap.value=e.normalMap,t.normalScale.value.copy(e.normalScale)),e.displacementMap&&(t.displacementMap.value=e.displacementMap,t.displacementScale.value=e.displacementScale,t.displacementBias.value=e.displacementBias),e.envMap&&(t.envMapIntensity.value=e.envMapIntensity)}function I(t,e){t.clearCoat.value=e.clearCoat,t.clearCoatRoughness.value=e.clearCoatRoughness,O(t,e)}function N(t,e){e.bumpMap&&(t.bumpMap.value=e.bumpMap,t.bumpScale.value=e.bumpScale),e.normalMap&&(t.normalMap.value=e.normalMap,t.normalScale.value.copy(e.normalScale)),e.displacementMap&&(t.displacementMap.value=e.displacementMap,t.displacementScale.value=e.displacementScale,t.displacementBias.value=e.displacementBias)}function D(t,e){t.ambientLightColor.needsUpdate=e,t.directionalLights.needsUpdate=e,t.pointLights.needsUpdate=e,t.spotLights.needsUpdate=e,t.rectAreaLights.needsUpdate=e,t.hemisphereLights.needsUpdate=e}function k(t){for(var e=0,n=0,r=t.length;n=Qt.maxTextures&&console.warn("WebGLRenderer: trying to use "+t+" texture units while this GPU supports only "+Qt.maxTextures),_t+=1,t}function B(t){var e;if(t===sa)return Kt.REPEAT;if(t===ua)return Kt.CLAMP_TO_EDGE;if(t===ca)return Kt.MIRRORED_REPEAT;if(t===la)return Kt.NEAREST;if(t===ha)return Kt.NEAREST_MIPMAP_NEAREST;if(t===pa)return Kt.NEAREST_MIPMAP_LINEAR;if(t===fa)return Kt.LINEAR;if(t===da)return Kt.LINEAR_MIPMAP_NEAREST;if(t===ma)return Kt.LINEAR_MIPMAP_LINEAR;if(t===va)return Kt.UNSIGNED_BYTE;if(t===Ma)return Kt.UNSIGNED_SHORT_4_4_4_4;if(t===Ta)return Kt.UNSIGNED_SHORT_5_5_5_1;if(t===Sa)return Kt.UNSIGNED_SHORT_5_6_5;if(t===ga)return Kt.BYTE;if(t===ya)return Kt.SHORT;if(t===ba)return Kt.UNSIGNED_SHORT;if(t===xa)return Kt.INT;if(t===_a)return Kt.UNSIGNED_INT;if(t===wa)return Kt.FLOAT;if(t===Ea&&null!==(e=$t.get("OES_texture_half_float")))return e.HALF_FLOAT_OES;if(t===Ca)return Kt.ALPHA;if(t===Pa)return Kt.RGB;if(t===Ra)return Kt.RGBA;if(t===La)return Kt.LUMINANCE;if(t===Oa)return Kt.LUMINANCE_ALPHA;if(t===Na)return Kt.DEPTH_COMPONENT;if(t===Da)return Kt.DEPTH_STENCIL;if(t===_o)return Kt.FUNC_ADD;if(t===wo)return Kt.FUNC_SUBTRACT;if(t===Eo)return Kt.FUNC_REVERSE_SUBTRACT;if(t===So)return Kt.ZERO;if(t===Ao)return Kt.ONE;if(t===Co)return Kt.SRC_COLOR;if(t===Po)return Kt.ONE_MINUS_SRC_COLOR;if(t===Ro)return Kt.SRC_ALPHA;if(t===Lo)return Kt.ONE_MINUS_SRC_ALPHA;if(t===Oo)return Kt.DST_ALPHA;if(t===Io)return Kt.ONE_MINUS_DST_ALPHA;if(t===No)return Kt.DST_COLOR;if(t===Do)return Kt.ONE_MINUS_DST_COLOR;if(t===ko)return Kt.SRC_ALPHA_SATURATE;if((t===ka||t===Ua||t===Fa||t===Ba)&&null!==(e=$t.get("WEBGL_compressed_texture_s3tc"))){if(t===ka)return e.COMPRESSED_RGB_S3TC_DXT1_EXT;if(t===Ua)return e.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(t===Fa)return e.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(t===Ba)return e.COMPRESSED_RGBA_S3TC_DXT5_EXT}if((t===za||t===ja||t===Va||t===Ha)&&null!==(e=$t.get("WEBGL_compressed_texture_pvrtc"))){if(t===za)return e.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(t===ja)return e.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(t===Va)return e.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(t===Ha)return e.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}if(t===Ga&&null!==(e=$t.get("WEBGL_compressed_texture_etc1")))return e.COMPRESSED_RGB_ETC1_WEBGL;if((t===Mo||t===To)&&null!==(e=$t.get("EXT_blend_minmax"))){if(t===Mo)return e.MIN_EXT;if(t===To)return e.MAX_EXT}return t===Aa&&null!==(e=$t.get("WEBGL_depth_texture"))?e.UNSIGNED_INT_24_8_WEBGL:0}console.log("THREE.WebGLRenderer",Zi),t=t||{};var z=void 0!==t.canvas?t.canvas:document.createElementNS("http://www.w3.org/1999/xhtml","canvas"),j=void 0!==t.context?t.context:null,V=void 0!==t.alpha&&t.alpha,H=void 0===t.depth||t.depth,G=void 0===t.stencil||t.stencil,W=void 0!==t.antialias&&t.antialias,Y=void 0===t.premultipliedAlpha||t.premultipliedAlpha,Z=void 0!==t.preserveDrawingBuffer&&t.preserveDrawingBuffer,$=[],tt=[],et=-1,rt=[],it=-1,st=new Float32Array(8),ut=[],ct=[];this.domElement=z,this.context=null,this.autoClear=!0,this.autoClearColor=!0,this.autoClearDepth=!0,this.autoClearStencil=!0,this.sortObjects=!0,this.clippingPlanes=[],this.localClippingEnabled=!1,this.gammaFactor=2,this.gammaInput=!1,this.gammaOutput=!1,this.physicallyCorrectLights=!1,this.toneMapping=Zo,this.toneMappingExposure=1,this.toneMappingWhitePoint=1,this.maxMorphTargets=8,this.maxMorphNormals=4;var lt=this,ht=null,pt=null,ft=null,mt=-1,vt="",gt=null,yt=new a,bt=null,xt=new a,_t=0,wt=new q(0),Et=0,Mt=z.width,Tt=z.height,St=1,At=new a(0,0,Mt,Tt),Ct=!1,Lt=new a(0,0,Mt,Tt),It=new ot,Dt=new ce,jt=!1,Vt=!1,Ht=new nt,Gt=new h,Wt=new l,Xt=new h,qt=new h,Yt={hash:"",ambient:[0,0,0],directional:[],directionalShadowMap:[],directionalShadowMatrix:[],spot:[],spotShadowMap:[],spotShadowMatrix:[],rectArea:[],point:[],pointShadowMap:[],pointShadowMatrix:[],hemi:[],shadows:[]},Zt={calls:0,vertices:0,faces:0,points:0};this.info={render:Zt,memory:{geometries:0,textures:0},programs:null};var Kt;try{var Jt={alpha:V,depth:H,stencil:G,antialias:W,premultipliedAlpha:Y,preserveDrawingBuffer:Z};if(null===(Kt=j||z.getContext("webgl",Jt)||z.getContext("experimental-webgl",Jt)))throw null!==z.getContext("webgl")?"Error creating WebGL context with your selected attributes.":"Error creating WebGL context.";void 0===Kt.getShaderPrecisionFormat&&(Kt.getShaderPrecisionFormat=function(){return{rangeMin:1,rangeMax:1,precision:1}}),z.addEventListener("webglcontextlost",i,!1)}catch(t){console.error("THREE.WebGLRenderer: "+t)}var $t=new ue(Kt);$t.get("WEBGL_depth_texture"),$t.get("OES_texture_float"),$t.get("OES_texture_float_linear"),$t.get("OES_texture_half_float"),$t.get("OES_texture_half_float_linear"),$t.get("OES_standard_derivatives"),$t.get("ANGLE_instanced_arrays"),$t.get("OES_element_index_uint")&&(Pt.MaxIndex=4294967296);var Qt=new se(Kt,$t,t),te=new ae(Kt,$t,B),ne=new oe,le=new ie(Kt,$t,te,ne,Qt,B,this.info),he=new re(Kt,ne,this.info),pe=new ee(this,Qt),fe=new zt;this.info.programs=pe.programs;var de,me,ve,ge,ye=new Bt(Kt,$t,Zt),be=new Ft(Kt,$t,Zt);n(),this.context=Kt,this.capabilities=Qt,this.extensions=$t,this.properties=ne,this.state=te;var xe=new at(this,Yt,he,Qt);this.shadowMap=xe;var _e=new J(this,ut),we=new K(this,ct);this.getContext=function(){return Kt},this.getContextAttributes=function(){return Kt.getContextAttributes()},this.forceContextLoss=function(){$t.get("WEBGL_lose_context").loseContext()},this.getMaxAnisotropy=function(){return Qt.getMaxAnisotropy()},this.getPrecision=function(){return Qt.precision},this.getPixelRatio=function(){return St},this.setPixelRatio=function(t){void 0!==t&&(St=t,this.setSize(Lt.z,Lt.w,!1))},this.getSize=function(){return{width:Mt,height:Tt}},this.setSize=function(t,e,n){Mt=t,Tt=e,z.width=t*St,z.height=e*St,!1!==n&&(z.style.width=t+"px",z.style.height=e+"px"),this.setViewport(0,0,t,e)},this.setViewport=function(t,e,n,r){te.viewport(Lt.set(t,e,n,r))},this.setScissor=function(t,e,n,r){te.scissor(At.set(t,e,n,r))},this.setScissorTest=function(t){te.setScissorTest(Ct=t)},this.getClearColor=function(){return wt},this.setClearColor=function(t,e){wt.set(t),Et=void 0!==e?e:1,te.buffers.color.setClear(wt.r,wt.g,wt.b,Et,Y)},this.getClearAlpha=function(){return Et},this.setClearAlpha=function(t){Et=t,te.buffers.color.setClear(wt.r,wt.g,wt.b,Et,Y)},this.clear=function(t,e,n){var r=0;(void 0===t||t)&&(r|=Kt.COLOR_BUFFER_BIT),(void 0===e||e)&&(r|=Kt.DEPTH_BUFFER_BIT),(void 0===n||n)&&(r|=Kt.STENCIL_BUFFER_BIT),Kt.clear(r)},this.clearColor=function(){this.clear(!0,!1,!1)},this.clearDepth=function(){this.clear(!1,!0,!1)},this.clearStencil=function(){this.clear(!1,!1,!0)},this.clearTarget=function(t,e,n,r){this.setRenderTarget(t),this.clear(e,n,r)},this.resetGLState=r,this.dispose=function(){rt=[],it=-1,tt=[],et=-1,z.removeEventListener("webglcontextlost",i,!1)},this.renderBufferImmediate=function(t,e,n){te.initAttributes();var r=ne.get(t);t.hasPositions&&!r.position&&(r.position=Kt.createBuffer()),t.hasNormals&&!r.normal&&(r.normal=Kt.createBuffer()),t.hasUvs&&!r.uv&&(r.uv=Kt.createBuffer()),t.hasColors&&!r.color&&(r.color=Kt.createBuffer());var i=e.getAttributes();if(t.hasPositions&&(Kt.bindBuffer(Kt.ARRAY_BUFFER,r.position),Kt.bufferData(Kt.ARRAY_BUFFER,t.positionArray,Kt.DYNAMIC_DRAW),te.enableAttribute(i.position),Kt.vertexAttribPointer(i.position,3,Kt.FLOAT,!1,0,0)),t.hasNormals){if(Kt.bindBuffer(Kt.ARRAY_BUFFER,r.normal),!n.isMeshPhongMaterial&&!n.isMeshStandardMaterial&&!n.isMeshNormalMaterial&&n.shading===co)for(var o=0,a=3*t.count;o8&&(f.length=8);for(var g=r.morphAttributes,d=0,m=f.length;d0&&M.renderInstances(r,R,O):M.render(R,O)}},this.render=function(t,e,n,r){if(void 0!==e&&!0!==e.isCamera)return void console.error("THREE.WebGLRenderer.render: camera is not an instance of THREE.Camera.");vt="",mt=-1,gt=null,!0===t.autoUpdate&&t.updateMatrixWorld(),null===e.parent&&e.updateMatrixWorld(),e.matrixWorldInverse.getInverse(e.matrixWorld),Gt.multiplyMatrices(e.projectionMatrix,e.matrixWorldInverse),It.setFromMatrix(Gt),$.length=0,et=-1,it=-1,ut.length=0,ct.length=0,Vt=this.localClippingEnabled,jt=Dt.init(this.clippingPlanes,Vt,e),b(t,e),tt.length=et+1,rt.length=it+1,!0===lt.sortObjects&&(tt.sort(f),rt.sort(d)),jt&&Dt.beginShadows(),k($),xe.render(t,e),U($,e),jt&&Dt.endShadows(),Zt.calls=0,Zt.vertices=0,Zt.faces=0,Zt.points=0,void 0===n&&(n=null),this.setRenderTarget(n);var i=t.background;if(null===i?te.buffers.color.setClear(wt.r,wt.g,wt.b,Et,Y):i&&i.isColor&&(te.buffers.color.setClear(i.r,i.g,i.b,1,Y),r=!0),(this.autoClear||r)&&this.clear(this.autoClearColor,this.autoClearDepth,this.autoClearStencil),i&&i.isCubeTexture?(void 0===ve&&(ve=new kt,ge=new Rt(new Ot(5,5,5),new Q({uniforms:Ms.cube.uniforms,vertexShader:Ms.cube.vertexShader,fragmentShader:Ms.cube.fragmentShader,side:so,depthTest:!1,depthWrite:!1,fog:!1}))),ve.projectionMatrix.copy(e.projectionMatrix),ve.matrixWorld.extractRotation(e.matrixWorld),ve.matrixWorldInverse.getInverse(ve.matrixWorld),ge.material.uniforms.tCube.value=i,ge.modelViewMatrix.multiplyMatrices(ve.matrixWorldInverse,ge.matrixWorld),he.update(ge),lt.renderBufferDirect(ve,null,ge.geometry,ge.material,ge,null)):i&&i.isTexture&&(void 0===de&&(de=new Ut(-1,1,1,-1,0,1),me=new Rt(new Nt(2,2),new dt({depthTest:!1,depthWrite:!1,fog:!1}))),me.material.map=i,he.update(me),lt.renderBufferDirect(de,null,me.geometry,me.material,me,null)),t.overrideMaterial){var o=t.overrideMaterial;x(tt,t,e,o),x(rt,t,e,o)}else te.setBlending(mo),x(tt,t,e),x(rt,t,e);_e.render(t,e),we.render(t,e,xt),n&&le.updateRenderTargetMipmap(n),te.setDepthTest(!0),te.setDepthWrite(!0),te.setColorWrite(!0)},this.setFaceCulling=function(t,e){te.setCullFace(t),te.setFlipSided(e===eo)},this.allocTextureUnit=F,this.setTexture2D=function(){var t=!1;return function(e,n){e&&e.isWebGLRenderTarget&&(t||(console.warn("THREE.WebGLRenderer.setTexture2D: don't use render targets as textures. Use their .texture property instead."),t=!0),e=e.texture),le.setTexture2D(e,n)}}(),this.setTexture=function(){var t=!1;return function(e,n){t||(console.warn("THREE.WebGLRenderer: .setTexture is deprecated, use setTexture2D instead."),t=!0),le.setTexture2D(e,n)}}(),this.setTextureCube=function(){var t=!1;return function(e,n){e&&e.isWebGLRenderTargetCube&&(t||(console.warn("THREE.WebGLRenderer.setTextureCube: don't use cube render targets as textures. Use their .texture property instead."),t=!0),e=e.texture),e&&e.isCubeTexture||Array.isArray(e.image)&&6===e.image.length?le.setTextureCube(e,n):le.setTextureCubeDynamic(e,n)}}(),this.getCurrentRenderTarget=function(){return pt},this.setRenderTarget=function(t){pt=t,t&&void 0===ne.get(t).__webglFramebuffer&&le.setupRenderTarget(t);var e,n=t&&t.isWebGLRenderTargetCube;if(t){var r=ne.get(t);e=n?r.__webglFramebuffer[t.activeCubeFace]:r.__webglFramebuffer,yt.copy(t.scissor),bt=t.scissorTest,xt.copy(t.viewport)}else e=null,yt.copy(At).multiplyScalar(St),bt=Ct,xt.copy(Lt).multiplyScalar(St);if(ft!==e&&(Kt.bindFramebuffer(Kt.FRAMEBUFFER,e),ft=e),te.scissor(yt),te.setScissorTest(bt),te.viewport(xt),n){var i=ne.get(t.texture);Kt.framebufferTexture2D(Kt.FRAMEBUFFER,Kt.COLOR_ATTACHMENT0,Kt.TEXTURE_CUBE_MAP_POSITIVE_X+t.activeCubeFace,i.__webglTexture,t.activeMipMapLevel)}},this.readRenderTargetPixels=function(t,e,n,r,i,o){if(!1===(t&&t.isWebGLRenderTarget))return void console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");var a=ne.get(t).__webglFramebuffer;if(a){var s=!1;a!==ft&&(Kt.bindFramebuffer(Kt.FRAMEBUFFER,a),s=!0);try{var u=t.texture,c=u.format,l=u.type;if(c!==Ra&&B(c)!==Kt.getParameter(Kt.IMPLEMENTATION_COLOR_READ_FORMAT))return void console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.");if(!(l===va||B(l)===Kt.getParameter(Kt.IMPLEMENTATION_COLOR_READ_TYPE)||l===wa&&($t.get("OES_texture_float")||$t.get("WEBGL_color_buffer_float"))||l===Ea&&$t.get("EXT_color_buffer_half_float")))return void console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.");Kt.checkFramebufferStatus(Kt.FRAMEBUFFER)===Kt.FRAMEBUFFER_COMPLETE?e>=0&&e<=t.width-r&&n>=0&&n<=t.height-i&&Kt.readPixels(e,n,r,i,B(c),B(l),o):console.error("THREE.WebGLRenderer.readRenderTargetPixels: readPixels from renderTarget failed. Framebuffer not complete.")}finally{s&&Kt.bindFramebuffer(Kt.FRAMEBUFFER,ft)}}}}function he(t,e){this.name="",this.color=new q(t),this.density=void 0!==e?e:25e-5}function pe(t,e,n){this.name="",this.color=new q(t),this.near=void 0!==e?e:1,this.far=void 0!==n?n:1e3}function fe(){lt.call(this),this.type="Scene",this.background=null,this.fog=null,this.overrideMaterial=null,this.autoUpdate=!0}function de(t,e,n,r,i){lt.call(this),this.lensFlares=[],this.positionScreen=new l,this.customUpdateCallback=void 0,void 0!==t&&this.add(t,e,n,r,i)}function me(t){$.call(this),this.type="SpriteMaterial",this.color=new q(16777215),this.map=null,this.rotation=0,this.fog=!1,this.lights=!1,this.setValues(t)}function ve(t){lt.call(this),this.type="Sprite",this.material=void 0!==t?t:new me}function ge(){lt.call(this),this.type="LOD",Object.defineProperties(this,{levels:{enumerable:!0,value:[]}})}function ye(t,e,n){if(this.useVertexTexture=void 0===n||n,this.identityMatrix=new h,t=t||[],this.bones=t.slice(0),this.useVertexTexture){var r=Math.sqrt(4*this.bones.length);r=fs.nextPowerOfTwo(Math.ceil(r)),r=Math.max(r,4),this.boneTextureWidth=r,this.boneTextureHeight=r,this.boneMatrices=new Float32Array(this.boneTextureWidth*this.boneTextureHeight*4),this.boneTexture=new Y(this.boneMatrices,this.boneTextureWidth,this.boneTextureHeight,Ra,wa)}else this.boneMatrices=new Float32Array(16*this.bones.length);if(void 0===e)this.calculateInverses();else if(this.bones.length===e.length)this.boneInverses=e.slice(0);else{console.warn("THREE.Skeleton bonInverses is the wrong length."),this.boneInverses=[];for(var i=0,o=this.bones.length;i=t.HAVE_CURRENT_DATA&&(h.needsUpdate=!0)}o.call(this,t,e,n,r,i,a,s,u,c),this.generateMipmaps=!1;var h=this;l()}function Ce(t,e,n,r,i,a,s,u,c,l,h,p){o.call(this,null,a,s,u,c,l,r,i,h,p),this.image={width:e,height:n},this.mipmaps=t,this.flipY=!1,this.generateMipmaps=!1}function Pe(t,e,n,r,i,a,s,u,c){o.call(this,t,e,n,r,i,a,s,u,c),this.needsUpdate=!0}function Re(t,e,n,r,i,a,s,u,c,l){if((l=void 0!==l?l:Na)!==Na&&l!==Da)throw new Error("DepthTexture format must be either THREE.DepthFormat or THREE.DepthStencilFormat");void 0===n&&l===Na&&(n=ba),void 0===n&&l===Da&&(n=Aa),o.call(this,null,r,i,a,s,u,l,n,c),this.image={width:t,height:e},this.magFilter=void 0!==s?s:la,this.minFilter=void 0!==u?u:la,this.flipY=!1,this.generateMipmaps=!1}function Le(t){function e(t,e){return t-e}Pt.call(this),this.type="WireframeGeometry";var n,r,i,o,a,s,u,c,h=[],p=[0,0],f={},d=["a","b","c"];if(t&&t.isGeometry){var m=t.faces;for(n=0,i=m.length;n.9&&o<.1&&(e<.2&&(m[t+0]+=1),n<.2&&(m[t+2]+=1),r<.2&&(m[t+4]+=1))}}function s(t){d.push(t.x,t.y,t.z)}function u(e,n){var r=3*e;n.x=t[r+0],n.y=t[r+1],n.z=t[r+2]}function c(){for(var t=new l,e=new l,n=new l,r=new l,o=new i,a=new i,s=new i,u=0,c=0;u0)&&m.push(w,E,T),(u!==n-1||c0&&c(!0),e>0&&c(!1)),this.setIndex(p),this.addAttribute("position",new Et(f,3)),this.addAttribute("normal",new Et(d,3)),this.addAttribute("uv",new Et(m,2))}function ln(t,e,n,r,i,o,a){un.call(this,0,t,e,n,r,i,o,a),this.type="ConeGeometry",this.parameters={radius:t,height:e,radialSegments:n,heightSegments:r,openEnded:i,thetaStart:o,thetaLength:a}}function hn(t,e,n,r,i,o,a){cn.call(this,0,t,e,n,r,i,o,a),this.type="ConeBufferGeometry",this.parameters={radius:t,height:e,radialSegments:n,heightSegments:r,openEnded:i,thetaStart:o,thetaLength:a}}function pn(t,e,n,r){Ct.call(this),this.type="CircleGeometry",this.parameters={radius:t,segments:e,thetaStart:n,thetaLength:r},this.fromBufferGeometry(new fn(t,e,n,r))}function fn(t,e,n,r){Pt.call(this),this.type="CircleBufferGeometry",this.parameters={radius:t,segments:e,thetaStart:n,thetaLength:r},t=t||50,e=void 0!==e?Math.max(3,e):8,n=void 0!==n?n:0,r=void 0!==r?r:2*Math.PI;var o,a,s=[],u=[],c=[],h=[],p=new l,f=new i;for(u.push(0,0,0),c.push(0,0,1),h.push(.5,.5),a=0,o=3;a<=e;a++,o+=3){var d=n+a/e*r;p.x=t*Math.cos(d),p.y=t*Math.sin(d),u.push(p.x,p.y,p.z),c.push(0,0,1),f.x=(u[o]/t+1)/2,f.y=(u[o+1]/t+1)/2,h.push(f.x,f.y)}for(o=1;o<=e;o++)s.push(o,o+1,0);this.setIndex(s),this.addAttribute("position",new Et(u,3)),this.addAttribute("normal",new Et(c,3)),this.addAttribute("uv",new Et(h,2))}function dn(){Q.call(this,{uniforms:xs.merge([Es.lights,{opacity:{value:1}}]),vertexShader:_s.shadow_vert,fragmentShader:_s.shadow_frag}),this.lights=!0,this.transparent=!0,Object.defineProperties(this,{opacity:{enumerable:!0,get:function(){return this.uniforms.opacity.value},set:function(t){this.uniforms.opacity.value=t}}})}function mn(t){Q.call(this,t),this.type="RawShaderMaterial"}function vn(t){this.uuid=fs.generateUUID(),this.type="MultiMaterial",this.materials=Array.isArray(t)?t:[],this.visible=!0}function gn(t){$.call(this),this.defines={STANDARD:""},this.type="MeshStandardMaterial",this.color=new q(16777215),this.roughness=.5,this.metalness=.5,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new q(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalScale=new i(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(t)}function yn(t){gn.call(this),this.defines={PHYSICAL:""},this.type="MeshPhysicalMaterial",this.reflectivity=.5,this.clearCoat=0,this.clearCoatRoughness=0,this.setValues(t)}function bn(t){$.call(this),this.type="MeshPhongMaterial",this.color=new q(16777215),this.specular=new q(1118481),this.shininess=30,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new q(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalScale=new i(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.combine=Wo,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(t)}function xn(t){bn.call(this),this.defines={TOON:""},this.type="MeshToonMaterial",this.gradientMap=null,this.setValues(t)}function _n(t){$.call(this,t),this.type="MeshNormalMaterial",this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalScale=new i(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.wireframe=!1,this.wireframeLinewidth=1,this.fog=!1,this.lights=!1,this.skinning=!1,this.morphTargets=!1,this.morphNormals=!1,this.setValues(t)}function wn(t){$.call(this),this.type="MeshLambertMaterial",this.color=new q(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new q(0),this.emissiveIntensity=1,this.emissiveMap=null,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.combine=Wo,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(t)}function En(t){$.call(this),this.type="LineDashedMaterial",this.color=new q(16777215),this.linewidth=1,this.scale=1,this.dashSize=3,this.gapSize=1,this.lights=!1,this.setValues(t)}function Mn(t,e,n){var r=this,i=!1,o=0,a=0;this.onStart=void 0,this.onLoad=t,this.onProgress=e,this.onError=n,this.itemStart=function(t){a++,!1===i&&void 0!==r.onStart&&r.onStart(t,o,a),i=!0},this.itemEnd=function(t){o++,void 0!==r.onProgress&&r.onProgress(t,o,a),o===a&&(i=!1,void 0!==r.onLoad&&r.onLoad())},this.itemError=function(t){void 0!==r.onError&&r.onError(t)}}function Tn(t){this.manager=void 0!==t?t:Is}function Sn(t){this.manager=void 0!==t?t:Is,this._parser=null}function An(t){this.manager=void 0!==t?t:Is,this._parser=null}function Cn(t){this.manager=void 0!==t?t:Is}function Pn(t){this.manager=void 0!==t?t:Is}function Rn(t){this.manager=void 0!==t?t:Is}function Ln(t,e){lt.call(this),this.type="Light",this.color=new q(t),this.intensity=void 0!==e?e:1,this.receiveShadow=void 0}function On(t,e,n){Ln.call(this,t,n),this.type="HemisphereLight",this.castShadow=void 0,this.position.copy(lt.DefaultUp),this.updateMatrix(),this.groundColor=new q(e)}function In(t){this.camera=t,this.bias=0,this.radius=1,this.mapSize=new i(512,512),this.map=null,this.matrix=new h}function Nn(){In.call(this,new kt(50,1,.5,500))}function Dn(t,e,n,r,i,o){Ln.call(this,t,e),this.type="SpotLight",this.position.copy(lt.DefaultUp),this.updateMatrix(),this.target=new lt,Object.defineProperty(this,"power",{get:function(){return this.intensity*Math.PI},set:function(t){this.intensity=t/Math.PI}}),this.distance=void 0!==n?n:0,this.angle=void 0!==r?r:Math.PI/3,this.penumbra=void 0!==i?i:0,this.decay=void 0!==o?o:1,this.shadow=new Nn}function kn(t,e,n,r){Ln.call(this,t,e),this.type="PointLight",Object.defineProperty(this,"power",{get:function(){return 4*this.intensity*Math.PI},set:function(t){this.intensity=t/(4*Math.PI)}}),this.distance=void 0!==n?n:0,this.decay=void 0!==r?r:1,this.shadow=new In(new kt(90,1,.5,500))}function Un(){In.call(this,new Ut(-5,5,5,-5,.5,500))}function Fn(t,e){Ln.call(this,t,e),this.type="DirectionalLight",this.position.copy(lt.DefaultUp),this.updateMatrix(),this.target=new lt,this.shadow=new Un}function Bn(t,e){Ln.call(this,t,e),this.type="AmbientLight",this.castShadow=void 0}function zn(t,e,n,r){this.parameterPositions=t,this._cachedIndex=0,this.resultBuffer=void 0!==r?r:new e.constructor(n),this.sampleValues=e,this.valueSize=n}function jn(t,e,n,r){zn.call(this,t,e,n,r),this._weightPrev=-0,this._offsetPrev=-0,this._weightNext=-0,this._offsetNext=-0}function Vn(t,e,n,r){zn.call(this,t,e,n,r)}function Hn(t,e,n,r){zn.call(this,t,e,n,r)}function Gn(t,e,n,r){if(void 0===t)throw new Error("track name is undefined");if(void 0===e||0===e.length)throw new Error("no keyframes in track named "+t);this.name=t,this.times=Ns.convertArray(e,this.TimeBufferType),this.values=Ns.convertArray(n,this.ValueBufferType),this.setInterpolation(r||this.DefaultInterpolation),this.validate(),this.optimize()}function Wn(t,e,n,r){Gn.call(this,t,e,n,r)}function Xn(t,e,n,r){zn.call(this,t,e,n,r)}function qn(t,e,n,r){Gn.call(this,t,e,n,r)}function Yn(t,e,n,r){Gn.call(this,t,e,n,r)}function Zn(t,e,n,r){Gn.call(this,t,e,n,r)}function Kn(t,e,n){Gn.call(this,t,e,n)}function Jn(t,e,n,r){Gn.call(this,t,e,n,r)}function $n(t,e,n,r){Gn.apply(this,arguments)}function Qn(t,e,n){this.name=t,this.tracks=n,this.duration=void 0!==e?e:-1,this.uuid=fs.generateUUID(),this.duration<0&&this.resetDuration(),this.optimize()}function tr(t){this.manager=void 0!==t?t:Is,this.textures={}}function er(t){this.manager=void 0!==t?t:Is}function nr(){this.onLoadStart=function(){},this.onLoadProgress=function(){},this.onLoadComplete=function(){}}function rr(t){"boolean"==typeof t&&(console.warn("THREE.JSONLoader: showStatus parameter has been removed from constructor."),t=void 0),this.manager=void 0!==t?t:Is,this.withCredentials=!1}function ir(t){this.manager=void 0!==t?t:Is,this.texturePath=""}function or(t,e,n,r,i){var o=.5*(r-e),a=.5*(i-n),s=t*t;return(2*n-2*r+o+a)*(t*s)+(-3*n+3*r-2*o-a)*s+o*t+n}function ar(t,e){var n=1-t;return n*n*e}function sr(t,e){return 2*(1-t)*t*e}function ur(t,e){return t*t*e}function cr(t,e,n,r){return ar(t,e)+sr(t,n)+ur(t,r)}function lr(t,e){var n=1-t;return n*n*n*e}function hr(t,e){var n=1-t;return 3*n*n*t*e}function pr(t,e){return 3*(1-t)*t*t*e}function fr(t,e){return t*t*t*e}function dr(t,e,n,r,i){return lr(t,e)+hr(t,n)+pr(t,r)+fr(t,i)}function mr(){}function vr(t,e){this.v1=t,this.v2=e}function gr(){this.curves=[],this.autoClose=!1}function yr(t,e,n,r,i,o,a,s){this.aX=t,this.aY=e,this.xRadius=n,this.yRadius=r,this.aStartAngle=i,this.aEndAngle=o,this.aClockwise=a,this.aRotation=s||0}function br(t){this.points=void 0===t?[]:t}function xr(t,e,n,r){this.v0=t,this.v1=e,this.v2=n,this.v3=r}function _r(t,e,n){this.v0=t,this.v1=e,this.v2=n}function wr(t){gr.call(this),this.currentPoint=new i,t&&this.fromPoints(t)}function Er(){wr.apply(this,arguments),this.holes=[]}function Mr(){this.subPaths=[],this.currentPath=null}function Tr(t){this.data=t}function Sr(t){this.manager=void 0!==t?t:Is}function Ar(t){this.manager=void 0!==t?t:Is}function Cr(t,e,n,r){Ln.call(this,t,e),this.type="RectAreaLight",this.position.set(0,1,0),this.updateMatrix(),this.width=void 0!==n?n:10,this.height=void 0!==r?r:10}function Pr(){this.type="StereoCamera",this.aspect=1,this.eyeSep=.064,this.cameraL=new kt,this.cameraL.layers.enable(1),this.cameraL.matrixAutoUpdate=!1,this.cameraR=new kt,this.cameraR.layers.enable(2),this.cameraR.matrixAutoUpdate=!1}function Rr(t,e,n){lt.call(this),this.type="CubeCamera";var r=new kt(90,1,t,e);r.up.set(0,-1,0),r.lookAt(new l(1,0,0)),this.add(r);var i=new kt(90,1,t,e);i.up.set(0,-1,0),i.lookAt(new l(-1,0,0)),this.add(i);var o=new kt(90,1,t,e);o.up.set(0,0,1),o.lookAt(new l(0,1,0)),this.add(o);var a=new kt(90,1,t,e);a.up.set(0,0,-1),a.lookAt(new l(0,-1,0)),this.add(a);var s=new kt(90,1,t,e);s.up.set(0,-1,0),s.lookAt(new l(0,0,1)),this.add(s);var c=new kt(90,1,t,e);c.up.set(0,-1,0),c.lookAt(new l(0,0,-1)),this.add(c);var h={format:Pa,magFilter:fa,minFilter:fa};this.renderTarget=new u(n,n,h),this.updateCubeMap=function(t,e){null===this.parent&&this.updateMatrixWorld();var n=this.renderTarget,u=n.texture.generateMipmaps;n.texture.generateMipmaps=!1,n.activeCubeFace=0,t.render(e,r,n),n.activeCubeFace=1,t.render(e,i,n),n.activeCubeFace=2,t.render(e,o,n),n.activeCubeFace=3,t.render(e,a,n),n.activeCubeFace=4,t.render(e,s,n),n.texture.generateMipmaps=u,n.activeCubeFace=5,t.render(e,c,n),t.setRenderTarget(null)}}function Lr(){lt.call(this),this.type="AudioListener",this.context=Fs.getContext(),this.gain=this.context.createGain(),this.gain.connect(this.context.destination),this.filter=null}function Or(t){lt.call(this),this.type="Audio",this.context=t.context,this.gain=this.context.createGain(),this.gain.connect(t.getInput()),this.autoplay=!1,this.buffer=null,this.loop=!1,this.startTime=0,this.playbackRate=1,this.isPlaying=!1,this.hasPlaybackControl=!0,this.sourceType="empty",this.filters=[]}function Ir(t){Or.call(this,t),this.panner=this.context.createPanner(),this.panner.connect(this.gain)}function Nr(t,e){this.analyser=t.context.createAnalyser(),this.analyser.fftSize=void 0!==e?e:2048,this.data=new Uint8Array(this.analyser.frequencyBinCount),t.getOutput().connect(this.analyser)}function Dr(t,e,n){this.binding=t,this.valueSize=n;var r,i=Float64Array;switch(e){case"quaternion":r=this._slerp;break;case"string":case"bool":i=Array,r=this._select;break;default:r=this._lerp}this.buffer=new i(4*n),this._mixBufferRegion=r,this.cumulativeWeight=0,this.useCount=0,this.referenceCount=0}function kr(t,e,n){this.path=e,this.parsedPath=n||kr.parseTrackName(e),this.node=kr.findNode(t,this.parsedPath.nodeName)||t,this.rootNode=t}function Ur(t){this.uuid=fs.generateUUID(),this._objects=Array.prototype.slice.call(arguments),this.nCachedObjects_=0;var e={};this._indicesByUUID=e;for(var n=0,r=arguments.length;n!==r;++n)e[arguments[n].uuid]=n;this._paths=[],this._parsedPaths=[],this._bindings=[],this._bindingsIndicesByPath={};var i=this;this.stats={objects:{get total(){return i._objects.length},get inUse(){return this.total-i.nCachedObjects_}},get bindingsPerObject(){return i._bindings.length}}}function Fr(t,e,n){this._mixer=t,this._clip=e,this._localRoot=n||null;for(var r=e.tracks,i=r.length,o=new Array(i),a={endingStart:Ja,endingEnd:Ja},s=0;s!==i;++s){var u=r[s].createInterpolant(null);o[s]=u,u.settings=a}this._interpolantSettings=a,this._interpolants=o,this._propertyBindings=new Array(i),this._cacheIndex=null,this._byClipCacheIndex=null,this._timeScaleInterpolant=null,this._weightInterpolant=null,this.loop=Xa,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 Br(t){this._root=t,this._initMemoryManager(),this._accuIndex=0,this.time=0,this.timeScale=1}function zr(t){"string"==typeof t&&(console.warn("THREE.Uniform: Type parameter is no longer needed."),t=arguments[1]),this.value=t}function jr(){Pt.call(this),this.type="InstancedBufferGeometry",this.maxInstancedCount=void 0}function Vr(t,e,n,r){this.uuid=fs.generateUUID(),this.data=t,this.itemSize=e,this.offset=n,this.normalized=!0===r}function Hr(t,e){this.uuid=fs.generateUUID(),this.array=t,this.stride=e,this.count=void 0!==t?t.length/e:0,this.dynamic=!1,this.updateRange={offset:0,count:-1},this.onUploadCallback=function(){},this.version=0}function Gr(t,e,n){Hr.call(this,t,e),this.meshPerAttribute=n||1}function Wr(t,e,n){mt.call(this,t,e),this.meshPerAttribute=n||1}function Xr(t,e,n,r){this.ray=new st(t,e),this.near=n||0,this.far=r||1/0,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 qr(t,e){return t.distance-e.distance}function Yr(t,e,n,r){if(!1!==t.visible&&(t.raycast(e,n),!0===r))for(var i=t.children,o=0,a=i.length;o0?1:+t}),void 0===Function.prototype.name&&Object.defineProperty(Function.prototype,"name",{get:function(){return this.toString().match(/^\s*function\s*([^\(\s]*)/)[1]}}),void 0===Object.assign&&function(){Object.assign=function(t){if(void 0===t||null===t)throw new TypeError("Cannot convert undefined or null to object");for(var e=Object(t),n=1;n>=4,n[i]=e[19===i?3&t|8:t]);return n.join("")}}(),clamp:function(t,e,n){return Math.max(e,Math.min(n,t))},euclideanModulo:function(t,e){return(t%e+e)%e},mapLinear:function(t,e,n,r,i){return r+(t-e)*(i-r)/(n-e)},lerp:function(t,e,n){return(1-n)*t+n*e},smoothstep:function(t,e,n){return t<=e?0:t>=n?1:(t=(t-e)/(n-e))*t*(3-2*t)},smootherstep:function(t,e,n){return t<=e?0:t>=n?1:(t=(t-e)/(n-e))*t*t*(t*(6*t-15)+10)},randInt:function(t,e){return t+Math.floor(Math.random()*(e-t+1))},randFloat:function(t,e){return t+Math.random()*(e-t)},randFloatSpread:function(t){return t*(.5-Math.random())},degToRad:function(t){return t*fs.DEG2RAD},radToDeg:function(t){return t*fs.RAD2DEG},isPowerOfTwo:function(t){return 0==(t&t-1)&&0!==t},nearestPowerOfTwo:function(t){return Math.pow(2,Math.round(Math.log(t)/Math.LN2))},nextPowerOfTwo:function(t){return t--,t|=t>>1,t|=t>>2,t|=t>>4,t|=t>>8,t|=t>>16,++t}};i.prototype={constructor:i,isVector2:!0,get width(){return this.x},set width(t){this.x=t},get height(){return this.y},set height(t){this.y=t},set:function(t,e){return this.x=t,this.y=e,this},setScalar:function(t){return this.x=t,this.y=t,this},setX:function(t){return this.x=t,this},setY:function(t){return this.y=t,this},setComponent:function(t,e){switch(t){case 0:this.x=e;break;case 1:this.y=e;break;default:throw new Error("index is out of range: "+t)}return this},getComponent:function(t){switch(t){case 0:return this.x;case 1:return this.y;default:throw new Error("index is out of range: "+t)}},clone:function(){return new this.constructor(this.x,this.y)},copy:function(t){return this.x=t.x,this.y=t.y,this},add:function(t,e){return void 0!==e?(console.warn("THREE.Vector2: .add() now only accepts one argument. Use .addVectors( a, b ) instead."),this.addVectors(t,e)):(this.x+=t.x,this.y+=t.y,this)},addScalar:function(t){return this.x+=t,this.y+=t,this},addVectors:function(t,e){return this.x=t.x+e.x,this.y=t.y+e.y,this},addScaledVector:function(t,e){return this.x+=t.x*e,this.y+=t.y*e,this},sub:function(t,e){return void 0!==e?(console.warn("THREE.Vector2: .sub() now only accepts one argument. Use .subVectors( a, b ) instead."),this.subVectors(t,e)):(this.x-=t.x,this.y-=t.y,this)},subScalar:function(t){return this.x-=t,this.y-=t,this},subVectors:function(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this},multiply:function(t){return this.x*=t.x,this.y*=t.y,this},multiplyScalar:function(t){return isFinite(t)?(this.x*=t,this.y*=t):(this.x=0,this.y=0),this},divide:function(t){return this.x/=t.x,this.y/=t.y,this},divideScalar:function(t){return this.multiplyScalar(1/t)},min:function(t){return this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y),this},max:function(t){return this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y),this},clamp:function(t,e){return this.x=Math.max(t.x,Math.min(e.x,this.x)),this.y=Math.max(t.y,Math.min(e.y,this.y)),this},clampScalar:function(){var t,e;return function(n,r){return void 0===t&&(t=new i,e=new i),t.set(n,n),e.set(r,r),this.clamp(t,e)}}(),clampLength:function(t,e){var n=this.length();return this.multiplyScalar(Math.max(t,Math.min(e,n))/n)},floor:function(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this},ceil:function(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this},round:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this},roundToZero:function(){return this.x=this.x<0?Math.ceil(this.x):Math.floor(this.x),this.y=this.y<0?Math.ceil(this.y):Math.floor(this.y),this},negate:function(){return this.x=-this.x,this.y=-this.y,this},dot:function(t){return this.x*t.x+this.y*t.y},lengthSq:function(){return this.x*this.x+this.y*this.y},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y)},lengthManhattan:function(){return Math.abs(this.x)+Math.abs(this.y)},normalize:function(){return this.divideScalar(this.length())},angle:function(){var t=Math.atan2(this.y,this.x);return t<0&&(t+=2*Math.PI),t},distanceTo:function(t){return Math.sqrt(this.distanceToSquared(t))},distanceToSquared:function(t){var e=this.x-t.x,n=this.y-t.y;return e*e+n*n},distanceToManhattan:function(t){return Math.abs(this.x-t.x)+Math.abs(this.y-t.y)},setLength:function(t){return this.multiplyScalar(t/this.length())},lerp:function(t,e){return this.x+=(t.x-this.x)*e,this.y+=(t.y-this.y)*e,this},lerpVectors:function(t,e,n){return this.subVectors(e,t).multiplyScalar(n).add(t)},equals:function(t){return t.x===this.x&&t.y===this.y},fromArray:function(t,e){return void 0===e&&(e=0),this.x=t[e],this.y=t[e+1],this},toArray:function(t,e){return void 0===t&&(t=[]),void 0===e&&(e=0),t[e]=this.x,t[e+1]=this.y,t},fromBufferAttribute:function(t,e,n){return void 0!==n&&console.warn("THREE.Vector2: offset has been removed from .fromBufferAttribute()."),this.x=t.getX(e),this.y=t.getY(e),this},rotateAround:function(t,e){var n=Math.cos(e),r=Math.sin(e),i=this.x-t.x,o=this.y-t.y;return this.x=i*n-o*r+t.x,this.y=i*r+o*n+t.y,this}};var ds=0;o.DEFAULT_IMAGE=void 0,o.DEFAULT_MAPPING=Qo,o.prototype={constructor:o,isTexture:!0,set needsUpdate(t){!0===t&&this.version++},clone:function(){return(new this.constructor).copy(this)},copy:function(t){return this.image=t.image,this.mipmaps=t.mipmaps.slice(0),this.mapping=t.mapping,this.wrapS=t.wrapS,this.wrapT=t.wrapT,this.magFilter=t.magFilter,this.minFilter=t.minFilter,this.anisotropy=t.anisotropy,this.format=t.format,this.type=t.type,this.offset.copy(t.offset),this.repeat.copy(t.repeat),this.generateMipmaps=t.generateMipmaps,this.premultiplyAlpha=t.premultiplyAlpha,this.flipY=t.flipY,this.unpackAlignment=t.unpackAlignment,this.encoding=t.encoding,this},toJSON:function(t){if(void 0!==t.textures[this.uuid])return t.textures[this.uuid];var e={metadata:{version:4.4,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],wrap:[this.wrapS,this.wrapT],minFilter:this.minFilter,magFilter:this.magFilter,anisotropy:this.anisotropy,flipY:this.flipY};if(void 0!==this.image){var n=this.image;void 0===n.uuid&&(n.uuid=fs.generateUUID()),void 0===t.images[n.uuid]&&(t.images[n.uuid]={uuid:n.uuid,url:function(t){var e;return void 0!==t.toDataURL?e=t:(e=document.createElementNS("http://www.w3.org/1999/xhtml","canvas"),e.width=t.width,e.height=t.height,e.getContext("2d").drawImage(t,0,0,t.width,t.height)),e.width>2048||e.height>2048?e.toDataURL("image/jpeg",.6):e.toDataURL("image/png")}(n)}),e.image=n.uuid}return t.textures[this.uuid]=e,e},dispose:function(){this.dispatchEvent({type:"dispose"})},transformUv:function(t){if(this.mapping===Qo){if(t.multiply(this.repeat),t.add(this.offset),t.x<0||t.x>1)switch(this.wrapS){case sa:t.x=t.x-Math.floor(t.x);break;case ua:t.x=t.x<0?0:1;break;case ca:1===Math.abs(Math.floor(t.x)%2)?t.x=Math.ceil(t.x)-t.x:t.x=t.x-Math.floor(t.x)}if(t.y<0||t.y>1)switch(this.wrapT){case sa:t.y=t.y-Math.floor(t.y);break;case ua:t.y=t.y<0?0:1;break;case ca:1===Math.abs(Math.floor(t.y)%2)?t.y=Math.ceil(t.y)-t.y:t.y=t.y-Math.floor(t.y)}this.flipY&&(t.y=1-t.y)}}},Object.assign(o.prototype,r.prototype),a.prototype={constructor:a,isVector4:!0,set:function(t,e,n,r){return this.x=t,this.y=e,this.z=n,this.w=r,this},setScalar:function(t){return this.x=t,this.y=t,this.z=t,this.w=t,this},setX:function(t){return this.x=t,this},setY:function(t){return this.y=t,this},setZ:function(t){return this.z=t,this},setW:function(t){return this.w=t,this},setComponent:function(t,e){switch(t){case 0:this.x=e;break;case 1:this.y=e;break;case 2:this.z=e;break;case 3:this.w=e;break;default:throw new Error("index is out of range: "+t)}return this},getComponent:function(t){switch(t){case 0:return this.x;case 1:return this.y;case 2:return this.z;case 3:return this.w;default:throw new Error("index is out of range: "+t)}},clone:function(){return new this.constructor(this.x,this.y,this.z,this.w)},copy:function(t){return this.x=t.x,this.y=t.y,this.z=t.z,this.w=void 0!==t.w?t.w:1,this},add:function(t,e){return void 0!==e?(console.warn("THREE.Vector4: .add() now only accepts one argument. Use .addVectors( a, b ) instead."),this.addVectors(t,e)):(this.x+=t.x,this.y+=t.y,this.z+=t.z,this.w+=t.w,this)},addScalar:function(t){return this.x+=t,this.y+=t,this.z+=t,this.w+=t,this},addVectors:function(t,e){return this.x=t.x+e.x,this.y=t.y+e.y,this.z=t.z+e.z,this.w=t.w+e.w,this},addScaledVector:function(t,e){return this.x+=t.x*e,this.y+=t.y*e,this.z+=t.z*e,this.w+=t.w*e,this},sub:function(t,e){return void 0!==e?(console.warn("THREE.Vector4: .sub() now only accepts one argument. Use .subVectors( a, b ) instead."),this.subVectors(t,e)):(this.x-=t.x,this.y-=t.y,this.z-=t.z,this.w-=t.w,this)},subScalar:function(t){return this.x-=t,this.y-=t,this.z-=t,this.w-=t,this},subVectors:function(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this.z=t.z-e.z,this.w=t.w-e.w,this},multiplyScalar:function(t){return isFinite(t)?(this.x*=t,this.y*=t,this.z*=t,this.w*=t):(this.x=0,this.y=0,this.z=0,this.w=0),this},applyMatrix4:function(t){var e=this.x,n=this.y,r=this.z,i=this.w,o=t.elements;return this.x=o[0]*e+o[4]*n+o[8]*r+o[12]*i,this.y=o[1]*e+o[5]*n+o[9]*r+o[13]*i,this.z=o[2]*e+o[6]*n+o[10]*r+o[14]*i,this.w=o[3]*e+o[7]*n+o[11]*r+o[15]*i,this},divideScalar:function(t){return this.multiplyScalar(1/t)},setAxisAngleFromQuaternion:function(t){this.w=2*Math.acos(t.w);var e=Math.sqrt(1-t.w*t.w);return e<1e-4?(this.x=1,this.y=0,this.z=0):(this.x=t.x/e,this.y=t.y/e,this.z=t.z/e),this},setAxisAngleFromRotationMatrix:function(t){var e,n,r,i,o=t.elements,a=o[0],s=o[4],u=o[8],c=o[1],l=o[5],h=o[9],p=o[2],f=o[6],d=o[10];if(Math.abs(s-c)<.01&&Math.abs(u-p)<.01&&Math.abs(h-f)<.01){if(Math.abs(s+c)<.1&&Math.abs(u+p)<.1&&Math.abs(h+f)<.1&&Math.abs(a+l+d-3)<.1)return this.set(1,0,0,0),this;e=Math.PI;var m=(a+1)/2,v=(l+1)/2,g=(d+1)/2,y=(s+c)/4,b=(u+p)/4,x=(h+f)/4;return m>v&&m>g?m<.01?(n=0,r=.707106781,i=.707106781):(n=Math.sqrt(m),r=y/n,i=b/n):v>g?v<.01?(n=.707106781,r=0,i=.707106781):(r=Math.sqrt(v),n=y/r,i=x/r):g<.01?(n=.707106781,r=.707106781,i=0):(i=Math.sqrt(g),n=b/i,r=x/i),this.set(n,r,i,e),this}var _=Math.sqrt((f-h)*(f-h)+(u-p)*(u-p)+(c-s)*(c-s));return Math.abs(_)<.001&&(_=1),this.x=(f-h)/_,this.y=(u-p)/_,this.z=(c-s)/_,this.w=Math.acos((a+l+d-1)/2),this},min:function(t){return this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y),this.z=Math.min(this.z,t.z),this.w=Math.min(this.w,t.w),this},max:function(t){return this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y),this.z=Math.max(this.z,t.z),this.w=Math.max(this.w,t.w),this},clamp:function(t,e){return this.x=Math.max(t.x,Math.min(e.x,this.x)),this.y=Math.max(t.y,Math.min(e.y,this.y)),this.z=Math.max(t.z,Math.min(e.z,this.z)),this.w=Math.max(t.w,Math.min(e.w,this.w)),this},clampScalar:function(){var t,e;return function(n,r){return void 0===t&&(t=new a,e=new a),t.set(n,n,n,n),e.set(r,r,r,r),this.clamp(t,e)}}(),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(t){return this.x*t.x+this.y*t.y+this.z*t.z+this.w*t.w},lengthSq:function(){return this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)},lengthManhattan: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())},setLength:function(t){return this.multiplyScalar(t/this.length())},lerp:function(t,e){return this.x+=(t.x-this.x)*e,this.y+=(t.y-this.y)*e,this.z+=(t.z-this.z)*e,this.w+=(t.w-this.w)*e,this},lerpVectors:function(t,e,n){return this.subVectors(e,t).multiplyScalar(n).add(t)},equals:function(t){return t.x===this.x&&t.y===this.y&&t.z===this.z&&t.w===this.w},fromArray:function(t,e){return void 0===e&&(e=0),this.x=t[e],this.y=t[e+1],this.z=t[e+2],this.w=t[e+3],this},toArray:function(t,e){return void 0===t&&(t=[]),void 0===e&&(e=0),t[e]=this.x,t[e+1]=this.y,t[e+2]=this.z,t[e+3]=this.w,t},fromBufferAttribute:function(t,e,n){return void 0!==n&&console.warn("THREE.Vector4: offset has been removed from .fromBufferAttribute()."),this.x=t.getX(e),this.y=t.getY(e),this.z=t.getZ(e),this.w=t.getW(e),this}},s.prototype={constructor:s,isWebGLRenderTarget:!0,setSize:function(t,e){this.width===t&&this.height===e||(this.width=t,this.height=e,this.dispose()),this.viewport.set(0,0,t,e),this.scissor.set(0,0,t,e)},clone:function(){return(new this.constructor).copy(this)},copy:function(t){return this.width=t.width,this.height=t.height,this.viewport.copy(t.viewport),this.texture=t.texture.clone(),this.depthBuffer=t.depthBuffer,this.stencilBuffer=t.stencilBuffer,this.depthTexture=t.depthTexture,this},dispose:function(){this.dispatchEvent({type:"dispose"})}},Object.assign(s.prototype,r.prototype),u.prototype=Object.create(s.prototype),u.prototype.constructor=u,u.prototype.isWebGLRenderTargetCube=!0,c.prototype={constructor:c,get x(){return this._x},set x(t){this._x=t,this.onChangeCallback()},get y(){return this._y},set y(t){this._y=t,this.onChangeCallback()},get z(){return this._z},set z(t){this._z=t,this.onChangeCallback()},get w(){return this._w},set w(t){this._w=t,this.onChangeCallback()},set:function(t,e,n,r){return this._x=t,this._y=e,this._z=n,this._w=r,this.onChangeCallback(),this},clone:function(){return new this.constructor(this._x,this._y,this._z,this._w)},copy:function(t){return this._x=t.x,this._y=t.y,this._z=t.z,this._w=t.w,this.onChangeCallback(),this},setFromEuler:function(t,e){if(!1===(t&&t.isEuler))throw new Error("THREE.Quaternion: .setFromEuler() now expects an Euler rotation rather than a Vector3 and order.");var n=Math.cos(t._x/2),r=Math.cos(t._y/2),i=Math.cos(t._z/2),o=Math.sin(t._x/2),a=Math.sin(t._y/2),s=Math.sin(t._z/2),u=t.order;return"XYZ"===u?(this._x=o*r*i+n*a*s,this._y=n*a*i-o*r*s,this._z=n*r*s+o*a*i,this._w=n*r*i-o*a*s):"YXZ"===u?(this._x=o*r*i+n*a*s,this._y=n*a*i-o*r*s,this._z=n*r*s-o*a*i,this._w=n*r*i+o*a*s):"ZXY"===u?(this._x=o*r*i-n*a*s,this._y=n*a*i+o*r*s,this._z=n*r*s+o*a*i,this._w=n*r*i-o*a*s):"ZYX"===u?(this._x=o*r*i-n*a*s,this._y=n*a*i+o*r*s,this._z=n*r*s-o*a*i,this._w=n*r*i+o*a*s):"YZX"===u?(this._x=o*r*i+n*a*s,this._y=n*a*i+o*r*s,this._z=n*r*s-o*a*i,this._w=n*r*i-o*a*s):"XZY"===u&&(this._x=o*r*i-n*a*s,this._y=n*a*i-o*r*s,this._z=n*r*s+o*a*i,this._w=n*r*i+o*a*s),!1!==e&&this.onChangeCallback(),this},setFromAxisAngle:function(t,e){var n=e/2,r=Math.sin(n);return this._x=t.x*r,this._y=t.y*r,this._z=t.z*r,this._w=Math.cos(n),this.onChangeCallback(),this},setFromRotationMatrix:function(t){var e,n=t.elements,r=n[0],i=n[4],o=n[8],a=n[1],s=n[5],u=n[9],c=n[2],l=n[6],h=n[10],p=r+s+h;return p>0?(e=.5/Math.sqrt(p+1),this._w=.25/e,this._x=(l-u)*e,this._y=(o-c)*e,this._z=(a-i)*e):r>s&&r>h?(e=2*Math.sqrt(1+r-s-h),this._w=(l-u)/e,this._x=.25*e,this._y=(i+a)/e,this._z=(o+c)/e):s>h?(e=2*Math.sqrt(1+s-r-h),this._w=(o-c)/e,this._x=(i+a)/e,this._y=.25*e,this._z=(u+l)/e):(e=2*Math.sqrt(1+h-r-s),this._w=(a-i)/e,this._x=(o+c)/e,this._y=(u+l)/e,this._z=.25*e),this.onChangeCallback(),this},setFromUnitVectors:function(){var t,e;return function(n,r){return void 0===t&&(t=new l),e=n.dot(r)+1,e<1e-6?(e=0,Math.abs(n.x)>Math.abs(n.z)?t.set(-n.y,n.x,0):t.set(0,-n.z,n.y)):t.crossVectors(n,r),this._x=t.x,this._y=t.y,this._z=t.z,this._w=e,this.normalize()}}(),inverse:function(){return this.conjugate().normalize()},conjugate:function(){return this._x*=-1,this._y*=-1,this._z*=-1,this.onChangeCallback(),this},dot:function(t){return this._x*t._x+this._y*t._y+this._z*t._z+this._w*t._w},lengthSq:function(){return this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w},length:function(){return Math.sqrt(this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w)},normalize:function(){var t=this.length();return 0===t?(this._x=0,this._y=0,this._z=0,this._w=1):(t=1/t,this._x=this._x*t,this._y=this._y*t,this._z=this._z*t,this._w=this._w*t),this.onChangeCallback(),this},multiply:function(t,e){return void 0!==e?(console.warn("THREE.Quaternion: .multiply() now only accepts one argument. Use .multiplyQuaternions( a, b ) instead."),this.multiplyQuaternions(t,e)):this.multiplyQuaternions(this,t)},premultiply:function(t){return this.multiplyQuaternions(t,this)},multiplyQuaternions:function(t,e){var n=t._x,r=t._y,i=t._z,o=t._w,a=e._x,s=e._y,u=e._z,c=e._w;return this._x=n*c+o*a+r*u-i*s,this._y=r*c+o*s+i*a-n*u,this._z=i*c+o*u+n*s-r*a,this._w=o*c-n*a-r*s-i*u,this.onChangeCallback(),this},slerp:function(t,e){if(0===e)return this;if(1===e)return this.copy(t);var n=this._x,r=this._y,i=this._z,o=this._w,a=o*t._w+n*t._x+r*t._y+i*t._z;if(a<0?(this._w=-t._w,this._x=-t._x,this._y=-t._y,this._z=-t._z,a=-a):this.copy(t),a>=1)return this._w=o,this._x=n,this._y=r,this._z=i,this;var s=Math.sqrt(1-a*a);if(Math.abs(s)<.001)return this._w=.5*(o+this._w),this._x=.5*(n+this._x),this._y=.5*(r+this._y),this._z=.5*(i+this._z),this;var u=Math.atan2(s,a),c=Math.sin((1-e)*u)/s,l=Math.sin(e*u)/s;return this._w=o*c+this._w*l,this._x=n*c+this._x*l,this._y=r*c+this._y*l,this._z=i*c+this._z*l,this.onChangeCallback(),this},equals:function(t){return t._x===this._x&&t._y===this._y&&t._z===this._z&&t._w===this._w},fromArray:function(t,e){return void 0===e&&(e=0),this._x=t[e],this._y=t[e+1],this._z=t[e+2],this._w=t[e+3],this.onChangeCallback(),this},toArray:function(t,e){return void 0===t&&(t=[]),void 0===e&&(e=0),t[e]=this._x,t[e+1]=this._y,t[e+2]=this._z,t[e+3]=this._w,t},onChange:function(t){return this.onChangeCallback=t,this},onChangeCallback:function(){}},Object.assign(c,{slerp:function(t,e,n,r){return n.copy(t).slerp(e,r)},slerpFlat:function(t,e,n,r,i,o,a){var s=n[r+0],u=n[r+1],c=n[r+2],l=n[r+3],h=i[o+0],p=i[o+1],f=i[o+2],d=i[o+3];if(l!==d||s!==h||u!==p||c!==f){var m=1-a,v=s*h+u*p+c*f+l*d,g=v>=0?1:-1,y=1-v*v;if(y>Number.EPSILON){var b=Math.sqrt(y),x=Math.atan2(b,v*g);m=Math.sin(m*x)/b,a=Math.sin(a*x)/b}var _=a*g;if(s=s*m+h*_,u=u*m+p*_,c=c*m+f*_,l=l*m+d*_,m===1-a){var w=1/Math.sqrt(s*s+u*u+c*c+l*l);s*=w,u*=w,c*=w,l*=w}}t[e]=s,t[e+1]=u,t[e+2]=c,t[e+3]=l}}),l.prototype={constructor:l,isVector3:!0,set:function(t,e,n){return this.x=t,this.y=e,this.z=n,this},setScalar:function(t){return this.x=t,this.y=t,this.z=t,this},setX:function(t){return this.x=t,this},setY:function(t){return this.y=t,this},setZ:function(t){return this.z=t,this},setComponent:function(t,e){switch(t){case 0:this.x=e;break;case 1:this.y=e;break;case 2:this.z=e;break;default:throw new Error("index is out of range: "+t)}return this},getComponent:function(t){switch(t){case 0:return this.x;case 1:return this.y;case 2:return this.z;default:throw new Error("index is out of range: "+t)}},clone:function(){return new this.constructor(this.x,this.y,this.z)},copy:function(t){return this.x=t.x,this.y=t.y,this.z=t.z,this},add:function(t,e){return void 0!==e?(console.warn("THREE.Vector3: .add() now only accepts one argument. Use .addVectors( a, b ) instead."),this.addVectors(t,e)):(this.x+=t.x,this.y+=t.y,this.z+=t.z,this)},addScalar:function(t){return this.x+=t,this.y+=t,this.z+=t,this},addVectors:function(t,e){return this.x=t.x+e.x,this.y=t.y+e.y,this.z=t.z+e.z,this},addScaledVector:function(t,e){return this.x+=t.x*e,this.y+=t.y*e,this.z+=t.z*e,this},sub:function(t,e){return void 0!==e?(console.warn("THREE.Vector3: .sub() now only accepts one argument. Use .subVectors( a, b ) instead."),this.subVectors(t,e)):(this.x-=t.x,this.y-=t.y,this.z-=t.z,this)},subScalar:function(t){return this.x-=t,this.y-=t,this.z-=t,this},subVectors:function(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this.z=t.z-e.z,this},multiply:function(t,e){return void 0!==e?(console.warn("THREE.Vector3: .multiply() now only accepts one argument. Use .multiplyVectors( a, b ) instead."),this.multiplyVectors(t,e)):(this.x*=t.x,this.y*=t.y,this.z*=t.z,this)},multiplyScalar:function(t){return isFinite(t)?(this.x*=t,this.y*=t,this.z*=t):(this.x=0,this.y=0,this.z=0),this},multiplyVectors:function(t,e){return this.x=t.x*e.x,this.y=t.y*e.y,this.z=t.z*e.z,this},applyEuler:function(){var t;return function(e){return!1===(e&&e.isEuler)&&console.error("THREE.Vector3: .applyEuler() now expects an Euler rotation rather than a Vector3 and order."),void 0===t&&(t=new c),this.applyQuaternion(t.setFromEuler(e))}}(),applyAxisAngle:function(){var t;return function(e,n){return void 0===t&&(t=new c),this.applyQuaternion(t.setFromAxisAngle(e,n))}}(),applyMatrix3:function(t){var e=this.x,n=this.y,r=this.z,i=t.elements;return this.x=i[0]*e+i[3]*n+i[6]*r,this.y=i[1]*e+i[4]*n+i[7]*r,this.z=i[2]*e+i[5]*n+i[8]*r,this},applyMatrix4:function(t){var e=this.x,n=this.y,r=this.z,i=t.elements;this.x=i[0]*e+i[4]*n+i[8]*r+i[12],this.y=i[1]*e+i[5]*n+i[9]*r+i[13],this.z=i[2]*e+i[6]*n+i[10]*r+i[14];var o=i[3]*e+i[7]*n+i[11]*r+i[15];return this.divideScalar(o)},applyQuaternion:function(t){var e=this.x,n=this.y,r=this.z,i=t.x,o=t.y,a=t.z,s=t.w,u=s*e+o*r-a*n,c=s*n+a*e-i*r,l=s*r+i*n-o*e,h=-i*e-o*n-a*r;return this.x=u*s+h*-i+c*-a-l*-o,this.y=c*s+h*-o+l*-i-u*-a,this.z=l*s+h*-a+u*-o-c*-i,this},project:function(){var t;return function(e){return void 0===t&&(t=new h),t.multiplyMatrices(e.projectionMatrix,t.getInverse(e.matrixWorld)),this.applyMatrix4(t)}}(),unproject:function(){var t;return function(e){return void 0===t&&(t=new h),t.multiplyMatrices(e.matrixWorld,t.getInverse(e.projectionMatrix)),this.applyMatrix4(t)}}(),transformDirection:function(t){var e=this.x,n=this.y,r=this.z,i=t.elements;return this.x=i[0]*e+i[4]*n+i[8]*r,this.y=i[1]*e+i[5]*n+i[9]*r,this.z=i[2]*e+i[6]*n+i[10]*r,this.normalize()},divide:function(t){return this.x/=t.x,this.y/=t.y,this.z/=t.z,this},divideScalar:function(t){return this.multiplyScalar(1/t)},min:function(t){return this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y),this.z=Math.min(this.z,t.z),this},max:function(t){return this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y),this.z=Math.max(this.z,t.z),this},clamp:function(t,e){return this.x=Math.max(t.x,Math.min(e.x,this.x)),this.y=Math.max(t.y,Math.min(e.y,this.y)),this.z=Math.max(t.z,Math.min(e.z,this.z)),this},clampScalar:function(){var t,e;return function(n,r){return void 0===t&&(t=new l,e=new l),t.set(n,n,n),e.set(r,r,r),this.clamp(t,e)}}(),clampLength:function(t,e){var n=this.length();return this.multiplyScalar(Math.max(t,Math.min(e,n))/n)},floor:function(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this},ceil:function(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this},round:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this},roundToZero:function(){return this.x=this.x<0?Math.ceil(this.x):Math.floor(this.x),this.y=this.y<0?Math.ceil(this.y):Math.floor(this.y),this.z=this.z<0?Math.ceil(this.z):Math.floor(this.z),this},negate:function(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this},dot:function(t){return this.x*t.x+this.y*t.y+this.z*t.z},lengthSq:function(){return this.x*this.x+this.y*this.y+this.z*this.z},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)},lengthManhattan:function(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)},normalize:function(){return this.divideScalar(this.length())},setLength:function(t){return this.multiplyScalar(t/this.length())},lerp:function(t,e){return this.x+=(t.x-this.x)*e,this.y+=(t.y-this.y)*e,this.z+=(t.z-this.z)*e,this},lerpVectors:function(t,e,n){return this.subVectors(e,t).multiplyScalar(n).add(t)},cross:function(t,e){if(void 0!==e)return console.warn("THREE.Vector3: .cross() now only accepts one argument. Use .crossVectors( a, b ) instead."),this.crossVectors(t,e);var n=this.x,r=this.y,i=this.z;return this.x=r*t.z-i*t.y,this.y=i*t.x-n*t.z,this.z=n*t.y-r*t.x,this},crossVectors:function(t,e){var n=t.x,r=t.y,i=t.z,o=e.x,a=e.y,s=e.z;return this.x=r*s-i*a,this.y=i*o-n*s,this.z=n*a-r*o,this},projectOnVector:function(t){var e=t.dot(this)/t.lengthSq();return this.copy(t).multiplyScalar(e)},projectOnPlane:function(){var t;return function(e){return void 0===t&&(t=new l),t.copy(this).projectOnVector(e),this.sub(t)}}(),reflect:function(){var t;return function(e){return void 0===t&&(t=new l),this.sub(t.copy(e).multiplyScalar(2*this.dot(e)))}}(),angleTo:function(t){var e=this.dot(t)/Math.sqrt(this.lengthSq()*t.lengthSq());return Math.acos(fs.clamp(e,-1,1))},distanceTo:function(t){return Math.sqrt(this.distanceToSquared(t))},distanceToSquared:function(t){var e=this.x-t.x,n=this.y-t.y,r=this.z-t.z;return e*e+n*n+r*r},distanceToManhattan:function(t){return Math.abs(this.x-t.x)+Math.abs(this.y-t.y)+Math.abs(this.z-t.z)},setFromSpherical:function(t){var e=Math.sin(t.phi)*t.radius;return this.x=e*Math.sin(t.theta),this.y=Math.cos(t.phi)*t.radius,this.z=e*Math.cos(t.theta),this},setFromCylindrical:function(t){return this.x=t.radius*Math.sin(t.theta),this.y=t.y,this.z=t.radius*Math.cos(t.theta),this},setFromMatrixPosition:function(t){return this.setFromMatrixColumn(t,3)},setFromMatrixScale:function(t){var e=this.setFromMatrixColumn(t,0).length(),n=this.setFromMatrixColumn(t,1).length(),r=this.setFromMatrixColumn(t,2).length();return this.x=e,this.y=n,this.z=r,this},setFromMatrixColumn:function(t,e){if("number"==typeof t){console.warn("THREE.Vector3: setFromMatrixColumn now expects ( matrix, index ).");var n=t;t=e,e=n}return this.fromArray(t.elements,4*e)},equals:function(t){return t.x===this.x&&t.y===this.y&&t.z===this.z},fromArray:function(t,e){return void 0===e&&(e=0),this.x=t[e],this.y=t[e+1],this.z=t[e+2],this},toArray:function(t,e){return void 0===t&&(t=[]),void 0===e&&(e=0),t[e]=this.x,t[e+1]=this.y,t[e+2]=this.z,t},fromBufferAttribute:function(t,e,n){return void 0!==n&&console.warn("THREE.Vector3: offset has been removed from .fromBufferAttribute()."),this.x=t.getX(e),this.y=t.getY(e),this.z=t.getZ(e),this}},h.prototype={constructor:h,isMatrix4:!0,set:function(t,e,n,r,i,o,a,s,u,c,l,h,p,f,d,m){var v=this.elements;return v[0]=t,v[4]=e,v[8]=n,v[12]=r,v[1]=i,v[5]=o,v[9]=a,v[13]=s,v[2]=u,v[6]=c,v[10]=l,v[14]=h,v[3]=p,v[7]=f,v[11]=d,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 h).fromArray(this.elements)},copy:function(t){return this.elements.set(t.elements),this},copyPosition:function(t){var e=this.elements,n=t.elements;return e[12]=n[12],e[13]=n[13],e[14]=n[14],this},extractBasis:function(t,e,n){return t.setFromMatrixColumn(this,0),e.setFromMatrixColumn(this,1),n.setFromMatrixColumn(this,2),this},makeBasis:function(t,e,n){return this.set(t.x,e.x,n.x,0,t.y,e.y,n.y,0,t.z,e.z,n.z,0,0,0,0,1),this},extractRotation:function(){var t;return function(e){void 0===t&&(t=new l);var n=this.elements,r=e.elements,i=1/t.setFromMatrixColumn(e,0).length(),o=1/t.setFromMatrixColumn(e,1).length(),a=1/t.setFromMatrixColumn(e,2).length();return n[0]=r[0]*i,n[1]=r[1]*i,n[2]=r[2]*i,n[4]=r[4]*o,n[5]=r[5]*o,n[6]=r[6]*o,n[8]=r[8]*a,n[9]=r[9]*a,n[10]=r[10]*a,this}}(),makeRotationFromEuler:function(t){!1===(t&&t.isEuler)&&console.error("THREE.Matrix: .makeRotationFromEuler() now expects a Euler rotation rather than a Vector3 and order.");var e=this.elements,n=t.x,r=t.y,i=t.z,o=Math.cos(n),a=Math.sin(n),s=Math.cos(r),u=Math.sin(r),c=Math.cos(i),l=Math.sin(i);if("XYZ"===t.order){var h=o*c,p=o*l,f=a*c,d=a*l;e[0]=s*c,e[4]=-s*l,e[8]=u,e[1]=p+f*u,e[5]=h-d*u,e[9]=-a*s,e[2]=d-h*u,e[6]=f+p*u,e[10]=o*s}else if("YXZ"===t.order){var m=s*c,v=s*l,g=u*c,y=u*l;e[0]=m+y*a,e[4]=g*a-v,e[8]=o*u,e[1]=o*l,e[5]=o*c,e[9]=-a,e[2]=v*a-g,e[6]=y+m*a,e[10]=o*s}else if("ZXY"===t.order){var m=s*c,v=s*l,g=u*c,y=u*l;e[0]=m-y*a,e[4]=-o*l,e[8]=g+v*a,e[1]=v+g*a,e[5]=o*c,e[9]=y-m*a,e[2]=-o*u,e[6]=a,e[10]=o*s}else if("ZYX"===t.order){var h=o*c,p=o*l,f=a*c,d=a*l;e[0]=s*c,e[4]=f*u-p,e[8]=h*u+d,e[1]=s*l,e[5]=d*u+h,e[9]=p*u-f,e[2]=-u,e[6]=a*s,e[10]=o*s}else if("YZX"===t.order){var b=o*s,x=o*u,_=a*s,w=a*u;e[0]=s*c,e[4]=w-b*l,e[8]=_*l+x,e[1]=l,e[5]=o*c,e[9]=-a*c,e[2]=-u*c,e[6]=x*l+_,e[10]=b-w*l}else if("XZY"===t.order){var b=o*s,x=o*u,_=a*s,w=a*u;e[0]=s*c,e[4]=-l,e[8]=u*c,e[1]=b*l+w,e[5]=o*c,e[9]=x*l-_,e[2]=_*l-x,e[6]=a*c,e[10]=w*l+b}return e[3]=0,e[7]=0,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,this},makeRotationFromQuaternion:function(t){var e=this.elements,n=t.x,r=t.y,i=t.z,o=t.w,a=n+n,s=r+r,u=i+i,c=n*a,l=n*s,h=n*u,p=r*s,f=r*u,d=i*u,m=o*a,v=o*s,g=o*u;return e[0]=1-(p+d),e[4]=l-g,e[8]=h+v,e[1]=l+g,e[5]=1-(c+d),e[9]=f-m,e[2]=h-v,e[6]=f+m,e[10]=1-(c+p),e[3]=0,e[7]=0,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,this},lookAt:function(){var t,e,n;return function(r,i,o){void 0===t&&(t=new l,e=new l,n=new l);var a=this.elements;return n.subVectors(r,i).normalize(),0===n.lengthSq()&&(n.z=1),t.crossVectors(o,n).normalize(),0===t.lengthSq()&&(n.z+=1e-4,t.crossVectors(o,n).normalize()),e.crossVectors(n,t),a[0]=t.x,a[4]=e.x,a[8]=n.x,a[1]=t.y,a[5]=e.y,a[9]=n.y,a[2]=t.z,a[6]=e.z,a[10]=n.z,this}}(),multiply:function(t,e){return void 0!==e?(console.warn("THREE.Matrix4: .multiply() now only accepts one argument. Use .multiplyMatrices( a, b ) instead."),this.multiplyMatrices(t,e)):this.multiplyMatrices(this,t)},premultiply:function(t){return this.multiplyMatrices(t,this)},multiplyMatrices:function(t,e){var n=t.elements,r=e.elements,i=this.elements,o=n[0],a=n[4],s=n[8],u=n[12],c=n[1],l=n[5],h=n[9],p=n[13],f=n[2],d=n[6],m=n[10],v=n[14],g=n[3],y=n[7],b=n[11],x=n[15],_=r[0],w=r[4],E=r[8],M=r[12],T=r[1],S=r[5],A=r[9],C=r[13],P=r[2],R=r[6],L=r[10],O=r[14],I=r[3],N=r[7],D=r[11],k=r[15];return i[0]=o*_+a*T+s*P+u*I,i[4]=o*w+a*S+s*R+u*N,i[8]=o*E+a*A+s*L+u*D,i[12]=o*M+a*C+s*O+u*k,i[1]=c*_+l*T+h*P+p*I,i[5]=c*w+l*S+h*R+p*N,i[9]=c*E+l*A+h*L+p*D,i[13]=c*M+l*C+h*O+p*k,i[2]=f*_+d*T+m*P+v*I,i[6]=f*w+d*S+m*R+v*N,i[10]=f*E+d*A+m*L+v*D,i[14]=f*M+d*C+m*O+v*k,i[3]=g*_+y*T+b*P+x*I,i[7]=g*w+y*S+b*R+x*N,i[11]=g*E+y*A+b*L+x*D,i[15]=g*M+y*C+b*O+x*k,this},multiplyToArray:function(t,e,n){var r=this.elements;return this.multiplyMatrices(t,e),n[0]=r[0],n[1]=r[1],n[2]=r[2],n[3]=r[3],n[4]=r[4],n[5]=r[5],n[6]=r[6],n[7]=r[7],n[8]=r[8],n[9]=r[9],n[10]=r[10],n[11]=r[11],n[12]=r[12],n[13]=r[13],n[14]=r[14],n[15]=r[15],this},multiplyScalar:function(t){var e=this.elements;return e[0]*=t,e[4]*=t,e[8]*=t,e[12]*=t,e[1]*=t,e[5]*=t,e[9]*=t,e[13]*=t,e[2]*=t,e[6]*=t,e[10]*=t,e[14]*=t,e[3]*=t,e[7]*=t,e[11]*=t,e[15]*=t,this},applyToBufferAttribute:function(){var t;return function(e){void 0===t&&(t=new l);for(var n=0,r=e.count;n 0.0 ) {\n#if defined ( PHYSICALLY_CORRECT_LIGHTS )\n\t\t\tfloat distanceFalloff = 1.0 / max( pow( lightDistance, decayExponent ), 0.01 );\n\t\t\tfloat maxDistanceCutoffFactor = pow2( saturate( 1.0 - pow4( lightDistance / cutoffDistance ) ) );\n\t\t\treturn distanceFalloff * maxDistanceCutoffFactor;\n#else\n\t\t\treturn pow( saturate( -lightDistance / cutoffDistance + 1.0 ), decayExponent );\n#endif\n\t\t}\n\t\treturn 1.0;\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}\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 GeometricContext geometry, const in vec3 specularColor, const in float roughness ) {\n\tfloat alpha = pow2( roughness );\n\tvec3 halfDir = normalize( incidentLight.direction + geometry.viewDir );\n\tfloat dotNL = saturate( dot( geometry.normal, incidentLight.direction ) );\n\tfloat dotNV = saturate( dot( geometry.normal, 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_GGX_SmithCorrelated( alpha, dotNL, dotNV );\n\tfloat D = D_GGX( alpha, dotNH );\n\treturn F * ( G * D );\n}\nvec2 ltcTextureCoords( const in GeometricContext geometry, 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\tvec3 N = geometry.normal;\n\tvec3 V = geometry.viewDir;\n\tvec3 P = geometry.position;\n\tfloat theta = acos( dot( N, V ) );\n\tvec2 uv = vec2(\n\t\tsqrt( saturate( roughness ) ),\n\t\tsaturate( theta / ( 0.5 * PI ) ) );\n\tuv = uv * LUT_SCALE + LUT_BIAS;\n\treturn uv;\n}\nvoid clipQuadToHorizon( inout vec3 L[5], out int n ) {\n\tint config = 0;\n\tif ( L[0].z > 0.0 ) config += 1;\n\tif ( L[1].z > 0.0 ) config += 2;\n\tif ( L[2].z > 0.0 ) config += 4;\n\tif ( L[3].z > 0.0 ) config += 8;\n\tn = 0;\n\tif ( config == 0 ) {\n\t} else if ( config == 1 ) {\n\t\tn = 3;\n\t\tL[1] = -L[1].z * L[0] + L[0].z * L[1];\n\t\tL[2] = -L[3].z * L[0] + L[0].z * L[3];\n\t} else if ( config == 2 ) {\n\t\tn = 3;\n\t\tL[0] = -L[0].z * L[1] + L[1].z * L[0];\n\t\tL[2] = -L[2].z * L[1] + L[1].z * L[2];\n\t} else if ( config == 3 ) {\n\t\tn = 4;\n\t\tL[2] = -L[2].z * L[1] + L[1].z * L[2];\n\t\tL[3] = -L[3].z * L[0] + L[0].z * L[3];\n\t} else if ( config == 4 ) {\n\t\tn = 3;\n\t\tL[0] = -L[3].z * L[2] + L[2].z * L[3];\n\t\tL[1] = -L[1].z * L[2] + L[2].z * L[1];\n\t} else if ( config == 5 ) {\n\t\tn = 0;\n\t} else if ( config == 6 ) {\n\t\tn = 4;\n\t\tL[0] = -L[0].z * L[1] + L[1].z * L[0];\n\t\tL[3] = -L[3].z * L[2] + L[2].z * L[3];\n\t} else if ( config == 7 ) {\n\t\tn = 5;\n\t\tL[4] = -L[3].z * L[0] + L[0].z * L[3];\n\t\tL[3] = -L[3].z * L[2] + L[2].z * L[3];\n\t} else if ( config == 8 ) {\n\t\tn = 3;\n\t\tL[0] = -L[0].z * L[3] + L[3].z * L[0];\n\t\tL[1] = -L[2].z * L[3] + L[3].z * L[2];\n\t\tL[2] = L[3];\n\t} else if ( config == 9 ) {\n\t\tn = 4;\n\t\tL[1] = -L[1].z * L[0] + L[0].z * L[1];\n\t\tL[2] = -L[2].z * L[3] + L[3].z * L[2];\n\t} else if ( config == 10 ) {\n\t\tn = 0;\n\t} else if ( config == 11 ) {\n\t\tn = 5;\n\t\tL[4] = L[3];\n\t\tL[3] = -L[2].z * L[3] + L[3].z * L[2];\n\t\tL[2] = -L[2].z * L[1] + L[1].z * L[2];\n\t} else if ( config == 12 ) {\n\t\tn = 4;\n\t\tL[1] = -L[1].z * L[2] + L[2].z * L[1];\n\t\tL[0] = -L[0].z * L[3] + L[3].z * L[0];\n\t} else if ( config == 13 ) {\n\t\tn = 5;\n\t\tL[4] = L[3];\n\t\tL[3] = L[2];\n\t\tL[2] = -L[1].z * L[2] + L[2].z * L[1];\n\t\tL[1] = -L[1].z * L[0] + L[0].z * L[1];\n\t} else if ( config == 14 ) {\n\t\tn = 5;\n\t\tL[4] = -L[0].z * L[3] + L[3].z * L[0];\n\t\tL[0] = -L[0].z * L[1] + L[1].z * L[0];\n\t} else if ( config == 15 ) {\n\t\tn = 4;\n\t}\n\tif ( n == 3 )\n\t\tL[3] = L[0];\n\tif ( n == 4 )\n\t\tL[4] = L[0];\n}\nfloat integrateLtcBrdfOverRectEdge( vec3 v1, vec3 v2 ) {\n\tfloat cosTheta = dot( v1, v2 );\n\tfloat theta = acos( cosTheta );\n\tfloat res = cross( v1, v2 ).z * ( ( theta > 0.001 ) ? theta / sin( theta ) : 1.0 );\n\treturn res;\n}\nvoid initRectPoints( const in vec3 pos, const in vec3 halfWidth, const in vec3 halfHeight, out vec3 rectPoints[4] ) {\n\trectPoints[0] = pos - halfWidth - halfHeight;\n\trectPoints[1] = pos + halfWidth - halfHeight;\n\trectPoints[2] = pos + halfWidth + halfHeight;\n\trectPoints[3] = pos - halfWidth + halfHeight;\n}\nvec3 integrateLtcBrdfOverRect( const in GeometricContext geometry, const in mat3 brdfMat, const in vec3 rectPoints[4] ) {\n\tvec3 N = geometry.normal;\n\tvec3 V = geometry.viewDir;\n\tvec3 P = geometry.position;\n\tvec3 T1, T2;\n\tT1 = normalize(V - N * dot( V, N ));\n\tT2 = - cross( N, T1 );\n\tmat3 brdfWrtSurface = brdfMat * transpose( mat3( T1, T2, N ) );\n\tvec3 clippedRect[5];\n\tclippedRect[0] = brdfWrtSurface * ( rectPoints[0] - P );\n\tclippedRect[1] = brdfWrtSurface * ( rectPoints[1] - P );\n\tclippedRect[2] = brdfWrtSurface * ( rectPoints[2] - P );\n\tclippedRect[3] = brdfWrtSurface * ( rectPoints[3] - P );\n\tint n;\n\tclipQuadToHorizon(clippedRect, n);\n\tif ( n == 0 )\n\t\treturn vec3( 0, 0, 0 );\n\tclippedRect[0] = normalize( clippedRect[0] );\n\tclippedRect[1] = normalize( clippedRect[1] );\n\tclippedRect[2] = normalize( clippedRect[2] );\n\tclippedRect[3] = normalize( clippedRect[3] );\n\tclippedRect[4] = normalize( clippedRect[4] );\n\tfloat sum = 0.0;\n\tsum += integrateLtcBrdfOverRectEdge( clippedRect[0], clippedRect[1] );\n\tsum += integrateLtcBrdfOverRectEdge( clippedRect[1], clippedRect[2] );\n\tsum += integrateLtcBrdfOverRectEdge( clippedRect[2], clippedRect[3] );\n\tif (n >= 4)\n\t\tsum += integrateLtcBrdfOverRectEdge( clippedRect[3], clippedRect[4] );\n\tif (n == 5)\n\t\tsum += integrateLtcBrdfOverRectEdge( clippedRect[4], clippedRect[0] );\n\tsum = max( 0.0, sum );\n\tvec3 Lo_i = vec3( sum, sum, sum );\n\treturn Lo_i;\n}\nvec3 Rect_Area_Light_Specular_Reflectance(\n\t\tconst in GeometricContext geometry,\n\t\tconst in vec3 lightPos, const in vec3 lightHalfWidth, const in vec3 lightHalfHeight,\n\t\tconst in float roughness,\n\t\tconst in sampler2D ltcMat, const in sampler2D ltcMag ) {\n\tvec3 rectPoints[4];\n\tinitRectPoints( lightPos, lightHalfWidth, lightHalfHeight, rectPoints );\n\tvec2 uv = ltcTextureCoords( geometry, roughness );\n\tvec4 brdfLtcApproxParams, t;\n\tbrdfLtcApproxParams = texture2D( ltcMat, uv );\n\tt = texture2D( ltcMat, uv );\n\tfloat brdfLtcScalar = texture2D( ltcMag, uv ).a;\n\tmat3 brdfLtcApproxMat = mat3(\n\t\tvec3( 1, 0, t.y ),\n\t\tvec3( 0, t.z, 0 ),\n\t\tvec3( t.w, 0, t.x )\n\t);\n\tvec3 specularReflectance = integrateLtcBrdfOverRect( geometry, brdfLtcApproxMat, rectPoints );\n\tspecularReflectance *= brdfLtcScalar;\n\treturn specularReflectance;\n}\nvec3 Rect_Area_Light_Diffuse_Reflectance(\n\t\tconst in GeometricContext geometry,\n\t\tconst in vec3 lightPos, const in vec3 lightHalfWidth, const in vec3 lightHalfHeight ) {\n\tvec3 rectPoints[4];\n\tinitRectPoints( lightPos, lightHalfWidth, lightHalfHeight, rectPoints );\n\tmat3 diffuseBrdfMat = mat3(1);\n\tvec3 diffuseReflectance = integrateLtcBrdfOverRect( geometry, diffuseBrdfMat, rectPoints );\n\treturn diffuseReflectance;\n}\nvec3 BRDF_Specular_GGX_Environment( const in GeometricContext geometry, const in vec3 specularColor, const in float roughness ) {\n\tfloat dotNV = saturate( dot( geometry.normal, geometry.viewDir ) );\n\tconst vec4 c0 = vec4( - 1, - 0.0275, - 0.572, 0.022 );\n\tconst vec4 c1 = vec4( 1, 0.0425, 1.04, - 0.04 );\n\tvec4 r = roughness * c0 + c1;\n\tfloat a004 = min( r.x * r.x, exp2( - 9.28 * dotNV ) ) * r.x + r.y;\n\tvec2 AB = vec2( -1.04, 1.04 ) * a004 + r.zw;\n\treturn specularColor * AB.x + AB.y;\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",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 = dFdx( surf_pos );\n\t\tvec3 vSigmaY = dFdy( surf_pos );\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\tvec3 vGrad = sign( fDet ) * ( dHdxy.x * R1 + dHdxy.y * R2 );\n\t\treturn normalize( abs( fDet ) * surf_norm - vGrad );\n\t}\n#endif\n",clipping_planes_fragment:"#if NUM_CLIPPING_PLANES > 0\n\tfor ( int i = 0; i < UNION_CLIPPING_PLANES; ++ i ) {\n\t\tvec4 plane = clippingPlanes[ i ];\n\t\tif ( dot( vViewPosition, plane.xyz ) > plane.w ) discard;\n\t}\n\t\t\n\t#if UNION_CLIPPING_PLANES < NUM_CLIPPING_PLANES\n\t\tbool clipped = true;\n\t\tfor ( int i = UNION_CLIPPING_PLANES; i < NUM_CLIPPING_PLANES; ++ i ) {\n\t\t\tvec4 plane = clippingPlanes[ i ];\n\t\t\tclipped = ( dot( vViewPosition, plane.xyz ) > plane.w ) && clipped;\n\t\t}\n\t\tif ( clipped ) discard;\n\t\n\t#endif\n#endif\n",clipping_planes_pars_fragment:"#if NUM_CLIPPING_PLANES > 0\n\t#if ! defined( PHYSICAL ) && ! defined( PHONG )\n\t\tvarying vec3 vViewPosition;\n\t#endif\n\tuniform vec4 clippingPlanes[ NUM_CLIPPING_PLANES ];\n#endif\n",clipping_planes_pars_vertex:"#if NUM_CLIPPING_PLANES > 0 && ! defined( PHYSICAL ) && ! defined( PHONG )\n\tvarying vec3 vViewPosition;\n#endif\n",clipping_planes_vertex:"#if NUM_CLIPPING_PLANES > 0 && ! defined( PHYSICAL ) && ! defined( PHONG )\n\tvViewPosition = - mvPosition.xyz;\n#endif\n",color_fragment:"#ifdef USE_COLOR\n\tdiffuseColor.rgb *= vColor;\n#endif",color_pars_fragment:"#ifdef USE_COLOR\n\tvarying vec3 vColor;\n#endif\n",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#define saturate(a) clamp( a, 0.0, 1.0 )\n#define whiteCompliment(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}\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};\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 transpose( const in mat3 v ) {\n\tmat3 tmp;\n\ttmp[0] = vec3(v[0].x, v[1].x, v[2].x);\n\ttmp[1] = vec3(v[0].y, v[1].y, v[2].y);\n\ttmp[2] = vec3(v[0].z, v[1].z, v[2].z);\n\treturn tmp;\n}\n",cube_uv_reflection_fragment:"#ifdef ENVMAP_TYPE_CUBE_UV\n#define cubeUV_textureSize (1024.0)\nint getFaceFromDirection(vec3 direction) {\n\tvec3 absDirection = abs(direction);\n\tint face = -1;\n\tif( absDirection.x > absDirection.z ) {\n\t\tif(absDirection.x > absDirection.y )\n\t\t\tface = direction.x > 0.0 ? 0 : 3;\n\t\telse\n\t\t\tface = direction.y > 0.0 ? 1 : 4;\n\t}\n\telse {\n\t\tif(absDirection.z > absDirection.y )\n\t\t\tface = direction.z > 0.0 ? 2 : 5;\n\t\telse\n\t\t\tface = direction.y > 0.0 ? 1 : 4;\n\t}\n\treturn face;\n}\n#define cubeUV_maxLods1 (log2(cubeUV_textureSize*0.25) - 1.0)\n#define cubeUV_rangeClamp (exp2((6.0 - 1.0) * 2.0))\nvec2 MipLevelInfo( vec3 vec, float roughnessLevel, float roughness ) {\n\tfloat scale = exp2(cubeUV_maxLods1 - roughnessLevel);\n\tfloat dxRoughness = dFdx(roughness);\n\tfloat dyRoughness = dFdy(roughness);\n\tvec3 dx = dFdx( vec * scale * dxRoughness );\n\tvec3 dy = dFdy( vec * scale * dyRoughness );\n\tfloat d = max( dot( dx, dx ), dot( dy, dy ) );\n\td = clamp(d, 1.0, cubeUV_rangeClamp);\n\tfloat mipLevel = 0.5 * log2(d);\n\treturn vec2(floor(mipLevel), fract(mipLevel));\n}\n#define cubeUV_maxLods2 (log2(cubeUV_textureSize*0.25) - 2.0)\n#define cubeUV_rcpTextureSize (1.0 / cubeUV_textureSize)\nvec2 getCubeUV(vec3 direction, float roughnessLevel, float mipLevel) {\n\tmipLevel = roughnessLevel > cubeUV_maxLods2 - 3.0 ? 0.0 : mipLevel;\n\tfloat a = 16.0 * cubeUV_rcpTextureSize;\n\tvec2 exp2_packed = exp2( vec2( roughnessLevel, mipLevel ) );\n\tvec2 rcp_exp2_packed = vec2( 1.0 ) / exp2_packed;\n\tfloat powScale = exp2_packed.x * exp2_packed.y;\n\tfloat scale = rcp_exp2_packed.x * rcp_exp2_packed.y * 0.25;\n\tfloat mipOffset = 0.75*(1.0 - rcp_exp2_packed.y) * rcp_exp2_packed.x;\n\tbool bRes = mipLevel == 0.0;\n\tscale = bRes && (scale < a) ? a : scale;\n\tvec3 r;\n\tvec2 offset;\n\tint face = getFaceFromDirection(direction);\n\tfloat rcpPowScale = 1.0 / powScale;\n\tif( face == 0) {\n\t\tr = vec3(direction.x, -direction.z, direction.y);\n\t\toffset = vec2(0.0+mipOffset,0.75 * rcpPowScale);\n\t\toffset.y = bRes && (offset.y < 2.0*a) ? a : offset.y;\n\t}\n\telse if( face == 1) {\n\t\tr = vec3(direction.y, direction.x, direction.z);\n\t\toffset = vec2(scale+mipOffset, 0.75 * rcpPowScale);\n\t\toffset.y = bRes && (offset.y < 2.0*a) ? a : offset.y;\n\t}\n\telse if( face == 2) {\n\t\tr = vec3(direction.z, direction.x, direction.y);\n\t\toffset = vec2(2.0*scale+mipOffset, 0.75 * rcpPowScale);\n\t\toffset.y = bRes && (offset.y < 2.0*a) ? a : offset.y;\n\t}\n\telse if( face == 3) {\n\t\tr = vec3(direction.x, direction.z, direction.y);\n\t\toffset = vec2(0.0+mipOffset,0.5 * rcpPowScale);\n\t\toffset.y = bRes && (offset.y < 2.0*a) ? 0.0 : offset.y;\n\t}\n\telse if( face == 4) {\n\t\tr = vec3(direction.y, direction.x, -direction.z);\n\t\toffset = vec2(scale+mipOffset, 0.5 * rcpPowScale);\n\t\toffset.y = bRes && (offset.y < 2.0*a) ? 0.0 : offset.y;\n\t}\n\telse {\n\t\tr = vec3(direction.z, -direction.x, direction.y);\n\t\toffset = vec2(2.0*scale+mipOffset, 0.5 * rcpPowScale);\n\t\toffset.y = bRes && (offset.y < 2.0*a) ? 0.0 : offset.y;\n\t}\n\tr = normalize(r);\n\tfloat texelOffset = 0.5 * cubeUV_rcpTextureSize;\n\tvec2 s = ( r.yz / abs( r.x ) + vec2( 1.0 ) ) * 0.5;\n\tvec2 base = offset + vec2( texelOffset );\n\treturn base + s * ( scale - 2.0 * texelOffset );\n}\n#define cubeUV_maxLods3 (log2(cubeUV_textureSize*0.25) - 3.0)\nvec4 textureCubeUV(vec3 reflectedDirection, float roughness ) {\n\tfloat roughnessVal = roughness* cubeUV_maxLods3;\n\tfloat r1 = floor(roughnessVal);\n\tfloat r2 = r1 + 1.0;\n\tfloat t = fract(roughnessVal);\n\tvec2 mipInfo = MipLevelInfo(reflectedDirection, r1, roughness);\n\tfloat s = mipInfo.y;\n\tfloat level0 = mipInfo.x;\n\tfloat level1 = level0 + 1.0;\n\tlevel1 = level1 > 5.0 ? 5.0 : level1;\n\tlevel0 += min( floor( s + 0.5 ), 5.0 );\n\tvec2 uv_10 = getCubeUV(reflectedDirection, r1, level0);\n\tvec4 color10 = envMapTexelToLinear(texture2D(envMap, uv_10));\n\tvec2 uv_20 = getCubeUV(reflectedDirection, r2, level0);\n\tvec4 color20 = envMapTexelToLinear(texture2D(envMap, uv_20));\n\tvec4 result = mix(color10, color20, t);\n\treturn vec4(result.rgb, 1.0);\n}\n#endif\n",defaultnormal_vertex:"#ifdef FLIP_SIDED\n\tobjectNormal = -objectNormal;\n#endif\nvec3 transformedNormal = normalMatrix * objectNormal;\n",displacementmap_pars_vertex:"#ifdef USE_DISPLACEMENTMAP\n\tuniform sampler2D displacementMap;\n\tuniform float displacementScale;\n\tuniform float displacementBias;\n#endif\n",displacementmap_vertex:"#ifdef USE_DISPLACEMENTMAP\n\ttransformed += normal * ( texture2D( displacementMap, uv ).x * displacementScale + displacementBias );\n#endif\n",emissivemap_fragment:"#ifdef USE_EMISSIVEMAP\n\tvec4 emissiveColor = texture2D( emissiveMap, vUv );\n\temissiveColor.rgb = emissiveMapTexelToLinear( emissiveColor ).rgb;\n\ttotalEmissiveRadiance *= emissiveColor.rgb;\n#endif\n",emissivemap_pars_fragment:"#ifdef USE_EMISSIVEMAP\n\tuniform sampler2D emissiveMap;\n#endif\n",encodings_fragment:" gl_FragColor = linearToOutputTexel( gl_FragColor );\n",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.xyz, vec3( gammaFactor ) ), value.w );\n}\nvec4 LinearToGamma( in vec4 value, in float gammaFactor ) {\n\treturn vec4( pow( value.xyz, vec3( 1.0 / gammaFactor ) ), value.w );\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.w );\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.w );\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.xyz * value.w * maxRange, 1.0 );\n}\nvec4 LinearToRGBM( in vec4 value, in float maxRange ) {\n\tfloat maxRGB = max( value.x, 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.x, 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 = value.rgb * cLogLuvM;\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 = Xp_Y_XYZp.rgb * cLogLuvInverseM;\n\treturn vec4( max(vRGB, 0.0), 1.0 );\n}\n",envmap_fragment:"#ifdef USE_ENVMAP\n\t#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG )\n\t\tvec3 cameraToVertex = normalize( vWorldPosition - cameraPosition );\n\t\tvec3 worldNormal = inverseTransformDirection( normal, viewMatrix );\n\t\t#ifdef ENVMAP_MODE_REFLECTION\n\t\t\tvec3 reflectVec = reflect( cameraToVertex, worldNormal );\n\t\t#else\n\t\t\tvec3 reflectVec = refract( cameraToVertex, 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, flipNormal * vec3( flipEnvMap * reflectVec.x, reflectVec.yz ) );\n\t#elif defined( ENVMAP_TYPE_EQUIREC )\n\t\tvec2 sampleUV;\n\t\tsampleUV.y = saturate( flipNormal * reflectVec.y * 0.5 + 0.5 );\n\t\tsampleUV.x = atan( flipNormal * reflectVec.z, flipNormal * reflectVec.x ) * RECIPROCAL_PI2 + 0.5;\n\t\tvec4 envColor = texture2D( envMap, sampleUV );\n\t#elif defined( ENVMAP_TYPE_SPHERE )\n\t\tvec3 reflectView = flipNormal * 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\tenvColor = envMapTexelToLinear( envColor );\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\n",envmap_pars_fragment:"#if defined( USE_ENVMAP ) || defined( PHYSICAL )\n\tuniform float reflectivity;\n\tuniform float envMapIntensity;\n#endif\n#ifdef USE_ENVMAP\n\t#if ! defined( PHYSICAL ) && ( defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) )\n\t\tvarying vec3 vWorldPosition;\n\t#endif\n\t#ifdef ENVMAP_TYPE_CUBE\n\t\tuniform samplerCube envMap;\n\t#else\n\t\tuniform sampler2D envMap;\n\t#endif\n\tuniform float flipEnvMap;\n\t#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( PHYSICAL )\n\t\tuniform float refractionRatio;\n\t#else\n\t\tvarying vec3 vReflect;\n\t#endif\n#endif\n",envmap_pars_vertex:"#ifdef USE_ENVMAP\n\t#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG )\n\t\tvarying vec3 vWorldPosition;\n\t#else\n\t\tvarying vec3 vReflect;\n\t\tuniform float refractionRatio;\n\t#endif\n#endif\n",envmap_vertex:"#ifdef USE_ENVMAP\n\t#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG )\n\t\tvWorldPosition = worldPosition.xyz;\n\t#else\n\t\tvec3 cameraToVertex = normalize( worldPosition.xyz - cameraPosition );\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\n",fog_vertex:"\n#ifdef USE_FOG\nfogDepth = -mvPosition.z;\n#endif",fog_pars_vertex:"#ifdef USE_FOG\n varying float fogDepth;\n#endif\n",fog_fragment:"#ifdef USE_FOG\n\t#ifdef FOG_EXP2\n\t\tfloat fogFactor = whiteCompliment( exp2( - fogDensity * fogDensity * fogDepth * fogDepth * LOG2 ) );\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\n",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\n",gradientmap_pars_fragment:"#ifdef TOON\n\tuniform sampler2D gradientMap;\n\tvec3 getGradientIrradiance( vec3 normal, vec3 lightDirection ) {\n\t\tfloat dotNL = dot( normal, lightDirection );\n\t\tvec2 coord = vec2( dotNL * 0.5 + 0.5, 0.0 );\n\t\t#ifdef USE_GRADIENTMAP\n\t\t\treturn texture2D( gradientMap, coord ).rgb;\n\t\t#else\n\t\t\treturn ( coord.x < 0.7 ) ? vec3( 0.7 ) : vec3( 1.0 );\n\t\t#endif\n\t}\n#endif\n",lightmap_fragment:"#ifdef USE_LIGHTMAP\n\treflectedLight.indirectDiffuse += PI * texture2D( lightMap, vUv2 ).xyz * lightMapIntensity;\n#endif\n",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 = normalize( -mvPosition.xyz );\nGeometricContext backGeometry;\nbackGeometry.position = geometry.position;\nbackGeometry.normal = -geometry.normal;\nbackGeometry.viewDir = geometry.viewDir;\nvLightFront = vec3( 0.0 );\n#ifdef DOUBLE_SIDED\n\tvLightBack = vec3( 0.0 );\n#endif\nIncidentLight directLight;\nfloat dotNL;\nvec3 directLightColor_Diffuse;\n#if NUM_POINT_LIGHTS > 0\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\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\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\tfor ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) {\n\t\tvLightFront += getHemisphereLightIrradiance( hemisphereLights[ i ], geometry );\n\t\t#ifdef DOUBLE_SIDED\n\t\t\tvLightBack += getHemisphereLightIrradiance( hemisphereLights[ i ], backGeometry );\n\t\t#endif\n\t}\n#endif\n",lights_pars:"uniform vec3 ambientLightColor;\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};\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 ltcMat;\tuniform sampler2D ltcMag;\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\n#if defined( USE_ENVMAP ) && defined( PHYSICAL )\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( 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 blinnShininessExponent, const in int maxMIPLevel ) {\n\t\tfloat maxMIPLevelScalar = float( maxMIPLevel );\n\t\tfloat desiredMIPLevel = maxMIPLevelScalar - 0.79248 - 0.5 * log2( pow2( blinnShininessExponent ) + 1.0 );\n\t\treturn clamp( desiredMIPLevel, 0.0, maxMIPLevelScalar );\n\t}\n\tvec3 getLightProbeIndirectRadiance( const in GeometricContext geometry, const in float blinnShininessExponent, const in int maxMIPLevel ) {\n\t\t#ifdef ENVMAP_MODE_REFLECTION\n\t\t\tvec3 reflectVec = reflect( -geometry.viewDir, geometry.normal );\n\t\t#else\n\t\t\tvec3 reflectVec = refract( -geometry.viewDir, geometry.normal, refractionRatio );\n\t\t#endif\n\t\treflectVec = inverseTransformDirection( reflectVec, viewMatrix );\n\t\tfloat specularMIPLevel = getSpecularMIPLevel( blinnShininessExponent, 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(queryReflectVec, BlinnExponentToGGXRoughness(blinnShininessExponent));\n\t\t#elif defined( ENVMAP_TYPE_EQUIREC )\n\t\t\tvec2 sampleUV;\n\t\t\tsampleUV.y = saturate( reflectVec.y * 0.5 + 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\n",lights_phong_fragment:"BlinnPhongMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb;\nmaterial.specularColor = specular;\nmaterial.specularShininess = shininess;\nmaterial.specularStrength = specularStrength;\n",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};\n#if NUM_RECT_AREA_LIGHTS > 0\n\tvoid RE_Direct_RectArea_BlinnPhong( const in RectAreaLight rectAreaLight, const in GeometricContext geometry, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {\n\t\tvec3 matDiffColor = material.diffuseColor;\n\t\tvec3 matSpecColor = material.specularColor;\n\t\tvec3 lightColor = rectAreaLight.color;\n\t\tfloat roughness = BlinnExponentToGGXRoughness( material.specularShininess );\n\t\tvec3 spec = Rect_Area_Light_Specular_Reflectance(\n\t\t\t\tgeometry,\n\t\t\t\trectAreaLight.position, rectAreaLight.halfWidth, rectAreaLight.halfHeight,\n\t\t\t\troughness,\n\t\t\t\tltcMat, ltcMag );\n\t\tvec3 diff = Rect_Area_Light_Diffuse_Reflectance(\n\t\t\t\tgeometry,\n\t\t\t\trectAreaLight.position, rectAreaLight.halfWidth, rectAreaLight.halfHeight );\n\t\treflectedLight.directSpecular += lightColor * matSpecColor * spec / PI2;\n\t\treflectedLight.directDiffuse += lightColor * matDiffColor * diff / PI2;\n\t}\n#endif\nvoid RE_Direct_BlinnPhong( const in IncidentLight directLight, const in GeometricContext geometry, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {\n\t#ifdef TOON\n\t\tvec3 irradiance = getGradientIrradiance( geometry.normal, directLight.direction ) * directLight.color;\n\t#else\n\t\tfloat dotNL = saturate( dot( geometry.normal, directLight.direction ) );\n\t\tvec3 irradiance = dotNL * directLight.color;\n\t#endif\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_Direct_RectArea\t\tRE_Direct_RectArea_BlinnPhong\n#define RE_IndirectDiffuse\t\tRE_IndirectDiffuse_BlinnPhong\n#define Material_LightProbeLOD( material )\t(0)\n",lights_physical_fragment:"PhysicalMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb * ( 1.0 - metalnessFactor );\nmaterial.specularRoughness = clamp( roughnessFactor, 0.04, 1.0 );\n#ifdef STANDARD\n\tmaterial.specularColor = mix( vec3( DEFAULT_SPECULAR_COEFFICIENT ), diffuseColor.rgb, metalnessFactor );\n#else\n\tmaterial.specularColor = mix( vec3( MAXIMUM_SPECULAR_COEFFICIENT * pow2( reflectivity ) ), diffuseColor.rgb, metalnessFactor );\n\tmaterial.clearCoat = saturate( clearCoat );\tmaterial.clearCoatRoughness = clamp( clearCoatRoughness, 0.04, 1.0 );\n#endif\n",lights_physical_pars_fragment:"struct PhysicalMaterial {\n\tvec3\tdiffuseColor;\n\tfloat\tspecularRoughness;\n\tvec3\tspecularColor;\n\t#ifndef STANDARD\n\t\tfloat clearCoat;\n\t\tfloat clearCoatRoughness;\n\t#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 matDiffColor = material.diffuseColor;\n\t\tvec3 matSpecColor = material.specularColor;\n\t\tvec3 lightColor = rectAreaLight.color;\n\t\tfloat roughness = material.specularRoughness;\n\t\tvec3 spec = Rect_Area_Light_Specular_Reflectance(\n\t\t\t\tgeometry,\n\t\t\t\trectAreaLight.position, rectAreaLight.halfWidth, rectAreaLight.halfHeight,\n\t\t\t\troughness,\n\t\t\t\tltcMat, ltcMag );\n\t\tvec3 diff = Rect_Area_Light_Diffuse_Reflectance(\n\t\t\t\tgeometry,\n\t\t\t\trectAreaLight.position, rectAreaLight.halfWidth, rectAreaLight.halfHeight );\n\t\treflectedLight.directSpecular += lightColor * matSpecColor * spec;\n\t\treflectedLight.directDiffuse += lightColor * matDiffColor * diff;\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#ifndef STANDARD\n\t\tfloat clearCoatDHR = material.clearCoat * clearCoatDHRApprox( material.clearCoatRoughness, dotNL );\n\t#else\n\t\tfloat clearCoatDHR = 0.0;\n\t#endif\n\treflectedLight.directSpecular += ( 1.0 - clearCoatDHR ) * irradiance * BRDF_Specular_GGX( directLight, geometry, material.specularColor, material.specularRoughness );\n\treflectedLight.directDiffuse += ( 1.0 - clearCoatDHR ) * irradiance * BRDF_Diffuse_Lambert( material.diffuseColor );\n\t#ifndef STANDARD\n\t\treflectedLight.directSpecular += irradiance * material.clearCoat * BRDF_Specular_GGX( directLight, geometry, vec3( DEFAULT_SPECULAR_COEFFICIENT ), material.clearCoatRoughness );\n\t#endif\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 clearCoatRadiance, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n\t#ifndef STANDARD\n\t\tfloat dotNV = saturate( dot( geometry.normal, geometry.viewDir ) );\n\t\tfloat dotNL = dotNV;\n\t\tfloat clearCoatDHR = material.clearCoat * clearCoatDHRApprox( material.clearCoatRoughness, dotNL );\n\t#else\n\t\tfloat clearCoatDHR = 0.0;\n\t#endif\n\treflectedLight.indirectSpecular += ( 1.0 - clearCoatDHR ) * radiance * BRDF_Specular_GGX_Environment( geometry, material.specularColor, material.specularRoughness );\n\t#ifndef STANDARD\n\t\treflectedLight.indirectSpecular += clearCoatRadiance * material.clearCoat * BRDF_Specular_GGX_Environment( geometry, vec3( DEFAULT_SPECULAR_COEFFICIENT ), material.clearCoatRoughness );\n\t#endif\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\n#define Material_BlinnShininessExponent( material ) GGXRoughnessToBlinnExponent( material.specularRoughness )\n#define Material_ClearCoat_BlinnShininessExponent( material ) GGXRoughnessToBlinnExponent( material.clearCoatRoughness )\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}\n",lights_template:"\nGeometricContext geometry;\ngeometry.position = - vViewPosition;\ngeometry.normal = normal;\ngeometry.viewDir = normalize( vViewPosition );\nIncidentLight directLight;\n#if ( NUM_POINT_LIGHTS > 0 ) && defined( RE_Direct )\n\tPointLight pointLight;\n\tfor ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {\n\t\tpointLight = pointLights[ i ];\n\t\tgetPointDirectLightIrradiance( pointLight, geometry, directLight );\n\t\t#ifdef USE_SHADOWMAP\n\t\tdirectLight.color *= all( bvec2( pointLight.shadow, directLight.visible ) ) ? getPointShadow( pointShadowMap[ i ], pointLight.shadowMapSize, pointLight.shadowBias, pointLight.shadowRadius, vPointShadowCoord[ i ] ) : 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\tfor ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {\n\t\tspotLight = spotLights[ i ];\n\t\tgetSpotDirectLightIrradiance( spotLight, geometry, directLight );\n\t\t#ifdef USE_SHADOWMAP\n\t\tdirectLight.color *= all( bvec2( spotLight.shadow, directLight.visible ) ) ? 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\tfor ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {\n\t\tdirectionalLight = directionalLights[ i ];\n\t\tgetDirectionalDirectLightIrradiance( directionalLight, geometry, directLight );\n\t\t#ifdef USE_SHADOWMAP\n\t\tdirectLight.color *= all( bvec2( directionalLight.shadow, directLight.visible ) ) ? 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\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 irradiance = getAmbientLightIrradiance( ambientLightColor );\n\t#ifdef USE_LIGHTMAP\n\t\tvec3 lightMapIrradiance = texture2D( lightMap, vUv2 ).xyz * 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 ( NUM_HEMI_LIGHTS > 0 )\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\t#if defined( USE_ENVMAP ) && defined( PHYSICAL ) && defined( ENVMAP_TYPE_CUBE_UV )\n\t\tirradiance += getLightProbeIndirectIrradiance( geometry, 8 );\n\t#endif\n\tRE_IndirectDiffuse( irradiance, geometry, material, reflectedLight );\n#endif\n#if defined( USE_ENVMAP ) && defined( RE_IndirectSpecular )\n\tvec3 radiance = getLightProbeIndirectRadiance( geometry, Material_BlinnShininessExponent( material ), 8 );\n\t#ifndef STANDARD\n\t\tvec3 clearCoatRadiance = getLightProbeIndirectRadiance( geometry, Material_ClearCoat_BlinnShininessExponent( material ), 8 );\n\t#else\n\t\tvec3 clearCoatRadiance = vec3( 0.0 );\n\t#endif\n\tRE_IndirectSpecular( radiance, clearCoatRadiance, geometry, material, reflectedLight );\n#endif\n",logdepthbuf_fragment:"#if defined(USE_LOGDEPTHBUF) && defined(USE_LOGDEPTHBUF_EXT)\n\tgl_FragDepthEXT = log2(vFragDepth) * logDepthBufFC * 0.5;\n#endif",logdepthbuf_pars_fragment:"#ifdef USE_LOGDEPTHBUF\n\tuniform float logDepthBufFC;\n\t#ifdef USE_LOGDEPTHBUF_EXT\n\t\tvarying float vFragDepth;\n\t#endif\n#endif\n",logdepthbuf_pars_vertex:"#ifdef USE_LOGDEPTHBUF\n\t#ifdef USE_LOGDEPTHBUF_EXT\n\t\tvarying float vFragDepth;\n\t#endif\n\tuniform float logDepthBufFC;\n#endif",logdepthbuf_vertex:"#ifdef USE_LOGDEPTHBUF\n\tgl_Position.z = log2(max( EPSILON, gl_Position.w + 1.0 )) * logDepthBufFC;\n\t#ifdef USE_LOGDEPTHBUF_EXT\n\t\tvFragDepth = 1.0 + gl_Position.w;\n\t#else\n\t\tgl_Position.z = (gl_Position.z - 1.0) * gl_Position.w;\n\t#endif\n#endif\n",map_fragment:"#ifdef USE_MAP\n\tvec4 texelColor = texture2D( map, vUv );\n\ttexelColor = mapTexelToLinear( texelColor );\n\tdiffuseColor *= texelColor;\n#endif\n",map_pars_fragment:"#ifdef USE_MAP\n\tuniform sampler2D map;\n#endif\n",map_particle_fragment:"#ifdef USE_MAP\n\tvec4 mapTexel = texture2D( map, vec2( gl_PointCoord.x, 1.0 - gl_PointCoord.y ) * offsetRepeat.zw + offsetRepeat.xy );\n\tdiffuseColor *= mapTexelToLinear( mapTexel );\n#endif\n",map_particle_pars_fragment:"#ifdef USE_MAP\n\tuniform vec4 offsetRepeat;\n\tuniform sampler2D map;\n#endif\n",metalnessmap_fragment:"float metalnessFactor = metalness;\n#ifdef USE_METALNESSMAP\n\tvec4 texelMetalness = texture2D( metalnessMap, vUv );\n\tmetalnessFactor *= texelMetalness.r;\n#endif\n",metalnessmap_pars_fragment:"#ifdef USE_METALNESSMAP\n\tuniform sampler2D metalnessMap;\n#endif",morphnormal_vertex:"#ifdef USE_MORPHNORMALS\n\tobjectNormal += ( morphNormal0 - normal ) * morphTargetInfluences[ 0 ];\n\tobjectNormal += ( morphNormal1 - normal ) * morphTargetInfluences[ 1 ];\n\tobjectNormal += ( morphNormal2 - normal ) * morphTargetInfluences[ 2 ];\n\tobjectNormal += ( morphNormal3 - normal ) * morphTargetInfluences[ 3 ];\n#endif\n",morphtarget_pars_vertex:"#ifdef USE_MORPHTARGETS\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 += ( morphTarget0 - position ) * morphTargetInfluences[ 0 ];\n\ttransformed += ( morphTarget1 - position ) * morphTargetInfluences[ 1 ];\n\ttransformed += ( morphTarget2 - position ) * morphTargetInfluences[ 2 ];\n\ttransformed += ( morphTarget3 - position ) * morphTargetInfluences[ 3 ];\n\t#ifndef USE_MORPHNORMALS\n\ttransformed += ( morphTarget4 - position ) * morphTargetInfluences[ 4 ];\n\ttransformed += ( morphTarget5 - position ) * morphTargetInfluences[ 5 ];\n\ttransformed += ( morphTarget6 - position ) * morphTargetInfluences[ 6 ];\n\ttransformed += ( morphTarget7 - position ) * morphTargetInfluences[ 7 ];\n\t#endif\n#endif\n",normal_flip:"#ifdef DOUBLE_SIDED\n\tfloat flipNormal = ( float( gl_FrontFacing ) * 2.0 - 1.0 );\n#else\n\tfloat flipNormal = 1.0;\n#endif\n",normal_fragment:"#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 ) * flipNormal;\n#endif\n#ifdef USE_NORMALMAP\n\tnormal = perturbNormal2Arb( -vViewPosition, normal );\n#elif defined( USE_BUMPMAP )\n\tnormal = perturbNormalArb( -vViewPosition, normal, dHdxy_fwd() );\n#endif\n",normalmap_pars_fragment:"#ifdef USE_NORMALMAP\n\tuniform sampler2D normalMap;\n\tuniform vec2 normalScale;\n\tvec3 perturbNormal2Arb( vec3 eye_pos, vec3 surf_norm ) {\n\t\tvec3 q0 = dFdx( eye_pos.xyz );\n\t\tvec3 q1 = dFdy( eye_pos.xyz );\n\t\tvec2 st0 = dFdx( vUv.st );\n\t\tvec2 st1 = dFdy( vUv.st );\n\t\tvec3 S = normalize( q0 * st1.t - q1 * st0.t );\n\t\tvec3 T = normalize( -q0 * st1.s + q1 * st0.s );\n\t\tvec3 N = normalize( surf_norm );\n\t\tvec3 mapN = texture2D( normalMap, vUv ).xyz * 2.0 - 1.0;\n\t\tmapN.xy = normalScale * mapN.xy;\n\t\tmat3 tsn = mat3( S, T, N );\n\t\treturn normalize( tsn * mapN );\n\t}\n#endif\n",packing:"vec3 packNormalToRGB( const in vec3 normal ) {\n\treturn normalize( normal ) * 0.5 + 0.5;\n}\nvec3 unpackRGBToNormal( const in vec3 rgb ) {\n\treturn 1.0 - 2.0 * rgb.xyz;\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}\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}\n",premultiplied_alpha_fragment:"#ifdef PREMULTIPLIED_ALPHA\n\tgl_FragColor.rgb *= gl_FragColor.a;\n#endif\n",project_vertex:"#ifdef USE_SKINNING\n\tvec4 mvPosition = modelViewMatrix * skinned;\n#else\n\tvec4 mvPosition = modelViewMatrix * vec4( transformed, 1.0 );\n#endif\ngl_Position = projectionMatrix * mvPosition;\n",roughnessmap_fragment:"float roughnessFactor = roughness;\n#ifdef USE_ROUGHNESSMAP\n\tvec4 texelRoughness = texture2D( roughnessMap, vUv );\n\troughnessFactor *= texelRoughness.r;\n#endif\n",roughnessmap_pars_fragment:"#ifdef USE_ROUGHNESSMAP\n\tuniform sampler2D roughnessMap;\n#endif",shadowmap_pars_fragment:"#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHTS > 0\n\t\tuniform sampler2D directionalShadowMap[ NUM_DIR_LIGHTS ];\n\t\tvarying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHTS ];\n\t#endif\n\t#if NUM_SPOT_LIGHTS > 0\n\t\tuniform sampler2D spotShadowMap[ NUM_SPOT_LIGHTS ];\n\t\tvarying vec4 vSpotShadowCoord[ NUM_SPOT_LIGHTS ];\n\t#endif\n\t#if NUM_POINT_LIGHTS > 0\n\t\tuniform sampler2D pointShadowMap[ NUM_POINT_LIGHTS ];\n\t\tvarying vec4 vPointShadowCoord[ NUM_POINT_LIGHTS ];\n\t#endif\n\tfloat texture2DCompare( sampler2D depths, vec2 uv, float compare ) {\n\t\treturn step( compare, unpackRGBAToDepth( texture2D( depths, uv ) ) );\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 ) / size;\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\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\treturn (\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( dx0, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy, 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( 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 / 9.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\treturn (\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#else\n\t\t\treturn texture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z );\n\t\t#endif\n\t\t}\n\t\treturn 1.0;\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 ) {\n\t\tvec2 texelSize = vec2( 1.0 ) / ( shadowMapSize * vec2( 4.0, 2.0 ) );\n\t\tvec3 lightToPosition = shadowCoord.xyz;\n\t\tvec3 bd3D = normalize( lightToPosition );\n\t\tfloat dp = ( length( lightToPosition ) - shadowBias ) / 1000.0;\n\t\t#if defined( SHADOWMAP_TYPE_PCF ) || defined( SHADOWMAP_TYPE_PCF_SOFT )\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\n",shadowmap_pars_vertex:"#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHTS > 0\n\t\tuniform mat4 directionalShadowMatrix[ NUM_DIR_LIGHTS ];\n\t\tvarying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHTS ];\n\t#endif\n\t#if NUM_SPOT_LIGHTS > 0\n\t\tuniform mat4 spotShadowMatrix[ NUM_SPOT_LIGHTS ];\n\t\tvarying vec4 vSpotShadowCoord[ NUM_SPOT_LIGHTS ];\n\t#endif\n\t#if NUM_POINT_LIGHTS > 0\n\t\tuniform mat4 pointShadowMatrix[ NUM_POINT_LIGHTS ];\n\t\tvarying vec4 vPointShadowCoord[ NUM_POINT_LIGHTS ];\n\t#endif\n#endif\n",shadowmap_vertex:"#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHTS > 0\n\tfor ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {\n\t\tvDirectionalShadowCoord[ i ] = directionalShadowMatrix[ i ] * worldPosition;\n\t}\n\t#endif\n\t#if NUM_SPOT_LIGHTS > 0\n\tfor ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {\n\t\tvSpotShadowCoord[ i ] = spotShadowMatrix[ i ] * worldPosition;\n\t}\n\t#endif\n\t#if NUM_POINT_LIGHTS > 0\n\tfor ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {\n\t\tvPointShadowCoord[ i ] = pointShadowMatrix[ i ] * worldPosition;\n\t}\n\t#endif\n#endif\n",shadowmask_pars_fragment:"float getShadowMask() {\n\tfloat shadow = 1.0;\n\t#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHTS > 0\n\tDirectionalLight directionalLight;\n\tfor ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {\n\t\tdirectionalLight = directionalLights[ i ];\n\t\tshadow *= bool( directionalLight.shadow ) ? getShadow( directionalShadowMap[ i ], directionalLight.shadowMapSize, directionalLight.shadowBias, directionalLight.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;\n\t}\n\t#endif\n\t#if NUM_SPOT_LIGHTS > 0\n\tSpotLight spotLight;\n\tfor ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {\n\t\tspotLight = spotLights[ i ];\n\t\tshadow *= bool( spotLight.shadow ) ? getShadow( spotShadowMap[ i ], spotLight.shadowMapSize, spotLight.shadowBias, spotLight.shadowRadius, vSpotShadowCoord[ i ] ) : 1.0;\n\t}\n\t#endif\n\t#if NUM_POINT_LIGHTS > 0\n\tPointLight pointLight;\n\tfor ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {\n\t\tpointLight = pointLights[ i ];\n\t\tshadow *= bool( pointLight.shadow ) ? getPointShadow( pointShadowMap[ i ], pointLight.shadowMapSize, pointLight.shadowBias, pointLight.shadowRadius, vPointShadowCoord[ i ] ) : 1.0;\n\t}\n\t#endif\n\t#endif\n\treturn shadow;\n}\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 sampler2D boneTexture;\n\t\tuniform int boneTextureWidth;\n\t\tuniform int boneTextureHeight;\n\t\tmat4 getBoneMatrix( const in float i ) {\n\t\t\tfloat j = i * 4.0;\n\t\t\tfloat x = mod( j, float( boneTextureWidth ) );\n\t\t\tfloat y = floor( j / float( boneTextureWidth ) );\n\t\t\tfloat dx = 1.0 / float( boneTextureWidth );\n\t\t\tfloat dy = 1.0 / float( boneTextureHeight );\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\n",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\tskinned = bindMatrixInverse * skinned;\n#endif\n",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#endif\n",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 gl_FragColor.rgb = toneMapping( gl_FragColor.rgb );\n#endif\n",tonemapping_pars_fragment:"#define saturate(a) clamp( a, 0.0, 1.0 )\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}\n",uv_pars_fragment:"#if defined( USE_MAP ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( USE_SPECULARMAP ) || defined( USE_ALPHAMAP ) || defined( USE_EMISSIVEMAP ) || defined( USE_ROUGHNESSMAP ) || defined( USE_METALNESSMAP )\n\tvarying vec2 vUv;\n#endif",uv_pars_vertex:"#if defined( USE_MAP ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( USE_SPECULARMAP ) || defined( USE_ALPHAMAP ) || defined( USE_EMISSIVEMAP ) || defined( USE_ROUGHNESSMAP ) || defined( USE_METALNESSMAP )\n\tvarying vec2 vUv;\n\tuniform vec4 offsetRepeat;\n#endif\n",uv_vertex:"#if defined( USE_MAP ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( USE_SPECULARMAP ) || defined( USE_ALPHAMAP ) || defined( USE_EMISSIVEMAP ) || defined( USE_ROUGHNESSMAP ) || defined( USE_METALNESSMAP )\n\tvUv = uv * offsetRepeat.zw + offsetRepeat.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#endif",uv2_vertex:"#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP )\n\tvUv2 = uv2;\n#endif",worldpos_vertex:"#if defined( USE_ENVMAP ) || defined( PHONG ) || defined( PHYSICAL ) || defined( LAMBERT ) || defined ( USE_SHADOWMAP )\n\t#ifdef USE_SKINNING\n\t\tvec4 worldPosition = modelMatrix * skinned;\n\t#else\n\t\tvec4 worldPosition = modelMatrix * vec4( transformed, 1.0 );\n\t#endif\n#endif\n",cube_frag:"uniform samplerCube tCube;\nuniform float tFlip;\nuniform float opacity;\nvarying vec3 vWorldPosition;\n#include \nvoid main() {\n\tgl_FragColor = textureCube( tCube, vec3( tFlip * vWorldPosition.x, vWorldPosition.yz ) );\n\tgl_FragColor.a *= opacity;\n}\n",cube_vert:"varying vec3 vWorldPosition;\n#include \nvoid main() {\n\tvWorldPosition = transformDirection( position, modelMatrix );\n\t#include \n\t#include \n}\n",depth_frag:"#if DEPTH_PACKING == 3200\n\tuniform float opacity;\n#endif\n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\tvec4 diffuseColor = vec4( 1.0 );\n\t#if DEPTH_PACKING == 3200\n\t\tdiffuseColor.a = opacity;\n\t#endif\n\t#include \n\t#include \n\t#include \n\t#include \n\t#if DEPTH_PACKING == 3200\n\t\tgl_FragColor = vec4( vec3( gl_FragCoord.z ), opacity );\n\t#elif DEPTH_PACKING == 3201\n\t\tgl_FragColor = packDepthToRGBA( gl_FragCoord.z );\n\t#endif\n}\n",depth_vert:"#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}\n",distanceRGBA_frag:"uniform vec3 lightPos;\nvarying vec4 vWorldPosition;\n#include \n#include \n#include \nvoid main () {\n\t#include \n\tgl_FragColor = packDepthToRGBA( length( vWorldPosition.xyz - lightPos.xyz ) / 1000.0 );\n}\n",distanceRGBA_vert:"varying vec4 vWorldPosition;\n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tvWorldPosition = worldPosition;\n}\n",equirect_frag:"uniform sampler2D tEquirect;\nuniform float tFlip;\nvarying vec3 vWorldPosition;\n#include \nvoid main() {\n\tvec3 direction = normalize( vWorldPosition );\n\tvec2 sampleUV;\n\tsampleUV.y = saturate( tFlip * direction.y * -0.5 + 0.5 );\n\tsampleUV.x = atan( direction.z, direction.x ) * RECIPROCAL_PI2 + 0.5;\n\tgl_FragColor = texture2D( tEquirect, sampleUV );\n}\n",equirect_vert:"varying vec3 vWorldPosition;\n#include \nvoid main() {\n\tvWorldPosition = transformDirection( position, modelMatrix );\n\t#include \n\t#include \n}\n",linedashed_frag:"uniform vec3 diffuse;\nuniform float opacity;\nuniform float dashSize;\nuniform float totalSize;\nvarying float vLineDistance;\n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\tif ( mod( vLineDistance, totalSize ) > dashSize ) {\n\t\tdiscard;\n\t}\n\tvec3 outgoingLight = vec3( 0.0 );\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include \n\t#include \n\toutgoingLight = diffuseColor.rgb;\n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include \n\t#include \n\t#include \n\t#include \n}\n",linedashed_vert:"uniform float scale;\nattribute float lineDistance;\nvarying float vLineDistance;\n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\tvLineDistance = scale * lineDistance;\n\tvec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );\n\tgl_Position = projectionMatrix * mvPosition;\n\t#include \n\t#include \n\t#include \n}\n",meshbasic_frag:"uniform vec3 diffuse;\nuniform float opacity;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\t#ifdef USE_LIGHTMAP\n\t\treflectedLight.indirectDiffuse += texture2D( lightMap, vUv2 ).xyz * lightMapIntensity;\n\t#else\n\t\treflectedLight.indirectDiffuse += vec3( 1.0 );\n\t#endif\n\t#include \n\treflectedLight.indirectDiffuse *= diffuseColor.rgb;\n\tvec3 outgoingLight = reflectedLight.indirectDiffuse;\n\t#include \n\t#include \n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include \n\t#include \n\t#include \n\t#include \n}\n",meshbasic_vert:"#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#include \n\t#include \n\t#ifdef USE_ENVMAP\n\t#include \n\t#include \n\t#include \n\t#include \n\t#endif\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}\n",meshlambert_frag:"uniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float opacity;\nvarying vec3 vLightFront;\n#ifdef DOUBLE_SIDED\n\tvarying vec3 vLightBack;\n#endif\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\treflectedLight.indirectDiffuse = getAmbientLightIrradiance( ambientLightColor );\n\t#include \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 \n\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;\n\t#include \n\t#include \n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include \n\t#include \n\t#include \n\t#include \n}\n",meshlambert_vert:"#define LAMBERT\nvarying vec3 vLightFront;\n#ifdef DOUBLE_SIDED\n\tvarying vec3 vLightBack;\n#endif\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}\n",meshphong_frag:"#define PHONG\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform vec3 specular;\nuniform float shininess;\nuniform float opacity;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveRadiance;\n\t#include \n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include \n\t#include \n\t#include \n\t#include \n}\n",meshphong_vert:"#define PHONG\nvarying vec3 vViewPosition;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n#ifndef FLAT_SHADED\n\tvNormal = normalize( transformedNormal );\n#endif\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tvViewPosition = - mvPosition.xyz;\n\t#include \n\t#include \n\t#include \n\t#include \n}\n",meshphysical_frag:"#define PHYSICAL\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float roughness;\nuniform float metalness;\nuniform float opacity;\n#ifndef STANDARD\n\tuniform float clearCoat;\n\tuniform float clearCoatRoughness;\n#endif\nvarying vec3 vViewPosition;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveRadiance;\n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include \n\t#include \n\t#include \n\t#include \n}\n",meshphysical_vert:"#define PHYSICAL\nvarying vec3 vViewPosition;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n#ifndef FLAT_SHADED\n\tvNormal = normalize( transformedNormal );\n#endif\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tvViewPosition = - mvPosition.xyz;\n\t#include \n\t#include \n\t#include \n}\n",normal_frag:"#define NORMAL\nuniform float opacity;\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP )\n\tvarying vec3 vViewPosition;\n#endif\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#include \n\tgl_FragColor = vec4( packNormalToRGB( normal ), opacity );\n}\n",normal_vert:"#define NORMAL\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP )\n\tvarying vec3 vViewPosition;\n#endif\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n#ifndef FLAT_SHADED\n\tvNormal = normalize( transformedNormal );\n#endif\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP )\n\tvViewPosition = - mvPosition.xyz;\n#endif\n}\n",points_frag:"uniform vec3 diffuse;\nuniform float opacity;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\tvec3 outgoingLight = vec3( 0.0 );\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include \n\t#include \n\t#include \n\t#include \n\toutgoingLight = diffuseColor.rgb;\n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include \n\t#include \n\t#include \n\t#include \n}\n",points_vert:"uniform float size;\nuniform float scale;\n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#include \n\t#ifdef USE_SIZEATTENUATION\n\t\tgl_PointSize = size * ( scale / - mvPosition.z );\n\t#else\n\t\tgl_PointSize = size;\n\t#endif\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}\n",shadow_frag:"uniform float opacity;\n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\tgl_FragColor = vec4( 0.0, 0.0, 0.0, opacity * ( 1.0 - getShadowMask() ) );\n}\n",shadow_vert:"#include \nvoid main() {\n\t#include \n\t#include \n\t#include \n\t#include \n}\n"};q.prototype={constructor:q,isColor:!0,r:1,g:1,b:1,set:function(t){return t&&t.isColor?this.copy(t):"number"==typeof t?this.setHex(t):"string"==typeof t&&this.setStyle(t),this},setScalar:function(t){return this.r=t,this.g=t,this.b=t,this},setHex:function(t){return t=Math.floor(t),this.r=(t>>16&255)/255,this.g=(t>>8&255)/255,this.b=(255&t)/255,this},setRGB:function(t,e,n){return this.r=t,this.g=e,this.b=n,this},setHSL:function(){function t(t,e,n){return n<0&&(n+=1),n>1&&(n-=1),n<1/6?t+6*(e-t)*n:n<.5?e:n<2/3?t+6*(e-t)*(2/3-n):t}return function(e,n,r){if(e=fs.euclideanModulo(e,1),n=fs.clamp(n,0,1),r=fs.clamp(r,0,1),0===n)this.r=this.g=this.b=r;else{var i=r<=.5?r*(1+n):r+n-r*n,o=2*r-i;this.r=t(o,i,e+1/3),this.g=t(o,i,e),this.b=t(o,i,e-1/3)}return this}}(),setStyle:function(t){function e(e){void 0!==e&&parseFloat(e)<1&&console.warn("THREE.Color: Alpha component of "+t+" will be ignored.")}var n;if(n=/^((?:rgb|hsl)a?)\(\s*([^\)]*)\)/.exec(t)){var r,i=n[1],o=n[2];switch(i){case"rgb":case"rgba":if(r=/^(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(,\s*([0-9]*\.?[0-9]+)\s*)?$/.exec(o))return this.r=Math.min(255,parseInt(r[1],10))/255,this.g=Math.min(255,parseInt(r[2],10))/255,this.b=Math.min(255,parseInt(r[3],10))/255,e(r[5]),this;if(r=/^(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(,\s*([0-9]*\.?[0-9]+)\s*)?$/.exec(o))return this.r=Math.min(100,parseInt(r[1],10))/100,this.g=Math.min(100,parseInt(r[2],10))/100,this.b=Math.min(100,parseInt(r[3],10))/100,e(r[5]),this;break;case"hsl":case"hsla":if(r=/^([0-9]*\.?[0-9]+)\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(,\s*([0-9]*\.?[0-9]+)\s*)?$/.exec(o)){var a=parseFloat(r[1])/360,s=parseInt(r[2],10)/100,u=parseInt(r[3],10)/100;return e(r[5]),this.setHSL(a,s,u)}}}else if(n=/^\#([A-Fa-f0-9]+)$/.exec(t)){var c=n[1],l=c.length;if(3===l)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===l)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}if(t&&t.length>0){var c=ws[t];void 0!==c?this.setHex(c):console.warn("THREE.Color: Unknown color "+t)}return this},clone:function(){return new this.constructor(this.r,this.g,this.b)},copy:function(t){return this.r=t.r,this.g=t.g,this.b=t.b,this},copyGammaToLinear:function(t,e){return void 0===e&&(e=2),this.r=Math.pow(t.r,e),this.g=Math.pow(t.g,e),this.b=Math.pow(t.b,e),this},copyLinearToGamma:function(t,e){void 0===e&&(e=2);var n=e>0?1/e:1;return this.r=Math.pow(t.r,n),this.g=Math.pow(t.g,n),this.b=Math.pow(t.b,n),this},convertGammaToLinear:function(){var t=this.r,e=this.g,n=this.b;return this.r=t*t,this.g=e*e,this.b=n*n,this},convertLinearToGamma:function(){return this.r=Math.sqrt(this.r),this.g=Math.sqrt(this.g),this.b=Math.sqrt(this.b),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(t){var e,n,r=t||{h:0,s:0,l:0},i=this.r,o=this.g,a=this.b,s=Math.max(i,o,a),u=Math.min(i,o,a),c=(u+s)/2;if(u===s)e=0,n=0;else{var l=s-u;switch(n=c<=.5?l/(s+u):l/(2-s-u),s){case i:e=(o-a)/l+(othis.max.x||t.ythis.max.y)},containsBox:function(t){return this.min.x<=t.min.x&&t.max.x<=this.max.x&&this.min.y<=t.min.y&&t.max.y<=this.max.y},getParameter:function(t,e){return(e||new i).set((t.x-this.min.x)/(this.max.x-this.min.x),(t.y-this.min.y)/(this.max.y-this.min.y))},intersectsBox:function(t){return!(t.max.xthis.max.x||t.max.ythis.max.y)},clampPoint:function(t,e){return(e||new i).copy(t).clamp(this.min,this.max)},distanceToPoint:function(){var t=new i;return function(e){return t.copy(e).clamp(this.min,this.max).sub(e).length()}}(),intersect:function(t){return this.min.max(t.min),this.max.min(t.max),this},union:function(t){return this.min.min(t.min),this.max.max(t.max),this},translate:function(t){return this.min.add(t),this.max.add(t),this},equals:function(t){return t.min.equals(this.min)&&t.max.equals(this.max)}};var Ts=0;$.prototype={constructor:$,isMaterial:!0,get needsUpdate(){return this._needsUpdate},set needsUpdate(t){!0===t&&this.update(),this._needsUpdate=t},setValues:function(t){if(void 0!==t)for(var e in t){var n=t[e];if(void 0!==n){var r=this[e];void 0!==r?r&&r.isColor?r.set(n):r&&r.isVector3&&n&&n.isVector3?r.copy(n):this[e]="overdraw"===e?Number(n):n:console.warn("THREE."+this.type+": '"+e+"' is not a property of this material.")}else console.warn("THREE.Material: '"+e+"' parameter is undefined.")}},toJSON:function(t){function e(t){var e=[];for(var n in t){var r=t[n];delete r.metadata,e.push(r)}return e}var n=void 0===t;n&&(t={textures:{},images:{}});var r={metadata:{version:4.4,type:"Material",generator:"Material.toJSON"}};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.emissive&&this.emissive.isColor&&(r.emissive=this.emissive.getHex()),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.map&&this.map.isTexture&&(r.map=this.map.toJSON(t).uuid),this.alphaMap&&this.alphaMap.isTexture&&(r.alphaMap=this.alphaMap.toJSON(t).uuid),this.lightMap&&this.lightMap.isTexture&&(r.lightMap=this.lightMap.toJSON(t).uuid),this.bumpMap&&this.bumpMap.isTexture&&(r.bumpMap=this.bumpMap.toJSON(t).uuid,r.bumpScale=this.bumpScale),this.normalMap&&this.normalMap.isTexture&&(r.normalMap=this.normalMap.toJSON(t).uuid,r.normalScale=this.normalScale.toArray()),this.displacementMap&&this.displacementMap.isTexture&&(r.displacementMap=this.displacementMap.toJSON(t).uuid,r.displacementScale=this.displacementScale,r.displacementBias=this.displacementBias),this.roughnessMap&&this.roughnessMap.isTexture&&(r.roughnessMap=this.roughnessMap.toJSON(t).uuid),this.metalnessMap&&this.metalnessMap.isTexture&&(r.metalnessMap=this.metalnessMap.toJSON(t).uuid),this.emissiveMap&&this.emissiveMap.isTexture&&(r.emissiveMap=this.emissiveMap.toJSON(t).uuid),this.specularMap&&this.specularMap.isTexture&&(r.specularMap=this.specularMap.toJSON(t).uuid),this.envMap&&this.envMap.isTexture&&(r.envMap=this.envMap.toJSON(t).uuid,r.reflectivity=this.reflectivity),this.gradientMap&&this.gradientMap.isTexture&&(r.gradientMap=this.gradientMap.toJSON(t).uuid),void 0!==this.size&&(r.size=this.size),void 0!==this.sizeAttenuation&&(r.sizeAttenuation=this.sizeAttenuation),this.blending!==vo&&(r.blending=this.blending),this.shading!==lo&&(r.shading=this.shading),this.side!==ao&&(r.side=this.side),this.vertexColors!==ho&&(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,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),r.skinning=this.skinning,r.morphTargets=this.morphTargets,n){var i=e(t.textures),o=e(t.images);i.length>0&&(r.textures=i),o.length>0&&(r.images=o)}return r},clone:function(){return(new this.constructor).copy(this)},copy:function(t){this.name=t.name,this.fog=t.fog,this.lights=t.lights,this.blending=t.blending,this.side=t.side,this.shading=t.shading,this.vertexColors=t.vertexColors,this.opacity=t.opacity,this.transparent=t.transparent,this.blendSrc=t.blendSrc,this.blendDst=t.blendDst,this.blendEquation=t.blendEquation,this.blendSrcAlpha=t.blendSrcAlpha,this.blendDstAlpha=t.blendDstAlpha,this.blendEquationAlpha=t.blendEquationAlpha,this.depthFunc=t.depthFunc,this.depthTest=t.depthTest,this.depthWrite=t.depthWrite,this.colorWrite=t.colorWrite,this.precision=t.precision,this.polygonOffset=t.polygonOffset,this.polygonOffsetFactor=t.polygonOffsetFactor,this.polygonOffsetUnits=t.polygonOffsetUnits,this.alphaTest=t.alphaTest,this.premultipliedAlpha=t.premultipliedAlpha,this.overdraw=t.overdraw,this.visible=t.visible,this.clipShadows=t.clipShadows,this.clipIntersection=t.clipIntersection;var e=t.clippingPlanes,n=null;if(null!==e){var r=e.length;n=new Array(r);for(var i=0;i!==r;++i)n[i]=e[i].clone()}return this.clippingPlanes=n,this},update:function(){this.dispatchEvent({type:"update"})},dispose:function(){this.dispatchEvent({type:"dispose"})}},Object.assign($.prototype,r.prototype),Q.prototype=Object.create($.prototype),Q.prototype.constructor=Q,Q.prototype.isShaderMaterial=!0,Q.prototype.copy=function(t){return $.prototype.copy.call(this,t),this.fragmentShader=t.fragmentShader,this.vertexShader=t.vertexShader,this.uniforms=xs.clone(t.uniforms),this.defines=t.defines,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.lights=t.lights,this.clipping=t.clipping,this.skinning=t.skinning,this.morphTargets=t.morphTargets,this.morphNormals=t.morphNormals,this.extensions=t.extensions,this},Q.prototype.toJSON=function(t){var e=$.prototype.toJSON.call(this,t);return e.uniforms=this.uniforms,e.vertexShader=this.vertexShader,e.fragmentShader=this.fragmentShader,e},tt.prototype=Object.create($.prototype),tt.prototype.constructor=tt,tt.prototype.isMeshDepthMaterial=!0,tt.prototype.copy=function(t){return $.prototype.copy.call(this,t),this.depthPacking=t.depthPacking,this.skinning=t.skinning,this.morphTargets=t.morphTargets,this.map=t.map,this.alphaMap=t.alphaMap,this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this},et.prototype={constructor:et,isBox3:!0,set:function(t,e){return this.min.copy(t),this.max.copy(e),this},setFromArray:function(t){for(var e=1/0,n=1/0,r=1/0,i=-1/0,o=-1/0,a=-1/0,s=0,u=t.length;si&&(i=c),l>o&&(o=l),h>a&&(a=h)}return this.min.set(e,n,r),this.max.set(i,o,a),this},setFromBufferAttribute:function(t){for(var e=1/0,n=1/0,r=1/0,i=-1/0,o=-1/0,a=-1/0,s=0,u=t.count;si&&(i=c),l>o&&(o=l),h>a&&(a=h)}return this.min.set(e,n,r),this.max.set(i,o,a),this},setFromPoints:function(t){this.makeEmpty();for(var e=0,n=t.length;ethis.max.x||t.ythis.max.y||t.zthis.max.z)},containsBox:function(t){return this.min.x<=t.min.x&&t.max.x<=this.max.x&&this.min.y<=t.min.y&&t.max.y<=this.max.y&&this.min.z<=t.min.z&&t.max.z<=this.max.z},getParameter:function(t,e){return(e||new l).set((t.x-this.min.x)/(this.max.x-this.min.x),(t.y-this.min.y)/(this.max.y-this.min.y),(t.z-this.min.z)/(this.max.z-this.min.z))},intersectsBox:function(t){return!(t.max.xthis.max.x||t.max.ythis.max.y||t.max.zthis.max.z)},intersectsSphere:function(){var t;return function(e){return void 0===t&&(t=new l),this.clampPoint(e.center,t),t.distanceToSquared(e.center)<=e.radius*e.radius}}(),intersectsPlane:function(t){var e,n;return t.normal.x>0?(e=t.normal.x*this.min.x,n=t.normal.x*this.max.x):(e=t.normal.x*this.max.x,n=t.normal.x*this.min.x),t.normal.y>0?(e+=t.normal.y*this.min.y,n+=t.normal.y*this.max.y):(e+=t.normal.y*this.max.y,n+=t.normal.y*this.min.y),t.normal.z>0?(e+=t.normal.z*this.min.z,n+=t.normal.z*this.max.z):(e+=t.normal.z*this.max.z,n+=t.normal.z*this.min.z),e<=t.constant&&n>=t.constant},clampPoint:function(t,e){return(e||new l).copy(t).clamp(this.min,this.max)},distanceToPoint:function(){var t=new l;return function(e){return t.copy(e).clamp(this.min,this.max).sub(e).length()}}(),getBoundingSphere:function(){var t=new l;return function(e){var n=e||new nt;return this.getCenter(n.center),n.radius=.5*this.getSize(t).length(),n}}(),intersect:function(t){return this.min.max(t.min),this.max.min(t.max),this.isEmpty()&&this.makeEmpty(),this},union:function(t){return this.min.min(t.min),this.max.max(t.max),this},applyMatrix4:function(){var t=[new l,new l,new l,new l,new l,new l,new l,new l];return function(e){return this.isEmpty()?this:(t[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(e),t[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(e),t[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(e),t[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(e),t[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(e),t[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(e),t[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(e),t[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(e),this.setFromPoints(t),this)}}(),translate:function(t){return this.min.add(t),this.max.add(t),this},equals:function(t){return t.min.equals(this.min)&&t.max.equals(this.max)}},nt.prototype={constructor:nt,set:function(t,e){return this.center.copy(t),this.radius=e,this},setFromPoints:function(){var t;return function(e,n){void 0===t&&(t=new et);var r=this.center;void 0!==n?r.copy(n):t.setFromPoints(e).getCenter(r);for(var i=0,o=0,a=e.length;othis.radius*this.radius&&(r.sub(this.center).normalize(),r.multiplyScalar(this.radius).add(this.center)),r},getBoundingBox:function(t){var e=t||new et;return e.set(this.center,this.center),e.expandByScalar(this.radius),e},applyMatrix4:function(t){return this.center.applyMatrix4(t),this.radius=this.radius*t.getMaxScaleOnAxis(),this},translate:function(t){return this.center.add(t),this},equals:function(t){return t.center.equals(this.center)&&t.radius===this.radius}},rt.prototype={constructor:rt,isMatrix3:!0,set:function(t,e,n,r,i,o,a,s,u){var c=this.elements;return c[0]=t,c[1]=r,c[2]=a,c[3]=e,c[4]=i,c[5]=s,c[6]=n,c[7]=o,c[8]=u,this},identity:function(){return this.set(1,0,0,0,1,0,0,0,1),this},clone:function(){return(new this.constructor).fromArray(this.elements)},copy:function(t){var e=t.elements;return this.set(e[0],e[3],e[6],e[1],e[4],e[7],e[2],e[5],e[8]),this},setFromMatrix4:function(t){var e=t.elements;return this.set(e[0],e[4],e[8],e[1],e[5],e[9],e[2],e[6],e[10]),this},applyToBufferAttribute:function(){var t;return function(e){void 0===t&&(t=new l);for(var n=0,r=e.count;n1))return r.copy(i).multiplyScalar(a).add(e.start)}else if(0===this.distanceToPoint(e.start))return r.copy(e.start)}}(),intersectsLine:function(t){var e=this.distanceToPoint(t.start),n=this.distanceToPoint(t.end);return e<0&&n>0||n<0&&e>0},intersectsBox:function(t){return t.intersectsPlane(this)},intersectsSphere:function(t){return t.intersectsPlane(this)},coplanarPoint:function(t){return(t||new l).copy(this.normal).multiplyScalar(-this.constant)},applyMatrix4:function(){var t=new l,e=new rt;return function(n,r){var i=this.coplanarPoint(t).applyMatrix4(n),o=r||e.getNormalMatrix(n),a=this.normal.applyMatrix3(o).normalize();return this.constant=-i.dot(a),this}}(),translate:function(t){return this.constant=this.constant-t.dot(this.normal),this},equals:function(t){return t.normal.equals(this.normal)&&t.constant===this.constant}},ot.prototype={constructor:ot,set:function(t,e,n,r,i,o){var a=this.planes;return a[0].copy(t),a[1].copy(e),a[2].copy(n),a[3].copy(r),a[4].copy(i),a[5].copy(o),this},clone:function(){return(new this.constructor).copy(this)},copy:function(t){for(var e=this.planes,n=0;n<6;n++)e[n].copy(t.planes[n]);return this},setFromMatrix:function(t){var e=this.planes,n=t.elements,r=n[0],i=n[1],o=n[2],a=n[3],s=n[4],u=n[5],c=n[6],l=n[7],h=n[8],p=n[9],f=n[10],d=n[11],m=n[12],v=n[13],g=n[14],y=n[15];return e[0].setComponents(a-r,l-s,d-h,y-m).normalize(),e[1].setComponents(a+r,l+s,d+h,y+m).normalize(),e[2].setComponents(a+i,l+u,d+p,y+v).normalize(),e[3].setComponents(a-i,l-u,d-p,y-v).normalize(),e[4].setComponents(a-o,l-c,d-f,y-g).normalize(),e[5].setComponents(a+o,l+c,d+f,y+g).normalize(),this},intersectsObject:function(){var t=new nt;return function(e){var n=e.geometry;return null===n.boundingSphere&&n.computeBoundingSphere(),t.copy(n.boundingSphere).applyMatrix4(e.matrixWorld),this.intersectsSphere(t)}}(),intersectsSprite:function(){var t=new nt;return function(e){return t.center.set(0,0,0),t.radius=.7071067811865476,t.applyMatrix4(e.matrixWorld),this.intersectsSphere(t)}}(),intersectsSphere:function(t){for(var e=this.planes,n=t.center,r=-t.radius,i=0;i<6;i++){if(e[i].distanceToPoint(n)0?n.min.x:n.max.x,e.x=o.normal.x>0?n.max.x:n.min.x,t.y=o.normal.y>0?n.min.y:n.max.y,e.y=o.normal.y>0?n.max.y:n.min.y,t.z=o.normal.z>0?n.min.z:n.max.z,e.z=o.normal.z>0?n.max.z:n.min.z;var a=o.distanceToPoint(t),s=o.distanceToPoint(e);if(a<0&&s<0)return!1}return!0}}(),containsPoint:function(t){for(var e=this.planes,n=0;n<6;n++)if(e[n].distanceToPoint(t)<0)return!1;return!0}},st.prototype={constructor:st,set:function(t,e){return this.origin.copy(t),this.direction.copy(e),this},clone:function(){return(new this.constructor).copy(this)},copy:function(t){return this.origin.copy(t.origin),this.direction.copy(t.direction),this},at:function(t,e){return(e||new l).copy(this.direction).multiplyScalar(t).add(this.origin)},lookAt:function(t){return this.direction.copy(t).sub(this.origin).normalize(),this},recast:function(){var t=new l;return function(e){return this.origin.copy(this.at(e,t)),this}}(),closestPointToPoint:function(t,e){var n=e||new l;n.subVectors(t,this.origin);var r=n.dot(this.direction);return r<0?n.copy(this.origin):n.copy(this.direction).multiplyScalar(r).add(this.origin)},distanceToPoint:function(t){return Math.sqrt(this.distanceSqToPoint(t))},distanceSqToPoint:function(){var t=new l;return function(e){var n=t.subVectors(e,this.origin).dot(this.direction);return n<0?this.origin.distanceToSquared(e):(t.copy(this.direction).multiplyScalar(n).add(this.origin),t.distanceToSquared(e))}}(),distanceSqToSegment:function(){var t=new l,e=new l,n=new l;return function(r,i,o,a){t.copy(r).add(i).multiplyScalar(.5),e.copy(i).sub(r).normalize(),n.copy(this.origin).sub(t);var s,u,c,l,h=.5*r.distanceTo(i),p=-this.direction.dot(e),f=n.dot(this.direction),d=-n.dot(e),m=n.lengthSq(),v=Math.abs(1-p*p);if(v>0)if(s=p*d-f,u=p*f-d,l=h*v,s>=0)if(u>=-l)if(u<=l){var g=1/v;s*=g,u*=g,c=s*(s+p*u+2*f)+u*(p*s+u+2*d)+m}else u=h,s=Math.max(0,-(p*u+f)),c=-s*s+u*(u+2*d)+m;else u=-h,s=Math.max(0,-(p*u+f)),c=-s*s+u*(u+2*d)+m;else u<=-l?(s=Math.max(0,-(-p*h+f)),u=s>0?-h:Math.min(Math.max(-h,-d),h),c=-s*s+u*(u+2*d)+m):u<=l?(s=0,u=Math.min(Math.max(-h,-d),h),c=u*(u+2*d)+m):(s=Math.max(0,-(p*h+f)),u=s>0?h:Math.min(Math.max(-h,-d),h),c=-s*s+u*(u+2*d)+m);else u=p>0?-h:h,s=Math.max(0,-(p*u+f)),c=-s*s+u*(u+2*d)+m;return o&&o.copy(this.direction).multiplyScalar(s).add(this.origin),a&&a.copy(e).multiplyScalar(u).add(t),c}}(),intersectSphere:function(){var t=new l;return function(e,n){t.subVectors(e.center,this.origin);var r=t.dot(this.direction),i=t.dot(t)-r*r,o=e.radius*e.radius;if(i>o)return null;var a=Math.sqrt(o-i),s=r-a,u=r+a;return s<0&&u<0?null:s<0?this.at(u,n):this.at(s,n)}}(),intersectsSphere:function(t){return this.distanceToPoint(t.center)<=t.radius},distanceToPlane:function(t){var e=t.normal.dot(this.direction);if(0===e)return 0===t.distanceToPoint(this.origin)?0:null;var n=-(this.origin.dot(t.normal)+t.constant)/e;return n>=0?n:null},intersectPlane:function(t,e){var n=this.distanceToPlane(t);return null===n?null:this.at(n,e)},intersectsPlane:function(t){var e=t.distanceToPoint(this.origin);return 0===e||t.normal.dot(this.direction)*e<0},intersectBox:function(t,e){var n,r,i,o,a,s,u=1/this.direction.x,c=1/this.direction.y,l=1/this.direction.z,h=this.origin;return u>=0?(n=(t.min.x-h.x)*u,r=(t.max.x-h.x)*u):(n=(t.max.x-h.x)*u,r=(t.min.x-h.x)*u),c>=0?(i=(t.min.y-h.y)*c,o=(t.max.y-h.y)*c):(i=(t.max.y-h.y)*c,o=(t.min.y-h.y)*c),n>o||i>r?null:((i>n||n!==n)&&(n=i),(o=0?(a=(t.min.z-h.z)*l,s=(t.max.z-h.z)*l):(a=(t.max.z-h.z)*l,s=(t.min.z-h.z)*l),n>s||a>r?null:((a>n||n!==n)&&(n=a),(s=0?n:r,e)))},intersectsBox:function(){var t=new l;return function(e){return null!==this.intersectBox(e,t)}}(),intersectTriangle:function(){var t=new l,e=new l,n=new l,r=new l;return function(i,o,a,s,u){e.subVectors(o,i),n.subVectors(a,i),r.crossVectors(e,n);var c,l=this.direction.dot(r);if(l>0){if(s)return null;c=1}else{if(!(l<0))return null;c=-1,l=-l}t.subVectors(this.origin,i);var h=c*this.direction.dot(n.crossVectors(t,n));if(h<0)return null;var p=c*this.direction.dot(e.cross(t));if(p<0)return null;if(h+p>l)return null;var f=-c*t.dot(r);return f<0?null:this.at(f/l,u)}}(),applyMatrix4:function(t){return this.direction.add(this.origin).applyMatrix4(t),this.origin.applyMatrix4(t),this.direction.sub(this.origin),this.direction.normalize(),this},equals:function(t){return t.origin.equals(this.origin)&&t.direction.equals(this.direction)}},ut.RotationOrders=["XYZ","YZX","ZXY","XZY","YXZ","ZYX"],ut.DefaultOrder="XYZ",ut.prototype={constructor:ut,isEuler:!0,get x(){return this._x},set x(t){this._x=t,this.onChangeCallback()},get y(){return this._y},set y(t){this._y=t,this.onChangeCallback()},get z(){return this._z},set z(t){this._z=t,this.onChangeCallback()},get order(){return this._order},set order(t){this._order=t,this.onChangeCallback()},set:function(t,e,n,r){return this._x=t,this._y=e,this._z=n,this._order=r||this._order,this.onChangeCallback(),this},clone:function(){return new this.constructor(this._x,this._y,this._z,this._order)},copy:function(t){return this._x=t._x,this._y=t._y,this._z=t._z,this._order=t._order,this.onChangeCallback(),this},setFromRotationMatrix:function(t,e,n){var r=fs.clamp,i=t.elements,o=i[0],a=i[4],s=i[8],u=i[1],c=i[5],l=i[9],h=i[2],p=i[6],f=i[10];return e=e||this._order,"XYZ"===e?(this._y=Math.asin(r(s,-1,1)),Math.abs(s)<.99999?(this._x=Math.atan2(-l,f),this._z=Math.atan2(-a,o)):(this._x=Math.atan2(p,c),this._z=0)):"YXZ"===e?(this._x=Math.asin(-r(l,-1,1)),Math.abs(l)<.99999?(this._y=Math.atan2(s,f),this._z=Math.atan2(u,c)):(this._y=Math.atan2(-h,o),this._z=0)):"ZXY"===e?(this._x=Math.asin(r(p,-1,1)),Math.abs(p)<.99999?(this._y=Math.atan2(-h,f),this._z=Math.atan2(-a,c)):(this._y=0,this._z=Math.atan2(u,o))):"ZYX"===e?(this._y=Math.asin(-r(h,-1,1)),Math.abs(h)<.99999?(this._x=Math.atan2(p,f),this._z=Math.atan2(u,o)):(this._x=0,this._z=Math.atan2(-a,c))):"YZX"===e?(this._z=Math.asin(r(u,-1,1)),Math.abs(u)<.99999?(this._x=Math.atan2(-l,c),this._y=Math.atan2(-h,o)):(this._x=0,this._y=Math.atan2(s,f))):"XZY"===e?(this._z=Math.asin(-r(a,-1,1)),Math.abs(a)<.99999?(this._x=Math.atan2(p,c),this._y=Math.atan2(s,o)):(this._x=Math.atan2(-l,f),this._y=0)):console.warn("THREE.Euler: .setFromRotationMatrix() given unsupported order: "+e),this._order=e,!1!==n&&this.onChangeCallback(),this},setFromQuaternion:function(){var t;return function(e,n,r){return void 0===t&&(t=new h),t.makeRotationFromQuaternion(e),this.setFromRotationMatrix(t,n,r)}}(),setFromVector3:function(t,e){return this.set(t.x,t.y,t.z,e||this._order)},reorder:function(){var t=new c;return function(e){return t.setFromEuler(this),this.setFromQuaternion(t,e)}}(),equals:function(t){return t._x===this._x&&t._y===this._y&&t._z===this._z&&t._order===this._order},fromArray:function(t){return this._x=t[0],this._y=t[1],this._z=t[2],void 0!==t[3]&&(this._order=t[3]),this.onChangeCallback(),this},toArray:function(t,e){return void 0===t&&(t=[]),void 0===e&&(e=0),t[e]=this._x,t[e+1]=this._y,t[e+2]=this._z,t[e+3]=this._order,t},toVector3:function(t){return t?t.set(this._x,this._y,this._z):new l(this._x,this._y,this._z)},onChange:function(t){return this.onChangeCallback=t,this},onChangeCallback:function(){}},ct.prototype={constructor:ct,set:function(t){this.mask=1<1){for(var e=0;e1)for(var e=0;e0){i.children=[];for(var o=0;o0&&(r.geometries=a),s.length>0&&(r.materials=s),u.length>0&&(r.textures=u),c.length>0&&(r.images=c)}return r.object=i,r},clone:function(t){return(new this.constructor).copy(this,t)},copy:function(t,e){if(void 0===e&&(e=!0),this.name=t.name,this.up.copy(t.up),this.position.copy(t.position),this.quaternion.copy(t.quaternion),this.scale.copy(t.scale),this.matrix.copy(t.matrix),this.matrixWorld.copy(t.matrixWorld),this.matrixAutoUpdate=t.matrixAutoUpdate,this.matrixWorldNeedsUpdate=t.matrixWorldNeedsUpdate,this.layers.mask=t.layers.mask,this.visible=t.visible,this.castShadow=t.castShadow,this.receiveShadow=t.receiveShadow,this.frustumCulled=t.frustumCulled,this.renderOrder=t.renderOrder,this.userData=JSON.parse(JSON.stringify(t.userData)),!0===e)for(var n=0;n0?o.multiplyScalar(1/Math.sqrt(a)):o.set(0,0,0)}}(),pt.barycoordFromPoint=function(){var t=new l,e=new l,n=new l;return function(r,i,o,a,s){t.subVectors(a,i),e.subVectors(o,i),n.subVectors(r,i);var u=t.dot(t),c=t.dot(e),h=t.dot(n),p=e.dot(e),f=e.dot(n),d=u*p-c*c,m=s||new l;if(0===d)return m.set(-2,-1,-1);var v=1/d,g=(p*h-c*f)*v,y=(u*f-c*h)*v;return m.set(1-g-y,y,g)}}(),pt.containsPoint=function(){var t=new l;return function(e,n,r,i){var o=pt.barycoordFromPoint(e,n,r,i,t);return o.x>=0&&o.y>=0&&o.x+o.y<=1}}(),pt.prototype={constructor:pt,set:function(t,e,n){return this.a.copy(t),this.b.copy(e),this.c.copy(n),this},setFromPointsAndIndices:function(t,e,n,r){return this.a.copy(t[e]),this.b.copy(t[n]),this.c.copy(t[r]),this},clone:function(){return(new this.constructor).copy(this)},copy:function(t){return this.a.copy(t.a),this.b.copy(t.b),this.c.copy(t.c),this},area:function(){var t=new l,e=new l;return function(){return t.subVectors(this.c,this.b),e.subVectors(this.a,this.b),.5*t.cross(e).length()}}(),midpoint:function(t){return(t||new l).addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)},normal:function(t){return pt.normal(this.a,this.b,this.c,t)},plane:function(t){return(t||new it).setFromCoplanarPoints(this.a,this.b,this.c)},barycoordFromPoint:function(t,e){return pt.barycoordFromPoint(t,this.a,this.b,this.c,e)},containsPoint:function(t){return pt.containsPoint(t,this.a,this.b,this.c)},closestPointToPoint:function(){var t,e,n,r;return function(i,o){void 0===t&&(t=new it,e=[new ht,new ht,new ht],n=new l,r=new l);var a=o||new l,s=1/0;if(t.setFromCoplanarPoints(this.a,this.b,this.c),t.projectPoint(i,n),!0===this.containsPoint(n))a.copy(n);else{e[0].set(this.a,this.b),e[1].set(this.b,this.c),e[2].set(this.c,this.a);for(var u=0;u0,s=o[1]&&o[1].length>0,u=t.morphTargets,c=u.length;if(c>0){e=[];for(var l=0;l0){h=[];for(var l=0;l0)for(var m=0;m0&&(this.normalsNeedUpdate=!0)},computeFlatVertexNormals:function(){var t,e,n;for(this.computeFaceNormals(),t=0,e=this.faces.length;t0&&(this.normalsNeedUpdate=!0)},computeMorphNormals:function(){var t,e,n,r,i;for(n=0,r=this.faces.length;n0&&(t+=e[n].distanceTo(e[n-1])),this.lineDistances[n]=t},computeBoundingBox:function(){null===this.boundingBox&&(this.boundingBox=new et),this.boundingBox.setFromPoints(this.vertices)},computeBoundingSphere:function(){null===this.boundingSphere&&(this.boundingSphere=new nt),this.boundingSphere.setFromPoints(this.vertices)},merge:function(t,e,n){if(!1===(t&&t.isGeometry))return void console.error("THREE.Geometry.merge(): geometry not an instance of THREE.Geometry.",t);var r,i=this.vertices.length,o=this.vertices,a=t.vertices,s=this.faces,u=t.faces,c=this.faceVertexUvs[0],l=t.faceVertexUvs[0],h=this.colors,p=t.colors;void 0===n&&(n=0),void 0!==e&&(r=(new rt).getNormalMatrix(e));for(var f=0,d=a.length;f=0;n--){var d=p[n];for(this.faces.splice(d,1),a=0,s=this.faceVertexUvs.length;a0,x=g.vertexNormals.length>0,_=1!==g.color.r||1!==g.color.g||1!==g.color.b,w=g.vertexColors.length>0,E=0;if(E=t(E,0,0),E=t(E,1,!0),E=t(E,2,!1),E=t(E,3,y),E=t(E,4,b),E=t(E,5,x),E=t(E,6,_),E=t(E,7,w),l.push(E),l.push(g.a,g.b,g.c),l.push(g.materialIndex),y){var M=this.faceVertexUvs[0][u];l.push(r(M[0]),r(M[1]),r(M[2]))}if(b&&l.push(e(g.normal)),x){var T=g.vertexNormals;l.push(e(T[0]),e(T[1]),e(T[2]))}if(_&&l.push(n(g.color)),w){var S=g.vertexColors;l.push(n(S[0]),n(S[1]),n(S[2]))}}return i.data={},i.data.vertices=s,i.data.normals=h,f.length>0&&(i.data.colors=f),m.length>0&&(i.data.uvs=[m]),i.data.faces=l,i},clone:function(){return(new Ct).copy(this)},copy:function(t){var e,n,r,i,o,a;this.vertices=[],this.colors=[],this.faces=[],this.faceVertexUvs=[[]],this.morphTargets=[],this.morphNormals=[],this.skinWeights=[],this.skinIndices=[],this.lineDistances=[],this.boundingBox=null,this.boundingSphere=null,this.name=t.name;var s=t.vertices;for(e=0,n=s.length;e65535?wt:xt)(t,1):this.index=t},addAttribute:function(t,e){return!1===(e&&e.isBufferAttribute)&&!1===(e&&e.isInterleavedBufferAttribute)?(console.warn("THREE.BufferGeometry: .addAttribute() now expects ( name, attribute )."),void this.addAttribute(t,new mt(arguments[1],arguments[2]))):"index"===t?(console.warn("THREE.BufferGeometry.addAttribute: Use .setIndex() for index attribute."),void this.setIndex(e)):(this.attributes[t]=e,this)},getAttribute:function(t){return this.attributes[t]},removeAttribute:function(t){return delete this.attributes[t],this},addGroup:function(t,e,n){this.groups.push({start:t,count:e,materialIndex:void 0!==n?n:0})},clearGroups:function(){this.groups=[]},setDrawRange:function(t,e){this.drawRange.start=t,this.drawRange.count=e},applyMatrix:function(t){var e=this.attributes.position;void 0!==e&&(t.applyToBufferAttribute(e),e.needsUpdate=!0);var n=this.attributes.normal;if(void 0!==n){(new rt).getNormalMatrix(t).applyToBufferAttribute(n),n.needsUpdate=!0}return null!==this.boundingBox&&this.computeBoundingBox(),null!==this.boundingSphere&&this.computeBoundingSphere(),this},rotateX:function(){var t;return function(e){return void 0===t&&(t=new h),t.makeRotationX(e),this.applyMatrix(t),this}}(),rotateY:function(){var t;return function(e){return void 0===t&&(t=new h),t.makeRotationY(e),this.applyMatrix(t),this}}(),rotateZ:function(){var t;return function(e){return void 0===t&&(t=new h),t.makeRotationZ(e),this.applyMatrix(t),this}}(),translate:function(){var t;return function(e,n,r){return void 0===t&&(t=new h),t.makeTranslation(e,n,r),this.applyMatrix(t),this}}(),scale:function(){var t;return function(e,n,r){return void 0===t&&(t=new h),t.makeScale(e,n,r),this.applyMatrix(t),this}}(),lookAt:function(){var t;return function(e){void 0===t&&(t=new lt),t.lookAt(e),t.updateMatrix(),this.applyMatrix(t.matrix)}}(),center:function(){this.computeBoundingBox();var t=this.boundingBox.getCenter().negate();return this.translate(t.x,t.y,t.z),t},setFromObject:function(t){var e=t.geometry;if(t.isPoints||t.isLine){var n=new Et(3*e.vertices.length,3),r=new Et(3*e.colors.length,3);if(this.addAttribute("position",n.copyVector3sArray(e.vertices)),this.addAttribute("color",r.copyColorsArray(e.colors)),e.lineDistances&&e.lineDistances.length===e.vertices.length){var i=new Et(e.lineDistances.length,1);this.addAttribute("lineDistance",i.copyArray(e.lineDistances))}null!==e.boundingSphere&&(this.boundingSphere=e.boundingSphere.clone()),null!==e.boundingBox&&(this.boundingBox=e.boundingBox.clone())}else t.isMesh&&e&&e.isGeometry&&this.fromGeometry(e);return this},updateFromObject:function(t){var e=t.geometry;if(t.isMesh){var n=e.__directGeometry;if(!0===e.elementsNeedUpdate&&(n=void 0,e.elementsNeedUpdate=!1),void 0===n)return this.fromGeometry(e);n.verticesNeedUpdate=e.verticesNeedUpdate,n.normalsNeedUpdate=e.normalsNeedUpdate,n.colorsNeedUpdate=e.colorsNeedUpdate,n.uvsNeedUpdate=e.uvsNeedUpdate,n.groupsNeedUpdate=e.groupsNeedUpdate,e.verticesNeedUpdate=!1,e.normalsNeedUpdate=!1,e.colorsNeedUpdate=!1,e.uvsNeedUpdate=!1,e.groupsNeedUpdate=!1,e=n}var r;return!0===e.verticesNeedUpdate&&(r=this.attributes.position,void 0!==r&&(r.copyVector3sArray(e.vertices),r.needsUpdate=!0),e.verticesNeedUpdate=!1),!0===e.normalsNeedUpdate&&(r=this.attributes.normal,void 0!==r&&(r.copyVector3sArray(e.normals),r.needsUpdate=!0),e.normalsNeedUpdate=!1),!0===e.colorsNeedUpdate&&(r=this.attributes.color,void 0!==r&&(r.copyColorsArray(e.colors),r.needsUpdate=!0),e.colorsNeedUpdate=!1),e.uvsNeedUpdate&&(r=this.attributes.uv,void 0!==r&&(r.copyVector2sArray(e.uvs),r.needsUpdate=!0),e.uvsNeedUpdate=!1),e.lineDistancesNeedUpdate&&(r=this.attributes.lineDistance,void 0!==r&&(r.copyArray(e.lineDistances),r.needsUpdate=!0),e.lineDistancesNeedUpdate=!1),e.groupsNeedUpdate&&(e.computeGroups(t.geometry),this.groups=e.groups,e.groupsNeedUpdate=!1),this},fromGeometry:function(t){return t.__directGeometry=(new Tt).fromGeometry(t),this.fromDirectGeometry(t.__directGeometry)},fromDirectGeometry:function(t){var e=new Float32Array(3*t.vertices.length);if(this.addAttribute("position",new mt(e,3).copyVector3sArray(t.vertices)),t.normals.length>0){var n=new Float32Array(3*t.normals.length);this.addAttribute("normal",new mt(n,3).copyVector3sArray(t.normals))}if(t.colors.length>0){var r=new Float32Array(3*t.colors.length);this.addAttribute("color",new mt(r,3).copyColorsArray(t.colors))}if(t.uvs.length>0){var i=new Float32Array(2*t.uvs.length);this.addAttribute("uv",new mt(i,2).copyVector2sArray(t.uvs))}if(t.uvs2.length>0){var o=new Float32Array(2*t.uvs2.length);this.addAttribute("uv2",new mt(o,2).copyVector2sArray(t.uvs2))}if(t.indices.length>0){var a=St(t.indices)>65535?Uint32Array:Uint16Array,s=new a(3*t.indices.length);this.setIndex(new mt(s,1).copyIndicesArray(t.indices))}this.groups=t.groups;for(var u in t.morphTargets){for(var c=[],l=t.morphTargets[u],h=0,p=l.length;h0){var m=new Et(4*t.skinIndices.length,4);this.addAttribute("skinIndex",m.copyVector4sArray(t.skinIndices))}if(t.skinWeights.length>0){var v=new Et(4*t.skinWeights.length,4);this.addAttribute("skinWeight",v.copyVector4sArray(t.skinWeights))}return null!==t.boundingSphere&&(this.boundingSphere=t.boundingSphere.clone()),null!==t.boundingBox&&(this.boundingBox=t.boundingBox.clone()),this},computeBoundingBox:function(){null===this.boundingBox&&(this.boundingBox=new et);var t=this.attributes.position;void 0!==t?this.boundingBox.setFromBufferAttribute(t):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(){var t=new et,e=new l;return function(){null===this.boundingSphere&&(this.boundingSphere=new nt);var n=this.attributes.position;if(n){var r=this.boundingSphere.center;t.setFromBufferAttribute(n),t.getCenter(r);for(var i=0,o=0,a=n.count;o0&&(t.data.groups=JSON.parse(JSON.stringify(s)));var u=this.boundingSphere;return null!==u&&(t.data.boundingSphere={center:u.center.toArray(),radius:u.radius}),t},clone:function(){return(new Pt).copy(this)},copy:function(t){var e,n,r;this.index=null,this.attributes={},this.morphAttributes={},this.groups=[],this.boundingBox=null,this.boundingSphere=null,this.name=t.name;var i=t.index;null!==i&&this.setIndex(i.clone());var o=t.attributes;for(e in o){var a=o[e];this.addAttribute(e,a.clone())}var s=t.morphAttributes;for(e in s){var u=[],c=s[e];for(n=0,r=c.length;n0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(var e=0,n=t.length;ee.far?null:{distance:u,point:x.clone(),object:t}}function n(n,r,i,o,a,l,h,p){s.fromBufferAttribute(o,l),u.fromBufferAttribute(o,h),c.fromBufferAttribute(o,p);var f=e(n,r,i,s,u,c,b);return f&&(a&&(m.fromBufferAttribute(a,l),v.fromBufferAttribute(a,h),g.fromBufferAttribute(a,p),f.uv=t(b,s,u,c,m,v,g)),f.face=new ft(l,h,p,pt.normal(s,u,c)),f.faceIndex=l),f}var r=new h,o=new st,a=new nt,s=new l,u=new l,c=new l,p=new l,f=new l,d=new l,m=new i,v=new i,g=new i,y=new l,b=new l,x=new l;return function(i,l){var h=this.geometry,y=this.material,x=this.matrixWorld;if(void 0!==y&&(null===h.boundingSphere&&h.computeBoundingSphere(),a.copy(h.boundingSphere),a.applyMatrix4(x),!1!==i.ray.intersectsSphere(a)&&(r.getInverse(x),o.copy(i.ray).applyMatrix4(r),null===h.boundingBox||!1!==o.intersectsBox(h.boundingBox)))){var _;if(h.isBufferGeometry){var w,E,M,T,S,A=h.index,C=h.attributes.position,P=h.attributes.uv;if(null!==A)for(T=0,S=A.count;T0&&(I=F);for(var B=0,z=U.length;Bthis.scale.x*this.scale.y/4||n.push({distance:Math.sqrt(r),point:this.position,face:null,object:this})}}(),clone:function(){return new this.constructor(this.material).copy(this)}}),ge.prototype=Object.assign(Object.create(lt.prototype),{constructor:ge,copy:function(t){lt.prototype.copy.call(this,t,!1);for(var e=t.levels,n=0,r=e.length;n1){t.setFromMatrixPosition(n.matrixWorld),e.setFromMatrixPosition(this.matrixWorld);var i=t.distanceTo(e);r[0].object.visible=!0;for(var o=1,a=r.length;o=r[o].distance;o++)r[o-1].object.visible=!1,r[o].object.visible=!0;for(;oa)){f.applyMatrix4(this.matrixWorld);var M=r.ray.origin.distanceTo(f);Mr.far||i.push({distance:M,point:p.clone().applyMatrix4(this.matrixWorld),index:b,face:null,faceIndex:null,object:this})}}else for(var b=0,x=g.length/3-1;ba)){f.applyMatrix4(this.matrixWorld);var M=r.ray.origin.distanceTo(f);Mr.far||i.push({distance:M,point:p.clone().applyMatrix4(this.matrixWorld),index:b,face:null,faceIndex:null,object:this})}}}else if(s.isGeometry)for(var T=s.vertices,S=T.length,b=0;ba)){f.applyMatrix4(this.matrixWorld);var M=r.ray.origin.distanceTo(f);Mr.far||i.push({distance:M,point:p.clone().applyMatrix4(this.matrixWorld),index:b,face:null,faceIndex:null,object:this})}}}}}(),clone:function(){return new this.constructor(this.geometry,this.material).copy(this)}}),Ee.prototype=Object.assign(Object.create(we.prototype),{constructor:Ee,isLineSegments:!0}),Me.prototype=Object.create($.prototype),Me.prototype.constructor=Me,Me.prototype.isPointsMaterial=!0,Me.prototype.copy=function(t){return $.prototype.copy.call(this,t),this.color.copy(t.color),this.map=t.map,this.size=t.size,this.sizeAttenuation=t.sizeAttenuation,this},Te.prototype=Object.assign(Object.create(lt.prototype),{constructor:Te,isPoints:!0,raycast:function(){var t=new h,e=new st,n=new nt;return function(r,i){function o(t,n){var o=e.distanceSqToPoint(t);if(or.far)return;i.push({distance:c,distanceToRay:Math.sqrt(o),point:s.clone(),index:n,face:null,object:a})}}var a=this,s=this.geometry,u=this.matrixWorld,c=r.params.Points.threshold;if(null===s.boundingSphere&&s.computeBoundingSphere(),n.copy(s.boundingSphere),n.applyMatrix4(u),!1!==r.ray.intersectsSphere(n)){t.getInverse(u),e.copy(r.ray).applyMatrix4(t);var h=c/((this.scale.x+this.scale.y+this.scale.z)/3),p=h*h,f=new l;if(s.isBufferGeometry){var d=s.index,m=s.attributes,v=m.position.array;if(null!==d)for(var g=d.array,y=0,b=g.length;y=-Number.EPSILON&&C>=-Number.EPSILON&&A>=-Number.EPSILON))return!1;return!0}return function(e,n){var r=e.length;if(r<3)return null;var i,o,a,s=[],u=[],c=[];if(Ps.area(e)>0)for(o=0;o2;){if(h--<=0)return console.warn("THREE.ShapeUtils: Unable to triangulate polygon! in triangulate()"),n?c:s;if(i=o,l<=i&&(i=0),o=i+1,l<=o&&(o=0),a=o+1,l<=a&&(a=0),t(e,i,o,a,l,u)){var p,f,d,m,v;for(p=u[i],f=u[o],d=u[a],s.push([e[p],e[f],e[d]]),c.push([u[i],u[o],u[a]]),m=o,v=o+1;v2&&t[e-1].equals(t[0])&&t.pop()}function r(t,e,n){return t.x!==e.x?t.xNumber.EPSILON){var d;if(p>0){if(f<0||f>p)return[];if((d=c*l-u*h)<0||d>p)return[]}else{if(f>0||f0||dT?[]:x===T?o?[]:[y]:_<=T?[y,b]:[y,E]}function o(t,e,n,r){var i=e.x-t.x,o=e.y-t.y,a=n.x-t.x,s=n.y-t.y,u=r.x-t.x,c=r.y-t.y,l=i*s-o*a,h=i*c-o*u;if(Math.abs(l)>Number.EPSILON){var p=u*s-c*a;return l>0?h>=0&&p>=0:h>=0||p>=0}return h>0}n(t),e.forEach(n);for(var a,s,u,c,l,h,p={},f=t.concat(),d=0,m=e.length;d0;){if(--_<0){console.log("Infinite Loop! Holes left:"+v.length+", Probably Hole outside Shape!");break}for(a=x;ar&&(a=0);var s=o(m[t],m[i],m[a],n[e]);if(!s)return!1;var u=n.length-1,c=e-1;c<0&&(c=u);var l=e+1;return l>u&&(l=0),!!(s=o(n[e],n[c],n[l],m[t]))}(a,w)&&!function(t,e){var n,r,o;for(n=0;n0)return!0;return!1}(s,u)&&!function(t,n){var r,o,a,s,u;for(r=0;r0)return!0;return!1}(s,u)){r=w,v.splice(y,1),h=m.slice(0,a+1),p=m.slice(a),f=n.slice(r),d=n.slice(0,r+1),m=h.concat(f).concat(d).concat(p),x=a;break}if(r>=0)break;g[l]=!0}if(r>=0)break}}return m}(t,e),g=Ps.triangulate(v,!1);for(a=0,s=g.length;aNumber.EPSILON){var f=Math.sqrt(h),d=Math.sqrt(c*c+l*l),m=e.x-u/f,v=e.y+s/f,g=n.x-l/d,y=n.y+c/d,b=((g-m)*l-(y-v)*c)/(s*l-u*c);r=m+s*b-t.x,o=v+u*b-t.y;var x=r*r+o*o;if(x<=2)return new i(r,o);a=Math.sqrt(x/2)}else{var _=!1;s>Number.EPSILON?c>Number.EPSILON&&(_=!0):s<-Number.EPSILON?c<-Number.EPSILON&&(_=!0):Math.sign(u)===Math.sign(l)&&(_=!0),_?(r=-u,o=s,a=Math.sqrt(h)):(r=s,o=u,a=Math.sqrt(h/2))}return new i(r/a,o/a)}function o(t,e){var n,r;for(W=t.length;--W>=0;){n=W,r=W-1,r<0&&(r=t.length-1);var i=0,o=_+2*y;for(i=0;i=0;k--){for(F=k/y,B=v*Math.cos(F*Math.PI/2),U=g*Math.sin(F*Math.PI/2),W=0,X=D.length;W0||0===t.search(/^data\:image\/jpeg/);i.format=r?Pa:Ra,i.image=n,i.needsUpdate=!0,void 0!==e&&e(i)},n,r),i},setCrossOrigin:function(t){return this.crossOrigin=t,this},setPath:function(t){return this.path=t,this}}),Ln.prototype=Object.assign(Object.create(lt.prototype),{constructor:Ln,isLight:!0,copy:function(t){return lt.prototype.copy.call(this,t),this.color.copy(t.color),this.intensity=t.intensity,this},toJSON:function(t){var e=lt.prototype.toJSON.call(this,t);return e.object.color=this.color.getHex(),e.object.intensity=this.intensity,void 0!==this.groundColor&&(e.object.groundColor=this.groundColor.getHex()),void 0!==this.distance&&(e.object.distance=this.distance),void 0!==this.angle&&(e.object.angle=this.angle),void 0!==this.decay&&(e.object.decay=this.decay),void 0!==this.penumbra&&(e.object.penumbra=this.penumbra),void 0!==this.shadow&&(e.object.shadow=this.shadow.toJSON()),e}}),On.prototype=Object.assign(Object.create(Ln.prototype),{constructor:On,isHemisphereLight:!0,copy:function(t){return Ln.prototype.copy.call(this,t),this.groundColor.copy(t.groundColor),this}}),Object.assign(In.prototype,{copy:function(t){return this.camera=t.camera.clone(),this.bias=t.bias,this.radius=t.radius,this.mapSize.copy(t.mapSize),this},clone:function(){return(new this.constructor).copy(this)},toJSON:function(){var t={};return 0!==this.bias&&(t.bias=this.bias),1!==this.radius&&(t.radius=this.radius),512===this.mapSize.x&&512===this.mapSize.y||(t.mapSize=this.mapSize.toArray()),t.camera=this.camera.toJSON(!1).object,delete t.camera.matrix,t}}),Nn.prototype=Object.assign(Object.create(In.prototype),{constructor:Nn,isSpotLightShadow:!0,update:function(t){var e=2*fs.RAD2DEG*t.angle,n=this.mapSize.width/this.mapSize.height,r=t.distance||500,i=this.camera;e===i.fov&&n===i.aspect&&r===i.far||(i.fov=e,i.aspect=n,i.far=r,i.updateProjectionMatrix())}}),Dn.prototype=Object.assign(Object.create(Ln.prototype),{constructor:Dn,isSpotLight:!0,copy:function(t){return Ln.prototype.copy.call(this,t),this.distance=t.distance,this.angle=t.angle,this.penumbra=t.penumbra,this.decay=t.decay,this.target=t.target.clone(),this.shadow=t.shadow.clone(),this}}),kn.prototype=Object.assign(Object.create(Ln.prototype),{constructor:kn,isPointLight:!0,copy:function(t){return Ln.prototype.copy.call(this,t),this.distance=t.distance,this.decay=t.decay,this.shadow=t.shadow.clone(),this}}),Un.prototype=Object.assign(Object.create(In.prototype),{constructor:Un}),Fn.prototype=Object.assign(Object.create(Ln.prototype),{constructor:Fn,isDirectionalLight:!0,copy:function(t){return Ln.prototype.copy.call(this,t),this.target=t.target.clone(),this.shadow=t.shadow.clone(),this}}),Bn.prototype=Object.assign(Object.create(Ln.prototype),{constructor:Bn,isAmbientLight:!0});var Ns={arraySlice:function(t,e,n){return Ns.isTypedArray(t)?new t.constructor(t.subarray(e,n)):t.slice(e,n)},convertArray:function(t,e,n){return!t||!n&&t.constructor===e?t:"number"==typeof e.BYTES_PER_ELEMENT?new e(t):Array.prototype.slice.call(t)},isTypedArray:function(t){return ArrayBuffer.isView(t)&&!(t instanceof DataView)},getKeyframeOrder:function(t){function e(e,n){return t[e]-t[n]}for(var n=t.length,r=new Array(n),i=0;i!==n;++i)r[i]=i;return r.sort(e),r},sortedArray:function(t,e,n){for(var r=t.length,i=new t.constructor(r),o=0,a=0;a!==r;++o)for(var s=n[o]*e,u=0;u!==e;++u)i[a++]=t[s+u];return i},flattenJSON:function(t,e,n,r){for(var i=1,o=t[0];void 0!==o&&void 0===o[r];)o=t[i++];if(void 0!==o){var a=o[r];if(void 0!==a)if(Array.isArray(a))do{a=o[r],void 0!==a&&(e.push(o.time),n.push.apply(n,a)),o=t[i++]}while(void 0!==o);else if(void 0!==a.toArray)do{a=o[r],void 0!==a&&(e.push(o.time),a.toArray(n,n.length)),o=t[i++]}while(void 0!==o);else do{a=o[r],void 0!==a&&(e.push(o.time),n.push(a)),o=t[i++]}while(void 0!==o)}}};zn.prototype={constructor:zn,evaluate:function(t){var e=this.parameterPositions,n=this._cachedIndex,r=e[n],i=e[n-1];t:{e:{var o;n:{r:if(!(t=i)break t;var s=e[1];t=i)break e}o=n,n=0}}for(;n>>1;te;)--o;if(++o,0!==i||o!==r){i>=o&&(o=Math.max(o,1),i=o-1);var a=this.getValueSize();this.times=Ns.arraySlice(n,i,o),this.values=Ns.arraySlice(this.values,i*a,o*a)}return this},validate:function(){var t=!0,e=this.getValueSize();e-Math.floor(e)!=0&&(console.error("invalid value size in track",this),t=!1);var n=this.times,r=this.values,i=n.length;0===i&&(console.error("track is empty",this),t=!1);for(var o=null,a=0;a!==i;a++){var s=n[a];if("number"==typeof s&&isNaN(s)){console.error("time is not a valid number",this,a,s),t=!1;break}if(null!==o&&o>s){console.error("out of order keys",this,a,s,o),t=!1;break}o=s}if(void 0!==r&&Ns.isTypedArray(r))for(var a=0,u=r.length;a!==u;++a){var c=r[a];if(isNaN(c)){console.error("value is not a valid number",this,a,c),t=!1;break}}return t},optimize:function(){for(var t=this.times,e=this.values,n=this.getValueSize(),r=this.getInterpolation()===Ka,i=1,o=t.length-1,a=1;a0){t[i]=t[o];for(var d=o*n,m=i*n,p=0;p!==n;++p)e[m+p]=e[d+p];++i}return i!==t.length&&(this.times=Ns.arraySlice(t,0,i),this.values=Ns.arraySlice(e,0,i*n)),this}},Wn.prototype=Object.assign(Object.create(Ds),{constructor:Wn,ValueTypeName:"vector"}),Xn.prototype=Object.assign(Object.create(zn.prototype),{constructor:Xn,interpolate_:function(t,e,n,r){for(var i=this.resultBuffer,o=this.sampleValues,a=this.valueSize,s=t*a,u=(n-e)/(r-e),l=s+a;s!==l;s+=4)c.slerpFlat(i,0,o,s-a,o,s,u);return i}}),qn.prototype=Object.assign(Object.create(Ds),{constructor:qn,ValueTypeName:"quaternion",DefaultInterpolation:Za,InterpolantFactoryMethodLinear:function(t){return new Xn(this.times,this.values,this.getValueSize(),t)},InterpolantFactoryMethodSmooth:void 0}),Yn.prototype=Object.assign(Object.create(Ds),{constructor:Yn,ValueTypeName:"number"}),Zn.prototype=Object.assign(Object.create(Ds),{constructor:Zn,ValueTypeName:"string",ValueBufferType:Array,DefaultInterpolation:Ya,InterpolantFactoryMethodLinear:void 0,InterpolantFactoryMethodSmooth:void 0}),Kn.prototype=Object.assign(Object.create(Ds),{constructor:Kn,ValueTypeName:"bool",ValueBufferType:Array,DefaultInterpolation:Ya,InterpolantFactoryMethodLinear:void 0,InterpolantFactoryMethodSmooth:void 0}),Jn.prototype=Object.assign(Object.create(Ds),{constructor:Jn,ValueTypeName:"color"}),$n.prototype=Ds,Ds.constructor=$n,Object.assign($n,{parse:function(t){if(void 0===t.type)throw new Error("track type undefined, can not parse");var e=$n._getTrackTypeForValueTypeName(t.type);if(void 0===t.times){var n=[],r=[];Ns.flattenJSON(t.keys,n,r,"value"),t.times=n,t.values=r}return void 0!==e.parse?e.parse(t):new e(t.name,t.times,t.values,t.interpolation)},toJSON:function(t){var e,n=t.constructor;if(void 0!==n.toJSON)e=n.toJSON(t);else{e={name:t.name,times:Ns.convertArray(t.times,Array),values:Ns.convertArray(t.values,Array)};var r=t.getInterpolation();r!==t.DefaultInterpolation&&(e.interpolation=r)}return e.type=t.ValueTypeName,e},_getTrackTypeForValueTypeName:function(t){switch(t.toLowerCase()){case"scalar":case"double":case"float":case"number":case"integer":return Yn;case"vector":case"vector2":case"vector3":case"vector4":return Wn;case"color":return Jn;case"quaternion":return qn;case"bool":case"boolean":return Kn;case"string":return Zn}throw new Error("Unsupported typeName: "+t)}}),Qn.prototype={constructor:Qn,resetDuration:function(){for(var t=this.tracks,e=0,n=0,r=t.length;n!==r;++n){var i=this.tracks[n];e=Math.max(e,i.times[i.times.length-1])}this.duration=e},trim:function(){for(var t=0;t1){var c=u[1],l=r[c];l||(r[c]=l=[]),l.push(s)}}var h=[];for(var c in r)h.push(Qn.CreateFromMorphTargetSequence(c,r[c],e,n));return h},parseAnimation:function(t,e){if(!t)return console.error(" no animation in JSONLoader data"),null;for(var n=function(t,e,n,r,i){if(0!==n.length){var o=[],a=[];Ns.flattenJSON(n,o,a,r),0!==o.length&&i.push(new t(e,o,a))}},r=[],i=t.name||"default",o=t.length||-1,a=t.fps||30,s=t.hierarchy||[],u=0;u1?t.skinWeights[r+1]:0,u=e>2?t.skinWeights[r+2]:0,c=e>3?t.skinWeights[r+3]:0;n.skinWeights.push(new a(o,s,u,c))}if(t.skinIndices)for(var r=0,i=t.skinIndices.length;r1?t.skinIndices[r+1]:0,p=e>2?t.skinIndices[r+2]:0,f=e>3?t.skinIndices[r+3]:0;n.skinIndices.push(new a(l,h,p,f))}n.bones=t.bones,n.bones&&n.bones.length>0&&(n.skinWeights.length!==n.skinIndices.length||n.skinIndices.length!==n.vertices.length)&&console.warn("When skinning, number of vertices ("+n.vertices.length+"), skinIndices ("+n.skinIndices.length+"), and skinWeights ("+n.skinWeights.length+") should match.")}(),function(e){if(void 0!==t.morphTargets)for(var r=0,i=t.morphTargets.length;r0){console.warn('THREE.JSONLoader: "morphColors" no longer supported. Using them as face colors.');for(var h=n.faces,p=t.morphColors[0].colors,r=0,i=h.length;r0&&(n.animations=e)}(),n.computeFaceNormals(),n.computeBoundingSphere(),void 0===t.materials||0===t.materials.length)return{geometry:n};var o=nr.prototype.initMaterials(t.materials,e,this.crossOrigin);return{geometry:n,materials:o}}}),Object.assign(ir.prototype,{load:function(t,e,n,r){""===this.texturePath&&(this.texturePath=t.substring(0,t.lastIndexOf("/")+1));var i=this;new Tn(i.manager).load(t,function(n){var o=null;try{o=JSON.parse(n)}catch(e){return void 0!==r&&r(e),void console.error("THREE:ObjectLoader: Can't parse "+t+".",e.message)}var a=o.metadata;if(void 0===a||void 0===a.type||"geometry"===a.type.toLowerCase())return void console.error("THREE.ObjectLoader: Can't load "+t+". Use THREE.JSONLoader instead.");i.parse(o,e)},n,r)},setTexturePath:function(t){this.texturePath=t},setCrossOrigin:function(t){this.crossOrigin=t},parse:function(t,e){var n=this.parseGeometries(t.geometries),r=this.parseImages(t.images,function(){void 0!==e&&e(a)}),i=this.parseTextures(t.textures,r),o=this.parseMaterials(t.materials,i),a=this.parseObject(t.object,n,o);return t.animations&&(a.animations=this.parseAnimations(t.animations)),void 0!==t.images&&0!==t.images.length||void 0!==e&&e(a),a},parseGeometries:function(t){var e={};if(void 0!==t)for(var n=new rr,r=new er,i=0,o=t.length;i0){var i=new Mn(e),o=new Cn(i);o.setCrossOrigin(this.crossOrigin);for(var a=0,s=t.length;a0?new xe(s,u):new Rt(s,u);break;case"LOD":a=new ge;break;case"Line":a=new we(i(e.geometry),o(e.material),e.mode);break;case"LineSegments":a=new Ee(i(e.geometry),o(e.material));break;case"PointCloud":case"Points":a=new Te(i(e.geometry),o(e.material));break;case"Sprite":a=new ve(o(e.material));break;case"Group":a=new Se;break;case"SkinnedMesh":console.warn("THREE.ObjectLoader.parseObject() does not support SkinnedMesh type. Instantiates Object3D instead.");default:a=new lt}if(a.uuid=e.uuid,void 0!==e.name&&(a.name=e.name),void 0!==e.matrix?(t.fromArray(e.matrix),t.decompose(a.position,a.quaternion,a.scale)):(void 0!==e.position&&a.position.fromArray(e.position),void 0!==e.rotation&&a.rotation.fromArray(e.rotation),void 0!==e.quaternion&&a.quaternion.fromArray(e.quaternion),void 0!==e.scale&&a.scale.fromArray(e.scale)),void 0!==e.castShadow&&(a.castShadow=e.castShadow),void 0!==e.receiveShadow&&(a.receiveShadow=e.receiveShadow),e.shadow&&(void 0!==e.shadow.bias&&(a.shadow.bias=e.shadow.bias),void 0!==e.shadow.radius&&(a.shadow.radius=e.shadow.radius),void 0!==e.shadow.mapSize&&a.shadow.mapSize.fromArray(e.shadow.mapSize),void 0!==e.shadow.camera&&(a.shadow.camera=this.parseObject(e.shadow.camera))),void 0!==e.visible&&(a.visible=e.visible),void 0!==e.userData&&(a.userData=e.userData),void 0!==e.children)for(var c in e.children)a.add(this.parseObject(e.children[c],n,r));if("LOD"===e.type)for(var l=e.levels,h=0;h0)){u=i;break}u=i-1}if(i=u,r[i]===n){var c=i/(o-1);return c}var l=r[i],h=r[i+1],p=h-l,f=(n-l)/p,c=(i+f)/(o-1);return c},getTangent:function(t){var e=t-1e-4,n=t+1e-4;e<0&&(e=0),n>1&&(n=1);var r=this.getPoint(e);return this.getPoint(n).clone().sub(r).normalize()},getTangentAt:function(t){var e=this.getUtoTmapping(t);return this.getTangent(e)},computeFrenetFrames:function(t,e){var n,r,i,o=new l,a=[],s=[],u=[],c=new l,p=new h;for(n=0;n<=t;n++)r=n/t,a[n]=this.getTangentAt(r),a[n].normalize();s[0]=new l,u[0]=new l;var f=Number.MAX_VALUE,d=Math.abs(a[0].x),m=Math.abs(a[0].y),v=Math.abs(a[0].z);for(d<=f&&(f=d,o.set(1,0,0)),m<=f&&(f=m,o.set(0,1,0)),v<=f&&o.set(0,0,1),c.crossVectors(a[0],o).normalize(),s[0].crossVectors(a[0],c),u[0].crossVectors(a[0],s[0]),n=1;n<=t;n++)s[n]=s[n-1].clone(),u[n]=u[n-1].clone(),c.crossVectors(a[n-1],a[n]),c.length()>Number.EPSILON&&(c.normalize(),i=Math.acos(fs.clamp(a[n-1].dot(a[n]),-1,1)),s[n].applyMatrix4(p.makeRotationAxis(c,i))),u[n].crossVectors(a[n],s[n]);if(!0===e)for(i=Math.acos(fs.clamp(s[0].dot(s[t]),-1,1)),i/=t,a[0].dot(c.crossVectors(s[0],s[t]))>0&&(i=-i),n=1;n<=t;n++)s[n].applyMatrix4(p.makeRotationAxis(a[n],i*n)),u[n].crossVectors(a[n],s[n]);return{tangents:a,normals:s,binormals:u}}},vr.prototype=Object.create(mr.prototype),vr.prototype.constructor=vr,vr.prototype.isLineCurve=!0,vr.prototype.getPoint=function(t){if(1===t)return this.v2.clone();var e=this.v2.clone().sub(this.v1);return e.multiplyScalar(t).add(this.v1),e},vr.prototype.getPointAt=function(t){return this.getPoint(t)},vr.prototype.getTangent=function(t){return this.v2.clone().sub(this.v1).normalize()},gr.prototype=Object.assign(Object.create(mr.prototype),{constructor:gr,add:function(t){this.curves.push(t)},closePath:function(){var t=this.curves[0].getPoint(0),e=this.curves[this.curves.length-1].getPoint(1);t.equals(e)||this.curves.push(new vr(e,t))},getPoint:function(t){for(var e=t*this.getLength(),n=this.getCurveLengths(),r=0;r=e){var i=n[r]-e,o=this.curves[r],a=o.getLength(),s=0===a?0:1-i/a;return o.getPointAt(s)}r++}return null},getLength:function(){var t=this.getCurveLengths();return t[t.length-1]},updateArcLengths:function(){this.needsUpdate=!0,this.cacheLengths=null,this.getLengths()},getCurveLengths:function(){if(this.cacheLengths&&this.cacheLengths.length===this.curves.length)return this.cacheLengths;for(var t=[],e=0,n=0,r=this.curves.length;n1&&!n[n.length-1].equals(n[0])&&n.push(n[0]),n},createPointsGeometry:function(t){var e=this.getPoints(t);return this.createGeometry(e)},createSpacedPointsGeometry:function(t){var e=this.getSpacedPoints(t);return this.createGeometry(e)},createGeometry:function(t){for(var e=new Ct,n=0,r=t.length;ne;)n-=e;ne.length-2?e.length-1:r+1],c=e[r>e.length-3?e.length-1:r+2];return new i(or(o,a.x,s.x,u.x,c.x),or(o,a.y,s.y,u.y,c.y))},xr.prototype=Object.create(mr.prototype),xr.prototype.constructor=xr,xr.prototype.getPoint=function(t){var e=this.v0,n=this.v1,r=this.v2,o=this.v3;return new i(dr(t,e.x,n.x,r.x,o.x),dr(t,e.y,n.y,r.y,o.y))},_r.prototype=Object.create(mr.prototype),_r.prototype.constructor=_r,_r.prototype.getPoint=function(t){var e=this.v0,n=this.v1,r=this.v2;return new i(cr(t,e.x,n.x,r.x),cr(t,e.y,n.y,r.y))};var ks=Object.assign(Object.create(gr.prototype),{fromPoints:function(t){this.moveTo(t[0].x,t[0].y);for(var e=1,n=t.length;e0){var c=u.getPoint(0);c.equals(this.currentPoint)||this.lineTo(c.x,c.y)}this.curves.push(u);var l=u.getPoint(1);this.currentPoint.copy(l)}});wr.prototype=ks,ks.constructor=wr,Er.prototype=Object.assign(Object.create(ks),{constructor:Er,getPointsHoles:function(t){for(var e=[],n=0,r=this.holes.length;n1){for(var g=!1,y=[],b=0,x=p.length;bNumber.EPSILON){if(c<0&&(a=e[o],u=-u,s=e[i],c=-c),t.ys.y)continue;if(t.y===a.y){if(t.x===a.x)return!0}else{var l=c*(t.x-a.x)-u*(t.y-a.y);if(0===l)return!0;if(l<0)continue;r=!r}}else{if(t.y!==a.y)continue;if(s.x<=t.x&&t.x<=a.x||a.x<=t.x&&t.x<=s.x)return!0}}return r})(E.p,p[T].p)&&(b!==T&&y.push({froms:b,tos:T,hole:w}),M?(M=!1,h[T].push(E)):g=!0);M&&h[b].push(E)}y.length>0&&(g||(f=h))}for(var S,m=0,A=p.length;m0){this.source.connect(this.filters[0]);for(var t=1,e=this.filters.length;t0){this.source.disconnect(this.filters[0]);for(var t=1,e=this.filters.length;t=.5)for(var o=0;o!==i;++o)t[e+o]=t[n+o]},_slerp:function(t,e,n,r,i){c.slerpFlat(t,e,t,e,t,n,r)},_lerp:function(t,e,n,r,i){for(var o=1-r,a=0;a!==i;++a){var s=e+a;t[s]=t[s]*o+t[n+a]*r}}},kr.prototype={constructor:kr,getValue:function(t,e){this.bind(),this.getValue(t,e)},setValue:function(t,e){this.bind(),this.setValue(t,e)},bind:function(){var t=this.node,e=this.parsedPath,n=e.objectName,r=e.propertyName,i=e.propertyIndex;if(t||(t=kr.findNode(this.rootNode,e.nodeName)||this.rootNode,this.node=t),this.getValue=this._getValue_unavailable,this.setValue=this._setValue_unavailable,!t)return void console.error(" trying to update node for track: "+this.path+" but it wasn't found.");if(n){var o=e.objectIndex;switch(n){case"materials":if(!t.material)return void console.error(" can not bind to material as node does not have a material",this);if(!t.material.materials)return void console.error(" can not bind to material.materials as node.material does not have a materials array",this);t=t.material.materials;break;case"bones":if(!t.skeleton)return void console.error(" can not bind to bones as node does not have a skeleton",this);t=t.skeleton.bones;for(var a=0;a=n){var h=n++,p=e[h];r[p.uuid]=l,e[l]=p,r[c]=h,e[h]=u;for(var f=0,d=o;f!==d;++f){var m=i[f],v=m[h],g=m[l];m[l]=v,m[h]=g}}}this.nCachedObjects_=n},uncache:function(t){for(var e=this._objects,n=e.length,r=this.nCachedObjects_,i=this._indicesByUUID,o=this._bindings,a=o.length,s=0,u=arguments.length;s!==u;++s){var c=arguments[s],l=c.uuid,h=i[l];if(void 0!==h)if(delete i[l],h0)for(var u=this._interpolants,c=this._propertyBindings,l=0,h=u.length;l!==h;++l)u[l].evaluate(a),c[l].accumulate(r,s)},_updateWeight:function(t){var e=0;if(this.enabled){e=this.weight;var n=this._weightInterpolant;if(null!==n){var r=n.evaluate(t)[0];e*=r,t>n.parameterPositions[1]&&(this.stopFading(),0===r&&(this.enabled=!1))}}return this._effectiveWeight=e,e},_updateTimeScale:function(t){var e=0;if(!this.paused){e=this.timeScale;var n=this._timeScaleInterpolant;if(null!==n){e*=n.evaluate(t)[0],t>n.parameterPositions[1]&&(this.stopWarping(),0===e?this.paused=!0:this.timeScale=e)}}return this._effectiveTimeScale=e,e},_updateTime:function(t){var e=this.time+t;if(0===t)return e;var n=this._clip.duration,r=this.loop,i=this._loopCount;if(r===Wa){-1===i&&(this._loopCount=0,this._setEndings(!0,!0,!1));t:{if(e>=n)e=n;else{if(!(e<0))break t;e=0}this.clampWhenFinished?this.paused=!0:this.enabled=!1,this._mixer.dispatchEvent({type:"finished",action:this,direction:t<0?-1:1})}}else{var o=r===qa;if(-1===i&&(t>=0?(i=0,this._setEndings(!0,0===this.repetitions,o)):this._setEndings(0===this.repetitions,!0,o)),e>=n||e<0){var a=Math.floor(e/n);e-=n*a,i+=Math.abs(a);var s=this.repetitions-i;if(s<0)this.clampWhenFinished?this.paused=!0:this.enabled=!1,e=t>0?n:0,this._mixer.dispatchEvent({type:"finished",action:this,direction:t>0?1:-1});else{if(0===s){var u=t<0;this._setEndings(u,!u,o)}else this._setEndings(!1,!1,o);this._loopCount=i,this._mixer.dispatchEvent({type:"loop",action:this,loopDelta:a})}}if(o&&1==(1&i))return this.time=e,n-e}return this.time=e,e},_setEndings:function(t,e,n){var r=this._interpolantSettings;n?(r.endingStart=$a,r.endingEnd=$a):(r.endingStart=t?this.zeroSlopeAtStart?$a:Ja:Qa,r.endingEnd=e?this.zeroSlopeAtEnd?$a:Ja:Qa)},_scheduleFading:function(t,e,n){var r=this._mixer,i=r.time,o=this._weightInterpolant;null===o&&(o=r._lendControlInterpolant(),this._weightInterpolant=o);var a=o.parameterPositions,s=o.sampleValues;return a[0]=i,s[0]=e,a[1]=i+t,s[1]=n,this}},Br.prototype={constructor:Br,clipAction:function(t,e){var n=e||this._root,r=n.uuid,i="string"==typeof t?Qn.findByName(n,t):t,o=null!==i?i.uuid:t,a=this._actionsByClip[o],s=null;if(void 0!==a){var u=a.actionByRoot[r];if(void 0!==u)return u;s=a.knownActions[0],null===i&&(i=s._clip)}if(null===i)return null;var c=new Fr(this,i,e);return this._bindAction(c,s),this._addInactiveAction(c,o,r),c},existingAction:function(t,e){var n=e||this._root,r=n.uuid,i="string"==typeof t?Qn.findByName(n,t):t,o=i?i.uuid:t,a=this._actionsByClip[o];return void 0!==a?a.actionByRoot[r]||null:null},stopAllAction:function(){var t=this._actions,e=this._nActiveActions,n=this._bindings,r=this._nActiveBindings;this._nActiveActions=0,this._nActiveBindings=0;for(var i=0;i!==e;++i)t[i].reset();for(var i=0;i!==r;++i)n[i].useCount=0;return this},update:function(t){t*=this.timeScale;for(var e=this._actions,n=this._nActiveActions,r=this.time+=t,i=Math.sign(t),o=this._accuIndex^=1,a=0;a!==n;++a){var s=e[a];s.enabled&&s._update(r,t,i,o)}for(var u=this._bindings,c=this._nActiveBindings,a=0;a!==c;++a)u[a].apply(o);return this},getRoot:function(){return this._root},uncacheClip:function(t){var e=this._actions,n=t.uuid,r=this._actionsByClip,i=r[n];if(void 0!==i){for(var o=i.knownActions,a=0,s=o.length;a!==s;++a){var u=o[a];this._deactivateAction(u);var c=u._cacheIndex,l=e[e.length-1];u._cacheIndex=null,u._byClipCacheIndex=null,l._cacheIndex=c,e[c]=l,e.pop(),this._removeInactiveBindingsForAction(u)}delete r[n]}},uncacheRoot:function(t){var e=t.uuid,n=this._actionsByClip;for(var r in n){var i=n[r].actionByRoot,o=i[e];void 0!==o&&(this._deactivateAction(o),this._removeInactiveAction(o))}var a=this._bindingsByRootAndName,s=a[e];if(void 0!==s)for(var u in s){var c=s[u];c.restoreOriginalState(),this._removeInactiveBinding(c)}},uncacheAction:function(t,e){var n=this.existingAction(t,e);null!==n&&(this._deactivateAction(n),this._removeInactiveAction(n))}},Object.assign(Br.prototype,{_bindAction:function(t,e){var n=t._localRoot||this._root,r=t._clip.tracks,i=r.length,o=t._propertyBindings,a=t._interpolants,s=n.uuid,u=this._bindingsByRootAndName,c=u[s];void 0===c&&(c={},u[s]=c);for(var l=0;l!==i;++l){var h=r[l],p=h.name,f=c[p];if(void 0!==f)o[l]=f;else{if(void 0!==(f=o[l])){null===f._cacheIndex&&(++f.referenceCount,this._addInactiveBinding(f,s,p));continue}var d=e&&e._propertyBindings[l].binding.parsedPath;f=new Dr(kr.create(n,p,d),h.ValueTypeName,h.getValueSize()),++f.referenceCount,this._addInactiveBinding(f,s,p),o[l]=f}a[l].resultBuffer=f.buffer}},_activateAction:function(t){if(!this._isActiveAction(t)){if(null===t._cacheIndex){var e=(t._localRoot||this._root).uuid,n=t._clip.uuid,r=this._actionsByClip[n];this._bindAction(t,r&&r.knownActions[0]),this._addInactiveAction(t,n,e)}for(var i=t._propertyBindings,o=0,a=i.length;o!==a;++o){var s=i[o];0==s.useCount++&&(this._lendBinding(s),s.saveOriginalState())}this._lendAction(t)}},_deactivateAction:function(t){if(this._isActiveAction(t)){for(var e=t._propertyBindings,n=0,r=e.length;n!==r;++n){var i=e[n];0==--i.useCount&&(i.restoreOriginalState(),this._takeBackBinding(i))}this._takeBackAction(t)}},_initMemoryManager:function(){this._actions=[],this._nActiveActions=0,this._actionsByClip={},this._bindings=[],this._nActiveBindings=0,this._bindingsByRootAndName={},this._controlInterpolants=[],this._nActiveControlInterpolants=0;var t=this;this.stats={actions:{get total(){return t._actions.length},get inUse(){return t._nActiveActions}},bindings:{get total(){return t._bindings.length},get inUse(){return t._nActiveBindings}},controlInterpolants:{get total(){return t._controlInterpolants.length},get inUse(){return t._nActiveControlInterpolants}}}},_isActiveAction:function(t){var e=t._cacheIndex;return null!==e&&e1){var c=u[1];r[c]||(r[c]={start:1/0,end:-1/0});var l=r[c];ol.end&&(l.end=o),e||(e=c)}}for(var c in r){var l=r[c];this.createAnimation(c,l.start,l.end,t)}this.firstAnimation=e},$r.prototype.setAnimationDirectionForward=function(t){var e=this.animationsMap[t];e&&(e.direction=1,e.directionBackwards=!1)},$r.prototype.setAnimationDirectionBackward=function(t){var e=this.animationsMap[t];e&&(e.direction=-1,e.directionBackwards=!0)},$r.prototype.setAnimationFPS=function(t,e){var n=this.animationsMap[t];n&&(n.fps=e,n.duration=(n.end-n.start)/n.fps)},$r.prototype.setAnimationDuration=function(t,e){var n=this.animationsMap[t];n&&(n.duration=e,n.fps=(n.end-n.start)/n.duration)},$r.prototype.setAnimationWeight=function(t,e){var n=this.animationsMap[t];n&&(n.weight=e)},$r.prototype.setAnimationTime=function(t,e){var n=this.animationsMap[t];n&&(n.time=e)},$r.prototype.getAnimationTime=function(t){var e=0,n=this.animationsMap[t];return n&&(e=n.time),e},$r.prototype.getAnimationDuration=function(t){var e=-1,n=this.animationsMap[t];return n&&(e=n.duration),e},$r.prototype.playAnimation=function(t){var e=this.animationsMap[t];e?(e.time=0,e.active=!0):console.warn("THREE.MorphBlendMesh: animation["+t+"] undefined in .playAnimation()")},$r.prototype.stopAnimation=function(t){var e=this.animationsMap[t];e&&(e.active=!1)},$r.prototype.update=function(t){for(var e=0,n=this.animationsList.length;er.duration||r.time<0)&&(r.direction*=-1,r.time>r.duration&&(r.time=r.duration,r.directionBackwards=!0),r.time<0&&(r.time=0,r.directionBackwards=!1)):(r.time=r.time%r.duration,r.time<0&&(r.time+=r.duration));var o=r.start+fs.clamp(Math.floor(r.time/i),0,r.length-1),a=r.weight;o!==r.currentFrame&&(this.morphTargetInfluences[r.lastFrame]=0,this.morphTargetInfluences[r.currentFrame]=1*a,this.morphTargetInfluences[o]=0,r.lastFrame=r.currentFrame,r.currentFrame=o);var s=r.time%i/i;r.directionBackwards&&(s=1-s),r.currentFrame!==r.lastFrame?(this.morphTargetInfluences[r.currentFrame]=s*a,this.morphTargetInfluences[r.lastFrame]=(1-s)*a):this.morphTargetInfluences[r.currentFrame]=a}}},Qr.prototype=Object.create(lt.prototype),Qr.prototype.constructor=Qr,Qr.prototype.isImmediateRenderObject=!0,ti.prototype=Object.create(Ee.prototype),ti.prototype.constructor=ti,ti.prototype.update=function(){var t=new l,e=new l,n=new rt;return function(){var r=["a","b","c"];this.object.updateMatrixWorld(!0),n.getNormalMatrix(this.object.matrixWorld);var i=this.object.matrixWorld,o=this.geometry.attributes.position,a=this.object.geometry;if(a&&a.isGeometry)for(var s=a.vertices,u=a.faces,c=0,l=0,h=u.length;l.99999?this.quaternion.set(0,0,0,1):n.y<-.99999?this.quaternion.set(1,0,0,0):(e.set(n.z,0,-n.x).normalize(),t=Math.acos(n.y),this.quaternion.setFromAxisAngle(e,t))}}(),pi.prototype.setLength=function(t,e,n){void 0===e&&(e=.2*t),void 0===n&&(n=.2*e),this.line.scale.set(1,Math.max(0,t-e),1),this.line.updateMatrix(),this.cone.scale.set(n,e,n),this.cone.position.y=t,this.cone.updateMatrix()},pi.prototype.setColor=function(t){this.line.material.color.copy(t),this.cone.material.color.copy(t)},fi.prototype=Object.create(Ee.prototype),fi.prototype.constructor=fi;var js=new l,Vs=new di,Hs=new di,Gs=new di;mi.prototype=Object.create(mr.prototype),mi.prototype.constructor=mi,mi.prototype.getPoint=function(t){var e=this.points,n=e.length;n<2&&console.log("duh, you need at least 2 points");var r=(n-(this.closed?0:1))*t,i=Math.floor(r),o=r-i;this.closed?i+=i>0?0:(Math.floor(Math.abs(i)/e.length)+1)*e.length:0===o&&i===n-1&&(i=n-2,o=1);var a,s,u,c;if(this.closed||i>0?a=e[(i-1)%n]:(js.subVectors(e[0],e[1]).add(e[0]),a=js),s=e[i%n],u=e[(i+1)%n],this.closed||i+26?u-6:0),l=6;l>",s=s||i,null==r[i]){if(n){var e=null===r[i]?"null":"undefined";return new Error("The "+a+" `"+s+"` is marked as required in `"+o+"`, but its value is `"+e+"`.")}return null}return t.apply(void 0,[r,i,o,a,s].concat(c))})}var r=n.bind(null,!1);return r.isRequired=n.bind(null,!0),r}function o(t,e){return"symbol"===t||("Symbol"===e["@@toStringTag"]||"function"==typeof Symbol&&e instanceof Symbol)}function a(t){var e=void 0===t?"undefined":M(t);return Array.isArray(t)?"array":t instanceof RegExp?"object":o(e,t)?"symbol":e}function s(t){var e=a(t);if("object"===e){if(t instanceof Date)return"date";if(t instanceof RegExp)return"regexp"}return e}function u(t,n){return i(function(r,i,o,u,c){return e.untracked(function(){if(t&&a(r[i])===n.toLowerCase())return null;var u=void 0;switch(n){case"Array":u=e.isObservableArray;break;case"Object":u=e.isObservableObject;break;case"Map":u=e.isObservableMap;break;default:throw new Error("Unexpected mobxType: "+n)}var l=r[i];if(!u(l)){var h=s(l),p=t?" or javascript `"+n.toLowerCase()+"`":"";return new Error("Invalid prop `"+c+"` of type `"+h+"` supplied to `"+o+"`, expected `mobx.Observable"+n+"`"+p+".")}return null})})}function c(t,n){return i(function(r,i,o,a,s){for(var c=arguments.length,l=Array(c>5?c-5:0),h=5;h2&&void 0!==arguments[2]&&arguments[2],r=t[e],i=K[e],o=r?!0===n?function(){i.apply(this,arguments),r.apply(this,arguments)}:function(){r.apply(this,arguments),i.apply(this,arguments)}:i;t[e]=o}function b(t,e){if(null==t||null==e||"object"!==(void 0===t?"undefined":M(t))||"object"!==(void 0===e?"undefined":M(e)))return t!==e;var n=Object.keys(t);if(n.length!==Object.keys(e).length)return!0;for(var r=void 0,i=n.length-1;r=n[i];i--)if(e[r]!==t[r])return!0;return!1}function x(t,e){if("string"==typeof t)throw new Error("Store names should be provided as array");if(Array.isArray(t))return X||(X=!0,console.warn('Mobx observer: Using observer to inject stores is deprecated since 4.0. Use `@inject("store1", "store2") @observer ComponentClass` or `inject("store1", "store2")(observer(componentClass))` instead of `@observer(["store1", "store2"]) ComponentClass`')),e?f.apply(null,t)(x(e)):function(e){return x(t,e)};var r=t;if(!0===r.isMobxInjector&&console.warn("Mobx observer: You are trying to use 'observer' on a component that already has 'inject'. Please apply 'observer' before applying 'inject'"),!("function"!=typeof r||r.prototype&&r.prototype.render||r.isReactClass||w.Component.isPrototypeOf(r))){var i,o;return x((o=i=function(t){function e(){return T(this,e),C(this,(e.__proto__||Object.getPrototypeOf(e)).apply(this,arguments))}return A(e,t),S(e,[{key:"render",value:function(){return r.call(this,this.props,this.context)}}]),e}(n.Component),i.displayName=r.displayName||r.name,i.contextTypes=r.contextTypes,i.propTypes=r.propTypes,i.defaultProps=r.defaultProps,o))}if(!r)throw new Error("Please pass a valid component to 'observer'");return _(r.prototype||r),r.isMobXReactObserver=!0,r}function _(t){y(t,"componentWillMount",!0),["componentDidMount","componentWillUnmount","componentDidUpdate"].forEach(function(e){y(t,e)}),t.shouldComponentUpdate||(t.shouldComponentUpdate=K.shouldComponentUpdate)}var w="default"in n?n.default:n,E="default"in r?r.default:r,M="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},T=function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")},S=function(){function t(t,e){for(var n=0;n",i=this._reactInternalInstance&&this._reactInternalInstance._rootNodeID,o=!1,a=!1;t.call(this,"props"),t.call(this,"state");var s=this.render.bind(this),u=null,c=!1,l=function(){return u=new e.Reaction(r+"#"+i+".render()",function(){if(!c&&(c=!0,"function"==typeof n.componentWillReact&&n.componentWillReact(),!0!==n.__$mobxIsUnmounted)){var t=!0;try{a=!0,o||w.Component.prototype.forceUpdate.call(n),t=!1}finally{a=!1,t&&u.dispose()}}}),h.$mobx=u,n.render=h,h()},h=function(){c=!1;var t=void 0,r=void 0;if(u.track(function(){G&&(n.__$mobRenderStart=Date.now());try{r=e.extras.allowStateChanges(!1,s)}catch(e){t=e}G&&(n.__$mobRenderEnd=Date.now())}),t)throw Z.emit(t),t;return r};this.render=l}},componentWillUnmount:function(){if(!0!==W&&(this.render.$mobx&&this.render.$mobx.dispose(),this.__$mobxIsUnmounted=!0,G)){var t=d(this);t&&q&&q.delete(t),Y.emit({event:"destroy",component:this,node:t})}},componentDidMount:function(){G&&m(this)},componentDidUpdate:function(){G&&m(this)},shouldComponentUpdate:function(t,e){return W&&console.warn("[mobx-react] It seems that a re-rendering of a React component is triggered while in static (server-side) mode. Please make sure components are rendered only once server-side."),this.state!==e||b(this.props,t)}},J=x(function(t){return(0,t.children)()});J.propTypes={children:function(t,e,n,r,i){if("function"!=typeof t[e])return new Error("Invalid prop `"+i+"` of type `"+M(t[e])+"` supplied to `"+n+"`, expected `function`.")}};var $,Q,tt={children:!0,key:!0,ref:!0},et=(Q=$=function(t){function e(){return T(this,e),C(this,(e.__proto__||Object.getPrototypeOf(e)).apply(this,arguments))}return A(e,t),S(e,[{key:"render",value:function(){return w.Children.only(this.props.children)}},{key:"getChildContext",value:function(){var t={},e=this.context.mobxStores;if(e)for(var n in e)t[n]=e[n];for(var r in this.props)tt[r]||"suppressChangedStoreWarning"===r||(t[r]=this.props[r]);return{mobxStores:t}}},{key:"componentWillReceiveProps",value:function(t){if(Object.keys(t).length!==Object.keys(this.props).length&&console.warn("MobX Provider: The set of provided stores has changed. Please avoid changing stores as the change might not propagate to all children"),!t.suppressChangedStoreWarning)for(var e in t)tt[e]||this.props[e]===t[e]||console.warn("MobX Provider: Provided store '"+e+"' has changed. Please avoid replacing stores as the change might not propagate to all children")}}]),e}(n.Component),$.contextTypes={mobxStores:k},$.childContextTypes={mobxStores:k.isRequired},Q),nt=void 0;if(nt="mobx-react",!e)throw new Error(nt+" requires the MobX package");if(!w)throw new Error(nt+" requires React to be available");"function"==typeof r.unstable_batchedUpdates&&e.extras.setReactionScheduler(r.unstable_batchedUpdates);var rt=function(t){return Z.on(t)};"object"===("undefined"==typeof __MOBX_DEVTOOLS_GLOBAL_HOOK__?"undefined":M(__MOBX_DEVTOOLS_GLOBAL_HOOK__))&&__MOBX_DEVTOOLS_GLOBAL_HOOK__.injectMobxReact(t,e),t.propTypes=U,t.PropTypes=U,t.onError=rt,t.default=t,t.observer=x,t.Observer=J,t.renderReporter=Y,t.componentByNodeRegistery=q,t.trackComponents=v,t.useStaticRendering=g,t.Provider=et,t.inject=f,Object.defineProperty(t,"__esModule",{value:!0})})},function(t,e,n){"use strict";var r=!("undefined"==typeof window||!window.document||!window.document.createElement),i={canUseDOM:r,canUseWorkers:"undefined"!=typeof Worker,canUseEventListeners:r&&!(!window.addEventListener&&!window.attachEvent),canUseViewport:r&&!!window.screen,isInWorker:!r};t.exports=i},function(t,e){var n=t.exports={version:"2.4.0"};"number"==typeof __e&&(__e=n)},function(t,e,n){"use strict";function r(t){return function(){return t}}var i=function(){};i.thatReturns=r,i.thatReturnsFalse=r(!1),i.thatReturnsTrue=r(!0),i.thatReturnsNull=r(null),i.thatReturnsThis=function(){return this},i.thatReturnsArgument=function(t){return t},t.exports=i},function(t,e,n){"use strict";var r=null;t.exports={debugTool:r}},function(t,e,n){"use strict";function r(){A.ReactReconcileTransaction&&_||l("123")}function i(){this.reinitializeTransaction(),this.dirtyComponentsLength=null,this.callbackQueue=p.getPooled(),this.reconcileTransaction=A.ReactReconcileTransaction.getPooled(!0)}function o(t,e,n,i,o,a){return r(),_.batchedUpdates(t,e,n,i,o,a)}function a(t,e){return t._mountOrder-e._mountOrder}function s(t){var e=t.dirtyComponentsLength;e!==g.length&&l("124",e,g.length),g.sort(a),y++;for(var n=0;n3&&void 0!==arguments[3]?arguments[3]:0,i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0,o=arguments.length>5&&void 0!==arguments[5]?arguments[5]:0,a=new m.MeshBasicMaterial({map:M.load(t),transparent:!0,depthWrite:!1}),s=new m.Mesh(new m.PlaneGeometry(e,n),a);return s.position.set(r,i,o),s.overdraw=!0,s}function a(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:16711680,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1,r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:4,o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:2,a=arguments.length>5&&void 0!==arguments[5]?arguments[5]:0,s=!(arguments.length>6&&void 0!==arguments[6])||arguments[6],u=new m.Path,c=u.createGeometry(t);c.computeLineDistances();var l=new m.LineDashedMaterial({color:e,dashSize:r,linewidth:n,gapSize:o}),h=new m.Line(c,l);return i(h,a),h.matrixAutoUpdate=s,s||h.updateMatrix(),h}function s(t,e){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:32,r=new m.CircleGeometry(t,n);return new m.Mesh(r,e)}function u(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:.5,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:16777215,r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:1,o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0,a=w(t.map(function(t){return[t.x,t.y]})),s=new m.ShaderMaterial(E({side:m.DoubleSide,diffuse:n,thickness:e,opacity:r,transparent:!0})),u=new m.Mesh(a,s);return i(u,o),u}function c(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:16711680,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1,r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0,o=!(arguments.length>4&&void 0!==arguments[4])||arguments[4],a=arguments.length>5&&void 0!==arguments[5]&&arguments[5],s=arguments.length>6&&void 0!==arguments[6]?arguments[6]:1,u=new m.Path,c=u.createGeometry(t),l=new m.LineBasicMaterial({color:e,linewidth:n,transparent:a,opacity:s}),h=new m.Line(c,l);return i(h,r),h.matrixAutoUpdate=o,!1===o&&h.updateMatrix(),h}function l(t,e,n){var r=new m.CubeGeometry(t.x,t.y,t.z),i=new m.MeshBasicMaterial({color:e}),o=new m.Mesh(r,i),a=new m.BoxHelper(o);return a.material.color=new m.Color(e),a.material.linewidth=n,a}function h(t,e,n,r,i){var o=new m.Vector3(0,t,0);return c([new m.Vector3(0,0,0),o,new m.Vector3(r/2,t-n,0),o,new m.Vector3(-r/2,t-n,0)],i,e,1)}function p(t){var e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n=new m.Shape;if(e){n.moveTo(t[0].x,t[0].y);for(var r=1;r1&&void 0!==arguments[1]?arguments[1]:new m.MeshBasicMaterial({color:16711680}),n=arguments.length>2&&void 0!==arguments[2]&&arguments[2],r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0,o=!(arguments.length>4&&void 0!==arguments[4])||arguments[4],a=p(t,n),s=new m.Mesh(a,e);return i(s,r),s.matrixAutoUpdate=o,!1===o&&s.updateMatrix(),s}Object.defineProperty(e,"__esModule",{value:!0}),e.addOffsetZ=i,e.drawImage=o,e.drawDashedLineFromPoints=a,e.drawCircle=s,e.drawThickBandFromPoints=u,e.drawSegmentsFromPoints=c,e.drawBox=l,e.drawArrow=h,e.getShapeGeometryFromPoints=p,e.drawShapeFromPoints=f;var d=n(8),m=function(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e.default=t,e}(d),v=n(337),g=r(v),y=n(338),b=r(y),x=n(35),_=.04,w=(0,g.default)(m),E=(0,b.default)(m),M=new m.TextureLoader},function(t,e,n){t.exports=!n(31)(function(){return 7!=Object.defineProperty({},"a",{get:function(){return 7}}).a})},function(t,e){var n={}.hasOwnProperty;t.exports=function(t,e){return n.call(t,e)}},function(t,e,n){var r=n(44),i=n(106),o=n(78),a=Object.defineProperty;e.f=n(26)?Object.defineProperty:function(t,e,n){if(r(t),e=o(e,!0),r(n),i)try{return a(t,e,n)}catch(t){}if("get"in n||"set"in n)throw TypeError("Accessors not supported!");return"value"in n&&(t[e]=n.value),t}},function(t,e,n){"use strict";var r=n(4),i=(n(0),function(t){var e=this;if(e.instancePool.length){var n=e.instancePool.pop();return e.call(n,t),n}return new e(t)}),o=function(t,e){var n=this;if(n.instancePool.length){var r=n.instancePool.pop();return n.call(r,t,e),r}return new n(t,e)},a=function(t,e,n){var r=this;if(r.instancePool.length){var i=r.instancePool.pop();return r.call(i,t,e,n),i}return new r(t,e,n)},s=function(t,e,n,r){var i=this;if(i.instancePool.length){var o=i.instancePool.pop();return i.call(o,t,e,n,r),o}return new i(t,e,n,r)},u=function(t){var e=this;t instanceof e||r("25"),t.destructor(),e.instancePool.length-1}function d(t,e,n){for(var r=-1,i=null==t?0:t.length;++r-1;);return n}function B(t,e){for(var n=t.length;n--&&M(e,t[n],0)>-1;);return n}function z(t,e){for(var n=t.length,r=0;n--;)t[n]===e&&++r;return r}function j(t){return"\\"+Cn[t]}function V(t,e){return null==t?it:t[e]}function H(t){return bn.test(t)}function G(t){return xn.test(t)}function W(t){for(var e,n=[];!(e=t.next()).done;)n.push(e.value);return n}function X(t){var e=-1,n=Array(t.size);return t.forEach(function(t,r){n[++e]=[r,t]}),n}function q(t,e){return function(n){return t(e(n))}}function Y(t,e){for(var n=-1,r=t.length,i=0,o=[];++n>>1,Bt=[["ary",Et],["bind",vt],["bindKey",gt],["curry",bt],["curryRight",xt],["flip",Tt],["partial",_t],["partialRight",wt],["rearg",Mt]],zt="[object Arguments]",jt="[object Array]",Vt="[object AsyncFunction]",Ht="[object Boolean]",Gt="[object Date]",Wt="[object DOMException]",Xt="[object Error]",qt="[object Function]",Yt="[object GeneratorFunction]",Zt="[object Map]",Kt="[object Number]",Jt="[object Null]",$t="[object Object]",Qt="[object Proxy]",te="[object RegExp]",ee="[object Set]",ne="[object String]",re="[object Symbol]",ie="[object Undefined]",oe="[object WeakMap]",ae="[object WeakSet]",se="[object ArrayBuffer]",ue="[object DataView]",ce="[object Float32Array]",le="[object Float64Array]",he="[object Int8Array]",pe="[object Int16Array]",fe="[object Int32Array]",de="[object Uint8Array]",me="[object Uint8ClampedArray]",ve="[object Uint16Array]",ge="[object Uint32Array]",ye=/\b__p \+= '';/g,be=/\b(__p \+=) '' \+/g,xe=/(__e\(.*?\)|\b__t\)) \+\n'';/g,_e=/&(?:amp|lt|gt|quot|#39);/g,we=/[&<>"']/g,Ee=RegExp(_e.source),Me=RegExp(we.source),Te=/<%-([\s\S]+?)%>/g,Se=/<%([\s\S]+?)%>/g,Ae=/<%=([\s\S]+?)%>/g,Ce=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,Pe=/^\w*$/,Re=/^\./,Le=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,Oe=/[\\^$.*+?()[\]{}|]/g,Ie=RegExp(Oe.source),Ne=/^\s+|\s+$/g,De=/^\s+/,ke=/\s+$/,Ue=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,Fe=/\{\n\/\* \[wrapped with (.+)\] \*/,Be=/,? & /,ze=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g,je=/\\(\\)?/g,Ve=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,He=/\w*$/,Ge=/^[-+]0x[0-9a-f]+$/i,We=/^0b[01]+$/i,Xe=/^\[object .+?Constructor\]$/,qe=/^0o[0-7]+$/i,Ye=/^(?:0|[1-9]\d*)$/,Ze=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,Ke=/($^)/,Je=/['\n\r\u2028\u2029\\]/g,$e="\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff",Qe="\\xac\\xb1\\xd7\\xf7\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf\\u2000-\\u206f \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000",tn="["+Qe+"]",en="["+$e+"]",nn="[a-z\\xdf-\\xf6\\xf8-\\xff]",rn="[^\\ud800-\\udfff"+Qe+"\\d+\\u2700-\\u27bfa-z\\xdf-\\xf6\\xf8-\\xffA-Z\\xc0-\\xd6\\xd8-\\xde]",on="\\ud83c[\\udffb-\\udfff]",an="(?:\\ud83c[\\udde6-\\uddff]){2}",sn="[\\ud800-\\udbff][\\udc00-\\udfff]",un="[A-Z\\xc0-\\xd6\\xd8-\\xde]",cn="(?:"+nn+"|"+rn+")",ln="(?:[\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff]|\\ud83c[\\udffb-\\udfff])?",hn="(?:\\u200d(?:"+["[^\\ud800-\\udfff]",an,sn].join("|")+")[\\ufe0e\\ufe0f]?"+ln+")*",pn="[\\ufe0e\\ufe0f]?"+ln+hn,fn="(?:"+["[\\u2700-\\u27bf]",an,sn].join("|")+")"+pn,dn="(?:"+["[^\\ud800-\\udfff]"+en+"?",en,an,sn,"[\\ud800-\\udfff]"].join("|")+")",mn=RegExp("['’]","g"),vn=RegExp(en,"g"),gn=RegExp(on+"(?="+on+")|"+dn+pn,"g"),yn=RegExp([un+"?"+nn+"+(?:['’](?:d|ll|m|re|s|t|ve))?(?="+[tn,un,"$"].join("|")+")","(?:[A-Z\\xc0-\\xd6\\xd8-\\xde]|[^\\ud800-\\udfff\\xac\\xb1\\xd7\\xf7\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf\\u2000-\\u206f \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000\\d+\\u2700-\\u27bfa-z\\xdf-\\xf6\\xf8-\\xffA-Z\\xc0-\\xd6\\xd8-\\xde])+(?:['’](?:D|LL|M|RE|S|T|VE))?(?="+[tn,un+cn,"$"].join("|")+")",un+"?"+cn+"+(?:['’](?:d|ll|m|re|s|t|ve))?",un+"+(?:['’](?:D|LL|M|RE|S|T|VE))?","\\d*(?:(?:1ST|2ND|3RD|(?![123])\\dTH)\\b)","\\d*(?:(?:1st|2nd|3rd|(?![123])\\dth)\\b)","\\d+",fn].join("|"),"g"),bn=RegExp("[\\u200d\\ud800-\\udfff"+$e+"\\ufe0e\\ufe0f]"),xn=/[a-z][A-Z]|[A-Z]{2,}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/,_n=["Array","Buffer","DataView","Date","Error","Float32Array","Float64Array","Function","Int8Array","Int16Array","Int32Array","Map","Math","Object","Promise","RegExp","Set","String","Symbol","TypeError","Uint8Array","Uint8ClampedArray","Uint16Array","Uint32Array","WeakMap","_","clearTimeout","isFinite","parseInt","setTimeout"],wn=-1,En={};En[ce]=En[le]=En[he]=En[pe]=En[fe]=En[de]=En[me]=En[ve]=En[ge]=!0,En[zt]=En[jt]=En[se]=En[Ht]=En[ue]=En[Gt]=En[Xt]=En[qt]=En[Zt]=En[Kt]=En[$t]=En[te]=En[ee]=En[ne]=En[oe]=!1;var Mn={};Mn[zt]=Mn[jt]=Mn[se]=Mn[ue]=Mn[Ht]=Mn[Gt]=Mn[ce]=Mn[le]=Mn[he]=Mn[pe]=Mn[fe]=Mn[Zt]=Mn[Kt]=Mn[$t]=Mn[te]=Mn[ee]=Mn[ne]=Mn[re]=Mn[de]=Mn[me]=Mn[ve]=Mn[ge]=!0,Mn[Xt]=Mn[qt]=Mn[oe]=!1;var Tn={"À":"A","Á":"A","Â":"A","Ã":"A","Ä":"A","Å":"A","à":"a","á":"a","â":"a","ã":"a","ä":"a","å":"a","Ç":"C","ç":"c","Ð":"D","ð":"d","È":"E","É":"E","Ê":"E","Ë":"E","è":"e","é":"e","ê":"e","ë":"e","Ì":"I","Í":"I","Î":"I","Ï":"I","ì":"i","í":"i","î":"i","ï":"i","Ñ":"N","ñ":"n","Ò":"O","Ó":"O","Ô":"O","Õ":"O","Ö":"O","Ø":"O","ò":"o","ó":"o","ô":"o","õ":"o","ö":"o","ø":"o","Ù":"U","Ú":"U","Û":"U","Ü":"U","ù":"u","ú":"u","û":"u","ü":"u","Ý":"Y","ý":"y","ÿ":"y","Æ":"Ae","æ":"ae","Þ":"Th","þ":"th","ß":"ss","Ā":"A","Ă":"A","Ą":"A","ā":"a","ă":"a","ą":"a","Ć":"C","Ĉ":"C","Ċ":"C","Č":"C","ć":"c","ĉ":"c","ċ":"c","č":"c","Ď":"D","Đ":"D","ď":"d","đ":"d","Ē":"E","Ĕ":"E","Ė":"E","Ę":"E","Ě":"E","ē":"e","ĕ":"e","ė":"e","ę":"e","ě":"e","Ĝ":"G","Ğ":"G","Ġ":"G","Ģ":"G","ĝ":"g","ğ":"g","ġ":"g","ģ":"g","Ĥ":"H","Ħ":"H","ĥ":"h","ħ":"h","Ĩ":"I","Ī":"I","Ĭ":"I","Į":"I","İ":"I","ĩ":"i","ī":"i","ĭ":"i","į":"i","ı":"i","Ĵ":"J","ĵ":"j","Ķ":"K","ķ":"k","ĸ":"k","Ĺ":"L","Ļ":"L","Ľ":"L","Ŀ":"L","Ł":"L","ĺ":"l","ļ":"l","ľ":"l","ŀ":"l","ł":"l","Ń":"N","Ņ":"N","Ň":"N","Ŋ":"N","ń":"n","ņ":"n","ň":"n","ŋ":"n","Ō":"O","Ŏ":"O","Ő":"O","ō":"o","ŏ":"o","ő":"o","Ŕ":"R","Ŗ":"R","Ř":"R","ŕ":"r","ŗ":"r","ř":"r","Ś":"S","Ŝ":"S","Ş":"S","Š":"S","ś":"s","ŝ":"s","ş":"s","š":"s","Ţ":"T","Ť":"T","Ŧ":"T","ţ":"t","ť":"t","ŧ":"t","Ũ":"U","Ū":"U","Ŭ":"U","Ů":"U","Ű":"U","Ų":"U","ũ":"u","ū":"u","ŭ":"u","ů":"u","ű":"u","ų":"u","Ŵ":"W","ŵ":"w","Ŷ":"Y","ŷ":"y","Ÿ":"Y","Ź":"Z","Ż":"Z","Ž":"Z","ź":"z","ż":"z","ž":"z","IJ":"IJ","ij":"ij","Œ":"Oe","œ":"oe","ʼn":"'n","ſ":"s"},Sn={"&":"&","<":"<",">":">",'"':""","'":"'"},An={"&":"&","<":"<",">":">",""":'"',"'":"'"},Cn={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"},Pn=parseFloat,Rn=parseInt,Ln="object"==typeof t&&t&&t.Object===Object&&t,On="object"==typeof self&&self&&self.Object===Object&&self,In=Ln||On||Function("return this")(),Nn="object"==typeof e&&e&&!e.nodeType&&e,Dn=Nn&&"object"==typeof r&&r&&!r.nodeType&&r,kn=Dn&&Dn.exports===Nn,Un=kn&&Ln.process,Fn=function(){try{return Un&&Un.binding&&Un.binding("util")}catch(t){}}(),Bn=Fn&&Fn.isArrayBuffer,zn=Fn&&Fn.isDate,jn=Fn&&Fn.isMap,Vn=Fn&&Fn.isRegExp,Hn=Fn&&Fn.isSet,Gn=Fn&&Fn.isTypedArray,Wn=C("length"),Xn=P(Tn),qn=P(Sn),Yn=P(An),Zn=function t(e){function n(t){if(ou(t)&&!vp(t)&&!(t instanceof x)){if(t instanceof i)return t;if(vl.call(t,"__wrapped__"))return na(t)}return new i(t)}function r(){}function i(t,e){this.__wrapped__=t,this.__actions__=[],this.__chain__=!!e,this.__index__=0,this.__values__=it}function x(t){this.__wrapped__=t,this.__actions__=[],this.__dir__=1,this.__filtered__=!1,this.__iteratees__=[],this.__takeCount__=kt,this.__views__=[]}function P(){var t=new x(this.__wrapped__);return t.__actions__=Ui(this.__actions__),t.__dir__=this.__dir__,t.__filtered__=this.__filtered__,t.__iteratees__=Ui(this.__iteratees__),t.__takeCount__=this.__takeCount__,t.__views__=Ui(this.__views__),t}function J(){if(this.__filtered__){var t=new x(this);t.__dir__=-1,t.__filtered__=!0}else t=this.clone(),t.__dir__*=-1;return t}function et(){var t=this.__wrapped__.value(),e=this.__dir__,n=vp(t),r=e<0,i=n?t.length:0,o=Ao(0,i,this.__views__),a=o.start,s=o.end,u=s-a,c=r?s:a-1,l=this.__iteratees__,h=l.length,p=0,f=Xl(u,this.__takeCount__);if(!n||!r&&i==u&&f==u)return yi(t,this.__actions__);var d=[];t:for(;u--&&p-1}function un(t,e){var n=this.__data__,r=Kn(n,t);return r<0?(++this.size,n.push([t,e])):n[r][1]=e,this}function cn(t){var e=-1,n=null==t?0:t.length;for(this.clear();++e=e?t:e)),t}function rr(t,e,n,r,i,o){var a,s=e&ht,u=e&pt,l=e&ft;if(n&&(a=i?n(t,r,i,o):n(t)),a!==it)return a;if(!iu(t))return t;var h=vp(t);if(h){if(a=Ro(t),!s)return Ui(t,a)}else{var p=Sh(t),f=p==qt||p==Yt;if(yp(t))return Ti(t,s);if(p==$t||p==zt||f&&!i){if(a=u||f?{}:Lo(t),!s)return u?zi(t,Qn(a,t)):Bi(t,$n(a,t))}else{if(!Mn[p])return i?t:{};a=Oo(t,p,rr,s)}}o||(o=new xn);var d=o.get(t);if(d)return d;o.set(t,a);var m=l?u?bo:yo:u?ju:zu,v=h?it:m(t);return c(v||t,function(r,i){v&&(i=r,r=t[i]),Wn(a,i,rr(r,e,n,i,t,o))}),a}function ir(t){var e=zu(t);return function(n){return or(n,t,e)}}function or(t,e,n){var r=n.length;if(null==t)return!r;for(t=sl(t);r--;){var i=n[r],o=e[i],a=t[i];if(a===it&&!(i in t)||!o(a))return!1}return!0}function ar(t,e,n){if("function"!=typeof t)throw new ll(st);return Ph(function(){t.apply(it,n)},e)}function sr(t,e,n,r){var i=-1,o=f,a=!0,s=t.length,u=[],c=e.length;if(!s)return u;n&&(e=m(e,D(n))),r?(o=d,a=!1):e.length>=ot&&(o=U,a=!1,e=new gn(e));t:for(;++ii?0:i+n),r=r===it||r>i?i:wu(r),r<0&&(r+=i),r=n>r?0:Eu(r);n0&&n(s)?e>1?pr(s,e-1,n,r,i):v(i,s):r||(i[i.length]=s)}return i}function fr(t,e){return t&&vh(t,e,zu)}function dr(t,e){return t&&gh(t,e,zu)}function mr(t,e){return p(e,function(e){return eu(t[e])})}function vr(t,e){e=Ei(e,t);for(var n=0,r=e.length;null!=t&&ne}function xr(t,e){return null!=t&&vl.call(t,e)}function _r(t,e){return null!=t&&e in sl(t)}function wr(t,e,n){return t>=Xl(e,n)&&t=120&&l.length>=120)?new gn(a&&l):it}l=t[0];var h=-1,p=s[0];t:for(;++h-1;)s!==t&&Rl.call(s,u,1),Rl.call(t,u,1);return t}function $r(t,e){for(var n=t?e.length:0,r=n-1;n--;){var i=e[n];if(n==r||i!==o){var o=i;Do(i)?Rl.call(t,i,1):mi(t,i)}}return t}function Qr(t,e){return t+Bl(Zl()*(e-t+1))}function ti(t,e,n,r){for(var i=-1,o=Wl(Fl((e-t)/(n||1)),0),a=nl(o);o--;)a[r?o:++i]=t,t+=n;return a}function ei(t,e){var n="";if(!t||e<1||e>It)return n;do{e%2&&(n+=t),(e=Bl(e/2))&&(t+=t)}while(e);return n}function ni(t,e){return Rh(qo(t,e,Rc),t+"")}function ri(t){return Nn(Qu(t))}function ii(t,e){var n=Qu(t);return $o(n,nr(e,0,n.length))}function oi(t,e,n,r){if(!iu(t))return t;e=Ei(e,t);for(var i=-1,o=e.length,a=o-1,s=t;null!=s&&++ii?0:i+e),n=n>i?i:n,n<0&&(n+=i),i=e>n?0:n-e>>>0,e>>>=0;for(var o=nl(i);++r>>1,a=t[o];null!==a&&!vu(a)&&(n?a<=e:a=ot){var c=e?null:wh(t);if(c)return Z(c);a=!1,i=U,u=new gn}else u=e?[]:s;t:for(;++r=r?t:si(t,e,n)}function Ti(t,e){if(e)return t.slice();var n=t.length,r=Sl?Sl(n):new t.constructor(n);return t.copy(r),r}function Si(t){var e=new t.constructor(t.byteLength);return new Tl(e).set(new Tl(t)),e}function Ai(t,e){var n=e?Si(t.buffer):t.buffer;return new t.constructor(n,t.byteOffset,t.byteLength)}function Ci(t,e,n){return g(e?n(X(t),ht):X(t),o,new t.constructor)}function Pi(t){var e=new t.constructor(t.source,He.exec(t));return e.lastIndex=t.lastIndex,e}function Ri(t,e,n){return g(e?n(Z(t),ht):Z(t),a,new t.constructor)}function Li(t){return hh?sl(hh.call(t)):{}}function Oi(t,e){var n=e?Si(t.buffer):t.buffer;return new t.constructor(n,t.byteOffset,t.length)}function Ii(t,e){if(t!==e){var n=t!==it,r=null===t,i=t===t,o=vu(t),a=e!==it,s=null===e,u=e===e,c=vu(e);if(!s&&!c&&!o&&t>e||o&&a&&u&&!s&&!c||r&&a&&u||!n&&u||!i)return 1;if(!r&&!o&&!c&&t=s)return u;return u*("desc"==n[r]?-1:1)}}return t.index-e.index}function Di(t,e,n,r){for(var i=-1,o=t.length,a=n.length,s=-1,u=e.length,c=Wl(o-a,0),l=nl(u+c),h=!r;++s1?n[i-1]:it,a=i>2?n[2]:it;for(o=t.length>3&&"function"==typeof o?(i--,o):it,a&&ko(n[0],n[1],a)&&(o=i<3?it:o,i=1),e=sl(e);++r-1?i[o?e[a]:a]:it}}function Ji(t){return go(function(e){var n=e.length,r=n,o=i.prototype.thru;for(t&&e.reverse();r--;){var a=e[r];if("function"!=typeof a)throw new ll(st);if(o&&!s&&"wrapper"==xo(a))var s=new i([],!0)}for(r=s?r:n;++r1&&y.reverse(),h&&us))return!1;var c=o.get(t);if(c&&o.get(e))return c==e;var l=-1,h=!0,p=n&mt?new gn:it;for(o.set(t,e),o.set(e,t);++l1?"& ":"")+e[r],e=e.join(n>2?", ":" "),t.replace(Ue,"{\n/* [wrapped with "+e+"] */\n")}function No(t){return vp(t)||mp(t)||!!(Ll&&t&&t[Ll])}function Do(t,e){return!!(e=null==e?It:e)&&("number"==typeof t||Ye.test(t))&&t>-1&&t%1==0&&t0){if(++e>=Ct)return arguments[0]}else e=0;return t.apply(it,arguments)}}function $o(t,e){var n=-1,r=t.length,i=r-1;for(e=e===it?r:e;++n=this.__values__.length;return{done:t,value:t?it:this.__values__[this.__index__++]}}function ns(){return this}function rs(t){for(var e,n=this;n instanceof r;){var i=na(n);i.__index__=0,i.__values__=it,e?o.__wrapped__=i:e=i;var o=i;n=n.__wrapped__}return o.__wrapped__=t,e}function is(){var t=this.__wrapped__;if(t instanceof x){var e=t;return this.__actions__.length&&(e=new x(this)),e=e.reverse(),e.__actions__.push({func:$a,args:[Ca],thisArg:it}),new i(e,this.__chain__)}return this.thru(Ca)}function os(){return yi(this.__wrapped__,this.__actions__)}function as(t,e,n){var r=vp(t)?h:ur;return n&&ko(t,e,n)&&(e=it),r(t,wo(e,3))}function ss(t,e){return(vp(t)?p:hr)(t,wo(e,3))}function us(t,e){return pr(ds(t,e),1)}function cs(t,e){return pr(ds(t,e),Ot)}function ls(t,e,n){return n=n===it?1:wu(n),pr(ds(t,e),n)}function hs(t,e){return(vp(t)?c:dh)(t,wo(e,3))}function ps(t,e){return(vp(t)?l:mh)(t,wo(e,3))}function fs(t,e,n,r){t=Xs(t)?t:Qu(t),n=n&&!r?wu(n):0;var i=t.length;return n<0&&(n=Wl(i+n,0)),mu(t)?n<=i&&t.indexOf(e,n)>-1:!!i&&M(t,e,n)>-1}function ds(t,e){return(vp(t)?m:jr)(t,wo(e,3))}function ms(t,e,n,r){return null==t?[]:(vp(e)||(e=null==e?[]:[e]),n=r?it:n,vp(n)||(n=null==n?[]:[n]),qr(t,e,n))}function vs(t,e,n){var r=vp(t)?g:R,i=arguments.length<3;return r(t,wo(e,4),n,i,dh)}function gs(t,e,n){var r=vp(t)?y:R,i=arguments.length<3;return r(t,wo(e,4),n,i,mh)}function ys(t,e){return(vp(t)?p:hr)(t,Os(wo(e,3)))}function bs(t){return(vp(t)?Nn:ri)(t)}function xs(t,e,n){return e=(n?ko(t,e,n):e===it)?1:wu(e),(vp(t)?Dn:ii)(t,e)}function _s(t){return(vp(t)?Un:ai)(t)}function ws(t){if(null==t)return 0;if(Xs(t))return mu(t)?Q(t):t.length;var e=Sh(t);return e==Zt||e==ee?t.size:Fr(t).length}function Es(t,e,n){var r=vp(t)?b:ui;return n&&ko(t,e,n)&&(e=it),r(t,wo(e,3))}function Ms(t,e){if("function"!=typeof e)throw new ll(st);return t=wu(t),function(){if(--t<1)return e.apply(this,arguments)}}function Ts(t,e,n){return e=n?it:e,e=t&&null==e?t.length:e,co(t,Et,it,it,it,it,e)}function Ss(t,e){var n;if("function"!=typeof e)throw new ll(st);return t=wu(t),function(){return--t>0&&(n=e.apply(this,arguments)),t<=1&&(e=it),n}}function As(t,e,n){e=n?it:e;var r=co(t,bt,it,it,it,it,it,e);return r.placeholder=As.placeholder,r}function Cs(t,e,n){e=n?it:e;var r=co(t,xt,it,it,it,it,it,e);return r.placeholder=Cs.placeholder,r}function Ps(t,e,n){function r(e){var n=p,r=f;return p=f=it,y=e,m=t.apply(r,n)}function i(t){return y=t,v=Ph(s,e),b?r(t):m}function o(t){var n=t-g,r=t-y,i=e-n;return x?Xl(i,d-r):i}function a(t){var n=t-g,r=t-y;return g===it||n>=e||n<0||x&&r>=d}function s(){var t=ip();if(a(t))return u(t);v=Ph(s,o(t))}function u(t){return v=it,_&&p?r(t):(p=f=it,m)}function c(){v!==it&&_h(v),y=0,p=g=f=v=it}function l(){return v===it?m:u(ip())}function h(){var t=ip(),n=a(t);if(p=arguments,f=this,g=t,n){if(v===it)return i(g);if(x)return v=Ph(s,e),r(g)}return v===it&&(v=Ph(s,e)),m}var p,f,d,m,v,g,y=0,b=!1,x=!1,_=!0;if("function"!=typeof t)throw new ll(st);return e=Mu(e)||0,iu(n)&&(b=!!n.leading,x="maxWait"in n,d=x?Wl(Mu(n.maxWait)||0,e):d,_="trailing"in n?!!n.trailing:_),h.cancel=c,h.flush=l,h}function Rs(t){return co(t,Tt)}function Ls(t,e){if("function"!=typeof t||null!=e&&"function"!=typeof e)throw new ll(st);var n=function(){var r=arguments,i=e?e.apply(this,r):r[0],o=n.cache;if(o.has(i))return o.get(i);var a=t.apply(this,r);return n.cache=o.set(i,a)||o,a};return n.cache=new(Ls.Cache||cn),n}function Os(t){if("function"!=typeof t)throw new ll(st);return function(){var e=arguments;switch(e.length){case 0:return!t.call(this);case 1:return!t.call(this,e[0]);case 2:return!t.call(this,e[0],e[1]);case 3:return!t.call(this,e[0],e[1],e[2])}return!t.apply(this,e)}}function Is(t){return Ss(2,t)}function Ns(t,e){if("function"!=typeof t)throw new ll(st);return e=e===it?e:wu(e),ni(t,e)}function Ds(t,e){if("function"!=typeof t)throw new ll(st);return e=null==e?0:Wl(wu(e),0),ni(function(n){var r=n[e],i=Mi(n,0,e);return r&&v(i,r),s(t,this,i)})}function ks(t,e,n){var r=!0,i=!0;if("function"!=typeof t)throw new ll(st);return iu(n)&&(r="leading"in n?!!n.leading:r,i="trailing"in n?!!n.trailing:i),Ps(t,e,{leading:r,maxWait:e,trailing:i})}function Us(t){return Ts(t,1)}function Fs(t,e){return lp(wi(e),t)}function Bs(){if(!arguments.length)return[];var t=arguments[0];return vp(t)?t:[t]}function zs(t){return rr(t,ft)}function js(t,e){return e="function"==typeof e?e:it,rr(t,ft,e)}function Vs(t){return rr(t,ht|ft)}function Hs(t,e){return e="function"==typeof e?e:it,rr(t,ht|ft,e)}function Gs(t,e){return null==e||or(t,e,zu(e))}function Ws(t,e){return t===e||t!==t&&e!==e}function Xs(t){return null!=t&&ru(t.length)&&!eu(t)}function qs(t){return ou(t)&&Xs(t)}function Ys(t){return!0===t||!1===t||ou(t)&&yr(t)==Ht}function Zs(t){return ou(t)&&1===t.nodeType&&!fu(t)}function Ks(t){if(null==t)return!0;if(Xs(t)&&(vp(t)||"string"==typeof t||"function"==typeof t.splice||yp(t)||Ep(t)||mp(t)))return!t.length;var e=Sh(t);if(e==Zt||e==ee)return!t.size;if(jo(t))return!Fr(t).length;for(var n in t)if(vl.call(t,n))return!1;return!0}function Js(t,e){return Pr(t,e)}function $s(t,e,n){n="function"==typeof n?n:it;var r=n?n(t,e):it;return r===it?Pr(t,e,it,n):!!r}function Qs(t){if(!ou(t))return!1;var e=yr(t);return e==Xt||e==Wt||"string"==typeof t.message&&"string"==typeof t.name&&!fu(t)}function tu(t){return"number"==typeof t&&Vl(t)}function eu(t){if(!iu(t))return!1;var e=yr(t);return e==qt||e==Yt||e==Vt||e==Qt}function nu(t){return"number"==typeof t&&t==wu(t)}function ru(t){return"number"==typeof t&&t>-1&&t%1==0&&t<=It}function iu(t){var e=typeof t;return null!=t&&("object"==e||"function"==e)}function ou(t){return null!=t&&"object"==typeof t}function au(t,e){return t===e||Or(t,e,Mo(e))}function su(t,e,n){return n="function"==typeof n?n:it,Or(t,e,Mo(e),n)}function uu(t){return pu(t)&&t!=+t}function cu(t){if(Ah(t))throw new il(at);return Ir(t)}function lu(t){return null===t}function hu(t){return null==t}function pu(t){return"number"==typeof t||ou(t)&&yr(t)==Kt}function fu(t){if(!ou(t)||yr(t)!=$t)return!1;var e=Al(t);if(null===e)return!0;var n=vl.call(e,"constructor")&&e.constructor;return"function"==typeof n&&n instanceof n&&ml.call(n)==xl}function du(t){return nu(t)&&t>=-It&&t<=It}function mu(t){return"string"==typeof t||!vp(t)&&ou(t)&&yr(t)==ne}function vu(t){return"symbol"==typeof t||ou(t)&&yr(t)==re}function gu(t){return t===it}function yu(t){return ou(t)&&Sh(t)==oe}function bu(t){return ou(t)&&yr(t)==ae}function xu(t){if(!t)return[];if(Xs(t))return mu(t)?tt(t):Ui(t);if(Ol&&t[Ol])return W(t[Ol]());var e=Sh(t);return(e==Zt?X:e==ee?Z:Qu)(t)}function _u(t){if(!t)return 0===t?t:0;if((t=Mu(t))===Ot||t===-Ot){return(t<0?-1:1)*Nt}return t===t?t:0}function wu(t){var e=_u(t),n=e%1;return e===e?n?e-n:e:0}function Eu(t){return t?nr(wu(t),0,kt):0}function Mu(t){if("number"==typeof t)return t;if(vu(t))return Dt;if(iu(t)){var e="function"==typeof t.valueOf?t.valueOf():t;t=iu(e)?e+"":e}if("string"!=typeof t)return 0===t?t:+t;t=t.replace(Ne,"");var n=We.test(t);return n||qe.test(t)?Rn(t.slice(2),n?2:8):Ge.test(t)?Dt:+t}function Tu(t){return Fi(t,ju(t))}function Su(t){return t?nr(wu(t),-It,It):0===t?t:0}function Au(t){return null==t?"":fi(t)}function Cu(t,e){var n=fh(t);return null==e?n:$n(n,e)}function Pu(t,e){return w(t,wo(e,3),fr)}function Ru(t,e){return w(t,wo(e,3),dr)}function Lu(t,e){return null==t?t:vh(t,wo(e,3),ju)}function Ou(t,e){return null==t?t:gh(t,wo(e,3),ju)}function Iu(t,e){return t&&fr(t,wo(e,3))}function Nu(t,e){return t&&dr(t,wo(e,3))}function Du(t){return null==t?[]:mr(t,zu(t))}function ku(t){return null==t?[]:mr(t,ju(t))}function Uu(t,e,n){var r=null==t?it:vr(t,e);return r===it?n:r}function Fu(t,e){return null!=t&&Po(t,e,xr)}function Bu(t,e){return null!=t&&Po(t,e,_r)}function zu(t){return Xs(t)?On(t):Fr(t)}function ju(t){return Xs(t)?On(t,!0):Br(t)}function Vu(t,e){var n={};return e=wo(e,3),fr(t,function(t,r,i){tr(n,e(t,r,i),t)}),n}function Hu(t,e){var n={};return e=wo(e,3),fr(t,function(t,r,i){tr(n,r,e(t,r,i))}),n}function Gu(t,e){return Wu(t,Os(wo(e)))}function Wu(t,e){if(null==t)return{};var n=m(bo(t),function(t){return[t]});return e=wo(e),Zr(t,n,function(t,n){return e(t,n[0])})}function Xu(t,e,n){e=Ei(e,t);var r=-1,i=e.length;for(i||(i=1,t=it);++re){var r=t;t=e,e=r}if(n||t%1||e%1){var i=Zl();return Xl(t+i*(e-t+Pn("1e-"+((i+"").length-1))),e)}return Qr(t,e)}function ic(t){return Zp(Au(t).toLowerCase())}function oc(t){return(t=Au(t))&&t.replace(Ze,Xn).replace(vn,"")}function ac(t,e,n){t=Au(t),e=fi(e);var r=t.length;n=n===it?r:nr(wu(n),0,r);var i=n;return(n-=e.length)>=0&&t.slice(n,i)==e}function sc(t){return t=Au(t),t&&Me.test(t)?t.replace(we,qn):t}function uc(t){return t=Au(t),t&&Ie.test(t)?t.replace(Oe,"\\$&"):t}function cc(t,e,n){t=Au(t),e=wu(e);var r=e?Q(t):0;if(!e||r>=e)return t;var i=(e-r)/2;return no(Bl(i),n)+t+no(Fl(i),n)}function lc(t,e,n){t=Au(t),e=wu(e);var r=e?Q(t):0;return e&&r>>0)?(t=Au(t),t&&("string"==typeof e||null!=e&&!_p(e))&&!(e=fi(e))&&H(t)?Mi(tt(t),0,n):t.split(e,n)):[]}function vc(t,e,n){return t=Au(t),n=null==n?0:nr(wu(n),0,t.length),e=fi(e),t.slice(n,n+e.length)==e}function gc(t,e,r){var i=n.templateSettings;r&&ko(t,e,r)&&(e=it),t=Au(t),e=Cp({},e,i,lo);var o,a,s=Cp({},e.imports,i.imports,lo),u=zu(s),c=k(s,u),l=0,h=e.interpolate||Ke,p="__p += '",f=ul((e.escape||Ke).source+"|"+h.source+"|"+(h===Ae?Ve:Ke).source+"|"+(e.evaluate||Ke).source+"|$","g"),d="//# sourceURL="+("sourceURL"in e?e.sourceURL:"lodash.templateSources["+ ++wn+"]")+"\n";t.replace(f,function(e,n,r,i,s,u){return r||(r=i),p+=t.slice(l,u).replace(Je,j),n&&(o=!0,p+="' +\n__e("+n+") +\n'"),s&&(a=!0,p+="';\n"+s+";\n__p += '"),r&&(p+="' +\n((__t = ("+r+")) == null ? '' : __t) +\n'"),l=u+e.length,e}),p+="';\n";var m=e.variable;m||(p="with (obj) {\n"+p+"\n}\n"),p=(a?p.replace(ye,""):p).replace(be,"$1").replace(xe,"$1;"),p="function("+(m||"obj")+") {\n"+(m?"":"obj || (obj = {});\n")+"var __t, __p = ''"+(o?", __e = _.escape":"")+(a?", __j = Array.prototype.join;\nfunction print() { __p += __j.call(arguments, '') }\n":";\n")+p+"return __p\n}";var v=Kp(function(){return ol(u,d+"return "+p).apply(it,c)});if(v.source=p,Qs(v))throw v;return v}function yc(t){return Au(t).toLowerCase()}function bc(t){return Au(t).toUpperCase()}function xc(t,e,n){if((t=Au(t))&&(n||e===it))return t.replace(Ne,"");if(!t||!(e=fi(e)))return t;var r=tt(t),i=tt(e);return Mi(r,F(r,i),B(r,i)+1).join("")}function _c(t,e,n){if((t=Au(t))&&(n||e===it))return t.replace(ke,"");if(!t||!(e=fi(e)))return t;var r=tt(t);return Mi(r,0,B(r,tt(e))+1).join("")}function wc(t,e,n){if((t=Au(t))&&(n||e===it))return t.replace(De,"");if(!t||!(e=fi(e)))return t;var r=tt(t);return Mi(r,F(r,tt(e))).join("")}function Ec(t,e){var n=St,r=At;if(iu(e)){var i="separator"in e?e.separator:i;n="length"in e?wu(e.length):n,r="omission"in e?fi(e.omission):r}t=Au(t);var o=t.length;if(H(t)){var a=tt(t);o=a.length}if(n>=o)return t;var s=n-Q(r);if(s<1)return r;var u=a?Mi(a,0,s).join(""):t.slice(0,s);if(i===it)return u+r;if(a&&(s+=u.length-s),_p(i)){if(t.slice(s).search(i)){var c,l=u;for(i.global||(i=ul(i.source,Au(He.exec(i))+"g")),i.lastIndex=0;c=i.exec(l);)var h=c.index;u=u.slice(0,h===it?s:h)}}else if(t.indexOf(fi(i),s)!=s){var p=u.lastIndexOf(i);p>-1&&(u=u.slice(0,p))}return u+r}function Mc(t){return t=Au(t),t&&Ee.test(t)?t.replace(_e,Yn):t}function Tc(t,e,n){return t=Au(t),e=n?it:e,e===it?G(t)?rt(t):_(t):t.match(e)||[]}function Sc(t){var e=null==t?0:t.length,n=wo();return t=e?m(t,function(t){if("function"!=typeof t[1])throw new ll(st);return[n(t[0]),t[1]]}):[],ni(function(n){for(var r=-1;++rIt)return[];var n=kt,r=Xl(t,kt);e=wo(e),t-=kt;for(var i=I(r,e);++n1?t[e-1]:it;return n="function"==typeof n?(t.pop(),n):it,qa(t,n)}),Zh=go(function(t){var e=t.length,n=e?t[0]:0,r=this.__wrapped__,o=function(e){return er(e,t)};return!(e>1||this.__actions__.length)&&r instanceof x&&Do(n)?(r=r.slice(n,+n+(e?1:0)),r.__actions__.push({func:$a,args:[o],thisArg:it}),new i(r,this.__chain__).thru(function(t){return e&&!t.length&&t.push(it),t})):this.thru(o)}),Kh=ji(function(t,e,n){vl.call(t,n)?++t[n]:tr(t,n,1)}),Jh=Ki(ha),$h=Ki(pa),Qh=ji(function(t,e,n){vl.call(t,n)?t[n].push(e):tr(t,n,[e])}),tp=ni(function(t,e,n){var r=-1,i="function"==typeof e,o=Xs(t)?nl(t.length):[];return dh(t,function(t){o[++r]=i?s(e,t,n):Tr(t,e,n)}),o}),ep=ji(function(t,e,n){tr(t,n,e)}),np=ji(function(t,e,n){t[n?0:1].push(e)},function(){return[[],[]]}),rp=ni(function(t,e){if(null==t)return[];var n=e.length;return n>1&&ko(t,e[0],e[1])?e=[]:n>2&&ko(e[0],e[1],e[2])&&(e=[e[0]]),qr(t,pr(e,1),[])}),ip=kl||function(){return In.Date.now()},op=ni(function(t,e,n){var r=vt;if(n.length){var i=Y(n,_o(op));r|=_t}return co(t,r,e,n,i)}),ap=ni(function(t,e,n){var r=vt|gt;if(n.length){var i=Y(n,_o(ap));r|=_t}return co(e,r,t,n,i)}),sp=ni(function(t,e){return ar(t,1,e)}),up=ni(function(t,e,n){return ar(t,Mu(e)||0,n)});Ls.Cache=cn;var cp=xh(function(t,e){e=1==e.length&&vp(e[0])?m(e[0],D(wo())):m(pr(e,1),D(wo()));var n=e.length;return ni(function(r){for(var i=-1,o=Xl(r.length,n);++i=e}),mp=Sr(function(){return arguments}())?Sr:function(t){return ou(t)&&vl.call(t,"callee")&&!Pl.call(t,"callee")},vp=nl.isArray,gp=Bn?D(Bn):Ar,yp=jl||jc,bp=zn?D(zn):Cr,xp=jn?D(jn):Lr,_p=Vn?D(Vn):Nr,wp=Hn?D(Hn):Dr,Ep=Gn?D(Gn):kr,Mp=oo(zr),Tp=oo(function(t,e){return t<=e}),Sp=Vi(function(t,e){if(jo(e)||Xs(e))return void Fi(e,zu(e),t);for(var n in e)vl.call(e,n)&&Wn(t,n,e[n])}),Ap=Vi(function(t,e){Fi(e,ju(e),t)}),Cp=Vi(function(t,e,n,r){Fi(e,ju(e),t,r)}),Pp=Vi(function(t,e,n,r){Fi(e,zu(e),t,r)}),Rp=go(er),Lp=ni(function(t){return t.push(it,lo),s(Cp,it,t)}),Op=ni(function(t){return t.push(it,ho),s(Up,it,t)}),Ip=Qi(function(t,e,n){t[e]=n},Cc(Rc)),Np=Qi(function(t,e,n){vl.call(t,e)?t[e].push(n):t[e]=[n]},wo),Dp=ni(Tr),kp=Vi(function(t,e,n){Gr(t,e,n)}),Up=Vi(function(t,e,n,r){Gr(t,e,n,r)}),Fp=go(function(t,e){var n={};if(null==t)return n;var r=!1;e=m(e,function(e){return e=Ei(e,t),r||(r=e.length>1),e}),Fi(t,bo(t),n),r&&(n=rr(n,ht|pt|ft,po));for(var i=e.length;i--;)mi(n,e[i]);return n}),Bp=go(function(t,e){return null==t?{}:Yr(t,e)}),zp=uo(zu),jp=uo(ju),Vp=qi(function(t,e,n){return e=e.toLowerCase(),t+(n?ic(e):e)}),Hp=qi(function(t,e,n){return t+(n?"-":"")+e.toLowerCase()}),Gp=qi(function(t,e,n){return t+(n?" ":"")+e.toLowerCase()}),Wp=Xi("toLowerCase"),Xp=qi(function(t,e,n){return t+(n?"_":"")+e.toLowerCase()}),qp=qi(function(t,e,n){return t+(n?" ":"")+Zp(e)}),Yp=qi(function(t,e,n){return t+(n?" ":"")+e.toUpperCase()}),Zp=Xi("toUpperCase"),Kp=ni(function(t,e){try{return s(t,it,e)}catch(t){return Qs(t)?t:new il(t)}}),Jp=go(function(t,e){return c(e,function(e){e=Qo(e),tr(t,e,op(t[e],t))}),t}),$p=Ji(),Qp=Ji(!0),tf=ni(function(t,e){return function(n){return Tr(n,t,e)}}),ef=ni(function(t,e){return function(n){return Tr(t,n,e)}}),nf=eo(m),rf=eo(h),of=eo(b),af=io(),sf=io(!0),uf=to(function(t,e){return t+e},0),cf=so("ceil"),lf=to(function(t,e){return t/e},1),hf=so("floor"),pf=to(function(t,e){return t*e},1),ff=so("round"),df=to(function(t,e){return t-e},0);return n.after=Ms,n.ary=Ts,n.assign=Sp,n.assignIn=Ap,n.assignInWith=Cp,n.assignWith=Pp,n.at=Rp,n.before=Ss,n.bind=op,n.bindAll=Jp,n.bindKey=ap,n.castArray=Bs,n.chain=Ka,n.chunk=ra,n.compact=ia,n.concat=oa,n.cond=Sc,n.conforms=Ac,n.constant=Cc,n.countBy=Kh,n.create=Cu,n.curry=As,n.curryRight=Cs,n.debounce=Ps,n.defaults=Lp,n.defaultsDeep=Op,n.defer=sp,n.delay=up,n.difference=Oh,n.differenceBy=Ih,n.differenceWith=Nh,n.drop=aa,n.dropRight=sa,n.dropRightWhile=ua,n.dropWhile=ca,n.fill=la,n.filter=ss,n.flatMap=us,n.flatMapDeep=cs,n.flatMapDepth=ls,n.flatten=fa,n.flattenDeep=da,n.flattenDepth=ma,n.flip=Rs,n.flow=$p,n.flowRight=Qp,n.fromPairs=va,n.functions=Du,n.functionsIn=ku,n.groupBy=Qh,n.initial=ba,n.intersection=Dh,n.intersectionBy=kh,n.intersectionWith=Uh,n.invert=Ip,n.invertBy=Np,n.invokeMap=tp,n.iteratee=Lc,n.keyBy=ep,n.keys=zu,n.keysIn=ju,n.map=ds,n.mapKeys=Vu,n.mapValues=Hu,n.matches=Oc,n.matchesProperty=Ic,n.memoize=Ls,n.merge=kp,n.mergeWith=Up,n.method=tf,n.methodOf=ef,n.mixin=Nc,n.negate=Os,n.nthArg=Uc,n.omit=Fp,n.omitBy=Gu,n.once=Is,n.orderBy=ms,n.over=nf,n.overArgs=cp,n.overEvery=rf,n.overSome=of,n.partial=lp,n.partialRight=hp,n.partition=np,n.pick=Bp,n.pickBy=Wu,n.property=Fc,n.propertyOf=Bc,n.pull=Fh,n.pullAll=Ma,n.pullAllBy=Ta,n.pullAllWith=Sa,n.pullAt=Bh,n.range=af,n.rangeRight=sf,n.rearg=pp,n.reject=ys,n.remove=Aa,n.rest=Ns,n.reverse=Ca,n.sampleSize=xs,n.set=qu,n.setWith=Yu,n.shuffle=_s,n.slice=Pa,n.sortBy=rp,n.sortedUniq=ka,n.sortedUniqBy=Ua,n.split=mc,n.spread=Ds,n.tail=Fa,n.take=Ba,n.takeRight=za,n.takeRightWhile=ja,n.takeWhile=Va,n.tap=Ja,n.throttle=ks,n.thru=$a,n.toArray=xu,n.toPairs=zp,n.toPairsIn=jp,n.toPath=Xc,n.toPlainObject=Tu,n.transform=Zu,n.unary=Us,n.union=zh,n.unionBy=jh,n.unionWith=Vh,n.uniq=Ha,n.uniqBy=Ga,n.uniqWith=Wa,n.unset=Ku,n.unzip=Xa,n.unzipWith=qa,n.update=Ju,n.updateWith=$u,n.values=Qu,n.valuesIn=tc,n.without=Hh,n.words=Tc,n.wrap=Fs,n.xor=Gh,n.xorBy=Wh,n.xorWith=Xh,n.zip=qh,n.zipObject=Ya,n.zipObjectDeep=Za,n.zipWith=Yh,n.entries=zp,n.entriesIn=jp,n.extend=Ap,n.extendWith=Cp,Nc(n,n),n.add=uf,n.attempt=Kp,n.camelCase=Vp,n.capitalize=ic,n.ceil=cf,n.clamp=ec,n.clone=zs,n.cloneDeep=Vs,n.cloneDeepWith=Hs,n.cloneWith=js,n.conformsTo=Gs,n.deburr=oc,n.defaultTo=Pc,n.divide=lf,n.endsWith=ac,n.eq=Ws,n.escape=sc,n.escapeRegExp=uc,n.every=as,n.find=Jh,n.findIndex=ha,n.findKey=Pu,n.findLast=$h,n.findLastIndex=pa,n.findLastKey=Ru,n.floor=hf,n.forEach=hs,n.forEachRight=ps,n.forIn=Lu,n.forInRight=Ou,n.forOwn=Iu,n.forOwnRight=Nu,n.get=Uu,n.gt=fp,n.gte=dp,n.has=Fu,n.hasIn=Bu,n.head=ga,n.identity=Rc,n.includes=fs,n.indexOf=ya,n.inRange=nc,n.invoke=Dp,n.isArguments=mp,n.isArray=vp,n.isArrayBuffer=gp,n.isArrayLike=Xs,n.isArrayLikeObject=qs,n.isBoolean=Ys,n.isBuffer=yp,n.isDate=bp,n.isElement=Zs,n.isEmpty=Ks,n.isEqual=Js,n.isEqualWith=$s,n.isError=Qs,n.isFinite=tu,n.isFunction=eu,n.isInteger=nu,n.isLength=ru,n.isMap=xp,n.isMatch=au,n.isMatchWith=su,n.isNaN=uu,n.isNative=cu,n.isNil=hu,n.isNull=lu,n.isNumber=pu,n.isObject=iu,n.isObjectLike=ou,n.isPlainObject=fu,n.isRegExp=_p,n.isSafeInteger=du,n.isSet=wp,n.isString=mu,n.isSymbol=vu,n.isTypedArray=Ep,n.isUndefined=gu,n.isWeakMap=yu,n.isWeakSet=bu,n.join=xa,n.kebabCase=Hp,n.last=_a,n.lastIndexOf=wa,n.lowerCase=Gp,n.lowerFirst=Wp,n.lt=Mp,n.lte=Tp,n.max=Yc,n.maxBy=Zc,n.mean=Kc,n.meanBy=Jc,n.min=$c,n.minBy=Qc,n.stubArray=zc,n.stubFalse=jc,n.stubObject=Vc,n.stubString=Hc,n.stubTrue=Gc,n.multiply=pf,n.nth=Ea,n.noConflict=Dc,n.noop=kc,n.now=ip,n.pad=cc,n.padEnd=lc,n.padStart=hc,n.parseInt=pc,n.random=rc,n.reduce=vs,n.reduceRight=gs,n.repeat=fc,n.replace=dc,n.result=Xu,n.round=ff,n.runInContext=t,n.sample=bs,n.size=ws,n.snakeCase=Xp,n.some=Es,n.sortedIndex=Ra,n.sortedIndexBy=La,n.sortedIndexOf=Oa,n.sortedLastIndex=Ia,n.sortedLastIndexBy=Na,n.sortedLastIndexOf=Da,n.startCase=qp,n.startsWith=vc,n.subtract=df,n.sum=tl,n.sumBy=el,n.template=gc,n.times=Wc,n.toFinite=_u,n.toInteger=wu,n.toLength=Eu,n.toLower=yc,n.toNumber=Mu,n.toSafeInteger=Su,n.toString=Au,n.toUpper=bc,n.trim=xc,n.trimEnd=_c,n.trimStart=wc,n.truncate=Ec,n.unescape=Mc,n.uniqueId=qc,n.upperCase=Yp,n.upperFirst=Zp,n.each=hs,n.eachRight=ps,n.first=ga,Nc(n,function(){var t={};return fr(n,function(e,r){vl.call(n.prototype,r)||(t[r]=e)}),t}(),{chain:!1}),n.VERSION="4.17.4",c(["bind","bindKey","curry","curryRight","partial","partialRight"],function(t){n[t].placeholder=n}),c(["drop","take"],function(t,e){x.prototype[t]=function(n){n=n===it?1:Wl(wu(n),0);var r=this.__filtered__&&!e?new x(this):this.clone();return r.__filtered__?r.__takeCount__=Xl(n,r.__takeCount__):r.__views__.push({size:Xl(n,kt),type:t+(r.__dir__<0?"Right":"")}),r},x.prototype[t+"Right"]=function(e){return this.reverse()[t](e).reverse()}}),c(["filter","map","takeWhile"],function(t,e){var n=e+1,r=n==Rt||3==n;x.prototype[t]=function(t){var e=this.clone();return e.__iteratees__.push({iteratee:wo(t,3),type:n}),e.__filtered__=e.__filtered__||r,e}}),c(["head","last"],function(t,e){var n="take"+(e?"Right":"");x.prototype[t]=function(){return this[n](1).value()[0]}}),c(["initial","tail"],function(t,e){var n="drop"+(e?"":"Right");x.prototype[t]=function(){return this.__filtered__?new x(this):this[n](1)}}),x.prototype.compact=function(){return this.filter(Rc)},x.prototype.find=function(t){return this.filter(t).head()},x.prototype.findLast=function(t){return this.reverse().find(t)},x.prototype.invokeMap=ni(function(t,e){return"function"==typeof t?new x(this):this.map(function(n){return Tr(n,t,e)})}),x.prototype.reject=function(t){return this.filter(Os(wo(t)))},x.prototype.slice=function(t,e){t=wu(t);var n=this;return n.__filtered__&&(t>0||e<0)?new x(n):(t<0?n=n.takeRight(-t):t&&(n=n.drop(t)),e!==it&&(e=wu(e),n=e<0?n.dropRight(-e):n.take(e-t)),n)},x.prototype.takeRightWhile=function(t){return this.reverse().takeWhile(t).reverse()},x.prototype.toArray=function(){return this.take(kt)},fr(x.prototype,function(t,e){var r=/^(?:filter|find|map|reject)|While$/.test(e),o=/^(?:head|last)$/.test(e),a=n[o?"take"+("last"==e?"Right":""):e],s=o||/^find/.test(e);a&&(n.prototype[e]=function(){var e=this.__wrapped__,u=o?[1]:arguments,c=e instanceof x,l=u[0],h=c||vp(e),p=function(t){var e=a.apply(n,v([t],u));return o&&f?e[0]:e};h&&r&&"function"==typeof l&&1!=l.length&&(c=h=!1);var f=this.__chain__,d=!!this.__actions__.length,m=s&&!f,g=c&&!d;if(!s&&h){e=g?e:new x(this);var y=t.apply(e,u);return y.__actions__.push({func:$a,args:[p],thisArg:it}),new i(y,f)}return m&&g?t.apply(this,u):(y=this.thru(p),m?o?y.value()[0]:y.value():y)})}),c(["pop","push","shift","sort","splice","unshift"],function(t){var e=hl[t],r=/^(?:push|sort|unshift)$/.test(t)?"tap":"thru",i=/^(?:pop|shift)$/.test(t);n.prototype[t]=function(){var t=arguments;if(i&&!this.__chain__){var n=this.value();return e.apply(vp(n)?n:[],t)}return this[r](function(n){return e.apply(vp(n)?n:[],t)})}}),fr(x.prototype,function(t,e){var r=n[e];if(r){var i=r.name+"";(ih[i]||(ih[i]=[])).push({name:e,func:r})}}),ih[$i(it,gt).name]=[{name:"wrapper",func:it}],x.prototype.clone=P,x.prototype.reverse=J,x.prototype.value=et,n.prototype.at=Zh,n.prototype.chain=Qa,n.prototype.commit=ts,n.prototype.next=es,n.prototype.plant=rs,n.prototype.reverse=is,n.prototype.toJSON=n.prototype.valueOf=n.prototype.value=os,n.prototype.first=n.prototype.head,Ol&&(n.prototype[Ol]=ns),n}();In._=Zn,(i=function(){return Zn}.call(e,n,e,r))!==it&&(r.exports=i)}).call(this)}).call(e,n(144),n(340)(t))},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),function(t,r){function i(t,e){function n(){this.constructor=t}We(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}function o(t){return t.interceptors&&t.interceptors.length>0}function a(t,e){var n=t.interceptors||(t.interceptors=[]);return n.push(e),Et(function(){var t=n.indexOf(e);-1!==t&&n.splice(t,1)})}function s(t,e){var n=he();try{var r=t.interceptors;if(r)for(var i=0,o=r.length;i0}function c(t,e){var n=t.changeListeners||(t.changeListeners=[]);return n.push(e),Et(function(){var t=n.indexOf(e);-1!==t&&n.splice(t,1)})}function l(t,e){var n=he(),r=t.changeListeners;if(r){r=r.slice();for(var i=0,o=r.length;i=this.length,value:e0,"actions should have valid names, got: '"+t+"'");var n=function(){return T(t,e,this,arguments)};return n.originalFn=e,n.isMobxAction=!0,n}function T(t,e,n,r){var i=S(t,e,n,r);try{return e.apply(n,r)}finally{A(i)}}function S(t,e,n,r){var i=h()&&!!t,o=0;if(i){o=Date.now();var a=r&&r.length||0,s=new Array(a);if(a>0)for(var u=0;u",i="function"==typeof t?t:e,o="function"==typeof t?e:n;return _t("function"==typeof i,E("m002")),_t(0===i.length,E("m003")),_t("string"==typeof r&&r.length>0,"actions should have valid names, got: '"+r+"'"),T(r,i,o,void 0)}function B(t){return"function"==typeof t&&!0===t.isMobxAction}function z(t,e,n){var r=function(){return T(e,n,t,arguments)};r.isMobxAction=!0,Lt(t,e,r)}function j(t,e,n){function r(){o(s)}var i,o,a;"string"==typeof t?(i=t,o=e,a=n):(i=t.name||"Autorun@"+bt(),o=t,a=e),_t("function"==typeof o,E("m004")),_t(!1===B(o),E("m005")),a&&(o=o.bind(a));var s=new Un(i,function(){this.track(r)});return s.schedule(),s.getDisposer()}function V(t,e,n,r){var i,o,a,s;return"string"==typeof t?(i=t,o=e,a=n,s=r):(i="When@"+bt(),o=t,a=e,s=n),j(i,function(t){if(o.call(s)){t.dispose();var e=he();a.call(s),pe(e)}})}function H(t,e,n,r){function i(){a(l)}var o,a,s,u;"string"==typeof t?(o=t,a=e,s=n,u=r):(o=t.name||"AutorunAsync@"+bt(),a=t,s=e,u=n),_t(!1===B(a),E("m006")),void 0===s&&(s=1),u&&(a=a.bind(u));var c=!1,l=new Un(o,function(){c||(c=!0,setTimeout(function(){c=!1,l.isDisposed||l.track(i)},s))});return l.schedule(),l.getDisposer()}function G(t,e,n){function r(){if(!u.isDisposed){var n=!1;u.track(function(){var e=t(u);n=Pt(i.compareStructural,o,e),o=e}),a&&i.fireImmediately&&e(o,u),a||!0!==n||e(o,u),a&&(a=!1)}}arguments.length>3&&xt(E("m007")),ut(t)&&xt(E("m008"));var i;i="object"==typeof n?n:{},i.name=i.name||t.name||e.name||"Reaction@"+bt(),i.fireImmediately=!0===n||!0===i.fireImmediately,i.delay=i.delay||0,i.compareStructural=i.compareStructural||i.struct||!1,e=hn(i.name,i.context?e.bind(i.context):e),i.context&&(t=t.bind(i.context));var o,a=!0,s=!1,u=new Un(i.name,function(){a||i.delay<1?r():s||(s=!0,setTimeout(function(){s=!1,r()},i.delay))});return u.schedule(),u.getDisposer()}function W(t,e){if(tt(t))return t.$mobx;_t(Object.isExtensible(t),E("m035")),At(t)||(e=(t.constructor.name||"ObservableObject")+"@"+bt()),e||(e="ObservableObject@"+bt());var n=new dn(t,e);return Ot(t,"$mobx",n),n}function X(t,e,n,r){if(t.values[e])return _t("value"in n,"The property "+e+" in "+t.name+" is already observable, cannot redefine it as computed property"),void(t.target[e]=n.value);if("value"in n)if(ut(n.value)){var i=n.value;q(t,e,i.initialValue,i.enhancer)}else B(n.value)&&!0===n.value.autoBind?z(t.target,e,n.value.originalFn):fn(n.value)?Z(t,e,n.value):q(t,e,n.value,r);else Y(t,e,n.get,n.set,!1,!0)}function q(t,e,n,r){if(Nt(t.target,e),o(t)){var i=s(t,{object:t.target,name:e,type:"add",newValue:n});if(!i)return;n=i.newValue}n=(t.values[e]=new an(n,r,t.name+"."+e,!1)).value,Object.defineProperty(t.target,e,K(e)),Q(t,t.target,e,n)}function Y(t,e,n,r,i,o){o&&Nt(t.target,e),t.values[e]=new pn(n,t.target,i,t.name+"."+e,r),o&&Object.defineProperty(t.target,e,J(e))}function Z(t,e,n){var r=t.name+"."+e;n.name=r,n.scope||(n.scope=t.target),t.values[e]=n,Object.defineProperty(t.target,e,J(e))}function K(t){return mn[t]||(mn[t]={configurable:!0,enumerable:!0,get:function(){return this.$mobx.values[t].get()},set:function(e){$(this,t,e)}})}function J(t){return vn[t]||(vn[t]={configurable:!0,enumerable:!1,get:function(){return this.$mobx.values[t].get()},set:function(e){return this.$mobx.values[t].set(e)}})}function $(t,e,n){var r=t.$mobx,i=r.values[e];if(o(r)){var a=s(r,{type:"update",object:t,name:e,newValue:n});if(!a)return;n=a.newValue}if((n=i.prepareNewValue(n))!==on){var c=u(r),p=h(),a=c||p?{type:"update",object:t,oldValue:i.value,name:e,newValue:n}:null;p&&f(a),i.setNewValue(n),c&&l(r,a),p&&d()}}function Q(t,e,n,r){var i=u(t),o=h(),a=i||o?{type:"add",object:e,name:n,newValue:r}:null;o&&f(a),i&&l(t,a),o&&d()}function tt(t){return!!St(t)&&(D(t),gn(t.$mobx))}function et(t,e){if(null===t||void 0===t)return!1;if(void 0!==e){if(w(t)||An(t))throw new Error(E("m019"));if(tt(t)){var n=t.$mobx;return n.values&&!!n.values[e]}return!1}return tt(t)||!!t.$mobx||Ye(t)||zn(t)||fn(t)}function nt(t){return _t(!!t,":("),I(function(e,n,r,i,o){Nt(e,n),_t(!o||!o.get,E("m022")),q(W(e,void 0),n,r,t)},function(t){var e=this.$mobx.values[t];if(void 0!==e)return e.get()},function(t,e){$(this,t,e)},!0,!1)}function rt(t){for(var e=[],n=1;n=2,E("m014")),_t("object"==typeof t,E("m015")),_t(!An(t),E("m016")),n.forEach(function(t){_t("object"==typeof t,E("m017")),_t(!et(t),E("m018"))});for(var r=W(t),i={},o=n.length-1;o>=0;o--){var a=n[o];for(var s in a)if(!0!==i[s]&&Rt(a,s)){if(i[s]=!0,t===a&&!It(t,s))continue;var u=Object.getOwnPropertyDescriptor(a,s);X(r,s,u,e)}}return t}function at(t){if(void 0===t&&(t=void 0),"string"==typeof arguments[1])return yn.apply(null,arguments);if(_t(arguments.length<=1,E("m021")),_t(!ut(t),E("m020")),et(t))return t;var e=lt(t,void 0,void 0);return e!==t?e:Mn.box(t)}function st(t){xt("Expected one or two arguments to observable."+t+". Did you accidentally try to use observable."+t+" as decorator?")}function ut(t){return"object"==typeof t&&null!==t&&!0===t.isMobxModifierDescriptor}function ct(t,e){return _t(!ut(e),"Modifiers cannot be nested"),{isMobxModifierDescriptor:!0,initialValue:e,enhancer:t}}function lt(t,e,n){return ut(t)&&xt("You tried to assign a modifier wrapped value to a collection, please define modifiers when creating the collection, not when modifying it"),et(t)?t:Array.isArray(t)?Mn.array(t,n):At(t)?Mn.object(t,n):zt(t)?Mn.map(t,n):t}function ht(t,e,n){return ut(t)&&xt("You tried to assign a modifier wrapped value to a collection, please define modifiers when creating the collection, not when modifying it"),void 0===t||null===t?t:tt(t)||w(t)||An(t)?t:Array.isArray(t)?Mn.shallowArray(t,n):At(t)?Mn.shallowObject(t,n):zt(t)?Mn.shallowMap(t,n):xt("The shallow modifier / decorator can only used in combination with arrays, objects and maps")}function pt(t){return t}function ft(t,e,n){if(kt(t,e))return e;if(et(t))return t;if(Array.isArray(t))return new en(t,ft,n);if(zt(t))return new Sn(t,ft,n);if(At(t)){var r={};return W(r,n),ot(r,ft,[t]),r}return t}function dt(t,e,n){return kt(t,e)?e:t}function mt(t,e){return void 0===e&&(e=void 0),wt(E("m023")),vt.apply(void 0,arguments)}function vt(t,e){return void 0===e&&(e=void 0),T("",t)}function gt(t){return wt("`mobx.map` is deprecated, use `new ObservableMap` or `mobx.observable.map` instead"),Mn.map(t)}function yt(){return t}function bt(){return++Dn.mobxGuid}function xt(t,e){throw _t(!1,t,e),"X"}function _t(t,e,n){if(!t)throw new Error("[mobx] Invariant failed: "+e+(n?" in '"+n+"'":""))}function wt(t){return-1===Rn.indexOf(t)&&(Rn.push(t),console.error("[mobx] Deprecated: "+t),!0)}function Et(t){var e=!1;return function(){if(!e)return e=!0,t.apply(this,arguments)}}function Mt(t){var e=[];return t.forEach(function(t){-1===e.indexOf(t)&&e.push(t)}),e}function Tt(t,e,n){return void 0===e&&(e=100),void 0===n&&(n=" - "),t?t.slice(0,e).join(n)+(t.length>e?" (... and "+(t.length-e)+"more)":""):""}function St(t){return null!==t&&"object"==typeof t}function At(t){if(null===t||"object"!=typeof t)return!1;var e=Object.getPrototypeOf(t);return e===Object.prototype||null===e}function Ct(){for(var t=arguments[0],e=1,n=arguments.length;e=0;i--)if(!kt(t[i],e[i]))return!1;return!0}if(r){if(t.size!==e.size)return!1;var o=!0;return t.forEach(function(t,n){o=o&&kt(e.get(n),t)}),o}if("object"==typeof t&&"object"==typeof e){if(null===t||null===e)return!1;if(Bt(t)&&Bt(e))return t.size===e.size&&kt(Mn.shallowMap(t).entries(),Mn.shallowMap(e).entries());if(Dt(t).length!==Dt(e).length)return!1;for(var a in t){if(!(a in e))return!1;if(!kt(t[a],e[a]))return!1}return!0}return!1}function Ut(t,e){var n="isMobX"+t;return e.prototype[n]=!0,function(t){return St(t)&&!0===t[n]}}function Ft(t){return Array.isArray(t)||w(t)}function Bt(t){return zt(t)||An(t)}function zt(t){return void 0!==yt().Map&&t instanceof yt().Map}function jt(){return"function"==typeof Symbol&&Symbol.toPrimitive||"@@toPrimitive"}function Vt(t){return null===t?null:"object"==typeof t?""+t:t}function Ht(){var t=yt(),e=Dn;if(t.__mobservableTrackingStack||t.__mobservableViewStack)throw new Error("[mobx] An incompatible version of mobservable is already loaded.");if(t.__mobxGlobal&&t.__mobxGlobal.version!==e.version)throw new Error("[mobx] An incompatible version of mobx is already loaded.");t.__mobxGlobal?Dn=t.__mobxGlobal:t.__mobxGlobal=e}function Gt(){return Dn}function Wt(){Dn.resetId++;var t=new Nn;for(var e in t)-1===In.indexOf(e)&&(Dn[e]=t[e]);Dn.allowStateChanges=!Dn.strictMode}function Xt(t){return t.observers&&t.observers.length>0}function qt(t){return t.observers}function Yt(t,e){var n=t.observers.length;n&&(t.observersIndexes[e.__mapid]=n),t.observers[n]=e,t.lowestObserverState>e.dependenciesState&&(t.lowestObserverState=e.dependenciesState)}function Zt(t,e){if(1===t.observers.length)t.observers.length=0,Kt(t);else{var n=t.observers,r=t.observersIndexes,i=n.pop();if(i!==e){var o=r[e.__mapid]||0;o?r[i.__mapid]=o:delete r[i.__mapid],n[o]=i}delete r[e.__mapid]}}function Kt(t){t.isPendingUnobservation||(t.isPendingUnobservation=!0,Dn.pendingUnobservations.push(t))}function Jt(){Dn.inBatch++}function $t(){if(0==--Dn.inBatch){ve();for(var t=Dn.pendingUnobservations,e=0;e0;Dn.computationDepth>0&&e&&xt(E("m031")+t.name),!Dn.allowStateChanges&&e&&xt(E(Dn.strictMode?"m030a":"m030b")+t.name)}function se(t,e,n){fe(t),t.newObserving=new Array(t.observing.length+100),t.unboundDepsCount=0,t.runId=++Dn.runId;var r=Dn.trackingDerivation;Dn.trackingDerivation=t;var i;try{i=e.call(n)}catch(t){i=new kn(t)}return Dn.trackingDerivation=r,ue(t),i}function ue(t){var e=t.observing,n=t.observing=t.newObserving,r=Pn.UP_TO_DATE;t.newObserving=null;for(var i=0,o=t.unboundDepsCount,a=0;ar&&(r=s.dependenciesState)}for(n.length=i,o=e.length;o--;){var s=e[o];0===s.diffValue&&Zt(s,t),s.diffValue=0}for(;i--;){var s=n[i];1===s.diffValue&&(s.diffValue=0,Yt(s,t))}r!==Pn.UP_TO_DATE&&(t.dependenciesState=r,t.onBecomeStale())}function ce(t){var e=t.observing;t.observing=[];for(var n=e.length;n--;)Zt(e[n],t);t.dependenciesState=Pn.NOT_TRACKING}function le(t){var e=he(),n=t();return pe(e),n}function he(){var t=Dn.trackingDerivation;return Dn.trackingDerivation=null,t}function pe(t){Dn.trackingDerivation=t}function fe(t){if(t.dependenciesState!==Pn.UP_TO_DATE){t.dependenciesState=Pn.UP_TO_DATE;for(var e=t.observing,n=e.length;n--;)e[n].lowestObserverState=Pn.UP_TO_DATE}}function de(t){_t(this&&this.$mobx&&zn(this.$mobx),"Invalid `this`"),_t(!this.$mobx.errorHandler,"Only one onErrorHandler can be registered"),this.$mobx.errorHandler=t}function me(t){return Dn.globalReactionErrorHandlers.push(t),function(){var e=Dn.globalReactionErrorHandlers.indexOf(t);e>=0&&Dn.globalReactionErrorHandlers.splice(e,1)}}function ve(){Dn.inBatch>0||Dn.isRunningReactions||Bn(ge)}function ge(){Dn.isRunningReactions=!0;for(var t=Dn.pendingReactions,e=0;t.length>0;){++e===Fn&&(console.error("Reaction doesn't converge to a stable state after "+Fn+" iterations. Probably there is a cycle in the reactive function: "+t[0]),t.splice(0));for(var n=t.splice(0),r=0,i=n.length;r0&&(e.dependencies=Mt(t.observing).map(je)),e}function Ve(t,e){return He(Me(t,e))}function He(t){var e={name:t.name};return Xt(t)&&(e.observers=qt(t).map(He)),e}function Ge(t,e,n){var r;if(An(t)||w(t)||sn(t))r=Te(t);else{if(!tt(t))return xt("Expected observable map, object or array as first array");if("string"!=typeof e)return xt("InterceptReads can only be used with a specific property, not with an object in general");r=Te(t,e)}return void 0!==r.dehancer?xt("An intercept reader was already established"):(r.dehancer="function"==typeof e?e:n,function(){r.dehancer=void 0})}n.d(e,"extras",function(){return Gn}),n.d(e,"Reaction",function(){return Un}),n.d(e,"untracked",function(){return le}),n.d(e,"IDerivationState",function(){return Pn}),n.d(e,"Atom",function(){return qe}),n.d(e,"BaseAtom",function(){return Xe}),n.d(e,"useStrict",function(){return C}),n.d(e,"isStrictModeEnabled",function(){return P}),n.d(e,"spy",function(){return m}),n.d(e,"asReference",function(){return be}),n.d(e,"asFlat",function(){return _e}),n.d(e,"asStructure",function(){return xe}),n.d(e,"asMap",function(){return we}),n.d(e,"isModifierDescriptor",function(){return ut}),n.d(e,"isObservableObject",function(){return tt}),n.d(e,"isBoxedObservable",function(){return sn}),n.d(e,"isObservableArray",function(){return w}),n.d(e,"ObservableMap",function(){return Sn}),n.d(e,"isObservableMap",function(){return An}),n.d(e,"map",function(){return gt}),n.d(e,"transaction",function(){return mt}),n.d(e,"observable",function(){return Mn}),n.d(e,"IObservableFactories",function(){return En}),n.d(e,"computed",function(){return Hn}),n.d(e,"isObservable",function(){return et}),n.d(e,"isComputed",function(){return Ae}),n.d(e,"extendObservable",function(){return rt}),n.d(e,"extendShallowObservable",function(){return it}),n.d(e,"observe",function(){return Ce}),n.d(e,"intercept",function(){return Le}),n.d(e,"autorun",function(){return j}),n.d(e,"autorunAsync",function(){return H}),n.d(e,"when",function(){return V}),n.d(e,"reaction",function(){return G}),n.d(e,"action",function(){return hn}),n.d(e,"isAction",function(){return B}),n.d(e,"runInAction",function(){return F}),n.d(e,"expr",function(){return Ne}),n.d(e,"toJS",function(){return De}),n.d(e,"createTransformer",function(){return ke}),n.d(e,"whyRun",function(){return Be}),n.d(e,"isArrayLike",function(){return Ft});/*! ***************************************************************************** -Copyright (c) Microsoft Corporation. All rights reserved. -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 - -THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED -WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, -MERCHANTABLITY OR NON-INFRINGEMENT. - -See the Apache Version 2.0 License for specific language governing permissions -and limitations under the License. -***************************************************************************** */ -var We=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])},Xe=function(){function t(t){void 0===t&&(t="Atom@"+bt()),this.name=t,this.isPendingUnobservation=!0,this.observers=[],this.observersIndexes={},this.diffValue=0,this.lastAccessedBy=0,this.lowestObserverState=Pn.NOT_TRACKING}return t.prototype.onBecomeUnobserved=function(){},t.prototype.reportObserved=function(){Qt(this)},t.prototype.reportChanged=function(){Jt(),te(this),$t()},t.prototype.toString=function(){return this.name},t}(),qe=function(t){function e(e,n,r){void 0===e&&(e="Atom@"+bt()),void 0===n&&(n=Ln),void 0===r&&(r=Ln);var i=t.call(this,e)||this;return i.name=e,i.onBecomeObservedHandler=n,i.onBecomeUnobservedHandler=r,i.isPendingUnobservation=!1,i.isBeingTracked=!1,i}return i(e,t),e.prototype.reportObserved=function(){return Jt(),t.prototype.reportObserved.call(this),this.isBeingTracked||(this.isBeingTracked=!0,this.onBecomeObservedHandler()),$t(),!!Dn.trackingDerivation},e.prototype.onBecomeUnobserved=function(){this.isBeingTracked=!1,this.onBecomeUnobservedHandler()},e}(Xe),Ye=Ut("Atom",Xe),Ze={spyReportEnd:!0},Ke="__$$iterating",Je=function(){var t=!1,e={};return Object.defineProperty(e,"0",{set:function(){t=!0}}),Object.create(e)[0]=1,!1===t}(),$e=0,Qe=function(){function t(){}return t}();!function(t,e){void 0!==Object.setPrototypeOf?Object.setPrototypeOf(t.prototype,e):void 0!==t.prototype.__proto__?t.prototype.__proto__=e:t.prototype=e}(Qe,Array.prototype);var tn=function(){function t(t,e,n,r){this.array=n,this.owned=r,this.values=[],this.lastKnownLength=0,this.interceptors=null,this.changeListeners=null,this.atom=new Xe(t||"ObservableArray@"+bt()),this.enhancer=function(n,r){return e(n,r,t+"[..]")}}return t.prototype.dehanceValue=function(t){return void 0!==this.dehancer?this.dehancer(t):t},t.prototype.dehanceValues=function(t){return void 0!==this.dehancer?t.map(this.dehancer):t},t.prototype.intercept=function(t){return a(this,t)},t.prototype.observe=function(t,e){return void 0===e&&(e=!1),e&&t({object:this.array,type:"splice",index:0,added:this.values.slice(),addedCount:this.values.length,removed:[],removedCount:0}),c(this,t)},t.prototype.getArrayLength=function(){return this.atom.reportObserved(),this.values.length},t.prototype.setArrayLength=function(t){if("number"!=typeof t||t<0)throw new Error("[mobx.array] Out of range: "+t);var e=this.values.length;if(t!==e)if(t>e){for(var n=new Array(t-e),r=0;r0&&t+e+1>$e&&_(t+e+1)},t.prototype.spliceWithArray=function(t,e,n){var r=this;ae(this.atom);var i=this.values.length;if(void 0===t?t=0:t>i?t=i:t<0&&(t=Math.max(0,i+t)),e=1===arguments.length?i-t:void 0===e||null===e?0:Math.max(0,Math.min(e,i-t)),void 0===n&&(n=[]),o(this)){var a=s(this,{object:this.array,type:"splice",index:t,removedCount:e,added:n});if(!a)return Cn;e=a.removedCount,n=a.added}n=n.map(function(t){return r.enhancer(t,void 0)});var u=n.length-e;this.updateArrayLength(i,u);var c=this.spliceItemsIntoValues(t,e,n);return 0===e&&0===n.length||this.notifyArraySplice(t,n,c),this.dehanceValues(c)},t.prototype.spliceItemsIntoValues=function(t,e,n){if(n.length<1e4)return(i=this.values).splice.apply(i,[t,e].concat(n));var r=this.values.slice(t,t+e);return this.values=this.values.slice(0,t).concat(n,this.values.slice(t+e)),r;var i},t.prototype.notifyArrayChildUpdate=function(t,e,n){var r=!this.owned&&h(),i=u(this),o=i||r?{object:this.array,type:"update",index:t,newValue:e,oldValue:n}:null;r&&f(o),this.atom.reportChanged(),i&&l(this,o),r&&d()},t.prototype.notifyArraySplice=function(t,e,n){var r=!this.owned&&h(),i=u(this),o=i||r?{object:this.array,type:"splice",index:t,removed:n,added:e,removedCount:n.length,addedCount:e.length}:null;r&&f(o),this.atom.reportChanged(),i&&l(this,o),r&&d()},t}(),en=function(t){function e(e,n,r,i){void 0===r&&(r="ObservableArray@"+bt()),void 0===i&&(i=!1);var o=t.call(this)||this,a=new tn(r,n,o,i);return Ot(o,"$mobx",a),e&&e.length&&o.spliceWithArray(0,0,e),Je&&Object.defineProperty(a.array,"0",nn),o}return i(e,t),e.prototype.intercept=function(t){return this.$mobx.intercept(t)},e.prototype.observe=function(t,e){return void 0===e&&(e=!1),this.$mobx.observe(t,e)},e.prototype.clear=function(){return this.splice(0)},e.prototype.concat=function(){for(var t=[],e=0;e-1&&(this.splice(e,1),!0)},e.prototype.move=function(t,e){function n(t){if(t<0)throw new Error("[mobx.array] Index out of bounds: "+t+" is negative");var e=this.$mobx.values.length;if(t>=e)throw new Error("[mobx.array] Index out of bounds: "+t+" is not smaller than "+e)}if(n.call(this,t),n.call(this,e),t!==e){var r,i=this.$mobx.values;r=t";Lt(t,e,hn(o,n))},function(t){return this[t]},function(){_t(!1,E("m001"))},!1,!0),ln=I(function(t,e,n){z(t,e,n)},function(t){return this[t]},function(){_t(!1,E("m001"))},!1,!1),hn=function(t,e,n,r){return 1===arguments.length&&"function"==typeof t?M(t.name||"",t):2===arguments.length&&"function"==typeof e?M(t,e):1===arguments.length&&"string"==typeof t?U(t):U(e).apply(null,arguments)};hn.bound=function(t,e,n){if("function"==typeof t){var r=M("",t);return r.autoBind=!0,r}return ln.apply(null,arguments)};var pn=function(){function t(t,e,n,r,i){this.derivation=t,this.scope=e,this.compareStructural=n,this.dependenciesState=Pn.NOT_TRACKING,this.observing=[],this.newObserving=null,this.isPendingUnobservation=!1,this.observers=[],this.observersIndexes={},this.diffValue=0,this.runId=0,this.lastAccessedBy=0,this.lowestObserverState=Pn.UP_TO_DATE,this.unboundDepsCount=0,this.__mapid="#"+bt(),this.value=void 0,this.isComputing=!1,this.isRunningSetter=!1,this.name=r||"ComputedValue@"+bt(),i&&(this.setter=M(r+"-setter",i))}return t.prototype.onBecomeStale=function(){ne(this)},t.prototype.onBecomeUnobserved=function(){ce(this),this.value=void 0},t.prototype.get=function(){_t(!this.isComputing,"Cycle detected in computation "+this.name,this.derivation),0===Dn.inBatch?(Jt(),ie(this)&&(this.value=this.computeValue(!1)),$t()):(Qt(this),ie(this)&&this.trackAndCompute()&&ee(this));var t=this.value;if(re(t))throw t.cause;return t},t.prototype.peek=function(){var t=this.computeValue(!1);if(re(t))throw t.cause;return t},t.prototype.set=function(t){if(this.setter){_t(!this.isRunningSetter,"The setter of computed value '"+this.name+"' is trying to update itself. Did you intend to update an _observable_ value, instead of the computed property?"),this.isRunningSetter=!0;try{this.setter.call(this.scope,t)}finally{this.isRunningSetter=!1}}else _t(!1,"[ComputedValue '"+this.name+"'] It is not possible to assign a new value to a computed value.")},t.prototype.trackAndCompute=function(){h()&&p({object:this.scope,type:"compute",fn:this.derivation});var t=this.value,e=this.value=this.computeValue(!0);return re(e)||Pt(this.compareStructural,e,t)},t.prototype.computeValue=function(t){this.isComputing=!0,Dn.computationDepth++;var e;if(t)e=se(this,this.derivation,this.scope);else try{e=this.derivation.call(this.scope)}catch(t){e=new kn(t)}return Dn.computationDepth--,this.isComputing=!1,e},t.prototype.observe=function(t,e){var n=this,r=!0,i=void 0;return j(function(){var o=n.get();if(!r||e){var a=he();t({type:"update",object:n,newValue:o,oldValue:i}),pe(a)}r=!1,i=o})},t.prototype.toJSON=function(){return this.get()},t.prototype.toString=function(){return this.name+"["+this.derivation.toString()+"]"},t.prototype.valueOf=function(){return Vt(this.get())},t.prototype.whyRun=function(){var t=Boolean(Dn.trackingDerivation),e=Mt(this.isComputing?this.newObserving:this.observing).map(function(t){return t.name}),n=Mt(qt(this).map(function(t){return t.name}));return"\nWhyRun? computation '"+this.name+"':\n * Running because: "+(t?"[active] the value of this computation is needed by a reaction":this.isComputing?"[get] The value of this computed was requested outside a reaction":"[idle] not running at the moment")+"\n"+(this.dependenciesState===Pn.NOT_TRACKING?E("m032"):" * This computation will re-run if any of the following observables changes:\n "+Tt(e)+"\n "+(this.isComputing&&t?" (... or any observable accessed during the remainder of the current run)":"")+"\n\t"+E("m038")+"\n\n * If the outcome of this computation changes, the following observers will be re-run:\n "+Tt(n)+"\n")},t}();pn.prototype[jt()]=pn.prototype.valueOf;var fn=Ut("ComputedValue",pn),dn=function(){function t(t,e){this.target=t,this.name=e,this.values={},this.changeListeners=null,this.interceptors=null}return t.prototype.observe=function(t,e){return _t(!0!==e,"`observe` doesn't support the fire immediately property for observable objects."),c(this,t)},t.prototype.intercept=function(t){return a(this,t)},t}(),mn={},vn={},gn=Ut("ObservableObjectAdministration",dn),yn=nt(lt),bn=nt(ht),xn=nt(pt),_n=nt(ft),wn=nt(dt),En=function(){function t(){}return t.prototype.box=function(t,e){return arguments.length>2&&st("box"),new an(t,lt,e)},t.prototype.shallowBox=function(t,e){return arguments.length>2&&st("shallowBox"),new an(t,pt,e)},t.prototype.array=function(t,e){return arguments.length>2&&st("array"),new en(t,lt,e)},t.prototype.shallowArray=function(t,e){return arguments.length>2&&st("shallowArray"),new en(t,pt,e)},t.prototype.map=function(t,e){return arguments.length>2&&st("map"),new Sn(t,lt,e)},t.prototype.shallowMap=function(t,e){return arguments.length>2&&st("shallowMap"),new Sn(t,pt,e)},t.prototype.object=function(t,e){arguments.length>2&&st("object");var n={};return W(n,e),rt(n,t),n},t.prototype.shallowObject=function(t,e){arguments.length>2&&st("shallowObject");var n={};return W(n,e),it(n,t),n},t.prototype.ref=function(){return arguments.length<2?ct(pt,arguments[0]):xn.apply(null,arguments)},t.prototype.shallow=function(){return arguments.length<2?ct(ht,arguments[0]):bn.apply(null,arguments)},t.prototype.deep=function(){return arguments.length<2?ct(lt,arguments[0]):yn.apply(null,arguments)},t.prototype.struct=function(){return arguments.length<2?ct(ft,arguments[0]):_n.apply(null,arguments)},t}(),Mn=at;Object.getOwnPropertyNames(En.prototype).filter(function(t){return"constructor"!==t}).forEach(function(t){return Mn[t]=En.prototype[t]}),Mn.deep.struct=Mn.struct,Mn.ref.struct=function(){return arguments.length<2?ct(dt,arguments[0]):wn.apply(null,arguments)};var Tn={},Sn=function(){function t(t,e,n){void 0===e&&(e=lt),void 0===n&&(n="ObservableMap@"+bt()),this.enhancer=e,this.name=n,this.$mobx=Tn,this._data=Object.create(null),this._hasMap=Object.create(null),this._keys=new en(void 0,pt,this.name+".keys()",!0),this.interceptors=null,this.changeListeners=null,this.dehancer=void 0,this.merge(t)}return t.prototype._has=function(t){return void 0!==this._data[t]},t.prototype.has=function(t){return!!this.isValidKey(t)&&(t=""+t,this._hasMap[t]?this._hasMap[t].get():this._updateHasMapEntry(t,!1).get())},t.prototype.set=function(t,e){this.assertValidKey(t),t=""+t;var n=this._has(t);if(o(this)){var r=s(this,{type:n?"update":"add",object:this,newValue:e,name:t});if(!r)return this;e=r.newValue}return n?this._updateValue(t,e):this._addValue(t,e),this},t.prototype.delete=function(t){var e=this;if(this.assertValidKey(t),t=""+t,o(this)){var n=s(this,{type:"delete",object:this,name:t});if(!n)return!1}if(this._has(t)){var r=h(),i=u(this),n=i||r?{type:"delete",object:this,oldValue:this._data[t].value,name:t}:null;return r&&f(n),vt(function(){e._keys.remove(t),e._updateHasMapEntry(t,!1),e._data[t].setNewValue(void 0),e._data[t]=void 0}),i&&l(this,n),r&&d(),!0}return!1},t.prototype._updateHasMapEntry=function(t,e){var n=this._hasMap[t];return n?n.setNewValue(e):n=this._hasMap[t]=new an(e,pt,this.name+"."+t+"?",!1),n},t.prototype._updateValue=function(t,e){var n=this._data[t];if((e=n.prepareNewValue(e))!==on){var r=h(),i=u(this),o=i||r?{type:"update",object:this,oldValue:n.value,name:t,newValue:e}:null;r&&f(o),n.setNewValue(e),i&&l(this,o),r&&d()}},t.prototype._addValue=function(t,e){var n=this;vt(function(){var r=n._data[t]=new an(e,n.enhancer,n.name+"."+t,!1);e=r.value,n._updateHasMapEntry(t,!0),n._keys.push(t)});var r=h(),i=u(this),o=i||r?{type:"add",object:this,name:t,newValue:e}:null;r&&f(o),i&&l(this,o),r&&d()},t.prototype.get=function(t){return t=""+t,this.has(t)?this.dehanceValue(this._data[t].get()):this.dehanceValue(void 0)},t.prototype.dehanceValue=function(t){return void 0!==this.dehancer?this.dehancer(t):t},t.prototype.keys=function(){return g(this._keys.slice())},t.prototype.values=function(){return g(this._keys.map(this.get,this))},t.prototype.entries=function(){var t=this;return g(this._keys.map(function(e){return[e,t.get(e)]}))},t.prototype.forEach=function(t,e){var n=this;this.keys().forEach(function(r){return t.call(e,n.get(r),r,n)})},t.prototype.merge=function(t){var e=this;return An(t)&&(t=t.toJS()),vt(function(){At(t)?Object.keys(t).forEach(function(n){return e.set(n,t[n])}):Array.isArray(t)?t.forEach(function(t){var n=t[0],r=t[1];return e.set(n,r)}):zt(t)?t.forEach(function(t,n){return e.set(n,t)}):null!==t&&void 0!==t&&xt("Cannot initialize map from "+t)}),this},t.prototype.clear=function(){var t=this;vt(function(){le(function(){t.keys().forEach(t.delete,t)})})},t.prototype.replace=function(t){var e=this;return vt(function(){e.clear(),e.merge(t)}),this},Object.defineProperty(t.prototype,"size",{get:function(){return this._keys.length},enumerable:!0,configurable:!0}),t.prototype.toJS=function(){var t=this,e={};return this.keys().forEach(function(n){return e[n]=t.get(n)}),e},t.prototype.toJSON=function(){return this.toJS()},t.prototype.isValidKey=function(t){return null!==t&&void 0!==t&&("string"==typeof t||"number"==typeof t||"boolean"==typeof t)},t.prototype.assertValidKey=function(t){if(!this.isValidKey(t))throw new Error("[mobx.map] Invalid key: '"+t+"', only strings, numbers and booleans are accepted as key in observable maps.")},t.prototype.toString=function(){var t=this;return this.name+"[{ "+this.keys().map(function(e){return e+": "+t.get(e)}).join(", ")+" }]"},t.prototype.observe=function(t,e){return _t(!0!==e,E("m033")),c(this,t)},t.prototype.intercept=function(t){return a(this,t)},t}();y(Sn.prototype,function(){return this.entries()});var An=Ut("ObservableMap",Sn),Cn=[];Object.freeze(Cn);var Pn,Rn=[],Ln=function(){},On=Object.prototype.hasOwnProperty,In=["mobxGuid","resetId","spyListeners","strictMode","runId"],Nn=function(){function t(){this.version=5,this.trackingDerivation=null,this.computationDepth=0,this.runId=0,this.mobxGuid=0,this.inBatch=0,this.pendingUnobservations=[],this.pendingReactions=[],this.isRunningReactions=!1,this.allowStateChanges=!0,this.strictMode=!1,this.resetId=0,this.spyListeners=[],this.globalReactionErrorHandlers=[]}return t}(),Dn=new Nn;!function(t){t[t.NOT_TRACKING=-1]="NOT_TRACKING",t[t.UP_TO_DATE=0]="UP_TO_DATE",t[t.POSSIBLY_STALE=1]="POSSIBLY_STALE",t[t.STALE=2]="STALE"}(Pn||(Pn={}));var kn=function(){function t(t){this.cause=t}return t}(),Un=function(){function t(t,e){void 0===t&&(t="Reaction@"+bt()),this.name=t,this.onInvalidate=e,this.observing=[],this.newObserving=[],this.dependenciesState=Pn.NOT_TRACKING,this.diffValue=0,this.runId=0,this.unboundDepsCount=0,this.__mapid="#"+bt(),this.isDisposed=!1,this._isScheduled=!1,this._isTrackPending=!1,this._isRunning=!1}return t.prototype.onBecomeStale=function(){this.schedule()},t.prototype.schedule=function(){this._isScheduled||(this._isScheduled=!0,Dn.pendingReactions.push(this),ve())},t.prototype.isScheduled=function(){return this._isScheduled},t.prototype.runReaction=function(){this.isDisposed||(Jt(),this._isScheduled=!1,ie(this)&&(this._isTrackPending=!0,this.onInvalidate(),this._isTrackPending&&h()&&p({object:this,type:"scheduled-reaction"})),$t())},t.prototype.track=function(t){Jt();var e,n=h();n&&(e=Date.now(),f({object:this,type:"reaction",fn:t})),this._isRunning=!0;var r=se(this,t,void 0);this._isRunning=!1,this._isTrackPending=!1,this.isDisposed&&ce(this),re(r)&&this.reportExceptionInDerivation(r.cause),n&&d({time:Date.now()-e}),$t()},t.prototype.reportExceptionInDerivation=function(t){var e=this;if(this.errorHandler)return void this.errorHandler(t,this);var n="[mobx] Encountered an uncaught exception that was thrown by a reaction or observer component, in: '"+this,r=E("m037");console.error(n||r,t),h()&&p({type:"error",message:n,error:t,object:this}),Dn.globalReactionErrorHandlers.forEach(function(n){return n(t,e)})},t.prototype.dispose=function(){this.isDisposed||(this.isDisposed=!0,this._isRunning||(Jt(),ce(this),$t()))},t.prototype.getDisposer=function(){var t=this.dispose.bind(this);return t.$mobx=this,t.onError=de,t},t.prototype.toString=function(){return"Reaction["+this.name+"]"},t.prototype.whyRun=function(){var t=Mt(this._isRunning?this.newObserving:this.observing).map(function(t){return t.name});return"\nWhyRun? reaction '"+this.name+"':\n * Status: ["+(this.isDisposed?"stopped":this._isRunning?"running":this.isScheduled()?"scheduled":"idle")+"]\n * This reaction will re-run if any of the following observables changes:\n "+Tt(t)+"\n "+(this._isRunning?" (... or any observable accessed during the remainder of the current run)":"")+"\n\t"+E("m038")+"\n"},t}(),Fn=100,Bn=function(t){return t()},zn=Ut("Reaction",Un),jn=Ee(!1),Vn=Ee(!0),Hn=function(t,e,n){if("string"==typeof e)return jn.apply(null,arguments);_t("function"==typeof t,E("m011")),_t(arguments.length<3,E("m012"));var r="object"==typeof e?e:{};return r.setter="function"==typeof e?e:r.setter,new pn(t,r.context,r.compareStructural||r.struct||!1,r.name||t.name||"",r.setter)};Hn.struct=Vn;var Gn={allowStateChanges:R,deepEqual:kt,getAtom:Me,getDebugName:Se,getDependencyTree:ze,getAdministration:Te,getGlobalState:Gt,getObserverTree:Ve,interceptReads:Ge,isComputingDerivation:oe,isSpyEnabled:h,onReactionError:me,reserveArrayBuffer:_,resetGlobalState:Wt,shareGlobalState:Ht,spyReport:p,spyReportEnd:d,spyReportStart:f,setReactionScheduler:ye},Wn="undefined"!=typeof exports?exports:void 0!==r&&void 0!==r.exports?r.exports:{};"object"==typeof __MOBX_DEVTOOLS_GLOBAL_HOOK__&&__MOBX_DEVTOOLS_GLOBAL_HOOK__.injectMobx({spy:m,extras:Gn}),Wn.default=Wn}.call(e,n(144),n(339)(t))},function(t,e,n){"use strict";function r(t){if(d){var e=t.node,n=t.children;if(n.length)for(var r=0;r1){for(var d=Array(f),m=0;m1){for(var g=Array(v),y=0;y0&&console.error("THREE.Matrix4: the constructor no longer reads arguments. use .set() instead.")}function p(t,e,n,r,i,a,s,u,c,l){t=void 0!==t?t:[],e=void 0!==e?e:ta,o.call(this,t,e,n,r,i,a,s,u,c,l),this.flipY=!1}function f(){this.seq=[],this.map={}}function d(t,e,n){var r=t[0];if(r<=0||r>0)return t;var i=e*n,o=gs[i];if(void 0===o&&(o=new Float32Array(i),gs[i]=o),0!==e){r.toArray(o,0);for(var a=1,s=0;a!==e;++a)s+=n,t[a].toArray(o,s)}return o}function m(t,e){var n=ys[e];void 0===n&&(n=new Int32Array(e),ys[e]=n);for(var r=0;r!==e;++r)n[r]=t.allocTextureUnit();return n}function v(t,e){t.uniform1f(this.addr,e)}function g(t,e){t.uniform1i(this.addr,e)}function y(t,e){void 0===e.x?t.uniform2fv(this.addr,e):t.uniform2f(this.addr,e.x,e.y)}function b(t,e){void 0!==e.x?t.uniform3f(this.addr,e.x,e.y,e.z):void 0!==e.r?t.uniform3f(this.addr,e.r,e.g,e.b):t.uniform3fv(this.addr,e)}function x(t,e){void 0===e.x?t.uniform4fv(this.addr,e):t.uniform4f(this.addr,e.x,e.y,e.z,e.w)}function _(t,e){t.uniformMatrix2fv(this.addr,!1,e.elements||e)}function w(t,e){t.uniformMatrix3fv(this.addr,!1,e.elements||e)}function E(t,e){t.uniformMatrix4fv(this.addr,!1,e.elements||e)}function M(t,e,n){var r=n.allocTextureUnit();t.uniform1i(this.addr,r),n.setTexture2D(e||ms,r)}function T(t,e,n){var r=n.allocTextureUnit();t.uniform1i(this.addr,r),n.setTextureCube(e||vs,r)}function S(t,e){t.uniform2iv(this.addr,e)}function A(t,e){t.uniform3iv(this.addr,e)}function C(t,e){t.uniform4iv(this.addr,e)}function P(t){switch(t){case 5126:return v;case 35664:return y;case 35665:return b;case 35666:return x;case 35674:return _;case 35675:return w;case 35676:return E;case 35678:return M;case 35680:return T;case 5124:case 35670:return g;case 35667:case 35671:return S;case 35668:case 35672:return A;case 35669:case 35673:return C}}function R(t,e){t.uniform1fv(this.addr,e)}function L(t,e){t.uniform1iv(this.addr,e)}function O(t,e){t.uniform2fv(this.addr,d(e,this.size,2))}function I(t,e){t.uniform3fv(this.addr,d(e,this.size,3))}function N(t,e){t.uniform4fv(this.addr,d(e,this.size,4))}function D(t,e){t.uniformMatrix2fv(this.addr,!1,d(e,this.size,4))}function k(t,e){t.uniformMatrix3fv(this.addr,!1,d(e,this.size,9))}function U(t,e){t.uniformMatrix4fv(this.addr,!1,d(e,this.size,16))}function F(t,e,n){var r=e.length,i=m(n,r);t.uniform1iv(this.addr,i);for(var o=0;o!==r;++o)n.setTexture2D(e[o]||ms,i[o])}function j(t,e,n){var r=e.length,i=m(n,r);t.uniform1iv(this.addr,i);for(var o=0;o!==r;++o)n.setTextureCube(e[o]||vs,i[o])}function B(t){switch(t){case 5126:return R;case 35664:return O;case 35665:return I;case 35666:return N;case 35674:return D;case 35675:return k;case 35676:return U;case 35678:return F;case 35680:return j;case 5124:case 35670:return L;case 35667:case 35671:return S;case 35668:case 35672:return A;case 35669:case 35673:return C}}function z(t,e,n){this.id=t,this.addr=n,this.setValue=P(e.type)}function V(t,e,n){this.id=t,this.addr=n,this.size=e.size,this.setValue=B(e.type)}function H(t){this.id=t,f.call(this)}function G(t,e){t.seq.push(e),t.map[e.id]=e}function W(t,e,n){var r=t.name,i=r.length;for(bs.lastIndex=0;;){var o=bs.exec(r),a=bs.lastIndex,s=o[1],u="]"===o[2],c=o[3];if(u&&(s|=0),void 0===c||"["===c&&a+2===i){G(n,void 0===c?new z(s,t,e):new V(s,t,e));break}var l=n.map,h=l[s];void 0===h&&(h=new H(s),G(n,h)),n=h}}function X(t,e,n){f.call(this),this.renderer=n;for(var r=t.getProgramParameter(e,t.ACTIVE_UNIFORMS),i=0;i.001&&L.scale>.001&&(E.x=L.x,E.y=L.y,E.z=L.z,_=L.size*L.scale/v.w,w.x=_*y,w.y=_,d.uniform3f(h.screenPosition,E.x,E.y,E.z),d.uniform2f(h.scale,w.x,w.y),d.uniform1f(h.rotation,L.rotation),d.uniform1f(h.opacity,L.opacity),d.uniform3f(h.color,L.color.r,L.color.g,L.color.b),m.setBlending(L.blending,L.blendEquation,L.blendSrc,L.blendDst),t.setTexture2D(L.texture,1),d.drawElements(d.TRIANGLES,6,d.UNSIGNED_SHORT,0))}}}m.enable(d.CULL_FACE),m.enable(d.DEPTH_TEST),m.setDepthWrite(!0),t.resetGLState()}}}function $(t,e){function n(){var t=new Float32Array([-.5,-.5,0,0,.5,-.5,1,0,.5,.5,1,1,-.5,.5,0,1]),e=new Uint16Array([0,1,2,0,2,3]);a=d.createBuffer(),s=d.createBuffer(),d.bindBuffer(d.ARRAY_BUFFER,a),d.bufferData(d.ARRAY_BUFFER,t,d.STATIC_DRAW),d.bindBuffer(d.ELEMENT_ARRAY_BUFFER,s),d.bufferData(d.ELEMENT_ARRAY_BUFFER,e,d.STATIC_DRAW),u=r(),h={position:d.getAttribLocation(u,"position"),uv:d.getAttribLocation(u,"uv")},p={uvOffset:d.getUniformLocation(u,"uvOffset"),uvScale:d.getUniformLocation(u,"uvScale"),rotation:d.getUniformLocation(u,"rotation"),scale:d.getUniformLocation(u,"scale"),color:d.getUniformLocation(u,"color"),map:d.getUniformLocation(u,"map"),opacity:d.getUniformLocation(u,"opacity"),modelViewMatrix:d.getUniformLocation(u,"modelViewMatrix"),projectionMatrix:d.getUniformLocation(u,"projectionMatrix"),fogType:d.getUniformLocation(u,"fogType"),fogDensity:d.getUniformLocation(u,"fogDensity"),fogNear:d.getUniformLocation(u,"fogNear"),fogFar:d.getUniformLocation(u,"fogFar"),fogColor:d.getUniformLocation(u,"fogColor"),alphaTest:d.getUniformLocation(u,"alphaTest")};var n=document.createElementNS("http://www.w3.org/1999/xhtml","canvas");n.width=8,n.height=8;var i=n.getContext("2d");i.fillStyle="white",i.fillRect(0,0,8,8),f=new o(n),f.needsUpdate=!0}function r(){var e=d.createProgram(),n=d.createShader(d.VERTEX_SHADER),r=d.createShader(d.FRAGMENT_SHADER);return d.shaderSource(n,["precision "+t.getPrecision()+" float;","uniform mat4 modelViewMatrix;","uniform mat4 projectionMatrix;","uniform float rotation;","uniform vec2 scale;","uniform vec2 uvOffset;","uniform vec2 uvScale;","attribute vec2 position;","attribute vec2 uv;","varying vec2 vUV;","void main() {","vUV = uvOffset + uv * uvScale;","vec2 alignedPosition = position * scale;","vec2 rotatedPosition;","rotatedPosition.x = cos( rotation ) * alignedPosition.x - sin( rotation ) * alignedPosition.y;","rotatedPosition.y = sin( rotation ) * alignedPosition.x + cos( rotation ) * alignedPosition.y;","vec4 finalPosition;","finalPosition = modelViewMatrix * vec4( 0.0, 0.0, 0.0, 1.0 );","finalPosition.xy += rotatedPosition;","finalPosition = projectionMatrix * finalPosition;","gl_Position = finalPosition;","}"].join("\n")),d.shaderSource(r,["precision "+t.getPrecision()+" float;","uniform vec3 color;","uniform sampler2D map;","uniform float opacity;","uniform int fogType;","uniform vec3 fogColor;","uniform float fogDensity;","uniform float fogNear;","uniform float fogFar;","uniform float alphaTest;","varying vec2 vUV;","void main() {","vec4 texture = texture2D( map, vUV );","if ( texture.a < alphaTest ) discard;","gl_FragColor = vec4( color * texture.xyz, texture.a * opacity );","if ( fogType > 0 ) {","float depth = gl_FragCoord.z / gl_FragCoord.w;","float fogFactor = 0.0;","if ( fogType == 1 ) {","fogFactor = smoothstep( fogNear, fogFar, depth );","} else {","const float LOG2 = 1.442695;","fogFactor = exp2( - fogDensity * fogDensity * depth * depth * LOG2 );","fogFactor = 1.0 - clamp( fogFactor, 0.0, 1.0 );","}","gl_FragColor = mix( gl_FragColor, vec4( fogColor, gl_FragColor.w ), fogFactor );","}","}"].join("\n")),d.compileShader(n),d.compileShader(r),d.attachShader(e,n),d.attachShader(e,r),d.linkProgram(e),e}function i(t,e){return t.renderOrder!==e.renderOrder?t.renderOrder-e.renderOrder:t.z!==e.z?e.z-t.z:e.id-t.id}var a,s,u,h,p,f,d=t.context,m=t.state,v=new l,g=new c,y=new l;this.render=function(r,o){if(0!==e.length){void 0===u&&n(),d.useProgram(u),m.initAttributes(),m.enableAttribute(h.position),m.enableAttribute(h.uv),m.disableUnusedAttributes(),m.disable(d.CULL_FACE),m.enable(d.BLEND),d.bindBuffer(d.ARRAY_BUFFER,a),d.vertexAttribPointer(h.position,2,d.FLOAT,!1,16,0),d.vertexAttribPointer(h.uv,2,d.FLOAT,!1,16,8),d.bindBuffer(d.ELEMENT_ARRAY_BUFFER,s),d.uniformMatrix4fv(p.projectionMatrix,!1,o.projectionMatrix.elements),m.activeTexture(d.TEXTURE0),d.uniform1i(p.map,0);var c=0,l=0,b=r.fog;b?(d.uniform3f(p.fogColor,b.color.r,b.color.g,b.color.b),b.isFog?(d.uniform1f(p.fogNear,b.near),d.uniform1f(p.fogFar,b.far),d.uniform1i(p.fogType,1),c=1,l=1):b.isFogExp2&&(d.uniform1f(p.fogDensity,b.density),d.uniform1i(p.fogType,2),c=2,l=2)):(d.uniform1i(p.fogType,0),c=0,l=0);for(var x=0,_=e.length;x<_;x++){var w=e[x];w.modelViewMatrix.multiplyMatrices(o.matrixWorldInverse,w.matrixWorld),w.z=-w.modelViewMatrix.elements[14]}e.sort(i);for(var E=[],x=0,_=e.length;x<_;x++){var w=e[x],M=w.material;if(!1!==M.visible){d.uniform1f(p.alphaTest,M.alphaTest),d.uniformMatrix4fv(p.modelViewMatrix,!1,w.modelViewMatrix.elements),w.matrixWorld.decompose(v,g,y),E[0]=y.x,E[1]=y.y;var T=0;r.fog&&M.fog&&(T=l),c!==T&&(d.uniform1i(p.fogType,T),c=T),null!==M.map?(d.uniform2f(p.uvOffset,M.map.offset.x,M.map.offset.y),d.uniform2f(p.uvScale,M.map.repeat.x,M.map.repeat.y)):(d.uniform2f(p.uvOffset,0,0),d.uniform2f(p.uvScale,1,1)),d.uniform1f(p.opacity,M.opacity),d.uniform3f(p.color,M.color.r,M.color.g,M.color.b),d.uniform1f(p.rotation,M.rotation),d.uniform2fv(p.scale,E),m.setBlending(M.blending,M.blendEquation,M.blendSrc,M.blendDst),m.setDepthTest(M.depthTest),m.setDepthWrite(M.depthWrite),M.map?t.setTexture2D(M.map,0):t.setTexture2D(f,0),d.drawElements(d.TRIANGLES,6,d.UNSIGNED_SHORT,0)}}m.enable(d.CULL_FACE),t.resetGLState()}}}function J(){Object.defineProperty(this,"id",{value:Ts++}),this.uuid=fs.generateUUID(),this.name="",this.type="Material",this.fog=!0,this.lights=!0,this.blending=vo,this.side=ao,this.shading=lo,this.vertexColors=ho,this.opacity=1,this.transparent=!1,this.blendSrc=Ro,this.blendDst=Lo,this.blendEquation=_o,this.blendSrcAlpha=null,this.blendDstAlpha=null,this.blendEquationAlpha=null,this.depthFunc=Bo,this.depthTest=!0,this.depthWrite=!0,this.clippingPlanes=null,this.clipIntersection=!1,this.clipShadows=!1,this.colorWrite=!0,this.precision=null,this.polygonOffset=!1,this.polygonOffsetFactor=0,this.polygonOffsetUnits=0,this.alphaTest=0,this.premultipliedAlpha=!1,this.overdraw=0,this.visible=!0,this._needsUpdate=!0}function Q(t){J.call(this),this.type="ShaderMaterial",this.defines={},this.uniforms={},this.vertexShader="void main() {\n\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",this.fragmentShader="void main() {\n\tgl_FragColor = vec4( 1.0, 0.0, 0.0, 1.0 );\n}",this.linewidth=1,this.wireframe=!1,this.wireframeLinewidth=1,this.fog=!1,this.lights=!1,this.clipping=!1,this.skinning=!1,this.morphTargets=!1,this.morphNormals=!1,this.extensions={derivatives:!1,fragDepth:!1,drawBuffers:!1,shaderTextureLOD:!1},this.defaultAttributeValues={color:[1,1,1],uv:[0,0],uv2:[0,0]},this.index0AttributeName=void 0,void 0!==t&&(void 0!==t.attributes&&console.error("THREE.ShaderMaterial: attributes should now be defined in THREE.BufferGeometry instead."),this.setValues(t))}function tt(t){J.call(this),this.type="MeshDepthMaterial",this.depthPacking=hs,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.lights=!1,this.setValues(t)}function et(t,e){this.min=void 0!==t?t:new l(1/0,1/0,1/0),this.max=void 0!==e?e:new l(-1/0,-1/0,-1/0)}function nt(t,e){this.center=void 0!==t?t:new l,this.radius=void 0!==e?e:0}function rt(){this.elements=new Float32Array([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.")}function it(t,e){this.normal=void 0!==t?t:new l(1,0,0),this.constant=void 0!==e?e:0}function ot(t,e,n,r,i,o){this.planes=[void 0!==t?t:new it,void 0!==e?e:new it,void 0!==n?n:new it,void 0!==r?r:new it,void 0!==i?i:new it,void 0!==o?o:new it]}function at(t,e,n,r){function o(e,n,r,i){var o=e.geometry,a=null,s=M,u=e.customDepthMaterial;if(r&&(s=T,u=e.customDistanceMaterial),u)a=u;else{var c=!1;n.morphTargets&&(o&&o.isBufferGeometry?c=o.morphAttributes&&o.morphAttributes.position&&o.morphAttributes.position.length>0:o&&o.isGeometry&&(c=o.morphTargets&&o.morphTargets.length>0));var l=e.isSkinnedMesh&&n.skinning,h=0;c&&(h|=_),l&&(h|=w),a=s[h]}if(t.localClippingEnabled&&!0===n.clipShadows&&0!==n.clippingPlanes.length){var p=a.uuid,f=n.uuid,d=S[p];void 0===d&&(d={},S[p]=d);var m=d[f];void 0===m&&(m=a.clone(),d[f]=m),a=m}a.visible=n.visible,a.wireframe=n.wireframe;var v=n.side;return F.renderSingleSided&&v==uo&&(v=ao),F.renderReverseSided&&(v===ao?v=so:v===so&&(v=ao)),a.side=v,a.clipShadows=n.clipShadows,a.clippingPlanes=n.clippingPlanes,a.wireframeLinewidth=n.wireframeLinewidth,a.linewidth=n.linewidth,r&&void 0!==a.uniforms.lightPos&&a.uniforms.lightPos.value.copy(i),a}function u(t,e,n){if(!1!==t.visible){if(0!=(t.layers.mask&e.layers.mask)&&(t.isMesh||t.isLine||t.isPoints)&&t.castShadow&&(!1===t.frustumCulled||!0===f.intersectsObject(t))){!0===t.material.visible&&(t.modelViewMatrix.multiplyMatrices(n.matrixWorldInverse,t.matrixWorld),x.push(t))}for(var r=t.children,i=0,o=r.length;in&&(n=t[e]);return n}function At(){return As++}function Ct(){Object.defineProperty(this,"id",{value:At()}),this.uuid=fs.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}function Pt(){Object.defineProperty(this,"id",{value:At()}),this.uuid=fs.generateUUID(),this.name="",this.type="BufferGeometry",this.index=null,this.attributes={},this.morphAttributes={},this.groups=[],this.boundingBox=null,this.boundingSphere=null,this.drawRange={start:0,count:1/0}}function Rt(t,e){lt.call(this),this.type="Mesh",this.geometry=void 0!==t?t:new Pt,this.material=void 0!==e?e:new dt({color:16777215*Math.random()}),this.drawMode=ts,this.updateMorphTargets()}function Lt(t,e,n,r,i,o){Ct.call(this),this.type="BoxGeometry",this.parameters={width:t,height:e,depth:n,widthSegments:r,heightSegments:i,depthSegments:o},this.fromBufferGeometry(new Ot(t,e,n,r,i,o)),this.mergeVertices()}function Ot(t,e,n,r,i,o){function a(t,e,n,r,i,o,a,m,v,g,y){var b,x,_=o/v,w=a/g,E=o/2,M=a/2,T=m/2,S=v+1,A=g+1,C=0,P=0,R=new l;for(x=0;x0?1:-1,h.push(R.x,R.y,R.z),p.push(b/v),p.push(1-x/g),C+=1}}for(x=0;x");return Jt(n)}var n=/#include +<([\w\d.]+)>/g;return t.replace(n,e)}function Qt(t){function e(t,e,n,r){for(var i="",o=parseInt(e);o0?t.gammaFactor:1,v=qt(o,r,t.extensions),g=Yt(a),y=i.createProgram();n.isRawShaderMaterial?(f=[g,"\n"].filter(Kt).join("\n"),d=[v,g,"\n"].filter(Kt).join("\n")):(f=["precision "+r.precision+" float;","precision "+r.precision+" int;","#define SHADER_NAME "+n.__webglShader.name,g,r.supportsVertexTextures?"#define VERTEX_TEXTURES":"","#define GAMMA_FACTOR "+m,"#define MAX_BONES "+r.maxBones,r.useFog&&r.fog?"#define USE_FOG":"",r.useFog&&r.fogExp?"#define FOG_EXP2":"",r.map?"#define USE_MAP":"",r.envMap?"#define USE_ENVMAP":"",r.envMap?"#define "+h:"",r.lightMap?"#define USE_LIGHTMAP":"",r.aoMap?"#define USE_AOMAP":"",r.emissiveMap?"#define USE_EMISSIVEMAP":"",r.bumpMap?"#define USE_BUMPMAP":"",r.normalMap?"#define USE_NORMALMAP":"",r.displacementMap&&r.supportsVertexTextures?"#define USE_DISPLACEMENTMAP":"",r.specularMap?"#define USE_SPECULARMAP":"",r.roughnessMap?"#define USE_ROUGHNESSMAP":"",r.metalnessMap?"#define USE_METALNESSMAP":"",r.alphaMap?"#define USE_ALPHAMAP":"",r.vertexColors?"#define USE_COLOR":"",r.flatShading?"#define FLAT_SHADED":"",r.skinning?"#define USE_SKINNING":"",r.useVertexTexture?"#define BONE_TEXTURE":"",r.morphTargets?"#define USE_MORPHTARGETS":"",r.morphNormals&&!1===r.flatShading?"#define USE_MORPHNORMALS":"",r.doubleSided?"#define DOUBLE_SIDED":"",r.flipSided?"#define FLIP_SIDED":"","#define NUM_CLIPPING_PLANES "+r.numClippingPlanes,r.shadowMapEnabled?"#define USE_SHADOWMAP":"",r.shadowMapEnabled?"#define "+c:"",r.sizeAttenuation?"#define USE_SIZEATTENUATION":"",r.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",r.logarithmicDepthBuffer&&t.extensions.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;","attribute vec3 position;","attribute vec3 normal;","attribute vec2 uv;","#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(Kt).join("\n"),d=[v,"precision "+r.precision+" float;","precision "+r.precision+" int;","#define SHADER_NAME "+n.__webglShader.name,g,r.alphaTest?"#define ALPHATEST "+r.alphaTest:"","#define GAMMA_FACTOR "+m,r.useFog&&r.fog?"#define USE_FOG":"",r.useFog&&r.fogExp?"#define FOG_EXP2":"",r.map?"#define USE_MAP":"",r.envMap?"#define USE_ENVMAP":"",r.envMap?"#define "+l:"",r.envMap?"#define "+h:"",r.envMap?"#define "+p:"",r.lightMap?"#define USE_LIGHTMAP":"",r.aoMap?"#define USE_AOMAP":"",r.emissiveMap?"#define USE_EMISSIVEMAP":"",r.bumpMap?"#define USE_BUMPMAP":"",r.normalMap?"#define USE_NORMALMAP":"",r.specularMap?"#define USE_SPECULARMAP":"",r.roughnessMap?"#define USE_ROUGHNESSMAP":"",r.metalnessMap?"#define USE_METALNESSMAP":"",r.alphaMap?"#define USE_ALPHAMAP":"",r.vertexColors?"#define USE_COLOR":"",r.gradientMap?"#define USE_GRADIENTMAP":"",r.flatShading?"#define FLAT_SHADED":"",r.doubleSided?"#define DOUBLE_SIDED":"",r.flipSided?"#define FLIP_SIDED":"","#define NUM_CLIPPING_PLANES "+r.numClippingPlanes,"#define UNION_CLIPPING_PLANES "+(r.numClippingPlanes-r.numClipIntersection),r.shadowMapEnabled?"#define USE_SHADOWMAP":"",r.shadowMapEnabled?"#define "+c:"",r.premultipliedAlpha?"#define PREMULTIPLIED_ALPHA":"",r.physicallyCorrectLights?"#define PHYSICALLY_CORRECT_LIGHTS":"",r.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",r.logarithmicDepthBuffer&&t.extensions.get("EXT_frag_depth")?"#define USE_LOGDEPTHBUF_EXT":"",r.envMap&&t.extensions.get("EXT_shader_texture_lod")?"#define TEXTURE_LOD_EXT":"","uniform mat4 viewMatrix;","uniform vec3 cameraPosition;",r.toneMapping!==Yo?"#define TONE_MAPPING":"",r.toneMapping!==Yo?_s.tonemapping_pars_fragment:"",r.toneMapping!==Yo?Xt("toneMapping",r.toneMapping):"",r.outputEncoding||r.mapEncoding||r.envMapEncoding||r.emissiveMapEncoding?_s.encodings_pars_fragment:"",r.mapEncoding?Gt("mapTexelToLinear",r.mapEncoding):"",r.envMapEncoding?Gt("envMapTexelToLinear",r.envMapEncoding):"",r.emissiveMapEncoding?Gt("emissiveMapTexelToLinear",r.emissiveMapEncoding):"",r.outputEncoding?Wt("linearToOutputTexel",r.outputEncoding):"",r.depthPacking?"#define DEPTH_PACKING "+n.depthPacking:"","\n"].filter(Kt).join("\n")),s=Jt(s,r),s=$t(s,r),u=Jt(u,r),u=$t(u,r),n.isShaderMaterial||(s=Qt(s),u=Qt(u));var b=f+s,x=d+u,_=Vt(i,i.VERTEX_SHADER,b),w=Vt(i,i.FRAGMENT_SHADER,x);i.attachShader(y,_),i.attachShader(y,w),void 0!==n.index0AttributeName?i.bindAttribLocation(y,0,n.index0AttributeName):!0===r.morphTargets&&i.bindAttribLocation(y,0,"position"),i.linkProgram(y);var E=i.getProgramInfoLog(y),M=i.getShaderInfoLog(_),T=i.getShaderInfoLog(w),S=!0,A=!0;!1===i.getProgramParameter(y,i.LINK_STATUS)?(S=!1,console.error("THREE.WebGLProgram: shader error: ",i.getError(),"gl.VALIDATE_STATUS",i.getProgramParameter(y,i.VALIDATE_STATUS),"gl.getProgramInfoLog",E,M,T)):""!==E?console.warn("THREE.WebGLProgram: gl.getProgramInfoLog()",E):""!==M&&""!==T||(A=!1),A&&(this.diagnostics={runnable:S,material:n,programLog:E,vertexShader:{log:M,prefix:f},fragmentShader:{log:T,prefix:d}}),i.deleteShader(_),i.deleteShader(w);var C;this.getUniforms=function(){return void 0===C&&(C=new X(i,y,t)),C};var P;return this.getAttributes=function(){return void 0===P&&(P=Zt(i,y)),P},this.destroy=function(){i.deleteProgram(y),this.program=void 0},Object.defineProperties(this,{uniforms:{get:function(){return console.warn("THREE.WebGLProgram: .uniforms is now .getUniforms()."),this.getUniforms()}},attributes:{get:function(){return console.warn("THREE.WebGLProgram: .attributes is now .getAttributes()."),this.getAttributes()}}}),this.id=Cs++,this.code=e,this.usedTimes=1,this.program=y,this.vertexShader=_,this.fragmentShader=w,this}function ee(t,e){function n(t){if(e.floatVertexTextures&&t&&t.skeleton&&t.skeleton.useVertexTexture)return 1024;var n=e.maxVertexUniforms,r=Math.floor((n-20)/4),i=r;return void 0!==t&&t&&t.isSkinnedMesh&&(i=Math.min(t.skeleton.bones.length,i))0,shadowMapType:t.shadowMap.type,toneMapping:t.toneMapping,physicallyCorrectLights:t.physicallyCorrectLights,premultipliedAlpha:i.premultipliedAlpha,alphaTest:i.alphaTest,doubleSided:i.side===uo,flipSided:i.side===so,depthPacking:void 0!==i.depthPacking&&i.depthPacking}},this.getProgramCode=function(t,e){var n=[];if(e.shaderID?n.push(e.shaderID):(n.push(t.fragmentShader),n.push(t.vertexShader)),void 0!==t.defines)for(var r in t.defines)n.push(r),n.push(t.defines[r]);for(var i=0;i65535?wt:xt)(o,1);return i(d,t.ELEMENT_ARRAY_BUFFER),r.wireframe=d,d}var l=new ne(t,e,n);return{getAttributeBuffer:s,getAttributeProperties:u,getWireframeAttribute:c,update:r}}function ie(t,e,n,r,i,o,a){function s(t,e){if(t.width>e||t.height>e){var n=e/Math.max(t.width,t.height),r=document.createElementNS("http://www.w3.org/1999/xhtml","canvas");r.width=Math.floor(t.width*n),r.height=Math.floor(t.height*n);return r.getContext("2d").drawImage(t,0,0,t.width,t.height,0,0,r.width,r.height),console.warn("THREE.WebGLRenderer: image is too big ("+t.width+"x"+t.height+"). Resized to "+r.width+"x"+r.height,t),r}return t}function u(t){return fs.isPowerOfTwo(t.width)&&fs.isPowerOfTwo(t.height)}function c(t){if(t instanceof HTMLImageElement||t instanceof HTMLCanvasElement){var e=document.createElementNS("http://www.w3.org/1999/xhtml","canvas");e.width=fs.nearestPowerOfTwo(t.width),e.height=fs.nearestPowerOfTwo(t.height);return e.getContext("2d").drawImage(t,0,0,e.width,e.height),console.warn("THREE.WebGLRenderer: image is not power of two ("+t.width+"x"+t.height+"). Resized to "+e.width+"x"+e.height,t),e}return t}function l(t){return t.wrapS!==ua||t.wrapT!==ua||t.minFilter!==la&&t.minFilter!==fa}function h(e){return e===la||e===ha||e===pa?t.NEAREST:t.LINEAR}function p(t){var e=t.target;e.removeEventListener("dispose",p),d(e),A.textures--}function f(t){var e=t.target;e.removeEventListener("dispose",f),m(e),A.textures--}function d(e){var n=r.get(e);if(e.image&&n.__image__webglTextureCube)t.deleteTexture(n.__image__webglTextureCube);else{if(void 0===n.__webglInit)return;t.deleteTexture(n.__webglTexture)}r.delete(e)}function m(e){var n=r.get(e),i=r.get(e.texture);if(e){if(void 0!==i.__webglTexture&&t.deleteTexture(i.__webglTexture),e.depthTexture&&e.depthTexture.dispose(),e.isWebGLRenderTargetCube)for(var o=0;o<6;o++)t.deleteFramebuffer(n.__webglFramebuffer[o]),n.__webglDepthbuffer&&t.deleteRenderbuffer(n.__webglDepthbuffer[o]);else t.deleteFramebuffer(n.__webglFramebuffer),n.__webglDepthbuffer&&t.deleteRenderbuffer(n.__webglDepthbuffer);r.delete(e.texture),r.delete(e)}}function v(e,i){var o=r.get(e);if(e.version>0&&o.__version!==e.version){var a=e.image;if(void 0===a)console.warn("THREE.WebGLRenderer: Texture marked for update but image is undefined",e);else{if(!1!==a.complete)return void x(o,e,i);console.warn("THREE.WebGLRenderer: Texture marked for update but image is incomplete",e)}}n.activeTexture(t.TEXTURE0+i),n.bindTexture(t.TEXTURE_2D,o.__webglTexture)}function g(e,a){var c=r.get(e);if(6===e.image.length)if(e.version>0&&c.__version!==e.version){c.__image__webglTextureCube||(e.addEventListener("dispose",p),c.__image__webglTextureCube=t.createTexture(),A.textures++),n.activeTexture(t.TEXTURE0+a),n.bindTexture(t.TEXTURE_CUBE_MAP,c.__image__webglTextureCube),t.pixelStorei(t.UNPACK_FLIP_Y_WEBGL,e.flipY);for(var l=e&&e.isCompressedTexture,h=e.image[0]&&e.image[0].isDataTexture,f=[],d=0;d<6;d++)f[d]=l||h?h?e.image[d].image:e.image[d]:s(e.image[d],i.maxCubemapSize);var m=f[0],v=u(m),g=o(e.format),y=o(e.type);b(t.TEXTURE_CUBE_MAP,e,v);for(var d=0;d<6;d++)if(l)for(var x,_=f[d].mipmaps,w=0,E=_.length;w-1?n.compressedTexImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+d,w,g,x.width,x.height,0,x.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .setTextureCube()"):n.texImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+d,w,g,x.width,x.height,0,g,y,x.data);else h?n.texImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+d,0,g,f[d].width,f[d].height,0,g,y,f[d].data):n.texImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+d,0,g,g,y,f[d]);e.generateMipmaps&&v&&t.generateMipmap(t.TEXTURE_CUBE_MAP),c.__version=e.version,e.onUpdate&&e.onUpdate(e)}else n.activeTexture(t.TEXTURE0+a),n.bindTexture(t.TEXTURE_CUBE_MAP,c.__image__webglTextureCube)}function y(e,i){n.activeTexture(t.TEXTURE0+i),n.bindTexture(t.TEXTURE_CUBE_MAP,r.get(e).__webglTexture)}function b(n,a,s){var u;if(s?(t.texParameteri(n,t.TEXTURE_WRAP_S,o(a.wrapS)),t.texParameteri(n,t.TEXTURE_WRAP_T,o(a.wrapT)),t.texParameteri(n,t.TEXTURE_MAG_FILTER,o(a.magFilter)),t.texParameteri(n,t.TEXTURE_MIN_FILTER,o(a.minFilter))):(t.texParameteri(n,t.TEXTURE_WRAP_S,t.CLAMP_TO_EDGE),t.texParameteri(n,t.TEXTURE_WRAP_T,t.CLAMP_TO_EDGE),a.wrapS===ua&&a.wrapT===ua||console.warn("THREE.WebGLRenderer: Texture is not power of two. Texture.wrapS and Texture.wrapT should be set to THREE.ClampToEdgeWrapping.",a),t.texParameteri(n,t.TEXTURE_MAG_FILTER,h(a.magFilter)),t.texParameteri(n,t.TEXTURE_MIN_FILTER,h(a.minFilter)),a.minFilter!==la&&a.minFilter!==fa&&console.warn("THREE.WebGLRenderer: Texture is not power of two. Texture.minFilter should be set to THREE.NearestFilter or THREE.LinearFilter.",a)),u=e.get("EXT_texture_filter_anisotropic")){if(a.type===wa&&null===e.get("OES_texture_float_linear"))return;if(a.type===Ea&&null===e.get("OES_texture_half_float_linear"))return;(a.anisotropy>1||r.get(a).__currentAnisotropy)&&(t.texParameterf(n,u.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(a.anisotropy,i.getMaxAnisotropy())),r.get(a).__currentAnisotropy=a.anisotropy)}}function x(e,r,a){void 0===e.__webglInit&&(e.__webglInit=!0,r.addEventListener("dispose",p),e.__webglTexture=t.createTexture(),A.textures++),n.activeTexture(t.TEXTURE0+a),n.bindTexture(t.TEXTURE_2D,e.__webglTexture),t.pixelStorei(t.UNPACK_FLIP_Y_WEBGL,r.flipY),t.pixelStorei(t.UNPACK_PREMULTIPLY_ALPHA_WEBGL,r.premultiplyAlpha),t.pixelStorei(t.UNPACK_ALIGNMENT,r.unpackAlignment);var h=s(r.image,i.maxTextureSize);l(r)&&!1===u(h)&&(h=c(h));var f=u(h),d=o(r.format),m=o(r.type);b(t.TEXTURE_2D,r,f);var v,g=r.mipmaps;if(r.isDepthTexture){var y=t.DEPTH_COMPONENT;if(r.type===wa){if(!C)throw new Error("Float Depth Texture only supported in WebGL2.0");y=t.DEPTH_COMPONENT32F}else C&&(y=t.DEPTH_COMPONENT16);r.format===Na&&y===t.DEPTH_COMPONENT&&r.type!==ba&&r.type!==_a&&(console.warn("THREE.WebGLRenderer: Use UnsignedShortType or UnsignedIntType for DepthFormat DepthTexture."),r.type=ba,m=o(r.type)),r.format===Da&&(y=t.DEPTH_STENCIL,r.type!==Aa&&(console.warn("THREE.WebGLRenderer: Use UnsignedInt248Type for DepthStencilFormat DepthTexture."),r.type=Aa,m=o(r.type))),n.texImage2D(t.TEXTURE_2D,0,y,h.width,h.height,0,d,m,null)}else if(r.isDataTexture)if(g.length>0&&f){for(var x=0,_=g.length;x<_;x++)v=g[x],n.texImage2D(t.TEXTURE_2D,x,d,v.width,v.height,0,d,m,v.data);r.generateMipmaps=!1}else n.texImage2D(t.TEXTURE_2D,0,d,h.width,h.height,0,d,m,h.data);else if(r.isCompressedTexture)for(var x=0,_=g.length;x<_;x++)v=g[x],r.format!==Ra&&r.format!==Pa?n.getCompressedTextureFormats().indexOf(d)>-1?n.compressedTexImage2D(t.TEXTURE_2D,x,d,v.width,v.height,0,v.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()"):n.texImage2D(t.TEXTURE_2D,x,d,v.width,v.height,0,d,m,v.data);else if(g.length>0&&f){for(var x=0,_=g.length;x<_;x++)v=g[x],n.texImage2D(t.TEXTURE_2D,x,d,d,m,v);r.generateMipmaps=!1}else n.texImage2D(t.TEXTURE_2D,0,d,d,m,h);r.generateMipmaps&&f&&t.generateMipmap(t.TEXTURE_2D),e.__version=r.version,r.onUpdate&&r.onUpdate(r)}function _(e,i,a,s){var u=o(i.texture.format),c=o(i.texture.type);n.texImage2D(s,0,u,i.width,i.height,0,u,c,null),t.bindFramebuffer(t.FRAMEBUFFER,e),t.framebufferTexture2D(t.FRAMEBUFFER,a,s,r.get(i.texture).__webglTexture,0),t.bindFramebuffer(t.FRAMEBUFFER,null)}function w(e,n){t.bindRenderbuffer(t.RENDERBUFFER,e),n.depthBuffer&&!n.stencilBuffer?(t.renderbufferStorage(t.RENDERBUFFER,t.DEPTH_COMPONENT16,n.width,n.height),t.framebufferRenderbuffer(t.FRAMEBUFFER,t.DEPTH_ATTACHMENT,t.RENDERBUFFER,e)):n.depthBuffer&&n.stencilBuffer?(t.renderbufferStorage(t.RENDERBUFFER,t.DEPTH_STENCIL,n.width,n.height),t.framebufferRenderbuffer(t.FRAMEBUFFER,t.DEPTH_STENCIL_ATTACHMENT,t.RENDERBUFFER,e)):t.renderbufferStorage(t.RENDERBUFFER,t.RGBA4,n.width,n.height),t.bindRenderbuffer(t.RENDERBUFFER,null)}function E(e,n){if(n&&n.isWebGLRenderTargetCube)throw new Error("Depth Texture with cube render targets is not supported!");if(t.bindFramebuffer(t.FRAMEBUFFER,e),!n.depthTexture||!n.depthTexture.isDepthTexture)throw new Error("renderTarget.depthTexture must be an instance of THREE.DepthTexture");r.get(n.depthTexture).__webglTexture&&n.depthTexture.image.width===n.width&&n.depthTexture.image.height===n.height||(n.depthTexture.image.width=n.width,n.depthTexture.image.height=n.height,n.depthTexture.needsUpdate=!0),v(n.depthTexture,0);var i=r.get(n.depthTexture).__webglTexture;if(n.depthTexture.format===Na)t.framebufferTexture2D(t.FRAMEBUFFER,t.DEPTH_ATTACHMENT,t.TEXTURE_2D,i,0);else{if(n.depthTexture.format!==Da)throw new Error("Unknown depthTexture format");t.framebufferTexture2D(t.FRAMEBUFFER,t.DEPTH_STENCIL_ATTACHMENT,t.TEXTURE_2D,i,0)}}function M(e){var n=r.get(e),i=!0===e.isWebGLRenderTargetCube;if(e.depthTexture){if(i)throw new Error("target.depthTexture not supported in Cube render targets");E(n.__webglFramebuffer,e)}else if(i){n.__webglDepthbuffer=[];for(var o=0;o<6;o++)t.bindFramebuffer(t.FRAMEBUFFER,n.__webglFramebuffer[o]),n.__webglDepthbuffer[o]=t.createRenderbuffer(),w(n.__webglDepthbuffer[o],e)}else t.bindFramebuffer(t.FRAMEBUFFER,n.__webglFramebuffer),n.__webglDepthbuffer=t.createRenderbuffer(),w(n.__webglDepthbuffer,e);t.bindFramebuffer(t.FRAMEBUFFER,null)}function T(e){var i=r.get(e),o=r.get(e.texture);e.addEventListener("dispose",f),o.__webglTexture=t.createTexture(),A.textures++;var a=!0===e.isWebGLRenderTargetCube,s=u(e);if(a){i.__webglFramebuffer=[];for(var c=0;c<6;c++)i.__webglFramebuffer[c]=t.createFramebuffer()}else i.__webglFramebuffer=t.createFramebuffer();if(a){n.bindTexture(t.TEXTURE_CUBE_MAP,o.__webglTexture),b(t.TEXTURE_CUBE_MAP,e.texture,s);for(var c=0;c<6;c++)_(i.__webglFramebuffer[c],e,t.COLOR_ATTACHMENT0,t.TEXTURE_CUBE_MAP_POSITIVE_X+c);e.texture.generateMipmaps&&s&&t.generateMipmap(t.TEXTURE_CUBE_MAP),n.bindTexture(t.TEXTURE_CUBE_MAP,null)}else n.bindTexture(t.TEXTURE_2D,o.__webglTexture),b(t.TEXTURE_2D,e.texture,s),_(i.__webglFramebuffer,e,t.COLOR_ATTACHMENT0,t.TEXTURE_2D),e.texture.generateMipmaps&&s&&t.generateMipmap(t.TEXTURE_2D),n.bindTexture(t.TEXTURE_2D,null);e.depthBuffer&&M(e)}function S(e){var i=e.texture;if(i.generateMipmaps&&u(e)&&i.minFilter!==la&&i.minFilter!==fa){var o=e&&e.isWebGLRenderTargetCube?t.TEXTURE_CUBE_MAP:t.TEXTURE_2D,a=r.get(i).__webglTexture;n.bindTexture(o,a),t.generateMipmap(o),n.bindTexture(o,null)}}var A=a.memory,C="undefined"!=typeof WebGL2RenderingContext&&t instanceof WebGL2RenderingContext;this.setTexture2D=v,this.setTextureCube=g,this.setTextureCubeDynamic=y,this.setupRenderTarget=T,this.updateRenderTargetMipmap=S}function oe(){var t={};return{get:function(e){var n=e.uuid,r=t[n];return void 0===r&&(r={},t[n]=r),r},delete:function(e){delete t[e.uuid]},clear:function(){t={}}}}function ae(t,e,n){function r(){var e=!1,n=new a,r=null,i=new a;return{setMask:function(n){r===n||e||(t.colorMask(n,n,n,n),r=n)},setLocked:function(t){e=t},setClear:function(e,r,o,a,s){!0===s&&(e*=a,r*=a,o*=a),n.set(e,r,o,a),!1===i.equals(n)&&(t.clearColor(e,r,o,a),i.copy(n))},reset:function(){e=!1,r=null,i.set(0,0,0,1)}}}function i(){var e=!1,n=null,r=null,i=null;return{setTest:function(e){e?f(t.DEPTH_TEST):d(t.DEPTH_TEST)},setMask:function(r){n===r||e||(t.depthMask(r),n=r)},setFunc:function(e){if(r!==e){if(e)switch(e){case Uo:t.depthFunc(t.NEVER);break;case Fo:t.depthFunc(t.ALWAYS);break;case jo:t.depthFunc(t.LESS);break;case Bo:t.depthFunc(t.LEQUAL);break;case zo:t.depthFunc(t.EQUAL);break;case Vo:t.depthFunc(t.GEQUAL);break;case Ho:t.depthFunc(t.GREATER);break;case Go:t.depthFunc(t.NOTEQUAL);break;default:t.depthFunc(t.LEQUAL)}else t.depthFunc(t.LEQUAL);r=e}},setLocked:function(t){e=t},setClear:function(e){i!==e&&(t.clearDepth(e),i=e)},reset:function(){e=!1,n=null,r=null,i=null}}}function o(){var e=!1,n=null,r=null,i=null,o=null,a=null,s=null,u=null,c=null;return{setTest:function(e){e?f(t.STENCIL_TEST):d(t.STENCIL_TEST)},setMask:function(r){n===r||e||(t.stencilMask(r),n=r)},setFunc:function(e,n,a){r===e&&i===n&&o===a||(t.stencilFunc(e,n,a),r=e,i=n,o=a)},setOp:function(e,n,r){a===e&&s===n&&u===r||(t.stencilOp(e,n,r),a=e,s=n,u=r)},setLocked:function(t){e=t},setClear:function(e){c!==e&&(t.clearStencil(e),c=e)},reset:function(){e=!1,n=null,r=null,i=null,o=null,a=null,s=null,u=null,c=null}}}function s(e,n,r){var i=new Uint8Array(4),o=t.createTexture();t.bindTexture(e,o),t.texParameteri(e,t.TEXTURE_MIN_FILTER,t.NEAREST),t.texParameteri(e,t.TEXTURE_MAG_FILTER,t.NEAREST);for(var a=0;a=1,lt=null,ht={},pt=new a,ft=new a,dt={};return dt[t.TEXTURE_2D]=s(t.TEXTURE_2D,t.TEXTURE_2D,1),dt[t.TEXTURE_CUBE_MAP]=s(t.TEXTURE_CUBE_MAP,t.TEXTURE_CUBE_MAP_POSITIVE_X,6),{buffers:{color:F,depth:j,stencil:B},init:u,initAttributes:c,enableAttribute:l,enableAttributeAndDivisor:h,disableUnusedAttributes:p,enable:f,disable:d,getCompressedTextureFormats:m,setBlending:v,setColorWrite:g,setDepthTest:y,setDepthWrite:b,setDepthFunc:x,setStencilTest:_,setStencilWrite:w,setStencilFunc:E,setStencilOp:M,setFlipSided:T,setCullFace:S,setLineWidth:A,setPolygonOffset:C,getScissorTest:P,setScissorTest:R,activeTexture:L,bindTexture:O,compressedTexImage2D:I,texImage2D:N,scissor:D,viewport:k,reset:U}}function se(t,e,n){function r(){if(void 0!==o)return o;var n=e.get("EXT_texture_filter_anisotropic");return o=null!==n?t.getParameter(n.MAX_TEXTURE_MAX_ANISOTROPY_EXT):0}function i(e){if("highp"===e){if(t.getShaderPrecisionFormat(t.VERTEX_SHADER,t.HIGH_FLOAT).precision>0&&t.getShaderPrecisionFormat(t.FRAGMENT_SHADER,t.HIGH_FLOAT).precision>0)return"highp";e="mediump"}return"mediump"===e&&t.getShaderPrecisionFormat(t.VERTEX_SHADER,t.MEDIUM_FLOAT).precision>0&&t.getShaderPrecisionFormat(t.FRAGMENT_SHADER,t.MEDIUM_FLOAT).precision>0?"mediump":"lowp"}var o,a=void 0!==n.precision?n.precision:"highp",s=i(a);s!==a&&(console.warn("THREE.WebGLRenderer:",a,"not supported, using",s,"instead."),a=s);var u=!0===n.logarithmicDepthBuffer&&!!e.get("EXT_frag_depth"),c=t.getParameter(t.MAX_TEXTURE_IMAGE_UNITS),l=t.getParameter(t.MAX_VERTEX_TEXTURE_IMAGE_UNITS),h=t.getParameter(t.MAX_TEXTURE_SIZE),p=t.getParameter(t.MAX_CUBE_MAP_TEXTURE_SIZE),f=t.getParameter(t.MAX_VERTEX_ATTRIBS),d=t.getParameter(t.MAX_VERTEX_UNIFORM_VECTORS),m=t.getParameter(t.MAX_VARYING_VECTORS),v=t.getParameter(t.MAX_FRAGMENT_UNIFORM_VECTORS),g=l>0,y=!!e.get("OES_texture_float");return{getMaxAnisotropy:r,getMaxPrecision:i,precision:a,logarithmicDepthBuffer:u,maxTextures:c,maxVertexTextures:l,maxTextureSize:h,maxCubemapSize:p,maxAttributes:f,maxVertexUniforms:d,maxVaryings:m,maxFragmentUniforms:v,vertexTextures:g,floatFragmentTextures:y,floatVertexTextures:g&&y}}function ue(t){var e={};return{get:function(n){if(void 0!==e[n])return e[n];var r;switch(n){case"WEBGL_depth_texture":r=t.getExtension("WEBGL_depth_texture")||t.getExtension("MOZ_WEBGL_depth_texture")||t.getExtension("WEBKIT_WEBGL_depth_texture");break;case"EXT_texture_filter_anisotropic":r=t.getExtension("EXT_texture_filter_anisotropic")||t.getExtension("MOZ_EXT_texture_filter_anisotropic")||t.getExtension("WEBKIT_EXT_texture_filter_anisotropic");break;case"WEBGL_compressed_texture_s3tc":r=t.getExtension("WEBGL_compressed_texture_s3tc")||t.getExtension("MOZ_WEBGL_compressed_texture_s3tc")||t.getExtension("WEBKIT_WEBGL_compressed_texture_s3tc");break;case"WEBGL_compressed_texture_pvrtc":r=t.getExtension("WEBGL_compressed_texture_pvrtc")||t.getExtension("WEBKIT_WEBGL_compressed_texture_pvrtc");break;case"WEBGL_compressed_texture_etc1":r=t.getExtension("WEBGL_compressed_texture_etc1");break;default:r=t.getExtension(n)}return null===r&&console.warn("THREE.WebGLRenderer: "+n+" extension not supported."),e[n]=r,r}}}function ce(){function t(){c.value!==r&&(c.value=r,c.needsUpdate=i>0),n.numPlanes=i,n.numIntersection=0}function e(t,e,r,i){var o=null!==t?t.length:0,a=null;if(0!==o){if(a=c.value,!0!==i||null===a){var l=r+4*o,h=e.matrixWorldInverse;u.getNormalMatrix(h),(null===a||a.length=0){var l=o[u];if(void 0!==l){var h=l.normalized,p=l.itemSize,f=he.getAttributeProperties(l),d=f.__webglBuffer,m=f.type,v=f.bytesPerElement;if(l.isInterleavedBufferAttribute){var g=l.data,y=g.stride,b=l.offset;g&&g.isInstancedInterleavedBuffer?(te.enableAttributeAndDivisor(c,g.meshPerAttribute,i),void 0===n.maxInstancedCount&&(n.maxInstancedCount=g.meshPerAttribute*g.count)):te.enableAttribute(c),Kt.bindBuffer(Kt.ARRAY_BUFFER,d),Kt.vertexAttribPointer(c,p,m,h,y*v,(r*y+b)*v)}else l.isInstancedBufferAttribute?(te.enableAttributeAndDivisor(c,l.meshPerAttribute,i),void 0===n.maxInstancedCount&&(n.maxInstancedCount=l.meshPerAttribute*l.count)):te.enableAttribute(c),Kt.bindBuffer(Kt.ARRAY_BUFFER,d),Kt.vertexAttribPointer(c,p,m,h,0,r*p*v)}else if(void 0!==s){var x=s[u];if(void 0!==x)switch(x.length){case 2:Kt.vertexAttrib2fv(c,x);break;case 3:Kt.vertexAttrib3fv(c,x);break;case 4:Kt.vertexAttrib4fv(c,x);break;default:Kt.vertexAttrib1fv(c,x)}}}}te.disableUnusedAttributes()}function p(t,e){return Math.abs(e[0])-Math.abs(t[0])}function f(t,e){return t.object.renderOrder!==e.object.renderOrder?t.object.renderOrder-e.object.renderOrder:t.material.program&&e.material.program&&t.material.program!==e.material.program?t.material.program.id-e.material.program.id:t.material.id!==e.material.id?t.material.id-e.material.id:t.z!==e.z?t.z-e.z:t.id-e.id}function d(t,e){return t.object.renderOrder!==e.object.renderOrder?t.object.renderOrder-e.object.renderOrder:t.z!==e.z?e.z-t.z:t.id-e.id}function m(t,e,n,r,i){var o,a;n.transparent?(o=rt,a=++it):(o=tt,a=++et);var s=o[a];void 0!==s?(s.id=t.id,s.object=t,s.geometry=e,s.material=n,s.z=Wt.z,s.group=i):(s={id:t.id,object:t,geometry:e,material:n,z:Wt.z,group:i},o.push(s))}function v(t){var e=t.geometry;return null===e.boundingSphere&&e.computeBoundingSphere(),Ht.copy(e.boundingSphere).applyMatrix4(t.matrixWorld),y(Ht)}function g(t){return Ht.center.set(0,0,0),Ht.radius=.7071067811865476,Ht.applyMatrix4(t.matrixWorld),y(Ht)}function y(t){if(!It.intersectsSphere(t))return!1;var e=Dt.numPlanes;if(0===e)return!0;var n=lt.clippingPlanes,r=t.center,i=-t.radius,o=0;do{if(n[o].distanceToPoint(r)=0&&t.numSupportedMorphTargets++}if(t.morphNormals){t.numSupportedMorphNormals=0;for(var p=0;p=0&&t.numSupportedMorphNormals++}var f=r.__webglShader.uniforms;(t.isShaderMaterial||t.isRawShaderMaterial)&&!0!==t.clipping||(r.numClippingPlanes=Dt.numPlanes,r.numIntersection=Dt.numIntersection,f.clippingPlanes=Dt.uniform),r.fog=e,r.lightsHash=Yt.hash,t.lights&&(f.ambientLightColor.value=Yt.ambient,f.directionalLights.value=Yt.directional,f.spotLights.value=Yt.spot,f.rectAreaLights.value=Yt.rectArea,f.pointLights.value=Yt.point,f.hemisphereLights.value=Yt.hemi,f.directionalShadowMap.value=Yt.directionalShadowMap,f.directionalShadowMatrix.value=Yt.directionalShadowMatrix,f.spotShadowMap.value=Yt.spotShadowMap,f.spotShadowMatrix.value=Yt.spotShadowMatrix,f.pointShadowMap.value=Yt.pointShadowMap,f.pointShadowMatrix.value=Yt.pointShadowMatrix);var d=r.program.getUniforms(),m=X.seqWithValue(d.seq,f);r.uniformsList=m}function w(t){t.side===uo?te.disable(Kt.CULL_FACE):te.enable(Kt.CULL_FACE),te.setFlipSided(t.side===so),!0===t.transparent?te.setBlending(t.blending,t.blendEquation,t.blendSrc,t.blendDst,t.blendEquationAlpha,t.blendSrcAlpha,t.blendDstAlpha,t.premultipliedAlpha):te.setBlending(mo),te.setDepthFunc(t.depthFunc),te.setDepthTest(t.depthTest),te.setDepthWrite(t.depthWrite),te.setColorWrite(t.colorWrite),te.setPolygonOffset(t.polygonOffset,t.polygonOffsetFactor,t.polygonOffsetUnits)}function E(t,e,n,r){_t=0;var i=ne.get(n);if(zt&&(Vt||t!==gt)){var o=t===gt&&n.id===mt;Dt.setState(n.clippingPlanes,n.clipIntersection,n.clipShadows,t,i,o)}!1===n.needsUpdate&&(void 0===i.program?n.needsUpdate=!0:n.fog&&i.fog!==e?n.needsUpdate=!0:n.lights&&i.lightsHash!==Yt.hash?n.needsUpdate=!0:void 0===i.numClippingPlanes||i.numClippingPlanes===Dt.numPlanes&&i.numIntersection===Dt.numIntersection||(n.needsUpdate=!0)),n.needsUpdate&&(_(n,e,r),n.needsUpdate=!1);var a=!1,s=!1,u=!1,c=i.program,l=c.getUniforms(),h=i.__webglShader.uniforms;if(c.id!==ht&&(Kt.useProgram(c.program),ht=c.id,a=!0,s=!0,u=!0),n.id!==mt&&(mt=n.id,s=!0),a||t!==gt){if(l.set(Kt,t,"projectionMatrix"),Qt.logarithmicDepthBuffer&&l.setValue(Kt,"logDepthBufFC",2/(Math.log(t.far+1)/Math.LN2)),t!==gt&&(gt=t,s=!0,u=!0),n.isShaderMaterial||n.isMeshPhongMaterial||n.isMeshStandardMaterial||n.envMap){var p=l.map.cameraPosition;void 0!==p&&p.setValue(Kt,Wt.setFromMatrixPosition(t.matrixWorld))}(n.isMeshPhongMaterial||n.isMeshLambertMaterial||n.isMeshBasicMaterial||n.isMeshStandardMaterial||n.isShaderMaterial||n.skinning)&&l.setValue(Kt,"viewMatrix",t.matrixWorldInverse),l.set(Kt,lt,"toneMappingExposure"),l.set(Kt,lt,"toneMappingWhitePoint")}if(n.skinning){l.setOptional(Kt,r,"bindMatrix"),l.setOptional(Kt,r,"bindMatrixInverse");var f=r.skeleton;f&&(Qt.floatVertexTextures&&f.useVertexTexture?(l.set(Kt,f,"boneTexture"),l.set(Kt,f,"boneTextureWidth"),l.set(Kt,f,"boneTextureHeight")):l.setOptional(Kt,f,"boneMatrices"))}return s&&(n.lights&&D(h,u),e&&n.fog&&C(h,e),(n.isMeshBasicMaterial||n.isMeshLambertMaterial||n.isMeshPhongMaterial||n.isMeshStandardMaterial||n.isMeshNormalMaterial||n.isMeshDepthMaterial)&&M(h,n),n.isLineBasicMaterial?T(h,n):n.isLineDashedMaterial?(T(h,n),S(h,n)):n.isPointsMaterial?A(h,n):n.isMeshLambertMaterial?P(h,n):n.isMeshToonMaterial?L(h,n):n.isMeshPhongMaterial?R(h,n):n.isMeshPhysicalMaterial?I(h,n):n.isMeshStandardMaterial?O(h,n):n.isMeshDepthMaterial?n.displacementMap&&(h.displacementMap.value=n.displacementMap,h.displacementScale.value=n.displacementScale,h.displacementBias.value=n.displacementBias):n.isMeshNormalMaterial&&N(h,n),void 0!==h.ltcMat&&(h.ltcMat.value=THREE.UniformsLib.LTC_MAT_TEXTURE),void 0!==h.ltcMag&&(h.ltcMag.value=THREE.UniformsLib.LTC_MAG_TEXTURE),X.upload(Kt,i.uniformsList,h,lt)),l.set(Kt,r,"modelViewMatrix"),l.set(Kt,r,"normalMatrix"),l.setValue(Kt,"modelMatrix",r.matrixWorld),c}function M(t,e){t.opacity.value=e.opacity,t.diffuse.value=e.color,e.emissive&&t.emissive.value.copy(e.emissive).multiplyScalar(e.emissiveIntensity),t.map.value=e.map,t.specularMap.value=e.specularMap,t.alphaMap.value=e.alphaMap,e.lightMap&&(t.lightMap.value=e.lightMap,t.lightMapIntensity.value=e.lightMapIntensity),e.aoMap&&(t.aoMap.value=e.aoMap,t.aoMapIntensity.value=e.aoMapIntensity);var n;if(e.map?n=e.map:e.specularMap?n=e.specularMap:e.displacementMap?n=e.displacementMap:e.normalMap?n=e.normalMap:e.bumpMap?n=e.bumpMap:e.roughnessMap?n=e.roughnessMap:e.metalnessMap?n=e.metalnessMap:e.alphaMap?n=e.alphaMap:e.emissiveMap&&(n=e.emissiveMap),void 0!==n){n.isWebGLRenderTarget&&(n=n.texture);var r=n.offset,i=n.repeat;t.offsetRepeat.value.set(r.x,r.y,i.x,i.y)}t.envMap.value=e.envMap,t.flipEnvMap.value=e.envMap&&e.envMap.isCubeTexture?-1:1,t.reflectivity.value=e.reflectivity,t.refractionRatio.value=e.refractionRatio}function T(t,e){t.diffuse.value=e.color,t.opacity.value=e.opacity}function S(t,e){t.dashSize.value=e.dashSize,t.totalSize.value=e.dashSize+e.gapSize,t.scale.value=e.scale}function A(t,e){if(t.diffuse.value=e.color,t.opacity.value=e.opacity,t.size.value=e.size*St,t.scale.value=.5*Tt,t.map.value=e.map,null!==e.map){var n=e.map.offset,r=e.map.repeat;t.offsetRepeat.value.set(n.x,n.y,r.x,r.y)}}function C(t,e){t.fogColor.value=e.color,e.isFog?(t.fogNear.value=e.near,t.fogFar.value=e.far):e.isFogExp2&&(t.fogDensity.value=e.density)}function P(t,e){e.emissiveMap&&(t.emissiveMap.value=e.emissiveMap)}function R(t,e){t.specular.value=e.specular,t.shininess.value=Math.max(e.shininess,1e-4),e.emissiveMap&&(t.emissiveMap.value=e.emissiveMap),e.bumpMap&&(t.bumpMap.value=e.bumpMap,t.bumpScale.value=e.bumpScale),e.normalMap&&(t.normalMap.value=e.normalMap,t.normalScale.value.copy(e.normalScale)),e.displacementMap&&(t.displacementMap.value=e.displacementMap,t.displacementScale.value=e.displacementScale,t.displacementBias.value=e.displacementBias)}function L(t,e){R(t,e),e.gradientMap&&(t.gradientMap.value=e.gradientMap)}function O(t,e){t.roughness.value=e.roughness,t.metalness.value=e.metalness,e.roughnessMap&&(t.roughnessMap.value=e.roughnessMap),e.metalnessMap&&(t.metalnessMap.value=e.metalnessMap),e.emissiveMap&&(t.emissiveMap.value=e.emissiveMap),e.bumpMap&&(t.bumpMap.value=e.bumpMap,t.bumpScale.value=e.bumpScale),e.normalMap&&(t.normalMap.value=e.normalMap,t.normalScale.value.copy(e.normalScale)),e.displacementMap&&(t.displacementMap.value=e.displacementMap,t.displacementScale.value=e.displacementScale,t.displacementBias.value=e.displacementBias),e.envMap&&(t.envMapIntensity.value=e.envMapIntensity)}function I(t,e){t.clearCoat.value=e.clearCoat,t.clearCoatRoughness.value=e.clearCoatRoughness,O(t,e)}function N(t,e){e.bumpMap&&(t.bumpMap.value=e.bumpMap,t.bumpScale.value=e.bumpScale),e.normalMap&&(t.normalMap.value=e.normalMap,t.normalScale.value.copy(e.normalScale)),e.displacementMap&&(t.displacementMap.value=e.displacementMap,t.displacementScale.value=e.displacementScale,t.displacementBias.value=e.displacementBias)}function D(t,e){t.ambientLightColor.needsUpdate=e,t.directionalLights.needsUpdate=e,t.pointLights.needsUpdate=e,t.spotLights.needsUpdate=e,t.rectAreaLights.needsUpdate=e,t.hemisphereLights.needsUpdate=e}function k(t){for(var e=0,n=0,r=t.length;n=Qt.maxTextures&&console.warn("WebGLRenderer: trying to use "+t+" texture units while this GPU supports only "+Qt.maxTextures),_t+=1,t}function j(t){var e;if(t===sa)return Kt.REPEAT;if(t===ua)return Kt.CLAMP_TO_EDGE;if(t===ca)return Kt.MIRRORED_REPEAT;if(t===la)return Kt.NEAREST;if(t===ha)return Kt.NEAREST_MIPMAP_NEAREST;if(t===pa)return Kt.NEAREST_MIPMAP_LINEAR;if(t===fa)return Kt.LINEAR;if(t===da)return Kt.LINEAR_MIPMAP_NEAREST;if(t===ma)return Kt.LINEAR_MIPMAP_LINEAR;if(t===va)return Kt.UNSIGNED_BYTE;if(t===Ma)return Kt.UNSIGNED_SHORT_4_4_4_4;if(t===Ta)return Kt.UNSIGNED_SHORT_5_5_5_1;if(t===Sa)return Kt.UNSIGNED_SHORT_5_6_5;if(t===ga)return Kt.BYTE;if(t===ya)return Kt.SHORT;if(t===ba)return Kt.UNSIGNED_SHORT;if(t===xa)return Kt.INT;if(t===_a)return Kt.UNSIGNED_INT;if(t===wa)return Kt.FLOAT;if(t===Ea&&null!==(e=Jt.get("OES_texture_half_float")))return e.HALF_FLOAT_OES;if(t===Ca)return Kt.ALPHA;if(t===Pa)return Kt.RGB;if(t===Ra)return Kt.RGBA;if(t===La)return Kt.LUMINANCE;if(t===Oa)return Kt.LUMINANCE_ALPHA;if(t===Na)return Kt.DEPTH_COMPONENT;if(t===Da)return Kt.DEPTH_STENCIL;if(t===_o)return Kt.FUNC_ADD;if(t===wo)return Kt.FUNC_SUBTRACT;if(t===Eo)return Kt.FUNC_REVERSE_SUBTRACT;if(t===So)return Kt.ZERO;if(t===Ao)return Kt.ONE;if(t===Co)return Kt.SRC_COLOR;if(t===Po)return Kt.ONE_MINUS_SRC_COLOR;if(t===Ro)return Kt.SRC_ALPHA;if(t===Lo)return Kt.ONE_MINUS_SRC_ALPHA;if(t===Oo)return Kt.DST_ALPHA;if(t===Io)return Kt.ONE_MINUS_DST_ALPHA;if(t===No)return Kt.DST_COLOR;if(t===Do)return Kt.ONE_MINUS_DST_COLOR;if(t===ko)return Kt.SRC_ALPHA_SATURATE;if((t===ka||t===Ua||t===Fa||t===ja)&&null!==(e=Jt.get("WEBGL_compressed_texture_s3tc"))){if(t===ka)return e.COMPRESSED_RGB_S3TC_DXT1_EXT;if(t===Ua)return e.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(t===Fa)return e.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(t===ja)return e.COMPRESSED_RGBA_S3TC_DXT5_EXT}if((t===Ba||t===za||t===Va||t===Ha)&&null!==(e=Jt.get("WEBGL_compressed_texture_pvrtc"))){if(t===Ba)return e.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(t===za)return e.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(t===Va)return e.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(t===Ha)return e.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}if(t===Ga&&null!==(e=Jt.get("WEBGL_compressed_texture_etc1")))return e.COMPRESSED_RGB_ETC1_WEBGL;if((t===Mo||t===To)&&null!==(e=Jt.get("EXT_blend_minmax"))){if(t===Mo)return e.MIN_EXT;if(t===To)return e.MAX_EXT}return t===Aa&&null!==(e=Jt.get("WEBGL_depth_texture"))?e.UNSIGNED_INT_24_8_WEBGL:0}console.log("THREE.WebGLRenderer",Zi),t=t||{};var B=void 0!==t.canvas?t.canvas:document.createElementNS("http://www.w3.org/1999/xhtml","canvas"),z=void 0!==t.context?t.context:null,V=void 0!==t.alpha&&t.alpha,H=void 0===t.depth||t.depth,G=void 0===t.stencil||t.stencil,W=void 0!==t.antialias&&t.antialias,Y=void 0===t.premultipliedAlpha||t.premultipliedAlpha,Z=void 0!==t.preserveDrawingBuffer&&t.preserveDrawingBuffer,J=[],tt=[],et=-1,rt=[],it=-1,st=new Float32Array(8),ut=[],ct=[];this.domElement=B,this.context=null,this.autoClear=!0,this.autoClearColor=!0,this.autoClearDepth=!0,this.autoClearStencil=!0,this.sortObjects=!0,this.clippingPlanes=[],this.localClippingEnabled=!1,this.gammaFactor=2,this.gammaInput=!1,this.gammaOutput=!1,this.physicallyCorrectLights=!1,this.toneMapping=Zo,this.toneMappingExposure=1,this.toneMappingWhitePoint=1,this.maxMorphTargets=8,this.maxMorphNormals=4;var lt=this,ht=null,pt=null,ft=null,mt=-1,vt="",gt=null,yt=new a,bt=null,xt=new a,_t=0,wt=new q(0),Et=0,Mt=B.width,Tt=B.height,St=1,At=new a(0,0,Mt,Tt),Ct=!1,Lt=new a(0,0,Mt,Tt),It=new ot,Dt=new ce,zt=!1,Vt=!1,Ht=new nt,Gt=new h,Wt=new l,Xt=new h,qt=new h,Yt={hash:"",ambient:[0,0,0],directional:[],directionalShadowMap:[],directionalShadowMatrix:[],spot:[],spotShadowMap:[],spotShadowMatrix:[],rectArea:[],point:[],pointShadowMap:[],pointShadowMatrix:[],hemi:[],shadows:[]},Zt={calls:0,vertices:0,faces:0,points:0};this.info={render:Zt,memory:{geometries:0,textures:0},programs:null};var Kt;try{var $t={alpha:V,depth:H,stencil:G,antialias:W,premultipliedAlpha:Y,preserveDrawingBuffer:Z};if(null===(Kt=z||B.getContext("webgl",$t)||B.getContext("experimental-webgl",$t)))throw null!==B.getContext("webgl")?"Error creating WebGL context with your selected attributes.":"Error creating WebGL context.";void 0===Kt.getShaderPrecisionFormat&&(Kt.getShaderPrecisionFormat=function(){return{rangeMin:1,rangeMax:1,precision:1}}),B.addEventListener("webglcontextlost",i,!1)}catch(t){console.error("THREE.WebGLRenderer: "+t)}var Jt=new ue(Kt);Jt.get("WEBGL_depth_texture"),Jt.get("OES_texture_float"),Jt.get("OES_texture_float_linear"),Jt.get("OES_texture_half_float"),Jt.get("OES_texture_half_float_linear"),Jt.get("OES_standard_derivatives"),Jt.get("ANGLE_instanced_arrays"),Jt.get("OES_element_index_uint")&&(Pt.MaxIndex=4294967296);var Qt=new se(Kt,Jt,t),te=new ae(Kt,Jt,j),ne=new oe,le=new ie(Kt,Jt,te,ne,Qt,j,this.info),he=new re(Kt,ne,this.info),pe=new ee(this,Qt),fe=new Bt;this.info.programs=pe.programs;var de,me,ve,ge,ye=new jt(Kt,Jt,Zt),be=new Ft(Kt,Jt,Zt);n(),this.context=Kt,this.capabilities=Qt,this.extensions=Jt,this.properties=ne,this.state=te;var xe=new at(this,Yt,he,Qt);this.shadowMap=xe;var _e=new $(this,ut),we=new K(this,ct);this.getContext=function(){return Kt},this.getContextAttributes=function(){return Kt.getContextAttributes()},this.forceContextLoss=function(){Jt.get("WEBGL_lose_context").loseContext()},this.getMaxAnisotropy=function(){return Qt.getMaxAnisotropy()},this.getPrecision=function(){return Qt.precision},this.getPixelRatio=function(){return St},this.setPixelRatio=function(t){void 0!==t&&(St=t,this.setSize(Lt.z,Lt.w,!1))},this.getSize=function(){return{width:Mt,height:Tt}},this.setSize=function(t,e,n){Mt=t,Tt=e,B.width=t*St,B.height=e*St,!1!==n&&(B.style.width=t+"px",B.style.height=e+"px"),this.setViewport(0,0,t,e)},this.setViewport=function(t,e,n,r){te.viewport(Lt.set(t,e,n,r))},this.setScissor=function(t,e,n,r){te.scissor(At.set(t,e,n,r))},this.setScissorTest=function(t){te.setScissorTest(Ct=t)},this.getClearColor=function(){return wt},this.setClearColor=function(t,e){wt.set(t),Et=void 0!==e?e:1,te.buffers.color.setClear(wt.r,wt.g,wt.b,Et,Y)},this.getClearAlpha=function(){return Et},this.setClearAlpha=function(t){Et=t,te.buffers.color.setClear(wt.r,wt.g,wt.b,Et,Y)},this.clear=function(t,e,n){var r=0;(void 0===t||t)&&(r|=Kt.COLOR_BUFFER_BIT),(void 0===e||e)&&(r|=Kt.DEPTH_BUFFER_BIT),(void 0===n||n)&&(r|=Kt.STENCIL_BUFFER_BIT),Kt.clear(r)},this.clearColor=function(){this.clear(!0,!1,!1)},this.clearDepth=function(){this.clear(!1,!0,!1)},this.clearStencil=function(){this.clear(!1,!1,!0)},this.clearTarget=function(t,e,n,r){this.setRenderTarget(t),this.clear(e,n,r)},this.resetGLState=r,this.dispose=function(){rt=[],it=-1,tt=[],et=-1,B.removeEventListener("webglcontextlost",i,!1)},this.renderBufferImmediate=function(t,e,n){te.initAttributes();var r=ne.get(t);t.hasPositions&&!r.position&&(r.position=Kt.createBuffer()),t.hasNormals&&!r.normal&&(r.normal=Kt.createBuffer()),t.hasUvs&&!r.uv&&(r.uv=Kt.createBuffer()),t.hasColors&&!r.color&&(r.color=Kt.createBuffer());var i=e.getAttributes();if(t.hasPositions&&(Kt.bindBuffer(Kt.ARRAY_BUFFER,r.position),Kt.bufferData(Kt.ARRAY_BUFFER,t.positionArray,Kt.DYNAMIC_DRAW),te.enableAttribute(i.position),Kt.vertexAttribPointer(i.position,3,Kt.FLOAT,!1,0,0)),t.hasNormals){if(Kt.bindBuffer(Kt.ARRAY_BUFFER,r.normal),!n.isMeshPhongMaterial&&!n.isMeshStandardMaterial&&!n.isMeshNormalMaterial&&n.shading===co)for(var o=0,a=3*t.count;o8&&(f.length=8);for(var g=r.morphAttributes,d=0,m=f.length;d0&&M.renderInstances(r,R,O):M.render(R,O)}},this.render=function(t,e,n,r){if(void 0!==e&&!0!==e.isCamera)return void console.error("THREE.WebGLRenderer.render: camera is not an instance of THREE.Camera.");vt="",mt=-1,gt=null,!0===t.autoUpdate&&t.updateMatrixWorld(),null===e.parent&&e.updateMatrixWorld(),e.matrixWorldInverse.getInverse(e.matrixWorld),Gt.multiplyMatrices(e.projectionMatrix,e.matrixWorldInverse),It.setFromMatrix(Gt),J.length=0,et=-1,it=-1,ut.length=0,ct.length=0,Vt=this.localClippingEnabled,zt=Dt.init(this.clippingPlanes,Vt,e),b(t,e),tt.length=et+1,rt.length=it+1,!0===lt.sortObjects&&(tt.sort(f),rt.sort(d)),zt&&Dt.beginShadows(),k(J),xe.render(t,e),U(J,e),zt&&Dt.endShadows(),Zt.calls=0,Zt.vertices=0,Zt.faces=0,Zt.points=0,void 0===n&&(n=null),this.setRenderTarget(n);var i=t.background;if(null===i?te.buffers.color.setClear(wt.r,wt.g,wt.b,Et,Y):i&&i.isColor&&(te.buffers.color.setClear(i.r,i.g,i.b,1,Y),r=!0),(this.autoClear||r)&&this.clear(this.autoClearColor,this.autoClearDepth,this.autoClearStencil),i&&i.isCubeTexture?(void 0===ve&&(ve=new kt,ge=new Rt(new Ot(5,5,5),new Q({uniforms:Ms.cube.uniforms,vertexShader:Ms.cube.vertexShader,fragmentShader:Ms.cube.fragmentShader,side:so,depthTest:!1,depthWrite:!1,fog:!1}))),ve.projectionMatrix.copy(e.projectionMatrix),ve.matrixWorld.extractRotation(e.matrixWorld),ve.matrixWorldInverse.getInverse(ve.matrixWorld),ge.material.uniforms.tCube.value=i,ge.modelViewMatrix.multiplyMatrices(ve.matrixWorldInverse,ge.matrixWorld),he.update(ge),lt.renderBufferDirect(ve,null,ge.geometry,ge.material,ge,null)):i&&i.isTexture&&(void 0===de&&(de=new Ut(-1,1,1,-1,0,1),me=new Rt(new Nt(2,2),new dt({depthTest:!1,depthWrite:!1,fog:!1}))),me.material.map=i,he.update(me),lt.renderBufferDirect(de,null,me.geometry,me.material,me,null)),t.overrideMaterial){var o=t.overrideMaterial;x(tt,t,e,o),x(rt,t,e,o)}else te.setBlending(mo),x(tt,t,e),x(rt,t,e);_e.render(t,e),we.render(t,e,xt),n&&le.updateRenderTargetMipmap(n),te.setDepthTest(!0),te.setDepthWrite(!0),te.setColorWrite(!0)},this.setFaceCulling=function(t,e){te.setCullFace(t),te.setFlipSided(e===eo)},this.allocTextureUnit=F,this.setTexture2D=function(){var t=!1;return function(e,n){e&&e.isWebGLRenderTarget&&(t||(console.warn("THREE.WebGLRenderer.setTexture2D: don't use render targets as textures. Use their .texture property instead."),t=!0),e=e.texture),le.setTexture2D(e,n)}}(),this.setTexture=function(){var t=!1;return function(e,n){t||(console.warn("THREE.WebGLRenderer: .setTexture is deprecated, use setTexture2D instead."),t=!0),le.setTexture2D(e,n)}}(),this.setTextureCube=function(){var t=!1;return function(e,n){e&&e.isWebGLRenderTargetCube&&(t||(console.warn("THREE.WebGLRenderer.setTextureCube: don't use cube render targets as textures. Use their .texture property instead."),t=!0),e=e.texture),e&&e.isCubeTexture||Array.isArray(e.image)&&6===e.image.length?le.setTextureCube(e,n):le.setTextureCubeDynamic(e,n)}}(),this.getCurrentRenderTarget=function(){return pt},this.setRenderTarget=function(t){pt=t,t&&void 0===ne.get(t).__webglFramebuffer&&le.setupRenderTarget(t);var e,n=t&&t.isWebGLRenderTargetCube;if(t){var r=ne.get(t);e=n?r.__webglFramebuffer[t.activeCubeFace]:r.__webglFramebuffer,yt.copy(t.scissor),bt=t.scissorTest,xt.copy(t.viewport)}else e=null,yt.copy(At).multiplyScalar(St),bt=Ct,xt.copy(Lt).multiplyScalar(St);if(ft!==e&&(Kt.bindFramebuffer(Kt.FRAMEBUFFER,e),ft=e),te.scissor(yt),te.setScissorTest(bt),te.viewport(xt),n){var i=ne.get(t.texture);Kt.framebufferTexture2D(Kt.FRAMEBUFFER,Kt.COLOR_ATTACHMENT0,Kt.TEXTURE_CUBE_MAP_POSITIVE_X+t.activeCubeFace,i.__webglTexture,t.activeMipMapLevel)}},this.readRenderTargetPixels=function(t,e,n,r,i,o){if(!1===(t&&t.isWebGLRenderTarget))return void console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");var a=ne.get(t).__webglFramebuffer;if(a){var s=!1;a!==ft&&(Kt.bindFramebuffer(Kt.FRAMEBUFFER,a),s=!0);try{var u=t.texture,c=u.format,l=u.type;if(c!==Ra&&j(c)!==Kt.getParameter(Kt.IMPLEMENTATION_COLOR_READ_FORMAT))return void console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.");if(!(l===va||j(l)===Kt.getParameter(Kt.IMPLEMENTATION_COLOR_READ_TYPE)||l===wa&&(Jt.get("OES_texture_float")||Jt.get("WEBGL_color_buffer_float"))||l===Ea&&Jt.get("EXT_color_buffer_half_float")))return void console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.");Kt.checkFramebufferStatus(Kt.FRAMEBUFFER)===Kt.FRAMEBUFFER_COMPLETE?e>=0&&e<=t.width-r&&n>=0&&n<=t.height-i&&Kt.readPixels(e,n,r,i,j(c),j(l),o):console.error("THREE.WebGLRenderer.readRenderTargetPixels: readPixels from renderTarget failed. Framebuffer not complete.")}finally{s&&Kt.bindFramebuffer(Kt.FRAMEBUFFER,ft)}}}}function he(t,e){this.name="",this.color=new q(t),this.density=void 0!==e?e:25e-5}function pe(t,e,n){this.name="",this.color=new q(t),this.near=void 0!==e?e:1,this.far=void 0!==n?n:1e3}function fe(){lt.call(this),this.type="Scene",this.background=null,this.fog=null,this.overrideMaterial=null,this.autoUpdate=!0}function de(t,e,n,r,i){lt.call(this),this.lensFlares=[],this.positionScreen=new l,this.customUpdateCallback=void 0,void 0!==t&&this.add(t,e,n,r,i)}function me(t){J.call(this),this.type="SpriteMaterial",this.color=new q(16777215),this.map=null,this.rotation=0,this.fog=!1,this.lights=!1,this.setValues(t)}function ve(t){lt.call(this),this.type="Sprite",this.material=void 0!==t?t:new me}function ge(){lt.call(this),this.type="LOD",Object.defineProperties(this,{levels:{enumerable:!0,value:[]}})}function ye(t,e,n){if(this.useVertexTexture=void 0===n||n,this.identityMatrix=new h,t=t||[],this.bones=t.slice(0),this.useVertexTexture){var r=Math.sqrt(4*this.bones.length);r=fs.nextPowerOfTwo(Math.ceil(r)),r=Math.max(r,4),this.boneTextureWidth=r,this.boneTextureHeight=r,this.boneMatrices=new Float32Array(this.boneTextureWidth*this.boneTextureHeight*4),this.boneTexture=new Y(this.boneMatrices,this.boneTextureWidth,this.boneTextureHeight,Ra,wa)}else this.boneMatrices=new Float32Array(16*this.bones.length);if(void 0===e)this.calculateInverses();else if(this.bones.length===e.length)this.boneInverses=e.slice(0);else{console.warn("THREE.Skeleton bonInverses is the wrong length."),this.boneInverses=[];for(var i=0,o=this.bones.length;i=t.HAVE_CURRENT_DATA&&(h.needsUpdate=!0)}o.call(this,t,e,n,r,i,a,s,u,c),this.generateMipmaps=!1;var h=this;l()}function Ce(t,e,n,r,i,a,s,u,c,l,h,p){o.call(this,null,a,s,u,c,l,r,i,h,p),this.image={width:e,height:n},this.mipmaps=t,this.flipY=!1,this.generateMipmaps=!1}function Pe(t,e,n,r,i,a,s,u,c){o.call(this,t,e,n,r,i,a,s,u,c),this.needsUpdate=!0}function Re(t,e,n,r,i,a,s,u,c,l){if((l=void 0!==l?l:Na)!==Na&&l!==Da)throw new Error("DepthTexture format must be either THREE.DepthFormat or THREE.DepthStencilFormat");void 0===n&&l===Na&&(n=ba),void 0===n&&l===Da&&(n=Aa),o.call(this,null,r,i,a,s,u,l,n,c),this.image={width:t,height:e},this.magFilter=void 0!==s?s:la,this.minFilter=void 0!==u?u:la,this.flipY=!1,this.generateMipmaps=!1}function Le(t){function e(t,e){return t-e}Pt.call(this),this.type="WireframeGeometry";var n,r,i,o,a,s,u,c,h=[],p=[0,0],f={},d=["a","b","c"];if(t&&t.isGeometry){var m=t.faces;for(n=0,i=m.length;n.9&&o<.1&&(e<.2&&(m[t+0]+=1),n<.2&&(m[t+2]+=1),r<.2&&(m[t+4]+=1))}}function s(t){d.push(t.x,t.y,t.z)}function u(e,n){var r=3*e;n.x=t[r+0],n.y=t[r+1],n.z=t[r+2]}function c(){for(var t=new l,e=new l,n=new l,r=new l,o=new i,a=new i,s=new i,u=0,c=0;u0)&&m.push(w,E,T),(u!==n-1||c0&&c(!0),e>0&&c(!1)),this.setIndex(p),this.addAttribute("position",new Et(f,3)),this.addAttribute("normal",new Et(d,3)),this.addAttribute("uv",new Et(m,2))}function ln(t,e,n,r,i,o,a){un.call(this,0,t,e,n,r,i,o,a),this.type="ConeGeometry",this.parameters={radius:t,height:e,radialSegments:n,heightSegments:r,openEnded:i,thetaStart:o,thetaLength:a}}function hn(t,e,n,r,i,o,a){cn.call(this,0,t,e,n,r,i,o,a),this.type="ConeBufferGeometry",this.parameters={radius:t,height:e,radialSegments:n,heightSegments:r,openEnded:i,thetaStart:o,thetaLength:a}}function pn(t,e,n,r){Ct.call(this),this.type="CircleGeometry",this.parameters={radius:t,segments:e,thetaStart:n,thetaLength:r},this.fromBufferGeometry(new fn(t,e,n,r))}function fn(t,e,n,r){Pt.call(this),this.type="CircleBufferGeometry",this.parameters={radius:t,segments:e,thetaStart:n,thetaLength:r},t=t||50,e=void 0!==e?Math.max(3,e):8,n=void 0!==n?n:0,r=void 0!==r?r:2*Math.PI;var o,a,s=[],u=[],c=[],h=[],p=new l,f=new i;for(u.push(0,0,0),c.push(0,0,1),h.push(.5,.5),a=0,o=3;a<=e;a++,o+=3){var d=n+a/e*r;p.x=t*Math.cos(d),p.y=t*Math.sin(d),u.push(p.x,p.y,p.z),c.push(0,0,1),f.x=(u[o]/t+1)/2,f.y=(u[o+1]/t+1)/2,h.push(f.x,f.y)}for(o=1;o<=e;o++)s.push(o,o+1,0);this.setIndex(s),this.addAttribute("position",new Et(u,3)),this.addAttribute("normal",new Et(c,3)),this.addAttribute("uv",new Et(h,2))}function dn(){Q.call(this,{uniforms:xs.merge([Es.lights,{opacity:{value:1}}]),vertexShader:_s.shadow_vert,fragmentShader:_s.shadow_frag}),this.lights=!0,this.transparent=!0,Object.defineProperties(this,{opacity:{enumerable:!0,get:function(){return this.uniforms.opacity.value},set:function(t){this.uniforms.opacity.value=t}}})}function mn(t){Q.call(this,t),this.type="RawShaderMaterial"}function vn(t){this.uuid=fs.generateUUID(),this.type="MultiMaterial",this.materials=Array.isArray(t)?t:[],this.visible=!0}function gn(t){J.call(this),this.defines={STANDARD:""},this.type="MeshStandardMaterial",this.color=new q(16777215),this.roughness=.5,this.metalness=.5,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new q(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalScale=new i(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(t)}function yn(t){gn.call(this),this.defines={PHYSICAL:""},this.type="MeshPhysicalMaterial",this.reflectivity=.5,this.clearCoat=0,this.clearCoatRoughness=0,this.setValues(t)}function bn(t){J.call(this),this.type="MeshPhongMaterial",this.color=new q(16777215),this.specular=new q(1118481),this.shininess=30,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new q(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalScale=new i(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.combine=Wo,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(t)}function xn(t){bn.call(this),this.defines={TOON:""},this.type="MeshToonMaterial",this.gradientMap=null,this.setValues(t)}function _n(t){J.call(this,t),this.type="MeshNormalMaterial",this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalScale=new i(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.wireframe=!1,this.wireframeLinewidth=1,this.fog=!1,this.lights=!1,this.skinning=!1,this.morphTargets=!1,this.morphNormals=!1,this.setValues(t)}function wn(t){J.call(this),this.type="MeshLambertMaterial",this.color=new q(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new q(0),this.emissiveIntensity=1,this.emissiveMap=null,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.combine=Wo,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(t)}function En(t){J.call(this),this.type="LineDashedMaterial",this.color=new q(16777215),this.linewidth=1,this.scale=1,this.dashSize=3,this.gapSize=1,this.lights=!1,this.setValues(t)}function Mn(t,e,n){var r=this,i=!1,o=0,a=0;this.onStart=void 0,this.onLoad=t,this.onProgress=e,this.onError=n,this.itemStart=function(t){a++,!1===i&&void 0!==r.onStart&&r.onStart(t,o,a),i=!0},this.itemEnd=function(t){o++,void 0!==r.onProgress&&r.onProgress(t,o,a),o===a&&(i=!1,void 0!==r.onLoad&&r.onLoad())},this.itemError=function(t){void 0!==r.onError&&r.onError(t)}}function Tn(t){this.manager=void 0!==t?t:Is}function Sn(t){this.manager=void 0!==t?t:Is,this._parser=null}function An(t){this.manager=void 0!==t?t:Is,this._parser=null}function Cn(t){this.manager=void 0!==t?t:Is}function Pn(t){this.manager=void 0!==t?t:Is}function Rn(t){this.manager=void 0!==t?t:Is}function Ln(t,e){lt.call(this),this.type="Light",this.color=new q(t),this.intensity=void 0!==e?e:1,this.receiveShadow=void 0}function On(t,e,n){Ln.call(this,t,n),this.type="HemisphereLight",this.castShadow=void 0,this.position.copy(lt.DefaultUp),this.updateMatrix(),this.groundColor=new q(e)}function In(t){this.camera=t,this.bias=0,this.radius=1,this.mapSize=new i(512,512),this.map=null,this.matrix=new h}function Nn(){In.call(this,new kt(50,1,.5,500))}function Dn(t,e,n,r,i,o){Ln.call(this,t,e),this.type="SpotLight",this.position.copy(lt.DefaultUp),this.updateMatrix(),this.target=new lt,Object.defineProperty(this,"power",{get:function(){return this.intensity*Math.PI},set:function(t){this.intensity=t/Math.PI}}),this.distance=void 0!==n?n:0,this.angle=void 0!==r?r:Math.PI/3,this.penumbra=void 0!==i?i:0,this.decay=void 0!==o?o:1,this.shadow=new Nn}function kn(t,e,n,r){Ln.call(this,t,e),this.type="PointLight",Object.defineProperty(this,"power",{get:function(){return 4*this.intensity*Math.PI},set:function(t){this.intensity=t/(4*Math.PI)}}),this.distance=void 0!==n?n:0,this.decay=void 0!==r?r:1,this.shadow=new In(new kt(90,1,.5,500))}function Un(){In.call(this,new Ut(-5,5,5,-5,.5,500))}function Fn(t,e){Ln.call(this,t,e),this.type="DirectionalLight",this.position.copy(lt.DefaultUp),this.updateMatrix(),this.target=new lt,this.shadow=new Un}function jn(t,e){Ln.call(this,t,e),this.type="AmbientLight",this.castShadow=void 0}function Bn(t,e,n,r){this.parameterPositions=t,this._cachedIndex=0,this.resultBuffer=void 0!==r?r:new e.constructor(n),this.sampleValues=e,this.valueSize=n}function zn(t,e,n,r){Bn.call(this,t,e,n,r),this._weightPrev=-0,this._offsetPrev=-0,this._weightNext=-0,this._offsetNext=-0}function Vn(t,e,n,r){Bn.call(this,t,e,n,r)}function Hn(t,e,n,r){Bn.call(this,t,e,n,r)}function Gn(t,e,n,r){if(void 0===t)throw new Error("track name is undefined");if(void 0===e||0===e.length)throw new Error("no keyframes in track named "+t);this.name=t,this.times=Ns.convertArray(e,this.TimeBufferType),this.values=Ns.convertArray(n,this.ValueBufferType),this.setInterpolation(r||this.DefaultInterpolation),this.validate(),this.optimize()}function Wn(t,e,n,r){Gn.call(this,t,e,n,r)}function Xn(t,e,n,r){Bn.call(this,t,e,n,r)}function qn(t,e,n,r){Gn.call(this,t,e,n,r)}function Yn(t,e,n,r){Gn.call(this,t,e,n,r)}function Zn(t,e,n,r){Gn.call(this,t,e,n,r)}function Kn(t,e,n){Gn.call(this,t,e,n)}function $n(t,e,n,r){Gn.call(this,t,e,n,r)}function Jn(t,e,n,r){Gn.apply(this,arguments)}function Qn(t,e,n){this.name=t,this.tracks=n,this.duration=void 0!==e?e:-1,this.uuid=fs.generateUUID(),this.duration<0&&this.resetDuration(),this.optimize()}function tr(t){this.manager=void 0!==t?t:Is,this.textures={}}function er(t){this.manager=void 0!==t?t:Is}function nr(){this.onLoadStart=function(){},this.onLoadProgress=function(){},this.onLoadComplete=function(){}}function rr(t){"boolean"==typeof t&&(console.warn("THREE.JSONLoader: showStatus parameter has been removed from constructor."),t=void 0),this.manager=void 0!==t?t:Is,this.withCredentials=!1}function ir(t){this.manager=void 0!==t?t:Is,this.texturePath=""}function or(t,e,n,r,i){var o=.5*(r-e),a=.5*(i-n),s=t*t;return(2*n-2*r+o+a)*(t*s)+(-3*n+3*r-2*o-a)*s+o*t+n}function ar(t,e){var n=1-t;return n*n*e}function sr(t,e){return 2*(1-t)*t*e}function ur(t,e){return t*t*e}function cr(t,e,n,r){return ar(t,e)+sr(t,n)+ur(t,r)}function lr(t,e){var n=1-t;return n*n*n*e}function hr(t,e){var n=1-t;return 3*n*n*t*e}function pr(t,e){return 3*(1-t)*t*t*e}function fr(t,e){return t*t*t*e}function dr(t,e,n,r,i){return lr(t,e)+hr(t,n)+pr(t,r)+fr(t,i)}function mr(){}function vr(t,e){this.v1=t,this.v2=e}function gr(){this.curves=[],this.autoClose=!1}function yr(t,e,n,r,i,o,a,s){this.aX=t,this.aY=e,this.xRadius=n,this.yRadius=r,this.aStartAngle=i,this.aEndAngle=o,this.aClockwise=a,this.aRotation=s||0}function br(t){this.points=void 0===t?[]:t}function xr(t,e,n,r){this.v0=t,this.v1=e,this.v2=n,this.v3=r}function _r(t,e,n){this.v0=t,this.v1=e,this.v2=n}function wr(t){gr.call(this),this.currentPoint=new i,t&&this.fromPoints(t)}function Er(){wr.apply(this,arguments),this.holes=[]}function Mr(){this.subPaths=[],this.currentPath=null}function Tr(t){this.data=t}function Sr(t){this.manager=void 0!==t?t:Is}function Ar(t){this.manager=void 0!==t?t:Is}function Cr(t,e,n,r){Ln.call(this,t,e),this.type="RectAreaLight",this.position.set(0,1,0),this.updateMatrix(),this.width=void 0!==n?n:10,this.height=void 0!==r?r:10}function Pr(){this.type="StereoCamera",this.aspect=1,this.eyeSep=.064,this.cameraL=new kt,this.cameraL.layers.enable(1),this.cameraL.matrixAutoUpdate=!1,this.cameraR=new kt,this.cameraR.layers.enable(2),this.cameraR.matrixAutoUpdate=!1}function Rr(t,e,n){lt.call(this),this.type="CubeCamera";var r=new kt(90,1,t,e);r.up.set(0,-1,0),r.lookAt(new l(1,0,0)),this.add(r);var i=new kt(90,1,t,e);i.up.set(0,-1,0),i.lookAt(new l(-1,0,0)),this.add(i);var o=new kt(90,1,t,e);o.up.set(0,0,1),o.lookAt(new l(0,1,0)),this.add(o);var a=new kt(90,1,t,e);a.up.set(0,0,-1),a.lookAt(new l(0,-1,0)),this.add(a);var s=new kt(90,1,t,e);s.up.set(0,-1,0),s.lookAt(new l(0,0,1)),this.add(s);var c=new kt(90,1,t,e);c.up.set(0,-1,0),c.lookAt(new l(0,0,-1)),this.add(c);var h={format:Pa,magFilter:fa,minFilter:fa};this.renderTarget=new u(n,n,h),this.updateCubeMap=function(t,e){null===this.parent&&this.updateMatrixWorld();var n=this.renderTarget,u=n.texture.generateMipmaps;n.texture.generateMipmaps=!1,n.activeCubeFace=0,t.render(e,r,n),n.activeCubeFace=1,t.render(e,i,n),n.activeCubeFace=2,t.render(e,o,n),n.activeCubeFace=3,t.render(e,a,n),n.activeCubeFace=4,t.render(e,s,n),n.texture.generateMipmaps=u,n.activeCubeFace=5,t.render(e,c,n),t.setRenderTarget(null)}}function Lr(){lt.call(this),this.type="AudioListener",this.context=Fs.getContext(),this.gain=this.context.createGain(),this.gain.connect(this.context.destination),this.filter=null}function Or(t){lt.call(this),this.type="Audio",this.context=t.context,this.gain=this.context.createGain(),this.gain.connect(t.getInput()),this.autoplay=!1,this.buffer=null,this.loop=!1,this.startTime=0,this.playbackRate=1,this.isPlaying=!1,this.hasPlaybackControl=!0,this.sourceType="empty",this.filters=[]}function Ir(t){Or.call(this,t),this.panner=this.context.createPanner(),this.panner.connect(this.gain)}function Nr(t,e){this.analyser=t.context.createAnalyser(),this.analyser.fftSize=void 0!==e?e:2048,this.data=new Uint8Array(this.analyser.frequencyBinCount),t.getOutput().connect(this.analyser)}function Dr(t,e,n){this.binding=t,this.valueSize=n;var r,i=Float64Array;switch(e){case"quaternion":r=this._slerp;break;case"string":case"bool":i=Array,r=this._select;break;default:r=this._lerp}this.buffer=new i(4*n),this._mixBufferRegion=r,this.cumulativeWeight=0,this.useCount=0,this.referenceCount=0}function kr(t,e,n){this.path=e,this.parsedPath=n||kr.parseTrackName(e),this.node=kr.findNode(t,this.parsedPath.nodeName)||t,this.rootNode=t}function Ur(t){this.uuid=fs.generateUUID(),this._objects=Array.prototype.slice.call(arguments),this.nCachedObjects_=0;var e={};this._indicesByUUID=e;for(var n=0,r=arguments.length;n!==r;++n)e[arguments[n].uuid]=n;this._paths=[],this._parsedPaths=[],this._bindings=[],this._bindingsIndicesByPath={};var i=this;this.stats={objects:{get total(){return i._objects.length},get inUse(){return this.total-i.nCachedObjects_}},get bindingsPerObject(){return i._bindings.length}}}function Fr(t,e,n){this._mixer=t,this._clip=e,this._localRoot=n||null;for(var r=e.tracks,i=r.length,o=new Array(i),a={endingStart:$a,endingEnd:$a},s=0;s!==i;++s){var u=r[s].createInterpolant(null);o[s]=u,u.settings=a}this._interpolantSettings=a,this._interpolants=o,this._propertyBindings=new Array(i),this._cacheIndex=null,this._byClipCacheIndex=null,this._timeScaleInterpolant=null,this._weightInterpolant=null,this.loop=Xa,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 jr(t){this._root=t,this._initMemoryManager(),this._accuIndex=0,this.time=0,this.timeScale=1}function Br(t){"string"==typeof t&&(console.warn("THREE.Uniform: Type parameter is no longer needed."),t=arguments[1]),this.value=t}function zr(){Pt.call(this),this.type="InstancedBufferGeometry",this.maxInstancedCount=void 0}function Vr(t,e,n,r){this.uuid=fs.generateUUID(),this.data=t,this.itemSize=e,this.offset=n,this.normalized=!0===r}function Hr(t,e){this.uuid=fs.generateUUID(),this.array=t,this.stride=e,this.count=void 0!==t?t.length/e:0,this.dynamic=!1,this.updateRange={offset:0,count:-1},this.onUploadCallback=function(){},this.version=0}function Gr(t,e,n){Hr.call(this,t,e),this.meshPerAttribute=n||1}function Wr(t,e,n){mt.call(this,t,e),this.meshPerAttribute=n||1}function Xr(t,e,n,r){this.ray=new st(t,e),this.near=n||0,this.far=r||1/0,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 qr(t,e){return t.distance-e.distance}function Yr(t,e,n,r){if(!1!==t.visible&&(t.raycast(e,n),!0===r))for(var i=t.children,o=0,a=i.length;o0?1:+t}),void 0===Function.prototype.name&&Object.defineProperty(Function.prototype,"name",{get:function(){return this.toString().match(/^\s*function\s*([^\(\s]*)/)[1]}}),void 0===Object.assign&&function(){Object.assign=function(t){if(void 0===t||null===t)throw new TypeError("Cannot convert undefined or null to object");for(var e=Object(t),n=1;n>=4,n[i]=e[19===i?3&t|8:t]);return n.join("")}}(),clamp:function(t,e,n){return Math.max(e,Math.min(n,t))},euclideanModulo:function(t,e){return(t%e+e)%e},mapLinear:function(t,e,n,r,i){return r+(t-e)*(i-r)/(n-e)},lerp:function(t,e,n){return(1-n)*t+n*e},smoothstep:function(t,e,n){return t<=e?0:t>=n?1:(t=(t-e)/(n-e))*t*(3-2*t)},smootherstep:function(t,e,n){return t<=e?0:t>=n?1:(t=(t-e)/(n-e))*t*t*(t*(6*t-15)+10)},randInt:function(t,e){return t+Math.floor(Math.random()*(e-t+1))},randFloat:function(t,e){return t+Math.random()*(e-t)},randFloatSpread:function(t){return t*(.5-Math.random())},degToRad:function(t){return t*fs.DEG2RAD},radToDeg:function(t){return t*fs.RAD2DEG},isPowerOfTwo:function(t){return 0==(t&t-1)&&0!==t},nearestPowerOfTwo:function(t){return Math.pow(2,Math.round(Math.log(t)/Math.LN2))},nextPowerOfTwo:function(t){return t--,t|=t>>1,t|=t>>2,t|=t>>4,t|=t>>8,t|=t>>16,++t}};i.prototype={constructor:i,isVector2:!0,get width(){return this.x},set width(t){this.x=t},get height(){return this.y},set height(t){this.y=t},set:function(t,e){return this.x=t,this.y=e,this},setScalar:function(t){return this.x=t,this.y=t,this},setX:function(t){return this.x=t,this},setY:function(t){return this.y=t,this},setComponent:function(t,e){switch(t){case 0:this.x=e;break;case 1:this.y=e;break;default:throw new Error("index is out of range: "+t)}return this},getComponent:function(t){switch(t){case 0:return this.x;case 1:return this.y;default:throw new Error("index is out of range: "+t)}},clone:function(){return new this.constructor(this.x,this.y)},copy:function(t){return this.x=t.x,this.y=t.y,this},add:function(t,e){return void 0!==e?(console.warn("THREE.Vector2: .add() now only accepts one argument. Use .addVectors( a, b ) instead."),this.addVectors(t,e)):(this.x+=t.x,this.y+=t.y,this)},addScalar:function(t){return this.x+=t,this.y+=t,this},addVectors:function(t,e){return this.x=t.x+e.x,this.y=t.y+e.y,this},addScaledVector:function(t,e){return this.x+=t.x*e,this.y+=t.y*e,this},sub:function(t,e){return void 0!==e?(console.warn("THREE.Vector2: .sub() now only accepts one argument. Use .subVectors( a, b ) instead."),this.subVectors(t,e)):(this.x-=t.x,this.y-=t.y,this)},subScalar:function(t){return this.x-=t,this.y-=t,this},subVectors:function(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this},multiply:function(t){return this.x*=t.x,this.y*=t.y,this},multiplyScalar:function(t){return isFinite(t)?(this.x*=t,this.y*=t):(this.x=0,this.y=0),this},divide:function(t){return this.x/=t.x,this.y/=t.y,this},divideScalar:function(t){return this.multiplyScalar(1/t)},min:function(t){return this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y),this},max:function(t){return this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y),this},clamp:function(t,e){return this.x=Math.max(t.x,Math.min(e.x,this.x)),this.y=Math.max(t.y,Math.min(e.y,this.y)),this},clampScalar:function(){var t,e;return function(n,r){return void 0===t&&(t=new i,e=new i),t.set(n,n),e.set(r,r),this.clamp(t,e)}}(),clampLength:function(t,e){var n=this.length();return this.multiplyScalar(Math.max(t,Math.min(e,n))/n)},floor:function(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this},ceil:function(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this},round:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this},roundToZero:function(){return this.x=this.x<0?Math.ceil(this.x):Math.floor(this.x),this.y=this.y<0?Math.ceil(this.y):Math.floor(this.y),this},negate:function(){return this.x=-this.x,this.y=-this.y,this},dot:function(t){return this.x*t.x+this.y*t.y},lengthSq:function(){return this.x*this.x+this.y*this.y},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y)},lengthManhattan:function(){return Math.abs(this.x)+Math.abs(this.y)},normalize:function(){return this.divideScalar(this.length())},angle:function(){var t=Math.atan2(this.y,this.x);return t<0&&(t+=2*Math.PI),t},distanceTo:function(t){return Math.sqrt(this.distanceToSquared(t))},distanceToSquared:function(t){var e=this.x-t.x,n=this.y-t.y;return e*e+n*n},distanceToManhattan:function(t){return Math.abs(this.x-t.x)+Math.abs(this.y-t.y)},setLength:function(t){return this.multiplyScalar(t/this.length())},lerp:function(t,e){return this.x+=(t.x-this.x)*e,this.y+=(t.y-this.y)*e,this},lerpVectors:function(t,e,n){return this.subVectors(e,t).multiplyScalar(n).add(t)},equals:function(t){return t.x===this.x&&t.y===this.y},fromArray:function(t,e){return void 0===e&&(e=0),this.x=t[e],this.y=t[e+1],this},toArray:function(t,e){return void 0===t&&(t=[]),void 0===e&&(e=0),t[e]=this.x,t[e+1]=this.y,t},fromBufferAttribute:function(t,e,n){return void 0!==n&&console.warn("THREE.Vector2: offset has been removed from .fromBufferAttribute()."),this.x=t.getX(e),this.y=t.getY(e),this},rotateAround:function(t,e){var n=Math.cos(e),r=Math.sin(e),i=this.x-t.x,o=this.y-t.y;return this.x=i*n-o*r+t.x,this.y=i*r+o*n+t.y,this}};var ds=0;o.DEFAULT_IMAGE=void 0,o.DEFAULT_MAPPING=Qo,o.prototype={constructor:o,isTexture:!0,set needsUpdate(t){!0===t&&this.version++},clone:function(){return(new this.constructor).copy(this)},copy:function(t){return this.image=t.image,this.mipmaps=t.mipmaps.slice(0),this.mapping=t.mapping,this.wrapS=t.wrapS,this.wrapT=t.wrapT,this.magFilter=t.magFilter,this.minFilter=t.minFilter,this.anisotropy=t.anisotropy,this.format=t.format,this.type=t.type,this.offset.copy(t.offset),this.repeat.copy(t.repeat),this.generateMipmaps=t.generateMipmaps,this.premultiplyAlpha=t.premultiplyAlpha,this.flipY=t.flipY,this.unpackAlignment=t.unpackAlignment,this.encoding=t.encoding,this},toJSON:function(t){if(void 0!==t.textures[this.uuid])return t.textures[this.uuid];var e={metadata:{version:4.4,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],wrap:[this.wrapS,this.wrapT],minFilter:this.minFilter,magFilter:this.magFilter,anisotropy:this.anisotropy,flipY:this.flipY};if(void 0!==this.image){var n=this.image;void 0===n.uuid&&(n.uuid=fs.generateUUID()),void 0===t.images[n.uuid]&&(t.images[n.uuid]={uuid:n.uuid,url:function(t){var e;return void 0!==t.toDataURL?e=t:(e=document.createElementNS("http://www.w3.org/1999/xhtml","canvas"),e.width=t.width,e.height=t.height,e.getContext("2d").drawImage(t,0,0,t.width,t.height)),e.width>2048||e.height>2048?e.toDataURL("image/jpeg",.6):e.toDataURL("image/png")}(n)}),e.image=n.uuid}return t.textures[this.uuid]=e,e},dispose:function(){this.dispatchEvent({type:"dispose"})},transformUv:function(t){if(this.mapping===Qo){if(t.multiply(this.repeat),t.add(this.offset),t.x<0||t.x>1)switch(this.wrapS){case sa:t.x=t.x-Math.floor(t.x);break;case ua:t.x=t.x<0?0:1;break;case ca:1===Math.abs(Math.floor(t.x)%2)?t.x=Math.ceil(t.x)-t.x:t.x=t.x-Math.floor(t.x)}if(t.y<0||t.y>1)switch(this.wrapT){case sa:t.y=t.y-Math.floor(t.y);break;case ua:t.y=t.y<0?0:1;break;case ca:1===Math.abs(Math.floor(t.y)%2)?t.y=Math.ceil(t.y)-t.y:t.y=t.y-Math.floor(t.y)}this.flipY&&(t.y=1-t.y)}}},Object.assign(o.prototype,r.prototype),a.prototype={constructor:a,isVector4:!0,set:function(t,e,n,r){return this.x=t,this.y=e,this.z=n,this.w=r,this},setScalar:function(t){return this.x=t,this.y=t,this.z=t,this.w=t,this},setX:function(t){return this.x=t,this},setY:function(t){return this.y=t,this},setZ:function(t){return this.z=t,this},setW:function(t){return this.w=t,this},setComponent:function(t,e){switch(t){case 0:this.x=e;break;case 1:this.y=e;break;case 2:this.z=e;break;case 3:this.w=e;break;default:throw new Error("index is out of range: "+t)}return this},getComponent:function(t){switch(t){case 0:return this.x;case 1:return this.y;case 2:return this.z;case 3:return this.w;default:throw new Error("index is out of range: "+t)}},clone:function(){return new this.constructor(this.x,this.y,this.z,this.w)},copy:function(t){return this.x=t.x,this.y=t.y,this.z=t.z,this.w=void 0!==t.w?t.w:1,this},add:function(t,e){return void 0!==e?(console.warn("THREE.Vector4: .add() now only accepts one argument. Use .addVectors( a, b ) instead."),this.addVectors(t,e)):(this.x+=t.x,this.y+=t.y,this.z+=t.z,this.w+=t.w,this)},addScalar:function(t){return this.x+=t,this.y+=t,this.z+=t,this.w+=t,this},addVectors:function(t,e){return this.x=t.x+e.x,this.y=t.y+e.y,this.z=t.z+e.z,this.w=t.w+e.w,this},addScaledVector:function(t,e){return this.x+=t.x*e,this.y+=t.y*e,this.z+=t.z*e,this.w+=t.w*e,this},sub:function(t,e){return void 0!==e?(console.warn("THREE.Vector4: .sub() now only accepts one argument. Use .subVectors( a, b ) instead."),this.subVectors(t,e)):(this.x-=t.x,this.y-=t.y,this.z-=t.z,this.w-=t.w,this)},subScalar:function(t){return this.x-=t,this.y-=t,this.z-=t,this.w-=t,this},subVectors:function(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this.z=t.z-e.z,this.w=t.w-e.w,this},multiplyScalar:function(t){return isFinite(t)?(this.x*=t,this.y*=t,this.z*=t,this.w*=t):(this.x=0,this.y=0,this.z=0,this.w=0),this},applyMatrix4:function(t){var e=this.x,n=this.y,r=this.z,i=this.w,o=t.elements;return this.x=o[0]*e+o[4]*n+o[8]*r+o[12]*i,this.y=o[1]*e+o[5]*n+o[9]*r+o[13]*i,this.z=o[2]*e+o[6]*n+o[10]*r+o[14]*i,this.w=o[3]*e+o[7]*n+o[11]*r+o[15]*i,this},divideScalar:function(t){return this.multiplyScalar(1/t)},setAxisAngleFromQuaternion:function(t){this.w=2*Math.acos(t.w);var e=Math.sqrt(1-t.w*t.w);return e<1e-4?(this.x=1,this.y=0,this.z=0):(this.x=t.x/e,this.y=t.y/e,this.z=t.z/e),this},setAxisAngleFromRotationMatrix:function(t){var e,n,r,i,o=t.elements,a=o[0],s=o[4],u=o[8],c=o[1],l=o[5],h=o[9],p=o[2],f=o[6],d=o[10];if(Math.abs(s-c)<.01&&Math.abs(u-p)<.01&&Math.abs(h-f)<.01){if(Math.abs(s+c)<.1&&Math.abs(u+p)<.1&&Math.abs(h+f)<.1&&Math.abs(a+l+d-3)<.1)return this.set(1,0,0,0),this;e=Math.PI;var m=(a+1)/2,v=(l+1)/2,g=(d+1)/2,y=(s+c)/4,b=(u+p)/4,x=(h+f)/4;return m>v&&m>g?m<.01?(n=0,r=.707106781,i=.707106781):(n=Math.sqrt(m),r=y/n,i=b/n):v>g?v<.01?(n=.707106781,r=0,i=.707106781):(r=Math.sqrt(v),n=y/r,i=x/r):g<.01?(n=.707106781,r=.707106781,i=0):(i=Math.sqrt(g),n=b/i,r=x/i),this.set(n,r,i,e),this}var _=Math.sqrt((f-h)*(f-h)+(u-p)*(u-p)+(c-s)*(c-s));return Math.abs(_)<.001&&(_=1),this.x=(f-h)/_,this.y=(u-p)/_,this.z=(c-s)/_,this.w=Math.acos((a+l+d-1)/2),this},min:function(t){return this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y),this.z=Math.min(this.z,t.z),this.w=Math.min(this.w,t.w),this},max:function(t){return this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y),this.z=Math.max(this.z,t.z),this.w=Math.max(this.w,t.w),this},clamp:function(t,e){return this.x=Math.max(t.x,Math.min(e.x,this.x)),this.y=Math.max(t.y,Math.min(e.y,this.y)),this.z=Math.max(t.z,Math.min(e.z,this.z)),this.w=Math.max(t.w,Math.min(e.w,this.w)),this},clampScalar:function(){var t,e;return function(n,r){return void 0===t&&(t=new a,e=new a),t.set(n,n,n,n),e.set(r,r,r,r),this.clamp(t,e)}}(),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(t){return this.x*t.x+this.y*t.y+this.z*t.z+this.w*t.w},lengthSq:function(){return this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)},lengthManhattan: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())},setLength:function(t){return this.multiplyScalar(t/this.length())},lerp:function(t,e){return this.x+=(t.x-this.x)*e,this.y+=(t.y-this.y)*e,this.z+=(t.z-this.z)*e,this.w+=(t.w-this.w)*e,this},lerpVectors:function(t,e,n){return this.subVectors(e,t).multiplyScalar(n).add(t)},equals:function(t){return t.x===this.x&&t.y===this.y&&t.z===this.z&&t.w===this.w},fromArray:function(t,e){return void 0===e&&(e=0),this.x=t[e],this.y=t[e+1],this.z=t[e+2],this.w=t[e+3],this},toArray:function(t,e){return void 0===t&&(t=[]),void 0===e&&(e=0),t[e]=this.x,t[e+1]=this.y,t[e+2]=this.z,t[e+3]=this.w,t},fromBufferAttribute:function(t,e,n){return void 0!==n&&console.warn("THREE.Vector4: offset has been removed from .fromBufferAttribute()."),this.x=t.getX(e),this.y=t.getY(e),this.z=t.getZ(e),this.w=t.getW(e),this}},s.prototype={constructor:s,isWebGLRenderTarget:!0,setSize:function(t,e){this.width===t&&this.height===e||(this.width=t,this.height=e,this.dispose()),this.viewport.set(0,0,t,e),this.scissor.set(0,0,t,e)},clone:function(){return(new this.constructor).copy(this)},copy:function(t){return this.width=t.width,this.height=t.height,this.viewport.copy(t.viewport),this.texture=t.texture.clone(),this.depthBuffer=t.depthBuffer,this.stencilBuffer=t.stencilBuffer,this.depthTexture=t.depthTexture,this},dispose:function(){this.dispatchEvent({type:"dispose"})}},Object.assign(s.prototype,r.prototype),u.prototype=Object.create(s.prototype),u.prototype.constructor=u,u.prototype.isWebGLRenderTargetCube=!0,c.prototype={constructor:c,get x(){return this._x},set x(t){this._x=t,this.onChangeCallback()},get y(){return this._y},set y(t){this._y=t,this.onChangeCallback()},get z(){return this._z},set z(t){this._z=t,this.onChangeCallback()},get w(){return this._w},set w(t){this._w=t,this.onChangeCallback()},set:function(t,e,n,r){return this._x=t,this._y=e,this._z=n,this._w=r,this.onChangeCallback(),this},clone:function(){return new this.constructor(this._x,this._y,this._z,this._w)},copy:function(t){return this._x=t.x,this._y=t.y,this._z=t.z,this._w=t.w,this.onChangeCallback(),this},setFromEuler:function(t,e){if(!1===(t&&t.isEuler))throw new Error("THREE.Quaternion: .setFromEuler() now expects an Euler rotation rather than a Vector3 and order.");var n=Math.cos(t._x/2),r=Math.cos(t._y/2),i=Math.cos(t._z/2),o=Math.sin(t._x/2),a=Math.sin(t._y/2),s=Math.sin(t._z/2),u=t.order;return"XYZ"===u?(this._x=o*r*i+n*a*s,this._y=n*a*i-o*r*s,this._z=n*r*s+o*a*i,this._w=n*r*i-o*a*s):"YXZ"===u?(this._x=o*r*i+n*a*s,this._y=n*a*i-o*r*s,this._z=n*r*s-o*a*i,this._w=n*r*i+o*a*s):"ZXY"===u?(this._x=o*r*i-n*a*s,this._y=n*a*i+o*r*s,this._z=n*r*s+o*a*i,this._w=n*r*i-o*a*s):"ZYX"===u?(this._x=o*r*i-n*a*s,this._y=n*a*i+o*r*s,this._z=n*r*s-o*a*i,this._w=n*r*i+o*a*s):"YZX"===u?(this._x=o*r*i+n*a*s,this._y=n*a*i+o*r*s,this._z=n*r*s-o*a*i,this._w=n*r*i-o*a*s):"XZY"===u&&(this._x=o*r*i-n*a*s,this._y=n*a*i-o*r*s,this._z=n*r*s+o*a*i,this._w=n*r*i+o*a*s),!1!==e&&this.onChangeCallback(),this},setFromAxisAngle:function(t,e){var n=e/2,r=Math.sin(n);return this._x=t.x*r,this._y=t.y*r,this._z=t.z*r,this._w=Math.cos(n),this.onChangeCallback(),this},setFromRotationMatrix:function(t){var e,n=t.elements,r=n[0],i=n[4],o=n[8],a=n[1],s=n[5],u=n[9],c=n[2],l=n[6],h=n[10],p=r+s+h;return p>0?(e=.5/Math.sqrt(p+1),this._w=.25/e,this._x=(l-u)*e,this._y=(o-c)*e,this._z=(a-i)*e):r>s&&r>h?(e=2*Math.sqrt(1+r-s-h),this._w=(l-u)/e,this._x=.25*e,this._y=(i+a)/e,this._z=(o+c)/e):s>h?(e=2*Math.sqrt(1+s-r-h),this._w=(o-c)/e,this._x=(i+a)/e,this._y=.25*e,this._z=(u+l)/e):(e=2*Math.sqrt(1+h-r-s),this._w=(a-i)/e,this._x=(o+c)/e,this._y=(u+l)/e,this._z=.25*e),this.onChangeCallback(),this},setFromUnitVectors:function(){var t,e;return function(n,r){return void 0===t&&(t=new l),e=n.dot(r)+1,e<1e-6?(e=0,Math.abs(n.x)>Math.abs(n.z)?t.set(-n.y,n.x,0):t.set(0,-n.z,n.y)):t.crossVectors(n,r),this._x=t.x,this._y=t.y,this._z=t.z,this._w=e,this.normalize()}}(),inverse:function(){return this.conjugate().normalize()},conjugate:function(){return this._x*=-1,this._y*=-1,this._z*=-1,this.onChangeCallback(),this},dot:function(t){return this._x*t._x+this._y*t._y+this._z*t._z+this._w*t._w},lengthSq:function(){return this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w},length:function(){return Math.sqrt(this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w)},normalize:function(){var t=this.length();return 0===t?(this._x=0,this._y=0,this._z=0,this._w=1):(t=1/t,this._x=this._x*t,this._y=this._y*t,this._z=this._z*t,this._w=this._w*t),this.onChangeCallback(),this},multiply:function(t,e){return void 0!==e?(console.warn("THREE.Quaternion: .multiply() now only accepts one argument. Use .multiplyQuaternions( a, b ) instead."),this.multiplyQuaternions(t,e)):this.multiplyQuaternions(this,t)},premultiply:function(t){return this.multiplyQuaternions(t,this)},multiplyQuaternions:function(t,e){var n=t._x,r=t._y,i=t._z,o=t._w,a=e._x,s=e._y,u=e._z,c=e._w;return this._x=n*c+o*a+r*u-i*s,this._y=r*c+o*s+i*a-n*u,this._z=i*c+o*u+n*s-r*a,this._w=o*c-n*a-r*s-i*u,this.onChangeCallback(),this},slerp:function(t,e){if(0===e)return this;if(1===e)return this.copy(t);var n=this._x,r=this._y,i=this._z,o=this._w,a=o*t._w+n*t._x+r*t._y+i*t._z;if(a<0?(this._w=-t._w,this._x=-t._x,this._y=-t._y,this._z=-t._z,a=-a):this.copy(t),a>=1)return this._w=o,this._x=n,this._y=r,this._z=i,this;var s=Math.sqrt(1-a*a);if(Math.abs(s)<.001)return this._w=.5*(o+this._w),this._x=.5*(n+this._x),this._y=.5*(r+this._y),this._z=.5*(i+this._z),this;var u=Math.atan2(s,a),c=Math.sin((1-e)*u)/s,l=Math.sin(e*u)/s;return this._w=o*c+this._w*l,this._x=n*c+this._x*l,this._y=r*c+this._y*l,this._z=i*c+this._z*l,this.onChangeCallback(),this},equals:function(t){return t._x===this._x&&t._y===this._y&&t._z===this._z&&t._w===this._w},fromArray:function(t,e){return void 0===e&&(e=0),this._x=t[e],this._y=t[e+1],this._z=t[e+2],this._w=t[e+3],this.onChangeCallback(),this},toArray:function(t,e){return void 0===t&&(t=[]),void 0===e&&(e=0),t[e]=this._x,t[e+1]=this._y,t[e+2]=this._z,t[e+3]=this._w,t},onChange:function(t){return this.onChangeCallback=t,this},onChangeCallback:function(){}},Object.assign(c,{slerp:function(t,e,n,r){return n.copy(t).slerp(e,r)},slerpFlat:function(t,e,n,r,i,o,a){var s=n[r+0],u=n[r+1],c=n[r+2],l=n[r+3],h=i[o+0],p=i[o+1],f=i[o+2],d=i[o+3];if(l!==d||s!==h||u!==p||c!==f){var m=1-a,v=s*h+u*p+c*f+l*d,g=v>=0?1:-1,y=1-v*v;if(y>Number.EPSILON){var b=Math.sqrt(y),x=Math.atan2(b,v*g);m=Math.sin(m*x)/b,a=Math.sin(a*x)/b}var _=a*g;if(s=s*m+h*_,u=u*m+p*_,c=c*m+f*_,l=l*m+d*_,m===1-a){var w=1/Math.sqrt(s*s+u*u+c*c+l*l);s*=w,u*=w,c*=w,l*=w}}t[e]=s,t[e+1]=u,t[e+2]=c,t[e+3]=l}}),l.prototype={constructor:l,isVector3:!0,set:function(t,e,n){return this.x=t,this.y=e,this.z=n,this},setScalar:function(t){return this.x=t,this.y=t,this.z=t,this},setX:function(t){return this.x=t,this},setY:function(t){return this.y=t,this},setZ:function(t){return this.z=t,this},setComponent:function(t,e){switch(t){case 0:this.x=e;break;case 1:this.y=e;break;case 2:this.z=e;break;default:throw new Error("index is out of range: "+t)}return this},getComponent:function(t){switch(t){case 0:return this.x;case 1:return this.y;case 2:return this.z;default:throw new Error("index is out of range: "+t)}},clone:function(){return new this.constructor(this.x,this.y,this.z)},copy:function(t){return this.x=t.x,this.y=t.y,this.z=t.z,this},add:function(t,e){return void 0!==e?(console.warn("THREE.Vector3: .add() now only accepts one argument. Use .addVectors( a, b ) instead."),this.addVectors(t,e)):(this.x+=t.x,this.y+=t.y,this.z+=t.z,this)},addScalar:function(t){return this.x+=t,this.y+=t,this.z+=t,this},addVectors:function(t,e){return this.x=t.x+e.x,this.y=t.y+e.y,this.z=t.z+e.z,this},addScaledVector:function(t,e){return this.x+=t.x*e,this.y+=t.y*e,this.z+=t.z*e,this},sub:function(t,e){return void 0!==e?(console.warn("THREE.Vector3: .sub() now only accepts one argument. Use .subVectors( a, b ) instead."),this.subVectors(t,e)):(this.x-=t.x,this.y-=t.y,this.z-=t.z,this)},subScalar:function(t){return this.x-=t,this.y-=t,this.z-=t,this},subVectors:function(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this.z=t.z-e.z,this},multiply:function(t,e){return void 0!==e?(console.warn("THREE.Vector3: .multiply() now only accepts one argument. Use .multiplyVectors( a, b ) instead."),this.multiplyVectors(t,e)):(this.x*=t.x,this.y*=t.y,this.z*=t.z,this)},multiplyScalar:function(t){return isFinite(t)?(this.x*=t,this.y*=t,this.z*=t):(this.x=0,this.y=0,this.z=0),this},multiplyVectors:function(t,e){return this.x=t.x*e.x,this.y=t.y*e.y,this.z=t.z*e.z,this},applyEuler:function(){var t;return function(e){return!1===(e&&e.isEuler)&&console.error("THREE.Vector3: .applyEuler() now expects an Euler rotation rather than a Vector3 and order."),void 0===t&&(t=new c),this.applyQuaternion(t.setFromEuler(e))}}(),applyAxisAngle:function(){var t;return function(e,n){return void 0===t&&(t=new c),this.applyQuaternion(t.setFromAxisAngle(e,n))}}(),applyMatrix3:function(t){var e=this.x,n=this.y,r=this.z,i=t.elements;return this.x=i[0]*e+i[3]*n+i[6]*r,this.y=i[1]*e+i[4]*n+i[7]*r,this.z=i[2]*e+i[5]*n+i[8]*r,this},applyMatrix4:function(t){var e=this.x,n=this.y,r=this.z,i=t.elements;this.x=i[0]*e+i[4]*n+i[8]*r+i[12],this.y=i[1]*e+i[5]*n+i[9]*r+i[13],this.z=i[2]*e+i[6]*n+i[10]*r+i[14];var o=i[3]*e+i[7]*n+i[11]*r+i[15];return this.divideScalar(o)},applyQuaternion:function(t){var e=this.x,n=this.y,r=this.z,i=t.x,o=t.y,a=t.z,s=t.w,u=s*e+o*r-a*n,c=s*n+a*e-i*r,l=s*r+i*n-o*e,h=-i*e-o*n-a*r;return this.x=u*s+h*-i+c*-a-l*-o,this.y=c*s+h*-o+l*-i-u*-a,this.z=l*s+h*-a+u*-o-c*-i,this},project:function(){var t;return function(e){return void 0===t&&(t=new h),t.multiplyMatrices(e.projectionMatrix,t.getInverse(e.matrixWorld)),this.applyMatrix4(t)}}(),unproject:function(){var t;return function(e){return void 0===t&&(t=new h),t.multiplyMatrices(e.matrixWorld,t.getInverse(e.projectionMatrix)),this.applyMatrix4(t)}}(),transformDirection:function(t){var e=this.x,n=this.y,r=this.z,i=t.elements;return this.x=i[0]*e+i[4]*n+i[8]*r,this.y=i[1]*e+i[5]*n+i[9]*r,this.z=i[2]*e+i[6]*n+i[10]*r,this.normalize()},divide:function(t){return this.x/=t.x,this.y/=t.y,this.z/=t.z,this},divideScalar:function(t){return this.multiplyScalar(1/t)},min:function(t){return this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y),this.z=Math.min(this.z,t.z),this},max:function(t){return this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y),this.z=Math.max(this.z,t.z),this},clamp:function(t,e){return this.x=Math.max(t.x,Math.min(e.x,this.x)),this.y=Math.max(t.y,Math.min(e.y,this.y)),this.z=Math.max(t.z,Math.min(e.z,this.z)),this},clampScalar:function(){var t,e;return function(n,r){return void 0===t&&(t=new l,e=new l),t.set(n,n,n),e.set(r,r,r),this.clamp(t,e)}}(),clampLength:function(t,e){var n=this.length();return this.multiplyScalar(Math.max(t,Math.min(e,n))/n)},floor:function(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this},ceil:function(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this},round:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this},roundToZero:function(){return this.x=this.x<0?Math.ceil(this.x):Math.floor(this.x),this.y=this.y<0?Math.ceil(this.y):Math.floor(this.y),this.z=this.z<0?Math.ceil(this.z):Math.floor(this.z),this},negate:function(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this},dot:function(t){return this.x*t.x+this.y*t.y+this.z*t.z},lengthSq:function(){return this.x*this.x+this.y*this.y+this.z*this.z},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)},lengthManhattan:function(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)},normalize:function(){return this.divideScalar(this.length())},setLength:function(t){return this.multiplyScalar(t/this.length())},lerp:function(t,e){return this.x+=(t.x-this.x)*e,this.y+=(t.y-this.y)*e,this.z+=(t.z-this.z)*e,this},lerpVectors:function(t,e,n){return this.subVectors(e,t).multiplyScalar(n).add(t)},cross:function(t,e){if(void 0!==e)return console.warn("THREE.Vector3: .cross() now only accepts one argument. Use .crossVectors( a, b ) instead."),this.crossVectors(t,e);var n=this.x,r=this.y,i=this.z;return this.x=r*t.z-i*t.y,this.y=i*t.x-n*t.z,this.z=n*t.y-r*t.x,this},crossVectors:function(t,e){var n=t.x,r=t.y,i=t.z,o=e.x,a=e.y,s=e.z;return this.x=r*s-i*a,this.y=i*o-n*s,this.z=n*a-r*o,this},projectOnVector:function(t){var e=t.dot(this)/t.lengthSq();return this.copy(t).multiplyScalar(e)},projectOnPlane:function(){var t;return function(e){return void 0===t&&(t=new l),t.copy(this).projectOnVector(e),this.sub(t)}}(),reflect:function(){var t;return function(e){return void 0===t&&(t=new l),this.sub(t.copy(e).multiplyScalar(2*this.dot(e)))}}(),angleTo:function(t){var e=this.dot(t)/Math.sqrt(this.lengthSq()*t.lengthSq());return Math.acos(fs.clamp(e,-1,1))},distanceTo:function(t){return Math.sqrt(this.distanceToSquared(t))},distanceToSquared:function(t){var e=this.x-t.x,n=this.y-t.y,r=this.z-t.z;return e*e+n*n+r*r},distanceToManhattan:function(t){return Math.abs(this.x-t.x)+Math.abs(this.y-t.y)+Math.abs(this.z-t.z)},setFromSpherical:function(t){var e=Math.sin(t.phi)*t.radius;return this.x=e*Math.sin(t.theta),this.y=Math.cos(t.phi)*t.radius,this.z=e*Math.cos(t.theta),this},setFromCylindrical:function(t){return this.x=t.radius*Math.sin(t.theta),this.y=t.y,this.z=t.radius*Math.cos(t.theta),this},setFromMatrixPosition:function(t){return this.setFromMatrixColumn(t,3)},setFromMatrixScale:function(t){var e=this.setFromMatrixColumn(t,0).length(),n=this.setFromMatrixColumn(t,1).length(),r=this.setFromMatrixColumn(t,2).length();return this.x=e,this.y=n,this.z=r,this},setFromMatrixColumn:function(t,e){if("number"==typeof t){console.warn("THREE.Vector3: setFromMatrixColumn now expects ( matrix, index ).");var n=t;t=e,e=n}return this.fromArray(t.elements,4*e)},equals:function(t){return t.x===this.x&&t.y===this.y&&t.z===this.z},fromArray:function(t,e){return void 0===e&&(e=0),this.x=t[e],this.y=t[e+1],this.z=t[e+2],this},toArray:function(t,e){return void 0===t&&(t=[]),void 0===e&&(e=0),t[e]=this.x,t[e+1]=this.y,t[e+2]=this.z,t},fromBufferAttribute:function(t,e,n){return void 0!==n&&console.warn("THREE.Vector3: offset has been removed from .fromBufferAttribute()."),this.x=t.getX(e),this.y=t.getY(e),this.z=t.getZ(e),this}},h.prototype={constructor:h,isMatrix4:!0,set:function(t,e,n,r,i,o,a,s,u,c,l,h,p,f,d,m){var v=this.elements;return v[0]=t,v[4]=e,v[8]=n,v[12]=r,v[1]=i,v[5]=o,v[9]=a,v[13]=s,v[2]=u,v[6]=c,v[10]=l,v[14]=h,v[3]=p,v[7]=f,v[11]=d,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 h).fromArray(this.elements)},copy:function(t){return this.elements.set(t.elements),this},copyPosition:function(t){var e=this.elements,n=t.elements;return e[12]=n[12],e[13]=n[13],e[14]=n[14],this},extractBasis:function(t,e,n){return t.setFromMatrixColumn(this,0),e.setFromMatrixColumn(this,1),n.setFromMatrixColumn(this,2),this},makeBasis:function(t,e,n){return this.set(t.x,e.x,n.x,0,t.y,e.y,n.y,0,t.z,e.z,n.z,0,0,0,0,1),this},extractRotation:function(){var t;return function(e){void 0===t&&(t=new l);var n=this.elements,r=e.elements,i=1/t.setFromMatrixColumn(e,0).length(),o=1/t.setFromMatrixColumn(e,1).length(),a=1/t.setFromMatrixColumn(e,2).length();return n[0]=r[0]*i,n[1]=r[1]*i,n[2]=r[2]*i,n[4]=r[4]*o,n[5]=r[5]*o,n[6]=r[6]*o,n[8]=r[8]*a,n[9]=r[9]*a,n[10]=r[10]*a,this}}(),makeRotationFromEuler:function(t){!1===(t&&t.isEuler)&&console.error("THREE.Matrix: .makeRotationFromEuler() now expects a Euler rotation rather than a Vector3 and order.");var e=this.elements,n=t.x,r=t.y,i=t.z,o=Math.cos(n),a=Math.sin(n),s=Math.cos(r),u=Math.sin(r),c=Math.cos(i),l=Math.sin(i);if("XYZ"===t.order){var h=o*c,p=o*l,f=a*c,d=a*l;e[0]=s*c,e[4]=-s*l,e[8]=u,e[1]=p+f*u,e[5]=h-d*u,e[9]=-a*s,e[2]=d-h*u,e[6]=f+p*u,e[10]=o*s}else if("YXZ"===t.order){var m=s*c,v=s*l,g=u*c,y=u*l;e[0]=m+y*a,e[4]=g*a-v,e[8]=o*u,e[1]=o*l,e[5]=o*c,e[9]=-a,e[2]=v*a-g,e[6]=y+m*a,e[10]=o*s}else if("ZXY"===t.order){var m=s*c,v=s*l,g=u*c,y=u*l;e[0]=m-y*a,e[4]=-o*l,e[8]=g+v*a,e[1]=v+g*a,e[5]=o*c,e[9]=y-m*a,e[2]=-o*u,e[6]=a,e[10]=o*s}else if("ZYX"===t.order){var h=o*c,p=o*l,f=a*c,d=a*l;e[0]=s*c,e[4]=f*u-p,e[8]=h*u+d,e[1]=s*l,e[5]=d*u+h,e[9]=p*u-f,e[2]=-u,e[6]=a*s,e[10]=o*s}else if("YZX"===t.order){var b=o*s,x=o*u,_=a*s,w=a*u;e[0]=s*c,e[4]=w-b*l,e[8]=_*l+x,e[1]=l,e[5]=o*c,e[9]=-a*c,e[2]=-u*c,e[6]=x*l+_,e[10]=b-w*l}else if("XZY"===t.order){var b=o*s,x=o*u,_=a*s,w=a*u;e[0]=s*c,e[4]=-l,e[8]=u*c,e[1]=b*l+w,e[5]=o*c,e[9]=x*l-_,e[2]=_*l-x,e[6]=a*c,e[10]=w*l+b}return e[3]=0,e[7]=0,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,this},makeRotationFromQuaternion:function(t){var e=this.elements,n=t.x,r=t.y,i=t.z,o=t.w,a=n+n,s=r+r,u=i+i,c=n*a,l=n*s,h=n*u,p=r*s,f=r*u,d=i*u,m=o*a,v=o*s,g=o*u;return e[0]=1-(p+d),e[4]=l-g,e[8]=h+v,e[1]=l+g,e[5]=1-(c+d),e[9]=f-m,e[2]=h-v,e[6]=f+m,e[10]=1-(c+p),e[3]=0,e[7]=0,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,this},lookAt:function(){var t,e,n;return function(r,i,o){void 0===t&&(t=new l,e=new l,n=new l);var a=this.elements;return n.subVectors(r,i).normalize(),0===n.lengthSq()&&(n.z=1),t.crossVectors(o,n).normalize(),0===t.lengthSq()&&(n.z+=1e-4,t.crossVectors(o,n).normalize()),e.crossVectors(n,t),a[0]=t.x,a[4]=e.x,a[8]=n.x,a[1]=t.y,a[5]=e.y,a[9]=n.y,a[2]=t.z,a[6]=e.z,a[10]=n.z,this}}(),multiply:function(t,e){return void 0!==e?(console.warn("THREE.Matrix4: .multiply() now only accepts one argument. Use .multiplyMatrices( a, b ) instead."),this.multiplyMatrices(t,e)):this.multiplyMatrices(this,t)},premultiply:function(t){return this.multiplyMatrices(t,this)},multiplyMatrices:function(t,e){var n=t.elements,r=e.elements,i=this.elements,o=n[0],a=n[4],s=n[8],u=n[12],c=n[1],l=n[5],h=n[9],p=n[13],f=n[2],d=n[6],m=n[10],v=n[14],g=n[3],y=n[7],b=n[11],x=n[15],_=r[0],w=r[4],E=r[8],M=r[12],T=r[1],S=r[5],A=r[9],C=r[13],P=r[2],R=r[6],L=r[10],O=r[14],I=r[3],N=r[7],D=r[11],k=r[15];return i[0]=o*_+a*T+s*P+u*I,i[4]=o*w+a*S+s*R+u*N,i[8]=o*E+a*A+s*L+u*D,i[12]=o*M+a*C+s*O+u*k,i[1]=c*_+l*T+h*P+p*I,i[5]=c*w+l*S+h*R+p*N,i[9]=c*E+l*A+h*L+p*D,i[13]=c*M+l*C+h*O+p*k,i[2]=f*_+d*T+m*P+v*I,i[6]=f*w+d*S+m*R+v*N,i[10]=f*E+d*A+m*L+v*D,i[14]=f*M+d*C+m*O+v*k,i[3]=g*_+y*T+b*P+x*I,i[7]=g*w+y*S+b*R+x*N,i[11]=g*E+y*A+b*L+x*D,i[15]=g*M+y*C+b*O+x*k,this},multiplyToArray:function(t,e,n){var r=this.elements;return this.multiplyMatrices(t,e),n[0]=r[0],n[1]=r[1],n[2]=r[2],n[3]=r[3],n[4]=r[4],n[5]=r[5],n[6]=r[6],n[7]=r[7],n[8]=r[8],n[9]=r[9],n[10]=r[10],n[11]=r[11],n[12]=r[12],n[13]=r[13],n[14]=r[14],n[15]=r[15],this},multiplyScalar:function(t){var e=this.elements;return e[0]*=t,e[4]*=t,e[8]*=t,e[12]*=t,e[1]*=t,e[5]*=t,e[9]*=t,e[13]*=t,e[2]*=t,e[6]*=t,e[10]*=t,e[14]*=t,e[3]*=t,e[7]*=t,e[11]*=t,e[15]*=t,this},applyToBufferAttribute:function(){var t;return function(e){void 0===t&&(t=new l);for(var n=0,r=e.count;n 0.0 ) {\n#if defined ( PHYSICALLY_CORRECT_LIGHTS )\n\t\t\tfloat distanceFalloff = 1.0 / max( pow( lightDistance, decayExponent ), 0.01 );\n\t\t\tfloat maxDistanceCutoffFactor = pow2( saturate( 1.0 - pow4( lightDistance / cutoffDistance ) ) );\n\t\t\treturn distanceFalloff * maxDistanceCutoffFactor;\n#else\n\t\t\treturn pow( saturate( -lightDistance / cutoffDistance + 1.0 ), decayExponent );\n#endif\n\t\t}\n\t\treturn 1.0;\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}\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 GeometricContext geometry, const in vec3 specularColor, const in float roughness ) {\n\tfloat alpha = pow2( roughness );\n\tvec3 halfDir = normalize( incidentLight.direction + geometry.viewDir );\n\tfloat dotNL = saturate( dot( geometry.normal, incidentLight.direction ) );\n\tfloat dotNV = saturate( dot( geometry.normal, 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_GGX_SmithCorrelated( alpha, dotNL, dotNV );\n\tfloat D = D_GGX( alpha, dotNH );\n\treturn F * ( G * D );\n}\nvec2 ltcTextureCoords( const in GeometricContext geometry, 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\tvec3 N = geometry.normal;\n\tvec3 V = geometry.viewDir;\n\tvec3 P = geometry.position;\n\tfloat theta = acos( dot( N, V ) );\n\tvec2 uv = vec2(\n\t\tsqrt( saturate( roughness ) ),\n\t\tsaturate( theta / ( 0.5 * PI ) ) );\n\tuv = uv * LUT_SCALE + LUT_BIAS;\n\treturn uv;\n}\nvoid clipQuadToHorizon( inout vec3 L[5], out int n ) {\n\tint config = 0;\n\tif ( L[0].z > 0.0 ) config += 1;\n\tif ( L[1].z > 0.0 ) config += 2;\n\tif ( L[2].z > 0.0 ) config += 4;\n\tif ( L[3].z > 0.0 ) config += 8;\n\tn = 0;\n\tif ( config == 0 ) {\n\t} else if ( config == 1 ) {\n\t\tn = 3;\n\t\tL[1] = -L[1].z * L[0] + L[0].z * L[1];\n\t\tL[2] = -L[3].z * L[0] + L[0].z * L[3];\n\t} else if ( config == 2 ) {\n\t\tn = 3;\n\t\tL[0] = -L[0].z * L[1] + L[1].z * L[0];\n\t\tL[2] = -L[2].z * L[1] + L[1].z * L[2];\n\t} else if ( config == 3 ) {\n\t\tn = 4;\n\t\tL[2] = -L[2].z * L[1] + L[1].z * L[2];\n\t\tL[3] = -L[3].z * L[0] + L[0].z * L[3];\n\t} else if ( config == 4 ) {\n\t\tn = 3;\n\t\tL[0] = -L[3].z * L[2] + L[2].z * L[3];\n\t\tL[1] = -L[1].z * L[2] + L[2].z * L[1];\n\t} else if ( config == 5 ) {\n\t\tn = 0;\n\t} else if ( config == 6 ) {\n\t\tn = 4;\n\t\tL[0] = -L[0].z * L[1] + L[1].z * L[0];\n\t\tL[3] = -L[3].z * L[2] + L[2].z * L[3];\n\t} else if ( config == 7 ) {\n\t\tn = 5;\n\t\tL[4] = -L[3].z * L[0] + L[0].z * L[3];\n\t\tL[3] = -L[3].z * L[2] + L[2].z * L[3];\n\t} else if ( config == 8 ) {\n\t\tn = 3;\n\t\tL[0] = -L[0].z * L[3] + L[3].z * L[0];\n\t\tL[1] = -L[2].z * L[3] + L[3].z * L[2];\n\t\tL[2] = L[3];\n\t} else if ( config == 9 ) {\n\t\tn = 4;\n\t\tL[1] = -L[1].z * L[0] + L[0].z * L[1];\n\t\tL[2] = -L[2].z * L[3] + L[3].z * L[2];\n\t} else if ( config == 10 ) {\n\t\tn = 0;\n\t} else if ( config == 11 ) {\n\t\tn = 5;\n\t\tL[4] = L[3];\n\t\tL[3] = -L[2].z * L[3] + L[3].z * L[2];\n\t\tL[2] = -L[2].z * L[1] + L[1].z * L[2];\n\t} else if ( config == 12 ) {\n\t\tn = 4;\n\t\tL[1] = -L[1].z * L[2] + L[2].z * L[1];\n\t\tL[0] = -L[0].z * L[3] + L[3].z * L[0];\n\t} else if ( config == 13 ) {\n\t\tn = 5;\n\t\tL[4] = L[3];\n\t\tL[3] = L[2];\n\t\tL[2] = -L[1].z * L[2] + L[2].z * L[1];\n\t\tL[1] = -L[1].z * L[0] + L[0].z * L[1];\n\t} else if ( config == 14 ) {\n\t\tn = 5;\n\t\tL[4] = -L[0].z * L[3] + L[3].z * L[0];\n\t\tL[0] = -L[0].z * L[1] + L[1].z * L[0];\n\t} else if ( config == 15 ) {\n\t\tn = 4;\n\t}\n\tif ( n == 3 )\n\t\tL[3] = L[0];\n\tif ( n == 4 )\n\t\tL[4] = L[0];\n}\nfloat integrateLtcBrdfOverRectEdge( vec3 v1, vec3 v2 ) {\n\tfloat cosTheta = dot( v1, v2 );\n\tfloat theta = acos( cosTheta );\n\tfloat res = cross( v1, v2 ).z * ( ( theta > 0.001 ) ? theta / sin( theta ) : 1.0 );\n\treturn res;\n}\nvoid initRectPoints( const in vec3 pos, const in vec3 halfWidth, const in vec3 halfHeight, out vec3 rectPoints[4] ) {\n\trectPoints[0] = pos - halfWidth - halfHeight;\n\trectPoints[1] = pos + halfWidth - halfHeight;\n\trectPoints[2] = pos + halfWidth + halfHeight;\n\trectPoints[3] = pos - halfWidth + halfHeight;\n}\nvec3 integrateLtcBrdfOverRect( const in GeometricContext geometry, const in mat3 brdfMat, const in vec3 rectPoints[4] ) {\n\tvec3 N = geometry.normal;\n\tvec3 V = geometry.viewDir;\n\tvec3 P = geometry.position;\n\tvec3 T1, T2;\n\tT1 = normalize(V - N * dot( V, N ));\n\tT2 = - cross( N, T1 );\n\tmat3 brdfWrtSurface = brdfMat * transpose( mat3( T1, T2, N ) );\n\tvec3 clippedRect[5];\n\tclippedRect[0] = brdfWrtSurface * ( rectPoints[0] - P );\n\tclippedRect[1] = brdfWrtSurface * ( rectPoints[1] - P );\n\tclippedRect[2] = brdfWrtSurface * ( rectPoints[2] - P );\n\tclippedRect[3] = brdfWrtSurface * ( rectPoints[3] - P );\n\tint n;\n\tclipQuadToHorizon(clippedRect, n);\n\tif ( n == 0 )\n\t\treturn vec3( 0, 0, 0 );\n\tclippedRect[0] = normalize( clippedRect[0] );\n\tclippedRect[1] = normalize( clippedRect[1] );\n\tclippedRect[2] = normalize( clippedRect[2] );\n\tclippedRect[3] = normalize( clippedRect[3] );\n\tclippedRect[4] = normalize( clippedRect[4] );\n\tfloat sum = 0.0;\n\tsum += integrateLtcBrdfOverRectEdge( clippedRect[0], clippedRect[1] );\n\tsum += integrateLtcBrdfOverRectEdge( clippedRect[1], clippedRect[2] );\n\tsum += integrateLtcBrdfOverRectEdge( clippedRect[2], clippedRect[3] );\n\tif (n >= 4)\n\t\tsum += integrateLtcBrdfOverRectEdge( clippedRect[3], clippedRect[4] );\n\tif (n == 5)\n\t\tsum += integrateLtcBrdfOverRectEdge( clippedRect[4], clippedRect[0] );\n\tsum = max( 0.0, sum );\n\tvec3 Lo_i = vec3( sum, sum, sum );\n\treturn Lo_i;\n}\nvec3 Rect_Area_Light_Specular_Reflectance(\n\t\tconst in GeometricContext geometry,\n\t\tconst in vec3 lightPos, const in vec3 lightHalfWidth, const in vec3 lightHalfHeight,\n\t\tconst in float roughness,\n\t\tconst in sampler2D ltcMat, const in sampler2D ltcMag ) {\n\tvec3 rectPoints[4];\n\tinitRectPoints( lightPos, lightHalfWidth, lightHalfHeight, rectPoints );\n\tvec2 uv = ltcTextureCoords( geometry, roughness );\n\tvec4 brdfLtcApproxParams, t;\n\tbrdfLtcApproxParams = texture2D( ltcMat, uv );\n\tt = texture2D( ltcMat, uv );\n\tfloat brdfLtcScalar = texture2D( ltcMag, uv ).a;\n\tmat3 brdfLtcApproxMat = mat3(\n\t\tvec3( 1, 0, t.y ),\n\t\tvec3( 0, t.z, 0 ),\n\t\tvec3( t.w, 0, t.x )\n\t);\n\tvec3 specularReflectance = integrateLtcBrdfOverRect( geometry, brdfLtcApproxMat, rectPoints );\n\tspecularReflectance *= brdfLtcScalar;\n\treturn specularReflectance;\n}\nvec3 Rect_Area_Light_Diffuse_Reflectance(\n\t\tconst in GeometricContext geometry,\n\t\tconst in vec3 lightPos, const in vec3 lightHalfWidth, const in vec3 lightHalfHeight ) {\n\tvec3 rectPoints[4];\n\tinitRectPoints( lightPos, lightHalfWidth, lightHalfHeight, rectPoints );\n\tmat3 diffuseBrdfMat = mat3(1);\n\tvec3 diffuseReflectance = integrateLtcBrdfOverRect( geometry, diffuseBrdfMat, rectPoints );\n\treturn diffuseReflectance;\n}\nvec3 BRDF_Specular_GGX_Environment( const in GeometricContext geometry, const in vec3 specularColor, const in float roughness ) {\n\tfloat dotNV = saturate( dot( geometry.normal, geometry.viewDir ) );\n\tconst vec4 c0 = vec4( - 1, - 0.0275, - 0.572, 0.022 );\n\tconst vec4 c1 = vec4( 1, 0.0425, 1.04, - 0.04 );\n\tvec4 r = roughness * c0 + c1;\n\tfloat a004 = min( r.x * r.x, exp2( - 9.28 * dotNV ) ) * r.x + r.y;\n\tvec2 AB = vec2( -1.04, 1.04 ) * a004 + r.zw;\n\treturn specularColor * AB.x + AB.y;\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",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 = dFdx( surf_pos );\n\t\tvec3 vSigmaY = dFdy( surf_pos );\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\tvec3 vGrad = sign( fDet ) * ( dHdxy.x * R1 + dHdxy.y * R2 );\n\t\treturn normalize( abs( fDet ) * surf_norm - vGrad );\n\t}\n#endif\n",clipping_planes_fragment:"#if NUM_CLIPPING_PLANES > 0\n\tfor ( int i = 0; i < UNION_CLIPPING_PLANES; ++ i ) {\n\t\tvec4 plane = clippingPlanes[ i ];\n\t\tif ( dot( vViewPosition, plane.xyz ) > plane.w ) discard;\n\t}\n\t\t\n\t#if UNION_CLIPPING_PLANES < NUM_CLIPPING_PLANES\n\t\tbool clipped = true;\n\t\tfor ( int i = UNION_CLIPPING_PLANES; i < NUM_CLIPPING_PLANES; ++ i ) {\n\t\t\tvec4 plane = clippingPlanes[ i ];\n\t\t\tclipped = ( dot( vViewPosition, plane.xyz ) > plane.w ) && clipped;\n\t\t}\n\t\tif ( clipped ) discard;\n\t\n\t#endif\n#endif\n",clipping_planes_pars_fragment:"#if NUM_CLIPPING_PLANES > 0\n\t#if ! defined( PHYSICAL ) && ! defined( PHONG )\n\t\tvarying vec3 vViewPosition;\n\t#endif\n\tuniform vec4 clippingPlanes[ NUM_CLIPPING_PLANES ];\n#endif\n",clipping_planes_pars_vertex:"#if NUM_CLIPPING_PLANES > 0 && ! defined( PHYSICAL ) && ! defined( PHONG )\n\tvarying vec3 vViewPosition;\n#endif\n",clipping_planes_vertex:"#if NUM_CLIPPING_PLANES > 0 && ! defined( PHYSICAL ) && ! defined( PHONG )\n\tvViewPosition = - mvPosition.xyz;\n#endif\n",color_fragment:"#ifdef USE_COLOR\n\tdiffuseColor.rgb *= vColor;\n#endif",color_pars_fragment:"#ifdef USE_COLOR\n\tvarying vec3 vColor;\n#endif\n",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#define saturate(a) clamp( a, 0.0, 1.0 )\n#define whiteCompliment(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}\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};\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 transpose( const in mat3 v ) {\n\tmat3 tmp;\n\ttmp[0] = vec3(v[0].x, v[1].x, v[2].x);\n\ttmp[1] = vec3(v[0].y, v[1].y, v[2].y);\n\ttmp[2] = vec3(v[0].z, v[1].z, v[2].z);\n\treturn tmp;\n}\n",cube_uv_reflection_fragment:"#ifdef ENVMAP_TYPE_CUBE_UV\n#define cubeUV_textureSize (1024.0)\nint getFaceFromDirection(vec3 direction) {\n\tvec3 absDirection = abs(direction);\n\tint face = -1;\n\tif( absDirection.x > absDirection.z ) {\n\t\tif(absDirection.x > absDirection.y )\n\t\t\tface = direction.x > 0.0 ? 0 : 3;\n\t\telse\n\t\t\tface = direction.y > 0.0 ? 1 : 4;\n\t}\n\telse {\n\t\tif(absDirection.z > absDirection.y )\n\t\t\tface = direction.z > 0.0 ? 2 : 5;\n\t\telse\n\t\t\tface = direction.y > 0.0 ? 1 : 4;\n\t}\n\treturn face;\n}\n#define cubeUV_maxLods1 (log2(cubeUV_textureSize*0.25) - 1.0)\n#define cubeUV_rangeClamp (exp2((6.0 - 1.0) * 2.0))\nvec2 MipLevelInfo( vec3 vec, float roughnessLevel, float roughness ) {\n\tfloat scale = exp2(cubeUV_maxLods1 - roughnessLevel);\n\tfloat dxRoughness = dFdx(roughness);\n\tfloat dyRoughness = dFdy(roughness);\n\tvec3 dx = dFdx( vec * scale * dxRoughness );\n\tvec3 dy = dFdy( vec * scale * dyRoughness );\n\tfloat d = max( dot( dx, dx ), dot( dy, dy ) );\n\td = clamp(d, 1.0, cubeUV_rangeClamp);\n\tfloat mipLevel = 0.5 * log2(d);\n\treturn vec2(floor(mipLevel), fract(mipLevel));\n}\n#define cubeUV_maxLods2 (log2(cubeUV_textureSize*0.25) - 2.0)\n#define cubeUV_rcpTextureSize (1.0 / cubeUV_textureSize)\nvec2 getCubeUV(vec3 direction, float roughnessLevel, float mipLevel) {\n\tmipLevel = roughnessLevel > cubeUV_maxLods2 - 3.0 ? 0.0 : mipLevel;\n\tfloat a = 16.0 * cubeUV_rcpTextureSize;\n\tvec2 exp2_packed = exp2( vec2( roughnessLevel, mipLevel ) );\n\tvec2 rcp_exp2_packed = vec2( 1.0 ) / exp2_packed;\n\tfloat powScale = exp2_packed.x * exp2_packed.y;\n\tfloat scale = rcp_exp2_packed.x * rcp_exp2_packed.y * 0.25;\n\tfloat mipOffset = 0.75*(1.0 - rcp_exp2_packed.y) * rcp_exp2_packed.x;\n\tbool bRes = mipLevel == 0.0;\n\tscale = bRes && (scale < a) ? a : scale;\n\tvec3 r;\n\tvec2 offset;\n\tint face = getFaceFromDirection(direction);\n\tfloat rcpPowScale = 1.0 / powScale;\n\tif( face == 0) {\n\t\tr = vec3(direction.x, -direction.z, direction.y);\n\t\toffset = vec2(0.0+mipOffset,0.75 * rcpPowScale);\n\t\toffset.y = bRes && (offset.y < 2.0*a) ? a : offset.y;\n\t}\n\telse if( face == 1) {\n\t\tr = vec3(direction.y, direction.x, direction.z);\n\t\toffset = vec2(scale+mipOffset, 0.75 * rcpPowScale);\n\t\toffset.y = bRes && (offset.y < 2.0*a) ? a : offset.y;\n\t}\n\telse if( face == 2) {\n\t\tr = vec3(direction.z, direction.x, direction.y);\n\t\toffset = vec2(2.0*scale+mipOffset, 0.75 * rcpPowScale);\n\t\toffset.y = bRes && (offset.y < 2.0*a) ? a : offset.y;\n\t}\n\telse if( face == 3) {\n\t\tr = vec3(direction.x, direction.z, direction.y);\n\t\toffset = vec2(0.0+mipOffset,0.5 * rcpPowScale);\n\t\toffset.y = bRes && (offset.y < 2.0*a) ? 0.0 : offset.y;\n\t}\n\telse if( face == 4) {\n\t\tr = vec3(direction.y, direction.x, -direction.z);\n\t\toffset = vec2(scale+mipOffset, 0.5 * rcpPowScale);\n\t\toffset.y = bRes && (offset.y < 2.0*a) ? 0.0 : offset.y;\n\t}\n\telse {\n\t\tr = vec3(direction.z, -direction.x, direction.y);\n\t\toffset = vec2(2.0*scale+mipOffset, 0.5 * rcpPowScale);\n\t\toffset.y = bRes && (offset.y < 2.0*a) ? 0.0 : offset.y;\n\t}\n\tr = normalize(r);\n\tfloat texelOffset = 0.5 * cubeUV_rcpTextureSize;\n\tvec2 s = ( r.yz / abs( r.x ) + vec2( 1.0 ) ) * 0.5;\n\tvec2 base = offset + vec2( texelOffset );\n\treturn base + s * ( scale - 2.0 * texelOffset );\n}\n#define cubeUV_maxLods3 (log2(cubeUV_textureSize*0.25) - 3.0)\nvec4 textureCubeUV(vec3 reflectedDirection, float roughness ) {\n\tfloat roughnessVal = roughness* cubeUV_maxLods3;\n\tfloat r1 = floor(roughnessVal);\n\tfloat r2 = r1 + 1.0;\n\tfloat t = fract(roughnessVal);\n\tvec2 mipInfo = MipLevelInfo(reflectedDirection, r1, roughness);\n\tfloat s = mipInfo.y;\n\tfloat level0 = mipInfo.x;\n\tfloat level1 = level0 + 1.0;\n\tlevel1 = level1 > 5.0 ? 5.0 : level1;\n\tlevel0 += min( floor( s + 0.5 ), 5.0 );\n\tvec2 uv_10 = getCubeUV(reflectedDirection, r1, level0);\n\tvec4 color10 = envMapTexelToLinear(texture2D(envMap, uv_10));\n\tvec2 uv_20 = getCubeUV(reflectedDirection, r2, level0);\n\tvec4 color20 = envMapTexelToLinear(texture2D(envMap, uv_20));\n\tvec4 result = mix(color10, color20, t);\n\treturn vec4(result.rgb, 1.0);\n}\n#endif\n",defaultnormal_vertex:"#ifdef FLIP_SIDED\n\tobjectNormal = -objectNormal;\n#endif\nvec3 transformedNormal = normalMatrix * objectNormal;\n",displacementmap_pars_vertex:"#ifdef USE_DISPLACEMENTMAP\n\tuniform sampler2D displacementMap;\n\tuniform float displacementScale;\n\tuniform float displacementBias;\n#endif\n",displacementmap_vertex:"#ifdef USE_DISPLACEMENTMAP\n\ttransformed += normal * ( texture2D( displacementMap, uv ).x * displacementScale + displacementBias );\n#endif\n",emissivemap_fragment:"#ifdef USE_EMISSIVEMAP\n\tvec4 emissiveColor = texture2D( emissiveMap, vUv );\n\temissiveColor.rgb = emissiveMapTexelToLinear( emissiveColor ).rgb;\n\ttotalEmissiveRadiance *= emissiveColor.rgb;\n#endif\n",emissivemap_pars_fragment:"#ifdef USE_EMISSIVEMAP\n\tuniform sampler2D emissiveMap;\n#endif\n",encodings_fragment:" gl_FragColor = linearToOutputTexel( gl_FragColor );\n",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.xyz, vec3( gammaFactor ) ), value.w );\n}\nvec4 LinearToGamma( in vec4 value, in float gammaFactor ) {\n\treturn vec4( pow( value.xyz, vec3( 1.0 / gammaFactor ) ), value.w );\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.w );\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.w );\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.xyz * value.w * maxRange, 1.0 );\n}\nvec4 LinearToRGBM( in vec4 value, in float maxRange ) {\n\tfloat maxRGB = max( value.x, 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.x, 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 = value.rgb * cLogLuvM;\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 = Xp_Y_XYZp.rgb * cLogLuvInverseM;\n\treturn vec4( max(vRGB, 0.0), 1.0 );\n}\n",envmap_fragment:"#ifdef USE_ENVMAP\n\t#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG )\n\t\tvec3 cameraToVertex = normalize( vWorldPosition - cameraPosition );\n\t\tvec3 worldNormal = inverseTransformDirection( normal, viewMatrix );\n\t\t#ifdef ENVMAP_MODE_REFLECTION\n\t\t\tvec3 reflectVec = reflect( cameraToVertex, worldNormal );\n\t\t#else\n\t\t\tvec3 reflectVec = refract( cameraToVertex, 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, flipNormal * vec3( flipEnvMap * reflectVec.x, reflectVec.yz ) );\n\t#elif defined( ENVMAP_TYPE_EQUIREC )\n\t\tvec2 sampleUV;\n\t\tsampleUV.y = saturate( flipNormal * reflectVec.y * 0.5 + 0.5 );\n\t\tsampleUV.x = atan( flipNormal * reflectVec.z, flipNormal * reflectVec.x ) * RECIPROCAL_PI2 + 0.5;\n\t\tvec4 envColor = texture2D( envMap, sampleUV );\n\t#elif defined( ENVMAP_TYPE_SPHERE )\n\t\tvec3 reflectView = flipNormal * 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\tenvColor = envMapTexelToLinear( envColor );\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\n",envmap_pars_fragment:"#if defined( USE_ENVMAP ) || defined( PHYSICAL )\n\tuniform float reflectivity;\n\tuniform float envMapIntensity;\n#endif\n#ifdef USE_ENVMAP\n\t#if ! defined( PHYSICAL ) && ( defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) )\n\t\tvarying vec3 vWorldPosition;\n\t#endif\n\t#ifdef ENVMAP_TYPE_CUBE\n\t\tuniform samplerCube envMap;\n\t#else\n\t\tuniform sampler2D envMap;\n\t#endif\n\tuniform float flipEnvMap;\n\t#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( PHYSICAL )\n\t\tuniform float refractionRatio;\n\t#else\n\t\tvarying vec3 vReflect;\n\t#endif\n#endif\n",envmap_pars_vertex:"#ifdef USE_ENVMAP\n\t#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG )\n\t\tvarying vec3 vWorldPosition;\n\t#else\n\t\tvarying vec3 vReflect;\n\t\tuniform float refractionRatio;\n\t#endif\n#endif\n",envmap_vertex:"#ifdef USE_ENVMAP\n\t#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG )\n\t\tvWorldPosition = worldPosition.xyz;\n\t#else\n\t\tvec3 cameraToVertex = normalize( worldPosition.xyz - cameraPosition );\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\n",fog_vertex:"\n#ifdef USE_FOG\nfogDepth = -mvPosition.z;\n#endif",fog_pars_vertex:"#ifdef USE_FOG\n varying float fogDepth;\n#endif\n",fog_fragment:"#ifdef USE_FOG\n\t#ifdef FOG_EXP2\n\t\tfloat fogFactor = whiteCompliment( exp2( - fogDensity * fogDensity * fogDepth * fogDepth * LOG2 ) );\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\n",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\n",gradientmap_pars_fragment:"#ifdef TOON\n\tuniform sampler2D gradientMap;\n\tvec3 getGradientIrradiance( vec3 normal, vec3 lightDirection ) {\n\t\tfloat dotNL = dot( normal, lightDirection );\n\t\tvec2 coord = vec2( dotNL * 0.5 + 0.5, 0.0 );\n\t\t#ifdef USE_GRADIENTMAP\n\t\t\treturn texture2D( gradientMap, coord ).rgb;\n\t\t#else\n\t\t\treturn ( coord.x < 0.7 ) ? vec3( 0.7 ) : vec3( 1.0 );\n\t\t#endif\n\t}\n#endif\n",lightmap_fragment:"#ifdef USE_LIGHTMAP\n\treflectedLight.indirectDiffuse += PI * texture2D( lightMap, vUv2 ).xyz * lightMapIntensity;\n#endif\n",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 = normalize( -mvPosition.xyz );\nGeometricContext backGeometry;\nbackGeometry.position = geometry.position;\nbackGeometry.normal = -geometry.normal;\nbackGeometry.viewDir = geometry.viewDir;\nvLightFront = vec3( 0.0 );\n#ifdef DOUBLE_SIDED\n\tvLightBack = vec3( 0.0 );\n#endif\nIncidentLight directLight;\nfloat dotNL;\nvec3 directLightColor_Diffuse;\n#if NUM_POINT_LIGHTS > 0\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\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\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\tfor ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) {\n\t\tvLightFront += getHemisphereLightIrradiance( hemisphereLights[ i ], geometry );\n\t\t#ifdef DOUBLE_SIDED\n\t\t\tvLightBack += getHemisphereLightIrradiance( hemisphereLights[ i ], backGeometry );\n\t\t#endif\n\t}\n#endif\n",lights_pars:"uniform vec3 ambientLightColor;\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};\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 ltcMat;\tuniform sampler2D ltcMag;\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\n#if defined( USE_ENVMAP ) && defined( PHYSICAL )\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( 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 blinnShininessExponent, const in int maxMIPLevel ) {\n\t\tfloat maxMIPLevelScalar = float( maxMIPLevel );\n\t\tfloat desiredMIPLevel = maxMIPLevelScalar - 0.79248 - 0.5 * log2( pow2( blinnShininessExponent ) + 1.0 );\n\t\treturn clamp( desiredMIPLevel, 0.0, maxMIPLevelScalar );\n\t}\n\tvec3 getLightProbeIndirectRadiance( const in GeometricContext geometry, const in float blinnShininessExponent, const in int maxMIPLevel ) {\n\t\t#ifdef ENVMAP_MODE_REFLECTION\n\t\t\tvec3 reflectVec = reflect( -geometry.viewDir, geometry.normal );\n\t\t#else\n\t\t\tvec3 reflectVec = refract( -geometry.viewDir, geometry.normal, refractionRatio );\n\t\t#endif\n\t\treflectVec = inverseTransformDirection( reflectVec, viewMatrix );\n\t\tfloat specularMIPLevel = getSpecularMIPLevel( blinnShininessExponent, 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(queryReflectVec, BlinnExponentToGGXRoughness(blinnShininessExponent));\n\t\t#elif defined( ENVMAP_TYPE_EQUIREC )\n\t\t\tvec2 sampleUV;\n\t\t\tsampleUV.y = saturate( reflectVec.y * 0.5 + 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\n",lights_phong_fragment:"BlinnPhongMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb;\nmaterial.specularColor = specular;\nmaterial.specularShininess = shininess;\nmaterial.specularStrength = specularStrength;\n",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};\n#if NUM_RECT_AREA_LIGHTS > 0\n\tvoid RE_Direct_RectArea_BlinnPhong( const in RectAreaLight rectAreaLight, const in GeometricContext geometry, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {\n\t\tvec3 matDiffColor = material.diffuseColor;\n\t\tvec3 matSpecColor = material.specularColor;\n\t\tvec3 lightColor = rectAreaLight.color;\n\t\tfloat roughness = BlinnExponentToGGXRoughness( material.specularShininess );\n\t\tvec3 spec = Rect_Area_Light_Specular_Reflectance(\n\t\t\t\tgeometry,\n\t\t\t\trectAreaLight.position, rectAreaLight.halfWidth, rectAreaLight.halfHeight,\n\t\t\t\troughness,\n\t\t\t\tltcMat, ltcMag );\n\t\tvec3 diff = Rect_Area_Light_Diffuse_Reflectance(\n\t\t\t\tgeometry,\n\t\t\t\trectAreaLight.position, rectAreaLight.halfWidth, rectAreaLight.halfHeight );\n\t\treflectedLight.directSpecular += lightColor * matSpecColor * spec / PI2;\n\t\treflectedLight.directDiffuse += lightColor * matDiffColor * diff / PI2;\n\t}\n#endif\nvoid RE_Direct_BlinnPhong( const in IncidentLight directLight, const in GeometricContext geometry, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {\n\t#ifdef TOON\n\t\tvec3 irradiance = getGradientIrradiance( geometry.normal, directLight.direction ) * directLight.color;\n\t#else\n\t\tfloat dotNL = saturate( dot( geometry.normal, directLight.direction ) );\n\t\tvec3 irradiance = dotNL * directLight.color;\n\t#endif\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_Direct_RectArea\t\tRE_Direct_RectArea_BlinnPhong\n#define RE_IndirectDiffuse\t\tRE_IndirectDiffuse_BlinnPhong\n#define Material_LightProbeLOD( material )\t(0)\n",lights_physical_fragment:"PhysicalMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb * ( 1.0 - metalnessFactor );\nmaterial.specularRoughness = clamp( roughnessFactor, 0.04, 1.0 );\n#ifdef STANDARD\n\tmaterial.specularColor = mix( vec3( DEFAULT_SPECULAR_COEFFICIENT ), diffuseColor.rgb, metalnessFactor );\n#else\n\tmaterial.specularColor = mix( vec3( MAXIMUM_SPECULAR_COEFFICIENT * pow2( reflectivity ) ), diffuseColor.rgb, metalnessFactor );\n\tmaterial.clearCoat = saturate( clearCoat );\tmaterial.clearCoatRoughness = clamp( clearCoatRoughness, 0.04, 1.0 );\n#endif\n",lights_physical_pars_fragment:"struct PhysicalMaterial {\n\tvec3\tdiffuseColor;\n\tfloat\tspecularRoughness;\n\tvec3\tspecularColor;\n\t#ifndef STANDARD\n\t\tfloat clearCoat;\n\t\tfloat clearCoatRoughness;\n\t#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 matDiffColor = material.diffuseColor;\n\t\tvec3 matSpecColor = material.specularColor;\n\t\tvec3 lightColor = rectAreaLight.color;\n\t\tfloat roughness = material.specularRoughness;\n\t\tvec3 spec = Rect_Area_Light_Specular_Reflectance(\n\t\t\t\tgeometry,\n\t\t\t\trectAreaLight.position, rectAreaLight.halfWidth, rectAreaLight.halfHeight,\n\t\t\t\troughness,\n\t\t\t\tltcMat, ltcMag );\n\t\tvec3 diff = Rect_Area_Light_Diffuse_Reflectance(\n\t\t\t\tgeometry,\n\t\t\t\trectAreaLight.position, rectAreaLight.halfWidth, rectAreaLight.halfHeight );\n\t\treflectedLight.directSpecular += lightColor * matSpecColor * spec;\n\t\treflectedLight.directDiffuse += lightColor * matDiffColor * diff;\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#ifndef STANDARD\n\t\tfloat clearCoatDHR = material.clearCoat * clearCoatDHRApprox( material.clearCoatRoughness, dotNL );\n\t#else\n\t\tfloat clearCoatDHR = 0.0;\n\t#endif\n\treflectedLight.directSpecular += ( 1.0 - clearCoatDHR ) * irradiance * BRDF_Specular_GGX( directLight, geometry, material.specularColor, material.specularRoughness );\n\treflectedLight.directDiffuse += ( 1.0 - clearCoatDHR ) * irradiance * BRDF_Diffuse_Lambert( material.diffuseColor );\n\t#ifndef STANDARD\n\t\treflectedLight.directSpecular += irradiance * material.clearCoat * BRDF_Specular_GGX( directLight, geometry, vec3( DEFAULT_SPECULAR_COEFFICIENT ), material.clearCoatRoughness );\n\t#endif\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 clearCoatRadiance, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n\t#ifndef STANDARD\n\t\tfloat dotNV = saturate( dot( geometry.normal, geometry.viewDir ) );\n\t\tfloat dotNL = dotNV;\n\t\tfloat clearCoatDHR = material.clearCoat * clearCoatDHRApprox( material.clearCoatRoughness, dotNL );\n\t#else\n\t\tfloat clearCoatDHR = 0.0;\n\t#endif\n\treflectedLight.indirectSpecular += ( 1.0 - clearCoatDHR ) * radiance * BRDF_Specular_GGX_Environment( geometry, material.specularColor, material.specularRoughness );\n\t#ifndef STANDARD\n\t\treflectedLight.indirectSpecular += clearCoatRadiance * material.clearCoat * BRDF_Specular_GGX_Environment( geometry, vec3( DEFAULT_SPECULAR_COEFFICIENT ), material.clearCoatRoughness );\n\t#endif\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\n#define Material_BlinnShininessExponent( material ) GGXRoughnessToBlinnExponent( material.specularRoughness )\n#define Material_ClearCoat_BlinnShininessExponent( material ) GGXRoughnessToBlinnExponent( material.clearCoatRoughness )\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}\n",lights_template:"\nGeometricContext geometry;\ngeometry.position = - vViewPosition;\ngeometry.normal = normal;\ngeometry.viewDir = normalize( vViewPosition );\nIncidentLight directLight;\n#if ( NUM_POINT_LIGHTS > 0 ) && defined( RE_Direct )\n\tPointLight pointLight;\n\tfor ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {\n\t\tpointLight = pointLights[ i ];\n\t\tgetPointDirectLightIrradiance( pointLight, geometry, directLight );\n\t\t#ifdef USE_SHADOWMAP\n\t\tdirectLight.color *= all( bvec2( pointLight.shadow, directLight.visible ) ) ? getPointShadow( pointShadowMap[ i ], pointLight.shadowMapSize, pointLight.shadowBias, pointLight.shadowRadius, vPointShadowCoord[ i ] ) : 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\tfor ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {\n\t\tspotLight = spotLights[ i ];\n\t\tgetSpotDirectLightIrradiance( spotLight, geometry, directLight );\n\t\t#ifdef USE_SHADOWMAP\n\t\tdirectLight.color *= all( bvec2( spotLight.shadow, directLight.visible ) ) ? 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\tfor ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {\n\t\tdirectionalLight = directionalLights[ i ];\n\t\tgetDirectionalDirectLightIrradiance( directionalLight, geometry, directLight );\n\t\t#ifdef USE_SHADOWMAP\n\t\tdirectLight.color *= all( bvec2( directionalLight.shadow, directLight.visible ) ) ? 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\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 irradiance = getAmbientLightIrradiance( ambientLightColor );\n\t#ifdef USE_LIGHTMAP\n\t\tvec3 lightMapIrradiance = texture2D( lightMap, vUv2 ).xyz * 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 ( NUM_HEMI_LIGHTS > 0 )\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\t#if defined( USE_ENVMAP ) && defined( PHYSICAL ) && defined( ENVMAP_TYPE_CUBE_UV )\n\t\tirradiance += getLightProbeIndirectIrradiance( geometry, 8 );\n\t#endif\n\tRE_IndirectDiffuse( irradiance, geometry, material, reflectedLight );\n#endif\n#if defined( USE_ENVMAP ) && defined( RE_IndirectSpecular )\n\tvec3 radiance = getLightProbeIndirectRadiance( geometry, Material_BlinnShininessExponent( material ), 8 );\n\t#ifndef STANDARD\n\t\tvec3 clearCoatRadiance = getLightProbeIndirectRadiance( geometry, Material_ClearCoat_BlinnShininessExponent( material ), 8 );\n\t#else\n\t\tvec3 clearCoatRadiance = vec3( 0.0 );\n\t#endif\n\tRE_IndirectSpecular( radiance, clearCoatRadiance, geometry, material, reflectedLight );\n#endif\n",logdepthbuf_fragment:"#if defined(USE_LOGDEPTHBUF) && defined(USE_LOGDEPTHBUF_EXT)\n\tgl_FragDepthEXT = log2(vFragDepth) * logDepthBufFC * 0.5;\n#endif",logdepthbuf_pars_fragment:"#ifdef USE_LOGDEPTHBUF\n\tuniform float logDepthBufFC;\n\t#ifdef USE_LOGDEPTHBUF_EXT\n\t\tvarying float vFragDepth;\n\t#endif\n#endif\n",logdepthbuf_pars_vertex:"#ifdef USE_LOGDEPTHBUF\n\t#ifdef USE_LOGDEPTHBUF_EXT\n\t\tvarying float vFragDepth;\n\t#endif\n\tuniform float logDepthBufFC;\n#endif",logdepthbuf_vertex:"#ifdef USE_LOGDEPTHBUF\n\tgl_Position.z = log2(max( EPSILON, gl_Position.w + 1.0 )) * logDepthBufFC;\n\t#ifdef USE_LOGDEPTHBUF_EXT\n\t\tvFragDepth = 1.0 + gl_Position.w;\n\t#else\n\t\tgl_Position.z = (gl_Position.z - 1.0) * gl_Position.w;\n\t#endif\n#endif\n",map_fragment:"#ifdef USE_MAP\n\tvec4 texelColor = texture2D( map, vUv );\n\ttexelColor = mapTexelToLinear( texelColor );\n\tdiffuseColor *= texelColor;\n#endif\n",map_pars_fragment:"#ifdef USE_MAP\n\tuniform sampler2D map;\n#endif\n",map_particle_fragment:"#ifdef USE_MAP\n\tvec4 mapTexel = texture2D( map, vec2( gl_PointCoord.x, 1.0 - gl_PointCoord.y ) * offsetRepeat.zw + offsetRepeat.xy );\n\tdiffuseColor *= mapTexelToLinear( mapTexel );\n#endif\n",map_particle_pars_fragment:"#ifdef USE_MAP\n\tuniform vec4 offsetRepeat;\n\tuniform sampler2D map;\n#endif\n",metalnessmap_fragment:"float metalnessFactor = metalness;\n#ifdef USE_METALNESSMAP\n\tvec4 texelMetalness = texture2D( metalnessMap, vUv );\n\tmetalnessFactor *= texelMetalness.r;\n#endif\n",metalnessmap_pars_fragment:"#ifdef USE_METALNESSMAP\n\tuniform sampler2D metalnessMap;\n#endif",morphnormal_vertex:"#ifdef USE_MORPHNORMALS\n\tobjectNormal += ( morphNormal0 - normal ) * morphTargetInfluences[ 0 ];\n\tobjectNormal += ( morphNormal1 - normal ) * morphTargetInfluences[ 1 ];\n\tobjectNormal += ( morphNormal2 - normal ) * morphTargetInfluences[ 2 ];\n\tobjectNormal += ( morphNormal3 - normal ) * morphTargetInfluences[ 3 ];\n#endif\n",morphtarget_pars_vertex:"#ifdef USE_MORPHTARGETS\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 += ( morphTarget0 - position ) * morphTargetInfluences[ 0 ];\n\ttransformed += ( morphTarget1 - position ) * morphTargetInfluences[ 1 ];\n\ttransformed += ( morphTarget2 - position ) * morphTargetInfluences[ 2 ];\n\ttransformed += ( morphTarget3 - position ) * morphTargetInfluences[ 3 ];\n\t#ifndef USE_MORPHNORMALS\n\ttransformed += ( morphTarget4 - position ) * morphTargetInfluences[ 4 ];\n\ttransformed += ( morphTarget5 - position ) * morphTargetInfluences[ 5 ];\n\ttransformed += ( morphTarget6 - position ) * morphTargetInfluences[ 6 ];\n\ttransformed += ( morphTarget7 - position ) * morphTargetInfluences[ 7 ];\n\t#endif\n#endif\n",normal_flip:"#ifdef DOUBLE_SIDED\n\tfloat flipNormal = ( float( gl_FrontFacing ) * 2.0 - 1.0 );\n#else\n\tfloat flipNormal = 1.0;\n#endif\n",normal_fragment:"#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 ) * flipNormal;\n#endif\n#ifdef USE_NORMALMAP\n\tnormal = perturbNormal2Arb( -vViewPosition, normal );\n#elif defined( USE_BUMPMAP )\n\tnormal = perturbNormalArb( -vViewPosition, normal, dHdxy_fwd() );\n#endif\n",normalmap_pars_fragment:"#ifdef USE_NORMALMAP\n\tuniform sampler2D normalMap;\n\tuniform vec2 normalScale;\n\tvec3 perturbNormal2Arb( vec3 eye_pos, vec3 surf_norm ) {\n\t\tvec3 q0 = dFdx( eye_pos.xyz );\n\t\tvec3 q1 = dFdy( eye_pos.xyz );\n\t\tvec2 st0 = dFdx( vUv.st );\n\t\tvec2 st1 = dFdy( vUv.st );\n\t\tvec3 S = normalize( q0 * st1.t - q1 * st0.t );\n\t\tvec3 T = normalize( -q0 * st1.s + q1 * st0.s );\n\t\tvec3 N = normalize( surf_norm );\n\t\tvec3 mapN = texture2D( normalMap, vUv ).xyz * 2.0 - 1.0;\n\t\tmapN.xy = normalScale * mapN.xy;\n\t\tmat3 tsn = mat3( S, T, N );\n\t\treturn normalize( tsn * mapN );\n\t}\n#endif\n",packing:"vec3 packNormalToRGB( const in vec3 normal ) {\n\treturn normalize( normal ) * 0.5 + 0.5;\n}\nvec3 unpackRGBToNormal( const in vec3 rgb ) {\n\treturn 1.0 - 2.0 * rgb.xyz;\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}\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}\n",premultiplied_alpha_fragment:"#ifdef PREMULTIPLIED_ALPHA\n\tgl_FragColor.rgb *= gl_FragColor.a;\n#endif\n",project_vertex:"#ifdef USE_SKINNING\n\tvec4 mvPosition = modelViewMatrix * skinned;\n#else\n\tvec4 mvPosition = modelViewMatrix * vec4( transformed, 1.0 );\n#endif\ngl_Position = projectionMatrix * mvPosition;\n",roughnessmap_fragment:"float roughnessFactor = roughness;\n#ifdef USE_ROUGHNESSMAP\n\tvec4 texelRoughness = texture2D( roughnessMap, vUv );\n\troughnessFactor *= texelRoughness.r;\n#endif\n",roughnessmap_pars_fragment:"#ifdef USE_ROUGHNESSMAP\n\tuniform sampler2D roughnessMap;\n#endif",shadowmap_pars_fragment:"#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHTS > 0\n\t\tuniform sampler2D directionalShadowMap[ NUM_DIR_LIGHTS ];\n\t\tvarying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHTS ];\n\t#endif\n\t#if NUM_SPOT_LIGHTS > 0\n\t\tuniform sampler2D spotShadowMap[ NUM_SPOT_LIGHTS ];\n\t\tvarying vec4 vSpotShadowCoord[ NUM_SPOT_LIGHTS ];\n\t#endif\n\t#if NUM_POINT_LIGHTS > 0\n\t\tuniform sampler2D pointShadowMap[ NUM_POINT_LIGHTS ];\n\t\tvarying vec4 vPointShadowCoord[ NUM_POINT_LIGHTS ];\n\t#endif\n\tfloat texture2DCompare( sampler2D depths, vec2 uv, float compare ) {\n\t\treturn step( compare, unpackRGBAToDepth( texture2D( depths, uv ) ) );\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 ) / size;\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\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\treturn (\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( dx0, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy, 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( 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 / 9.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\treturn (\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#else\n\t\t\treturn texture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z );\n\t\t#endif\n\t\t}\n\t\treturn 1.0;\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 ) {\n\t\tvec2 texelSize = vec2( 1.0 ) / ( shadowMapSize * vec2( 4.0, 2.0 ) );\n\t\tvec3 lightToPosition = shadowCoord.xyz;\n\t\tvec3 bd3D = normalize( lightToPosition );\n\t\tfloat dp = ( length( lightToPosition ) - shadowBias ) / 1000.0;\n\t\t#if defined( SHADOWMAP_TYPE_PCF ) || defined( SHADOWMAP_TYPE_PCF_SOFT )\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\n",shadowmap_pars_vertex:"#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHTS > 0\n\t\tuniform mat4 directionalShadowMatrix[ NUM_DIR_LIGHTS ];\n\t\tvarying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHTS ];\n\t#endif\n\t#if NUM_SPOT_LIGHTS > 0\n\t\tuniform mat4 spotShadowMatrix[ NUM_SPOT_LIGHTS ];\n\t\tvarying vec4 vSpotShadowCoord[ NUM_SPOT_LIGHTS ];\n\t#endif\n\t#if NUM_POINT_LIGHTS > 0\n\t\tuniform mat4 pointShadowMatrix[ NUM_POINT_LIGHTS ];\n\t\tvarying vec4 vPointShadowCoord[ NUM_POINT_LIGHTS ];\n\t#endif\n#endif\n",shadowmap_vertex:"#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHTS > 0\n\tfor ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {\n\t\tvDirectionalShadowCoord[ i ] = directionalShadowMatrix[ i ] * worldPosition;\n\t}\n\t#endif\n\t#if NUM_SPOT_LIGHTS > 0\n\tfor ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {\n\t\tvSpotShadowCoord[ i ] = spotShadowMatrix[ i ] * worldPosition;\n\t}\n\t#endif\n\t#if NUM_POINT_LIGHTS > 0\n\tfor ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {\n\t\tvPointShadowCoord[ i ] = pointShadowMatrix[ i ] * worldPosition;\n\t}\n\t#endif\n#endif\n",shadowmask_pars_fragment:"float getShadowMask() {\n\tfloat shadow = 1.0;\n\t#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHTS > 0\n\tDirectionalLight directionalLight;\n\tfor ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {\n\t\tdirectionalLight = directionalLights[ i ];\n\t\tshadow *= bool( directionalLight.shadow ) ? getShadow( directionalShadowMap[ i ], directionalLight.shadowMapSize, directionalLight.shadowBias, directionalLight.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;\n\t}\n\t#endif\n\t#if NUM_SPOT_LIGHTS > 0\n\tSpotLight spotLight;\n\tfor ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {\n\t\tspotLight = spotLights[ i ];\n\t\tshadow *= bool( spotLight.shadow ) ? getShadow( spotShadowMap[ i ], spotLight.shadowMapSize, spotLight.shadowBias, spotLight.shadowRadius, vSpotShadowCoord[ i ] ) : 1.0;\n\t}\n\t#endif\n\t#if NUM_POINT_LIGHTS > 0\n\tPointLight pointLight;\n\tfor ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {\n\t\tpointLight = pointLights[ i ];\n\t\tshadow *= bool( pointLight.shadow ) ? getPointShadow( pointShadowMap[ i ], pointLight.shadowMapSize, pointLight.shadowBias, pointLight.shadowRadius, vPointShadowCoord[ i ] ) : 1.0;\n\t}\n\t#endif\n\t#endif\n\treturn shadow;\n}\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 sampler2D boneTexture;\n\t\tuniform int boneTextureWidth;\n\t\tuniform int boneTextureHeight;\n\t\tmat4 getBoneMatrix( const in float i ) {\n\t\t\tfloat j = i * 4.0;\n\t\t\tfloat x = mod( j, float( boneTextureWidth ) );\n\t\t\tfloat y = floor( j / float( boneTextureWidth ) );\n\t\t\tfloat dx = 1.0 / float( boneTextureWidth );\n\t\t\tfloat dy = 1.0 / float( boneTextureHeight );\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\n",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\tskinned = bindMatrixInverse * skinned;\n#endif\n",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#endif\n",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 gl_FragColor.rgb = toneMapping( gl_FragColor.rgb );\n#endif\n",tonemapping_pars_fragment:"#define saturate(a) clamp( a, 0.0, 1.0 )\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}\n",uv_pars_fragment:"#if defined( USE_MAP ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( USE_SPECULARMAP ) || defined( USE_ALPHAMAP ) || defined( USE_EMISSIVEMAP ) || defined( USE_ROUGHNESSMAP ) || defined( USE_METALNESSMAP )\n\tvarying vec2 vUv;\n#endif",uv_pars_vertex:"#if defined( USE_MAP ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( USE_SPECULARMAP ) || defined( USE_ALPHAMAP ) || defined( USE_EMISSIVEMAP ) || defined( USE_ROUGHNESSMAP ) || defined( USE_METALNESSMAP )\n\tvarying vec2 vUv;\n\tuniform vec4 offsetRepeat;\n#endif\n",uv_vertex:"#if defined( USE_MAP ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( USE_SPECULARMAP ) || defined( USE_ALPHAMAP ) || defined( USE_EMISSIVEMAP ) || defined( USE_ROUGHNESSMAP ) || defined( USE_METALNESSMAP )\n\tvUv = uv * offsetRepeat.zw + offsetRepeat.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#endif",uv2_vertex:"#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP )\n\tvUv2 = uv2;\n#endif",worldpos_vertex:"#if defined( USE_ENVMAP ) || defined( PHONG ) || defined( PHYSICAL ) || defined( LAMBERT ) || defined ( USE_SHADOWMAP )\n\t#ifdef USE_SKINNING\n\t\tvec4 worldPosition = modelMatrix * skinned;\n\t#else\n\t\tvec4 worldPosition = modelMatrix * vec4( transformed, 1.0 );\n\t#endif\n#endif\n",cube_frag:"uniform samplerCube tCube;\nuniform float tFlip;\nuniform float opacity;\nvarying vec3 vWorldPosition;\n#include \nvoid main() {\n\tgl_FragColor = textureCube( tCube, vec3( tFlip * vWorldPosition.x, vWorldPosition.yz ) );\n\tgl_FragColor.a *= opacity;\n}\n",cube_vert:"varying vec3 vWorldPosition;\n#include \nvoid main() {\n\tvWorldPosition = transformDirection( position, modelMatrix );\n\t#include \n\t#include \n}\n",depth_frag:"#if DEPTH_PACKING == 3200\n\tuniform float opacity;\n#endif\n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\tvec4 diffuseColor = vec4( 1.0 );\n\t#if DEPTH_PACKING == 3200\n\t\tdiffuseColor.a = opacity;\n\t#endif\n\t#include \n\t#include \n\t#include \n\t#include \n\t#if DEPTH_PACKING == 3200\n\t\tgl_FragColor = vec4( vec3( gl_FragCoord.z ), opacity );\n\t#elif DEPTH_PACKING == 3201\n\t\tgl_FragColor = packDepthToRGBA( gl_FragCoord.z );\n\t#endif\n}\n",depth_vert:"#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}\n",distanceRGBA_frag:"uniform vec3 lightPos;\nvarying vec4 vWorldPosition;\n#include \n#include \n#include \nvoid main () {\n\t#include \n\tgl_FragColor = packDepthToRGBA( length( vWorldPosition.xyz - lightPos.xyz ) / 1000.0 );\n}\n",distanceRGBA_vert:"varying vec4 vWorldPosition;\n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tvWorldPosition = worldPosition;\n}\n",equirect_frag:"uniform sampler2D tEquirect;\nuniform float tFlip;\nvarying vec3 vWorldPosition;\n#include \nvoid main() {\n\tvec3 direction = normalize( vWorldPosition );\n\tvec2 sampleUV;\n\tsampleUV.y = saturate( tFlip * direction.y * -0.5 + 0.5 );\n\tsampleUV.x = atan( direction.z, direction.x ) * RECIPROCAL_PI2 + 0.5;\n\tgl_FragColor = texture2D( tEquirect, sampleUV );\n}\n",equirect_vert:"varying vec3 vWorldPosition;\n#include \nvoid main() {\n\tvWorldPosition = transformDirection( position, modelMatrix );\n\t#include \n\t#include \n}\n",linedashed_frag:"uniform vec3 diffuse;\nuniform float opacity;\nuniform float dashSize;\nuniform float totalSize;\nvarying float vLineDistance;\n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\tif ( mod( vLineDistance, totalSize ) > dashSize ) {\n\t\tdiscard;\n\t}\n\tvec3 outgoingLight = vec3( 0.0 );\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include \n\t#include \n\toutgoingLight = diffuseColor.rgb;\n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include \n\t#include \n\t#include \n\t#include \n}\n",linedashed_vert:"uniform float scale;\nattribute float lineDistance;\nvarying float vLineDistance;\n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\tvLineDistance = scale * lineDistance;\n\tvec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );\n\tgl_Position = projectionMatrix * mvPosition;\n\t#include \n\t#include \n\t#include \n}\n",meshbasic_frag:"uniform vec3 diffuse;\nuniform float opacity;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\t#ifdef USE_LIGHTMAP\n\t\treflectedLight.indirectDiffuse += texture2D( lightMap, vUv2 ).xyz * lightMapIntensity;\n\t#else\n\t\treflectedLight.indirectDiffuse += vec3( 1.0 );\n\t#endif\n\t#include \n\treflectedLight.indirectDiffuse *= diffuseColor.rgb;\n\tvec3 outgoingLight = reflectedLight.indirectDiffuse;\n\t#include \n\t#include \n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include \n\t#include \n\t#include \n\t#include \n}\n",meshbasic_vert:"#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#include \n\t#include \n\t#ifdef USE_ENVMAP\n\t#include \n\t#include \n\t#include \n\t#include \n\t#endif\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}\n",meshlambert_frag:"uniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float opacity;\nvarying vec3 vLightFront;\n#ifdef DOUBLE_SIDED\n\tvarying vec3 vLightBack;\n#endif\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\treflectedLight.indirectDiffuse = getAmbientLightIrradiance( ambientLightColor );\n\t#include \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 \n\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;\n\t#include \n\t#include \n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include \n\t#include \n\t#include \n\t#include \n}\n",meshlambert_vert:"#define LAMBERT\nvarying vec3 vLightFront;\n#ifdef DOUBLE_SIDED\n\tvarying vec3 vLightBack;\n#endif\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}\n",meshphong_frag:"#define PHONG\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform vec3 specular;\nuniform float shininess;\nuniform float opacity;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveRadiance;\n\t#include \n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include \n\t#include \n\t#include \n\t#include \n}\n",meshphong_vert:"#define PHONG\nvarying vec3 vViewPosition;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n#ifndef FLAT_SHADED\n\tvNormal = normalize( transformedNormal );\n#endif\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tvViewPosition = - mvPosition.xyz;\n\t#include \n\t#include \n\t#include \n\t#include \n}\n",meshphysical_frag:"#define PHYSICAL\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float roughness;\nuniform float metalness;\nuniform float opacity;\n#ifndef STANDARD\n\tuniform float clearCoat;\n\tuniform float clearCoatRoughness;\n#endif\nvarying vec3 vViewPosition;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveRadiance;\n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include \n\t#include \n\t#include \n\t#include \n}\n",meshphysical_vert:"#define PHYSICAL\nvarying vec3 vViewPosition;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n#ifndef FLAT_SHADED\n\tvNormal = normalize( transformedNormal );\n#endif\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tvViewPosition = - mvPosition.xyz;\n\t#include \n\t#include \n\t#include \n}\n",normal_frag:"#define NORMAL\nuniform float opacity;\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP )\n\tvarying vec3 vViewPosition;\n#endif\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#include \n\tgl_FragColor = vec4( packNormalToRGB( normal ), opacity );\n}\n",normal_vert:"#define NORMAL\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP )\n\tvarying vec3 vViewPosition;\n#endif\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n#ifndef FLAT_SHADED\n\tvNormal = normalize( transformedNormal );\n#endif\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP )\n\tvViewPosition = - mvPosition.xyz;\n#endif\n}\n",points_frag:"uniform vec3 diffuse;\nuniform float opacity;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\tvec3 outgoingLight = vec3( 0.0 );\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include \n\t#include \n\t#include \n\t#include \n\toutgoingLight = diffuseColor.rgb;\n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include \n\t#include \n\t#include \n\t#include \n}\n",points_vert:"uniform float size;\nuniform float scale;\n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#include \n\t#ifdef USE_SIZEATTENUATION\n\t\tgl_PointSize = size * ( scale / - mvPosition.z );\n\t#else\n\t\tgl_PointSize = size;\n\t#endif\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}\n",shadow_frag:"uniform float opacity;\n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\tgl_FragColor = vec4( 0.0, 0.0, 0.0, opacity * ( 1.0 - getShadowMask() ) );\n}\n",shadow_vert:"#include \nvoid main() {\n\t#include \n\t#include \n\t#include \n\t#include \n}\n"};q.prototype={constructor:q,isColor:!0,r:1,g:1,b:1,set:function(t){return t&&t.isColor?this.copy(t):"number"==typeof t?this.setHex(t):"string"==typeof t&&this.setStyle(t),this},setScalar:function(t){return this.r=t,this.g=t,this.b=t,this},setHex:function(t){return t=Math.floor(t),this.r=(t>>16&255)/255,this.g=(t>>8&255)/255,this.b=(255&t)/255,this},setRGB:function(t,e,n){return this.r=t,this.g=e,this.b=n,this},setHSL:function(){function t(t,e,n){return n<0&&(n+=1),n>1&&(n-=1),n<1/6?t+6*(e-t)*n:n<.5?e:n<2/3?t+6*(e-t)*(2/3-n):t}return function(e,n,r){if(e=fs.euclideanModulo(e,1),n=fs.clamp(n,0,1),r=fs.clamp(r,0,1),0===n)this.r=this.g=this.b=r;else{var i=r<=.5?r*(1+n):r+n-r*n,o=2*r-i;this.r=t(o,i,e+1/3),this.g=t(o,i,e),this.b=t(o,i,e-1/3)}return this}}(),setStyle:function(t){function e(e){void 0!==e&&parseFloat(e)<1&&console.warn("THREE.Color: Alpha component of "+t+" will be ignored.")}var n;if(n=/^((?:rgb|hsl)a?)\(\s*([^\)]*)\)/.exec(t)){var r,i=n[1],o=n[2];switch(i){case"rgb":case"rgba":if(r=/^(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(,\s*([0-9]*\.?[0-9]+)\s*)?$/.exec(o))return this.r=Math.min(255,parseInt(r[1],10))/255,this.g=Math.min(255,parseInt(r[2],10))/255,this.b=Math.min(255,parseInt(r[3],10))/255,e(r[5]),this;if(r=/^(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(,\s*([0-9]*\.?[0-9]+)\s*)?$/.exec(o))return this.r=Math.min(100,parseInt(r[1],10))/100,this.g=Math.min(100,parseInt(r[2],10))/100,this.b=Math.min(100,parseInt(r[3],10))/100,e(r[5]),this;break;case"hsl":case"hsla":if(r=/^([0-9]*\.?[0-9]+)\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(,\s*([0-9]*\.?[0-9]+)\s*)?$/.exec(o)){var a=parseFloat(r[1])/360,s=parseInt(r[2],10)/100,u=parseInt(r[3],10)/100;return e(r[5]),this.setHSL(a,s,u)}}}else if(n=/^\#([A-Fa-f0-9]+)$/.exec(t)){var c=n[1],l=c.length;if(3===l)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===l)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}if(t&&t.length>0){var c=ws[t];void 0!==c?this.setHex(c):console.warn("THREE.Color: Unknown color "+t)}return this},clone:function(){return new this.constructor(this.r,this.g,this.b)},copy:function(t){return this.r=t.r,this.g=t.g,this.b=t.b,this},copyGammaToLinear:function(t,e){return void 0===e&&(e=2),this.r=Math.pow(t.r,e),this.g=Math.pow(t.g,e),this.b=Math.pow(t.b,e),this},copyLinearToGamma:function(t,e){void 0===e&&(e=2);var n=e>0?1/e:1;return this.r=Math.pow(t.r,n),this.g=Math.pow(t.g,n),this.b=Math.pow(t.b,n),this},convertGammaToLinear:function(){var t=this.r,e=this.g,n=this.b;return this.r=t*t,this.g=e*e,this.b=n*n,this},convertLinearToGamma:function(){return this.r=Math.sqrt(this.r),this.g=Math.sqrt(this.g),this.b=Math.sqrt(this.b),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(t){var e,n,r=t||{h:0,s:0,l:0},i=this.r,o=this.g,a=this.b,s=Math.max(i,o,a),u=Math.min(i,o,a),c=(u+s)/2;if(u===s)e=0,n=0;else{var l=s-u;switch(n=c<=.5?l/(s+u):l/(2-s-u),s){case i:e=(o-a)/l+(othis.max.x||t.ythis.max.y)},containsBox:function(t){return this.min.x<=t.min.x&&t.max.x<=this.max.x&&this.min.y<=t.min.y&&t.max.y<=this.max.y},getParameter:function(t,e){return(e||new i).set((t.x-this.min.x)/(this.max.x-this.min.x),(t.y-this.min.y)/(this.max.y-this.min.y))},intersectsBox:function(t){return!(t.max.xthis.max.x||t.max.ythis.max.y)},clampPoint:function(t,e){return(e||new i).copy(t).clamp(this.min,this.max)},distanceToPoint:function(){var t=new i;return function(e){return t.copy(e).clamp(this.min,this.max).sub(e).length()}}(),intersect:function(t){return this.min.max(t.min),this.max.min(t.max),this},union:function(t){return this.min.min(t.min),this.max.max(t.max),this},translate:function(t){return this.min.add(t),this.max.add(t),this},equals:function(t){return t.min.equals(this.min)&&t.max.equals(this.max)}};var Ts=0;J.prototype={constructor:J,isMaterial:!0,get needsUpdate(){return this._needsUpdate},set needsUpdate(t){!0===t&&this.update(),this._needsUpdate=t},setValues:function(t){if(void 0!==t)for(var e in t){var n=t[e];if(void 0!==n){var r=this[e];void 0!==r?r&&r.isColor?r.set(n):r&&r.isVector3&&n&&n.isVector3?r.copy(n):this[e]="overdraw"===e?Number(n):n:console.warn("THREE."+this.type+": '"+e+"' is not a property of this material.")}else console.warn("THREE.Material: '"+e+"' parameter is undefined.")}},toJSON:function(t){function e(t){var e=[];for(var n in t){var r=t[n];delete r.metadata,e.push(r)}return e}var n=void 0===t;n&&(t={textures:{},images:{}});var r={metadata:{version:4.4,type:"Material",generator:"Material.toJSON"}};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.emissive&&this.emissive.isColor&&(r.emissive=this.emissive.getHex()),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.map&&this.map.isTexture&&(r.map=this.map.toJSON(t).uuid),this.alphaMap&&this.alphaMap.isTexture&&(r.alphaMap=this.alphaMap.toJSON(t).uuid),this.lightMap&&this.lightMap.isTexture&&(r.lightMap=this.lightMap.toJSON(t).uuid),this.bumpMap&&this.bumpMap.isTexture&&(r.bumpMap=this.bumpMap.toJSON(t).uuid,r.bumpScale=this.bumpScale),this.normalMap&&this.normalMap.isTexture&&(r.normalMap=this.normalMap.toJSON(t).uuid,r.normalScale=this.normalScale.toArray()),this.displacementMap&&this.displacementMap.isTexture&&(r.displacementMap=this.displacementMap.toJSON(t).uuid,r.displacementScale=this.displacementScale,r.displacementBias=this.displacementBias),this.roughnessMap&&this.roughnessMap.isTexture&&(r.roughnessMap=this.roughnessMap.toJSON(t).uuid),this.metalnessMap&&this.metalnessMap.isTexture&&(r.metalnessMap=this.metalnessMap.toJSON(t).uuid),this.emissiveMap&&this.emissiveMap.isTexture&&(r.emissiveMap=this.emissiveMap.toJSON(t).uuid),this.specularMap&&this.specularMap.isTexture&&(r.specularMap=this.specularMap.toJSON(t).uuid),this.envMap&&this.envMap.isTexture&&(r.envMap=this.envMap.toJSON(t).uuid,r.reflectivity=this.reflectivity),this.gradientMap&&this.gradientMap.isTexture&&(r.gradientMap=this.gradientMap.toJSON(t).uuid),void 0!==this.size&&(r.size=this.size),void 0!==this.sizeAttenuation&&(r.sizeAttenuation=this.sizeAttenuation),this.blending!==vo&&(r.blending=this.blending),this.shading!==lo&&(r.shading=this.shading),this.side!==ao&&(r.side=this.side),this.vertexColors!==ho&&(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,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),r.skinning=this.skinning,r.morphTargets=this.morphTargets,n){var i=e(t.textures),o=e(t.images);i.length>0&&(r.textures=i),o.length>0&&(r.images=o)}return r},clone:function(){return(new this.constructor).copy(this)},copy:function(t){this.name=t.name,this.fog=t.fog,this.lights=t.lights,this.blending=t.blending,this.side=t.side,this.shading=t.shading,this.vertexColors=t.vertexColors,this.opacity=t.opacity,this.transparent=t.transparent,this.blendSrc=t.blendSrc,this.blendDst=t.blendDst,this.blendEquation=t.blendEquation,this.blendSrcAlpha=t.blendSrcAlpha,this.blendDstAlpha=t.blendDstAlpha,this.blendEquationAlpha=t.blendEquationAlpha,this.depthFunc=t.depthFunc,this.depthTest=t.depthTest,this.depthWrite=t.depthWrite,this.colorWrite=t.colorWrite,this.precision=t.precision,this.polygonOffset=t.polygonOffset,this.polygonOffsetFactor=t.polygonOffsetFactor,this.polygonOffsetUnits=t.polygonOffsetUnits,this.alphaTest=t.alphaTest,this.premultipliedAlpha=t.premultipliedAlpha,this.overdraw=t.overdraw,this.visible=t.visible,this.clipShadows=t.clipShadows,this.clipIntersection=t.clipIntersection;var e=t.clippingPlanes,n=null;if(null!==e){var r=e.length;n=new Array(r);for(var i=0;i!==r;++i)n[i]=e[i].clone()}return this.clippingPlanes=n,this},update:function(){this.dispatchEvent({type:"update"})},dispose:function(){this.dispatchEvent({type:"dispose"})}},Object.assign(J.prototype,r.prototype),Q.prototype=Object.create(J.prototype),Q.prototype.constructor=Q,Q.prototype.isShaderMaterial=!0,Q.prototype.copy=function(t){return J.prototype.copy.call(this,t),this.fragmentShader=t.fragmentShader,this.vertexShader=t.vertexShader,this.uniforms=xs.clone(t.uniforms),this.defines=t.defines,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.lights=t.lights,this.clipping=t.clipping,this.skinning=t.skinning,this.morphTargets=t.morphTargets,this.morphNormals=t.morphNormals,this.extensions=t.extensions,this},Q.prototype.toJSON=function(t){var e=J.prototype.toJSON.call(this,t);return e.uniforms=this.uniforms,e.vertexShader=this.vertexShader,e.fragmentShader=this.fragmentShader,e},tt.prototype=Object.create(J.prototype),tt.prototype.constructor=tt,tt.prototype.isMeshDepthMaterial=!0,tt.prototype.copy=function(t){return J.prototype.copy.call(this,t),this.depthPacking=t.depthPacking,this.skinning=t.skinning,this.morphTargets=t.morphTargets,this.map=t.map,this.alphaMap=t.alphaMap,this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this},et.prototype={constructor:et,isBox3:!0,set:function(t,e){return this.min.copy(t),this.max.copy(e),this},setFromArray:function(t){for(var e=1/0,n=1/0,r=1/0,i=-1/0,o=-1/0,a=-1/0,s=0,u=t.length;si&&(i=c),l>o&&(o=l),h>a&&(a=h)}return this.min.set(e,n,r),this.max.set(i,o,a),this},setFromBufferAttribute:function(t){for(var e=1/0,n=1/0,r=1/0,i=-1/0,o=-1/0,a=-1/0,s=0,u=t.count;si&&(i=c),l>o&&(o=l),h>a&&(a=h)}return this.min.set(e,n,r),this.max.set(i,o,a),this},setFromPoints:function(t){this.makeEmpty();for(var e=0,n=t.length;ethis.max.x||t.ythis.max.y||t.zthis.max.z)},containsBox:function(t){return this.min.x<=t.min.x&&t.max.x<=this.max.x&&this.min.y<=t.min.y&&t.max.y<=this.max.y&&this.min.z<=t.min.z&&t.max.z<=this.max.z},getParameter:function(t,e){return(e||new l).set((t.x-this.min.x)/(this.max.x-this.min.x),(t.y-this.min.y)/(this.max.y-this.min.y),(t.z-this.min.z)/(this.max.z-this.min.z))},intersectsBox:function(t){return!(t.max.xthis.max.x||t.max.ythis.max.y||t.max.zthis.max.z)},intersectsSphere:function(){var t;return function(e){return void 0===t&&(t=new l),this.clampPoint(e.center,t),t.distanceToSquared(e.center)<=e.radius*e.radius}}(),intersectsPlane:function(t){var e,n;return t.normal.x>0?(e=t.normal.x*this.min.x,n=t.normal.x*this.max.x):(e=t.normal.x*this.max.x,n=t.normal.x*this.min.x),t.normal.y>0?(e+=t.normal.y*this.min.y,n+=t.normal.y*this.max.y):(e+=t.normal.y*this.max.y,n+=t.normal.y*this.min.y),t.normal.z>0?(e+=t.normal.z*this.min.z,n+=t.normal.z*this.max.z):(e+=t.normal.z*this.max.z,n+=t.normal.z*this.min.z),e<=t.constant&&n>=t.constant},clampPoint:function(t,e){return(e||new l).copy(t).clamp(this.min,this.max)},distanceToPoint:function(){var t=new l;return function(e){return t.copy(e).clamp(this.min,this.max).sub(e).length()}}(),getBoundingSphere:function(){var t=new l;return function(e){var n=e||new nt;return this.getCenter(n.center),n.radius=.5*this.getSize(t).length(),n}}(),intersect:function(t){return this.min.max(t.min),this.max.min(t.max),this.isEmpty()&&this.makeEmpty(),this},union:function(t){return this.min.min(t.min),this.max.max(t.max),this},applyMatrix4:function(){var t=[new l,new l,new l,new l,new l,new l,new l,new l];return function(e){return this.isEmpty()?this:(t[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(e),t[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(e),t[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(e),t[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(e),t[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(e),t[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(e),t[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(e),t[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(e),this.setFromPoints(t),this)}}(),translate:function(t){return this.min.add(t),this.max.add(t),this},equals:function(t){return t.min.equals(this.min)&&t.max.equals(this.max)}},nt.prototype={constructor:nt,set:function(t,e){return this.center.copy(t),this.radius=e,this},setFromPoints:function(){var t;return function(e,n){void 0===t&&(t=new et);var r=this.center;void 0!==n?r.copy(n):t.setFromPoints(e).getCenter(r);for(var i=0,o=0,a=e.length;othis.radius*this.radius&&(r.sub(this.center).normalize(),r.multiplyScalar(this.radius).add(this.center)),r},getBoundingBox:function(t){var e=t||new et;return e.set(this.center,this.center),e.expandByScalar(this.radius),e},applyMatrix4:function(t){return this.center.applyMatrix4(t),this.radius=this.radius*t.getMaxScaleOnAxis(),this},translate:function(t){return this.center.add(t),this},equals:function(t){return t.center.equals(this.center)&&t.radius===this.radius}},rt.prototype={constructor:rt,isMatrix3:!0,set:function(t,e,n,r,i,o,a,s,u){var c=this.elements;return c[0]=t,c[1]=r,c[2]=a,c[3]=e,c[4]=i,c[5]=s,c[6]=n,c[7]=o,c[8]=u,this},identity:function(){return this.set(1,0,0,0,1,0,0,0,1),this},clone:function(){return(new this.constructor).fromArray(this.elements)},copy:function(t){var e=t.elements;return this.set(e[0],e[3],e[6],e[1],e[4],e[7],e[2],e[5],e[8]),this},setFromMatrix4:function(t){var e=t.elements;return this.set(e[0],e[4],e[8],e[1],e[5],e[9],e[2],e[6],e[10]),this},applyToBufferAttribute:function(){var t;return function(e){void 0===t&&(t=new l);for(var n=0,r=e.count;n1))return r.copy(i).multiplyScalar(a).add(e.start)}else if(0===this.distanceToPoint(e.start))return r.copy(e.start)}}(),intersectsLine:function(t){var e=this.distanceToPoint(t.start),n=this.distanceToPoint(t.end);return e<0&&n>0||n<0&&e>0},intersectsBox:function(t){return t.intersectsPlane(this)},intersectsSphere:function(t){return t.intersectsPlane(this)},coplanarPoint:function(t){return(t||new l).copy(this.normal).multiplyScalar(-this.constant)},applyMatrix4:function(){var t=new l,e=new rt;return function(n,r){var i=this.coplanarPoint(t).applyMatrix4(n),o=r||e.getNormalMatrix(n),a=this.normal.applyMatrix3(o).normalize();return this.constant=-i.dot(a),this}}(),translate:function(t){return this.constant=this.constant-t.dot(this.normal),this},equals:function(t){return t.normal.equals(this.normal)&&t.constant===this.constant}},ot.prototype={constructor:ot,set:function(t,e,n,r,i,o){var a=this.planes;return a[0].copy(t),a[1].copy(e),a[2].copy(n),a[3].copy(r),a[4].copy(i),a[5].copy(o),this},clone:function(){return(new this.constructor).copy(this)},copy:function(t){for(var e=this.planes,n=0;n<6;n++)e[n].copy(t.planes[n]);return this},setFromMatrix:function(t){var e=this.planes,n=t.elements,r=n[0],i=n[1],o=n[2],a=n[3],s=n[4],u=n[5],c=n[6],l=n[7],h=n[8],p=n[9],f=n[10],d=n[11],m=n[12],v=n[13],g=n[14],y=n[15];return e[0].setComponents(a-r,l-s,d-h,y-m).normalize(),e[1].setComponents(a+r,l+s,d+h,y+m).normalize(),e[2].setComponents(a+i,l+u,d+p,y+v).normalize(),e[3].setComponents(a-i,l-u,d-p,y-v).normalize(),e[4].setComponents(a-o,l-c,d-f,y-g).normalize(),e[5].setComponents(a+o,l+c,d+f,y+g).normalize(),this},intersectsObject:function(){var t=new nt;return function(e){var n=e.geometry;return null===n.boundingSphere&&n.computeBoundingSphere(),t.copy(n.boundingSphere).applyMatrix4(e.matrixWorld),this.intersectsSphere(t)}}(),intersectsSprite:function(){var t=new nt;return function(e){return t.center.set(0,0,0),t.radius=.7071067811865476,t.applyMatrix4(e.matrixWorld),this.intersectsSphere(t)}}(),intersectsSphere:function(t){for(var e=this.planes,n=t.center,r=-t.radius,i=0;i<6;i++){if(e[i].distanceToPoint(n)0?n.min.x:n.max.x,e.x=o.normal.x>0?n.max.x:n.min.x,t.y=o.normal.y>0?n.min.y:n.max.y,e.y=o.normal.y>0?n.max.y:n.min.y,t.z=o.normal.z>0?n.min.z:n.max.z,e.z=o.normal.z>0?n.max.z:n.min.z;var a=o.distanceToPoint(t),s=o.distanceToPoint(e);if(a<0&&s<0)return!1}return!0}}(),containsPoint:function(t){for(var e=this.planes,n=0;n<6;n++)if(e[n].distanceToPoint(t)<0)return!1;return!0}},st.prototype={constructor:st,set:function(t,e){return this.origin.copy(t),this.direction.copy(e),this},clone:function(){return(new this.constructor).copy(this)},copy:function(t){return this.origin.copy(t.origin),this.direction.copy(t.direction),this},at:function(t,e){return(e||new l).copy(this.direction).multiplyScalar(t).add(this.origin)},lookAt:function(t){return this.direction.copy(t).sub(this.origin).normalize(),this},recast:function(){var t=new l;return function(e){return this.origin.copy(this.at(e,t)),this}}(),closestPointToPoint:function(t,e){var n=e||new l;n.subVectors(t,this.origin);var r=n.dot(this.direction);return r<0?n.copy(this.origin):n.copy(this.direction).multiplyScalar(r).add(this.origin)},distanceToPoint:function(t){return Math.sqrt(this.distanceSqToPoint(t))},distanceSqToPoint:function(){var t=new l;return function(e){var n=t.subVectors(e,this.origin).dot(this.direction);return n<0?this.origin.distanceToSquared(e):(t.copy(this.direction).multiplyScalar(n).add(this.origin),t.distanceToSquared(e))}}(),distanceSqToSegment:function(){var t=new l,e=new l,n=new l;return function(r,i,o,a){t.copy(r).add(i).multiplyScalar(.5),e.copy(i).sub(r).normalize(),n.copy(this.origin).sub(t);var s,u,c,l,h=.5*r.distanceTo(i),p=-this.direction.dot(e),f=n.dot(this.direction),d=-n.dot(e),m=n.lengthSq(),v=Math.abs(1-p*p);if(v>0)if(s=p*d-f,u=p*f-d,l=h*v,s>=0)if(u>=-l)if(u<=l){var g=1/v;s*=g,u*=g,c=s*(s+p*u+2*f)+u*(p*s+u+2*d)+m}else u=h,s=Math.max(0,-(p*u+f)),c=-s*s+u*(u+2*d)+m;else u=-h,s=Math.max(0,-(p*u+f)),c=-s*s+u*(u+2*d)+m;else u<=-l?(s=Math.max(0,-(-p*h+f)),u=s>0?-h:Math.min(Math.max(-h,-d),h),c=-s*s+u*(u+2*d)+m):u<=l?(s=0,u=Math.min(Math.max(-h,-d),h),c=u*(u+2*d)+m):(s=Math.max(0,-(p*h+f)),u=s>0?h:Math.min(Math.max(-h,-d),h),c=-s*s+u*(u+2*d)+m);else u=p>0?-h:h,s=Math.max(0,-(p*u+f)),c=-s*s+u*(u+2*d)+m;return o&&o.copy(this.direction).multiplyScalar(s).add(this.origin),a&&a.copy(e).multiplyScalar(u).add(t),c}}(),intersectSphere:function(){var t=new l;return function(e,n){t.subVectors(e.center,this.origin);var r=t.dot(this.direction),i=t.dot(t)-r*r,o=e.radius*e.radius;if(i>o)return null;var a=Math.sqrt(o-i),s=r-a,u=r+a;return s<0&&u<0?null:s<0?this.at(u,n):this.at(s,n)}}(),intersectsSphere:function(t){return this.distanceToPoint(t.center)<=t.radius},distanceToPlane:function(t){var e=t.normal.dot(this.direction);if(0===e)return 0===t.distanceToPoint(this.origin)?0:null;var n=-(this.origin.dot(t.normal)+t.constant)/e;return n>=0?n:null},intersectPlane:function(t,e){var n=this.distanceToPlane(t);return null===n?null:this.at(n,e)},intersectsPlane:function(t){var e=t.distanceToPoint(this.origin);return 0===e||t.normal.dot(this.direction)*e<0},intersectBox:function(t,e){var n,r,i,o,a,s,u=1/this.direction.x,c=1/this.direction.y,l=1/this.direction.z,h=this.origin;return u>=0?(n=(t.min.x-h.x)*u,r=(t.max.x-h.x)*u):(n=(t.max.x-h.x)*u,r=(t.min.x-h.x)*u),c>=0?(i=(t.min.y-h.y)*c,o=(t.max.y-h.y)*c):(i=(t.max.y-h.y)*c,o=(t.min.y-h.y)*c),n>o||i>r?null:((i>n||n!==n)&&(n=i),(o=0?(a=(t.min.z-h.z)*l,s=(t.max.z-h.z)*l):(a=(t.max.z-h.z)*l,s=(t.min.z-h.z)*l),n>s||a>r?null:((a>n||n!==n)&&(n=a),(s=0?n:r,e)))},intersectsBox:function(){var t=new l;return function(e){return null!==this.intersectBox(e,t)}}(),intersectTriangle:function(){var t=new l,e=new l,n=new l,r=new l;return function(i,o,a,s,u){e.subVectors(o,i),n.subVectors(a,i),r.crossVectors(e,n);var c,l=this.direction.dot(r);if(l>0){if(s)return null;c=1}else{if(!(l<0))return null;c=-1,l=-l}t.subVectors(this.origin,i);var h=c*this.direction.dot(n.crossVectors(t,n));if(h<0)return null;var p=c*this.direction.dot(e.cross(t));if(p<0)return null;if(h+p>l)return null;var f=-c*t.dot(r);return f<0?null:this.at(f/l,u)}}(),applyMatrix4:function(t){return this.direction.add(this.origin).applyMatrix4(t),this.origin.applyMatrix4(t),this.direction.sub(this.origin),this.direction.normalize(),this},equals:function(t){return t.origin.equals(this.origin)&&t.direction.equals(this.direction)}},ut.RotationOrders=["XYZ","YZX","ZXY","XZY","YXZ","ZYX"],ut.DefaultOrder="XYZ",ut.prototype={constructor:ut,isEuler:!0,get x(){return this._x},set x(t){this._x=t,this.onChangeCallback()},get y(){return this._y},set y(t){this._y=t,this.onChangeCallback()},get z(){return this._z},set z(t){this._z=t,this.onChangeCallback()},get order(){return this._order},set order(t){this._order=t,this.onChangeCallback()},set:function(t,e,n,r){return this._x=t,this._y=e,this._z=n,this._order=r||this._order,this.onChangeCallback(),this},clone:function(){return new this.constructor(this._x,this._y,this._z,this._order)},copy:function(t){return this._x=t._x,this._y=t._y,this._z=t._z,this._order=t._order,this.onChangeCallback(),this},setFromRotationMatrix:function(t,e,n){var r=fs.clamp,i=t.elements,o=i[0],a=i[4],s=i[8],u=i[1],c=i[5],l=i[9],h=i[2],p=i[6],f=i[10];return e=e||this._order,"XYZ"===e?(this._y=Math.asin(r(s,-1,1)),Math.abs(s)<.99999?(this._x=Math.atan2(-l,f),this._z=Math.atan2(-a,o)):(this._x=Math.atan2(p,c),this._z=0)):"YXZ"===e?(this._x=Math.asin(-r(l,-1,1)),Math.abs(l)<.99999?(this._y=Math.atan2(s,f),this._z=Math.atan2(u,c)):(this._y=Math.atan2(-h,o),this._z=0)):"ZXY"===e?(this._x=Math.asin(r(p,-1,1)),Math.abs(p)<.99999?(this._y=Math.atan2(-h,f),this._z=Math.atan2(-a,c)):(this._y=0,this._z=Math.atan2(u,o))):"ZYX"===e?(this._y=Math.asin(-r(h,-1,1)),Math.abs(h)<.99999?(this._x=Math.atan2(p,f),this._z=Math.atan2(u,o)):(this._x=0,this._z=Math.atan2(-a,c))):"YZX"===e?(this._z=Math.asin(r(u,-1,1)),Math.abs(u)<.99999?(this._x=Math.atan2(-l,c),this._y=Math.atan2(-h,o)):(this._x=0,this._y=Math.atan2(s,f))):"XZY"===e?(this._z=Math.asin(-r(a,-1,1)),Math.abs(a)<.99999?(this._x=Math.atan2(p,c),this._y=Math.atan2(s,o)):(this._x=Math.atan2(-l,f),this._y=0)):console.warn("THREE.Euler: .setFromRotationMatrix() given unsupported order: "+e),this._order=e,!1!==n&&this.onChangeCallback(),this},setFromQuaternion:function(){var t;return function(e,n,r){return void 0===t&&(t=new h),t.makeRotationFromQuaternion(e),this.setFromRotationMatrix(t,n,r)}}(),setFromVector3:function(t,e){return this.set(t.x,t.y,t.z,e||this._order)},reorder:function(){var t=new c;return function(e){return t.setFromEuler(this),this.setFromQuaternion(t,e)}}(),equals:function(t){return t._x===this._x&&t._y===this._y&&t._z===this._z&&t._order===this._order},fromArray:function(t){return this._x=t[0],this._y=t[1],this._z=t[2],void 0!==t[3]&&(this._order=t[3]),this.onChangeCallback(),this},toArray:function(t,e){return void 0===t&&(t=[]),void 0===e&&(e=0),t[e]=this._x,t[e+1]=this._y,t[e+2]=this._z,t[e+3]=this._order,t},toVector3:function(t){return t?t.set(this._x,this._y,this._z):new l(this._x,this._y,this._z)},onChange:function(t){return this.onChangeCallback=t,this},onChangeCallback:function(){}},ct.prototype={constructor:ct,set:function(t){this.mask=1<1){for(var e=0;e1)for(var e=0;e0){i.children=[];for(var o=0;o0&&(r.geometries=a),s.length>0&&(r.materials=s),u.length>0&&(r.textures=u),c.length>0&&(r.images=c)}return r.object=i,r},clone:function(t){return(new this.constructor).copy(this,t)},copy:function(t,e){if(void 0===e&&(e=!0),this.name=t.name,this.up.copy(t.up),this.position.copy(t.position),this.quaternion.copy(t.quaternion),this.scale.copy(t.scale),this.matrix.copy(t.matrix),this.matrixWorld.copy(t.matrixWorld),this.matrixAutoUpdate=t.matrixAutoUpdate,this.matrixWorldNeedsUpdate=t.matrixWorldNeedsUpdate,this.layers.mask=t.layers.mask,this.visible=t.visible,this.castShadow=t.castShadow,this.receiveShadow=t.receiveShadow,this.frustumCulled=t.frustumCulled,this.renderOrder=t.renderOrder,this.userData=JSON.parse(JSON.stringify(t.userData)),!0===e)for(var n=0;n0?o.multiplyScalar(1/Math.sqrt(a)):o.set(0,0,0)}}(),pt.barycoordFromPoint=function(){var t=new l,e=new l,n=new l;return function(r,i,o,a,s){t.subVectors(a,i),e.subVectors(o,i),n.subVectors(r,i);var u=t.dot(t),c=t.dot(e),h=t.dot(n),p=e.dot(e),f=e.dot(n),d=u*p-c*c,m=s||new l;if(0===d)return m.set(-2,-1,-1);var v=1/d,g=(p*h-c*f)*v,y=(u*f-c*h)*v;return m.set(1-g-y,y,g)}}(),pt.containsPoint=function(){var t=new l;return function(e,n,r,i){var o=pt.barycoordFromPoint(e,n,r,i,t);return o.x>=0&&o.y>=0&&o.x+o.y<=1}}(),pt.prototype={constructor:pt,set:function(t,e,n){return this.a.copy(t),this.b.copy(e),this.c.copy(n),this},setFromPointsAndIndices:function(t,e,n,r){return this.a.copy(t[e]),this.b.copy(t[n]),this.c.copy(t[r]),this},clone:function(){return(new this.constructor).copy(this)},copy:function(t){return this.a.copy(t.a),this.b.copy(t.b),this.c.copy(t.c),this},area:function(){var t=new l,e=new l;return function(){return t.subVectors(this.c,this.b),e.subVectors(this.a,this.b),.5*t.cross(e).length()}}(),midpoint:function(t){return(t||new l).addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)},normal:function(t){return pt.normal(this.a,this.b,this.c,t)},plane:function(t){return(t||new it).setFromCoplanarPoints(this.a,this.b,this.c)},barycoordFromPoint:function(t,e){return pt.barycoordFromPoint(t,this.a,this.b,this.c,e)},containsPoint:function(t){return pt.containsPoint(t,this.a,this.b,this.c)},closestPointToPoint:function(){var t,e,n,r;return function(i,o){void 0===t&&(t=new it,e=[new ht,new ht,new ht],n=new l,r=new l);var a=o||new l,s=1/0;if(t.setFromCoplanarPoints(this.a,this.b,this.c),t.projectPoint(i,n),!0===this.containsPoint(n))a.copy(n);else{e[0].set(this.a,this.b),e[1].set(this.b,this.c),e[2].set(this.c,this.a);for(var u=0;u0,s=o[1]&&o[1].length>0,u=t.morphTargets,c=u.length;if(c>0){e=[];for(var l=0;l0){h=[];for(var l=0;l0)for(var m=0;m0&&(this.normalsNeedUpdate=!0)},computeFlatVertexNormals:function(){var t,e,n;for(this.computeFaceNormals(),t=0,e=this.faces.length;t0&&(this.normalsNeedUpdate=!0)},computeMorphNormals:function(){var t,e,n,r,i;for(n=0,r=this.faces.length;n0&&(t+=e[n].distanceTo(e[n-1])),this.lineDistances[n]=t},computeBoundingBox:function(){null===this.boundingBox&&(this.boundingBox=new et),this.boundingBox.setFromPoints(this.vertices)},computeBoundingSphere:function(){null===this.boundingSphere&&(this.boundingSphere=new nt),this.boundingSphere.setFromPoints(this.vertices)},merge:function(t,e,n){if(!1===(t&&t.isGeometry))return void console.error("THREE.Geometry.merge(): geometry not an instance of THREE.Geometry.",t);var r,i=this.vertices.length,o=this.vertices,a=t.vertices,s=this.faces,u=t.faces,c=this.faceVertexUvs[0],l=t.faceVertexUvs[0],h=this.colors,p=t.colors;void 0===n&&(n=0),void 0!==e&&(r=(new rt).getNormalMatrix(e));for(var f=0,d=a.length;f=0;n--){var d=p[n];for(this.faces.splice(d,1),a=0,s=this.faceVertexUvs.length;a0,x=g.vertexNormals.length>0,_=1!==g.color.r||1!==g.color.g||1!==g.color.b,w=g.vertexColors.length>0,E=0;if(E=t(E,0,0),E=t(E,1,!0),E=t(E,2,!1),E=t(E,3,y),E=t(E,4,b),E=t(E,5,x),E=t(E,6,_),E=t(E,7,w),l.push(E),l.push(g.a,g.b,g.c),l.push(g.materialIndex),y){var M=this.faceVertexUvs[0][u];l.push(r(M[0]),r(M[1]),r(M[2]))}if(b&&l.push(e(g.normal)),x){var T=g.vertexNormals;l.push(e(T[0]),e(T[1]),e(T[2]))}if(_&&l.push(n(g.color)),w){var S=g.vertexColors;l.push(n(S[0]),n(S[1]),n(S[2]))}}return i.data={},i.data.vertices=s,i.data.normals=h,f.length>0&&(i.data.colors=f),m.length>0&&(i.data.uvs=[m]),i.data.faces=l,i},clone:function(){return(new Ct).copy(this)},copy:function(t){var e,n,r,i,o,a;this.vertices=[],this.colors=[],this.faces=[],this.faceVertexUvs=[[]],this.morphTargets=[],this.morphNormals=[],this.skinWeights=[],this.skinIndices=[],this.lineDistances=[],this.boundingBox=null,this.boundingSphere=null,this.name=t.name;var s=t.vertices;for(e=0,n=s.length;e65535?wt:xt)(t,1):this.index=t},addAttribute:function(t,e){return!1===(e&&e.isBufferAttribute)&&!1===(e&&e.isInterleavedBufferAttribute)?(console.warn("THREE.BufferGeometry: .addAttribute() now expects ( name, attribute )."),void this.addAttribute(t,new mt(arguments[1],arguments[2]))):"index"===t?(console.warn("THREE.BufferGeometry.addAttribute: Use .setIndex() for index attribute."),void this.setIndex(e)):(this.attributes[t]=e,this)},getAttribute:function(t){return this.attributes[t]},removeAttribute:function(t){return delete this.attributes[t],this},addGroup:function(t,e,n){this.groups.push({start:t,count:e,materialIndex:void 0!==n?n:0})},clearGroups:function(){this.groups=[]},setDrawRange:function(t,e){this.drawRange.start=t,this.drawRange.count=e},applyMatrix:function(t){var e=this.attributes.position;void 0!==e&&(t.applyToBufferAttribute(e),e.needsUpdate=!0);var n=this.attributes.normal;if(void 0!==n){(new rt).getNormalMatrix(t).applyToBufferAttribute(n),n.needsUpdate=!0}return null!==this.boundingBox&&this.computeBoundingBox(),null!==this.boundingSphere&&this.computeBoundingSphere(),this},rotateX:function(){var t;return function(e){return void 0===t&&(t=new h),t.makeRotationX(e),this.applyMatrix(t),this}}(),rotateY:function(){var t;return function(e){return void 0===t&&(t=new h),t.makeRotationY(e),this.applyMatrix(t),this}}(),rotateZ:function(){var t;return function(e){return void 0===t&&(t=new h),t.makeRotationZ(e),this.applyMatrix(t),this}}(),translate:function(){var t;return function(e,n,r){return void 0===t&&(t=new h),t.makeTranslation(e,n,r),this.applyMatrix(t),this}}(),scale:function(){var t;return function(e,n,r){return void 0===t&&(t=new h),t.makeScale(e,n,r),this.applyMatrix(t),this}}(),lookAt:function(){var t;return function(e){void 0===t&&(t=new lt),t.lookAt(e),t.updateMatrix(),this.applyMatrix(t.matrix)}}(),center:function(){this.computeBoundingBox();var t=this.boundingBox.getCenter().negate();return this.translate(t.x,t.y,t.z),t},setFromObject:function(t){var e=t.geometry;if(t.isPoints||t.isLine){var n=new Et(3*e.vertices.length,3),r=new Et(3*e.colors.length,3);if(this.addAttribute("position",n.copyVector3sArray(e.vertices)),this.addAttribute("color",r.copyColorsArray(e.colors)),e.lineDistances&&e.lineDistances.length===e.vertices.length){var i=new Et(e.lineDistances.length,1);this.addAttribute("lineDistance",i.copyArray(e.lineDistances))}null!==e.boundingSphere&&(this.boundingSphere=e.boundingSphere.clone()),null!==e.boundingBox&&(this.boundingBox=e.boundingBox.clone())}else t.isMesh&&e&&e.isGeometry&&this.fromGeometry(e);return this},updateFromObject:function(t){var e=t.geometry;if(t.isMesh){var n=e.__directGeometry;if(!0===e.elementsNeedUpdate&&(n=void 0,e.elementsNeedUpdate=!1),void 0===n)return this.fromGeometry(e);n.verticesNeedUpdate=e.verticesNeedUpdate,n.normalsNeedUpdate=e.normalsNeedUpdate,n.colorsNeedUpdate=e.colorsNeedUpdate,n.uvsNeedUpdate=e.uvsNeedUpdate,n.groupsNeedUpdate=e.groupsNeedUpdate,e.verticesNeedUpdate=!1,e.normalsNeedUpdate=!1,e.colorsNeedUpdate=!1,e.uvsNeedUpdate=!1,e.groupsNeedUpdate=!1,e=n}var r;return!0===e.verticesNeedUpdate&&(r=this.attributes.position,void 0!==r&&(r.copyVector3sArray(e.vertices),r.needsUpdate=!0),e.verticesNeedUpdate=!1),!0===e.normalsNeedUpdate&&(r=this.attributes.normal,void 0!==r&&(r.copyVector3sArray(e.normals),r.needsUpdate=!0),e.normalsNeedUpdate=!1),!0===e.colorsNeedUpdate&&(r=this.attributes.color,void 0!==r&&(r.copyColorsArray(e.colors),r.needsUpdate=!0),e.colorsNeedUpdate=!1),e.uvsNeedUpdate&&(r=this.attributes.uv,void 0!==r&&(r.copyVector2sArray(e.uvs),r.needsUpdate=!0),e.uvsNeedUpdate=!1),e.lineDistancesNeedUpdate&&(r=this.attributes.lineDistance,void 0!==r&&(r.copyArray(e.lineDistances),r.needsUpdate=!0),e.lineDistancesNeedUpdate=!1),e.groupsNeedUpdate&&(e.computeGroups(t.geometry),this.groups=e.groups,e.groupsNeedUpdate=!1),this},fromGeometry:function(t){return t.__directGeometry=(new Tt).fromGeometry(t),this.fromDirectGeometry(t.__directGeometry)},fromDirectGeometry:function(t){var e=new Float32Array(3*t.vertices.length);if(this.addAttribute("position",new mt(e,3).copyVector3sArray(t.vertices)),t.normals.length>0){var n=new Float32Array(3*t.normals.length);this.addAttribute("normal",new mt(n,3).copyVector3sArray(t.normals))}if(t.colors.length>0){var r=new Float32Array(3*t.colors.length);this.addAttribute("color",new mt(r,3).copyColorsArray(t.colors))}if(t.uvs.length>0){var i=new Float32Array(2*t.uvs.length);this.addAttribute("uv",new mt(i,2).copyVector2sArray(t.uvs))}if(t.uvs2.length>0){var o=new Float32Array(2*t.uvs2.length);this.addAttribute("uv2",new mt(o,2).copyVector2sArray(t.uvs2))}if(t.indices.length>0){var a=St(t.indices)>65535?Uint32Array:Uint16Array,s=new a(3*t.indices.length);this.setIndex(new mt(s,1).copyIndicesArray(t.indices))}this.groups=t.groups;for(var u in t.morphTargets){for(var c=[],l=t.morphTargets[u],h=0,p=l.length;h0){var m=new Et(4*t.skinIndices.length,4);this.addAttribute("skinIndex",m.copyVector4sArray(t.skinIndices))}if(t.skinWeights.length>0){var v=new Et(4*t.skinWeights.length,4);this.addAttribute("skinWeight",v.copyVector4sArray(t.skinWeights))}return null!==t.boundingSphere&&(this.boundingSphere=t.boundingSphere.clone()),null!==t.boundingBox&&(this.boundingBox=t.boundingBox.clone()),this},computeBoundingBox:function(){null===this.boundingBox&&(this.boundingBox=new et);var t=this.attributes.position;void 0!==t?this.boundingBox.setFromBufferAttribute(t):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(){var t=new et,e=new l;return function(){null===this.boundingSphere&&(this.boundingSphere=new nt);var n=this.attributes.position;if(n){var r=this.boundingSphere.center;t.setFromBufferAttribute(n),t.getCenter(r);for(var i=0,o=0,a=n.count;o0&&(t.data.groups=JSON.parse(JSON.stringify(s)));var u=this.boundingSphere;return null!==u&&(t.data.boundingSphere={center:u.center.toArray(),radius:u.radius}),t},clone:function(){return(new Pt).copy(this)},copy:function(t){var e,n,r;this.index=null,this.attributes={},this.morphAttributes={},this.groups=[],this.boundingBox=null,this.boundingSphere=null,this.name=t.name;var i=t.index;null!==i&&this.setIndex(i.clone());var o=t.attributes;for(e in o){var a=o[e];this.addAttribute(e,a.clone())}var s=t.morphAttributes;for(e in s){var u=[],c=s[e];for(n=0,r=c.length;n0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(var e=0,n=t.length;ee.far?null:{distance:u,point:x.clone(),object:t}}function n(n,r,i,o,a,l,h,p){s.fromBufferAttribute(o,l),u.fromBufferAttribute(o,h),c.fromBufferAttribute(o,p);var f=e(n,r,i,s,u,c,b);return f&&(a&&(m.fromBufferAttribute(a,l),v.fromBufferAttribute(a,h),g.fromBufferAttribute(a,p),f.uv=t(b,s,u,c,m,v,g)),f.face=new ft(l,h,p,pt.normal(s,u,c)),f.faceIndex=l),f}var r=new h,o=new st,a=new nt,s=new l,u=new l,c=new l,p=new l,f=new l,d=new l,m=new i,v=new i,g=new i,y=new l,b=new l,x=new l;return function(i,l){var h=this.geometry,y=this.material,x=this.matrixWorld;if(void 0!==y&&(null===h.boundingSphere&&h.computeBoundingSphere(),a.copy(h.boundingSphere),a.applyMatrix4(x),!1!==i.ray.intersectsSphere(a)&&(r.getInverse(x),o.copy(i.ray).applyMatrix4(r),null===h.boundingBox||!1!==o.intersectsBox(h.boundingBox)))){var _;if(h.isBufferGeometry){var w,E,M,T,S,A=h.index,C=h.attributes.position,P=h.attributes.uv;if(null!==A)for(T=0,S=A.count;T0&&(I=F);for(var j=0,B=U.length;jthis.scale.x*this.scale.y/4||n.push({distance:Math.sqrt(r),point:this.position,face:null,object:this})}}(),clone:function(){return new this.constructor(this.material).copy(this)}}),ge.prototype=Object.assign(Object.create(lt.prototype),{constructor:ge,copy:function(t){lt.prototype.copy.call(this,t,!1);for(var e=t.levels,n=0,r=e.length;n1){t.setFromMatrixPosition(n.matrixWorld),e.setFromMatrixPosition(this.matrixWorld);var i=t.distanceTo(e);r[0].object.visible=!0;for(var o=1,a=r.length;o=r[o].distance;o++)r[o-1].object.visible=!1,r[o].object.visible=!0;for(;oa)){f.applyMatrix4(this.matrixWorld);var M=r.ray.origin.distanceTo(f);Mr.far||i.push({distance:M,point:p.clone().applyMatrix4(this.matrixWorld),index:b,face:null,faceIndex:null,object:this})}}else for(var b=0,x=g.length/3-1;ba)){f.applyMatrix4(this.matrixWorld);var M=r.ray.origin.distanceTo(f);Mr.far||i.push({distance:M,point:p.clone().applyMatrix4(this.matrixWorld),index:b,face:null,faceIndex:null,object:this})}}}else if(s.isGeometry)for(var T=s.vertices,S=T.length,b=0;ba)){f.applyMatrix4(this.matrixWorld);var M=r.ray.origin.distanceTo(f);Mr.far||i.push({distance:M,point:p.clone().applyMatrix4(this.matrixWorld),index:b,face:null,faceIndex:null,object:this})}}}}}(),clone:function(){return new this.constructor(this.geometry,this.material).copy(this)}}),Ee.prototype=Object.assign(Object.create(we.prototype),{constructor:Ee,isLineSegments:!0}),Me.prototype=Object.create(J.prototype),Me.prototype.constructor=Me,Me.prototype.isPointsMaterial=!0,Me.prototype.copy=function(t){return J.prototype.copy.call(this,t),this.color.copy(t.color),this.map=t.map,this.size=t.size,this.sizeAttenuation=t.sizeAttenuation,this},Te.prototype=Object.assign(Object.create(lt.prototype),{constructor:Te,isPoints:!0,raycast:function(){var t=new h,e=new st,n=new nt;return function(r,i){function o(t,n){var o=e.distanceSqToPoint(t);if(or.far)return;i.push({distance:c,distanceToRay:Math.sqrt(o),point:s.clone(),index:n,face:null,object:a})}}var a=this,s=this.geometry,u=this.matrixWorld,c=r.params.Points.threshold;if(null===s.boundingSphere&&s.computeBoundingSphere(),n.copy(s.boundingSphere),n.applyMatrix4(u),!1!==r.ray.intersectsSphere(n)){t.getInverse(u),e.copy(r.ray).applyMatrix4(t);var h=c/((this.scale.x+this.scale.y+this.scale.z)/3),p=h*h,f=new l;if(s.isBufferGeometry){var d=s.index,m=s.attributes,v=m.position.array;if(null!==d)for(var g=d.array,y=0,b=g.length;y=-Number.EPSILON&&C>=-Number.EPSILON&&A>=-Number.EPSILON))return!1;return!0}return function(e,n){var r=e.length;if(r<3)return null;var i,o,a,s=[],u=[],c=[];if(Ps.area(e)>0)for(o=0;o2;){if(h--<=0)return console.warn("THREE.ShapeUtils: Unable to triangulate polygon! in triangulate()"),n?c:s;if(i=o,l<=i&&(i=0),o=i+1,l<=o&&(o=0),a=o+1,l<=a&&(a=0),t(e,i,o,a,l,u)){var p,f,d,m,v;for(p=u[i],f=u[o],d=u[a],s.push([e[p],e[f],e[d]]),c.push([u[i],u[o],u[a]]),m=o,v=o+1;v2&&t[e-1].equals(t[0])&&t.pop()}function r(t,e,n){return t.x!==e.x?t.xNumber.EPSILON){var d;if(p>0){if(f<0||f>p)return[];if((d=c*l-u*h)<0||d>p)return[]}else{if(f>0||f0||dT?[]:x===T?o?[]:[y]:_<=T?[y,b]:[y,E]}function o(t,e,n,r){var i=e.x-t.x,o=e.y-t.y,a=n.x-t.x,s=n.y-t.y,u=r.x-t.x,c=r.y-t.y,l=i*s-o*a,h=i*c-o*u;if(Math.abs(l)>Number.EPSILON){var p=u*s-c*a;return l>0?h>=0&&p>=0:h>=0||p>=0}return h>0}n(t),e.forEach(n);for(var a,s,u,c,l,h,p={},f=t.concat(),d=0,m=e.length;d0;){if(--_<0){console.log("Infinite Loop! Holes left:"+v.length+", Probably Hole outside Shape!");break}for(a=x;ar&&(a=0);var s=o(m[t],m[i],m[a],n[e]);if(!s)return!1;var u=n.length-1,c=e-1;c<0&&(c=u);var l=e+1;return l>u&&(l=0),!!(s=o(n[e],n[c],n[l],m[t]))}(a,w)&&!function(t,e){var n,r,o;for(n=0;n0)return!0;return!1}(s,u)&&!function(t,n){var r,o,a,s,u;for(r=0;r0)return!0;return!1}(s,u)){r=w,v.splice(y,1),h=m.slice(0,a+1),p=m.slice(a),f=n.slice(r),d=n.slice(0,r+1),m=h.concat(f).concat(d).concat(p),x=a;break}if(r>=0)break;g[l]=!0}if(r>=0)break}}return m}(t,e),g=Ps.triangulate(v,!1);for(a=0,s=g.length;aNumber.EPSILON){var f=Math.sqrt(h),d=Math.sqrt(c*c+l*l),m=e.x-u/f,v=e.y+s/f,g=n.x-l/d,y=n.y+c/d,b=((g-m)*l-(y-v)*c)/(s*l-u*c);r=m+s*b-t.x,o=v+u*b-t.y;var x=r*r+o*o;if(x<=2)return new i(r,o);a=Math.sqrt(x/2)}else{var _=!1;s>Number.EPSILON?c>Number.EPSILON&&(_=!0):s<-Number.EPSILON?c<-Number.EPSILON&&(_=!0):Math.sign(u)===Math.sign(l)&&(_=!0),_?(r=-u,o=s,a=Math.sqrt(h)):(r=s,o=u,a=Math.sqrt(h/2))}return new i(r/a,o/a)}function o(t,e){var n,r;for(W=t.length;--W>=0;){n=W,r=W-1,r<0&&(r=t.length-1);var i=0,o=_+2*y;for(i=0;i=0;k--){for(F=k/y,j=v*Math.cos(F*Math.PI/2),U=g*Math.sin(F*Math.PI/2),W=0,X=D.length;W0||0===t.search(/^data\:image\/jpeg/);i.format=r?Pa:Ra,i.image=n,i.needsUpdate=!0,void 0!==e&&e(i)},n,r),i},setCrossOrigin:function(t){return this.crossOrigin=t,this},setPath:function(t){return this.path=t,this}}),Ln.prototype=Object.assign(Object.create(lt.prototype),{constructor:Ln,isLight:!0,copy:function(t){return lt.prototype.copy.call(this,t),this.color.copy(t.color),this.intensity=t.intensity,this},toJSON:function(t){var e=lt.prototype.toJSON.call(this,t);return e.object.color=this.color.getHex(),e.object.intensity=this.intensity,void 0!==this.groundColor&&(e.object.groundColor=this.groundColor.getHex()),void 0!==this.distance&&(e.object.distance=this.distance),void 0!==this.angle&&(e.object.angle=this.angle),void 0!==this.decay&&(e.object.decay=this.decay),void 0!==this.penumbra&&(e.object.penumbra=this.penumbra),void 0!==this.shadow&&(e.object.shadow=this.shadow.toJSON()),e}}),On.prototype=Object.assign(Object.create(Ln.prototype),{constructor:On,isHemisphereLight:!0,copy:function(t){return Ln.prototype.copy.call(this,t),this.groundColor.copy(t.groundColor),this}}),Object.assign(In.prototype,{copy:function(t){return this.camera=t.camera.clone(),this.bias=t.bias,this.radius=t.radius,this.mapSize.copy(t.mapSize),this},clone:function(){return(new this.constructor).copy(this)},toJSON:function(){var t={};return 0!==this.bias&&(t.bias=this.bias),1!==this.radius&&(t.radius=this.radius),512===this.mapSize.x&&512===this.mapSize.y||(t.mapSize=this.mapSize.toArray()),t.camera=this.camera.toJSON(!1).object,delete t.camera.matrix,t}}),Nn.prototype=Object.assign(Object.create(In.prototype),{constructor:Nn,isSpotLightShadow:!0,update:function(t){var e=2*fs.RAD2DEG*t.angle,n=this.mapSize.width/this.mapSize.height,r=t.distance||500,i=this.camera;e===i.fov&&n===i.aspect&&r===i.far||(i.fov=e,i.aspect=n,i.far=r,i.updateProjectionMatrix())}}),Dn.prototype=Object.assign(Object.create(Ln.prototype),{constructor:Dn,isSpotLight:!0,copy:function(t){return Ln.prototype.copy.call(this,t),this.distance=t.distance,this.angle=t.angle,this.penumbra=t.penumbra,this.decay=t.decay,this.target=t.target.clone(),this.shadow=t.shadow.clone(),this}}),kn.prototype=Object.assign(Object.create(Ln.prototype),{constructor:kn,isPointLight:!0,copy:function(t){return Ln.prototype.copy.call(this,t),this.distance=t.distance,this.decay=t.decay,this.shadow=t.shadow.clone(),this}}),Un.prototype=Object.assign(Object.create(In.prototype),{constructor:Un}),Fn.prototype=Object.assign(Object.create(Ln.prototype),{constructor:Fn,isDirectionalLight:!0,copy:function(t){return Ln.prototype.copy.call(this,t),this.target=t.target.clone(),this.shadow=t.shadow.clone(),this}}),jn.prototype=Object.assign(Object.create(Ln.prototype),{constructor:jn,isAmbientLight:!0});var Ns={arraySlice:function(t,e,n){return Ns.isTypedArray(t)?new t.constructor(t.subarray(e,n)):t.slice(e,n)},convertArray:function(t,e,n){return!t||!n&&t.constructor===e?t:"number"==typeof e.BYTES_PER_ELEMENT?new e(t):Array.prototype.slice.call(t)},isTypedArray:function(t){return ArrayBuffer.isView(t)&&!(t instanceof DataView)},getKeyframeOrder:function(t){function e(e,n){return t[e]-t[n]}for(var n=t.length,r=new Array(n),i=0;i!==n;++i)r[i]=i;return r.sort(e),r},sortedArray:function(t,e,n){for(var r=t.length,i=new t.constructor(r),o=0,a=0;a!==r;++o)for(var s=n[o]*e,u=0;u!==e;++u)i[a++]=t[s+u];return i},flattenJSON:function(t,e,n,r){for(var i=1,o=t[0];void 0!==o&&void 0===o[r];)o=t[i++];if(void 0!==o){var a=o[r];if(void 0!==a)if(Array.isArray(a))do{a=o[r],void 0!==a&&(e.push(o.time),n.push.apply(n,a)),o=t[i++]}while(void 0!==o);else if(void 0!==a.toArray)do{a=o[r],void 0!==a&&(e.push(o.time),a.toArray(n,n.length)),o=t[i++]}while(void 0!==o);else do{a=o[r],void 0!==a&&(e.push(o.time),n.push(a)),o=t[i++]}while(void 0!==o)}}};Bn.prototype={constructor:Bn,evaluate:function(t){var e=this.parameterPositions,n=this._cachedIndex,r=e[n],i=e[n-1];t:{e:{var o;n:{r:if(!(t=i)break t;var s=e[1];t=i)break e}o=n,n=0}}for(;n>>1;te;)--o;if(++o,0!==i||o!==r){i>=o&&(o=Math.max(o,1),i=o-1);var a=this.getValueSize();this.times=Ns.arraySlice(n,i,o),this.values=Ns.arraySlice(this.values,i*a,o*a)}return this},validate:function(){var t=!0,e=this.getValueSize();e-Math.floor(e)!=0&&(console.error("invalid value size in track",this),t=!1);var n=this.times,r=this.values,i=n.length;0===i&&(console.error("track is empty",this),t=!1);for(var o=null,a=0;a!==i;a++){var s=n[a];if("number"==typeof s&&isNaN(s)){console.error("time is not a valid number",this,a,s),t=!1;break}if(null!==o&&o>s){console.error("out of order keys",this,a,s,o),t=!1;break}o=s}if(void 0!==r&&Ns.isTypedArray(r))for(var a=0,u=r.length;a!==u;++a){var c=r[a];if(isNaN(c)){console.error("value is not a valid number",this,a,c),t=!1;break}}return t},optimize:function(){for(var t=this.times,e=this.values,n=this.getValueSize(),r=this.getInterpolation()===Ka,i=1,o=t.length-1,a=1;a0){t[i]=t[o];for(var d=o*n,m=i*n,p=0;p!==n;++p)e[m+p]=e[d+p];++i}return i!==t.length&&(this.times=Ns.arraySlice(t,0,i),this.values=Ns.arraySlice(e,0,i*n)),this}},Wn.prototype=Object.assign(Object.create(Ds),{constructor:Wn,ValueTypeName:"vector"}),Xn.prototype=Object.assign(Object.create(Bn.prototype),{constructor:Xn,interpolate_:function(t,e,n,r){for(var i=this.resultBuffer,o=this.sampleValues,a=this.valueSize,s=t*a,u=(n-e)/(r-e),l=s+a;s!==l;s+=4)c.slerpFlat(i,0,o,s-a,o,s,u);return i}}),qn.prototype=Object.assign(Object.create(Ds),{constructor:qn,ValueTypeName:"quaternion",DefaultInterpolation:Za,InterpolantFactoryMethodLinear:function(t){return new Xn(this.times,this.values,this.getValueSize(),t)},InterpolantFactoryMethodSmooth:void 0}),Yn.prototype=Object.assign(Object.create(Ds),{constructor:Yn,ValueTypeName:"number"}),Zn.prototype=Object.assign(Object.create(Ds),{constructor:Zn,ValueTypeName:"string",ValueBufferType:Array,DefaultInterpolation:Ya,InterpolantFactoryMethodLinear:void 0,InterpolantFactoryMethodSmooth:void 0}),Kn.prototype=Object.assign(Object.create(Ds),{constructor:Kn,ValueTypeName:"bool",ValueBufferType:Array,DefaultInterpolation:Ya,InterpolantFactoryMethodLinear:void 0,InterpolantFactoryMethodSmooth:void 0}),$n.prototype=Object.assign(Object.create(Ds),{constructor:$n,ValueTypeName:"color"}),Jn.prototype=Ds,Ds.constructor=Jn,Object.assign(Jn,{parse:function(t){if(void 0===t.type)throw new Error("track type undefined, can not parse");var e=Jn._getTrackTypeForValueTypeName(t.type);if(void 0===t.times){var n=[],r=[];Ns.flattenJSON(t.keys,n,r,"value"),t.times=n,t.values=r}return void 0!==e.parse?e.parse(t):new e(t.name,t.times,t.values,t.interpolation)},toJSON:function(t){var e,n=t.constructor;if(void 0!==n.toJSON)e=n.toJSON(t);else{e={name:t.name,times:Ns.convertArray(t.times,Array),values:Ns.convertArray(t.values,Array)};var r=t.getInterpolation();r!==t.DefaultInterpolation&&(e.interpolation=r)}return e.type=t.ValueTypeName,e},_getTrackTypeForValueTypeName:function(t){switch(t.toLowerCase()){case"scalar":case"double":case"float":case"number":case"integer":return Yn;case"vector":case"vector2":case"vector3":case"vector4":return Wn;case"color":return $n;case"quaternion":return qn;case"bool":case"boolean":return Kn;case"string":return Zn}throw new Error("Unsupported typeName: "+t)}}),Qn.prototype={constructor:Qn,resetDuration:function(){for(var t=this.tracks,e=0,n=0,r=t.length;n!==r;++n){var i=this.tracks[n];e=Math.max(e,i.times[i.times.length-1])}this.duration=e},trim:function(){for(var t=0;t1){var c=u[1],l=r[c];l||(r[c]=l=[]),l.push(s)}}var h=[];for(var c in r)h.push(Qn.CreateFromMorphTargetSequence(c,r[c],e,n));return h},parseAnimation:function(t,e){if(!t)return console.error(" no animation in JSONLoader data"),null;for(var n=function(t,e,n,r,i){if(0!==n.length){var o=[],a=[];Ns.flattenJSON(n,o,a,r),0!==o.length&&i.push(new t(e,o,a))}},r=[],i=t.name||"default",o=t.length||-1,a=t.fps||30,s=t.hierarchy||[],u=0;u1?t.skinWeights[r+1]:0,u=e>2?t.skinWeights[r+2]:0,c=e>3?t.skinWeights[r+3]:0;n.skinWeights.push(new a(o,s,u,c))}if(t.skinIndices)for(var r=0,i=t.skinIndices.length;r1?t.skinIndices[r+1]:0,p=e>2?t.skinIndices[r+2]:0,f=e>3?t.skinIndices[r+3]:0;n.skinIndices.push(new a(l,h,p,f))}n.bones=t.bones,n.bones&&n.bones.length>0&&(n.skinWeights.length!==n.skinIndices.length||n.skinIndices.length!==n.vertices.length)&&console.warn("When skinning, number of vertices ("+n.vertices.length+"), skinIndices ("+n.skinIndices.length+"), and skinWeights ("+n.skinWeights.length+") should match.")}(),function(e){if(void 0!==t.morphTargets)for(var r=0,i=t.morphTargets.length;r0){console.warn('THREE.JSONLoader: "morphColors" no longer supported. Using them as face colors.');for(var h=n.faces,p=t.morphColors[0].colors,r=0,i=h.length;r0&&(n.animations=e)}(),n.computeFaceNormals(),n.computeBoundingSphere(),void 0===t.materials||0===t.materials.length)return{geometry:n};var o=nr.prototype.initMaterials(t.materials,e,this.crossOrigin);return{geometry:n,materials:o}}}),Object.assign(ir.prototype,{load:function(t,e,n,r){""===this.texturePath&&(this.texturePath=t.substring(0,t.lastIndexOf("/")+1));var i=this;new Tn(i.manager).load(t,function(n){var o=null;try{o=JSON.parse(n)}catch(e){return void 0!==r&&r(e),void console.error("THREE:ObjectLoader: Can't parse "+t+".",e.message)}var a=o.metadata;if(void 0===a||void 0===a.type||"geometry"===a.type.toLowerCase())return void console.error("THREE.ObjectLoader: Can't load "+t+". Use THREE.JSONLoader instead.");i.parse(o,e)},n,r)},setTexturePath:function(t){this.texturePath=t},setCrossOrigin:function(t){this.crossOrigin=t},parse:function(t,e){var n=this.parseGeometries(t.geometries),r=this.parseImages(t.images,function(){void 0!==e&&e(a)}),i=this.parseTextures(t.textures,r),o=this.parseMaterials(t.materials,i),a=this.parseObject(t.object,n,o);return t.animations&&(a.animations=this.parseAnimations(t.animations)),void 0!==t.images&&0!==t.images.length||void 0!==e&&e(a),a},parseGeometries:function(t){var e={};if(void 0!==t)for(var n=new rr,r=new er,i=0,o=t.length;i0){var i=new Mn(e),o=new Cn(i);o.setCrossOrigin(this.crossOrigin);for(var a=0,s=t.length;a0?new xe(s,u):new Rt(s,u);break;case"LOD":a=new ge;break;case"Line":a=new we(i(e.geometry),o(e.material),e.mode);break;case"LineSegments":a=new Ee(i(e.geometry),o(e.material));break;case"PointCloud":case"Points":a=new Te(i(e.geometry),o(e.material));break;case"Sprite":a=new ve(o(e.material));break;case"Group":a=new Se;break;case"SkinnedMesh":console.warn("THREE.ObjectLoader.parseObject() does not support SkinnedMesh type. Instantiates Object3D instead.");default:a=new lt}if(a.uuid=e.uuid,void 0!==e.name&&(a.name=e.name),void 0!==e.matrix?(t.fromArray(e.matrix),t.decompose(a.position,a.quaternion,a.scale)):(void 0!==e.position&&a.position.fromArray(e.position),void 0!==e.rotation&&a.rotation.fromArray(e.rotation),void 0!==e.quaternion&&a.quaternion.fromArray(e.quaternion),void 0!==e.scale&&a.scale.fromArray(e.scale)),void 0!==e.castShadow&&(a.castShadow=e.castShadow),void 0!==e.receiveShadow&&(a.receiveShadow=e.receiveShadow),e.shadow&&(void 0!==e.shadow.bias&&(a.shadow.bias=e.shadow.bias),void 0!==e.shadow.radius&&(a.shadow.radius=e.shadow.radius),void 0!==e.shadow.mapSize&&a.shadow.mapSize.fromArray(e.shadow.mapSize),void 0!==e.shadow.camera&&(a.shadow.camera=this.parseObject(e.shadow.camera))),void 0!==e.visible&&(a.visible=e.visible),void 0!==e.userData&&(a.userData=e.userData),void 0!==e.children)for(var c in e.children)a.add(this.parseObject(e.children[c],n,r));if("LOD"===e.type)for(var l=e.levels,h=0;h0)){u=i;break}u=i-1}if(i=u,r[i]===n){var c=i/(o-1);return c}var l=r[i],h=r[i+1],p=h-l,f=(n-l)/p,c=(i+f)/(o-1);return c},getTangent:function(t){var e=t-1e-4,n=t+1e-4;e<0&&(e=0),n>1&&(n=1);var r=this.getPoint(e);return this.getPoint(n).clone().sub(r).normalize()},getTangentAt:function(t){var e=this.getUtoTmapping(t);return this.getTangent(e)},computeFrenetFrames:function(t,e){var n,r,i,o=new l,a=[],s=[],u=[],c=new l,p=new h;for(n=0;n<=t;n++)r=n/t,a[n]=this.getTangentAt(r),a[n].normalize();s[0]=new l,u[0]=new l;var f=Number.MAX_VALUE,d=Math.abs(a[0].x),m=Math.abs(a[0].y),v=Math.abs(a[0].z);for(d<=f&&(f=d,o.set(1,0,0)),m<=f&&(f=m,o.set(0,1,0)),v<=f&&o.set(0,0,1),c.crossVectors(a[0],o).normalize(),s[0].crossVectors(a[0],c),u[0].crossVectors(a[0],s[0]),n=1;n<=t;n++)s[n]=s[n-1].clone(),u[n]=u[n-1].clone(),c.crossVectors(a[n-1],a[n]),c.length()>Number.EPSILON&&(c.normalize(),i=Math.acos(fs.clamp(a[n-1].dot(a[n]),-1,1)),s[n].applyMatrix4(p.makeRotationAxis(c,i))),u[n].crossVectors(a[n],s[n]);if(!0===e)for(i=Math.acos(fs.clamp(s[0].dot(s[t]),-1,1)),i/=t,a[0].dot(c.crossVectors(s[0],s[t]))>0&&(i=-i),n=1;n<=t;n++)s[n].applyMatrix4(p.makeRotationAxis(a[n],i*n)),u[n].crossVectors(a[n],s[n]);return{tangents:a,normals:s,binormals:u}}},vr.prototype=Object.create(mr.prototype),vr.prototype.constructor=vr,vr.prototype.isLineCurve=!0,vr.prototype.getPoint=function(t){if(1===t)return this.v2.clone();var e=this.v2.clone().sub(this.v1);return e.multiplyScalar(t).add(this.v1),e},vr.prototype.getPointAt=function(t){return this.getPoint(t)},vr.prototype.getTangent=function(t){return this.v2.clone().sub(this.v1).normalize()},gr.prototype=Object.assign(Object.create(mr.prototype),{constructor:gr,add:function(t){this.curves.push(t)},closePath:function(){var t=this.curves[0].getPoint(0),e=this.curves[this.curves.length-1].getPoint(1);t.equals(e)||this.curves.push(new vr(e,t))},getPoint:function(t){for(var e=t*this.getLength(),n=this.getCurveLengths(),r=0;r=e){var i=n[r]-e,o=this.curves[r],a=o.getLength(),s=0===a?0:1-i/a;return o.getPointAt(s)}r++}return null},getLength:function(){var t=this.getCurveLengths();return t[t.length-1]},updateArcLengths:function(){this.needsUpdate=!0,this.cacheLengths=null,this.getLengths()},getCurveLengths:function(){if(this.cacheLengths&&this.cacheLengths.length===this.curves.length)return this.cacheLengths;for(var t=[],e=0,n=0,r=this.curves.length;n1&&!n[n.length-1].equals(n[0])&&n.push(n[0]),n},createPointsGeometry:function(t){var e=this.getPoints(t);return this.createGeometry(e)},createSpacedPointsGeometry:function(t){var e=this.getSpacedPoints(t);return this.createGeometry(e)},createGeometry:function(t){for(var e=new Ct,n=0,r=t.length;ne;)n-=e;ne.length-2?e.length-1:r+1],c=e[r>e.length-3?e.length-1:r+2];return new i(or(o,a.x,s.x,u.x,c.x),or(o,a.y,s.y,u.y,c.y))},xr.prototype=Object.create(mr.prototype),xr.prototype.constructor=xr,xr.prototype.getPoint=function(t){var e=this.v0,n=this.v1,r=this.v2,o=this.v3;return new i(dr(t,e.x,n.x,r.x,o.x),dr(t,e.y,n.y,r.y,o.y))},_r.prototype=Object.create(mr.prototype),_r.prototype.constructor=_r,_r.prototype.getPoint=function(t){var e=this.v0,n=this.v1,r=this.v2;return new i(cr(t,e.x,n.x,r.x),cr(t,e.y,n.y,r.y))};var ks=Object.assign(Object.create(gr.prototype),{fromPoints:function(t){this.moveTo(t[0].x,t[0].y);for(var e=1,n=t.length;e0){var c=u.getPoint(0);c.equals(this.currentPoint)||this.lineTo(c.x,c.y)}this.curves.push(u);var l=u.getPoint(1);this.currentPoint.copy(l)}});wr.prototype=ks,ks.constructor=wr,Er.prototype=Object.assign(Object.create(ks),{constructor:Er,getPointsHoles:function(t){for(var e=[],n=0,r=this.holes.length;n1){for(var g=!1,y=[],b=0,x=p.length;bNumber.EPSILON){if(c<0&&(a=e[o],u=-u,s=e[i],c=-c),t.ys.y)continue;if(t.y===a.y){if(t.x===a.x)return!0}else{var l=c*(t.x-a.x)-u*(t.y-a.y);if(0===l)return!0;if(l<0)continue;r=!r}}else{if(t.y!==a.y)continue;if(s.x<=t.x&&t.x<=a.x||a.x<=t.x&&t.x<=s.x)return!0}}return r})(E.p,p[T].p)&&(b!==T&&y.push({froms:b,tos:T,hole:w}),M?(M=!1,h[T].push(E)):g=!0);M&&h[b].push(E)}y.length>0&&(g||(f=h))}for(var S,m=0,A=p.length;m0){this.source.connect(this.filters[0]);for(var t=1,e=this.filters.length;t0){this.source.disconnect(this.filters[0]);for(var t=1,e=this.filters.length;t=.5)for(var o=0;o!==i;++o)t[e+o]=t[n+o]},_slerp:function(t,e,n,r,i){c.slerpFlat(t,e,t,e,t,n,r)},_lerp:function(t,e,n,r,i){for(var o=1-r,a=0;a!==i;++a){var s=e+a;t[s]=t[s]*o+t[n+a]*r}}},kr.prototype={constructor:kr,getValue:function(t,e){this.bind(),this.getValue(t,e)},setValue:function(t,e){this.bind(),this.setValue(t,e)},bind:function(){var t=this.node,e=this.parsedPath,n=e.objectName,r=e.propertyName,i=e.propertyIndex;if(t||(t=kr.findNode(this.rootNode,e.nodeName)||this.rootNode,this.node=t),this.getValue=this._getValue_unavailable,this.setValue=this._setValue_unavailable,!t)return void console.error(" trying to update node for track: "+this.path+" but it wasn't found.");if(n){var o=e.objectIndex;switch(n){case"materials":if(!t.material)return void console.error(" can not bind to material as node does not have a material",this);if(!t.material.materials)return void console.error(" can not bind to material.materials as node.material does not have a materials array",this);t=t.material.materials;break;case"bones":if(!t.skeleton)return void console.error(" can not bind to bones as node does not have a skeleton",this);t=t.skeleton.bones;for(var a=0;a=n){var h=n++,p=e[h];r[p.uuid]=l,e[l]=p,r[c]=h,e[h]=u;for(var f=0,d=o;f!==d;++f){var m=i[f],v=m[h],g=m[l];m[l]=v,m[h]=g}}}this.nCachedObjects_=n},uncache:function(t){for(var e=this._objects,n=e.length,r=this.nCachedObjects_,i=this._indicesByUUID,o=this._bindings,a=o.length,s=0,u=arguments.length;s!==u;++s){var c=arguments[s],l=c.uuid,h=i[l];if(void 0!==h)if(delete i[l],h0)for(var u=this._interpolants,c=this._propertyBindings,l=0,h=u.length;l!==h;++l)u[l].evaluate(a),c[l].accumulate(r,s)},_updateWeight:function(t){var e=0;if(this.enabled){e=this.weight;var n=this._weightInterpolant;if(null!==n){var r=n.evaluate(t)[0];e*=r,t>n.parameterPositions[1]&&(this.stopFading(),0===r&&(this.enabled=!1))}}return this._effectiveWeight=e,e},_updateTimeScale:function(t){var e=0;if(!this.paused){e=this.timeScale;var n=this._timeScaleInterpolant;if(null!==n){e*=n.evaluate(t)[0],t>n.parameterPositions[1]&&(this.stopWarping(),0===e?this.paused=!0:this.timeScale=e)}}return this._effectiveTimeScale=e,e},_updateTime:function(t){var e=this.time+t;if(0===t)return e;var n=this._clip.duration,r=this.loop,i=this._loopCount;if(r===Wa){-1===i&&(this._loopCount=0,this._setEndings(!0,!0,!1));t:{if(e>=n)e=n;else{if(!(e<0))break t;e=0}this.clampWhenFinished?this.paused=!0:this.enabled=!1,this._mixer.dispatchEvent({type:"finished",action:this,direction:t<0?-1:1})}}else{var o=r===qa;if(-1===i&&(t>=0?(i=0,this._setEndings(!0,0===this.repetitions,o)):this._setEndings(0===this.repetitions,!0,o)),e>=n||e<0){var a=Math.floor(e/n);e-=n*a,i+=Math.abs(a);var s=this.repetitions-i;if(s<0)this.clampWhenFinished?this.paused=!0:this.enabled=!1,e=t>0?n:0,this._mixer.dispatchEvent({type:"finished",action:this,direction:t>0?1:-1});else{if(0===s){var u=t<0;this._setEndings(u,!u,o)}else this._setEndings(!1,!1,o);this._loopCount=i,this._mixer.dispatchEvent({type:"loop",action:this,loopDelta:a})}}if(o&&1==(1&i))return this.time=e,n-e}return this.time=e,e},_setEndings:function(t,e,n){var r=this._interpolantSettings;n?(r.endingStart=Ja,r.endingEnd=Ja):(r.endingStart=t?this.zeroSlopeAtStart?Ja:$a:Qa,r.endingEnd=e?this.zeroSlopeAtEnd?Ja:$a:Qa)},_scheduleFading:function(t,e,n){var r=this._mixer,i=r.time,o=this._weightInterpolant;null===o&&(o=r._lendControlInterpolant(),this._weightInterpolant=o);var a=o.parameterPositions,s=o.sampleValues;return a[0]=i,s[0]=e,a[1]=i+t,s[1]=n,this}},jr.prototype={constructor:jr,clipAction:function(t,e){var n=e||this._root,r=n.uuid,i="string"==typeof t?Qn.findByName(n,t):t,o=null!==i?i.uuid:t,a=this._actionsByClip[o],s=null;if(void 0!==a){var u=a.actionByRoot[r];if(void 0!==u)return u;s=a.knownActions[0],null===i&&(i=s._clip)}if(null===i)return null;var c=new Fr(this,i,e);return this._bindAction(c,s),this._addInactiveAction(c,o,r),c},existingAction:function(t,e){var n=e||this._root,r=n.uuid,i="string"==typeof t?Qn.findByName(n,t):t,o=i?i.uuid:t,a=this._actionsByClip[o];return void 0!==a?a.actionByRoot[r]||null:null},stopAllAction:function(){var t=this._actions,e=this._nActiveActions,n=this._bindings,r=this._nActiveBindings;this._nActiveActions=0,this._nActiveBindings=0;for(var i=0;i!==e;++i)t[i].reset();for(var i=0;i!==r;++i)n[i].useCount=0;return this},update:function(t){t*=this.timeScale;for(var e=this._actions,n=this._nActiveActions,r=this.time+=t,i=Math.sign(t),o=this._accuIndex^=1,a=0;a!==n;++a){var s=e[a];s.enabled&&s._update(r,t,i,o)}for(var u=this._bindings,c=this._nActiveBindings,a=0;a!==c;++a)u[a].apply(o);return this},getRoot:function(){return this._root},uncacheClip:function(t){var e=this._actions,n=t.uuid,r=this._actionsByClip,i=r[n];if(void 0!==i){for(var o=i.knownActions,a=0,s=o.length;a!==s;++a){var u=o[a];this._deactivateAction(u);var c=u._cacheIndex,l=e[e.length-1];u._cacheIndex=null,u._byClipCacheIndex=null,l._cacheIndex=c,e[c]=l,e.pop(),this._removeInactiveBindingsForAction(u)}delete r[n]}},uncacheRoot:function(t){var e=t.uuid,n=this._actionsByClip;for(var r in n){var i=n[r].actionByRoot,o=i[e];void 0!==o&&(this._deactivateAction(o),this._removeInactiveAction(o))}var a=this._bindingsByRootAndName,s=a[e];if(void 0!==s)for(var u in s){var c=s[u];c.restoreOriginalState(),this._removeInactiveBinding(c)}},uncacheAction:function(t,e){var n=this.existingAction(t,e);null!==n&&(this._deactivateAction(n),this._removeInactiveAction(n))}},Object.assign(jr.prototype,{_bindAction:function(t,e){var n=t._localRoot||this._root,r=t._clip.tracks,i=r.length,o=t._propertyBindings,a=t._interpolants,s=n.uuid,u=this._bindingsByRootAndName,c=u[s];void 0===c&&(c={},u[s]=c);for(var l=0;l!==i;++l){var h=r[l],p=h.name,f=c[p];if(void 0!==f)o[l]=f;else{if(void 0!==(f=o[l])){null===f._cacheIndex&&(++f.referenceCount,this._addInactiveBinding(f,s,p));continue}var d=e&&e._propertyBindings[l].binding.parsedPath;f=new Dr(kr.create(n,p,d),h.ValueTypeName,h.getValueSize()),++f.referenceCount,this._addInactiveBinding(f,s,p),o[l]=f}a[l].resultBuffer=f.buffer}},_activateAction:function(t){if(!this._isActiveAction(t)){if(null===t._cacheIndex){var e=(t._localRoot||this._root).uuid,n=t._clip.uuid,r=this._actionsByClip[n];this._bindAction(t,r&&r.knownActions[0]),this._addInactiveAction(t,n,e)}for(var i=t._propertyBindings,o=0,a=i.length;o!==a;++o){var s=i[o];0==s.useCount++&&(this._lendBinding(s),s.saveOriginalState())}this._lendAction(t)}},_deactivateAction:function(t){if(this._isActiveAction(t)){for(var e=t._propertyBindings,n=0,r=e.length;n!==r;++n){var i=e[n];0==--i.useCount&&(i.restoreOriginalState(),this._takeBackBinding(i))}this._takeBackAction(t)}},_initMemoryManager:function(){this._actions=[],this._nActiveActions=0,this._actionsByClip={},this._bindings=[],this._nActiveBindings=0,this._bindingsByRootAndName={},this._controlInterpolants=[],this._nActiveControlInterpolants=0;var t=this;this.stats={actions:{get total(){return t._actions.length},get inUse(){return t._nActiveActions}},bindings:{get total(){return t._bindings.length},get inUse(){return t._nActiveBindings}},controlInterpolants:{get total(){return t._controlInterpolants.length},get inUse(){return t._nActiveControlInterpolants}}}},_isActiveAction:function(t){var e=t._cacheIndex;return null!==e&&e1){var c=u[1];r[c]||(r[c]={start:1/0,end:-1/0});var l=r[c];ol.end&&(l.end=o),e||(e=c)}}for(var c in r){var l=r[c];this.createAnimation(c,l.start,l.end,t)}this.firstAnimation=e},Jr.prototype.setAnimationDirectionForward=function(t){var e=this.animationsMap[t];e&&(e.direction=1,e.directionBackwards=!1)},Jr.prototype.setAnimationDirectionBackward=function(t){var e=this.animationsMap[t];e&&(e.direction=-1,e.directionBackwards=!0)},Jr.prototype.setAnimationFPS=function(t,e){var n=this.animationsMap[t];n&&(n.fps=e,n.duration=(n.end-n.start)/n.fps)},Jr.prototype.setAnimationDuration=function(t,e){var n=this.animationsMap[t];n&&(n.duration=e,n.fps=(n.end-n.start)/n.duration)},Jr.prototype.setAnimationWeight=function(t,e){var n=this.animationsMap[t];n&&(n.weight=e)},Jr.prototype.setAnimationTime=function(t,e){var n=this.animationsMap[t];n&&(n.time=e)},Jr.prototype.getAnimationTime=function(t){var e=0,n=this.animationsMap[t];return n&&(e=n.time),e},Jr.prototype.getAnimationDuration=function(t){var e=-1,n=this.animationsMap[t];return n&&(e=n.duration),e},Jr.prototype.playAnimation=function(t){var e=this.animationsMap[t];e?(e.time=0,e.active=!0):console.warn("THREE.MorphBlendMesh: animation["+t+"] undefined in .playAnimation()")},Jr.prototype.stopAnimation=function(t){var e=this.animationsMap[t];e&&(e.active=!1)},Jr.prototype.update=function(t){for(var e=0,n=this.animationsList.length;er.duration||r.time<0)&&(r.direction*=-1,r.time>r.duration&&(r.time=r.duration,r.directionBackwards=!0),r.time<0&&(r.time=0,r.directionBackwards=!1)):(r.time=r.time%r.duration,r.time<0&&(r.time+=r.duration));var o=r.start+fs.clamp(Math.floor(r.time/i),0,r.length-1),a=r.weight;o!==r.currentFrame&&(this.morphTargetInfluences[r.lastFrame]=0,this.morphTargetInfluences[r.currentFrame]=1*a,this.morphTargetInfluences[o]=0,r.lastFrame=r.currentFrame,r.currentFrame=o);var s=r.time%i/i;r.directionBackwards&&(s=1-s),r.currentFrame!==r.lastFrame?(this.morphTargetInfluences[r.currentFrame]=s*a,this.morphTargetInfluences[r.lastFrame]=(1-s)*a):this.morphTargetInfluences[r.currentFrame]=a}}},Qr.prototype=Object.create(lt.prototype),Qr.prototype.constructor=Qr,Qr.prototype.isImmediateRenderObject=!0,ti.prototype=Object.create(Ee.prototype),ti.prototype.constructor=ti,ti.prototype.update=function(){var t=new l,e=new l,n=new rt;return function(){var r=["a","b","c"];this.object.updateMatrixWorld(!0),n.getNormalMatrix(this.object.matrixWorld);var i=this.object.matrixWorld,o=this.geometry.attributes.position,a=this.object.geometry;if(a&&a.isGeometry)for(var s=a.vertices,u=a.faces,c=0,l=0,h=u.length;l.99999?this.quaternion.set(0,0,0,1):n.y<-.99999?this.quaternion.set(1,0,0,0):(e.set(n.z,0,-n.x).normalize(),t=Math.acos(n.y),this.quaternion.setFromAxisAngle(e,t))}}(),pi.prototype.setLength=function(t,e,n){void 0===e&&(e=.2*t),void 0===n&&(n=.2*e),this.line.scale.set(1,Math.max(0,t-e),1),this.line.updateMatrix(),this.cone.scale.set(n,e,n),this.cone.position.y=t,this.cone.updateMatrix()},pi.prototype.setColor=function(t){this.line.material.color.copy(t),this.cone.material.color.copy(t)},fi.prototype=Object.create(Ee.prototype),fi.prototype.constructor=fi;var zs=new l,Vs=new di,Hs=new di,Gs=new di;mi.prototype=Object.create(mr.prototype),mi.prototype.constructor=mi,mi.prototype.getPoint=function(t){var e=this.points,n=e.length;n<2&&console.log("duh, you need at least 2 points");var r=(n-(this.closed?0:1))*t,i=Math.floor(r),o=r-i;this.closed?i+=i>0?0:(Math.floor(Math.abs(i)/e.length)+1)*e.length:0===o&&i===n-1&&(i=n-2,o=1);var a,s,u,c;if(this.closed||i>0?a=e[(i-1)%n]:(zs.subVectors(e[0],e[1]).add(e[0]),a=zs),s=e[i%n],u=e[(i+1)%n],this.closed||i+26?s-6:0),c=6;c>",a=a||r,null==n[r]){if(e){var s=null===n[r]?"null":"undefined";return new Error("The "+o+" `"+a+"` is marked as required in `"+i+"`, but its value is `"+s+"`.")}return null}return t.apply(void 0,[n,r,i,o,a].concat(u))})}var n=e.bind(null,!1);return n.isRequired=e.bind(null,!0),n}function i(t,e){return"symbol"===t||("Symbol"===e["@@toStringTag"]||"function"==typeof Symbol&&e instanceof Symbol)}function o(t){var e=void 0===t?"undefined":c(t);return Array.isArray(t)?"array":t instanceof RegExp?"object":i(e,t)?"symbol":e}function a(t){var e=o(t);if("object"===e){if(t instanceof Date)return"date";if(t instanceof RegExp)return"regexp"}return e}function s(t,e){return r(function(n,r,i,s,u){return(0,l.untracked)(function(){if(t&&o(n[r])===e.toLowerCase())return null;var s=void 0;switch(e){case"Array":s=l.isObservableArray;break;case"Object":s=l.isObservableObject;break;case"Map":s=l.isObservableMap;break;default:throw new Error("Unexpected mobxType: "+e)}var c=n[r];if(!s(c)){var h=a(c),p=t?" or javascript `"+e.toLowerCase()+"`":"";return new Error("Invalid prop `"+u+"` of type `"+h+"` supplied to `"+i+"`, expected `mobx.Observable"+e+"`"+p+".")}return null})})}function u(t,e){return r(function(n,r,i,o,a){for(var u=arguments.length,c=Array(u>5?u-5:0),h=5;h2&&void 0!==arguments[2]&&arguments[2],r=t[e],i=O[e],o=r?!0===n?function(){i.apply(this,arguments),r.apply(this,arguments)}:function(){r.apply(this,arguments),i.apply(this,arguments)}:i;t[e]=o}function p(t,e){if(null==t||null==e||"object"!==(void 0===t?"undefined":v(t))||"object"!==(void 0===e?"undefined":v(e)))return t!==e;var n=Object.keys(t);if(n.length!==Object.keys(e).length)return!0;for(var r=void 0,i=n.length-1;r=n[i];i--)if(e[r]!==t[r])return!0;return!1}function f(t,e){if("string"==typeof t)throw new Error("Store names should be provided as array");if(Array.isArray(t))return P||(P=!0,console.warn('Mobx observer: Using observer to inject stores is deprecated since 4.0. Use `@inject("store1", "store2") @observer ComponentClass` or `inject("store1", "store2")(observer(componentClass))` instead of `@observer(["store1", "store2"]) ComponentClass`')),e?S.default.apply(null,t)(f(e)):function(e){return f(t,e)};var n=t;if(!0===n.isMobxInjector&&console.warn("Mobx observer: You are trying to use 'observer' on a component that already has 'inject'. Please apply 'observer' before applying 'inject'"),!("function"!=typeof n||n.prototype&&n.prototype.render||n.isReactClass||b.default.Component.isPrototypeOf(n))){var r,s;return f((s=r=function(t){function e(){return i(this,e),o(this,(e.__proto__||Object.getPrototypeOf(e)).apply(this,arguments))}return a(e,t),m(e,[{key:"render",value:function(){return n.call(this,this.props,this.context)}}]),e}(y.Component),r.displayName=n.displayName||n.name,r.contextTypes=n.contextTypes,r.propTypes=n.propTypes,r.defaultProps=n.defaultProps,s))}if(!n)throw new Error("Please pass a valid component to 'observer'");return d(n.prototype||n),n.isMobXReactObserver=!0,n}function d(t){h(t,"componentWillMount",!0),["componentDidMount","componentWillUnmount","componentDidUpdate"].forEach(function(e){h(t,e)}),t.shouldComponentUpdate||(t.shouldComponentUpdate=O.shouldComponentUpdate)}Object.defineProperty(e,"__esModule",{value:!0}),e.Observer=e.renderReporter=e.componentByNodeRegistery=void 0;var m=function(){function t(t,e){for(var n=0;n",r=this._reactInternalInstance&&this._reactInternalInstance._rootNodeID,i=!1,o=!1;t.call(this,"props"),t.call(this,"state");var a=this.render.bind(this),s=null,u=!1,c=function(){return s=new g.Reaction(n+"#"+r+".render()",function(){if(!u&&(u=!0,"function"==typeof e.componentWillReact&&e.componentWillReact(),!0!==e.__$mobxIsUnmounted)){var t=!0;try{o=!0,i||b.default.Component.prototype.forceUpdate.call(e),t=!1}finally{o=!1,t&&s.dispose()}}}),l.$mobx=s,e.render=l,l()},l=function(){u=!1;var t=void 0,n=void 0;if(s.track(function(){A&&(e.__$mobRenderStart=Date.now());try{n=g.extras.allowStateChanges(!1,a)}catch(e){t=e}A&&(e.__$mobRenderEnd=Date.now())}),t)throw t;return n};this.render=c}},componentWillUnmount:function(){if(!0!==C&&(this.render.$mobx&&this.render.$mobx.dispose(),this.__$mobxIsUnmounted=!0,A)){var t=s(this);t&&R&&R.delete(t),L.emit({event:"destroy",component:this,node:t})}},componentDidMount:function(){A&&u(this)},componentDidUpdate:function(){A&&u(this)},shouldComponentUpdate:function(t,e){return C&&console.warn("[mobx-react] It seems that a re-rendering of a React component is triggered while in static (server-side) mode. Please make sure components are rendered only once server-side."),this.state!==e||p(this.props,t)}};(e.Observer=f(function(t){return(0,t.children)()})).propTypes={children:function(t,e,n,r,i){if("function"!=typeof t[e])return new Error("Invalid prop `"+i+"` of type `"+v(t[e])+"` supplied to `"+n+"`, expected `function`.")}}},function(t,e){t.exports=n},function(t,e,n){"use strict";function r(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function i(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function o(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}Object.defineProperty(e,"__esModule",{value:!0}),e.default=void 0;var a,s,u=function(){function t(t,e){for(var n=0;n3&&void 0!==arguments[3]?arguments[3]:0,i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0,o=arguments.length>5&&void 0!==arguments[5]?arguments[5]:0,a=new m.MeshBasicMaterial({map:M.load(t),transparent:!0,depthWrite:!1}),s=new m.Mesh(new m.PlaneGeometry(e,n),a);return s.position.set(r,i,o),s.overdraw=!0,s}function a(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:16711680,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1,r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:4,o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:2,a=arguments.length>5&&void 0!==arguments[5]?arguments[5]:0,s=!(arguments.length>6&&void 0!==arguments[6])||arguments[6],u=new m.Path,c=u.createGeometry(t);c.computeLineDistances();var l=new m.LineDashedMaterial({color:e,dashSize:r,linewidth:n,gapSize:o}),h=new m.Line(c,l);return i(h,a),h.matrixAutoUpdate=s,s||h.updateMatrix(),h}function s(t,e){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:32,r=new m.CircleGeometry(t,n);return new m.Mesh(r,e)}function u(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:.5,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:16777215,r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:1,o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0,a=w(t.map(function(t){return[t.x,t.y]})),s=new m.ShaderMaterial(E({side:m.DoubleSide,diffuse:n,thickness:e,opacity:r,transparent:!0})),u=new m.Mesh(a,s);return i(u,o),u}function c(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:16711680,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1,r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0,o=!(arguments.length>4&&void 0!==arguments[4])||arguments[4],a=arguments.length>5&&void 0!==arguments[5]&&arguments[5],s=arguments.length>6&&void 0!==arguments[6]?arguments[6]:1,u=new m.Path,c=u.createGeometry(t),l=new m.LineBasicMaterial({color:e,linewidth:n,transparent:a,opacity:s}),h=new m.Line(c,l);return i(h,r),h.matrixAutoUpdate=o,!1===o&&h.updateMatrix(),h}function l(t,e,n){var r=new m.CubeGeometry(t.x,t.y,t.z),i=new m.MeshBasicMaterial({color:e}),o=new m.Mesh(r,i),a=new m.BoxHelper(o);return a.material.color=new m.Color(e),a.material.linewidth=n,a}function h(t,e,n,r,i){var o=new m.Vector3(0,t,0);return c([new m.Vector3(0,0,0),o,new m.Vector3(r/2,t-n,0),o,new m.Vector3(-r/2,t-n,0)],i,e,1)}function p(t){var e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n=new m.Shape;if(e){n.moveTo(t[0].x,t[0].y);for(var r=1;r1&&void 0!==arguments[1]?arguments[1]:new m.MeshBasicMaterial({color:16711680}),n=arguments.length>2&&void 0!==arguments[2]&&arguments[2],r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0,o=!(arguments.length>4&&void 0!==arguments[4])||arguments[4],a=p(t,n),s=new m.Mesh(a,e);return i(s,r),s.matrixAutoUpdate=o,!1===o&&s.updateMatrix(),s}Object.defineProperty(e,"__esModule",{value:!0}),e.addOffsetZ=i,e.drawImage=o,e.drawDashedLineFromPoints=a,e.drawCircle=s,e.drawThickBandFromPoints=u,e.drawSegmentsFromPoints=c,e.drawBox=l,e.drawArrow=h,e.getShapeGeometryFromPoints=p,e.drawShapeFromPoints=f;var d=n(8),m=function(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e.default=t,e}(d),v=n(336),g=r(v),y=n(337),b=r(y),x=n(35),_=.04,w=(0,g.default)(m),E=(0,b.default)(m),M=new m.TextureLoader},function(t,e,n){t.exports=!n(31)(function(){return 7!=Object.defineProperty({},"a",{get:function(){return 7}}).a})},function(t,e){var n={}.hasOwnProperty;t.exports=function(t,e){return n.call(t,e)}},function(t,e,n){var r=n(46),i=n(108),o=n(78),a=Object.defineProperty;e.f=n(26)?Object.defineProperty:function(t,e,n){if(r(t),e=o(e,!0),r(n),i)try{return a(t,e,n)}catch(t){}if("get"in n||"set"in n)throw TypeError("Accessors not supported!");return"value"in n&&(t[e]=n.value),t}},function(t,e,n){"use strict";var r=n(4),i=(n(0),function(t){var e=this;if(e.instancePool.length){var n=e.instancePool.pop();return e.call(n,t),n}return new e(t)}),o=function(t,e){var n=this;if(n.instancePool.length){var r=n.instancePool.pop();return n.call(r,t,e),r}return new n(t,e)},a=function(t,e,n){var r=this;if(r.instancePool.length){var i=r.instancePool.pop();return r.call(i,t,e,n),i}return new r(t,e,n)},s=function(t,e,n,r){var i=this;if(i.instancePool.length){var o=i.instancePool.pop();return i.call(o,t,e,n,r),o}return new i(t,e,n,r)},u=function(t){var e=this;t instanceof e||r("25"),t.destructor(),e.instancePool.length-1}function d(t,e,n){for(var r=-1,i=null==t?0:t.length;++r-1;);return n}function j(t,e){for(var n=t.length;n--&&M(e,t[n],0)>-1;);return n}function B(t,e){for(var n=t.length,r=0;n--;)t[n]===e&&++r;return r}function z(t){return"\\"+Cn[t]}function V(t,e){return null==t?it:t[e]}function H(t){return bn.test(t)}function G(t){return xn.test(t)}function W(t){for(var e,n=[];!(e=t.next()).done;)n.push(e.value);return n}function X(t){var e=-1,n=Array(t.size);return t.forEach(function(t,r){n[++e]=[r,t]}),n}function q(t,e){return function(n){return t(e(n))}}function Y(t,e){for(var n=-1,r=t.length,i=0,o=[];++n>>1,jt=[["ary",Et],["bind",vt],["bindKey",gt],["curry",bt],["curryRight",xt],["flip",Tt],["partial",_t],["partialRight",wt],["rearg",Mt]],Bt="[object Arguments]",zt="[object Array]",Vt="[object AsyncFunction]",Ht="[object Boolean]",Gt="[object Date]",Wt="[object DOMException]",Xt="[object Error]",qt="[object Function]",Yt="[object GeneratorFunction]",Zt="[object Map]",Kt="[object Number]",$t="[object Null]",Jt="[object Object]",Qt="[object Proxy]",te="[object RegExp]",ee="[object Set]",ne="[object String]",re="[object Symbol]",ie="[object Undefined]",oe="[object WeakMap]",ae="[object WeakSet]",se="[object ArrayBuffer]",ue="[object DataView]",ce="[object Float32Array]",le="[object Float64Array]",he="[object Int8Array]",pe="[object Int16Array]",fe="[object Int32Array]",de="[object Uint8Array]",me="[object Uint8ClampedArray]",ve="[object Uint16Array]",ge="[object Uint32Array]",ye=/\b__p \+= '';/g,be=/\b(__p \+=) '' \+/g,xe=/(__e\(.*?\)|\b__t\)) \+\n'';/g,_e=/&(?:amp|lt|gt|quot|#39);/g,we=/[&<>"']/g,Ee=RegExp(_e.source),Me=RegExp(we.source),Te=/<%-([\s\S]+?)%>/g,Se=/<%([\s\S]+?)%>/g,Ae=/<%=([\s\S]+?)%>/g,Ce=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,Pe=/^\w*$/,Re=/^\./,Le=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,Oe=/[\\^$.*+?()[\]{}|]/g,Ie=RegExp(Oe.source),Ne=/^\s+|\s+$/g,De=/^\s+/,ke=/\s+$/,Ue=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,Fe=/\{\n\/\* \[wrapped with (.+)\] \*/,je=/,? & /,Be=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g,ze=/\\(\\)?/g,Ve=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,He=/\w*$/,Ge=/^[-+]0x[0-9a-f]+$/i,We=/^0b[01]+$/i,Xe=/^\[object .+?Constructor\]$/,qe=/^0o[0-7]+$/i,Ye=/^(?:0|[1-9]\d*)$/,Ze=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,Ke=/($^)/,$e=/['\n\r\u2028\u2029\\]/g,Je="\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff",Qe="\\xac\\xb1\\xd7\\xf7\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf\\u2000-\\u206f \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000",tn="["+Qe+"]",en="["+Je+"]",nn="[a-z\\xdf-\\xf6\\xf8-\\xff]",rn="[^\\ud800-\\udfff"+Qe+"\\d+\\u2700-\\u27bfa-z\\xdf-\\xf6\\xf8-\\xffA-Z\\xc0-\\xd6\\xd8-\\xde]",on="\\ud83c[\\udffb-\\udfff]",an="(?:\\ud83c[\\udde6-\\uddff]){2}",sn="[\\ud800-\\udbff][\\udc00-\\udfff]",un="[A-Z\\xc0-\\xd6\\xd8-\\xde]",cn="(?:"+nn+"|"+rn+")",ln="(?:[\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff]|\\ud83c[\\udffb-\\udfff])?",hn="(?:\\u200d(?:"+["[^\\ud800-\\udfff]",an,sn].join("|")+")[\\ufe0e\\ufe0f]?"+ln+")*",pn="[\\ufe0e\\ufe0f]?"+ln+hn,fn="(?:"+["[\\u2700-\\u27bf]",an,sn].join("|")+")"+pn,dn="(?:"+["[^\\ud800-\\udfff]"+en+"?",en,an,sn,"[\\ud800-\\udfff]"].join("|")+")",mn=RegExp("['’]","g"),vn=RegExp(en,"g"),gn=RegExp(on+"(?="+on+")|"+dn+pn,"g"),yn=RegExp([un+"?"+nn+"+(?:['’](?:d|ll|m|re|s|t|ve))?(?="+[tn,un,"$"].join("|")+")","(?:[A-Z\\xc0-\\xd6\\xd8-\\xde]|[^\\ud800-\\udfff\\xac\\xb1\\xd7\\xf7\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf\\u2000-\\u206f \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000\\d+\\u2700-\\u27bfa-z\\xdf-\\xf6\\xf8-\\xffA-Z\\xc0-\\xd6\\xd8-\\xde])+(?:['’](?:D|LL|M|RE|S|T|VE))?(?="+[tn,un+cn,"$"].join("|")+")",un+"?"+cn+"+(?:['’](?:d|ll|m|re|s|t|ve))?",un+"+(?:['’](?:D|LL|M|RE|S|T|VE))?","\\d*(?:(?:1ST|2ND|3RD|(?![123])\\dTH)\\b)","\\d*(?:(?:1st|2nd|3rd|(?![123])\\dth)\\b)","\\d+",fn].join("|"),"g"),bn=RegExp("[\\u200d\\ud800-\\udfff"+Je+"\\ufe0e\\ufe0f]"),xn=/[a-z][A-Z]|[A-Z]{2,}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/,_n=["Array","Buffer","DataView","Date","Error","Float32Array","Float64Array","Function","Int8Array","Int16Array","Int32Array","Map","Math","Object","Promise","RegExp","Set","String","Symbol","TypeError","Uint8Array","Uint8ClampedArray","Uint16Array","Uint32Array","WeakMap","_","clearTimeout","isFinite","parseInt","setTimeout"],wn=-1,En={};En[ce]=En[le]=En[he]=En[pe]=En[fe]=En[de]=En[me]=En[ve]=En[ge]=!0,En[Bt]=En[zt]=En[se]=En[Ht]=En[ue]=En[Gt]=En[Xt]=En[qt]=En[Zt]=En[Kt]=En[Jt]=En[te]=En[ee]=En[ne]=En[oe]=!1;var Mn={};Mn[Bt]=Mn[zt]=Mn[se]=Mn[ue]=Mn[Ht]=Mn[Gt]=Mn[ce]=Mn[le]=Mn[he]=Mn[pe]=Mn[fe]=Mn[Zt]=Mn[Kt]=Mn[Jt]=Mn[te]=Mn[ee]=Mn[ne]=Mn[re]=Mn[de]=Mn[me]=Mn[ve]=Mn[ge]=!0,Mn[Xt]=Mn[qt]=Mn[oe]=!1;var Tn={"À":"A","Á":"A","Â":"A","Ã":"A","Ä":"A","Å":"A","à":"a","á":"a","â":"a","ã":"a","ä":"a","å":"a","Ç":"C","ç":"c","Ð":"D","ð":"d","È":"E","É":"E","Ê":"E","Ë":"E","è":"e","é":"e","ê":"e","ë":"e","Ì":"I","Í":"I","Î":"I","Ï":"I","ì":"i","í":"i","î":"i","ï":"i","Ñ":"N","ñ":"n","Ò":"O","Ó":"O","Ô":"O","Õ":"O","Ö":"O","Ø":"O","ò":"o","ó":"o","ô":"o","õ":"o","ö":"o","ø":"o","Ù":"U","Ú":"U","Û":"U","Ü":"U","ù":"u","ú":"u","û":"u","ü":"u","Ý":"Y","ý":"y","ÿ":"y","Æ":"Ae","æ":"ae","Þ":"Th","þ":"th","ß":"ss","Ā":"A","Ă":"A","Ą":"A","ā":"a","ă":"a","ą":"a","Ć":"C","Ĉ":"C","Ċ":"C","Č":"C","ć":"c","ĉ":"c","ċ":"c","č":"c","Ď":"D","Đ":"D","ď":"d","đ":"d","Ē":"E","Ĕ":"E","Ė":"E","Ę":"E","Ě":"E","ē":"e","ĕ":"e","ė":"e","ę":"e","ě":"e","Ĝ":"G","Ğ":"G","Ġ":"G","Ģ":"G","ĝ":"g","ğ":"g","ġ":"g","ģ":"g","Ĥ":"H","Ħ":"H","ĥ":"h","ħ":"h","Ĩ":"I","Ī":"I","Ĭ":"I","Į":"I","İ":"I","ĩ":"i","ī":"i","ĭ":"i","į":"i","ı":"i","Ĵ":"J","ĵ":"j","Ķ":"K","ķ":"k","ĸ":"k","Ĺ":"L","Ļ":"L","Ľ":"L","Ŀ":"L","Ł":"L","ĺ":"l","ļ":"l","ľ":"l","ŀ":"l","ł":"l","Ń":"N","Ņ":"N","Ň":"N","Ŋ":"N","ń":"n","ņ":"n","ň":"n","ŋ":"n","Ō":"O","Ŏ":"O","Ő":"O","ō":"o","ŏ":"o","ő":"o","Ŕ":"R","Ŗ":"R","Ř":"R","ŕ":"r","ŗ":"r","ř":"r","Ś":"S","Ŝ":"S","Ş":"S","Š":"S","ś":"s","ŝ":"s","ş":"s","š":"s","Ţ":"T","Ť":"T","Ŧ":"T","ţ":"t","ť":"t","ŧ":"t","Ũ":"U","Ū":"U","Ŭ":"U","Ů":"U","Ű":"U","Ų":"U","ũ":"u","ū":"u","ŭ":"u","ů":"u","ű":"u","ų":"u","Ŵ":"W","ŵ":"w","Ŷ":"Y","ŷ":"y","Ÿ":"Y","Ź":"Z","Ż":"Z","Ž":"Z","ź":"z","ż":"z","ž":"z","IJ":"IJ","ij":"ij","Œ":"Oe","œ":"oe","ʼn":"'n","ſ":"s"},Sn={"&":"&","<":"<",">":">",'"':""","'":"'"},An={"&":"&","<":"<",">":">",""":'"',"'":"'"},Cn={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"},Pn=parseFloat,Rn=parseInt,Ln="object"==typeof t&&t&&t.Object===Object&&t,On="object"==typeof self&&self&&self.Object===Object&&self,In=Ln||On||Function("return this")(),Nn="object"==typeof e&&e&&!e.nodeType&&e,Dn=Nn&&"object"==typeof r&&r&&!r.nodeType&&r,kn=Dn&&Dn.exports===Nn,Un=kn&&Ln.process,Fn=function(){try{return Un&&Un.binding&&Un.binding("util")}catch(t){}}(),jn=Fn&&Fn.isArrayBuffer,Bn=Fn&&Fn.isDate,zn=Fn&&Fn.isMap,Vn=Fn&&Fn.isRegExp,Hn=Fn&&Fn.isSet,Gn=Fn&&Fn.isTypedArray,Wn=C("length"),Xn=P(Tn),qn=P(Sn),Yn=P(An),Zn=function t(e){function n(t){if(ou(t)&&!vp(t)&&!(t instanceof x)){if(t instanceof i)return t;if(vl.call(t,"__wrapped__"))return na(t)}return new i(t)}function r(){}function i(t,e){this.__wrapped__=t,this.__actions__=[],this.__chain__=!!e,this.__index__=0,this.__values__=it}function x(t){this.__wrapped__=t,this.__actions__=[],this.__dir__=1,this.__filtered__=!1,this.__iteratees__=[],this.__takeCount__=kt,this.__views__=[]}function P(){var t=new x(this.__wrapped__);return t.__actions__=Ui(this.__actions__),t.__dir__=this.__dir__,t.__filtered__=this.__filtered__,t.__iteratees__=Ui(this.__iteratees__),t.__takeCount__=this.__takeCount__,t.__views__=Ui(this.__views__),t}function $(){if(this.__filtered__){var t=new x(this);t.__dir__=-1,t.__filtered__=!0}else t=this.clone(),t.__dir__*=-1;return t}function et(){var t=this.__wrapped__.value(),e=this.__dir__,n=vp(t),r=e<0,i=n?t.length:0,o=Ao(0,i,this.__views__),a=o.start,s=o.end,u=s-a,c=r?s:a-1,l=this.__iteratees__,h=l.length,p=0,f=Xl(u,this.__takeCount__);if(!n||!r&&i==u&&f==u)return yi(t,this.__actions__);var d=[];t:for(;u--&&p-1}function un(t,e){var n=this.__data__,r=Kn(n,t);return r<0?(++this.size,n.push([t,e])):n[r][1]=e,this}function cn(t){var e=-1,n=null==t?0:t.length;for(this.clear();++e=e?t:e)),t}function rr(t,e,n,r,i,o){var a,s=e&ht,u=e&pt,l=e&ft;if(n&&(a=i?n(t,r,i,o):n(t)),a!==it)return a;if(!iu(t))return t;var h=vp(t);if(h){if(a=Ro(t),!s)return Ui(t,a)}else{var p=Sh(t),f=p==qt||p==Yt;if(yp(t))return Ti(t,s);if(p==Jt||p==Bt||f&&!i){if(a=u||f?{}:Lo(t),!s)return u?Bi(t,Qn(a,t)):ji(t,Jn(a,t))}else{if(!Mn[p])return i?t:{};a=Oo(t,p,rr,s)}}o||(o=new xn);var d=o.get(t);if(d)return d;o.set(t,a);var m=l?u?bo:yo:u?zu:Bu,v=h?it:m(t);return c(v||t,function(r,i){v&&(i=r,r=t[i]),Wn(a,i,rr(r,e,n,i,t,o))}),a}function ir(t){var e=Bu(t);return function(n){return or(n,t,e)}}function or(t,e,n){var r=n.length;if(null==t)return!r;for(t=sl(t);r--;){var i=n[r],o=e[i],a=t[i];if(a===it&&!(i in t)||!o(a))return!1}return!0}function ar(t,e,n){if("function"!=typeof t)throw new ll(st);return Ph(function(){t.apply(it,n)},e)}function sr(t,e,n,r){var i=-1,o=f,a=!0,s=t.length,u=[],c=e.length;if(!s)return u;n&&(e=m(e,D(n))),r?(o=d,a=!1):e.length>=ot&&(o=U,a=!1,e=new gn(e));t:for(;++ii?0:i+n),r=r===it||r>i?i:wu(r),r<0&&(r+=i),r=n>r?0:Eu(r);n0&&n(s)?e>1?pr(s,e-1,n,r,i):v(i,s):r||(i[i.length]=s)}return i}function fr(t,e){return t&&vh(t,e,Bu)}function dr(t,e){return t&&gh(t,e,Bu)}function mr(t,e){return p(e,function(e){return eu(t[e])})}function vr(t,e){e=Ei(e,t);for(var n=0,r=e.length;null!=t&&ne}function xr(t,e){return null!=t&&vl.call(t,e)}function _r(t,e){return null!=t&&e in sl(t)}function wr(t,e,n){return t>=Xl(e,n)&&t=120&&l.length>=120)?new gn(a&&l):it}l=t[0];var h=-1,p=s[0];t:for(;++h-1;)s!==t&&Rl.call(s,u,1),Rl.call(t,u,1);return t}function Jr(t,e){for(var n=t?e.length:0,r=n-1;n--;){var i=e[n];if(n==r||i!==o){var o=i;Do(i)?Rl.call(t,i,1):mi(t,i)}}return t}function Qr(t,e){return t+jl(Zl()*(e-t+1))}function ti(t,e,n,r){for(var i=-1,o=Wl(Fl((e-t)/(n||1)),0),a=nl(o);o--;)a[r?o:++i]=t,t+=n;return a}function ei(t,e){var n="";if(!t||e<1||e>It)return n;do{e%2&&(n+=t),(e=jl(e/2))&&(t+=t)}while(e);return n}function ni(t,e){return Rh(qo(t,e,Rc),t+"")}function ri(t){return Nn(Qu(t))}function ii(t,e){var n=Qu(t);return Jo(n,nr(e,0,n.length))}function oi(t,e,n,r){if(!iu(t))return t;e=Ei(e,t);for(var i=-1,o=e.length,a=o-1,s=t;null!=s&&++ii?0:i+e),n=n>i?i:n,n<0&&(n+=i),i=e>n?0:n-e>>>0,e>>>=0;for(var o=nl(i);++r>>1,a=t[o];null!==a&&!vu(a)&&(n?a<=e:a=ot){var c=e?null:wh(t);if(c)return Z(c);a=!1,i=U,u=new gn}else u=e?[]:s;t:for(;++r=r?t:si(t,e,n)}function Ti(t,e){if(e)return t.slice();var n=t.length,r=Sl?Sl(n):new t.constructor(n);return t.copy(r),r}function Si(t){var e=new t.constructor(t.byteLength);return new Tl(e).set(new Tl(t)),e}function Ai(t,e){var n=e?Si(t.buffer):t.buffer;return new t.constructor(n,t.byteOffset,t.byteLength)}function Ci(t,e,n){return g(e?n(X(t),ht):X(t),o,new t.constructor)}function Pi(t){var e=new t.constructor(t.source,He.exec(t));return e.lastIndex=t.lastIndex,e}function Ri(t,e,n){return g(e?n(Z(t),ht):Z(t),a,new t.constructor)}function Li(t){return hh?sl(hh.call(t)):{}}function Oi(t,e){var n=e?Si(t.buffer):t.buffer;return new t.constructor(n,t.byteOffset,t.length)}function Ii(t,e){if(t!==e){var n=t!==it,r=null===t,i=t===t,o=vu(t),a=e!==it,s=null===e,u=e===e,c=vu(e);if(!s&&!c&&!o&&t>e||o&&a&&u&&!s&&!c||r&&a&&u||!n&&u||!i)return 1;if(!r&&!o&&!c&&t=s)return u;return u*("desc"==n[r]?-1:1)}}return t.index-e.index}function Di(t,e,n,r){for(var i=-1,o=t.length,a=n.length,s=-1,u=e.length,c=Wl(o-a,0),l=nl(u+c),h=!r;++s1?n[i-1]:it,a=i>2?n[2]:it;for(o=t.length>3&&"function"==typeof o?(i--,o):it,a&&ko(n[0],n[1],a)&&(o=i<3?it:o,i=1),e=sl(e);++r-1?i[o?e[a]:a]:it}}function $i(t){return go(function(e){var n=e.length,r=n,o=i.prototype.thru;for(t&&e.reverse();r--;){var a=e[r];if("function"!=typeof a)throw new ll(st);if(o&&!s&&"wrapper"==xo(a))var s=new i([],!0)}for(r=s?r:n;++r1&&y.reverse(),h&&us))return!1;var c=o.get(t);if(c&&o.get(e))return c==e;var l=-1,h=!0,p=n&mt?new gn:it;for(o.set(t,e),o.set(e,t);++l1?"& ":"")+e[r],e=e.join(n>2?", ":" "),t.replace(Ue,"{\n/* [wrapped with "+e+"] */\n")}function No(t){return vp(t)||mp(t)||!!(Ll&&t&&t[Ll])}function Do(t,e){return!!(e=null==e?It:e)&&("number"==typeof t||Ye.test(t))&&t>-1&&t%1==0&&t0){if(++e>=Ct)return arguments[0]}else e=0;return t.apply(it,arguments)}}function Jo(t,e){var n=-1,r=t.length,i=r-1;for(e=e===it?r:e;++n=this.__values__.length;return{done:t,value:t?it:this.__values__[this.__index__++]}}function ns(){return this}function rs(t){for(var e,n=this;n instanceof r;){var i=na(n);i.__index__=0,i.__values__=it,e?o.__wrapped__=i:e=i;var o=i;n=n.__wrapped__}return o.__wrapped__=t,e}function is(){var t=this.__wrapped__;if(t instanceof x){var e=t;return this.__actions__.length&&(e=new x(this)),e=e.reverse(),e.__actions__.push({func:Ja,args:[Ca],thisArg:it}),new i(e,this.__chain__)}return this.thru(Ca)}function os(){return yi(this.__wrapped__,this.__actions__)}function as(t,e,n){var r=vp(t)?h:ur;return n&&ko(t,e,n)&&(e=it),r(t,wo(e,3))}function ss(t,e){return(vp(t)?p:hr)(t,wo(e,3))}function us(t,e){return pr(ds(t,e),1)}function cs(t,e){return pr(ds(t,e),Ot)}function ls(t,e,n){return n=n===it?1:wu(n),pr(ds(t,e),n)}function hs(t,e){return(vp(t)?c:dh)(t,wo(e,3))}function ps(t,e){return(vp(t)?l:mh)(t,wo(e,3))}function fs(t,e,n,r){t=Xs(t)?t:Qu(t),n=n&&!r?wu(n):0;var i=t.length;return n<0&&(n=Wl(i+n,0)),mu(t)?n<=i&&t.indexOf(e,n)>-1:!!i&&M(t,e,n)>-1}function ds(t,e){return(vp(t)?m:zr)(t,wo(e,3))}function ms(t,e,n,r){return null==t?[]:(vp(e)||(e=null==e?[]:[e]),n=r?it:n,vp(n)||(n=null==n?[]:[n]),qr(t,e,n))}function vs(t,e,n){var r=vp(t)?g:R,i=arguments.length<3;return r(t,wo(e,4),n,i,dh)}function gs(t,e,n){var r=vp(t)?y:R,i=arguments.length<3;return r(t,wo(e,4),n,i,mh)}function ys(t,e){return(vp(t)?p:hr)(t,Os(wo(e,3)))}function bs(t){return(vp(t)?Nn:ri)(t)}function xs(t,e,n){return e=(n?ko(t,e,n):e===it)?1:wu(e),(vp(t)?Dn:ii)(t,e)}function _s(t){return(vp(t)?Un:ai)(t)}function ws(t){if(null==t)return 0;if(Xs(t))return mu(t)?Q(t):t.length;var e=Sh(t);return e==Zt||e==ee?t.size:Fr(t).length}function Es(t,e,n){var r=vp(t)?b:ui;return n&&ko(t,e,n)&&(e=it),r(t,wo(e,3))}function Ms(t,e){if("function"!=typeof e)throw new ll(st);return t=wu(t),function(){if(--t<1)return e.apply(this,arguments)}}function Ts(t,e,n){return e=n?it:e,e=t&&null==e?t.length:e,co(t,Et,it,it,it,it,e)}function Ss(t,e){var n;if("function"!=typeof e)throw new ll(st);return t=wu(t),function(){return--t>0&&(n=e.apply(this,arguments)),t<=1&&(e=it),n}}function As(t,e,n){e=n?it:e;var r=co(t,bt,it,it,it,it,it,e);return r.placeholder=As.placeholder,r}function Cs(t,e,n){e=n?it:e;var r=co(t,xt,it,it,it,it,it,e);return r.placeholder=Cs.placeholder,r}function Ps(t,e,n){function r(e){var n=p,r=f;return p=f=it,y=e,m=t.apply(r,n)}function i(t){return y=t,v=Ph(s,e),b?r(t):m}function o(t){var n=t-g,r=t-y,i=e-n;return x?Xl(i,d-r):i}function a(t){var n=t-g,r=t-y;return g===it||n>=e||n<0||x&&r>=d}function s(){var t=ip();if(a(t))return u(t);v=Ph(s,o(t))}function u(t){return v=it,_&&p?r(t):(p=f=it,m)}function c(){v!==it&&_h(v),y=0,p=g=f=v=it}function l(){return v===it?m:u(ip())}function h(){var t=ip(),n=a(t);if(p=arguments,f=this,g=t,n){if(v===it)return i(g);if(x)return v=Ph(s,e),r(g)}return v===it&&(v=Ph(s,e)),m}var p,f,d,m,v,g,y=0,b=!1,x=!1,_=!0;if("function"!=typeof t)throw new ll(st);return e=Mu(e)||0,iu(n)&&(b=!!n.leading,x="maxWait"in n,d=x?Wl(Mu(n.maxWait)||0,e):d,_="trailing"in n?!!n.trailing:_),h.cancel=c,h.flush=l,h}function Rs(t){return co(t,Tt)}function Ls(t,e){if("function"!=typeof t||null!=e&&"function"!=typeof e)throw new ll(st);var n=function(){var r=arguments,i=e?e.apply(this,r):r[0],o=n.cache;if(o.has(i))return o.get(i);var a=t.apply(this,r);return n.cache=o.set(i,a)||o,a};return n.cache=new(Ls.Cache||cn),n}function Os(t){if("function"!=typeof t)throw new ll(st);return function(){var e=arguments;switch(e.length){case 0:return!t.call(this);case 1:return!t.call(this,e[0]);case 2:return!t.call(this,e[0],e[1]);case 3:return!t.call(this,e[0],e[1],e[2])}return!t.apply(this,e)}}function Is(t){return Ss(2,t)}function Ns(t,e){if("function"!=typeof t)throw new ll(st);return e=e===it?e:wu(e),ni(t,e)}function Ds(t,e){if("function"!=typeof t)throw new ll(st);return e=null==e?0:Wl(wu(e),0),ni(function(n){var r=n[e],i=Mi(n,0,e);return r&&v(i,r),s(t,this,i)})}function ks(t,e,n){var r=!0,i=!0;if("function"!=typeof t)throw new ll(st);return iu(n)&&(r="leading"in n?!!n.leading:r,i="trailing"in n?!!n.trailing:i),Ps(t,e,{leading:r,maxWait:e,trailing:i})}function Us(t){return Ts(t,1)}function Fs(t,e){return lp(wi(e),t)}function js(){if(!arguments.length)return[];var t=arguments[0];return vp(t)?t:[t]}function Bs(t){return rr(t,ft)}function zs(t,e){return e="function"==typeof e?e:it,rr(t,ft,e)}function Vs(t){return rr(t,ht|ft)}function Hs(t,e){return e="function"==typeof e?e:it,rr(t,ht|ft,e)}function Gs(t,e){return null==e||or(t,e,Bu(e))}function Ws(t,e){return t===e||t!==t&&e!==e}function Xs(t){return null!=t&&ru(t.length)&&!eu(t)}function qs(t){return ou(t)&&Xs(t)}function Ys(t){return!0===t||!1===t||ou(t)&&yr(t)==Ht}function Zs(t){return ou(t)&&1===t.nodeType&&!fu(t)}function Ks(t){if(null==t)return!0;if(Xs(t)&&(vp(t)||"string"==typeof t||"function"==typeof t.splice||yp(t)||Ep(t)||mp(t)))return!t.length;var e=Sh(t);if(e==Zt||e==ee)return!t.size;if(zo(t))return!Fr(t).length;for(var n in t)if(vl.call(t,n))return!1;return!0}function $s(t,e){return Pr(t,e)}function Js(t,e,n){n="function"==typeof n?n:it;var r=n?n(t,e):it;return r===it?Pr(t,e,it,n):!!r}function Qs(t){if(!ou(t))return!1;var e=yr(t);return e==Xt||e==Wt||"string"==typeof t.message&&"string"==typeof t.name&&!fu(t)}function tu(t){return"number"==typeof t&&Vl(t)}function eu(t){if(!iu(t))return!1;var e=yr(t);return e==qt||e==Yt||e==Vt||e==Qt}function nu(t){return"number"==typeof t&&t==wu(t)}function ru(t){return"number"==typeof t&&t>-1&&t%1==0&&t<=It}function iu(t){var e=typeof t;return null!=t&&("object"==e||"function"==e)}function ou(t){return null!=t&&"object"==typeof t}function au(t,e){return t===e||Or(t,e,Mo(e))}function su(t,e,n){return n="function"==typeof n?n:it,Or(t,e,Mo(e),n)}function uu(t){return pu(t)&&t!=+t}function cu(t){if(Ah(t))throw new il(at);return Ir(t)}function lu(t){return null===t}function hu(t){return null==t}function pu(t){return"number"==typeof t||ou(t)&&yr(t)==Kt}function fu(t){if(!ou(t)||yr(t)!=Jt)return!1;var e=Al(t);if(null===e)return!0;var n=vl.call(e,"constructor")&&e.constructor;return"function"==typeof n&&n instanceof n&&ml.call(n)==xl}function du(t){return nu(t)&&t>=-It&&t<=It}function mu(t){return"string"==typeof t||!vp(t)&&ou(t)&&yr(t)==ne}function vu(t){return"symbol"==typeof t||ou(t)&&yr(t)==re}function gu(t){return t===it}function yu(t){return ou(t)&&Sh(t)==oe}function bu(t){return ou(t)&&yr(t)==ae}function xu(t){if(!t)return[];if(Xs(t))return mu(t)?tt(t):Ui(t);if(Ol&&t[Ol])return W(t[Ol]());var e=Sh(t);return(e==Zt?X:e==ee?Z:Qu)(t)}function _u(t){if(!t)return 0===t?t:0;if((t=Mu(t))===Ot||t===-Ot){return(t<0?-1:1)*Nt}return t===t?t:0}function wu(t){var e=_u(t),n=e%1;return e===e?n?e-n:e:0}function Eu(t){return t?nr(wu(t),0,kt):0}function Mu(t){if("number"==typeof t)return t;if(vu(t))return Dt;if(iu(t)){var e="function"==typeof t.valueOf?t.valueOf():t;t=iu(e)?e+"":e}if("string"!=typeof t)return 0===t?t:+t;t=t.replace(Ne,"");var n=We.test(t);return n||qe.test(t)?Rn(t.slice(2),n?2:8):Ge.test(t)?Dt:+t}function Tu(t){return Fi(t,zu(t))}function Su(t){return t?nr(wu(t),-It,It):0===t?t:0}function Au(t){return null==t?"":fi(t)}function Cu(t,e){var n=fh(t);return null==e?n:Jn(n,e)}function Pu(t,e){return w(t,wo(e,3),fr)}function Ru(t,e){return w(t,wo(e,3),dr)}function Lu(t,e){return null==t?t:vh(t,wo(e,3),zu)}function Ou(t,e){return null==t?t:gh(t,wo(e,3),zu)}function Iu(t,e){return t&&fr(t,wo(e,3))}function Nu(t,e){return t&&dr(t,wo(e,3))}function Du(t){return null==t?[]:mr(t,Bu(t))}function ku(t){return null==t?[]:mr(t,zu(t))}function Uu(t,e,n){var r=null==t?it:vr(t,e);return r===it?n:r}function Fu(t,e){return null!=t&&Po(t,e,xr)}function ju(t,e){return null!=t&&Po(t,e,_r)}function Bu(t){return Xs(t)?On(t):Fr(t)}function zu(t){return Xs(t)?On(t,!0):jr(t)}function Vu(t,e){var n={};return e=wo(e,3),fr(t,function(t,r,i){tr(n,e(t,r,i),t)}),n}function Hu(t,e){var n={};return e=wo(e,3),fr(t,function(t,r,i){tr(n,r,e(t,r,i))}),n}function Gu(t,e){return Wu(t,Os(wo(e)))}function Wu(t,e){if(null==t)return{};var n=m(bo(t),function(t){return[t]});return e=wo(e),Zr(t,n,function(t,n){return e(t,n[0])})}function Xu(t,e,n){e=Ei(e,t);var r=-1,i=e.length;for(i||(i=1,t=it);++re){var r=t;t=e,e=r}if(n||t%1||e%1){var i=Zl();return Xl(t+i*(e-t+Pn("1e-"+((i+"").length-1))),e)}return Qr(t,e)}function ic(t){return Zp(Au(t).toLowerCase())}function oc(t){return(t=Au(t))&&t.replace(Ze,Xn).replace(vn,"")}function ac(t,e,n){t=Au(t),e=fi(e);var r=t.length;n=n===it?r:nr(wu(n),0,r);var i=n;return(n-=e.length)>=0&&t.slice(n,i)==e}function sc(t){return t=Au(t),t&&Me.test(t)?t.replace(we,qn):t}function uc(t){return t=Au(t),t&&Ie.test(t)?t.replace(Oe,"\\$&"):t}function cc(t,e,n){t=Au(t),e=wu(e);var r=e?Q(t):0;if(!e||r>=e)return t;var i=(e-r)/2;return no(jl(i),n)+t+no(Fl(i),n)}function lc(t,e,n){t=Au(t),e=wu(e);var r=e?Q(t):0;return e&&r>>0)?(t=Au(t),t&&("string"==typeof e||null!=e&&!_p(e))&&!(e=fi(e))&&H(t)?Mi(tt(t),0,n):t.split(e,n)):[]}function vc(t,e,n){return t=Au(t),n=null==n?0:nr(wu(n),0,t.length),e=fi(e),t.slice(n,n+e.length)==e}function gc(t,e,r){var i=n.templateSettings;r&&ko(t,e,r)&&(e=it),t=Au(t),e=Cp({},e,i,lo);var o,a,s=Cp({},e.imports,i.imports,lo),u=Bu(s),c=k(s,u),l=0,h=e.interpolate||Ke,p="__p += '",f=ul((e.escape||Ke).source+"|"+h.source+"|"+(h===Ae?Ve:Ke).source+"|"+(e.evaluate||Ke).source+"|$","g"),d="//# sourceURL="+("sourceURL"in e?e.sourceURL:"lodash.templateSources["+ ++wn+"]")+"\n";t.replace(f,function(e,n,r,i,s,u){return r||(r=i),p+=t.slice(l,u).replace($e,z),n&&(o=!0,p+="' +\n__e("+n+") +\n'"),s&&(a=!0,p+="';\n"+s+";\n__p += '"),r&&(p+="' +\n((__t = ("+r+")) == null ? '' : __t) +\n'"),l=u+e.length,e}),p+="';\n";var m=e.variable;m||(p="with (obj) {\n"+p+"\n}\n"),p=(a?p.replace(ye,""):p).replace(be,"$1").replace(xe,"$1;"),p="function("+(m||"obj")+") {\n"+(m?"":"obj || (obj = {});\n")+"var __t, __p = ''"+(o?", __e = _.escape":"")+(a?", __j = Array.prototype.join;\nfunction print() { __p += __j.call(arguments, '') }\n":";\n")+p+"return __p\n}";var v=Kp(function(){return ol(u,d+"return "+p).apply(it,c)});if(v.source=p,Qs(v))throw v;return v}function yc(t){return Au(t).toLowerCase()}function bc(t){return Au(t).toUpperCase()}function xc(t,e,n){if((t=Au(t))&&(n||e===it))return t.replace(Ne,"");if(!t||!(e=fi(e)))return t;var r=tt(t),i=tt(e);return Mi(r,F(r,i),j(r,i)+1).join("")}function _c(t,e,n){if((t=Au(t))&&(n||e===it))return t.replace(ke,"");if(!t||!(e=fi(e)))return t;var r=tt(t);return Mi(r,0,j(r,tt(e))+1).join("")}function wc(t,e,n){if((t=Au(t))&&(n||e===it))return t.replace(De,"");if(!t||!(e=fi(e)))return t;var r=tt(t);return Mi(r,F(r,tt(e))).join("")}function Ec(t,e){var n=St,r=At;if(iu(e)){var i="separator"in e?e.separator:i;n="length"in e?wu(e.length):n,r="omission"in e?fi(e.omission):r}t=Au(t);var o=t.length;if(H(t)){var a=tt(t);o=a.length}if(n>=o)return t;var s=n-Q(r);if(s<1)return r;var u=a?Mi(a,0,s).join(""):t.slice(0,s);if(i===it)return u+r;if(a&&(s+=u.length-s),_p(i)){if(t.slice(s).search(i)){var c,l=u;for(i.global||(i=ul(i.source,Au(He.exec(i))+"g")),i.lastIndex=0;c=i.exec(l);)var h=c.index;u=u.slice(0,h===it?s:h)}}else if(t.indexOf(fi(i),s)!=s){var p=u.lastIndexOf(i);p>-1&&(u=u.slice(0,p))}return u+r}function Mc(t){return t=Au(t),t&&Ee.test(t)?t.replace(_e,Yn):t}function Tc(t,e,n){return t=Au(t),e=n?it:e,e===it?G(t)?rt(t):_(t):t.match(e)||[]}function Sc(t){var e=null==t?0:t.length,n=wo();return t=e?m(t,function(t){if("function"!=typeof t[1])throw new ll(st);return[n(t[0]),t[1]]}):[],ni(function(n){for(var r=-1;++rIt)return[];var n=kt,r=Xl(t,kt);e=wo(e),t-=kt;for(var i=I(r,e);++n1?t[e-1]:it;return n="function"==typeof n?(t.pop(),n):it,qa(t,n)}),Zh=go(function(t){var e=t.length,n=e?t[0]:0,r=this.__wrapped__,o=function(e){return er(e,t)};return!(e>1||this.__actions__.length)&&r instanceof x&&Do(n)?(r=r.slice(n,+n+(e?1:0)),r.__actions__.push({func:Ja,args:[o],thisArg:it}),new i(r,this.__chain__).thru(function(t){return e&&!t.length&&t.push(it),t})):this.thru(o)}),Kh=zi(function(t,e,n){vl.call(t,n)?++t[n]:tr(t,n,1)}),$h=Ki(ha),Jh=Ki(pa),Qh=zi(function(t,e,n){vl.call(t,n)?t[n].push(e):tr(t,n,[e])}),tp=ni(function(t,e,n){var r=-1,i="function"==typeof e,o=Xs(t)?nl(t.length):[];return dh(t,function(t){o[++r]=i?s(e,t,n):Tr(t,e,n)}),o}),ep=zi(function(t,e,n){tr(t,n,e)}),np=zi(function(t,e,n){t[n?0:1].push(e)},function(){return[[],[]]}),rp=ni(function(t,e){if(null==t)return[];var n=e.length;return n>1&&ko(t,e[0],e[1])?e=[]:n>2&&ko(e[0],e[1],e[2])&&(e=[e[0]]),qr(t,pr(e,1),[])}),ip=kl||function(){return In.Date.now()},op=ni(function(t,e,n){var r=vt;if(n.length){var i=Y(n,_o(op));r|=_t}return co(t,r,e,n,i)}),ap=ni(function(t,e,n){var r=vt|gt;if(n.length){var i=Y(n,_o(ap));r|=_t}return co(e,r,t,n,i)}),sp=ni(function(t,e){return ar(t,1,e)}),up=ni(function(t,e,n){return ar(t,Mu(e)||0,n)});Ls.Cache=cn;var cp=xh(function(t,e){e=1==e.length&&vp(e[0])?m(e[0],D(wo())):m(pr(e,1),D(wo()));var n=e.length;return ni(function(r){for(var i=-1,o=Xl(r.length,n);++i=e}),mp=Sr(function(){return arguments}())?Sr:function(t){return ou(t)&&vl.call(t,"callee")&&!Pl.call(t,"callee")},vp=nl.isArray,gp=jn?D(jn):Ar,yp=zl||zc,bp=Bn?D(Bn):Cr,xp=zn?D(zn):Lr,_p=Vn?D(Vn):Nr,wp=Hn?D(Hn):Dr,Ep=Gn?D(Gn):kr,Mp=oo(Br),Tp=oo(function(t,e){return t<=e}),Sp=Vi(function(t,e){if(zo(e)||Xs(e))return void Fi(e,Bu(e),t);for(var n in e)vl.call(e,n)&&Wn(t,n,e[n])}),Ap=Vi(function(t,e){Fi(e,zu(e),t)}),Cp=Vi(function(t,e,n,r){Fi(e,zu(e),t,r)}),Pp=Vi(function(t,e,n,r){Fi(e,Bu(e),t,r)}),Rp=go(er),Lp=ni(function(t){return t.push(it,lo),s(Cp,it,t)}),Op=ni(function(t){return t.push(it,ho),s(Up,it,t)}),Ip=Qi(function(t,e,n){t[e]=n},Cc(Rc)),Np=Qi(function(t,e,n){vl.call(t,e)?t[e].push(n):t[e]=[n]},wo),Dp=ni(Tr),kp=Vi(function(t,e,n){Gr(t,e,n)}),Up=Vi(function(t,e,n,r){Gr(t,e,n,r)}),Fp=go(function(t,e){var n={};if(null==t)return n;var r=!1;e=m(e,function(e){return e=Ei(e,t),r||(r=e.length>1),e}),Fi(t,bo(t),n),r&&(n=rr(n,ht|pt|ft,po));for(var i=e.length;i--;)mi(n,e[i]);return n}),jp=go(function(t,e){return null==t?{}:Yr(t,e)}),Bp=uo(Bu),zp=uo(zu),Vp=qi(function(t,e,n){return e=e.toLowerCase(),t+(n?ic(e):e)}),Hp=qi(function(t,e,n){return t+(n?"-":"")+e.toLowerCase()}),Gp=qi(function(t,e,n){return t+(n?" ":"")+e.toLowerCase()}),Wp=Xi("toLowerCase"),Xp=qi(function(t,e,n){return t+(n?"_":"")+e.toLowerCase()}),qp=qi(function(t,e,n){return t+(n?" ":"")+Zp(e)}),Yp=qi(function(t,e,n){return t+(n?" ":"")+e.toUpperCase()}),Zp=Xi("toUpperCase"),Kp=ni(function(t,e){try{return s(t,it,e)}catch(t){return Qs(t)?t:new il(t)}}),$p=go(function(t,e){return c(e,function(e){e=Qo(e),tr(t,e,op(t[e],t))}),t}),Jp=$i(),Qp=$i(!0),tf=ni(function(t,e){return function(n){return Tr(n,t,e)}}),ef=ni(function(t,e){return function(n){return Tr(t,n,e)}}),nf=eo(m),rf=eo(h),of=eo(b),af=io(),sf=io(!0),uf=to(function(t,e){return t+e},0),cf=so("ceil"),lf=to(function(t,e){return t/e},1),hf=so("floor"),pf=to(function(t,e){return t*e},1),ff=so("round"),df=to(function(t,e){return t-e},0);return n.after=Ms,n.ary=Ts,n.assign=Sp,n.assignIn=Ap,n.assignInWith=Cp,n.assignWith=Pp,n.at=Rp,n.before=Ss,n.bind=op,n.bindAll=$p,n.bindKey=ap,n.castArray=js,n.chain=Ka,n.chunk=ra,n.compact=ia,n.concat=oa,n.cond=Sc,n.conforms=Ac,n.constant=Cc,n.countBy=Kh,n.create=Cu,n.curry=As,n.curryRight=Cs,n.debounce=Ps,n.defaults=Lp,n.defaultsDeep=Op,n.defer=sp,n.delay=up,n.difference=Oh,n.differenceBy=Ih,n.differenceWith=Nh,n.drop=aa,n.dropRight=sa,n.dropRightWhile=ua,n.dropWhile=ca,n.fill=la,n.filter=ss,n.flatMap=us,n.flatMapDeep=cs,n.flatMapDepth=ls,n.flatten=fa,n.flattenDeep=da,n.flattenDepth=ma,n.flip=Rs,n.flow=Jp,n.flowRight=Qp,n.fromPairs=va,n.functions=Du,n.functionsIn=ku,n.groupBy=Qh,n.initial=ba,n.intersection=Dh,n.intersectionBy=kh,n.intersectionWith=Uh,n.invert=Ip,n.invertBy=Np,n.invokeMap=tp,n.iteratee=Lc,n.keyBy=ep,n.keys=Bu,n.keysIn=zu,n.map=ds,n.mapKeys=Vu,n.mapValues=Hu,n.matches=Oc,n.matchesProperty=Ic,n.memoize=Ls,n.merge=kp,n.mergeWith=Up,n.method=tf,n.methodOf=ef,n.mixin=Nc,n.negate=Os,n.nthArg=Uc,n.omit=Fp,n.omitBy=Gu,n.once=Is,n.orderBy=ms,n.over=nf,n.overArgs=cp,n.overEvery=rf,n.overSome=of,n.partial=lp,n.partialRight=hp,n.partition=np,n.pick=jp,n.pickBy=Wu,n.property=Fc,n.propertyOf=jc,n.pull=Fh,n.pullAll=Ma,n.pullAllBy=Ta,n.pullAllWith=Sa,n.pullAt=jh,n.range=af,n.rangeRight=sf,n.rearg=pp,n.reject=ys,n.remove=Aa,n.rest=Ns,n.reverse=Ca,n.sampleSize=xs,n.set=qu,n.setWith=Yu,n.shuffle=_s,n.slice=Pa,n.sortBy=rp,n.sortedUniq=ka,n.sortedUniqBy=Ua,n.split=mc,n.spread=Ds,n.tail=Fa,n.take=ja,n.takeRight=Ba,n.takeRightWhile=za,n.takeWhile=Va,n.tap=$a,n.throttle=ks,n.thru=Ja,n.toArray=xu,n.toPairs=Bp,n.toPairsIn=zp,n.toPath=Xc,n.toPlainObject=Tu,n.transform=Zu,n.unary=Us,n.union=Bh,n.unionBy=zh,n.unionWith=Vh,n.uniq=Ha,n.uniqBy=Ga,n.uniqWith=Wa,n.unset=Ku,n.unzip=Xa,n.unzipWith=qa,n.update=$u,n.updateWith=Ju,n.values=Qu,n.valuesIn=tc,n.without=Hh,n.words=Tc,n.wrap=Fs,n.xor=Gh,n.xorBy=Wh,n.xorWith=Xh,n.zip=qh,n.zipObject=Ya,n.zipObjectDeep=Za,n.zipWith=Yh,n.entries=Bp,n.entriesIn=zp,n.extend=Ap,n.extendWith=Cp,Nc(n,n),n.add=uf,n.attempt=Kp,n.camelCase=Vp,n.capitalize=ic,n.ceil=cf,n.clamp=ec,n.clone=Bs,n.cloneDeep=Vs,n.cloneDeepWith=Hs,n.cloneWith=zs,n.conformsTo=Gs,n.deburr=oc,n.defaultTo=Pc,n.divide=lf,n.endsWith=ac,n.eq=Ws,n.escape=sc,n.escapeRegExp=uc,n.every=as,n.find=$h,n.findIndex=ha,n.findKey=Pu,n.findLast=Jh,n.findLastIndex=pa,n.findLastKey=Ru,n.floor=hf,n.forEach=hs,n.forEachRight=ps,n.forIn=Lu,n.forInRight=Ou,n.forOwn=Iu,n.forOwnRight=Nu,n.get=Uu,n.gt=fp,n.gte=dp,n.has=Fu,n.hasIn=ju,n.head=ga,n.identity=Rc,n.includes=fs,n.indexOf=ya,n.inRange=nc,n.invoke=Dp,n.isArguments=mp,n.isArray=vp,n.isArrayBuffer=gp,n.isArrayLike=Xs,n.isArrayLikeObject=qs,n.isBoolean=Ys,n.isBuffer=yp,n.isDate=bp,n.isElement=Zs,n.isEmpty=Ks,n.isEqual=$s,n.isEqualWith=Js,n.isError=Qs,n.isFinite=tu,n.isFunction=eu,n.isInteger=nu,n.isLength=ru,n.isMap=xp,n.isMatch=au,n.isMatchWith=su,n.isNaN=uu,n.isNative=cu,n.isNil=hu,n.isNull=lu,n.isNumber=pu,n.isObject=iu,n.isObjectLike=ou,n.isPlainObject=fu,n.isRegExp=_p,n.isSafeInteger=du,n.isSet=wp,n.isString=mu,n.isSymbol=vu,n.isTypedArray=Ep,n.isUndefined=gu,n.isWeakMap=yu,n.isWeakSet=bu,n.join=xa,n.kebabCase=Hp,n.last=_a,n.lastIndexOf=wa,n.lowerCase=Gp,n.lowerFirst=Wp,n.lt=Mp,n.lte=Tp,n.max=Yc,n.maxBy=Zc,n.mean=Kc,n.meanBy=$c,n.min=Jc,n.minBy=Qc,n.stubArray=Bc,n.stubFalse=zc,n.stubObject=Vc,n.stubString=Hc,n.stubTrue=Gc,n.multiply=pf,n.nth=Ea,n.noConflict=Dc,n.noop=kc,n.now=ip,n.pad=cc,n.padEnd=lc,n.padStart=hc,n.parseInt=pc,n.random=rc,n.reduce=vs,n.reduceRight=gs,n.repeat=fc,n.replace=dc,n.result=Xu,n.round=ff,n.runInContext=t,n.sample=bs,n.size=ws,n.snakeCase=Xp,n.some=Es,n.sortedIndex=Ra,n.sortedIndexBy=La,n.sortedIndexOf=Oa,n.sortedLastIndex=Ia,n.sortedLastIndexBy=Na,n.sortedLastIndexOf=Da,n.startCase=qp,n.startsWith=vc,n.subtract=df,n.sum=tl,n.sumBy=el,n.template=gc,n.times=Wc,n.toFinite=_u,n.toInteger=wu,n.toLength=Eu,n.toLower=yc,n.toNumber=Mu,n.toSafeInteger=Su,n.toString=Au,n.toUpper=bc,n.trim=xc,n.trimEnd=_c,n.trimStart=wc,n.truncate=Ec,n.unescape=Mc,n.uniqueId=qc,n.upperCase=Yp,n.upperFirst=Zp,n.each=hs,n.eachRight=ps,n.first=ga,Nc(n,function(){var t={};return fr(n,function(e,r){vl.call(n.prototype,r)||(t[r]=e)}),t}(),{chain:!1}),n.VERSION="4.17.4",c(["bind","bindKey","curry","curryRight","partial","partialRight"],function(t){n[t].placeholder=n}),c(["drop","take"],function(t,e){x.prototype[t]=function(n){n=n===it?1:Wl(wu(n),0);var r=this.__filtered__&&!e?new x(this):this.clone();return r.__filtered__?r.__takeCount__=Xl(n,r.__takeCount__):r.__views__.push({size:Xl(n,kt),type:t+(r.__dir__<0?"Right":"")}),r},x.prototype[t+"Right"]=function(e){return this.reverse()[t](e).reverse()}}),c(["filter","map","takeWhile"],function(t,e){var n=e+1,r=n==Rt||3==n;x.prototype[t]=function(t){var e=this.clone();return e.__iteratees__.push({iteratee:wo(t,3),type:n}),e.__filtered__=e.__filtered__||r,e}}),c(["head","last"],function(t,e){var n="take"+(e?"Right":"");x.prototype[t]=function(){return this[n](1).value()[0]}}),c(["initial","tail"],function(t,e){var n="drop"+(e?"":"Right");x.prototype[t]=function(){return this.__filtered__?new x(this):this[n](1)}}),x.prototype.compact=function(){return this.filter(Rc)},x.prototype.find=function(t){return this.filter(t).head()},x.prototype.findLast=function(t){return this.reverse().find(t)},x.prototype.invokeMap=ni(function(t,e){return"function"==typeof t?new x(this):this.map(function(n){return Tr(n,t,e)})}),x.prototype.reject=function(t){return this.filter(Os(wo(t)))},x.prototype.slice=function(t,e){t=wu(t);var n=this;return n.__filtered__&&(t>0||e<0)?new x(n):(t<0?n=n.takeRight(-t):t&&(n=n.drop(t)),e!==it&&(e=wu(e),n=e<0?n.dropRight(-e):n.take(e-t)),n)},x.prototype.takeRightWhile=function(t){return this.reverse().takeWhile(t).reverse()},x.prototype.toArray=function(){return this.take(kt)},fr(x.prototype,function(t,e){var r=/^(?:filter|find|map|reject)|While$/.test(e),o=/^(?:head|last)$/.test(e),a=n[o?"take"+("last"==e?"Right":""):e],s=o||/^find/.test(e);a&&(n.prototype[e]=function(){var e=this.__wrapped__,u=o?[1]:arguments,c=e instanceof x,l=u[0],h=c||vp(e),p=function(t){var e=a.apply(n,v([t],u));return o&&f?e[0]:e};h&&r&&"function"==typeof l&&1!=l.length&&(c=h=!1);var f=this.__chain__,d=!!this.__actions__.length,m=s&&!f,g=c&&!d;if(!s&&h){e=g?e:new x(this);var y=t.apply(e,u);return y.__actions__.push({func:Ja,args:[p],thisArg:it}),new i(y,f)}return m&&g?t.apply(this,u):(y=this.thru(p),m?o?y.value()[0]:y.value():y)})}),c(["pop","push","shift","sort","splice","unshift"],function(t){var e=hl[t],r=/^(?:push|sort|unshift)$/.test(t)?"tap":"thru",i=/^(?:pop|shift)$/.test(t);n.prototype[t]=function(){var t=arguments;if(i&&!this.__chain__){var n=this.value();return e.apply(vp(n)?n:[],t)}return this[r](function(n){return e.apply(vp(n)?n:[],t)})}}),fr(x.prototype,function(t,e){var r=n[e];if(r){var i=r.name+"";(ih[i]||(ih[i]=[])).push({name:e,func:r})}}),ih[Ji(it,gt).name]=[{name:"wrapper",func:it}],x.prototype.clone=P,x.prototype.reverse=$,x.prototype.value=et,n.prototype.at=Zh,n.prototype.chain=Qa,n.prototype.commit=ts,n.prototype.next=es,n.prototype.plant=rs,n.prototype.reverse=is,n.prototype.toJSON=n.prototype.valueOf=n.prototype.value=os,n.prototype.first=n.prototype.head,Ol&&(n.prototype[Ol]=ns),n}();In._=Zn,(i=function(){return Zn}.call(e,n,e,r))!==it&&(r.exports=i)}).call(this)}).call(e,n(144),n(338)(t))},function(t,e,n){"use strict";(function(n){function r(t){return function(e,n,r){return r&&"function"==typeof r.value?(r.value=F(t,r.value),r.enumerable=!1,r.configurable=!0,r):He(t).apply(this,arguments)}}function i(t,e,n){var r="string"==typeof t?t:t.name||"",i="function"==typeof t?t:e,o="function"==typeof t?e:n;return xe("function"==typeof i,ve("m002")),xe(0===i.length,ve("m003")),xe("string"==typeof r&&r.length>0,"actions should have valid names, got: '"+r+"'"),j(r,i,o,void 0)}function o(t){return"function"==typeof t&&!0===t.isMobxAction}function a(t,e,n){var r=function(){return j(e,n,t,arguments)};r.isMobxAction=!0,Re(t,e,r)}function s(t,e,n){function r(){a(u)}var i,a,s;"string"==typeof t?(i=t,a=e,s=n):(i=t.name||"Autorun@"+ye(),a=t,s=e),xe("function"==typeof a,ve("m004")),xe(!1===o(a),ve("m005")),s&&(a=a.bind(s));var u=new fn(i,function(){this.track(r)});return u.schedule(),u.getDisposer()}function u(t,e,n,r){var i,o,a,u;return"string"==typeof t?(i=t,o=e,a=n,u=r):(i="When@"+ye(),o=t,a=e,u=n),s(i,function(t){if(o.call(u)){t.dispose();var e=et();a.call(u),nt(e)}})}function c(t,e,n,r){function i(){s(h)}var a,s,u,c;"string"==typeof t?(a=t,s=e,u=n,c=r):(a=t.name||"AutorunAsync@"+ye(),s=t,u=e,c=n),xe(!1===o(s),ve("m006")),void 0===u&&(u=1),c&&(s=s.bind(c));var l=!1,h=new fn(a,function(){l||(l=!0,setTimeout(function(){l=!1,h.isDisposed||h.track(i)},u))});return h.schedule(),h.getDisposer()}function l(t,e,n){function r(){if(!u.isDisposed){var n=!1;u.track(function(){var e=t(u);n=Ce(i.compareStructural,o,e),o=e}),a&&i.fireImmediately&&e(o,u),a||!0!==n||e(o,u),a&&(a=!1)}}arguments.length>3&&be(ve("m007")),Ft(t)&&be(ve("m008"));var i;i="object"==typeof n?n:{},i.name=i.name||t.name||e.name||"Reaction@"+ye(),i.fireImmediately=!0===n||!0===i.fireImmediately,i.delay=i.delay||0,i.compareStructural=i.compareStructural||i.struct||!1,e=We(i.name,i.context?e.bind(i.context):e),i.context&&(t=t.bind(i.context));var o,a=!0,s=!1,u=new fn(i.name,function(){a||i.delay<1?r():s||(s=!0,setTimeout(function(){s=!1,r()},i.delay))});return u.schedule(),u.getDisposer()}function h(t){return ce(function(e,n,r,i,o){xe(void 0!==o,ve("m009")),xe("function"==typeof o.get,ve("m010")),Qt(Kt(e,""),n,o.get,o.set,t,!1)},function(t){var e=this.$mobx.values[t];if(void 0!==e)return e.get()},function(t,e){this.$mobx.values[t].set(e)},!1,!1)}function p(t,e){xe("function"==typeof t&&t.length<2,"createTransformer expects a function that accepts one argument");var n={},r=pn.resetId,i=function(r){function i(e,n){var i=r.call(this,function(){return t(n)},void 0,!1,"Transformer-"+t.name+"-"+e,void 0)||this;return i.sourceIdentifier=e,i.sourceObject=n,i}return Ve(i,r),i.prototype.onBecomeUnobserved=function(){var t=this.value;r.prototype.onBecomeUnobserved.call(this),delete n[this.sourceIdentifier],e&&e(t,this.sourceObject)},i}(an);return function(t){r!==pn.resetId&&(n={},r=pn.resetId);var e=f(t),o=n[e];return o?o.get():(o=n[e]=new i(e,t),o.get())}}function f(t){if("string"==typeof t||"number"==typeof t)return t;if(null===t||"object"!=typeof t)throw new Error("[mobx] transform expected some kind of object or primitive value, got: "+t);var e=t.$transformId;return void 0===e&&(e=ye(),Re(t,"$transformId",e)),e}function d(t,e){return Z()||console.warn(ve("m013")),Ye(t,{context:e}).get()}function m(t){for(var e=[],n=1;n=2,ve("m014")),xe("object"==typeof t,ve("m015")),xe(!An(t),ve("m016")),n.forEach(function(t){xe("object"==typeof t,ve("m017")),xe(!S(t),ve("m018"))});for(var r=Kt(t),i={},o=n.length-1;o>=0;o--){var a=n[o];for(var s in a)if(!0!==i[s]&&Pe(a,s)){if(i[s]=!0,t===a&&!Oe(t,s))continue;var u=Object.getOwnPropertyDescriptor(a,s);$t(r,s,u,e)}}return t}function y(t,e){return b(ae(t,e))}function b(t){var e={name:t.name};return t.observing&&t.observing.length>0&&(e.dependencies=Ee(t.observing).map(b)),e}function x(t,e){return _(ae(t,e))}function _(t){var e={name:t.name};return st(t)&&(e.observers=ut(t).map(_)),e}function w(t,e,n){return"function"==typeof n?M(t,e,n):E(t,e)}function E(t,e){return se(t).intercept(e)}function M(t,e,n){return se(t,e).intercept(n)}function T(t,e){if(null===t||void 0===t)return!1;if(void 0!==e){if(!1===oe(t))return!1;var n=ae(t,e);return un(n)}return un(t)}function S(t,e){if(null===t||void 0===t)return!1;if(void 0!==e){if(Yt(t)||An(t))throw new Error(ve("m019"));if(oe(t)){var n=t.$mobx;return n.values&&!!n.values[e]}return!1}return oe(t)||!!t.$mobx||on(t)||vn(t)||un(t)}function A(t){if(void 0===t&&(t=void 0),"string"==typeof arguments[1])return Ze.apply(null,arguments);if(xe(arguments.length<=1,ve("m021")),xe(!Ft(t),ve("m020")),S(t))return t;var e=Bt(t,void 0,void 0);return e!==t?e:en.box(t)}function C(t){be("Expected one or two arguments to observable."+t+". Did you accidentally try to use observable."+t+" as decorator?")}function P(t){return xe(!!t,":("),ce(function(e,n,r,i,o){Ie(e,n),xe(!o||!o.get,ve("m022")),Jt(Kt(e,void 0),n,r,t)},function(t){var e=this.$mobx.values[t];if(void 0!==e)return e.get()},function(t,e){re(this,t,e)},!0,!1)}function R(t,e,n,r){return"function"==typeof n?O(t,e,n,r):L(t,e,n)}function L(t,e,n){return se(t).observe(e,n)}function O(t,e,n,r){return se(t,e).observe(n,r)}function I(t,e,n){function r(r){return e&&n.push([t,r]),r}if(void 0===e&&(e=!0),void 0===n&&(n=[]),S(t)){if(e&&null===n&&(n=[]),e&&null!==t&&"object"==typeof t)for(var i=0,o=n.length;i0,"actions should have valid names, got: '"+t+"'");var n=function(){return j(t,e,this,arguments)};return n.originalFn=e,n.isMobxAction=!0,n}function j(t,e,n,r){var i=B(t,e,n,r);try{return e.apply(n,r)}finally{z(i)}}function B(t,e,n,r){var i=Et()&&!!t,o=0;if(i){o=Date.now();var a=r&&r.length||0,s=new Array(a);if(a>0)for(var u=0;u0;pn.computationDepth>0&&e&&be(ve("m031")+t.name),!pn.allowStateChanges&&e&&be(ve(pn.strictMode?"m030a":"m030b")+t.name)}function $(t,e,n){rt(t),t.newObserving=new Array(t.observing.length+100),t.unboundDepsCount=0,t.runId=++pn.runId;var r=pn.trackingDerivation;pn.trackingDerivation=t;var i;try{i=e.call(n)}catch(t){i=new cn(t)}return pn.trackingDerivation=r,J(t),i}function J(t){var e=t.observing,n=t.observing=t.newObserving,r=sn.UP_TO_DATE;t.newObserving=null;for(var i=0,o=t.unboundDepsCount,a=0;ar&&(r=s.dependenciesState)}for(n.length=i,o=e.length;o--;){var s=e[o];0===s.diffValue&<(s,t),s.diffValue=0}for(;i--;){var s=n[i];1===s.diffValue&&(s.diffValue=0,ct(s,t))}r!==sn.UP_TO_DATE&&(t.dependenciesState=r,t.onBecomeStale())}function Q(t){var e=t.observing;t.observing=[];for(var n=e.length;n--;)lt(e[n],t);t.dependenciesState=sn.NOT_TRACKING}function tt(t){var e=et(),n=t();return nt(e),n}function et(){var t=pn.trackingDerivation;return pn.trackingDerivation=null,t}function nt(t){pn.trackingDerivation=t}function rt(t){if(t.dependenciesState!==sn.UP_TO_DATE){t.dependenciesState=sn.UP_TO_DATE;for(var e=t.observing,n=e.length;n--;)e[n].lowestObserverState=sn.UP_TO_DATE}}function it(){var t=ge(),e=pn;if(t.__mobservableTrackingStack||t.__mobservableViewStack)throw new Error("[mobx] An incompatible version of mobservable is already loaded.");if(t.__mobxGlobal&&t.__mobxGlobal.version!==e.version)throw new Error("[mobx] An incompatible version of mobx is already loaded.");t.__mobxGlobal?pn=t.__mobxGlobal:t.__mobxGlobal=e}function ot(){return pn}function at(){pn.resetId++;var t=new hn;for(var e in t)-1===ln.indexOf(e)&&(pn[e]=t[e]);pn.allowStateChanges=!pn.strictMode}function st(t){return t.observers&&t.observers.length>0}function ut(t){return t.observers}function ct(t,e){var n=t.observers.length;n&&(t.observersIndexes[e.__mapid]=n),t.observers[n]=e,t.lowestObserverState>e.dependenciesState&&(t.lowestObserverState=e.dependenciesState)}function lt(t,e){if(1===t.observers.length)t.observers.length=0,ht(t);else{var n=t.observers,r=t.observersIndexes,i=n.pop();if(i!==e){var o=r[e.__mapid]||0;o?r[i.__mapid]=o:delete r[i.__mapid],n[o]=i}delete r[e.__mapid]}}function ht(t){t.isPendingUnobservation||(t.isPendingUnobservation=!0,pn.pendingUnobservations.push(t))}function pt(){pn.inBatch++}function ft(){if(0==--pn.inBatch){xt();for(var t=pn.pendingUnobservations,e=0;e=0&&pn.globalReactionErrorHandlers.splice(e,1)}}function xt(){pn.inBatch>0||pn.isRunningReactions||mn(_t)}function _t(){pn.isRunningReactions=!0;for(var t=pn.pendingReactions,e=0;t.length>0;){++e===dn&&(console.error("Reaction doesn't converge to a stable state after "+dn+" iterations. Probably there is a cycle in the reactive function: "+t[0]),t.splice(0));for(var n=t.splice(0),r=0,i=n.length;r0}function Pt(t,e){var n=t.interceptors||(t.interceptors=[]);return n.push(e),we(function(){var t=n.indexOf(e);-1!==t&&n.splice(t,1)})}function Rt(t,e){var n=et();try{var r=t.interceptors;if(r)for(var i=0,o=r.length;i0}function Ot(t,e){var n=t.changeListeners||(t.changeListeners=[]);return n.push(e),we(function(){var t=n.indexOf(e);-1!==t&&n.splice(t,1)})}function It(t,e){var n=et(),r=t.changeListeners;if(r){r=r.slice();for(var i=0,o=r.length;i=this.length,value:ee?" (... and "+(t.length-e)+"more)":""):""}function Te(t){return null!==t&&"object"==typeof t}function Se(t){if(null===t||"object"!=typeof t)return!1;var e=Object.getPrototypeOf(t);return e===Object.prototype||null===e}function Ae(){for(var t=arguments[0],e=1,n=arguments.length;e=0;i--)if(!De(t[i],e[i]))return!1;return!0}if(r){if(t.size!==e.size)return!1;var o=!0;return t.forEach(function(t,n){o=o&&De(e.get(n),t)}),o}if("object"==typeof t&&"object"==typeof e){if(null===t||null===e)return!1;if(Fe(t)&&Fe(e))return t.size===e.size&&De(en.shallowMap(t).entries(),en.shallowMap(e).entries());if(Ne(t).length!==Ne(e).length)return!1;for(var a in t){if(!(a in e))return!1;if(!De(t[a],e[a]))return!1}return!0}return!1}function ke(t,e){var n="isMobX"+t;return e.prototype[n]=!0,function(t){return Te(t)&&!0===t[n]}}function Ue(t){return Array.isArray(t)||Yt(t)}function Fe(t){return je(t)||An(t)}function je(t){return void 0!==ge().Map&&t instanceof ge().Map}function Be(){return"function"==typeof Symbol&&Symbol.toPrimitive||"@@toPrimitive"}function ze(t){return null===t?null:"object"==typeof t?""+t:t}var Ve=this&&this.__extends||function(){var t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])};return function(e,n){function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}();Object.defineProperty(e,"__esModule",{value:!0}),e.extras={allowStateChanges:G,deepEqual:De,getAtom:ae,getDebugName:ue,getDependencyTree:y,getAdministration:se,getGlobalState:ot,getObserverTree:x,isComputingDerivation:Z,isSpyEnabled:Et,onReactionError:bt,reserveArrayBuffer:qt,resetGlobalState:at,shareGlobalState:it,spyReport:Mt,spyReportEnd:St,spyReportStart:Tt,setReactionScheduler:wt},"object"==typeof __MOBX_DEVTOOLS_GLOBAL_HOOK__&&__MOBX_DEVTOOLS_GLOBAL_HOOK__.injectMobx(t.exports),t.exports.default=t.exports;var He=ce(function(t,e,n,r,i){var o=r&&1===r.length?r[0]:n.name||e||"";Re(t,e,We(o,n))},function(t){return this[t]},function(){xe(!1,ve("m001"))},!1,!0),Ge=ce(function(t,e,n){a(t,e,n)},function(t){return this[t]},function(){xe(!1,ve("m001"))},!1,!1),We=function(t,e,n,i){return 1===arguments.length&&"function"==typeof t?F(t.name||"",t):2===arguments.length&&"function"==typeof e?F(t,e):1===arguments.length&&"string"==typeof t?r(t):r(e).apply(null,arguments)};e.action=We,We.bound=function(t,e,n){if("function"==typeof t){var r=F("",t);return r.autoBind=!0,r}return Ge.apply(null,arguments)},e.runInAction=i,e.isAction=o,e.autorun=s,e.when=u,e.autorunAsync=c,e.reaction=l;var Xe=h(!1),qe=h(!0),Ye=function(t,e,n){if("string"==typeof e)return Xe.apply(null,arguments);xe("function"==typeof t,ve("m011")),xe(arguments.length<3,ve("m012"));var r="object"==typeof e?e:{};return r.setter="function"==typeof e?e:r.setter,new an(t,r.context,r.compareStructural||r.struct||!1,r.name||t.name||"",r.setter)};e.computed=Ye,Ye.struct=qe,e.createTransformer=p,e.expr=d,e.extendObservable=m,e.extendShallowObservable=v,e.intercept=w,e.isComputed=T,e.isObservable=S;var Ze=P(Bt),Ke=P(zt),$e=P(Vt),Je=P(Ht),Qe=P(Gt),tn=function(){function t(){}return t.prototype.box=function(t,e){return arguments.length>2&&C("box"),new In(t,Bt,e)},t.prototype.shallowBox=function(t,e){return arguments.length>2&&C("shallowBox"),new In(t,Vt,e)},t.prototype.array=function(t,e){return arguments.length>2&&C("array"),new wn(t,Bt,e)},t.prototype.shallowArray=function(t,e){return arguments.length>2&&C("shallowArray"),new wn(t,Vt,e)},t.prototype.map=function(t,e){return arguments.length>2&&C("map"),new Sn(t,Bt,e)},t.prototype.shallowMap=function(t,e){return arguments.length>2&&C("shallowMap"),new Sn(t,Vt,e)},t.prototype.object=function(t,e){arguments.length>2&&C("object");var n={};return Kt(n,e),m(n,t),n},t.prototype.shallowObject=function(t,e){arguments.length>2&&C("shallowObject");var n={};return Kt(n,e),v(n,t),n},t.prototype.ref=function(){return arguments.length<2?jt(Vt,arguments[0]):$e.apply(null,arguments)},t.prototype.shallow=function(){return arguments.length<2?jt(zt,arguments[0]):Ke.apply(null,arguments)},t.prototype.deep=function(){return arguments.length<2?jt(Bt,arguments[0]):Ze.apply(null,arguments)},t.prototype.struct=function(){return arguments.length<2?jt(Ht,arguments[0]):Je.apply(null,arguments)},t}();e.IObservableFactories=tn;var en=A;e.observable=en,Object.keys(tn.prototype).forEach(function(t){return en[t]=tn.prototype[t]}),en.deep.struct=en.struct,en.ref.struct=function(){return arguments.length<2?jt(Gt,arguments[0]):Qe.apply(null,arguments)},e.observe=R,e.toJS=I,e.transaction=N,e.whyRun=U,e.useStrict=V,e.isStrictModeEnabled=H;var nn=function(){function t(t){void 0===t&&(t="Atom@"+ye()),this.name=t,this.isPendingUnobservation=!0,this.observers=[],this.observersIndexes={},this.diffValue=0,this.lastAccessedBy=0,this.lowestObserverState=sn.NOT_TRACKING}return t.prototype.onBecomeUnobserved=function(){},t.prototype.reportObserved=function(){dt(this)},t.prototype.reportChanged=function(){pt(),mt(this),ft()},t.prototype.toString=function(){return this.name},t}();e.BaseAtom=nn;var rn=function(t){function e(e,n,r){void 0===e&&(e="Atom@"+ye()),void 0===n&&(n=jn),void 0===r&&(r=jn);var i=t.call(this,e)||this;return i.name=e,i.onBecomeObservedHandler=n,i.onBecomeUnobservedHandler=r,i.isPendingUnobservation=!1,i.isBeingTracked=!1,i}return Ve(e,t),e.prototype.reportObserved=function(){return pt(),t.prototype.reportObserved.call(this),this.isBeingTracked||(this.isBeingTracked=!0,this.onBecomeObservedHandler()),ft(),!!pn.trackingDerivation},e.prototype.onBecomeUnobserved=function(){this.isBeingTracked=!1,this.onBecomeUnobservedHandler()},e}(nn);e.Atom=rn;var on=ke("Atom",nn),an=function(){function t(t,e,n,r,i){this.derivation=t,this.scope=e,this.compareStructural=n,this.dependenciesState=sn.NOT_TRACKING,this.observing=[],this.newObserving=null,this.isPendingUnobservation=!1,this.observers=[],this.observersIndexes={},this.diffValue=0,this.runId=0,this.lastAccessedBy=0,this.lowestObserverState=sn.UP_TO_DATE,this.unboundDepsCount=0,this.__mapid="#"+ye(),this.value=void 0,this.isComputing=!1,this.isRunningSetter=!1,this.name=r||"ComputedValue@"+ye(),i&&(this.setter=F(r+"-setter",i))}return t.prototype.onBecomeStale=function(){gt(this)},t.prototype.onBecomeUnobserved=function(){Q(this),this.value=void 0},t.prototype.get=function(){xe(!this.isComputing,"Cycle detected in computation "+this.name,this.derivation),0===pn.inBatch?(pt(),Y(this)&&(this.value=this.computeValue(!1)),ft()):(dt(this),Y(this)&&this.trackAndCompute()&&vt(this));var t=this.value;if(q(t))throw t.cause;return t},t.prototype.peek=function(){var t=this.computeValue(!1);if(q(t))throw t.cause;return t},t.prototype.set=function(t){if(this.setter){xe(!this.isRunningSetter,"The setter of computed value '"+this.name+"' is trying to update itself. Did you intend to update an _observable_ value, instead of the computed property?"),this.isRunningSetter=!0;try{this.setter.call(this.scope,t)}finally{this.isRunningSetter=!1}}else xe(!1,"[ComputedValue '"+this.name+"'] It is not possible to assign a new value to a computed value.")},t.prototype.trackAndCompute=function(){Et()&&Mt({object:this.scope,type:"compute",fn:this.derivation});var t=this.value,e=this.value=this.computeValue(!0);return q(e)||Ce(this.compareStructural,e,t)},t.prototype.computeValue=function(t){this.isComputing=!0,pn.computationDepth++;var e;if(t)e=$(this,this.derivation,this.scope);else try{e=this.derivation.call(this.scope)}catch(t){e=new cn(t)}return pn.computationDepth--,this.isComputing=!1,e},t.prototype.observe=function(t,e){var n=this,r=!0,i=void 0;return s(function(){var o=n.get();if(!r||e){var a=et();t({type:"update",object:n,newValue:o,oldValue:i}),nt(a)}r=!1,i=o})},t.prototype.toJSON=function(){return this.get()},t.prototype.toString=function(){return this.name+"["+this.derivation.toString()+"]"},t.prototype.valueOf=function(){return ze(this.get())},t.prototype.whyRun=function(){var t=Boolean(pn.trackingDerivation),e=Ee(this.isComputing?this.newObserving:this.observing).map(function(t){return t.name}),n=Ee(ut(this).map(function(t){return t.name}));return"\nWhyRun? computation '"+this.name+"':\n * Running because: "+(t?"[active] the value of this computation is needed by a reaction":this.isComputing?"[get] The value of this computed was requested outside a reaction":"[idle] not running at the moment")+"\n"+(this.dependenciesState===sn.NOT_TRACKING?ve("m032"):" * This computation will re-run if any of the following observables changes:\n "+Me(e)+"\n "+(this.isComputing&&t?" (... or any observable accessed during the remainder of the current run)":"")+"\n\t"+ve("m038")+"\n\n * If the outcome of this computation changes, the following observers will be re-run:\n "+Me(n)+"\n")},t}();an.prototype[Be()]=an.prototype.valueOf;var sn,un=ke("ComputedValue",an);!function(t){t[t.NOT_TRACKING=-1]="NOT_TRACKING",t[t.UP_TO_DATE=0]="UP_TO_DATE",t[t.POSSIBLY_STALE=1]="POSSIBLY_STALE",t[t.STALE=2]="STALE"}(sn||(sn={})),e.IDerivationState=sn;var cn=function(){function t(t){this.cause=t}return t}();e.untracked=tt;var ln=["mobxGuid","resetId","spyListeners","strictMode","runId"],hn=function(){function t(){this.version=5,this.trackingDerivation=null,this.computationDepth=0,this.runId=0,this.mobxGuid=0,this.inBatch=0,this.pendingUnobservations=[],this.pendingReactions=[],this.isRunningReactions=!1,this.allowStateChanges=!0,this.strictMode=!1,this.resetId=0,this.spyListeners=[],this.globalReactionErrorHandlers=[]}return t}(),pn=new hn,fn=function(){function t(t,e){void 0===t&&(t="Reaction@"+ye()),this.name=t,this.onInvalidate=e,this.observing=[],this.newObserving=[],this.dependenciesState=sn.NOT_TRACKING,this.diffValue=0,this.runId=0,this.unboundDepsCount=0,this.__mapid="#"+ye(),this.isDisposed=!1,this._isScheduled=!1,this._isTrackPending=!1,this._isRunning=!1}return t.prototype.onBecomeStale=function(){this.schedule()},t.prototype.schedule=function(){this._isScheduled||(this._isScheduled=!0,pn.pendingReactions.push(this),xt())},t.prototype.isScheduled=function(){return this._isScheduled},t.prototype.runReaction=function(){this.isDisposed||(pt(),this._isScheduled=!1,Y(this)&&(this._isTrackPending=!0,this.onInvalidate(),this._isTrackPending&&Et()&&Mt({object:this,type:"scheduled-reaction"})),ft())},t.prototype.track=function(t){pt();var e,n=Et();n&&(e=Date.now(),Tt({object:this,type:"reaction",fn:t})),this._isRunning=!0;var r=$(this,t,void 0);this._isRunning=!1,this._isTrackPending=!1,this.isDisposed&&Q(this),q(r)&&this.reportExceptionInDerivation(r.cause),n&&St({time:Date.now()-e}),ft()},t.prototype.reportExceptionInDerivation=function(t){var e=this;if(this.errorHandler)return void this.errorHandler(t,this);var n="[mobx] Encountered an uncaught exception that was thrown by a reaction or observer component, in: '"+this,r=ve("m037");console.error(n||r,t),Et()&&Mt({type:"error",message:n,error:t,object:this}),pn.globalReactionErrorHandlers.forEach(function(n){return n(t,e)})},t.prototype.dispose=function(){this.isDisposed||(this.isDisposed=!0,this._isRunning||(pt(),Q(this),ft()))},t.prototype.getDisposer=function(){var t=this.dispose.bind(this);return t.$mobx=this,t.onError=yt,t},t.prototype.toString=function(){return"Reaction["+this.name+"]"},t.prototype.whyRun=function(){var t=Ee(this._isRunning?this.newObserving:this.observing).map(function(t){return t.name});return"\nWhyRun? reaction '"+this.name+"':\n * Status: ["+(this.isDisposed?"stopped":this._isRunning?"running":this.isScheduled()?"scheduled":"idle")+"]\n * This reaction will re-run if any of the following observables changes:\n "+Me(t)+"\n "+(this._isRunning?" (... or any observable accessed during the remainder of the current run)":"")+"\n\t"+ve("m038")+"\n"},t}();e.Reaction=fn;var dn=100,mn=function(t){return t()},vn=ke("Reaction",fn),gn={spyReportEnd:!0};e.spy=At,e.asReference=Nt,e.asStructure=Dt,e.asFlat=kt,e.asMap=Ut,e.isModifierDescriptor=Ft;var yn=function(){var t=!1,e={};return Object.defineProperty(e,"0",{set:function(){t=!0}}),Object.create(e)[0]=1,!1===t}(),bn=0,xn=function(){function t(){}return t}();xn.prototype=[];var _n=function(){function t(t,e,n,r){this.array=n,this.owned=r,this.lastKnownLength=0,this.interceptors=null,this.changeListeners=null,this.atom=new nn(t||"ObservableArray@"+ye()),this.enhancer=function(n,r){return e(n,r,t+"[..]")}}return t.prototype.intercept=function(t){return Pt(this,t)},t.prototype.observe=function(t,e){return void 0===e&&(e=!1),e&&t({object:this.array,type:"splice",index:0,added:this.values.slice(),addedCount:this.values.length,removed:[],removedCount:0}),Ot(this,t)},t.prototype.getArrayLength=function(){return this.atom.reportObserved(),this.values.length},t.prototype.setArrayLength=function(t){if("number"!=typeof t||t<0)throw new Error("[mobx.array] Out of range: "+t);var e=this.values.length;if(t!==e)if(t>e){for(var n=new Array(t-e),r=0;r0&&t+e+1>bn&&qt(t+e+1)},t.prototype.spliceWithArray=function(t,e,n){var r=this;K(this.atom);var i=this.values.length;if(void 0===t?t=0:t>i?t=i:t<0&&(t=Math.max(0,i+t)),e=1===arguments.length?i-t:void 0===e||null===e?0:Math.max(0,Math.min(e,i-t)),void 0===n&&(n=[]),Ct(this)){var o=Rt(this,{object:this.array,type:"splice",index:t,removedCount:e,added:n});if(!o)return Un;e=o.removedCount,n=o.added}n=n.map(function(t){return r.enhancer(t,void 0)});var a=n.length-e;this.updateArrayLength(i,a);var s=this.spliceItemsIntoValues(t,e,n);return 0===e&&0===n.length||this.notifyArraySplice(t,n,s),s},t.prototype.spliceItemsIntoValues=function(t,e,n){if(n.length<1e4)return(i=this.values).splice.apply(i,[t,e].concat(n));var r=this.values.slice(t,t+e);return this.values=this.values.slice(0,t).concat(n,this.values.slice(t+e)),r;var i},t.prototype.notifyArrayChildUpdate=function(t,e,n){var r=!this.owned&&Et(),i=Lt(this),o=i||r?{object:this.array,type:"update",index:t,newValue:e,oldValue:n}:null;r&&Tt(o),this.atom.reportChanged(),i&&It(this,o),r&&St()},t.prototype.notifyArraySplice=function(t,e,n){var r=!this.owned&&Et(),i=Lt(this),o=i||r?{object:this.array,type:"splice",index:t,removed:n,added:e,removedCount:n.length,addedCount:e.length}:null;r&&Tt(o),this.atom.reportChanged(),i&&It(this,o),r&&St()},t}(),wn=function(t){function e(e,n,r,i){void 0===r&&(r="ObservableArray@"+ye()),void 0===i&&(i=!1);var o=t.call(this)||this,a=new _n(r,n,o,i);return Le(o,"$mobx",a),e&&e.length?(a.updateArrayLength(0,e.length),a.values=e.map(function(t){return n(t,void 0,r+"[..]")}),a.notifyArraySplice(0,a.values.slice(),Un)):a.values=[],yn&&Object.defineProperty(a.array,"0",En),o}return Ve(e,t),e.prototype.intercept=function(t){return this.$mobx.intercept(t)},e.prototype.observe=function(t,e){return void 0===e&&(e=!1),this.$mobx.observe(t,e)},e.prototype.clear=function(){return this.splice(0)},e.prototype.concat=function(){for(var t=[],e=0;e-1&&(this.splice(e,1),!0)},e.prototype.move=function(t,e){function n(t){if(t<0)throw new Error("[mobx.array] Index out of bounds: "+t+" is negative");var e=this.$mobx.values.length;if(t>=e)throw new Error("[mobx.array] Index out of bounds: "+t+" is not smaller than "+e)}if(n.call(this,t),n.call(this,e),t!==e){var r,i=this.$mobx.values;r=t1){for(var d=Array(f),m=0;m1){for(var g=Array(v),y=0;y150&&console.log("Last sim_world_update took "+(t.timestamp-this.lastUpdateTimestamp)+"ms"),this.lastUpdateTimestamp=t.timestamp,-1!==this.lastSeqNum&&t.world.sequenceNum>this.lastSeqNum+1&&console.debug("Last seq: "+this.lastSeqNum+". New seq: "+t.world.sequenceNum+"."),this.lastSeqNum=t.world.sequenceNum}},{key:"requestMapData",value:function(t){this.websocket.send((0,o.default)({type:"RetrieveMapData",elements:t}))}},{key:"requestMapElementsByRadius",value:function(t){this.websocket.send((0,o.default)({type:"RetrieveMapElementsByRadius",radius:t}))}},{key:"requestRoute",value:function(t,e,n){var r=arguments.length>3&&void 0!==arguments[3]&&arguments[3];this.websocket.send((0,o.default)({type:"SendRoutingRequest",start:t,end:n,waypoint:e,sendDefaultRoute:r}))}}]),t}(),v=function(){var t=window.location.origin,e=document.createElement("a");return e.href=t,("https:"===location.protocol?"wss":"ws")+"://"+e.hostname+":"+window.location.port+"/websocket"}(),g=new m(v);e.default=g},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{default:t}}Object.defineProperty(e,"__esModule",{value:!0});var i=n(1),o=r(i),a=n(2),s=r(a),u=n(8),c=function(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e.default=t,e}(u);n(149);var l=n(42),h=r(l),p=n(168),f=r(p),d=n(167),m=r(d),v=n(170),g=r(v),y=n(171),b=r(y),x=n(176),_=r(x),w=n(99),E=r(w),M=n(169),T=r(M),S=n(172),A=r(S),C=n(173),P=r(C),R=n(174),L=r(R),O=function(){function t(){(0,o.default)(this,t),this.coordinates=new f.default,this.renderer=new c.WebGLRenderer({preserveDrawingBuffer:!0,antialias:!0}),this.scene=new c.Scene,this.scene.background=new c.Color(203825),this.ground=new g.default,this.map=new b.default,this.adc=new m.default,this.adcMeshAddedToScene=!1,this.planningTrajectory=new _.default,this.perceptionObstacles=new E.default,this.decision=new T.default,this.prediction=new A.default,this.routing=new P.default,this.routingEditor=new L.default}return(0,s.default)(t,[{key:"initialize",value:function(t,e,n,r){this.options=r,this.canvasId=t,this.viewAngle=h.default.camera.viewAngle,this.viewDistance=h.default.camera.laneWidth*h.default.camera.laneWidthToViewDistanceRatio,this.camera=new c.PerspectiveCamera(h.default.camera[this.options.cameraAngle].fov,window.innerWidth/window.innerHeight,h.default.camera[this.options.cameraAngle].near,h.default.camera[this.options.cameraAngle].far),this.camera.name="camera",this.scene.add(this.camera),this.updateDimension(e,n),this.renderer.setPixelRatio(window.devicePixelRatio),document.getElementById(t).appendChild(this.renderer.domElement);var i=new c.AmbientLight(4473924),o=new c.DirectionalLight(16772829);o.position.set(0,0,1).normalize(),this.controls=new c.OrbitControls(this.camera,this.renderer.domElement),this.controls.enable=!1,this.onMouseDownHandler=this.editRoute.bind(this),this.scene.add(i),this.scene.add(o),this.animate()}},{key:"maybeInitializeOffest",value:function(t,e){this.coordinates.isInitialized()||this.coordinates.initialize(t,e)}},{key:"updateDimension",value:function(t,e){this.camera.aspect=t/e,this.camera.updateProjectionMatrix(),this.renderer.setSize(t,e)}},{key:"enableOrbitControls",value:function(){this.controls.enabled=!0,this.controls.enableRotate=!1,this.controls.reset(),this.controls.minDistance=20,this.controls.maxDistance=1e3;var t=this.adc.mesh.position;this.camera.position.set(t.x,t.y,50),this.camera.up.set(0,1,0),this.camera.lookAt(t.x,t.y,0)}},{key:"adjustCamera",value:function(t,e){if(this.routingEditor.isInEditingMode())return this.camera.up.set(0,1,0),void this.camera.lookAt(this.camera.position.x,this.camera.position.y,0);switch(this.camera.fov=h.default.camera[e].fov,this.camera.near=h.default.camera[e].near,this.camera.far=h.default.camera[e].far,e){case"Default":var n=this.viewDistance*Math.cos(t.rotation.y)*Math.cos(this.viewAngle),r=this.viewDistance*Math.sin(t.rotation.y)*Math.cos(this.viewAngle),i=this.viewDistance*Math.sin(this.viewAngle);this.camera.position.x=t.position.x-n,this.camera.position.y=t.position.y-r,this.camera.position.z=t.position.z+i,this.camera.up.set(0,0,1),this.camera.lookAt({x:t.position.x+2*n,y:t.position.y+2*r,z:0}),this.controls.enabled=!1;break;case"Near":n=.5*this.viewDistance*Math.cos(t.rotation.y)*Math.cos(this.viewAngle),r=.5*this.viewDistance*Math.sin(t.rotation.y)*Math.cos(this.viewAngle),i=.5*this.viewDistance*Math.sin(this.viewAngle),this.camera.position.x=t.position.x-n,this.camera.position.y=t.position.y-r,this.camera.position.z=t.position.z+i,this.camera.up.set(0,0,1),this.camera.lookAt({x:t.position.x+2*n,y:t.position.y+2*r,z:0}),this.controls.enabled=!1;break;case"Overhead":r=.5*this.viewDistance*Math.sin(t.rotation.y)*Math.cos(this.viewAngle),i=2*this.viewDistance*Math.sin(this.viewAngle),this.camera.position.x=t.position.x,this.camera.position.y=t.position.y+r,this.camera.position.z=2*(t.position.z+i),this.camera.up.set(0,1,0),this.camera.lookAt({x:t.position.x,y:t.position.y+r,z:0}),this.controls.enabled=!1;break;case"Map":this.controls.enabled?(this.camera.up.set(0,1,0),this.camera.lookAt(this.camera.position.x,this.camera.position.y,0)):this.enableOrbitControls()}this.camera.updateProjectionMatrix()}},{key:"enableRouteEditing",value:function(){this.enableOrbitControls(),this.routingEditor.enableEditingMode(this.camera,this.adc),document.getElementById(this.canvasId).addEventListener("mousedown",this.onMouseDownHandler,!1)}},{key:"disableRouteEditing",value:function(){this.routingEditor.disableEditingMode(this.scene),document.getElementById(this.canvasId).removeEventListener("mousedown",this.onMouseDownHandler,!1)}},{key:"removeAllRoutingPoints",value:function(){this.routingEditor.removeAllRoutePoints(this.scene)}},{key:"removeLastRoutingPoint",value:function(){this.routingEditor.removeLastRoutingPoint(this.scene)}},{key:"sendRoutingRequest",value:function(){return arguments.length>0&&void 0!==arguments[0]&&arguments[0]?this.routingEditor.sendDefaultRoutingRequest(this.adc.mesh.position,this.coordinates):this.routingEditor.sendRoutingRequest(this.Scene,this.adc.mesh.position,this.coordinates)}},{key:"editRoute",value:function(t){this.routingEditor.isInEditingMode()&&t.button===c.MOUSE.LEFT&&this.coordinates.isInitialized()&&this.ground.mesh&&this.routingEditor.addRoutingPoint(t,this.camera,this.ground,this.scene)}},{key:"render",value:function(){this.coordinates.isInitialized()&&this.adc.mesh&&this.ground.mesh&&(this.adcMeshAddedToScene||(this.adcMeshAddedToScene=!0,this.adc.mesh.name="adc",this.scene.add(this.adc.mesh)),this.ground.initialized||(this.ground.initialize(this.coordinates),this.ground.mesh.name="ground",this.scene.add(this.ground.mesh)),this.adjustCamera(this.adc.mesh,this.options.cameraAngle),this.renderer.render(this.scene,this.camera))}},{key:"animate",value:function(){var t=this;requestAnimationFrame(function(){t.animate()}),this.render()}},{key:"updateWorld",value:function(t){this.adc.update(t,this.coordinates),this.planningTrajectory.update(t,this.coordinates,this.scene),this.perceptionObstacles.update(t,this.coordinates,this.scene),this.decision.update(t,this.coordinates,this.scene),this.prediction.update(t,this.coordinates,this.scene),this.routing.update(t,this.coordinates,this.scene)}},{key:"updateMap",value:function(t){this.map.appendMapData(t,this.coordinates,this.scene)}},{key:"updateMapIndex",value:function(t,e,n){this.routingEditor.isInEditingMode()&&this.routingEditor.EDITING_MAP_RADIUS!==n||this.map.updateIndex(t,e,this.scene)}}]),t}(),I=new O;e.default=I},function(t,e){e.f={}.propertyIsEnumerable},function(t,e){t.exports=function(t,e){return{enumerable:!(1&t),configurable:!(2&t),writable:!(4&t),value:e}}},function(t,e,n){var r=n(66);t.exports=function(t){return Object(r(t))}},function(t,e){var n=0,r=Math.random();t.exports=function(t){return"Symbol(".concat(void 0===t?"":t,")_",(++n+r).toString(36))}},function(t,e,n){"use strict";var r={};t.exports=r},function(t,e,n){"use strict";function r(t){return Object.prototype.hasOwnProperty.call(t,m)||(t[m]=f++,h[t[m]]={}),h[t[m]]}var i,o=n(5),a=n(84),s=n(288),u=n(129),c=n(320),l=n(95),h={},p=!1,f=0,d={topAbort:"abort",topAnimationEnd:c("animationend")||"animationend",topAnimationIteration:c("animationiteration")||"animationiteration",topAnimationStart:c("animationstart")||"animationstart",topBlur:"blur",topCanPlay:"canplay",topCanPlayThrough:"canplaythrough",topChange:"change",topClick:"click",topCompositionEnd:"compositionend",topCompositionStart:"compositionstart",topCompositionUpdate:"compositionupdate",topContextMenu:"contextmenu",topCopy:"copy",topCut:"cut",topDoubleClick:"dblclick",topDrag:"drag",topDragEnd:"dragend",topDragEnter:"dragenter",topDragExit:"dragexit",topDragLeave:"dragleave",topDragOver:"dragover",topDragStart:"dragstart",topDrop:"drop",topDurationChange:"durationchange",topEmptied:"emptied",topEncrypted:"encrypted",topEnded:"ended",topError:"error",topFocus:"focus",topInput:"input",topKeyDown:"keydown",topKeyPress:"keypress",topKeyUp:"keyup",topLoadedData:"loadeddata",topLoadedMetadata:"loadedmetadata",topLoadStart:"loadstart",topMouseDown:"mousedown",topMouseMove:"mousemove",topMouseOut:"mouseout",topMouseOver:"mouseover",topMouseUp:"mouseup",topPaste:"paste",topPause:"pause",topPlay:"play",topPlaying:"playing",topProgress:"progress",topRateChange:"ratechange",topScroll:"scroll",topSeeked:"seeked",topSeeking:"seeking",topSelectionChange:"selectionchange",topStalled:"stalled",topSuspend:"suspend",topTextInput:"textInput",topTimeUpdate:"timeupdate",topTouchCancel:"touchcancel",topTouchEnd:"touchend",topTouchMove:"touchmove",topTouchStart:"touchstart",topTransitionEnd:c("transitionend")||"transitionend",topVolumeChange:"volumechange",topWaiting:"waiting",topWheel:"wheel"},m="_reactListenersID"+String(Math.random()).slice(2),v=o({},s,{ReactEventListener:null,injection:{injectReactEventListener:function(t){t.setHandleTopLevel(v.handleTopLevel),v.ReactEventListener=t}},setEnabled:function(t){v.ReactEventListener&&v.ReactEventListener.setEnabled(t)},isEnabled:function(){return!(!v.ReactEventListener||!v.ReactEventListener.isEnabled())},listenTo:function(t,e){for(var n=e,i=r(n),o=a.registrationNameDependencies[t],s=0;s]/;t.exports=i},function(t,e,n){"use strict";var r,i=n(13),o=n(83),a=/^[ \r\n\t\f]/,s=/<(!--|link|noscript|meta|script|style)[ \r\n\t\f\/>]/,u=n(91),c=u(function(t,e){if(t.namespaceURI!==o.svg||"innerHTML"in t)t.innerHTML=e;else{r=r||document.createElement("div"),r.innerHTML=""+e+"";for(var n=r.firstChild;n.firstChild;)t.appendChild(n.firstChild)}});if(i.canUseDOM){var l=document.createElement("div");l.innerHTML=" ",""===l.innerHTML&&(c=function(t,e){if(t.parentNode&&t.parentNode.replaceChild(t,t),a.test(e)||"<"===e[0]&&s.test(e)){t.innerHTML=String.fromCharCode(65279)+e;var n=t.firstChild;1===n.data.length?t.removeChild(n):n.deleteData(0,1)}else t.innerHTML=e}),l=null}t.exports=c},function(t,e,n){"use strict";t.exports=n(273)},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{default:t}}function i(t,e,n,r){function i(t){if(r){var e=t.clone();r(e)}}p[e]?i(p[e]):l.load(t,function(t){var r=new s.OBJLoader;t.preload(),r.setMaterials(t),r.load(e,function(t){t.name=e,t.scale.set(n.x,n.y,n.z),p[e]=t,i(t)})})}function o(t,e){h.load(t,e)}Object.defineProperty(e,"__esModule",{value:!0}),e.loadObject=i,e.loadTexture=o;var a=n(8),s=function(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e.default=t,e}(a),u=n(409),c=(r(u),n(408)),l=(r(c),new s.MTLLoader),h=new s.TextureLoader,p={}},function(t,e){t.exports=function(t){if(void 0==t)throw TypeError("Can't call method on "+t);return t}},function(t,e){t.exports="constructor,hasOwnProperty,isPrototypeOf,propertyIsEnumerable,toLocaleString,toString,valueOf".split(",")},function(t,e){t.exports={}},function(t,e){t.exports=!0},function(t,e,n){var r=n(44),i=n(213),o=n(67),a=n(75)("IE_PROTO"),s=function(){},u=function(){var t,e=n(105)("iframe"),r=o.length;for(e.style.display="none",n(206).appendChild(e),e.src="javascript:",t=e.contentWindow.document,t.open(),t.write("