-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbundle.js
More file actions
18 lines (18 loc) · 539 KB
/
bundle.js
File metadata and controls
18 lines (18 loc) · 539 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
!function t(e,i,n){function r(o,s){if(!i[o]){if(!e[o]){var c="function"==typeof require&&require;if(!s&&c)return c(o,!0);if(a)return a(o,!0);var h=new Error("Cannot find module '"+o+"'");throw h.code="MODULE_NOT_FOUND",h}var l=i[o]={exports:{}};e[o][0].call(l.exports,function(t){var i=e[o][1][t];return r(i||t)},l,l.exports,t,e,i,n)}return i[o].exports}for(var a="function"==typeof require&&require,o=0;o<n.length;o++)r(n[o]);return r}({1:[function(t,e,i){"use strict";var n=t("./lib/visual");document.addEventListener("mousemove",function(t){var e=t.pageX/window.innerWidth-.5,i=t.pageY/window.innerHeight-.5;i*=-1,(0,n.bouncerSling)(i),(0,n.bouncerSpread)(e)}),document.addEventListener("click",function(){(0,n.bouncerJump)(.1),(0,n.changePalette)()})},{"./lib/visual":5}],2:[function(t,e,i){"use strict";function n(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function r(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function a(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}var o=function(){function t(t,e){for(var i=0;i<e.length;i++){var n=e[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}return function(e,i,n){return i&&t(e.prototype,i),n&&t(e,n),e}}(),s=t("three"),c=function(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e.default=t,e}(s),h=t("./bouncerSim"),l=function(t){function e(t,i,a,o,s,l){n(this,e);var u=r(this,(e.__proto__||Object.getPrototypeOf(e)).call(this));u.sim=new h(t,i,a,o,s),u.segments=[];for(var p=0;p<o;p+=1)u.segments[p]=new c.Mesh(new c.SphereGeometry(1,1,1),new c.MeshBasicMaterial({color:l[p%l.length]})),u.segments[p].scale.setScalar(.1),u.add(u.segments[p]);return u}return a(e,t),o(e,[{key:"update",value:function(t){this.sim.update(t);for(var e=0;e<this.segments.length;e+=1)this.segments[e].position.set(this.sim.vertices[e].position[0],this.sim.vertices[e].position[1],this.sim.vertices[e].position[2])}},{key:"jump",value:function(t){this.sim.jump(t)}},{key:"moveHead",value:function(t){var e=t.x,i=t.y,n=t.z,r=this.getHeadPos();void 0!==e&&(r[0]=e),void 0!==i&&(r[1]=i),void 0!==n&&(r[2]=n),this.sim.move(r,0)}},{key:"getHeadPos",value:function(){return this.sim.vertices[0].position}},{key:"changePalette",value:function(t){for(var e=0;e<this.segments.length;e+=1){this.segments[e].material.color.set(t[e%t.length])}}}]),e}(c.Group);e.exports=l},{"./bouncerSim":3,three:35}],3:[function(t,e,i){"use strict";function n(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function r(t,e){for(var i=[],n=0;n<t.length-1;n++)i.push([t[n],t[n+1]]);return i.map(function(t){return s(t,{restingDistance:e,stiffness:.5})})}var a=function(){function t(t,e){for(var i=0;i<e.length;i++){var n=e[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}return function(e,i,n){return i&&t(e.prototype,i),n&&t(e,n),e}}(),o=t("verlet-point/3d"),s=t("verlet-constraint/3d"),c=function(){function t(e,i,a,s,c){n(this,t),this.position=[e,i,a],this.vertices=[];for(var h=0;h<s;h+=1){var l=o({position:[e,i-.5*c*h,a],mass:.5});this.vertices.push(l)}this.vertices[0].mass=0,this.vertices[this.vertices.length-1].mass=5,this.constraints=r(this.vertices,c)}return a(t,[{key:"update",value:function(t){this.constraints.forEach(function(t){t.solve()})}},{key:"jump",value:function(t){this.vertices[this.vertices.length-1].addForce([0,t,0])}},{key:"move",value:function(t,e){this.vertices[e].place(t)}}]),t}();e.exports=c},{"verlet-constraint/3d":36,"verlet-point/3d":38}],4:[function(t,e,i){"use strict";function n(){var t=void 0,e=Number(localStorage.getItem("lastPaletteIndex"));return null===e?t=Math.floor(Math.random()*r.length):(t=e+1)>=r.length&&(t=0),localStorage.setItem("lastPaletteIndex",t),r[t]}Object.defineProperty(i,"__esModule",{value:!0});var r=[{background:8082571,bouncer:[15554370,16369152,12242739,96429,16777215]},{background:0,bouncer:[16776960,16711935,65535]},{background:4808311,bouncer:[14572083,45268,14609392]},{background:9069192,bouncer:[16246591,10608563,15367630]},{background:1909548,bouncer:[14176451,6030008,9043778]},{background:12119269,bouncer:[15596021,16420800,653561]},{background:16777215,bouncer:[16777215,13363307,1840141]},{background:16731728,bouncer:[15590772,16552250,14808516]},{background:15790827,bouncer:[16054994,16728642,14806457,13954654]}];i.default=n},{}],5:[function(t,e,i){"use strict";function n(){E.reset(),E.render(M.scene,M.camera),E.pass(S),E.pass(T),E.pass(A),E.toScreen()}function r(t){for(var e=0;e<L.length;e+=1)L[e].moveHead({y:t})}function a(t){for(var e=Math.sign(t),i=Math.sign(O),n=e!==i,r=0;r<L.length;r+=1){var a=L[r].getHeadPos(),o=(new l.Vector3).fromArray([a[0],0,a[2]]);o.normalize().multiplyScalar(Math.abs(t)),n&&o.multiplyScalar(-1),L[r].moveHead({x:o.x,z:o.z})}O=t}function o(t){for(var e=0;e<L.length;e+=1){var i=L[e].getHeadPos(),n=(new l.Vector3).fromArray(i);n.applyAxisAngle(_,t),L[e].moveHead({x:n.x,z:n.z})}}function s(){for(var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:.1,e=0;e<L.length;e+=1)L[e].jump(t)}function c(){var t=(0,p.default)();M.scene.background=new l.Color(t.background);for(var e=0;e<L.length;e+=1)L[e].changePalette(t.bouncer)}Object.defineProperty(i,"__esModule",{value:!0}),i.changePalette=i.bouncerRotate=i.bouncerSling=i.bouncerSpread=i.bouncerJump=i.app=void 0;var h=t("three"),l=function(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e.default=t,e}(h),u=t("./palette"),p=function(t){return t&&t.__esModule?t:{default:t}}(u),d=t("three-orbit-viewer")(l),f=t("verlet-system/3d"),m=t("@superguigui/wagner"),v=t("@superguigui/wagner/src/passes/noise/noise"),g=t("@superguigui/wagner/src/passes/rgbsplit/rgbsplit"),y=t("@superguigui/wagner/src/passes/vignette/VignettePass"),x=t("@superguigui/wagner/src/passes/zoom-blur/ZoomBlurPass"),b=t("./bouncer"),_=new l.Vector3(0,1,0),w=(0,p.default)(),M=d({clearColor:w.background,clearAlpha:1,fov:65,position:new l.Vector3(0,1,0)});M.camera.rotation.z=.5*Math.PI,M.renderer.autoClearColor=!0;var E=new m.Composer(M.renderer);E.setSize(window.innerWidth,window.innerHeight);for(var T=new v({amount:.2,speed:0}),S=new g({delta:{x:50,y:50}}),A=(new y({boost:1.2,reduction:.2}),new x({strength:.02})),L=[],R=0;R<13;R+=1){var P=new l.Vector3(.5,.5,0);P.applyAxisAngle(_,2*Math.PI/13*R);var C=new b(P.x,P.y,P.z,10,.01,w.bouncer);L.push(C),M.scene.add(C)}var I=new l.DirectionalLight(16777215,1);M.scene.add(I);var U=f({gravity:[0,-1,0]}),O=.5;M.on("tick",function(t){for(var e=0;e<L.length;e+=1)U.integrate(L[e].sim.vertices,t/1e3),L[e].update(t/1e3)}),M.on("render",function(t){n()}),i.app=M,i.bouncerJump=s,i.bouncerSpread=a,i.bouncerSling=r,i.bouncerRotate=o,i.changePalette=c},{"./bouncer":2,"./palette":4,"@superguigui/wagner":6,"@superguigui/wagner/src/passes/noise/noise":11,"@superguigui/wagner/src/passes/rgbsplit/rgbsplit":12,"@superguigui/wagner/src/passes/vignette/VignettePass":13,"@superguigui/wagner/src/passes/zoom-blur/ZoomBlurPass":14,three:35,"three-orbit-viewer":34,"verlet-system/3d":40}],6:[function(t,e,i){"use strict";e.exports.Composer=t("./src/Composer"),e.exports.CopyPass=t("./src/passes/copy/CopyPass"),e.exports.BlendMode={Normal:1,Dissolve:2,Darken:3,Multiply:4,ColorBurn:5,LinearBurn:6,DarkerColor:7,Lighten:8,Screen:9,ColorDodge:10,LinearDodge:11,LighterColor:12,Overlay:13,SoftLight:14,HardLight:15,VividLight:16,LinearLight:17,PinLight:18,HardMix:19,Difference:20,Exclusion:21,Substract:22,Divide:23}},{"./src/Composer":7,"./src/passes/copy/CopyPass":10}],7:[function(t,e,i){"use strict";function n(t,e){var i=t.getPixelRatio();this.width=Math.floor(t.context.canvas.width/i)||1,this.height=Math.floor(t.context.canvas.height/i)||1,this.output=null,this.input=null,this.read=null,this.write=null,this.settings=e||{},this.useRGBA=this.settings.useRGBA||!1,this.renderer=t,this.copyPass=new a(this.settings),this.defaultMaterial=new r.MeshBasicMaterial({color:65280,wireframe:!1}),this.scene=new r.Scene,this.quad=new r.Mesh(new r.PlaneBufferGeometry(1,1),this.defaultMaterial),this.scene.add(this.quad),this.camera=new r.OrthographicCamera(1,1,1,1,-1e4,1e4),this.front=new r.WebGLRenderTarget(1,1,{minFilter:void 0!==this.settings.minFilter?this.settings.minFilter:r.LinearFilter,magFilter:void 0!==this.settings.magFilter?this.settings.magFilter:r.LinearFilter,wrapS:void 0!==this.settings.wrapS?this.settings.wrapS:r.ClampToEdgeWrapping,wrapT:void 0!==this.settings.wrapT?this.settings.wrapT:r.ClampToEdgeWrapping,format:this.useRGBA?r.RGBAFormat:r.RGBFormat,type:void 0!==this.settings.type?this.settings.type:r.UnsignedByteType,stencilBuffer:void 0===this.settings.stencilBuffer||this.settings.stencilBuffer}),this.back=this.front.clone(),this.startTime=Date.now(),this.passes={},this.setSize(this.width,this.height)}var r=t("three"),a=t("./passes/copy/CopyPass"),o=t("./Stack"),s=t("./Pass");e.exports=n,n.prototype.swapBuffers=function(){this.output=this.write,this.input=this.read;var t=this.write;this.write=this.read,this.read=t},n.prototype.render=function(t,e,i,n){i&&this.swapBuffers(),this.renderer.render(t,e,n||this.write,!0),n||this.swapBuffers()},n.prototype.toScreen=function(t){this.quad.material=t?t.shader:this.copyPass.shader,this.quad.material.uniforms.tInput.value=this.read.texture,this.quad.material.uniforms.resolution.value.set(this.width,this.height),this.renderer.render(this.scene,this.camera)},n.prototype.toTexture=function(t,e){this.quad.material=e?e.shader:this.copyPass.shader,this.quad.material.uniforms.tInput.value=this.read.texture,this.renderer.render(this.scene,this.camera,t,!1)},n.prototype.pass=function(t){if(t instanceof o)this.passStack(t);else{if(t instanceof r.ShaderMaterial&&(this.quad.material=t),t instanceof s)return void t.run(this);t.isSim||(this.quad.material.uniforms.tInput.value=this.read.texture),this.quad.material.uniforms.resolution.value.set(this.width,this.height),this.quad.material.uniforms.time.value=.001*(Date.now()-this.startTime),this.renderer.render(this.scene,this.camera,this.write,!1),this.swapBuffers()}},n.prototype.passStack=function(t){t.getPasses().forEach(function(t){this.pass(t)}.bind(this))},n.prototype.reset=function(){this.read=this.front,this.write=this.back,this.output=this.write,this.input=this.read},n.prototype.setSource=function(t){this.quad.material=this.copyPass.shader,this.quad.material.uniforms.tInput.value=t,this.renderer.render(this.scene,this.camera,this.write,!0),this.swapBuffers()},n.prototype.setSize=function(t,e){this.width=t,this.height=e,this.camera.projectionMatrix.makeOrthographic(t/-2,t/2,e/2,e/-2,this.camera.near,this.camera.far),this.quad.scale.set(t,e,1),this.front.setSize(t,e),this.back.setSize(t,e)}},{"./Pass":8,"./Stack":9,"./passes/copy/CopyPass":10,three:35}],8:[function(t,e,i){"use strict";function n(){this.shader=null,this.loaded=null,this.params={},this.isSim=!1}var r=t("three"),a=t("./utils/processShader");e.exports=n,n.prototype.setShader=function(t,e){this.shader=a(t,e)},n.prototype.run=function(t){t.pass(this.shader)},n.prototype.getOfflineTexture=function(t,e,i){return new r.WebGLRenderTarget(t,e,{minFilter:r.LinearFilter,magFilter:r.LinearFilter,format:i?r.RGBAFormat:r.RGBFormat})}},{"./utils/processShader":15,three:35}],9:[function(t,e,i){"use strict";function n(t){this.passItems=[],this.shadersPool=t,this.passes=[]}e.exports=n,n.prototype.addPass=function(t,e,i,n){var r=0,a={shaderName:t,enabled:e||!1};return this.passItems.push(a),r=this.passItems.length,this.updatePasses(),n?this.movePassToIndex(this.passItems[r],n):r-1},n.prototype.removePass=function(t){this.passItems.splice(t,1),this.updatePasses()},n.prototype.enablePass=function(t){this.passItems[t].enabled=!0,this.updatePasses()},n.prototype.disablePass=function(t){this.passItems[t].enabled=!1,this.updatePasses()},n.prototype.isPassEnabled=function(t){return this.passItems[t].enabled},n.prototype.movePassToIndex=function(t,e){return this.passItems.splice(e,0,this.passItems.splice(t,1)[0]),this.updatePasses(),e},n.prototype.reverse=function(){this.passItems.reverse(),this.updatePasses()},n.prototype.updatePasses=function(){this.passes=this.shadersPool.getPasses(this.passItems),this.passItems.forEach(function(t,e){void 0===t.params&&(t.params=JSON.parse(JSON.stringify(this.passes[e].params)))}.bind(this))},n.prototype.getPasses=function(){return this.passes}},{}],10:[function(t,e,i){"use strict";function n(){r.call(this),this.setShader(a,o)}var r=t("../../Pass"),a="#define GLSLIFY 1\nvarying vec2 vUv;\n\nvoid main() {\n\n vUv = uv;\n gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n\n}",o="#define GLSLIFY 1\nvarying vec2 vUv;\nuniform sampler2D tInput;\n\nvoid main() {\n gl_FragColor = texture2D( tInput, vUv );\n\n}";e.exports=n,n.prototype=Object.create(r.prototype),n.prototype.constructor=n},{"../../Pass":8}],11:[function(t,e,i){"use strict";function n(t){r.call(this),t=t||{},this.setShader(a,o),this.params.amount=t.amount||.1,this.params.speed=t.speed||0}var r=(t("three"),t("../../Pass")),a="#define GLSLIFY 1\nvarying vec2 vUv;\n\nvoid main() {\n\n vUv = uv;\n gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n\n}",o="#define GLSLIFY 1\nuniform sampler2D tInput;\nuniform float amount;\nuniform float speed;\nuniform float time;\nvarying vec2 vUv;\n\nfloat random(vec2 n, float offset ){\n\t//return fract(sin(dot(gl_FragCoord.xyz+seed,scale))*43758.5453);\n\treturn .5 - fract(sin(dot(n.xy + vec2( offset, 0. ), vec2(12.9898, 78.233)))* 43758.5453);\n}\n\nvoid main() {\n\n\tvec4 color = texture2D(tInput, vUv);\n\n\t//color += amount * ( .5 - random( vec3( 1. ), length( gl_FragCoord ) + speed * .01 * time ) );\n\tcolor += vec4( vec3( amount * random( vUv, .00001 * speed * time ) ), 1. );\n\n\tgl_FragColor = color;\n\n}";e.exports=n,n.prototype=Object.create(r.prototype),n.prototype.constructor=n,n.prototype.run=function(t){this.shader.uniforms.amount.value=this.params.amount,this.shader.uniforms.speed.value=this.params.speed,t.pass(this.shader)}},{"../../Pass":8,three:35}],12:[function(t,e,i){"use strict";function n(t){a.call(this),this.setShader(o,s),this.params.delta=t.delta||new r.Vector2}var r=t("three"),a=t("../../Pass"),o="#define GLSLIFY 1\nvarying vec2 vUv;\n\nvoid main() {\n\n vUv = uv;\n gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n\n}",s="#define GLSLIFY 1\nvarying vec2 vUv;\nuniform sampler2D tInput;\nuniform vec2 delta;\nuniform vec2 resolution;\n\nvoid main() {\n\n vec2 dir = vUv - vec2( .5 );\n float d = .7 * length( dir );\n normalize( dir );\n vec2 value = d * dir * delta;\n\n vec4 c1 = texture2D( tInput, vUv - value / resolution.x );\n vec4 c2 = texture2D( tInput, vUv );\n vec4 c3 = texture2D( tInput, vUv + value / resolution.y );\n \n gl_FragColor = vec4( c1.r, c2.g, c3.b, c1.a + c2.a + c3.b );\n\n}";e.exports=n,n.prototype=Object.create(a.prototype),n.prototype.constructor=n,n.prototype.run=function(t){this.shader.uniforms.delta.value.copy(this.params.delta),t.pass(this.shader)}},{"../../Pass":8,three:35}],13:[function(t,e,i){"use strict";function n(t){r.call(this),t=t||{},this.setShader(a,o),this.params.boost=t.boost||1,this.params.reduction=t.reduction||1}var r=t("../../Pass"),a="#define GLSLIFY 1\nvarying vec2 vUv;\n\nvoid main() {\n\n vUv = uv;\n gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n\n}",o="#define GLSLIFY 1\nvarying vec2 vUv;\nuniform sampler2D tInput;\nuniform vec2 resolution;\n\nuniform float reduction;\nuniform float boost;\n\nvoid main() {\n\n vec4 color = texture2D( tInput, vUv );\n\n vec2 center = resolution * 0.5;\n float vignette = distance( center, gl_FragCoord.xy ) / resolution.x;\n vignette = boost - vignette * reduction;\n\n color.rgb *= vignette;\n gl_FragColor = color;\n\n}";e.exports=n,n.prototype=Object.create(r.prototype),n.prototype.constructor=n,n.prototype.run=function(t){this.shader.uniforms.boost.value=this.params.boost,this.shader.uniforms.reduction.value=this.params.reduction,t.pass(this.shader)}},{"../../Pass":8}],14:[function(t,e,i){"use strict";function n(t){a.call(this),t=t||{},this.setShader(o,s),this.params.center=new r.Vector2(t.centerX||.5,t.centerY||.5),this.params.strength=t.strength||.1}var r=t("three"),a=t("../../Pass"),o="#define GLSLIFY 1\nvarying vec2 vUv;\n\nvoid main() {\n\n vUv = uv;\n gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n\n}",s="#define GLSLIFY 1\nuniform sampler2D tInput;\nuniform vec2 center;\nuniform float strength;\nuniform vec2 resolution;\nvarying vec2 vUv;\n\nfloat random(vec3 scale,float seed){return fract(sin(dot(gl_FragCoord.xyz+seed,scale))*43758.5453+seed);}\n\nvoid main(){\n vec4 color=vec4(0.0);\n float total=0.0;\n vec2 toCenter=center-vUv*resolution;\n float offset=random(vec3(12.9898,78.233,151.7182),0.0);\n for(float t=0.0;t<=40.0;t++){\n float percent=(t+offset)/40.0;\n float weight=4.0*(percent-percent*percent);\n vec4 sample=texture2D(tInput,vUv+toCenter*percent*strength/resolution);\n sample.rgb*=sample.a;\n color+=sample*weight;\n total+=weight;\n }\n gl_FragColor=color/total;\n gl_FragColor.rgb/=gl_FragColor.a+0.00001;\n}";e.exports=n,n.prototype=Object.create(a.prototype),n.prototype.constructor=n,n.prototype.run=function(t){this.shader.uniforms.center.value.set(t.width*this.params.center.x,t.height*this.params.center.y),this.shader.uniforms.strength.value=this.params.strength,t.pass(this.shader)}},{"../../Pass":8,three:35}],15:[function(t,e,i){"use strict";var n=t("three");e.exports=function(t,e){for(var i,r,a,o=/uniform\s+(lowp|mediump|highp)?\s*([^\s]+)\s+([^\s]+)\s*;/gi,s=/uniform\s+([^\s]+)\s+([^\s]+)\s*\[\s*(\w+)\s*\]*\s*;/gi,c={sampler2D:{type:"t",value:function(){return new n.Texture}},samplerCube:{type:"t",value:function(){}},bool:{type:"b",value:function(){return 0}},int:{type:"i",value:function(){return 0}},float:{type:"f",value:function(){return 0}},vec2:{type:"v2",value:function(){return new n.Vector2}},vec3:{type:"v3",value:function(){return new n.Vector3}},vec4:{type:"v4",value:function(){return new n.Vector4}},bvec2:{type:"v2",value:function(){return new n.Vector2}},bvec3:{type:"v3",value:function(){return new n.Vector3}},bvec4:{type:"v4",value:function(){return new n.Vector4}},ivec2:{type:"v2",value:function(){return new n.Vector2}},ivec3:{type:"v3",value:function(){return new n.Vector3}},ivec4:{type:"v4",value:function(){return new n.Vector4}},mat2:{type:"v2",value:function(){return new n.Matrix2}},mat3:{type:"v3",value:function(){return new n.Matrix3}},mat4:{type:"v4",value:function(){return new n.Matrix4}}},h={float:{type:"fv",value:function(){return[]}},vec3:{type:"v3v",value:function(){return[]}}},l={resolution:{type:"v2",value:new n.Vector2(1,1),default:!0},time:{type:"f",value:Date.now(),default:!0},tInput:{type:"t",value:new n.Texture,default:!0}};null!==(i=o.exec(e));)i.index===o.lastIndex&&o.lastIndex++,r=i[2],a=i[3],l[a]={type:c[r].type,value:c[r].value()};for(;null!==(i=s.exec(e));)i.index===o.lastIndex&&o.lastIndex++,r=i[1],a=i[2],i[3],l[a]={type:h[r].type,value:h[r].value()};var u=new n.ShaderMaterial({uniforms:l,vertexShader:t,fragmentShader:e,depthWrite:!1,depthTest:!1,transparent:!0});return parseInt(n.REVISION)<87?u.shading=n.FlatShading:u.flatShading=!0,u}},{three:35}],16:[function(t,e,i){function n(t,e,i,n){return h=h||(document.addEventListener?{add:a,rm:o}:{add:s,rm:c}),h.add(t,e,i,n)}function r(t,e,i,n){return h=h||(document.addEventListener?{add:a,rm:o}:{add:s,rm:c}),h.rm(t,e,i,n)}function a(t,e,i,n){t.addEventListener(e,i,n)}function o(t,e,i,n){t.removeEventListener(e,i,n)}function s(t,e,i,n){if(n)throw new Error("cannot useCapture in oldIE");t.attachEvent("on"+e,i)}function c(t,e,i,n){t.detachEvent("on"+e,i)}n.removeEventListener=r,n.addEventListener=n,e.exports=n;var h=null},{}],17:[function(t,e,i){e.exports=function(t,e){return"number"==typeof t?t:"number"==typeof e?e:0}},{}],18:[function(t,e,i){function n(t){var e="undefined"!=typeof CanvasRenderingContext2D&&t instanceof CanvasRenderingContext2D;return t&&(e||a(t))}function r(t,e){if(!(this instanceof r))return new r(t,e);"object"==typeof t&&t&&(e=t,t=null),t="function"==typeof t?t:e.onRender,e=e||{},e.retina="boolean"!=typeof e.retina||e.retina;var i="number"==typeof e.width,h="number"==typeof e.height;(i||h)&&(e.ignoreResize=!0),e.width=i?e.width:window.innerWidth,e.height=h?e.height:window.innerHeight;var l,u,p=e.retina?window.devicePixelRatio||1:1,d=e.contextAttributes||{};if(this.isWebGL=!1,n(e.context)&&(u=e.context,l=u.canvas),l||(l=e.canvas||document.createElement("canvas")),l.width=e.width*p,l.height=e.height*p,!u)if("webgl"===e.context||"experimental-webgl"===e.context){if(!(u=o({canvas:l,attributes:d})))throw"WebGL Context Not Supported -- try enabling it or using a different browser"}else u=l.getContext(e.context||"2d",d);this.isWebGL=a(u),e.retina&&(l.style.width=e.width+"px",l.style.height=e.height+"px"),this.running=!1,this.width=e.width,this.height=e.height,this.canvas=l,this.context=u,this.onResize=e.onResize,this._DPR=p,this._retina=e.retina,this._once=e.once,this._ignoreResize=e.ignoreResize,this._lastFrame=null,this._then=Date.now(),this.maxDeltaTime="number"==typeof e.maxDeltaTime?e.maxDeltaTime:1e3/24,this.fps=60,this._frames=0,this._prevTime=this._then,this._ignoreResize||(e.resizeDebounce="number"==typeof e.resizeDebounce?e.resizeDebounce:50,c(window,"resize",s(function(){this.resize(window.innerWidth,window.innerHeight)}.bind(this),e.resizeDebounce,!1)),c(window,"orientationchange",function(){this.resize(window.innerWidth,window.innerHeight)}.bind(this))),this.onRender="function"==typeof t?t.bind(this):function(t,e,i,n){},this.renderOnce=function(){var t=Date.now(),e=Math.min(this.maxDeltaTime,t-this._then);this._frames++,t>this._prevTime+1e3&&(this.fps=Math.round(1e3*this._frames/(t-this._prevTime)),this._prevTime=t,this._frames=0),this.isWebGL?this.context.viewport(0,0,this.width*this._DPR,this.height*this._DPR):(this.context.save(),this.context.scale(this._DPR,this._DPR)),this.onRender(this.context,this.width,this.height,e),this.isWebGL||this.context.restore(),this._then=t},this._renderHandler=function(){this.running&&(this._once||(this._lastFrame=requestAnimationFrame(this._renderHandler)),this.renderOnce())}.bind(this),"function"==typeof e.onReady&&e.onReady.call(this,u,this.width,this.height)}var a=t("is-webgl-context"),o=t("webgl-context"),s=t("debounce"),c=t("add-event-listener");Object.defineProperty(r.prototype,"retinaEnabled",{set:function(t){this._retina=t,this._DPR=this._retina?window.devicePixelRatio||1:1,this.resize(this.width,this.height)},get:function(){return this._retina}}),Object.defineProperty(r.prototype,"deviceWidth",{get:function(){return this.width*this._DPR}}),Object.defineProperty(r.prototype,"deviceHeight",{get:function(){return this.height*this._DPR}}),r.prototype.resetFPS=function(){this._frames=0,this._prevTime=Date.now(),this._then=this._prevTime,this.fps=60},r.prototype.start=function(){this.running||(this._lastFrame&&cancelAnimationFrame(this._lastFrame),this.resetFPS(),this.running=!0,this._lastFrame=requestAnimationFrame(this._renderHandler))},r.prototype.stop=function(){this._lastFrame&&(cancelAnimationFrame(this._lastFrame),this._lastFrame=null),this.running=!1},r.prototype.resize=function(t,e){var i=this.canvas;this.width=t,this.height=e,i.width=this.width*this._DPR,i.height=this.height*this._DPR,this._retina&&(i.style.width=this.width+"px",i.style.height=this.height+"px"),this._once&&requestAnimationFrame(this._renderHandler),"function"==typeof this.onResize&&this.onResize(this.width,this.height)},e.exports=r},{"add-event-listener":16,debounce:20,"is-webgl-context":32,"webgl-context":43}],19:[function(t,e,i){function n(t,e,i){return e<i?t<e?e:t>i?i:t:t<i?i:t>e?e:t}e.exports=n},{}],20:[function(t,e,i){e.exports=function(t,e,i){function n(){var h=Date.now()-s;h<e&&h>=0?r=setTimeout(n,e-h):(r=null,i||(c=t.apply(o,a),o=a=null))}var r,a,o,s,c;null==e&&(e=100);var h=function(){o=this,a=arguments,s=Date.now();var h=i&&!r;return r||(r=setTimeout(n,e)),h&&(c=t.apply(o,a),o=a=null),c};return h.clear=function(){r&&(clearTimeout(r),r=null)},h.flush=function(){r&&(c=t.apply(o,a),o=a=null,clearTimeout(r),r=null)},h}},{}],21:[function(t,e,i){function n(){this._events=this._events||{},this._maxListeners=this._maxListeners||void 0}function r(t){return"function"==typeof t}function a(t){return"number"==typeof t}function o(t){return"object"==typeof t&&null!==t}function s(t){return void 0===t}e.exports=n,n.EventEmitter=n,n.prototype._events=void 0,n.prototype._maxListeners=void 0,n.defaultMaxListeners=10,n.prototype.setMaxListeners=function(t){if(!a(t)||t<0||isNaN(t))throw TypeError("n must be a positive number");return this._maxListeners=t,this},n.prototype.emit=function(t){var e,i,n,a,c,h;if(this._events||(this._events={}),"error"===t&&(!this._events.error||o(this._events.error)&&!this._events.error.length)){if((e=arguments[1])instanceof Error)throw e;var l=new Error('Uncaught, unspecified "error" event. ('+e+")");throw l.context=e,l}if(i=this._events[t],s(i))return!1;if(r(i))switch(arguments.length){case 1:i.call(this);break;case 2:i.call(this,arguments[1]);break;case 3:i.call(this,arguments[1],arguments[2]);break;default:a=Array.prototype.slice.call(arguments,1),i.apply(this,a)}else if(o(i))for(a=Array.prototype.slice.call(arguments,1),h=i.slice(),n=h.length,c=0;c<n;c++)h[c].apply(this,a);return!0},n.prototype.addListener=function(t,e){var i;if(!r(e))throw TypeError("listener must be a function");return this._events||(this._events={}),this._events.newListener&&this.emit("newListener",t,r(e.listener)?e.listener:e),this._events[t]?o(this._events[t])?this._events[t].push(e):this._events[t]=[this._events[t],e]:this._events[t]=e,o(this._events[t])&&!this._events[t].warned&&(i=s(this._maxListeners)?n.defaultMaxListeners:this._maxListeners)&&i>0&&this._events[t].length>i&&(this._events[t].warned=!0,console.error("(node) warning: possible EventEmitter memory leak detected. %d listeners added. Use emitter.setMaxListeners() to increase limit.",this._events[t].length),"function"==typeof console.trace&&console.trace()),this},n.prototype.on=n.prototype.addListener,n.prototype.once=function(t,e){function i(){this.removeListener(t,i),n||(n=!0,e.apply(this,arguments))}if(!r(e))throw TypeError("listener must be a function");var n=!1;return i.listener=e,this.on(t,i),this},n.prototype.removeListener=function(t,e){var i,n,a,s;if(!r(e))throw TypeError("listener must be a function");if(!this._events||!this._events[t])return this;if(i=this._events[t],a=i.length,n=-1,i===e||r(i.listener)&&i.listener===e)delete this._events[t],this._events.removeListener&&this.emit("removeListener",t,e);else if(o(i)){for(s=a;s-- >0;)if(i[s]===e||i[s].listener&&i[s].listener===e){n=s;break}if(n<0)return this;1===i.length?(i.length=0,delete this._events[t]):i.splice(n,1),this._events.removeListener&&this.emit("removeListener",t,e)}return this},n.prototype.removeAllListeners=function(t){var e,i;if(!this._events)return this;if(!this._events.removeListener)return 0===arguments.length?this._events={}:this._events[t]&&delete this._events[t],this;if(0===arguments.length){for(e in this._events)"removeListener"!==e&&this.removeAllListeners(e);return this.removeAllListeners("removeListener"),this._events={},this}if(i=this._events[t],r(i))this.removeListener(t,i);else if(i)for(;i.length;)this.removeListener(t,i[i.length-1]);return delete this._events[t],this},n.prototype.listeners=function(t){return this._events&&this._events[t]?r(this._events[t])?[this._events[t]]:this._events[t].slice():[]},n.prototype.listenerCount=function(t){if(this._events){var e=this._events[t];if(r(e))return 1;if(e)return e.length}return 0},n.listenerCount=function(t,e){return t.listenerCount(e)}},{}],22:[function(t,e,i){function n(t,e,i){return t[0]=e[0]+i[0],t[1]=e[1]+i[1],t[2]=e[2]+i[2],t}e.exports=n},{}],23:[function(t,e,i){function n(t,e){return t[0]=e[0],t[1]=e[1],t[2]=e[2],t}e.exports=n},{}],24:[function(t,e,i){function n(){var t=new Float32Array(3);return t[0]=0,t[1]=0,t[2]=0,t}e.exports=n},{}],25:[function(t,e,i){function n(t,e){var i=e[0]-t[0],n=e[1]-t[1],r=e[2]-t[2];return Math.sqrt(i*i+n*n+r*r)}e.exports=n},{}],26:[function(t,e,i){function n(t,e){return t[0]*e[0]+t[1]*e[1]+t[2]*e[2]}e.exports=n},{}],27:[function(t,e,i){function n(t,e,i){var n=new Float32Array(3);return n[0]=t,n[1]=e,n[2]=i,n}e.exports=n},{}],28:[function(t,e,i){function n(t,e,i){return t[0]=e[0]*i[0],t[1]=e[1]*i[1],t[2]=e[2]*i[2],t}e.exports=n},{}],29:[function(t,e,i){function n(t,e,i){return t[0]=e[0]*i,t[1]=e[1]*i,t[2]=e[2]*i,t}e.exports=n},{}],30:[function(t,e,i){function n(t){var e=t[0],i=t[1],n=t[2];return e*e+i*i+n*n}e.exports=n},{}],31:[function(t,e,i){function n(t,e,i){return t[0]=e[0]-i[0],t[1]=e[1]-i[1],t[2]=e[2]-i[2],t}e.exports=n},{}],32:[function(t,e,i){e.exports=function(t){if(!t)return!1;var e=t;return void 0!==t.rawgl&&(e=t.rawgl),"undefined"!=typeof WebGLRenderingContext&&e instanceof WebGLRenderingContext||"undefined"!=typeof WebGL2RenderingContext&&e instanceof WebGL2RenderingContext}},{}],33:[function(t,e,i){e.exports=function(t){function e(e,n){function r(){return 2*Math.PI/60/60*v.autoRotateSpeed}function a(){return Math.pow(.95,v.zoomSpeed)}function o(t){if(!1!==v.enabled){if(t.preventDefault(),t.button===v.mouseButtons.ORBIT){if(!0===v.noRotate)return;D=O.ROTATE,g.set(t.clientX,t.clientY)}else if(t.button===v.mouseButtons.ZOOM){if(!0===v.noZoom)return;D=O.DOLLY,T.set(t.clientX,t.clientY)}else if(t.button===v.mouseButtons.PAN){if(!0===v.noPan)return;D=O.PAN,b.set(t.clientX,t.clientY)}D!==O.NONE&&(document.addEventListener("mousemove",s,!1),document.addEventListener("mouseup",c,!1),v.dispatchEvent(z))}}function s(t){if(!1!==v.enabled){t.preventDefault();var e=v.domElement===document?v.domElement.body:v.domElement;if(D===O.ROTATE){if(!0===v.noRotate)return;y.set(t.clientX,t.clientY),x.subVectors(y,g),v.rotateLeft(2*Math.PI*x.x/e.clientWidth*v.rotateSpeed),v.rotateUp(2*Math.PI*x.y/e.clientHeight*v.rotateSpeed),g.copy(y)}else if(D===O.DOLLY){if(!0===v.noZoom)return;S.set(t.clientX,t.clientY),A.subVectors(S,T),A.y>0?v.dollyIn():v.dollyOut(),T.copy(S)}else if(D===O.PAN){if(!0===v.noPan)return;_.set(t.clientX,t.clientY),w.subVectors(_,b),v.pan(w.x,w.y),b.copy(_)}D!==O.NONE&&v.update()}}function c(){!1!==v.enabled&&(document.removeEventListener("mousemove",s,!1),document.removeEventListener("mouseup",c,!1),v.dispatchEvent(G),D=O.NONE)}function h(t){if(!1!==v.enabled&&!0!==v.noZoom&&D===O.NONE){t.preventDefault(),t.stopPropagation();var e=0;void 0!==t.wheelDelta?e=t.wheelDelta:void 0!==t.detail&&(e=-t.detail),e>0?v.dollyOut():v.dollyIn(),v.update(),v.dispatchEvent(z),v.dispatchEvent(G)}}function l(t){if(!1!==v.enabled&&!0!==v.noKeys&&!0!==v.noPan)switch(t.keyCode){case v.keys.UP:v.pan(0,v.keyPanSpeed),v.update();break;case v.keys.BOTTOM:v.pan(0,-v.keyPanSpeed),v.update();break;case v.keys.LEFT:v.pan(v.keyPanSpeed,0),v.update();break;case v.keys.RIGHT:v.pan(-v.keyPanSpeed,0),v.update()}}function u(t){if(!1!==v.enabled){switch(t.touches.length){case 1:if(!0===v.noRotate)return;D=O.TOUCH_ROTATE,g.set(t.touches[0].pageX,t.touches[0].pageY);break;case 2:if(!0===v.noZoom)return;D=O.TOUCH_DOLLY;var e=t.touches[0].pageX-t.touches[1].pageX,i=t.touches[0].pageY-t.touches[1].pageY,n=Math.sqrt(e*e+i*i);T.set(0,n);break;case 3:
if(!0===v.noPan)return;D=O.TOUCH_PAN,b.set(t.touches[0].pageX,t.touches[0].pageY);break;default:D=O.NONE}D!==O.NONE&&v.dispatchEvent(z)}}function p(t){if(!1!==v.enabled){t.preventDefault(),t.stopPropagation();var e=v.domElement===document?v.domElement.body:v.domElement;switch(t.touches.length){case 1:if(!0===v.noRotate)return;if(D!==O.TOUCH_ROTATE)return;y.set(t.touches[0].pageX,t.touches[0].pageY),x.subVectors(y,g),v.rotateLeft(2*Math.PI*x.x/e.clientWidth*v.rotateSpeed),v.rotateUp(2*Math.PI*x.y/e.clientHeight*v.rotateSpeed),g.copy(y),v.update();break;case 2:if(!0===v.noZoom)return;if(D!==O.TOUCH_DOLLY)return;var i=t.touches[0].pageX-t.touches[1].pageX,n=t.touches[0].pageY-t.touches[1].pageY,r=Math.sqrt(i*i+n*n);S.set(0,r),A.subVectors(S,T),A.y>0?v.dollyOut():v.dollyIn(),T.copy(S),v.update();break;case 3:if(!0===v.noPan)return;if(D!==O.TOUCH_PAN)return;_.set(t.touches[0].pageX,t.touches[0].pageY),w.subVectors(_,b),v.pan(w.x,w.y),b.copy(_),v.update();break;default:D=O.NONE}}}function d(){!1!==v.enabled&&(v.dispatchEvent(G),D=O.NONE)}this.object=e,this.domElement=void 0!==n?n:document,this.enabled=!0,this.target=new t.Vector3,this.center=this.target,this.noZoom=!1,this.zoomSpeed=1,this.minDistance=0,this.maxDistance=1/0,this.noRotate=!1,this.rotateSpeed=1,this.noPan=!1,this.keyPanSpeed=7,this.autoRotate=!1,this.autoRotateSpeed=2,this.minPolarAngle=0,this.maxPolarAngle=Math.PI,this.minAzimuthAngle=-1/0,this.maxAzimuthAngle=1/0,this.noKeys=!1,this.keys={LEFT:37,UP:38,RIGHT:39,BOTTOM:40},this.mouseButtons={ORBIT:i.LEFT,ZOOM:i.MIDDLE,PAN:i.RIGHT};var f,m,v=this,g=new t.Vector2,y=new t.Vector2,x=new t.Vector2,b=new t.Vector2,_=new t.Vector2,w=new t.Vector2,M=new t.Vector3,E=new t.Vector3,T=new t.Vector2,S=new t.Vector2,A=new t.Vector2,L=0,R=0,P=1,C=new t.Vector3,I=new t.Vector3,U=new t.Quaternion,O={NONE:-1,ROTATE:0,DOLLY:1,PAN:2,TOUCH_ROTATE:3,TOUCH_DOLLY:4,TOUCH_PAN:5},D=O.NONE;this.target0=this.target.clone(),this.position0=this.object.position.clone();var N=(new t.Quaternion).setFromUnitVectors(e.up,new t.Vector3(0,1,0)),F=N.clone().inverse(),B={type:"change"},z={type:"start"},G={type:"end"};this.rotateLeft=function(t){void 0===t&&(t=r()),R-=t},this.rotateUp=function(t){void 0===t&&(t=r()),L-=t},this.panLeft=function(t){var e=this.object.matrix.elements;M.set(e[0],e[1],e[2]),M.multiplyScalar(-t),C.add(M)},this.panUp=function(t){var e=this.object.matrix.elements;M.set(e[4],e[5],e[6]),M.multiplyScalar(t),C.add(M)},this.pan=function(t,e){var i=v.domElement===document?v.domElement.body:v.domElement;if(void 0!==v.object.fov){var n=v.object.position,r=n.clone().sub(v.target),a=r.length();a*=Math.tan(v.object.fov/2*Math.PI/180),v.panLeft(2*t*a/i.clientHeight),v.panUp(2*e*a/i.clientHeight)}else void 0!==v.object.top?(v.panLeft(t*(v.object.right-v.object.left)/i.clientWidth),v.panUp(e*(v.object.top-v.object.bottom)/i.clientHeight)):console.warn("WARNING: OrbitControls.js encountered an unknown camera type - pan disabled.")},this.dollyIn=function(t){void 0===t&&(t=a()),P/=t},this.dollyOut=function(t){void 0===t&&(t=a()),P*=t},this.update=function(){var t=this.object.position;E.copy(t).sub(this.target),E.applyQuaternion(N),f=Math.atan2(E.x,E.z),m=Math.atan2(Math.sqrt(E.x*E.x+E.z*E.z),E.y),this.autoRotate&&this.rotateLeft(r()),f+=R,m+=L,f=Math.max(this.minAzimuthAngle,Math.min(this.maxAzimuthAngle,f)),m=Math.max(this.minPolarAngle,Math.min(this.maxPolarAngle,m)),m=Math.max(1e-6,Math.min(Math.PI-1e-6,m));var e=E.length()*P;e=Math.max(this.minDistance,Math.min(this.maxDistance,e)),this.target.add(C),E.x=e*Math.sin(m)*Math.sin(f),E.y=e*Math.cos(m),E.z=e*Math.sin(m)*Math.cos(f),E.applyQuaternion(F),t.copy(this.target).add(E),this.object.lookAt(this.target),R=0,L=0,P=1,C.set(0,0,0),(I.distanceToSquared(this.object.position)>1e-6||8*(1-U.dot(this.object.quaternion))>1e-6)&&(this.dispatchEvent(B),I.copy(this.object.position),U.copy(this.object.quaternion))},this.reset=function(){D=O.NONE,this.target.copy(this.target0),this.object.position.copy(this.position0),this.update()},this.getPolarAngle=function(){return m},this.getAzimuthalAngle=function(){return f},this.domElement.addEventListener("contextmenu",function(t){t.preventDefault()},!1),this.domElement.addEventListener("mousedown",o,!1),this.domElement.addEventListener("mousewheel",h,!1),this.domElement.addEventListener("DOMMouseScroll",h,!1),this.domElement.addEventListener("touchstart",u,!1),this.domElement.addEventListener("touchend",d,!1),this.domElement.addEventListener("touchmove",p,!1),window.addEventListener("keydown",l,!1),this.update()}var i=t.MOUSE;return i||(i={LEFT:0,MIDDLE:1,RIGHT:2}),e.prototype=Object.create(t.EventDispatcher.prototype),e.prototype.constructor=e,e}},{}],34:[function(t,e,i){var n=t("canvas-app"),r=t("three-orbit-controls"),a=t("events/"),o=t("xtend"),s=t("as-number");e.exports=function(t){var e=r(t);return function(i){i=i||{};var r=new a,c=i.contextAttributes||{},h=function(t,e,i,n){r.emit("tick",n),r.renderer.render(r.scene,r.camera),r.emit("render",n)},l=function(t,e){r.renderer&&(r.renderer.setSize(t,e),r.camera.aspect=t/e,r.camera.updateProjectionMatrix(),r.emit("resize",t,e))},u=n(h,o(i,{context:"webgl",onResize:l}));return r.engine=u,document.body.appendChild(u.canvas),document.body.style.margin="0",document.body.style.overflow="hidden",function(n,a,h){r.renderer=new t.WebGLRenderer(o(c,{canvas:n.canvas}));var l=0;(i.clearColor||"number"==typeof i.clearColor)&&(l=i.clearColor);var u=i.clearAlpha||0;r.renderer.setClearColor(l,u);var p=s(i.fov,50),d=s(i.near,.1),f=s(i.far,1e3);r.scene=new t.Scene,r.camera=new t.PerspectiveCamera(p,a/h,d,f);var m=i.position||new t.Vector3(1,1,-2),v=i.target||new t.Vector3;r.camera.position.copy(m),r.camera.lookAt(v),r.controls=new e(r.camera,r.engine.canvas),r.controls.target.copy(v)}(u.context,u.width,u.height),"function"==typeof r.renderer.setPixelRatio?r.renderer.setPixelRatio(u._DPR):"number"==typeof r.renderer.devicePixelRatio&&(r.renderer.devicePixelRatio=u._DPR),r.renderer.setSize(u.width,u.height),u.start(),r}}},{"as-number":17,"canvas-app":18,"events/":21,"three-orbit-controls":33,xtend:44}],35:[function(t,e,i){!function(t,n){"object"==typeof i&&void 0!==e?n(i):"function"==typeof define&&define.amd?define(["exports"],n):n(t.THREE=t.THREE||{})}(this,function(t){"use strict";function e(){}function i(t,e){this.x=t||0,this.y=e||0}function n(t,e,r,a,o,s,c,h,l,u){Object.defineProperty(this,"id",{value:ls++}),this.uuid=hs.generateUUID(),this.name="",this.image=void 0!==t?t:n.DEFAULT_IMAGE,this.mipmaps=[],this.mapping=void 0!==e?e:n.DEFAULT_MAPPING,this.wrapS=void 0!==r?r:uo,this.wrapT=void 0!==a?a:uo,this.magFilter=void 0!==o?o:go,this.minFilter=void 0!==s?s:xo,this.anisotropy=void 0!==l?l:1,this.format=void 0!==c?c:Oo,this.type=void 0!==h?h:bo,this.offset=new i(0,0),this.repeat=new i(1,1),this.generateMipmaps=!0,this.premultiplyAlpha=!1,this.flipY=!0,this.unpackAlignment=4,this.encoding=void 0!==u?u:ts,this.version=0,this.onUpdate=null}function r(t,e,i,n){this.x=t||0,this.y=e||0,this.z=i||0,this.w=void 0!==n?n:1}function a(t,e,i){this.uuid=hs.generateUUID(),this.width=t,this.height=e,this.scissor=new r(0,0,t,e),this.scissorTest=!1,this.viewport=new r(0,0,t,e),i=i||{},void 0===i.minFilter&&(i.minFilter=go),this.texture=new n(void 0,void 0,i.wrapS,i.wrapT,i.magFilter,i.minFilter,i.format,i.type,i.anisotropy,i.encoding),this.depthBuffer=void 0===i.depthBuffer||i.depthBuffer,this.stencilBuffer=void 0===i.stencilBuffer||i.stencilBuffer,this.depthTexture=void 0!==i.depthTexture?i.depthTexture:null}function o(t,e,i){a.call(this,t,e,i),this.activeCubeFace=0,this.activeMipMapLevel=0}function s(t,e,i,n){this._x=t||0,this._y=e||0,this._z=i||0,this._w=void 0!==n?n:1}function c(t,e,i){this.x=t||0,this.y=e||0,this.z=i||0}function h(){this.elements=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],arguments.length>0&&console.error("THREE.Matrix4: the constructor no longer reads arguments. use .set() instead.")}function l(t,e,i,r,a,o,s,c,h,l,u,p){n.call(this,null,o,s,c,h,l,r,a,u,p),this.image={data:t,width:e,height:i},this.magFilter=void 0!==h?h:fo,this.minFilter=void 0!==l?l:fo,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}function u(t,e,i,r,a,o,s,c,h,l){t=void 0!==t?t:[],e=void 0!==e?e:no,n.call(this,t,e,i,r,a,o,s,c,h,l),this.flipY=!1}function p(){this.seq=[],this.map={}}function d(t,e,i){var n=t[0];if(n<=0||n>0)return t;var r=e*i,a=ds[r];if(void 0===a&&(a=new Float32Array(r),ds[r]=a),0!==e){n.toArray(a,0);for(var o=1,s=0;o!==e;++o)s+=i,t[o].toArray(a,s)}return a}function f(t,e){var i=fs[e];void 0===i&&(i=new Int32Array(e),fs[e]=i);for(var n=0;n!==e;++n)i[n]=t.allocTextureUnit();return i}function m(t,e){t.uniform1f(this.addr,e)}function v(t,e){t.uniform1i(this.addr,e)}function g(t,e){void 0===e.x?t.uniform2fv(this.addr,e):t.uniform2f(this.addr,e.x,e.y)}function y(t,e){void 0!==e.x?t.uniform3f(this.addr,e.x,e.y,e.z):void 0!==e.r?t.uniform3f(this.addr,e.r,e.g,e.b):t.uniform3fv(this.addr,e)}function x(t,e){void 0===e.x?t.uniform4fv(this.addr,e):t.uniform4f(this.addr,e.x,e.y,e.z,e.w)}function b(t,e){t.uniformMatrix2fv(this.addr,!1,e.elements||e)}function _(t,e){void 0===e.elements?t.uniformMatrix3fv(this.addr,!1,e):(vs.set(e.elements),t.uniformMatrix3fv(this.addr,!1,vs))}function w(t,e){void 0===e.elements?t.uniformMatrix4fv(this.addr,!1,e):(ms.set(e.elements),t.uniformMatrix4fv(this.addr,!1,ms))}function M(t,e,i){var n=i.allocTextureUnit();t.uniform1i(this.addr,n),i.setTexture2D(e||us,n)}function E(t,e,i){var n=i.allocTextureUnit();t.uniform1i(this.addr,n),i.setTextureCube(e||ps,n)}function T(t,e){t.uniform2iv(this.addr,e)}function S(t,e){t.uniform3iv(this.addr,e)}function A(t,e){t.uniform4iv(this.addr,e)}function L(t){switch(t){case 5126:return m;case 35664:return g;case 35665:return y;case 35666:return x;case 35674:return b;case 35675:return _;case 35676:return w;case 35678:return M;case 35680:return E;case 5124:case 35670:return v;case 35667:case 35671:return T;case 35668:case 35672:return S;case 35669:case 35673:return A}}function R(t,e){t.uniform1fv(this.addr,e)}function P(t,e){t.uniform1iv(this.addr,e)}function C(t,e){t.uniform2fv(this.addr,d(e,this.size,2))}function I(t,e){t.uniform3fv(this.addr,d(e,this.size,3))}function U(t,e){t.uniform4fv(this.addr,d(e,this.size,4))}function O(t,e){t.uniformMatrix2fv(this.addr,!1,d(e,this.size,4))}function D(t,e){t.uniformMatrix3fv(this.addr,!1,d(e,this.size,9))}function N(t,e){t.uniformMatrix4fv(this.addr,!1,d(e,this.size,16))}function F(t,e,i){var n=e.length,r=f(i,n);t.uniform1iv(this.addr,r);for(var a=0;a!==n;++a)i.setTexture2D(e[a]||us,r[a])}function B(t,e,i){var n=e.length,r=f(i,n);t.uniform1iv(this.addr,r);for(var a=0;a!==n;++a)i.setTextureCube(e[a]||ps,r[a])}function z(t){switch(t){case 5126:return R;case 35664:return C;case 35665:return I;case 35666:return U;case 35674:return O;case 35675:return D;case 35676:return N;case 35678:return F;case 35680:return B;case 5124:case 35670:return P;case 35667:case 35671:return T;case 35668:case 35672:return S;case 35669:case 35673:return A}}function G(t,e,i){this.id=t,this.addr=i,this.setValue=L(e.type)}function H(t,e,i){this.id=t,this.addr=i,this.size=e.size,this.setValue=z(e.type)}function V(t){this.id=t,p.call(this)}function k(t,e){t.seq.push(e),t.map[e.id]=e}function j(t,e,i){var n=t.name,r=n.length;for(gs.lastIndex=0;;){var a=gs.exec(n),o=gs.lastIndex,s=a[1],c="]"===a[2],h=a[3];if(c&&(s|=0),void 0===h||"["===h&&o+2===r){k(i,void 0===h?new G(s,t,e):new H(s,t,e));break}var l=i.map,u=l[s];void 0===u&&(u=new V(s),k(i,u)),i=u}}function W(t,e,i){p.call(this),this.renderer=i;for(var n=t.getProgramParameter(e,t.ACTIVE_UNIFORMS),r=0;r<n;++r){var a=t.getActiveUniform(e,r),o=a.name;j(a,t.getUniformLocation(e,o),this)}}function X(t,e,i){return void 0===e&&void 0===i?this.set(t):this.setRGB(t,e,i)}function q(t,e){this.min=void 0!==t?t:new i(1/0,1/0),this.max=void 0!==e?e:new i(-1/0,-1/0)}function Y(t,e){function n(){var t=new Float32Array([-1,-1,0,0,1,-1,1,0,1,1,1,1,-1,1,0,1]),e=new Uint16Array([0,1,2,0,2,3]);a=f.createBuffer(),o=f.createBuffer(),f.bindBuffer(f.ARRAY_BUFFER,a),f.bufferData(f.ARRAY_BUFFER,t,f.STATIC_DRAW),f.bindBuffer(f.ELEMENT_ARRAY_BUFFER,o),f.bufferData(f.ELEMENT_ARRAY_BUFFER,e,f.STATIC_DRAW),p=f.createTexture(),d=f.createTexture(),m.bindTexture(f.TEXTURE_2D,p),f.texImage2D(f.TEXTURE_2D,0,f.RGB,16,16,0,f.RGB,f.UNSIGNED_BYTE,null),f.texParameteri(f.TEXTURE_2D,f.TEXTURE_WRAP_S,f.CLAMP_TO_EDGE),f.texParameteri(f.TEXTURE_2D,f.TEXTURE_WRAP_T,f.CLAMP_TO_EDGE),f.texParameteri(f.TEXTURE_2D,f.TEXTURE_MAG_FILTER,f.NEAREST),f.texParameteri(f.TEXTURE_2D,f.TEXTURE_MIN_FILTER,f.NEAREST),m.bindTexture(f.TEXTURE_2D,d),f.texImage2D(f.TEXTURE_2D,0,f.RGBA,16,16,0,f.RGBA,f.UNSIGNED_BYTE,null),f.texParameteri(f.TEXTURE_2D,f.TEXTURE_WRAP_S,f.CLAMP_TO_EDGE),f.texParameteri(f.TEXTURE_2D,f.TEXTURE_WRAP_T,f.CLAMP_TO_EDGE),f.texParameteri(f.TEXTURE_2D,f.TEXTURE_MAG_FILTER,f.NEAREST),f.texParameteri(f.TEXTURE_2D,f.TEXTURE_MIN_FILTER,f.NEAREST),s={vertexShader:["uniform lowp int renderType;","uniform vec3 screenPosition;","uniform vec2 scale;","uniform float rotation;","uniform sampler2D occlusionMap;","attribute vec2 position;","attribute vec2 uv;","varying vec2 vUV;","varying float vVisibility;","void main() {","vUV = uv;","vec2 pos = position;","if ( renderType == 2 ) {","vec4 visibility = texture2D( occlusionMap, vec2( 0.1, 0.1 ) );","visibility += texture2D( occlusionMap, vec2( 0.5, 0.1 ) );","visibility += texture2D( occlusionMap, vec2( 0.9, 0.1 ) );","visibility += texture2D( occlusionMap, vec2( 0.9, 0.5 ) );","visibility += texture2D( occlusionMap, vec2( 0.9, 0.9 ) );","visibility += texture2D( occlusionMap, vec2( 0.5, 0.9 ) );","visibility += texture2D( occlusionMap, vec2( 0.1, 0.9 ) );","visibility += texture2D( occlusionMap, vec2( 0.1, 0.5 ) );","visibility += texture2D( occlusionMap, vec2( 0.5, 0.5 ) );","vVisibility = visibility.r / 9.0;","vVisibility *= 1.0 - visibility.g / 9.0;","vVisibility *= visibility.b / 9.0;","vVisibility *= 1.0 - visibility.a / 9.0;","pos.x = cos( rotation ) * position.x - sin( rotation ) * position.y;","pos.y = sin( rotation ) * position.x + cos( rotation ) * position.y;","}","gl_Position = vec4( ( pos * scale + screenPosition.xy ).xy, screenPosition.z, 1.0 );","}"].join("\n"),fragmentShader:["uniform lowp int renderType;","uniform sampler2D map;","uniform float opacity;","uniform vec3 color;","varying vec2 vUV;","varying float vVisibility;","void main() {","if ( renderType == 0 ) {","gl_FragColor = vec4( 1.0, 0.0, 1.0, 0.0 );","} else if ( renderType == 1 ) {","gl_FragColor = texture2D( map, vUV );","} else {","vec4 texture = texture2D( map, vUV );","texture.a *= opacity * vVisibility;","gl_FragColor = texture;","gl_FragColor.rgb *= color;","}","}"].join("\n")},h=r(s),l={vertex:f.getAttribLocation(h,"position"),uv:f.getAttribLocation(h,"uv")},u={renderType:f.getUniformLocation(h,"renderType"),map:f.getUniformLocation(h,"map"),occlusionMap:f.getUniformLocation(h,"occlusionMap"),opacity:f.getUniformLocation(h,"opacity"),color:f.getUniformLocation(h,"color"),scale:f.getUniformLocation(h,"scale"),rotation:f.getUniformLocation(h,"rotation"),screenPosition:f.getUniformLocation(h,"screenPosition")}}function r(e){var i=f.createProgram(),n=f.createShader(f.FRAGMENT_SHADER),r=f.createShader(f.VERTEX_SHADER),a="precision "+t.getPrecision()+" float;\n";return f.shaderSource(n,a+e.fragmentShader),f.shaderSource(r,a+e.vertexShader),f.compileShader(n),f.compileShader(r),f.attachShader(i,n),f.attachShader(i,r),f.linkProgram(i),i}var a,o,s,h,l,u,p,d,f=t.context,m=t.state;this.render=function(r,s,v){if(0!==e.length){var g=new c,y=v.w/v.z,x=.5*v.z,b=.5*v.w,_=16/v.w,w=new i(_*y,_),M=new c(1,1,0),E=new i(1,1),T=new q;T.min.set(v.x,v.y),T.max.set(v.x+(v.z-16),v.y+(v.w-16)),void 0===h&&n(),f.useProgram(h),m.initAttributes(),m.enableAttribute(l.vertex),m.enableAttribute(l.uv),m.disableUnusedAttributes(),f.uniform1i(u.occlusionMap,0),f.uniform1i(u.map,1),f.bindBuffer(f.ARRAY_BUFFER,a),f.vertexAttribPointer(l.vertex,2,f.FLOAT,!1,16,0),f.vertexAttribPointer(l.uv,2,f.FLOAT,!1,16,8),f.bindBuffer(f.ELEMENT_ARRAY_BUFFER,o),m.disable(f.CULL_FACE),m.buffers.depth.setMask(!1);for(var S=0,A=e.length;S<A;S++){_=16/v.w,w.set(_*y,_);var L=e[S];if(g.set(L.matrixWorld.elements[12],L.matrixWorld.elements[13],L.matrixWorld.elements[14]),g.applyMatrix4(s.matrixWorldInverse),g.applyMatrix4(s.projectionMatrix),M.copy(g),E.x=v.x+M.x*x+x-8,E.y=v.y+M.y*b+b-8,!0===T.containsPoint(E)){m.activeTexture(f.TEXTURE0),m.bindTexture(f.TEXTURE_2D,null),m.activeTexture(f.TEXTURE1),m.bindTexture(f.TEXTURE_2D,p),f.copyTexImage2D(f.TEXTURE_2D,0,f.RGB,E.x,E.y,16,16,0),f.uniform1i(u.renderType,0),f.uniform2f(u.scale,w.x,w.y),f.uniform3f(u.screenPosition,M.x,M.y,M.z),m.disable(f.BLEND),m.enable(f.DEPTH_TEST),f.drawElements(f.TRIANGLES,6,f.UNSIGNED_SHORT,0),m.activeTexture(f.TEXTURE0),m.bindTexture(f.TEXTURE_2D,d),f.copyTexImage2D(f.TEXTURE_2D,0,f.RGBA,E.x,E.y,16,16,0),f.uniform1i(u.renderType,1),m.disable(f.DEPTH_TEST),m.activeTexture(f.TEXTURE1),m.bindTexture(f.TEXTURE_2D,p),f.drawElements(f.TRIANGLES,6,f.UNSIGNED_SHORT,0),L.positionScreen.copy(M),L.customUpdateCallback?L.customUpdateCallback(L):L.updateLensFlares(),f.uniform1i(u.renderType,2),m.enable(f.BLEND);for(var R=0,P=L.lensFlares.length;R<P;R++){var C=L.lensFlares[R];C.opacity>.001&&C.scale>.001&&(M.x=C.x,M.y=C.y,M.z=C.z,_=C.size*C.scale/v.w,w.x=_*y,w.y=_,f.uniform3f(u.screenPosition,M.x,M.y,M.z),f.uniform2f(u.scale,w.x,w.y),f.uniform1f(u.rotation,C.rotation),f.uniform1f(u.opacity,C.opacity),f.uniform3f(u.color,C.color.r,C.color.g,C.color.b),m.setBlending(C.blending,C.blendEquation,C.blendSrc,C.blendDst),t.setTexture2D(C.texture,1),f.drawElements(f.TRIANGLES,6,f.UNSIGNED_SHORT,0))}}}m.enable(f.CULL_FACE),m.enable(f.DEPTH_TEST),m.buffers.depth.setMask(!0),t.resetGLState()}}}function Z(t,e){function i(){var t=new Float32Array([-.5,-.5,0,0,.5,-.5,1,0,.5,.5,1,1,-.5,.5,0,1]),e=new Uint16Array([0,1,2,0,2,3]);o=f.createBuffer(),h=f.createBuffer(),f.bindBuffer(f.ARRAY_BUFFER,o),f.bufferData(f.ARRAY_BUFFER,t,f.STATIC_DRAW),f.bindBuffer(f.ELEMENT_ARRAY_BUFFER,h),f.bufferData(f.ELEMENT_ARRAY_BUFFER,e,f.STATIC_DRAW),l=r(),u={position:f.getAttribLocation(l,"position"),uv:f.getAttribLocation(l,"uv")},p={uvOffset:f.getUniformLocation(l,"uvOffset"),uvScale:f.getUniformLocation(l,"uvScale"),rotation:f.getUniformLocation(l,"rotation"),scale:f.getUniformLocation(l,"scale"),color:f.getUniformLocation(l,"color"),map:f.getUniformLocation(l,"map"),opacity:f.getUniformLocation(l,"opacity"),modelViewMatrix:f.getUniformLocation(l,"modelViewMatrix"),projectionMatrix:f.getUniformLocation(l,"projectionMatrix"),fogType:f.getUniformLocation(l,"fogType"),fogDensity:f.getUniformLocation(l,"fogDensity"),fogNear:f.getUniformLocation(l,"fogNear"),fogFar:f.getUniformLocation(l,"fogFar"),fogColor:f.getUniformLocation(l,"fogColor"),alphaTest:f.getUniformLocation(l,"alphaTest")};var i=document.createElementNS("http://www.w3.org/1999/xhtml","canvas");i.width=8,i.height=8;var a=i.getContext("2d");a.fillStyle="white",a.fillRect(0,0,8,8),d=new n(i),d.needsUpdate=!0}function r(){var e=f.createProgram(),i=f.createShader(f.VERTEX_SHADER),n=f.createShader(f.FRAGMENT_SHADER);return f.shaderSource(i,["precision "+t.getPrecision()+" float;","uniform mat4 modelViewMatrix;","uniform mat4 projectionMatrix;","uniform float rotation;","uniform vec2 scale;","uniform vec2 uvOffset;","uniform vec2 uvScale;","attribute vec2 position;","attribute vec2 uv;","varying vec2 vUV;","void main() {","vUV = uvOffset + uv * uvScale;","vec2 alignedPosition = position * scale;","vec2 rotatedPosition;","rotatedPosition.x = cos( rotation ) * alignedPosition.x - sin( rotation ) * alignedPosition.y;","rotatedPosition.y = sin( rotation ) * alignedPosition.x + cos( rotation ) * alignedPosition.y;","vec4 finalPosition;","finalPosition = modelViewMatrix * vec4( 0.0, 0.0, 0.0, 1.0 );","finalPosition.xy += rotatedPosition;","finalPosition = projectionMatrix * finalPosition;","gl_Position = finalPosition;","}"].join("\n")),f.shaderSource(n,["precision "+t.getPrecision()+" float;","uniform vec3 color;","uniform sampler2D map;","uniform float opacity;","uniform int fogType;","uniform vec3 fogColor;","uniform float fogDensity;","uniform float fogNear;","uniform float fogFar;","uniform float alphaTest;","varying vec2 vUV;","void main() {","vec4 texture = texture2D( map, vUV );","if ( texture.a < alphaTest ) discard;","gl_FragColor = vec4( color * texture.xyz, texture.a * opacity );","if ( fogType > 0 ) {","float depth = gl_FragCoord.z / gl_FragCoord.w;","float fogFactor = 0.0;","if ( fogType == 1 ) {","fogFactor = smoothstep( fogNear, fogFar, depth );","} else {","const float LOG2 = 1.442695;","fogFactor = exp2( - fogDensity * fogDensity * depth * depth * LOG2 );","fogFactor = 1.0 - clamp( fogFactor, 0.0, 1.0 );","}","gl_FragColor = mix( gl_FragColor, vec4( fogColor, gl_FragColor.w ), fogFactor );","}","}"].join("\n")),f.compileShader(i),f.compileShader(n),f.attachShader(e,i),f.attachShader(e,n),f.linkProgram(e),e}function a(t,e){return t.renderOrder!==e.renderOrder?t.renderOrder-e.renderOrder:t.z!==e.z?e.z-t.z:e.id-t.id}var o,h,l,u,p,d,f=t.context,m=t.state,v=new c,g=new s,y=new c;this.render=function(n,r){if(0!==e.length){void 0===l&&i(),f.useProgram(l),m.initAttributes(),m.enableAttribute(u.position),m.enableAttribute(u.uv),m.disableUnusedAttributes(),m.disable(f.CULL_FACE),m.enable(f.BLEND),f.bindBuffer(f.ARRAY_BUFFER,o),f.vertexAttribPointer(u.position,2,f.FLOAT,!1,16,0),f.vertexAttribPointer(u.uv,2,f.FLOAT,!1,16,8),f.bindBuffer(f.ELEMENT_ARRAY_BUFFER,h),f.uniformMatrix4fv(p.projectionMatrix,!1,r.projectionMatrix.elements),m.activeTexture(f.TEXTURE0),f.uniform1i(p.map,0);var s=0,c=0,x=n.fog;x?(f.uniform3f(p.fogColor,x.color.r,x.color.g,x.color.b),x.isFog?(f.uniform1f(p.fogNear,x.near),f.uniform1f(p.fogFar,x.far),f.uniform1i(p.fogType,1),s=1,c=1):x.isFogExp2&&(f.uniform1f(p.fogDensity,x.density),f.uniform1i(p.fogType,2),s=2,c=2)):(f.uniform1i(p.fogType,0),s=0,c=0);for(var b=0,_=e.length;b<_;b++){var w=e[b];w.modelViewMatrix.multiplyMatrices(r.matrixWorldInverse,w.matrixWorld),w.z=-w.modelViewMatrix.elements[14]}e.sort(a);for(var M=[],b=0,_=e.length;b<_;b++){var w=e[b],E=w.material;if(!1!==E.visible){f.uniform1f(p.alphaTest,E.alphaTest),f.uniformMatrix4fv(p.modelViewMatrix,!1,w.modelViewMatrix.elements),w.matrixWorld.decompose(v,g,y),M[0]=y.x,M[1]=y.y;var T=0;n.fog&&E.fog&&(T=c),s!==T&&(f.uniform1i(p.fogType,T),s=T),null!==E.map?(f.uniform2f(p.uvOffset,E.map.offset.x,E.map.offset.y),f.uniform2f(p.uvScale,E.map.repeat.x,E.map.repeat.y)):(f.uniform2f(p.uvOffset,0,0),f.uniform2f(p.uvScale,1,1)),f.uniform1f(p.opacity,E.opacity),f.uniform3f(p.color,E.color.r,E.color.g,E.color.b),f.uniform1f(p.rotation,E.rotation),f.uniform2fv(p.scale,M),m.setBlending(E.blending,E.blendEquation,E.blendSrc,E.blendDst),m.buffers.depth.setTest(E.depthTest),m.buffers.depth.setMask(E.depthWrite),E.map?t.setTexture2D(E.map,0):t.setTexture2D(d,0),f.drawElements(f.TRIANGLES,6,f.UNSIGNED_SHORT,0)}}m.enable(f.CULL_FACE),t.resetGLState()}}}function J(){Object.defineProperty(this,"id",{value:Ms++}),this.uuid=hs.generateUUID(),this.name="",this.type="Material",this.fog=!0,this.lights=!0,this.blending=ba,this.side=ua,this.shading=ma,this.vertexColors=va,this.opacity=1,this.transparent=!1,this.blendSrc=Oa,this.blendDst=Da,this.blendEquation=Ta,this.blendSrcAlpha=null,this.blendDstAlpha=null,this.blendEquationAlpha=null,this.depthFunc=ja,this.depthTest=!0,this.depthWrite=!0,this.clippingPlanes=null,this.clipIntersection=!1,this.clipShadows=!1,this.colorWrite=!0,this.precision=null,this.polygonOffset=!1,this.polygonOffsetFactor=0,this.polygonOffsetUnits=0,this.dithering=!1,this.alphaTest=0,this.premultipliedAlpha=!1,this.overdraw=0,this.visible=!0,this.needsUpdate=!0}function Q(t){J.call(this),this.type="ShaderMaterial",this.defines={},this.uniforms={},this.vertexShader="void main() {\n\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",this.fragmentShader="void main() {\n\tgl_FragColor = vec4( 1.0, 0.0, 0.0, 1.0 );\n}",this.linewidth=1,this.wireframe=!1,this.wireframeLinewidth=1,this.fog=!1,this.lights=!1,this.clipping=!1,this.skinning=!1,this.morphTargets=!1,this.morphNormals=!1,this.extensions={derivatives:!1,fragDepth:!1,drawBuffers:!1,shaderTextureLOD:!1},this.defaultAttributeValues={color:[1,1,1],uv:[0,0],uv2:[0,0]},this.index0AttributeName=void 0,void 0!==t&&(void 0!==t.attributes&&console.error("THREE.ShaderMaterial: attributes should now be defined in THREE.BufferGeometry instead."),this.setValues(t))}function K(t){J.call(this),this.type="MeshDepthMaterial",this.depthPacking=ss,this.skinning=!1,this.morphTargets=!1,this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.wireframe=!1,this.wireframeLinewidth=1,this.fog=!1,this.lights=!1,this.setValues(t)}function $(t,e){this.min=void 0!==t?t:new c(1/0,1/0,1/0),this.max=void 0!==e?e:new c(-1/0,-1/0,-1/0)}function tt(t,e){this.center=void 0!==t?t:new c,this.radius=void 0!==e?e:0}function et(){this.elements=[1,0,0,0,1,0,0,0,1],arguments.length>0&&console.error("THREE.Matrix3: the constructor no longer reads arguments. use .set() instead.")}function it(t,e){this.normal=void 0!==t?t:new c(1,0,0),this.constant=void 0!==e?e:0}function nt(t,e,i,n,r,a){this.planes=[void 0!==t?t:new it,void 0!==e?e:new it,void 0!==i?i:new it,void 0!==n?n:new it,void 0!==r?r:new it,void 0!==a?a:new it]}function rt(t,e,n,o){function s(e,i,n,r){var a=e.geometry,o=null,s=M,c=e.customDepthMaterial;if(n&&(s=E,c=e.customDistanceMaterial),c)o=c;else{var h=!1;i.morphTargets&&(a&&a.isBufferGeometry?h=a.morphAttributes&&a.morphAttributes.position&&a.morphAttributes.position.length>0:a&&a.isGeometry&&(h=a.morphTargets&&a.morphTargets.length>0)),e.isSkinnedMesh&&!1===i.skinning&&console.warn("THREE.WebGLShadowMap: THREE.SkinnedMesh with material.skinning set to false:",e);var l=e.isSkinnedMesh&&i.skinning,u=0;h&&(u|=b),l&&(u|=_),o=s[u]}if(t.localClippingEnabled&&!0===i.clipShadows&&0!==i.clippingPlanes.length){var p=o.uuid,d=i.uuid,f=T[p];void 0===f&&(f={},T[p]=f);var m=f[d];void 0===m&&(m=o.clone(),f[d]=m),o=m}o.visible=i.visible,o.wireframe=i.wireframe;var v=i.side;return F.renderSingleSided&&v==da&&(v=ua),F.renderReverseSided&&(v===ua?v=pa:v===pa&&(v=ua)),o.side=v,o.clipShadows=i.clipShadows,o.clippingPlanes=i.clippingPlanes,o.wireframeLinewidth=i.wireframeLinewidth,o.linewidth=i.linewidth,n&&void 0!==o.uniforms.lightPos&&o.uniforms.lightPos.value.copy(r),o}function l(e,i,r,a){if(!1!==e.visible){if(e.layers.test(i.layers)&&(e.isMesh||e.isLine||e.isPoints)&&e.castShadow&&(!e.frustumCulled||d.intersectsObject(e))){e.modelViewMatrix.multiplyMatrices(r.matrixWorldInverse,e.matrixWorld);var o=n.update(e),c=e.material;if(Array.isArray(c))for(var h=o.groups,u=0,p=h.length;u<p;u++){var f=h[u],m=c[f.materialIndex];if(m&&m.visible){var v=s(e,m,a,x);t.renderBufferDirect(r,null,o,v,e,f)}}else if(c.visible){var v=s(e,c,a,x);t.renderBufferDirect(r,null,o,v,e,null)}}for(var g=e.children,y=0,b=g.length;y<b;y++)l(g[y],i,r,a)}}var u=t.context,p=t.state,d=new nt,f=new h,m=e.shadows,v=new i,g=new i(o.maxTextureSize,o.maxTextureSize),y=new c,x=new c,b=1,_=2,w=1+(b|_),M=new Array(w),E=new Array(w),T={},S=[new c(1,0,0),new c(-1,0,0),new c(0,0,1),new c(0,0,-1),new c(0,1,0),new c(0,-1,0)],A=[new c(0,1,0),new c(0,1,0),new c(0,1,0),new c(0,1,0),new c(0,0,1),new c(0,0,-1)],L=[new r,new r,new r,new r,new r,new r],R=new K;R.depthPacking=cs,R.clipping=!0;for(var P=ws.distanceRGBA,C=bs.clone(P.uniforms),I=0;I!==w;++I){var U=0!=(I&b),O=0!=(I&_),D=R.clone();D.morphTargets=U,D.skinning=O,M[I]=D;var N=new Q({defines:{USE_SHADOWMAP:""},uniforms:C,vertexShader:P.vertexShader,fragmentShader:P.fragmentShader,morphTargets:U,skinning:O,clipping:!0});E[I]=N}var F=this;this.enabled=!1,this.autoUpdate=!0,this.needsUpdate=!1,this.type=ha,this.renderReverseSided=!0,this.renderSingleSided=!0,this.render=function(e,i){if(!1!==F.enabled&&(!1!==F.autoUpdate||!1!==F.needsUpdate)&&0!==m.length){p.disable(u.BLEND),p.buffers.color.setClear(1,1,1,1),p.buffers.depth.setTest(!0),p.setScissorTest(!1);for(var n,r,o=0,s=m.length;o<s;o++){var c=m[o],h=c.shadow;if(void 0!==h){var b=h.camera,_=h.matrix;if(x.setFromMatrixPosition(c.matrixWorld),b.position.copy(x),v.copy(h.mapSize),v.min(g),c&&c.isPointLight){n=6,r=!0;var w=v.x,M=v.y;L[0].set(2*w,M,w,M),L[1].set(0,M,w,M),L[2].set(3*w,M,w,M),L[3].set(w,M,w,M),L[4].set(3*w,0,w,M),L[5].set(w,0,w,M),v.x*=4,v.y*=2,_.makeTranslation(-x.x,-x.y,-x.z)}else n=1,r=!1,y.setFromMatrixPosition(c.target.matrixWorld),b.lookAt(y),b.updateMatrixWorld(),b.matrixWorldInverse.getInverse(b.matrixWorld),_.set(.5,0,0,.5,0,.5,0,.5,0,0,.5,.5,0,0,0,1),_.multiply(b.projectionMatrix),_.multiply(b.matrixWorldInverse);if(null===h.map){var E={minFilter:fo,magFilter:fo,format:Oo};h.map=new a(v.x,v.y,E),h.map.texture.name=c.name+".shadowMap",b.updateProjectionMatrix()}h.isSpotLightShadow&&h.update(c);var T=h.map;t.setRenderTarget(T),t.clear();for(var R=0;R<n;R++){if(r){y.copy(b.position),y.add(S[R]),b.up.copy(A[R]),b.lookAt(y),b.updateMatrixWorld(),b.matrixWorldInverse.getInverse(b.matrixWorld);var P=L[R];p.viewport(P)}f.multiplyMatrices(b.projectionMatrix,b.matrixWorldInverse),d.setFromMatrix(f),l(e,i,b,r)}}else console.warn("THREE.WebGLShadowMap:",c,"has no shadow.")}var C=t.getClearColor(),I=t.getClearAlpha();t.setClearColor(C,I),F.needsUpdate=!1}}}function at(t,e){this.origin=void 0!==t?t:new c,this.direction=void 0!==e?e:new c}function ot(t,e,i,n){this._x=t||0,this._y=e||0,this._z=i||0,this._order=n||ot.DefaultOrder}function st(){this.mask=1}function ct(){function t(){r.setFromEuler(n,!1)}function e(){n.setFromQuaternion(r,void 0,!1)}Object.defineProperty(this,"id",{value:Es++}),this.uuid=hs.generateUUID(),this.name="",this.type="Object3D",this.parent=null,this.children=[],this.up=ct.DefaultUp.clone();var i=new c,n=new ot,r=new s,a=new c(1,1,1);n.onChange(t),r.onChange(e),Object.defineProperties(this,{position:{enumerable:!0,value:i},rotation:{enumerable:!0,value:n},quaternion:{enumerable:!0,value:r},scale:{enumerable:!0,value:a},modelViewMatrix:{value:new h},normalMatrix:{value:new et}}),this.matrix=new h,this.matrixWorld=new h,this.matrixAutoUpdate=ct.DefaultMatrixAutoUpdate,this.matrixWorldNeedsUpdate=!1,this.layers=new st,this.visible=!0,this.castShadow=!1,this.receiveShadow=!1,this.frustumCulled=!0,this.renderOrder=0,this.userData={},this.onBeforeRender=function(){},this.onAfterRender=function(){}}function ht(t,e){this.start=void 0!==t?t:new c,this.end=void 0!==e?e:new c}function lt(t,e,i){this.a=void 0!==t?t:new c,this.b=void 0!==e?e:new c,this.c=void 0!==i?i:new c}function ut(t,e,i,n,r,a){this.a=t,this.b=e,this.c=i,this.normal=n&&n.isVector3?n:new c,this.vertexNormals=Array.isArray(n)?n:[],this.color=r&&r.isColor?r:new X,this.vertexColors=Array.isArray(r)?r:[],this.materialIndex=void 0!==a?a:0}function pt(t){J.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=Za,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.skinning=!1,this.morphTargets=!1,this.lights=!1,this.setValues(t)}function dt(t,e,i){if(Array.isArray(t))throw new TypeError("THREE.BufferAttribute: array should be a Typed Array.");this.uuid=hs.generateUUID(),this.array=t,this.itemSize=e,this.count=void 0!==t?t.length/e:0,this.normalized=!0===i,this.dynamic=!1,this.updateRange={offset:0,count:-1},this.onUploadCallback=function(){},this.version=0}function ft(t,e){dt.call(this,new Int8Array(t),e)}function mt(t,e){dt.call(this,new Uint8Array(t),e)}function vt(t,e){dt.call(this,new Uint8ClampedArray(t),e)}function gt(t,e){dt.call(this,new Int16Array(t),e)}function yt(t,e){
dt.call(this,new Uint16Array(t),e)}function xt(t,e){dt.call(this,new Int32Array(t),e)}function bt(t,e){dt.call(this,new Uint32Array(t),e)}function _t(t,e){dt.call(this,new Float32Array(t),e)}function wt(t,e){dt.call(this,new Float64Array(t),e)}function Mt(){this.indices=[],this.vertices=[],this.normals=[],this.colors=[],this.uvs=[],this.uvs2=[],this.groups=[],this.morphTargets={},this.skinWeights=[],this.skinIndices=[],this.boundingBox=null,this.boundingSphere=null,this.verticesNeedUpdate=!1,this.normalsNeedUpdate=!1,this.colorsNeedUpdate=!1,this.uvsNeedUpdate=!1,this.groupsNeedUpdate=!1}function Et(t){if(0===t.length)return-1/0;for(var e=t[0],i=1,n=t.length;i<n;++i)t[i]>e&&(e=t[i]);return e}function Tt(){return Ts++}function St(){Object.defineProperty(this,"id",{value:Tt()}),this.uuid=hs.generateUUID(),this.name="",this.type="Geometry",this.vertices=[],this.colors=[],this.faces=[],this.faceVertexUvs=[[]],this.morphTargets=[],this.morphNormals=[],this.skinWeights=[],this.skinIndices=[],this.lineDistances=[],this.boundingBox=null,this.boundingSphere=null,this.elementsNeedUpdate=!1,this.verticesNeedUpdate=!1,this.uvsNeedUpdate=!1,this.normalsNeedUpdate=!1,this.colorsNeedUpdate=!1,this.lineDistancesNeedUpdate=!1,this.groupsNeedUpdate=!1}function At(){Object.defineProperty(this,"id",{value:Tt()}),this.uuid=hs.generateUUID(),this.name="",this.type="BufferGeometry",this.index=null,this.attributes={},this.morphAttributes={},this.groups=[],this.boundingBox=null,this.boundingSphere=null,this.drawRange={start:0,count:1/0}}function Lt(t,e){ct.call(this),this.type="Mesh",this.geometry=void 0!==t?t:new At,this.material=void 0!==e?e:new pt({color:16777215*Math.random()}),this.drawMode=Qo,this.updateMorphTargets()}function Rt(t,e,i,n,r,a){St.call(this),this.type="BoxGeometry",this.parameters={width:t,height:e,depth:i,widthSegments:n,heightSegments:r,depthSegments:a},this.fromBufferGeometry(new Pt(t,e,i,n,r,a)),this.mergeVertices()}function Pt(t,e,i,n,r,a){function o(t,e,i,n,r,a,o,m,v,g,y){var x,b,_=a/v,w=o/g,M=a/2,E=o/2,T=m/2,S=v+1,A=g+1,L=0,R=0,P=new c;for(b=0;b<A;b++){var C=b*w-E;for(x=0;x<S;x++){var I=x*_-M;P[t]=I*n,P[e]=C*r,P[i]=T,l.push(P.x,P.y,P.z),P[t]=0,P[e]=0,P[i]=m>0?1:-1,u.push(P.x,P.y,P.z),p.push(x/v),p.push(1-b/g),L+=1}}for(b=0;b<g;b++)for(x=0;x<v;x++){var U=d+x+S*b,O=d+x+S*(b+1),D=d+(x+1)+S*(b+1),N=d+(x+1)+S*b;h.push(U,O,N),h.push(O,D,N),R+=6}s.addGroup(f,R,y),f+=R,d+=L}At.call(this),this.type="BoxBufferGeometry",this.parameters={width:t,height:e,depth:i,widthSegments:n,heightSegments:r,depthSegments:a};var s=this;n=Math.floor(n)||1,r=Math.floor(r)||1,a=Math.floor(a)||1;var h=[],l=[],u=[],p=[],d=0,f=0;o("z","y","x",-1,-1,i,e,t,a,r,0),o("z","y","x",1,-1,i,e,-t,a,r,1),o("x","z","y",1,1,t,i,e,n,a,2),o("x","z","y",1,-1,t,i,-e,n,a,3),o("x","y","z",1,-1,t,e,i,n,r,4),o("x","y","z",-1,-1,t,e,-i,n,r,5),this.setIndex(h),this.addAttribute("position",new _t(l,3)),this.addAttribute("normal",new _t(u,3)),this.addAttribute("uv",new _t(p,2))}function Ct(t,e,i,n){St.call(this),this.type="PlaneGeometry",this.parameters={width:t,height:e,widthSegments:i,heightSegments:n},this.fromBufferGeometry(new It(t,e,i,n)),this.mergeVertices()}function It(t,e,i,n){At.call(this),this.type="PlaneBufferGeometry",this.parameters={width:t,height:e,widthSegments:i,heightSegments:n};var r,a,o=t/2,s=e/2,c=Math.floor(i)||1,h=Math.floor(n)||1,l=c+1,u=h+1,p=t/c,d=e/h,f=[],m=[],v=[],g=[];for(a=0;a<u;a++){var y=a*d-s;for(r=0;r<l;r++){var x=r*p-o;m.push(x,-y,0),v.push(0,0,1),g.push(r/c),g.push(1-a/h)}}for(a=0;a<h;a++)for(r=0;r<c;r++){var b=r+l*a,_=r+l*(a+1),w=r+1+l*(a+1),M=r+1+l*a;f.push(b,_,M),f.push(_,w,M)}this.setIndex(f),this.addAttribute("position",new _t(m,3)),this.addAttribute("normal",new _t(v,3)),this.addAttribute("uv",new _t(g,2))}function Ut(){ct.call(this),this.type="Camera",this.matrixWorldInverse=new h,this.projectionMatrix=new h}function Ot(t,e,i,n){Ut.call(this),this.type="PerspectiveCamera",this.fov=void 0!==t?t:50,this.zoom=1,this.near=void 0!==i?i:.1,this.far=void 0!==n?n:2e3,this.focus=10,this.aspect=void 0!==e?e:1,this.view=null,this.filmGauge=35,this.filmOffset=0,this.updateProjectionMatrix()}function Dt(t,e,i,n,r,a){Ut.call(this),this.type="OrthographicCamera",this.zoom=1,this.view=null,this.left=t,this.right=e,this.top=i,this.bottom=n,this.near=void 0!==r?r:.1,this.far=void 0!==a?a:2e3,this.updateProjectionMatrix()}function Nt(t){function e(e,i){var n=e.array,r=e.dynamic?t.DYNAMIC_DRAW:t.STATIC_DRAW,a=t.createBuffer();t.bindBuffer(i,a),t.bufferData(i,n,r),e.onUploadCallback();var o=t.FLOAT;return n instanceof Float32Array?o=t.FLOAT:n instanceof Float64Array?console.warn("Unsupported data buffer format: Float64Array"):n instanceof Uint16Array?o=t.UNSIGNED_SHORT:n instanceof Int16Array?o=t.SHORT:n instanceof Uint32Array?o=t.UNSIGNED_INT:n instanceof Int32Array?o=t.INT:n instanceof Int8Array?o=t.BYTE:n instanceof Uint8Array&&(o=t.UNSIGNED_BYTE),{buffer:a,type:o,bytesPerElement:n.BYTES_PER_ELEMENT,version:e.version}}function i(e,i,n){var r=i.array,a=i.updateRange;t.bindBuffer(n,e),!1===i.dynamic?t.bufferData(n,r,t.STATIC_DRAW):-1===a.count?t.bufferSubData(n,0,r):0===a.count?console.error("THREE.WebGLObjects.updateBuffer: dynamic THREE.BufferAttribute marked as needsUpdate but updateRange.count is 0, ensure you are using set methods or updating manually."):(t.bufferSubData(n,a.offset*r.BYTES_PER_ELEMENT,r.subarray(a.offset,a.offset+a.count)),a.count=0)}function n(t){return t.isInterleavedBufferAttribute&&(t=t.data),o[t.uuid]}function r(e){var i=o[e.uuid];i&&(t.deleteBuffer(i.buffer),delete o[e.uuid])}function a(t,n){t.isInterleavedBufferAttribute&&(t=t.data);var r=o[t.uuid];void 0===r?o[t.uuid]=e(t,n):r.version<t.version&&(i(r.buffer,t,n),r.version=t.version)}var o={};return{get:n,remove:r,update:a}}function Ft(t,e){return t.renderOrder!==e.renderOrder?t.renderOrder-e.renderOrder:t.program&&e.program&&t.program!==e.program?t.program.id-e.program.id:t.material.id!==e.material.id?t.material.id-e.material.id:t.z!==e.z?t.z-e.z:t.id-e.id}function Bt(t,e){return t.renderOrder!==e.renderOrder?t.renderOrder-e.renderOrder:t.z!==e.z?e.z-t.z:t.id-e.id}function zt(){function t(){a=-1,s=-1}function e(t,e,i,n,c){var h,l;i.transparent?(h=o,l=++s):(h=r,l=++a);var u=h[l];u?(u.id=t.id,u.object=t,u.geometry=e,u.material=i,u.program=i.program,u.renderOrder=t.renderOrder,u.z=n,u.group=c):(u={id:t.id,object:t,geometry:e,material:i,program:i.program,renderOrder:t.renderOrder,z:n,group:c},h.push(u))}function i(){r.length=a+1,o.length=s+1}function n(){r.sort(Ft),o.sort(Bt)}var r=[],a=-1,o=[],s=-1;return{opaque:r,transparent:o,init:t,push:e,finish:i,sort:n}}function Gt(){function t(t,e){var n=t.id+","+e.id,r=i[n];return void 0===r&&(r=new zt,i[n]=r),r}function e(){i={}}var i={};return{get:t,dispose:e}}function Ht(t,e,i){function n(t){s=t}function r(i){i.array instanceof Uint32Array&&e.get("OES_element_index_uint")?(c=t.UNSIGNED_INT,h=4):i.array instanceof Uint16Array?(c=t.UNSIGNED_SHORT,h=2):(c=t.UNSIGNED_BYTE,h=1)}function a(e,n){t.drawElements(s,n,c,e*h),i.calls++,i.vertices+=n,s===t.TRIANGLES&&(i.faces+=n/3)}function o(n,r,a){var o=e.get("ANGLE_instanced_arrays");if(null===o)return void console.error("THREE.WebGLIndexedBufferRenderer: using THREE.InstancedBufferGeometry but hardware does not support extension ANGLE_instanced_arrays.");o.drawElementsInstancedANGLE(s,a,c,r*h,n.maxInstancedCount),i.calls++,i.vertices+=a*n.maxInstancedCount,s===t.TRIANGLES&&(i.faces+=n.maxInstancedCount*a/3)}var s,c,h;this.setMode=n,this.setIndex=r,this.render=a,this.renderInstances=o}function Vt(t,e,i){function n(t){o=t}function r(e,n){t.drawArrays(o,e,n),i.calls++,i.vertices+=n,o===t.TRIANGLES&&(i.faces+=n/3)}function a(n,r,a){var s=e.get("ANGLE_instanced_arrays");if(null===s)return void console.error("THREE.WebGLBufferRenderer: using THREE.InstancedBufferGeometry but hardware does not support extension ANGLE_instanced_arrays.");var c=n.attributes.position;c.isInterleavedBufferAttribute?(a=c.data.count,s.drawArraysInstancedANGLE(o,0,a,n.maxInstancedCount)):s.drawArraysInstancedANGLE(o,r,a,n.maxInstancedCount),i.calls++,i.vertices+=a*n.maxInstancedCount,o===t.TRIANGLES&&(i.faces+=n.maxInstancedCount*a/3)}var o;this.setMode=n,this.render=r,this.renderInstances=a}function kt(t,e,i){function n(t){var r=t.target,a=s[r.id];null!==a.index&&e.remove(a.index);for(var o in a.attributes)e.remove(a.attributes[o]);r.removeEventListener("dispose",n),delete s[r.id];var h=c[r.id];h&&(e.remove(h),delete c[r.id]),h=c[a.id],h&&(e.remove(h),delete c[a.id]),i.geometries--}function r(t,e){var r=s[e.id];return r||(e.addEventListener("dispose",n),e.isBufferGeometry?r=e:e.isGeometry&&(void 0===e._bufferGeometry&&(e._bufferGeometry=(new At).setFromObject(t)),r=e._bufferGeometry),s[e.id]=r,i.geometries++,r)}function a(i){var n=i.index,r=i.attributes;null!==n&&e.update(n,t.ELEMENT_ARRAY_BUFFER);for(var a in r)e.update(r[a],t.ARRAY_BUFFER);var o=i.morphAttributes;for(var a in o)for(var s=o[a],c=0,h=s.length;c<h;c++)e.update(s[c],t.ARRAY_BUFFER)}function o(i){var n=c[i.id];if(n)return n;var r=[],a=i.index,o=i.attributes;if(null!==a)for(var s=a.array,h=0,l=s.length;h<l;h+=3){var u=s[h+0],p=s[h+1],d=s[h+2];r.push(u,p,p,d,d,u)}else for(var s=o.position.array,h=0,l=s.length/3-1;h<l;h+=3){var u=h+0,p=h+1,d=h+2;r.push(u,p,p,d,d,u)}return n=new(Et(r)>65535?bt:yt)(r,1),e.update(n,t.ELEMENT_ARRAY_BUFFER),c[i.id]=n,n}var s={},c={};return{get:r,update:a,getWireframeAttribute:o}}function jt(){var t={};return{get:function(e){if(void 0!==t[e.id])return t[e.id];var n;switch(e.type){case"DirectionalLight":n={direction:new c,color:new X,shadow:!1,shadowBias:0,shadowRadius:1,shadowMapSize:new i};break;case"SpotLight":n={position:new c,direction:new c,color:new X,distance:0,coneCos:0,penumbraCos:0,decay:0,shadow:!1,shadowBias:0,shadowRadius:1,shadowMapSize:new i};break;case"PointLight":n={position:new c,color:new X,distance:0,decay:0,shadow:!1,shadowBias:0,shadowRadius:1,shadowMapSize:new i};break;case"HemisphereLight":n={direction:new c,skyColor:new X,groundColor:new X};break;case"RectAreaLight":n={color:new X,position:new c,halfWidth:new c,halfHeight:new c}}return t[e.id]=n,n}}}function Wt(t,e,i){function n(t){var n=i.frame,r=t.geometry,o=e.get(t,r);return a[o.id]!==n&&(r.isGeometry&&o.updateFromObject(t),e.update(o),a[o.id]=n),o}function r(){a={}}var a={};return{update:n,clear:r}}function Xt(t){for(var e=t.split("\n"),i=0;i<e.length;i++)e[i]=i+1+": "+e[i];return e.join("\n")}function qt(t,e,i){var n=t.createShader(e);return t.shaderSource(n,i),t.compileShader(n),!1===t.getShaderParameter(n,t.COMPILE_STATUS)&&console.error("THREE.WebGLShader: Shader couldn't compile."),""!==t.getShaderInfoLog(n)&&console.warn("THREE.WebGLShader: gl.getShaderInfoLog()",e===t.VERTEX_SHADER?"vertex":"fragment",t.getShaderInfoLog(n),Xt(i)),n}function Yt(t){switch(t){case ts:return["Linear","( value )"];case es:return["sRGB","( value )"];case ns:return["RGBE","( value )"];case rs:return["RGBM","( value, 7.0 )"];case as:return["RGBM","( value, 16.0 )"];case os:return["RGBD","( value, 256.0 )"];case is:return["Gamma","( value, float( GAMMA_FACTOR ) )"];default:throw new Error("unsupported encoding: "+t)}}function Zt(t,e){var i=Yt(e);return"vec4 "+t+"( vec4 value ) { return "+i[0]+"ToLinear"+i[1]+"; }"}function Jt(t,e){var i=Yt(e);return"vec4 "+t+"( vec4 value ) { return LinearTo"+i[0]+i[1]+"; }"}function Qt(t,e){var i;switch(e){case $a:i="Linear";break;case to:i="Reinhard";break;case eo:i="Uncharted2";break;case io:i="OptimizedCineon";break;default:throw new Error("unsupported toneMapping: "+e)}return"vec3 "+t+"( vec3 color ) { return "+i+"ToneMapping( color ); }"}function Kt(t,e,i){return t=t||{},[t.derivatives||e.envMapCubeUV||e.bumpMap||e.normalMap||e.flatShading?"#extension GL_OES_standard_derivatives : enable":"",(t.fragDepth||e.logarithmicDepthBuffer)&&i.get("EXT_frag_depth")?"#extension GL_EXT_frag_depth : enable":"",t.drawBuffers&&i.get("WEBGL_draw_buffers")?"#extension GL_EXT_draw_buffers : require":"",(t.shaderTextureLOD||e.envMap)&&i.get("EXT_shader_texture_lod")?"#extension GL_EXT_shader_texture_lod : enable":""].filter(ee).join("\n")}function $t(t){var e=[];for(var i in t){var n=t[i];!1!==n&&e.push("#define "+i+" "+n)}return e.join("\n")}function te(t,e,i){for(var n={},r=t.getProgramParameter(e,t.ACTIVE_ATTRIBUTES),a=0;a<r;a++){var o=t.getActiveAttrib(e,a),s=o.name;n[s]=t.getAttribLocation(e,s)}return n}function ee(t){return""!==t}function ie(t,e){return t.replace(/NUM_DIR_LIGHTS/g,e.numDirLights).replace(/NUM_SPOT_LIGHTS/g,e.numSpotLights).replace(/NUM_RECT_AREA_LIGHTS/g,e.numRectAreaLights).replace(/NUM_POINT_LIGHTS/g,e.numPointLights).replace(/NUM_HEMI_LIGHTS/g,e.numHemiLights)}function ne(t){function e(t,e){var i=_s[e];if(void 0===i)throw new Error("Can not resolve #include <"+e+">");return ne(i)}var i=/^[ \t]*#include +<([\w\d.]+)>/gm;return t.replace(i,e)}function re(t){function e(t,e,i,n){for(var r="",a=parseInt(e);a<parseInt(i);a++)r+=n.replace(/\[ i \]/g,"[ "+a+" ]");return r}var i=/for \( int i \= (\d+)\; i < (\d+)\; i \+\+ \) \{([\s\S]+?)(?=\})\}/g;return t.replace(i,e)}function ae(t,e,i,n){var r=t.context,a=i.extensions,o=i.defines,s=i.__webglShader.vertexShader,c=i.__webglShader.fragmentShader,h="SHADOWMAP_TYPE_BASIC";n.shadowMapType===ha?h="SHADOWMAP_TYPE_PCF":n.shadowMapType===la&&(h="SHADOWMAP_TYPE_PCF_SOFT");var l="ENVMAP_TYPE_CUBE",u="ENVMAP_MODE_REFLECTION",p="ENVMAP_BLENDING_MULTIPLY";if(n.envMap){switch(i.envMap.mapping){case no:case ro:l="ENVMAP_TYPE_CUBE";break;case co:case ho:l="ENVMAP_TYPE_CUBE_UV";break;case ao:case oo:l="ENVMAP_TYPE_EQUIREC";break;case so:l="ENVMAP_TYPE_SPHERE"}switch(i.envMap.mapping){case ro:case oo:u="ENVMAP_MODE_REFRACTION"}switch(i.combine){case Za:p="ENVMAP_BLENDING_MULTIPLY";break;case Ja:p="ENVMAP_BLENDING_MIX";break;case Qa:p="ENVMAP_BLENDING_ADD"}}var d,f,m=t.gammaFactor>0?t.gammaFactor:1,v=Kt(a,n,t.extensions),g=$t(o),y=r.createProgram();i.isRawShaderMaterial?(d=[g,"\n"].filter(ee).join("\n"),f=[v,g,"\n"].filter(ee).join("\n")):(d=["precision "+n.precision+" float;","precision "+n.precision+" int;","#define SHADER_NAME "+i.__webglShader.name,g,n.supportsVertexTextures?"#define VERTEX_TEXTURES":"","#define GAMMA_FACTOR "+m,"#define MAX_BONES "+n.maxBones,n.useFog&&n.fog?"#define USE_FOG":"",n.useFog&&n.fogExp?"#define FOG_EXP2":"",n.map?"#define USE_MAP":"",n.envMap?"#define USE_ENVMAP":"",n.envMap?"#define "+u:"",n.lightMap?"#define USE_LIGHTMAP":"",n.aoMap?"#define USE_AOMAP":"",n.emissiveMap?"#define USE_EMISSIVEMAP":"",n.bumpMap?"#define USE_BUMPMAP":"",n.normalMap?"#define USE_NORMALMAP":"",n.displacementMap&&n.supportsVertexTextures?"#define USE_DISPLACEMENTMAP":"",n.specularMap?"#define USE_SPECULARMAP":"",n.roughnessMap?"#define USE_ROUGHNESSMAP":"",n.metalnessMap?"#define USE_METALNESSMAP":"",n.alphaMap?"#define USE_ALPHAMAP":"",n.vertexColors?"#define USE_COLOR":"",n.flatShading?"#define FLAT_SHADED":"",n.skinning?"#define USE_SKINNING":"",n.useVertexTexture?"#define BONE_TEXTURE":"",n.morphTargets?"#define USE_MORPHTARGETS":"",n.morphNormals&&!1===n.flatShading?"#define USE_MORPHNORMALS":"",n.doubleSided?"#define DOUBLE_SIDED":"",n.flipSided?"#define FLIP_SIDED":"","#define NUM_CLIPPING_PLANES "+n.numClippingPlanes,n.shadowMapEnabled?"#define USE_SHADOWMAP":"",n.shadowMapEnabled?"#define "+h:"",n.sizeAttenuation?"#define USE_SIZEATTENUATION":"",n.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",n.logarithmicDepthBuffer&&t.extensions.get("EXT_frag_depth")?"#define USE_LOGDEPTHBUF_EXT":"","uniform mat4 modelMatrix;","uniform mat4 modelViewMatrix;","uniform mat4 projectionMatrix;","uniform mat4 viewMatrix;","uniform mat3 normalMatrix;","uniform vec3 cameraPosition;","attribute vec3 position;","attribute vec3 normal;","attribute vec2 uv;","#ifdef USE_COLOR","\tattribute vec3 color;","#endif","#ifdef USE_MORPHTARGETS","\tattribute vec3 morphTarget0;","\tattribute vec3 morphTarget1;","\tattribute vec3 morphTarget2;","\tattribute vec3 morphTarget3;","\t#ifdef USE_MORPHNORMALS","\t\tattribute vec3 morphNormal0;","\t\tattribute vec3 morphNormal1;","\t\tattribute vec3 morphNormal2;","\t\tattribute vec3 morphNormal3;","\t#else","\t\tattribute vec3 morphTarget4;","\t\tattribute vec3 morphTarget5;","\t\tattribute vec3 morphTarget6;","\t\tattribute vec3 morphTarget7;","\t#endif","#endif","#ifdef USE_SKINNING","\tattribute vec4 skinIndex;","\tattribute vec4 skinWeight;","#endif","\n"].filter(ee).join("\n"),f=[v,"precision "+n.precision+" float;","precision "+n.precision+" int;","#define SHADER_NAME "+i.__webglShader.name,g,n.alphaTest?"#define ALPHATEST "+n.alphaTest:"","#define GAMMA_FACTOR "+m,n.useFog&&n.fog?"#define USE_FOG":"",n.useFog&&n.fogExp?"#define FOG_EXP2":"",n.map?"#define USE_MAP":"",n.envMap?"#define USE_ENVMAP":"",n.envMap?"#define "+l:"",n.envMap?"#define "+u:"",n.envMap?"#define "+p:"",n.lightMap?"#define USE_LIGHTMAP":"",n.aoMap?"#define USE_AOMAP":"",n.emissiveMap?"#define USE_EMISSIVEMAP":"",n.bumpMap?"#define USE_BUMPMAP":"",n.normalMap?"#define USE_NORMALMAP":"",n.specularMap?"#define USE_SPECULARMAP":"",n.roughnessMap?"#define USE_ROUGHNESSMAP":"",n.metalnessMap?"#define USE_METALNESSMAP":"",n.alphaMap?"#define USE_ALPHAMAP":"",n.vertexColors?"#define USE_COLOR":"",n.gradientMap?"#define USE_GRADIENTMAP":"",n.flatShading?"#define FLAT_SHADED":"",n.doubleSided?"#define DOUBLE_SIDED":"",n.flipSided?"#define FLIP_SIDED":"","#define NUM_CLIPPING_PLANES "+n.numClippingPlanes,"#define UNION_CLIPPING_PLANES "+(n.numClippingPlanes-n.numClipIntersection),n.shadowMapEnabled?"#define USE_SHADOWMAP":"",n.shadowMapEnabled?"#define "+h:"",n.premultipliedAlpha?"#define PREMULTIPLIED_ALPHA":"",n.physicallyCorrectLights?"#define PHYSICALLY_CORRECT_LIGHTS":"",n.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",n.logarithmicDepthBuffer&&t.extensions.get("EXT_frag_depth")?"#define USE_LOGDEPTHBUF_EXT":"",n.envMap&&t.extensions.get("EXT_shader_texture_lod")?"#define TEXTURE_LOD_EXT":"","uniform mat4 viewMatrix;","uniform vec3 cameraPosition;",n.toneMapping!==Ka?"#define TONE_MAPPING":"",n.toneMapping!==Ka?_s.tonemapping_pars_fragment:"",n.toneMapping!==Ka?Qt("toneMapping",n.toneMapping):"",n.dithering?"#define DITHERING":"",n.outputEncoding||n.mapEncoding||n.envMapEncoding||n.emissiveMapEncoding?_s.encodings_pars_fragment:"",n.mapEncoding?Zt("mapTexelToLinear",n.mapEncoding):"",n.envMapEncoding?Zt("envMapTexelToLinear",n.envMapEncoding):"",n.emissiveMapEncoding?Zt("emissiveMapTexelToLinear",n.emissiveMapEncoding):"",n.outputEncoding?Jt("linearToOutputTexel",n.outputEncoding):"",n.depthPacking?"#define DEPTH_PACKING "+i.depthPacking:"","\n"].filter(ee).join("\n")),s=ne(s,n),s=ie(s,n),c=ne(c,n),c=ie(c,n),i.isShaderMaterial||(s=re(s),c=re(c));var x=d+s,b=f+c,_=qt(r,r.VERTEX_SHADER,x),w=qt(r,r.FRAGMENT_SHADER,b);r.attachShader(y,_),r.attachShader(y,w),void 0!==i.index0AttributeName?r.bindAttribLocation(y,0,i.index0AttributeName):!0===n.morphTargets&&r.bindAttribLocation(y,0,"position"),r.linkProgram(y);var M=r.getProgramInfoLog(y),E=r.getShaderInfoLog(_),T=r.getShaderInfoLog(w),S=!0,A=!0;!1===r.getProgramParameter(y,r.LINK_STATUS)?(S=!1,console.error("THREE.WebGLProgram: shader error: ",r.getError(),"gl.VALIDATE_STATUS",r.getProgramParameter(y,r.VALIDATE_STATUS),"gl.getProgramInfoLog",M,E,T)):""!==M?console.warn("THREE.WebGLProgram: gl.getProgramInfoLog()",M):""!==E&&""!==T||(A=!1),A&&(this.diagnostics={runnable:S,material:i,programLog:M,vertexShader:{log:E,prefix:d},fragmentShader:{log:T,prefix:f}}),r.deleteShader(_),r.deleteShader(w);var L;this.getUniforms=function(){return void 0===L&&(L=new W(r,y,t)),L};var R;return this.getAttributes=function(){return void 0===R&&(R=te(r,y)),R},this.destroy=function(){r.deleteProgram(y),this.program=void 0},Object.defineProperties(this,{uniforms:{get:function(){return console.warn("THREE.WebGLProgram: .uniforms is now .getUniforms()."),this.getUniforms()}},attributes:{get:function(){return console.warn("THREE.WebGLProgram: .attributes is now .getAttributes()."),this.getAttributes()}}}),this.id=Ss++,this.code=e,this.usedTimes=1,this.program=y,this.vertexShader=_,this.fragmentShader=w,this}function oe(t,e){function i(t){var i=t.skeleton,n=i.bones;if(e.floatVertexTextures)return 1024;var r=e.maxVertexUniforms,a=Math.floor((r-20)/4),o=Math.min(a,n.length);return o<n.length?(console.warn("THREE.WebGLRenderer: Skeleton has "+n.length+" bones. This GPU supports "+o+"."),0):o}function n(t,e){var i;return t?t.isTexture?i=t.encoding:t.isWebGLRenderTarget&&(console.warn("THREE.WebGLPrograms.getTextureEncodingFromMap: don't use render targets as textures. Use their .texture property instead."),i=t.texture.encoding):i=ts,i===ts&&e&&(i=is),i}var r=[],a={MeshDepthMaterial:"depth",MeshNormalMaterial:"normal",MeshBasicMaterial:"basic",MeshLambertMaterial:"lambert",MeshPhongMaterial:"phong",MeshToonMaterial:"phong",MeshStandardMaterial:"physical",MeshPhysicalMaterial:"physical",LineBasicMaterial:"basic",LineDashedMaterial:"dashed",PointsMaterial:"points"},o=["precision","supportsVertexTextures","map","mapEncoding","envMap","envMapMode","envMapEncoding","lightMap","aoMap","emissiveMap","emissiveMapEncoding","bumpMap","normalMap","displacementMap","specularMap","roughnessMap","metalnessMap","gradientMap","alphaMap","combine","vertexColors","fog","useFog","fogExp","flatShading","sizeAttenuation","logarithmicDepthBuffer","skinning","maxBones","useVertexTexture","morphTargets","morphNormals","maxMorphTargets","maxMorphNormals","premultipliedAlpha","numDirLights","numPointLights","numSpotLights","numHemiLights","numRectAreaLights","shadowMapEnabled","shadowMapType","toneMapping","physicallyCorrectLights","alphaTest","doubleSided","flipSided","numClippingPlanes","numClipIntersection","depthPacking","dithering"];this.getParameters=function(r,o,s,c,h,l){var u=a[r.type],p=l.isSkinnedMesh?i(l):0,d=t.getPrecision();null!==r.precision&&(d=e.getMaxPrecision(r.precision))!==r.precision&&console.warn("THREE.WebGLProgram.getParameters:",r.precision,"not supported, using",d,"instead.");var f=t.getRenderTarget();return{shaderID:u,precision:d,supportsVertexTextures:e.vertexTextures,outputEncoding:n(f?f.texture:null,t.gammaOutput),map:!!r.map,mapEncoding:n(r.map,t.gammaInput),envMap:!!r.envMap,envMapMode:r.envMap&&r.envMap.mapping,envMapEncoding:n(r.envMap,t.gammaInput),envMapCubeUV:!!r.envMap&&(r.envMap.mapping===co||r.envMap.mapping===ho),lightMap:!!r.lightMap,aoMap:!!r.aoMap,emissiveMap:!!r.emissiveMap,emissiveMapEncoding:n(r.emissiveMap,t.gammaInput),bumpMap:!!r.bumpMap,normalMap:!!r.normalMap,displacementMap:!!r.displacementMap,roughnessMap:!!r.roughnessMap,metalnessMap:!!r.metalnessMap,specularMap:!!r.specularMap,alphaMap:!!r.alphaMap,gradientMap:!!r.gradientMap,combine:r.combine,vertexColors:r.vertexColors,fog:!!s,useFog:r.fog,fogExp:s&&s.isFogExp2,flatShading:r.shading===fa,sizeAttenuation:r.sizeAttenuation,logarithmicDepthBuffer:e.logarithmicDepthBuffer,skinning:r.skinning&&p>0,maxBones:p,useVertexTexture:e.floatVertexTextures,morphTargets:r.morphTargets,morphNormals:r.morphNormals,maxMorphTargets:t.maxMorphTargets,maxMorphNormals:t.maxMorphNormals,numDirLights:o.directional.length,numPointLights:o.point.length,numSpotLights:o.spot.length,numRectAreaLights:o.rectArea.length,numHemiLights:o.hemi.length,numClippingPlanes:c,numClipIntersection:h,dithering:r.dithering,shadowMapEnabled:t.shadowMap.enabled&&l.receiveShadow&&o.shadows.length>0,shadowMapType:t.shadowMap.type,toneMapping:t.toneMapping,physicallyCorrectLights:t.physicallyCorrectLights,premultipliedAlpha:r.premultipliedAlpha,alphaTest:r.alphaTest,doubleSided:r.side===da,flipSided:r.side===pa,depthPacking:void 0!==r.depthPacking&&r.depthPacking}},this.getProgramCode=function(t,e){var i=[];if(e.shaderID?i.push(e.shaderID):(i.push(t.fragmentShader),i.push(t.vertexShader)),void 0!==t.defines)for(var n in t.defines)i.push(n),i.push(t.defines[n]);for(var r=0;r<o.length;r++)i.push(e[o[r]]);return i.join()},this.acquireProgram=function(e,i,n){for(var a,o=0,s=r.length;o<s;o++){var c=r[o];if(c.code===n){a=c,++a.usedTimes;break}}return void 0===a&&(a=new ae(t,n,e,i),r.push(a)),a},this.releaseProgram=function(t){if(0==--t.usedTimes){var e=r.indexOf(t);r[e]=r[r.length-1],r.pop(),t.destroy()}},this.programs=r}function se(t,e,i,n,r,a,o){function s(t,e){if(t.width>e||t.height>e){var i=e/Math.max(t.width,t.height),n=document.createElementNS("http://www.w3.org/1999/xhtml","canvas");n.width=Math.floor(t.width*i),n.height=Math.floor(t.height*i);return n.getContext("2d").drawImage(t,0,0,t.width,t.height,0,0,n.width,n.height),console.warn("THREE.WebGLRenderer: image is too big ("+t.width+"x"+t.height+"). Resized to "+n.width+"x"+n.height,t),n}return t}function c(t){return hs.isPowerOfTwo(t.width)&&hs.isPowerOfTwo(t.height)}function h(t){if(t instanceof HTMLImageElement||t instanceof HTMLCanvasElement){var e=document.createElementNS("http://www.w3.org/1999/xhtml","canvas");e.width=hs.nearestPowerOfTwo(t.width),e.height=hs.nearestPowerOfTwo(t.height);return e.getContext("2d").drawImage(t,0,0,e.width,e.height),console.warn("THREE.WebGLRenderer: image is not power of two ("+t.width+"x"+t.height+"). Resized to "+e.width+"x"+e.height,t),e}return t}function l(t){return t.wrapS!==uo||t.wrapT!==uo||t.minFilter!==fo&&t.minFilter!==go}function u(e){return e===fo||e===mo||e===vo?t.NEAREST:t.LINEAR}function p(t){var e=t.target;e.removeEventListener("dispose",p),f(e),o.textures--}function d(t){var e=t.target;e.removeEventListener("dispose",d),m(e),o.textures--}function f(e){var i=n.get(e);if(e.image&&i.__image__webglTextureCube)t.deleteTexture(i.__image__webglTextureCube);else{if(void 0===i.__webglInit)return;t.deleteTexture(i.__webglTexture)}n.remove(e)}function m(e){var i=n.get(e),r=n.get(e.texture);if(e){if(void 0!==r.__webglTexture&&t.deleteTexture(r.__webglTexture),e.depthTexture&&e.depthTexture.dispose(),e.isWebGLRenderTargetCube)for(var a=0;a<6;a++)t.deleteFramebuffer(i.__webglFramebuffer[a]),i.__webglDepthbuffer&&t.deleteRenderbuffer(i.__webglDepthbuffer[a]);else t.deleteFramebuffer(i.__webglFramebuffer),i.__webglDepthbuffer&&t.deleteRenderbuffer(i.__webglDepthbuffer);n.remove(e.texture),n.remove(e)}}function v(e,r){var a=n.get(e);if(e.version>0&&a.__version!==e.version){var o=e.image;if(void 0===o)console.warn("THREE.WebGLRenderer: Texture marked for update but image is undefined",e);else{if(!1!==o.complete)return void b(a,e,r);console.warn("THREE.WebGLRenderer: Texture marked for update but image is incomplete",e)}}i.activeTexture(t.TEXTURE0+r),i.bindTexture(t.TEXTURE_2D,a.__webglTexture)}function g(e,h){var l=n.get(e);if(6===e.image.length)if(e.version>0&&l.__version!==e.version){l.__image__webglTextureCube||(e.addEventListener("dispose",p),l.__image__webglTextureCube=t.createTexture(),o.textures++),i.activeTexture(t.TEXTURE0+h),i.bindTexture(t.TEXTURE_CUBE_MAP,l.__image__webglTextureCube),t.pixelStorei(t.UNPACK_FLIP_Y_WEBGL,e.flipY);for(var u=e&&e.isCompressedTexture,d=e.image[0]&&e.image[0].isDataTexture,f=[],m=0;m<6;m++)f[m]=u||d?d?e.image[m].image:e.image[m]:s(e.image[m],r.maxCubemapSize);var v=f[0],g=c(v),y=a(e.format),b=a(e.type);x(t.TEXTURE_CUBE_MAP,e,g);for(var m=0;m<6;m++)if(u)for(var _,w=f[m].mipmaps,M=0,E=w.length;M<E;M++)_=w[M],e.format!==Oo&&e.format!==Uo?i.getCompressedTextureFormats().indexOf(y)>-1?i.compressedTexImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+m,M,y,_.width,_.height,0,_.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .setTextureCube()"):i.texImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+m,M,y,_.width,_.height,0,y,b,_.data);else d?i.texImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+m,0,y,f[m].width,f[m].height,0,y,b,f[m].data):i.texImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+m,0,y,y,b,f[m]);e.generateMipmaps&&g&&t.generateMipmap(t.TEXTURE_CUBE_MAP),l.__version=e.version,e.onUpdate&&e.onUpdate(e)}else i.activeTexture(t.TEXTURE0+h),i.bindTexture(t.TEXTURE_CUBE_MAP,l.__image__webglTextureCube)}function y(e,r){i.activeTexture(t.TEXTURE0+r),i.bindTexture(t.TEXTURE_CUBE_MAP,n.get(e).__webglTexture)}function x(i,o,s){var c;if(s?(t.texParameteri(i,t.TEXTURE_WRAP_S,a(o.wrapS)),t.texParameteri(i,t.TEXTURE_WRAP_T,a(o.wrapT)),t.texParameteri(i,t.TEXTURE_MAG_FILTER,a(o.magFilter)),t.texParameteri(i,t.TEXTURE_MIN_FILTER,a(o.minFilter))):(t.texParameteri(i,t.TEXTURE_WRAP_S,t.CLAMP_TO_EDGE),t.texParameteri(i,t.TEXTURE_WRAP_T,t.CLAMP_TO_EDGE),o.wrapS===uo&&o.wrapT===uo||console.warn("THREE.WebGLRenderer: Texture is not power of two. Texture.wrapS and Texture.wrapT should be set to THREE.ClampToEdgeWrapping.",o),t.texParameteri(i,t.TEXTURE_MAG_FILTER,u(o.magFilter)),t.texParameteri(i,t.TEXTURE_MIN_FILTER,u(o.minFilter)),o.minFilter!==fo&&o.minFilter!==go&&console.warn("THREE.WebGLRenderer: Texture is not power of two. Texture.minFilter should be set to THREE.NearestFilter or THREE.LinearFilter.",o)),c=e.get("EXT_texture_filter_anisotropic")){if(o.type===So&&null===e.get("OES_texture_float_linear"))return;if(o.type===Ao&&null===e.get("OES_texture_half_float_linear"))return;(o.anisotropy>1||n.get(o).__currentAnisotropy)&&(t.texParameterf(i,c.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(o.anisotropy,r.getMaxAnisotropy())),n.get(o).__currentAnisotropy=o.anisotropy)}}function b(e,n,u){void 0===e.__webglInit&&(e.__webglInit=!0,n.addEventListener("dispose",p),e.__webglTexture=t.createTexture(),o.textures++),i.activeTexture(t.TEXTURE0+u),i.bindTexture(t.TEXTURE_2D,e.__webglTexture),t.pixelStorei(t.UNPACK_FLIP_Y_WEBGL,n.flipY),t.pixelStorei(t.UNPACK_PREMULTIPLY_ALPHA_WEBGL,n.premultiplyAlpha),t.pixelStorei(t.UNPACK_ALIGNMENT,n.unpackAlignment);var d=s(n.image,r.maxTextureSize);l(n)&&!1===c(d)&&(d=h(d));var f=c(d),m=a(n.format),v=a(n.type);x(t.TEXTURE_2D,n,f);var g,y=n.mipmaps;if(n.isDepthTexture){var b=t.DEPTH_COMPONENT;if(n.type===So){if(!A)throw new Error("Float Depth Texture only supported in WebGL2.0");b=t.DEPTH_COMPONENT32F}else A&&(b=t.DEPTH_COMPONENT16);n.format===Bo&&b===t.DEPTH_COMPONENT&&n.type!==Mo&&n.type!==To&&(console.warn("THREE.WebGLRenderer: Use UnsignedShortType or UnsignedIntType for DepthFormat DepthTexture."),n.type=Mo,v=a(n.type)),n.format===zo&&(b=t.DEPTH_STENCIL,n.type!==Co&&(console.warn("THREE.WebGLRenderer: Use UnsignedInt248Type for DepthStencilFormat DepthTexture."),n.type=Co,v=a(n.type))),i.texImage2D(t.TEXTURE_2D,0,b,d.width,d.height,0,m,v,null)}else if(n.isDataTexture)if(y.length>0&&f){for(var _=0,w=y.length;_<w;_++)g=y[_],i.texImage2D(t.TEXTURE_2D,_,m,g.width,g.height,0,m,v,g.data);n.generateMipmaps=!1}else i.texImage2D(t.TEXTURE_2D,0,m,d.width,d.height,0,m,v,d.data);else if(n.isCompressedTexture)for(var _=0,w=y.length;_<w;_++)g=y[_],n.format!==Oo&&n.format!==Uo?i.getCompressedTextureFormats().indexOf(m)>-1?i.compressedTexImage2D(t.TEXTURE_2D,_,m,g.width,g.height,0,g.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()"):i.texImage2D(t.TEXTURE_2D,_,m,g.width,g.height,0,m,v,g.data);else if(y.length>0&&f){for(var _=0,w=y.length;_<w;_++)g=y[_],i.texImage2D(t.TEXTURE_2D,_,m,m,v,g);n.generateMipmaps=!1}else i.texImage2D(t.TEXTURE_2D,0,m,m,v,d);n.generateMipmaps&&f&&t.generateMipmap(t.TEXTURE_2D),e.__version=n.version,n.onUpdate&&n.onUpdate(n)}function _(e,r,o,s){var c=a(r.texture.format),h=a(r.texture.type);i.texImage2D(s,0,c,r.width,r.height,0,c,h,null),t.bindFramebuffer(t.FRAMEBUFFER,e),t.framebufferTexture2D(t.FRAMEBUFFER,o,s,n.get(r.texture).__webglTexture,0),t.bindFramebuffer(t.FRAMEBUFFER,null)}function w(e,i){t.bindRenderbuffer(t.RENDERBUFFER,e),i.depthBuffer&&!i.stencilBuffer?(t.renderbufferStorage(t.RENDERBUFFER,t.DEPTH_COMPONENT16,i.width,i.height),t.framebufferRenderbuffer(t.FRAMEBUFFER,t.DEPTH_ATTACHMENT,t.RENDERBUFFER,e)):i.depthBuffer&&i.stencilBuffer?(t.renderbufferStorage(t.RENDERBUFFER,t.DEPTH_STENCIL,i.width,i.height),t.framebufferRenderbuffer(t.FRAMEBUFFER,t.DEPTH_STENCIL_ATTACHMENT,t.RENDERBUFFER,e)):t.renderbufferStorage(t.RENDERBUFFER,t.RGBA4,i.width,i.height),
t.bindRenderbuffer(t.RENDERBUFFER,null)}function M(e,i){if(i&&i.isWebGLRenderTargetCube)throw new Error("Depth Texture with cube render targets is not supported!");if(t.bindFramebuffer(t.FRAMEBUFFER,e),!i.depthTexture||!i.depthTexture.isDepthTexture)throw new Error("renderTarget.depthTexture must be an instance of THREE.DepthTexture");n.get(i.depthTexture).__webglTexture&&i.depthTexture.image.width===i.width&&i.depthTexture.image.height===i.height||(i.depthTexture.image.width=i.width,i.depthTexture.image.height=i.height,i.depthTexture.needsUpdate=!0),v(i.depthTexture,0);var r=n.get(i.depthTexture).__webglTexture;if(i.depthTexture.format===Bo)t.framebufferTexture2D(t.FRAMEBUFFER,t.DEPTH_ATTACHMENT,t.TEXTURE_2D,r,0);else{if(i.depthTexture.format!==zo)throw new Error("Unknown depthTexture format");t.framebufferTexture2D(t.FRAMEBUFFER,t.DEPTH_STENCIL_ATTACHMENT,t.TEXTURE_2D,r,0)}}function E(e){var i=n.get(e),r=!0===e.isWebGLRenderTargetCube;if(e.depthTexture){if(r)throw new Error("target.depthTexture not supported in Cube render targets");M(i.__webglFramebuffer,e)}else if(r){i.__webglDepthbuffer=[];for(var a=0;a<6;a++)t.bindFramebuffer(t.FRAMEBUFFER,i.__webglFramebuffer[a]),i.__webglDepthbuffer[a]=t.createRenderbuffer(),w(i.__webglDepthbuffer[a],e)}else t.bindFramebuffer(t.FRAMEBUFFER,i.__webglFramebuffer),i.__webglDepthbuffer=t.createRenderbuffer(),w(i.__webglDepthbuffer,e);t.bindFramebuffer(t.FRAMEBUFFER,null)}function T(e){var r=n.get(e),a=n.get(e.texture);e.addEventListener("dispose",d),a.__webglTexture=t.createTexture(),o.textures++;var s=!0===e.isWebGLRenderTargetCube,h=c(e);if(s){r.__webglFramebuffer=[];for(var l=0;l<6;l++)r.__webglFramebuffer[l]=t.createFramebuffer()}else r.__webglFramebuffer=t.createFramebuffer();if(s){i.bindTexture(t.TEXTURE_CUBE_MAP,a.__webglTexture),x(t.TEXTURE_CUBE_MAP,e.texture,h);for(var l=0;l<6;l++)_(r.__webglFramebuffer[l],e,t.COLOR_ATTACHMENT0,t.TEXTURE_CUBE_MAP_POSITIVE_X+l);e.texture.generateMipmaps&&h&&t.generateMipmap(t.TEXTURE_CUBE_MAP),i.bindTexture(t.TEXTURE_CUBE_MAP,null)}else i.bindTexture(t.TEXTURE_2D,a.__webglTexture),x(t.TEXTURE_2D,e.texture,h),_(r.__webglFramebuffer,e,t.COLOR_ATTACHMENT0,t.TEXTURE_2D),e.texture.generateMipmaps&&h&&t.generateMipmap(t.TEXTURE_2D),i.bindTexture(t.TEXTURE_2D,null);e.depthBuffer&&E(e)}function S(e){var r=e.texture;if(r.generateMipmaps&&c(e)&&r.minFilter!==fo&&r.minFilter!==go){var a=e&&e.isWebGLRenderTargetCube?t.TEXTURE_CUBE_MAP:t.TEXTURE_2D,o=n.get(r).__webglTexture;i.bindTexture(a,o),t.generateMipmap(a),i.bindTexture(a,null)}}var A="undefined"!=typeof WebGL2RenderingContext&&t instanceof WebGL2RenderingContext;this.setTexture2D=v,this.setTextureCube=g,this.setTextureCubeDynamic=y,this.setupRenderTarget=T,this.updateRenderTargetMipmap=S}function ce(){function t(t){var e=t.uuid,i=n[e];return void 0===i&&(i={},n[e]=i),i}function e(t){delete n[t.uuid]}function i(){n={}}var n={};return{get:t,remove:e,clear:i}}function he(t,e,i){function n(){var e=!1,i=new r,n=null,a=new r;return{setMask:function(i){n===i||e||(t.colorMask(i,i,i,i),n=i)},setLocked:function(t){e=t},setClear:function(e,n,r,o,s){!0===s&&(e*=o,n*=o,r*=o),i.set(e,n,r,o),!1===a.equals(i)&&(t.clearColor(e,n,r,o),a.copy(i))},reset:function(){e=!1,n=null,a.set(0,0,0,1)}}}function a(){var e=!1,i=null,n=null,r=null;return{setTest:function(e){e?d(t.DEPTH_TEST):f(t.DEPTH_TEST)},setMask:function(n){i===n||e||(t.depthMask(n),i=n)},setFunc:function(e){if(n!==e){if(e)switch(e){case Ha:t.depthFunc(t.NEVER);break;case Va:t.depthFunc(t.ALWAYS);break;case ka:t.depthFunc(t.LESS);break;case ja:t.depthFunc(t.LEQUAL);break;case Wa:t.depthFunc(t.EQUAL);break;case Xa:t.depthFunc(t.GEQUAL);break;case qa:t.depthFunc(t.GREATER);break;case Ya:t.depthFunc(t.NOTEQUAL);break;default:t.depthFunc(t.LEQUAL)}else t.depthFunc(t.LEQUAL);n=e}},setLocked:function(t){e=t},setClear:function(e){r!==e&&(t.clearDepth(e),r=e)},reset:function(){e=!1,i=null,n=null,r=null}}}function o(){var e=!1,i=null,n=null,r=null,a=null,o=null,s=null,c=null,h=null;return{setTest:function(e){e?d(t.STENCIL_TEST):f(t.STENCIL_TEST)},setMask:function(n){i===n||e||(t.stencilMask(n),i=n)},setFunc:function(e,i,o){n===e&&r===i&&a===o||(t.stencilFunc(e,i,o),n=e,r=i,a=o)},setOp:function(e,i,n){o===e&&s===i&&c===n||(t.stencilOp(e,i,n),o=e,s=i,c=n)},setLocked:function(t){e=t},setClear:function(e){h!==e&&(t.clearStencil(e),h=e)},reset:function(){e=!1,i=null,n=null,r=null,a=null,o=null,s=null,c=null,h=null}}}function s(e,i,n){var r=new Uint8Array(4),a=t.createTexture();t.bindTexture(e,a),t.texParameteri(e,t.TEXTURE_MIN_FILTER,t.NEAREST),t.texParameteri(e,t.TEXTURE_MAG_FILTER,t.NEAREST);for(var o=0;o<n;o++)t.texImage2D(i+o,0,t.RGBA,1,1,0,t.RGBA,t.UNSIGNED_BYTE,r);return a}function c(){C.setClear(0,0,0,1),I.setClear(1),U.setClear(0),d(t.DEPTH_TEST),I.setFunc(ja),y(!1),x(oa),d(t.CULL_FACE),d(t.BLEND),v(ba)}function h(){for(var t=0,e=D.length;t<e;t++)D[t]=0}function l(i){if(D[i]=1,0===N[i]&&(t.enableVertexAttribArray(i),N[i]=1),0!==F[i]){e.get("ANGLE_instanced_arrays").vertexAttribDivisorANGLE(i,0),F[i]=0}}function u(i,n){if(D[i]=1,0===N[i]&&(t.enableVertexAttribArray(i),N[i]=1),F[i]!==n){e.get("ANGLE_instanced_arrays").vertexAttribDivisorANGLE(i,n),F[i]=n}}function p(){for(var e=0,i=N.length;e!==i;++e)N[e]!==D[e]&&(t.disableVertexAttribArray(e),N[e]=0)}function d(e){!0!==B[e]&&(t.enable(e),B[e]=!0)}function f(e){!1!==B[e]&&(t.disable(e),B[e]=!1)}function m(){if(null===z&&(z=[],e.get("WEBGL_compressed_texture_pvrtc")||e.get("WEBGL_compressed_texture_s3tc")||e.get("WEBGL_compressed_texture_etc1")))for(var i=t.getParameter(t.COMPRESSED_TEXTURE_FORMATS),n=0;n<i.length;n++)z.push(i[n]);return z}function v(e,n,r,a,o,s,c,h){e!==xa?d(t.BLEND):f(t.BLEND),e===G&&h===q||(e===_a?h?(t.blendEquationSeparate(t.FUNC_ADD,t.FUNC_ADD),t.blendFuncSeparate(t.ONE,t.ONE,t.ONE,t.ONE)):(t.blendEquation(t.FUNC_ADD),t.blendFunc(t.SRC_ALPHA,t.ONE)):e===wa?h?(t.blendEquationSeparate(t.FUNC_ADD,t.FUNC_ADD),t.blendFuncSeparate(t.ZERO,t.ZERO,t.ONE_MINUS_SRC_COLOR,t.ONE_MINUS_SRC_ALPHA)):(t.blendEquation(t.FUNC_ADD),t.blendFunc(t.ZERO,t.ONE_MINUS_SRC_COLOR)):e===Ma?h?(t.blendEquationSeparate(t.FUNC_ADD,t.FUNC_ADD),t.blendFuncSeparate(t.ZERO,t.SRC_COLOR,t.ZERO,t.SRC_ALPHA)):(t.blendEquation(t.FUNC_ADD),t.blendFunc(t.ZERO,t.SRC_COLOR)):h?(t.blendEquationSeparate(t.FUNC_ADD,t.FUNC_ADD),t.blendFuncSeparate(t.ONE,t.ONE_MINUS_SRC_ALPHA,t.ONE,t.ONE_MINUS_SRC_ALPHA)):(t.blendEquationSeparate(t.FUNC_ADD,t.FUNC_ADD),t.blendFuncSeparate(t.SRC_ALPHA,t.ONE_MINUS_SRC_ALPHA,t.ONE,t.ONE_MINUS_SRC_ALPHA)),G=e,q=h),e===Ea?(o=o||n,s=s||r,c=c||a,n===H&&o===j||(t.blendEquationSeparate(i(n),i(o)),H=n,j=o),r===V&&a===k&&s===W&&c===X||(t.blendFuncSeparate(i(r),i(a),i(s),i(c)),V=r,k=a,W=s,X=c)):(H=null,V=null,k=null,j=null,W=null,X=null)}function g(e){e.side===da?f(t.CULL_FACE):d(t.CULL_FACE),y(e.side===pa),!0===e.transparent?v(e.blending,e.blendEquation,e.blendSrc,e.blendDst,e.blendEquationAlpha,e.blendSrcAlpha,e.blendDstAlpha,e.premultipliedAlpha):v(xa),I.setFunc(e.depthFunc),I.setTest(e.depthTest),I.setMask(e.depthWrite),C.setMask(e.colorWrite),_(e.polygonOffset,e.polygonOffsetFactor,e.polygonOffsetUnits)}function y(e){Y!==e&&(e?t.frontFace(t.CW):t.frontFace(t.CCW),Y=e)}function x(e){e!==aa?(d(t.CULL_FACE),e!==Z&&(e===oa?t.cullFace(t.BACK):e===sa?t.cullFace(t.FRONT):t.cullFace(t.FRONT_AND_BACK))):f(t.CULL_FACE),Z=e}function b(e){e!==J&&(it&&t.lineWidth(e),J=e)}function _(e,i,n){e?(d(t.POLYGON_OFFSET_FILL),Q===i&&K===n||(t.polygonOffset(i,n),Q=i,K=n)):f(t.POLYGON_OFFSET_FILL)}function w(){return $}function M(e){$=e,e?d(t.SCISSOR_TEST):f(t.SCISSOR_TEST)}function E(e){void 0===e&&(e=t.TEXTURE0+tt-1),nt!==e&&(t.activeTexture(e),nt=e)}function T(e,i){null===nt&&E();var n=rt[nt];void 0===n&&(n={type:void 0,texture:void 0},rt[nt]=n),n.type===e&&n.texture===i||(t.bindTexture(e,i||st[e]),n.type=e,n.texture=i)}function S(){try{t.compressedTexImage2D.apply(t,arguments)}catch(t){console.error(t)}}function A(){try{t.texImage2D.apply(t,arguments)}catch(t){console.error(t)}}function L(e){!1===at.equals(e)&&(t.scissor(e.x,e.y,e.z,e.w),at.copy(e))}function R(e){!1===ot.equals(e)&&(t.viewport(e.x,e.y,e.z,e.w),ot.copy(e))}function P(){for(var e=0;e<N.length;e++)1===N[e]&&(t.disableVertexAttribArray(e),N[e]=0);B={},z=null,nt=null,rt={},G=null,Y=null,Z=null,C.reset(),I.reset(),U.reset()}var C=new n,I=new a,U=new o,O=t.getParameter(t.MAX_VERTEX_ATTRIBS),D=new Uint8Array(O),N=new Uint8Array(O),F=new Uint8Array(O),B={},z=null,G=null,H=null,V=null,k=null,j=null,W=null,X=null,q=!1,Y=null,Z=null,J=null,Q=null,K=null,$=null,tt=t.getParameter(t.MAX_TEXTURE_IMAGE_UNITS),et=parseFloat(/^WebGL\ ([0-9])/.exec(t.getParameter(t.VERSION))[1]),it=parseFloat(et)>=1,nt=null,rt={},at=new r,ot=new r,st={};return st[t.TEXTURE_2D]=s(t.TEXTURE_2D,t.TEXTURE_2D,1),st[t.TEXTURE_CUBE_MAP]=s(t.TEXTURE_CUBE_MAP,t.TEXTURE_CUBE_MAP_POSITIVE_X,6),{buffers:{color:C,depth:I,stencil:U},init:c,initAttributes:h,enableAttribute:l,enableAttributeAndDivisor:u,disableUnusedAttributes:p,enable:d,disable:f,getCompressedTextureFormats:m,setBlending:v,setMaterial:g,setFlipSided:y,setCullFace:x,setLineWidth:b,setPolygonOffset:_,getScissorTest:w,setScissorTest:M,activeTexture:E,bindTexture:T,compressedTexImage2D:S,texImage2D:A,scissor:L,viewport:R,reset:P}}function le(t,e,i){function n(){if(void 0!==a)return a;var i=e.get("EXT_texture_filter_anisotropic");return a=null!==i?t.getParameter(i.MAX_TEXTURE_MAX_ANISOTROPY_EXT):0}function r(e){if("highp"===e){if(t.getShaderPrecisionFormat(t.VERTEX_SHADER,t.HIGH_FLOAT).precision>0&&t.getShaderPrecisionFormat(t.FRAGMENT_SHADER,t.HIGH_FLOAT).precision>0)return"highp";e="mediump"}return"mediump"===e&&t.getShaderPrecisionFormat(t.VERTEX_SHADER,t.MEDIUM_FLOAT).precision>0&&t.getShaderPrecisionFormat(t.FRAGMENT_SHADER,t.MEDIUM_FLOAT).precision>0?"mediump":"lowp"}var a,o=void 0!==i.precision?i.precision:"highp",s=r(o);s!==o&&(console.warn("THREE.WebGLRenderer:",o,"not supported, using",s,"instead."),o=s);var c=!0===i.logarithmicDepthBuffer&&!!e.get("EXT_frag_depth"),h=t.getParameter(t.MAX_TEXTURE_IMAGE_UNITS),l=t.getParameter(t.MAX_VERTEX_TEXTURE_IMAGE_UNITS),u=t.getParameter(t.MAX_TEXTURE_SIZE),p=t.getParameter(t.MAX_CUBE_MAP_TEXTURE_SIZE),d=t.getParameter(t.MAX_VERTEX_ATTRIBS),f=t.getParameter(t.MAX_VERTEX_UNIFORM_VECTORS),m=t.getParameter(t.MAX_VARYING_VECTORS),v=t.getParameter(t.MAX_FRAGMENT_UNIFORM_VECTORS),g=l>0,y=!!e.get("OES_texture_float");return{getMaxAnisotropy:n,getMaxPrecision:r,precision:o,logarithmicDepthBuffer:c,maxTextures:h,maxVertexTextures:l,maxTextureSize:u,maxCubemapSize:p,maxAttributes:d,maxVertexUniforms:f,maxVaryings:m,maxFragmentUniforms:v,vertexTextures:g,floatFragmentTextures:y,floatVertexTextures:g&&y}}function ue(t){var e={};return{get:function(i){if(void 0!==e[i])return e[i];var n;switch(i){case"WEBGL_depth_texture":n=t.getExtension("WEBGL_depth_texture")||t.getExtension("MOZ_WEBGL_depth_texture")||t.getExtension("WEBKIT_WEBGL_depth_texture");break;case"EXT_texture_filter_anisotropic":n=t.getExtension("EXT_texture_filter_anisotropic")||t.getExtension("MOZ_EXT_texture_filter_anisotropic")||t.getExtension("WEBKIT_EXT_texture_filter_anisotropic");break;case"WEBGL_compressed_texture_s3tc":n=t.getExtension("WEBGL_compressed_texture_s3tc")||t.getExtension("MOZ_WEBGL_compressed_texture_s3tc")||t.getExtension("WEBKIT_WEBGL_compressed_texture_s3tc");break;case"WEBGL_compressed_texture_pvrtc":n=t.getExtension("WEBGL_compressed_texture_pvrtc")||t.getExtension("WEBKIT_WEBGL_compressed_texture_pvrtc");break;case"WEBGL_compressed_texture_etc1":n=t.getExtension("WEBGL_compressed_texture_etc1");break;default:n=t.getExtension(i)}return null===n&&console.warn("THREE.WebGLRenderer: "+i+" extension not supported."),e[i]=n,n}}}function pe(){function t(){h.value!==n&&(h.value=n,h.needsUpdate=r>0),i.numPlanes=r,i.numIntersection=0}function e(t,e,n,r){var a=null!==t?t.length:0,o=null;if(0!==a){if(o=h.value,!0!==r||null===o){var l=n+4*a,u=e.matrixWorldInverse;c.getNormalMatrix(u),(null===o||o.length<l)&&(o=new Float32Array(l));for(var p=0,d=n;p!==a;++p,d+=4)s.copy(t[p]).applyMatrix4(u,c),s.normal.toArray(o,d),o[d+3]=s.constant}h.value=o,h.needsUpdate=!0}return i.numPlanes=a,o}var i=this,n=null,r=0,a=!1,o=!1,s=new it,c=new et,h={value:null,needsUpdate:!1};this.uniform=h,this.numPlanes=0,this.numIntersection=0,this.init=function(t,i,o){var s=0!==t.length||i||0!==r||a;return a=i,n=e(t,o,0),r=t.length,s},this.beginShadows=function(){o=!0,e(null)},this.endShadows=function(){o=!1,t()},this.setState=function(i,s,c,l,u,p){if(!a||null===i||0===i.length||o&&!c)o?e(null):t();else{var d=o?0:r,f=4*d,m=u.clippingState||null;h.value=m,m=e(i,l,f,p);for(var v=0;v!==f;++v)m[v]=n[v];u.clippingState=m,this.numIntersection=s?this.numPlanes:0,this.numPlanes+=d}}}function de(t){function e(){return null===it?yt:1}function i(){Jt.init(),Jt.scissor(ht.copy(xt).multiplyScalar(yt)),Jt.viewport(ut.copy(_t).multiplyScalar(yt)),Jt.buffers.color.setClear(ft.r,ft.g,ft.b,mt,V)}function n(){et=null,ct=null,st="",ot=-1,Jt.reset()}function a(t){t.preventDefault(),n(),i(),Qt.clear(),ee.clear()}function o(t){var e=t.target;e.removeEventListener("dispose",o),s(e)}function s(t){u(t),Qt.remove(t)}function u(t){var e=Qt.get(t).program;t.program=void 0,void 0!==e&&ie.releaseProgram(e)}function p(t,e,i){t.render(function(t){tt.renderBufferImmediate(t,e,i)})}function d(t,e){return Math.abs(e[0])-Math.abs(t[0])}function f(t,e,i,n){if(i&&i.isInstancedBufferGeometry&&null===Yt.get("ANGLE_instanced_arrays"))return void console.error("THREE.WebGLRenderer.setupVertexAttributes: using THREE.InstancedBufferGeometry but hardware does not support extension ANGLE_instanced_arrays.");void 0===n&&(n=0),Jt.initAttributes();var r=i.attributes,a=e.getAttributes(),o=t.defaultAttributeValues;for(var s in a){var c=a[s];if(c>=0){var h=r[s];if(void 0!==h){var l=h.normalized,u=h.itemSize,p=$t.get(h),d=p.buffer,f=p.type,m=p.bytesPerElement;if(h.isInterleavedBufferAttribute){var v=h.data,g=v.stride,y=h.offset;v&&v.isInstancedInterleavedBuffer?(Jt.enableAttributeAndDivisor(c,v.meshPerAttribute),void 0===i.maxInstancedCount&&(i.maxInstancedCount=v.meshPerAttribute*v.count)):Jt.enableAttribute(c),Xt.bindBuffer(Xt.ARRAY_BUFFER,d),Xt.vertexAttribPointer(c,u,f,l,g*m,(n*g+y)*m)}else h.isInstancedBufferAttribute?(Jt.enableAttributeAndDivisor(c,h.meshPerAttribute),void 0===i.maxInstancedCount&&(i.maxInstancedCount=h.meshPerAttribute*h.count)):Jt.enableAttribute(c),Xt.bindBuffer(Xt.ARRAY_BUFFER,d),Xt.vertexAttribPointer(c,u,f,l,0,n*u*m)}else if(void 0!==o){var x=o[s];if(void 0!==x)switch(x.length){case 2:Xt.vertexAttrib2fv(c,x);break;case 3:Xt.vertexAttrib3fv(c,x);break;case 4:Xt.vertexAttrib4fv(c,x);break;default:Xt.vertexAttrib1fv(c,x)}}}}Jt.disableUnusedAttributes()}function m(t,e,i){if(t.visible){if(t.layers.test(e.layers))if(t.isLight)j.push(t);else if(t.isSprite)t.frustumCulled&&!wt.intersectsSprite(t)||K.push(t);else if(t.isLensFlare)$.push(t);else if(t.isImmediateRenderObject)i&&Rt.setFromMatrixPosition(t.matrixWorld).applyMatrix4(St),q.push(t,null,t.material,Rt.z,null);else if((t.isMesh||t.isLine||t.isPoints)&&(t.isSkinnedMesh&&t.skeleton.update(),!t.frustumCulled||wt.intersectsObject(t))){i&&Rt.setFromMatrixPosition(t.matrixWorld).applyMatrix4(St);var n=ee.update(t),r=t.material;if(Array.isArray(r))for(var a=n.groups,o=0,s=a.length;o<s;o++){var c=a[o],h=r[c.materialIndex];h&&h.visible&&q.push(t,n,h,Rt.z,c)}else r.visible&&q.push(t,n,r,Rt.z,null)}for(var l=t.children,o=0,s=l.length;o<s;o++)m(l[o],e,i)}}function v(t,e,i,n){for(var r=0,a=t.length;r<a;r++){var o=t[r],s=o.object,c=o.geometry,h=void 0===n?o.material:n,l=o.group;if(s.onBeforeRender(tt,e,i,c,h,l),i.isArrayCamera&&i.enabled)for(var u=i.cameras,p=0,d=u.length;p<d;p++){var f=u[p],m=f.bounds;tt.setViewport(m.x*vt*yt,m.y*gt*yt,m.z*vt*yt,m.w*gt*yt),tt.setScissor(m.x*vt*yt,m.y*gt*yt,m.z*vt*yt,m.w*gt*yt),tt.setScissorTest(!0),g(s,e,f,c,h,l)}else g(s,e,i,c,h,l);s.onAfterRender(tt,e,i,c,h,l)}}function g(t,e,i,n,r,a){if(t.modelViewMatrix.multiplyMatrices(i.matrixWorldInverse,t.matrixWorld),t.normalMatrix.getNormalMatrix(t.modelViewMatrix),t.isImmediateRenderObject){Jt.setMaterial(r);var o=x(i,e.fog,r,t);st="",p(t,o,r)}else tt.renderBufferDirect(i,e.fog,n,r,t,a)}function y(t,e,i){var n=Qt.get(t),r=ie.getParameters(t,Ft,e,Mt.numPlanes,Mt.numIntersection,i),a=ie.getProgramCode(t,r),s=n.program,c=!0;if(void 0===s)t.addEventListener("dispose",o);else if(s.code!==a)u(t);else{if(void 0!==r.shaderID)return;c=!1}if(c){if(r.shaderID){var h=ws[r.shaderID];n.__webglShader={name:t.type,uniforms:bs.clone(h.uniforms),vertexShader:h.vertexShader,fragmentShader:h.fragmentShader}}else n.__webglShader={name:t.type,uniforms:t.uniforms,vertexShader:t.vertexShader,fragmentShader:t.fragmentShader};t.__webglShader=n.__webglShader,s=ie.acquireProgram(t,r,a),n.program=s,t.program=s}var l=s.getAttributes();if(t.morphTargets){t.numSupportedMorphTargets=0;for(var p=0;p<tt.maxMorphTargets;p++)l["morphTarget"+p]>=0&&t.numSupportedMorphTargets++}if(t.morphNormals){t.numSupportedMorphNormals=0;for(var p=0;p<tt.maxMorphNormals;p++)l["morphNormal"+p]>=0&&t.numSupportedMorphNormals++}var d=n.__webglShader.uniforms;(t.isShaderMaterial||t.isRawShaderMaterial)&&!0!==t.clipping||(n.numClippingPlanes=Mt.numPlanes,n.numIntersection=Mt.numIntersection,d.clippingPlanes=Mt.uniform),n.fog=e,n.lightsHash=Ft.hash,t.lights&&(d.ambientLightColor.value=Ft.ambient,d.directionalLights.value=Ft.directional,d.spotLights.value=Ft.spot,d.rectAreaLights.value=Ft.rectArea,d.pointLights.value=Ft.point,d.hemisphereLights.value=Ft.hemi,d.directionalShadowMap.value=Ft.directionalShadowMap,d.directionalShadowMatrix.value=Ft.directionalShadowMatrix,d.spotShadowMap.value=Ft.spotShadowMap,d.spotShadowMatrix.value=Ft.spotShadowMatrix,d.pointShadowMap.value=Ft.pointShadowMap,d.pointShadowMatrix.value=Ft.pointShadowMatrix);var f=n.program.getUniforms(),m=W.seqWithValue(f.seq,d);n.uniformsList=m}function x(t,e,i,n){dt=0;var r=Qt.get(i);if(Et&&(Tt||t!==ct)){var a=t===ct&&i.id===ot;Mt.setState(i.clippingPlanes,i.clipIntersection,i.clipShadows,t,r,a)}!1===i.needsUpdate&&(void 0===r.program?i.needsUpdate=!0:i.fog&&r.fog!==e?i.needsUpdate=!0:i.lights&&r.lightsHash!==Ft.hash?i.needsUpdate=!0:void 0===r.numClippingPlanes||r.numClippingPlanes===Mt.numPlanes&&r.numIntersection===Mt.numIntersection||(i.needsUpdate=!0)),i.needsUpdate&&(y(i,e,n),i.needsUpdate=!1);var o=!1,s=!1,c=!1,h=r.program,u=h.getUniforms(),p=r.__webglShader.uniforms;if(h.id!==et&&(Xt.useProgram(h.program),et=h.id,o=!0,s=!0,c=!0),i.id!==ot&&(ot=i.id,s=!0),o||t!==ct){if(u.setValue(Xt,"projectionMatrix",t.projectionMatrix),Zt.logarithmicDepthBuffer&&u.setValue(Xt,"logDepthBufFC",2/(Math.log(t.far+1)/Math.LN2)),t!==ct&&(ct=t,s=!0,c=!0),i.isShaderMaterial||i.isMeshPhongMaterial||i.isMeshStandardMaterial||i.envMap){var d=u.map.cameraPosition;void 0!==d&&d.setValue(Xt,Rt.setFromMatrixPosition(t.matrixWorld))}(i.isMeshPhongMaterial||i.isMeshLambertMaterial||i.isMeshBasicMaterial||i.isMeshStandardMaterial||i.isShaderMaterial||i.skinning)&&u.setValue(Xt,"viewMatrix",t.matrixWorldInverse),u.setValue(Xt,"toneMappingExposure",tt.toneMappingExposure),u.setValue(Xt,"toneMappingWhitePoint",tt.toneMappingWhitePoint)}if(i.skinning){u.setOptional(Xt,n,"bindMatrix"),u.setOptional(Xt,n,"bindMatrixInverse");var f=n.skeleton;if(f){var m=f.bones;if(Zt.floatVertexTextures){if(void 0===f.boneTexture){var v=Math.sqrt(4*m.length);v=hs.nextPowerOfTwo(Math.ceil(v)),v=Math.max(v,4);var g=new Float32Array(v*v*4);g.set(f.boneMatrices);var x=new l(g,v,v,Oo,So);f.boneMatrices=g,f.boneTexture=x,f.boneTextureSize=v}u.setValue(Xt,"boneTexture",f.boneTexture),u.setValue(Xt,"boneTextureSize",f.boneTextureSize)}else u.setOptional(Xt,f,"boneMatrices")}}return s&&(i.lights&&C(p,c),e&&i.fog&&E(p,e),(i.isMeshBasicMaterial||i.isMeshLambertMaterial||i.isMeshPhongMaterial||i.isMeshStandardMaterial||i.isMeshNormalMaterial||i.isMeshDepthMaterial)&&b(p,i),i.isLineBasicMaterial?_(p,i):i.isLineDashedMaterial?(_(p,i),w(p,i)):i.isPointsMaterial?M(p,i):i.isMeshLambertMaterial?T(p,i):i.isMeshToonMaterial?A(p,i):i.isMeshPhongMaterial?S(p,i):i.isMeshPhysicalMaterial?R(p,i):i.isMeshStandardMaterial?L(p,i):i.isMeshDepthMaterial?i.displacementMap&&(p.displacementMap.value=i.displacementMap,p.displacementScale.value=i.displacementScale,p.displacementBias.value=i.displacementBias):i.isMeshNormalMaterial&&P(p,i),void 0!==p.ltcMat&&(p.ltcMat.value=xs.LTC_MAT_TEXTURE),void 0!==p.ltcMag&&(p.ltcMag.value=xs.LTC_MAG_TEXTURE),W.upload(Xt,r.uniformsList,p,tt)),u.setValue(Xt,"modelViewMatrix",n.modelViewMatrix),u.setValue(Xt,"normalMatrix",n.normalMatrix),u.setValue(Xt,"modelMatrix",n.matrixWorld),h}function b(t,e){t.opacity.value=e.opacity,t.diffuse.value=e.color,e.emissive&&t.emissive.value.copy(e.emissive).multiplyScalar(e.emissiveIntensity),t.map.value=e.map,t.specularMap.value=e.specularMap,t.alphaMap.value=e.alphaMap,e.lightMap&&(t.lightMap.value=e.lightMap,t.lightMapIntensity.value=e.lightMapIntensity),e.aoMap&&(t.aoMap.value=e.aoMap,t.aoMapIntensity.value=e.aoMapIntensity);var i;if(e.map?i=e.map:e.specularMap?i=e.specularMap:e.displacementMap?i=e.displacementMap:e.normalMap?i=e.normalMap:e.bumpMap?i=e.bumpMap:e.roughnessMap?i=e.roughnessMap:e.metalnessMap?i=e.metalnessMap:e.alphaMap?i=e.alphaMap:e.emissiveMap&&(i=e.emissiveMap),void 0!==i){i.isWebGLRenderTarget&&(i=i.texture);var n=i.offset,r=i.repeat;t.offsetRepeat.value.set(n.x,n.y,r.x,r.y)}t.envMap.value=e.envMap,t.flipEnvMap.value=e.envMap&&e.envMap.isCubeTexture?-1:1,t.reflectivity.value=e.reflectivity,t.refractionRatio.value=e.refractionRatio}function _(t,e){t.diffuse.value=e.color,t.opacity.value=e.opacity}function w(t,e){t.dashSize.value=e.dashSize,t.totalSize.value=e.dashSize+e.gapSize,t.scale.value=e.scale}function M(t,e){if(t.diffuse.value=e.color,t.opacity.value=e.opacity,t.size.value=e.size*yt,t.scale.value=.5*gt,t.map.value=e.map,null!==e.map){var i=e.map.offset,n=e.map.repeat;t.offsetRepeat.value.set(i.x,i.y,n.x,n.y)}}function E(t,e){t.fogColor.value=e.color,e.isFog?(t.fogNear.value=e.near,t.fogFar.value=e.far):e.isFogExp2&&(t.fogDensity.value=e.density)}function T(t,e){e.emissiveMap&&(t.emissiveMap.value=e.emissiveMap)}function S(t,e){t.specular.value=e.specular,t.shininess.value=Math.max(e.shininess,1e-4),e.emissiveMap&&(t.emissiveMap.value=e.emissiveMap),e.bumpMap&&(t.bumpMap.value=e.bumpMap,t.bumpScale.value=e.bumpScale),e.normalMap&&(t.normalMap.value=e.normalMap,t.normalScale.value.copy(e.normalScale)),e.displacementMap&&(t.displacementMap.value=e.displacementMap,t.displacementScale.value=e.displacementScale,t.displacementBias.value=e.displacementBias)}function A(t,e){S(t,e),e.gradientMap&&(t.gradientMap.value=e.gradientMap)}function L(t,e){t.roughness.value=e.roughness,t.metalness.value=e.metalness,e.roughnessMap&&(t.roughnessMap.value=e.roughnessMap),e.metalnessMap&&(t.metalnessMap.value=e.metalnessMap),e.emissiveMap&&(t.emissiveMap.value=e.emissiveMap),e.bumpMap&&(t.bumpMap.value=e.bumpMap,t.bumpScale.value=e.bumpScale),e.normalMap&&(t.normalMap.value=e.normalMap,t.normalScale.value.copy(e.normalScale)),e.displacementMap&&(t.displacementMap.value=e.displacementMap,t.displacementScale.value=e.displacementScale,t.displacementBias.value=e.displacementBias),e.envMap&&(t.envMapIntensity.value=e.envMapIntensity)}function R(t,e){t.clearCoat.value=e.clearCoat,t.clearCoatRoughness.value=e.clearCoatRoughness,L(t,e)}function P(t,e){e.bumpMap&&(t.bumpMap.value=e.bumpMap,t.bumpScale.value=e.bumpScale),e.normalMap&&(t.normalMap.value=e.normalMap,t.normalScale.value.copy(e.normalScale)),e.displacementMap&&(t.displacementMap.value=e.displacementMap,t.displacementScale.value=e.displacementScale,t.displacementBias.value=e.displacementBias)}function C(t,e){t.ambientLightColor.needsUpdate=e,t.directionalLights.needsUpdate=e,t.pointLights.needsUpdate=e,t.spotLights.needsUpdate=e,t.rectAreaLights.needsUpdate=e,t.hemisphereLights.needsUpdate=e}function I(t){for(var e=0,i=0,n=t.length;i<n;i++){var r=t[i];r.castShadow&&(Ft.shadows[e]=r,e++)}Ft.shadows.length=e}function U(t,e){var i,n,r,a,o,s,c,h,l=0,u=0,p=0,d=e.matrixWorldInverse,f=0,m=0,v=0,g=0,y=0;for(i=0,n=t.length;i<n;i++)if(r=t[i],o=r.color,s=r.intensity,c=r.distance,h=r.shadow&&r.shadow.map?r.shadow.map.texture:null,r.isAmbientLight)l+=o.r*s,u+=o.g*s,p+=o.b*s;else if(r.isDirectionalLight){var x=ne.get(r);x.color.copy(r.color).multiplyScalar(r.intensity),x.direction.setFromMatrixPosition(r.matrixWorld),Rt.setFromMatrixPosition(r.target.matrixWorld),x.direction.sub(Rt),x.direction.transformDirection(d),x.shadow=r.castShadow,r.castShadow&&(a=r.shadow,x.shadowBias=a.bias,x.shadowRadius=a.radius,x.shadowMapSize=a.mapSize),Ft.directionalShadowMap[f]=h,Ft.directionalShadowMatrix[f]=r.shadow.matrix,Ft.directional[f]=x,f++}else if(r.isSpotLight){var x=ne.get(r);x.position.setFromMatrixPosition(r.matrixWorld),x.position.applyMatrix4(d),x.color.copy(o).multiplyScalar(s),x.distance=c,x.direction.setFromMatrixPosition(r.matrixWorld),Rt.setFromMatrixPosition(r.target.matrixWorld),x.direction.sub(Rt),x.direction.transformDirection(d),x.coneCos=Math.cos(r.angle),x.penumbraCos=Math.cos(r.angle*(1-r.penumbra)),x.decay=0===r.distance?0:r.decay,x.shadow=r.castShadow,r.castShadow&&(a=r.shadow,x.shadowBias=a.bias,x.shadowRadius=a.radius,x.shadowMapSize=a.mapSize),Ft.spotShadowMap[v]=h,Ft.spotShadowMatrix[v]=r.shadow.matrix,Ft.spot[v]=x,v++}else if(r.isRectAreaLight){var x=ne.get(r);x.color.copy(o).multiplyScalar(s/(r.width*r.height)),x.position.setFromMatrixPosition(r.matrixWorld),x.position.applyMatrix4(d),Ut.identity(),Ct.copy(r.matrixWorld),Ct.premultiply(d),Ut.extractRotation(Ct),x.halfWidth.set(.5*r.width,0,0),x.halfHeight.set(0,.5*r.height,0),x.halfWidth.applyMatrix4(Ut),x.halfHeight.applyMatrix4(Ut),Ft.rectArea[g]=x,g++}else if(r.isPointLight){var x=ne.get(r);x.position.setFromMatrixPosition(r.matrixWorld),x.position.applyMatrix4(d),x.color.copy(r.color).multiplyScalar(r.intensity),x.distance=r.distance,x.decay=0===r.distance?0:r.decay,x.shadow=r.castShadow,r.castShadow&&(a=r.shadow,x.shadowBias=a.bias,x.shadowRadius=a.radius,x.shadowMapSize=a.mapSize),Ft.pointShadowMap[m]=h,Ft.pointShadowMatrix[m]=r.shadow.matrix,Ft.point[m]=x,m++}else if(r.isHemisphereLight){var x=ne.get(r);x.direction.setFromMatrixPosition(r.matrixWorld),x.direction.transformDirection(d),x.direction.normalize(),x.skyColor.copy(r.color).multiplyScalar(s),x.groundColor.copy(r.groundColor).multiplyScalar(s),Ft.hemi[y]=x,y++}Ft.ambient[0]=l,Ft.ambient[1]=u,Ft.ambient[2]=p,Ft.directional.length=f,Ft.spot.length=v,Ft.rectArea.length=g,Ft.point.length=m,Ft.hemi.length=y,Ft.hash=f+","+m+","+v+","+g+","+y+","+Ft.shadows.length}function O(){var t=dt;return t>=Zt.maxTextures&&console.warn("WebGLRenderer: trying to use "+t+" texture units while this GPU supports only "+Zt.maxTextures),dt+=1,t}function D(t){var e;if(t===lo)return Xt.REPEAT;if(t===uo)return Xt.CLAMP_TO_EDGE;if(t===po)return Xt.MIRRORED_REPEAT;if(t===fo)return Xt.NEAREST;if(t===mo)return Xt.NEAREST_MIPMAP_NEAREST;if(t===vo)return Xt.NEAREST_MIPMAP_LINEAR;if(t===go)return Xt.LINEAR;if(t===yo)return Xt.LINEAR_MIPMAP_NEAREST;if(t===xo)return Xt.LINEAR_MIPMAP_LINEAR;if(t===bo)return Xt.UNSIGNED_BYTE;if(t===Lo)return Xt.UNSIGNED_SHORT_4_4_4_4;if(t===Ro)return Xt.UNSIGNED_SHORT_5_5_5_1;if(t===Po)return Xt.UNSIGNED_SHORT_5_6_5;if(t===_o)return Xt.BYTE;if(t===wo)return Xt.SHORT;if(t===Mo)return Xt.UNSIGNED_SHORT;if(t===Eo)return Xt.INT;if(t===To)return Xt.UNSIGNED_INT;if(t===So)return Xt.FLOAT;if(t===Ao&&null!==(e=Yt.get("OES_texture_half_float")))return e.HALF_FLOAT_OES;if(t===Io)return Xt.ALPHA;if(t===Uo)return Xt.RGB;if(t===Oo)return Xt.RGBA;if(t===Do)return Xt.LUMINANCE;if(t===No)return Xt.LUMINANCE_ALPHA;if(t===Bo)return Xt.DEPTH_COMPONENT;if(t===zo)return Xt.DEPTH_STENCIL;if(t===Ta)return Xt.FUNC_ADD;if(t===Sa)return Xt.FUNC_SUBTRACT;if(t===Aa)return Xt.FUNC_REVERSE_SUBTRACT;if(t===Pa)return Xt.ZERO;if(t===Ca)return Xt.ONE;if(t===Ia)return Xt.SRC_COLOR;if(t===Ua)return Xt.ONE_MINUS_SRC_COLOR;if(t===Oa)return Xt.SRC_ALPHA;if(t===Da)return Xt.ONE_MINUS_SRC_ALPHA;if(t===Na)return Xt.DST_ALPHA;if(t===Fa)return Xt.ONE_MINUS_DST_ALPHA;if(t===Ba)return Xt.DST_COLOR;if(t===za)return Xt.ONE_MINUS_DST_COLOR;if(t===Ga)return Xt.SRC_ALPHA_SATURATE;if((t===Go||t===Ho||t===Vo||t===ko)&&null!==(e=Yt.get("WEBGL_compressed_texture_s3tc"))){if(t===Go)return e.COMPRESSED_RGB_S3TC_DXT1_EXT;if(t===Ho)return e.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(t===Vo)return e.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(t===ko)return e.COMPRESSED_RGBA_S3TC_DXT5_EXT}if((t===jo||t===Wo||t===Xo||t===qo)&&null!==(e=Yt.get("WEBGL_compressed_texture_pvrtc"))){if(t===jo)return e.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(t===Wo)return e.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(t===Xo)return e.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(t===qo)return e.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}if(t===Yo&&null!==(e=Yt.get("WEBGL_compressed_texture_etc1")))return e.COMPRESSED_RGB_ETC1_WEBGL;if((t===La||t===Ra)&&null!==(e=Yt.get("EXT_blend_minmax"))){if(t===La)return e.MIN_EXT;if(t===Ra)return e.MAX_EXT}return t===Co&&null!==(e=Yt.get("WEBGL_depth_texture"))?e.UNSIGNED_INT_24_8_WEBGL:0}console.log("THREE.WebGLRenderer",na),t=t||{};var N=void 0!==t.canvas?t.canvas:document.createElementNS("http://www.w3.org/1999/xhtml","canvas"),F=void 0!==t.context?t.context:null,B=void 0!==t.alpha&&t.alpha,z=void 0===t.depth||t.depth,G=void 0===t.stencil||t.stencil,H=void 0!==t.antialias&&t.antialias,V=void 0===t.premultipliedAlpha||t.premultipliedAlpha,k=void 0!==t.preserveDrawingBuffer&&t.preserveDrawingBuffer,j=[],q=null,J=new Float32Array(8),K=[],$=[];this.domElement=N,this.context=null,this.autoClear=!0,this.autoClearColor=!0,this.autoClearDepth=!0,this.autoClearStencil=!0,this.sortObjects=!0,this.clippingPlanes=[],this.localClippingEnabled=!1,this.gammaFactor=2,this.gammaInput=!1,this.gammaOutput=!1,this.physicallyCorrectLights=!1,this.toneMapping=$a,this.toneMappingExposure=1,this.toneMappingWhitePoint=1,this.maxMorphTargets=8,this.maxMorphNormals=4;var tt=this,et=null,it=null,at=null,ot=-1,st="",ct=null,ht=new r,lt=null,ut=new r,dt=0,ft=new X(0),mt=0,vt=N.width,gt=N.height,yt=1,xt=new r(0,0,vt,gt),bt=!1,_t=new r(0,0,vt,gt),wt=new nt,Mt=new pe,Et=!1,Tt=!1,St=new h,Rt=new c,Ct=new h,Ut=new h,Ft={hash:"",ambient:[0,0,0],directional:[],directionalShadowMap:[],directionalShadowMatrix:[],spot:[],spotShadowMap:[],spotShadowMatrix:[],rectArea:[],point:[],pointShadowMap:[],pointShadowMatrix:[],hemi:[],shadows:[]},Bt={geometries:0,textures:0},zt={frame:0,calls:0,vertices:0,faces:0,points:0};this.info={render:zt,memory:Bt,programs:null};var Xt;try{var qt={alpha:B,depth:z,stencil:G,antialias:H,premultipliedAlpha:V,preserveDrawingBuffer:k};if(null===(Xt=F||N.getContext("webgl",qt)||N.getContext("experimental-webgl",qt)))throw null!==N.getContext("webgl")?"Error creating WebGL context with your selected attributes.":"Error creating WebGL context.";void 0===Xt.getShaderPrecisionFormat&&(Xt.getShaderPrecisionFormat=function(){return{rangeMin:1,rangeMax:1,precision:1}}),N.addEventListener("webglcontextlost",a,!1)}catch(t){console.error("THREE.WebGLRenderer: "+t)}var Yt=new ue(Xt);Yt.get("WEBGL_depth_texture"),Yt.get("OES_texture_float"),Yt.get("OES_texture_float_linear"),Yt.get("OES_texture_half_float"),Yt.get("OES_texture_half_float_linear"),Yt.get("OES_standard_derivatives"),Yt.get("ANGLE_instanced_arrays"),Yt.get("OES_element_index_uint")&&(At.MaxIndex=4294967296);var Zt=new le(Xt,Yt,t),Jt=new he(Xt,Yt,D),Qt=new ce,Kt=new se(Xt,Yt,Jt,Qt,Zt,D,Bt),$t=new Nt(Xt),te=new kt(Xt,$t,Bt),ee=new Wt(Xt,te,zt),ie=new oe(this,Zt),ne=new jt,re=new Gt;this.info.programs=ie.programs;var ae,de,fe,me,ve=new Vt(Xt,Yt,zt),ge=new Ht(Xt,Yt,zt);i(),this.context=Xt,this.capabilities=Zt,this.extensions=Yt,this.properties=Qt,this.state=Jt;var ye=new rt(this,Ft,ee,Zt);this.shadowMap=ye;var xe=new Z(this,K),be=new Y(this,$);this.getContext=function(){return Xt},this.getContextAttributes=function(){return Xt.getContextAttributes()
},this.forceContextLoss=function(){var t=Yt.get("WEBGL_lose_context");t&&t.loseContext()},this.getMaxAnisotropy=function(){return Zt.getMaxAnisotropy()},this.getPrecision=function(){return Zt.precision},this.getPixelRatio=function(){return yt},this.setPixelRatio=function(t){void 0!==t&&(yt=t,this.setSize(_t.z,_t.w,!1))},this.getSize=function(){return{width:vt,height:gt}},this.setSize=function(t,e,i){vt=t,gt=e,N.width=t*yt,N.height=e*yt,!1!==i&&(N.style.width=t+"px",N.style.height=e+"px"),this.setViewport(0,0,t,e)},this.setViewport=function(t,e,i,n){Jt.viewport(_t.set(t,e,i,n))},this.setScissor=function(t,e,i,n){Jt.scissor(xt.set(t,e,i,n))},this.setScissorTest=function(t){Jt.setScissorTest(bt=t)},this.getClearColor=function(){return ft},this.setClearColor=function(t,e){ft.set(t),mt=void 0!==e?e:1,Jt.buffers.color.setClear(ft.r,ft.g,ft.b,mt,V)},this.getClearAlpha=function(){return mt},this.setClearAlpha=function(t){mt=t,Jt.buffers.color.setClear(ft.r,ft.g,ft.b,mt,V)},this.clear=function(t,e,i){var n=0;(void 0===t||t)&&(n|=Xt.COLOR_BUFFER_BIT),(void 0===e||e)&&(n|=Xt.DEPTH_BUFFER_BIT),(void 0===i||i)&&(n|=Xt.STENCIL_BUFFER_BIT),Xt.clear(n)},this.clearColor=function(){this.clear(!0,!1,!1)},this.clearDepth=function(){this.clear(!1,!0,!1)},this.clearStencil=function(){this.clear(!1,!1,!0)},this.clearTarget=function(t,e,i,n){this.setRenderTarget(t),this.clear(e,i,n)},this.resetGLState=n,this.dispose=function(){N.removeEventListener("webglcontextlost",a,!1),re.dispose()},this.renderBufferImmediate=function(t,e,i){Jt.initAttributes();var n=Qt.get(t);t.hasPositions&&!n.position&&(n.position=Xt.createBuffer()),t.hasNormals&&!n.normal&&(n.normal=Xt.createBuffer()),t.hasUvs&&!n.uv&&(n.uv=Xt.createBuffer()),t.hasColors&&!n.color&&(n.color=Xt.createBuffer());var r=e.getAttributes();if(t.hasPositions&&(Xt.bindBuffer(Xt.ARRAY_BUFFER,n.position),Xt.bufferData(Xt.ARRAY_BUFFER,t.positionArray,Xt.DYNAMIC_DRAW),Jt.enableAttribute(r.position),Xt.vertexAttribPointer(r.position,3,Xt.FLOAT,!1,0,0)),t.hasNormals){if(Xt.bindBuffer(Xt.ARRAY_BUFFER,n.normal),!i.isMeshPhongMaterial&&!i.isMeshStandardMaterial&&!i.isMeshNormalMaterial&&i.shading===fa)for(var a=0,o=3*t.count;a<o;a+=9){var s=t.normalArray,c=(s[a+0]+s[a+3]+s[a+6])/3,h=(s[a+1]+s[a+4]+s[a+7])/3,l=(s[a+2]+s[a+5]+s[a+8])/3;s[a+0]=c,s[a+1]=h,s[a+2]=l,s[a+3]=c,s[a+4]=h,s[a+5]=l,s[a+6]=c,s[a+7]=h,s[a+8]=l}Xt.bufferData(Xt.ARRAY_BUFFER,t.normalArray,Xt.DYNAMIC_DRAW),Jt.enableAttribute(r.normal),Xt.vertexAttribPointer(r.normal,3,Xt.FLOAT,!1,0,0)}t.hasUvs&&i.map&&(Xt.bindBuffer(Xt.ARRAY_BUFFER,n.uv),Xt.bufferData(Xt.ARRAY_BUFFER,t.uvArray,Xt.DYNAMIC_DRAW),Jt.enableAttribute(r.uv),Xt.vertexAttribPointer($t.uv,2,Xt.FLOAT,!1,0,0)),t.hasColors&&i.vertexColors!==va&&(Xt.bindBuffer(Xt.ARRAY_BUFFER,n.color),Xt.bufferData(Xt.ARRAY_BUFFER,t.colorArray,Xt.DYNAMIC_DRAW),Jt.enableAttribute(r.color),Xt.vertexAttribPointer(r.color,3,Xt.FLOAT,!1,0,0)),Jt.disableUnusedAttributes(),Xt.drawArrays(Xt.TRIANGLES,0,t.count),t.count=0},this.renderBufferDirect=function(t,i,n,r,a,o){Jt.setMaterial(r);var s=x(t,i,r,a),c=n.id+"_"+s.id+"_"+(!0===r.wireframe),h=!1;c!==st&&(st=c,h=!0);var l=a.morphTargetInfluences;if(void 0!==l){for(var u=[],p=0,m=l.length;p<m;p++){var v=l[p];u.push([v,p])}u.sort(d),u.length>8&&(u.length=8);for(var g=n.morphAttributes,p=0,m=u.length;p<m;p++){var v=u[p];if(J[p]=v[0],0!==v[0]){var y=v[1];!0===r.morphTargets&&g.position&&n.addAttribute("morphTarget"+p,g.position[y]),!0===r.morphNormals&&g.normal&&n.addAttribute("morphNormal"+p,g.normal[y])}else!0===r.morphTargets&&n.removeAttribute("morphTarget"+p),!0===r.morphNormals&&n.removeAttribute("morphNormal"+p)}for(var p=u.length,b=J.length;p<b;p++)J[p]=0;s.getUniforms().setValue(Xt,"morphTargetInfluences",J),h=!0}var y=n.index,_=n.attributes.position,w=1;!0===r.wireframe&&(y=te.getWireframeAttribute(n),w=2);var M=ve;null!==y&&(M=ge,M.setIndex(y)),h&&(f(r,s,n),null!==y&&Xt.bindBuffer(Xt.ELEMENT_ARRAY_BUFFER,$t.get(y).buffer));var E=0;null!==y?E=y.count:void 0!==_&&(E=_.count);var T=n.drawRange.start*w,S=n.drawRange.count*w,A=null!==o?o.start*w:0,L=null!==o?o.count*w:1/0,R=Math.max(T,A),P=Math.min(E,T+S,A+L)-1,C=Math.max(0,P-R+1);if(0!==C){if(a.isMesh)if(!0===r.wireframe)Jt.setLineWidth(r.wireframeLinewidth*e()),M.setMode(Xt.LINES);else switch(a.drawMode){case Qo:M.setMode(Xt.TRIANGLES);break;case Ko:M.setMode(Xt.TRIANGLE_STRIP);break;case $o:M.setMode(Xt.TRIANGLE_FAN)}else if(a.isLine){var I=r.linewidth;void 0===I&&(I=1),Jt.setLineWidth(I*e()),a.isLineSegments?M.setMode(Xt.LINES):a.isLineLoop?M.setMode(Xt.LINE_LOOP):M.setMode(Xt.LINE_STRIP)}else a.isPoints&&M.setMode(Xt.POINTS);n&&n.isInstancedBufferGeometry?n.maxInstancedCount>0&&M.renderInstances(n,R,C):M.render(R,C)}},this.compile=function(t,e){j=[],t.traverse(function(t){t.isLight&&j.push(t)}),U(j,e),t.traverse(function(e){if(e.material)if(Array.isArray(e.material))for(var i=0;i<e.material.length;i++)y(e.material[i],t.fog,e);else y(e.material,t.fog,e)})},this.render=function(t,e,i,n){if(void 0!==e&&!0!==e.isCamera)return void console.error("THREE.WebGLRenderer.render: camera is not an instance of THREE.Camera.");st="",ot=-1,ct=null,!0===t.autoUpdate&&t.updateMatrixWorld(),e.onBeforeRender(tt),null===e.parent&&e.updateMatrixWorld(),e.matrixWorldInverse.getInverse(e.matrixWorld),St.multiplyMatrices(e.projectionMatrix,e.matrixWorldInverse),wt.setFromMatrix(St),j.length=0,K.length=0,$.length=0,Tt=this.localClippingEnabled,Et=Mt.init(this.clippingPlanes,Tt,e),q=re.get(t,e),q.init(),m(t,e,tt.sortObjects),q.finish(),!0===tt.sortObjects&&q.sort(),Et&&Mt.beginShadows(),I(j),ye.render(t,e),U(j,e),Et&&Mt.endShadows(),zt.frame++,zt.calls=0,zt.vertices=0,zt.faces=0,zt.points=0,void 0===i&&(i=null),this.setRenderTarget(i);var r=t.background;null===r?Jt.buffers.color.setClear(ft.r,ft.g,ft.b,mt,V):r&&r.isColor&&(Jt.buffers.color.setClear(r.r,r.g,r.b,1,V),n=!0),(this.autoClear||n)&&this.clear(this.autoClearColor,this.autoClearDepth,this.autoClearStencil),r&&r.isCubeTexture?(void 0===fe&&(fe=new Ot,me=new Lt(new Pt(5,5,5),new Q({uniforms:ws.cube.uniforms,vertexShader:ws.cube.vertexShader,fragmentShader:ws.cube.fragmentShader,side:pa,depthTest:!1,depthWrite:!1,fog:!1}))),fe.projectionMatrix.copy(e.projectionMatrix),fe.matrixWorld.extractRotation(e.matrixWorld),fe.matrixWorldInverse.getInverse(fe.matrixWorld),me.material.uniforms.tCube.value=r,me.modelViewMatrix.multiplyMatrices(fe.matrixWorldInverse,me.matrixWorld),ee.update(me),tt.renderBufferDirect(fe,null,me.geometry,me.material,me,null)):r&&r.isTexture&&(void 0===ae&&(ae=new Dt(-1,1,1,-1,0,1),de=new Lt(new It(2,2),new pt({depthTest:!1,depthWrite:!1,fog:!1}))),de.material.map=r,ee.update(de),tt.renderBufferDirect(ae,null,de.geometry,de.material,de,null));var a=q.opaque,o=q.transparent;if(t.overrideMaterial){var s=t.overrideMaterial;a.length&&v(a,t,e,s),o.length&&v(o,t,e,s)}else a.length&&v(a,t,e),o.length&&v(o,t,e);xe.render(t,e),be.render(t,e,ut),i&&Kt.updateRenderTargetMipmap(i),Jt.buffers.depth.setTest(!0),Jt.buffers.depth.setMask(!0),Jt.buffers.color.setMask(!0),e.isArrayCamera&&e.enabled&&tt.setScissorTest(!1),e.onAfterRender(tt)},this.setFaceCulling=function(t,e){Jt.setCullFace(t),Jt.setFlipSided(e===ca)},this.allocTextureUnit=O,this.setTexture2D=function(){var t=!1;return function(e,i){e&&e.isWebGLRenderTarget&&(t||(console.warn("THREE.WebGLRenderer.setTexture2D: don't use render targets as textures. Use their .texture property instead."),t=!0),e=e.texture),Kt.setTexture2D(e,i)}}(),this.setTexture=function(){var t=!1;return function(e,i){t||(console.warn("THREE.WebGLRenderer: .setTexture is deprecated, use setTexture2D instead."),t=!0),Kt.setTexture2D(e,i)}}(),this.setTextureCube=function(){var t=!1;return function(e,i){e&&e.isWebGLRenderTargetCube&&(t||(console.warn("THREE.WebGLRenderer.setTextureCube: don't use cube render targets as textures. Use their .texture property instead."),t=!0),e=e.texture),e&&e.isCubeTexture||Array.isArray(e.image)&&6===e.image.length?Kt.setTextureCube(e,i):Kt.setTextureCubeDynamic(e,i)}}(),this.getRenderTarget=function(){return it},this.setRenderTarget=function(t){it=t,t&&void 0===Qt.get(t).__webglFramebuffer&&Kt.setupRenderTarget(t);var e,i=t&&t.isWebGLRenderTargetCube;if(t){var n=Qt.get(t);e=i?n.__webglFramebuffer[t.activeCubeFace]:n.__webglFramebuffer,ht.copy(t.scissor),lt=t.scissorTest,ut.copy(t.viewport)}else e=null,ht.copy(xt).multiplyScalar(yt),lt=bt,ut.copy(_t).multiplyScalar(yt);if(at!==e&&(Xt.bindFramebuffer(Xt.FRAMEBUFFER,e),at=e),Jt.scissor(ht),Jt.setScissorTest(lt),Jt.viewport(ut),i){var r=Qt.get(t.texture);Xt.framebufferTexture2D(Xt.FRAMEBUFFER,Xt.COLOR_ATTACHMENT0,Xt.TEXTURE_CUBE_MAP_POSITIVE_X+t.activeCubeFace,r.__webglTexture,t.activeMipMapLevel)}},this.readRenderTargetPixels=function(t,e,i,n,r,a){if(!1===(t&&t.isWebGLRenderTarget))return void console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");var o=Qt.get(t).__webglFramebuffer;if(o){var s=!1;o!==at&&(Xt.bindFramebuffer(Xt.FRAMEBUFFER,o),s=!0);try{var c=t.texture,h=c.format,l=c.type;if(h!==Oo&&D(h)!==Xt.getParameter(Xt.IMPLEMENTATION_COLOR_READ_FORMAT))return void console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.");if(!(l===bo||D(l)===Xt.getParameter(Xt.IMPLEMENTATION_COLOR_READ_TYPE)||l===So&&(Yt.get("OES_texture_float")||Yt.get("WEBGL_color_buffer_float"))||l===Ao&&Yt.get("EXT_color_buffer_half_float")))return void console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.");Xt.checkFramebufferStatus(Xt.FRAMEBUFFER)===Xt.FRAMEBUFFER_COMPLETE?e>=0&&e<=t.width-n&&i>=0&&i<=t.height-r&&Xt.readPixels(e,i,n,r,D(h),D(l),a):console.error("THREE.WebGLRenderer.readRenderTargetPixels: readPixels from renderTarget failed. Framebuffer not complete.")}finally{s&&Xt.bindFramebuffer(Xt.FRAMEBUFFER,at)}}}}function fe(t,e){this.name="",this.color=new X(t),this.density=void 0!==e?e:25e-5}function me(t,e,i){this.name="",this.color=new X(t),this.near=void 0!==e?e:1,this.far=void 0!==i?i:1e3}function ve(){ct.call(this),this.type="Scene",this.background=null,this.fog=null,this.overrideMaterial=null,this.autoUpdate=!0}function ge(t,e,i,n,r){ct.call(this),this.lensFlares=[],this.positionScreen=new c,this.customUpdateCallback=void 0,void 0!==t&&this.add(t,e,i,n,r)}function ye(t){J.call(this),this.type="SpriteMaterial",this.color=new X(16777215),this.map=null,this.rotation=0,this.fog=!1,this.lights=!1,this.setValues(t)}function xe(t){ct.call(this),this.type="Sprite",this.material=void 0!==t?t:new ye}function be(){ct.call(this),this.type="LOD",Object.defineProperties(this,{levels:{enumerable:!0,value:[]}})}function _e(t,e){if(t=t||[],this.bones=t.slice(0),this.boneMatrices=new Float32Array(16*this.bones.length),void 0===e)this.calculateInverses();else if(this.bones.length===e.length)this.boneInverses=e.slice(0);else{console.warn("THREE.Skeleton boneInverses is the wrong length."),this.boneInverses=[];for(var i=0,n=this.bones.length;i<n;i++)this.boneInverses.push(new h)}}function we(){ct.call(this),this.type="Bone"}function Me(t,e){Lt.call(this,t,e),this.type="SkinnedMesh",this.bindMode="attached",this.bindMatrix=new h,this.bindMatrixInverse=new h;var i=this.initBones(),n=new _e(i);this.bind(n,this.matrixWorld),this.normalizeSkinWeights()}function Ee(t){J.call(this),this.type="LineBasicMaterial",this.color=new X(16777215),this.linewidth=1,this.linecap="round",this.linejoin="round",this.lights=!1,this.setValues(t)}function Te(t,e,i){if(1===i)return console.warn("THREE.Line: parameter THREE.LinePieces no longer supported. Created THREE.LineSegments instead."),new Se(t,e);ct.call(this),this.type="Line",this.geometry=void 0!==t?t:new At,this.material=void 0!==e?e:new Ee({color:16777215*Math.random()})}function Se(t,e){Te.call(this,t,e),this.type="LineSegments"}function Ae(t,e){Te.call(this,t,e),this.type="LineLoop"}function Le(t){J.call(this),this.type="PointsMaterial",this.color=new X(16777215),this.map=null,this.size=1,this.sizeAttenuation=!0,this.lights=!1,this.setValues(t)}function Re(t,e){ct.call(this),this.type="Points",this.geometry=void 0!==t?t:new At,this.material=void 0!==e?e:new Le({color:16777215*Math.random()})}function Pe(){ct.call(this),this.type="Group"}function Ce(t,e,i,r,a,o,s,c,h){function l(){requestAnimationFrame(l),t.readyState>=t.HAVE_CURRENT_DATA&&(u.needsUpdate=!0)}n.call(this,t,e,i,r,a,o,s,c,h),this.generateMipmaps=!1;var u=this;l()}function Ie(t,e,i,r,a,o,s,c,h,l,u,p){n.call(this,null,o,s,c,h,l,r,a,u,p),this.image={width:e,height:i},this.mipmaps=t,this.flipY=!1,this.generateMipmaps=!1}function Ue(t,e,i,r,a,o,s,c,h){n.call(this,t,e,i,r,a,o,s,c,h),this.needsUpdate=!0}function Oe(t,e,i,r,a,o,s,c,h,l){if((l=void 0!==l?l:Bo)!==Bo&&l!==zo)throw new Error("DepthTexture format must be either THREE.DepthFormat or THREE.DepthStencilFormat");void 0===i&&l===Bo&&(i=Mo),void 0===i&&l===zo&&(i=Co),n.call(this,null,r,a,o,s,c,l,i,h),this.image={width:t,height:e},this.magFilter=void 0!==s?s:fo,this.minFilter=void 0!==c?c:fo,this.flipY=!1,this.generateMipmaps=!1}function De(t){At.call(this),this.type="WireframeGeometry";var e,i,n,r,a,o,s,h,l,u,p=[],d=[0,0],f={},m=["a","b","c"];if(t&&t.isGeometry){var v=t.faces;for(e=0,n=v.length;e<n;e++){var g=v[e];for(i=0;i<3;i++)s=g[m[i]],h=g[m[(i+1)%3]],d[0]=Math.min(s,h),d[1]=Math.max(s,h),l=d[0]+","+d[1],void 0===f[l]&&(f[l]={index1:d[0],index2:d[1]})}for(l in f)o=f[l],u=t.vertices[o.index1],p.push(u.x,u.y,u.z),u=t.vertices[o.index2],p.push(u.x,u.y,u.z)}else if(t&&t.isBufferGeometry){var y,x,b,_,w,M,E,T;if(u=new c,null!==t.index){for(y=t.attributes.position,x=t.index,b=t.groups,0===b.length&&(b=[{start:0,count:x.count,materialIndex:0}]),r=0,a=b.length;r<a;++r)for(_=b[r],w=_.start,M=_.count,e=w,n=w+M;e<n;e+=3)for(i=0;i<3;i++)s=x.getX(e+i),h=x.getX(e+(i+1)%3),d[0]=Math.min(s,h),d[1]=Math.max(s,h),l=d[0]+","+d[1],void 0===f[l]&&(f[l]={index1:d[0],index2:d[1]});for(l in f)o=f[l],u.fromBufferAttribute(y,o.index1),p.push(u.x,u.y,u.z),u.fromBufferAttribute(y,o.index2),p.push(u.x,u.y,u.z)}else for(y=t.attributes.position,e=0,n=y.count/3;e<n;e++)for(i=0;i<3;i++)E=3*e+i,u.fromBufferAttribute(y,E),p.push(u.x,u.y,u.z),T=3*e+(i+1)%3,u.fromBufferAttribute(y,T),p.push(u.x,u.y,u.z)}this.addAttribute("position",new _t(p,3))}function Ne(t,e,i){St.call(this),this.type="ParametricGeometry",this.parameters={func:t,slices:e,stacks:i},this.fromBufferGeometry(new Fe(t,e,i)),this.mergeVertices()}function Fe(t,e,i){At.call(this),this.type="ParametricBufferGeometry",this.parameters={func:t,slices:e,stacks:i};var n,r,a=[],o=[],s=[],h=[],l=new c,u=new c,p=new c,d=new c,f=new c,m=e+1;for(n=0;n<=i;n++){var v=n/i;for(r=0;r<=e;r++){var g=r/e;u=t(g,v,u),o.push(u.x,u.y,u.z),g-1e-5>=0?(p=t(g-1e-5,v,p),d.subVectors(u,p)):(p=t(g+1e-5,v,p),d.subVectors(p,u)),v-1e-5>=0?(p=t(g,v-1e-5,p),f.subVectors(u,p)):(p=t(g,v+1e-5,p),f.subVectors(p,u)),l.crossVectors(d,f).normalize(),s.push(l.x,l.y,l.z),h.push(g,v)}}for(n=0;n<i;n++)for(r=0;r<e;r++){var y=n*m+r,x=n*m+r+1,b=(n+1)*m+r+1,_=(n+1)*m+r;a.push(y,x,_),a.push(x,b,_)}this.setIndex(a),this.addAttribute("position",new _t(o,3)),this.addAttribute("normal",new _t(s,3)),this.addAttribute("uv",new _t(h,2))}function Be(t,e,i,n){St.call(this),this.type="PolyhedronGeometry",this.parameters={vertices:t,indices:e,radius:i,detail:n},this.fromBufferGeometry(new ze(t,e,i,n)),this.mergeVertices()}function ze(t,e,n,r){function a(t,e,i,n){var r,a,o=Math.pow(2,n),c=[];for(r=0;r<=o;r++){c[r]=[];var h=t.clone().lerp(i,r/o),l=e.clone().lerp(i,r/o),u=o-r;for(a=0;a<=u;a++)c[r][a]=0===a&&r===o?h:h.clone().lerp(l,a/u)}for(r=0;r<o;r++)for(a=0;a<2*(o-r)-1;a++){var p=Math.floor(a/2);a%2==0?(s(c[r][p+1]),s(c[r+1][p]),s(c[r][p])):(s(c[r][p+1]),s(c[r+1][p+1]),s(c[r+1][p]))}}function o(){for(var t=0;t<m.length;t+=6){var e=m[t+0],i=m[t+2],n=m[t+4],r=Math.max(e,i,n),a=Math.min(e,i,n);r>.9&&a<.1&&(e<.2&&(m[t+0]+=1),i<.2&&(m[t+2]+=1),n<.2&&(m[t+4]+=1))}}function s(t){f.push(t.x,t.y,t.z)}function h(e,i){var n=3*e;i.x=t[n+0],i.y=t[n+1],i.z=t[n+2]}function l(){for(var t=new c,e=new c,n=new c,r=new c,a=new i,o=new i,s=new i,h=0,l=0;h<f.length;h+=9,l+=6){t.set(f[h+0],f[h+1],f[h+2]),e.set(f[h+3],f[h+4],f[h+5]),n.set(f[h+6],f[h+7],f[h+8]),a.set(m[l+0],m[l+1]),o.set(m[l+2],m[l+3]),s.set(m[l+4],m[l+5]),r.copy(t).add(e).add(n).divideScalar(3);var d=p(r);u(a,l+0,t,d),u(o,l+2,e,d),u(s,l+4,n,d)}}function u(t,e,i,n){n<0&&1===t.x&&(m[e]=t.x-1),0===i.x&&0===i.z&&(m[e]=n/2/Math.PI+.5)}function p(t){return Math.atan2(t.z,-t.x)}function d(t){return Math.atan2(-t.y,Math.sqrt(t.x*t.x+t.z*t.z))}At.call(this),this.type="PolyhedronBufferGeometry",this.parameters={vertices:t,indices:e,radius:n,detail:r},n=n||1,r=r||0;var f=[],m=[];!function(t){for(var i=new c,n=new c,r=new c,o=0;o<e.length;o+=3)h(e[o+0],i),h(e[o+1],n),h(e[o+2],r),a(i,n,r,t)}(r),function(t){for(var e=new c,i=0;i<f.length;i+=3)e.x=f[i+0],e.y=f[i+1],e.z=f[i+2],e.normalize().multiplyScalar(t),f[i+0]=e.x,f[i+1]=e.y,f[i+2]=e.z}(n),function(){for(var t=new c,e=0;e<f.length;e+=3){t.x=f[e+0],t.y=f[e+1],t.z=f[e+2];var i=p(t)/2/Math.PI+.5,n=d(t)/Math.PI+.5;m.push(i,1-n)}l(),o()}(),this.addAttribute("position",new _t(f,3)),this.addAttribute("normal",new _t(f.slice(),3)),this.addAttribute("uv",new _t(m,2)),this.normalizeNormals()}function Ge(t,e){St.call(this),this.type="TetrahedronGeometry",this.parameters={radius:t,detail:e},this.fromBufferGeometry(new He(t,e)),this.mergeVertices()}function He(t,e){var i=[1,1,1,-1,-1,1,-1,1,-1,1,-1,-1],n=[2,1,0,0,3,2,1,3,0,2,3,1];ze.call(this,i,n,t,e),this.type="TetrahedronBufferGeometry",this.parameters={radius:t,detail:e}}function Ve(t,e){St.call(this),this.type="OctahedronGeometry",this.parameters={radius:t,detail:e},this.fromBufferGeometry(new ke(t,e)),this.mergeVertices()}function ke(t,e){var i=[1,0,0,-1,0,0,0,1,0,0,-1,0,0,0,1,0,0,-1],n=[0,2,4,0,4,3,0,3,5,0,5,2,1,2,5,1,5,3,1,3,4,1,4,2];ze.call(this,i,n,t,e),this.type="OctahedronBufferGeometry",this.parameters={radius:t,detail:e}}function je(t,e){St.call(this),this.type="IcosahedronGeometry",this.parameters={radius:t,detail:e},this.fromBufferGeometry(new We(t,e)),this.mergeVertices()}function We(t,e){var i=(1+Math.sqrt(5))/2,n=[-1,i,0,1,i,0,-1,-i,0,1,-i,0,0,-1,i,0,1,i,0,-1,-i,0,1,-i,i,0,-1,i,0,1,-i,0,-1,-i,0,1],r=[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];ze.call(this,n,r,t,e),this.type="IcosahedronBufferGeometry",this.parameters={radius:t,detail:e}}function Xe(t,e){St.call(this),this.type="DodecahedronGeometry",this.parameters={radius:t,detail:e},this.fromBufferGeometry(new qe(t,e)),this.mergeVertices()}function qe(t,e){var i=(1+Math.sqrt(5))/2,n=1/i,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,-n,-i,0,-n,i,0,n,-i,0,n,i,-n,-i,0,-n,i,0,n,-i,0,n,i,0,-i,0,-n,i,0,-n,-i,0,n,i,0,n],a=[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];ze.call(this,r,a,t,e),this.type="DodecahedronBufferGeometry",this.parameters={radius:t,detail:e}}function Ye(t,e,i,n,r,a){St.call(this),this.type="TubeGeometry",this.parameters={path:t,tubularSegments:e,radius:i,radialSegments:n,closed:r},void 0!==a&&console.warn("THREE.TubeGeometry: taper has been removed.");var o=new Ze(t,e,i,n,r);this.tangents=o.tangents,this.normals=o.normals,this.binormals=o.binormals,this.fromBufferGeometry(o),this.mergeVertices()}function Ze(t,e,n,r,a){function o(i){var a=t.getPointAt(i/e),o=l.normals[i],s=l.binormals[i];for(p=0;p<=r;p++){var c=p/r*Math.PI*2,h=Math.sin(c),u=-Math.cos(c);f.x=u*o.x+h*s.x,f.y=u*o.y+h*s.y,f.z=u*o.z+h*s.z,f.normalize(),g.push(f.x,f.y,f.z),d.x=a.x+n*f.x,d.y=a.y+n*f.y,d.z=a.z+n*f.z,v.push(d.x,d.y,d.z)}}function s(){for(p=1;p<=e;p++)for(u=1;u<=r;u++){var t=(r+1)*(p-1)+(u-1),i=(r+1)*p+(u-1),n=(r+1)*p+u,a=(r+1)*(p-1)+u;x.push(t,i,a),x.push(i,n,a)}}function h(){for(u=0;u<=e;u++)for(p=0;p<=r;p++)m.x=u/e,m.y=p/r,y.push(m.x,m.y)}At.call(this),this.type="TubeBufferGeometry",this.parameters={path:t,tubularSegments:e,radius:n,radialSegments:r,closed:a},e=e||64,n=n||1,r=r||8,a=a||!1;var l=t.computeFrenetFrames(e,a);this.tangents=l.tangents,this.normals=l.normals,this.binormals=l.binormals;var u,p,d=new c,f=new c,m=new i,v=[],g=[],y=[],x=[];!function(){for(u=0;u<e;u++)o(u);o(!1===a?e:0),h(),s()}(),this.setIndex(x),this.addAttribute("position",new _t(v,3)),this.addAttribute("normal",new _t(g,3)),this.addAttribute("uv",new _t(y,2))}function Je(t,e,i,n,r,a,o){St.call(this),this.type="TorusKnotGeometry",this.parameters={radius:t,tube:e,tubularSegments:i,radialSegments:n,p:r,q:a},void 0!==o&&console.warn("THREE.TorusKnotGeometry: heightScale has been deprecated. Use .scale( x, y, z ) instead."),this.fromBufferGeometry(new Qe(t,e,i,n,r,a)),this.mergeVertices()}function Qe(t,e,i,n,r,a){function o(t,e,i,n,r){var a=Math.cos(t),o=Math.sin(t),s=i/e*t,c=Math.cos(s);r.x=n*(2+c)*.5*a,r.y=n*(2+c)*o*.5,r.z=n*Math.sin(s)*.5}At.call(this),this.type="TorusKnotBufferGeometry",this.parameters={radius:t,tube:e,tubularSegments:i,radialSegments:n,p:r,q:a},t=t||100,e=e||40,i=Math.floor(i)||64,n=Math.floor(n)||8,r=r||2,a=a||3;var s,h,l=[],u=[],p=[],d=[],f=new c,m=new c,v=new c,g=new c,y=new c,x=new c,b=new c;for(s=0;s<=i;++s){var _=s/i*r*Math.PI*2;for(o(_,r,a,t,v),o(_+.01,r,a,t,g),x.subVectors(g,v),b.addVectors(g,v),y.crossVectors(x,b),b.crossVectors(y,x),y.normalize(),b.normalize(),h=0;h<=n;++h){var w=h/n*Math.PI*2,M=-e*Math.cos(w),E=e*Math.sin(w);f.x=v.x+(M*b.x+E*y.x),f.y=v.y+(M*b.y+E*y.y),f.z=v.z+(M*b.z+E*y.z),u.push(f.x,f.y,f.z),m.subVectors(f,v).normalize(),p.push(m.x,m.y,m.z),d.push(s/i),d.push(h/n)}}for(h=1;h<=i;h++)for(s=1;s<=n;s++){var T=(n+1)*(h-1)+(s-1),S=(n+1)*h+(s-1),A=(n+1)*h+s,L=(n+1)*(h-1)+s;l.push(T,S,L),l.push(S,A,L)}this.setIndex(l),this.addAttribute("position",new _t(u,3)),this.addAttribute("normal",new _t(p,3)),this.addAttribute("uv",new _t(d,2))}function Ke(t,e,i,n,r){St.call(this),this.type="TorusGeometry",this.parameters={radius:t,tube:e,radialSegments:i,tubularSegments:n,arc:r},this.fromBufferGeometry(new $e(t,e,i,n,r)),this.mergeVertices()}function $e(t,e,i,n,r){At.call(this),this.type="TorusBufferGeometry",this.parameters={radius:t,tube:e,radialSegments:i,tubularSegments:n,arc:r},t=t||100,e=e||40,i=Math.floor(i)||8,n=Math.floor(n)||6,r=r||2*Math.PI;var a,o,s=[],h=[],l=[],u=[],p=new c,d=new c,f=new c;for(a=0;a<=i;a++)for(o=0;o<=n;o++){var m=o/n*r,v=a/i*Math.PI*2;d.x=(t+e*Math.cos(v))*Math.cos(m),d.y=(t+e*Math.cos(v))*Math.sin(m),d.z=e*Math.sin(v),h.push(d.x,d.y,d.z),p.x=t*Math.cos(m),p.y=t*Math.sin(m),f.subVectors(d,p).normalize(),l.push(f.x,f.y,f.z),u.push(o/n),u.push(a/i)}for(a=1;a<=i;a++)for(o=1;o<=n;o++){var g=(n+1)*a+o-1,y=(n+1)*(a-1)+o-1,x=(n+1)*(a-1)+o,b=(n+1)*a+o;s.push(g,y,b),s.push(y,x,b)}this.setIndex(s),this.addAttribute("position",new _t(h,3)),this.addAttribute("normal",new _t(l,3)),this.addAttribute("uv",new _t(u,2))}function ti(t,e){St.call(this),this.type="ExtrudeGeometry",this.parameters={shapes:t,options:e},this.fromBufferGeometry(new ei(t,e)),this.mergeVertices()}function ei(t,e){if(void 0===t)return void(t=[]);At.call(this),this.type="ExtrudeBufferGeometry",t=Array.isArray(t)?t:[t],this.addShapeList(t,e),this.computeVertexNormals()}function ii(t,e){St.call(this),this.type="TextGeometry",this.parameters={text:t,parameters:e},this.fromBufferGeometry(new ni(t,e)),this.mergeVertices()}function ni(t,e){e=e||{};var i=e.font;if(!1===(i&&i.isFont))return console.error("THREE.TextGeometry: font parameter is not an instance of THREE.Font."),new St;var n=i.generateShapes(t,e.size,e.curveSegments);e.amount=void 0!==e.height?e.height:50,void 0===e.bevelThickness&&(e.bevelThickness=10),void 0===e.bevelSize&&(e.bevelSize=8),void 0===e.bevelEnabled&&(e.bevelEnabled=!1),ei.call(this,n,e),this.type="TextBufferGeometry"}function ri(t,e,i,n,r,a,o){St.call(this),this.type="SphereGeometry",this.parameters={radius:t,widthSegments:e,heightSegments:i,phiStart:n,phiLength:r,thetaStart:a,thetaLength:o},this.fromBufferGeometry(new ai(t,e,i,n,r,a,o)),this.mergeVertices()}function ai(t,e,i,n,r,a,o){At.call(this),this.type="SphereBufferGeometry",this.parameters={radius:t,widthSegments:e,heightSegments:i,phiStart:n,phiLength:r,thetaStart:a,thetaLength:o},t=t||50,e=Math.max(3,Math.floor(e)||8),i=Math.max(2,Math.floor(i)||6),n=void 0!==n?n:0,r=void 0!==r?r:2*Math.PI,a=void 0!==a?a:0,o=void 0!==o?o:Math.PI;var s,h,l=a+o,u=0,p=[],d=new c,f=new c,m=[],v=[],g=[],y=[];for(h=0;h<=i;h++){var x=[],b=h/i;for(s=0;s<=e;s++){var _=s/e;d.x=-t*Math.cos(n+_*r)*Math.sin(a+b*o),d.y=t*Math.cos(a+b*o),d.z=t*Math.sin(n+_*r)*Math.sin(a+b*o),v.push(d.x,d.y,d.z),f.set(d.x,d.y,d.z).normalize(),g.push(f.x,f.y,f.z),y.push(_,1-b),x.push(u++)}p.push(x)}for(h=0;h<i;h++)for(s=0;s<e;s++){var w=p[h][s+1],M=p[h][s],E=p[h+1][s],T=p[h+1][s+1];(0!==h||a>0)&&m.push(w,M,T),(h!==i-1||l<Math.PI)&&m.push(M,E,T)}this.setIndex(m),this.addAttribute("position",new _t(v,3)),this.addAttribute("normal",new _t(g,3)),this.addAttribute("uv",new _t(y,2))}function oi(t,e,i,n,r,a){St.call(this),this.type="RingGeometry",this.parameters={innerRadius:t,outerRadius:e,thetaSegments:i,phiSegments:n,thetaStart:r,thetaLength:a},this.fromBufferGeometry(new si(t,e,i,n,r,a)),this.mergeVertices()}function si(t,e,n,r,a,o){At.call(this),this.type="RingBufferGeometry",this.parameters={innerRadius:t,outerRadius:e,thetaSegments:n,phiSegments:r,thetaStart:a,thetaLength:o},t=t||20,e=e||50,a=void 0!==a?a:0,o=void 0!==o?o:2*Math.PI,n=void 0!==n?Math.max(3,n):8,r=void 0!==r?Math.max(1,r):1;var s,h,l,u=[],p=[],d=[],f=[],m=t,v=(e-t)/r,g=new c,y=new i;for(h=0;h<=r;h++){for(l=0;l<=n;l++)s=a+l/n*o,g.x=m*Math.cos(s),g.y=m*Math.sin(s),p.push(g.x,g.y,g.z),d.push(0,0,1),y.x=(g.x/e+1)/2,y.y=(g.y/e+1)/2,f.push(y.x,y.y);m+=v}for(h=0;h<r;h++){var x=h*(n+1);for(l=0;l<n;l++){s=l+x;var b=s,_=s+n+1,w=s+n+2,M=s+1;u.push(b,_,M),u.push(_,w,M)}}this.setIndex(u),this.addAttribute("position",new _t(p,3)),this.addAttribute("normal",new _t(d,3)),this.addAttribute("uv",new _t(f,2))}function ci(t,e,i,n){St.call(this),this.type="LatheGeometry",this.parameters={points:t,segments:e,phiStart:i,phiLength:n},this.fromBufferGeometry(new hi(t,e,i,n)),this.mergeVertices()}function hi(t,e,n,r){At.call(this),this.type="LatheBufferGeometry",this.parameters={points:t,segments:e,phiStart:n,phiLength:r},e=Math.floor(e)||12,n=n||0,r=r||2*Math.PI,r=hs.clamp(r,0,2*Math.PI);var a,o,s,h=[],l=[],u=[],p=1/e,d=new c,f=new i;for(o=0;o<=e;o++){var m=n+o*p*r,v=Math.sin(m),g=Math.cos(m);for(s=0;s<=t.length-1;s++)d.x=t[s].x*v,d.y=t[s].y,d.z=t[s].x*g,l.push(d.x,d.y,d.z),f.x=o/e,f.y=s/(t.length-1),u.push(f.x,f.y)}for(o=0;o<e;o++)for(s=0;s<t.length-1;s++){a=s+o*t.length;var y=a,x=a+t.length,b=a+t.length+1,_=a+1;h.push(y,x,_),h.push(x,b,_)}if(this.setIndex(h),this.addAttribute("position",new _t(l,3)),this.addAttribute("uv",new _t(u,2)),this.computeVertexNormals(),r===2*Math.PI){var w=this.attributes.normal.array,M=new c,E=new c,T=new c;for(a=e*t.length*3,o=0,s=0;o<t.length;o++,s+=3)M.x=w[s+0],M.y=w[s+1],M.z=w[s+2],E.x=w[a+s+0],E.y=w[a+s+1],E.z=w[a+s+2],T.addVectors(M,E).normalize(),w[s+0]=w[a+s+0]=T.x,w[s+1]=w[a+s+1]=T.y,w[s+2]=w[a+s+2]=T.z}}function li(t,e){St.call(this),this.type="ShapeGeometry","object"==typeof e&&(console.warn("THREE.ShapeGeometry: Options parameter has been removed."),e=e.curveSegments),this.parameters={shapes:t,curveSegments:e},this.fromBufferGeometry(new ui(t,e)),this.mergeVertices()}function ui(t,e){function i(t){var i,s,h,l=r.length/3,u=t.extractPoints(e),p=u.shape,d=u.holes;if(!1===As.isClockWise(p))for(p=p.reverse(),i=0,s=d.length;i<s;i++)h=d[i],!0===As.isClockWise(h)&&(d[i]=h.reverse());var f=As.triangulateShape(p,d);for(i=0,s=d.length;i<s;i++)h=d[i],p=p.concat(h);for(i=0,s=p.length;i<s;i++){var m=p[i];r.push(m.x,m.y,0),a.push(0,0,1),o.push(m.x,m.y)}for(i=0,s=f.length;i<s;i++){var v=f[i],g=v[0]+l,y=v[1]+l,x=v[2]+l;n.push(g,y,x),c+=3}}At.call(this),this.type="ShapeBufferGeometry",this.parameters={shapes:t,curveSegments:e},e=e||12;var n=[],r=[],a=[],o=[],s=0,c=0;if(!1===Array.isArray(t))i(t);else for(var h=0;h<t.length;h++)i(t[h]),this.addGroup(s,c,h),s+=c,c=0;this.setIndex(n),this.addAttribute("position",new _t(r,3)),this.addAttribute("normal",new _t(a,3)),this.addAttribute("uv",new _t(o,2))}function pi(t,e){At.call(this),this.type="EdgesGeometry",this.parameters={thresholdAngle:e},e=void 0!==e?e:1;var i,n,r,a,o=[],s=Math.cos(hs.DEG2RAD*e),c=[0,0],h={},l=["a","b","c"];t.isBufferGeometry?(a=new St,a.fromBufferGeometry(t)):a=t.clone(),a.mergeVertices(),a.computeFaceNormals();for(var u=a.vertices,p=a.faces,d=0,f=p.length;d<f;d++)for(var m=p[d],v=0;v<3;v++)i=m[l[v]],n=m[l[(v+1)%3]],c[0]=Math.min(i,n),c[1]=Math.max(i,n),r=c[0]+","+c[1],void 0===h[r]?h[r]={index1:c[0],index2:c[1],face1:d,face2:void 0}:h[r].face2=d;for(r in h){var g=h[r];if(void 0===g.face2||p[g.face1].normal.dot(p[g.face2].normal)<=s){var y=u[g.index1];o.push(y.x,y.y,y.z),y=u[g.index2],o.push(y.x,y.y,y.z)}}this.addAttribute("position",new _t(o,3))}function di(t,e,i,n,r,a,o,s){St.call(this),this.type="CylinderGeometry",this.parameters={radiusTop:t,radiusBottom:e,height:i,radialSegments:n,heightSegments:r,openEnded:a,thetaStart:o,thetaLength:s},this.fromBufferGeometry(new fi(t,e,i,n,r,a,o,s)),this.mergeVertices()}function fi(t,e,n,r,a,o,s,h){function l(n){var a,o,l,g=new i,b=new c,_=0,w=!0===n?t:e,M=!0===n?1:-1;for(o=v,a=1;a<=r;a++)d.push(0,y*M,0),f.push(0,M,0),m.push(.5,.5),v++;for(l=v,a=0;a<=r;a++){var E=a/r,T=E*h+s,S=Math.cos(T),A=Math.sin(T);b.x=w*A,b.y=y*M,b.z=w*S,d.push(b.x,b.y,b.z),f.push(0,M,0),g.x=.5*S+.5,g.y=.5*A*M+.5,m.push(g.x,g.y),v++}for(a=0;a<r;a++){var L=o+a,R=l+a;!0===n?p.push(R,R+1,L):p.push(R+1,R,L),_+=3}u.addGroup(x,_,!0===n?1:2),x+=_}At.call(this),this.type="CylinderBufferGeometry",this.parameters={radiusTop:t,radiusBottom:e,height:n,radialSegments:r,heightSegments:a,openEnded:o,thetaStart:s,thetaLength:h};var u=this;t=void 0!==t?t:20,e=void 0!==e?e:20,n=void 0!==n?n:100,r=Math.floor(r)||8,a=Math.floor(a)||1,o=void 0!==o&&o,s=void 0!==s?s:0,h=void 0!==h?h:2*Math.PI;var p=[],d=[],f=[],m=[],v=0,g=[],y=n/2,x=0;!function(){var i,o,l=new c,b=new c,_=0,w=(e-t)/n;for(o=0;o<=a;o++){var M=[],E=o/a,T=E*(e-t)+t;for(i=0;i<=r;i++){var S=i/r,A=S*h+s,L=Math.sin(A),R=Math.cos(A);b.x=T*L,b.y=-E*n+y,b.z=T*R,d.push(b.x,b.y,b.z),l.set(L,w,R).normalize(),f.push(l.x,l.y,l.z),m.push(S,1-E),M.push(v++)}g.push(M)}for(i=0;i<r;i++)for(o=0;o<a;o++){var P=g[o][i],C=g[o+1][i],I=g[o+1][i+1],U=g[o][i+1];p.push(P,C,U),p.push(C,I,U),_+=6}u.addGroup(x,_,0),x+=_}(),!1===o&&(t>0&&l(!0),e>0&&l(!1)),this.setIndex(p),this.addAttribute("position",new _t(d,3)),this.addAttribute("normal",new _t(f,3)),this.addAttribute("uv",new _t(m,2))}function mi(t,e,i,n,r,a,o){di.call(this,0,t,e,i,n,r,a,o),this.type="ConeGeometry",this.parameters={radius:t,height:e,radialSegments:i,heightSegments:n,openEnded:r,thetaStart:a,thetaLength:o}}function vi(t,e,i,n,r,a,o){fi.call(this,0,t,e,i,n,r,a,o),this.type="ConeBufferGeometry",this.parameters={radius:t,height:e,radialSegments:i,heightSegments:n,openEnded:r,thetaStart:a,thetaLength:o}}function gi(t,e,i,n){St.call(this),this.type="CircleGeometry",this.parameters={radius:t,segments:e,thetaStart:i,thetaLength:n},this.fromBufferGeometry(new yi(t,e,i,n)),this.mergeVertices()}function yi(t,e,n,r){At.call(this),this.type="CircleBufferGeometry",this.parameters={radius:t,segments:e,thetaStart:n,thetaLength:r},t=t||50,e=void 0!==e?Math.max(3,e):8,n=void 0!==n?n:0,r=void 0!==r?r:2*Math.PI;var a,o,s=[],h=[],l=[],u=[],p=new c,d=new i;for(h.push(0,0,0),l.push(0,0,1),u.push(.5,.5),o=0,a=3;o<=e;o++,a+=3){var f=n+o/e*r;p.x=t*Math.cos(f),p.y=t*Math.sin(f),h.push(p.x,p.y,p.z),l.push(0,0,1),d.x=(h[a]/t+1)/2,d.y=(h[a+1]/t+1)/2,u.push(d.x,d.y)}for(a=1;a<=e;a++)s.push(a,a+1,0);this.setIndex(s),
this.addAttribute("position",new _t(h,3)),this.addAttribute("normal",new _t(l,3)),this.addAttribute("uv",new _t(u,2))}function xi(t){Q.call(this,{uniforms:bs.merge([xs.lights,{opacity:{value:1}}]),vertexShader:_s.shadow_vert,fragmentShader:_s.shadow_frag}),this.lights=!0,this.transparent=!0,Object.defineProperties(this,{opacity:{enumerable:!0,get:function(){return this.uniforms.opacity.value},set:function(t){this.uniforms.opacity.value=t}}}),this.setValues(t)}function bi(t){Q.call(this,t),this.type="RawShaderMaterial"}function _i(t){J.call(this),this.defines={STANDARD:""},this.type="MeshStandardMaterial",this.color=new X(16777215),this.roughness=.5,this.metalness=.5,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new X(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalScale=new i(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.roughnessMap=null,this.metalnessMap=null,this.alphaMap=null,this.envMap=null,this.envMapIntensity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.skinning=!1,this.morphTargets=!1,this.morphNormals=!1,this.setValues(t)}function wi(t){_i.call(this),this.defines={PHYSICAL:""},this.type="MeshPhysicalMaterial",this.reflectivity=.5,this.clearCoat=0,this.clearCoatRoughness=0,this.setValues(t)}function Mi(t){J.call(this),this.type="MeshPhongMaterial",this.color=new X(16777215),this.specular=new X(1118481),this.shininess=30,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new X(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalScale=new i(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.combine=Za,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.skinning=!1,this.morphTargets=!1,this.morphNormals=!1,this.setValues(t)}function Ei(t){Mi.call(this),this.defines={TOON:""},this.type="MeshToonMaterial",this.gradientMap=null,this.setValues(t)}function Ti(t){J.call(this,t),this.type="MeshNormalMaterial",this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalScale=new i(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.wireframe=!1,this.wireframeLinewidth=1,this.fog=!1,this.lights=!1,this.skinning=!1,this.morphTargets=!1,this.morphNormals=!1,this.setValues(t)}function Si(t){J.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=Za,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.skinning=!1,this.morphTargets=!1,this.morphNormals=!1,this.setValues(t)}function Ai(t){J.call(this),this.type="LineDashedMaterial",this.color=new X(16777215),this.linewidth=1,this.scale=1,this.dashSize=3,this.gapSize=1,this.lights=!1,this.setValues(t)}function Li(t,e,i){var n=this,r=!1,a=0,o=0;this.onStart=void 0,this.onLoad=t,this.onProgress=e,this.onError=i,this.itemStart=function(t){o++,!1===r&&void 0!==n.onStart&&n.onStart(t,a,o),r=!0},this.itemEnd=function(t){a++,void 0!==n.onProgress&&n.onProgress(t,a,o),a===o&&(r=!1,void 0!==n.onLoad&&n.onLoad())},this.itemError=function(t){void 0!==n.onError&&n.onError(t)}}function Ri(t){this.manager=void 0!==t?t:Cs}function Pi(t){this.manager=void 0!==t?t:Cs,this._parser=null}function Ci(t){this.manager=void 0!==t?t:Cs,this._parser=null}function Ii(t){this.manager=void 0!==t?t:Cs}function Ui(t){this.manager=void 0!==t?t:Cs}function Oi(t){this.manager=void 0!==t?t:Cs}function Di(t,e){ct.call(this),this.type="Light",this.color=new X(t),this.intensity=void 0!==e?e:1,this.receiveShadow=void 0}function Ni(t,e,i){Di.call(this,t,i),this.type="HemisphereLight",this.castShadow=void 0,this.position.copy(ct.DefaultUp),this.updateMatrix(),this.groundColor=new X(e)}function Fi(t){this.camera=t,this.bias=0,this.radius=1,this.mapSize=new i(512,512),this.map=null,this.matrix=new h}function Bi(){Fi.call(this,new Ot(50,1,.5,500))}function zi(t,e,i,n,r,a){Di.call(this,t,e),this.type="SpotLight",this.position.copy(ct.DefaultUp),this.updateMatrix(),this.target=new ct,Object.defineProperty(this,"power",{get:function(){return this.intensity*Math.PI},set:function(t){this.intensity=t/Math.PI}}),this.distance=void 0!==i?i:0,this.angle=void 0!==n?n:Math.PI/3,this.penumbra=void 0!==r?r:0,this.decay=void 0!==a?a:1,this.shadow=new Bi}function Gi(t,e,i,n){Di.call(this,t,e),this.type="PointLight",Object.defineProperty(this,"power",{get:function(){return 4*this.intensity*Math.PI},set:function(t){this.intensity=t/(4*Math.PI)}}),this.distance=void 0!==i?i:0,this.decay=void 0!==n?n:1,this.shadow=new Fi(new Ot(90,1,.5,500))}function Hi(){Fi.call(this,new Dt(-5,5,5,-5,.5,500))}function Vi(t,e){Di.call(this,t,e),this.type="DirectionalLight",this.position.copy(ct.DefaultUp),this.updateMatrix(),this.target=new ct,this.shadow=new Hi}function ki(t,e){Di.call(this,t,e),this.type="AmbientLight",this.castShadow=void 0}function ji(t,e,i,n){Di.call(this,t,e),this.type="RectAreaLight",this.position.set(0,1,0),this.updateMatrix(),this.width=void 0!==i?i:10,this.height=void 0!==n?n:10}function Wi(t,e,i,n){this.parameterPositions=t,this._cachedIndex=0,this.resultBuffer=void 0!==n?n:new e.constructor(i),this.sampleValues=e,this.valueSize=i}function Xi(t,e,i,n){Wi.call(this,t,e,i,n),this._weightPrev=-0,this._offsetPrev=-0,this._weightNext=-0,this._offsetNext=-0}function qi(t,e,i,n){Wi.call(this,t,e,i,n)}function Yi(t,e,i,n){Wi.call(this,t,e,i,n)}function Zi(t,e,i,n){if(void 0===t)throw new Error("track name is undefined");if(void 0===e||0===e.length)throw new Error("no keyframes in track named "+t);this.name=t,this.times=Is.convertArray(e,this.TimeBufferType),this.values=Is.convertArray(i,this.ValueBufferType),this.setInterpolation(n||this.DefaultInterpolation),this.validate(),this.optimize()}function Ji(t,e,i,n){Zi.call(this,t,e,i,n)}function Qi(t,e,i,n){Wi.call(this,t,e,i,n)}function Ki(t,e,i,n){Zi.call(this,t,e,i,n)}function $i(t,e,i,n){Zi.call(this,t,e,i,n)}function tn(t,e,i,n){Zi.call(this,t,e,i,n)}function en(t,e,i){Zi.call(this,t,e,i)}function nn(t,e,i,n){Zi.call(this,t,e,i,n)}function rn(t,e,i,n){Zi.apply(this,arguments)}function an(t,e,i){this.name=t,this.tracks=i,this.duration=void 0!==e?e:-1,this.uuid=hs.generateUUID(),this.duration<0&&this.resetDuration(),this.optimize()}function on(t){this.manager=void 0!==t?t:Cs,this.textures={}}function sn(t){this.manager=void 0!==t?t:Cs}function cn(){this.onLoadStart=function(){},this.onLoadProgress=function(){},this.onLoadComplete=function(){}}function hn(t){"boolean"==typeof t&&(console.warn("THREE.JSONLoader: showStatus parameter has been removed from constructor."),t=void 0),this.manager=void 0!==t?t:Cs,this.withCredentials=!1}function ln(t){this.manager=void 0!==t?t:Cs,this.texturePath=""}function un(t,e,i,n,r){var a=.5*(n-e),o=.5*(r-i),s=t*t;return(2*i-2*n+a+o)*(t*s)+(-3*i+3*n-2*a-o)*s+a*t+i}function pn(t,e){var i=1-t;return i*i*e}function dn(t,e){return 2*(1-t)*t*e}function fn(t,e){return t*t*e}function mn(t,e,i,n){return pn(t,e)+dn(t,i)+fn(t,n)}function vn(t,e){var i=1-t;return i*i*i*e}function gn(t,e){var i=1-t;return 3*i*i*t*e}function yn(t,e){return 3*(1-t)*t*t*e}function xn(t,e){return t*t*t*e}function bn(t,e,i,n,r){return vn(t,e)+gn(t,i)+yn(t,n)+xn(t,r)}function _n(){this.arcLengthDivisions=200}function wn(t,e){_n.call(this),this.v1=t,this.v2=e}function Mn(){_n.call(this),this.curves=[],this.autoClose=!1}function En(t,e,i,n,r,a,o,s){_n.call(this),this.aX=t,this.aY=e,this.xRadius=i,this.yRadius=n,this.aStartAngle=r,this.aEndAngle=a,this.aClockwise=o,this.aRotation=s||0}function Tn(t){_n.call(this),this.points=void 0===t?[]:t}function Sn(t,e,i,n){_n.call(this),this.v0=t,this.v1=e,this.v2=i,this.v3=n}function An(t,e,i){_n.call(this),this.v0=t,this.v1=e,this.v2=i}function Ln(t){Mn.call(this),this.currentPoint=new i,t&&this.fromPoints(t)}function Rn(){Ln.apply(this,arguments),this.holes=[]}function Pn(){this.subPaths=[],this.currentPath=null}function Cn(t){this.data=t}function In(t){this.manager=void 0!==t?t:Cs}function Un(t){this.manager=void 0!==t?t:Cs}function On(){this.type="StereoCamera",this.aspect=1,this.eyeSep=.064,this.cameraL=new Ot,this.cameraL.layers.enable(1),this.cameraL.matrixAutoUpdate=!1,this.cameraR=new Ot,this.cameraR.layers.enable(2),this.cameraR.matrixAutoUpdate=!1}function Dn(t,e,i){ct.call(this),this.type="CubeCamera";var n=new Ot(90,1,t,e);n.up.set(0,-1,0),n.lookAt(new c(1,0,0)),this.add(n);var r=new Ot(90,1,t,e);r.up.set(0,-1,0),r.lookAt(new c(-1,0,0)),this.add(r);var a=new Ot(90,1,t,e);a.up.set(0,0,1),a.lookAt(new c(0,1,0)),this.add(a);var s=new Ot(90,1,t,e);s.up.set(0,0,-1),s.lookAt(new c(0,-1,0)),this.add(s);var h=new Ot(90,1,t,e);h.up.set(0,-1,0),h.lookAt(new c(0,0,1)),this.add(h);var l=new Ot(90,1,t,e);l.up.set(0,-1,0),l.lookAt(new c(0,0,-1)),this.add(l);var u={format:Uo,magFilter:go,minFilter:go};this.renderTarget=new o(i,i,u),this.renderTarget.texture.name="CubeCamera",this.updateCubeMap=function(t,e){null===this.parent&&this.updateMatrixWorld();var i=this.renderTarget,o=i.texture.generateMipmaps;i.texture.generateMipmaps=!1,i.activeCubeFace=0,t.render(e,n,i),i.activeCubeFace=1,t.render(e,r,i),i.activeCubeFace=2,t.render(e,a,i),i.activeCubeFace=3,t.render(e,s,i),i.activeCubeFace=4,t.render(e,h,i),i.texture.generateMipmaps=o,i.activeCubeFace=5,t.render(e,l,i),t.setRenderTarget(null)}}function Nn(t){Ot.call(this),this.enabled=!1,this.cameras=t||[]}function Fn(){ct.call(this),this.type="AudioListener",this.context=Gs.getContext(),this.gain=this.context.createGain(),this.gain.connect(this.context.destination),this.filter=null}function Bn(t){ct.call(this),this.type="Audio",this.context=t.context,this.gain=this.context.createGain(),this.gain.connect(t.getInput()),this.autoplay=!1,this.buffer=null,this.loop=!1,this.startTime=0,this.playbackRate=1,this.isPlaying=!1,this.hasPlaybackControl=!0,this.sourceType="empty",this.filters=[]}function zn(t){Bn.call(this,t),this.panner=this.context.createPanner(),this.panner.connect(this.gain)}function Gn(t,e){this.analyser=t.context.createAnalyser(),this.analyser.fftSize=void 0!==e?e:2048,this.data=new Uint8Array(this.analyser.frequencyBinCount),t.getOutput().connect(this.analyser)}function Hn(t,e,i){this.binding=t,this.valueSize=i;var n,r=Float64Array;switch(e){case"quaternion":n=this._slerp;break;case"string":case"bool":r=Array,n=this._select;break;default:n=this._lerp}this.buffer=new r(4*i),this._mixBufferRegion=n,this.cumulativeWeight=0,this.useCount=0,this.referenceCount=0}function Vn(t,e,i){var n=i||kn.parseTrackName(e);this._targetGroup=t,this._bindings=t.subscribe_(e,n)}function kn(t,e,i){this.path=e,this.parsedPath=i||kn.parseTrackName(e),this.node=kn.findNode(t,this.parsedPath.nodeName)||t,this.rootNode=t}function jn(t){this.uuid=hs.generateUUID(),this._objects=Array.prototype.slice.call(arguments),this.nCachedObjects_=0;var e={};this._indicesByUUID=e;for(var i=0,n=arguments.length;i!==n;++i)e[arguments[i].uuid]=i;this._paths=[],this._parsedPaths=[],this._bindings=[],this._bindingsIndicesByPath={};var r=this;this.stats={objects:{get total(){return r._objects.length},get inUse(){return this.total-r.nCachedObjects_}},get bindingsPerObject(){return r._bindings.length}}}function Wn(t,e,i){this._mixer=t,this._clip=e,this._localRoot=i||null;for(var n=e.tracks,r=n.length,a=new Array(r),o={endingStart:Jo,endingEnd:Jo},s=0;s!==r;++s){var c=n[s].createInterpolant(null);a[s]=c,c.settings=o}this._interpolantSettings=o,this._interpolants=a,this._propertyBindings=new Array(r),this._cacheIndex=null,this._byClipCacheIndex=null,this._timeScaleInterpolant=null,this._weightInterpolant=null,this.loop=Zo,this._loopCount=-1,this._startTime=null,this.time=0,this.timeScale=1,this._effectiveTimeScale=1,this.weight=1,this._effectiveWeight=1,this.repetitions=1/0,this.paused=!1,this.enabled=!0,this.clampWhenFinished=!1,this.zeroSlopeAtStart=!0,this.zeroSlopeAtEnd=!0}function Xn(t){this._root=t,this._initMemoryManager(),this._accuIndex=0,this.time=0,this.timeScale=1}function qn(t){"string"==typeof t&&(console.warn("THREE.Uniform: Type parameter is no longer needed."),t=arguments[1]),this.value=t}function Yn(){At.call(this),this.type="InstancedBufferGeometry",this.maxInstancedCount=void 0}function Zn(t,e,i,n){this.uuid=hs.generateUUID(),this.data=t,this.itemSize=e,this.offset=i,this.normalized=!0===n}function Jn(t,e){this.uuid=hs.generateUUID(),this.array=t,this.stride=e,this.count=void 0!==t?t.length/e:0,this.dynamic=!1,this.updateRange={offset:0,count:-1},this.onUploadCallback=function(){},this.version=0}function Qn(t,e,i){Jn.call(this,t,e),this.meshPerAttribute=i||1}function Kn(t,e,i){dt.call(this,t,e),this.meshPerAttribute=i||1}function $n(t,e,i,n){this.ray=new at(t,e),this.near=i||0,this.far=n||1/0,this.params={Mesh:{},Line:{},LOD:{},Points:{threshold:1},Sprite:{}},Object.defineProperties(this.params,{PointCloud:{get:function(){return console.warn("THREE.Raycaster: params.PointCloud has been renamed to params.Points."),this.Points}}})}function tr(t,e){return t.distance-e.distance}function er(t,e,i,n){if(!1!==t.visible&&(t.raycast(e,i),!0===n))for(var r=t.children,a=0,o=r.length;a<o;a++)er(r[a],e,i,!0)}function ir(t){this.autoStart=void 0===t||t,this.startTime=0,this.oldTime=0,this.elapsedTime=0,this.running=!1}function nr(t,e,i){return this.radius=void 0!==t?t:1,this.phi=void 0!==e?e:0,this.theta=void 0!==i?i:0,this}function rr(t,e,i){return this.radius=void 0!==t?t:1,this.theta=void 0!==e?e:0,this.y=void 0!==i?i:0,this}function ar(t,e){Lt.call(this,t,e),this.animationsMap={},this.animationsList=[];var i=this.geometry.morphTargets.length,n=i-1,r=i/1;this.createAnimation("__default",0,n,r),this.setAnimationWeight("__default",1)}function or(t){ct.call(this),this.material=t,this.render=function(t){}}function sr(t,e,i,n){this.object=t,this.size=void 0!==e?e:1;var r=void 0!==i?i:16711680,a=void 0!==n?n:1,o=0,s=this.object.geometry;s&&s.isGeometry?o=3*s.faces.length:s&&s.isBufferGeometry&&(o=s.attributes.normal.count);var c=new At,h=new _t(2*o*3,3);c.addAttribute("position",h),Se.call(this,c,new Ee({color:r,linewidth:a})),this.matrixAutoUpdate=!1,this.update()}function cr(t){ct.call(this),this.light=t,this.light.updateMatrixWorld(),this.matrix=t.matrixWorld,this.matrixAutoUpdate=!1;for(var e=new At,i=[0,0,0,0,0,1,0,0,0,1,0,1,0,0,0,-1,0,1,0,0,0,0,1,1,0,0,0,0,-1,1],n=0,r=1;n<32;n++,r++){var a=n/32*Math.PI*2,o=r/32*Math.PI*2;i.push(Math.cos(a),Math.sin(a),1,Math.cos(o),Math.sin(o),1)}e.addAttribute("position",new _t(i,3));var s=new Ee({fog:!1});this.cone=new Se(e,s),this.add(this.cone),this.update()}function hr(t){this.bones=this.getBoneList(t);for(var e=new At,i=[],n=[],r=new X(0,0,1),a=new X(0,1,0),o=0;o<this.bones.length;o++){var s=this.bones[o];s.parent&&s.parent.isBone&&(i.push(0,0,0),i.push(0,0,0),n.push(r.r,r.g,r.b),n.push(a.r,a.g,a.b))}e.addAttribute("position",new _t(i,3)),e.addAttribute("color",new _t(n,3));var c=new Ee({vertexColors:ya,depthTest:!1,depthWrite:!1,transparent:!0});Se.call(this,e,c),this.root=t,this.matrix=t.matrixWorld,this.matrixAutoUpdate=!1,this.update()}function lr(t,e){this.light=t,this.light.updateMatrixWorld();var i=new ai(e,4,2),n=new pt({wireframe:!0,fog:!1});n.color.copy(this.light.color),Lt.call(this,i,n),this.matrix=this.light.matrixWorld,this.matrixAutoUpdate=!1}function ur(t){ct.call(this),this.light=t,this.light.updateMatrixWorld(),this.matrix=t.matrixWorld,this.matrixAutoUpdate=!1;var e=new Ee({color:t.color}),i=new At;i.addAttribute("position",new dt(new Float32Array(15),3)),this.add(new Te(i,e)),this.update()}function pr(t,e){ct.call(this),this.light=t,this.light.updateMatrixWorld(),this.matrix=t.matrixWorld,this.matrixAutoUpdate=!1;var i=new ke(e);i.rotateY(.5*Math.PI);var n=new pt({vertexColors:ya,wireframe:!0}),r=i.getAttribute("position"),a=new Float32Array(3*r.count);i.addAttribute("color",new dt(a,3)),this.add(new Lt(i,n)),this.update()}function dr(t,e,i,n){t=t||10,e=e||10,i=new X(void 0!==i?i:4473924),n=new X(void 0!==n?n:8947848);for(var r=e/2,a=t/e,o=t/2,s=[],c=[],h=0,l=0,u=-o;h<=e;h++,u+=a){s.push(-o,0,u,o,0,u),s.push(u,0,-o,u,0,o);var p=h===r?i:n;p.toArray(c,l),l+=3,p.toArray(c,l),l+=3,p.toArray(c,l),l+=3,p.toArray(c,l),l+=3}var d=new At;d.addAttribute("position",new _t(s,3)),d.addAttribute("color",new _t(c,3));var f=new Ee({vertexColors:ya});Se.call(this,d,f)}function fr(t,e,i,n,r,a){t=t||10,e=e||16,i=i||8,n=n||64,r=new X(void 0!==r?r:4473924),a=new X(void 0!==a?a:8947848);var o,s,c,h,l,u,p,d=[],f=[];for(h=0;h<=e;h++)c=h/e*(2*Math.PI),o=Math.sin(c)*t,s=Math.cos(c)*t,d.push(0,0,0),d.push(o,0,s),p=1&h?r:a,f.push(p.r,p.g,p.b),f.push(p.r,p.g,p.b);for(h=0;h<=i;h++)for(p=1&h?r:a,u=t-t/i*h,l=0;l<n;l++)c=l/n*(2*Math.PI),o=Math.sin(c)*u,s=Math.cos(c)*u,d.push(o,0,s),f.push(p.r,p.g,p.b),c=(l+1)/n*(2*Math.PI),o=Math.sin(c)*u,s=Math.cos(c)*u,d.push(o,0,s),f.push(p.r,p.g,p.b);var m=new At;m.addAttribute("position",new _t(d,3)),m.addAttribute("color",new _t(f,3));var v=new Ee({vertexColors:ya});Se.call(this,m,v)}function mr(t,e,i,n){this.object=t,this.size=void 0!==e?e:1;var r=void 0!==i?i:16776960,a=void 0!==n?n:1,o=0,s=this.object.geometry;s&&s.isGeometry?o=s.faces.length:console.warn("THREE.FaceNormalsHelper: only THREE.Geometry is supported. Use THREE.VertexNormalsHelper, instead.");var c=new At,h=new _t(2*o*3,3);c.addAttribute("position",h),Se.call(this,c,new Ee({color:r,linewidth:a})),this.matrixAutoUpdate=!1,this.update()}function vr(t,e){ct.call(this),this.light=t,this.light.updateMatrixWorld(),this.matrix=t.matrixWorld,this.matrixAutoUpdate=!1,void 0===e&&(e=1);var i=new At;i.addAttribute("position",new _t([-e,e,0,e,e,0,e,-e,0,-e,-e,0,-e,e,0],3));var n=new Ee({fog:!1});this.add(new Te(i,n)),i=new At,i.addAttribute("position",new _t([0,0,0,0,0,1],3)),this.add(new Te(i,n)),this.update()}function gr(t){function e(t,e,n){i(t,n),i(e,n)}function i(t,e){a.push(0,0,0),o.push(e.r,e.g,e.b),void 0===s[t]&&(s[t]=[]),s[t].push(a.length/3-1)}var n=new At,r=new Ee({color:16777215,vertexColors:ga}),a=[],o=[],s={},c=new X(16755200),h=new X(16711680),l=new X(43775),u=new X(16777215),p=new X(3355443);e("n1","n2",c),e("n2","n4",c),e("n4","n3",c),e("n3","n1",c),e("f1","f2",c),e("f2","f4",c),e("f4","f3",c),e("f3","f1",c),e("n1","f1",c),e("n2","f2",c),e("n3","f3",c),e("n4","f4",c),e("p","n1",h),e("p","n2",h),e("p","n3",h),e("p","n4",h),e("u1","u2",l),e("u2","u3",l),e("u3","u1",l),e("c","t",u),e("p","c",p),e("cn1","cn2",p),e("cn3","cn4",p),e("cf1","cf2",p),e("cf3","cf4",p),n.addAttribute("position",new _t(a,3)),n.addAttribute("color",new _t(o,3)),Se.call(this,n,r),this.camera=t,this.camera.updateProjectionMatrix&&this.camera.updateProjectionMatrix(),this.matrix=t.matrixWorld,this.matrixAutoUpdate=!1,this.pointMap=s,this.update()}function yr(t,e){this.object=t,void 0===e&&(e=16776960);var i=new Uint16Array([0,1,1,2,2,3,3,0,4,5,5,6,6,7,7,4,0,4,1,5,2,6,3,7]),n=new Float32Array(24),r=new At;r.setIndex(new dt(i,1)),r.addAttribute("position",new dt(n,3)),Se.call(this,r,new Ee({color:e})),this.matrixAutoUpdate=!1,this.update()}function xr(t,e,i,n,r,a){ct.call(this),void 0===n&&(n=16776960),void 0===i&&(i=1),void 0===r&&(r=.2*i),void 0===a&&(a=.2*r),void 0===Hs&&(Hs=new At,Hs.addAttribute("position",new _t([0,0,0,0,1,0],3)),Vs=new fi(0,.5,1,5,1),Vs.translate(0,-.5,0)),this.position.copy(e),this.line=new Te(Hs,new Ee({color:n})),this.line.matrixAutoUpdate=!1,this.add(this.line),this.cone=new Lt(Vs,new pt({color:n})),this.cone.matrixAutoUpdate=!1,this.add(this.cone),this.setDirection(t),this.setLength(i,r,a)}function br(t){t=t||1;var e=[0,0,0,t,0,0,0,0,0,0,t,0,0,0,0,0,0,t],i=[1,0,0,1,.6,0,0,1,0,.6,1,0,0,0,1,0,.6,1],n=new At;n.addAttribute("position",new _t(e,3)),n.addAttribute("color",new _t(i,3));var r=new Ee({vertexColors:ya});Se.call(this,n,r)}function _r(){function t(t,a,o,s){e=t,i=o,n=-3*t+3*a-2*o-s,r=2*t-2*a+o+s}var e=0,i=0,n=0,r=0;return{initCatmullRom:function(e,i,n,r,a){t(i,n,a*(n-e),a*(r-i))},initNonuniformCatmullRom:function(e,i,n,r,a,o,s){var c=(i-e)/a-(n-e)/(a+o)+(n-i)/o,h=(n-i)/o-(r-i)/(o+s)+(r-n)/s;c*=o,h*=o,t(i,n,c,h)},calc:function(t){var a=t*t;return e+i*t+n*a+r*(a*t)}}}function wr(t){_n.call(this),this.points=t||[],this.closed=!1}function Mr(t,e,i,n){_n.call(this),this.v0=t,this.v1=e,this.v2=i,this.v3=n}function Er(t,e,i){_n.call(this),this.v0=t,this.v1=e,this.v2=i}function Tr(t,e){_n.call(this),this.v1=t,this.v2=e}function Sr(t,e,i,n,r,a){En.call(this,t,e,i,i,n,r,a)}function Ar(t,e,i,n,r,a,o){return console.warn("THREE.Face4 has been removed. A THREE.Face3 will be created instead."),new ut(t,e,i,r,a,o)}function Lr(t){return console.warn("THREE.MeshFaceMaterial has been removed. Use an Array instead."),t}function Rr(t){return void 0===t&&(t=[]),console.warn("THREE.MultiMaterial has been removed. Use an Array instead."),t.isMultiMaterial=!0,t.materials=t,t.clone=function(){return t.slice()},t}function Pr(t,e){return console.warn("THREE.PointCloud has been renamed to THREE.Points."),new Re(t,e)}function Cr(t){return console.warn("THREE.Particle has been renamed to THREE.Sprite."),new xe(t)}function Ir(t,e){return console.warn("THREE.ParticleSystem has been renamed to THREE.Points."),new Re(t,e)}function Ur(t){return console.warn("THREE.PointCloudMaterial has been renamed to THREE.PointsMaterial."),new Le(t)}function Or(t){return console.warn("THREE.ParticleBasicMaterial has been renamed to THREE.PointsMaterial."),new Le(t)}function Dr(t){return console.warn("THREE.ParticleSystemMaterial has been renamed to THREE.PointsMaterial."),new Le(t)}function Nr(t,e,i){return console.warn("THREE.Vertex has been removed. Use THREE.Vector3 instead."),new c(t,e,i)}function Fr(t,e){return console.warn("THREE.DynamicBufferAttribute has been removed. Use new THREE.BufferAttribute().setDynamic( true ) instead."),new dt(t,e).setDynamic(!0)}function Br(t,e){return console.warn("THREE.Int8Attribute has been removed. Use new THREE.Int8BufferAttribute() instead."),new ft(t,e)}function zr(t,e){return console.warn("THREE.Uint8Attribute has been removed. Use new THREE.Uint8BufferAttribute() instead."),new mt(t,e)}function Gr(t,e){return console.warn("THREE.Uint8ClampedAttribute has been removed. Use new THREE.Uint8ClampedBufferAttribute() instead."),new vt(t,e)}function Hr(t,e){return console.warn("THREE.Int16Attribute has been removed. Use new THREE.Int16BufferAttribute() instead."),new gt(t,e)}function Vr(t,e){return console.warn("THREE.Uint16Attribute has been removed. Use new THREE.Uint16BufferAttribute() instead."),new yt(t,e)}function kr(t,e){return console.warn("THREE.Int32Attribute has been removed. Use new THREE.Int32BufferAttribute() instead."),new xt(t,e)}function jr(t,e){return console.warn("THREE.Uint32Attribute has been removed. Use new THREE.Uint32BufferAttribute() instead."),new bt(t,e)}function Wr(t,e){return console.warn("THREE.Float32Attribute has been removed. Use new THREE.Float32BufferAttribute() instead."),new _t(t,e)}function Xr(t,e){return console.warn("THREE.Float64Attribute has been removed. Use new THREE.Float64BufferAttribute() instead."),new wt(t,e)}function qr(t){console.warn("THREE.ClosedSplineCurve3 has been deprecated. Use THREE.CatmullRomCurve3 instead."),wr.call(this,t),this.type="catmullrom",this.closed=!0}function Yr(t){console.warn("THREE.SplineCurve3 has been deprecated. Use THREE.CatmullRomCurve3 instead."),wr.call(this,t),this.type="catmullrom"}function Zr(t){console.warn("THREE.Spline has been removed. Use THREE.CatmullRomCurve3 instead."),wr.call(this,t),this.type="catmullrom"}function Jr(t,e){return console.warn("THREE.BoundingBoxHelper has been deprecated. Creating a THREE.BoxHelper instead."),new yr(t,e)}function Qr(t,e){return console.warn("THREE.EdgesHelper has been removed. Use THREE.EdgesGeometry instead."),new Se(new pi(t.geometry),new Ee({color:void 0!==e?e:16777215}))}function Kr(t,e){return console.warn("THREE.WireframeHelper has been removed. Use THREE.WireframeGeometry instead."),new Se(new De(t.geometry),new Ee({color:void 0!==e?e:16777215}))}function $r(t){return console.warn("THREE.XHRLoader has been renamed to THREE.FileLoader."),new Ri(t)}function ta(t){return console.warn("THREE.BinaryTextureLoader has been renamed to THREE.DataTextureLoader."),new Ci(t)}function ea(){console.error("THREE.Projector has been moved to /examples/js/renderers/Projector.js."),this.projectVector=function(t,e){console.warn("THREE.Projector: .projectVector() is now vector.project()."),t.project(e)},this.unprojectVector=function(t,e){console.warn("THREE.Projector: .unprojectVector() is now vector.unproject()."),t.unproject(e)},this.pickingRay=function(){console.error("THREE.Projector: .pickingRay() is now raycaster.setFromCamera().")}}function ia(){console.error("THREE.CanvasRenderer has been moved to /examples/js/renderers/CanvasRenderer.js"),this.domElement=document.createElementNS("http://www.w3.org/1999/xhtml","canvas"),this.clear=function(){},this.render=function(){},this.setClearColor=function(){},this.setSize=function(){}}void 0===Number.EPSILON&&(Number.EPSILON=Math.pow(2,-52)),void 0===Number.isInteger&&(Number.isInteger=function(t){return"number"==typeof t&&isFinite(t)&&Math.floor(t)===t}),void 0===Math.sign&&(Math.sign=function(t){return t<0?-1:t>0?1:+t}),void 0===Function.prototype.name&&Object.defineProperty(Function.prototype,"name",{get:function(){return this.toString().match(/^\s*function\s*([^\(\s]*)/)[1]}}),void 0===Object.assign&&function(){Object.assign=function(t){if(void 0===t||null===t)throw new TypeError("Cannot convert undefined or null to object");for(var e=Object(t),i=1;i<arguments.length;i++){var n=arguments[i];if(void 0!==n&&null!==n)for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e}}(),Object.assign(e.prototype,{addEventListener:function(t,e){void 0===this._listeners&&(this._listeners={});var i=this._listeners;void 0===i[t]&&(i[t]=[]),-1===i[t].indexOf(e)&&i[t].push(e)},hasEventListener:function(t,e){if(void 0===this._listeners)return!1;var i=this._listeners;return void 0!==i[t]&&-1!==i[t].indexOf(e)},removeEventListener:function(t,e){if(void 0!==this._listeners){var i=this._listeners,n=i[t];if(void 0!==n){var r=n.indexOf(e);-1!==r&&n.splice(r,1)}}},dispatchEvent:function(t){if(void 0!==this._listeners){var e=this._listeners,i=e[t.type];if(void 0!==i){t.target=this;var n=[],r=0,a=i.length;for(r=0;r<a;r++)n[r]=i[r];for(r=0;r<a;r++)n[r].call(this,t)}}}});var na="85",ra={LEFT:0,MIDDLE:1,RIGHT:2},aa=0,oa=1,sa=2,ca=0,ha=1,la=2,ua=0,pa=1,da=2,fa=1,ma=2,va=0,ga=1,ya=2,xa=0,ba=1,_a=2,wa=3,Ma=4,Ea=5,Ta=100,Sa=101,Aa=102,La=103,Ra=104,Pa=200,Ca=201,Ia=202,Ua=203,Oa=204,Da=205,Na=206,Fa=207,Ba=208,za=209,Ga=210,Ha=0,Va=1,ka=2,ja=3,Wa=4,Xa=5,qa=6,Ya=7,Za=0,Ja=1,Qa=2,Ka=0,$a=1,to=2,eo=3,io=4,no=301,ro=302,ao=303,oo=304,so=305,co=306,ho=307,lo=1e3,uo=1001,po=1002,fo=1003,mo=1004,vo=1005,go=1006,yo=1007,xo=1008,bo=1009,_o=1010,wo=1011,Mo=1012,Eo=1013,To=1014,So=1015,Ao=1016,Lo=1017,Ro=1018,Po=1019,Co=1020,Io=1021,Uo=1022,Oo=1023,Do=1024,No=1025,Fo=Oo,Bo=1026,zo=1027,Go=2001,Ho=2002,Vo=2003,ko=2004,jo=2100,Wo=2101,Xo=2102,qo=2103,Yo=2151,Zo=2201,Jo=2400,Qo=0,Ko=1,$o=2,ts=3e3,es=3001,is=3007,ns=3002,rs=3004,as=3005,os=3006,ss=3200,cs=3201,hs={DEG2RAD:Math.PI/180,RAD2DEG:180/Math.PI,generateUUID:function(){var t,e="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz".split(""),i=new Array(36),n=0;return function(){for(var r=0;r<36;r++)8===r||13===r||18===r||23===r?i[r]="-":14===r?i[r]="4":(n<=2&&(n=33554432+16777216*Math.random()|0),t=15&n,n>>=4,i[r]=e[19===r?3&t|8:t]);return i.join("")}}(),clamp:function(t,e,i){return Math.max(e,Math.min(i,t))},euclideanModulo:function(t,e){return(t%e+e)%e},mapLinear:function(t,e,i,n,r){return n+(t-e)*(r-n)/(i-e)},lerp:function(t,e,i){return(1-i)*t+i*e},smoothstep:function(t,e,i){return t<=e?0:t>=i?1:(t=(t-e)/(i-e))*t*(3-2*t)},smootherstep:function(t,e,i){return t<=e?0:t>=i?1:(t=(t-e)/(i-e))*t*t*(t*(6*t-15)+10)},randInt:function(t,e){return t+Math.floor(Math.random()*(e-t+1))},randFloat:function(t,e){return t+Math.random()*(e-t)},randFloatSpread:function(t){return t*(.5-Math.random())},degToRad:function(t){return t*hs.DEG2RAD},radToDeg:function(t){return t*hs.RAD2DEG},isPowerOfTwo:function(t){return 0==(t&t-1)&&0!==t},nearestPowerOfTwo:function(t){return Math.pow(2,Math.round(Math.log(t)/Math.LN2))},nextPowerOfTwo:function(t){return t--,t|=t>>1,t|=t>>2,t|=t>>4,t|=t>>8,t|=t>>16,++t}};Object.defineProperties(i.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(i.prototype,{isVector2:!0,set:function(t,e){return this.x=t,this.y=e,this},setScalar:function(t){return this.x=t,this.y=t,this},setX:function(t){return this.x=t,this},setY:function(t){return this.y=t,this},setComponent:function(t,e){switch(t){case 0:this.x=e;break;case 1:this.y=e;break;default:throw new Error("index is out of range: "+t)}return this},getComponent:function(t){switch(t){case 0:return this.x;case 1:return this.y;default:throw new Error("index is out of range: "+t)}},clone:function(){return new this.constructor(this.x,this.y)},copy:function(t){return this.x=t.x,this.y=t.y,this},add:function(t,e){return void 0!==e?(console.warn("THREE.Vector2: .add() now only accepts one argument. Use .addVectors( a, b ) instead."),this.addVectors(t,e)):(this.x+=t.x,this.y+=t.y,this)},addScalar:function(t){return this.x+=t,this.y+=t,this},addVectors:function(t,e){return this.x=t.x+e.x,this.y=t.y+e.y,this},addScaledVector:function(t,e){return this.x+=t.x*e,this.y+=t.y*e,this},sub:function(t,e){return void 0!==e?(console.warn("THREE.Vector2: .sub() now only accepts one argument. Use .subVectors( a, b ) instead."),this.subVectors(t,e)):(this.x-=t.x,this.y-=t.y,this)},subScalar:function(t){return this.x-=t,this.y-=t,this},subVectors:function(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this},multiply:function(t){return this.x*=t.x,this.y*=t.y,this},multiplyScalar:function(t){return 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)},min:function(t){return this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y),this},max:function(t){return this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y),this},clamp:function(t,e){return this.x=Math.max(t.x,Math.min(e.x,this.x)),this.y=Math.max(t.y,Math.min(e.y,this.y)),this},clampScalar:function(){var t=new i,e=new i;return function(i,n){return t.set(i,i),e.set(n,n),this.clamp(t,e)}}(),clampLength:function(t,e){var i=this.length();return this.multiplyScalar(Math.max(t,Math.min(e,i))/i)},floor:function(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this},ceil:function(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this},round:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this},roundToZero:function(){return this.x=this.x<0?Math.ceil(this.x):Math.floor(this.x),this.y=this.y<0?Math.ceil(this.y):Math.floor(this.y),this},negate:function(){return this.x=-this.x,this.y=-this.y,this},dot:function(t){return this.x*t.x+this.y*t.y},lengthSq:function(){return this.x*this.x+this.y*this.y},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y)},lengthManhattan:function(){return Math.abs(this.x)+Math.abs(this.y)},normalize:function(){return this.divideScalar(this.length())},angle:function(){
var t=Math.atan2(this.y,this.x);return t<0&&(t+=2*Math.PI),t},distanceTo:function(t){return Math.sqrt(this.distanceToSquared(t))},distanceToSquared:function(t){var e=this.x-t.x,i=this.y-t.y;return e*e+i*i},distanceToManhattan:function(t){return Math.abs(this.x-t.x)+Math.abs(this.y-t.y)},setLength:function(t){return this.multiplyScalar(t/this.length())},lerp:function(t,e){return this.x+=(t.x-this.x)*e,this.y+=(t.y-this.y)*e,this},lerpVectors:function(t,e,i){return this.subVectors(e,t).multiplyScalar(i).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,i){return void 0!==i&&console.warn("THREE.Vector2: offset has been removed from .fromBufferAttribute()."),this.x=t.getX(e),this.y=t.getY(e),this},rotateAround:function(t,e){var i=Math.cos(e),n=Math.sin(e),r=this.x-t.x,a=this.y-t.y;return this.x=r*i-a*n+t.x,this.y=r*n+a*i+t.y,this}});var ls=0;n.DEFAULT_IMAGE=void 0,n.DEFAULT_MAPPING=300,Object.defineProperty(n.prototype,"needsUpdate",{set:function(t){!0===t&&this.version++}}),Object.assign(n.prototype,e.prototype,{constructor:n,isTexture:!0,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.generateMipmaps=t.generateMipmaps,this.premultiplyAlpha=t.premultiplyAlpha,this.flipY=t.flipY,this.unpackAlignment=t.unpackAlignment,this.encoding=t.encoding,this},toJSON:function(t){if(void 0!==t.textures[this.uuid])return t.textures[this.uuid];var e={metadata:{version:4.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],wrap:[this.wrapS,this.wrapT],minFilter:this.minFilter,magFilter:this.magFilter,anisotropy:this.anisotropy,flipY:this.flipY};if(void 0!==this.image){var i=this.image;void 0===i.uuid&&(i.uuid=hs.generateUUID()),void 0===t.images[i.uuid]&&(t.images[i.uuid]={uuid:i.uuid,url:function(t){var e;return void 0!==t.toDataURL?e=t:(e=document.createElementNS("http://www.w3.org/1999/xhtml","canvas"),e.width=t.width,e.height=t.height,e.getContext("2d").drawImage(t,0,0,t.width,t.height)),e.width>2048||e.height>2048?e.toDataURL("image/jpeg",.6):e.toDataURL("image/png")}(i)}),e.image=i.uuid}return t.textures[this.uuid]=e,e},dispose:function(){this.dispatchEvent({type:"dispose"})},transformUv:function(t){if(300===this.mapping){if(t.multiply(this.repeat),t.add(this.offset),t.x<0||t.x>1)switch(this.wrapS){case lo:t.x=t.x-Math.floor(t.x);break;case uo:t.x=t.x<0?0:1;break;case po: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 lo:t.y=t.y-Math.floor(t.y);break;case uo:t.y=t.y<0?0:1;break;case po:1===Math.abs(Math.floor(t.y)%2)?t.y=Math.ceil(t.y)-t.y:t.y=t.y-Math.floor(t.y)}this.flipY&&(t.y=1-t.y)}}}),Object.assign(r.prototype,{isVector4:!0,set:function(t,e,i,n){return this.x=t,this.y=e,this.z=i,this.w=n,this},setScalar:function(t){return this.x=t,this.y=t,this.z=t,this.w=t,this},setX:function(t){return this.x=t,this},setY:function(t){return this.y=t,this},setZ:function(t){return this.z=t,this},setW:function(t){return this.w=t,this},setComponent:function(t,e){switch(t){case 0:this.x=e;break;case 1:this.y=e;break;case 2:this.z=e;break;case 3:this.w=e;break;default:throw new Error("index is out of range: "+t)}return this},getComponent:function(t){switch(t){case 0:return this.x;case 1:return this.y;case 2:return this.z;case 3:return this.w;default:throw new Error("index is out of range: "+t)}},clone:function(){return new this.constructor(this.x,this.y,this.z,this.w)},copy:function(t){return this.x=t.x,this.y=t.y,this.z=t.z,this.w=void 0!==t.w?t.w:1,this},add:function(t,e){return void 0!==e?(console.warn("THREE.Vector4: .add() now only accepts one argument. Use .addVectors( a, b ) instead."),this.addVectors(t,e)):(this.x+=t.x,this.y+=t.y,this.z+=t.z,this.w+=t.w,this)},addScalar:function(t){return this.x+=t,this.y+=t,this.z+=t,this.w+=t,this},addVectors:function(t,e){return this.x=t.x+e.x,this.y=t.y+e.y,this.z=t.z+e.z,this.w=t.w+e.w,this},addScaledVector:function(t,e){return this.x+=t.x*e,this.y+=t.y*e,this.z+=t.z*e,this.w+=t.w*e,this},sub:function(t,e){return void 0!==e?(console.warn("THREE.Vector4: .sub() now only accepts one argument. Use .subVectors( a, b ) instead."),this.subVectors(t,e)):(this.x-=t.x,this.y-=t.y,this.z-=t.z,this.w-=t.w,this)},subScalar:function(t){return this.x-=t,this.y-=t,this.z-=t,this.w-=t,this},subVectors:function(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this.z=t.z-e.z,this.w=t.w-e.w,this},multiplyScalar:function(t){return this.x*=t,this.y*=t,this.z*=t,this.w*=t,this},applyMatrix4:function(t){var e=this.x,i=this.y,n=this.z,r=this.w,a=t.elements;return this.x=a[0]*e+a[4]*i+a[8]*n+a[12]*r,this.y=a[1]*e+a[5]*i+a[9]*n+a[13]*r,this.z=a[2]*e+a[6]*i+a[10]*n+a[14]*r,this.w=a[3]*e+a[7]*i+a[11]*n+a[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,i,n,r,a=t.elements,o=a[0],s=a[4],c=a[8],h=a[1],l=a[5],u=a[9],p=a[2],d=a[6],f=a[10];if(Math.abs(s-h)<.01&&Math.abs(c-p)<.01&&Math.abs(u-d)<.01){if(Math.abs(s+h)<.1&&Math.abs(c+p)<.1&&Math.abs(u+d)<.1&&Math.abs(o+l+f-3)<.1)return this.set(1,0,0,0),this;e=Math.PI;var m=(o+1)/2,v=(l+1)/2,g=(f+1)/2,y=(s+h)/4,x=(c+p)/4,b=(u+d)/4;return m>v&&m>g?m<.01?(i=0,n=.707106781,r=.707106781):(i=Math.sqrt(m),n=y/i,r=x/i):v>g?v<.01?(i=.707106781,n=0,r=.707106781):(n=Math.sqrt(v),i=y/n,r=b/n):g<.01?(i=.707106781,n=.707106781,r=0):(r=Math.sqrt(g),i=x/r,n=b/r),this.set(i,n,r,e),this}var _=Math.sqrt((d-u)*(d-u)+(c-p)*(c-p)+(h-s)*(h-s));return Math.abs(_)<.001&&(_=1),this.x=(d-u)/_,this.y=(c-p)/_,this.z=(h-s)/_,this.w=Math.acos((o+l+f-1)/2),this},min:function(t){return this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y),this.z=Math.min(this.z,t.z),this.w=Math.min(this.w,t.w),this},max:function(t){return this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y),this.z=Math.max(this.z,t.z),this.w=Math.max(this.w,t.w),this},clamp:function(t,e){return this.x=Math.max(t.x,Math.min(e.x,this.x)),this.y=Math.max(t.y,Math.min(e.y,this.y)),this.z=Math.max(t.z,Math.min(e.z,this.z)),this.w=Math.max(t.w,Math.min(e.w,this.w)),this},clampScalar:function(){var t=new r,e=new r;return function(i,n){return t.set(i,i,i,i),e.set(n,n,n,n),this.clamp(t,e)}}(),floor:function(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this.w=Math.floor(this.w),this},ceil:function(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this.w=Math.ceil(this.w),this},round:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this.w=Math.round(this.w),this},roundToZero:function(){return this.x=this.x<0?Math.ceil(this.x):Math.floor(this.x),this.y=this.y<0?Math.ceil(this.y):Math.floor(this.y),this.z=this.z<0?Math.ceil(this.z):Math.floor(this.z),this.w=this.w<0?Math.ceil(this.w):Math.floor(this.w),this},negate:function(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this.w=-this.w,this},dot:function(t){return this.x*t.x+this.y*t.y+this.z*t.z+this.w*t.w},lengthSq:function(){return this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)},lengthManhattan:function(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)+Math.abs(this.w)},normalize:function(){return this.divideScalar(this.length())},setLength:function(t){return this.multiplyScalar(t/this.length())},lerp:function(t,e){return this.x+=(t.x-this.x)*e,this.y+=(t.y-this.y)*e,this.z+=(t.z-this.z)*e,this.w+=(t.w-this.w)*e,this},lerpVectors:function(t,e,i){return this.subVectors(e,t).multiplyScalar(i).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,i){return void 0!==i&&console.warn("THREE.Vector4: offset has been removed from .fromBufferAttribute()."),this.x=t.getX(e),this.y=t.getY(e),this.z=t.getZ(e),this.w=t.getW(e),this}}),Object.assign(a.prototype,e.prototype,{isWebGLRenderTarget:!0,setSize:function(t,e){this.width===t&&this.height===e||(this.width=t,this.height=e,this.dispose()),this.viewport.set(0,0,t,e),this.scissor.set(0,0,t,e)},clone:function(){return(new this.constructor).copy(this)},copy:function(t){return this.width=t.width,this.height=t.height,this.viewport.copy(t.viewport),this.texture=t.texture.clone(),this.depthBuffer=t.depthBuffer,this.stencilBuffer=t.stencilBuffer,this.depthTexture=t.depthTexture,this},dispose:function(){this.dispatchEvent({type:"dispose"})}}),o.prototype=Object.create(a.prototype),o.prototype.constructor=o,o.prototype.isWebGLRenderTargetCube=!0,Object.assign(s,{slerp:function(t,e,i,n){return i.copy(t).slerp(e,n)},slerpFlat:function(t,e,i,n,r,a,o){var s=i[n+0],c=i[n+1],h=i[n+2],l=i[n+3],u=r[a+0],p=r[a+1],d=r[a+2],f=r[a+3];if(l!==f||s!==u||c!==p||h!==d){var m=1-o,v=s*u+c*p+h*d+l*f,g=v>=0?1:-1,y=1-v*v;if(y>Number.EPSILON){var x=Math.sqrt(y),b=Math.atan2(x,v*g);m=Math.sin(m*b)/x,o=Math.sin(o*b)/x}var _=o*g;if(s=s*m+u*_,c=c*m+p*_,h=h*m+d*_,l=l*m+f*_,m===1-o){var w=1/Math.sqrt(s*s+c*c+h*h+l*l);s*=w,c*=w,h*=w,l*=w}}t[e]=s,t[e+1]=c,t[e+2]=h,t[e+3]=l}}),Object.defineProperties(s.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(s.prototype,{set:function(t,e,i,n){return this._x=t,this._y=e,this._z=i,this._w=n,this.onChangeCallback(),this},clone:function(){return new this.constructor(this._x,this._y,this._z,this._w)},copy:function(t){return this._x=t.x,this._y=t.y,this._z=t.z,this._w=t.w,this.onChangeCallback(),this},setFromEuler:function(t,e){if(!1===(t&&t.isEuler))throw new Error("THREE.Quaternion: .setFromEuler() now expects an Euler rotation rather than a Vector3 and order.");var i=t._x,n=t._y,r=t._z,a=t.order,o=Math.cos,s=Math.sin,c=o(i/2),h=o(n/2),l=o(r/2),u=s(i/2),p=s(n/2),d=s(r/2);return"XYZ"===a?(this._x=u*h*l+c*p*d,this._y=c*p*l-u*h*d,this._z=c*h*d+u*p*l,this._w=c*h*l-u*p*d):"YXZ"===a?(this._x=u*h*l+c*p*d,this._y=c*p*l-u*h*d,this._z=c*h*d-u*p*l,this._w=c*h*l+u*p*d):"ZXY"===a?(this._x=u*h*l-c*p*d,this._y=c*p*l+u*h*d,this._z=c*h*d+u*p*l,this._w=c*h*l-u*p*d):"ZYX"===a?(this._x=u*h*l-c*p*d,this._y=c*p*l+u*h*d,this._z=c*h*d-u*p*l,this._w=c*h*l+u*p*d):"YZX"===a?(this._x=u*h*l+c*p*d,this._y=c*p*l+u*h*d,this._z=c*h*d-u*p*l,this._w=c*h*l-u*p*d):"XZY"===a&&(this._x=u*h*l-c*p*d,this._y=c*p*l-u*h*d,this._z=c*h*d+u*p*l,this._w=c*h*l+u*p*d),!1!==e&&this.onChangeCallback(),this},setFromAxisAngle:function(t,e){var i=e/2,n=Math.sin(i);return this._x=t.x*n,this._y=t.y*n,this._z=t.z*n,this._w=Math.cos(i),this.onChangeCallback(),this},setFromRotationMatrix:function(t){var e,i=t.elements,n=i[0],r=i[4],a=i[8],o=i[1],s=i[5],c=i[9],h=i[2],l=i[6],u=i[10],p=n+s+u;return p>0?(e=.5/Math.sqrt(p+1),this._w=.25/e,this._x=(l-c)*e,this._y=(a-h)*e,this._z=(o-r)*e):n>s&&n>u?(e=2*Math.sqrt(1+n-s-u),this._w=(l-c)/e,this._x=.25*e,this._y=(r+o)/e,this._z=(a+h)/e):s>u?(e=2*Math.sqrt(1+s-n-u),this._w=(a-h)/e,this._x=(r+o)/e,this._y=.25*e,this._z=(c+l)/e):(e=2*Math.sqrt(1+u-n-s),this._w=(o-r)/e,this._x=(a+h)/e,this._y=(c+l)/e,this._z=.25*e),this.onChangeCallback(),this},setFromUnitVectors:function(){var t,e=new c;return function(i,n){return void 0===e&&(e=new c),t=i.dot(n)+1,t<1e-6?(t=0,Math.abs(i.x)>Math.abs(i.z)?e.set(-i.y,i.x,0):e.set(0,-i.z,i.y)):e.crossVectors(i,n),this._x=e.x,this._y=e.y,this._z=e.z,this._w=t,this.normalize()}}(),inverse:function(){return this.conjugate().normalize()},conjugate:function(){return this._x*=-1,this._y*=-1,this._z*=-1,this.onChangeCallback(),this},dot:function(t){return this._x*t._x+this._y*t._y+this._z*t._z+this._w*t._w},lengthSq:function(){return this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w},length:function(){return Math.sqrt(this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w)},normalize:function(){var t=this.length();return 0===t?(this._x=0,this._y=0,this._z=0,this._w=1):(t=1/t,this._x=this._x*t,this._y=this._y*t,this._z=this._z*t,this._w=this._w*t),this.onChangeCallback(),this},multiply:function(t,e){return void 0!==e?(console.warn("THREE.Quaternion: .multiply() now only accepts one argument. Use .multiplyQuaternions( a, b ) instead."),this.multiplyQuaternions(t,e)):this.multiplyQuaternions(this,t)},premultiply:function(t){return this.multiplyQuaternions(t,this)},multiplyQuaternions:function(t,e){var i=t._x,n=t._y,r=t._z,a=t._w,o=e._x,s=e._y,c=e._z,h=e._w;return this._x=i*h+a*o+n*c-r*s,this._y=n*h+a*s+r*o-i*c,this._z=r*h+a*c+i*s-n*o,this._w=a*h-i*o-n*s-r*c,this.onChangeCallback(),this},slerp:function(t,e){if(0===e)return this;if(1===e)return this.copy(t);var i=this._x,n=this._y,r=this._z,a=this._w,o=a*t._w+i*t._x+n*t._y+r*t._z;if(o<0?(this._w=-t._w,this._x=-t._x,this._y=-t._y,this._z=-t._z,o=-o):this.copy(t),o>=1)return this._w=a,this._x=i,this._y=n,this._z=r,this;var s=Math.sqrt(1-o*o);if(Math.abs(s)<.001)return this._w=.5*(a+this._w),this._x=.5*(i+this._x),this._y=.5*(n+this._y),this._z=.5*(r+this._z),this;var c=Math.atan2(s,o),h=Math.sin((1-e)*c)/s,l=Math.sin(e*c)/s;return this._w=a*h+this._w*l,this._x=i*h+this._x*l,this._y=n*h+this._y*l,this._z=r*h+this._z*l,this.onChangeCallback(),this},equals:function(t){return t._x===this._x&&t._y===this._y&&t._z===this._z&&t._w===this._w},fromArray:function(t,e){return void 0===e&&(e=0),this._x=t[e],this._y=t[e+1],this._z=t[e+2],this._w=t[e+3],this.onChangeCallback(),this},toArray:function(t,e){return void 0===t&&(t=[]),void 0===e&&(e=0),t[e]=this._x,t[e+1]=this._y,t[e+2]=this._z,t[e+3]=this._w,t},onChange:function(t){return this.onChangeCallback=t,this},onChangeCallback:function(){}}),Object.assign(c.prototype,{isVector3:!0,set:function(t,e,i){return this.x=t,this.y=e,this.z=i,this},setScalar:function(t){return this.x=t,this.y=t,this.z=t,this},setX:function(t){return this.x=t,this},setY:function(t){return this.y=t,this},setZ:function(t){return this.z=t,this},setComponent:function(t,e){switch(t){case 0:this.x=e;break;case 1:this.y=e;break;case 2:this.z=e;break;default:throw new Error("index is out of range: "+t)}return this},getComponent:function(t){switch(t){case 0:return this.x;case 1:return this.y;case 2:return this.z;default:throw new Error("index is out of range: "+t)}},clone:function(){return new this.constructor(this.x,this.y,this.z)},copy:function(t){return this.x=t.x,this.y=t.y,this.z=t.z,this},add:function(t,e){return void 0!==e?(console.warn("THREE.Vector3: .add() now only accepts one argument. Use .addVectors( a, b ) instead."),this.addVectors(t,e)):(this.x+=t.x,this.y+=t.y,this.z+=t.z,this)},addScalar:function(t){return this.x+=t,this.y+=t,this.z+=t,this},addVectors:function(t,e){return this.x=t.x+e.x,this.y=t.y+e.y,this.z=t.z+e.z,this},addScaledVector:function(t,e){return this.x+=t.x*e,this.y+=t.y*e,this.z+=t.z*e,this},sub:function(t,e){return void 0!==e?(console.warn("THREE.Vector3: .sub() now only accepts one argument. Use .subVectors( a, b ) instead."),this.subVectors(t,e)):(this.x-=t.x,this.y-=t.y,this.z-=t.z,this)},subScalar:function(t){return this.x-=t,this.y-=t,this.z-=t,this},subVectors:function(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this.z=t.z-e.z,this},multiply:function(t,e){return void 0!==e?(console.warn("THREE.Vector3: .multiply() now only accepts one argument. Use .multiplyVectors( a, b ) instead."),this.multiplyVectors(t,e)):(this.x*=t.x,this.y*=t.y,this.z*=t.z,this)},multiplyScalar:function(t){return 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(){var t=new s;return function(e){return!1===(e&&e.isEuler)&&console.error("THREE.Vector3: .applyEuler() now expects an Euler rotation rather than a Vector3 and order."),this.applyQuaternion(t.setFromEuler(e))}}(),applyAxisAngle:function(){var t=new s;return function(e,i){return this.applyQuaternion(t.setFromAxisAngle(e,i))}}(),applyMatrix3:function(t){var e=this.x,i=this.y,n=this.z,r=t.elements;return this.x=r[0]*e+r[3]*i+r[6]*n,this.y=r[1]*e+r[4]*i+r[7]*n,this.z=r[2]*e+r[5]*i+r[8]*n,this},applyMatrix4:function(t){var e=this.x,i=this.y,n=this.z,r=t.elements;this.x=r[0]*e+r[4]*i+r[8]*n+r[12],this.y=r[1]*e+r[5]*i+r[9]*n+r[13],this.z=r[2]*e+r[6]*i+r[10]*n+r[14];var a=r[3]*e+r[7]*i+r[11]*n+r[15];return this.divideScalar(a)},applyQuaternion:function(t){var e=this.x,i=this.y,n=this.z,r=t.x,a=t.y,o=t.z,s=t.w,c=s*e+a*n-o*i,h=s*i+o*e-r*n,l=s*n+r*i-a*e,u=-r*e-a*i-o*n;return this.x=c*s+u*-r+h*-o-l*-a,this.y=h*s+u*-a+l*-r-c*-o,this.z=l*s+u*-o+c*-a-h*-r,this},project:function(){var t=new h;return function(e){return t.multiplyMatrices(e.projectionMatrix,t.getInverse(e.matrixWorld)),this.applyMatrix4(t)}}(),unproject:function(){var t=new h;return function(e){return t.multiplyMatrices(e.matrixWorld,t.getInverse(e.projectionMatrix)),this.applyMatrix4(t)}}(),transformDirection:function(t){var e=this.x,i=this.y,n=this.z,r=t.elements;return this.x=r[0]*e+r[4]*i+r[8]*n,this.y=r[1]*e+r[5]*i+r[9]*n,this.z=r[2]*e+r[6]*i+r[10]*n,this.normalize()},divide:function(t){return this.x/=t.x,this.y/=t.y,this.z/=t.z,this},divideScalar:function(t){return this.multiplyScalar(1/t)},min:function(t){return this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y),this.z=Math.min(this.z,t.z),this},max:function(t){return this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y),this.z=Math.max(this.z,t.z),this},clamp:function(t,e){return this.x=Math.max(t.x,Math.min(e.x,this.x)),this.y=Math.max(t.y,Math.min(e.y,this.y)),this.z=Math.max(t.z,Math.min(e.z,this.z)),this},clampScalar:function(){var t=new c,e=new c;return function(i,n){return t.set(i,i,i),e.set(n,n,n),this.clamp(t,e)}}(),clampLength:function(t,e){var i=this.length();return this.multiplyScalar(Math.max(t,Math.min(e,i))/i)},floor:function(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this},ceil:function(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this},round:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this},roundToZero:function(){return this.x=this.x<0?Math.ceil(this.x):Math.floor(this.x),this.y=this.y<0?Math.ceil(this.y):Math.floor(this.y),this.z=this.z<0?Math.ceil(this.z):Math.floor(this.z),this},negate:function(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this},dot:function(t){return this.x*t.x+this.y*t.y+this.z*t.z},lengthSq:function(){return this.x*this.x+this.y*this.y+this.z*this.z},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)},lengthManhattan:function(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)},normalize:function(){return this.divideScalar(this.length())},setLength:function(t){return this.multiplyScalar(t/this.length())},lerp:function(t,e){return this.x+=(t.x-this.x)*e,this.y+=(t.y-this.y)*e,this.z+=(t.z-this.z)*e,this},lerpVectors:function(t,e,i){return this.subVectors(e,t).multiplyScalar(i).add(t)},cross:function(t,e){if(void 0!==e)return console.warn("THREE.Vector3: .cross() now only accepts one argument. Use .crossVectors( a, b ) instead."),this.crossVectors(t,e);var i=this.x,n=this.y,r=this.z;return this.x=n*t.z-r*t.y,this.y=r*t.x-i*t.z,this.z=i*t.y-n*t.x,this},crossVectors:function(t,e){var i=t.x,n=t.y,r=t.z,a=e.x,o=e.y,s=e.z;return this.x=n*s-r*o,this.y=r*a-i*s,this.z=i*o-n*a,this},projectOnVector:function(t){var e=t.dot(this)/t.lengthSq();return this.copy(t).multiplyScalar(e)},projectOnPlane:function(){var t=new c;return function(e){return t.copy(this).projectOnVector(e),this.sub(t)}}(),reflect:function(){var t=new c;return function(e){return this.sub(t.copy(e).multiplyScalar(2*this.dot(e)))}}(),angleTo:function(t){var e=this.dot(t)/Math.sqrt(this.lengthSq()*t.lengthSq());return Math.acos(hs.clamp(e,-1,1))},distanceTo:function(t){return Math.sqrt(this.distanceToSquared(t))},distanceToSquared:function(t){var e=this.x-t.x,i=this.y-t.y,n=this.z-t.z;return e*e+i*i+n*n},distanceToManhattan:function(t){return Math.abs(this.x-t.x)+Math.abs(this.y-t.y)+Math.abs(this.z-t.z)},setFromSpherical:function(t){var e=Math.sin(t.phi)*t.radius;return this.x=e*Math.sin(t.theta),this.y=Math.cos(t.phi)*t.radius,this.z=e*Math.cos(t.theta),this},setFromCylindrical:function(t){return this.x=t.radius*Math.sin(t.theta),this.y=t.y,this.z=t.radius*Math.cos(t.theta),this},setFromMatrixPosition:function(t){return this.setFromMatrixColumn(t,3)},setFromMatrixScale:function(t){var e=this.setFromMatrixColumn(t,0).length(),i=this.setFromMatrixColumn(t,1).length(),n=this.setFromMatrixColumn(t,2).length();return this.x=e,this.y=i,this.z=n,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,i){return void 0!==i&&console.warn("THREE.Vector3: offset has been removed from .fromBufferAttribute()."),this.x=t.getX(e),this.y=t.getY(e),this.z=t.getZ(e),this}}),Object.assign(h.prototype,{isMatrix4:!0,set:function(t,e,i,n,r,a,o,s,c,h,l,u,p,d,f,m){var v=this.elements;return v[0]=t,v[4]=e,v[8]=i,v[12]=n,v[1]=r,v[5]=a,v[9]=o,v[13]=s,v[2]=c,v[6]=h,v[10]=l,v[14]=u,v[3]=p,v[7]=d,v[11]=f,v[15]=m,this},identity:function(){return this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1),this},clone:function(){return(new h).fromArray(this.elements)},copy:function(t){var e=this.elements,i=t.elements;return e[0]=i[0],e[1]=i[1],e[2]=i[2],e[3]=i[3],e[4]=i[4],e[5]=i[5],e[6]=i[6],e[7]=i[7],e[8]=i[8],e[9]=i[9],e[10]=i[10],e[11]=i[11],e[12]=i[12],e[13]=i[13],e[14]=i[14],e[15]=i[15],this},copyPosition:function(t){var e=this.elements,i=t.elements;return e[12]=i[12],e[13]=i[13],e[14]=i[14],this},extractBasis:function(t,e,i){return t.setFromMatrixColumn(this,0),e.setFromMatrixColumn(this,1),i.setFromMatrixColumn(this,2),this},makeBasis:function(t,e,i){return this.set(t.x,e.x,i.x,0,t.y,e.y,i.y,0,t.z,e.z,i.z,0,0,0,0,1),this},extractRotation:function(){var t=new c;return function(e){var i=this.elements,n=e.elements,r=1/t.setFromMatrixColumn(e,0).length(),a=1/t.setFromMatrixColumn(e,1).length(),o=1/t.setFromMatrixColumn(e,2).length();return i[0]=n[0]*r,i[1]=n[1]*r,i[2]=n[2]*r,i[4]=n[4]*a,i[5]=n[5]*a,i[6]=n[6]*a,i[8]=n[8]*o,i[9]=n[9]*o,i[10]=n[10]*o,this}}(),makeRotationFromEuler:function(t){!1===(t&&t.isEuler)&&console.error("THREE.Matrix: .makeRotationFromEuler() now expects a Euler rotation rather than a Vector3 and order.");var e=this.elements,i=t.x,n=t.y,r=t.z,a=Math.cos(i),o=Math.sin(i),s=Math.cos(n),c=Math.sin(n),h=Math.cos(r),l=Math.sin(r);if("XYZ"===t.order){var u=a*h,p=a*l,d=o*h,f=o*l;e[0]=s*h,e[4]=-s*l,e[8]=c,e[1]=p+d*c,e[5]=u-f*c,e[9]=-o*s,e[2]=f-u*c,e[6]=d+p*c,e[10]=a*s}else if("YXZ"===t.order){var m=s*h,v=s*l,g=c*h,y=c*l;e[0]=m+y*o,e[4]=g*o-v,e[8]=a*c,e[1]=a*l,e[5]=a*h,e[9]=-o,e[2]=v*o-g,e[6]=y+m*o,e[10]=a*s}else if("ZXY"===t.order){var m=s*h,v=s*l,g=c*h,y=c*l;e[0]=m-y*o,e[4]=-a*l,e[8]=g+v*o,e[1]=v+g*o,e[5]=a*h,e[9]=y-m*o,e[2]=-a*c,e[6]=o,e[10]=a*s}else if("ZYX"===t.order){var u=a*h,p=a*l,d=o*h,f=o*l;e[0]=s*h,e[4]=d*c-p,e[8]=u*c+f,e[1]=s*l,e[5]=f*c+u,e[9]=p*c-d,e[2]=-c,e[6]=o*s,e[10]=a*s}else if("YZX"===t.order){var x=a*s,b=a*c,_=o*s,w=o*c;e[0]=s*h,e[4]=w-x*l,e[8]=_*l+b,e[1]=l,e[5]=a*h,e[9]=-o*h,e[2]=-c*h,e[6]=b*l+_,e[10]=x-w*l}else if("XZY"===t.order){var x=a*s,b=a*c,_=o*s,w=o*c;e[0]=s*h,e[4]=-l,e[8]=c*h,e[1]=x*l+w,e[5]=a*h,e[9]=b*l-_,e[2]=_*l-b,e[6]=o*h,e[10]=w*l+x}return e[3]=0,e[7]=0,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,this},makeRotationFromQuaternion:function(t){var e=this.elements,i=t._x,n=t._y,r=t._z,a=t._w,o=i+i,s=n+n,c=r+r,h=i*o,l=i*s,u=i*c,p=n*s,d=n*c,f=r*c,m=a*o,v=a*s,g=a*c;return e[0]=1-(p+f),e[4]=l-g,e[8]=u+v,e[1]=l+g,e[5]=1-(h+f),e[9]=d-m,e[2]=u-v,e[6]=d+m,e[10]=1-(h+p),e[3]=0,e[7]=0,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,this},lookAt:function(){var t=new c,e=new c,i=new c;return function(n,r,a){var o=this.elements;return i.subVectors(n,r),0===i.lengthSq()&&(i.z=1),i.normalize(),t.crossVectors(a,i),0===t.lengthSq()&&(i.z+=1e-4,t.crossVectors(a,i)),t.normalize(),e.crossVectors(i,t),o[0]=t.x,o[4]=e.x,o[8]=i.x,o[1]=t.y,o[5]=e.y,o[9]=i.y,o[2]=t.z,o[6]=e.z,o[10]=i.z,this}}(),multiply:function(t,e){return void 0!==e?(console.warn("THREE.Matrix4: .multiply() now only accepts one argument. Use .multiplyMatrices( a, b ) instead."),this.multiplyMatrices(t,e)):this.multiplyMatrices(this,t)},premultiply:function(t){return this.multiplyMatrices(t,this)},multiplyMatrices:function(t,e){var i=t.elements,n=e.elements,r=this.elements,a=i[0],o=i[4],s=i[8],c=i[12],h=i[1],l=i[5],u=i[9],p=i[13],d=i[2],f=i[6],m=i[10],v=i[14],g=i[3],y=i[7],x=i[11],b=i[15],_=n[0],w=n[4],M=n[8],E=n[12],T=n[1],S=n[5],A=n[9],L=n[13],R=n[2],P=n[6],C=n[10],I=n[14],U=n[3],O=n[7],D=n[11],N=n[15];return r[0]=a*_+o*T+s*R+c*U,r[4]=a*w+o*S+s*P+c*O,r[8]=a*M+o*A+s*C+c*D,r[12]=a*E+o*L+s*I+c*N,r[1]=h*_+l*T+u*R+p*U,r[5]=h*w+l*S+u*P+p*O,r[9]=h*M+l*A+u*C+p*D,r[13]=h*E+l*L+u*I+p*N,r[2]=d*_+f*T+m*R+v*U,r[6]=d*w+f*S+m*P+v*O,r[10]=d*M+f*A+m*C+v*D,r[14]=d*E+f*L+m*I+v*N,r[3]=g*_+y*T+x*R+b*U,r[7]=g*w+y*S+x*P+b*O,r[11]=g*M+y*A+x*C+b*D,r[15]=g*E+y*L+x*I+b*N,this},multiplyScalar:function(t){var e=this.elements;return e[0]*=t,e[4]*=t,e[8]*=t,e[12]*=t,e[1]*=t,e[5]*=t,e[9]*=t,e[13]*=t,e[2]*=t,e[6]*=t,e[10]*=t,e[14]*=t,e[3]*=t,e[7]*=t,e[11]*=t,e[15]*=t,this},applyToBufferAttribute:function(){var t=new c;return function(e){for(var i=0,n=e.count;i<n;i++)t.x=e.getX(i),t.y=e.getY(i),t.z=e.getZ(i),t.applyMatrix4(this),e.setXYZ(i,t.x,t.y,t.z);return e}}(),determinant:function(){var t=this.elements,e=t[0],i=t[4],n=t[8],r=t[12],a=t[1],o=t[5],s=t[9],c=t[13],h=t[2],l=t[6],u=t[10],p=t[14];return t[3]*(+r*s*l-n*c*l-r*o*u+i*c*u+n*o*p-i*s*p)+t[7]*(+e*s*p-e*c*u+r*a*u-n*a*p+n*c*h-r*s*h)+t[11]*(+e*c*l-e*o*p-r*a*l+i*a*p+r*o*h-i*c*h)+t[15]*(-n*o*h-e*s*l+e*o*u+n*a*l-i*a*u+i*s*h)},transpose:function(){var t,e=this.elements;return t=e[1],e[1]=e[4],e[4]=t,t=e[2],e[2]=e[8],e[8]=t,t=e[6],e[6]=e[9],e[9]=t,t=e[3],e[3]=e[12],e[12]=t,t=e[7],e[7]=e[13],e[13]=t,t=e[11],e[11]=e[14],e[14]=t,this},setPosition:function(t){var e=this.elements;return e[12]=t.x,e[13]=t.y,e[14]=t.z,this},getInverse:function(t,e){var i=this.elements,n=t.elements,r=n[0],a=n[1],o=n[2],s=n[3],c=n[4],h=n[5],l=n[6],u=n[7],p=n[8],d=n[9],f=n[10],m=n[11],v=n[12],g=n[13],y=n[14],x=n[15],b=d*y*u-g*f*u+g*l*m-h*y*m-d*l*x+h*f*x,_=v*f*u-p*y*u-v*l*m+c*y*m+p*l*x-c*f*x,w=p*g*u-v*d*u+v*h*m-c*g*m-p*h*x+c*d*x,M=v*d*l-p*g*l-v*h*f+c*g*f+p*h*y-c*d*y,E=r*b+a*_+o*w+s*M;if(0===E){var T="THREE.Matrix4.getInverse(): can't invert matrix, determinant is 0";if(!0===e)throw new Error(T);return console.warn(T),this.identity()}var S=1/E;return i[0]=b*S,i[1]=(g*f*s-d*y*s-g*o*m+a*y*m+d*o*x-a*f*x)*S,i[2]=(h*y*s-g*l*s+g*o*u-a*y*u-h*o*x+a*l*x)*S,i[3]=(d*l*s-h*f*s-d*o*u+a*f*u+h*o*m-a*l*m)*S,i[4]=_*S,i[5]=(p*y*s-v*f*s+v*o*m-r*y*m-p*o*x+r*f*x)*S,i[6]=(v*l*s-c*y*s-v*o*u+r*y*u+c*o*x-r*l*x)*S,i[7]=(c*f*s-p*l*s+p*o*u-r*f*u-c*o*m+r*l*m)*S,i[8]=w*S,i[9]=(v*d*s-p*g*s-v*a*m+r*g*m+p*a*x-r*d*x)*S,i[10]=(c*g*s-v*h*s+v*a*u-r*g*u-c*a*x+r*h*x)*S,i[11]=(p*h*s-c*d*s-p*a*u+r*d*u+c*a*m-r*h*m)*S,i[12]=M*S,i[13]=(p*g*o-v*d*o+v*a*f-r*g*f-p*a*y+r*d*y)*S,i[14]=(v*h*o-c*g*o-v*a*l+r*g*l+c*a*y-r*h*y)*S,i[15]=(c*d*o-p*h*o+p*a*l-r*d*l-c*a*f+r*h*f)*S,this},scale:function(t){var e=this.elements,i=t.x,n=t.y,r=t.z;return e[0]*=i,e[4]*=n,e[8]*=r,e[1]*=i,e[5]*=n,e[9]*=r,e[2]*=i,e[6]*=n,e[10]*=r,e[3]*=i,e[7]*=n,e[11]*=r,this},getMaxScaleOnAxis:function(){var t=this.elements,e=t[0]*t[0]+t[1]*t[1]+t[2]*t[2],i=t[4]*t[4]+t[5]*t[5]+t[6]*t[6],n=t[8]*t[8]+t[9]*t[9]+t[10]*t[10];return Math.sqrt(Math.max(e,i,n))},makeTranslation:function(t,e,i){return this.set(1,0,0,t,0,1,0,e,0,0,1,i,0,0,0,1),this},makeRotationX:function(t){var e=Math.cos(t),i=Math.sin(t);return this.set(1,0,0,0,0,e,-i,0,0,i,e,0,0,0,0,1),this},makeRotationY:function(t){var e=Math.cos(t),i=Math.sin(t);return this.set(e,0,i,0,0,1,0,0,-i,0,e,0,0,0,0,1),this},makeRotationZ:function(t){var e=Math.cos(t),i=Math.sin(t);return this.set(e,-i,0,0,i,e,0,0,0,0,1,0,0,0,0,1),this},makeRotationAxis:function(t,e){var i=Math.cos(e),n=Math.sin(e),r=1-i,a=t.x,o=t.y,s=t.z,c=r*a,h=r*o;return this.set(c*a+i,c*o-n*s,c*s+n*o,0,c*o+n*s,h*o+i,h*s-n*a,0,c*s-n*o,h*s+n*a,r*s*s+i,0,0,0,0,1),this},makeScale:function(t,e,i){return this.set(t,0,0,0,0,e,0,0,0,0,i,0,0,0,0,1),this},makeShear:function(t,e,i){return this.set(1,e,i,0,t,1,i,0,t,e,1,0,0,0,0,1),this},compose:function(t,e,i){return this.makeRotationFromQuaternion(e),this.scale(i),this.setPosition(t),this},decompose:function(){var t=new c,e=new h;return function(i,n,r){var a=this.elements,o=t.set(a[0],a[1],a[2]).length(),s=t.set(a[4],a[5],a[6]).length(),c=t.set(a[8],a[9],a[10]).length();this.determinant()<0&&(o=-o),i.x=a[12],i.y=a[13],i.z=a[14],e.copy(this);var h=1/o,l=1/s,u=1/c;return e.elements[0]*=h,e.elements[1]*=h,e.elements[2]*=h,e.elements[4]*=l,e.elements[5]*=l,e.elements[6]*=l,e.elements[8]*=u,e.elements[9]*=u,e.elements[10]*=u,n.setFromRotationMatrix(e),r.x=o,r.y=s,r.z=c,this}}(),makePerspective:function(t,e,i,n,r,a){void 0===a&&console.warn("THREE.Matrix4: .makePerspective() has been redefined and has a new signature. Please check the docs.");var o=this.elements,s=2*r/(e-t),c=2*r/(i-n),h=(e+t)/(e-t),l=(i+n)/(i-n),u=-(a+r)/(a-r),p=-2*a*r/(a-r);return o[0]=s,o[4]=0,o[8]=h,o[12]=0,o[1]=0,o[5]=c,o[9]=l,o[13]=0,o[2]=0,o[6]=0,o[10]=u,o[14]=p,o[3]=0,o[7]=0,o[11]=-1,o[15]=0,this},makeOrthographic:function(t,e,i,n,r,a){var o=this.elements,s=1/(e-t),c=1/(i-n),h=1/(a-r),l=(e+t)*s,u=(i+n)*c,p=(a+r)*h;return o[0]=2*s,o[4]=0,o[8]=0,o[12]=-l,o[1]=0,o[5]=2*c,o[9]=0,o[13]=-u,o[2]=0,o[6]=0,o[10]=-2*h,o[14]=-p,o[3]=0,o[7]=0,o[11]=0,o[15]=1,this},equals:function(t){for(var e=this.elements,i=t.elements,n=0;n<16;n++)if(e[n]!==i[n])return!1;return!0},fromArray:function(t,e){void 0===e&&(e=0);for(var i=0;i<16;i++)this.elements[i]=t[i+e];return this},toArray:function(t,e){void 0===t&&(t=[]),void 0===e&&(e=0);var i=this.elements;return t[e]=i[0],t[e+1]=i[1],t[e+2]=i[2],t[e+3]=i[3],t[e+4]=i[4],t[e+5]=i[5],t[e+6]=i[6],t[e+7]=i[7],t[e+8]=i[8],t[e+9]=i[9],t[e+10]=i[10],t[e+11]=i[11],t[e+12]=i[12],t[e+13]=i[13],t[e+14]=i[14],t[e+15]=i[15],t}}),l.prototype=Object.create(n.prototype),l.prototype.constructor=l,l.prototype.isDataTexture=!0,u.prototype=Object.create(n.prototype),u.prototype.constructor=u,u.prototype.isCubeTexture=!0,Object.defineProperty(u.prototype,"images",{get:function(){return this.image},set:function(t){this.image=t}});var us=new n,ps=new u,ds=[],fs=[],ms=new Float32Array(16),vs=new Float32Array(9);V.prototype.setValue=function(t,e){for(var i=this.seq,n=0,r=i.length;n!==r;++n){var a=i[n];a.setValue(t,e[a.id])}};var gs=/([\w\d_]+)(\])?(\[|\.)?/g;W.prototype.setValue=function(t,e,i){var n=this.map[e]
;void 0!==n&&n.setValue(t,i,this.renderer)},W.prototype.setOptional=function(t,e,i){var n=e[i];void 0!==n&&this.setValue(t,i,n)},W.upload=function(t,e,i,n){for(var r=0,a=e.length;r!==a;++r){var o=e[r],s=i[o.id];!1!==s.needsUpdate&&o.setValue(t,s.value,n)}},W.seqWithValue=function(t,e){for(var i=[],n=0,r=t.length;n!==r;++n){var a=t[n];a.id in e&&i.push(a)}return i};var ys={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,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};Object.assign(X.prototype,{isColor:!0,r:1,g:1,b:1,set:function(t){return t&&t.isColor?this.copy(t):"number"==typeof t?this.setHex(t):"string"==typeof t&&this.setStyle(t),this},setScalar:function(t){return this.r=t,this.g=t,this.b=t,this},setHex:function(t){return t=Math.floor(t),this.r=(t>>16&255)/255,this.g=(t>>8&255)/255,this.b=(255&t)/255,this},setRGB:function(t,e,i){return this.r=t,this.g=e,this.b=i,this},setHSL:function(){function t(t,e,i){return i<0&&(i+=1),i>1&&(i-=1),i<1/6?t+6*(e-t)*i:i<.5?e:i<2/3?t+6*(e-t)*(2/3-i):t}return function(e,i,n){if(e=hs.euclideanModulo(e,1),i=hs.clamp(i,0,1),n=hs.clamp(n,0,1),0===i)this.r=this.g=this.b=n;else{var r=n<=.5?n*(1+i):n+i-n*i,a=2*n-r;this.r=t(a,r,e+1/3),this.g=t(a,r,e),this.b=t(a,r,e-1/3)}return this}}(),setStyle:function(t){function e(e){void 0!==e&&parseFloat(e)<1&&console.warn("THREE.Color: Alpha component of "+t+" will be ignored.")}var i;if(i=/^((?:rgb|hsl)a?)\(\s*([^\)]*)\)/.exec(t)){var n,r=i[1],a=i[2];switch(r){case"rgb":case"rgba":if(n=/^(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(,\s*([0-9]*\.?[0-9]+)\s*)?$/.exec(a))return this.r=Math.min(255,parseInt(n[1],10))/255,this.g=Math.min(255,parseInt(n[2],10))/255,this.b=Math.min(255,parseInt(n[3],10))/255,e(n[5]),this;if(n=/^(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(,\s*([0-9]*\.?[0-9]+)\s*)?$/.exec(a))return this.r=Math.min(100,parseInt(n[1],10))/100,this.g=Math.min(100,parseInt(n[2],10))/100,this.b=Math.min(100,parseInt(n[3],10))/100,e(n[5]),this;break;case"hsl":case"hsla":if(n=/^([0-9]*\.?[0-9]+)\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(,\s*([0-9]*\.?[0-9]+)\s*)?$/.exec(a)){var o=parseFloat(n[1])/360,s=parseInt(n[2],10)/100,c=parseInt(n[3],10)/100;return e(n[5]),this.setHSL(o,s,c)}}}else if(i=/^\#([A-Fa-f0-9]+)$/.exec(t)){var h=i[1],l=h.length;if(3===l)return this.r=parseInt(h.charAt(0)+h.charAt(0),16)/255,this.g=parseInt(h.charAt(1)+h.charAt(1),16)/255,this.b=parseInt(h.charAt(2)+h.charAt(2),16)/255,this;if(6===l)return this.r=parseInt(h.charAt(0)+h.charAt(1),16)/255,this.g=parseInt(h.charAt(2)+h.charAt(3),16)/255,this.b=parseInt(h.charAt(4)+h.charAt(5),16)/255,this}if(t&&t.length>0){var h=ys[t];void 0!==h?this.setHex(h):console.warn("THREE.Color: Unknown color "+t)}return this},clone:function(){return new this.constructor(this.r,this.g,this.b)},copy:function(t){return this.r=t.r,this.g=t.g,this.b=t.b,this},copyGammaToLinear:function(t,e){return void 0===e&&(e=2),this.r=Math.pow(t.r,e),this.g=Math.pow(t.g,e),this.b=Math.pow(t.b,e),this},copyLinearToGamma:function(t,e){void 0===e&&(e=2);var i=e>0?1/e:1;return this.r=Math.pow(t.r,i),this.g=Math.pow(t.g,i),this.b=Math.pow(t.b,i),this},convertGammaToLinear:function(){var t=this.r,e=this.g,i=this.b;return this.r=t*t,this.g=e*e,this.b=i*i,this},convertLinearToGamma:function(){return this.r=Math.sqrt(this.r),this.g=Math.sqrt(this.g),this.b=Math.sqrt(this.b),this},getHex:function(){return 255*this.r<<16^255*this.g<<8^255*this.b<<0},getHexString:function(){return("000000"+this.getHex().toString(16)).slice(-6)},getHSL:function(t){var e,i,n=t||{h:0,s:0,l:0},r=this.r,a=this.g,o=this.b,s=Math.max(r,a,o),c=Math.min(r,a,o),h=(c+s)/2;if(c===s)e=0,i=0;else{var l=s-c;switch(i=h<=.5?l/(s+c):l/(2-s-c),s){case r:e=(a-o)/l+(a<o?6:0);break;case a:e=(o-r)/l+2;break;case o:e=(r-a)/l+4}e/=6}return n.h=e,n.s=i,n.l=h,n},getStyle:function(){return"rgb("+(255*this.r|0)+","+(255*this.g|0)+","+(255*this.b|0)+")"},offsetHSL:function(t,e,i){var n=this.getHSL();return n.h+=t,n.s+=e,n.l+=i,this.setHSL(n.h,n.s,n.l),this},add:function(t){return this.r+=t.r,this.g+=t.g,this.b+=t.b,this},addColors:function(t,e){return this.r=t.r+e.r,this.g=t.g+e.g,this.b=t.b+e.b,this},addScalar:function(t){return this.r+=t,this.g+=t,this.b+=t,this},sub:function(t){return this.r=Math.max(0,this.r-t.r),this.g=Math.max(0,this.g-t.g),this.b=Math.max(0,this.b-t.b),this},multiply:function(t){return this.r*=t.r,this.g*=t.g,this.b*=t.b,this},multiplyScalar:function(t){return this.r*=t,this.g*=t,this.b*=t,this},lerp:function(t,e){return this.r+=(t.r-this.r)*e,this.g+=(t.g-this.g)*e,this.b+=(t.b-this.b)*e,this},equals:function(t){return t.r===this.r&&t.g===this.g&&t.b===this.b},fromArray:function(t,e){return void 0===e&&(e=0),this.r=t[e],this.g=t[e+1],this.b=t[e+2],this},toArray:function(t,e){return void 0===t&&(t=[]),void 0===e&&(e=0),t[e]=this.r,t[e+1]=this.g,t[e+2]=this.b,t},toJSON:function(){return this.getHex()}});var xs={common:{diffuse:{value:new X(15658734)},opacity:{value:1},map:{value:null},offsetRepeat:{value:new r(0,0,1,1)},specularMap:{value:null},alphaMap:{value:null},envMap:{value:null},flipEnvMap:{value:-1},reflectivity:{value:1},refractionRatio:{value:.98}},aomap:{aoMap:{value:null},aoMapIntensity:{value:1}},lightmap:{lightMap:{value:null},lightMapIntensity:{value:1}},emissivemap:{emissiveMap:{value:null}},bumpmap:{bumpMap:{value:null},bumpScale:{value:1}},normalmap:{normalMap:{value:null},normalScale:{value:new i(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:[]},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:{}}},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},offsetRepeat:{value:new r(0,0,1,1)}}},bs={merge:function(t){for(var e={},i=0;i<t.length;i++){var n=this.clone(t[i]);for(var r in n)e[r]=n[r]}return e},clone:function(t){var e={};for(var i in t){e[i]={};for(var n in t[i]){var r=t[i][n];r&&(r.isColor||r.isMatrix3||r.isMatrix4||r.isVector2||r.isVector3||r.isVector4||r.isTexture)?e[i][n]=r.clone():Array.isArray(r)?e[i][n]=r.slice():e[i][n]=r}}return e}},_s={alphamap_fragment:"#ifdef USE_ALPHAMAP\n\tdiffuseColor.a *= texture2D( alphaMap, vUv ).g;\n#endif\n",alphamap_pars_fragment:"#ifdef USE_ALPHAMAP\n\tuniform sampler2D alphaMap;\n#endif\n",alphatest_fragment:"#ifdef ALPHATEST\n\tif ( diffuseColor.a < ALPHATEST ) discard;\n#endif\n",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( PHYSICAL )\n\t\tfloat dotNV = saturate( dot( geometry.normal, geometry.viewDir ) );\n\t\treflectedLight.indirectSpecular *= computeSpecularOcclusion( dotNV, ambientOcclusion, material.specularRoughness );\n\t#endif\n#endif\n",aomap_pars_fragment:"#ifdef USE_AOMAP\n\tuniform sampler2D aoMap;\n\tuniform float aoMapIntensity;\n#endif",begin_vertex:"\nvec3 transformed = vec3( position );\n",beginnormal_vertex:"\nvec3 objectNormal = vec3( normal );\n",bsdfs:"float punctualLightIntensityToIrradianceFactor( const in float lightDistance, const in float cutoffDistance, const in float decayExponent ) {\n\tif( decayExponent > 0.0 ) {\n#if defined ( PHYSICALLY_CORRECT_LIGHTS )\n\t\tfloat distanceFalloff = 1.0 / max( pow( lightDistance, decayExponent ), 0.01 );\n\t\tfloat maxDistanceCutoffFactor = pow2( saturate( 1.0 - pow4( lightDistance / cutoffDistance ) ) );\n\t\treturn distanceFalloff * maxDistanceCutoffFactor;\n#else\n\t\treturn pow( saturate( -lightDistance / cutoffDistance + 1.0 ), decayExponent );\n#endif\n\t}\n\treturn 1.0;\n}\nvec3 BRDF_Diffuse_Lambert( const in vec3 diffuseColor ) {\n\treturn RECIPROCAL_PI * diffuseColor;\n}\nvec3 F_Schlick( const in vec3 specularColor, const in float dotLH ) {\n\tfloat fresnel = exp2( ( -5.55473 * dotLH - 6.98316 ) * dotLH );\n\treturn ( 1.0 - specularColor ) * fresnel + specularColor;\n}\nfloat G_GGX_Smith( const in float alpha, const in float dotNL, const in float dotNV ) {\n\tfloat a2 = pow2( alpha );\n\tfloat gl = dotNL + sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNL ) );\n\tfloat gv = dotNV + sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNV ) );\n\treturn 1.0 / ( gl * gv );\n}\nfloat G_GGX_SmithCorrelated( const in float alpha, const in float dotNL, const in float dotNV ) {\n\tfloat a2 = pow2( alpha );\n\tfloat gv = dotNL * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNV ) );\n\tfloat gl = dotNV * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNL ) );\n\treturn 0.5 / max( gv + gl, EPSILON );\n}\nfloat D_GGX( const in float alpha, const in float dotNH ) {\n\tfloat a2 = pow2( alpha );\n\tfloat denom = pow2( dotNH ) * ( a2 - 1.0 ) + 1.0;\n\treturn RECIPROCAL_PI * a2 / pow2( denom );\n}\nvec3 BRDF_Specular_GGX( const in IncidentLight incidentLight, const in GeometricContext geometry, const in vec3 specularColor, const in float roughness ) {\n\tfloat alpha = pow2( roughness );\n\tvec3 halfDir = normalize( incidentLight.direction + geometry.viewDir );\n\tfloat dotNL = saturate( dot( geometry.normal, incidentLight.direction ) );\n\tfloat dotNV = saturate( dot( geometry.normal, geometry.viewDir ) );\n\tfloat dotNH = saturate( dot( geometry.normal, halfDir ) );\n\tfloat dotLH = saturate( dot( incidentLight.direction, halfDir ) );\n\tvec3 F = F_Schlick( specularColor, dotLH );\n\tfloat G = G_GGX_SmithCorrelated( alpha, dotNL, dotNV );\n\tfloat D = D_GGX( alpha, dotNH );\n\treturn F * ( G * D );\n}\nvec2 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 theta = acos( dot( N, V ) );\n\tvec2 uv = vec2(\n\t\tsqrt( saturate( roughness ) ),\n\t\tsaturate( theta / ( 0.5 * PI ) ) );\n\tuv = uv * LUT_SCALE + LUT_BIAS;\n\treturn uv;\n}\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.86267 + (0.49788 + 0.01436 * y ) * y;\n\tfloat b = 3.45068 + (4.18814 + y) * y;\n\tfloat v = a / b;\n\tfloat theta_sintheta = (x > 0.0) ? v : 0.5 * inversesqrt( 1.0 - x * x ) - 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 * transpose( 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\tvec3 result = vec3( LTC_ClippedSphereFormFactor( vectorFormFactor ) );\n\treturn result;\n}\nvec3 BRDF_Specular_GGX_Environment( const in GeometricContext geometry, const in vec3 specularColor, const in float roughness ) {\n\tfloat dotNV = saturate( dot( geometry.normal, geometry.viewDir ) );\n\tconst vec4 c0 = vec4( - 1, - 0.0275, - 0.572, 0.022 );\n\tconst vec4 c1 = vec4( 1, 0.0425, 1.04, - 0.04 );\n\tvec4 r = roughness * c0 + c1;\n\tfloat a004 = min( r.x * r.x, exp2( - 9.28 * dotNV ) ) * r.x + r.y;\n\tvec2 AB = vec2( -1.04, 1.04 ) * a004 + r.zw;\n\treturn specularColor * AB.x + AB.y;\n}\nfloat G_BlinnPhong_Implicit( ) {\n\treturn 0.25;\n}\nfloat D_BlinnPhong( const in float shininess, const in float dotNH ) {\n\treturn RECIPROCAL_PI * ( shininess * 0.5 + 1.0 ) * pow( dotNH, shininess );\n}\nvec3 BRDF_Specular_BlinnPhong( const in IncidentLight incidentLight, const in GeometricContext geometry, const in vec3 specularColor, const in float shininess ) {\n\tvec3 halfDir = normalize( incidentLight.direction + geometry.viewDir );\n\tfloat dotNH = saturate( dot( geometry.normal, halfDir ) );\n\tfloat dotLH = saturate( dot( incidentLight.direction, halfDir ) );\n\tvec3 F = F_Schlick( specularColor, dotLH );\n\tfloat G = G_BlinnPhong_Implicit( );\n\tfloat D = D_BlinnPhong( shininess, dotNH );\n\treturn F * ( G * D );\n}\nfloat GGXRoughnessToBlinnExponent( const in float ggxRoughness ) {\n\treturn ( 2.0 / pow2( ggxRoughness + 0.0001 ) - 2.0 );\n}\nfloat BlinnExponentToGGXRoughness( const in float blinnExponent ) {\n\treturn sqrt( 2.0 / ( blinnExponent + 2.0 ) );\n}\n",bumpmap_pars_fragment:"#ifdef USE_BUMPMAP\n\tuniform sampler2D bumpMap;\n\tuniform float bumpScale;\n\tvec2 dHdxy_fwd() {\n\t\tvec2 dSTdx = dFdx( vUv );\n\t\tvec2 dSTdy = dFdy( vUv );\n\t\tfloat Hll = bumpScale * texture2D( bumpMap, vUv ).x;\n\t\tfloat dBx = bumpScale * texture2D( bumpMap, vUv + dSTdx ).x - Hll;\n\t\tfloat dBy = bumpScale * texture2D( bumpMap, vUv + dSTdy ).x - Hll;\n\t\treturn vec2( dBx, dBy );\n\t}\n\tvec3 perturbNormalArb( vec3 surf_pos, vec3 surf_norm, vec2 dHdxy ) {\n\t\tvec3 vSigmaX = dFdx( surf_pos );\n\t\tvec3 vSigmaY = dFdy( surf_pos );\n\t\tvec3 vN = surf_norm;\n\t\tvec3 R1 = cross( vSigmaY, vN );\n\t\tvec3 R2 = cross( vN, vSigmaX );\n\t\tfloat fDet = dot( vSigmaX, R1 );\n\t\tvec3 vGrad = sign( fDet ) * ( dHdxy.x * R1 + dHdxy.y * R2 );\n\t\treturn normalize( abs( fDet ) * surf_norm - vGrad );\n\t}\n#endif\n",clipping_planes_fragment:"#if NUM_CLIPPING_PLANES > 0\n\tfor ( int i = 0; i < UNION_CLIPPING_PLANES; ++ i ) {\n\t\tvec4 plane = clippingPlanes[ i ];\n\t\tif ( dot( vViewPosition, plane.xyz ) > plane.w ) discard;\n\t}\n\t\t\n\t#if UNION_CLIPPING_PLANES < NUM_CLIPPING_PLANES\n\t\tbool clipped = true;\n\t\tfor ( int i = UNION_CLIPPING_PLANES; i < NUM_CLIPPING_PLANES; ++ i ) {\n\t\t\tvec4 plane = clippingPlanes[ i ];\n\t\t\tclipped = ( dot( vViewPosition, plane.xyz ) > plane.w ) && clipped;\n\t\t}\n\t\tif ( clipped ) discard;\n\t\n\t#endif\n#endif\n",clipping_planes_pars_fragment:"#if NUM_CLIPPING_PLANES > 0\n\t#if ! defined( PHYSICAL ) && ! defined( PHONG )\n\t\tvarying vec3 vViewPosition;\n\t#endif\n\tuniform vec4 clippingPlanes[ NUM_CLIPPING_PLANES ];\n#endif\n",clipping_planes_pars_vertex:"#if NUM_CLIPPING_PLANES > 0 && ! defined( PHYSICAL ) && ! defined( PHONG )\n\tvarying vec3 vViewPosition;\n#endif\n",clipping_planes_vertex:"#if NUM_CLIPPING_PLANES > 0 && ! defined( PHYSICAL ) && ! defined( PHONG )\n\tvViewPosition = - mvPosition.xyz;\n#endif\n",color_fragment:"#ifdef USE_COLOR\n\tdiffuseColor.rgb *= vColor;\n#endif",color_pars_fragment:"#ifdef USE_COLOR\n\tvarying vec3 vColor;\n#endif\n",color_pars_vertex:"#ifdef USE_COLOR\n\tvarying vec3 vColor;\n#endif",color_vertex:"#ifdef USE_COLOR\n\tvColor.xyz = color.xyz;\n#endif",common:"#define PI 3.14159265359\n#define PI2 6.28318530718\n#define PI_HALF 1.5707963267949\n#define RECIPROCAL_PI 0.31830988618\n#define RECIPROCAL_PI2 0.15915494\n#define LOG2 1.442695\n#define EPSILON 1e-6\n#define saturate(a) clamp( a, 0.0, 1.0 )\n#define whiteCompliment(a) ( 1.0 - saturate( a ) )\nfloat pow2( const in float x ) { return x*x; }\nfloat pow3( const in float x ) { return x*x*x; }\nfloat pow4( const in float x ) { float x2 = x*x; return x2*x2; }\nfloat average( const in vec3 color ) { return dot( color, vec3( 0.3333 ) ); }\nhighp float rand( const in vec2 uv ) {\n\tconst highp float a = 12.9898, b = 78.233, c = 43758.5453;\n\thighp float dt = dot( uv.xy, vec2( a,b ) ), sn = mod( dt, PI );\n\treturn fract(sin(sn) * c);\n}\nstruct IncidentLight {\n\tvec3 color;\n\tvec3 direction;\n\tbool visible;\n};\nstruct ReflectedLight {\n\tvec3 directDiffuse;\n\tvec3 directSpecular;\n\tvec3 indirectDiffuse;\n\tvec3 indirectSpecular;\n};\nstruct GeometricContext {\n\tvec3 position;\n\tvec3 normal;\n\tvec3 viewDir;\n};\nvec3 transformDirection( in vec3 dir, in mat4 matrix ) {\n\treturn normalize( ( matrix * vec4( dir, 0.0 ) ).xyz );\n}\nvec3 inverseTransformDirection( in vec3 dir, in mat4 matrix ) {\n\treturn normalize( ( vec4( dir, 0.0 ) * matrix ).xyz );\n}\nvec3 projectOnPlane(in vec3 point, in vec3 pointOnPlane, in vec3 planeNormal ) {\n\tfloat distance = dot( planeNormal, point - pointOnPlane );\n\treturn - distance * planeNormal + point;\n}\nfloat sideOfPlane( in vec3 point, in vec3 pointOnPlane, in vec3 planeNormal ) {\n\treturn sign( dot( point - pointOnPlane, planeNormal ) );\n}\nvec3 linePlaneIntersect( in vec3 pointOnLine, in vec3 lineDirection, in vec3 pointOnPlane, in vec3 planeNormal ) {\n\treturn lineDirection * ( dot( planeNormal, pointOnPlane - pointOnLine ) / dot( planeNormal, lineDirection ) ) + pointOnLine;\n}\nmat3 transpose( const in mat3 v ) {\n\tmat3 tmp;\n\ttmp[0] = vec3(v[0].x, v[1].x, v[2].x);\n\ttmp[1] = vec3(v[0].y, v[1].y, v[2].y);\n\ttmp[2] = vec3(v[0].z, v[1].z, v[2].z);\n\treturn tmp;\n}\n",cube_uv_reflection_fragment:"#ifdef ENVMAP_TYPE_CUBE_UV\n#define cubeUV_textureSize (1024.0)\nint getFaceFromDirection(vec3 direction) {\n\tvec3 absDirection = abs(direction);\n\tint face = -1;\n\tif( absDirection.x > absDirection.z ) {\n\t\tif(absDirection.x > absDirection.y )\n\t\t\tface = direction.x > 0.0 ? 0 : 3;\n\t\telse\n\t\t\tface = direction.y > 0.0 ? 1 : 4;\n\t}\n\telse {\n\t\tif(absDirection.z > absDirection.y )\n\t\t\tface = direction.z > 0.0 ? 2 : 5;\n\t\telse\n\t\t\tface = direction.y > 0.0 ? 1 : 4;\n\t}\n\treturn face;\n}\n#define cubeUV_maxLods1 (log2(cubeUV_textureSize*0.25) - 1.0)\n#define cubeUV_rangeClamp (exp2((6.0 - 1.0) * 2.0))\nvec2 MipLevelInfo( vec3 vec, float roughnessLevel, float roughness ) {\n\tfloat scale = exp2(cubeUV_maxLods1 - roughnessLevel);\n\tfloat dxRoughness = dFdx(roughness);\n\tfloat dyRoughness = dFdy(roughness);\n\tvec3 dx = dFdx( vec * scale * dxRoughness );\n\tvec3 dy = dFdy( vec * scale * dyRoughness );\n\tfloat d = max( dot( dx, dx ), dot( dy, dy ) );\n\td = clamp(d, 1.0, cubeUV_rangeClamp);\n\tfloat mipLevel = 0.5 * log2(d);\n\treturn vec2(floor(mipLevel), fract(mipLevel));\n}\n#define cubeUV_maxLods2 (log2(cubeUV_textureSize*0.25) - 2.0)\n#define cubeUV_rcpTextureSize (1.0 / cubeUV_textureSize)\nvec2 getCubeUV(vec3 direction, float roughnessLevel, float mipLevel) {\n\tmipLevel = roughnessLevel > cubeUV_maxLods2 - 3.0 ? 0.0 : mipLevel;\n\tfloat a = 16.0 * cubeUV_rcpTextureSize;\n\tvec2 exp2_packed = exp2( vec2( roughnessLevel, mipLevel ) );\n\tvec2 rcp_exp2_packed = vec2( 1.0 ) / exp2_packed;\n\tfloat powScale = exp2_packed.x * exp2_packed.y;\n\tfloat scale = rcp_exp2_packed.x * rcp_exp2_packed.y * 0.25;\n\tfloat mipOffset = 0.75*(1.0 - rcp_exp2_packed.y) * rcp_exp2_packed.x;\n\tbool bRes = mipLevel == 0.0;\n\tscale = bRes && (scale < a) ? a : scale;\n\tvec3 r;\n\tvec2 offset;\n\tint face = getFaceFromDirection(direction);\n\tfloat rcpPowScale = 1.0 / powScale;\n\tif( face == 0) {\n\t\tr = vec3(direction.x, -direction.z, direction.y);\n\t\toffset = vec2(0.0+mipOffset,0.75 * rcpPowScale);\n\t\toffset.y = bRes && (offset.y < 2.0*a) ? a : offset.y;\n\t}\n\telse if( face == 1) {\n\t\tr = vec3(direction.y, direction.x, direction.z);\n\t\toffset = vec2(scale+mipOffset, 0.75 * rcpPowScale);\n\t\toffset.y = bRes && (offset.y < 2.0*a) ? a : offset.y;\n\t}\n\telse if( face == 2) {\n\t\tr = vec3(direction.z, direction.x, direction.y);\n\t\toffset = vec2(2.0*scale+mipOffset, 0.75 * rcpPowScale);\n\t\toffset.y = bRes && (offset.y < 2.0*a) ? a : offset.y;\n\t}\n\telse if( face == 3) {\n\t\tr = vec3(direction.x, direction.z, direction.y);\n\t\toffset = vec2(0.0+mipOffset,0.5 * rcpPowScale);\n\t\toffset.y = bRes && (offset.y < 2.0*a) ? 0.0 : offset.y;\n\t}\n\telse if( face == 4) {\n\t\tr = vec3(direction.y, direction.x, -direction.z);\n\t\toffset = vec2(scale+mipOffset, 0.5 * rcpPowScale);\n\t\toffset.y = bRes && (offset.y < 2.0*a) ? 0.0 : offset.y;\n\t}\n\telse {\n\t\tr = vec3(direction.z, -direction.x, direction.y);\n\t\toffset = vec2(2.0*scale+mipOffset, 0.5 * rcpPowScale);\n\t\toffset.y = bRes && (offset.y < 2.0*a) ? 0.0 : offset.y;\n\t}\n\tr = normalize(r);\n\tfloat texelOffset = 0.5 * cubeUV_rcpTextureSize;\n\tvec2 s = ( r.yz / abs( r.x ) + vec2( 1.0 ) ) * 0.5;\n\tvec2 base = offset + vec2( texelOffset );\n\treturn base + s * ( scale - 2.0 * texelOffset );\n}\n#define cubeUV_maxLods3 (log2(cubeUV_textureSize*0.25) - 3.0)\nvec4 textureCubeUV(vec3 reflectedDirection, float roughness ) {\n\tfloat roughnessVal = roughness* cubeUV_maxLods3;\n\tfloat r1 = floor(roughnessVal);\n\tfloat r2 = r1 + 1.0;\n\tfloat t = fract(roughnessVal);\n\tvec2 mipInfo = MipLevelInfo(reflectedDirection, r1, roughness);\n\tfloat s = mipInfo.y;\n\tfloat level0 = mipInfo.x;\n\tfloat level1 = level0 + 1.0;\n\tlevel1 = level1 > 5.0 ? 5.0 : level1;\n\tlevel0 += min( floor( s + 0.5 ), 5.0 );\n\tvec2 uv_10 = getCubeUV(reflectedDirection, r1, level0);\n\tvec4 color10 = envMapTexelToLinear(texture2D(envMap, uv_10));\n\tvec2 uv_20 = getCubeUV(reflectedDirection, r2, level0);\n\tvec4 color20 = envMapTexelToLinear(texture2D(envMap, uv_20));\n\tvec4 result = mix(color10, color20, t);\n\treturn vec4(result.rgb, 1.0);\n}\n#endif\n",defaultnormal_vertex:"#ifdef FLIP_SIDED\n\tobjectNormal = -objectNormal;\n#endif\nvec3 transformedNormal = normalMatrix * objectNormal;\n",displacementmap_pars_vertex:"#ifdef USE_DISPLACEMENTMAP\n\tuniform sampler2D displacementMap;\n\tuniform float displacementScale;\n\tuniform float displacementBias;\n#endif\n",displacementmap_vertex:"#ifdef USE_DISPLACEMENTMAP\n\ttransformed += normal * ( texture2D( displacementMap, uv ).x * displacementScale + displacementBias );\n#endif\n",emissivemap_fragment:"#ifdef USE_EMISSIVEMAP\n\tvec4 emissiveColor = texture2D( emissiveMap, vUv );\n\temissiveColor.rgb = emissiveMapTexelToLinear( emissiveColor ).rgb;\n\ttotalEmissiveRadiance *= emissiveColor.rgb;\n#endif\n",emissivemap_pars_fragment:"#ifdef USE_EMISSIVEMAP\n\tuniform sampler2D emissiveMap;\n#endif\n",encodings_fragment:" gl_FragColor = linearToOutputTexel( gl_FragColor );\n",encodings_pars_fragment:"\nvec4 LinearToLinear( in vec4 value ) {\n\treturn value;\n}\nvec4 GammaToLinear( in vec4 value, in float gammaFactor ) {\n\treturn vec4( pow( value.xyz, vec3( gammaFactor ) ), value.w );\n}\nvec4 LinearToGamma( in vec4 value, in float gammaFactor ) {\n\treturn vec4( pow( value.xyz, vec3( 1.0 / gammaFactor ) ), value.w );\n}\nvec4 sRGBToLinear( in vec4 value ) {\n\treturn vec4( mix( pow( value.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), value.rgb * 0.0773993808, vec3( lessThanEqual( value.rgb, vec3( 0.04045 ) ) ) ), value.w );\n}\nvec4 LinearTosRGB( in vec4 value ) {\n\treturn vec4( mix( pow( value.rgb, vec3( 0.41666 ) ) * 1.055 - vec3( 0.055 ), value.rgb * 12.92, vec3( lessThanEqual( value.rgb, vec3( 0.0031308 ) ) ) ), value.w );\n}\nvec4 RGBEToLinear( in vec4 value ) {\n\treturn vec4( value.rgb * exp2( value.a * 255.0 - 128.0 ), 1.0 );\n}\nvec4 LinearToRGBE( in vec4 value ) {\n\tfloat maxComponent = max( max( value.r, value.g ), value.b );\n\tfloat fExp = clamp( ceil( log2( maxComponent ) ), -128.0, 127.0 );\n\treturn vec4( value.rgb / exp2( fExp ), ( fExp + 128.0 ) / 255.0 );\n}\nvec4 RGBMToLinear( in vec4 value, in float maxRange ) {\n\treturn vec4( value.xyz * value.w * maxRange, 1.0 );\n}\nvec4 LinearToRGBM( in vec4 value, in float maxRange ) {\n\tfloat maxRGB = max( value.x, max( value.g, value.b ) );\n\tfloat M = clamp( maxRGB / maxRange, 0.0, 1.0 );\n\tM = ceil( M * 255.0 ) / 255.0;\n\treturn vec4( value.rgb / ( M * maxRange ), M );\n}\nvec4 RGBDToLinear( in vec4 value, in float maxRange ) {\n\treturn vec4( value.rgb * ( ( maxRange / 255.0 ) / value.a ), 1.0 );\n}\nvec4 LinearToRGBD( in vec4 value, in float maxRange ) {\n\tfloat maxRGB = max( value.x, max( value.g, value.b ) );\n\tfloat D = max( maxRange / maxRGB, 1.0 );\n\tD = min( floor( D ) / 255.0, 1.0 );\n\treturn vec4( value.rgb * ( D * ( 255.0 / maxRange ) ), D );\n}\nconst mat3 cLogLuvM = mat3( 0.2209, 0.3390, 0.4184, 0.1138, 0.6780, 0.7319, 0.0102, 0.1130, 0.2969 );\nvec4 LinearToLogLuv( in vec4 value ) {\n\tvec3 Xp_Y_XYZp = value.rgb * cLogLuvM;\n\tXp_Y_XYZp = max(Xp_Y_XYZp, vec3(1e-6, 1e-6, 1e-6));\n\tvec4 vResult;\n\tvResult.xy = Xp_Y_XYZp.xy / Xp_Y_XYZp.z;\n\tfloat Le = 2.0 * log2(Xp_Y_XYZp.y) + 127.0;\n\tvResult.w = fract(Le);\n\tvResult.z = (Le - (floor(vResult.w*255.0))/255.0)/255.0;\n\treturn vResult;\n}\nconst mat3 cLogLuvInverseM = mat3( 6.0014, -2.7008, -1.7996, -1.3320, 3.1029, -5.7721, 0.3008, -1.0882, 5.6268 );\nvec4 LogLuvToLinear( in vec4 value ) {\n\tfloat Le = value.z * 255.0 + value.w;\n\tvec3 Xp_Y_XYZp;\n\tXp_Y_XYZp.y = exp2((Le - 127.0) / 2.0);\n\tXp_Y_XYZp.z = Xp_Y_XYZp.y / value.y;\n\tXp_Y_XYZp.x = value.x * Xp_Y_XYZp.z;\n\tvec3 vRGB = Xp_Y_XYZp.rgb * cLogLuvInverseM;\n\treturn vec4( max(vRGB, 0.0), 1.0 );\n}\n",envmap_fragment:"#ifdef USE_ENVMAP\n\t#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG )\n\t\tvec3 cameraToVertex = normalize( vWorldPosition - cameraPosition );\n\t\tvec3 worldNormal = inverseTransformDirection( normal, viewMatrix );\n\t\t#ifdef ENVMAP_MODE_REFLECTION\n\t\t\tvec3 reflectVec = reflect( cameraToVertex, worldNormal );\n\t\t#else\n\t\t\tvec3 reflectVec = refract( cameraToVertex, worldNormal, refractionRatio );\n\t\t#endif\n\t#else\n\t\tvec3 reflectVec = vReflect;\n\t#endif\n\t#ifdef ENVMAP_TYPE_CUBE\n\t\tvec4 envColor = textureCube( envMap, flipNormal * vec3( flipEnvMap * reflectVec.x, reflectVec.yz ) );\n\t#elif defined( ENVMAP_TYPE_EQUIREC )\n\t\tvec2 sampleUV;\n\t\tsampleUV.y = saturate( flipNormal * reflectVec.y * 0.5 + 0.5 );\n\t\tsampleUV.x = atan( flipNormal * reflectVec.z, flipNormal * reflectVec.x ) * RECIPROCAL_PI2 + 0.5;\n\t\tvec4 envColor = texture2D( envMap, sampleUV );\n\t#elif defined( ENVMAP_TYPE_SPHERE )\n\t\tvec3 reflectView = flipNormal * normalize( ( viewMatrix * vec4( reflectVec, 0.0 ) ).xyz + vec3( 0.0, 0.0, 1.0 ) );\n\t\tvec4 envColor = texture2D( envMap, reflectView.xy * 0.5 + 0.5 );\n\t#else\n\t\tvec4 envColor = vec4( 0.0 );\n\t#endif\n\tenvColor = envMapTexelToLinear( envColor );\n\t#ifdef ENVMAP_BLENDING_MULTIPLY\n\t\toutgoingLight = mix( outgoingLight, outgoingLight * envColor.xyz, specularStrength * reflectivity );\n\t#elif defined( ENVMAP_BLENDING_MIX )\n\t\toutgoingLight = mix( outgoingLight, envColor.xyz, specularStrength * reflectivity );\n\t#elif defined( ENVMAP_BLENDING_ADD )\n\t\toutgoingLight += envColor.xyz * specularStrength * reflectivity;\n\t#endif\n#endif\n",envmap_pars_fragment:"#if defined( USE_ENVMAP ) || defined( PHYSICAL )\n\tuniform float reflectivity;\n\tuniform float envMapIntensity;\n#endif\n#ifdef USE_ENVMAP\n\t#if ! defined( PHYSICAL ) && ( defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) )\n\t\tvarying vec3 vWorldPosition;\n\t#endif\n\t#ifdef ENVMAP_TYPE_CUBE\n\t\tuniform samplerCube envMap;\n\t#else\n\t\tuniform sampler2D envMap;\n\t#endif\n\tuniform float flipEnvMap;\n\t#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( PHYSICAL )\n\t\tuniform float refractionRatio;\n\t#else\n\t\tvarying vec3 vReflect;\n\t#endif\n#endif\n",envmap_pars_vertex:"#ifdef USE_ENVMAP\n\t#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG )\n\t\tvarying vec3 vWorldPosition;\n\t#else\n\t\tvarying vec3 vReflect;\n\t\tuniform float refractionRatio;\n\t#endif\n#endif\n",envmap_vertex:"#ifdef USE_ENVMAP\n\t#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG )\n\t\tvWorldPosition = worldPosition.xyz;\n\t#else\n\t\tvec3 cameraToVertex = normalize( worldPosition.xyz - cameraPosition );\n\t\tvec3 worldNormal = inverseTransformDirection( transformedNormal, viewMatrix );\n\t\t#ifdef ENVMAP_MODE_REFLECTION\n\t\t\tvReflect = reflect( cameraToVertex, worldNormal );\n\t\t#else\n\t\t\tvReflect = refract( cameraToVertex, worldNormal, refractionRatio );\n\t\t#endif\n\t#endif\n#endif\n",fog_vertex:"\n#ifdef USE_FOG\nfogDepth = -mvPosition.z;\n#endif",
fog_pars_vertex:"#ifdef USE_FOG\n varying float fogDepth;\n#endif\n",fog_fragment:"#ifdef USE_FOG\n\t#ifdef FOG_EXP2\n\t\tfloat fogFactor = whiteCompliment( exp2( - fogDensity * fogDensity * fogDepth * fogDepth * LOG2 ) );\n\t#else\n\t\tfloat fogFactor = smoothstep( fogNear, fogFar, fogDepth );\n\t#endif\n\tgl_FragColor.rgb = mix( gl_FragColor.rgb, fogColor, fogFactor );\n#endif\n",fog_pars_fragment:"#ifdef USE_FOG\n\tuniform vec3 fogColor;\n\tvarying float fogDepth;\n\t#ifdef FOG_EXP2\n\t\tuniform float fogDensity;\n\t#else\n\t\tuniform float fogNear;\n\t\tuniform float fogFar;\n\t#endif\n#endif\n",gradientmap_pars_fragment:"#ifdef TOON\n\tuniform sampler2D gradientMap;\n\tvec3 getGradientIrradiance( vec3 normal, vec3 lightDirection ) {\n\t\tfloat dotNL = dot( normal, lightDirection );\n\t\tvec2 coord = vec2( dotNL * 0.5 + 0.5, 0.0 );\n\t\t#ifdef USE_GRADIENTMAP\n\t\t\treturn texture2D( gradientMap, coord ).rgb;\n\t\t#else\n\t\t\treturn ( coord.x < 0.7 ) ? vec3( 0.7 ) : vec3( 1.0 );\n\t\t#endif\n\t}\n#endif\n",lightmap_fragment:"#ifdef USE_LIGHTMAP\n\treflectedLight.indirectDiffuse += PI * texture2D( lightMap, vUv2 ).xyz * lightMapIntensity;\n#endif\n",lightmap_pars_fragment:"#ifdef USE_LIGHTMAP\n\tuniform sampler2D lightMap;\n\tuniform float lightMapIntensity;\n#endif",lights_lambert_vertex:"vec3 diffuse = vec3( 1.0 );\nGeometricContext geometry;\ngeometry.position = mvPosition.xyz;\ngeometry.normal = normalize( transformedNormal );\ngeometry.viewDir = normalize( -mvPosition.xyz );\nGeometricContext backGeometry;\nbackGeometry.position = geometry.position;\nbackGeometry.normal = -geometry.normal;\nbackGeometry.viewDir = geometry.viewDir;\nvLightFront = vec3( 0.0 );\n#ifdef DOUBLE_SIDED\n\tvLightBack = vec3( 0.0 );\n#endif\nIncidentLight directLight;\nfloat dotNL;\nvec3 directLightColor_Diffuse;\n#if NUM_POINT_LIGHTS > 0\n\tfor ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {\n\t\tgetPointDirectLightIrradiance( pointLights[ i ], geometry, directLight );\n\t\tdotNL = dot( geometry.normal, directLight.direction );\n\t\tdirectLightColor_Diffuse = PI * directLight.color;\n\t\tvLightFront += saturate( dotNL ) * directLightColor_Diffuse;\n\t\t#ifdef DOUBLE_SIDED\n\t\t\tvLightBack += saturate( -dotNL ) * directLightColor_Diffuse;\n\t\t#endif\n\t}\n#endif\n#if NUM_SPOT_LIGHTS > 0\n\tfor ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {\n\t\tgetSpotDirectLightIrradiance( spotLights[ i ], geometry, directLight );\n\t\tdotNL = dot( geometry.normal, directLight.direction );\n\t\tdirectLightColor_Diffuse = PI * directLight.color;\n\t\tvLightFront += saturate( dotNL ) * directLightColor_Diffuse;\n\t\t#ifdef DOUBLE_SIDED\n\t\t\tvLightBack += saturate( -dotNL ) * directLightColor_Diffuse;\n\t\t#endif\n\t}\n#endif\n#if NUM_DIR_LIGHTS > 0\n\tfor ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {\n\t\tgetDirectionalDirectLightIrradiance( directionalLights[ i ], geometry, directLight );\n\t\tdotNL = dot( geometry.normal, directLight.direction );\n\t\tdirectLightColor_Diffuse = PI * directLight.color;\n\t\tvLightFront += saturate( dotNL ) * directLightColor_Diffuse;\n\t\t#ifdef DOUBLE_SIDED\n\t\t\tvLightBack += saturate( -dotNL ) * directLightColor_Diffuse;\n\t\t#endif\n\t}\n#endif\n#if NUM_HEMI_LIGHTS > 0\n\tfor ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) {\n\t\tvLightFront += getHemisphereLightIrradiance( hemisphereLights[ i ], geometry );\n\t\t#ifdef DOUBLE_SIDED\n\t\t\tvLightBack += getHemisphereLightIrradiance( hemisphereLights[ i ], backGeometry );\n\t\t#endif\n\t}\n#endif\n",lights_pars:"uniform vec3 ambientLightColor;\nvec3 getAmbientLightIrradiance( const in vec3 ambientLightColor ) {\n\tvec3 irradiance = ambientLightColor;\n\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\t\tirradiance *= PI;\n\t#endif\n\treturn irradiance;\n}\n#if NUM_DIR_LIGHTS > 0\n\tstruct DirectionalLight {\n\t\tvec3 direction;\n\t\tvec3 color;\n\t\tint shadow;\n\t\tfloat shadowBias;\n\t\tfloat shadowRadius;\n\t\tvec2 shadowMapSize;\n\t};\n\tuniform DirectionalLight directionalLights[ NUM_DIR_LIGHTS ];\n\tvoid getDirectionalDirectLightIrradiance( const in DirectionalLight directionalLight, const in GeometricContext geometry, out IncidentLight directLight ) {\n\t\tdirectLight.color = directionalLight.color;\n\t\tdirectLight.direction = directionalLight.direction;\n\t\tdirectLight.visible = true;\n\t}\n#endif\n#if NUM_POINT_LIGHTS > 0\n\tstruct PointLight {\n\t\tvec3 position;\n\t\tvec3 color;\n\t\tfloat distance;\n\t\tfloat decay;\n\t\tint shadow;\n\t\tfloat shadowBias;\n\t\tfloat shadowRadius;\n\t\tvec2 shadowMapSize;\n\t};\n\tuniform PointLight pointLights[ NUM_POINT_LIGHTS ];\n\tvoid getPointDirectLightIrradiance( const in PointLight pointLight, const in GeometricContext geometry, out IncidentLight directLight ) {\n\t\tvec3 lVector = pointLight.position - geometry.position;\n\t\tdirectLight.direction = normalize( lVector );\n\t\tfloat lightDistance = length( lVector );\n\t\tdirectLight.color = pointLight.color;\n\t\tdirectLight.color *= punctualLightIntensityToIrradianceFactor( lightDistance, pointLight.distance, pointLight.decay );\n\t\tdirectLight.visible = ( directLight.color != vec3( 0.0 ) );\n\t}\n#endif\n#if NUM_SPOT_LIGHTS > 0\n\tstruct SpotLight {\n\t\tvec3 position;\n\t\tvec3 direction;\n\t\tvec3 color;\n\t\tfloat distance;\n\t\tfloat decay;\n\t\tfloat coneCos;\n\t\tfloat penumbraCos;\n\t\tint shadow;\n\t\tfloat shadowBias;\n\t\tfloat shadowRadius;\n\t\tvec2 shadowMapSize;\n\t};\n\tuniform SpotLight spotLights[ NUM_SPOT_LIGHTS ];\n\tvoid getSpotDirectLightIrradiance( const in SpotLight spotLight, const in GeometricContext geometry, out IncidentLight directLight ) {\n\t\tvec3 lVector = spotLight.position - geometry.position;\n\t\tdirectLight.direction = normalize( lVector );\n\t\tfloat lightDistance = length( lVector );\n\t\tfloat angleCos = dot( directLight.direction, spotLight.direction );\n\t\tif ( angleCos > spotLight.coneCos ) {\n\t\t\tfloat spotEffect = smoothstep( spotLight.coneCos, spotLight.penumbraCos, angleCos );\n\t\t\tdirectLight.color = spotLight.color;\n\t\t\tdirectLight.color *= spotEffect * punctualLightIntensityToIrradianceFactor( lightDistance, spotLight.distance, spotLight.decay );\n\t\t\tdirectLight.visible = true;\n\t\t} else {\n\t\t\tdirectLight.color = vec3( 0.0 );\n\t\t\tdirectLight.visible = false;\n\t\t}\n\t}\n#endif\n#if NUM_RECT_AREA_LIGHTS > 0\n\tstruct RectAreaLight {\n\t\tvec3 color;\n\t\tvec3 position;\n\t\tvec3 halfWidth;\n\t\tvec3 halfHeight;\n\t};\n\tuniform sampler2D ltcMat;\tuniform sampler2D ltcMag;\n\tuniform RectAreaLight rectAreaLights[ NUM_RECT_AREA_LIGHTS ];\n#endif\n#if NUM_HEMI_LIGHTS > 0\n\tstruct HemisphereLight {\n\t\tvec3 direction;\n\t\tvec3 skyColor;\n\t\tvec3 groundColor;\n\t};\n\tuniform HemisphereLight hemisphereLights[ NUM_HEMI_LIGHTS ];\n\tvec3 getHemisphereLightIrradiance( const in HemisphereLight hemiLight, const in GeometricContext geometry ) {\n\t\tfloat dotNL = dot( geometry.normal, hemiLight.direction );\n\t\tfloat hemiDiffuseWeight = 0.5 * dotNL + 0.5;\n\t\tvec3 irradiance = mix( hemiLight.groundColor, hemiLight.skyColor, hemiDiffuseWeight );\n\t\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\t\t\tirradiance *= PI;\n\t\t#endif\n\t\treturn irradiance;\n\t}\n#endif\n#if defined( USE_ENVMAP ) && defined( PHYSICAL )\n\tvec3 getLightProbeIndirectIrradiance( const in GeometricContext geometry, const in int maxMIPLevel ) {\n\t\tvec3 worldNormal = inverseTransformDirection( geometry.normal, viewMatrix );\n\t\t#ifdef ENVMAP_TYPE_CUBE\n\t\t\tvec3 queryVec = vec3( flipEnvMap * worldNormal.x, worldNormal.yz );\n\t\t\t#ifdef TEXTURE_LOD_EXT\n\t\t\t\tvec4 envMapColor = textureCubeLodEXT( envMap, queryVec, float( maxMIPLevel ) );\n\t\t\t#else\n\t\t\t\tvec4 envMapColor = textureCube( envMap, queryVec, float( maxMIPLevel ) );\n\t\t\t#endif\n\t\t\tenvMapColor.rgb = envMapTexelToLinear( envMapColor ).rgb;\n\t\t#elif defined( ENVMAP_TYPE_CUBE_UV )\n\t\t\tvec3 queryVec = vec3( flipEnvMap * worldNormal.x, worldNormal.yz );\n\t\t\tvec4 envMapColor = textureCubeUV( queryVec, 1.0 );\n\t\t#else\n\t\t\tvec4 envMapColor = vec4( 0.0 );\n\t\t#endif\n\t\treturn PI * envMapColor.rgb * envMapIntensity;\n\t}\n\tfloat getSpecularMIPLevel( const in float blinnShininessExponent, const in int maxMIPLevel ) {\n\t\tfloat maxMIPLevelScalar = float( maxMIPLevel );\n\t\tfloat desiredMIPLevel = maxMIPLevelScalar - 0.79248 - 0.5 * log2( pow2( blinnShininessExponent ) + 1.0 );\n\t\treturn clamp( desiredMIPLevel, 0.0, maxMIPLevelScalar );\n\t}\n\tvec3 getLightProbeIndirectRadiance( const in GeometricContext geometry, const in float blinnShininessExponent, const in int maxMIPLevel ) {\n\t\t#ifdef ENVMAP_MODE_REFLECTION\n\t\t\tvec3 reflectVec = reflect( -geometry.viewDir, geometry.normal );\n\t\t#else\n\t\t\tvec3 reflectVec = refract( -geometry.viewDir, geometry.normal, refractionRatio );\n\t\t#endif\n\t\treflectVec = inverseTransformDirection( reflectVec, viewMatrix );\n\t\tfloat specularMIPLevel = getSpecularMIPLevel( blinnShininessExponent, maxMIPLevel );\n\t\t#ifdef ENVMAP_TYPE_CUBE\n\t\t\tvec3 queryReflectVec = vec3( flipEnvMap * reflectVec.x, reflectVec.yz );\n\t\t\t#ifdef TEXTURE_LOD_EXT\n\t\t\t\tvec4 envMapColor = textureCubeLodEXT( envMap, queryReflectVec, specularMIPLevel );\n\t\t\t#else\n\t\t\t\tvec4 envMapColor = textureCube( envMap, queryReflectVec, specularMIPLevel );\n\t\t\t#endif\n\t\t\tenvMapColor.rgb = envMapTexelToLinear( envMapColor ).rgb;\n\t\t#elif defined( ENVMAP_TYPE_CUBE_UV )\n\t\t\tvec3 queryReflectVec = vec3( flipEnvMap * reflectVec.x, reflectVec.yz );\n\t\t\tvec4 envMapColor = textureCubeUV(queryReflectVec, BlinnExponentToGGXRoughness(blinnShininessExponent));\n\t\t#elif defined( ENVMAP_TYPE_EQUIREC )\n\t\t\tvec2 sampleUV;\n\t\t\tsampleUV.y = saturate( reflectVec.y * 0.5 + 0.5 );\n\t\t\tsampleUV.x = atan( reflectVec.z, reflectVec.x ) * RECIPROCAL_PI2 + 0.5;\n\t\t\t#ifdef TEXTURE_LOD_EXT\n\t\t\t\tvec4 envMapColor = texture2DLodEXT( envMap, sampleUV, specularMIPLevel );\n\t\t\t#else\n\t\t\t\tvec4 envMapColor = texture2D( envMap, sampleUV, specularMIPLevel );\n\t\t\t#endif\n\t\t\tenvMapColor.rgb = envMapTexelToLinear( envMapColor ).rgb;\n\t\t#elif defined( ENVMAP_TYPE_SPHERE )\n\t\t\tvec3 reflectView = normalize( ( viewMatrix * vec4( reflectVec, 0.0 ) ).xyz + vec3( 0.0,0.0,1.0 ) );\n\t\t\t#ifdef TEXTURE_LOD_EXT\n\t\t\t\tvec4 envMapColor = texture2DLodEXT( envMap, reflectView.xy * 0.5 + 0.5, specularMIPLevel );\n\t\t\t#else\n\t\t\t\tvec4 envMapColor = texture2D( envMap, reflectView.xy * 0.5 + 0.5, specularMIPLevel );\n\t\t\t#endif\n\t\t\tenvMapColor.rgb = envMapTexelToLinear( envMapColor ).rgb;\n\t\t#endif\n\t\treturn envMapColor.rgb * envMapIntensity;\n\t}\n#endif\n",lights_phong_fragment:"BlinnPhongMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb;\nmaterial.specularColor = specular;\nmaterial.specularShininess = shininess;\nmaterial.specularStrength = specularStrength;\n",lights_phong_pars_fragment:"varying vec3 vViewPosition;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\nstruct BlinnPhongMaterial {\n\tvec3\tdiffuseColor;\n\tvec3\tspecularColor;\n\tfloat\tspecularShininess;\n\tfloat\tspecularStrength;\n};\n#if NUM_RECT_AREA_LIGHTS > 0\n\tvoid RE_Direct_RectArea_BlinnPhong( const in RectAreaLight rectAreaLight, const in GeometricContext geometry, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {\n\t\tvec3 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 = BlinnExponentToGGXRoughness( material.specularShininess );\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\tfloat norm = texture2D( ltcMag, uv ).a;\n\t\tvec4 t = texture2D( ltcMat, uv );\n\t\tmat3 mInv = mat3(\n\t\t\tvec3( 1, 0, t.y ),\n\t\t\tvec3( 0, t.z, 0 ),\n\t\t\tvec3( t.w, 0, t.x )\n\t\t);\n\t\treflectedLight.directSpecular += lightColor * material.specularColor * norm * LTC_Evaluate( normal, viewDir, position, mInv, rectCoords );\n\t\treflectedLight.directDiffuse += lightColor * material.diffuseColor * LTC_Evaluate( normal, viewDir, position, mat3( 1 ), rectCoords );\n\t}\n#endif\nvoid RE_Direct_BlinnPhong( const in IncidentLight directLight, const in GeometricContext geometry, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {\n\t#ifdef TOON\n\t\tvec3 irradiance = getGradientIrradiance( geometry.normal, directLight.direction ) * directLight.color;\n\t#else\n\t\tfloat dotNL = saturate( dot( geometry.normal, directLight.direction ) );\n\t\tvec3 irradiance = dotNL * directLight.color;\n\t#endif\n\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\t\tirradiance *= PI;\n\t#endif\n\treflectedLight.directDiffuse += irradiance * BRDF_Diffuse_Lambert( material.diffuseColor );\n\treflectedLight.directSpecular += irradiance * BRDF_Specular_BlinnPhong( directLight, geometry, material.specularColor, material.specularShininess ) * material.specularStrength;\n}\nvoid RE_IndirectDiffuse_BlinnPhong( const in vec3 irradiance, const in GeometricContext geometry, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {\n\treflectedLight.indirectDiffuse += irradiance * BRDF_Diffuse_Lambert( material.diffuseColor );\n}\n#define RE_Direct\t\t\t\tRE_Direct_BlinnPhong\n#define RE_Direct_RectArea\t\tRE_Direct_RectArea_BlinnPhong\n#define RE_IndirectDiffuse\t\tRE_IndirectDiffuse_BlinnPhong\n#define Material_LightProbeLOD( material )\t(0)\n",lights_physical_fragment:"PhysicalMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb * ( 1.0 - metalnessFactor );\nmaterial.specularRoughness = clamp( roughnessFactor, 0.04, 1.0 );\n#ifdef STANDARD\n\tmaterial.specularColor = mix( vec3( DEFAULT_SPECULAR_COEFFICIENT ), diffuseColor.rgb, metalnessFactor );\n#else\n\tmaterial.specularColor = mix( vec3( MAXIMUM_SPECULAR_COEFFICIENT * pow2( reflectivity ) ), diffuseColor.rgb, metalnessFactor );\n\tmaterial.clearCoat = saturate( clearCoat );\tmaterial.clearCoatRoughness = clamp( clearCoatRoughness, 0.04, 1.0 );\n#endif\n",lights_physical_pars_fragment:"struct PhysicalMaterial {\n\tvec3\tdiffuseColor;\n\tfloat\tspecularRoughness;\n\tvec3\tspecularColor;\n\t#ifndef STANDARD\n\t\tfloat clearCoat;\n\t\tfloat clearCoatRoughness;\n\t#endif\n};\n#define MAXIMUM_SPECULAR_COEFFICIENT 0.16\n#define DEFAULT_SPECULAR_COEFFICIENT 0.04\nfloat clearCoatDHRApprox( const in float roughness, const in float dotNL ) {\n\treturn DEFAULT_SPECULAR_COEFFICIENT + ( 1.0 - DEFAULT_SPECULAR_COEFFICIENT ) * ( pow( 1.0 - dotNL, 5.0 ) * pow( 1.0 - roughness, 2.0 ) );\n}\n#if NUM_RECT_AREA_LIGHTS > 0\n\tvoid RE_Direct_RectArea_Physical( const in RectAreaLight rectAreaLight, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n\t\tvec3 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\tfloat norm = texture2D( ltcMag, uv ).a;\n\t\tvec4 t = texture2D( ltcMat, uv );\n\t\tmat3 mInv = mat3(\n\t\t\tvec3( 1, 0, t.y ),\n\t\t\tvec3( 0, t.z, 0 ),\n\t\t\tvec3( t.w, 0, t.x )\n\t\t);\n\t\treflectedLight.directSpecular += lightColor * material.specularColor * norm * LTC_Evaluate( normal, viewDir, position, mInv, rectCoords );\n\t\treflectedLight.directDiffuse += lightColor * material.diffuseColor * LTC_Evaluate( normal, viewDir, position, mat3( 1 ), 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#ifndef STANDARD\n\t\tfloat clearCoatDHR = material.clearCoat * clearCoatDHRApprox( material.clearCoatRoughness, dotNL );\n\t#else\n\t\tfloat clearCoatDHR = 0.0;\n\t#endif\n\treflectedLight.directSpecular += ( 1.0 - clearCoatDHR ) * irradiance * BRDF_Specular_GGX( directLight, geometry, material.specularColor, material.specularRoughness );\n\treflectedLight.directDiffuse += ( 1.0 - clearCoatDHR ) * irradiance * BRDF_Diffuse_Lambert( material.diffuseColor );\n\t#ifndef STANDARD\n\t\treflectedLight.directSpecular += irradiance * material.clearCoat * BRDF_Specular_GGX( directLight, geometry, vec3( DEFAULT_SPECULAR_COEFFICIENT ), material.clearCoatRoughness );\n\t#endif\n}\nvoid RE_IndirectDiffuse_Physical( const in vec3 irradiance, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n\treflectedLight.indirectDiffuse += irradiance * BRDF_Diffuse_Lambert( material.diffuseColor );\n}\nvoid RE_IndirectSpecular_Physical( const in vec3 radiance, const in vec3 clearCoatRadiance, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n\t#ifndef STANDARD\n\t\tfloat dotNV = saturate( dot( geometry.normal, geometry.viewDir ) );\n\t\tfloat dotNL = dotNV;\n\t\tfloat clearCoatDHR = material.clearCoat * clearCoatDHRApprox( material.clearCoatRoughness, dotNL );\n\t#else\n\t\tfloat clearCoatDHR = 0.0;\n\t#endif\n\treflectedLight.indirectSpecular += ( 1.0 - clearCoatDHR ) * radiance * BRDF_Specular_GGX_Environment( geometry, material.specularColor, material.specularRoughness );\n\t#ifndef STANDARD\n\t\treflectedLight.indirectSpecular += clearCoatRadiance * material.clearCoat * BRDF_Specular_GGX_Environment( geometry, vec3( DEFAULT_SPECULAR_COEFFICIENT ), material.clearCoatRoughness );\n\t#endif\n}\n#define RE_Direct\t\t\t\tRE_Direct_Physical\n#define RE_Direct_RectArea\t\tRE_Direct_RectArea_Physical\n#define RE_IndirectDiffuse\t\tRE_IndirectDiffuse_Physical\n#define RE_IndirectSpecular\t\tRE_IndirectSpecular_Physical\n#define Material_BlinnShininessExponent( material ) GGXRoughnessToBlinnExponent( material.specularRoughness )\n#define Material_ClearCoat_BlinnShininessExponent( material ) GGXRoughnessToBlinnExponent( material.clearCoatRoughness )\nfloat computeSpecularOcclusion( const in float dotNV, const in float ambientOcclusion, const in float roughness ) {\n\treturn saturate( pow( dotNV + ambientOcclusion, exp2( - 16.0 * roughness - 1.0 ) ) - 1.0 + ambientOcclusion );\n}\n",lights_template:"\nGeometricContext geometry;\ngeometry.position = - vViewPosition;\ngeometry.normal = normal;\ngeometry.viewDir = normalize( vViewPosition );\nIncidentLight directLight;\n#if ( NUM_POINT_LIGHTS > 0 ) && defined( RE_Direct )\n\tPointLight pointLight;\n\tfor ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {\n\t\tpointLight = pointLights[ i ];\n\t\tgetPointDirectLightIrradiance( pointLight, geometry, directLight );\n\t\t#ifdef USE_SHADOWMAP\n\t\tdirectLight.color *= all( bvec2( pointLight.shadow, directLight.visible ) ) ? getPointShadow( pointShadowMap[ i ], pointLight.shadowMapSize, pointLight.shadowBias, pointLight.shadowRadius, vPointShadowCoord[ i ] ) : 1.0;\n\t\t#endif\n\t\tRE_Direct( directLight, geometry, material, reflectedLight );\n\t}\n#endif\n#if ( NUM_SPOT_LIGHTS > 0 ) && defined( RE_Direct )\n\tSpotLight spotLight;\n\tfor ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {\n\t\tspotLight = spotLights[ i ];\n\t\tgetSpotDirectLightIrradiance( spotLight, geometry, directLight );\n\t\t#ifdef USE_SHADOWMAP\n\t\tdirectLight.color *= all( bvec2( spotLight.shadow, directLight.visible ) ) ? getShadow( spotShadowMap[ i ], spotLight.shadowMapSize, spotLight.shadowBias, spotLight.shadowRadius, vSpotShadowCoord[ i ] ) : 1.0;\n\t\t#endif\n\t\tRE_Direct( directLight, geometry, material, reflectedLight );\n\t}\n#endif\n#if ( NUM_DIR_LIGHTS > 0 ) && defined( RE_Direct )\n\tDirectionalLight directionalLight;\n\tfor ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {\n\t\tdirectionalLight = directionalLights[ i ];\n\t\tgetDirectionalDirectLightIrradiance( directionalLight, geometry, directLight );\n\t\t#ifdef USE_SHADOWMAP\n\t\tdirectLight.color *= all( bvec2( directionalLight.shadow, directLight.visible ) ) ? getShadow( directionalShadowMap[ i ], directionalLight.shadowMapSize, directionalLight.shadowBias, directionalLight.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;\n\t\t#endif\n\t\tRE_Direct( directLight, geometry, material, reflectedLight );\n\t}\n#endif\n#if ( NUM_RECT_AREA_LIGHTS > 0 ) && defined( RE_Direct_RectArea )\n\tRectAreaLight rectAreaLight;\n\tfor ( int i = 0; i < NUM_RECT_AREA_LIGHTS; i ++ ) {\n\t\trectAreaLight = rectAreaLights[ i ];\n\t\tRE_Direct_RectArea( rectAreaLight, geometry, material, reflectedLight );\n\t}\n#endif\n#if defined( RE_IndirectDiffuse )\n\tvec3 irradiance = getAmbientLightIrradiance( ambientLightColor );\n\t#ifdef USE_LIGHTMAP\n\t\tvec3 lightMapIrradiance = texture2D( lightMap, vUv2 ).xyz * lightMapIntensity;\n\t\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\t\t\tlightMapIrradiance *= PI;\n\t\t#endif\n\t\tirradiance += lightMapIrradiance;\n\t#endif\n\t#if ( NUM_HEMI_LIGHTS > 0 )\n\t\tfor ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) {\n\t\t\tirradiance += getHemisphereLightIrradiance( hemisphereLights[ i ], geometry );\n\t\t}\n\t#endif\n\t#if defined( USE_ENVMAP ) && defined( PHYSICAL ) && defined( ENVMAP_TYPE_CUBE_UV )\n\t\tirradiance += getLightProbeIndirectIrradiance( geometry, 8 );\n\t#endif\n\tRE_IndirectDiffuse( irradiance, geometry, material, reflectedLight );\n#endif\n#if defined( USE_ENVMAP ) && defined( RE_IndirectSpecular )\n\tvec3 radiance = getLightProbeIndirectRadiance( geometry, Material_BlinnShininessExponent( material ), 8 );\n\t#ifndef STANDARD\n\t\tvec3 clearCoatRadiance = getLightProbeIndirectRadiance( geometry, Material_ClearCoat_BlinnShininessExponent( material ), 8 );\n\t#else\n\t\tvec3 clearCoatRadiance = vec3( 0.0 );\n\t#endif\n\tRE_IndirectSpecular( radiance, clearCoatRadiance, geometry, material, reflectedLight );\n#endif\n",logdepthbuf_fragment:"#if defined(USE_LOGDEPTHBUF) && defined(USE_LOGDEPTHBUF_EXT)\n\tgl_FragDepthEXT = log2(vFragDepth) * logDepthBufFC * 0.5;\n#endif",logdepthbuf_pars_fragment:"#ifdef USE_LOGDEPTHBUF\n\tuniform float logDepthBufFC;\n\t#ifdef USE_LOGDEPTHBUF_EXT\n\t\tvarying float vFragDepth;\n\t#endif\n#endif\n",logdepthbuf_pars_vertex:"#ifdef USE_LOGDEPTHBUF\n\t#ifdef USE_LOGDEPTHBUF_EXT\n\t\tvarying float vFragDepth;\n\t#endif\n\tuniform float logDepthBufFC;\n#endif",logdepthbuf_vertex:"#ifdef USE_LOGDEPTHBUF\n\tgl_Position.z = log2(max( EPSILON, gl_Position.w + 1.0 )) * logDepthBufFC;\n\t#ifdef USE_LOGDEPTHBUF_EXT\n\t\tvFragDepth = 1.0 + gl_Position.w;\n\t#else\n\t\tgl_Position.z = (gl_Position.z - 1.0) * gl_Position.w;\n\t#endif\n#endif\n",map_fragment:"#ifdef USE_MAP\n\tvec4 texelColor = texture2D( map, vUv );\n\ttexelColor = mapTexelToLinear( texelColor );\n\tdiffuseColor *= texelColor;\n#endif\n",map_pars_fragment:"#ifdef USE_MAP\n\tuniform sampler2D map;\n#endif\n",map_particle_fragment:"#ifdef USE_MAP\n\tvec4 mapTexel = texture2D( map, vec2( gl_PointCoord.x, 1.0 - gl_PointCoord.y ) * offsetRepeat.zw + offsetRepeat.xy );\n\tdiffuseColor *= mapTexelToLinear( mapTexel );\n#endif\n",map_particle_pars_fragment:"#ifdef USE_MAP\n\tuniform vec4 offsetRepeat;\n\tuniform sampler2D map;\n#endif\n",metalnessmap_fragment:"float metalnessFactor = metalness;\n#ifdef USE_METALNESSMAP\n\tvec4 texelMetalness = texture2D( metalnessMap, vUv );\n\tmetalnessFactor *= texelMetalness.b;\n#endif\n",metalnessmap_pars_fragment:"#ifdef USE_METALNESSMAP\n\tuniform sampler2D metalnessMap;\n#endif",morphnormal_vertex:"#ifdef USE_MORPHNORMALS\n\tobjectNormal += ( morphNormal0 - normal ) * morphTargetInfluences[ 0 ];\n\tobjectNormal += ( morphNormal1 - normal ) * morphTargetInfluences[ 1 ];\n\tobjectNormal += ( morphNormal2 - normal ) * morphTargetInfluences[ 2 ];\n\tobjectNormal += ( morphNormal3 - normal ) * morphTargetInfluences[ 3 ];\n#endif\n",morphtarget_pars_vertex:"#ifdef USE_MORPHTARGETS\n\t#ifndef USE_MORPHNORMALS\n\tuniform float morphTargetInfluences[ 8 ];\n\t#else\n\tuniform float morphTargetInfluences[ 4 ];\n\t#endif\n#endif",morphtarget_vertex:"#ifdef USE_MORPHTARGETS\n\ttransformed += ( morphTarget0 - position ) * morphTargetInfluences[ 0 ];\n\ttransformed += ( morphTarget1 - position ) * morphTargetInfluences[ 1 ];\n\ttransformed += ( morphTarget2 - position ) * morphTargetInfluences[ 2 ];\n\ttransformed += ( morphTarget3 - position ) * morphTargetInfluences[ 3 ];\n\t#ifndef USE_MORPHNORMALS\n\ttransformed += ( morphTarget4 - position ) * morphTargetInfluences[ 4 ];\n\ttransformed += ( morphTarget5 - position ) * morphTargetInfluences[ 5 ];\n\ttransformed += ( morphTarget6 - position ) * morphTargetInfluences[ 6 ];\n\ttransformed += ( morphTarget7 - position ) * morphTargetInfluences[ 7 ];\n\t#endif\n#endif\n",normal_flip:"#ifdef DOUBLE_SIDED\n\tfloat flipNormal = ( float( gl_FrontFacing ) * 2.0 - 1.0 );\n#else\n\tfloat flipNormal = 1.0;\n#endif\n",normal_fragment:"#ifdef FLAT_SHADED\n\tvec3 fdx = vec3( dFdx( vViewPosition.x ), dFdx( vViewPosition.y ), dFdx( vViewPosition.z ) );\n\tvec3 fdy = vec3( dFdy( vViewPosition.x ), dFdy( vViewPosition.y ), dFdy( vViewPosition.z ) );\n\tvec3 normal = normalize( cross( fdx, fdy ) );\n#else\n\tvec3 normal = normalize( vNormal ) * flipNormal;\n#endif\n#ifdef USE_NORMALMAP\n\tnormal = perturbNormal2Arb( -vViewPosition, normal );\n#elif defined( USE_BUMPMAP )\n\tnormal = perturbNormalArb( -vViewPosition, normal, dHdxy_fwd() );\n#endif\n",normalmap_pars_fragment:"#ifdef USE_NORMALMAP\n\tuniform sampler2D normalMap;\n\tuniform vec2 normalScale;\n\tvec3 perturbNormal2Arb( vec3 eye_pos, vec3 surf_norm ) {\n\t\tvec3 q0 = dFdx( eye_pos.xyz );\n\t\tvec3 q1 = dFdy( eye_pos.xyz );\n\t\tvec2 st0 = dFdx( vUv.st );\n\t\tvec2 st1 = dFdy( vUv.st );\n\t\tvec3 S = normalize( q0 * st1.t - q1 * st0.t );\n\t\tvec3 T = normalize( -q0 * st1.s + q1 * st0.s );\n\t\tvec3 N = normalize( surf_norm );\n\t\tvec3 mapN = texture2D( normalMap, vUv ).xyz * 2.0 - 1.0;\n\t\tmapN.xy = normalScale * mapN.xy;\n\t\tmat3 tsn = mat3( S, T, N );\n\t\treturn normalize( tsn * mapN );\n\t}\n#endif\n",packing:"vec3 packNormalToRGB( const in vec3 normal ) {\n\treturn normalize( normal ) * 0.5 + 0.5;\n}\nvec3 unpackRGBToNormal( const in vec3 rgb ) {\n\treturn 1.0 - 2.0 * rgb.xyz;\n}\nconst float PackUpscale = 256. / 255.;const float UnpackDownscale = 255. / 256.;\nconst vec3 PackFactors = vec3( 256. * 256. * 256., 256. * 256., 256. );\nconst vec4 UnpackFactors = UnpackDownscale / vec4( PackFactors, 1. );\nconst float ShiftRight8 = 1. / 256.;\nvec4 packDepthToRGBA( const in float v ) {\n\tvec4 r = vec4( fract( v * PackFactors ), v );\n\tr.yzw -= r.xyz * ShiftRight8;\treturn r * PackUpscale;\n}\nfloat unpackRGBAToDepth( const in vec4 v ) {\n\treturn dot( v, UnpackFactors );\n}\nfloat viewZToOrthographicDepth( const in float viewZ, const in float near, const in float far ) {\n\treturn ( viewZ + near ) / ( near - far );\n}\nfloat orthographicDepthToViewZ( const in float linearClipZ, const in float near, const in float far ) {\n\treturn linearClipZ * ( near - far ) - near;\n}\nfloat viewZToPerspectiveDepth( const in float viewZ, const in float near, const in float far ) {\n\treturn (( near + viewZ ) * far ) / (( far - near ) * viewZ );\n}\nfloat perspectiveDepthToViewZ( const in float invClipZ, const in float near, const in float far ) {\n\treturn ( near * far ) / ( ( far - near ) * invClipZ - far );\n}\n",premultiplied_alpha_fragment:"#ifdef PREMULTIPLIED_ALPHA\n\tgl_FragColor.rgb *= gl_FragColor.a;\n#endif\n",project_vertex:"#ifdef USE_SKINNING\n\tvec4 mvPosition = modelViewMatrix * skinned;\n#else\n\tvec4 mvPosition = modelViewMatrix * vec4( transformed, 1.0 );\n#endif\ngl_Position = projectionMatrix * mvPosition;\n",dithering_fragment:"#if defined( DITHERING )\n gl_FragColor.rgb = dithering( gl_FragColor.rgb );\n#endif\n",dithering_pars_fragment:"#if defined( 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\n",roughnessmap_fragment:"float roughnessFactor = roughness;\n#ifdef USE_ROUGHNESSMAP\n\tvec4 texelRoughness = texture2D( roughnessMap, vUv );\n\troughnessFactor *= texelRoughness.g;\n#endif\n",roughnessmap_pars_fragment:"#ifdef USE_ROUGHNESSMAP\n\tuniform sampler2D roughnessMap;\n#endif",
shadowmap_pars_fragment:"#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHTS > 0\n\t\tuniform sampler2D directionalShadowMap[ NUM_DIR_LIGHTS ];\n\t\tvarying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHTS ];\n\t#endif\n\t#if NUM_SPOT_LIGHTS > 0\n\t\tuniform sampler2D spotShadowMap[ NUM_SPOT_LIGHTS ];\n\t\tvarying vec4 vSpotShadowCoord[ NUM_SPOT_LIGHTS ];\n\t#endif\n\t#if NUM_POINT_LIGHTS > 0\n\t\tuniform sampler2D pointShadowMap[ NUM_POINT_LIGHTS ];\n\t\tvarying vec4 vPointShadowCoord[ NUM_POINT_LIGHTS ];\n\t#endif\n\tfloat texture2DCompare( sampler2D depths, vec2 uv, float compare ) {\n\t\treturn step( compare, unpackRGBAToDepth( texture2D( depths, uv ) ) );\n\t}\n\tfloat texture2DShadowLerp( sampler2D depths, vec2 size, vec2 uv, float compare ) {\n\t\tconst vec2 offset = vec2( 0.0, 1.0 );\n\t\tvec2 texelSize = vec2( 1.0 ) / size;\n\t\tvec2 centroidUV = floor( uv * size + 0.5 ) / size;\n\t\tfloat lb = texture2DCompare( depths, centroidUV + texelSize * offset.xx, compare );\n\t\tfloat lt = texture2DCompare( depths, centroidUV + texelSize * offset.xy, compare );\n\t\tfloat rb = texture2DCompare( depths, centroidUV + texelSize * offset.yx, compare );\n\t\tfloat rt = texture2DCompare( depths, centroidUV + texelSize * offset.yy, compare );\n\t\tvec2 f = fract( uv * size + 0.5 );\n\t\tfloat a = mix( lb, lt, f.y );\n\t\tfloat b = mix( rb, rt, f.y );\n\t\tfloat c = mix( a, b, f.x );\n\t\treturn c;\n\t}\n\tfloat getShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowBias, float shadowRadius, vec4 shadowCoord ) {\n\t\tshadowCoord.xyz /= shadowCoord.w;\n\t\tshadowCoord.z += shadowBias;\n\t\tbvec4 inFrustumVec = bvec4 ( shadowCoord.x >= 0.0, shadowCoord.x <= 1.0, shadowCoord.y >= 0.0, shadowCoord.y <= 1.0 );\n\t\tbool inFrustum = all( inFrustumVec );\n\t\tbvec2 frustumTestVec = bvec2( inFrustum, shadowCoord.z <= 1.0 );\n\t\tbool frustumTest = all( frustumTestVec );\n\t\tif ( frustumTest ) {\n\t\t#if defined( SHADOWMAP_TYPE_PCF )\n\t\t\tvec2 texelSize = vec2( 1.0 ) / shadowMapSize;\n\t\t\tfloat dx0 = - texelSize.x * shadowRadius;\n\t\t\tfloat dy0 = - texelSize.y * shadowRadius;\n\t\t\tfloat dx1 = + texelSize.x * shadowRadius;\n\t\t\tfloat dy1 = + texelSize.y * shadowRadius;\n\t\t\treturn (\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy1 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy1 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy1 ), shadowCoord.z )\n\t\t\t) * ( 1.0 / 9.0 );\n\t\t#elif defined( SHADOWMAP_TYPE_PCF_SOFT )\n\t\t\tvec2 texelSize = vec2( 1.0 ) / shadowMapSize;\n\t\t\tfloat dx0 = - texelSize.x * shadowRadius;\n\t\t\tfloat dy0 = - texelSize.y * shadowRadius;\n\t\t\tfloat dx1 = + texelSize.x * shadowRadius;\n\t\t\tfloat dy1 = + texelSize.y * shadowRadius;\n\t\t\treturn (\n\t\t\t\ttexture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy + vec2( dx0, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy + vec2( 0.0, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy + vec2( dx1, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy + vec2( dx0, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy, shadowCoord.z ) +\n\t\t\t\ttexture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy + vec2( dx1, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy + vec2( dx0, dy1 ), shadowCoord.z ) +\n\t\t\t\ttexture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy + vec2( 0.0, dy1 ), shadowCoord.z ) +\n\t\t\t\ttexture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy + vec2( dx1, dy1 ), shadowCoord.z )\n\t\t\t) * ( 1.0 / 9.0 );\n\t\t#else\n\t\t\treturn texture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z );\n\t\t#endif\n\t\t}\n\t\treturn 1.0;\n\t}\n\tvec2 cubeToUV( vec3 v, float texelSizeY ) {\n\t\tvec3 absV = abs( v );\n\t\tfloat scaleToCube = 1.0 / max( absV.x, max( absV.y, absV.z ) );\n\t\tabsV *= scaleToCube;\n\t\tv *= scaleToCube * ( 1.0 - 2.0 * texelSizeY );\n\t\tvec2 planar = v.xy;\n\t\tfloat almostATexel = 1.5 * texelSizeY;\n\t\tfloat almostOne = 1.0 - almostATexel;\n\t\tif ( absV.z >= almostOne ) {\n\t\t\tif ( v.z > 0.0 )\n\t\t\t\tplanar.x = 4.0 - v.x;\n\t\t} else if ( absV.x >= almostOne ) {\n\t\t\tfloat signX = sign( v.x );\n\t\t\tplanar.x = v.z * signX + 2.0 * signX;\n\t\t} else if ( absV.y >= almostOne ) {\n\t\t\tfloat signY = sign( v.y );\n\t\t\tplanar.x = v.x + 2.0 * signY + 2.0;\n\t\t\tplanar.y = v.z * signY - 2.0;\n\t\t}\n\t\treturn vec2( 0.125, 0.25 ) * planar + vec2( 0.375, 0.75 );\n\t}\n\tfloat getPointShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowBias, float shadowRadius, vec4 shadowCoord ) {\n\t\tvec2 texelSize = vec2( 1.0 ) / ( shadowMapSize * vec2( 4.0, 2.0 ) );\n\t\tvec3 lightToPosition = shadowCoord.xyz;\n\t\tvec3 bd3D = normalize( lightToPosition );\n\t\tfloat dp = ( length( lightToPosition ) - shadowBias ) / 1000.0;\n\t\t#if defined( SHADOWMAP_TYPE_PCF ) || defined( SHADOWMAP_TYPE_PCF_SOFT )\n\t\t\tvec2 offset = vec2( - 1, 1 ) * shadowRadius * texelSize.y;\n\t\t\treturn (\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyy, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyy, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyx, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyx, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxy, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxy, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxx, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxx, texelSize.y ), dp )\n\t\t\t) * ( 1.0 / 9.0 );\n\t\t#else\n\t\t\treturn texture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp );\n\t\t#endif\n\t}\n#endif\n",shadowmap_pars_vertex:"#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHTS > 0\n\t\tuniform mat4 directionalShadowMatrix[ NUM_DIR_LIGHTS ];\n\t\tvarying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHTS ];\n\t#endif\n\t#if NUM_SPOT_LIGHTS > 0\n\t\tuniform mat4 spotShadowMatrix[ NUM_SPOT_LIGHTS ];\n\t\tvarying vec4 vSpotShadowCoord[ NUM_SPOT_LIGHTS ];\n\t#endif\n\t#if NUM_POINT_LIGHTS > 0\n\t\tuniform mat4 pointShadowMatrix[ NUM_POINT_LIGHTS ];\n\t\tvarying vec4 vPointShadowCoord[ NUM_POINT_LIGHTS ];\n\t#endif\n#endif\n",shadowmap_vertex:"#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHTS > 0\n\tfor ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {\n\t\tvDirectionalShadowCoord[ i ] = directionalShadowMatrix[ i ] * worldPosition;\n\t}\n\t#endif\n\t#if NUM_SPOT_LIGHTS > 0\n\tfor ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {\n\t\tvSpotShadowCoord[ i ] = spotShadowMatrix[ i ] * worldPosition;\n\t}\n\t#endif\n\t#if NUM_POINT_LIGHTS > 0\n\tfor ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {\n\t\tvPointShadowCoord[ i ] = pointShadowMatrix[ i ] * worldPosition;\n\t}\n\t#endif\n#endif\n",shadowmask_pars_fragment:"float getShadowMask() {\n\tfloat shadow = 1.0;\n\t#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHTS > 0\n\tDirectionalLight directionalLight;\n\tfor ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {\n\t\tdirectionalLight = directionalLights[ i ];\n\t\tshadow *= bool( directionalLight.shadow ) ? getShadow( directionalShadowMap[ i ], directionalLight.shadowMapSize, directionalLight.shadowBias, directionalLight.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;\n\t}\n\t#endif\n\t#if NUM_SPOT_LIGHTS > 0\n\tSpotLight spotLight;\n\tfor ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {\n\t\tspotLight = spotLights[ i ];\n\t\tshadow *= bool( spotLight.shadow ) ? getShadow( spotShadowMap[ i ], spotLight.shadowMapSize, spotLight.shadowBias, spotLight.shadowRadius, vSpotShadowCoord[ i ] ) : 1.0;\n\t}\n\t#endif\n\t#if NUM_POINT_LIGHTS > 0\n\tPointLight pointLight;\n\tfor ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {\n\t\tpointLight = pointLights[ i ];\n\t\tshadow *= bool( pointLight.shadow ) ? getPointShadow( pointShadowMap[ i ], pointLight.shadowMapSize, pointLight.shadowBias, pointLight.shadowRadius, vPointShadowCoord[ i ] ) : 1.0;\n\t}\n\t#endif\n\t#endif\n\treturn shadow;\n}\n",skinbase_vertex:"#ifdef USE_SKINNING\n\tmat4 boneMatX = getBoneMatrix( skinIndex.x );\n\tmat4 boneMatY = getBoneMatrix( skinIndex.y );\n\tmat4 boneMatZ = getBoneMatrix( skinIndex.z );\n\tmat4 boneMatW = getBoneMatrix( skinIndex.w );\n#endif",skinning_pars_vertex:"#ifdef USE_SKINNING\n\tuniform mat4 bindMatrix;\n\tuniform mat4 bindMatrixInverse;\n\t#ifdef BONE_TEXTURE\n\t\tuniform sampler2D boneTexture;\n\t\tuniform int 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\n",skinning_vertex:"#ifdef USE_SKINNING\n\tvec4 skinVertex = bindMatrix * vec4( transformed, 1.0 );\n\tvec4 skinned = vec4( 0.0 );\n\tskinned += boneMatX * skinVertex * skinWeight.x;\n\tskinned += boneMatY * skinVertex * skinWeight.y;\n\tskinned += boneMatZ * skinVertex * skinWeight.z;\n\tskinned += boneMatW * skinVertex * skinWeight.w;\n\tskinned = bindMatrixInverse * skinned;\n#endif\n",skinnormal_vertex:"#ifdef USE_SKINNING\n\tmat4 skinMatrix = mat4( 0.0 );\n\tskinMatrix += skinWeight.x * boneMatX;\n\tskinMatrix += skinWeight.y * boneMatY;\n\tskinMatrix += skinWeight.z * boneMatZ;\n\tskinMatrix += skinWeight.w * boneMatW;\n\tskinMatrix = bindMatrixInverse * skinMatrix * bindMatrix;\n\tobjectNormal = vec4( skinMatrix * vec4( objectNormal, 0.0 ) ).xyz;\n#endif\n",specularmap_fragment:"float specularStrength;\n#ifdef USE_SPECULARMAP\n\tvec4 texelSpecular = texture2D( specularMap, vUv );\n\tspecularStrength = texelSpecular.r;\n#else\n\tspecularStrength = 1.0;\n#endif",specularmap_pars_fragment:"#ifdef USE_SPECULARMAP\n\tuniform sampler2D specularMap;\n#endif",tonemapping_fragment:"#if defined( TONE_MAPPING )\n gl_FragColor.rgb = toneMapping( gl_FragColor.rgb );\n#endif\n",tonemapping_pars_fragment:"#define saturate(a) clamp( a, 0.0, 1.0 )\nuniform float toneMappingExposure;\nuniform float toneMappingWhitePoint;\nvec3 LinearToneMapping( vec3 color ) {\n\treturn toneMappingExposure * color;\n}\nvec3 ReinhardToneMapping( vec3 color ) {\n\tcolor *= toneMappingExposure;\n\treturn saturate( color / ( vec3( 1.0 ) + color ) );\n}\n#define Uncharted2Helper( x ) max( ( ( x * ( 0.15 * x + 0.10 * 0.50 ) + 0.20 * 0.02 ) / ( x * ( 0.15 * x + 0.50 ) + 0.20 * 0.30 ) ) - 0.02 / 0.30, vec3( 0.0 ) )\nvec3 Uncharted2ToneMapping( vec3 color ) {\n\tcolor *= toneMappingExposure;\n\treturn saturate( Uncharted2Helper( color ) / Uncharted2Helper( vec3( toneMappingWhitePoint ) ) );\n}\nvec3 OptimizedCineonToneMapping( vec3 color ) {\n\tcolor *= toneMappingExposure;\n\tcolor = max( vec3( 0.0 ), color - 0.004 );\n\treturn pow( ( color * ( 6.2 * color + 0.5 ) ) / ( color * ( 6.2 * color + 1.7 ) + 0.06 ), vec3( 2.2 ) );\n}\n",uv_pars_fragment:"#if defined( USE_MAP ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( USE_SPECULARMAP ) || defined( USE_ALPHAMAP ) || defined( USE_EMISSIVEMAP ) || defined( USE_ROUGHNESSMAP ) || defined( USE_METALNESSMAP )\n\tvarying vec2 vUv;\n#endif",uv_pars_vertex:"#if defined( USE_MAP ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( USE_SPECULARMAP ) || defined( USE_ALPHAMAP ) || defined( USE_EMISSIVEMAP ) || defined( USE_ROUGHNESSMAP ) || defined( USE_METALNESSMAP )\n\tvarying vec2 vUv;\n\tuniform vec4 offsetRepeat;\n#endif\n",uv_vertex:"#if defined( USE_MAP ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( USE_SPECULARMAP ) || defined( USE_ALPHAMAP ) || defined( USE_EMISSIVEMAP ) || defined( USE_ROUGHNESSMAP ) || defined( USE_METALNESSMAP )\n\tvUv = uv * offsetRepeat.zw + offsetRepeat.xy;\n#endif",uv2_pars_fragment:"#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP )\n\tvarying vec2 vUv2;\n#endif",uv2_pars_vertex:"#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP )\n\tattribute vec2 uv2;\n\tvarying vec2 vUv2;\n#endif",uv2_vertex:"#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP )\n\tvUv2 = uv2;\n#endif",worldpos_vertex:"#if defined( USE_ENVMAP ) || defined( PHONG ) || defined( PHYSICAL ) || defined( LAMBERT ) || defined ( USE_SHADOWMAP )\n\t#ifdef USE_SKINNING\n\t\tvec4 worldPosition = modelMatrix * skinned;\n\t#else\n\t\tvec4 worldPosition = modelMatrix * vec4( transformed, 1.0 );\n\t#endif\n#endif\n",cube_frag:"uniform samplerCube tCube;\nuniform float tFlip;\nuniform float opacity;\nvarying vec3 vWorldPosition;\n#include <common>\nvoid main() {\n\tgl_FragColor = textureCube( tCube, vec3( tFlip * vWorldPosition.x, vWorldPosition.yz ) );\n\tgl_FragColor.a *= opacity;\n}\n",cube_vert:"varying vec3 vWorldPosition;\n#include <common>\nvoid main() {\n\tvWorldPosition = transformDirection( position, modelMatrix );\n\t#include <begin_vertex>\n\t#include <project_vertex>\n}\n",depth_frag:"#if DEPTH_PACKING == 3200\n\tuniform float opacity;\n#endif\n#include <common>\n#include <packing>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tvec4 diffuseColor = vec4( 1.0 );\n\t#if DEPTH_PACKING == 3200\n\t\tdiffuseColor.a = opacity;\n\t#endif\n\t#include <map_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <logdepthbuf_fragment>\n\t#if DEPTH_PACKING == 3200\n\t\tgl_FragColor = vec4( vec3( gl_FragCoord.z ), opacity );\n\t#elif DEPTH_PACKING == 3201\n\t\tgl_FragColor = packDepthToRGBA( gl_FragCoord.z );\n\t#endif\n}\n",depth_vert:"#include <common>\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <skinbase_vertex>\n\t#include <begin_vertex>\n\t#include <displacementmap_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n}\n",distanceRGBA_frag:"uniform vec3 lightPos;\nvarying vec4 vWorldPosition;\n#include <common>\n#include <packing>\n#include <clipping_planes_pars_fragment>\nvoid main () {\n\t#include <clipping_planes_fragment>\n\tgl_FragColor = packDepthToRGBA( length( vWorldPosition.xyz - lightPos.xyz ) / 1000.0 );\n}\n",distanceRGBA_vert:"varying vec4 vWorldPosition;\n#include <common>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <skinbase_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <project_vertex>\n\t#include <worldpos_vertex>\n\t#include <clipping_planes_vertex>\n\tvWorldPosition = worldPosition;\n}\n",equirect_frag:"uniform sampler2D tEquirect;\nuniform float tFlip;\nvarying vec3 vWorldPosition;\n#include <common>\nvoid main() {\n\tvec3 direction = normalize( vWorldPosition );\n\tvec2 sampleUV;\n\tsampleUV.y = saturate( tFlip * direction.y * -0.5 + 0.5 );\n\tsampleUV.x = atan( direction.z, direction.x ) * RECIPROCAL_PI2 + 0.5;\n\tgl_FragColor = texture2D( tEquirect, sampleUV );\n}\n",equirect_vert:"varying vec3 vWorldPosition;\n#include <common>\nvoid main() {\n\tvWorldPosition = transformDirection( position, modelMatrix );\n\t#include <begin_vertex>\n\t#include <project_vertex>\n}\n",linedashed_frag:"uniform vec3 diffuse;\nuniform float opacity;\nuniform float dashSize;\nuniform float totalSize;\nvarying float vLineDistance;\n#include <common>\n#include <color_pars_fragment>\n#include <fog_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tif ( mod( vLineDistance, totalSize ) > dashSize ) {\n\t\tdiscard;\n\t}\n\tvec3 outgoingLight = vec3( 0.0 );\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <logdepthbuf_fragment>\n\t#include <color_fragment>\n\toutgoingLight = diffuseColor.rgb;\n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include <premultiplied_alpha_fragment>\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n}\n",linedashed_vert:"uniform float scale;\nattribute float lineDistance;\nvarying float vLineDistance;\n#include <common>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <color_vertex>\n\tvLineDistance = scale * lineDistance;\n\tvec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );\n\tgl_Position = projectionMatrix * mvPosition;\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\t#include <fog_vertex>\n}\n",meshbasic_frag:"uniform vec3 diffuse;\nuniform float opacity;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\n#include <common>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <uv2_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <envmap_pars_fragment>\n#include <fog_pars_fragment>\n#include <specularmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <specularmap_fragment>\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\t#ifdef USE_LIGHTMAP\n\t\treflectedLight.indirectDiffuse += texture2D( lightMap, vUv2 ).xyz * lightMapIntensity;\n\t#else\n\t\treflectedLight.indirectDiffuse += vec3( 1.0 );\n\t#endif\n\t#include <aomap_fragment>\n\treflectedLight.indirectDiffuse *= diffuseColor.rgb;\n\tvec3 outgoingLight = reflectedLight.indirectDiffuse;\n\t#include <normal_flip>\n\t#include <envmap_fragment>\n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include <premultiplied_alpha_fragment>\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n}\n",meshbasic_vert:"#include <common>\n#include <uv_pars_vertex>\n#include <uv2_pars_vertex>\n#include <envmap_pars_vertex>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <uv2_vertex>\n\t#include <color_vertex>\n\t#include <skinbase_vertex>\n\t#ifdef USE_ENVMAP\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n\t#endif\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <worldpos_vertex>\n\t#include <clipping_planes_vertex>\n\t#include <envmap_vertex>\n\t#include <fog_vertex>\n}\n",meshlambert_frag:"uniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float opacity;\nvarying vec3 vLightFront;\n#ifdef DOUBLE_SIDED\n\tvarying vec3 vLightBack;\n#endif\n#include <common>\n#include <packing>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <uv2_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <emissivemap_pars_fragment>\n#include <envmap_pars_fragment>\n#include <bsdfs>\n#include <lights_pars>\n#include <fog_pars_fragment>\n#include <shadowmap_pars_fragment>\n#include <shadowmask_pars_fragment>\n#include <specularmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <specularmap_fragment>\n\t#include <emissivemap_fragment>\n\treflectedLight.indirectDiffuse = getAmbientLightIrradiance( ambientLightColor );\n\t#include <lightmap_fragment>\n\treflectedLight.indirectDiffuse *= BRDF_Diffuse_Lambert( diffuseColor.rgb );\n\t#ifdef DOUBLE_SIDED\n\t\treflectedLight.directDiffuse = ( gl_FrontFacing ) ? vLightFront : vLightBack;\n\t#else\n\t\treflectedLight.directDiffuse = vLightFront;\n\t#endif\n\treflectedLight.directDiffuse *= BRDF_Diffuse_Lambert( diffuseColor.rgb ) * getShadowMask();\n\t#include <aomap_fragment>\n\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;\n\t#include <normal_flip>\n\t#include <envmap_fragment>\n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n\t#include <dithering_fragment>\n}\n",meshlambert_vert:"#define LAMBERT\nvarying vec3 vLightFront;\n#ifdef DOUBLE_SIDED\n\tvarying vec3 vLightBack;\n#endif\n#include <common>\n#include <uv_pars_vertex>\n#include <uv2_pars_vertex>\n#include <envmap_pars_vertex>\n#include <bsdfs>\n#include <lights_pars>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <shadowmap_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <uv2_vertex>\n\t#include <color_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\t#include <worldpos_vertex>\n\t#include <envmap_vertex>\n\t#include <lights_lambert_vertex>\n\t#include <shadowmap_vertex>\n\t#include <fog_vertex>\n}\n",meshphong_frag:"#define PHONG\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform vec3 specular;\nuniform float shininess;\nuniform float opacity;\n#include <common>\n#include <packing>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <uv2_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <emissivemap_pars_fragment>\n#include <envmap_pars_fragment>\n#include <gradientmap_pars_fragment>\n#include <fog_pars_fragment>\n#include <bsdfs>\n#include <lights_pars>\n#include <lights_phong_pars_fragment>\n#include <shadowmap_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <specularmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <specularmap_fragment>\n\t#include <normal_flip>\n\t#include <normal_fragment>\n\t#include <emissivemap_fragment>\n\t#include <lights_phong_fragment>\n\t#include <lights_template>\n\t#include <aomap_fragment>\n\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveRadiance;\n\t#include <envmap_fragment>\n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n\t#include <dithering_fragment>\n}\n",meshphong_vert:"#define PHONG\nvarying vec3 vViewPosition;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\n#include <common>\n#include <uv_pars_vertex>\n#include <uv2_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <envmap_pars_vertex>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <shadowmap_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <uv2_vertex>\n\t#include <color_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n#ifndef FLAT_SHADED\n\tvNormal = normalize( transformedNormal );\n#endif\n\t#include <begin_vertex>\n\t#include <displacementmap_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\tvViewPosition = - mvPosition.xyz;\n\t#include <worldpos_vertex>\n\t#include <envmap_vertex>\n\t#include <shadowmap_vertex>\n\t#include <fog_vertex>\n}\n",meshphysical_frag:"#define PHYSICAL\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float roughness;\nuniform float metalness;\nuniform float opacity;\n#ifndef STANDARD\n\tuniform float clearCoat;\n\tuniform float clearCoatRoughness;\n#endif\nvarying vec3 vViewPosition;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\n#include <common>\n#include <packing>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <uv2_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <emissivemap_pars_fragment>\n#include <envmap_pars_fragment>\n#include <fog_pars_fragment>\n#include <bsdfs>\n#include <cube_uv_reflection_fragment>\n#include <lights_pars>\n#include <lights_physical_pars_fragment>\n#include <shadowmap_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <roughnessmap_pars_fragment>\n#include <metalnessmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <specularmap_fragment>\n\t#include <roughnessmap_fragment>\n\t#include <metalnessmap_fragment>\n\t#include <normal_flip>\n\t#include <normal_fragment>\n\t#include <emissivemap_fragment>\n\t#include <lights_physical_fragment>\n\t#include <lights_template>\n\t#include <aomap_fragment>\n\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveRadiance;\n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n\t#include <dithering_fragment>\n}\n",meshphysical_vert:"#define PHYSICAL\nvarying vec3 vViewPosition;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\n#include <common>\n#include <uv_pars_vertex>\n#include <uv2_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <shadowmap_pars_vertex>\n#include <specularmap_pars_fragment>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <uv2_vertex>\n\t#include <color_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n#ifndef FLAT_SHADED\n\tvNormal = normalize( transformedNormal );\n#endif\n\t#include <begin_vertex>\n\t#include <displacementmap_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\tvViewPosition = - mvPosition.xyz;\n\t#include <worldpos_vertex>\n\t#include <shadowmap_vertex>\n\t#include <fog_vertex>\n}\n",normal_frag:"#define NORMAL\nuniform float opacity;\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP )\n\tvarying vec3 vViewPosition;\n#endif\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\n#include <packing>\n#include <uv_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\nvoid main() {\n\t#include <logdepthbuf_fragment>\n\t#include <normal_flip>\n\t#include <normal_fragment>\n\tgl_FragColor = vec4( packNormalToRGB( normal ), opacity );\n}\n",
normal_vert:"#define NORMAL\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP )\n\tvarying vec3 vViewPosition;\n#endif\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <logdepthbuf_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n#ifndef FLAT_SHADED\n\tvNormal = normalize( transformedNormal );\n#endif\n\t#include <begin_vertex>\n\t#include <displacementmap_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP )\n\tvViewPosition = - mvPosition.xyz;\n#endif\n}\n",points_frag:"uniform vec3 diffuse;\nuniform float opacity;\n#include <common>\n#include <packing>\n#include <color_pars_fragment>\n#include <map_particle_pars_fragment>\n#include <fog_pars_fragment>\n#include <shadowmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tvec3 outgoingLight = vec3( 0.0 );\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <logdepthbuf_fragment>\n\t#include <map_particle_fragment>\n\t#include <color_fragment>\n\t#include <alphatest_fragment>\n\toutgoingLight = diffuseColor.rgb;\n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include <premultiplied_alpha_fragment>\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n}\n",points_vert:"uniform float size;\nuniform float scale;\n#include <common>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <shadowmap_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <color_vertex>\n\t#include <begin_vertex>\n\t#include <project_vertex>\n\t#ifdef USE_SIZEATTENUATION\n\t\tgl_PointSize = size * ( scale / - mvPosition.z );\n\t#else\n\t\tgl_PointSize = size;\n\t#endif\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\t#include <worldpos_vertex>\n\t#include <shadowmap_vertex>\n\t#include <fog_vertex>\n}\n",shadow_frag:"uniform float opacity;\n#include <common>\n#include <packing>\n#include <bsdfs>\n#include <lights_pars>\n#include <shadowmap_pars_fragment>\n#include <shadowmask_pars_fragment>\nvoid main() {\n\tgl_FragColor = vec4( 0.0, 0.0, 0.0, opacity * ( 1.0 - getShadowMask() ) );\n}\n",shadow_vert:"#include <shadowmap_pars_vertex>\nvoid main() {\n\t#include <begin_vertex>\n\t#include <project_vertex>\n\t#include <worldpos_vertex>\n\t#include <shadowmap_vertex>\n}\n"},ws={basic:{uniforms:bs.merge([xs.common,xs.aomap,xs.lightmap,xs.fog]),vertexShader:_s.meshbasic_vert,fragmentShader:_s.meshbasic_frag},lambert:{uniforms:bs.merge([xs.common,xs.aomap,xs.lightmap,xs.emissivemap,xs.fog,xs.lights,{emissive:{value:new X(0)}}]),vertexShader:_s.meshlambert_vert,fragmentShader:_s.meshlambert_frag},phong:{uniforms:bs.merge([xs.common,xs.aomap,xs.lightmap,xs.emissivemap,xs.bumpmap,xs.normalmap,xs.displacementmap,xs.gradientmap,xs.fog,xs.lights,{emissive:{value:new X(0)},specular:{value:new X(1118481)},shininess:{value:30}}]),vertexShader:_s.meshphong_vert,fragmentShader:_s.meshphong_frag},standard:{uniforms:bs.merge([xs.common,xs.aomap,xs.lightmap,xs.emissivemap,xs.bumpmap,xs.normalmap,xs.displacementmap,xs.roughnessmap,xs.metalnessmap,xs.fog,xs.lights,{emissive:{value:new X(0)},roughness:{value:.5},metalness:{value:.5},envMapIntensity:{value:1}}]),vertexShader:_s.meshphysical_vert,fragmentShader:_s.meshphysical_frag},points:{uniforms:bs.merge([xs.points,xs.fog]),vertexShader:_s.points_vert,fragmentShader:_s.points_frag},dashed:{uniforms:bs.merge([xs.common,xs.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:_s.linedashed_vert,fragmentShader:_s.linedashed_frag},depth:{uniforms:bs.merge([xs.common,xs.displacementmap]),vertexShader:_s.depth_vert,fragmentShader:_s.depth_frag},normal:{uniforms:bs.merge([xs.common,xs.bumpmap,xs.normalmap,xs.displacementmap,{opacity:{value:1}}]),vertexShader:_s.normal_vert,fragmentShader:_s.normal_frag},cube:{uniforms:{tCube:{value:null},tFlip:{value:-1},opacity:{value:1}},vertexShader:_s.cube_vert,fragmentShader:_s.cube_frag},equirect:{uniforms:{tEquirect:{value:null},tFlip:{value:-1}},vertexShader:_s.equirect_vert,fragmentShader:_s.equirect_frag},distanceRGBA:{uniforms:{lightPos:{value:new c}},vertexShader:_s.distanceRGBA_vert,fragmentShader:_s.distanceRGBA_frag}};ws.physical={uniforms:bs.merge([ws.standard.uniforms,{clearCoat:{value:0},clearCoatRoughness:{value:0}}]),vertexShader:_s.meshphysical_vert,fragmentShader:_s.meshphysical_frag},Object.assign(q.prototype,{set:function(t,e){return this.min.copy(t),this.max.copy(e),this},setFromPoints:function(t){this.makeEmpty();for(var e=0,i=t.length;e<i;e++)this.expandByPoint(t[e]);return this},setFromCenterAndSize:function(){var t=new i;return function(e,i){var n=t.copy(i).multiplyScalar(.5);return this.min.copy(e).sub(n),this.max.copy(e).add(n),this}}(),clone:function(){return(new this.constructor).copy(this)},copy:function(t){return this.min.copy(t.min),this.max.copy(t.max),this},makeEmpty:function(){return this.min.x=this.min.y=1/0,this.max.x=this.max.y=-1/0,this},isEmpty:function(){return this.max.x<this.min.x||this.max.y<this.min.y},getCenter:function(t){var e=t||new i;return this.isEmpty()?e.set(0,0):e.addVectors(this.min,this.max).multiplyScalar(.5)},getSize:function(t){var e=t||new i;return this.isEmpty()?e.set(0,0):e.subVectors(this.max,this.min)},expandByPoint:function(t){return this.min.min(t),this.max.max(t),this},expandByVector:function(t){return this.min.sub(t),this.max.add(t),this},expandByScalar:function(t){return this.min.addScalar(-t),this.max.addScalar(t),this},containsPoint:function(t){return!(t.x<this.min.x||t.x>this.max.x||t.y<this.min.y||t.y>this.max.y)},containsBox:function(t){return this.min.x<=t.min.x&&t.max.x<=this.max.x&&this.min.y<=t.min.y&&t.max.y<=this.max.y},getParameter:function(t,e){return(e||new i).set((t.x-this.min.x)/(this.max.x-this.min.x),(t.y-this.min.y)/(this.max.y-this.min.y))},intersectsBox:function(t){return!(t.max.x<this.min.x||t.min.x>this.max.x||t.max.y<this.min.y||t.min.y>this.max.y)},clampPoint:function(t,e){return(e||new i).copy(t).clamp(this.min,this.max)},distanceToPoint:function(){var t=new i;return function(e){return t.copy(e).clamp(this.min,this.max).sub(e).length()}}(),intersect:function(t){return this.min.max(t.min),this.max.min(t.max),this},union:function(t){return this.min.min(t.min),this.max.max(t.max),this},translate:function(t){return this.min.add(t),this.max.add(t),this},equals:function(t){return t.min.equals(this.min)&&t.max.equals(this.max)}});var Ms=0;Object.assign(J.prototype,e.prototype,{isMaterial:!0,setValues:function(t){if(void 0!==t)for(var e in t){var i=t[e];if(void 0!==i){var n=this[e];void 0!==n?n&&n.isColor?n.set(i):n&&n.isVector3&&i&&i.isVector3?n.copy(i):this[e]="overdraw"===e?Number(i):i:console.warn("THREE."+this.type+": '"+e+"' is not a property of this material.")}else console.warn("THREE.Material: '"+e+"' parameter is undefined.")}},toJSON:function(t){function e(t){var e=[];for(var i in t){var n=t[i];delete n.metadata,e.push(n)}return e}var i=void 0===t;i&&(t={textures:{},images:{}});var n={metadata:{version:4.5,type:"Material",generator:"Material.toJSON"}};if(n.uuid=this.uuid,n.type=this.type,""!==this.name&&(n.name=this.name),this.color&&this.color.isColor&&(n.color=this.color.getHex()),void 0!==this.roughness&&(n.roughness=this.roughness),void 0!==this.metalness&&(n.metalness=this.metalness),this.emissive&&this.emissive.isColor&&(n.emissive=this.emissive.getHex()),this.specular&&this.specular.isColor&&(n.specular=this.specular.getHex()),void 0!==this.shininess&&(n.shininess=this.shininess),void 0!==this.clearCoat&&(n.clearCoat=this.clearCoat),void 0!==this.clearCoatRoughness&&(n.clearCoatRoughness=this.clearCoatRoughness),this.map&&this.map.isTexture&&(n.map=this.map.toJSON(t).uuid),this.alphaMap&&this.alphaMap.isTexture&&(n.alphaMap=this.alphaMap.toJSON(t).uuid),this.lightMap&&this.lightMap.isTexture&&(n.lightMap=this.lightMap.toJSON(t).uuid),this.bumpMap&&this.bumpMap.isTexture&&(n.bumpMap=this.bumpMap.toJSON(t).uuid,n.bumpScale=this.bumpScale),this.normalMap&&this.normalMap.isTexture&&(n.normalMap=this.normalMap.toJSON(t).uuid,n.normalScale=this.normalScale.toArray()),this.displacementMap&&this.displacementMap.isTexture&&(n.displacementMap=this.displacementMap.toJSON(t).uuid,n.displacementScale=this.displacementScale,n.displacementBias=this.displacementBias),this.roughnessMap&&this.roughnessMap.isTexture&&(n.roughnessMap=this.roughnessMap.toJSON(t).uuid),this.metalnessMap&&this.metalnessMap.isTexture&&(n.metalnessMap=this.metalnessMap.toJSON(t).uuid),this.emissiveMap&&this.emissiveMap.isTexture&&(n.emissiveMap=this.emissiveMap.toJSON(t).uuid),this.specularMap&&this.specularMap.isTexture&&(n.specularMap=this.specularMap.toJSON(t).uuid),this.envMap&&this.envMap.isTexture&&(n.envMap=this.envMap.toJSON(t).uuid,n.reflectivity=this.reflectivity),this.gradientMap&&this.gradientMap.isTexture&&(n.gradientMap=this.gradientMap.toJSON(t).uuid),void 0!==this.size&&(n.size=this.size),void 0!==this.sizeAttenuation&&(n.sizeAttenuation=this.sizeAttenuation),this.blending!==ba&&(n.blending=this.blending),this.shading!==ma&&(n.shading=this.shading),this.side!==ua&&(n.side=this.side),this.vertexColors!==va&&(n.vertexColors=this.vertexColors),this.opacity<1&&(n.opacity=this.opacity),!0===this.transparent&&(n.transparent=this.transparent),n.depthFunc=this.depthFunc,n.depthTest=this.depthTest,n.depthWrite=this.depthWrite,this.alphaTest>0&&(n.alphaTest=this.alphaTest),!0===this.premultipliedAlpha&&(n.premultipliedAlpha=this.premultipliedAlpha),!0===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),n.skinning=this.skinning,n.morphTargets=this.morphTargets,n.dithering=this.dithering,i){var r=e(t.textures),a=e(t.images);r.length>0&&(n.textures=r),a.length>0&&(n.images=a)}return n},clone:function(){return(new this.constructor).copy(this)},copy:function(t){this.name=t.name,this.fog=t.fog,this.lights=t.lights,this.blending=t.blending,this.side=t.side,this.shading=t.shading,this.vertexColors=t.vertexColors,this.opacity=t.opacity,this.transparent=t.transparent,this.blendSrc=t.blendSrc,this.blendDst=t.blendDst,this.blendEquation=t.blendEquation,this.blendSrcAlpha=t.blendSrcAlpha,this.blendDstAlpha=t.blendDstAlpha,this.blendEquationAlpha=t.blendEquationAlpha,this.depthFunc=t.depthFunc,this.depthTest=t.depthTest,this.depthWrite=t.depthWrite,this.colorWrite=t.colorWrite,this.precision=t.precision,this.polygonOffset=t.polygonOffset,this.polygonOffsetFactor=t.polygonOffsetFactor,this.polygonOffsetUnits=t.polygonOffsetUnits,this.dithering=t.dithering,this.alphaTest=t.alphaTest,this.premultipliedAlpha=t.premultipliedAlpha,this.overdraw=t.overdraw,this.visible=t.visible,this.clipShadows=t.clipShadows,this.clipIntersection=t.clipIntersection;var e=t.clippingPlanes,i=null;if(null!==e){var n=e.length;i=new Array(n);for(var r=0;r!==n;++r)i[r]=e[r].clone()}return this.clippingPlanes=i,this},dispose:function(){this.dispatchEvent({type:"dispose"})}}),Q.prototype=Object.create(J.prototype),Q.prototype.constructor=Q,Q.prototype.isShaderMaterial=!0,Q.prototype.copy=function(t){return J.prototype.copy.call(this,t),this.fragmentShader=t.fragmentShader,this.vertexShader=t.vertexShader,this.uniforms=bs.clone(t.uniforms),this.defines=t.defines,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.lights=t.lights,this.clipping=t.clipping,this.skinning=t.skinning,this.morphTargets=t.morphTargets,this.morphNormals=t.morphNormals,this.extensions=t.extensions,this},Q.prototype.toJSON=function(t){var e=J.prototype.toJSON.call(this,t);return e.uniforms=this.uniforms,e.vertexShader=this.vertexShader,e.fragmentShader=this.fragmentShader,e},K.prototype=Object.create(J.prototype),K.prototype.constructor=K,K.prototype.isMeshDepthMaterial=!0,K.prototype.copy=function(t){return J.prototype.copy.call(this,t),this.depthPacking=t.depthPacking,this.skinning=t.skinning,this.morphTargets=t.morphTargets,this.map=t.map,this.alphaMap=t.alphaMap,this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this},Object.assign($.prototype,{isBox3:!0,set:function(t,e){return this.min.copy(t),this.max.copy(e),this},setFromArray:function(t){for(var e=1/0,i=1/0,n=1/0,r=-1/0,a=-1/0,o=-1/0,s=0,c=t.length;s<c;s+=3){var h=t[s],l=t[s+1],u=t[s+2];h<e&&(e=h),l<i&&(i=l),u<n&&(n=u),h>r&&(r=h),l>a&&(a=l),u>o&&(o=u)}return this.min.set(e,i,n),this.max.set(r,a,o),this},setFromBufferAttribute:function(t){for(var e=1/0,i=1/0,n=1/0,r=-1/0,a=-1/0,o=-1/0,s=0,c=t.count;s<c;s++){var h=t.getX(s),l=t.getY(s),u=t.getZ(s);h<e&&(e=h),l<i&&(i=l),u<n&&(n=u),h>r&&(r=h),l>a&&(a=l),u>o&&(o=u)}return this.min.set(e,i,n),this.max.set(r,a,o),this},setFromPoints:function(t){this.makeEmpty();for(var e=0,i=t.length;e<i;e++)this.expandByPoint(t[e]);return this},setFromCenterAndSize:function(){var t=new c;return function(e,i){var n=t.copy(i).multiplyScalar(.5);return this.min.copy(e).sub(n),this.max.copy(e).add(n),this}}(),setFromObject:function(t){return this.makeEmpty(),this.expandByObject(t)},clone:function(){return(new this.constructor).copy(this)},copy:function(t){return this.min.copy(t.min),this.max.copy(t.max),this},makeEmpty:function(){return this.min.x=this.min.y=this.min.z=1/0,this.max.x=this.max.y=this.max.z=-1/0,this},isEmpty:function(){return this.max.x<this.min.x||this.max.y<this.min.y||this.max.z<this.min.z},getCenter:function(t){var e=t||new c;return this.isEmpty()?e.set(0,0,0):e.addVectors(this.min,this.max).multiplyScalar(.5)},getSize:function(t){var e=t||new c;return this.isEmpty()?e.set(0,0,0):e.subVectors(this.max,this.min)},expandByPoint:function(t){return this.min.min(t),this.max.max(t),this},expandByVector:function(t){return this.min.sub(t),this.max.add(t),this},expandByScalar:function(t){return this.min.addScalar(-t),this.max.addScalar(t),this},expandByObject:function(){var t=new c;return function(e){var i=this;return e.updateMatrixWorld(!0),e.traverse(function(e){var n,r,a=e.geometry;if(void 0!==a)if(a.isGeometry){var o=a.vertices;for(n=0,r=o.length;n<r;n++)t.copy(o[n]),t.applyMatrix4(e.matrixWorld),i.expandByPoint(t)}else if(a.isBufferGeometry){var s=a.attributes.position;if(void 0!==s)for(n=0,r=s.count;n<r;n++)t.fromBufferAttribute(s,n).applyMatrix4(e.matrixWorld),i.expandByPoint(t)}}),this}}(),containsPoint:function(t){return!(t.x<this.min.x||t.x>this.max.x||t.y<this.min.y||t.y>this.max.y||t.z<this.min.z||t.z>this.max.z)},containsBox:function(t){return this.min.x<=t.min.x&&t.max.x<=this.max.x&&this.min.y<=t.min.y&&t.max.y<=this.max.y&&this.min.z<=t.min.z&&t.max.z<=this.max.z},getParameter:function(t,e){return(e||new c).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.x<this.min.x||t.min.x>this.max.x||t.max.y<this.min.y||t.min.y>this.max.y||t.max.z<this.min.z||t.min.z>this.max.z)},intersectsSphere:function(){var t=new c;return function(e){return this.clampPoint(e.center,t),t.distanceToSquared(e.center)<=e.radius*e.radius}}(),intersectsPlane:function(t){var e,i;return t.normal.x>0?(e=t.normal.x*this.min.x,i=t.normal.x*this.max.x):(e=t.normal.x*this.max.x,i=t.normal.x*this.min.x),t.normal.y>0?(e+=t.normal.y*this.min.y,i+=t.normal.y*this.max.y):(e+=t.normal.y*this.max.y,i+=t.normal.y*this.min.y),t.normal.z>0?(e+=t.normal.z*this.min.z,i+=t.normal.z*this.max.z):(e+=t.normal.z*this.max.z,i+=t.normal.z*this.min.z),e<=t.constant&&i>=t.constant},clampPoint:function(t,e){return(e||new c).copy(t).clamp(this.min,this.max)},distanceToPoint:function(){var t=new c;return function(e){return t.copy(e).clamp(this.min,this.max).sub(e).length()}}(),getBoundingSphere:function(){var t=new c;return function(e){var i=e||new tt;return this.getCenter(i.center),i.radius=.5*this.getSize(t).length(),i}}(),intersect:function(t){return this.min.max(t.min),this.max.min(t.max),this.isEmpty()&&this.makeEmpty(),this},union:function(t){return this.min.min(t.min),this.max.max(t.max),this},applyMatrix4:function(){var t=[new c,new c,new c,new c,new c,new c,new c,new c];return function(e){return this.isEmpty()?this:(t[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(e),t[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(e),t[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(e),t[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(e),t[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(e),t[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(e),t[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(e),t[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(e),this.setFromPoints(t),this)}}(),translate:function(t){return this.min.add(t),this.max.add(t),this},equals:function(t){return t.min.equals(this.min)&&t.max.equals(this.max)}}),Object.assign(tt.prototype,{set:function(t,e){return this.center.copy(t),this.radius=e,this},setFromPoints:function(){var t=new $;return function(e,i){var n=this.center;void 0!==i?n.copy(i):t.setFromPoints(e).getCenter(n);for(var r=0,a=0,o=e.length;a<o;a++)r=Math.max(r,n.distanceToSquared(e[a]));return this.radius=Math.sqrt(r),this}}(),clone:function(){return(new this.constructor).copy(this)},copy:function(t){return this.center.copy(t.center),this.radius=t.radius,this},empty:function(){return this.radius<=0},containsPoint:function(t){return t.distanceToSquared(this.center)<=this.radius*this.radius},distanceToPoint:function(t){return t.distanceTo(this.center)-this.radius},intersectsSphere:function(t){var e=this.radius+t.radius;return t.center.distanceToSquared(this.center)<=e*e},intersectsBox:function(t){return t.intersectsSphere(this)},intersectsPlane:function(t){return Math.abs(this.center.dot(t.normal)-t.constant)<=this.radius},clampPoint:function(t,e){var i=this.center.distanceToSquared(t),n=e||new c;return n.copy(t),i>this.radius*this.radius&&(n.sub(this.center).normalize(),n.multiplyScalar(this.radius).add(this.center)),n},getBoundingBox:function(t){var e=t||new $;return e.set(this.center,this.center),e.expandByScalar(this.radius),e},applyMatrix4:function(t){return this.center.applyMatrix4(t),this.radius=this.radius*t.getMaxScaleOnAxis(),this},translate:function(t){return this.center.add(t),this},equals:function(t){return t.center.equals(this.center)&&t.radius===this.radius}}),Object.assign(et.prototype,{isMatrix3:!0,set:function(t,e,i,n,r,a,o,s,c){var h=this.elements;return h[0]=t,h[1]=n,h[2]=o,h[3]=e,h[4]=r,h[5]=s,h[6]=i,h[7]=a,h[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,i=t.elements;return e[0]=i[0],e[1]=i[1],e[2]=i[2],e[3]=i[3],e[4]=i[4],e[5]=i[5],e[6]=i[6],e[7]=i[7],e[8]=i[8],this},setFromMatrix4:function(t){var e=t.elements;return this.set(e[0],e[4],e[8],e[1],e[5],e[9],e[2],e[6],e[10]),this},applyToBufferAttribute:function(){var t=new c;return function(e){for(var i=0,n=e.count;i<n;i++)t.x=e.getX(i),t.y=e.getY(i),t.z=e.getZ(i),t.applyMatrix3(this),e.setXYZ(i,t.x,t.y,t.z);return e}}(),multiply:function(t){return this.multiplyMatrices(this,t)},premultiply:function(t){return this.multiplyMatrices(t,this)},multiplyMatrices:function(t,e){var i=t.elements,n=e.elements,r=this.elements,a=i[0],o=i[3],s=i[6],c=i[1],h=i[4],l=i[7],u=i[2],p=i[5],d=i[8],f=n[0],m=n[3],v=n[6],g=n[1],y=n[4],x=n[7],b=n[2],_=n[5],w=n[8];return r[0]=a*f+o*g+s*b,r[3]=a*m+o*y+s*_,r[6]=a*v+o*x+s*w,r[1]=c*f+h*g+l*b,r[4]=c*m+h*y+l*_,r[7]=c*v+h*x+l*w,r[2]=u*f+p*g+d*b,r[5]=u*m+p*y+d*_,r[8]=u*v+p*x+d*w,this},multiplyScalar:function(t){var e=this.elements;return e[0]*=t,e[3]*=t,e[6]*=t,e[1]*=t,e[4]*=t,e[7]*=t,e[2]*=t,e[5]*=t,e[8]*=t,this},determinant:function(){var t=this.elements,e=t[0],i=t[1],n=t[2],r=t[3],a=t[4],o=t[5],s=t[6],c=t[7],h=t[8];return e*a*h-e*o*c-i*r*h+i*o*s+n*r*c-n*a*s},getInverse:function(t,e){t&&t.isMatrix4&&console.error("THREE.Matrix3.getInverse no longer takes a Matrix4 argument.");var i=t.elements,n=this.elements,r=i[0],a=i[1],o=i[2],s=i[3],c=i[4],h=i[5],l=i[6],u=i[7],p=i[8],d=p*c-h*u,f=h*l-p*s,m=u*s-c*l,v=r*d+a*f+o*m;if(0===v){var g="THREE.Matrix3.getInverse(): can't invert matrix, determinant is 0";if(!0===e)throw new Error(g);return console.warn(g),this.identity()}var y=1/v;return n[0]=d*y,n[1]=(o*u-p*a)*y,n[2]=(h*a-o*c)*y,n[3]=f*y,n[4]=(p*r-o*l)*y,n[5]=(o*s-h*r)*y,n[6]=m*y,n[7]=(a*l-u*r)*y,n[8]=(c*r-a*s)*y,this},transpose:function(){var t,e=this.elements;return t=e[1],e[1]=e[3],e[3]=t,t=e[2],e[2]=e[6],e[6]=t,t=e[5],e[5]=e[7],e[7]=t,this},getNormalMatrix:function(t){return this.setFromMatrix4(t).getInverse(this).transpose()},transposeIntoArray:function(t){var e=this.elements;return t[0]=e[0],t[1]=e[3],t[2]=e[6],t[3]=e[1],t[4]=e[4],t[5]=e[7],t[6]=e[2],t[7]=e[5],t[8]=e[8],this},equals:function(t){for(var e=this.elements,i=t.elements,n=0;n<9;n++)if(e[n]!==i[n])return!1;return!0},fromArray:function(t,e){void 0===e&&(e=0);for(var i=0;i<9;i++)this.elements[i]=t[i+e];return this},toArray:function(t,e){void 0===t&&(t=[]),void 0===e&&(e=0);var i=this.elements;return t[e]=i[0],t[e+1]=i[1],t[e+2]=i[2],t[e+3]=i[3],t[e+4]=i[4],t[e+5]=i[5],t[e+6]=i[6],t[e+7]=i[7],t[e+8]=i[8],t}}),Object.assign(it.prototype,{set:function(t,e){return this.normal.copy(t),this.constant=e,this},setComponents:function(t,e,i,n){return this.normal.set(t,e,i),this.constant=n,this},setFromNormalAndCoplanarPoint:function(t,e){return this.normal.copy(t),this.constant=-e.dot(this.normal),this},setFromCoplanarPoints:function(){var t=new c,e=new c;return function(i,n,r){var a=t.subVectors(r,n).cross(e.subVectors(i,n)).normalize();return this.setFromNormalAndCoplanarPoint(a,i),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 this.orthoPoint(t,e).sub(t).negate()},orthoPoint:function(t,e){var i=this.distanceToPoint(t);return(e||new c).copy(this.normal).multiplyScalar(i)},intersectLine:function(){var t=new c;return function(e,i){var n=i||new c,r=e.delta(t),a=this.normal.dot(r);if(0!==a){var o=-(e.start.dot(this.normal)+this.constant)/a;if(!(o<0||o>1))return n.copy(r).multiplyScalar(o).add(e.start)}else if(0===this.distanceToPoint(e.start))return n.copy(e.start)}}(),intersectsLine:function(t){var e=this.distanceToPoint(t.start),i=this.distanceToPoint(t.end);return e<0&&i>0||i<0&&e>0},intersectsBox:function(t){return t.intersectsPlane(this)},intersectsSphere:function(t){return t.intersectsPlane(this)},coplanarPoint:function(t){return(t||new c).copy(this.normal).multiplyScalar(-this.constant)},applyMatrix4:function(){var t=new c,e=new et;return function(i,n){var r=this.coplanarPoint(t).applyMatrix4(i),a=n||e.getNormalMatrix(i),o=this.normal.applyMatrix3(a).normalize();return this.constant=-r.dot(o),this}}(),translate:function(t){return this.constant=this.constant-t.dot(this.normal),this},equals:function(t){return t.normal.equals(this.normal)&&t.constant===this.constant}}),Object.assign(nt.prototype,{set:function(t,e,i,n,r,a){var o=this.planes;return o[0].copy(t),o[1].copy(e),o[2].copy(i),o[3].copy(n),o[4].copy(r),o[5].copy(a),this},clone:function(){return(new this.constructor).copy(this)},copy:function(t){for(var e=this.planes,i=0;i<6;i++)e[i].copy(t.planes[i]);return this},setFromMatrix:function(t){var e=this.planes,i=t.elements,n=i[0],r=i[1],a=i[2],o=i[3],s=i[4],c=i[5],h=i[6],l=i[7],u=i[8],p=i[9],d=i[10],f=i[11],m=i[12],v=i[13],g=i[14],y=i[15];return e[0].setComponents(o-n,l-s,f-u,y-m).normalize(),e[1].setComponents(o+n,l+s,f+u,y+m).normalize(),e[2].setComponents(o+r,l+c,f+p,y+v).normalize(),e[3].setComponents(o-r,l-c,f-p,y-v).normalize(),e[4].setComponents(o-a,l-h,f-d,y-g).normalize(),e[5].setComponents(o+a,l+h,f+d,y+g).normalize(),this},intersectsObject:function(){var t=new tt;return function(e){var i=e.geometry;return null===i.boundingSphere&&i.computeBoundingSphere(),t.copy(i.boundingSphere).applyMatrix4(e.matrixWorld),this.intersectsSphere(t)}}(),intersectsSprite:function(){var t=new tt;return function(e){return t.center.set(0,0,0),t.radius=.7071067811865476,t.applyMatrix4(e.matrixWorld),this.intersectsSphere(t)}}(),intersectsSphere:function(t){for(var e=this.planes,i=t.center,n=-t.radius,r=0;r<6;r++){if(e[r].distanceToPoint(i)<n)return!1}return!0},intersectsBox:function(){var t=new c,e=new c;return function(i){for(var n=this.planes,r=0;r<6;r++){var a=n[r];t.x=a.normal.x>0?i.min.x:i.max.x,e.x=a.normal.x>0?i.max.x:i.min.x,t.y=a.normal.y>0?i.min.y:i.max.y,e.y=a.normal.y>0?i.max.y:i.min.y,t.z=a.normal.z>0?i.min.z:i.max.z,e.z=a.normal.z>0?i.max.z:i.min.z;var o=a.distanceToPoint(t),s=a.distanceToPoint(e);if(o<0&&s<0)return!1}return!0}}(),containsPoint:function(t){for(var e=this.planes,i=0;i<6;i++)if(e[i].distanceToPoint(t)<0)return!1;return!0}}),Object.assign(at.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(e||new c).copy(this.direction).multiplyScalar(t).add(this.origin)},lookAt:function(t){return this.direction.copy(t).sub(this.origin).normalize(),this},recast:function(){var t=new c;return function(e){return this.origin.copy(this.at(e,t)),this}}(),closestPointToPoint:function(t,e){var i=e||new c;i.subVectors(t,this.origin);var n=i.dot(this.direction);return n<0?i.copy(this.origin):i.copy(this.direction).multiplyScalar(n).add(this.origin)},distanceToPoint:function(t){return Math.sqrt(this.distanceSqToPoint(t))},distanceSqToPoint:function(){var t=new c;return function(e){var i=t.subVectors(e,this.origin).dot(this.direction);return i<0?this.origin.distanceToSquared(e):(t.copy(this.direction).multiplyScalar(i).add(this.origin),t.distanceToSquared(e))}}(),distanceSqToSegment:function(){var t=new c,e=new c,i=new c;return function(n,r,a,o){t.copy(n).add(r).multiplyScalar(.5),e.copy(r).sub(n).normalize(),i.copy(this.origin).sub(t);var s,c,h,l,u=.5*n.distanceTo(r),p=-this.direction.dot(e),d=i.dot(this.direction),f=-i.dot(e),m=i.lengthSq(),v=Math.abs(1-p*p);if(v>0)if(s=p*f-d,c=p*d-f,l=u*v,s>=0)if(c>=-l)if(c<=l){var g=1/v;s*=g,c*=g,h=s*(s+p*c+2*d)+c*(p*s+c+2*f)+m}else c=u,s=Math.max(0,-(p*c+d)),h=-s*s+c*(c+2*f)+m;else c=-u,s=Math.max(0,-(p*c+d)),h=-s*s+c*(c+2*f)+m;else c<=-l?(s=Math.max(0,-(-p*u+d)),c=s>0?-u:Math.min(Math.max(-u,-f),u),h=-s*s+c*(c+2*f)+m):c<=l?(s=0,c=Math.min(Math.max(-u,-f),u),h=c*(c+2*f)+m):(s=Math.max(0,-(p*u+d)),c=s>0?u:Math.min(Math.max(-u,-f),u),h=-s*s+c*(c+2*f)+m);else c=p>0?-u:u,s=Math.max(0,-(p*c+d)),h=-s*s+c*(c+2*f)+m;return a&&a.copy(this.direction).multiplyScalar(s).add(this.origin),o&&o.copy(e).multiplyScalar(c).add(t),h}}(),intersectSphere:function(){var t=new c;return function(e,i){t.subVectors(e.center,this.origin);var n=t.dot(this.direction),r=t.dot(t)-n*n,a=e.radius*e.radius;if(r>a)return null;var o=Math.sqrt(a-r),s=n-o,c=n+o;return s<0&&c<0?null:s<0?this.at(c,i):this.at(s,i)}}(),intersectsSphere:function(t){return this.distanceToPoint(t.center)<=t.radius},distanceToPlane:function(t){var e=t.normal.dot(this.direction);if(0===e)return 0===t.distanceToPoint(this.origin)?0:null;var i=-(this.origin.dot(t.normal)+t.constant)/e;return i>=0?i:null},intersectPlane:function(t,e){var i=this.distanceToPlane(t);return null===i?null:this.at(i,e)},intersectsPlane:function(t){var e=t.distanceToPoint(this.origin);return 0===e||t.normal.dot(this.direction)*e<0},intersectBox:function(t,e){var i,n,r,a,o,s,c=1/this.direction.x,h=1/this.direction.y,l=1/this.direction.z,u=this.origin;return c>=0?(i=(t.min.x-u.x)*c,n=(t.max.x-u.x)*c):(i=(t.max.x-u.x)*c,n=(t.min.x-u.x)*c),h>=0?(r=(t.min.y-u.y)*h,a=(t.max.y-u.y)*h):(r=(t.max.y-u.y)*h,a=(t.min.y-u.y)*h),i>a||r>n?null:((r>i||i!==i)&&(i=r),(a<n||n!==n)&&(n=a),l>=0?(o=(t.min.z-u.z)*l,s=(t.max.z-u.z)*l):(o=(t.max.z-u.z)*l,s=(t.min.z-u.z)*l),i>s||o>n?null:((o>i||i!==i)&&(i=o),(s<n||n!==n)&&(n=s),n<0?null:this.at(i>=0?i:n,e)))},intersectsBox:function(){var t=new c;return function(e){return null!==this.intersectBox(e,t)}}(),intersectTriangle:function(){var t=new c,e=new c,i=new c,n=new c;return function(r,a,o,s,c){e.subVectors(a,r),i.subVectors(o,r),n.crossVectors(e,i);var h,l=this.direction.dot(n);if(l>0){if(s)return null;h=1}else{if(!(l<0))return null;h=-1,l=-l}t.subVectors(this.origin,r);var u=h*this.direction.dot(i.crossVectors(t,i));if(u<0)return null;var p=h*this.direction.dot(e.cross(t));if(p<0)return null;if(u+p>l)return null;var d=-h*t.dot(n);return d<0?null:this.at(d/l,c)}}(),applyMatrix4:function(t){return this.direction.add(this.origin).applyMatrix4(t),this.origin.applyMatrix4(t),this.direction.sub(this.origin),this.direction.normalize(),this},equals:function(t){return t.origin.equals(this.origin)&&t.direction.equals(this.direction)}}),ot.RotationOrders=["XYZ","YZX","ZXY","XZY","YXZ","ZYX"],ot.DefaultOrder="XYZ",Object.defineProperties(ot.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()}},order:{get:function(){return this._order},set:function(t){this._order=t,this.onChangeCallback()}}}),Object.assign(ot.prototype,{isEuler:!0,set:function(t,e,i,n){return this._x=t,this._y=e,this._z=i,this._order=n||this._order,this.onChangeCallback(),this},clone:function(){return new this.constructor(this._x,this._y,this._z,this._order)},copy:function(t){return this._x=t._x,this._y=t._y,this._z=t._z,this._order=t._order,this.onChangeCallback(),this},setFromRotationMatrix:function(t,e,i){var n=hs.clamp,r=t.elements,a=r[0],o=r[4],s=r[8],c=r[1],h=r[5],l=r[9],u=r[2],p=r[6],d=r[10];return e=e||this._order,"XYZ"===e?(this._y=Math.asin(n(s,-1,1)),Math.abs(s)<.99999?(this._x=Math.atan2(-l,d),this._z=Math.atan2(-o,a)):(this._x=Math.atan2(p,h),this._z=0)):"YXZ"===e?(this._x=Math.asin(-n(l,-1,1)),Math.abs(l)<.99999?(this._y=Math.atan2(s,d),this._z=Math.atan2(c,h)):(this._y=Math.atan2(-u,a),this._z=0)):"ZXY"===e?(this._x=Math.asin(n(p,-1,1)),Math.abs(p)<.99999?(this._y=Math.atan2(-u,d),this._z=Math.atan2(-o,h)):(this._y=0,this._z=Math.atan2(c,a))):"ZYX"===e?(this._y=Math.asin(-n(u,-1,1)),Math.abs(u)<.99999?(this._x=Math.atan2(p,d),this._z=Math.atan2(c,a)):(this._x=0,this._z=Math.atan2(-o,h))):"YZX"===e?(this._z=Math.asin(n(c,-1,1)),Math.abs(c)<.99999?(this._x=Math.atan2(-l,h),this._y=Math.atan2(-u,a)):(this._x=0,this._y=Math.atan2(s,d))):"XZY"===e?(this._z=Math.asin(-n(o,-1,1)),Math.abs(o)<.99999?(this._x=Math.atan2(p,h),this._y=Math.atan2(s,a)):(this._x=Math.atan2(-l,d),this._y=0)):console.warn("THREE.Euler: .setFromRotationMatrix() given unsupported order: "+e),this._order=e,!1!==i&&this.onChangeCallback(),this},
setFromQuaternion:function(){var t=new h;return function(e,i,n){return t.makeRotationFromQuaternion(e),this.setFromRotationMatrix(t,i,n)}}(),setFromVector3:function(t,e){return this.set(t.x,t.y,t.z,e||this._order)},reorder:function(){var t=new s;return function(e){return t.setFromEuler(this),this.setFromQuaternion(t,e)}}(),equals:function(t){return t._x===this._x&&t._y===this._y&&t._z===this._z&&t._order===this._order},fromArray:function(t){return this._x=t[0],this._y=t[1],this._z=t[2],void 0!==t[3]&&(this._order=t[3]),this.onChangeCallback(),this},toArray:function(t,e){return void 0===t&&(t=[]),void 0===e&&(e=0),t[e]=this._x,t[e+1]=this._y,t[e+2]=this._z,t[e+3]=this._order,t},toVector3:function(t){return t?t.set(this._x,this._y,this._z):new c(this._x,this._y,this._z)},onChange:function(t){return this.onChangeCallback=t,this},onChangeCallback:function(){}}),Object.assign(st.prototype,{set:function(t){this.mask=1<<t|0},enable:function(t){this.mask|=1<<t|0},toggle:function(t){this.mask^=1<<t|0},disable:function(t){this.mask&=~(1<<t|0)},test:function(t){return 0!=(this.mask&t.mask)}});var Es=0;ct.DefaultUp=new c(0,1,0),ct.DefaultMatrixAutoUpdate=!0,Object.assign(ct.prototype,e.prototype,{isObject3D:!0,applyMatrix:function(t){this.matrix.multiplyMatrices(t,this.matrix),this.matrix.decompose(this.position,this.quaternion,this.scale)},setRotationFromAxisAngle:function(t,e){this.quaternion.setFromAxisAngle(t,e)},setRotationFromEuler:function(t){this.quaternion.setFromEuler(t,!0)},setRotationFromMatrix:function(t){this.quaternion.setFromRotationMatrix(t)},setRotationFromQuaternion:function(t){this.quaternion.copy(t)},rotateOnAxis:function(){var t=new s;return function(e,i){return t.setFromAxisAngle(e,i),this.quaternion.multiply(t),this}}(),rotateX:function(){var t=new c(1,0,0);return function(e){return this.rotateOnAxis(t,e)}}(),rotateY:function(){var t=new c(0,1,0);return function(e){return this.rotateOnAxis(t,e)}}(),rotateZ:function(){var t=new c(0,0,1);return function(e){return this.rotateOnAxis(t,e)}}(),translateOnAxis:function(){var t=new c;return function(e,i){return t.copy(e).applyQuaternion(this.quaternion),this.position.add(t.multiplyScalar(i)),this}}(),translateX:function(){var t=new c(1,0,0);return function(e){return this.translateOnAxis(t,e)}}(),translateY:function(){var t=new c(0,1,0);return function(e){return this.translateOnAxis(t,e)}}(),translateZ:function(){var t=new c(0,0,1);return function(e){return this.translateOnAxis(t,e)}}(),localToWorld:function(t){return t.applyMatrix4(this.matrixWorld)},worldToLocal:function(){var t=new h;return function(e){return e.applyMatrix4(t.getInverse(this.matrixWorld))}}(),lookAt:function(){var t=new h;return function(e){this.isCamera?t.lookAt(this.position,e,this.up):t.lookAt(e,this.position,this.up),this.quaternion.setFromRotationMatrix(t)}}(),add:function(t){if(arguments.length>1){for(var e=0;e<arguments.length;e++)this.add(arguments[e]);return this}return t===this?(console.error("THREE.Object3D.add: object can't be added as a child of itself.",t),this):(t&&t.isObject3D?(null!==t.parent&&t.parent.remove(t),t.parent=this,t.dispatchEvent({type:"added"}),this.children.push(t)):console.error("THREE.Object3D.add: object not an instance of THREE.Object3D.",t),this)},remove:function(t){if(arguments.length>1)for(var e=0;e<arguments.length;e++)this.remove(arguments[e]);var i=this.children.indexOf(t);-1!==i&&(t.parent=null,t.dispatchEvent({type:"removed"}),this.children.splice(i,1))},getObjectById:function(t){return this.getObjectByProperty("id",t)},getObjectByName:function(t){return this.getObjectByProperty("name",t)},getObjectByProperty:function(t,e){if(this[t]===e)return this;for(var i=0,n=this.children.length;i<n;i++){var r=this.children[i],a=r.getObjectByProperty(t,e);if(void 0!==a)return a}},getWorldPosition:function(t){var e=t||new c;return this.updateMatrixWorld(!0),e.setFromMatrixPosition(this.matrixWorld)},getWorldQuaternion:function(){var t=new c,e=new c;return function(i){var n=i||new s;return this.updateMatrixWorld(!0),this.matrixWorld.decompose(t,n,e),n}}(),getWorldRotation:function(){var t=new s;return function(e){var i=e||new ot;return this.getWorldQuaternion(t),i.setFromQuaternion(t,this.rotation.order,!1)}}(),getWorldScale:function(){var t=new c,e=new s;return function(i){var n=i||new c;return this.updateMatrixWorld(!0),this.matrixWorld.decompose(t,e,n),n}}(),getWorldDirection:function(){var t=new s;return function(e){var i=e||new c;return this.getWorldQuaternion(t),i.set(0,0,1).applyQuaternion(t)}}(),raycast:function(){},traverse:function(t){t(this);for(var e=this.children,i=0,n=e.length;i<n;i++)e[i].traverse(t)},traverseVisible:function(t){if(!1!==this.visible){t(this);for(var e=this.children,i=0,n=e.length;i<n;i++)e[i].traverseVisible(t)}},traverseAncestors:function(t){var e=this.parent;null!==e&&(t(e),e.traverseAncestors(t))},updateMatrix:function(){this.matrix.compose(this.position,this.quaternion,this.scale),this.matrixWorldNeedsUpdate=!0},updateMatrixWorld:function(t){this.matrixAutoUpdate&&this.updateMatrix(),(this.matrixWorldNeedsUpdate||t)&&(null===this.parent?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix),this.matrixWorldNeedsUpdate=!1,t=!0);for(var e=this.children,i=0,n=e.length;i<n;i++)e[i].updateMatrixWorld(t)},toJSON:function(t){function e(e,i){return void 0===e[i.uuid]&&(e[i.uuid]=i.toJSON(t)),i.uuid}function i(t){var e=[];for(var i in t){var n=t[i];delete n.metadata,e.push(n)}return e}var n=void 0===t||""===t,r={};n&&(t={geometries:{},materials:{},textures:{},images:{}},r.metadata={version:4.5,type:"Object",generator:"Object3D.toJSON"});var a={};if(a.uuid=this.uuid,a.type=this.type,""!==this.name&&(a.name=this.name),"{}"!==JSON.stringify(this.userData)&&(a.userData=this.userData),!0===this.castShadow&&(a.castShadow=!0),!0===this.receiveShadow&&(a.receiveShadow=!0),!1===this.visible&&(a.visible=!1),a.matrix=this.matrix.toArray(),void 0!==this.geometry&&(a.geometry=e(t.geometries,this.geometry)),void 0!==this.material)if(Array.isArray(this.material)){for(var o=[],s=0,c=this.material.length;s<c;s++)o.push(e(t.materials,this.material[s]));a.material=o}else a.material=e(t.materials,this.material);if(this.children.length>0){a.children=[];for(var s=0;s<this.children.length;s++)a.children.push(this.children[s].toJSON(t).object)}if(n){var h=i(t.geometries),l=i(t.materials),u=i(t.textures),p=i(t.images);h.length>0&&(r.geometries=h),l.length>0&&(r.materials=l),u.length>0&&(r.textures=u),p.length>0&&(r.images=p)}return r.object=a,r},clone:function(t){return(new this.constructor).copy(this,t)},copy:function(t,e){if(void 0===e&&(e=!0),this.name=t.name,this.up.copy(t.up),this.position.copy(t.position),this.quaternion.copy(t.quaternion),this.scale.copy(t.scale),this.matrix.copy(t.matrix),this.matrixWorld.copy(t.matrixWorld),this.matrixAutoUpdate=t.matrixAutoUpdate,this.matrixWorldNeedsUpdate=t.matrixWorldNeedsUpdate,this.layers.mask=t.layers.mask,this.visible=t.visible,this.castShadow=t.castShadow,this.receiveShadow=t.receiveShadow,this.frustumCulled=t.frustumCulled,this.renderOrder=t.renderOrder,this.userData=JSON.parse(JSON.stringify(t.userData)),!0===e)for(var i=0;i<t.children.length;i++){var n=t.children[i];this.add(n.clone())}return this}}),Object.assign(ht.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(t||new c).addVectors(this.start,this.end).multiplyScalar(.5)},delta:function(t){return(t||new c).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){var i=e||new c;return this.delta(i).multiplyScalar(t).add(this.start)},closestPointToPointParameter:function(){var t=new c,e=new c;return function(i,n){t.subVectors(i,this.start),e.subVectors(this.end,this.start);var r=e.dot(e),a=e.dot(t),o=a/r;return n&&(o=hs.clamp(o,0,1)),o}}(),closestPointToPoint:function(t,e,i){var n=this.closestPointToPointParameter(t,e),r=i||new c;return this.delta(r).multiplyScalar(n).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)}}),Object.assign(lt,{normal:function(){var t=new c;return function(e,i,n,r){var a=r||new c;a.subVectors(n,i),t.subVectors(e,i),a.cross(t);var o=a.lengthSq();return o>0?a.multiplyScalar(1/Math.sqrt(o)):a.set(0,0,0)}}(),barycoordFromPoint:function(){var t=new c,e=new c,i=new c;return function(n,r,a,o,s){t.subVectors(o,r),e.subVectors(a,r),i.subVectors(n,r);var h=t.dot(t),l=t.dot(e),u=t.dot(i),p=e.dot(e),d=e.dot(i),f=h*p-l*l,m=s||new c;if(0===f)return m.set(-2,-1,-1);var v=1/f,g=(p*u-l*d)*v,y=(h*d-l*u)*v;return m.set(1-g-y,y,g)}}(),containsPoint:function(){var t=new c;return function(e,i,n,r){var a=lt.barycoordFromPoint(e,i,n,r,t);return a.x>=0&&a.y>=0&&a.x+a.y<=1}}()}),Object.assign(lt.prototype,{set:function(t,e,i){return this.a.copy(t),this.b.copy(e),this.c.copy(i),this},setFromPointsAndIndices:function(t,e,i,n){return this.a.copy(t[e]),this.b.copy(t[i]),this.c.copy(t[n]),this},clone:function(){return(new this.constructor).copy(this)},copy:function(t){return this.a.copy(t.a),this.b.copy(t.b),this.c.copy(t.c),this},area:function(){var t=new c,e=new c;return function(){return t.subVectors(this.c,this.b),e.subVectors(this.a,this.b),.5*t.cross(e).length()}}(),midpoint:function(t){return(t||new c).addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)},normal:function(t){return lt.normal(this.a,this.b,this.c,t)},plane:function(t){return(t||new it).setFromCoplanarPoints(this.a,this.b,this.c)},barycoordFromPoint:function(t,e){return lt.barycoordFromPoint(t,this.a,this.b,this.c,e)},containsPoint:function(t){return lt.containsPoint(t,this.a,this.b,this.c)},closestPointToPoint:function(){var t=new it,e=[new ht,new ht,new ht],i=new c,n=new c;return function(r,a){var o=a||new c,s=1/0;if(t.setFromCoplanarPoints(this.a,this.b,this.c),t.projectPoint(r,i),!0===this.containsPoint(i))o.copy(i);else{e[0].set(this.a,this.b),e[1].set(this.b,this.c),e[2].set(this.c,this.a);for(var h=0;h<e.length;h++){e[h].closestPointToPoint(i,!0,n);var l=i.distanceToSquared(n);l<s&&(s=l,o.copy(n))}}return o}}(),equals:function(t){return t.a.equals(this.a)&&t.b.equals(this.b)&&t.c.equals(this.c)}}),Object.assign(ut.prototype,{clone:function(){return(new this.constructor).copy(this)},copy:function(t){this.a=t.a,this.b=t.b,this.c=t.c,this.normal.copy(t.normal),this.color.copy(t.color),this.materialIndex=t.materialIndex;for(var e=0,i=t.vertexNormals.length;e<i;e++)this.vertexNormals[e]=t.vertexNormals[e].clone();for(var e=0,i=t.vertexColors.length;e<i;e++)this.vertexColors[e]=t.vertexColors[e].clone();return this}}),pt.prototype=Object.create(J.prototype),pt.prototype.constructor=pt,pt.prototype.isMeshBasicMaterial=!0,pt.prototype.copy=function(t){return J.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(dt.prototype,"needsUpdate",{set:function(t){!0===t&&this.version++}}),Object.assign(dt.prototype,{isBufferAttribute:!0,setArray:function(t){if(Array.isArray(t))throw new TypeError("THREE.BufferAttribute: array should be a Typed Array.");this.count=void 0!==t?t.length/this.itemSize:0,this.array=t},setDynamic:function(t){return this.dynamic=t,this},copy:function(t){return 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,i){t*=this.itemSize,i*=e.itemSize;for(var n=0,r=this.itemSize;n<r;n++)this.array[t+n]=e.array[i+n];return this},copyArray:function(t){return this.array.set(t),this},copyColorsArray:function(t){for(var e=this.array,i=0,n=0,r=t.length;n<r;n++){var a=t[n];void 0===a&&(console.warn("THREE.BufferAttribute.copyColorsArray(): color is undefined",n),a=new X),e[i++]=a.r,e[i++]=a.g,e[i++]=a.b}return this},copyIndicesArray:function(t){for(var e=this.array,i=0,n=0,r=t.length;n<r;n++){var a=t[n];e[i++]=a.a,e[i++]=a.b,e[i++]=a.c}return this},copyVector2sArray:function(t){for(var e=this.array,n=0,r=0,a=t.length;r<a;r++){var o=t[r];void 0===o&&(console.warn("THREE.BufferAttribute.copyVector2sArray(): vector is undefined",r),o=new i),e[n++]=o.x,e[n++]=o.y}return this},copyVector3sArray:function(t){for(var e=this.array,i=0,n=0,r=t.length;n<r;n++){var a=t[n];void 0===a&&(console.warn("THREE.BufferAttribute.copyVector3sArray(): vector is undefined",n),a=new c),e[i++]=a.x,e[i++]=a.y,e[i++]=a.z}return this},copyVector4sArray:function(t){for(var e=this.array,i=0,n=0,a=t.length;n<a;n++){var o=t[n];void 0===o&&(console.warn("THREE.BufferAttribute.copyVector4sArray(): vector is undefined",n),o=new r),e[i++]=o.x,e[i++]=o.y,e[i++]=o.z,e[i++]=o.w}return this},set:function(t,e){return void 0===e&&(e=0),this.array.set(t,e),this},getX:function(t){return this.array[t*this.itemSize]},setX:function(t,e){return this.array[t*this.itemSize]=e,this},getY:function(t){return this.array[t*this.itemSize+1]},setY:function(t,e){return this.array[t*this.itemSize+1]=e,this},getZ:function(t){return this.array[t*this.itemSize+2]},setZ:function(t,e){return this.array[t*this.itemSize+2]=e,this},getW:function(t){return this.array[t*this.itemSize+3]},setW:function(t,e){return this.array[t*this.itemSize+3]=e,this},setXY:function(t,e,i){return t*=this.itemSize,this.array[t+0]=e,this.array[t+1]=i,this},setXYZ:function(t,e,i,n){return t*=this.itemSize,this.array[t+0]=e,this.array[t+1]=i,this.array[t+2]=n,this},setXYZW:function(t,e,i,n,r){return t*=this.itemSize,this.array[t+0]=e,this.array[t+1]=i,this.array[t+2]=n,this.array[t+3]=r,this},onUpload:function(t){return this.onUploadCallback=t,this},clone:function(){return new this.constructor(this.array,this.itemSize).copy(this)}}),ft.prototype=Object.create(dt.prototype),ft.prototype.constructor=ft,mt.prototype=Object.create(dt.prototype),mt.prototype.constructor=mt,vt.prototype=Object.create(dt.prototype),vt.prototype.constructor=vt,gt.prototype=Object.create(dt.prototype),gt.prototype.constructor=gt,yt.prototype=Object.create(dt.prototype),yt.prototype.constructor=yt,xt.prototype=Object.create(dt.prototype),xt.prototype.constructor=xt,bt.prototype=Object.create(dt.prototype),bt.prototype.constructor=bt,_t.prototype=Object.create(dt.prototype),_t.prototype.constructor=_t,wt.prototype=Object.create(dt.prototype),wt.prototype.constructor=wt,Object.assign(Mt.prototype,{computeGroups:function(t){for(var e,i=[],n=void 0,r=t.faces,a=0;a<r.length;a++){var o=r[a];o.materialIndex!==n&&(n=o.materialIndex,void 0!==e&&(e.count=3*a-e.start,i.push(e)),e={start:3*a,materialIndex:n})}void 0!==e&&(e.count=3*a-e.start,i.push(e)),this.groups=i},fromGeometry:function(t){var e,n=t.faces,r=t.vertices,a=t.faceVertexUvs,o=a[0]&&a[0].length>0,s=a[1]&&a[1].length>0,c=t.morphTargets,h=c.length;if(h>0){e=[];for(var l=0;l<h;l++)e[l]=[];this.morphTargets.position=e}var u,p=t.morphNormals,d=p.length;if(d>0){u=[];for(var l=0;l<d;l++)u[l]=[];this.morphTargets.normal=u}for(var f=t.skinIndices,m=t.skinWeights,v=f.length===r.length,g=m.length===r.length,l=0;l<n.length;l++){var y=n[l];this.vertices.push(r[y.a],r[y.b],r[y.c]);var x=y.vertexNormals;if(3===x.length)this.normals.push(x[0],x[1],x[2]);else{var b=y.normal;this.normals.push(b,b,b)}var _=y.vertexColors;if(3===_.length)this.colors.push(_[0],_[1],_[2]);else{var w=y.color;this.colors.push(w,w,w)}if(!0===o){var M=a[0][l];void 0!==M?this.uvs.push(M[0],M[1],M[2]):(console.warn("THREE.DirectGeometry.fromGeometry(): Undefined vertexUv ",l),this.uvs.push(new i,new i,new i))}if(!0===s){var M=a[1][l];void 0!==M?this.uvs2.push(M[0],M[1],M[2]):(console.warn("THREE.DirectGeometry.fromGeometry(): Undefined vertexUv2 ",l),this.uvs2.push(new i,new i,new i))}for(var E=0;E<h;E++){var T=c[E].vertices;e[E].push(T[y.a],T[y.b],T[y.c])}for(var E=0;E<d;E++){var S=p[E].vertexNormals[l];u[E].push(S.a,S.b,S.c)}v&&this.skinIndices.push(f[y.a],f[y.b],f[y.c]),g&&this.skinWeights.push(m[y.a],m[y.b],m[y.c])}return this.computeGroups(t),this.verticesNeedUpdate=t.verticesNeedUpdate,this.normalsNeedUpdate=t.normalsNeedUpdate,this.colorsNeedUpdate=t.colorsNeedUpdate,this.uvsNeedUpdate=t.uvsNeedUpdate,this.groupsNeedUpdate=t.groupsNeedUpdate,this}});var Ts=0;Object.assign(St.prototype,e.prototype,{isGeometry:!0,applyMatrix:function(t){for(var e=(new et).getNormalMatrix(t),i=0,n=this.vertices.length;i<n;i++){this.vertices[i].applyMatrix4(t)}for(var i=0,n=this.faces.length;i<n;i++){var r=this.faces[i];r.normal.applyMatrix3(e).normalize();for(var a=0,o=r.vertexNormals.length;a<o;a++)r.vertexNormals[a].applyMatrix3(e).normalize()}return null!==this.boundingBox&&this.computeBoundingBox(),null!==this.boundingSphere&&this.computeBoundingSphere(),this.verticesNeedUpdate=!0,this.normalsNeedUpdate=!0,this},rotateX:function(){var t=new h;return function(e){return t.makeRotationX(e),this.applyMatrix(t),this}}(),rotateY:function(){var t=new h;return function(e){return t.makeRotationY(e),this.applyMatrix(t),this}}(),rotateZ:function(){var t=new h;return function(e){return t.makeRotationZ(e),this.applyMatrix(t),this}}(),translate:function(){var t=new h;return function(e,i,n){return t.makeTranslation(e,i,n),this.applyMatrix(t),this}}(),scale:function(){var t=new h;return function(e,i,n){return t.makeScale(e,i,n),this.applyMatrix(t),this}}(),lookAt:function(){var t=new ct;return function(e){t.lookAt(e),t.updateMatrix(),this.applyMatrix(t.matrix)}}(),fromBufferGeometry:function(t){function e(t,e,i,r){var a=void 0!==s?[p[t].clone(),p[e].clone(),p[i].clone()]:[],o=void 0!==h?[n.colors[t].clone(),n.colors[e].clone(),n.colors[i].clone()]:[],c=new ut(t,e,i,a,o,r);n.faces.push(c),void 0!==l&&n.faceVertexUvs[0].push([d[t].clone(),d[e].clone(),d[i].clone()]),void 0!==u&&n.faceVertexUvs[1].push([f[t].clone(),f[e].clone(),f[i].clone()])}var n=this,r=null!==t.index?t.index.array:void 0,a=t.attributes,o=a.position.array,s=void 0!==a.normal?a.normal.array:void 0,h=void 0!==a.color?a.color.array:void 0,l=void 0!==a.uv?a.uv.array:void 0,u=void 0!==a.uv2?a.uv2.array:void 0;void 0!==u&&(this.faceVertexUvs[1]=[]);for(var p=[],d=[],f=[],m=0,v=0;m<o.length;m+=3,v+=2)n.vertices.push(new c(o[m],o[m+1],o[m+2])),void 0!==s&&p.push(new c(s[m],s[m+1],s[m+2])),void 0!==h&&n.colors.push(new X(h[m],h[m+1],h[m+2])),void 0!==l&&d.push(new i(l[v],l[v+1])),void 0!==u&&f.push(new i(u[v],u[v+1]));var g=t.groups;if(g.length>0)for(var m=0;m<g.length;m++)for(var y=g[m],x=y.start,b=y.count,v=x,_=x+b;v<_;v+=3)void 0!==r?e(r[v],r[v+1],r[v+2],y.materialIndex):e(v,v+1,v+2,y.materialIndex);else if(void 0!==r)for(var m=0;m<r.length;m+=3)e(r[m],r[m+1],r[m+2]);else for(var m=0;m<o.length/3;m+=3)e(m,m+1,m+2);return this.computeFaceNormals(),null!==t.boundingBox&&(this.boundingBox=t.boundingBox.clone()),null!==t.boundingSphere&&(this.boundingSphere=t.boundingSphere.clone()),this},center:function(){this.computeBoundingBox();var t=this.boundingBox.getCenter().negate();return this.translate(t.x,t.y,t.z),t},normalize:function(){this.computeBoundingSphere();var t=this.boundingSphere.center,e=this.boundingSphere.radius,i=0===e?1:1/e,n=new h;return n.set(i,0,0,-i*t.x,0,i,0,-i*t.y,0,0,i,-i*t.z,0,0,0,1),this.applyMatrix(n),this},computeFaceNormals:function(){for(var t=new c,e=new c,i=0,n=this.faces.length;i<n;i++){var r=this.faces[i],a=this.vertices[r.a],o=this.vertices[r.b],s=this.vertices[r.c];t.subVectors(s,o),e.subVectors(a,o),t.cross(e),t.normalize(),r.normal.copy(t)}},computeVertexNormals:function(t){void 0===t&&(t=!0);var e,i,n,r,a,o;for(o=new Array(this.vertices.length),e=0,i=this.vertices.length;e<i;e++)o[e]=new c;if(t){var s,h,l,u=new c,p=new c;for(n=0,r=this.faces.length;n<r;n++)a=this.faces[n],s=this.vertices[a.a],h=this.vertices[a.b],l=this.vertices[a.c],u.subVectors(l,h),p.subVectors(s,h),u.cross(p),o[a.a].add(u),o[a.b].add(u),o[a.c].add(u)}else for(this.computeFaceNormals(),n=0,r=this.faces.length;n<r;n++)a=this.faces[n],o[a.a].add(a.normal),o[a.b].add(a.normal),o[a.c].add(a.normal);for(e=0,i=this.vertices.length;e<i;e++)o[e].normalize();for(n=0,r=this.faces.length;n<r;n++){a=this.faces[n];var d=a.vertexNormals;3===d.length?(d[0].copy(o[a.a]),d[1].copy(o[a.b]),d[2].copy(o[a.c])):(d[0]=o[a.a].clone(),d[1]=o[a.b].clone(),d[2]=o[a.c].clone())}this.faces.length>0&&(this.normalsNeedUpdate=!0)},computeFlatVertexNormals:function(){var t,e,i;for(this.computeFaceNormals(),t=0,e=this.faces.length;t<e;t++){i=this.faces[t];var n=i.vertexNormals;3===n.length?(n[0].copy(i.normal),n[1].copy(i.normal),n[2].copy(i.normal)):(n[0]=i.normal.clone(),n[1]=i.normal.clone(),n[2]=i.normal.clone())}this.faces.length>0&&(this.normalsNeedUpdate=!0)},computeMorphNormals:function(){var t,e,i,n,r;for(i=0,n=this.faces.length;i<n;i++)for(r=this.faces[i],r.__originalFaceNormal?r.__originalFaceNormal.copy(r.normal):r.__originalFaceNormal=r.normal.clone(),r.__originalVertexNormals||(r.__originalVertexNormals=[]),t=0,e=r.vertexNormals.length;t<e;t++)r.__originalVertexNormals[t]?r.__originalVertexNormals[t].copy(r.vertexNormals[t]):r.__originalVertexNormals[t]=r.vertexNormals[t].clone();var a=new St;for(a.faces=this.faces,t=0,e=this.morphTargets.length;t<e;t++){if(!this.morphNormals[t]){this.morphNormals[t]={},this.morphNormals[t].faceNormals=[],this.morphNormals[t].vertexNormals=[];var o,s,h=this.morphNormals[t].faceNormals,l=this.morphNormals[t].vertexNormals;for(i=0,n=this.faces.length;i<n;i++)o=new c,s={a:new c,b:new c,c:new c},h.push(o),l.push(s)}var u=this.morphNormals[t];a.vertices=this.morphTargets[t].vertices,a.computeFaceNormals(),a.computeVertexNormals();var o,s;for(i=0,n=this.faces.length;i<n;i++)r=this.faces[i],o=u.faceNormals[i],s=u.vertexNormals[i],o.copy(r.normal),s.a.copy(r.vertexNormals[0]),s.b.copy(r.vertexNormals[1]),s.c.copy(r.vertexNormals[2])}for(i=0,n=this.faces.length;i<n;i++)r=this.faces[i],r.normal=r.__originalFaceNormal,r.vertexNormals=r.__originalVertexNormals},computeLineDistances:function(){for(var t=0,e=this.vertices,i=0,n=e.length;i<n;i++)i>0&&(t+=e[i].distanceTo(e[i-1])),this.lineDistances[i]=t},computeBoundingBox:function(){null===this.boundingBox&&(this.boundingBox=new $),this.boundingBox.setFromPoints(this.vertices)},computeBoundingSphere:function(){null===this.boundingSphere&&(this.boundingSphere=new tt),this.boundingSphere.setFromPoints(this.vertices)},merge:function(t,e,i){if(!1===(t&&t.isGeometry))return void console.error("THREE.Geometry.merge(): geometry not an instance of THREE.Geometry.",t);var n,r=this.vertices.length,a=this.vertices,o=t.vertices,s=this.faces,c=t.faces,h=this.faceVertexUvs[0],l=t.faceVertexUvs[0],u=this.colors,p=t.colors;void 0===i&&(i=0),void 0!==e&&(n=(new et).getNormalMatrix(e));for(var d=0,f=o.length;d<f;d++){var m=o[d],v=m.clone();void 0!==e&&v.applyMatrix4(e),a.push(v)}for(var d=0,f=p.length;d<f;d++)u.push(p[d].clone());for(d=0,f=c.length;d<f;d++){var g,y,x,b=c[d],_=b.vertexNormals,w=b.vertexColors;g=new ut(b.a+r,b.b+r,b.c+r),g.normal.copy(b.normal),void 0!==n&&g.normal.applyMatrix3(n).normalize();for(var M=0,E=_.length;M<E;M++)y=_[M].clone(),void 0!==n&&y.applyMatrix3(n).normalize(),g.vertexNormals.push(y);g.color.copy(b.color);for(var M=0,E=w.length;M<E;M++)x=w[M],g.vertexColors.push(x.clone());g.materialIndex=b.materialIndex+i,s.push(g)}for(d=0,f=l.length;d<f;d++){var T=l[d],S=[];if(void 0!==T){for(var M=0,E=T.length;M<E;M++)S.push(T[M].clone());h.push(S)}}},mergeMesh:function(t){if(!1===(t&&t.isMesh))return void console.error("THREE.Geometry.mergeMesh(): mesh not an instance of THREE.Mesh.",t);t.matrixAutoUpdate&&t.updateMatrix(),this.merge(t.geometry,t.matrix)},mergeVertices:function(){var t,e,i,n,r,a,o,s,c={},h=[],l=[],u=Math.pow(10,4);for(i=0,n=this.vertices.length;i<n;i++)t=this.vertices[i],e=Math.round(t.x*u)+"_"+Math.round(t.y*u)+"_"+Math.round(t.z*u),void 0===c[e]?(c[e]=i,h.push(this.vertices[i]),l[i]=h.length-1):l[i]=l[c[e]];var p=[];for(i=0,n=this.faces.length;i<n;i++){r=this.faces[i],r.a=l[r.a],r.b=l[r.b],r.c=l[r.c],a=[r.a,r.b,r.c];for(var d=0;d<3;d++)if(a[d]===a[(d+1)%3]){p.push(i);break}}for(i=p.length-1;i>=0;i--){var f=p[i];for(this.faces.splice(f,1),o=0,s=this.faceVertexUvs.length;o<s;o++)this.faceVertexUvs[o].splice(f,1)}var m=this.vertices.length-h.length;return this.vertices=h,m},sortFacesByMaterialIndex:function(){function t(t,e){return t.materialIndex-e.materialIndex}for(var e=this.faces,i=e.length,n=0;n<i;n++)e[n]._id=n;e.sort(t);var r,a,o=this.faceVertexUvs[0],s=this.faceVertexUvs[1];o&&o.length===i&&(r=[]),s&&s.length===i&&(a=[]);for(var n=0;n<i;n++){var c=e[n]._id;r&&r.push(o[c]),a&&a.push(s[c])}r&&(this.faceVertexUvs[0]=r),a&&(this.faceVertexUvs[1]=a)},toJSON:function(){function t(t,e,i){return i?t|1<<e:t&~(1<<e)}function e(t){var e=t.x.toString()+t.y.toString()+t.z.toString();return void 0!==p[e]?p[e]:(p[e]=u.length/3,u.push(t.x,t.y,t.z),p[e])}function i(t){var e=t.r.toString()+t.g.toString()+t.b.toString();return void 0!==f[e]?f[e]:(f[e]=d.length,d.push(t.getHex()),f[e])}function n(t){var e=t.x.toString()+t.y.toString();return void 0!==v[e]?v[e]:(v[e]=m.length/2,m.push(t.x,t.y),v[e])}var r={metadata:{version:4.5,type:"Geometry",generator:"Geometry.toJSON"}};if(r.uuid=this.uuid,r.type=this.type,""!==this.name&&(r.name=this.name),void 0!==this.parameters){var a=this.parameters;for(var o in a)void 0!==a[o]&&(r[o]=a[o]);return r}for(var s=[],c=0;c<this.vertices.length;c++){var h=this.vertices[c];s.push(h.x,h.y,h.z)}for(var l=[],u=[],p={},d=[],f={},m=[],v={},c=0;c<this.faces.length;c++){var g=this.faces[c],y=void 0!==this.faceVertexUvs[0][c],x=g.normal.length()>0,b=g.vertexNormals.length>0,_=1!==g.color.r||1!==g.color.g||1!==g.color.b,w=g.vertexColors.length>0,M=0;if(M=t(M,0,0),M=t(M,1,!0),M=t(M,2,!1),M=t(M,3,y),M=t(M,4,x),M=t(M,5,b),M=t(M,6,_),M=t(M,7,w),l.push(M),l.push(g.a,g.b,g.c),l.push(g.materialIndex),y){var E=this.faceVertexUvs[0][c];l.push(n(E[0]),n(E[1]),n(E[2]))}if(x&&l.push(e(g.normal)),b){var T=g.vertexNormals;l.push(e(T[0]),e(T[1]),e(T[2]))}if(_&&l.push(i(g.color)),w){var S=g.vertexColors;l.push(i(S[0]),i(S[1]),i(S[2]))}}return r.data={},r.data.vertices=s,r.data.normals=u,d.length>0&&(r.data.colors=d),m.length>0&&(r.data.uvs=[m]),r.data.faces=l,r},clone:function(){return(new St).copy(this)},copy:function(t){var e,i,n,r,a,o;this.vertices=[],this.colors=[],this.faces=[],this.faceVertexUvs=[[]],this.morphTargets=[],this.morphNormals=[],this.skinWeights=[],this.skinIndices=[],this.lineDistances=[],this.boundingBox=null,this.boundingSphere=null,this.name=t.name;var s=t.vertices;for(e=0,i=s.length;e<i;e++)this.vertices.push(s[e].clone());var c=t.colors;for(e=0,i=c.length;e<i;e++)this.colors.push(c[e].clone());var h=t.faces;for(e=0,i=h.length;e<i;e++)this.faces.push(h[e].clone());for(e=0,i=t.faceVertexUvs.length;e<i;e++){var l=t.faceVertexUvs[e];for(void 0===this.faceVertexUvs[e]&&(this.faceVertexUvs[e]=[]),n=0,r=l.length;n<r;n++){var u=l[n],p=[];for(a=0,o=u.length;a<o;a++){var d=u[a];p.push(d.clone())}this.faceVertexUvs[e].push(p)}}var f=t.morphTargets;for(e=0,i=f.length;e<i;e++){var m={};if(m.name=f[e].name,void 0!==f[e].vertices)for(m.vertices=[],n=0,r=f[e].vertices.length;n<r;n++)m.vertices.push(f[e].vertices[n].clone());if(void 0!==f[e].normals)for(m.normals=[],n=0,r=f[e].normals.length;n<r;n++)m.normals.push(f[e].normals[n].clone());this.morphTargets.push(m)}var v=t.morphNormals;for(e=0,i=v.length;e<i;e++){var g={};if(void 0!==v[e].vertexNormals)for(g.vertexNormals=[],n=0,r=v[e].vertexNormals.length;n<r;n++){var y=v[e].vertexNormals[n],x={};x.a=y.a.clone(),x.b=y.b.clone(),x.c=y.c.clone(),g.vertexNormals.push(x)}if(void 0!==v[e].faceNormals)for(g.faceNormals=[],n=0,r=v[e].faceNormals.length;n<r;n++)g.faceNormals.push(v[e].faceNormals[n].clone());this.morphNormals.push(g)}var b=t.skinWeights;for(e=0,i=b.length;e<i;e++)this.skinWeights.push(b[e].clone());var _=t.skinIndices;for(e=0,i=_.length;e<i;e++)this.skinIndices.push(_[e].clone());var w=t.lineDistances;for(e=0,i=w.length;e<i;e++)this.lineDistances.push(w[e]);var M=t.boundingBox;null!==M&&(this.boundingBox=M.clone());var E=t.boundingSphere;return null!==E&&(this.boundingSphere=E.clone()),this.elementsNeedUpdate=t.elementsNeedUpdate,this.verticesNeedUpdate=t.verticesNeedUpdate,this.uvsNeedUpdate=t.uvsNeedUpdate,this.normalsNeedUpdate=t.normalsNeedUpdate,this.colorsNeedUpdate=t.colorsNeedUpdate,this.lineDistancesNeedUpdate=t.lineDistancesNeedUpdate,this.groupsNeedUpdate=t.groupsNeedUpdate,this},dispose:function(){this.dispatchEvent({type:"dispose"})}}),At.MaxIndex=65535,Object.assign(At.prototype,e.prototype,{isBufferGeometry:!0,getIndex:function(){return this.index},setIndex:function(t){Array.isArray(t)?this.index=new(Et(t)>65535?bt:yt)(t,1):this.index=t},addAttribute:function(t,e){return!1===(e&&e.isBufferAttribute)&&!1===(e&&e.isInterleavedBufferAttribute)?(console.warn("THREE.BufferGeometry: .addAttribute() now expects ( name, attribute )."),void this.addAttribute(t,new dt(arguments[1],arguments[2]))):"index"===t?(console.warn("THREE.BufferGeometry.addAttribute: Use .setIndex() for index attribute."),void this.setIndex(e)):(this.attributes[t]=e,this)},getAttribute:function(t){return this.attributes[t]},removeAttribute:function(t){return delete this.attributes[t],this},addGroup:function(t,e,i){this.groups.push({start:t,count:e,materialIndex:void 0!==i?i:0})},clearGroups:function(){this.groups=[]},setDrawRange:function(t,e){this.drawRange.start=t,this.drawRange.count=e},applyMatrix:function(t){var e=this.attributes.position;void 0!==e&&(t.applyToBufferAttribute(e),e.needsUpdate=!0);var i=this.attributes.normal;if(void 0!==i){(new et).getNormalMatrix(t).applyToBufferAttribute(i),i.needsUpdate=!0}return null!==this.boundingBox&&this.computeBoundingBox(),null!==this.boundingSphere&&this.computeBoundingSphere(),this},rotateX:function(){var t=new h;return function(e){return t.makeRotationX(e),this.applyMatrix(t),this}}(),rotateY:function(){var t=new h;return function(e){return t.makeRotationY(e),this.applyMatrix(t),this}}(),rotateZ:function(){var t=new h;return function(e){return t.makeRotationZ(e),this.applyMatrix(t),this}}(),translate:function(){var t=new h;return function(e,i,n){return t.makeTranslation(e,i,n),this.applyMatrix(t),this}}(),scale:function(){var t=new h;return function(e,i,n){return t.makeScale(e,i,n),this.applyMatrix(t),this}}(),lookAt:function(){var t=new ct;return function(e){t.lookAt(e),t.updateMatrix(),this.applyMatrix(t.matrix)}}(),center:function(){this.computeBoundingBox();var t=this.boundingBox.getCenter().negate();return this.translate(t.x,t.y,t.z),t},setFromObject:function(t){var e=t.geometry;if(t.isPoints||t.isLine){var i=new _t(3*e.vertices.length,3),n=new _t(3*e.colors.length,3);if(this.addAttribute("position",i.copyVector3sArray(e.vertices)),this.addAttribute("color",n.copyColorsArray(e.colors)),e.lineDistances&&e.lineDistances.length===e.vertices.length){var r=new _t(e.lineDistances.length,1);this.addAttribute("lineDistance",r.copyArray(e.lineDistances))}null!==e.boundingSphere&&(this.boundingSphere=e.boundingSphere.clone()),null!==e.boundingBox&&(this.boundingBox=e.boundingBox.clone())}else t.isMesh&&e&&e.isGeometry&&this.fromGeometry(e);return this},updateFromObject:function(t){var e=t.geometry;if(t.isMesh){var i=e.__directGeometry;if(!0===e.elementsNeedUpdate&&(i=void 0,e.elementsNeedUpdate=!1),
void 0===i)return this.fromGeometry(e);i.verticesNeedUpdate=e.verticesNeedUpdate,i.normalsNeedUpdate=e.normalsNeedUpdate,i.colorsNeedUpdate=e.colorsNeedUpdate,i.uvsNeedUpdate=e.uvsNeedUpdate,i.groupsNeedUpdate=e.groupsNeedUpdate,e.verticesNeedUpdate=!1,e.normalsNeedUpdate=!1,e.colorsNeedUpdate=!1,e.uvsNeedUpdate=!1,e.groupsNeedUpdate=!1,e=i}var n;return!0===e.verticesNeedUpdate&&(n=this.attributes.position,void 0!==n&&(n.copyVector3sArray(e.vertices),n.needsUpdate=!0),e.verticesNeedUpdate=!1),!0===e.normalsNeedUpdate&&(n=this.attributes.normal,void 0!==n&&(n.copyVector3sArray(e.normals),n.needsUpdate=!0),e.normalsNeedUpdate=!1),!0===e.colorsNeedUpdate&&(n=this.attributes.color,void 0!==n&&(n.copyColorsArray(e.colors),n.needsUpdate=!0),e.colorsNeedUpdate=!1),e.uvsNeedUpdate&&(n=this.attributes.uv,void 0!==n&&(n.copyVector2sArray(e.uvs),n.needsUpdate=!0),e.uvsNeedUpdate=!1),e.lineDistancesNeedUpdate&&(n=this.attributes.lineDistance,void 0!==n&&(n.copyArray(e.lineDistances),n.needsUpdate=!0),e.lineDistancesNeedUpdate=!1),e.groupsNeedUpdate&&(e.computeGroups(t.geometry),this.groups=e.groups,e.groupsNeedUpdate=!1),this},fromGeometry:function(t){return t.__directGeometry=(new Mt).fromGeometry(t),this.fromDirectGeometry(t.__directGeometry)},fromDirectGeometry:function(t){var e=new Float32Array(3*t.vertices.length);if(this.addAttribute("position",new dt(e,3).copyVector3sArray(t.vertices)),t.normals.length>0){var i=new Float32Array(3*t.normals.length);this.addAttribute("normal",new dt(i,3).copyVector3sArray(t.normals))}if(t.colors.length>0){var n=new Float32Array(3*t.colors.length);this.addAttribute("color",new dt(n,3).copyColorsArray(t.colors))}if(t.uvs.length>0){var r=new Float32Array(2*t.uvs.length);this.addAttribute("uv",new dt(r,2).copyVector2sArray(t.uvs))}if(t.uvs2.length>0){var a=new Float32Array(2*t.uvs2.length);this.addAttribute("uv2",new dt(a,2).copyVector2sArray(t.uvs2))}if(t.indices.length>0){var o=Et(t.indices)>65535?Uint32Array:Uint16Array,s=new o(3*t.indices.length);this.setIndex(new dt(s,1).copyIndicesArray(t.indices))}this.groups=t.groups;for(var c in t.morphTargets){for(var h=[],l=t.morphTargets[c],u=0,p=l.length;u<p;u++){var d=l[u],f=new _t(3*d.length,3);h.push(f.copyVector3sArray(d))}this.morphAttributes[c]=h}if(t.skinIndices.length>0){var m=new _t(4*t.skinIndices.length,4);this.addAttribute("skinIndex",m.copyVector4sArray(t.skinIndices))}if(t.skinWeights.length>0){var v=new _t(4*t.skinWeights.length,4);this.addAttribute("skinWeight",v.copyVector4sArray(t.skinWeights))}return null!==t.boundingSphere&&(this.boundingSphere=t.boundingSphere.clone()),null!==t.boundingBox&&(this.boundingBox=t.boundingBox.clone()),this},computeBoundingBox:function(){null===this.boundingBox&&(this.boundingBox=new $);var t=this.attributes.position;void 0!==t?this.boundingBox.setFromBufferAttribute(t):this.boundingBox.makeEmpty(),(isNaN(this.boundingBox.min.x)||isNaN(this.boundingBox.min.y)||isNaN(this.boundingBox.min.z))&&console.error('THREE.BufferGeometry.computeBoundingBox: Computed min/max have NaN values. The "position" attribute is likely to have NaN values.',this)},computeBoundingSphere:function(){var t=new $,e=new c;return function(){null===this.boundingSphere&&(this.boundingSphere=new tt);var i=this.attributes.position;if(i){var n=this.boundingSphere.center;t.setFromBufferAttribute(i),t.getCenter(n);for(var r=0,a=0,o=i.count;a<o;a++)e.x=i.getX(a),e.y=i.getY(a),e.z=i.getZ(a),r=Math.max(r,n.distanceToSquared(e));this.boundingSphere.radius=Math.sqrt(r),isNaN(this.boundingSphere.radius)&&console.error('THREE.BufferGeometry.computeBoundingSphere(): Computed radius is NaN. The "position" attribute is likely to have NaN values.',this)}}}(),computeFaceNormals:function(){},computeVertexNormals:function(){var t=this.index,e=this.attributes,i=this.groups;if(e.position){var n=e.position.array;if(void 0===e.normal)this.addAttribute("normal",new dt(new Float32Array(n.length),3));else for(var r=e.normal.array,a=0,o=r.length;a<o;a++)r[a]=0;var s,h,l,u=e.normal.array,p=new c,d=new c,f=new c,m=new c,v=new c;if(t){var g=t.array;0===i.length&&this.addGroup(0,g.length);for(var y=0,x=i.length;y<x;++y)for(var b=i[y],_=b.start,w=b.count,a=_,o=_+w;a<o;a+=3)s=3*g[a+0],h=3*g[a+1],l=3*g[a+2],p.fromArray(n,s),d.fromArray(n,h),f.fromArray(n,l),m.subVectors(f,d),v.subVectors(p,d),m.cross(v),u[s]+=m.x,u[s+1]+=m.y,u[s+2]+=m.z,u[h]+=m.x,u[h+1]+=m.y,u[h+2]+=m.z,u[l]+=m.x,u[l+1]+=m.y,u[l+2]+=m.z}else for(var a=0,o=n.length;a<o;a+=9)p.fromArray(n,a),d.fromArray(n,a+3),f.fromArray(n,a+6),m.subVectors(f,d),v.subVectors(p,d),m.cross(v),u[a]=m.x,u[a+1]=m.y,u[a+2]=m.z,u[a+3]=m.x,u[a+4]=m.y,u[a+5]=m.z,u[a+6]=m.x,u[a+7]=m.y,u[a+8]=m.z;this.normalizeNormals(),e.normal.needsUpdate=!0}},merge:function(t,e){if(!1===(t&&t.isBufferGeometry))return void console.error("THREE.BufferGeometry.merge(): geometry not an instance of THREE.BufferGeometry.",t);void 0===e&&(e=0);var i=this.attributes;for(var n in i)if(void 0!==t.attributes[n])for(var r=i[n],a=r.array,o=t.attributes[n],s=o.array,c=o.itemSize,h=0,l=c*e;h<s.length;h++,l++)a[l]=s[h];return this},normalizeNormals:function(){for(var t,e,i,n,r=this.attributes.normal,a=0,o=r.count;a<o;a++)t=r.getX(a),e=r.getY(a),i=r.getZ(a),n=1/Math.sqrt(t*t+e*e+i*i),r.setXYZ(a,t*n,e*n,i*n)},toNonIndexed:function(){if(null===this.index)return console.warn("THREE.BufferGeometry.toNonIndexed(): Geometry is already non-indexed."),this;var t=new At,e=this.index.array,i=this.attributes;for(var n in i){for(var r=i[n],a=r.array,o=r.itemSize,s=new a.constructor(e.length*o),c=0,h=0,l=0,u=e.length;l<u;l++){c=e[l]*o;for(var p=0;p<o;p++)s[h++]=a[c++]}t.addAttribute(n,new dt(s,o))}return t},toJSON:function(){var t={metadata:{version:4.5,type:"BufferGeometry",generator:"BufferGeometry.toJSON"}};if(t.uuid=this.uuid,t.type=this.type,""!==this.name&&(t.name=this.name),void 0!==this.parameters){var e=this.parameters;for(var i in e)void 0!==e[i]&&(t[i]=e[i]);return t}t.data={attributes:{}};var n=this.index;if(null!==n){var r=Array.prototype.slice.call(n.array);t.data.index={type:n.array.constructor.name,array:r}}var a=this.attributes;for(var i in a){var o=a[i],r=Array.prototype.slice.call(o.array);t.data.attributes[i]={itemSize:o.itemSize,type:o.array.constructor.name,array:r,normalized:o.normalized}}var s=this.groups;s.length>0&&(t.data.groups=JSON.parse(JSON.stringify(s)));var c=this.boundingSphere;return null!==c&&(t.data.boundingSphere={center:c.center.toArray(),radius:c.radius}),t},clone:function(){return(new At).copy(this)},copy:function(t){var e,i,n;this.index=null,this.attributes={},this.morphAttributes={},this.groups=[],this.boundingBox=null,this.boundingSphere=null,this.name=t.name;var r=t.index;null!==r&&this.setIndex(r.clone());var a=t.attributes;for(e in a){var o=a[e];this.addAttribute(e,o.clone())}var s=t.morphAttributes;for(e in s){var c=[],h=s[e];for(i=0,n=h.length;i<n;i++)c.push(h[i].clone());this.morphAttributes[e]=c}var l=t.groups;for(i=0,n=l.length;i<n;i++){var u=l[i];this.addGroup(u.start,u.count,u.materialIndex)}var p=t.boundingBox;null!==p&&(this.boundingBox=p.clone());var d=t.boundingSphere;return null!==d&&(this.boundingSphere=d.clone()),this.drawRange.start=t.drawRange.start,this.drawRange.count=t.drawRange.count,this},dispose:function(){this.dispatchEvent({type:"dispose"})}}),Lt.prototype=Object.assign(Object.create(ct.prototype),{constructor:Lt,isMesh:!0,setDrawMode:function(t){this.drawMode=t},copy:function(t){return ct.prototype.copy.call(this,t),this.drawMode=t.drawMode,this},updateMorphTargets:function(){var t=this.geometry.morphTargets;if(void 0!==t&&t.length>0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(var e=0,i=t.length;e<i;e++)this.morphTargetInfluences.push(0),this.morphTargetDictionary[t[e].name]=e}},raycast:function(){function t(t,e,i,n,r,a,o){return lt.barycoordFromPoint(t,e,i,n,y),r.multiplyScalar(y.x),a.multiplyScalar(y.y),o.multiplyScalar(y.z),r.add(a).add(o),r.clone()}function e(t,e,i,n,r,a,o){var s=t.material;if(null===(s.side===pa?i.intersectTriangle(a,r,n,!0,o):i.intersectTriangle(n,r,a,s.side!==da,o)))return null;b.copy(o),b.applyMatrix4(t.matrixWorld);var c=e.ray.origin.distanceTo(b);return c<e.near||c>e.far?null:{distance:c,point:b.clone(),object:t}}function n(i,n,r,a,o,c,h,p){s.fromBufferAttribute(a,c),l.fromBufferAttribute(a,h),u.fromBufferAttribute(a,p);var d=e(i,n,r,s,l,u,x);return d&&(o&&(m.fromBufferAttribute(o,c),v.fromBufferAttribute(o,h),g.fromBufferAttribute(o,p),d.uv=t(x,s,l,u,m,v,g)),d.face=new ut(c,h,p,lt.normal(s,l,u)),d.faceIndex=c),d}var r=new h,a=new at,o=new tt,s=new c,l=new c,u=new c,p=new c,d=new c,f=new c,m=new i,v=new i,g=new i,y=new c,x=new c,b=new c;return function(i,c){var h=this.geometry,y=this.material,b=this.matrixWorld;if(void 0!==y&&(null===h.boundingSphere&&h.computeBoundingSphere(),o.copy(h.boundingSphere),o.applyMatrix4(b),!1!==i.ray.intersectsSphere(o)&&(r.getInverse(b),a.copy(i.ray).applyMatrix4(r),null===h.boundingBox||!1!==a.intersectsBox(h.boundingBox)))){var _;if(h.isBufferGeometry){var w,M,E,T,S,A=h.index,L=h.attributes.position,R=h.attributes.uv;if(null!==A)for(T=0,S=A.count;T<S;T+=3)w=A.getX(T),M=A.getX(T+1),E=A.getX(T+2),(_=n(this,i,a,L,R,w,M,E))&&(_.faceIndex=Math.floor(T/3),c.push(_));else for(T=0,S=L.count;T<S;T+=3)w=T,M=T+1,E=T+2,(_=n(this,i,a,L,R,w,M,E))&&(_.index=w,c.push(_))}else if(h.isGeometry){var P,C,I,U,O=Array.isArray(y),D=h.vertices,N=h.faces,F=h.faceVertexUvs[0];F.length>0&&(U=F);for(var B=0,z=N.length;B<z;B++){var G=N[B],H=O?y[G.materialIndex]:y;if(void 0!==H){if(P=D[G.a],C=D[G.b],I=D[G.c],!0===H.morphTargets){var V=h.morphTargets,k=this.morphTargetInfluences;s.set(0,0,0),l.set(0,0,0),u.set(0,0,0);for(var j=0,W=V.length;j<W;j++){var X=k[j];if(0!==X){var q=V[j].vertices;s.addScaledVector(p.subVectors(q[G.a],P),X),l.addScaledVector(d.subVectors(q[G.b],C),X),u.addScaledVector(f.subVectors(q[G.c],I),X)}}s.add(P),l.add(C),u.add(I),P=s,C=l,I=u}if(_=e(this,i,a,P,C,I,x)){if(U&&U[B]){var Y=U[B];m.copy(Y[0]),v.copy(Y[1]),g.copy(Y[2]),_.uv=t(x,P,C,I,m,v,g)}_.face=G,_.faceIndex=B,c.push(_)}}}}}}}(),clone:function(){return new this.constructor(this.geometry,this.material).copy(this)}}),Rt.prototype=Object.create(St.prototype),Rt.prototype.constructor=Rt,Pt.prototype=Object.create(At.prototype),Pt.prototype.constructor=Pt,Ct.prototype=Object.create(St.prototype),Ct.prototype.constructor=Ct,It.prototype=Object.create(At.prototype),It.prototype.constructor=It,Ut.prototype=Object.assign(Object.create(ct.prototype),{constructor:Ut,isCamera:!0,copy:function(t){return ct.prototype.copy.call(this,t),this.matrixWorldInverse.copy(t.matrixWorldInverse),this.projectionMatrix.copy(t.projectionMatrix),this},getWorldDirection:function(){var t=new s;return function(e){var i=e||new c;return this.getWorldQuaternion(t),i.set(0,0,-1).applyQuaternion(t)}}(),clone:function(){return(new this.constructor).copy(this)}}),Ot.prototype=Object.assign(Object.create(Ut.prototype),{constructor:Ot,isPerspectiveCamera:!0,copy:function(t){return Ut.prototype.copy.call(this,t),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*hs.RAD2DEG*Math.atan(e),this.updateProjectionMatrix()},getFocalLength:function(){var t=Math.tan(.5*hs.DEG2RAD*this.fov);return.5*this.getFilmHeight()/t},getEffectiveFOV:function(){return 2*hs.RAD2DEG*Math.atan(Math.tan(.5*hs.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,i,n,r,a){this.aspect=t/e,this.view={fullWidth:t,fullHeight:e,offsetX:i,offsetY:n,width:r,height:a},this.updateProjectionMatrix()},clearViewOffset:function(){this.view=null,this.updateProjectionMatrix()},updateProjectionMatrix:function(){var t=this.near,e=t*Math.tan(.5*hs.DEG2RAD*this.fov)/this.zoom,i=2*e,n=this.aspect*i,r=-.5*n,a=this.view;if(null!==a){var o=a.fullWidth,s=a.fullHeight;r+=a.offsetX*n/o,e-=a.offsetY*i/s,n*=a.width/o,i*=a.height/s}var c=this.filmOffset;0!==c&&(r+=t*c/this.getFilmWidth()),this.projectionMatrix.makePerspective(r,r+n,e,e-i,t,this.far)},toJSON:function(t){var e=ct.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}}),Dt.prototype=Object.assign(Object.create(Ut.prototype),{constructor:Dt,isOrthographicCamera:!0,copy:function(t){return Ut.prototype.copy.call(this,t),this.left=t.left,this.right=t.right,this.top=t.top,this.bottom=t.bottom,this.near=t.near,this.far=t.far,this.zoom=t.zoom,this.view=null===t.view?null:Object.assign({},t.view),this},setViewOffset:function(t,e,i,n,r,a){this.view={fullWidth:t,fullHeight:e,offsetX:i,offsetY:n,width:r,height:a},this.updateProjectionMatrix()},clearViewOffset:function(){this.view=null,this.updateProjectionMatrix()},updateProjectionMatrix:function(){var t=(this.right-this.left)/(2*this.zoom),e=(this.top-this.bottom)/(2*this.zoom),i=(this.right+this.left)/2,n=(this.top+this.bottom)/2,r=i-t,a=i+t,o=n+e,s=n-e;if(null!==this.view){var c=this.zoom/(this.view.width/this.view.fullWidth),h=this.zoom/(this.view.height/this.view.fullHeight),l=(this.right-this.left)/this.view.width,u=(this.top-this.bottom)/this.view.height;r+=l*(this.view.offsetX/c),a=r+l*(this.view.width/c),o-=u*(this.view.offsetY/h),s=o-u*(this.view.height/h)}this.projectionMatrix.makeOrthographic(r,a,o,s,this.near,this.far)},toJSON:function(t){var e=ct.prototype.toJSON.call(this,t);return e.object.zoom=this.zoom,e.object.left=this.left,e.object.right=this.right,e.object.top=this.top,e.object.bottom=this.bottom,e.object.near=this.near,e.object.far=this.far,null!==this.view&&(e.object.view=Object.assign({},this.view)),e}});var Ss=0;fe.prototype.isFogExp2=!0,fe.prototype.clone=function(){return new fe(this.color.getHex(),this.density)},fe.prototype.toJSON=function(t){return{type:"FogExp2",color:this.color.getHex(),density:this.density}},me.prototype.isFog=!0,me.prototype.clone=function(){return new me(this.color.getHex(),this.near,this.far)},me.prototype.toJSON=function(t){return{type:"Fog",color:this.color.getHex(),near:this.near,far:this.far}},ve.prototype=Object.assign(Object.create(ct.prototype),{constructor:ve,copy:function(t,e){return ct.prototype.copy.call(this,t,e),null!==t.background&&(this.background=t.background.clone()),null!==t.fog&&(this.fog=t.fog.clone()),null!==t.overrideMaterial&&(this.overrideMaterial=t.overrideMaterial.clone()),this.autoUpdate=t.autoUpdate,this.matrixAutoUpdate=t.matrixAutoUpdate,this},toJSON:function(t){var e=ct.prototype.toJSON.call(this,t);return null!==this.background&&(e.object.background=this.background.toJSON(t)),null!==this.fog&&(e.object.fog=this.fog.toJSON()),e}}),ge.prototype=Object.assign(Object.create(ct.prototype),{constructor:ge,isLensFlare:!0,copy:function(t){ct.prototype.copy.call(this,t),this.positionScreen.copy(t.positionScreen),this.customUpdateCallback=t.customUpdateCallback;for(var e=0,i=t.lensFlares.length;e<i;e++)this.lensFlares.push(t.lensFlares[e]);return this},add:function(t,e,i,n,r,a){void 0===e&&(e=-1),void 0===i&&(i=0),void 0===a&&(a=1),void 0===r&&(r=new X(16777215)),void 0===n&&(n=ba),i=Math.min(i,Math.max(0,i)),this.lensFlares.push({texture:t,size:e,distance:i,x:0,y:0,z:0,scale:1,rotation:0,opacity:a,color:r,blending:n})},updateLensFlares:function(){var t,e,i=this.lensFlares.length,n=2*-this.positionScreen.x,r=2*-this.positionScreen.y;for(t=0;t<i;t++)e=this.lensFlares[t],e.x=this.positionScreen.x+n*e.distance,e.y=this.positionScreen.y+r*e.distance,e.wantedRotation=e.x*Math.PI*.25,e.rotation+=.25*(e.wantedRotation-e.rotation)}}),ye.prototype=Object.create(J.prototype),ye.prototype.constructor=ye,ye.prototype.isSpriteMaterial=!0,ye.prototype.copy=function(t){return J.prototype.copy.call(this,t),this.color.copy(t.color),this.map=t.map,this.rotation=t.rotation,this},xe.prototype=Object.assign(Object.create(ct.prototype),{constructor:xe,isSprite:!0,raycast:function(){var t=new c,e=new c,i=new c;return function(n,r){e.setFromMatrixPosition(this.matrixWorld),n.ray.closestPointToPoint(e,t),i.setFromMatrixScale(this.matrixWorld);var a=i.x*i.y/4;if(!(e.distanceToSquared(t)>a)){var o=n.ray.origin.distanceTo(t);o<n.near||o>n.far||r.push({distance:o,point:t.clone(),face:null,object:this})}}}(),clone:function(){return new this.constructor(this.material).copy(this)}}),be.prototype=Object.assign(Object.create(ct.prototype),{constructor:be,copy:function(t){ct.prototype.copy.call(this,t,!1);for(var e=t.levels,i=0,n=e.length;i<n;i++){var r=e[i];this.addLevel(r.object.clone(),r.distance)}return this},addLevel:function(t,e){void 0===e&&(e=0),e=Math.abs(e);for(var i=this.levels,n=0;n<i.length&&!(e<i[n].distance);n++);i.splice(n,0,{distance:e,object:t}),this.add(t)},getObjectForDistance:function(t){for(var e=this.levels,i=1,n=e.length;i<n&&!(t<e[i].distance);i++);return e[i-1].object},raycast:function(){var t=new c;return function(e,i){t.setFromMatrixPosition(this.matrixWorld);var n=e.ray.origin.distanceTo(t);this.getObjectForDistance(n).raycast(e,i)}}(),update:function(){var t=new c,e=new c;return function(i){var n=this.levels;if(n.length>1){t.setFromMatrixPosition(i.matrixWorld),e.setFromMatrixPosition(this.matrixWorld);var r=t.distanceTo(e);n[0].object.visible=!0;for(var a=1,o=n.length;a<o&&r>=n[a].distance;a++)n[a-1].object.visible=!1,n[a].object.visible=!0;for(;a<o;a++)n[a].object.visible=!1}}}(),toJSON:function(t){var e=ct.prototype.toJSON.call(this,t);e.object.levels=[];for(var i=this.levels,n=0,r=i.length;n<r;n++){var a=i[n];e.object.levels.push({object:a.object.uuid,distance:a.distance})}return e}}),Object.assign(_e.prototype,{calculateInverses:function(){this.boneInverses=[];for(var t=0,e=this.bones.length;t<e;t++){var i=new h;this.bones[t]&&i.getInverse(this.bones[t].matrixWorld),this.boneInverses.push(i)}},pose:function(){var t,e,i;for(e=0,i=this.bones.length;e<i;e++)(t=this.bones[e])&&t.matrixWorld.getInverse(this.boneInverses[e]);for(e=0,i=this.bones.length;e<i;e++)(t=this.bones[e])&&(t.parent&&t.parent.isBone?(t.matrix.getInverse(t.parent.matrixWorld),t.matrix.multiply(t.matrixWorld)):t.matrix.copy(t.matrixWorld),t.matrix.decompose(t.position,t.quaternion,t.scale))},update:function(){var t=new h,e=new h;return function(){for(var i=this.bones,n=this.boneInverses,r=this.boneMatrices,a=this.boneTexture,o=0,s=i.length;o<s;o++){var c=i[o]?i[o].matrixWorld:e;t.multiplyMatrices(c,n[o]),t.toArray(r,16*o)}void 0!==a&&(a.needsUpdate=!0)}}(),clone:function(){return new _e(this.bones,this.boneInverses)}}),we.prototype=Object.assign(Object.create(ct.prototype),{constructor:we,isBone:!0}),Me.prototype=Object.assign(Object.create(Lt.prototype),{constructor:Me,isSkinnedMesh:!0,initBones:function(){var t,e,i,n,r=[];if(this.geometry&&void 0!==this.geometry.bones){for(i=0,n=this.geometry.bones.length;i<n;i++)e=this.geometry.bones[i],t=new we,r.push(t),t.name=e.name,t.position.fromArray(e.pos),t.quaternion.fromArray(e.rotq),void 0!==e.scl&&t.scale.fromArray(e.scl);for(i=0,n=this.geometry.bones.length;i<n;i++)e=this.geometry.bones[i],-1!==e.parent&&null!==e.parent&&void 0!==r[e.parent]?r[e.parent].add(r[i]):this.add(r[i])}return this.updateMatrixWorld(!0),r},bind:function(t,e){this.skeleton=t,void 0===e&&(this.updateMatrixWorld(!0),this.skeleton.calculateInverses(),e=this.matrixWorld),this.bindMatrix.copy(e),this.bindMatrixInverse.getInverse(e)},pose:function(){this.skeleton.pose()},normalizeSkinWeights:function(){var t,e;if(this.geometry&&this.geometry.isGeometry)for(e=0;e<this.geometry.skinWeights.length;e++){var i=this.geometry.skinWeights[e];t=1/i.lengthManhattan(),t!==1/0?i.multiplyScalar(t):i.set(1,0,0,0)}else if(this.geometry&&this.geometry.isBufferGeometry){var n=new r,a=this.geometry.attributes.skinWeight;for(e=0;e<a.count;e++)n.x=a.getX(e),n.y=a.getY(e),n.z=a.getZ(e),n.w=a.getW(e),t=1/n.lengthManhattan(),t!==1/0?n.multiplyScalar(t):n.set(1,0,0,0),a.setXYZW(e,n.x,n.y,n.z,n.w)}},updateMatrixWorld:function(t){Lt.prototype.updateMatrixWorld.call(this,t),"attached"===this.bindMode?this.bindMatrixInverse.getInverse(this.matrixWorld):"detached"===this.bindMode?this.bindMatrixInverse.getInverse(this.bindMatrix):console.warn("THREE.SkinnedMesh: Unrecognized bindMode: "+this.bindMode)},clone:function(){return new this.constructor(this.geometry,this.material).copy(this)}}),Ee.prototype=Object.create(J.prototype),Ee.prototype.constructor=Ee,Ee.prototype.isLineBasicMaterial=!0,Ee.prototype.copy=function(t){return J.prototype.copy.call(this,t),this.color.copy(t.color),this.linewidth=t.linewidth,this.linecap=t.linecap,this.linejoin=t.linejoin,this},Te.prototype=Object.assign(Object.create(ct.prototype),{constructor:Te,isLine:!0,raycast:function(){var t=new h,e=new at,i=new tt;return function(n,r){var a=n.linePrecision,o=a*a,s=this.geometry,h=this.matrixWorld;if(null===s.boundingSphere&&s.computeBoundingSphere(),i.copy(s.boundingSphere),i.applyMatrix4(h),!1!==n.ray.intersectsSphere(i)){t.getInverse(h),e.copy(n.ray).applyMatrix4(t);var l=new c,u=new c,p=new c,d=new c,f=this&&this.isLineSegments?2:1;if(s.isBufferGeometry){var m=s.index,v=s.attributes,g=v.position.array;if(null!==m)for(var y=m.array,x=0,b=y.length-1;x<b;x+=f){var _=y[x],w=y[x+1];l.fromArray(g,3*_),u.fromArray(g,3*w);var M=e.distanceSqToSegment(l,u,d,p);if(!(M>o)){d.applyMatrix4(this.matrixWorld);var E=n.ray.origin.distanceTo(d);E<n.near||E>n.far||r.push({distance:E,point:p.clone().applyMatrix4(this.matrixWorld),index:x,face:null,faceIndex:null,object:this})}}else for(var x=0,b=g.length/3-1;x<b;x+=f){l.fromArray(g,3*x),u.fromArray(g,3*x+3);var M=e.distanceSqToSegment(l,u,d,p);if(!(M>o)){d.applyMatrix4(this.matrixWorld);var E=n.ray.origin.distanceTo(d);E<n.near||E>n.far||r.push({distance:E,point:p.clone().applyMatrix4(this.matrixWorld),index:x,face:null,faceIndex:null,object:this})}}}else if(s.isGeometry)for(var T=s.vertices,S=T.length,x=0;x<S-1;x+=f){var M=e.distanceSqToSegment(T[x],T[x+1],d,p);if(!(M>o)){d.applyMatrix4(this.matrixWorld);var E=n.ray.origin.distanceTo(d);E<n.near||E>n.far||r.push({distance:E,point:p.clone().applyMatrix4(this.matrixWorld),index:x,face:null,faceIndex:null,object:this})}}}}}(),clone:function(){return new this.constructor(this.geometry,this.material).copy(this)}}),Se.prototype=Object.assign(Object.create(Te.prototype),{constructor:Se,isLineSegments:!0}),Ae.prototype=Object.assign(Object.create(Te.prototype),{constructor:Ae,isLineLoop:!0}),Le.prototype=Object.create(J.prototype),Le.prototype.constructor=Le,Le.prototype.isPointsMaterial=!0,Le.prototype.copy=function(t){return J.prototype.copy.call(this,t),this.color.copy(t.color),this.map=t.map,this.size=t.size,this.sizeAttenuation=t.sizeAttenuation,this},Re.prototype=Object.assign(Object.create(ct.prototype),{constructor:Re,isPoints:!0,raycast:function(){var t=new h,e=new at,i=new tt;return function(n,r){function a(t,i){var a=e.distanceSqToPoint(t);if(a<p){var s=e.closestPointToPoint(t);s.applyMatrix4(h);var c=n.ray.origin.distanceTo(s);if(c<n.near||c>n.far)return;r.push({distance:c,distanceToRay:Math.sqrt(a),point:s.clone(),index:i,face:null,object:o})}}var o=this,s=this.geometry,h=this.matrixWorld,l=n.params.Points.threshold;if(null===s.boundingSphere&&s.computeBoundingSphere(),i.copy(s.boundingSphere),i.applyMatrix4(h),i.radius+=l,!1!==n.ray.intersectsSphere(i)){t.getInverse(h),e.copy(n.ray).applyMatrix4(t);var u=l/((this.scale.x+this.scale.y+this.scale.z)/3),p=u*u,d=new c;if(s.isBufferGeometry){var f=s.index,m=s.attributes,v=m.position.array;if(null!==f)for(var g=f.array,y=0,x=g.length;y<x;y++){var b=g[y];d.fromArray(v,3*b),a(d,b)}else for(var y=0,_=v.length/3;y<_;y++)d.fromArray(v,3*y),a(d,y)}else for(var w=s.vertices,y=0,_=w.length;y<_;y++)a(w[y],y)}}}(),clone:function(){return new this.constructor(this.geometry,this.material).copy(this)}}),Pe.prototype=Object.assign(Object.create(ct.prototype),{constructor:Pe}),Ce.prototype=Object.create(n.prototype),Ce.prototype.constructor=Ce,Ie.prototype=Object.create(n.prototype),Ie.prototype.constructor=Ie,Ie.prototype.isCompressedTexture=!0,Ue.prototype=Object.create(n.prototype),Ue.prototype.constructor=Ue,Oe.prototype=Object.create(n.prototype),Oe.prototype.constructor=Oe,Oe.prototype.isDepthTexture=!0,De.prototype=Object.create(At.prototype),De.prototype.constructor=De,Ne.prototype=Object.create(St.prototype),Ne.prototype.constructor=Ne,Fe.prototype=Object.create(At.prototype),Fe.prototype.constructor=Fe,Be.prototype=Object.create(St.prototype),Be.prototype.constructor=Be,ze.prototype=Object.create(At.prototype),ze.prototype.constructor=ze,Ge.prototype=Object.create(St.prototype),Ge.prototype.constructor=Ge,He.prototype=Object.create(ze.prototype),He.prototype.constructor=He,Ve.prototype=Object.create(St.prototype),Ve.prototype.constructor=Ve,ke.prototype=Object.create(ze.prototype),ke.prototype.constructor=ke,je.prototype=Object.create(St.prototype),je.prototype.constructor=je,We.prototype=Object.create(ze.prototype),We.prototype.constructor=We,Xe.prototype=Object.create(St.prototype),Xe.prototype.constructor=Xe,qe.prototype=Object.create(ze.prototype),qe.prototype.constructor=qe,Ye.prototype=Object.create(St.prototype),Ye.prototype.constructor=Ye,Ze.prototype=Object.create(At.prototype),Ze.prototype.constructor=Ze,Je.prototype=Object.create(St.prototype),Je.prototype.constructor=Je,Qe.prototype=Object.create(At.prototype),Qe.prototype.constructor=Qe,Ke.prototype=Object.create(St.prototype),Ke.prototype.constructor=Ke,$e.prototype=Object.create(At.prototype),$e.prototype.constructor=$e;var As={area:function(t){for(var e=t.length,i=0,n=e-1,r=0;r<e;n=r++)i+=t[n].x*t[r].y-t[r].x*t[n].y;return.5*i},triangulate:function(){function t(t,e,i,n,r,a){var o,s,c,h,l,u,p,d,f;if(s=t[a[e]].x,c=t[a[e]].y,h=t[a[i]].x,l=t[a[i]].y,u=t[a[n]].x,p=t[a[n]].y,(h-s)*(p-c)-(l-c)*(u-s)<=0)return!1;var m,v,g,y,x,b,_,w,M,E,T,S,A,L,R;for(m=u-h,v=p-l,g=s-u,y=c-p,x=h-s,b=l-c,o=0;o<r;o++)if(d=t[a[o]].x,f=t[a[o]].y,!(d===s&&f===c||d===h&&f===l||d===u&&f===p)&&(_=d-s,w=f-c,M=d-h,E=f-l,T=d-u,S=f-p,R=m*E-v*M,A=x*w-b*_,L=g*S-y*T,R>=-Number.EPSILON&&L>=-Number.EPSILON&&A>=-Number.EPSILON))return!1;return!0}return function(e,i){var n=e.length;if(n<3)return null;var r,a,o,s=[],c=[],h=[];if(As.area(e)>0)for(a=0;a<n;a++)c[a]=a;else for(a=0;a<n;a++)c[a]=n-1-a;var l=n,u=2*l;for(a=l-1;l>2;){if(u--<=0)return console.warn("THREE.ShapeUtils: Unable to triangulate polygon! in triangulate()"),i?h:s;if(r=a,l<=r&&(r=0),a=r+1,l<=a&&(a=0),o=a+1,l<=o&&(o=0),t(e,r,a,o,l,c)){var p,d,f,m,v;for(p=c[r],d=c[a],f=c[o],s.push([e[p],e[d],e[f]]),h.push([c[r],c[a],c[o]]),m=a,v=a+1;v<l;m++,v++)c[m]=c[v];l--,u=2*l}}return i?h:s}}(),triangulateShape:function(t,e){function i(t){var e=t.length;e>2&&t[e-1].equals(t[0])&&t.pop()}function n(t,e,i){return t.x!==e.x?t.x<e.x?t.x<=i.x&&i.x<=e.x:e.x<=i.x&&i.x<=t.x:t.y<e.y?t.y<=i.y&&i.y<=e.y:e.y<=i.y&&i.y<=t.y}function r(t,e,i,r,a){var o=e.x-t.x,s=e.y-t.y,c=r.x-i.x,h=r.y-i.y,l=t.x-i.x,u=t.y-i.y,p=s*c-o*h,d=s*l-o*u;if(Math.abs(p)>Number.EPSILON){var f;if(p>0){if(d<0||d>p)return[];if((f=h*l-c*u)<0||f>p)return[]}else{if(d>0||d<p)return[];if((f=h*l-c*u)>0||f<p)return[]}if(0===f)return!a||0!==d&&d!==p?[t]:[];if(f===p)return!a||0!==d&&d!==p?[e]:[];if(0===d)return[i];if(d===p)return[r];var m=f/p;return[{x:t.x+m*o,y:t.y+m*s}]}if(0!==d||h*l!=c*u)return[];var v=0===o&&0===s,g=0===c&&0===h;if(v&&g)return t.x!==i.x||t.y!==i.y?[]:[t];if(v)return n(i,r,t)?[t]:[];if(g)return n(t,e,i)?[i]:[];var y,x,b,_,w,M,E,T;return 0!==o?(t.x<e.x?(y=t,b=t.x,x=e,_=e.x):(y=e,b=e.x,x=t,_=t.x),i.x<r.x?(w=i,E=i.x,M=r,T=r.x):(w=r,E=r.x,M=i,T=i.x)):(t.y<e.y?(y=t,b=t.y,x=e,_=e.y):(y=e,b=e.y,x=t,_=t.y),i.y<r.y?(w=i,E=i.y,M=r,T=r.y):(w=r,E=r.y,M=i,T=i.y)),b<=E?_<E?[]:_===E?a?[]:[w]:_<=T?[w,x]:[w,M]:b>T?[]:b===T?a?[]:[y]:_<=T?[y,x]:[y,M]}function a(t,e,i,n){var r=e.x-t.x,a=e.y-t.y,o=i.x-t.x,s=i.y-t.y,c=n.x-t.x,h=n.y-t.y,l=r*s-a*o,u=r*h-a*c;if(Math.abs(l)>Number.EPSILON){var p=c*s-h*o;return l>0?u>=0&&p>=0:u>=0||p>=0}return u>0}i(t),e.forEach(i);for(var o,s,c,h,l,u,p={},d=t.concat(),f=0,m=e.length;f<m;f++)Array.prototype.push.apply(d,e[f]);for(o=0,s=d.length;o<s;o++)l=d[o].x+":"+d[o].y,void 0!==p[l]&&console.warn("THREE.ShapeUtils: Duplicate point",l,o),p[l]=o;var v=function(t,e){for(var i,n,o,s,c,h,l,u,p,d,f,m=t.concat(),v=[],g=[],y=0,x=e.length;y<x;y++)v.push(y);for(var b=0,_=2*v.length;v.length>0;){if(--_<0){console.log("Infinite Loop! Holes left:"+v.length+", Probably Hole outside Shape!");break}for(o=b;o<m.length;o++){s=m[o],n=-1;for(var y=0;y<v.length;y++)if(h=v[y],l=s.x+":"+s.y+":"+h,void 0===g[l]){i=e[h];for(var w=0;w<i.length;w++)if(c=i[w],function(t,e){var n=m.length-1,r=t-1;r<0&&(r=n);var o=t+1;o>n&&(o=0);var s=a(m[t],m[r],m[o],i[e]);if(!s)return!1;var c=i.length-1,h=e-1;h<0&&(h=c);var l=e+1;return l>c&&(l=0),!!(s=a(i[e],i[h],i[l],m[t]))}(o,w)&&!function(t,e){var i,n,a;for(i=0;i<m.length;i++)if(n=i+1,n%=m.length,a=r(t,e,m[i],m[n],!0),a.length>0)return!0;return!1}(s,c)&&!function(t,i){var n,a,o,s,c;for(n=0;n<v.length;n++)for(a=e[v[n]],o=0;o<a.length;o++)if(s=o+1,s%=a.length,c=r(t,i,a[o],a[s],!0),c.length>0)return!0;return!1}(s,c)){n=w,v.splice(y,1),u=m.slice(0,o+1),p=m.slice(o),d=i.slice(n),f=i.slice(0,n+1),m=u.concat(d).concat(f).concat(p),b=o;break}if(n>=0)break;g[l]=!0}if(n>=0)break}}return m}(t,e),g=As.triangulate(v,!1);for(o=0,s=g.length;o<s;o++)for(h=g[o],c=0;c<3;c++)l=h[c].x+":"+h[c].y,void 0!==(u=p[l])&&(h[c]=u);return g.concat()},isClockWise:function(t){return As.area(t)<0}};ti.prototype=Object.create(St.prototype),ti.prototype.constructor=ti,ei.prototype=Object.create(At.prototype),ei.prototype.constructor=ei,ei.prototype.getArrays=function(){var t=this.getAttribute("position"),e=t?Array.prototype.slice.call(t.array):[],i=this.getAttribute("uv"),n=i?Array.prototype.slice.call(i.array):[],r=this.index;return{position:e,uv:n,index:r?Array.prototype.slice.call(r.array):[]}},ei.prototype.addShapeList=function(t,e){var i=t.length;e.arrays=this.getArrays();for(var n=0;n<i;n++){var r=t[n];this.addShape(r,e)}this.setIndex(e.arrays.index),this.addAttribute("position",new _t(e.arrays.position,3)),this.addAttribute("uv",new _t(e.arrays.uv,2))},ei.prototype.addShape=function(t,e){function n(t,e,i){return e||console.error("THREE.ExtrudeGeometry: vec does not exist"),e.clone().multiplyScalar(i).add(t)}function r(t,e,n){var r,a,o=1,s=t.x-e.x,c=t.y-e.y,h=n.x-t.x,l=n.y-t.y,u=s*s+c*c,p=s*l-c*h;if(Math.abs(p)>Number.EPSILON){var d=Math.sqrt(u),f=Math.sqrt(h*h+l*l),m=e.x-c/d,v=e.y+s/d,g=n.x-l/f,y=n.y+h/f,x=((g-m)*l-(y-v)*h)/(s*l-c*h);r=m+s*x-t.x,a=v+c*x-t.y;var b=r*r+a*a;if(b<=2)return new i(r,a);o=Math.sqrt(b/2)}else{var _=!1;s>Number.EPSILON?h>Number.EPSILON&&(_=!0):s<-Number.EPSILON?h<-Number.EPSILON&&(_=!0):Math.sign(c)===Math.sign(l)&&(_=!0),_?(r=-c,a=s,o=Math.sqrt(u)):(r=s,a=c,o=Math.sqrt(u/2))}return new i(r/o,a/o)}function a(t,e){var i,n;for(Q=t.length;--Q>=0;){i=Q,n=Q-1,n<0&&(n=t.length-1);var r=0,a=L+2*T;for(r=0;r<a;r++){var o=Y*r,s=Y*(r+1);h(e+i+o,e+n+o,e+n+s,e+i+s,t,r,a,i,n)}}}function o(t,e,i){_.push(t),_.push(e),_.push(i)}function s(t,e,i){l(t),l(e),l(i);var n=y.length/3,r=C.generateTopUV(D,y,n-3,n-2,n-1);u(r[0]),u(r[1]),u(r[2])}function h(t,e,i,n,r,a,o,s,c){l(t),l(e),l(n),l(e),l(i),l(n);var h=y.length/3,p=C.generateSideWallUV(D,y,h-6,h-3,h-2,h-1);u(p[0]),u(p[1]),u(p[3]),u(p[1]),u(p[2]),u(p[3])}function l(t){x.push(y.length/3),y.push(_[3*t+0]),y.push(_[3*t+1]),y.push(_[3*t+2])}function u(t){b.push(t.x),b.push(t.y)}
var p,d,f,m,v,g=e.arrays?e.arrays:this.getArrays(),y=g.position,x=g.index,b=g.uv,_=[],w=void 0!==e.amount?e.amount:100,M=void 0!==e.bevelThickness?e.bevelThickness:6,E=void 0!==e.bevelSize?e.bevelSize:M-2,T=void 0!==e.bevelSegments?e.bevelSegments:3,S=void 0===e.bevelEnabled||e.bevelEnabled,A=void 0!==e.curveSegments?e.curveSegments:12,L=void 0!==e.steps?e.steps:1,R=e.extrudePath,P=!1,C=void 0!==e.UVGenerator?e.UVGenerator:ti.WorldUVGenerator;R&&(p=R.getSpacedPoints(L),P=!0,S=!1,d=void 0!==e.frames?e.frames:R.computeFrenetFrames(L,!1),f=new c,m=new c,v=new c),S||(T=0,M=0,E=0);var I,U,O,D=this,N=t.extractPoints(A),F=N.shape,B=N.holes,z=!As.isClockWise(F);if(z){for(F=F.reverse(),U=0,O=B.length;U<O;U++)I=B[U],As.isClockWise(I)&&(B[U]=I.reverse());z=!1}var G=As.triangulateShape(F,B),H=F;for(U=0,O=B.length;U<O;U++)I=B[U],F=F.concat(I);for(var V,k,j,W,X,q,Y=F.length,Z=G.length,J=[],Q=0,K=H.length,$=K-1,tt=Q+1;Q<K;Q++,$++,tt++)$===K&&($=0),tt===K&&(tt=0),J[Q]=r(H[Q],H[$],H[tt]);var et,it=[],nt=J.concat();for(U=0,O=B.length;U<O;U++){for(I=B[U],et=[],Q=0,K=I.length,$=K-1,tt=Q+1;Q<K;Q++,$++,tt++)$===K&&($=0),tt===K&&(tt=0),et[Q]=r(I[Q],I[$],I[tt]);it.push(et),nt=nt.concat(et)}for(V=0;V<T;V++){for(j=V/T,W=M*Math.cos(j*Math.PI/2),k=E*Math.sin(j*Math.PI/2),Q=0,K=H.length;Q<K;Q++)X=n(H[Q],J[Q],k),o(X.x,X.y,-W);for(U=0,O=B.length;U<O;U++)for(I=B[U],et=it[U],Q=0,K=I.length;Q<K;Q++)X=n(I[Q],et[Q],k),o(X.x,X.y,-W)}for(k=E,Q=0;Q<Y;Q++)X=S?n(F[Q],nt[Q],k):F[Q],P?(m.copy(d.normals[0]).multiplyScalar(X.x),f.copy(d.binormals[0]).multiplyScalar(X.y),v.copy(p[0]).add(m).add(f),o(v.x,v.y,v.z)):o(X.x,X.y,0);var rt;for(rt=1;rt<=L;rt++)for(Q=0;Q<Y;Q++)X=S?n(F[Q],nt[Q],k):F[Q],P?(m.copy(d.normals[rt]).multiplyScalar(X.x),f.copy(d.binormals[rt]).multiplyScalar(X.y),v.copy(p[rt]).add(m).add(f),o(v.x,v.y,v.z)):o(X.x,X.y,w/L*rt);for(V=T-1;V>=0;V--){for(j=V/T,W=M*Math.cos(j*Math.PI/2),k=E*Math.sin(j*Math.PI/2),Q=0,K=H.length;Q<K;Q++)X=n(H[Q],J[Q],k),o(X.x,X.y,w+W);for(U=0,O=B.length;U<O;U++)for(I=B[U],et=it[U],Q=0,K=I.length;Q<K;Q++)X=n(I[Q],et[Q],k),P?o(X.x,X.y+p[L-1].y,p[L-1].x+W):o(X.x,X.y,w+W)}!function(){var t=y.length/3;if(S){var i=0,n=Y*i;for(Q=0;Q<Z;Q++)q=G[Q],s(q[2]+n,q[1]+n,q[0]+n);for(i=L+2*T,n=Y*i,Q=0;Q<Z;Q++)q=G[Q],s(q[0]+n,q[1]+n,q[2]+n)}else{for(Q=0;Q<Z;Q++)q=G[Q],s(q[2],q[1],q[0]);for(Q=0;Q<Z;Q++)q=G[Q],s(q[0]+Y*L,q[1]+Y*L,q[2]+Y*L)}D.addGroup(t,y.length/3-t,void 0!==e.material?e.material:0)}(),function(){var t=y.length/3,i=0;for(a(H,i),i+=H.length,U=0,O=B.length;U<O;U++)I=B[U],a(I,i),i+=I.length;D.addGroup(t,y.length/3-t,void 0!==e.extrudeMaterial?e.extrudeMaterial:1)}(),e.arrays||(this.setIndex(x),this.addAttribute("position",new _t(y,3)),this.addAttribute("uv",new _t(e.arrays.uv,2)))},ti.WorldUVGenerator={generateTopUV:function(t,e,n,r,a){var o=e[3*n],s=e[3*n+1],c=e[3*r],h=e[3*r+1],l=e[3*a],u=e[3*a+1];return[new i(o,s),new i(c,h),new i(l,u)]},generateSideWallUV:function(t,e,n,r,a,o){var s=e[3*n],c=e[3*n+1],h=e[3*n+2],l=e[3*r],u=e[3*r+1],p=e[3*r+2],d=e[3*a],f=e[3*a+1],m=e[3*a+2],v=e[3*o],g=e[3*o+1],y=e[3*o+2];return Math.abs(c-u)<.01?[new i(s,1-h),new i(l,1-p),new i(d,1-m),new i(v,1-y)]:[new i(c,1-h),new i(u,1-p),new i(f,1-m),new i(g,1-y)]}},ii.prototype=Object.create(St.prototype),ii.prototype.constructor=ii,ni.prototype=Object.create(ei.prototype),ni.prototype.constructor=ni,ri.prototype=Object.create(St.prototype),ri.prototype.constructor=ri,ai.prototype=Object.create(At.prototype),ai.prototype.constructor=ai,oi.prototype=Object.create(St.prototype),oi.prototype.constructor=oi,si.prototype=Object.create(At.prototype),si.prototype.constructor=si,ci.prototype=Object.create(St.prototype),ci.prototype.constructor=ci,hi.prototype=Object.create(At.prototype),hi.prototype.constructor=hi,li.prototype=Object.create(St.prototype),li.prototype.constructor=li,ui.prototype=Object.create(At.prototype),ui.prototype.constructor=ui,pi.prototype=Object.create(At.prototype),pi.prototype.constructor=pi,di.prototype=Object.create(St.prototype),di.prototype.constructor=di,fi.prototype=Object.create(At.prototype),fi.prototype.constructor=fi,mi.prototype=Object.create(di.prototype),mi.prototype.constructor=mi,vi.prototype=Object.create(fi.prototype),vi.prototype.constructor=vi,gi.prototype=Object.create(St.prototype),gi.prototype.constructor=gi,yi.prototype=Object.create(At.prototype),yi.prototype.constructor=yi;var Ls=Object.freeze({WireframeGeometry:De,ParametricGeometry:Ne,ParametricBufferGeometry:Fe,TetrahedronGeometry:Ge,TetrahedronBufferGeometry:He,OctahedronGeometry:Ve,OctahedronBufferGeometry:ke,IcosahedronGeometry:je,IcosahedronBufferGeometry:We,DodecahedronGeometry:Xe,DodecahedronBufferGeometry:qe,PolyhedronGeometry:Be,PolyhedronBufferGeometry:ze,TubeGeometry:Ye,TubeBufferGeometry:Ze,TorusKnotGeometry:Je,TorusKnotBufferGeometry:Qe,TorusGeometry:Ke,TorusBufferGeometry:$e,TextGeometry:ii,TextBufferGeometry:ni,SphereGeometry:ri,SphereBufferGeometry:ai,RingGeometry:oi,RingBufferGeometry:si,PlaneGeometry:Ct,PlaneBufferGeometry:It,LatheGeometry:ci,LatheBufferGeometry:hi,ShapeGeometry:li,ShapeBufferGeometry:ui,ExtrudeGeometry:ti,ExtrudeBufferGeometry:ei,EdgesGeometry:pi,ConeGeometry:mi,ConeBufferGeometry:vi,CylinderGeometry:di,CylinderBufferGeometry:fi,CircleGeometry:gi,CircleBufferGeometry:yi,BoxGeometry:Rt,BoxBufferGeometry:Pt});xi.prototype=Object.create(Q.prototype),xi.prototype.constructor=xi,xi.prototype.isShadowMaterial=!0,bi.prototype=Object.create(Q.prototype),bi.prototype.constructor=bi,bi.prototype.isRawShaderMaterial=!0,_i.prototype=Object.create(J.prototype),_i.prototype.constructor=_i,_i.prototype.isMeshStandardMaterial=!0,_i.prototype.copy=function(t){return J.prototype.copy.call(this,t),this.defines={STANDARD:""},this.color.copy(t.color),this.roughness=t.roughness,this.metalness=t.metalness,this.map=t.map,this.lightMap=t.lightMap,this.lightMapIntensity=t.lightMapIntensity,this.aoMap=t.aoMap,this.aoMapIntensity=t.aoMapIntensity,this.emissive.copy(t.emissive),this.emissiveMap=t.emissiveMap,this.emissiveIntensity=t.emissiveIntensity,this.bumpMap=t.bumpMap,this.bumpScale=t.bumpScale,this.normalMap=t.normalMap,this.normalScale.copy(t.normalScale),this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this.roughnessMap=t.roughnessMap,this.metalnessMap=t.metalnessMap,this.alphaMap=t.alphaMap,this.envMap=t.envMap,this.envMapIntensity=t.envMapIntensity,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.morphNormals=t.morphNormals,this},wi.prototype=Object.create(_i.prototype),wi.prototype.constructor=wi,wi.prototype.isMeshPhysicalMaterial=!0,wi.prototype.copy=function(t){return _i.prototype.copy.call(this,t),this.defines={PHYSICAL:""},this.reflectivity=t.reflectivity,this.clearCoat=t.clearCoat,this.clearCoatRoughness=t.clearCoatRoughness,this},Mi.prototype=Object.create(J.prototype),Mi.prototype.constructor=Mi,Mi.prototype.isMeshPhongMaterial=!0,Mi.prototype.copy=function(t){return J.prototype.copy.call(this,t),this.color.copy(t.color),this.specular.copy(t.specular),this.shininess=t.shininess,this.map=t.map,this.lightMap=t.lightMap,this.lightMapIntensity=t.lightMapIntensity,this.aoMap=t.aoMap,this.aoMapIntensity=t.aoMapIntensity,this.emissive.copy(t.emissive),this.emissiveMap=t.emissiveMap,this.emissiveIntensity=t.emissiveIntensity,this.bumpMap=t.bumpMap,this.bumpScale=t.bumpScale,this.normalMap=t.normalMap,this.normalScale.copy(t.normalScale),this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this.specularMap=t.specularMap,this.alphaMap=t.alphaMap,this.envMap=t.envMap,this.combine=t.combine,this.reflectivity=t.reflectivity,this.refractionRatio=t.refractionRatio,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.wireframeLinecap=t.wireframeLinecap,this.wireframeLinejoin=t.wireframeLinejoin,this.skinning=t.skinning,this.morphTargets=t.morphTargets,this.morphNormals=t.morphNormals,this},Ei.prototype=Object.create(Mi.prototype),Ei.prototype.constructor=Ei,Ei.prototype.isMeshToonMaterial=!0,Ei.prototype.copy=function(t){return Mi.prototype.copy.call(this,t),this.gradientMap=t.gradientMap,this},Ti.prototype=Object.create(J.prototype),Ti.prototype.constructor=Ti,Ti.prototype.isMeshNormalMaterial=!0,Ti.prototype.copy=function(t){return J.prototype.copy.call(this,t),this.bumpMap=t.bumpMap,this.bumpScale=t.bumpScale,this.normalMap=t.normalMap,this.normalScale.copy(t.normalScale),this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.skinning=t.skinning,this.morphTargets=t.morphTargets,this.morphNormals=t.morphNormals,this},Si.prototype=Object.create(J.prototype),Si.prototype.constructor=Si,Si.prototype.isMeshLambertMaterial=!0,Si.prototype.copy=function(t){return J.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.emissive.copy(t.emissive),this.emissiveMap=t.emissiveMap,this.emissiveIntensity=t.emissiveIntensity,this.specularMap=t.specularMap,this.alphaMap=t.alphaMap,this.envMap=t.envMap,this.combine=t.combine,this.reflectivity=t.reflectivity,this.refractionRatio=t.refractionRatio,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.wireframeLinecap=t.wireframeLinecap,this.wireframeLinejoin=t.wireframeLinejoin,this.skinning=t.skinning,this.morphTargets=t.morphTargets,this.morphNormals=t.morphNormals,this},Ai.prototype=Object.create(J.prototype),Ai.prototype.constructor=Ai,Ai.prototype.isLineDashedMaterial=!0,Ai.prototype.copy=function(t){return J.prototype.copy.call(this,t),this.color.copy(t.color),this.linewidth=t.linewidth,this.scale=t.scale,this.dashSize=t.dashSize,this.gapSize=t.gapSize,this};var Rs=Object.freeze({ShadowMaterial:xi,SpriteMaterial:ye,RawShaderMaterial:bi,ShaderMaterial:Q,PointsMaterial:Le,MeshPhysicalMaterial:wi,MeshStandardMaterial:_i,MeshPhongMaterial:Mi,MeshToonMaterial:Ei,MeshNormalMaterial:Ti,MeshLambertMaterial:Si,MeshDepthMaterial:K,MeshBasicMaterial:pt,LineDashedMaterial:Ai,LineBasicMaterial:Ee,Material:J}),Ps={enabled:!1,files:{},add:function(t,e){!1!==this.enabled&&(this.files[t]=e)},get:function(t){if(!1!==this.enabled)return this.files[t]},remove:function(t){delete this.files[t]},clear:function(){this.files={}}},Cs=new Li;Object.assign(Ri.prototype,{load:function(t,e,i,n){void 0===t&&(t=""),void 0!==this.path&&(t=this.path+t);var r=this,a=Ps.get(t);if(void 0!==a)return r.manager.itemStart(t),setTimeout(function(){e&&e(a),r.manager.itemEnd(t)},0),a;var o=/^data:(.*?)(;base64)?,(.*)$/,s=t.match(o);if(s){var c=s[1],h=!!s[2],l=s[3];l=window.decodeURIComponent(l),h&&(l=window.atob(l));try{var u,p=(this.responseType||"").toLowerCase();switch(p){case"arraybuffer":case"blob":u=new ArrayBuffer(l.length);for(var d=new Uint8Array(u),f=0;f<l.length;f++)d[f]=l.charCodeAt(f);"blob"===p&&(u=new Blob([u],{type:c}));break;case"document":var m=new DOMParser;u=m.parseFromString(l,c);break;case"json":u=JSON.parse(l);break;default:u=l}window.setTimeout(function(){e&&e(u),r.manager.itemEnd(t)},0)}catch(e){window.setTimeout(function(){n&&n(e),r.manager.itemEnd(t),r.manager.itemError(t)},0)}}else{var v=new XMLHttpRequest;v.open("GET",t,!0),v.addEventListener("load",function(i){var a=i.target.response;Ps.add(t,a),200===this.status?(e&&e(a),r.manager.itemEnd(t)):0===this.status?(console.warn("THREE.FileLoader: HTTP Status 0 received."),e&&e(a),r.manager.itemEnd(t)):(n&&n(i),r.manager.itemEnd(t),r.manager.itemError(t))},!1),void 0!==i&&v.addEventListener("progress",function(t){i(t)},!1),v.addEventListener("error",function(e){n&&n(e),r.manager.itemEnd(t),r.manager.itemError(t)},!1),void 0!==this.responseType&&(v.responseType=this.responseType),void 0!==this.withCredentials&&(v.withCredentials=this.withCredentials),v.overrideMimeType&&v.overrideMimeType(void 0!==this.mimeType?this.mimeType:"text/plain");for(var g in this.requestHeader)v.setRequestHeader(g,this.requestHeader[g]);v.send(null)}return r.manager.itemStart(t),v},setPath:function(t){return this.path=t,this},setResponseType:function(t){return this.responseType=t,this},setWithCredentials:function(t){return this.withCredentials=t,this},setMimeType:function(t){return this.mimeType=t,this},setRequestHeader:function(t){return this.requestHeader=t,this}}),Object.assign(Pi.prototype,{load:function(t,e,i,n){var r=this,a=[],o=new Ie;o.image=a;var s=new Ri(this.manager);if(s.setPath(this.path),s.setResponseType("arraybuffer"),Array.isArray(t))for(var c=0,h=0,l=t.length;h<l;++h)!function(h){s.load(t[h],function(t){var i=r._parser(t,!0);a[h]={width:i.width,height:i.height,format:i.format,mipmaps:i.mipmaps},6===(c+=1)&&(1===i.mipmapCount&&(o.minFilter=go),o.format=i.format,o.needsUpdate=!0,e&&e(o))},i,n)}(h);else s.load(t,function(t){var i=r._parser(t,!0);if(i.isCubemap)for(var n=i.mipmaps.length/i.mipmapCount,s=0;s<n;s++){a[s]={mipmaps:[]};for(var c=0;c<i.mipmapCount;c++)a[s].mipmaps.push(i.mipmaps[s*i.mipmapCount+c]),a[s].format=i.format,a[s].width=i.width,a[s].height=i.height}else o.image.width=i.width,o.image.height=i.height,o.mipmaps=i.mipmaps;1===i.mipmapCount&&(o.minFilter=go),o.format=i.format,o.needsUpdate=!0,e&&e(o)},i,n);return o},setPath:function(t){return this.path=t,this}}),Object.assign(Ci.prototype,{load:function(t,e,i,n){var r=this,a=new l,o=new Ri(this.manager);return o.setResponseType("arraybuffer"),o.load(t,function(t){var i=r._parser(t);i&&(void 0!==i.image?a.image=i.image:void 0!==i.data&&(a.image.width=i.width,a.image.height=i.height,a.image.data=i.data),a.wrapS=void 0!==i.wrapS?i.wrapS:uo,a.wrapT=void 0!==i.wrapT?i.wrapT:uo,a.magFilter=void 0!==i.magFilter?i.magFilter:go,a.minFilter=void 0!==i.minFilter?i.minFilter:xo,a.anisotropy=void 0!==i.anisotropy?i.anisotropy:1,void 0!==i.format&&(a.format=i.format),void 0!==i.type&&(a.type=i.type),void 0!==i.mipmaps&&(a.mipmaps=i.mipmaps),1===i.mipmapCount&&(a.minFilter=go),a.needsUpdate=!0,e&&e(a,i))},i,n),a}}),Object.assign(Ii.prototype,{load:function(t,e,i,n){void 0===t&&(t=""),void 0!==this.path&&(t=this.path+t);var r=this,a=Ps.get(t);if(void 0!==a)return r.manager.itemStart(t),setTimeout(function(){e&&e(a),r.manager.itemEnd(t)},0),a;var o=document.createElementNS("http://www.w3.org/1999/xhtml","img");return o.addEventListener("load",function(){Ps.add(t,this),e&&e(this),r.manager.itemEnd(t)},!1),o.addEventListener("error",function(e){n&&n(e),r.manager.itemEnd(t),r.manager.itemError(t)},!1),"data:"!==t.substr(0,5)&&void 0!==this.crossOrigin&&(o.crossOrigin=this.crossOrigin),r.manager.itemStart(t),o.src=t,o},setCrossOrigin:function(t){return this.crossOrigin=t,this},setPath:function(t){return this.path=t,this}}),Object.assign(Ui.prototype,{load:function(t,e,i,n){var r=new u,a=new Ii(this.manager);a.setCrossOrigin(this.crossOrigin),a.setPath(this.path);for(var o=0,s=0;s<t.length;++s)!function(i){a.load(t[i],function(t){r.images[i]=t,6==++o&&(r.needsUpdate=!0,e&&e(r))},void 0,n)}(s);return r},setCrossOrigin:function(t){return this.crossOrigin=t,this},setPath:function(t){return this.path=t,this}}),Object.assign(Oi.prototype,{load:function(t,e,i,r){var a=new Ii(this.manager);a.setCrossOrigin(this.crossOrigin),a.setPath(this.path);var o=new n;return o.image=a.load(t,function(){var i=t.search(/\.(jpg|jpeg)$/)>0||0===t.search(/^data\:image\/jpeg/);o.format=i?Uo:Oo,o.needsUpdate=!0,void 0!==e&&e(o)},i,r),o},setCrossOrigin:function(t){return this.crossOrigin=t,this},setPath:function(t){return this.path=t,this}}),Di.prototype=Object.assign(Object.create(ct.prototype),{constructor:Di,isLight:!0,copy:function(t){return ct.prototype.copy.call(this,t),this.color.copy(t.color),this.intensity=t.intensity,this},toJSON:function(t){var e=ct.prototype.toJSON.call(this,t);return e.object.color=this.color.getHex(),e.object.intensity=this.intensity,void 0!==this.groundColor&&(e.object.groundColor=this.groundColor.getHex()),void 0!==this.distance&&(e.object.distance=this.distance),void 0!==this.angle&&(e.object.angle=this.angle),void 0!==this.decay&&(e.object.decay=this.decay),void 0!==this.penumbra&&(e.object.penumbra=this.penumbra),void 0!==this.shadow&&(e.object.shadow=this.shadow.toJSON()),e}}),Ni.prototype=Object.assign(Object.create(Di.prototype),{constructor:Ni,isHemisphereLight:!0,copy:function(t){return Di.prototype.copy.call(this,t),this.groundColor.copy(t.groundColor),this}}),Object.assign(Fi.prototype,{copy:function(t){return this.camera=t.camera.clone(),this.bias=t.bias,this.radius=t.radius,this.mapSize.copy(t.mapSize),this},clone:function(){return(new this.constructor).copy(this)},toJSON:function(){var t={};return 0!==this.bias&&(t.bias=this.bias),1!==this.radius&&(t.radius=this.radius),512===this.mapSize.x&&512===this.mapSize.y||(t.mapSize=this.mapSize.toArray()),t.camera=this.camera.toJSON(!1).object,delete t.camera.matrix,t}}),Bi.prototype=Object.assign(Object.create(Fi.prototype),{constructor:Bi,isSpotLightShadow:!0,update:function(t){var e=this.camera,i=2*hs.RAD2DEG*t.angle,n=this.mapSize.width/this.mapSize.height,r=t.distance||e.far;i===e.fov&&n===e.aspect&&r===e.far||(e.fov=i,e.aspect=n,e.far=r,e.updateProjectionMatrix())}}),zi.prototype=Object.assign(Object.create(Di.prototype),{constructor:zi,isSpotLight:!0,copy:function(t){return Di.prototype.copy.call(this,t),this.distance=t.distance,this.angle=t.angle,this.penumbra=t.penumbra,this.decay=t.decay,this.target=t.target.clone(),this.shadow=t.shadow.clone(),this}}),Gi.prototype=Object.assign(Object.create(Di.prototype),{constructor:Gi,isPointLight:!0,copy:function(t){return Di.prototype.copy.call(this,t),this.distance=t.distance,this.decay=t.decay,this.shadow=t.shadow.clone(),this}}),Hi.prototype=Object.assign(Object.create(Fi.prototype),{constructor:Hi}),Vi.prototype=Object.assign(Object.create(Di.prototype),{constructor:Vi,isDirectionalLight:!0,copy:function(t){return Di.prototype.copy.call(this,t),this.target=t.target.clone(),this.shadow=t.shadow.clone(),this}}),ki.prototype=Object.assign(Object.create(Di.prototype),{constructor:ki,isAmbientLight:!0}),ji.prototype=Object.assign(Object.create(Di.prototype),{constructor:ji,isRectAreaLight:!0,copy:function(t){return Di.prototype.copy.call(this,t),this.width=t.width,this.height=t.height,this},toJSON:function(t){var e=Di.prototype.toJSON.call(this,t);return e.object.width=this.width,e.object.height=this.height,e}});var Is={arraySlice:function(t,e,i){return Is.isTypedArray(t)?new t.constructor(t.subarray(e,void 0!==i?i:t.length)):t.slice(e,i)},convertArray:function(t,e,i){return!t||!i&&t.constructor===e?t:"number"==typeof e.BYTES_PER_ELEMENT?new e(t):Array.prototype.slice.call(t)},isTypedArray:function(t){return ArrayBuffer.isView(t)&&!(t instanceof DataView)},getKeyframeOrder:function(t){function e(e,i){return t[e]-t[i]}for(var i=t.length,n=new Array(i),r=0;r!==i;++r)n[r]=r;return n.sort(e),n},sortedArray:function(t,e,i){for(var n=t.length,r=new t.constructor(n),a=0,o=0;o!==n;++a)for(var s=i[a]*e,c=0;c!==e;++c)r[o++]=t[s+c];return r},flattenJSON:function(t,e,i,n){for(var r=1,a=t[0];void 0!==a&&void 0===a[n];)a=t[r++];if(void 0!==a){var o=a[n];if(void 0!==o)if(Array.isArray(o))do{o=a[n],void 0!==o&&(e.push(a.time),i.push.apply(i,o)),a=t[r++]}while(void 0!==a);else if(void 0!==o.toArray)do{o=a[n],void 0!==o&&(e.push(a.time),o.toArray(i,i.length)),a=t[r++]}while(void 0!==a);else do{o=a[n],void 0!==o&&(e.push(a.time),i.push(o)),a=t[r++]}while(void 0!==a)}}};Object.assign(Wi.prototype,{evaluate:function(t){var e=this.parameterPositions,i=this._cachedIndex,n=e[i],r=e[i-1];t:{e:{var a;i:{n:if(!(t<n)){for(var o=i+2;;){if(void 0===n){if(t<r)break n;return i=e.length,this._cachedIndex=i,this.afterEnd_(i-1,t,r)}if(i===o)break;if(r=n,n=e[++i],t<n)break e}a=e.length;break i}{if(t>=r)break t;var s=e[1];t<s&&(i=2,r=s);for(var o=i-2;;){if(void 0===r)return this._cachedIndex=0,this.beforeStart_(0,t,n);if(i===o)break;if(n=r,r=e[--i-1],t>=r)break e}a=i,i=0}}for(;i<a;){var c=i+a>>>1;t<e[c]?a=c:i=c+1}if(n=e[i],void 0===(r=e[i-1]))return this._cachedIndex=0,this.beforeStart_(0,t,n);if(void 0===n)return i=e.length,this._cachedIndex=i,this.afterEnd_(i-1,r,t)}this._cachedIndex=i,this.intervalChanged_(i,r,n)}return this.interpolate_(i,r,t,n)},settings:null,DefaultSettings_:{},getSettings_:function(){return this.settings||this.DefaultSettings_},copySampleValue_:function(t){for(var e=this.resultBuffer,i=this.sampleValues,n=this.valueSize,r=t*n,a=0;a!==n;++a)e[a]=i[r+a];return e},interpolate_:function(t,e,i,n){throw new Error("call to abstract method")},intervalChanged_:function(t,e,i){}}),Object.assign(Wi.prototype,{beforeStart_:Wi.prototype.copySampleValue_,afterEnd_:Wi.prototype.copySampleValue_}),Xi.prototype=Object.assign(Object.create(Wi.prototype),{constructor:Xi,DefaultSettings_:{endingStart:Jo,endingEnd:Jo},intervalChanged_:function(t,e,i){var n=this.parameterPositions,r=t-2,a=t+1,o=n[r],s=n[a];if(void 0===o)switch(this.getSettings_().endingStart){case 2401:r=t,o=2*e-i;break;case 2402:r=n.length-2,o=e+n[r]-n[r+1];break;default:r=t,o=i}if(void 0===s)switch(this.getSettings_().endingEnd){case 2401:a=t,s=2*i-e;break;case 2402:a=1,s=i+n[1]-n[0];break;default:a=t-1,s=e}var c=.5*(i-e),h=this.valueSize;this._weightPrev=c/(e-o),this._weightNext=c/(s-i),this._offsetPrev=r*h,this._offsetNext=a*h},interpolate_:function(t,e,i,n){for(var r=this.resultBuffer,a=this.sampleValues,o=this.valueSize,s=t*o,c=s-o,h=this._offsetPrev,l=this._offsetNext,u=this._weightPrev,p=this._weightNext,d=(i-e)/(n-e),f=d*d,m=f*d,v=-u*m+2*u*f-u*d,g=(1+u)*m+(-1.5-2*u)*f+(-.5+u)*d+1,y=(-1-p)*m+(1.5+p)*f+.5*d,x=p*m-p*f,b=0;b!==o;++b)r[b]=v*a[h+b]+g*a[c+b]+y*a[s+b]+x*a[l+b];return r}}),qi.prototype=Object.assign(Object.create(Wi.prototype),{constructor:qi,interpolate_:function(t,e,i,n){for(var r=this.resultBuffer,a=this.sampleValues,o=this.valueSize,s=t*o,c=s-o,h=(i-e)/(n-e),l=1-h,u=0;u!==o;++u)r[u]=a[c+u]*l+a[s+u]*h;return r}}),Yi.prototype=Object.assign(Object.create(Wi.prototype),{constructor:Yi,interpolate_:function(t,e,i,n){return this.copySampleValue_(t-1)}});var Us;Us={TimeBufferType:Float32Array,ValueBufferType:Float32Array,DefaultInterpolation:2301,InterpolantFactoryMethodDiscrete:function(t){return new Yi(this.times,this.values,this.getValueSize(),t)},InterpolantFactoryMethodLinear:function(t){return new qi(this.times,this.values,this.getValueSize(),t)},InterpolantFactoryMethodSmooth:function(t){return new Xi(this.times,this.values,this.getValueSize(),t)},setInterpolation:function(t){var e;switch(t){case 2300:e=this.InterpolantFactoryMethodDiscrete;break;case 2301:e=this.InterpolantFactoryMethodLinear;break;case 2302:e=this.InterpolantFactoryMethodSmooth}if(void 0===e){var i="unsupported interpolation for "+this.ValueTypeName+" keyframe track named "+this.name;if(void 0===this.createInterpolant){if(t===this.DefaultInterpolation)throw new Error(i);this.setInterpolation(this.DefaultInterpolation)}return void console.warn(i)}this.createInterpolant=e},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){if(0!==t)for(var e=this.times,i=0,n=e.length;i!==n;++i)e[i]+=t;return this},scale:function(t){if(1!==t)for(var e=this.times,i=0,n=e.length;i!==n;++i)e[i]*=t;return this},trim:function(t,e){for(var i=this.times,n=i.length,r=0,a=n-1;r!==n&&i[r]<t;)++r;for(;-1!==a&&i[a]>e;)--a;if(++a,0!==r||a!==n){r>=a&&(a=Math.max(a,1),r=a-1);var o=this.getValueSize();this.times=Is.arraySlice(i,r,a),this.values=Is.arraySlice(this.values,r*o,a*o)}return this},validate:function(){var t=!0,e=this.getValueSize();e-Math.floor(e)!=0&&(console.error("invalid value size in track",this),t=!1);var i=this.times,n=this.values,r=i.length;0===r&&(console.error("track is empty",this),t=!1);for(var a=null,o=0;o!==r;o++){var s=i[o];if("number"==typeof s&&isNaN(s)){console.error("time is not a valid number",this,o,s),t=!1;break}if(null!==a&&a>s){console.error("out of order keys",this,o,s,a),t=!1;break}a=s}if(void 0!==n&&Is.isTypedArray(n))for(var o=0,c=n.length;o!==c;++o){var h=n[o];if(isNaN(h)){console.error("value is not a valid number",this,o,h),t=!1;break}}return t},optimize:function(){for(var t=this.times,e=this.values,i=this.getValueSize(),n=2302===this.getInterpolation(),r=1,a=t.length-1,o=1;o<a;++o){var s=!1,c=t[o];if(c!==t[o+1]&&(1!==o||c!==c[0]))if(n)s=!0;else for(var h=o*i,l=h-i,u=h+i,p=0;p!==i;++p){var d=e[h+p];if(d!==e[l+p]||d!==e[u+p]){s=!0;break}}if(s){if(o!==r){t[r]=t[o];for(var f=o*i,m=r*i,p=0;p!==i;++p)e[m+p]=e[f+p]}++r}}if(a>0){t[r]=t[a];for(var f=a*i,m=r*i,p=0;p!==i;++p)e[m+p]=e[f+p];++r}return r!==t.length&&(this.times=Is.arraySlice(t,0,r),this.values=Is.arraySlice(e,0,r*i)),this}},Ji.prototype=Object.assign(Object.create(Us),{constructor:Ji,ValueTypeName:"vector"}),Qi.prototype=Object.assign(Object.create(Wi.prototype),{constructor:Qi,interpolate_:function(t,e,i,n){for(var r=this.resultBuffer,a=this.sampleValues,o=this.valueSize,c=t*o,h=(i-e)/(n-e),l=c+o;c!==l;c+=4)s.slerpFlat(r,0,a,c-o,a,c,h);return r}}),Ki.prototype=Object.assign(Object.create(Us),{constructor:Ki,ValueTypeName:"quaternion",DefaultInterpolation:2301,InterpolantFactoryMethodLinear:function(t){return new Qi(this.times,this.values,this.getValueSize(),t)},InterpolantFactoryMethodSmooth:void 0}),$i.prototype=Object.assign(Object.create(Us),{constructor:$i,ValueTypeName:"number"}),tn.prototype=Object.assign(Object.create(Us),{constructor:tn,ValueTypeName:"string",ValueBufferType:Array,DefaultInterpolation:2300,InterpolantFactoryMethodLinear:void 0,InterpolantFactoryMethodSmooth:void 0}),en.prototype=Object.assign(Object.create(Us),{constructor:en,ValueTypeName:"bool",ValueBufferType:Array,DefaultInterpolation:2300,InterpolantFactoryMethodLinear:void 0,InterpolantFactoryMethodSmooth:void 0}),nn.prototype=Object.assign(Object.create(Us),{constructor:nn,ValueTypeName:"color"}),rn.prototype=Us,Us.constructor=rn,Object.assign(rn,{parse:function(t){if(void 0===t.type)throw new Error("track type undefined, can not parse");var e=rn._getTrackTypeForValueTypeName(t.type);if(void 0===t.times){var i=[],n=[];Is.flattenJSON(t.keys,i,n,"value"),t.times=i,t.values=n}return void 0!==e.parse?e.parse(t):new e(t.name,t.times,t.values,t.interpolation)},toJSON:function(t){var e,i=t.constructor;if(void 0!==i.toJSON)e=i.toJSON(t);else{e={name:t.name,times:Is.convertArray(t.times,Array),values:Is.convertArray(t.values,Array)};var n=t.getInterpolation();n!==t.DefaultInterpolation&&(e.interpolation=n)}return e.type=t.ValueTypeName,e},_getTrackTypeForValueTypeName:function(t){switch(t.toLowerCase()){case"scalar":case"double":case"float":case"number":case"integer":return $i;case"vector":case"vector2":case"vector3":case"vector4":return Ji;case"color":return nn;case"quaternion":return Ki;case"bool":case"boolean":return en;case"string":return tn}throw new Error("Unsupported typeName: "+t)}}),Object.assign(an,{parse:function(t){for(var e=[],i=t.tracks,n=1/(t.fps||1),r=0,a=i.length;r!==a;++r)e.push(rn.parse(i[r]).scale(n));return new an(t.name,t.duration,e)},toJSON:function(t){for(var e=[],i=t.tracks,n={name:t.name,duration:t.duration,tracks:e},r=0,a=i.length;r!==a;++r)e.push(rn.toJSON(i[r]));return n},CreateFromMorphTargetSequence:function(t,e,i,n){for(var r=e.length,a=[],o=0;o<r;o++){var s=[],c=[];s.push((o+r-1)%r,o,(o+1)%r),c.push(0,1,0);var h=Is.getKeyframeOrder(s);s=Is.sortedArray(s,1,h),c=Is.sortedArray(c,1,h),n||0!==s[0]||(s.push(r),c.push(c[0])),a.push(new $i(".morphTargetInfluences["+e[o].name+"]",s,c).scale(1/i))}return new an(t,-1,a)},findByName:function(t,e){var i=t;if(!Array.isArray(t)){var n=t;i=n.geometry&&n.geometry.animations||n.animations}for(var r=0;r<i.length;r++)if(i[r].name===e)return i[r];return null},CreateClipsFromMorphTargetSequences:function(t,e,i){for(var n={},r=/^([\w-]*?)([\d]+)$/,a=0,o=t.length;a<o;a++){var s=t[a],c=s.name.match(r);if(c&&c.length>1){var h=c[1],l=n[h];l||(n[h]=l=[]),l.push(s)}}var u=[];for(var h in n)u.push(an.CreateFromMorphTargetSequence(h,n[h],e,i));return u},parseAnimation:function(t,e){if(!t)return console.error(" no animation in JSONLoader data"),null;for(var i=function(t,e,i,n,r){if(0!==i.length){var a=[],o=[];Is.flattenJSON(i,a,o,n),0!==a.length&&r.push(new t(e,a,o))}},n=[],r=t.name||"default",a=t.length||-1,o=t.fps||30,s=t.hierarchy||[],c=0;c<s.length;c++){var h=s[c].keys;if(h&&0!==h.length)if(h[0].morphTargets){for(var l={},u=0;u<h.length;u++)if(h[u].morphTargets)for(var p=0;p<h[u].morphTargets.length;p++)l[h[u].morphTargets[p]]=-1;for(var d in l){for(var f=[],m=[],p=0;p!==h[u].morphTargets.length;++p){var v=h[u];f.push(v.time),m.push(v.morphTarget===d?1:0)}n.push(new $i(".morphTargetInfluence["+d+"]",f,m))}a=l.length*(o||1)}else{var g=".bones["+e[c].name+"]";i(Ji,g+".position",h,"pos",n),i(Ki,g+".quaternion",h,"rot",n),i(Ji,g+".scale",h,"scl",n)}}return 0===n.length?null:new an(r,a,n)}}),Object.assign(an.prototype,{resetDuration:function(){for(var t=this.tracks,e=0,i=0,n=t.length;i!==n;++i){var r=this.tracks[i];e=Math.max(e,r.times[r.times.length-1])}this.duration=e},trim:function(){for(var t=0;t<this.tracks.length;t++)this.tracks[t].trim(0,this.duration);return this},optimize:function(){for(var t=0;t<this.tracks.length;t++)this.tracks[t].optimize();return this}}),Object.assign(on.prototype,{load:function(t,e,i,n){var r=this,a=new Ri(r.manager);a.setResponseType("json"),a.load(t,function(t){e(r.parse(t))},i,n)},setTextures:function(t){this.textures=t},parse:function(t){function e(t){return void 0===n[t]&&console.warn("THREE.MaterialLoader: Undefined texture",t),n[t]}var n=this.textures,r=new Rs[t.type];if(void 0!==t.uuid&&(r.uuid=t.uuid),void 0!==t.name&&(r.name=t.name),void 0!==t.color&&r.color.setHex(t.color),void 0!==t.roughness&&(r.roughness=t.roughness),void 0!==t.metalness&&(r.metalness=t.metalness),void 0!==t.emissive&&r.emissive.setHex(t.emissive),void 0!==t.specular&&r.specular.setHex(t.specular),void 0!==t.shininess&&(r.shininess=t.shininess),void 0!==t.clearCoat&&(r.clearCoat=t.clearCoat),void 0!==t.clearCoatRoughness&&(r.clearCoatRoughness=t.clearCoatRoughness),void 0!==t.uniforms&&(r.uniforms=t.uniforms),void 0!==t.vertexShader&&(r.vertexShader=t.vertexShader),void 0!==t.fragmentShader&&(r.fragmentShader=t.fragmentShader),void 0!==t.vertexColors&&(r.vertexColors=t.vertexColors),void 0!==t.fog&&(r.fog=t.fog),void 0!==t.shading&&(r.shading=t.shading),void 0!==t.blending&&(r.blending=t.blending),void 0!==t.side&&(r.side=t.side),void 0!==t.opacity&&(r.opacity=t.opacity),void 0!==t.transparent&&(r.transparent=t.transparent),void 0!==t.alphaTest&&(r.alphaTest=t.alphaTest),void 0!==t.depthTest&&(r.depthTest=t.depthTest),void 0!==t.depthWrite&&(r.depthWrite=t.depthWrite),void 0!==t.colorWrite&&(r.colorWrite=t.colorWrite),void 0!==t.wireframe&&(r.wireframe=t.wireframe),void 0!==t.wireframeLinewidth&&(r.wireframeLinewidth=t.wireframeLinewidth),void 0!==t.wireframeLinecap&&(r.wireframeLinecap=t.wireframeLinecap),void 0!==t.wireframeLinejoin&&(r.wireframeLinejoin=t.wireframeLinejoin),void 0!==t.skinning&&(r.skinning=t.skinning),void 0!==t.morphTargets&&(r.morphTargets=t.morphTargets),void 0!==t.size&&(r.size=t.size),void 0!==t.sizeAttenuation&&(r.sizeAttenuation=t.sizeAttenuation),void 0!==t.map&&(r.map=e(t.map)),void 0!==t.alphaMap&&(r.alphaMap=e(t.alphaMap),r.transparent=!0),void 0!==t.bumpMap&&(r.bumpMap=e(t.bumpMap)),void 0!==t.bumpScale&&(r.bumpScale=t.bumpScale),void 0!==t.normalMap&&(r.normalMap=e(t.normalMap)),void 0!==t.normalScale){var a=t.normalScale
;!1===Array.isArray(a)&&(a=[a,a]),r.normalScale=(new i).fromArray(a)}return void 0!==t.displacementMap&&(r.displacementMap=e(t.displacementMap)),void 0!==t.displacementScale&&(r.displacementScale=t.displacementScale),void 0!==t.displacementBias&&(r.displacementBias=t.displacementBias),void 0!==t.roughnessMap&&(r.roughnessMap=e(t.roughnessMap)),void 0!==t.metalnessMap&&(r.metalnessMap=e(t.metalnessMap)),void 0!==t.emissiveMap&&(r.emissiveMap=e(t.emissiveMap)),void 0!==t.emissiveIntensity&&(r.emissiveIntensity=t.emissiveIntensity),void 0!==t.specularMap&&(r.specularMap=e(t.specularMap)),void 0!==t.envMap&&(r.envMap=e(t.envMap)),void 0!==t.reflectivity&&(r.reflectivity=t.reflectivity),void 0!==t.lightMap&&(r.lightMap=e(t.lightMap)),void 0!==t.lightMapIntensity&&(r.lightMapIntensity=t.lightMapIntensity),void 0!==t.aoMap&&(r.aoMap=e(t.aoMap)),void 0!==t.aoMapIntensity&&(r.aoMapIntensity=t.aoMapIntensity),void 0!==t.gradientMap&&(r.gradientMap=e(t.gradientMap)),r}}),Object.assign(sn.prototype,{load:function(t,e,i,n){var r=this,a=new Ri(r.manager);a.setResponseType("json"),a.load(t,function(t){e(r.parse(t))},i,n)},parse:function(t){var e=new At,i=t.data.index;if(void 0!==i){var n=new Os[i.type](i.array);e.setIndex(new dt(n,1))}var r=t.data.attributes;for(var a in r){var o=r[a],n=new Os[o.type](o.array);e.addAttribute(a,new dt(n,o.itemSize,o.normalized))}var s=t.data.groups||t.data.drawcalls||t.data.offsets;if(void 0!==s)for(var h=0,l=s.length;h!==l;++h){var u=s[h];e.addGroup(u.start,u.count,u.materialIndex)}var p=t.data.boundingSphere;if(void 0!==p){var d=new c;void 0!==p.center&&d.fromArray(p.center),e.boundingSphere=new tt(d,p.radius)}return e}});var Os={Int8Array:Int8Array,Uint8Array:Uint8Array,Uint8ClampedArray:Uint8ClampedArray,Int16Array:Int16Array,Uint16Array:Uint16Array,Int32Array:Int32Array,Uint32Array:Uint32Array,Float32Array:Float32Array,Float64Array:Float64Array};cn.Handlers={handlers:[],add:function(t,e){this.handlers.push(t,e)},get:function(t){for(var e=this.handlers,i=0,n=e.length;i<n;i+=2){var r=e[i],a=e[i+1];if(r.test(t))return a}return null}},Object.assign(cn.prototype,{crossOrigin:void 0,extractUrlBase:function(t){var e=t.split("/");return 1===e.length?"./":(e.pop(),e.join("/")+"/")},initMaterials:function(t,e,i){for(var n=[],r=0;r<t.length;++r)n[r]=this.createMaterial(t[r],e,i);return n},createMaterial:function(){var t={NoBlending:xa,NormalBlending:ba,AdditiveBlending:_a,SubtractiveBlending:wa,MultiplyBlending:Ma,CustomBlending:Ea},e=new X,i=new Oi,n=new on;return function(r,a,o){function s(t,e,n,r,s){var h,l=a+t,u=cn.Handlers.get(l);null!==u?h=u.load(l):(i.setCrossOrigin(o),h=i.load(l)),void 0!==e&&(h.repeat.fromArray(e),1!==e[0]&&(h.wrapS=lo),1!==e[1]&&(h.wrapT=lo)),void 0!==n&&h.offset.fromArray(n),void 0!==r&&("repeat"===r[0]&&(h.wrapS=lo),"mirror"===r[0]&&(h.wrapS=po),"repeat"===r[1]&&(h.wrapT=lo),"mirror"===r[1]&&(h.wrapT=po)),void 0!==s&&(h.anisotropy=s);var p=hs.generateUUID();return c[p]=h,p}var c={},h={uuid:hs.generateUUID(),type:"MeshLambertMaterial"};for(var l in r){var u=r[l];switch(l){case"DbgColor":case"DbgIndex":case"opticalDensity":case"illumination":break;case"DbgName":h.name=u;break;case"blending":h.blending=t[u];break;case"colorAmbient":case"mapAmbient":console.warn("THREE.Loader.createMaterial:",l,"is no longer supported.");break;case"colorDiffuse":h.color=e.fromArray(u).getHex();break;case"colorSpecular":h.specular=e.fromArray(u).getHex();break;case"colorEmissive":h.emissive=e.fromArray(u).getHex();break;case"specularCoef":h.shininess=u;break;case"shading":"basic"===u.toLowerCase()&&(h.type="MeshBasicMaterial"),"phong"===u.toLowerCase()&&(h.type="MeshPhongMaterial"),"standard"===u.toLowerCase()&&(h.type="MeshStandardMaterial");break;case"mapDiffuse":h.map=s(u,r.mapDiffuseRepeat,r.mapDiffuseOffset,r.mapDiffuseWrap,r.mapDiffuseAnisotropy);break;case"mapDiffuseRepeat":case"mapDiffuseOffset":case"mapDiffuseWrap":case"mapDiffuseAnisotropy":break;case"mapEmissive":h.emissiveMap=s(u,r.mapEmissiveRepeat,r.mapEmissiveOffset,r.mapEmissiveWrap,r.mapEmissiveAnisotropy);break;case"mapEmissiveRepeat":case"mapEmissiveOffset":case"mapEmissiveWrap":case"mapEmissiveAnisotropy":break;case"mapLight":h.lightMap=s(u,r.mapLightRepeat,r.mapLightOffset,r.mapLightWrap,r.mapLightAnisotropy);break;case"mapLightRepeat":case"mapLightOffset":case"mapLightWrap":case"mapLightAnisotropy":break;case"mapAO":h.aoMap=s(u,r.mapAORepeat,r.mapAOOffset,r.mapAOWrap,r.mapAOAnisotropy);break;case"mapAORepeat":case"mapAOOffset":case"mapAOWrap":case"mapAOAnisotropy":break;case"mapBump":h.bumpMap=s(u,r.mapBumpRepeat,r.mapBumpOffset,r.mapBumpWrap,r.mapBumpAnisotropy);break;case"mapBumpScale":h.bumpScale=u;break;case"mapBumpRepeat":case"mapBumpOffset":case"mapBumpWrap":case"mapBumpAnisotropy":break;case"mapNormal":h.normalMap=s(u,r.mapNormalRepeat,r.mapNormalOffset,r.mapNormalWrap,r.mapNormalAnisotropy);break;case"mapNormalFactor":h.normalScale=[u,u];break;case"mapNormalRepeat":case"mapNormalOffset":case"mapNormalWrap":case"mapNormalAnisotropy":break;case"mapSpecular":h.specularMap=s(u,r.mapSpecularRepeat,r.mapSpecularOffset,r.mapSpecularWrap,r.mapSpecularAnisotropy);break;case"mapSpecularRepeat":case"mapSpecularOffset":case"mapSpecularWrap":case"mapSpecularAnisotropy":break;case"mapMetalness":h.metalnessMap=s(u,r.mapMetalnessRepeat,r.mapMetalnessOffset,r.mapMetalnessWrap,r.mapMetalnessAnisotropy);break;case"mapMetalnessRepeat":case"mapMetalnessOffset":case"mapMetalnessWrap":case"mapMetalnessAnisotropy":break;case"mapRoughness":h.roughnessMap=s(u,r.mapRoughnessRepeat,r.mapRoughnessOffset,r.mapRoughnessWrap,r.mapRoughnessAnisotropy);break;case"mapRoughnessRepeat":case"mapRoughnessOffset":case"mapRoughnessWrap":case"mapRoughnessAnisotropy":break;case"mapAlpha":h.alphaMap=s(u,r.mapAlphaRepeat,r.mapAlphaOffset,r.mapAlphaWrap,r.mapAlphaAnisotropy);break;case"mapAlphaRepeat":case"mapAlphaOffset":case"mapAlphaWrap":case"mapAlphaAnisotropy":break;case"flipSided":h.side=pa;break;case"doubleSided":h.side=da;break;case"transparency":console.warn("THREE.Loader.createMaterial: transparency has been renamed to opacity"),h.opacity=u;break;case"depthTest":case"depthWrite":case"colorWrite":case"opacity":case"reflectivity":case"transparent":case"visible":case"wireframe":h[l]=u;break;case"vertexColors":!0===u&&(h.vertexColors=ya),"face"===u&&(h.vertexColors=ga);break;default:console.error("THREE.Loader.createMaterial: Unsupported",l,u)}}return"MeshBasicMaterial"===h.type&&delete h.emissive,"MeshPhongMaterial"!==h.type&&delete h.specular,h.opacity<1&&(h.transparent=!0),n.setTextures(c),n.parse(h)}}()}),Object.assign(hn.prototype,{load:function(t,e,i,n){var r=this,a=this.texturePath&&"string"==typeof this.texturePath?this.texturePath:cn.prototype.extractUrlBase(t),o=new Ri(this.manager);o.setResponseType("json"),o.setWithCredentials(this.withCredentials),o.load(t,function(i){var n=i.metadata;if(void 0!==n){var o=n.type;if(void 0!==o){if("object"===o.toLowerCase())return void console.error("THREE.JSONLoader: "+t+" should be loaded with THREE.ObjectLoader instead.");if("scene"===o.toLowerCase())return void console.error("THREE.JSONLoader: "+t+" should be loaded with THREE.SceneLoader instead.")}}var s=r.parse(i,a);e(s.geometry,s.materials)},i,n)},setTexturePath:function(t){this.texturePath=t},parse:function(){function t(t,e){function n(t,e){return t&1<<e}var r,a,o,s,h,l,u,p,d,f,m,v,g,y,x,b,_,w,M,E,T,S,A,L,R,P,C,I=t.faces,U=t.vertices,O=t.normals,D=t.colors,N=t.scale,F=0;if(void 0!==t.uvs){for(r=0;r<t.uvs.length;r++)t.uvs[r].length&&F++;for(r=0;r<F;r++)e.faceVertexUvs[r]=[]}for(s=0,h=U.length;s<h;)w=new c,w.x=U[s++]*N,w.y=U[s++]*N,w.z=U[s++]*N,e.vertices.push(w);for(s=0,h=I.length;s<h;)if(f=I[s++],m=n(f,0),v=n(f,1),g=n(f,3),y=n(f,4),x=n(f,5),b=n(f,6),_=n(f,7),m){if(E=new ut,E.a=I[s],E.b=I[s+1],E.c=I[s+3],T=new ut,T.a=I[s+1],T.b=I[s+2],T.c=I[s+3],s+=4,v&&(d=I[s++],E.materialIndex=d,T.materialIndex=d),o=e.faces.length,g)for(r=0;r<F;r++)for(L=t.uvs[r],e.faceVertexUvs[r][o]=[],e.faceVertexUvs[r][o+1]=[],a=0;a<4;a++)p=I[s++],P=L[2*p],C=L[2*p+1],R=new i(P,C),2!==a&&e.faceVertexUvs[r][o].push(R),0!==a&&e.faceVertexUvs[r][o+1].push(R);if(y&&(u=3*I[s++],E.normal.set(O[u++],O[u++],O[u]),T.normal.copy(E.normal)),x)for(r=0;r<4;r++)u=3*I[s++],A=new c(O[u++],O[u++],O[u]),2!==r&&E.vertexNormals.push(A),0!==r&&T.vertexNormals.push(A);if(b&&(l=I[s++],S=D[l],E.color.setHex(S),T.color.setHex(S)),_)for(r=0;r<4;r++)l=I[s++],S=D[l],2!==r&&E.vertexColors.push(new X(S)),0!==r&&T.vertexColors.push(new X(S));e.faces.push(E),e.faces.push(T)}else{if(M=new ut,M.a=I[s++],M.b=I[s++],M.c=I[s++],v&&(d=I[s++],M.materialIndex=d),o=e.faces.length,g)for(r=0;r<F;r++)for(L=t.uvs[r],e.faceVertexUvs[r][o]=[],a=0;a<3;a++)p=I[s++],P=L[2*p],C=L[2*p+1],R=new i(P,C),e.faceVertexUvs[r][o].push(R);if(y&&(u=3*I[s++],M.normal.set(O[u++],O[u++],O[u])),x)for(r=0;r<3;r++)u=3*I[s++],A=new c(O[u++],O[u++],O[u]),M.vertexNormals.push(A);if(b&&(l=I[s++],M.color.setHex(D[l])),_)for(r=0;r<3;r++)l=I[s++],M.vertexColors.push(new X(D[l]));e.faces.push(M)}}function e(t,e){var i=void 0!==t.influencesPerVertex?t.influencesPerVertex:2;if(t.skinWeights)for(var n=0,a=t.skinWeights.length;n<a;n+=i){var o=t.skinWeights[n],s=i>1?t.skinWeights[n+1]:0,c=i>2?t.skinWeights[n+2]:0,h=i>3?t.skinWeights[n+3]:0;e.skinWeights.push(new r(o,s,c,h))}if(t.skinIndices)for(var n=0,a=t.skinIndices.length;n<a;n+=i){var l=t.skinIndices[n],u=i>1?t.skinIndices[n+1]:0,p=i>2?t.skinIndices[n+2]:0,d=i>3?t.skinIndices[n+3]:0;e.skinIndices.push(new r(l,u,p,d))}e.bones=t.bones,e.bones&&e.bones.length>0&&(e.skinWeights.length!==e.skinIndices.length||e.skinIndices.length!==e.vertices.length)&&console.warn("When skinning, number of vertices ("+e.vertices.length+"), skinIndices ("+e.skinIndices.length+"), and skinWeights ("+e.skinWeights.length+") should match.")}function n(t,e){var i=t.scale;if(void 0!==t.morphTargets)for(var n=0,r=t.morphTargets.length;n<r;n++){e.morphTargets[n]={},e.morphTargets[n].name=t.morphTargets[n].name,e.morphTargets[n].vertices=[];for(var a=e.morphTargets[n].vertices,o=t.morphTargets[n].vertices,s=0,h=o.length;s<h;s+=3){var l=new c;l.x=o[s]*i,l.y=o[s+1]*i,l.z=o[s+2]*i,a.push(l)}}if(void 0!==t.morphColors&&t.morphColors.length>0){console.warn('THREE.JSONLoader: "morphColors" no longer supported. Using them as face colors.');for(var u=e.faces,p=t.morphColors[0].colors,n=0,r=u.length;n<r;n++)u[n].color.fromArray(p,3*n)}}function a(t,e){var i=[],n=[];void 0!==t.animation&&n.push(t.animation),void 0!==t.animations&&(t.animations.length?n=n.concat(t.animations):n.push(t.animations));for(var r=0;r<n.length;r++){var a=an.parseAnimation(n[r],e.bones);a&&i.push(a)}if(e.morphTargets){var o=an.CreateClipsFromMorphTargetSequences(e.morphTargets,10);i=i.concat(o)}i.length>0&&(e.animations=i)}return function(i,r){void 0!==i.data&&(i=i.data),void 0!==i.scale?i.scale=1/i.scale:i.scale=1;var o=new St;return t(i,o),e(i,o),n(i,o),a(i,o),o.computeFaceNormals(),o.computeBoundingSphere(),void 0===i.materials||0===i.materials.length?{geometry:o}:{geometry:o,materials:cn.prototype.initMaterials(i.materials,r,this.crossOrigin)}}}()}),Object.assign(ln.prototype,{load:function(t,e,i,n){""===this.texturePath&&(this.texturePath=t.substring(0,t.lastIndexOf("/")+1));var r=this;new Ri(r.manager).load(t,function(i){var a=null;try{a=JSON.parse(i)}catch(e){return void 0!==n&&n(e),void console.error("THREE:ObjectLoader: Can't parse "+t+".",e.message)}var o=a.metadata;if(void 0===o||void 0===o.type||"geometry"===o.type.toLowerCase())return void console.error("THREE.ObjectLoader: Can't load "+t+". Use THREE.JSONLoader instead.");r.parse(a,e)},i,n)},setTexturePath:function(t){this.texturePath=t},setCrossOrigin:function(t){this.crossOrigin=t},parse:function(t,e){var i=this.parseGeometries(t.geometries),n=this.parseImages(t.images,function(){void 0!==e&&e(o)}),r=this.parseTextures(t.textures,n),a=this.parseMaterials(t.materials,r),o=this.parseObject(t.object,i,a);return t.animations&&(o.animations=this.parseAnimations(t.animations)),void 0!==t.images&&0!==t.images.length||void 0!==e&&e(o),o},parseGeometries:function(t){var e={};if(void 0!==t)for(var i=new hn,n=new sn,r=0,a=t.length;r<a;r++){var o,s=t[r];switch(s.type){case"PlaneGeometry":case"PlaneBufferGeometry":o=new Ls[s.type](s.width,s.height,s.widthSegments,s.heightSegments);break;case"BoxGeometry":case"BoxBufferGeometry":case"CubeGeometry":o=new Ls[s.type](s.width,s.height,s.depth,s.widthSegments,s.heightSegments,s.depthSegments);break;case"CircleGeometry":case"CircleBufferGeometry":o=new Ls[s.type](s.radius,s.segments,s.thetaStart,s.thetaLength);break;case"CylinderGeometry":case"CylinderBufferGeometry":o=new Ls[s.type](s.radiusTop,s.radiusBottom,s.height,s.radialSegments,s.heightSegments,s.openEnded,s.thetaStart,s.thetaLength);break;case"ConeGeometry":case"ConeBufferGeometry":o=new Ls[s.type](s.radius,s.height,s.radialSegments,s.heightSegments,s.openEnded,s.thetaStart,s.thetaLength);break;case"SphereGeometry":case"SphereBufferGeometry":o=new Ls[s.type](s.radius,s.widthSegments,s.heightSegments,s.phiStart,s.phiLength,s.thetaStart,s.thetaLength);break;case"DodecahedronGeometry":case"IcosahedronGeometry":case"OctahedronGeometry":case"TetrahedronGeometry":o=new Ls[s.type](s.radius,s.detail);break;case"RingGeometry":case"RingBufferGeometry":o=new Ls[s.type](s.innerRadius,s.outerRadius,s.thetaSegments,s.phiSegments,s.thetaStart,s.thetaLength);break;case"TorusGeometry":case"TorusBufferGeometry":o=new Ls[s.type](s.radius,s.tube,s.radialSegments,s.tubularSegments,s.arc);break;case"TorusKnotGeometry":case"TorusKnotBufferGeometry":o=new Ls[s.type](s.radius,s.tube,s.tubularSegments,s.radialSegments,s.p,s.q);break;case"LatheGeometry":case"LatheBufferGeometry":o=new Ls[s.type](s.points,s.segments,s.phiStart,s.phiLength);break;case"BufferGeometry":o=n.parse(s);break;case"Geometry":o=i.parse(s,this.texturePath).geometry;break;default:console.warn('THREE.ObjectLoader: Unsupported geometry type "'+s.type+'"');continue}o.uuid=s.uuid,void 0!==s.name&&(o.name=s.name),e[s.uuid]=o}return e},parseMaterials:function(t,e){var i={};if(void 0!==t){var n=new on;n.setTextures(e);for(var r=0,a=t.length;r<a;r++){var o=t[r];if("MultiMaterial"===o.type){for(var s=[],c=0;c<o.materials.length;c++)s.push(n.parse(o.materials[c]));i[o.uuid]=s}else i[o.uuid]=n.parse(o)}}return i},parseAnimations:function(t){for(var e=[],i=0;i<t.length;i++){var n=an.parse(t[i]);e.push(n)}return e},parseImages:function(t,e){var i=this,n={};if(void 0!==t&&t.length>0){var r=new Li(e),a=new Ii(r);a.setCrossOrigin(this.crossOrigin);for(var o=0,s=t.length;o<s;o++){var c=t[o],h=/^(\/\/)|([a-z]+:(\/\/)?)/i.test(c.url)?c.url:i.texturePath+c.url;n[c.uuid]=function(t){return i.manager.itemStart(t),a.load(t,function(){i.manager.itemEnd(t)},void 0,function(){i.manager.itemEnd(t),i.manager.itemError(t)})}(h)}}return n},parseTextures:function(t,e){function i(t,e){return"number"==typeof t?t:(console.warn("THREE.ObjectLoader.parseTexture: Constant should be in numeric form.",t),e[t])}var r={};if(void 0!==t)for(var a=0,o=t.length;a<o;a++){var s=t[a];void 0===s.image&&console.warn('THREE.ObjectLoader: No "image" specified for',s.uuid),void 0===e[s.image]&&console.warn("THREE.ObjectLoader: Undefined image",s.image);var c=new n(e[s.image]);c.needsUpdate=!0,c.uuid=s.uuid,void 0!==s.name&&(c.name=s.name),void 0!==s.mapping&&(c.mapping=i(s.mapping,Ds)),void 0!==s.offset&&c.offset.fromArray(s.offset),void 0!==s.repeat&&c.repeat.fromArray(s.repeat),void 0!==s.wrap&&(c.wrapS=i(s.wrap[0],Ns),c.wrapT=i(s.wrap[1],Ns)),void 0!==s.minFilter&&(c.minFilter=i(s.minFilter,Fs)),void 0!==s.magFilter&&(c.magFilter=i(s.magFilter,Fs)),void 0!==s.anisotropy&&(c.anisotropy=s.anisotropy),void 0!==s.flipY&&(c.flipY=s.flipY),r[s.uuid]=c}return r},parseObject:function(){var t=new h;return function(e,i,n){function r(t){return void 0===i[t]&&console.warn("THREE.ObjectLoader: Undefined geometry",t),i[t]}function a(t){if(void 0!==t){if(Array.isArray(t)){for(var e=[],i=0,r=t.length;i<r;i++){var a=t[i];void 0===n[a]&&console.warn("THREE.ObjectLoader: Undefined material",a),e.push(n[a])}return e}return void 0===n[t]&&console.warn("THREE.ObjectLoader: Undefined material",t),n[t]}}var o;switch(e.type){case"Scene":o=new ve,void 0!==e.background&&Number.isInteger(e.background)&&(o.background=new X(e.background)),void 0!==e.fog&&("Fog"===e.fog.type?o.fog=new me(e.fog.color,e.fog.near,e.fog.far):"FogExp2"===e.fog.type&&(o.fog=new fe(e.fog.color,e.fog.density)));break;case"PerspectiveCamera":o=new Ot(e.fov,e.aspect,e.near,e.far),void 0!==e.focus&&(o.focus=e.focus),void 0!==e.zoom&&(o.zoom=e.zoom),void 0!==e.filmGauge&&(o.filmGauge=e.filmGauge),void 0!==e.filmOffset&&(o.filmOffset=e.filmOffset),void 0!==e.view&&(o.view=Object.assign({},e.view));break;case"OrthographicCamera":o=new Dt(e.left,e.right,e.top,e.bottom,e.near,e.far);break;case"AmbientLight":o=new ki(e.color,e.intensity);break;case"DirectionalLight":o=new Vi(e.color,e.intensity);break;case"PointLight":o=new Gi(e.color,e.intensity,e.distance,e.decay);break;case"RectAreaLight":o=new ji(e.color,e.intensity,e.width,e.height);break;case"SpotLight":o=new zi(e.color,e.intensity,e.distance,e.angle,e.penumbra,e.decay);break;case"HemisphereLight":o=new Ni(e.color,e.groundColor,e.intensity);break;case"SkinnedMesh":console.warn("THREE.ObjectLoader.parseObject() does not support SkinnedMesh yet.");case"Mesh":var s=r(e.geometry),c=a(e.material);o=s.bones&&s.bones.length>0?new Me(s,c):new Lt(s,c);break;case"LOD":o=new be;break;case"Line":o=new Te(r(e.geometry),a(e.material),e.mode);break;case"LineLoop":o=new Ae(r(e.geometry),a(e.material));break;case"LineSegments":o=new Se(r(e.geometry),a(e.material));break;case"PointCloud":case"Points":o=new Re(r(e.geometry),a(e.material));break;case"Sprite":o=new xe(a(e.material));break;case"Group":o=new Pe;break;default:o=new ct}if(o.uuid=e.uuid,void 0!==e.name&&(o.name=e.name),void 0!==e.matrix?(t.fromArray(e.matrix),t.decompose(o.position,o.quaternion,o.scale)):(void 0!==e.position&&o.position.fromArray(e.position),void 0!==e.rotation&&o.rotation.fromArray(e.rotation),void 0!==e.quaternion&&o.quaternion.fromArray(e.quaternion),void 0!==e.scale&&o.scale.fromArray(e.scale)),void 0!==e.castShadow&&(o.castShadow=e.castShadow),void 0!==e.receiveShadow&&(o.receiveShadow=e.receiveShadow),e.shadow&&(void 0!==e.shadow.bias&&(o.shadow.bias=e.shadow.bias),void 0!==e.shadow.radius&&(o.shadow.radius=e.shadow.radius),void 0!==e.shadow.mapSize&&o.shadow.mapSize.fromArray(e.shadow.mapSize),void 0!==e.shadow.camera&&(o.shadow.camera=this.parseObject(e.shadow.camera))),void 0!==e.visible&&(o.visible=e.visible),void 0!==e.userData&&(o.userData=e.userData),void 0!==e.children)for(var h in e.children)o.add(this.parseObject(e.children[h],i,n));if("LOD"===e.type)for(var l=e.levels,u=0;u<l.length;u++){var p=l[u],h=o.getObjectByProperty("uuid",p.object);void 0!==h&&o.addLevel(h,p.distance)}return o}}()});var Ds={UVMapping:300,CubeReflectionMapping:no,CubeRefractionMapping:ro,EquirectangularReflectionMapping:ao,EquirectangularRefractionMapping:oo,SphericalReflectionMapping:so,CubeUVReflectionMapping:co,CubeUVRefractionMapping:ho},Ns={RepeatWrapping:lo,ClampToEdgeWrapping:uo,MirroredRepeatWrapping:po},Fs={NearestFilter:fo,NearestMipMapNearestFilter:mo,NearestMipMapLinearFilter:vo,LinearFilter:go,LinearMipMapNearestFilter:yo,LinearMipMapLinearFilter:xo};Object.assign(_n.prototype,{getPoint:function(){return console.warn("THREE.Curve: .getPoint() not implemented."),null},getPointAt:function(t){var e=this.getUtoTmapping(t);return this.getPoint(e)},getPoints:function(t){void 0===t&&(t=5);for(var e=[],i=0;i<=t;i++)e.push(this.getPoint(i/t));return e},getSpacedPoints:function(t){void 0===t&&(t=5);for(var e=[],i=0;i<=t;i++)e.push(this.getPointAt(i/t));return e},getLength:function(){var t=this.getLengths();return t[t.length-1]},getLengths:function(t){if(void 0===t&&(t=this.arcLengthDivisions),this.cacheArcLengths&&this.cacheArcLengths.length===t+1&&!this.needsUpdate)return this.cacheArcLengths;this.needsUpdate=!1;var e,i,n=[],r=this.getPoint(0),a=0;for(n.push(0),i=1;i<=t;i++)e=this.getPoint(i/t),a+=e.distanceTo(r),n.push(a),r=e;return this.cacheArcLengths=n,n},updateArcLengths:function(){this.needsUpdate=!0,this.getLengths()},getUtoTmapping:function(t,e){var i,n=this.getLengths(),r=0,a=n.length;i=e||t*n[a-1];for(var o,s=0,c=a-1;s<=c;)if(r=Math.floor(s+(c-s)/2),(o=n[r]-i)<0)s=r+1;else{if(!(o>0)){c=r;break}c=r-1}if(r=c,n[r]===i)return r/(a-1);var h=n[r];return(r+(i-h)/(n[r+1]-h))/(a-1)},getTangent:function(t){var e=t-1e-4,i=t+1e-4;e<0&&(e=0),i>1&&(i=1);var n=this.getPoint(e);return this.getPoint(i).clone().sub(n).normalize()},getTangentAt:function(t){var e=this.getUtoTmapping(t);return this.getTangent(e)},computeFrenetFrames:function(t,e){var i,n,r,a=new c,o=[],s=[],l=[],u=new c,p=new h;for(i=0;i<=t;i++)n=i/t,o[i]=this.getTangentAt(n),o[i].normalize();s[0]=new c,l[0]=new c;var d=Number.MAX_VALUE,f=Math.abs(o[0].x),m=Math.abs(o[0].y),v=Math.abs(o[0].z);for(f<=d&&(d=f,a.set(1,0,0)),m<=d&&(d=m,a.set(0,1,0)),v<=d&&a.set(0,0,1),u.crossVectors(o[0],a).normalize(),s[0].crossVectors(o[0],u),l[0].crossVectors(o[0],s[0]),i=1;i<=t;i++)s[i]=s[i-1].clone(),l[i]=l[i-1].clone(),u.crossVectors(o[i-1],o[i]),u.length()>Number.EPSILON&&(u.normalize(),r=Math.acos(hs.clamp(o[i-1].dot(o[i]),-1,1)),s[i].applyMatrix4(p.makeRotationAxis(u,r))),l[i].crossVectors(o[i],s[i]);if(!0===e)for(r=Math.acos(hs.clamp(s[0].dot(s[t]),-1,1)),r/=t,o[0].dot(u.crossVectors(s[0],s[t]))>0&&(r=-r),i=1;i<=t;i++)s[i].applyMatrix4(p.makeRotationAxis(o[i],r*i)),l[i].crossVectors(o[i],s[i]);return{tangents:o,normals:s,binormals:l}}}),wn.prototype=Object.create(_n.prototype),wn.prototype.constructor=wn,wn.prototype.isLineCurve=!0,wn.prototype.getPoint=function(t){if(1===t)return this.v2.clone();var e=this.v2.clone().sub(this.v1);return e.multiplyScalar(t).add(this.v1),e},wn.prototype.getPointAt=function(t){return this.getPoint(t)},wn.prototype.getTangent=function(t){return this.v2.clone().sub(this.v1).normalize()},Mn.prototype=Object.assign(Object.create(_n.prototype),{constructor:Mn,add:function(t){this.curves.push(t)},closePath:function(){var t=this.curves[0].getPoint(0),e=this.curves[this.curves.length-1].getPoint(1);t.equals(e)||this.curves.push(new wn(e,t))},getPoint:function(t){for(var e=t*this.getLength(),i=this.getCurveLengths(),n=0;n<i.length;){if(i[n]>=e){var r=i[n]-e,a=this.curves[n],o=a.getLength(),s=0===o?0:1-r/o;return a.getPointAt(s)}n++}return null},getLength:function(){var t=this.getCurveLengths();return t[t.length-1]},updateArcLengths:function(){this.needsUpdate=!0,this.cacheLengths=null,this.getCurveLengths()},getCurveLengths:function(){if(this.cacheLengths&&this.cacheLengths.length===this.curves.length)return this.cacheLengths;for(var t=[],e=0,i=0,n=this.curves.length;i<n;i++)e+=this.curves[i].getLength(),t.push(e);return this.cacheLengths=t,t},getSpacedPoints:function(t){void 0===t&&(t=40);for(var e=[],i=0;i<=t;i++)e.push(this.getPoint(i/t));return this.autoClose&&e.push(e[0]),e},getPoints:function(t){t=t||12;for(var e,i=[],n=0,r=this.curves;n<r.length;n++)for(var a=r[n],o=a&&a.isEllipseCurve?2*t:a&&a.isLineCurve?1:a&&a.isSplineCurve?t*a.points.length:t,s=a.getPoints(o),c=0;c<s.length;c++){var h=s[c];e&&e.equals(h)||(i.push(h),e=h)}return this.autoClose&&i.length>1&&!i[i.length-1].equals(i[0])&&i.push(i[0]),i},createPointsGeometry:function(t){var e=this.getPoints(t);return this.createGeometry(e)},createSpacedPointsGeometry:function(t){var e=this.getSpacedPoints(t);return this.createGeometry(e)},createGeometry:function(t){for(var e=new St,i=0,n=t.length;i<n;i++){var r=t[i];e.vertices.push(new c(r.x,r.y,r.z||0))}return e}}),En.prototype=Object.create(_n.prototype),En.prototype.constructor=En,En.prototype.isEllipseCurve=!0,En.prototype.getPoint=function(t){for(var e=2*Math.PI,n=this.aEndAngle-this.aStartAngle,r=Math.abs(n)<Number.EPSILON;n<0;)n+=e;for(;n>e;)n-=e;n<Number.EPSILON&&(n=r?0:e),!0!==this.aClockwise||r||(n===e?n=-e:n-=e);var a=this.aStartAngle+t*n,o=this.aX+this.xRadius*Math.cos(a),s=this.aY+this.yRadius*Math.sin(a);if(0!==this.aRotation){var c=Math.cos(this.aRotation),h=Math.sin(this.aRotation),l=o-this.aX,u=s-this.aY;o=l*c-u*h+this.aX,s=l*h+u*c+this.aY}return new i(o,s)},Tn.prototype=Object.create(_n.prototype),Tn.prototype.constructor=Tn,Tn.prototype.isSplineCurve=!0,Tn.prototype.getPoint=function(t){var e=this.points,n=(e.length-1)*t,r=Math.floor(n),a=n-r,o=e[0===r?r:r-1],s=e[r],c=e[r>e.length-2?e.length-1:r+1],h=e[r>e.length-3?e.length-1:r+2];return new i(un(a,o.x,s.x,c.x,h.x),un(a,o.y,s.y,c.y,h.y))},Sn.prototype=Object.create(_n.prototype),Sn.prototype.constructor=Sn,Sn.prototype.getPoint=function(t){var e=this.v0,n=this.v1,r=this.v2,a=this.v3;return new i(bn(t,e.x,n.x,r.x,a.x),bn(t,e.y,n.y,r.y,a.y))},An.prototype=Object.create(_n.prototype),An.prototype.constructor=An,An.prototype.getPoint=function(t){var e=this.v0,n=this.v1,r=this.v2;return new i(mn(t,e.x,n.x,r.x),mn(t,e.y,n.y,r.y))};var Bs=Object.assign(Object.create(Mn.prototype),{fromPoints:function(t){this.moveTo(t[0].x,t[0].y);for(var e=1,i=t.length;e<i;e++)this.lineTo(t[e].x,t[e].y)},moveTo:function(t,e){this.currentPoint.set(t,e)},lineTo:function(t,e){var n=new wn(this.currentPoint.clone(),new i(t,e));this.curves.push(n),this.currentPoint.set(t,e)},quadraticCurveTo:function(t,e,n,r){var a=new An(this.currentPoint.clone(),new i(t,e),new i(n,r));this.curves.push(a),this.currentPoint.set(n,r)},bezierCurveTo:function(t,e,n,r,a,o){var s=new Sn(this.currentPoint.clone(),new i(t,e),new i(n,r),new i(a,o));this.curves.push(s),this.currentPoint.set(a,o)},splineThru:function(t){var e=[this.currentPoint.clone()].concat(t),i=new Tn(e);this.curves.push(i),this.currentPoint.copy(t[t.length-1])},arc:function(t,e,i,n,r,a){var o=this.currentPoint.x,s=this.currentPoint.y;this.absarc(t+o,e+s,i,n,r,a)},absarc:function(t,e,i,n,r,a){this.absellipse(t,e,i,i,n,r,a)},ellipse:function(t,e,i,n,r,a,o,s){var c=this.currentPoint.x,h=this.currentPoint.y;this.absellipse(t+c,e+h,i,n,r,a,o,s)},absellipse:function(t,e,i,n,r,a,o,s){var c=new En(t,e,i,n,r,a,o,s);if(this.curves.length>0){var h=c.getPoint(0);h.equals(this.currentPoint)||this.lineTo(h.x,h.y)}this.curves.push(c);var l=c.getPoint(1);this.currentPoint.copy(l)}});Ln.prototype=Bs,Bs.constructor=Ln,Rn.prototype=Object.assign(Object.create(Bs),{constructor:Rn,getPointsHoles:function(t){for(var e=[],i=0,n=this.holes.length;i<n;i++)e[i]=this.holes[i].getPoints(t);return e},extractAllPoints:function(t){return{shape:this.getPoints(t),holes:this.getPointsHoles(t)}},extractPoints:function(t){return this.extractAllPoints(t)}}),Object.assign(Pn.prototype,{moveTo:function(t,e){this.currentPath=new Ln,this.subPaths.push(this.currentPath),this.currentPath.moveTo(t,e)},lineTo:function(t,e){this.currentPath.lineTo(t,e)},quadraticCurveTo:function(t,e,i,n){this.currentPath.quadraticCurveTo(t,e,i,n)},bezierCurveTo:function(t,e,i,n,r,a){this.currentPath.bezierCurveTo(t,e,i,n,r,a)},splineThru:function(t){this.currentPath.splineThru(t)},toShapes:function(t,e){function i(t){for(var e=[],i=0,n=t.length;i<n;i++){var r=t[i],a=new Rn;a.curves=r.curves,e.push(a)}return e}var n=As.isClockWise,r=this.subPaths;if(0===r.length)return[];if(!0===e)return i(r);var a,o,s,c=[];if(1===r.length)return o=r[0],s=new Rn,s.curves=o.curves,c.push(s),c;var h=!n(r[0].getPoints());h=t?!h:h;var l,u=[],p=[],d=[],f=0;p[f]=void 0,d[f]=[];for(var m=0,v=r.length;m<v;m++)o=r[m],l=o.getPoints(),a=n(l),a=t?!a:a,a?(!h&&p[f]&&f++,p[f]={s:new Rn,p:l},p[f].s.curves=o.curves,h&&f++,d[f]=[]):d[f].push({h:o,p:l[0]});if(!p[0])return i(r);if(p.length>1){for(var g=!1,y=[],x=0,b=p.length;x<b;x++)u[x]=[];for(var x=0,b=p.length;x<b;x++)for(var _=d[x],w=0;w<_.length;w++){for(var M=_[w],E=!0,T=0;T<p.length;T++)(function(t,e){for(var i=e.length,n=!1,r=i-1,a=0;a<i;r=a++){var o=e[r],s=e[a],c=s.x-o.x,h=s.y-o.y;if(Math.abs(h)>Number.EPSILON){if(h<0&&(o=e[a],c=-c,s=e[r],h=-h),t.y<o.y||t.y>s.y)continue;if(t.y===o.y){if(t.x===o.x)return!0}else{var l=h*(t.x-o.x)-c*(t.y-o.y);if(0===l)return!0;if(l<0)continue;n=!n}}else{if(t.y!==o.y)continue;if(s.x<=t.x&&t.x<=o.x||o.x<=t.x&&t.x<=s.x)return!0}}return n})(M.p,p[T].p)&&(x!==T&&y.push({froms:x,tos:T,hole:w}),E?(E=!1,u[T].push(M)):g=!0);E&&u[x].push(M)}y.length>0&&(g||(d=u))}for(var S,m=0,A=p.length;m<A;m++){s=p[m].s,c.push(s),S=d[m];for(var L=0,R=S.length;L<R;L++)s.holes.push(S[L].h)}return c}}),Object.assign(Cn.prototype,{isFont:!0,generateShapes:function(t,e,i){function n(t,e,n,a){var o=r.glyphs[t]||r.glyphs["?"];if(o){var s,c,h,l,u,p,d,f,m,v,g,y=new Pn,x=[];if(o.o)for(var b=o._cachedOutline||(o._cachedOutline=o.o.split(" ")),_=0,w=b.length;_<w;){var M=b[_++];switch(M){case"m":s=b[_++]*e+n,c=b[_++]*e+a,y.moveTo(s,c);break;case"l":s=b[_++]*e+n,c=b[_++]*e+a,y.lineTo(s,c);break;case"q":if(h=b[_++]*e+n,l=b[_++]*e+a,d=b[_++]*e+n,f=b[_++]*e+a,y.quadraticCurveTo(d,f,h,l),g=x[x.length-1]){u=g.x,p=g.y;for(var E=1;E<=i;E++){var T=E/i;mn(T,u,d,h),mn(T,p,f,l)}}break;case"b":if(h=b[_++]*e+n,l=b[_++]*e+a,d=b[_++]*e+n,f=b[_++]*e+a,m=b[_++]*e+n,v=b[_++]*e+a,y.bezierCurveTo(d,f,m,v,h,l),g=x[x.length-1]){u=g.x,p=g.y;for(var E=1;E<=i;E++){var T=E/i;bn(T,u,d,m,h),bn(T,p,f,v,l)}}}}return{offsetX:o.ha*e,path:y}}}void 0===e&&(e=100),void 0===i&&(i=4);for(var r=this.data,a=function(t){for(var i=String(t).split(""),a=e/r.resolution,o=(r.boundingBox.yMax-r.boundingBox.yMin+r.underlineThickness)*a,s=0,c=0,h=[],l=0;l<i.length;l++){var u=i[l];if("\n"===u)s=0,c-=o;else{var p=n(u,a,s,c);s+=p.offsetX,h.push(p.path)}}return h}(t),o=[],s=0,c=a.length;s<c;s++)Array.prototype.push.apply(o,a[s].toShapes());return o}}),Object.assign(In.prototype,{load:function(t,e,i,n){var r=this;new Ri(this.manager).load(t,function(t){var i;try{i=JSON.parse(t)}catch(e){console.warn("THREE.FontLoader: typeface.js support is being deprecated. Use typeface.json instead."),i=JSON.parse(t.substring(65,t.length-2))}var n=r.parse(i);e&&e(n)},i,n)},parse:function(t){return new Cn(t)}});var zs,Gs={getContext:function(){return void 0===zs&&(zs=new(window.AudioContext||window.webkitAudioContext)),zs},setContext:function(t){zs=t}};Object.assign(Un.prototype,{load:function(t,e,i,n){var r=new Ri(this.manager);r.setResponseType("arraybuffer"),r.load(t,function(t){Gs.getContext().decodeAudioData(t,function(t){e(t)})},i,n)}}),Object.assign(On.prototype,{update:function(){var t,e,i,n,r,a,o,s,c=new h,l=new h;return function(h){if(t!==this||e!==h.focus||i!==h.fov||n!==h.aspect*this.aspect||r!==h.near||a!==h.far||o!==h.zoom||s!==this.eyeSep){t=this,e=h.focus,i=h.fov,n=h.aspect*this.aspect,r=h.near,a=h.far,o=h.zoom;var u=h.projectionMatrix.clone();s=this.eyeSep/2;var p,d,f=s*r/e,m=r*Math.tan(hs.DEG2RAD*i*.5)/o;l.elements[12]=-s,c.elements[12]=s,p=-m*n+f,d=m*n+f,u.elements[0]=2*r/(d-p),u.elements[8]=(d+p)/(d-p),this.cameraL.projectionMatrix.copy(u),p=-m*n-f,d=m*n-f,u.elements[0]=2*r/(d-p),u.elements[8]=(d+p)/(d-p),this.cameraR.projectionMatrix.copy(u)}this.cameraL.matrixWorld.copy(h.matrixWorld).multiply(l),this.cameraR.matrixWorld.copy(h.matrixWorld).multiply(c)}}()}),Dn.prototype=Object.create(ct.prototype),Dn.prototype.constructor=Dn,Nn.prototype=Object.assign(Object.create(Ot.prototype),{constructor:Nn,isArrayCamera:!0}),Fn.prototype=Object.assign(Object.create(ct.prototype),{constructor:Fn,getInput:function(){return this.gain},removeFilter:function(){null!==this.filter&&(this.gain.disconnect(this.filter),this.filter.disconnect(this.context.destination),this.gain.connect(this.context.destination),this.filter=null)},getFilter:function(){return this.filter},setFilter:function(t){null!==this.filter?(this.gain.disconnect(this.filter),this.filter.disconnect(this.context.destination)):this.gain.disconnect(this.context.destination),this.filter=t,this.gain.connect(this.filter),this.filter.connect(this.context.destination)},getMasterVolume:function(){return this.gain.gain.value},setMasterVolume:function(t){this.gain.gain.value=t},updateMatrixWorld:function(){
var t=new c,e=new s,i=new c,n=new c;return function(r){ct.prototype.updateMatrixWorld.call(this,r);var a=this.context.listener,o=this.up;this.matrixWorld.decompose(t,e,i),n.set(0,0,-1).applyQuaternion(e),a.positionX?(a.positionX.setValueAtTime(t.x,this.context.currentTime),a.positionY.setValueAtTime(t.y,this.context.currentTime),a.positionZ.setValueAtTime(t.z,this.context.currentTime),a.forwardX.setValueAtTime(n.x,this.context.currentTime),a.forwardY.setValueAtTime(n.y,this.context.currentTime),a.forwardZ.setValueAtTime(n.z,this.context.currentTime),a.upX.setValueAtTime(o.x,this.context.currentTime),a.upY.setValueAtTime(o.y,this.context.currentTime),a.upZ.setValueAtTime(o.z,this.context.currentTime)):(a.setPosition(t.x,t.y,t.z),a.setOrientation(n.x,n.y,n.z,o.x,o.y,o.z))}}()}),Bn.prototype=Object.assign(Object.create(ct.prototype),{constructor:Bn,getOutput:function(){return this.gain},setNodeSource:function(t){return this.hasPlaybackControl=!1,this.sourceType="audioNode",this.source=t,this.connect(),this},setBuffer:function(t){return this.buffer=t,this.sourceType="buffer",this.autoplay&&this.play(),this},play:function(){if(!0===this.isPlaying)return void console.warn("THREE.Audio: Audio is already playing.");if(!1===this.hasPlaybackControl)return void console.warn("THREE.Audio: this Audio has no playback control.");var t=this.context.createBufferSource();return t.buffer=this.buffer,t.loop=this.loop,t.onended=this.onEnded.bind(this),t.playbackRate.setValueAtTime(this.playbackRate,this.startTime),t.start(0,this.startTime),this.isPlaying=!0,this.source=t,this.connect()},pause:function(){return!1===this.hasPlaybackControl?void console.warn("THREE.Audio: this Audio has no playback control."):(this.source.stop(),this.startTime=this.context.currentTime,this.isPlaying=!1,this)},stop:function(){return!1===this.hasPlaybackControl?void console.warn("THREE.Audio: this Audio has no playback control."):(this.source.stop(),this.startTime=0,this.isPlaying=!1,this)},connect:function(){if(this.filters.length>0){this.source.connect(this.filters[0]);for(var t=1,e=this.filters.length;t<e;t++)this.filters[t-1].connect(this.filters[t]);this.filters[this.filters.length-1].connect(this.getOutput())}else this.source.connect(this.getOutput());return this},disconnect:function(){if(this.filters.length>0){this.source.disconnect(this.filters[0]);for(var t=1,e=this.filters.length;t<e;t++)this.filters[t-1].disconnect(this.filters[t]);this.filters[this.filters.length-1].disconnect(this.getOutput())}else this.source.disconnect(this.getOutput());return this},getFilters:function(){return this.filters},setFilters:function(t){return t||(t=[]),!0===this.isPlaying?(this.disconnect(),this.filters=t,this.connect()):this.filters=t,this},getFilter:function(){return this.getFilters()[0]},setFilter:function(t){return this.setFilters(t?[t]:[])},setPlaybackRate:function(t){return!1===this.hasPlaybackControl?void console.warn("THREE.Audio: this Audio has no playback control."):(this.playbackRate=t,!0===this.isPlaying&&this.source.playbackRate.setValueAtTime(this.playbackRate,this.context.currentTime),this)},getPlaybackRate:function(){return this.playbackRate},onEnded:function(){this.isPlaying=!1},getLoop:function(){return!1===this.hasPlaybackControl?(console.warn("THREE.Audio: this Audio has no playback control."),!1):this.loop},setLoop:function(t){return!1===this.hasPlaybackControl?void console.warn("THREE.Audio: this Audio has no playback control."):(this.loop=t,!0===this.isPlaying&&(this.source.loop=this.loop),this)},getVolume:function(){return this.gain.gain.value},setVolume:function(t){return this.gain.gain.value=t,this}}),zn.prototype=Object.assign(Object.create(Bn.prototype),{constructor:zn,getOutput:function(){return this.panner},getRefDistance:function(){return this.panner.refDistance},setRefDistance:function(t){this.panner.refDistance=t},getRolloffFactor:function(){return this.panner.rolloffFactor},setRolloffFactor:function(t){this.panner.rolloffFactor=t},getDistanceModel:function(){return this.panner.distanceModel},setDistanceModel:function(t){this.panner.distanceModel=t},getMaxDistance:function(){return this.panner.maxDistance},setMaxDistance:function(t){this.panner.maxDistance=t},updateMatrixWorld:function(){var t=new c;return function(e){ct.prototype.updateMatrixWorld.call(this,e),t.setFromMatrixPosition(this.matrixWorld),this.panner.setPosition(t.x,t.y,t.z)}}()}),Object.assign(Gn.prototype,{getFrequencyData:function(){return this.analyser.getByteFrequencyData(this.data),this.data},getAverageFrequency:function(){for(var t=0,e=this.getFrequencyData(),i=0;i<e.length;i++)t+=e[i];return t/e.length}}),Object.assign(Hn.prototype,{accumulate:function(t,e){var i=this.buffer,n=this.valueSize,r=t*n+n,a=this.cumulativeWeight;if(0===a){for(var o=0;o!==n;++o)i[r+o]=i[o];a=e}else{a+=e;var s=e/a;this._mixBufferRegion(i,r,0,s,n)}this.cumulativeWeight=a},apply:function(t){var e=this.valueSize,i=this.buffer,n=t*e+e,r=this.cumulativeWeight,a=this.binding;if(this.cumulativeWeight=0,r<1){var o=3*e;this._mixBufferRegion(i,n,o,1-r,e)}for(var s=e,c=e+e;s!==c;++s)if(i[s]!==i[s+e]){a.setValue(i,n);break}},saveOriginalState:function(){var t=this.binding,e=this.buffer,i=this.valueSize,n=3*i;t.getValue(e,n);for(var r=i,a=n;r!==a;++r)e[r]=e[n+r%i];this.cumulativeWeight=0},restoreOriginalState:function(){var t=3*this.valueSize;this.binding.setValue(this.buffer,t)},_select:function(t,e,i,n,r){if(n>=.5)for(var a=0;a!==r;++a)t[e+a]=t[i+a]},_slerp:function(t,e,i,n){s.slerpFlat(t,e,t,e,t,i,n)},_lerp:function(t,e,i,n,r){for(var a=1-n,o=0;o!==r;++o){var s=e+o;t[s]=t[s]*a+t[i+o]*n}}}),Object.assign(Vn.prototype,{getValue:function(t,e){this.bind();var i=this._targetGroup.nCachedObjects_,n=this._bindings[i];void 0!==n&&n.getValue(t,e)},setValue:function(t,e){for(var i=this._bindings,n=this._targetGroup.nCachedObjects_,r=i.length;n!==r;++n)i[n].setValue(t,e)},bind:function(){for(var t=this._bindings,e=this._targetGroup.nCachedObjects_,i=t.length;e!==i;++e)t[e].bind()},unbind:function(){for(var t=this._bindings,e=this._targetGroup.nCachedObjects_,i=t.length;e!==i;++e)t[e].unbind()}}),Object.assign(kn,{Composite:Vn,create:function(t,e,i){return t&&t.isAnimationObjectGroup?new kn.Composite(t,e,i):new kn(t,e,i)},parseTrackName:function(){var t=/((?:[\w-]+[\/:])*)/,e=/([\w-\.]+)?/,i=/(?:\.([\w-]+)(?:\[(.+)\])?)?/,n=/\.([\w-]+)(?:\[(.+)\])?/,r=new RegExp("^"+t.source+e.source+i.source+n.source+"$"),a=["material","materials","bones"];return function(t){var e=r.exec(t);if(!e)throw new Error("PropertyBinding: Cannot parse trackName: "+t);var i={nodeName:e[2],objectName:e[3],objectIndex:e[4],propertyName:e[5],propertyIndex:e[6]},n=i.nodeName&&i.nodeName.lastIndexOf(".");if(void 0!==n&&-1!==n){var o=i.nodeName.substring(n+1);-1!==a.indexOf(o)&&(i.nodeName=i.nodeName.substring(0,n),i.objectName=o)}if(null===i.propertyName||0===i.propertyName.length)throw new Error("PropertyBinding: can not parse propertyName from trackName: "+t);return i}}(),findNode:function(t,e){if(!e||""===e||"root"===e||"."===e||-1===e||e===t.name||e===t.uuid)return t;if(t.skeleton){var i=function(t){for(var i=0;i<t.bones.length;i++){var n=t.bones[i];if(n.name===e)return n}return null}(t.skeleton);if(i)return i}if(t.children){var n=function(t){for(var i=0;i<t.length;i++){var r=t[i];if(r.name===e||r.uuid===e)return r;var a=n(r.children);if(a)return a}return null},r=n(t.children);if(r)return r}return null}}),Object.assign(kn.prototype,{_getValue_unavailable:function(){},_setValue_unavailable:function(){},BindingType:{Direct:0,EntireArray:1,ArrayElement:2,HasFromToArray:3},Versioning:{None:0,NeedsUpdate:1,MatrixWorldNeedsUpdate:2},GetterByBindingType:[function(t,e){t[e]=this.node[this.propertyName]},function(t,e){for(var i=this.resolvedProperty,n=0,r=i.length;n!==r;++n)t[e++]=i[n]},function(t,e){t[e]=this.resolvedProperty[this.propertyIndex]},function(t,e){this.resolvedProperty.toArray(t,e)}],SetterByBindingTypeAndVersioning:[[function(t,e){this.node[this.propertyName]=t[e]},function(t,e){this.node[this.propertyName]=t[e],this.targetObject.needsUpdate=!0},function(t,e){this.node[this.propertyName]=t[e],this.targetObject.matrixWorldNeedsUpdate=!0}],[function(t,e){for(var i=this.resolvedProperty,n=0,r=i.length;n!==r;++n)i[n]=t[e++]},function(t,e){for(var i=this.resolvedProperty,n=0,r=i.length;n!==r;++n)i[n]=t[e++];this.targetObject.needsUpdate=!0},function(t,e){for(var i=this.resolvedProperty,n=0,r=i.length;n!==r;++n)i[n]=t[e++];this.targetObject.matrixWorldNeedsUpdate=!0}],[function(t,e){this.resolvedProperty[this.propertyIndex]=t[e]},function(t,e){this.resolvedProperty[this.propertyIndex]=t[e],this.targetObject.needsUpdate=!0},function(t,e){this.resolvedProperty[this.propertyIndex]=t[e],this.targetObject.matrixWorldNeedsUpdate=!0}],[function(t,e){this.resolvedProperty.fromArray(t,e)},function(t,e){this.resolvedProperty.fromArray(t,e),this.targetObject.needsUpdate=!0},function(t,e){this.resolvedProperty.fromArray(t,e),this.targetObject.matrixWorldNeedsUpdate=!0}]],getValue:function(t,e){this.bind(),this.getValue(t,e)},setValue:function(t,e){this.bind(),this.setValue(t,e)},bind:function(){var t=this.node,e=this.parsedPath,i=e.objectName,n=e.propertyName,r=e.propertyIndex;if(t||(t=kn.findNode(this.rootNode,e.nodeName)||this.rootNode,this.node=t),this.getValue=this._getValue_unavailable,this.setValue=this._setValue_unavailable,!t)return void console.error(" trying to update node for track: "+this.path+" but it wasn't found.");if(i){var a=e.objectIndex;switch(i){case"materials":if(!t.material)return void console.error(" can not bind to material as node does not have a material",this);if(!t.material.materials)return void console.error(" can not bind to material.materials as node.material does not have a materials array",this);t=t.material.materials;break;case"bones":if(!t.skeleton)return void console.error(" can not bind to bones as node does not have a skeleton",this);t=t.skeleton.bones;for(var o=0;o<t.length;o++)if(t[o].name===a){a=o;break}break;default:if(void 0===t[i])return void console.error(" can not bind to objectName of node, undefined",this);t=t[i]}if(void 0!==a){if(void 0===t[a])return void console.error(" trying to bind to objectIndex of objectName, but is undefined:",this,t);t=t[a]}}var s=t[n];if(void 0===s){var c=e.nodeName;return void console.error(" trying to update property for track: "+c+"."+n+" but it wasn't found.",t)}var h=this.Versioning.None;void 0!==t.needsUpdate?(h=this.Versioning.NeedsUpdate,this.targetObject=t):void 0!==t.matrixWorldNeedsUpdate&&(h=this.Versioning.MatrixWorldNeedsUpdate,this.targetObject=t);var l=this.BindingType.Direct;if(void 0!==r){if("morphTargetInfluences"===n){if(!t.geometry)return void console.error(" can not bind to morphTargetInfluences becasuse node does not have a geometry",this);if(!t.geometry.morphTargets)return void console.error(" can not bind to morphTargetInfluences becasuse node does not have a geometry.morphTargets",this);for(var o=0;o<this.node.geometry.morphTargets.length;o++)if(t.geometry.morphTargets[o].name===r){r=o;break}}l=this.BindingType.ArrayElement,this.resolvedProperty=s,this.propertyIndex=r}else void 0!==s.fromArray&&void 0!==s.toArray?(l=this.BindingType.HasFromToArray,this.resolvedProperty=s):Array.isArray(s)?(l=this.BindingType.EntireArray,this.resolvedProperty=s):this.propertyName=n;this.getValue=this.GetterByBindingType[l],this.setValue=this.SetterByBindingTypeAndVersioning[l][h]},unbind:function(){this.node=null,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}}),Object.assign(kn.prototype,{_getValue_unbound:kn.prototype.getValue,_setValue_unbound:kn.prototype.setValue}),Object.assign(jn.prototype,{isAnimationObjectGroup:!0,add:function(t){for(var e=this._objects,i=e.length,n=this.nCachedObjects_,r=this._indicesByUUID,a=this._paths,o=this._parsedPaths,s=this._bindings,c=s.length,h=0,l=arguments.length;h!==l;++h){var u=arguments[h],p=u.uuid,d=r[p],f=void 0;if(void 0===d){d=i++,r[p]=d,e.push(u);for(var m=0,v=c;m!==v;++m)s[m].push(new kn(u,a[m],o[m]))}else if(d<n){f=e[d];var g=--n,y=e[g];r[y.uuid]=d,e[d]=y,r[p]=g,e[g]=u;for(var m=0,v=c;m!==v;++m){var x=s[m],b=x[g],_=x[d];x[d]=b,void 0===_&&(_=new kn(u,a[m],o[m])),x[g]=_}}else e[d]!==f&&console.error("Different objects with the same UUID detected. Clean the caches or recreate your infrastructure when reloading scenes...")}this.nCachedObjects_=n},remove:function(t){for(var e=this._objects,i=this.nCachedObjects_,n=this._indicesByUUID,r=this._bindings,a=r.length,o=0,s=arguments.length;o!==s;++o){var c=arguments[o],h=c.uuid,l=n[h];if(void 0!==l&&l>=i){var u=i++,p=e[u];n[p.uuid]=l,e[l]=p,n[h]=u,e[u]=c;for(var d=0,f=a;d!==f;++d){var m=r[d],v=m[u],g=m[l];m[l]=v,m[u]=g}}}this.nCachedObjects_=i},uncache:function(t){for(var e=this._objects,i=e.length,n=this.nCachedObjects_,r=this._indicesByUUID,a=this._bindings,o=a.length,s=0,c=arguments.length;s!==c;++s){var h=arguments[s],l=h.uuid,u=r[l];if(void 0!==u)if(delete r[l],u<n){var p=--n,d=e[p],f=--i,m=e[f];r[d.uuid]=u,e[u]=d,r[m.uuid]=p,e[p]=m,e.pop();for(var v=0,g=o;v!==g;++v){var y=a[v],x=y[p],b=y[f];y[u]=x,y[p]=b,y.pop()}}else{var f=--i,m=e[f];r[m.uuid]=u,e[u]=m,e.pop();for(var v=0,g=o;v!==g;++v){var y=a[v];y[u]=y[f],y.pop()}}}this.nCachedObjects_=n},subscribe_:function(t,e){var i=this._bindingsIndicesByPath,n=i[t],r=this._bindings;if(void 0!==n)return r[n];var a=this._paths,o=this._parsedPaths,s=this._objects,c=s.length,h=this.nCachedObjects_,l=new Array(c);n=r.length,i[t]=n,a.push(t),o.push(e),r.push(l);for(var u=h,p=s.length;u!==p;++u){var d=s[u];l[u]=new kn(d,t,e)}return l},unsubscribe_:function(t){var e=this._bindingsIndicesByPath,i=e[t];if(void 0!==i){var n=this._paths,r=this._parsedPaths,a=this._bindings,o=a.length-1,s=a[o];e[t[o]]=i,a[i]=s,a.pop(),r[i]=r[o],r.pop(),n[i]=n[o],n.pop()}}}),Object.assign(Wn.prototype,{play:function(){return this._mixer._activateAction(this),this},stop:function(){return this._mixer._deactivateAction(this),this.reset()},reset:function(){return this.paused=!1,this.enabled=!0,this.time=0,this._loopCount=-1,this._startTime=null,this.stopFading().stopWarping()},isRunning:function(){return this.enabled&&!this.paused&&0!==this.timeScale&&null===this._startTime&&this._mixer._isActiveAction(this)},isScheduled:function(){return this._mixer._isActiveAction(this)},startAt:function(t){return this._startTime=t,this},setLoop:function(t,e){return this.loop=t,this.repetitions=e,this},setEffectiveWeight:function(t){return this.weight=t,this._effectiveWeight=this.enabled?t:0,this.stopFading()},getEffectiveWeight:function(){return this._effectiveWeight},fadeIn:function(t){return this._scheduleFading(t,0,1)},fadeOut:function(t){return this._scheduleFading(t,1,0)},crossFadeFrom:function(t,e,i){if(t.fadeOut(e),this.fadeIn(e),i){var n=this._clip.duration,r=t._clip.duration,a=r/n,o=n/r;t.warp(1,a,e),this.warp(o,1,e)}return this},crossFadeTo:function(t,e,i){return t.crossFadeFrom(this,e,i)},stopFading:function(){var t=this._weightInterpolant;return null!==t&&(this._weightInterpolant=null,this._mixer._takeBackControlInterpolant(t)),this},setEffectiveTimeScale:function(t){return this.timeScale=t,this._effectiveTimeScale=this.paused?0:t,this.stopWarping()},getEffectiveTimeScale:function(){return this._effectiveTimeScale},setDuration:function(t){return this.timeScale=this._clip.duration/t,this.stopWarping()},syncWith:function(t){return this.time=t.time,this.timeScale=t.timeScale,this.stopWarping()},halt:function(t){return this.warp(this._effectiveTimeScale,0,t)},warp:function(t,e,i){var n=this._mixer,r=n.time,a=this._timeScaleInterpolant,o=this.timeScale;null===a&&(a=n._lendControlInterpolant(),this._timeScaleInterpolant=a);var s=a.parameterPositions,c=a.sampleValues;return s[0]=r,s[1]=r+i,c[0]=t/o,c[1]=e/o,this},stopWarping:function(){var t=this._timeScaleInterpolant;return null!==t&&(this._timeScaleInterpolant=null,this._mixer._takeBackControlInterpolant(t)),this},getMixer:function(){return this._mixer},getClip:function(){return this._clip},getRoot:function(){return this._localRoot||this._mixer._root},_update:function(t,e,i,n){if(!this.enabled)return void this._updateWeight(t);var r=this._startTime;if(null!==r){var a=(t-r)*i;if(a<0||0===i)return;this._startTime=null,e=i*a}e*=this._updateTimeScale(t);var o=this._updateTime(e),s=this._updateWeight(t);if(s>0)for(var c=this._interpolants,h=this._propertyBindings,l=0,u=c.length;l!==u;++l)c[l].evaluate(o),h[l].accumulate(n,s)},_updateWeight:function(t){var e=0;if(this.enabled){e=this.weight;var i=this._weightInterpolant;if(null!==i){var n=i.evaluate(t)[0];e*=n,t>i.parameterPositions[1]&&(this.stopFading(),0===n&&(this.enabled=!1))}}return this._effectiveWeight=e,e},_updateTimeScale:function(t){var e=0;if(!this.paused){e=this.timeScale;var i=this._timeScaleInterpolant;if(null!==i){e*=i.evaluate(t)[0],t>i.parameterPositions[1]&&(this.stopWarping(),0===e?this.paused=!0:this.timeScale=e)}}return this._effectiveTimeScale=e,e},_updateTime:function(t){var e=this.time+t;if(0===t)return e;var i=this._clip.duration,n=this.loop,r=this._loopCount;if(2200===n){-1===r&&(this._loopCount=0,this._setEndings(!0,!0,!1));t:{if(e>=i)e=i;else{if(!(e<0))break t;e=0}this.clampWhenFinished?this.paused=!0:this.enabled=!1,this._mixer.dispatchEvent({type:"finished",action:this,direction:t<0?-1:1})}}else{var a=2202===n;if(-1===r&&(t>=0?(r=0,this._setEndings(!0,0===this.repetitions,a)):this._setEndings(0===this.repetitions,!0,a)),e>=i||e<0){var o=Math.floor(e/i);e-=i*o,r+=Math.abs(o);var s=this.repetitions-r;if(s<0)this.clampWhenFinished?this.paused=!0:this.enabled=!1,e=t>0?i:0,this._mixer.dispatchEvent({type:"finished",action:this,direction:t>0?1:-1});else{if(0===s){var c=t<0;this._setEndings(c,!c,a)}else this._setEndings(!1,!1,a);this._loopCount=r,this._mixer.dispatchEvent({type:"loop",action:this,loopDelta:o})}}if(a&&1==(1&r))return this.time=e,i-e}return this.time=e,e},_setEndings:function(t,e,i){var n=this._interpolantSettings;i?(n.endingStart=2401,n.endingEnd=2401):(n.endingStart=t?this.zeroSlopeAtStart?2401:Jo:2402,n.endingEnd=e?this.zeroSlopeAtEnd?2401:Jo:2402)},_scheduleFading:function(t,e,i){var n=this._mixer,r=n.time,a=this._weightInterpolant;null===a&&(a=n._lendControlInterpolant(),this._weightInterpolant=a);var o=a.parameterPositions,s=a.sampleValues;return o[0]=r,s[0]=e,o[1]=r+t,s[1]=i,this}}),Object.assign(Xn.prototype,e.prototype,{_bindAction:function(t,e){var i=t._localRoot||this._root,n=t._clip.tracks,r=n.length,a=t._propertyBindings,o=t._interpolants,s=i.uuid,c=this._bindingsByRootAndName,h=c[s];void 0===h&&(h={},c[s]=h);for(var l=0;l!==r;++l){var u=n[l],p=u.name,d=h[p];if(void 0!==d)a[l]=d;else{if(void 0!==(d=a[l])){null===d._cacheIndex&&(++d.referenceCount,this._addInactiveBinding(d,s,p));continue}var f=e&&e._propertyBindings[l].binding.parsedPath;d=new Hn(kn.create(i,p,f),u.ValueTypeName,u.getValueSize()),++d.referenceCount,this._addInactiveBinding(d,s,p),a[l]=d}o[l].resultBuffer=d.buffer}},_activateAction:function(t){if(!this._isActiveAction(t)){if(null===t._cacheIndex){var e=(t._localRoot||this._root).uuid,i=t._clip.uuid,n=this._actionsByClip[i];this._bindAction(t,n&&n.knownActions[0]),this._addInactiveAction(t,i,e)}for(var r=t._propertyBindings,a=0,o=r.length;a!==o;++a){var s=r[a];0==s.useCount++&&(this._lendBinding(s),s.saveOriginalState())}this._lendAction(t)}},_deactivateAction:function(t){if(this._isActiveAction(t)){for(var e=t._propertyBindings,i=0,n=e.length;i!==n;++i){var r=e[i];0==--r.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&&e<this._nActiveActions},_addInactiveAction:function(t,e,i){var n=this._actions,r=this._actionsByClip,a=r[e];if(void 0===a)a={knownActions:[t],actionByRoot:{}},t._byClipCacheIndex=0,r[e]=a;else{var o=a.knownActions;t._byClipCacheIndex=o.length,o.push(t)}t._cacheIndex=n.length,n.push(t),a.actionByRoot[i]=t},_removeInactiveAction:function(t){var e=this._actions,i=e[e.length-1],n=t._cacheIndex;i._cacheIndex=n,e[n]=i,e.pop(),t._cacheIndex=null;var r=t._clip.uuid,a=this._actionsByClip,o=a[r],s=o.knownActions,c=s[s.length-1],h=t._byClipCacheIndex;c._byClipCacheIndex=h,s[h]=c,s.pop(),t._byClipCacheIndex=null,delete o.actionByRoot[(t._localRoot||this._root).uuid],0===s.length&&delete a[r],this._removeInactiveBindingsForAction(t)},_removeInactiveBindingsForAction:function(t){for(var e=t._propertyBindings,i=0,n=e.length;i!==n;++i){var r=e[i];0==--r.referenceCount&&this._removeInactiveBinding(r)}},_lendAction:function(t){var e=this._actions,i=t._cacheIndex,n=this._nActiveActions++,r=e[n];t._cacheIndex=n,e[n]=t,r._cacheIndex=i,e[i]=r},_takeBackAction:function(t){var e=this._actions,i=t._cacheIndex,n=--this._nActiveActions,r=e[n];t._cacheIndex=n,e[n]=t,r._cacheIndex=i,e[i]=r},_addInactiveBinding:function(t,e,i){var n=this._bindingsByRootAndName,r=n[e],a=this._bindings;void 0===r&&(r={},n[e]=r),r[i]=t,t._cacheIndex=a.length,a.push(t)},_removeInactiveBinding:function(t){var e=this._bindings,i=t.binding,n=i.rootNode.uuid,r=i.path,a=this._bindingsByRootAndName,o=a[n],s=e[e.length-1],c=t._cacheIndex;s._cacheIndex=c,e[c]=s,e.pop(),delete o[r];t:{for(var h in o)break t;delete a[n]}},_lendBinding:function(t){var e=this._bindings,i=t._cacheIndex,n=this._nActiveBindings++,r=e[n];t._cacheIndex=n,e[n]=t,r._cacheIndex=i,e[i]=r},_takeBackBinding:function(t){var e=this._bindings,i=t._cacheIndex,n=--this._nActiveBindings,r=e[n];t._cacheIndex=n,e[n]=t,r._cacheIndex=i,e[i]=r},_lendControlInterpolant:function(){var t=this._controlInterpolants,e=this._nActiveControlInterpolants++,i=t[e];return void 0===i&&(i=new qi(new Float32Array(2),new Float32Array(2),1,this._controlInterpolantsResultBuffer),i.__cacheIndex=e,t[e]=i),i},_takeBackControlInterpolant:function(t){var e=this._controlInterpolants,i=t.__cacheIndex,n=--this._nActiveControlInterpolants,r=e[n];t.__cacheIndex=n,e[n]=t,r.__cacheIndex=i,e[i]=r},_controlInterpolantsResultBuffer:new Float32Array(1),clipAction:function(t,e){var i=e||this._root,n=i.uuid,r="string"==typeof t?an.findByName(i,t):t,a=null!==r?r.uuid:t,o=this._actionsByClip[a],s=null;if(void 0!==o){var c=o.actionByRoot[n];if(void 0!==c)return c;s=o.knownActions[0],null===r&&(r=s._clip)}if(null===r)return null;var h=new Wn(this,r,e);return this._bindAction(h,s),this._addInactiveAction(h,a,n),h},existingAction:function(t,e){var i=e||this._root,n=i.uuid,r="string"==typeof t?an.findByName(i,t):t,a=r?r.uuid:t,o=this._actionsByClip[a];return void 0!==o?o.actionByRoot[n]||null:null},stopAllAction:function(){var t=this._actions,e=this._nActiveActions,i=this._bindings,n=this._nActiveBindings;this._nActiveActions=0,this._nActiveBindings=0;for(var r=0;r!==e;++r)t[r].reset();for(var r=0;r!==n;++r)i[r].useCount=0;return this},update:function(t){t*=this.timeScale;for(var e=this._actions,i=this._nActiveActions,n=this.time+=t,r=Math.sign(t),a=this._accuIndex^=1,o=0;o!==i;++o){e[o]._update(n,t,r,a)}for(var s=this._bindings,c=this._nActiveBindings,o=0;o!==c;++o)s[o].apply(a);return this},getRoot:function(){return this._root},uncacheClip:function(t){var e=this._actions,i=t.uuid,n=this._actionsByClip,r=n[i];if(void 0!==r){for(var a=r.knownActions,o=0,s=a.length;o!==s;++o){var c=a[o];this._deactivateAction(c);var h=c._cacheIndex,l=e[e.length-1];c._cacheIndex=null,c._byClipCacheIndex=null,l._cacheIndex=h,e[h]=l,e.pop(),this._removeInactiveBindingsForAction(c)}delete n[i]}},uncacheRoot:function(t){var e=t.uuid,i=this._actionsByClip;for(var n in i){var r=i[n].actionByRoot,a=r[e];void 0!==a&&(this._deactivateAction(a),this._removeInactiveAction(a))}var o=this._bindingsByRootAndName,s=o[e];if(void 0!==s)for(var c in s){var h=s[c];h.restoreOriginalState(),this._removeInactiveBinding(h)}},uncacheAction:function(t,e){var i=this.existingAction(t,e);null!==i&&(this._deactivateAction(i),this._removeInactiveAction(i))}}),qn.prototype.clone=function(){return new qn(void 0===this.value.clone?this.value:this.value.clone())},Yn.prototype=Object.assign(Object.create(At.prototype),{constructor:Yn,isInstancedBufferGeometry:!0,addGroup:function(t,e,i){this.groups.push({start:t,count:e,materialIndex:i})},copy:function(t){var e=t.index;null!==e&&this.setIndex(e.clone());var i=t.attributes;for(var n in i){var r=i[n];this.addAttribute(n,r.clone())}for(var a=t.groups,o=0,s=a.length;o<s;o++){var c=a[o];this.addGroup(c.start,c.count,c.materialIndex)}return this}}),Object.defineProperties(Zn.prototype,{count:{get:function(){return this.data.count}},array:{get:function(){return this.data.array}}}),Object.assign(Zn.prototype,{isInterleavedBufferAttribute:!0,setX:function(t,e){return this.data.array[t*this.data.stride+this.offset]=e,this},setY:function(t,e){return this.data.array[t*this.data.stride+this.offset+1]=e,this},setZ:function(t,e){return this.data.array[t*this.data.stride+this.offset+2]=e,this},setW:function(t,e){return this.data.array[t*this.data.stride+this.offset+3]=e,this},getX:function(t){return this.data.array[t*this.data.stride+this.offset]},getY:function(t){return this.data.array[t*this.data.stride+this.offset+1]},getZ:function(t){return this.data.array[t*this.data.stride+this.offset+2]},getW:function(t){return this.data.array[t*this.data.stride+this.offset+3]},setXY:function(t,e,i){return t=t*this.data.stride+this.offset,this.data.array[t+0]=e,this.data.array[t+1]=i,this},setXYZ:function(t,e,i,n){return t=t*this.data.stride+this.offset,this.data.array[t+0]=e,this.data.array[t+1]=i,this.data.array[t+2]=n,this},setXYZW:function(t,e,i,n,r){return t=t*this.data.stride+this.offset,this.data.array[t+0]=e,this.data.array[t+1]=i,this.data.array[t+2]=n,this.data.array[t+3]=r,this}}),Object.defineProperty(Jn.prototype,"needsUpdate",{set:function(t){!0===t&&this.version++}}),Object.assign(Jn.prototype,{isInterleavedBuffer:!0,setArray:function(t){if(Array.isArray(t))throw new TypeError("THREE.BufferAttribute: array should be a Typed Array.");this.count=void 0!==t?t.length/this.stride:0,this.array=t},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,i){t*=this.stride,i*=e.stride;for(var n=0,r=this.stride;n<r;n++)this.array[t+n]=e.array[i+n];return this},set:function(t,e){return void 0===e&&(e=0),this.array.set(t,e),this},clone:function(){return(new this.constructor).copy(this)},onUpload:function(t){return this.onUploadCallback=t,this}}),Qn.prototype=Object.assign(Object.create(Jn.prototype),{constructor:Qn,isInstancedInterleavedBuffer:!0,copy:function(t){return Jn.prototype.copy.call(this,t),this.meshPerAttribute=t.meshPerAttribute,this}}),Kn.prototype=Object.assign(Object.create(dt.prototype),{constructor:Kn,isInstancedBufferAttribute:!0,copy:function(t){return dt.prototype.copy.call(this,t),this.meshPerAttribute=t.meshPerAttribute,this}}),Object.assign($n.prototype,{linePrecision:1,set:function(t,e){this.ray.set(t,e)},setFromCamera:function(t,e){e&&e.isPerspectiveCamera?(this.ray.origin.setFromMatrixPosition(e.matrixWorld),this.ray.direction.set(t.x,t.y,.5).unproject(e).sub(this.ray.origin).normalize()):e&&e.isOrthographicCamera?(this.ray.origin.set(t.x,t.y,(e.near+e.far)/(e.near-e.far)).unproject(e),this.ray.direction.set(0,0,-1).transformDirection(e.matrixWorld)):console.error("THREE.Raycaster: Unsupported camera type.")},intersectObject:function(t,e){var i=[];return er(t,this,i,e),i.sort(tr),i},intersectObjects:function(t,e){var i=[];if(!1===Array.isArray(t))return console.warn("THREE.Raycaster.intersectObjects: objects is not an Array."),i;for(var n=0,r=t.length;n<r;n++)er(t[n],this,i,e);return i.sort(tr),i}}),Object.assign(ir.prototype,{start:function(){this.startTime=("undefined"==typeof performance?Date:performance).now(),this.oldTime=this.startTime,this.elapsedTime=0,this.running=!0},stop:function(){this.getElapsedTime(),this.running=!1},getElapsedTime:function(){return this.getDelta(),this.elapsedTime},getDelta:function(){var t=0;if(this.autoStart&&!this.running)return this.start(),0;if(this.running){var e=("undefined"==typeof performance?Date:performance).now();t=(e-this.oldTime)/1e3,this.oldTime=e,this.elapsedTime+=t}return t}}),Object.assign(nr.prototype,{set:function(t,e,i){return this.radius=t,this.phi=e,this.theta=i,this},clone:function(){return(new this.constructor).copy(this)},copy:function(t){return this.radius=t.radius,this.phi=t.phi,this.theta=t.theta,this},makeSafe:function(){return this.phi=Math.max(1e-6,Math.min(Math.PI-1e-6,this.phi)),this},setFromVector3:function(t){return this.radius=t.length(),0===this.radius?(this.theta=0,this.phi=0):(this.theta=Math.atan2(t.x,t.z),this.phi=Math.acos(hs.clamp(t.y/this.radius,-1,1))),this}}),Object.assign(rr.prototype,{set:function(t,e,i){return this.radius=t,this.theta=e,this.y=i,this},clone:function(){return(new this.constructor).copy(this)},copy:function(t){return this.radius=t.radius,this.theta=t.theta,this.y=t.y,this},setFromVector3:function(t){return this.radius=Math.sqrt(t.x*t.x+t.z*t.z),this.theta=Math.atan2(t.x,t.z),this.y=t.y,this}}),ar.prototype=Object.create(Lt.prototype),ar.prototype.constructor=ar,ar.prototype.createAnimation=function(t,e,i,n){var r={start:e,end:i,length:i-e+1,fps:n,duration:(i-e)/n,lastFrame:0,currentFrame:0,active:!1,time:0,direction:1,weight:1,directionBackwards:!1,mirroredLoop:!1};this.animationsMap[t]=r,this.animationsList.push(r)},ar.prototype.autoCreateAnimations=function(t){for(var e,i=/([a-z]+)_?(\d+)/i,n={},r=this.geometry,a=0,o=r.morphTargets.length;a<o;a++){var s=r.morphTargets[a],c=s.name.match(i);if(c&&c.length>1){var h=c[1];n[h]||(n[h]={start:1/0,end:-1/0});var l=n[h];a<l.start&&(l.start=a),a>l.end&&(l.end=a),e||(e=h)}}for(var h in n){var l=n[h];this.createAnimation(h,l.start,l.end,t)}this.firstAnimation=e},ar.prototype.setAnimationDirectionForward=function(t){var e=this.animationsMap[t];e&&(e.direction=1,e.directionBackwards=!1)},ar.prototype.setAnimationDirectionBackward=function(t){var e=this.animationsMap[t];e&&(e.direction=-1,e.directionBackwards=!0)},ar.prototype.setAnimationFPS=function(t,e){var i=this.animationsMap[t];i&&(i.fps=e,i.duration=(i.end-i.start)/i.fps)},ar.prototype.setAnimationDuration=function(t,e){var i=this.animationsMap[t];i&&(i.duration=e,i.fps=(i.end-i.start)/i.duration)},ar.prototype.setAnimationWeight=function(t,e){var i=this.animationsMap[t];i&&(i.weight=e)},ar.prototype.setAnimationTime=function(t,e){var i=this.animationsMap[t];i&&(i.time=e)},ar.prototype.getAnimationTime=function(t){var e=0,i=this.animationsMap[t];return i&&(e=i.time),e},ar.prototype.getAnimationDuration=function(t){var e=-1,i=this.animationsMap[t];return i&&(e=i.duration),e},ar.prototype.playAnimation=function(t){var e=this.animationsMap[t];e?(e.time=0,e.active=!0):console.warn("THREE.MorphBlendMesh: animation["+t+"] undefined in .playAnimation()")},ar.prototype.stopAnimation=function(t){var e=this.animationsMap[t];e&&(e.active=!1)},ar.prototype.update=function(t){for(var e=0,i=this.animationsList.length;e<i;e++){var n=this.animationsList[e];if(n.active){var r=n.duration/n.length;n.time+=n.direction*t,n.mirroredLoop?(n.time>n.duration||n.time<0)&&(n.direction*=-1,n.time>n.duration&&(n.time=n.duration,n.directionBackwards=!0),n.time<0&&(n.time=0,n.directionBackwards=!1)):(n.time=n.time%n.duration,n.time<0&&(n.time+=n.duration))
;var a=n.start+hs.clamp(Math.floor(n.time/r),0,n.length-1),o=n.weight;a!==n.currentFrame&&(this.morphTargetInfluences[n.lastFrame]=0,this.morphTargetInfluences[n.currentFrame]=1*o,this.morphTargetInfluences[a]=0,n.lastFrame=n.currentFrame,n.currentFrame=a);var s=n.time%r/r;n.directionBackwards&&(s=1-s),n.currentFrame!==n.lastFrame?(this.morphTargetInfluences[n.currentFrame]=s*o,this.morphTargetInfluences[n.lastFrame]=(1-s)*o):this.morphTargetInfluences[n.currentFrame]=o}}},or.prototype=Object.create(ct.prototype),or.prototype.constructor=or,or.prototype.isImmediateRenderObject=!0,sr.prototype=Object.create(Se.prototype),sr.prototype.constructor=sr,sr.prototype.update=function(){var t=new c,e=new c,i=new et;return function(){var n=["a","b","c"];this.object.updateMatrixWorld(!0),i.getNormalMatrix(this.object.matrixWorld);var r=this.object.matrixWorld,a=this.geometry.attributes.position,o=this.object.geometry;if(o&&o.isGeometry)for(var s=o.vertices,c=o.faces,h=0,l=0,u=c.length;l<u;l++)for(var p=c[l],d=0,f=p.vertexNormals.length;d<f;d++){var m=s[p[n[d]]],v=p.vertexNormals[d];t.copy(m).applyMatrix4(r),e.copy(v).applyMatrix3(i).normalize().multiplyScalar(this.size).add(t),a.setXYZ(h,t.x,t.y,t.z),h+=1,a.setXYZ(h,e.x,e.y,e.z),h+=1}else if(o&&o.isBufferGeometry)for(var g=o.attributes.position,y=o.attributes.normal,h=0,d=0,f=g.count;d<f;d++)t.set(g.getX(d),g.getY(d),g.getZ(d)).applyMatrix4(r),e.set(y.getX(d),y.getY(d),y.getZ(d)),e.applyMatrix3(i).normalize().multiplyScalar(this.size).add(t),a.setXYZ(h,t.x,t.y,t.z),h+=1,a.setXYZ(h,e.x,e.y,e.z),h+=1;a.needsUpdate=!0}}(),cr.prototype=Object.create(ct.prototype),cr.prototype.constructor=cr,cr.prototype.dispose=function(){this.cone.geometry.dispose(),this.cone.material.dispose()},cr.prototype.update=function(){var t=new c,e=new c;return function(){var i=this.light.distance?this.light.distance:1e3,n=i*Math.tan(this.light.angle);this.cone.scale.set(n,n,i),t.setFromMatrixPosition(this.light.matrixWorld),e.setFromMatrixPosition(this.light.target.matrixWorld),this.cone.lookAt(e.sub(t)),this.cone.material.color.copy(this.light.color)}}(),hr.prototype=Object.create(Se.prototype),hr.prototype.constructor=hr,hr.prototype.getBoneList=function(t){var e=[];t&&t.isBone&&e.push(t);for(var i=0;i<t.children.length;i++)e.push.apply(e,this.getBoneList(t.children[i]));return e},hr.prototype.update=function(){var t=new c,e=new h,i=new h;return function(){var n=this.geometry,r=n.getAttribute("position");i.getInverse(this.root.matrixWorld);for(var a=0,o=0;a<this.bones.length;a++){var s=this.bones[a];s.parent&&s.parent.isBone&&(e.multiplyMatrices(i,s.matrixWorld),t.setFromMatrixPosition(e),r.setXYZ(o,t.x,t.y,t.z),e.multiplyMatrices(i,s.parent.matrixWorld),t.setFromMatrixPosition(e),r.setXYZ(o+1,t.x,t.y,t.z),o+=2)}n.getAttribute("position").needsUpdate=!0}}(),lr.prototype=Object.create(Lt.prototype),lr.prototype.constructor=lr,lr.prototype.dispose=function(){this.geometry.dispose(),this.material.dispose()},lr.prototype.update=function(){this.material.color.copy(this.light.color)},ur.prototype=Object.create(ct.prototype),ur.prototype.constructor=ur,ur.prototype.dispose=function(){this.children[0].geometry.dispose(),this.children[0].material.dispose()},ur.prototype.update=function(){var t=this.children[0];t.material.color.copy(this.light.color);var e=.5*this.light.width,i=.5*this.light.height,n=t.geometry.attributes.position,r=n.array;r[0]=e,r[1]=-i,r[2]=0,r[3]=e,r[4]=i,r[5]=0,r[6]=-e,r[7]=i,r[8]=0,r[9]=-e,r[10]=-i,r[11]=0,r[12]=e,r[13]=-i,r[14]=0,n.needsUpdate=!0},pr.prototype=Object.create(ct.prototype),pr.prototype.constructor=pr,pr.prototype.dispose=function(){this.children[0].geometry.dispose(),this.children[0].material.dispose()},pr.prototype.update=function(){var t=new c,e=new X,i=new X;return function(){var n=this.children[0],r=n.geometry.getAttribute("color");e.copy(this.light.color),i.copy(this.light.groundColor);for(var a=0,o=r.count;a<o;a++){var s=a<o/2?e:i;r.setXYZ(a,s.r,s.g,s.b)}n.lookAt(t.setFromMatrixPosition(this.light.matrixWorld).negate()),r.needsUpdate=!0}}(),dr.prototype=Object.create(Se.prototype),dr.prototype.constructor=dr,fr.prototype=Object.create(Se.prototype),fr.prototype.constructor=fr,mr.prototype=Object.create(Se.prototype),mr.prototype.constructor=mr,mr.prototype.update=function(){var t=new c,e=new c,i=new et;return function(){this.object.updateMatrixWorld(!0),i.getNormalMatrix(this.object.matrixWorld);for(var n=this.object.matrixWorld,r=this.geometry.attributes.position,a=this.object.geometry,o=a.vertices,s=a.faces,c=0,h=0,l=s.length;h<l;h++){var u=s[h],p=u.normal;t.copy(o[u.a]).add(o[u.b]).add(o[u.c]).divideScalar(3).applyMatrix4(n),e.copy(p).applyMatrix3(i).normalize().multiplyScalar(this.size).add(t),r.setXYZ(c,t.x,t.y,t.z),c+=1,r.setXYZ(c,e.x,e.y,e.z),c+=1}r.needsUpdate=!0}}(),vr.prototype=Object.create(ct.prototype),vr.prototype.constructor=vr,vr.prototype.dispose=function(){var t=this.children[0],e=this.children[1];t.geometry.dispose(),t.material.dispose(),e.geometry.dispose(),e.material.dispose()},vr.prototype.update=function(){var t=new c,e=new c,i=new c;return function(){t.setFromMatrixPosition(this.light.matrixWorld),e.setFromMatrixPosition(this.light.target.matrixWorld),i.subVectors(e,t);var n=this.children[0],r=this.children[1];n.lookAt(i),n.material.color.copy(this.light.color),r.lookAt(i),r.scale.z=i.length()}}(),gr.prototype=Object.create(Se.prototype),gr.prototype.constructor=gr,gr.prototype.update=function(){function t(t,a,o,s){n.set(a,o,s).unproject(r);var c=i[t];if(void 0!==c)for(var h=e.getAttribute("position"),l=0,u=c.length;l<u;l++)h.setXYZ(c[l],n.x,n.y,n.z)}var e,i,n=new c,r=new Ut;return function(){e=this.geometry,i=this.pointMap;r.projectionMatrix.copy(this.camera.projectionMatrix),t("c",0,0,-1),t("t",0,0,1),t("n1",-1,-1,-1),t("n2",1,-1,-1),t("n3",-1,1,-1),t("n4",1,1,-1),t("f1",-1,-1,1),t("f2",1,-1,1),t("f3",-1,1,1),t("f4",1,1,1),t("u1",.7,1.1,-1),t("u2",-.7,1.1,-1),t("u3",0,2,-1),t("cf1",-1,0,1),t("cf2",1,0,1),t("cf3",0,-1,1),t("cf4",0,1,1),t("cn1",-1,0,-1),t("cn2",1,0,-1),t("cn3",0,-1,-1),t("cn4",0,1,-1),e.getAttribute("position").needsUpdate=!0}}(),yr.prototype=Object.create(Se.prototype),yr.prototype.constructor=yr,yr.prototype.update=function(){var t=new $;return function(e){if(void 0!==e&&console.warn("THREE.BoxHelper: .update() has no longer arguments."),void 0!==this.object&&t.setFromObject(this.object),!t.isEmpty()){var i=t.min,n=t.max,r=this.geometry.attributes.position,a=r.array;a[0]=n.x,a[1]=n.y,a[2]=n.z,a[3]=i.x,a[4]=n.y,a[5]=n.z,a[6]=i.x,a[7]=i.y,a[8]=n.z,a[9]=n.x,a[10]=i.y,a[11]=n.z,a[12]=n.x,a[13]=n.y,a[14]=i.z,a[15]=i.x,a[16]=n.y,a[17]=i.z,a[18]=i.x,a[19]=i.y,a[20]=i.z,a[21]=n.x,a[22]=i.y,a[23]=i.z,r.needsUpdate=!0,this.geometry.computeBoundingSphere()}}}(),yr.prototype.setFromObject=function(t){return this.object=t,this.update(),this};var Hs,Vs;xr.prototype=Object.create(ct.prototype),xr.prototype.constructor=xr,xr.prototype.setDirection=function(){var t,e=new c;return function(i){i.y>.99999?this.quaternion.set(0,0,0,1):i.y<-.99999?this.quaternion.set(1,0,0,0):(e.set(i.z,0,-i.x).normalize(),t=Math.acos(i.y),this.quaternion.setFromAxisAngle(e,t))}}(),xr.prototype.setLength=function(t,e,i){void 0===e&&(e=.2*t),void 0===i&&(i=.2*e),this.line.scale.set(1,Math.max(0,t-e),1),this.line.updateMatrix(),this.cone.scale.set(i,e,i),this.cone.position.y=t,this.cone.updateMatrix()},xr.prototype.setColor=function(t){this.line.material.color.copy(t),this.cone.material.color.copy(t)},br.prototype=Object.create(Se.prototype),br.prototype.constructor=br;var ks=new c,js=new _r,Ws=new _r,Xs=new _r;wr.prototype=Object.create(_n.prototype),wr.prototype.constructor=wr,wr.prototype.getPoint=function(t){var e=this.points,i=e.length;i<2&&console.log("duh, you need at least 2 points");var n=(i-(this.closed?0:1))*t,r=Math.floor(n),a=n-r;this.closed?r+=r>0?0:(Math.floor(Math.abs(r)/e.length)+1)*e.length:0===a&&r===i-1&&(r=i-2,a=1);var o,s,h,l;if(this.closed||r>0?o=e[(r-1)%i]:(ks.subVectors(e[0],e[1]).add(e[0]),o=ks),s=e[r%i],h=e[(r+1)%i],this.closed||r+2<i?l=e[(r+2)%i]:(ks.subVectors(e[i-1],e[i-2]).add(e[i-1]),l=ks),void 0===this.type||"centripetal"===this.type||"chordal"===this.type){var u="chordal"===this.type?.5:.25,p=Math.pow(o.distanceToSquared(s),u),d=Math.pow(s.distanceToSquared(h),u),f=Math.pow(h.distanceToSquared(l),u);d<1e-4&&(d=1),p<1e-4&&(p=d),f<1e-4&&(f=d),js.initNonuniformCatmullRom(o.x,s.x,h.x,l.x,p,d,f),Ws.initNonuniformCatmullRom(o.y,s.y,h.y,l.y,p,d,f),Xs.initNonuniformCatmullRom(o.z,s.z,h.z,l.z,p,d,f)}else if("catmullrom"===this.type){var m=void 0!==this.tension?this.tension:.5;js.initCatmullRom(o.x,s.x,h.x,l.x,m),Ws.initCatmullRom(o.y,s.y,h.y,l.y,m),Xs.initCatmullRom(o.z,s.z,h.z,l.z,m)}return new c(js.calc(a),Ws.calc(a),Xs.calc(a))},Mr.prototype=Object.create(_n.prototype),Mr.prototype.constructor=Mr,Mr.prototype.getPoint=function(t){var e=this.v0,i=this.v1,n=this.v2,r=this.v3;return new c(bn(t,e.x,i.x,n.x,r.x),bn(t,e.y,i.y,n.y,r.y),bn(t,e.z,i.z,n.z,r.z))},Er.prototype=Object.create(_n.prototype),Er.prototype.constructor=Er,Er.prototype.getPoint=function(t){var e=this.v0,i=this.v1,n=this.v2;return new c(mn(t,e.x,i.x,n.x),mn(t,e.y,i.y,n.y),mn(t,e.z,i.z,n.z))},Tr.prototype=Object.create(_n.prototype),Tr.prototype.constructor=Tr,Tr.prototype.getPoint=function(t){if(1===t)return this.v2.clone();var e=new c;return e.subVectors(this.v2,this.v1),e.multiplyScalar(t),e.add(this.v1),e},Sr.prototype=Object.create(En.prototype),Sr.prototype.constructor=Sr;var qs={createMultiMaterialObject:function(t,e){for(var i=new Pe,n=0,r=e.length;n<r;n++)i.add(new Lt(t,e[n]));return i},detach:function(t,e,i){t.applyMatrix(e.matrixWorld),e.remove(t),i.add(t)},attach:function(t,e,i){var n=new h;n.getInverse(i.matrixWorld),t.applyMatrix(n),e.remove(t),i.add(t)}};_n.create=function(t,e){return console.log("THREE.Curve.create() has been deprecated"),t.prototype=Object.create(_n.prototype),t.prototype.constructor=t,t.prototype.getPoint=e,t},qr.prototype=Object.create(wr.prototype),Yr.prototype=Object.create(wr.prototype),Zr.prototype=Object.create(wr.prototype),Object.assign(Zr.prototype,{initFromArray:function(t){console.error("THREE.Spline: .initFromArray() has been removed.")},getControlPointsArray:function(t){console.error("THREE.Spline: .getControlPointsArray() has been removed.")},reparametrizeByArcLength:function(t){console.error("THREE.Spline: .reparametrizeByArcLength() has been removed.")}}),dr.prototype.setColors=function(){console.error("THREE.GridHelper: setColors() has been deprecated, pass them in the constructor instead.")},Object.assign(q.prototype,{center:function(t){return console.warn("THREE.Box2: .center() has been renamed to .getCenter()."),this.getCenter(t)},empty:function(){return console.warn("THREE.Box2: .empty() has been renamed to .isEmpty()."),this.isEmpty()},isIntersectionBox:function(t){return console.warn("THREE.Box2: .isIntersectionBox() has been renamed to .intersectsBox()."),this.intersectsBox(t)},size:function(t){return console.warn("THREE.Box2: .size() has been renamed to .getSize()."),this.getSize(t)}}),Object.assign($.prototype,{center:function(t){return console.warn("THREE.Box3: .center() has been renamed to .getCenter()."),this.getCenter(t)},empty:function(){return console.warn("THREE.Box3: .empty() has been renamed to .isEmpty()."),this.isEmpty()},isIntersectionBox:function(t){return console.warn("THREE.Box3: .isIntersectionBox() has been renamed to .intersectsBox()."),this.intersectsBox(t)},isIntersectionSphere:function(t){return console.warn("THREE.Box3: .isIntersectionSphere() has been renamed to .intersectsSphere()."),this.intersectsSphere(t)},size:function(t){return console.warn("THREE.Box3: .size() has been renamed to .getSize()."),this.getSize(t)}}),ht.prototype.center=function(t){return console.warn("THREE.Line3: .center() has been renamed to .getCenter()."),this.getCenter(t)},hs.random16=function(){return console.warn("THREE.Math.random16() has been deprecated. Use Math.random() instead."),Math.random()},Object.assign(et.prototype,{flattenToArrayOffset:function(t,e){return console.warn("THREE.Matrix3: .flattenToArrayOffset() has been deprecated. Use .toArray() instead."),this.toArray(t,e)},multiplyVector3:function(t){return console.warn("THREE.Matrix3: .multiplyVector3() has been removed. Use vector.applyMatrix3( matrix ) instead."),t.applyMatrix3(this)},multiplyVector3Array:function(t){return console.warn("THREE.Matrix3: .multiplyVector3Array() has been renamed. Use matrix.applyToVector3Array( array ) instead."),this.applyToVector3Array(t)},applyToBuffer:function(t,e,i){return console.warn("THREE.Matrix3: .applyToBuffer() has been removed. Use matrix.applyToBufferAttribute( attribute ) instead."),this.applyToBufferAttribute(t)},applyToVector3Array:function(t,e,i){console.error("THREE.Matrix3: .applyToVector3Array() has been removed.")}}),Object.assign(h.prototype,{extractPosition:function(t){return console.warn("THREE.Matrix4: .extractPosition() has been renamed to .copyPosition()."),this.copyPosition(t)},flattenToArrayOffset:function(t,e){return console.warn("THREE.Matrix4: .flattenToArrayOffset() has been deprecated. Use .toArray() instead."),this.toArray(t,e)},getPosition:function(){var t;return function(){return void 0===t&&(t=new c),console.warn("THREE.Matrix4: .getPosition() has been removed. Use Vector3.setFromMatrixPosition( matrix ) instead."),t.setFromMatrixColumn(this,3)}}(),setRotationFromQuaternion:function(t){return console.warn("THREE.Matrix4: .setRotationFromQuaternion() has been renamed to .makeRotationFromQuaternion()."),this.makeRotationFromQuaternion(t)},multiplyToArray:function(){console.warn("THREE.Matrix4: .multiplyToArray() has been removed.")},multiplyVector3:function(t){return console.warn("THREE.Matrix4: .multiplyVector3() has been removed. Use vector.applyMatrix4( matrix ) instead."),t.applyMatrix4(this)},multiplyVector4:function(t){return console.warn("THREE.Matrix4: .multiplyVector4() has been removed. Use vector.applyMatrix4( matrix ) instead."),t.applyMatrix4(this)},multiplyVector3Array:function(t){return console.warn("THREE.Matrix4: .multiplyVector3Array() has been renamed. Use matrix.applyToVector3Array( array ) instead."),this.applyToVector3Array(t)},rotateAxis:function(t){console.warn("THREE.Matrix4: .rotateAxis() has been removed. Use Vector3.transformDirection( matrix ) instead."),t.transformDirection(this)},crossVector:function(t){return console.warn("THREE.Matrix4: .crossVector() has been removed. Use vector.applyMatrix4( matrix ) instead."),t.applyMatrix4(this)},translate:function(){console.error("THREE.Matrix4: .translate() has been removed.")},rotateX:function(){console.error("THREE.Matrix4: .rotateX() has been removed.")},rotateY:function(){console.error("THREE.Matrix4: .rotateY() has been removed.")},rotateZ:function(){console.error("THREE.Matrix4: .rotateZ() has been removed.")},rotateByAxis:function(){console.error("THREE.Matrix4: .rotateByAxis() has been removed.")},applyToBuffer:function(t,e,i){return console.warn("THREE.Matrix4: .applyToBuffer() has been removed. Use matrix.applyToBufferAttribute( attribute ) instead."),this.applyToBufferAttribute(t)},applyToVector3Array:function(t,e,i){console.error("THREE.Matrix4: .applyToVector3Array() has been removed.")},makeFrustum:function(t,e,i,n,r,a){return console.warn("THREE.Matrix4: .makeFrustum() has been removed. Use .makePerspective( left, right, top, bottom, near, far ) instead."),this.makePerspective(t,e,n,i,r,a)}}),it.prototype.isIntersectionLine=function(t){return console.warn("THREE.Plane: .isIntersectionLine() has been renamed to .intersectsLine()."),this.intersectsLine(t)},s.prototype.multiplyVector3=function(t){return console.warn("THREE.Quaternion: .multiplyVector3() has been removed. Use is now vector.applyQuaternion( quaternion ) instead."),t.applyQuaternion(this)},Object.assign(at.prototype,{isIntersectionBox:function(t){return console.warn("THREE.Ray: .isIntersectionBox() has been renamed to .intersectsBox()."),this.intersectsBox(t)},isIntersectionPlane:function(t){return console.warn("THREE.Ray: .isIntersectionPlane() has been renamed to .intersectsPlane()."),this.intersectsPlane(t)},isIntersectionSphere:function(t){return console.warn("THREE.Ray: .isIntersectionSphere() has been renamed to .intersectsSphere()."),this.intersectsSphere(t)}}),Object.assign(Rn.prototype,{extrude:function(t){return console.warn("THREE.Shape: .extrude() has been removed. Use ExtrudeGeometry() instead."),new ti(this,t)},makeGeometry:function(t){return console.warn("THREE.Shape: .makeGeometry() has been removed. Use ShapeGeometry() instead."),new li(this,t)}}),Object.assign(i.prototype,{fromAttribute:function(t,e,i){return console.error("THREE.Vector2: .fromAttribute() has been renamed to .fromBufferAttribute()."),this.fromBufferAttribute(t,e,i)}}),Object.assign(c.prototype,{setEulerFromRotationMatrix:function(){console.error("THREE.Vector3: .setEulerFromRotationMatrix() has been removed. Use Euler.setFromRotationMatrix() instead.")},setEulerFromQuaternion:function(){console.error("THREE.Vector3: .setEulerFromQuaternion() has been removed. Use Euler.setFromQuaternion() instead.")},getPositionFromMatrix:function(t){return console.warn("THREE.Vector3: .getPositionFromMatrix() has been renamed to .setFromMatrixPosition()."),this.setFromMatrixPosition(t)},getScaleFromMatrix:function(t){return console.warn("THREE.Vector3: .getScaleFromMatrix() has been renamed to .setFromMatrixScale()."),this.setFromMatrixScale(t)},getColumnFromMatrix:function(t,e){return console.warn("THREE.Vector3: .getColumnFromMatrix() has been renamed to .setFromMatrixColumn()."),this.setFromMatrixColumn(e,t)},applyProjection:function(t){return console.warn("THREE.Vector3: .applyProjection() has been removed. Use .applyMatrix4( m ) instead."),this.applyMatrix4(t)},fromAttribute:function(t,e,i){return console.error("THREE.Vector3: .fromAttribute() has been renamed to .fromBufferAttribute()."),this.fromBufferAttribute(t,e,i)}}),Object.assign(r.prototype,{fromAttribute:function(t,e,i){return console.error("THREE.Vector4: .fromAttribute() has been renamed to .fromBufferAttribute()."),this.fromBufferAttribute(t,e,i)}}),St.prototype.computeTangents=function(){console.warn("THREE.Geometry: .computeTangents() has been removed.")},Object.assign(ct.prototype,{getChildByName:function(t){return console.warn("THREE.Object3D: .getChildByName() has been renamed to .getObjectByName()."),this.getObjectByName(t)},renderDepth:function(){console.warn("THREE.Object3D: .renderDepth has been removed. Use .renderOrder, instead.")},translate:function(t,e){return console.warn("THREE.Object3D: .translate() has been removed. Use .translateOnAxis( axis, distance ) instead."),this.translateOnAxis(e,t)}}),Object.defineProperties(ct.prototype,{eulerOrder:{get:function(){return console.warn("THREE.Object3D: .eulerOrder is now .rotation.order."),this.rotation.order},set:function(t){console.warn("THREE.Object3D: .eulerOrder is now .rotation.order."),this.rotation.order=t}},useQuaternion:{get:function(){console.warn("THREE.Object3D: .useQuaternion has been removed. The library now uses quaternions by default.")},set:function(){console.warn("THREE.Object3D: .useQuaternion has been removed. The library now uses quaternions by default.")}}}),Object.defineProperties(be.prototype,{objects:{get:function(){return console.warn("THREE.LOD: .objects has been renamed to .levels."),this.levels}}}),Object.defineProperty(_e.prototype,"useVertexTexture",{get:function(){console.warn("THREE.Skeleton: useVertexTexture has been removed.")},set:function(){console.warn("THREE.Skeleton: useVertexTexture has been removed.")}}),Object.defineProperty(_n.prototype,"__arcLengthDivisions",{get:function(){return console.warn("THREE.Curve: .__arcLengthDivisions is now .arcLengthDivisions."),this.arcLengthDivisions},set:function(t){console.warn("THREE.Curve: .__arcLengthDivisions is now .arcLengthDivisions."),this.arcLengthDivisions=t}}),Ot.prototype.setLens=function(t,e){console.warn("THREE.PerspectiveCamera.setLens is deprecated. Use .setFocalLength and .filmGauge for a photographic setup."),void 0!==e&&(this.filmGauge=e),this.setFocalLength(t)},Object.defineProperties(Di.prototype,{onlyShadow:{set:function(){console.warn("THREE.Light: .onlyShadow has been removed.")}},shadowCameraFov:{set:function(t){console.warn("THREE.Light: .shadowCameraFov is now .shadow.camera.fov."),this.shadow.camera.fov=t}},shadowCameraLeft:{set:function(t){console.warn("THREE.Light: .shadowCameraLeft is now .shadow.camera.left."),this.shadow.camera.left=t}},shadowCameraRight:{set:function(t){console.warn("THREE.Light: .shadowCameraRight is now .shadow.camera.right."),this.shadow.camera.right=t}},shadowCameraTop:{set:function(t){console.warn("THREE.Light: .shadowCameraTop is now .shadow.camera.top."),this.shadow.camera.top=t}},shadowCameraBottom:{set:function(t){console.warn("THREE.Light: .shadowCameraBottom is now .shadow.camera.bottom."),this.shadow.camera.bottom=t}},shadowCameraNear:{set:function(t){console.warn("THREE.Light: .shadowCameraNear is now .shadow.camera.near."),this.shadow.camera.near=t}},shadowCameraFar:{set:function(t){console.warn("THREE.Light: .shadowCameraFar is now .shadow.camera.far."),this.shadow.camera.far=t}},shadowCameraVisible:{set:function(){console.warn("THREE.Light: .shadowCameraVisible has been removed. Use new THREE.CameraHelper( light.shadow.camera ) instead.")}},shadowBias:{set:function(t){console.warn("THREE.Light: .shadowBias is now .shadow.bias."),this.shadow.bias=t}},shadowDarkness:{set:function(){console.warn("THREE.Light: .shadowDarkness has been removed.")}},shadowMapWidth:{set:function(t){console.warn("THREE.Light: .shadowMapWidth is now .shadow.mapSize.width."),this.shadow.mapSize.width=t}},shadowMapHeight:{set:function(t){console.warn("THREE.Light: .shadowMapHeight is now .shadow.mapSize.height."),this.shadow.mapSize.height=t}}}),Object.defineProperties(dt.prototype,{length:{get:function(){return console.warn("THREE.BufferAttribute: .length has been deprecated. Use .count instead."),this.array.length}}}),Object.assign(At.prototype,{addIndex:function(t){console.warn("THREE.BufferGeometry: .addIndex() has been renamed to .setIndex()."),this.setIndex(t)},addDrawCall:function(t,e,i){void 0!==i&&console.warn("THREE.BufferGeometry: .addDrawCall() no longer supports indexOffset."),console.warn("THREE.BufferGeometry: .addDrawCall() is now .addGroup()."),this.addGroup(t,e)},clearDrawCalls:function(){console.warn("THREE.BufferGeometry: .clearDrawCalls() is now .clearGroups()."),this.clearGroups()},computeTangents:function(){console.warn("THREE.BufferGeometry: .computeTangents() has been removed.")},computeOffsets:function(){console.warn("THREE.BufferGeometry: .computeOffsets() has been removed.")}}),Object.defineProperties(At.prototype,{drawcalls:{get:function(){return console.error("THREE.BufferGeometry: .drawcalls has been renamed to .groups."),this.groups}},offsets:{get:function(){return console.warn("THREE.BufferGeometry: .offsets has been renamed to .groups."),this.groups}}}),Object.defineProperties(qn.prototype,{dynamic:{set:function(){console.warn("THREE.Uniform: .dynamic has been removed. Use object.onBeforeRender() instead.")}},onUpdate:{value:function(){return console.warn("THREE.Uniform: .onUpdate() has been removed. Use object.onBeforeRender() instead."),this}}}),Object.defineProperties(J.prototype,{wrapAround:{get:function(){console.warn("THREE.Material: .wrapAround has been removed.")},set:function(){console.warn("THREE.Material: .wrapAround has been removed.")}},wrapRGB:{get:function(){return console.warn("THREE.Material: .wrapRGB has been removed."),new X}}}),Object.defineProperties(Mi.prototype,{metal:{get:function(){return console.warn("THREE.MeshPhongMaterial: .metal has been removed. Use THREE.MeshStandardMaterial instead."),!1},set:function(){console.warn("THREE.MeshPhongMaterial: .metal has been removed. Use THREE.MeshStandardMaterial instead")}}}),Object.defineProperties(Q.prototype,{derivatives:{get:function(){return console.warn("THREE.ShaderMaterial: .derivatives has been moved to .extensions.derivatives."),this.extensions.derivatives},set:function(t){console.warn("THREE. ShaderMaterial: .derivatives has been moved to .extensions.derivatives."),this.extensions.derivatives=t}}}),Object.assign(de.prototype,{getCurrentRenderTarget:function(){return console.warn("THREE.WebGLRenderer: .getCurrentRenderTarget() is now .getRenderTarget()."),this.getRenderTarget()},supportsFloatTextures:function(){return console.warn("THREE.WebGLRenderer: .supportsFloatTextures() is now .extensions.get( 'OES_texture_float' )."),this.extensions.get("OES_texture_float")},supportsHalfFloatTextures:function(){return console.warn("THREE.WebGLRenderer: .supportsHalfFloatTextures() is now .extensions.get( 'OES_texture_half_float' )."),this.extensions.get("OES_texture_half_float")},supportsStandardDerivatives:function(){return console.warn("THREE.WebGLRenderer: .supportsStandardDerivatives() is now .extensions.get( 'OES_standard_derivatives' )."),this.extensions.get("OES_standard_derivatives")},supportsCompressedTextureS3TC:function(){return console.warn("THREE.WebGLRenderer: .supportsCompressedTextureS3TC() is now .extensions.get( 'WEBGL_compressed_texture_s3tc' )."),this.extensions.get("WEBGL_compressed_texture_s3tc")},supportsCompressedTexturePVRTC:function(){return console.warn("THREE.WebGLRenderer: .supportsCompressedTexturePVRTC() is now .extensions.get( 'WEBGL_compressed_texture_pvrtc' )."),this.extensions.get("WEBGL_compressed_texture_pvrtc")},supportsBlendMinMax:function(){return console.warn("THREE.WebGLRenderer: .supportsBlendMinMax() is now .extensions.get( 'EXT_blend_minmax' )."),this.extensions.get("EXT_blend_minmax")},supportsVertexTextures:function(){return console.warn("THREE.WebGLRenderer: .supportsVertexTextures() is now .capabilities.vertexTextures."),this.capabilities.vertexTextures},supportsInstancedArrays:function(){return console.warn("THREE.WebGLRenderer: .supportsInstancedArrays() is now .extensions.get( 'ANGLE_instanced_arrays' )."),this.extensions.get("ANGLE_instanced_arrays")},enableScissorTest:function(t){console.warn("THREE.WebGLRenderer: .enableScissorTest() is now .setScissorTest()."),this.setScissorTest(t)},initMaterial:function(){console.warn("THREE.WebGLRenderer: .initMaterial() has been removed.")},addPrePlugin:function(){console.warn("THREE.WebGLRenderer: .addPrePlugin() has been removed.")},addPostPlugin:function(){console.warn("THREE.WebGLRenderer: .addPostPlugin() has been removed.")},updateShadowMap:function(){console.warn("THREE.WebGLRenderer: .updateShadowMap() has been removed.")}}),Object.defineProperties(de.prototype,{shadowMapEnabled:{get:function(){return this.shadowMap.enabled},set:function(t){console.warn("THREE.WebGLRenderer: .shadowMapEnabled is now .shadowMap.enabled."),this.shadowMap.enabled=t}},shadowMapType:{get:function(){return this.shadowMap.type},set:function(t){console.warn("THREE.WebGLRenderer: .shadowMapType is now .shadowMap.type."),this.shadowMap.type=t}},shadowMapCullFace:{get:function(){return this.shadowMap.cullFace},set:function(t){console.warn("THREE.WebGLRenderer: .shadowMapCullFace is now .shadowMap.cullFace."),this.shadowMap.cullFace=t}}}),Object.defineProperties(rt.prototype,{cullFace:{get:function(){return this.renderReverseSided?sa:oa},set:function(t){var e=t!==oa;console.warn("WebGLRenderer: .shadowMap.cullFace is deprecated. Set .shadowMap.renderReverseSided to "+e+"."),this.renderReverseSided=e}}}),Object.defineProperties(a.prototype,{wrapS:{get:function(){return console.warn("THREE.WebGLRenderTarget: .wrapS is now .texture.wrapS."),this.texture.wrapS},set:function(t){console.warn("THREE.WebGLRenderTarget: .wrapS is now .texture.wrapS."),this.texture.wrapS=t}},wrapT:{get:function(){return console.warn("THREE.WebGLRenderTarget: .wrapT is now .texture.wrapT."),this.texture.wrapT},set:function(t){console.warn("THREE.WebGLRenderTarget: .wrapT is now .texture.wrapT."),this.texture.wrapT=t}},magFilter:{get:function(){return console.warn("THREE.WebGLRenderTarget: .magFilter is now .texture.magFilter."),this.texture.magFilter},set:function(t){console.warn("THREE.WebGLRenderTarget: .magFilter is now .texture.magFilter."),this.texture.magFilter=t}},minFilter:{get:function(){return console.warn("THREE.WebGLRenderTarget: .minFilter is now .texture.minFilter."),this.texture.minFilter},set:function(t){console.warn("THREE.WebGLRenderTarget: .minFilter is now .texture.minFilter."),this.texture.minFilter=t}},anisotropy:{get:function(){return console.warn("THREE.WebGLRenderTarget: .anisotropy is now .texture.anisotropy."),this.texture.anisotropy},set:function(t){console.warn("THREE.WebGLRenderTarget: .anisotropy is now .texture.anisotropy."),this.texture.anisotropy=t}},offset:{get:function(){return console.warn("THREE.WebGLRenderTarget: .offset is now .texture.offset."),this.texture.offset},set:function(t){console.warn("THREE.WebGLRenderTarget: .offset is now .texture.offset."),this.texture.offset=t}},repeat:{get:function(){return console.warn("THREE.WebGLRenderTarget: .repeat is now .texture.repeat."),this.texture.repeat},set:function(t){console.warn("THREE.WebGLRenderTarget: .repeat is now .texture.repeat."),this.texture.repeat=t}},format:{get:function(){return console.warn("THREE.WebGLRenderTarget: .format is now .texture.format."),this.texture.format},set:function(t){console.warn("THREE.WebGLRenderTarget: .format is now .texture.format."),this.texture.format=t}},type:{get:function(){return console.warn("THREE.WebGLRenderTarget: .type is now .texture.type."),this.texture.type},set:function(t){console.warn("THREE.WebGLRenderTarget: .type is now .texture.type."),this.texture.type=t}},generateMipmaps:{get:function(){return console.warn("THREE.WebGLRenderTarget: .generateMipmaps is now .texture.generateMipmaps."),this.texture.generateMipmaps},set:function(t){console.warn("THREE.WebGLRenderTarget: .generateMipmaps is now .texture.generateMipmaps."),this.texture.generateMipmaps=t}}}),Bn.prototype.load=function(t){console.warn("THREE.Audio: .load has been deprecated. Use THREE.AudioLoader instead.");var e=this;return(new Un).load(t,function(t){e.setBuffer(t)}),this},Gn.prototype.getData=function(){return console.warn("THREE.AudioAnalyser: .getData() is now .getFrequencyData()."),this.getFrequencyData()};var Ys={merge:function(t,e,i){console.warn("THREE.GeometryUtils: .merge() has been moved to Geometry. Use geometry.merge( geometry2, matrix, materialIndexOffset ) instead.");var n;e.isMesh&&(e.matrixAutoUpdate&&e.updateMatrix(),n=e.matrix,e=e.geometry),t.merge(e,n,i)},center:function(t){return console.warn("THREE.GeometryUtils: .center() has been moved to Geometry. Use geometry.center() instead."),t.center()}},Zs={crossOrigin:void 0,loadTexture:function(t,e,i,n){console.warn("THREE.ImageUtils.loadTexture has been deprecated. Use THREE.TextureLoader() instead.");var r=new Oi;r.setCrossOrigin(this.crossOrigin);var a=r.load(t,i,void 0,n);return e&&(a.mapping=e),a},loadTextureCube:function(t,e,i,n){console.warn("THREE.ImageUtils.loadTextureCube has been deprecated. Use THREE.CubeTextureLoader() instead.");var r=new Ui;r.setCrossOrigin(this.crossOrigin);var a=r.load(t,i,void 0,n);return e&&(a.mapping=e),a},loadCompressedTexture:function(){console.error("THREE.ImageUtils.loadCompressedTexture has been removed. Use THREE.DDSLoader instead.")},loadCompressedTextureCube:function(){console.error("THREE.ImageUtils.loadCompressedTextureCube has been removed. Use THREE.DDSLoader instead.")}};t.WebGLRenderTargetCube=o,t.WebGLRenderTarget=a,t.WebGLRenderer=de,t.ShaderLib=ws,t.UniformsLib=xs,t.UniformsUtils=bs,t.ShaderChunk=_s,t.FogExp2=fe,t.Fog=me,t.Scene=ve,t.LensFlare=ge,t.Sprite=xe,t.LOD=be,t.SkinnedMesh=Me,t.Skeleton=_e,t.Bone=we,t.Mesh=Lt,t.LineSegments=Se,t.LineLoop=Ae,t.Line=Te,t.Points=Re,t.Group=Pe,t.VideoTexture=Ce,t.DataTexture=l,
t.CompressedTexture=Ie,t.CubeTexture=u,t.CanvasTexture=Ue,t.DepthTexture=Oe,t.Texture=n,t.CompressedTextureLoader=Pi,t.DataTextureLoader=Ci,t.CubeTextureLoader=Ui,t.TextureLoader=Oi,t.ObjectLoader=ln,t.MaterialLoader=on,t.BufferGeometryLoader=sn,t.DefaultLoadingManager=Cs,t.LoadingManager=Li,t.JSONLoader=hn,t.ImageLoader=Ii,t.FontLoader=In,t.FileLoader=Ri,t.Loader=cn,t.Cache=Ps,t.AudioLoader=Un,t.SpotLightShadow=Bi,t.SpotLight=zi,t.PointLight=Gi,t.RectAreaLight=ji,t.HemisphereLight=Ni,t.DirectionalLightShadow=Hi,t.DirectionalLight=Vi,t.AmbientLight=ki,t.LightShadow=Fi,t.Light=Di,t.StereoCamera=On,t.PerspectiveCamera=Ot,t.OrthographicCamera=Dt,t.CubeCamera=Dn,t.ArrayCamera=Nn,t.Camera=Ut,t.AudioListener=Fn,t.PositionalAudio=zn,t.AudioContext=Gs,t.AudioAnalyser=Gn,t.Audio=Bn,t.VectorKeyframeTrack=Ji,t.StringKeyframeTrack=tn,t.QuaternionKeyframeTrack=Ki,t.NumberKeyframeTrack=$i,t.ColorKeyframeTrack=nn,t.BooleanKeyframeTrack=en,t.PropertyMixer=Hn,t.PropertyBinding=kn,t.KeyframeTrack=rn,t.AnimationUtils=Is,t.AnimationObjectGroup=jn,t.AnimationMixer=Xn,t.AnimationClip=an,t.Uniform=qn,t.InstancedBufferGeometry=Yn,t.BufferGeometry=At,t.GeometryIdCount=Tt,t.Geometry=St,t.InterleavedBufferAttribute=Zn,t.InstancedInterleavedBuffer=Qn,t.InterleavedBuffer=Jn,t.InstancedBufferAttribute=Kn,t.Face3=ut,t.Object3D=ct,t.Raycaster=$n,t.Layers=st,t.EventDispatcher=e,t.Clock=ir,t.QuaternionLinearInterpolant=Qi,t.LinearInterpolant=qi,t.DiscreteInterpolant=Yi,t.CubicInterpolant=Xi,t.Interpolant=Wi,t.Triangle=lt,t.Math=hs,t.Spherical=nr,t.Cylindrical=rr,t.Plane=it,t.Frustum=nt,t.Sphere=tt,t.Ray=at,t.Matrix4=h,t.Matrix3=et,t.Box3=$,t.Box2=q,t.Line3=ht,t.Euler=ot,t.Vector4=r,t.Vector3=c,t.Vector2=i,t.Quaternion=s,t.Color=X,t.MorphBlendMesh=ar,t.ImmediateRenderObject=or,t.VertexNormalsHelper=sr,t.SpotLightHelper=cr,t.SkeletonHelper=hr,t.PointLightHelper=lr,t.RectAreaLightHelper=ur,t.HemisphereLightHelper=pr,t.GridHelper=dr,t.PolarGridHelper=fr,t.FaceNormalsHelper=mr,t.DirectionalLightHelper=vr,t.CameraHelper=gr,t.BoxHelper=yr,t.ArrowHelper=xr,t.AxisHelper=br,t.CatmullRomCurve3=wr,t.CubicBezierCurve3=Mr,t.QuadraticBezierCurve3=Er,t.LineCurve3=Tr,t.ArcCurve=Sr,t.EllipseCurve=En,t.SplineCurve=Tn,t.CubicBezierCurve=Sn,t.QuadraticBezierCurve=An,t.LineCurve=wn,t.Shape=Rn,t.Path=Ln,t.ShapePath=Pn,t.Font=Cn,t.CurvePath=Mn,t.Curve=_n,t.ShapeUtils=As,t.SceneUtils=qs,t.WireframeGeometry=De,t.ParametricGeometry=Ne,t.ParametricBufferGeometry=Fe,t.TetrahedronGeometry=Ge,t.TetrahedronBufferGeometry=He,t.OctahedronGeometry=Ve,t.OctahedronBufferGeometry=ke,t.IcosahedronGeometry=je,t.IcosahedronBufferGeometry=We,t.DodecahedronGeometry=Xe,t.DodecahedronBufferGeometry=qe,t.PolyhedronGeometry=Be,t.PolyhedronBufferGeometry=ze,t.TubeGeometry=Ye,t.TubeBufferGeometry=Ze,t.TorusKnotGeometry=Je,t.TorusKnotBufferGeometry=Qe,t.TorusGeometry=Ke,t.TorusBufferGeometry=$e,t.TextGeometry=ii,t.TextBufferGeometry=ni,t.SphereGeometry=ri,t.SphereBufferGeometry=ai,t.RingGeometry=oi,t.RingBufferGeometry=si,t.PlaneGeometry=Ct,t.PlaneBufferGeometry=It,t.LatheGeometry=ci,t.LatheBufferGeometry=hi,t.ShapeGeometry=li,t.ShapeBufferGeometry=ui,t.ExtrudeGeometry=ti,t.ExtrudeBufferGeometry=ei,t.EdgesGeometry=pi,t.ConeGeometry=mi,t.ConeBufferGeometry=vi,t.CylinderGeometry=di,t.CylinderBufferGeometry=fi,t.CircleGeometry=gi,t.CircleBufferGeometry=yi,t.BoxGeometry=Rt,t.BoxBufferGeometry=Pt,t.ShadowMaterial=xi,t.SpriteMaterial=ye,t.RawShaderMaterial=bi,t.ShaderMaterial=Q,t.PointsMaterial=Le,t.MeshPhysicalMaterial=wi;t.MeshStandardMaterial=_i,t.MeshPhongMaterial=Mi,t.MeshToonMaterial=Ei,t.MeshNormalMaterial=Ti,t.MeshLambertMaterial=Si,t.MeshDepthMaterial=K,t.MeshBasicMaterial=pt,t.LineDashedMaterial=Ai,t.LineBasicMaterial=Ee,t.Material=J,t.Float64BufferAttribute=wt,t.Float32BufferAttribute=_t,t.Uint32BufferAttribute=bt,t.Int32BufferAttribute=xt,t.Uint16BufferAttribute=yt,t.Int16BufferAttribute=gt,t.Uint8ClampedBufferAttribute=vt,t.Uint8BufferAttribute=mt,t.Int8BufferAttribute=ft,t.BufferAttribute=dt,t.REVISION=na,t.MOUSE=ra,t.CullFaceNone=aa,t.CullFaceBack=oa,t.CullFaceFront=sa,t.CullFaceFrontBack=3,t.FrontFaceDirectionCW=ca,t.FrontFaceDirectionCCW=1,t.BasicShadowMap=0,t.PCFShadowMap=ha,t.PCFSoftShadowMap=la,t.FrontSide=ua,t.BackSide=pa,t.DoubleSide=da,t.FlatShading=fa,t.SmoothShading=ma,t.NoColors=va,t.FaceColors=ga,t.VertexColors=ya,t.NoBlending=xa,t.NormalBlending=ba,t.AdditiveBlending=_a,t.SubtractiveBlending=wa,t.MultiplyBlending=Ma,t.CustomBlending=Ea,t.AddEquation=Ta,t.SubtractEquation=Sa,t.ReverseSubtractEquation=Aa,t.MinEquation=La,t.MaxEquation=Ra,t.ZeroFactor=Pa,t.OneFactor=Ca,t.SrcColorFactor=Ia,t.OneMinusSrcColorFactor=Ua,t.SrcAlphaFactor=Oa,t.OneMinusSrcAlphaFactor=Da,t.DstAlphaFactor=Na,t.OneMinusDstAlphaFactor=Fa,t.DstColorFactor=Ba,t.OneMinusDstColorFactor=za,t.SrcAlphaSaturateFactor=Ga,t.NeverDepth=Ha,t.AlwaysDepth=Va,t.LessDepth=ka,t.LessEqualDepth=ja,t.EqualDepth=Wa,t.GreaterEqualDepth=Xa,t.GreaterDepth=qa,t.NotEqualDepth=Ya,t.MultiplyOperation=Za,t.MixOperation=Ja,t.AddOperation=Qa,t.NoToneMapping=Ka,t.LinearToneMapping=$a,t.ReinhardToneMapping=to,t.Uncharted2ToneMapping=eo,t.CineonToneMapping=io,t.UVMapping=300,t.CubeReflectionMapping=no,t.CubeRefractionMapping=ro,t.EquirectangularReflectionMapping=ao,t.EquirectangularRefractionMapping=oo,t.SphericalReflectionMapping=so,t.CubeUVReflectionMapping=co,t.CubeUVRefractionMapping=ho,t.RepeatWrapping=lo,t.ClampToEdgeWrapping=uo,t.MirroredRepeatWrapping=po,t.NearestFilter=fo,t.NearestMipMapNearestFilter=mo,t.NearestMipMapLinearFilter=vo,t.LinearFilter=go,t.LinearMipMapNearestFilter=yo,t.LinearMipMapLinearFilter=xo,t.UnsignedByteType=bo,t.ByteType=_o,t.ShortType=wo,t.UnsignedShortType=Mo,t.IntType=Eo,t.UnsignedIntType=To,t.FloatType=So,t.HalfFloatType=Ao,t.UnsignedShort4444Type=Lo,t.UnsignedShort5551Type=Ro,t.UnsignedShort565Type=Po,t.UnsignedInt248Type=Co,t.AlphaFormat=Io,t.RGBFormat=Uo,t.RGBAFormat=Oo,t.LuminanceFormat=Do,t.LuminanceAlphaFormat=No,t.RGBEFormat=Fo,t.DepthFormat=Bo,t.DepthStencilFormat=zo,t.RGB_S3TC_DXT1_Format=Go,t.RGBA_S3TC_DXT1_Format=Ho,t.RGBA_S3TC_DXT3_Format=Vo,t.RGBA_S3TC_DXT5_Format=ko,t.RGB_PVRTC_4BPPV1_Format=jo,t.RGB_PVRTC_2BPPV1_Format=Wo,t.RGBA_PVRTC_4BPPV1_Format=Xo,t.RGBA_PVRTC_2BPPV1_Format=qo,t.RGB_ETC1_Format=Yo,t.LoopOnce=2200,t.LoopRepeat=Zo,t.LoopPingPong=2202,t.InterpolateDiscrete=2300,t.InterpolateLinear=2301,t.InterpolateSmooth=2302,t.ZeroCurvatureEnding=Jo,t.ZeroSlopeEnding=2401,t.WrapAroundEnding=2402,t.TrianglesDrawMode=Qo,t.TriangleStripDrawMode=Ko,t.TriangleFanDrawMode=$o,t.LinearEncoding=ts,t.sRGBEncoding=es,t.GammaEncoding=is,t.RGBEEncoding=ns,t.LogLuvEncoding=3003,t.RGBM7Encoding=rs,t.RGBM16Encoding=as,t.RGBDEncoding=os,t.BasicDepthPacking=ss,t.RGBADepthPacking=cs,t.CubeGeometry=Rt,t.Face4=Ar,t.LineStrip=0,t.LinePieces=1,t.MeshFaceMaterial=Lr,t.MultiMaterial=Rr,t.PointCloud=Pr,t.Particle=Cr,t.ParticleSystem=Ir,t.PointCloudMaterial=Ur,t.ParticleBasicMaterial=Or,t.ParticleSystemMaterial=Dr,t.Vertex=Nr,t.DynamicBufferAttribute=Fr,t.Int8Attribute=Br,t.Uint8Attribute=zr,t.Uint8ClampedAttribute=Gr,t.Int16Attribute=Hr,t.Uint16Attribute=Vr,t.Int32Attribute=kr,t.Uint32Attribute=jr,t.Float32Attribute=Wr,t.Float64Attribute=Xr,t.ClosedSplineCurve3=qr,t.SplineCurve3=Yr,t.Spline=Zr,t.BoundingBoxHelper=Jr,t.EdgesHelper=Qr,t.WireframeHelper=Kr,t.XHRLoader=$r,t.BinaryTextureLoader=ta,t.GeometryUtils=Ys,t.ImageUtils=Zs,t.Projector=ea,t.CanvasRenderer=ia,Object.defineProperty(t,"__esModule",{value:!0})})},{}],36:[function(t,e,i){var n={create:t("gl-vec3/create"),add:t("gl-vec3/add"),dot:t("gl-vec3/dot"),sub:t("gl-vec3/subtract"),scale:t("gl-vec3/scale"),distance:t("gl-vec3/distance")};e.exports=t("./lib/build")(n)},{"./lib/build":37,"gl-vec3/add":22,"gl-vec3/create":24,"gl-vec3/distance":25,"gl-vec3/dot":26,"gl-vec3/scale":29,"gl-vec3/subtract":31}],37:[function(t,e,i){e.exports=function(t){function e(e,i){if(!e||2!==e.length)throw new Error("two points must be specified for the constraint");if(!e[0].position||!e[1].position)throw new Error("must specify verlet-point or similar, with { position }");this.points=e,this.stiffness=1,i&&"number"==typeof i.stiffness&&(this.stiffness=i.stiffness),i&&"number"==typeof i.restingDistance?this.restingDistance=i.restingDistance:this.restingDistance=t.distance(this.points[0].position,this.points[1].position)}var i=t.create(),n=t.create();return e.prototype.solve=function(){var e=this.points[0],r=this.points[1],a=e.position,o=r.position,s="number"==typeof e.mass?e.mass:1,c="number"==typeof r.mass?r.mass:1;t.sub(i,a,o);var h,l,u=Math.sqrt(t.dot(i,i)),p=0===u?this.restingDistance:(this.restingDistance-u)/u;if(0==s&&0==c)h=0,l=0;else if(0==s&&c>0)h=0,l=this.stiffness;else if(s>0&&0==c)h=this.stiffness,l=0;else{var d=1/s,f=1/c;h=d/(d+f)*this.stiffness,l=this.stiffness-h}return t.scale(n,i,h*p),t.add(a,a,n),t.scale(n,i,l*p),t.sub(o,o,n),u},function(t,i,n){return new e(t,i,n)}}},{}],38:[function(t,e,i){var n={create:t("gl-vec3/create"),sub:t("gl-vec3/subtract"),copy:t("gl-vec3/copy")};e.exports=t("./lib/build")(n)},{"./lib/build":39,"gl-vec3/copy":23,"gl-vec3/create":24,"gl-vec3/subtract":31}],39:[function(t,e,i){e.exports=function(t){function e(e){this.position=t.create(),this.previous=t.create(),this.acceleration=t.create(),this.mass=1,this.radius=0,e&&"number"==typeof e.mass&&(this.mass=e.mass),e&&"number"==typeof e.radius&&(this.radius=e.radius),e&&e.position&&t.copy(this.position,e.position),e&&(e.previous||e.position)&&t.copy(this.previous,e.previous||e.position),e&&e.acceleration&&t.copy(this.acceleration,e.acceleration)}return e.prototype.addForce=function(e){return t.sub(this.previous,this.previous,e),this},e.prototype.place=function(e){return t.copy(this.position,e),t.copy(this.previous,e),this},function(t){return new e(t)}}},{}],40:[function(t,e,i){var n={create:t("gl-vec3/create"),add:t("gl-vec3/add"),multiply:t("gl-vec3/multiply"),sub:t("gl-vec3/subtract"),scale:t("gl-vec3/scale"),copy:t("gl-vec3/copy"),sqrLen:t("gl-vec3/squaredLength"),fromValues:t("gl-vec3/fromValues")};e.exports=t("./lib/build")(n)},{"./lib/build":42,"gl-vec3/add":22,"gl-vec3/copy":23,"gl-vec3/create":24,"gl-vec3/fromValues":27,"gl-vec3/multiply":28,"gl-vec3/scale":29,"gl-vec3/squaredLength":30,"gl-vec3/subtract":31}],41:[function(t,e,i){e.exports=function(t){var e=t.fromValues(-1/0,-1/0,-1/0),i=t.fromValues(1/0,1/0,1/0),n=t.fromValues(1,1,1),r=t.create();return function(a,o,s,c,h){if(s||c){t.copy(r,n),s=s||e,c=c||i;var l=0,u=a.position.length,p=!1,d=a.radius||0;for(l=0;l<u;l++)"number"==typeof s[l]&&a.position[l]-d<s[l]&&(r[l]=-1,a.position[l]=s[l]+d,p=!0);for(l=0;l<u;l++)"number"==typeof c[l]&&a.position[l]+d>c[l]&&(r[l]=-1,a.position[l]=c[l]-d,p=!0);var f=t.sqrLen(o);if(p&&!(f<=1e-6)){var m=Math.sqrt(f);0!==m&&t.scale(o,o,1/m),t.scale(r,r,m*h),t.multiply(o,o,r)}}}}},{}],42:[function(t,e,i){var n=t("as-number"),r=(t("clamp"),t("./box-collision"));e.exports=function(t){function e(i){if(!(this instanceof e))return new e(i);i=i||{},this.gravity=i.gravity||t.create(),this.friction=n(i.friction,.98),this.min=i.min,this.max=i.max,this.bounce=n(i.bounce,1)}var i=r(t),a=t.create(),o=t.create(),s=t.create();return e.prototype.collision=function(t,e){i(t,e,this.min,this.max,this.bounce)},e.prototype.integratePoint=function(e,i){var n="number"==typeof e.mass?e.mass:1;if(0===n)return this.collision(e,s),void t.copy(e.acceleration,s);t.add(e.acceleration,e.acceleration,this.gravity),t.scale(e.acceleration,e.acceleration,n),t.sub(a,e.position,e.previous),t.scale(a,a,this.friction),this.collision(e,a),t.copy(e.previous,e.position);var r=i*i;t.scale(o,e.acceleration,.5*r),t.add(e.position,e.position,a),t.add(e.position,e.position,o),t.copy(e.acceleration,s)},e.prototype.integrate=function(t,e){for(var i=0;i<t.length;i++)this.integratePoint(t[i],e)},e}},{"./box-collision":41,"as-number":17,clamp:19}],43:[function(t,e,i){e.exports=function(t){t=t||{};var e=t.canvas||document.createElement("canvas");"number"==typeof t.width&&(e.width=t.width),"number"==typeof t.height&&(e.height=t.height);var i=t.attributes||t.attribs||{};try{gl=e.getContext("webgl",i)||e.getContext("experimental-webgl",i)}catch(t){gl=null}return gl}},{}],44:[function(t,e,i){function n(){for(var t={},e=0;e<arguments.length;e++){var i=arguments[e];for(var n in i)r.call(i,n)&&(t[n]=i[n])}return t}e.exports=n;var r=Object.prototype.hasOwnProperty},{}]},{},[1]);