From 242cc5279bcddbece8050926961086c838505de6 Mon Sep 17 00:00:00 2001 From: Jiangtao Hu Date: Sat, 16 Dec 2017 09:41:05 -0800 Subject: [PATCH] dreamview: lock planning acc in range [-4, 2] --- modules/dreamview/frontend/dist/app.bundle.js | 40 ++++++++++++++++--- .../dreamview/frontend/dist/app.bundle.js.map | 2 +- .../frontend/src/store/config/graph.yml | 8 ++-- 3 files changed, 41 insertions(+), 9 deletions(-) diff --git a/modules/dreamview/frontend/dist/app.bundle.js b/modules/dreamview/frontend/dist/app.bundle.js index 5f23c70b54..f17ca10fc9 100644 --- a/modules/dreamview/frontend/dist/app.bundle.js +++ b/modules/dreamview/frontend/dist/app.bundle.js @@ -1,22 +1,52 @@ -!function(e){function t(r){if(n[r])return n[r].exports;var i=n[r]={i:r,l:!1,exports:{}};return e[r].call(i.exports,i,i.exports,t),i.l=!0,i.exports}var n={};t.m=e,t.c=n,t.i=function(e){return e},t.d=function(e,n,r){t.o(e,n)||Object.defineProperty(e,n,{configurable:!1,enumerable:!0,get:r})},t.n=function(e){var n=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(n,"a",n),n},t.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},t.p="/",t(t.s=119)}([function(e,t,n){"use strict";t.__esModule=!0,t.default=function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}},function(e,t,n){"use strict";t.__esModule=!0;var r=n(13),i=function(e){return e&&e.__esModule?e:{default:e}}(r);t.default=function(){function e(e,t){for(var n=0;n6?s-6:0),u=6;u>",a=a||r,null==n[r]){if(t){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 e.apply(void 0,[n,r,i,o,a].concat(l))})}var n=t.bind(null,!1);return n.isRequired=t.bind(null,!0),n}function i(e,t){return"symbol"===e||("Symbol"===t["@@toStringTag"]||"function"==typeof Symbol&&t instanceof Symbol)}function o(e){var t=void 0===e?"undefined":u(e);return Array.isArray(e)?"array":e instanceof RegExp?"object":i(t,e)?"symbol":t}function a(e){var t=o(e);if("object"===t){if(e instanceof Date)return"date";if(e instanceof RegExp)return"regexp"}return t}function s(e,t){return r(function(n,r,i,s,l){return(0,c.untracked)(function(){if(e&&o(n[r])===t.toLowerCase())return null;var s=void 0;switch(t){case"Array":s=c.isObservableArray;break;case"Object":s=c.isObservableObject;break;case"Map":s=c.isObservableMap;break;default:throw new Error("Unexpected mobxType: "+t)}var u=n[r];if(!s(u)){var d=a(u),h=e?" or javascript `"+t.toLowerCase()+"`":"";return new Error("Invalid prop `"+l+"` of type `"+d+"` supplied to `"+i+"`, expected `mobx.Observable"+t+"`"+h+".")}return null})})}function l(e,t){return r(function(n,r,i,o,a){for(var l=arguments.length,u=Array(l>5?l-5:0),d=5;d2&&void 0!==arguments[2]&&arguments[2],r=e[t],i=R[t],o=r?!0===n?function(){i.apply(this,arguments),r.apply(this,arguments)}:function(){r.apply(this,arguments),i.apply(this,arguments)}:i;e[t]=o}function h(e,t){if(null==e||null==t||"object"!==(void 0===e?"undefined":g(e))||"object"!==(void 0===t?"undefined":g(t)))return e!==t;var n=Object.keys(e);if(n.length!==Object.keys(t).length)return!0;for(var r=void 0,i=n.length-1;r=n[i];i--)if(t[r]!==e[r])return!0;return!1}function f(e,t){if("string"==typeof e)throw new Error("Store names should be provided as array");if(Array.isArray(e))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`')),t?T.default.apply(null,e)(f(t)):function(t){return f(e,t)};var n=e;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(e){function t(){return i(this,t),o(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments))}return a(t,e),m(t,[{key:"render",value:function(){return n.call(this,this.props,this.context)}}]),t}(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 p(n.prototype||n),n.isMobXReactObserver=!0,n}function p(e){d(e,"componentWillMount",!0),["componentDidMount","componentWillUnmount","componentDidUpdate"].forEach(function(t){d(e,t)}),e.shouldComponentUpdate||(e.shouldComponentUpdate=R.shouldComponentUpdate)}Object.defineProperty(t,"__esModule",{value:!0}),t.Observer=t.renderReporter=t.componentByNodeRegistery=void 0;var m=function(){function e(e,t){for(var n=0;n",r=this._reactInternalInstance&&this._reactInternalInstance._rootNodeID,i=!1,o=!1;e.call(this,"props"),e.call(this,"state");var a=this.render.bind(this),s=null,l=!1,u=function(){return s=new v.Reaction(n+"#"+r+".render()",function(){if(!l&&(l=!0,"function"==typeof t.componentWillReact&&t.componentWillReact(),!0!==t.__$mobxIsUnmounted)){var e=!0;try{o=!0,i||b.default.Component.prototype.forceUpdate.call(t),e=!1}finally{o=!1,e&&s.dispose()}}}),c.$mobx=s,t.render=c,c()},c=function(){l=!1;var e=void 0,n=void 0;if(s.track(function(){k&&(t.__$mobRenderStart=Date.now());try{n=v.extras.allowStateChanges(!1,a)}catch(t){e=t}k&&(t.__$mobRenderEnd=Date.now())}),e)throw e;return n};this.render=u}},componentWillUnmount:function(){if(!0!==C&&(this.render.$mobx&&this.render.$mobx.dispose(),this.__$mobxIsUnmounted=!0,k)){var e=s(this);e&&O&&O.delete(e),A.emit({event:"destroy",component:this,node:e})}},componentDidMount:function(){k&&l(this)},componentDidUpdate:function(){k&&l(this)},shouldComponentUpdate:function(e,t){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!==t||h(this.props,e)}};(t.Observer=f(function(e){return(0,e.children)()})).propTypes={children:function(e,t,n,r,i){if("function"!=typeof e[t])return new Error("Invalid prop `"+i+"` of type `"+g(e[t])+"` supplied to `"+n+"`, expected `function`.")}}},function(e,t){e.exports=n},function(e,t,n){"use strict";function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function o(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var a,s,l=function(){function e(e,t){for(var n=0;n0&&console.error("THREE.Matrix4: the constructor no longer reads arguments. use .set() instead.")}function h(e,t,n,r,i,a,s,l,u,c){e=void 0!==e?e:[],t=void 0!==t?t:ea,o.call(this,e,t,n,r,i,a,s,l,u,c),this.flipY=!1}function f(){this.seq=[],this.map={}}function p(e,t,n){var r=e[0];if(r<=0||r>0)return e;var i=t*n,o=vs[i];if(void 0===o&&(o=new Float32Array(i),vs[i]=o),0!==t){r.toArray(o,0);for(var a=1,s=0;a!==t;++a)s+=n,e[a].toArray(o,s)}return o}function m(e,t){var n=ys[t];void 0===n&&(n=new Int32Array(t),ys[t]=n);for(var r=0;r!==t;++r)n[r]=e.allocTextureUnit();return n}function g(e,t){e.uniform1f(this.addr,t)}function v(e,t){e.uniform1i(this.addr,t)}function y(e,t){void 0===t.x?e.uniform2fv(this.addr,t):e.uniform2f(this.addr,t.x,t.y)}function b(e,t){void 0!==t.x?e.uniform3f(this.addr,t.x,t.y,t.z):void 0!==t.r?e.uniform3f(this.addr,t.r,t.g,t.b):e.uniform3fv(this.addr,t)}function x(e,t){void 0===t.x?e.uniform4fv(this.addr,t):e.uniform4f(this.addr,t.x,t.y,t.z,t.w)}function _(e,t){e.uniformMatrix2fv(this.addr,!1,t.elements||t)}function w(e,t){e.uniformMatrix3fv(this.addr,!1,t.elements||t)}function M(e,t){e.uniformMatrix4fv(this.addr,!1,t.elements||t)}function S(e,t,n){var r=n.allocTextureUnit();e.uniform1i(this.addr,r),n.setTexture2D(t||ms,r)}function E(e,t,n){var r=n.allocTextureUnit();e.uniform1i(this.addr,r),n.setTextureCube(t||gs,r)}function T(e,t){e.uniform2iv(this.addr,t)}function k(e,t){e.uniform3iv(this.addr,t)}function C(e,t){e.uniform4iv(this.addr,t)}function P(e){switch(e){case 5126:return g;case 35664:return y;case 35665:return b;case 35666:return x;case 35674:return _;case 35675:return w;case 35676:return M;case 35678:return S;case 35680:return E;case 5124:case 35670:return v;case 35667:case 35671:return T;case 35668:case 35672:return k;case 35669:case 35673:return C}}function O(e,t){e.uniform1fv(this.addr,t)}function A(e,t){e.uniform1iv(this.addr,t)}function R(e,t){e.uniform2fv(this.addr,p(t,this.size,2))}function L(e,t){e.uniform3fv(this.addr,p(t,this.size,3))}function D(e,t){e.uniform4fv(this.addr,p(t,this.size,4))}function I(e,t){e.uniformMatrix2fv(this.addr,!1,p(t,this.size,4))}function z(e,t){e.uniformMatrix3fv(this.addr,!1,p(t,this.size,9))}function N(e,t){e.uniformMatrix4fv(this.addr,!1,p(t,this.size,16))}function F(e,t,n){var r=t.length,i=m(n,r);e.uniform1iv(this.addr,i);for(var o=0;o!==r;++o)n.setTexture2D(t[o]||ms,i[o])}function B(e,t,n){var r=t.length,i=m(n,r);e.uniform1iv(this.addr,i);for(var o=0;o!==r;++o)n.setTextureCube(t[o]||gs,i[o])}function U(e){switch(e){case 5126:return O;case 35664:return R;case 35665:return L;case 35666:return D;case 35674:return I;case 35675:return z;case 35676:return N;case 35678:return F;case 35680:return B;case 5124:case 35670:return A;case 35667:case 35671:return T;case 35668:case 35672:return k;case 35669:case 35673:return C}}function j(e,t,n){this.id=e,this.addr=n,this.setValue=P(t.type)}function W(e,t,n){this.id=e,this.addr=n,this.size=t.size,this.setValue=U(t.type)}function V(e){this.id=e,f.call(this)}function H(e,t){e.seq.push(t),e.map[t.id]=t}function G(e,t,n){var r=e.name,i=r.length;for(bs.lastIndex=0;;){var o=bs.exec(r),a=bs.lastIndex,s=o[1],l="]"===o[2],u=o[3];if(l&&(s|=0),void 0===u||"["===u&&a+2===i){H(n,void 0===u?new j(s,e,t):new W(s,e,t));break}var c=n.map,d=c[s];void 0===d&&(d=new V(s),H(n,d)),n=d}}function Y(e,t,n){f.call(this),this.renderer=n;for(var r=e.getProgramParameter(t,e.ACTIVE_UNIFORMS),i=0;i.001&&A.scale>.001&&(M.x=A.x,M.y=A.y,M.z=A.z,_=A.size*A.scale/g.w,w.x=_*y,w.y=_,p.uniform3f(d.screenPosition,M.x,M.y,M.z),p.uniform2f(d.scale,w.x,w.y),p.uniform1f(d.rotation,A.rotation),p.uniform1f(d.opacity,A.opacity),p.uniform3f(d.color,A.color.r,A.color.g,A.color.b),m.setBlending(A.blending,A.blendEquation,A.blendSrc,A.blendDst),e.setTexture2D(A.texture,1),p.drawElements(p.TRIANGLES,6,p.UNSIGNED_SHORT,0))}}}m.enable(p.CULL_FACE),m.enable(p.DEPTH_TEST),m.setDepthWrite(!0),e.resetGLState()}}}function J(e,t){function n(){var e=new Float32Array([-.5,-.5,0,0,.5,-.5,1,0,.5,.5,1,1,-.5,.5,0,1]),t=new Uint16Array([0,1,2,0,2,3]);a=p.createBuffer(),s=p.createBuffer(),p.bindBuffer(p.ARRAY_BUFFER,a),p.bufferData(p.ARRAY_BUFFER,e,p.STATIC_DRAW),p.bindBuffer(p.ELEMENT_ARRAY_BUFFER,s),p.bufferData(p.ELEMENT_ARRAY_BUFFER,t,p.STATIC_DRAW),l=r(),d={position:p.getAttribLocation(l,"position"),uv:p.getAttribLocation(l,"uv")},h={uvOffset:p.getUniformLocation(l,"uvOffset"),uvScale:p.getUniformLocation(l,"uvScale"),rotation:p.getUniformLocation(l,"rotation"),scale:p.getUniformLocation(l,"scale"),color:p.getUniformLocation(l,"color"),map:p.getUniformLocation(l,"map"),opacity:p.getUniformLocation(l,"opacity"),modelViewMatrix:p.getUniformLocation(l,"modelViewMatrix"),projectionMatrix:p.getUniformLocation(l,"projectionMatrix"),fogType:p.getUniformLocation(l,"fogType"),fogDensity:p.getUniformLocation(l,"fogDensity"),fogNear:p.getUniformLocation(l,"fogNear"),fogFar:p.getUniformLocation(l,"fogFar"),fogColor:p.getUniformLocation(l,"fogColor"),alphaTest:p.getUniformLocation(l,"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 t=p.createProgram(),n=p.createShader(p.VERTEX_SHADER),r=p.createShader(p.FRAGMENT_SHADER);return p.shaderSource(n,["precision "+e.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")),p.shaderSource(r,["precision "+e.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")),p.compileShader(n),p.compileShader(r),p.attachShader(t,n),p.attachShader(t,r),p.linkProgram(t),t}function i(e,t){return e.renderOrder!==t.renderOrder?e.renderOrder-t.renderOrder:e.z!==t.z?t.z-e.z:t.id-e.id}var a,s,l,d,h,f,p=e.context,m=e.state,g=new c,v=new u,y=new c;this.render=function(r,o){if(0!==t.length){void 0===l&&n(),p.useProgram(l),m.initAttributes(),m.enableAttribute(d.position),m.enableAttribute(d.uv),m.disableUnusedAttributes(),m.disable(p.CULL_FACE),m.enable(p.BLEND),p.bindBuffer(p.ARRAY_BUFFER,a),p.vertexAttribPointer(d.position,2,p.FLOAT,!1,16,0),p.vertexAttribPointer(d.uv,2,p.FLOAT,!1,16,8),p.bindBuffer(p.ELEMENT_ARRAY_BUFFER,s),p.uniformMatrix4fv(h.projectionMatrix,!1,o.projectionMatrix.elements),m.activeTexture(p.TEXTURE0),p.uniform1i(h.map,0);var u=0,c=0,b=r.fog;b?(p.uniform3f(h.fogColor,b.color.r,b.color.g,b.color.b),b.isFog?(p.uniform1f(h.fogNear,b.near),p.uniform1f(h.fogFar,b.far),p.uniform1i(h.fogType,1),u=1,c=1):b.isFogExp2&&(p.uniform1f(h.fogDensity,b.density),p.uniform1i(h.fogType,2),u=2,c=2)):(p.uniform1i(h.fogType,0),u=0,c=0);for(var x=0,_=t.length;x<_;x++){var w=t[x];w.modelViewMatrix.multiplyMatrices(o.matrixWorldInverse,w.matrixWorld),w.z=-w.modelViewMatrix.elements[14]}t.sort(i);for(var M=[],x=0,_=t.length;x<_;x++){var w=t[x],S=w.material;if(!1!==S.visible){p.uniform1f(h.alphaTest,S.alphaTest),p.uniformMatrix4fv(h.modelViewMatrix,!1,w.modelViewMatrix.elements),w.matrixWorld.decompose(g,v,y),M[0]=y.x,M[1]=y.y;var E=0;r.fog&&S.fog&&(E=c),u!==E&&(p.uniform1i(h.fogType,E),u=E),null!==S.map?(p.uniform2f(h.uvOffset,S.map.offset.x,S.map.offset.y),p.uniform2f(h.uvScale,S.map.repeat.x,S.map.repeat.y)):(p.uniform2f(h.uvOffset,0,0),p.uniform2f(h.uvScale,1,1)),p.uniform1f(h.opacity,S.opacity),p.uniform3f(h.color,S.color.r,S.color.g,S.color.b),p.uniform1f(h.rotation,S.rotation),p.uniform2fv(h.scale,M),m.setBlending(S.blending,S.blendEquation,S.blendSrc,S.blendDst),m.setDepthTest(S.depthTest),m.setDepthWrite(S.depthWrite),S.map?e.setTexture2D(S.map,0):e.setTexture2D(f,0),p.drawElements(p.TRIANGLES,6,p.UNSIGNED_SHORT,0)}}m.enable(p.CULL_FACE),e.resetGLState()}}}function $(){Object.defineProperty(this,"id",{value:Es++}),this.uuid=fs.generateUUID(),this.name="",this.type="Material",this.fog=!0,this.lights=!0,this.blending=go,this.side=ao,this.shading=co,this.vertexColors=ho,this.opacity=1,this.transparent=!1,this.blendSrc=Oo,this.blendDst=Ao,this.blendEquation=_o,this.blendSrcAlpha=null,this.blendDstAlpha=null,this.blendEquationAlpha=null,this.depthFunc=Uo,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(e){$.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!==e&&(void 0!==e.attributes&&console.error("THREE.ShaderMaterial: attributes should now be defined in THREE.BufferGeometry instead."),this.setValues(e))}function ee(e){$.call(this),this.type="MeshDepthMaterial",this.depthPacking=ds,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(e)}function te(e,t){this.min=void 0!==e?e:new c(1/0,1/0,1/0),this.max=void 0!==t?t:new c(-1/0,-1/0,-1/0)}function ne(e,t){this.center=void 0!==e?e:new c,this.radius=void 0!==t?t:0}function re(){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 ie(e,t){this.normal=void 0!==e?e:new c(1,0,0),this.constant=void 0!==t?t:0}function oe(e,t,n,r,i,o){this.planes=[void 0!==e?e:new ie,void 0!==t?t:new ie,void 0!==n?n:new ie,void 0!==r?r:new ie,void 0!==i?i:new ie,void 0!==o?o:new ie]}function ae(e,t,n,r){function o(t,n,r,i){var o=t.geometry,a=null,s=S,l=t.customDepthMaterial;if(r&&(s=E,l=t.customDistanceMaterial),l)a=l;else{var u=!1;n.morphTargets&&(o&&o.isBufferGeometry?u=o.morphAttributes&&o.morphAttributes.position&&o.morphAttributes.position.length>0:o&&o.isGeometry&&(u=o.morphTargets&&o.morphTargets.length>0));var c=t.isSkinnedMesh&&n.skinning,d=0;u&&(d|=_),c&&(d|=w),a=s[d]}if(e.localClippingEnabled&&!0===n.clipShadows&&0!==n.clippingPlanes.length){var h=a.uuid,f=n.uuid,p=T[h];void 0===p&&(p={},T[h]=p);var m=p[f];void 0===m&&(m=a.clone(),p[f]=m),a=m}a.visible=n.visible,a.wireframe=n.wireframe;var g=n.side;return F.renderSingleSided&&g==lo&&(g=ao),F.renderReverseSided&&(g===ao?g=so:g===so&&(g=ao)),a.side=g,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 l(e,t,n){if(!1!==e.visible){if(0!=(e.layers.mask&t.layers.mask)&&(e.isMesh||e.isLine||e.isPoints)&&e.castShadow&&(!1===e.frustumCulled||!0===f.intersectsObject(e))){!0===e.material.visible&&(e.modelViewMatrix.multiplyMatrices(n.matrixWorldInverse,e.matrixWorld),x.push(e))}for(var r=e.children,i=0,o=r.length;in&&(n=e[t]);return n}function ke(){return ks++}function Ce(){Object.defineProperty(this,"id",{value:ke()}),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 Pe(){Object.defineProperty(this,"id",{value:ke()}),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 Oe(e,t){ce.call(this),this.type="Mesh",this.geometry=void 0!==e?e:new Pe,this.material=void 0!==t?t:new pe({color:16777215*Math.random()}),this.drawMode=es,this.updateMorphTargets()}function Ae(e,t,n,r,i,o){Ce.call(this),this.type="BoxGeometry",this.parameters={width:e,height:t,depth:n,widthSegments:r,heightSegments:i,depthSegments:o},this.fromBufferGeometry(new Re(e,t,n,r,i,o)),this.mergeVertices()}function Re(e,t,n,r,i,o){function a(e,t,n,r,i,o,a,m,g,v,y){var b,x,_=o/g,w=a/v,M=o/2,S=a/2,E=m/2,T=g+1,k=v+1,C=0,P=0,O=new c;for(x=0;x0?1:-1,d.push(O.x,O.y,O.z),h.push(b/g),h.push(1-x/v),C+=1}}for(x=0;x");return $e(n)}var n=/#include +<([\w\d.]+)>/g;return e.replace(n,t)}function Qe(e){function t(e,t,n,r){for(var i="",o=parseInt(t);o0?e.gammaFactor:1,g=Xe(o,r,e.extensions),v=qe(a),y=i.createProgram();n.isRawShaderMaterial?(f=[v,"\n"].filter(Ke).join("\n"),p=[g,v,"\n"].filter(Ke).join("\n")):(f=["precision "+r.precision+" float;","precision "+r.precision+" int;","#define SHADER_NAME "+n.__webglShader.name,v,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 "+d:"",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 "+u:"",r.sizeAttenuation?"#define USE_SIZEATTENUATION":"",r.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",r.logarithmicDepthBuffer&&e.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(Ke).join("\n"),p=[g,"precision "+r.precision+" float;","precision "+r.precision+" int;","#define SHADER_NAME "+n.__webglShader.name,v,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 "+c:"",r.envMap?"#define "+d:"",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.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 "+u:"",r.premultipliedAlpha?"#define PREMULTIPLIED_ALPHA":"",r.physicallyCorrectLights?"#define PHYSICALLY_CORRECT_LIGHTS":"",r.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",r.logarithmicDepthBuffer&&e.extensions.get("EXT_frag_depth")?"#define USE_LOGDEPTHBUF_EXT":"",r.envMap&&e.extensions.get("EXT_shader_texture_lod")?"#define TEXTURE_LOD_EXT":"","uniform mat4 viewMatrix;","uniform vec3 cameraPosition;",r.toneMapping!==qo?"#define TONE_MAPPING":"",r.toneMapping!==qo?_s.tonemapping_pars_fragment:"",r.toneMapping!==qo?Ye("toneMapping",r.toneMapping):"",r.outputEncoding||r.mapEncoding||r.envMapEncoding||r.emissiveMapEncoding?_s.encodings_pars_fragment:"",r.mapEncoding?He("mapTexelToLinear",r.mapEncoding):"",r.envMapEncoding?He("envMapTexelToLinear",r.envMapEncoding):"",r.emissiveMapEncoding?He("emissiveMapTexelToLinear",r.emissiveMapEncoding):"",r.outputEncoding?Ge("linearToOutputTexel",r.outputEncoding):"",r.depthPacking?"#define DEPTH_PACKING "+n.depthPacking:"","\n"].filter(Ke).join("\n")),s=$e(s,r),s=Je(s,r),l=$e(l,r),l=Je(l,r),n.isShaderMaterial||(s=Qe(s),l=Qe(l));var b=f+s,x=p+l,_=We(i,i.VERTEX_SHADER,b),w=We(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 M=i.getProgramInfoLog(y),S=i.getShaderInfoLog(_),E=i.getShaderInfoLog(w),T=!0,k=!0;!1===i.getProgramParameter(y,i.LINK_STATUS)?(T=!1,console.error("THREE.WebGLProgram: shader error: ",i.getError(),"gl.VALIDATE_STATUS",i.getProgramParameter(y,i.VALIDATE_STATUS),"gl.getProgramInfoLog",M,S,E)):""!==M?console.warn("THREE.WebGLProgram: gl.getProgramInfoLog()",M):""!==S&&""!==E||(k=!1),k&&(this.diagnostics={runnable:T,material:n,programLog:M,vertexShader:{log:S,prefix:f},fragmentShader:{log:E,prefix:p}}),i.deleteShader(_),i.deleteShader(w);var C;this.getUniforms=function(){return void 0===C&&(C=new Y(i,y,e)),C};var P;return this.getAttributes=function(){return void 0===P&&(P=Ze(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=t,this.usedTimes=1,this.program=y,this.vertexShader=_,this.fragmentShader=w,this}function tt(e,t){function n(e){if(t.floatVertexTextures&&e&&e.skeleton&&e.skeleton.useVertexTexture)return 1024;var n=t.maxVertexUniforms,r=Math.floor((n-20)/4),i=r;return void 0!==e&&e&&e.isSkinnedMesh&&(i=Math.min(e.skeleton.bones.length,i))0,shadowMapType:e.shadowMap.type,toneMapping:e.toneMapping,physicallyCorrectLights:e.physicallyCorrectLights,premultipliedAlpha:i.premultipliedAlpha,alphaTest:i.alphaTest,doubleSided:i.side===lo,flipSided:i.side===so,depthPacking:void 0!==i.depthPacking&&i.depthPacking}},this.getProgramCode=function(e,t){var n=[];if(t.shaderID?n.push(t.shaderID):(n.push(e.fragmentShader),n.push(e.vertexShader)),void 0!==e.defines)for(var r in e.defines)n.push(r),n.push(e.defines[r]);for(var i=0;i65535?we:xe)(o,1);return i(p,e.ELEMENT_ARRAY_BUFFER),r.wireframe=p,p}var c=new nt(e,t,n);return{getAttributeBuffer:s,getAttributeProperties:l,getWireframeAttribute:u,update:r}}function it(e,t,n,r,i,o,a){function s(e,t){if(e.width>t||e.height>t){var n=t/Math.max(e.width,e.height),r=document.createElementNS("http://www.w3.org/1999/xhtml","canvas");r.width=Math.floor(e.width*n),r.height=Math.floor(e.height*n);return r.getContext("2d").drawImage(e,0,0,e.width,e.height,0,0,r.width,r.height),console.warn("THREE.WebGLRenderer: image is too big ("+e.width+"x"+e.height+"). Resized to "+r.width+"x"+r.height,e),r}return e}function l(e){return fs.isPowerOfTwo(e.width)&&fs.isPowerOfTwo(e.height)}function u(e){if(e instanceof HTMLImageElement||e instanceof HTMLCanvasElement){var t=document.createElementNS("http://www.w3.org/1999/xhtml","canvas");t.width=fs.nearestPowerOfTwo(e.width),t.height=fs.nearestPowerOfTwo(e.height);return t.getContext("2d").drawImage(e,0,0,t.width,t.height),console.warn("THREE.WebGLRenderer: image is not power of two ("+e.width+"x"+e.height+"). Resized to "+t.width+"x"+t.height,e),t}return e}function c(e){return e.wrapS!==la||e.wrapT!==la||e.minFilter!==ca&&e.minFilter!==fa}function d(t){return t===ca||t===da||t===ha?e.NEAREST:e.LINEAR}function h(e){var t=e.target;t.removeEventListener("dispose",h),p(t),k.textures--}function f(e){var t=e.target;t.removeEventListener("dispose",f),m(t),k.textures--}function p(t){var n=r.get(t);if(t.image&&n.__image__webglTextureCube)e.deleteTexture(n.__image__webglTextureCube);else{if(void 0===n.__webglInit)return;e.deleteTexture(n.__webglTexture)}r.delete(t)}function m(t){var n=r.get(t),i=r.get(t.texture);if(t){if(void 0!==i.__webglTexture&&e.deleteTexture(i.__webglTexture),t.depthTexture&&t.depthTexture.dispose(),t.isWebGLRenderTargetCube)for(var o=0;o<6;o++)e.deleteFramebuffer(n.__webglFramebuffer[o]),n.__webglDepthbuffer&&e.deleteRenderbuffer(n.__webglDepthbuffer[o]);else e.deleteFramebuffer(n.__webglFramebuffer),n.__webglDepthbuffer&&e.deleteRenderbuffer(n.__webglDepthbuffer);r.delete(t.texture),r.delete(t)}}function g(t,i){var o=r.get(t);if(t.version>0&&o.__version!==t.version){var a=t.image;if(void 0===a)console.warn("THREE.WebGLRenderer: Texture marked for update but image is undefined",t);else{if(!1!==a.complete)return void x(o,t,i);console.warn("THREE.WebGLRenderer: Texture marked for update but image is incomplete",t)}}n.activeTexture(e.TEXTURE0+i),n.bindTexture(e.TEXTURE_2D,o.__webglTexture)}function v(t,a){var u=r.get(t);if(6===t.image.length)if(t.version>0&&u.__version!==t.version){u.__image__webglTextureCube||(t.addEventListener("dispose",h),u.__image__webglTextureCube=e.createTexture(),k.textures++),n.activeTexture(e.TEXTURE0+a),n.bindTexture(e.TEXTURE_CUBE_MAP,u.__image__webglTextureCube),e.pixelStorei(e.UNPACK_FLIP_Y_WEBGL,t.flipY);for(var c=t&&t.isCompressedTexture,d=t.image[0]&&t.image[0].isDataTexture,f=[],p=0;p<6;p++)f[p]=c||d?d?t.image[p].image:t.image[p]:s(t.image[p],i.maxCubemapSize);var m=f[0],g=l(m),v=o(t.format),y=o(t.type);b(e.TEXTURE_CUBE_MAP,t,g);for(var p=0;p<6;p++)if(c)for(var x,_=f[p].mipmaps,w=0,M=_.length;w-1?n.compressedTexImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+p,w,v,x.width,x.height,0,x.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .setTextureCube()"):n.texImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+p,w,v,x.width,x.height,0,v,y,x.data);else d?n.texImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+p,0,v,f[p].width,f[p].height,0,v,y,f[p].data):n.texImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+p,0,v,v,y,f[p]);t.generateMipmaps&&g&&e.generateMipmap(e.TEXTURE_CUBE_MAP),u.__version=t.version,t.onUpdate&&t.onUpdate(t)}else n.activeTexture(e.TEXTURE0+a),n.bindTexture(e.TEXTURE_CUBE_MAP,u.__image__webglTextureCube)}function y(t,i){n.activeTexture(e.TEXTURE0+i),n.bindTexture(e.TEXTURE_CUBE_MAP,r.get(t).__webglTexture)}function b(n,a,s){var l;if(s?(e.texParameteri(n,e.TEXTURE_WRAP_S,o(a.wrapS)),e.texParameteri(n,e.TEXTURE_WRAP_T,o(a.wrapT)),e.texParameteri(n,e.TEXTURE_MAG_FILTER,o(a.magFilter)),e.texParameteri(n,e.TEXTURE_MIN_FILTER,o(a.minFilter))):(e.texParameteri(n,e.TEXTURE_WRAP_S,e.CLAMP_TO_EDGE),e.texParameteri(n,e.TEXTURE_WRAP_T,e.CLAMP_TO_EDGE),a.wrapS===la&&a.wrapT===la||console.warn("THREE.WebGLRenderer: Texture is not power of two. Texture.wrapS and Texture.wrapT should be set to THREE.ClampToEdgeWrapping.",a),e.texParameteri(n,e.TEXTURE_MAG_FILTER,d(a.magFilter)),e.texParameteri(n,e.TEXTURE_MIN_FILTER,d(a.minFilter)),a.minFilter!==ca&&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)),l=t.get("EXT_texture_filter_anisotropic")){if(a.type===wa&&null===t.get("OES_texture_float_linear"))return;if(a.type===Ma&&null===t.get("OES_texture_half_float_linear"))return;(a.anisotropy>1||r.get(a).__currentAnisotropy)&&(e.texParameterf(n,l.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(a.anisotropy,i.getMaxAnisotropy())),r.get(a).__currentAnisotropy=a.anisotropy)}}function x(t,r,a){void 0===t.__webglInit&&(t.__webglInit=!0,r.addEventListener("dispose",h),t.__webglTexture=e.createTexture(),k.textures++),n.activeTexture(e.TEXTURE0+a),n.bindTexture(e.TEXTURE_2D,t.__webglTexture),e.pixelStorei(e.UNPACK_FLIP_Y_WEBGL,r.flipY),e.pixelStorei(e.UNPACK_PREMULTIPLY_ALPHA_WEBGL,r.premultiplyAlpha),e.pixelStorei(e.UNPACK_ALIGNMENT,r.unpackAlignment);var d=s(r.image,i.maxTextureSize);c(r)&&!1===l(d)&&(d=u(d));var f=l(d),p=o(r.format),m=o(r.type);b(e.TEXTURE_2D,r,f);var g,v=r.mipmaps;if(r.isDepthTexture){var y=e.DEPTH_COMPONENT;if(r.type===wa){if(!C)throw new Error("Float Depth Texture only supported in WebGL2.0");y=e.DEPTH_COMPONENT32F}else C&&(y=e.DEPTH_COMPONENT16);r.format===Da&&y===e.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===Ia&&(y=e.DEPTH_STENCIL,r.type!==ka&&(console.warn("THREE.WebGLRenderer: Use UnsignedInt248Type for DepthStencilFormat DepthTexture."),r.type=ka,m=o(r.type))),n.texImage2D(e.TEXTURE_2D,0,y,d.width,d.height,0,p,m,null)}else if(r.isDataTexture)if(v.length>0&&f){for(var x=0,_=v.length;x<_;x++)g=v[x],n.texImage2D(e.TEXTURE_2D,x,p,g.width,g.height,0,p,m,g.data);r.generateMipmaps=!1}else n.texImage2D(e.TEXTURE_2D,0,p,d.width,d.height,0,p,m,d.data);else if(r.isCompressedTexture)for(var x=0,_=v.length;x<_;x++)g=v[x],r.format!==Oa&&r.format!==Pa?n.getCompressedTextureFormats().indexOf(p)>-1?n.compressedTexImage2D(e.TEXTURE_2D,x,p,g.width,g.height,0,g.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()"):n.texImage2D(e.TEXTURE_2D,x,p,g.width,g.height,0,p,m,g.data);else if(v.length>0&&f){for(var x=0,_=v.length;x<_;x++)g=v[x],n.texImage2D(e.TEXTURE_2D,x,p,p,m,g);r.generateMipmaps=!1}else n.texImage2D(e.TEXTURE_2D,0,p,p,m,d);r.generateMipmaps&&f&&e.generateMipmap(e.TEXTURE_2D),t.__version=r.version,r.onUpdate&&r.onUpdate(r)}function _(t,i,a,s){var l=o(i.texture.format),u=o(i.texture.type);n.texImage2D(s,0,l,i.width,i.height,0,l,u,null),e.bindFramebuffer(e.FRAMEBUFFER,t),e.framebufferTexture2D(e.FRAMEBUFFER,a,s,r.get(i.texture).__webglTexture,0),e.bindFramebuffer(e.FRAMEBUFFER,null)}function w(t,n){e.bindRenderbuffer(e.RENDERBUFFER,t),n.depthBuffer&&!n.stencilBuffer?(e.renderbufferStorage(e.RENDERBUFFER,e.DEPTH_COMPONENT16,n.width,n.height),e.framebufferRenderbuffer(e.FRAMEBUFFER,e.DEPTH_ATTACHMENT,e.RENDERBUFFER,t)):n.depthBuffer&&n.stencilBuffer?(e.renderbufferStorage(e.RENDERBUFFER,e.DEPTH_STENCIL,n.width,n.height),e.framebufferRenderbuffer(e.FRAMEBUFFER,e.DEPTH_STENCIL_ATTACHMENT,e.RENDERBUFFER,t)):e.renderbufferStorage(e.RENDERBUFFER,e.RGBA4,n.width,n.height),e.bindRenderbuffer(e.RENDERBUFFER,null)}function M(t,n){if(n&&n.isWebGLRenderTargetCube)throw new Error("Depth Texture with cube render targets is not supported!");if(e.bindFramebuffer(e.FRAMEBUFFER,t),!n.depthTexture||!n.depthTexture.isDepthTexture)throw new Error("renderTarget.depthTexture must be an instance of THREE.DepthTexture");r.get(n.depthTexture).__webglTexture&&n.depthTexture.image.width===n.width&&n.depthTexture.image.height===n.height||(n.depthTexture.image.width=n.width,n.depthTexture.image.height=n.height,n.depthTexture.needsUpdate=!0),g(n.depthTexture,0);var i=r.get(n.depthTexture).__webglTexture;if(n.depthTexture.format===Da)e.framebufferTexture2D(e.FRAMEBUFFER,e.DEPTH_ATTACHMENT,e.TEXTURE_2D,i,0);else{if(n.depthTexture.format!==Ia)throw new Error("Unknown depthTexture format");e.framebufferTexture2D(e.FRAMEBUFFER,e.DEPTH_STENCIL_ATTACHMENT,e.TEXTURE_2D,i,0)}}function S(t){var n=r.get(t),i=!0===t.isWebGLRenderTargetCube;if(t.depthTexture){if(i)throw new Error("target.depthTexture not supported in Cube render targets");M(n.__webglFramebuffer,t)}else if(i){n.__webglDepthbuffer=[];for(var o=0;o<6;o++)e.bindFramebuffer(e.FRAMEBUFFER,n.__webglFramebuffer[o]),n.__webglDepthbuffer[o]=e.createRenderbuffer(),w(n.__webglDepthbuffer[o],t)}else e.bindFramebuffer(e.FRAMEBUFFER,n.__webglFramebuffer),n.__webglDepthbuffer=e.createRenderbuffer(),w(n.__webglDepthbuffer,t);e.bindFramebuffer(e.FRAMEBUFFER,null)}function E(t){var i=r.get(t),o=r.get(t.texture);t.addEventListener("dispose",f),o.__webglTexture=e.createTexture(),k.textures++;var a=!0===t.isWebGLRenderTargetCube,s=l(t);if(a){i.__webglFramebuffer=[];for(var u=0;u<6;u++)i.__webglFramebuffer[u]=e.createFramebuffer()}else i.__webglFramebuffer=e.createFramebuffer();if(a){n.bindTexture(e.TEXTURE_CUBE_MAP,o.__webglTexture),b(e.TEXTURE_CUBE_MAP,t.texture,s);for(var u=0;u<6;u++)_(i.__webglFramebuffer[u],t,e.COLOR_ATTACHMENT0,e.TEXTURE_CUBE_MAP_POSITIVE_X+u);t.texture.generateMipmaps&&s&&e.generateMipmap(e.TEXTURE_CUBE_MAP),n.bindTexture(e.TEXTURE_CUBE_MAP,null)}else n.bindTexture(e.TEXTURE_2D,o.__webglTexture),b(e.TEXTURE_2D,t.texture,s),_(i.__webglFramebuffer,t,e.COLOR_ATTACHMENT0,e.TEXTURE_2D),t.texture.generateMipmaps&&s&&e.generateMipmap(e.TEXTURE_2D),n.bindTexture(e.TEXTURE_2D,null);t.depthBuffer&&S(t)}function T(t){var i=t.texture;if(i.generateMipmaps&&l(t)&&i.minFilter!==ca&&i.minFilter!==fa){var o=t&&t.isWebGLRenderTargetCube?e.TEXTURE_CUBE_MAP:e.TEXTURE_2D,a=r.get(i).__webglTexture;n.bindTexture(o,a),e.generateMipmap(o),n.bindTexture(o,null)}}var k=a.memory,C="undefined"!=typeof WebGL2RenderingContext&&e instanceof WebGL2RenderingContext;this.setTexture2D=g,this.setTextureCube=v,this.setTextureCubeDynamic=y,this.setupRenderTarget=E,this.updateRenderTargetMipmap=T}function ot(){var e={};return{get:function(t){var n=t.uuid,r=e[n];return void 0===r&&(r={},e[n]=r),r},delete:function(t){delete e[t.uuid]},clear:function(){e={}}}}function at(e,t,n){function r(){var t=!1,n=new a,r=null,i=new a;return{setMask:function(n){r===n||t||(e.colorMask(n,n,n,n),r=n)},setLocked:function(e){t=e},setClear:function(t,r,o,a,s){!0===s&&(t*=a,r*=a,o*=a),n.set(t,r,o,a),!1===i.equals(n)&&(e.clearColor(t,r,o,a),i.copy(n))},reset:function(){t=!1,r=null,i.set(0,0,0,1)}}}function i(){var t=!1,n=null,r=null,i=null;return{setTest:function(t){t?f(e.DEPTH_TEST):p(e.DEPTH_TEST)},setMask:function(r){n===r||t||(e.depthMask(r),n=r)},setFunc:function(t){if(r!==t){if(t)switch(t){case No:e.depthFunc(e.NEVER);break;case Fo:e.depthFunc(e.ALWAYS);break;case Bo:e.depthFunc(e.LESS);break;case Uo:e.depthFunc(e.LEQUAL);break;case jo:e.depthFunc(e.EQUAL);break;case Wo:e.depthFunc(e.GEQUAL);break;case Vo:e.depthFunc(e.GREATER);break;case Ho:e.depthFunc(e.NOTEQUAL);break;default:e.depthFunc(e.LEQUAL)}else e.depthFunc(e.LEQUAL);r=t}},setLocked:function(e){t=e},setClear:function(t){i!==t&&(e.clearDepth(t),i=t)},reset:function(){t=!1,n=null,r=null,i=null}}}function o(){var t=!1,n=null,r=null,i=null,o=null,a=null,s=null,l=null,u=null;return{setTest:function(t){t?f(e.STENCIL_TEST):p(e.STENCIL_TEST)},setMask:function(r){n===r||t||(e.stencilMask(r),n=r)},setFunc:function(t,n,a){r===t&&i===n&&o===a||(e.stencilFunc(t,n,a),r=t,i=n,o=a)},setOp:function(t,n,r){a===t&&s===n&&l===r||(e.stencilOp(t,n,r),a=t,s=n,l=r)},setLocked:function(e){t=e},setClear:function(t){u!==t&&(e.clearStencil(t),u=t)},reset:function(){t=!1,n=null,r=null,i=null,o=null,a=null,s=null,l=null,u=null}}}function s(t,n,r){var i=new Uint8Array(4),o=e.createTexture();e.bindTexture(t,o),e.texParameteri(t,e.TEXTURE_MIN_FILTER,e.NEAREST),e.texParameteri(t,e.TEXTURE_MAG_FILTER,e.NEAREST);for(var a=0;a=1,ce=null,de={},he=new a,fe=new a,pe={};return pe[e.TEXTURE_2D]=s(e.TEXTURE_2D,e.TEXTURE_2D,1),pe[e.TEXTURE_CUBE_MAP]=s(e.TEXTURE_CUBE_MAP,e.TEXTURE_CUBE_MAP_POSITIVE_X,6),{buffers:{color:F,depth:B,stencil:U},init:l,initAttributes:u,enableAttribute:c,enableAttributeAndDivisor:d,disableUnusedAttributes:h,enable:f,disable:p,getCompressedTextureFormats:m,setBlending:g,setColorWrite:v,setDepthTest:y,setDepthWrite:b,setDepthFunc:x,setStencilTest:_,setStencilWrite:w,setStencilFunc:M,setStencilOp:S,setFlipSided:E,setCullFace:T,setLineWidth:k,setPolygonOffset:C,getScissorTest:P,setScissorTest:O,activeTexture:A,bindTexture:R,compressedTexImage2D:L,texImage2D:D,scissor:I,viewport:z,reset:N}}function st(e,t,n){function r(){if(void 0!==o)return o;var n=t.get("EXT_texture_filter_anisotropic");return o=null!==n?e.getParameter(n.MAX_TEXTURE_MAX_ANISOTROPY_EXT):0}function i(t){if("highp"===t){if(e.getShaderPrecisionFormat(e.VERTEX_SHADER,e.HIGH_FLOAT).precision>0&&e.getShaderPrecisionFormat(e.FRAGMENT_SHADER,e.HIGH_FLOAT).precision>0)return"highp";t="mediump"}return"mediump"===t&&e.getShaderPrecisionFormat(e.VERTEX_SHADER,e.MEDIUM_FLOAT).precision>0&&e.getShaderPrecisionFormat(e.FRAGMENT_SHADER,e.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 l=!0===n.logarithmicDepthBuffer&&!!t.get("EXT_frag_depth"),u=e.getParameter(e.MAX_TEXTURE_IMAGE_UNITS),c=e.getParameter(e.MAX_VERTEX_TEXTURE_IMAGE_UNITS),d=e.getParameter(e.MAX_TEXTURE_SIZE),h=e.getParameter(e.MAX_CUBE_MAP_TEXTURE_SIZE),f=e.getParameter(e.MAX_VERTEX_ATTRIBS),p=e.getParameter(e.MAX_VERTEX_UNIFORM_VECTORS),m=e.getParameter(e.MAX_VARYING_VECTORS),g=e.getParameter(e.MAX_FRAGMENT_UNIFORM_VECTORS),v=c>0,y=!!t.get("OES_texture_float");return{getMaxAnisotropy:r,getMaxPrecision:i,precision:a,logarithmicDepthBuffer:l,maxTextures:u,maxVertexTextures:c,maxTextureSize:d,maxCubemapSize:h,maxAttributes:f,maxVertexUniforms:p,maxVaryings:m,maxFragmentUniforms:g,vertexTextures:v,floatFragmentTextures:y,floatVertexTextures:v&&y}}function lt(e){var t={};return{get:function(n){if(void 0!==t[n])return t[n];var r;switch(n){case"WEBGL_depth_texture":r=e.getExtension("WEBGL_depth_texture")||e.getExtension("MOZ_WEBGL_depth_texture")||e.getExtension("WEBKIT_WEBGL_depth_texture");break;case"EXT_texture_filter_anisotropic":r=e.getExtension("EXT_texture_filter_anisotropic")||e.getExtension("MOZ_EXT_texture_filter_anisotropic")||e.getExtension("WEBKIT_EXT_texture_filter_anisotropic");break;case"WEBGL_compressed_texture_s3tc":r=e.getExtension("WEBGL_compressed_texture_s3tc")||e.getExtension("MOZ_WEBGL_compressed_texture_s3tc")||e.getExtension("WEBKIT_WEBGL_compressed_texture_s3tc");break;case"WEBGL_compressed_texture_pvrtc":r=e.getExtension("WEBGL_compressed_texture_pvrtc")||e.getExtension("WEBKIT_WEBGL_compressed_texture_pvrtc");break;case"WEBGL_compressed_texture_etc1":r=e.getExtension("WEBGL_compressed_texture_etc1");break;default:r=e.getExtension(n)}return null===r&&console.warn("THREE.WebGLRenderer: "+n+" extension not supported."),t[n]=r,r}}}function ut(){function e(){u.value!==r&&(u.value=r,u.needsUpdate=i>0),n.numPlanes=i,n.numIntersection=0}function t(e,t,r,i){var o=null!==e?e.length:0,a=null;if(0!==o){if(a=u.value,!0!==i||null===a){var c=r+4*o,d=t.matrixWorldInverse;l.getNormalMatrix(d),(null===a||a.length=0){var c=o[l];if(void 0!==c){var d=c.normalized,h=c.itemSize,f=dt.getAttributeProperties(c),p=f.__webglBuffer,m=f.type,g=f.bytesPerElement;if(c.isInterleavedBufferAttribute){var v=c.data,y=v.stride,b=c.offset;v&&v.isInstancedInterleavedBuffer?(et.enableAttributeAndDivisor(u,v.meshPerAttribute,i),void 0===n.maxInstancedCount&&(n.maxInstancedCount=v.meshPerAttribute*v.count)):et.enableAttribute(u),Ke.bindBuffer(Ke.ARRAY_BUFFER,p),Ke.vertexAttribPointer(u,h,m,d,y*g,(r*y+b)*g)}else c.isInstancedBufferAttribute?(et.enableAttributeAndDivisor(u,c.meshPerAttribute,i),void 0===n.maxInstancedCount&&(n.maxInstancedCount=c.meshPerAttribute*c.count)):et.enableAttribute(u),Ke.bindBuffer(Ke.ARRAY_BUFFER,p),Ke.vertexAttribPointer(u,h,m,d,0,r*h*g)}else if(void 0!==s){var x=s[l];if(void 0!==x)switch(x.length){case 2:Ke.vertexAttrib2fv(u,x);break;case 3:Ke.vertexAttrib3fv(u,x);break;case 4:Ke.vertexAttrib4fv(u,x);break;default:Ke.vertexAttrib1fv(u,x)}}}}et.disableUnusedAttributes()}function h(e,t){return Math.abs(t[0])-Math.abs(e[0])}function f(e,t){return e.object.renderOrder!==t.object.renderOrder?e.object.renderOrder-t.object.renderOrder:e.material.program&&t.material.program&&e.material.program!==t.material.program?e.material.program.id-t.material.program.id:e.material.id!==t.material.id?e.material.id-t.material.id:e.z!==t.z?e.z-t.z:e.id-t.id}function p(e,t){return e.object.renderOrder!==t.object.renderOrder?e.object.renderOrder-t.object.renderOrder:e.z!==t.z?t.z-e.z:e.id-t.id}function m(e,t,n,r,i){var o,a;n.transparent?(o=re,a=++ie):(o=ee,a=++te);var s=o[a];void 0!==s?(s.id=e.id,s.object=e,s.geometry=t,s.material=n,s.z=Ge.z,s.group=i):(s={id:e.id,object:e,geometry:t,material:n,z:Ge.z,group:i},o.push(s))}function g(e){var t=e.geometry;return null===t.boundingSphere&&t.computeBoundingSphere(),Ve.copy(t.boundingSphere).applyMatrix4(e.matrixWorld),y(Ve)}function v(e){return Ve.center.set(0,0,0),Ve.radius=.7071067811865476,Ve.applyMatrix4(e.matrixWorld),y(Ve)}function y(e){if(!Le.intersectsSphere(e))return!1;var t=Ie.numPlanes;if(0===t)return!0;var n=ce.clippingPlanes,r=e.center,i=-e.radius,o=0;do{if(n[o].distanceToPoint(r)=0&&e.numSupportedMorphTargets++}if(e.morphNormals){e.numSupportedMorphNormals=0;for(var h=0;h=0&&e.numSupportedMorphNormals++}var f=r.__webglShader.uniforms;(e.isShaderMaterial||e.isRawShaderMaterial)&&!0!==e.clipping||(r.numClippingPlanes=Ie.numPlanes,r.numIntersection=Ie.numIntersection,f.clippingPlanes=Ie.uniform),r.fog=t,r.lightsHash=qe.hash,e.lights&&(f.ambientLightColor.value=qe.ambient,f.directionalLights.value=qe.directional,f.spotLights.value=qe.spot,f.rectAreaLights.value=qe.rectArea,f.pointLights.value=qe.point,f.hemisphereLights.value=qe.hemi,f.directionalShadowMap.value=qe.directionalShadowMap,f.directionalShadowMatrix.value=qe.directionalShadowMatrix,f.spotShadowMap.value=qe.spotShadowMap,f.spotShadowMatrix.value=qe.spotShadowMatrix,f.pointShadowMap.value=qe.pointShadowMap,f.pointShadowMatrix.value=qe.pointShadowMatrix);var p=r.program.getUniforms(),m=Y.seqWithValue(p.seq,f);r.uniformsList=m}function w(e){e.side===lo?et.disable(Ke.CULL_FACE):et.enable(Ke.CULL_FACE),et.setFlipSided(e.side===so),!0===e.transparent?et.setBlending(e.blending,e.blendEquation,e.blendSrc,e.blendDst,e.blendEquationAlpha,e.blendSrcAlpha,e.blendDstAlpha,e.premultipliedAlpha):et.setBlending(mo),et.setDepthFunc(e.depthFunc),et.setDepthTest(e.depthTest),et.setDepthWrite(e.depthWrite),et.setColorWrite(e.colorWrite),et.setPolygonOffset(e.polygonOffset,e.polygonOffsetFactor,e.polygonOffsetUnits)}function M(e,t,n,r){_e=0;var i=nt.get(n);if(je&&(We||e!==ve)){var o=e===ve&&n.id===me;Ie.setState(n.clippingPlanes,n.clipIntersection,n.clipShadows,e,i,o)}!1===n.needsUpdate&&(void 0===i.program?n.needsUpdate=!0:n.fog&&i.fog!==t?n.needsUpdate=!0:n.lights&&i.lightsHash!==qe.hash?n.needsUpdate=!0:void 0===i.numClippingPlanes||i.numClippingPlanes===Ie.numPlanes&&i.numIntersection===Ie.numIntersection||(n.needsUpdate=!0)),n.needsUpdate&&(_(n,t,r),n.needsUpdate=!1);var a=!1,s=!1,l=!1,u=i.program,c=u.getUniforms(),d=i.__webglShader.uniforms;if(u.id!==de&&(Ke.useProgram(u.program),de=u.id,a=!0,s=!0,l=!0),n.id!==me&&(me=n.id,s=!0),a||e!==ve){if(c.set(Ke,e,"projectionMatrix"),Qe.logarithmicDepthBuffer&&c.setValue(Ke,"logDepthBufFC",2/(Math.log(e.far+1)/Math.LN2)),e!==ve&&(ve=e,s=!0,l=!0),n.isShaderMaterial||n.isMeshPhongMaterial||n.isMeshStandardMaterial||n.envMap){var h=c.map.cameraPosition;void 0!==h&&h.setValue(Ke,Ge.setFromMatrixPosition(e.matrixWorld))}(n.isMeshPhongMaterial||n.isMeshLambertMaterial||n.isMeshBasicMaterial||n.isMeshStandardMaterial||n.isShaderMaterial||n.skinning)&&c.setValue(Ke,"viewMatrix",e.matrixWorldInverse),c.set(Ke,ce,"toneMappingExposure"),c.set(Ke,ce,"toneMappingWhitePoint")}if(n.skinning){c.setOptional(Ke,r,"bindMatrix"),c.setOptional(Ke,r,"bindMatrixInverse");var f=r.skeleton;f&&(Qe.floatVertexTextures&&f.useVertexTexture?(c.set(Ke,f,"boneTexture"),c.set(Ke,f,"boneTextureWidth"),c.set(Ke,f,"boneTextureHeight")):c.setOptional(Ke,f,"boneMatrices"))}return s&&(n.lights&&I(d,l),t&&n.fog&&C(d,t),(n.isMeshBasicMaterial||n.isMeshLambertMaterial||n.isMeshPhongMaterial||n.isMeshStandardMaterial||n.isMeshNormalMaterial||n.isMeshDepthMaterial)&&S(d,n),n.isLineBasicMaterial?E(d,n):n.isLineDashedMaterial?(E(d,n),T(d,n)):n.isPointsMaterial?k(d,n):n.isMeshLambertMaterial?P(d,n):n.isMeshToonMaterial?A(d,n):n.isMeshPhongMaterial?O(d,n):n.isMeshPhysicalMaterial?L(d,n):n.isMeshStandardMaterial?R(d,n):n.isMeshDepthMaterial?n.displacementMap&&(d.displacementMap.value=n.displacementMap,d.displacementScale.value=n.displacementScale,d.displacementBias.value=n.displacementBias):n.isMeshNormalMaterial&&D(d,n),void 0!==d.ltcMat&&(d.ltcMat.value=THREE.UniformsLib.LTC_MAT_TEXTURE),void 0!==d.ltcMag&&(d.ltcMag.value=THREE.UniformsLib.LTC_MAG_TEXTURE),Y.upload(Ke,i.uniformsList,d,ce)),c.set(Ke,r,"modelViewMatrix"),c.set(Ke,r,"normalMatrix"),c.setValue(Ke,"modelMatrix",r.matrixWorld),u}function S(e,t){e.opacity.value=t.opacity,e.diffuse.value=t.color,t.emissive&&e.emissive.value.copy(t.emissive).multiplyScalar(t.emissiveIntensity),e.map.value=t.map,e.specularMap.value=t.specularMap,e.alphaMap.value=t.alphaMap,t.lightMap&&(e.lightMap.value=t.lightMap,e.lightMapIntensity.value=t.lightMapIntensity),t.aoMap&&(e.aoMap.value=t.aoMap,e.aoMapIntensity.value=t.aoMapIntensity);var n;if(t.map?n=t.map:t.specularMap?n=t.specularMap:t.displacementMap?n=t.displacementMap:t.normalMap?n=t.normalMap:t.bumpMap?n=t.bumpMap:t.roughnessMap?n=t.roughnessMap:t.metalnessMap?n=t.metalnessMap:t.alphaMap?n=t.alphaMap:t.emissiveMap&&(n=t.emissiveMap),void 0!==n){n.isWebGLRenderTarget&&(n=n.texture);var r=n.offset,i=n.repeat;e.offsetRepeat.value.set(r.x,r.y,i.x,i.y)}e.envMap.value=t.envMap,e.flipEnvMap.value=t.envMap&&t.envMap.isCubeTexture?-1:1,e.reflectivity.value=t.reflectivity,e.refractionRatio.value=t.refractionRatio}function E(e,t){e.diffuse.value=t.color,e.opacity.value=t.opacity}function T(e,t){e.dashSize.value=t.dashSize,e.totalSize.value=t.dashSize+t.gapSize,e.scale.value=t.scale}function k(e,t){if(e.diffuse.value=t.color,e.opacity.value=t.opacity,e.size.value=t.size*Te,e.scale.value=.5*Ee,e.map.value=t.map,null!==t.map){var n=t.map.offset,r=t.map.repeat;e.offsetRepeat.value.set(n.x,n.y,r.x,r.y)}}function C(e,t){e.fogColor.value=t.color,t.isFog?(e.fogNear.value=t.near,e.fogFar.value=t.far):t.isFogExp2&&(e.fogDensity.value=t.density)}function P(e,t){t.emissiveMap&&(e.emissiveMap.value=t.emissiveMap)}function O(e,t){e.specular.value=t.specular,e.shininess.value=Math.max(t.shininess,1e-4),t.emissiveMap&&(e.emissiveMap.value=t.emissiveMap),t.bumpMap&&(e.bumpMap.value=t.bumpMap,e.bumpScale.value=t.bumpScale),t.normalMap&&(e.normalMap.value=t.normalMap,e.normalScale.value.copy(t.normalScale)),t.displacementMap&&(e.displacementMap.value=t.displacementMap,e.displacementScale.value=t.displacementScale,e.displacementBias.value=t.displacementBias)}function A(e,t){O(e,t),t.gradientMap&&(e.gradientMap.value=t.gradientMap)}function R(e,t){e.roughness.value=t.roughness,e.metalness.value=t.metalness,t.roughnessMap&&(e.roughnessMap.value=t.roughnessMap),t.metalnessMap&&(e.metalnessMap.value=t.metalnessMap),t.emissiveMap&&(e.emissiveMap.value=t.emissiveMap),t.bumpMap&&(e.bumpMap.value=t.bumpMap,e.bumpScale.value=t.bumpScale),t.normalMap&&(e.normalMap.value=t.normalMap,e.normalScale.value.copy(t.normalScale)),t.displacementMap&&(e.displacementMap.value=t.displacementMap,e.displacementScale.value=t.displacementScale,e.displacementBias.value=t.displacementBias),t.envMap&&(e.envMapIntensity.value=t.envMapIntensity)}function L(e,t){e.clearCoat.value=t.clearCoat,e.clearCoatRoughness.value=t.clearCoatRoughness,R(e,t)}function D(e,t){t.bumpMap&&(e.bumpMap.value=t.bumpMap,e.bumpScale.value=t.bumpScale),t.normalMap&&(e.normalMap.value=t.normalMap,e.normalScale.value.copy(t.normalScale)),t.displacementMap&&(e.displacementMap.value=t.displacementMap,e.displacementScale.value=t.displacementScale,e.displacementBias.value=t.displacementBias)}function I(e,t){e.ambientLightColor.needsUpdate=t,e.directionalLights.needsUpdate=t,e.pointLights.needsUpdate=t,e.spotLights.needsUpdate=t,e.rectAreaLights.needsUpdate=t,e.hemisphereLights.needsUpdate=t}function z(e){for(var t=0,n=0,r=e.length;n=Qe.maxTextures&&console.warn("WebGLRenderer: trying to use "+e+" texture units while this GPU supports only "+Qe.maxTextures),_e+=1,e}function B(e){var t;if(e===sa)return Ke.REPEAT;if(e===la)return Ke.CLAMP_TO_EDGE;if(e===ua)return Ke.MIRRORED_REPEAT;if(e===ca)return Ke.NEAREST;if(e===da)return Ke.NEAREST_MIPMAP_NEAREST;if(e===ha)return Ke.NEAREST_MIPMAP_LINEAR;if(e===fa)return Ke.LINEAR;if(e===pa)return Ke.LINEAR_MIPMAP_NEAREST;if(e===ma)return Ke.LINEAR_MIPMAP_LINEAR;if(e===ga)return Ke.UNSIGNED_BYTE;if(e===Sa)return Ke.UNSIGNED_SHORT_4_4_4_4;if(e===Ea)return Ke.UNSIGNED_SHORT_5_5_5_1;if(e===Ta)return Ke.UNSIGNED_SHORT_5_6_5;if(e===va)return Ke.BYTE;if(e===ya)return Ke.SHORT;if(e===ba)return Ke.UNSIGNED_SHORT;if(e===xa)return Ke.INT;if(e===_a)return Ke.UNSIGNED_INT;if(e===wa)return Ke.FLOAT;if(e===Ma&&null!==(t=$e.get("OES_texture_half_float")))return t.HALF_FLOAT_OES;if(e===Ca)return Ke.ALPHA;if(e===Pa)return Ke.RGB;if(e===Oa)return Ke.RGBA;if(e===Aa)return Ke.LUMINANCE;if(e===Ra)return Ke.LUMINANCE_ALPHA;if(e===Da)return Ke.DEPTH_COMPONENT;if(e===Ia)return Ke.DEPTH_STENCIL;if(e===_o)return Ke.FUNC_ADD;if(e===wo)return Ke.FUNC_SUBTRACT;if(e===Mo)return Ke.FUNC_REVERSE_SUBTRACT;if(e===To)return Ke.ZERO;if(e===ko)return Ke.ONE;if(e===Co)return Ke.SRC_COLOR;if(e===Po)return Ke.ONE_MINUS_SRC_COLOR;if(e===Oo)return Ke.SRC_ALPHA;if(e===Ao)return Ke.ONE_MINUS_SRC_ALPHA;if(e===Ro)return Ke.DST_ALPHA;if(e===Lo)return Ke.ONE_MINUS_DST_ALPHA;if(e===Do)return Ke.DST_COLOR;if(e===Io)return Ke.ONE_MINUS_DST_COLOR;if(e===zo)return Ke.SRC_ALPHA_SATURATE;if((e===za||e===Na||e===Fa||e===Ba)&&null!==(t=$e.get("WEBGL_compressed_texture_s3tc"))){if(e===za)return t.COMPRESSED_RGB_S3TC_DXT1_EXT;if(e===Na)return t.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(e===Fa)return t.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(e===Ba)return t.COMPRESSED_RGBA_S3TC_DXT5_EXT}if((e===Ua||e===ja||e===Wa||e===Va)&&null!==(t=$e.get("WEBGL_compressed_texture_pvrtc"))){if(e===Ua)return t.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(e===ja)return t.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(e===Wa)return t.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(e===Va)return t.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}if(e===Ha&&null!==(t=$e.get("WEBGL_compressed_texture_etc1")))return t.COMPRESSED_RGB_ETC1_WEBGL;if((e===So||e===Eo)&&null!==(t=$e.get("EXT_blend_minmax"))){if(e===So)return t.MIN_EXT;if(e===Eo)return t.MAX_EXT}return e===ka&&null!==(t=$e.get("WEBGL_depth_texture"))?t.UNSIGNED_INT_24_8_WEBGL:0}console.log("THREE.WebGLRenderer",Zi),e=e||{};var U=void 0!==e.canvas?e.canvas:document.createElementNS("http://www.w3.org/1999/xhtml","canvas"),j=void 0!==e.context?e.context:null,W=void 0!==e.alpha&&e.alpha,V=void 0===e.depth||e.depth,H=void 0===e.stencil||e.stencil,G=void 0!==e.antialias&&e.antialias,q=void 0===e.premultipliedAlpha||e.premultipliedAlpha,Z=void 0!==e.preserveDrawingBuffer&&e.preserveDrawingBuffer,$=[],ee=[],te=-1,re=[],ie=-1,se=new Float32Array(8),le=[],ue=[];this.domElement=U,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 ce=this,de=null,he=null,fe=null,me=-1,ge="",ve=null,ye=new a,be=null,xe=new a,_e=0,we=new X(0),Me=0,Se=U.width,Ee=U.height,Te=1,ke=new a(0,0,Se,Ee),Ce=!1,Ae=new a(0,0,Se,Ee),Le=new oe,Ie=new ut,je=!1,We=!1,Ve=new ne,He=new d,Ge=new c,Ye=new d,Xe=new d,qe={hash:"",ambient:[0,0,0],directional:[],directionalShadowMap:[],directionalShadowMatrix:[],spot:[],spotShadowMap:[],spotShadowMatrix:[],rectArea:[],point:[],pointShadowMap:[],pointShadowMatrix:[],hemi:[],shadows:[]},Ze={calls:0,vertices:0,faces:0,points:0};this.info={render:Ze,memory:{geometries:0,textures:0},programs:null};var Ke;try{var Je={alpha:W,depth:V,stencil:H,antialias:G,premultipliedAlpha:q,preserveDrawingBuffer:Z};if(null===(Ke=j||U.getContext("webgl",Je)||U.getContext("experimental-webgl",Je)))throw null!==U.getContext("webgl")?"Error creating WebGL context with your selected attributes.":"Error creating WebGL context.";void 0===Ke.getShaderPrecisionFormat&&(Ke.getShaderPrecisionFormat=function(){return{rangeMin:1,rangeMax:1,precision:1}}),U.addEventListener("webglcontextlost",i,!1)}catch(e){console.error("THREE.WebGLRenderer: "+e)}var $e=new lt(Ke);$e.get("WEBGL_depth_texture"),$e.get("OES_texture_float"),$e.get("OES_texture_float_linear"),$e.get("OES_texture_half_float"),$e.get("OES_texture_half_float_linear"),$e.get("OES_standard_derivatives"),$e.get("ANGLE_instanced_arrays"),$e.get("OES_element_index_uint")&&(Pe.MaxIndex=4294967296);var Qe=new st(Ke,$e,e),et=new at(Ke,$e,B),nt=new ot,ct=new it(Ke,$e,et,nt,Qe,B,this.info),dt=new rt(Ke,nt,this.info),ht=new tt(this,Qe),ft=new Ue;this.info.programs=ht.programs;var pt,mt,gt,vt,yt=new Be(Ke,$e,Ze),bt=new Fe(Ke,$e,Ze);n(),this.context=Ke,this.capabilities=Qe,this.extensions=$e,this.properties=nt,this.state=et;var xt=new ae(this,qe,dt,Qe);this.shadowMap=xt;var _t=new J(this,le),wt=new K(this,ue);this.getContext=function(){return Ke},this.getContextAttributes=function(){return Ke.getContextAttributes()},this.forceContextLoss=function(){$e.get("WEBGL_lose_context").loseContext()},this.getMaxAnisotropy=function(){return Qe.getMaxAnisotropy()},this.getPrecision=function(){return Qe.precision},this.getPixelRatio=function(){return Te},this.setPixelRatio=function(e){void 0!==e&&(Te=e,this.setSize(Ae.z,Ae.w,!1))},this.getSize=function(){return{width:Se,height:Ee}},this.setSize=function(e,t,n){Se=e,Ee=t,U.width=e*Te,U.height=t*Te,!1!==n&&(U.style.width=e+"px",U.style.height=t+"px"),this.setViewport(0,0,e,t)},this.setViewport=function(e,t,n,r){et.viewport(Ae.set(e,t,n,r))},this.setScissor=function(e,t,n,r){et.scissor(ke.set(e,t,n,r))},this.setScissorTest=function(e){et.setScissorTest(Ce=e)},this.getClearColor=function(){return we},this.setClearColor=function(e,t){we.set(e),Me=void 0!==t?t:1,et.buffers.color.setClear(we.r,we.g,we.b,Me,q)},this.getClearAlpha=function(){return Me},this.setClearAlpha=function(e){Me=e,et.buffers.color.setClear(we.r,we.g,we.b,Me,q)},this.clear=function(e,t,n){var r=0;(void 0===e||e)&&(r|=Ke.COLOR_BUFFER_BIT),(void 0===t||t)&&(r|=Ke.DEPTH_BUFFER_BIT),(void 0===n||n)&&(r|=Ke.STENCIL_BUFFER_BIT),Ke.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(e,t,n,r){this.setRenderTarget(e),this.clear(t,n,r)},this.resetGLState=r,this.dispose=function(){re=[],ie=-1,ee=[],te=-1,U.removeEventListener("webglcontextlost",i,!1)},this.renderBufferImmediate=function(e,t,n){et.initAttributes();var r=nt.get(e);e.hasPositions&&!r.position&&(r.position=Ke.createBuffer()),e.hasNormals&&!r.normal&&(r.normal=Ke.createBuffer()),e.hasUvs&&!r.uv&&(r.uv=Ke.createBuffer()),e.hasColors&&!r.color&&(r.color=Ke.createBuffer());var i=t.getAttributes();if(e.hasPositions&&(Ke.bindBuffer(Ke.ARRAY_BUFFER,r.position),Ke.bufferData(Ke.ARRAY_BUFFER,e.positionArray,Ke.DYNAMIC_DRAW),et.enableAttribute(i.position),Ke.vertexAttribPointer(i.position,3,Ke.FLOAT,!1,0,0)),e.hasNormals){if(Ke.bindBuffer(Ke.ARRAY_BUFFER,r.normal),!n.isMeshPhongMaterial&&!n.isMeshStandardMaterial&&!n.isMeshNormalMaterial&&n.shading===uo)for(var o=0,a=3*e.count;o8&&(f.length=8);for(var v=r.morphAttributes,p=0,m=f.length;p0&&S.renderInstances(r,O,R):S.render(O,R)}},this.render=function(e,t,n,r){if(void 0!==t&&!0!==t.isCamera)return void console.error("THREE.WebGLRenderer.render: camera is not an instance of THREE.Camera.");ge="",me=-1,ve=null,!0===e.autoUpdate&&e.updateMatrixWorld(),null===t.parent&&t.updateMatrixWorld(),t.matrixWorldInverse.getInverse(t.matrixWorld),He.multiplyMatrices(t.projectionMatrix,t.matrixWorldInverse),Le.setFromMatrix(He),$.length=0,te=-1,ie=-1,le.length=0,ue.length=0,We=this.localClippingEnabled,je=Ie.init(this.clippingPlanes,We,t),b(e,t),ee.length=te+1,re.length=ie+1,!0===ce.sortObjects&&(ee.sort(f),re.sort(p)),je&&Ie.beginShadows(),z($),xt.render(e,t),N($,t),je&&Ie.endShadows(),Ze.calls=0,Ze.vertices=0,Ze.faces=0,Ze.points=0,void 0===n&&(n=null),this.setRenderTarget(n);var i=e.background;if(null===i?et.buffers.color.setClear(we.r,we.g,we.b,Me,q):i&&i.isColor&&(et.buffers.color.setClear(i.r,i.g,i.b,1,q),r=!0),(this.autoClear||r)&&this.clear(this.autoClearColor,this.autoClearDepth,this.autoClearStencil),i&&i.isCubeTexture?(void 0===gt&&(gt=new ze,vt=new Oe(new Re(5,5,5),new Q({uniforms:Ss.cube.uniforms,vertexShader:Ss.cube.vertexShader,fragmentShader:Ss.cube.fragmentShader,side:so,depthTest:!1,depthWrite:!1,fog:!1}))),gt.projectionMatrix.copy(t.projectionMatrix),gt.matrixWorld.extractRotation(t.matrixWorld),gt.matrixWorldInverse.getInverse(gt.matrixWorld),vt.material.uniforms.tCube.value=i,vt.modelViewMatrix.multiplyMatrices(gt.matrixWorldInverse,vt.matrixWorld),dt.update(vt),ce.renderBufferDirect(gt,null,vt.geometry,vt.material,vt,null)):i&&i.isTexture&&(void 0===pt&&(pt=new Ne(-1,1,1,-1,0,1),mt=new Oe(new De(2,2),new pe({depthTest:!1,depthWrite:!1,fog:!1}))),mt.material.map=i,dt.update(mt),ce.renderBufferDirect(pt,null,mt.geometry,mt.material,mt,null)),e.overrideMaterial){var o=e.overrideMaterial;x(ee,e,t,o),x(re,e,t,o)}else et.setBlending(mo),x(ee,e,t),x(re,e,t);_t.render(e,t),wt.render(e,t,xe),n&&ct.updateRenderTargetMipmap(n),et.setDepthTest(!0),et.setDepthWrite(!0),et.setColorWrite(!0)},this.setFaceCulling=function(e,t){et.setCullFace(e),et.setFlipSided(t===to)},this.allocTextureUnit=F,this.setTexture2D=function(){var e=!1;return function(t,n){t&&t.isWebGLRenderTarget&&(e||(console.warn("THREE.WebGLRenderer.setTexture2D: don't use render targets as textures. Use their .texture property instead."),e=!0),t=t.texture),ct.setTexture2D(t,n)}}(),this.setTexture=function(){var e=!1;return function(t,n){e||(console.warn("THREE.WebGLRenderer: .setTexture is deprecated, use setTexture2D instead."),e=!0),ct.setTexture2D(t,n)}}(),this.setTextureCube=function(){var e=!1;return function(t,n){t&&t.isWebGLRenderTargetCube&&(e||(console.warn("THREE.WebGLRenderer.setTextureCube: don't use cube render targets as textures. Use their .texture property instead."),e=!0),t=t.texture),t&&t.isCubeTexture||Array.isArray(t.image)&&6===t.image.length?ct.setTextureCube(t,n):ct.setTextureCubeDynamic(t,n)}}(),this.getCurrentRenderTarget=function(){return he},this.setRenderTarget=function(e){he=e,e&&void 0===nt.get(e).__webglFramebuffer&&ct.setupRenderTarget(e);var t,n=e&&e.isWebGLRenderTargetCube;if(e){var r=nt.get(e);t=n?r.__webglFramebuffer[e.activeCubeFace]:r.__webglFramebuffer,ye.copy(e.scissor),be=e.scissorTest,xe.copy(e.viewport)}else t=null,ye.copy(ke).multiplyScalar(Te),be=Ce,xe.copy(Ae).multiplyScalar(Te);if(fe!==t&&(Ke.bindFramebuffer(Ke.FRAMEBUFFER,t),fe=t),et.scissor(ye),et.setScissorTest(be),et.viewport(xe),n){var i=nt.get(e.texture);Ke.framebufferTexture2D(Ke.FRAMEBUFFER,Ke.COLOR_ATTACHMENT0,Ke.TEXTURE_CUBE_MAP_POSITIVE_X+e.activeCubeFace,i.__webglTexture,e.activeMipMapLevel)}},this.readRenderTargetPixels=function(e,t,n,r,i,o){if(!1===(e&&e.isWebGLRenderTarget))return void console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");var a=nt.get(e).__webglFramebuffer;if(a){var s=!1;a!==fe&&(Ke.bindFramebuffer(Ke.FRAMEBUFFER,a),s=!0);try{var l=e.texture,u=l.format,c=l.type;if(u!==Oa&&B(u)!==Ke.getParameter(Ke.IMPLEMENTATION_COLOR_READ_FORMAT))return void console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.");if(!(c===ga||B(c)===Ke.getParameter(Ke.IMPLEMENTATION_COLOR_READ_TYPE)||c===wa&&($e.get("OES_texture_float")||$e.get("WEBGL_color_buffer_float"))||c===Ma&&$e.get("EXT_color_buffer_half_float")))return void console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.");Ke.checkFramebufferStatus(Ke.FRAMEBUFFER)===Ke.FRAMEBUFFER_COMPLETE?t>=0&&t<=e.width-r&&n>=0&&n<=e.height-i&&Ke.readPixels(t,n,r,i,B(u),B(c),o):console.error("THREE.WebGLRenderer.readRenderTargetPixels: readPixels from renderTarget failed. Framebuffer not complete.")}finally{s&&Ke.bindFramebuffer(Ke.FRAMEBUFFER,fe)}}}}function dt(e,t){this.name="",this.color=new X(e),this.density=void 0!==t?t:25e-5}function ht(e,t,n){this.name="",this.color=new X(e),this.near=void 0!==t?t:1,this.far=void 0!==n?n:1e3}function ft(){ce.call(this),this.type="Scene",this.background=null,this.fog=null,this.overrideMaterial=null,this.autoUpdate=!0}function pt(e,t,n,r,i){ce.call(this),this.lensFlares=[],this.positionScreen=new c,this.customUpdateCallback=void 0,void 0!==e&&this.add(e,t,n,r,i)}function mt(e){$.call(this),this.type="SpriteMaterial",this.color=new X(16777215),this.map=null,this.rotation=0,this.fog=!1,this.lights=!1,this.setValues(e)}function gt(e){ce.call(this),this.type="Sprite",this.material=void 0!==e?e:new mt}function vt(){ce.call(this),this.type="LOD",Object.defineProperties(this,{levels:{enumerable:!0,value:[]}})}function yt(e,t,n){if(this.useVertexTexture=void 0===n||n,this.identityMatrix=new d,e=e||[],this.bones=e.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 q(this.boneMatrices,this.boneTextureWidth,this.boneTextureHeight,Oa,wa)}else this.boneMatrices=new Float32Array(16*this.bones.length);if(void 0===t)this.calculateInverses();else if(this.bones.length===t.length)this.boneInverses=t.slice(0);else{console.warn("THREE.Skeleton bonInverses is the wrong length."),this.boneInverses=[];for(var i=0,o=this.bones.length;i=e.HAVE_CURRENT_DATA&&(d.needsUpdate=!0)}o.call(this,e,t,n,r,i,a,s,l,u),this.generateMipmaps=!1;var d=this;c()}function Ct(e,t,n,r,i,a,s,l,u,c,d,h){o.call(this,null,a,s,l,u,c,r,i,d,h),this.image={width:t,height:n},this.mipmaps=e,this.flipY=!1,this.generateMipmaps=!1}function Pt(e,t,n,r,i,a,s,l,u){o.call(this,e,t,n,r,i,a,s,l,u),this.needsUpdate=!0}function Ot(e,t,n,r,i,a,s,l,u,c){if((c=void 0!==c?c:Da)!==Da&&c!==Ia)throw new Error("DepthTexture format must be either THREE.DepthFormat or THREE.DepthStencilFormat");void 0===n&&c===Da&&(n=ba),void 0===n&&c===Ia&&(n=ka),o.call(this,null,r,i,a,s,l,c,n,u),this.image={width:e,height:t},this.magFilter=void 0!==s?s:ca,this.minFilter=void 0!==l?l:ca,this.flipY=!1,this.generateMipmaps=!1}function At(e){function t(e,t){return e-t}Pe.call(this),this.type="WireframeGeometry";var n,r,i,o,a,s,l,u,d=[],h=[0,0],f={},p=["a","b","c"];if(e&&e.isGeometry){var m=e.faces;for(n=0,i=m.length;n.9&&o<.1&&(t<.2&&(m[e+0]+=1),n<.2&&(m[e+2]+=1),r<.2&&(m[e+4]+=1))}}function s(e){p.push(e.x,e.y,e.z)}function l(t,n){var r=3*t;n.x=e[r+0],n.y=e[r+1],n.z=e[r+2]}function u(){for(var e=new c,t=new c,n=new c,r=new c,o=new i,a=new i,s=new i,l=0,u=0;l0)&&m.push(w,M,E),(l!==n-1||u0&&u(!0),t>0&&u(!1)),this.setIndex(h),this.addAttribute("position",new Me(f,3)),this.addAttribute("normal",new Me(p,3)),this.addAttribute("uv",new Me(m,2))}function cn(e,t,n,r,i,o,a){ln.call(this,0,e,t,n,r,i,o,a),this.type="ConeGeometry",this.parameters={radius:e,height:t,radialSegments:n,heightSegments:r,openEnded:i,thetaStart:o,thetaLength:a}}function dn(e,t,n,r,i,o,a){un.call(this,0,e,t,n,r,i,o,a),this.type="ConeBufferGeometry",this.parameters={radius:e,height:t,radialSegments:n,heightSegments:r,openEnded:i,thetaStart:o,thetaLength:a}}function hn(e,t,n,r){Ce.call(this),this.type="CircleGeometry",this.parameters={radius:e,segments:t,thetaStart:n,thetaLength:r},this.fromBufferGeometry(new fn(e,t,n,r))}function fn(e,t,n,r){Pe.call(this),this.type="CircleBufferGeometry",this.parameters={radius:e,segments:t,thetaStart:n,thetaLength:r},e=e||50,t=void 0!==t?Math.max(3,t):8,n=void 0!==n?n:0,r=void 0!==r?r:2*Math.PI;var o,a,s=[],l=[],u=[],d=[],h=new c,f=new i;for(l.push(0,0,0),u.push(0,0,1),d.push(.5,.5),a=0,o=3;a<=t;a++,o+=3){var p=n+a/t*r;h.x=e*Math.cos(p),h.y=e*Math.sin(p),l.push(h.x,h.y,h.z),u.push(0,0,1),f.x=(l[o]/e+1)/2,f.y=(l[o+1]/e+1)/2,d.push(f.x,f.y)}for(o=1;o<=t;o++)s.push(o,o+1,0);this.setIndex(s),this.addAttribute("position",new Me(l,3)),this.addAttribute("normal",new Me(u,3)),this.addAttribute("uv",new Me(d,2))}function pn(){Q.call(this,{uniforms:xs.merge([Ms.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(e){this.uniforms.opacity.value=e}}})}function mn(e){Q.call(this,e),this.type="RawShaderMaterial"}function gn(e){this.uuid=fs.generateUUID(),this.type="MultiMaterial",this.materials=Array.isArray(e)?e:[],this.visible=!0}function vn(e){$.call(this),this.defines={STANDARD:""},this.type="MeshStandardMaterial",this.color=new X(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 X(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(e)}function yn(e){vn.call(this),this.defines={PHYSICAL:""},this.type="MeshPhysicalMaterial",this.reflectivity=.5,this.clearCoat=0,this.clearCoatRoughness=0,this.setValues(e)}function bn(e){$.call(this),this.type="MeshPhongMaterial",this.color=new X(16777215),this.specular=new X(1118481),this.shininess=30,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new X(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=Go,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.skinning=!1,this.morphTargets=!1,this.morphNormals=!1,this.setValues(e)}function xn(e){bn.call(this),this.defines={TOON:""},this.type="MeshToonMaterial",this.gradientMap=null,this.setValues(e)}function _n(e){$.call(this,e),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(e)}function wn(e){$.call(this),this.type="MeshLambertMaterial",this.color=new X(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new X(0),this.emissiveIntensity=1,this.emissiveMap=null,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.combine=Go,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.skinning=!1,this.morphTargets=!1,this.morphNormals=!1,this.setValues(e)}function Mn(e){$.call(this),this.type="LineDashedMaterial",this.color=new X(16777215),this.linewidth=1,this.scale=1,this.dashSize=3,this.gapSize=1,this.lights=!1,this.setValues(e)}function Sn(e,t,n){var r=this,i=!1,o=0,a=0;this.onStart=void 0,this.onLoad=e,this.onProgress=t,this.onError=n,this.itemStart=function(e){a++,!1===i&&void 0!==r.onStart&&r.onStart(e,o,a),i=!0},this.itemEnd=function(e){o++,void 0!==r.onProgress&&r.onProgress(e,o,a),o===a&&(i=!1,void 0!==r.onLoad&&r.onLoad())},this.itemError=function(e){void 0!==r.onError&&r.onError(e)}}function En(e){this.manager=void 0!==e?e:Ls}function Tn(e){this.manager=void 0!==e?e:Ls,this._parser=null}function kn(e){this.manager=void 0!==e?e:Ls,this._parser=null}function Cn(e){this.manager=void 0!==e?e:Ls}function Pn(e){this.manager=void 0!==e?e:Ls}function On(e){this.manager=void 0!==e?e:Ls}function An(e,t){ce.call(this),this.type="Light",this.color=new X(e),this.intensity=void 0!==t?t:1,this.receiveShadow=void 0}function Rn(e,t,n){An.call(this,e,n),this.type="HemisphereLight",this.castShadow=void 0,this.position.copy(ce.DefaultUp),this.updateMatrix(),this.groundColor=new X(t)}function Ln(e){this.camera=e,this.bias=0,this.radius=1,this.mapSize=new i(512,512),this.map=null,this.matrix=new d}function Dn(){Ln.call(this,new ze(50,1,.5,500))}function In(e,t,n,r,i,o){An.call(this,e,t),this.type="SpotLight",this.position.copy(ce.DefaultUp),this.updateMatrix(),this.target=new ce,Object.defineProperty(this,"power",{get:function(){return this.intensity*Math.PI},set:function(e){this.intensity=e/Math.PI}}),this.distance=void 0!==n?n:0,this.angle=void 0!==r?r:Math.PI/3,this.penumbra=void 0!==i?i:0,this.decay=void 0!==o?o:1,this.shadow=new Dn}function zn(e,t,n,r){An.call(this,e,t),this.type="PointLight",Object.defineProperty(this,"power",{get:function(){return 4*this.intensity*Math.PI},set:function(e){this.intensity=e/(4*Math.PI)}}),this.distance=void 0!==n?n:0,this.decay=void 0!==r?r:1,this.shadow=new Ln(new ze(90,1,.5,500))}function Nn(){Ln.call(this,new Ne(-5,5,5,-5,.5,500))}function Fn(e,t){An.call(this,e,t),this.type="DirectionalLight",this.position.copy(ce.DefaultUp),this.updateMatrix(),this.target=new ce,this.shadow=new Nn}function Bn(e,t){An.call(this,e,t),this.type="AmbientLight",this.castShadow=void 0}function Un(e,t,n,r){this.parameterPositions=e,this._cachedIndex=0,this.resultBuffer=void 0!==r?r:new t.constructor(n),this.sampleValues=t,this.valueSize=n}function jn(e,t,n,r){Un.call(this,e,t,n,r),this._weightPrev=-0,this._offsetPrev=-0,this._weightNext=-0,this._offsetNext=-0}function Wn(e,t,n,r){Un.call(this,e,t,n,r)}function Vn(e,t,n,r){Un.call(this,e,t,n,r)}function Hn(e,t,n,r){if(void 0===e)throw new Error("track name is undefined");if(void 0===t||0===t.length)throw new Error("no keyframes in track named "+e);this.name=e,this.times=Ds.convertArray(t,this.TimeBufferType),this.values=Ds.convertArray(n,this.ValueBufferType),this.setInterpolation(r||this.DefaultInterpolation),this.validate(),this.optimize()}function Gn(e,t,n,r){Hn.call(this,e,t,n,r)}function Yn(e,t,n,r){Un.call(this,e,t,n,r)}function Xn(e,t,n,r){Hn.call(this,e,t,n,r)}function qn(e,t,n,r){Hn.call(this,e,t,n,r)}function Zn(e,t,n,r){Hn.call(this,e,t,n,r)}function Kn(e,t,n){Hn.call(this,e,t,n)}function Jn(e,t,n,r){Hn.call(this,e,t,n,r)}function $n(e,t,n,r){Hn.apply(this,arguments)}function Qn(e,t,n){this.name=e,this.tracks=n,this.duration=void 0!==t?t:-1,this.uuid=fs.generateUUID(),this.duration<0&&this.resetDuration(),this.optimize()}function er(e){this.manager=void 0!==e?e:Ls,this.textures={}}function tr(e){this.manager=void 0!==e?e:Ls}function nr(){this.onLoadStart=function(){},this.onLoadProgress=function(){},this.onLoadComplete=function(){}}function rr(e){"boolean"==typeof e&&(console.warn("THREE.JSONLoader: showStatus parameter has been removed from constructor."),e=void 0),this.manager=void 0!==e?e:Ls,this.withCredentials=!1}function ir(e){this.manager=void 0!==e?e:Ls,this.texturePath=""}function or(e,t,n,r,i){var o=.5*(r-t),a=.5*(i-n),s=e*e;return(2*n-2*r+o+a)*(e*s)+(-3*n+3*r-2*o-a)*s+o*e+n}function ar(e,t){var n=1-e;return n*n*t}function sr(e,t){return 2*(1-e)*e*t}function lr(e,t){return e*e*t}function ur(e,t,n,r){return ar(e,t)+sr(e,n)+lr(e,r)}function cr(e,t){var n=1-e;return n*n*n*t}function dr(e,t){var n=1-e;return 3*n*n*e*t}function hr(e,t){return 3*(1-e)*e*e*t}function fr(e,t){return e*e*e*t}function pr(e,t,n,r,i){return cr(e,t)+dr(e,n)+hr(e,r)+fr(e,i)}function mr(){}function gr(e,t){this.v1=e,this.v2=t}function vr(){this.curves=[],this.autoClose=!1}function yr(e,t,n,r,i,o,a,s){this.aX=e,this.aY=t,this.xRadius=n,this.yRadius=r,this.aStartAngle=i,this.aEndAngle=o,this.aClockwise=a,this.aRotation=s||0}function br(e){this.points=void 0===e?[]:e}function xr(e,t,n,r){this.v0=e,this.v1=t,this.v2=n,this.v3=r}function _r(e,t,n){this.v0=e,this.v1=t,this.v2=n}function wr(e){vr.call(this),this.currentPoint=new i,e&&this.fromPoints(e)}function Mr(){wr.apply(this,arguments),this.holes=[]}function Sr(){this.subPaths=[],this.currentPath=null}function Er(e){this.data=e}function Tr(e){this.manager=void 0!==e?e:Ls}function kr(e){this.manager=void 0!==e?e:Ls}function Cr(e,t,n,r){An.call(this,e,t),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 ze,this.cameraL.layers.enable(1),this.cameraL.matrixAutoUpdate=!1,this.cameraR=new ze,this.cameraR.layers.enable(2),this.cameraR.matrixAutoUpdate=!1}function Or(e,t,n){ce.call(this),this.type="CubeCamera";var r=new ze(90,1,e,t);r.up.set(0,-1,0),r.lookAt(new c(1,0,0)),this.add(r);var i=new ze(90,1,e,t);i.up.set(0,-1,0),i.lookAt(new c(-1,0,0)),this.add(i);var o=new ze(90,1,e,t);o.up.set(0,0,1),o.lookAt(new c(0,1,0)),this.add(o);var a=new ze(90,1,e,t);a.up.set(0,0,-1),a.lookAt(new c(0,-1,0)),this.add(a);var s=new ze(90,1,e,t);s.up.set(0,-1,0),s.lookAt(new c(0,0,1)),this.add(s);var u=new ze(90,1,e,t);u.up.set(0,-1,0),u.lookAt(new c(0,0,-1)),this.add(u);var d={format:Pa,magFilter:fa,minFilter:fa};this.renderTarget=new l(n,n,d),this.updateCubeMap=function(e,t){null===this.parent&&this.updateMatrixWorld();var n=this.renderTarget,l=n.texture.generateMipmaps;n.texture.generateMipmaps=!1,n.activeCubeFace=0,e.render(t,r,n),n.activeCubeFace=1,e.render(t,i,n),n.activeCubeFace=2,e.render(t,o,n),n.activeCubeFace=3,e.render(t,a,n),n.activeCubeFace=4,e.render(t,s,n),n.texture.generateMipmaps=l,n.activeCubeFace=5,e.render(t,u,n),e.setRenderTarget(null)}}function Ar(){ce.call(this),this.type="AudioListener",this.context=Fs.getContext(),this.gain=this.context.createGain(),this.gain.connect(this.context.destination),this.filter=null}function Rr(e){ce.call(this),this.type="Audio",this.context=e.context,this.gain=this.context.createGain(),this.gain.connect(e.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 Lr(e){Rr.call(this,e),this.panner=this.context.createPanner(),this.panner.connect(this.gain)}function Dr(e,t){this.analyser=e.context.createAnalyser(),this.analyser.fftSize=void 0!==t?t:2048,this.data=new Uint8Array(this.analyser.frequencyBinCount),e.getOutput().connect(this.analyser)}function Ir(e,t,n){this.binding=e,this.valueSize=n;var r,i=Float64Array;switch(t){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 zr(e,t,n){this.path=t,this.parsedPath=n||zr.parseTrackName(t),this.node=zr.findNode(e,this.parsedPath.nodeName)||e,this.rootNode=e}function Nr(e){this.uuid=fs.generateUUID(),this._objects=Array.prototype.slice.call(arguments),this.nCachedObjects_=0;var t={};this._indicesByUUID=t;for(var n=0,r=arguments.length;n!==r;++n)t[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(e,t,n){this._mixer=e,this._clip=t,this._localRoot=n||null;for(var r=t.tracks,i=r.length,o=new Array(i),a={endingStart:Ja,endingEnd:Ja},s=0;s!==i;++s){var l=r[s].createInterpolant(null);o[s]=l,l.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=Ya,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(e){this._root=e,this._initMemoryManager(),this._accuIndex=0,this.time=0,this.timeScale=1}function Ur(e){"string"==typeof e&&(console.warn("THREE.Uniform: Type parameter is no longer needed."),e=arguments[1]),this.value=e}function jr(){Pe.call(this),this.type="InstancedBufferGeometry",this.maxInstancedCount=void 0}function Wr(e,t,n,r){this.uuid=fs.generateUUID(),this.data=e,this.itemSize=t,this.offset=n,this.normalized=!0===r}function Vr(e,t){this.uuid=fs.generateUUID(),this.array=e,this.stride=t,this.count=void 0!==e?e.length/t:0,this.dynamic=!1,this.updateRange={offset:0,count:-1},this.onUploadCallback=function(){},this.version=0}function Hr(e,t,n){Vr.call(this,e,t),this.meshPerAttribute=n||1}function Gr(e,t,n){me.call(this,e,t),this.meshPerAttribute=n||1}function Yr(e,t,n,r){this.ray=new se(e,t),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 Xr(e,t){return e.distance-t.distance}function qr(e,t,n,r){if(!1!==e.visible&&(e.raycast(t,n),!0===r))for(var i=e.children,o=0,a=i.length;o0?1:+e}),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(e){if(void 0===e||null===e)throw new TypeError("Cannot convert undefined or null to object");for(var t=Object(e),n=1;n>=4,n[i]=t[19===i?3&e|8:e]);return n.join("")}}(),clamp:function(e,t,n){return Math.max(t,Math.min(n,e))},euclideanModulo:function(e,t){return(e%t+t)%t},mapLinear:function(e,t,n,r,i){return r+(e-t)*(i-r)/(n-t)},lerp:function(e,t,n){return(1-n)*e+n*t},smoothstep:function(e,t,n){return e<=t?0:e>=n?1:(e=(e-t)/(n-t))*e*(3-2*e)},smootherstep:function(e,t,n){return e<=t?0:e>=n?1:(e=(e-t)/(n-t))*e*e*(e*(6*e-15)+10)},randInt:function(e,t){return e+Math.floor(Math.random()*(t-e+1))},randFloat:function(e,t){return e+Math.random()*(t-e)},randFloatSpread:function(e){return e*(.5-Math.random())},degToRad:function(e){return e*fs.DEG2RAD},radToDeg:function(e){return e*fs.RAD2DEG},isPowerOfTwo:function(e){return 0==(e&e-1)&&0!==e},nearestPowerOfTwo:function(e){return Math.pow(2,Math.round(Math.log(e)/Math.LN2))},nextPowerOfTwo:function(e){return e--,e|=e>>1,e|=e>>2,e|=e>>4,e|=e>>8,e|=e>>16,++e}};i.prototype={constructor:i,isVector2:!0,get width(){return this.x},set width(e){this.x=e},get height(){return this.y},set height(e){this.y=e},set:function(e,t){return this.x=e,this.y=t,this},setScalar:function(e){return this.x=e,this.y=e,this},setX:function(e){return this.x=e,this},setY:function(e){return this.y=e,this},setComponent:function(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;default:throw new Error("index is out of range: "+e)}return this},getComponent:function(e){switch(e){case 0:return this.x;case 1:return this.y;default:throw new Error("index is out of range: "+e)}},clone:function(){return new this.constructor(this.x,this.y)},copy:function(e){return this.x=e.x,this.y=e.y,this},add:function(e,t){return void 0!==t?(console.warn("THREE.Vector2: .add() now only accepts one argument. Use .addVectors( a, b ) instead."),this.addVectors(e,t)):(this.x+=e.x,this.y+=e.y,this)},addScalar:function(e){return this.x+=e,this.y+=e,this},addVectors:function(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this},addScaledVector:function(e,t){return this.x+=e.x*t,this.y+=e.y*t,this},sub:function(e,t){return void 0!==t?(console.warn("THREE.Vector2: .sub() now only accepts one argument. Use .subVectors( a, b ) instead."),this.subVectors(e,t)):(this.x-=e.x,this.y-=e.y,this)},subScalar:function(e){return this.x-=e,this.y-=e,this},subVectors:function(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this},multiply:function(e){return this.x*=e.x,this.y*=e.y,this},multiplyScalar:function(e){return isFinite(e)?(this.x*=e,this.y*=e):(this.x=0,this.y=0),this},divide:function(e){return this.x/=e.x,this.y/=e.y,this},divideScalar:function(e){return this.multiplyScalar(1/e)},min:function(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this},max:function(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this},clamp:function(e,t){return this.x=Math.max(e.x,Math.min(t.x,this.x)),this.y=Math.max(e.y,Math.min(t.y,this.y)),this},clampScalar:function(){var e,t;return function(n,r){return void 0===e&&(e=new i,t=new i),e.set(n,n),t.set(r,r),this.clamp(e,t)}}(),clampLength:function(e,t){var n=this.length();return this.multiplyScalar(Math.max(e,Math.min(t,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(e){return this.x*e.x+this.y*e.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 e=Math.atan2(this.y,this.x);return e<0&&(e+=2*Math.PI),e},distanceTo:function(e){return Math.sqrt(this.distanceToSquared(e))},distanceToSquared:function(e){var t=this.x-e.x,n=this.y-e.y;return t*t+n*n},distanceToManhattan:function(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)},setLength:function(e){return this.multiplyScalar(e/this.length())},lerp:function(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this},lerpVectors:function(e,t,n){return this.subVectors(t,e).multiplyScalar(n).add(e)},equals:function(e){return e.x===this.x&&e.y===this.y},fromArray:function(e,t){return void 0===t&&(t=0),this.x=e[t],this.y=e[t+1],this},toArray:function(e,t){return void 0===e&&(e=[]),void 0===t&&(t=0),e[t]=this.x,e[t+1]=this.y,e},fromBufferAttribute:function(e,t,n){return void 0!==n&&console.warn("THREE.Vector2: offset has been removed from .fromBufferAttribute()."),this.x=e.getX(t),this.y=e.getY(t),this},rotateAround:function(e,t){var n=Math.cos(t),r=Math.sin(t),i=this.x-e.x,o=this.y-e.y;return this.x=i*n-o*r+e.x,this.y=i*r+o*n+e.y,this}};var ps=0;o.DEFAULT_IMAGE=void 0,o.DEFAULT_MAPPING=Qo,o.prototype={constructor:o,isTexture:!0,set needsUpdate(e){!0===e&&this.version++},clone:function(){return(new this.constructor).copy(this)},copy:function(e){return this.image=e.image,this.mipmaps=e.mipmaps.slice(0),this.mapping=e.mapping,this.wrapS=e.wrapS,this.wrapT=e.wrapT,this.magFilter=e.magFilter,this.minFilter=e.minFilter,this.anisotropy=e.anisotropy,this.format=e.format,this.type=e.type,this.offset.copy(e.offset),this.repeat.copy(e.repeat),this.generateMipmaps=e.generateMipmaps,this.premultiplyAlpha=e.premultiplyAlpha,this.flipY=e.flipY,this.unpackAlignment=e.unpackAlignment,this.encoding=e.encoding,this},toJSON:function(e){if(void 0!==e.textures[this.uuid])return e.textures[this.uuid];var t={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===e.images[n.uuid]&&(e.images[n.uuid]={uuid:n.uuid,url:function(e){var t;return void 0!==e.toDataURL?t=e:(t=document.createElementNS("http://www.w3.org/1999/xhtml","canvas"),t.width=e.width,t.height=e.height,t.getContext("2d").drawImage(e,0,0,e.width,e.height)),t.width>2048||t.height>2048?t.toDataURL("image/jpeg",.6):t.toDataURL("image/png")}(n)}),t.image=n.uuid}return e.textures[this.uuid]=t,t},dispose:function(){this.dispatchEvent({type:"dispose"})},transformUv:function(e){if(this.mapping===Qo){if(e.multiply(this.repeat),e.add(this.offset),e.x<0||e.x>1)switch(this.wrapS){case sa:e.x=e.x-Math.floor(e.x);break;case la:e.x=e.x<0?0:1;break;case ua:1===Math.abs(Math.floor(e.x)%2)?e.x=Math.ceil(e.x)-e.x:e.x=e.x-Math.floor(e.x)}if(e.y<0||e.y>1)switch(this.wrapT){case sa:e.y=e.y-Math.floor(e.y);break;case la:e.y=e.y<0?0:1;break;case ua:1===Math.abs(Math.floor(e.y)%2)?e.y=Math.ceil(e.y)-e.y:e.y=e.y-Math.floor(e.y)}this.flipY&&(e.y=1-e.y)}}},Object.assign(o.prototype,r.prototype),a.prototype={constructor:a,isVector4:!0,set:function(e,t,n,r){return this.x=e,this.y=t,this.z=n,this.w=r,this},setScalar:function(e){return this.x=e,this.y=e,this.z=e,this.w=e,this},setX:function(e){return this.x=e,this},setY:function(e){return this.y=e,this},setZ:function(e){return this.z=e,this},setW:function(e){return this.w=e,this},setComponent:function(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;case 2:this.z=t;break;case 3:this.w=t;break;default:throw new Error("index is out of range: "+e)}return this},getComponent:function(e){switch(e){case 0:return this.x;case 1:return this.y;case 2:return this.z;case 3:return this.w;default:throw new Error("index is out of range: "+e)}},clone:function(){return new this.constructor(this.x,this.y,this.z,this.w)},copy:function(e){return this.x=e.x,this.y=e.y,this.z=e.z,this.w=void 0!==e.w?e.w:1,this},add:function(e,t){return void 0!==t?(console.warn("THREE.Vector4: .add() now only accepts one argument. Use .addVectors( a, b ) instead."),this.addVectors(e,t)):(this.x+=e.x,this.y+=e.y,this.z+=e.z,this.w+=e.w,this)},addScalar:function(e){return this.x+=e,this.y+=e,this.z+=e,this.w+=e,this},addVectors:function(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this.z=e.z+t.z,this.w=e.w+t.w,this},addScaledVector:function(e,t){return this.x+=e.x*t,this.y+=e.y*t,this.z+=e.z*t,this.w+=e.w*t,this},sub:function(e,t){return void 0!==t?(console.warn("THREE.Vector4: .sub() now only accepts one argument. Use .subVectors( a, b ) instead."),this.subVectors(e,t)):(this.x-=e.x,this.y-=e.y,this.z-=e.z,this.w-=e.w,this)},subScalar:function(e){return this.x-=e,this.y-=e,this.z-=e,this.w-=e,this},subVectors:function(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this.z=e.z-t.z,this.w=e.w-t.w,this},multiplyScalar:function(e){return isFinite(e)?(this.x*=e,this.y*=e,this.z*=e,this.w*=e):(this.x=0,this.y=0,this.z=0,this.w=0),this},applyMatrix4:function(e){var t=this.x,n=this.y,r=this.z,i=this.w,o=e.elements;return this.x=o[0]*t+o[4]*n+o[8]*r+o[12]*i,this.y=o[1]*t+o[5]*n+o[9]*r+o[13]*i,this.z=o[2]*t+o[6]*n+o[10]*r+o[14]*i,this.w=o[3]*t+o[7]*n+o[11]*r+o[15]*i,this},divideScalar:function(e){return this.multiplyScalar(1/e)},setAxisAngleFromQuaternion:function(e){this.w=2*Math.acos(e.w);var t=Math.sqrt(1-e.w*e.w);return t<1e-4?(this.x=1,this.y=0,this.z=0):(this.x=e.x/t,this.y=e.y/t,this.z=e.z/t),this},setAxisAngleFromRotationMatrix:function(e){var t,n,r,i,o=e.elements,a=o[0],s=o[4],l=o[8],u=o[1],c=o[5],d=o[9],h=o[2],f=o[6],p=o[10];if(Math.abs(s-u)<.01&&Math.abs(l-h)<.01&&Math.abs(d-f)<.01){if(Math.abs(s+u)<.1&&Math.abs(l+h)<.1&&Math.abs(d+f)<.1&&Math.abs(a+c+p-3)<.1)return this.set(1,0,0,0),this;t=Math.PI;var m=(a+1)/2,g=(c+1)/2,v=(p+1)/2,y=(s+u)/4,b=(l+h)/4,x=(d+f)/4;return m>g&&m>v?m<.01?(n=0,r=.707106781,i=.707106781):(n=Math.sqrt(m),r=y/n,i=b/n):g>v?g<.01?(n=.707106781,r=0,i=.707106781):(r=Math.sqrt(g),n=y/r,i=x/r):v<.01?(n=.707106781,r=.707106781,i=0):(i=Math.sqrt(v),n=b/i,r=x/i),this.set(n,r,i,t),this}var _=Math.sqrt((f-d)*(f-d)+(l-h)*(l-h)+(u-s)*(u-s));return Math.abs(_)<.001&&(_=1),this.x=(f-d)/_,this.y=(l-h)/_,this.z=(u-s)/_,this.w=Math.acos((a+c+p-1)/2),this},min:function(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this.z=Math.min(this.z,e.z),this.w=Math.min(this.w,e.w),this},max:function(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this.z=Math.max(this.z,e.z),this.w=Math.max(this.w,e.w),this},clamp:function(e,t){return this.x=Math.max(e.x,Math.min(t.x,this.x)),this.y=Math.max(e.y,Math.min(t.y,this.y)),this.z=Math.max(e.z,Math.min(t.z,this.z)),this.w=Math.max(e.w,Math.min(t.w,this.w)),this},clampScalar:function(){var e,t;return function(n,r){return void 0===e&&(e=new a,t=new a),e.set(n,n,n,n),t.set(r,r,r,r),this.clamp(e,t)}}(),floor:function(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this.w=Math.floor(this.w),this},ceil:function(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this.w=Math.ceil(this.w),this},round:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this.w=Math.round(this.w),this},roundToZero:function(){return this.x=this.x<0?Math.ceil(this.x):Math.floor(this.x),this.y=this.y<0?Math.ceil(this.y):Math.floor(this.y),this.z=this.z<0?Math.ceil(this.z):Math.floor(this.z),this.w=this.w<0?Math.ceil(this.w):Math.floor(this.w),this},negate:function(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this.w=-this.w,this},dot:function(e){return this.x*e.x+this.y*e.y+this.z*e.z+this.w*e.w},lengthSq:function(){return this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)},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(e){return this.multiplyScalar(e/this.length())},lerp:function(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this.z+=(e.z-this.z)*t,this.w+=(e.w-this.w)*t,this},lerpVectors:function(e,t,n){return this.subVectors(t,e).multiplyScalar(n).add(e)},equals:function(e){return e.x===this.x&&e.y===this.y&&e.z===this.z&&e.w===this.w},fromArray:function(e,t){return void 0===t&&(t=0),this.x=e[t],this.y=e[t+1],this.z=e[t+2],this.w=e[t+3],this},toArray:function(e,t){return void 0===e&&(e=[]),void 0===t&&(t=0),e[t]=this.x,e[t+1]=this.y,e[t+2]=this.z,e[t+3]=this.w,e},fromBufferAttribute:function(e,t,n){return void 0!==n&&console.warn("THREE.Vector4: offset has been removed from .fromBufferAttribute()."),this.x=e.getX(t),this.y=e.getY(t),this.z=e.getZ(t),this.w=e.getW(t),this}},s.prototype={constructor:s,isWebGLRenderTarget:!0,setSize:function(e,t){this.width===e&&this.height===t||(this.width=e,this.height=t,this.dispose()),this.viewport.set(0,0,e,t),this.scissor.set(0,0,e,t)},clone:function(){return(new this.constructor).copy(this)},copy:function(e){return this.width=e.width,this.height=e.height,this.viewport.copy(e.viewport),this.texture=e.texture.clone(),this.depthBuffer=e.depthBuffer,this.stencilBuffer=e.stencilBuffer,this.depthTexture=e.depthTexture,this},dispose:function(){this.dispatchEvent({type:"dispose"})}},Object.assign(s.prototype,r.prototype),l.prototype=Object.create(s.prototype),l.prototype.constructor=l,l.prototype.isWebGLRenderTargetCube=!0,u.prototype={constructor:u,get x(){return this._x},set x(e){this._x=e,this.onChangeCallback()},get y(){return this._y},set y(e){this._y=e,this.onChangeCallback()},get z(){return this._z},set z(e){this._z=e,this.onChangeCallback()},get w(){return this._w},set w(e){this._w=e,this.onChangeCallback()},set:function(e,t,n,r){return this._x=e,this._y=t,this._z=n,this._w=r,this.onChangeCallback(),this},clone:function(){return new this.constructor(this._x,this._y,this._z,this._w)},copy:function(e){return this._x=e.x,this._y=e.y,this._z=e.z,this._w=e.w,this.onChangeCallback(),this},setFromEuler:function(e,t){if(!1===(e&&e.isEuler))throw new Error("THREE.Quaternion: .setFromEuler() now expects an Euler rotation rather than a Vector3 and order.");var n=Math.cos(e._x/2),r=Math.cos(e._y/2),i=Math.cos(e._z/2),o=Math.sin(e._x/2),a=Math.sin(e._y/2),s=Math.sin(e._z/2),l=e.order;return"XYZ"===l?(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"===l?(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"===l?(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"===l?(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"===l?(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"===l&&(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!==t&&this.onChangeCallback(),this},setFromAxisAngle:function(e,t){var n=t/2,r=Math.sin(n);return this._x=e.x*r,this._y=e.y*r,this._z=e.z*r,this._w=Math.cos(n),this.onChangeCallback(),this},setFromRotationMatrix:function(e){var t,n=e.elements,r=n[0],i=n[4],o=n[8],a=n[1],s=n[5],l=n[9],u=n[2],c=n[6],d=n[10],h=r+s+d;return h>0?(t=.5/Math.sqrt(h+1),this._w=.25/t,this._x=(c-l)*t,this._y=(o-u)*t,this._z=(a-i)*t):r>s&&r>d?(t=2*Math.sqrt(1+r-s-d),this._w=(c-l)/t,this._x=.25*t,this._y=(i+a)/t,this._z=(o+u)/t):s>d?(t=2*Math.sqrt(1+s-r-d),this._w=(o-u)/t,this._x=(i+a)/t,this._y=.25*t,this._z=(l+c)/t):(t=2*Math.sqrt(1+d-r-s),this._w=(a-i)/t,this._x=(o+u)/t,this._y=(l+c)/t,this._z=.25*t),this.onChangeCallback(),this},setFromUnitVectors:function(){var e,t;return function(n,r){return void 0===e&&(e=new c),t=n.dot(r)+1,t<1e-6?(t=0,Math.abs(n.x)>Math.abs(n.z)?e.set(-n.y,n.x,0):e.set(0,-n.z,n.y)):e.crossVectors(n,r),this._x=e.x,this._y=e.y,this._z=e.z,this._w=t,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(e){return this._x*e._x+this._y*e._y+this._z*e._z+this._w*e._w},lengthSq:function(){return this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w},length:function(){return Math.sqrt(this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w)},normalize:function(){var e=this.length();return 0===e?(this._x=0,this._y=0,this._z=0,this._w=1):(e=1/e,this._x=this._x*e,this._y=this._y*e,this._z=this._z*e,this._w=this._w*e),this.onChangeCallback(),this},multiply:function(e,t){return void 0!==t?(console.warn("THREE.Quaternion: .multiply() now only accepts one argument. Use .multiplyQuaternions( a, b ) instead."),this.multiplyQuaternions(e,t)):this.multiplyQuaternions(this,e)},premultiply:function(e){return this.multiplyQuaternions(e,this)},multiplyQuaternions:function(e,t){var n=e._x,r=e._y,i=e._z,o=e._w,a=t._x,s=t._y,l=t._z,u=t._w;return this._x=n*u+o*a+r*l-i*s,this._y=r*u+o*s+i*a-n*l,this._z=i*u+o*l+n*s-r*a,this._w=o*u-n*a-r*s-i*l,this.onChangeCallback(),this},slerp:function(e,t){if(0===t)return this;if(1===t)return this.copy(e);var n=this._x,r=this._y,i=this._z,o=this._w,a=o*e._w+n*e._x+r*e._y+i*e._z;if(a<0?(this._w=-e._w,this._x=-e._x,this._y=-e._y,this._z=-e._z,a=-a):this.copy(e),a>=1)return this._w=o,this._x=n,this._y=r,this._z=i,this;var s=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 l=Math.atan2(s,a),u=Math.sin((1-t)*l)/s,c=Math.sin(t*l)/s;return this._w=o*u+this._w*c,this._x=n*u+this._x*c,this._y=r*u+this._y*c,this._z=i*u+this._z*c,this.onChangeCallback(),this},equals:function(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._w===this._w},fromArray:function(e,t){return void 0===t&&(t=0),this._x=e[t],this._y=e[t+1],this._z=e[t+2],this._w=e[t+3],this.onChangeCallback(),this},toArray:function(e,t){return void 0===e&&(e=[]),void 0===t&&(t=0),e[t]=this._x,e[t+1]=this._y,e[t+2]=this._z,e[t+3]=this._w,e},onChange:function(e){return this.onChangeCallback=e,this},onChangeCallback:function(){}},Object.assign(u,{slerp:function(e,t,n,r){return n.copy(e).slerp(t,r)},slerpFlat:function(e,t,n,r,i,o,a){var s=n[r+0],l=n[r+1],u=n[r+2],c=n[r+3],d=i[o+0],h=i[o+1],f=i[o+2],p=i[o+3];if(c!==p||s!==d||l!==h||u!==f){var m=1-a,g=s*d+l*h+u*f+c*p,v=g>=0?1:-1,y=1-g*g;if(y>Number.EPSILON){var b=Math.sqrt(y),x=Math.atan2(b,g*v);m=Math.sin(m*x)/b,a=Math.sin(a*x)/b}var _=a*v;if(s=s*m+d*_,l=l*m+h*_,u=u*m+f*_,c=c*m+p*_,m===1-a){var w=1/Math.sqrt(s*s+l*l+u*u+c*c);s*=w,l*=w,u*=w,c*=w}}e[t]=s,e[t+1]=l,e[t+2]=u,e[t+3]=c}}),c.prototype={constructor:c,isVector3:!0,set:function(e,t,n){return this.x=e,this.y=t,this.z=n,this},setScalar:function(e){return this.x=e,this.y=e,this.z=e,this},setX:function(e){return this.x=e,this},setY:function(e){return this.y=e,this},setZ:function(e){return this.z=e,this},setComponent:function(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;case 2:this.z=t;break;default:throw new Error("index is out of range: "+e)}return this},getComponent:function(e){switch(e){case 0:return this.x;case 1:return this.y;case 2:return this.z;default:throw new Error("index is out of range: "+e)}},clone:function(){return new this.constructor(this.x,this.y,this.z)},copy:function(e){return this.x=e.x,this.y=e.y,this.z=e.z,this},add:function(e,t){return void 0!==t?(console.warn("THREE.Vector3: .add() now only accepts one argument. Use .addVectors( a, b ) instead."),this.addVectors(e,t)):(this.x+=e.x,this.y+=e.y,this.z+=e.z,this)},addScalar:function(e){return this.x+=e,this.y+=e,this.z+=e,this},addVectors:function(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this.z=e.z+t.z,this},addScaledVector:function(e,t){return this.x+=e.x*t,this.y+=e.y*t,this.z+=e.z*t,this},sub:function(e,t){return void 0!==t?(console.warn("THREE.Vector3: .sub() now only accepts one argument. Use .subVectors( a, b ) instead."),this.subVectors(e,t)):(this.x-=e.x,this.y-=e.y,this.z-=e.z,this)},subScalar:function(e){return this.x-=e,this.y-=e,this.z-=e,this},subVectors:function(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this.z=e.z-t.z,this},multiply:function(e,t){return void 0!==t?(console.warn("THREE.Vector3: .multiply() now only accepts one argument. Use .multiplyVectors( a, b ) instead."),this.multiplyVectors(e,t)):(this.x*=e.x,this.y*=e.y,this.z*=e.z,this)},multiplyScalar:function(e){return isFinite(e)?(this.x*=e,this.y*=e,this.z*=e):(this.x=0,this.y=0,this.z=0),this},multiplyVectors:function(e,t){return this.x=e.x*t.x,this.y=e.y*t.y,this.z=e.z*t.z,this},applyEuler:function(){var e;return function(t){return!1===(t&&t.isEuler)&&console.error("THREE.Vector3: .applyEuler() now expects an Euler rotation rather than a Vector3 and order."),void 0===e&&(e=new u),this.applyQuaternion(e.setFromEuler(t))}}(),applyAxisAngle:function(){var e;return function(t,n){return void 0===e&&(e=new u),this.applyQuaternion(e.setFromAxisAngle(t,n))}}(),applyMatrix3:function(e){var t=this.x,n=this.y,r=this.z,i=e.elements;return this.x=i[0]*t+i[3]*n+i[6]*r,this.y=i[1]*t+i[4]*n+i[7]*r,this.z=i[2]*t+i[5]*n+i[8]*r,this},applyMatrix4:function(e){var t=this.x,n=this.y,r=this.z,i=e.elements;this.x=i[0]*t+i[4]*n+i[8]*r+i[12],this.y=i[1]*t+i[5]*n+i[9]*r+i[13],this.z=i[2]*t+i[6]*n+i[10]*r+i[14];var o=i[3]*t+i[7]*n+i[11]*r+i[15];return this.divideScalar(o)},applyQuaternion:function(e){var t=this.x,n=this.y,r=this.z,i=e.x,o=e.y,a=e.z,s=e.w,l=s*t+o*r-a*n,u=s*n+a*t-i*r,c=s*r+i*n-o*t,d=-i*t-o*n-a*r;return this.x=l*s+d*-i+u*-a-c*-o,this.y=u*s+d*-o+c*-i-l*-a,this.z=c*s+d*-a+l*-o-u*-i,this},project:function(){var e;return function(t){return void 0===e&&(e=new d),e.multiplyMatrices(t.projectionMatrix,e.getInverse(t.matrixWorld)),this.applyMatrix4(e)}}(),unproject:function(){var e;return function(t){return void 0===e&&(e=new d),e.multiplyMatrices(t.matrixWorld,e.getInverse(t.projectionMatrix)),this.applyMatrix4(e)}}(),transformDirection:function(e){var t=this.x,n=this.y,r=this.z,i=e.elements;return this.x=i[0]*t+i[4]*n+i[8]*r,this.y=i[1]*t+i[5]*n+i[9]*r,this.z=i[2]*t+i[6]*n+i[10]*r,this.normalize()},divide:function(e){return this.x/=e.x,this.y/=e.y,this.z/=e.z,this},divideScalar:function(e){return this.multiplyScalar(1/e)},min:function(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this.z=Math.min(this.z,e.z),this},max:function(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this.z=Math.max(this.z,e.z),this},clamp:function(e,t){return this.x=Math.max(e.x,Math.min(t.x,this.x)),this.y=Math.max(e.y,Math.min(t.y,this.y)),this.z=Math.max(e.z,Math.min(t.z,this.z)),this},clampScalar:function(){var e,t;return function(n,r){return void 0===e&&(e=new c,t=new c),e.set(n,n,n),t.set(r,r,r),this.clamp(e,t)}}(),clampLength:function(e,t){var n=this.length();return this.multiplyScalar(Math.max(e,Math.min(t,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(e){return this.x*e.x+this.y*e.y+this.z*e.z},lengthSq:function(){return this.x*this.x+this.y*this.y+this.z*this.z},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)},lengthManhattan:function(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)},normalize:function(){return this.divideScalar(this.length())},setLength:function(e){return this.multiplyScalar(e/this.length())},lerp:function(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this.z+=(e.z-this.z)*t,this},lerpVectors:function(e,t,n){return this.subVectors(t,e).multiplyScalar(n).add(e)},cross:function(e,t){if(void 0!==t)return console.warn("THREE.Vector3: .cross() now only accepts one argument. Use .crossVectors( a, b ) instead."),this.crossVectors(e,t);var n=this.x,r=this.y,i=this.z;return this.x=r*e.z-i*e.y,this.y=i*e.x-n*e.z,this.z=n*e.y-r*e.x,this},crossVectors:function(e,t){var n=e.x,r=e.y,i=e.z,o=t.x,a=t.y,s=t.z;return this.x=r*s-i*a,this.y=i*o-n*s,this.z=n*a-r*o,this},projectOnVector:function(e){var t=e.dot(this)/e.lengthSq();return this.copy(e).multiplyScalar(t)},projectOnPlane:function(){var e;return function(t){return void 0===e&&(e=new c),e.copy(this).projectOnVector(t),this.sub(e)}}(),reflect:function(){var e;return function(t){return void 0===e&&(e=new c),this.sub(e.copy(t).multiplyScalar(2*this.dot(t)))}}(),angleTo:function(e){var t=this.dot(e)/Math.sqrt(this.lengthSq()*e.lengthSq());return Math.acos(fs.clamp(t,-1,1))},distanceTo:function(e){return Math.sqrt(this.distanceToSquared(e))},distanceToSquared:function(e){var t=this.x-e.x,n=this.y-e.y,r=this.z-e.z;return t*t+n*n+r*r},distanceToManhattan:function(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)+Math.abs(this.z-e.z)},setFromSpherical:function(e){var t=Math.sin(e.phi)*e.radius;return this.x=t*Math.sin(e.theta),this.y=Math.cos(e.phi)*e.radius,this.z=t*Math.cos(e.theta),this},setFromCylindrical:function(e){return this.x=e.radius*Math.sin(e.theta),this.y=e.y,this.z=e.radius*Math.cos(e.theta),this},setFromMatrixPosition:function(e){return this.setFromMatrixColumn(e,3)},setFromMatrixScale:function(e){var t=this.setFromMatrixColumn(e,0).length(),n=this.setFromMatrixColumn(e,1).length(),r=this.setFromMatrixColumn(e,2).length();return this.x=t,this.y=n,this.z=r,this},setFromMatrixColumn:function(e,t){if("number"==typeof e){console.warn("THREE.Vector3: setFromMatrixColumn now expects ( matrix, index ).");var n=e;e=t,t=n}return this.fromArray(e.elements,4*t)},equals:function(e){return e.x===this.x&&e.y===this.y&&e.z===this.z},fromArray:function(e,t){return void 0===t&&(t=0),this.x=e[t],this.y=e[t+1],this.z=e[t+2],this},toArray:function(e,t){return void 0===e&&(e=[]),void 0===t&&(t=0),e[t]=this.x,e[t+1]=this.y,e[t+2]=this.z,e},fromBufferAttribute:function(e,t,n){return void 0!==n&&console.warn("THREE.Vector3: offset has been removed from .fromBufferAttribute()."),this.x=e.getX(t),this.y=e.getY(t),this.z=e.getZ(t),this}},d.prototype={constructor:d,isMatrix4:!0,set:function(e,t,n,r,i,o,a,s,l,u,c,d,h,f,p,m){var g=this.elements;return g[0]=e,g[4]=t,g[8]=n,g[12]=r,g[1]=i,g[5]=o,g[9]=a,g[13]=s,g[2]=l,g[6]=u,g[10]=c,g[14]=d,g[3]=h,g[7]=f,g[11]=p,g[15]=m,this},identity:function(){return this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1),this},clone:function(){return(new d).fromArray(this.elements)},copy:function(e){return this.elements.set(e.elements),this},copyPosition:function(e){var t=this.elements,n=e.elements;return t[12]=n[12],t[13]=n[13],t[14]=n[14],this},extractBasis:function(e,t,n){return e.setFromMatrixColumn(this,0),t.setFromMatrixColumn(this,1),n.setFromMatrixColumn(this,2),this},makeBasis:function(e,t,n){return this.set(e.x,t.x,n.x,0,e.y,t.y,n.y,0,e.z,t.z,n.z,0,0,0,0,1),this},extractRotation:function(){var e;return function(t){void 0===e&&(e=new c);var n=this.elements,r=t.elements,i=1/e.setFromMatrixColumn(t,0).length(),o=1/e.setFromMatrixColumn(t,1).length(),a=1/e.setFromMatrixColumn(t,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(e){!1===(e&&e.isEuler)&&console.error("THREE.Matrix: .makeRotationFromEuler() now expects a Euler rotation rather than a Vector3 and order.");var t=this.elements,n=e.x,r=e.y,i=e.z,o=Math.cos(n),a=Math.sin(n),s=Math.cos(r),l=Math.sin(r),u=Math.cos(i),c=Math.sin(i);if("XYZ"===e.order){var d=o*u,h=o*c,f=a*u,p=a*c;t[0]=s*u,t[4]=-s*c,t[8]=l,t[1]=h+f*l,t[5]=d-p*l,t[9]=-a*s,t[2]=p-d*l,t[6]=f+h*l,t[10]=o*s}else if("YXZ"===e.order){var m=s*u,g=s*c,v=l*u,y=l*c;t[0]=m+y*a,t[4]=v*a-g,t[8]=o*l,t[1]=o*c,t[5]=o*u,t[9]=-a,t[2]=g*a-v,t[6]=y+m*a,t[10]=o*s}else if("ZXY"===e.order){var m=s*u,g=s*c,v=l*u,y=l*c;t[0]=m-y*a,t[4]=-o*c,t[8]=v+g*a,t[1]=g+v*a,t[5]=o*u,t[9]=y-m*a,t[2]=-o*l,t[6]=a,t[10]=o*s}else if("ZYX"===e.order){var d=o*u,h=o*c,f=a*u,p=a*c;t[0]=s*u,t[4]=f*l-h,t[8]=d*l+p,t[1]=s*c,t[5]=p*l+d,t[9]=h*l-f,t[2]=-l,t[6]=a*s,t[10]=o*s}else if("YZX"===e.order){var b=o*s,x=o*l,_=a*s,w=a*l;t[0]=s*u,t[4]=w-b*c,t[8]=_*c+x,t[1]=c,t[5]=o*u,t[9]=-a*u,t[2]=-l*u,t[6]=x*c+_,t[10]=b-w*c}else if("XZY"===e.order){var b=o*s,x=o*l,_=a*s,w=a*l;t[0]=s*u,t[4]=-c,t[8]=l*u,t[1]=b*c+w,t[5]=o*u,t[9]=x*c-_,t[2]=_*c-x,t[6]=a*u,t[10]=w*c+b}return t[3]=0,t[7]=0,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this},makeRotationFromQuaternion:function(e){var t=this.elements,n=e.x,r=e.y,i=e.z,o=e.w,a=n+n,s=r+r,l=i+i,u=n*a,c=n*s,d=n*l,h=r*s,f=r*l,p=i*l,m=o*a,g=o*s,v=o*l;return t[0]=1-(h+p),t[4]=c-v,t[8]=d+g,t[1]=c+v,t[5]=1-(u+p),t[9]=f-m,t[2]=d-g,t[6]=f+m,t[10]=1-(u+h),t[3]=0,t[7]=0,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this},lookAt:function(){var e,t,n;return function(r,i,o){void 0===e&&(e=new c,t=new c,n=new c);var a=this.elements;return n.subVectors(r,i).normalize(),0===n.lengthSq()&&(n.z=1),e.crossVectors(o,n).normalize(),0===e.lengthSq()&&(n.z+=1e-4,e.crossVectors(o,n).normalize()),t.crossVectors(n,e),a[0]=e.x,a[4]=t.x,a[8]=n.x,a[1]=e.y,a[5]=t.y,a[9]=n.y,a[2]=e.z,a[6]=t.z,a[10]=n.z,this}}(),multiply:function(e,t){return void 0!==t?(console.warn("THREE.Matrix4: .multiply() now only accepts one argument. Use .multiplyMatrices( a, b ) instead."),this.multiplyMatrices(e,t)):this.multiplyMatrices(this,e)},premultiply:function(e){return this.multiplyMatrices(e,this)},multiplyMatrices:function(e,t){var n=e.elements,r=t.elements,i=this.elements,o=n[0],a=n[4],s=n[8],l=n[12],u=n[1],c=n[5],d=n[9],h=n[13],f=n[2],p=n[6],m=n[10],g=n[14],v=n[3],y=n[7],b=n[11],x=n[15],_=r[0],w=r[4],M=r[8],S=r[12],E=r[1],T=r[5],k=r[9],C=r[13],P=r[2],O=r[6],A=r[10],R=r[14],L=r[3],D=r[7],I=r[11],z=r[15];return i[0]=o*_+a*E+s*P+l*L,i[4]=o*w+a*T+s*O+l*D,i[8]=o*M+a*k+s*A+l*I,i[12]=o*S+a*C+s*R+l*z,i[1]=u*_+c*E+d*P+h*L,i[5]=u*w+c*T+d*O+h*D,i[9]=u*M+c*k+d*A+h*I,i[13]=u*S+c*C+d*R+h*z,i[2]=f*_+p*E+m*P+g*L,i[6]=f*w+p*T+m*O+g*D,i[10]=f*M+p*k+m*A+g*I,i[14]=f*S+p*C+m*R+g*z,i[3]=v*_+y*E+b*P+x*L,i[7]=v*w+y*T+b*O+x*D,i[11]=v*M+y*k+b*A+x*I,i[15]=v*S+y*C+b*R+x*z,this},multiplyToArray:function(e,t,n){var r=this.elements;return this.multiplyMatrices(e,t),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(e){var t=this.elements;return t[0]*=e,t[4]*=e,t[8]*=e,t[12]*=e,t[1]*=e,t[5]*=e,t[9]*=e,t[13]*=e,t[2]*=e,t[6]*=e,t[10]*=e,t[14]*=e,t[3]*=e,t[7]*=e,t[11]*=e,t[15]*=e,this},applyToBufferAttribute:function(){var e;return function(t){void 0===e&&(e=new c);for(var n=0,r=t.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"};X.prototype={constructor:X,isColor:!0,r:1,g:1,b:1,set:function(e){return e&&e.isColor?this.copy(e):"number"==typeof e?this.setHex(e):"string"==typeof e&&this.setStyle(e),this},setScalar:function(e){return this.r=e,this.g=e,this.b=e,this},setHex:function(e){return e=Math.floor(e),this.r=(e>>16&255)/255,this.g=(e>>8&255)/255,this.b=(255&e)/255,this},setRGB:function(e,t,n){return this.r=e,this.g=t,this.b=n,this},setHSL:function(){function e(e,t,n){return n<0&&(n+=1),n>1&&(n-=1),n<1/6?e+6*(t-e)*n:n<.5?t:n<2/3?e+6*(t-e)*(2/3-n):e}return function(t,n,r){if(t=fs.euclideanModulo(t,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=e(o,i,t+1/3),this.g=e(o,i,t),this.b=e(o,i,t-1/3)}return this}}(),setStyle:function(e){function t(t){void 0!==t&&parseFloat(t)<1&&console.warn("THREE.Color: Alpha component of "+e+" will be ignored.")}var n;if(n=/^((?:rgb|hsl)a?)\(\s*([^\)]*)\)/.exec(e)){var r,i=n[1],o=n[2];switch(i){case"rgb":case"rgba":if(r=/^(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(,\s*([0-9]*\.?[0-9]+)\s*)?$/.exec(o))return this.r=Math.min(255,parseInt(r[1],10))/255,this.g=Math.min(255,parseInt(r[2],10))/255,this.b=Math.min(255,parseInt(r[3],10))/255,t(r[5]),this;if(r=/^(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(,\s*([0-9]*\.?[0-9]+)\s*)?$/.exec(o))return this.r=Math.min(100,parseInt(r[1],10))/100,this.g=Math.min(100,parseInt(r[2],10))/100,this.b=Math.min(100,parseInt(r[3],10))/100,t(r[5]),this;break;case"hsl":case"hsla":if(r=/^([0-9]*\.?[0-9]+)\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(,\s*([0-9]*\.?[0-9]+)\s*)?$/.exec(o)){var a=parseFloat(r[1])/360,s=parseInt(r[2],10)/100,l=parseInt(r[3],10)/100;return t(r[5]),this.setHSL(a,s,l)}}}else if(n=/^\#([A-Fa-f0-9]+)$/.exec(e)){var u=n[1],c=u.length;if(3===c)return this.r=parseInt(u.charAt(0)+u.charAt(0),16)/255,this.g=parseInt(u.charAt(1)+u.charAt(1),16)/255,this.b=parseInt(u.charAt(2)+u.charAt(2),16)/255,this;if(6===c)return this.r=parseInt(u.charAt(0)+u.charAt(1),16)/255,this.g=parseInt(u.charAt(2)+u.charAt(3),16)/255,this.b=parseInt(u.charAt(4)+u.charAt(5),16)/255,this}if(e&&e.length>0){var u=ws[e];void 0!==u?this.setHex(u):console.warn("THREE.Color: Unknown color "+e)}return this},clone:function(){return new this.constructor(this.r,this.g,this.b)},copy:function(e){return this.r=e.r,this.g=e.g,this.b=e.b,this},copyGammaToLinear:function(e,t){return void 0===t&&(t=2),this.r=Math.pow(e.r,t),this.g=Math.pow(e.g,t),this.b=Math.pow(e.b,t),this},copyLinearToGamma:function(e,t){void 0===t&&(t=2);var n=t>0?1/t:1;return this.r=Math.pow(e.r,n),this.g=Math.pow(e.g,n),this.b=Math.pow(e.b,n),this},convertGammaToLinear:function(){var e=this.r,t=this.g,n=this.b;return this.r=e*e,this.g=t*t,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(e){var t,n,r=e||{h:0,s:0,l:0},i=this.r,o=this.g,a=this.b,s=Math.max(i,o,a),l=Math.min(i,o,a),u=(l+s)/2;if(l===s)t=0,n=0;else{var c=s-l;switch(n=u<=.5?c/(s+l):c/(2-s-l),s){case i:t=(o-a)/c+(othis.max.x||e.ythis.max.y)},containsBox:function(e){return this.min.x<=e.min.x&&e.max.x<=this.max.x&&this.min.y<=e.min.y&&e.max.y<=this.max.y},getParameter:function(e,t){return(t||new i).set((e.x-this.min.x)/(this.max.x-this.min.x),(e.y-this.min.y)/(this.max.y-this.min.y))},intersectsBox:function(e){return!(e.max.xthis.max.x||e.max.ythis.max.y)},clampPoint:function(e,t){return(t||new i).copy(e).clamp(this.min,this.max)},distanceToPoint:function(){var e=new i;return function(t){return e.copy(t).clamp(this.min,this.max).sub(t).length()}}(),intersect:function(e){return this.min.max(e.min),this.max.min(e.max),this},union:function(e){return this.min.min(e.min),this.max.max(e.max),this},translate:function(e){return this.min.add(e),this.max.add(e),this},equals:function(e){return e.min.equals(this.min)&&e.max.equals(this.max)}};var Es=0;$.prototype={constructor:$,isMaterial:!0,get needsUpdate(){return this._needsUpdate},set needsUpdate(e){!0===e&&this.update(),this._needsUpdate=e},setValues:function(e){if(void 0!==e)for(var t in e){var n=e[t];if(void 0!==n){var r=this[t];void 0!==r?r&&r.isColor?r.set(n):r&&r.isVector3&&n&&n.isVector3?r.copy(n):this[t]="overdraw"===t?Number(n):n:console.warn("THREE."+this.type+": '"+t+"' is not a property of this material.")}else console.warn("THREE.Material: '"+t+"' parameter is undefined.")}},toJSON:function(e){function t(e){var t=[];for(var n in e){var r=e[n];delete r.metadata,t.push(r)}return t}var n=void 0===e;n&&(e={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(e).uuid),this.alphaMap&&this.alphaMap.isTexture&&(r.alphaMap=this.alphaMap.toJSON(e).uuid),this.lightMap&&this.lightMap.isTexture&&(r.lightMap=this.lightMap.toJSON(e).uuid),this.bumpMap&&this.bumpMap.isTexture&&(r.bumpMap=this.bumpMap.toJSON(e).uuid,r.bumpScale=this.bumpScale),this.normalMap&&this.normalMap.isTexture&&(r.normalMap=this.normalMap.toJSON(e).uuid,r.normalScale=this.normalScale.toArray()),this.displacementMap&&this.displacementMap.isTexture&&(r.displacementMap=this.displacementMap.toJSON(e).uuid,r.displacementScale=this.displacementScale,r.displacementBias=this.displacementBias),this.roughnessMap&&this.roughnessMap.isTexture&&(r.roughnessMap=this.roughnessMap.toJSON(e).uuid),this.metalnessMap&&this.metalnessMap.isTexture&&(r.metalnessMap=this.metalnessMap.toJSON(e).uuid),this.emissiveMap&&this.emissiveMap.isTexture&&(r.emissiveMap=this.emissiveMap.toJSON(e).uuid),this.specularMap&&this.specularMap.isTexture&&(r.specularMap=this.specularMap.toJSON(e).uuid),this.envMap&&this.envMap.isTexture&&(r.envMap=this.envMap.toJSON(e).uuid,r.reflectivity=this.reflectivity),this.gradientMap&&this.gradientMap.isTexture&&(r.gradientMap=this.gradientMap.toJSON(e).uuid),void 0!==this.size&&(r.size=this.size),void 0!==this.sizeAttenuation&&(r.sizeAttenuation=this.sizeAttenuation),this.blending!==go&&(r.blending=this.blending),this.shading!==co&&(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=t(e.textures),o=t(e.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(e){this.name=e.name,this.fog=e.fog,this.lights=e.lights,this.blending=e.blending,this.side=e.side,this.shading=e.shading,this.vertexColors=e.vertexColors,this.opacity=e.opacity,this.transparent=e.transparent,this.blendSrc=e.blendSrc,this.blendDst=e.blendDst,this.blendEquation=e.blendEquation,this.blendSrcAlpha=e.blendSrcAlpha,this.blendDstAlpha=e.blendDstAlpha,this.blendEquationAlpha=e.blendEquationAlpha,this.depthFunc=e.depthFunc,this.depthTest=e.depthTest,this.depthWrite=e.depthWrite,this.colorWrite=e.colorWrite,this.precision=e.precision,this.polygonOffset=e.polygonOffset,this.polygonOffsetFactor=e.polygonOffsetFactor,this.polygonOffsetUnits=e.polygonOffsetUnits,this.alphaTest=e.alphaTest,this.premultipliedAlpha=e.premultipliedAlpha,this.overdraw=e.overdraw,this.visible=e.visible,this.clipShadows=e.clipShadows,this.clipIntersection=e.clipIntersection;var t=e.clippingPlanes,n=null;if(null!==t){var r=t.length;n=new Array(r);for(var i=0;i!==r;++i)n[i]=t[i].clone()}return this.clippingPlanes=n,this},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(e){return $.prototype.copy.call(this,e),this.fragmentShader=e.fragmentShader,this.vertexShader=e.vertexShader,this.uniforms=xs.clone(e.uniforms),this.defines=e.defines,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.lights=e.lights,this.clipping=e.clipping,this.skinning=e.skinning,this.morphTargets=e.morphTargets,this.morphNormals=e.morphNormals,this.extensions=e.extensions,this},Q.prototype.toJSON=function(e){var t=$.prototype.toJSON.call(this,e);return t.uniforms=this.uniforms,t.vertexShader=this.vertexShader,t.fragmentShader=this.fragmentShader,t},ee.prototype=Object.create($.prototype),ee.prototype.constructor=ee,ee.prototype.isMeshDepthMaterial=!0,ee.prototype.copy=function(e){return $.prototype.copy.call(this,e),this.depthPacking=e.depthPacking,this.skinning=e.skinning,this.morphTargets=e.morphTargets,this.map=e.map,this.alphaMap=e.alphaMap,this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this},te.prototype={constructor:te,isBox3:!0,set:function(e,t){return this.min.copy(e),this.max.copy(t),this},setFromArray:function(e){for(var t=1/0,n=1/0,r=1/0,i=-1/0,o=-1/0,a=-1/0,s=0,l=e.length;si&&(i=u),c>o&&(o=c),d>a&&(a=d)}return this.min.set(t,n,r),this.max.set(i,o,a),this},setFromBufferAttribute:function(e){for(var t=1/0,n=1/0,r=1/0,i=-1/0,o=-1/0,a=-1/0,s=0,l=e.count;si&&(i=u),c>o&&(o=c),d>a&&(a=d)}return this.min.set(t,n,r),this.max.set(i,o,a),this},setFromPoints:function(e){this.makeEmpty();for(var t=0,n=e.length;tthis.max.x||e.ythis.max.y||e.zthis.max.z)},containsBox:function(e){return this.min.x<=e.min.x&&e.max.x<=this.max.x&&this.min.y<=e.min.y&&e.max.y<=this.max.y&&this.min.z<=e.min.z&&e.max.z<=this.max.z},getParameter:function(e,t){return(t||new c).set((e.x-this.min.x)/(this.max.x-this.min.x),(e.y-this.min.y)/(this.max.y-this.min.y),(e.z-this.min.z)/(this.max.z-this.min.z))},intersectsBox:function(e){return!(e.max.xthis.max.x||e.max.ythis.max.y||e.max.zthis.max.z)},intersectsSphere:function(){var e;return function(t){return void 0===e&&(e=new c),this.clampPoint(t.center,e),e.distanceToSquared(t.center)<=t.radius*t.radius}}(),intersectsPlane:function(e){var t,n;return e.normal.x>0?(t=e.normal.x*this.min.x,n=e.normal.x*this.max.x):(t=e.normal.x*this.max.x,n=e.normal.x*this.min.x),e.normal.y>0?(t+=e.normal.y*this.min.y,n+=e.normal.y*this.max.y):(t+=e.normal.y*this.max.y,n+=e.normal.y*this.min.y),e.normal.z>0?(t+=e.normal.z*this.min.z,n+=e.normal.z*this.max.z):(t+=e.normal.z*this.max.z,n+=e.normal.z*this.min.z),t<=e.constant&&n>=e.constant},clampPoint:function(e,t){return(t||new c).copy(e).clamp(this.min,this.max)},distanceToPoint:function(){var e=new c;return function(t){return e.copy(t).clamp(this.min,this.max).sub(t).length()}}(),getBoundingSphere:function(){var e=new c;return function(t){var n=t||new ne;return this.getCenter(n.center),n.radius=.5*this.getSize(e).length(),n}}(),intersect:function(e){return this.min.max(e.min),this.max.min(e.max),this.isEmpty()&&this.makeEmpty(),this},union:function(e){return this.min.min(e.min),this.max.max(e.max),this},applyMatrix4:function(){var e=[new c,new c,new c,new c,new c,new c,new c,new c];return function(t){return this.isEmpty()?this:(e[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(t),e[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(t),e[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(t),e[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(t),e[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(t),e[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(t),e[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(t),e[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(t),this.setFromPoints(e),this)}}(),translate:function(e){return this.min.add(e),this.max.add(e),this},equals:function(e){return e.min.equals(this.min)&&e.max.equals(this.max)}},ne.prototype={constructor:ne,set:function(e,t){return this.center.copy(e),this.radius=t,this},setFromPoints:function(){var e;return function(t,n){void 0===e&&(e=new te);var r=this.center;void 0!==n?r.copy(n):e.setFromPoints(t).getCenter(r);for(var i=0,o=0,a=t.length;othis.radius*this.radius&&(r.sub(this.center).normalize(),r.multiplyScalar(this.radius).add(this.center)),r},getBoundingBox:function(e){var t=e||new te;return t.set(this.center,this.center),t.expandByScalar(this.radius),t},applyMatrix4:function(e){return this.center.applyMatrix4(e),this.radius=this.radius*e.getMaxScaleOnAxis(),this},translate:function(e){return this.center.add(e),this},equals:function(e){return e.center.equals(this.center)&&e.radius===this.radius}},re.prototype={constructor:re,isMatrix3:!0,set:function(e,t,n,r,i,o,a,s,l){var u=this.elements;return u[0]=e,u[1]=r,u[2]=a,u[3]=t,u[4]=i,u[5]=s,u[6]=n,u[7]=o,u[8]=l,this},identity:function(){return this.set(1,0,0,0,1,0,0,0,1),this},clone:function(){return(new this.constructor).fromArray(this.elements)},copy:function(e){var t=e.elements;return this.set(t[0],t[3],t[6],t[1],t[4],t[7],t[2],t[5],t[8]),this},setFromMatrix4:function(e){var t=e.elements;return this.set(t[0],t[4],t[8],t[1],t[5],t[9],t[2],t[6],t[10]),this},applyToBufferAttribute:function(){var e;return function(t){void 0===e&&(e=new c);for(var n=0,r=t.count;n1))return r.copy(i).multiplyScalar(a).add(t.start)}else if(0===this.distanceToPoint(t.start))return r.copy(t.start)}}(),intersectsLine:function(e){var t=this.distanceToPoint(e.start),n=this.distanceToPoint(e.end);return t<0&&n>0||n<0&&t>0},intersectsBox:function(e){return e.intersectsPlane(this)},intersectsSphere:function(e){return e.intersectsPlane(this)},coplanarPoint:function(e){return(e||new c).copy(this.normal).multiplyScalar(-this.constant)},applyMatrix4:function(){var e=new c,t=new re;return function(n,r){var i=this.coplanarPoint(e).applyMatrix4(n),o=r||t.getNormalMatrix(n),a=this.normal.applyMatrix3(o).normalize();return this.constant=-i.dot(a),this}}(),translate:function(e){return this.constant=this.constant-e.dot(this.normal),this},equals:function(e){return e.normal.equals(this.normal)&&e.constant===this.constant}},oe.prototype={constructor:oe,set:function(e,t,n,r,i,o){var a=this.planes;return a[0].copy(e),a[1].copy(t),a[2].copy(n),a[3].copy(r),a[4].copy(i),a[5].copy(o),this},clone:function(){return(new this.constructor).copy(this)},copy:function(e){for(var t=this.planes,n=0;n<6;n++)t[n].copy(e.planes[n]);return this},setFromMatrix:function(e){var t=this.planes,n=e.elements,r=n[0],i=n[1],o=n[2],a=n[3],s=n[4],l=n[5],u=n[6],c=n[7],d=n[8],h=n[9],f=n[10],p=n[11],m=n[12],g=n[13],v=n[14],y=n[15];return t[0].setComponents(a-r,c-s,p-d,y-m).normalize(),t[1].setComponents(a+r,c+s,p+d,y+m).normalize(),t[2].setComponents(a+i,c+l,p+h,y+g).normalize(),t[3].setComponents(a-i,c-l,p-h,y-g).normalize(),t[4].setComponents(a-o,c-u,p-f,y-v).normalize(),t[5].setComponents(a+o,c+u,p+f,y+v).normalize(),this},intersectsObject:function(){var e=new ne;return function(t){var n=t.geometry;return null===n.boundingSphere&&n.computeBoundingSphere(),e.copy(n.boundingSphere).applyMatrix4(t.matrixWorld),this.intersectsSphere(e)}}(),intersectsSprite:function(){var e=new ne;return function(t){return e.center.set(0,0,0),e.radius=.7071067811865476,e.applyMatrix4(t.matrixWorld),this.intersectsSphere(e)}}(),intersectsSphere:function(e){for(var t=this.planes,n=e.center,r=-e.radius,i=0;i<6;i++){if(t[i].distanceToPoint(n)0?n.min.x:n.max.x,t.x=o.normal.x>0?n.max.x:n.min.x,e.y=o.normal.y>0?n.min.y:n.max.y,t.y=o.normal.y>0?n.max.y:n.min.y,e.z=o.normal.z>0?n.min.z:n.max.z,t.z=o.normal.z>0?n.max.z:n.min.z;var a=o.distanceToPoint(e),s=o.distanceToPoint(t);if(a<0&&s<0)return!1}return!0}}(),containsPoint:function(e){for(var t=this.planes,n=0;n<6;n++)if(t[n].distanceToPoint(e)<0)return!1;return!0}},se.prototype={constructor:se,set:function(e,t){return this.origin.copy(e),this.direction.copy(t),this},clone:function(){return(new this.constructor).copy(this)},copy:function(e){return this.origin.copy(e.origin),this.direction.copy(e.direction),this},at:function(e,t){return(t||new c).copy(this.direction).multiplyScalar(e).add(this.origin)},lookAt:function(e){return this.direction.copy(e).sub(this.origin).normalize(),this},recast:function(){var e=new c;return function(t){return this.origin.copy(this.at(t,e)),this}}(),closestPointToPoint:function(e,t){var n=t||new c;n.subVectors(e,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(e){return Math.sqrt(this.distanceSqToPoint(e))},distanceSqToPoint:function(){var e=new c;return function(t){var n=e.subVectors(t,this.origin).dot(this.direction);return n<0?this.origin.distanceToSquared(t):(e.copy(this.direction).multiplyScalar(n).add(this.origin),e.distanceToSquared(t))}}(),distanceSqToSegment:function(){var e=new c,t=new c,n=new c;return function(r,i,o,a){e.copy(r).add(i).multiplyScalar(.5),t.copy(i).sub(r).normalize(),n.copy(this.origin).sub(e);var s,l,u,c,d=.5*r.distanceTo(i),h=-this.direction.dot(t),f=n.dot(this.direction),p=-n.dot(t),m=n.lengthSq(),g=Math.abs(1-h*h);if(g>0)if(s=h*p-f,l=h*f-p,c=d*g,s>=0)if(l>=-c)if(l<=c){var v=1/g;s*=v,l*=v,u=s*(s+h*l+2*f)+l*(h*s+l+2*p)+m}else l=d,s=Math.max(0,-(h*l+f)),u=-s*s+l*(l+2*p)+m;else l=-d,s=Math.max(0,-(h*l+f)),u=-s*s+l*(l+2*p)+m;else l<=-c?(s=Math.max(0,-(-h*d+f)),l=s>0?-d:Math.min(Math.max(-d,-p),d),u=-s*s+l*(l+2*p)+m):l<=c?(s=0,l=Math.min(Math.max(-d,-p),d),u=l*(l+2*p)+m):(s=Math.max(0,-(h*d+f)),l=s>0?d:Math.min(Math.max(-d,-p),d),u=-s*s+l*(l+2*p)+m);else l=h>0?-d:d,s=Math.max(0,-(h*l+f)),u=-s*s+l*(l+2*p)+m;return o&&o.copy(this.direction).multiplyScalar(s).add(this.origin),a&&a.copy(t).multiplyScalar(l).add(e),u}}(),intersectSphere:function(){var e=new c;return function(t,n){e.subVectors(t.center,this.origin);var r=e.dot(this.direction),i=e.dot(e)-r*r,o=t.radius*t.radius;if(i>o)return null;var a=Math.sqrt(o-i),s=r-a,l=r+a;return s<0&&l<0?null:s<0?this.at(l,n):this.at(s,n)}}(),intersectsSphere:function(e){return this.distanceToPoint(e.center)<=e.radius},distanceToPlane:function(e){var t=e.normal.dot(this.direction);if(0===t)return 0===e.distanceToPoint(this.origin)?0:null;var n=-(this.origin.dot(e.normal)+e.constant)/t;return n>=0?n:null},intersectPlane:function(e,t){var n=this.distanceToPlane(e);return null===n?null:this.at(n,t)},intersectsPlane:function(e){var t=e.distanceToPoint(this.origin);return 0===t||e.normal.dot(this.direction)*t<0},intersectBox:function(e,t){var n,r,i,o,a,s,l=1/this.direction.x,u=1/this.direction.y,c=1/this.direction.z,d=this.origin;return l>=0?(n=(e.min.x-d.x)*l,r=(e.max.x-d.x)*l):(n=(e.max.x-d.x)*l,r=(e.min.x-d.x)*l),u>=0?(i=(e.min.y-d.y)*u,o=(e.max.y-d.y)*u):(i=(e.max.y-d.y)*u,o=(e.min.y-d.y)*u),n>o||i>r?null:((i>n||n!==n)&&(n=i),(o=0?(a=(e.min.z-d.z)*c,s=(e.max.z-d.z)*c):(a=(e.max.z-d.z)*c,s=(e.min.z-d.z)*c),n>s||a>r?null:((a>n||n!==n)&&(n=a),(s=0?n:r,t)))},intersectsBox:function(){var e=new c;return function(t){return null!==this.intersectBox(t,e)}}(),intersectTriangle:function(){var e=new c,t=new c,n=new c,r=new c;return function(i,o,a,s,l){t.subVectors(o,i),n.subVectors(a,i),r.crossVectors(t,n);var u,c=this.direction.dot(r);if(c>0){if(s)return null;u=1}else{if(!(c<0))return null;u=-1,c=-c}e.subVectors(this.origin,i);var d=u*this.direction.dot(n.crossVectors(e,n));if(d<0)return null;var h=u*this.direction.dot(t.cross(e));if(h<0)return null;if(d+h>c)return null;var f=-u*e.dot(r);return f<0?null:this.at(f/c,l)}}(),applyMatrix4:function(e){return this.direction.add(this.origin).applyMatrix4(e),this.origin.applyMatrix4(e),this.direction.sub(this.origin),this.direction.normalize(),this},equals:function(e){return e.origin.equals(this.origin)&&e.direction.equals(this.direction)}},le.RotationOrders=["XYZ","YZX","ZXY","XZY","YXZ","ZYX"],le.DefaultOrder="XYZ",le.prototype={constructor:le,isEuler:!0,get x(){return this._x},set x(e){this._x=e,this.onChangeCallback()},get y(){return this._y},set y(e){this._y=e,this.onChangeCallback()},get z(){return this._z},set z(e){this._z=e,this.onChangeCallback()},get order(){return this._order},set order(e){this._order=e,this.onChangeCallback()},set:function(e,t,n,r){return this._x=e,this._y=t,this._z=n,this._order=r||this._order,this.onChangeCallback(),this},clone:function(){return new this.constructor(this._x,this._y,this._z,this._order)},copy:function(e){return this._x=e._x,this._y=e._y,this._z=e._z,this._order=e._order,this.onChangeCallback(),this},setFromRotationMatrix:function(e,t,n){var r=fs.clamp,i=e.elements,o=i[0],a=i[4],s=i[8],l=i[1],u=i[5],c=i[9],d=i[2],h=i[6],f=i[10];return t=t||this._order,"XYZ"===t?(this._y=Math.asin(r(s,-1,1)),Math.abs(s)<.99999?(this._x=Math.atan2(-c,f),this._z=Math.atan2(-a,o)):(this._x=Math.atan2(h,u),this._z=0)):"YXZ"===t?(this._x=Math.asin(-r(c,-1,1)),Math.abs(c)<.99999?(this._y=Math.atan2(s,f),this._z=Math.atan2(l,u)):(this._y=Math.atan2(-d,o),this._z=0)):"ZXY"===t?(this._x=Math.asin(r(h,-1,1)),Math.abs(h)<.99999?(this._y=Math.atan2(-d,f),this._z=Math.atan2(-a,u)):(this._y=0,this._z=Math.atan2(l,o))):"ZYX"===t?(this._y=Math.asin(-r(d,-1,1)),Math.abs(d)<.99999?(this._x=Math.atan2(h,f),this._z=Math.atan2(l,o)):(this._x=0,this._z=Math.atan2(-a,u))):"YZX"===t?(this._z=Math.asin(r(l,-1,1)),Math.abs(l)<.99999?(this._x=Math.atan2(-c,u),this._y=Math.atan2(-d,o)):(this._x=0,this._y=Math.atan2(s,f))):"XZY"===t?(this._z=Math.asin(-r(a,-1,1)),Math.abs(a)<.99999?(this._x=Math.atan2(h,u),this._y=Math.atan2(s,o)):(this._x=Math.atan2(-c,f),this._y=0)):console.warn("THREE.Euler: .setFromRotationMatrix() given unsupported order: "+t),this._order=t,!1!==n&&this.onChangeCallback(),this},setFromQuaternion:function(){var e;return function(t,n,r){return void 0===e&&(e=new d),e.makeRotationFromQuaternion(t),this.setFromRotationMatrix(e,n,r)}}(),setFromVector3:function(e,t){return this.set(e.x,e.y,e.z,t||this._order)},reorder:function(){var e=new u;return function(t){return e.setFromEuler(this),this.setFromQuaternion(e,t)}}(),equals:function(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._order===this._order},fromArray:function(e){return this._x=e[0],this._y=e[1],this._z=e[2],void 0!==e[3]&&(this._order=e[3]),this.onChangeCallback(),this},toArray:function(e,t){return void 0===e&&(e=[]),void 0===t&&(t=0),e[t]=this._x,e[t+1]=this._y,e[t+2]=this._z,e[t+3]=this._order,e},toVector3:function(e){return e?e.set(this._x,this._y,this._z):new c(this._x,this._y,this._z)},onChange:function(e){return this.onChangeCallback=e,this},onChangeCallback:function(){}},ue.prototype={constructor:ue,set:function(e){this.mask=1<1){for(var t=0;t1)for(var t=0;t0){i.children=[];for(var o=0;o0&&(r.geometries=a),s.length>0&&(r.materials=s),l.length>0&&(r.textures=l),u.length>0&&(r.images=u)}return r.object=i,r},clone:function(e){return(new this.constructor).copy(this,e)},copy:function(e,t){if(void 0===t&&(t=!0),this.name=e.name,this.up.copy(e.up),this.position.copy(e.position),this.quaternion.copy(e.quaternion),this.scale.copy(e.scale),this.matrix.copy(e.matrix),this.matrixWorld.copy(e.matrixWorld),this.matrixAutoUpdate=e.matrixAutoUpdate,this.matrixWorldNeedsUpdate=e.matrixWorldNeedsUpdate,this.layers.mask=e.layers.mask,this.visible=e.visible,this.castShadow=e.castShadow,this.receiveShadow=e.receiveShadow,this.frustumCulled=e.frustumCulled,this.renderOrder=e.renderOrder,this.userData=JSON.parse(JSON.stringify(e.userData)),!0===t)for(var n=0;n0?o.multiplyScalar(1/Math.sqrt(a)):o.set(0,0,0)}}(),he.barycoordFromPoint=function(){var e=new c,t=new c,n=new c;return function(r,i,o,a,s){e.subVectors(a,i),t.subVectors(o,i),n.subVectors(r,i);var l=e.dot(e),u=e.dot(t),d=e.dot(n),h=t.dot(t),f=t.dot(n),p=l*h-u*u,m=s||new c;if(0===p)return m.set(-2,-1,-1);var g=1/p,v=(h*d-u*f)*g,y=(l*f-u*d)*g;return m.set(1-v-y,y,v)}}(),he.containsPoint=function(){var e=new c;return function(t,n,r,i){var o=he.barycoordFromPoint(t,n,r,i,e);return o.x>=0&&o.y>=0&&o.x+o.y<=1}}(),he.prototype={constructor:he,set:function(e,t,n){return this.a.copy(e),this.b.copy(t),this.c.copy(n),this},setFromPointsAndIndices:function(e,t,n,r){return this.a.copy(e[t]),this.b.copy(e[n]),this.c.copy(e[r]),this},clone:function(){return(new this.constructor).copy(this)},copy:function(e){return this.a.copy(e.a),this.b.copy(e.b),this.c.copy(e.c),this},area:function(){var e=new c,t=new c;return function(){return e.subVectors(this.c,this.b),t.subVectors(this.a,this.b),.5*e.cross(t).length()}}(),midpoint:function(e){return(e||new c).addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)},normal:function(e){return he.normal(this.a,this.b,this.c,e)},plane:function(e){return(e||new ie).setFromCoplanarPoints(this.a,this.b,this.c)},barycoordFromPoint:function(e,t){return he.barycoordFromPoint(e,this.a,this.b,this.c,t)},containsPoint:function(e){return he.containsPoint(e,this.a,this.b,this.c)},closestPointToPoint:function(){var e,t,n,r;return function(i,o){void 0===e&&(e=new ie,t=[new de,new de,new de],n=new c,r=new c);var a=o||new c,s=1/0;if(e.setFromCoplanarPoints(this.a,this.b,this.c),e.projectPoint(i,n),!0===this.containsPoint(n))a.copy(n);else{t[0].set(this.a,this.b),t[1].set(this.b,this.c),t[2].set(this.c,this.a);for(var l=0;l0,s=o[1]&&o[1].length>0,l=e.morphTargets,u=l.length;if(u>0){t=[];for(var c=0;c0){d=[];for(var c=0;c0)for(var m=0;m0&&(this.normalsNeedUpdate=!0)},computeFlatVertexNormals:function(){var e,t,n;for(this.computeFaceNormals(),e=0,t=this.faces.length;e0&&(this.normalsNeedUpdate=!0)},computeMorphNormals:function(){var e,t,n,r,i;for(n=0,r=this.faces.length;n0&&(e+=t[n].distanceTo(t[n-1])),this.lineDistances[n]=e},computeBoundingBox:function(){null===this.boundingBox&&(this.boundingBox=new te),this.boundingBox.setFromPoints(this.vertices)},computeBoundingSphere:function(){null===this.boundingSphere&&(this.boundingSphere=new ne),this.boundingSphere.setFromPoints(this.vertices)},merge:function(e,t,n){if(!1===(e&&e.isGeometry))return void console.error("THREE.Geometry.merge(): geometry not an instance of THREE.Geometry.",e);var r,i=this.vertices.length,o=this.vertices,a=e.vertices,s=this.faces,l=e.faces,u=this.faceVertexUvs[0],c=e.faceVertexUvs[0],d=this.colors,h=e.colors;void 0===n&&(n=0),void 0!==t&&(r=(new re).getNormalMatrix(t));for(var f=0,p=a.length;f=0;n--){var p=h[n];for(this.faces.splice(p,1),a=0,s=this.faceVertexUvs.length;a0,x=v.vertexNormals.length>0,_=1!==v.color.r||1!==v.color.g||1!==v.color.b,w=v.vertexColors.length>0,M=0;if(M=e(M,0,0),M=e(M,1,!0),M=e(M,2,!1),M=e(M,3,y),M=e(M,4,b),M=e(M,5,x),M=e(M,6,_),M=e(M,7,w),c.push(M),c.push(v.a,v.b,v.c),c.push(v.materialIndex),y){var S=this.faceVertexUvs[0][l];c.push(r(S[0]),r(S[1]),r(S[2]))}if(b&&c.push(t(v.normal)),x){var E=v.vertexNormals;c.push(t(E[0]),t(E[1]),t(E[2]))}if(_&&c.push(n(v.color)),w){var T=v.vertexColors;c.push(n(T[0]),n(T[1]),n(T[2]))}}return i.data={},i.data.vertices=s,i.data.normals=d,f.length>0&&(i.data.colors=f),m.length>0&&(i.data.uvs=[m]),i.data.faces=c,i},clone:function(){return(new Ce).copy(this)},copy:function(e){var t,n,r,i,o,a;this.vertices=[],this.colors=[],this.faces=[],this.faceVertexUvs=[[]],this.morphTargets=[],this.morphNormals=[],this.skinWeights=[],this.skinIndices=[],this.lineDistances=[],this.boundingBox=null,this.boundingSphere=null,this.name=e.name;var s=e.vertices;for(t=0,n=s.length;t65535?we:xe)(e,1):this.index=e},addAttribute:function(e,t){return!1===(t&&t.isBufferAttribute)&&!1===(t&&t.isInterleavedBufferAttribute)?(console.warn("THREE.BufferGeometry: .addAttribute() now expects ( name, attribute )."),void this.addAttribute(e,new me(arguments[1],arguments[2]))):"index"===e?(console.warn("THREE.BufferGeometry.addAttribute: Use .setIndex() for index attribute."),void this.setIndex(t)):(this.attributes[e]=t,this)},getAttribute:function(e){return this.attributes[e]},removeAttribute:function(e){return delete this.attributes[e],this},addGroup:function(e,t,n){this.groups.push({start:e,count:t,materialIndex:void 0!==n?n:0})},clearGroups:function(){this.groups=[]},setDrawRange:function(e,t){this.drawRange.start=e,this.drawRange.count=t},applyMatrix:function(e){var t=this.attributes.position;void 0!==t&&(e.applyToBufferAttribute(t),t.needsUpdate=!0);var n=this.attributes.normal;if(void 0!==n){(new re).getNormalMatrix(e).applyToBufferAttribute(n),n.needsUpdate=!0}return null!==this.boundingBox&&this.computeBoundingBox(),null!==this.boundingSphere&&this.computeBoundingSphere(),this},rotateX:function(){var e;return function(t){return void 0===e&&(e=new d),e.makeRotationX(t),this.applyMatrix(e),this}}(),rotateY:function(){var e;return function(t){return void 0===e&&(e=new d),e.makeRotationY(t),this.applyMatrix(e),this}}(),rotateZ:function(){var e;return function(t){return void 0===e&&(e=new d),e.makeRotationZ(t),this.applyMatrix(e),this}}(),translate:function(){var e;return function(t,n,r){return void 0===e&&(e=new d),e.makeTranslation(t,n,r),this.applyMatrix(e),this}}(),scale:function(){var e;return function(t,n,r){return void 0===e&&(e=new d),e.makeScale(t,n,r),this.applyMatrix(e),this}}(),lookAt:function(){var e;return function(t){void 0===e&&(e=new ce),e.lookAt(t),e.updateMatrix(),this.applyMatrix(e.matrix)}}(),center:function(){this.computeBoundingBox();var e=this.boundingBox.getCenter().negate();return this.translate(e.x,e.y,e.z),e},setFromObject:function(e){var t=e.geometry;if(e.isPoints||e.isLine){var n=new Me(3*t.vertices.length,3),r=new Me(3*t.colors.length,3);if(this.addAttribute("position",n.copyVector3sArray(t.vertices)),this.addAttribute("color",r.copyColorsArray(t.colors)),t.lineDistances&&t.lineDistances.length===t.vertices.length){var i=new Me(t.lineDistances.length,1);this.addAttribute("lineDistance",i.copyArray(t.lineDistances))}null!==t.boundingSphere&&(this.boundingSphere=t.boundingSphere.clone()),null!==t.boundingBox&&(this.boundingBox=t.boundingBox.clone())}else e.isMesh&&t&&t.isGeometry&&this.fromGeometry(t);return this},updateFromObject:function(e){var t=e.geometry;if(e.isMesh){var n=t.__directGeometry;if(!0===t.elementsNeedUpdate&&(n=void 0,t.elementsNeedUpdate=!1),void 0===n)return this.fromGeometry(t);n.verticesNeedUpdate=t.verticesNeedUpdate,n.normalsNeedUpdate=t.normalsNeedUpdate,n.colorsNeedUpdate=t.colorsNeedUpdate,n.uvsNeedUpdate=t.uvsNeedUpdate,n.groupsNeedUpdate=t.groupsNeedUpdate,t.verticesNeedUpdate=!1,t.normalsNeedUpdate=!1,t.colorsNeedUpdate=!1,t.uvsNeedUpdate=!1,t.groupsNeedUpdate=!1,t=n}var r;return!0===t.verticesNeedUpdate&&(r=this.attributes.position,void 0!==r&&(r.copyVector3sArray(t.vertices),r.needsUpdate=!0),t.verticesNeedUpdate=!1),!0===t.normalsNeedUpdate&&(r=this.attributes.normal,void 0!==r&&(r.copyVector3sArray(t.normals),r.needsUpdate=!0),t.normalsNeedUpdate=!1),!0===t.colorsNeedUpdate&&(r=this.attributes.color,void 0!==r&&(r.copyColorsArray(t.colors),r.needsUpdate=!0),t.colorsNeedUpdate=!1),t.uvsNeedUpdate&&(r=this.attributes.uv,void 0!==r&&(r.copyVector2sArray(t.uvs),r.needsUpdate=!0),t.uvsNeedUpdate=!1),t.lineDistancesNeedUpdate&&(r=this.attributes.lineDistance,void 0!==r&&(r.copyArray(t.lineDistances),r.needsUpdate=!0),t.lineDistancesNeedUpdate=!1),t.groupsNeedUpdate&&(t.computeGroups(e.geometry),this.groups=t.groups,t.groupsNeedUpdate=!1),this},fromGeometry:function(e){return e.__directGeometry=(new Ee).fromGeometry(e),this.fromDirectGeometry(e.__directGeometry)},fromDirectGeometry:function(e){var t=new Float32Array(3*e.vertices.length);if(this.addAttribute("position",new me(t,3).copyVector3sArray(e.vertices)),e.normals.length>0){var n=new Float32Array(3*e.normals.length);this.addAttribute("normal",new me(n,3).copyVector3sArray(e.normals))}if(e.colors.length>0){var r=new Float32Array(3*e.colors.length);this.addAttribute("color",new me(r,3).copyColorsArray(e.colors))}if(e.uvs.length>0){var i=new Float32Array(2*e.uvs.length);this.addAttribute("uv",new me(i,2).copyVector2sArray(e.uvs))}if(e.uvs2.length>0){var o=new Float32Array(2*e.uvs2.length);this.addAttribute("uv2",new me(o,2).copyVector2sArray(e.uvs2))}if(e.indices.length>0){var a=Te(e.indices)>65535?Uint32Array:Uint16Array,s=new a(3*e.indices.length);this.setIndex(new me(s,1).copyIndicesArray(e.indices))}this.groups=e.groups;for(var l in e.morphTargets){for(var u=[],c=e.morphTargets[l],d=0,h=c.length;d0){var m=new Me(4*e.skinIndices.length,4);this.addAttribute("skinIndex",m.copyVector4sArray(e.skinIndices))}if(e.skinWeights.length>0){var g=new Me(4*e.skinWeights.length,4);this.addAttribute("skinWeight",g.copyVector4sArray(e.skinWeights))}return null!==e.boundingSphere&&(this.boundingSphere=e.boundingSphere.clone()),null!==e.boundingBox&&(this.boundingBox=e.boundingBox.clone()),this},computeBoundingBox:function(){null===this.boundingBox&&(this.boundingBox=new te);var e=this.attributes.position;void 0!==e?this.boundingBox.setFromBufferAttribute(e):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 e=new te,t=new c;return function(){null===this.boundingSphere&&(this.boundingSphere=new ne);var n=this.attributes.position;if(n){var r=this.boundingSphere.center;e.setFromBufferAttribute(n),e.getCenter(r);for(var i=0,o=0,a=n.count;o0&&(e.data.groups=JSON.parse(JSON.stringify(s)));var l=this.boundingSphere;return null!==l&&(e.data.boundingSphere={center:l.center.toArray(),radius:l.radius}),e},clone:function(){return(new Pe).copy(this)},copy:function(e){var t,n,r;this.index=null,this.attributes={},this.morphAttributes={},this.groups=[],this.boundingBox=null,this.boundingSphere=null,this.name=e.name;var i=e.index;null!==i&&this.setIndex(i.clone());var o=e.attributes;for(t in o){var a=o[t];this.addAttribute(t,a.clone())}var s=e.morphAttributes;for(t in s){var l=[],u=s[t];for(n=0,r=u.length;n0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(var t=0,n=e.length;tt.far?null:{distance:l,point:x.clone(),object:e}}function n(n,r,i,o,a,c,d,h){s.fromBufferAttribute(o,c),l.fromBufferAttribute(o,d),u.fromBufferAttribute(o,h);var f=t(n,r,i,s,l,u,b);return f&&(a&&(m.fromBufferAttribute(a,c),g.fromBufferAttribute(a,d),v.fromBufferAttribute(a,h),f.uv=e(b,s,l,u,m,g,v)),f.face=new fe(c,d,h,he.normal(s,l,u)),f.faceIndex=c),f}var r=new d,o=new se,a=new ne,s=new c,l=new c,u=new c,h=new c,f=new c,p=new c,m=new i,g=new i,v=new i,y=new c,b=new c,x=new c;return function(i,c){var d=this.geometry,y=this.material,x=this.matrixWorld;if(void 0!==y&&(null===d.boundingSphere&&d.computeBoundingSphere(),a.copy(d.boundingSphere),a.applyMatrix4(x),!1!==i.ray.intersectsSphere(a)&&(r.getInverse(x),o.copy(i.ray).applyMatrix4(r),null===d.boundingBox||!1!==o.intersectsBox(d.boundingBox)))){var _;if(d.isBufferGeometry){var w,M,S,E,T,k=d.index,C=d.attributes.position,P=d.attributes.uv;if(null!==k)for(E=0,T=k.count;E0&&(L=F);for(var B=0,U=N.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)}}),vt.prototype=Object.assign(Object.create(ce.prototype),{constructor:vt,copy:function(e){ce.prototype.copy.call(this,e,!1);for(var t=e.levels,n=0,r=t.length;n1){e.setFromMatrixPosition(n.matrixWorld),t.setFromMatrixPosition(this.matrixWorld);var i=e.distanceTo(t);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 S=r.ray.origin.distanceTo(f);Sr.far||i.push({distance:S,point:h.clone().applyMatrix4(this.matrixWorld),index:b,face:null,faceIndex:null,object:this})}}else for(var b=0,x=v.length/3-1;ba)){f.applyMatrix4(this.matrixWorld);var S=r.ray.origin.distanceTo(f);Sr.far||i.push({distance:S,point:h.clone().applyMatrix4(this.matrixWorld),index:b,face:null,faceIndex:null,object:this})}}}else if(s.isGeometry)for(var E=s.vertices,T=E.length,b=0;ba)){f.applyMatrix4(this.matrixWorld);var S=r.ray.origin.distanceTo(f);Sr.far||i.push({distance:S,point:h.clone().applyMatrix4(this.matrixWorld),index:b,face:null,faceIndex:null,object:this})}}}}}(),clone:function(){return new this.constructor(this.geometry,this.material).copy(this)}}),Mt.prototype=Object.assign(Object.create(wt.prototype),{constructor:Mt,isLineSegments:!0}),St.prototype=Object.create($.prototype),St.prototype.constructor=St,St.prototype.isPointsMaterial=!0,St.prototype.copy=function(e){return $.prototype.copy.call(this,e),this.color.copy(e.color),this.map=e.map,this.size=e.size,this.sizeAttenuation=e.sizeAttenuation,this},Et.prototype=Object.assign(Object.create(ce.prototype),{constructor:Et,isPoints:!0,raycast:function(){var e=new d,t=new se,n=new ne;return function(r,i){function o(e,n){var o=t.distanceSqToPoint(e);if(or.far)return;i.push({distance:u,distanceToRay:Math.sqrt(o),point:s.clone(),index:n,face:null,object:a})}}var a=this,s=this.geometry,l=this.matrixWorld,u=r.params.Points.threshold;if(null===s.boundingSphere&&s.computeBoundingSphere(),n.copy(s.boundingSphere),n.applyMatrix4(l),!1!==r.ray.intersectsSphere(n)){e.getInverse(l),t.copy(r.ray).applyMatrix4(e);var d=u/((this.scale.x+this.scale.y+this.scale.z)/3),h=d*d,f=new c;if(s.isBufferGeometry){var p=s.index,m=s.attributes,g=m.position.array;if(null!==p)for(var v=p.array,y=0,b=v.length;y=-Number.EPSILON&&C>=-Number.EPSILON&&k>=-Number.EPSILON))return!1;return!0}return function(t,n){var r=t.length;if(r<3)return null;var i,o,a,s=[],l=[],u=[];if(Ps.area(t)>0)for(o=0;o2;){if(d--<=0)return console.warn("THREE.ShapeUtils: Unable to triangulate polygon! in triangulate()"),n?u:s;if(i=o,c<=i&&(i=0),o=i+1,c<=o&&(o=0),a=o+1,c<=a&&(a=0),e(t,i,o,a,c,l)){var h,f,p,m,g;for(h=l[i],f=l[o],p=l[a],s.push([t[h],t[f],t[p]]),u.push([l[i],l[o],l[a]]),m=o,g=o+1;g2&&e[t-1].equals(e[0])&&e.pop()}function r(e,t,n){return e.x!==t.x?e.xNumber.EPSILON){var p;if(h>0){if(f<0||f>h)return[];if((p=u*c-l*d)<0||p>h)return[]}else{if(f>0||f0||pE?[]:x===E?o?[]:[y]:_<=E?[y,b]:[y,M]}function o(e,t,n,r){var i=t.x-e.x,o=t.y-e.y,a=n.x-e.x,s=n.y-e.y,l=r.x-e.x,u=r.y-e.y,c=i*s-o*a,d=i*u-o*l;if(Math.abs(c)>Number.EPSILON){var h=l*s-u*a;return c>0?d>=0&&h>=0:d>=0||h>=0}return d>0}n(e),t.forEach(n);for(var a,s,l,u,c,d,h={},f=e.concat(),p=0,m=t.length;p0;){if(--_<0){console.log("Infinite Loop! Holes left:"+g.length+", Probably Hole outside Shape!");break}for(a=x;ar&&(a=0);var s=o(m[e],m[i],m[a],n[t]);if(!s)return!1;var l=n.length-1,u=t-1;u<0&&(u=l);var c=t+1;return c>l&&(c=0),!!(s=o(n[t],n[u],n[c],m[e]))}(a,w)&&!function(e,t){var n,r,o;for(n=0;n0)return!0;return!1}(s,l)&&!function(e,n){var r,o,a,s,l;for(r=0;r0)return!0;return!1}(s,l)){r=w,g.splice(y,1),d=m.slice(0,a+1),h=m.slice(a),f=n.slice(r),p=n.slice(0,r+1),m=d.concat(f).concat(p).concat(h),x=a;break}if(r>=0)break;v[c]=!0}if(r>=0)break}}return m}(e,t),v=Ps.triangulate(g,!1);for(a=0,s=v.length;aNumber.EPSILON){var f=Math.sqrt(d),p=Math.sqrt(u*u+c*c),m=t.x-l/f,g=t.y+s/f,v=n.x-c/p,y=n.y+u/p,b=((v-m)*c-(y-g)*u)/(s*c-l*u);r=m+s*b-e.x,o=g+l*b-e.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?u>Number.EPSILON&&(_=!0):s<-Number.EPSILON?u<-Number.EPSILON&&(_=!0):Math.sign(l)===Math.sign(c)&&(_=!0),_?(r=-l,o=s,a=Math.sqrt(d)):(r=s,o=l,a=Math.sqrt(d/2))}return new i(r/a,o/a)}function o(e,t){var n,r;for(G=e.length;--G>=0;){n=G,r=G-1,r<0&&(r=e.length-1);var i=0,o=_+2*y;for(i=0;i=0;z--){for(F=z/y,B=g*Math.cos(F*Math.PI/2),N=v*Math.sin(F*Math.PI/2),G=0,Y=I.length;G0||0===e.search(/^data\:image\/jpeg/);i.format=r?Pa:Oa,i.image=n,i.needsUpdate=!0,void 0!==t&&t(i)},n,r),i},setCrossOrigin:function(e){return this.crossOrigin=e,this},setPath:function(e){return this.path=e,this}}),An.prototype=Object.assign(Object.create(ce.prototype),{constructor:An,isLight:!0,copy:function(e){return ce.prototype.copy.call(this,e),this.color.copy(e.color),this.intensity=e.intensity,this},toJSON:function(e){var t=ce.prototype.toJSON.call(this,e);return t.object.color=this.color.getHex(),t.object.intensity=this.intensity,void 0!==this.groundColor&&(t.object.groundColor=this.groundColor.getHex()),void 0!==this.distance&&(t.object.distance=this.distance),void 0!==this.angle&&(t.object.angle=this.angle),void 0!==this.decay&&(t.object.decay=this.decay),void 0!==this.penumbra&&(t.object.penumbra=this.penumbra),void 0!==this.shadow&&(t.object.shadow=this.shadow.toJSON()),t}}),Rn.prototype=Object.assign(Object.create(An.prototype),{constructor:Rn,isHemisphereLight:!0,copy:function(e){return An.prototype.copy.call(this,e),this.groundColor.copy(e.groundColor),this}}),Object.assign(Ln.prototype,{copy:function(e){return this.camera=e.camera.clone(),this.bias=e.bias,this.radius=e.radius,this.mapSize.copy(e.mapSize),this},clone:function(){return(new this.constructor).copy(this)},toJSON:function(){var e={};return 0!==this.bias&&(e.bias=this.bias),1!==this.radius&&(e.radius=this.radius),512===this.mapSize.x&&512===this.mapSize.y||(e.mapSize=this.mapSize.toArray()),e.camera=this.camera.toJSON(!1).object,delete e.camera.matrix,e}}),Dn.prototype=Object.assign(Object.create(Ln.prototype),{constructor:Dn,isSpotLightShadow:!0,update:function(e){var t=2*fs.RAD2DEG*e.angle,n=this.mapSize.width/this.mapSize.height,r=e.distance||500,i=this.camera;t===i.fov&&n===i.aspect&&r===i.far||(i.fov=t,i.aspect=n,i.far=r,i.updateProjectionMatrix())}}),In.prototype=Object.assign(Object.create(An.prototype),{constructor:In,isSpotLight:!0,copy:function(e){return An.prototype.copy.call(this,e),this.distance=e.distance,this.angle=e.angle,this.penumbra=e.penumbra,this.decay=e.decay,this.target=e.target.clone(),this.shadow=e.shadow.clone(),this}}),zn.prototype=Object.assign(Object.create(An.prototype),{constructor:zn,isPointLight:!0,copy:function(e){return An.prototype.copy.call(this,e),this.distance=e.distance,this.decay=e.decay,this.shadow=e.shadow.clone(),this}}),Nn.prototype=Object.assign(Object.create(Ln.prototype),{constructor:Nn}),Fn.prototype=Object.assign(Object.create(An.prototype),{constructor:Fn,isDirectionalLight:!0,copy:function(e){return An.prototype.copy.call(this,e),this.target=e.target.clone(),this.shadow=e.shadow.clone(),this}}),Bn.prototype=Object.assign(Object.create(An.prototype),{constructor:Bn,isAmbientLight:!0});var Ds={arraySlice:function(e,t,n){return Ds.isTypedArray(e)?new e.constructor(e.subarray(t,n)):e.slice(t,n)},convertArray:function(e,t,n){return!e||!n&&e.constructor===t?e:"number"==typeof t.BYTES_PER_ELEMENT?new t(e):Array.prototype.slice.call(e)},isTypedArray:function(e){return ArrayBuffer.isView(e)&&!(e instanceof DataView)},getKeyframeOrder:function(e){function t(t,n){return e[t]-e[n]}for(var n=e.length,r=new Array(n),i=0;i!==n;++i)r[i]=i;return r.sort(t),r},sortedArray:function(e,t,n){for(var r=e.length,i=new e.constructor(r),o=0,a=0;a!==r;++o)for(var s=n[o]*t,l=0;l!==t;++l)i[a++]=e[s+l];return i},flattenJSON:function(e,t,n,r){for(var i=1,o=e[0];void 0!==o&&void 0===o[r];)o=e[i++];if(void 0!==o){var a=o[r];if(void 0!==a)if(Array.isArray(a))do{a=o[r],void 0!==a&&(t.push(o.time),n.push.apply(n,a)),o=e[i++]}while(void 0!==o);else if(void 0!==a.toArray)do{a=o[r],void 0!==a&&(t.push(o.time),a.toArray(n,n.length)),o=e[i++]}while(void 0!==o);else do{a=o[r],void 0!==a&&(t.push(o.time),n.push(a)),o=e[i++]}while(void 0!==o)}}};Un.prototype={constructor:Un,evaluate:function(e){var t=this.parameterPositions,n=this._cachedIndex,r=t[n],i=t[n-1];e:{t:{var o;n:{r:if(!(e=i)break e;var s=t[1];e=i)break t}o=n,n=0}}for(;n>>1;et;)--o;if(++o,0!==i||o!==r){i>=o&&(o=Math.max(o,1),i=o-1);var a=this.getValueSize();this.times=Ds.arraySlice(n,i,o),this.values=Ds.arraySlice(this.values,i*a,o*a)}return this},validate:function(){var e=!0,t=this.getValueSize();t-Math.floor(t)!=0&&(console.error("invalid value size in track",this),e=!1);var n=this.times,r=this.values,i=n.length;0===i&&(console.error("track is empty",this),e=!1);for(var o=null,a=0;a!==i;a++){var s=n[a];if("number"==typeof s&&isNaN(s)){console.error("time is not a valid number",this,a,s),e=!1;break}if(null!==o&&o>s){console.error("out of order keys",this,a,s,o),e=!1;break}o=s}if(void 0!==r&&Ds.isTypedArray(r))for(var a=0,l=r.length;a!==l;++a){var u=r[a];if(isNaN(u)){console.error("value is not a valid number",this,a,u),e=!1;break}}return e},optimize:function(){for(var e=this.times,t=this.values,n=this.getValueSize(),r=this.getInterpolation()===Ka,i=1,o=e.length-1,a=1;a0){e[i]=e[o];for(var p=o*n,m=i*n,h=0;h!==n;++h)t[m+h]=t[p+h];++i}return i!==e.length&&(this.times=Ds.arraySlice(e,0,i),this.values=Ds.arraySlice(t,0,i*n)),this}},Gn.prototype=Object.assign(Object.create(Is),{constructor:Gn,ValueTypeName:"vector"}),Yn.prototype=Object.assign(Object.create(Un.prototype),{constructor:Yn,interpolate_:function(e,t,n,r){for(var i=this.resultBuffer,o=this.sampleValues,a=this.valueSize,s=e*a,l=(n-t)/(r-t),c=s+a;s!==c;s+=4)u.slerpFlat(i,0,o,s-a,o,s,l);return i}}),Xn.prototype=Object.assign(Object.create(Is),{constructor:Xn,ValueTypeName:"quaternion",DefaultInterpolation:Za,InterpolantFactoryMethodLinear:function(e){return new Yn(this.times,this.values,this.getValueSize(),e)},InterpolantFactoryMethodSmooth:void 0}),qn.prototype=Object.assign(Object.create(Is),{constructor:qn,ValueTypeName:"number"}),Zn.prototype=Object.assign(Object.create(Is),{constructor:Zn,ValueTypeName:"string",ValueBufferType:Array,DefaultInterpolation:qa,InterpolantFactoryMethodLinear:void 0,InterpolantFactoryMethodSmooth:void 0}),Kn.prototype=Object.assign(Object.create(Is),{constructor:Kn,ValueTypeName:"bool",ValueBufferType:Array,DefaultInterpolation:qa,InterpolantFactoryMethodLinear:void 0,InterpolantFactoryMethodSmooth:void 0}),Jn.prototype=Object.assign(Object.create(Is),{constructor:Jn,ValueTypeName:"color"}),$n.prototype=Is,Is.constructor=$n,Object.assign($n,{parse:function(e){if(void 0===e.type)throw new Error("track type undefined, can not parse");var t=$n._getTrackTypeForValueTypeName(e.type);if(void 0===e.times){var n=[],r=[];Ds.flattenJSON(e.keys,n,r,"value"),e.times=n,e.values=r}return void 0!==t.parse?t.parse(e):new t(e.name,e.times,e.values,e.interpolation)},toJSON:function(e){var t,n=e.constructor;if(void 0!==n.toJSON)t=n.toJSON(e);else{t={name:e.name,times:Ds.convertArray(e.times,Array),values:Ds.convertArray(e.values,Array)};var r=e.getInterpolation();r!==e.DefaultInterpolation&&(t.interpolation=r)}return t.type=e.ValueTypeName,t},_getTrackTypeForValueTypeName:function(e){switch(e.toLowerCase()){case"scalar":case"double":case"float":case"number":case"integer":return qn;case"vector":case"vector2":case"vector3":case"vector4":return Gn;case"color":return Jn;case"quaternion":return Xn;case"bool":case"boolean":return Kn;case"string":return Zn}throw new Error("Unsupported typeName: "+e)}}),Qn.prototype={constructor:Qn,resetDuration:function(){for(var e=this.tracks,t=0,n=0,r=e.length;n!==r;++n){var i=this.tracks[n];t=Math.max(t,i.times[i.times.length-1])}this.duration=t},trim:function(){for(var e=0;e1){var u=l[1],c=r[u];c||(r[u]=c=[]),c.push(s)}}var d=[];for(var u in r)d.push(Qn.CreateFromMorphTargetSequence(u,r[u],t,n));return d},parseAnimation:function(e,t){if(!e)return console.error(" no animation in JSONLoader data"),null;for(var n=function(e,t,n,r,i){if(0!==n.length){var o=[],a=[];Ds.flattenJSON(n,o,a,r),0!==o.length&&i.push(new e(t,o,a))}},r=[],i=e.name||"default",o=e.length||-1,a=e.fps||30,s=e.hierarchy||[],l=0;l1?e.skinWeights[r+1]:0,l=t>2?e.skinWeights[r+2]:0,u=t>3?e.skinWeights[r+3]:0;n.skinWeights.push(new a(o,s,l,u))}if(e.skinIndices)for(var r=0,i=e.skinIndices.length;r1?e.skinIndices[r+1]:0,h=t>2?e.skinIndices[r+2]:0,f=t>3?e.skinIndices[r+3]:0;n.skinIndices.push(new a(c,d,h,f))}n.bones=e.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(t){if(void 0!==e.morphTargets)for(var r=0,i=e.morphTargets.length;r0){console.warn('THREE.JSONLoader: "morphColors" no longer supported. Using them as face colors.');for(var d=n.faces,h=e.morphColors[0].colors,r=0,i=d.length;r0&&(n.animations=t)}(),n.computeFaceNormals(),n.computeBoundingSphere(),void 0===e.materials||0===e.materials.length)return{geometry:n};var o=nr.prototype.initMaterials(e.materials,t,this.crossOrigin);return{geometry:n,materials:o}}}),Object.assign(ir.prototype,{load:function(e,t,n,r){""===this.texturePath&&(this.texturePath=e.substring(0,e.lastIndexOf("/")+1));var i=this;new En(i.manager).load(e,function(n){var o=null;try{o=JSON.parse(n)}catch(t){return void 0!==r&&r(t),void console.error("THREE:ObjectLoader: Can't parse "+e+".",t.message)}var a=o.metadata;if(void 0===a||void 0===a.type||"geometry"===a.type.toLowerCase())return void console.error("THREE.ObjectLoader: Can't load "+e+". Use THREE.JSONLoader instead.");i.parse(o,t)},n,r)},setTexturePath:function(e){this.texturePath=e},setCrossOrigin:function(e){this.crossOrigin=e},parse:function(e,t){var n=this.parseGeometries(e.geometries),r=this.parseImages(e.images,function(){void 0!==t&&t(a)}),i=this.parseTextures(e.textures,r),o=this.parseMaterials(e.materials,i),a=this.parseObject(e.object,n,o);return e.animations&&(a.animations=this.parseAnimations(e.animations)),void 0!==e.images&&0!==e.images.length||void 0!==t&&t(a),a},parseGeometries:function(e){var t={};if(void 0!==e)for(var n=new rr,r=new tr,i=0,o=e.length;i0){var i=new Sn(t),o=new Cn(i);o.setCrossOrigin(this.crossOrigin);for(var a=0,s=e.length;a0?new xt(s,l):new Oe(s,l);break;case"LOD":a=new vt;break;case"Line":a=new wt(i(t.geometry),o(t.material),t.mode);break;case"LineSegments":a=new Mt(i(t.geometry),o(t.material));break;case"PointCloud":case"Points":a=new Et(i(t.geometry),o(t.material));break;case"Sprite":a=new gt(o(t.material));break;case"Group":a=new Tt;break;case"SkinnedMesh":console.warn("THREE.ObjectLoader.parseObject() does not support SkinnedMesh type. Instantiates Object3D instead.");default:a=new ce}if(a.uuid=t.uuid,void 0!==t.name&&(a.name=t.name),void 0!==t.matrix?(e.fromArray(t.matrix),e.decompose(a.position,a.quaternion,a.scale)):(void 0!==t.position&&a.position.fromArray(t.position),void 0!==t.rotation&&a.rotation.fromArray(t.rotation),void 0!==t.quaternion&&a.quaternion.fromArray(t.quaternion),void 0!==t.scale&&a.scale.fromArray(t.scale)),void 0!==t.castShadow&&(a.castShadow=t.castShadow),void 0!==t.receiveShadow&&(a.receiveShadow=t.receiveShadow),t.shadow&&(void 0!==t.shadow.bias&&(a.shadow.bias=t.shadow.bias),void 0!==t.shadow.radius&&(a.shadow.radius=t.shadow.radius),void 0!==t.shadow.mapSize&&a.shadow.mapSize.fromArray(t.shadow.mapSize),void 0!==t.shadow.camera&&(a.shadow.camera=this.parseObject(t.shadow.camera))),void 0!==t.visible&&(a.visible=t.visible),void 0!==t.userData&&(a.userData=t.userData),void 0!==t.children)for(var u in t.children)a.add(this.parseObject(t.children[u],n,r));if("LOD"===t.type)for(var c=t.levels,d=0;d0)){l=i;break}l=i-1}if(i=l,r[i]===n){var u=i/(o-1);return u}var c=r[i],d=r[i+1],h=d-c,f=(n-c)/h,u=(i+f)/(o-1);return u},getTangent:function(e){var t=e-1e-4,n=e+1e-4;t<0&&(t=0),n>1&&(n=1);var r=this.getPoint(t);return this.getPoint(n).clone().sub(r).normalize()},getTangentAt:function(e){var t=this.getUtoTmapping(e);return this.getTangent(t)},computeFrenetFrames:function(e,t){var n,r,i,o=new c,a=[],s=[],l=[],u=new c,h=new d;for(n=0;n<=e;n++)r=n/e,a[n]=this.getTangentAt(r),a[n].normalize();s[0]=new c,l[0]=new c;var f=Number.MAX_VALUE,p=Math.abs(a[0].x),m=Math.abs(a[0].y),g=Math.abs(a[0].z);for(p<=f&&(f=p,o.set(1,0,0)),m<=f&&(f=m,o.set(0,1,0)),g<=f&&o.set(0,0,1),u.crossVectors(a[0],o).normalize(),s[0].crossVectors(a[0],u),l[0].crossVectors(a[0],s[0]),n=1;n<=e;n++)s[n]=s[n-1].clone(),l[n]=l[n-1].clone(),u.crossVectors(a[n-1],a[n]),u.length()>Number.EPSILON&&(u.normalize(),i=Math.acos(fs.clamp(a[n-1].dot(a[n]),-1,1)),s[n].applyMatrix4(h.makeRotationAxis(u,i))),l[n].crossVectors(a[n],s[n]);if(!0===t)for(i=Math.acos(fs.clamp(s[0].dot(s[e]),-1,1)),i/=e,a[0].dot(u.crossVectors(s[0],s[e]))>0&&(i=-i),n=1;n<=e;n++)s[n].applyMatrix4(h.makeRotationAxis(a[n],i*n)),l[n].crossVectors(a[n],s[n]);return{tangents:a,normals:s,binormals:l}}},gr.prototype=Object.create(mr.prototype),gr.prototype.constructor=gr,gr.prototype.isLineCurve=!0,gr.prototype.getPoint=function(e){if(1===e)return this.v2.clone();var t=this.v2.clone().sub(this.v1);return t.multiplyScalar(e).add(this.v1),t},gr.prototype.getPointAt=function(e){return this.getPoint(e)},gr.prototype.getTangent=function(e){return this.v2.clone().sub(this.v1).normalize()},vr.prototype=Object.assign(Object.create(mr.prototype),{constructor:vr,add:function(e){this.curves.push(e)},closePath:function(){var e=this.curves[0].getPoint(0),t=this.curves[this.curves.length-1].getPoint(1);e.equals(t)||this.curves.push(new gr(t,e))},getPoint:function(e){for(var t=e*this.getLength(),n=this.getCurveLengths(),r=0;r=t){var i=n[r]-t,o=this.curves[r],a=o.getLength(),s=0===a?0:1-i/a;return o.getPointAt(s)}r++}return null},getLength:function(){var e=this.getCurveLengths();return e[e.length-1]},updateArcLengths:function(){this.needsUpdate=!0,this.cacheLengths=null,this.getLengths()},getCurveLengths:function(){if(this.cacheLengths&&this.cacheLengths.length===this.curves.length)return this.cacheLengths;for(var e=[],t=0,n=0,r=this.curves.length;n1&&!n[n.length-1].equals(n[0])&&n.push(n[0]),n},createPointsGeometry:function(e){var t=this.getPoints(e);return this.createGeometry(t)},createSpacedPointsGeometry:function(e){var t=this.getSpacedPoints(e);return this.createGeometry(t)},createGeometry:function(e){for(var t=new Ce,n=0,r=e.length;nt;)n-=t;nt.length-2?t.length-1:r+1],u=t[r>t.length-3?t.length-1:r+2];return new i(or(o,a.x,s.x,l.x,u.x),or(o,a.y,s.y,l.y,u.y))},xr.prototype=Object.create(mr.prototype),xr.prototype.constructor=xr,xr.prototype.getPoint=function(e){var t=this.v0,n=this.v1,r=this.v2,o=this.v3;return new i(pr(e,t.x,n.x,r.x,o.x),pr(e,t.y,n.y,r.y,o.y))},_r.prototype=Object.create(mr.prototype),_r.prototype.constructor=_r,_r.prototype.getPoint=function(e){var t=this.v0,n=this.v1,r=this.v2;return new i(ur(e,t.x,n.x,r.x),ur(e,t.y,n.y,r.y))};var zs=Object.assign(Object.create(vr.prototype),{fromPoints:function(e){this.moveTo(e[0].x,e[0].y);for(var t=1,n=e.length;t0){var u=l.getPoint(0);u.equals(this.currentPoint)||this.lineTo(u.x,u.y)}this.curves.push(l);var c=l.getPoint(1);this.currentPoint.copy(c)}});wr.prototype=zs,zs.constructor=wr,Mr.prototype=Object.assign(Object.create(zs),{constructor:Mr,getPointsHoles:function(e){for(var t=[],n=0,r=this.holes.length;n1){for(var v=!1,y=[],b=0,x=h.length;bNumber.EPSILON){if(u<0&&(a=t[o],l=-l,s=t[i],u=-u),e.ys.y)continue;if(e.y===a.y){if(e.x===a.x)return!0}else{var c=u*(e.x-a.x)-l*(e.y-a.y);if(0===c)return!0;if(c<0)continue;r=!r}}else{if(e.y!==a.y)continue;if(s.x<=e.x&&e.x<=a.x||a.x<=e.x&&e.x<=s.x)return!0}}return r})(M.p,h[E].p)&&(b!==E&&y.push({froms:b,tos:E,hole:w}),S?(S=!1,d[E].push(M)):v=!0);S&&d[b].push(M)}y.length>0&&(v||(f=d))}for(var T,m=0,k=h.length;m0){this.source.connect(this.filters[0]);for(var e=1,t=this.filters.length;e0){this.source.disconnect(this.filters[0]);for(var e=1,t=this.filters.length;e=.5)for(var o=0;o!==i;++o)e[t+o]=e[n+o]},_slerp:function(e,t,n,r,i){u.slerpFlat(e,t,e,t,e,n,r)},_lerp:function(e,t,n,r,i){for(var o=1-r,a=0;a!==i;++a){var s=t+a;e[s]=e[s]*o+e[n+a]*r}}},zr.prototype={constructor:zr,getValue:function(e,t){this.bind(),this.getValue(e,t)},setValue:function(e,t){this.bind(),this.setValue(e,t)},bind:function(){var e=this.node,t=this.parsedPath,n=t.objectName,r=t.propertyName,i=t.propertyIndex;if(e||(e=zr.findNode(this.rootNode,t.nodeName)||this.rootNode,this.node=e),this.getValue=this._getValue_unavailable,this.setValue=this._setValue_unavailable,!e)return void console.error(" trying to update node for track: "+this.path+" but it wasn't found.");if(n){var o=t.objectIndex;switch(n){case"materials":if(!e.material)return void console.error(" can not bind to material as node does not have a material",this);if(!e.material.materials)return void console.error(" can not bind to material.materials as node.material does not have a materials array",this);e=e.material.materials;break;case"bones":if(!e.skeleton)return void console.error(" can not bind to bones as node does not have a skeleton",this);e=e.skeleton.bones;for(var a=0;a=n){var d=n++,h=t[d];r[h.uuid]=c,t[c]=h,r[u]=d,t[d]=l;for(var f=0,p=o;f!==p;++f){var m=i[f],g=m[d],v=m[c];m[c]=g,m[d]=v}}}this.nCachedObjects_=n},uncache:function(e){for(var t=this._objects,n=t.length,r=this.nCachedObjects_,i=this._indicesByUUID,o=this._bindings,a=o.length,s=0,l=arguments.length;s!==l;++s){var u=arguments[s],c=u.uuid,d=i[c];if(void 0!==d)if(delete i[c],d0)for(var l=this._interpolants,u=this._propertyBindings,c=0,d=l.length;c!==d;++c)l[c].evaluate(a),u[c].accumulate(r,s)},_updateWeight:function(e){var t=0;if(this.enabled){t=this.weight;var n=this._weightInterpolant;if(null!==n){var r=n.evaluate(e)[0];t*=r,e>n.parameterPositions[1]&&(this.stopFading(),0===r&&(this.enabled=!1))}}return this._effectiveWeight=t,t},_updateTimeScale:function(e){var t=0;if(!this.paused){t=this.timeScale;var n=this._timeScaleInterpolant;if(null!==n){t*=n.evaluate(e)[0],e>n.parameterPositions[1]&&(this.stopWarping(),0===t?this.paused=!0:this.timeScale=t)}}return this._effectiveTimeScale=t,t},_updateTime:function(e){var t=this.time+e;if(0===e)return t;var n=this._clip.duration,r=this.loop,i=this._loopCount;if(r===Ga){-1===i&&(this._loopCount=0,this._setEndings(!0,!0,!1));e:{if(t>=n)t=n;else{if(!(t<0))break e;t=0}this.clampWhenFinished?this.paused=!0:this.enabled=!1,this._mixer.dispatchEvent({type:"finished",action:this,direction:e<0?-1:1})}}else{var o=r===Xa;if(-1===i&&(e>=0?(i=0,this._setEndings(!0,0===this.repetitions,o)):this._setEndings(0===this.repetitions,!0,o)),t>=n||t<0){var a=Math.floor(t/n);t-=n*a,i+=Math.abs(a);var s=this.repetitions-i;if(s<0)this.clampWhenFinished?this.paused=!0:this.enabled=!1,t=e>0?n:0,this._mixer.dispatchEvent({type:"finished",action:this,direction:e>0?1:-1});else{if(0===s){var l=e<0;this._setEndings(l,!l,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=t,n-t}return this.time=t,t},_setEndings:function(e,t,n){var r=this._interpolantSettings;n?(r.endingStart=$a,r.endingEnd=$a):(r.endingStart=e?this.zeroSlopeAtStart?$a:Ja:Qa,r.endingEnd=t?this.zeroSlopeAtEnd?$a:Ja:Qa)},_scheduleFading:function(e,t,n){var r=this._mixer,i=r.time,o=this._weightInterpolant;null===o&&(o=r._lendControlInterpolant(),this._weightInterpolant=o);var a=o.parameterPositions,s=o.sampleValues;return a[0]=i,s[0]=t,a[1]=i+e,s[1]=n,this}},Br.prototype={constructor:Br,clipAction:function(e,t){var n=t||this._root,r=n.uuid,i="string"==typeof e?Qn.findByName(n,e):e,o=null!==i?i.uuid:e,a=this._actionsByClip[o],s=null;if(void 0!==a){var l=a.actionByRoot[r];if(void 0!==l)return l;s=a.knownActions[0],null===i&&(i=s._clip)}if(null===i)return null;var u=new Fr(this,i,t);return this._bindAction(u,s),this._addInactiveAction(u,o,r),u},existingAction:function(e,t){var n=t||this._root,r=n.uuid,i="string"==typeof e?Qn.findByName(n,e):e,o=i?i.uuid:e,a=this._actionsByClip[o];return void 0!==a?a.actionByRoot[r]||null:null},stopAllAction:function(){var e=this._actions,t=this._nActiveActions,n=this._bindings,r=this._nActiveBindings;this._nActiveActions=0,this._nActiveBindings=0;for(var i=0;i!==t;++i)e[i].reset();for(var i=0;i!==r;++i)n[i].useCount=0;return this},update:function(e){e*=this.timeScale;for(var t=this._actions,n=this._nActiveActions,r=this.time+=e,i=Math.sign(e),o=this._accuIndex^=1,a=0;a!==n;++a){var s=t[a];s.enabled&&s._update(r,e,i,o)}for(var l=this._bindings,u=this._nActiveBindings,a=0;a!==u;++a)l[a].apply(o);return this},getRoot:function(){return this._root},uncacheClip:function(e){var t=this._actions,n=e.uuid,r=this._actionsByClip,i=r[n];if(void 0!==i){for(var o=i.knownActions,a=0,s=o.length;a!==s;++a){var l=o[a];this._deactivateAction(l);var u=l._cacheIndex,c=t[t.length-1];l._cacheIndex=null,l._byClipCacheIndex=null,c._cacheIndex=u,t[u]=c,t.pop(),this._removeInactiveBindingsForAction(l)}delete r[n]}},uncacheRoot:function(e){var t=e.uuid,n=this._actionsByClip;for(var r in n){var i=n[r].actionByRoot,o=i[t];void 0!==o&&(this._deactivateAction(o),this._removeInactiveAction(o))}var a=this._bindingsByRootAndName,s=a[t];if(void 0!==s)for(var l in s){var u=s[l];u.restoreOriginalState(),this._removeInactiveBinding(u)}},uncacheAction:function(e,t){var n=this.existingAction(e,t);null!==n&&(this._deactivateAction(n),this._removeInactiveAction(n))}},Object.assign(Br.prototype,{_bindAction:function(e,t){var n=e._localRoot||this._root,r=e._clip.tracks,i=r.length,o=e._propertyBindings,a=e._interpolants,s=n.uuid,l=this._bindingsByRootAndName,u=l[s];void 0===u&&(u={},l[s]=u);for(var c=0;c!==i;++c){var d=r[c],h=d.name,f=u[h];if(void 0!==f)o[c]=f;else{if(void 0!==(f=o[c])){null===f._cacheIndex&&(++f.referenceCount,this._addInactiveBinding(f,s,h));continue}var p=t&&t._propertyBindings[c].binding.parsedPath;f=new Ir(zr.create(n,h,p),d.ValueTypeName,d.getValueSize()),++f.referenceCount,this._addInactiveBinding(f,s,h),o[c]=f}a[c].resultBuffer=f.buffer}},_activateAction:function(e){if(!this._isActiveAction(e)){if(null===e._cacheIndex){var t=(e._localRoot||this._root).uuid,n=e._clip.uuid,r=this._actionsByClip[n];this._bindAction(e,r&&r.knownActions[0]),this._addInactiveAction(e,n,t)}for(var i=e._propertyBindings,o=0,a=i.length;o!==a;++o){var s=i[o];0==s.useCount++&&(this._lendBinding(s),s.saveOriginalState())}this._lendAction(e)}},_deactivateAction:function(e){if(this._isActiveAction(e)){for(var t=e._propertyBindings,n=0,r=t.length;n!==r;++n){var i=t[n];0==--i.useCount&&(i.restoreOriginalState(),this._takeBackBinding(i))}this._takeBackAction(e)}},_initMemoryManager:function(){this._actions=[],this._nActiveActions=0,this._actionsByClip={},this._bindings=[],this._nActiveBindings=0,this._bindingsByRootAndName={},this._controlInterpolants=[],this._nActiveControlInterpolants=0;var e=this;this.stats={actions:{get total(){return e._actions.length},get inUse(){return e._nActiveActions}},bindings:{get total(){return e._bindings.length},get inUse(){return e._nActiveBindings}},controlInterpolants:{get total(){return e._controlInterpolants.length},get inUse(){return e._nActiveControlInterpolants}}}},_isActiveAction:function(e){var t=e._cacheIndex;return null!==t&&t1){var u=l[1];r[u]||(r[u]={start:1/0,end:-1/0});var c=r[u];oc.end&&(c.end=o),t||(t=u)}}for(var u in r){var c=r[u];this.createAnimation(u,c.start,c.end,e)}this.firstAnimation=t},$r.prototype.setAnimationDirectionForward=function(e){var t=this.animationsMap[e];t&&(t.direction=1,t.directionBackwards=!1)},$r.prototype.setAnimationDirectionBackward=function(e){var t=this.animationsMap[e];t&&(t.direction=-1,t.directionBackwards=!0)},$r.prototype.setAnimationFPS=function(e,t){var n=this.animationsMap[e];n&&(n.fps=t,n.duration=(n.end-n.start)/n.fps)},$r.prototype.setAnimationDuration=function(e,t){var n=this.animationsMap[e];n&&(n.duration=t,n.fps=(n.end-n.start)/n.duration)},$r.prototype.setAnimationWeight=function(e,t){var n=this.animationsMap[e];n&&(n.weight=t)},$r.prototype.setAnimationTime=function(e,t){var n=this.animationsMap[e];n&&(n.time=t)},$r.prototype.getAnimationTime=function(e){var t=0,n=this.animationsMap[e];return n&&(t=n.time),t},$r.prototype.getAnimationDuration=function(e){var t=-1,n=this.animationsMap[e];return n&&(t=n.duration),t},$r.prototype.playAnimation=function(e){var t=this.animationsMap[e];t?(t.time=0,t.active=!0):console.warn("THREE.MorphBlendMesh: animation["+e+"] undefined in .playAnimation()")},$r.prototype.stopAnimation=function(e){var t=this.animationsMap[e];t&&(t.active=!1)},$r.prototype.update=function(e){for(var t=0,n=this.animationsList.length;tr.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(ce.prototype),Qr.prototype.constructor=Qr,Qr.prototype.isImmediateRenderObject=!0,ei.prototype=Object.create(Mt.prototype),ei.prototype.constructor=ei,ei.prototype.update=function(){var e=new c,t=new c,n=new re;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,l=a.faces,u=0,c=0,d=l.length;c.99999?this.quaternion.set(0,0,0,1):n.y<-.99999?this.quaternion.set(1,0,0,0):(t.set(n.z,0,-n.x).normalize(),e=Math.acos(n.y),this.quaternion.setFromAxisAngle(t,e))}}(),hi.prototype.setLength=function(e,t,n){void 0===t&&(t=.2*e),void 0===n&&(n=.2*t),this.line.scale.set(1,Math.max(0,e-t),1),this.line.updateMatrix(),this.cone.scale.set(n,t,n),this.cone.position.y=e,this.cone.updateMatrix()},hi.prototype.setColor=function(e){this.line.material.color.copy(e),this.cone.material.color.copy(e)},fi.prototype=Object.create(Mt.prototype),fi.prototype.constructor=fi;var js=new c,Ws=new pi,Vs=new pi,Hs=new pi;mi.prototype=Object.create(mr.prototype),mi.prototype.constructor=mi,mi.prototype.getPoint=function(e){var t=this.points,n=t.length;n<2&&console.log("duh, you need at least 2 points");var r=(n-(this.closed?0:1))*e,i=Math.floor(r),o=r-i;this.closed?i+=i>0?0:(Math.floor(Math.abs(i)/t.length)+1)*t.length:0===o&&i===n-1&&(i=n-2,o=1);var a,s,l,u;if(this.closed||i>0?a=t[(i-1)%n]:(js.subVectors(t[0],t[1]).add(t[0]),a=js),s=t[i%n],l=t[(i+1)%n],this.closed||i+26?l-6:0),c=6;c>",s=s||i,null==r[i]){if(t){var n=null===r[i]?"null":"undefined";return new Error("The "+a+" `"+s+"` is marked as required in `"+o+"`, but its value is `"+n+"`.")}return null}return e.apply(void 0,[r,i,o,a,s].concat(u))})}var r=t.bind(null,!1);return r.isRequired=t.bind(null,!0),r}function i(e,t){return"symbol"===e||("Symbol"===t["@@toStringTag"]||"function"==typeof Symbol&&t instanceof Symbol)}function o(e){var t=void 0===e?"undefined":S(e);return Array.isArray(e)?"array":e instanceof RegExp?"object":i(t,e)?"symbol":t}function a(e){var t=o(e);if("object"===t){if(e instanceof Date)return"date";if(e instanceof RegExp)return"regexp"}return t}function s(e,t){return r(function(r,i,s,l,u){return n.i(_.untracked)(function(){if(e&&o(r[i])===t.toLowerCase())return null;var n=void 0;switch(t){case"Array":n=_.isObservableArray;break;case"Object":n=_.isObservableObject;break;case"Map":n=_.isObservableMap;break;default:throw new Error("Unexpected mobxType: "+t)}var l=r[i];if(!n(l)){var c=a(l),d=e?" or javascript `"+t.toLowerCase()+"`":"";return new Error("Invalid prop `"+u+"` of type `"+c+"` supplied to `"+s+"`, expected `mobx.Observable"+t+"`"+d+".")}return null})})}function l(e,t){return r(function(r,i,o,a,l){for(var u=arguments.length,c=Array(u>5?u-5:0),d=5;d2&&void 0!==arguments[2]&&arguments[2],r=e[t],i=te[t],o=r?!0===n?function(){i.apply(this,arguments),r.apply(this,arguments)}:function(){r.apply(this,arguments),i.apply(this,arguments)}:i;e[t]=o}function y(e,t){if(null==e||null==t||"object"!==(void 0===e?"undefined":S(e))||"object"!==(void 0===t?"undefined":S(t)))return e!==t;var n=Object.keys(e);if(n.length!==Object.keys(t).length)return!0;for(var r=void 0,i=n.length-1;r=n[i];i--)if(t[r]!==e[r])return!0;return!1}function b(e,t){if("string"==typeof e)throw new Error("Store names should be provided as array");if(Array.isArray(e))return J||(J=!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`')),t?h.apply(null,e)(b(t)):function(t){return b(e,t)};var n=e;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||w.Component.isPrototypeOf(n))){var r,i;return b((i=r=function(e){function t(){return E(this,t),O(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments))}return k(t,e),T(t,[{key:"render",value:function(){return n.call(this,this.props,this.context)}}]),t}(w.Component),r.displayName=n.displayName||n.name,r.contextTypes=n.contextTypes,r.propTypes=n.propTypes,r.defaultProps=n.defaultProps,i))}if(!n)throw new Error("Please pass a valid component to 'observer'");return x(n.prototype||n),n.isMobXReactObserver=!0,n}function x(e){v(e,"componentWillMount",!0),["componentDidMount","componentWillUnmount","componentDidUpdate"].forEach(function(t){v(e,t)}),e.shouldComponentUpdate||(e.shouldComponentUpdate=te.shouldComponentUpdate)}Object.defineProperty(t,"__esModule",{value:!0}),n.d(t,"propTypes",function(){return Y}),n.d(t,"PropTypes",function(){return Y}),n.d(t,"onError",function(){return se}),n.d(t,"observer",function(){return b}),n.d(t,"Observer",function(){return ne}),n.d(t,"renderReporter",function(){return $}),n.d(t,"componentByNodeRegistery",function(){return Q}),n.d(t,"trackComponents",function(){return m}),n.d(t,"useStaticRendering",function(){return g}),n.d(t,"Provider",function(){return ae}),n.d(t,"inject",function(){return h});var _=n(21),w=n(2),M=(n.n(w),n(38)),S=(n.n(M),"function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e}),E=(function(){function e(e){this.value=e}function t(t){function n(e,t){return new Promise(function(n,i){var s={key:e,arg:t,resolve:n,reject:i,next:null};a?a=a.next=s:(o=a=s,r(e,t))})}function r(n,o){try{var a=t[n](o),s=a.value;s instanceof e?Promise.resolve(s.value).then(function(e){r("next",e)},function(e){r("throw",e)}):i(a.done?"return":"normal",a.value)}catch(e){i("throw",e)}}function i(e,t){switch(e){case"return":o.resolve({value:t,done:!0});break;case"throw":o.reject(t);break;default:o.resolve({value:t,done:!1})}o=o.next,o?r(o.key,o.arg):a=null}var o,a;this._invoke=n,"function"!=typeof t.return&&(this.return=void 0)}"function"==typeof Symbol&&Symbol.asyncIterator&&(t.prototype[Symbol.asyncIterator]=function(){return this}),t.prototype.next=function(e){return this._invoke("next",e)},t.prototype.throw=function(e){return this._invoke("throw",e)},t.prototype.return=function(e){return this._invoke("return",e)}}(),function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}),T=function(){function e(e,t){for(var n=0;n",r=this._reactInternalInstance&&this._reactInternalInstance._rootNodeID,i=!1,o=!1;e.call(this,"props"),e.call(this,"state");var a=this.render.bind(this),s=null,l=!1,u=function(){return s=new _.Reaction(n+"#"+r+".render()",function(){if(!l&&(l=!0,"function"==typeof t.componentWillReact&&t.componentWillReact(),!0!==t.__$mobxIsUnmounted)){var e=!0;try{o=!0,i||w.Component.prototype.forceUpdate.call(t),e=!1}finally{o=!1,e&&s.dispose()}}}),s.reactComponent=t,c.$mobx=s,t.render=c,c()},c=function(){l=!1;var e=void 0,n=void 0;if(s.track(function(){Z&&(t.__$mobRenderStart=Date.now());try{n=_.extras.allowStateChanges(!1,a)}catch(t){e=t}Z&&(t.__$mobRenderEnd=Date.now())}),e)throw ee.emit(e),e;return n};this.render=u}},componentWillUnmount:function(){if(!0!==K&&(this.render.$mobx&&this.render.$mobx.dispose(),this.__$mobxIsUnmounted=!0,Z)){var e=f(this);e&&Q&&Q.delete(e),$.emit({event:"destroy",component:this,node:e})}},componentDidMount:function(){Z&&p(this)},componentDidUpdate:function(){Z&&p(this)},shouldComponentUpdate:function(e,t){return K&&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!==t||y(this.props,e)}},ne=b(function(e){return(0,e.children)()});ne.displayName="Observer",ne.propTypes={children:function(e,t,n,r,i){if("function"!=typeof e[t])return new Error("Invalid prop `"+i+"` of type `"+S(e[t])+"` supplied to `"+n+"`, expected `function`.")}};var re,ie,oe={children:!0,key:!0,ref:!0},ae=(ie=re=function(e){function t(){return E(this,t),O(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments))}return k(t,e),T(t,[{key:"render",value:function(){return w.Children.only(this.props.children)}},{key:"getChildContext",value:function(){var e={},t=this.context.mobxStores;if(t)for(var n in t)e[n]=t[n];for(var r in this.props)oe[r]||"suppressChangedStoreWarning"===r||(e[r]=this.props[r]);return{mobxStores:e}}},{key:"componentWillReceiveProps",value:function(e){if(Object.keys(e).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"),!e.suppressChangedStoreWarning)for(var t in e)oe[t]||this.props[t]===e[t]||console.warn("MobX Provider: Provided store '"+t+"' has changed. Please avoid replacing stores as the change might not propagate to all children")}}]),t}(w.Component),re.contextTypes={mobxStores:G},re.childContextTypes={mobxStores:G.isRequired},ie);if(!w.Component)throw new Error("mobx-react requires React to be available");if(!_.extras)throw new Error("mobx-react requires mobx to be available");"function"==typeof M.unstable_batchedUpdates&&_.extras.setReactionScheduler(M.unstable_batchedUpdates);var se=function(e){return ee.on(e)};if("object"===("undefined"==typeof __MOBX_DEVTOOLS_GLOBAL_HOOK__?"undefined":S(__MOBX_DEVTOOLS_GLOBAL_HOOK__))){var le={spy:_.spy,extras:_.extras},ue={renderReporter:$,componentByNodeRegistery:Q,trackComponents:m};__MOBX_DEVTOOLS_GLOBAL_HOOK__.injectMobxReact(ue,le)}},function(e,t,n){"use strict";var r=n(6);e.exports={_set:function(e,t){return r.merge(this[e]||(this[e]={}),t)}}},function(e,t,n){"use strict";function r(){}function i(e,t){this.x=e||0,this.y=t||0}function o(e,t,n,r,a,s,l,u,c,d){Object.defineProperty(this,"id",{value:ps++}),this.uuid=fs.generateUUID(),this.name="",this.image=void 0!==e?e:o.DEFAULT_IMAGE,this.mipmaps=[],this.mapping=void 0!==t?t:o.DEFAULT_MAPPING,this.wrapS=void 0!==n?n:la,this.wrapT=void 0!==r?r:la,this.magFilter=void 0!==a?a:fa,this.minFilter=void 0!==s?s:ma,this.anisotropy=void 0!==c?c:1,this.format=void 0!==l?l:Pa,this.type=void 0!==u?u:ga,this.offset=new i(0,0),this.repeat=new i(1,1),this.generateMipmaps=!0,this.premultiplyAlpha=!1,this.flipY=!0,this.unpackAlignment=4,this.encoding=void 0!==d?d:rs,this.version=0,this.onUpdate=null}function a(e,t,n,r){this.x=e||0,this.y=t||0,this.z=n||0,this.w=void 0!==r?r:1}function s(e,t,n){this.uuid=fs.generateUUID(),this.width=e,this.height=t,this.scissor=new a(0,0,e,t),this.scissorTest=!1,this.viewport=new a(0,0,e,t),n=n||{},void 0===n.minFilter&&(n.minFilter=fa),this.texture=new o(void 0,void 0,n.wrapS,n.wrapT,n.magFilter,n.minFilter,n.format,n.type,n.anisotropy,n.encoding),this.depthBuffer=void 0===n.depthBuffer||n.depthBuffer,this.stencilBuffer=void 0===n.stencilBuffer||n.stencilBuffer,this.depthTexture=void 0!==n.depthTexture?n.depthTexture:null}function l(e,t,n){s.call(this,e,t,n),this.activeCubeFace=0,this.activeMipMapLevel=0}function u(e,t,n,r){this._x=e||0,this._y=t||0,this._z=n||0,this._w=void 0!==r?r:1}function c(e,t,n){this.x=e||0,this.y=t||0,this.z=n||0}function d(){this.elements=new Float32Array([1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1]),arguments.length>0&&console.error("THREE.Matrix4: the constructor no longer reads arguments. use .set() instead.")}function h(e,t,n,r,i,a,s,l,u,c){e=void 0!==e?e:[],t=void 0!==t?t:ea,o.call(this,e,t,n,r,i,a,s,l,u,c),this.flipY=!1}function f(){this.seq=[],this.map={}}function p(e,t,n){var r=e[0];if(r<=0||r>0)return e;var i=t*n,o=vs[i];if(void 0===o&&(o=new Float32Array(i),vs[i]=o),0!==t){r.toArray(o,0);for(var a=1,s=0;a!==t;++a)s+=n,e[a].toArray(o,s)}return o}function m(e,t){var n=ys[t];void 0===n&&(n=new Int32Array(t),ys[t]=n);for(var r=0;r!==t;++r)n[r]=e.allocTextureUnit();return n}function g(e,t){e.uniform1f(this.addr,t)}function v(e,t){e.uniform1i(this.addr,t)}function y(e,t){void 0===t.x?e.uniform2fv(this.addr,t):e.uniform2f(this.addr,t.x,t.y)}function b(e,t){void 0!==t.x?e.uniform3f(this.addr,t.x,t.y,t.z):void 0!==t.r?e.uniform3f(this.addr,t.r,t.g,t.b):e.uniform3fv(this.addr,t)}function x(e,t){void 0===t.x?e.uniform4fv(this.addr,t):e.uniform4f(this.addr,t.x,t.y,t.z,t.w)}function _(e,t){e.uniformMatrix2fv(this.addr,!1,t.elements||t)}function w(e,t){e.uniformMatrix3fv(this.addr,!1,t.elements||t)}function M(e,t){e.uniformMatrix4fv(this.addr,!1,t.elements||t)}function S(e,t,n){var r=n.allocTextureUnit();e.uniform1i(this.addr,r),n.setTexture2D(t||ms,r)}function E(e,t,n){var r=n.allocTextureUnit();e.uniform1i(this.addr,r),n.setTextureCube(t||gs,r)}function T(e,t){e.uniform2iv(this.addr,t)}function k(e,t){e.uniform3iv(this.addr,t)}function O(e,t){e.uniform4iv(this.addr,t)}function C(e){switch(e){case 5126:return g;case 35664:return y;case 35665:return b;case 35666:return x;case 35674:return _;case 35675:return w;case 35676:return M;case 35678:return S;case 35680:return E;case 5124:case 35670:return v;case 35667:case 35671:return T;case 35668:case 35672:return k;case 35669:case 35673:return O}}function P(e,t){e.uniform1fv(this.addr,t)}function A(e,t){e.uniform1iv(this.addr,t)}function R(e,t){e.uniform2fv(this.addr,p(t,this.size,2))}function L(e,t){e.uniform3fv(this.addr,p(t,this.size,3))}function D(e,t){e.uniform4fv(this.addr,p(t,this.size,4))}function I(e,t){e.uniformMatrix2fv(this.addr,!1,p(t,this.size,4))}function z(e,t){e.uniformMatrix3fv(this.addr,!1,p(t,this.size,9))}function N(e,t){e.uniformMatrix4fv(this.addr,!1,p(t,this.size,16))}function B(e,t,n){var r=t.length,i=m(n,r);e.uniform1iv(this.addr,i);for(var o=0;o!==r;++o)n.setTexture2D(t[o]||ms,i[o])}function F(e,t,n){var r=t.length,i=m(n,r);e.uniform1iv(this.addr,i);for(var o=0;o!==r;++o)n.setTextureCube(t[o]||gs,i[o])}function U(e){switch(e){case 5126:return P;case 35664:return R;case 35665:return L;case 35666:return D;case 35674:return I;case 35675:return z;case 35676:return N;case 35678:return B;case 35680:return F;case 5124:case 35670:return A;case 35667:case 35671:return T;case 35668:case 35672:return k;case 35669:case 35673:return O}}function j(e,t,n){this.id=e,this.addr=n,this.setValue=C(t.type)}function W(e,t,n){this.id=e,this.addr=n,this.size=t.size,this.setValue=U(t.type)}function V(e){this.id=e,f.call(this)}function H(e,t){e.seq.push(t),e.map[t.id]=t}function G(e,t,n){var r=e.name,i=r.length;for(bs.lastIndex=0;;){var o=bs.exec(r),a=bs.lastIndex,s=o[1],l="]"===o[2],u=o[3];if(l&&(s|=0),void 0===u||"["===u&&a+2===i){H(n,void 0===u?new j(s,e,t):new W(s,e,t));break}var c=n.map,d=c[s];void 0===d&&(d=new V(s),H(n,d)),n=d}}function Y(e,t,n){f.call(this),this.renderer=n;for(var r=e.getProgramParameter(t,e.ACTIVE_UNIFORMS),i=0;i.001&&A.scale>.001&&(M.x=A.x,M.y=A.y,M.z=A.z,_=A.size*A.scale/g.w,w.x=_*y,w.y=_,p.uniform3f(d.screenPosition,M.x,M.y,M.z),p.uniform2f(d.scale,w.x,w.y),p.uniform1f(d.rotation,A.rotation),p.uniform1f(d.opacity,A.opacity),p.uniform3f(d.color,A.color.r,A.color.g,A.color.b),m.setBlending(A.blending,A.blendEquation,A.blendSrc,A.blendDst),e.setTexture2D(A.texture,1),p.drawElements(p.TRIANGLES,6,p.UNSIGNED_SHORT,0))}}}m.enable(p.CULL_FACE),m.enable(p.DEPTH_TEST),m.setDepthWrite(!0),e.resetGLState()}}}function J(e,t){function n(){var e=new Float32Array([-.5,-.5,0,0,.5,-.5,1,0,.5,.5,1,1,-.5,.5,0,1]),t=new Uint16Array([0,1,2,0,2,3]);a=p.createBuffer(),s=p.createBuffer(),p.bindBuffer(p.ARRAY_BUFFER,a),p.bufferData(p.ARRAY_BUFFER,e,p.STATIC_DRAW),p.bindBuffer(p.ELEMENT_ARRAY_BUFFER,s),p.bufferData(p.ELEMENT_ARRAY_BUFFER,t,p.STATIC_DRAW),l=r(),d={position:p.getAttribLocation(l,"position"),uv:p.getAttribLocation(l,"uv")},h={uvOffset:p.getUniformLocation(l,"uvOffset"),uvScale:p.getUniformLocation(l,"uvScale"),rotation:p.getUniformLocation(l,"rotation"),scale:p.getUniformLocation(l,"scale"),color:p.getUniformLocation(l,"color"),map:p.getUniformLocation(l,"map"),opacity:p.getUniformLocation(l,"opacity"),modelViewMatrix:p.getUniformLocation(l,"modelViewMatrix"),projectionMatrix:p.getUniformLocation(l,"projectionMatrix"),fogType:p.getUniformLocation(l,"fogType"),fogDensity:p.getUniformLocation(l,"fogDensity"),fogNear:p.getUniformLocation(l,"fogNear"),fogFar:p.getUniformLocation(l,"fogFar"),fogColor:p.getUniformLocation(l,"fogColor"),alphaTest:p.getUniformLocation(l,"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 t=p.createProgram(),n=p.createShader(p.VERTEX_SHADER),r=p.createShader(p.FRAGMENT_SHADER);return p.shaderSource(n,["precision "+e.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")),p.shaderSource(r,["precision "+e.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")),p.compileShader(n),p.compileShader(r),p.attachShader(t,n),p.attachShader(t,r),p.linkProgram(t),t}function i(e,t){return e.renderOrder!==t.renderOrder?e.renderOrder-t.renderOrder:e.z!==t.z?t.z-e.z:t.id-e.id}var a,s,l,d,h,f,p=e.context,m=e.state,g=new c,v=new u,y=new c;this.render=function(r,o){if(0!==t.length){void 0===l&&n(),p.useProgram(l),m.initAttributes(),m.enableAttribute(d.position),m.enableAttribute(d.uv),m.disableUnusedAttributes(),m.disable(p.CULL_FACE),m.enable(p.BLEND),p.bindBuffer(p.ARRAY_BUFFER,a),p.vertexAttribPointer(d.position,2,p.FLOAT,!1,16,0),p.vertexAttribPointer(d.uv,2,p.FLOAT,!1,16,8),p.bindBuffer(p.ELEMENT_ARRAY_BUFFER,s),p.uniformMatrix4fv(h.projectionMatrix,!1,o.projectionMatrix.elements),m.activeTexture(p.TEXTURE0),p.uniform1i(h.map,0);var u=0,c=0,b=r.fog;b?(p.uniform3f(h.fogColor,b.color.r,b.color.g,b.color.b),b.isFog?(p.uniform1f(h.fogNear,b.near),p.uniform1f(h.fogFar,b.far),p.uniform1i(h.fogType,1),u=1,c=1):b.isFogExp2&&(p.uniform1f(h.fogDensity,b.density),p.uniform1i(h.fogType,2),u=2,c=2)):(p.uniform1i(h.fogType,0),u=0,c=0);for(var x=0,_=t.length;x<_;x++){var w=t[x];w.modelViewMatrix.multiplyMatrices(o.matrixWorldInverse,w.matrixWorld),w.z=-w.modelViewMatrix.elements[14]}t.sort(i);for(var M=[],x=0,_=t.length;x<_;x++){var w=t[x],S=w.material;if(!1!==S.visible){p.uniform1f(h.alphaTest,S.alphaTest),p.uniformMatrix4fv(h.modelViewMatrix,!1,w.modelViewMatrix.elements),w.matrixWorld.decompose(g,v,y),M[0]=y.x,M[1]=y.y;var E=0;r.fog&&S.fog&&(E=c),u!==E&&(p.uniform1i(h.fogType,E),u=E),null!==S.map?(p.uniform2f(h.uvOffset,S.map.offset.x,S.map.offset.y),p.uniform2f(h.uvScale,S.map.repeat.x,S.map.repeat.y)):(p.uniform2f(h.uvOffset,0,0),p.uniform2f(h.uvScale,1,1)),p.uniform1f(h.opacity,S.opacity),p.uniform3f(h.color,S.color.r,S.color.g,S.color.b),p.uniform1f(h.rotation,S.rotation),p.uniform2fv(h.scale,M),m.setBlending(S.blending,S.blendEquation,S.blendSrc,S.blendDst),m.setDepthTest(S.depthTest),m.setDepthWrite(S.depthWrite),S.map?e.setTexture2D(S.map,0):e.setTexture2D(f,0),p.drawElements(p.TRIANGLES,6,p.UNSIGNED_SHORT,0)}}m.enable(p.CULL_FACE),e.resetGLState()}}}function Q(){Object.defineProperty(this,"id",{value:Es++}),this.uuid=fs.generateUUID(),this.name="",this.type="Material",this.fog=!0,this.lights=!0,this.blending=go,this.side=ao,this.shading=co,this.vertexColors=ho,this.opacity=1,this.transparent=!1,this.blendSrc=Po,this.blendDst=Ao,this.blendEquation=_o,this.blendSrcAlpha=null,this.blendDstAlpha=null,this.blendEquationAlpha=null,this.depthFunc=Uo,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 $(e){Q.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!==e&&(void 0!==e.attributes&&console.error("THREE.ShaderMaterial: attributes should now be defined in THREE.BufferGeometry instead."),this.setValues(e))}function ee(e){Q.call(this),this.type="MeshDepthMaterial",this.depthPacking=ds,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(e)}function te(e,t){this.min=void 0!==e?e:new c(1/0,1/0,1/0),this.max=void 0!==t?t:new c(-1/0,-1/0,-1/0)}function ne(e,t){this.center=void 0!==e?e:new c,this.radius=void 0!==t?t:0}function re(){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 ie(e,t){this.normal=void 0!==e?e:new c(1,0,0),this.constant=void 0!==t?t:0}function oe(e,t,n,r,i,o){this.planes=[void 0!==e?e:new ie,void 0!==t?t:new ie,void 0!==n?n:new ie,void 0!==r?r:new ie,void 0!==i?i:new ie,void 0!==o?o:new ie]}function ae(e,t,n,r){function o(t,n,r,i){var o=t.geometry,a=null,s=S,l=t.customDepthMaterial;if(r&&(s=E,l=t.customDistanceMaterial),l)a=l;else{var u=!1;n.morphTargets&&(o&&o.isBufferGeometry?u=o.morphAttributes&&o.morphAttributes.position&&o.morphAttributes.position.length>0:o&&o.isGeometry&&(u=o.morphTargets&&o.morphTargets.length>0));var c=t.isSkinnedMesh&&n.skinning,d=0;u&&(d|=_),c&&(d|=w),a=s[d]}if(e.localClippingEnabled&&!0===n.clipShadows&&0!==n.clippingPlanes.length){var h=a.uuid,f=n.uuid,p=T[h];void 0===p&&(p={},T[h]=p);var m=p[f];void 0===m&&(m=a.clone(),p[f]=m),a=m}a.visible=n.visible,a.wireframe=n.wireframe;var g=n.side;return B.renderSingleSided&&g==lo&&(g=ao),B.renderReverseSided&&(g===ao?g=so:g===so&&(g=ao)),a.side=g,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 l(e,t,n){if(!1!==e.visible){if(0!=(e.layers.mask&t.layers.mask)&&(e.isMesh||e.isLine||e.isPoints)&&e.castShadow&&(!1===e.frustumCulled||!0===f.intersectsObject(e))){!0===e.material.visible&&(e.modelViewMatrix.multiplyMatrices(n.matrixWorldInverse,e.matrixWorld),x.push(e))}for(var r=e.children,i=0,o=r.length;in&&(n=e[t]);return n}function ke(){return ks++}function Oe(){Object.defineProperty(this,"id",{value:ke()}),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 Ce(){Object.defineProperty(this,"id",{value:ke()}),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 Pe(e,t){ce.call(this),this.type="Mesh",this.geometry=void 0!==e?e:new Ce,this.material=void 0!==t?t:new pe({color:16777215*Math.random()}),this.drawMode=es,this.updateMorphTargets()}function Ae(e,t,n,r,i,o){Oe.call(this),this.type="BoxGeometry",this.parameters={width:e,height:t,depth:n,widthSegments:r,heightSegments:i,depthSegments:o},this.fromBufferGeometry(new Re(e,t,n,r,i,o)),this.mergeVertices()}function Re(e,t,n,r,i,o){function a(e,t,n,r,i,o,a,m,g,v,y){var b,x,_=o/g,w=a/v,M=o/2,S=a/2,E=m/2,T=g+1,k=v+1,O=0,C=0,P=new c;for(x=0;x0?1:-1,d.push(P.x,P.y,P.z),h.push(b/g),h.push(1-x/v),O+=1}}for(x=0;x");return Qe(n)}var n=/#include +<([\w\d.]+)>/g;return e.replace(n,t)}function $e(e){function t(e,t,n,r){for(var i="",o=parseInt(t);o0?e.gammaFactor:1,g=qe(o,r,e.extensions),v=Xe(a),y=i.createProgram();n.isRawShaderMaterial?(f=[v,"\n"].filter(Ke).join("\n"),p=[g,v,"\n"].filter(Ke).join("\n")):(f=["precision "+r.precision+" float;","precision "+r.precision+" int;","#define SHADER_NAME "+n.__webglShader.name,v,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 "+d:"",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 "+u:"",r.sizeAttenuation?"#define USE_SIZEATTENUATION":"",r.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",r.logarithmicDepthBuffer&&e.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(Ke).join("\n"),p=[g,"precision "+r.precision+" float;","precision "+r.precision+" int;","#define SHADER_NAME "+n.__webglShader.name,v,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 "+c:"",r.envMap?"#define "+d:"",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.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 "+u:"",r.premultipliedAlpha?"#define PREMULTIPLIED_ALPHA":"",r.physicallyCorrectLights?"#define PHYSICALLY_CORRECT_LIGHTS":"",r.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",r.logarithmicDepthBuffer&&e.extensions.get("EXT_frag_depth")?"#define USE_LOGDEPTHBUF_EXT":"",r.envMap&&e.extensions.get("EXT_shader_texture_lod")?"#define TEXTURE_LOD_EXT":"","uniform mat4 viewMatrix;","uniform vec3 cameraPosition;",r.toneMapping!==Xo?"#define TONE_MAPPING":"",r.toneMapping!==Xo?_s.tonemapping_pars_fragment:"",r.toneMapping!==Xo?Ye("toneMapping",r.toneMapping):"",r.outputEncoding||r.mapEncoding||r.envMapEncoding||r.emissiveMapEncoding?_s.encodings_pars_fragment:"",r.mapEncoding?He("mapTexelToLinear",r.mapEncoding):"",r.envMapEncoding?He("envMapTexelToLinear",r.envMapEncoding):"",r.emissiveMapEncoding?He("emissiveMapTexelToLinear",r.emissiveMapEncoding):"",r.outputEncoding?Ge("linearToOutputTexel",r.outputEncoding):"",r.depthPacking?"#define DEPTH_PACKING "+n.depthPacking:"","\n"].filter(Ke).join("\n")),s=Qe(s,r),s=Je(s,r),l=Qe(l,r),l=Je(l,r),n.isShaderMaterial||(s=$e(s),l=$e(l));var b=f+s,x=p+l,_=We(i,i.VERTEX_SHADER,b),w=We(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 M=i.getProgramInfoLog(y),S=i.getShaderInfoLog(_),E=i.getShaderInfoLog(w),T=!0,k=!0;!1===i.getProgramParameter(y,i.LINK_STATUS)?(T=!1,console.error("THREE.WebGLProgram: shader error: ",i.getError(),"gl.VALIDATE_STATUS",i.getProgramParameter(y,i.VALIDATE_STATUS),"gl.getProgramInfoLog",M,S,E)):""!==M?console.warn("THREE.WebGLProgram: gl.getProgramInfoLog()",M):""!==S&&""!==E||(k=!1),k&&(this.diagnostics={runnable:T,material:n,programLog:M,vertexShader:{log:S,prefix:f},fragmentShader:{log:E,prefix:p}}),i.deleteShader(_),i.deleteShader(w);var O;this.getUniforms=function(){return void 0===O&&(O=new Y(i,y,e)),O};var C;return this.getAttributes=function(){return void 0===C&&(C=Ze(i,y)),C},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=Os++,this.code=t,this.usedTimes=1,this.program=y,this.vertexShader=_,this.fragmentShader=w,this}function tt(e,t){function n(e){if(t.floatVertexTextures&&e&&e.skeleton&&e.skeleton.useVertexTexture)return 1024;var n=t.maxVertexUniforms,r=Math.floor((n-20)/4),i=r;return void 0!==e&&e&&e.isSkinnedMesh&&(i=Math.min(e.skeleton.bones.length,i))0,shadowMapType:e.shadowMap.type,toneMapping:e.toneMapping,physicallyCorrectLights:e.physicallyCorrectLights,premultipliedAlpha:i.premultipliedAlpha,alphaTest:i.alphaTest,doubleSided:i.side===lo,flipSided:i.side===so,depthPacking:void 0!==i.depthPacking&&i.depthPacking}},this.getProgramCode=function(e,t){var n=[];if(t.shaderID?n.push(t.shaderID):(n.push(e.fragmentShader),n.push(e.vertexShader)),void 0!==e.defines)for(var r in e.defines)n.push(r),n.push(e.defines[r]);for(var i=0;i65535?we:xe)(o,1);return i(p,e.ELEMENT_ARRAY_BUFFER),r.wireframe=p,p}var c=new nt(e,t,n);return{getAttributeBuffer:s,getAttributeProperties:l,getWireframeAttribute:u,update:r}}function it(e,t,n,r,i,o,a){function s(e,t){if(e.width>t||e.height>t){var n=t/Math.max(e.width,e.height),r=document.createElementNS("http://www.w3.org/1999/xhtml","canvas");r.width=Math.floor(e.width*n),r.height=Math.floor(e.height*n);return r.getContext("2d").drawImage(e,0,0,e.width,e.height,0,0,r.width,r.height),console.warn("THREE.WebGLRenderer: image is too big ("+e.width+"x"+e.height+"). Resized to "+r.width+"x"+r.height,e),r}return e}function l(e){return fs.isPowerOfTwo(e.width)&&fs.isPowerOfTwo(e.height)}function u(e){if(e instanceof HTMLImageElement||e instanceof HTMLCanvasElement){var t=document.createElementNS("http://www.w3.org/1999/xhtml","canvas");t.width=fs.nearestPowerOfTwo(e.width),t.height=fs.nearestPowerOfTwo(e.height);return t.getContext("2d").drawImage(e,0,0,t.width,t.height),console.warn("THREE.WebGLRenderer: image is not power of two ("+e.width+"x"+e.height+"). Resized to "+t.width+"x"+t.height,e),t}return e}function c(e){return e.wrapS!==la||e.wrapT!==la||e.minFilter!==ca&&e.minFilter!==fa}function d(t){return t===ca||t===da||t===ha?e.NEAREST:e.LINEAR}function h(e){var t=e.target;t.removeEventListener("dispose",h),p(t),k.textures--}function f(e){var t=e.target;t.removeEventListener("dispose",f),m(t),k.textures--}function p(t){var n=r.get(t);if(t.image&&n.__image__webglTextureCube)e.deleteTexture(n.__image__webglTextureCube);else{if(void 0===n.__webglInit)return;e.deleteTexture(n.__webglTexture)}r.delete(t)}function m(t){var n=r.get(t),i=r.get(t.texture);if(t){if(void 0!==i.__webglTexture&&e.deleteTexture(i.__webglTexture),t.depthTexture&&t.depthTexture.dispose(),t.isWebGLRenderTargetCube)for(var o=0;o<6;o++)e.deleteFramebuffer(n.__webglFramebuffer[o]),n.__webglDepthbuffer&&e.deleteRenderbuffer(n.__webglDepthbuffer[o]);else e.deleteFramebuffer(n.__webglFramebuffer),n.__webglDepthbuffer&&e.deleteRenderbuffer(n.__webglDepthbuffer);r.delete(t.texture),r.delete(t)}}function g(t,i){var o=r.get(t);if(t.version>0&&o.__version!==t.version){var a=t.image;if(void 0===a)console.warn("THREE.WebGLRenderer: Texture marked for update but image is undefined",t);else{if(!1!==a.complete)return void x(o,t,i);console.warn("THREE.WebGLRenderer: Texture marked for update but image is incomplete",t)}}n.activeTexture(e.TEXTURE0+i),n.bindTexture(e.TEXTURE_2D,o.__webglTexture)}function v(t,a){var u=r.get(t);if(6===t.image.length)if(t.version>0&&u.__version!==t.version){u.__image__webglTextureCube||(t.addEventListener("dispose",h),u.__image__webglTextureCube=e.createTexture(),k.textures++),n.activeTexture(e.TEXTURE0+a),n.bindTexture(e.TEXTURE_CUBE_MAP,u.__image__webglTextureCube),e.pixelStorei(e.UNPACK_FLIP_Y_WEBGL,t.flipY);for(var c=t&&t.isCompressedTexture,d=t.image[0]&&t.image[0].isDataTexture,f=[],p=0;p<6;p++)f[p]=c||d?d?t.image[p].image:t.image[p]:s(t.image[p],i.maxCubemapSize);var m=f[0],g=l(m),v=o(t.format),y=o(t.type);b(e.TEXTURE_CUBE_MAP,t,g);for(var p=0;p<6;p++)if(c)for(var x,_=f[p].mipmaps,w=0,M=_.length;w-1?n.compressedTexImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+p,w,v,x.width,x.height,0,x.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .setTextureCube()"):n.texImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+p,w,v,x.width,x.height,0,v,y,x.data);else d?n.texImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+p,0,v,f[p].width,f[p].height,0,v,y,f[p].data):n.texImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+p,0,v,v,y,f[p]);t.generateMipmaps&&g&&e.generateMipmap(e.TEXTURE_CUBE_MAP),u.__version=t.version,t.onUpdate&&t.onUpdate(t)}else n.activeTexture(e.TEXTURE0+a),n.bindTexture(e.TEXTURE_CUBE_MAP,u.__image__webglTextureCube)}function y(t,i){n.activeTexture(e.TEXTURE0+i),n.bindTexture(e.TEXTURE_CUBE_MAP,r.get(t).__webglTexture)}function b(n,a,s){var l;if(s?(e.texParameteri(n,e.TEXTURE_WRAP_S,o(a.wrapS)),e.texParameteri(n,e.TEXTURE_WRAP_T,o(a.wrapT)),e.texParameteri(n,e.TEXTURE_MAG_FILTER,o(a.magFilter)),e.texParameteri(n,e.TEXTURE_MIN_FILTER,o(a.minFilter))):(e.texParameteri(n,e.TEXTURE_WRAP_S,e.CLAMP_TO_EDGE),e.texParameteri(n,e.TEXTURE_WRAP_T,e.CLAMP_TO_EDGE),a.wrapS===la&&a.wrapT===la||console.warn("THREE.WebGLRenderer: Texture is not power of two. Texture.wrapS and Texture.wrapT should be set to THREE.ClampToEdgeWrapping.",a),e.texParameteri(n,e.TEXTURE_MAG_FILTER,d(a.magFilter)),e.texParameteri(n,e.TEXTURE_MIN_FILTER,d(a.minFilter)),a.minFilter!==ca&&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)),l=t.get("EXT_texture_filter_anisotropic")){if(a.type===wa&&null===t.get("OES_texture_float_linear"))return;if(a.type===Ma&&null===t.get("OES_texture_half_float_linear"))return;(a.anisotropy>1||r.get(a).__currentAnisotropy)&&(e.texParameterf(n,l.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(a.anisotropy,i.getMaxAnisotropy())),r.get(a).__currentAnisotropy=a.anisotropy)}}function x(t,r,a){void 0===t.__webglInit&&(t.__webglInit=!0,r.addEventListener("dispose",h),t.__webglTexture=e.createTexture(),k.textures++),n.activeTexture(e.TEXTURE0+a),n.bindTexture(e.TEXTURE_2D,t.__webglTexture),e.pixelStorei(e.UNPACK_FLIP_Y_WEBGL,r.flipY),e.pixelStorei(e.UNPACK_PREMULTIPLY_ALPHA_WEBGL,r.premultiplyAlpha),e.pixelStorei(e.UNPACK_ALIGNMENT,r.unpackAlignment);var d=s(r.image,i.maxTextureSize);c(r)&&!1===l(d)&&(d=u(d));var f=l(d),p=o(r.format),m=o(r.type);b(e.TEXTURE_2D,r,f);var g,v=r.mipmaps;if(r.isDepthTexture){var y=e.DEPTH_COMPONENT;if(r.type===wa){if(!O)throw new Error("Float Depth Texture only supported in WebGL2.0");y=e.DEPTH_COMPONENT32F}else O&&(y=e.DEPTH_COMPONENT16);r.format===Da&&y===e.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===Ia&&(y=e.DEPTH_STENCIL,r.type!==ka&&(console.warn("THREE.WebGLRenderer: Use UnsignedInt248Type for DepthStencilFormat DepthTexture."),r.type=ka,m=o(r.type))),n.texImage2D(e.TEXTURE_2D,0,y,d.width,d.height,0,p,m,null)}else if(r.isDataTexture)if(v.length>0&&f){for(var x=0,_=v.length;x<_;x++)g=v[x],n.texImage2D(e.TEXTURE_2D,x,p,g.width,g.height,0,p,m,g.data);r.generateMipmaps=!1}else n.texImage2D(e.TEXTURE_2D,0,p,d.width,d.height,0,p,m,d.data);else if(r.isCompressedTexture)for(var x=0,_=v.length;x<_;x++)g=v[x],r.format!==Pa&&r.format!==Ca?n.getCompressedTextureFormats().indexOf(p)>-1?n.compressedTexImage2D(e.TEXTURE_2D,x,p,g.width,g.height,0,g.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()"):n.texImage2D(e.TEXTURE_2D,x,p,g.width,g.height,0,p,m,g.data);else if(v.length>0&&f){for(var x=0,_=v.length;x<_;x++)g=v[x],n.texImage2D(e.TEXTURE_2D,x,p,p,m,g);r.generateMipmaps=!1}else n.texImage2D(e.TEXTURE_2D,0,p,p,m,d);r.generateMipmaps&&f&&e.generateMipmap(e.TEXTURE_2D),t.__version=r.version,r.onUpdate&&r.onUpdate(r)}function _(t,i,a,s){var l=o(i.texture.format),u=o(i.texture.type);n.texImage2D(s,0,l,i.width,i.height,0,l,u,null),e.bindFramebuffer(e.FRAMEBUFFER,t),e.framebufferTexture2D(e.FRAMEBUFFER,a,s,r.get(i.texture).__webglTexture,0),e.bindFramebuffer(e.FRAMEBUFFER,null)}function w(t,n){e.bindRenderbuffer(e.RENDERBUFFER,t),n.depthBuffer&&!n.stencilBuffer?(e.renderbufferStorage(e.RENDERBUFFER,e.DEPTH_COMPONENT16,n.width,n.height),e.framebufferRenderbuffer(e.FRAMEBUFFER,e.DEPTH_ATTACHMENT,e.RENDERBUFFER,t)):n.depthBuffer&&n.stencilBuffer?(e.renderbufferStorage(e.RENDERBUFFER,e.DEPTH_STENCIL,n.width,n.height),e.framebufferRenderbuffer(e.FRAMEBUFFER,e.DEPTH_STENCIL_ATTACHMENT,e.RENDERBUFFER,t)):e.renderbufferStorage(e.RENDERBUFFER,e.RGBA4,n.width,n.height),e.bindRenderbuffer(e.RENDERBUFFER,null)}function M(t,n){if(n&&n.isWebGLRenderTargetCube)throw new Error("Depth Texture with cube render targets is not supported!");if(e.bindFramebuffer(e.FRAMEBUFFER,t),!n.depthTexture||!n.depthTexture.isDepthTexture)throw new Error("renderTarget.depthTexture must be an instance of THREE.DepthTexture");r.get(n.depthTexture).__webglTexture&&n.depthTexture.image.width===n.width&&n.depthTexture.image.height===n.height||(n.depthTexture.image.width=n.width,n.depthTexture.image.height=n.height,n.depthTexture.needsUpdate=!0),g(n.depthTexture,0);var i=r.get(n.depthTexture).__webglTexture;if(n.depthTexture.format===Da)e.framebufferTexture2D(e.FRAMEBUFFER,e.DEPTH_ATTACHMENT,e.TEXTURE_2D,i,0);else{if(n.depthTexture.format!==Ia)throw new Error("Unknown depthTexture format");e.framebufferTexture2D(e.FRAMEBUFFER,e.DEPTH_STENCIL_ATTACHMENT,e.TEXTURE_2D,i,0)}}function S(t){var n=r.get(t),i=!0===t.isWebGLRenderTargetCube;if(t.depthTexture){if(i)throw new Error("target.depthTexture not supported in Cube render targets");M(n.__webglFramebuffer,t)}else if(i){n.__webglDepthbuffer=[];for(var o=0;o<6;o++)e.bindFramebuffer(e.FRAMEBUFFER,n.__webglFramebuffer[o]),n.__webglDepthbuffer[o]=e.createRenderbuffer(),w(n.__webglDepthbuffer[o],t)}else e.bindFramebuffer(e.FRAMEBUFFER,n.__webglFramebuffer),n.__webglDepthbuffer=e.createRenderbuffer(),w(n.__webglDepthbuffer,t);e.bindFramebuffer(e.FRAMEBUFFER,null)}function E(t){var i=r.get(t),o=r.get(t.texture);t.addEventListener("dispose",f),o.__webglTexture=e.createTexture(),k.textures++;var a=!0===t.isWebGLRenderTargetCube,s=l(t);if(a){i.__webglFramebuffer=[];for(var u=0;u<6;u++)i.__webglFramebuffer[u]=e.createFramebuffer()}else i.__webglFramebuffer=e.createFramebuffer();if(a){n.bindTexture(e.TEXTURE_CUBE_MAP,o.__webglTexture),b(e.TEXTURE_CUBE_MAP,t.texture,s);for(var u=0;u<6;u++)_(i.__webglFramebuffer[u],t,e.COLOR_ATTACHMENT0,e.TEXTURE_CUBE_MAP_POSITIVE_X+u);t.texture.generateMipmaps&&s&&e.generateMipmap(e.TEXTURE_CUBE_MAP),n.bindTexture(e.TEXTURE_CUBE_MAP,null)}else n.bindTexture(e.TEXTURE_2D,o.__webglTexture),b(e.TEXTURE_2D,t.texture,s),_(i.__webglFramebuffer,t,e.COLOR_ATTACHMENT0,e.TEXTURE_2D),t.texture.generateMipmaps&&s&&e.generateMipmap(e.TEXTURE_2D),n.bindTexture(e.TEXTURE_2D,null);t.depthBuffer&&S(t)}function T(t){var i=t.texture;if(i.generateMipmaps&&l(t)&&i.minFilter!==ca&&i.minFilter!==fa){var o=t&&t.isWebGLRenderTargetCube?e.TEXTURE_CUBE_MAP:e.TEXTURE_2D,a=r.get(i).__webglTexture;n.bindTexture(o,a),e.generateMipmap(o),n.bindTexture(o,null)}}var k=a.memory,O="undefined"!=typeof WebGL2RenderingContext&&e instanceof WebGL2RenderingContext;this.setTexture2D=g,this.setTextureCube=v,this.setTextureCubeDynamic=y,this.setupRenderTarget=E,this.updateRenderTargetMipmap=T}function ot(){var e={};return{get:function(t){var n=t.uuid,r=e[n];return void 0===r&&(r={},e[n]=r),r},delete:function(t){delete e[t.uuid]},clear:function(){e={}}}}function at(e,t,n){function r(){var t=!1,n=new a,r=null,i=new a;return{setMask:function(n){r===n||t||(e.colorMask(n,n,n,n),r=n)},setLocked:function(e){t=e},setClear:function(t,r,o,a,s){!0===s&&(t*=a,r*=a,o*=a),n.set(t,r,o,a),!1===i.equals(n)&&(e.clearColor(t,r,o,a),i.copy(n))},reset:function(){t=!1,r=null,i.set(0,0,0,1)}}}function i(){var t=!1,n=null,r=null,i=null;return{setTest:function(t){t?f(e.DEPTH_TEST):p(e.DEPTH_TEST)},setMask:function(r){n===r||t||(e.depthMask(r),n=r)},setFunc:function(t){if(r!==t){if(t)switch(t){case No:e.depthFunc(e.NEVER);break;case Bo:e.depthFunc(e.ALWAYS);break;case Fo:e.depthFunc(e.LESS);break;case Uo:e.depthFunc(e.LEQUAL);break;case jo:e.depthFunc(e.EQUAL);break;case Wo:e.depthFunc(e.GEQUAL);break;case Vo:e.depthFunc(e.GREATER);break;case Ho:e.depthFunc(e.NOTEQUAL);break;default:e.depthFunc(e.LEQUAL)}else e.depthFunc(e.LEQUAL);r=t}},setLocked:function(e){t=e},setClear:function(t){i!==t&&(e.clearDepth(t),i=t)},reset:function(){t=!1,n=null,r=null,i=null}}}function o(){var t=!1,n=null,r=null,i=null,o=null,a=null,s=null,l=null,u=null;return{setTest:function(t){t?f(e.STENCIL_TEST):p(e.STENCIL_TEST)},setMask:function(r){n===r||t||(e.stencilMask(r),n=r)},setFunc:function(t,n,a){r===t&&i===n&&o===a||(e.stencilFunc(t,n,a),r=t,i=n,o=a)},setOp:function(t,n,r){a===t&&s===n&&l===r||(e.stencilOp(t,n,r),a=t,s=n,l=r)},setLocked:function(e){t=e},setClear:function(t){u!==t&&(e.clearStencil(t),u=t)},reset:function(){t=!1,n=null,r=null,i=null,o=null,a=null,s=null,l=null,u=null}}}function s(t,n,r){var i=new Uint8Array(4),o=e.createTexture();e.bindTexture(t,o),e.texParameteri(t,e.TEXTURE_MIN_FILTER,e.NEAREST),e.texParameteri(t,e.TEXTURE_MAG_FILTER,e.NEAREST);for(var a=0;a=1,ce=null,de={},he=new a,fe=new a,pe={};return pe[e.TEXTURE_2D]=s(e.TEXTURE_2D,e.TEXTURE_2D,1),pe[e.TEXTURE_CUBE_MAP]=s(e.TEXTURE_CUBE_MAP,e.TEXTURE_CUBE_MAP_POSITIVE_X,6),{buffers:{color:B,depth:F,stencil:U},init:l,initAttributes:u,enableAttribute:c,enableAttributeAndDivisor:d,disableUnusedAttributes:h,enable:f,disable:p,getCompressedTextureFormats:m,setBlending:g,setColorWrite:v,setDepthTest:y,setDepthWrite:b,setDepthFunc:x,setStencilTest:_,setStencilWrite:w,setStencilFunc:M,setStencilOp:S,setFlipSided:E,setCullFace:T,setLineWidth:k,setPolygonOffset:O,getScissorTest:C,setScissorTest:P,activeTexture:A,bindTexture:R,compressedTexImage2D:L,texImage2D:D,scissor:I,viewport:z,reset:N}}function st(e,t,n){function r(){if(void 0!==o)return o;var n=t.get("EXT_texture_filter_anisotropic");return o=null!==n?e.getParameter(n.MAX_TEXTURE_MAX_ANISOTROPY_EXT):0}function i(t){if("highp"===t){if(e.getShaderPrecisionFormat(e.VERTEX_SHADER,e.HIGH_FLOAT).precision>0&&e.getShaderPrecisionFormat(e.FRAGMENT_SHADER,e.HIGH_FLOAT).precision>0)return"highp";t="mediump"}return"mediump"===t&&e.getShaderPrecisionFormat(e.VERTEX_SHADER,e.MEDIUM_FLOAT).precision>0&&e.getShaderPrecisionFormat(e.FRAGMENT_SHADER,e.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 l=!0===n.logarithmicDepthBuffer&&!!t.get("EXT_frag_depth"),u=e.getParameter(e.MAX_TEXTURE_IMAGE_UNITS),c=e.getParameter(e.MAX_VERTEX_TEXTURE_IMAGE_UNITS),d=e.getParameter(e.MAX_TEXTURE_SIZE),h=e.getParameter(e.MAX_CUBE_MAP_TEXTURE_SIZE),f=e.getParameter(e.MAX_VERTEX_ATTRIBS),p=e.getParameter(e.MAX_VERTEX_UNIFORM_VECTORS),m=e.getParameter(e.MAX_VARYING_VECTORS),g=e.getParameter(e.MAX_FRAGMENT_UNIFORM_VECTORS),v=c>0,y=!!t.get("OES_texture_float");return{getMaxAnisotropy:r,getMaxPrecision:i,precision:a,logarithmicDepthBuffer:l,maxTextures:u,maxVertexTextures:c,maxTextureSize:d,maxCubemapSize:h,maxAttributes:f,maxVertexUniforms:p,maxVaryings:m,maxFragmentUniforms:g,vertexTextures:v,floatFragmentTextures:y,floatVertexTextures:v&&y}}function lt(e){var t={};return{get:function(n){if(void 0!==t[n])return t[n];var r;switch(n){case"WEBGL_depth_texture":r=e.getExtension("WEBGL_depth_texture")||e.getExtension("MOZ_WEBGL_depth_texture")||e.getExtension("WEBKIT_WEBGL_depth_texture");break;case"EXT_texture_filter_anisotropic":r=e.getExtension("EXT_texture_filter_anisotropic")||e.getExtension("MOZ_EXT_texture_filter_anisotropic")||e.getExtension("WEBKIT_EXT_texture_filter_anisotropic");break;case"WEBGL_compressed_texture_s3tc":r=e.getExtension("WEBGL_compressed_texture_s3tc")||e.getExtension("MOZ_WEBGL_compressed_texture_s3tc")||e.getExtension("WEBKIT_WEBGL_compressed_texture_s3tc");break;case"WEBGL_compressed_texture_pvrtc":r=e.getExtension("WEBGL_compressed_texture_pvrtc")||e.getExtension("WEBKIT_WEBGL_compressed_texture_pvrtc");break;case"WEBGL_compressed_texture_etc1":r=e.getExtension("WEBGL_compressed_texture_etc1");break;default:r=e.getExtension(n)}return null===r&&console.warn("THREE.WebGLRenderer: "+n+" extension not supported."),t[n]=r,r}}}function ut(){function e(){u.value!==r&&(u.value=r,u.needsUpdate=i>0),n.numPlanes=i,n.numIntersection=0}function t(e,t,r,i){var o=null!==e?e.length:0,a=null;if(0!==o){if(a=u.value,!0!==i||null===a){var c=r+4*o,d=t.matrixWorldInverse;l.getNormalMatrix(d),(null===a||a.length=0){var c=o[l];if(void 0!==c){var d=c.normalized,h=c.itemSize,f=dt.getAttributeProperties(c),p=f.__webglBuffer,m=f.type,g=f.bytesPerElement;if(c.isInterleavedBufferAttribute){var v=c.data,y=v.stride,b=c.offset;v&&v.isInstancedInterleavedBuffer?(et.enableAttributeAndDivisor(u,v.meshPerAttribute,i),void 0===n.maxInstancedCount&&(n.maxInstancedCount=v.meshPerAttribute*v.count)):et.enableAttribute(u),Ke.bindBuffer(Ke.ARRAY_BUFFER,p),Ke.vertexAttribPointer(u,h,m,d,y*g,(r*y+b)*g)}else c.isInstancedBufferAttribute?(et.enableAttributeAndDivisor(u,c.meshPerAttribute,i),void 0===n.maxInstancedCount&&(n.maxInstancedCount=c.meshPerAttribute*c.count)):et.enableAttribute(u),Ke.bindBuffer(Ke.ARRAY_BUFFER,p),Ke.vertexAttribPointer(u,h,m,d,0,r*h*g)}else if(void 0!==s){var x=s[l];if(void 0!==x)switch(x.length){case 2:Ke.vertexAttrib2fv(u,x);break;case 3:Ke.vertexAttrib3fv(u,x);break;case 4:Ke.vertexAttrib4fv(u,x);break;default:Ke.vertexAttrib1fv(u,x)}}}}et.disableUnusedAttributes()}function h(e,t){return Math.abs(t[0])-Math.abs(e[0])}function f(e,t){return e.object.renderOrder!==t.object.renderOrder?e.object.renderOrder-t.object.renderOrder:e.material.program&&t.material.program&&e.material.program!==t.material.program?e.material.program.id-t.material.program.id:e.material.id!==t.material.id?e.material.id-t.material.id:e.z!==t.z?e.z-t.z:e.id-t.id}function p(e,t){return e.object.renderOrder!==t.object.renderOrder?e.object.renderOrder-t.object.renderOrder:e.z!==t.z?t.z-e.z:e.id-t.id}function m(e,t,n,r,i){var o,a;n.transparent?(o=re,a=++ie):(o=ee,a=++te);var s=o[a];void 0!==s?(s.id=e.id,s.object=e,s.geometry=t,s.material=n,s.z=Ge.z,s.group=i):(s={id:e.id,object:e,geometry:t,material:n,z:Ge.z,group:i},o.push(s))}function g(e){var t=e.geometry;return null===t.boundingSphere&&t.computeBoundingSphere(),Ve.copy(t.boundingSphere).applyMatrix4(e.matrixWorld),y(Ve)}function v(e){return Ve.center.set(0,0,0),Ve.radius=.7071067811865476,Ve.applyMatrix4(e.matrixWorld),y(Ve)}function y(e){if(!Le.intersectsSphere(e))return!1;var t=Ie.numPlanes;if(0===t)return!0;var n=ce.clippingPlanes,r=e.center,i=-e.radius,o=0;do{if(n[o].distanceToPoint(r)=0&&e.numSupportedMorphTargets++}if(e.morphNormals){e.numSupportedMorphNormals=0;for(var h=0;h=0&&e.numSupportedMorphNormals++}var f=r.__webglShader.uniforms;(e.isShaderMaterial||e.isRawShaderMaterial)&&!0!==e.clipping||(r.numClippingPlanes=Ie.numPlanes,r.numIntersection=Ie.numIntersection,f.clippingPlanes=Ie.uniform),r.fog=t,r.lightsHash=Xe.hash,e.lights&&(f.ambientLightColor.value=Xe.ambient,f.directionalLights.value=Xe.directional,f.spotLights.value=Xe.spot,f.rectAreaLights.value=Xe.rectArea,f.pointLights.value=Xe.point,f.hemisphereLights.value=Xe.hemi,f.directionalShadowMap.value=Xe.directionalShadowMap,f.directionalShadowMatrix.value=Xe.directionalShadowMatrix,f.spotShadowMap.value=Xe.spotShadowMap,f.spotShadowMatrix.value=Xe.spotShadowMatrix,f.pointShadowMap.value=Xe.pointShadowMap,f.pointShadowMatrix.value=Xe.pointShadowMatrix);var p=r.program.getUniforms(),m=Y.seqWithValue(p.seq,f);r.uniformsList=m}function w(e){e.side===lo?et.disable(Ke.CULL_FACE):et.enable(Ke.CULL_FACE),et.setFlipSided(e.side===so),!0===e.transparent?et.setBlending(e.blending,e.blendEquation,e.blendSrc,e.blendDst,e.blendEquationAlpha,e.blendSrcAlpha,e.blendDstAlpha,e.premultipliedAlpha):et.setBlending(mo),et.setDepthFunc(e.depthFunc),et.setDepthTest(e.depthTest),et.setDepthWrite(e.depthWrite),et.setColorWrite(e.colorWrite),et.setPolygonOffset(e.polygonOffset,e.polygonOffsetFactor,e.polygonOffsetUnits)}function M(e,t,n,r){_e=0;var i=nt.get(n);if(je&&(We||e!==ve)){var o=e===ve&&n.id===me;Ie.setState(n.clippingPlanes,n.clipIntersection,n.clipShadows,e,i,o)}!1===n.needsUpdate&&(void 0===i.program?n.needsUpdate=!0:n.fog&&i.fog!==t?n.needsUpdate=!0:n.lights&&i.lightsHash!==Xe.hash?n.needsUpdate=!0:void 0===i.numClippingPlanes||i.numClippingPlanes===Ie.numPlanes&&i.numIntersection===Ie.numIntersection||(n.needsUpdate=!0)),n.needsUpdate&&(_(n,t,r),n.needsUpdate=!1);var a=!1,s=!1,l=!1,u=i.program,c=u.getUniforms(),d=i.__webglShader.uniforms;if(u.id!==de&&(Ke.useProgram(u.program),de=u.id,a=!0,s=!0,l=!0),n.id!==me&&(me=n.id,s=!0),a||e!==ve){if(c.set(Ke,e,"projectionMatrix"),$e.logarithmicDepthBuffer&&c.setValue(Ke,"logDepthBufFC",2/(Math.log(e.far+1)/Math.LN2)),e!==ve&&(ve=e,s=!0,l=!0),n.isShaderMaterial||n.isMeshPhongMaterial||n.isMeshStandardMaterial||n.envMap){var h=c.map.cameraPosition;void 0!==h&&h.setValue(Ke,Ge.setFromMatrixPosition(e.matrixWorld))}(n.isMeshPhongMaterial||n.isMeshLambertMaterial||n.isMeshBasicMaterial||n.isMeshStandardMaterial||n.isShaderMaterial||n.skinning)&&c.setValue(Ke,"viewMatrix",e.matrixWorldInverse),c.set(Ke,ce,"toneMappingExposure"),c.set(Ke,ce,"toneMappingWhitePoint")}if(n.skinning){c.setOptional(Ke,r,"bindMatrix"),c.setOptional(Ke,r,"bindMatrixInverse");var f=r.skeleton;f&&($e.floatVertexTextures&&f.useVertexTexture?(c.set(Ke,f,"boneTexture"),c.set(Ke,f,"boneTextureWidth"),c.set(Ke,f,"boneTextureHeight")):c.setOptional(Ke,f,"boneMatrices"))}return s&&(n.lights&&I(d,l),t&&n.fog&&O(d,t),(n.isMeshBasicMaterial||n.isMeshLambertMaterial||n.isMeshPhongMaterial||n.isMeshStandardMaterial||n.isMeshNormalMaterial||n.isMeshDepthMaterial)&&S(d,n),n.isLineBasicMaterial?E(d,n):n.isLineDashedMaterial?(E(d,n),T(d,n)):n.isPointsMaterial?k(d,n):n.isMeshLambertMaterial?C(d,n):n.isMeshToonMaterial?A(d,n):n.isMeshPhongMaterial?P(d,n):n.isMeshPhysicalMaterial?L(d,n):n.isMeshStandardMaterial?R(d,n):n.isMeshDepthMaterial?n.displacementMap&&(d.displacementMap.value=n.displacementMap,d.displacementScale.value=n.displacementScale,d.displacementBias.value=n.displacementBias):n.isMeshNormalMaterial&&D(d,n),void 0!==d.ltcMat&&(d.ltcMat.value=THREE.UniformsLib.LTC_MAT_TEXTURE),void 0!==d.ltcMag&&(d.ltcMag.value=THREE.UniformsLib.LTC_MAG_TEXTURE),Y.upload(Ke,i.uniformsList,d,ce)),c.set(Ke,r,"modelViewMatrix"),c.set(Ke,r,"normalMatrix"),c.setValue(Ke,"modelMatrix",r.matrixWorld),u}function S(e,t){e.opacity.value=t.opacity,e.diffuse.value=t.color,t.emissive&&e.emissive.value.copy(t.emissive).multiplyScalar(t.emissiveIntensity),e.map.value=t.map,e.specularMap.value=t.specularMap,e.alphaMap.value=t.alphaMap,t.lightMap&&(e.lightMap.value=t.lightMap,e.lightMapIntensity.value=t.lightMapIntensity),t.aoMap&&(e.aoMap.value=t.aoMap,e.aoMapIntensity.value=t.aoMapIntensity);var n;if(t.map?n=t.map:t.specularMap?n=t.specularMap:t.displacementMap?n=t.displacementMap:t.normalMap?n=t.normalMap:t.bumpMap?n=t.bumpMap:t.roughnessMap?n=t.roughnessMap:t.metalnessMap?n=t.metalnessMap:t.alphaMap?n=t.alphaMap:t.emissiveMap&&(n=t.emissiveMap),void 0!==n){n.isWebGLRenderTarget&&(n=n.texture);var r=n.offset,i=n.repeat;e.offsetRepeat.value.set(r.x,r.y,i.x,i.y)}e.envMap.value=t.envMap,e.flipEnvMap.value=t.envMap&&t.envMap.isCubeTexture?-1:1,e.reflectivity.value=t.reflectivity,e.refractionRatio.value=t.refractionRatio}function E(e,t){e.diffuse.value=t.color,e.opacity.value=t.opacity}function T(e,t){e.dashSize.value=t.dashSize,e.totalSize.value=t.dashSize+t.gapSize,e.scale.value=t.scale}function k(e,t){if(e.diffuse.value=t.color,e.opacity.value=t.opacity,e.size.value=t.size*Te,e.scale.value=.5*Ee,e.map.value=t.map,null!==t.map){var n=t.map.offset,r=t.map.repeat;e.offsetRepeat.value.set(n.x,n.y,r.x,r.y)}}function O(e,t){e.fogColor.value=t.color,t.isFog?(e.fogNear.value=t.near,e.fogFar.value=t.far):t.isFogExp2&&(e.fogDensity.value=t.density)}function C(e,t){t.emissiveMap&&(e.emissiveMap.value=t.emissiveMap)}function P(e,t){e.specular.value=t.specular,e.shininess.value=Math.max(t.shininess,1e-4),t.emissiveMap&&(e.emissiveMap.value=t.emissiveMap),t.bumpMap&&(e.bumpMap.value=t.bumpMap,e.bumpScale.value=t.bumpScale),t.normalMap&&(e.normalMap.value=t.normalMap,e.normalScale.value.copy(t.normalScale)),t.displacementMap&&(e.displacementMap.value=t.displacementMap,e.displacementScale.value=t.displacementScale,e.displacementBias.value=t.displacementBias)}function A(e,t){P(e,t),t.gradientMap&&(e.gradientMap.value=t.gradientMap)}function R(e,t){e.roughness.value=t.roughness,e.metalness.value=t.metalness,t.roughnessMap&&(e.roughnessMap.value=t.roughnessMap),t.metalnessMap&&(e.metalnessMap.value=t.metalnessMap),t.emissiveMap&&(e.emissiveMap.value=t.emissiveMap),t.bumpMap&&(e.bumpMap.value=t.bumpMap,e.bumpScale.value=t.bumpScale),t.normalMap&&(e.normalMap.value=t.normalMap,e.normalScale.value.copy(t.normalScale)),t.displacementMap&&(e.displacementMap.value=t.displacementMap,e.displacementScale.value=t.displacementScale,e.displacementBias.value=t.displacementBias),t.envMap&&(e.envMapIntensity.value=t.envMapIntensity)}function L(e,t){e.clearCoat.value=t.clearCoat,e.clearCoatRoughness.value=t.clearCoatRoughness,R(e,t)}function D(e,t){t.bumpMap&&(e.bumpMap.value=t.bumpMap,e.bumpScale.value=t.bumpScale),t.normalMap&&(e.normalMap.value=t.normalMap,e.normalScale.value.copy(t.normalScale)),t.displacementMap&&(e.displacementMap.value=t.displacementMap,e.displacementScale.value=t.displacementScale,e.displacementBias.value=t.displacementBias)}function I(e,t){e.ambientLightColor.needsUpdate=t,e.directionalLights.needsUpdate=t,e.pointLights.needsUpdate=t,e.spotLights.needsUpdate=t,e.rectAreaLights.needsUpdate=t,e.hemisphereLights.needsUpdate=t}function z(e){for(var t=0,n=0,r=e.length;n=$e.maxTextures&&console.warn("WebGLRenderer: trying to use "+e+" texture units while this GPU supports only "+$e.maxTextures),_e+=1,e}function F(e){var t;if(e===sa)return Ke.REPEAT;if(e===la)return Ke.CLAMP_TO_EDGE;if(e===ua)return Ke.MIRRORED_REPEAT;if(e===ca)return Ke.NEAREST;if(e===da)return Ke.NEAREST_MIPMAP_NEAREST;if(e===ha)return Ke.NEAREST_MIPMAP_LINEAR;if(e===fa)return Ke.LINEAR;if(e===pa)return Ke.LINEAR_MIPMAP_NEAREST;if(e===ma)return Ke.LINEAR_MIPMAP_LINEAR;if(e===ga)return Ke.UNSIGNED_BYTE;if(e===Sa)return Ke.UNSIGNED_SHORT_4_4_4_4;if(e===Ea)return Ke.UNSIGNED_SHORT_5_5_5_1;if(e===Ta)return Ke.UNSIGNED_SHORT_5_6_5;if(e===va)return Ke.BYTE;if(e===ya)return Ke.SHORT;if(e===ba)return Ke.UNSIGNED_SHORT;if(e===xa)return Ke.INT;if(e===_a)return Ke.UNSIGNED_INT;if(e===wa)return Ke.FLOAT;if(e===Ma&&null!==(t=Qe.get("OES_texture_half_float")))return t.HALF_FLOAT_OES;if(e===Oa)return Ke.ALPHA;if(e===Ca)return Ke.RGB;if(e===Pa)return Ke.RGBA;if(e===Aa)return Ke.LUMINANCE;if(e===Ra)return Ke.LUMINANCE_ALPHA;if(e===Da)return Ke.DEPTH_COMPONENT;if(e===Ia)return Ke.DEPTH_STENCIL;if(e===_o)return Ke.FUNC_ADD;if(e===wo)return Ke.FUNC_SUBTRACT;if(e===Mo)return Ke.FUNC_REVERSE_SUBTRACT;if(e===To)return Ke.ZERO;if(e===ko)return Ke.ONE;if(e===Oo)return Ke.SRC_COLOR;if(e===Co)return Ke.ONE_MINUS_SRC_COLOR;if(e===Po)return Ke.SRC_ALPHA;if(e===Ao)return Ke.ONE_MINUS_SRC_ALPHA;if(e===Ro)return Ke.DST_ALPHA;if(e===Lo)return Ke.ONE_MINUS_DST_ALPHA;if(e===Do)return Ke.DST_COLOR;if(e===Io)return Ke.ONE_MINUS_DST_COLOR;if(e===zo)return Ke.SRC_ALPHA_SATURATE;if((e===za||e===Na||e===Ba||e===Fa)&&null!==(t=Qe.get("WEBGL_compressed_texture_s3tc"))){if(e===za)return t.COMPRESSED_RGB_S3TC_DXT1_EXT;if(e===Na)return t.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(e===Ba)return t.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(e===Fa)return t.COMPRESSED_RGBA_S3TC_DXT5_EXT}if((e===Ua||e===ja||e===Wa||e===Va)&&null!==(t=Qe.get("WEBGL_compressed_texture_pvrtc"))){if(e===Ua)return t.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(e===ja)return t.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(e===Wa)return t.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(e===Va)return t.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}if(e===Ha&&null!==(t=Qe.get("WEBGL_compressed_texture_etc1")))return t.COMPRESSED_RGB_ETC1_WEBGL;if((e===So||e===Eo)&&null!==(t=Qe.get("EXT_blend_minmax"))){if(e===So)return t.MIN_EXT;if(e===Eo)return t.MAX_EXT}return e===ka&&null!==(t=Qe.get("WEBGL_depth_texture"))?t.UNSIGNED_INT_24_8_WEBGL:0}console.log("THREE.WebGLRenderer",Zi),e=e||{};var U=void 0!==e.canvas?e.canvas:document.createElementNS("http://www.w3.org/1999/xhtml","canvas"),j=void 0!==e.context?e.context:null,W=void 0!==e.alpha&&e.alpha,V=void 0===e.depth||e.depth,H=void 0===e.stencil||e.stencil,G=void 0!==e.antialias&&e.antialias,X=void 0===e.premultipliedAlpha||e.premultipliedAlpha,Z=void 0!==e.preserveDrawingBuffer&&e.preserveDrawingBuffer,Q=[],ee=[],te=-1,re=[],ie=-1,se=new Float32Array(8),le=[],ue=[];this.domElement=U,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 ce=this,de=null,he=null,fe=null,me=-1,ge="",ve=null,ye=new a,be=null,xe=new a,_e=0,we=new q(0),Me=0,Se=U.width,Ee=U.height,Te=1,ke=new a(0,0,Se,Ee),Oe=!1,Ae=new a(0,0,Se,Ee),Le=new oe,Ie=new ut,je=!1,We=!1,Ve=new ne,He=new d,Ge=new c,Ye=new d,qe=new d,Xe={hash:"",ambient:[0,0,0],directional:[],directionalShadowMap:[],directionalShadowMatrix:[],spot:[],spotShadowMap:[],spotShadowMatrix:[],rectArea:[],point:[],pointShadowMap:[],pointShadowMatrix:[],hemi:[],shadows:[]},Ze={calls:0,vertices:0,faces:0,points:0};this.info={render:Ze,memory:{geometries:0,textures:0},programs:null};var Ke;try{var Je={alpha:W,depth:V,stencil:H,antialias:G,premultipliedAlpha:X,preserveDrawingBuffer:Z};if(null===(Ke=j||U.getContext("webgl",Je)||U.getContext("experimental-webgl",Je)))throw null!==U.getContext("webgl")?"Error creating WebGL context with your selected attributes.":"Error creating WebGL context.";void 0===Ke.getShaderPrecisionFormat&&(Ke.getShaderPrecisionFormat=function(){return{rangeMin:1,rangeMax:1,precision:1}}),U.addEventListener("webglcontextlost",i,!1)}catch(e){console.error("THREE.WebGLRenderer: "+e)}var Qe=new lt(Ke);Qe.get("WEBGL_depth_texture"),Qe.get("OES_texture_float"),Qe.get("OES_texture_float_linear"),Qe.get("OES_texture_half_float"),Qe.get("OES_texture_half_float_linear"),Qe.get("OES_standard_derivatives"),Qe.get("ANGLE_instanced_arrays"),Qe.get("OES_element_index_uint")&&(Ce.MaxIndex=4294967296);var $e=new st(Ke,Qe,e),et=new at(Ke,Qe,F),nt=new ot,ct=new it(Ke,Qe,et,nt,$e,F,this.info),dt=new rt(Ke,nt,this.info),ht=new tt(this,$e),ft=new Ue;this.info.programs=ht.programs;var pt,mt,gt,vt,yt=new Fe(Ke,Qe,Ze),bt=new Be(Ke,Qe,Ze);n(),this.context=Ke,this.capabilities=$e,this.extensions=Qe,this.properties=nt,this.state=et;var xt=new ae(this,Xe,dt,$e);this.shadowMap=xt;var _t=new J(this,le),wt=new K(this,ue);this.getContext=function(){return Ke},this.getContextAttributes=function(){return Ke.getContextAttributes()},this.forceContextLoss=function(){Qe.get("WEBGL_lose_context").loseContext()},this.getMaxAnisotropy=function(){return $e.getMaxAnisotropy()},this.getPrecision=function(){return $e.precision},this.getPixelRatio=function(){return Te},this.setPixelRatio=function(e){void 0!==e&&(Te=e,this.setSize(Ae.z,Ae.w,!1))},this.getSize=function(){return{width:Se,height:Ee}},this.setSize=function(e,t,n){Se=e,Ee=t,U.width=e*Te,U.height=t*Te,!1!==n&&(U.style.width=e+"px",U.style.height=t+"px"),this.setViewport(0,0,e,t)},this.setViewport=function(e,t,n,r){et.viewport(Ae.set(e,t,n,r))},this.setScissor=function(e,t,n,r){et.scissor(ke.set(e,t,n,r))},this.setScissorTest=function(e){et.setScissorTest(Oe=e)},this.getClearColor=function(){return we},this.setClearColor=function(e,t){we.set(e),Me=void 0!==t?t:1,et.buffers.color.setClear(we.r,we.g,we.b,Me,X)},this.getClearAlpha=function(){return Me},this.setClearAlpha=function(e){Me=e,et.buffers.color.setClear(we.r,we.g,we.b,Me,X)},this.clear=function(e,t,n){var r=0;(void 0===e||e)&&(r|=Ke.COLOR_BUFFER_BIT),(void 0===t||t)&&(r|=Ke.DEPTH_BUFFER_BIT),(void 0===n||n)&&(r|=Ke.STENCIL_BUFFER_BIT),Ke.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(e,t,n,r){this.setRenderTarget(e),this.clear(t,n,r)},this.resetGLState=r,this.dispose=function(){re=[],ie=-1,ee=[],te=-1,U.removeEventListener("webglcontextlost",i,!1)},this.renderBufferImmediate=function(e,t,n){et.initAttributes();var r=nt.get(e);e.hasPositions&&!r.position&&(r.position=Ke.createBuffer()),e.hasNormals&&!r.normal&&(r.normal=Ke.createBuffer()),e.hasUvs&&!r.uv&&(r.uv=Ke.createBuffer()),e.hasColors&&!r.color&&(r.color=Ke.createBuffer());var i=t.getAttributes();if(e.hasPositions&&(Ke.bindBuffer(Ke.ARRAY_BUFFER,r.position),Ke.bufferData(Ke.ARRAY_BUFFER,e.positionArray,Ke.DYNAMIC_DRAW),et.enableAttribute(i.position),Ke.vertexAttribPointer(i.position,3,Ke.FLOAT,!1,0,0)),e.hasNormals){if(Ke.bindBuffer(Ke.ARRAY_BUFFER,r.normal),!n.isMeshPhongMaterial&&!n.isMeshStandardMaterial&&!n.isMeshNormalMaterial&&n.shading===uo)for(var o=0,a=3*e.count;o8&&(f.length=8);for(var v=r.morphAttributes,p=0,m=f.length;p0&&S.renderInstances(r,P,R):S.render(P,R)}},this.render=function(e,t,n,r){if(void 0!==t&&!0!==t.isCamera)return void console.error("THREE.WebGLRenderer.render: camera is not an instance of THREE.Camera.");ge="",me=-1,ve=null,!0===e.autoUpdate&&e.updateMatrixWorld(),null===t.parent&&t.updateMatrixWorld(),t.matrixWorldInverse.getInverse(t.matrixWorld),He.multiplyMatrices(t.projectionMatrix,t.matrixWorldInverse),Le.setFromMatrix(He),Q.length=0,te=-1,ie=-1,le.length=0,ue.length=0,We=this.localClippingEnabled,je=Ie.init(this.clippingPlanes,We,t),b(e,t),ee.length=te+1,re.length=ie+1,!0===ce.sortObjects&&(ee.sort(f),re.sort(p)),je&&Ie.beginShadows(),z(Q),xt.render(e,t),N(Q,t),je&&Ie.endShadows(),Ze.calls=0,Ze.vertices=0,Ze.faces=0,Ze.points=0,void 0===n&&(n=null),this.setRenderTarget(n);var i=e.background;if(null===i?et.buffers.color.setClear(we.r,we.g,we.b,Me,X):i&&i.isColor&&(et.buffers.color.setClear(i.r,i.g,i.b,1,X),r=!0),(this.autoClear||r)&&this.clear(this.autoClearColor,this.autoClearDepth,this.autoClearStencil),i&&i.isCubeTexture?(void 0===gt&&(gt=new ze,vt=new Pe(new Re(5,5,5),new $({uniforms:Ss.cube.uniforms,vertexShader:Ss.cube.vertexShader,fragmentShader:Ss.cube.fragmentShader,side:so,depthTest:!1,depthWrite:!1,fog:!1}))),gt.projectionMatrix.copy(t.projectionMatrix),gt.matrixWorld.extractRotation(t.matrixWorld),gt.matrixWorldInverse.getInverse(gt.matrixWorld),vt.material.uniforms.tCube.value=i,vt.modelViewMatrix.multiplyMatrices(gt.matrixWorldInverse,vt.matrixWorld),dt.update(vt),ce.renderBufferDirect(gt,null,vt.geometry,vt.material,vt,null)):i&&i.isTexture&&(void 0===pt&&(pt=new Ne(-1,1,1,-1,0,1),mt=new Pe(new De(2,2),new pe({depthTest:!1,depthWrite:!1,fog:!1}))),mt.material.map=i,dt.update(mt),ce.renderBufferDirect(pt,null,mt.geometry,mt.material,mt,null)),e.overrideMaterial){var o=e.overrideMaterial;x(ee,e,t,o),x(re,e,t,o)}else et.setBlending(mo),x(ee,e,t),x(re,e,t);_t.render(e,t),wt.render(e,t,xe),n&&ct.updateRenderTargetMipmap(n),et.setDepthTest(!0),et.setDepthWrite(!0),et.setColorWrite(!0)},this.setFaceCulling=function(e,t){et.setCullFace(e),et.setFlipSided(t===to)},this.allocTextureUnit=B,this.setTexture2D=function(){var e=!1;return function(t,n){t&&t.isWebGLRenderTarget&&(e||(console.warn("THREE.WebGLRenderer.setTexture2D: don't use render targets as textures. Use their .texture property instead."),e=!0),t=t.texture),ct.setTexture2D(t,n)}}(),this.setTexture=function(){var e=!1;return function(t,n){e||(console.warn("THREE.WebGLRenderer: .setTexture is deprecated, use setTexture2D instead."),e=!0),ct.setTexture2D(t,n)}}(),this.setTextureCube=function(){var e=!1;return function(t,n){t&&t.isWebGLRenderTargetCube&&(e||(console.warn("THREE.WebGLRenderer.setTextureCube: don't use cube render targets as textures. Use their .texture property instead."),e=!0),t=t.texture),t&&t.isCubeTexture||Array.isArray(t.image)&&6===t.image.length?ct.setTextureCube(t,n):ct.setTextureCubeDynamic(t,n)}}(),this.getCurrentRenderTarget=function(){return he},this.setRenderTarget=function(e){he=e,e&&void 0===nt.get(e).__webglFramebuffer&&ct.setupRenderTarget(e);var t,n=e&&e.isWebGLRenderTargetCube;if(e){var r=nt.get(e);t=n?r.__webglFramebuffer[e.activeCubeFace]:r.__webglFramebuffer,ye.copy(e.scissor),be=e.scissorTest,xe.copy(e.viewport)}else t=null,ye.copy(ke).multiplyScalar(Te),be=Oe,xe.copy(Ae).multiplyScalar(Te);if(fe!==t&&(Ke.bindFramebuffer(Ke.FRAMEBUFFER,t),fe=t),et.scissor(ye),et.setScissorTest(be),et.viewport(xe),n){var i=nt.get(e.texture);Ke.framebufferTexture2D(Ke.FRAMEBUFFER,Ke.COLOR_ATTACHMENT0,Ke.TEXTURE_CUBE_MAP_POSITIVE_X+e.activeCubeFace,i.__webglTexture,e.activeMipMapLevel)}},this.readRenderTargetPixels=function(e,t,n,r,i,o){if(!1===(e&&e.isWebGLRenderTarget))return void console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");var a=nt.get(e).__webglFramebuffer;if(a){var s=!1;a!==fe&&(Ke.bindFramebuffer(Ke.FRAMEBUFFER,a),s=!0);try{var l=e.texture,u=l.format,c=l.type;if(u!==Pa&&F(u)!==Ke.getParameter(Ke.IMPLEMENTATION_COLOR_READ_FORMAT))return void console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.");if(!(c===ga||F(c)===Ke.getParameter(Ke.IMPLEMENTATION_COLOR_READ_TYPE)||c===wa&&(Qe.get("OES_texture_float")||Qe.get("WEBGL_color_buffer_float"))||c===Ma&&Qe.get("EXT_color_buffer_half_float")))return void console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.");Ke.checkFramebufferStatus(Ke.FRAMEBUFFER)===Ke.FRAMEBUFFER_COMPLETE?t>=0&&t<=e.width-r&&n>=0&&n<=e.height-i&&Ke.readPixels(t,n,r,i,F(u),F(c),o):console.error("THREE.WebGLRenderer.readRenderTargetPixels: readPixels from renderTarget failed. Framebuffer not complete.")}finally{s&&Ke.bindFramebuffer(Ke.FRAMEBUFFER,fe)}}}}function dt(e,t){this.name="",this.color=new q(e),this.density=void 0!==t?t:25e-5}function ht(e,t,n){this.name="",this.color=new q(e),this.near=void 0!==t?t:1,this.far=void 0!==n?n:1e3}function ft(){ce.call(this),this.type="Scene",this.background=null,this.fog=null,this.overrideMaterial=null,this.autoUpdate=!0}function pt(e,t,n,r,i){ce.call(this),this.lensFlares=[],this.positionScreen=new c,this.customUpdateCallback=void 0,void 0!==e&&this.add(e,t,n,r,i)}function mt(e){Q.call(this),this.type="SpriteMaterial",this.color=new q(16777215),this.map=null,this.rotation=0,this.fog=!1,this.lights=!1,this.setValues(e)}function gt(e){ce.call(this),this.type="Sprite",this.material=void 0!==e?e:new mt}function vt(){ce.call(this),this.type="LOD",Object.defineProperties(this,{levels:{enumerable:!0,value:[]}})}function yt(e,t,n){if(this.useVertexTexture=void 0===n||n,this.identityMatrix=new d,e=e||[],this.bones=e.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 X(this.boneMatrices,this.boneTextureWidth,this.boneTextureHeight,Pa,wa)}else this.boneMatrices=new Float32Array(16*this.bones.length);if(void 0===t)this.calculateInverses();else if(this.bones.length===t.length)this.boneInverses=t.slice(0);else{console.warn("THREE.Skeleton bonInverses is the wrong length."),this.boneInverses=[];for(var i=0,o=this.bones.length;i=e.HAVE_CURRENT_DATA&&(d.needsUpdate=!0)}o.call(this,e,t,n,r,i,a,s,l,u),this.generateMipmaps=!1;var d=this;c()}function Ot(e,t,n,r,i,a,s,l,u,c,d,h){o.call(this,null,a,s,l,u,c,r,i,d,h),this.image={width:t,height:n},this.mipmaps=e,this.flipY=!1,this.generateMipmaps=!1}function Ct(e,t,n,r,i,a,s,l,u){o.call(this,e,t,n,r,i,a,s,l,u),this.needsUpdate=!0}function Pt(e,t,n,r,i,a,s,l,u,c){if((c=void 0!==c?c:Da)!==Da&&c!==Ia)throw new Error("DepthTexture format must be either THREE.DepthFormat or THREE.DepthStencilFormat");void 0===n&&c===Da&&(n=ba),void 0===n&&c===Ia&&(n=ka),o.call(this,null,r,i,a,s,l,c,n,u),this.image={width:e,height:t},this.magFilter=void 0!==s?s:ca,this.minFilter=void 0!==l?l:ca,this.flipY=!1,this.generateMipmaps=!1}function At(e){function t(e,t){return e-t}Ce.call(this),this.type="WireframeGeometry";var n,r,i,o,a,s,l,u,d=[],h=[0,0],f={},p=["a","b","c"];if(e&&e.isGeometry){var m=e.faces;for(n=0,i=m.length;n.9&&o<.1&&(t<.2&&(m[e+0]+=1),n<.2&&(m[e+2]+=1),r<.2&&(m[e+4]+=1))}}function s(e){p.push(e.x,e.y,e.z)}function l(t,n){var r=3*t;n.x=e[r+0],n.y=e[r+1],n.z=e[r+2]}function u(){for(var e=new c,t=new c,n=new c,r=new c,o=new i,a=new i,s=new i,l=0,u=0;l0)&&m.push(w,M,E),(l!==n-1||u0&&u(!0),t>0&&u(!1)),this.setIndex(h),this.addAttribute("position",new Me(f,3)),this.addAttribute("normal",new Me(p,3)),this.addAttribute("uv",new Me(m,2))}function cn(e,t,n,r,i,o,a){ln.call(this,0,e,t,n,r,i,o,a),this.type="ConeGeometry",this.parameters={radius:e,height:t,radialSegments:n,heightSegments:r,openEnded:i,thetaStart:o,thetaLength:a}}function dn(e,t,n,r,i,o,a){un.call(this,0,e,t,n,r,i,o,a),this.type="ConeBufferGeometry",this.parameters={radius:e,height:t,radialSegments:n,heightSegments:r,openEnded:i,thetaStart:o,thetaLength:a}}function hn(e,t,n,r){Oe.call(this),this.type="CircleGeometry",this.parameters={radius:e,segments:t,thetaStart:n,thetaLength:r},this.fromBufferGeometry(new fn(e,t,n,r))}function fn(e,t,n,r){Ce.call(this),this.type="CircleBufferGeometry",this.parameters={radius:e,segments:t,thetaStart:n,thetaLength:r},e=e||50,t=void 0!==t?Math.max(3,t):8,n=void 0!==n?n:0,r=void 0!==r?r:2*Math.PI;var o,a,s=[],l=[],u=[],d=[],h=new c,f=new i;for(l.push(0,0,0),u.push(0,0,1),d.push(.5,.5),a=0,o=3;a<=t;a++,o+=3){var p=n+a/t*r;h.x=e*Math.cos(p),h.y=e*Math.sin(p),l.push(h.x,h.y,h.z),u.push(0,0,1),f.x=(l[o]/e+1)/2,f.y=(l[o+1]/e+1)/2,d.push(f.x,f.y)}for(o=1;o<=t;o++)s.push(o,o+1,0);this.setIndex(s),this.addAttribute("position",new Me(l,3)),this.addAttribute("normal",new Me(u,3)),this.addAttribute("uv",new Me(d,2))}function pn(){$.call(this,{uniforms:xs.merge([Ms.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(e){this.uniforms.opacity.value=e}}})}function mn(e){$.call(this,e),this.type="RawShaderMaterial"}function gn(e){this.uuid=fs.generateUUID(),this.type="MultiMaterial",this.materials=Array.isArray(e)?e:[],this.visible=!0}function vn(e){Q.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(e)}function yn(e){vn.call(this),this.defines={PHYSICAL:""},this.type="MeshPhysicalMaterial",this.reflectivity=.5,this.clearCoat=0,this.clearCoatRoughness=0,this.setValues(e)}function bn(e){Q.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=Go,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.skinning=!1,this.morphTargets=!1,this.morphNormals=!1,this.setValues(e)}function xn(e){bn.call(this),this.defines={TOON:""},this.type="MeshToonMaterial",this.gradientMap=null,this.setValues(e)}function _n(e){Q.call(this,e),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(e)}function wn(e){Q.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=Go,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.skinning=!1,this.morphTargets=!1,this.morphNormals=!1,this.setValues(e)}function Mn(e){Q.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(e)}function Sn(e,t,n){var r=this,i=!1,o=0,a=0;this.onStart=void 0,this.onLoad=e,this.onProgress=t,this.onError=n,this.itemStart=function(e){a++,!1===i&&void 0!==r.onStart&&r.onStart(e,o,a),i=!0},this.itemEnd=function(e){o++,void 0!==r.onProgress&&r.onProgress(e,o,a),o===a&&(i=!1,void 0!==r.onLoad&&r.onLoad())},this.itemError=function(e){void 0!==r.onError&&r.onError(e)}}function En(e){this.manager=void 0!==e?e:Ls}function Tn(e){this.manager=void 0!==e?e:Ls,this._parser=null}function kn(e){this.manager=void 0!==e?e:Ls,this._parser=null}function On(e){this.manager=void 0!==e?e:Ls}function Cn(e){this.manager=void 0!==e?e:Ls}function Pn(e){this.manager=void 0!==e?e:Ls}function An(e,t){ce.call(this),this.type="Light",this.color=new q(e),this.intensity=void 0!==t?t:1,this.receiveShadow=void 0}function Rn(e,t,n){An.call(this,e,n),this.type="HemisphereLight",this.castShadow=void 0,this.position.copy(ce.DefaultUp),this.updateMatrix(),this.groundColor=new q(t)}function Ln(e){this.camera=e,this.bias=0,this.radius=1,this.mapSize=new i(512,512),this.map=null,this.matrix=new d}function Dn(){Ln.call(this,new ze(50,1,.5,500))}function In(e,t,n,r,i,o){An.call(this,e,t),this.type="SpotLight",this.position.copy(ce.DefaultUp),this.updateMatrix(),this.target=new ce,Object.defineProperty(this,"power",{get:function(){return this.intensity*Math.PI},set:function(e){this.intensity=e/Math.PI}}),this.distance=void 0!==n?n:0,this.angle=void 0!==r?r:Math.PI/3,this.penumbra=void 0!==i?i:0,this.decay=void 0!==o?o:1,this.shadow=new Dn}function zn(e,t,n,r){An.call(this,e,t),this.type="PointLight",Object.defineProperty(this,"power",{get:function(){return 4*this.intensity*Math.PI},set:function(e){this.intensity=e/(4*Math.PI)}}),this.distance=void 0!==n?n:0,this.decay=void 0!==r?r:1,this.shadow=new Ln(new ze(90,1,.5,500))}function Nn(){Ln.call(this,new Ne(-5,5,5,-5,.5,500))}function Bn(e,t){An.call(this,e,t),this.type="DirectionalLight",this.position.copy(ce.DefaultUp),this.updateMatrix(),this.target=new ce,this.shadow=new Nn}function Fn(e,t){An.call(this,e,t),this.type="AmbientLight",this.castShadow=void 0}function Un(e,t,n,r){this.parameterPositions=e,this._cachedIndex=0,this.resultBuffer=void 0!==r?r:new t.constructor(n),this.sampleValues=t,this.valueSize=n}function jn(e,t,n,r){Un.call(this,e,t,n,r),this._weightPrev=-0,this._offsetPrev=-0,this._weightNext=-0,this._offsetNext=-0}function Wn(e,t,n,r){Un.call(this,e,t,n,r)}function Vn(e,t,n,r){Un.call(this,e,t,n,r)}function Hn(e,t,n,r){if(void 0===e)throw new Error("track name is undefined");if(void 0===t||0===t.length)throw new Error("no keyframes in track named "+e);this.name=e,this.times=Ds.convertArray(t,this.TimeBufferType),this.values=Ds.convertArray(n,this.ValueBufferType),this.setInterpolation(r||this.DefaultInterpolation),this.validate(),this.optimize()}function Gn(e,t,n,r){Hn.call(this,e,t,n,r)}function Yn(e,t,n,r){Un.call(this,e,t,n,r)}function qn(e,t,n,r){Hn.call(this,e,t,n,r)}function Xn(e,t,n,r){Hn.call(this,e,t,n,r)}function Zn(e,t,n,r){Hn.call(this,e,t,n,r)}function Kn(e,t,n){Hn.call(this,e,t,n)}function Jn(e,t,n,r){Hn.call(this,e,t,n,r)}function Qn(e,t,n,r){Hn.apply(this,arguments)}function $n(e,t,n){this.name=e,this.tracks=n,this.duration=void 0!==t?t:-1,this.uuid=fs.generateUUID(),this.duration<0&&this.resetDuration(),this.optimize()}function er(e){this.manager=void 0!==e?e:Ls,this.textures={}}function tr(e){this.manager=void 0!==e?e:Ls}function nr(){this.onLoadStart=function(){},this.onLoadProgress=function(){},this.onLoadComplete=function(){}}function rr(e){"boolean"==typeof e&&(console.warn("THREE.JSONLoader: showStatus parameter has been removed from constructor."),e=void 0),this.manager=void 0!==e?e:Ls,this.withCredentials=!1}function ir(e){this.manager=void 0!==e?e:Ls,this.texturePath=""}function or(e,t,n,r,i){var o=.5*(r-t),a=.5*(i-n),s=e*e;return(2*n-2*r+o+a)*(e*s)+(-3*n+3*r-2*o-a)*s+o*e+n}function ar(e,t){var n=1-e;return n*n*t}function sr(e,t){return 2*(1-e)*e*t}function lr(e,t){return e*e*t}function ur(e,t,n,r){return ar(e,t)+sr(e,n)+lr(e,r)}function cr(e,t){var n=1-e;return n*n*n*t}function dr(e,t){var n=1-e;return 3*n*n*e*t}function hr(e,t){return 3*(1-e)*e*e*t}function fr(e,t){return e*e*e*t}function pr(e,t,n,r,i){return cr(e,t)+dr(e,n)+hr(e,r)+fr(e,i)}function mr(){}function gr(e,t){this.v1=e,this.v2=t}function vr(){this.curves=[],this.autoClose=!1}function yr(e,t,n,r,i,o,a,s){this.aX=e,this.aY=t,this.xRadius=n,this.yRadius=r,this.aStartAngle=i,this.aEndAngle=o,this.aClockwise=a,this.aRotation=s||0}function br(e){this.points=void 0===e?[]:e}function xr(e,t,n,r){this.v0=e,this.v1=t,this.v2=n,this.v3=r}function _r(e,t,n){this.v0=e,this.v1=t,this.v2=n}function wr(e){vr.call(this),this.currentPoint=new i,e&&this.fromPoints(e)}function Mr(){wr.apply(this,arguments),this.holes=[]}function Sr(){this.subPaths=[],this.currentPath=null}function Er(e){this.data=e}function Tr(e){this.manager=void 0!==e?e:Ls}function kr(e){this.manager=void 0!==e?e:Ls}function Or(e,t,n,r){An.call(this,e,t),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 Cr(){this.type="StereoCamera",this.aspect=1,this.eyeSep=.064,this.cameraL=new ze,this.cameraL.layers.enable(1),this.cameraL.matrixAutoUpdate=!1,this.cameraR=new ze,this.cameraR.layers.enable(2),this.cameraR.matrixAutoUpdate=!1}function Pr(e,t,n){ce.call(this),this.type="CubeCamera";var r=new ze(90,1,e,t);r.up.set(0,-1,0),r.lookAt(new c(1,0,0)),this.add(r);var i=new ze(90,1,e,t);i.up.set(0,-1,0),i.lookAt(new c(-1,0,0)),this.add(i);var o=new ze(90,1,e,t);o.up.set(0,0,1),o.lookAt(new c(0,1,0)),this.add(o);var a=new ze(90,1,e,t);a.up.set(0,0,-1),a.lookAt(new c(0,-1,0)),this.add(a);var s=new ze(90,1,e,t);s.up.set(0,-1,0),s.lookAt(new c(0,0,1)),this.add(s);var u=new ze(90,1,e,t);u.up.set(0,-1,0),u.lookAt(new c(0,0,-1)),this.add(u);var d={format:Ca,magFilter:fa,minFilter:fa};this.renderTarget=new l(n,n,d),this.updateCubeMap=function(e,t){null===this.parent&&this.updateMatrixWorld();var n=this.renderTarget,l=n.texture.generateMipmaps;n.texture.generateMipmaps=!1,n.activeCubeFace=0,e.render(t,r,n),n.activeCubeFace=1,e.render(t,i,n),n.activeCubeFace=2,e.render(t,o,n),n.activeCubeFace=3,e.render(t,a,n),n.activeCubeFace=4,e.render(t,s,n),n.texture.generateMipmaps=l,n.activeCubeFace=5,e.render(t,u,n),e.setRenderTarget(null)}}function Ar(){ce.call(this),this.type="AudioListener",this.context=Bs.getContext(),this.gain=this.context.createGain(),this.gain.connect(this.context.destination),this.filter=null}function Rr(e){ce.call(this),this.type="Audio",this.context=e.context,this.gain=this.context.createGain(),this.gain.connect(e.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 Lr(e){Rr.call(this,e),this.panner=this.context.createPanner(),this.panner.connect(this.gain)}function Dr(e,t){this.analyser=e.context.createAnalyser(),this.analyser.fftSize=void 0!==t?t:2048,this.data=new Uint8Array(this.analyser.frequencyBinCount),e.getOutput().connect(this.analyser)}function Ir(e,t,n){this.binding=e,this.valueSize=n;var r,i=Float64Array;switch(t){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 zr(e,t,n){this.path=t,this.parsedPath=n||zr.parseTrackName(t),this.node=zr.findNode(e,this.parsedPath.nodeName)||e,this.rootNode=e}function Nr(e){this.uuid=fs.generateUUID(),this._objects=Array.prototype.slice.call(arguments),this.nCachedObjects_=0;var t={};this._indicesByUUID=t;for(var n=0,r=arguments.length;n!==r;++n)t[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 Br(e,t,n){this._mixer=e,this._clip=t,this._localRoot=n||null;for(var r=t.tracks,i=r.length,o=new Array(i),a={endingStart:Ja,endingEnd:Ja},s=0;s!==i;++s){var l=r[s].createInterpolant(null);o[s]=l,l.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=Ya,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 Fr(e){this._root=e,this._initMemoryManager(),this._accuIndex=0,this.time=0,this.timeScale=1}function Ur(e){"string"==typeof e&&(console.warn("THREE.Uniform: Type parameter is no longer needed."),e=arguments[1]),this.value=e}function jr(){Ce.call(this),this.type="InstancedBufferGeometry",this.maxInstancedCount=void 0}function Wr(e,t,n,r){this.uuid=fs.generateUUID(),this.data=e,this.itemSize=t,this.offset=n,this.normalized=!0===r}function Vr(e,t){this.uuid=fs.generateUUID(),this.array=e,this.stride=t,this.count=void 0!==e?e.length/t:0,this.dynamic=!1,this.updateRange={offset:0,count:-1},this.onUploadCallback=function(){},this.version=0}function Hr(e,t,n){Vr.call(this,e,t),this.meshPerAttribute=n||1}function Gr(e,t,n){me.call(this,e,t),this.meshPerAttribute=n||1}function Yr(e,t,n,r){this.ray=new se(e,t),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(e,t){return e.distance-t.distance}function Xr(e,t,n,r){if(!1!==e.visible&&(e.raycast(t,n),!0===r))for(var i=e.children,o=0,a=i.length;o0?1:+e}),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(e){if(void 0===e||null===e)throw new TypeError("Cannot convert undefined or null to object");for(var t=Object(e),n=1;n>=4,n[i]=t[19===i?3&e|8:e]);return n.join("")}}(),clamp:function(e,t,n){return Math.max(t,Math.min(n,e))},euclideanModulo:function(e,t){return(e%t+t)%t},mapLinear:function(e,t,n,r,i){return r+(e-t)*(i-r)/(n-t)},lerp:function(e,t,n){return(1-n)*e+n*t},smoothstep:function(e,t,n){return e<=t?0:e>=n?1:(e=(e-t)/(n-t))*e*(3-2*e)},smootherstep:function(e,t,n){return e<=t?0:e>=n?1:(e=(e-t)/(n-t))*e*e*(e*(6*e-15)+10)},randInt:function(e,t){return e+Math.floor(Math.random()*(t-e+1))},randFloat:function(e,t){return e+Math.random()*(t-e)},randFloatSpread:function(e){return e*(.5-Math.random())},degToRad:function(e){return e*fs.DEG2RAD},radToDeg:function(e){return e*fs.RAD2DEG},isPowerOfTwo:function(e){return 0==(e&e-1)&&0!==e},nearestPowerOfTwo:function(e){return Math.pow(2,Math.round(Math.log(e)/Math.LN2))},nextPowerOfTwo:function(e){return e--,e|=e>>1,e|=e>>2,e|=e>>4,e|=e>>8,e|=e>>16,++e}};i.prototype={constructor:i,isVector2:!0,get width(){return this.x},set width(e){this.x=e},get height(){return this.y},set height(e){this.y=e},set:function(e,t){return this.x=e,this.y=t,this},setScalar:function(e){return this.x=e,this.y=e,this},setX:function(e){return this.x=e,this},setY:function(e){return this.y=e,this},setComponent:function(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;default:throw new Error("index is out of range: "+e)}return this},getComponent:function(e){switch(e){case 0:return this.x;case 1:return this.y;default:throw new Error("index is out of range: "+e)}},clone:function(){return new this.constructor(this.x,this.y)},copy:function(e){return this.x=e.x,this.y=e.y,this},add:function(e,t){return void 0!==t?(console.warn("THREE.Vector2: .add() now only accepts one argument. Use .addVectors( a, b ) instead."),this.addVectors(e,t)):(this.x+=e.x,this.y+=e.y,this)},addScalar:function(e){return this.x+=e,this.y+=e,this},addVectors:function(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this},addScaledVector:function(e,t){return this.x+=e.x*t,this.y+=e.y*t,this},sub:function(e,t){return void 0!==t?(console.warn("THREE.Vector2: .sub() now only accepts one argument. Use .subVectors( a, b ) instead."),this.subVectors(e,t)):(this.x-=e.x,this.y-=e.y,this)},subScalar:function(e){return this.x-=e,this.y-=e,this},subVectors:function(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this},multiply:function(e){return this.x*=e.x,this.y*=e.y,this},multiplyScalar:function(e){return isFinite(e)?(this.x*=e,this.y*=e):(this.x=0,this.y=0),this},divide:function(e){return this.x/=e.x,this.y/=e.y,this},divideScalar:function(e){return this.multiplyScalar(1/e)},min:function(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this},max:function(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this},clamp:function(e,t){return this.x=Math.max(e.x,Math.min(t.x,this.x)),this.y=Math.max(e.y,Math.min(t.y,this.y)),this},clampScalar:function(){var e,t;return function(n,r){return void 0===e&&(e=new i,t=new i),e.set(n,n),t.set(r,r),this.clamp(e,t)}}(),clampLength:function(e,t){var n=this.length();return this.multiplyScalar(Math.max(e,Math.min(t,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(e){return this.x*e.x+this.y*e.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 e=Math.atan2(this.y,this.x);return e<0&&(e+=2*Math.PI),e},distanceTo:function(e){return Math.sqrt(this.distanceToSquared(e))},distanceToSquared:function(e){var t=this.x-e.x,n=this.y-e.y;return t*t+n*n},distanceToManhattan:function(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)},setLength:function(e){return this.multiplyScalar(e/this.length())},lerp:function(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this},lerpVectors:function(e,t,n){return this.subVectors(t,e).multiplyScalar(n).add(e)},equals:function(e){return e.x===this.x&&e.y===this.y},fromArray:function(e,t){return void 0===t&&(t=0),this.x=e[t],this.y=e[t+1],this},toArray:function(e,t){return void 0===e&&(e=[]),void 0===t&&(t=0),e[t]=this.x,e[t+1]=this.y,e},fromBufferAttribute:function(e,t,n){return void 0!==n&&console.warn("THREE.Vector2: offset has been removed from .fromBufferAttribute()."),this.x=e.getX(t),this.y=e.getY(t),this},rotateAround:function(e,t){var n=Math.cos(t),r=Math.sin(t),i=this.x-e.x,o=this.y-e.y;return this.x=i*n-o*r+e.x,this.y=i*r+o*n+e.y,this}};var ps=0;o.DEFAULT_IMAGE=void 0,o.DEFAULT_MAPPING=$o,o.prototype={constructor:o,isTexture:!0,set needsUpdate(e){!0===e&&this.version++},clone:function(){return(new this.constructor).copy(this)},copy:function(e){return this.image=e.image,this.mipmaps=e.mipmaps.slice(0),this.mapping=e.mapping,this.wrapS=e.wrapS,this.wrapT=e.wrapT,this.magFilter=e.magFilter,this.minFilter=e.minFilter,this.anisotropy=e.anisotropy,this.format=e.format,this.type=e.type,this.offset.copy(e.offset),this.repeat.copy(e.repeat),this.generateMipmaps=e.generateMipmaps,this.premultiplyAlpha=e.premultiplyAlpha,this.flipY=e.flipY,this.unpackAlignment=e.unpackAlignment,this.encoding=e.encoding,this},toJSON:function(e){if(void 0!==e.textures[this.uuid])return e.textures[this.uuid];var t={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===e.images[n.uuid]&&(e.images[n.uuid]={uuid:n.uuid,url:function(e){var t;return void 0!==e.toDataURL?t=e:(t=document.createElementNS("http://www.w3.org/1999/xhtml","canvas"),t.width=e.width,t.height=e.height,t.getContext("2d").drawImage(e,0,0,e.width,e.height)),t.width>2048||t.height>2048?t.toDataURL("image/jpeg",.6):t.toDataURL("image/png")}(n)}),t.image=n.uuid}return e.textures[this.uuid]=t,t},dispose:function(){this.dispatchEvent({type:"dispose"})},transformUv:function(e){if(this.mapping===$o){if(e.multiply(this.repeat),e.add(this.offset),e.x<0||e.x>1)switch(this.wrapS){case sa:e.x=e.x-Math.floor(e.x);break;case la:e.x=e.x<0?0:1;break;case ua:1===Math.abs(Math.floor(e.x)%2)?e.x=Math.ceil(e.x)-e.x:e.x=e.x-Math.floor(e.x)}if(e.y<0||e.y>1)switch(this.wrapT){case sa:e.y=e.y-Math.floor(e.y);break;case la:e.y=e.y<0?0:1;break;case ua:1===Math.abs(Math.floor(e.y)%2)?e.y=Math.ceil(e.y)-e.y:e.y=e.y-Math.floor(e.y)}this.flipY&&(e.y=1-e.y)}}},Object.assign(o.prototype,r.prototype),a.prototype={constructor:a,isVector4:!0,set:function(e,t,n,r){return this.x=e,this.y=t,this.z=n,this.w=r,this},setScalar:function(e){return this.x=e,this.y=e,this.z=e,this.w=e,this},setX:function(e){return this.x=e,this},setY:function(e){return this.y=e,this},setZ:function(e){return this.z=e,this},setW:function(e){return this.w=e,this},setComponent:function(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;case 2:this.z=t;break;case 3:this.w=t;break;default:throw new Error("index is out of range: "+e)}return this},getComponent:function(e){switch(e){case 0:return this.x;case 1:return this.y;case 2:return this.z;case 3:return this.w;default:throw new Error("index is out of range: "+e)}},clone:function(){return new this.constructor(this.x,this.y,this.z,this.w)},copy:function(e){return this.x=e.x,this.y=e.y,this.z=e.z,this.w=void 0!==e.w?e.w:1,this},add:function(e,t){return void 0!==t?(console.warn("THREE.Vector4: .add() now only accepts one argument. Use .addVectors( a, b ) instead."),this.addVectors(e,t)):(this.x+=e.x,this.y+=e.y,this.z+=e.z,this.w+=e.w,this)},addScalar:function(e){return this.x+=e,this.y+=e,this.z+=e,this.w+=e,this},addVectors:function(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this.z=e.z+t.z,this.w=e.w+t.w,this},addScaledVector:function(e,t){return this.x+=e.x*t,this.y+=e.y*t,this.z+=e.z*t,this.w+=e.w*t,this},sub:function(e,t){return void 0!==t?(console.warn("THREE.Vector4: .sub() now only accepts one argument. Use .subVectors( a, b ) instead."),this.subVectors(e,t)):(this.x-=e.x,this.y-=e.y,this.z-=e.z,this.w-=e.w,this)},subScalar:function(e){return this.x-=e,this.y-=e,this.z-=e,this.w-=e,this},subVectors:function(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this.z=e.z-t.z,this.w=e.w-t.w,this},multiplyScalar:function(e){return isFinite(e)?(this.x*=e,this.y*=e,this.z*=e,this.w*=e):(this.x=0,this.y=0,this.z=0,this.w=0),this},applyMatrix4:function(e){var t=this.x,n=this.y,r=this.z,i=this.w,o=e.elements;return this.x=o[0]*t+o[4]*n+o[8]*r+o[12]*i,this.y=o[1]*t+o[5]*n+o[9]*r+o[13]*i,this.z=o[2]*t+o[6]*n+o[10]*r+o[14]*i,this.w=o[3]*t+o[7]*n+o[11]*r+o[15]*i,this},divideScalar:function(e){return this.multiplyScalar(1/e)},setAxisAngleFromQuaternion:function(e){this.w=2*Math.acos(e.w);var t=Math.sqrt(1-e.w*e.w);return t<1e-4?(this.x=1,this.y=0,this.z=0):(this.x=e.x/t,this.y=e.y/t,this.z=e.z/t),this},setAxisAngleFromRotationMatrix:function(e){var t,n,r,i,o=e.elements,a=o[0],s=o[4],l=o[8],u=o[1],c=o[5],d=o[9],h=o[2],f=o[6],p=o[10];if(Math.abs(s-u)<.01&&Math.abs(l-h)<.01&&Math.abs(d-f)<.01){if(Math.abs(s+u)<.1&&Math.abs(l+h)<.1&&Math.abs(d+f)<.1&&Math.abs(a+c+p-3)<.1)return this.set(1,0,0,0),this;t=Math.PI;var m=(a+1)/2,g=(c+1)/2,v=(p+1)/2,y=(s+u)/4,b=(l+h)/4,x=(d+f)/4;return m>g&&m>v?m<.01?(n=0,r=.707106781,i=.707106781):(n=Math.sqrt(m),r=y/n,i=b/n):g>v?g<.01?(n=.707106781,r=0,i=.707106781):(r=Math.sqrt(g),n=y/r,i=x/r):v<.01?(n=.707106781,r=.707106781,i=0):(i=Math.sqrt(v),n=b/i,r=x/i),this.set(n,r,i,t),this}var _=Math.sqrt((f-d)*(f-d)+(l-h)*(l-h)+(u-s)*(u-s));return Math.abs(_)<.001&&(_=1),this.x=(f-d)/_,this.y=(l-h)/_,this.z=(u-s)/_,this.w=Math.acos((a+c+p-1)/2),this},min:function(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this.z=Math.min(this.z,e.z),this.w=Math.min(this.w,e.w),this},max:function(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this.z=Math.max(this.z,e.z),this.w=Math.max(this.w,e.w),this},clamp:function(e,t){return this.x=Math.max(e.x,Math.min(t.x,this.x)),this.y=Math.max(e.y,Math.min(t.y,this.y)),this.z=Math.max(e.z,Math.min(t.z,this.z)),this.w=Math.max(e.w,Math.min(t.w,this.w)),this},clampScalar:function(){var e,t;return function(n,r){return void 0===e&&(e=new a,t=new a),e.set(n,n,n,n),t.set(r,r,r,r),this.clamp(e,t)}}(),floor:function(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this.w=Math.floor(this.w),this},ceil:function(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this.w=Math.ceil(this.w),this},round:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this.w=Math.round(this.w),this},roundToZero:function(){return this.x=this.x<0?Math.ceil(this.x):Math.floor(this.x),this.y=this.y<0?Math.ceil(this.y):Math.floor(this.y),this.z=this.z<0?Math.ceil(this.z):Math.floor(this.z),this.w=this.w<0?Math.ceil(this.w):Math.floor(this.w),this},negate:function(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this.w=-this.w,this},dot:function(e){return this.x*e.x+this.y*e.y+this.z*e.z+this.w*e.w},lengthSq:function(){return this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)},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(e){return this.multiplyScalar(e/this.length())},lerp:function(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this.z+=(e.z-this.z)*t,this.w+=(e.w-this.w)*t,this},lerpVectors:function(e,t,n){return this.subVectors(t,e).multiplyScalar(n).add(e)},equals:function(e){return e.x===this.x&&e.y===this.y&&e.z===this.z&&e.w===this.w},fromArray:function(e,t){return void 0===t&&(t=0),this.x=e[t],this.y=e[t+1],this.z=e[t+2],this.w=e[t+3],this},toArray:function(e,t){return void 0===e&&(e=[]),void 0===t&&(t=0),e[t]=this.x,e[t+1]=this.y,e[t+2]=this.z,e[t+3]=this.w,e},fromBufferAttribute:function(e,t,n){return void 0!==n&&console.warn("THREE.Vector4: offset has been removed from .fromBufferAttribute()."),this.x=e.getX(t),this.y=e.getY(t),this.z=e.getZ(t),this.w=e.getW(t),this}},s.prototype={constructor:s,isWebGLRenderTarget:!0,setSize:function(e,t){this.width===e&&this.height===t||(this.width=e,this.height=t,this.dispose()),this.viewport.set(0,0,e,t),this.scissor.set(0,0,e,t)},clone:function(){return(new this.constructor).copy(this)},copy:function(e){return this.width=e.width,this.height=e.height,this.viewport.copy(e.viewport),this.texture=e.texture.clone(),this.depthBuffer=e.depthBuffer,this.stencilBuffer=e.stencilBuffer,this.depthTexture=e.depthTexture,this},dispose:function(){this.dispatchEvent({type:"dispose"})}},Object.assign(s.prototype,r.prototype),l.prototype=Object.create(s.prototype),l.prototype.constructor=l,l.prototype.isWebGLRenderTargetCube=!0,u.prototype={constructor:u,get x(){return this._x},set x(e){this._x=e,this.onChangeCallback()},get y(){return this._y},set y(e){this._y=e,this.onChangeCallback()},get z(){return this._z},set z(e){this._z=e,this.onChangeCallback()},get w(){return this._w},set w(e){this._w=e,this.onChangeCallback()},set:function(e,t,n,r){return this._x=e,this._y=t,this._z=n,this._w=r,this.onChangeCallback(),this},clone:function(){return new this.constructor(this._x,this._y,this._z,this._w)},copy:function(e){return this._x=e.x,this._y=e.y,this._z=e.z,this._w=e.w,this.onChangeCallback(),this},setFromEuler:function(e,t){if(!1===(e&&e.isEuler))throw new Error("THREE.Quaternion: .setFromEuler() now expects an Euler rotation rather than a Vector3 and order.");var n=Math.cos(e._x/2),r=Math.cos(e._y/2),i=Math.cos(e._z/2),o=Math.sin(e._x/2),a=Math.sin(e._y/2),s=Math.sin(e._z/2),l=e.order;return"XYZ"===l?(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"===l?(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"===l?(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"===l?(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"===l?(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"===l&&(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!==t&&this.onChangeCallback(),this},setFromAxisAngle:function(e,t){var n=t/2,r=Math.sin(n);return this._x=e.x*r,this._y=e.y*r,this._z=e.z*r,this._w=Math.cos(n),this.onChangeCallback(),this},setFromRotationMatrix:function(e){var t,n=e.elements,r=n[0],i=n[4],o=n[8],a=n[1],s=n[5],l=n[9],u=n[2],c=n[6],d=n[10],h=r+s+d;return h>0?(t=.5/Math.sqrt(h+1),this._w=.25/t,this._x=(c-l)*t,this._y=(o-u)*t,this._z=(a-i)*t):r>s&&r>d?(t=2*Math.sqrt(1+r-s-d),this._w=(c-l)/t,this._x=.25*t,this._y=(i+a)/t,this._z=(o+u)/t):s>d?(t=2*Math.sqrt(1+s-r-d),this._w=(o-u)/t,this._x=(i+a)/t,this._y=.25*t,this._z=(l+c)/t):(t=2*Math.sqrt(1+d-r-s),this._w=(a-i)/t,this._x=(o+u)/t,this._y=(l+c)/t,this._z=.25*t),this.onChangeCallback(),this},setFromUnitVectors:function(){var e,t;return function(n,r){return void 0===e&&(e=new c),t=n.dot(r)+1,t<1e-6?(t=0,Math.abs(n.x)>Math.abs(n.z)?e.set(-n.y,n.x,0):e.set(0,-n.z,n.y)):e.crossVectors(n,r),this._x=e.x,this._y=e.y,this._z=e.z,this._w=t,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(e){return this._x*e._x+this._y*e._y+this._z*e._z+this._w*e._w},lengthSq:function(){return this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w},length:function(){return Math.sqrt(this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w)},normalize:function(){var e=this.length();return 0===e?(this._x=0,this._y=0,this._z=0,this._w=1):(e=1/e,this._x=this._x*e,this._y=this._y*e,this._z=this._z*e,this._w=this._w*e),this.onChangeCallback(),this},multiply:function(e,t){return void 0!==t?(console.warn("THREE.Quaternion: .multiply() now only accepts one argument. Use .multiplyQuaternions( a, b ) instead."),this.multiplyQuaternions(e,t)):this.multiplyQuaternions(this,e)},premultiply:function(e){return this.multiplyQuaternions(e,this)},multiplyQuaternions:function(e,t){var n=e._x,r=e._y,i=e._z,o=e._w,a=t._x,s=t._y,l=t._z,u=t._w;return this._x=n*u+o*a+r*l-i*s,this._y=r*u+o*s+i*a-n*l,this._z=i*u+o*l+n*s-r*a,this._w=o*u-n*a-r*s-i*l,this.onChangeCallback(),this},slerp:function(e,t){if(0===t)return this;if(1===t)return this.copy(e);var n=this._x,r=this._y,i=this._z,o=this._w,a=o*e._w+n*e._x+r*e._y+i*e._z;if(a<0?(this._w=-e._w,this._x=-e._x,this._y=-e._y,this._z=-e._z,a=-a):this.copy(e),a>=1)return this._w=o,this._x=n,this._y=r,this._z=i,this;var s=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 l=Math.atan2(s,a),u=Math.sin((1-t)*l)/s,c=Math.sin(t*l)/s;return this._w=o*u+this._w*c,this._x=n*u+this._x*c,this._y=r*u+this._y*c,this._z=i*u+this._z*c,this.onChangeCallback(),this},equals:function(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._w===this._w},fromArray:function(e,t){return void 0===t&&(t=0),this._x=e[t],this._y=e[t+1],this._z=e[t+2],this._w=e[t+3],this.onChangeCallback(),this},toArray:function(e,t){return void 0===e&&(e=[]),void 0===t&&(t=0),e[t]=this._x,e[t+1]=this._y,e[t+2]=this._z,e[t+3]=this._w,e},onChange:function(e){return this.onChangeCallback=e,this},onChangeCallback:function(){}},Object.assign(u,{slerp:function(e,t,n,r){return n.copy(e).slerp(t,r)},slerpFlat:function(e,t,n,r,i,o,a){var s=n[r+0],l=n[r+1],u=n[r+2],c=n[r+3],d=i[o+0],h=i[o+1],f=i[o+2],p=i[o+3];if(c!==p||s!==d||l!==h||u!==f){var m=1-a,g=s*d+l*h+u*f+c*p,v=g>=0?1:-1,y=1-g*g;if(y>Number.EPSILON){var b=Math.sqrt(y),x=Math.atan2(b,g*v);m=Math.sin(m*x)/b,a=Math.sin(a*x)/b}var _=a*v;if(s=s*m+d*_,l=l*m+h*_,u=u*m+f*_,c=c*m+p*_,m===1-a){var w=1/Math.sqrt(s*s+l*l+u*u+c*c);s*=w,l*=w,u*=w,c*=w}}e[t]=s,e[t+1]=l,e[t+2]=u,e[t+3]=c}}),c.prototype={constructor:c,isVector3:!0,set:function(e,t,n){return this.x=e,this.y=t,this.z=n,this},setScalar:function(e){return this.x=e,this.y=e,this.z=e,this},setX:function(e){return this.x=e,this},setY:function(e){return this.y=e,this},setZ:function(e){return this.z=e,this},setComponent:function(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;case 2:this.z=t;break;default:throw new Error("index is out of range: "+e)}return this},getComponent:function(e){switch(e){case 0:return this.x;case 1:return this.y;case 2:return this.z;default:throw new Error("index is out of range: "+e)}},clone:function(){return new this.constructor(this.x,this.y,this.z)},copy:function(e){return this.x=e.x,this.y=e.y,this.z=e.z,this},add:function(e,t){return void 0!==t?(console.warn("THREE.Vector3: .add() now only accepts one argument. Use .addVectors( a, b ) instead."),this.addVectors(e,t)):(this.x+=e.x,this.y+=e.y,this.z+=e.z,this)},addScalar:function(e){return this.x+=e,this.y+=e,this.z+=e,this},addVectors:function(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this.z=e.z+t.z,this},addScaledVector:function(e,t){return this.x+=e.x*t,this.y+=e.y*t,this.z+=e.z*t,this},sub:function(e,t){return void 0!==t?(console.warn("THREE.Vector3: .sub() now only accepts one argument. Use .subVectors( a, b ) instead."),this.subVectors(e,t)):(this.x-=e.x,this.y-=e.y,this.z-=e.z,this)},subScalar:function(e){return this.x-=e,this.y-=e,this.z-=e,this},subVectors:function(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this.z=e.z-t.z,this},multiply:function(e,t){return void 0!==t?(console.warn("THREE.Vector3: .multiply() now only accepts one argument. Use .multiplyVectors( a, b ) instead."),this.multiplyVectors(e,t)):(this.x*=e.x,this.y*=e.y,this.z*=e.z,this)},multiplyScalar:function(e){return isFinite(e)?(this.x*=e,this.y*=e,this.z*=e):(this.x=0,this.y=0,this.z=0),this},multiplyVectors:function(e,t){return this.x=e.x*t.x,this.y=e.y*t.y,this.z=e.z*t.z,this},applyEuler:function(){var e;return function(t){return!1===(t&&t.isEuler)&&console.error("THREE.Vector3: .applyEuler() now expects an Euler rotation rather than a Vector3 and order."),void 0===e&&(e=new u),this.applyQuaternion(e.setFromEuler(t))}}(),applyAxisAngle:function(){var e;return function(t,n){return void 0===e&&(e=new u),this.applyQuaternion(e.setFromAxisAngle(t,n))}}(),applyMatrix3:function(e){var t=this.x,n=this.y,r=this.z,i=e.elements;return this.x=i[0]*t+i[3]*n+i[6]*r,this.y=i[1]*t+i[4]*n+i[7]*r,this.z=i[2]*t+i[5]*n+i[8]*r,this},applyMatrix4:function(e){var t=this.x,n=this.y,r=this.z,i=e.elements;this.x=i[0]*t+i[4]*n+i[8]*r+i[12],this.y=i[1]*t+i[5]*n+i[9]*r+i[13],this.z=i[2]*t+i[6]*n+i[10]*r+i[14];var o=i[3]*t+i[7]*n+i[11]*r+i[15];return this.divideScalar(o)},applyQuaternion:function(e){var t=this.x,n=this.y,r=this.z,i=e.x,o=e.y,a=e.z,s=e.w,l=s*t+o*r-a*n,u=s*n+a*t-i*r,c=s*r+i*n-o*t,d=-i*t-o*n-a*r;return this.x=l*s+d*-i+u*-a-c*-o,this.y=u*s+d*-o+c*-i-l*-a,this.z=c*s+d*-a+l*-o-u*-i,this},project:function(){var e;return function(t){return void 0===e&&(e=new d),e.multiplyMatrices(t.projectionMatrix,e.getInverse(t.matrixWorld)),this.applyMatrix4(e)}}(),unproject:function(){var e;return function(t){return void 0===e&&(e=new d),e.multiplyMatrices(t.matrixWorld,e.getInverse(t.projectionMatrix)),this.applyMatrix4(e)}}(),transformDirection:function(e){var t=this.x,n=this.y,r=this.z,i=e.elements;return this.x=i[0]*t+i[4]*n+i[8]*r,this.y=i[1]*t+i[5]*n+i[9]*r,this.z=i[2]*t+i[6]*n+i[10]*r,this.normalize()},divide:function(e){return this.x/=e.x,this.y/=e.y,this.z/=e.z,this},divideScalar:function(e){return this.multiplyScalar(1/e)},min:function(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this.z=Math.min(this.z,e.z),this},max:function(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this.z=Math.max(this.z,e.z),this},clamp:function(e,t){return this.x=Math.max(e.x,Math.min(t.x,this.x)),this.y=Math.max(e.y,Math.min(t.y,this.y)),this.z=Math.max(e.z,Math.min(t.z,this.z)),this},clampScalar:function(){var e,t;return function(n,r){return void 0===e&&(e=new c,t=new c),e.set(n,n,n),t.set(r,r,r),this.clamp(e,t)}}(),clampLength:function(e,t){var n=this.length();return this.multiplyScalar(Math.max(e,Math.min(t,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(e){return this.x*e.x+this.y*e.y+this.z*e.z},lengthSq:function(){return this.x*this.x+this.y*this.y+this.z*this.z},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)},lengthManhattan:function(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)},normalize:function(){return this.divideScalar(this.length())},setLength:function(e){return this.multiplyScalar(e/this.length())},lerp:function(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this.z+=(e.z-this.z)*t,this},lerpVectors:function(e,t,n){return this.subVectors(t,e).multiplyScalar(n).add(e)},cross:function(e,t){if(void 0!==t)return console.warn("THREE.Vector3: .cross() now only accepts one argument. Use .crossVectors( a, b ) instead."),this.crossVectors(e,t);var n=this.x,r=this.y,i=this.z;return this.x=r*e.z-i*e.y,this.y=i*e.x-n*e.z,this.z=n*e.y-r*e.x,this},crossVectors:function(e,t){var n=e.x,r=e.y,i=e.z,o=t.x,a=t.y,s=t.z;return this.x=r*s-i*a,this.y=i*o-n*s,this.z=n*a-r*o,this},projectOnVector:function(e){var t=e.dot(this)/e.lengthSq();return this.copy(e).multiplyScalar(t)},projectOnPlane:function(){var e;return function(t){return void 0===e&&(e=new c),e.copy(this).projectOnVector(t),this.sub(e)}}(),reflect:function(){var e;return function(t){return void 0===e&&(e=new c),this.sub(e.copy(t).multiplyScalar(2*this.dot(t)))}}(),angleTo:function(e){var t=this.dot(e)/Math.sqrt(this.lengthSq()*e.lengthSq());return Math.acos(fs.clamp(t,-1,1))},distanceTo:function(e){return Math.sqrt(this.distanceToSquared(e))},distanceToSquared:function(e){var t=this.x-e.x,n=this.y-e.y,r=this.z-e.z;return t*t+n*n+r*r},distanceToManhattan:function(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)+Math.abs(this.z-e.z)},setFromSpherical:function(e){var t=Math.sin(e.phi)*e.radius;return this.x=t*Math.sin(e.theta),this.y=Math.cos(e.phi)*e.radius,this.z=t*Math.cos(e.theta),this},setFromCylindrical:function(e){return this.x=e.radius*Math.sin(e.theta),this.y=e.y,this.z=e.radius*Math.cos(e.theta),this},setFromMatrixPosition:function(e){return this.setFromMatrixColumn(e,3)},setFromMatrixScale:function(e){var t=this.setFromMatrixColumn(e,0).length(),n=this.setFromMatrixColumn(e,1).length(),r=this.setFromMatrixColumn(e,2).length();return this.x=t,this.y=n,this.z=r,this},setFromMatrixColumn:function(e,t){if("number"==typeof e){console.warn("THREE.Vector3: setFromMatrixColumn now expects ( matrix, index ).");var n=e;e=t,t=n}return this.fromArray(e.elements,4*t)},equals:function(e){return e.x===this.x&&e.y===this.y&&e.z===this.z},fromArray:function(e,t){return void 0===t&&(t=0),this.x=e[t],this.y=e[t+1],this.z=e[t+2],this},toArray:function(e,t){return void 0===e&&(e=[]),void 0===t&&(t=0),e[t]=this.x,e[t+1]=this.y,e[t+2]=this.z,e},fromBufferAttribute:function(e,t,n){return void 0!==n&&console.warn("THREE.Vector3: offset has been removed from .fromBufferAttribute()."),this.x=e.getX(t),this.y=e.getY(t),this.z=e.getZ(t),this}},d.prototype={constructor:d,isMatrix4:!0,set:function(e,t,n,r,i,o,a,s,l,u,c,d,h,f,p,m){var g=this.elements;return g[0]=e,g[4]=t,g[8]=n,g[12]=r,g[1]=i,g[5]=o,g[9]=a,g[13]=s,g[2]=l,g[6]=u,g[10]=c,g[14]=d,g[3]=h,g[7]=f,g[11]=p,g[15]=m,this},identity:function(){return this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1),this},clone:function(){return(new d).fromArray(this.elements)},copy:function(e){return this.elements.set(e.elements),this},copyPosition:function(e){var t=this.elements,n=e.elements;return t[12]=n[12],t[13]=n[13],t[14]=n[14],this},extractBasis:function(e,t,n){return e.setFromMatrixColumn(this,0),t.setFromMatrixColumn(this,1),n.setFromMatrixColumn(this,2),this},makeBasis:function(e,t,n){return this.set(e.x,t.x,n.x,0,e.y,t.y,n.y,0,e.z,t.z,n.z,0,0,0,0,1),this},extractRotation:function(){var e;return function(t){void 0===e&&(e=new c);var n=this.elements,r=t.elements,i=1/e.setFromMatrixColumn(t,0).length(),o=1/e.setFromMatrixColumn(t,1).length(),a=1/e.setFromMatrixColumn(t,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(e){!1===(e&&e.isEuler)&&console.error("THREE.Matrix: .makeRotationFromEuler() now expects a Euler rotation rather than a Vector3 and order.");var t=this.elements,n=e.x,r=e.y,i=e.z,o=Math.cos(n),a=Math.sin(n),s=Math.cos(r),l=Math.sin(r),u=Math.cos(i),c=Math.sin(i);if("XYZ"===e.order){var d=o*u,h=o*c,f=a*u,p=a*c;t[0]=s*u,t[4]=-s*c,t[8]=l,t[1]=h+f*l,t[5]=d-p*l,t[9]=-a*s,t[2]=p-d*l,t[6]=f+h*l,t[10]=o*s}else if("YXZ"===e.order){var m=s*u,g=s*c,v=l*u,y=l*c;t[0]=m+y*a,t[4]=v*a-g,t[8]=o*l,t[1]=o*c,t[5]=o*u,t[9]=-a,t[2]=g*a-v,t[6]=y+m*a,t[10]=o*s}else if("ZXY"===e.order){var m=s*u,g=s*c,v=l*u,y=l*c;t[0]=m-y*a,t[4]=-o*c,t[8]=v+g*a,t[1]=g+v*a,t[5]=o*u,t[9]=y-m*a,t[2]=-o*l,t[6]=a,t[10]=o*s}else if("ZYX"===e.order){var d=o*u,h=o*c,f=a*u,p=a*c;t[0]=s*u,t[4]=f*l-h,t[8]=d*l+p,t[1]=s*c,t[5]=p*l+d,t[9]=h*l-f,t[2]=-l,t[6]=a*s,t[10]=o*s}else if("YZX"===e.order){var b=o*s,x=o*l,_=a*s,w=a*l;t[0]=s*u,t[4]=w-b*c,t[8]=_*c+x,t[1]=c,t[5]=o*u,t[9]=-a*u,t[2]=-l*u,t[6]=x*c+_,t[10]=b-w*c}else if("XZY"===e.order){var b=o*s,x=o*l,_=a*s,w=a*l;t[0]=s*u,t[4]=-c,t[8]=l*u,t[1]=b*c+w,t[5]=o*u,t[9]=x*c-_,t[2]=_*c-x,t[6]=a*u,t[10]=w*c+b}return t[3]=0,t[7]=0,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this},makeRotationFromQuaternion:function(e){var t=this.elements,n=e.x,r=e.y,i=e.z,o=e.w,a=n+n,s=r+r,l=i+i,u=n*a,c=n*s,d=n*l,h=r*s,f=r*l,p=i*l,m=o*a,g=o*s,v=o*l;return t[0]=1-(h+p),t[4]=c-v,t[8]=d+g,t[1]=c+v,t[5]=1-(u+p),t[9]=f-m,t[2]=d-g,t[6]=f+m,t[10]=1-(u+h),t[3]=0,t[7]=0,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this},lookAt:function(){var e,t,n;return function(r,i,o){void 0===e&&(e=new c,t=new c,n=new c);var a=this.elements;return n.subVectors(r,i).normalize(),0===n.lengthSq()&&(n.z=1),e.crossVectors(o,n).normalize(),0===e.lengthSq()&&(n.z+=1e-4,e.crossVectors(o,n).normalize()),t.crossVectors(n,e),a[0]=e.x,a[4]=t.x,a[8]=n.x,a[1]=e.y,a[5]=t.y,a[9]=n.y,a[2]=e.z,a[6]=t.z,a[10]=n.z,this}}(),multiply:function(e,t){return void 0!==t?(console.warn("THREE.Matrix4: .multiply() now only accepts one argument. Use .multiplyMatrices( a, b ) instead."),this.multiplyMatrices(e,t)):this.multiplyMatrices(this,e)},premultiply:function(e){return this.multiplyMatrices(e,this)},multiplyMatrices:function(e,t){var n=e.elements,r=t.elements,i=this.elements,o=n[0],a=n[4],s=n[8],l=n[12],u=n[1],c=n[5],d=n[9],h=n[13],f=n[2],p=n[6],m=n[10],g=n[14],v=n[3],y=n[7],b=n[11],x=n[15],_=r[0],w=r[4],M=r[8],S=r[12],E=r[1],T=r[5],k=r[9],O=r[13],C=r[2],P=r[6],A=r[10],R=r[14],L=r[3],D=r[7],I=r[11],z=r[15];return i[0]=o*_+a*E+s*C+l*L,i[4]=o*w+a*T+s*P+l*D,i[8]=o*M+a*k+s*A+l*I,i[12]=o*S+a*O+s*R+l*z,i[1]=u*_+c*E+d*C+h*L,i[5]=u*w+c*T+d*P+h*D,i[9]=u*M+c*k+d*A+h*I,i[13]=u*S+c*O+d*R+h*z,i[2]=f*_+p*E+m*C+g*L,i[6]=f*w+p*T+m*P+g*D,i[10]=f*M+p*k+m*A+g*I,i[14]=f*S+p*O+m*R+g*z,i[3]=v*_+y*E+b*C+x*L,i[7]=v*w+y*T+b*P+x*D,i[11]=v*M+y*k+b*A+x*I,i[15]=v*S+y*O+b*R+x*z,this},multiplyToArray:function(e,t,n){var r=this.elements;return this.multiplyMatrices(e,t),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(e){var t=this.elements;return t[0]*=e,t[4]*=e,t[8]*=e,t[12]*=e,t[1]*=e,t[5]*=e,t[9]*=e,t[13]*=e,t[2]*=e,t[6]*=e,t[10]*=e,t[14]*=e,t[3]*=e,t[7]*=e,t[11]*=e,t[15]*=e,this},applyToBufferAttribute:function(){var e;return function(t){void 0===e&&(e=new c);for(var n=0,r=t.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(e){return e&&e.isColor?this.copy(e):"number"==typeof e?this.setHex(e):"string"==typeof e&&this.setStyle(e),this},setScalar:function(e){return this.r=e,this.g=e,this.b=e,this},setHex:function(e){return e=Math.floor(e),this.r=(e>>16&255)/255,this.g=(e>>8&255)/255,this.b=(255&e)/255,this},setRGB:function(e,t,n){return this.r=e,this.g=t,this.b=n,this},setHSL:function(){function e(e,t,n){return n<0&&(n+=1),n>1&&(n-=1),n<1/6?e+6*(t-e)*n:n<.5?t:n<2/3?e+6*(t-e)*(2/3-n):e}return function(t,n,r){if(t=fs.euclideanModulo(t,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=e(o,i,t+1/3),this.g=e(o,i,t),this.b=e(o,i,t-1/3)}return this}}(),setStyle:function(e){function t(t){void 0!==t&&parseFloat(t)<1&&console.warn("THREE.Color: Alpha component of "+e+" will be ignored.")}var n;if(n=/^((?:rgb|hsl)a?)\(\s*([^\)]*)\)/.exec(e)){var r,i=n[1],o=n[2];switch(i){case"rgb":case"rgba":if(r=/^(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(,\s*([0-9]*\.?[0-9]+)\s*)?$/.exec(o))return this.r=Math.min(255,parseInt(r[1],10))/255,this.g=Math.min(255,parseInt(r[2],10))/255,this.b=Math.min(255,parseInt(r[3],10))/255,t(r[5]),this;if(r=/^(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(,\s*([0-9]*\.?[0-9]+)\s*)?$/.exec(o))return this.r=Math.min(100,parseInt(r[1],10))/100,this.g=Math.min(100,parseInt(r[2],10))/100,this.b=Math.min(100,parseInt(r[3],10))/100,t(r[5]),this;break;case"hsl":case"hsla":if(r=/^([0-9]*\.?[0-9]+)\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(,\s*([0-9]*\.?[0-9]+)\s*)?$/.exec(o)){var a=parseFloat(r[1])/360,s=parseInt(r[2],10)/100,l=parseInt(r[3],10)/100;return t(r[5]),this.setHSL(a,s,l)}}}else if(n=/^\#([A-Fa-f0-9]+)$/.exec(e)){var u=n[1],c=u.length;if(3===c)return this.r=parseInt(u.charAt(0)+u.charAt(0),16)/255,this.g=parseInt(u.charAt(1)+u.charAt(1),16)/255,this.b=parseInt(u.charAt(2)+u.charAt(2),16)/255,this;if(6===c)return this.r=parseInt(u.charAt(0)+u.charAt(1),16)/255,this.g=parseInt(u.charAt(2)+u.charAt(3),16)/255,this.b=parseInt(u.charAt(4)+u.charAt(5),16)/255,this}if(e&&e.length>0){var u=ws[e];void 0!==u?this.setHex(u):console.warn("THREE.Color: Unknown color "+e)}return this},clone:function(){return new this.constructor(this.r,this.g,this.b)},copy:function(e){return this.r=e.r,this.g=e.g,this.b=e.b,this},copyGammaToLinear:function(e,t){return void 0===t&&(t=2),this.r=Math.pow(e.r,t),this.g=Math.pow(e.g,t),this.b=Math.pow(e.b,t),this},copyLinearToGamma:function(e,t){void 0===t&&(t=2);var n=t>0?1/t:1;return this.r=Math.pow(e.r,n),this.g=Math.pow(e.g,n),this.b=Math.pow(e.b,n),this},convertGammaToLinear:function(){var e=this.r,t=this.g,n=this.b;return this.r=e*e,this.g=t*t,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(e){var t,n,r=e||{h:0,s:0,l:0},i=this.r,o=this.g,a=this.b,s=Math.max(i,o,a),l=Math.min(i,o,a),u=(l+s)/2;if(l===s)t=0,n=0;else{var c=s-l;switch(n=u<=.5?c/(s+l):c/(2-s-l),s){case i:t=(o-a)/c+(othis.max.x||e.ythis.max.y)},containsBox:function(e){return this.min.x<=e.min.x&&e.max.x<=this.max.x&&this.min.y<=e.min.y&&e.max.y<=this.max.y},getParameter:function(e,t){return(t||new i).set((e.x-this.min.x)/(this.max.x-this.min.x),(e.y-this.min.y)/(this.max.y-this.min.y))},intersectsBox:function(e){return!(e.max.xthis.max.x||e.max.ythis.max.y)},clampPoint:function(e,t){return(t||new i).copy(e).clamp(this.min,this.max)},distanceToPoint:function(){var e=new i;return function(t){return e.copy(t).clamp(this.min,this.max).sub(t).length()}}(),intersect:function(e){return this.min.max(e.min),this.max.min(e.max),this},union:function(e){return this.min.min(e.min),this.max.max(e.max),this},translate:function(e){return this.min.add(e),this.max.add(e),this},equals:function(e){return e.min.equals(this.min)&&e.max.equals(this.max)}};var Es=0;Q.prototype={constructor:Q,isMaterial:!0,get needsUpdate(){return this._needsUpdate},set needsUpdate(e){!0===e&&this.update(),this._needsUpdate=e},setValues:function(e){if(void 0!==e)for(var t in e){var n=e[t];if(void 0!==n){var r=this[t];void 0!==r?r&&r.isColor?r.set(n):r&&r.isVector3&&n&&n.isVector3?r.copy(n):this[t]="overdraw"===t?Number(n):n:console.warn("THREE."+this.type+": '"+t+"' is not a property of this material.")}else console.warn("THREE.Material: '"+t+"' parameter is undefined.")}},toJSON:function(e){function t(e){var t=[];for(var n in e){var r=e[n];delete r.metadata,t.push(r)}return t}var n=void 0===e;n&&(e={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(e).uuid),this.alphaMap&&this.alphaMap.isTexture&&(r.alphaMap=this.alphaMap.toJSON(e).uuid),this.lightMap&&this.lightMap.isTexture&&(r.lightMap=this.lightMap.toJSON(e).uuid),this.bumpMap&&this.bumpMap.isTexture&&(r.bumpMap=this.bumpMap.toJSON(e).uuid,r.bumpScale=this.bumpScale),this.normalMap&&this.normalMap.isTexture&&(r.normalMap=this.normalMap.toJSON(e).uuid,r.normalScale=this.normalScale.toArray()),this.displacementMap&&this.displacementMap.isTexture&&(r.displacementMap=this.displacementMap.toJSON(e).uuid,r.displacementScale=this.displacementScale,r.displacementBias=this.displacementBias),this.roughnessMap&&this.roughnessMap.isTexture&&(r.roughnessMap=this.roughnessMap.toJSON(e).uuid),this.metalnessMap&&this.metalnessMap.isTexture&&(r.metalnessMap=this.metalnessMap.toJSON(e).uuid),this.emissiveMap&&this.emissiveMap.isTexture&&(r.emissiveMap=this.emissiveMap.toJSON(e).uuid),this.specularMap&&this.specularMap.isTexture&&(r.specularMap=this.specularMap.toJSON(e).uuid),this.envMap&&this.envMap.isTexture&&(r.envMap=this.envMap.toJSON(e).uuid,r.reflectivity=this.reflectivity),this.gradientMap&&this.gradientMap.isTexture&&(r.gradientMap=this.gradientMap.toJSON(e).uuid),void 0!==this.size&&(r.size=this.size),void 0!==this.sizeAttenuation&&(r.sizeAttenuation=this.sizeAttenuation),this.blending!==go&&(r.blending=this.blending),this.shading!==co&&(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=t(e.textures),o=t(e.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(e){this.name=e.name,this.fog=e.fog,this.lights=e.lights,this.blending=e.blending,this.side=e.side,this.shading=e.shading,this.vertexColors=e.vertexColors,this.opacity=e.opacity,this.transparent=e.transparent,this.blendSrc=e.blendSrc,this.blendDst=e.blendDst,this.blendEquation=e.blendEquation,this.blendSrcAlpha=e.blendSrcAlpha,this.blendDstAlpha=e.blendDstAlpha,this.blendEquationAlpha=e.blendEquationAlpha,this.depthFunc=e.depthFunc,this.depthTest=e.depthTest,this.depthWrite=e.depthWrite,this.colorWrite=e.colorWrite,this.precision=e.precision,this.polygonOffset=e.polygonOffset,this.polygonOffsetFactor=e.polygonOffsetFactor,this.polygonOffsetUnits=e.polygonOffsetUnits,this.alphaTest=e.alphaTest,this.premultipliedAlpha=e.premultipliedAlpha,this.overdraw=e.overdraw,this.visible=e.visible,this.clipShadows=e.clipShadows,this.clipIntersection=e.clipIntersection;var t=e.clippingPlanes,n=null;if(null!==t){var r=t.length;n=new Array(r);for(var i=0;i!==r;++i)n[i]=t[i].clone()}return this.clippingPlanes=n,this},update:function(){this.dispatchEvent({type:"update"})},dispose:function(){this.dispatchEvent({type:"dispose"})}},Object.assign(Q.prototype,r.prototype),$.prototype=Object.create(Q.prototype),$.prototype.constructor=$,$.prototype.isShaderMaterial=!0,$.prototype.copy=function(e){return Q.prototype.copy.call(this,e),this.fragmentShader=e.fragmentShader,this.vertexShader=e.vertexShader,this.uniforms=xs.clone(e.uniforms),this.defines=e.defines,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.lights=e.lights,this.clipping=e.clipping,this.skinning=e.skinning,this.morphTargets=e.morphTargets,this.morphNormals=e.morphNormals,this.extensions=e.extensions,this},$.prototype.toJSON=function(e){var t=Q.prototype.toJSON.call(this,e);return t.uniforms=this.uniforms,t.vertexShader=this.vertexShader,t.fragmentShader=this.fragmentShader,t},ee.prototype=Object.create(Q.prototype),ee.prototype.constructor=ee,ee.prototype.isMeshDepthMaterial=!0,ee.prototype.copy=function(e){return Q.prototype.copy.call(this,e),this.depthPacking=e.depthPacking,this.skinning=e.skinning,this.morphTargets=e.morphTargets,this.map=e.map,this.alphaMap=e.alphaMap,this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this},te.prototype={constructor:te,isBox3:!0,set:function(e,t){return this.min.copy(e),this.max.copy(t),this},setFromArray:function(e){for(var t=1/0,n=1/0,r=1/0,i=-1/0,o=-1/0,a=-1/0,s=0,l=e.length;si&&(i=u),c>o&&(o=c),d>a&&(a=d)}return this.min.set(t,n,r),this.max.set(i,o,a),this},setFromBufferAttribute:function(e){for(var t=1/0,n=1/0,r=1/0,i=-1/0,o=-1/0,a=-1/0,s=0,l=e.count;si&&(i=u),c>o&&(o=c),d>a&&(a=d)}return this.min.set(t,n,r),this.max.set(i,o,a),this},setFromPoints:function(e){this.makeEmpty();for(var t=0,n=e.length;tthis.max.x||e.ythis.max.y||e.zthis.max.z)},containsBox:function(e){return this.min.x<=e.min.x&&e.max.x<=this.max.x&&this.min.y<=e.min.y&&e.max.y<=this.max.y&&this.min.z<=e.min.z&&e.max.z<=this.max.z},getParameter:function(e,t){return(t||new c).set((e.x-this.min.x)/(this.max.x-this.min.x),(e.y-this.min.y)/(this.max.y-this.min.y),(e.z-this.min.z)/(this.max.z-this.min.z))},intersectsBox:function(e){return!(e.max.xthis.max.x||e.max.ythis.max.y||e.max.zthis.max.z)},intersectsSphere:function(){var e;return function(t){return void 0===e&&(e=new c),this.clampPoint(t.center,e),e.distanceToSquared(t.center)<=t.radius*t.radius}}(),intersectsPlane:function(e){var t,n;return e.normal.x>0?(t=e.normal.x*this.min.x,n=e.normal.x*this.max.x):(t=e.normal.x*this.max.x,n=e.normal.x*this.min.x),e.normal.y>0?(t+=e.normal.y*this.min.y,n+=e.normal.y*this.max.y):(t+=e.normal.y*this.max.y,n+=e.normal.y*this.min.y),e.normal.z>0?(t+=e.normal.z*this.min.z,n+=e.normal.z*this.max.z):(t+=e.normal.z*this.max.z,n+=e.normal.z*this.min.z),t<=e.constant&&n>=e.constant},clampPoint:function(e,t){return(t||new c).copy(e).clamp(this.min,this.max)},distanceToPoint:function(){var e=new c;return function(t){return e.copy(t).clamp(this.min,this.max).sub(t).length()}}(),getBoundingSphere:function(){var e=new c;return function(t){var n=t||new ne;return this.getCenter(n.center),n.radius=.5*this.getSize(e).length(),n}}(),intersect:function(e){return this.min.max(e.min),this.max.min(e.max),this.isEmpty()&&this.makeEmpty(),this},union:function(e){return this.min.min(e.min),this.max.max(e.max),this},applyMatrix4:function(){var e=[new c,new c,new c,new c,new c,new c,new c,new c];return function(t){return this.isEmpty()?this:(e[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(t),e[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(t),e[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(t),e[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(t),e[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(t),e[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(t),e[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(t),e[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(t),this.setFromPoints(e),this)}}(),translate:function(e){return this.min.add(e),this.max.add(e),this},equals:function(e){return e.min.equals(this.min)&&e.max.equals(this.max)}},ne.prototype={constructor:ne,set:function(e,t){return this.center.copy(e),this.radius=t,this},setFromPoints:function(){var e;return function(t,n){void 0===e&&(e=new te);var r=this.center;void 0!==n?r.copy(n):e.setFromPoints(t).getCenter(r);for(var i=0,o=0,a=t.length;othis.radius*this.radius&&(r.sub(this.center).normalize(),r.multiplyScalar(this.radius).add(this.center)),r},getBoundingBox:function(e){var t=e||new te;return t.set(this.center,this.center),t.expandByScalar(this.radius),t},applyMatrix4:function(e){return this.center.applyMatrix4(e),this.radius=this.radius*e.getMaxScaleOnAxis(),this},translate:function(e){return this.center.add(e),this},equals:function(e){return e.center.equals(this.center)&&e.radius===this.radius}},re.prototype={constructor:re,isMatrix3:!0,set:function(e,t,n,r,i,o,a,s,l){var u=this.elements;return u[0]=e,u[1]=r,u[2]=a,u[3]=t,u[4]=i,u[5]=s,u[6]=n,u[7]=o,u[8]=l,this},identity:function(){return this.set(1,0,0,0,1,0,0,0,1),this},clone:function(){return(new this.constructor).fromArray(this.elements)},copy:function(e){var t=e.elements;return this.set(t[0],t[3],t[6],t[1],t[4],t[7],t[2],t[5],t[8]),this},setFromMatrix4:function(e){var t=e.elements;return this.set(t[0],t[4],t[8],t[1],t[5],t[9],t[2],t[6],t[10]),this},applyToBufferAttribute:function(){var e;return function(t){void 0===e&&(e=new c);for(var n=0,r=t.count;n1))return r.copy(i).multiplyScalar(a).add(t.start)}else if(0===this.distanceToPoint(t.start))return r.copy(t.start)}}(),intersectsLine:function(e){var t=this.distanceToPoint(e.start),n=this.distanceToPoint(e.end);return t<0&&n>0||n<0&&t>0},intersectsBox:function(e){return e.intersectsPlane(this)},intersectsSphere:function(e){return e.intersectsPlane(this)},coplanarPoint:function(e){return(e||new c).copy(this.normal).multiplyScalar(-this.constant)},applyMatrix4:function(){var e=new c,t=new re;return function(n,r){var i=this.coplanarPoint(e).applyMatrix4(n),o=r||t.getNormalMatrix(n),a=this.normal.applyMatrix3(o).normalize();return this.constant=-i.dot(a),this}}(),translate:function(e){return this.constant=this.constant-e.dot(this.normal),this},equals:function(e){return e.normal.equals(this.normal)&&e.constant===this.constant}},oe.prototype={constructor:oe,set:function(e,t,n,r,i,o){var a=this.planes;return a[0].copy(e),a[1].copy(t),a[2].copy(n),a[3].copy(r),a[4].copy(i),a[5].copy(o),this},clone:function(){return(new this.constructor).copy(this)},copy:function(e){for(var t=this.planes,n=0;n<6;n++)t[n].copy(e.planes[n]);return this},setFromMatrix:function(e){var t=this.planes,n=e.elements,r=n[0],i=n[1],o=n[2],a=n[3],s=n[4],l=n[5],u=n[6],c=n[7],d=n[8],h=n[9],f=n[10],p=n[11],m=n[12],g=n[13],v=n[14],y=n[15];return t[0].setComponents(a-r,c-s,p-d,y-m).normalize(),t[1].setComponents(a+r,c+s,p+d,y+m).normalize(),t[2].setComponents(a+i,c+l,p+h,y+g).normalize(),t[3].setComponents(a-i,c-l,p-h,y-g).normalize(),t[4].setComponents(a-o,c-u,p-f,y-v).normalize(),t[5].setComponents(a+o,c+u,p+f,y+v).normalize(),this},intersectsObject:function(){var e=new ne;return function(t){var n=t.geometry;return null===n.boundingSphere&&n.computeBoundingSphere(),e.copy(n.boundingSphere).applyMatrix4(t.matrixWorld),this.intersectsSphere(e)}}(),intersectsSprite:function(){var e=new ne;return function(t){return e.center.set(0,0,0),e.radius=.7071067811865476,e.applyMatrix4(t.matrixWorld),this.intersectsSphere(e)}}(),intersectsSphere:function(e){for(var t=this.planes,n=e.center,r=-e.radius,i=0;i<6;i++){if(t[i].distanceToPoint(n)0?n.min.x:n.max.x,t.x=o.normal.x>0?n.max.x:n.min.x,e.y=o.normal.y>0?n.min.y:n.max.y,t.y=o.normal.y>0?n.max.y:n.min.y,e.z=o.normal.z>0?n.min.z:n.max.z,t.z=o.normal.z>0?n.max.z:n.min.z;var a=o.distanceToPoint(e),s=o.distanceToPoint(t);if(a<0&&s<0)return!1}return!0}}(),containsPoint:function(e){for(var t=this.planes,n=0;n<6;n++)if(t[n].distanceToPoint(e)<0)return!1;return!0}},se.prototype={constructor:se,set:function(e,t){return this.origin.copy(e),this.direction.copy(t),this},clone:function(){return(new this.constructor).copy(this)},copy:function(e){return this.origin.copy(e.origin),this.direction.copy(e.direction),this},at:function(e,t){return(t||new c).copy(this.direction).multiplyScalar(e).add(this.origin)},lookAt:function(e){return this.direction.copy(e).sub(this.origin).normalize(),this},recast:function(){var e=new c;return function(t){return this.origin.copy(this.at(t,e)),this}}(),closestPointToPoint:function(e,t){var n=t||new c;n.subVectors(e,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(e){return Math.sqrt(this.distanceSqToPoint(e))},distanceSqToPoint:function(){var e=new c;return function(t){var n=e.subVectors(t,this.origin).dot(this.direction);return n<0?this.origin.distanceToSquared(t):(e.copy(this.direction).multiplyScalar(n).add(this.origin),e.distanceToSquared(t))}}(),distanceSqToSegment:function(){var e=new c,t=new c,n=new c;return function(r,i,o,a){e.copy(r).add(i).multiplyScalar(.5),t.copy(i).sub(r).normalize(),n.copy(this.origin).sub(e);var s,l,u,c,d=.5*r.distanceTo(i),h=-this.direction.dot(t),f=n.dot(this.direction),p=-n.dot(t),m=n.lengthSq(),g=Math.abs(1-h*h);if(g>0)if(s=h*p-f,l=h*f-p,c=d*g,s>=0)if(l>=-c)if(l<=c){var v=1/g;s*=v,l*=v,u=s*(s+h*l+2*f)+l*(h*s+l+2*p)+m}else l=d,s=Math.max(0,-(h*l+f)),u=-s*s+l*(l+2*p)+m;else l=-d,s=Math.max(0,-(h*l+f)),u=-s*s+l*(l+2*p)+m;else l<=-c?(s=Math.max(0,-(-h*d+f)),l=s>0?-d:Math.min(Math.max(-d,-p),d),u=-s*s+l*(l+2*p)+m):l<=c?(s=0,l=Math.min(Math.max(-d,-p),d),u=l*(l+2*p)+m):(s=Math.max(0,-(h*d+f)),l=s>0?d:Math.min(Math.max(-d,-p),d),u=-s*s+l*(l+2*p)+m);else l=h>0?-d:d,s=Math.max(0,-(h*l+f)),u=-s*s+l*(l+2*p)+m;return o&&o.copy(this.direction).multiplyScalar(s).add(this.origin),a&&a.copy(t).multiplyScalar(l).add(e),u}}(),intersectSphere:function(){var e=new c;return function(t,n){e.subVectors(t.center,this.origin);var r=e.dot(this.direction),i=e.dot(e)-r*r,o=t.radius*t.radius;if(i>o)return null;var a=Math.sqrt(o-i),s=r-a,l=r+a;return s<0&&l<0?null:s<0?this.at(l,n):this.at(s,n)}}(),intersectsSphere:function(e){return this.distanceToPoint(e.center)<=e.radius},distanceToPlane:function(e){var t=e.normal.dot(this.direction);if(0===t)return 0===e.distanceToPoint(this.origin)?0:null;var n=-(this.origin.dot(e.normal)+e.constant)/t;return n>=0?n:null},intersectPlane:function(e,t){var n=this.distanceToPlane(e);return null===n?null:this.at(n,t)},intersectsPlane:function(e){var t=e.distanceToPoint(this.origin);return 0===t||e.normal.dot(this.direction)*t<0},intersectBox:function(e,t){var n,r,i,o,a,s,l=1/this.direction.x,u=1/this.direction.y,c=1/this.direction.z,d=this.origin;return l>=0?(n=(e.min.x-d.x)*l,r=(e.max.x-d.x)*l):(n=(e.max.x-d.x)*l,r=(e.min.x-d.x)*l),u>=0?(i=(e.min.y-d.y)*u,o=(e.max.y-d.y)*u):(i=(e.max.y-d.y)*u,o=(e.min.y-d.y)*u),n>o||i>r?null:((i>n||n!==n)&&(n=i),(o=0?(a=(e.min.z-d.z)*c,s=(e.max.z-d.z)*c):(a=(e.max.z-d.z)*c,s=(e.min.z-d.z)*c),n>s||a>r?null:((a>n||n!==n)&&(n=a),(s=0?n:r,t)))},intersectsBox:function(){var e=new c;return function(t){return null!==this.intersectBox(t,e)}}(),intersectTriangle:function(){var e=new c,t=new c,n=new c,r=new c;return function(i,o,a,s,l){t.subVectors(o,i),n.subVectors(a,i),r.crossVectors(t,n);var u,c=this.direction.dot(r);if(c>0){if(s)return null;u=1}else{if(!(c<0))return null;u=-1,c=-c}e.subVectors(this.origin,i);var d=u*this.direction.dot(n.crossVectors(e,n));if(d<0)return null;var h=u*this.direction.dot(t.cross(e));if(h<0)return null;if(d+h>c)return null;var f=-u*e.dot(r);return f<0?null:this.at(f/c,l)}}(),applyMatrix4:function(e){return this.direction.add(this.origin).applyMatrix4(e),this.origin.applyMatrix4(e),this.direction.sub(this.origin),this.direction.normalize(),this},equals:function(e){return e.origin.equals(this.origin)&&e.direction.equals(this.direction)}},le.RotationOrders=["XYZ","YZX","ZXY","XZY","YXZ","ZYX"],le.DefaultOrder="XYZ",le.prototype={constructor:le,isEuler:!0,get x(){return this._x},set x(e){this._x=e,this.onChangeCallback()},get y(){return this._y},set y(e){this._y=e,this.onChangeCallback()},get z(){return this._z},set z(e){this._z=e,this.onChangeCallback()},get order(){return this._order},set order(e){this._order=e,this.onChangeCallback()},set:function(e,t,n,r){return this._x=e,this._y=t,this._z=n,this._order=r||this._order,this.onChangeCallback(),this},clone:function(){return new this.constructor(this._x,this._y,this._z,this._order)},copy:function(e){return this._x=e._x,this._y=e._y,this._z=e._z,this._order=e._order,this.onChangeCallback(),this},setFromRotationMatrix:function(e,t,n){var r=fs.clamp,i=e.elements,o=i[0],a=i[4],s=i[8],l=i[1],u=i[5],c=i[9],d=i[2],h=i[6],f=i[10];return t=t||this._order,"XYZ"===t?(this._y=Math.asin(r(s,-1,1)),Math.abs(s)<.99999?(this._x=Math.atan2(-c,f),this._z=Math.atan2(-a,o)):(this._x=Math.atan2(h,u),this._z=0)):"YXZ"===t?(this._x=Math.asin(-r(c,-1,1)),Math.abs(c)<.99999?(this._y=Math.atan2(s,f),this._z=Math.atan2(l,u)):(this._y=Math.atan2(-d,o),this._z=0)):"ZXY"===t?(this._x=Math.asin(r(h,-1,1)),Math.abs(h)<.99999?(this._y=Math.atan2(-d,f),this._z=Math.atan2(-a,u)):(this._y=0,this._z=Math.atan2(l,o))):"ZYX"===t?(this._y=Math.asin(-r(d,-1,1)),Math.abs(d)<.99999?(this._x=Math.atan2(h,f),this._z=Math.atan2(l,o)):(this._x=0,this._z=Math.atan2(-a,u))):"YZX"===t?(this._z=Math.asin(r(l,-1,1)),Math.abs(l)<.99999?(this._x=Math.atan2(-c,u),this._y=Math.atan2(-d,o)):(this._x=0,this._y=Math.atan2(s,f))):"XZY"===t?(this._z=Math.asin(-r(a,-1,1)),Math.abs(a)<.99999?(this._x=Math.atan2(h,u),this._y=Math.atan2(s,o)):(this._x=Math.atan2(-c,f),this._y=0)):console.warn("THREE.Euler: .setFromRotationMatrix() given unsupported order: "+t),this._order=t,!1!==n&&this.onChangeCallback(),this},setFromQuaternion:function(){var e;return function(t,n,r){return void 0===e&&(e=new d),e.makeRotationFromQuaternion(t),this.setFromRotationMatrix(e,n,r)}}(),setFromVector3:function(e,t){return this.set(e.x,e.y,e.z,t||this._order)},reorder:function(){var e=new u;return function(t){return e.setFromEuler(this),this.setFromQuaternion(e,t)}}(),equals:function(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._order===this._order},fromArray:function(e){return this._x=e[0],this._y=e[1],this._z=e[2],void 0!==e[3]&&(this._order=e[3]),this.onChangeCallback(),this},toArray:function(e,t){return void 0===e&&(e=[]),void 0===t&&(t=0),e[t]=this._x,e[t+1]=this._y,e[t+2]=this._z,e[t+3]=this._order,e},toVector3:function(e){return e?e.set(this._x,this._y,this._z):new c(this._x,this._y,this._z)},onChange:function(e){return this.onChangeCallback=e,this},onChangeCallback:function(){}},ue.prototype={constructor:ue,set:function(e){this.mask=1<1){for(var t=0;t1)for(var t=0;t0){i.children=[];for(var o=0;o0&&(r.geometries=a),s.length>0&&(r.materials=s),l.length>0&&(r.textures=l),u.length>0&&(r.images=u)}return r.object=i,r},clone:function(e){return(new this.constructor).copy(this,e)},copy:function(e,t){if(void 0===t&&(t=!0),this.name=e.name,this.up.copy(e.up),this.position.copy(e.position),this.quaternion.copy(e.quaternion),this.scale.copy(e.scale),this.matrix.copy(e.matrix),this.matrixWorld.copy(e.matrixWorld),this.matrixAutoUpdate=e.matrixAutoUpdate,this.matrixWorldNeedsUpdate=e.matrixWorldNeedsUpdate,this.layers.mask=e.layers.mask,this.visible=e.visible,this.castShadow=e.castShadow,this.receiveShadow=e.receiveShadow,this.frustumCulled=e.frustumCulled,this.renderOrder=e.renderOrder,this.userData=JSON.parse(JSON.stringify(e.userData)),!0===t)for(var n=0;n0?o.multiplyScalar(1/Math.sqrt(a)):o.set(0,0,0)}}(),he.barycoordFromPoint=function(){var e=new c,t=new c,n=new c;return function(r,i,o,a,s){e.subVectors(a,i),t.subVectors(o,i),n.subVectors(r,i);var l=e.dot(e),u=e.dot(t),d=e.dot(n),h=t.dot(t),f=t.dot(n),p=l*h-u*u,m=s||new c;if(0===p)return m.set(-2,-1,-1);var g=1/p,v=(h*d-u*f)*g,y=(l*f-u*d)*g;return m.set(1-v-y,y,v)}}(),he.containsPoint=function(){var e=new c;return function(t,n,r,i){var o=he.barycoordFromPoint(t,n,r,i,e);return o.x>=0&&o.y>=0&&o.x+o.y<=1}}(),he.prototype={constructor:he,set:function(e,t,n){return this.a.copy(e),this.b.copy(t),this.c.copy(n),this},setFromPointsAndIndices:function(e,t,n,r){return this.a.copy(e[t]),this.b.copy(e[n]),this.c.copy(e[r]),this},clone:function(){return(new this.constructor).copy(this)},copy:function(e){return this.a.copy(e.a),this.b.copy(e.b),this.c.copy(e.c),this},area:function(){var e=new c,t=new c;return function(){return e.subVectors(this.c,this.b),t.subVectors(this.a,this.b),.5*e.cross(t).length()}}(),midpoint:function(e){return(e||new c).addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)},normal:function(e){return he.normal(this.a,this.b,this.c,e)},plane:function(e){return(e||new ie).setFromCoplanarPoints(this.a,this.b,this.c)},barycoordFromPoint:function(e,t){return he.barycoordFromPoint(e,this.a,this.b,this.c,t)},containsPoint:function(e){return he.containsPoint(e,this.a,this.b,this.c)},closestPointToPoint:function(){var e,t,n,r;return function(i,o){void 0===e&&(e=new ie,t=[new de,new de,new de],n=new c,r=new c);var a=o||new c,s=1/0;if(e.setFromCoplanarPoints(this.a,this.b,this.c),e.projectPoint(i,n),!0===this.containsPoint(n))a.copy(n);else{t[0].set(this.a,this.b),t[1].set(this.b,this.c),t[2].set(this.c,this.a);for(var l=0;l0,s=o[1]&&o[1].length>0,l=e.morphTargets,u=l.length;if(u>0){t=[];for(var c=0;c0){d=[];for(var c=0;c0)for(var m=0;m0&&(this.normalsNeedUpdate=!0)},computeFlatVertexNormals:function(){var e,t,n;for(this.computeFaceNormals(),e=0,t=this.faces.length;e0&&(this.normalsNeedUpdate=!0)},computeMorphNormals:function(){var e,t,n,r,i;for(n=0,r=this.faces.length;n0&&(e+=t[n].distanceTo(t[n-1])),this.lineDistances[n]=e},computeBoundingBox:function(){null===this.boundingBox&&(this.boundingBox=new te),this.boundingBox.setFromPoints(this.vertices)},computeBoundingSphere:function(){null===this.boundingSphere&&(this.boundingSphere=new ne),this.boundingSphere.setFromPoints(this.vertices)},merge:function(e,t,n){if(!1===(e&&e.isGeometry))return void console.error("THREE.Geometry.merge(): geometry not an instance of THREE.Geometry.",e);var r,i=this.vertices.length,o=this.vertices,a=e.vertices,s=this.faces,l=e.faces,u=this.faceVertexUvs[0],c=e.faceVertexUvs[0],d=this.colors,h=e.colors;void 0===n&&(n=0),void 0!==t&&(r=(new re).getNormalMatrix(t));for(var f=0,p=a.length;f=0;n--){var p=h[n];for(this.faces.splice(p,1),a=0,s=this.faceVertexUvs.length;a0,x=v.vertexNormals.length>0,_=1!==v.color.r||1!==v.color.g||1!==v.color.b,w=v.vertexColors.length>0,M=0;if(M=e(M,0,0),M=e(M,1,!0),M=e(M,2,!1),M=e(M,3,y),M=e(M,4,b),M=e(M,5,x),M=e(M,6,_),M=e(M,7,w),c.push(M),c.push(v.a,v.b,v.c),c.push(v.materialIndex),y){var S=this.faceVertexUvs[0][l];c.push(r(S[0]),r(S[1]),r(S[2]))}if(b&&c.push(t(v.normal)),x){var E=v.vertexNormals;c.push(t(E[0]),t(E[1]),t(E[2]))}if(_&&c.push(n(v.color)),w){var T=v.vertexColors;c.push(n(T[0]),n(T[1]),n(T[2]))}}return i.data={},i.data.vertices=s,i.data.normals=d,f.length>0&&(i.data.colors=f),m.length>0&&(i.data.uvs=[m]),i.data.faces=c,i},clone:function(){return(new Oe).copy(this)},copy:function(e){var t,n,r,i,o,a;this.vertices=[],this.colors=[],this.faces=[],this.faceVertexUvs=[[]],this.morphTargets=[],this.morphNormals=[],this.skinWeights=[],this.skinIndices=[],this.lineDistances=[],this.boundingBox=null,this.boundingSphere=null,this.name=e.name;var s=e.vertices;for(t=0,n=s.length;t65535?we:xe)(e,1):this.index=e},addAttribute:function(e,t){return!1===(t&&t.isBufferAttribute)&&!1===(t&&t.isInterleavedBufferAttribute)?(console.warn("THREE.BufferGeometry: .addAttribute() now expects ( name, attribute )."),void this.addAttribute(e,new me(arguments[1],arguments[2]))):"index"===e?(console.warn("THREE.BufferGeometry.addAttribute: Use .setIndex() for index attribute."),void this.setIndex(t)):(this.attributes[e]=t,this)},getAttribute:function(e){return this.attributes[e]},removeAttribute:function(e){return delete this.attributes[e],this},addGroup:function(e,t,n){this.groups.push({start:e,count:t,materialIndex:void 0!==n?n:0})},clearGroups:function(){this.groups=[]},setDrawRange:function(e,t){this.drawRange.start=e,this.drawRange.count=t},applyMatrix:function(e){var t=this.attributes.position;void 0!==t&&(e.applyToBufferAttribute(t),t.needsUpdate=!0);var n=this.attributes.normal;if(void 0!==n){(new re).getNormalMatrix(e).applyToBufferAttribute(n),n.needsUpdate=!0}return null!==this.boundingBox&&this.computeBoundingBox(),null!==this.boundingSphere&&this.computeBoundingSphere(),this},rotateX:function(){var e;return function(t){return void 0===e&&(e=new d),e.makeRotationX(t),this.applyMatrix(e),this}}(),rotateY:function(){var e;return function(t){return void 0===e&&(e=new d),e.makeRotationY(t),this.applyMatrix(e),this}}(),rotateZ:function(){var e;return function(t){return void 0===e&&(e=new d),e.makeRotationZ(t),this.applyMatrix(e),this}}(),translate:function(){var e;return function(t,n,r){return void 0===e&&(e=new d),e.makeTranslation(t,n,r),this.applyMatrix(e),this}}(),scale:function(){var e;return function(t,n,r){return void 0===e&&(e=new d),e.makeScale(t,n,r),this.applyMatrix(e),this}}(),lookAt:function(){var e;return function(t){void 0===e&&(e=new ce),e.lookAt(t),e.updateMatrix(),this.applyMatrix(e.matrix)}}(),center:function(){this.computeBoundingBox();var e=this.boundingBox.getCenter().negate();return this.translate(e.x,e.y,e.z),e},setFromObject:function(e){var t=e.geometry;if(e.isPoints||e.isLine){var n=new Me(3*t.vertices.length,3),r=new Me(3*t.colors.length,3);if(this.addAttribute("position",n.copyVector3sArray(t.vertices)),this.addAttribute("color",r.copyColorsArray(t.colors)),t.lineDistances&&t.lineDistances.length===t.vertices.length){var i=new Me(t.lineDistances.length,1);this.addAttribute("lineDistance",i.copyArray(t.lineDistances))}null!==t.boundingSphere&&(this.boundingSphere=t.boundingSphere.clone()),null!==t.boundingBox&&(this.boundingBox=t.boundingBox.clone())}else e.isMesh&&t&&t.isGeometry&&this.fromGeometry(t);return this},updateFromObject:function(e){var t=e.geometry;if(e.isMesh){var n=t.__directGeometry;if(!0===t.elementsNeedUpdate&&(n=void 0,t.elementsNeedUpdate=!1),void 0===n)return this.fromGeometry(t);n.verticesNeedUpdate=t.verticesNeedUpdate,n.normalsNeedUpdate=t.normalsNeedUpdate,n.colorsNeedUpdate=t.colorsNeedUpdate,n.uvsNeedUpdate=t.uvsNeedUpdate,n.groupsNeedUpdate=t.groupsNeedUpdate,t.verticesNeedUpdate=!1,t.normalsNeedUpdate=!1,t.colorsNeedUpdate=!1,t.uvsNeedUpdate=!1,t.groupsNeedUpdate=!1,t=n}var r;return!0===t.verticesNeedUpdate&&(r=this.attributes.position,void 0!==r&&(r.copyVector3sArray(t.vertices),r.needsUpdate=!0),t.verticesNeedUpdate=!1),!0===t.normalsNeedUpdate&&(r=this.attributes.normal,void 0!==r&&(r.copyVector3sArray(t.normals),r.needsUpdate=!0),t.normalsNeedUpdate=!1),!0===t.colorsNeedUpdate&&(r=this.attributes.color,void 0!==r&&(r.copyColorsArray(t.colors),r.needsUpdate=!0),t.colorsNeedUpdate=!1),t.uvsNeedUpdate&&(r=this.attributes.uv,void 0!==r&&(r.copyVector2sArray(t.uvs),r.needsUpdate=!0),t.uvsNeedUpdate=!1),t.lineDistancesNeedUpdate&&(r=this.attributes.lineDistance,void 0!==r&&(r.copyArray(t.lineDistances),r.needsUpdate=!0),t.lineDistancesNeedUpdate=!1),t.groupsNeedUpdate&&(t.computeGroups(e.geometry),this.groups=t.groups,t.groupsNeedUpdate=!1),this},fromGeometry:function(e){return e.__directGeometry=(new Ee).fromGeometry(e),this.fromDirectGeometry(e.__directGeometry)},fromDirectGeometry:function(e){var t=new Float32Array(3*e.vertices.length);if(this.addAttribute("position",new me(t,3).copyVector3sArray(e.vertices)),e.normals.length>0){var n=new Float32Array(3*e.normals.length);this.addAttribute("normal",new me(n,3).copyVector3sArray(e.normals))}if(e.colors.length>0){var r=new Float32Array(3*e.colors.length);this.addAttribute("color",new me(r,3).copyColorsArray(e.colors))}if(e.uvs.length>0){var i=new Float32Array(2*e.uvs.length);this.addAttribute("uv",new me(i,2).copyVector2sArray(e.uvs))}if(e.uvs2.length>0){var o=new Float32Array(2*e.uvs2.length);this.addAttribute("uv2",new me(o,2).copyVector2sArray(e.uvs2))}if(e.indices.length>0){var a=Te(e.indices)>65535?Uint32Array:Uint16Array,s=new a(3*e.indices.length);this.setIndex(new me(s,1).copyIndicesArray(e.indices))}this.groups=e.groups;for(var l in e.morphTargets){for(var u=[],c=e.morphTargets[l],d=0,h=c.length;d0){var m=new Me(4*e.skinIndices.length,4);this.addAttribute("skinIndex",m.copyVector4sArray(e.skinIndices))}if(e.skinWeights.length>0){var g=new Me(4*e.skinWeights.length,4);this.addAttribute("skinWeight",g.copyVector4sArray(e.skinWeights))}return null!==e.boundingSphere&&(this.boundingSphere=e.boundingSphere.clone()),null!==e.boundingBox&&(this.boundingBox=e.boundingBox.clone()),this},computeBoundingBox:function(){null===this.boundingBox&&(this.boundingBox=new te);var e=this.attributes.position;void 0!==e?this.boundingBox.setFromBufferAttribute(e):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 e=new te,t=new c;return function(){null===this.boundingSphere&&(this.boundingSphere=new ne);var n=this.attributes.position;if(n){var r=this.boundingSphere.center;e.setFromBufferAttribute(n),e.getCenter(r);for(var i=0,o=0,a=n.count;o0&&(e.data.groups=JSON.parse(JSON.stringify(s)));var l=this.boundingSphere;return null!==l&&(e.data.boundingSphere={center:l.center.toArray(),radius:l.radius}),e},clone:function(){return(new Ce).copy(this)},copy:function(e){var t,n,r;this.index=null,this.attributes={},this.morphAttributes={},this.groups=[],this.boundingBox=null,this.boundingSphere=null,this.name=e.name;var i=e.index;null!==i&&this.setIndex(i.clone());var o=e.attributes;for(t in o){var a=o[t];this.addAttribute(t,a.clone())}var s=e.morphAttributes;for(t in s){var l=[],u=s[t];for(n=0,r=u.length;n0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(var t=0,n=e.length;tt.far?null:{distance:l,point:x.clone(),object:e}}function n(n,r,i,o,a,c,d,h){s.fromBufferAttribute(o,c),l.fromBufferAttribute(o,d),u.fromBufferAttribute(o,h);var f=t(n,r,i,s,l,u,b);return f&&(a&&(m.fromBufferAttribute(a,c),g.fromBufferAttribute(a,d),v.fromBufferAttribute(a,h),f.uv=e(b,s,l,u,m,g,v)),f.face=new fe(c,d,h,he.normal(s,l,u)),f.faceIndex=c),f}var r=new d,o=new se,a=new ne,s=new c,l=new c,u=new c,h=new c,f=new c,p=new c,m=new i,g=new i,v=new i,y=new c,b=new c,x=new c;return function(i,c){var d=this.geometry,y=this.material,x=this.matrixWorld;if(void 0!==y&&(null===d.boundingSphere&&d.computeBoundingSphere(),a.copy(d.boundingSphere),a.applyMatrix4(x),!1!==i.ray.intersectsSphere(a)&&(r.getInverse(x),o.copy(i.ray).applyMatrix4(r),null===d.boundingBox||!1!==o.intersectsBox(d.boundingBox)))){var _;if(d.isBufferGeometry){var w,M,S,E,T,k=d.index,O=d.attributes.position,C=d.attributes.uv;if(null!==k)for(E=0,T=k.count;E0&&(L=B);for(var F=0,U=N.length;Fthis.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)}}),vt.prototype=Object.assign(Object.create(ce.prototype),{constructor:vt,copy:function(e){ce.prototype.copy.call(this,e,!1);for(var t=e.levels,n=0,r=t.length;n1){e.setFromMatrixPosition(n.matrixWorld),t.setFromMatrixPosition(this.matrixWorld);var i=e.distanceTo(t);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 S=r.ray.origin.distanceTo(f);Sr.far||i.push({distance:S,point:h.clone().applyMatrix4(this.matrixWorld),index:b,face:null,faceIndex:null,object:this})}}else for(var b=0,x=v.length/3-1;ba)){f.applyMatrix4(this.matrixWorld);var S=r.ray.origin.distanceTo(f);Sr.far||i.push({distance:S,point:h.clone().applyMatrix4(this.matrixWorld),index:b,face:null,faceIndex:null,object:this})}}}else if(s.isGeometry)for(var E=s.vertices,T=E.length,b=0;ba)){f.applyMatrix4(this.matrixWorld);var S=r.ray.origin.distanceTo(f);Sr.far||i.push({distance:S,point:h.clone().applyMatrix4(this.matrixWorld),index:b,face:null,faceIndex:null,object:this})}}}}}(),clone:function(){return new this.constructor(this.geometry,this.material).copy(this)}}),Mt.prototype=Object.assign(Object.create(wt.prototype),{constructor:Mt,isLineSegments:!0}),St.prototype=Object.create(Q.prototype),St.prototype.constructor=St,St.prototype.isPointsMaterial=!0,St.prototype.copy=function(e){return Q.prototype.copy.call(this,e),this.color.copy(e.color),this.map=e.map,this.size=e.size,this.sizeAttenuation=e.sizeAttenuation,this},Et.prototype=Object.assign(Object.create(ce.prototype),{constructor:Et,isPoints:!0,raycast:function(){var e=new d,t=new se,n=new ne;return function(r,i){function o(e,n){var o=t.distanceSqToPoint(e);if(or.far)return;i.push({distance:u,distanceToRay:Math.sqrt(o),point:s.clone(),index:n,face:null,object:a})}}var a=this,s=this.geometry,l=this.matrixWorld,u=r.params.Points.threshold;if(null===s.boundingSphere&&s.computeBoundingSphere(),n.copy(s.boundingSphere),n.applyMatrix4(l),!1!==r.ray.intersectsSphere(n)){e.getInverse(l),t.copy(r.ray).applyMatrix4(e);var d=u/((this.scale.x+this.scale.y+this.scale.z)/3),h=d*d,f=new c;if(s.isBufferGeometry){var p=s.index,m=s.attributes,g=m.position.array;if(null!==p)for(var v=p.array,y=0,b=v.length;y=-Number.EPSILON&&O>=-Number.EPSILON&&k>=-Number.EPSILON))return!1;return!0}return function(t,n){var r=t.length;if(r<3)return null;var i,o,a,s=[],l=[],u=[];if(Cs.area(t)>0)for(o=0;o2;){if(d--<=0)return console.warn("THREE.ShapeUtils: Unable to triangulate polygon! in triangulate()"),n?u:s;if(i=o,c<=i&&(i=0),o=i+1,c<=o&&(o=0),a=o+1,c<=a&&(a=0),e(t,i,o,a,c,l)){var h,f,p,m,g;for(h=l[i],f=l[o],p=l[a],s.push([t[h],t[f],t[p]]),u.push([l[i],l[o],l[a]]),m=o,g=o+1;g2&&e[t-1].equals(e[0])&&e.pop()}function r(e,t,n){return e.x!==t.x?e.xNumber.EPSILON){var p;if(h>0){if(f<0||f>h)return[];if((p=u*c-l*d)<0||p>h)return[]}else{if(f>0||f0||pE?[]:x===E?o?[]:[y]:_<=E?[y,b]:[y,M]}function o(e,t,n,r){var i=t.x-e.x,o=t.y-e.y,a=n.x-e.x,s=n.y-e.y,l=r.x-e.x,u=r.y-e.y,c=i*s-o*a,d=i*u-o*l;if(Math.abs(c)>Number.EPSILON){var h=l*s-u*a;return c>0?d>=0&&h>=0:d>=0||h>=0}return d>0}n(e),t.forEach(n);for(var a,s,l,u,c,d,h={},f=e.concat(),p=0,m=t.length;p0;){if(--_<0){console.log("Infinite Loop! Holes left:"+g.length+", Probably Hole outside Shape!");break}for(a=x;ar&&(a=0);var s=o(m[e],m[i],m[a],n[t]);if(!s)return!1;var l=n.length-1,u=t-1;u<0&&(u=l);var c=t+1;return c>l&&(c=0),!!(s=o(n[t],n[u],n[c],m[e]))}(a,w)&&!function(e,t){var n,r,o;for(n=0;n0)return!0;return!1}(s,l)&&!function(e,n){var r,o,a,s,l;for(r=0;r0)return!0;return!1}(s,l)){r=w,g.splice(y,1),d=m.slice(0,a+1),h=m.slice(a),f=n.slice(r),p=n.slice(0,r+1),m=d.concat(f).concat(p).concat(h),x=a;break}if(r>=0)break;v[c]=!0}if(r>=0)break}}return m}(e,t),v=Cs.triangulate(g,!1);for(a=0,s=v.length;aNumber.EPSILON){var f=Math.sqrt(d),p=Math.sqrt(u*u+c*c),m=t.x-l/f,g=t.y+s/f,v=n.x-c/p,y=n.y+u/p,b=((v-m)*c-(y-g)*u)/(s*c-l*u);r=m+s*b-e.x,o=g+l*b-e.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?u>Number.EPSILON&&(_=!0):s<-Number.EPSILON?u<-Number.EPSILON&&(_=!0):Math.sign(l)===Math.sign(c)&&(_=!0),_?(r=-l,o=s,a=Math.sqrt(d)):(r=s,o=l,a=Math.sqrt(d/2))}return new i(r/a,o/a)}function o(e,t){var n,r;for(G=e.length;--G>=0;){n=G,r=G-1,r<0&&(r=e.length-1);var i=0,o=_+2*y;for(i=0;i=0;z--){for(B=z/y,F=g*Math.cos(B*Math.PI/2),N=v*Math.sin(B*Math.PI/2),G=0,Y=I.length;G0||0===e.search(/^data\:image\/jpeg/);i.format=r?Ca:Pa,i.image=n,i.needsUpdate=!0,void 0!==t&&t(i)},n,r),i},setCrossOrigin:function(e){return this.crossOrigin=e,this},setPath:function(e){return this.path=e,this}}),An.prototype=Object.assign(Object.create(ce.prototype),{constructor:An,isLight:!0,copy:function(e){return ce.prototype.copy.call(this,e),this.color.copy(e.color),this.intensity=e.intensity,this},toJSON:function(e){var t=ce.prototype.toJSON.call(this,e);return t.object.color=this.color.getHex(),t.object.intensity=this.intensity,void 0!==this.groundColor&&(t.object.groundColor=this.groundColor.getHex()),void 0!==this.distance&&(t.object.distance=this.distance),void 0!==this.angle&&(t.object.angle=this.angle),void 0!==this.decay&&(t.object.decay=this.decay),void 0!==this.penumbra&&(t.object.penumbra=this.penumbra),void 0!==this.shadow&&(t.object.shadow=this.shadow.toJSON()),t}}),Rn.prototype=Object.assign(Object.create(An.prototype),{constructor:Rn,isHemisphereLight:!0,copy:function(e){return An.prototype.copy.call(this,e),this.groundColor.copy(e.groundColor),this}}),Object.assign(Ln.prototype,{copy:function(e){return this.camera=e.camera.clone(),this.bias=e.bias,this.radius=e.radius,this.mapSize.copy(e.mapSize),this},clone:function(){return(new this.constructor).copy(this)},toJSON:function(){var e={};return 0!==this.bias&&(e.bias=this.bias),1!==this.radius&&(e.radius=this.radius),512===this.mapSize.x&&512===this.mapSize.y||(e.mapSize=this.mapSize.toArray()),e.camera=this.camera.toJSON(!1).object,delete e.camera.matrix,e}}),Dn.prototype=Object.assign(Object.create(Ln.prototype),{constructor:Dn,isSpotLightShadow:!0,update:function(e){var t=2*fs.RAD2DEG*e.angle,n=this.mapSize.width/this.mapSize.height,r=e.distance||500,i=this.camera;t===i.fov&&n===i.aspect&&r===i.far||(i.fov=t,i.aspect=n,i.far=r,i.updateProjectionMatrix())}}),In.prototype=Object.assign(Object.create(An.prototype),{constructor:In,isSpotLight:!0,copy:function(e){return An.prototype.copy.call(this,e),this.distance=e.distance,this.angle=e.angle,this.penumbra=e.penumbra,this.decay=e.decay,this.target=e.target.clone(),this.shadow=e.shadow.clone(),this}}),zn.prototype=Object.assign(Object.create(An.prototype),{constructor:zn,isPointLight:!0,copy:function(e){return An.prototype.copy.call(this,e),this.distance=e.distance,this.decay=e.decay,this.shadow=e.shadow.clone(),this}}),Nn.prototype=Object.assign(Object.create(Ln.prototype),{constructor:Nn}),Bn.prototype=Object.assign(Object.create(An.prototype),{constructor:Bn,isDirectionalLight:!0,copy:function(e){return An.prototype.copy.call(this,e),this.target=e.target.clone(),this.shadow=e.shadow.clone(),this}}),Fn.prototype=Object.assign(Object.create(An.prototype),{constructor:Fn,isAmbientLight:!0});var Ds={arraySlice:function(e,t,n){return Ds.isTypedArray(e)?new e.constructor(e.subarray(t,n)):e.slice(t,n)},convertArray:function(e,t,n){return!e||!n&&e.constructor===t?e:"number"==typeof t.BYTES_PER_ELEMENT?new t(e):Array.prototype.slice.call(e)},isTypedArray:function(e){return ArrayBuffer.isView(e)&&!(e instanceof DataView)},getKeyframeOrder:function(e){function t(t,n){return e[t]-e[n]}for(var n=e.length,r=new Array(n),i=0;i!==n;++i)r[i]=i;return r.sort(t),r},sortedArray:function(e,t,n){for(var r=e.length,i=new e.constructor(r),o=0,a=0;a!==r;++o)for(var s=n[o]*t,l=0;l!==t;++l)i[a++]=e[s+l];return i},flattenJSON:function(e,t,n,r){for(var i=1,o=e[0];void 0!==o&&void 0===o[r];)o=e[i++];if(void 0!==o){var a=o[r];if(void 0!==a)if(Array.isArray(a))do{a=o[r],void 0!==a&&(t.push(o.time),n.push.apply(n,a)),o=e[i++]}while(void 0!==o);else if(void 0!==a.toArray)do{a=o[r],void 0!==a&&(t.push(o.time),a.toArray(n,n.length)),o=e[i++]}while(void 0!==o);else do{a=o[r],void 0!==a&&(t.push(o.time),n.push(a)),o=e[i++]}while(void 0!==o)}}};Un.prototype={constructor:Un,evaluate:function(e){var t=this.parameterPositions,n=this._cachedIndex,r=t[n],i=t[n-1];e:{t:{var o;n:{r:if(!(e=i)break e;var s=t[1];e=i)break t}o=n,n=0}}for(;n>>1;et;)--o;if(++o,0!==i||o!==r){i>=o&&(o=Math.max(o,1),i=o-1);var a=this.getValueSize();this.times=Ds.arraySlice(n,i,o),this.values=Ds.arraySlice(this.values,i*a,o*a)}return this},validate:function(){var e=!0,t=this.getValueSize();t-Math.floor(t)!=0&&(console.error("invalid value size in track",this),e=!1);var n=this.times,r=this.values,i=n.length;0===i&&(console.error("track is empty",this),e=!1);for(var o=null,a=0;a!==i;a++){var s=n[a];if("number"==typeof s&&isNaN(s)){console.error("time is not a valid number",this,a,s),e=!1;break}if(null!==o&&o>s){console.error("out of order keys",this,a,s,o),e=!1;break}o=s}if(void 0!==r&&Ds.isTypedArray(r))for(var a=0,l=r.length;a!==l;++a){var u=r[a];if(isNaN(u)){console.error("value is not a valid number",this,a,u),e=!1;break}}return e},optimize:function(){for(var e=this.times,t=this.values,n=this.getValueSize(),r=this.getInterpolation()===Ka,i=1,o=e.length-1,a=1;a0){e[i]=e[o];for(var p=o*n,m=i*n,h=0;h!==n;++h)t[m+h]=t[p+h];++i}return i!==e.length&&(this.times=Ds.arraySlice(e,0,i),this.values=Ds.arraySlice(t,0,i*n)),this}},Gn.prototype=Object.assign(Object.create(Is),{constructor:Gn,ValueTypeName:"vector"}),Yn.prototype=Object.assign(Object.create(Un.prototype),{constructor:Yn,interpolate_:function(e,t,n,r){for(var i=this.resultBuffer,o=this.sampleValues,a=this.valueSize,s=e*a,l=(n-t)/(r-t),c=s+a;s!==c;s+=4)u.slerpFlat(i,0,o,s-a,o,s,l);return i}}),qn.prototype=Object.assign(Object.create(Is),{constructor:qn,ValueTypeName:"quaternion",DefaultInterpolation:Za,InterpolantFactoryMethodLinear:function(e){return new Yn(this.times,this.values,this.getValueSize(),e)},InterpolantFactoryMethodSmooth:void 0}),Xn.prototype=Object.assign(Object.create(Is),{constructor:Xn,ValueTypeName:"number"}),Zn.prototype=Object.assign(Object.create(Is),{constructor:Zn,ValueTypeName:"string",ValueBufferType:Array,DefaultInterpolation:Xa,InterpolantFactoryMethodLinear:void 0,InterpolantFactoryMethodSmooth:void 0}),Kn.prototype=Object.assign(Object.create(Is),{constructor:Kn,ValueTypeName:"bool",ValueBufferType:Array,DefaultInterpolation:Xa,InterpolantFactoryMethodLinear:void 0,InterpolantFactoryMethodSmooth:void 0}),Jn.prototype=Object.assign(Object.create(Is),{constructor:Jn,ValueTypeName:"color"}),Qn.prototype=Is,Is.constructor=Qn,Object.assign(Qn,{parse:function(e){if(void 0===e.type)throw new Error("track type undefined, can not parse");var t=Qn._getTrackTypeForValueTypeName(e.type);if(void 0===e.times){var n=[],r=[];Ds.flattenJSON(e.keys,n,r,"value"),e.times=n,e.values=r}return void 0!==t.parse?t.parse(e):new t(e.name,e.times,e.values,e.interpolation)},toJSON:function(e){var t,n=e.constructor;if(void 0!==n.toJSON)t=n.toJSON(e);else{t={name:e.name,times:Ds.convertArray(e.times,Array),values:Ds.convertArray(e.values,Array)};var r=e.getInterpolation();r!==e.DefaultInterpolation&&(t.interpolation=r)}return t.type=e.ValueTypeName,t},_getTrackTypeForValueTypeName:function(e){switch(e.toLowerCase()){case"scalar":case"double":case"float":case"number":case"integer":return Xn;case"vector":case"vector2":case"vector3":case"vector4":return Gn;case"color":return Jn;case"quaternion":return qn;case"bool":case"boolean":return Kn;case"string":return Zn}throw new Error("Unsupported typeName: "+e)}}),$n.prototype={constructor:$n,resetDuration:function(){for(var e=this.tracks,t=0,n=0,r=e.length;n!==r;++n){var i=this.tracks[n];t=Math.max(t,i.times[i.times.length-1])}this.duration=t},trim:function(){for(var e=0;e1){var u=l[1],c=r[u];c||(r[u]=c=[]),c.push(s)}}var d=[];for(var u in r)d.push($n.CreateFromMorphTargetSequence(u,r[u],t,n));return d},parseAnimation:function(e,t){if(!e)return console.error(" no animation in JSONLoader data"),null;for(var n=function(e,t,n,r,i){if(0!==n.length){var o=[],a=[];Ds.flattenJSON(n,o,a,r),0!==o.length&&i.push(new e(t,o,a))}},r=[],i=e.name||"default",o=e.length||-1,a=e.fps||30,s=e.hierarchy||[],l=0;l1?e.skinWeights[r+1]:0,l=t>2?e.skinWeights[r+2]:0,u=t>3?e.skinWeights[r+3]:0;n.skinWeights.push(new a(o,s,l,u))}if(e.skinIndices)for(var r=0,i=e.skinIndices.length;r1?e.skinIndices[r+1]:0,h=t>2?e.skinIndices[r+2]:0,f=t>3?e.skinIndices[r+3]:0;n.skinIndices.push(new a(c,d,h,f))}n.bones=e.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(t){if(void 0!==e.morphTargets)for(var r=0,i=e.morphTargets.length;r0){console.warn('THREE.JSONLoader: "morphColors" no longer supported. Using them as face colors.');for(var d=n.faces,h=e.morphColors[0].colors,r=0,i=d.length;r0&&(n.animations=t)}(),n.computeFaceNormals(),n.computeBoundingSphere(),void 0===e.materials||0===e.materials.length)return{geometry:n};var o=nr.prototype.initMaterials(e.materials,t,this.crossOrigin);return{geometry:n,materials:o}}}),Object.assign(ir.prototype,{load:function(e,t,n,r){""===this.texturePath&&(this.texturePath=e.substring(0,e.lastIndexOf("/")+1));var i=this;new En(i.manager).load(e,function(n){var o=null;try{o=JSON.parse(n)}catch(t){return void 0!==r&&r(t),void console.error("THREE:ObjectLoader: Can't parse "+e+".",t.message)}var a=o.metadata;if(void 0===a||void 0===a.type||"geometry"===a.type.toLowerCase())return void console.error("THREE.ObjectLoader: Can't load "+e+". Use THREE.JSONLoader instead.");i.parse(o,t)},n,r)},setTexturePath:function(e){this.texturePath=e},setCrossOrigin:function(e){this.crossOrigin=e},parse:function(e,t){var n=this.parseGeometries(e.geometries),r=this.parseImages(e.images,function(){void 0!==t&&t(a)}),i=this.parseTextures(e.textures,r),o=this.parseMaterials(e.materials,i),a=this.parseObject(e.object,n,o);return e.animations&&(a.animations=this.parseAnimations(e.animations)),void 0!==e.images&&0!==e.images.length||void 0!==t&&t(a),a},parseGeometries:function(e){var t={};if(void 0!==e)for(var n=new rr,r=new tr,i=0,o=e.length;i0){var i=new Sn(t),o=new On(i);o.setCrossOrigin(this.crossOrigin);for(var a=0,s=e.length;a0?new xt(s,l):new Pe(s,l);break;case"LOD":a=new vt;break;case"Line":a=new wt(i(t.geometry),o(t.material),t.mode);break;case"LineSegments":a=new Mt(i(t.geometry),o(t.material));break;case"PointCloud":case"Points":a=new Et(i(t.geometry),o(t.material));break;case"Sprite":a=new gt(o(t.material));break;case"Group":a=new Tt;break;case"SkinnedMesh":console.warn("THREE.ObjectLoader.parseObject() does not support SkinnedMesh type. Instantiates Object3D instead.");default:a=new ce}if(a.uuid=t.uuid,void 0!==t.name&&(a.name=t.name),void 0!==t.matrix?(e.fromArray(t.matrix),e.decompose(a.position,a.quaternion,a.scale)):(void 0!==t.position&&a.position.fromArray(t.position),void 0!==t.rotation&&a.rotation.fromArray(t.rotation),void 0!==t.quaternion&&a.quaternion.fromArray(t.quaternion),void 0!==t.scale&&a.scale.fromArray(t.scale)),void 0!==t.castShadow&&(a.castShadow=t.castShadow),void 0!==t.receiveShadow&&(a.receiveShadow=t.receiveShadow),t.shadow&&(void 0!==t.shadow.bias&&(a.shadow.bias=t.shadow.bias),void 0!==t.shadow.radius&&(a.shadow.radius=t.shadow.radius),void 0!==t.shadow.mapSize&&a.shadow.mapSize.fromArray(t.shadow.mapSize),void 0!==t.shadow.camera&&(a.shadow.camera=this.parseObject(t.shadow.camera))),void 0!==t.visible&&(a.visible=t.visible),void 0!==t.userData&&(a.userData=t.userData),void 0!==t.children)for(var u in t.children)a.add(this.parseObject(t.children[u],n,r));if("LOD"===t.type)for(var c=t.levels,d=0;d0)){l=i;break}l=i-1}if(i=l,r[i]===n){var u=i/(o-1);return u}var c=r[i],d=r[i+1],h=d-c,f=(n-c)/h,u=(i+f)/(o-1);return u},getTangent:function(e){var t=e-1e-4,n=e+1e-4;t<0&&(t=0),n>1&&(n=1);var r=this.getPoint(t);return this.getPoint(n).clone().sub(r).normalize()},getTangentAt:function(e){var t=this.getUtoTmapping(e);return this.getTangent(t)},computeFrenetFrames:function(e,t){var n,r,i,o=new c,a=[],s=[],l=[],u=new c,h=new d;for(n=0;n<=e;n++)r=n/e,a[n]=this.getTangentAt(r),a[n].normalize();s[0]=new c,l[0]=new c;var f=Number.MAX_VALUE,p=Math.abs(a[0].x),m=Math.abs(a[0].y),g=Math.abs(a[0].z);for(p<=f&&(f=p,o.set(1,0,0)),m<=f&&(f=m,o.set(0,1,0)),g<=f&&o.set(0,0,1),u.crossVectors(a[0],o).normalize(),s[0].crossVectors(a[0],u),l[0].crossVectors(a[0],s[0]),n=1;n<=e;n++)s[n]=s[n-1].clone(),l[n]=l[n-1].clone(),u.crossVectors(a[n-1],a[n]),u.length()>Number.EPSILON&&(u.normalize(),i=Math.acos(fs.clamp(a[n-1].dot(a[n]),-1,1)),s[n].applyMatrix4(h.makeRotationAxis(u,i))),l[n].crossVectors(a[n],s[n]);if(!0===t)for(i=Math.acos(fs.clamp(s[0].dot(s[e]),-1,1)),i/=e,a[0].dot(u.crossVectors(s[0],s[e]))>0&&(i=-i),n=1;n<=e;n++)s[n].applyMatrix4(h.makeRotationAxis(a[n],i*n)),l[n].crossVectors(a[n],s[n]);return{tangents:a,normals:s,binormals:l}}},gr.prototype=Object.create(mr.prototype),gr.prototype.constructor=gr,gr.prototype.isLineCurve=!0,gr.prototype.getPoint=function(e){if(1===e)return this.v2.clone();var t=this.v2.clone().sub(this.v1);return t.multiplyScalar(e).add(this.v1),t},gr.prototype.getPointAt=function(e){return this.getPoint(e)},gr.prototype.getTangent=function(e){return this.v2.clone().sub(this.v1).normalize()},vr.prototype=Object.assign(Object.create(mr.prototype),{constructor:vr,add:function(e){this.curves.push(e)},closePath:function(){var e=this.curves[0].getPoint(0),t=this.curves[this.curves.length-1].getPoint(1);e.equals(t)||this.curves.push(new gr(t,e))},getPoint:function(e){for(var t=e*this.getLength(),n=this.getCurveLengths(),r=0;r=t){var i=n[r]-t,o=this.curves[r],a=o.getLength(),s=0===a?0:1-i/a;return o.getPointAt(s)}r++}return null},getLength:function(){var e=this.getCurveLengths();return e[e.length-1]},updateArcLengths:function(){this.needsUpdate=!0,this.cacheLengths=null,this.getLengths()},getCurveLengths:function(){if(this.cacheLengths&&this.cacheLengths.length===this.curves.length)return this.cacheLengths;for(var e=[],t=0,n=0,r=this.curves.length;n1&&!n[n.length-1].equals(n[0])&&n.push(n[0]),n},createPointsGeometry:function(e){var t=this.getPoints(e);return this.createGeometry(t)},createSpacedPointsGeometry:function(e){var t=this.getSpacedPoints(e);return this.createGeometry(t)},createGeometry:function(e){for(var t=new Oe,n=0,r=e.length;nt;)n-=t;nt.length-2?t.length-1:r+1],u=t[r>t.length-3?t.length-1:r+2];return new i(or(o,a.x,s.x,l.x,u.x),or(o,a.y,s.y,l.y,u.y))},xr.prototype=Object.create(mr.prototype),xr.prototype.constructor=xr,xr.prototype.getPoint=function(e){var t=this.v0,n=this.v1,r=this.v2,o=this.v3;return new i(pr(e,t.x,n.x,r.x,o.x),pr(e,t.y,n.y,r.y,o.y))},_r.prototype=Object.create(mr.prototype),_r.prototype.constructor=_r,_r.prototype.getPoint=function(e){var t=this.v0,n=this.v1,r=this.v2;return new i(ur(e,t.x,n.x,r.x),ur(e,t.y,n.y,r.y))};var zs=Object.assign(Object.create(vr.prototype),{fromPoints:function(e){this.moveTo(e[0].x,e[0].y);for(var t=1,n=e.length;t0){var u=l.getPoint(0);u.equals(this.currentPoint)||this.lineTo(u.x,u.y)}this.curves.push(l);var c=l.getPoint(1);this.currentPoint.copy(c)}});wr.prototype=zs,zs.constructor=wr,Mr.prototype=Object.assign(Object.create(zs),{constructor:Mr,getPointsHoles:function(e){for(var t=[],n=0,r=this.holes.length;n1){for(var v=!1,y=[],b=0,x=h.length;bNumber.EPSILON){if(u<0&&(a=t[o],l=-l,s=t[i],u=-u),e.ys.y)continue;if(e.y===a.y){if(e.x===a.x)return!0}else{var c=u*(e.x-a.x)-l*(e.y-a.y);if(0===c)return!0;if(c<0)continue;r=!r}}else{if(e.y!==a.y)continue;if(s.x<=e.x&&e.x<=a.x||a.x<=e.x&&e.x<=s.x)return!0}}return r})(M.p,h[E].p)&&(b!==E&&y.push({froms:b,tos:E,hole:w}),S?(S=!1,d[E].push(M)):v=!0);S&&d[b].push(M)}y.length>0&&(v||(f=d))}for(var T,m=0,k=h.length;m0){this.source.connect(this.filters[0]);for(var e=1,t=this.filters.length;e0){this.source.disconnect(this.filters[0]);for(var e=1,t=this.filters.length;e=.5)for(var o=0;o!==i;++o)e[t+o]=e[n+o]},_slerp:function(e,t,n,r,i){u.slerpFlat(e,t,e,t,e,n,r)},_lerp:function(e,t,n,r,i){for(var o=1-r,a=0;a!==i;++a){var s=t+a;e[s]=e[s]*o+e[n+a]*r}}},zr.prototype={constructor:zr,getValue:function(e,t){this.bind(),this.getValue(e,t)},setValue:function(e,t){this.bind(),this.setValue(e,t)},bind:function(){var e=this.node,t=this.parsedPath,n=t.objectName,r=t.propertyName,i=t.propertyIndex;if(e||(e=zr.findNode(this.rootNode,t.nodeName)||this.rootNode,this.node=e),this.getValue=this._getValue_unavailable,this.setValue=this._setValue_unavailable,!e)return void console.error(" trying to update node for track: "+this.path+" but it wasn't found.");if(n){var o=t.objectIndex;switch(n){case"materials":if(!e.material)return void console.error(" can not bind to material as node does not have a material",this);if(!e.material.materials)return void console.error(" can not bind to material.materials as node.material does not have a materials array",this);e=e.material.materials;break;case"bones":if(!e.skeleton)return void console.error(" can not bind to bones as node does not have a skeleton",this);e=e.skeleton.bones;for(var a=0;a=n){var d=n++,h=t[d];r[h.uuid]=c,t[c]=h,r[u]=d,t[d]=l;for(var f=0,p=o;f!==p;++f){var m=i[f],g=m[d],v=m[c];m[c]=g,m[d]=v}}}this.nCachedObjects_=n},uncache:function(e){for(var t=this._objects,n=t.length,r=this.nCachedObjects_,i=this._indicesByUUID,o=this._bindings,a=o.length,s=0,l=arguments.length;s!==l;++s){var u=arguments[s],c=u.uuid,d=i[c];if(void 0!==d)if(delete i[c],d0)for(var l=this._interpolants,u=this._propertyBindings,c=0,d=l.length;c!==d;++c)l[c].evaluate(a),u[c].accumulate(r,s)},_updateWeight:function(e){var t=0;if(this.enabled){t=this.weight;var n=this._weightInterpolant;if(null!==n){var r=n.evaluate(e)[0];t*=r,e>n.parameterPositions[1]&&(this.stopFading(),0===r&&(this.enabled=!1))}}return this._effectiveWeight=t,t},_updateTimeScale:function(e){var t=0;if(!this.paused){t=this.timeScale;var n=this._timeScaleInterpolant;if(null!==n){t*=n.evaluate(e)[0],e>n.parameterPositions[1]&&(this.stopWarping(),0===t?this.paused=!0:this.timeScale=t)}}return this._effectiveTimeScale=t,t},_updateTime:function(e){var t=this.time+e;if(0===e)return t;var n=this._clip.duration,r=this.loop,i=this._loopCount;if(r===Ga){-1===i&&(this._loopCount=0,this._setEndings(!0,!0,!1));e:{if(t>=n)t=n;else{if(!(t<0))break e;t=0}this.clampWhenFinished?this.paused=!0:this.enabled=!1,this._mixer.dispatchEvent({type:"finished",action:this,direction:e<0?-1:1})}}else{var o=r===qa;if(-1===i&&(e>=0?(i=0,this._setEndings(!0,0===this.repetitions,o)):this._setEndings(0===this.repetitions,!0,o)),t>=n||t<0){var a=Math.floor(t/n);t-=n*a,i+=Math.abs(a);var s=this.repetitions-i;if(s<0)this.clampWhenFinished?this.paused=!0:this.enabled=!1,t=e>0?n:0,this._mixer.dispatchEvent({type:"finished",action:this,direction:e>0?1:-1});else{if(0===s){var l=e<0;this._setEndings(l,!l,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=t,n-t}return this.time=t,t},_setEndings:function(e,t,n){var r=this._interpolantSettings;n?(r.endingStart=Qa,r.endingEnd=Qa):(r.endingStart=e?this.zeroSlopeAtStart?Qa:Ja:$a,r.endingEnd=t?this.zeroSlopeAtEnd?Qa:Ja:$a)},_scheduleFading:function(e,t,n){var r=this._mixer,i=r.time,o=this._weightInterpolant;null===o&&(o=r._lendControlInterpolant(),this._weightInterpolant=o);var a=o.parameterPositions,s=o.sampleValues;return a[0]=i,s[0]=t,a[1]=i+e,s[1]=n,this}},Fr.prototype={constructor:Fr,clipAction:function(e,t){var n=t||this._root,r=n.uuid,i="string"==typeof e?$n.findByName(n,e):e,o=null!==i?i.uuid:e,a=this._actionsByClip[o],s=null;if(void 0!==a){var l=a.actionByRoot[r];if(void 0!==l)return l;s=a.knownActions[0],null===i&&(i=s._clip)}if(null===i)return null;var u=new Br(this,i,t);return this._bindAction(u,s),this._addInactiveAction(u,o,r),u},existingAction:function(e,t){var n=t||this._root,r=n.uuid,i="string"==typeof e?$n.findByName(n,e):e,o=i?i.uuid:e,a=this._actionsByClip[o];return void 0!==a?a.actionByRoot[r]||null:null},stopAllAction:function(){var e=this._actions,t=this._nActiveActions,n=this._bindings,r=this._nActiveBindings;this._nActiveActions=0,this._nActiveBindings=0;for(var i=0;i!==t;++i)e[i].reset();for(var i=0;i!==r;++i)n[i].useCount=0;return this},update:function(e){e*=this.timeScale;for(var t=this._actions,n=this._nActiveActions,r=this.time+=e,i=Math.sign(e),o=this._accuIndex^=1,a=0;a!==n;++a){var s=t[a];s.enabled&&s._update(r,e,i,o)}for(var l=this._bindings,u=this._nActiveBindings,a=0;a!==u;++a)l[a].apply(o);return this},getRoot:function(){return this._root},uncacheClip:function(e){var t=this._actions,n=e.uuid,r=this._actionsByClip,i=r[n];if(void 0!==i){for(var o=i.knownActions,a=0,s=o.length;a!==s;++a){var l=o[a];this._deactivateAction(l);var u=l._cacheIndex,c=t[t.length-1];l._cacheIndex=null,l._byClipCacheIndex=null,c._cacheIndex=u,t[u]=c,t.pop(),this._removeInactiveBindingsForAction(l)}delete r[n]}},uncacheRoot:function(e){var t=e.uuid,n=this._actionsByClip;for(var r in n){var i=n[r].actionByRoot,o=i[t];void 0!==o&&(this._deactivateAction(o),this._removeInactiveAction(o))}var a=this._bindingsByRootAndName,s=a[t];if(void 0!==s)for(var l in s){var u=s[l];u.restoreOriginalState(),this._removeInactiveBinding(u)}},uncacheAction:function(e,t){var n=this.existingAction(e,t);null!==n&&(this._deactivateAction(n),this._removeInactiveAction(n))}},Object.assign(Fr.prototype,{_bindAction:function(e,t){var n=e._localRoot||this._root,r=e._clip.tracks,i=r.length,o=e._propertyBindings,a=e._interpolants,s=n.uuid,l=this._bindingsByRootAndName,u=l[s];void 0===u&&(u={},l[s]=u);for(var c=0;c!==i;++c){var d=r[c],h=d.name,f=u[h];if(void 0!==f)o[c]=f;else{if(void 0!==(f=o[c])){null===f._cacheIndex&&(++f.referenceCount,this._addInactiveBinding(f,s,h));continue}var p=t&&t._propertyBindings[c].binding.parsedPath;f=new Ir(zr.create(n,h,p),d.ValueTypeName,d.getValueSize()),++f.referenceCount,this._addInactiveBinding(f,s,h),o[c]=f}a[c].resultBuffer=f.buffer}},_activateAction:function(e){if(!this._isActiveAction(e)){if(null===e._cacheIndex){var t=(e._localRoot||this._root).uuid,n=e._clip.uuid,r=this._actionsByClip[n];this._bindAction(e,r&&r.knownActions[0]),this._addInactiveAction(e,n,t)}for(var i=e._propertyBindings,o=0,a=i.length;o!==a;++o){var s=i[o];0==s.useCount++&&(this._lendBinding(s),s.saveOriginalState())}this._lendAction(e)}},_deactivateAction:function(e){if(this._isActiveAction(e)){for(var t=e._propertyBindings,n=0,r=t.length;n!==r;++n){var i=t[n];0==--i.useCount&&(i.restoreOriginalState(),this._takeBackBinding(i))}this._takeBackAction(e)}},_initMemoryManager:function(){this._actions=[],this._nActiveActions=0,this._actionsByClip={},this._bindings=[],this._nActiveBindings=0,this._bindingsByRootAndName={},this._controlInterpolants=[],this._nActiveControlInterpolants=0;var e=this;this.stats={actions:{get total(){return e._actions.length},get inUse(){return e._nActiveActions}},bindings:{get total(){return e._bindings.length},get inUse(){return e._nActiveBindings}},controlInterpolants:{get total(){return e._controlInterpolants.length},get inUse(){return e._nActiveControlInterpolants}}}},_isActiveAction:function(e){var t=e._cacheIndex;return null!==t&&t1){var u=l[1];r[u]||(r[u]={start:1/0,end:-1/0});var c=r[u];oc.end&&(c.end=o),t||(t=u)}}for(var u in r){var c=r[u];this.createAnimation(u,c.start,c.end,e)}this.firstAnimation=t},Qr.prototype.setAnimationDirectionForward=function(e){var t=this.animationsMap[e];t&&(t.direction=1,t.directionBackwards=!1)},Qr.prototype.setAnimationDirectionBackward=function(e){var t=this.animationsMap[e];t&&(t.direction=-1,t.directionBackwards=!0)},Qr.prototype.setAnimationFPS=function(e,t){var n=this.animationsMap[e];n&&(n.fps=t,n.duration=(n.end-n.start)/n.fps)},Qr.prototype.setAnimationDuration=function(e,t){var n=this.animationsMap[e];n&&(n.duration=t,n.fps=(n.end-n.start)/n.duration)},Qr.prototype.setAnimationWeight=function(e,t){var n=this.animationsMap[e];n&&(n.weight=t)},Qr.prototype.setAnimationTime=function(e,t){var n=this.animationsMap[e];n&&(n.time=t)},Qr.prototype.getAnimationTime=function(e){var t=0,n=this.animationsMap[e];return n&&(t=n.time),t},Qr.prototype.getAnimationDuration=function(e){var t=-1,n=this.animationsMap[e];return n&&(t=n.duration),t},Qr.prototype.playAnimation=function(e){var t=this.animationsMap[e];t?(t.time=0,t.active=!0):console.warn("THREE.MorphBlendMesh: animation["+e+"] undefined in .playAnimation()")},Qr.prototype.stopAnimation=function(e){var t=this.animationsMap[e];t&&(t.active=!1)},Qr.prototype.update=function(e){for(var t=0,n=this.animationsList.length;tr.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}}},$r.prototype=Object.create(ce.prototype),$r.prototype.constructor=$r,$r.prototype.isImmediateRenderObject=!0,ei.prototype=Object.create(Mt.prototype),ei.prototype.constructor=ei,ei.prototype.update=function(){var e=new c,t=new c,n=new re;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,l=a.faces,u=0,c=0,d=l.length;c.99999?this.quaternion.set(0,0,0,1):n.y<-.99999?this.quaternion.set(1,0,0,0):(t.set(n.z,0,-n.x).normalize(),e=Math.acos(n.y),this.quaternion.setFromAxisAngle(t,e))}}(),hi.prototype.setLength=function(e,t,n){void 0===t&&(t=.2*e),void 0===n&&(n=.2*t),this.line.scale.set(1,Math.max(0,e-t),1),this.line.updateMatrix(),this.cone.scale.set(n,t,n),this.cone.position.y=e,this.cone.updateMatrix()},hi.prototype.setColor=function(e){this.line.material.color.copy(e),this.cone.material.color.copy(e)},fi.prototype=Object.create(Mt.prototype),fi.prototype.constructor=fi;var js=new c,Ws=new pi,Vs=new pi,Hs=new pi;mi.prototype=Object.create(mr.prototype),mi.prototype.constructor=mi,mi.prototype.getPoint=function(e){var t=this.points,n=t.length;n<2&&console.log("duh, you need at least 2 points");var r=(n-(this.closed?0:1))*e,i=Math.floor(r),o=r-i;this.closed?i+=i>0?0:(Math.floor(Math.abs(i)/t.length)+1)*t.length:0===o&&i===n-1&&(i=n-2,o=1);var a,s,l,u;if(this.closed||i>0?a=t[(i-1)%n]:(js.subVectors(t[0],t[1]).add(t[0]),a=js),s=t[i%n],l=t[(i+1)%n],this.closed||i+2",i="function"==typeof e?e:t,o="function"==typeof e?t:n;return xt("function"==typeof i,gt("m002")),xt(0===i.length,gt("m003")),xt("string"==typeof r&&r.length>0,"actions should have valid names, got: '"+r+"'"),B(r,i,o,void 0)}function o(e){return"function"==typeof e&&!0===e.isMobxAction}function a(e,t,n){var r=function(){return B(t,n,e,arguments)};r.isMobxAction=!0,Ot(e,t,r)}function s(e,t,n){function r(){a(l)}var i,a,s;"string"==typeof e?(i=e,a=t,s=n):(i=e.name||"Autorun@"+yt(),a=e,s=t),xt("function"==typeof a,gt("m004")),xt(!1===o(a),gt("m005")),s&&(a=a.bind(s));var l=new fn(i,function(){this.track(r)});return l.schedule(),l.getDisposer()}function l(e,t,n,r){var i,o,a,l;return"string"==typeof e?(i=e,o=t,a=n,l=r):(i="When@"+yt(),o=e,a=t,l=n),s(i,function(e){if(o.call(l)){e.dispose();var t=te();a.call(l),ne(t)}})}function u(e,t,n,r){function i(){s(d)}var a,s,l,u;"string"==typeof e?(a=e,s=t,l=n,u=r):(a=e.name||"AutorunAsync@"+yt(),s=e,l=t,u=n),xt(!1===o(s),gt("m006")),void 0===l&&(l=1),u&&(s=s.bind(u));var c=!1,d=new fn(a,function(){c||(c=!0,setTimeout(function(){c=!1,d.isDisposed||d.track(i)},l))});return d.schedule(),d.getDisposer()}function c(e,t,n){function r(){if(!l.isDisposed){var n=!1;l.track(function(){var t=e(l);n=Ct(i.compareStructural,o,t),o=t}),a&&i.fireImmediately&&t(o,l),a||!0!==n||t(o,l),a&&(a=!1)}}arguments.length>3&&bt(gt("m007")),Fe(e)&&bt(gt("m008"));var i;i="object"==typeof n?n:{},i.name=i.name||e.name||t.name||"Reaction@"+yt(),i.fireImmediately=!0===n||!0===i.fireImmediately,i.delay=i.delay||0,i.compareStructural=i.compareStructural||i.struct||!1,t=Gt(i.name,i.context?t.bind(i.context):t),i.context&&(e=e.bind(i.context));var o,a=!0,s=!1,l=new fn(i.name,function(){a||i.delay<1?r():s||(s=!0,setTimeout(function(){s=!1,r()},i.delay))});return l.schedule(),l.getDisposer()}function d(e){return ut(function(t,n,r,i,o){xt(void 0!==o,gt("m009")),xt("function"==typeof o.get,gt("m010")),Qe(Ke(t,""),n,o.get,o.set,e,!1)},function(e){var t=this.$mobx.values[e];if(void 0!==t)return t.get()},function(e,t){this.$mobx.values[e].set(t)},!1,!1)}function h(e,t){xt("function"==typeof e&&e.length<2,"createTransformer expects a function that accepts one argument");var n={},r=hn.resetId,i=function(r){function i(t,n){var i=r.call(this,function(){return e(n)},void 0,!1,"Transformer-"+e.name+"-"+t,void 0)||this;return i.sourceIdentifier=t,i.sourceObject=n,i}return Wt(i,r),i.prototype.onBecomeUnobserved=function(){var e=this.value;r.prototype.onBecomeUnobserved.call(this),delete n[this.sourceIdentifier],t&&t(e,this.sourceObject)},i}(an);return function(e){r!==hn.resetId&&(n={},r=hn.resetId);var t=f(e),o=n[t];return o?o.get():(o=n[t]=new i(t,e),o.get())}}function f(e){if("string"==typeof e||"number"==typeof e)return e;if(null===e||"object"!=typeof e)throw new Error("[mobx] transform expected some kind of object or primitive value, got: "+e);var t=e.$transformId;return void 0===t&&(t=yt(),Ot(e,"$transformId",t)),t}function p(e,t){return Z()||console.warn(gt("m013")),qt(e,{context:t}).get()}function m(e){for(var t=[],n=1;n=2,gt("m014")),xt("object"==typeof e,gt("m015")),xt(!kn(e),gt("m016")),n.forEach(function(e){xt("object"==typeof e,gt("m017")),xt(!T(e),gt("m018"))});for(var r=Ke(e),i={},o=n.length-1;o>=0;o--){var a=n[o];for(var s in a)if(!0!==i[s]&&Pt(a,s)){if(i[s]=!0,e===a&&!Rt(e,s))continue;var l=Object.getOwnPropertyDescriptor(a,s);Je(r,s,l,t)}}return e}function y(e,t){return b(at(e,t))}function b(e){var t={name:e.name};return e.observing&&e.observing.length>0&&(t.dependencies=Mt(e.observing).map(b)),t}function x(e,t){return _(at(e,t))}function _(e){var t={name:e.name};return se(e)&&(t.observers=le(e).map(_)),t}function w(e,t,n){return"function"==typeof n?S(e,t,n):M(e,t)}function M(e,t){return st(e).intercept(t)}function S(e,t,n){return st(e,t).intercept(n)}function E(e,t){if(null===e||void 0===e)return!1;if(void 0!==t){if(!1===ot(e))return!1;var n=at(e,t);return ln(n)}return ln(e)}function T(e,t){if(null===e||void 0===e)return!1;if(void 0!==t){if(qe(e)||kn(e))throw new Error(gt("m019"));if(ot(e)){var n=e.$mobx;return n.values&&!!n.values[t]}return!1}return ot(e)||!!e.$mobx||on(e)||gn(e)||ln(e)}function k(e){if(void 0===e&&(e=void 0),"string"==typeof arguments[1])return Zt.apply(null,arguments);if(xt(arguments.length<=1,gt("m021")),xt(!Fe(e),gt("m020")),T(e))return e;var t=Ue(e,void 0,void 0);return t!==e?t:tn.box(e)}function C(e){bt("Expected one or two arguments to observable."+e+". Did you accidentally try to use observable."+e+" as decorator?")}function P(e){return xt(!!e,":("),ut(function(t,n,r,i,o){Lt(t,n),xt(!o||!o.get,gt("m022")),$e(Ke(t,void 0),n,r,e)},function(e){var t=this.$mobx.values[e];if(void 0!==t)return t.get()},function(e,t){rt(this,e,t)},!0,!1)}function O(e,t,n,r){return"function"==typeof n?R(e,t,n,r):A(e,t,n)}function A(e,t,n){return st(e).observe(t,n)}function R(e,t,n,r){return st(e,t).observe(n,r)}function L(e,t,n){function r(r){return t&&n.push([e,r]),r}if(void 0===t&&(t=!0),void 0===n&&(n=[]),T(e)){if(t&&null===n&&(n=[]),t&&null!==e&&"object"==typeof e)for(var i=0,o=n.length;i0,"actions should have valid names, got: '"+e+"'");var n=function(){return B(e,t,this,arguments)};return n.originalFn=t,n.isMobxAction=!0,n}function B(e,t,n,r){var i=U(e,t,n,r);try{return t.apply(n,r)}finally{j(i)}}function U(e,t,n,r){var i=Me()&&!!e,o=0;if(i){o=Date.now();var a=r&&r.length||0,s=new Array(a);if(a>0)for(var l=0;l0;hn.computationDepth>0&&t&&bt(gt("m031")+e.name),!hn.allowStateChanges&&t&&bt(gt(hn.strictMode?"m030a":"m030b")+e.name)}function J(e,t,n){re(e),e.newObserving=new Array(e.observing.length+100),e.unboundDepsCount=0,e.runId=++hn.runId;var r=hn.trackingDerivation;hn.trackingDerivation=e;var i;try{i=t.call(n)}catch(e){i=new un(e)}return hn.trackingDerivation=r,$(e),i}function $(e){var t=e.observing,n=e.observing=e.newObserving,r=sn.UP_TO_DATE;e.newObserving=null;for(var i=0,o=e.unboundDepsCount,a=0;ar&&(r=s.dependenciesState)}for(n.length=i,o=t.length;o--;){var s=t[o];0===s.diffValue&&ce(s,e),s.diffValue=0}for(;i--;){var s=n[i];1===s.diffValue&&(s.diffValue=0,ue(s,e))}r!==sn.UP_TO_DATE&&(e.dependenciesState=r,e.onBecomeStale())}function Q(e){var t=e.observing;e.observing=[];for(var n=t.length;n--;)ce(t[n],e);e.dependenciesState=sn.NOT_TRACKING}function ee(e){var t=te(),n=e();return ne(t),n}function te(){var e=hn.trackingDerivation;return hn.trackingDerivation=null,e}function ne(e){hn.trackingDerivation=e}function re(e){if(e.dependenciesState!==sn.UP_TO_DATE){e.dependenciesState=sn.UP_TO_DATE;for(var t=e.observing,n=t.length;n--;)t[n].lowestObserverState=sn.UP_TO_DATE}}function ie(){var e=vt(),t=hn;if(e.__mobservableTrackingStack||e.__mobservableViewStack)throw new Error("[mobx] An incompatible version of mobservable is already loaded.");if(e.__mobxGlobal&&e.__mobxGlobal.version!==t.version)throw new Error("[mobx] An incompatible version of mobx is already loaded.");e.__mobxGlobal?hn=e.__mobxGlobal:e.__mobxGlobal=t}function oe(){return hn}function ae(){hn.resetId++;var e=new dn;for(var t in e)-1===cn.indexOf(t)&&(hn[t]=e[t]);hn.allowStateChanges=!hn.strictMode}function se(e){return e.observers&&e.observers.length>0}function le(e){return e.observers}function ue(e,t){var n=e.observers.length;n&&(e.observersIndexes[t.__mapid]=n),e.observers[n]=t,e.lowestObserverState>t.dependenciesState&&(e.lowestObserverState=t.dependenciesState)}function ce(e,t){if(1===e.observers.length)e.observers.length=0,de(e);else{var n=e.observers,r=e.observersIndexes,i=n.pop();if(i!==t){var o=r[t.__mapid]||0;o?r[i.__mapid]=o:delete r[i.__mapid],n[o]=i}delete r[t.__mapid]}}function de(e){e.isPendingUnobservation||(e.isPendingUnobservation=!0,hn.pendingUnobservations.push(e))}function he(){hn.inBatch++}function fe(){if(0==--hn.inBatch){xe();for(var e=hn.pendingUnobservations,t=0;t=0&&hn.globalReactionErrorHandlers.splice(t,1)}}function xe(){hn.inBatch>0||hn.isRunningReactions||mn(_e)}function _e(){hn.isRunningReactions=!0;for(var e=hn.pendingReactions,t=0;e.length>0;){++t===pn&&(console.error("Reaction doesn't converge to a stable state after "+pn+" iterations. Probably there is a cycle in the reactive function: "+e[0]),e.splice(0));for(var n=e.splice(0),r=0,i=n.length;r0}function Pe(e,t){var n=e.interceptors||(e.interceptors=[]);return n.push(t),wt(function(){var e=n.indexOf(t);-1!==e&&n.splice(e,1)})}function Oe(e,t){var n=te();try{var r=e.interceptors;if(r)for(var i=0,o=r.length;i0}function Re(e,t){var n=e.changeListeners||(e.changeListeners=[]);return n.push(t),wt(function(){var e=n.indexOf(t);-1!==e&&n.splice(e,1)})}function Le(e,t){var n=te(),r=e.changeListeners;if(r){r=r.slice();for(var i=0,o=r.length;i=this.length,value:tt?" (... and "+(e.length-t)+"more)":""):""}function Et(e){return null!==e&&"object"==typeof e}function Tt(e){if(null===e||"object"!=typeof e)return!1;var t=Object.getPrototypeOf(e);return t===Object.prototype||null===t}function kt(){for(var e=arguments[0],t=1,n=arguments.length;t=0;i--)if(!It(e[i],t[i]))return!1;return!0}if(r){if(e.size!==t.size)return!1;var o=!0;return e.forEach(function(e,n){o=o&&It(t.get(n),e)}),o}if("object"==typeof e&&"object"==typeof t){if(null===e||null===t)return!1;if(Ft(e)&&Ft(t))return e.size===t.size&&It(tn.shallowMap(e).entries(),tn.shallowMap(t).entries());if(Dt(e).length!==Dt(t).length)return!1;for(var a in e){if(!(a in t))return!1;if(!It(e[a],t[a]))return!1}return!0}return!1}function zt(e,t){var n="isMobX"+e;return t.prototype[n]=!0,function(e){return Et(e)&&!0===e[n]}}function Nt(e){return Array.isArray(e)||qe(e)}function Ft(e){return Bt(e)||kn(e)}function Bt(e){return void 0!==vt().Map&&e instanceof vt().Map}function Ut(){return"function"==typeof Symbol&&Symbol.toPrimitive||"@@toPrimitive"}function jt(e){return null===e?null:"object"==typeof e?""+e:e}var Wt=this&&this.__extends||function(){var e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])};return function(t,n){function r(){this.constructor=t}e(t,n),t.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}();Object.defineProperty(t,"__esModule",{value:!0}),t.extras={allowStateChanges:H,deepEqual:It,getAtom:at,getDebugName:lt,getDependencyTree:y,getAdministration:st,getGlobalState:oe,getObserverTree:x,isComputingDerivation:Z,isSpyEnabled:Me,onReactionError:be,reserveArrayBuffer:Xe,resetGlobalState:ae,shareGlobalState:ie,spyReport:Se,spyReportEnd:Te,spyReportStart:Ee,setReactionScheduler:we},"object"==typeof __MOBX_DEVTOOLS_GLOBAL_HOOK__&&__MOBX_DEVTOOLS_GLOBAL_HOOK__.injectMobx(e.exports),e.exports.default=e.exports;var Vt=ut(function(e,t,n,r,i){var o=r&&1===r.length?r[0]:n.name||t||"";Ot(e,t,Gt(o,n))},function(e){return this[e]},function(){xt(!1,gt("m001"))},!1,!0),Ht=ut(function(e,t,n){a(e,t,n)},function(e){return this[e]},function(){xt(!1,gt("m001"))},!1,!1),Gt=function(e,t,n,i){return 1===arguments.length&&"function"==typeof e?F(e.name||"",e):2===arguments.length&&"function"==typeof t?F(e,t):1===arguments.length&&"string"==typeof e?r(e):r(t).apply(null,arguments)};t.action=Gt,Gt.bound=function(e,t,n){if("function"==typeof e){var r=F("",e);return r.autoBind=!0,r}return Ht.apply(null,arguments)},t.runInAction=i,t.isAction=o,t.autorun=s,t.when=l,t.autorunAsync=u,t.reaction=c;var Yt=d(!1),Xt=d(!0),qt=function(e,t,n){if("string"==typeof t)return Yt.apply(null,arguments);xt("function"==typeof e,gt("m011")),xt(arguments.length<3,gt("m012"));var r="object"==typeof t?t:{};return r.setter="function"==typeof t?t:r.setter,new an(e,r.context,r.compareStructural||r.struct||!1,r.name||e.name||"",r.setter)};t.computed=qt,qt.struct=Xt,t.createTransformer=h,t.expr=p,t.extendObservable=m,t.extendShallowObservable=g,t.intercept=w,t.isComputed=E,t.isObservable=T;var Zt=P(Ue),Kt=P(je),Jt=P(We),$t=P(Ve),Qt=P(He),en=function(){function e(){}return e.prototype.box=function(e,t){return arguments.length>2&&C("box"),new Ln(e,Ue,t)},e.prototype.shallowBox=function(e,t){return arguments.length>2&&C("shallowBox"),new Ln(e,We,t)},e.prototype.array=function(e,t){return arguments.length>2&&C("array"),new wn(e,Ue,t)},e.prototype.shallowArray=function(e,t){return arguments.length>2&&C("shallowArray"),new wn(e,We,t)},e.prototype.map=function(e,t){return arguments.length>2&&C("map"),new Tn(e,Ue,t)},e.prototype.shallowMap=function(e,t){return arguments.length>2&&C("shallowMap"),new Tn(e,We,t)},e.prototype.object=function(e,t){arguments.length>2&&C("object");var n={};return Ke(n,t),m(n,e),n},e.prototype.shallowObject=function(e,t){arguments.length>2&&C("shallowObject");var n={};return Ke(n,t),g(n,e),n},e.prototype.ref=function(){return arguments.length<2?Be(We,arguments[0]):Jt.apply(null,arguments)},e.prototype.shallow=function(){return arguments.length<2?Be(je,arguments[0]):Kt.apply(null,arguments)},e.prototype.deep=function(){return arguments.length<2?Be(Ue,arguments[0]):Zt.apply(null,arguments)},e.prototype.struct=function(){return arguments.length<2?Be(Ve,arguments[0]):$t.apply(null,arguments)},e}();t.IObservableFactories=en;var tn=k;t.observable=tn,Object.keys(en.prototype).forEach(function(e){return tn[e]=en.prototype[e]}),tn.deep.struct=tn.struct,tn.ref.struct=function(){return arguments.length<2?Be(He,arguments[0]):Qt.apply(null,arguments)},t.observe=O,t.toJS=L,t.transaction=D,t.whyRun=N,t.useStrict=W,t.isStrictModeEnabled=V;var nn=function(){function e(e){void 0===e&&(e="Atom@"+yt()),this.name=e,this.isPendingUnobservation=!0,this.observers=[],this.observersIndexes={},this.diffValue=0,this.lastAccessedBy=0,this.lowestObserverState=sn.NOT_TRACKING}return e.prototype.onBecomeUnobserved=function(){},e.prototype.reportObserved=function(){pe(this)},e.prototype.reportChanged=function(){he(),me(this),fe()},e.prototype.toString=function(){return this.name},e}();t.BaseAtom=nn;var rn=function(e){function t(t,n,r){void 0===t&&(t="Atom@"+yt()),void 0===n&&(n=Bn),void 0===r&&(r=Bn);var i=e.call(this,t)||this;return i.name=t,i.onBecomeObservedHandler=n,i.onBecomeUnobservedHandler=r,i.isPendingUnobservation=!1,i.isBeingTracked=!1,i}return Wt(t,e),t.prototype.reportObserved=function(){return he(),e.prototype.reportObserved.call(this),this.isBeingTracked||(this.isBeingTracked=!0,this.onBecomeObservedHandler()),fe(),!!hn.trackingDerivation},t.prototype.onBecomeUnobserved=function(){this.isBeingTracked=!1,this.onBecomeUnobservedHandler()},t}(nn);t.Atom=rn;var on=zt("Atom",nn),an=function(){function e(e,t,n,r,i){this.derivation=e,this.scope=t,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="#"+yt(),this.value=void 0,this.isComputing=!1,this.isRunningSetter=!1,this.name=r||"ComputedValue@"+yt(),i&&(this.setter=F(r+"-setter",i))}return e.prototype.onBecomeStale=function(){ve(this)},e.prototype.onBecomeUnobserved=function(){Q(this),this.value=void 0},e.prototype.get=function(){xt(!this.isComputing,"Cycle detected in computation "+this.name,this.derivation),0===hn.inBatch?(he(),q(this)&&(this.value=this.computeValue(!1)),fe()):(pe(this),q(this)&&this.trackAndCompute()&&ge(this));var e=this.value;if(X(e))throw e.cause;return e},e.prototype.peek=function(){var e=this.computeValue(!1);if(X(e))throw e.cause;return e},e.prototype.set=function(e){if(this.setter){xt(!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,e)}finally{this.isRunningSetter=!1}}else xt(!1,"[ComputedValue '"+this.name+"'] It is not possible to assign a new value to a computed value.")},e.prototype.trackAndCompute=function(){Me()&&Se({object:this.scope,type:"compute",fn:this.derivation});var e=this.value,t=this.value=this.computeValue(!0);return X(t)||Ct(this.compareStructural,t,e)},e.prototype.computeValue=function(e){this.isComputing=!0,hn.computationDepth++;var t;if(e)t=J(this,this.derivation,this.scope);else try{t=this.derivation.call(this.scope)}catch(e){t=new un(e)}return hn.computationDepth--,this.isComputing=!1,t},e.prototype.observe=function(e,t){var n=this,r=!0,i=void 0;return s(function(){var o=n.get();if(!r||t){var a=te();e({type:"update",object:n,newValue:o,oldValue:i}),ne(a)}r=!1,i=o})},e.prototype.toJSON=function(){return this.get()},e.prototype.toString=function(){return this.name+"["+this.derivation.toString()+"]"},e.prototype.valueOf=function(){return jt(this.get())},e.prototype.whyRun=function(){var e=Boolean(hn.trackingDerivation),t=Mt(this.isComputing?this.newObserving:this.observing).map(function(e){return e.name}),n=Mt(le(this).map(function(e){return e.name}));return"\nWhyRun? computation '"+this.name+"':\n * Running because: "+(e?"[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?gt("m032"):" * This computation will re-run if any of the following observables changes:\n "+St(t)+"\n "+(this.isComputing&&e?" (... or any observable accessed during the remainder of the current run)":"")+"\n\t"+gt("m038")+"\n\n * If the outcome of this computation changes, the following observers will be re-run:\n "+St(n)+"\n")},e}();an.prototype[Ut()]=an.prototype.valueOf;var sn,ln=zt("ComputedValue",an);!function(e){e[e.NOT_TRACKING=-1]="NOT_TRACKING",e[e.UP_TO_DATE=0]="UP_TO_DATE",e[e.POSSIBLY_STALE=1]="POSSIBLY_STALE",e[e.STALE=2]="STALE"}(sn||(sn={})),t.IDerivationState=sn;var un=function(){function e(e){this.cause=e}return e}();t.untracked=ee;var cn=["mobxGuid","resetId","spyListeners","strictMode","runId"],dn=function(){function e(){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 e}(),hn=new dn,fn=function(){function e(e,t){void 0===e&&(e="Reaction@"+yt()),this.name=e,this.onInvalidate=t,this.observing=[],this.newObserving=[],this.dependenciesState=sn.NOT_TRACKING,this.diffValue=0,this.runId=0,this.unboundDepsCount=0,this.__mapid="#"+yt(),this.isDisposed=!1,this._isScheduled=!1,this._isTrackPending=!1,this._isRunning=!1}return e.prototype.onBecomeStale=function(){this.schedule()},e.prototype.schedule=function(){this._isScheduled||(this._isScheduled=!0,hn.pendingReactions.push(this),xe())},e.prototype.isScheduled=function(){return this._isScheduled},e.prototype.runReaction=function(){this.isDisposed||(he(),this._isScheduled=!1,q(this)&&(this._isTrackPending=!0,this.onInvalidate(),this._isTrackPending&&Me()&&Se({object:this,type:"scheduled-reaction"})),fe())},e.prototype.track=function(e){he();var t,n=Me();n&&(t=Date.now(),Ee({object:this,type:"reaction",fn:e})),this._isRunning=!0;var r=J(this,e,void 0);this._isRunning=!1,this._isTrackPending=!1,this.isDisposed&&Q(this),X(r)&&this.reportExceptionInDerivation(r.cause),n&&Te({time:Date.now()-t}),fe()},e.prototype.reportExceptionInDerivation=function(e){var t=this;if(this.errorHandler)return void this.errorHandler(e,this);var n="[mobx] Encountered an uncaught exception that was thrown by a reaction or observer component, in: '"+this,r=gt("m037");console.error(n||r,e),Me()&&Se({type:"error",message:n,error:e,object:this}),hn.globalReactionErrorHandlers.forEach(function(n){return n(e,t)})},e.prototype.dispose=function(){this.isDisposed||(this.isDisposed=!0,this._isRunning||(he(),Q(this),fe()))},e.prototype.getDisposer=function(){var e=this.dispose.bind(this);return e.$mobx=this,e.onError=ye,e},e.prototype.toString=function(){return"Reaction["+this.name+"]"},e.prototype.whyRun=function(){var e=Mt(this._isRunning?this.newObserving:this.observing).map(function(e){return e.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 "+St(e)+"\n "+(this._isRunning?" (... or any observable accessed during the remainder of the current run)":"")+"\n\t"+gt("m038")+"\n"},e}();t.Reaction=fn;var pn=100,mn=function(e){return e()},gn=zt("Reaction",fn),vn={spyReportEnd:!0};t.spy=ke,t.asReference=De,t.asStructure=Ie,t.asFlat=ze,t.asMap=Ne,t.isModifierDescriptor=Fe;var yn=function(){var e=!1,t={};return Object.defineProperty(t,"0",{set:function(){e=!0}}),Object.create(t)[0]=1,!1===e}(),bn=0,xn=function(){function e(){}return e}();xn.prototype=[];var _n=function(){function e(e,t,n,r){this.array=n,this.owned=r,this.lastKnownLength=0,this.interceptors=null,this.changeListeners=null,this.atom=new nn(e||"ObservableArray@"+yt()),this.enhancer=function(n,r){return t(n,r,e+"[..]")}}return e.prototype.intercept=function(e){return Pe(this,e)},e.prototype.observe=function(e,t){return void 0===t&&(t=!1),t&&e({object:this.array,type:"splice",index:0,added:this.values.slice(),addedCount:this.values.length,removed:[],removedCount:0}),Re(this,e)},e.prototype.getArrayLength=function(){return this.atom.reportObserved(),this.values.length},e.prototype.setArrayLength=function(e){if("number"!=typeof e||e<0)throw new Error("[mobx.array] Out of range: "+e);var t=this.values.length;if(e!==t)if(e>t){for(var n=new Array(e-t),r=0;r0&&e+t+1>bn&&Xe(e+t+1)},e.prototype.spliceWithArray=function(e,t,n){var r=this;K(this.atom);var i=this.values.length;if(void 0===e?e=0:e>i?e=i:e<0&&(e=Math.max(0,i+e)),t=1===arguments.length?i-e:void 0===t||null===t?0:Math.max(0,Math.min(t,i-e)),void 0===n&&(n=[]),Ce(this)){var o=Oe(this,{object:this.array,type:"splice",index:e,removedCount:t,added:n});if(!o)return Nn;t=o.removedCount,n=o.added}n=n.map(function(e){return r.enhancer(e,void 0)});var a=n.length-t;this.updateArrayLength(i,a);var s=this.spliceItemsIntoValues(e,t,n);return 0===t&&0===n.length||this.notifyArraySplice(e,n,s),s},e.prototype.spliceItemsIntoValues=function(e,t,n){if(n.length<1e4)return(i=this.values).splice.apply(i,[e,t].concat(n));var r=this.values.slice(e,e+t);return this.values=this.values.slice(0,e).concat(n,this.values.slice(e+t)),r;var i},e.prototype.notifyArrayChildUpdate=function(e,t,n){var r=!this.owned&&Me(),i=Ae(this),o=i||r?{object:this.array,type:"update",index:e,newValue:t,oldValue:n}:null;r&&Ee(o),this.atom.reportChanged(),i&&Le(this,o),r&&Te()},e.prototype.notifyArraySplice=function(e,t,n){var r=!this.owned&&Me(),i=Ae(this),o=i||r?{object:this.array,type:"splice",index:e,removed:n,added:t,removedCount:n.length,addedCount:t.length}:null;r&&Ee(o),this.atom.reportChanged(),i&&Le(this,o),r&&Te()},e}(),wn=function(e){function t(t,n,r,i){void 0===r&&(r="ObservableArray@"+yt()),void 0===i&&(i=!1);var o=e.call(this)||this,a=new _n(r,n,o,i);return At(o,"$mobx",a),t&&t.length?(a.updateArrayLength(0,t.length),a.values=t.map(function(e){return n(e,void 0,r+"[..]")}),a.notifyArraySplice(0,a.values.slice(),Nn)):a.values=[],yn&&Object.defineProperty(a.array,"0",Mn),o}return Wt(t,e),t.prototype.intercept=function(e){return this.$mobx.intercept(e)},t.prototype.observe=function(e,t){return void 0===t&&(t=!1),this.$mobx.observe(e,t)},t.prototype.clear=function(){return this.splice(0)},t.prototype.concat=function(){for(var e=[],t=0;t-1&&(this.splice(t,1),!0)},t.prototype.move=function(e,t){function n(e){if(e<0)throw new Error("[mobx.array] Index out of bounds: "+e+" is negative");var t=this.$mobx.values.length;if(e>=t)throw new Error("[mobx.array] Index out of bounds: "+e+" is not smaller than "+t)}if(n.call(this,e),n.call(this,t),e!==t){var r,i=this.$mobx.values;r=e3&&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 g.MeshBasicMaterial({map:E.load(e),transparent:!0,depthWrite:!1}),s=new g.Mesh(new g.PlaneGeometry(t,n),a);return s.material.side=g.DoubleSide,s.position.set(r,i,o),s.overdraw=!0,s}function a(e){var t=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],l=new g.Path,u=l.createGeometry(e);u.computeLineDistances();var c=new g.LineDashedMaterial({color:t,dashSize:r,linewidth:n,gapSize:o}),d=new g.Line(u,c);return i(d,a),d.matrixAutoUpdate=s,s||d.updateMatrix(),d}function s(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:32,r=new g.CircleGeometry(e,n);return new g.Mesh(r,t)}function l(e){var t=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=M(e.map(function(e){return[e.x,e.y]})),s=new g.ShaderMaterial(S({side:g.DoubleSide,diffuse:n,thickness:t,opacity:r,transparent:!0})),l=new g.Mesh(a,s);return i(l,o),l}function u(e){var t=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,l=new g.Path,u=l.createGeometry(e),c=new g.LineBasicMaterial({color:t,linewidth:n,transparent:a,opacity:s}),d=new g.Line(u,c);return i(d,r),d.matrixAutoUpdate=o,!1===o&&d.updateMatrix(),d}function c(e,t,n){var r=new g.CubeGeometry(e.x,e.y,e.z),i=new g.MeshBasicMaterial({color:t}),o=new g.Mesh(r,i),a=new g.BoxHelper(o);return a.material.linewidth=n,a}function d(e,t,n){var r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:.01,i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:.02,o=new g.CubeGeometry(e.x,e.y,e.z);o=new g.EdgesGeometry(o),o=(new g.Geometry).fromBufferGeometry(o),o.computeLineDistances();var a=new g.LineDashedMaterial({color:t,linewidth:n,dashSize:r,gapSize:i});return new g.LineSegments(o,a)}function h(e,t,n,r,i){var o=new g.Vector3(0,e,0);return u([new g.Vector3(0,0,0),o,new g.Vector3(r/2,e-n,0),o,new g.Vector3(-r/2,e-n,0)],i,t,1)}function f(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n=new g.Shape;if(t){n.moveTo(e[0].x,e[0].y);for(var r=1;r1&&void 0!==arguments[1]?arguments[1]:new g.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=f(e,n),s=new g.Mesh(a,t);return i(s,r),s.matrixAutoUpdate=o,!1===o&&s.updateMatrix(),s}Object.defineProperty(t,"__esModule",{value:!0}),t.addOffsetZ=i,t.drawImage=o,t.drawDashedLineFromPoints=a,t.drawCircle=s,t.drawThickBandFromPoints=l,t.drawSegmentsFromPoints=u,t.drawBox=c,t.drawDashedBox=d,t.drawArrow=h,t.getShapeGeometryFromPoints=f,t.drawShapeFromPoints=p;var m=n(9),g=function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t.default=e,t}(m),v=n(350),y=r(v),b=n(351),x=r(b),_=n(33),w=.04,M=(0,y.default)(g),S=(0,x.default)(g),E=new g.TextureLoader},function(e,t){e.exports=function(e){try{return!!e()}catch(e){return!0}}},function(e,t){var n={}.hasOwnProperty;e.exports=function(e,t){return n.call(e,t)}},function(e,t){e.exports=function(e){return"object"==typeof e?null!==e:"function"==typeof e}},function(e,t,n){(function(e,r){var i;(function(){function o(e,t){return e.set(t[0],t[1]),e}function a(e,t){return e.add(t),e}function s(e,t,n){switch(n.length){case 0:return e.call(t);case 1:return e.call(t,n[0]);case 2:return e.call(t,n[0],n[1]);case 3:return e.call(t,n[0],n[1],n[2])}return e.apply(t,n)}function l(e,t,n,r){for(var i=-1,o=null==e?0:e.length;++i-1}function p(e,t,n){for(var r=-1,i=null==e?0:e.length;++r-1;);return n}function B(e,t){for(var n=e.length;n--&&S(t,e[n],0)>-1;);return n}function U(e,t){for(var n=e.length,r=0;n--;)e[n]===t&&++r;return r}function j(e){return"\\"+Cn[e]}function W(e,t){return null==e?ie:e[t]}function V(e){return bn.test(e)}function H(e){return xn.test(e)}function G(e){for(var t,n=[];!(t=e.next()).done;)n.push(t.value);return n}function Y(e){var t=-1,n=Array(e.size);return e.forEach(function(e,r){n[++t]=[r,e]}),n}function X(e,t){return function(n){return e(t(n))}}function q(e,t){for(var n=-1,r=e.length,i=0,o=[];++n>>1,Be=[["ary",Me],["bind",ge],["bindKey",ve],["curry",be],["curryRight",xe],["flip",Ee],["partial",_e],["partialRight",we],["rearg",Se]],Ue="[object Arguments]",je="[object Array]",We="[object AsyncFunction]",Ve="[object Boolean]",He="[object Date]",Ge="[object DOMException]",Ye="[object Error]",Xe="[object Function]",qe="[object GeneratorFunction]",Ze="[object Map]",Ke="[object Number]",Je="[object Null]",$e="[object Object]",Qe="[object Proxy]",et="[object RegExp]",tt="[object Set]",nt="[object String]",rt="[object Symbol]",it="[object Undefined]",ot="[object WeakMap]",at="[object WeakSet]",st="[object ArrayBuffer]",lt="[object DataView]",ut="[object Float32Array]",ct="[object Float64Array]",dt="[object Int8Array]",ht="[object Int16Array]",ft="[object Int32Array]",pt="[object Uint8Array]",mt="[object Uint8ClampedArray]",gt="[object Uint16Array]",vt="[object Uint32Array]",yt=/\b__p \+= '';/g,bt=/\b(__p \+=) '' \+/g,xt=/(__e\(.*?\)|\b__t\)) \+\n'';/g,_t=/&(?:amp|lt|gt|quot|#39);/g,wt=/[&<>"']/g,Mt=RegExp(_t.source),St=RegExp(wt.source),Et=/<%-([\s\S]+?)%>/g,Tt=/<%([\s\S]+?)%>/g,kt=/<%=([\s\S]+?)%>/g,Ct=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,Pt=/^\w*$/,Ot=/^\./,At=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,Rt=/[\\^$.*+?()[\]{}|]/g,Lt=RegExp(Rt.source),Dt=/^\s+|\s+$/g,It=/^\s+/,zt=/\s+$/,Nt=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,Ft=/\{\n\/\* \[wrapped with (.+)\] \*/,Bt=/,? & /,Ut=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g,jt=/\\(\\)?/g,Wt=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,Vt=/\w*$/,Ht=/^[-+]0x[0-9a-f]+$/i,Gt=/^0b[01]+$/i,Yt=/^\[object .+?Constructor\]$/,Xt=/^0o[0-7]+$/i,qt=/^(?:0|[1-9]\d*)$/,Zt=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,Kt=/($^)/,Jt=/['\n\r\u2028\u2029\\]/g,$t="\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff",Qt="\\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",en="["+Qt+"]",tn="["+$t+"]",nn="[a-z\\xdf-\\xf6\\xf8-\\xff]",rn="[^\\ud800-\\udfff"+Qt+"\\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]",ln="[A-Z\\xc0-\\xd6\\xd8-\\xde]",un="(?:"+nn+"|"+rn+")",cn="(?:[\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff]|\\ud83c[\\udffb-\\udfff])?",dn="(?:\\u200d(?:"+["[^\\ud800-\\udfff]",an,sn].join("|")+")[\\ufe0e\\ufe0f]?"+cn+")*",hn="[\\ufe0e\\ufe0f]?"+cn+dn,fn="(?:"+["[\\u2700-\\u27bf]",an,sn].join("|")+")"+hn,pn="(?:"+["[^\\ud800-\\udfff]"+tn+"?",tn,an,sn,"[\\ud800-\\udfff]"].join("|")+")",mn=RegExp("['’]","g"),gn=RegExp(tn,"g"),vn=RegExp(on+"(?="+on+")|"+pn+hn,"g"),yn=RegExp([ln+"?"+nn+"+(?:['’](?:d|ll|m|re|s|t|ve))?(?="+[en,ln,"$"].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))?(?="+[en,ln+un,"$"].join("|")+")",ln+"?"+un+"+(?:['’](?:d|ll|m|re|s|t|ve))?",ln+"+(?:['’](?: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"+$t+"\\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,Mn={};Mn[ut]=Mn[ct]=Mn[dt]=Mn[ht]=Mn[ft]=Mn[pt]=Mn[mt]=Mn[gt]=Mn[vt]=!0,Mn[Ue]=Mn[je]=Mn[st]=Mn[Ve]=Mn[lt]=Mn[He]=Mn[Ye]=Mn[Xe]=Mn[Ze]=Mn[Ke]=Mn[$e]=Mn[et]=Mn[tt]=Mn[nt]=Mn[ot]=!1;var Sn={};Sn[Ue]=Sn[je]=Sn[st]=Sn[lt]=Sn[Ve]=Sn[He]=Sn[ut]=Sn[ct]=Sn[dt]=Sn[ht]=Sn[ft]=Sn[Ze]=Sn[Ke]=Sn[$e]=Sn[et]=Sn[tt]=Sn[nt]=Sn[rt]=Sn[pt]=Sn[mt]=Sn[gt]=Sn[vt]=!0,Sn[Ye]=Sn[Xe]=Sn[ot]=!1;var En={"À":"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"},Tn={"&":"&","<":"<",">":">",'"':""","'":"'"},kn={"&":"&","<":"<",">":">",""":'"',"'":"'"},Cn={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"},Pn=parseFloat,On=parseInt,An="object"==typeof e&&e&&e.Object===Object&&e,Rn="object"==typeof self&&self&&self.Object===Object&&self,Ln=An||Rn||Function("return this")(),Dn="object"==typeof t&&t&&!t.nodeType&&t,In=Dn&&"object"==typeof r&&r&&!r.nodeType&&r,zn=In&&In.exports===Dn,Nn=zn&&An.process,Fn=function(){try{return Nn&&Nn.binding&&Nn.binding("util")}catch(e){}}(),Bn=Fn&&Fn.isArrayBuffer,Un=Fn&&Fn.isDate,jn=Fn&&Fn.isMap,Wn=Fn&&Fn.isRegExp,Vn=Fn&&Fn.isSet,Hn=Fn&&Fn.isTypedArray,Gn=C("length"),Yn=P(En),Xn=P(Tn),qn=P(kn),Zn=function e(t){function n(e){if(ol(e)&&!gh(e)&&!(e instanceof x)){if(e instanceof i)return e;if(gc.call(e,"__wrapped__"))return na(e)}return new i(e)}function r(){}function i(e,t){this.__wrapped__=e,this.__actions__=[],this.__chain__=!!t,this.__index__=0,this.__values__=ie}function x(e){this.__wrapped__=e,this.__actions__=[],this.__dir__=1,this.__filtered__=!1,this.__iteratees__=[],this.__takeCount__=ze,this.__views__=[]}function P(){var e=new x(this.__wrapped__);return e.__actions__=Ni(this.__actions__),e.__dir__=this.__dir__,e.__filtered__=this.__filtered__,e.__iteratees__=Ni(this.__iteratees__),e.__takeCount__=this.__takeCount__,e.__views__=Ni(this.__views__),e}function J(){if(this.__filtered__){var e=new x(this);e.__dir__=-1,e.__filtered__=!0}else e=this.clone(),e.__dir__*=-1;return e}function te(){var e=this.__wrapped__.value(),t=this.__dir__,n=gh(e),r=t<0,i=n?e.length:0,o=ko(0,i,this.__views__),a=o.start,s=o.end,l=s-a,u=r?s:a-1,c=this.__iteratees__,d=c.length,h=0,f=Yc(l,this.__takeCount__);if(!n||!r&&i==l&&f==l)return yi(e,this.__actions__);var p=[];e:for(;l--&&h-1}function ln(e,t){var n=this.__data__,r=Kn(n,e);return r<0?(++this.size,n.push([e,t])):n[r][1]=t,this}function un(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t=t?e:t)),e}function rr(e,t,n,r,i,o){var a,s=t&de,l=t&he,c=t&fe;if(n&&(a=i?n(e,r,i,o):n(e)),a!==ie)return a;if(!il(e))return e;var d=gh(e);if(d){if(a=Oo(e),!s)return Ni(e,a)}else{var h=Td(e),f=h==Xe||h==qe;if(yh(e))return Ei(e,s);if(h==$e||h==Ue||f&&!i){if(a=l||f?{}:Ao(e),!s)return l?Ui(e,Qn(a,e)):Bi(e,$n(a,e))}else{if(!Sn[h])return i?e:{};a=Ro(e,h,rr,s)}}o||(o=new xn);var p=o.get(e);if(p)return p;o.set(e,a);var m=c?l?bo:yo:l?jl:Ul,g=d?ie:m(e);return u(g||e,function(r,i){g&&(i=r,r=e[i]),Gn(a,i,rr(r,t,n,i,e,o))}),a}function ir(e){var t=Ul(e);return function(n){return or(n,e,t)}}function or(e,t,n){var r=n.length;if(null==e)return!r;for(e=sc(e);r--;){var i=n[r],o=t[i],a=e[i];if(a===ie&&!(i in e)||!o(a))return!1}return!0}function ar(e,t,n){if("function"!=typeof e)throw new cc(se);return Pd(function(){e.apply(ie,n)},t)}function sr(e,t,n,r){var i=-1,o=f,a=!0,s=e.length,l=[],u=t.length;if(!s)return l;n&&(t=m(t,I(n))),r?(o=p,a=!1):t.length>=oe&&(o=N,a=!1,t=new vn(t));e:for(;++ii?0:i+n),r=r===ie||r>i?i:wl(r),r<0&&(r+=i),r=n>r?0:Ml(r);n0&&n(s)?t>1?hr(s,t-1,n,r,i):g(i,s):r||(i[i.length]=s)}return i}function fr(e,t){return e&&gd(e,t,Ul)}function pr(e,t){return e&&vd(e,t,Ul)}function mr(e,t){return h(t,function(t){return tl(e[t])})}function gr(e,t){t=Mi(t,e);for(var n=0,r=t.length;null!=e&&nt}function xr(e,t){return null!=e&&gc.call(e,t)}function _r(e,t){return null!=e&&t in sc(e)}function wr(e,t,n){return e>=Yc(t,n)&&e=120&&c.length>=120)?new vn(a&&c):ie}c=e[0];var d=-1,h=s[0];e:for(;++d-1;)s!==e&&Oc.call(s,l,1),Oc.call(e,l,1);return e}function $r(e,t){for(var n=e?t.length:0,r=n-1;n--;){var i=t[n];if(n==r||i!==o){var o=i;Io(i)?Oc.call(e,i,1):mi(e,i)}}return e}function Qr(e,t){return e+Bc(Zc()*(t-e+1))}function ei(e,t,n,r){for(var i=-1,o=Gc(Fc((t-e)/(n||1)),0),a=nc(o);o--;)a[r?o:++i]=e,e+=n;return a}function ti(e,t){var n="";if(!e||t<1||t>Le)return n;do{t%2&&(n+=e),(t=Bc(t/2))&&(e+=e)}while(t);return n}function ni(e,t){return Od(Xo(e,t,Ou),e+"")}function ri(e){return Dn(Ql(e))}function ii(e,t){var n=Ql(e);return $o(n,nr(t,0,n.length))}function oi(e,t,n,r){if(!il(e))return e;t=Mi(t,e);for(var i=-1,o=t.length,a=o-1,s=e;null!=s&&++ii?0:i+t),n=n>i?i:n,n<0&&(n+=i),i=t>n?0:n-t>>>0,t>>>=0;for(var o=nc(i);++r>>1,a=e[o];null!==a&&!gl(a)&&(n?a<=t:a=oe){var u=t?null:wd(e);if(u)return Z(u);a=!1,i=N,l=new vn}else l=t?[]:s;e:for(;++r=r?e:si(e,t,n)}function Ei(e,t){if(t)return e.slice();var n=e.length,r=Tc?Tc(n):new e.constructor(n);return e.copy(r),r}function Ti(e){var t=new e.constructor(e.byteLength);return new Ec(t).set(new Ec(e)),t}function ki(e,t){var n=t?Ti(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.byteLength)}function Ci(e,t,n){return v(t?n(Y(e),de):Y(e),o,new e.constructor)}function Pi(e){var t=new e.constructor(e.source,Vt.exec(e));return t.lastIndex=e.lastIndex,t}function Oi(e,t,n){return v(t?n(Z(e),de):Z(e),a,new e.constructor)}function Ai(e){return dd?sc(dd.call(e)):{}}function Ri(e,t){var n=t?Ti(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.length)}function Li(e,t){if(e!==t){var n=e!==ie,r=null===e,i=e===e,o=gl(e),a=t!==ie,s=null===t,l=t===t,u=gl(t);if(!s&&!u&&!o&&e>t||o&&a&&l&&!s&&!u||r&&a&&l||!n&&l||!i)return 1;if(!r&&!o&&!u&&e=s)return l;return l*("desc"==n[r]?-1:1)}}return e.index-t.index}function Ii(e,t,n,r){for(var i=-1,o=e.length,a=n.length,s=-1,l=t.length,u=Gc(o-a,0),c=nc(l+u),d=!r;++s1?n[i-1]:ie,a=i>2?n[2]:ie;for(o=e.length>3&&"function"==typeof o?(i--,o):ie,a&&zo(n[0],n[1],a)&&(o=i<3?ie:o,i=1),t=sc(t);++r-1?i[o?t[a]:a]:ie}}function Ji(e){return vo(function(t){var n=t.length,r=n,o=i.prototype.thru;for(e&&t.reverse();r--;){var a=t[r];if("function"!=typeof a)throw new cc(se);if(o&&!s&&"wrapper"==xo(a))var s=new i([],!0)}for(r=s?r:n;++r1&&y.reverse(),d&&ls))return!1;var u=o.get(e);if(u&&o.get(t))return u==t;var c=-1,d=!0,h=n&me?new vn:ie;for(o.set(e,t),o.set(t,e);++c1?"& ":"")+t[r],t=t.join(n>2?", ":" "),e.replace(Nt,"{\n/* [wrapped with "+t+"] */\n")}function Do(e){return gh(e)||mh(e)||!!(Ac&&e&&e[Ac])}function Io(e,t){return!!(t=null==t?Le:t)&&("number"==typeof e||qt.test(e))&&e>-1&&e%1==0&&e0){if(++t>=Ce)return arguments[0]}else t=0;return e.apply(ie,arguments)}}function $o(e,t){var n=-1,r=e.length,i=r-1;for(t=t===ie?r:t;++n=this.__values__.length;return{done:e,value:e?ie:this.__values__[this.__index__++]}}function ns(){return this}function rs(e){for(var t,n=this;n instanceof r;){var i=na(n);i.__index__=0,i.__values__=ie,t?o.__wrapped__=i:t=i;var o=i;n=n.__wrapped__}return o.__wrapped__=e,t}function is(){var e=this.__wrapped__;if(e instanceof x){var t=e;return this.__actions__.length&&(t=new x(this)),t=t.reverse(),t.__actions__.push({func:$a,args:[Ca],thisArg:ie}),new i(t,this.__chain__)}return this.thru(Ca)}function os(){return yi(this.__wrapped__,this.__actions__)}function as(e,t,n){var r=gh(e)?d:lr;return n&&zo(e,t,n)&&(t=ie),r(e,wo(t,3))}function ss(e,t){return(gh(e)?h:dr)(e,wo(t,3))}function ls(e,t){return hr(ps(e,t),1)}function us(e,t){return hr(ps(e,t),Re)}function cs(e,t,n){return n=n===ie?1:wl(n),hr(ps(e,t),n)}function ds(e,t){return(gh(e)?u:pd)(e,wo(t,3))}function hs(e,t){return(gh(e)?c:md)(e,wo(t,3))}function fs(e,t,n,r){e=Ys(e)?e:Ql(e),n=n&&!r?wl(n):0;var i=e.length;return n<0&&(n=Gc(i+n,0)),ml(e)?n<=i&&e.indexOf(t,n)>-1:!!i&&S(e,t,n)>-1}function ps(e,t){return(gh(e)?m:jr)(e,wo(t,3))}function ms(e,t,n,r){return null==e?[]:(gh(t)||(t=null==t?[]:[t]),n=r?ie:n,gh(n)||(n=null==n?[]:[n]),Xr(e,t,n))}function gs(e,t,n){var r=gh(e)?v:O,i=arguments.length<3;return r(e,wo(t,4),n,i,pd)}function vs(e,t,n){var r=gh(e)?y:O,i=arguments.length<3;return r(e,wo(t,4),n,i,md)}function ys(e,t){return(gh(e)?h:dr)(e,Rs(wo(t,3)))}function bs(e){return(gh(e)?Dn:ri)(e)}function xs(e,t,n){return t=(n?zo(e,t,n):t===ie)?1:wl(t),(gh(e)?In:ii)(e,t)}function _s(e){return(gh(e)?Nn:ai)(e)}function ws(e){if(null==e)return 0;if(Ys(e))return ml(e)?Q(e):e.length;var t=Td(e);return t==Ze||t==tt?e.size:Fr(e).length}function Ms(e,t,n){var r=gh(e)?b:li;return n&&zo(e,t,n)&&(t=ie),r(e,wo(t,3))}function Ss(e,t){if("function"!=typeof t)throw new cc(se);return e=wl(e),function(){if(--e<1)return t.apply(this,arguments)}}function Es(e,t,n){return t=n?ie:t,t=e&&null==t?e.length:t,uo(e,Me,ie,ie,ie,ie,t)}function Ts(e,t){var n;if("function"!=typeof t)throw new cc(se);return e=wl(e),function(){return--e>0&&(n=t.apply(this,arguments)),e<=1&&(t=ie),n}}function ks(e,t,n){t=n?ie:t;var r=uo(e,be,ie,ie,ie,ie,ie,t);return r.placeholder=ks.placeholder,r}function Cs(e,t,n){t=n?ie:t;var r=uo(e,xe,ie,ie,ie,ie,ie,t);return r.placeholder=Cs.placeholder,r}function Ps(e,t,n){function r(t){var n=h,r=f;return h=f=ie,y=t,m=e.apply(r,n)}function i(e){return y=e,g=Pd(s,t),b?r(e):m}function o(e){var n=e-v,r=e-y,i=t-n;return x?Yc(i,p-r):i}function a(e){var n=e-v,r=e-y;return v===ie||n>=t||n<0||x&&r>=p}function s(){var e=ih();if(a(e))return l(e);g=Pd(s,o(e))}function l(e){return g=ie,_&&h?r(e):(h=f=ie,m)}function u(){g!==ie&&_d(g),y=0,h=v=f=g=ie}function c(){return g===ie?m:l(ih())}function d(){var e=ih(),n=a(e);if(h=arguments,f=this,v=e,n){if(g===ie)return i(v);if(x)return g=Pd(s,t),r(v)}return g===ie&&(g=Pd(s,t)),m}var h,f,p,m,g,v,y=0,b=!1,x=!1,_=!0;if("function"!=typeof e)throw new cc(se);return t=Sl(t)||0,il(n)&&(b=!!n.leading,x="maxWait"in n,p=x?Gc(Sl(n.maxWait)||0,t):p,_="trailing"in n?!!n.trailing:_),d.cancel=u,d.flush=c,d}function Os(e){return uo(e,Ee)}function As(e,t){if("function"!=typeof e||null!=t&&"function"!=typeof t)throw new cc(se);var n=function(){var r=arguments,i=t?t.apply(this,r):r[0],o=n.cache;if(o.has(i))return o.get(i);var a=e.apply(this,r);return n.cache=o.set(i,a)||o,a};return n.cache=new(As.Cache||un),n}function Rs(e){if("function"!=typeof e)throw new cc(se);return function(){var t=arguments;switch(t.length){case 0:return!e.call(this);case 1:return!e.call(this,t[0]);case 2:return!e.call(this,t[0],t[1]);case 3:return!e.call(this,t[0],t[1],t[2])}return!e.apply(this,t)}}function Ls(e){return Ts(2,e)}function Ds(e,t){if("function"!=typeof e)throw new cc(se);return t=t===ie?t:wl(t),ni(e,t)}function Is(e,t){if("function"!=typeof e)throw new cc(se);return t=null==t?0:Gc(wl(t),0),ni(function(n){var r=n[t],i=Si(n,0,t);return r&&g(i,r),s(e,this,i)})}function zs(e,t,n){var r=!0,i=!0;if("function"!=typeof e)throw new cc(se);return il(n)&&(r="leading"in n?!!n.leading:r,i="trailing"in n?!!n.trailing:i),Ps(e,t,{leading:r,maxWait:t,trailing:i})}function Ns(e){return Es(e,1)}function Fs(e,t){return ch(wi(t),e)}function Bs(){if(!arguments.length)return[];var e=arguments[0];return gh(e)?e:[e]}function Us(e){return rr(e,fe)}function js(e,t){return t="function"==typeof t?t:ie,rr(e,fe,t)}function Ws(e){return rr(e,de|fe)}function Vs(e,t){return t="function"==typeof t?t:ie,rr(e,de|fe,t)}function Hs(e,t){return null==t||or(e,t,Ul(t))}function Gs(e,t){return e===t||e!==e&&t!==t}function Ys(e){return null!=e&&rl(e.length)&&!tl(e)}function Xs(e){return ol(e)&&Ys(e)}function qs(e){return!0===e||!1===e||ol(e)&&yr(e)==Ve}function Zs(e){return ol(e)&&1===e.nodeType&&!fl(e)}function Ks(e){if(null==e)return!0;if(Ys(e)&&(gh(e)||"string"==typeof e||"function"==typeof e.splice||yh(e)||Mh(e)||mh(e)))return!e.length;var t=Td(e);if(t==Ze||t==tt)return!e.size;if(jo(e))return!Fr(e).length;for(var n in e)if(gc.call(e,n))return!1;return!0}function Js(e,t){return Pr(e,t)}function $s(e,t,n){n="function"==typeof n?n:ie;var r=n?n(e,t):ie;return r===ie?Pr(e,t,ie,n):!!r}function Qs(e){if(!ol(e))return!1;var t=yr(e);return t==Ye||t==Ge||"string"==typeof e.message&&"string"==typeof e.name&&!fl(e)}function el(e){return"number"==typeof e&&Wc(e)}function tl(e){if(!il(e))return!1;var t=yr(e);return t==Xe||t==qe||t==We||t==Qe}function nl(e){return"number"==typeof e&&e==wl(e)}function rl(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=Le}function il(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)}function ol(e){return null!=e&&"object"==typeof e}function al(e,t){return e===t||Rr(e,t,So(t))}function sl(e,t,n){return n="function"==typeof n?n:ie,Rr(e,t,So(t),n)}function ll(e){return hl(e)&&e!=+e}function ul(e){if(kd(e))throw new ic(ae);return Lr(e)}function cl(e){return null===e}function dl(e){return null==e}function hl(e){return"number"==typeof e||ol(e)&&yr(e)==Ke}function fl(e){if(!ol(e)||yr(e)!=$e)return!1;var t=kc(e);if(null===t)return!0;var n=gc.call(t,"constructor")&&t.constructor;return"function"==typeof n&&n instanceof n&&mc.call(n)==xc}function pl(e){return nl(e)&&e>=-Le&&e<=Le}function ml(e){return"string"==typeof e||!gh(e)&&ol(e)&&yr(e)==nt}function gl(e){return"symbol"==typeof e||ol(e)&&yr(e)==rt}function vl(e){return e===ie}function yl(e){return ol(e)&&Td(e)==ot}function bl(e){return ol(e)&&yr(e)==at}function xl(e){if(!e)return[];if(Ys(e))return ml(e)?ee(e):Ni(e);if(Rc&&e[Rc])return G(e[Rc]());var t=Td(e);return(t==Ze?Y:t==tt?Z:Ql)(e)}function _l(e){if(!e)return 0===e?e:0;if((e=Sl(e))===Re||e===-Re){return(e<0?-1:1)*De}return e===e?e:0}function wl(e){var t=_l(e),n=t%1;return t===t?n?t-n:t:0}function Ml(e){return e?nr(wl(e),0,ze):0}function Sl(e){if("number"==typeof e)return e;if(gl(e))return Ie;if(il(e)){var t="function"==typeof e.valueOf?e.valueOf():e;e=il(t)?t+"":t}if("string"!=typeof e)return 0===e?e:+e;e=e.replace(Dt,"");var n=Gt.test(e);return n||Xt.test(e)?On(e.slice(2),n?2:8):Ht.test(e)?Ie:+e}function El(e){return Fi(e,jl(e))}function Tl(e){return e?nr(wl(e),-Le,Le):0===e?e:0}function kl(e){return null==e?"":fi(e)}function Cl(e,t){var n=fd(e);return null==t?n:$n(n,t)}function Pl(e,t){return w(e,wo(t,3),fr)}function Ol(e,t){return w(e,wo(t,3),pr)}function Al(e,t){return null==e?e:gd(e,wo(t,3),jl)}function Rl(e,t){return null==e?e:vd(e,wo(t,3),jl)}function Ll(e,t){return e&&fr(e,wo(t,3))}function Dl(e,t){return e&&pr(e,wo(t,3))}function Il(e){return null==e?[]:mr(e,Ul(e))}function zl(e){return null==e?[]:mr(e,jl(e))}function Nl(e,t,n){var r=null==e?ie:gr(e,t);return r===ie?n:r}function Fl(e,t){return null!=e&&Po(e,t,xr)}function Bl(e,t){return null!=e&&Po(e,t,_r)}function Ul(e){return Ys(e)?Rn(e):Fr(e)}function jl(e){return Ys(e)?Rn(e,!0):Br(e)}function Wl(e,t){var n={};return t=wo(t,3),fr(e,function(e,r,i){er(n,t(e,r,i),e)}),n}function Vl(e,t){var n={};return t=wo(t,3),fr(e,function(e,r,i){er(n,r,t(e,r,i))}),n}function Hl(e,t){return Gl(e,Rs(wo(t)))}function Gl(e,t){if(null==e)return{};var n=m(bo(e),function(e){return[e]});return t=wo(t),Zr(e,n,function(e,n){return t(e,n[0])})}function Yl(e,t,n){t=Mi(t,e);var r=-1,i=t.length;for(i||(i=1,e=ie);++rt){var r=e;e=t,t=r}if(n||e%1||t%1){var i=Zc();return Yc(e+i*(t-e+Pn("1e-"+((i+"").length-1))),t)}return Qr(e,t)}function iu(e){return Zh(kl(e).toLowerCase())}function ou(e){return(e=kl(e))&&e.replace(Zt,Yn).replace(gn,"")}function au(e,t,n){e=kl(e),t=fi(t);var r=e.length;n=n===ie?r:nr(wl(n),0,r);var i=n;return(n-=t.length)>=0&&e.slice(n,i)==t}function su(e){return e=kl(e),e&&St.test(e)?e.replace(wt,Xn):e}function lu(e){return e=kl(e),e&&Lt.test(e)?e.replace(Rt,"\\$&"):e}function uu(e,t,n){e=kl(e),t=wl(t);var r=t?Q(e):0;if(!t||r>=t)return e;var i=(t-r)/2;return no(Bc(i),n)+e+no(Fc(i),n)}function cu(e,t,n){e=kl(e),t=wl(t);var r=t?Q(e):0;return t&&r>>0)?(e=kl(e),e&&("string"==typeof t||null!=t&&!_h(t))&&!(t=fi(t))&&V(e)?Si(ee(e),0,n):e.split(t,n)):[]}function gu(e,t,n){return e=kl(e),n=null==n?0:nr(wl(n),0,e.length),t=fi(t),e.slice(n,n+t.length)==t}function vu(e,t,r){var i=n.templateSettings;r&&zo(e,t,r)&&(t=ie),e=kl(e),t=Ch({},t,i,co);var o,a,s=Ch({},t.imports,i.imports,co),l=Ul(s),u=z(s,l),c=0,d=t.interpolate||Kt,h="__p += '",f=lc((t.escape||Kt).source+"|"+d.source+"|"+(d===kt?Wt:Kt).source+"|"+(t.evaluate||Kt).source+"|$","g"),p="//# sourceURL="+("sourceURL"in t?t.sourceURL:"lodash.templateSources["+ ++wn+"]")+"\n";e.replace(f,function(t,n,r,i,s,l){return r||(r=i),h+=e.slice(c,l).replace(Jt,j),n&&(o=!0,h+="' +\n__e("+n+") +\n'"),s&&(a=!0,h+="';\n"+s+";\n__p += '"),r&&(h+="' +\n((__t = ("+r+")) == null ? '' : __t) +\n'"),c=l+t.length,t}),h+="';\n";var m=t.variable;m||(h="with (obj) {\n"+h+"\n}\n"),h=(a?h.replace(yt,""):h).replace(bt,"$1").replace(xt,"$1;"),h="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")+h+"return __p\n}";var g=Kh(function(){return oc(l,p+"return "+h).apply(ie,u)});if(g.source=h,Qs(g))throw g;return g}function yu(e){return kl(e).toLowerCase()}function bu(e){return kl(e).toUpperCase()}function xu(e,t,n){if((e=kl(e))&&(n||t===ie))return e.replace(Dt,"");if(!e||!(t=fi(t)))return e;var r=ee(e),i=ee(t);return Si(r,F(r,i),B(r,i)+1).join("")}function _u(e,t,n){if((e=kl(e))&&(n||t===ie))return e.replace(zt,"");if(!e||!(t=fi(t)))return e;var r=ee(e);return Si(r,0,B(r,ee(t))+1).join("")}function wu(e,t,n){if((e=kl(e))&&(n||t===ie))return e.replace(It,"");if(!e||!(t=fi(t)))return e;var r=ee(e);return Si(r,F(r,ee(t))).join("")}function Mu(e,t){var n=Te,r=ke;if(il(t)){var i="separator"in t?t.separator:i;n="length"in t?wl(t.length):n,r="omission"in t?fi(t.omission):r}e=kl(e);var o=e.length;if(V(e)){var a=ee(e);o=a.length}if(n>=o)return e;var s=n-Q(r);if(s<1)return r;var l=a?Si(a,0,s).join(""):e.slice(0,s);if(i===ie)return l+r;if(a&&(s+=l.length-s),_h(i)){if(e.slice(s).search(i)){var u,c=l;for(i.global||(i=lc(i.source,kl(Vt.exec(i))+"g")),i.lastIndex=0;u=i.exec(c);)var d=u.index;l=l.slice(0,d===ie?s:d)}}else if(e.indexOf(fi(i),s)!=s){var h=l.lastIndexOf(i);h>-1&&(l=l.slice(0,h))}return l+r}function Su(e){return e=kl(e),e&&Mt.test(e)?e.replace(_t,qn):e}function Eu(e,t,n){return e=kl(e),t=n?ie:t,t===ie?H(e)?re(e):_(e):e.match(t)||[]}function Tu(e){var t=null==e?0:e.length,n=wo();return e=t?m(e,function(e){if("function"!=typeof e[1])throw new cc(se);return[n(e[0]),e[1]]}):[],ni(function(n){for(var r=-1;++rLe)return[];var n=ze,r=Yc(e,ze);t=wo(t),e-=ze;for(var i=L(r,t);++n1?e[t-1]:ie;return n="function"==typeof n?(e.pop(),n):ie,Xa(e,n)}),Zd=vo(function(e){var t=e.length,n=t?e[0]:0,r=this.__wrapped__,o=function(t){return tr(t,e)};return!(t>1||this.__actions__.length)&&r instanceof x&&Io(n)?(r=r.slice(n,+n+(t?1:0)),r.__actions__.push({func:$a,args:[o],thisArg:ie}),new i(r,this.__chain__).thru(function(e){return t&&!e.length&&e.push(ie),e})):this.thru(o)}),Kd=ji(function(e,t,n){gc.call(e,n)?++e[n]:er(e,n,1)}),Jd=Ki(da),$d=Ki(ha),Qd=ji(function(e,t,n){gc.call(e,n)?e[n].push(t):er(e,n,[t])}),eh=ni(function(e,t,n){var r=-1,i="function"==typeof t,o=Ys(e)?nc(e.length):[];return pd(e,function(e){o[++r]=i?s(t,e,n):Er(e,t,n)}),o}),th=ji(function(e,t,n){er(e,n,t)}),nh=ji(function(e,t,n){e[n?0:1].push(t)},function(){return[[],[]]}),rh=ni(function(e,t){if(null==e)return[];var n=t.length;return n>1&&zo(e,t[0],t[1])?t=[]:n>2&&zo(t[0],t[1],t[2])&&(t=[t[0]]),Xr(e,hr(t,1),[])}),ih=zc||function(){return Ln.Date.now()},oh=ni(function(e,t,n){var r=ge;if(n.length){var i=q(n,_o(oh));r|=_e}return uo(e,r,t,n,i)}),ah=ni(function(e,t,n){var r=ge|ve;if(n.length){var i=q(n,_o(ah));r|=_e}return uo(t,r,e,n,i)}),sh=ni(function(e,t){return ar(e,1,t)}),lh=ni(function(e,t,n){return ar(e,Sl(t)||0,n)});As.Cache=un;var uh=xd(function(e,t){t=1==t.length&&gh(t[0])?m(t[0],I(wo())):m(hr(t,1),I(wo()));var n=t.length;return ni(function(r){for(var i=-1,o=Yc(r.length,n);++i=t}),mh=Tr(function(){return arguments}())?Tr:function(e){return ol(e)&&gc.call(e,"callee")&&!Pc.call(e,"callee")},gh=nc.isArray,vh=Bn?I(Bn):kr,yh=jc||ju,bh=Un?I(Un):Cr,xh=jn?I(jn):Ar,_h=Wn?I(Wn):Dr,wh=Vn?I(Vn):Ir,Mh=Hn?I(Hn):zr,Sh=oo(Ur),Eh=oo(function(e,t){return e<=t}),Th=Wi(function(e,t){if(jo(t)||Ys(t))return void Fi(t,Ul(t),e);for(var n in t)gc.call(t,n)&&Gn(e,n,t[n])}),kh=Wi(function(e,t){Fi(t,jl(t),e)}),Ch=Wi(function(e,t,n,r){Fi(t,jl(t),e,r)}),Ph=Wi(function(e,t,n,r){Fi(t,Ul(t),e,r)}),Oh=vo(tr),Ah=ni(function(e){return e.push(ie,co),s(Ch,ie,e)}),Rh=ni(function(e){return e.push(ie,ho),s(Nh,ie,e)}),Lh=Qi(function(e,t,n){e[t]=n},Cu(Ou)),Dh=Qi(function(e,t,n){gc.call(e,t)?e[t].push(n):e[t]=[n]},wo),Ih=ni(Er),zh=Wi(function(e,t,n){Hr(e,t,n)}),Nh=Wi(function(e,t,n,r){Hr(e,t,n,r)}),Fh=vo(function(e,t){var n={};if(null==e)return n;var r=!1;t=m(t,function(t){return t=Mi(t,e),r||(r=t.length>1),t}),Fi(e,bo(e),n),r&&(n=rr(n,de|he|fe,fo));for(var i=t.length;i--;)mi(n,t[i]);return n}),Bh=vo(function(e,t){return null==e?{}:qr(e,t)}),Uh=lo(Ul),jh=lo(jl),Wh=Xi(function(e,t,n){return t=t.toLowerCase(),e+(n?iu(t):t)}),Vh=Xi(function(e,t,n){return e+(n?"-":"")+t.toLowerCase()}),Hh=Xi(function(e,t,n){return e+(n?" ":"")+t.toLowerCase()}),Gh=Yi("toLowerCase"),Yh=Xi(function(e,t,n){return e+(n?"_":"")+t.toLowerCase()}),Xh=Xi(function(e,t,n){return e+(n?" ":"")+Zh(t)}),qh=Xi(function(e,t,n){return e+(n?" ":"")+t.toUpperCase()}),Zh=Yi("toUpperCase"),Kh=ni(function(e,t){try{return s(e,ie,t)}catch(e){return Qs(e)?e:new ic(e)}}),Jh=vo(function(e,t){return u(t,function(t){t=Qo(t),er(e,t,oh(e[t],e))}),e}),$h=Ji(),Qh=Ji(!0),ef=ni(function(e,t){return function(n){return Er(n,e,t)}}),tf=ni(function(e,t){return function(n){return Er(e,n,t)}}),nf=to(m),rf=to(d),of=to(b),af=io(),sf=io(!0),lf=eo(function(e,t){return e+t},0),uf=so("ceil"),cf=eo(function(e,t){return e/t},1),df=so("floor"),hf=eo(function(e,t){return e*t},1),ff=so("round"),pf=eo(function(e,t){return e-t},0);return n.after=Ss,n.ary=Es,n.assign=Th,n.assignIn=kh,n.assignInWith=Ch,n.assignWith=Ph,n.at=Oh,n.before=Ts,n.bind=oh,n.bindAll=Jh,n.bindKey=ah,n.castArray=Bs,n.chain=Ka,n.chunk=ra,n.compact=ia,n.concat=oa,n.cond=Tu,n.conforms=ku,n.constant=Cu,n.countBy=Kd,n.create=Cl,n.curry=ks,n.curryRight=Cs,n.debounce=Ps,n.defaults=Ah,n.defaultsDeep=Rh,n.defer=sh,n.delay=lh,n.difference=Rd,n.differenceBy=Ld,n.differenceWith=Dd,n.drop=aa,n.dropRight=sa,n.dropRightWhile=la,n.dropWhile=ua,n.fill=ca,n.filter=ss,n.flatMap=ls,n.flatMapDeep=us,n.flatMapDepth=cs,n.flatten=fa,n.flattenDeep=pa,n.flattenDepth=ma,n.flip=Os,n.flow=$h,n.flowRight=Qh,n.fromPairs=ga,n.functions=Il,n.functionsIn=zl,n.groupBy=Qd,n.initial=ba,n.intersection=Id,n.intersectionBy=zd,n.intersectionWith=Nd,n.invert=Lh,n.invertBy=Dh,n.invokeMap=eh,n.iteratee=Au,n.keyBy=th,n.keys=Ul,n.keysIn=jl,n.map=ps,n.mapKeys=Wl,n.mapValues=Vl,n.matches=Ru,n.matchesProperty=Lu,n.memoize=As,n.merge=zh,n.mergeWith=Nh,n.method=ef,n.methodOf=tf,n.mixin=Du,n.negate=Rs,n.nthArg=Nu,n.omit=Fh,n.omitBy=Hl,n.once=Ls,n.orderBy=ms,n.over=nf,n.overArgs=uh,n.overEvery=rf,n.overSome=of,n.partial=ch,n.partialRight=dh,n.partition=nh,n.pick=Bh,n.pickBy=Gl,n.property=Fu,n.propertyOf=Bu,n.pull=Fd,n.pullAll=Sa,n.pullAllBy=Ea,n.pullAllWith=Ta,n.pullAt=Bd,n.range=af,n.rangeRight=sf,n.rearg=hh,n.reject=ys,n.remove=ka,n.rest=Ds,n.reverse=Ca,n.sampleSize=xs,n.set=Xl,n.setWith=ql,n.shuffle=_s,n.slice=Pa,n.sortBy=rh,n.sortedUniq=za,n.sortedUniqBy=Na,n.split=mu,n.spread=Is,n.tail=Fa,n.take=Ba,n.takeRight=Ua,n.takeRightWhile=ja,n.takeWhile=Wa,n.tap=Ja,n.throttle=zs,n.thru=$a,n.toArray=xl,n.toPairs=Uh,n.toPairsIn=jh,n.toPath=Yu,n.toPlainObject=El,n.transform=Zl,n.unary=Ns,n.union=Ud,n.unionBy=jd,n.unionWith=Wd,n.uniq=Va,n.uniqBy=Ha,n.uniqWith=Ga,n.unset=Kl,n.unzip=Ya,n.unzipWith=Xa,n.update=Jl,n.updateWith=$l,n.values=Ql,n.valuesIn=eu,n.without=Vd,n.words=Eu,n.wrap=Fs,n.xor=Hd,n.xorBy=Gd,n.xorWith=Yd,n.zip=Xd,n.zipObject=qa,n.zipObjectDeep=Za,n.zipWith=qd,n.entries=Uh,n.entriesIn=jh,n.extend=kh,n.extendWith=Ch,Du(n,n),n.add=lf,n.attempt=Kh,n.camelCase=Wh,n.capitalize=iu,n.ceil=uf,n.clamp=tu,n.clone=Us,n.cloneDeep=Ws,n.cloneDeepWith=Vs,n.cloneWith=js,n.conformsTo=Hs,n.deburr=ou,n.defaultTo=Pu,n.divide=cf,n.endsWith=au,n.eq=Gs,n.escape=su,n.escapeRegExp=lu,n.every=as,n.find=Jd,n.findIndex=da,n.findKey=Pl,n.findLast=$d,n.findLastIndex=ha,n.findLastKey=Ol,n.floor=df,n.forEach=ds,n.forEachRight=hs,n.forIn=Al,n.forInRight=Rl,n.forOwn=Ll,n.forOwnRight=Dl,n.get=Nl,n.gt=fh,n.gte=ph,n.has=Fl,n.hasIn=Bl,n.head=va,n.identity=Ou,n.includes=fs,n.indexOf=ya,n.inRange=nu,n.invoke=Ih,n.isArguments=mh,n.isArray=gh,n.isArrayBuffer=vh,n.isArrayLike=Ys,n.isArrayLikeObject=Xs,n.isBoolean=qs,n.isBuffer=yh,n.isDate=bh,n.isElement=Zs,n.isEmpty=Ks,n.isEqual=Js,n.isEqualWith=$s,n.isError=Qs,n.isFinite=el,n.isFunction=tl,n.isInteger=nl,n.isLength=rl,n.isMap=xh,n.isMatch=al,n.isMatchWith=sl,n.isNaN=ll,n.isNative=ul,n.isNil=dl,n.isNull=cl,n.isNumber=hl,n.isObject=il,n.isObjectLike=ol,n.isPlainObject=fl,n.isRegExp=_h,n.isSafeInteger=pl,n.isSet=wh,n.isString=ml,n.isSymbol=gl,n.isTypedArray=Mh,n.isUndefined=vl,n.isWeakMap=yl,n.isWeakSet=bl,n.join=xa,n.kebabCase=Vh,n.last=_a,n.lastIndexOf=wa,n.lowerCase=Hh,n.lowerFirst=Gh,n.lt=Sh,n.lte=Eh,n.max=qu,n.maxBy=Zu,n.mean=Ku,n.meanBy=Ju,n.min=$u,n.minBy=Qu,n.stubArray=Uu,n.stubFalse=ju,n.stubObject=Wu,n.stubString=Vu,n.stubTrue=Hu,n.multiply=hf,n.nth=Ma,n.noConflict=Iu,n.noop=zu,n.now=ih,n.pad=uu,n.padEnd=cu,n.padStart=du,n.parseInt=hu,n.random=ru,n.reduce=gs,n.reduceRight=vs,n.repeat=fu,n.replace=pu,n.result=Yl,n.round=ff,n.runInContext=e,n.sample=bs,n.size=ws,n.snakeCase=Yh,n.some=Ms,n.sortedIndex=Oa,n.sortedIndexBy=Aa,n.sortedIndexOf=Ra,n.sortedLastIndex=La,n.sortedLastIndexBy=Da,n.sortedLastIndexOf=Ia,n.startCase=Xh,n.startsWith=gu,n.subtract=pf,n.sum=ec,n.sumBy=tc,n.template=vu,n.times=Gu,n.toFinite=_l,n.toInteger=wl,n.toLength=Ml,n.toLower=yu,n.toNumber=Sl,n.toSafeInteger=Tl,n.toString=kl,n.toUpper=bu,n.trim=xu,n.trimEnd=_u,n.trimStart=wu,n.truncate=Mu,n.unescape=Su,n.uniqueId=Xu,n.upperCase=qh,n.upperFirst=Zh,n.each=ds,n.eachRight=hs,n.first=va,Du(n,function(){var e={};return fr(n,function(t,r){gc.call(n.prototype,r)||(e[r]=t)}),e}(),{chain:!1}),n.VERSION="4.17.4",u(["bind","bindKey","curry","curryRight","partial","partialRight"],function(e){n[e].placeholder=n}),u(["drop","take"],function(e,t){x.prototype[e]=function(n){n=n===ie?1:Gc(wl(n),0);var r=this.__filtered__&&!t?new x(this):this.clone();return r.__filtered__?r.__takeCount__=Yc(n,r.__takeCount__):r.__views__.push({size:Yc(n,ze),type:e+(r.__dir__<0?"Right":"")}),r},x.prototype[e+"Right"]=function(t){return this.reverse()[e](t).reverse()}}),u(["filter","map","takeWhile"],function(e,t){var n=t+1,r=n==Oe||3==n;x.prototype[e]=function(e){var t=this.clone();return t.__iteratees__.push({iteratee:wo(e,3),type:n}),t.__filtered__=t.__filtered__||r,t}}),u(["head","last"],function(e,t){var n="take"+(t?"Right":"");x.prototype[e]=function(){return this[n](1).value()[0]}}),u(["initial","tail"],function(e,t){var n="drop"+(t?"":"Right");x.prototype[e]=function(){return this.__filtered__?new x(this):this[n](1)}}),x.prototype.compact=function(){return this.filter(Ou)},x.prototype.find=function(e){return this.filter(e).head()},x.prototype.findLast=function(e){return this.reverse().find(e)},x.prototype.invokeMap=ni(function(e,t){return"function"==typeof e?new x(this):this.map(function(n){return Er(n,e,t)})}),x.prototype.reject=function(e){return this.filter(Rs(wo(e)))},x.prototype.slice=function(e,t){e=wl(e);var n=this;return n.__filtered__&&(e>0||t<0)?new x(n):(e<0?n=n.takeRight(-e):e&&(n=n.drop(e)),t!==ie&&(t=wl(t),n=t<0?n.dropRight(-t):n.take(t-e)),n)},x.prototype.takeRightWhile=function(e){return this.reverse().takeWhile(e).reverse()},x.prototype.toArray=function(){return this.take(ze)},fr(x.prototype,function(e,t){var r=/^(?:filter|find|map|reject)|While$/.test(t),o=/^(?:head|last)$/.test(t),a=n[o?"take"+("last"==t?"Right":""):t],s=o||/^find/.test(t);a&&(n.prototype[t]=function(){var t=this.__wrapped__,l=o?[1]:arguments,u=t instanceof x,c=l[0],d=u||gh(t),h=function(e){var t=a.apply(n,g([e],l));return o&&f?t[0]:t};d&&r&&"function"==typeof c&&1!=c.length&&(u=d=!1);var f=this.__chain__,p=!!this.__actions__.length,m=s&&!f,v=u&&!p;if(!s&&d){t=v?t:new x(this);var y=e.apply(t,l);return y.__actions__.push({func:$a,args:[h],thisArg:ie}),new i(y,f)}return m&&v?e.apply(this,l):(y=this.thru(h),m?o?y.value()[0]:y.value():y)})}),u(["pop","push","shift","sort","splice","unshift"],function(e){var t=dc[e],r=/^(?:push|sort|unshift)$/.test(e)?"tap":"thru",i=/^(?:pop|shift)$/.test(e);n.prototype[e]=function(){var e=arguments;if(i&&!this.__chain__){var n=this.value();return t.apply(gh(n)?n:[],e)}return this[r](function(n){return t.apply(gh(n)?n:[],e)})}}),fr(x.prototype,function(e,t){var r=n[t];if(r){var i=r.name+"";(id[i]||(id[i]=[])).push({name:t,func:r})}}),id[$i(ie,ve).name]=[{name:"wrapper",func:ie}],x.prototype.clone=P,x.prototype.reverse=J,x.prototype.value=te,n.prototype.at=Zd,n.prototype.chain=Qa,n.prototype.commit=es,n.prototype.next=ts,n.prototype.plant=rs,n.prototype.reverse=is,n.prototype.toJSON=n.prototype.valueOf=n.prototype.value=os,n.prototype.first=n.prototype.head,Rc&&(n.prototype[Rc]=ns),n}();Ln._=Zn,(i=function(){return Zn}.call(t,n,t,r))!==ie&&(r.exports=i)}).call(this)}).call(t,n(80),n(81)(e))},function(e,t,n){e.exports={default:n(244),__esModule:!0}},function(e,t,n){var r=n(249);e.exports=function(e,t,n){if(r(e),void 0===t)return e;switch(n){case 1:return function(n){return e.call(t,n)};case 2:return function(n,r){return e.call(t,n,r)};case 3:return function(n,r,i){return e.call(t,n,r,i)}}return function(){return e.apply(t,arguments)}}},function(e,t,n){var r=n(102),i=n(58);e.exports=Object.keys||function(e){return r(e,i)}},function(e,t,n){var r=n(48);e.exports=function(e){return Object(r(e))}},function(e,t,n){e.exports=n(335)()},function(e,t,n){"use strict";function r(){if("undefined"!=typeof __REACT_DEVTOOLS_GLOBAL_HOOK__&&"function"==typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE)try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(r)}catch(e){console.error(e)}}r(),e.exports=n(337)},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0});var i=n(0),o=r(i),a=n(1),s=r(a),l=n(9),u=function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t.default=e,t}(l),c=n(394),d=(r(c),n(348)),h=r(d),f=n(24),p=r(f),m=n(155),g=r(m),v=n(154),y=r(v),b=n(157),x=r(b),_=n(163),w=r(_),M=n(158),S=r(M),E=n(164),T=r(E),k=n(84),C=r(k),P=n(156),O=r(P),A=n(159),R=r(A),L=n(160),D=r(L),I=n(161),z=r(I),N=(n(33),function(){function e(){(0,o.default)(this,e);var t=!this.isMobileDevice();this.coordinates=new g.default,this.renderer=new u.WebGLRenderer({antialias:t}),this.scene=new u.Scene,this.scene.background=new u.Color(1316634),this.dimension={width:0,height:0},this.ground="tile"===p.default.ground.type?new w.default:new x.default,this.map=new S.default,this.adc=new y.default,this.adcMeshAddedToScene=!1,this.planningTrajectory=new T.default,this.perceptionObstacles=new C.default,this.decision=new O.default,this.prediction=new R.default,this.routing=new D.default,this.routingEditor=new z.default,this.stats=null,p.default.debug.performanceMonitor&&(this.stats=new h.default,this.stats.showPanel(1),this.stats.domElement.style.position="absolute",this.stats.domElement.style.top=null,this.stats.domElement.style.bottom="0px",document.body.appendChild(this.stats.domElement)),this.geolocation={x:0,y:0}}return(0,s.default)(e,[{key:"initialize",value:function(e,t,n,r){this.options=r,this.canvasId=e,this.viewAngle=p.default.camera.viewAngle,this.viewDistance=p.default.camera.laneWidth*p.default.camera.laneWidthToViewDistanceRatio,this.camera=new u.PerspectiveCamera(p.default.camera[this.options.cameraAngle].fov,window.innerWidth/window.innerHeight,p.default.camera[this.options.cameraAngle].near,p.default.camera[this.options.cameraAngle].far),this.camera.name="camera",this.scene.add(this.camera),this.updateDimension(t,n),this.renderer.setPixelRatio(window.devicePixelRatio),document.getElementById(e).appendChild(this.renderer.domElement);var i=new u.AmbientLight(4473924),o=new u.DirectionalLight(16772829);o.position.set(0,0,1).normalize(),this.controls=new u.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(e,t){this.coordinates.isInitialized()||this.coordinates.initialize(e,t)}},{key:"updateDimension",value:function(e,t){this.camera.aspect=e/t,this.camera.updateProjectionMatrix(),this.renderer.setSize(e,t),this.dimension.width=e,this.dimension.height=t}},{key:"enableOrbitControls",value:function(){var e=this.adc.mesh.position;this.controls.enabled=!0,this.controls.enableRotate=!1,this.controls.reset(),this.controls.minDistance=20,this.controls.maxDistance=1e3,this.controls.target.set(e.x,e.y,0),this.camera.position.set(e.x,e.y,50),this.camera.up.set(0,1,0),this.camera.lookAt(e.x,e.y,0)}},{key:"adjustCamera",value:function(e,t){if(!this.routingEditor.isInEditingMode()){switch(this.camera.fov=p.default.camera[t].fov,this.camera.near=p.default.camera[t].near,this.camera.far=p.default.camera[t].far,t){case"Default":var n=this.viewDistance*Math.cos(e.rotation.y)*Math.cos(this.viewAngle),r=this.viewDistance*Math.sin(e.rotation.y)*Math.cos(this.viewAngle),i=this.viewDistance*Math.sin(this.viewAngle);this.camera.position.x=e.position.x-n,this.camera.position.y=e.position.y-r,this.camera.position.z=e.position.z+i,this.camera.up.set(0,0,1),this.camera.lookAt({x:e.position.x+2*n,y:e.position.y+2*r,z:0}),this.controls.enabled=!1;break;case"Near":n=.5*this.viewDistance*Math.cos(e.rotation.y)*Math.cos(this.viewAngle),r=.5*this.viewDistance*Math.sin(e.rotation.y)*Math.cos(this.viewAngle),i=.5*this.viewDistance*Math.sin(this.viewAngle),this.camera.position.x=e.position.x-n,this.camera.position.y=e.position.y-r,this.camera.position.z=e.position.z+i,this.camera.up.set(0,0,1),this.camera.lookAt({x:e.position.x+2*n,y:e.position.y+2*r,z:0}),this.controls.enabled=!1;break;case"Overhead":r=.5*this.viewDistance*Math.sin(e.rotation.y)*Math.cos(this.viewAngle),i=2*this.viewDistance*Math.sin(this.viewAngle),this.camera.position.x=e.position.x,this.camera.position.y=e.position.y+r,this.camera.position.z=2*(e.position.z+i),this.camera.up.set(0,1,0),this.camera.lookAt({x:e.position.x,y:e.position.y+r,z:0}),this.controls.enabled=!1;break;case"Monitor":this.camera.position.set(e.position.x,e.position.y,50),this.camera.up.set(0,1,0),this.camera.lookAt(e.position.x,e.position.y,0),this.controls.enabled=!1;break;case"Map":this.controls.enabled||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:"addDefaultEndPoint",value:function(e){for(var t=0;t0)n=e.stepSize;else{var o=r.niceNum(t.max-t.min,!1);n=r.niceNum(o/(e.maxTicks-1),!0)}var a=Math.floor(t.min/n)*n,s=Math.ceil(t.max/n)*n;e.min&&e.max&&e.stepSize&&r.almostWhole((e.max-e.min)/e.stepSize,n/1e3)&&(a=e.min,s=e.max);var l=(s-a)/n;l=r.almostEquals(l,Math.round(l),n/1e3)?Math.round(l):Math.ceil(l),i.push(void 0!==e.min?e.min:a);for(var u=1;u3?n[2]-n[1]:n[1]-n[0];Math.abs(i)>1&&e!==Math.floor(e)&&(i=e-Math.floor(e));var o=r.log10(Math.abs(i)),a="";if(0!==e){var s=-1*Math.floor(o);s=Math.max(Math.min(s,20),0),a=e.toFixed(s)}else a="0";return a},logarithmic:function(e,t,n){var i=e/Math.pow(10,Math.floor(r.log10(e)));return 0===e?"0":1===i||2===i||5===i||0===t||t===n.length-1?e.toExponential():""}}}},function(e,t){e.exports={}},function(e,t){e.exports=function(e,t){return{enumerable:!(1&e),configurable:!(2&e),writable:!(4&e),value:t}}},function(e,t,n){"use strict";function r(e){return"string"==typeof e&&i.test(e)}Object.defineProperty(t,"__esModule",{value:!0}),t.default=r;var i=/-webkit-|-moz-|-ms-/;e.exports=t.default},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function i(e,t,n,r){function i(e){if(r){var t=e.clone();r(t)}}h[t]?i(h[t]):c.load(e,function(e){var r=new s.OBJLoader;e.preload(),r.setMaterials(e),r.load(t,function(e){e.name=t,e.scale.set(n.x,n.y,n.z),h[t]=e,i(e)})})}function o(e,t){d.load(e,t)}Object.defineProperty(t,"__esModule",{value:!0}),t.loadObject=i,t.loadTexture=o;var a=n(9),s=function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t.default=e,t}(a),l=n(396),u=(r(l),n(395)),c=(r(u),new s.MTLLoader),d=new s.TextureLoader;s.TextureLoader.prototype.crossOrigin="";var h={}},function(e,t,n){e.exports={default:n(236),__esModule:!0}},function(e,t,n){"use strict";var r={noop:function(){},uid:function(){var e=0;return function(){return e++}}(),isNullOrUndef:function(e){return null===e||void 0===e},isArray:Array.isArray?Array.isArray:function(e){return"[object Array]"===Object.prototype.toString.call(e)},isObject:function(e){return null!==e&&"[object Object]"===Object.prototype.toString.call(e)},valueOrDefault:function(e,t){return void 0===e?t:e},valueAtIndexOrDefault:function(e,t,n){return r.valueOrDefault(r.isArray(e)?e[t]:e,n)},callback:function(e,t,n){if(e&&"function"==typeof e.call)return e.apply(n,t)},each:function(e,t,n,i){var o,a,s;if(r.isArray(e))if(a=e.length,i)for(o=a-1;o>=0;o--)t.call(n,e[o],o);else for(o=0;odocument.F=Object<\/script>"),e.close(),l=e.F;r--;)delete l.prototype[o[r]];return l()};e.exports=Object.create||function(e,t){var n;return null!==e?(s.prototype=r(e),n=new s,s.prototype=null,n[a]=e):n=l(),void 0===t?n:i(n,t)}},function(e,t){t.f={}.propertyIsEnumerable},function(e,t,n){var r=n(17).f,i=n(31),o=n(12)("toStringTag");e.exports=function(e,t,n){e&&!i(e=n?e:e.prototype,o)&&r(e,o,{configurable:!0,value:t})}},function(e,t,n){var r=n(69),i=Math.min;e.exports=function(e){return e>0?i(r(e),9007199254740991):0}},function(e,t){var n=0,r=Math.random();e.exports=function(e){return"Symbol(".concat(void 0===e?"":e,")_",(++n+r).toString(36))}},function(e,t,n){"use strict";var r=n(270)(!0);n(61)(String,"String",function(e){this._t=String(e),this._i=0},function(){var e,t=this._t,n=this._i;return n>=t.length?{value:void 0,done:!0}:(e=r(t,n),this._i+=e.length,{value:e,done:!1})})},function(e,t,n){"use strict";function r(e){return function(){return e}}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(e){return e},e.exports=i},function(e,t,n){"use strict";function r(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])}function i(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;if(e.constructor===Array&&e.length>0)for(;tb;b++)if((g=t?y(a(p=e[b])[0],p[1]):y(e[b]))===u||g===c)return g}else for(m=v.call(e);!(p=m.next()).done;)if((g=i(m,y,p.value,t))===u||g===c)return g};t.BREAK=u,t.RETURN=c},function(e,t,n){var r=n(57);e.exports=Object("z").propertyIsEnumerable(0)?Object:function(e){return"String"==r(e)?e.split(""):Object(e)}},function(e,t,n){"use strict";var r=n(62),i=n(16),o=n(104),a=n(27),s=n(31),l=n(42),u=n(262),c=n(51),d=n(101),h=n(12)("iterator"),f=!([].keys&&"next"in[].keys()),p=function(){return this};e.exports=function(e,t,n,m,g,v,y){u(n,t,m);var b,x,_,w=function(e){if(!f&&e in T)return T[e];switch(e){case"keys":case"values":return function(){return new n(this,e)}}return function(){return new n(this,e)}},M=t+" Iterator",S="values"==g,E=!1,T=e.prototype,k=T[h]||T["@@iterator"]||g&&T[g],C=k||w(g),P=g?S?w("entries"):C:void 0,O="Array"==t?T.entries||k:k;if(O&&(_=d(O.call(new e)))!==Object.prototype&&(c(_,M,!0),r||s(_,h)||a(_,h,p)),S&&k&&"values"!==k.name&&(E=!0,C=function(){return k.call(this)}),r&&!y||!f&&!E&&T[h]||a(T,h,C),l[t]=C,l[M]=p,g)if(b={values:S?C:w("values"),keys:v?C:w("keys"),entries:P},y)for(x in b)x in T||o(T,x,b[x]);else i(i.P+i.F*(f||E),t,b);return b}},function(e,t){e.exports=!0},function(e,t,n){var r=n(53)("meta"),i=n(32),o=n(31),a=n(17).f,s=0,l=Object.isExtensible||function(){return!0},u=!n(30)(function(){return l(Object.preventExtensions({}))}),c=function(e){a(e,r,{value:{i:"O"+ ++s,w:{}}})},d=function(e,t){if(!i(e))return"symbol"==typeof e?e:("string"==typeof e?"S":"P")+e;if(!o(e,r)){if(!l(e))return"F";if(!t)return"E";c(e)}return e[r].i},h=function(e,t){if(!o(e,r)){if(!l(e))return!0;if(!t)return!1;c(e)}return e[r].w},f=function(e){return u&&p.NEED&&l(e)&&!o(e,r)&&c(e),e},p=e.exports={KEY:r,NEED:!1,fastKey:d,getWeak:h,onFreeze:f}},function(e,t,n){var r=n(50),i=n(43),o=n(28),a=n(70),s=n(31),l=n(95),u=Object.getOwnPropertyDescriptor;t.f=n(19)?u:function(e,t){if(e=o(e),t=a(t,!0),l)try{return u(e,t)}catch(e){}if(s(e,t))return i(!r.f.call(e,t),e[t])}},function(e,t){t.f=Object.getOwnPropertySymbols},function(e,t,n){var r=n(16),i=n(10),o=n(30);e.exports=function(e,t){var n=(i.Object||{})[e]||Object[e],a={};a[e]=t(n),r(r.S+r.F*o(function(){n(1)}),"Object",a)}},function(e,t,n){var r=n(68)("keys"),i=n(53);e.exports=function(e){return r[e]||(r[e]=i(e))}},function(e,t,n){var r=n(20),i=r["__core-js_shared__"]||(r["__core-js_shared__"]={});e.exports=function(e){return i[e]||(i[e]={})}},function(e,t){var n=Math.ceil,r=Math.floor;e.exports=function(e){return isNaN(e=+e)?0:(e>0?r:n)(e)}},function(e,t,n){var r=n(32);e.exports=function(e,t){if(!r(e))return e;var n,i;if(t&&"function"==typeof(n=e.toString)&&!r(i=n.call(e)))return i;if("function"==typeof(n=e.valueOf)&&!r(i=n.call(e)))return i;if(!t&&"function"==typeof(n=e.toString)&&!r(i=n.call(e)))return i;throw TypeError("Can't convert object to primitive value")}},function(e,t,n){var r=n(20),i=n(10),o=n(62),a=n(72),s=n(17).f;e.exports=function(e){var t=i.Symbol||(i.Symbol=o?{}:r.Symbol||{});"_"==e.charAt(0)||e in t||s(t,e,{value:a.f(e)})}},function(e,t,n){t.f=n(12)},function(e,t,n){var r=n(93),i=n(12)("iterator"),o=n(42);e.exports=n(10).getIteratorMethod=function(e){if(void 0!=e)return e[i]||e["@@iterator"]||o[r(e)]}},function(e,t,n){n(274);for(var r=n(20),i=n(27),o=n(42),a=n(12)("toStringTag"),s=["NodeList","DOMTokenList","MediaList","StyleSheetList","CSSRuleList"],l=0;l<5;l++){var u=s[l],c=r[u],d=c&&c.prototype;d&&!d[a]&&i(d,a,u),o[u]=o.Array}},function(e,t,n){"use strict";function r(e,t,n,r,o,a,s,l){if(i(t),!e){var u;if(void 0===t)u=new Error("Minified exception occurred; use the non-minified dev environment for the full error message and additional helpful warnings.");else{var c=[n,r,o,a,s,l],d=0;u=new Error(t.replace(/%s/g,function(){return c[d++]})),u.name="Invariant Violation"}throw u.framesToPop=1,u}}var i=function(e){};e.exports=r},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0});var i=n(304),o=r(i),a=n(307),s=r(a),l=n(306),u=r(l),c=n(308),d=r(c),h=n(309),f=r(h),p=n(310),m=r(p),g=n(311),v=r(g),y=n(312),b=r(y),x=n(313),_=r(x),w=n(314),M=r(w),S=n(315),E=r(S),T=n(317),k=r(T),C=n(305),P=r(C),O=[u.default,s.default,d.default,m.default,v.default,b.default,_.default,M.default,E.default,f.default],A=(0,o.default)({prefixMap:P.default.prefixMap,plugins:O},k.default);t.default=A,e.exports=t.default},function(e,t,n){"use strict";function r(e){return e.charAt(0).toUpperCase()+e.slice(1)}Object.defineProperty(t,"__esModule",{value:!0}),t.default=r,e.exports=t.default},function(e,t,n){"use strict";function r(e){if(null===e||void 0===e)throw new TypeError("Object.assign cannot be called with null or undefined");return Object(e)}/* +!function(){"use strict";function n(){for(var e=[],t=0;t0}function o(e,t){var n=e.interceptors||(e.interceptors=[]);return n.push(t),Se(function(){var e=n.indexOf(t);-1!==e&&n.splice(e,1)})}function a(e,t){var n=pt();try{var r=e.interceptors;if(r)for(var i=0,o=r.length;i0}function l(e,t){var n=e.changeListeners||(e.changeListeners=[]);return n.push(t),Se(function(){var e=n.indexOf(t);-1!==e&&n.splice(e,1)})}function u(e,t){var n=pt(),r=e.changeListeners;if(r){r=r.slice();for(var i=0,o=r.length;i=this.length,value:t0,"actions should have valid names, got: '"+e+"'");var n=function(){return S(e,t,this,arguments)};return n.originalFn=t,n.isMobxAction=!0,n}function S(e,t,n,r){var i=E(e,t,n,r);try{return t.apply(n,r)}finally{T(i)}}function E(e,t,n,r){var i=c()&&!!e,o=0;if(i){o=Date.now();var a=r&&r.length||0,s=new Array(a);if(a>0)for(var l=0;l",i="function"==typeof e?e:t,o="function"==typeof e?t:n;return we("function"==typeof i,w("m002")),we(0===i.length,w("m003")),we("string"==typeof r&&r.length>0,"actions should have valid names, got: '"+r+"'"),S(r,i,o,void 0)}function B(e){return"function"==typeof e&&!0===e.isMobxAction}function F(e,t,n){var r=function(){return S(t,n,e,arguments)};r.isMobxAction=!0,Ae(e,t,r)}function U(e,t){return e===t}function j(e,t){return ze(e,t)}function W(e,t){return Be(e,t)||U(e,t)}function V(e,t,n){function r(){o(s)}var i,o,a;"string"==typeof e?(i=e,o=t,a=n):(i=e.name||"Autorun@"+xe(),o=e,a=t),we("function"==typeof o,w("m004")),we(!1===B(o),w("m005")),a&&(o=o.bind(a));var s=new Gn(i,function(){this.track(r)});return s.schedule(),s.getDisposer()}function H(e,t,n,r){var i,o,a,s;return"string"==typeof e?(i=e,o=t,a=n,s=r):(i="When@"+xe(),o=e,a=t,s=n),V(i,function(e){if(o.call(s)){e.dispose();var t=pt();a.call(s),mt(t)}})}function G(e,t,n,r){function i(){a(c)}var o,a,s,l;"string"==typeof e?(o=e,a=t,s=n,l=r):(o=e.name||"AutorunAsync@"+xe(),a=e,s=t,l=n),we(!1===B(a),w("m006")),void 0===s&&(s=1),l&&(a=a.bind(l));var u=!1,c=new Gn(o,function(){u||(u=!0,setTimeout(function(){u=!1,c.isDisposed||c.track(i)},s))});return c.schedule(),c.getDisposer()}function Y(e,t,n){function r(){if(!u.isDisposed){var n=!1;u.track(function(){var t=e(u);n=a||!l(o,t),o=t}),a&&i.fireImmediately&&t(o,u),a||!0!==n||t(o,u),a&&(a=!1)}}arguments.length>3&&_e(w("m007")),ce(e)&&_e(w("m008"));var i;i="object"==typeof n?n:{},i.name=i.name||e.name||t.name||"Reaction@"+xe(),i.fireImmediately=!0===n||!0===i.fireImmediately,i.delay=i.delay||0,i.compareStructural=i.compareStructural||i.struct||!1,t=pn(i.name,i.context?t.bind(i.context):t),i.context&&(e=e.bind(i.context));var o,a=!0,s=!1,l=i.equals?i.equals:i.compareStructural||i.struct?mn.structural:mn.default,u=new Gn(i.name,function(){a||i.delay<1?r():s||(s=!0,setTimeout(function(){s=!1,r()},i.delay))});return u.schedule(),u.getDisposer()}function q(e,t){if(ne(e)&&e.hasOwnProperty("$mobx"))return e.$mobx;we(Object.isExtensible(e),w("m035")),Oe(e)||(t=(e.constructor.name||"ObservableObject")+"@"+xe()),t||(t="ObservableObject@"+xe());var n=new yn(e,t);return Re(e,"$mobx",n),n}function X(e,t,n,r){if(e.values[t]&&!vn(e.values[t]))return we("value"in n,"The property "+t+" in "+e.name+" is already observable, cannot redefine it as computed property"),void(e.target[t]=n.value);if("value"in n)if(ce(n.value)){var i=n.value;Z(e,t,i.initialValue,i.enhancer)}else B(n.value)&&!0===n.value.autoBind?F(e.target,t,n.value.originalFn):vn(n.value)?J(e,t,n.value):Z(e,t,n.value,r);else K(e,t,n.get,n.set,mn.default,!0)}function Z(e,t,n,r){if(De(e.target,t),i(e)){var o=a(e,{object:e.target,name:t,type:"add",newValue:n});if(!o)return;n=o.newValue}n=(e.values[t]=new un(n,r,e.name+"."+t,!1)).value,Object.defineProperty(e.target,t,Q(t)),te(e,e.target,t,n)}function K(e,t,n,r,i,o){o&&De(e.target,t),e.values[t]=new gn(n,e.target,i,e.name+"."+t,r),o&&Object.defineProperty(e.target,t,$(t))}function J(e,t,n){var r=e.name+"."+t;n.name=r,n.scope||(n.scope=e.target),e.values[t]=n,Object.defineProperty(e.target,t,$(t))}function Q(e){return bn[e]||(bn[e]={configurable:!0,enumerable:!0,get:function(){return this.$mobx.values[e].get()},set:function(t){ee(this,e,t)}})}function $(e){return xn[e]||(xn[e]={configurable:!0,enumerable:!1,get:function(){return this.$mobx.values[e].get()},set:function(t){return this.$mobx.values[e].set(t)}})}function ee(e,t,n){var r=e.$mobx,o=r.values[t];if(i(r)){var l=a(r,{type:"update",object:e,name:t,newValue:n});if(!l)return;n=l.newValue}if((n=o.prepareNewValue(n))!==ln){var d=s(r),p=c(),l=d||p?{type:"update",object:e,oldValue:o.value,name:t,newValue:n}:null;p&&h(l),o.setNewValue(n),d&&u(r,l),p&&f()}}function te(e,t,n,r){var i=s(e),o=c(),a=i||o?{type:"add",object:t,name:n,newValue:r}:null;o&&h(a),i&&u(e,a),o&&f()}function ne(e){return!!ke(e)&&(D(e),_n(e.$mobx))}function re(e,t){if(null===e||void 0===e)return!1;if(void 0!==t){if(_(e)||An(e))throw new Error(w("m019"));if(ne(e)){var n=e.$mobx;return n.values&&!!n.values[t]}return!1}return ne(e)||!!e.$mobx||Jt(e)||Xn(e)||vn(e)}function ie(e){return we(!!e,":("),R(function(t,n,r,i,o){De(t,n),we(!o||!o.get,w("m022")),Z(q(t,void 0),n,r,e)},function(e){var t=this.$mobx.values[e];if(void 0!==t)return t.get()},function(e,t){ee(this,e,t)},!0,!1)}function oe(e){for(var t=[],n=1;n=2,w("m014")),we("object"==typeof e,w("m015")),we(!An(e),w("m016")),n.forEach(function(e){we("object"==typeof e,w("m017")),we(!re(e),w("m018"))});for(var r=q(e),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,e===a&&!Le(e,s))continue;var l=Object.getOwnPropertyDescriptor(a,s);X(r,s,l,t)}}return e}function le(e){if(void 0===e&&(e=void 0),"string"==typeof arguments[1])return wn.apply(null,arguments);if(we(arguments.length<=1,w("m021")),we(!ce(e),w("m020")),re(e))return e;var t=he(e,void 0,void 0);return t!==e?t:On.box(e)}function ue(e){_e("Expected one or two arguments to observable."+e+". Did you accidentally try to use observable."+e+" as decorator?")}function ce(e){return"object"==typeof e&&null!==e&&!0===e.isMobxModifierDescriptor}function de(e,t){return we(!ce(t),"Modifiers cannot be nested"),{isMobxModifierDescriptor:!0,initialValue:t,enhancer:e}}function he(e,t,n){return ce(e)&&_e("You tried to assign a modifier wrapped value to a collection, please define modifiers when creating the collection, not when modifying it"),re(e)?e:Array.isArray(e)?On.array(e,n):Oe(e)?On.object(e,n):je(e)?On.map(e,n):e}function fe(e,t,n){return ce(e)&&_e("You tried to assign a modifier wrapped value to a collection, please define modifiers when creating the collection, not when modifying it"),void 0===e||null===e?e:ne(e)||_(e)||An(e)?e:Array.isArray(e)?On.shallowArray(e,n):Oe(e)?On.shallowObject(e,n):je(e)?On.shallowMap(e,n):_e("The shallow modifier / decorator can only used in combination with arrays, objects and maps")}function pe(e){return e}function me(e,t,n){if(ze(e,t))return t;if(re(e))return e;if(Array.isArray(e))return new on(e,me,n);if(je(e))return new Pn(e,me,n);if(Oe(e)){var r={};return q(r,n),se(r,me,[e]),r}return e}function ge(e,t,n){return ze(e,t)?t:e}function ve(e,t){void 0===t&&(t=void 0),et();try{return e.apply(t)}finally{tt()}}function ye(e){return Me("`mobx.map` is deprecated, use `new ObservableMap` or `mobx.observable.map` instead"),On.map(e)}function be(){return"undefined"!=typeof window?window:e}function xe(){return++Bn.mobxGuid}function _e(e,t){throw we(!1,e,t),"X"}function we(e,t,n){if(!e)throw new Error("[mobx] Invariant failed: "+t+(n?" in '"+n+"'":""))}function Me(e){return-1===Ln.indexOf(e)&&(Ln.push(e),console.error("[mobx] Deprecated: "+e),!0)}function Se(e){var t=!1;return function(){if(!t)return t=!0,e.apply(this,arguments)}}function Ee(e){var t=[];return e.forEach(function(e){-1===t.indexOf(e)&&t.push(e)}),t}function Te(e,t,n){return void 0===t&&(t=100),void 0===n&&(n=" - "),e?e.slice(0,t).join(n)+(e.length>t?" (... and "+(e.length-t)+"more)":""):""}function ke(e){return null!==e&&"object"==typeof e}function Oe(e){if(null===e||"object"!=typeof e)return!1;var t=Object.getPrototypeOf(e);return t===Object.prototype||null===t}function Ce(){for(var e=arguments[0],t=1,n=arguments.length;t=0;i--)if(!ze(e[i],t[i]))return!1;return!0}if(r){if(e.size!==t.size)return!1;var o=!0;return e.forEach(function(e,n){o=o&&ze(t.get(n),e)}),o}if("object"==typeof e&&"object"==typeof t){if(null===e||null===t)return!1;if(Ue(e)&&Ue(t))return e.size===t.size&&ze(On.shallowMap(e).entries(),On.shallowMap(t).entries());if(Ie(e).length!==Ie(t).length)return!1;for(var a in e){if(!(a in t))return!1;if(!ze(e[a],t[a]))return!1}return!0}return!1}function Ne(e,t){var n="isMobX"+e;return t.prototype[n]=!0,function(e){return ke(e)&&!0===e[n]}}function Be(e,t){return"number"==typeof e&&"number"==typeof t&&isNaN(e)&&isNaN(t)}function Fe(e){return Array.isArray(e)||_(e)}function Ue(e){return je(e)||An(e)}function je(e){return void 0!==be().Map&&e instanceof be().Map}function We(e){var t;return Oe(e)?t=Object.keys(e):Array.isArray(e)?t=e.map(function(e){return e[0]}):Ue(e)?t=Array.from(e.keys()):_e("Cannot get keys from "+e),t}function Ve(){return"function"==typeof Symbol&&Symbol.toPrimitive||"@@toPrimitive"}function He(e){return null===e?null:"object"==typeof e?""+e:e}function Ge(){Un=!0,be().__mobxInstanceCount--}function Ye(){Me("Using `shareGlobalState` is not recommended, use peer dependencies instead. See https://github.com/mobxjs/mobx/issues/1082 for details."),Fn=!0;var e=be(),t=Bn;if(e.__mobservableTrackingStack||e.__mobservableViewStack)throw new Error("[mobx] An incompatible version of mobservable is already loaded.");if(e.__mobxGlobal&&e.__mobxGlobal.version!==t.version)throw new Error("[mobx] An incompatible version of mobx is already loaded.");e.__mobxGlobal?Bn=e.__mobxGlobal:e.__mobxGlobal=t}function qe(){return Bn}function Xe(){Bn.resetId++;var e=new Nn;for(var t in e)-1===zn.indexOf(t)&&(Bn[t]=e[t]);Bn.allowStateChanges=!Bn.strictMode}function Ze(e){return e.observers&&e.observers.length>0}function Ke(e){return e.observers}function Je(e,t){var n=e.observers.length;n&&(e.observersIndexes[t.__mapid]=n),e.observers[n]=t,e.lowestObserverState>t.dependenciesState&&(e.lowestObserverState=t.dependenciesState)}function Qe(e,t){if(1===e.observers.length)e.observers.length=0,$e(e);else{var n=e.observers,r=e.observersIndexes,i=n.pop();if(i!==t){var o=r[t.__mapid]||0;o?r[i.__mapid]=o:delete r[i.__mapid],n[o]=i}delete r[t.__mapid]}}function $e(e){e.isPendingUnobservation||(e.isPendingUnobservation=!0,Bn.pendingUnobservations.push(e))}function et(){Bn.inBatch++}function tt(){if(0==--Bn.inBatch){bt();for(var e=Bn.pendingUnobservations,t=0;t0;Bn.computationDepth>0&&t&&_e(w("m031")+e.name),!Bn.allowStateChanges&&t&&_e(w(Bn.strictMode?"m030a":"m030b")+e.name)}function ct(e,t,n){gt(e),e.newObserving=new Array(e.observing.length+100),e.unboundDepsCount=0,e.runId=++Bn.runId;var r=Bn.trackingDerivation;Bn.trackingDerivation=e;var i;try{i=t.call(n)}catch(e){i=new Hn(e)}return Bn.trackingDerivation=r,dt(e),i}function dt(e){for(var t=e.observing,n=e.observing=e.newObserving,r=Vn.UP_TO_DATE,i=0,o=e.unboundDepsCount,a=0;ar&&(r=s.dependenciesState)}for(n.length=i,e.newObserving=null,o=t.length;o--;){var s=t[o];0===s.diffValue&&Qe(s,e),s.diffValue=0}for(;i--;){var s=n[i];1===s.diffValue&&(s.diffValue=0,Je(s,e))}r!==Vn.UP_TO_DATE&&(e.dependenciesState=r,e.onBecomeStale())}function ht(e){var t=e.observing;e.observing=[];for(var n=t.length;n--;)Qe(t[n],e);e.dependenciesState=Vn.NOT_TRACKING}function ft(e){var t=pt(),n=e();return mt(t),n}function pt(){var e=Bn.trackingDerivation;return Bn.trackingDerivation=null,e}function mt(e){Bn.trackingDerivation=e}function gt(e){if(e.dependenciesState!==Vn.UP_TO_DATE){e.dependenciesState=Vn.UP_TO_DATE;for(var t=e.observing,n=t.length;n--;)t[n].lowestObserverState=Vn.UP_TO_DATE}}function vt(e){we(this&&this.$mobx&&Xn(this.$mobx),"Invalid `this`"),we(!this.$mobx.errorHandler,"Only one onErrorHandler can be registered"),this.$mobx.errorHandler=e}function yt(e){return Bn.globalReactionErrorHandlers.push(e),function(){var t=Bn.globalReactionErrorHandlers.indexOf(e);t>=0&&Bn.globalReactionErrorHandlers.splice(t,1)}}function bt(){Bn.inBatch>0||Bn.isRunningReactions||qn(xt)}function xt(){Bn.isRunningReactions=!0;for(var e=Bn.pendingReactions,t=0;e.length>0;){++t===Yn&&(console.error("Reaction doesn't converge to a stable state after "+Yn+" iterations. Probably there is a cycle in the reactive function: "+e[0]),e.splice(0));for(var n=e.splice(0),r=0,i=n.length;r0&&(t.dependencies=Ee(e.observing).map(Ht)),t}function Gt(e,t){return Yt(kt(e,t))}function Yt(e){var t={name:e.name};return Ze(e)&&(t.observers=Ke(e).map(Yt)),t}function qt(e,t,n){var r;if(An(e)||_(e)||cn(e))r=Ot(e);else{if(!ne(e))return _e("Expected observable map, object or array as first array");if("string"!=typeof t)return _e("InterceptReads can only be used with a specific property, not with an object in general");r=Ot(e,t)}return void 0!==r.dehancer?_e("An intercept reader was already established"):(r.dehancer="function"==typeof t?t:n,function(){r.dehancer=void 0})}n.d(t,"extras",function(){return Qn}),n.d(t,"Reaction",function(){return Gn}),n.d(t,"untracked",function(){return ft}),n.d(t,"IDerivationState",function(){return Vn}),n.d(t,"Atom",function(){return Kt}),n.d(t,"BaseAtom",function(){return Zt}),n.d(t,"useStrict",function(){return k}),n.d(t,"isStrictModeEnabled",function(){return O}),n.d(t,"spy",function(){return p}),n.d(t,"comparer",function(){return mn}),n.d(t,"asReference",function(){return wt}),n.d(t,"asFlat",function(){return St}),n.d(t,"asStructure",function(){return Mt}),n.d(t,"asMap",function(){return Et}),n.d(t,"isModifierDescriptor",function(){return ce}),n.d(t,"isObservableObject",function(){return ne}),n.d(t,"isBoxedObservable",function(){return cn}),n.d(t,"isObservableArray",function(){return _}),n.d(t,"ObservableMap",function(){return Pn}),n.d(t,"isObservableMap",function(){return An}),n.d(t,"map",function(){return ye}),n.d(t,"transaction",function(){return ve}),n.d(t,"observable",function(){return On}),n.d(t,"computed",function(){return Jn}),n.d(t,"isObservable",function(){return re}),n.d(t,"isComputed",function(){return Pt}),n.d(t,"extendObservable",function(){return oe}),n.d(t,"extendShallowObservable",function(){return ae}),n.d(t,"observe",function(){return At}),n.d(t,"intercept",function(){return Dt}),n.d(t,"autorun",function(){return V}),n.d(t,"autorunAsync",function(){return G}),n.d(t,"when",function(){return H}),n.d(t,"reaction",function(){return Y}),n.d(t,"action",function(){return pn}),n.d(t,"isAction",function(){return B}),n.d(t,"runInAction",function(){return N}),n.d(t,"expr",function(){return Nt}),n.d(t,"toJS",function(){return Bt}),n.d(t,"createTransformer",function(){return Ft}),n.d(t,"whyRun",function(){return Wt}),n.d(t,"isArrayLike",function(){return Fe});/*! ***************************************************************************** +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 Xt=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])},Zt=function(){function e(e){void 0===e&&(e="Atom@"+xe()),this.name=e,this.isPendingUnobservation=!0,this.observers=[],this.observersIndexes={},this.diffValue=0,this.lastAccessedBy=0,this.lowestObserverState=Vn.NOT_TRACKING}return e.prototype.onBecomeUnobserved=function(){},e.prototype.reportObserved=function(){nt(this)},e.prototype.reportChanged=function(){et(),rt(this),tt()},e.prototype.toString=function(){return this.name},e}(),Kt=function(e){function t(t,n,r){void 0===t&&(t="Atom@"+xe()),void 0===n&&(n=Dn),void 0===r&&(r=Dn);var i=e.call(this,t)||this;return i.name=t,i.onBecomeObservedHandler=n,i.onBecomeUnobservedHandler=r,i.isPendingUnobservation=!1,i.isBeingTracked=!1,i}return r(t,e),t.prototype.reportObserved=function(){return et(),e.prototype.reportObserved.call(this),this.isBeingTracked||(this.isBeingTracked=!0,this.onBecomeObservedHandler()),tt(),!!Bn.trackingDerivation},t.prototype.onBecomeUnobserved=function(){this.isBeingTracked=!1,this.onBecomeUnobservedHandler()},t}(Zt),Jt=Ne("Atom",Zt),Qt={spyReportEnd:!0},$t="__$$iterating",en=function(){var e=!1,t={};return Object.defineProperty(t,"0",{set:function(){e=!0}}),Object.create(t)[0]=1,!1===e}(),tn=0,nn=function(){function e(){}return e}();!function(e,t){void 0!==Object.setPrototypeOf?Object.setPrototypeOf(e.prototype,t):void 0!==e.prototype.__proto__?e.prototype.__proto__=t:e.prototype=t}(nn,Array.prototype),Object.isFrozen(Array)&&["constructor","push","shift","concat","pop","unshift","replace","find","findIndex","splice","reverse","sort"].forEach(function(e){Object.defineProperty(nn.prototype,e,{configurable:!0,writable:!0,value:Array.prototype[e]})});var rn=function(){function e(e,t,n,r){this.array=n,this.owned=r,this.values=[],this.lastKnownLength=0,this.interceptors=null,this.changeListeners=null,this.atom=new Zt(e||"ObservableArray@"+xe()),this.enhancer=function(n,r){return t(n,r,e+"[..]")}}return e.prototype.dehanceValue=function(e){return void 0!==this.dehancer?this.dehancer(e):e},e.prototype.dehanceValues=function(e){return void 0!==this.dehancer?e.map(this.dehancer):e},e.prototype.intercept=function(e){return o(this,e)},e.prototype.observe=function(e,t){return void 0===t&&(t=!1),t&&e({object:this.array,type:"splice",index:0,added:this.values.slice(),addedCount:this.values.length,removed:[],removedCount:0}),l(this,e)},e.prototype.getArrayLength=function(){return this.atom.reportObserved(),this.values.length},e.prototype.setArrayLength=function(e){if("number"!=typeof e||e<0)throw new Error("[mobx.array] Out of range: "+e);var t=this.values.length;if(e!==t)if(e>t){for(var n=new Array(e-t),r=0;r0&&e+t+1>tn&&x(e+t+1)},e.prototype.spliceWithArray=function(e,t,n){var r=this;ut(this.atom);var o=this.values.length;if(void 0===e?e=0:e>o?e=o:e<0&&(e=Math.max(0,o+e)),t=1===arguments.length?o-e:void 0===t||null===t?0:Math.max(0,Math.min(t,o-e)),void 0===n&&(n=[]),i(this)){var s=a(this,{object:this.array,type:"splice",index:e,removedCount:t,added:n});if(!s)return Rn;t=s.removedCount,n=s.added}n=n.map(function(e){return r.enhancer(e,void 0)});var l=n.length-t;this.updateArrayLength(o,l);var u=this.spliceItemsIntoValues(e,t,n);return 0===t&&0===n.length||this.notifyArraySplice(e,n,u),this.dehanceValues(u)},e.prototype.spliceItemsIntoValues=function(e,t,n){if(n.length<1e4)return(i=this.values).splice.apply(i,[e,t].concat(n));var r=this.values.slice(e,e+t);return this.values=this.values.slice(0,e).concat(n,this.values.slice(e+t)),r;var i},e.prototype.notifyArrayChildUpdate=function(e,t,n){var r=!this.owned&&c(),i=s(this),o=i||r?{object:this.array,type:"update",index:e,newValue:t,oldValue:n}:null;r&&h(o),this.atom.reportChanged(),i&&u(this,o),r&&f()},e.prototype.notifyArraySplice=function(e,t,n){var r=!this.owned&&c(),i=s(this),o=i||r?{object:this.array,type:"splice",index:e,removed:n,added:t,removedCount:n.length,addedCount:t.length}:null;r&&h(o),this.atom.reportChanged(),i&&u(this,o),r&&f()},e}(),on=function(e){function t(t,n,r,i){void 0===r&&(r="ObservableArray@"+xe()),void 0===i&&(i=!1);var o=e.call(this)||this,a=new rn(r,n,o,i);return Re(o,"$mobx",a),t&&t.length&&o.spliceWithArray(0,0,t),en&&Object.defineProperty(a.array,"0",an),o}return r(t,e),t.prototype.intercept=function(e){return this.$mobx.intercept(e)},t.prototype.observe=function(e,t){return void 0===t&&(t=!1),this.$mobx.observe(e,t)},t.prototype.clear=function(){return this.splice(0)},t.prototype.concat=function(){for(var e=[],t=0;t-1&&(this.splice(t,1),!0)},t.prototype.move=function(e,t){function n(e){if(e<0)throw new Error("[mobx.array] Index out of bounds: "+e+" is negative");var t=this.$mobx.values.length;if(e>=t)throw new Error("[mobx.array] Index out of bounds: "+e+" is not smaller than "+t)}if(n.call(this,e),n.call(this,t),e!==t){var r,i=this.$mobx.values;r=e";Ae(e,t,pn(o,n))},function(e){return this[e]},function(){we(!1,w("m001"))},!1,!0),fn=R(function(e,t,n){F(e,t,n)},function(e){return this[e]},function(){we(!1,w("m001"))},!1,!1),pn=function(e,t,n,r){return 1===arguments.length&&"function"==typeof e?M(e.name||"",e):2===arguments.length&&"function"==typeof t?M(e,t):1===arguments.length&&"string"==typeof e?z(e):z(t).apply(null,arguments)};pn.bound=function(e,t,n){if("function"==typeof e){var r=M("",e);return r.autoBind=!0,r}return fn.apply(null,arguments)};var mn={identity:U,structural:j,default:W},gn=function(){function e(e,t,n,r,i){this.derivation=e,this.scope=t,this.equals=n,this.dependenciesState=Vn.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=Vn.UP_TO_DATE,this.unboundDepsCount=0,this.__mapid="#"+xe(),this.value=new Hn(null),this.isComputing=!1,this.isRunningSetter=!1,this.name=r||"ComputedValue@"+xe(),i&&(this.setter=M(r+"-setter",i))}return e.prototype.onBecomeStale=function(){ot(this)},e.prototype.onBecomeUnobserved=function(){ht(this),this.value=void 0},e.prototype.get=function(){we(!this.isComputing,"Cycle detected in computation "+this.name,this.derivation),0===Bn.inBatch?(et(),st(this)&&(this.value=this.computeValue(!1)),tt()):(nt(this),st(this)&&this.trackAndCompute()&&it(this));var e=this.value;if(at(e))throw e.cause;return e},e.prototype.peek=function(){var e=this.computeValue(!1);if(at(e))throw e.cause;return e},e.prototype.set=function(e){if(this.setter){we(!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,e)}finally{this.isRunningSetter=!1}}else we(!1,"[ComputedValue '"+this.name+"'] It is not possible to assign a new value to a computed value.")},e.prototype.trackAndCompute=function(){c()&&d({object:this.scope,type:"compute",fn:this.derivation});var e=this.value,t=this.dependenciesState===Vn.NOT_TRACKING,n=this.value=this.computeValue(!0);return t||at(e)||at(n)||!this.equals(e,n)},e.prototype.computeValue=function(e){this.isComputing=!0,Bn.computationDepth++;var t;if(e)t=ct(this,this.derivation,this.scope);else try{t=this.derivation.call(this.scope)}catch(e){t=new Hn(e)}return Bn.computationDepth--,this.isComputing=!1,t},e.prototype.observe=function(e,t){var n=this,r=!0,i=void 0;return V(function(){var o=n.get();if(!r||t){var a=pt();e({type:"update",object:n,newValue:o,oldValue:i}),mt(a)}r=!1,i=o})},e.prototype.toJSON=function(){return this.get()},e.prototype.toString=function(){return this.name+"["+this.derivation.toString()+"]"},e.prototype.valueOf=function(){return He(this.get())},e.prototype.whyRun=function(){var e=Boolean(Bn.trackingDerivation),t=Ee(this.isComputing?this.newObserving:this.observing).map(function(e){return e.name}),n=Ee(Ke(this).map(function(e){return e.name}));return"\nWhyRun? computation '"+this.name+"':\n * Running because: "+(e?"[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===Vn.NOT_TRACKING?w("m032"):" * This computation will re-run if any of the following observables changes:\n "+Te(t)+"\n "+(this.isComputing&&e?" (... or any observable accessed during the remainder of the current run)":"")+"\n "+w("m038")+"\n\n * If the outcome of this computation changes, the following observers will be re-run:\n "+Te(n)+"\n")},e}();gn.prototype[Ve()]=gn.prototype.valueOf;var vn=Ne("ComputedValue",gn),yn=function(){function e(e,t){this.target=e,this.name=t,this.values={},this.changeListeners=null,this.interceptors=null}return e.prototype.observe=function(e,t){return we(!0!==t,"`observe` doesn't support the fire immediately property for observable objects."),l(this,e)},e.prototype.intercept=function(e){return o(this,e)},e}(),bn={},xn={},_n=Ne("ObservableObjectAdministration",yn),wn=ie(he),Mn=ie(fe),Sn=ie(pe),En=ie(me),Tn=ie(ge),kn={box:function(e,t){return arguments.length>2&&ue("box"),new un(e,he,t)},shallowBox:function(e,t){return arguments.length>2&&ue("shallowBox"),new un(e,pe,t)},array:function(e,t){return arguments.length>2&&ue("array"),new on(e,he,t)},shallowArray:function(e,t){return arguments.length>2&&ue("shallowArray"),new on(e,pe,t)},map:function(e,t){return arguments.length>2&&ue("map"),new Pn(e,he,t)},shallowMap:function(e,t){return arguments.length>2&&ue("shallowMap"),new Pn(e,pe,t)},object:function(e,t){arguments.length>2&&ue("object");var n={};return q(n,t),oe(n,e),n},shallowObject:function(e,t){arguments.length>2&&ue("shallowObject");var n={};return q(n,t),ae(n,e),n},ref:function(){return arguments.length<2?de(pe,arguments[0]):Sn.apply(null,arguments)},shallow:function(){return arguments.length<2?de(fe,arguments[0]):Mn.apply(null,arguments)},deep:function(){return arguments.length<2?de(he,arguments[0]):wn.apply(null,arguments)},struct:function(){return arguments.length<2?de(me,arguments[0]):En.apply(null,arguments)}},On=le;Object.keys(kn).forEach(function(e){return On[e]=kn[e]}),On.deep.struct=On.struct,On.ref.struct=function(){return arguments.length<2?de(ge,arguments[0]):Tn.apply(null,arguments)};var Cn={},Pn=function(){function e(e,t,n){void 0===t&&(t=he),void 0===n&&(n="ObservableMap@"+xe()),this.enhancer=t,this.name=n,this.$mobx=Cn,this._data=Object.create(null),this._hasMap=Object.create(null),this._keys=new on(void 0,pe,this.name+".keys()",!0),this.interceptors=null,this.changeListeners=null,this.dehancer=void 0,this.merge(e)}return e.prototype._has=function(e){return void 0!==this._data[e]},e.prototype.has=function(e){return!!this.isValidKey(e)&&(e=""+e,this._hasMap[e]?this._hasMap[e].get():this._updateHasMapEntry(e,!1).get())},e.prototype.set=function(e,t){this.assertValidKey(e),e=""+e;var n=this._has(e);if(i(this)){var r=a(this,{type:n?"update":"add",object:this,newValue:t,name:e});if(!r)return this;t=r.newValue}return n?this._updateValue(e,t):this._addValue(e,t),this},e.prototype.delete=function(e){var t=this;if(this.assertValidKey(e),e=""+e,i(this)){var n=a(this,{type:"delete",object:this,name:e});if(!n)return!1}if(this._has(e)){var r=c(),o=s(this),n=o||r?{type:"delete",object:this,oldValue:this._data[e].value,name:e}:null;return r&&h(n),ve(function(){t._keys.remove(e),t._updateHasMapEntry(e,!1),t._data[e].setNewValue(void 0),t._data[e]=void 0}),o&&u(this,n),r&&f(),!0}return!1},e.prototype._updateHasMapEntry=function(e,t){var n=this._hasMap[e];return n?n.setNewValue(t):n=this._hasMap[e]=new un(t,pe,this.name+"."+e+"?",!1),n},e.prototype._updateValue=function(e,t){var n=this._data[e];if((t=n.prepareNewValue(t))!==ln){var r=c(),i=s(this),o=i||r?{type:"update",object:this,oldValue:n.value,name:e,newValue:t}:null;r&&h(o),n.setNewValue(t),i&&u(this,o),r&&f()}},e.prototype._addValue=function(e,t){var n=this;ve(function(){var r=n._data[e]=new un(t,n.enhancer,n.name+"."+e,!1);t=r.value,n._updateHasMapEntry(e,!0),n._keys.push(e)});var r=c(),i=s(this),o=i||r?{type:"add",object:this,name:e,newValue:t}:null;r&&h(o),i&&u(this,o),r&&f()},e.prototype.get=function(e){return e=""+e,this.has(e)?this.dehanceValue(this._data[e].get()):this.dehanceValue(void 0)},e.prototype.dehanceValue=function(e){return void 0!==this.dehancer?this.dehancer(e):e},e.prototype.keys=function(){return g(this._keys.slice())},e.prototype.values=function(){return g(this._keys.map(this.get,this))},e.prototype.entries=function(){var e=this;return g(this._keys.map(function(t){return[t,e.get(t)]}))},e.prototype.forEach=function(e,t){var n=this;this.keys().forEach(function(r){return e.call(t,n.get(r),r,n)})},e.prototype.merge=function(e){var t=this;return An(e)&&(e=e.toJS()),ve(function(){Oe(e)?Object.keys(e).forEach(function(n){return t.set(n,e[n])}):Array.isArray(e)?e.forEach(function(e){var n=e[0],r=e[1];return t.set(n,r)}):je(e)?e.forEach(function(e,n){return t.set(n,e)}):null!==e&&void 0!==e&&_e("Cannot initialize map from "+e)}),this},e.prototype.clear=function(){var e=this;ve(function(){ft(function(){e.keys().forEach(e.delete,e)})})},e.prototype.replace=function(e){var t=this;return ve(function(){var n=We(e);t.keys().filter(function(e){return-1===n.indexOf(e)}).forEach(function(e){return t.delete(e)}),t.merge(e)}),this},Object.defineProperty(e.prototype,"size",{get:function(){return this._keys.length},enumerable:!0,configurable:!0}),e.prototype.toJS=function(){var e=this,t={};return this.keys().forEach(function(n){return t[n]=e.get(n)}),t},e.prototype.toJSON=function(){return this.toJS()},e.prototype.isValidKey=function(e){return null!==e&&void 0!==e&&("string"==typeof e||"number"==typeof e||"boolean"==typeof e)},e.prototype.assertValidKey=function(e){if(!this.isValidKey(e))throw new Error("[mobx.map] Invalid key: '"+e+"', only strings, numbers and booleans are accepted as key in observable maps.")},e.prototype.toString=function(){var e=this;return this.name+"[{ "+this.keys().map(function(t){return t+": "+e.get(t)}).join(", ")+" }]"},e.prototype.observe=function(e,t){return we(!0!==t,w("m033")),l(this,e)},e.prototype.intercept=function(e){return o(this,e)},e}();v(Pn.prototype,function(){return this.entries()});var An=Ne("ObservableMap",Pn),Rn=[];Object.freeze(Rn);var Ln=[],Dn=function(){},In=Object.prototype.hasOwnProperty,zn=["mobxGuid","resetId","spyListeners","strictMode","runId"],Nn=function(){function e(){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 e}(),Bn=new Nn,Fn=!1,Un=!1,jn=!1,Wn=be();Wn.__mobxInstanceCount?(Wn.__mobxInstanceCount++,setTimeout(function(){Fn||Un||jn||(jn=!0,console.warn("[mobx] Warning: there are multiple mobx instances active. This might lead to unexpected results. See https://github.com/mobxjs/mobx/issues/1082 for details."))})):Wn.__mobxInstanceCount=1;var Vn;!function(e){e[e.NOT_TRACKING=-1]="NOT_TRACKING",e[e.UP_TO_DATE=0]="UP_TO_DATE",e[e.POSSIBLY_STALE=1]="POSSIBLY_STALE",e[e.STALE=2]="STALE"}(Vn||(Vn={}));var Hn=function(){function e(e){this.cause=e}return e}(),Gn=function(){function e(e,t){void 0===e&&(e="Reaction@"+xe()),this.name=e,this.onInvalidate=t,this.observing=[],this.newObserving=[],this.dependenciesState=Vn.NOT_TRACKING,this.diffValue=0,this.runId=0,this.unboundDepsCount=0,this.__mapid="#"+xe(),this.isDisposed=!1,this._isScheduled=!1,this._isTrackPending=!1,this._isRunning=!1}return e.prototype.onBecomeStale=function(){this.schedule()},e.prototype.schedule=function(){this._isScheduled||(this._isScheduled=!0,Bn.pendingReactions.push(this),bt())},e.prototype.isScheduled=function(){return this._isScheduled},e.prototype.runReaction=function(){this.isDisposed||(et(),this._isScheduled=!1,st(this)&&(this._isTrackPending=!0,this.onInvalidate(),this._isTrackPending&&c()&&d({object:this,type:"scheduled-reaction"})),tt())},e.prototype.track=function(e){et();var t,n=c();n&&(t=Date.now(),h({object:this,type:"reaction",fn:e})),this._isRunning=!0;var r=ct(this,e,void 0);this._isRunning=!1,this._isTrackPending=!1,this.isDisposed&&ht(this),at(r)&&this.reportExceptionInDerivation(r.cause),n&&f({time:Date.now()-t}),tt()},e.prototype.reportExceptionInDerivation=function(e){var t=this;if(this.errorHandler)return void this.errorHandler(e,this);var n="[mobx] Encountered an uncaught exception that was thrown by a reaction or observer component, in: '"+this,r=w("m037");console.error(n||r,e),c()&&d({type:"error",message:n,error:e,object:this}),Bn.globalReactionErrorHandlers.forEach(function(n){return n(e,t)})},e.prototype.dispose=function(){this.isDisposed||(this.isDisposed=!0,this._isRunning||(et(),ht(this),tt()))},e.prototype.getDisposer=function(){var e=this.dispose.bind(this);return e.$mobx=this,e.onError=vt,e},e.prototype.toString=function(){return"Reaction["+this.name+"]"},e.prototype.whyRun=function(){var e=Ee(this._isRunning?this.newObserving:this.observing).map(function(e){return e.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 "+Te(e)+"\n "+(this._isRunning?" (... or any observable accessed during the remainder of the current run)":"")+"\n\t"+w("m038")+"\n"},e}(),Yn=100,qn=function(e){return e()},Xn=Ne("Reaction",Gn),Zn=Tt(mn.default),Kn=Tt(mn.structural),Jn=function(e,t,n){if("string"==typeof t)return Zn.apply(null,arguments);we("function"==typeof e,w("m011")),we(arguments.length<3,w("m012"));var r="object"==typeof t?t:{};r.setter="function"==typeof t?t:r.setter;var i=r.equals?r.equals:r.compareStructural||r.struct?mn.structural:mn.default;return new gn(e,r.context,i,r.name||e.name||"",r.setter)};Jn.struct=Kn,Jn.equals=Tt;var Qn={allowStateChanges:C,deepEqual:ze,getAtom:kt,getDebugName:Ct,getDependencyTree:Vt,getAdministration:Ot,getGlobalState:qe,getObserverTree:Gt,interceptReads:qt,isComputingDerivation:lt,isSpyEnabled:c,onReactionError:yt,reserveArrayBuffer:x,resetGlobalState:Xe,isolateGlobalState:Ge,shareGlobalState:Ye,spyReport:d,spyReportEnd:f,spyReportStart:h,setReactionScheduler:_t},$n={Reaction:Gn,untracked:ft,Atom:Kt,BaseAtom:Zt,useStrict:k,isStrictModeEnabled:O,spy:p,comparer:mn,asReference:wt,asFlat:St,asStructure:Mt,asMap:Et,isModifierDescriptor:ce,isObservableObject:ne,isBoxedObservable:cn,isObservableArray:_,ObservableMap:Pn,isObservableMap:An,map:ye,transaction:ve,observable:On,computed:Jn,isObservable:re,isComputed:Pt,extendObservable:oe,extendShallowObservable:ae,observe:At,intercept:Dt,autorun:V,autorunAsync:G,when:H,reaction:Y,action:pn,isAction:B,runInAction:N,expr:Nt,toJS:Bt,createTransformer:Ft,whyRun:Wt,isArrayLike:Fe,extras:Qn},er=!1;for(var tr in $n)!function(e){var t=$n[e];Object.defineProperty($n,e,{get:function(){return er||(er=!0,console.warn("Using default export (`import mobx from 'mobx'`) is deprecated and won’t work in mobx@4.0.0\nUse `import * as mobx from 'mobx'` instead")),t}})}(tr);"object"==typeof __MOBX_DEVTOOLS_GLOBAL_HOOK__&&__MOBX_DEVTOOLS_GLOBAL_HOOK__.injectMobx({spy:p,extras:Qn}),t.default=$n}.call(t,n(79))},function(e,t,n){e.exports={default:n(195),__esModule:!0}},function(e,t){e.exports=function(e){return"object"==typeof e?null!==e:"function"==typeof e}},function(e,t,n){"use strict";function r(e,t,n){return n?[e,t]:e}Object.defineProperty(t,"__esModule",{value:!0}),t.default=r,e.exports=t.default},function(e,t){e.exports={camera:{viewAngle:.5,Default:{fov:60,near:1,far:300},Near:{fov:60,near:1,far:200},Overhead:{fov:60,near:1,far:100},Map:{fov:70,near:1,far:4e3},laneWidth:4.5,laneWidthToViewDistanceRatio:5},ground:{mpp:400,xres:8192,yres:8192,xorigin:4096,yorigin:4096,xyoffset:0,type:"default",tileRange:4},planning:{minInterval:.1,defaults:{width:1.4}},options:{defaults:{showModuleController:!1,showMenu:!1,showPOI:!1,showPNCMonitor:!1,showRouteEditingBar:!1,showTasks:!0,showVideo:!1,showPlanningReference:!1,showPlaningDpOptimizer:!1,showPlanningQpOptimizer:!1,showPlanning:!0,showDecisionMain:!0,showDecisionObstacle:!0,showRouting:!0,showPredictionMajor:!0,showPredictionMinor:!0,showObstaclesVehicle:!0,showObstaclesPedestrian:!0,showObstaclesBicycle:!0,showObstaclesUnknownMovable:!0,showObstaclesUnknownUnmovable:!0,showObstaclesUnknown:!0,showObstaclesVirtual:!1,showObstaclesVelocity:!0,showObstaclesHeading:!0,showObstaclesId:!0,cameraAngle:"Default"}},debug:{autoMonitorMessage:!1,performanceMonitor:!1}}},function(e,t,n){var r=n(23);e.exports=function(e){if(!r(e))throw TypeError(e+" is not an object!");return e}},function(e,t,n){var r=n(15),i=n(42);e.exports=n(19)?function(e,t,n){return r.f(e,t,i(1,n))}:function(e,t,n){return e[t]=n,e}},function(e,t,n){"use strict";e.exports={},e.exports.Arc=n(268),e.exports.Line=n(269),e.exports.Point=n(270),e.exports.Rectangle=n(271)},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function i(e,t){if(t){var n=t*w;e.position.z+=n}}function o(e,t,n){var r=arguments.length>3&&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 g.MeshBasicMaterial({map:E.load(e),transparent:!0,depthWrite:!1}),s=new g.Mesh(new g.PlaneGeometry(t,n),a);return s.material.side=g.DoubleSide,s.position.set(r,i,o),s.overdraw=!0,s}function a(e){var t=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],l=new g.Path,u=l.createGeometry(e);u.computeLineDistances();var c=new g.LineDashedMaterial({color:t,dashSize:r,linewidth:n,gapSize:o}),d=new g.Line(u,c);return i(d,a),d.matrixAutoUpdate=s,s||d.updateMatrix(),d}function s(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:32,r=new g.CircleGeometry(e,n);return new g.Mesh(r,t)}function l(e){var t=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=M(e.map(function(e){return[e.x,e.y]})),s=new g.ShaderMaterial(S({side:g.DoubleSide,diffuse:n,thickness:t,opacity:r,transparent:!0})),l=new g.Mesh(a,s);return i(l,o),l}function u(e){var t=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,l=new g.Path,u=l.createGeometry(e),c=new g.LineBasicMaterial({color:t,linewidth:n,transparent:a,opacity:s}),d=new g.Line(u,c);return i(d,r),d.matrixAutoUpdate=o,!1===o&&d.updateMatrix(),d}function c(e,t,n){var r=new g.CubeGeometry(e.x,e.y,e.z),i=new g.MeshBasicMaterial({color:t}),o=new g.Mesh(r,i),a=new g.BoxHelper(o);return a.material.linewidth=n,a}function d(e,t,n){var r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:.01,i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:.02,o=new g.CubeGeometry(e.x,e.y,e.z);o=new g.EdgesGeometry(o),o=(new g.Geometry).fromBufferGeometry(o),o.computeLineDistances();var a=new g.LineDashedMaterial({color:t,linewidth:n,dashSize:r,gapSize:i});return new g.LineSegments(o,a)}function h(e,t,n,r,i){var o=new g.Vector3(0,e,0);return u([new g.Vector3(0,0,0),o,new g.Vector3(r/2,e-n,0),o,new g.Vector3(-r/2,e-n,0)],i,t,1)}function f(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n=new g.Shape;if(t){n.moveTo(e[0].x,e[0].y);for(var r=1;r1&&void 0!==arguments[1]?arguments[1]:new g.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=f(e,n),s=new g.Mesh(a,t);return i(s,r),s.matrixAutoUpdate=o,!1===o&&s.updateMatrix(),s}Object.defineProperty(t,"__esModule",{value:!0}),t.addOffsetZ=i,t.drawImage=o,t.drawDashedLineFromPoints=a,t.drawCircle=s,t.drawThickBandFromPoints=l,t.drawSegmentsFromPoints=u,t.drawBox=c,t.drawDashedBox=d,t.drawArrow=h,t.getShapeGeometryFromPoints=f,t.drawShapeFromPoints=p;var m=n(9),g=function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t.default=e,t}(m),v=n(354),y=r(v),b=n(355),x=r(b),_=n(34),w=.04,M=(0,y.default)(g),S=(0,x.default)(g),E=new g.TextureLoader},function(e,t,n){var r=n(87);e.exports=function(e,t,n){if(r(e),void 0===t)return e;switch(n){case 1:return function(n){return e.call(t,n)};case 2:return function(n,r){return e.call(t,n,r)};case 3:return function(n,r,i){return e.call(t,n,r,i)}}return function(){return e.apply(t,arguments)}}},function(e,t){e.exports=function(e){try{return!!e()}catch(e){return!0}}},function(e,t){var n={}.hasOwnProperty;e.exports=function(e,t){return n.call(e,t)}},function(e,t,n){var r=n(60),i=n(58);e.exports=function(e){return r(i(e))}},function(e,t,n){(function(e,r){var i;(function(){function o(e,t){return e.set(t[0],t[1]),e}function a(e,t){return e.add(t),e}function s(e,t,n){switch(n.length){case 0:return e.call(t);case 1:return e.call(t,n[0]);case 2:return e.call(t,n[0],n[1]);case 3:return e.call(t,n[0],n[1],n[2])}return e.apply(t,n)}function l(e,t,n,r){for(var i=-1,o=null==e?0:e.length;++i-1}function p(e,t,n){for(var r=-1,i=null==e?0:e.length;++r-1;);return n}function F(e,t){for(var n=e.length;n--&&S(t,e[n],0)>-1;);return n}function U(e,t){for(var n=e.length,r=0;n--;)e[n]===t&&++r;return r}function j(e){return"\\"+On[e]}function W(e,t){return null==e?ie:e[t]}function V(e){return bn.test(e)}function H(e){return xn.test(e)}function G(e){for(var t,n=[];!(t=e.next()).done;)n.push(t.value);return n}function Y(e){var t=-1,n=Array(e.size);return e.forEach(function(e,r){n[++t]=[r,e]}),n}function q(e,t){return function(n){return e(t(n))}}function X(e,t){for(var n=-1,r=e.length,i=0,o=[];++n>>1,Fe=[["ary",Me],["bind",ge],["bindKey",ve],["curry",be],["curryRight",xe],["flip",Ee],["partial",_e],["partialRight",we],["rearg",Se]],Ue="[object Arguments]",je="[object Array]",We="[object AsyncFunction]",Ve="[object Boolean]",He="[object Date]",Ge="[object DOMException]",Ye="[object Error]",qe="[object Function]",Xe="[object GeneratorFunction]",Ze="[object Map]",Ke="[object Number]",Je="[object Null]",Qe="[object Object]",$e="[object Proxy]",et="[object RegExp]",tt="[object Set]",nt="[object String]",rt="[object Symbol]",it="[object Undefined]",ot="[object WeakMap]",at="[object WeakSet]",st="[object ArrayBuffer]",lt="[object DataView]",ut="[object Float32Array]",ct="[object Float64Array]",dt="[object Int8Array]",ht="[object Int16Array]",ft="[object Int32Array]",pt="[object Uint8Array]",mt="[object Uint8ClampedArray]",gt="[object Uint16Array]",vt="[object Uint32Array]",yt=/\b__p \+= '';/g,bt=/\b(__p \+=) '' \+/g,xt=/(__e\(.*?\)|\b__t\)) \+\n'';/g,_t=/&(?:amp|lt|gt|quot|#39);/g,wt=/[&<>"']/g,Mt=RegExp(_t.source),St=RegExp(wt.source),Et=/<%-([\s\S]+?)%>/g,Tt=/<%([\s\S]+?)%>/g,kt=/<%=([\s\S]+?)%>/g,Ot=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,Ct=/^\w*$/,Pt=/^\./,At=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,Rt=/[\\^$.*+?()[\]{}|]/g,Lt=RegExp(Rt.source),Dt=/^\s+|\s+$/g,It=/^\s+/,zt=/\s+$/,Nt=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,Bt=/\{\n\/\* \[wrapped with (.+)\] \*/,Ft=/,? & /,Ut=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g,jt=/\\(\\)?/g,Wt=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,Vt=/\w*$/,Ht=/^[-+]0x[0-9a-f]+$/i,Gt=/^0b[01]+$/i,Yt=/^\[object .+?Constructor\]$/,qt=/^0o[0-7]+$/i,Xt=/^(?:0|[1-9]\d*)$/,Zt=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,Kt=/($^)/,Jt=/['\n\r\u2028\u2029\\]/g,Qt="\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff",$t="\\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",en="["+$t+"]",tn="["+Qt+"]",nn="[a-z\\xdf-\\xf6\\xf8-\\xff]",rn="[^\\ud800-\\udfff"+$t+"\\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]",ln="[A-Z\\xc0-\\xd6\\xd8-\\xde]",un="(?:"+nn+"|"+rn+")",cn="(?:[\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff]|\\ud83c[\\udffb-\\udfff])?",dn="(?:\\u200d(?:"+["[^\\ud800-\\udfff]",an,sn].join("|")+")[\\ufe0e\\ufe0f]?"+cn+")*",hn="[\\ufe0e\\ufe0f]?"+cn+dn,fn="(?:"+["[\\u2700-\\u27bf]",an,sn].join("|")+")"+hn,pn="(?:"+["[^\\ud800-\\udfff]"+tn+"?",tn,an,sn,"[\\ud800-\\udfff]"].join("|")+")",mn=RegExp("['’]","g"),gn=RegExp(tn,"g"),vn=RegExp(on+"(?="+on+")|"+pn+hn,"g"),yn=RegExp([ln+"?"+nn+"+(?:['’](?:d|ll|m|re|s|t|ve))?(?="+[en,ln,"$"].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))?(?="+[en,ln+un,"$"].join("|")+")",ln+"?"+un+"+(?:['’](?:d|ll|m|re|s|t|ve))?",ln+"+(?:['’](?: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"+Qt+"\\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,Mn={};Mn[ut]=Mn[ct]=Mn[dt]=Mn[ht]=Mn[ft]=Mn[pt]=Mn[mt]=Mn[gt]=Mn[vt]=!0,Mn[Ue]=Mn[je]=Mn[st]=Mn[Ve]=Mn[lt]=Mn[He]=Mn[Ye]=Mn[qe]=Mn[Ze]=Mn[Ke]=Mn[Qe]=Mn[et]=Mn[tt]=Mn[nt]=Mn[ot]=!1;var Sn={};Sn[Ue]=Sn[je]=Sn[st]=Sn[lt]=Sn[Ve]=Sn[He]=Sn[ut]=Sn[ct]=Sn[dt]=Sn[ht]=Sn[ft]=Sn[Ze]=Sn[Ke]=Sn[Qe]=Sn[et]=Sn[tt]=Sn[nt]=Sn[rt]=Sn[pt]=Sn[mt]=Sn[gt]=Sn[vt]=!0,Sn[Ye]=Sn[qe]=Sn[ot]=!1;var En={"À":"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"},Tn={"&":"&","<":"<",">":">",'"':""","'":"'"},kn={"&":"&","<":"<",">":">",""":'"',"'":"'"},On={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"},Cn=parseFloat,Pn=parseInt,An="object"==typeof e&&e&&e.Object===Object&&e,Rn="object"==typeof self&&self&&self.Object===Object&&self,Ln=An||Rn||Function("return this")(),Dn="object"==typeof t&&t&&!t.nodeType&&t,In=Dn&&"object"==typeof r&&r&&!r.nodeType&&r,zn=In&&In.exports===Dn,Nn=zn&&An.process,Bn=function(){try{return Nn&&Nn.binding&&Nn.binding("util")}catch(e){}}(),Fn=Bn&&Bn.isArrayBuffer,Un=Bn&&Bn.isDate,jn=Bn&&Bn.isMap,Wn=Bn&&Bn.isRegExp,Vn=Bn&&Bn.isSet,Hn=Bn&&Bn.isTypedArray,Gn=O("length"),Yn=C(En),qn=C(Tn),Xn=C(kn),Zn=function e(t){function n(e){if(ol(e)&&!gh(e)&&!(e instanceof x)){if(e instanceof i)return e;if(gc.call(e,"__wrapped__"))return na(e)}return new i(e)}function r(){}function i(e,t){this.__wrapped__=e,this.__actions__=[],this.__chain__=!!t,this.__index__=0,this.__values__=ie}function x(e){this.__wrapped__=e,this.__actions__=[],this.__dir__=1,this.__filtered__=!1,this.__iteratees__=[],this.__takeCount__=ze,this.__views__=[]}function C(){var e=new x(this.__wrapped__);return e.__actions__=Ni(this.__actions__),e.__dir__=this.__dir__,e.__filtered__=this.__filtered__,e.__iteratees__=Ni(this.__iteratees__),e.__takeCount__=this.__takeCount__,e.__views__=Ni(this.__views__),e}function J(){if(this.__filtered__){var e=new x(this);e.__dir__=-1,e.__filtered__=!0}else e=this.clone(),e.__dir__*=-1;return e}function te(){var e=this.__wrapped__.value(),t=this.__dir__,n=gh(e),r=t<0,i=n?e.length:0,o=ko(0,i,this.__views__),a=o.start,s=o.end,l=s-a,u=r?s:a-1,c=this.__iteratees__,d=c.length,h=0,f=Yc(l,this.__takeCount__);if(!n||!r&&i==l&&f==l)return yi(e,this.__actions__);var p=[];e:for(;l--&&h-1}function ln(e,t){var n=this.__data__,r=Kn(n,e);return r<0?(++this.size,n.push([e,t])):n[r][1]=t,this}function un(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t=t?e:t)),e}function rr(e,t,n,r,i,o){var a,s=t&de,l=t&he,c=t&fe;if(n&&(a=i?n(e,r,i,o):n(e)),a!==ie)return a;if(!il(e))return e;var d=gh(e);if(d){if(a=Po(e),!s)return Ni(e,a)}else{var h=Td(e),f=h==qe||h==Xe;if(yh(e))return Ei(e,s);if(h==Qe||h==Ue||f&&!i){if(a=l||f?{}:Ao(e),!s)return l?Ui(e,$n(a,e)):Fi(e,Qn(a,e))}else{if(!Sn[h])return i?e:{};a=Ro(e,h,rr,s)}}o||(o=new xn);var p=o.get(e);if(p)return p;o.set(e,a);var m=c?l?bo:yo:l?jl:Ul,g=d?ie:m(e);return u(g||e,function(r,i){g&&(i=r,r=e[i]),Gn(a,i,rr(r,t,n,i,e,o))}),a}function ir(e){var t=Ul(e);return function(n){return or(n,e,t)}}function or(e,t,n){var r=n.length;if(null==e)return!r;for(e=sc(e);r--;){var i=n[r],o=t[i],a=e[i];if(a===ie&&!(i in e)||!o(a))return!1}return!0}function ar(e,t,n){if("function"!=typeof e)throw new cc(se);return Cd(function(){e.apply(ie,n)},t)}function sr(e,t,n,r){var i=-1,o=f,a=!0,s=e.length,l=[],u=t.length;if(!s)return l;n&&(t=m(t,I(n))),r?(o=p,a=!1):t.length>=oe&&(o=N,a=!1,t=new vn(t));e:for(;++ii?0:i+n),r=r===ie||r>i?i:wl(r),r<0&&(r+=i),r=n>r?0:Ml(r);n0&&n(s)?t>1?hr(s,t-1,n,r,i):g(i,s):r||(i[i.length]=s)}return i}function fr(e,t){return e&&gd(e,t,Ul)}function pr(e,t){return e&&vd(e,t,Ul)}function mr(e,t){return h(t,function(t){return tl(e[t])})}function gr(e,t){t=Mi(t,e);for(var n=0,r=t.length;null!=e&&nt}function xr(e,t){return null!=e&&gc.call(e,t)}function _r(e,t){return null!=e&&t in sc(e)}function wr(e,t,n){return e>=Yc(t,n)&&e=120&&c.length>=120)?new vn(a&&c):ie}c=e[0];var d=-1,h=s[0];e:for(;++d-1;)s!==e&&Pc.call(s,l,1),Pc.call(e,l,1);return e}function Qr(e,t){for(var n=e?t.length:0,r=n-1;n--;){var i=t[n];if(n==r||i!==o){var o=i;Io(i)?Pc.call(e,i,1):mi(e,i)}}return e}function $r(e,t){return e+Fc(Zc()*(t-e+1))}function ei(e,t,n,r){for(var i=-1,o=Gc(Bc((t-e)/(n||1)),0),a=nc(o);o--;)a[r?o:++i]=e,e+=n;return a}function ti(e,t){var n="";if(!e||t<1||t>Le)return n;do{t%2&&(n+=e),(t=Fc(t/2))&&(e+=e)}while(t);return n}function ni(e,t){return Pd(qo(e,t,Pu),e+"")}function ri(e){return Dn($l(e))}function ii(e,t){var n=$l(e);return Qo(n,nr(t,0,n.length))}function oi(e,t,n,r){if(!il(e))return e;t=Mi(t,e);for(var i=-1,o=t.length,a=o-1,s=e;null!=s&&++ii?0:i+t),n=n>i?i:n,n<0&&(n+=i),i=t>n?0:n-t>>>0,t>>>=0;for(var o=nc(i);++r>>1,a=e[o];null!==a&&!gl(a)&&(n?a<=t:a=oe){var u=t?null:wd(e);if(u)return Z(u);a=!1,i=N,l=new vn}else l=t?[]:s;e:for(;++r=r?e:si(e,t,n)}function Ei(e,t){if(t)return e.slice();var n=e.length,r=Tc?Tc(n):new e.constructor(n);return e.copy(r),r}function Ti(e){var t=new e.constructor(e.byteLength);return new Ec(t).set(new Ec(e)),t}function ki(e,t){var n=t?Ti(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.byteLength)}function Oi(e,t,n){return v(t?n(Y(e),de):Y(e),o,new e.constructor)}function Ci(e){var t=new e.constructor(e.source,Vt.exec(e));return t.lastIndex=e.lastIndex,t}function Pi(e,t,n){return v(t?n(Z(e),de):Z(e),a,new e.constructor)}function Ai(e){return dd?sc(dd.call(e)):{}}function Ri(e,t){var n=t?Ti(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.length)}function Li(e,t){if(e!==t){var n=e!==ie,r=null===e,i=e===e,o=gl(e),a=t!==ie,s=null===t,l=t===t,u=gl(t);if(!s&&!u&&!o&&e>t||o&&a&&l&&!s&&!u||r&&a&&l||!n&&l||!i)return 1;if(!r&&!o&&!u&&e=s)return l;return l*("desc"==n[r]?-1:1)}}return e.index-t.index}function Ii(e,t,n,r){for(var i=-1,o=e.length,a=n.length,s=-1,l=t.length,u=Gc(o-a,0),c=nc(l+u),d=!r;++s1?n[i-1]:ie,a=i>2?n[2]:ie;for(o=e.length>3&&"function"==typeof o?(i--,o):ie,a&&zo(n[0],n[1],a)&&(o=i<3?ie:o,i=1),t=sc(t);++r-1?i[o?t[a]:a]:ie}}function Ji(e){return vo(function(t){var n=t.length,r=n,o=i.prototype.thru;for(e&&t.reverse();r--;){var a=t[r];if("function"!=typeof a)throw new cc(se);if(o&&!s&&"wrapper"==xo(a))var s=new i([],!0)}for(r=s?r:n;++r1&&y.reverse(),d&&ls))return!1;var u=o.get(e);if(u&&o.get(t))return u==t;var c=-1,d=!0,h=n&me?new vn:ie;for(o.set(e,t),o.set(t,e);++c1?"& ":"")+t[r],t=t.join(n>2?", ":" "),e.replace(Nt,"{\n/* [wrapped with "+t+"] */\n")}function Do(e){return gh(e)||mh(e)||!!(Ac&&e&&e[Ac])}function Io(e,t){return!!(t=null==t?Le:t)&&("number"==typeof e||Xt.test(e))&&e>-1&&e%1==0&&e0){if(++t>=Oe)return arguments[0]}else t=0;return e.apply(ie,arguments)}}function Qo(e,t){var n=-1,r=e.length,i=r-1;for(t=t===ie?r:t;++n=this.__values__.length;return{done:e,value:e?ie:this.__values__[this.__index__++]}}function ns(){return this}function rs(e){for(var t,n=this;n instanceof r;){var i=na(n);i.__index__=0,i.__values__=ie,t?o.__wrapped__=i:t=i;var o=i;n=n.__wrapped__}return o.__wrapped__=e,t}function is(){var e=this.__wrapped__;if(e instanceof x){var t=e;return this.__actions__.length&&(t=new x(this)),t=t.reverse(),t.__actions__.push({func:Qa,args:[Oa],thisArg:ie}),new i(t,this.__chain__)}return this.thru(Oa)}function os(){return yi(this.__wrapped__,this.__actions__)}function as(e,t,n){var r=gh(e)?d:lr;return n&&zo(e,t,n)&&(t=ie),r(e,wo(t,3))}function ss(e,t){return(gh(e)?h:dr)(e,wo(t,3))}function ls(e,t){return hr(ps(e,t),1)}function us(e,t){return hr(ps(e,t),Re)}function cs(e,t,n){return n=n===ie?1:wl(n),hr(ps(e,t),n)}function ds(e,t){return(gh(e)?u:pd)(e,wo(t,3))}function hs(e,t){return(gh(e)?c:md)(e,wo(t,3))}function fs(e,t,n,r){e=Ys(e)?e:$l(e),n=n&&!r?wl(n):0;var i=e.length;return n<0&&(n=Gc(i+n,0)),ml(e)?n<=i&&e.indexOf(t,n)>-1:!!i&&S(e,t,n)>-1}function ps(e,t){return(gh(e)?m:jr)(e,wo(t,3))}function ms(e,t,n,r){return null==e?[]:(gh(t)||(t=null==t?[]:[t]),n=r?ie:n,gh(n)||(n=null==n?[]:[n]),qr(e,t,n))}function gs(e,t,n){var r=gh(e)?v:P,i=arguments.length<3;return r(e,wo(t,4),n,i,pd)}function vs(e,t,n){var r=gh(e)?y:P,i=arguments.length<3;return r(e,wo(t,4),n,i,md)}function ys(e,t){return(gh(e)?h:dr)(e,Rs(wo(t,3)))}function bs(e){return(gh(e)?Dn:ri)(e)}function xs(e,t,n){return t=(n?zo(e,t,n):t===ie)?1:wl(t),(gh(e)?In:ii)(e,t)}function _s(e){return(gh(e)?Nn:ai)(e)}function ws(e){if(null==e)return 0;if(Ys(e))return ml(e)?$(e):e.length;var t=Td(e);return t==Ze||t==tt?e.size:Br(e).length}function Ms(e,t,n){var r=gh(e)?b:li;return n&&zo(e,t,n)&&(t=ie),r(e,wo(t,3))}function Ss(e,t){if("function"!=typeof t)throw new cc(se);return e=wl(e),function(){if(--e<1)return t.apply(this,arguments)}}function Es(e,t,n){return t=n?ie:t,t=e&&null==t?e.length:t,uo(e,Me,ie,ie,ie,ie,t)}function Ts(e,t){var n;if("function"!=typeof t)throw new cc(se);return e=wl(e),function(){return--e>0&&(n=t.apply(this,arguments)),e<=1&&(t=ie),n}}function ks(e,t,n){t=n?ie:t;var r=uo(e,be,ie,ie,ie,ie,ie,t);return r.placeholder=ks.placeholder,r}function Os(e,t,n){t=n?ie:t;var r=uo(e,xe,ie,ie,ie,ie,ie,t);return r.placeholder=Os.placeholder,r}function Cs(e,t,n){function r(t){var n=h,r=f;return h=f=ie,y=t,m=e.apply(r,n)}function i(e){return y=e,g=Cd(s,t),b?r(e):m}function o(e){var n=e-v,r=e-y,i=t-n;return x?Yc(i,p-r):i}function a(e){var n=e-v,r=e-y;return v===ie||n>=t||n<0||x&&r>=p}function s(){var e=ih();if(a(e))return l(e);g=Cd(s,o(e))}function l(e){return g=ie,_&&h?r(e):(h=f=ie,m)}function u(){g!==ie&&_d(g),y=0,h=v=f=g=ie}function c(){return g===ie?m:l(ih())}function d(){var e=ih(),n=a(e);if(h=arguments,f=this,v=e,n){if(g===ie)return i(v);if(x)return g=Cd(s,t),r(v)}return g===ie&&(g=Cd(s,t)),m}var h,f,p,m,g,v,y=0,b=!1,x=!1,_=!0;if("function"!=typeof e)throw new cc(se);return t=Sl(t)||0,il(n)&&(b=!!n.leading,x="maxWait"in n,p=x?Gc(Sl(n.maxWait)||0,t):p,_="trailing"in n?!!n.trailing:_),d.cancel=u,d.flush=c,d}function Ps(e){return uo(e,Ee)}function As(e,t){if("function"!=typeof e||null!=t&&"function"!=typeof t)throw new cc(se);var n=function(){var r=arguments,i=t?t.apply(this,r):r[0],o=n.cache;if(o.has(i))return o.get(i);var a=e.apply(this,r);return n.cache=o.set(i,a)||o,a};return n.cache=new(As.Cache||un),n}function Rs(e){if("function"!=typeof e)throw new cc(se);return function(){var t=arguments;switch(t.length){case 0:return!e.call(this);case 1:return!e.call(this,t[0]);case 2:return!e.call(this,t[0],t[1]);case 3:return!e.call(this,t[0],t[1],t[2])}return!e.apply(this,t)}}function Ls(e){return Ts(2,e)}function Ds(e,t){if("function"!=typeof e)throw new cc(se);return t=t===ie?t:wl(t),ni(e,t)}function Is(e,t){if("function"!=typeof e)throw new cc(se);return t=null==t?0:Gc(wl(t),0),ni(function(n){var r=n[t],i=Si(n,0,t);return r&&g(i,r),s(e,this,i)})}function zs(e,t,n){var r=!0,i=!0;if("function"!=typeof e)throw new cc(se);return il(n)&&(r="leading"in n?!!n.leading:r,i="trailing"in n?!!n.trailing:i),Cs(e,t,{leading:r,maxWait:t,trailing:i})}function Ns(e){return Es(e,1)}function Bs(e,t){return ch(wi(t),e)}function Fs(){if(!arguments.length)return[];var e=arguments[0];return gh(e)?e:[e]}function Us(e){return rr(e,fe)}function js(e,t){return t="function"==typeof t?t:ie,rr(e,fe,t)}function Ws(e){return rr(e,de|fe)}function Vs(e,t){return t="function"==typeof t?t:ie,rr(e,de|fe,t)}function Hs(e,t){return null==t||or(e,t,Ul(t))}function Gs(e,t){return e===t||e!==e&&t!==t}function Ys(e){return null!=e&&rl(e.length)&&!tl(e)}function qs(e){return ol(e)&&Ys(e)}function Xs(e){return!0===e||!1===e||ol(e)&&yr(e)==Ve}function Zs(e){return ol(e)&&1===e.nodeType&&!fl(e)}function Ks(e){if(null==e)return!0;if(Ys(e)&&(gh(e)||"string"==typeof e||"function"==typeof e.splice||yh(e)||Mh(e)||mh(e)))return!e.length;var t=Td(e);if(t==Ze||t==tt)return!e.size;if(jo(e))return!Br(e).length;for(var n in e)if(gc.call(e,n))return!1;return!0}function Js(e,t){return Cr(e,t)}function Qs(e,t,n){n="function"==typeof n?n:ie;var r=n?n(e,t):ie;return r===ie?Cr(e,t,ie,n):!!r}function $s(e){if(!ol(e))return!1;var t=yr(e);return t==Ye||t==Ge||"string"==typeof e.message&&"string"==typeof e.name&&!fl(e)}function el(e){return"number"==typeof e&&Wc(e)}function tl(e){if(!il(e))return!1;var t=yr(e);return t==qe||t==Xe||t==We||t==$e}function nl(e){return"number"==typeof e&&e==wl(e)}function rl(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=Le}function il(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)}function ol(e){return null!=e&&"object"==typeof e}function al(e,t){return e===t||Rr(e,t,So(t))}function sl(e,t,n){return n="function"==typeof n?n:ie,Rr(e,t,So(t),n)}function ll(e){return hl(e)&&e!=+e}function ul(e){if(kd(e))throw new ic(ae);return Lr(e)}function cl(e){return null===e}function dl(e){return null==e}function hl(e){return"number"==typeof e||ol(e)&&yr(e)==Ke}function fl(e){if(!ol(e)||yr(e)!=Qe)return!1;var t=kc(e);if(null===t)return!0;var n=gc.call(t,"constructor")&&t.constructor;return"function"==typeof n&&n instanceof n&&mc.call(n)==xc}function pl(e){return nl(e)&&e>=-Le&&e<=Le}function ml(e){return"string"==typeof e||!gh(e)&&ol(e)&&yr(e)==nt}function gl(e){return"symbol"==typeof e||ol(e)&&yr(e)==rt}function vl(e){return e===ie}function yl(e){return ol(e)&&Td(e)==ot}function bl(e){return ol(e)&&yr(e)==at}function xl(e){if(!e)return[];if(Ys(e))return ml(e)?ee(e):Ni(e);if(Rc&&e[Rc])return G(e[Rc]());var t=Td(e);return(t==Ze?Y:t==tt?Z:$l)(e)}function _l(e){if(!e)return 0===e?e:0;if((e=Sl(e))===Re||e===-Re){return(e<0?-1:1)*De}return e===e?e:0}function wl(e){var t=_l(e),n=t%1;return t===t?n?t-n:t:0}function Ml(e){return e?nr(wl(e),0,ze):0}function Sl(e){if("number"==typeof e)return e;if(gl(e))return Ie;if(il(e)){var t="function"==typeof e.valueOf?e.valueOf():e;e=il(t)?t+"":t}if("string"!=typeof e)return 0===e?e:+e;e=e.replace(Dt,"");var n=Gt.test(e);return n||qt.test(e)?Pn(e.slice(2),n?2:8):Ht.test(e)?Ie:+e}function El(e){return Bi(e,jl(e))}function Tl(e){return e?nr(wl(e),-Le,Le):0===e?e:0}function kl(e){return null==e?"":fi(e)}function Ol(e,t){var n=fd(e);return null==t?n:Qn(n,t)}function Cl(e,t){return w(e,wo(t,3),fr)}function Pl(e,t){return w(e,wo(t,3),pr)}function Al(e,t){return null==e?e:gd(e,wo(t,3),jl)}function Rl(e,t){return null==e?e:vd(e,wo(t,3),jl)}function Ll(e,t){return e&&fr(e,wo(t,3))}function Dl(e,t){return e&&pr(e,wo(t,3))}function Il(e){return null==e?[]:mr(e,Ul(e))}function zl(e){return null==e?[]:mr(e,jl(e))}function Nl(e,t,n){var r=null==e?ie:gr(e,t);return r===ie?n:r}function Bl(e,t){return null!=e&&Co(e,t,xr)}function Fl(e,t){return null!=e&&Co(e,t,_r)}function Ul(e){return Ys(e)?Rn(e):Br(e)}function jl(e){return Ys(e)?Rn(e,!0):Fr(e)}function Wl(e,t){var n={};return t=wo(t,3),fr(e,function(e,r,i){er(n,t(e,r,i),e)}),n}function Vl(e,t){var n={};return t=wo(t,3),fr(e,function(e,r,i){er(n,r,t(e,r,i))}),n}function Hl(e,t){return Gl(e,Rs(wo(t)))}function Gl(e,t){if(null==e)return{};var n=m(bo(e),function(e){return[e]});return t=wo(t),Zr(e,n,function(e,n){return t(e,n[0])})}function Yl(e,t,n){t=Mi(t,e);var r=-1,i=t.length;for(i||(i=1,e=ie);++rt){var r=e;e=t,t=r}if(n||e%1||t%1){var i=Zc();return Yc(e+i*(t-e+Cn("1e-"+((i+"").length-1))),t)}return $r(e,t)}function iu(e){return Zh(kl(e).toLowerCase())}function ou(e){return(e=kl(e))&&e.replace(Zt,Yn).replace(gn,"")}function au(e,t,n){e=kl(e),t=fi(t);var r=e.length;n=n===ie?r:nr(wl(n),0,r);var i=n;return(n-=t.length)>=0&&e.slice(n,i)==t}function su(e){return e=kl(e),e&&St.test(e)?e.replace(wt,qn):e}function lu(e){return e=kl(e),e&&Lt.test(e)?e.replace(Rt,"\\$&"):e}function uu(e,t,n){e=kl(e),t=wl(t);var r=t?$(e):0;if(!t||r>=t)return e;var i=(t-r)/2;return no(Fc(i),n)+e+no(Bc(i),n)}function cu(e,t,n){e=kl(e),t=wl(t);var r=t?$(e):0;return t&&r>>0)?(e=kl(e),e&&("string"==typeof t||null!=t&&!_h(t))&&!(t=fi(t))&&V(e)?Si(ee(e),0,n):e.split(t,n)):[]}function gu(e,t,n){return e=kl(e),n=null==n?0:nr(wl(n),0,e.length),t=fi(t),e.slice(n,n+t.length)==t}function vu(e,t,r){var i=n.templateSettings;r&&zo(e,t,r)&&(t=ie),e=kl(e),t=Oh({},t,i,co);var o,a,s=Oh({},t.imports,i.imports,co),l=Ul(s),u=z(s,l),c=0,d=t.interpolate||Kt,h="__p += '",f=lc((t.escape||Kt).source+"|"+d.source+"|"+(d===kt?Wt:Kt).source+"|"+(t.evaluate||Kt).source+"|$","g"),p="//# sourceURL="+("sourceURL"in t?t.sourceURL:"lodash.templateSources["+ ++wn+"]")+"\n";e.replace(f,function(t,n,r,i,s,l){return r||(r=i),h+=e.slice(c,l).replace(Jt,j),n&&(o=!0,h+="' +\n__e("+n+") +\n'"),s&&(a=!0,h+="';\n"+s+";\n__p += '"),r&&(h+="' +\n((__t = ("+r+")) == null ? '' : __t) +\n'"),c=l+t.length,t}),h+="';\n";var m=t.variable;m||(h="with (obj) {\n"+h+"\n}\n"),h=(a?h.replace(yt,""):h).replace(bt,"$1").replace(xt,"$1;"),h="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")+h+"return __p\n}";var g=Kh(function(){return oc(l,p+"return "+h).apply(ie,u)});if(g.source=h,$s(g))throw g;return g}function yu(e){return kl(e).toLowerCase()}function bu(e){return kl(e).toUpperCase()}function xu(e,t,n){if((e=kl(e))&&(n||t===ie))return e.replace(Dt,"");if(!e||!(t=fi(t)))return e;var r=ee(e),i=ee(t);return Si(r,B(r,i),F(r,i)+1).join("")}function _u(e,t,n){if((e=kl(e))&&(n||t===ie))return e.replace(zt,"");if(!e||!(t=fi(t)))return e;var r=ee(e);return Si(r,0,F(r,ee(t))+1).join("")}function wu(e,t,n){if((e=kl(e))&&(n||t===ie))return e.replace(It,"");if(!e||!(t=fi(t)))return e;var r=ee(e);return Si(r,B(r,ee(t))).join("")}function Mu(e,t){var n=Te,r=ke;if(il(t)){var i="separator"in t?t.separator:i;n="length"in t?wl(t.length):n,r="omission"in t?fi(t.omission):r}e=kl(e);var o=e.length;if(V(e)){var a=ee(e);o=a.length}if(n>=o)return e;var s=n-$(r);if(s<1)return r;var l=a?Si(a,0,s).join(""):e.slice(0,s);if(i===ie)return l+r;if(a&&(s+=l.length-s),_h(i)){if(e.slice(s).search(i)){var u,c=l;for(i.global||(i=lc(i.source,kl(Vt.exec(i))+"g")),i.lastIndex=0;u=i.exec(c);)var d=u.index;l=l.slice(0,d===ie?s:d)}}else if(e.indexOf(fi(i),s)!=s){var h=l.lastIndexOf(i);h>-1&&(l=l.slice(0,h))}return l+r}function Su(e){return e=kl(e),e&&Mt.test(e)?e.replace(_t,Xn):e}function Eu(e,t,n){return e=kl(e),t=n?ie:t,t===ie?H(e)?re(e):_(e):e.match(t)||[]}function Tu(e){var t=null==e?0:e.length,n=wo();return e=t?m(e,function(e){if("function"!=typeof e[1])throw new cc(se);return[n(e[0]),e[1]]}):[],ni(function(n){for(var r=-1;++rLe)return[];var n=ze,r=Yc(e,ze);t=wo(t),e-=ze;for(var i=L(r,t);++n1?e[t-1]:ie;return n="function"==typeof n?(e.pop(),n):ie,qa(e,n)}),Zd=vo(function(e){var t=e.length,n=t?e[0]:0,r=this.__wrapped__,o=function(t){return tr(t,e)};return!(t>1||this.__actions__.length)&&r instanceof x&&Io(n)?(r=r.slice(n,+n+(t?1:0)),r.__actions__.push({func:Qa,args:[o],thisArg:ie}),new i(r,this.__chain__).thru(function(e){return t&&!e.length&&e.push(ie),e})):this.thru(o)}),Kd=ji(function(e,t,n){gc.call(e,n)?++e[n]:er(e,n,1)}),Jd=Ki(da),Qd=Ki(ha),$d=ji(function(e,t,n){gc.call(e,n)?e[n].push(t):er(e,n,[t])}),eh=ni(function(e,t,n){var r=-1,i="function"==typeof t,o=Ys(e)?nc(e.length):[];return pd(e,function(e){o[++r]=i?s(t,e,n):Er(e,t,n)}),o}),th=ji(function(e,t,n){er(e,n,t)}),nh=ji(function(e,t,n){e[n?0:1].push(t)},function(){return[[],[]]}),rh=ni(function(e,t){if(null==e)return[];var n=t.length;return n>1&&zo(e,t[0],t[1])?t=[]:n>2&&zo(t[0],t[1],t[2])&&(t=[t[0]]),qr(e,hr(t,1),[])}),ih=zc||function(){return Ln.Date.now()},oh=ni(function(e,t,n){var r=ge;if(n.length){var i=X(n,_o(oh));r|=_e}return uo(e,r,t,n,i)}),ah=ni(function(e,t,n){var r=ge|ve;if(n.length){var i=X(n,_o(ah));r|=_e}return uo(t,r,e,n,i)}),sh=ni(function(e,t){return ar(e,1,t)}),lh=ni(function(e,t,n){return ar(e,Sl(t)||0,n)});As.Cache=un;var uh=xd(function(e,t){t=1==t.length&&gh(t[0])?m(t[0],I(wo())):m(hr(t,1),I(wo()));var n=t.length;return ni(function(r){for(var i=-1,o=Yc(r.length,n);++i=t}),mh=Tr(function(){return arguments}())?Tr:function(e){return ol(e)&&gc.call(e,"callee")&&!Cc.call(e,"callee")},gh=nc.isArray,vh=Fn?I(Fn):kr,yh=jc||ju,bh=Un?I(Un):Or,xh=jn?I(jn):Ar,_h=Wn?I(Wn):Dr,wh=Vn?I(Vn):Ir,Mh=Hn?I(Hn):zr,Sh=oo(Ur),Eh=oo(function(e,t){return e<=t}),Th=Wi(function(e,t){if(jo(t)||Ys(t))return void Bi(t,Ul(t),e);for(var n in t)gc.call(t,n)&&Gn(e,n,t[n])}),kh=Wi(function(e,t){Bi(t,jl(t),e)}),Oh=Wi(function(e,t,n,r){Bi(t,jl(t),e,r)}),Ch=Wi(function(e,t,n,r){Bi(t,Ul(t),e,r)}),Ph=vo(tr),Ah=ni(function(e){return e.push(ie,co),s(Oh,ie,e)}),Rh=ni(function(e){return e.push(ie,ho),s(Nh,ie,e)}),Lh=$i(function(e,t,n){e[t]=n},Ou(Pu)),Dh=$i(function(e,t,n){gc.call(e,t)?e[t].push(n):e[t]=[n]},wo),Ih=ni(Er),zh=Wi(function(e,t,n){Hr(e,t,n)}),Nh=Wi(function(e,t,n,r){Hr(e,t,n,r)}),Bh=vo(function(e,t){var n={};if(null==e)return n;var r=!1;t=m(t,function(t){return t=Mi(t,e),r||(r=t.length>1),t}),Bi(e,bo(e),n),r&&(n=rr(n,de|he|fe,fo));for(var i=t.length;i--;)mi(n,t[i]);return n}),Fh=vo(function(e,t){return null==e?{}:Xr(e,t)}),Uh=lo(Ul),jh=lo(jl),Wh=qi(function(e,t,n){return t=t.toLowerCase(),e+(n?iu(t):t)}),Vh=qi(function(e,t,n){return e+(n?"-":"")+t.toLowerCase()}),Hh=qi(function(e,t,n){return e+(n?" ":"")+t.toLowerCase()}),Gh=Yi("toLowerCase"),Yh=qi(function(e,t,n){return e+(n?"_":"")+t.toLowerCase()}),qh=qi(function(e,t,n){return e+(n?" ":"")+Zh(t)}),Xh=qi(function(e,t,n){return e+(n?" ":"")+t.toUpperCase()}),Zh=Yi("toUpperCase"),Kh=ni(function(e,t){try{return s(e,ie,t)}catch(e){return $s(e)?e:new ic(e)}}),Jh=vo(function(e,t){return u(t,function(t){t=$o(t),er(e,t,oh(e[t],e))}),e}),Qh=Ji(),$h=Ji(!0),ef=ni(function(e,t){return function(n){return Er(n,e,t)}}),tf=ni(function(e,t){return function(n){return Er(e,n,t)}}),nf=to(m),rf=to(d),of=to(b),af=io(),sf=io(!0),lf=eo(function(e,t){return e+t},0),uf=so("ceil"),cf=eo(function(e,t){return e/t},1),df=so("floor"),hf=eo(function(e,t){return e*t},1),ff=so("round"),pf=eo(function(e,t){return e-t},0);return n.after=Ss,n.ary=Es,n.assign=Th,n.assignIn=kh,n.assignInWith=Oh,n.assignWith=Ch,n.at=Ph,n.before=Ts,n.bind=oh,n.bindAll=Jh,n.bindKey=ah,n.castArray=Fs,n.chain=Ka,n.chunk=ra,n.compact=ia,n.concat=oa,n.cond=Tu,n.conforms=ku,n.constant=Ou,n.countBy=Kd,n.create=Ol,n.curry=ks,n.curryRight=Os,n.debounce=Cs,n.defaults=Ah,n.defaultsDeep=Rh,n.defer=sh,n.delay=lh,n.difference=Rd,n.differenceBy=Ld,n.differenceWith=Dd,n.drop=aa,n.dropRight=sa,n.dropRightWhile=la,n.dropWhile=ua,n.fill=ca,n.filter=ss,n.flatMap=ls,n.flatMapDeep=us,n.flatMapDepth=cs,n.flatten=fa,n.flattenDeep=pa,n.flattenDepth=ma,n.flip=Ps,n.flow=Qh,n.flowRight=$h,n.fromPairs=ga,n.functions=Il,n.functionsIn=zl,n.groupBy=$d,n.initial=ba,n.intersection=Id,n.intersectionBy=zd,n.intersectionWith=Nd,n.invert=Lh,n.invertBy=Dh,n.invokeMap=eh,n.iteratee=Au,n.keyBy=th,n.keys=Ul,n.keysIn=jl,n.map=ps,n.mapKeys=Wl,n.mapValues=Vl,n.matches=Ru,n.matchesProperty=Lu,n.memoize=As,n.merge=zh,n.mergeWith=Nh,n.method=ef,n.methodOf=tf,n.mixin=Du,n.negate=Rs,n.nthArg=Nu,n.omit=Bh,n.omitBy=Hl,n.once=Ls,n.orderBy=ms,n.over=nf,n.overArgs=uh,n.overEvery=rf,n.overSome=of,n.partial=ch,n.partialRight=dh,n.partition=nh,n.pick=Fh,n.pickBy=Gl,n.property=Bu,n.propertyOf=Fu,n.pull=Bd,n.pullAll=Sa,n.pullAllBy=Ea,n.pullAllWith=Ta,n.pullAt=Fd,n.range=af,n.rangeRight=sf,n.rearg=hh,n.reject=ys,n.remove=ka,n.rest=Ds,n.reverse=Oa,n.sampleSize=xs,n.set=ql,n.setWith=Xl,n.shuffle=_s,n.slice=Ca,n.sortBy=rh,n.sortedUniq=za,n.sortedUniqBy=Na,n.split=mu,n.spread=Is,n.tail=Ba,n.take=Fa,n.takeRight=Ua,n.takeRightWhile=ja,n.takeWhile=Wa,n.tap=Ja,n.throttle=zs,n.thru=Qa,n.toArray=xl,n.toPairs=Uh,n.toPairsIn=jh,n.toPath=Yu,n.toPlainObject=El,n.transform=Zl,n.unary=Ns,n.union=Ud,n.unionBy=jd,n.unionWith=Wd,n.uniq=Va,n.uniqBy=Ha,n.uniqWith=Ga,n.unset=Kl,n.unzip=Ya,n.unzipWith=qa,n.update=Jl,n.updateWith=Ql,n.values=$l,n.valuesIn=eu,n.without=Vd,n.words=Eu,n.wrap=Bs,n.xor=Hd,n.xorBy=Gd,n.xorWith=Yd,n.zip=qd,n.zipObject=Xa,n.zipObjectDeep=Za,n.zipWith=Xd,n.entries=Uh,n.entriesIn=jh,n.extend=kh,n.extendWith=Oh,Du(n,n),n.add=lf,n.attempt=Kh,n.camelCase=Wh,n.capitalize=iu,n.ceil=uf,n.clamp=tu,n.clone=Us,n.cloneDeep=Ws,n.cloneDeepWith=Vs,n.cloneWith=js,n.conformsTo=Hs,n.deburr=ou,n.defaultTo=Cu,n.divide=cf,n.endsWith=au,n.eq=Gs,n.escape=su,n.escapeRegExp=lu,n.every=as,n.find=Jd,n.findIndex=da,n.findKey=Cl,n.findLast=Qd,n.findLastIndex=ha,n.findLastKey=Pl,n.floor=df,n.forEach=ds,n.forEachRight=hs,n.forIn=Al,n.forInRight=Rl,n.forOwn=Ll,n.forOwnRight=Dl,n.get=Nl,n.gt=fh,n.gte=ph,n.has=Bl,n.hasIn=Fl,n.head=va,n.identity=Pu,n.includes=fs,n.indexOf=ya,n.inRange=nu,n.invoke=Ih,n.isArguments=mh,n.isArray=gh,n.isArrayBuffer=vh,n.isArrayLike=Ys,n.isArrayLikeObject=qs,n.isBoolean=Xs,n.isBuffer=yh,n.isDate=bh,n.isElement=Zs,n.isEmpty=Ks,n.isEqual=Js,n.isEqualWith=Qs,n.isError=$s,n.isFinite=el,n.isFunction=tl,n.isInteger=nl,n.isLength=rl,n.isMap=xh,n.isMatch=al,n.isMatchWith=sl,n.isNaN=ll,n.isNative=ul,n.isNil=dl,n.isNull=cl,n.isNumber=hl,n.isObject=il,n.isObjectLike=ol,n.isPlainObject=fl,n.isRegExp=_h,n.isSafeInteger=pl,n.isSet=wh,n.isString=ml,n.isSymbol=gl,n.isTypedArray=Mh,n.isUndefined=vl,n.isWeakMap=yl,n.isWeakSet=bl,n.join=xa,n.kebabCase=Vh,n.last=_a,n.lastIndexOf=wa,n.lowerCase=Hh,n.lowerFirst=Gh,n.lt=Sh,n.lte=Eh,n.max=Xu,n.maxBy=Zu,n.mean=Ku,n.meanBy=Ju,n.min=Qu,n.minBy=$u,n.stubArray=Uu,n.stubFalse=ju,n.stubObject=Wu,n.stubString=Vu,n.stubTrue=Hu,n.multiply=hf,n.nth=Ma,n.noConflict=Iu,n.noop=zu,n.now=ih,n.pad=uu,n.padEnd=cu,n.padStart=du,n.parseInt=hu,n.random=ru,n.reduce=gs,n.reduceRight=vs,n.repeat=fu,n.replace=pu,n.result=Yl,n.round=ff,n.runInContext=e,n.sample=bs,n.size=ws,n.snakeCase=Yh,n.some=Ms,n.sortedIndex=Pa,n.sortedIndexBy=Aa,n.sortedIndexOf=Ra,n.sortedLastIndex=La,n.sortedLastIndexBy=Da,n.sortedLastIndexOf=Ia,n.startCase=qh,n.startsWith=gu,n.subtract=pf,n.sum=ec,n.sumBy=tc,n.template=vu,n.times=Gu,n.toFinite=_l,n.toInteger=wl,n.toLength=Ml,n.toLower=yu,n.toNumber=Sl,n.toSafeInteger=Tl,n.toString=kl,n.toUpper=bu,n.trim=xu,n.trimEnd=_u,n.trimStart=wu,n.truncate=Mu,n.unescape=Su,n.uniqueId=qu,n.upperCase=Xh,n.upperFirst=Zh,n.each=ds,n.eachRight=hs,n.first=va,Du(n,function(){var e={};return fr(n,function(t,r){gc.call(n.prototype,r)||(e[r]=t)}),e}(),{chain:!1}),n.VERSION="4.17.4",u(["bind","bindKey","curry","curryRight","partial","partialRight"],function(e){n[e].placeholder=n}),u(["drop","take"],function(e,t){x.prototype[e]=function(n){n=n===ie?1:Gc(wl(n),0);var r=this.__filtered__&&!t?new x(this):this.clone();return r.__filtered__?r.__takeCount__=Yc(n,r.__takeCount__):r.__views__.push({size:Yc(n,ze),type:e+(r.__dir__<0?"Right":"")}),r},x.prototype[e+"Right"]=function(t){return this.reverse()[e](t).reverse()}}),u(["filter","map","takeWhile"],function(e,t){var n=t+1,r=n==Pe||3==n;x.prototype[e]=function(e){var t=this.clone();return t.__iteratees__.push({iteratee:wo(e,3),type:n}),t.__filtered__=t.__filtered__||r,t}}),u(["head","last"],function(e,t){var n="take"+(t?"Right":"");x.prototype[e]=function(){return this[n](1).value()[0]}}),u(["initial","tail"],function(e,t){var n="drop"+(t?"":"Right");x.prototype[e]=function(){return this.__filtered__?new x(this):this[n](1)}}),x.prototype.compact=function(){return this.filter(Pu)},x.prototype.find=function(e){return this.filter(e).head()},x.prototype.findLast=function(e){return this.reverse().find(e)},x.prototype.invokeMap=ni(function(e,t){return"function"==typeof e?new x(this):this.map(function(n){return Er(n,e,t)})}),x.prototype.reject=function(e){return this.filter(Rs(wo(e)))},x.prototype.slice=function(e,t){e=wl(e);var n=this;return n.__filtered__&&(e>0||t<0)?new x(n):(e<0?n=n.takeRight(-e):e&&(n=n.drop(e)),t!==ie&&(t=wl(t),n=t<0?n.dropRight(-t):n.take(t-e)),n)},x.prototype.takeRightWhile=function(e){return this.reverse().takeWhile(e).reverse()},x.prototype.toArray=function(){return this.take(ze)},fr(x.prototype,function(e,t){var r=/^(?:filter|find|map|reject)|While$/.test(t),o=/^(?:head|last)$/.test(t),a=n[o?"take"+("last"==t?"Right":""):t],s=o||/^find/.test(t);a&&(n.prototype[t]=function(){var t=this.__wrapped__,l=o?[1]:arguments,u=t instanceof x,c=l[0],d=u||gh(t),h=function(e){var t=a.apply(n,g([e],l));return o&&f?t[0]:t};d&&r&&"function"==typeof c&&1!=c.length&&(u=d=!1);var f=this.__chain__,p=!!this.__actions__.length,m=s&&!f,v=u&&!p;if(!s&&d){t=v?t:new x(this);var y=e.apply(t,l);return y.__actions__.push({func:Qa,args:[h],thisArg:ie}),new i(y,f)}return m&&v?e.apply(this,l):(y=this.thru(h),m?o?y.value()[0]:y.value():y)})}),u(["pop","push","shift","sort","splice","unshift"],function(e){var t=dc[e],r=/^(?:push|sort|unshift)$/.test(e)?"tap":"thru",i=/^(?:pop|shift)$/.test(e);n.prototype[e]=function(){var e=arguments;if(i&&!this.__chain__){var n=this.value();return t.apply(gh(n)?n:[],e)}return this[r](function(n){return t.apply(gh(n)?n:[],e)})}}),fr(x.prototype,function(e,t){var r=n[t];if(r){var i=r.name+"";(id[i]||(id[i]=[])).push({name:t,func:r})}}),id[Qi(ie,ve).name]=[{name:"wrapper",func:ie}],x.prototype.clone=C,x.prototype.reverse=J,x.prototype.value=te,n.prototype.at=Zd,n.prototype.chain=$a,n.prototype.commit=es,n.prototype.next=ts,n.prototype.plant=rs,n.prototype.reverse=is,n.prototype.toJSON=n.prototype.valueOf=n.prototype.value=os,n.prototype.first=n.prototype.head,Rc&&(n.prototype[Rc]=ns),n}();Ln._=Zn,(i=function(){return Zn}.call(t,n,t,r))!==ie&&(r.exports=i)}).call(this)}).call(t,n(79),n(80)(e))},function(e,t,n){e.exports={default:n(197),__esModule:!0}},function(e,t,n){var r=n(58);e.exports=function(e){return Object(r(e))}},function(e,t,n){e.exports=n(339)()},function(e,t,n){"use strict";function r(){if("undefined"!=typeof __REACT_DEVTOOLS_GLOBAL_HOOK__&&"function"==typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE)try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(r)}catch(e){console.error(e)}}r(),e.exports=n(341)},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0});var i=n(0),o=r(i),a=n(1),s=r(a),l=n(9),u=function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t.default=e,t}(l),c=n(398),d=(r(c),n(352)),h=r(d),f=n(25),p=r(f),m=n(156),g=r(m),v=n(155),y=r(v),b=n(158),x=r(b),_=n(164),w=r(_),M=n(159),S=r(M),E=n(165),T=r(E),k=n(83),O=r(k),C=n(157),P=r(C),A=n(160),R=r(A),L=n(161),D=r(L),I=n(162),z=r(I),N=(n(34),function(){function e(){(0,o.default)(this,e);var t=!this.isMobileDevice();this.coordinates=new g.default,this.renderer=new u.WebGLRenderer({antialias:t}),this.scene=new u.Scene,this.scene.background=new u.Color(1316634),this.dimension={width:0,height:0},this.ground="tile"===p.default.ground.type?new w.default:new x.default,this.map=new S.default,this.adc=new y.default,this.adcMeshAddedToScene=!1,this.planningTrajectory=new T.default,this.perceptionObstacles=new O.default,this.decision=new P.default,this.prediction=new R.default,this.routing=new D.default,this.routingEditor=new z.default,this.stats=null,p.default.debug.performanceMonitor&&(this.stats=new h.default,this.stats.showPanel(1),this.stats.domElement.style.position="absolute",this.stats.domElement.style.top=null,this.stats.domElement.style.bottom="0px",document.body.appendChild(this.stats.domElement)),this.geolocation={x:0,y:0}}return(0,s.default)(e,[{key:"initialize",value:function(e,t,n,r){this.options=r,this.canvasId=e,this.viewAngle=p.default.camera.viewAngle,this.viewDistance=p.default.camera.laneWidth*p.default.camera.laneWidthToViewDistanceRatio,this.camera=new u.PerspectiveCamera(p.default.camera[this.options.cameraAngle].fov,window.innerWidth/window.innerHeight,p.default.camera[this.options.cameraAngle].near,p.default.camera[this.options.cameraAngle].far),this.camera.name="camera",this.scene.add(this.camera),this.updateDimension(t,n),this.renderer.setPixelRatio(window.devicePixelRatio),document.getElementById(e).appendChild(this.renderer.domElement);var i=new u.AmbientLight(4473924),o=new u.DirectionalLight(16772829);o.position.set(0,0,1).normalize(),this.controls=new u.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(e,t){this.coordinates.isInitialized()||this.coordinates.initialize(e,t)}},{key:"updateDimension",value:function(e,t){this.camera.aspect=e/t,this.camera.updateProjectionMatrix(),this.renderer.setSize(e,t),this.dimension.width=e,this.dimension.height=t}},{key:"enableOrbitControls",value:function(){var e=this.adc.mesh.position;this.controls.enabled=!0,this.controls.enableRotate=!1,this.controls.reset(),this.controls.minDistance=20,this.controls.maxDistance=1e3,this.controls.target.set(e.x,e.y,0),this.camera.position.set(e.x,e.y,50),this.camera.up.set(0,1,0),this.camera.lookAt(e.x,e.y,0)}},{key:"adjustCamera",value:function(e,t){if(!this.routingEditor.isInEditingMode()){switch(this.camera.fov=p.default.camera[t].fov,this.camera.near=p.default.camera[t].near,this.camera.far=p.default.camera[t].far,t){case"Default":var n=this.viewDistance*Math.cos(e.rotation.y)*Math.cos(this.viewAngle),r=this.viewDistance*Math.sin(e.rotation.y)*Math.cos(this.viewAngle),i=this.viewDistance*Math.sin(this.viewAngle);this.camera.position.x=e.position.x-n,this.camera.position.y=e.position.y-r,this.camera.position.z=e.position.z+i,this.camera.up.set(0,0,1),this.camera.lookAt({x:e.position.x+2*n,y:e.position.y+2*r,z:0}),this.controls.enabled=!1;break;case"Near":n=.5*this.viewDistance*Math.cos(e.rotation.y)*Math.cos(this.viewAngle),r=.5*this.viewDistance*Math.sin(e.rotation.y)*Math.cos(this.viewAngle),i=.5*this.viewDistance*Math.sin(this.viewAngle),this.camera.position.x=e.position.x-n,this.camera.position.y=e.position.y-r,this.camera.position.z=e.position.z+i,this.camera.up.set(0,0,1),this.camera.lookAt({x:e.position.x+2*n,y:e.position.y+2*r,z:0}),this.controls.enabled=!1;break;case"Overhead":r=.5*this.viewDistance*Math.sin(e.rotation.y)*Math.cos(this.viewAngle),i=2*this.viewDistance*Math.sin(this.viewAngle),this.camera.position.x=e.position.x,this.camera.position.y=e.position.y+r,this.camera.position.z=2*(e.position.z+i),this.camera.up.set(0,1,0),this.camera.lookAt({x:e.position.x,y:e.position.y+r,z:0}),this.controls.enabled=!1;break;case"Monitor":this.camera.position.set(e.position.x,e.position.y,50),this.camera.up.set(0,1,0),this.camera.lookAt(e.position.x,e.position.y,0),this.controls.enabled=!1;break;case"Map":this.controls.enabled||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:"addDefaultEndPoint",value:function(e){for(var t=0;t0)n=e.stepSize;else{var o=r.niceNum(t.max-t.min,!1);n=r.niceNum(o/(e.maxTicks-1),!0)}var a=Math.floor(t.min/n)*n,s=Math.ceil(t.max/n)*n;e.min&&e.max&&e.stepSize&&r.almostWhole((e.max-e.min)/e.stepSize,n/1e3)&&(a=e.min,s=e.max);var l=(s-a)/n;l=r.almostEquals(l,Math.round(l),n/1e3)?Math.round(l):Math.ceil(l),i.push(void 0!==e.min?e.min:a);for(var u=1;u3?n[2]-n[1]:n[1]-n[0];Math.abs(i)>1&&e!==Math.floor(e)&&(i=e-Math.floor(e));var o=r.log10(Math.abs(i)),a="";if(0!==e){var s=-1*Math.floor(o);s=Math.max(Math.min(s,20),0),a=e.toFixed(s)}else a="0";return a},logarithmic:function(e,t,n){var i=e/Math.pow(10,Math.floor(r.log10(e)));return 0===e?"0":1===i||2===i||5===i||0===t||t===n.length-1?e.toExponential():""}}}},function(e,t,n){"use strict";function r(e){return"string"==typeof e&&i.test(e)}Object.defineProperty(t,"__esModule",{value:!0}),t.default=r;var i=/-webkit-|-moz-|-ms-/;e.exports=t.default},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function i(e,t,n,r){function i(e){if(r){var t=e.clone();r(t)}}h[t]?i(h[t]):c.load(e,function(e){var r=new s.OBJLoader;e.preload(),r.setMaterials(e),r.load(t,function(e){e.name=t,e.scale.set(n.x,n.y,n.z),h[t]=e,i(e)})})}function o(e,t){d.load(e,t)}Object.defineProperty(t,"__esModule",{value:!0}),t.loadObject=i,t.loadTexture=o;var a=n(9),s=function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t.default=e,t}(a),l=n(400),u=(r(l),n(399)),c=(r(u),new s.MTLLoader),d=new s.TextureLoader;s.TextureLoader.prototype.crossOrigin="";var h={}},function(e,t,n){e.exports={default:n(189),__esModule:!0}},function(e,t,n){var r=n(30),i=n(94),o=n(92),a=n(26),s=n(51),l=n(73),u={},c={},t=e.exports=function(e,t,n,d,h){var f,p,m,g,v=h?function(){return e}:l(e),y=r(n,d,t?2:1),b=0;if("function"!=typeof v)throw TypeError(e+" is not iterable!");if(o(v)){for(f=s(e.length);f>b;b++)if((g=t?y(a(p=e[b])[0],p[1]):y(e[b]))===u||g===c)return g}else for(m=v.call(e);!(p=m.next()).done;)if((g=i(m,y,p.value,t))===u||g===c)return g};t.BREAK=u,t.RETURN=c},function(e,t,n){var r=n(26),i=n(217),o=n(59),a=n(67)("IE_PROTO"),s=function(){},l=function(){var e,t=n(90)("iframe"),r=o.length;for(t.style.display="none",n(213).appendChild(t),t.src="javascript:",e=t.contentWindow.document,e.open(),e.write("