From c881d994b181467c38b6c023bb7232f0521b9f33 Mon Sep 17 00:00:00 2001 From: Lucas <18538046+TeaWithLucas@users.noreply.github.com> Date: Thu, 17 Oct 2019 10:33:48 +0100 Subject: [PATCH] Merge With Lilys (#11) * Correct Type-o fix: incorrect spelling for Greasemonkey * Update CODE_OF_CONDUCT.md * Create CONTRIBUTING.md * Update issue templates * Apply morphs (#3) Fix: fromBufferAttribute wasn't working with morphtargets so we set them manually Fix: update tempVector to use morphVector is needed * Minor adjustments * task: make parity with my version * task: @allanmaral did a great job on styling fix: incorrect naming for OBJ files fix: save item needs to be available - need to find a way to hide it after it changes * fix: check for non-zero vale of skinIndexNames task: remove herosaver.js * task: rewind face vertices when mirrored * Merge With Lilys * Update README.md --- .gitignore | 4 +- Autoloader.js | 2 +- README.md | 26 ++-- dist/saver.min.js | 1 + package-lock.json | 341 ++++++++++++++++++++++++++++++++++++++++++++ package.json | 26 ++++ rollup.config.js | 46 ++++++ src/finalizeMesh.js | 117 +++++++++++++++ src/saver.js | 152 ++++++++++++++++++++ 9 files changed, 699 insertions(+), 16 deletions(-) create mode 100644 dist/saver.min.js create mode 100644 package-lock.json create mode 100644 package.json create mode 100644 rollup.config.js create mode 100644 src/finalizeMesh.js create mode 100755 src/saver.js diff --git a/.gitignore b/.gitignore index 00f4fd8..9daa824 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,2 @@ - -.vs/slnx.sqlite +.DS_Store +node_modules diff --git a/Autoloader.js b/Autoloader.js index ffc8e45..3fa74f7 100644 --- a/Autoloader.js +++ b/Autoloader.js @@ -30,7 +30,7 @@ function runinsert(){ // run the Herosaver Script - var xhr=new XMLHttpRequest;xhr.open("get","https://raw.githubusercontent.com/TeaWithLucas/Herosaver/master/herosaver.js",true);xhr.onreadystatechange=function(){if(xhr.readyState==4){var script=document.createElement("script");script.type="text/javascript";script.text=xhr.responseText;document.body.appendChild(script)}};xhr.send(null); + var xhr=new XMLHttpRequest;xhr.open("get","https://raw.githubusercontent.com/TeaWithLucas/Herosaver/master/dist/saver.min.js",true);xhr.onreadystatechange=function(){if(xhr.readyState==4){var script=document.createElement("script");script.type="text/javascript";script.text=xhr.responseText;document.body.appendChild(script)}};xhr.send(null); }; diff --git a/README.md b/README.md index 86adcb9..a1b673f 100644 --- a/README.md +++ b/README.md @@ -9,9 +9,9 @@ Please **Always** think about the **developers** of such websites and try to **s 1. Go to the intended website 2. Open the Javascript Console [F12], then click on Console 3. Paste the following - + ``` -var xhr=new XMLHttpRequest;xhr.open("get","https://raw.githubusercontent.com/TeaWithLucas/Herosaver/master/herosaver.js",true);xhr.onreadystatechange=function(){if(xhr.readyState==4){var script=document.createElement("script");script.type="text/javascript";script.text=xhr.responseText;document.body.appendChild(script)}};xhr.send(null); +var xhr=new XMLHttpRequest;xhr.open("get","https://raw.githubusercontent.com/TeaWithLucas/Herosaver/master/dist/saver.min.js",true);xhr.onreadystatechange=function(){if(xhr.readyState==4){var script=document.createElement("script");script.type="text/javascript";script.text=xhr.responseText;document.body.appendChild(script)}};xhr.send(null); ``` ### Loading via Greecemonkey or other script loader @@ -23,29 +23,29 @@ This method should automatically load the script on page load. Current it doesn' 4. Save ## Buttons -* Export Model (STL) - Exports the current model and downloads a STL of it. -* Export (JSON) - Exports the current model settings in a JSON format. -* Import (JSON) - Imports a previously exported JSON file with model settings. -* Enlarge - Increases the size and rotates the model to match STL output for standard printing ```size:[10,10,10], rotation:[90,0,0]``` -* Reset Scale - Resets the model and refreshes it, bug: refresh twice to reset some incorrect models. +* STL - Exports the current model and downloads a STL of it. +* OBJ - Exports the current model and downloads a OBJ of it. +* Subdivision Passes - Number of loop subdivision passes for the model. +* Save - Exports the current model settings in a JSON format. +* Load - Imports a previously exported JSON file with model settings. ## Bugs Current bugs, open to solutions/suggestions -* Reset Scale Button doesnt work first press, need a second refresh to work. -* Autoloader.js doesnt work when page is reloaded, only on first page load. -* Some Geometry like facial experessions are not implemented, need to work on the THREE.js section. +* ~~Reset Scale Button doesnt work first press, need a second refresh to work.~~ +* ~~Autoloader.js doesnt work when page is reloaded, only on first page load.~~ +* ~~Some Geometry like facial experessions are not implemented, need to work on the THREE.js section.~~ * Shaders are not included, causing a more _'blocky'_ output, work on the THREE.js section is needed for this. ## Future work Current things to work on, open to solutions/suggestions -* Rotation is off by 90 degrees, simple fix -* The buttons for enlarge and reset scale are a quick and ugly method, needs reworking to not affect the scale in brower if possible, if not, automatically change scale when downloading and resetting scale when downloaded. My lack of THREE.js experience means I am unsure how to do the latter. +* ~~Rotation is off by 90 degrees, simple fix~~ +* ~~The buttons for enlarge and reset scale are a quick and ugly method, needs reworking to not affect the scale in brower if possible, if not, automatically change scale when downloading and resetting scale when downloaded. My lack of THREE.js experience means I am unsure how to do the latter.~~ ## Limitations -Currently this is a compliled selection of various bits of code, so the output is not 100% great. If you want higher quality exports, consider purchasing the stl files or help work on the code :) +Currently this is a compiled selection of various bits of code, so the output is not 100% great. If you want higher quality exports, consider purchasing the stl files or help work on the code :) diff --git a/dist/saver.min.js b/dist/saver.min.js new file mode 100644 index 0000000..18e714f --- /dev/null +++ b/dist/saver.min.js @@ -0,0 +1 @@ +var t;t=function(){"use strict";function t(){}function e(t,e){this.x=t||0,this.y=e||0}function n(t,e,n,i){this._x=t||0,this._y=e||0,this._z=n||0,this._w=void 0!==i?i:1}function i(t,e,n){this.x=t||0,this.y=e||0,this.z=n||0}function r(){this.elements=[1,0,0,0,1,0,0,0,1],arguments.length}function o(t,n,i,a,s,c,l,u,h,p){Object.defineProperty(this,"id",{value:lc++}),this.uuid=ic.generateUUID(),this.name="",this.image=void 0!==t?t:o.DEFAULT_IMAGE,this.mipmaps=[],this.mapping=void 0!==n?n:o.DEFAULT_MAPPING,this.wrapS=void 0!==i?i:Ba,this.wrapT=void 0!==a?a:Ba,this.magFilter=void 0!==s?s:Wa,this.minFilter=void 0!==c?c:qa,this.anisotropy=void 0!==h?h:1,this.format=void 0!==l?l:ss,this.type=void 0!==u?u:Xa,this.offset=new e(0,0),this.repeat=new e(1,1),this.center=new e(0,0),this.rotation=0,this.matrixAutoUpdate=1,this.matrix=new r,this.generateMipmaps=1,this.premultiplyAlpha=0,this.flipY=1,this.unpackAlignment=4,this.encoding=void 0!==p?p:js,this.version=0,this.onUpdate=null}function a(t,e,n,i){this.x=t||0,this.y=e||0,this.z=n||0,this.w=void 0!==i?i:1}function s(t,e,n){this.width=t,this.height=e,this.scissor=new a(0,0,t,e),this.scissorTest=0,this.viewport=new a(0,0,t,e),n=n||{},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.texture.image={},this.texture.image.width=t,this.texture.image.height=e,this.texture.generateMipmaps=void 0!==n.generateMipmaps?n.generateMipmaps:0,this.texture.minFilter=void 0!==n.minFilter?n.minFilter:Wa,this.depthBuffer=void 0!==n.depthBuffer?n.depthBuffer:1,this.stencilBuffer=void 0!==n.stencilBuffer?n.stencilBuffer:1,this.depthTexture=void 0!==n.depthTexture?n.depthTexture:null}function c(t,e,n){s.call(this,t,e,n),this.samples=4}function l(){this.elements=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],arguments.length}function u(t,e,n,i){this._x=t||0,this._y=e||0,this._z=n||0,this._order=i||u.DefaultOrder}function h(){this.mask=1}function p(){var t,e,o,a;Object.defineProperty(this,"id",{value:xc++}),this.uuid=ic.generateUUID(),this.name="",this.type="Object3D",this.parent=null,this.children=[],this.up=p.DefaultUp.clone(),t=new i,e=new u,o=new n,a=new i(1,1,1),e._onChange(function(){o.setFromEuler(e,0)}),o._onChange(function(){e.setFromQuaternion(o,void 0,0)}),Object.defineProperties(this,{position:{configurable:1,enumerable:1,value:t},rotation:{configurable:1,enumerable:1,value:e},quaternion:{configurable:1,enumerable:1,value:o},scale:{configurable:1,enumerable:1,value:a},modelViewMatrix:{value:new l},normalMatrix:{value:new r}}),this.matrix=new l,this.matrixWorld=new l,this.matrixAutoUpdate=p.DefaultMatrixAutoUpdate,this.matrixWorldNeedsUpdate=0,this.layers=new h,this.visible=1,this.castShadow=0,this.receiveShadow=0,this.frustumCulled=1,this.renderOrder=0,this.userData={}}function d(){p.call(this),this.type="Scene",this.background=null,this.fog=null,this.overrideMaterial=null,this.autoUpdate=1,"undefined"!=typeof __THREE_DEVTOOLS__&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}function f(t,e){this.min=void 0!==t?t:new i(1/0,1/0,1/0),this.max=void 0!==e?e:new i(-1/0,-1/0,-1/0)}function m(t,e,n,i,r){var o,a,s,c,l,u;for(o=0,a=t.length-3;o<=a;o+=3)if(Gc.fromArray(t,o),s=r.x*Math.abs(Gc.x)+r.y*Math.abs(Gc.y)+r.z*Math.abs(Gc.z),c=e.dot(Gc),l=n.dot(Gc),u=i.dot(Gc),Math.max(-Math.max(c,l,u),Math.min(c,l,u))>s)return 0;return 1}function g(t,e){this.center=void 0!==t?t:new i,this.radius=void 0!==e?e:0}function v(t,e){this.origin=void 0!==t?t:new i,this.direction=void 0!==e?e:new i}function y(t,e,n){this.a=void 0!==t?t:new i,this.b=void 0!==e?e:new i,this.c=void 0!==n?n:new i}function x(t,e,n){return void 0===e&&void 0===n?this.set(t):this.setRGB(t,e,n)}function b(t,e,n){return n<0&&(n+=1),n>1&&(n-=1),n<1/6?t+6*(e-t)*n:n<.5?e:n<2/3?t+6*(e-t)*(2/3-n):t}function _(t){return t<.04045?.0773993808*t:Math.pow(.9478672986*t+.0521327014,2.4)}function w(t){return t<.0031308?12.92*t:1.055*Math.pow(t,.41666)-.055}function M(t,e,n,r,o,a){this.a=t,this.b=e,this.c=n,this.normal=r&&r.isVector3?r:new i,this.vertexNormals=Array.isArray(r)?r:[],this.color=o&&o.isColor?o:new x,this.vertexColors=Array.isArray(o)?o:[],this.materialIndex=void 0!==a?a:0}function S(){Object.defineProperty(this,"id",{value:hl++}),this.uuid=ic.generateUUID(),this.name="",this.type="Material",this.fog=1,this.blending=Xo,this.side=Uo,this.flatShading=0,this.vertexTangents=0,this.vertexColors=Go,this.opacity=1,this.transparent=0,this.blendSrc=sa,this.blendDst=ca,this.blendEquation=Qo,this.blendSrcAlpha=null,this.blendDstAlpha=null,this.blendEquationAlpha=null,this.depthFunc=va,this.depthTest=1,this.depthWrite=1,this.stencilWriteMask=255,this.stencilFunc=tc,this.stencilRef=0,this.stencilFuncMask=255,this.stencilFail=Ks,this.stencilZFail=Ks,this.stencilZPass=Ks,this.stencilWrite=0,this.clippingPlanes=null,this.clipIntersection=0,this.clipShadows=0,this.shadowSide=null,this.colorWrite=1,this.precision=null,this.polygonOffset=0,this.polygonOffsetFactor=0,this.polygonOffsetUnits=0,this.dithering=0,this.alphaTest=0,this.premultipliedAlpha=0,this.visible=1,this.toneMapped=1,this.userData={},this.needsUpdate=1}function T(t){S.call(this),this.type="MeshBasicMaterial",this.color=new x(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.combine=wa,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=0,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.skinning=0,this.morphTargets=0,this.setValues(t)}function A(t,e,n){if(Array.isArray(t))throw new TypeError("THREE.BufferAttribute: array should be a Typed Array.");this.name="",this.array=t,this.itemSize=e,this.count=void 0!==t?t.length/e:0,this.normalized=1==n,this.dynamic=0,this.updateRange={offset:0,count:-1},this.version=0}function L(t,e,n){A.call(this,new Int8Array(t),e,n)}function C(t,e,n){A.call(this,new Uint8Array(t),e,n)}function P(t,e,n){A.call(this,new Uint8ClampedArray(t),e,n)}function E(t,e,n){A.call(this,new Int16Array(t),e,n)}function N(t,e,n){A.call(this,new Uint16Array(t),e,n)}function O(t,e,n){A.call(this,new Int32Array(t),e,n)}function D(t,e,n){A.call(this,new Uint32Array(t),e,n)}function I(t,e,n){A.call(this,new Float32Array(t),e,n)}function z(t,e,n){A.call(this,new Float64Array(t),e,n)}function R(){this.vertices=[],this.normals=[],this.colors=[],this.uvs=[],this.uvs2=[],this.groups=[],this.morphTargets={},this.skinWeights=[],this.skinIndices=[],this.boundingBox=null,this.boundingSphere=null,this.verticesNeedUpdate=0,this.normalsNeedUpdate=0,this.colorsNeedUpdate=0,this.uvsNeedUpdate=0,this.groupsNeedUpdate=0}function F(t){var e,n,i;if(0===t.length)return-1/0;for(e=t[0],n=1,i=t.length;ne&&(e=t[n]);return e}function k(){Object.defineProperty(this,"id",{value:pl+=2}),this.uuid=ic.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},this.userData={}}function B(t,e){p.call(this),this.type="Mesh",this.geometry=void 0!==t?t:new k,this.material=void 0!==e?e:new T({color:16777215*Math.random()}),this.drawMode=ks,this.updateMorphTargets()}function U(t,e,n,i,r,o,a,s){var c;return null===(e.side===jo?i.intersectTriangle(a,o,r,1,s):i.intersectTriangle(r,o,a,e.side!==Vo,s))?null:(zl.copy(s),zl.applyMatrix4(t.matrixWorld),(c=n.ray.origin.distanceTo(zl))n.far?null:{distance:c,point:zl.clone(),object:t})}function j(t,n,i,r,o,a,s,c,l,u,h){var p,d,f,m,g,v,x;if(wl.fromBufferAttribute(o,l),Ml.fromBufferAttribute(o,u),Sl.fromBufferAttribute(o,h),p=t.morphTargetInfluences,n.morphTargets&&a&&p){for(Cl.set(0,0,0),Pl.set(0,0,0),El.set(0,0,0),d=0,f=a.length;d0&&t.getShaderPrecisionFormat(35632,36338).precision>0)return"highp";e="mediump"}return"mediump"===e&&t.getShaderPrecisionFormat(35633,36337).precision>0&&t.getShaderPrecisionFormat(35632,36337).precision>0?"mediump":"lowp"}var r,o,a,s,c="undefined"!=typeof WebGL2RenderingContext&&t instanceof WebGL2RenderingContext,l=void 0!==n.precision?n.precision:"highp",u=i(l);return u!==l&&(l=u),{isWebGL2:c,getMaxAnisotropy:function(){if(void 0!==r)return r;var n=e.get("EXT_texture_filter_anisotropic");return r=null!==n?t.getParameter(n.MAX_TEXTURE_MAX_ANISOTROPY_EXT):0},getMaxPrecision:i,precision:l,logarithmicDepthBuffer:1==n.logarithmicDepthBuffer,maxTextures:t.getParameter(34930),maxVertexTextures:o=t.getParameter(35660),maxTextureSize:t.getParameter(3379),maxCubemapSize:t.getParameter(34076),maxAttributes:t.getParameter(34921),maxVertexUniforms:t.getParameter(36347),maxVaryings:t.getParameter(36348),maxFragmentUniforms:t.getParameter(36349),vertexTextures:a=o>0,floatFragmentTextures:s=c||!!e.get("OES_texture_float"),floatVertexTextures:a&&s,maxSamples:c?t.getParameter(36183):0}}function at(){function t(){u.value!==i&&(u.value=i,u.needsUpdate=o>0),n.numPlanes=o,n.numIntersection=0}function e(t,e,i,r){var o,a,s,h,p=null!==t?t.length:0,d=null;if(0!==p){if(d=u.value,1!=r||null===d)for(o=i+4*p,a=e.matrixWorldInverse,l.getNormalMatrix(a),(null===d||d.length65535?D:N)(h,1)).version=f,e.update(l,34963),(u=a.get(t))&&e.remove(u),a.set(t,l)}var o=new WeakMap,a=new WeakMap;return{get:function(t,e){var r=o.get(e);return r||(e.addEventListener("dispose",i),e.isBufferGeometry?r=e:e.isGeometry&&(void 0===e._bufferGeometry&&(e._bufferGeometry=(new k).setFromObject(t)),r=e._bufferGeometry),o.set(e,r),n.memory.geometries++,r)},update:function(t){var n,i,r,o,a,s=t.index,c=t.attributes;for(n in null!==s&&e.update(s,34963),c)e.update(c[n],34962);for(n in i=t.morphAttributes)for(o=0,a=(r=i[n]).length;o0)return t;if(void 0===(r=nu[i=e*n])&&(r=new Float32Array(i),nu[i]=r),0!==e)for(s.toArray(r,0),o=1,a=0;o!==e;++o)a+=n,t[o].toArray(r,a);return r}function yt(t,e){if(t.length!==e.length)return 0;for(var n=0,i=t.length;n");return le(n)}function he(t){return t.replace(uu,pe)}function pe(t,e,n,i){var r,o="";for(r=parseInt(e);r0?t.gammaFactor:1,N=o.isWebGL2?"":function(t,e,n){return[(t=t||{}).derivatives||e.envMapCubeUV||e.bumpMap||e.tangentSpaceNormalMap||e.clearcoatNormalMap||e.flatShading?"#extension GL_OES_standard_derivatives : enable":"",(t.fragDepth||e.logarithmicDepthBuffer)&&n.get("EXT_frag_depth")?"#extension GL_EXT_frag_depth : enable":"",t.drawBuffers&&n.get("WEBGL_draw_buffers")?"#extension GL_EXT_draw_buffers : require":"",(t.shaderTextureLOD||e.envMap)&&n.get("EXT_shader_texture_lod")?"#extension GL_EXT_shader_texture_lod : enable":""].filter(ae).join("\n")}(i.extensions,o,e),O=function(t){var e,n,i=[];for(e in t)0!=(n=t[e])&&i.push("#define "+e+" "+n);return i.join("\n")}(M),D=w.createProgram(),I=t.getRenderTarget(),z=I&&I.isWebGLMultiviewRenderTarget?I.numViews:0;return i.isRawShaderMaterial?((a=[O].filter(ae).join("\n")).length>0&&(a+="\n"),(s=[N,O].filter(ae).join("\n")).length>0&&(s+="\n")):(a=[de(o),"#define SHADER_NAME "+r.name,O,o.instancing?"#define USE_INSTANCING":"",o.supportsVertexTextures?"#define VERTEX_TEXTURES":"","#define GAMMA_FACTOR "+E,"#define MAX_BONES "+o.maxBones,o.useFog&&o.fog?"#define USE_FOG":"",o.useFog&&o.fogExp2?"#define FOG_EXP2":"",o.map?"#define USE_MAP":"",o.envMap?"#define USE_ENVMAP":"",o.envMap?"#define "+C:"",o.lightMap?"#define USE_LIGHTMAP":"",o.aoMap?"#define USE_AOMAP":"",o.emissiveMap?"#define USE_EMISSIVEMAP":"",o.bumpMap?"#define USE_BUMPMAP":"",o.normalMap?"#define USE_NORMALMAP":"",o.normalMap&&o.objectSpaceNormalMap?"#define OBJECTSPACE_NORMALMAP":"",o.normalMap&&o.tangentSpaceNormalMap?"#define TANGENTSPACE_NORMALMAP":"",o.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",o.displacementMap&&o.supportsVertexTextures?"#define USE_DISPLACEMENTMAP":"",o.specularMap?"#define USE_SPECULARMAP":"",o.roughnessMap?"#define USE_ROUGHNESSMAP":"",o.metalnessMap?"#define USE_METALNESSMAP":"",o.alphaMap?"#define USE_ALPHAMAP":"",o.vertexTangents?"#define USE_TANGENT":"",o.vertexColors?"#define USE_COLOR":"",o.vertexUvs?"#define USE_UV":"",o.flatShading?"#define FLAT_SHADED":"",o.skinning?"#define USE_SKINNING":"",o.useVertexTexture?"#define BONE_TEXTURE":"",o.morphTargets?"#define USE_MORPHTARGETS":"",o.morphNormals&&0==o.flatShading?"#define USE_MORPHNORMALS":"",o.doubleSided?"#define DOUBLE_SIDED":"",o.flipSided?"#define FLIP_SIDED":"",o.shadowMapEnabled?"#define USE_SHADOWMAP":"",o.shadowMapEnabled?"#define "+A:"",o.sizeAttenuation?"#define USE_SIZEATTENUATION":"",o.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",o.logarithmicDepthBuffer&&(o.isWebGL2||e.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;","#ifdef USE_INSTANCING"," attribute mat4 instanceMatrix;","#endif","attribute vec3 position;","attribute vec3 normal;","attribute vec2 uv;","#ifdef USE_TANGENT","\tattribute vec4 tangent;","#endif","#ifdef USE_COLOR","\tattribute vec3 color;","#endif","#ifdef USE_MORPHTARGETS","\tattribute vec3 morphTarget0;","\tattribute vec3 morphTarget1;","\tattribute vec3 morphTarget2;","\tattribute vec3 morphTarget3;","\t#ifdef USE_MORPHNORMALS","\t\tattribute vec3 morphNormal0;","\t\tattribute vec3 morphNormal1;","\t\tattribute vec3 morphNormal2;","\t\tattribute vec3 morphNormal3;","\t#else","\t\tattribute vec3 morphTarget4;","\t\tattribute vec3 morphTarget5;","\t\tattribute vec3 morphTarget6;","\t\tattribute vec3 morphTarget7;","\t#endif","#endif","#ifdef USE_SKINNING","\tattribute vec4 skinIndex;","\tattribute vec4 skinWeight;","#endif","\n"].filter(ae).join("\n"),s=[N,de(o),"#define SHADER_NAME "+r.name,O,o.alphaTest?"#define ALPHATEST "+o.alphaTest+(o.alphaTest%1?"":".0"):"","#define GAMMA_FACTOR "+E,o.useFog&&o.fog?"#define USE_FOG":"",o.useFog&&o.fogExp2?"#define FOG_EXP2":"",o.map?"#define USE_MAP":"",o.matcap?"#define USE_MATCAP":"",o.envMap?"#define USE_ENVMAP":"",o.envMap?"#define "+L:"",o.envMap?"#define "+C:"",o.envMap?"#define "+P:"",o.lightMap?"#define USE_LIGHTMAP":"",o.aoMap?"#define USE_AOMAP":"",o.emissiveMap?"#define USE_EMISSIVEMAP":"",o.bumpMap?"#define USE_BUMPMAP":"",o.normalMap?"#define USE_NORMALMAP":"",o.normalMap&&o.objectSpaceNormalMap?"#define OBJECTSPACE_NORMALMAP":"",o.normalMap&&o.tangentSpaceNormalMap?"#define TANGENTSPACE_NORMALMAP":"",o.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",o.specularMap?"#define USE_SPECULARMAP":"",o.roughnessMap?"#define USE_ROUGHNESSMAP":"",o.metalnessMap?"#define USE_METALNESSMAP":"",o.alphaMap?"#define USE_ALPHAMAP":"",o.sheen?"#define USE_SHEEN":"",o.vertexTangents?"#define USE_TANGENT":"",o.vertexColors?"#define USE_COLOR":"",o.vertexUvs?"#define USE_UV":"",o.gradientMap?"#define USE_GRADIENTMAP":"",o.flatShading?"#define FLAT_SHADED":"",o.doubleSided?"#define DOUBLE_SIDED":"",o.flipSided?"#define FLIP_SIDED":"",o.shadowMapEnabled?"#define USE_SHADOWMAP":"",o.shadowMapEnabled?"#define "+A:"",o.premultipliedAlpha?"#define PREMULTIPLIED_ALPHA":"",o.physicallyCorrectLights?"#define PHYSICALLY_CORRECT_LIGHTS":"",o.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",o.logarithmicDepthBuffer&&(o.isWebGL2||e.get("EXT_frag_depth"))?"#define USE_LOGDEPTHBUF_EXT":"",(i.extensions&&i.extensions.shaderTextureLOD||o.envMap)&&(o.isWebGL2||e.get("EXT_shader_texture_lod"))?"#define TEXTURE_LOD_EXT":"","uniform mat4 viewMatrix;","uniform vec3 cameraPosition;",o.toneMapping!==Ta?"#define TONE_MAPPING":"",o.toneMapping!==Ta?Zl.tonemapping_pars_fragment:"",o.toneMapping!==Ta?oe("toneMapping",o.toneMapping):"",o.dithering?"#define DITHERING":"",o.outputEncoding||o.mapEncoding||o.matcapEncoding||o.envMapEncoding||o.emissiveMapEncoding?Zl.encodings_pars_fragment:"",o.mapEncoding?re("mapTexelToLinear",o.mapEncoding):"",o.matcapEncoding?re("matcapTexelToLinear",o.matcapEncoding):"",o.envMapEncoding?re("envMapTexelToLinear",o.envMapEncoding):"",o.emissiveMapEncoding?re("emissiveMapTexelToLinear",o.emissiveMapEncoding):"",o.outputEncoding?("linearToOutputTexel",b=o.outputEncoding,_=ne(b),"vec4 linearToOutputTexel( vec4 value ) { return LinearTo"+_[0]+_[1]+"; }"):"",o.depthPacking?"#define DEPTH_PACKING "+i.depthPacking:"","\n"].filter(ae).join("\n")),S=ce(S=se(S=le(S),o),o),T=ce(T=se(T=le(T),o),o),S=he(S),T=he(T),o.isWebGL2&&!i.isRawShaderMaterial&&(c=0,l=/^\s*#version\s+300\s+es\s*\n/,i.isShaderMaterial&&null!==S.match(l)&&null!==T.match(l)&&(c=1,S=S.replace(l,""),T=T.replace(l,"")),a="#version 300 es\n\n#define attribute in\n#define varying out\n#define texture2D texture\n"+a,s=["#version 300 es\n\n#define varying in",c?"":"out highp vec4 pc_fragColor;",c?"":"#define gl_FragColor pc_fragColor","#define gl_FragDepthEXT gl_FragDepth\n#define texture2D texture\n#define textureCube texture\n#define texture2DProj textureProj\n#define texture2DLodEXT textureLod\n#define texture2DProjLodEXT textureProjLod\n#define textureCubeLodEXT textureLod\n#define texture2DGradEXT textureGrad\n#define texture2DProjGradEXT textureProjGrad\n#define textureCubeGradEXT textureGrad"].join("\n")+"\n"+s,z>0&&(a=(a=a.replace("#version 300 es\n",["#version 300 es\n\n#extension GL_OVR_multiview2 : require","layout(num_views = "+z+") in;","#define VIEW_ID gl_ViewID_OVR"].join("\n"))).replace("uniform mat4 modelViewMatrix;\nuniform mat4 projectionMatrix;\nuniform mat4 viewMatrix;\nuniform mat3 normalMatrix;",["uniform mat4 modelViewMatrices["+z+"];","uniform mat4 projectionMatrices["+z+"];","uniform mat4 viewMatrices["+z+"];","uniform mat3 normalMatrices["+z+"];","#define modelViewMatrix modelViewMatrices[VIEW_ID]\n#define projectionMatrix projectionMatrices[VIEW_ID]\n#define viewMatrix viewMatrices[VIEW_ID]\n#define normalMatrix normalMatrices[VIEW_ID]"].join("\n")),s=(s=s.replace("#version 300 es\n","#version 300 es\n\n#extension GL_OVR_multiview2 : require\n#define VIEW_ID gl_ViewID_OVR")).replace("uniform mat4 viewMatrix;",["uniform mat4 viewMatrices["+z+"];","#define viewMatrix viewMatrices[VIEW_ID]"].join("\n")))),u=s+T,h=ee(w,35633,a+S),p=ee(w,35632,u),w.attachShader(D,h),w.attachShader(D,p),void 0!==i.index0AttributeName?w.bindAttribLocation(D,0,i.index0AttributeName):1==o.morphTargets&&w.bindAttribLocation(D,0,"position"),w.linkProgram(D),t.debug.checkShaderErrors&&(d=w.getProgramInfoLog(D).trim(),f=w.getShaderInfoLog(h).trim(),m=w.getShaderInfoLog(p).trim(),g=1,v=1,0==w.getProgramParameter(D,35714)?(g=0,ie(w,h,"vertex"),ie(w,p,"fragment")):""!==d||""!==f&&""!==m||(v=0),v&&(this.diagnostics={runnable:g,material:i,programLog:d,vertexShader:{log:f,prefix:a},fragmentShader:{log:m,prefix:s}})),w.deleteShader(h),w.deleteShader(p),this.getUniforms=function(){return void 0===y&&(y=new te(w,D)),y},this.getAttributes=function(){return void 0===x&&(x=function(t,e){var n,i,r={},o=t.getProgramParameter(e,35721);for(n=0;n0,maxBones:d,useVertexTexture:n.floatVertexTextures,morphTargets:e.morphTargets,morphNormals:e.morphNormals,maxMorphTargets:t.maxMorphTargets,maxMorphNormals:t.maxMorphNormals,numDirLights:r.directional.length,numPointLights:r.point.length,numSpotLights:r.spot.length,numRectAreaLights:r.rectArea.length,numHemiLights:r.hemi.length,numDirLightShadows:r.directionalShadowMap.length,numPointLightShadows:r.pointShadowMap.length,numSpotLightShadows:r.spotShadowMap.length,numClippingPlanes:c,numClipIntersection:l,dithering:e.dithering,shadowMapEnabled:t.shadowMap.enabled&&a.length>0,shadowMapType:t.shadowMap.type,toneMapping:e.toneMapped?t.toneMapping:Ta,physicallyCorrectLights:t.physicallyCorrectLights,premultipliedAlpha:e.premultipliedAlpha,alphaTest:e.alphaTest,doubleSided:e.side===Vo,flipSided:e.side===jo,depthPacking:void 0!==e.depthPacking?e.depthPacking:0}},this.getProgramCode=function(e,n){var i,r,o=[];if(n.shaderID?o.push(n.shaderID):(o.push(e.fragmentShader),o.push(e.vertexShader)),void 0!==e.defines)for(i in e.defines)o.push(i),o.push(e.defines[i]);for(r=0;r<59;r++)o.push(n[a[r]]);return o.push(e.onBeforeCompile.toString()),o.push(t.gammaOutput),o.push(t.gammaFactor),o.join()},this.acquireProgram=function(n,i,o,a){var s,c,l,u;for(c=0,l=r.length;c1&&i.sort(ve),r.length>1&&r.sort(ye)}}}function be(){function t(n){var i=n.target;i.removeEventListener("dispose",t),e.delete(i)}var e=new WeakMap;return{get:function(n,i){var r,o=e.get(n);return void 0===o?(r=new xe,e.set(n,new WeakMap),e.get(n).set(i,r),n.addEventListener("dispose",t)):void 0===(r=o.get(i))&&(r=new xe,o.set(i,r)),r},dispose:function(){e=new WeakMap}}}function _e(){var t={};return{get:function(n){if(void 0!==t[n.id])return t[n.id];var r;switch(n.type){case"DirectionalLight":r={direction:new i,color:new x,shadow:0,shadowBias:0,shadowRadius:1,shadowMapSize:new e};break;case"SpotLight":r={position:new i,direction:new i,color:new x,distance:0,coneCos:0,penumbraCos:0,decay:0,shadow:0,shadowBias:0,shadowRadius:1,shadowMapSize:new e};break;case"PointLight":r={position:new i,color:new x,distance:0,decay:0,shadow:0,shadowBias:0,shadowRadius:1,shadowMapSize:new e,shadowCameraNear:1,shadowCameraFar:1e3};break;case"HemisphereLight":r={direction:new i,skyColor:new x,groundColor:new x};break;case"RectAreaLight":r={color:new x,position:new i,halfWidth:new i,halfHeight:new i}}return t[n.id]=r,r}}}function we(t,e){return(e.castShadow?1:0)-(t.castShadow?1:0)}function Me(){var t,e,n,r,o=new _e,a={version:0,hash:{directionalLength:-1,pointLength:-1,spotLength:-1,rectAreaLength:-1,hemiLength:-1,numDirectionalShadows:-1,numPointShadows:-1,numSpotShadows:-1},ambient:[0,0,0],probe:[],directional:[],directionalShadowMap:[],directionalShadowMatrix:[],spot:[],spotShadowMap:[],spotShadowMatrix:[],rectArea:[],point:[],pointShadowMap:[],pointShadowMatrix:[],hemi:[],numDirectionalShadows:-1,numPointShadows:-1,numSpotShadows:-1};for(t=0;t<9;t++)a.probe.push(new i);return e=new i,n=new l,r=new l,{setup:function(t,i,s){var c,l,u,h,p,d,f,m,g,v,y,x,b,_,w,M,S,T,A,L,C=0,P=0,E=0;for(c=0;c<9;c++)a.probe[c].set(0,0,0);for(l=0,u=0,h=0,p=0,d=0,f=0,m=0,g=0,v=s.matrixWorldInverse,t.sort(we),c=0,y=t.length;c0:f&&f.isGeometry&&(s=f.morphTargets&&f.morphTargets.length>0)),e.isSkinnedMesh&&n.skinning,c=e.isSkinnedMesh&&n.skinning,l=0,s&&(l|=_),c&&(l|=w),m=g[l]),t.localClippingEnabled&&1==n.clipShadows&&0!==n.clippingPlanes.length&&(u=m.uuid,h=n.uuid,void 0===(p=L[u])&&(p={},L[u]=p),void 0===(d=p[h])&&(d=m.clone(),p[h]=d),m=d),m.visible=n.visible,m.wireframe=n.wireframe,m.side=a===Bo?null!=n.shadowSide?n.shadowSide:n.side:null!=n.shadowSide?n.shadowSide:C[n.side],m.clipShadows=n.clipShadows,m.clippingPlanes=n.clippingPlanes,m.clipIntersection=n.clipIntersection,m.wireframeLinewidth=n.wireframeLinewidth,m.linewidth=n.linewidth,i.isPointLight&&m.isMeshDistanceMaterial&&(m.referencePosition.setFromMatrixPosition(i.matrixWorld),m.nearDistance=r,m.farDistance=o),m}function c(e,i,r,a,s){var l,u,h,p,d,f,m,g,y,x,b;if(0!=e.visible){if(e.layers.test(i.layers)&&(e.isMesh||e.isLine||e.isPoints)&&(e.castShadow||e.receiveShadow&&s===Bo)&&(!e.frustumCulled||v.intersectsObject(e)))if(e.modelViewMatrix.multiplyMatrices(r.matrixWorldInverse,e.matrixWorld),l=n.update(e),u=e.material,Array.isArray(u))for(p=0,d=(h=l.groups).length;pi||y.y>i)&&(y.x>i&&(x.x=Math.floor(i/_.x),y.x=x.x*_.x,m.mapSize.x=x.x),y.y>i&&(x.y=Math.floor(i/_.y),y.y=x.y*_.y,m.mapSize.y=x.y)),null!==m.map||m.isPointLightShadow||this.type!==Bo||(w={minFilter:Wa,magFilter:Wa,format:ss},m.map=new s(y.x,y.y,w),m.map.texture.name=f.name+".shadowMap",m.mapPass=new s(y.x,y.y,w),m.camera.updateProjectionMatrix()),null===m.map&&(w={minFilter:ja,magFilter:ja,format:ss},m.map=new s(y.x,y.y,w),m.map.texture.name=f.name+".shadowMap",m.camera.updateProjectionMatrix()),t.setRenderTarget(m.map),t.clear(),M=m.getViewportCount(),S=0;S=1):-1!==q.indexOf("OpenGL ES")&&(H=parseFloat(/^OpenGL\ ES\ ([0-9])/.exec(q)[1]),W=H>=2),f=null,m={},g=new a,v=new a,(y={})[3553]=r(3553,3553,1),y[34067]=r(34067,34069,6),x.setClear(0,0,0,1),b.setClear(1),_.setClear(0),s(2929),b.setFunc(va),u(0),h(zo),s(2884),l(qo),{buffers:{color:x,depth:b,stencil:_},initAttributes:function(){for(var t=0,e=M.length;ti||t.height>i)&&(l=i/Math.max(t.width,t.height)),(l<1||1==e)&&("undefined"!=typeof HTMLImageElement&&t instanceof HTMLImageElement||"undefined"!=typeof HTMLCanvasElement&&t instanceof HTMLCanvasElement||"undefined"!=typeof ImageBitmap&&t instanceof ImageBitmap)?(o=(r=e?ic.floorPowerOfTwo:Math.floor)(l*t.width),a=r(l*t.height),void 0===T&&(T=s(o,a)),(c=n?s(o,a):T).width=o,c.height=a,c.getContext("2d").drawImage(t,0,0,o,a),c):t}function l(t){return ic.isPowerOfTwo(t.width)&&ic.isPowerOfTwo(t.height)}function u(t,e){return t.generateMipmaps&&e&&t.minFilter!==ja&&t.minFilter!==Wa}function h(e,n,r,o){t.generateMipmap(e),i.get(n).__maxMipLevel=Math.log(Math.max(r,o))*Math.LOG2E}function p(t,n){if(!r.isWebGL2)return t;var i=t;return 6403===t&&(5126===n&&(i=33326),5131===n&&(i=33325),5121===n&&(i=33321)),6407===t&&(5126===n&&(i=34837),5131===n&&(i=34843),5121===n&&(i=32849)),6408===t&&(5126===n&&(i=34836),5131===n&&(i=34842),5121===n&&(i=32856)),33325!==i&&33326!==i&&34842!==i&&34836!==i||e.get("EXT_color_buffer_float"),i}function d(t){return t===ja||t===Va||t===Ga?9728:9729}function f(e){var n=e.target;n.removeEventListener("dispose",f),function(e){var n=i.get(e);void 0!==n.__webglInit&&(t.deleteTexture(n.__webglTexture),i.remove(e))}(n),n.isVideoTexture&&A.delete(n),a.memory.textures--}function m(e){var n=e.target;n.removeEventListener("dispose",m),function(e){var n,r,o=i.get(e),s=i.get(e.texture);if(e){if(void 0!==s.__webglTexture&&t.deleteTexture(s.__webglTexture),e.depthTexture&&e.depthTexture.dispose(),e.isWebGLRenderTargetCube)for(n=0;n<6;n++)t.deleteFramebuffer(o.__webglFramebuffer[n]),o.__webglDepthbuffer&&t.deleteRenderbuffer(o.__webglDepthbuffer[n]);else t.deleteFramebuffer(o.__webglFramebuffer),o.__webglDepthbuffer&&t.deleteRenderbuffer(o.__webglDepthbuffer);if(e.isWebGLMultiviewRenderTarget)for(t.deleteTexture(o.__webglColorTexture),t.deleteTexture(o.__webglDepthStencilTexture),a.memory.textures-=2,n=0,r=o.__webglViewFramebuffers.length;n0&&o.__version!==t.version)if(void 0===(r=t.image));else if(0!=r.complete)return void _(o,t,e);n.activeTexture(33984+e),n.bindTexture(3553,o.__webglTexture)}function v(e,a){var s,d,f,m,g,v,y,_,w,M,S,T,A,L;if(6===e.image.length)if(s=i.get(e),e.version>0&&s.__version!==e.version){for(b(s,e),n.activeTexture(33984+a),n.bindTexture(34067,s.__webglTexture),t.pixelStorei(37440,e.flipY),d=e&&e.isCompressedTexture,f=e.image[0]&&e.image[0].isDataTexture,m=[],g=0;g<6;g++)m[g]=d||f?f?e.image[g].image:e.image[g]:c(e.image[g],0,1,r.maxCubemapSize);if(y=l(v=m[0])||r.isWebGL2,M=p(_=o.convert(e.format),w=o.convert(e.type)),x(34067,e,y),d){for(g=0;g<6;g++)for(S=m[g].mipmaps,T=0;T-1&&n.compressedTexImage2D(34069+g,T,M,A.width,A.height,0,A.data):n.texImage2D(34069+g,T,M,A.width,A.height,0,_,w,A.data);s.__maxMipLevel=S.length-1}else{for(S=e.mipmaps,g=0;g<6;g++)if(f)for(n.texImage2D(34069+g,0,M,m[g].width,m[g].height,0,_,w,m[g].data),T=0;T1||i.get(a).__currentAnisotropy)&&(t.texParameterf(n,c.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(a.anisotropy,r.getMaxAnisotropy())),i.get(a).__currentAnisotropy=a.anisotropy)}}function b(e,n){void 0===e.__webglInit&&(e.__webglInit=1,n.addEventListener("dispose",f),e.__webglTexture=t.createTexture(),a.memory.textures++)}function _(e,i,a){var s,d,f,m,g,v,y,_,w,M,S=3553;if(i.isDataTexture2DArray&&(S=35866),i.isDataTexture3D&&(S=32879),b(e,i),n.activeTexture(33984+a),n.bindTexture(S,e.__webglTexture),t.pixelStorei(37440,i.flipY),t.pixelStorei(37441,i.premultiplyAlpha),t.pixelStorei(3317,i.unpackAlignment),s=function(t){return r.isWebGL2?0:t.wrapS!==Ba||t.wrapT!==Ba||t.minFilter!==ja&&t.minFilter!==Wa}(i)&&0==l(i.image),f=l(d=c(i.image,s,0,r.maxTextureSize))||r.isWebGL2,v=p(m=o.convert(i.format),g=o.convert(i.type)),x(S,i,f),_=i.mipmaps,i.isDepthTexture){if(v=6402,i.type===Ka){if(!r.isWebGL2)throw Error("Float Depth Texture only supported in WebGL2.0");v=36012}else r.isWebGL2&&(v=33189);i.format===us&&6402===v&&i.type!==Ja&&i.type!==Qa&&(i.type=Ja,g=o.convert(i.type)),i.format===hs&&(v=34041,i.type!==rs&&(i.type=rs,g=o.convert(i.type))),n.texImage2D(3553,0,v,d.width,d.height,0,m,g,null)}else if(i.isDataTexture)if(_.length>0&&f){for(w=0,M=_.length;w-1&&n.compressedTexImage2D(3553,w,v,y.width,y.height,0,y.data):n.texImage2D(3553,w,v,y.width,y.height,0,m,g,y.data);e.__maxMipLevel=_.length-1}else if(i.isDataTexture2DArray)n.texImage3D(35866,0,v,d.width,d.height,d.depth,0,m,g,d.data),e.__maxMipLevel=0;else if(i.isDataTexture3D)n.texImage3D(32879,0,v,d.width,d.height,d.depth,0,m,g,d.data),e.__maxMipLevel=0;else if(_.length>0&&f){for(w=0,M=_.length;w0&&r.__version!==t.version?_(r,t,e):(n.activeTexture(33984+e),n.bindTexture(35866,r.__webglTexture))},this.setTexture3D=function(t,e){var r=i.get(t);t.version>0&&r.__version!==t.version?_(r,t,e):(n.activeTexture(33984+e),n.bindTexture(32879,r.__webglTexture))},this.setTextureCube=v,this.setTextureCubeDynamic=y,this.setupRenderTarget=function(s){var c,d,f,v,y,b,_,T,A,L,C,P,E,N,O=i.get(s),D=i.get(s.texture);if(s.addEventListener("dispose",m),D.__webglTexture=t.createTexture(),a.memory.textures++,c=1==s.isWebGLRenderTargetCube,d=1==s.isWebGLMultisampleRenderTarget,f=1==s.isWebGLMultiviewRenderTarget,v=l(s)||r.isWebGL2,c)for(O.__webglFramebuffer=[],y=0;y<6;y++)O.__webglFramebuffer[y]=t.createFramebuffer();else if(O.__webglFramebuffer=t.createFramebuffer(),d)r.isWebGL2&&(O.__webglMultisampledFramebuffer=t.createFramebuffer(),O.__webglColorRenderbuffer=t.createRenderbuffer(),t.bindRenderbuffer(36161,O.__webglColorRenderbuffer),b=p(o.convert(s.texture.format),o.convert(s.texture.type)),_=S(s),t.renderbufferStorageMultisample(36161,_,b,s.width,s.height),t.bindFramebuffer(36160,O.__webglMultisampledFramebuffer),t.framebufferRenderbuffer(36160,36064,36161,O.__webglColorRenderbuffer),t.bindRenderbuffer(36161,null),s.depthBuffer&&(O.__webglDepthRenderbuffer=t.createRenderbuffer(),M(O.__webglDepthRenderbuffer,s,1)),t.bindFramebuffer(36160,null));else if(f){for(T=s.width,A=s.height,L=s.numViews,t.bindFramebuffer(36160,O.__webglFramebuffer),C=e.get("OVR_multiview2"),a.memory.textures+=2,P=t.createTexture(),t.bindTexture(35866,P),t.texParameteri(35866,10240,9728),t.texParameteri(35866,10241,9728),t.texImage3D(35866,0,32856,T,A,L,0,6408,5121,null),C.framebufferTextureMultiviewOVR(36160,36064,P,0,0,L),E=t.createTexture(),t.bindTexture(35866,E),t.texParameteri(35866,10240,9728),t.texParameteri(35866,10241,9728),t.texImage3D(35866,0,35056,T,A,L,0,34041,34042,null),C.framebufferTextureMultiviewOVR(36160,33306,E,0,0,L),N=Array(L),y=0;ym)return 0;for(n=1,i=e.length;n=0&&t.numSupportedMorphTargets++;if(t.morphNormals)for(t.numSupportedMorphNormals=0,o=0;o=0&&t.numSupportedMorphNormals++;a=h.shader.uniforms,(t.isShaderMaterial||t.isRawShaderMaterial)&&1!=t.clipping||(h.numClippingPlanes=nt.numPlanes,h.numIntersection=nt.numIntersection,a.clippingPlanes=nt.uniform),h.fog=e,h.needsLights=function(t){return t.isMeshLambertMaterial||t.isMeshPhongMaterial||t.isMeshStandardMaterial||t.isShadowMaterial||t.isShaderMaterial&&1==t.lights}(t),h.lightsStateVersion=f,h.needsLights&&(a.ambientLightColor.value=p.state.ambient,a.lightProbe.value=p.state.probe,a.directionalLights.value=p.state.directional,a.spotLights.value=p.state.spot,a.rectAreaLights.value=p.state.rectArea,a.pointLights.value=p.state.point,a.hemisphereLights.value=p.state.hemi,a.directionalShadowMap.value=p.state.directionalShadowMap,a.directionalShadowMatrix.value=p.state.directionalShadowMatrix,a.spotShadowMap.value=p.state.spotShadowMap,a.spotShadowMatrix.value=p.state.spotShadowMatrix,a.pointShadowMap.value=p.state.pointShadowMap,a.pointShadowMatrix.value=p.state.pointShadowMatrix),s=h.program.getUniforms(),l=te.seqWithValue(s.seq,a),h.uniformsList=l}function f(t,e,n,i){var r,o,a,s,c,l,u,h,p,f,y,x,b,_,w,M,S;return St.resetTextureUnits(),r=Mt.get(n),o=P.state.lights,ht&&(ft||t!==B)&&(a=t===B&&n.id===F,nt.setState(n.clippingPlanes,n.clipIntersection,n.clipShadows,t,r,a)),0==n.needsUpdate&&(void 0===r.program?n.needsUpdate=1:n.fog&&r.fog!==e?n.needsUpdate=1:r.needsLights&&r.lightsStateVersion!==o.state.version?n.needsUpdate=1:void 0===r.numClippingPlanes||r.numClippingPlanes===nt.numPlanes&&r.numIntersection===nt.numIntersection||(n.needsUpdate=1)),n.needsUpdate&&(d(n,e,i),n.needsUpdate=0),s=0,c=0,l=0,h=(u=r.program).getUniforms(),p=r.shader.uniforms,_t.useProgram(u.program)&&(s=1,c=1,l=1),n.id!==F&&(F=n.id,c=1),(s||B!==t)&&(u.numMultiviewViews>0?Ft.updateCameraProjectionMatricesUniform(t,h):h.setValue(vt,"projectionMatrix",t.projectionMatrix),bt.logarithmicDepthBuffer&&h.setValue(vt,"logDepthBufFC",2/(Math.log(t.far+1)/Math.LN2)),B!==t&&(B=t,c=1,l=1),(n.isShaderMaterial||n.isMeshPhongMaterial||n.isMeshStandardMaterial||n.envMap)&&void 0!==(f=h.map.cameraPosition)&&f.setValue(vt,gt.setFromMatrixPosition(t.matrixWorld)),(n.isMeshPhongMaterial||n.isMeshLambertMaterial||n.isMeshBasicMaterial||n.isMeshStandardMaterial||n.isShaderMaterial||n.skinning)&&(u.numMultiviewViews>0?Ft.updateCameraViewMatricesUniform(t,h):h.setValue(vt,"viewMatrix",t.matrixWorldInverse))),n.skinning&&(h.setOptional(vt,i,"bindMatrix"),h.setOptional(vt,i,"bindMatrixInverse"),(y=i.skeleton)&&(x=y.bones,bt.floatVertexTextures?(void 0===y.boneTexture&&(b=Math.sqrt(4*x.length),b=ic.ceilPowerOfTwo(b),b=Math.max(b,4),(_=new Float32Array(b*b*4)).set(y.boneMatrices),w=new J(_,b,b,ss,Ka),y.boneMatrices=_,y.boneTexture=w,y.boneTextureSize=b),h.setValue(vt,"boneTexture",y.boneTexture,St),h.setValue(vt,"boneTextureSize",y.boneTextureSize)):h.setOptional(vt,y,"boneMatrices"))),(c||r.receiveShadow!==i.receiveShadow)&&(r.receiveShadow=i.receiveShadow,h.setValue(vt,"receiveShadow",i.receiveShadow)),c&&(h.setValue(vt,"toneMappingExposure",E.toneMappingExposure),h.setValue(vt,"toneMappingWhitePoint",E.toneMappingWhitePoint),r.needsLights&&(S=l,(M=p).ambientLightColor.needsUpdate=S,M.lightProbe.needsUpdate=S,M.directionalLights.needsUpdate=S,M.pointLights.needsUpdate=S,M.spotLights.needsUpdate=S,M.rectAreaLights.needsUpdate=S,M.hemisphereLights.needsUpdate=S),e&&n.fog&&function(t,e){t.fogColor.value.copy(e.color),e.isFog?(t.fogNear.value=e.near,t.fogFar.value=e.far):e.isFogExp2&&(t.fogDensity.value=e.density)}(p,e),n.isMeshBasicMaterial?m(p,n):n.isMeshLambertMaterial?(m(p,n),function(t,e){e.emissiveMap&&(t.emissiveMap.value=e.emissiveMap)}(p,n)):n.isMeshPhongMaterial?(m(p,n),n.isMeshToonMaterial?function(t,e){g(t,e),e.gradientMap&&(t.gradientMap.value=e.gradientMap)}(p,n):g(p,n)):n.isMeshStandardMaterial?(m(p,n),n.isMeshPhysicalMaterial?function(t,e){v(t,e),t.reflectivity.value=e.reflectivity,t.clearcoat.value=e.clearcoat,t.clearcoatRoughness.value=e.clearcoatRoughness,e.sheen&&t.sheen.value.copy(e.sheen),e.clearcoatNormalMap&&(t.clearcoatNormalScale.value.copy(e.clearcoatNormalScale),t.clearcoatNormalMap.value=e.clearcoatNormalMap,e.side===jo&&t.clearcoatNormalScale.value.negate()),t.transparency.value=e.transparency}(p,n):v(p,n)):n.isMeshMatcapMaterial?(m(p,n),function(t,e){e.matcap&&(t.matcap.value=e.matcap),e.bumpMap&&(t.bumpMap.value=e.bumpMap,t.bumpScale.value=e.bumpScale,e.side===jo&&(t.bumpScale.value*=-1)),e.normalMap&&(t.normalMap.value=e.normalMap,t.normalScale.value.copy(e.normalScale),e.side===jo&&t.normalScale.value.negate()),e.displacementMap&&(t.displacementMap.value=e.displacementMap,t.displacementScale.value=e.displacementScale,t.displacementBias.value=e.displacementBias)}(p,n)):n.isMeshDepthMaterial?(m(p,n),function(t,e){e.displacementMap&&(t.displacementMap.value=e.displacementMap,t.displacementScale.value=e.displacementScale,t.displacementBias.value=e.displacementBias)}(p,n)):n.isMeshDistanceMaterial?(m(p,n),function(t,e){e.displacementMap&&(t.displacementMap.value=e.displacementMap,t.displacementScale.value=e.displacementScale,t.displacementBias.value=e.displacementBias),t.referencePosition.value.copy(e.referencePosition),t.nearDistance.value=e.nearDistance,t.farDistance.value=e.farDistance}(p,n)):n.isMeshNormalMaterial?(m(p,n),function(t,e){e.bumpMap&&(t.bumpMap.value=e.bumpMap,t.bumpScale.value=e.bumpScale,e.side===jo&&(t.bumpScale.value*=-1)),e.normalMap&&(t.normalMap.value=e.normalMap,t.normalScale.value.copy(e.normalScale),e.side===jo&&t.normalScale.value.negate()),e.displacementMap&&(t.displacementMap.value=e.displacementMap,t.displacementScale.value=e.displacementScale,t.displacementBias.value=e.displacementBias)}(p,n)):n.isLineBasicMaterial?(function(t,e){t.diffuse.value.copy(e.color),t.opacity.value=e.opacity}(p,n),n.isLineDashedMaterial&&function(t,e){t.dashSize.value=e.dashSize,t.totalSize.value=e.dashSize+e.gapSize,t.scale.value=e.scale}(p,n)):n.isPointsMaterial?function(t,e){t.diffuse.value.copy(e.color),t.opacity.value=e.opacity,t.size.value=e.size*X,t.scale.value=.5*q,t.map.value=e.map,null!==e.map&&(1==e.map.matrixAutoUpdate&&e.map.updateMatrix(),t.uvTransform.value.copy(e.map.matrix))}(p,n):n.isSpriteMaterial?function(t,e){t.diffuse.value.copy(e.color),t.opacity.value=e.opacity,t.rotation.value=e.rotation,t.map.value=e.map,null!==e.map&&(1==e.map.matrixAutoUpdate&&e.map.updateMatrix(),t.uvTransform.value.copy(e.map.matrix))}(p,n):n.isShadowMaterial&&(p.color.value.copy(n.color),p.opacity.value=n.opacity),void 0!==p.ltc_1&&(p.ltc_1.value=Jl.LTC_1),void 0!==p.ltc_2&&(p.ltc_2.value=Jl.LTC_2),te.upload(vt,r.uniformsList,p,St)),n.isShaderMaterial&&1==n.uniformsNeedUpdate&&(te.upload(vt,r.uniformsList,p,St),n.uniformsNeedUpdate=0),n.isSpriteMaterial&&h.setValue(vt,"center",i.center),u.numMultiviewViews>0?Ft.updateObjectMatricesUniforms(i,t,h):(h.setValue(vt,"modelViewMatrix",i.modelViewMatrix),h.setValue(vt,"normalMatrix",i.normalMatrix)),h.setValue(vt,"modelMatrix",i.matrixWorld),u}function m(t,e){var n;t.opacity.value=e.opacity,e.color&&t.diffuse.value.copy(e.color),e.emissive&&t.emissive.value.copy(e.emissive).multiplyScalar(e.emissiveIntensity),e.map&&(t.map.value=e.map),e.alphaMap&&(t.alphaMap.value=e.alphaMap),e.specularMap&&(t.specularMap.value=e.specularMap),e.envMap&&(t.envMap.value=e.envMap,t.flipEnvMap.value=e.envMap.isCubeTexture?-1:1,t.reflectivity.value=e.reflectivity,t.refractionRatio.value=e.refractionRatio,t.maxMipLevel.value=Mt.get(e.envMap).__maxMipLevel),e.lightMap&&(t.lightMap.value=e.lightMap,t.lightMapIntensity.value=e.lightMapIntensity),e.aoMap&&(t.aoMap.value=e.aoMap,t.aoMapIntensity.value=e.aoMapIntensity),e.map?n=e.map:e.specularMap?n=e.specularMap:e.displacementMap?n=e.displacementMap:e.normalMap?n=e.normalMap:e.bumpMap?n=e.bumpMap:e.roughnessMap?n=e.roughnessMap:e.metalnessMap?n=e.metalnessMap:e.alphaMap?n=e.alphaMap:e.emissiveMap&&(n=e.emissiveMap),void 0!==n&&(n.isWebGLRenderTarget&&(n=n.texture),1==n.matrixAutoUpdate&&n.updateMatrix(),t.uvTransform.value.copy(n.matrix))}function g(t,e){t.specular.value.copy(e.specular),t.shininess.value=Math.max(e.shininess,1e-4),e.emissiveMap&&(t.emissiveMap.value=e.emissiveMap),e.bumpMap&&(t.bumpMap.value=e.bumpMap,t.bumpScale.value=e.bumpScale,e.side===jo&&(t.bumpScale.value*=-1)),e.normalMap&&(t.normalMap.value=e.normalMap,t.normalScale.value.copy(e.normalScale),e.side===jo&&t.normalScale.value.negate()),e.displacementMap&&(t.displacementMap.value=e.displacementMap,t.displacementScale.value=e.displacementScale,t.displacementBias.value=e.displacementBias)}function v(t,e){t.roughness.value=e.roughness,t.metalness.value=e.metalness,e.roughnessMap&&(t.roughnessMap.value=e.roughnessMap),e.metalnessMap&&(t.metalnessMap.value=e.metalnessMap),e.emissiveMap&&(t.emissiveMap.value=e.emissiveMap),e.bumpMap&&(t.bumpMap.value=e.bumpMap,t.bumpScale.value=e.bumpScale,e.side===jo&&(t.bumpScale.value*=-1)),e.normalMap&&(t.normalMap.value=e.normalMap,t.normalScale.value.copy(e.normalScale),e.side===jo&&t.normalScale.value.negate()),e.displacementMap&&(t.displacementMap.value=e.displacementMap,t.displacementScale.value=e.displacementScale,t.displacementBias.value=e.displacementBias),e.envMap&&(t.envMapIntensity.value=e.envMapIntensity)}var y,x,b,_,w,M,S,T,A,L,C,P,E,N,O,D,I,z,R,F,k,B,U,j,V,W,H,q,X,Y,Z,$,et,nt,ht,ft,mt,gt,vt,yt,xt,bt,_t,wt,Mt,St,Tt,At,Lt,Ct,Pt,Et,Nt,Ot,Dt,It,zt,Rt,Ft,kt,Bt,Ut;y=void 0!==(t=t||{}).canvas?t.canvas:document.createElementNS("http://www.w3.org/1999/xhtml","canvas"),x=void 0!==t.context?t.context:null,b=void 0!==t.alpha?t.alpha:0,_=void 0!==t.depth?t.depth:1,w=void 0!==t.stencil?t.stencil:1,M=void 0!==t.antialias?t.antialias:0,S=void 0!==t.premultipliedAlpha?t.premultipliedAlpha:1,T=void 0!==t.preserveDrawingBuffer?t.preserveDrawingBuffer:0,A=void 0!==t.powerPreference?t.powerPreference:"default",L=void 0!==t.failIfMajorPerformanceCaveat?t.failIfMajorPerformanceCaveat:0,C=null,P=null,this.domElement=y,this.debug={checkShaderErrors:1},this.autoClear=1,this.autoClearColor=1,this.autoClearDepth=1,this.autoClearStencil=1,this.sortObjects=1,this.clippingPlanes=[],this.localClippingEnabled=0,this.gammaFactor=2,this.gammaInput=0,this.gammaOutput=0,this.physicallyCorrectLights=0,this.toneMapping=Aa,this.toneMappingExposure=1,this.toneMappingWhitePoint=1,this.maxMorphTargets=8,this.maxMorphNormals=4,E=this,N=0,O=null,D=0,I=0,z=null,R=null,F=-1,k={geometry:null,program:null,wireframe:0},B=null,U=null,j=new a,V=new a,W=null,H=y.width,q=y.height,X=1,Y=new a(0,0,H,q),Z=new a(0,0,H,q),$=0,et=new Q,nt=new at,ht=0,ft=0,mt=new l,gt=new i;try{if(yt={alpha:b,depth:_,stencil:w,antialias:M,premultipliedAlpha:S,preserveDrawingBuffer:T,powerPreference:A,failIfMajorPerformanceCaveat:L,xrCompatible:1},y.addEventListener("webglcontextlost",o,0),y.addEventListener("webglcontextrestored",s,0),null===(vt=x||y.getContext("webgl",yt)||y.getContext("experimental-webgl",yt)))throw null!==y.getContext("webgl")?Error("Error creating WebGL context with your selected attributes."):Error("Error creating WebGL context.");void 0===vt.getShaderPrecisionFormat&&(vt.getShaderPrecisionFormat=function(){return{rangeMin:1,rangeMax:1,precision:1}})}catch(t){throw t}r(),Rt="undefined"!=typeof navigator&&"xr"in navigator&&"supportsSession"in navigator.xr?new ke(E,vt):new Fe(E),this.vr=Rt,Ft=new De(E,vt),kt=new Ce(E,Lt,bt.maxTextureSize),this.shadowMap=kt,this.getContext=function(){return vt},this.getContextAttributes=function(){return vt.getContextAttributes()},this.forceContextLoss=function(){var t=xt.get("WEBGL_lose_context");t&&t.loseContext()},this.forceContextRestore=function(){var t=xt.get("WEBGL_lose_context");t&&t.restoreContext()},this.getPixelRatio=function(){return X},this.setPixelRatio=function(t){void 0!==t&&(X=t,this.setSize(H,q,0))},this.getSize=function(t){return void 0===t&&(t=new e),t.set(H,q)},this.setSize=function(t,e,n){Rt.isPresenting()||(H=t,q=e,y.width=Math.floor(t*X),y.height=Math.floor(e*X),0!=n&&(y.style.width=t+"px",y.style.height=e+"px"),this.setViewport(0,0,t,e))},this.getDrawingBufferSize=function(t){return void 0===t&&(t=new e),t.set(H*X,q*X).floor()},this.setDrawingBufferSize=function(t,e,n){H=t,q=e,X=n,y.width=Math.floor(t*n),y.height=Math.floor(e*n),this.setViewport(0,0,t,e)},this.getCurrentViewport=function(t){return void 0===t&&(t=new a),t.copy(j)},this.getViewport=function(t){return t.copy(Y)},this.setViewport=function(t,e,n,i){t.isVector4?Y.set(t.x,t.y,t.z,t.w):Y.set(t,e,n,i),_t.viewport(j.copy(Y).multiplyScalar(X).floor())},this.getScissor=function(t){return t.copy(Z)},this.setScissor=function(t,e,n,i){t.isVector4?Z.set(t.x,t.y,t.z,t.w):Z.set(t,e,n,i),_t.scissor(V.copy(Z).multiplyScalar(X).floor())},this.getScissorTest=function(){return $},this.setScissorTest=function(t){_t.setScissorTest($=t)},this.getClearColor=function(){return Nt.getClearColor()},this.setClearColor=function(){Nt.setClearColor.apply(Nt,arguments)},this.getClearAlpha=function(){return Nt.getClearAlpha()},this.setClearAlpha=function(){Nt.setClearAlpha.apply(Nt,arguments)},this.clear=function(t,e,n){var i=0;(void 0===t||t)&&(i|=16384),(void 0===e||e)&&(i|=256),(void 0===n||n)&&(i|=1024),vt.clear(i)},this.clearColor=function(){this.clear(1,0,0)},this.clearDepth=function(){this.clear(0,1,0)},this.clearStencil=function(){this.clear(0,0,1)},this.dispose=function(){y.removeEventListener("webglcontextlost",o,0),y.removeEventListener("webglcontextrestored",s,0),Pt.dispose(),Et.dispose(),Mt.dispose(),Lt.dispose(),Rt.dispose(),Ut.stop()},this.renderBufferImmediate=function(t,e){var n,i;_t.initAttributes(),n=Mt.get(t),t.hasPositions&&!n.position&&(n.position=vt.createBuffer()),t.hasNormals&&!n.normal&&(n.normal=vt.createBuffer()),t.hasUvs&&!n.uv&&(n.uv=vt.createBuffer()),t.hasColors&&!n.color&&(n.color=vt.createBuffer()),i=e.getAttributes(),t.hasPositions&&(vt.bindBuffer(34962,n.position),vt.bufferData(34962,t.positionArray,35048),_t.enableAttribute(i.position),vt.vertexAttribPointer(i.position,3,5126,0,0,0)),t.hasNormals&&(vt.bindBuffer(34962,n.normal),vt.bufferData(34962,t.normalArray,35048),_t.enableAttribute(i.normal),vt.vertexAttribPointer(i.normal,3,5126,0,0,0)),t.hasUvs&&(vt.bindBuffer(34962,n.uv),vt.bufferData(34962,t.uvArray,35048),_t.enableAttribute(i.uv),vt.vertexAttribPointer(i.uv,2,5126,0,0,0)),t.hasColors&&(vt.bindBuffer(34962,n.color),vt.bufferData(34962,t.colorArray,35048),_t.enableAttribute(i.color),vt.vertexAttribPointer(i.color,3,5126,0,0,0)),_t.disableUnusedAttributes(),vt.drawArrays(4,0,t.count),t.count=0},this.renderBufferDirect=function(t,e,i,r,o,a){var s,c,l,u,h,p,d,m,g,v,y,x,b,_,w,M=o.isMesh&&o.matrixWorld.determinant()<0;if(_t.setMaterial(r,M),s=f(t,e,r,o),c=0,k.geometry===i.id&&k.program===s.id&&k.wireframe===(1==r.wireframe)||(k.geometry=i.id,k.program=s.id,k.wireframe=1==r.wireframe,c=1),o.morphTargetInfluences&&(Ot.update(o,i,r,s),c=1),l=i.index,u=i.attributes.position,h=1,1==r.wireframe&&(l=At.getWireframeAttribute(i),h=2),d=Dt,null!==l&&(p=Tt.get(l),(d=It).setIndex(p)),c&&(function(t,e,n,i){var r,o,a,s,c,l,u,h,p,d,f,m,g,v,y,x;if(0!=bt.isWebGL2||!t.isInstancedMesh&&!e.isInstancedBufferGeometry||null!==xt.get("ANGLE_instanced_arrays")){for(s in _t.initAttributes(),r=e.attributes,o=i.getAttributes(),a=n.defaultAttributeValues,o)if((c=o[s])>=0)if(void 0!==(l=r[s])){if(u=l.normalized,h=l.itemSize,void 0===(p=Tt.get(l)))continue;d=p.buffer,f=p.type,m=p.bytesPerElement,l.isInterleavedBufferAttribute?(v=(g=l.data).stride,y=l.offset,g&&g.isInstancedInterleavedBuffer?(_t.enableAttributeAndDivisor(c,g.meshPerAttribute),void 0===e.maxInstancedCount&&(e.maxInstancedCount=g.meshPerAttribute*g.count)):_t.enableAttribute(c),vt.bindBuffer(34962,d),vt.vertexAttribPointer(c,h,f,u,v*m,y*m)):(l.isInstancedBufferAttribute?(_t.enableAttributeAndDivisor(c,l.meshPerAttribute),void 0===e.maxInstancedCount&&(e.maxInstancedCount=l.meshPerAttribute*l.count)):_t.enableAttribute(c),vt.bindBuffer(34962,d),vt.vertexAttribPointer(c,h,f,u,0,0))}else if("instanceMatrix"===s){if(void 0===(p=Tt.get(t.instanceMatrix)))continue;d=p.buffer,f=p.type,_t.enableAttributeAndDivisor(c+0,1),_t.enableAttributeAndDivisor(c+1,1),_t.enableAttributeAndDivisor(c+2,1),_t.enableAttributeAndDivisor(c+3,1),vt.bindBuffer(34962,d),vt.vertexAttribPointer(c+0,4,f,0,64,0),vt.vertexAttribPointer(c+1,4,f,0,64,16),vt.vertexAttribPointer(c+2,4,f,0,64,32),vt.vertexAttribPointer(c+3,4,f,0,64,48)}else if(void 0!==a&&void 0!==(x=a[s]))switch(x.length){case 2:vt.vertexAttrib2fv(c,x);break;case 3:vt.vertexAttrib3fv(c,x);break;case 4:vt.vertexAttrib4fv(c,x);break;default:vt.vertexAttrib1fv(c,x)}_t.disableUnusedAttributes()}}(o,i,r,s),null!==l&&vt.bindBuffer(34963,p.buffer)),m=1/0,null!==l?m=l.count:void 0!==u&&(m=u.count),g=i.drawRange.start*h,v=i.drawRange.count*h,y=null!==a?a.start*h:0,x=null!==a?a.count*h:1/0,b=Math.max(g,y),0!==(_=Math.max(0,Math.min(m,g+v,y+x)-1-b+1))){if(o.isMesh)if(1==r.wireframe)_t.setLineWidth(r.wireframeLinewidth*n()),d.setMode(1);else switch(o.drawMode){case ks:d.setMode(4);break;case Bs:d.setMode(5);break;case Us:d.setMode(6)}else o.isLine?(void 0===(w=r.linewidth)&&(w=1),_t.setLineWidth(w*n()),o.isLineSegments?d.setMode(1):o.isLineLoop?d.setMode(2):d.setMode(3)):o.isPoints?d.setMode(0):o.isSprite&&d.setMode(4);o.isInstancedMesh?d.renderInstances(i,b,_,o.count):i.isInstancedBufferGeometry?d.renderInstances(i,b,_,i.maxInstancedCount):d.render(b,_)}},this.compile=function(t,e){(P=Et.get(t,e)).init(),t.traverse(function(t){t.isLight&&(P.pushLight(t),t.castShadow&&P.pushShadow(t))}),P.setupLights(e),t.traverse(function(e){if(e.material)if(Array.isArray(e.material))for(var n=0;n=0&&e<=t.width-i&&n>=0&&n<=t.height-r&&vt.readPixels(e,n,i,r,zt.convert(u),zt.convert(h),o)}finally{c&&vt.bindFramebuffer(36160,R)}}},this.copyFramebufferToTexture=function(t,e,n){var i=e.image.width,r=e.image.height,o=zt.convert(e.format);St.setTexture2D(e,0),vt.copyTexImage2D(3553,n||0,o,t.x,t.y,i,r,0)},this.copyTextureToTexture=function(t,e,n,i){var r=e.image.width,o=e.image.height,a=zt.convert(n.format),s=zt.convert(n.type);St.setTexture2D(n,0),e.isDataTexture?vt.texSubImage2D(3553,i||0,t.x,t.y,r,o,a,s,e.image.data):vt.texSubImage2D(3553,i||0,t.x,t.y,a,s,e.image)},"undefined"!=typeof __THREE_DEVTOOLS__&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}function Ue(t,e){this.name="",this.color=new x(t),this.density=void 0!==e?e:25e-5}function je(t,e,n){this.name="",this.color=new x(t),this.near=void 0!==e?e:1,this.far=void 0!==n?n:1e3}function Ve(t,e){this.array=t,this.stride=e,this.count=void 0!==t?t.length/e:0,this.dynamic=0,this.updateRange={offset:0,count:-1},this.version=0}function Ge(t,e,n,i){this.data=t,this.itemSize=e,this.offset=n,this.normalized=1==i}function We(t){S.call(this),this.type="SpriteMaterial",this.color=new x(16777215),this.map=null,this.rotation=0,this.sizeAttenuation=1,this.transparent=1,this.setValues(t)}function He(t){var n;p.call(this),this.type="Sprite",void 0===gu&&(gu=new k,n=new Ve(new Float32Array([-.5,-.5,0,0,0,.5,-.5,0,1,0,.5,.5,0,1,1,-.5,.5,0,0,1]),5),gu.setIndex([0,1,2,0,2,3]),gu.addAttribute("position",new Ge(n,3,0,0)),gu.addAttribute("uv",new Ge(n,2,3,0))),this.geometry=gu,this.material=void 0!==t?t:new We,this.center=new e(.5,.5)}function qe(t,e,n,i,r,o){bu.subVectors(t,n).addScalar(.5).multiply(i),void 0!==r?(_u.x=o*bu.x-r*bu.y,_u.y=r*bu.x+o*bu.y):_u.copy(bu),t.copy(e),t.x+=_u.x,t.y+=_u.y,t.applyMatrix4(wu)}function Xe(){p.call(this),this.type="LOD",Object.defineProperties(this,{levels:{enumerable:1,value:[]}}),this.autoUpdate=1}function Ye(t,e){t&&t.isGeometry,B.call(this,t,e),this.type="SkinnedMesh",this.bindMode="attached",this.bindMatrix=new l,this.bindMatrixInverse=new l}function Ze(t,e){if(t=t||[],this.bones=t.slice(0),this.boneMatrices=new Float32Array(16*this.bones.length),this.frame=-1,void 0===e)this.calculateInverses();else if(this.bones.length===e.length)this.boneInverses=e.slice(0);else{this.boneInverses=[];for(var n=0,i=this.bones.length;no.far)return;a.push({distance:l,distanceToRay:Math.sqrt(u),point:c,index:e,face:null,object:s})}}function an(t,e,n,i,r,a,s,c,l){o.call(this,t,e,n,i,r,a,s,c,l),this.format=void 0!==s?s:as,this.minFilter=void 0!==a?a:Wa,this.magFilter=void 0!==r?r:Wa,this.generateMipmaps=0}function sn(t,e,n,i,r,a,s,c,l,u,h,p){o.call(this,null,a,s,c,l,u,i,r,h,p),this.image={width:e,height:n},this.mipmaps=t,this.flipY=0,this.generateMipmaps=0}function cn(t,e,n,i,r,a,s,c,l){o.call(this,t,e,n,i,r,a,s,c,l),this.needsUpdate=1}function ln(t,e,n,i,r,a,s,c,l,u){if((u=void 0!==u?u:us)!==us&&u!==hs)throw Error("DepthTexture format must be either THREE.DepthFormat or THREE.DepthStencilFormat");void 0===n&&u===us&&(n=Ja),void 0===n&&u===hs&&(n=rs),o.call(this,null,i,r,a,s,c,u,n,l),this.image={width:t,height:e},this.magFilter=void 0!==s?s:ja,this.minFilter=void 0!==c?c:ja,this.flipY=0,this.generateMipmaps=0}function un(t){var e,n,r,o,a,s,c,l,u,h,p,d,f,m,g,v,y,x,b,_,w,M,S;if(k.call(this),this.type="WireframeGeometry",e=[],c=[0,0],l={},f=["a","b","c"],t&&t.isGeometry){for(n=0,o=(g=t.faces).length;n=0?(t(v-1e-5,g,u),h.subVectors(l,u)):(t(v+1e-5,g,u),h.subVectors(u,l)),g-1e-5>=0?(t(v,g-1e-5,u),p.subVectors(l,u)):(t(v,g+1e-5,u),p.subVectors(u,l)),c.crossVectors(h,p).normalize(),a.push(c.x,c.y,c.z),s.push(v,g);for(d=0;d.9&&Math.min(e,n,i)<.1&&(e<.2&&(p[t+0]+=1),n<.2&&(p[t+2]+=1),i<.2&&(p[t+4]+=1))}()}(),this.addAttribute("position",new I(h,3)),this.addAttribute("normal",new I(h.slice(),3)),this.addAttribute("uv",new I(p,2)),0===o?this.computeVertexNormals():this.normalizeNormals()}function mn(t,e){V.call(this),this.type="TetrahedronGeometry",this.parameters={radius:t,detail:e},this.fromBufferGeometry(new gn(t,e)),this.mergeVertices()}function gn(t,e){fn.call(this,[1,1,1,-1,-1,1,-1,1,-1,1,-1,-1],[2,1,0,0,3,2,1,3,0,2,3,1],t,e),this.type="TetrahedronBufferGeometry",this.parameters={radius:t,detail:e}}function vn(t,e){V.call(this),this.type="OctahedronGeometry",this.parameters={radius:t,detail:e},this.fromBufferGeometry(new yn(t,e)),this.mergeVertices()}function yn(t,e){fn.call(this,[1,0,0,-1,0,0,0,1,0,0,-1,0,0,0,1,0,0,-1],[0,2,4,0,4,3,0,3,5,0,5,2,1,2,5,1,5,3,1,3,4,1,4,2],t,e),this.type="OctahedronBufferGeometry",this.parameters={radius:t,detail:e}}function xn(t,e){V.call(this),this.type="IcosahedronGeometry",this.parameters={radius:t,detail:e},this.fromBufferGeometry(new bn(t,e)),this.mergeVertices()}function bn(t,e){var n=1.618033988749895,i=[-1,n,0,1,n,0,-1,-n,0,1,-n,0,0,-1,n,0,1,n,0,-1,-n,0,1,-n,n,0,-1,n,0,1,-n,0,-1,-n,0,1];fn.call(this,i,[0,11,5,0,5,1,0,1,7,0,7,10,0,10,11,1,5,9,5,11,4,11,10,2,10,7,6,7,1,8,3,9,4,3,4,2,3,2,6,3,6,8,3,8,9,4,9,5,2,4,11,6,2,10,8,6,7,9,8,1],t,e),this.type="IcosahedronBufferGeometry",this.parameters={radius:t,detail:e}}function _n(t,e){V.call(this),this.type="DodecahedronGeometry",this.parameters={radius:t,detail:e},this.fromBufferGeometry(new wn(t,e)),this.mergeVertices()}function wn(t,e){var n=1.618033988749895,i=1/n,r=[-1,-1,-1,-1,-1,1,-1,1,-1,-1,1,1,1,-1,-1,1,-1,1,1,1,-1,1,1,1,0,-i,-n,0,-i,n,0,i,-n,0,i,n,-i,-n,0,-i,n,0,i,-n,0,i,n,0,-n,0,-i,n,0,-i,-n,0,i,n,0,i];fn.call(this,r,[3,11,7,3,7,15,3,15,13,7,19,17,7,17,6,7,6,15,17,4,8,17,8,10,17,10,6,8,0,16,8,16,2,8,2,10,0,12,1,0,1,18,0,18,16,6,10,2,6,2,13,6,13,15,2,16,18,2,18,3,2,3,13,18,1,9,18,9,11,18,11,3,4,14,12,4,12,0,4,0,8,11,9,5,11,5,19,11,19,7,19,5,14,19,14,4,19,4,17,1,12,14,1,14,5,1,5,9],t,e),this.type="DodecahedronBufferGeometry",this.parameters={radius:t,detail:e}}function Mn(t,e,n,i,r){V.call(this),this.type="TubeGeometry",this.parameters={path:t,tubularSegments:e,radius:n,radialSegments:i,closed:r};var o=new Sn(t,e,n,i,r);this.tangents=o.tangents,this.normals=o.normals,this.binormals=o.binormals,this.fromBufferGeometry(o),this.mergeVertices()}function Sn(t,n,r,o,a){function s(e){var i,a,s,h,d;for(p=t.getPointAt(e/n,p),i=c.normals[e],a=c.binormals[e],f=0;f<=o;f++)h=Math.sin(s=f/o*Math.PI*2),d=-Math.cos(s),u.x=d*i.x+h*a.x,u.y=d*i.y+h*a.y,u.z=d*i.z+h*a.z,u.normalize(),g.push(u.x,u.y,u.z),l.x=p.x+r*u.x,l.y=p.y+r*u.y,l.z=p.z+r*u.z,m.push(l.x,l.y,l.z)}var c,l,u,h,p,d,f,m,g,v,y;k.call(this),this.type="TubeBufferGeometry",this.parameters={path:t,tubularSegments:n,radius:r,radialSegments:o,closed:a},n=n||64,r=r||1,o=o||8,a=a||0,c=t.computeFrenetFrames(n,a),this.tangents=c.tangents,this.normals=c.normals,this.binormals=c.binormals,l=new i,u=new i,h=new e,p=new i,m=[],g=[],v=[],y=[],function(){for(d=0;d0)for(o=e;o=e;o-=i)a=Xn(o,t[o],t[o+1],a);return a&&Gn(a,a.next)&&(Yn(a),a=a.next),a}function En(t,e){if(!t)return t;e||(e=t);var n,i=t;do{if(n=0,i.steiner||!Gn(i,i.next)&&0!==Vn(i.prev,i,i.next))i=i.next;else{if(Yn(i),(i=e=i.prev)===i.next)break;n=1}}while(n||i!==e);return e}function Nn(t,e,n,i,r,o,a){if(t){!a&&o&&function(t,e,n,i){var r=t;do{null===r.z&&(r.z=kn(r.x,r.y,e,n,i)),r.prevZ=r.prev,r.nextZ=r.next,r=r.next}while(r!==t);r.prevZ.nextZ=null,r.prevZ=null,function(t){var e,n,i,r,o,a,s,c,l=1;do{for(n=t,t=null,o=null,a=0;n;){for(a++,i=n,s=0,e=0;e0||c>0&&i;)0!==s&&(0===c||!i||n.z<=i.z)?(r=n,n=n.nextZ,s--):(r=i,i=i.nextZ,c--),o?o.nextZ=r:t=r,r.prevZ=o,o=r;n=i}o.nextZ=null,l*=2}while(a>1)}(r)}(t,i,r,o);for(var s,c,l=t;t.prev!==t.next;)if(s=t.prev,c=t.next,o?Dn(t,i,r,o):On(t))e.push(s.i/n),e.push(t.i/n),e.push(c.i/n),Yn(t),t=c.next,l=c.next;else if((t=c)===l){a?1===a?Nn(t=In(t,e,n),e,n,i,r,o,2):2===a&&zn(t,e,n,i,r,o):Nn(En(t),e,n,i,r,o,1);break}}}function On(t){var e,n=t.prev,i=t,r=t.next;if(Vn(n,i,r)>=0)return 0;for(e=t.next.next;e!==t.prev;){if(Un(n.x,n.y,i.x,i.y,r.x,r.y,e.x,e.y)&&Vn(e.prev,e,e.next)>=0)return 0;e=e.next}return 1}function Dn(t,e,n,i){var r,o,a,s,c,l,u,h,p=t.prev,d=t,f=t.next;if(Vn(p,d,f)>=0)return 0;for(r=p.xd.x?p.x>f.x?p.x:f.x:d.x>f.x?d.x:f.x,s=p.y>d.y?p.y>f.y?p.y:f.y:d.y>f.y?d.y:f.y,c=kn(r,o,e,n,i),l=kn(a,s,e,n,i),u=t.prevZ,h=t.nextZ;u&&u.z>=c&&h&&h.z<=l;){if(u!==t.prev&&u!==t.next&&Un(p.x,p.y,d.x,d.y,f.x,f.y,u.x,u.y)&&Vn(u.prev,u,u.next)>=0)return 0;if(u=u.prevZ,h!==t.prev&&h!==t.next&&Un(p.x,p.y,d.x,d.y,f.x,f.y,h.x,h.y)&&Vn(h.prev,h,h.next)>=0)return 0;h=h.nextZ}for(;u&&u.z>=c;){if(u!==t.prev&&u!==t.next&&Un(p.x,p.y,d.x,d.y,f.x,f.y,u.x,u.y)&&Vn(u.prev,u,u.next)>=0)return 0;u=u.prevZ}for(;h&&h.z<=l;){if(h!==t.prev&&h!==t.next&&Un(p.x,p.y,d.x,d.y,f.x,f.y,h.x,h.y)&&Vn(h.prev,h,h.next)>=0)return 0;h=h.nextZ}return 1}function In(t,e,n){var i,r,o=t;do{!Gn(i=o.prev,r=o.next.next)&&Wn(i,o,o.next,r)&&Hn(i,r)&&Hn(r,i)&&(e.push(i.i/n),e.push(o.i/n),e.push(r.i/n),Yn(o),Yn(o.next),o=t=r),o=o.next}while(o!==t);return o}function zn(t,e,n,i,r,o){var a,s,c=t;do{for(a=c.next.next;a!==c.prev;){if(c.i!==a.i&&jn(c,a))return s=qn(c,a),c=En(c,c.next),s=En(s,s.next),Nn(c,e,n,i,r,o),void Nn(s,e,n,i,r,o);a=a.next}c=c.next}while(c!==t)}function Rn(t,e){return t.x-e.x}function Fn(t,e){if(e=function(t,e){var n,i,r,o,a,s,c,l=e,u=t.x,h=t.y,p=-1/0;do{if(h<=l.y&&h>=l.next.y&&l.next.y!==l.y&&(i=l.x+(h-l.y)*(l.next.x-l.x)/(l.next.y-l.y))<=u&&i>p){if(p=i,i===u){if(h===l.y)return l;if(h===l.next.y)return l.next}n=l.x=l.x&&l.x>=o&&u!==l.x&&Un(hn.x)&&Hn(l,t)&&(n=l,s=c),l=l.next;return n}(t,e)){var n=qn(e,t);En(n,n.next)}}function kn(t,e,n,i,r){return(t=1431655765&((t=858993459&((t=252645135&((t=16711935&((t=32767*(t-n)*r)|t<<8))|t<<4))|t<<2))|t<<1))|(e=1431655765&((e=858993459&((e=252645135&((e=16711935&((e=32767*(e-i)*r)|e<<8))|e<<4))|e<<2))|e<<1))<<1}function Bn(t){var e=t,n=t;do{(e.x=0&&(t-a)*(i-s)-(n-a)*(e-s)>=0&&(n-a)*(o-s)-(r-a)*(i-s)>=0}function jn(t,e){return t.next.i!==e.i&&t.prev.i!==e.i&&!function(t,e){var n=t;do{if(n.i!==t.i&&n.next.i!==t.i&&n.i!==e.i&&n.next.i!==e.i&&Wn(n,n.next,t,e))return 1;n=n.next}while(n!==t);return 0}(t,e)&&Hn(t,e)&&Hn(e,t)&&function(t,e){var n=t,i=0,r=(t.x+e.x)/2,o=(t.y+e.y)/2;do{n.y>o!=n.next.y>o&&n.next.y!==n.y&&r<(n.next.x-n.x)*(o-n.y)/(n.next.y-n.y)+n.x&&(i=!i),n=n.next}while(n!==t);return i}(t,e)}function Vn(t,e,n){return(e.y-t.y)*(n.x-e.x)-(e.x-t.x)*(n.y-e.y)}function Gn(t,e){return t.x===e.x&&t.y===e.y}function Wn(t,e,n,i){return Gn(t,n)&&Gn(e,i)||Gn(t,i)&&Gn(n,e)?1:Vn(t,e,n)>0!=Vn(t,e,i)>0&&Vn(n,i,t)>0!=Vn(n,i,e)>0}function Hn(t,e){return Vn(t.prev,t,t.next)<0?Vn(t,e,t.next)>=0&&Vn(t,t.prev,e)>=0:Vn(t,e,t.prev)<0||Vn(t,t.next,e)<0}function qn(t,e){var n=new Zn(t.i,t.x,t.y),i=new Zn(e.i,e.x,e.y),r=t.next,o=e.prev;return t.next=e,e.prev=t,n.next=r,r.prev=n,i.next=n,n.prev=i,o.next=i,i.prev=o,i}function Xn(t,e,n,i){var r=new Zn(t,e,n);return i?(r.next=i.next,r.prev=i,i.next.prev=r,i.next=r):(r.prev=r,r.next=r),r}function Yn(t){t.next.prev=t.prev,t.prev.next=t.next,t.prevZ&&(t.prevZ.nextZ=t.nextZ),t.nextZ&&(t.nextZ.prevZ=t.prevZ)}function Zn(t,e,n){this.i=t,this.x=e,this.y=n,this.prev=null,this.next=null,this.z=null,this.prevZ=null,this.nextZ=null,this.steiner=0}function Jn(t){var e=t.length;e>2&&t[e-1].equals(t[0])&&t.pop()}function $n(t,e){for(var n=0;nNumber.EPSILON){if(s=Math.sqrt(y),c=Math.sqrt(g*g+v*v),l=n.x-m/s,u=n.y+f/s,(p=(r=l+f*(h=((i.x-v/c-l)*v-(i.y+g/c-u)*g)/(f*v-m*g))-t.x)*r+(o=u+m*h-t.y)*o)<=2)return new e(r,o);a=Math.sqrt(p/2)}else d=0,f>Number.EPSILON?g>Number.EPSILON&&(d=1):f<-Number.EPSILON?g<-Number.EPSILON&&(d=1):Math.sign(m)===Math.sign(v)&&(d=1),d?(r=-m,o=f,a=Math.sqrt(y)):(r=f,o=m,a=Math.sqrt(y/2));return new e(r/a,o/a)}function l(t,e){var n,i,r,o,a,s;for(k=t.length;--k>=0;)for(n=k,(i=k-1)<0&&(i=t.length-1),r=0,o=Y+2*tt,r=0;r=0;P--){for(O=$*Math.cos((N=P/tt)*Math.PI/2),E=Q*Math.sin(N*Math.PI/2)+K,k=0,B=C.length;k0)&&m.push(M,S,A),(u!==n-1||c0&&u(1),n>0&&u(0)),this.setIndex(p),this.addAttribute("position",new I(d,3)),this.addAttribute("normal",new I(f,3)),this.addAttribute("uv",new I(m,2))}function mi(t,e,n,i,r,o,a){di.call(this,0,t,e,n,i,r,o,a),this.type="ConeGeometry",this.parameters={radius:t,height:e,radialSegments:n,heightSegments:i,openEnded:r,thetaStart:o,thetaLength:a}}function gi(t,e,n,i,r,o,a){fi.call(this,0,t,e,n,i,r,o,a),this.type="ConeBufferGeometry",this.parameters={radius:t,height:e,radialSegments:n,heightSegments:i,openEnded:r,thetaStart:o,thetaLength:a}}function vi(t,e,n,i){V.call(this),this.type="CircleGeometry",this.parameters={radius:t,segments:e,thetaStart:n,thetaLength:i},this.fromBufferGeometry(new yi(t,e,n,i)),this.mergeVertices()}function yi(t,n,r,o){var a,s,c,l,u,h,p,d,f;for(k.call(this),this.type="CircleBufferGeometry",this.parameters={radius:t,segments:n,thetaStart:r,thetaLength:o},t=t||1,n=void 0!==n?Math.max(3,n):8,r=void 0!==r?r:0,o=void 0!==o?o:2*Math.PI,a=[],s=[],c=[],l=[],p=new i,d=new e,s.push(0,0,0),c.push(0,0,1),l.push(.5,.5),h=0,u=3;h<=n;h++,u+=3)f=r+h/n*o,p.x=t*Math.cos(f),p.y=t*Math.sin(f),s.push(p.x,p.y,p.z),c.push(0,0,1),d.x=(s[u]/t+1)/2,d.y=(s[u+1]/t+1)/2,l.push(d.x,d.y);for(u=1;u<=n;u++)a.push(u,u+1,0);this.setIndex(a),this.addAttribute("position",new I(s,3)),this.addAttribute("normal",new I(c,3)),this.addAttribute("uv",new I(l,2))}function xi(t){S.call(this),this.type="ShadowMaterial",this.color=new x(0),this.transparent=1,this.setValues(t)}function bi(t){H.call(this,t),this.type="RawShaderMaterial"}function _i(t){S.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.normalMapType=$s,this.normalScale=new e(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=0,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.skinning=0,this.morphTargets=0,this.morphNormals=0,this.setValues(t)}function wi(t){_i.call(this),this.defines={STANDARD:"",PHYSICAL:""},this.type="MeshPhysicalMaterial",this.reflectivity=.5,this.clearcoat=0,this.clearcoatRoughness=0,this.sheen=null,this.clearcoatNormalScale=new e(1,1),this.clearcoatNormalMap=null,this.transparency=0,this.setValues(t)}function Mi(t){S.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.normalMapType=$s,this.normalScale=new e(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.combine=wa,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=0,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.skinning=0,this.morphTargets=0,this.morphNormals=0,this.setValues(t)}function Si(t){Mi.call(this),this.defines={TOON:""},this.type="MeshToonMaterial",this.gradientMap=null,this.setValues(t)}function Ti(t){S.call(this),this.type="MeshNormalMaterial",this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=$s,this.normalScale=new e(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.wireframe=0,this.wireframeLinewidth=1,this.fog=0,this.skinning=0,this.morphTargets=0,this.morphNormals=0,this.setValues(t)}function Ai(t){S.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=wa,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=0,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.skinning=0,this.morphTargets=0,this.morphNormals=0,this.setValues(t)}function Li(t){S.call(this),this.defines={MATCAP:""},this.type="MeshMatcapMaterial",this.color=new x(16777215),this.matcap=null,this.map=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=$s,this.normalScale=new e(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.alphaMap=null,this.skinning=0,this.morphTargets=0,this.morphNormals=0,this.setValues(t)}function Ci(t){Qe.call(this),this.type="LineDashedMaterial",this.scale=1,this.dashSize=3,this.gapSize=1,this.setValues(t)}function Pi(t,e,n,i){this.parameterPositions=t,this._cachedIndex=0,this.resultBuffer=void 0!==i?i:new e.constructor(n),this.sampleValues=e,this.valueSize=n}function Ei(t,e,n,i){Pi.call(this,t,e,n,i),this._weightPrev=-0,this._offsetPrev=-0,this._weightNext=-0,this._offsetNext=-0}function Ni(t,e,n,i){Pi.call(this,t,e,n,i)}function Oi(t,e,n,i){Pi.call(this,t,e,n,i)}function Di(t,e,n,i){if(void 0===t)throw Error("THREE.KeyframeTrack: track name is undefined");if(void 0===e||0===e.length)throw Error("THREE.KeyframeTrack: no keyframes in track named "+t);this.name=t,this.times=Zu.convertArray(e,this.TimeBufferType),this.values=Zu.convertArray(n,this.ValueBufferType),this.setInterpolation(i||this.DefaultInterpolation)}function Ii(t,e,n){Di.call(this,t,e,n)}function zi(t,e,n,i){Di.call(this,t,e,n,i)}function Ri(t,e,n,i){Di.call(this,t,e,n,i)}function Fi(t,e,n,i){Pi.call(this,t,e,n,i)}function ki(t,e,n,i){Di.call(this,t,e,n,i)}function Bi(t,e,n,i){Di.call(this,t,e,n,i)}function Ui(t,e,n,i){Di.call(this,t,e,n,i)}function ji(t,e,n){this.name=t,this.tracks=n,this.duration=void 0!==e?e:-1,this.uuid=ic.generateUUID(),this.duration<0&&this.resetDuration()}function Vi(t){var e,n,i;if(void 0===t.type)throw Error("THREE.KeyframeTrack: track type undefined, can not parse");return e=function(t){switch(t.toLowerCase()){case"scalar":case"double":case"float":case"number":case"integer":return Ri;case"vector":case"vector2":case"vector3":case"vector4":return Ui;case"color":return zi;case"quaternion":return ki;case"bool":case"boolean":return Ii;case"string":return Bi}throw Error("THREE.KeyframeTrack: Unsupported typeName: "+t)}(t.type),void 0===t.times&&(n=[],i=[],Zu.flattenJSON(t.keys,n,i,"value"),t.times=n,t.values=i),void 0!==e.parse?e.parse(t):new e(t.name,t.times,t.values,t.interpolation)}function Gi(t,e,n){var i=this,r=0,o=0,a=0,s=void 0,c=[];this.onStart=void 0,this.onLoad=t,this.onProgress=e,this.onError=n,this.itemStart=function(t){a++,0==r&&void 0!==i.onStart&&i.onStart(t,o,a),r=1},this.itemEnd=function(t){o++,void 0!==i.onProgress&&i.onProgress(t,o,a),o===a&&(r=0,void 0!==i.onLoad&&i.onLoad())},this.itemError=function(t){void 0!==i.onError&&i.onError(t)},this.resolveURL=function(t){return s?s(t):t},this.setURLModifier=function(t){return s=t,this},this.addHandler=function(t,e){return c.push(t,e),this},this.removeHandler=function(t){var e=c.indexOf(t);return-1!==e&&c.splice(e,2),this},this.getHandler=function(t){var e,n,i,r;for(e=0,n=c.length;e0?ap("#subdivideSLT").val():void 0,e=CK.character.data.mirroredPose,n=Do(CK.character,t,e),i=(new tp).parse(n),r=Oo(),o=new Blob([i],{type:"application/sla;charset=utf-8"});op(o,r+(t?"-smooth":"")+".stl")}function Po(){var t=ap("#subdivideSLT").val()>0?ap("#subdivideSLT").val():void 0,e=CK.character.data.mirroredPose,n=Do(CK.character,t,e),i=(new ep).parse(n),r=Oo(),o=new Blob([i],{type:"text/plain;charset=utf-8"});op(o,r+(t?"-smooth":"")+".obj")}function Eo(){var t=Oo(),e=new Blob([JSON.stringify(CK.data.getJson())],{type:"text/plain;charset=utf-8"});op(e,t+".json")}function No(t){var e=t.target.files[0],n=new FileReader;n.onload=function(t){t.preventDefault(),CK.change(JSON.parse(t.target.result))},null!=e&&n.readAsText(e)}function Oo(){var t=CK.character.data.meta.character_name;return""===t?"Hero":t}function Do(t,e,n){var i=new T,r=new Ie;return t.traverseVisible(function(t){var o,a;t.isMesh&&(o=(new sp).parse(t),1==n&&(o=function(t){const e=[0,0,0];t.index&&t.copy(t.toNonIndexed());for(let n=0;n0?1:+t}),"name"in Function.prototype==0&&Object.defineProperty(Function.prototype,"name",{get:function(){return this.toString().match(/^\s*function\s*([^\(\s]*)/)[1]}}),void 0===Object.assign&&(Object.assign=function(t){var e,n,i,r;if(null==t)throw new TypeError("Cannot convert undefined or null to object");for(e=Object(t),n=1;n>8&255]+ec[t>>16&255]+ec[t>>24&255]+"-"+ec[255&e]+ec[e>>8&255]+"-"+ec[e>>16&15|64]+ec[e>>24&255]+"-"+ec[63&n|128]+ec[n>>8&255]+"-"+ec[n>>16&255]+ec[n>>24&255]+ec[255&i]+ec[i>>8&255]+ec[i>>16&255]+ec[i>>24&255]).toUpperCase()},clamp:function(t,e,n){return Math.max(e,Math.min(n,t))},euclideanModulo:function(t,e){return(t%e+e)%e},mapLinear:function(t,e,n,i,r){return i+(t-e)*(r-i)/(n-e)},lerp:function(t,e,n){return(1-n)*t+n*e},smoothstep:function(t,e,n){return t<=e?0:t>=n?1:(t=(t-e)/(n-e))*t*(3-2*t)},smootherstep:function(t,e,n){return t<=e?0:t>=n?1:(t=(t-e)/(n-e))*t*t*(t*(6*t-15)+10)},randInt:function(t,e){return t+Math.floor(Math.random()*(e-t+1))},randFloat:function(t,e){return t+Math.random()*(e-t)},randFloatSpread:function(t){return t*(.5-Math.random())},degToRad:function(t){return t*ic.DEG2RAD},radToDeg:function(t){return t*ic.RAD2DEG},isPowerOfTwo:function(t){return 0==(t&t-1)&&0!==t},ceilPowerOfTwo:function(t){return Math.pow(2,Math.ceil(Math.log(t)/Math.LN2))},floorPowerOfTwo:function(t){return Math.pow(2,Math.floor(Math.log(t)/Math.LN2))}},Object.defineProperties(e.prototype,{width:{get:function(){return this.x},set:function(t){this.x=t}},height:{get:function(){return this.y},set:function(t){this.y=t}}}),Object.assign(e.prototype,{isVector2:1,set:function(t,e){return this.x=t,this.y=e,this},setScalar:function(t){return this.x=t,this.y=t,this},setX:function(t){return this.x=t,this},setY:function(t){return this.y=t,this},setComponent:function(t,e){switch(t){case 0:this.x=e;break;case 1:this.y=e;break;default:throw Error("index is out of range: "+t)}return this},getComponent:function(t){switch(t){case 0:return this.x;case 1:return this.y;default:throw Error("index is out of range: "+t)}},clone:function(){return new this.constructor(this.x,this.y)},copy:function(t){return this.x=t.x,this.y=t.y,this},add:function(t,e){return void 0!==e?this.addVectors(t,e):(this.x+=t.x,this.y+=t.y,this)},addScalar:function(t){return this.x+=t,this.y+=t,this},addVectors:function(t,e){return this.x=t.x+e.x,this.y=t.y+e.y,this},addScaledVector:function(t,e){return this.x+=t.x*e,this.y+=t.y*e,this},sub:function(t,e){return void 0!==e?this.subVectors(t,e):(this.x-=t.x,this.y-=t.y,this)},subScalar:function(t){return this.x-=t,this.y-=t,this},subVectors:function(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this},multiply:function(t){return this.x*=t.x,this.y*=t.y,this},multiplyScalar:function(t){return this.x*=t,this.y*=t,this},divide:function(t){return this.x/=t.x,this.y/=t.y,this},divideScalar:function(t){return this.multiplyScalar(1/t)},applyMatrix3:function(t){var e=this.x,n=this.y,i=t.elements;return this.x=i[0]*e+i[3]*n+i[6],this.y=i[1]*e+i[4]*n+i[7],this},min:function(t){return this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y),this},max:function(t){return this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y),this},clamp:function(t,e){return this.x=Math.max(t.x,Math.min(e.x,this.x)),this.y=Math.max(t.y,Math.min(e.y,this.y)),this},clampScalar:function(t,e){return this.x=Math.max(t,Math.min(e,this.x)),this.y=Math.max(t,Math.min(e,this.y)),this},clampLength:function(t,e){var n=this.length();return this.divideScalar(n||1).multiplyScalar(Math.max(t,Math.min(e,n)))},floor:function(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this},ceil:function(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this},round:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this},roundToZero:function(){return this.x=this.x<0?Math.ceil(this.x):Math.floor(this.x),this.y=this.y<0?Math.ceil(this.y):Math.floor(this.y),this},negate:function(){return this.x=-this.x,this.y=-this.y,this},dot:function(t){return this.x*t.x+this.y*t.y},cross:function(t){return this.x*t.y-this.y*t.x},lengthSq:function(){return this.x*this.x+this.y*this.y},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y)},manhattanLength:function(){return Math.abs(this.x)+Math.abs(this.y)},normalize:function(){return this.divideScalar(this.length()||1)},angle:function(){var t=Math.atan2(this.y,this.x);return t<0&&(t+=2*Math.PI),t},distanceTo:function(t){return Math.sqrt(this.distanceToSquared(t))},distanceToSquared:function(t){var e=this.x-t.x,n=this.y-t.y;return e*e+n*n},manhattanDistanceTo:function(t){return Math.abs(this.x-t.x)+Math.abs(this.y-t.y)},setLength:function(t){return this.normalize().multiplyScalar(t)},lerp:function(t,e){return this.x+=(t.x-this.x)*e,this.y+=(t.y-this.y)*e,this},lerpVectors:function(t,e,n){return this.subVectors(e,t).multiplyScalar(n).add(t)},equals:function(t){return t.x===this.x&&t.y===this.y},fromArray:function(t,e){return void 0===e&&(e=0),this.x=t[e],this.y=t[e+1],this},toArray:function(t,e){return void 0===t&&(t=[]),void 0===e&&(e=0),t[e]=this.x,t[e+1]=this.y,t},fromBufferAttribute:function(t,e){return this.x=t.getX(e),this.y=t.getY(e),this},rotateAround:function(t,e){var n=Math.cos(e),i=Math.sin(e),r=this.x-t.x,o=this.y-t.y;return this.x=r*n-o*i+t.x,this.y=r*i+o*n+t.y,this}}),Object.assign(n,{slerp:function(t,e,n,i){return n.copy(t).slerp(e,i)},slerpFlat:function(t,e,n,i,r,o,a){var s,c,l,u,h,p,d,f,m=n[i+0],g=n[i+1],v=n[i+2],y=n[i+3],x=r[o+0],b=r[o+1],_=r[o+2],w=r[o+3];y===w&&m===x&&g===b&&v===_||(s=1-a,l=(c=m*x+g*b+v*_+y*w)>=0?1:-1,(u=1-c*c)>Number.EPSILON&&(s=Math.sin(s*(p=Math.atan2(h=Math.sqrt(u),c*l)))/h,a=Math.sin(a*p)/h),m=m*s+x*(d=a*l),g=g*s+b*d,v=v*s+_*d,y=y*s+w*d,s===1-a&&(m*=f=1/Math.sqrt(m*m+g*g+v*v+y*y),g*=f,v*=f,y*=f)),t[e]=m,t[e+1]=g,t[e+2]=v,t[e+3]=y}}),Object.defineProperties(n.prototype,{x:{get:function(){return this._x},set:function(t){this._x=t,this._onChangeCallback()}},y:{get:function(){return this._y},set:function(t){this._y=t,this._onChangeCallback()}},z:{get:function(){return this._z},set:function(t){this._z=t,this._onChangeCallback()}},w:{get:function(){return this._w},set:function(t){this._w=t,this._onChangeCallback()}}}),Object.assign(n.prototype,{isQuaternion:1,set:function(t,e,n,i){return this._x=t,this._y=e,this._z=n,this._w=i,this._onChangeCallback(),this},clone:function(){return new this.constructor(this._x,this._y,this._z,this._w)},copy:function(t){return this._x=t.x,this._y=t.y,this._z=t.z,this._w=t.w,this._onChangeCallback(),this},setFromEuler:function(t,e){var n,i,r,o,a,s,c,l,u,h,p,d;if(!t||!t.isEuler)throw Error("THREE.Quaternion: .setFromEuler() now expects an Euler rotation rather than a Vector3 and order.");return n=t._x,i=t._y,r=t._z,o=t.order,s=Math.sin,c=(a=Math.cos)(n/2),l=a(i/2),u=a(r/2),h=s(n/2),p=s(i/2),d=s(r/2),"XYZ"===o?(this._x=h*l*u+c*p*d,this._y=c*p*u-h*l*d,this._z=c*l*d+h*p*u,this._w=c*l*u-h*p*d):"YXZ"===o?(this._x=h*l*u+c*p*d,this._y=c*p*u-h*l*d,this._z=c*l*d-h*p*u,this._w=c*l*u+h*p*d):"ZXY"===o?(this._x=h*l*u-c*p*d,this._y=c*p*u+h*l*d,this._z=c*l*d+h*p*u,this._w=c*l*u-h*p*d):"ZYX"===o?(this._x=h*l*u-c*p*d,this._y=c*p*u+h*l*d,this._z=c*l*d-h*p*u,this._w=c*l*u+h*p*d):"YZX"===o?(this._x=h*l*u+c*p*d,this._y=c*p*u+h*l*d,this._z=c*l*d-h*p*u,this._w=c*l*u-h*p*d):"XZY"===o&&(this._x=h*l*u-c*p*d,this._y=c*p*u-h*l*d,this._z=c*l*d+h*p*u,this._w=c*l*u+h*p*d),0!=e&&this._onChangeCallback(),this},setFromAxisAngle:function(t,e){var n=e/2,i=Math.sin(n);return this._x=t.x*i,this._y=t.y*i,this._z=t.z*i,this._w=Math.cos(n),this._onChangeCallback(),this},setFromRotationMatrix:function(t){var e,n=t.elements,i=n[0],r=n[4],o=n[8],a=n[1],s=n[5],c=n[9],l=n[2],u=n[6],h=n[10],p=i+s+h;return p>0?(e=.5/Math.sqrt(p+1),this._w=.25/e,this._x=(u-c)*e,this._y=(o-l)*e,this._z=(a-r)*e):i>s&&i>h?(e=2*Math.sqrt(1+i-s-h),this._w=(u-c)/e,this._x=.25*e,this._y=(r+a)/e,this._z=(o+l)/e):s>h?(e=2*Math.sqrt(1+s-i-h),this._w=(o-l)/e,this._x=(r+a)/e,this._y=.25*e,this._z=(c+u)/e):(e=2*Math.sqrt(1+h-i-s),this._w=(a-r)/e,this._x=(o+l)/e,this._y=(c+u)/e,this._z=.25*e),this._onChangeCallback(),this},setFromUnitVectors:function(t,e){var n=t.dot(e)+1;return n<1e-6?(n=0,Math.abs(t.x)>Math.abs(t.z)?(this._x=-t.y,this._y=t.x,this._z=0,this._w=n):(this._x=0,this._y=-t.z,this._z=t.y,this._w=n)):(this._x=t.y*e.z-t.z*e.y,this._y=t.z*e.x-t.x*e.z,this._z=t.x*e.y-t.y*e.x,this._w=n),this.normalize()},angleTo:function(t){return 2*Math.acos(Math.abs(ic.clamp(this.dot(t),-1,1)))},rotateTowards:function(t,e){var n,i=this.angleTo(t);return 0===i?this:(n=Math.min(1,e/i),this.slerp(t,n),this)},inverse:function(){return this.conjugate()},conjugate:function(){return this._x*=-1,this._y*=-1,this._z*=-1,this._onChangeCallback(),this},dot:function(t){return this._x*t._x+this._y*t._y+this._z*t._z+this._w*t._w},lengthSq:function(){return this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w},length:function(){return Math.sqrt(this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w)},normalize:function(){var t=this.length();return 0===t?(this._x=0,this._y=0,this._z=0,this._w=1):(t=1/t,this._x=this._x*t,this._y=this._y*t,this._z=this._z*t,this._w=this._w*t),this._onChangeCallback(),this},multiply:function(t,e){return void 0!==e?this.multiplyQuaternions(t,e):this.multiplyQuaternions(this,t)},premultiply:function(t){return this.multiplyQuaternions(t,this)},multiplyQuaternions:function(t,e){var n=t._x,i=t._y,r=t._z,o=t._w,a=e._x,s=e._y,c=e._z,l=e._w;return this._x=n*l+o*a+i*c-r*s,this._y=i*l+o*s+r*a-n*c,this._z=r*l+o*c+n*s-i*a,this._w=o*l-n*a-i*s-r*c,this._onChangeCallback(),this},slerp:function(t,e){var n,i,r,o,a,s,c,l,u,h,p;return 0===e?this:1===e?this.copy(t):(n=this._x,i=this._y,r=this._z,(a=(o=this._w)*t._w+n*t._x+i*t._y+r*t._z)<0?(this._w=-t._w,this._x=-t._x,this._y=-t._y,this._z=-t._z,a=-a):this.copy(t),a>=1?(this._w=o,this._x=n,this._y=i,this._z=r,this):(s=1-a*a)<=Number.EPSILON?(c=1-e,this._w=c*o+e*this._w,this._x=c*n+e*this._x,this._y=c*i+e*this._y,this._z=c*r+e*this._z,this.normalize(),this._onChangeCallback(),this):(h=Math.sin((1-e)*(u=Math.atan2(l=Math.sqrt(s),a)))/l,p=Math.sin(e*u)/l,this._w=o*h+this._w*p,this._x=n*h+this._x*p,this._y=i*h+this._y*p,this._z=r*h+this._z*p,this._onChangeCallback(),this))},equals:function(t){return t._x===this._x&&t._y===this._y&&t._z===this._z&&t._w===this._w},fromArray:function(t,e){return void 0===e&&(e=0),this._x=t[e],this._y=t[e+1],this._z=t[e+2],this._w=t[e+3],this._onChangeCallback(),this},toArray:function(t,e){return void 0===t&&(t=[]),void 0===e&&(e=0),t[e]=this._x,t[e+1]=this._y,t[e+2]=this._z,t[e+3]=this._w,t},_onChange:function(t){return this._onChangeCallback=t,this},_onChangeCallback:function(){}}),rc=new i,oc=new n,Object.assign(i.prototype,{isVector3:1,set:function(t,e,n){return this.x=t,this.y=e,this.z=n,this},setScalar:function(t){return this.x=t,this.y=t,this.z=t,this},setX:function(t){return this.x=t,this},setY:function(t){return this.y=t,this},setZ:function(t){return this.z=t,this},setComponent:function(t,e){switch(t){case 0:this.x=e;break;case 1:this.y=e;break;case 2:this.z=e;break;default:throw Error("index is out of range: "+t)}return this},getComponent:function(t){switch(t){case 0:return this.x;case 1:return this.y;case 2:return this.z;default:throw Error("index is out of range: "+t)}},clone:function(){return new this.constructor(this.x,this.y,this.z)},copy:function(t){return this.x=t.x,this.y=t.y,this.z=t.z,this},add:function(t,e){return void 0!==e?this.addVectors(t,e):(this.x+=t.x,this.y+=t.y,this.z+=t.z,this)},addScalar:function(t){return this.x+=t,this.y+=t,this.z+=t,this},addVectors:function(t,e){return this.x=t.x+e.x,this.y=t.y+e.y,this.z=t.z+e.z,this},addScaledVector:function(t,e){return this.x+=t.x*e,this.y+=t.y*e,this.z+=t.z*e,this},sub:function(t,e){return void 0!==e?this.subVectors(t,e):(this.x-=t.x,this.y-=t.y,this.z-=t.z,this)},subScalar:function(t){return this.x-=t,this.y-=t,this.z-=t,this},subVectors:function(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this.z=t.z-e.z,this},multiply:function(t,e){return void 0!==e?this.multiplyVectors(t,e):(this.x*=t.x,this.y*=t.y,this.z*=t.z,this)},multiplyScalar:function(t){return this.x*=t,this.y*=t,this.z*=t,this},multiplyVectors:function(t,e){return this.x=t.x*e.x,this.y=t.y*e.y,this.z=t.z*e.z,this},applyEuler:function(t){return!t||t.isEuler,this.applyQuaternion(oc.setFromEuler(t))},applyAxisAngle:function(t,e){return this.applyQuaternion(oc.setFromAxisAngle(t,e))},applyMatrix3:function(t){var e=this.x,n=this.y,i=this.z,r=t.elements;return this.x=r[0]*e+r[3]*n+r[6]*i,this.y=r[1]*e+r[4]*n+r[7]*i,this.z=r[2]*e+r[5]*n+r[8]*i,this},applyMatrix4:function(t){var e=this.x,n=this.y,i=this.z,r=t.elements,o=1/(r[3]*e+r[7]*n+r[11]*i+r[15]);return this.x=(r[0]*e+r[4]*n+r[8]*i+r[12])*o,this.y=(r[1]*e+r[5]*n+r[9]*i+r[13])*o,this.z=(r[2]*e+r[6]*n+r[10]*i+r[14])*o,this},applyQuaternion:function(t){var e=this.x,n=this.y,i=this.z,r=t.x,o=t.y,a=t.z,s=t.w,c=s*e+o*i-a*n,l=s*n+a*e-r*i,u=s*i+r*n-o*e,h=-r*e-o*n-a*i;return this.x=c*s+h*-r+l*-a-u*-o,this.y=l*s+h*-o+u*-r-c*-a,this.z=u*s+h*-a+c*-o-l*-r,this},project:function(t){return this.applyMatrix4(t.matrixWorldInverse).applyMatrix4(t.projectionMatrix)},unproject:function(t){return this.applyMatrix4(t.projectionMatrixInverse).applyMatrix4(t.matrixWorld)},transformDirection:function(t){var e=this.x,n=this.y,i=this.z,r=t.elements;return this.x=r[0]*e+r[4]*n+r[8]*i,this.y=r[1]*e+r[5]*n+r[9]*i,this.z=r[2]*e+r[6]*n+r[10]*i,this.normalize()},divide:function(t){return this.x/=t.x,this.y/=t.y,this.z/=t.z,this},divideScalar:function(t){return this.multiplyScalar(1/t)},min:function(t){return this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y),this.z=Math.min(this.z,t.z),this},max:function(t){return this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y),this.z=Math.max(this.z,t.z),this},clamp:function(t,e){return this.x=Math.max(t.x,Math.min(e.x,this.x)),this.y=Math.max(t.y,Math.min(e.y,this.y)),this.z=Math.max(t.z,Math.min(e.z,this.z)),this},clampScalar:function(t,e){return this.x=Math.max(t,Math.min(e,this.x)),this.y=Math.max(t,Math.min(e,this.y)),this.z=Math.max(t,Math.min(e,this.z)),this},clampLength:function(t,e){var n=this.length();return this.divideScalar(n||1).multiplyScalar(Math.max(t,Math.min(e,n)))},floor:function(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this},ceil:function(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this},round:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this},roundToZero:function(){return this.x=this.x<0?Math.ceil(this.x):Math.floor(this.x),this.y=this.y<0?Math.ceil(this.y):Math.floor(this.y),this.z=this.z<0?Math.ceil(this.z):Math.floor(this.z),this},negate:function(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this},dot:function(t){return this.x*t.x+this.y*t.y+this.z*t.z},lengthSq:function(){return this.x*this.x+this.y*this.y+this.z*this.z},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)},manhattanLength:function(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)},normalize:function(){return this.divideScalar(this.length()||1)},setLength:function(t){return this.normalize().multiplyScalar(t)},lerp:function(t,e){return this.x+=(t.x-this.x)*e,this.y+=(t.y-this.y)*e,this.z+=(t.z-this.z)*e,this},lerpVectors:function(t,e,n){return this.subVectors(e,t).multiplyScalar(n).add(t)},cross:function(t,e){return void 0!==e?this.crossVectors(t,e):this.crossVectors(this,t)},crossVectors:function(t,e){var n=t.x,i=t.y,r=t.z,o=e.x,a=e.y,s=e.z;return this.x=i*s-r*a,this.y=r*o-n*s,this.z=n*a-i*o,this},projectOnVector:function(t){var e=t.dot(this)/t.lengthSq();return this.copy(t).multiplyScalar(e)},projectOnPlane:function(t){return rc.copy(this).projectOnVector(t),this.sub(rc)},reflect:function(t){return this.sub(rc.copy(t).multiplyScalar(2*this.dot(t)))},angleTo:function(t){var e,n=Math.sqrt(this.lengthSq()*t.lengthSq());return e=this.dot(t)/n,Math.acos(ic.clamp(e,-1,1))},distanceTo:function(t){return Math.sqrt(this.distanceToSquared(t))},distanceToSquared:function(t){var e=this.x-t.x,n=this.y-t.y,i=this.z-t.z;return e*e+n*n+i*i},manhattanDistanceTo:function(t){return Math.abs(this.x-t.x)+Math.abs(this.y-t.y)+Math.abs(this.z-t.z)},setFromSpherical:function(t){return this.setFromSphericalCoords(t.radius,t.phi,t.theta)},setFromSphericalCoords:function(t,e,n){var i=Math.sin(e)*t;return this.x=i*Math.sin(n),this.y=Math.cos(e)*t,this.z=i*Math.cos(n),this},setFromCylindrical:function(t){return this.setFromCylindricalCoords(t.radius,t.theta,t.y)},setFromCylindricalCoords:function(t,e,n){return this.x=t*Math.sin(e),this.y=n,this.z=t*Math.cos(e),this},setFromMatrixPosition:function(t){var e=t.elements;return this.x=e[12],this.y=e[13],this.z=e[14],this},setFromMatrixScale:function(t){var e=this.setFromMatrixColumn(t,0).length(),n=this.setFromMatrixColumn(t,1).length(),i=this.setFromMatrixColumn(t,2).length();return this.x=e,this.y=n,this.z=i,this},setFromMatrixColumn:function(t,e){return this.fromArray(t.elements,4*e)},equals:function(t){return t.x===this.x&&t.y===this.y&&t.z===this.z},fromArray:function(t,e){return void 0===e&&(e=0),this.x=t[e],this.y=t[e+1],this.z=t[e+2],this},toArray:function(t,e){return void 0===t&&(t=[]),void 0===e&&(e=0),t[e]=this.x,t[e+1]=this.y,t[e+2]=this.z,t},fromBufferAttribute:function(t,e){return this.x=t.getX(e),this.y=t.getY(e),this.z=t.getZ(e),this}}),ac=new i,Object.assign(r.prototype,{isMatrix3:1,set:function(t,e,n,i,r,o,a,s,c){var l=this.elements;return l[0]=t,l[1]=i,l[2]=a,l[3]=e,l[4]=r,l[5]=s,l[6]=n,l[7]=o,l[8]=c,this},identity:function(){return this.set(1,0,0,0,1,0,0,0,1),this},clone:function(){return(new this.constructor).fromArray(this.elements)},copy:function(t){var e=this.elements,n=t.elements;return e[0]=n[0],e[1]=n[1],e[2]=n[2],e[3]=n[3],e[4]=n[4],e[5]=n[5],e[6]=n[6],e[7]=n[7],e[8]=n[8],this},setFromMatrix4:function(t){var e=t.elements;return this.set(e[0],e[4],e[8],e[1],e[5],e[9],e[2],e[6],e[10]),this},applyToBufferAttribute:function(t){for(var e=0,n=t.count;e2048||e.height>2048?e.toDataURL("image/jpeg",.6):e.toDataURL("image/png"))}},lc=0,o.DEFAULT_IMAGE=void 0,o.DEFAULT_MAPPING=300,o.prototype=Object.assign(Object.create(t.prototype),{constructor:o,isTexture:1,updateMatrix:function(){this.matrix.setUvTransform(this.offset.x,this.offset.y,this.repeat.x,this.repeat.y,this.rotation,this.center.x,this.center.y)},clone:function(){return(new this.constructor).copy(this)},copy:function(t){return this.name=t.name,this.image=t.image,this.mipmaps=t.mipmaps.slice(0),this.mapping=t.mapping,this.wrapS=t.wrapS,this.wrapT=t.wrapT,this.magFilter=t.magFilter,this.minFilter=t.minFilter,this.anisotropy=t.anisotropy,this.format=t.format,this.type=t.type,this.offset.copy(t.offset),this.repeat.copy(t.repeat),this.center.copy(t.center),this.rotation=t.rotation,this.matrixAutoUpdate=t.matrixAutoUpdate,this.matrix.copy(t.matrix),this.generateMipmaps=t.generateMipmaps,this.premultiplyAlpha=t.premultiplyAlpha,this.flipY=t.flipY,this.unpackAlignment=t.unpackAlignment,this.encoding=t.encoding,this},toJSON:function(t){var e,n,i,r,o,a=void 0===t||"string"==typeof t;if(!a&&void 0!==t.textures[this.uuid])return t.textures[this.uuid];if(e={metadata:{version:4.5,type:"Texture",generator:"Texture.toJSON"},uuid:this.uuid,name:this.name,mapping:this.mapping,repeat:[this.repeat.x,this.repeat.y],offset:[this.offset.x,this.offset.y],center:[this.center.x,this.center.y],rotation:this.rotation,wrap:[this.wrapS,this.wrapT],format:this.format,type:this.type,encoding:this.encoding,minFilter:this.minFilter,magFilter:this.magFilter,anisotropy:this.anisotropy,flipY:this.flipY,premultiplyAlpha:this.premultiplyAlpha,unpackAlignment:this.unpackAlignment},void 0!==this.image){if(void 0===(n=this.image).uuid&&(n.uuid=ic.generateUUID()),!a&&void 0===t.images[n.uuid]){if(Array.isArray(n))for(i=[],r=0,o=n.length;r1)switch(this.wrapS){case ka:t.x=t.x-Math.floor(t.x);break;case Ba:t.x=t.x<0?0:1;break;case Ua:1===Math.abs(Math.floor(t.x)%2)?t.x=Math.ceil(t.x)-t.x:t.x=t.x-Math.floor(t.x)}if(t.y<0||t.y>1)switch(this.wrapT){case ka:t.y=t.y-Math.floor(t.y);break;case Ba:t.y=t.y<0?0:1;break;case Ua:1===Math.abs(Math.floor(t.y)%2)?t.y=Math.ceil(t.y)-t.y:t.y=t.y-Math.floor(t.y)}return this.flipY&&(t.y=1-t.y),t}}),Object.defineProperty(o.prototype,"needsUpdate",{set:function(t){1==t&&this.version++}}),Object.defineProperties(a.prototype,{width:{get:function(){return this.z},set:function(t){this.z=t}},height:{get:function(){return this.w},set:function(t){this.w=t}}}),Object.assign(a.prototype,{isVector4:1,set:function(t,e,n,i){return this.x=t,this.y=e,this.z=n,this.w=i,this},setScalar:function(t){return this.x=t,this.y=t,this.z=t,this.w=t,this},setX:function(t){return this.x=t,this},setY:function(t){return this.y=t,this},setZ:function(t){return this.z=t,this},setW:function(t){return this.w=t,this},setComponent:function(t,e){switch(t){case 0:this.x=e;break;case 1:this.y=e;break;case 2:this.z=e;break;case 3:this.w=e;break;default:throw Error("index is out of range: "+t)}return this},getComponent:function(t){switch(t){case 0:return this.x;case 1:return this.y;case 2:return this.z;case 3:return this.w;default:throw Error("index is out of range: "+t)}},clone:function(){return new this.constructor(this.x,this.y,this.z,this.w)},copy:function(t){return this.x=t.x,this.y=t.y,this.z=t.z,this.w=void 0!==t.w?t.w:1,this},add:function(t,e){return void 0!==e?this.addVectors(t,e):(this.x+=t.x,this.y+=t.y,this.z+=t.z,this.w+=t.w,this)},addScalar:function(t){return this.x+=t,this.y+=t,this.z+=t,this.w+=t,this},addVectors:function(t,e){return this.x=t.x+e.x,this.y=t.y+e.y,this.z=t.z+e.z,this.w=t.w+e.w,this},addScaledVector:function(t,e){return this.x+=t.x*e,this.y+=t.y*e,this.z+=t.z*e,this.w+=t.w*e,this},sub:function(t,e){return void 0!==e?this.subVectors(t,e):(this.x-=t.x,this.y-=t.y,this.z-=t.z,this.w-=t.w,this)},subScalar:function(t){return this.x-=t,this.y-=t,this.z-=t,this.w-=t,this},subVectors:function(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this.z=t.z-e.z,this.w=t.w-e.w,this},multiplyScalar:function(t){return this.x*=t,this.y*=t,this.z*=t,this.w*=t,this},applyMatrix4:function(t){var e=this.x,n=this.y,i=this.z,r=this.w,o=t.elements;return this.x=o[0]*e+o[4]*n+o[8]*i+o[12]*r,this.y=o[1]*e+o[5]*n+o[9]*i+o[13]*r,this.z=o[2]*e+o[6]*n+o[10]*i+o[14]*r,this.w=o[3]*e+o[7]*n+o[11]*i+o[15]*r,this},divideScalar:function(t){return this.multiplyScalar(1/t)},setAxisAngleFromQuaternion:function(t){this.w=2*Math.acos(t.w);var e=Math.sqrt(1-t.w*t.w);return e<1e-4?(this.x=1,this.y=0,this.z=0):(this.x=t.x/e,this.y=t.y/e,this.z=t.z/e),this},setAxisAngleFromRotationMatrix:function(t){var e,n,i,r,o,a,s,c,l,u,h=t.elements,p=h[0],d=h[4],f=h[8],m=h[1],g=h[5],v=h[9],y=h[2],x=h[6],b=h[10];return Math.abs(d-m)<.01&&Math.abs(f-y)<.01&&Math.abs(v-x)<.01?Math.abs(d+m)<.1&&Math.abs(f+y)<.1&&Math.abs(v+x)<.1&&Math.abs(p+g+b-3)<.1?(this.set(1,0,0,0),this):(a=(b+1)/2,s=(d+m)/4,c=(f+y)/4,l=(v+x)/4,(r=(p+1)/2)>(o=(g+1)/2)&&r>a?r<.01?(e=0,n=.707106781,i=.707106781):(n=s/(e=Math.sqrt(r)),i=c/e):o>a?o<.01?(e=.707106781,n=0,i=.707106781):(e=s/(n=Math.sqrt(o)),i=l/n):a<.01?(e=.707106781,n=.707106781,i=0):(e=c/(i=Math.sqrt(a)),n=l/i),this.set(e,n,i,3.141592653589793),this):(Math.abs(u=Math.sqrt((x-v)*(x-v)+(f-y)*(f-y)+(m-d)*(m-d)))<.001&&(u=1),this.x=(x-v)/u,this.y=(f-y)/u,this.z=(m-d)/u,this.w=Math.acos((p+g+b-1)/2),this)},min:function(t){return this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y),this.z=Math.min(this.z,t.z),this.w=Math.min(this.w,t.w),this},max:function(t){return this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y),this.z=Math.max(this.z,t.z),this.w=Math.max(this.w,t.w),this},clamp:function(t,e){return this.x=Math.max(t.x,Math.min(e.x,this.x)),this.y=Math.max(t.y,Math.min(e.y,this.y)),this.z=Math.max(t.z,Math.min(e.z,this.z)),this.w=Math.max(t.w,Math.min(e.w,this.w)),this},clampScalar:function(t,e){return this.x=Math.max(t,Math.min(e,this.x)),this.y=Math.max(t,Math.min(e,this.y)),this.z=Math.max(t,Math.min(e,this.z)),this.w=Math.max(t,Math.min(e,this.w)),this},clampLength:function(t,e){var n=this.length();return this.divideScalar(n||1).multiplyScalar(Math.max(t,Math.min(e,n)))},floor:function(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this.w=Math.floor(this.w),this},ceil:function(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this.w=Math.ceil(this.w),this},round:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this.w=Math.round(this.w),this},roundToZero:function(){return this.x=this.x<0?Math.ceil(this.x):Math.floor(this.x),this.y=this.y<0?Math.ceil(this.y):Math.floor(this.y),this.z=this.z<0?Math.ceil(this.z):Math.floor(this.z),this.w=this.w<0?Math.ceil(this.w):Math.floor(this.w),this},negate:function(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this.w=-this.w,this},dot:function(t){return this.x*t.x+this.y*t.y+this.z*t.z+this.w*t.w},lengthSq:function(){return this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)},manhattanLength:function(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)+Math.abs(this.w)},normalize:function(){return this.divideScalar(this.length()||1)},setLength:function(t){return this.normalize().multiplyScalar(t)},lerp:function(t,e){return this.x+=(t.x-this.x)*e,this.y+=(t.y-this.y)*e,this.z+=(t.z-this.z)*e,this.w+=(t.w-this.w)*e,this},lerpVectors:function(t,e,n){return this.subVectors(e,t).multiplyScalar(n).add(t)},equals:function(t){return t.x===this.x&&t.y===this.y&&t.z===this.z&&t.w===this.w},fromArray:function(t,e){return void 0===e&&(e=0),this.x=t[e],this.y=t[e+1],this.z=t[e+2],this.w=t[e+3],this},toArray:function(t,e){return void 0===t&&(t=[]),void 0===e&&(e=0),t[e]=this.x,t[e+1]=this.y,t[e+2]=this.z,t[e+3]=this.w,t},fromBufferAttribute:function(t,e){return this.x=t.getX(e),this.y=t.getY(e),this.z=t.getZ(e),this.w=t.getW(e),this}}),s.prototype=Object.assign(Object.create(t.prototype),{constructor:s,isWebGLRenderTarget:1,setSize:function(t,e){this.width===t&&this.height===e||(this.width=t,this.height=e,this.texture.image.width=t,this.texture.image.height=e,this.dispose()),this.viewport.set(0,0,t,e),this.scissor.set(0,0,t,e)},clone:function(){return(new this.constructor).copy(this)},copy:function(t){return this.width=t.width,this.height=t.height,this.viewport.copy(t.viewport),this.texture=t.texture.clone(),this.depthBuffer=t.depthBuffer,this.stencilBuffer=t.stencilBuffer,this.depthTexture=t.depthTexture,this},dispose:function(){this.dispatchEvent({type:"dispose"})}}),c.prototype=Object.assign(Object.create(s.prototype),{constructor:c,isWebGLMultisampleRenderTarget:1,copy:function(t){return s.prototype.copy.call(this,t),this.samples=t.samples,this}}),uc=new i,hc=new l,pc=new i(0,0,0),dc=new i(1,1,1),fc=new i,mc=new i,gc=new i,Object.assign(l.prototype,{isMatrix4:1,set:function(t,e,n,i,r,o,a,s,c,l,u,h,p,d,f,m){var g=this.elements;return g[0]=t,g[4]=e,g[8]=n,g[12]=i,g[1]=r,g[5]=o,g[9]=a,g[13]=s,g[2]=c,g[6]=l,g[10]=u,g[14]=h,g[3]=p,g[7]=d,g[11]=f,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 l).fromArray(this.elements)},copy:function(t){var e=this.elements,n=t.elements;return e[0]=n[0],e[1]=n[1],e[2]=n[2],e[3]=n[3],e[4]=n[4],e[5]=n[5],e[6]=n[6],e[7]=n[7],e[8]=n[8],e[9]=n[9],e[10]=n[10],e[11]=n[11],e[12]=n[12],e[13]=n[13],e[14]=n[14],e[15]=n[15],this},copyPosition:function(t){var e=this.elements,n=t.elements;return e[12]=n[12],e[13]=n[13],e[14]=n[14],this},extractBasis:function(t,e,n){return t.setFromMatrixColumn(this,0),e.setFromMatrixColumn(this,1),n.setFromMatrixColumn(this,2),this},makeBasis:function(t,e,n){return this.set(t.x,e.x,n.x,0,t.y,e.y,n.y,0,t.z,e.z,n.z,0,0,0,0,1),this},extractRotation:function(t){var e=this.elements,n=t.elements,i=1/uc.setFromMatrixColumn(t,0).length(),r=1/uc.setFromMatrixColumn(t,1).length(),o=1/uc.setFromMatrixColumn(t,2).length();return e[0]=n[0]*i,e[1]=n[1]*i,e[2]=n[2]*i,e[3]=0,e[4]=n[4]*r,e[5]=n[5]*r,e[6]=n[6]*r,e[7]=0,e[8]=n[8]*o,e[9]=n[9]*o,e[10]=n[10]*o,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,this},makeRotationFromEuler:function(t){var e,n,i,r,o,a,s,c,l,u,h,p,d,f,m,g,v,y,x,b,_,w;return!t||t.isEuler,e=this.elements,n=t.x,i=t.y,r=t.z,o=Math.cos(n),a=Math.sin(n),s=Math.cos(i),c=Math.sin(i),l=Math.cos(r),u=Math.sin(r),"XYZ"===t.order?(h=o*l,p=o*u,d=a*l,f=a*u,e[0]=s*l,e[4]=-s*u,e[8]=c,e[1]=p+d*c,e[5]=h-f*c,e[9]=-a*s,e[2]=f-h*c,e[6]=d+p*c,e[10]=o*s):"YXZ"===t.order?(m=s*l,g=s*u,v=c*l,y=c*u,e[0]=m+y*a,e[4]=v*a-g,e[8]=o*c,e[1]=o*u,e[5]=o*l,e[9]=-a,e[2]=g*a-v,e[6]=y+m*a,e[10]=o*s):"ZXY"===t.order?(m=s*l,g=s*u,v=c*l,y=c*u,e[0]=m-y*a,e[4]=-o*u,e[8]=v+g*a,e[1]=g+v*a,e[5]=o*l,e[9]=y-m*a,e[2]=-o*c,e[6]=a,e[10]=o*s):"ZYX"===t.order?(h=o*l,p=o*u,d=a*l,f=a*u,e[0]=s*l,e[4]=d*c-p,e[8]=h*c+f,e[1]=s*u,e[5]=f*c+h,e[9]=p*c-d,e[2]=-c,e[6]=a*s,e[10]=o*s):"YZX"===t.order?(x=o*s,b=o*c,_=a*s,w=a*c,e[0]=s*l,e[4]=w-x*u,e[8]=_*u+b,e[1]=u,e[5]=o*l,e[9]=-a*l,e[2]=-c*l,e[6]=b*u+_,e[10]=x-w*u):"XZY"===t.order&&(x=o*s,b=o*c,_=a*s,w=a*c,e[0]=s*l,e[4]=-u,e[8]=c*l,e[1]=x*u+w,e[5]=o*l,e[9]=b*u-_,e[2]=_*u-b,e[6]=a*l,e[10]=w*u+x),e[3]=0,e[7]=0,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,this},makeRotationFromQuaternion:function(t){return this.compose(pc,t,dc)},lookAt:function(t,e,n){var i=this.elements;return gc.subVectors(t,e),0===gc.lengthSq()&&(gc.z=1),gc.normalize(),fc.crossVectors(n,gc),0===fc.lengthSq()&&(1===Math.abs(n.z)?gc.x+=1e-4:gc.z+=1e-4,gc.normalize(),fc.crossVectors(n,gc)),fc.normalize(),mc.crossVectors(gc,fc),i[0]=fc.x,i[4]=mc.x,i[8]=gc.x,i[1]=fc.y,i[5]=mc.y,i[9]=gc.y,i[2]=fc.z,i[6]=mc.z,i[10]=gc.z,this},multiply:function(t,e){return void 0!==e?this.multiplyMatrices(t,e):this.multiplyMatrices(this,t)},premultiply:function(t){return this.multiplyMatrices(t,this)},multiplyMatrices:function(t,e){var n=t.elements,i=e.elements,r=this.elements,o=n[0],a=n[4],s=n[8],c=n[12],l=n[1],u=n[5],h=n[9],p=n[13],d=n[2],f=n[6],m=n[10],g=n[14],v=n[3],y=n[7],x=n[11],b=n[15],_=i[0],w=i[4],M=i[8],S=i[12],T=i[1],A=i[5],L=i[9],C=i[13],P=i[2],E=i[6],N=i[10],O=i[14],D=i[3],I=i[7],z=i[11],R=i[15];return r[0]=o*_+a*T+s*P+c*D,r[4]=o*w+a*A+s*E+c*I,r[8]=o*M+a*L+s*N+c*z,r[12]=o*S+a*C+s*O+c*R,r[1]=l*_+u*T+h*P+p*D,r[5]=l*w+u*A+h*E+p*I,r[9]=l*M+u*L+h*N+p*z,r[13]=l*S+u*C+h*O+p*R,r[2]=d*_+f*T+m*P+g*D,r[6]=d*w+f*A+m*E+g*I,r[10]=d*M+f*L+m*N+g*z,r[14]=d*S+f*C+m*O+g*R,r[3]=v*_+y*T+x*P+b*D,r[7]=v*w+y*A+x*E+b*I,r[11]=v*M+y*L+x*N+b*z,r[15]=v*S+y*C+x*O+b*R,this},multiplyScalar:function(t){var e=this.elements;return e[0]*=t,e[4]*=t,e[8]*=t,e[12]*=t,e[1]*=t,e[5]*=t,e[9]*=t,e[13]*=t,e[2]*=t,e[6]*=t,e[10]*=t,e[14]*=t,e[3]*=t,e[7]*=t,e[11]*=t,e[15]*=t,this},applyToBufferAttribute:function(t){for(var e=0,n=t.count;e1){for(var e=0;e1){for(e=0;e0)for(i.children=[],a=0;a0&&(m.geometries=u),h.length>0&&(m.materials=h),p.length>0&&(m.textures=p),d.length>0&&(m.images=d),o.length>0&&(m.shapes=o)),m.object=i,m},clone:function(t){return(new this.constructor).copy(this,t)},copy:function(t,e){var n,i;if(void 0===e&&(e=1),this.name=t.name,this.up.copy(t.up),this.position.copy(t.position),this.quaternion.copy(t.quaternion),this.scale.copy(t.scale),this.matrix.copy(t.matrix),this.matrixWorld.copy(t.matrixWorld),this.matrixAutoUpdate=t.matrixAutoUpdate,this.matrixWorldNeedsUpdate=t.matrixWorldNeedsUpdate,this.layers.mask=t.layers.mask,this.visible=t.visible,this.castShadow=t.castShadow,this.receiveShadow=t.receiveShadow,this.frustumCulled=t.frustumCulled,this.renderOrder=t.renderOrder,this.userData=JSON.parse(JSON.stringify(t.userData)),1==e)for(n=0;nl&&(l=i),r>u&&(u=r),o>h&&(h=o);return this.min.set(a,s,c),this.max.set(l,u,h),this},setFromBufferAttribute:function(t){var e,n,i,r,o,a=1/0,s=1/0,c=1/0,l=-1/0,u=-1/0,h=-1/0;for(e=0,n=t.count;el&&(l=i),r>u&&(u=r),o>h&&(h=o);return this.min.set(a,s,c),this.max.set(l,u,h),this},setFromPoints:function(t){this.makeEmpty();for(var e=0,n=t.length;ethis.max.x||t.ythis.max.y||t.zthis.max.z?0:1},containsBox:function(t){return this.min.x<=t.min.x&&t.max.x<=this.max.x&&this.min.y<=t.min.y&&t.max.y<=this.max.y&&this.min.z<=t.min.z&&t.max.z<=this.max.z},getParameter:function(t,e){return void 0===e&&(e=new i),e.set((t.x-this.min.x)/(this.max.x-this.min.x),(t.y-this.min.y)/(this.max.y-this.min.y),(t.z-this.min.z)/(this.max.z-this.min.z))},intersectsBox:function(t){return t.max.xthis.max.x||t.max.ythis.max.y||t.max.zthis.max.z?0:1},intersectsSphere:function(t){return this.clampPoint(t.center,Dc),Dc.distanceToSquared(t.center)<=t.radius*t.radius},intersectsPlane:function(t){var e,n;return t.normal.x>0?(e=t.normal.x*this.min.x,n=t.normal.x*this.max.x):(e=t.normal.x*this.max.x,n=t.normal.x*this.min.x),t.normal.y>0?(e+=t.normal.y*this.min.y,n+=t.normal.y*this.max.y):(e+=t.normal.y*this.max.y,n+=t.normal.y*this.min.y),t.normal.z>0?(e+=t.normal.z*this.min.z,n+=t.normal.z*this.max.z):(e+=t.normal.z*this.max.z,n+=t.normal.z*this.min.z),e<=-t.constant&&n>=-t.constant},intersectsTriangle:function(t){if(this.isEmpty())return 0;this.getCenter(Uc),jc.subVectors(this.max,Uc),Ic.subVectors(t.a,Uc),zc.subVectors(t.b,Uc),Rc.subVectors(t.c,Uc),Fc.subVectors(zc,Ic),kc.subVectors(Rc,zc),Bc.subVectors(Ic,Rc);var e=[0,-Fc.z,Fc.y,0,-kc.z,kc.y,0,-Bc.z,Bc.y,Fc.z,0,-Fc.x,kc.z,0,-kc.x,Bc.z,0,-Bc.x,-Fc.y,Fc.x,0,-kc.y,kc.x,0,-Bc.y,Bc.x,0];return m(e,Ic,zc,Rc,jc)&&m(e=[1,0,0,0,1,0,0,0,1],Ic,zc,Rc,jc)?(Vc.crossVectors(Fc,kc),m(e=[Vc.x,Vc.y,Vc.z],Ic,zc,Rc,jc)):0},clampPoint:function(t,e){return void 0===e&&(e=new i),e.copy(t).clamp(this.min,this.max)},distanceToPoint:function(t){return Dc.copy(t).clamp(this.min,this.max).sub(t).length()},getBoundingSphere:function(t){return this.getCenter(t.center),t.radius=.5*this.getSize(Dc).length(),t},intersect:function(t){return this.min.max(t.min),this.max.min(t.max),this.isEmpty()&&this.makeEmpty(),this},union:function(t){return this.min.min(t.min),this.max.max(t.max),this},applyMatrix4:function(t){return this.isEmpty()?this:(Oc[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(t),Oc[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(t),Oc[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(t),Oc[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(t),Oc[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(t),Oc[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(t),Oc[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(t),Oc[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(t),this.setFromPoints(Oc),this)},translate:function(t){return this.min.add(t),this.max.add(t),this},equals:function(t){return t.min.equals(this.min)&&t.max.equals(this.max)}}),Wc=new f,Object.assign(g.prototype,{set:function(t,e){return this.center.copy(t),this.radius=e,this},setFromPoints:function(t,e){var n,i,r,o=this.center;for(void 0!==e?o.copy(e):Wc.setFromPoints(t).getCenter(o),n=0,i=0,r=t.length;ithis.radius*this.radius&&(e.sub(this.center).normalize(),e.multiplyScalar(this.radius).add(this.center)),e},getBoundingBox:function(t){return void 0===t&&(t=new f),t.set(this.center,this.center),t.expandByScalar(this.radius),t},applyMatrix4:function(t){return this.center.applyMatrix4(t),this.radius=this.radius*t.getMaxScaleOnAxis(),this},translate:function(t){return this.center.add(t),this},equals:function(t){return t.center.equals(this.center)&&t.radius===this.radius}}),Hc=new i,qc=new i,Xc=new i,Yc=new i,Zc=new i,Jc=new i,$c=new i,Object.assign(v.prototype,{set:function(t,e){return this.origin.copy(t),this.direction.copy(e),this},clone:function(){return(new this.constructor).copy(this)},copy:function(t){return this.origin.copy(t.origin),this.direction.copy(t.direction),this},at:function(t,e){return void 0===e&&(e=new i),e.copy(this.direction).multiplyScalar(t).add(this.origin)},lookAt:function(t){return this.direction.copy(t).sub(this.origin).normalize(),this},recast:function(t){return this.origin.copy(this.at(t,Hc)),this},closestPointToPoint:function(t,e){void 0===e&&(e=new i),e.subVectors(t,this.origin);var n=e.dot(this.direction);return n<0?e.copy(this.origin):e.copy(this.direction).multiplyScalar(n).add(this.origin)},distanceToPoint:function(t){return Math.sqrt(this.distanceSqToPoint(t))},distanceSqToPoint:function(t){var e=Hc.subVectors(t,this.origin).dot(this.direction);return e<0?this.origin.distanceToSquared(t):(Hc.copy(this.direction).multiplyScalar(e).add(this.origin),Hc.distanceToSquared(t))},distanceSqToSegment:function(t,e,n,i){var r,o,a,s,c,l,u,h,p,d,f;return qc.copy(t).add(e).multiplyScalar(.5),Xc.copy(e).sub(t).normalize(),Yc.copy(this.origin).sub(qc),r=.5*t.distanceTo(e),o=-this.direction.dot(Xc),a=Yc.dot(this.direction),s=-Yc.dot(Xc),c=Yc.lengthSq(),(l=Math.abs(1-o*o))>0?(h=o*a-s,d=r*l,(u=o*s-a)>=0?p=h>=-d?h<=d?(u*=f=1/l)*(u+o*(h*=f)+2*a)+h*(o*u+h+2*s)+c:-(u=Math.max(0,-(o*(h=r)+a)))*u+h*(h+2*s)+c:-(u=Math.max(0,-(o*(h=-r)+a)))*u+h*(h+2*s)+c:h<=-d?p=-(u=Math.max(0,-(-o*r+a)))*u+(h=u>0?-r:Math.min(Math.max(-r,-s),r))*(h+2*s)+c:h<=d?(u=0,p=(h=Math.min(Math.max(-r,-s),r))*(h+2*s)+c):p=-(u=Math.max(0,-(o*r+a)))*u+(h=u>0?r:Math.min(Math.max(-r,-s),r))*(h+2*s)+c):p=-(u=Math.max(0,-(o*(h=o>0?-r:r)+a)))*u+h*(h+2*s)+c,n&&n.copy(this.direction).multiplyScalar(u).add(this.origin),i&&i.copy(Xc).multiplyScalar(h).add(qc),p},intersectSphere:function(t,e){var n,i,r,o,a,s;return Hc.subVectors(t.center,this.origin),n=Hc.dot(this.direction),(i=Hc.dot(Hc)-n*n)>(r=t.radius*t.radius)?null:(s=n+(o=Math.sqrt(r-i)),(a=n-o)<0&&s<0?null:a<0?this.at(s,e):this.at(a,e))},intersectsSphere:function(t){return this.distanceSqToPoint(t.center)<=t.radius*t.radius},distanceToPlane:function(t){var e,n=t.normal.dot(this.direction);return 0===n?0===t.distanceToPoint(this.origin)?0:null:(e=-(this.origin.dot(t.normal)+t.constant)/n)>=0?e:null},intersectPlane:function(t,e){var n=this.distanceToPlane(t);return null===n?null:this.at(n,e)},intersectsPlane:function(t){var e=t.distanceToPoint(this.origin);return 0===e?1:t.normal.dot(this.direction)*e<0?1:0},intersectBox:function(t,e){var n,i,r,o,a,s,c=1/this.direction.x,l=1/this.direction.y,u=1/this.direction.z,h=this.origin;return c>=0?(n=(t.min.x-h.x)*c,i=(t.max.x-h.x)*c):(n=(t.max.x-h.x)*c,i=(t.min.x-h.x)*c),l>=0?(r=(t.min.y-h.y)*l,o=(t.max.y-h.y)*l):(r=(t.max.y-h.y)*l,o=(t.min.y-h.y)*l),n>o||r>i?null:((r>n||n!=n)&&(n=r),(o=0?(a=(t.min.z-h.z)*u,s=(t.max.z-h.z)*u):(a=(t.max.z-h.z)*u,s=(t.min.z-h.z)*u),n>s||a>i?null:((a>n||n!=n)&&(n=a),(s=0?n:i,e)))},intersectsBox:function(t){return null!==this.intersectBox(t,Hc)},intersectTriangle:function(t,e,n,i,r){var o,a,s,c,l;if(Zc.subVectors(e,t),Jc.subVectors(n,t),$c.crossVectors(Zc,Jc),(o=this.direction.dot($c))>0){if(i)return null;a=1}else{if(!(o<0))return null;a=-1,o=-o}return Yc.subVectors(this.origin,t),(s=a*this.direction.dot(Jc.crossVectors(Yc,Jc)))<0?null:(c=a*this.direction.dot(Zc.cross(Yc)))<0?null:s+c>o?null:(l=-a*Yc.dot($c))<0?null:this.at(l/o,r)},applyMatrix4:function(t){return this.origin.applyMatrix4(t),this.direction.transformDirection(t),this},equals:function(t){return t.origin.equals(this.origin)&&t.direction.equals(this.direction)}}),Qc=new i,Kc=new i,tl=new i,el=new i,nl=new i,il=new i,rl=new i,ol=new i,al=new i,sl=new i,Object.assign(y,{getNormal:function(t,e,n,r){void 0===r&&(r=new i),r.subVectors(n,e),Qc.subVectors(t,e),r.cross(Qc);var o=r.lengthSq();return o>0?r.multiplyScalar(1/Math.sqrt(o)):r.set(0,0,0)},getBarycoord:function(t,e,n,r,o){var a,s,c,l,u,h,p,d,f;return Qc.subVectors(r,e),Kc.subVectors(n,e),tl.subVectors(t,e),a=Qc.dot(Qc),s=Qc.dot(Kc),c=Qc.dot(tl),l=Kc.dot(Kc),u=Kc.dot(tl),h=a*l-s*s,void 0===o&&(o=new i),0===h?o.set(-2,-1,-1):(d=(l*c-s*u)*(p=1/h),f=(a*u-s*c)*p,o.set(1-d-f,f,d))},containsPoint:function(t,e,n,i){return y.getBarycoord(t,e,n,i,el),el.x>=0&&el.y>=0&&el.x+el.y<=1},getUV:function(t,e,n,i,r,o,a,s){return this.getBarycoord(t,e,n,i,el),s.set(0,0),s.addScaledVector(r,el.x),s.addScaledVector(o,el.y),s.addScaledVector(a,el.z),s},isFrontFacing:function(t,e,n,i){return Qc.subVectors(n,e),Kc.subVectors(t,e),Qc.cross(Kc).dot(i)<0?1:0}}),Object.assign(y.prototype,{set:function(t,e,n){return this.a.copy(t),this.b.copy(e),this.c.copy(n),this},setFromPointsAndIndices:function(t,e,n,i){return this.a.copy(t[e]),this.b.copy(t[n]),this.c.copy(t[i]),this},clone:function(){return(new this.constructor).copy(this)},copy:function(t){return this.a.copy(t.a),this.b.copy(t.b),this.c.copy(t.c),this},getArea:function(){return Qc.subVectors(this.c,this.b),Kc.subVectors(this.a,this.b),.5*Qc.cross(Kc).length()},getMidpoint:function(t){return void 0===t&&(t=new i),t.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)},getNormal:function(t){return y.getNormal(this.a,this.b,this.c,t)},getPlane:function(t){return void 0===t&&(t=new i),t.setFromCoplanarPoints(this.a,this.b,this.c)},getBarycoord:function(t,e){return y.getBarycoord(t,this.a,this.b,this.c,e)},getUV:function(t,e,n,i,r){return y.getUV(t,this.a,this.b,this.c,e,n,i,r)},containsPoint:function(t){return y.containsPoint(t,this.a,this.b,this.c)},isFrontFacing:function(t){return y.isFrontFacing(this.a,this.b,this.c,t)},intersectsBox:function(t){return t.intersectsTriangle(this)},closestPointToPoint:function(t,e){var n,r,o,a,s,c,l,u,h,p,d,f,m,g,v;return void 0===e&&(e=new i),n=this.a,r=this.b,o=this.c,nl.subVectors(r,n),il.subVectors(o,n),ol.subVectors(t,n),c=nl.dot(ol),l=il.dot(ol),c<=0&&l<=0?e.copy(n):(al.subVectors(t,r),u=nl.dot(al),h=il.dot(al),u>=0&&h<=u?e.copy(r):(p=c*h-u*l)<=0&&c>=0&&u<=0?(a=c/(c-u),e.copy(n).addScaledVector(nl,a)):(sl.subVectors(t,o),d=nl.dot(sl),(f=il.dot(sl))>=0&&d<=f?e.copy(o):(m=d*l-c*f)<=0&&l>=0&&f<=0?(s=l/(l-f),e.copy(n).addScaledVector(il,s)):(g=u*f-d*h)<=0&&h-u>=0&&d-f>=0?(rl.subVectors(o,r),s=(h-u)/(h-u+(d-f)),e.copy(r).addScaledVector(rl,s)):(a=m*(v=1/(g+m+p)),s=p*v,e.copy(n).addScaledVector(nl,a).addScaledVector(il,s))))},equals:function(t){return t.a.equals(this.a)&&t.b.equals(this.b)&&t.c.equals(this.c)}}),cl={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074},ll={h:0,s:0,l:0},ul={h:0,s:0,l:0},Object.assign(x.prototype,{isColor:1,r:1,g:1,b:1,set:function(t){return t&&t.isColor?this.copy(t):"number"==typeof t?this.setHex(t):"string"==typeof t&&this.setStyle(t),this},setScalar:function(t){return this.r=t,this.g=t,this.b=t,this},setHex:function(t){return t=Math.floor(t),this.r=(t>>16&255)/255,this.g=(t>>8&255)/255,this.b=(255&t)/255,this},setRGB:function(t,e,n){return this.r=t,this.g=e,this.b=n,this},setHSL:function(t,e,n){var i,r;return t=ic.euclideanModulo(t,1),e=ic.clamp(e,0,1),n=ic.clamp(n,0,1),0===e?this.r=this.g=this.b=n:(r=2*n-(i=n<=.5?n*(1+e):n+e-n*e),this.r=b(r,i,t+1/3),this.g=b(r,i,t),this.b=b(r,i,t-1/3)),this},setStyle:function(t){var e,n,i,r,o,a,s,c,l;if(e=/^((?:rgb|hsl)a?)\(\s*([^\)]*)\)/.exec(t))switch(i=e[1],r=e[2],i){case"rgb":case"rgba":if(n=/^(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(,\s*([0-9]*\.?[0-9]+)\s*)?$/.exec(r))return this.r=Math.min(255,parseInt(n[1],10))/255,this.g=Math.min(255,parseInt(n[2],10))/255,this.b=Math.min(255,parseInt(n[3],10))/255,n[5],this;if(n=/^(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(,\s*([0-9]*\.?[0-9]+)\s*)?$/.exec(r))return this.r=Math.min(100,parseInt(n[1],10))/100,this.g=Math.min(100,parseInt(n[2],10))/100,this.b=Math.min(100,parseInt(n[3],10))/100,n[5],this;break;case"hsl":case"hsla":if(n=/^([0-9]*\.?[0-9]+)\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(,\s*([0-9]*\.?[0-9]+)\s*)?$/.exec(r))return o=parseFloat(n[1])/360,a=parseInt(n[2],10)/100,s=parseInt(n[3],10)/100,n[5],this.setHSL(o,a,s)}else if(e=/^\#([A-Fa-f0-9]+)$/.exec(t)){if(3===(l=(c=e[1]).length))return this.r=parseInt(c.charAt(0)+c.charAt(0),16)/255,this.g=parseInt(c.charAt(1)+c.charAt(1),16)/255,this.b=parseInt(c.charAt(2)+c.charAt(2),16)/255,this;if(6===l)return this.r=parseInt(c.charAt(0)+c.charAt(1),16)/255,this.g=parseInt(c.charAt(2)+c.charAt(3),16)/255,this.b=parseInt(c.charAt(4)+c.charAt(5),16)/255,this}return t&&t.length>0&&void 0!==(c=cl[t])&&this.setHex(c),this},clone:function(){return new this.constructor(this.r,this.g,this.b)},copy:function(t){return this.r=t.r,this.g=t.g,this.b=t.b,this},copyGammaToLinear:function(t,e){return void 0===e&&(e=2),this.r=Math.pow(t.r,e),this.g=Math.pow(t.g,e),this.b=Math.pow(t.b,e),this},copyLinearToGamma:function(t,e){void 0===e&&(e=2);var n=e>0?1/e:1;return this.r=Math.pow(t.r,n),this.g=Math.pow(t.g,n),this.b=Math.pow(t.b,n),this},convertGammaToLinear:function(t){return this.copyGammaToLinear(this,t),this},convertLinearToGamma:function(t){return this.copyLinearToGamma(this,t),this},copySRGBToLinear:function(t){return this.r=_(t.r),this.g=_(t.g),this.b=_(t.b),this},copyLinearToSRGB:function(t){return this.r=w(t.r),this.g=w(t.g),this.b=w(t.b),this},convertSRGBToLinear:function(){return this.copySRGBToLinear(this),this},convertLinearToSRGB:function(){return this.copyLinearToSRGB(this),this},getHex:function(){return 255*this.r<<16^255*this.g<<8^255*this.b<<0},getHexString:function(){return("000000"+this.getHex().toString(16)).slice(-6)},getHSL:function(t){var e,n,i,r,o,a,s,c,l;if(void 0===t&&(t={h:0,s:0,l:0}),e=this.r,n=this.g,i=this.b,r=Math.max(e,n,i),c=((o=Math.min(e,n,i))+r)/2,o===r)a=0,s=0;else{switch(l=r-o,s=c<=.5?l/(r+o):l/(2-r-o),r){case e:a=(n-i)/l+(n0&&(n.alphaTest=this.alphaTest),1==this.premultipliedAlpha&&(n.premultipliedAlpha=this.premultipliedAlpha),1==this.wireframe&&(n.wireframe=this.wireframe),this.wireframeLinewidth>1&&(n.wireframeLinewidth=this.wireframeLinewidth),"round"!==this.wireframeLinecap&&(n.wireframeLinecap=this.wireframeLinecap),"round"!==this.wireframeLinejoin&&(n.wireframeLinejoin=this.wireframeLinejoin),1==this.morphTargets&&(n.morphTargets=1),1==this.morphNormals&&(n.morphNormals=1),1==this.skinning&&(n.skinning=1),0==this.visible&&(n.visible=0),0==this.toneMapped&&(n.toneMapped=0),"{}"!==JSON.stringify(this.userData)&&(n.userData=this.userData),o&&(i=e(t.textures),r=e(t.images),i.length>0&&(n.textures=i),r.length>0&&(n.images=r)),n},clone:function(){return(new this.constructor).copy(this)},copy:function(t){var e,n,i,r;if(this.name=t.name,this.fog=t.fog,this.blending=t.blending,this.side=t.side,this.flatShading=t.flatShading,this.vertexColors=t.vertexColors,this.opacity=t.opacity,this.transparent=t.transparent,this.blendSrc=t.blendSrc,this.blendDst=t.blendDst,this.blendEquation=t.blendEquation,this.blendSrcAlpha=t.blendSrcAlpha,this.blendDstAlpha=t.blendDstAlpha,this.blendEquationAlpha=t.blendEquationAlpha,this.depthFunc=t.depthFunc,this.depthTest=t.depthTest,this.depthWrite=t.depthWrite,this.stencilWrite=t.stencilWrite,this.stencilWriteMask=t.stencilWriteMask,this.stencilFunc=t.stencilFunc,this.stencilRef=t.stencilRef,this.stencilFuncMask=t.stencilFuncMask,this.stencilFail=t.stencilFail,this.stencilZFail=t.stencilZFail,this.stencilZPass=t.stencilZPass,this.colorWrite=t.colorWrite,this.precision=t.precision,this.polygonOffset=t.polygonOffset,this.polygonOffsetFactor=t.polygonOffsetFactor,this.polygonOffsetUnits=t.polygonOffsetUnits,this.dithering=t.dithering,this.alphaTest=t.alphaTest,this.premultipliedAlpha=t.premultipliedAlpha,this.visible=t.visible,this.toneMapped=t.toneMapped,this.userData=JSON.parse(JSON.stringify(t.userData)),this.clipShadows=t.clipShadows,this.clipIntersection=t.clipIntersection,n=null,null!==(e=t.clippingPlanes))for(i=e.length,n=Array(i),r=0;r!==i;++r)n[r]=e[r].clone();return this.clippingPlanes=n,this.shadowSide=t.shadowSide,this},dispose:function(){this.dispatchEvent({type:"dispose"})}}),T.prototype=Object.create(S.prototype),T.prototype.constructor=T,T.prototype.isMeshBasicMaterial=1,T.prototype.copy=function(t){return S.prototype.copy.call(this,t),this.color.copy(t.color),this.map=t.map,this.lightMap=t.lightMap,this.lightMapIntensity=t.lightMapIntensity,this.aoMap=t.aoMap,this.aoMapIntensity=t.aoMapIntensity,this.specularMap=t.specularMap,this.alphaMap=t.alphaMap,this.envMap=t.envMap,this.combine=t.combine,this.reflectivity=t.reflectivity,this.refractionRatio=t.refractionRatio,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.wireframeLinecap=t.wireframeLinecap,this.wireframeLinejoin=t.wireframeLinejoin,this.skinning=t.skinning,this.morphTargets=t.morphTargets,this},Object.defineProperty(A.prototype,"needsUpdate",{set:function(t){1==t&&this.version++}}),Object.assign(A.prototype,{isBufferAttribute:1,onUploadCallback:function(){},setDynamic:function(t){return this.dynamic=t,this},copy:function(t){return this.name=t.name,this.array=new t.array.constructor(t.array),this.itemSize=t.itemSize,this.count=t.count,this.normalized=t.normalized,this.dynamic=t.dynamic,this},copyAt:function(t,e,n){t*=this.itemSize,n*=e.itemSize;for(var i=0,r=this.itemSize;i0,S=w[1]&&w[1].length>0,T=t.morphTargets,A=T.length;if(A>0){for(n=[],i=0;i0){for(a=[],i=0;i0&&b.length,i=0;i65535?D:N)(t,1):t},addAttribute:function(t,e,n){return e&&e.isBufferAttribute||e&&e.isInterleavedBufferAttribute?"index"===t?(this.setIndex(e),this):this.setAttribute(t,e):this.addAttribute(t,new A(e,n))},getAttribute:function(t){return this.attributes[t]},setAttribute:function(t,e){return this.attributes[t]=e,this},removeAttribute:function(t){return delete this.attributes[t],this},addGroup:function(t,e,n){this.groups.push({start:t,count:e,materialIndex:void 0!==n?n:0})},clearGroups:function(){this.groups=[]},setDrawRange:function(t,e){this.drawRange.start=t,this.drawRange.count=e},applyMatrix:function(t){var e,n,i=this.attributes.position;return void 0!==i&&(t.applyToBufferAttribute(i),i.needsUpdate=1),void 0!==(e=this.attributes.normal)&&((new r).getNormalMatrix(t).applyToBufferAttribute(e),e.needsUpdate=1),void 0!==(n=this.attributes.tangent)&&((new r).getNormalMatrix(t).applyToBufferAttribute(n),n.needsUpdate=1),null!==this.boundingBox&&this.computeBoundingBox(),null!==this.boundingSphere&&this.computeBoundingSphere(),this},rotateX:function(t){return dl.makeRotationX(t),this.applyMatrix(dl),this},rotateY:function(t){return dl.makeRotationY(t),this.applyMatrix(dl),this},rotateZ:function(t){return dl.makeRotationZ(t),this.applyMatrix(dl),this},translate:function(t,e,n){return dl.makeTranslation(t,e,n),this.applyMatrix(dl),this},scale:function(t,e,n){return dl.makeScale(t,e,n),this.applyMatrix(dl),this},lookAt:function(t){return fl.lookAt(t),fl.updateMatrix(),this.applyMatrix(fl.matrix),this},center:function(){return this.computeBoundingBox(),this.boundingBox.getCenter(ml).negate(),this.translate(ml.x,ml.y,ml.z),this},setFromObject:function(t){var e,n,i,r=t.geometry;return t.isPoints||t.isLine?(e=new I(3*r.vertices.length,3),n=new I(3*r.colors.length,3),this.addAttribute("position",e.copyVector3sArray(r.vertices)),this.addAttribute("color",n.copyColorsArray(r.colors)),r.lineDistances&&r.lineDistances.length===r.vertices.length&&(i=new I(r.lineDistances.length,1),this.addAttribute("lineDistance",i.copyArray(r.lineDistances))),null!==r.boundingSphere&&(this.boundingSphere=r.boundingSphere.clone()),null!==r.boundingBox&&(this.boundingBox=r.boundingBox.clone())):t.isMesh&&r&&r.isGeometry&&this.fromGeometry(r),this},setFromPoints:function(t){var e,n,i,r=[];for(e=0,n=t.length;e0&&(e=new Float32Array(3*t.normals.length),this.addAttribute("normal",new A(e,3).copyVector3sArray(t.normals))),t.colors.length>0&&(n=new Float32Array(3*t.colors.length),this.addAttribute("color",new A(n,3).copyColorsArray(t.colors))),t.uvs.length>0&&(i=new Float32Array(2*t.uvs.length),this.addAttribute("uv",new A(i,2).copyVector2sArray(t.uvs))),t.uvs2.length>0&&(r=new Float32Array(2*t.uvs2.length),this.addAttribute("uv2",new A(r,2).copyVector2sArray(t.uvs2))),this.groups=t.groups,t.morphTargets){for(a=[],c=0,l=(s=t.morphTargets[o]).length;c0&&(p=new I(4*t.skinIndices.length,4),this.addAttribute("skinIndex",p.copyVector4sArray(t.skinIndices))),t.skinWeights.length>0&&(d=new I(4*t.skinWeights.length,4),this.addAttribute("skinWeight",d.copyVector4sArray(t.skinWeights))),null!==t.boundingSphere&&(this.boundingSphere=t.boundingSphere.clone()),null!==t.boundingBox&&(this.boundingBox=t.boundingBox.clone()),this},computeBoundingBox:function(){var t,e,n,i,r;if(null===this.boundingBox&&(this.boundingBox=new f),t=this.attributes.position,e=this.morphAttributes.position,void 0!==t){if(this.boundingBox.setFromBufferAttribute(t),e)for(n=0,i=e.length;n0&&(f.userData=this.userData),void 0!==this.parameters){for(e in t=this.parameters)void 0!==t[e]&&(f[e]=t[e]);return f}for(e in f.data={attributes:{}},null!==(n=this.index)&&(f.data.index={type:n.array.constructor.name,array:Array.prototype.slice.call(n.array)}),i=this.attributes)o=(r=i[e]).toJSON(),""!==r.name&&(o.name=r.name),f.data.attributes[e]=o;for(e in a={},s=0,this.morphAttributes){for(l=[],u=0,h=(c=this.morphAttributes[e]).length;u0&&(a[e]=l,s=1)}return s&&(f.data.morphAttributes=a),(p=this.groups).length>0&&(f.data.groups=JSON.parse(JSON.stringify(p))),null!==(d=this.boundingSphere)&&(f.data.boundingSphere={center:d.center.toArray(),radius:d.radius}),f},clone:function(){return(new k).copy(this)},copy:function(t){var e,n,i,r,o,a,s,c,l,u,h,p,d;for(e in this.index=null,this.attributes={},this.morphAttributes={},this.groups=[],this.boundingBox=null,this.boundingSphere=null,this.name=t.name,null!==(r=t.index)&&this.setIndex(r.clone()),o=t.attributes)a=o[e],this.addAttribute(e,a.clone());for(e in s=t.morphAttributes){for(c=[],n=0,i=(l=s[e]).length;n0&&void 0!==(o=i[r[0]]))for(this.morphTargetInfluences=[],this.morphTargetDictionary={},t=0,e=o.length;t0&&(L=C),P=0,E=A.length;P0)for(l=0;l0&&(this.normalsNeedUpdate=1)},computeFlatVertexNormals:function(){var t,e,n,i;for(this.computeFaceNormals(),t=0,e=this.faces.length;t0&&(this.normalsNeedUpdate=1)},computeMorphNormals:function(){var t,e,n,r,o,a,s,c,l,u,h;for(n=0,r=this.faces.length;n=0;n--)for(u=c[n],this.faces.splice(u,1),a=0,s=this.faceVertexUvs.length;a0,x=g.vertexNormals.length>0,b=1!==g.color.r||1!==g.color.g||1!==g.color.b,_=g.vertexColors.length>0,w=t(w=0,0,0),w=t(w,1,1),w=t(w,2,0),w=t(w,3,v),w=t(w,4,y),w=t(w,5,x),w=t(w,6,b),w=t(w,7,_),l.push(w),l.push(g.a,g.b,g.c),l.push(g.materialIndex),v&&(M=this.faceVertexUvs[0][s],l.push(i(M[0]),i(M[1]),i(M[2]))),y&&l.push(e(g.normal)),x&&(S=g.vertexNormals,l.push(e(S[0]),e(S[1]),e(S[2]))),b&&l.push(n(g.color)),_&&(T=g.vertexColors,l.push(n(T[0]),n(T[1]),n(T[2])));return A.data={},A.data.vertices=a,A.data.normals=u,p.length>0&&(A.data.colors=p),f.length>0&&(A.data.uvs=[f]),A.data.faces=l,A},clone:function(){return(new V).copy(this)},copy:function(t){var e,n,i,r,o,a,s,c,l,u,h,p,d,f,m,g,v,y,x,b,_,w,M,S;for(this.vertices=[],this.colors=[],this.faces=[],this.faceVertexUvs=[[]],this.morphTargets=[],this.morphNormals=[],this.skinWeights=[],this.skinIndices=[],this.lineDistances=[],this.boundingBox=null,this.boundingSphere=null,this.name=t.name,e=0,n=(s=t.vertices).length;e0?1:-1,h.push(R.x,R.y,R.z),p.push(x/g),p.push(1-b/v),I+=1;for(b=0;b0&&(o.defines=this.defines),o.vertexShader=this.vertexShader,o.fragmentShader=this.fragmentShader,i={},this.extensions)1==this.extensions[r]&&(i[r]=1);return Object.keys(i).length>0&&(o.extensions=i),o},q.prototype=Object.assign(Object.create(p.prototype),{constructor:q,isCamera:1,copy:function(t,e){return p.prototype.copy.call(this,t,e),this.matrixWorldInverse.copy(t.matrixWorldInverse),this.projectionMatrix.copy(t.projectionMatrix),this.projectionMatrixInverse.copy(t.projectionMatrixInverse),this},getWorldDirection:function(t){void 0===t&&(t=new i),this.updateMatrixWorld(1);var e=this.matrixWorld.elements;return t.set(-e[8],-e[9],-e[10]).normalize()},updateMatrixWorld:function(t){p.prototype.updateMatrixWorld.call(this,t),this.matrixWorldInverse.getInverse(this.matrixWorld)},clone:function(){return(new this.constructor).copy(this)}}),X.prototype=Object.assign(Object.create(q.prototype),{constructor:X,isPerspectiveCamera:1,copy:function(t,e){return q.prototype.copy.call(this,t,e),this.fov=t.fov,this.zoom=t.zoom,this.near=t.near,this.far=t.far,this.focus=t.focus,this.aspect=t.aspect,this.view=null===t.view?null:Object.assign({},t.view),this.filmGauge=t.filmGauge,this.filmOffset=t.filmOffset,this},setFocalLength:function(t){var e=.5*this.getFilmHeight()/t;this.fov=2*ic.RAD2DEG*Math.atan(e),this.updateProjectionMatrix()},getFocalLength:function(){var t=Math.tan(.5*ic.DEG2RAD*this.fov);return.5*this.getFilmHeight()/t},getEffectiveFOV:function(){return 2*ic.RAD2DEG*Math.atan(Math.tan(.5*ic.DEG2RAD*this.fov)/this.zoom)},getFilmWidth:function(){return this.filmGauge*Math.min(this.aspect,1)},getFilmHeight:function(){return this.filmGauge/Math.max(this.aspect,1)},setViewOffset:function(t,e,n,i,r,o){this.aspect=t/e,null===this.view&&(this.view={enabled:1,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1}),this.view.enabled=1,this.view.fullWidth=t,this.view.fullHeight=e,this.view.offsetX=n,this.view.offsetY=i,this.view.width=r,this.view.height=o,this.updateProjectionMatrix()},clearViewOffset:function(){null!==this.view&&(this.view.enabled=0),this.updateProjectionMatrix()},updateProjectionMatrix:function(){var t,e,n,i=this.near,r=i*Math.tan(.5*ic.DEG2RAD*this.fov)/this.zoom,o=2*r,a=this.aspect*o,s=-.5*a,c=this.view;null!==this.view&&this.view.enabled&&(t=c.fullWidth,e=c.fullHeight,s+=c.offsetX*a/t,r-=c.offsetY*o/e,a*=c.width/t,o*=c.height/e),0!==(n=this.filmOffset)&&(s+=i*n/this.getFilmWidth()),this.projectionMatrix.makePerspective(s,s+a,r,r-o,i,this.far),this.projectionMatrixInverse.getInverse(this.projectionMatrix)},toJSON:function(t){var e=p.prototype.toJSON.call(this,t);return e.object.fov=this.fov,e.object.zoom=this.zoom,e.object.near=this.near,e.object.far=this.far,e.object.focus=this.focus,e.object.aspect=this.aspect,null!==this.view&&(e.object.view=Object.assign({},this.view)),e.object.filmGauge=this.filmGauge,e.object.filmOffset=this.filmOffset,e}}),Vl=90,Gl=1,Y.prototype=Object.create(p.prototype),Y.prototype.constructor=Y,Z.prototype=Object.create(s.prototype),Z.prototype.constructor=Z,Z.prototype.isWebGLRenderTargetCube=1,Z.prototype.fromEquirectangularTexture=function(t,e){var n,i,r,o,a;return this.texture.type=e.type,this.texture.format=e.format,this.texture.encoding=e.encoding,n=new d,(r=new H({type:"CubemapFromEquirect",uniforms:G((i={uniforms:{tEquirect:{value:null}},vertexShader:"varying vec3 vWorldDirection;\nvec3 transformDirection( in vec3 dir, in mat4 matrix ) {\n\treturn normalize( ( matrix * vec4( dir, 0.0 ) ).xyz );\n}\nvoid main() {\n\tvWorldDirection = transformDirection( position, modelMatrix );\n\t#include \n\t#include \n}",fragmentShader:"uniform sampler2D tEquirect;\nvarying vec3 vWorldDirection;\n#define RECIPROCAL_PI 0.31830988618\n#define RECIPROCAL_PI2 0.15915494\nvoid main() {\n\tvec3 direction = normalize( vWorldDirection );\n\tvec2 sampleUV;\n\tsampleUV.y = asin( clamp( direction.y, - 1.0, 1.0 ) ) * RECIPROCAL_PI + 0.5;\n\tsampleUV.x = atan( direction.z, direction.x ) * RECIPROCAL_PI2 + 0.5;\n\tgl_FragColor = texture2D( tEquirect, sampleUV );\n}"}).uniforms),vertexShader:i.vertexShader,fragmentShader:i.fragmentShader,side:jo,blending:qo})).uniforms.tEquirect.value=e,o=new B(new up(5,5,5),r),n.add(o),(a=new Y(1,10,1)).renderTarget=this,a.renderTarget.texture.name="CubeCameraTexture",a.update(t,n),o.geometry.dispose(),o.material.dispose(),this},J.prototype=Object.create(o.prototype),J.prototype.constructor=J,J.prototype.isDataTexture=1,Wl=new i,Hl=new i,ql=new r,Object.assign($.prototype,{isPlane:1,set:function(t,e){return this.normal.copy(t),this.constant=e,this},setComponents:function(t,e,n,i){return this.normal.set(t,e,n),this.constant=i,this},setFromNormalAndCoplanarPoint:function(t,e){return this.normal.copy(t),this.constant=-e.dot(this.normal),this},setFromCoplanarPoints:function(t,e,n){var i=Wl.subVectors(n,e).cross(Hl.subVectors(t,e)).normalize();return this.setFromNormalAndCoplanarPoint(i,t),this},clone:function(){return(new this.constructor).copy(this)},copy:function(t){return this.normal.copy(t.normal),this.constant=t.constant,this},normalize:function(){var t=1/this.normal.length();return this.normal.multiplyScalar(t),this.constant*=t,this},negate:function(){return this.constant*=-1,this.normal.negate(),this},distanceToPoint:function(t){return this.normal.dot(t)+this.constant},distanceToSphere:function(t){return this.distanceToPoint(t.center)-t.radius},projectPoint:function(t,e){return void 0===e&&(e=new i),e.copy(this.normal).multiplyScalar(-this.distanceToPoint(t)).add(t)},intersectLine:function(t,e){var n,r,o;return void 0===e&&(e=new i),n=t.delta(Wl),0===(r=this.normal.dot(n))?0===this.distanceToPoint(t.start)?e.copy(t.start):void 0:(o=-(t.start.dot(this.normal)+this.constant)/r)<0||o>1?void 0:e.copy(n).multiplyScalar(o).add(t.start)},intersectsLine:function(t){var e=this.distanceToPoint(t.start),n=this.distanceToPoint(t.end);return e<0&&n>0||n<0&&e>0},intersectsBox:function(t){return t.intersectsPlane(this)},intersectsSphere:function(t){return t.intersectsPlane(this)},coplanarPoint:function(t){return void 0===t&&(t=new i),t.copy(this.normal).multiplyScalar(-this.constant)},applyMatrix4:function(t,e){var n=e||ql.getNormalMatrix(t),i=this.coplanarPoint(Wl).applyMatrix4(t),r=this.normal.applyMatrix3(n).normalize();return this.constant=-i.dot(r),this},translate:function(t){return this.constant-=t.dot(this.normal),this},equals:function(t){return t.normal.equals(this.normal)&&t.constant===this.constant}}),Xl=new g,Yl=new i,Object.assign(Q.prototype,{set:function(t,e,n,i,r,o){var a=this.planes;return a[0].copy(t),a[1].copy(e),a[2].copy(n),a[3].copy(i),a[4].copy(r),a[5].copy(o),this},clone:function(){return(new this.constructor).copy(this)},copy:function(t){var e,n=this.planes;for(e=0;e<6;e++)n[e].copy(t.planes[e]);return this},setFromMatrix:function(t){var e=this.planes,n=t.elements,i=n[0],r=n[1],o=n[2],a=n[3],s=n[4],c=n[5],l=n[6],u=n[7],h=n[8],p=n[9],d=n[10],f=n[11],m=n[12],g=n[13],v=n[14],y=n[15];return e[0].setComponents(a-i,u-s,f-h,y-m).normalize(),e[1].setComponents(a+i,u+s,f+h,y+m).normalize(),e[2].setComponents(a+r,u+c,f+p,y+g).normalize(),e[3].setComponents(a-r,u-c,f-p,y-g).normalize(),e[4].setComponents(a-o,u-l,f-d,y-v).normalize(),e[5].setComponents(a+o,u+l,f+d,y+v).normalize(),this},intersectsObject:function(t){var e=t.geometry;return null===e.boundingSphere&&e.computeBoundingSphere(),Xl.copy(e.boundingSphere).applyMatrix4(t.matrixWorld),this.intersectsSphere(Xl)},intersectsSprite:function(t){return Xl.center.set(0,0,0),Xl.radius=.7071067811865476,Xl.applyMatrix4(t.matrixWorld),this.intersectsSphere(Xl)},intersectsSphere:function(t){var e,n=this.planes,i=t.center,r=-t.radius;for(e=0;e<6;e++)if(n[e].distanceToPoint(i)0?t.max.x:t.min.x,Yl.y=n.normal.y>0?t.max.y:t.min.y,Yl.z=n.normal.z>0?t.max.z:t.min.z,n.distanceToPoint(Yl)<0)return 0;return 1},containsPoint:function(t){var e,n=this.planes;for(e=0;e<6;e++)if(n[e].distanceToPoint(t)<0)return 0;return 1}}),Zl={alphamap_fragment:"#ifdef USE_ALPHAMAP\n\tdiffuseColor.a *= texture2D( alphaMap, vUv ).g;\n#endif",alphamap_pars_fragment:"#ifdef USE_ALPHAMAP\n\tuniform sampler2D alphaMap;\n#endif",alphatest_fragment:"#ifdef ALPHATEST\n\tif ( diffuseColor.a < ALPHATEST ) discard;\n#endif",aomap_fragment:"#ifdef USE_AOMAP\n\tfloat ambientOcclusion = ( texture2D( aoMap, vUv2 ).r - 1.0 ) * aoMapIntensity + 1.0;\n\treflectedLight.indirectDiffuse *= ambientOcclusion;\n\t#if defined( USE_ENVMAP ) && defined( STANDARD )\n\t\tfloat dotNV = saturate( dot( geometry.normal, geometry.viewDir ) );\n\t\treflectedLight.indirectSpecular *= computeSpecularOcclusion( dotNV, ambientOcclusion, material.specularRoughness );\n\t#endif\n#endif",aomap_pars_fragment:"#ifdef USE_AOMAP\n\tuniform sampler2D aoMap;\n\tuniform float aoMapIntensity;\n#endif",begin_vertex:"vec3 transformed = vec3( position );",beginnormal_vertex:"vec3 objectNormal = vec3( normal );\n#ifdef USE_TANGENT\n\tvec3 objectTangent = vec3( tangent.xyz );\n#endif",bsdfs:"vec2 integrateSpecularBRDF( const in float dotNV, const in float roughness ) {\n\tconst vec4 c0 = vec4( - 1, - 0.0275, - 0.572, 0.022 );\n\tconst vec4 c1 = vec4( 1, 0.0425, 1.04, - 0.04 );\n\tvec4 r = roughness * c0 + c1;\n\tfloat a004 = min( r.x * r.x, exp2( - 9.28 * dotNV ) ) * r.x + r.y;\n\treturn vec2( -1.04, 1.04 ) * a004 + r.zw;\n}\nfloat punctualLightIntensityToIrradianceFactor( const in float lightDistance, const in float cutoffDistance, const in float decayExponent ) {\n#if defined ( PHYSICALLY_CORRECT_LIGHTS )\n\tfloat distanceFalloff = 1.0 / max( pow( lightDistance, decayExponent ), 0.01 );\n\tif( cutoffDistance > 0.0 ) {\n\t\tdistanceFalloff *= pow2( saturate( 1.0 - pow4( lightDistance / cutoffDistance ) ) );\n\t}\n\treturn distanceFalloff;\n#else\n\tif( cutoffDistance > 0.0 && decayExponent > 0.0 ) {\n\t\treturn pow( saturate( -lightDistance / cutoffDistance + 1.0 ), decayExponent );\n\t}\n\treturn 1.0;\n#endif\n}\nvec3 BRDF_Diffuse_Lambert( const in vec3 diffuseColor ) {\n\treturn RECIPROCAL_PI * diffuseColor;\n}\nvec3 F_Schlick( const in vec3 specularColor, const in float dotLH ) {\n\tfloat fresnel = exp2( ( -5.55473 * dotLH - 6.98316 ) * dotLH );\n\treturn ( 1.0 - specularColor ) * fresnel + specularColor;\n}\nvec3 F_Schlick_RoughnessDependent( const in vec3 F0, const in float dotNV, const in float roughness ) {\n\tfloat fresnel = exp2( ( -5.55473 * dotNV - 6.98316 ) * dotNV );\n\tvec3 Fr = max( vec3( 1.0 - roughness ), F0 ) - F0;\n\treturn Fr * fresnel + F0;\n}\nfloat G_GGX_Smith( const in float alpha, const in float dotNL, const in float dotNV ) {\n\tfloat a2 = pow2( alpha );\n\tfloat gl = dotNL + sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNL ) );\n\tfloat gv = dotNV + sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNV ) );\n\treturn 1.0 / ( gl * gv );\n}\nfloat G_GGX_SmithCorrelated( const in float alpha, const in float dotNL, const in float dotNV ) {\n\tfloat a2 = pow2( alpha );\n\tfloat gv = dotNL * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNV ) );\n\tfloat gl = dotNV * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNL ) );\n\treturn 0.5 / max( gv + gl, EPSILON );\n}\nfloat D_GGX( const in float alpha, const in float dotNH ) {\n\tfloat a2 = pow2( alpha );\n\tfloat denom = pow2( dotNH ) * ( a2 - 1.0 ) + 1.0;\n\treturn RECIPROCAL_PI * a2 / pow2( denom );\n}\nvec3 BRDF_Specular_GGX( const in IncidentLight incidentLight, const in vec3 viewDir, const in vec3 normal, const in vec3 specularColor, const in float roughness ) {\n\tfloat alpha = pow2( roughness );\n\tvec3 halfDir = normalize( incidentLight.direction + viewDir );\n\tfloat dotNL = saturate( dot( normal, incidentLight.direction ) );\n\tfloat dotNV = saturate( dot( normal, viewDir ) );\n\tfloat dotNH = saturate( dot( normal, halfDir ) );\n\tfloat dotLH = saturate( dot( incidentLight.direction, halfDir ) );\n\tvec3 F = F_Schlick( specularColor, dotLH );\n\tfloat G = G_GGX_SmithCorrelated( alpha, dotNL, dotNV );\n\tfloat D = D_GGX( alpha, dotNH );\n\treturn F * ( G * D );\n}\nvec2 LTC_Uv( const in vec3 N, const in vec3 V, const in float roughness ) {\n\tconst float LUT_SIZE = 64.0;\n\tconst float LUT_SCALE = ( LUT_SIZE - 1.0 ) / LUT_SIZE;\n\tconst float LUT_BIAS = 0.5 / LUT_SIZE;\n\tfloat dotNV = saturate( dot( N, V ) );\n\tvec2 uv = vec2( roughness, sqrt( 1.0 - dotNV ) );\n\tuv = uv * LUT_SCALE + LUT_BIAS;\n\treturn uv;\n}\nfloat LTC_ClippedSphereFormFactor( const in vec3 f ) {\n\tfloat l = length( f );\n\treturn max( ( l * l + f.z ) / ( l + 1.0 ), 0.0 );\n}\nvec3 LTC_EdgeVectorFormFactor( const in vec3 v1, const in vec3 v2 ) {\n\tfloat x = dot( v1, v2 );\n\tfloat y = abs( x );\n\tfloat a = 0.8543985 + ( 0.4965155 + 0.0145206 * y ) * y;\n\tfloat b = 3.4175940 + ( 4.1616724 + y ) * y;\n\tfloat v = a / b;\n\tfloat theta_sintheta = ( x > 0.0 ) ? v : 0.5 * inversesqrt( max( 1.0 - x * x, 1e-7 ) ) - v;\n\treturn cross( v1, v2 ) * theta_sintheta;\n}\nvec3 LTC_Evaluate( const in vec3 N, const in vec3 V, const in vec3 P, const in mat3 mInv, const in vec3 rectCoords[ 4 ] ) {\n\tvec3 v1 = rectCoords[ 1 ] - rectCoords[ 0 ];\n\tvec3 v2 = rectCoords[ 3 ] - rectCoords[ 0 ];\n\tvec3 lightNormal = cross( v1, v2 );\n\tif( dot( lightNormal, P - rectCoords[ 0 ] ) < 0.0 ) return vec3( 0.0 );\n\tvec3 T1, T2;\n\tT1 = normalize( V - N * dot( V, N ) );\n\tT2 = - cross( N, T1 );\n\tmat3 mat = mInv * transposeMat3( mat3( T1, T2, N ) );\n\tvec3 coords[ 4 ];\n\tcoords[ 0 ] = mat * ( rectCoords[ 0 ] - P );\n\tcoords[ 1 ] = mat * ( rectCoords[ 1 ] - P );\n\tcoords[ 2 ] = mat * ( rectCoords[ 2 ] - P );\n\tcoords[ 3 ] = mat * ( rectCoords[ 3 ] - P );\n\tcoords[ 0 ] = normalize( coords[ 0 ] );\n\tcoords[ 1 ] = normalize( coords[ 1 ] );\n\tcoords[ 2 ] = normalize( coords[ 2 ] );\n\tcoords[ 3 ] = normalize( coords[ 3 ] );\n\tvec3 vectorFormFactor = vec3( 0.0 );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 0 ], coords[ 1 ] );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 1 ], coords[ 2 ] );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 2 ], coords[ 3 ] );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 3 ], coords[ 0 ] );\n\tfloat result = LTC_ClippedSphereFormFactor( vectorFormFactor );\n\treturn vec3( result );\n}\nvec3 BRDF_Specular_GGX_Environment( const in vec3 viewDir, const in vec3 normal, const in vec3 specularColor, const in float roughness ) {\n\tfloat dotNV = saturate( dot( normal, viewDir ) );\n\tvec2 brdf = integrateSpecularBRDF( dotNV, roughness );\n\treturn specularColor * brdf.x + brdf.y;\n}\nvoid BRDF_Specular_Multiscattering_Environment( const in GeometricContext geometry, const in vec3 specularColor, const in float roughness, inout vec3 singleScatter, inout vec3 multiScatter ) {\n\tfloat dotNV = saturate( dot( geometry.normal, geometry.viewDir ) );\n\tvec3 F = F_Schlick_RoughnessDependent( specularColor, dotNV, roughness );\n\tvec2 brdf = integrateSpecularBRDF( dotNV, roughness );\n\tvec3 FssEss = F * brdf.x + brdf.y;\n\tfloat Ess = brdf.x + brdf.y;\n\tfloat Ems = 1.0 - Ess;\n\tvec3 Favg = specularColor + ( 1.0 - specularColor ) * 0.047619;\tvec3 Fms = FssEss * Favg / ( 1.0 - Ems * Favg );\n\tsingleScatter += FssEss;\n\tmultiScatter += Fms * Ems;\n}\nfloat G_BlinnPhong_Implicit( ) {\n\treturn 0.25;\n}\nfloat D_BlinnPhong( const in float shininess, const in float dotNH ) {\n\treturn RECIPROCAL_PI * ( shininess * 0.5 + 1.0 ) * pow( dotNH, shininess );\n}\nvec3 BRDF_Specular_BlinnPhong( const in IncidentLight incidentLight, const in GeometricContext geometry, const in vec3 specularColor, const in float shininess ) {\n\tvec3 halfDir = normalize( incidentLight.direction + geometry.viewDir );\n\tfloat dotNH = saturate( dot( geometry.normal, halfDir ) );\n\tfloat dotLH = saturate( dot( incidentLight.direction, halfDir ) );\n\tvec3 F = F_Schlick( specularColor, dotLH );\n\tfloat G = G_BlinnPhong_Implicit( );\n\tfloat D = D_BlinnPhong( shininess, dotNH );\n\treturn F * ( G * D );\n}\nfloat GGXRoughnessToBlinnExponent( const in float ggxRoughness ) {\n\treturn ( 2.0 / pow2( ggxRoughness + 0.0001 ) - 2.0 );\n}\nfloat BlinnExponentToGGXRoughness( const in float blinnExponent ) {\n\treturn sqrt( 2.0 / ( blinnExponent + 2.0 ) );\n}\n#if defined( USE_SHEEN )\nfloat D_Charlie(float roughness, float NoH) {\n\tfloat invAlpha = 1.0 / roughness;\n\tfloat cos2h = NoH * NoH;\n\tfloat sin2h = max(1.0 - cos2h, 0.0078125);\treturn (2.0 + invAlpha) * pow(sin2h, invAlpha * 0.5) / (2.0 * PI);\n}\nfloat V_Neubelt(float NoV, float NoL) {\n\treturn saturate(1.0 / (4.0 * (NoL + NoV - NoL * NoV)));\n}\nvec3 BRDF_Specular_Sheen( const in float roughness, const in vec3 L, const in GeometricContext geometry, vec3 specularColor ) {\n\tvec3 N = geometry.normal;\n\tvec3 V = geometry.viewDir;\n\tvec3 H = normalize( V + L );\n\tfloat dotNH = saturate( dot( N, H ) );\n\treturn specularColor * D_Charlie( roughness, dotNH ) * V_Neubelt( dot(N, V), dot(N, L) );\n}\n#endif",bumpmap_pars_fragment:"#ifdef USE_BUMPMAP\n\tuniform sampler2D bumpMap;\n\tuniform float bumpScale;\n\tvec2 dHdxy_fwd() {\n\t\tvec2 dSTdx = dFdx( vUv );\n\t\tvec2 dSTdy = dFdy( vUv );\n\t\tfloat Hll = bumpScale * texture2D( bumpMap, vUv ).x;\n\t\tfloat dBx = bumpScale * texture2D( bumpMap, vUv + dSTdx ).x - Hll;\n\t\tfloat dBy = bumpScale * texture2D( bumpMap, vUv + dSTdy ).x - Hll;\n\t\treturn vec2( dBx, dBy );\n\t}\n\tvec3 perturbNormalArb( vec3 surf_pos, vec3 surf_norm, vec2 dHdxy ) {\n\t\tvec3 vSigmaX = vec3( dFdx( surf_pos.x ), dFdx( surf_pos.y ), dFdx( surf_pos.z ) );\n\t\tvec3 vSigmaY = vec3( dFdy( surf_pos.x ), dFdy( surf_pos.y ), dFdy( surf_pos.z ) );\n\t\tvec3 vN = surf_norm;\n\t\tvec3 R1 = cross( vSigmaY, vN );\n\t\tvec3 R2 = cross( vN, vSigmaX );\n\t\tfloat fDet = dot( vSigmaX, R1 );\n\t\tfDet *= ( float( gl_FrontFacing ) * 2.0 - 1.0 );\n\t\tvec3 vGrad = sign( fDet ) * ( dHdxy.x * R1 + dHdxy.y * R2 );\n\t\treturn normalize( abs( fDet ) * surf_norm - vGrad );\n\t}\n#endif",clipping_planes_fragment:"#if NUM_CLIPPING_PLANES > 0\n\tvec4 plane;\n\t#pragma unroll_loop\n\tfor ( int i = 0; i < UNION_CLIPPING_PLANES; i ++ ) {\n\t\tplane = clippingPlanes[ i ];\n\t\tif ( dot( vViewPosition, plane.xyz ) > plane.w ) discard;\n\t}\n\t#if UNION_CLIPPING_PLANES < NUM_CLIPPING_PLANES\n\t\tbool clipped = true;\n\t\t#pragma unroll_loop\n\t\tfor ( int i = UNION_CLIPPING_PLANES; i < NUM_CLIPPING_PLANES; i ++ ) {\n\t\t\tplane = clippingPlanes[ i ];\n\t\t\tclipped = ( dot( vViewPosition, plane.xyz ) > plane.w ) && clipped;\n\t\t}\n\t\tif ( clipped ) discard;\n\t#endif\n#endif",clipping_planes_pars_fragment:"#if NUM_CLIPPING_PLANES > 0\n\t#if ! defined( STANDARD ) && ! defined( PHONG ) && ! defined( MATCAP )\n\t\tvarying vec3 vViewPosition;\n\t#endif\n\tuniform vec4 clippingPlanes[ NUM_CLIPPING_PLANES ];\n#endif",clipping_planes_pars_vertex:"#if NUM_CLIPPING_PLANES > 0 && ! defined( STANDARD ) && ! defined( PHONG ) && ! defined( MATCAP )\n\tvarying vec3 vViewPosition;\n#endif",clipping_planes_vertex:"#if NUM_CLIPPING_PLANES > 0 && ! defined( STANDARD ) && ! defined( PHONG ) && ! defined( MATCAP )\n\tvViewPosition = - mvPosition.xyz;\n#endif",color_fragment:"#ifdef USE_COLOR\n\tdiffuseColor.rgb *= vColor;\n#endif",color_pars_fragment:"#ifdef USE_COLOR\n\tvarying vec3 vColor;\n#endif",color_pars_vertex:"#ifdef USE_COLOR\n\tvarying vec3 vColor;\n#endif",color_vertex:"#ifdef USE_COLOR\n\tvColor.xyz = color.xyz;\n#endif",common:"#define PI 3.14159265359\n#define PI2 6.28318530718\n#define PI_HALF 1.5707963267949\n#define RECIPROCAL_PI 0.31830988618\n#define RECIPROCAL_PI2 0.15915494\n#define LOG2 1.442695\n#define EPSILON 1e-6\n#ifndef saturate\n#define saturate(a) clamp( a, 0.0, 1.0 )\n#endif\n#define whiteComplement(a) ( 1.0 - saturate( a ) )\nfloat pow2( const in float x ) { return x*x; }\nfloat pow3( const in float x ) { return x*x*x; }\nfloat pow4( const in float x ) { float x2 = x*x; return x2*x2; }\nfloat average( const in vec3 color ) { return dot( color, vec3( 0.3333 ) ); }\nhighp float rand( const in vec2 uv ) {\n\tconst highp float a = 12.9898, b = 78.233, c = 43758.5453;\n\thighp float dt = dot( uv.xy, vec2( a,b ) ), sn = mod( dt, PI );\n\treturn fract(sin(sn) * c);\n}\n#ifdef HIGH_PRECISION\n\tfloat precisionSafeLength( vec3 v ) { return length( v ); }\n#else\n\tfloat max3( vec3 v ) { return max( max( v.x, v.y ), v.z ); }\n\tfloat precisionSafeLength( vec3 v ) {\n\t\tfloat maxComponent = max3( abs( v ) );\n\t\treturn length( v / maxComponent ) * maxComponent;\n\t}\n#endif\nstruct IncidentLight {\n\tvec3 color;\n\tvec3 direction;\n\tbool visible;\n};\nstruct ReflectedLight {\n\tvec3 directDiffuse;\n\tvec3 directSpecular;\n\tvec3 indirectDiffuse;\n\tvec3 indirectSpecular;\n};\nstruct GeometricContext {\n\tvec3 position;\n\tvec3 normal;\n\tvec3 viewDir;\n#ifdef CLEARCOAT\n\tvec3 clearcoatNormal;\n#endif\n};\nvec3 transformDirection( in vec3 dir, in mat4 matrix ) {\n\treturn normalize( ( matrix * vec4( dir, 0.0 ) ).xyz );\n}\nvec3 inverseTransformDirection( in vec3 dir, in mat4 matrix ) {\n\treturn normalize( ( vec4( dir, 0.0 ) * matrix ).xyz );\n}\nvec3 projectOnPlane(in vec3 point, in vec3 pointOnPlane, in vec3 planeNormal ) {\n\tfloat distance = dot( planeNormal, point - pointOnPlane );\n\treturn - distance * planeNormal + point;\n}\nfloat sideOfPlane( in vec3 point, in vec3 pointOnPlane, in vec3 planeNormal ) {\n\treturn sign( dot( point - pointOnPlane, planeNormal ) );\n}\nvec3 linePlaneIntersect( in vec3 pointOnLine, in vec3 lineDirection, in vec3 pointOnPlane, in vec3 planeNormal ) {\n\treturn lineDirection * ( dot( planeNormal, pointOnPlane - pointOnLine ) / dot( planeNormal, lineDirection ) ) + pointOnLine;\n}\nmat3 transposeMat3( const in mat3 m ) {\n\tmat3 tmp;\n\ttmp[ 0 ] = vec3( m[ 0 ].x, m[ 1 ].x, m[ 2 ].x );\n\ttmp[ 1 ] = vec3( m[ 0 ].y, m[ 1 ].y, m[ 2 ].y );\n\ttmp[ 2 ] = vec3( m[ 0 ].z, m[ 1 ].z, m[ 2 ].z );\n\treturn tmp;\n}\nfloat linearToRelativeLuminance( const in vec3 color ) {\n\tvec3 weights = vec3( 0.2126, 0.7152, 0.0722 );\n\treturn dot( weights, color.rgb );\n}\nbool isPerspectiveMatrix( mat4 m ) {\n return m[ 2 ][ 3 ] == - 1.0;\n}",cube_uv_reflection_fragment:"#ifdef ENVMAP_TYPE_CUBE_UV\n#define cubeUV_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( sampler2D envMap, 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",defaultnormal_vertex:"vec3 transformedNormal = objectNormal;\n#ifdef USE_INSTANCING\n\ttransformedNormal = mat3( instanceMatrix ) * transformedNormal;\n#endif\ntransformedNormal = normalMatrix * transformedNormal;\n#ifdef FLIP_SIDED\n\ttransformedNormal = - transformedNormal;\n#endif\n#ifdef USE_TANGENT\n\tvec3 transformedTangent = normalMatrix * objectTangent;\n\t#ifdef FLIP_SIDED\n\t\ttransformedTangent = - transformedTangent;\n\t#endif\n#endif",displacementmap_pars_vertex:"#ifdef USE_DISPLACEMENTMAP\n\tuniform sampler2D displacementMap;\n\tuniform float displacementScale;\n\tuniform float displacementBias;\n#endif",displacementmap_vertex:"#ifdef USE_DISPLACEMENTMAP\n\ttransformed += normalize( objectNormal ) * ( texture2D( displacementMap, vUv ).x * displacementScale + displacementBias );\n#endif",emissivemap_fragment:"#ifdef USE_EMISSIVEMAP\n\tvec4 emissiveColor = texture2D( emissiveMap, vUv );\n\temissiveColor.rgb = emissiveMapTexelToLinear( emissiveColor ).rgb;\n\ttotalEmissiveRadiance *= emissiveColor.rgb;\n#endif",emissivemap_pars_fragment:"#ifdef USE_EMISSIVEMAP\n\tuniform sampler2D emissiveMap;\n#endif",encodings_fragment:"gl_FragColor = linearToOutputTexel( gl_FragColor );",encodings_pars_fragment:"\nvec4 LinearToLinear( in vec4 value ) {\n\treturn value;\n}\nvec4 GammaToLinear( in vec4 value, in float gammaFactor ) {\n\treturn vec4( pow( value.rgb, vec3( gammaFactor ) ), value.a );\n}\nvec4 LinearToGamma( in vec4 value, in float gammaFactor ) {\n\treturn vec4( pow( value.rgb, vec3( 1.0 / gammaFactor ) ), value.a );\n}\nvec4 sRGBToLinear( in vec4 value ) {\n\treturn vec4( mix( pow( value.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), value.rgb * 0.0773993808, vec3( lessThanEqual( value.rgb, vec3( 0.04045 ) ) ) ), value.a );\n}\nvec4 LinearTosRGB( in vec4 value ) {\n\treturn vec4( mix( pow( value.rgb, vec3( 0.41666 ) ) * 1.055 - vec3( 0.055 ), value.rgb * 12.92, vec3( lessThanEqual( value.rgb, vec3( 0.0031308 ) ) ) ), value.a );\n}\nvec4 RGBEToLinear( in vec4 value ) {\n\treturn vec4( value.rgb * exp2( value.a * 255.0 - 128.0 ), 1.0 );\n}\nvec4 LinearToRGBE( in vec4 value ) {\n\tfloat maxComponent = max( max( value.r, value.g ), value.b );\n\tfloat fExp = clamp( ceil( log2( maxComponent ) ), -128.0, 127.0 );\n\treturn vec4( value.rgb / exp2( fExp ), ( fExp + 128.0 ) / 255.0 );\n}\nvec4 RGBMToLinear( in vec4 value, in float maxRange ) {\n\treturn vec4( value.rgb * value.a * maxRange, 1.0 );\n}\nvec4 LinearToRGBM( in vec4 value, in float maxRange ) {\n\tfloat maxRGB = max( value.r, max( value.g, value.b ) );\n\tfloat M = clamp( maxRGB / maxRange, 0.0, 1.0 );\n\tM = ceil( M * 255.0 ) / 255.0;\n\treturn vec4( value.rgb / ( M * maxRange ), M );\n}\nvec4 RGBDToLinear( in vec4 value, in float maxRange ) {\n\treturn vec4( value.rgb * ( ( maxRange / 255.0 ) / value.a ), 1.0 );\n}\nvec4 LinearToRGBD( in vec4 value, in float maxRange ) {\n\tfloat maxRGB = max( value.r, max( value.g, value.b ) );\n\tfloat D = max( maxRange / maxRGB, 1.0 );\n\tD = min( floor( D ) / 255.0, 1.0 );\n\treturn vec4( value.rgb * ( D * ( 255.0 / maxRange ) ), D );\n}\nconst mat3 cLogLuvM = mat3( 0.2209, 0.3390, 0.4184, 0.1138, 0.6780, 0.7319, 0.0102, 0.1130, 0.2969 );\nvec4 LinearToLogLuv( in vec4 value ) {\n\tvec3 Xp_Y_XYZp = cLogLuvM * value.rgb;\n\tXp_Y_XYZp = max( Xp_Y_XYZp, vec3( 1e-6, 1e-6, 1e-6 ) );\n\tvec4 vResult;\n\tvResult.xy = Xp_Y_XYZp.xy / Xp_Y_XYZp.z;\n\tfloat Le = 2.0 * log2(Xp_Y_XYZp.y) + 127.0;\n\tvResult.w = fract( Le );\n\tvResult.z = ( Le - ( floor( vResult.w * 255.0 ) ) / 255.0 ) / 255.0;\n\treturn vResult;\n}\nconst mat3 cLogLuvInverseM = mat3( 6.0014, -2.7008, -1.7996, -1.3320, 3.1029, -5.7721, 0.3008, -1.0882, 5.6268 );\nvec4 LogLuvToLinear( in vec4 value ) {\n\tfloat Le = value.z * 255.0 + value.w;\n\tvec3 Xp_Y_XYZp;\n\tXp_Y_XYZp.y = exp2( ( Le - 127.0 ) / 2.0 );\n\tXp_Y_XYZp.z = Xp_Y_XYZp.y / value.y;\n\tXp_Y_XYZp.x = value.x * Xp_Y_XYZp.z;\n\tvec3 vRGB = cLogLuvInverseM * Xp_Y_XYZp.rgb;\n\treturn vec4( max( vRGB, 0.0 ), 1.0 );\n}",envmap_fragment:"#ifdef USE_ENVMAP\n\t#ifdef ENV_WORLDPOS\n\t\tvec3 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, vec3( flipEnvMap * reflectVec.x, reflectVec.yz ) );\n\t#elif defined( ENVMAP_TYPE_EQUIREC )\n\t\tvec2 sampleUV;\n\t\treflectVec = normalize( reflectVec );\n\t\tsampleUV.y = asin( clamp( reflectVec.y, - 1.0, 1.0 ) ) * RECIPROCAL_PI + 0.5;\n\t\tsampleUV.x = atan( reflectVec.z, reflectVec.x ) * RECIPROCAL_PI2 + 0.5;\n\t\tvec4 envColor = texture2D( envMap, sampleUV );\n\t#elif defined( ENVMAP_TYPE_SPHERE )\n\t\treflectVec = normalize( reflectVec );\n\t\tvec3 reflectView = normalize( ( viewMatrix * vec4( reflectVec, 0.0 ) ).xyz + vec3( 0.0, 0.0, 1.0 ) );\n\t\tvec4 envColor = texture2D( envMap, reflectView.xy * 0.5 + 0.5 );\n\t#else\n\t\tvec4 envColor = vec4( 0.0 );\n\t#endif\n\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",envmap_common_pars_fragment:"#ifdef USE_ENVMAP\n\tuniform float envMapIntensity;\n\tuniform float flipEnvMap;\n\tuniform int maxMipLevel;\n\t#ifdef ENVMAP_TYPE_CUBE\n\t\tuniform samplerCube envMap;\n\t#else\n\t\tuniform sampler2D envMap;\n\t#endif\n\t\n#endif",envmap_pars_fragment:"#ifdef USE_ENVMAP\n\tuniform float reflectivity;\n\t#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG )\n\t\t#define ENV_WORLDPOS\n\t#endif\n\t#ifdef ENV_WORLDPOS\n\t\tvarying vec3 vWorldPosition;\n\t\tuniform float refractionRatio;\n\t#else\n\t\tvarying vec3 vReflect;\n\t#endif\n#endif",envmap_pars_vertex:"#ifdef USE_ENVMAP\n\t#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) ||defined( PHONG )\n\t\t#define ENV_WORLDPOS\n\t#endif\n\t#ifdef ENV_WORLDPOS\n\t\t\n\t\tvarying vec3 vWorldPosition;\n\t#else\n\t\tvarying vec3 vReflect;\n\t\tuniform float refractionRatio;\n\t#endif\n#endif",envmap_physical_pars_fragment:"#if defined( USE_ENVMAP )\n\t#ifdef ENVMAP_MODE_REFRACTION\n\t\tuniform float refractionRatio;\n\t#endif\n\tvec3 getLightProbeIndirectIrradiance( const in GeometricContext geometry, const in int maxMIPLevel ) {\n\t\tvec3 worldNormal = inverseTransformDirection( geometry.normal, viewMatrix );\n\t\t#ifdef ENVMAP_TYPE_CUBE\n\t\t\tvec3 queryVec = vec3( flipEnvMap * worldNormal.x, worldNormal.yz );\n\t\t\t#ifdef TEXTURE_LOD_EXT\n\t\t\t\tvec4 envMapColor = textureCubeLodEXT( envMap, queryVec, float( maxMIPLevel ) );\n\t\t\t#else\n\t\t\t\tvec4 envMapColor = textureCube( envMap, queryVec, float( maxMIPLevel ) );\n\t\t\t#endif\n\t\t\tenvMapColor.rgb = envMapTexelToLinear( envMapColor ).rgb;\n\t\t#elif defined( ENVMAP_TYPE_CUBE_UV )\n\t\t\tvec3 queryVec = vec3( flipEnvMap * worldNormal.x, worldNormal.yz );\n\t\t\tvec4 envMapColor = textureCubeUV( envMap, queryVec, 1.0 );\n\t\t#else\n\t\t\tvec4 envMapColor = vec4( 0.0 );\n\t\t#endif\n\t\treturn PI * envMapColor.rgb * envMapIntensity;\n\t}\n\tfloat getSpecularMIPLevel( const in float roughness, const in int maxMIPLevel ) {\n\t\tfloat maxMIPLevelScalar = float( maxMIPLevel );\n\t\tfloat sigma = PI * roughness * roughness / ( 1.0 + roughness );\n\t\tfloat desiredMIPLevel = maxMIPLevelScalar + log2( sigma );\n\t\treturn clamp( desiredMIPLevel, 0.0, maxMIPLevelScalar );\n\t}\n\tvec3 getLightProbeIndirectRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness, const in int maxMIPLevel ) {\n\t\t#ifdef ENVMAP_MODE_REFLECTION\n\t\t vec3 reflectVec = reflect( -viewDir, normal );\n\t\t reflectVec = normalize( mix( reflectVec, normal, roughness * roughness) );\n\t\t#else\n\t\t vec3 reflectVec = refract( -viewDir, normal, refractionRatio );\n\t\t#endif\n\t\treflectVec = inverseTransformDirection( reflectVec, viewMatrix );\n\t\tfloat specularMIPLevel = getSpecularMIPLevel( roughness, maxMIPLevel );\n\t\t#ifdef ENVMAP_TYPE_CUBE\n\t\t\tvec3 queryReflectVec = vec3( flipEnvMap * reflectVec.x, reflectVec.yz );\n\t\t\t#ifdef TEXTURE_LOD_EXT\n\t\t\t\tvec4 envMapColor = textureCubeLodEXT( envMap, queryReflectVec, specularMIPLevel );\n\t\t\t#else\n\t\t\t\tvec4 envMapColor = textureCube( envMap, queryReflectVec, specularMIPLevel );\n\t\t\t#endif\n\t\t\tenvMapColor.rgb = envMapTexelToLinear( envMapColor ).rgb;\n\t\t#elif defined( ENVMAP_TYPE_CUBE_UV )\n\t\t\tvec3 queryReflectVec = vec3( flipEnvMap * reflectVec.x, reflectVec.yz );\n\t\t\tvec4 envMapColor = textureCubeUV( envMap, queryReflectVec, roughness );\n\t\t#elif defined( ENVMAP_TYPE_EQUIREC )\n\t\t\tvec2 sampleUV;\n\t\t\tsampleUV.y = asin( clamp( reflectVec.y, - 1.0, 1.0 ) ) * RECIPROCAL_PI + 0.5;\n\t\t\tsampleUV.x = atan( reflectVec.z, reflectVec.x ) * RECIPROCAL_PI2 + 0.5;\n\t\t\t#ifdef TEXTURE_LOD_EXT\n\t\t\t\tvec4 envMapColor = texture2DLodEXT( envMap, sampleUV, specularMIPLevel );\n\t\t\t#else\n\t\t\t\tvec4 envMapColor = texture2D( envMap, sampleUV, specularMIPLevel );\n\t\t\t#endif\n\t\t\tenvMapColor.rgb = envMapTexelToLinear( envMapColor ).rgb;\n\t\t#elif defined( ENVMAP_TYPE_SPHERE )\n\t\t\tvec3 reflectView = normalize( ( viewMatrix * vec4( reflectVec, 0.0 ) ).xyz + vec3( 0.0,0.0,1.0 ) );\n\t\t\t#ifdef TEXTURE_LOD_EXT\n\t\t\t\tvec4 envMapColor = texture2DLodEXT( envMap, reflectView.xy * 0.5 + 0.5, specularMIPLevel );\n\t\t\t#else\n\t\t\t\tvec4 envMapColor = texture2D( envMap, reflectView.xy * 0.5 + 0.5, specularMIPLevel );\n\t\t\t#endif\n\t\t\tenvMapColor.rgb = envMapTexelToLinear( envMapColor ).rgb;\n\t\t#endif\n\t\treturn envMapColor.rgb * envMapIntensity;\n\t}\n#endif",envmap_vertex:"#ifdef USE_ENVMAP\n\t#ifdef ENV_WORLDPOS\n\t\tvWorldPosition = worldPosition.xyz;\n\t#else\n\t\tvec3 cameraToVertex = 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",fog_vertex:"#ifdef USE_FOG\n\tfogDepth = -mvPosition.z;\n#endif",fog_pars_vertex:"#ifdef USE_FOG\n\tvarying float fogDepth;\n#endif",fog_fragment:"#ifdef USE_FOG\n\t#ifdef FOG_EXP2\n\t\tfloat fogFactor = 1.0 - exp( - fogDensity * fogDensity * fogDepth * fogDepth );\n\t#else\n\t\tfloat fogFactor = smoothstep( fogNear, fogFar, fogDepth );\n\t#endif\n\tgl_FragColor.rgb = mix( gl_FragColor.rgb, fogColor, fogFactor );\n#endif",fog_pars_fragment:"#ifdef USE_FOG\n\tuniform vec3 fogColor;\n\tvarying float fogDepth;\n\t#ifdef FOG_EXP2\n\t\tuniform float fogDensity;\n\t#else\n\t\tuniform float fogNear;\n\t\tuniform float fogFar;\n\t#endif\n#endif",gradientmap_pars_fragment:"#ifdef 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",lightmap_fragment:"#ifdef USE_LIGHTMAP\n\treflectedLight.indirectDiffuse += PI * texture2D( lightMap, vUv2 ).xyz * lightMapIntensity;\n#endif",lightmap_pars_fragment:"#ifdef USE_LIGHTMAP\n\tuniform sampler2D lightMap;\n\tuniform float lightMapIntensity;\n#endif",lights_lambert_vertex:"vec3 diffuse = vec3( 1.0 );\nGeometricContext geometry;\ngeometry.position = mvPosition.xyz;\ngeometry.normal = normalize( transformedNormal );\ngeometry.viewDir = normalize( -mvPosition.xyz );\nGeometricContext backGeometry;\nbackGeometry.position = geometry.position;\nbackGeometry.normal = -geometry.normal;\nbackGeometry.viewDir = geometry.viewDir;\nvLightFront = vec3( 0.0 );\nvIndirectFront = vec3( 0.0 );\n#ifdef DOUBLE_SIDED\n\tvLightBack = vec3( 0.0 );\n\tvIndirectBack = vec3( 0.0 );\n#endif\nIncidentLight directLight;\nfloat dotNL;\nvec3 directLightColor_Diffuse;\n#if NUM_POINT_LIGHTS > 0\n\t#pragma unroll_loop\n\tfor ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {\n\t\tgetPointDirectLightIrradiance( pointLights[ i ], geometry, directLight );\n\t\tdotNL = dot( geometry.normal, directLight.direction );\n\t\tdirectLightColor_Diffuse = PI * directLight.color;\n\t\tvLightFront += saturate( dotNL ) * directLightColor_Diffuse;\n\t\t#ifdef DOUBLE_SIDED\n\t\t\tvLightBack += saturate( -dotNL ) * directLightColor_Diffuse;\n\t\t#endif\n\t}\n#endif\n#if NUM_SPOT_LIGHTS > 0\n\t#pragma unroll_loop\n\tfor ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {\n\t\tgetSpotDirectLightIrradiance( spotLights[ i ], geometry, directLight );\n\t\tdotNL = dot( geometry.normal, directLight.direction );\n\t\tdirectLightColor_Diffuse = PI * directLight.color;\n\t\tvLightFront += saturate( dotNL ) * directLightColor_Diffuse;\n\t\t#ifdef DOUBLE_SIDED\n\t\t\tvLightBack += saturate( -dotNL ) * directLightColor_Diffuse;\n\t\t#endif\n\t}\n#endif\n#if NUM_DIR_LIGHTS > 0\n\t#pragma unroll_loop\n\tfor ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {\n\t\tgetDirectionalDirectLightIrradiance( directionalLights[ i ], geometry, directLight );\n\t\tdotNL = dot( geometry.normal, directLight.direction );\n\t\tdirectLightColor_Diffuse = PI * directLight.color;\n\t\tvLightFront += saturate( dotNL ) * directLightColor_Diffuse;\n\t\t#ifdef DOUBLE_SIDED\n\t\t\tvLightBack += saturate( -dotNL ) * directLightColor_Diffuse;\n\t\t#endif\n\t}\n#endif\n#if NUM_HEMI_LIGHTS > 0\n\t#pragma unroll_loop\n\tfor ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) {\n\t\tvIndirectFront += getHemisphereLightIrradiance( hemisphereLights[ i ], geometry );\n\t\t#ifdef DOUBLE_SIDED\n\t\t\tvIndirectBack += getHemisphereLightIrradiance( hemisphereLights[ i ], backGeometry );\n\t\t#endif\n\t}\n#endif",lights_pars_begin:"uniform bool receiveShadow;\nuniform vec3 ambientLightColor;\nuniform vec3 lightProbe[ 9 ];\nvec3 shGetIrradianceAt( in vec3 normal, in vec3 shCoefficients[ 9 ] ) {\n\tfloat x = normal.x, y = normal.y, z = normal.z;\n\tvec3 result = shCoefficients[ 0 ] * 0.886227;\n\tresult += shCoefficients[ 1 ] * 2.0 * 0.511664 * y;\n\tresult += shCoefficients[ 2 ] * 2.0 * 0.511664 * z;\n\tresult += shCoefficients[ 3 ] * 2.0 * 0.511664 * x;\n\tresult += shCoefficients[ 4 ] * 2.0 * 0.429043 * x * y;\n\tresult += shCoefficients[ 5 ] * 2.0 * 0.429043 * y * z;\n\tresult += shCoefficients[ 6 ] * ( 0.743125 * z * z - 0.247708 );\n\tresult += shCoefficients[ 7 ] * 2.0 * 0.429043 * x * z;\n\tresult += shCoefficients[ 8 ] * 0.429043 * ( x * x - y * y );\n\treturn result;\n}\nvec3 getLightProbeIrradiance( const in vec3 lightProbe[ 9 ], const in GeometricContext geometry ) {\n\tvec3 worldNormal = inverseTransformDirection( geometry.normal, viewMatrix );\n\tvec3 irradiance = shGetIrradianceAt( worldNormal, lightProbe );\n\treturn irradiance;\n}\nvec3 getAmbientLightIrradiance( const in vec3 ambientLightColor ) {\n\tvec3 irradiance = ambientLightColor;\n\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\t\tirradiance *= PI;\n\t#endif\n\treturn irradiance;\n}\n#if NUM_DIR_LIGHTS > 0\n\tstruct DirectionalLight {\n\t\tvec3 direction;\n\t\tvec3 color;\n\t\tint shadow;\n\t\tfloat shadowBias;\n\t\tfloat shadowRadius;\n\t\tvec2 shadowMapSize;\n\t};\n\tuniform DirectionalLight directionalLights[ NUM_DIR_LIGHTS ];\n\tvoid getDirectionalDirectLightIrradiance( const in DirectionalLight directionalLight, const in GeometricContext geometry, out IncidentLight directLight ) {\n\t\tdirectLight.color = directionalLight.color;\n\t\tdirectLight.direction = directionalLight.direction;\n\t\tdirectLight.visible = true;\n\t}\n#endif\n#if NUM_POINT_LIGHTS > 0\n\tstruct PointLight {\n\t\tvec3 position;\n\t\tvec3 color;\n\t\tfloat distance;\n\t\tfloat decay;\n\t\tint shadow;\n\t\tfloat shadowBias;\n\t\tfloat shadowRadius;\n\t\tvec2 shadowMapSize;\n\t\tfloat shadowCameraNear;\n\t\tfloat shadowCameraFar;\n\t};\n\tuniform PointLight pointLights[ NUM_POINT_LIGHTS ];\n\tvoid getPointDirectLightIrradiance( const in PointLight pointLight, const in GeometricContext geometry, out IncidentLight directLight ) {\n\t\tvec3 lVector = pointLight.position - geometry.position;\n\t\tdirectLight.direction = normalize( lVector );\n\t\tfloat lightDistance = length( lVector );\n\t\tdirectLight.color = pointLight.color;\n\t\tdirectLight.color *= punctualLightIntensityToIrradianceFactor( lightDistance, pointLight.distance, pointLight.decay );\n\t\tdirectLight.visible = ( directLight.color != vec3( 0.0 ) );\n\t}\n#endif\n#if NUM_SPOT_LIGHTS > 0\n\tstruct SpotLight {\n\t\tvec3 position;\n\t\tvec3 direction;\n\t\tvec3 color;\n\t\tfloat distance;\n\t\tfloat decay;\n\t\tfloat coneCos;\n\t\tfloat penumbraCos;\n\t\tint shadow;\n\t\tfloat shadowBias;\n\t\tfloat shadowRadius;\n\t\tvec2 shadowMapSize;\n\t};\n\tuniform SpotLight spotLights[ NUM_SPOT_LIGHTS ];\n\tvoid getSpotDirectLightIrradiance( const in SpotLight spotLight, const in GeometricContext geometry, out IncidentLight directLight ) {\n\t\tvec3 lVector = spotLight.position - geometry.position;\n\t\tdirectLight.direction = normalize( lVector );\n\t\tfloat lightDistance = length( lVector );\n\t\tfloat angleCos = dot( directLight.direction, spotLight.direction );\n\t\tif ( angleCos > spotLight.coneCos ) {\n\t\t\tfloat spotEffect = smoothstep( spotLight.coneCos, spotLight.penumbraCos, angleCos );\n\t\t\tdirectLight.color = spotLight.color;\n\t\t\tdirectLight.color *= spotEffect * punctualLightIntensityToIrradianceFactor( lightDistance, spotLight.distance, spotLight.decay );\n\t\t\tdirectLight.visible = true;\n\t\t} else {\n\t\t\tdirectLight.color = vec3( 0.0 );\n\t\t\tdirectLight.visible = false;\n\t\t}\n\t}\n#endif\n#if NUM_RECT_AREA_LIGHTS > 0\n\tstruct RectAreaLight {\n\t\tvec3 color;\n\t\tvec3 position;\n\t\tvec3 halfWidth;\n\t\tvec3 halfHeight;\n\t};\n\tuniform sampler2D ltc_1;\tuniform sampler2D ltc_2;\n\tuniform RectAreaLight rectAreaLights[ NUM_RECT_AREA_LIGHTS ];\n#endif\n#if NUM_HEMI_LIGHTS > 0\n\tstruct HemisphereLight {\n\t\tvec3 direction;\n\t\tvec3 skyColor;\n\t\tvec3 groundColor;\n\t};\n\tuniform HemisphereLight hemisphereLights[ NUM_HEMI_LIGHTS ];\n\tvec3 getHemisphereLightIrradiance( const in HemisphereLight hemiLight, const in GeometricContext geometry ) {\n\t\tfloat dotNL = dot( geometry.normal, hemiLight.direction );\n\t\tfloat hemiDiffuseWeight = 0.5 * dotNL + 0.5;\n\t\tvec3 irradiance = mix( hemiLight.groundColor, hemiLight.skyColor, hemiDiffuseWeight );\n\t\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\t\t\tirradiance *= PI;\n\t\t#endif\n\t\treturn irradiance;\n\t}\n#endif",lights_phong_fragment:"BlinnPhongMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb;\nmaterial.specularColor = specular;\nmaterial.specularShininess = shininess;\nmaterial.specularStrength = specularStrength;",lights_phong_pars_fragment:"varying vec3 vViewPosition;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\nstruct BlinnPhongMaterial {\n\tvec3\tdiffuseColor;\n\tvec3\tspecularColor;\n\tfloat\tspecularShininess;\n\tfloat\tspecularStrength;\n};\nvoid RE_Direct_BlinnPhong( const in IncidentLight directLight, const in GeometricContext geometry, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {\n\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_IndirectDiffuse\t\tRE_IndirectDiffuse_BlinnPhong\n#define Material_LightProbeLOD( material )\t(0)",lights_physical_fragment:"PhysicalMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb * ( 1.0 - metalnessFactor );\nmaterial.specularRoughness = clamp( roughnessFactor, 0.04, 1.0 );\n#ifdef REFLECTIVITY\n\tmaterial.specularColor = mix( vec3( MAXIMUM_SPECULAR_COEFFICIENT * pow2( reflectivity ) ), diffuseColor.rgb, metalnessFactor );\n#else\n\tmaterial.specularColor = mix( vec3( DEFAULT_SPECULAR_COEFFICIENT ), diffuseColor.rgb, metalnessFactor );\n#endif\n#ifdef CLEARCOAT\n\tmaterial.clearcoat = saturate( clearcoat );\tmaterial.clearcoatRoughness = clamp( clearcoatRoughness, 0.04, 1.0 );\n#endif\n#ifdef USE_SHEEN\n\tmaterial.sheenColor = sheen;\n#endif",lights_physical_pars_fragment:"struct PhysicalMaterial {\n\tvec3\tdiffuseColor;\n\tfloat\tspecularRoughness;\n\tvec3\tspecularColor;\n#ifdef CLEARCOAT\n\tfloat clearcoat;\n\tfloat clearcoatRoughness;\n#endif\n#ifdef USE_SHEEN\n\tvec3 sheenColor;\n#endif\n};\n#define MAXIMUM_SPECULAR_COEFFICIENT 0.16\n#define DEFAULT_SPECULAR_COEFFICIENT 0.04\nfloat clearcoatDHRApprox( const in float roughness, const in float dotNL ) {\n\treturn DEFAULT_SPECULAR_COEFFICIENT + ( 1.0 - DEFAULT_SPECULAR_COEFFICIENT ) * ( pow( 1.0 - dotNL, 5.0 ) * pow( 1.0 - roughness, 2.0 ) );\n}\n#if NUM_RECT_AREA_LIGHTS > 0\n\tvoid RE_Direct_RectArea_Physical( const in RectAreaLight rectAreaLight, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n\t\tvec3 normal = geometry.normal;\n\t\tvec3 viewDir = geometry.viewDir;\n\t\tvec3 position = geometry.position;\n\t\tvec3 lightPos = rectAreaLight.position;\n\t\tvec3 halfWidth = rectAreaLight.halfWidth;\n\t\tvec3 halfHeight = rectAreaLight.halfHeight;\n\t\tvec3 lightColor = rectAreaLight.color;\n\t\tfloat roughness = material.specularRoughness;\n\t\tvec3 rectCoords[ 4 ];\n\t\trectCoords[ 0 ] = lightPos + halfWidth - halfHeight;\t\trectCoords[ 1 ] = lightPos - halfWidth - halfHeight;\n\t\trectCoords[ 2 ] = lightPos - halfWidth + halfHeight;\n\t\trectCoords[ 3 ] = lightPos + halfWidth + halfHeight;\n\t\tvec2 uv = LTC_Uv( normal, viewDir, roughness );\n\t\tvec4 t1 = texture2D( ltc_1, uv );\n\t\tvec4 t2 = texture2D( ltc_2, uv );\n\t\tmat3 mInv = mat3(\n\t\t\tvec3( t1.x, 0, t1.y ),\n\t\t\tvec3( 0, 1, 0 ),\n\t\t\tvec3( t1.z, 0, t1.w )\n\t\t);\n\t\tvec3 fresnel = ( material.specularColor * t2.x + ( vec3( 1.0 ) - material.specularColor ) * t2.y );\n\t\treflectedLight.directSpecular += lightColor * fresnel * LTC_Evaluate( normal, viewDir, position, mInv, rectCoords );\n\t\treflectedLight.directDiffuse += lightColor * material.diffuseColor * LTC_Evaluate( normal, viewDir, position, mat3( 1.0 ), rectCoords );\n\t}\n#endif\nvoid RE_Direct_Physical( const in IncidentLight directLight, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n\tfloat dotNL = saturate( dot( geometry.normal, directLight.direction ) );\n\tvec3 irradiance = dotNL * directLight.color;\n\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\t\tirradiance *= PI;\n\t#endif\n\t#ifdef CLEARCOAT\n\t\tfloat ccDotNL = saturate( dot( geometry.clearcoatNormal, directLight.direction ) );\n\t\tvec3 ccIrradiance = ccDotNL * directLight.color;\n\t\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\t\t\tccIrradiance *= PI;\n\t\t#endif\n\t\tfloat clearcoatDHR = material.clearcoat * clearcoatDHRApprox( material.clearcoatRoughness, ccDotNL );\n\t\treflectedLight.directSpecular += ccIrradiance * material.clearcoat * BRDF_Specular_GGX( directLight, geometry.viewDir, geometry.clearcoatNormal, vec3( DEFAULT_SPECULAR_COEFFICIENT ), material.clearcoatRoughness );\n\t#else\n\t\tfloat clearcoatDHR = 0.0;\n\t#endif\n\t#ifdef USE_SHEEN\n\t\treflectedLight.directSpecular += ( 1.0 - clearcoatDHR ) * irradiance * BRDF_Specular_Sheen(\n\t\t\tmaterial.specularRoughness,\n\t\t\tdirectLight.direction,\n\t\t\tgeometry,\n\t\t\tmaterial.sheenColor\n\t\t);\n\t#else\n\t\treflectedLight.directSpecular += ( 1.0 - clearcoatDHR ) * irradiance * BRDF_Specular_GGX( directLight, geometry.viewDir, geometry.normal, material.specularColor, material.specularRoughness);\n\t#endif\n\treflectedLight.directDiffuse += ( 1.0 - clearcoatDHR ) * irradiance * BRDF_Diffuse_Lambert( material.diffuseColor );\n}\nvoid RE_IndirectDiffuse_Physical( const in vec3 irradiance, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n\treflectedLight.indirectDiffuse += irradiance * BRDF_Diffuse_Lambert( material.diffuseColor );\n}\nvoid RE_IndirectSpecular_Physical( const in vec3 radiance, const in vec3 irradiance, const in vec3 clearcoatRadiance, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight) {\n\t#ifdef CLEARCOAT\n\t\tfloat ccDotNV = saturate( dot( geometry.clearcoatNormal, geometry.viewDir ) );\n\t\treflectedLight.indirectSpecular += clearcoatRadiance * material.clearcoat * BRDF_Specular_GGX_Environment( geometry.viewDir, geometry.clearcoatNormal, vec3( DEFAULT_SPECULAR_COEFFICIENT ), material.clearcoatRoughness );\n\t\tfloat ccDotNL = ccDotNV;\n\t\tfloat clearcoatDHR = material.clearcoat * clearcoatDHRApprox( material.clearcoatRoughness, ccDotNL );\n\t#else\n\t\tfloat clearcoatDHR = 0.0;\n\t#endif\n\tfloat clearcoatInv = 1.0 - clearcoatDHR;\n\tvec3 singleScattering = vec3( 0.0 );\n\tvec3 multiScattering = vec3( 0.0 );\n\tvec3 cosineWeightedIrradiance = irradiance * RECIPROCAL_PI;\n\tBRDF_Specular_Multiscattering_Environment( geometry, material.specularColor, material.specularRoughness, singleScattering, multiScattering );\n\tvec3 diffuse = material.diffuseColor * ( 1.0 - ( singleScattering + multiScattering ) );\n\treflectedLight.indirectSpecular += clearcoatInv * radiance * singleScattering;\n\treflectedLight.indirectSpecular += multiScattering * cosineWeightedIrradiance;\n\treflectedLight.indirectDiffuse += diffuse * cosineWeightedIrradiance;\n}\n#define RE_Direct\t\t\t\tRE_Direct_Physical\n#define RE_Direct_RectArea\t\tRE_Direct_RectArea_Physical\n#define RE_IndirectDiffuse\t\tRE_IndirectDiffuse_Physical\n#define RE_IndirectSpecular\t\tRE_IndirectSpecular_Physical\nfloat computeSpecularOcclusion( const in float dotNV, const in float ambientOcclusion, const in float roughness ) {\n\treturn saturate( pow( dotNV + ambientOcclusion, exp2( - 16.0 * roughness - 1.0 ) ) - 1.0 + ambientOcclusion );\n}",lights_fragment_begin:"\nGeometricContext geometry;\ngeometry.position = - vViewPosition;\ngeometry.normal = normal;\ngeometry.viewDir = normalize( vViewPosition );\n#ifdef CLEARCOAT\n\tgeometry.clearcoatNormal = clearcoatNormal;\n#endif\nIncidentLight directLight;\n#if ( NUM_POINT_LIGHTS > 0 ) && defined( RE_Direct )\n\tPointLight pointLight;\n\t#pragma unroll_loop\n\tfor ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {\n\t\tpointLight = pointLights[ i ];\n\t\tgetPointDirectLightIrradiance( pointLight, geometry, directLight );\n\t\t#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_POINT_LIGHT_SHADOWS )\n\t\tdirectLight.color *= all( bvec3( pointLight.shadow, directLight.visible, receiveShadow ) ) ? getPointShadow( pointShadowMap[ i ], pointLight.shadowMapSize, pointLight.shadowBias, pointLight.shadowRadius, vPointShadowCoord[ i ], pointLight.shadowCameraNear, pointLight.shadowCameraFar ) : 1.0;\n\t\t#endif\n\t\tRE_Direct( directLight, geometry, material, reflectedLight );\n\t}\n#endif\n#if ( NUM_SPOT_LIGHTS > 0 ) && defined( RE_Direct )\n\tSpotLight spotLight;\n\t#pragma unroll_loop\n\tfor ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {\n\t\tspotLight = spotLights[ i ];\n\t\tgetSpotDirectLightIrradiance( spotLight, geometry, directLight );\n\t\t#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )\n\t\tdirectLight.color *= all( bvec3( spotLight.shadow, directLight.visible, receiveShadow ) ) ? getShadow( spotShadowMap[ i ], spotLight.shadowMapSize, spotLight.shadowBias, spotLight.shadowRadius, vSpotShadowCoord[ i ] ) : 1.0;\n\t\t#endif\n\t\tRE_Direct( directLight, geometry, material, reflectedLight );\n\t}\n#endif\n#if ( NUM_DIR_LIGHTS > 0 ) && defined( RE_Direct )\n\tDirectionalLight directionalLight;\n\t#pragma unroll_loop\n\tfor ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {\n\t\tdirectionalLight = directionalLights[ i ];\n\t\tgetDirectionalDirectLightIrradiance( directionalLight, geometry, directLight );\n\t\t#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_DIR_LIGHT_SHADOWS )\n\t\tdirectLight.color *= all( bvec3( directionalLight.shadow, directLight.visible, receiveShadow ) ) ? getShadow( directionalShadowMap[ i ], directionalLight.shadowMapSize, directionalLight.shadowBias, directionalLight.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;\n\t\t#endif\n\t\tRE_Direct( directLight, geometry, material, reflectedLight );\n\t}\n#endif\n#if ( NUM_RECT_AREA_LIGHTS > 0 ) && defined( RE_Direct_RectArea )\n\tRectAreaLight rectAreaLight;\n\t#pragma unroll_loop\n\tfor ( int i = 0; i < NUM_RECT_AREA_LIGHTS; i ++ ) {\n\t\trectAreaLight = rectAreaLights[ i ];\n\t\tRE_Direct_RectArea( rectAreaLight, geometry, material, reflectedLight );\n\t}\n#endif\n#if defined( RE_IndirectDiffuse )\n\tvec3 iblIrradiance = vec3( 0.0 );\n\tvec3 irradiance = getAmbientLightIrradiance( ambientLightColor );\n\tirradiance += getLightProbeIrradiance( lightProbe, geometry );\n\t#if ( NUM_HEMI_LIGHTS > 0 )\n\t\t#pragma unroll_loop\n\t\tfor ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) {\n\t\t\tirradiance += getHemisphereLightIrradiance( hemisphereLights[ i ], geometry );\n\t\t}\n\t#endif\n#endif\n#if defined( RE_IndirectSpecular )\n\tvec3 radiance = vec3( 0.0 );\n\tvec3 clearcoatRadiance = vec3( 0.0 );\n#endif",lights_fragment_maps:"#if defined( RE_IndirectDiffuse )\n\t#ifdef USE_LIGHTMAP\n\t\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 defined( USE_ENVMAP ) && defined( STANDARD ) && defined( ENVMAP_TYPE_CUBE_UV )\n\t\tiblIrradiance += getLightProbeIndirectIrradiance( geometry, maxMipLevel );\n\t#endif\n#endif\n#if defined( USE_ENVMAP ) && defined( RE_IndirectSpecular )\n\tradiance += getLightProbeIndirectRadiance( geometry.viewDir, geometry.normal, material.specularRoughness, maxMipLevel );\n\t#ifdef CLEARCOAT\n\t\tclearcoatRadiance += getLightProbeIndirectRadiance( geometry.viewDir, geometry.clearcoatNormal, material.clearcoatRoughness, maxMipLevel );\n\t#endif\n#endif",lights_fragment_end:"#if defined( RE_IndirectDiffuse )\n\tRE_IndirectDiffuse( irradiance, geometry, material, reflectedLight );\n#endif\n#if defined( RE_IndirectSpecular )\n\tRE_IndirectSpecular( radiance, iblIrradiance, clearcoatRadiance, geometry, material, reflectedLight );\n#endif",logdepthbuf_fragment:"#if defined( USE_LOGDEPTHBUF ) && defined( USE_LOGDEPTHBUF_EXT )\n\tgl_FragDepthEXT = vIsPerspective == 1.0 ? log2( vFragDepth ) * logDepthBufFC * 0.5 : gl_FragCoord.z;\n#endif",logdepthbuf_pars_fragment:"#if defined( USE_LOGDEPTHBUF ) && defined( USE_LOGDEPTHBUF_EXT )\n\tuniform float logDepthBufFC;\n\tvarying float vFragDepth;\n\tvarying float vIsPerspective;\n#endif",logdepthbuf_pars_vertex:"#ifdef USE_LOGDEPTHBUF\n\t#ifdef USE_LOGDEPTHBUF_EXT\n\t\tvarying float vFragDepth;\n\t\tvarying float vIsPerspective;\n\t#else\n\t\tuniform float logDepthBufFC;\n\t#endif\n#endif",logdepthbuf_vertex:"#ifdef USE_LOGDEPTHBUF\n\t#ifdef USE_LOGDEPTHBUF_EXT\n\t\tvFragDepth = 1.0 + gl_Position.w;\n\t\tvIsPerspective = float( isPerspectiveMatrix( projectionMatrix ) );\n\t#else\n\t\tif ( isPerspectiveMatrix( projectionMatrix ) ) {\n\t\t\tgl_Position.z = log2( max( EPSILON, gl_Position.w + 1.0 ) ) * logDepthBufFC - 1.0;\n\t\t\tgl_Position.z *= gl_Position.w;\n\t\t}\n\t#endif\n#endif",map_fragment:"#ifdef USE_MAP\n\tvec4 texelColor = texture2D( map, vUv );\n\ttexelColor = mapTexelToLinear( texelColor );\n\tdiffuseColor *= texelColor;\n#endif",map_pars_fragment:"#ifdef USE_MAP\n\tuniform sampler2D map;\n#endif",map_particle_fragment:"#ifdef USE_MAP\n\tvec2 uv = ( uvTransform * vec3( gl_PointCoord.x, 1.0 - gl_PointCoord.y, 1 ) ).xy;\n\tvec4 mapTexel = texture2D( map, uv );\n\tdiffuseColor *= mapTexelToLinear( mapTexel );\n#endif",map_particle_pars_fragment:"#ifdef USE_MAP\n\tuniform mat3 uvTransform;\n\tuniform sampler2D map;\n#endif",metalnessmap_fragment:"float metalnessFactor = metalness;\n#ifdef USE_METALNESSMAP\n\tvec4 texelMetalness = texture2D( metalnessMap, vUv );\n\tmetalnessFactor *= texelMetalness.b;\n#endif",metalnessmap_pars_fragment:"#ifdef USE_METALNESSMAP\n\tuniform sampler2D metalnessMap;\n#endif",morphnormal_vertex:"#ifdef USE_MORPHNORMALS\n\tobjectNormal += ( morphNormal0 - normal ) * morphTargetInfluences[ 0 ];\n\tobjectNormal += ( morphNormal1 - normal ) * morphTargetInfluences[ 1 ];\n\tobjectNormal += ( morphNormal2 - normal ) * morphTargetInfluences[ 2 ];\n\tobjectNormal += ( morphNormal3 - normal ) * morphTargetInfluences[ 3 ];\n#endif",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",normal_fragment_begin:"#ifdef FLAT_SHADED\n\tvec3 fdx = vec3( dFdx( vViewPosition.x ), dFdx( vViewPosition.y ), dFdx( vViewPosition.z ) );\n\tvec3 fdy = vec3( dFdy( vViewPosition.x ), dFdy( vViewPosition.y ), dFdy( vViewPosition.z ) );\n\tvec3 normal = normalize( cross( fdx, fdy ) );\n#else\n\tvec3 normal = normalize( vNormal );\n\t#ifdef DOUBLE_SIDED\n\t\tnormal = normal * ( float( gl_FrontFacing ) * 2.0 - 1.0 );\n\t#endif\n\t#ifdef USE_TANGENT\n\t\tvec3 tangent = normalize( vTangent );\n\t\tvec3 bitangent = normalize( vBitangent );\n\t\t#ifdef DOUBLE_SIDED\n\t\t\ttangent = tangent * ( float( gl_FrontFacing ) * 2.0 - 1.0 );\n\t\t\tbitangent = bitangent * ( float( gl_FrontFacing ) * 2.0 - 1.0 );\n\t\t#endif\n\t#endif\n#endif\nvec3 geometryNormal = normal;",normal_fragment_maps:"#ifdef OBJECTSPACE_NORMALMAP\n\tnormal = texture2D( normalMap, vUv ).xyz * 2.0 - 1.0;\n\t#ifdef FLIP_SIDED\n\t\tnormal = - normal;\n\t#endif\n\t#ifdef DOUBLE_SIDED\n\t\tnormal = normal * ( float( gl_FrontFacing ) * 2.0 - 1.0 );\n\t#endif\n\tnormal = normalize( normalMatrix * normal );\n#elif defined( TANGENTSPACE_NORMALMAP )\n\t#ifdef USE_TANGENT\n\t\tmat3 vTBN = mat3( tangent, bitangent, normal );\n\t\tvec3 mapN = texture2D( normalMap, vUv ).xyz * 2.0 - 1.0;\n\t\tmapN.xy = normalScale * mapN.xy;\n\t\tnormal = normalize( vTBN * mapN );\n\t#else\n\t\tnormal = perturbNormal2Arb( -vViewPosition, normal, normalScale, normalMap );\n\t#endif\n#elif defined( USE_BUMPMAP )\n\tnormal = perturbNormalArb( -vViewPosition, normal, dHdxy_fwd() );\n#endif",normalmap_pars_fragment:"#ifdef USE_NORMALMAP\n\tuniform sampler2D normalMap;\n\tuniform vec2 normalScale;\n#endif\n#ifdef OBJECTSPACE_NORMALMAP\n\tuniform mat3 normalMatrix;\n#endif\n#if ! defined ( USE_TANGENT ) && ( defined ( TANGENTSPACE_NORMALMAP ) || defined ( USE_CLEARCOAT_NORMALMAP ) )\n\tvec3 perturbNormal2Arb( vec3 eye_pos, vec3 surf_norm, vec2 normalScale, in sampler2D normalMap ) {\n\t\tvec3 q0 = vec3( dFdx( eye_pos.x ), dFdx( eye_pos.y ), dFdx( eye_pos.z ) );\n\t\tvec3 q1 = vec3( dFdy( eye_pos.x ), dFdy( eye_pos.y ), dFdy( eye_pos.z ) );\n\t\tvec2 st0 = dFdx( vUv.st );\n\t\tvec2 st1 = dFdy( vUv.st );\n\t\tfloat scale = sign( st1.t * st0.s - st0.t * st1.s );\n\t\tvec3 S = normalize( ( q0 * st1.t - q1 * st0.t ) * scale );\n\t\tvec3 T = normalize( ( - q0 * st1.s + q1 * st0.s ) * scale );\n\t\tvec3 N = normalize( surf_norm );\n\t\tvec3 mapN = texture2D( normalMap, vUv ).xyz * 2.0 - 1.0;\n\t\tmapN.xy *= normalScale;\n\t\t#ifdef DOUBLE_SIDED\n\t\t\tbool frontFacing = dot( cross( S, T ), N ) > 0.0;\n\t\t\tmapN.xy *= ( float( frontFacing ) * 2.0 - 1.0 );\n\t\t#else\n\t\t\tmapN.xy *= ( float( gl_FrontFacing ) * 2.0 - 1.0 );\n\t\t#endif\n\t\tmat3 tsn = mat3( S, T, N );\n\t\treturn normalize( tsn * mapN );\n\t}\n#endif",clearcoat_normal_fragment_begin:"#ifdef CLEARCOAT\n\tvec3 clearcoatNormal = geometryNormal;\n#endif",clearcoat_normal_fragment_maps:"#ifdef USE_CLEARCOAT_NORMALMAP\n\t#ifdef USE_TANGENT\n\t\tmat3 vTBN = mat3( tangent, bitangent, clearcoatNormal );\n\t\tvec3 mapN = texture2D( normalMap, vUv ).xyz * 2.0 - 1.0;\n\t\tmapN.xy = clearcoatNormalScale * mapN.xy;\n\t\tclearcoatNormal = normalize( vTBN * mapN );\n\t#else\n\t\tclearcoatNormal = perturbNormal2Arb( - vViewPosition, clearcoatNormal, clearcoatNormalScale, clearcoatNormalMap );\n\t#endif\n#endif",clearcoat_normalmap_pars_fragment:"#ifdef USE_CLEARCOAT_NORMALMAP\n\tuniform sampler2D clearcoatNormalMap;\n\tuniform vec2 clearcoatNormalScale;\n#endif",packing:"vec3 packNormalToRGB( const in vec3 normal ) {\n\treturn normalize( normal ) * 0.5 + 0.5;\n}\nvec3 unpackRGBToNormal( const in vec3 rgb ) {\n\treturn 2.0 * rgb.xyz - 1.0;\n}\nconst float PackUpscale = 256. / 255.;const float UnpackDownscale = 255. / 256.;\nconst vec3 PackFactors = vec3( 256. * 256. * 256., 256. * 256., 256. );\nconst vec4 UnpackFactors = UnpackDownscale / vec4( PackFactors, 1. );\nconst float ShiftRight8 = 1. / 256.;\nvec4 packDepthToRGBA( const in float v ) {\n\tvec4 r = vec4( fract( v * PackFactors ), v );\n\tr.yzw -= r.xyz * ShiftRight8;\treturn r * PackUpscale;\n}\nfloat unpackRGBAToDepth( const in vec4 v ) {\n\treturn dot( v, UnpackFactors );\n}\nvec4 encodeHalfRGBA ( vec2 v ) {\n\tvec4 encoded = vec4( 0.0 );\n\tconst vec2 offset = vec2( 1.0 / 255.0, 0.0 );\n\tencoded.xy = vec2( v.x, fract( v.x * 255.0 ) );\n\tencoded.xy = encoded.xy - ( encoded.yy * offset );\n\tencoded.zw = vec2( v.y, fract( v.y * 255.0 ) );\n\tencoded.zw = encoded.zw - ( encoded.ww * offset );\n\treturn encoded;\n}\nvec2 decodeHalfRGBA( vec4 v ) {\n\treturn vec2( v.x + ( v.y / 255.0 ), v.z + ( v.w / 255.0 ) );\n}\nfloat viewZToOrthographicDepth( const in float viewZ, const in float near, const in float far ) {\n\treturn ( viewZ + near ) / ( near - far );\n}\nfloat orthographicDepthToViewZ( const in float linearClipZ, const in float near, const in float far ) {\n\treturn linearClipZ * ( near - far ) - near;\n}\nfloat viewZToPerspectiveDepth( const in float viewZ, const in float near, const in float far ) {\n\treturn (( near + viewZ ) * far ) / (( far - near ) * viewZ );\n}\nfloat perspectiveDepthToViewZ( const in float invClipZ, const in float near, const in float far ) {\n\treturn ( near * far ) / ( ( far - near ) * invClipZ - far );\n}",premultiplied_alpha_fragment:"#ifdef PREMULTIPLIED_ALPHA\n\tgl_FragColor.rgb *= gl_FragColor.a;\n#endif",project_vertex:"vec4 mvPosition = vec4( transformed, 1.0 );\n#ifdef USE_INSTANCING\n\tmvPosition = instanceMatrix * mvPosition;\n#endif\nmvPosition = modelViewMatrix * mvPosition;\ngl_Position = projectionMatrix * mvPosition;",dithering_fragment:"#ifdef DITHERING\n\tgl_FragColor.rgb = dithering( gl_FragColor.rgb );\n#endif",dithering_pars_fragment:"#ifdef DITHERING\n\tvec3 dithering( vec3 color ) {\n\t\tfloat grid_position = rand( gl_FragCoord.xy );\n\t\tvec3 dither_shift_RGB = vec3( 0.25 / 255.0, -0.25 / 255.0, 0.25 / 255.0 );\n\t\tdither_shift_RGB = mix( 2.0 * dither_shift_RGB, -2.0 * dither_shift_RGB, grid_position );\n\t\treturn color + dither_shift_RGB;\n\t}\n#endif",roughnessmap_fragment:"float roughnessFactor = roughness;\n#ifdef USE_ROUGHNESSMAP\n\tvec4 texelRoughness = texture2D( roughnessMap, vUv );\n\troughnessFactor *= texelRoughness.g;\n#endif",roughnessmap_pars_fragment:"#ifdef USE_ROUGHNESSMAP\n\tuniform sampler2D roughnessMap;\n#endif",shadowmap_pars_fragment:"#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHT_SHADOWS > 0\n\t\tuniform sampler2D directionalShadowMap[ NUM_DIR_LIGHT_SHADOWS ];\n\t\tvarying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ];\n\t#endif\n\t#if NUM_SPOT_LIGHT_SHADOWS > 0\n\t\tuniform sampler2D spotShadowMap[ NUM_SPOT_LIGHT_SHADOWS ];\n\t\tvarying vec4 vSpotShadowCoord[ NUM_SPOT_LIGHT_SHADOWS ];\n\t#endif\n\t#if NUM_POINT_LIGHT_SHADOWS > 0\n\t\tuniform sampler2D pointShadowMap[ NUM_POINT_LIGHT_SHADOWS ];\n\t\tvarying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ];\n\t#endif\n\tfloat texture2DCompare( sampler2D depths, vec2 uv, float compare ) {\n\t\treturn step( compare, unpackRGBAToDepth( texture2D( depths, uv ) ) );\n\t}\n\tvec2 texture2DDistribution( sampler2D shadow, vec2 uv ) {\n\t\treturn decodeHalfRGBA( texture2D( shadow, uv ) );\n\t}\n\tfloat VSMShadow (sampler2D shadow, vec2 uv, float compare ){\n\t\tfloat occlusion = 1.0;\n\t\tvec2 distribution = texture2DDistribution( shadow, uv );\n\t\tfloat hard_shadow = step( compare , distribution.x );\n\t\tif (hard_shadow != 1.0 ) {\n\t\t\tfloat distance = compare - distribution.x ;\n\t\t\tfloat variance = max( 0.00000, distribution.y * distribution.y );\n\t\t\tfloat softness_probability = variance / (variance + distance * distance );\t\t\tsoftness_probability = clamp( ( softness_probability - 0.3 ) / ( 0.95 - 0.3 ), 0.0, 1.0 );\t\t\tocclusion = clamp( max( hard_shadow, softness_probability ), 0.0, 1.0 );\n\t\t}\n\t\treturn occlusion;\n\t}\n\tfloat texture2DShadowLerp( sampler2D depths, vec2 size, vec2 uv, float compare ) {\n\t\tconst vec2 offset = vec2( 0.0, 1.0 );\n\t\tvec2 texelSize = vec2( 1.0 ) / size;\n\t\tvec2 centroidUV = ( floor( uv * size - 0.5 ) + 0.5 ) * texelSize;\n\t\tfloat lb = texture2DCompare( depths, centroidUV + texelSize * offset.xx, compare );\n\t\tfloat lt = texture2DCompare( depths, centroidUV + texelSize * offset.xy, compare );\n\t\tfloat rb = texture2DCompare( depths, centroidUV + texelSize * offset.yx, compare );\n\t\tfloat rt = texture2DCompare( depths, centroidUV + texelSize * offset.yy, compare );\n\t\tvec2 f = fract( uv * size + 0.5 );\n\t\tfloat a = mix( lb, lt, f.y );\n\t\tfloat b = mix( rb, rt, f.y );\n\t\tfloat c = mix( a, b, f.x );\n\t\treturn c;\n\t}\n\tfloat getShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowBias, float shadowRadius, vec4 shadowCoord ) {\n\t\tfloat shadow = 1.0;\n\t\tshadowCoord.xyz /= shadowCoord.w;\n\t\tshadowCoord.z += shadowBias;\n\t\tbvec4 inFrustumVec = bvec4 ( shadowCoord.x >= 0.0, shadowCoord.x <= 1.0, shadowCoord.y >= 0.0, shadowCoord.y <= 1.0 );\n\t\tbool inFrustum = all( inFrustumVec );\n\t\tbvec2 frustumTestVec = bvec2( inFrustum, shadowCoord.z <= 1.0 );\n\t\tbool frustumTest = all( frustumTestVec );\n\t\tif ( frustumTest ) {\n\t\t#if defined( SHADOWMAP_TYPE_PCF )\n\t\t\tvec2 texelSize = vec2( 1.0 ) / shadowMapSize;\n\t\t\tfloat dx0 = - texelSize.x * shadowRadius;\n\t\t\tfloat dy0 = - texelSize.y * shadowRadius;\n\t\t\tfloat dx1 = + texelSize.x * shadowRadius;\n\t\t\tfloat dy1 = + texelSize.y * shadowRadius;\n\t\t\tfloat dx2 = dx0 / 2.0;\n\t\t\tfloat dy2 = dy0 / 2.0;\n\t\t\tfloat dx3 = dx1 / 2.0;\n\t\t\tfloat dy3 = dy1 / 2.0;\n\t\t\tshadow = (\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, dy2 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy2 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, dy2 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, dy3 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy3 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, dy3 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy1 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy1 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy1 ), shadowCoord.z )\n\t\t\t) * ( 1.0 / 17.0 );\n\t\t#elif defined( SHADOWMAP_TYPE_PCF_SOFT )\n\t\t\tvec2 texelSize = vec2( 1.0 ) / shadowMapSize;\n\t\t\tfloat dx0 = - texelSize.x * shadowRadius;\n\t\t\tfloat dy0 = - texelSize.y * shadowRadius;\n\t\t\tfloat dx1 = + texelSize.x * shadowRadius;\n\t\t\tfloat dy1 = + texelSize.y * shadowRadius;\n\t\t\tshadow = (\n\t\t\t\ttexture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy + vec2( dx0, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy + vec2( 0.0, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy + vec2( dx1, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy + vec2( dx0, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy, shadowCoord.z ) +\n\t\t\t\ttexture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy + vec2( dx1, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy + vec2( dx0, dy1 ), shadowCoord.z ) +\n\t\t\t\ttexture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy + vec2( 0.0, dy1 ), shadowCoord.z ) +\n\t\t\t\ttexture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy + vec2( dx1, dy1 ), shadowCoord.z )\n\t\t\t) * ( 1.0 / 9.0 );\n\t\t#elif defined( SHADOWMAP_TYPE_VSM )\n\t\t\tshadow = VSMShadow( shadowMap, shadowCoord.xy, shadowCoord.z );\n\t\t#else\n\t\t\tshadow = texture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z );\n\t\t#endif\n\t\t}\n\t\treturn shadow;\n\t}\n\tvec2 cubeToUV( vec3 v, float texelSizeY ) {\n\t\tvec3 absV = abs( v );\n\t\tfloat scaleToCube = 1.0 / max( absV.x, max( absV.y, absV.z ) );\n\t\tabsV *= scaleToCube;\n\t\tv *= scaleToCube * ( 1.0 - 2.0 * texelSizeY );\n\t\tvec2 planar = v.xy;\n\t\tfloat almostATexel = 1.5 * texelSizeY;\n\t\tfloat almostOne = 1.0 - almostATexel;\n\t\tif ( absV.z >= almostOne ) {\n\t\t\tif ( v.z > 0.0 )\n\t\t\t\tplanar.x = 4.0 - v.x;\n\t\t} else if ( absV.x >= almostOne ) {\n\t\t\tfloat signX = sign( v.x );\n\t\t\tplanar.x = v.z * signX + 2.0 * signX;\n\t\t} else if ( absV.y >= almostOne ) {\n\t\t\tfloat signY = sign( v.y );\n\t\t\tplanar.x = v.x + 2.0 * signY + 2.0;\n\t\t\tplanar.y = v.z * signY - 2.0;\n\t\t}\n\t\treturn vec2( 0.125, 0.25 ) * planar + vec2( 0.375, 0.75 );\n\t}\n\tfloat getPointShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowBias, float shadowRadius, vec4 shadowCoord, float shadowCameraNear, float shadowCameraFar ) {\n\t\tvec2 texelSize = vec2( 1.0 ) / ( shadowMapSize * vec2( 4.0, 2.0 ) );\n\t\tvec3 lightToPosition = shadowCoord.xyz;\n\t\tfloat dp = ( length( lightToPosition ) - shadowCameraNear ) / ( shadowCameraFar - shadowCameraNear );\t\tdp += shadowBias;\n\t\tvec3 bd3D = normalize( lightToPosition );\n\t\t#if defined( SHADOWMAP_TYPE_PCF ) || defined( SHADOWMAP_TYPE_PCF_SOFT ) || defined( SHADOWMAP_TYPE_VSM )\n\t\t\tvec2 offset = vec2( - 1, 1 ) * shadowRadius * texelSize.y;\n\t\t\treturn (\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyy, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyy, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyx, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyx, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxy, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxy, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxx, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxx, texelSize.y ), dp )\n\t\t\t) * ( 1.0 / 9.0 );\n\t\t#else\n\t\t\treturn texture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp );\n\t\t#endif\n\t}\n#endif",shadowmap_pars_vertex:"#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHT_SHADOWS > 0\n\t\tuniform mat4 directionalShadowMatrix[ NUM_DIR_LIGHT_SHADOWS ];\n\t\tvarying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ];\n\t#endif\n\t#if NUM_SPOT_LIGHT_SHADOWS > 0\n\t\tuniform mat4 spotShadowMatrix[ NUM_SPOT_LIGHT_SHADOWS ];\n\t\tvarying vec4 vSpotShadowCoord[ NUM_SPOT_LIGHT_SHADOWS ];\n\t#endif\n\t#if NUM_POINT_LIGHT_SHADOWS > 0\n\t\tuniform mat4 pointShadowMatrix[ NUM_POINT_LIGHT_SHADOWS ];\n\t\tvarying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ];\n\t#endif\n#endif",shadowmap_vertex:"#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHT_SHADOWS > 0\n\t#pragma unroll_loop\n\tfor ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) {\n\t\tvDirectionalShadowCoord[ i ] = directionalShadowMatrix[ i ] * worldPosition;\n\t}\n\t#endif\n\t#if NUM_SPOT_LIGHT_SHADOWS > 0\n\t#pragma unroll_loop\n\tfor ( int i = 0; i < NUM_SPOT_LIGHT_SHADOWS; i ++ ) {\n\t\tvSpotShadowCoord[ i ] = spotShadowMatrix[ i ] * worldPosition;\n\t}\n\t#endif\n\t#if NUM_POINT_LIGHT_SHADOWS > 0\n\t#pragma unroll_loop\n\tfor ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) {\n\t\tvPointShadowCoord[ i ] = pointShadowMatrix[ i ] * worldPosition;\n\t}\n\t#endif\n#endif",shadowmask_pars_fragment:"float getShadowMask() {\n\tfloat shadow = 1.0;\n\t#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHT_SHADOWS > 0\n\tDirectionalLight directionalLight;\n\t#pragma unroll_loop\n\tfor ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) {\n\t\tdirectionalLight = directionalLights[ i ];\n\t\tshadow *= all( bvec2( directionalLight.shadow, receiveShadow ) ) ? getShadow( directionalShadowMap[ i ], directionalLight.shadowMapSize, directionalLight.shadowBias, directionalLight.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;\n\t}\n\t#endif\n\t#if NUM_SPOT_LIGHT_SHADOWS > 0\n\tSpotLight spotLight;\n\t#pragma unroll_loop\n\tfor ( int i = 0; i < NUM_SPOT_LIGHT_SHADOWS; i ++ ) {\n\t\tspotLight = spotLights[ i ];\n\t\tshadow *= all( bvec2( spotLight.shadow, receiveShadow ) ) ? getShadow( spotShadowMap[ i ], spotLight.shadowMapSize, spotLight.shadowBias, spotLight.shadowRadius, vSpotShadowCoord[ i ] ) : 1.0;\n\t}\n\t#endif\n\t#if NUM_POINT_LIGHT_SHADOWS > 0\n\tPointLight pointLight;\n\t#pragma unroll_loop\n\tfor ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) {\n\t\tpointLight = pointLights[ i ];\n\t\tshadow *= all( bvec2( pointLight.shadow, receiveShadow ) ) ? getPointShadow( pointShadowMap[ i ], pointLight.shadowMapSize, pointLight.shadowBias, pointLight.shadowRadius, vPointShadowCoord[ i ], pointLight.shadowCameraNear, pointLight.shadowCameraFar ) : 1.0;\n\t}\n\t#endif\n\t#endif\n\treturn shadow;\n}",skinbase_vertex:"#ifdef USE_SKINNING\n\tmat4 boneMatX = getBoneMatrix( skinIndex.x );\n\tmat4 boneMatY = getBoneMatrix( skinIndex.y );\n\tmat4 boneMatZ = getBoneMatrix( skinIndex.z );\n\tmat4 boneMatW = getBoneMatrix( skinIndex.w );\n#endif",skinning_pars_vertex:"#ifdef USE_SKINNING\n\tuniform mat4 bindMatrix;\n\tuniform mat4 bindMatrixInverse;\n\t#ifdef BONE_TEXTURE\n\t\tuniform highp sampler2D boneTexture;\n\t\tuniform int boneTextureSize;\n\t\tmat4 getBoneMatrix( const in float i ) {\n\t\t\tfloat j = i * 4.0;\n\t\t\tfloat x = mod( j, float( boneTextureSize ) );\n\t\t\tfloat y = floor( j / float( boneTextureSize ) );\n\t\t\tfloat dx = 1.0 / float( boneTextureSize );\n\t\t\tfloat dy = 1.0 / float( boneTextureSize );\n\t\t\ty = dy * ( y + 0.5 );\n\t\t\tvec4 v1 = texture2D( boneTexture, vec2( dx * ( x + 0.5 ), y ) );\n\t\t\tvec4 v2 = texture2D( boneTexture, vec2( dx * ( x + 1.5 ), y ) );\n\t\t\tvec4 v3 = texture2D( boneTexture, vec2( dx * ( x + 2.5 ), y ) );\n\t\t\tvec4 v4 = texture2D( boneTexture, vec2( dx * ( x + 3.5 ), y ) );\n\t\t\tmat4 bone = mat4( v1, v2, v3, v4 );\n\t\t\treturn bone;\n\t\t}\n\t#else\n\t\tuniform mat4 boneMatrices[ MAX_BONES ];\n\t\tmat4 getBoneMatrix( const in float i ) {\n\t\t\tmat4 bone = boneMatrices[ int(i) ];\n\t\t\treturn bone;\n\t\t}\n\t#endif\n#endif",skinning_vertex:"#ifdef USE_SKINNING\n\tvec4 skinVertex = bindMatrix * vec4( transformed, 1.0 );\n\tvec4 skinned = vec4( 0.0 );\n\tskinned += boneMatX * skinVertex * skinWeight.x;\n\tskinned += boneMatY * skinVertex * skinWeight.y;\n\tskinned += boneMatZ * skinVertex * skinWeight.z;\n\tskinned += boneMatW * skinVertex * skinWeight.w;\n\ttransformed = ( bindMatrixInverse * skinned ).xyz;\n#endif",skinnormal_vertex:"#ifdef USE_SKINNING\n\tmat4 skinMatrix = mat4( 0.0 );\n\tskinMatrix += skinWeight.x * boneMatX;\n\tskinMatrix += skinWeight.y * boneMatY;\n\tskinMatrix += skinWeight.z * boneMatZ;\n\tskinMatrix += skinWeight.w * boneMatW;\n\tskinMatrix = bindMatrixInverse * skinMatrix * bindMatrix;\n\tobjectNormal = vec4( skinMatrix * vec4( objectNormal, 0.0 ) ).xyz;\n\t#ifdef USE_TANGENT\n\t\tobjectTangent = vec4( skinMatrix * vec4( objectTangent, 0.0 ) ).xyz;\n\t#endif\n#endif",specularmap_fragment:"float specularStrength;\n#ifdef USE_SPECULARMAP\n\tvec4 texelSpecular = texture2D( specularMap, vUv );\n\tspecularStrength = texelSpecular.r;\n#else\n\tspecularStrength = 1.0;\n#endif",specularmap_pars_fragment:"#ifdef USE_SPECULARMAP\n\tuniform sampler2D specularMap;\n#endif",tonemapping_fragment:"#if defined( TONE_MAPPING )\n\tgl_FragColor.rgb = toneMapping( gl_FragColor.rgb );\n#endif",tonemapping_pars_fragment:"#ifndef saturate\n#define saturate(a) clamp( a, 0.0, 1.0 )\n#endif\nuniform float toneMappingExposure;\nuniform float toneMappingWhitePoint;\nvec3 LinearToneMapping( vec3 color ) {\n\treturn toneMappingExposure * color;\n}\nvec3 ReinhardToneMapping( vec3 color ) {\n\tcolor *= toneMappingExposure;\n\treturn saturate( color / ( vec3( 1.0 ) + color ) );\n}\n#define Uncharted2Helper( x ) max( ( ( x * ( 0.15 * x + 0.10 * 0.50 ) + 0.20 * 0.02 ) / ( x * ( 0.15 * x + 0.50 ) + 0.20 * 0.30 ) ) - 0.02 / 0.30, vec3( 0.0 ) )\nvec3 Uncharted2ToneMapping( vec3 color ) {\n\tcolor *= toneMappingExposure;\n\treturn saturate( Uncharted2Helper( color ) / Uncharted2Helper( vec3( toneMappingWhitePoint ) ) );\n}\nvec3 OptimizedCineonToneMapping( vec3 color ) {\n\tcolor *= toneMappingExposure;\n\tcolor = max( vec3( 0.0 ), color - 0.004 );\n\treturn pow( ( color * ( 6.2 * color + 0.5 ) ) / ( color * ( 6.2 * color + 1.7 ) + 0.06 ), vec3( 2.2 ) );\n}\nvec3 ACESFilmicToneMapping( vec3 color ) {\n\tcolor *= toneMappingExposure;\n\treturn saturate( ( color * ( 2.51 * color + 0.03 ) ) / ( color * ( 2.43 * color + 0.59 ) + 0.14 ) );\n}",uv_pars_fragment:"#ifdef USE_UV\n\tvarying vec2 vUv;\n#endif",uv_pars_vertex:"#ifdef USE_UV\n\tvarying vec2 vUv;\n\tuniform mat3 uvTransform;\n#endif",uv_vertex:"#ifdef USE_UV\n\tvUv = ( uvTransform * vec3( uv, 1 ) ).xy;\n#endif",uv2_pars_fragment:"#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP )\n\tvarying vec2 vUv2;\n#endif",uv2_pars_vertex:"#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP )\n\tattribute vec2 uv2;\n\tvarying vec2 vUv2;\n#endif",uv2_vertex:"#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP )\n\tvUv2 = uv2;\n#endif",worldpos_vertex:"#if defined( USE_ENVMAP ) || defined( DISTANCE ) || defined ( USE_SHADOWMAP )\n\tvec4 worldPosition = vec4( transformed, 1.0 );\n\t#ifdef USE_INSTANCING\n\t\tworldPosition = instanceMatrix * worldPosition;\n\t#endif\n\tworldPosition = modelMatrix * worldPosition;\n#endif",background_frag:"uniform sampler2D t2D;\nvarying vec2 vUv;\nvoid main() {\n\tvec4 texColor = texture2D( t2D, vUv );\n\tgl_FragColor = mapTexelToLinear( texColor );\n\t#include \n\t#include \n}",background_vert:"varying vec2 vUv;\nuniform mat3 uvTransform;\nvoid main() {\n\tvUv = ( uvTransform * vec3( uv, 1 ) ).xy;\n\tgl_Position = vec4( position.xy, 1.0, 1.0 );\n}",cube_frag:"uniform samplerCube tCube;\nuniform float tFlip;\nuniform float opacity;\nvarying vec3 vWorldDirection;\nvoid main() {\n\tvec4 texColor = textureCube( tCube, vec3( tFlip * vWorldDirection.x, vWorldDirection.yz ) );\n\tgl_FragColor = mapTexelToLinear( texColor );\n\tgl_FragColor.a *= opacity;\n\t#include \n\t#include \n}",cube_vert:"varying vec3 vWorldDirection;\n#include \nvoid main() {\n\tvWorldDirection = transformDirection( position, modelMatrix );\n\t#include \n\t#include \n\tgl_Position.z = gl_Position.w;\n}",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( 1.0 - gl_FragCoord.z ), opacity );\n\t#elif DEPTH_PACKING == 3201\n\t\tgl_FragColor = packDepthToRGBA( gl_FragCoord.z );\n\t#endif\n}",depth_vert:"#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#ifdef USE_DISPLACEMENTMAP\n\t\t#include \n\t\t#include \n\t\t#include \n\t#endif\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}",distanceRGBA_frag:"#define DISTANCE\nuniform vec3 referencePosition;\nuniform float nearDistance;\nuniform float farDistance;\nvarying vec3 vWorldPosition;\n#include \n#include \n#include \n#include \n#include \n#include \nvoid main () {\n\t#include \n\tvec4 diffuseColor = vec4( 1.0 );\n\t#include \n\t#include \n\t#include \n\tfloat dist = length( vWorldPosition - referencePosition );\n\tdist = ( dist - nearDistance ) / ( farDistance - nearDistance );\n\tdist = saturate( dist );\n\tgl_FragColor = packDepthToRGBA( dist );\n}",distanceRGBA_vert:"#define DISTANCE\nvarying vec3 vWorldPosition;\n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#ifdef USE_DISPLACEMENTMAP\n\t\t#include \n\t\t#include \n\t\t#include \n\t#endif\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tvWorldPosition = worldPosition.xyz;\n}",equirect_frag:"uniform sampler2D tEquirect;\nvarying vec3 vWorldDirection;\n#include \nvoid main() {\n\tvec3 direction = normalize( vWorldDirection );\n\tvec2 sampleUV;\n\tsampleUV.y = asin( clamp( direction.y, - 1.0, 1.0 ) ) * RECIPROCAL_PI + 0.5;\n\tsampleUV.x = atan( direction.z, direction.x ) * RECIPROCAL_PI2 + 0.5;\n\tvec4 texColor = texture2D( tEquirect, sampleUV );\n\tgl_FragColor = mapTexelToLinear( texColor );\n\t#include \n\t#include \n}",equirect_vert:"varying vec3 vWorldDirection;\n#include \nvoid main() {\n\tvWorldDirection = transformDirection( position, modelMatrix );\n\t#include \n\t#include \n}",linedashed_frag:"uniform vec3 diffuse;\nuniform float opacity;\nuniform float dashSize;\nuniform float totalSize;\nvarying float vLineDistance;\n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\tif ( mod( vLineDistance, totalSize ) > dashSize ) {\n\t\tdiscard;\n\t}\n\tvec3 outgoingLight = vec3( 0.0 );\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include \n\t#include \n\toutgoingLight = diffuseColor.rgb;\n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include \n\t#include \n\t#include \n\t#include \n}",linedashed_vert:"uniform float scale;\nattribute float lineDistance;\nvarying float vLineDistance;\n#include \n#include \n#include \n#include \n#include \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}",meshbasic_frag:"uniform vec3 diffuse;\nuniform float opacity;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \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\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include \n\t#include \n\t#include \n\t#include \n}",meshbasic_vert:"#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#include \n\t#include \n\t#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}",meshlambert_frag:"uniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float opacity;\nvarying vec3 vLightFront;\nvarying vec3 vIndirectFront;\n#ifdef DOUBLE_SIDED\n\tvarying vec3 vLightBack;\n\tvarying vec3 vIndirectBack;\n#endif\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \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#ifdef DOUBLE_SIDED\n\t\treflectedLight.indirectDiffuse += ( gl_FrontFacing ) ? vIndirectFront : vIndirectBack;\n\t#else\n\t\treflectedLight.indirectDiffuse += vIndirectFront;\n\t#endif\n\t#include \n\treflectedLight.indirectDiffuse *= BRDF_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\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}",meshlambert_vert:"#define LAMBERT\nvarying vec3 vLightFront;\nvarying vec3 vIndirectFront;\n#ifdef DOUBLE_SIDED\n\tvarying vec3 vLightBack;\n\tvarying vec3 vIndirectBack;\n#endif\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}",meshmatcap_frag:"#define MATCAP\nuniform vec3 diffuse;\nuniform float opacity;\nuniform sampler2D matcap;\nvarying vec3 vViewPosition;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\n#include \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\tvec3 viewDir = normalize( vViewPosition );\n\tvec3 x = normalize( vec3( viewDir.z, 0.0, - viewDir.x ) );\n\tvec3 y = cross( viewDir, x );\n\tvec2 uv = vec2( dot( x, normal ), dot( y, normal ) ) * 0.495 + 0.5;\n\t#ifdef USE_MATCAP\n\t\tvec4 matcapColor = texture2D( matcap, uv );\n\t\tmatcapColor = matcapTexelToLinear( matcapColor );\n\t#else\n\t\tvec4 matcapColor = vec4( 1.0 );\n\t#endif\n\tvec3 outgoingLight = diffuseColor.rgb * matcapColor.rgb;\n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include \n\t#include \n\t#include \n\t#include \n}",meshmatcap_vert:"#define MATCAP\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 \nvoid main() {\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#ifndef FLAT_SHADED\n\t\tvNormal = normalize( transformedNormal );\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\tvViewPosition = - mvPosition.xyz;\n}",meshphong_frag:"#define PHONG\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform vec3 specular;\nuniform float shininess;\nuniform float opacity;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveRadiance;\n\t#include \n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \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}",meshphysical_frag:"#define STANDARD\n#ifdef PHYSICAL\n\t#define REFLECTIVITY\n\t#define CLEARCOAT\n\t#define TRANSPARENCY\n#endif\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float roughness;\nuniform float metalness;\nuniform float opacity;\n#ifdef TRANSPARENCY\n\tuniform float transparency;\n#endif\n#ifdef REFLECTIVITY\n\tuniform float reflectivity;\n#endif\n#ifdef CLEARCOAT\n\tuniform float clearcoat;\n\tuniform float clearcoatRoughness;\n#endif\n#ifdef USE_SHEEN\n\tuniform vec3 sheen;\n#endif\nvarying vec3 vViewPosition;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n\t#ifdef USE_TANGENT\n\t\tvarying vec3 vTangent;\n\t\tvarying vec3 vBitangent;\n\t#endif\n#endif\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveRadiance;\n\t#ifdef TRANSPARENCY\n\t\tdiffuseColor.a *= saturate( 1. - transparency + linearToRelativeLuminance( reflectedLight.directSpecular + reflectedLight.indirectSpecular ) );\n\t#endif\n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}",meshphysical_vert:"#define STANDARD\nvarying vec3 vViewPosition;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n\t#ifdef USE_TANGENT\n\t\tvarying vec3 vTangent;\n\t\tvarying vec3 vBitangent;\n\t#endif\n#endif\n#include \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\t#ifdef USE_TANGENT\n\t\tvTangent = normalize( transformedTangent );\n\t\tvBitangent = normalize( cross( vNormal, vTangent ) * tangent.w );\n\t#endif\n#endif\n\t#include \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}",normal_frag:"#define NORMAL\nuniform float opacity;\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( TANGENTSPACE_NORMALMAP )\n\tvarying vec3 vViewPosition;\n#endif\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n\t#ifdef USE_TANGENT\n\t\tvarying vec3 vTangent;\n\t\tvarying vec3 vBitangent;\n\t#endif\n#endif\n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#include \n\t#include \n\tgl_FragColor = vec4( packNormalToRGB( normal ), opacity );\n}",normal_vert:"#define NORMAL\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( TANGENTSPACE_NORMALMAP )\n\tvarying vec3 vViewPosition;\n#endif\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n\t#ifdef USE_TANGENT\n\t\tvarying vec3 vTangent;\n\t\tvarying vec3 vBitangent;\n\t#endif\n#endif\n#include \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\t#ifdef USE_TANGENT\n\t\tvTangent = normalize( transformedTangent );\n\t\tvBitangent = normalize( cross( vNormal, vTangent ) * tangent.w );\n\t#endif\n#endif\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( TANGENTSPACE_NORMALMAP )\n\tvViewPosition = - mvPosition.xyz;\n#endif\n}",points_frag:"uniform vec3 diffuse;\nuniform float opacity;\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}",points_vert:"uniform float size;\nuniform float scale;\n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#include \n\t#include \n\tgl_PointSize = size;\n\t#ifdef USE_SIZEATTENUATION\n\t\tbool isPerspective = isPerspectiveMatrix( projectionMatrix );\n\t\tif ( isPerspective ) gl_PointSize *= ( scale / - mvPosition.z );\n\t#endif\n\t#include \n\t#include \n\t#include \n\t#include \n}",shadow_frag:"uniform vec3 color;\nuniform float opacity;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\tgl_FragColor = vec4( color, opacity * ( 1.0 - getShadowMask() ) );\n\t#include \n}",shadow_vert:"#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}",sprite_frag:"uniform vec3 diffuse;\nuniform float opacity;\n#include \n#include \n#include \n#include \n#include \n#include \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\toutgoingLight = diffuseColor.rgb;\n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include \n\t#include \n\t#include \n}",sprite_vert:"uniform float rotation;\nuniform vec2 center;\n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\tvec4 mvPosition = modelViewMatrix * vec4( 0.0, 0.0, 0.0, 1.0 );\n\tvec2 scale;\n\tscale.x = length( vec3( modelMatrix[ 0 ].x, modelMatrix[ 0 ].y, modelMatrix[ 0 ].z ) );\n\tscale.y = length( vec3( modelMatrix[ 1 ].x, modelMatrix[ 1 ].y, modelMatrix[ 1 ].z ) );\n\t#ifndef USE_SIZEATTENUATION\n\t\tbool isPerspective = isPerspectiveMatrix( projectionMatrix );\n\t\tif ( isPerspective ) scale *= - mvPosition.z;\n\t#endif\n\tvec2 alignedPosition = ( position.xy - ( center - vec2( 0.5 ) ) ) * scale;\n\tvec2 rotatedPosition;\n\trotatedPosition.x = cos( rotation ) * alignedPosition.x - sin( rotation ) * alignedPosition.y;\n\trotatedPosition.y = sin( rotation ) * alignedPosition.x + cos( rotation ) * alignedPosition.y;\n\tmvPosition.xy += rotatedPosition;\n\tgl_Position = projectionMatrix * mvPosition;\n\t#include \n\t#include \n\t#include \n}"},Jl={common:{diffuse:{value:new x(15658734)},opacity:{value:1},map:{value:null},uvTransform:{value:new r},alphaMap:{value:null}},specularmap:{specularMap:{value:null}},envmap:{envMap:{value:null},flipEnvMap:{value:-1},reflectivity:{value:1},refractionRatio:{value:.98},maxMipLevel:{value:0}},aomap:{aoMap:{value:null},aoMapIntensity:{value:1}},lightmap:{lightMap:{value:null},lightMapIntensity:{value:1}},emissivemap:{emissiveMap:{value:null}},bumpmap:{bumpMap:{value:null},bumpScale:{value:1}},normalmap:{normalMap:{value:null},normalScale:{value:new e(1,1)}},displacementmap:{displacementMap:{value:null},displacementScale:{value:1},displacementBias:{value:0}},roughnessmap:{roughnessMap:{value:null}},metalnessmap:{metalnessMap:{value:null}},gradientmap:{gradientMap:{value:null}},fog:{fogDensity:{value:25e-5},fogNear:{value:1},fogFar:{value:2e3},fogColor:{value:new x(16777215)}},lights:{ambientLightColor:{value:[]},lightProbe:{value:[]},directionalLights:{value:[],properties:{direction:{},color:{},shadow:{},shadowBias:{},shadowRadius:{},shadowMapSize:{}}},directionalShadowMap:{value:[]},directionalShadowMatrix:{value:[]},spotLights:{value:[],properties:{color:{},position:{},direction:{},distance:{},coneCos:{},penumbraCos:{},decay:{},shadow:{},shadowBias:{},shadowRadius:{},shadowMapSize:{}}},spotShadowMap:{value:[]},spotShadowMatrix:{value:[]},pointLights:{value:[],properties:{color:{},position:{},decay:{},distance:{},shadow:{},shadowBias:{},shadowRadius:{},shadowMapSize:{},shadowCameraNear:{},shadowCameraFar:{}}},pointShadowMap:{value:[]},pointShadowMatrix:{value:[]},hemisphereLights:{value:[],properties:{direction:{},skyColor:{},groundColor:{}}},rectAreaLights:{value:[],properties:{color:{},position:{},width:{},height:{}}}},points:{diffuse:{value:new x(15658734)},opacity:{value:1},size:{value:1},scale:{value:1},map:{value:null},uvTransform:{value:new r}},sprite:{diffuse:{value:new x(15658734)},opacity:{value:1},center:{value:new e(.5,.5)},rotation:{value:0},map:{value:null},uvTransform:{value:new r}}},($l={basic:{uniforms:W([Jl.common,Jl.specularmap,Jl.envmap,Jl.aomap,Jl.lightmap,Jl.fog]),vertexShader:Zl.meshbasic_vert,fragmentShader:Zl.meshbasic_frag},lambert:{uniforms:W([Jl.common,Jl.specularmap,Jl.envmap,Jl.aomap,Jl.lightmap,Jl.emissivemap,Jl.fog,Jl.lights,{emissive:{value:new x(0)}}]),vertexShader:Zl.meshlambert_vert,fragmentShader:Zl.meshlambert_frag},phong:{uniforms:W([Jl.common,Jl.specularmap,Jl.envmap,Jl.aomap,Jl.lightmap,Jl.emissivemap,Jl.bumpmap,Jl.normalmap,Jl.displacementmap,Jl.gradientmap,Jl.fog,Jl.lights,{emissive:{value:new x(0)},specular:{value:new x(1118481)},shininess:{value:30}}]),vertexShader:Zl.meshphong_vert,fragmentShader:Zl.meshphong_frag},standard:{uniforms:W([Jl.common,Jl.envmap,Jl.aomap,Jl.lightmap,Jl.emissivemap,Jl.bumpmap,Jl.normalmap,Jl.displacementmap,Jl.roughnessmap,Jl.metalnessmap,Jl.fog,Jl.lights,{emissive:{value:new x(0)},roughness:{value:.5},metalness:{value:.5},envMapIntensity:{value:1}}]),vertexShader:Zl.meshphysical_vert,fragmentShader:Zl.meshphysical_frag},matcap:{uniforms:W([Jl.common,Jl.bumpmap,Jl.normalmap,Jl.displacementmap,Jl.fog,{matcap:{value:null}}]),vertexShader:Zl.meshmatcap_vert,fragmentShader:Zl.meshmatcap_frag},points:{uniforms:W([Jl.points,Jl.fog]),vertexShader:Zl.points_vert,fragmentShader:Zl.points_frag},dashed:{uniforms:W([Jl.common,Jl.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:Zl.linedashed_vert,fragmentShader:Zl.linedashed_frag},depth:{uniforms:W([Jl.common,Jl.displacementmap]),vertexShader:Zl.depth_vert,fragmentShader:Zl.depth_frag},normal:{uniforms:W([Jl.common,Jl.bumpmap,Jl.normalmap,Jl.displacementmap,{opacity:{value:1}}]),vertexShader:Zl.normal_vert,fragmentShader:Zl.normal_frag},sprite:{uniforms:W([Jl.sprite,Jl.fog]),vertexShader:Zl.sprite_vert,fragmentShader:Zl.sprite_frag},background:{uniforms:{uvTransform:{value:new r},t2D:{value:null}},vertexShader:Zl.background_vert,fragmentShader:Zl.background_frag},cube:{uniforms:{tCube:{value:null},tFlip:{value:-1},opacity:{value:1}},vertexShader:Zl.cube_vert,fragmentShader:Zl.cube_frag},equirect:{uniforms:{tEquirect:{value:null}},vertexShader:Zl.equirect_vert,fragmentShader:Zl.equirect_frag},distanceRGBA:{uniforms:W([Jl.common,Jl.displacementmap,{referencePosition:{value:new i},nearDistance:{value:1},farDistance:{value:1e3}}]),vertexShader:Zl.distanceRGBA_vert,fragmentShader:Zl.distanceRGBA_frag},shadow:{uniforms:W([Jl.lights,Jl.fog,{color:{value:new x(0)},opacity:{value:1}}]),vertexShader:Zl.shadow_vert,fragmentShader:Zl.shadow_frag}}).physical={uniforms:W([$l.standard.uniforms,{transparency:{value:0},clearcoat:{value:0},clearcoatRoughness:{value:0},sheen:{value:new x(0)},clearcoatNormalScale:{value:new e(1,1)},clearcoatNormalMap:{value:null}}]),vertexShader:Zl.meshphysical_vert,fragmentShader:Zl.meshphysical_frag},et.prototype=Object.create(V.prototype),et.prototype.constructor=et,nt.prototype=Object.create(k.prototype),nt.prototype.constructor=nt,ft.prototype=Object.create(o.prototype),ft.prototype.constructor=ft,ft.prototype.isCubeTexture=1,Object.defineProperty(ft.prototype,"images",{get:function(){return this.image},set:function(t){this.image=t}}),mt.prototype=Object.create(o.prototype),mt.prototype.constructor=mt,mt.prototype.isDataTexture2DArray=1,gt.prototype=Object.create(o.prototype),gt.prototype.constructor=gt,gt.prototype.isDataTexture3D=1,Ql=new o,Kl=new mt,tu=new gt,eu=new ft,nu=[],iu=[],ru=new Float32Array(16),ou=new Float32Array(9),au=new Float32Array(4),Jt.prototype.updateCache=function(t){var e=this.cache;t instanceof Float32Array&&e.length!==t.length&&(this.cache=new Float32Array(t.length)),xt(e,t)},$t.prototype.setValue=function(t,e,n){var i,r,o,a=this.seq;for(i=0,r=a.length;i!==r;++i)(o=a[i]).setValue(t,e[o.id],n)},su=/([\w\d_]+)(\])?(\[|\.)?/g,te.prototype.setValue=function(t,e,n,i){var r=this.map[e];void 0!==r&&r.setValue(t,n,i)},te.prototype.setOptional=function(t,e,n){var i=e[n];void 0!==i&&this.setValue(t,n,i)},te.upload=function(t,e,n,i){var r,o,a,s;for(r=0,o=e.length;r!==o;++r)0!=(s=n[(a=e[r]).id]).needsUpdate&&a.setValue(t,s.value,i)},te.seqWithValue=function(t,e){var n,i,r,o=[];for(n=0,i=t.length;n!==i;++n)(r=t[n]).id in e&&o.push(r);return o},cu=0,lu=/^[ \t]*#include +<([\w\d./]+)>/gm,uu=/#pragma unroll_loop[\s]+?for \( int i \= (\d+)\; i < (\d+)\; i \+\+ \) \{([\s\S]+?)(?=\})\}/g,hu=0,Ae.prototype=Object.create(S.prototype),Ae.prototype.constructor=Ae,Ae.prototype.isMeshDepthMaterial=1,Ae.prototype.copy=function(t){return S.prototype.copy.call(this,t),this.depthPacking=t.depthPacking,this.skinning=t.skinning,this.morphTargets=t.morphTargets,this.map=t.map,this.alphaMap=t.alphaMap,this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this},Le.prototype=Object.create(S.prototype),Le.prototype.constructor=Le,Le.prototype.isMeshDistanceMaterial=1,Le.prototype.copy=function(t){return S.prototype.copy.call(this,t),this.referencePosition.copy(t.referencePosition),this.nearDistance=t.nearDistance,this.farDistance=t.farDistance,this.skinning=t.skinning,this.morphTargets=t.morphTargets,this.map=t.map,this.alphaMap=t.alphaMap,this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this},pu="uniform sampler2D shadow_pass;\nuniform vec2 resolution;\nuniform float radius;\n#include \nvoid main() {\n float mean = 0.0;\n float squared_mean = 0.0;\n \n\tfloat depth = unpackRGBAToDepth( texture2D( shadow_pass, ( gl_FragCoord.xy ) / resolution ) );\n for ( float i = -1.0; i < 1.0 ; i += SAMPLE_RATE) {\n #ifdef HORIZONAL_PASS\n vec2 distribution = decodeHalfRGBA ( texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( i, 0.0 ) * radius ) / resolution ) );\n mean += distribution.x;\n squared_mean += distribution.y * distribution.y + distribution.x * distribution.x;\n #else\n float depth = unpackRGBAToDepth( texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( 0.0, i ) * radius ) / resolution ) );\n mean += depth;\n squared_mean += depth * depth;\n #endif\n }\n mean = mean * HALF_SAMPLE_RATE;\n squared_mean = squared_mean * HALF_SAMPLE_RATE;\n float std_dev = pow( squared_mean - mean * mean, 0.5 );\n gl_FragColor = encodeHalfRGBA( vec2( mean, std_dev ) );\n}",du="void main() {\n\tgl_Position = vec4( position, 1.0 );\n}",Oe.prototype=Object.assign(Object.create(s.prototype),{constructor:Oe,isWebGLMultiviewRenderTarget:1,copy:function(t){return s.prototype.copy.call(this,t),this.numViews=t.numViews,this},setNumViews:function(t){return this.numViews!==t&&(this.numViews=t,this.dispose()),this}}),Ie.prototype=Object.assign(Object.create(p.prototype),{constructor:Ie,isGroup:1}),ze.prototype=Object.assign(Object.create(X.prototype),{constructor:ze,isArrayCamera:1}),fu=new i,mu=new i,Object.assign(Fe.prototype,t.prototype),Object.assign(ke.prototype,t.prototype),Object.assign(Ue.prototype,{isFogExp2:1,clone:function(){return new Ue(this.color,this.density)},toJSON:function(){return{type:"FogExp2",color:this.color.getHex(),density:this.density}}}),Object.assign(je.prototype,{isFog:1,clone:function(){return new je(this.color,this.near,this.far)},toJSON:function(){return{type:"Fog",color:this.color.getHex(),near:this.near,far:this.far}}}),Object.defineProperty(Ve.prototype,"needsUpdate",{set:function(t){1==t&&this.version++}}),Object.assign(Ve.prototype,{isInterleavedBuffer:1,onUploadCallback:function(){},setDynamic:function(t){return this.dynamic=t,this},copy:function(t){return this.array=new t.array.constructor(t.array),this.count=t.count,this.stride=t.stride,this.dynamic=t.dynamic,this},copyAt:function(t,e,n){t*=this.stride,n*=e.stride;for(var i=0,r=this.stride;it.far||n.push({distance:s,point:vu.clone(),uv:y.getUV(vu,Mu,Su,Tu,Au,Lu,Cu,new e),face:null,object:this})},clone:function(){return new this.constructor(this.material).copy(this)},copy:function(t){return p.prototype.copy.call(this,t),void 0!==t.center&&this.center.copy(t.center),this}}),Pu=new i,Eu=new i,Xe.prototype=Object.assign(Object.create(p.prototype),{constructor:Xe,isLOD:1,copy:function(t){var e,n,i,r;for(p.prototype.copy.call(this,t,0),n=0,i=(e=t.levels).length;n1){for(Pu.setFromMatrixPosition(t.matrixWorld),Eu.setFromMatrixPosition(this.matrixWorld),e=Pu.distanceTo(Eu),r[0].object.visible=1,n=1,i=r.length;n=r[n].distance;n++)r[n-1].object.visible=0,r[n].object.visible=1;for(;nr||(c.applyMatrix4(this.matrixWorld),(v=t.ray.origin.distanceTo(c))t.far||e.push({distance:v,point:s.clone().applyMatrix4(this.matrixWorld),index:d,face:null,faceIndex:null,object:this}));else for(d=0,f=h.length/3-1;dr||(c.applyMatrix4(this.matrixWorld),(v=t.ray.origin.distanceTo(c))t.far||e.push({distance:v,point:s.clone().applyMatrix4(this.matrixWorld),index:d,face:null,faceIndex:null,object:this}));else if(_.isGeometry)for(x=(y=_.vertices).length,d=0;dr||(c.applyMatrix4(this.matrixWorld),(v=t.ray.origin.distanceTo(c))t.far||e.push({distance:v,point:s.clone().applyMatrix4(this.matrixWorld),index:d,face:null,faceIndex:null,object:this}))},clone:function(){return new this.constructor(this.geometry,this.material).copy(this)}}),ku=new i,Bu=new i,tn.prototype=Object.assign(Object.create(Ke.prototype),{constructor:tn,isLineSegments:1,computeLineDistances:function(){var t,e,n,i,r,o=this.geometry;if(o.isBufferGeometry){if(null===o.index){for(e=[],n=0,i=(t=o.attributes.position).count;n0&&void 0!==(o=i[r[0]]))for(this.morphTargetInfluences=[],this.morphTargetDictionary={},t=0,e=o.length;t=t.HAVE_CURRENT_DATA&&(this.needsUpdate=1)}}),sn.prototype=Object.create(o.prototype),sn.prototype.constructor=sn,sn.prototype.isCompressedTexture=1,cn.prototype=Object.create(o.prototype),cn.prototype.constructor=cn,cn.prototype.isCanvasTexture=1,ln.prototype=Object.create(o.prototype),ln.prototype.constructor=ln,ln.prototype.isDepthTexture=1,un.prototype=Object.create(k.prototype),un.prototype.constructor=un,hn.prototype=Object.create(V.prototype),hn.prototype.constructor=hn,pn.prototype=Object.create(k.prototype),pn.prototype.constructor=pn,dn.prototype=Object.create(V.prototype),dn.prototype.constructor=dn,fn.prototype=Object.create(k.prototype),fn.prototype.constructor=fn,mn.prototype=Object.create(V.prototype),mn.prototype.constructor=mn,gn.prototype=Object.create(fn.prototype),gn.prototype.constructor=gn,vn.prototype=Object.create(V.prototype),vn.prototype.constructor=vn,yn.prototype=Object.create(fn.prototype),yn.prototype.constructor=yn,xn.prototype=Object.create(V.prototype),xn.prototype.constructor=xn,bn.prototype=Object.create(fn.prototype),bn.prototype.constructor=bn,_n.prototype=Object.create(V.prototype),_n.prototype.constructor=_n,wn.prototype=Object.create(fn.prototype),wn.prototype.constructor=wn,Mn.prototype=Object.create(V.prototype),Mn.prototype.constructor=Mn,Sn.prototype=Object.create(k.prototype),Sn.prototype.constructor=Sn,Sn.prototype.toJSON=function(){var t=k.prototype.toJSON.call(this);return t.path=this.parameters.path.toJSON(),t},Tn.prototype=Object.create(V.prototype),Tn.prototype.constructor=Tn,An.prototype=Object.create(k.prototype),An.prototype.constructor=An,Ln.prototype=Object.create(V.prototype),Ln.prototype.constructor=Ln,Cn.prototype=Object.create(k.prototype),Cn.prototype.constructor=Cn,Wu=function(t,e,n){var i,r,o,a,s,c,l,u,h,p,d,f;if(n=n||2,a=[],!(o=Pn(t,0,r=(i=e&&e.length)?e[0]*n:t.length,n,1))||o.next===o.prev)return a;if(i&&(o=function(t,e,n,i){var r,o,a,s=[];for(r=0,o=e.length;r80*n){for(s=l=t[0],c=u=t[1],f=n;fl&&(l=h),p>u&&(u=p);d=0!==(d=Math.max(l-s,u-c))?1/d:0}return Nn(o,a,n,s,c,d),a},Hu={area:function(t){var e,n,i=t.length,r=0;for(e=i-1,n=0;n=c)break t;for(t<(i=o[1])&&(a=2,c=i),n=a-2;;){if(void 0===c)return this._cachedIndex=0,this.beforeStart_(0,t,s);if(a===n)break;if(s=c,t>=(c=o[--a-1]))break e}e=a,a=0}for(;a>>1]?e=r:a=r+1;if(s=o[a],void 0===(c=o[a-1]))return this._cachedIndex=0,this.beforeStart_(0,t,s);if(void 0===s)return a=o.length,this._cachedIndex=a,this.afterEnd_(a-1,c,t)}this._cachedIndex=a,this.intervalChanged_(a,c,s)}return this.interpolate_(a,c,t,s)},settings:null,DefaultSettings_:{},getSettings_:function(){return this.settings||this.DefaultSettings_},copySampleValue_:function(t){var e,n=this.resultBuffer,i=this.sampleValues,r=this.valueSize,o=t*r;for(e=0;e!==r;++e)n[e]=i[o+e];return n},interpolate_:function(){throw Error("call to abstract method")},intervalChanged_:function(){}}),Object.assign(Pi.prototype,{beforeStart_:Pi.prototype.copySampleValue_,afterEnd_:Pi.prototype.copySampleValue_}),Ei.prototype=Object.assign(Object.create(Pi.prototype),{constructor:Ei,DefaultSettings_:{endingStart:Fs,endingEnd:Fs},intervalChanged_:function(t,e,n){var i,r,o=this.parameterPositions,a=t-2,s=t+1,c=o[a],l=o[s];if(void 0===c)switch(this.getSettings_().endingStart){case 2401:a=t,c=2*e-n;break;case 2402:c=e+o[a=o.length-2]-o[a+1];break;default:a=t,c=n}if(void 0===l)switch(this.getSettings_().endingEnd){case 2401:s=t,l=2*n-e;break;case 2402:s=1,l=n+o[1]-o[0];break;default:s=t-1,l=e}i=.5*(n-e),r=this.valueSize,this._weightPrev=i/(e-c),this._weightNext=i/(l-n),this._offsetPrev=a*r,this._offsetNext=s*r},interpolate_:function(t,e,n,i){var r,o=this.resultBuffer,a=this.sampleValues,s=this.valueSize,c=t*s,l=c-s,u=this._offsetPrev,h=this._offsetNext,p=this._weightPrev,d=this._weightNext,f=(n-e)/(i-e),m=f*f,g=m*f,v=-p*g+2*p*m-p*f,y=(1+p)*g+(-1.5-2*p)*m+(-.5+p)*f+1,x=(-1-d)*g+(1.5+d)*m+.5*f,b=d*g-d*m;for(r=0;r!==s;++r)o[r]=v*a[u+r]+y*a[l+r]+x*a[c+r]+b*a[h+r];return o}}),Ni.prototype=Object.assign(Object.create(Pi.prototype),{constructor:Ni,interpolate_:function(t,e,n,i){var r,o=this.resultBuffer,a=this.sampleValues,s=this.valueSize,c=t*s,l=c-s,u=(n-e)/(i-e),h=1-u;for(r=0;r!==s;++r)o[r]=a[l+r]*h+a[c+r]*u;return o}}),Oi.prototype=Object.assign(Object.create(Pi.prototype),{constructor:Oi,interpolate_:function(t){return this.copySampleValue_(t-1)}}),Object.assign(Di,{toJSON:function(t){var e,n,i=t.constructor;return void 0!==i.toJSON?e=i.toJSON(t):(e={name:t.name,times:Zu.convertArray(t.times,Array),values:Zu.convertArray(t.values,Array)},(n=t.getInterpolation())!==t.DefaultInterpolation&&(e.interpolation=n)),e.type=t.ValueTypeName,e}}),Object.assign(Di.prototype,{constructor:Di,TimeBufferType:Float32Array,ValueBufferType:Float32Array,DefaultInterpolation:2301,InterpolantFactoryMethodDiscrete:function(t){return new Oi(this.times,this.values,this.getValueSize(),t)},InterpolantFactoryMethodLinear:function(t){return new Ni(this.times,this.values,this.getValueSize(),t)},InterpolantFactoryMethodSmooth:function(t){return new Ei(this.times,this.values,this.getValueSize(),t)},setInterpolation:function(t){var e,n;switch(t){case 2300:e=this.InterpolantFactoryMethodDiscrete;break;case 2301:e=this.InterpolantFactoryMethodLinear;break;case 2302:e=this.InterpolantFactoryMethodSmooth}if(void 0===e){if(n="unsupported interpolation for "+this.ValueTypeName+" keyframe track named "+this.name,void 0===this.createInterpolant){if(t===this.DefaultInterpolation)throw Error(n);this.setInterpolation(this.DefaultInterpolation)}return this}return this.createInterpolant=e,this},getInterpolation:function(){switch(this.createInterpolant){case this.InterpolantFactoryMethodDiscrete:return 2300;case this.InterpolantFactoryMethodLinear:return 2301;case this.InterpolantFactoryMethodSmooth:return 2302}},getValueSize:function(){return this.values.length/this.times.length},shift:function(t){var e,n,i;if(0!==t)for(n=0,i=(e=this.times).length;n!==i;++n)e[n]+=t;return this},scale:function(t){var e,n,i;if(1!==t)for(n=0,i=(e=this.times).length;n!==i;++n)e[n]*=t;return this},trim:function(t,e){for(var n,i=this.times,r=i.length,o=0,a=r-1;o!==r&&i[o]e;)--a;return++a,0===o&&a===r||(o>=a&&(o=(a=Math.max(a,1))-1),n=this.getValueSize(),this.times=Zu.arraySlice(i,o,a),this.values=Zu.arraySlice(this.values,o*n,a*n)),this},validate:function(){var t,e,n,i,r,o,a,s,c=1,l=this.getValueSize();for(l-Math.floor(l)!=0&&(c=0),t=this.times,e=this.values,0===(n=t.length)&&(c=0),i=null,r=0;r!==n;r++){if("number"==typeof(o=t[r])&&isNaN(o)){c=0;break}if(null!==i&&i>o){c=0;break}i=o}if(void 0!==e&&Zu.isTypedArray(e))for(r=0,a=e.length;r!==a;++r)if(s=e[r],isNaN(s)){c=0;break}return c},optimize:function(){var t,e,n,i,r,o,a,s,c,l,u=this.times,h=this.values,p=this.getValueSize(),d=2302===this.getInterpolation(),f=1,m=u.length-1;for(t=1;t0){for(u[f]=u[m],c=m*p,l=f*p,a=0;a!==p;++a)h[l+a]=h[c+a];++f}return f!==u.length&&(this.times=Zu.arraySlice(u,0,f),this.values=Zu.arraySlice(h,0,f*p)),this},clone:function(){var t=Zu.arraySlice(this.times,0),e=Zu.arraySlice(this.values,0),n=new(0,this.constructor)(this.name,t,e);return n.createInterpolant=this.createInterpolant,n}}),Ii.prototype=Object.assign(Object.create(Di.prototype),{constructor:Ii,ValueTypeName:"bool",ValueBufferType:Array,DefaultInterpolation:2300,InterpolantFactoryMethodLinear:void 0,InterpolantFactoryMethodSmooth:void 0}),zi.prototype=Object.assign(Object.create(Di.prototype),{constructor:zi,ValueTypeName:"color"}),Ri.prototype=Object.assign(Object.create(Di.prototype),{constructor:Ri,ValueTypeName:"number"}),Fi.prototype=Object.assign(Object.create(Pi.prototype),{constructor:Fi,interpolate_:function(t,e,i,r){var o,a=this.resultBuffer,s=this.sampleValues,c=this.valueSize,l=t*c,u=(i-e)/(r-e);for(o=l+c;l!==o;l+=4)n.slerpFlat(a,0,s,l-c,s,l,u);return a}}),ki.prototype=Object.assign(Object.create(Di.prototype),{constructor:ki,ValueTypeName:"quaternion",DefaultInterpolation:2301,InterpolantFactoryMethodLinear:function(t){return new Fi(this.times,this.values,this.getValueSize(),t)},InterpolantFactoryMethodSmooth:void 0}),Bi.prototype=Object.assign(Object.create(Di.prototype),{constructor:Bi,ValueTypeName:"string",ValueBufferType:Array,DefaultInterpolation:2300,InterpolantFactoryMethodLinear:void 0,InterpolantFactoryMethodSmooth:void 0}),Ui.prototype=Object.assign(Object.create(Di.prototype),{constructor:Ui,ValueTypeName:"vector"}),Object.assign(ji,{parse:function(t){var e,n,i=[],r=t.tracks,o=1/(t.fps||1);for(e=0,n=r.length;e!==n;++e)i.push(Vi(r[e]).scale(o));return new ji(t.name,t.duration,i)},toJSON:function(t){var e,n,i=[],r=t.tracks,o={name:t.name,duration:t.duration,tracks:i,uuid:t.uuid};for(e=0,n=r.length;e!==n;++e)i.push(Di.toJSON(r[e]));return o},CreateFromMorphTargetSequence:function(t,e,n,i){var r,o,a,s,c=e.length,l=[];for(r=0;r1&&((c=u[s=a[1]])||(u[s]=c=[]),c.push(o));for(s in l=[],u)l.push(ji.CreateFromMorphTargetSequence(s,u[s],e,n));return l},parseAnimation:function(t,e){var n,i,r,o,a,s,c,l,u,h,p,d,f,m,g,v;if(!t)return null;for(n=function(t,e,n,i,r){var o,a;0!==n.length&&(o=[],a=[],Zu.flattenJSON(n,o,a,i),0!==o.length&&r.push(new t(e,o,a)))},i=[],r=t.name||"default",o=t.length||-1,a=t.fps||30,s=t.hierarchy||[],c=0;c0||0===t.search(/^data\:image\/jpeg/);r.format=i?as:ss,r.needsUpdate=1,void 0!==e&&e(r)},n,i),r}}),Object.assign(Qi.prototype,{getPoint:function(){return null},getPointAt:function(t,e){var n=this.getUtoTmapping(t);return this.getPoint(n,e)},getPoints:function(t){var e,n;for(void 0===t&&(t=5),e=[],n=0;n<=t;n++)e.push(this.getPoint(n/t));return e},getSpacedPoints:function(t){var e,n;for(void 0===t&&(t=5),e=[],n=0;n<=t;n++)e.push(this.getPointAt(n/t));return e},getLength:function(){var t=this.getLengths();return t[t.length-1]},getLengths:function(t){var e,n,i,r,o;if(void 0===t&&(t=this.arcLengthDivisions),this.cacheArcLengths&&this.cacheArcLengths.length===t+1&&!this.needsUpdate)return this.cacheArcLengths;for(this.needsUpdate=0,e=[],i=this.getPoint(0),o=0,e.push(0),r=1;r<=t;r++)o+=(n=this.getPoint(r/t)).distanceTo(i),e.push(o),i=n;return this.cacheArcLengths=e,e},updateArcLengths:function(){this.needsUpdate=1,this.getLengths()},getUtoTmapping:function(t,e){var n,i,r,o,a,s=this.getLengths(),c=0,l=s.length;for(n=e||t*s[l-1],i=0,r=l-1;i<=r;)if((o=s[c=Math.floor(i+(r-i)/2)]-n)<0)i=c+1;else{if(!(o>0)){r=c;break}r=c-1}return s[c=r]===n?c/(l-1):(c+(n-(a=s[c]))/(s[c+1]-a))/(l-1)},getTangent:function(t){var e,n=t-1e-4,i=t+1e-4;return n<0&&(n=0),i>1&&(i=1),e=this.getPoint(n),this.getPoint(i).clone().sub(e).normalize()},getTangentAt:function(t){var e=this.getUtoTmapping(t);return this.getTangent(e)},computeFrenetFrames:function(t,e){var n,r,o,a,s,c,u,h=new i,p=[],d=[],f=[],m=new i,g=new l;for(n=0;n<=t;n++)r=n/t,p[n]=this.getTangentAt(r),p[n].normalize();for(d[0]=new i,f[0]=new i,a=Number.MAX_VALUE,s=Math.abs(p[0].x),c=Math.abs(p[0].y),u=Math.abs(p[0].z),s<=a&&(a=s,h.set(1,0,0)),c<=a&&(a=c,h.set(0,1,0)),u<=a&&h.set(0,0,1),m.crossVectors(p[0],h).normalize(),d[0].crossVectors(p[0],m),f[0].crossVectors(p[0],d[0]),n=1;n<=t;n++)d[n]=d[n-1].clone(),f[n]=f[n-1].clone(),m.crossVectors(p[n-1],p[n]),m.length()>Number.EPSILON&&(m.normalize(),o=Math.acos(ic.clamp(p[n-1].dot(p[n]),-1,1)),d[n].applyMatrix4(g.makeRotationAxis(m,o))),f[n].crossVectors(p[n],d[n]);if(1==e)for(o=Math.acos(ic.clamp(d[0].dot(d[t]),-1,1)),o/=t,p[0].dot(m.crossVectors(d[0],d[t]))>0&&(o=-o),n=1;n<=t;n++)d[n].applyMatrix4(g.makeRotationAxis(p[n],o*n)),f[n].crossVectors(p[n],d[n]);return{tangents:p,normals:d,binormals:f}},clone:function(){return(new this.constructor).copy(this)},copy:function(t){return this.arcLengthDivisions=t.arcLengthDivisions,this},toJSON:function(){var t={metadata:{version:4.5,type:"Curve",generator:"Curve.toJSON"}};return t.arcLengthDivisions=this.arcLengthDivisions,t.type=this.type,t},fromJSON:function(t){return this.arcLengthDivisions=t.arcLengthDivisions,this}}),Ki.prototype=Object.create(Qi.prototype),Ki.prototype.constructor=Ki,Ki.prototype.isEllipseCurve=1,Ki.prototype.getPoint=function(t,n){for(var i,r,o,a,s,c,l,u=n||new e,h=2*Math.PI,p=this.aEndAngle-this.aStartAngle,d=Math.abs(p)h;)p-=h;return p0?0:(Math.floor(Math.abs(m)/d)+1)*d:0===g&&m===d-1&&(m=d-2,g=1),this.closed||m>0?n=p[(m-1)%d]:(Ku.subVectors(p[0],p[1]).add(p[0]),n=Ku),r=p[m%d],o=p[(m+1)%d],this.closed||m+2r.length-2?r.length-1:a+1],h=r[a>r.length-3?r.length-1:a+2];return i.set(ir(s,c.x,l.x,u.x,h.x),ir(s,c.y,l.y,u.y,h.y)),i},pr.prototype.copy=function(t){var e,n,i;for(Qi.prototype.copy.call(this,t),this.points=[],e=0,n=t.points.length;e=o)return e=a[s]-o,r=0===(i=(n=this.curves[s]).getLength())?0:1-e/i,n.getPointAt(r);s++}return null},getLength:function(){var t=this.getCurveLengths();return t[t.length-1]},updateArcLengths:function(){this.needsUpdate=1,this.cacheLengths=null,this.getCurveLengths()},getCurveLengths:function(){var t,e,n,i;if(this.cacheLengths&&this.cacheLengths.length===this.curves.length)return this.cacheLengths;for(t=[],e=0,n=0,i=this.curves.length;n1&&!e[e.length-1].equals(e[0])&&e.push(e[0]),e},copy:function(t){var e,n,i;for(Qi.prototype.copy.call(this,t),this.curves=[],e=0,n=t.curves.length;e0&&((c=u.getPoint(0)).equals(this.currentPoint)||this.lineTo(c.x,c.y)),this.curves.push(u),l=u.getPoint(1),this.currentPoint.copy(l)},copy:function(t){return dr.prototype.copy.call(this,t),this.currentPoint.copy(t.currentPoint),this},toJSON:function(){var t=dr.prototype.toJSON.call(this);return t.currentPoint=this.currentPoint.toArray(),t},fromJSON:function(t){return dr.prototype.fromJSON.call(this,t),this.currentPoint.fromArray(t.currentPoint),this}}),mr.prototype=Object.assign(Object.create(fr.prototype),{constructor:mr,getPointsHoles:function(t){var e,n,i=[];for(e=0,n=this.holes.length;e0)for(i=new Gi(e),(r=new Zi(i)).setCrossOrigin(this.crossOrigin),o=0,a=t.length;o0?new Ye(a,s):new B(a,s),void 0!==t.drawMode&&o.setDrawMode(t.drawMode);break;case"LOD":o=new Xe;break;case"Line":o=new Ke(i(t.geometry),r(t.material),t.mode);break;case"LineLoop":o=new en(i(t.geometry),r(t.material));break;case"LineSegments":o=new tn(i(t.geometry),r(t.material));break;case"PointCloud":case"Points":o=new rn(i(t.geometry),r(t.material));break;case"Sprite":o=new He(r(t.material));break;case"Group":o=new Ie;break;default:o=new p}if(o.uuid=t.uuid,void 0!==t.name&&(o.name=t.name),void 0!==t.matrix?(o.matrix.fromArray(t.matrix),void 0!==t.matrixAutoUpdate&&(o.matrixAutoUpdate=t.matrixAutoUpdate),o.matrixAutoUpdate&&o.matrix.decompose(o.position,o.quaternion,o.scale)):(void 0!==t.position&&o.position.fromArray(t.position),void 0!==t.rotation&&o.rotation.fromArray(t.rotation),void 0!==t.quaternion&&o.quaternion.fromArray(t.quaternion),void 0!==t.scale&&o.scale.fromArray(t.scale)),void 0!==t.castShadow&&(o.castShadow=t.castShadow),void 0!==t.receiveShadow&&(o.receiveShadow=t.receiveShadow),t.shadow&&(void 0!==t.shadow.bias&&(o.shadow.bias=t.shadow.bias),void 0!==t.shadow.radius&&(o.shadow.radius=t.shadow.radius),void 0!==t.shadow.mapSize&&o.shadow.mapSize.fromArray(t.shadow.mapSize),void 0!==t.shadow.camera&&(o.shadow.camera=this.parseObject(t.shadow.camera))),void 0!==t.visible&&(o.visible=t.visible),void 0!==t.frustumCulled&&(o.frustumCulled=t.frustumCulled),void 0!==t.renderOrder&&(o.renderOrder=t.renderOrder),void 0!==t.userData&&(o.userData=t.userData),void 0!==t.layers&&(o.layers.mask=t.layers),void 0!==t.children)for(c=t.children,l=0;lNumber.EPSILON){if(s<0&&(r=e[i],a=-a,o=e[n],s=-s),t.yo.y)continue;if(t.y===r.y){if(t.x===r.x)return 1}else{if(0==(c=s*(t.x-r.x)-a*(t.y-r.y)))return 1;if(c<0)continue;u=!u}}else{if(t.y!==r.y)continue;if(o.x<=t.x&&t.x<=r.x||r.x<=t.x&&t.x<=o.x)return 1}return u}var r,o,a,s,c,l,u,h,p,d,f,m,g,v,y,x,b,_,w,M,S,T,A,L,C,P=Hu.isClockWise,E=this.subPaths;if(0===E.length)return[];if(1==e)return n(E);if(s=[],1===E.length)return o=E[0],(a=new mr).curves=o.curves,s.push(a),s;for(c=!P(E[0].getPoints()),c=t?!c:c,l=[],h=[],(u=[])[p=0]=void 0,h[p]=[],f=0,m=E.length;f1){for(g=0,v=[],y=0,x=u.length;y0&&(g||(h=l))}for(f=0,A=u.length;f0){this.source.connect(this.filters[0]);for(var t=1,e=this.filters.length;t0){this.source.disconnect(this.filters[0]);for(var t=1,e=this.filters.length;t=.5)for(var o=0;o!==r;++o)t[e+o]=t[n+o]},_slerp:function(t,e,i,r){n.slerpFlat(t,e,t,e,t,i,r)},_lerp:function(t,e,n,i,r){var o,a,s=1-i;for(o=0;o!==r;++o)t[a=e+o]=t[a]*s+t[n+o]*i}}),_h=RegExp("["+"\\[\\]\\.:\\/"+"]","g"),wh=/((?:WC+[\/:])*)/.source.replace("WC","[^\\[\\]\\.:\\/]"),Mh=/(WCOD+)?/.source.replace("WCOD","[^\\[\\]:\\/]"),Sh=/(?:\.(WC+)(?:\[(.+)\])?)?/.source.replace("WC","[^\\[\\]\\.:\\/]"),Th=/\.(WC+)(?:\[(.+)\])?/.source.replace("WC","[^\\[\\]\\.:\\/]"),Ah=RegExp("^"+wh+Mh+Sh+Th+"$"),Lh=["material","materials","bones"],Object.assign(Zr.prototype,{getValue:function(t,e){this.bind();var n=this._targetGroup.nCachedObjects_,i=this._bindings[n];void 0!==i&&i.getValue(t,e)},setValue:function(t,e){var n,i,r=this._bindings;for(n=this._targetGroup.nCachedObjects_,i=r.length;n!==i;++n)r[n].setValue(t,e)},bind:function(){var t,e,n=this._bindings;for(t=this._targetGroup.nCachedObjects_,e=n.length;t!==e;++t)n[t].bind()},unbind:function(){var t,e,n=this._bindings;for(t=this._targetGroup.nCachedObjects_,e=n.length;t!==e;++t)n[t].unbind()}}),Object.assign(Jr,{Composite:Zr,create:function(t,e,n){return t&&t.isAnimationObjectGroup?new Jr.Composite(t,e,n):new Jr(t,e,n)},sanitizeNodeName:function(t){return t.replace(/\s/g,"_").replace(_h,"")},parseTrackName:function(t){var e,n,i,r=Ah.exec(t);if(!r)throw Error("PropertyBinding: Cannot parse trackName: "+t);if(void 0!==(n=(e={nodeName:r[2],objectName:r[3],objectIndex:r[4],propertyName:r[5],propertyIndex:r[6]}).nodeName&&e.nodeName.lastIndexOf("."))&&-1!==n&&(i=e.nodeName.substring(n+1),-1!==Lh.indexOf(i)&&(e.nodeName=e.nodeName.substring(0,n),e.objectName=i)),null===e.propertyName||0===e.propertyName.length)throw Error("PropertyBinding: can not parse propertyName from trackName: "+t);return e},findNode:function(t,e){var n,i,r;return e&&""!==e&&"root"!==e&&"."!==e&&-1!==e&&e!==t.name&&e!==t.uuid?t.skeleton&&void 0!==(n=t.skeleton.getBoneByName(e))?n:t.children&&(r=(i=function(t){var n,r,o;for(n=0;n=d)for(f[(a=p[o=d++]).uuid]=r,p[r]=a,f[i]=o,p[o]=n,s=0,c=g;s!==c;++s)u=(l=m[s])[o],h=l[r],l[r]=u,l[o]=h;this.nCachedObjects_=d},uncache:function(){var t,e,n,i,r,o,a,s,c,l,u,h,p,d=this._objects,f=d.length,m=this.nCachedObjects_,g=this._indicesByUUID,v=this._bindings,y=v.length;for(t=0,e=arguments.length;t!==e;++t)if(void 0!==(i=g[n=arguments[t].uuid]))if(delete g[n],i0)for(c=this._interpolants,l=this._propertyBindings,u=0,h=c.length;u!==h;++u)c[u].evaluate(a),l[u].accumulate(i,s)}else this._updateWeight(t)},_updateWeight:function(t){var e,n,i=0;return this.enabled&&(i=this.weight,null!==(e=this._weightInterpolant)&&(i*=n=e.evaluate(t)[0],t>e.parameterPositions[1]&&(this.stopFading(),0===n&&(this.enabled=0)))),this._effectiveWeight=i,i},_updateTimeScale:function(t){var e,n=0;return this.paused||(n=this.timeScale,null!==(e=this._timeScaleInterpolant)&&(n*=e.evaluate(t)[0],t>e.parameterPositions[1]&&(this.stopWarping(),0===n?this.paused=1:this.timeScale=n))),this._effectiveTimeScale=n,n},_updateTime:function(t){var e,n,i,r=this.time+t,o=this._clip.duration,a=this.loop,s=this._loopCount,c=2202===a;if(0===t)return-1===s?r:c&&1==(1&s)?o-r:r;if(2200===a){-1===s&&(this._loopCount=0,this._setEndings(1,1,0));t:{if(r>=o)r=o;else{if(!(r<0)){this.time=r;break t}r=0}this.clampWhenFinished?this.paused=1:this.enabled=0,this.time=r,this._mixer.dispatchEvent({type:"finished",action:this,direction:t<0?-1:1})}}else if(-1===s&&(t>=0?(s=0,this._setEndings(1,0===this.repetitions,c)):this._setEndings(0===this.repetitions,1,c)),r>=o||r<0?(r-=o*(e=Math.floor(r/o)),s+=Math.abs(e),(n=this.repetitions-s)<=0?(this.clampWhenFinished?this.paused=1:this.enabled=0,r=t>0?o:0,this.time=r,this._mixer.dispatchEvent({type:"finished",action:this,direction:t>0?1:-1})):(1===n?(i=t<0,this._setEndings(i,!i,c)):this._setEndings(0,0,c),this._loopCount=s,this.time=r,this._mixer.dispatchEvent({type:"loop",action:this,loopDelta:e}))):this.time=r,c&&1==(1&s))return o-r;return r},_setEndings:function(t,e,n){var i=this._interpolantSettings;n?(i.endingStart=2401,i.endingEnd=2401):(i.endingStart=t?this.zeroSlopeAtStart?2401:Fs:2402,i.endingEnd=e?this.zeroSlopeAtEnd?2401:Fs:2402)},_scheduleFading:function(t,e,n){var i,r,o=this._mixer,a=o.time,s=this._weightInterpolant;return null===s&&(s=o._lendControlInterpolant(),this._weightInterpolant=s),i=s.parameterPositions,r=s.sampleValues,i[0]=a,r[0]=e,i[1]=a+t,r[1]=n,this}}),Qr.prototype=Object.assign(Object.create(t.prototype),{constructor:Qr,_bindAction:function(t,e){var n,i,r,o,a,s=t._localRoot||this._root,c=t._clip.tracks,l=c.length,u=t._propertyBindings,h=t._interpolants,p=s.uuid,d=this._bindingsByRootAndName,f=d[p];for(void 0===f&&(f={},d[p]=f),n=0;n!==l;++n){if(void 0!==(o=f[r=(i=c[n]).name]))u[n]=o;else{if(void 0!==(o=u[n])){null===o._cacheIndex&&(++o.referenceCount,this._addInactiveBinding(o,p,r));continue}a=e&&e._propertyBindings[n].binding.parsedPath,++(o=new Yr(Jr.create(s,r,a),i.ValueTypeName,i.getValueSize())).referenceCount,this._addInactiveBinding(o,p,r),u[n]=o}h[n].resultBuffer=o.buffer}},_activateAction:function(t){var e,n,i,r,o,a,s;if(!this._isActiveAction(t)){for(null===t._cacheIndex&&(e=(t._localRoot||this._root).uuid,n=t._clip.uuid,i=this._actionsByClip[n],this._bindAction(t,i&&i.knownActions[0]),this._addInactiveAction(t,n,e)),o=0,a=(r=t._propertyBindings).length;o!==a;++o)0==(s=r[o]).useCount++&&(this._lendBinding(s),s.saveOriginalState());this._lendAction(t)}},_deactivateAction:function(t){var e,n,i,r;if(this._isActiveAction(t)){for(n=0,i=(e=t._propertyBindings).length;n!==i;++n)0==--(r=e[n]).useCount&&(r.restoreOriginalState(),this._takeBackBinding(r));this._takeBackAction(t)}},_initMemoryManager:function(){this._actions=[],this._nActiveActions=0,this._actionsByClip={},this._bindings=[],this._nActiveBindings=0,this._bindingsByRootAndName={},this._controlInterpolants=[],this._nActiveControlInterpolants=0;var t=this;this.stats={actions:{get total(){return t._actions.length},get inUse(){return t._nActiveActions}},bindings:{get total(){return t._bindings.length},get inUse(){return t._nActiveBindings}},controlInterpolants:{get total(){return t._controlInterpolants.length},get inUse(){return t._nActiveControlInterpolants}}}},_isActiveAction:function(t){var e=t._cacheIndex;return null!==e&&ethis.max.x||t.ythis.max.y?0:1},containsBox:function(t){return this.min.x<=t.min.x&&t.max.x<=this.max.x&&this.min.y<=t.min.y&&t.max.y<=this.max.y},getParameter:function(t,n){return void 0===n&&(n=new e),n.set((t.x-this.min.x)/(this.max.x-this.min.x),(t.y-this.min.y)/(this.max.y-this.min.y))},intersectsBox:function(t){return t.max.xthis.max.x||t.max.ythis.max.y?0:1},clampPoint:function(t,n){return void 0===n&&(n=new e),n.copy(t).clamp(this.min,this.max)},distanceToPoint:function(t){return Ch.copy(t).clamp(this.min,this.max).sub(t).length()},intersect:function(t){return this.min.max(t.min),this.max.min(t.max),this},union:function(t){return this.min.min(t.min),this.max.max(t.max),this},translate:function(t){return this.min.add(t),this.max.add(t),this},equals:function(t){return t.min.equals(this.min)&&t.max.equals(this.max)}}),Ph=new i,Eh=new i,Object.assign(ro.prototype,{set:function(t,e){return this.start.copy(t),this.end.copy(e),this},clone:function(){return(new this.constructor).copy(this)},copy:function(t){return this.start.copy(t.start),this.end.copy(t.end),this},getCenter:function(t){return void 0===t&&(t=new i),t.addVectors(this.start,this.end).multiplyScalar(.5)},delta:function(t){return void 0===t&&(t=new i),t.subVectors(this.end,this.start)},distanceSq:function(){return this.start.distanceToSquared(this.end)},distance:function(){return this.start.distanceTo(this.end)},at:function(t,e){return void 0===e&&(e=new i),this.delta(e).multiplyScalar(t).add(this.start)},closestPointToPointParameter:function(t,e){var n,i;return Ph.subVectors(t,this.start),Eh.subVectors(this.end,this.start),n=Eh.dot(Eh),i=Eh.dot(Ph)/n,e&&(i=ic.clamp(i,0,1)),i},closestPointToPoint:function(t,e,n){var r=this.closestPointToPointParameter(t,e);return void 0===n&&(n=new i),this.delta(n).multiplyScalar(r).add(this.start)},applyMatrix4:function(t){return this.start.applyMatrix4(t),this.end.applyMatrix4(t),this},equals:function(t){return t.start.equals(this.start)&&t.end.equals(this.end)}}),oo.prototype=Object.create(p.prototype),oo.prototype.constructor=oo,oo.prototype.isImmediateRenderObject=1,Nh=new i,Oh=new i,Dh=new r,Ih=["a","b","c"],ao.prototype=Object.create(tn.prototype),ao.prototype.constructor=ao,ao.prototype.update=function(){var t,e,n,i,r,o,a,s,c,l,u,h,p,d,f;if(this.object.updateMatrixWorld(1),Dh.getNormalMatrix(this.object.matrixWorld),t=this.object.matrixWorld,e=this.geometry.attributes.position,(n=this.object.geometry)&&n.isGeometry)for(i=n.vertices,o=0,a=0,s=(r=n.faces).length;a1&&t.multiplyScalar(1/e),this.children[0].material.color.copy(this.material.color))},uo.prototype.dispose=function(){this.geometry.dispose(),this.material.dispose(),this.children[0].geometry.dispose(),this.children[0].material.dispose()},Bh=new i,Uh=new x,jh=new x,ho.prototype=Object.create(p.prototype),ho.prototype.constructor=ho,ho.prototype.dispose=function(){this.children[0].geometry.dispose(),this.children[0].material.dispose()},ho.prototype.update=function(){var t,e,n,i,r=this.children[0];if(void 0!==this.color)this.material.color.set(this.color);else{for(t=r.geometry.getAttribute("color"),Uh.copy(this.light.color),jh.copy(this.light.groundColor),e=0,n=t.count;e.99999)this.quaternion.set(0,0,0,1);else if(t.y<-.99999)this.quaternion.set(1,0,0,0);else{$h.set(t.z,0,-t.x).normalize();var e=Math.acos(t.y);this.quaternion.setFromAxisAngle($h,e)}},So.prototype.setLength=function(t,e,n){void 0===e&&(e=.2*t),void 0===n&&(n=.2*e),this.line.scale.set(1,Math.max(1e-4,t-e),1),this.line.updateMatrix(),this.cone.scale.set(n,e,n),this.cone.position.y=t,this.cone.updateMatrix()},So.prototype.setColor=function(t){this.line.material.color.set(t),this.cone.material.color.set(t)},So.prototype.copy=function(t){return p.prototype.copy.call(this,t,0),this.line.copy(t.line),this.cone.copy(t.cone),this},So.prototype.clone=function(){return(new this.constructor).copy(this)},To.prototype=Object.create(tn.prototype),To.prototype.constructor=To,Qi.create=function(t,e){return t.prototype=Object.create(Qi.prototype),t.prototype.constructor=t,t.prototype.getPoint=e,t},Object.assign(dr.prototype,{createPointsGeometry:function(t){var e=this.getPoints(t);return this.createGeometry(e)},createSpacedPointsGeometry:function(t){var e=this.getSpacedPoints(t);return this.createGeometry(e)},createGeometry:function(t){var e,n,r,o;for(e=new V,n=0,r=t.length;n0;)this.smooth(t);return t.computeFaceNormals(),t.computeVertexNormals(),t},function(){function t(t,e,n){return n[Math.min(t,e)+"_"+Math.max(t,e)]}function n(t,e,n,i,r,o){var a,s=Math.min(t,e),c=Math.max(t,e),l=s+"_"+c;l in i?a=i[l]:(a={a:n[s],b:n[c],newEdge:null,faces:[]},i[l]=a),a.faces.push(r),o[t].edges.push(a),o[e].edges.push(a)}function r(t,e,n,i,r){t.push(new M(e,n,i,void 0,void 0,r))}function o(t,e){return Math.abs(e-t)/2+Math.min(t,e)}function a(t,e,n,i){t.push([e.clone(),n.clone(),i.clone()])}var s=["a","b","c"];np.prototype.smooth=function(c){var l,u,h,p,d,f,m,g,v,y,x,b,_,w,M,S,T,A,L,C,P,E,N,O,D,I,z,R,F,k,B,U,j,V,G=new i,W=[],H=c.vertices,q=c.faces,X=c.faceVertexUvs[0],Y=void 0!==X&&X.length>0,Z=Array(H.length),J={};for(p in function(t,e,i,r){var o,a,s;for(o=0,a=t.length;o3&&(T=3/(8*h)),A=1-h*T,L=T,h<=2&&2==h&&(A=.75,L=1/8),N=E.clone().multiplyScalar(A),G.set(0,0,0),f=0;f=e.status}function i(t){try{t.dispatchEvent(new MouseEvent("click"))}catch(n){var e=document.createEvent("MouseEvents");e.initMouseEvent("click",1,1,window,0,0,0,80,20,0,0,0,0,0,null),t.dispatchEvent(e)}}var r="object"==typeof window&&window.window===window?window:"object"==typeof self&&self.self===self?self:"object"==typeof ip&&ip.global===ip?ip:void 0,o=r.saveAs||("object"!=typeof window||window!==r?function(){}:"download"in HTMLAnchorElement.prototype?function(t,o,a){var s=r.URL||r.webkitURL,c=document.createElement("a");o=o||t.name||"download",c.download=o,c.rel="noopener","string"==typeof t?(c.href=t,c.origin===location.origin?i(c):n(c.href)?e(t,o,a):i(c,c.target="_blank")):(c.href=s.createObjectURL(t),setTimeout(function(){s.revokeObjectURL(c.href)},4e4),setTimeout(function(){i(c)},0))}:"msSaveOrOpenBlob"in navigator?function(t,r,o){if(r=r||t.name||"download","string"!=typeof t)navigator.msSaveOrOpenBlob(function(t,e){return void 0===e?e={autoBom:0}:"object"!=typeof e&&(e={autoBom:!e}),e.autoBom&&/^\s*(?:text\/\S*|application\/xml|\S*\/\S*\+xml)\s*;.*charset\s*=\s*utf-8/i.test(t.type)?new Blob(["\ufeff",t],{type:t.type}):t}(t,o),r);else if(n(t))e(t,r,o);else{var a=document.createElement("a");a.href=t,a.target="_blank",setTimeout(function(){i(a)})}}:function(t,n,i,o){var a,s,c,l,u,h;if((o=o||open("","_blank"))&&(o.document.title=o.document.body.innerText="downloading..."),"string"==typeof t)return e(t,n,i);a="application/octet-stream"===t.type,s=/constructor/i.test(r.HTMLElement)||r.safari,((c=/CriOS\/[\d]+/.test(navigator.userAgent))||a&&s)&&"object"==typeof FileReader?((l=new FileReader).onloadend=function(){var t=l.result;t=c?t:t.replace(/^data:[^;]*;/,"data:attachment/file;"),o?o.location.href=t:location=t,o=null},l.readAsDataURL(t)):(u=r.URL||r.webkitURL,h=u.createObjectURL(t),o?o.location=h:location.href=h,o=null,setTimeout(function(){u.revokeObjectURL(h)},4e4))});r.saveAs=o.saveAs=o,t.exports=o}()}),op=rp.saveAs,ap=Lo(function(t){!function(e,n){t.exports=e.document?n(e,1):function(t){if(!t.document)throw Error("jQuery requires a window with a document");return n(t)}}("undefined"!=typeof window?window:ip,function(t,e){function n(t,e,n){var i,r,o=(n=n||Ie).createElement("script");if(o.text=t,e)for(i in Ye)(r=e[i]||e.getAttribute&&e.getAttribute(i))&&o.setAttribute(i,r);n.head.appendChild(o).parentNode.removeChild(o)}function i(t){return null==t?t+"":"object"==typeof t||"function"==typeof t?Ue[je.call(t)]||"object":typeof t}function r(t){var e=!!t&&"length"in t&&t.length,n=i(t);return qe(t)||Xe(t)?0:"array"===n||0===e||"number"==typeof e&&e>0&&e-1 in t}function o(t,e){return t.nodeName&&t.nodeName.toLowerCase()===e.toLowerCase()}function a(t,e,n){return qe(e)?Ze.grep(t,function(t,i){return!!e.call(t,i,t)!==n}):e.nodeType?Ze.grep(t,function(t){return t===e!==n}):"string"!=typeof e?Ze.grep(t,function(t){return Be.call(e,t)>-1!==n}):Ze.filter(e,t,n)}function s(t,e){for(;(t=t[e])&&1!==t.nodeType;);return t}function c(t){return t}function l(t){throw t}function u(t,e,n,i){var r;try{t&&qe(r=t.promise)?r.call(t).done(e).fail(n):t&&qe(r=t.then)?r.call(t,e,n):e.apply(void 0,[t].slice(i))}catch(t){n.call(void 0,t)}}function h(){Ie.removeEventListener("DOMContentLoaded",h),t.removeEventListener("load",h),Ze.ready()}function p(t,e){return e.toUpperCase()}function d(t){return t.replace(pt,"ms-").replace(dt,p)}function f(){this.expando=Ze.expando+f.uid++}function m(t,e,n){var i;if(void 0===n&&1===t.nodeType)if(i="data-"+e.replace(yt,"-$&").toLowerCase(),"string"==typeof(n=t.getAttribute(i))){try{n=function(t){return"true"===t?1:"false"===t?0:"null"===t?null:t===+t+""?+t:vt.test(t)?JSON.parse(t):t}(n)}catch(t){}gt.set(t,e,n)}else n=void 0;return n}function g(t,e,n,i){var r,o,a=20,s=i?function(){return i.cur()}:function(){return Ze.css(t,e,"")},c=s(),l=n&&n[3]||(Ze.cssNumber[e]?"":"px"),u=t.nodeType&&(Ze.cssNumber[e]||"px"!==l&&+c)&&bt.exec(Ze.css(t,e));if(u&&u[3]!==l){for(c/=2,l=l||u[3],u=+c||1;a--;)Ze.style(t,e,u+l),(1-o)*(1-(o=s()/c||.5))<=0&&(a=0),u/=o;u*=2,Ze.style(t,e,u+l),n=n||[]}return n&&(u=+u||+c||0,r=n[1]?u+(n[1]+1)*n[2]:+n[2],i&&(i.unit=l,i.start=u,i.end=r)),r}function v(t){var e,n=t.ownerDocument,i=t.nodeName,r=Lt[i];return r||(e=n.body.appendChild(n.createElement(i)),r=Ze.css(e,"display"),e.parentNode.removeChild(e),"none"===r&&(r="block"),Lt[i]=r,r)}function y(t,e){for(var n,i,r=[],o=0,a=t.length;o-1)o&&o.push(a);else if(u=Mt(a),s=x(p.appendChild(a),"script"),u&&b(s),n)for(h=0;a=s[h++];)Et.test(a.type||"")&&n.push(a);return p}function w(){return 1}function M(){return 0}function S(t,e){return t===function(){try{return Ie.activeElement}catch(t){}}()==("focus"===e)}function T(t,e,n,i,r,o){var a,s;if("object"==typeof e){for(s in"string"!=typeof n&&(i=i||n,n=void 0),e)T(t,s,n,i,e[s],o);return t}if(null==i&&null==r?(r=n,i=n=void 0):null==r&&("string"==typeof n?(r=i,i=void 0):(r=i,i=n,n=void 0)),0==r)r=M;else if(!r)return t;return 1===o&&(a=r,(r=function(t){return Ze().off(t),a.apply(this,arguments)}).guid=a.guid||(a.guid=Ze.guid++)),t.each(function(){Ze.event.add(this,e,r,i,n)})}function A(t,e,n){n?(mt.set(t,e,0),Ze.event.add(t,e,{namespace:0,handler:function(t){var i,r,o=mt.get(this,e);if(1&t.isTrigger&&this[e]){if(o.length)(Ze.event.special[e]||{}).delegateType&&t.stopPropagation();else if(o=Re.call(arguments),mt.set(this,e,o),i=n(this,e),this[e](),o!==(r=mt.get(this,e))||i?mt.set(this,e,0):r={},o!==r)return t.stopImmediatePropagation(),t.preventDefault(),r.value}else o.length&&(mt.set(this,e,{value:Ze.event.trigger(Ze.extend(o[0],Ze.Event.prototype),o.slice(1),this)}),t.stopImmediatePropagation())}})):void 0===mt.get(t,e)&&Ze.event.add(t,e,w)}function L(t,e){return o(t,"table")&&o(11!==e.nodeType?e:e.firstChild,"tr")&&Ze(t).children("tbody")[0]||t}function C(t){return t.type=(null!==t.getAttribute("type"))+"/"+t.type,t}function P(t){return"true/"===(t.type||"").slice(0,5)?t.type=t.type.slice(5):t.removeAttribute("type"),t}function E(t,e){var n,i,r,o,a,s,c,l;if(1===e.nodeType){if(mt.hasData(t)&&(o=mt.access(t),a=mt.set(e,o),l=o.events))for(r in delete a.handle,a.events={},l)for(n=0,i=l[r].length;n1&&"string"==typeof f&&!He.checkClone&&kt.test(f))return t.each(function(n){var o=t.eq(n);m&&(e[0]=f.call(this,n,o.html())),O(o,e,i,r)});if(p&&(a=(o=_(e,t[0].ownerDocument,0,t,r)).firstChild,1===o.childNodes.length&&(o=a),a||r)){for(c=(s=Ze.map(x(o,"script"),C)).length;h=0&&(c+=Math.max(0,Math.ceil(t["offset"+e[0].toUpperCase()+e.slice(1)]-o-c-s-.5))||0),c}function B(t,e,n){var i=jt(t),r=(!He.boxSizingReliable()||n)&&"border-box"===Ze.css(t,"boxSizing",0,i),o=r,a=I(t,e,i),s="offset"+e[0].toUpperCase()+e.slice(1);if(Ut.test(a)){if(!n)return a;a="auto"}return(!He.boxSizingReliable()&&r||"auto"===a||!parseFloat(a)&&"inline"===Ze.css(t,"display",0,i))&&t.getClientRects().length&&(r="border-box"===Ze.css(t,"boxSizing",0,i),(o=s in t)&&(a=t[s])),(a=parseFloat(a)||0)+k(t,e,n||(r?"border":"content"),o,i,a)+"px"}function U(t,e,n,i,r){return new U.prototype.init(t,e,n,i,r)}function j(){$t&&(0==Ie.hidden&&t.requestAnimationFrame?t.requestAnimationFrame(j):t.setTimeout(j,Ze.fx.interval),Ze.fx.tick())}function V(){return t.setTimeout(function(){Jt=void 0}),Jt=Date.now()}function G(t,e){var n,i=0,r={height:t};for(e=e?1:0;i<4;i+=2-e)r["margin"+(n=_t[i])]=r["padding"+n]=t;return e&&(r.opacity=r.width=t),r}function W(t,e,n){for(var i,r=(H.tweeners[e]||[]).concat(H.tweeners["*"]),o=0,a=r.length;o=0&&n_.cacheLength&&delete e[t.shift()],e[n+" "]=i}}function i(t){return t[k]=1,t}function r(t){var e=N.createElement("fieldset");try{return!!t(e)}catch(t){return 0}finally{e.parentNode&&e.parentNode.removeChild(e),e=null}}function o(t,e){for(var n=t.split("|"),i=n.length;i--;)_.attrHandle[n[i]]=e}function a(t,e){var n=e&&t,i=n&&1===t.nodeType&&1===e.nodeType&&t.sourceIndex-e.sourceIndex;if(i)return i;if(n)for(;n=n.nextSibling;)if(n===e)return-1;return t?1:-1}function s(t){return function(e){return"input"===e.nodeName.toLowerCase()&&e.type===t}}function c(t){return function(e){var n=e.nodeName.toLowerCase();return("input"===n||"button"===n)&&e.type===t}}function l(t){return function(e){return"form"in e?e.parentNode&&0==e.disabled?"label"in e?"label"in e.parentNode?e.parentNode.disabled===t:e.disabled===t:e.isDisabled===t||e.isDisabled!==!t&&St(e)===t:e.disabled===t:"label"in e?e.disabled===t:0}}function u(t){return i(function(e){return e=+e,i(function(n,i){for(var r,o=t([],n.length,e),a=o.length;a--;)n[r=o[a]]&&(n[r]=!(i[r]=n[r]))})})}function h(t){return t&&void 0!==t.getElementsByTagName&&t}function p(){}function d(t){for(var e=0,n=t.length,i="";e1?function(e,n,i){for(var r=t.length;r--;)if(!t[r](e,n,i))return 0;return 1}:t[0]}function g(t,e,n,i,r){for(var o,a=[],s=0,c=t.length,l=null!=e;s-1&&(i[u]=!(s[u]=p))}}else x=g(x===s?x.splice(m,x.length):x),a?a(null,s,x,l):$.apply(s,x)})}function y(t){for(var e,n,i,r=t.length,o=_.relative[t[0].type],a=o||_.relative[" "],s=o?1:0,c=f(function(t){return t===e},a,1),l=f(function(t){return K(e,t)>-1},a,1),u=[function(t,n,i){var r=!o&&(i||n!==L)||((e=n).nodeType?c(t,n,i):l(t,n,i));return e=null,r}];s1&&m(u),s>1&&d(t.slice(0,s-1).concat({value:" "===t[s-2].type?"*":""})).replace(at,"$1"),n,s+~]|[\x20\t\r\n\f])[\x20\t\r\n\f]*/,lt=/[\x20\t\r\n\f]|>/,ut=RegExp(rt),ht=RegExp("^"+nt+"$"),pt={ID:RegExp("^#("+nt+")"),CLASS:RegExp("^\\.("+nt+")"),TAG:RegExp("^("+nt+"|[*])"),ATTR:RegExp("^"+it),PSEUDO:RegExp("^"+rt),CHILD:/^:(only|first|last|nth|nth-last)-(child|of-type)(?:\([\x20\t\r\n\f]*(even|odd|(([+-]|)(\d*)n|)[\x20\t\r\n\f]*(?:([+-]|)[\x20\t\r\n\f]*(\d+)|))[\x20\t\r\n\f]*\)|)/i,bool:RegExp("^(?:"+tt+")$","i"),needsContext:/^[\x20\t\r\n\f]*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\([\x20\t\r\n\f]*((?:-\d)?\d*)[\x20\t\r\n\f]*\)|)(?=[^-]|$)/i},dt=/HTML$/i,ft=/^(?:input|select|textarea|button)$/i,mt=/^h\d$/i,gt=/^[^{]+\{\s*\[native \w/,vt=/^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,yt=/[+~]/,xt=/\\([\da-f]{1,6}[\x20\t\r\n\f]?|([\x20\t\r\n\f])|.)/gi,bt=function(t,e,n){var i="0x"+e-65536;return i!=i||n?e:i<0?String.fromCharCode(i+65536):String.fromCharCode(i>>10|55296,1023&i|56320)},_t=/([\0-\x1f\x7f]|^-?\d)|^-$|[^\0-\x1f\x7f-\uFFFF\w-]/g,wt=function(t,e){return e?"\0"===t?"�":t.slice(0,-1)+"\\"+t.charCodeAt(t.length-1).toString(16)+" ":"\\"+t},Mt=function(){E()},St=f(function(t){return 1==t.disabled&&"fieldset"===t.nodeName.toLowerCase()},{dir:"parentNode",next:"legend"});try{$.apply(Y=Q.call(B.childNodes),B.childNodes),Y[B.childNodes.length].nodeType}catch(t){$={apply:Y.length?function(t,e){J.apply(t,Q.call(e))}:function(t,e){for(var n=t.length,i=0;t[n++]=e[i++];);t.length=n-1}}}for(x in b=e.support={},M=e.isXML=function(t){var e=t.namespaceURI,n=(t.ownerDocument||t).documentElement;return!dt.test(e||n&&n.nodeName||"HTML")},E=e.setDocument=function(t){var e,n,i=t?t.ownerDocument||t:B;return i!==N&&9===i.nodeType&&i.documentElement?(O=(N=i).documentElement,D=!M(N),B!==N&&(n=N.defaultView)&&n.top!==n&&(n.addEventListener?n.addEventListener("unload",Mt,0):n.attachEvent&&n.attachEvent("onunload",Mt)),b.attributes=r(function(t){return t.className="i",!t.getAttribute("className")}),b.getElementsByTagName=r(function(t){return t.appendChild(N.createComment("")),!t.getElementsByTagName("*").length}),b.getElementsByClassName=gt.test(N.getElementsByClassName),b.getById=r(function(t){return O.appendChild(t).id=k,!N.getElementsByName||!N.getElementsByName(k).length}),b.getById?(_.filter.ID=function(t){var e=t.replace(xt,bt);return function(t){return t.getAttribute("id")===e}},_.find.ID=function(t,e){if(void 0!==e.getElementById&&D){var n=e.getElementById(t);return n?[n]:[]}}):(_.filter.ID=function(t){var e=t.replace(xt,bt);return function(t){var n=void 0!==t.getAttributeNode&&t.getAttributeNode("id");return n&&n.value===e}},_.find.ID=function(t,e){if(void 0!==e.getElementById&&D){var n,i,r,o=e.getElementById(t);if(o){if((n=o.getAttributeNode("id"))&&n.value===t)return[o];for(r=e.getElementsByName(t),i=0;o=r[i++];)if((n=o.getAttributeNode("id"))&&n.value===t)return[o]}return[]}}),_.find.TAG=b.getElementsByTagName?function(t,e){return void 0!==e.getElementsByTagName?e.getElementsByTagName(t):b.qsa?e.querySelectorAll(t):void 0}:function(t,e){var n,i=[],r=0,o=e.getElementsByTagName(t);if("*"===t){for(;n=o[r++];)1===n.nodeType&&i.push(n);return i}return o},_.find.CLASS=b.getElementsByClassName&&function(t,e){if(void 0!==e.getElementsByClassName&&D)return e.getElementsByClassName(t)},z=[],I=[],(b.qsa=gt.test(N.querySelectorAll))&&(r(function(t){O.appendChild(t).innerHTML="",t.querySelectorAll("[msallowcapture^='']").length&&I.push("[*^$]="+et+"*(?:''|\"\")"),t.querySelectorAll("[selected]").length||I.push("\\["+et+"*(?:value|"+tt+")"),t.querySelectorAll("[id~="+k+"-]").length||I.push("~="),t.querySelectorAll(":checked").length||I.push(":checked"),t.querySelectorAll("a#"+k+"+*").length||I.push(".#.+[+~]")}),r(function(t){t.innerHTML="";var e=N.createElement("input");e.setAttribute("type","hidden"),t.appendChild(e).setAttribute("name","D"),t.querySelectorAll("[name=d]").length&&I.push("name"+et+"*[*^$|!~]?="),2!==t.querySelectorAll(":enabled").length&&I.push(":enabled",":disabled"),O.appendChild(t).disabled=1,2!==t.querySelectorAll(":disabled").length&&I.push(":enabled",":disabled"),t.querySelectorAll("*,:x"),I.push(",.*:")})),(b.matchesSelector=gt.test(R=O.matches||O.webkitMatchesSelector||O.mozMatchesSelector||O.oMatchesSelector||O.msMatchesSelector))&&r(function(t){b.disconnectedMatch=R.call(t,"*"),R.call(t,"[s!='']:x"),z.push("!=",rt)}),I=I.length&&RegExp(I.join("|")),z=z.length&&RegExp(z.join("|")),e=gt.test(O.compareDocumentPosition),F=e||gt.test(O.contains)?function(t,e){var n=9===t.nodeType?t.documentElement:t,i=e&&e.parentNode;return t===i||!(!i||1!==i.nodeType||!(n.contains?n.contains(i):t.compareDocumentPosition&&16&t.compareDocumentPosition(i)))}:function(t,e){if(e)for(;e=e.parentNode;)if(e===t)return 1;return 0},q=e?function(t,e){if(t===e)return P=1,0;var n=!t.compareDocumentPosition-!e.compareDocumentPosition;return n||(1&(n=(t.ownerDocument||t)===(e.ownerDocument||e)?t.compareDocumentPosition(e):1)||!b.sortDetached&&e.compareDocumentPosition(t)===n?t===N||t.ownerDocument===B&&F(B,t)?-1:e===N||e.ownerDocument===B&&F(B,e)?1:C?K(C,t)-K(C,e):0:4&n?-1:1)}:function(t,e){if(t===e)return P=1,0;var n,i=0,r=t.parentNode,o=e.parentNode,s=[t],c=[e];if(!r||!o)return t===N?-1:e===N?1:r?-1:o?1:C?K(C,t)-K(C,e):0;if(r===o)return a(t,e);for(n=t;n=n.parentNode;)s.unshift(n);for(n=e;n=n.parentNode;)c.unshift(n);for(;s[i]===c[i];)i++;return i?a(s[i],c[i]):s[i]===B?-1:c[i]===B?1:0},N):N},e.matches=function(t,n){return e(t,null,null,n)},e.matchesSelector=function(t,n){if((t.ownerDocument||t)!==N&&E(t),b.matchesSelector&&D&&!H[n+" "]&&(!z||!z.test(n))&&(!I||!I.test(n)))try{var i=R.call(t,n);if(i||b.disconnectedMatch||t.document&&11!==t.document.nodeType)return i}catch(t){H(n,1)}return e(n,N,null,[t]).length>0},e.contains=function(t,e){return(t.ownerDocument||t)!==N&&E(t),F(t,e)},e.attr=function(t,e){(t.ownerDocument||t)!==N&&E(t);var n=_.attrHandle[e.toLowerCase()],i=n&&X.call(_.attrHandle,e.toLowerCase())?n(t,e,!D):void 0;return void 0!==i?i:b.attributes||!D?t.getAttribute(e):(i=t.getAttributeNode(e))&&i.specified?i.value:null},e.escape=function(t){return(t+"").replace(_t,wt)},e.error=function(t){throw Error("Syntax error, unrecognized expression: "+t)},e.uniqueSort=function(t){var e,n=[],i=0,r=0;if(P=!b.detectDuplicates,C=!b.sortStable&&t.slice(0),t.sort(q),P){for(;e=t[r++];)e===t[r]&&(i=n.push(r));for(;i--;)t.splice(n[i],1)}return C=null,t},w=e.getText=function(t){var e,n="",i=0,r=t.nodeType;if(r){if(1===r||9===r||11===r){if("string"==typeof t.textContent)return t.textContent;for(t=t.firstChild;t;t=t.nextSibling)n+=w(t)}else if(3===r||4===r)return t.nodeValue}else for(;e=t[i++];)n+=w(e);return n},(_=e.selectors={cacheLength:50,createPseudo:i,match:pt,attrHandle:{},find:{},relative:{">":{dir:"parentNode",first:1}," ":{dir:"parentNode"},"+":{dir:"previousSibling",first:1},"~":{dir:"previousSibling"}},preFilter:{ATTR:function(t){return t[1]=t[1].replace(xt,bt),t[3]=(t[3]||t[4]||t[5]||"").replace(xt,bt),"~="===t[2]&&(t[3]=" "+t[3]+" "),t.slice(0,4)},CHILD:function(t){return t[1]=t[1].toLowerCase(),"nth"===t[1].slice(0,3)?(t[3]||e.error(t[0]),t[4]=+(t[4]?t[5]+(t[6]||1):2*("even"===t[3]||"odd"===t[3])),t[5]=+(t[7]+t[8]||"odd"===t[3])):t[3]&&e.error(t[0]),t},PSEUDO:function(t){var e,n=!t[6]&&t[2];return pt.CHILD.test(t[0])?null:(t[3]?t[2]=t[4]||t[5]||"":n&&ut.test(n)&&(e=S(n,1))&&(e=n.indexOf(")",n.length-e)-n.length)&&(t[0]=t[0].slice(0,e),t[2]=n.slice(0,e)),t.slice(0,3))}},filter:{TAG:function(t){var e=t.replace(xt,bt).toLowerCase();return"*"===t?function(){return 1}:function(t){return t.nodeName&&t.nodeName.toLowerCase()===e}},CLASS:function(t){var e=V[t+" "];return e||(e=RegExp("(^|"+et+")"+t+"("+et+"|$)"))&&V(t,function(t){return e.test("string"==typeof t.className&&t.className||void 0!==t.getAttribute&&t.getAttribute("class")||"")})},ATTR:function(t,n,i){return function(r){var o=e.attr(r,t);return null==o?"!="===n:n?(o+="","="===n?o===i:"!="===n?o!==i:"^="===n?i&&0===o.indexOf(i):"*="===n?i&&o.indexOf(i)>-1:"$="===n?i&&o.slice(-i.length)===i:"~="===n?(" "+o.replace(ot," ")+" ").indexOf(i)>-1:"|="===n?o===i||o.slice(0,i.length+1)===i+"-":0):1}},CHILD:function(t,e,n,i,r){var o="nth"!==t.slice(0,3),a="last"!==t.slice(-4),s="of-type"===e;return 1===i&&0===r?function(t){return!!t.parentNode}:function(e,n,c){var l,u,h,p,d,f,m=o!==a?"nextSibling":"previousSibling",g=e.parentNode,v=s&&e.nodeName.toLowerCase(),y=!c&&!s,x=0;if(g){if(o){for(;m;){for(p=e;p=p[m];)if(s?p.nodeName.toLowerCase()===v:1===p.nodeType)return 0;f=m="only"===t&&!f&&"nextSibling"}return 1}if(f=[a?g.firstChild:g.lastChild],a&&y){for(x=(d=(l=(u=(h=(p=g)[k]||(p[k]={}))[p.uniqueID]||(h[p.uniqueID]={}))[t]||[])[0]===U&&l[1])&&l[2],p=d&&g.childNodes[d];p=++d&&p&&p[m]||(x=d=0)||f.pop();)if(1===p.nodeType&&++x&&p===e){u[t]=[U,d,x];break}}else if(y&&(x=d=(l=(u=(h=(p=e)[k]||(p[k]={}))[p.uniqueID]||(h[p.uniqueID]={}))[t]||[])[0]===U&&l[1]),0==x)for(;(p=++d&&p&&p[m]||(x=d=0)||f.pop())&&((s?p.nodeName.toLowerCase()!==v:1!==p.nodeType)||!++x||(y&&((u=(h=p[k]||(p[k]={}))[p.uniqueID]||(h[p.uniqueID]={}))[t]=[U,x]),p!==e)););return(x-=r)===i||x%i==0&&x/i>=0}}},PSEUDO:function(t,n){var r,o=_.pseudos[t]||_.setFilters[t.toLowerCase()]||e.error("unsupported pseudo: "+t);return o[k]?o(n):o.length>1?(r=[t,t,"",n],_.setFilters.hasOwnProperty(t.toLowerCase())?i(function(t,e){for(var i,r=o(t,n),a=r.length;a--;)t[i=K(t,r[a])]=!(e[i]=r[a])}):function(t){return o(t,0,r)}):o}},pseudos:{not:i(function(t){var e=[],n=[],r=T(t.replace(at,"$1"));return r[k]?i(function(t,e,n,i){for(var o,a=r(t,null,i,[]),s=t.length;s--;)(o=a[s])&&(t[s]=!(e[s]=o))}):function(t,i,o){return e[0]=t,r(e,null,o,n),e[0]=null,!n.pop()}}),has:i(function(t){return function(n){return e(t,n).length>0}}),contains:i(function(t){return t=t.replace(xt,bt),function(e){return(e.textContent||w(e)).indexOf(t)>-1}}),lang:i(function(t){return ht.test(t||"")||e.error("unsupported lang: "+t),t=t.replace(xt,bt).toLowerCase(),function(e){var n;do{if(n=D?e.lang:e.getAttribute("xml:lang")||e.getAttribute("lang"))return(n=n.toLowerCase())===t||0===n.indexOf(t+"-")}while((e=e.parentNode)&&1===e.nodeType);return 0}}),target:function(e){var n=t.location&&t.location.hash;return n&&n.slice(1)===e.id},root:function(t){return t===O},focus:function(t){return t===N.activeElement&&(!N.hasFocus||N.hasFocus())&&!!(t.type||t.href||~t.tabIndex)},enabled:l(0),disabled:l(1),checked:function(t){var e=t.nodeName.toLowerCase();return"input"===e&&!!t.checked||"option"===e&&!!t.selected},selected:function(t){return t.parentNode&&t.parentNode.selectedIndex,1==t.selected},empty:function(t){for(t=t.firstChild;t;t=t.nextSibling)if(t.nodeType<6)return 0;return 1},parent:function(t){return!_.pseudos.empty(t)},header:function(t){return mt.test(t.nodeName)},input:function(t){return ft.test(t.nodeName)},button:function(t){var e=t.nodeName.toLowerCase();return"input"===e&&"button"===t.type||"button"===e},text:function(t){var e;return"input"===t.nodeName.toLowerCase()&&"text"===t.type&&(null==(e=t.getAttribute("type"))||"text"===e.toLowerCase())},first:u(function(){return[0]}),last:u(function(t,e){return[e-1]}),eq:u(function(t,e,n){return[n<0?n+e:n]}),even:u(function(t,e){for(var n=0;ne?e:n;--i>=0;)t.push(i);return t}),gt:u(function(t,e,n){for(var i=n<0?n+e:n;++i0,o=t.length>0,a=function(i,a,s,c,l){var u,h,p,d=0,f="0",m=i&&[],v=[],y=L,x=i||o&&_.find.TAG("*",l),b=U+=null==y?1:Math.random()||.1,w=x.length;for(l&&(L=a===N||a||l);f!==w&&null!=(u=x[f]);f++){if(o&&u){for(h=0,a||u.ownerDocument===N||(E(u),s=!D);p=t[h++];)if(p(u,a||N,s)){c.push(u);break}l&&(U=b)}r&&((u=!p&&u)&&d--,i&&m.push(u))}if(d+=f,r&&f!==d){for(h=0;p=n[h++];)p(m,v,a,s);if(i){if(d>0)for(;f--;)m[f]||v[f]||(v[f]=Z.call(c));v=g(v)}$.apply(c,v),l&&!i&&v.length>0&&d+n.length>1&&e.uniqueSort(c)}return l&&(U=b,L=y),m};return r?i(a):a}(a,o))).selector=t}return s},A=e.select=function(t,e,n,i){var r,o,a,s,c,l="function"==typeof t&&t,u=!i&&S(t=l.selector||t);if(n=n||[],1===u.length){if((o=u[0]=u[0].slice(0)).length>2&&"ID"===(a=o[0]).type&&9===e.nodeType&&D&&_.relative[o[1].type]){if(!(e=(_.find.ID(a.matches[0].replace(xt,bt),e)||[])[0]))return n;l&&(e=e.parentNode),t=t.slice(o.shift().value.length)}for(r=pt.needsContext.test(t)?0:o.length;r--&&(a=o[r],!_.relative[s=a.type]);)if((c=_.find[s])&&(i=c(a.matches[0].replace(xt,bt),yt.test(o[0].type)&&h(e.parentNode)||e))){if(o.splice(r,1),!(t=i.length&&d(o)))return $.apply(n,i),n;break}}return(l||T(t,u))(i,e,!D,n,!e||yt.test(t)&&h(e.parentNode)||e),n},b.sortStable=k.split("").sort(q).join("")===k,b.detectDuplicates=!!P,E(),b.sortDetached=r(function(t){return 1&t.compareDocumentPosition(N.createElement("fieldset"))}),r(function(t){return t.innerHTML="","#"===t.firstChild.getAttribute("href")})||o("type|href|height|width",function(t,e,n){if(!n)return t.getAttribute(e,"type"===e.toLowerCase()?1:2)}),b.attributes&&r(function(t){return t.innerHTML="",t.firstChild.setAttribute("value",""),""===t.firstChild.getAttribute("value")})||o("value",function(t,e,n){if(!n&&"input"===t.nodeName.toLowerCase())return t.defaultValue}),r(function(t){return null==t.getAttribute("disabled")})||o(tt,function(t,e,n){var i;if(!n)return 1==t[e]?e.toLowerCase():(i=t.getAttributeNode(e))&&i.specified?i.value:null}),e}(t),Ze.find=K,Ze.expr=K.selectors,Ze.expr[":"]=Ze.expr.pseudos,Ze.uniqueSort=Ze.unique=K.uniqueSort,Ze.text=K.getText,Ze.isXMLDoc=K.isXML,Ze.contains=K.contains,Ze.escapeSelector=K.escape,tt=function(t,e,n){for(var i=[],r=void 0!==n;(t=t[e])&&9!==t.nodeType;)if(1===t.nodeType){if(r&&Ze(t).is(n))break;i.push(t)}return i},et=function(t,e){for(var n=[];t;t=t.nextSibling)1===t.nodeType&&t!==e&&n.push(t);return n},nt=Ze.expr.match.needsContext,it=/^<([a-z][^\/\0>:\x20\t\r\n\f]*)[\x20\t\r\n\f]*\/?>(?:<\/\1>|)$/i,Ze.filter=function(t,e,n){var i=e[0];return n&&(t=":not("+t+")"),1===e.length&&1===i.nodeType?Ze.find.matchesSelector(i,t)?[i]:[]:Ze.find.matches(t,Ze.grep(e,function(t){return 1===t.nodeType}))},Ze.fn.extend({find:function(t){var e,n,i=this.length,r=this;if("string"!=typeof t)return this.pushStack(Ze(t).filter(function(){for(e=0;e1?Ze.uniqueSort(n):n},filter:function(t){return this.pushStack(a(this,t||[],0))},not:function(t){return this.pushStack(a(this,t||[],1))},is:function(t){return!!a(this,"string"==typeof t&&nt.test(t)?Ze(t):t||[],0).length}}),ot=/^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]+))$/,(Ze.fn.init=function(t,e,n){var i,r;if(!t)return this;if(n=n||rt,"string"==typeof t){if(!(i="<"===t[0]&&">"===t[t.length-1]&&t.length>=3?[null,t,null]:ot.exec(t))||!i[1]&&e)return!e||e.jquery?(e||n).find(t):this.constructor(e).find(t);if(i[1]){if(e=e instanceof Ze?e[0]:e,Ze.merge(this,Ze.parseHTML(i[1],e&&e.nodeType?e.ownerDocument||e:Ie,1)),it.test(i[1])&&Ze.isPlainObject(e))for(i in e)qe(this[i])?this[i](e[i]):this.attr(i,e[i]);return this}return(r=Ie.getElementById(i[2]))&&(this[0]=r,this.length=1),this}return t.nodeType?(this[0]=t,this.length=1,this):qe(t)?void 0!==n.ready?n.ready(t):t(Ze):Ze.makeArray(t,this)}).prototype=Ze.fn,rt=Ze(Ie),at=/^(?:parents|prev(?:Until|All))/,st={children:1,contents:1,next:1,prev:1},Ze.fn.extend({has:function(t){var e=Ze(t,this),n=e.length;return this.filter(function(){for(var t=0;t-1:1===n.nodeType&&Ze.find.matchesSelector(n,t))){o.push(n);break}return this.pushStack(o.length>1?Ze.uniqueSort(o):o)},index:function(t){return t?"string"==typeof t?Be.call(Ze(t),this[0]):Be.call(this,t.jquery?t[0]:t):this[0]&&this[0].parentNode?this.first().prevAll().length:-1},add:function(t,e){return this.pushStack(Ze.uniqueSort(Ze.merge(this.get(),Ze(t,e))))},addBack:function(t){return this.add(null==t?this.prevObject:this.prevObject.filter(t))}}),Ze.each({parent:function(t){var e=t.parentNode;return e&&11!==e.nodeType?e:null},parents:function(t){return tt(t,"parentNode")},parentsUntil:function(t,e,n){return tt(t,"parentNode",n)},next:function(t){return s(t,"nextSibling")},prev:function(t){return s(t,"previousSibling")},nextAll:function(t){return tt(t,"nextSibling")},prevAll:function(t){return tt(t,"previousSibling")},nextUntil:function(t,e,n){return tt(t,"nextSibling",n)},prevUntil:function(t,e,n){return tt(t,"previousSibling",n)},siblings:function(t){return et((t.parentNode||{}).firstChild,t)},children:function(t){return et(t.firstChild)},contents:function(t){return void 0!==t.contentDocument?t.contentDocument:(o(t,"template")&&(t=t.content||t),Ze.merge([],t.childNodes))}},function(t,e){Ze.fn[t]=function(n,i){var r=Ze.map(this,e,n);return"Until"!==t.slice(-5)&&(i=n),i&&"string"==typeof i&&(r=Ze.filter(i,r)),this.length>1&&(st[t]||Ze.uniqueSort(r),at.test(t)&&r.reverse()),this.pushStack(r)}}),ct=/[^\x20\t\r\n\f]+/g,Ze.Callbacks=function(t){t="string"==typeof t?function(t){var e={};return Ze.each(t.match(ct)||[],function(t,n){e[n]=1}),e}(t):Ze.extend({},t);var e,n,r,o,a=[],s=[],c=-1,l=function(){for(o=o||t.once,r=e=1;s.length;c=-1)for(n=s.shift();++c-1;)a.splice(n,1),n<=c&&c--}),this},has:function(t){return t?Ze.inArray(t,a)>-1:a.length>0},empty:function(){return a&&(a=[]),this},disable:function(){return o=s=[],a=n="",this},disabled:function(){return!a},lock:function(){return o=s=[],n||e||(a=n=""),this},locked:function(){return!!o},fireWith:function(t,n){return o||(n=[t,(n=n||[]).slice?n.slice():n],s.push(n),e||l()),this},fire:function(){return u.fireWith(this,arguments),this},fired:function(){return!!r}};return u},Ze.extend({Deferred:function(e){var n=[["notify","progress",Ze.Callbacks("memory"),Ze.Callbacks("memory"),2],["resolve","done",Ze.Callbacks("once memory"),Ze.Callbacks("once memory"),0,"resolved"],["reject","fail",Ze.Callbacks("once memory"),Ze.Callbacks("once memory"),1,"rejected"]],i="pending",r={state:function(){return i},always:function(){return o.done(arguments).fail(arguments),this},catch:function(t){return r.then(null,t)},pipe:function(){var t=arguments;return Ze.Deferred(function(e){Ze.each(n,function(n,i){var r=qe(t[i[4]])&&t[i[4]];o[i[1]](function(){var t=r&&r.apply(this,arguments);t&&qe(t.promise)?t.promise().progress(e.notify).done(e.resolve).fail(e.reject):e[i[0]+"With"](this,r?[t]:arguments)})}),t=null}).promise()},then:function(e,i,r){function o(e,n,i,r){return function(){var s=this,u=arguments,h=function(){var t,h;if(!(e=a&&(i!==l&&(s=void 0,u=[t]),n.rejectWith(s,u))}};e?p():(Ze.Deferred.getStackHook&&(p.stackTrace=Ze.Deferred.getStackHook()),t.setTimeout(p))}}var a=0;return Ze.Deferred(function(t){n[0][3].add(o(0,t,qe(r)?r:c,t.notifyWith)),n[1][3].add(o(0,t,qe(e)?e:c)),n[2][3].add(o(0,t,qe(i)?i:l))}).promise()},promise:function(t){return null!=t?Ze.extend(t,r):r}},o={};return Ze.each(n,function(t,e){var a=e[2],s=e[5];r[e[1]]=a.add,s&&a.add(function(){i=s},n[3-t][2].disable,n[3-t][3].disable,n[0][2].lock,n[0][3].lock),a.add(e[3].fire),o[e[0]]=function(){return o[e[0]+"With"](this===o?void 0:this,arguments),this},o[e[0]+"With"]=a.fireWith}),r.promise(o),e&&e.call(o,o),o},when:function(t){var e=arguments.length,n=e,i=Array(n),r=Re.call(arguments),o=Ze.Deferred(),a=function(t){return function(n){i[t]=this,r[t]=arguments.length>1?Re.call(arguments):n,--e||o.resolveWith(i,r)}};if(e<=1&&(u(t,o.done(a(n)).resolve,o.reject,!e),"pending"===o.state()||qe(r[n]&&r[n].then)))return o.then();for(;n--;)u(r[n],a(n),o.reject);return o.promise()}}),lt=/^(Eval|Internal|Range|Reference|Syntax|Type|URI)Error$/,Ze.Deferred.exceptionHook=function(e,n){t.console&&t.console.warn&&e&<.test(e.name)&&t.console.warn("jQuery.Deferred exception: "+e.message,e.stack,n)},Ze.readyException=function(e){t.setTimeout(function(){throw e})},ut=Ze.Deferred(),Ze.fn.ready=function(t){return ut.then(t).catch(function(t){Ze.readyException(t)}),this},Ze.extend({isReady:0,readyWait:1,ready:function(t){(1==t?--Ze.readyWait:Ze.isReady)||(Ze.isReady=1,1!=t&&--Ze.readyWait>0||ut.resolveWith(Ie,[Ze]))}}),Ze.ready.then=ut.then,"complete"===Ie.readyState||"loading"!==Ie.readyState&&!Ie.documentElement.doScroll?t.setTimeout(Ze.ready):(Ie.addEventListener("DOMContentLoaded",h),t.addEventListener("load",h)),ht=function(t,e,n,r,o,a,s){var c=0,l=t.length,u=null==n;if("object"===i(n))for(c in o=1,n)ht(t,e,c,n[c],1,a,s);else if(void 0!==r&&(o=1,qe(r)||(s=1),u&&(s?(e.call(t,r),e=null):(u=e,e=function(t,e,n){return u.call(Ze(t),n)})),e))for(;c1,null,1)},removeData:function(t){return this.each(function(){gt.remove(this,t)})}}),Ze.extend({queue:function(t,e,n){var i;if(t)return e=(e||"fx")+"queue",i=mt.get(t,e),n&&(!i||Array.isArray(n)?i=mt.access(t,e,Ze.makeArray(n)):i.push(n)),i||[]},dequeue:function(t,e){e=e||"fx";var n=Ze.queue(t,e),i=n.length,r=n.shift(),o=Ze._queueHooks(t,e);"inprogress"===r&&(r=n.shift(),i--),r&&("fx"===e&&n.unshift("inprogress"),delete o.stop,r.call(t,function(){Ze.dequeue(t,e)},o)),!i&&o&&o.empty.fire()},_queueHooks:function(t,e){var n=e+"queueHooks";return mt.get(t,n)||mt.access(t,n,{empty:Ze.Callbacks("once memory").add(function(){mt.remove(t,[e+"queue",n])})})}}),Ze.fn.extend({queue:function(t,e){var n=2;return"string"!=typeof t&&(e=t,t="fx",n--),arguments.length\x20\t\r\n\f]*)/i,Et=/^$|^module$|\/(?:java|ecma)script/i,(Nt={option:[1,""],thead:[1,"","
"],col:[2,"","
"],tr:[2,"","
"],td:[3,"","
"],_default:[0,"",""]}).optgroup=Nt.option,Nt.tbody=Nt.tfoot=Nt.colgroup=Nt.caption=Nt.thead,Nt.th=Nt.td,Ot=/<|&#?\w+;/,Ee=Ie.createDocumentFragment().appendChild(Ie.createElement("div")),(Ne=Ie.createElement("input")).setAttribute("type","radio"),Ne.setAttribute("checked","checked"),Ne.setAttribute("name","t"),Ee.appendChild(Ne),He.checkClone=Ee.cloneNode(1).cloneNode(1).lastChild.checked,Ee.innerHTML="",He.noCloneChecked=!!Ee.cloneNode(1).lastChild.defaultValue,Dt=/^key/,It=/^(?:mouse|pointer|contextmenu|drag|drop)|click/,zt=/^([^.]*)(?:\.(.+)|)/,Ze.event={global:{},add:function(t,e,n,i,r){var o,a,s,c,l,u,h,p,d,f,m,g=mt.get(t);if(g)for(n.handler&&(n=(o=n).handler,r=o.selector),r&&Ze.find.matchesSelector(wt,r),n.guid||(n.guid=Ze.guid++),(c=g.events)||(c=g.events={}),(a=g.handle)||(a=g.handle=function(e){return void 0!==Ze&&Ze.event.triggered!==e.type?Ze.event.dispatch.apply(t,arguments):void 0}),l=(e=(e||"").match(ct)||[""]).length;l--;)d=m=(s=zt.exec(e[l])||[])[1],f=(s[2]||"").split(".").sort(),d&&(h=Ze.event.special[d]||{},d=(r?h.delegateType:h.bindType)||d,h=Ze.event.special[d]||{},u=Ze.extend({type:d,origType:m,data:i,handler:n,guid:n.guid,selector:r,needsContext:r&&Ze.expr.match.needsContext.test(r),namespace:f.join(".")},o),(p=c[d])||((p=c[d]=[]).delegateCount=0,h.setup&&0!=h.setup.call(t,i,f,a)||t.addEventListener&&t.addEventListener(d,a)),h.add&&(h.add.call(t,u),u.handler.guid||(u.handler.guid=n.guid)),r?p.splice(p.delegateCount++,0,u):p.push(u),Ze.event.global[d]=1)},remove:function(t,e,n,i,r){var o,a,s,c,l,u,h,p,d,f,m,g=mt.hasData(t)&&mt.get(t);if(g&&(c=g.events)){for(l=(e=(e||"").match(ct)||[""]).length;l--;)if(d=m=(s=zt.exec(e[l])||[])[1],f=(s[2]||"").split(".").sort(),d){for(h=Ze.event.special[d]||{},p=c[d=(i?h.delegateType:h.bindType)||d]||[],s=s[2]&&RegExp("(^|\\.)"+f.join("\\.(?:.*\\.|)")+"(\\.|$)"),a=o=p.length;o--;)u=p[o],!r&&m!==u.origType||n&&n.guid!==u.guid||s&&!s.test(u.namespace)||i&&i!==u.selector&&("**"!==i||!u.selector)||(p.splice(o,1),u.selector&&p.delegateCount--,h.remove&&h.remove.call(t,u));a&&!p.length&&(h.teardown&&0!=h.teardown.call(t,f,g.handle)||Ze.removeEvent(t,d,g.handle),delete c[d])}else for(d in c)Ze.event.remove(t,d+e[l],n,i,1);Ze.isEmptyObject(c)&&mt.remove(t,"handle events")}},dispatch:function(t){var e,n,i,r,o,a,s=Ze.event.fix(t),c=Array(arguments.length),l=(mt.get(this,"events")||{})[s.type]||[],u=Ze.event.special[s.type]||{};for(c[0]=s,e=1;e=1))for(;l!==this;l=l.parentNode||this)if(1===l.nodeType&&("click"!==t.type||1!=l.disabled)){for(o=[],a={},n=0;n-1:Ze.find(r,this,null,[l]).length),a[r]&&o.push(i);o.length&&s.push({elem:l,handlers:o})}return l=this,c\x20\t\r\n\f]*)[^>]*)\/>/gi,Ft=/\s*$/g,Ze.extend({htmlPrefilter:function(t){return t.replace(Rt,"<$1>")},clone:function(t,e,n){var i,r,o,a,s=t.cloneNode(1),c=Mt(t);if(!(He.noCloneChecked||1!==t.nodeType&&11!==t.nodeType||Ze.isXMLDoc(t)))for(a=x(s),i=0,r=(o=x(t)).length;i0&&b(a,!c&&x(t,"script")),s},cleanData:function(t){for(var e,n,i,r=Ze.event.special,o=0;void 0!==(n=t[o]);o++)if(ft(n)){if(e=n[mt.expando]){if(e.events)for(i in e.events)r[i]?Ze.event.remove(n,i):Ze.removeEvent(n,i,e.handle);n[mt.expando]=void 0}n[gt.expando]&&(n[gt.expando]=void 0)}}}),Ze.fn.extend({detach:function(t){return D(this,t,1)},remove:function(t){return D(this,t)},text:function(t){return ht(this,function(t){return void 0===t?Ze.text(this):this.empty().each(function(){1!==this.nodeType&&11!==this.nodeType&&9!==this.nodeType||(this.textContent=t)})},null,t,arguments.length)},append:function(){return O(this,arguments,function(t){1!==this.nodeType&&11!==this.nodeType&&9!==this.nodeType||L(this,t).appendChild(t)})},prepend:function(){return O(this,arguments,function(t){if(1===this.nodeType||11===this.nodeType||9===this.nodeType){var e=L(this,t);e.insertBefore(t,e.firstChild)}})},before:function(){return O(this,arguments,function(t){this.parentNode&&this.parentNode.insertBefore(t,this)})},after:function(){return O(this,arguments,function(t){this.parentNode&&this.parentNode.insertBefore(t,this.nextSibling)})},empty:function(){for(var t,e=0;null!=(t=this[e]);e++)1===t.nodeType&&(Ze.cleanData(x(t,0)),t.textContent="");return this},clone:function(t,e){return t=null==t?0:t,e=null==e?t:e,this.map(function(){return Ze.clone(this,t,e)})},html:function(t){return ht(this,function(t){var e=this[0]||{},n=0,i=this.length;if(void 0===t&&1===e.nodeType)return e.innerHTML;if("string"==typeof t&&!Ft.test(t)&&!Nt[(Pt.exec(t)||["",""])[1].toLowerCase()]){t=Ze.htmlPrefilter(t);try{for(;n1)}}),Ze.Tween=U,U.prototype={constructor:U,init:function(t,e,n,i,r,o){this.elem=t,this.prop=n,this.easing=r||Ze.easing._default,this.options=e,this.start=this.now=this.cur(),this.end=i,this.unit=o||(Ze.cssNumber[n]?"":"px")},cur:function(){var t=U.propHooks[this.prop];return t&&t.get?t.get(this):U.propHooks._default.get(this)},run:function(t){var e,n=U.propHooks[this.prop];return this.options.duration?this.pos=e=Ze.easing[this.easing](t,this.options.duration*t,0,1,this.options.duration):this.pos=e=t,this.now=(this.end-this.start)*e+this.start,this.options.step&&this.options.step.call(this.elem,this.now,this),n&&n.set?n.set(this):U.propHooks._default.set(this),this}},U.prototype.init.prototype=U.prototype,U.propHooks={_default:{get:function(t){var e;return 1!==t.elem.nodeType||null!=t.elem[t.prop]&&null==t.elem.style[t.prop]?t.elem[t.prop]:(e=Ze.css(t.elem,t.prop,""))&&"auto"!==e?e:0},set:function(t){Ze.fx.step[t.prop]?Ze.fx.step[t.prop](t):1!==t.elem.nodeType||!Ze.cssHooks[t.prop]&&null==t.elem.style[R(t.prop)]?t.elem[t.prop]=t.now:Ze.style(t.elem,t.prop,t.now+t.unit)}}},U.propHooks.scrollTop=U.propHooks.scrollLeft={set:function(t){t.elem.nodeType&&t.elem.parentNode&&(t.elem[t.prop]=t.now)}},Ze.easing={linear:function(t){return t},swing:function(t){return.5-Math.cos(t*Math.PI)/2},_default:"swing"},Ze.fx=U.prototype.init,Ze.fx.step={},Qt=/^(?:toggle|show|hide)$/,Kt=/queueHooks$/,Ze.Animation=Ze.extend(H,{tweeners:{"*":[function(t,e){var n=this.createTween(t,e);return g(n.elem,t,bt.exec(e),n),n}]},tweener:function(t,e){qe(t)?(e=t,t=["*"]):t=t.match(ct);for(var n,i=0,r=t.length;i1)},removeAttr:function(t){return this.each(function(){Ze.removeAttr(this,t)})}}),Ze.extend({attr:function(t,e,n){var i,r,o=t.nodeType;if(3!==o&&8!==o&&2!==o)return void 0===t.getAttribute?Ze.prop(t,e,n):(1===o&&Ze.isXMLDoc(t)||(r=Ze.attrHooks[e.toLowerCase()]||(Ze.expr.match.bool.test(e)?te:void 0)),void 0!==n?null===n?void Ze.removeAttr(t,e):r&&"set"in r&&void 0!==(i=r.set(t,n,e))?i:(t.setAttribute(e,n+""),n):r&&"get"in r&&null!==(i=r.get(t,e))?i:null==(i=Ze.find.attr(t,e))?void 0:i)},attrHooks:{type:{set:function(t,e){if(!He.radioValue&&"radio"===e&&o(t,"input")){var n=t.value;return t.setAttribute("type",e),n&&(t.value=n),e}}}},removeAttr:function(t,e){var n,i=0,r=e&&e.match(ct);if(r&&1===t.nodeType)for(;n=r[i++];)t.removeAttribute(n)}}),te={set:function(t,e,n){return 0==e?Ze.removeAttr(t,n):t.setAttribute(n,n),n}},Ze.each(Ze.expr.match.bool.source.match(/\w+/g),function(t,e){var n=ee[e]||Ze.find.attr;ee[e]=function(t,e,i){var r,o,a=e.toLowerCase();return i||(o=ee[a],ee[a]=r,r=null!=n(t,e,i)?a:null,ee[a]=o),r}}),ne=/^(?:input|select|textarea|button)$/i,ie=/^(?:a|area)$/i,Ze.fn.extend({prop:function(t,e){return ht(this,Ze.prop,t,e,arguments.length>1)},removeProp:function(t){return this.each(function(){delete this[Ze.propFix[t]||t]})}}),Ze.extend({prop:function(t,e,n){var i,r,o=t.nodeType;if(3!==o&&8!==o&&2!==o)return 1===o&&Ze.isXMLDoc(t)||(e=Ze.propFix[e]||e,r=Ze.propHooks[e]),void 0!==n?r&&"set"in r&&void 0!==(i=r.set(t,n,e))?i:t[e]=n:r&&"get"in r&&null!==(i=r.get(t,e))?i:t[e]},propHooks:{tabIndex:{get:function(t){var e=Ze.find.attr(t,"tabindex");return e?parseInt(e,10):ne.test(t.nodeName)||ie.test(t.nodeName)&&t.href?0:-1}}},propFix:{for:"htmlFor",class:"className"}}),He.optSelected||(Ze.propHooks.selected={get:function(t){var e=t.parentNode;return e&&e.parentNode&&e.parentNode.selectedIndex,null},set:function(t){var e=t.parentNode;e&&(e.selectedIndex,e.parentNode&&e.parentNode.selectedIndex)}}),Ze.each(["tabIndex","readOnly","maxLength","cellSpacing","cellPadding","rowSpan","colSpan","useMap","frameBorder","contentEditable"],function(){Ze.propFix[this.toLowerCase()]=this}),Ze.fn.extend({addClass:function(t){var e,n,i,r,o,a,s,c=0;if(qe(t))return this.each(function(e){Ze(this).addClass(t.call(this,e,X(this)))});if((e=Y(t)).length)for(;n=this[c++];)if(r=X(n),i=1===n.nodeType&&" "+q(r)+" "){for(a=0;o=e[a++];)i.indexOf(" "+o+" ")<0&&(i+=o+" ");r!==(s=q(i))&&n.setAttribute("class",s)}return this},removeClass:function(t){var e,n,i,r,o,a,s,c=0;if(qe(t))return this.each(function(e){Ze(this).removeClass(t.call(this,e,X(this)))});if(!arguments.length)return this.attr("class","");if((e=Y(t)).length)for(;n=this[c++];)if(r=X(n),i=1===n.nodeType&&" "+q(r)+" "){for(a=0;o=e[a++];)for(;i.indexOf(" "+o+" ")>-1;)i=i.replace(" "+o+" "," ");r!==(s=q(i))&&n.setAttribute("class",s)}return this},toggleClass:function(t,e){var n=typeof t,i="string"===n||Array.isArray(t);return"boolean"==typeof e&&i?e?this.addClass(t):this.removeClass(t):qe(t)?this.each(function(n){Ze(this).toggleClass(t.call(this,n,X(this),e),e)}):this.each(function(){var e,r,o,a;if(i)for(r=0,o=Ze(this),a=Y(t);e=a[r++];)o.hasClass(e)?o.removeClass(e):o.addClass(e);else void 0!==t&&"boolean"!==n||((e=X(this))&&mt.set(this,"__className__",e),this.setAttribute&&this.setAttribute("class",e||0==t?"":mt.get(this,"__className__")||""))})},hasClass:function(t){var e,n,i=0;for(e=" "+t+" ";n=this[i++];)if(1===n.nodeType&&(" "+q(X(n))+" ").indexOf(e)>-1)return 1;return 0}}),re=/\r/g,Ze.fn.extend({val:function(t){var e,n,i,r=this[0];return arguments.length?(i=qe(t),this.each(function(n){var r;1===this.nodeType&&(null==(r=i?t.call(this,n,Ze(this).val()):t)?r="":"number"==typeof r?r+="":Array.isArray(r)&&(r=Ze.map(r,function(t){return null==t?"":t+""})),(e=Ze.valHooks[this.type]||Ze.valHooks[this.nodeName.toLowerCase()])&&"set"in e&&void 0!==e.set(this,r,"value")||(this.value=r))})):r?(e=Ze.valHooks[r.type]||Ze.valHooks[r.nodeName.toLowerCase()])&&"get"in e&&void 0!==(n=e.get(r,"value"))?n:"string"==typeof(n=r.value)?n.replace(re,""):null==n?"":n:void 0}}),Ze.extend({valHooks:{option:{get:function(t){var e=Ze.find.attr(t,"value");return null!=e?e:q(Ze.text(t))}},select:{get:function(t){var e,n,i,r=t.options,a=t.selectedIndex,s="select-one"===t.type,c=s?null:[],l=s?a+1:r.length;for(i=a<0?l:s?a:0;i-1)&&(n=1);return n||(t.selectedIndex=-1),o}}}}),Ze.each(["radio","checkbox"],function(){Ze.valHooks[this]={set:function(t,e){if(Array.isArray(e))return t.checked=Ze.inArray(Ze(t).val(),e)>-1}},He.checkOn||(Ze.valHooks[this].get=function(t){return null===t.getAttribute("value")?"on":t.value})}),He.focusin="onfocusin"in t,oe=/^(?:focusinfocus|focusoutblur)$/,ae=function(t){t.stopPropagation()},Ze.extend(Ze.event,{trigger:function(e,n,i,r){var o,a,s,c,l,u,h,p,d=[i||Ie],f=Ve.call(e,"type")?e.type:e,m=Ve.call(e,"namespace")?e.namespace.split("."):[];if(a=p=s=i=i||Ie,3!==i.nodeType&&8!==i.nodeType&&!oe.test(f+Ze.event.triggered)&&(f.indexOf(".")>-1&&(m=f.split("."),f=m.shift(),m.sort()),l=f.indexOf(":")<0&&"on"+f,(e=e[Ze.expando]?e:new Ze.Event(f,"object"==typeof e&&e)).isTrigger=r?2:3,e.namespace=m.join("."),e.rnamespace=e.namespace?RegExp("(^|\\.)"+m.join("\\.(?:.*\\.|)")+"(\\.|$)"):null,e.result=void 0,e.target||(e.target=i),n=null==n?[e]:Ze.makeArray(n,[e]),h=Ze.event.special[f]||{},r||!h.trigger||0!=h.trigger.apply(i,n))){if(!r&&!h.noBubble&&!Xe(i)){for(c=h.delegateType||f,oe.test(c+f)||(a=a.parentNode);a;a=a.parentNode)d.push(a),s=a;s===(i.ownerDocument||Ie)&&d.push(s.defaultView||s.parentWindow||t)}for(o=0;(a=d[o++])&&!e.isPropagationStopped();)p=a,e.type=o>1?c:h.bindType||f,(u=(mt.get(a,"events")||{})[e.type]&&mt.get(a,"handle"))&&u.apply(a,n),(u=l&&a[l])&&u.apply&&ft(a)&&(e.result=u.apply(a,n),0==e.result&&e.preventDefault());return e.type=f,r||e.isDefaultPrevented()||h._default&&0!=h._default.apply(d.pop(),n)||!ft(i)||l&&qe(i[f])&&!Xe(i)&&((s=i[l])&&(i[l]=null),Ze.event.triggered=f,e.isPropagationStopped()&&p.addEventListener(f,ae),i[f](),e.isPropagationStopped()&&p.removeEventListener(f,ae),Ze.event.triggered=void 0,s&&(i[l]=s)),e.result}},simulate:function(t,e,n){var i=Ze.extend(new Ze.Event,n,{type:t,isSimulated:1});Ze.event.trigger(i,null,e)}}),Ze.fn.extend({trigger:function(t,e){return this.each(function(){Ze.event.trigger(t,e,this)})},triggerHandler:function(t,e){var n=this[0];if(n)return Ze.event.trigger(t,e,n,1)}}),He.focusin||Ze.each({focus:"focusin",blur:"focusout"},function(t,e){var n=function(t){Ze.event.simulate(e,t.target,Ze.event.fix(t))};Ze.event.special[e]={setup:function(){var i=this.ownerDocument||this,r=mt.access(i,e);r||i.addEventListener(t,n,1),mt.access(i,e,(r||0)+1)},teardown:function(){var i=this.ownerDocument||this,r=mt.access(i,e)-1;r?mt.access(i,e,r):(i.removeEventListener(t,n,1),mt.remove(i,e))}}}),se=t.location,ce=Date.now(),le=/\?/,Ze.parseXML=function(e){var n;if(!e||"string"!=typeof e)return null;try{n=(new t.DOMParser).parseFromString(e,"text/xml")}catch(t){n=void 0}return n&&!n.getElementsByTagName("parsererror").length||Ze.error("Invalid XML: "+e),n},ue=/\[\]$/,he=/\r?\n/g,pe=/^(?:submit|button|image|reset|file)$/i,de=/^(?:input|select|textarea|keygen)/i,Ze.param=function(t,e){var n,i=[],r=function(t,e){var n=qe(e)?e():e;i[i.length]=encodeURIComponent(t)+"="+encodeURIComponent(null==n?"":n)};if(null==t)return"";if(Array.isArray(t)||t.jquery&&!Ze.isPlainObject(t))Ze.each(t,function(){r(this.name,this.value)});else for(n in t)Z(n,t[n],e,r);return i.join("&")},Ze.fn.extend({serialize:function(){return Ze.param(this.serializeArray())},serializeArray:function(){return this.map(function(){var t=Ze.prop(this,"elements");return t?Ze.makeArray(t):this}).filter(function(){var t=this.type;return this.name&&!Ze(this).is(":disabled")&&de.test(this.nodeName)&&!pe.test(t)&&(this.checked||!Ct.test(t))}).map(function(t,e){var n=Ze(this).val();return null==n?null:Array.isArray(n)?Ze.map(n,function(t){return{name:e.name,value:t.replace(he,"\r\n")}}):{name:e.name,value:n.replace(he,"\r\n")}}).get()}}),fe=/%20/g,me=/#.*$/,ge=/([?&])_=[^&]*/,ve=/^(.*?):[ \t]*([^\r\n]*)$/gm,ye=/^(?:about|app|app-storage|.+-extension|file|res|widget):$/,xe=/^(?:GET|HEAD)$/,be=/^\/\//,_e={},we={},"*/*",(Me=Ie.createElement("a")).href=se.href,Ze.extend({active:0,lastModified:{},etag:{},ajaxSettings:{url:se.href,type:"GET",isLocal:ye.test(se.protocol),global:1,processData:1,async:1,contentType:"application/x-www-form-urlencoded; charset=UTF-8",accepts:{"*":"*/*",text:"text/plain",html:"text/html",xml:"application/xml, text/xml",json:"application/json, text/javascript"},contents:{xml:/\bxml\b/,html:/\bhtml/,json:/\bjson\b/},responseFields:{xml:"responseXML",text:"responseText",json:"responseJSON"},converters:{"* text":String,"text html":1,"text json":JSON.parse,"text xml":Ze.parseXML},flatOptions:{url:1,context:1}},ajaxSetup:function(t,e){return e?Q(Q(t,Ze.ajaxSettings),e):Q(Ze.ajaxSettings,t)},ajaxPrefilter:J(_e),ajaxTransport:J(we),ajax:function(e,n){function i(e,n,i,s){var l,p,d,b,_,w=n;u||(u=1,c&&t.clearTimeout(c),r=void 0,a=s||"",M.readyState=e>0?4:0,l=e>=200&&e<300||304===e,i&&(b=function(t,e,n){for(var i,r,o,a,s=t.contents,c=t.dataTypes;"*"===c[0];)c.shift(),void 0===i&&(i=t.mimeType||e.getResponseHeader("Content-Type"));if(i)for(r in s)if(s[r]&&s[r].test(i)){c.unshift(r);break}if(c[0]in n)o=c[0];else{for(r in n){if(!c[0]||t.converters[r+" "+c[0]]){o=r;break}a||(a=r)}o=o||a}if(o)return o!==c[0]&&c.unshift(o),n[o]}(f,M,i)),b=function(t,e,n,i){var r,o,a,s,c,l={},u=t.dataTypes.slice();if(u[1])for(a in t.converters)l[a.toLowerCase()]=t.converters[a];for(o=u.shift();o;)if(t.responseFields[o]&&(n[t.responseFields[o]]=e),!c&&i&&t.dataFilter&&(e=t.dataFilter(e,t.dataType)),c=o,o=u.shift())if("*"===o)o=c;else if("*"!==c&&c!==o){if(!(a=l[c+" "+o]||l["* "+o]))for(r in l)if((s=r.split(" "))[1]===o&&(a=l[c+" "+s[0]]||l["* "+s[0]])){1==a?a=l[r]:1!=l[r]&&(o=s[0],u.unshift(s[1]));break}if(1!=a)if(a&&t.throws)e=a(e);else try{e=a(e)}catch(t){return{state:"parsererror",error:a?t:"No conversion from "+c+" to "+o}}}return{state:"success",data:e}}(f,b,M,l),l?(f.ifModified&&((_=M.getResponseHeader("Last-Modified"))&&(Ze.lastModified[o]=_),(_=M.getResponseHeader("etag"))&&(Ze.etag[o]=_)),204===e||"HEAD"===f.type?w="nocontent":304===e?w="notmodified":(w=b.state,p=b.data,l=!(d=b.error))):(d=w,!e&&w||(w="error",e<0&&(e=0))),M.status=e,M.statusText=(n||w)+"",l?v.resolveWith(m,[p,w,M]):v.rejectWith(m,[M,w,d]),M.statusCode(x),x=void 0,h&&g.trigger(l?"ajaxSuccess":"ajaxError",[M,f,l?p:d]),y.fireWith(m,[M,w]),h&&(g.trigger("ajaxComplete",[M,f]),--Ze.active||Ze.event.trigger("ajaxStop")))}"object"==typeof e&&(n=e,e=void 0),n=n||{};var r,o,a,s,c,l,u,h,p,d,f=Ze.ajaxSetup({},n),m=f.context||f,g=f.context&&(m.nodeType||m.jquery)?Ze(m):Ze.event,v=Ze.Deferred(),y=Ze.Callbacks("once memory"),x=f.statusCode||{},b={},_={},w="canceled",M={readyState:0,getResponseHeader:function(t){var e;if(u){if(!s)for(s={};e=ve.exec(a);)s[e[1].toLowerCase()+" "]=(s[e[1].toLowerCase()+" "]||[]).concat(e[2]);e=s[t.toLowerCase()+" "]}return null==e?null:e.join(", ")},getAllResponseHeaders:function(){return u?a:null},setRequestHeader:function(t,e){return null==u&&(t=_[t.toLowerCase()]=_[t.toLowerCase()]||t,b[t]=e),this},overrideMimeType:function(t){return null==u&&(f.mimeType=t),this},statusCode:function(t){var e;if(t)if(u)M.always(t[M.status]);else for(e in t)x[e]=[x[e],t[e]];return this},abort:function(t){var e=t||w;return r&&r.abort(e),i(0,e),this}};if(v.promise(M),f.url=((e||f.url||se.href)+"").replace(be,se.protocol+"//"),f.type=n.method||n.type||f.method||f.type,f.dataTypes=(f.dataType||"*").toLowerCase().match(ct)||[""],null==f.crossDomain){l=Ie.createElement("a");try{l.href=f.url,l.href=l.href,f.crossDomain=Me.protocol+"//"+Me.host!=l.protocol+"//"+l.host}catch(t){f.crossDomain=1}}if(f.data&&f.processData&&"string"!=typeof f.data&&(f.data=Ze.param(f.data,f.traditional)),$(_e,f,n,M),u)return M;for(p in(h=Ze.event&&f.global)&&0==Ze.active++&&Ze.event.trigger("ajaxStart"),f.type=f.type.toUpperCase(),f.hasContent=!xe.test(f.type),o=f.url.replace(me,""),f.hasContent?f.data&&f.processData&&0===(f.contentType||"").indexOf("application/x-www-form-urlencoded")&&(f.data=f.data.replace(fe,"+")):(d=f.url.slice(o.length),f.data&&(f.processData||"string"==typeof f.data)&&(o+=(le.test(o)?"&":"?")+f.data,delete f.data),0==f.cache&&(o=o.replace(ge,"$1"),d=(le.test(o)?"&":"?")+"_="+ce+++d),f.url=o+d),f.ifModified&&(Ze.lastModified[o]&&M.setRequestHeader("If-Modified-Since",Ze.lastModified[o]),Ze.etag[o]&&M.setRequestHeader("If-None-Match",Ze.etag[o])),(f.data&&f.hasContent&&0!=f.contentType||n.contentType)&&M.setRequestHeader("Content-Type",f.contentType),M.setRequestHeader("Accept",f.dataTypes[0]&&f.accepts[f.dataTypes[0]]?f.accepts[f.dataTypes[0]]+("*"!==f.dataTypes[0]?", */*; q=0.01":""):f.accepts["*"]),f.headers)M.setRequestHeader(p,f.headers[p]);if(f.beforeSend&&(0==f.beforeSend.call(m,M,f)||u))return M.abort();if(w="abort",y.add(f.complete),M.done(f.success),M.fail(f.error),r=$(we,f,n,M)){if(M.readyState=1,h&&g.trigger("ajaxSend",[M,f]),u)return M;f.async&&f.timeout>0&&(c=t.setTimeout(function(){M.abort("timeout")},f.timeout));try{u=0,r.send(b,i)}catch(t){if(u)throw t;i(-1,t)}}else i(-1,"No Transport");return M},getJSON:function(t,e,n){return Ze.get(t,e,n,"json")},getScript:function(t,e){return Ze.get(t,void 0,e,"script")}}),Ze.each(["get","post"],function(t,e){Ze[e]=function(t,n,i,r){return qe(n)&&(r=r||i,i=n,n=void 0),Ze.ajax(Ze.extend({url:t,type:e,dataType:r,data:n,success:i},Ze.isPlainObject(t)&&t))}}),Ze._evalUrl=function(t,e){return Ze.ajax({url:t,type:"GET",dataType:"script",cache:1,async:0,global:0,converters:{"text script":function(){}},dataFilter:function(t){Ze.globalEval(t,e)}})},Ze.fn.extend({wrapAll:function(t){var e;return this[0]&&(qe(t)&&(t=t.call(this[0])),e=Ze(t,this[0].ownerDocument).eq(0).clone(1),this[0].parentNode&&e.insertBefore(this[0]),e.map(function(){for(var t=this;t.firstElementChild;)t=t.firstElementChild;return t}).append(this)),this},wrapInner:function(t){return qe(t)?this.each(function(e){Ze(this).wrapInner(t.call(this,e))}):this.each(function(){var e=Ze(this),n=e.contents();n.length?n.wrapAll(t):e.append(t)})},wrap:function(t){var e=qe(t);return this.each(function(n){Ze(this).wrapAll(e?t.call(this,n):t)})},unwrap:function(t){return this.parent(t).not("body").each(function(){Ze(this).replaceWith(this.childNodes)}),this}}),Ze.expr.pseudos.hidden=function(t){return!Ze.expr.pseudos.visible(t)},Ze.expr.pseudos.visible=function(t){return!!(t.offsetWidth||t.offsetHeight||t.getClientRects().length)},Ze.ajaxSettings.xhr=function(){try{return new t.XMLHttpRequest}catch(t){}},Se={0:200,1223:204},Te=Ze.ajaxSettings.xhr(),He.cors=!!Te&&"withCredentials"in Te,He.ajax=Te=!!Te,Ze.ajaxTransport(function(e){var n,i;if(He.cors||Te&&!e.crossDomain)return{send:function(r,o){var a,s=e.xhr();if(s.open(e.type,e.url,e.async,e.username,e.password),e.xhrFields)for(a in e.xhrFields)s[a]=e.xhrFields[a];for(a in e.mimeType&&s.overrideMimeType&&s.overrideMimeType(e.mimeType),e.crossDomain||r["X-Requested-With"]||(r["X-Requested-With"]="XMLHttpRequest"),r)s.setRequestHeader(a,r[a]);n=function(t){return function(){n&&(n=i=s.onload=s.onerror=s.onabort=s.ontimeout=s.onreadystatechange=null,"abort"===t?s.abort():"error"===t?"number"!=typeof s.status?o(0,"error"):o(s.status,s.statusText):o(Se[s.status]||s.status,s.statusText,"text"!==(s.responseType||"text")||"string"!=typeof s.responseText?{binary:s.response}:{text:s.responseText},s.getAllResponseHeaders()))}},s.onload=n(),i=s.onerror=s.ontimeout=n("error"),void 0!==s.onabort?s.onabort=i:s.onreadystatechange=function(){4===s.readyState&&t.setTimeout(function(){n&&i()})},n=n("abort");try{s.send(e.hasContent&&e.data||null)}catch(t){if(n)throw t}},abort:function(){n&&n()}}}),Ze.ajaxPrefilter(function(t){t.crossDomain&&(t.contents.script=0)}),Ze.ajaxSetup({accepts:{script:"text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"},contents:{script:/\b(?:java|ecma)script\b/},converters:{"text script":function(t){return Ze.globalEval(t),t}}}),Ze.ajaxPrefilter("script",function(t){void 0===t.cache&&(t.cache=0),t.crossDomain&&(t.type="GET")}),Ze.ajaxTransport("script",function(t){var e,n;if(t.crossDomain||t.scriptAttrs)return{send:function(i,r){e=Ze("