aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--sunsistemo.js42
-rw-r--r--validation/validation.js32
2 files changed, 35 insertions, 39 deletions
diff --git a/sunsistemo.js b/sunsistemo.js
index 097b9ca..e2b3e78 100644
--- a/sunsistemo.js
+++ b/sunsistemo.js
@@ -1,22 +1,20 @@
-!function(t){function e(r){if(n[r])return n[r].exports;var i=n[r]={exports:{},id:r,loaded:!1};return t[r].call(i.exports,i,i.exports,e),i.loaded=!0,i.exports}var n={};return e.m=t,e.c=n,e.p="",e(0)}([function(t,e,n){"use strict";function r(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e["default"]=t,e}function i(t){if(Array.isArray(t)){for(var e=0,n=Array(t.length);e<t.length;e++)n[e]=t[e];return n}return Array.from(t)}function a(t){var e=!0,n=!1,r=void 0;try{for(var i,a=O[Symbol.iterator]();!(e=(i=a.next()).done);e=!0){var o=i.value;if(o.label===t)return o}}catch(s){n=!0,r=s}finally{try{!e&&a["return"]&&a["return"]()}finally{if(n)throw r}}var c=!0,u=!1,l=void 0;try{for(var h,f=I[Symbol.iterator]();!(c=(h=f.next()).done);c=!0){var p=h.value;if(p.label===t)return p}}catch(s){u=!0,l=s}finally{try{!c&&f["return"]&&f["return"]()}finally{if(u)throw l}}return O[0]}function o(){var t=window.location.search,e={s:O[0].label};if(t.startsWith("?")){t=t.slice(1).split("&");var n=!0,r=!1,i=void 0;try{for(var a,o=t[Symbol.iterator]();!(n=(a=o.next()).done);n=!0){var s=a.value,c=s.split("=");e[c[0]]=decodeURIComponent(c[1].replace(/-/g," "))}}catch(u){r=!0,i=u}finally{try{!n&&o["return"]&&o["return"]()}finally{if(r)throw i}}}return e}function s(t,e){F[t]=e;var n=[],r=!0,i=!1,a=void 0;try{for(var o,s=Object.keys(F)[Symbol.iterator]();!(r=(o=s.next()).done);r=!0){var c=o.value;n.push(c+"="+encodeURIComponent(F[c].replace(/ /g,"-")))}}catch(u){i=!0,a=u}finally{try{!r&&s["return"]&&s["return"]()}finally{if(i)throw a}}if(F.hasOwnProperty("s")){var l=F.s;window.history.replaceState({s:l},"Sunsistemo - "+l,"?"+n.join("&"))}}function c(t){var e=50,n=200,r=E.select("body"),a=r.selectAll("#gui");a.style();var o=a.append("svg").attr("width","450px").attr("height","800px").attr("class","menuSvg"),s=o.selectAll(".button").data(O);s.enter().append("g").attr("transform",function(t,n){return"translate(10,"+(n*e+10)+")"}).attr("class","button"),s.append("rect").style("opacity",".5").attr("width",n).attr("height",e-3).attr("rx",5).attr("ry",5),s.append("text").style("fill","black").attr("dx",".35em").attr("y",e/2).attr("dy",".35em").text(function(t){return t.label}),s.on("mouseover",function(t){E.select(E.event.target.parentNode).classed("highlight",!0)}).on("mouseout",function(t){E.select(E.event.target.parentNode).classed("highlight",!1)}).on("click",function(t){E.selectAll(".selected").classed("selected",!1),t["function"]==u?(l(),t["function"].apply(t,i(t.args))):"About"===t.label?t["function"]():(h(),f(t),l()),E.select(E.event.target.parentNode).classed("selected",!0)})}function u(t){var e=40,n=150,r=E.select("body"),i=r.selectAll("#gui"),a=i.selectAll(".menuSvg"),o=a.selectAll(".subButton").data(t);o.enter().append("g").attr("class","button subButton").style("opacity",0).attr("transform",function(t,e){return"translate(220,-50)"}).transition().duration(800).style("opacity",1).attr("transform",function(t,n){return"translate(220,"+(n*e+10)+")"}),o.append("rect").style("opacity",".5").attr("width",n).attr("height",e-3).attr("rx",5).attr("ry",5),o.append("text").style("fill","black").attr("dx",".35em").attr("y",e/2).attr("dy",".35em").text(function(t){return t.label}),o.on("mouseover",function(t){E.select(E.event.target.parentNode).classed("highlight",!0)}).on("mouseout",function(t){E.select(E.event.target.parentNode).classed("highlight",!1)}).on("click",function(t){E.selectAll(".subButton.selected").classed("selected",!1),h(),f(t),E.select(E.event.target.parentNode).classed("selected",!0)})}function l(){var t=E.selectAll(".subButton");t.transition().duration(800).style("opacity",0).attr("transform",function(t,e){return"translate(220,1000)"}).remove()}function h(){for(var t=document.getElementById("sim");t.firstChild;)t.removeChild(t.firstChild);for(var e=document.getElementById("time");e.firstChild;)e.removeChild(e.firstChild);cancelAnimationFrame(R),R=void 0,window.removeEventListener("resize",g)}function f(t){N=t["function"].apply(t,i(t.args)),U=N.bodies,N.hasOwnProperty("stepsPerFrame")?N.steps=N.stepsPerFrame:N.steps=1,D=new Date(0);var e=p(),n=y(e,1);if(B=n[0],"Solar System"===t.label){var r=!0,a=!1,o=void 0;try{for(var c,u=B[Symbol.iterator]();!(r=(c=u.next()).done);r=!0){var l=c.value;l.rotation.x+=.5*Math.PI}}catch(h){a=!0,o=h}finally{try{!r&&u["return"]&&u["return"]()}finally{if(a)throw o}}}d(),s("s",t.label),window.addEventListener("resize",g,!0)}function p(){T=new w.Scene,A=new w.PerspectiveCamera(75,window.innerWidth/window.innerHeight,.1,1e5),A.position.set(N.camera.x,N.camera.y,N.camera.z),T.add(A),C=new S(A);var t=new w.TextureLoader,e=new w.SphereGeometry(1e5,32,32),n=new w.MeshBasicMaterial({map:t.load("textures/galaxy_starfield.png"),side:w.BackSide}),r=new w.Mesh(e,n);T.add(r);var i=[],a=!0,o=!1,s=void 0;try{for(var c,u=U[Symbol.iterator]();!(a=(c=u.next()).done);a=!0){var l=c.value,h=new w.SphereGeometry(l.rad,N.sphereP,P),f=new w.MeshPhongMaterial;f.map=l.getTexture(),f.bumpMap=l.getBumpMap(),f.bumpScale=.2,f.specularMap=l.getSpecularMap();var p=new w.Mesh(h,f);p.position.set(l.r.x,l.r.y,l.r.z),T.add(p),i.push(p)}}catch(d){o=!0,s=d}finally{try{!a&&u["return"]&&u["return"]()}finally{if(o)throw s}}if(N.sunOn){var m=i[0];m.material.emissive.set(13281843),m.material.emissiveMap=m.material.map;var g=new w.PointLight(16569408,2,8e3);m.add(g);var v=new w.SpriteMaterial({map:t.load("textures/glow.png"),color:16548927,transparent:!1,blending:w.AdditiveBlending}),y=new w.Sprite(v),x=3*m.geometry.boundingSphere.radius;y.scale.set(x,x,1),m.add(y);var b=new w.AmbientLight(4210752);T.add(b)}else{var M=new w.AmbientLight(15790320);T.add(M)}return L=new w.WebGLRenderer,L.setClearColor(0),L.setSize(window.innerWidth,window.innerHeight),document.getElementById("sim").appendChild(L.domElement),[i]}function d(){U=_.leapfrog_initial(U,N.stepsize),R=requestAnimationFrame(m)}function m(){D.setTime(D.getTime()+N.stepsize*N.stepsPerFrame*1e3);for(var t=0;t<N.steps;t++)U=_.leapfrog(U,N.stepsize);var e=_.removeLostBodies(U,B,T,N.boundary),n=y(e,2);U=n[0],B=n[1];for(var r=0;r<U.length;r++){var i=U[r].r.clone();if(N.hasOwnProperty("scalePosition")&&(i=N.scalePosition(i)),B[r].position.set(i.x,i.y,i.z),B[r].rotation.x+=U[r].rot.x,B[r].rotation.y+=U[r].rot.y,B[r].rotation.z+=U[r].rot.z,N.collisions)for(var a=r+1;a<U.length;a++)r!==a&&_.touch(U[r],U[a])&&_.checkBodiesApproach(U[r],U[a])&&_.elasticCollision(U[r],U[a])}if(R=requestAnimationFrame(m),"date"===N.counter){var o=D.toDateString().split(" ").splice(1),s=y(o,3),c=s[0],u=s[1],l=s[2];document.getElementById("time").innerHTML=[u,c,l].join(" ")}v(),C.update()}function g(){A.aspect=window.innerWidth/window.innerHeight,A.updateProjectionMatrix(),L.setSize(window.innerWidth,window.innerHeight),v()}function v(){L.render(T,A)}var y=function(){function t(t,e){var n=[],r=!0,i=!1,a=void 0;try{for(var o,s=t[Symbol.iterator]();!(r=(o=s.next()).done)&&(n.push(o.value),!e||n.length!==e);r=!0);}catch(c){i=!0,a=c}finally{try{!r&&s["return"]&&s["return"]()}finally{if(i)throw a}}return n}return function(e,n){if(Array.isArray(e))return e;if(Symbol.iterator in Object(e))return t(e,n);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}(),x=n(1),b=r(x),M=n(2),_=r(M),w=n(3),S=n(4)(w),E=n(5),T=void 0,A=void 0,L=void 0,C=void 0,R=void 0,P=16,D=void 0,N=void 0,U=void 0,B=void 0,I=[{label:"ButterFly1","function":b.genButterFly1,args:[]},{label:"ButterFly2","function":b.genButterFly2,args:[]},{label:"Butterfly3","function":b.genButterfly3,args:[]},{label:"Butterfly4","function":b.genButterfly4,args:[]},{label:"Bumblebee","function":b.genBumblebee,args:[]},{label:"Moth1","function":b.genMoth1,args:[]},{label:"Moth2","function":b.genMoth2,args:[]},{label:"Moth3","function":b.genMoth3,args:[]},{label:"Goggles","function":b.genGoggles,args:[]},{label:"Dragonfly","function":b.genDragonfly,args:[]},{label:"Yarn","function":b.genYarn,args:[]},{label:"YinYang1","function":b.genYinYang1,args:[]},{label:"YinYang2","function":b.genYinYang2,args:[]}],O=[{label:"The Sun","function":b.genBodiesRot,args:[0,!0,!0]},{label:"Two Bodies","function":b.gen2Bodies,args:[!0]},{label:"Three Bodies","function":b.gen3Bodies,args:[!0]},{label:"Solar System","function":b.genSolarSystem,args:[!0]},{label:"Random Bodies","function":b.genBodies,args:[200,"solar",!1,!0]},{label:"Angular Momentum","function":b.genBodiesRot,args:[200,"solar",!0,!1]},{label:"Angular with Bounce","function":b.genBodiesRot,args:[200,"balls",!0,!0,!0]},{label:"Choreographies","function":u,args:[I]},{label:"About","function":function(){window.open("report/sunsistemo.pdf")},args:[]}];c(O);var F=o(),V=a(F.s);f(V)},function(t,e,n){"use strict";function r(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e["default"]=t,e}function i(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function a(t){function e(t){var e=2*Math.PI/(t*n/r);return new b(0,e,0)}var n=86400,r=.1*n,i=new _(1.98855e30,new b(0,0,0),new b(0,0,0),696342e3,"sun",e(25.38)),a=new _(3.3011e23,new b(38371302887.33682,28770253502.43919,(-1175806982.200703)),new b((-38787.66588423944),41093.05229662527,6918.459013107025),2439700,"mercury",e(58.64)),o=new _(4.8675e24,new b((-5377313296.255215),(-108595640391.1222),(-1164748440.839313)),new b(34741.48284671561,(-1865.747137359618),(-2031.505677951714)),6051800,"venus",e(-243.02)),s=new _(5.997219e24,new b((-27007428594.39665),144600702142.9538,9687450.72542131),new b((-29770.44214085218),(-5568.042062189587),.3960050738736065),6371e3,"earth",e(.997)),c=new _(7.3477e22,new b((-27391801660.63208),144525214256.4551,(-5966407.74730593)),new b((-29515.49140447329),(-6529.794009827214),(-76.15838122417217)),1737100,"moon",e(27.32)),u=new _(6.4171e23,new b(198382454336.9704,74229240656.11902,(-3334840409.383859)),new b((-7557.626093692695),24761.2652479582,704.7458490385097),3389500,"mars",e(1.026)),l=new _(1.8986e27,new b((-749650178421.0088),(-320171238261.7047),18111584337.18784),new b(4982.523623046754,(-11417.82925514267),(-64.66474051600457)),69911e3,"jupiter",e(.41)),h=new _(5.6836e26,new b(1082806087546.906,851084072618.1986,(-57934875833.71094)),new b((-6487.121289267689),7565.952106845154,125.4418330224025),58232e3,"saturn",e(.426)),f=new _(8.681e25,new b((-2724615970786.758),(-289401931770.462),34288240158.31023),new b(671.2348901080567,(-7099.101277978575),(-35.28579247809205)),25362e3,"uranus",e(-.71833)),p=new _(1.0243e26,new b((-2328070851258),(-3891087698123.372),133743983241.2817),new b(4633.959234836657,(-2767.419818371484),(-49.57409060715667)),24622e3,"neptune",e(.671)),d=new _(1.305e22,new b((-4551131153197.412),317539648237.7141,1282172026454.296),new b(635.4565491262041,(-5762.636149150082),440.9493397386148),1186e3,"pluto",e(-6.387)),m=[i,a,o,s,c,u,l,h,f,p,d],g=function(t){return.2*Math.pow(t,.25)},v=!0,y=!1,x=void 0;try{for(var M,w=m[Symbol.iterator]();!(v=(M=w.next()).done);v=!0){var S=M.value;S.rad=g(S.rad)}}catch(E){y=!0,x=E}finally{try{!v&&w["return"]&&w["return"]()}finally{if(y)throw x}}return{bodies:m,stepsize:r,stepsPerFrame:1,scalePosition:function(t){return t.multiplyScalar(1e-9)},camera:{x:0,y:0,z:1300},collisions:!1,sunOn:t,sphereP:32,boundary:1e13,counter:"date"}}function o(t){var e=new _(1e19,new b(0,0,0),new b(0,(-90),0),12,"sun",new b(0,0,S())),n=new _(1e18,new b(200,0,0),new b(0,900,0),8,"earth",new b(0,0,S())),r=[e,n];return{bodies:r,stepsize:5e-6,stepsPerFrame:300,camera:{x:0,y:0,z:250},collisions:!1,sunOn:t,sphereP:32,boundary:2e3}}function s(t){var e=new _(1e19,new b(0,0,0),new b(0,2,0),12,"sun",new b(0,0,S())),n=new _(1e18,new b(200,0,0),new b(0,900,0),8,"venus",new b(0,0,S())),r=new _(1e18,new b((-200),0,0),new b(0,(-900),0),8,"earth",new b(0,0,S())),i=[e,n,r];return{bodies:i,stepsize:3e-6,stepsPerFrame:300,camera:{x:0,y:0,z:250},collisions:!1,sunOn:t,sphereP:32,boundary:2e3}}function c(t,e,n,r){e||(w=[]);for(var i=[],a=0;a<t;a++){var o=new b(p(-300,300),p(-300,300),p(-300,300)),s=new b(p(-500,500),p(-500,500),p(-500,500)),c=new b(0,S(),0),u=15*Math.random()+4;i.push(new _(1e15*(3^u),o,s,u,f(M.solar),c))}return{bodies:i,stepsize:.001,stepsPerFrame:1,camera:{x:0,y:0,z:400},collisions:r,sunOn:n,sphereP:32,boundary:2e3}}function u(t,e,n,r){var i=M[e],a=[],o=new b(0,4,0);a.push(new _(1e18,new b(0,0,0),new b(0,0,0),12,"sun",new b(0,.01,0)));for(var s=0;s<t;s++){var c=new b(p(-300,300),p(-300,300),p(-300,300)),u=new b(0,0,0),l=new b(0,S(),0),h=15*Math.random()+4;u.crossVectors(c,o).multiplyScalar(Math.random()+.1),a.push(new _(1e14*h,c,u,h,f(i),l))}return{bodies:a,stepsize:5e-4,stepsPerFrame:1,camera:{x:0,y:0,z:400},collisions:r,sunOn:n,sphereP:32,boundary:2e3}}function l(t,e){var n=function(){var n=1/y.G,r=d(M.all,3),i=m(r,3),a=i[0],o=i[1],s=i[2],c=new _(n,new b((-1),0,0),new b(t,e,0),.05,a,new b(0,S(),0)),u=new _(n,new b((-c.r.x),0,0),new b(c.v.x,c.v.y,0),.05,o,new b(0,S(),0)),l=new _(n,new b(0,0,0),new b(-2*c.v.x,-2*c.v.y),.05,s,new b(0,S(),0));return{bodies:[c,u,l],stepsize:2e-5,stepsPerFrame:5e3,camera:{x:0,y:0,z:2},collisions:!1,boundary:2e3}};return n}function h(t,e,n,r){var i={},a=new x.TextureLoader;if(e){var o=a.load("textures/"+t+"map.jpg");o.minFilter=x.LinearFilter,i.texture=o}if(n){var s=a.load("textures/"+t+"bump.jpg");s.minFilter=x.LinearFilter,i.bumpMap=s}if(r){var c=a.load("textures/"+t+"specular.jpg");c.minFilter=x.LinearFilter,i.specularMap=c}return i}function f(t){return t[p(0,t.length)]}function p(t,e){return Math.floor(Math.random()*(e-t))+t}function d(t,e){for(var n=[];n.length<e;){var r=f(t);n.indexOf(r)===-1&&n.push(r)}return n}Object.defineProperty(e,"__esModule",{value:!0}),e.genYinYang2=e.genYinYang1=e.genYarn=e.genDragonfly=e.genButterfly4=e.genGoggles=e.genMoth3=e.genButterfly3=e.genMoth2=e.genMoth1=e.genBumblebee=e.genButterFly2=e.genButterFly1=void 0;var m=function(){function t(t,e){var n=[],r=!0,i=!1,a=void 0;try{for(var o,s=t[Symbol.iterator]();!(r=(o=s.next()).done)&&(n.push(o.value),!e||n.length!==e);r=!0);}catch(c){i=!0,a=c}finally{try{!r&&s["return"]&&s["return"]()}finally{if(i)throw a}}return n}return function(e,n){if(Array.isArray(e))return e;if(Symbol.iterator in Object(e))return t(e,n);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}(),g=function(){function t(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}return function(e,n,r){return n&&t(e.prototype,n),r&&t(e,r),e}}();e.genSolarSystem=a,e.gen2Bodies=o,e.gen3Bodies=s,e.genBodies=c,e.genBodiesRot=u,e.getRandomInt=p;var v=n(2),y=r(v),x=n(3),b=x.Vector3,M={solar:["sun","mercury","venus","earth","moon","mars","jupiter","saturn","uranus","neptune","pluto"],balls:["tennisball","softball"]};M.all=M.solar.concat(M.balls);var _=function(){function t(e,n,r,a,o,s){i(this,t),this.m=e,this.r=n,this.v=r,this.rad=a,this.texture=o,this.rot=s}return g(t,[{key:"getTexture",value:function(){return w[this.texture].texture}},{key:"getBumpMap",value:function(){return w[this.texture].bumpMap}},{key:"getSpecularMap",value:function(){return w[this.texture].specularMap}},{key:"set",value:function(t,e){return this.r=t,this.v=e,this}},{key:"clone",value:function(){return new t(this.m,this.r,this.v,this.rad,this.texture,this.rot)}}]),t}();e["default"]=_;var w={sun:h("sun",!0,!1,!1),mercury:h("mercury",!0,!0,!1),venus:h("venus",!0,!0,!1),earth:h("earth",!0,!0,!0),mars:h("mars",!0,!0,!1),moon:h("moon",!0,!0,!1),jupiter:h("jupiter",!0,!1,!1),saturn:h("saturn",!0,!1,!1),uranus:h("uranus",!0,!1,!1),neptune:h("neptune",!0,!1,!1),pluto:h("pluto",!0,!0,!1),tennisball:h("tennisball",!0,!0,!0),softball:h("softball",!0,!0,!1)},S=function(){return Math.random()/30};e.genButterFly1=l(.30689,.12551),e.genButterFly2=l(.39295,.09758),e.genBumblebee=l(.18428,.58719),e.genMoth1=l(.46444,.39606),e.genMoth2=l(.43917,.45297),e.genButterfly3=l(.40592,.23016),e.genMoth3=l(.38344,.37736),e.genGoggles=l(.0833,.12789),e.genButterfly4=l(.350112,.07934),e.genDragonfly=l(.08058,.58884),e.genYarn=l(.55906,.34919),e.genYinYang1=l(.51394,.30474),e.genYinYang2=l(.41682,.33033)},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{"default":t}}function i(t,e){for(var n=new g(0,0,0),r=0;r<e.length;r++)if(r!==t){var i=e[r].r.clone().sub(e[t].r),a=v*e[r].m/Math.pow(i.length(),3);n.add(i.multiplyScalar(a))}return n}function a(t,e){for(var n=[],r=0;r<t.length;r++){var a=t[r].r.clone().add(t[r].v.clone().multiplyScalar(e)),o=t[r].v.clone().add(i(r,t).multiplyScalar(e));n.push(t[r].clone().set(a,o))}return n}function o(t,e){for(var n=[],r=0;r<t.length;r++){var a=t[r].v.clone().add(i(r,t).multiplyScalar(e)),o=t[r].r.clone().add(a.clone().multiplyScalar(e));n.push(t[r].clone().set(o,a))}return n}function s(t,e){for(var n=0;n<t.length;n++)t[n].v.add(i(n,t).multiplyScalar(.5*e));return t}function c(t,e){for(var n=0;n<t.length;n++)t[n].r.add(t[n].v.clone().multiplyScalar(e));for(var r=0;r<t.length;r++)t[r].v.add(i(r,t).multiplyScalar(e));return t}function u(t){for(var e=new g(0,0,0),n=0,r=0;r<t.length;r++)e.add(t[r].r.clone().multiplyScalar(t[r].m)),n+=t[r].m;return e.divideScalar(n)}function l(t,e,n,r){for(var i=u(t),a=0;a<t.length;a++){var o=t[a].r.clone(),s=new g(0,0,0);s.subVectors(o,i),s.length()>r&&(t.splice(a,1),n.remove(e[a]),e.splice(a,1))}return[t,e]}function h(t,e){var n=new g(0,0,0);return n.subVectors(t.r,e.r),n.length()<=t.rad+e.rad}function f(t,e){var n=new g(0,0,0),r=new g(0,0,0);return n.subVectors(t.r,e.r),r.subVectors(t.v,e.v),r.dot(n)<0}function p(t,e){var n=t.m,r=e.m,i=t.v.clone(),a=e.v.clone(),o=new g(0,0,0),s=new g(0,0,0),c=t.r.clone(),u=e.r.clone(),l=new g(0,0,0),h=new g(0,0,0),f=new g(0,0,0),p=new g(0,0,0);o.subVectors(i,a),s.subVectors(a,i),l.subVectors(c,u),h.subVectors(u,c),f.subVectors(i,l.multiplyScalar(o.dot(l)/l.lengthSq()*(2*r/(n+r)))),p.subVectors(a,h.multiplyScalar(s.dot(h)/h.lengthSq()*(2*n/(n+r)))),t.v=f,e.v=p}function d(t,e,n,r,i){var a=void 0,o=void 0;r.m>i.m?(a=r,o=i,console.log("merge!")):(a=i,o=r,console.log("merge!")),a.m+=o.m,a.rad+=2,t.splice(t.indexOf(o),1),n.remove(e[t.indexOf(o)]),e.splice(t.indexOf(o),1),console.log("merge!")}Object.defineProperty(e,"__esModule",{value:!0}),e.G=void 0,e.accel=i,e.euler=a,e.symplectic_euler=o,e.leapfrog_initial=s,e.leapfrog=c,e.getGravCenter=u,e.removeLostBodies=l,e.touch=h,e.checkBodiesApproach=f,e.elasticCollision=p,e.mergeCollision=d;var m=n(1),g=(r(m),n(3).Vector3),v=e.G=6.67408e-11},function(t,e,n){var r,i,a={REVISION:"78"};r=a,i="function"==typeof r?r.call(e,n,e,t):r,!(void 0!==i&&(t.exports=i)),void 0===Number.EPSILON&&(Number.EPSILON=Math.pow(2,-52)),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*)\s*\(/)[1]}}),void 0===Object.assign&&!function(){Object.assign=function(t){"use strict";if(void 0===t||null===t)throw new TypeError("Cannot convert undefined or null to object");for(var e=Object(t),n=1;n<arguments.length;n++){var r=arguments[n];if(void 0!==r&&null!==r)for(var i in r)Object.prototype.hasOwnProperty.call(r,i)&&(e[i]=r[i])}return e}}(),Object.assign(a,{MOUSE:{LEFT:0,MIDDLE:1,RIGHT:2},CullFaceNone:0,CullFaceBack:1,CullFaceFront:2,CullFaceFrontBack:3,FrontFaceDirectionCW:0,FrontFaceDirectionCCW:1,BasicShadowMap:0,PCFShadowMap:1,PCFSoftShadowMap:2,FrontSide:0,BackSide:1,DoubleSide:2,FlatShading:1,SmoothShading:2,NoColors:0,FaceColors:1,VertexColors:2,NoBlending:0,NormalBlending:1,AdditiveBlending:2,SubtractiveBlending:3,MultiplyBlending:4,CustomBlending:5,AddEquation:100,SubtractEquation:101,ReverseSubtractEquation:102,MinEquation:103,MaxEquation:104,ZeroFactor:200,OneFactor:201,SrcColorFactor:202,OneMinusSrcColorFactor:203,SrcAlphaFactor:204,OneMinusSrcAlphaFactor:205,DstAlphaFactor:206,OneMinusDstAlphaFactor:207,DstColorFactor:208,OneMinusDstColorFactor:209,SrcAlphaSaturateFactor:210,NeverDepth:0,AlwaysDepth:1,LessDepth:2,LessEqualDepth:3,EqualDepth:4,GreaterEqualDepth:5,GreaterDepth:6,NotEqualDepth:7,MultiplyOperation:0,MixOperation:1,AddOperation:2,NoToneMapping:0,LinearToneMapping:1,ReinhardToneMapping:2,Uncharted2ToneMapping:3,CineonToneMapping:4,UVMapping:300,CubeReflectionMapping:301,CubeRefractionMapping:302,EquirectangularReflectionMapping:303,EquirectangularRefractionMapping:304,SphericalReflectionMapping:305,CubeUVReflectionMapping:306,CubeUVRefractionMapping:307,RepeatWrapping:1e3,ClampToEdgeWrapping:1001,MirroredRepeatWrapping:1002,NearestFilter:1003,NearestMipMapNearestFilter:1004,NearestMipMapLinearFilter:1005,LinearFilter:1006,LinearMipMapNearestFilter:1007,LinearMipMapLinearFilter:1008,UnsignedByteType:1009,ByteType:1010,ShortType:1011,UnsignedShortType:1012,IntType:1013,UnsignedIntType:1014,FloatType:1015,HalfFloatType:1025,UnsignedShort4444Type:1016,UnsignedShort5551Type:1017,UnsignedShort565Type:1018,AlphaFormat:1019,RGBFormat:1020,RGBAFormat:1021,LuminanceFormat:1022,LuminanceAlphaFormat:1023,RGBEFormat:a.RGBAFormat,DepthFormat:1026,RGB_S3TC_DXT1_Format:2001,RGBA_S3TC_DXT1_Format:2002,RGBA_S3TC_DXT3_Format:2003,RGBA_S3TC_DXT5_Format:2004,RGB_PVRTC_4BPPV1_Format:2100,RGB_PVRTC_2BPPV1_Format:2101,RGBA_PVRTC_4BPPV1_Format:2102,RGBA_PVRTC_2BPPV1_Format:2103,RGB_ETC1_Format:2151,LoopOnce:2200,LoopRepeat:2201,LoopPingPong:2202,InterpolateDiscrete:2300,InterpolateLinear:2301,InterpolateSmooth:2302,ZeroCurvatureEnding:2400,ZeroSlopeEnding:2401,WrapAroundEnding:2402,TrianglesDrawMode:0,TriangleStripDrawMode:1,TriangleFanDrawMode:2,LinearEncoding:3e3,sRGBEncoding:3001,GammaEncoding:3007,RGBEEncoding:3002,LogLuvEncoding:3003,RGBM7Encoding:3004,RGBM16Encoding:3005,RGBDEncoding:3006,BasicDepthPacking:3200,RGBADepthPacking:3201}),a.Color=function(t,e,n){return void 0===e&&void 0===n?this.set(t):this.setRGB(t,e,n)},a.Color.prototype={constructor:a.Color,r:1,g:1,b:1,set:function(t){return t instanceof a.Color?this.copy(t):"number"==typeof t?this.setHex(t):"string"==typeof t&&this.setStyle(t),this},setScalar:function(t){this.r=t,this.g=t,this.b=t},setHex:function(t){return t=Math.floor(t),this.r=(t>>16&255)/255,this.g=(t>>8&255)/255,this.b=(255&t)/255,this},setRGB:function(t,e,n){return this.r=t,this.g=e,this.b=n,this},setHSL:function(){function t(t,e,n){return n<0&&(n+=1),n>1&&(n-=1),n<1/6?t+6*(e-t)*n:n<.5?e:n<2/3?t+6*(e-t)*(2/3-n):t}return function(e,n,r){if(e=a.Math.euclideanModulo(e,1),n=a.Math.clamp(n,0,1),r=a.Math.clamp(r,0,1),0===n)this.r=this.g=this.b=r;else{var i=r<=.5?r*(1+n):r+n-r*n,o=2*r-i;this.r=t(o,i,e+1/3),this.g=t(o,i,e),this.b=t(o,i,e-1/3)}return this}}(),setStyle:function(t){function e(e){void 0!==e&&parseFloat(e)<1&&console.warn("THREE.Color: Alpha component of "+t+" will be ignored.")}var n;if(n=/^((?:rgb|hsl)a?)\(\s*([^\)]*)\)/.exec(t)){var r,i=n[1],o=n[2];switch(i){case"rgb":case"rgba":if(r=/^(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(,\s*([0-9]*\.?[0-9]+)\s*)?$/.exec(o))return this.r=Math.min(255,parseInt(r[1],10))/255,this.g=Math.min(255,parseInt(r[2],10))/255,this.b=Math.min(255,parseInt(r[3],10))/255,e(r[5]),this;if(r=/^(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(,\s*([0-9]*\.?[0-9]+)\s*)?$/.exec(o))return this.r=Math.min(100,parseInt(r[1],10))/100,this.g=Math.min(100,parseInt(r[2],10))/100,this.b=Math.min(100,parseInt(r[3],10))/100,e(r[5]),this;break;case"hsl":case"hsla":if(r=/^([0-9]*\.?[0-9]+)\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(,\s*([0-9]*\.?[0-9]+)\s*)?$/.exec(o)){var s=parseFloat(r[1])/360,c=parseInt(r[2],10)/100,u=parseInt(r[3],10)/100;return e(r[5]),this.setHSL(s,c,u)}}}else if(n=/^\#([A-Fa-f0-9]+)$/.exec(t)){var l=n[1],h=l.length;if(3===h)return this.r=parseInt(l.charAt(0)+l.charAt(0),16)/255,this.g=parseInt(l.charAt(1)+l.charAt(1),16)/255,this.b=parseInt(l.charAt(2)+l.charAt(2),16)/255,this;if(6===h)return this.r=parseInt(l.charAt(0)+l.charAt(1),16)/255,this.g=parseInt(l.charAt(2)+l.charAt(3),16)/255,this.b=parseInt(l.charAt(4)+l.charAt(5),16)/255,this}if(t&&t.length>0){var l=a.ColorKeywords[t];void 0!==l?this.setHex(l):console.warn("THREE.Color: Unknown color "+t)}return this},clone:function(){return new this.constructor(this.r,this.g,this.b)},copy:function(t){return this.r=t.r,this.g=t.g,this.b=t.b,this},copyGammaToLinear:function(t,e){return void 0===e&&(e=2),this.r=Math.pow(t.r,e),this.g=Math.pow(t.g,e),this.b=Math.pow(t.b,e),this},copyLinearToGamma:function(t,e){void 0===e&&(e=2);var n=e>0?1/e:1;return this.r=Math.pow(t.r,n),this.g=Math.pow(t.g,n),this.b=Math.pow(t.b,n),this},convertGammaToLinear:function(){var t=this.r,e=this.g,n=this.b;return this.r=t*t,this.g=e*e,this.b=n*n,this},convertLinearToGamma:function(){return this.r=Math.sqrt(this.r),this.g=Math.sqrt(this.g),this.b=Math.sqrt(this.b),this},getHex:function(){return 255*this.r<<16^255*this.g<<8^255*this.b<<0},getHexString:function(){return("000000"+this.getHex().toString(16)).slice(-6)},getHSL:function(t){var e,n,r=t||{h:0,s:0,l:0},i=this.r,a=this.g,o=this.b,s=Math.max(i,a,o),c=Math.min(i,a,o),u=(c+s)/2;if(c===s)e=0,n=0;else{var l=s-c;switch(n=u<=.5?l/(s+c):l/(2-s-c),s){case i:e=(a-o)/l+(a<o?6:0);break;case a:e=(o-i)/l+2;break;case o:e=(i-a)/l+4}e/=6}return r.h=e,r.s=n,r.l=u,r},getStyle:function(){return"rgb("+(255*this.r|0)+","+(255*this.g|0)+","+(255*this.b|0)+")"},offsetHSL:function(t,e,n){var r=this.getHSL();return r.h+=t,r.s+=e,r.l+=n,this.setHSL(r.h,r.s,r.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},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}},a.ColorKeywords={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},a.Quaternion=function(t,e,n,r){this._x=t||0,this._y=e||0,this._z=n||0,this._w=void 0!==r?r:1},a.Quaternion.prototype={constructor:a.Quaternion,get x(){return this._x},set x(t){this._x=t,this.onChangeCallback()},get y(){return this._y},set y(t){this._y=t,this.onChangeCallback()},get z(){return this._z},set z(t){this._z=t,this.onChangeCallback()},get w(){return this._w},set w(t){this._w=t,this.onChangeCallback()},set:function(t,e,n,r){return this._x=t,this._y=e,this._z=n,this._w=r,this.onChangeCallback(),this},clone:function(){return new this.constructor(this._x,this._y,this._z,this._w)},copy:function(t){return this._x=t.x,this._y=t.y,this._z=t.z,this._w=t.w,this.onChangeCallback(),this},setFromEuler:function(t,e){if(t instanceof a.Euler==!1)throw new Error("THREE.Quaternion: .setFromEuler() now expects a Euler rotation rather than a Vector3 and order.");var n=Math.cos(t._x/2),r=Math.cos(t._y/2),i=Math.cos(t._z/2),o=Math.sin(t._x/2),s=Math.sin(t._y/2),c=Math.sin(t._z/2),u=t.order;return"XYZ"===u?(this._x=o*r*i+n*s*c,this._y=n*s*i-o*r*c,this._z=n*r*c+o*s*i,this._w=n*r*i-o*s*c):"YXZ"===u?(this._x=o*r*i+n*s*c,this._y=n*s*i-o*r*c,this._z=n*r*c-o*s*i,this._w=n*r*i+o*s*c):"ZXY"===u?(this._x=o*r*i-n*s*c,this._y=n*s*i+o*r*c,this._z=n*r*c+o*s*i,this._w=n*r*i-o*s*c):"ZYX"===u?(this._x=o*r*i-n*s*c,this._y=n*s*i+o*r*c,this._z=n*r*c-o*s*i,this._w=n*r*i+o*s*c):"YZX"===u?(this._x=o*r*i+n*s*c,this._y=n*s*i+o*r*c,this._z=n*r*c-o*s*i,this._w=n*r*i-o*s*c):"XZY"===u&&(this._x=o*r*i-n*s*c,this._y=n*s*i-o*r*c,this._z=n*r*c+o*s*i,this._w=n*r*i+o*s*c),e!==!1&&this.onChangeCallback(),this},setFromAxisAngle:function(t,e){var n=e/2,r=Math.sin(n);return this._x=t.x*r,this._y=t.y*r,this._z=t.z*r,this._w=Math.cos(n),this.onChangeCallback(),this},setFromRotationMatrix:function(t){var e,n=t.elements,r=n[0],i=n[4],a=n[8],o=n[1],s=n[5],c=n[9],u=n[2],l=n[6],h=n[10],f=r+s+h;return f>0?(e=.5/Math.sqrt(f+1),this._w=.25/e,this._x=(l-c)*e,this._y=(a-u)*e,this._z=(o-i)*e):r>s&&r>h?(e=2*Math.sqrt(1+r-s-h),this._w=(l-c)/e,this._x=.25*e,this._y=(i+o)/e,this._z=(a+u)/e):s>h?(e=2*Math.sqrt(1+s-r-h),this._w=(a-u)/e,this._x=(i+o)/e,this._y=.25*e,this._z=(c+l)/e):(e=2*Math.sqrt(1+h-r-s),this._w=(o-i)/e,this._x=(a+u)/e,this._y=(c+l)/e,this._z=.25*e),this.onChangeCallback(),this},setFromUnitVectors:function(){var t,e,n=1e-6;return function(r,i){return void 0===t&&(t=new a.Vector3),e=r.dot(i)+1,e<n?(e=0,Math.abs(r.x)>Math.abs(r.z)?t.set(-r.y,r.x,0):t.set(0,-r.z,r.y)):t.crossVectors(r,i),this._x=t.x,this._y=t.y,this._z=t.z,this._w=e,this.normalize()}}(),inverse:function(){return this.conjugate().normalize()},conjugate:function(){return this._x*=-1,this._y*=-1,this._z*=-1,this.onChangeCallback(),this},dot:function(t){return this._x*t._x+this._y*t._y+this._z*t._z+this._w*t._w},lengthSq:function(){return this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w},length:function(){return Math.sqrt(this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w)},normalize:function(){var t=this.length();return 0===t?(this._x=0,this._y=0,this._z=0,this._w=1):(t=1/t,this._x=this._x*t,this._y=this._y*t,this._z=this._z*t,this._w=this._w*t),
-this.onChangeCallback(),this},multiply:function(t,e){return void 0!==e?(console.warn("THREE.Quaternion: .multiply() now only accepts one argument. Use .multiplyQuaternions( a, b ) instead."),this.multiplyQuaternions(t,e)):this.multiplyQuaternions(this,t)},premultiply:function(t){return this.multiplyQuaternions(t,this)},multiplyQuaternions:function(t,e){var n=t._x,r=t._y,i=t._z,a=t._w,o=e._x,s=e._y,c=e._z,u=e._w;return this._x=n*u+a*o+r*c-i*s,this._y=r*u+a*s+i*o-n*c,this._z=i*u+a*c+n*s-r*o,this._w=a*u-n*o-r*s-i*c,this.onChangeCallback(),this},slerp:function(t,e){if(0===e)return this;if(1===e)return this.copy(t);var n=this._x,r=this._y,i=this._z,a=this._w,o=a*t._w+n*t._x+r*t._y+i*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=n,this._y=r,this._z=i,this;var s=Math.sqrt(1-o*o);if(Math.abs(s)<.001)return this._w=.5*(a+this._w),this._x=.5*(n+this._x),this._y=.5*(r+this._y),this._z=.5*(i+this._z),this;var c=Math.atan2(s,o),u=Math.sin((1-e)*c)/s,l=Math.sin(e*c)/s;return this._w=a*u+this._w*l,this._x=n*u+this._x*l,this._y=r*u+this._y*l,this._z=i*u+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(a.Quaternion,{slerp:function(t,e,n,r){return n.copy(t).slerp(e,r)},slerpFlat:function(t,e,n,r,i,a,o){var s=n[r+0],c=n[r+1],u=n[r+2],l=n[r+3],h=i[a+0],f=i[a+1],p=i[a+2],d=i[a+3];if(l!==d||s!==h||c!==f||u!==p){var m=1-o,g=s*h+c*f+u*p+l*d,v=g>=0?1:-1,y=1-g*g;if(y>Number.EPSILON){var x=Math.sqrt(y),b=Math.atan2(x,g*v);m=Math.sin(m*b)/x,o=Math.sin(o*b)/x}var M=o*v;if(s=s*m+h*M,c=c*m+f*M,u=u*m+p*M,l=l*m+d*M,m===1-o){var _=1/Math.sqrt(s*s+c*c+u*u+l*l);s*=_,c*=_,u*=_,l*=_}}t[e]=s,t[e+1]=c,t[e+2]=u,t[e+3]=l}}),a.Vector2=function(t,e){this.x=t||0,this.y=e||0},a.Vector2.prototype={constructor:a.Vector2,get width(){return this.x},set width(t){this.x=t},get height(){return this.y},set height(t){this.y=t},set:function(t,e){return this.x=t,this.y=e,this},setScalar:function(t){return this.x=t,this.y=t,this},setX:function(t){return this.x=t,this},setY:function(t){return this.y=t,this},setComponent:function(t,e){switch(t){case 0:this.x=e;break;case 1:this.y=e;break;default:throw new Error("index is out of range: "+t)}},getComponent:function(t){switch(t){case 0:return this.x;case 1:return this.y;default:throw new Error("index is out of range: "+t)}},clone:function(){return new this.constructor(this.x,this.y)},copy:function(t){return this.x=t.x,this.y=t.y,this},add:function(t,e){return void 0!==e?(console.warn("THREE.Vector2: .add() now only accepts one argument. Use .addVectors( a, b ) instead."),this.addVectors(t,e)):(this.x+=t.x,this.y+=t.y,this)},addScalar:function(t){return this.x+=t,this.y+=t,this},addVectors:function(t,e){return this.x=t.x+e.x,this.y=t.y+e.y,this},addScaledVector:function(t,e){return this.x+=t.x*e,this.y+=t.y*e,this},sub:function(t,e){return void 0!==e?(console.warn("THREE.Vector2: .sub() now only accepts one argument. Use .subVectors( a, b ) instead."),this.subVectors(t,e)):(this.x-=t.x,this.y-=t.y,this)},subScalar:function(t){return this.x-=t,this.y-=t,this},subVectors:function(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this},multiply:function(t){return this.x*=t.x,this.y*=t.y,this},multiplyScalar:function(t){return isFinite(t)?(this.x*=t,this.y*=t):(this.x=0,this.y=0),this},divide:function(t){return this.x/=t.x,this.y/=t.y,this},divideScalar:function(t){return this.multiplyScalar(1/t)},min:function(t){return this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y),this},max:function(t){return this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y),this},clamp:function(t,e){return this.x=Math.max(t.x,Math.min(e.x,this.x)),this.y=Math.max(t.y,Math.min(e.y,this.y)),this},clampScalar:function(){var t,e;return function(n,r){return void 0===t&&(t=new a.Vector2,e=new a.Vector2),t.set(n,n),e.set(r,r),this.clamp(t,e)}}(),clampLength:function(t,e){var n=this.length();return this.multiplyScalar(Math.max(t,Math.min(e,n))/n)},floor:function(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this},ceil:function(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this},round:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this},roundToZero:function(){return this.x=this.x<0?Math.ceil(this.x):Math.floor(this.x),this.y=this.y<0?Math.ceil(this.y):Math.floor(this.y),this},negate:function(){return this.x=-this.x,this.y=-this.y,this},dot:function(t){return this.x*t.x+this.y*t.y},lengthSq:function(){return this.x*this.x+this.y*this.y},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y)},lengthManhattan:function(){return Math.abs(this.x)+Math.abs(this.y)},normalize:function(){return this.divideScalar(this.length())},angle:function(){var t=Math.atan2(this.y,this.x);return t<0&&(t+=2*Math.PI),t},distanceTo:function(t){return Math.sqrt(this.distanceToSquared(t))},distanceToSquared:function(t){var e=this.x-t.x,n=this.y-t.y;return e*e+n*n},setLength:function(t){return this.multiplyScalar(t/this.length())},lerp:function(t,e){return this.x+=(t.x-this.x)*e,this.y+=(t.y-this.y)*e,this},lerpVectors:function(t,e,n){return this.subVectors(e,t).multiplyScalar(n).add(t)},equals:function(t){return t.x===this.x&&t.y===this.y},fromArray:function(t,e){return void 0===e&&(e=0),this.x=t[e],this.y=t[e+1],this},toArray:function(t,e){return void 0===t&&(t=[]),void 0===e&&(e=0),t[e]=this.x,t[e+1]=this.y,t},fromAttribute:function(t,e,n){return void 0===n&&(n=0),e=e*t.itemSize+n,this.x=t.array[e],this.y=t.array[e+1],this},rotateAround:function(t,e){var n=Math.cos(e),r=Math.sin(e),i=this.x-t.x,a=this.y-t.y;return this.x=i*n-a*r+t.x,this.y=i*r+a*n+t.y,this}},a.Vector3=function(t,e,n){this.x=t||0,this.y=e||0,this.z=n||0},a.Vector3.prototype={constructor:a.Vector3,set:function(t,e,n){return this.x=t,this.y=e,this.z=n,this},setScalar:function(t){return this.x=t,this.y=t,this.z=t,this},setX:function(t){return this.x=t,this},setY:function(t){return this.y=t,this},setZ:function(t){return this.z=t,this},setComponent:function(t,e){switch(t){case 0:this.x=e;break;case 1:this.y=e;break;case 2:this.z=e;break;default:throw new Error("index is out of range: "+t)}},getComponent:function(t){switch(t){case 0:return this.x;case 1:return this.y;case 2:return this.z;default:throw new Error("index is out of range: "+t)}},clone:function(){return new this.constructor(this.x,this.y,this.z)},copy:function(t){return this.x=t.x,this.y=t.y,this.z=t.z,this},add:function(t,e){return void 0!==e?(console.warn("THREE.Vector3: .add() now only accepts one argument. Use .addVectors( a, b ) instead."),this.addVectors(t,e)):(this.x+=t.x,this.y+=t.y,this.z+=t.z,this)},addScalar:function(t){return this.x+=t,this.y+=t,this.z+=t,this},addVectors:function(t,e){return this.x=t.x+e.x,this.y=t.y+e.y,this.z=t.z+e.z,this},addScaledVector:function(t,e){return this.x+=t.x*e,this.y+=t.y*e,this.z+=t.z*e,this},sub:function(t,e){return void 0!==e?(console.warn("THREE.Vector3: .sub() now only accepts one argument. Use .subVectors( a, b ) instead."),this.subVectors(t,e)):(this.x-=t.x,this.y-=t.y,this.z-=t.z,this)},subScalar:function(t){return this.x-=t,this.y-=t,this.z-=t,this},subVectors:function(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this.z=t.z-e.z,this},multiply:function(t,e){return void 0!==e?(console.warn("THREE.Vector3: .multiply() now only accepts one argument. Use .multiplyVectors( a, b ) instead."),this.multiplyVectors(t,e)):(this.x*=t.x,this.y*=t.y,this.z*=t.z,this)},multiplyScalar:function(t){return isFinite(t)?(this.x*=t,this.y*=t,this.z*=t):(this.x=0,this.y=0,this.z=0),this},multiplyVectors:function(t,e){return this.x=t.x*e.x,this.y=t.y*e.y,this.z=t.z*e.z,this},applyEuler:function(){var t;return function(e){return e instanceof a.Euler==!1&&console.error("THREE.Vector3: .applyEuler() now expects an Euler rotation rather than a Vector3 and order."),void 0===t&&(t=new a.Quaternion),this.applyQuaternion(t.setFromEuler(e))}}(),applyAxisAngle:function(){var t;return function(e,n){return void 0===t&&(t=new a.Quaternion),this.applyQuaternion(t.setFromAxisAngle(e,n))}}(),applyMatrix3:function(t){var e=this.x,n=this.y,r=this.z,i=t.elements;return this.x=i[0]*e+i[3]*n+i[6]*r,this.y=i[1]*e+i[4]*n+i[7]*r,this.z=i[2]*e+i[5]*n+i[8]*r,this},applyMatrix4:function(t){var e=this.x,n=this.y,r=this.z,i=t.elements;return this.x=i[0]*e+i[4]*n+i[8]*r+i[12],this.y=i[1]*e+i[5]*n+i[9]*r+i[13],this.z=i[2]*e+i[6]*n+i[10]*r+i[14],this},applyProjection:function(t){var e=this.x,n=this.y,r=this.z,i=t.elements,a=1/(i[3]*e+i[7]*n+i[11]*r+i[15]);return this.x=(i[0]*e+i[4]*n+i[8]*r+i[12])*a,this.y=(i[1]*e+i[5]*n+i[9]*r+i[13])*a,this.z=(i[2]*e+i[6]*n+i[10]*r+i[14])*a,this},applyQuaternion:function(t){var e=this.x,n=this.y,r=this.z,i=t.x,a=t.y,o=t.z,s=t.w,c=s*e+a*r-o*n,u=s*n+o*e-i*r,l=s*r+i*n-a*e,h=-i*e-a*n-o*r;return this.x=c*s+h*-i+u*-o-l*-a,this.y=u*s+h*-a+l*-i-c*-o,this.z=l*s+h*-o+c*-a-u*-i,this},project:function(){var t;return function(e){return void 0===t&&(t=new a.Matrix4),t.multiplyMatrices(e.projectionMatrix,t.getInverse(e.matrixWorld)),this.applyProjection(t)}}(),unproject:function(){var t;return function(e){return void 0===t&&(t=new a.Matrix4),t.multiplyMatrices(e.matrixWorld,t.getInverse(e.projectionMatrix)),this.applyProjection(t)}}(),transformDirection:function(t){var e=this.x,n=this.y,r=this.z,i=t.elements;return this.x=i[0]*e+i[4]*n+i[8]*r,this.y=i[1]*e+i[5]*n+i[9]*r,this.z=i[2]*e+i[6]*n+i[10]*r,this.normalize()},divide:function(t){return this.x/=t.x,this.y/=t.y,this.z/=t.z,this},divideScalar:function(t){return this.multiplyScalar(1/t)},min:function(t){return this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y),this.z=Math.min(this.z,t.z),this},max:function(t){return this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y),this.z=Math.max(this.z,t.z),this},clamp:function(t,e){return this.x=Math.max(t.x,Math.min(e.x,this.x)),this.y=Math.max(t.y,Math.min(e.y,this.y)),this.z=Math.max(t.z,Math.min(e.z,this.z)),this},clampScalar:function(){var t,e;return function(n,r){return void 0===t&&(t=new a.Vector3,e=new a.Vector3),t.set(n,n,n),e.set(r,r,r),this.clamp(t,e)}}(),clampLength:function(t,e){var n=this.length();return this.multiplyScalar(Math.max(t,Math.min(e,n))/n)},floor:function(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this},ceil:function(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this},round:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this},roundToZero:function(){return this.x=this.x<0?Math.ceil(this.x):Math.floor(this.x),this.y=this.y<0?Math.ceil(this.y):Math.floor(this.y),this.z=this.z<0?Math.ceil(this.z):Math.floor(this.z),this},negate:function(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this},dot:function(t){return this.x*t.x+this.y*t.y+this.z*t.z},lengthSq:function(){return this.x*this.x+this.y*this.y+this.z*this.z},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)},lengthManhattan:function(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)},normalize:function(){return this.divideScalar(this.length())},setLength:function(t){return this.multiplyScalar(t/this.length())},lerp:function(t,e){return this.x+=(t.x-this.x)*e,this.y+=(t.y-this.y)*e,this.z+=(t.z-this.z)*e,this},lerpVectors:function(t,e,n){return this.subVectors(e,t).multiplyScalar(n).add(t)},cross:function(t,e){if(void 0!==e)return console.warn("THREE.Vector3: .cross() now only accepts one argument. Use .crossVectors( a, b ) instead."),this.crossVectors(t,e);var n=this.x,r=this.y,i=this.z;return this.x=r*t.z-i*t.y,this.y=i*t.x-n*t.z,this.z=n*t.y-r*t.x,this},crossVectors:function(t,e){var n=t.x,r=t.y,i=t.z,a=e.x,o=e.y,s=e.z;return this.x=r*s-i*o,this.y=i*a-n*s,this.z=n*o-r*a,this},projectOnVector:function(t){var e=t.dot(this)/t.lengthSq();return this.copy(t).multiplyScalar(e)},projectOnPlane:function(){var t;return function(e){return void 0===t&&(t=new a.Vector3),t.copy(this).projectOnVector(e),this.sub(t)}}(),reflect:function(){var t;return function(e){return void 0===t&&(t=new a.Vector3),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(a.Math.clamp(e,-1,1))},distanceTo:function(t){return Math.sqrt(this.distanceToSquared(t))},distanceToSquared:function(t){var e=this.x-t.x,n=this.y-t.y,r=this.z-t.z;return e*e+n*n+r*r},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},setFromMatrixPosition:function(t){return this.setFromMatrixColumn(t,3)},setFromMatrixScale:function(t){var e=this.setFromMatrixColumn(t,0).length(),n=this.setFromMatrixColumn(t,1).length(),r=this.setFromMatrixColumn(t,2).length();return this.x=e,this.y=n,this.z=r,this},setFromMatrixColumn:function(t,e){if("number"==typeof t){console.warn("THREE.Vector3: setFromMatrixColumn now expects ( matrix, index ).");var n=t;t=e,e=n}return this.fromArray(t.elements,4*e)},equals:function(t){return t.x===this.x&&t.y===this.y&&t.z===this.z},fromArray:function(t,e){return void 0===e&&(e=0),this.x=t[e],this.y=t[e+1],this.z=t[e+2],this},toArray:function(t,e){return void 0===t&&(t=[]),void 0===e&&(e=0),t[e]=this.x,t[e+1]=this.y,t[e+2]=this.z,t},fromAttribute:function(t,e,n){return void 0===n&&(n=0),e=e*t.itemSize+n,this.x=t.array[e],this.y=t.array[e+1],this.z=t.array[e+2],this}},a.Vector4=function(t,e,n,r){this.x=t||0,this.y=e||0,this.z=n||0,this.w=void 0!==r?r:1},a.Vector4.prototype={constructor:a.Vector4,set:function(t,e,n,r){return this.x=t,this.y=e,this.z=n,this.w=r,this},setScalar:function(t){return this.x=t,this.y=t,this.z=t,this.w=t,this},setX:function(t){return this.x=t,this},setY:function(t){return this.y=t,this},setZ:function(t){return this.z=t,this},setW:function(t){return this.w=t,this},setComponent:function(t,e){switch(t){case 0:this.x=e;break;case 1:this.y=e;break;case 2:this.z=e;break;case 3:this.w=e;break;default:throw new Error("index is out of range: "+t)}},getComponent:function(t){switch(t){case 0:return this.x;case 1:return this.y;case 2:return this.z;case 3:return this.w;default:throw new Error("index is out of range: "+t)}},clone:function(){return new this.constructor(this.x,this.y,this.z,this.w)},copy:function(t){return this.x=t.x,this.y=t.y,this.z=t.z,this.w=void 0!==t.w?t.w:1,this},add:function(t,e){return void 0!==e?(console.warn("THREE.Vector4: .add() now only accepts one argument. Use .addVectors( a, b ) instead."),this.addVectors(t,e)):(this.x+=t.x,this.y+=t.y,this.z+=t.z,this.w+=t.w,this)},addScalar:function(t){return this.x+=t,this.y+=t,this.z+=t,this.w+=t,this},addVectors:function(t,e){return this.x=t.x+e.x,this.y=t.y+e.y,this.z=t.z+e.z,this.w=t.w+e.w,this},addScaledVector:function(t,e){return this.x+=t.x*e,this.y+=t.y*e,this.z+=t.z*e,this.w+=t.w*e,this},sub:function(t,e){return void 0!==e?(console.warn("THREE.Vector4: .sub() now only accepts one argument. Use .subVectors( a, b ) instead."),this.subVectors(t,e)):(this.x-=t.x,this.y-=t.y,this.z-=t.z,this.w-=t.w,this)},subScalar:function(t){return this.x-=t,this.y-=t,this.z-=t,this.w-=t,this},subVectors:function(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this.z=t.z-e.z,this.w=t.w-e.w,this},multiplyScalar:function(t){return isFinite(t)?(this.x*=t,this.y*=t,this.z*=t,this.w*=t):(this.x=0,this.y=0,this.z=0,this.w=0),this},applyMatrix4:function(t){var e=this.x,n=this.y,r=this.z,i=this.w,a=t.elements;return this.x=a[0]*e+a[4]*n+a[8]*r+a[12]*i,this.y=a[1]*e+a[5]*n+a[9]*r+a[13]*i,this.z=a[2]*e+a[6]*n+a[10]*r+a[14]*i,this.w=a[3]*e+a[7]*n+a[11]*r+a[15]*i,this},divideScalar:function(t){return this.multiplyScalar(1/t)},setAxisAngleFromQuaternion:function(t){this.w=2*Math.acos(t.w);var e=Math.sqrt(1-t.w*t.w);return e<1e-4?(this.x=1,this.y=0,this.z=0):(this.x=t.x/e,this.y=t.y/e,this.z=t.z/e),this},setAxisAngleFromRotationMatrix:function(t){var e,n,r,i,a=.01,o=.1,s=t.elements,c=s[0],u=s[4],l=s[8],h=s[1],f=s[5],p=s[9],d=s[2],m=s[6],g=s[10];if(Math.abs(u-h)<a&&Math.abs(l-d)<a&&Math.abs(p-m)<a){if(Math.abs(u+h)<o&&Math.abs(l+d)<o&&Math.abs(p+m)<o&&Math.abs(c+f+g-3)<o)return this.set(1,0,0,0),this;e=Math.PI;var v=(c+1)/2,y=(f+1)/2,x=(g+1)/2,b=(u+h)/4,M=(l+d)/4,_=(p+m)/4;return v>y&&v>x?v<a?(n=0,r=.707106781,i=.707106781):(n=Math.sqrt(v),r=b/n,i=M/n):y>x?y<a?(n=.707106781,r=0,i=.707106781):(r=Math.sqrt(y),n=b/r,i=_/r):x<a?(n=.707106781,r=.707106781,i=0):(i=Math.sqrt(x),n=M/i,r=_/i),this.set(n,r,i,e),this}var w=Math.sqrt((m-p)*(m-p)+(l-d)*(l-d)+(h-u)*(h-u));return Math.abs(w)<.001&&(w=1),this.x=(m-p)/w,this.y=(l-d)/w,this.z=(h-u)/w,this.w=Math.acos((c+f+g-1)/2),this},min:function(t){return this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y),this.z=Math.min(this.z,t.z),this.w=Math.min(this.w,t.w),this},max:function(t){return this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y),this.z=Math.max(this.z,t.z),this.w=Math.max(this.w,t.w),this},clamp:function(t,e){return this.x=Math.max(t.x,Math.min(e.x,this.x)),this.y=Math.max(t.y,Math.min(e.y,this.y)),this.z=Math.max(t.z,Math.min(e.z,this.z)),this.w=Math.max(t.w,Math.min(e.w,this.w)),this},clampScalar:function(){var t,e;return function(n,r){return void 0===t&&(t=new a.Vector4,e=new a.Vector4),t.set(n,n,n,n),e.set(r,r,r,r),this.clamp(t,e)}}(),floor:function(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this.w=Math.floor(this.w),this},ceil:function(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this.w=Math.ceil(this.w),this},round:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this.w=Math.round(this.w),this},roundToZero:function(){return this.x=this.x<0?Math.ceil(this.x):Math.floor(this.x),this.y=this.y<0?Math.ceil(this.y):Math.floor(this.y),this.z=this.z<0?Math.ceil(this.z):Math.floor(this.z),this.w=this.w<0?Math.ceil(this.w):Math.floor(this.w),this},negate:function(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this.w=-this.w,this},dot:function(t){return this.x*t.x+this.y*t.y+this.z*t.z+this.w*t.w},lengthSq:function(){return this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)},lengthManhattan:function(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)+Math.abs(this.w)},normalize:function(){return this.divideScalar(this.length())},setLength:function(t){return this.multiplyScalar(t/this.length())},lerp:function(t,e){return this.x+=(t.x-this.x)*e,this.y+=(t.y-this.y)*e,this.z+=(t.z-this.z)*e,this.w+=(t.w-this.w)*e,this},lerpVectors:function(t,e,n){return this.subVectors(e,t).multiplyScalar(n).add(t)},equals:function(t){return t.x===this.x&&t.y===this.y&&t.z===this.z&&t.w===this.w},fromArray:function(t,e){return void 0===e&&(e=0),this.x=t[e],this.y=t[e+1],this.z=t[e+2],this.w=t[e+3],this},toArray:function(t,e){return void 0===t&&(t=[]),void 0===e&&(e=0),t[e]=this.x,t[e+1]=this.y,t[e+2]=this.z,t[e+3]=this.w,t},fromAttribute:function(t,e,n){return void 0===n&&(n=0),e=e*t.itemSize+n,this.x=t.array[e],this.y=t.array[e+1],this.z=t.array[e+2],this.w=t.array[e+3],this}},a.Euler=function(t,e,n,r){this._x=t||0,this._y=e||0,this._z=n||0,this._order=r||a.Euler.DefaultOrder},a.Euler.RotationOrders=["XYZ","YZX","ZXY","XZY","YXZ","ZYX"],a.Euler.DefaultOrder="XYZ",a.Euler.prototype={constructor:a.Euler,get x(){return this._x},set x(t){this._x=t,this.onChangeCallback()},get y(){return this._y},set y(t){this._y=t,this.onChangeCallback()},get z(){return this._z},set z(t){this._z=t,this.onChangeCallback()},get order(){return this._order},set order(t){this._order=t,this.onChangeCallback()},set:function(t,e,n,r){return this._x=t,this._y=e,this._z=n,this._order=r||this._order,this.onChangeCallback(),this},clone:function(){return new this.constructor(this._x,this._y,this._z,this._order)},copy:function(t){return this._x=t._x,this._y=t._y,this._z=t._z,this._order=t._order,this.onChangeCallback(),this},setFromRotationMatrix:function(t,e,n){var r=a.Math.clamp,i=t.elements,o=i[0],s=i[4],c=i[8],u=i[1],l=i[5],h=i[9],f=i[2],p=i[6],d=i[10];return e=e||this._order,"XYZ"===e?(this._y=Math.asin(r(c,-1,1)),Math.abs(c)<.99999?(this._x=Math.atan2(-h,d),this._z=Math.atan2(-s,o)):(this._x=Math.atan2(p,l),this._z=0)):"YXZ"===e?(this._x=Math.asin(-r(h,-1,1)),Math.abs(h)<.99999?(this._y=Math.atan2(c,d),this._z=Math.atan2(u,l)):(this._y=Math.atan2(-f,o),this._z=0)):"ZXY"===e?(this._x=Math.asin(r(p,-1,1)),Math.abs(p)<.99999?(this._y=Math.atan2(-f,d),this._z=Math.atan2(-s,l)):(this._y=0,this._z=Math.atan2(u,o))):"ZYX"===e?(this._y=Math.asin(-r(f,-1,1)),Math.abs(f)<.99999?(this._x=Math.atan2(p,d),this._z=Math.atan2(u,o)):(this._x=0,this._z=Math.atan2(-s,l))):"YZX"===e?(this._z=Math.asin(r(u,-1,1)),Math.abs(u)<.99999?(this._x=Math.atan2(-h,l),this._y=Math.atan2(-f,o)):(this._x=0,this._y=Math.atan2(c,d))):"XZY"===e?(this._z=Math.asin(-r(s,-1,1)),Math.abs(s)<.99999?(this._x=Math.atan2(p,l),this._y=Math.atan2(c,o)):(this._x=Math.atan2(-h,d),this._y=0)):console.warn("THREE.Euler: .setFromRotationMatrix() given unsupported order: "+e),this._order=e,n!==!1&&this.onChangeCallback(),this},setFromQuaternion:function(){var t;return function(e,n,r){return void 0===t&&(t=new a.Matrix4),t.makeRotationFromQuaternion(e),this.setFromRotationMatrix(t,n,r)}}(),setFromVector3:function(t,e){return this.set(t.x,t.y,t.z,e||this._order)},reorder:function(){var t=new a.Quaternion;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 a.Vector3(this._x,this._y,this._z)},onChange:function(t){return this.onChangeCallback=t,this},onChangeCallback:function(){}},a.Line3=function(t,e){this.start=void 0!==t?t:new a.Vector3,this.end=void 0!==e?e:new a.Vector3},a.Line3.prototype={constructor:a.Line3,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},center:function(t){var e=t||new a.Vector3;return e.addVectors(this.start,this.end).multiplyScalar(.5)},delta:function(t){var e=t||new a.Vector3;return e.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 n=e||new a.Vector3;return this.delta(n).multiplyScalar(t).add(this.start)},closestPointToPointParameter:function(){var t=new a.Vector3,e=new a.Vector3;return function(n,r){t.subVectors(n,this.start),e.subVectors(this.end,this.start);var i=e.dot(e),o=e.dot(t),s=o/i;return r&&(s=a.Math.clamp(s,0,1)),s}}(),closestPointToPoint:function(t,e,n){var r=this.closestPointToPointParameter(t,e),i=n||new a.Vector3;return this.delta(i).multiplyScalar(r).add(this.start)},applyMatrix4:function(t){return this.start.applyMatrix4(t),this.end.applyMatrix4(t),this},equals:function(t){return t.start.equals(this.start)&&t.end.equals(this.end)}},a.Box2=function(t,e){this.min=void 0!==t?t:new a.Vector2((+(1/0)),(+(1/0))),this.max=void 0!==e?e:new a.Vector2((-(1/0)),(-(1/0)))},a.Box2.prototype={constructor:a.Box2,set:function(t,e){return this.min.copy(t),this.max.copy(e),this},setFromPoints:function(t){this.makeEmpty();for(var e=0,n=t.length;e<n;e++)this.expandByPoint(t[e]);return this},setFromCenterAndSize:function(){var t=new a.Vector2;return function(e,n){var r=t.copy(n).multiplyScalar(.5);return this.min.copy(e).sub(r),this.max.copy(e).add(r),this}}(),clone:function(){return(new this.constructor).copy(this)},copy:function(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},center:function(t){var e=t||new a.Vector2;return e.addVectors(this.min,this.max).multiplyScalar(.5)},size:function(t){var e=t||new a.Vector2;return 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){var n=e||new a.Vector2;return n.set((t.x-this.min.x)/(this.max.x-this.min.x),(t.y-this.min.y)/(this.max.y-this.min.y))},intersectsBox:function(t){return!(t.max.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){var n=e||new a.Vector2;return n.copy(t).clamp(this.min,this.max)},distanceToPoint:function(){var t=new a.Vector2;return function(e){var n=t.copy(e).clamp(this.min,this.max);return n.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)}},a.Box3=function(t,e){this.min=void 0!==t?t:new a.Vector3((+(1/0)),(+(1/0)),(+(1/0))),this.max=void 0!==e?e:new a.Vector3((-(1/0)),(-(1/0)),(-(1/0)))},a.Box3.prototype={constructor:a.Box3,set:function(t,e){return this.min.copy(t),this.max.copy(e),this},setFromArray:function(t){for(var e=+(1/0),n=+(1/0),r=+(1/0),i=-(1/0),a=-(1/0),o=-(1/0),s=0,c=t.length;s<c;s+=3){var u=t[s],l=t[s+1],h=t[s+2];u<e&&(e=u),l<n&&(n=l),h<r&&(r=h),u>i&&(i=u),l>a&&(a=l),h>o&&(o=h)}this.min.set(e,n,r),this.max.set(i,a,o)},setFromPoints:function(t){this.makeEmpty();for(var e=0,n=t.length;e<n;e++)this.expandByPoint(t[e]);return this},setFromCenterAndSize:function(){var t=new a.Vector3;return function(e,n){var r=t.copy(n).multiplyScalar(.5);return this.min.copy(e).sub(r),this.max.copy(e).add(r),this}}(),setFromObject:function(){var t=new a.Vector3;return function(e){var n=this;return e.updateMatrixWorld(!0),this.makeEmpty(),e.traverse(function(e){var r=e.geometry;if(void 0!==r)if(r instanceof a.Geometry)for(var i=r.vertices,o=0,s=i.length;o<s;o++)t.copy(i[o]),t.applyMatrix4(e.matrixWorld),n.expandByPoint(t);else if(r instanceof a.BufferGeometry&&void 0!==r.attributes.position)for(var c=r.attributes.position.array,o=0,s=c.length;o<s;o+=3)t.fromArray(c,o),t.applyMatrix4(e.matrixWorld),n.expandByPoint(t)}),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=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},center:function(t){var e=t||new a.Vector3;return e.addVectors(this.min,this.max).multiplyScalar(.5)},size:function(t){var e=t||new a.Vector3;return 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||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){var n=e||new a.Vector3;return n.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;return function(e){return void 0===t&&(t=new a.Vector3),this.clampPoint(e.center,t),t.distanceToSquared(e.center)<=e.radius*e.radius}}(),intersectsPlane:function(t){var e,n;return t.normal.x>0?(e=t.normal.x*this.min.x,n=t.normal.x*this.max.x):(e=t.normal.x*this.max.x,n=t.normal.x*this.min.x),t.normal.y>0?(e+=t.normal.y*this.min.y,n+=t.normal.y*this.max.y):(e+=t.normal.y*this.max.y,n+=t.normal.y*this.min.y),t.normal.z>0?(e+=t.normal.z*this.min.z,n+=t.normal.z*this.max.z):(e+=t.normal.z*this.max.z,n+=t.normal.z*this.min.z),e<=t.constant&&n>=t.constant},clampPoint:function(t,e){var n=e||new a.Vector3;return n.copy(t).clamp(this.min,this.max)},distanceToPoint:function(){var t=new a.Vector3;return function(e){var n=t.copy(e).clamp(this.min,this.max);return n.sub(e).length()}}(),getBoundingSphere:function(){var t=new a.Vector3;return function(e){var n=e||new a.Sphere;return n.center=this.center(),n.radius=.5*this.size(t).length(),n}}(),intersect:function(t){return this.min.max(t.min),this.max.min(t.max),this.isEmpty()&&this.makeEmpty(),this},union:function(t){return this.min.min(t.min),this.max.max(t.max),this},applyMatrix4:function(){var t=[new a.Vector3,new a.Vector3,new a.Vector3,new a.Vector3,new a.Vector3,new a.Vector3,new a.Vector3,new a.Vector3];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)}},a.Matrix3=function(){this.elements=new Float32Array([1,0,0,0,1,0,0,0,1]),arguments.length>0&&console.error("THREE.Matrix3: the constructor no longer reads arguments. use .set() instead.")},a.Matrix3.prototype={constructor:a.Matrix3,set:function(t,e,n,r,i,a,o,s,c){var u=this.elements;return u[0]=t,u[1]=r,u[2]=o,u[3]=e,u[4]=i,u[5]=s,u[6]=n,u[7]=a,u[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=t.elements;return this.set(e[0],e[3],e[6],e[1],e[4],e[7],e[2],e[5],e[8]),this},setFromMatrix4:function(t){var e=t.elements;return this.set(e[0],e[4],e[8],e[1],e[5],e[9],e[2],e[6],e[10]),this},applyToVector3Array:function(){var t;return function(e,n,r){void 0===t&&(t=new a.Vector3),void 0===n&&(n=0),void 0===r&&(r=e.length);for(var i=0,o=n;i<r;i+=3,o+=3)t.fromArray(e,o),t.applyMatrix3(this),t.toArray(e,o);return e}}(),applyToBuffer:function(){var t;return function(e,n,r){void 0===t&&(t=new a.Vector3),void 0===n&&(n=0),void 0===r&&(r=e.length/e.itemSize);for(var i=0,o=n;i<r;i++,o++)t.x=e.getX(o),t.y=e.getY(o),t.z=e.getZ(o),t.applyMatrix3(this),e.setXYZ(t.x,t.y,t.z);return e}}(),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],n=t[1],r=t[2],i=t[3],a=t[4],o=t[5],s=t[6],c=t[7],u=t[8];return e*a*u-e*o*c-n*i*u+n*o*s+r*i*c-r*a*s},getInverse:function(t,e){t instanceof a.Matrix4&&console.error("THREE.Matrix3.getInverse no longer takes a Matrix4 argument.");var n=t.elements,r=this.elements,i=n[0],o=n[1],s=n[2],c=n[3],u=n[4],l=n[5],h=n[6],f=n[7],p=n[8],d=p*u-l*f,m=l*h-p*c,g=f*c-u*h,v=i*d+o*m+s*g;if(0===v){var y="THREE.Matrix3.getInverse(): can't invert matrix, determinant is 0";if(e)throw new Error(y);return console.warn(y),this.identity()}var x=1/v;return r[0]=d*x,r[1]=(s*f-p*o)*x,r[2]=(l*o-s*u)*x,r[3]=m*x,r[4]=(p*i-s*h)*x,r[5]=(s*c-l*i)*x,r[6]=g*x,r[7]=(o*h-f*i)*x,r[8]=(u*i-o*c)*x,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},flattenToArrayOffset:function(t,e){return console.warn("THREE.Matrix3: .flattenToArrayOffset is deprecated - just use .toArray instead."),this.toArray(t,e)},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},fromArray:function(t){return this.elements.set(t),this},toArray:function(t,e){void 0===t&&(t=[]),void 0===e&&(e=0);var n=this.elements;return t[e]=n[0],t[e+1]=n[1],t[e+2]=n[2],t[e+3]=n[3],t[e+4]=n[4],t[e+5]=n[5],t[e+6]=n[6],t[e+7]=n[7],t[e+8]=n[8],t}},a.Matrix4=function(){this.elements=new Float32Array([1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1]),arguments.length>0&&console.error("THREE.Matrix4: the constructor no longer reads arguments. use .set() instead.")},a.Matrix4.prototype={constructor:a.Matrix4,set:function(t,e,n,r,i,a,o,s,c,u,l,h,f,p,d,m){var g=this.elements;return g[0]=t,g[4]=e,g[8]=n,g[12]=r,g[1]=i,g[5]=a,g[9]=o,g[13]=s,g[2]=c,g[6]=u,g[10]=l,g[14]=h,g[3]=f,g[7]=p,g[11]=d,g[15]=m,this},identity:function(){return this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1),this},clone:function(){return(new a.Matrix4).fromArray(this.elements)},copy:function(t){return this.elements.set(t.elements),this},copyPosition:function(t){var e=this.elements,n=t.elements;return e[12]=n[12],e[13]=n[13],e[14]=n[14],this},extractBasis:function(t,e,n){return t.setFromMatrixColumn(this,0),e.setFromMatrixColumn(this,1),n.setFromMatrixColumn(this,2),this},makeBasis:function(t,e,n){return this.set(t.x,e.x,n.x,0,t.y,e.y,n.y,0,t.z,e.z,n.z,0,0,0,0,1),this},extractRotation:function(){var t;return function(e){void 0===t&&(t=new a.Vector3);var n=this.elements,r=e.elements,i=1/t.setFromMatrixColumn(e,0).length(),o=1/t.setFromMatrixColumn(e,1).length(),s=1/t.setFromMatrixColumn(e,2).length();return n[0]=r[0]*i,n[1]=r[1]*i,n[2]=r[2]*i,n[4]=r[4]*o,n[5]=r[5]*o,n[6]=r[6]*o,n[8]=r[8]*s,n[9]=r[9]*s,n[10]=r[10]*s,this}}(),makeRotationFromEuler:function(t){t instanceof a.Euler==!1&&console.error("THREE.Matrix: .makeRotationFromEuler() now expects a Euler rotation rather than a Vector3 and order.");var e=this.elements,n=t.x,r=t.y,i=t.z,o=Math.cos(n),s=Math.sin(n),c=Math.cos(r),u=Math.sin(r),l=Math.cos(i),h=Math.sin(i);if("XYZ"===t.order){var f=o*l,p=o*h,d=s*l,m=s*h;e[0]=c*l,e[4]=-c*h,e[8]=u,e[1]=p+d*u,e[5]=f-m*u,e[9]=-s*c,e[2]=m-f*u,e[6]=d+p*u,e[10]=o*c}else if("YXZ"===t.order){var g=c*l,v=c*h,y=u*l,x=u*h;e[0]=g+x*s,e[4]=y*s-v,e[8]=o*u,e[1]=o*h,e[5]=o*l,e[9]=-s,e[2]=v*s-y,e[6]=x+g*s,e[10]=o*c}else if("ZXY"===t.order){var g=c*l,v=c*h,y=u*l,x=u*h;e[0]=g-x*s,e[4]=-o*h,e[8]=y+v*s,e[1]=v+y*s,e[5]=o*l,e[9]=x-g*s,e[2]=-o*u,e[6]=s,e[10]=o*c}else if("ZYX"===t.order){var f=o*l,p=o*h,d=s*l,m=s*h;e[0]=c*l,e[4]=d*u-p,e[8]=f*u+m,e[1]=c*h,e[5]=m*u+f,e[9]=p*u-d,e[2]=-u,e[6]=s*c,e[10]=o*c}else if("YZX"===t.order){var b=o*c,M=o*u,_=s*c,w=s*u;e[0]=c*l,e[4]=w-b*h,e[8]=_*h+M,e[1]=h,e[5]=o*l,e[9]=-s*l,e[2]=-u*l,e[6]=M*h+_,e[10]=b-w*h}else if("XZY"===t.order){var b=o*c,M=o*u,_=s*c,w=s*u;e[0]=c*l,e[4]=-h,e[8]=u*l,e[1]=b*h+w,e[5]=o*l,e[9]=M*h-_,e[2]=_*h-M,e[6]=s*l,e[10]=w*h+b}return e[3]=0,e[7]=0,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,this},makeRotationFromQuaternion:function(t){var e=this.elements,n=t.x,r=t.y,i=t.z,a=t.w,o=n+n,s=r+r,c=i+i,u=n*o,l=n*s,h=n*c,f=r*s,p=r*c,d=i*c,m=a*o,g=a*s,v=a*c;return e[0]=1-(f+d),e[4]=l-v,e[8]=h+g,e[1]=l+v,e[5]=1-(u+d),e[9]=p-m,e[2]=h-g,e[6]=p+m,e[10]=1-(u+f),e[3]=0,e[7]=0,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,this},lookAt:function(){var t,e,n;return function(r,i,o){void 0===t&&(t=new a.Vector3,e=new a.Vector3,n=new a.Vector3);var s=this.elements;return n.subVectors(r,i).normalize(),0===n.lengthSq()&&(n.z=1),t.crossVectors(o,n).normalize(),0===t.lengthSq()&&(n.z+=1e-4,t.crossVectors(o,n).normalize()),e.crossVectors(n,t),s[0]=t.x,s[4]=e.x,s[8]=n.x,s[1]=t.y,s[5]=e.y,s[9]=n.y,s[2]=t.z,s[6]=e.z,s[10]=n.z,this}}(),multiply:function(t,e){return void 0!==e?(console.warn("THREE.Matrix4: .multiply() now only accepts one argument. Use .multiplyMatrices( a, b ) instead."),this.multiplyMatrices(t,e)):this.multiplyMatrices(this,t)},premultiply:function(t){return this.multiplyMatrices(t,this)},multiplyMatrices:function(t,e){var n=t.elements,r=e.elements,i=this.elements,a=n[0],o=n[4],s=n[8],c=n[12],u=n[1],l=n[5],h=n[9],f=n[13],p=n[2],d=n[6],m=n[10],g=n[14],v=n[3],y=n[7],x=n[11],b=n[15],M=r[0],_=r[4],w=r[8],S=r[12],E=r[1],T=r[5],A=r[9],L=r[13],C=r[2],R=r[6],P=r[10],D=r[14],N=r[3],U=r[7],B=r[11],I=r[15];return i[0]=a*M+o*E+s*C+c*N,i[4]=a*_+o*T+s*R+c*U,i[8]=a*w+o*A+s*P+c*B,i[12]=a*S+o*L+s*D+c*I,i[1]=u*M+l*E+h*C+f*N,i[5]=u*_+l*T+h*R+f*U,i[9]=u*w+l*A+h*P+f*B,i[13]=u*S+l*L+h*D+f*I,i[2]=p*M+d*E+m*C+g*N,i[6]=p*_+d*T+m*R+g*U,i[10]=p*w+d*A+m*P+g*B,i[14]=p*S+d*L+m*D+g*I,i[3]=v*M+y*E+x*C+b*N,i[7]=v*_+y*T+x*R+b*U,i[11]=v*w+y*A+x*P+b*B,i[15]=v*S+y*L+x*D+b*I,this},multiplyToArray:function(t,e,n){var r=this.elements;return this.multiplyMatrices(t,e),n[0]=r[0],n[1]=r[1],n[2]=r[2],n[3]=r[3],n[4]=r[4],n[5]=r[5],n[6]=r[6],n[7]=r[7],n[8]=r[8],n[9]=r[9],n[10]=r[10],n[11]=r[11],n[12]=r[12],n[13]=r[13],n[14]=r[14],n[15]=r[15],this},multiplyScalar:function(t){var e=this.elements;return e[0]*=t,e[4]*=t,e[8]*=t,e[12]*=t,e[1]*=t,e[5]*=t,e[9]*=t,e[13]*=t,e[2]*=t,e[6]*=t,e[10]*=t,e[14]*=t,e[3]*=t,e[7]*=t,e[11]*=t,e[15]*=t,this},applyToVector3Array:function(){var t;return function(e,n,r){void 0===t&&(t=new a.Vector3),void 0===n&&(n=0),void 0===r&&(r=e.length);for(var i=0,o=n;i<r;i+=3,o+=3)t.fromArray(e,o),t.applyMatrix4(this),t.toArray(e,o);return e}}(),applyToBuffer:function(){var t;return function(e,n,r){void 0===t&&(t=new a.Vector3),void 0===n&&(n=0),void 0===r&&(r=e.length/e.itemSize);for(var i=0,o=n;i<r;i++,o++)t.x=e.getX(o),t.y=e.getY(o),t.z=e.getZ(o),t.applyMatrix4(this),e.setXYZ(t.x,t.y,t.z);return e}}(),determinant:function(){var t=this.elements,e=t[0],n=t[4],r=t[8],i=t[12],a=t[1],o=t[5],s=t[9],c=t[13],u=t[2],l=t[6],h=t[10],f=t[14],p=t[3],d=t[7],m=t[11],g=t[15];return p*(+i*s*l-r*c*l-i*o*h+n*c*h+r*o*f-n*s*f)+d*(+e*s*f-e*c*h+i*a*h-r*a*f+r*c*u-i*s*u)+m*(+e*c*l-e*o*f-i*a*l+n*a*f+i*o*u-n*c*u)+g*(-r*o*u-e*s*l+e*o*h+r*a*l-n*a*h+n*s*u)},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},flattenToArrayOffset:function(t,e){return console.warn("THREE.Matrix3: .flattenToArrayOffset is deprecated - just use .toArray instead."),this.toArray(t,e)},getPosition:function(){var t;return function(){return void 0===t&&(t=new a.Vector3),console.warn("THREE.Matrix4: .getPosition() has been removed. Use Vector3.setFromMatrixPosition( matrix ) instead."),t.setFromMatrixColumn(this,3)}}(),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 n=this.elements,r=t.elements,i=r[0],a=r[1],o=r[2],s=r[3],c=r[4],u=r[5],l=r[6],h=r[7],f=r[8],p=r[9],d=r[10],m=r[11],g=r[12],v=r[13],y=r[14],x=r[15],b=p*y*h-v*d*h+v*l*m-u*y*m-p*l*x+u*d*x,M=g*d*h-f*y*h-g*l*m+c*y*m+f*l*x-c*d*x,_=f*v*h-g*p*h+g*u*m-c*v*m-f*u*x+c*p*x,w=g*p*l-f*v*l-g*u*d+c*v*d+f*u*y-c*p*y,S=i*b+a*M+o*_+s*w;if(0===S){var E="THREE.Matrix4.getInverse(): can't invert matrix, determinant is 0";if(e)throw new Error(E);return console.warn(E),this.identity()}var T=1/S;return n[0]=b*T,n[1]=(v*d*s-p*y*s-v*o*m+a*y*m+p*o*x-a*d*x)*T,n[2]=(u*y*s-v*l*s+v*o*h-a*y*h-u*o*x+a*l*x)*T,n[3]=(p*l*s-u*d*s-p*o*h+a*d*h+u*o*m-a*l*m)*T,n[4]=M*T,n[5]=(f*y*s-g*d*s+g*o*m-i*y*m-f*o*x+i*d*x)*T,n[6]=(g*l*s-c*y*s-g*o*h+i*y*h+c*o*x-i*l*x)*T,n[7]=(c*d*s-f*l*s+f*o*h-i*d*h-c*o*m+i*l*m)*T,n[8]=_*T,n[9]=(g*p*s-f*v*s-g*a*m+i*v*m+f*a*x-i*p*x)*T,n[10]=(c*v*s-g*u*s+g*a*h-i*v*h-c*a*x+i*u*x)*T,n[11]=(f*u*s-c*p*s-f*a*h+i*p*h+c*a*m-i*u*m)*T,n[12]=w*T,n[13]=(f*v*o-g*p*o+g*a*d-i*v*d-f*a*y+i*p*y)*T,n[14]=(g*u*o-c*v*o-g*a*l+i*v*l+c*a*y-i*u*y)*T,n[15]=(c*p*o-f*u*o+f*a*l-i*p*l-c*a*d+i*u*d)*T,this},scale:function(t){var e=this.elements,n=t.x,r=t.y,i=t.z;return e[0]*=n,e[4]*=r,e[8]*=i,e[1]*=n,e[5]*=r,e[9]*=i,e[2]*=n,e[6]*=r,e[10]*=i,e[3]*=n,e[7]*=r,e[11]*=i,this},getMaxScaleOnAxis:function(){var t=this.elements,e=t[0]*t[0]+t[1]*t[1]+t[2]*t[2],n=t[4]*t[4]+t[5]*t[5]+t[6]*t[6],r=t[8]*t[8]+t[9]*t[9]+t[10]*t[10];return Math.sqrt(Math.max(e,n,r))},makeTranslation:function(t,e,n){return this.set(1,0,0,t,0,1,0,e,0,0,1,n,0,0,0,1),this},makeRotationX:function(t){var e=Math.cos(t),n=Math.sin(t);return this.set(1,0,0,0,0,e,-n,0,0,n,e,0,0,0,0,1),this},makeRotationY:function(t){var e=Math.cos(t),n=Math.sin(t);return this.set(e,0,n,0,0,1,0,0,-n,0,e,0,0,0,0,1),this},makeRotationZ:function(t){var e=Math.cos(t),n=Math.sin(t);return this.set(e,-n,0,0,n,e,0,0,0,0,1,0,0,0,0,1),this},makeRotationAxis:function(t,e){var n=Math.cos(e),r=Math.sin(e),i=1-n,a=t.x,o=t.y,s=t.z,c=i*a,u=i*o;return this.set(c*a+n,c*o-r*s,c*s+r*o,0,c*o+r*s,u*o+n,u*s-r*a,0,c*s-r*o,u*s+r*a,i*s*s+n,0,0,0,0,1),this},makeScale:function(t,e,n){return this.set(t,0,0,0,0,e,0,0,0,0,n,0,0,0,0,1),this},compose:function(t,e,n){return this.makeRotationFromQuaternion(e),this.scale(n),this.setPosition(t),this},decompose:function(){var t,e;return function(n,r,i){void 0===t&&(t=new a.Vector3,e=new a.Matrix4);var o=this.elements,s=t.set(o[0],o[1],o[2]).length(),c=t.set(o[4],o[5],o[6]).length(),u=t.set(o[8],o[9],o[10]).length(),l=this.determinant();l<0&&(s=-s),n.x=o[12],n.y=o[13],n.z=o[14],e.elements.set(this.elements);var h=1/s,f=1/c,p=1/u;return e.elements[0]*=h,e.elements[1]*=h,e.elements[2]*=h,e.elements[4]*=f,e.elements[5]*=f,e.elements[6]*=f,e.elements[8]*=p,e.elements[9]*=p,e.elements[10]*=p,r.setFromRotationMatrix(e),i.x=s,i.y=c,i.z=u,this}}(),makeFrustum:function(t,e,n,r,i,a){var o=this.elements,s=2*i/(e-t),c=2*i/(r-n),u=(e+t)/(e-t),l=(r+n)/(r-n),h=-(a+i)/(a-i),f=-2*a*i/(a-i);return o[0]=s,o[4]=0,o[8]=u,o[12]=0,o[1]=0,o[5]=c,o[9]=l,o[13]=0,o[2]=0,o[6]=0,o[10]=h,o[14]=f,o[3]=0,o[7]=0,o[11]=-1,o[15]=0,this},makePerspective:function(t,e,n,r){var i=n*Math.tan(a.Math.DEG2RAD*t*.5),o=-i,s=o*e,c=i*e;return this.makeFrustum(s,c,o,i,n,r)},makeOrthographic:function(t,e,n,r,i,a){var o=this.elements,s=1/(e-t),c=1/(n-r),u=1/(a-i),l=(e+t)*s,h=(n+r)*c,f=(a+i)*u;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]=-h,o[2]=0,o[6]=0,o[10]=-2*u,o[14]=-f,o[3]=0,o[7]=0,o[11]=0,o[15]=1,this},equals:function(t){for(var e=this.elements,n=t.elements,r=0;r<16;r++)if(e[r]!==n[r])return!1;return!0},fromArray:function(t){return this.elements.set(t),this},toArray:function(t,e){void 0===t&&(t=[]),void 0===e&&(e=0);var n=this.elements;return t[e]=n[0],t[e+1]=n[1],t[e+2]=n[2],t[e+3]=n[3],t[e+4]=n[4],t[e+5]=n[5],t[e+6]=n[6],t[e+7]=n[7],t[e+8]=n[8],t[e+9]=n[9],t[e+10]=n[10],t[e+11]=n[11],t[e+12]=n[12],t[e+13]=n[13],t[e+14]=n[14],t[e+15]=n[15],t}},a.Ray=function(t,e){this.origin=void 0!==t?t:new a.Vector3,this.direction=void 0!==e?e:new a.Vector3},a.Ray.prototype={constructor:a.Ray,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){var n=e||new a.Vector3;return n.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 a.Vector3;return function(e){return this.origin.copy(this.at(e,t)),this}}(),closestPointToPoint:function(t,e){var n=e||new a.Vector3;n.subVectors(t,this.origin);var r=n.dot(this.direction);return r<0?n.copy(this.origin):n.copy(this.direction).multiplyScalar(r).add(this.origin)},distanceToPoint:function(t){return Math.sqrt(this.distanceSqToPoint(t))},distanceSqToPoint:function(){var t=new a.Vector3;return function(e){var n=t.subVectors(e,this.origin).dot(this.direction);return n<0?this.origin.distanceToSquared(e):(t.copy(this.direction).multiplyScalar(n).add(this.origin),t.distanceToSquared(e))}}(),distanceSqToSegment:function(){var t=new a.Vector3,e=new a.Vector3,n=new a.Vector3;return function(r,i,a,o){t.copy(r).add(i).multiplyScalar(.5),e.copy(i).sub(r).normalize(),n.copy(this.origin).sub(t);var s,c,u,l,h=.5*r.distanceTo(i),f=-this.direction.dot(e),p=n.dot(this.direction),d=-n.dot(e),m=n.lengthSq(),g=Math.abs(1-f*f);if(g>0)if(s=f*d-p,c=f*p-d,l=h*g,s>=0)if(c>=-l)if(c<=l){var v=1/g;s*=v,c*=v,u=s*(s+f*c+2*p)+c*(f*s+c+2*d)+m}else c=h,s=Math.max(0,-(f*c+p)),u=-s*s+c*(c+2*d)+m;else c=-h,s=Math.max(0,-(f*c+p)),u=-s*s+c*(c+2*d)+m;else c<=-l?(s=Math.max(0,-(-f*h+p)),c=s>0?-h:Math.min(Math.max(-h,-d),h),u=-s*s+c*(c+2*d)+m):c<=l?(s=0,c=Math.min(Math.max(-h,-d),h),u=c*(c+2*d)+m):(s=Math.max(0,-(f*h+p)),c=s>0?h:Math.min(Math.max(-h,-d),h),u=-s*s+c*(c+2*d)+m);else c=f>0?-h:h,s=Math.max(0,-(f*c+p)),u=-s*s+c*(c+2*d)+m;return a&&a.copy(this.direction).multiplyScalar(s).add(this.origin),o&&o.copy(e).multiplyScalar(c).add(t),u}}(),intersectSphere:function(){var t=new a.Vector3;return function(e,n){t.subVectors(e.center,this.origin);var r=t.dot(this.direction),i=t.dot(t)-r*r,a=e.radius*e.radius;if(i>a)return null;var o=Math.sqrt(a-i),s=r-o,c=r+o;return s<0&&c<0?null:s<0?this.at(c,n):this.at(s,n)}}(),intersectsSphere:function(t){return this.distanceToPoint(t.center)<=t.radius},distanceToPlane:function(t){var e=t.normal.dot(this.direction);if(0===e)return 0===t.distanceToPoint(this.origin)?0:null;var n=-(this.origin.dot(t.normal)+t.constant)/e;return n>=0?n:null},intersectPlane:function(t,e){var n=this.distanceToPlane(t);return null===n?null:this.at(n,e)},intersectsPlane:function(t){var e=t.distanceToPoint(this.origin);if(0===e)return!0;var n=t.normal.dot(this.direction);return n*e<0},intersectBox:function(t,e){var n,r,i,a,o,s,c=1/this.direction.x,u=1/this.direction.y,l=1/this.direction.z,h=this.origin;return c>=0?(n=(t.min.x-h.x)*c,r=(t.max.x-h.x)*c):(n=(t.max.x-h.x)*c,r=(t.min.x-h.x)*c),u>=0?(i=(t.min.y-h.y)*u,a=(t.max.y-h.y)*u):(i=(t.max.y-h.y)*u,a=(t.min.y-h.y)*u),n>a||i>r?null:((i>n||n!==n)&&(n=i),(a<r||r!==r)&&(r=a),l>=0?(o=(t.min.z-h.z)*l,s=(t.max.z-h.z)*l):(o=(t.max.z-h.z)*l,s=(t.min.z-h.z)*l),n>s||o>r?null:((o>n||n!==n)&&(n=o),(s<r||r!==r)&&(r=s),r<0?null:this.at(n>=0?n:r,e)))},intersectsBox:function(){var t=new a.Vector3;return function(e){return null!==this.intersectBox(e,t)}}(),intersectTriangle:function(){var t=new a.Vector3,e=new a.Vector3,n=new a.Vector3,r=new a.Vector3;return function(i,a,o,s,c){e.subVectors(a,i),n.subVectors(o,i),r.crossVectors(e,n);var u,l=this.direction.dot(r);if(l>0){if(s)return null;u=1}else{if(!(l<0))return null;u=-1,l=-l}t.subVectors(this.origin,i);var h=u*this.direction.dot(n.crossVectors(t,n));if(h<0)return null;var f=u*this.direction.dot(e.cross(t));if(f<0)return null;if(h+f>l)return null;var p=-u*t.dot(r);return p<0?null:this.at(p/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)}},a.Sphere=function(t,e){this.center=void 0!==t?t:new a.Vector3,this.radius=void 0!==e?e:0},a.Sphere.prototype={constructor:a.Sphere,set:function(t,e){return this.center.copy(t),this.radius=e,this},setFromPoints:function(){var t=new a.Box3;return function(e,n){var r=this.center;void 0!==n?r.copy(n):t.setFromPoints(e).center(r);for(var i=0,a=0,o=e.length;a<o;a++)i=Math.max(i,r.distanceToSquared(e[a]));return this.radius=Math.sqrt(i),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 n=this.center.distanceToSquared(t),r=e||new a.Vector3;return r.copy(t),n>this.radius*this.radius&&(r.sub(this.center).normalize(),r.multiplyScalar(this.radius).add(this.center)),r},getBoundingBox:function(t){var e=t||new a.Box3;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}},a.Frustum=function(t,e,n,r,i,o){this.planes=[void 0!==t?t:new a.Plane,void 0!==e?e:new a.Plane,void 0!==n?n:new a.Plane,void 0!==r?r:new a.Plane,void 0!==i?i:new a.Plane,void 0!==o?o:new a.Plane]},a.Frustum.prototype={constructor:a.Frustum,set:function(t,e,n,r,i,a){var o=this.planes;return o[0].copy(t),o[1].copy(e),o[2].copy(n),o[3].copy(r),o[4].copy(i),o[5].copy(a),this},clone:function(){return(new this.constructor).copy(this)},copy:function(t){for(var e=this.planes,n=0;n<6;n++)e[n].copy(t.planes[n]);return this},setFromMatrix:function(t){var e=this.planes,n=t.elements,r=n[0],i=n[1],a=n[2],o=n[3],s=n[4],c=n[5],u=n[6],l=n[7],h=n[8],f=n[9],p=n[10],d=n[11],m=n[12],g=n[13],v=n[14],y=n[15];return e[0].setComponents(o-r,l-s,d-h,y-m).normalize(),e[1].setComponents(o+r,l+s,d+h,y+m).normalize(),e[2].setComponents(o+i,l+c,d+f,y+g).normalize(),e[3].setComponents(o-i,l-c,d-f,y-g).normalize(),e[4].setComponents(o-a,l-u,d-p,y-v).normalize(),e[5].setComponents(o+a,l+u,d+p,y+v).normalize(),this},intersectsObject:function(){var t=new a.Sphere;return function(e){var n=e.geometry;return null===n.boundingSphere&&n.computeBoundingSphere(),t.copy(n.boundingSphere).applyMatrix4(e.matrixWorld),this.intersectsSphere(t)}}(),intersectsSprite:function(){var t=new a.Sphere;return function(e){return t.center.set(0,0,0),t.radius=.7071067811865476,t.applyMatrix4(e.matrixWorld),this.intersectsSphere(t)}}(),intersectsSphere:function(t){for(var e=this.planes,n=t.center,r=-t.radius,i=0;i<6;i++){var a=e[i].distanceToPoint(n);if(a<r)return!1}return!0},intersectsBox:function(){var t=new a.Vector3,e=new a.Vector3;return function(n){for(var r=this.planes,i=0;i<6;i++){var a=r[i];t.x=a.normal.x>0?n.min.x:n.max.x,e.x=a.normal.x>0?n.max.x:n.min.x,t.y=a.normal.y>0?n.min.y:n.max.y,e.y=a.normal.y>0?n.max.y:n.min.y,t.z=a.normal.z>0?n.min.z:n.max.z,e.z=a.normal.z>0?n.max.z:n.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,n=0;n<6;n++)if(e[n].distanceToPoint(t)<0)return!1;return!0}},a.Plane=function(t,e){this.normal=void 0!==t?t:new a.Vector3(1,0,0),this.constant=void 0!==e?e:0},a.Plane.prototype={constructor:a.Plane,set:function(t,e){return this.normal.copy(t),this.constant=e,this},setComponents:function(t,e,n,r){return this.normal.set(t,e,n),this.constant=r,this},setFromNormalAndCoplanarPoint:function(t,e){return this.normal.copy(t),this.constant=-e.dot(this.normal),this},setFromCoplanarPoints:function(){var t=new a.Vector3,e=new a.Vector3;return function(n,r,i){var a=t.subVectors(i,r).cross(e.subVectors(n,r)).normalize();return this.setFromNormalAndCoplanarPoint(a,n),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 n=this.distanceToPoint(t),r=e||new a.Vector3;return r.copy(this.normal).multiplyScalar(n)},intersectLine:function(){var t=new a.Vector3;return function(e,n){var r=n||new a.Vector3,i=e.delta(t),o=this.normal.dot(i);if(0!==o){var s=-(e.start.dot(this.normal)+this.constant)/o;if(!(s<0||s>1))return r.copy(i).multiplyScalar(s).add(e.start)}else if(0===this.distanceToPoint(e.start))return r.copy(e.start)}}(),intersectsLine:function(t){var e=this.distanceToPoint(t.start),n=this.distanceToPoint(t.end);return e<0&&n>0||n<0&&e>0},intersectsBox:function(t){return t.intersectsPlane(this)},intersectsSphere:function(t){return t.intersectsPlane(this)},coplanarPoint:function(t){var e=t||new a.Vector3;return e.copy(this.normal).multiplyScalar(-this.constant)},applyMatrix4:function(){var t=new a.Vector3,e=new a.Matrix3;return function(n,r){var i=this.coplanarPoint(t).applyMatrix4(n),a=r||e.getNormalMatrix(n),o=this.normal.applyMatrix3(a).normalize();return this.constant=-i.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}},a.Spherical=function(t,e,n){return this.radius=void 0!==t?t:1,this.phi=void 0!==e?e:0,this.theta=void 0!==n?n:0,this},a.Spherical.prototype={constructor:a.Spherical,set:function(t,e,n){return this.radius=t,this.phi=e,this.theta=n,this},clone:function(){return(new this.constructor).copy(this)},copy:function(t){return this.radius.copy(t.radius),this.phi.copy(t.phi),this.theta.copy(t.theta),this},makeSafe:function(){var t=1e-6;return this.phi=Math.max(t,Math.min(Math.PI-t,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(a.Math.clamp(t.y/this.radius,-1,1))),this}},a.Math={DEG2RAD:Math.PI/180,RAD2DEG:180/Math.PI,generateUUID:function(){var t,e="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz".split(""),n=new Array(36),r=0;return function(){for(var i=0;i<36;i++)8===i||13===i||18===i||23===i?n[i]="-":14===i?n[i]="4":(r<=2&&(r=33554432+16777216*Math.random()|0),t=15&r,r>>=4,n[i]=e[19===i?3&t|8:t]);return n.join("")}}(),clamp:function(t,e,n){return Math.max(e,Math.min(n,t))},euclideanModulo:function(t,e){return(t%e+e)%e},mapLinear:function(t,e,n,r,i){return r+(t-e)*(i-r)/(n-e)},smoothstep:function(t,e,n){return t<=e?0:t>=n?1:(t=(t-e)/(n-e),t*t*(3-2*t))},smootherstep:function(t,e,n){return t<=e?0:t>=n?1:(t=(t-e)/(n-e),t*t*t*(t*(6*t-15)+10))},random16:function(){return console.warn("THREE.Math.random16() has been deprecated. Use Math.random() instead."),Math.random()},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*a.Math.DEG2RAD},radToDeg:function(t){return t*a.Math.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++,t}},a.Spline=function(t){function e(t,e,n,r,i,a,o){var s=.5*(n-t),c=.5*(r-e);return(2*(e-n)+s+c)*o+(-3*(e-n)-2*s-c)*a+s*i+e}this.points=t;var n,r,i,o,s,c,u,l,h,f=[],p={x:0,y:0,z:0};this.initFromArray=function(t){this.points=[];for(var e=0;e<t.length;e++)this.points[e]={x:t[e][0],y:t[e][1],z:t[e][2]}},this.getPoint=function(t){return n=(this.points.length-1)*t,r=Math.floor(n),i=n-r,f[0]=0===r?r:r-1,f[1]=r,f[2]=r>this.points.length-2?this.points.length-1:r+1,f[3]=r>this.points.length-3?this.points.length-1:r+2,c=this.points[f[0]],u=this.points[f[1]],l=this.points[f[2]],h=this.points[f[3]],o=i*i,s=i*o,p.x=e(c.x,u.x,l.x,h.x,i,o,s),p.y=e(c.y,u.y,l.y,h.y,i,o,s),p.z=e(c.z,u.z,l.z,h.z,i,o,s),p},this.getControlPointsArray=function(){var t,e,n=this.points.length,r=[];for(t=0;t<n;t++)e=this.points[t],r[t]=[e.x,e.y,e.z];return r},this.getLength=function(t){var e,n,r,i,o=0,s=0,c=0,u=new a.Vector3,l=new a.Vector3,h=[],f=0;for(h[0]=0,t||(t=100),r=this.points.length*t,u.copy(this.points[0]),e=1;e<r;e++)n=e/r,i=this.getPoint(n),l.copy(i),f+=l.distanceTo(u),u.copy(i),o=(this.points.length-1)*n,s=Math.floor(o),s!==c&&(h[s]=f,c=s);return h[h.length]=f,{chunks:h,total:f}},this.reparametrizeByArcLength=function(t){var e,n,r,i,o,s,c,u,l=[],h=new a.Vector3,f=this.getLength();for(l.push(h.copy(this.points[0]).clone()),e=1;e<this.points.length;e++){for(s=f.chunks[e]-f.chunks[e-1],c=Math.ceil(t*s/f.total),i=(e-1)/(this.points.length-1),o=e/(this.points.length-1),n=1;n<c-1;n++)r=i+n*(1/c)*(o-i),u=this.getPoint(r),l.push(h.copy(u).clone());l.push(h.copy(this.points[e]).clone())}this.points=l}},a.Triangle=function(t,e,n){this.a=void 0!==t?t:new a.Vector3,this.b=void 0!==e?e:new a.Vector3,this.c=void 0!==n?n:new a.Vector3},a.Triangle.normal=function(){var t=new a.Vector3;return function(e,n,r,i){var o=i||new a.Vector3;o.subVectors(r,n),t.subVectors(e,n),o.cross(t);var s=o.lengthSq();return s>0?o.multiplyScalar(1/Math.sqrt(s)):o.set(0,0,0)}}(),a.Triangle.barycoordFromPoint=function(){var t=new a.Vector3,e=new a.Vector3,n=new a.Vector3;return function(r,i,o,s,c){t.subVectors(s,i),e.subVectors(o,i),n.subVectors(r,i);var u=t.dot(t),l=t.dot(e),h=t.dot(n),f=e.dot(e),p=e.dot(n),d=u*f-l*l,m=c||new a.Vector3;if(0===d)return m.set(-2,-1,-1);var g=1/d,v=(f*h-l*p)*g,y=(u*p-l*h)*g;return m.set(1-v-y,y,v)}}(),a.Triangle.containsPoint=function(){var t=new a.Vector3;return function(e,n,r,i){var o=a.Triangle.barycoordFromPoint(e,n,r,i,t);return o.x>=0&&o.y>=0&&o.x+o.y<=1}}(),a.Triangle.prototype={constructor:a.Triangle,set:function(t,e,n){return this.a.copy(t),this.b.copy(e),this.c.copy(n),this},setFromPointsAndIndices:function(t,e,n,r){return this.a.copy(t[e]),this.b.copy(t[n]),this.c.copy(t[r]),this},clone:function(){return(new this.constructor).copy(this)},copy:function(t){return this.a.copy(t.a),this.b.copy(t.b),this.c.copy(t.c),this},area:function(){var t=new a.Vector3,e=new a.Vector3;return function(){return t.subVectors(this.c,this.b),e.subVectors(this.a,this.b),.5*t.cross(e).length()}}(),midpoint:function(t){var e=t||new a.Vector3;return e.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)},normal:function(t){return a.Triangle.normal(this.a,this.b,this.c,t)},plane:function(t){var e=t||new a.Plane;return e.setFromCoplanarPoints(this.a,this.b,this.c)},barycoordFromPoint:function(t,e){return a.Triangle.barycoordFromPoint(t,this.a,this.b,this.c,e)},containsPoint:function(t){return a.Triangle.containsPoint(t,this.a,this.b,this.c)},closestPointToPoint:function(){var t,e,n,r;return function(i,o){void 0===t&&(t=new a.Plane,e=[new a.Line3,new a.Line3,new a.Line3],n=new a.Vector3,r=new a.Vector3);var s=o||new a.Vector3,c=1/0;if(t.setFromCoplanarPoints(this.a,this.b,this.c),t.projectPoint(i,n),this.containsPoint(n)===!0)s.copy(n);else{e[0].set(this.a,this.b),e[1].set(this.b,this.c),e[2].set(this.c,this.a);for(var u=0;u<e.length;u++){e[u].closestPointToPoint(n,!0,r);var l=n.distanceToSquared(r);l<c&&(c=l,s.copy(r))}}return s}}(),equals:function(t){return t.a.equals(this.a)&&t.b.equals(this.b)&&t.c.equals(this.c)}},a.Interpolant=function(t,e,n,r){this.parameterPositions=t,this._cachedIndex=0,this.resultBuffer=void 0!==r?r:new e.constructor(n),this.sampleValues=e,this.valueSize=n},a.Interpolant.prototype={constructor:a.Interpolant,evaluate:function(t){var e=this.parameterPositions,n=this._cachedIndex,r=e[n],i=e[n-1];t:{e:{var a;n:{r:if(!(t<r)){for(var o=n+2;;){if(void 0===r){if(t<i)break r;return n=e.length,this._cachedIndex=n,this.afterEnd_(n-1,t,i)}if(n===o)break;if(i=r,r=e[++n],t<r)break e}a=e.length;break n}{if(t>=i)break t;var s=e[1];t<s&&(n=2,i=s);for(var o=n-2;;){if(void 0===i)return this._cachedIndex=0,this.beforeStart_(0,t,r);if(n===o)break;if(r=i,i=e[--n-1],t>=i)break e}a=n,n=0}}for(;n<a;){var c=n+a>>>1;t<e[c]?a=c:n=c+1}if(r=e[n],i=e[n-1],void 0===i)return this._cachedIndex=0,this.beforeStart_(0,t,r);if(void 0===r)return n=e.length,this._cachedIndex=n,this.afterEnd_(n-1,i,t)}this._cachedIndex=n,this.intervalChanged_(n,i,r)}return this.interpolate_(n,i,t,r)},settings:null,DefaultSettings_:{},getSettings_:function(){return this.settings||this.DefaultSettings_},copySampleValue_:function(t){for(var e=this.resultBuffer,n=this.sampleValues,r=this.valueSize,i=t*r,a=0;a!==r;++a)e[a]=n[i+a];return e},interpolate_:function(t,e,n,r){throw new Error("call to abstract method")},intervalChanged_:function(t,e,n){}},Object.assign(a.Interpolant.prototype,{beforeStart_:a.Interpolant.prototype.copySampleValue_,afterEnd_:a.Interpolant.prototype.copySampleValue_}),a.CubicInterpolant=function(t,e,n,r){a.Interpolant.call(this,t,e,n,r),this._weightPrev=-0,this._offsetPrev=-0,this._weightNext=-0,this._offsetNext=-0},a.CubicInterpolant.prototype=Object.assign(Object.create(a.Interpolant.prototype),{constructor:a.CubicInterpolant,DefaultSettings_:{endingStart:a.ZeroCurvatureEnding,endingEnd:a.ZeroCurvatureEnding},intervalChanged_:function(t,e,n){var r=this.parameterPositions,i=t-2,o=t+1,s=r[i],c=r[o];if(void 0===s)switch(this.getSettings_().endingStart){case a.ZeroSlopeEnding:i=t,s=2*e-n;break;case a.WrapAroundEnding:i=r.length-2,s=e+r[i]-r[i+1];break;default:i=t,s=n}if(void 0===c)switch(this.getSettings_().endingEnd){case a.ZeroSlopeEnding:o=t,c=2*n-e;break;case a.WrapAroundEnding:o=1,c=n+r[1]-r[0];break;default:o=t-1,c=e}var u=.5*(n-e),l=this.valueSize;this._weightPrev=u/(e-s),this._weightNext=u/(c-n),this._offsetPrev=i*l,this._offsetNext=o*l},interpolate_:function(t,e,n,r){for(var i=this.resultBuffer,a=this.sampleValues,o=this.valueSize,s=t*o,c=s-o,u=this._offsetPrev,l=this._offsetNext,h=this._weightPrev,f=this._weightNext,p=(n-e)/(r-e),d=p*p,m=d*p,g=-h*m+2*h*d-h*p,v=(1+h)*m+(-1.5-2*h)*d+(-.5+h)*p+1,y=(-1-f)*m+(1.5+f)*d+.5*p,x=f*m-f*d,b=0;b!==o;++b)i[b]=g*a[u+b]+v*a[c+b]+y*a[s+b]+x*a[l+b];return i}}),a.DiscreteInterpolant=function(t,e,n,r){a.Interpolant.call(this,t,e,n,r)},a.DiscreteInterpolant.prototype=Object.assign(Object.create(a.Interpolant.prototype),{constructor:a.DiscreteInterpolant,interpolate_:function(t,e,n,r){return this.copySampleValue_(t-1)}}),a.LinearInterpolant=function(t,e,n,r){a.Interpolant.call(this,t,e,n,r)},a.LinearInterpolant.prototype=Object.assign(Object.create(a.Interpolant.prototype),{constructor:a.LinearInterpolant,interpolate_:function(t,e,n,r){for(var i=this.resultBuffer,a=this.sampleValues,o=this.valueSize,s=t*o,c=s-o,u=(n-e)/(r-e),l=1-u,h=0;h!==o;++h)i[h]=a[c+h]*l+a[s+h]*u;return i}}),a.QuaternionLinearInterpolant=function(t,e,n,r){a.Interpolant.call(this,t,e,n,r)},a.QuaternionLinearInterpolant.prototype=Object.assign(Object.create(a.Interpolant.prototype),{constructor:a.QuaternionLinearInterpolant,interpolate_:function(t,e,n,r){for(var i=this.resultBuffer,o=this.sampleValues,s=this.valueSize,c=t*s,u=(n-e)/(r-e),l=c+s;c!==l;c+=4)a.Quaternion.slerpFlat(i,0,o,c-s,o,c,u);return i}}),a.Clock=function(t){this.autoStart=void 0===t||t,this.startTime=0,this.oldTime=0,this.elapsedTime=0,this.running=!1},a.Clock.prototype={constructor:a.Clock,start:function(){this.startTime=(performance||Date).now(),this.oldTime=this.startTime,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&&this.start(),this.running){var e=(performance||Date).now();t=(e-this.oldTime)/1e3,this.oldTime=e,this.elapsedTime+=t}return t}},a.EventDispatcher=function(){},Object.assign(a.EventDispatcher.prototype,{addEventListener:function(t,e){void 0===this._listeners&&(this._listeners={});var n=this._listeners;void 0===n[t]&&(n[t]=[]),n[t].indexOf(e)===-1&&n[t].push(e)},hasEventListener:function(t,e){if(void 0===this._listeners)return!1;var n=this._listeners;return void 0!==n[t]&&n[t].indexOf(e)!==-1},removeEventListener:function(t,e){if(void 0!==this._listeners){var n=this._listeners,r=n[t];if(void 0!==r){var i=r.indexOf(e);i!==-1&&r.splice(i,1)}}},dispatchEvent:function(t){if(void 0!==this._listeners){var e=this._listeners,n=e[t.type];if(void 0!==n){t.target=this;var r=[],i=0,a=n.length;for(i=0;i<a;i++)r[i]=n[i];for(i=0;i<a;i++)r[i].call(this,t)}}}}),a.Layers=function(){this.mask=1},a.Layers.prototype={constructor:a.Layers,set:function(t){this.mask=1<<t},enable:function(t){this.mask|=1<<t},toggle:function(t){this.mask^=1<<t},disable:function(t){this.mask&=~(1<<t)},test:function(t){return 0!==(this.mask&t.mask)}},function(t){function e(t,e){return t.distance-e.distance}function n(t,e,r,i){if(t.visible!==!1&&(t.raycast(e,r),i===!0))for(var a=t.children,o=0,s=a.length;o<s;o++)n(a[o],e,r,!0)}t.Raycaster=function(e,n,r,i){this.ray=new t.Ray(e,n),this.near=r||0,this.far=i||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}}})},t.Raycaster.prototype={constructor:t.Raycaster,linePrecision:1,set:function(t,e){this.ray.set(t,e)},setFromCamera:function(e,n){n instanceof t.PerspectiveCamera?(this.ray.origin.setFromMatrixPosition(n.matrixWorld),this.ray.direction.set(e.x,e.y,.5).unproject(n).sub(this.ray.origin).normalize()):n instanceof t.OrthographicCamera?(this.ray.origin.set(e.x,e.y,(n.near+n.far)/(n.near-n.far)).unproject(n),this.ray.direction.set(0,0,-1).transformDirection(n.matrixWorld)):console.error("THREE.Raycaster: Unsupported camera type.")},intersectObject:function(t,r){var i=[];return n(t,this,i,r),i.sort(e),i},intersectObjects:function(t,r){var i=[];if(Array.isArray(t)===!1)return console.warn("THREE.Raycaster.intersectObjects: objects is not an Array."),i;for(var a=0,o=t.length;a<o;a++)n(t[a],this,i,r);return i.sort(e),i}}}(a),a.Object3D=function(){function t(){i.setFromEuler(r,!1)}function e(){r.setFromQuaternion(i,void 0,!1)}Object.defineProperty(this,"id",{value:a.Object3DIdCount++}),this.uuid=a.Math.generateUUID(),this.name="",this.type="Object3D",this.parent=null,this.children=[],this.up=a.Object3D.DefaultUp.clone();var n=new a.Vector3,r=new a.Euler,i=new a.Quaternion,o=new a.Vector3(1,1,1);r.onChange(t),i.onChange(e),Object.defineProperties(this,{position:{enumerable:!0,value:n},rotation:{enumerable:!0,value:r},quaternion:{enumerable:!0,value:i},scale:{enumerable:!0,value:o},modelViewMatrix:{value:new a.Matrix4},normalMatrix:{value:new a.Matrix3}}),this.matrix=new a.Matrix4,this.matrixWorld=new a.Matrix4,this.matrixAutoUpdate=a.Object3D.DefaultMatrixAutoUpdate,this.matrixWorldNeedsUpdate=!1,this.layers=new a.Layers,this.visible=!0,this.castShadow=!1,this.receiveShadow=!1,this.frustumCulled=!0,this.renderOrder=0,this.userData={}},a.Object3D.DefaultUp=new a.Vector3(0,1,0),a.Object3D.DefaultMatrixAutoUpdate=!0,Object.assign(a.Object3D.prototype,a.EventDispatcher.prototype,{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 a.Quaternion;return function(e,n){return t.setFromAxisAngle(e,n),this.quaternion.multiply(t),this}}(),rotateX:function(){var t=new a.Vector3(1,0,0);return function(e){return this.rotateOnAxis(t,e)}}(),rotateY:function(){var t=new a.Vector3(0,1,0);return function(e){return this.rotateOnAxis(t,e)}}(),rotateZ:function(){var t=new a.Vector3(0,0,1);return function(e){return this.rotateOnAxis(t,e)}}(),translateOnAxis:function(){var t=new a.Vector3;return function(e,n){return t.copy(e).applyQuaternion(this.quaternion),this.position.add(t.multiplyScalar(n)),this}}(),translateX:function(){var t=new a.Vector3(1,0,0);return function(e){return this.translateOnAxis(t,e)}}(),translateY:function(){var t=new a.Vector3(0,1,0);return function(e){return this.translateOnAxis(t,e)}}(),translateZ:function(){var t=new a.Vector3(0,0,1);return function(e){return this.translateOnAxis(t,e)}}(),localToWorld:function(t){return t.applyMatrix4(this.matrixWorld)},worldToLocal:function(){var t=new a.Matrix4;return function(e){return e.applyMatrix4(t.getInverse(this.matrixWorld))}}(),lookAt:function(){var t=new a.Matrix4;return function(e){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 instanceof a.Object3D?(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 n=this.children.indexOf(t);n!==-1&&(t.parent=null,t.dispatchEvent({type:"removed"}),this.children.splice(n,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 n=0,r=this.children.length;n<r;n++){var i=this.children[n],a=i.getObjectByProperty(t,e);if(void 0!==a)return a}},getWorldPosition:function(t){var e=t||new a.Vector3;return this.updateMatrixWorld(!0),e.setFromMatrixPosition(this.matrixWorld)},getWorldQuaternion:function(){var t=new a.Vector3,e=new a.Vector3;return function(n){var r=n||new a.Quaternion;return this.updateMatrixWorld(!0),this.matrixWorld.decompose(t,r,e),r}}(),getWorldRotation:function(){var t=new a.Quaternion;return function(e){var n=e||new a.Euler;return this.getWorldQuaternion(t),n.setFromQuaternion(t,this.rotation.order,!1)}}(),getWorldScale:function(){var t=new a.Vector3,e=new a.Quaternion;return function(n){var r=n||new a.Vector3;return this.updateMatrixWorld(!0),this.matrixWorld.decompose(t,e,r),r}}(),getWorldDirection:function(){var t=new a.Quaternion;return function(e){var n=e||new a.Vector3;return this.getWorldQuaternion(t),n.set(0,0,1).applyQuaternion(t)}}(),raycast:function(){},traverse:function(t){t(this);for(var e=this.children,n=0,r=e.length;n<r;n++)e[n].traverse(t)},traverseVisible:function(t){if(this.visible!==!1){t(this);for(var e=this.children,n=0,r=e.length;n<r;n++)e[n].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===!0&&this.updateMatrix(),this.matrixWorldNeedsUpdate!==!0&&t!==!0||(null===this.parent?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix),this.matrixWorldNeedsUpdate=!1,t=!0);for(var e=0,n=this.children.length;e<n;e++)this.children[e].updateMatrixWorld(t)},toJSON:function(t){function e(t){var e=[];for(var n in t){var r=t[n];delete r.metadata,e.push(r)}return e}var n=void 0===t||""===t,r={};n&&(t={geometries:{},materials:{},textures:{},images:{}},r.metadata={version:4.4,type:"Object",generator:"Object3D.toJSON"});var i={};if(i.uuid=this.uuid,i.type=this.type,""!==this.name&&(i.name=this.name),"{}"!==JSON.stringify(this.userData)&&(i.userData=this.userData),this.castShadow===!0&&(i.castShadow=!0),this.receiveShadow===!0&&(i.receiveShadow=!0),this.visible===!1&&(i.visible=!1),i.matrix=this.matrix.toArray(),void 0!==this.geometry&&(void 0===t.geometries[this.geometry.uuid]&&(t.geometries[this.geometry.uuid]=this.geometry.toJSON(t)),i.geometry=this.geometry.uuid),void 0!==this.material&&(void 0===t.materials[this.material.uuid]&&(t.materials[this.material.uuid]=this.material.toJSON(t)),i.material=this.material.uuid),this.children.length>0){i.children=[];for(var a=0;a<this.children.length;a++)i.children.push(this.children[a].toJSON(t).object)}if(n){var o=e(t.geometries),s=e(t.materials),c=e(t.textures),u=e(t.images);o.length>0&&(r.geometries=o),s.length>0&&(r.materials=s),c.length>0&&(r.textures=c),u.length>0&&(r.images=u)}return r.object=i,r},clone:function(t){return(new this.constructor).copy(this,t)},copy:function(t,e){if(void 0===e&&(e=!0),this.name=t.name,this.up.copy(t.up),this.position.copy(t.position),this.quaternion.copy(t.quaternion),this.scale.copy(t.scale),this.matrix.copy(t.matrix),this.matrixWorld.copy(t.matrixWorld),this.matrixAutoUpdate=t.matrixAutoUpdate,this.matrixWorldNeedsUpdate=t.matrixWorldNeedsUpdate,this.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)),e===!0)for(var n=0;n<t.children.length;n++){var r=t.children[n];this.add(r.clone())}return this}}),a.Object3DIdCount=0,a.Face3=function(t,e,n,r,i,o){this.a=t,this.b=e,this.c=n,this.normal=r instanceof a.Vector3?r:new a.Vector3,this.vertexNormals=Array.isArray(r)?r:[],this.color=i instanceof a.Color?i:new a.Color,this.vertexColors=Array.isArray(i)?i:[],this.materialIndex=void 0!==o?o:0},a.Face3.prototype={constructor:a.Face3,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,n=t.vertexNormals.length;e<n;e++)this.vertexNormals[e]=t.vertexNormals[e].clone();for(var e=0,n=t.vertexColors.length;e<n;e++)this.vertexColors[e]=t.vertexColors[e].clone();return this}},a.BufferAttribute=function(t,e,n){this.uuid=a.Math.generateUUID(),this.array=t,this.itemSize=e,this.dynamic=!1,this.updateRange={offset:0,count:-1},this.version=0,this.normalized=n===!0},a.BufferAttribute.prototype={constructor:a.BufferAttribute,get count(){return this.array.length/this.itemSize},set needsUpdate(t){t===!0&&this.version++},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.dynamic=t.dynamic,this},copyAt:function(t,e,n){t*=this.itemSize,n*=e.itemSize;for(var r=0,i=this.itemSize;r<i;r++)this.array[t+r]=e.array[n+r];return this},copyArray:function(t){return this.array.set(t),this},copyColorsArray:function(t){for(var e=this.array,n=0,r=0,i=t.length;r<i;r++){var o=t[r];void 0===o&&(console.warn("THREE.BufferAttribute.copyColorsArray(): color is undefined",r),o=new a.Color),e[n++]=o.r,e[n++]=o.g,e[n++]=o.b}return this},copyIndicesArray:function(t){for(var e=this.array,n=0,r=0,i=t.length;r<i;r++){var a=t[r];e[n++]=a.a,e[n++]=a.b,e[n++]=a.c}return this},copyVector2sArray:function(t){for(var e=this.array,n=0,r=0,i=t.length;r<i;r++){var o=t[r];void 0===o&&(console.warn("THREE.BufferAttribute.copyVector2sArray(): vector is undefined",r),o=new a.Vector2),e[n++]=o.x,e[n++]=o.y}return this},copyVector3sArray:function(t){for(var e=this.array,n=0,r=0,i=t.length;r<i;r++){var o=t[r];void 0===o&&(console.warn("THREE.BufferAttribute.copyVector3sArray(): vector is undefined",r),o=new a.Vector3),e[n++]=o.x,e[n++]=o.y,e[n++]=o.z}return this},copyVector4sArray:function(t){for(var e=this.array,n=0,r=0,i=t.length;r<i;r++){var o=t[r];void 0===o&&(console.warn("THREE.BufferAttribute.copyVector4sArray(): vector is undefined",r),o=new a.Vector4),e[n++]=o.x,e[n++]=o.y,e[n++]=o.z,e[n++]=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,n){return t*=this.itemSize,this.array[t+0]=e,this.array[t+1]=n,this},setXYZ:function(t,e,n,r){return t*=this.itemSize,this.array[t+0]=e,this.array[t+1]=n,this.array[t+2]=r,this},setXYZW:function(t,e,n,r,i){return t*=this.itemSize,this.array[t+0]=e,this.array[t+1]=n,this.array[t+2]=r,this.array[t+3]=i,this},clone:function(){return(new this.constructor).copy(this)}},a.Int8Attribute=function(t,e){return new a.BufferAttribute(new Int8Array(t),e)},a.Uint8Attribute=function(t,e){return new a.BufferAttribute(new Uint8Array(t),e)},a.Uint8ClampedAttribute=function(t,e){return new a.BufferAttribute(new Uint8ClampedArray(t),e)},a.Int16Attribute=function(t,e){return new a.BufferAttribute(new Int16Array(t),e)},a.Uint16Attribute=function(t,e){return new a.BufferAttribute(new Uint16Array(t),e)},a.Int32Attribute=function(t,e){return new a.BufferAttribute(new Int32Array(t),e)},a.Uint32Attribute=function(t,e){return new a.BufferAttribute(new Uint32Array(t),e)},a.Float32Attribute=function(t,e){return new a.BufferAttribute(new Float32Array(t),e)},a.Float64Attribute=function(t,e){return new a.BufferAttribute(new Float64Array(t),e)},a.DynamicBufferAttribute=function(t,e){return console.warn("THREE.DynamicBufferAttribute has been removed. Use new THREE.BufferAttribute().setDynamic( true ) instead."),new a.BufferAttribute(t,e).setDynamic(!0)},a.InstancedBufferAttribute=function(t,e,n){a.BufferAttribute.call(this,t,e),this.meshPerAttribute=n||1},a.InstancedBufferAttribute.prototype=Object.create(a.BufferAttribute.prototype),a.InstancedBufferAttribute.prototype.constructor=a.InstancedBufferAttribute,a.InstancedBufferAttribute.prototype.copy=function(t){return a.BufferAttribute.prototype.copy.call(this,t),this.meshPerAttribute=t.meshPerAttribute,this},a.InterleavedBuffer=function(t,e){this.uuid=a.Math.generateUUID(),this.array=t,this.stride=e,this.dynamic=!1,this.updateRange={offset:0,count:-1},this.version=0},a.InterleavedBuffer.prototype={constructor:a.InterleavedBuffer,get length(){return this.array.length},get count(){return this.array.length/this.stride},set needsUpdate(t){t===!0&&this.version++},setDynamic:function(t){return this.dynamic=t,this},copy:function(t){return this.array=new t.array.constructor(t.array),this.stride=t.stride,this.dynamic=t.dynamic,this},copyAt:function(t,e,n){t*=this.stride,n*=e.stride;for(var r=0,i=this.stride;r<i;r++)this.array[t+r]=e.array[n+r];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)}},a.InstancedInterleavedBuffer=function(t,e,n){a.InterleavedBuffer.call(this,t,e),this.meshPerAttribute=n||1},a.InstancedInterleavedBuffer.prototype=Object.create(a.InterleavedBuffer.prototype),a.InstancedInterleavedBuffer.prototype.constructor=a.InstancedInterleavedBuffer,a.InstancedInterleavedBuffer.prototype.copy=function(t){return a.InterleavedBuffer.prototype.copy.call(this,t),this.meshPerAttribute=t.meshPerAttribute,this},a.InterleavedBufferAttribute=function(t,e,n){this.uuid=a.Math.generateUUID(),this.data=t,this.itemSize=e,this.offset=n},a.InterleavedBufferAttribute.prototype={constructor:a.InterleavedBufferAttribute,get length(){return console.warn("THREE.BufferAttribute: .length has been deprecated. Please use .count."),this.array.length},get count(){return this.data.count},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,n){return t=t*this.data.stride+this.offset,this.data.array[t+0]=e,this.data.array[t+1]=n,this},setXYZ:function(t,e,n,r){return t=t*this.data.stride+this.offset,this.data.array[t+0]=e,this.data.array[t+1]=n,this.data.array[t+2]=r,this},setXYZW:function(t,e,n,r,i){return t=t*this.data.stride+this.offset,this.data.array[t+0]=e,this.data.array[t+1]=n,this.data.array[t+2]=r,this.data.array[t+3]=i,this}},a.Geometry=function(){Object.defineProperty(this,"id",{value:a.GeometryIdCount++}),this.uuid=a.Math.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.verticesNeedUpdate=!1,this.elementsNeedUpdate=!1,this.uvsNeedUpdate=!1,this.normalsNeedUpdate=!1,this.colorsNeedUpdate=!1,this.lineDistancesNeedUpdate=!1,this.groupsNeedUpdate=!1},Object.assign(a.Geometry.prototype,a.EventDispatcher.prototype,{applyMatrix:function(t){for(var e=(new a.Matrix3).getNormalMatrix(t),n=0,r=this.vertices.length;n<r;n++){var i=this.vertices[n];i.applyMatrix4(t)}for(var n=0,r=this.faces.length;n<r;n++){var o=this.faces[n];o.normal.applyMatrix3(e).normalize();for(var s=0,c=o.vertexNormals.length;s<c;s++)o.vertexNormals[s].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;return function(e){return void 0===t&&(t=new a.Matrix4),t.makeRotationX(e),this.applyMatrix(t),this}}(),rotateY:function(){var t;return function(e){return void 0===t&&(t=new a.Matrix4),t.makeRotationY(e),this.applyMatrix(t),this}}(),rotateZ:function(){var t;return function(e){return void 0===t&&(t=new a.Matrix4),t.makeRotationZ(e),this.applyMatrix(t),this}}(),translate:function(){var t;return function(e,n,r){return void 0===t&&(t=new a.Matrix4),t.makeTranslation(e,n,r),this.applyMatrix(t),this}}(),scale:function(){var t;return function(e,n,r){return void 0===t&&(t=new a.Matrix4),t.makeScale(e,n,r),this.applyMatrix(t),this}}(),lookAt:function(){var t;return function(e){void 0===t&&(t=new a.Object3D),t.lookAt(e),t.updateMatrix(),this.applyMatrix(t.matrix)}}(),fromBufferGeometry:function(t){function e(t,e,r,i){var o=void 0!==s?[h[t].clone(),h[e].clone(),h[r].clone()]:[],d=void 0!==c?[n.colors[t].clone(),n.colors[e].clone(),n.colors[r].clone()]:[],m=new a.Face3(t,e,r,o,d,i);n.faces.push(m),void 0!==u&&n.faceVertexUvs[0].push([f[t].clone(),f[e].clone(),f[r].clone()]),void 0!==l&&n.faceVertexUvs[1].push([p[t].clone(),p[e].clone(),p[r].clone()])}var n=this,r=null!==t.index?t.index.array:void 0,i=t.attributes,o=i.position.array,s=void 0!==i.normal?i.normal.array:void 0,c=void 0!==i.color?i.color.array:void 0,u=void 0!==i.uv?i.uv.array:void 0,l=void 0!==i.uv2?i.uv2.array:void 0;void 0!==l&&(this.faceVertexUvs[1]=[]);for(var h=[],f=[],p=[],d=0,m=0;d<o.length;d+=3,m+=2)n.vertices.push(new a.Vector3(o[d],o[d+1],o[d+2])),void 0!==s&&h.push(new a.Vector3(s[d],s[d+1],s[d+2])),void 0!==c&&n.colors.push(new a.Color(c[d],c[d+1],c[d+2])),void 0!==u&&f.push(new a.Vector2(u[m],u[m+1])),void 0!==l&&p.push(new a.Vector2(l[m],l[m+1]));if(void 0!==r){var g=t.groups;if(g.length>0)for(var d=0;d<g.length;d++)for(var v=g[d],y=v.start,x=v.count,m=y,b=y+x;m<b;m+=3)e(r[m],r[m+1],r[m+2],v.materialIndex);else for(var d=0;d<r.length;d+=3)e(r[d],r[d+1],r[d+2])}else for(var d=0;d<o.length/3;d+=3)e(d,d+1,d+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.center().negate();return this.translate(t.x,t.y,t.z),t},normalize:function(){this.computeBoundingSphere();var t=this.boundingSphere.center,e=this.boundingSphere.radius,n=0===e?1:1/e,r=new a.Matrix4;return r.set(n,0,0,-n*t.x,0,n,0,-n*t.y,0,0,n,-n*t.z,0,0,0,1),this.applyMatrix(r),this},computeFaceNormals:function(){for(var t=new a.Vector3,e=new a.Vector3,n=0,r=this.faces.length;n<r;n++){var i=this.faces[n],o=this.vertices[i.a],s=this.vertices[i.b],c=this.vertices[i.c];t.subVectors(c,s),e.subVectors(o,s),t.cross(e),t.normalize(),i.normal.copy(t)}},computeVertexNormals:function(t){void 0===t&&(t=!0);var e,n,r,i,o,s;for(s=new Array(this.vertices.length),e=0,n=this.vertices.length;e<n;e++)s[e]=new a.Vector3;if(t){var c,u,l,h=new a.Vector3,f=new a.Vector3;for(r=0,i=this.faces.length;r<i;r++)o=this.faces[r],c=this.vertices[o.a],u=this.vertices[o.b],l=this.vertices[o.c],h.subVectors(l,u),f.subVectors(c,u),h.cross(f),s[o.a].add(h),s[o.b].add(h),s[o.c].add(h)}else for(r=0,i=this.faces.length;r<i;r++)o=this.faces[r],s[o.a].add(o.normal),s[o.b].add(o.normal),s[o.c].add(o.normal);for(e=0,n=this.vertices.length;e<n;e++)s[e].normalize();for(r=0,i=this.faces.length;r<i;r++){o=this.faces[r];var p=o.vertexNormals;3===p.length?(p[0].copy(s[o.a]),p[1].copy(s[o.b]),p[2].copy(s[o.c])):(p[0]=s[o.a].clone(),p[1]=s[o.b].clone(),p[2]=s[o.c].clone())}this.faces.length>0&&(this.normalsNeedUpdate=!0)},computeMorphNormals:function(){var t,e,n,r,i;for(n=0,r=this.faces.length;n<r;n++)for(i=this.faces[n],i.__originalFaceNormal?i.__originalFaceNormal.copy(i.normal):i.__originalFaceNormal=i.normal.clone(),i.__originalVertexNormals||(i.__originalVertexNormals=[]),t=0,e=i.vertexNormals.length;t<e;t++)i.__originalVertexNormals[t]?i.__originalVertexNormals[t].copy(i.vertexNormals[t]):i.__originalVertexNormals[t]=i.vertexNormals[t].clone();var o=new a.Geometry;for(o.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 s,c,u=this.morphNormals[t].faceNormals,l=this.morphNormals[t].vertexNormals;for(n=0,r=this.faces.length;n<r;n++)s=new a.Vector3,c={a:new a.Vector3,b:new a.Vector3,c:new a.Vector3},u.push(s),l.push(c)}var h=this.morphNormals[t];o.vertices=this.morphTargets[t].vertices,o.computeFaceNormals(),o.computeVertexNormals();var s,c;for(n=0,r=this.faces.length;n<r;n++)i=this.faces[n],s=h.faceNormals[n],c=h.vertexNormals[n],s.copy(i.normal),c.a.copy(i.vertexNormals[0]),c.b.copy(i.vertexNormals[1]),c.c.copy(i.vertexNormals[2])}for(n=0,r=this.faces.length;n<r;n++)i=this.faces[n],i.normal=i.__originalFaceNormal,i.vertexNormals=i.__originalVertexNormals},computeTangents:function(){console.warn("THREE.Geometry: .computeTangents() has been removed.")},computeLineDistances:function(){for(var t=0,e=this.vertices,n=0,r=e.length;n<r;n++)n>0&&(t+=e[n].distanceTo(e[n-1])),this.lineDistances[n]=t},computeBoundingBox:function(){null===this.boundingBox&&(this.boundingBox=new a.Box3),this.boundingBox.setFromPoints(this.vertices)},computeBoundingSphere:function(){null===this.boundingSphere&&(this.boundingSphere=new a.Sphere),this.boundingSphere.setFromPoints(this.vertices)},merge:function(t,e,n){if(t instanceof a.Geometry==!1)return void console.error("THREE.Geometry.merge(): geometry not an instance of THREE.Geometry.",t);var r,i=this.vertices.length,o=this.vertices,s=t.vertices,c=this.faces,u=t.faces,l=this.faceVertexUvs[0],h=t.faceVertexUvs[0];void 0===n&&(n=0),void 0!==e&&(r=(new a.Matrix3).getNormalMatrix(e));for(var f=0,p=s.length;f<p;f++){var d=s[f],m=d.clone();void 0!==e&&m.applyMatrix4(e),o.push(m)}for(f=0,p=u.length;f<p;f++){var g,v,y,x=u[f],b=x.vertexNormals,M=x.vertexColors;g=new a.Face3(x.a+i,x.b+i,x.c+i),g.normal.copy(x.normal),void 0!==r&&g.normal.applyMatrix3(r).normalize();for(var _=0,w=b.length;_<w;_++)v=b[_].clone(),void 0!==r&&v.applyMatrix3(r).normalize(),g.vertexNormals.push(v);g.color.copy(x.color);for(var _=0,w=M.length;_<w;_++)y=M[_],g.vertexColors.push(y.clone());g.materialIndex=x.materialIndex+n,c.push(g)}for(f=0,p=h.length;f<p;f++){var S=h[f],E=[];if(void 0!==S){for(var _=0,w=S.length;_<w;_++)E.push(S[_].clone());l.push(E)}}},mergeMesh:function(t){return t instanceof a.Mesh==!1?void console.error("THREE.Geometry.mergeMesh(): mesh not an instance of THREE.Mesh.",t):(t.matrixAutoUpdate&&t.updateMatrix(),void this.merge(t.geometry,t.matrix))},mergeVertices:function(){var t,e,n,r,i,a,o,s,c={},u=[],l=[],h=4,f=Math.pow(10,h);for(n=0,r=this.vertices.length;n<r;n++)t=this.vertices[n],e=Math.round(t.x*f)+"_"+Math.round(t.y*f)+"_"+Math.round(t.z*f),void 0===c[e]?(c[e]=n,u.push(this.vertices[n]),l[n]=u.length-1):l[n]=l[c[e]];var p=[];for(n=0,r=this.faces.length;n<r;n++){i=this.faces[n],i.a=l[i.a],i.b=l[i.b],i.c=l[i.c],a=[i.a,i.b,i.c];for(var d=-1,m=0;m<3;m++)if(a[m]===a[(m+1)%3]){d=m,p.push(n);break}}for(n=p.length-1;n>=0;n--){var g=p[n];for(this.faces.splice(g,1),o=0,s=this.faceVertexUvs.length;o<s;o++)this.faceVertexUvs[o].splice(g,1)}var v=this.vertices.length-u.length;return this.vertices=u,v},sortFacesByMaterialIndex:function(){function t(t,e){return t.materialIndex-e.materialIndex}for(var e=this.faces,n=e.length,r=0;r<n;r++)e[r]._id=r;e.sort(t);var i,a,o=this.faceVertexUvs[0],s=this.faceVertexUvs[1];o&&o.length===n&&(i=[]),s&&s.length===n&&(a=[]);for(var r=0;r<n;r++){var c=e[r]._id;i&&i.push(o[c]),a&&a.push(s[c])}i&&(this.faceVertexUvs[0]=i),a&&(this.faceVertexUvs[1]=a)},toJSON:function(){function t(t,e,n){return n?t|1<<e:t&~(1<<e)}function e(t){var e=t.x.toString()+t.y.toString()+t.z.toString();return void 0!==f[e]?f[e]:(f[e]=h.length/3,h.push(t.x,t.y,t.z),f[e])}function n(t){var e=t.r.toString()+t.g.toString()+t.b.toString();return void 0!==d[e]?d[e]:(d[e]=p.length,p.push(t.getHex()),d[e])}function r(t){var e=t.x.toString()+t.y.toString();return void 0!==g[e]?g[e]:(g[e]=m.length/2,m.push(t.x,t.y),g[e])}var i={metadata:{version:4.4,type:"Geometry",generator:"Geometry.toJSON"}};if(i.uuid=this.uuid,i.type=this.type,""!==this.name&&(i.name=this.name),void 0!==this.parameters){var a=this.parameters;for(var o in a)void 0!==a[o]&&(i[o]=a[o]);return i}for(var s=[],c=0;c<this.vertices.length;c++){var u=this.vertices[c];s.push(u.x,u.y,u.z)}for(var l=[],h=[],f={},p=[],d={},m=[],g={},c=0;c<this.faces.length;c++){var v=this.faces[c],y=!0,x=!1,b=void 0!==this.faceVertexUvs[0][c],M=v.normal.length()>0,_=v.vertexNormals.length>0,w=1!==v.color.r||1!==v.color.g||1!==v.color.b,S=v.vertexColors.length>0,E=0;if(E=t(E,0,0),E=t(E,1,y),E=t(E,2,x),E=t(E,3,b),E=t(E,4,M),E=t(E,5,_),E=t(E,6,w),E=t(E,7,S),l.push(E),l.push(v.a,v.b,v.c),l.push(v.materialIndex),b){var T=this.faceVertexUvs[0][c];l.push(r(T[0]),r(T[1]),r(T[2]))}if(M&&l.push(e(v.normal)),_){var A=v.vertexNormals;l.push(e(A[0]),e(A[1]),e(A[2]))}if(w&&l.push(n(v.color)),S){var L=v.vertexColors;l.push(n(L[0]),n(L[1]),n(L[2]))}}return i.data={},i.data.vertices=s,i.data.normals=h,p.length>0&&(i.data.colors=p),m.length>0&&(i.data.uvs=[m]),i.data.faces=l,i},clone:function(){return(new a.Geometry).copy(this)},copy:function(t){this.vertices=[],this.faces=[],this.faceVertexUvs=[[]];for(var e=t.vertices,n=0,r=e.length;n<r;n++)this.vertices.push(e[n].clone());for(var i=t.faces,n=0,r=i.length;n<r;n++)this.faces.push(i[n].clone());for(var n=0,r=t.faceVertexUvs.length;n<r;n++){var a=t.faceVertexUvs[n];void 0===this.faceVertexUvs[n]&&(this.faceVertexUvs[n]=[]);for(var o=0,s=a.length;o<s;o++){for(var c=a[o],u=[],l=0,h=c.length;l<h;l++){var f=c[l];u.push(f.clone())}this.faceVertexUvs[n].push(u)}}return this},dispose:function(){this.dispatchEvent({type:"dispose"})}}),a.GeometryIdCount=0,a.DirectGeometry=function(){Object.defineProperty(this,"id",{value:a.GeometryIdCount++}),this.uuid=a.Math.generateUUID(),this.name="",this.type="DirectGeometry",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},Object.assign(a.DirectGeometry.prototype,a.EventDispatcher.prototype,{computeBoundingBox:a.Geometry.prototype.computeBoundingBox,computeBoundingSphere:a.Geometry.prototype.computeBoundingSphere,computeFaceNormals:function(){console.warn("THREE.DirectGeometry: computeFaceNormals() is not a method of this type of geometry.")},computeVertexNormals:function(){console.warn("THREE.DirectGeometry: computeVertexNormals() is not a method of this type of geometry.")},computeGroups:function(t){for(var e,n,r=[],i=t.faces,a=0;a<i.length;a++){var o=i[a];o.materialIndex!==n&&(n=o.materialIndex,void 0!==e&&(e.count=3*a-e.start,r.push(e)),e={start:3*a,materialIndex:n})}void 0!==e&&(e.count=3*a-e.start,r.push(e)),this.groups=r},fromGeometry:function(t){var e,n=t.faces,r=t.vertices,i=t.faceVertexUvs,o=i[0]&&i[0].length>0,s=i[1]&&i[1].length>0,c=t.morphTargets,u=c.length;if(u>0){e=[];for(var l=0;l<u;l++)e[l]=[];this.morphTargets.position=e}var h,f=t.morphNormals,p=f.length;if(p>0){h=[];for(var l=0;l<p;l++)h[l]=[];this.morphTargets.normal=h}for(var d=t.skinIndices,m=t.skinWeights,g=d.length===r.length,v=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 M=y.vertexColors;if(3===M.length)this.colors.push(M[0],M[1],M[2]);else{var _=y.color;this.colors.push(_,_,_)}if(o===!0){var w=i[0][l];void 0!==w?this.uvs.push(w[0],w[1],w[2]):(console.warn("THREE.DirectGeometry.fromGeometry(): Undefined vertexUv ",l),this.uvs.push(new a.Vector2,new a.Vector2,new a.Vector2))}if(s===!0){var w=i[1][l];void 0!==w?this.uvs2.push(w[0],w[1],w[2]):(console.warn("THREE.DirectGeometry.fromGeometry(): Undefined vertexUv2 ",l),this.uvs2.push(new a.Vector2,new a.Vector2,new a.Vector2))}for(var S=0;S<u;S++){var E=c[S].vertices;e[S].push(E[y.a],E[y.b],E[y.c])}for(var S=0;S<p;S++){var T=f[S].vertexNormals[l];h[S].push(T.a,T.b,T.c)}g&&this.skinIndices.push(d[y.a],d[y.b],d[y.c]),v&&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},dispose:function(){this.dispatchEvent({type:"dispose"})}}),a.BufferGeometry=function(){Object.defineProperty(this,"id",{value:a.GeometryIdCount++}),this.uuid=a.Math.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}},Object.assign(a.BufferGeometry.prototype,a.EventDispatcher.prototype,{getIndex:function(){return this.index},setIndex:function(t){this.index=t},addAttribute:function(t,e){return e instanceof a.BufferAttribute==!1&&e instanceof a.InterleavedBufferAttribute==!1?(console.warn("THREE.BufferGeometry: .addAttribute() now expects ( name, attribute )."),void this.addAttribute(t,new a.BufferAttribute(arguments[1],arguments[2]))):"index"===t?(console.warn("THREE.BufferGeometry.addAttribute: Use .setIndex() for index attribute."),
-void this.setIndex(e)):(this.attributes[t]=e,this)},getAttribute:function(t){return this.attributes[t]},removeAttribute:function(t){return delete this.attributes[t],this},addGroup:function(t,e,n){this.groups.push({start:t,count:e,materialIndex:void 0!==n?n:0})},clearGroups:function(){this.groups=[]},setDrawRange:function(t,e){this.drawRange.start=t,this.drawRange.count=e},applyMatrix:function(t){var e=this.attributes.position;void 0!==e&&(t.applyToVector3Array(e.array),e.needsUpdate=!0);var n=this.attributes.normal;if(void 0!==n){var r=(new a.Matrix3).getNormalMatrix(t);r.applyToVector3Array(n.array),n.needsUpdate=!0}return null!==this.boundingBox&&this.computeBoundingBox(),null!==this.boundingSphere&&this.computeBoundingSphere(),this},rotateX:function(){var t;return function(e){return void 0===t&&(t=new a.Matrix4),t.makeRotationX(e),this.applyMatrix(t),this}}(),rotateY:function(){var t;return function(e){return void 0===t&&(t=new a.Matrix4),t.makeRotationY(e),this.applyMatrix(t),this}}(),rotateZ:function(){var t;return function(e){return void 0===t&&(t=new a.Matrix4),t.makeRotationZ(e),this.applyMatrix(t),this}}(),translate:function(){var t;return function(e,n,r){return void 0===t&&(t=new a.Matrix4),t.makeTranslation(e,n,r),this.applyMatrix(t),this}}(),scale:function(){var t;return function(e,n,r){return void 0===t&&(t=new a.Matrix4),t.makeScale(e,n,r),this.applyMatrix(t),this}}(),lookAt:function(){var t;return function(e){void 0===t&&(t=new a.Object3D),t.lookAt(e),t.updateMatrix(),this.applyMatrix(t.matrix)}}(),center:function(){this.computeBoundingBox();var t=this.boundingBox.center().negate();return this.translate(t.x,t.y,t.z),t},setFromObject:function(t){var e=t.geometry;if(t instanceof a.Points||t instanceof a.Line){var n=new a.Float32Attribute(3*e.vertices.length,3),r=new a.Float32Attribute(3*e.colors.length,3);if(this.addAttribute("position",n.copyVector3sArray(e.vertices)),this.addAttribute("color",r.copyColorsArray(e.colors)),e.lineDistances&&e.lineDistances.length===e.vertices.length){var i=new a.Float32Attribute(e.lineDistances.length,1);this.addAttribute("lineDistance",i.copyArray(e.lineDistances))}null!==e.boundingSphere&&(this.boundingSphere=e.boundingSphere.clone()),null!==e.boundingBox&&(this.boundingBox=e.boundingBox.clone())}else t instanceof a.Mesh&&e instanceof a.Geometry&&this.fromGeometry(e);return this},updateFromObject:function(t){var e=t.geometry;if(t instanceof a.Mesh){var n=e.__directGeometry;if(void 0===n)return this.fromGeometry(e);n.verticesNeedUpdate=e.verticesNeedUpdate,n.normalsNeedUpdate=e.normalsNeedUpdate,n.colorsNeedUpdate=e.colorsNeedUpdate,n.uvsNeedUpdate=e.uvsNeedUpdate,n.groupsNeedUpdate=e.groupsNeedUpdate,e.verticesNeedUpdate=!1,e.normalsNeedUpdate=!1,e.colorsNeedUpdate=!1,e.uvsNeedUpdate=!1,e.groupsNeedUpdate=!1,e=n}if(e.verticesNeedUpdate===!0){var r=this.attributes.position;void 0!==r&&(r.copyVector3sArray(e.vertices),r.needsUpdate=!0),e.verticesNeedUpdate=!1}if(e.normalsNeedUpdate===!0){var r=this.attributes.normal;void 0!==r&&(r.copyVector3sArray(e.normals),r.needsUpdate=!0),e.normalsNeedUpdate=!1}if(e.colorsNeedUpdate===!0){var r=this.attributes.color;void 0!==r&&(r.copyColorsArray(e.colors),r.needsUpdate=!0),e.colorsNeedUpdate=!1}if(e.uvsNeedUpdate){var r=this.attributes.uv;void 0!==r&&(r.copyVector2sArray(e.uvs),r.needsUpdate=!0),e.uvsNeedUpdate=!1}if(e.lineDistancesNeedUpdate){var r=this.attributes.lineDistance;void 0!==r&&(r.copyArray(e.lineDistances),r.needsUpdate=!0),e.lineDistancesNeedUpdate=!1}return e.groupsNeedUpdate&&(e.computeGroups(t.geometry),this.groups=e.groups,e.groupsNeedUpdate=!1),this},fromGeometry:function(t){return t.__directGeometry=(new a.DirectGeometry).fromGeometry(t),this.fromDirectGeometry(t.__directGeometry)},fromDirectGeometry:function(t){var e=new Float32Array(3*t.vertices.length);if(this.addAttribute("position",new a.BufferAttribute(e,3).copyVector3sArray(t.vertices)),t.normals.length>0){var n=new Float32Array(3*t.normals.length);this.addAttribute("normal",new a.BufferAttribute(n,3).copyVector3sArray(t.normals))}if(t.colors.length>0){var r=new Float32Array(3*t.colors.length);this.addAttribute("color",new a.BufferAttribute(r,3).copyColorsArray(t.colors))}if(t.uvs.length>0){var i=new Float32Array(2*t.uvs.length);this.addAttribute("uv",new a.BufferAttribute(i,2).copyVector2sArray(t.uvs))}if(t.uvs2.length>0){var o=new Float32Array(2*t.uvs2.length);this.addAttribute("uv2",new a.BufferAttribute(o,2).copyVector2sArray(t.uvs2))}if(t.indices.length>0){var s=t.vertices.length>65535?Uint32Array:Uint16Array,c=new s(3*t.indices.length);this.setIndex(new a.BufferAttribute(c,1).copyIndicesArray(t.indices))}this.groups=t.groups;for(var u in t.morphTargets){for(var l=[],h=t.morphTargets[u],f=0,p=h.length;f<p;f++){var d=h[f],m=new a.Float32Attribute(3*d.length,3);l.push(m.copyVector3sArray(d))}this.morphAttributes[u]=l}if(t.skinIndices.length>0){var g=new a.Float32Attribute(4*t.skinIndices.length,4);this.addAttribute("skinIndex",g.copyVector4sArray(t.skinIndices))}if(t.skinWeights.length>0){var v=new a.Float32Attribute(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 a.Box3);var t=this.attributes.position.array;void 0!==t?this.boundingBox.setFromArray(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 a.Box3,e=new a.Vector3;return function(){null===this.boundingSphere&&(this.boundingSphere=new a.Sphere);var n=this.attributes.position;if(n){var r=n.array,i=this.boundingSphere.center;t.setFromArray(r),t.center(i);for(var o=0,s=0,c=r.length;s<c;s+=3)e.fromArray(r,s),o=Math.max(o,i.distanceToSquared(e));this.boundingSphere.radius=Math.sqrt(o),isNaN(this.boundingSphere.radius)&&console.error('THREE.BufferGeometry.computeBoundingSphere(): Computed radius is NaN. The "position" attribute is likely to have NaN values.',this)}}}(),computeFaceNormals:function(){},computeVertexNormals:function(){var t=this.index,e=this.attributes,n=this.groups;if(e.position){var r=e.position.array;if(void 0===e.normal)this.addAttribute("normal",new a.BufferAttribute(new Float32Array(r.length),3));else for(var i=e.normal.array,o=0,s=i.length;o<s;o++)i[o]=0;var c,u,l,h=e.normal.array,f=new a.Vector3,p=new a.Vector3,d=new a.Vector3,m=new a.Vector3,g=new a.Vector3;if(t){var v=t.array;0===n.length&&this.addGroup(0,v.length);for(var y=0,x=n.length;y<x;++y)for(var b=n[y],M=b.start,_=b.count,o=M,s=M+_;o<s;o+=3)c=3*v[o+0],u=3*v[o+1],l=3*v[o+2],f.fromArray(r,c),p.fromArray(r,u),d.fromArray(r,l),m.subVectors(d,p),g.subVectors(f,p),m.cross(g),h[c]+=m.x,h[c+1]+=m.y,h[c+2]+=m.z,h[u]+=m.x,h[u+1]+=m.y,h[u+2]+=m.z,h[l]+=m.x,h[l+1]+=m.y,h[l+2]+=m.z}else for(var o=0,s=r.length;o<s;o+=9)f.fromArray(r,o),p.fromArray(r,o+3),d.fromArray(r,o+6),m.subVectors(d,p),g.subVectors(f,p),m.cross(g),h[o]=m.x,h[o+1]=m.y,h[o+2]=m.z,h[o+3]=m.x,h[o+4]=m.y,h[o+5]=m.z,h[o+6]=m.x,h[o+7]=m.y,h[o+8]=m.z;this.normalizeNormals(),e.normal.needsUpdate=!0}},merge:function(t,e){if(t instanceof a.BufferGeometry==!1)return void console.error("THREE.BufferGeometry.merge(): geometry not an instance of THREE.BufferGeometry.",t);void 0===e&&(e=0);var n=this.attributes;for(var r in n)if(void 0!==t.attributes[r])for(var i=n[r],o=i.array,s=t.attributes[r],c=s.array,u=s.itemSize,l=0,h=u*e;l<c.length;l++,h++)o[h]=c[l];return this},normalizeNormals:function(){for(var t,e,n,r,i=this.attributes.normal.array,a=0,o=i.length;a<o;a+=3)t=i[a],e=i[a+1],n=i[a+2],r=1/Math.sqrt(t*t+e*e+n*n),i[a]*=r,i[a+1]*=r,i[a+2]*=r},toNonIndexed:function(){if(null===this.index)return console.warn("THREE.BufferGeometry.toNonIndexed(): Geometry is already non-indexed."),this;var t=new a.BufferGeometry,e=this.index.array,n=this.attributes;for(var r in n){for(var i=n[r],o=i.array,s=i.itemSize,c=new o.constructor(e.length*s),u=0,l=0,h=0,f=e.length;h<f;h++){u=e[h]*s;for(var p=0;p<s;p++)c[l++]=o[u++]}t.addAttribute(r,new a.BufferAttribute(c,s))}return t},toJSON:function(){var t={metadata:{version:4.4,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 n in e)void 0!==e[n]&&(t[n]=e[n]);return t}t.data={attributes:{}};var r=this.index;if(null!==r){var i=Array.prototype.slice.call(r.array);t.data.index={type:r.array.constructor.name,array:i}}var a=this.attributes;for(var n in a){var o=a[n],i=Array.prototype.slice.call(o.array);t.data.attributes[n]={itemSize:o.itemSize,type:o.array.constructor.name,array:i,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 a.BufferGeometry).copy(this)},copy:function(t){var e=t.index;null!==e&&this.setIndex(e.clone());var n=t.attributes;for(var r in n){var i=n[r];this.addAttribute(r,i.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},dispose:function(){this.dispatchEvent({type:"dispose"})}}),a.BufferGeometry.MaxIndex=65535,a.InstancedBufferGeometry=function(){a.BufferGeometry.call(this),this.type="InstancedBufferGeometry",this.maxInstancedCount=void 0},a.InstancedBufferGeometry.prototype=Object.create(a.BufferGeometry.prototype),a.InstancedBufferGeometry.prototype.constructor=a.InstancedBufferGeometry,a.InstancedBufferGeometry.prototype.addGroup=function(t,e,n){this.groups.push({start:t,count:e,instances:n})},a.InstancedBufferGeometry.prototype.copy=function(t){var e=t.index;null!==e&&this.setIndex(e.clone());var n=t.attributes;for(var r in n){var i=n[r];this.addAttribute(r,i.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.instances)}return this},a.Uniform=function(t){"string"==typeof t&&(console.warn("THREE.Uniform: Type parameter is no longer needed."),t=arguments[1]),this.value=t,this.dynamic=!1},a.Uniform.prototype={constructor:a.Uniform,onUpdate:function(t){return this.dynamic=!0,this.onUpdateCallback=t,this}},a.AnimationAction=function(){throw new Error("THREE.AnimationAction: Use mixer.clipAction for construction.")},a.AnimationAction._new=function(t,e,n){this._mixer=t,this._clip=e,this._localRoot=n||null;for(var r=e.tracks,i=r.length,o=new Array(i),s={endingStart:a.ZeroCurvatureEnding,endingEnd:a.ZeroCurvatureEnding},c=0;c!==i;++c){var u=r[c].createInterpolant(null);o[c]=u,u.settings=s}this._interpolantSettings=s,this._interpolants=o,this._propertyBindings=new Array(i),this._cacheIndex=null,this._byClipCacheIndex=null,this._timeScaleInterpolant=null,this._weightInterpolant=null,this.loop=a.LoopRepeat,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},a.AnimationAction._new.prototype={constructor:a.AnimationAction._new,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(){this._startTime;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,n){this._mixer;if(t.fadeOut(e),this.fadeIn(e),n){var r=this._clip.duration,i=t._clip.duration,a=i/r,o=r/i;t.warp(1,a,e),this.warp(o,1,e)}return this},crossFadeTo:function(t,e,n){return t.crossFadeFrom(this,e,n)},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,n){var r=this._mixer,i=r.time,a=this._timeScaleInterpolant,o=this.timeScale;null===a&&(a=r._lendControlInterpolant(),this._timeScaleInterpolant=a);var s=a.parameterPositions,c=a.sampleValues;return s[0]=i,s[1]=i+n,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,n,r){var i=this._startTime;if(null!==i){var a=(t-i)*n;if(a<0||0===n)return;this._startTime=null,e=n*a}e*=this._updateTimeScale(t);var o=this._updateTime(e),s=this._updateWeight(t);if(s>0)for(var c=this._interpolants,u=this._propertyBindings,l=0,h=c.length;l!==h;++l)c[l].evaluate(o),u[l].accumulate(r,s)},_updateWeight:function(t){var e=0;if(this.enabled){e=this.weight;var n=this._weightInterpolant;if(null!==n){var r=n.evaluate(t)[0];e*=r,t>n.parameterPositions[1]&&(this.stopFading(),0===r&&(this.enabled=!1))}}return this._effectiveWeight=e,e},_updateTimeScale:function(t){var e=0;if(!this.paused){e=this.timeScale;var n=this._timeScaleInterpolant;if(null!==n){var r=n.evaluate(t)[0];e*=r,t>n.parameterPositions[1]&&(this.stopWarping(),0===e?this.paused=!0:this.timeScale=e)}}return this._effectiveTimeScale=e,e},_updateTime:function(t){var e=this.time+t;if(0===t)return e;var n=this._clip.duration,r=this.loop,i=this._loopCount;if(r===a.LoopOnce){i===-1&&(this.loopCount=0,this._setEndings(!0,!0,!1));t:{if(e>=n)e=n;else{if(!(e<0))break t;e=0}this.clampWhenFinished?this.paused=!0:this.enabled=!1,this._mixer.dispatchEvent({type:"finished",action:this,direction:t<0?-1:1})}}else{var o=r===a.LoopPingPong;if(i===-1&&(t>=0?(i=0,this._setEndings(!0,0===this.repetitions,o)):this._setEndings(0===this.repetitions,!0,o)),e>=n||e<0){var s=Math.floor(e/n);e-=n*s,i+=Math.abs(s);var c=this.repetitions-i;if(c<0)this.clampWhenFinished?this.paused=!0:this.enabled=!1,e=t>0?n:0,this._mixer.dispatchEvent({type:"finished",action:this,direction:t>0?1:-1});else{if(0===c){var u=t<0;this._setEndings(u,!u,o)}else this._setEndings(!1,!1,o);this._loopCount=i,this._mixer.dispatchEvent({type:"loop",action:this,loopDelta:s})}}if(o&&1===(1&i))return this.time=e,n-e}return this.time=e,e},_setEndings:function(t,e,n){var r=this._interpolantSettings;n?(r.endingStart=a.ZeroSlopeEnding,r.endingEnd=a.ZeroSlopeEnding):(t?r.endingStart=this.zeroSlopeAtStart?a.ZeroSlopeEnding:a.ZeroCurvatureEnding:r.endingStart=a.WrapAroundEnding,e?r.endingEnd=this.zeroSlopeAtEnd?a.ZeroSlopeEnding:a.ZeroCurvatureEnding:r.endingEnd=a.WrapAroundEnding)},_scheduleFading:function(t,e,n){var r=this._mixer,i=r.time,a=this._weightInterpolant;null===a&&(a=r._lendControlInterpolant(),this._weightInterpolant=a);var o=a.parameterPositions,s=a.sampleValues;return o[0]=i,s[0]=e,o[1]=i+t,s[1]=n,this}},a.AnimationClip=function(t,e,n){this.name=t,this.tracks=n,this.duration=void 0!==e?e:-1,this.uuid=a.Math.generateUUID(),this.duration<0&&this.resetDuration(),this.trim(),this.optimize()},a.AnimationClip.prototype={constructor:a.AnimationClip,resetDuration:function(){for(var t=this.tracks,e=0,n=0,r=t.length;n!==r;++n){var i=this.tracks[n];e=Math.max(e,i.times[i.times.length-1])}this.duration=e},trim:function(){for(var t=0;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(a.AnimationClip,{parse:function(t){for(var e=[],n=t.tracks,r=1/(t.fps||1),i=0,o=n.length;i!==o;++i)e.push(a.KeyframeTrack.parse(n[i]).scale(r));return new a.AnimationClip(t.name,t.duration,e)},toJSON:function(t){for(var e=[],n=t.tracks,r={name:t.name,duration:t.duration,tracks:e},i=0,o=n.length;i!==o;++i)e.push(a.KeyframeTrack.toJSON(n[i]));return r},CreateFromMorphTargetSequence:function(t,e,n,r){for(var i=e.length,o=[],s=0;s<i;s++){var c=[],u=[];c.push((s+i-1)%i,s,(s+1)%i),u.push(0,1,0);var l=a.AnimationUtils.getKeyframeOrder(c);c=a.AnimationUtils.sortedArray(c,1,l),u=a.AnimationUtils.sortedArray(u,1,l),r||0!==c[0]||(c.push(i),u.push(u[0])),o.push(new a.NumberKeyframeTrack(".morphTargetInfluences["+e[s].name+"]",c,u).scale(1/n))}return new a.AnimationClip(t,(-1),o)},findByName:function(t,e){var n=t;if(!Array.isArray(t)){var r=t;n=r.geometry&&r.geometry.animations||r.animations}for(var i=0;i<n.length;i++)if(n[i].name===e)return n[i];return null},CreateClipsFromMorphTargetSequences:function(t,e,n){for(var r={},i=/^([\w-]*?)([\d]+)$/,o=0,s=t.length;o<s;o++){var c=t[o],u=c.name.match(i);if(u&&u.length>1){var l=u[1],h=r[l];h||(r[l]=h=[]),h.push(c)}}var f=[];for(var l in r)f.push(a.AnimationClip.CreateFromMorphTargetSequence(l,r[l],e,n));return f},parseAnimation:function(t,e,n){if(!t)return console.error(" no animation in JSONLoader data"),null;for(var r=function(t,e,n,r,i){if(0!==n.length){var o=[],s=[];a.AnimationUtils.flattenJSON(n,o,s,r),0!==o.length&&i.push(new t(e,o,s))}},i=[],o=t.name||"default",s=t.length||-1,c=t.fps||30,u=t.hierarchy||[],l=0;l<u.length;l++){var h=u[l].keys;if(h&&0!==h.length)if(h[0].morphTargets){for(var f={},p=0;p<h.length;p++)if(h[p].morphTargets)for(var d=0;d<h[p].morphTargets.length;d++)f[h[p].morphTargets[d]]=-1;for(var m in f){for(var g=[],v=[],d=0;d!==h[p].morphTargets.length;++d){var y=h[p];g.push(y.time),v.push(y.morphTarget===m?1:0)}i.push(new a.NumberKeyframeTrack(".morphTargetInfluence["+m+"]",g,v))}s=f.length*(c||1)}else{var x=".bones["+e[l].name+"]";r(a.VectorKeyframeTrack,x+".position",h,"pos",i),r(a.QuaternionKeyframeTrack,x+".quaternion",h,"rot",i),r(a.VectorKeyframeTrack,x+".scale",h,"scl",i)}}if(0===i.length)return null;var b=new a.AnimationClip(o,s,i);return b}}),a.AnimationMixer=function(t){this._root=t,this._initMemoryManager(),this._accuIndex=0,this.time=0,this.timeScale=1},Object.assign(a.AnimationMixer.prototype,a.EventDispatcher.prototype,{clipAction:function(t,e){var n=e||this._root,r=n.uuid,i="string"==typeof t?a.AnimationClip.findByName(n,t):t,o=null!==i?i.uuid:t,s=this._actionsByClip[o],c=null;if(void 0!==s){var u=s.actionByRoot[r];if(void 0!==u)return u;c=s.knownActions[0],null===i&&(i=c._clip)}if(null===i)return null;var l=new a.AnimationMixer._Action(this,i,e);return this._bindAction(l,c),this._addInactiveAction(l,o,r),l},existingAction:function(t,e){var n=e||this._root,r=n.uuid,i="string"==typeof t?a.AnimationClip.findByName(n,t):t,o=i?i.uuid:t,s=this._actionsByClip[o];return void 0!==s?s.actionByRoot[r]||null:null},stopAllAction:function(){var t=this._actions,e=this._nActiveActions,n=this._bindings,r=this._nActiveBindings;this._nActiveActions=0,this._nActiveBindings=0;for(var i=0;i!==e;++i)t[i].reset();for(var i=0;i!==r;++i)n[i].useCount=0;return this},update:function(t){t*=this.timeScale;for(var e=this._actions,n=this._nActiveActions,r=this.time+=t,i=Math.sign(t),a=this._accuIndex^=1,o=0;o!==n;++o){var s=e[o];s.enabled&&s._update(r,t,i,a)}for(var c=this._bindings,u=this._nActiveBindings,o=0;o!==u;++o)c[o].apply(a);return this},getRoot:function(){return this._root},uncacheClip:function(t){var e=this._actions,n=t.uuid,r=this._actionsByClip,i=r[n];if(void 0!==i){for(var a=i.knownActions,o=0,s=a.length;o!==s;++o){var c=a[o];this._deactivateAction(c);var u=c._cacheIndex,l=e[e.length-1];c._cacheIndex=null,c._byClipCacheIndex=null,l._cacheIndex=u,e[u]=l,e.pop(),this._removeInactiveBindingsForAction(c)}delete r[n]}},uncacheRoot:function(t){var e=t.uuid,n=this._actionsByClip;for(var r in n){var i=n[r].actionByRoot,a=i[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 u=s[c];u.restoreOriginalState(),this._removeInactiveBinding(u)}},uncacheAction:function(t,e){var n=this.existingAction(t,e);null!==n&&(this._deactivateAction(n),this._removeInactiveAction(n))}}),a.AnimationMixer._Action=a.AnimationAction._new,Object.assign(a.AnimationMixer.prototype,{_bindAction:function(t,e){var n=t._localRoot||this._root,r=t._clip.tracks,i=r.length,o=t._propertyBindings,s=t._interpolants,c=n.uuid,u=this._bindingsByRootAndName,l=u[c];void 0===l&&(l={},u[c]=l);for(var h=0;h!==i;++h){var f=r[h],p=f.name,d=l[p];if(void 0!==d)o[h]=d;else{if(d=o[h],void 0!==d){null===d._cacheIndex&&(++d.referenceCount,this._addInactiveBinding(d,c,p));continue}var m=e&&e._propertyBindings[h].binding.parsedPath;d=new a.PropertyMixer(a.PropertyBinding.create(n,p,m),f.ValueTypeName,f.getValueSize()),++d.referenceCount,this._addInactiveBinding(d,c,p),o[h]=d}s[h].resultBuffer=d.buffer}},_activateAction:function(t){if(!this._isActiveAction(t)){if(null===t._cacheIndex){var e=(t._localRoot||this._root).uuid,n=t._clip.uuid,r=this._actionsByClip[n];this._bindAction(t,r&&r.knownActions[0]),this._addInactiveAction(t,n,e)}for(var i=t._propertyBindings,a=0,o=i.length;a!==o;++a){var s=i[a];0===s.useCount++&&(this._lendBinding(s),s.saveOriginalState())}this._lendAction(t)}},_deactivateAction:function(t){if(this._isActiveAction(t)){for(var e=t._propertyBindings,n=0,r=e.length;n!==r;++n){var i=e[n];0===--i.useCount&&(i.restoreOriginalState(),this._takeBackBinding(i))}this._takeBackAction(t)}},_initMemoryManager:function(){this._actions=[],this._nActiveActions=0,this._actionsByClip={},this._bindings=[],this._nActiveBindings=0,this._bindingsByRootAndName={},this._controlInterpolants=[],this._nActiveControlInterpolants=0;var t=this;this.stats={actions:{get total(){return t._actions.length},get inUse(){return t._nActiveActions}},bindings:{get total(){return t._bindings.length},get inUse(){return t._nActiveBindings}},controlInterpolants:{get total(){return t._controlInterpolants.length},get inUse(){return t._nActiveControlInterpolants}}}},_isActiveAction:function(t){var e=t._cacheIndex;return null!==e&&e<this._nActiveActions},_addInactiveAction:function(t,e,n){var r=this._actions,i=this._actionsByClip,a=i[e];if(void 0===a)a={knownActions:[t],actionByRoot:{}},t._byClipCacheIndex=0,i[e]=a;else{var o=a.knownActions;t._byClipCacheIndex=o.length,o.push(t)}t._cacheIndex=r.length,r.push(t),a.actionByRoot[n]=t},_removeInactiveAction:function(t){var e=this._actions,n=e[e.length-1],r=t._cacheIndex;n._cacheIndex=r,e[r]=n,e.pop(),t._cacheIndex=null;var i=t._clip.uuid,a=this._actionsByClip,o=a[i],s=o.knownActions,c=s[s.length-1],u=t._byClipCacheIndex;c._byClipCacheIndex=u,s[u]=c,s.pop(),t._byClipCacheIndex=null;var l=o.actionByRoot,h=(e._localRoot||this._root).uuid;delete l[h],0===s.length&&delete a[i],this._removeInactiveBindingsForAction(t)},_removeInactiveBindingsForAction:function(t){for(var e=t._propertyBindings,n=0,r=e.length;n!==r;++n){var i=e[n];0===--i.referenceCount&&this._removeInactiveBinding(i)}},_lendAction:function(t){var e=this._actions,n=t._cacheIndex,r=this._nActiveActions++,i=e[r];t._cacheIndex=r,e[r]=t,i._cacheIndex=n,e[n]=i},_takeBackAction:function(t){var e=this._actions,n=t._cacheIndex,r=--this._nActiveActions,i=e[r];t._cacheIndex=r,e[r]=t,i._cacheIndex=n,e[n]=i},_addInactiveBinding:function(t,e,n){var r=this._bindingsByRootAndName,i=r[e],a=this._bindings;void 0===i&&(i={},r[e]=i),i[n]=t,t._cacheIndex=a.length,a.push(t)},_removeInactiveBinding:function(t){var e=this._bindings,n=t.binding,r=n.rootNode.uuid,i=n.path,a=this._bindingsByRootAndName,o=a[r],s=e[e.length-1],c=t._cacheIndex;s._cacheIndex=c,e[c]=s,e.pop(),delete o[i];t:{for(var u in o)break t;delete a[r]}},_lendBinding:function(t){var e=this._bindings,n=t._cacheIndex,r=this._nActiveBindings++,i=e[r];t._cacheIndex=r,e[r]=t,i._cacheIndex=n,e[n]=i},_takeBackBinding:function(t){var e=this._bindings,n=t._cacheIndex,r=--this._nActiveBindings,i=e[r];t._cacheIndex=r,e[r]=t,i._cacheIndex=n,e[n]=i},_lendControlInterpolant:function(){var t=this._controlInterpolants,e=this._nActiveControlInterpolants++,n=t[e];return void 0===n&&(n=new a.LinearInterpolant(new Float32Array(2),new Float32Array(2),1,this._controlInterpolantsResultBuffer),n.__cacheIndex=e,t[e]=n),n},_takeBackControlInterpolant:function(t){var e=this._controlInterpolants,n=t.__cacheIndex,r=--this._nActiveControlInterpolants,i=e[r];t.__cacheIndex=r,e[r]=t,i.__cacheIndex=n,e[n]=i},_controlInterpolantsResultBuffer:new Float32Array(1)}),a.AnimationObjectGroup=function(t){this.uuid=a.Math.generateUUID(),this._objects=Array.prototype.slice.call(arguments),this.nCachedObjects_=0;var e={};this._indicesByUUID=e;for(var n=0,r=arguments.length;n!==r;++n)e[arguments[n].uuid]=n;this._paths=[],this._parsedPaths=[],this._bindings=[],this._bindingsIndicesByPath={};var i=this;this.stats={objects:{get total(){return i._objects.length},get inUse(){return this.total-i.nCachedObjects_}},get bindingsPerObject(){return i._bindings.length}}},a.AnimationObjectGroup.prototype={constructor:a.AnimationObjectGroup,add:function(t){for(var e=this._objects,n=e.length,r=this.nCachedObjects_,i=this._indicesByUUID,o=this._paths,s=this._parsedPaths,c=this._bindings,u=c.length,l=0,h=arguments.length;l!==h;++l){var f=arguments[l],p=f.uuid,d=i[p];if(void 0===d){d=n++,i[p]=d,e.push(f);for(var m=0,g=u;m!==g;++m)c[m].push(new a.PropertyBinding(f,o[m],s[m]))}else if(d<r){var v=e[d],y=--r,x=e[y];i[x.uuid]=d,e[d]=x,i[p]=y,e[y]=f;for(var m=0,g=u;m!==g;++m){var b=c[m],M=b[y],_=b[d];b[d]=M,void 0===_&&(_=new a.PropertyBinding(f,o[m],s[m])),b[y]=_}}else e[d]!==v&&console.error("Different objects with the same UUID detected. Clean the caches or recreate your infrastructure when reloading scenes...")}this.nCachedObjects_=r},remove:function(t){for(var e=this._objects,n=(e.length,this.nCachedObjects_),r=this._indicesByUUID,i=this._bindings,a=i.length,o=0,s=arguments.length;o!==s;++o){var c=arguments[o],u=c.uuid,l=r[u];if(void 0!==l&&l>=n){var h=n++,f=e[h];r[f.uuid]=l,e[l]=f,r[u]=h,e[h]=c;for(var p=0,d=a;p!==d;++p){var m=i[p],g=m[h],v=m[l];m[l]=g,m[h]=v}}}this.nCachedObjects_=n},uncache:function(t){for(var e=this._objects,n=e.length,r=this.nCachedObjects_,i=this._indicesByUUID,a=this._bindings,o=a.length,s=0,c=arguments.length;s!==c;++s){var u=arguments[s],l=u.uuid,h=i[l];if(void 0!==h)if(delete i[l],h<r){var f=--r,p=e[f],d=--n,m=e[d];i[p.uuid]=h,e[h]=p,i[m.uuid]=f,e[f]=m,e.pop();for(var g=0,v=o;g!==v;++g){var y=a[g],x=y[f],b=y[d];y[h]=x,y[f]=b,y.pop()}}else{var d=--n,m=e[d];i[m.uuid]=h,e[h]=m,e.pop();for(var g=0,v=o;g!==v;++g){var y=a[g];y[h]=y[d],y.pop()}}}this.nCachedObjects_=r},subscribe_:function(t,e){var n=this._bindingsIndicesByPath,r=n[t],i=this._bindings;if(void 0!==r)return i[r];var o=this._paths,s=this._parsedPaths,c=this._objects,u=c.length,l=this.nCachedObjects_,h=new Array(u);r=i.length,n[t]=r,o.push(t),s.push(e),i.push(h);for(var f=l,p=c.length;f!==p;++f){var d=c[f];h[f]=new a.PropertyBinding(d,t,e)}return h},unsubscribe_:function(t){var e=this._bindingsIndicesByPath,n=e[t];if(void 0!==n){var r=this._paths,i=this._parsedPaths,a=this._bindings,o=a.length-1,s=a[o],c=t[o];e[c]=n,a[n]=s,a.pop(),i[n]=i[o],i.pop(),r[n]=r[o],r.pop()}}},a.AnimationUtils={arraySlice:function(t,e,n){return a.AnimationUtils.isTypedArray(t)?new t.constructor(t.subarray(e,n)):t.slice(e,n)},convertArray:function(t,e,n){return!t||!n&&t.constructor===e?t:"number"==typeof e.BYTES_PER_ELEMENT?new e(t):Array.prototype.slice.call(t)},isTypedArray:function(t){return ArrayBuffer.isView(t)&&!(t instanceof DataView)},getKeyframeOrder:function(t){function e(e,n){return t[e]-t[n]}for(var n=t.length,r=new Array(n),i=0;i!==n;++i)r[i]=i;return r.sort(e),r},sortedArray:function(t,e,n){for(var r=t.length,i=new t.constructor(r),a=0,o=0;o!==r;++a)for(var s=n[a]*e,c=0;c!==e;++c)i[o++]=t[s+c];return i},flattenJSON:function(t,e,n,r){for(var i=1,a=t[0];void 0!==a&&void 0===a[r];)a=t[i++];if(void 0!==a){var o=a[r];if(void 0!==o)if(Array.isArray(o)){do o=a[r],void 0!==o&&(e.push(a.time),n.push.apply(n,o)),a=t[i++];while(void 0!==a)}else if(void 0!==o.toArray){do o=a[r],void 0!==o&&(e.push(a.time),o.toArray(n,n.length)),a=t[i++];while(void 0!==a)}else do o=a[r],void 0!==o&&(e.push(a.time),n.push(o)),a=t[i++];while(void 0!==a)}}},a.KeyframeTrack=function(t,e,n,r){if(void 0===t)throw new Error("track name is undefined");if(void 0===e||0===e.length)throw new Error("no keyframes in track named "+t);this.name=t,this.times=a.AnimationUtils.convertArray(e,this.TimeBufferType),this.values=a.AnimationUtils.convertArray(n,this.ValueBufferType),this.setInterpolation(r||this.DefaultInterpolation),this.validate(),this.optimize()},a.KeyframeTrack.prototype={constructor:a.KeyframeTrack,TimeBufferType:Float32Array,ValueBufferType:Float32Array,DefaultInterpolation:a.InterpolateLinear,InterpolantFactoryMethodDiscrete:function(t){return new a.DiscreteInterpolant(this.times,this.values,this.getValueSize(),t)},InterpolantFactoryMethodLinear:function(t){return new a.LinearInterpolant(this.times,this.values,this.getValueSize(),t)},InterpolantFactoryMethodSmooth:function(t){return new a.CubicInterpolant(this.times,this.values,this.getValueSize(),t)},setInterpolation:function(t){var e;switch(t){case a.InterpolateDiscrete:e=this.InterpolantFactoryMethodDiscrete;break;case a.InterpolateLinear:e=this.InterpolantFactoryMethodLinear;break;case a.InterpolateSmooth:e=this.InterpolantFactoryMethodSmooth}if(void 0===e){var n="unsupported interpolation for "+this.ValueTypeName+" keyframe track named "+this.name;if(void 0===this.createInterpolant){if(t===this.DefaultInterpolation)throw new Error(n);this.setInterpolation(this.DefaultInterpolation)}return void console.warn(n)}this.createInterpolant=e},getInterpolation:function(){switch(this.createInterpolant){case this.InterpolantFactoryMethodDiscrete:return a.InterpolateDiscrete;case this.InterpolantFactoryMethodLinear:return a.InterpolateLinear;case this.InterpolantFactoryMethodSmooth:return a.InterpolateSmooth}},getValueSize:function(){return this.values.length/this.times.length},shift:function(t){if(0!==t)for(var e=this.times,n=0,r=e.length;n!==r;++n)e[n]+=t;return this},scale:function(t){if(1!==t)for(var e=this.times,n=0,r=e.length;n!==r;++n)e[n]*=t;return this},trim:function(t,e){for(var n=this.times,r=n.length,i=0,o=r-1;i!==r&&n[i]<t;)++i;for(;o!==-1&&n[o]>e;)--o;if(++o,0!==i||o!==r){i>=o&&(o=Math.max(o,1),i=o-1);var s=this.getValueSize();this.times=a.AnimationUtils.arraySlice(n,i,o),this.values=a.AnimationUtils.arraySlice(this.values,i*s,o*s)}return this},validate:function(){var t=!0,e=this.getValueSize();e-Math.floor(e)!==0&&(console.error("invalid value size in track",this),t=!1);var n=this.times,r=this.values,i=n.length;0===i&&(console.error("track is empty",this),t=!1);for(var o=null,s=0;s!==i;s++){var c=n[s];if("number"==typeof c&&isNaN(c)){console.error("time is not a valid number",this,s,c),t=!1;break}if(null!==o&&o>c){console.error("out of order keys",this,s,c,o),t=!1;break}o=c}if(void 0!==r&&a.AnimationUtils.isTypedArray(r))for(var s=0,u=r.length;s!==u;++s){
-var l=r[s];if(isNaN(l)){console.error("value is not a valid number",this,s,l),t=!1;break}}return t},optimize:function(){for(var t=this.times,e=this.values,n=this.getValueSize(),r=1,i=1,o=t.length-1;i<=o;++i){var s=!1,c=t[i],u=t[i+1];if(c!==u&&(1!==i||c!==c[0]))for(var l=i*n,h=l-n,f=l+n,p=0;p!==n;++p){var d=e[l+p];if(d!==e[h+p]||d!==e[f+p]){s=!0;break}}if(s){if(i!==r){t[r]=t[i];for(var m=i*n,g=r*n,p=0;p!==n;++p)e[g+p]=e[m+p]}++r}}return r!==t.length&&(this.times=a.AnimationUtils.arraySlice(t,0,r),this.values=a.AnimationUtils.arraySlice(e,0,r*n)),this}},Object.assign(a.KeyframeTrack,{parse:function(t){if(void 0===t.type)throw new Error("track type undefined, can not parse");var e=a.KeyframeTrack._getTrackTypeForValueTypeName(t.type);if(void 0===t.times){var n=[],r=[];a.AnimationUtils.flattenJSON(t.keys,n,r,"value"),t.times=n,t.values=r}return void 0!==e.parse?e.parse(t):new e(t.name,t.times,t.values,t.interpolation)},toJSON:function(t){var e,n=t.constructor;if(void 0!==n.toJSON)e=n.toJSON(t);else{e={name:t.name,times:a.AnimationUtils.convertArray(t.times,Array),values:a.AnimationUtils.convertArray(t.values,Array)};var r=t.getInterpolation();r!==t.DefaultInterpolation&&(e.interpolation=r)}return e.type=t.ValueTypeName,e},_getTrackTypeForValueTypeName:function(t){switch(t.toLowerCase()){case"scalar":case"double":case"float":case"number":case"integer":return a.NumberKeyframeTrack;case"vector":case"vector2":case"vector3":case"vector4":return a.VectorKeyframeTrack;case"color":return a.ColorKeyframeTrack;case"quaternion":return a.QuaternionKeyframeTrack;case"bool":case"boolean":return a.BooleanKeyframeTrack;case"string":return a.StringKeyframeTrack}throw new Error("Unsupported typeName: "+t)}}),a.PropertyBinding=function(t,e,n){this.path=e,this.parsedPath=n||a.PropertyBinding.parseTrackName(e),this.node=a.PropertyBinding.findNode(t,this.parsedPath.nodeName)||t,this.rootNode=t},a.PropertyBinding.prototype={constructor:a.PropertyBinding,getValue:function(t,e){this.bind(),this.getValue(t,e)},setValue:function(t,e){this.bind(),this.setValue(t,e)},bind:function(){var t=this.node,e=this.parsedPath,n=e.objectName,r=e.propertyName,i=e.propertyIndex;if(t||(t=a.PropertyBinding.findNode(this.rootNode,e.nodeName)||this.rootNode,this.node=t),this.getValue=this._getValue_unavailable,this.setValue=this._setValue_unavailable,!t)return void console.error(" trying to update node for track: "+this.path+" but it wasn't found.");if(n){var o=e.objectIndex;switch(n){case"materials":if(!t.material)return void console.error(" can not bind to material as node does not have a material",this);if(!t.material.materials)return void console.error(" can not bind to material.materials as node.material does not have a materials array",this);t=t.material.materials;break;case"bones":if(!t.skeleton)return void console.error(" can not bind to bones as node does not have a skeleton",this);t=t.skeleton.bones;for(var s=0;s<t.length;s++)if(t[s].name===o){o=s;break}break;default:if(void 0===t[n])return void console.error(" can not bind to objectName of node, undefined",this);t=t[n]}if(void 0!==o){if(void 0===t[o])return void console.error(" trying to bind to objectIndex of objectName, but is undefined:",this,t);t=t[o]}}var c=t[r];if(void 0===c){var u=e.nodeName;return void console.error(" trying to update property for track: "+u+"."+r+" but it wasn't found.",t)}var l=this.Versioning.None;void 0!==t.needsUpdate?(l=this.Versioning.NeedsUpdate,this.targetObject=t):void 0!==t.matrixWorldNeedsUpdate&&(l=this.Versioning.MatrixWorldNeedsUpdate,this.targetObject=t);var h=this.BindingType.Direct;if(void 0!==i){if("morphTargetInfluences"===r){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 s=0;s<this.node.geometry.morphTargets.length;s++)if(t.geometry.morphTargets[s].name===i){i=s;break}}h=this.BindingType.ArrayElement,this.resolvedProperty=c,this.propertyIndex=i}else void 0!==c.fromArray&&void 0!==c.toArray?(h=this.BindingType.HasFromToArray,this.resolvedProperty=c):void 0!==c.length?(h=this.BindingType.EntireArray,this.resolvedProperty=c):this.propertyName=r;this.getValue=this.GetterByBindingType[h],this.setValue=this.SetterByBindingTypeAndVersioning[h][l]},unbind:function(){this.node=null,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}},Object.assign(a.PropertyBinding.prototype,{_getValue_unavailable:function(){},_setValue_unavailable:function(){},_getValue_unbound:a.PropertyBinding.prototype.getValue,_setValue_unbound:a.PropertyBinding.prototype.setValue,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 n=this.resolvedProperty,r=0,i=n.length;r!==i;++r)t[e++]=n[r]},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 n=this.resolvedProperty,r=0,i=n.length;r!==i;++r)n[r]=t[e++]},function(t,e){for(var n=this.resolvedProperty,r=0,i=n.length;r!==i;++r)n[r]=t[e++];this.targetObject.needsUpdate=!0},function(t,e){for(var n=this.resolvedProperty,r=0,i=n.length;r!==i;++r)n[r]=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}]]}),a.PropertyBinding.Composite=function(t,e,n){var r=n||a.PropertyBinding.parseTrackName(e);this._targetGroup=t,this._bindings=t.subscribe_(e,r)},a.PropertyBinding.Composite.prototype={constructor:a.PropertyBinding.Composite,getValue:function(t,e){this.bind();var n=this._targetGroup.nCachedObjects_,r=this._bindings[n];void 0!==r&&r.getValue(t,e)},setValue:function(t,e){for(var n=this._bindings,r=this._targetGroup.nCachedObjects_,i=n.length;r!==i;++r)n[r].setValue(t,e)},bind:function(){for(var t=this._bindings,e=this._targetGroup.nCachedObjects_,n=t.length;e!==n;++e)t[e].bind()},unbind:function(){for(var t=this._bindings,e=this._targetGroup.nCachedObjects_,n=t.length;e!==n;++e)t[e].unbind()}},a.PropertyBinding.create=function(t,e,n){return t instanceof a.AnimationObjectGroup?new a.PropertyBinding.Composite(t,e,n):new a.PropertyBinding(t,e,n)},a.PropertyBinding.parseTrackName=function(t){var e=/^(([\w]+\/)*)([\w-\d]+)?(\.([\w]+)(\[([\w\d\[\]\_.:\- ]+)\])?)?(\.([\w.]+)(\[([\w\d\[\]\_. ]+)\])?)$/,n=e.exec(t);if(!n)throw new Error("cannot parse trackName at all: "+t);n.index===e.lastIndex&&e.lastIndex++;var r={nodeName:n[3],objectName:n[5],objectIndex:n[7],propertyName:n[9],propertyIndex:n[11]};if(null===r.propertyName||0===r.propertyName.length)throw new Error("can not parse propertyName from trackName: "+t);return r},a.PropertyBinding.findNode=function(t,e){if(!e||""===e||"root"===e||"."===e||e===-1||e===t.name||e===t.uuid)return t;if(t.skeleton){var n=function(t){for(var n=0;n<t.bones.length;n++){var r=t.bones[n];if(r.name===e)return r}return null},r=n(t.skeleton);if(r)return r}if(t.children){var i=function(t){for(var n=0;n<t.length;n++){var r=t[n];if(r.name===e||r.uuid===e)return r;var a=i(r.children);if(a)return a}return null},a=i(t.children);if(a)return a}return null},a.PropertyMixer=function(t,e,n){this.binding=t,this.valueSize=n;var r,i=Float64Array;switch(e){case"quaternion":r=this._slerp;break;case"string":case"bool":i=Array,r=this._select;break;default:r=this._lerp}this.buffer=new i(4*n),this._mixBufferRegion=r,this.cumulativeWeight=0,this.useCount=0,this.referenceCount=0},a.PropertyMixer.prototype={constructor:a.PropertyMixer,accumulate:function(t,e){var n=this.buffer,r=this.valueSize,i=t*r+r,a=this.cumulativeWeight;if(0===a){for(var o=0;o!==r;++o)n[i+o]=n[o];a=e}else{a+=e;var s=e/a;this._mixBufferRegion(n,i,0,s,r)}this.cumulativeWeight=a},apply:function(t){var e=this.valueSize,n=this.buffer,r=t*e+e,i=this.cumulativeWeight,a=this.binding;if(this.cumulativeWeight=0,i<1){var o=3*e;this._mixBufferRegion(n,r,o,1-i,e)}for(var s=e,c=e+e;s!==c;++s)if(n[s]!==n[s+e]){a.setValue(n,r);break}},saveOriginalState:function(){var t=this.binding,e=this.buffer,n=this.valueSize,r=3*n;t.getValue(e,r);for(var i=n,a=r;i!==a;++i)e[i]=e[r+i%n];this.cumulativeWeight=0},restoreOriginalState:function(){var t=3*this.valueSize;this.binding.setValue(this.buffer,t)},_select:function(t,e,n,r,i){if(r>=.5)for(var a=0;a!==i;++a)t[e+a]=t[n+a]},_slerp:function(t,e,n,r,i){a.Quaternion.slerpFlat(t,e,t,e,t,n,r)},_lerp:function(t,e,n,r,i){for(var a=1-r,o=0;o!==i;++o){var s=e+o;t[s]=t[s]*a+t[n+o]*r}}},a.BooleanKeyframeTrack=function(t,e,n){a.KeyframeTrack.call(this,t,e,n)},a.BooleanKeyframeTrack.prototype=Object.assign(Object.create(a.KeyframeTrack.prototype),{constructor:a.BooleanKeyframeTrack,ValueTypeName:"bool",ValueBufferType:Array,DefaultInterpolation:a.InterpolateDiscrete,InterpolantFactoryMethodLinear:void 0,InterpolantFactoryMethodSmooth:void 0}),a.ColorKeyframeTrack=function(t,e,n,r){a.KeyframeTrack.call(this,t,e,n,r)},a.ColorKeyframeTrack.prototype=Object.assign(Object.create(a.KeyframeTrack.prototype),{constructor:a.ColorKeyframeTrack,ValueTypeName:"color"}),a.NumberKeyframeTrack=function(t,e,n,r){a.KeyframeTrack.call(this,t,e,n,r)},a.NumberKeyframeTrack.prototype=Object.assign(Object.create(a.KeyframeTrack.prototype),{constructor:a.NumberKeyframeTrack,ValueTypeName:"number"}),a.QuaternionKeyframeTrack=function(t,e,n,r){a.KeyframeTrack.call(this,t,e,n,r)},a.QuaternionKeyframeTrack.prototype=Object.assign(Object.create(a.KeyframeTrack.prototype),{constructor:a.QuaternionKeyframeTrack,ValueTypeName:"quaternion",DefaultInterpolation:a.InterpolateLinear,InterpolantFactoryMethodLinear:function(t){return new a.QuaternionLinearInterpolant(this.times,this.values,this.getValueSize(),t)},InterpolantFactoryMethodSmooth:void 0}),a.StringKeyframeTrack=function(t,e,n,r){a.KeyframeTrack.call(this,t,e,n,r)},a.StringKeyframeTrack.prototype=Object.assign(Object.create(a.KeyframeTrack.prototype),{constructor:a.StringKeyframeTrack,ValueTypeName:"string",ValueBufferType:Array,DefaultInterpolation:a.InterpolateDiscrete,InterpolantFactoryMethodLinear:void 0,InterpolantFactoryMethodSmooth:void 0}),a.VectorKeyframeTrack=function(t,e,n,r){a.KeyframeTrack.call(this,t,e,n,r)},a.VectorKeyframeTrack.prototype=Object.assign(Object.create(a.KeyframeTrack.prototype),{constructor:a.VectorKeyframeTrack,ValueTypeName:"vector"}),a.Audio=function(t){a.Object3D.call(this),this.type="Audio",this.context=t.context,this.source=this.context.createBufferSource(),this.source.onended=this.onEnded.bind(this),this.gain=this.context.createGain(),this.gain.connect(t.getInput()),this.autoplay=!1,this.startTime=0,this.playbackRate=1,this.isPlaying=!1,this.hasPlaybackControl=!0,this.sourceType="empty",this.filters=[]},a.Audio.prototype=Object.assign(Object.create(a.Object3D.prototype),{constructor:a.Audio,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.source.buffer=t,this.sourceType="buffer",this.autoplay&&this.play(),this},play:function(){if(this.isPlaying===!0)return void console.warn("THREE.Audio: Audio is already playing.");if(this.hasPlaybackControl===!1)return void console.warn("THREE.Audio: this Audio has no playback control.");var t=this.context.createBufferSource();return t.buffer=this.source.buffer,t.loop=this.source.loop,t.onended=this.source.onended,t.start(0,this.startTime),t.playbackRate.value=this.playbackRate,this.isPlaying=!0,this.source=t,this.connect()},pause:function(){return this.hasPlaybackControl===!1?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 this.hasPlaybackControl===!1?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=[]),this.isPlaying===!0?(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 this.hasPlaybackControl===!1?void console.warn("THREE.Audio: this Audio has no playback control."):(this.playbackRate=t,this.isPlaying===!0&&(this.source.playbackRate.value=this.playbackRate),this)},getPlaybackRate:function(){return this.playbackRate},onEnded:function(){this.isPlaying=!1},getLoop:function(){return this.hasPlaybackControl===!1?(console.warn("THREE.Audio: this Audio has no playback control."),!1):this.source.loop},setLoop:function(t){return this.hasPlaybackControl===!1?void console.warn("THREE.Audio: this Audio has no playback control."):void(this.source.loop=t)},getVolume:function(){return this.gain.gain.value},setVolume:function(t){return this.gain.gain.value=t,this}}),a.AudioAnalyser=function(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)},Object.assign(a.AudioAnalyser.prototype,{getFrequencyData:function(){return this.analyser.getByteFrequencyData(this.data),this.data},getAverageFrequency:function(){for(var t=0,e=this.getFrequencyData(),n=0;n<e.length;n++)t+=e[n];return t/e.length}}),Object.defineProperty(a,"AudioContext",{get:function(){var t;return function(){return void 0===t&&(t=new(window.AudioContext||window.webkitAudioContext)),t}}()}),a.PositionalAudio=function(t){a.Audio.call(this,t),this.panner=this.context.createPanner(),this.panner.connect(this.gain)},a.PositionalAudio.prototype=Object.assign(Object.create(a.Audio.prototype),{constructor:a.PositionalAudio,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 a.Vector3;return function(e){a.Object3D.prototype.updateMatrixWorld.call(this,e),t.setFromMatrixPosition(this.matrixWorld),this.panner.setPosition(t.x,t.y,t.z)}}()}),a.AudioListener=function(){a.Object3D.call(this),this.type="AudioListener",this.context=a.AudioContext,this.gain=this.context.createGain(),this.gain.connect(this.context.destination),this.filter=null},a.AudioListener.prototype=Object.assign(Object.create(a.Object3D.prototype),{constructor:a.AudioListener,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 a.Vector3,e=new a.Quaternion,n=new a.Vector3,r=new a.Vector3;return function(i){a.Object3D.prototype.updateMatrixWorld.call(this,i);var o=this.context.listener,s=this.up;this.matrixWorld.decompose(t,e,n),r.set(0,0,-1).applyQuaternion(e),o.setPosition(t.x,t.y,t.z),o.setOrientation(r.x,r.y,r.z,s.x,s.y,s.z)}}()}),a.Camera=function(){a.Object3D.call(this),this.type="Camera",this.matrixWorldInverse=new a.Matrix4,this.projectionMatrix=new a.Matrix4},a.Camera.prototype=Object.create(a.Object3D.prototype),a.Camera.prototype.constructor=a.Camera,a.Camera.prototype.getWorldDirection=function(){var t=new a.Quaternion;return function(e){var n=e||new a.Vector3;return this.getWorldQuaternion(t),n.set(0,0,-1).applyQuaternion(t)}}(),a.Camera.prototype.lookAt=function(){var t=new a.Matrix4;return function(e){t.lookAt(this.position,e,this.up),this.quaternion.setFromRotationMatrix(t)}}(),a.Camera.prototype.clone=function(){return(new this.constructor).copy(this)},a.Camera.prototype.copy=function(t){return a.Object3D.prototype.copy.call(this,t),this.matrixWorldInverse.copy(t.matrixWorldInverse),this.projectionMatrix.copy(t.projectionMatrix),this},a.CubeCamera=function(t,e,n){a.Object3D.call(this),this.type="CubeCamera";var r=90,i=1,o=new a.PerspectiveCamera(r,i,t,e);o.up.set(0,-1,0),o.lookAt(new a.Vector3(1,0,0)),this.add(o);var s=new a.PerspectiveCamera(r,i,t,e);s.up.set(0,-1,0),s.lookAt(new a.Vector3((-1),0,0)),this.add(s);var c=new a.PerspectiveCamera(r,i,t,e);c.up.set(0,0,1),c.lookAt(new a.Vector3(0,1,0)),this.add(c);var u=new a.PerspectiveCamera(r,i,t,e);u.up.set(0,0,-1),u.lookAt(new a.Vector3(0,(-1),0)),this.add(u);var l=new a.PerspectiveCamera(r,i,t,e);l.up.set(0,-1,0),l.lookAt(new a.Vector3(0,0,1)),this.add(l);var h=new a.PerspectiveCamera(r,i,t,e);h.up.set(0,-1,0),h.lookAt(new a.Vector3(0,0,(-1))),this.add(h);var f={format:a.RGBFormat,magFilter:a.LinearFilter,minFilter:a.LinearFilter};this.renderTarget=new a.WebGLRenderTargetCube(n,n,f),this.updateCubeMap=function(t,e){null===this.parent&&this.updateMatrixWorld();var n=this.renderTarget,r=n.texture.generateMipmaps;n.texture.generateMipmaps=!1,n.activeCubeFace=0,t.render(e,o,n),n.activeCubeFace=1,t.render(e,s,n),n.activeCubeFace=2,t.render(e,c,n),n.activeCubeFace=3,t.render(e,u,n),n.activeCubeFace=4,t.render(e,l,n),n.texture.generateMipmaps=r,n.activeCubeFace=5,t.render(e,h,n),t.setRenderTarget(null)}},a.CubeCamera.prototype=Object.create(a.Object3D.prototype),a.CubeCamera.prototype.constructor=a.CubeCamera,a.OrthographicCamera=function(t,e,n,r,i,o){a.Camera.call(this),this.type="OrthographicCamera",this.zoom=1,this.view=null,this.left=t,this.right=e,this.top=n,this.bottom=r,this.near=void 0!==i?i:.1,this.far=void 0!==o?o:2e3,this.updateProjectionMatrix()},a.OrthographicCamera.prototype=Object.assign(Object.create(a.Camera.prototype),{constructor:a.OrthographicCamera,copy:function(t){return a.Camera.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,n,r,i,a){this.view={fullWidth:t,fullHeight:e,offsetX:n,offsetY:r,width:i,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),n=(this.right+this.left)/2,r=(this.top+this.bottom)/2,i=n-t,a=n+t,o=r+e,s=r-e;if(null!==this.view){var c=this.zoom/(this.view.width/this.view.fullWidth),u=this.zoom/(this.view.height/this.view.fullHeight),l=(this.right-this.left)/this.view.width,h=(this.top-this.bottom)/this.view.height;i+=l*(this.view.offsetX/c),a=i+l*(this.view.width/c),o-=h*(this.view.offsetY/u),s=o-h*(this.view.height/u)}this.projectionMatrix.makeOrthographic(i,a,o,s,this.near,this.far)},toJSON:function(t){var e=a.Object3D.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}}),a.PerspectiveCamera=function(t,e,n,r){a.Camera.call(this),this.type="PerspectiveCamera",this.fov=void 0!==t?t:50,this.zoom=1,this.near=void 0!==n?n:.1,this.far=void 0!==r?r:2e3,this.focus=10,this.aspect=void 0!==e?e:1,this.view=null,this.filmGauge=35,this.filmOffset=0,this.updateProjectionMatrix()},a.PerspectiveCamera.prototype=Object.assign(Object.create(a.Camera.prototype),{constructor:a.PerspectiveCamera,copy:function(t){return a.Camera.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*a.Math.RAD2DEG*Math.atan(e),this.updateProjectionMatrix()},getFocalLength:function(){var t=Math.tan(.5*a.Math.DEG2RAD*this.fov);return.5*this.getFilmHeight()/t},getEffectiveFOV:function(){return 2*a.Math.RAD2DEG*Math.atan(Math.tan(.5*a.Math.DEG2RAD*this.fov)/this.zoom)},getFilmWidth:function(){return this.filmGauge*Math.min(this.aspect,1)},getFilmHeight:function(){return this.filmGauge/Math.max(this.aspect,1)},setViewOffset:function(t,e,n,r,i,a){this.aspect=t/e,this.view={fullWidth:t,fullHeight:e,offsetX:n,offsetY:r,width:i,height:a},this.updateProjectionMatrix()},clearViewOffset:function(){this.view=null,this.updateProjectionMatrix()},updateProjectionMatrix:function(){var t=this.near,e=t*Math.tan(.5*a.Math.DEG2RAD*this.fov)/this.zoom,n=2*e,r=this.aspect*n,i=-.5*r,o=this.view;if(null!==o){var s=o.fullWidth,c=o.fullHeight;i+=o.offsetX*r/s,e-=o.offsetY*n/c,r*=o.width/s,n*=o.height/c}var u=this.filmOffset;0!==u&&(i+=t*u/this.getFilmWidth()),this.projectionMatrix.makeFrustum(i,i+r,e-n,e,t,this.far)},toJSON:function(t){var e=a.Object3D.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}}),a.StereoCamera=function(){this.type="StereoCamera",this.aspect=1,this.cameraL=new a.PerspectiveCamera,this.cameraL.layers.enable(1),this.cameraL.matrixAutoUpdate=!1,this.cameraR=new a.PerspectiveCamera,this.cameraR.layers.enable(2),this.cameraR.matrixAutoUpdate=!1},Object.assign(a.StereoCamera.prototype,{update:function(){var t,e,n,r,i,o=new a.Matrix4,s=new a.Matrix4;return function(c){var u=t!==c.focus||e!==c.fov||n!==c.aspect*this.aspect||r!==c.near||i!==c.far;if(u){t=c.focus,e=c.fov,n=c.aspect*this.aspect,r=c.near,i=c.far;var l,h,f=c.projectionMatrix.clone(),p=.032,d=p*r/t,m=r*Math.tan(a.Math.DEG2RAD*e*.5);s.elements[12]=-p,o.elements[12]=p,l=-m*n+d,h=m*n+d,f.elements[0]=2*r/(h-l),f.elements[8]=(h+l)/(h-l),this.cameraL.projectionMatrix.copy(f),l=-m*n-d,h=m*n-d,f.elements[0]=2*r/(h-l),f.elements[8]=(h+l)/(h-l),this.cameraR.projectionMatrix.copy(f)}this.cameraL.matrixWorld.copy(c.matrixWorld).multiply(s),this.cameraR.matrixWorld.copy(c.matrixWorld).multiply(o)}}()}),a.Light=function(t,e){a.Object3D.call(this),this.type="Light",this.color=new a.Color(t),this.intensity=void 0!==e?e:1,this.receiveShadow=void 0},a.Light.prototype=Object.assign(Object.create(a.Object3D.prototype),{constructor:a.Light,copy:function(t){return a.Object3D.prototype.copy.call(this,t),this.color.copy(t.color),this.intensity=t.intensity,this},toJSON:function(t){var e=a.Object3D.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),e}}),a.LightShadow=function(t){this.camera=t,this.bias=0,this.radius=1,this.mapSize=new a.Vector2(512,512),this.map=null,this.matrix=new a.Matrix4},Object.assign(a.LightShadow.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)}}),a.AmbientLight=function(t,e){a.Light.call(this,t,e),this.type="AmbientLight",this.castShadow=void 0},a.AmbientLight.prototype=Object.assign(Object.create(a.Light.prototype),{constructor:a.AmbientLight}),a.DirectionalLight=function(t,e){a.Light.call(this,t,e),this.type="DirectionalLight",this.position.set(0,1,0),this.updateMatrix(),this.target=new a.Object3D,this.shadow=new a.DirectionalLightShadow},a.DirectionalLight.prototype=Object.assign(Object.create(a.Light.prototype),{constructor:a.DirectionalLight,copy:function(t){return a.Light.prototype.copy.call(this,t),this.target=t.target.clone(),this.shadow=t.shadow.clone(),this}}),a.DirectionalLightShadow=function(t){a.LightShadow.call(this,new a.OrthographicCamera((-5),5,5,(-5),.5,500))},a.DirectionalLightShadow.prototype=Object.assign(Object.create(a.LightShadow.prototype),{constructor:a.DirectionalLightShadow}),a.HemisphereLight=function(t,e,n){a.Light.call(this,t,n),this.type="HemisphereLight",this.castShadow=void 0,this.position.set(0,1,0),this.updateMatrix(),this.groundColor=new a.Color(e)},a.HemisphereLight.prototype=Object.assign(Object.create(a.Light.prototype),{constructor:a.HemisphereLight,copy:function(t){return a.Light.prototype.copy.call(this,t),this.groundColor.copy(t.groundColor),this}}),a.PointLight=function(t,e,n,r){a.Light.call(this,t,e),this.type="PointLight",Object.defineProperty(this,"power",{get:function(){return 4*this.intensity*Math.PI},set:function(t){this.intensity=t/(4*Math.PI)}}),this.distance=void 0!==n?n:0,this.decay=void 0!==r?r:1,this.shadow=new a.LightShadow(new a.PerspectiveCamera(90,1,.5,500))},a.PointLight.prototype=Object.assign(Object.create(a.Light.prototype),{constructor:a.PointLight,copy:function(t){return a.Light.prototype.copy.call(this,t),this.distance=t.distance,this.decay=t.decay,this.shadow=t.shadow.clone(),this}}),a.SpotLight=function(t,e,n,r,i,o){a.Light.call(this,t,e),this.type="SpotLight",this.position.set(0,1,0),this.updateMatrix(),this.target=new a.Object3D,Object.defineProperty(this,"power",{get:function(){return this.intensity*Math.PI},set:function(t){this.intensity=t/Math.PI}}),this.distance=void 0!==n?n:0,this.angle=void 0!==r?r:Math.PI/3,this.penumbra=void 0!==i?i:0,this.decay=void 0!==o?o:1,this.shadow=new a.SpotLightShadow},a.SpotLight.prototype=Object.assign(Object.create(a.Light.prototype),{constructor:a.SpotLight,copy:function(t){return a.Light.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}}),a.SpotLightShadow=function(){a.LightShadow.call(this,new a.PerspectiveCamera(50,1,.5,500))},a.SpotLightShadow.prototype=Object.assign(Object.create(a.LightShadow.prototype),{constructor:a.SpotLightShadow,update:function(t){var e=2*a.Math.RAD2DEG*t.angle,n=this.mapSize.width/this.mapSize.height,r=t.distance||500,i=this.camera;e===i.fov&&n===i.aspect&&r===i.far||(i.fov=e,i.aspect=n,i.far=r,i.updateProjectionMatrix())}}),a.AudioLoader=function(t){this.manager=void 0!==t?t:a.DefaultLoadingManager},Object.assign(a.AudioLoader.prototype,{load:function(t,e,n,r){var i=new a.XHRLoader(this.manager);i.setResponseType("arraybuffer"),i.load(t,function(t){var n=a.AudioContext;n.decodeAudioData(t,function(t){e(t)})},n,r)}}),a.Cache={enabled:!1,files:{},add:function(t,e){this.enabled!==!1&&(this.files[t]=e)},get:function(t){if(this.enabled!==!1)return this.files[t]},remove:function(t){delete this.files[t]},clear:function(){this.files={}}},a.Loader=function(){this.onLoadStart=function(){},this.onLoadProgress=function(){},this.onLoadComplete=function(){}},a.Loader.prototype={constructor:a.Loader,crossOrigin:void 0,extractUrlBase:function(t){var e=t.split("/");return 1===e.length?"./":(e.pop(),e.join("/")+"/")},initMaterials:function(t,e,n){for(var r=[],i=0;i<t.length;++i)r[i]=this.createMaterial(t[i],e,n);return r},createMaterial:function(){var t,e,n;return function(r,i,o){function s(t,n,r,s,u){var l,h=i+t,f=a.Loader.Handlers.get(h);null!==f?l=f.load(h):(e.setCrossOrigin(o),l=e.load(h)),void 0!==n&&(l.repeat.fromArray(n),1!==n[0]&&(l.wrapS=a.RepeatWrapping),1!==n[1]&&(l.wrapT=a.RepeatWrapping)),void 0!==r&&l.offset.fromArray(r),void 0!==s&&("repeat"===s[0]&&(l.wrapS=a.RepeatWrapping),"mirror"===s[0]&&(l.wrapS=a.MirroredRepeatWrapping),"repeat"===s[1]&&(l.wrapT=a.RepeatWrapping),"mirror"===s[1]&&(l.wrapT=a.MirroredRepeatWrapping)),void 0!==u&&(l.anisotropy=u);var p=a.Math.generateUUID();return c[p]=l,p}void 0===t&&(t=new a.Color),void 0===e&&(e=new a.TextureLoader),void 0===n&&(n=new a.MaterialLoader);var c={},u={uuid:a.Math.generateUUID(),type:"MeshLambertMaterial"};for(var l in r){var h=r[l];switch(l){case"DbgColor":case"DbgIndex":case"opticalDensity":case"illumination":break;case"DbgName":u.name=h;break;case"blending":u.blending=a[h];break;case"colorAmbient":case"mapAmbient":console.warn("THREE.Loader.createMaterial:",l,"is no longer supported.");break;case"colorDiffuse":u.color=t.fromArray(h).getHex();break;case"colorSpecular":u.specular=t.fromArray(h).getHex();break;case"colorEmissive":u.emissive=t.fromArray(h).getHex();break;case"specularCoef":u.shininess=h;break;case"shading":"basic"===h.toLowerCase()&&(u.type="MeshBasicMaterial"),"phong"===h.toLowerCase()&&(u.type="MeshPhongMaterial"),"standard"===h.toLowerCase()&&(u.type="MeshStandardMaterial");break;case"mapDiffuse":u.map=s(h,r.mapDiffuseRepeat,r.mapDiffuseOffset,r.mapDiffuseWrap,r.mapDiffuseAnisotropy);break;case"mapDiffuseRepeat":case"mapDiffuseOffset":case"mapDiffuseWrap":case"mapDiffuseAnisotropy":break;case"mapEmissive":u.emissiveMap=s(h,r.mapEmissiveRepeat,r.mapEmissiveOffset,r.mapEmissiveWrap,r.mapEmissiveAnisotropy);break;case"mapEmissiveRepeat":case"mapEmissiveOffset":case"mapEmissiveWrap":case"mapEmissiveAnisotropy":break;case"mapLight":u.lightMap=s(h,r.mapLightRepeat,r.mapLightOffset,r.mapLightWrap,r.mapLightAnisotropy);break;case"mapLightRepeat":case"mapLightOffset":case"mapLightWrap":case"mapLightAnisotropy":break;case"mapAO":u.aoMap=s(h,r.mapAORepeat,r.mapAOOffset,r.mapAOWrap,r.mapAOAnisotropy);break;case"mapAORepeat":case"mapAOOffset":case"mapAOWrap":case"mapAOAnisotropy":break;case"mapBump":u.bumpMap=s(h,r.mapBumpRepeat,r.mapBumpOffset,r.mapBumpWrap,r.mapBumpAnisotropy);break;case"mapBumpScale":u.bumpScale=h;break;case"mapBumpRepeat":case"mapBumpOffset":case"mapBumpWrap":case"mapBumpAnisotropy":break;case"mapNormal":u.normalMap=s(h,r.mapNormalRepeat,r.mapNormalOffset,r.mapNormalWrap,r.mapNormalAnisotropy);break;case"mapNormalFactor":u.normalScale=[h,h];break;case"mapNormalRepeat":case"mapNormalOffset":
-case"mapNormalWrap":case"mapNormalAnisotropy":break;case"mapSpecular":u.specularMap=s(h,r.mapSpecularRepeat,r.mapSpecularOffset,r.mapSpecularWrap,r.mapSpecularAnisotropy);break;case"mapSpecularRepeat":case"mapSpecularOffset":case"mapSpecularWrap":case"mapSpecularAnisotropy":break;case"mapMetalness":u.metalnessMap=s(h,r.mapMetalnessRepeat,r.mapMetalnessOffset,r.mapMetalnessWrap,r.mapMetalnessAnisotropy);break;case"mapMetalnessRepeat":case"mapMetalnessOffset":case"mapMetalnessWrap":case"mapMetalnessAnisotropy":break;case"mapRoughness":u.roughnessMap=s(h,r.mapRoughnessRepeat,r.mapRoughnessOffset,r.mapRoughnessWrap,r.mapRoughnessAnisotropy);break;case"mapRoughnessRepeat":case"mapRoughnessOffset":case"mapRoughnessWrap":case"mapRoughnessAnisotropy":break;case"mapAlpha":u.alphaMap=s(h,r.mapAlphaRepeat,r.mapAlphaOffset,r.mapAlphaWrap,r.mapAlphaAnisotropy);break;case"mapAlphaRepeat":case"mapAlphaOffset":case"mapAlphaWrap":case"mapAlphaAnisotropy":break;case"flipSided":u.side=a.BackSide;break;case"doubleSided":u.side=a.DoubleSide;break;case"transparency":console.warn("THREE.Loader.createMaterial: transparency has been renamed to opacity"),u.opacity=h;break;case"depthTest":case"depthWrite":case"colorWrite":case"opacity":case"reflectivity":case"transparent":case"visible":case"wireframe":u[l]=h;break;case"vertexColors":h===!0&&(u.vertexColors=a.VertexColors),"face"===h&&(u.vertexColors=a.FaceColors);break;default:console.error("THREE.Loader.createMaterial: Unsupported",l,h)}}return"MeshBasicMaterial"===u.type&&delete u.emissive,"MeshPhongMaterial"!==u.type&&delete u.specular,u.opacity<1&&(u.transparent=!0),n.setTextures(c),n.parse(u)}}()},a.Loader.Handlers={handlers:[],add:function(t,e){this.handlers.push(t,e)},get:function(t){for(var e=this.handlers,n=0,r=e.length;n<r;n+=2){var i=e[n],a=e[n+1];if(i.test(t))return a}return null}},a.XHRLoader=function(t){this.manager=void 0!==t?t:a.DefaultLoadingManager},Object.assign(a.XHRLoader.prototype,{load:function(t,e,n,r){void 0!==this.path&&(t=this.path+t);var i=this,o=a.Cache.get(t);if(void 0!==o)return e&&setTimeout(function(){e(o)},0),o;var s=new XMLHttpRequest;return s.overrideMimeType("text/plain"),s.open("GET",t,!0),s.addEventListener("load",function(n){var o=n.target.response;a.Cache.add(t,o),200===this.status?(e&&e(o),i.manager.itemEnd(t)):0===this.status?(console.warn("THREE.XHRLoader: HTTP Status 0 received."),e&&e(o),i.manager.itemEnd(t)):(r&&r(n),i.manager.itemError(t))},!1),void 0!==n&&s.addEventListener("progress",function(t){n(t)},!1),s.addEventListener("error",function(e){r&&r(e),i.manager.itemError(t)},!1),void 0!==this.responseType&&(s.responseType=this.responseType),void 0!==this.withCredentials&&(s.withCredentials=this.withCredentials),s.send(null),i.manager.itemStart(t),s},setPath:function(t){return this.path=t,this},setResponseType:function(t){return this.responseType=t,this},setWithCredentials:function(t){return this.withCredentials=t,this}}),a.FontLoader=function(t){this.manager=void 0!==t?t:a.DefaultLoadingManager},Object.assign(a.FontLoader.prototype,{load:function(t,e,n,r){var i=this,o=new a.XHRLoader(this.manager);o.load(t,function(t){var n;try{n=JSON.parse(t)}catch(r){console.warn("THREE.FontLoader: typeface.js support is being deprecated. Use typeface.json instead."),n=JSON.parse(t.substring(65,t.length-2))}var a=i.parse(n);e&&e(a)},n,r)},parse:function(t){return new a.Font(t)}}),a.ImageLoader=function(t){this.manager=void 0!==t?t:a.DefaultLoadingManager},Object.assign(a.ImageLoader.prototype,{load:function(t,e,n,r){var i=document.createElementNS("http://www.w3.org/1999/xhtml","img");if(i.onload=function(){URL.revokeObjectURL(i.src),e&&e(i)},0===t.indexOf("data:"))i.src=t;else{var o=new a.XHRLoader(this.manager);o.setPath(this.path),o.setResponseType("blob"),o.load(t,function(t){i.src=URL.createObjectURL(t)},n,r)}return i},setCrossOrigin:function(t){return this.crossOrigin=t,this},setPath:function(t){return this.path=t,this}}),a.JSONLoader=function(t){"boolean"==typeof t&&(console.warn("THREE.JSONLoader: showStatus parameter has been removed from constructor."),t=void 0),this.manager=void 0!==t?t:a.DefaultLoadingManager,this.withCredentials=!1},Object.assign(a.JSONLoader.prototype,{load:function(t,e,n,r){var i=this,o=this.texturePath&&"string"==typeof this.texturePath?this.texturePath:a.Loader.prototype.extractUrlBase(t),s=new a.XHRLoader(this.manager);s.setWithCredentials(this.withCredentials),s.load(t,function(n){var r=JSON.parse(n),a=r.metadata;if(void 0!==a){var s=a.type;if(void 0!==s){if("object"===s.toLowerCase())return void console.error("THREE.JSONLoader: "+t+" should be loaded with THREE.ObjectLoader instead.");if("scene"===s.toLowerCase())return void console.error("THREE.JSONLoader: "+t+" should be loaded with THREE.SceneLoader instead.")}}var c=i.parse(r,o);e(c.geometry,c.materials)},n,r)},setTexturePath:function(t){this.texturePath=t},parse:function(t,e){function n(e){function n(t,e){return t&1<<e}var r,i,o,c,u,l,h,f,p,d,m,g,v,y,x,b,M,_,w,S,E,T,A,L,C,R,P,D=t.faces,N=t.vertices,U=t.normals,B=t.colors,I=0;if(void 0!==t.uvs){for(r=0;r<t.uvs.length;r++)t.uvs[r].length&&I++;for(r=0;r<I;r++)s.faceVertexUvs[r]=[]}for(c=0,u=N.length;c<u;)_=new a.Vector3,_.x=N[c++]*e,_.y=N[c++]*e,_.z=N[c++]*e,s.vertices.push(_);for(c=0,u=D.length;c<u;)if(d=D[c++],m=n(d,0),g=n(d,1),v=n(d,3),y=n(d,4),x=n(d,5),b=n(d,6),M=n(d,7),m){if(S=new a.Face3,S.a=D[c],S.b=D[c+1],S.c=D[c+3],E=new a.Face3,E.a=D[c+1],E.b=D[c+2],E.c=D[c+3],c+=4,g&&(p=D[c++],S.materialIndex=p,E.materialIndex=p),o=s.faces.length,v)for(r=0;r<I;r++)for(L=t.uvs[r],s.faceVertexUvs[r][o]=[],s.faceVertexUvs[r][o+1]=[],i=0;i<4;i++)f=D[c++],R=L[2*f],P=L[2*f+1],C=new a.Vector2(R,P),2!==i&&s.faceVertexUvs[r][o].push(C),0!==i&&s.faceVertexUvs[r][o+1].push(C);if(y&&(h=3*D[c++],S.normal.set(U[h++],U[h++],U[h]),E.normal.copy(S.normal)),x)for(r=0;r<4;r++)h=3*D[c++],A=new a.Vector3(U[h++],U[h++],U[h]),2!==r&&S.vertexNormals.push(A),0!==r&&E.vertexNormals.push(A);if(b&&(l=D[c++],T=B[l],S.color.setHex(T),E.color.setHex(T)),M)for(r=0;r<4;r++)l=D[c++],T=B[l],2!==r&&S.vertexColors.push(new a.Color(T)),0!==r&&E.vertexColors.push(new a.Color(T));s.faces.push(S),s.faces.push(E)}else{if(w=new a.Face3,w.a=D[c++],w.b=D[c++],w.c=D[c++],g&&(p=D[c++],w.materialIndex=p),o=s.faces.length,v)for(r=0;r<I;r++)for(L=t.uvs[r],s.faceVertexUvs[r][o]=[],i=0;i<3;i++)f=D[c++],R=L[2*f],P=L[2*f+1],C=new a.Vector2(R,P),s.faceVertexUvs[r][o].push(C);if(y&&(h=3*D[c++],w.normal.set(U[h++],U[h++],U[h])),x)for(r=0;r<3;r++)h=3*D[c++],A=new a.Vector3(U[h++],U[h++],U[h]),w.vertexNormals.push(A);if(b&&(l=D[c++],w.color.setHex(B[l])),M)for(r=0;r<3;r++)l=D[c++],w.vertexColors.push(new a.Color(B[l]));s.faces.push(w)}}function r(){var e=void 0!==t.influencesPerVertex?t.influencesPerVertex:2;if(t.skinWeights)for(var n=0,r=t.skinWeights.length;n<r;n+=e){var i=t.skinWeights[n],o=e>1?t.skinWeights[n+1]:0,c=e>2?t.skinWeights[n+2]:0,u=e>3?t.skinWeights[n+3]:0;s.skinWeights.push(new a.Vector4(i,o,c,u))}if(t.skinIndices)for(var n=0,r=t.skinIndices.length;n<r;n+=e){var l=t.skinIndices[n],h=e>1?t.skinIndices[n+1]:0,f=e>2?t.skinIndices[n+2]:0,p=e>3?t.skinIndices[n+3]:0;s.skinIndices.push(new a.Vector4(l,h,f,p))}s.bones=t.bones,s.bones&&s.bones.length>0&&(s.skinWeights.length!==s.skinIndices.length||s.skinIndices.length!==s.vertices.length)&&console.warn("When skinning, number of vertices ("+s.vertices.length+"), skinIndices ("+s.skinIndices.length+"), and skinWeights ("+s.skinWeights.length+") should match.")}function i(e){if(void 0!==t.morphTargets)for(var n=0,r=t.morphTargets.length;n<r;n++){s.morphTargets[n]={},s.morphTargets[n].name=t.morphTargets[n].name,s.morphTargets[n].vertices=[];for(var i=s.morphTargets[n].vertices,o=t.morphTargets[n].vertices,c=0,u=o.length;c<u;c+=3){var l=new a.Vector3;l.x=o[c]*e,l.y=o[c+1]*e,l.z=o[c+2]*e,i.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 h=s.faces,f=t.morphColors[0].colors,n=0,r=h.length;n<r;n++)h[n].color.fromArray(f,3*n)}}function o(){var e=[],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 i=a.AnimationClip.parseAnimation(n[r],s.bones);i&&e.push(i)}if(s.morphTargets){var o=a.AnimationClip.CreateClipsFromMorphTargetSequences(s.morphTargets,10);e=e.concat(o)}e.length>0&&(s.animations=e)}var s=new a.Geometry,c=void 0!==t.scale?1/t.scale:1;if(n(c),r(),i(c),o(),s.computeFaceNormals(),s.computeBoundingSphere(),void 0===t.materials||0===t.materials.length)return{geometry:s};var u=a.Loader.prototype.initMaterials(t.materials,e,this.crossOrigin);return{geometry:s,materials:u}}}),a.LoadingManager=function(t,e,n){var r=this,i=!1,a=0,o=0;this.onStart=void 0,this.onLoad=t,this.onProgress=e,this.onError=n,this.itemStart=function(t){o++,i===!1&&void 0!==r.onStart&&r.onStart(t,a,o),i=!0},this.itemEnd=function(t){a++,void 0!==r.onProgress&&r.onProgress(t,a,o),a===o&&(i=!1,void 0!==r.onLoad&&r.onLoad())},this.itemError=function(t){void 0!==r.onError&&r.onError(t)}},a.DefaultLoadingManager=new a.LoadingManager,a.BufferGeometryLoader=function(t){this.manager=void 0!==t?t:a.DefaultLoadingManager},Object.assign(a.BufferGeometryLoader.prototype,{load:function(t,e,n,r){var i=this,o=new a.XHRLoader(i.manager);o.load(t,function(t){e(i.parse(JSON.parse(t)))},n,r)},parse:function(t){var e=new a.BufferGeometry,n=t.data.index,r={Int8Array:Int8Array,Uint8Array:Uint8Array,Uint8ClampedArray:Uint8ClampedArray,Int16Array:Int16Array,Uint16Array:Uint16Array,Int32Array:Int32Array,Uint32Array:Uint32Array,Float32Array:Float32Array,Float64Array:Float64Array};if(void 0!==n){var i=new r[n.type](n.array);e.setIndex(new a.BufferAttribute(i,1))}var o=t.data.attributes;for(var s in o){var c=o[s],i=new r[c.type](c.array);e.addAttribute(s,new a.BufferAttribute(i,c.itemSize,c.normalized))}var u=t.data.groups||t.data.drawcalls||t.data.offsets;if(void 0!==u)for(var l=0,h=u.length;l!==h;++l){var f=u[l];e.addGroup(f.start,f.count,f.materialIndex)}var p=t.data.boundingSphere;if(void 0!==p){var d=new a.Vector3;void 0!==p.center&&d.fromArray(p.center),e.boundingSphere=new a.Sphere(d,p.radius)}return e}}),a.MaterialLoader=function(t){this.manager=void 0!==t?t:a.DefaultLoadingManager,this.textures={}},Object.assign(a.MaterialLoader.prototype,{load:function(t,e,n,r){var i=this,o=new a.XHRLoader(i.manager);o.load(t,function(t){e(i.parse(JSON.parse(t)))},n,r)},setTextures:function(t){this.textures=t},getTexture:function(t){var e=this.textures;return void 0===e[t]&&console.warn("THREE.MaterialLoader: Undefined texture",t),e[t]},parse:function(t){var e=new a[t.type];if(void 0!==t.uuid&&(e.uuid=t.uuid),void 0!==t.name&&(e.name=t.name),void 0!==t.color&&e.color.setHex(t.color),void 0!==t.roughness&&(e.roughness=t.roughness),void 0!==t.metalness&&(e.metalness=t.metalness),void 0!==t.emissive&&e.emissive.setHex(t.emissive),void 0!==t.specular&&e.specular.setHex(t.specular),void 0!==t.shininess&&(e.shininess=t.shininess),void 0!==t.uniforms&&(e.uniforms=t.uniforms),void 0!==t.vertexShader&&(e.vertexShader=t.vertexShader),void 0!==t.fragmentShader&&(e.fragmentShader=t.fragmentShader),void 0!==t.vertexColors&&(e.vertexColors=t.vertexColors),void 0!==t.shading&&(e.shading=t.shading),void 0!==t.blending&&(e.blending=t.blending),void 0!==t.side&&(e.side=t.side),void 0!==t.opacity&&(e.opacity=t.opacity),void 0!==t.transparent&&(e.transparent=t.transparent),void 0!==t.alphaTest&&(e.alphaTest=t.alphaTest),void 0!==t.depthTest&&(e.depthTest=t.depthTest),void 0!==t.depthWrite&&(e.depthWrite=t.depthWrite),void 0!==t.colorWrite&&(e.colorWrite=t.colorWrite),void 0!==t.wireframe&&(e.wireframe=t.wireframe),void 0!==t.wireframeLinewidth&&(e.wireframeLinewidth=t.wireframeLinewidth),void 0!==t.size&&(e.size=t.size),void 0!==t.sizeAttenuation&&(e.sizeAttenuation=t.sizeAttenuation),void 0!==t.map&&(e.map=this.getTexture(t.map)),void 0!==t.alphaMap&&(e.alphaMap=this.getTexture(t.alphaMap),e.transparent=!0),void 0!==t.bumpMap&&(e.bumpMap=this.getTexture(t.bumpMap)),void 0!==t.bumpScale&&(e.bumpScale=t.bumpScale),void 0!==t.normalMap&&(e.normalMap=this.getTexture(t.normalMap)),void 0!==t.normalScale){var n=t.normalScale;Array.isArray(n)===!1&&(n=[n,n]),e.normalScale=(new a.Vector2).fromArray(n)}if(void 0!==t.displacementMap&&(e.displacementMap=this.getTexture(t.displacementMap)),void 0!==t.displacementScale&&(e.displacementScale=t.displacementScale),void 0!==t.displacementBias&&(e.displacementBias=t.displacementBias),void 0!==t.roughnessMap&&(e.roughnessMap=this.getTexture(t.roughnessMap)),void 0!==t.metalnessMap&&(e.metalnessMap=this.getTexture(t.metalnessMap)),void 0!==t.emissiveMap&&(e.emissiveMap=this.getTexture(t.emissiveMap)),void 0!==t.emissiveIntensity&&(e.emissiveIntensity=t.emissiveIntensity),void 0!==t.specularMap&&(e.specularMap=this.getTexture(t.specularMap)),void 0!==t.envMap&&(e.envMap=this.getTexture(t.envMap),e.combine=a.MultiplyOperation),void 0!==t.reflectivity&&(e.reflectivity=t.reflectivity),void 0!==t.lightMap&&(e.lightMap=this.getTexture(t.lightMap)),void 0!==t.lightMapIntensity&&(e.lightMapIntensity=t.lightMapIntensity),void 0!==t.aoMap&&(e.aoMap=this.getTexture(t.aoMap)),void 0!==t.aoMapIntensity&&(e.aoMapIntensity=t.aoMapIntensity),void 0!==t.materials)for(var r=0,i=t.materials.length;r<i;r++)e.materials.push(this.parse(t.materials[r]));return e}}),a.ObjectLoader=function(t){this.manager=void 0!==t?t:a.DefaultLoadingManager,this.texturePath=""},Object.assign(a.ObjectLoader.prototype,{load:function(t,e,n,r){""===this.texturePath&&(this.texturePath=t.substring(0,t.lastIndexOf("/")+1));var i=this,o=new a.XHRLoader(i.manager);o.load(t,function(t){i.parse(JSON.parse(t),e)},n,r)},setTexturePath:function(t){this.texturePath=t},setCrossOrigin:function(t){this.crossOrigin=t},parse:function(t,e){var n=this.parseGeometries(t.geometries),r=this.parseImages(t.images,function(){void 0!==e&&e(o)}),i=this.parseTextures(t.textures,r),a=this.parseMaterials(t.materials,i),o=this.parseObject(t.object,n,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 n=new a.JSONLoader,r=new a.BufferGeometryLoader,i=0,o=t.length;i<o;i++){var s,c=t[i];switch(c.type){case"PlaneGeometry":case"PlaneBufferGeometry":s=new a[c.type](c.width,c.height,c.widthSegments,c.heightSegments);break;case"BoxGeometry":case"BoxBufferGeometry":case"CubeGeometry":s=new a[c.type](c.width,c.height,c.depth,c.widthSegments,c.heightSegments,c.depthSegments);break;case"CircleGeometry":case"CircleBufferGeometry":s=new a[c.type](c.radius,c.segments,c.thetaStart,c.thetaLength);break;case"CylinderGeometry":case"CylinderBufferGeometry":s=new a[c.type](c.radiusTop,c.radiusBottom,c.height,c.radialSegments,c.heightSegments,c.openEnded,c.thetaStart,c.thetaLength);break;case"ConeGeometry":case"ConeBufferGeometry":s=new a[c.type](c.radius,c.height,c.radialSegments,c.heightSegments,c.openEnded,c.thetaStart,c.thetaLength);break;case"SphereGeometry":case"SphereBufferGeometry":s=new a[c.type](c.radius,c.widthSegments,c.heightSegments,c.phiStart,c.phiLength,c.thetaStart,c.thetaLength);break;case"DodecahedronGeometry":case"IcosahedronGeometry":case"OctahedronGeometry":case"TetrahedronGeometry":s=new a[c.type](c.radius,c.detail);break;case"RingGeometry":case"RingBufferGeometry":s=new a[c.type](c.innerRadius,c.outerRadius,c.thetaSegments,c.phiSegments,c.thetaStart,c.thetaLength);break;case"TorusGeometry":case"TorusBufferGeometry":s=new a[c.type](c.radius,c.tube,c.radialSegments,c.tubularSegments,c.arc);break;case"TorusKnotGeometry":case"TorusKnotBufferGeometry":s=new a[c.type](c.radius,c.tube,c.tubularSegments,c.radialSegments,c.p,c.q);break;case"LatheGeometry":case"LatheBufferGeometry":s=new a[c.type](c.points,c.segments,c.phiStart,c.phiLength);break;case"BufferGeometry":s=r.parse(c);break;case"Geometry":s=n.parse(c.data,this.texturePath).geometry;break;default:console.warn('THREE.ObjectLoader: Unsupported geometry type "'+c.type+'"');continue}s.uuid=c.uuid,void 0!==c.name&&(s.name=c.name),e[c.uuid]=s}return e},parseMaterials:function(t,e){var n={};if(void 0!==t){var r=new a.MaterialLoader;r.setTextures(e);for(var i=0,o=t.length;i<o;i++){var s=r.parse(t[i]);n[s.uuid]=s}}return n},parseAnimations:function(t){for(var e=[],n=0;n<t.length;n++){var r=a.AnimationClip.parse(t[n]);e.push(r)}return e},parseImages:function(t,e){function n(t){return r.manager.itemStart(t),s.load(t,function(){r.manager.itemEnd(t)})}var r=this,i={};if(void 0!==t&&t.length>0){var o=new a.LoadingManager(e),s=new a.ImageLoader(o);s.setCrossOrigin(this.crossOrigin);for(var c=0,u=t.length;c<u;c++){var l=t[c],h=/^(\/\/)|([a-z]+:(\/\/)?)/i.test(l.url)?l.url:r.texturePath+l.url;i[l.uuid]=n(h)}}return i},parseTextures:function(t,e){function n(t){return"number"==typeof t?t:(console.warn("THREE.ObjectLoader.parseTexture: Constant should be in numeric form.",t),a[t])}var r={};if(void 0!==t)for(var i=0,o=t.length;i<o;i++){var s=t[i];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 a.Texture(e[s.image]);c.needsUpdate=!0,c.uuid=s.uuid,void 0!==s.name&&(c.name=s.name),void 0!==s.mapping&&(c.mapping=n(s.mapping)),void 0!==s.offset&&(c.offset=new a.Vector2(s.offset[0],s.offset[1])),void 0!==s.repeat&&(c.repeat=new a.Vector2(s.repeat[0],s.repeat[1])),void 0!==s.minFilter&&(c.minFilter=n(s.minFilter)),void 0!==s.magFilter&&(c.magFilter=n(s.magFilter)),void 0!==s.anisotropy&&(c.anisotropy=s.anisotropy),Array.isArray(s.wrap)&&(c.wrapS=n(s.wrap[0]),c.wrapT=n(s.wrap[1])),r[s.uuid]=c}return r},parseObject:function(){var t=new a.Matrix4;return function(e,n,r){function i(t){return void 0===n[t]&&console.warn("THREE.ObjectLoader: Undefined geometry",t),n[t]}function o(t){if(void 0!==t)return void 0===r[t]&&console.warn("THREE.ObjectLoader: Undefined material",t),r[t]}var s;switch(e.type){case"Scene":s=new a.Scene;break;case"PerspectiveCamera":s=new a.PerspectiveCamera(e.fov,e.aspect,e.near,e.far),void 0!==e.focus&&(s.focus=e.focus),void 0!==e.zoom&&(s.zoom=e.zoom),void 0!==e.filmGauge&&(s.filmGauge=e.filmGauge),void 0!==e.filmOffset&&(s.filmOffset=e.filmOffset),void 0!==e.view&&(s.view=Object.assign({},e.view));break;case"OrthographicCamera":s=new a.OrthographicCamera(e.left,e.right,e.top,e.bottom,e.near,e.far);break;case"AmbientLight":s=new a.AmbientLight(e.color,e.intensity);break;case"DirectionalLight":s=new a.DirectionalLight(e.color,e.intensity);break;case"PointLight":s=new a.PointLight(e.color,e.intensity,e.distance,e.decay);break;case"SpotLight":s=new a.SpotLight(e.color,e.intensity,e.distance,e.angle,e.penumbra,e.decay);break;case"HemisphereLight":s=new a.HemisphereLight(e.color,e.groundColor,e.intensity);break;case"Mesh":var c=i(e.geometry),u=o(e.material);s=c.bones&&c.bones.length>0?new a.SkinnedMesh(c,u):new a.Mesh(c,u);break;case"LOD":s=new a.LOD;break;case"Line":s=new a.Line(i(e.geometry),o(e.material),e.mode);break;case"PointCloud":case"Points":s=new a.Points(i(e.geometry),o(e.material));break;case"Sprite":s=new a.Sprite(o(e.material));break;case"Group":s=new a.Group;break;default:s=new a.Object3D}if(s.uuid=e.uuid,void 0!==e.name&&(s.name=e.name),void 0!==e.matrix?(t.fromArray(e.matrix),t.decompose(s.position,s.quaternion,s.scale)):(void 0!==e.position&&s.position.fromArray(e.position),void 0!==e.rotation&&s.rotation.fromArray(e.rotation),void 0!==e.scale&&s.scale.fromArray(e.scale)),void 0!==e.castShadow&&(s.castShadow=e.castShadow),void 0!==e.receiveShadow&&(s.receiveShadow=e.receiveShadow),void 0!==e.visible&&(s.visible=e.visible),void 0!==e.userData&&(s.userData=e.userData),void 0!==e.children)for(var l in e.children)s.add(this.parseObject(e.children[l],n,r));if("LOD"===e.type)for(var h=e.levels,f=0;f<h.length;f++){var p=h[f],l=s.getObjectByProperty("uuid",p.object);void 0!==l&&s.addLevel(l,p.distance)}return s}}()}),a.TextureLoader=function(t){this.manager=void 0!==t?t:a.DefaultLoadingManager},Object.assign(a.TextureLoader.prototype,{load:function(t,e,n,r){var i=new a.Texture,o=new a.ImageLoader(this.manager);return o.setCrossOrigin(this.crossOrigin),o.setPath(this.path),o.load(t,function(t){i.image=t,i.needsUpdate=!0,void 0!==e&&e(i)},n,r),i},setCrossOrigin:function(t){return this.crossOrigin=t,this},setPath:function(t){return this.path=t,this}}),a.CubeTextureLoader=function(t){this.manager=void 0!==t?t:a.DefaultLoadingManager},Object.assign(a.CubeTextureLoader.prototype,{load:function(t,e,n,r){function i(n){s.load(t[n],function(t){o.images[n]=t,c++,6===c&&(o.needsUpdate=!0,e&&e(o))},void 0,r)}var o=new a.CubeTexture,s=new a.ImageLoader(this.manager);s.setCrossOrigin(this.crossOrigin),s.setPath(this.path);for(var c=0,u=0;u<t.length;++u)i(u);return o},setCrossOrigin:function(t){return this.crossOrigin=t,this},setPath:function(t){return this.path=t,this}}),a.DataTextureLoader=a.BinaryTextureLoader=function(t){this.manager=void 0!==t?t:a.DefaultLoadingManager,this._parser=null},Object.assign(a.BinaryTextureLoader.prototype,{load:function(t,e,n,r){var i=this,o=new a.DataTexture,s=new a.XHRLoader(this.manager);return s.setResponseType("arraybuffer"),s.load(t,function(t){var n=i._parser(t);n&&(void 0!==n.image?o.image=n.image:void 0!==n.data&&(o.image.width=n.width,o.image.height=n.height,o.image.data=n.data),o.wrapS=void 0!==n.wrapS?n.wrapS:a.ClampToEdgeWrapping,o.wrapT=void 0!==n.wrapT?n.wrapT:a.ClampToEdgeWrapping,o.magFilter=void 0!==n.magFilter?n.magFilter:a.LinearFilter,o.minFilter=void 0!==n.minFilter?n.minFilter:a.LinearMipMapLinearFilter,o.anisotropy=void 0!==n.anisotropy?n.anisotropy:1,void 0!==n.format&&(o.format=n.format),void 0!==n.type&&(o.type=n.type),void 0!==n.mipmaps&&(o.mipmaps=n.mipmaps),1===n.mipmapCount&&(o.minFilter=a.LinearFilter),o.needsUpdate=!0,e&&e(o,n))},n,r),o}}),a.CompressedTextureLoader=function(t){this.manager=void 0!==t?t:a.DefaultLoadingManager,this._parser=null},Object.assign(a.CompressedTextureLoader.prototype,{load:function(t,e,n,r){function i(i){u.load(t[i],function(t){var n=o._parser(t,!0);s[i]={width:n.width,height:n.height,format:n.format,mipmaps:n.mipmaps},l+=1,6===l&&(1===n.mipmapCount&&(c.minFilter=a.LinearFilter),c.format=n.format,c.needsUpdate=!0,e&&e(c))},n,r)}var o=this,s=[],c=new a.CompressedTexture;c.image=s;var u=new a.XHRLoader(this.manager);if(u.setPath(this.path),u.setResponseType("arraybuffer"),Array.isArray(t))for(var l=0,h=0,f=t.length;h<f;++h)i(h);else u.load(t,function(t){var n=o._parser(t,!0);if(n.isCubemap)for(var r=n.mipmaps.length/n.mipmapCount,i=0;i<r;i++){s[i]={mipmaps:[]};for(var u=0;u<n.mipmapCount;u++)s[i].mipmaps.push(n.mipmaps[i*n.mipmapCount+u]),s[i].format=n.format,s[i].width=n.width,s[i].height=n.height}else c.image.width=n.width,c.image.height=n.height,c.mipmaps=n.mipmaps;1===n.mipmapCount&&(c.minFilter=a.LinearFilter),c.format=n.format,c.needsUpdate=!0,e&&e(c)},n,r);return c},setPath:function(t){return this.path=t,this}}),a.Material=function(){Object.defineProperty(this,"id",{value:a.MaterialIdCount++}),this.uuid=a.Math.generateUUID(),this.name="",this.type="Material",this.fog=!0,this.lights=!0,this.blending=a.NormalBlending,this.side=a.FrontSide,this.shading=a.SmoothShading,this.vertexColors=a.NoColors,this.opacity=1,this.transparent=!1,this.blendSrc=a.SrcAlphaFactor,this.blendDst=a.OneMinusSrcAlphaFactor,this.blendEquation=a.AddEquation,this.blendSrcAlpha=null,this.blendDstAlpha=null,this.blendEquationAlpha=null,this.depthFunc=a.LessEqualDepth,this.depthTest=!0,this.depthWrite=!0,this.clippingPlanes=null,this.clipShadows=!1,this.colorWrite=!0,this.precision=null,this.polygonOffset=!1,this.polygonOffsetFactor=0,this.polygonOffsetUnits=0,this.alphaTest=0,this.premultipliedAlpha=!1,this.overdraw=0,this.visible=!0,this._needsUpdate=!0},a.Material.prototype={constructor:a.Material,get needsUpdate(){return this._needsUpdate},set needsUpdate(t){t===!0&&this.update(),this._needsUpdate=t},setValues:function(t){if(void 0!==t)for(var e in t){var n=t[e];if(void 0!==n){var r=this[e];void 0!==r?r instanceof a.Color?r.set(n):r instanceof a.Vector3&&n instanceof a.Vector3?r.copy(n):"overdraw"===e?this[e]=Number(n):this[e]=n:console.warn("THREE."+this.type+": '"+e+"' is not a property of this material.")}else console.warn("THREE.Material: '"+e+"' parameter is undefined.")}},toJSON:function(t){function e(t){var e=[];for(var n in t){var r=t[n];delete r.metadata,e.push(r)}return e}var n=void 0===t;n&&(t={textures:{},images:{}});var r={metadata:{version:4.4,type:"Material",generator:"Material.toJSON"}};if(r.uuid=this.uuid,r.type=this.type,""!==this.name&&(r.name=this.name),this.color instanceof a.Color&&(r.color=this.color.getHex()),void 0!==this.roughness&&(r.roughness=this.roughness),void 0!==this.metalness&&(r.metalness=this.metalness),this.emissive instanceof a.Color&&(r.emissive=this.emissive.getHex()),this.specular instanceof a.Color&&(r.specular=this.specular.getHex()),void 0!==this.shininess&&(r.shininess=this.shininess),this.map instanceof a.Texture&&(r.map=this.map.toJSON(t).uuid),this.alphaMap instanceof a.Texture&&(r.alphaMap=this.alphaMap.toJSON(t).uuid),this.lightMap instanceof a.Texture&&(r.lightMap=this.lightMap.toJSON(t).uuid),this.bumpMap instanceof a.Texture&&(r.bumpMap=this.bumpMap.toJSON(t).uuid,r.bumpScale=this.bumpScale),this.normalMap instanceof a.Texture&&(r.normalMap=this.normalMap.toJSON(t).uuid,r.normalScale=this.normalScale.toArray()),this.displacementMap instanceof a.Texture&&(r.displacementMap=this.displacementMap.toJSON(t).uuid,r.displacementScale=this.displacementScale,r.displacementBias=this.displacementBias),this.roughnessMap instanceof a.Texture&&(r.roughnessMap=this.roughnessMap.toJSON(t).uuid),this.metalnessMap instanceof a.Texture&&(r.metalnessMap=this.metalnessMap.toJSON(t).uuid),this.emissiveMap instanceof a.Texture&&(r.emissiveMap=this.emissiveMap.toJSON(t).uuid),this.specularMap instanceof a.Texture&&(r.specularMap=this.specularMap.toJSON(t).uuid),this.envMap instanceof a.Texture&&(r.envMap=this.envMap.toJSON(t).uuid,r.reflectivity=this.reflectivity),void 0!==this.size&&(r.size=this.size),void 0!==this.sizeAttenuation&&(r.sizeAttenuation=this.sizeAttenuation),this.blending!==a.NormalBlending&&(r.blending=this.blending),this.shading!==a.SmoothShading&&(r.shading=this.shading),this.side!==a.FrontSide&&(r.side=this.side),this.vertexColors!==a.NoColors&&(r.vertexColors=this.vertexColors),this.opacity<1&&(r.opacity=this.opacity),this.transparent===!0&&(r.transparent=this.transparent),this.alphaTest>0&&(r.alphaTest=this.alphaTest),this.premultipliedAlpha===!0&&(r.premultipliedAlpha=this.premultipliedAlpha),this.wireframe===!0&&(r.wireframe=this.wireframe),this.wireframeLinewidth>1&&(r.wireframeLinewidth=this.wireframeLinewidth),n){var i=e(t.textures),o=e(t.images);i.length>0&&(r.textures=i),o.length>0&&(r.images=o)}return r},clone:function(){return(new this.constructor).copy(this)},copy:function(t){this.name=t.name,this.fog=t.fog,this.lights=t.lights,this.blending=t.blending,this.side=t.side,this.shading=t.shading,this.vertexColors=t.vertexColors,this.opacity=t.opacity,this.transparent=t.transparent,this.blendSrc=t.blendSrc,this.blendDst=t.blendDst,this.blendEquation=t.blendEquation,this.blendSrcAlpha=t.blendSrcAlpha,this.blendDstAlpha=t.blendDstAlpha,this.blendEquationAlpha=t.blendEquationAlpha,this.depthFunc=t.depthFunc,this.depthTest=t.depthTest,this.depthWrite=t.depthWrite,this.colorWrite=t.colorWrite,this.precision=t.precision,this.polygonOffset=t.polygonOffset,this.polygonOffsetFactor=t.polygonOffsetFactor,this.polygonOffsetUnits=t.polygonOffsetUnits,this.alphaTest=t.alphaTest,this.premultipliedAlpha=t.premultipliedAlpha,this.overdraw=t.overdraw,this.visible=t.visible,this.clipShadows=t.clipShadows;var e=t.clippingPlanes,n=null;if(null!==e){var r=e.length;n=new Array(r);for(var i=0;i!==r;++i)n[i]=e[i].clone()}return this.clippingPlanes=n,this},update:function(){this.dispatchEvent({type:"update"})},dispose:function(){this.dispatchEvent({type:"dispose"})}},Object.assign(a.Material.prototype,a.EventDispatcher.prototype),a.MaterialIdCount=0,a.LineBasicMaterial=function(t){a.Material.call(this),this.type="LineBasicMaterial",this.color=new a.Color(16777215),this.linewidth=1,this.linecap="round",this.linejoin="round",this.lights=!1,this.setValues(t)},a.LineBasicMaterial.prototype=Object.create(a.Material.prototype),a.LineBasicMaterial.prototype.constructor=a.LineBasicMaterial,a.LineBasicMaterial.prototype.copy=function(t){return a.Material.prototype.copy.call(this,t),this.color.copy(t.color),this.linewidth=t.linewidth,this.linecap=t.linecap,this.linejoin=t.linejoin,this},a.LineDashedMaterial=function(t){a.Material.call(this),this.type="LineDashedMaterial",this.color=new a.Color(16777215),this.linewidth=1,this.scale=1,this.dashSize=3,this.gapSize=1,this.lights=!1,this.setValues(t)},a.LineDashedMaterial.prototype=Object.create(a.Material.prototype),a.LineDashedMaterial.prototype.constructor=a.LineDashedMaterial,a.LineDashedMaterial.prototype.copy=function(t){return a.Material.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},a.MeshBasicMaterial=function(t){a.Material.call(this),this.type="MeshBasicMaterial",this.color=new a.Color(16777215),this.map=null,this.aoMap=null,this.aoMapIntensity=1,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.combine=a.MultiplyOperation,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)},a.MeshBasicMaterial.prototype=Object.create(a.Material.prototype),a.MeshBasicMaterial.prototype.constructor=a.MeshBasicMaterial,a.MeshBasicMaterial.prototype.copy=function(t){return a.Material.prototype.copy.call(this,t),this.color.copy(t.color),this.map=t.map,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},a.MeshDepthMaterial=function(t){a.Material.call(this),this.type="MeshDepthMaterial",this.depthPacking=a.BasicDepthPacking,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)},a.MeshDepthMaterial.prototype=Object.create(a.Material.prototype),a.MeshDepthMaterial.prototype.constructor=a.MeshDepthMaterial,a.MeshDepthMaterial.prototype.copy=function(t){return a.Material.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},a.MeshLambertMaterial=function(t){a.Material.call(this),this.type="MeshLambertMaterial",this.color=new a.Color(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new a.Color(0),this.emissiveIntensity=1,this.emissiveMap=null,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.combine=a.MultiplyOperation,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)},a.MeshLambertMaterial.prototype=Object.create(a.Material.prototype),a.MeshLambertMaterial.prototype.constructor=a.MeshLambertMaterial,a.MeshLambertMaterial.prototype.copy=function(t){return a.Material.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},a.MeshNormalMaterial=function(t){a.Material.call(this,t),this.type="MeshNormalMaterial",this.wireframe=!1,this.wireframeLinewidth=1,this.fog=!1,this.lights=!1,this.morphTargets=!1,this.setValues(t)},a.MeshNormalMaterial.prototype=Object.create(a.Material.prototype),a.MeshNormalMaterial.prototype.constructor=a.MeshNormalMaterial,a.MeshNormalMaterial.prototype.copy=function(t){return a.Material.prototype.copy.call(this,t),this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this},a.MeshPhongMaterial=function(t){a.Material.call(this),this.type="MeshPhongMaterial",this.color=new a.Color(16777215),this.specular=new a.Color(1118481),this.shininess=30,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new a.Color(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalScale=new a.Vector2(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.combine=a.MultiplyOperation,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)},a.MeshPhongMaterial.prototype=Object.create(a.Material.prototype),a.MeshPhongMaterial.prototype.constructor=a.MeshPhongMaterial,a.MeshPhongMaterial.prototype.copy=function(t){return a.Material.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},a.MeshStandardMaterial=function(t){a.Material.call(this),this.defines={STANDARD:""},this.type="MeshStandardMaterial",this.color=new a.Color(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 a.Color(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalScale=new a.Vector2(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)},a.MeshStandardMaterial.prototype=Object.create(a.Material.prototype),a.MeshStandardMaterial.prototype.constructor=a.MeshStandardMaterial,a.MeshStandardMaterial.prototype.copy=function(t){return a.Material.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},a.MeshPhysicalMaterial=function(t){a.MeshStandardMaterial.call(this),this.defines={PHYSICAL:""},this.type="MeshPhysicalMaterial",this.reflectivity=.5,this.clearCoat=0,this.clearCoatRoughness=0,this.setValues(t)},a.MeshPhysicalMaterial.prototype=Object.create(a.MeshStandardMaterial.prototype),a.MeshPhysicalMaterial.prototype.constructor=a.MeshPhysicalMaterial,a.MeshPhysicalMaterial.prototype.copy=function(t){return a.MeshStandardMaterial.prototype.copy.call(this,t),this.defines={PHYSICAL:""},this.reflectivity=t.reflectivity,this.clearCoat=t.clearCoat,this.clearCoatRoughness=t.clearCoatRoughness,this},a.MultiMaterial=function(t){this.uuid=a.Math.generateUUID(),this.type="MultiMaterial",this.materials=t instanceof Array?t:[],this.visible=!0},a.MultiMaterial.prototype={constructor:a.MultiMaterial,toJSON:function(t){for(var e={metadata:{version:4.2,type:"material",generator:"MaterialExporter"},uuid:this.uuid,type:this.type,materials:[]},n=this.materials,r=0,i=n.length;r<i;r++){var a=n[r].toJSON(t);delete a.metadata,e.materials.push(a)}return e.visible=this.visible,e},clone:function(){for(var t=new this.constructor,e=0;e<this.materials.length;e++)t.materials.push(this.materials[e].clone());return t.visible=this.visible,t}},a.PointsMaterial=function(t){a.Material.call(this),this.type="PointsMaterial",this.color=new a.Color(16777215),this.map=null,this.size=1,this.sizeAttenuation=!0,this.lights=!1,this.setValues(t)},a.PointsMaterial.prototype=Object.create(a.Material.prototype),a.PointsMaterial.prototype.constructor=a.PointsMaterial,a.PointsMaterial.prototype.copy=function(t){return a.Material.prototype.copy.call(this,t),this.color.copy(t.color),this.map=t.map,this.size=t.size,this.sizeAttenuation=t.sizeAttenuation,this},a.ShaderMaterial=function(t){a.Material.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))},a.ShaderMaterial.prototype=Object.create(a.Material.prototype),a.ShaderMaterial.prototype.constructor=a.ShaderMaterial,a.ShaderMaterial.prototype.copy=function(t){return a.Material.prototype.copy.call(this,t),this.fragmentShader=t.fragmentShader,this.vertexShader=t.vertexShader,this.uniforms=a.UniformsUtils.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},a.ShaderMaterial.prototype.toJSON=function(t){var e=a.Material.prototype.toJSON.call(this,t);return e.uniforms=this.uniforms,e.vertexShader=this.vertexShader,e.fragmentShader=this.fragmentShader,e},a.RawShaderMaterial=function(t){a.ShaderMaterial.call(this,t),this.type="RawShaderMaterial"},a.RawShaderMaterial.prototype=Object.create(a.ShaderMaterial.prototype),a.RawShaderMaterial.prototype.constructor=a.RawShaderMaterial,a.SpriteMaterial=function(t){a.Material.call(this),this.type="SpriteMaterial",this.color=new a.Color(16777215),this.map=null,this.rotation=0,this.fog=!1,this.lights=!1,this.setValues(t)},a.SpriteMaterial.prototype=Object.create(a.Material.prototype),a.SpriteMaterial.prototype.constructor=a.SpriteMaterial,a.SpriteMaterial.prototype.copy=function(t){return a.Material.prototype.copy.call(this,t),this.color.copy(t.color),this.map=t.map,this.rotation=t.rotation,this},a.ShadowMaterial=function(){a.ShaderMaterial.call(this,{uniforms:a.UniformsUtils.merge([a.UniformsLib.lights,{opacity:{value:1}}]),vertexShader:a.ShaderChunk.shadow_vert,fragmentShader:a.ShaderChunk.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}}})},a.ShadowMaterial.prototype=Object.create(a.ShaderMaterial.prototype),a.ShadowMaterial.prototype.constructor=a.ShadowMaterial,a.Texture=function(t,e,n,r,i,o,s,c,u,l){Object.defineProperty(this,"id",{value:a.TextureIdCount++}),this.uuid=a.Math.generateUUID(),this.name="",this.sourceFile="",this.image=void 0!==t?t:a.Texture.DEFAULT_IMAGE,this.mipmaps=[],this.mapping=void 0!==e?e:a.Texture.DEFAULT_MAPPING,this.wrapS=void 0!==n?n:a.ClampToEdgeWrapping,this.wrapT=void 0!==r?r:a.ClampToEdgeWrapping,this.magFilter=void 0!==i?i:a.LinearFilter,this.minFilter=void 0!==o?o:a.LinearMipMapLinearFilter,this.anisotropy=void 0!==u?u:1,this.format=void 0!==s?s:a.RGBAFormat,this.type=void 0!==c?c:a.UnsignedByteType,this.offset=new a.Vector2(0,0),this.repeat=new a.Vector2(1,1),this.generateMipmaps=!0,this.premultiplyAlpha=!1,this.flipY=!0,this.unpackAlignment=4,this.encoding=void 0!==l?l:a.LinearEncoding,this.version=0,this.onUpdate=null},a.Texture.DEFAULT_IMAGE=void 0,a.Texture.DEFAULT_MAPPING=a.UVMapping,a.Texture.prototype={constructor:a.Texture,set needsUpdate(t){t===!0&&this.version++},clone:function(){return(new this.constructor).copy(this)},copy:function(t){return this.image=t.image,this.mipmaps=t.mipmaps.slice(0),this.mapping=t.mapping,this.wrapS=t.wrapS,this.wrapT=t.wrapT,this.magFilter=t.magFilter,this.minFilter=t.minFilter,this.anisotropy=t.anisotropy,this.format=t.format,this.type=t.type,this.offset.copy(t.offset),this.repeat.copy(t.repeat),this.generateMipmaps=t.generateMipmaps,this.premultiplyAlpha=t.premultiplyAlpha,this.flipY=t.flipY,this.unpackAlignment=t.unpackAlignment,this.encoding=t.encoding,this},toJSON:function(t){function e(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")}if(void 0!==t.textures[this.uuid])return t.textures[this.uuid];var n={metadata:{version:4.4,type:"Texture",generator:"Texture.toJSON"},uuid:this.uuid,name:this.name,mapping:this.mapping,repeat:[this.repeat.x,this.repeat.y],offset:[this.offset.x,this.offset.y],wrap:[this.wrapS,this.wrapT],minFilter:this.minFilter,magFilter:this.magFilter,anisotropy:this.anisotropy};if(void 0!==this.image){var r=this.image;void 0===r.uuid&&(r.uuid=a.Math.generateUUID()),void 0===t.images[r.uuid]&&(t.images[r.uuid]={uuid:r.uuid,url:e(r)}),n.image=r.uuid}return t.textures[this.uuid]=n,n},dispose:function(){this.dispatchEvent({type:"dispose"})},transformUv:function(t){if(this.mapping===a.UVMapping){if(t.multiply(this.repeat),t.add(this.offset),t.x<0||t.x>1)switch(this.wrapS){case a.RepeatWrapping:t.x=t.x-Math.floor(t.x);break;case a.ClampToEdgeWrapping:t.x=t.x<0?0:1;break;case a.MirroredRepeatWrapping: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 a.RepeatWrapping:t.y=t.y-Math.floor(t.y);break;case a.ClampToEdgeWrapping:t.y=t.y<0?0:1;break;case a.MirroredRepeatWrapping: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(a.Texture.prototype,a.EventDispatcher.prototype),a.TextureIdCount=0,a.DepthTexture=function(t,e,n,r,i,o,s,c,u){a.Texture.call(this,null,r,i,o,s,c,a.DepthFormat,n,u),this.image={width:t,height:e},this.type=void 0!==n?n:a.UnsignedShortType,this.magFilter=void 0!==s?s:a.NearestFilter,this.minFilter=void 0!==c?c:a.NearestFilter,this.flipY=!1,this.generateMipmaps=!1},a.DepthTexture.prototype=Object.create(a.Texture.prototype),a.DepthTexture.prototype.constructor=a.DepthTexture,a.CanvasTexture=function(t,e,n,r,i,o,s,c,u){a.Texture.call(this,t,e,n,r,i,o,s,c,u),this.needsUpdate=!0},a.CanvasTexture.prototype=Object.create(a.Texture.prototype),a.CanvasTexture.prototype.constructor=a.CanvasTexture,a.CubeTexture=function(t,e,n,r,i,o,s,c,u,l){t=void 0!==t?t:[],e=void 0!==e?e:a.CubeReflectionMapping,a.Texture.call(this,t,e,n,r,i,o,s,c,u,l),this.flipY=!1},a.CubeTexture.prototype=Object.create(a.Texture.prototype),a.CubeTexture.prototype.constructor=a.CubeTexture,Object.defineProperty(a.CubeTexture.prototype,"images",{get:function(){return this.image},set:function(t){this.image=t}}),a.CompressedTexture=function(t,e,n,r,i,o,s,c,u,l,h,f){a.Texture.call(this,null,o,s,c,u,l,r,i,h,f),this.image={width:e,height:n},this.mipmaps=t,this.flipY=!1,this.generateMipmaps=!1},a.CompressedTexture.prototype=Object.create(a.Texture.prototype),a.CompressedTexture.prototype.constructor=a.CompressedTexture,a.DataTexture=function(t,e,n,r,i,o,s,c,u,l,h,f){a.Texture.call(this,null,o,s,c,u,l,r,i,h,f),this.image={data:t,width:e,height:n},this.magFilter=void 0!==u?u:a.NearestFilter,this.minFilter=void 0!==l?l:a.NearestFilter,this.flipY=!1,this.generateMipmaps=!1},a.DataTexture.prototype=Object.create(a.Texture.prototype),a.DataTexture.prototype.constructor=a.DataTexture,a.VideoTexture=function(t,e,n,r,i,o,s,c,u){function l(){requestAnimationFrame(l),t.readyState>=t.HAVE_CURRENT_DATA&&(h.needsUpdate=!0)}a.Texture.call(this,t,e,n,r,i,o,s,c,u),this.generateMipmaps=!1;var h=this;l()},a.VideoTexture.prototype=Object.create(a.Texture.prototype),a.VideoTexture.prototype.constructor=a.VideoTexture,a.Group=function(){a.Object3D.call(this),this.type="Group"},a.Group.prototype=Object.assign(Object.create(a.Object3D.prototype),{constructor:a.Group}),a.Points=function(t,e){a.Object3D.call(this),this.type="Points",this.geometry=void 0!==t?t:new a.BufferGeometry,this.material=void 0!==e?e:new a.PointsMaterial({color:16777215*Math.random()})},a.Points.prototype=Object.assign(Object.create(a.Object3D.prototype),{constructor:a.Points,raycast:function(){var t=new a.Matrix4,e=new a.Ray,n=new a.Sphere;return function(r,i){function o(t,n){var a=e.distanceSqToPoint(t);if(a<f){var o=e.closestPointToPoint(t);o.applyMatrix4(u);var c=r.ray.origin.distanceTo(o);if(c<r.near||c>r.far)return;i.push({distance:c,distanceToRay:Math.sqrt(a),point:o.clone(),index:n,face:null,object:s})}}var s=this,c=this.geometry,u=this.matrixWorld,l=r.params.Points.threshold;if(null===c.boundingSphere&&c.computeBoundingSphere(),n.copy(c.boundingSphere),n.applyMatrix4(u),r.ray.intersectsSphere(n)!==!1){t.getInverse(u),e.copy(r.ray).applyMatrix4(t);var h=l/((this.scale.x+this.scale.y+this.scale.z)/3),f=h*h,p=new a.Vector3;if(c instanceof a.BufferGeometry){var d=c.index,m=c.attributes,g=m.position.array;if(null!==d)for(var v=d.array,y=0,x=v.length;y<x;y++){var b=v[y];p.fromArray(g,3*b),o(p,b)}else for(var y=0,M=g.length/3;y<M;y++)p.fromArray(g,3*y),o(p,y)}else for(var _=c.vertices,y=0,M=_.length;y<M;y++)o(_[y],y)}}}(),clone:function(){return new this.constructor(this.geometry,this.material).copy(this)}}),a.Line=function(t,e,n){return 1===n?(console.warn("THREE.Line: parameter THREE.LinePieces no longer supported. Created THREE.LineSegments instead."),new a.LineSegments(t,e)):(a.Object3D.call(this),this.type="Line",this.geometry=void 0!==t?t:new a.BufferGeometry,void(this.material=void 0!==e?e:new a.LineBasicMaterial({color:16777215*Math.random()})))},a.Line.prototype=Object.assign(Object.create(a.Object3D.prototype),{constructor:a.Line,raycast:function(){var t=new a.Matrix4,e=new a.Ray,n=new a.Sphere;return function(r,i){var o=r.linePrecision,s=o*o,c=this.geometry,u=this.matrixWorld;if(null===c.boundingSphere&&c.computeBoundingSphere(),n.copy(c.boundingSphere),n.applyMatrix4(u),r.ray.intersectsSphere(n)!==!1){t.getInverse(u),e.copy(r.ray).applyMatrix4(t);var l=new a.Vector3,h=new a.Vector3,f=new a.Vector3,p=new a.Vector3,d=this instanceof a.LineSegments?2:1;if(c instanceof a.BufferGeometry){var m=c.index,g=c.attributes,v=g.position.array;if(null!==m)for(var y=m.array,x=0,b=y.length-1;x<b;x+=d){var M=y[x],_=y[x+1];l.fromArray(v,3*M),h.fromArray(v,3*_);var w=e.distanceSqToSegment(l,h,p,f);if(!(w>s)){p.applyMatrix4(this.matrixWorld);var S=r.ray.origin.distanceTo(p);S<r.near||S>r.far||i.push({distance:S,point:f.clone().applyMatrix4(this.matrixWorld),index:x,face:null,faceIndex:null,object:this})}}else for(var x=0,b=v.length/3-1;x<b;x+=d){l.fromArray(v,3*x),h.fromArray(v,3*x+3);var w=e.distanceSqToSegment(l,h,p,f);if(!(w>s)){p.applyMatrix4(this.matrixWorld);var S=r.ray.origin.distanceTo(p);S<r.near||S>r.far||i.push({distance:S,point:f.clone().applyMatrix4(this.matrixWorld),index:x,face:null,faceIndex:null,object:this})}}}else if(c instanceof a.Geometry)for(var E=c.vertices,T=E.length,x=0;x<T-1;x+=d){var w=e.distanceSqToSegment(E[x],E[x+1],p,f);if(!(w>s)){p.applyMatrix4(this.matrixWorld);var S=r.ray.origin.distanceTo(p);S<r.near||S>r.far||i.push({distance:S,point:f.clone().applyMatrix4(this.matrixWorld),index:x,face:null,faceIndex:null,object:this})}}}}}(),clone:function(){return new this.constructor(this.geometry,this.material).copy(this)}}),a.LineSegments=function(t,e){a.Line.call(this,t,e),this.type="LineSegments"},a.LineSegments.prototype=Object.assign(Object.create(a.Line.prototype),{constructor:a.LineSegments}),a.Mesh=function(t,e){a.Object3D.call(this),this.type="Mesh",this.geometry=void 0!==t?t:new a.BufferGeometry,this.material=void 0!==e?e:new a.MeshBasicMaterial({color:16777215*Math.random()}),this.drawMode=a.TrianglesDrawMode,this.updateMorphTargets()},a.Mesh.prototype=Object.assign(Object.create(a.Object3D.prototype),{constructor:a.Mesh,setDrawMode:function(t){this.drawMode=t},copy:function(t){return a.Object3D.prototype.copy.call(this,t),this.drawMode=t.drawMode,this},updateMorphTargets:function(){if(void 0!==this.geometry.morphTargets&&this.geometry.morphTargets.length>0){this.morphTargetBase=-1,this.morphTargetInfluences=[],this.morphTargetDictionary={};for(var t=0,e=this.geometry.morphTargets.length;t<e;t++)this.morphTargetInfluences.push(0),this.morphTargetDictionary[this.geometry.morphTargets[t].name]=t}},getMorphTargetIndexByName:function(t){return void 0!==this.morphTargetDictionary[t]?this.morphTargetDictionary[t]:(console.warn("THREE.Mesh.getMorphTargetIndexByName: morph target "+t+" does not exist. Returning 0."),0)},raycast:function(){function t(t,e,n,r,i,o,s){return a.Triangle.barycoordFromPoint(t,e,n,r,g),i.multiplyScalar(g.x),o.multiplyScalar(g.y),s.multiplyScalar(g.z),i.add(o).add(s),i.clone()}function e(t,e,n,r,i,o,s){var c,u=t.material;if(c=u.side===a.BackSide?n.intersectTriangle(o,i,r,!0,s):n.intersectTriangle(r,i,o,u.side!==a.DoubleSide,s),null===c)return null;y.copy(s),y.applyMatrix4(t.matrixWorld);var l=e.ray.origin.distanceTo(y);return l<e.near||l>e.far?null:{distance:l,point:y.clone(),object:t}}function n(n,r,i,o,l,h,f,g){s.fromArray(o,3*h),c.fromArray(o,3*f),u.fromArray(o,3*g);var y=e(n,r,i,s,c,u,v);return y&&(l&&(p.fromArray(l,2*h),d.fromArray(l,2*f),m.fromArray(l,2*g),y.uv=t(v,s,c,u,p,d,m)),y.face=new a.Face3(h,f,g,a.Triangle.normal(s,c,u)),y.faceIndex=h),y}var r=new a.Matrix4,i=new a.Ray,o=new a.Sphere,s=new a.Vector3,c=new a.Vector3,u=new a.Vector3,l=new a.Vector3,h=new a.Vector3,f=new a.Vector3,p=new a.Vector2,d=new a.Vector2,m=new a.Vector2,g=new a.Vector3,v=new a.Vector3,y=new a.Vector3;return function(g,y){var x=this.geometry,b=this.material,M=this.matrixWorld;if(void 0!==b&&(null===x.boundingSphere&&x.computeBoundingSphere(),o.copy(x.boundingSphere),o.applyMatrix4(M),g.ray.intersectsSphere(o)!==!1&&(r.getInverse(M),i.copy(g.ray).applyMatrix4(r),null===x.boundingBox||i.intersectsBox(x.boundingBox)!==!1))){var _,w;if(x instanceof a.BufferGeometry){var S,E,T,A=x.index,L=x.attributes,C=L.position.array;if(void 0!==L.uv&&(_=L.uv.array),null!==A)for(var R=A.array,P=0,D=R.length;P<D;P+=3)S=R[P],E=R[P+1],T=R[P+2],w=n(this,g,i,C,_,S,E,T),w&&(w.faceIndex=Math.floor(P/3),y.push(w));else for(var P=0,D=C.length;P<D;P+=9)S=P/3,E=S+1,T=S+2,w=n(this,g,i,C,_,S,E,T),w&&(w.index=S,y.push(w))}else if(x instanceof a.Geometry){var N,U,B,I=b instanceof a.MultiMaterial,O=I===!0?b.materials:null,F=x.vertices,V=x.faces,G=x.faceVertexUvs[0];G.length>0&&(_=G);for(var k=0,z=V.length;k<z;k++){var H=V[k],j=I===!0?O[H.materialIndex]:b;if(void 0!==j){if(N=F[H.a],U=F[H.b],B=F[H.c],j.morphTargets===!0){var W=x.morphTargets,X=this.morphTargetInfluences;s.set(0,0,0),c.set(0,0,0),u.set(0,0,0);for(var q=0,Y=W.length;q<Y;q++){var Z=X[q];if(0!==Z){var K=W[q].vertices;s.addScaledVector(l.subVectors(K[H.a],N),Z),c.addScaledVector(h.subVectors(K[H.b],U),Z),u.addScaledVector(f.subVectors(K[H.c],B),Z)}}s.add(N),c.add(U),u.add(B),N=s,U=c,B=u}if(w=e(this,g,i,N,U,B,v)){if(_){var Q=_[k];p.copy(Q[0]),d.copy(Q[1]),m.copy(Q[2]),w.uv=t(v,N,U,B,p,d,m)}w.face=H,w.faceIndex=k,y.push(w)}}}}}}}(),clone:function(){return new this.constructor(this.geometry,this.material).copy(this)}}),a.Bone=function(t){a.Object3D.call(this),this.type="Bone",this.skin=t},a.Bone.prototype=Object.assign(Object.create(a.Object3D.prototype),{constructor:a.Bone,copy:function(t){return a.Object3D.prototype.copy.call(this,t),this.skin=t.skin,this}}),a.Skeleton=function(t,e,n){if(this.useVertexTexture=void 0===n||n,this.identityMatrix=new a.Matrix4,t=t||[],this.bones=t.slice(0),this.useVertexTexture){var r=Math.sqrt(4*this.bones.length);r=a.Math.nextPowerOfTwo(Math.ceil(r)),r=Math.max(r,4),this.boneTextureWidth=r,this.boneTextureHeight=r,this.boneMatrices=new Float32Array(this.boneTextureWidth*this.boneTextureHeight*4),this.boneTexture=new a.DataTexture(this.boneMatrices,this.boneTextureWidth,this.boneTextureHeight,a.RGBAFormat,a.FloatType)}else this.boneMatrices=new Float32Array(16*this.bones.length);if(void 0===e)this.calculateInverses();else if(this.bones.length===e.length)this.boneInverses=e.slice(0);else{console.warn("THREE.Skeleton bonInverses is the wrong length."),this.boneInverses=[];for(var i=0,o=this.bones.length;i<o;i++)this.boneInverses.push(new a.Matrix4)}},Object.assign(a.Skeleton.prototype,{calculateInverses:function(){this.boneInverses=[];for(var t=0,e=this.bones.length;t<e;t++){var n=new a.Matrix4;this.bones[t]&&n.getInverse(this.bones[t].matrixWorld),this.boneInverses.push(n)}},pose:function(){for(var t,e=0,n=this.bones.length;e<n;e++)t=this.bones[e],t&&t.matrixWorld.getInverse(this.boneInverses[e]);for(var e=0,n=this.bones.length;e<n;e++)t=this.bones[e],t&&(t.parent instanceof a.Bone?(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 a.Matrix4;return function(){for(var e=0,n=this.bones.length;e<n;e++){var r=this.bones[e]?this.bones[e].matrixWorld:this.identityMatrix;t.multiplyMatrices(r,this.boneInverses[e]),t.toArray(this.boneMatrices,16*e)}this.useVertexTexture&&(this.boneTexture.needsUpdate=!0)}}(),clone:function(){return new a.Skeleton(this.bones,this.boneInverses,this.useVertexTexture)}}),a.SkinnedMesh=function(t,e,n){a.Mesh.call(this,t,e),this.type="SkinnedMesh",this.bindMode="attached",this.bindMatrix=new a.Matrix4,this.bindMatrixInverse=new a.Matrix4;var r=[];if(this.geometry&&void 0!==this.geometry.bones){for(var i,o,s=0,c=this.geometry.bones.length;s<c;++s)o=this.geometry.bones[s],i=new a.Bone(this),r.push(i),i.name=o.name,i.position.fromArray(o.pos),i.quaternion.fromArray(o.rotq),void 0!==o.scl&&i.scale.fromArray(o.scl);for(var s=0,c=this.geometry.bones.length;s<c;++s)o=this.geometry.bones[s],o.parent!==-1&&null!==o.parent&&void 0!==r[o.parent]?r[o.parent].add(r[s]):this.add(r[s])}this.normalizeSkinWeights(),this.updateMatrixWorld(!0),this.bind(new a.Skeleton(r,(void 0),n),this.matrixWorld)},a.SkinnedMesh.prototype=Object.assign(Object.create(a.Mesh.prototype),{constructor:a.SkinnedMesh,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(){if(this.geometry instanceof a.Geometry)for(var t=0;t<this.geometry.skinWeights.length;t++){var e=this.geometry.skinWeights[t],n=1/e.lengthManhattan();n!==1/0?e.multiplyScalar(n):e.set(1,0,0,0)}else if(this.geometry instanceof a.BufferGeometry)for(var r=new a.Vector4,i=this.geometry.attributes.skinWeight,t=0;t<i.count;t++){r.x=i.getX(t),r.y=i.getY(t),r.z=i.getZ(t),r.w=i.getW(t);var n=1/r.lengthManhattan();n!==1/0?r.multiplyScalar(n):r.set(1,0,0,0),i.setXYZW(t,r.x,r.y,r.z,r.w)}},updateMatrixWorld:function(t){a.Mesh.prototype.updateMatrixWorld.call(this,!0),"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,this.skeleton.useVertexTexture).copy(this)}}),a.LOD=function(){a.Object3D.call(this),this.type="LOD",Object.defineProperties(this,{levels:{enumerable:!0,value:[]}})},a.LOD.prototype=Object.assign(Object.create(a.Object3D.prototype),{constructor:a.LOD,copy:function(t){a.Object3D.prototype.copy.call(this,t,!1);for(var e=t.levels,n=0,r=e.length;n<r;n++){var i=e[n];this.addLevel(i.object.clone(),i.distance)}return this},addLevel:function(t,e){void 0===e&&(e=0),e=Math.abs(e);for(var n=this.levels,r=0;r<n.length&&!(e<n[r].distance);r++);n.splice(r,0,{distance:e,object:t}),this.add(t)},getObjectForDistance:function(t){for(var e=this.levels,n=1,r=e.length;n<r&&!(t<e[n].distance);n++);return e[n-1].object},raycast:function(){var t=new a.Vector3;return function(e,n){t.setFromMatrixPosition(this.matrixWorld);var r=e.ray.origin.distanceTo(t);this.getObjectForDistance(r).raycast(e,n)}}(),update:function(){var t=new a.Vector3,e=new a.Vector3;return function(n){var r=this.levels;if(r.length>1){t.setFromMatrixPosition(n.matrixWorld),e.setFromMatrixPosition(this.matrixWorld);var i=t.distanceTo(e);r[0].object.visible=!0;for(var a=1,o=r.length;a<o&&i>=r[a].distance;a++)r[a-1].object.visible=!1,r[a].object.visible=!0;for(;a<o;a++)r[a].object.visible=!1}}}(),toJSON:function(t){var e=a.Object3D.prototype.toJSON.call(this,t);e.object.levels=[];for(var n=this.levels,r=0,i=n.length;r<i;r++){var o=n[r];e.object.levels.push({object:o.object.uuid,distance:o.distance})}return e}}),a.Sprite=function(t){a.Object3D.call(this),this.type="Sprite",this.material=void 0!==t?t:new a.SpriteMaterial},a.Sprite.prototype=Object.assign(Object.create(a.Object3D.prototype),{constructor:a.Sprite,raycast:function(){var t=new a.Vector3;return function(e,n){t.setFromMatrixPosition(this.matrixWorld);var r=e.ray.distanceSqToPoint(t),i=this.scale.x*this.scale.y/4;r>i||n.push({distance:Math.sqrt(r),point:this.position,face:null,object:this})}}(),clone:function(){return new this.constructor(this.material).copy(this)}}),a.LensFlare=function(t,e,n,r,i){a.Object3D.call(this),this.lensFlares=[],this.positionScreen=new a.Vector3,this.customUpdateCallback=void 0,void 0!==t&&this.add(t,e,n,r,i)},a.LensFlare.prototype=Object.assign(Object.create(a.Object3D.prototype),{constructor:a.LensFlare,copy:function(t){a.Object3D.prototype.copy.call(this,t),this.positionScreen.copy(t.positionScreen),this.customUpdateCallback=t.customUpdateCallback;for(var e=0,n=t.lensFlares.length;e<n;e++)this.lensFlares.push(t.lensFlares[e]);return this},add:function(t,e,n,r,i,o){void 0===e&&(e=-1),void 0===n&&(n=0),void 0===o&&(o=1),void 0===i&&(i=new a.Color(16777215)),void 0===r&&(r=a.NormalBlending),n=Math.min(n,Math.max(0,n)),this.lensFlares.push({texture:t,size:e,distance:n,x:0,y:0,z:0,scale:1,rotation:0,opacity:o,color:i,blending:r})},updateLensFlares:function(){var t,e,n=this.lensFlares.length,r=2*-this.positionScreen.x,i=2*-this.positionScreen.y;for(t=0;t<n;t++)e=this.lensFlares[t],e.x=this.positionScreen.x+r*e.distance,e.y=this.positionScreen.y+i*e.distance,e.wantedRotation=e.x*Math.PI*.25,e.rotation+=.25*(e.wantedRotation-e.rotation)}}),a.Scene=function(){a.Object3D.call(this),this.type="Scene",this.background=null,this.fog=null,this.overrideMaterial=null,this.autoUpdate=!0},a.Scene.prototype=Object.create(a.Object3D.prototype),a.Scene.prototype.constructor=a.Scene,a.Scene.prototype.copy=function(t,e){return a.Object3D.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},a.Fog=function(t,e,n){this.name="",this.color=new a.Color(t),this.near=void 0!==e?e:1,this.far=void 0!==n?n:1e3},a.Fog.prototype.clone=function(){return new a.Fog(this.color.getHex(),this.near,this.far)},a.FogExp2=function(t,e){this.name="",this.color=new a.Color(t),this.density=void 0!==e?e:25e-5},a.FogExp2.prototype.clone=function(){return new a.FogExp2(this.color.getHex(),this.density)},a.ShaderChunk={},a.ShaderChunk.alphamap_fragment="#ifdef USE_ALPHAMAP\n\tdiffuseColor.a *= texture2D( alphaMap, vUv ).g;\n#endif\n",a.ShaderChunk.alphamap_pars_fragment="#ifdef USE_ALPHAMAP\n\tuniform sampler2D alphaMap;\n#endif\n",a.ShaderChunk.alphatest_fragment="#ifdef ALPHATEST\n\tif ( diffuseColor.a < ALPHATEST ) discard;\n#endif\n",a.ShaderChunk.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",a.ShaderChunk.aomap_pars_fragment="#ifdef USE_AOMAP\n\tuniform sampler2D aoMap;\n\tuniform float aoMapIntensity;\n#endif",a.ShaderChunk.begin_vertex="\nvec3 transformed = vec3( position );\n",a.ShaderChunk.beginnormal_vertex="\nvec3 objectNormal = vec3( normal );\n",a.ShaderChunk.bsdfs="bool testLightInRange( const in float lightDistance, const in float cutoffDistance ) {\n\treturn any( bvec2( cutoffDistance == 0.0, lightDistance < cutoffDistance ) );\n}\nfloat punctualLightIntensityToIrradianceFactor( const in float lightDistance, const in float cutoffDistance, const in float decayExponent ) {\n\t\tif( decayExponent > 0.0 ) {\n#if defined ( PHYSICALLY_CORRECT_LIGHTS )\n\t\t\tfloat distanceFalloff = 1.0 / max( pow( lightDistance, decayExponent ), 0.01 );\n\t\t\tfloat maxDistanceCutoffFactor = pow2( saturate( 1.0 - pow4( lightDistance / cutoffDistance ) ) );\n\t\t\treturn distanceFalloff * maxDistanceCutoffFactor;\n#else\n\t\t\treturn pow( saturate( -lightDistance / cutoffDistance + 1.0 ), decayExponent );\n#endif\n\t\t}\n\t\treturn 1.0;\n}\nvec3 BRDF_Diffuse_Lambert( const in vec3 diffuseColor ) {\n\treturn RECIPROCAL_PI * diffuseColor;\n}\nvec3 F_Schlick( const in vec3 specularColor, const in float dotLH ) {\n\tfloat fresnel = exp2( ( -5.55473 * dotLH - 6.98316 ) * dotLH );\n\treturn ( 1.0 - specularColor ) * fresnel + specularColor;\n}\nfloat G_GGX_Smith( const in float alpha, const in float dotNL, const in float dotNV ) {\n\tfloat a2 = pow2( alpha );\n\tfloat gl = dotNL + sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNL ) );\n\tfloat gv = dotNV + sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNV ) );\n\treturn 1.0 / ( gl * gv );\n}\nfloat G_GGX_SmithCorrelated( const in float alpha, const in float dotNL, const in float dotNV ) {\n\tfloat a2 = pow2( alpha );\n\tfloat gv = dotNL * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNV ) );\n\tfloat gl = dotNV * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNL ) );\n\treturn 0.5 / max( gv + gl, EPSILON );\n}\nfloat D_GGX( const in float alpha, const in float dotNH ) {\n\tfloat a2 = pow2( alpha );\n\tfloat denom = pow2( dotNH ) * ( a2 - 1.0 ) + 1.0;\n\treturn RECIPROCAL_PI * a2 / pow2( denom );\n}\nvec3 BRDF_Specular_GGX( const in IncidentLight incidentLight, const in GeometricContext geometry, const in vec3 specularColor, const in float roughness ) {\n\tfloat alpha = pow2( roughness );\n\tvec3 halfDir = normalize( incidentLight.direction + geometry.viewDir );\n\tfloat dotNL = saturate( dot( geometry.normal, incidentLight.direction ) );\n\tfloat dotNV = saturate( dot( geometry.normal, geometry.viewDir ) );\n\tfloat dotNH = saturate( dot( geometry.normal, halfDir ) );\n\tfloat dotLH = saturate( dot( incidentLight.direction, halfDir ) );\n\tvec3 F = F_Schlick( specularColor, dotLH );\n\tfloat G = G_GGX_SmithCorrelated( alpha, dotNL, dotNV );\n\tfloat D = D_GGX( alpha, dotNH );\n\treturn F * ( G * D );\n}\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",
-a.ShaderChunk.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",a.ShaderChunk.clipping_planes_fragment="#if NUM_CLIPPING_PLANES > 0\n\tfor ( int i = 0; i < NUM_CLIPPING_PLANES; ++ i ) {\n\t\tvec4 plane = clippingPlanes[ i ];\n\t\tif ( dot( vViewPosition, plane.xyz ) > plane.w ) discard;\n\t}\n#endif\n",a.ShaderChunk.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",a.ShaderChunk.clipping_planes_pars_vertex="#if NUM_CLIPPING_PLANES > 0 && ! defined( PHYSICAL ) && ! defined( PHONG )\n\tvarying vec3 vViewPosition;\n#endif\n",a.ShaderChunk.clipping_planes_vertex="#if NUM_CLIPPING_PLANES > 0 && ! defined( PHYSICAL ) && ! defined( PHONG )\n\tvViewPosition = - mvPosition.xyz;\n#endif\n",a.ShaderChunk.color_fragment="#ifdef USE_COLOR\n\tdiffuseColor.rgb *= vColor;\n#endif",a.ShaderChunk.color_pars_fragment="#ifdef USE_COLOR\n\tvarying vec3 vColor;\n#endif\n",a.ShaderChunk.color_pars_vertex="#ifdef USE_COLOR\n\tvarying vec3 vColor;\n#endif",a.ShaderChunk.color_vertex="#ifdef USE_COLOR\n\tvColor.xyz = color.xyz;\n#endif",a.ShaderChunk.common="#define PI 3.14159265359\n#define PI2 6.28318530718\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}\n",a.ShaderChunk.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",a.ShaderChunk.defaultnormal_vertex="#ifdef FLIP_SIDED\n\tobjectNormal = -objectNormal;\n#endif\nvec3 transformedNormal = normalMatrix * objectNormal;\n",a.ShaderChunk.displacementmap_vertex="#ifdef USE_DISPLACEMENTMAP\n\ttransformed += normal * ( texture2D( displacementMap, uv ).x * displacementScale + displacementBias );\n#endif\n",a.ShaderChunk.displacementmap_pars_vertex="#ifdef USE_DISPLACEMENTMAP\n\tuniform sampler2D displacementMap;\n\tuniform float displacementScale;\n\tuniform float displacementBias;\n#endif\n",a.ShaderChunk.emissivemap_fragment="#ifdef USE_EMISSIVEMAP\n\tvec4 emissiveColor = texture2D( emissiveMap, vUv );\n\temissiveColor.rgb = emissiveMapTexelToLinear( emissiveColor ).rgb;\n\ttotalEmissiveRadiance *= emissiveColor.rgb;\n#endif\n",a.ShaderChunk.emissivemap_pars_fragment="#ifdef USE_EMISSIVEMAP\n\tuniform sampler2D emissiveMap;\n#endif\n",a.ShaderChunk.encodings_pars_fragment="\nvec4 LinearToLinear( in vec4 value ) {\n return value;\n}\nvec4 GammaToLinear( in vec4 value, in float gammaFactor ) {\n return vec4( pow( value.xyz, vec3( gammaFactor ) ), value.w );\n}\nvec4 LinearToGamma( in vec4 value, in float gammaFactor ) {\n return vec4( pow( value.xyz, vec3( 1.0 / gammaFactor ) ), value.w );\n}\nvec4 sRGBToLinear( in vec4 value ) {\n return 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 return 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 return vec4( value.rgb * exp2( value.a * 255.0 - 128.0 ), 1.0 );\n}\nvec4 LinearToRGBE( in vec4 value ) {\n float maxComponent = max( max( value.r, value.g ), value.b );\n float fExp = clamp( ceil( log2( maxComponent ) ), -128.0, 127.0 );\n return vec4( value.rgb / exp2( fExp ), ( fExp + 128.0 ) / 255.0 );\n}\nvec4 RGBMToLinear( in vec4 value, in float maxRange ) {\n return vec4( value.xyz * value.w * maxRange, 1.0 );\n}\nvec4 LinearToRGBM( in vec4 value, in float maxRange ) {\n float maxRGB = max( value.x, max( value.g, value.b ) );\n float M = clamp( maxRGB / maxRange, 0.0, 1.0 );\n M = ceil( M * 255.0 ) / 255.0;\n return vec4( value.rgb / ( M * maxRange ), M );\n}\nvec4 RGBDToLinear( in vec4 value, in float maxRange ) {\n return vec4( value.rgb * ( ( maxRange / 255.0 ) / value.a ), 1.0 );\n}\nvec4 LinearToRGBD( in vec4 value, in float maxRange ) {\n float maxRGB = max( value.x, max( value.g, value.b ) );\n float D = max( maxRange / maxRGB, 1.0 );\n D = min( floor( D ) / 255.0, 1.0 );\n return 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 vec3 Xp_Y_XYZp = value.rgb * cLogLuvM;\n Xp_Y_XYZp = max(Xp_Y_XYZp, vec3(1e-6, 1e-6, 1e-6));\n vec4 vResult;\n vResult.xy = Xp_Y_XYZp.xy / Xp_Y_XYZp.z;\n float Le = 2.0 * log2(Xp_Y_XYZp.y) + 127.0;\n vResult.w = fract(Le);\n vResult.z = (Le - (floor(vResult.w*255.0))/255.0)/255.0;\n return 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 float Le = value.z * 255.0 + value.w;\n vec3 Xp_Y_XYZp;\n Xp_Y_XYZp.y = exp2((Le - 127.0) / 2.0);\n Xp_Y_XYZp.z = Xp_Y_XYZp.y / value.y;\n Xp_Y_XYZp.x = value.x * Xp_Y_XYZp.z;\n vec3 vRGB = Xp_Y_XYZp.rgb * cLogLuvInverseM;\n return vec4( max(vRGB, 0.0), 1.0 );\n}\n",a.ShaderChunk.encodings_fragment=" gl_FragColor = linearToOutputTexel( gl_FragColor );\n",a.ShaderChunk.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#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",a.ShaderChunk.envmap_pars_fragment="#if defined( USE_ENVMAP ) || defined( PHYSICAL )\n\tuniform float reflectivity;\n\tuniform float envMapIntenstiy;\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",a.ShaderChunk.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",a.ShaderChunk.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",a.ShaderChunk.fog_fragment="#ifdef USE_FOG\n\t#ifdef USE_LOGDEPTHBUF_EXT\n\t\tfloat depth = gl_FragDepthEXT / gl_FragCoord.w;\n\t#else\n\t\tfloat depth = gl_FragCoord.z / gl_FragCoord.w;\n\t#endif\n\t#ifdef FOG_EXP2\n\t\tfloat fogFactor = whiteCompliment( exp2( - fogDensity * fogDensity * depth * depth * LOG2 ) );\n\t#else\n\t\tfloat fogFactor = smoothstep( fogNear, fogFar, depth );\n\t#endif\n\tgl_FragColor.rgb = mix( gl_FragColor.rgb, fogColor, fogFactor );\n#endif\n",a.ShaderChunk.fog_pars_fragment="#ifdef USE_FOG\n\tuniform vec3 fogColor;\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",a.ShaderChunk.lightmap_fragment="#ifdef USE_LIGHTMAP\n\treflectedLight.indirectDiffuse += PI * texture2D( lightMap, vUv2 ).xyz * lightMapIntensity;\n#endif\n",a.ShaderChunk.lightmap_pars_fragment="#ifdef USE_LIGHTMAP\n\tuniform sampler2D lightMap;\n\tuniform float lightMapIntensity;\n#endif",a.ShaderChunk.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",a.ShaderChunk.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\tif ( testLightInRange( lightDistance, pointLight.distance ) ) {\n\t\t\tdirectLight.color = pointLight.color;\n\t\t\tdirectLight.color *= punctualLightIntensityToIrradianceFactor( lightDistance, pointLight.distance, pointLight.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_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 ( all( bvec2( angleCos > spotLight.coneCos, testLightInRange( lightDistance, spotLight.distance ) ) ) ) {\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_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\t#include <normal_flip>\n\t\tvec3 worldNormal = inverseTransformDirection( geometry.normal, viewMatrix );\n\t\t#ifdef ENVMAP_TYPE_CUBE\n\t\t\tvec3 queryVec = flipNormal * 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 = flipNormal * 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\t#include <normal_flip>\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 = flipNormal * 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 = flipNormal * 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( flipNormal * reflectVec.y * 0.5 + 0.5 );\n\t\t\tsampleUV.x = atan( flipNormal * reflectVec.z, flipNormal * 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 = flipNormal * 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",a.ShaderChunk.lights_phong_fragment="BlinnPhongMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb;\nmaterial.specularColor = specular;\nmaterial.specularShininess = shininess;\nmaterial.specularStrength = specularStrength;\n",a.ShaderChunk.lights_phong_pars_fragment="varying vec3 vViewPosition;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\nstruct BlinnPhongMaterial {\n\tvec3\tdiffuseColor;\n\tvec3\tspecularColor;\n\tfloat\tspecularShininess;\n\tfloat\tspecularStrength;\n};\nvoid RE_Direct_BlinnPhong( const in IncidentLight directLight, const in GeometricContext geometry, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {\n\tfloat dotNL = saturate( dot( geometry.normal, directLight.direction ) );\n\tvec3 irradiance = dotNL * directLight.color;\n\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\t\tirradiance *= PI;\n\t#endif\n\treflectedLight.directDiffuse += irradiance * BRDF_Diffuse_Lambert( material.diffuseColor );\n\treflectedLight.directSpecular += irradiance * BRDF_Specular_BlinnPhong( directLight, geometry, material.specularColor, material.specularShininess ) * material.specularStrength;\n}\nvoid RE_IndirectDiffuse_BlinnPhong( const in vec3 irradiance, const in GeometricContext geometry, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {\n\treflectedLight.indirectDiffuse += irradiance * BRDF_Diffuse_Lambert( material.diffuseColor );\n}\n#define RE_Direct\t\t\t\tRE_Direct_BlinnPhong\n#define RE_IndirectDiffuse\t\tRE_IndirectDiffuse_BlinnPhong\n#define Material_LightProbeLOD( material )\t(0)\n",a.ShaderChunk.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",a.ShaderChunk.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\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\treflectedLight.directSpecular += irradiance * BRDF_Specular_GGX( directLight, geometry, material.specularColor, material.specularRoughness );\n\treflectedLight.directDiffuse += 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\treflectedLight.indirectSpecular += 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_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",a.ShaderChunk.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 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\t\t\n\tRE_IndirectSpecular( radiance, clearCoatRadiance, geometry, material, reflectedLight );\n#endif\n",
-a.ShaderChunk.logdepthbuf_fragment="#if defined(USE_LOGDEPTHBUF) && defined(USE_LOGDEPTHBUF_EXT)\n\tgl_FragDepthEXT = log2(vFragDepth) * logDepthBufFC * 0.5;\n#endif",a.ShaderChunk.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",a.ShaderChunk.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",a.ShaderChunk.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",a.ShaderChunk.map_fragment="#ifdef USE_MAP\n\tvec4 texelColor = texture2D( map, vUv );\n\ttexelColor = mapTexelToLinear( texelColor );\n\tdiffuseColor *= texelColor;\n#endif\n",a.ShaderChunk.map_pars_fragment="#ifdef USE_MAP\n\tuniform sampler2D map;\n#endif\n",a.ShaderChunk.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",a.ShaderChunk.map_particle_pars_fragment="#ifdef USE_MAP\n\tuniform vec4 offsetRepeat;\n\tuniform sampler2D map;\n#endif\n",a.ShaderChunk.metalnessmap_fragment="float metalnessFactor = metalness;\n#ifdef USE_METALNESSMAP\n\tvec4 texelMetalness = texture2D( metalnessMap, vUv );\n\tmetalnessFactor *= texelMetalness.r;\n#endif\n",a.ShaderChunk.metalnessmap_pars_fragment="#ifdef USE_METALNESSMAP\n\tuniform sampler2D metalnessMap;\n#endif",a.ShaderChunk.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",a.ShaderChunk.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",a.ShaderChunk.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",a.ShaderChunk.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",a.ShaderChunk.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",a.ShaderChunk.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",a.ShaderChunk.packing="vec3 packNormalToRGB( const in vec3 normal ) {\n return normalize( normal ) * 0.5 + 0.5;\n}\nvec3 unpackRGBToNormal( const in vec3 rgb ) {\n return 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 return ( viewZ + near ) / ( near - far );\n}\nfloat orthographicDepthToViewZ( const in float linearClipZ, const in float near, const in float far ) {\n return linearClipZ * ( near - far ) - near;\n}\nfloat viewZToPerspectiveDepth( const in float viewZ, const in float near, const in float far ) {\n return (( near + viewZ ) * far ) / (( far - near ) * viewZ );\n}\nfloat perspectiveDepthToViewZ( const in float invClipZ, const in float near, const in float far ) {\n return ( near * far ) / ( ( far - near ) * invClipZ - far );\n}\n",a.ShaderChunk.premultiplied_alpha_fragment="#ifdef PREMULTIPLIED_ALPHA\n\tgl_FragColor.rgb *= gl_FragColor.a;\n#endif\n",a.ShaderChunk.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",a.ShaderChunk.roughnessmap_fragment="float roughnessFactor = roughness;\n#ifdef USE_ROUGHNESSMAP\n\tvec4 texelRoughness = texture2D( roughnessMap, vUv );\n\troughnessFactor *= texelRoughness.r;\n#endif\n",a.ShaderChunk.roughnessmap_pars_fragment="#ifdef USE_ROUGHNESSMAP\n\tuniform sampler2D roughnessMap;\n#endif",a.ShaderChunk.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",a.ShaderChunk.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",a.ShaderChunk.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",a.ShaderChunk.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",a.ShaderChunk.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",a.ShaderChunk.skinning_pars_vertex="#ifdef USE_SKINNING\n\tuniform mat4 bindMatrix;\n\tuniform mat4 bindMatrixInverse;\n\t#ifdef BONE_TEXTURE\n\t\tuniform sampler2D boneTexture;\n\t\tuniform int boneTextureWidth;\n\t\tuniform int boneTextureHeight;\n\t\tmat4 getBoneMatrix( const in float i ) {\n\t\t\tfloat j = i * 4.0;\n\t\t\tfloat x = mod( j, float( boneTextureWidth ) );\n\t\t\tfloat y = floor( j / float( boneTextureWidth ) );\n\t\t\tfloat dx = 1.0 / float( boneTextureWidth );\n\t\t\tfloat dy = 1.0 / float( boneTextureHeight );\n\t\t\ty = dy * ( y + 0.5 );\n\t\t\tvec4 v1 = texture2D( boneTexture, vec2( dx * ( x + 0.5 ), y ) );\n\t\t\tvec4 v2 = texture2D( boneTexture, vec2( dx * ( x + 1.5 ), y ) );\n\t\t\tvec4 v3 = texture2D( boneTexture, vec2( dx * ( x + 2.5 ), y ) );\n\t\t\tvec4 v4 = texture2D( boneTexture, vec2( dx * ( x + 3.5 ), y ) );\n\t\t\tmat4 bone = mat4( v1, v2, v3, v4 );\n\t\t\treturn bone;\n\t\t}\n\t#else\n\t\tuniform mat4 boneMatrices[ MAX_BONES ];\n\t\tmat4 getBoneMatrix( const in float i ) {\n\t\t\tmat4 bone = boneMatrices[ int(i) ];\n\t\t\treturn bone;\n\t\t}\n\t#endif\n#endif\n",a.ShaderChunk.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",a.ShaderChunk.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",a.ShaderChunk.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",a.ShaderChunk.specularmap_pars_fragment="#ifdef USE_SPECULARMAP\n\tuniform sampler2D specularMap;\n#endif",a.ShaderChunk.tonemapping_fragment="#if defined( TONE_MAPPING )\n gl_FragColor.rgb = toneMapping( gl_FragColor.rgb );\n#endif\n",a.ShaderChunk.tonemapping_pars_fragment="#define saturate(a) clamp( a, 0.0, 1.0 )\nuniform float toneMappingExposure;\nuniform float toneMappingWhitePoint;\nvec3 LinearToneMapping( vec3 color ) {\n return toneMappingExposure * color;\n}\nvec3 ReinhardToneMapping( vec3 color ) {\n color *= toneMappingExposure;\n return 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 color *= toneMappingExposure;\n return saturate( Uncharted2Helper( color ) / Uncharted2Helper( vec3( toneMappingWhitePoint ) ) );\n}\nvec3 OptimizedCineonToneMapping( vec3 color ) {\n color *= toneMappingExposure;\n color = max( vec3( 0.0 ), color - 0.004 );\n return pow( ( color * ( 6.2 * color + 0.5 ) ) / ( color * ( 6.2 * color + 1.7 ) + 0.06 ), vec3( 2.2 ) );\n}\n",a.ShaderChunk.uv2_pars_fragment="#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP )\n\tvarying vec2 vUv2;\n#endif",a.ShaderChunk.uv2_pars_vertex="#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP )\n\tattribute vec2 uv2;\n\tvarying vec2 vUv2;\n#endif",a.ShaderChunk.uv2_vertex="#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP )\n\tvUv2 = uv2;\n#endif",a.ShaderChunk.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",a.ShaderChunk.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",a.ShaderChunk.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",a.ShaderChunk.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",a.UniformsUtils={merge:function(t){for(var e={},n=0;n<t.length;n++){var r=this.clone(t[n]);for(var i in r)e[i]=r[i]}return e},clone:function(t){var e={};for(var n in t){e[n]={};for(var r in t[n]){var i=t[n][r];i instanceof a.Color||i instanceof a.Vector2||i instanceof a.Vector3||i instanceof a.Vector4||i instanceof a.Matrix3||i instanceof a.Matrix4||i instanceof a.Texture?e[n][r]=i.clone():Array.isArray(i)?e[n][r]=i.slice():e[n][r]=i}}return e}},a.UniformsLib={common:{diffuse:{value:new a.Color(15658734)},opacity:{value:1},map:{value:null},offsetRepeat:{value:new a.Vector4(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 a.Vector2(1,1)}},displacementmap:{displacementMap:{value:null},displacementScale:{value:1},displacementBias:{value:0}},roughnessmap:{roughnessMap:{value:null}},metalnessmap:{metalnessMap:{value:null}},fog:{fogDensity:{value:25e-5},fogNear:{value:1},fogFar:{value:2e3},fogColor:{value:new a.Color(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:{}}}},points:{diffuse:{value:new a.Color(15658734)},opacity:{value:1},size:{value:1},scale:{value:1},map:{value:null},offsetRepeat:{value:new a.Vector4(0,0,1,1)}}},a.ShaderChunk.cube_frag="uniform samplerCube tCube;\nuniform float tFlip;\nvarying vec3 vWorldPosition;\n#include <common>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tgl_FragColor = textureCube( tCube, vec3( tFlip * vWorldPosition.x, vWorldPosition.yz ) );\n\t#include <logdepthbuf_fragment>\n}\n",a.ShaderChunk.cube_vert="varying vec3 vWorldPosition;\n#include <common>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\tvWorldPosition = transformDirection( position, modelMatrix );\n\t#include <begin_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n}\n",a.ShaderChunk.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",a.ShaderChunk.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",a.ShaderChunk.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",a.ShaderChunk.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",a.ShaderChunk.equirect_frag="uniform sampler2D tEquirect;\nuniform float tFlip;\nvarying vec3 vWorldPosition;\n#include <common>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\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\t#include <logdepthbuf_fragment>\n}\n",a.ShaderChunk.equirect_vert="varying vec3 vWorldPosition;\n#include <common>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\tvWorldPosition = transformDirection( position, modelMatrix );\n\t#include <begin_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n}\n",a.ShaderChunk.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",a.ShaderChunk.linedashed_vert="uniform float scale;\nattribute float lineDistance;\nvarying float vLineDistance;\n#include <common>\n#include <color_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}\n",a.ShaderChunk.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 <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;\n\treflectedLight.directDiffuse = vec3( 0.0 );\n\treflectedLight.directSpecular = vec3( 0.0 );\n\treflectedLight.indirectDiffuse = diffuseColor.rgb;\n\treflectedLight.indirectSpecular = vec3( 0.0 );\n\t#include <aomap_fragment>\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",a.ShaderChunk.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 <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}\n",a.ShaderChunk.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 <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 <premultiplied_alpha_fragment>\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n}\n",
-a.ShaderChunk.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 <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}\n",a.ShaderChunk.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 <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 <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 <premultiplied_alpha_fragment>\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n}\n",a.ShaderChunk.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 <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}\n",a.ShaderChunk.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\nuniform float envMapIntensity;\nvarying vec3 vViewPosition;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\n#include <common>\n#include <packing>\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 <premultiplied_alpha_fragment>\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n}\n",a.ShaderChunk.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 <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}\n",a.ShaderChunk.normal_frag="uniform float opacity;\nvarying vec3 vNormal;\n#include <common>\n#include <packing>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tgl_FragColor = vec4( packNormalToRGB( vNormal ), opacity );\n\t#include <logdepthbuf_fragment>\n}\n",a.ShaderChunk.normal_vert="varying vec3 vNormal;\n#include <common>\n#include <morphtarget_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\tvNormal = normalize( normalMatrix * normal );\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n}\n",a.ShaderChunk.points_frag="uniform vec3 diffuse;\nuniform float opacity;\n#include <common>\n#include <color_pars_fragment>\n#include <map_particle_pars_fragment>\n#include <fog_pars_fragment>\n#include <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",a.ShaderChunk.points_vert="uniform float size;\nuniform float scale;\n#include <common>\n#include <color_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}\n",a.ShaderChunk.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",a.ShaderChunk.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",a.ShaderLib={basic:{uniforms:a.UniformsUtils.merge([a.UniformsLib.common,a.UniformsLib.aomap,a.UniformsLib.fog]),vertexShader:a.ShaderChunk.meshbasic_vert,fragmentShader:a.ShaderChunk.meshbasic_frag},lambert:{uniforms:a.UniformsUtils.merge([a.UniformsLib.common,a.UniformsLib.aomap,a.UniformsLib.lightmap,a.UniformsLib.emissivemap,a.UniformsLib.fog,a.UniformsLib.lights,{emissive:{value:new a.Color(0)}}]),vertexShader:a.ShaderChunk.meshlambert_vert,fragmentShader:a.ShaderChunk.meshlambert_frag},phong:{uniforms:a.UniformsUtils.merge([a.UniformsLib.common,a.UniformsLib.aomap,a.UniformsLib.lightmap,a.UniformsLib.emissivemap,a.UniformsLib.bumpmap,a.UniformsLib.normalmap,a.UniformsLib.displacementmap,a.UniformsLib.fog,a.UniformsLib.lights,{emissive:{value:new a.Color(0)},specular:{value:new a.Color(1118481)},shininess:{value:30}}]),vertexShader:a.ShaderChunk.meshphong_vert,fragmentShader:a.ShaderChunk.meshphong_frag},standard:{uniforms:a.UniformsUtils.merge([a.UniformsLib.common,a.UniformsLib.aomap,a.UniformsLib.lightmap,a.UniformsLib.emissivemap,a.UniformsLib.bumpmap,a.UniformsLib.normalmap,a.UniformsLib.displacementmap,a.UniformsLib.roughnessmap,a.UniformsLib.metalnessmap,a.UniformsLib.fog,a.UniformsLib.lights,{emissive:{value:new a.Color(0)},roughness:{value:.5},metalness:{value:0},envMapIntensity:{value:1}}]),vertexShader:a.ShaderChunk.meshphysical_vert,fragmentShader:a.ShaderChunk.meshphysical_frag},points:{uniforms:a.UniformsUtils.merge([a.UniformsLib.points,a.UniformsLib.fog]),vertexShader:a.ShaderChunk.points_vert,fragmentShader:a.ShaderChunk.points_frag},dashed:{uniforms:a.UniformsUtils.merge([a.UniformsLib.common,a.UniformsLib.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:a.ShaderChunk.linedashed_vert,fragmentShader:a.ShaderChunk.linedashed_frag},depth:{uniforms:a.UniformsUtils.merge([a.UniformsLib.common,a.UniformsLib.displacementmap]),vertexShader:a.ShaderChunk.depth_vert,fragmentShader:a.ShaderChunk.depth_frag},normal:{uniforms:{opacity:{value:1}},vertexShader:a.ShaderChunk.normal_vert,fragmentShader:a.ShaderChunk.normal_frag},cube:{uniforms:{tCube:{value:null},tFlip:{value:-1}},vertexShader:a.ShaderChunk.cube_vert,fragmentShader:a.ShaderChunk.cube_frag},equirect:{uniforms:{tEquirect:{value:null},tFlip:{value:-1}},vertexShader:a.ShaderChunk.equirect_vert,fragmentShader:a.ShaderChunk.equirect_frag},distanceRGBA:{uniforms:{lightPos:{value:new a.Vector3}},vertexShader:a.ShaderChunk.distanceRGBA_vert,fragmentShader:a.ShaderChunk.distanceRGBA_frag}},a.ShaderLib.physical={uniforms:a.UniformsUtils.merge([a.ShaderLib.standard.uniforms,{clearCoat:{value:0},clearCoatRoughness:{value:0}}]),vertexShader:a.ShaderChunk.meshphysical_vert,fragmentShader:a.ShaderChunk.meshphysical_frag},a.WebGLRenderer=function(t){function e(){return null===et?dt:1}function n(t,e,n,r){H===!0&&(t*=r,e*=r,n*=r),Dt.clearColor(t,e,n,r)}function r(){Dt.init(),Dt.scissor(ot.copy(mt).multiplyScalar(dt)),Dt.viewport(ct.copy(vt).multiplyScalar(dt)),n(lt.r,lt.g,lt.b,ht)}function i(){tt=null,at=null,it="",rt=-1,Dt.reset()}function o(t){t.preventDefault(),i(),r(),Nt.clear()}function s(t){var e=t.target;e.removeEventListener("dispose",s),c(e)}function c(t){u(t),Nt["delete"](t)}function u(t){var e=Nt.get(t).program;t.program=void 0,void 0!==e&&It.releaseProgram(e)}function l(t,e,n,r){var i;if(n instanceof a.InstancedBufferGeometry&&(i=Rt.get("ANGLE_instanced_arrays"),null===i))return void console.error("THREE.WebGLRenderer.setupVertexAttributes: using THREE.InstancedBufferGeometry but hardware does not support extension ANGLE_instanced_arrays.");void 0===r&&(r=0),Dt.initAttributes();var o=n.attributes,s=e.getAttributes(),c=t.defaultAttributeValues;for(var u in s){var l=s[u];if(l>=0){var h=o[u];if(void 0!==h){var f=At.FLOAT,p=h.array,d=h.normalized;p instanceof Float32Array?f=At.FLOAT:p instanceof Float64Array?console.warn("Unsupported data buffer format: Float64Array"):p instanceof Uint16Array?f=At.UNSIGNED_SHORT:p instanceof Int16Array?f=At.SHORT:p instanceof Uint32Array?f=At.UNSIGNED_INT:p instanceof Int32Array?f=At.INT:p instanceof Int8Array?f=At.BYTE:p instanceof Uint8Array&&(f=At.UNSIGNED_BYTE);var m=h.itemSize,g=Bt.getAttributeBuffer(h);if(h instanceof a.InterleavedBufferAttribute){var v=h.data,y=v.stride,x=h.offset;v instanceof a.InstancedInterleavedBuffer?(Dt.enableAttributeAndDivisor(l,v.meshPerAttribute,i),void 0===n.maxInstancedCount&&(n.maxInstancedCount=v.meshPerAttribute*v.count)):Dt.enableAttribute(l),At.bindBuffer(At.ARRAY_BUFFER,g),At.vertexAttribPointer(l,m,f,d,y*v.array.BYTES_PER_ELEMENT,(r*y+x)*v.array.BYTES_PER_ELEMENT)}else h instanceof a.InstancedBufferAttribute?(Dt.enableAttributeAndDivisor(l,h.meshPerAttribute,i),void 0===n.maxInstancedCount&&(n.maxInstancedCount=h.meshPerAttribute*h.count)):Dt.enableAttribute(l),At.bindBuffer(At.ARRAY_BUFFER,g),At.vertexAttribPointer(l,m,f,d,0,r*m*h.array.BYTES_PER_ELEMENT)}else if(void 0!==c){var b=c[u];if(void 0!==b)switch(b.length){case 2:At.vertexAttrib2fv(l,b);break;case 3:At.vertexAttrib3fv(l,b);break;case 4:At.vertexAttrib4fv(l,b);break;default:At.vertexAttrib1fv(l,b)}}}}Dt.disableUnusedAttributes()}function h(t,e){return Math.abs(e[0])-Math.abs(t[0])}function f(t,e){return t.object.renderOrder!==e.object.renderOrder?t.object.renderOrder-e.object.renderOrder:t.material.id!==e.material.id?t.material.id-e.material.id:t.z!==e.z?t.z-e.z:t.id-e.id}function p(t,e){return t.object.renderOrder!==e.object.renderOrder?t.object.renderOrder-e.object.renderOrder:t.z!==e.z?e.z-t.z:t.id-e.id}function d(t,e,n,r,i){var a,o;n.transparent?(a=Y,o=++Z):(a=X,o=++q);var s=a[o];void 0!==s?(s.id=t.id,s.object=t,s.geometry=e,s.material=n,s.z=St.z,s.group=i):(s={id:t.id,object:t,geometry:e,material:n,z:St.z,group:i},a.push(s))}function m(t){var e=t.geometry;return null===e.boundingSphere&&e.computeBoundingSphere(),_t.copy(e.boundingSphere).applyMatrix4(t.matrixWorld),v(_t)}function g(t){return _t.center.set(0,0,0),_t.radius=.7071067811865476,_t.applyMatrix4(t.matrixWorld),v(_t)}function v(t){if(!yt.intersectsSphere(t))return!1;var e=xt.numPlanes;if(0===e)return!0;var n=$.clippingPlanes,r=t.center,i=-t.radius,a=0;do if(n[a].distanceToPoint(r)<i)return!1;while(++a!==e);return!0}function y(t,e){if(t.visible!==!1){if(t.layers.test(e.layers))if(t instanceof a.Light)W.push(t);else if(t instanceof a.Sprite)t.frustumCulled!==!1&&g(t)!==!0||Q.push(t);else if(t instanceof a.LensFlare)J.push(t);else if(t instanceof a.ImmediateRenderObject)$.sortObjects===!0&&(St.setFromMatrixPosition(t.matrixWorld),St.applyProjection(wt)),d(t,null,t.material,St.z,null);else if((t instanceof a.Mesh||t instanceof a.Line||t instanceof a.Points)&&(t instanceof a.SkinnedMesh&&t.skeleton.update(),t.frustumCulled===!1||m(t)===!0)){var n=t.material;if(n.visible===!0){$.sortObjects===!0&&(St.setFromMatrixPosition(t.matrixWorld),St.applyProjection(wt));var r=Bt.update(t);if(n instanceof a.MultiMaterial)for(var i=r.groups,o=n.materials,s=0,c=i.length;s<c;s++){var u=i[s],l=o[u.materialIndex];l.visible===!0&&d(t,r,l,St.z,u)}else d(t,r,n,St.z,null)}}for(var h=t.children,s=0,c=h.length;s<c;s++)y(h[s],e)}}function x(t,e,n,r){for(var i=0,o=t.length;i<o;i++){var s=t[i],c=s.object,u=s.geometry,l=void 0===r?s.material:r,h=s.group;if(c.modelViewMatrix.multiplyMatrices(e.matrixWorldInverse,c.matrixWorld),c.normalMatrix.getNormalMatrix(c.modelViewMatrix),c instanceof a.ImmediateRenderObject){M(l);var f=_(e,n,l,c);it="",c.render(function(t){$.renderBufferImmediate(t,f,l)})}else $.renderBufferDirect(e,n,u,l,c,h)}}function b(t,e,n){var r=Nt.get(t),i=It.getParameters(t,Et,e,xt.numPlanes,n),o=It.getProgramCode(t,i),c=r.program,l=!0;if(void 0===c)t.addEventListener("dispose",s);else if(c.code!==o)u(t);else{if(void 0!==i.shaderID)return;l=!1}if(l){if(i.shaderID){var h=a.ShaderLib[i.shaderID];r.__webglShader={name:t.type,uniforms:a.UniformsUtils.clone(h.uniforms),vertexShader:h.vertexShader,fragmentShader:h.fragmentShader}}else r.__webglShader={name:t.type,uniforms:t.uniforms,vertexShader:t.vertexShader,fragmentShader:t.fragmentShader};t.__webglShader=r.__webglShader,c=It.acquireProgram(t,i,o),r.program=c,t.program=c}var f=c.getAttributes();if(t.morphTargets){t.numSupportedMorphTargets=0;for(var p=0;p<$.maxMorphTargets;p++)f["morphTarget"+p]>=0&&t.numSupportedMorphTargets++}if(t.morphNormals){t.numSupportedMorphNormals=0;for(var p=0;p<$.maxMorphNormals;p++)f["morphNormal"+p]>=0&&t.numSupportedMorphNormals++}var d=r.__webglShader.uniforms;(t instanceof a.ShaderMaterial||t instanceof a.RawShaderMaterial)&&t.clipping!==!0||(r.numClippingPlanes=xt.numPlanes,d.clippingPlanes=xt.uniform),t.lights&&(r.lightsHash=Et.hash,d.ambientLightColor.value=Et.ambient,d.directionalLights.value=Et.directional,d.spotLights.value=Et.spot,d.pointLights.value=Et.point,d.hemisphereLights.value=Et.hemi,d.directionalShadowMap.value=Et.directionalShadowMap,d.directionalShadowMatrix.value=Et.directionalShadowMatrix,d.spotShadowMap.value=Et.spotShadowMap,d.spotShadowMatrix.value=Et.spotShadowMatrix,d.pointShadowMap.value=Et.pointShadowMap,d.pointShadowMatrix.value=Et.pointShadowMatrix);var m=r.program.getUniforms(),g=a.WebGLUniforms.seqWithValue(m.seq,d);r.uniformsList=g,r.dynamicUniforms=a.WebGLUniforms.splitDynamic(g,d)}function M(t){t.side!==a.DoubleSide?Dt.enable(At.CULL_FACE):Dt.disable(At.CULL_FACE),Dt.setFlipSided(t.side===a.BackSide),t.transparent===!0?Dt.setBlending(t.blending,t.blendEquation,t.blendSrc,t.blendDst,t.blendEquationAlpha,t.blendSrcAlpha,t.blendDstAlpha,t.premultipliedAlpha):Dt.setBlending(a.NoBlending),Dt.setDepthFunc(t.depthFunc),Dt.setDepthTest(t.depthTest),Dt.setDepthWrite(t.depthWrite),Dt.setColorWrite(t.colorWrite),Dt.setPolygonOffset(t.polygonOffset,t.polygonOffsetFactor,t.polygonOffsetUnits)}function _(t,e,n,r){ut=0;var i=Nt.get(n);if(bt){if(Mt||t!==at){var o=t===at&&n.id===rt;xt.setState(n.clippingPlanes,n.clipShadows,t,i,o)}void 0!==i.numClippingPlanes&&i.numClippingPlanes!==xt.numPlanes&&(n.needsUpdate=!0)}void 0===i.program&&(n.needsUpdate=!0),void 0!==i.lightsHash&&i.lightsHash!==Et.hash&&(n.needsUpdate=!0),n.needsUpdate&&(b(n,e,r),n.needsUpdate=!1);var s=!1,c=!1,u=!1,l=i.program,h=l.getUniforms(),f=i.__webglShader.uniforms;if(l.id!==tt&&(At.useProgram(l.program),tt=l.id,s=!0,c=!0,u=!0),n.id!==rt&&(rt=n.id,c=!0),s||t!==at){if(h.set(At,t,"projectionMatrix"),Pt.logarithmicDepthBuffer&&h.setValue(At,"logDepthBufFC",2/(Math.log(t.far+1)/Math.LN2)),t!==at&&(at=t,c=!0,u=!0),n instanceof a.ShaderMaterial||n instanceof a.MeshPhongMaterial||n instanceof a.MeshStandardMaterial||n.envMap){var p=h.map.cameraPosition;void 0!==p&&p.setValue(At,St.setFromMatrixPosition(t.matrixWorld))}(n instanceof a.MeshPhongMaterial||n instanceof a.MeshLambertMaterial||n instanceof a.MeshBasicMaterial||n instanceof a.MeshStandardMaterial||n instanceof a.ShaderMaterial||n.skinning)&&h.setValue(At,"viewMatrix",t.matrixWorldInverse),h.set(At,$,"toneMappingExposure"),h.set(At,$,"toneMappingWhitePoint")}if(n.skinning){h.setOptional(At,r,"bindMatrix"),h.setOptional(At,r,"bindMatrixInverse");var d=r.skeleton;d&&(Pt.floatVertexTextures&&d.useVertexTexture?(h.set(At,d,"boneTexture"),h.set(At,d,"boneTextureWidth"),h.set(At,d,"boneTextureHeight")):h.setOptional(At,d,"boneMatrices"))}c&&(n.lights&&D(f,u),e&&n.fog&&A(f,e),(n instanceof a.MeshBasicMaterial||n instanceof a.MeshLambertMaterial||n instanceof a.MeshPhongMaterial||n instanceof a.MeshStandardMaterial||n instanceof a.MeshDepthMaterial)&&w(f,n),n instanceof a.LineBasicMaterial?S(f,n):n instanceof a.LineDashedMaterial?(S(f,n),E(f,n)):n instanceof a.PointsMaterial?T(f,n):n instanceof a.MeshLambertMaterial?L(f,n):n instanceof a.MeshPhongMaterial?C(f,n):n instanceof a.MeshPhysicalMaterial?P(f,n):n instanceof a.MeshStandardMaterial?R(f,n):n instanceof a.MeshDepthMaterial?n.displacementMap&&(f.displacementMap.value=n.displacementMap,f.displacementScale.value=n.displacementScale,f.displacementBias.value=n.displacementBias):n instanceof a.MeshNormalMaterial&&(f.opacity.value=n.opacity),a.WebGLUniforms.upload(At,i.uniformsList,f,$)),h.set(At,r,"modelViewMatrix"),h.set(At,r,"normalMatrix"),h.setValue(At,"modelMatrix",r.matrixWorld);var m=i.dynamicUniforms;return null!==m&&(a.WebGLUniforms.evalDynamic(m,f,r,t),a.WebGLUniforms.upload(At,m,f,$)),l}function w(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.aoMap&&(t.aoMap.value=e.aoMap,t.aoMapIntensity.value=e.aoMapIntensity);var n;if(e.map?n=e.map:e.specularMap?n=e.specularMap:e.displacementMap?n=e.displacementMap:e.normalMap?n=e.normalMap:e.bumpMap?n=e.bumpMap:e.roughnessMap?n=e.roughnessMap:e.metalnessMap?n=e.metalnessMap:e.alphaMap?n=e.alphaMap:e.emissiveMap&&(n=e.emissiveMap),void 0!==n){n instanceof a.WebGLRenderTarget&&(n=n.texture);var r=n.offset,i=n.repeat;t.offsetRepeat.value.set(r.x,r.y,i.x,i.y)}t.envMap.value=e.envMap,t.flipEnvMap.value=e.envMap instanceof a.CubeTexture?-1:1,t.reflectivity.value=e.reflectivity,t.refractionRatio.value=e.refractionRatio}function S(t,e){t.diffuse.value=e.color,t.opacity.value=e.opacity}function E(t,e){t.dashSize.value=e.dashSize,t.totalSize.value=e.dashSize+e.gapSize,t.scale.value=e.scale}function T(t,e){if(t.diffuse.value=e.color,t.opacity.value=e.opacity,t.size.value=e.size*dt,t.scale.value=.5*O.clientHeight,t.map.value=e.map,null!==e.map){var n=e.map.offset,r=e.map.repeat;t.offsetRepeat.value.set(n.x,n.y,r.x,r.y)}}function A(t,e){t.fogColor.value=e.color,e instanceof a.Fog?(t.fogNear.value=e.near,t.fogFar.value=e.far):e instanceof a.FogExp2&&(t.fogDensity.value=e.density)}function L(t,e){e.lightMap&&(t.lightMap.value=e.lightMap,t.lightMapIntensity.value=e.lightMapIntensity),e.emissiveMap&&(t.emissiveMap.value=e.emissiveMap)}function C(t,e){t.specular.value=e.specular,t.shininess.value=Math.max(e.shininess,1e-4),e.lightMap&&(t.lightMap.value=e.lightMap,t.lightMapIntensity.value=e.lightMapIntensity),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 R(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.lightMap&&(t.lightMap.value=e.lightMap,t.lightMapIntensity.value=e.lightMapIntensity),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 P(t,e){t.clearCoat.value=e.clearCoat,t.clearCoatRoughness.value=e.clearCoatRoughness,R(t,e)}function D(t,e){t.ambientLightColor.needsUpdate=e,t.directionalLights.needsUpdate=e,t.pointLights.needsUpdate=e,t.spotLights.needsUpdate=e,t.hemisphereLights.needsUpdate=e}function N(t){for(var e=0,n=0,r=t.length;n<r;n++){var i=t[n];i.castShadow&&(Et.shadows[e++]=i)}Et.shadows.length=e}function U(t,e){var n,r,i,o,s,c,u,l=0,h=0,f=0,p=e.matrixWorldInverse,d=0,m=0,g=0,v=0;for(n=0,r=t.length;n<r;n++)if(i=t[n],o=i.color,s=i.intensity,c=i.distance,u=i.shadow&&i.shadow.map?i.shadow.map.texture:null,i instanceof a.AmbientLight)l+=o.r*s,h+=o.g*s,f+=o.b*s;else if(i instanceof a.DirectionalLight){var y=Ot.get(i);y.color.copy(i.color).multiplyScalar(i.intensity),y.direction.setFromMatrixPosition(i.matrixWorld),St.setFromMatrixPosition(i.target.matrixWorld),y.direction.sub(St),y.direction.transformDirection(p),y.shadow=i.castShadow,i.castShadow&&(y.shadowBias=i.shadow.bias,y.shadowRadius=i.shadow.radius,y.shadowMapSize=i.shadow.mapSize),Et.directionalShadowMap[d]=u,Et.directionalShadowMatrix[d]=i.shadow.matrix,Et.directional[d++]=y}else if(i instanceof a.SpotLight){var y=Ot.get(i);y.position.setFromMatrixPosition(i.matrixWorld),y.position.applyMatrix4(p),y.color.copy(o).multiplyScalar(s),y.distance=c,y.direction.setFromMatrixPosition(i.matrixWorld),St.setFromMatrixPosition(i.target.matrixWorld),y.direction.sub(St),y.direction.transformDirection(p),y.coneCos=Math.cos(i.angle),y.penumbraCos=Math.cos(i.angle*(1-i.penumbra)),y.decay=0===i.distance?0:i.decay,y.shadow=i.castShadow,i.castShadow&&(y.shadowBias=i.shadow.bias,y.shadowRadius=i.shadow.radius,y.shadowMapSize=i.shadow.mapSize),Et.spotShadowMap[g]=u,Et.spotShadowMatrix[g]=i.shadow.matrix,Et.spot[g++]=y}else if(i instanceof a.PointLight){var y=Ot.get(i);y.position.setFromMatrixPosition(i.matrixWorld),y.position.applyMatrix4(p),y.color.copy(i.color).multiplyScalar(i.intensity),y.distance=i.distance,y.decay=0===i.distance?0:i.decay,y.shadow=i.castShadow,i.castShadow&&(y.shadowBias=i.shadow.bias,y.shadowRadius=i.shadow.radius,y.shadowMapSize=i.shadow.mapSize),Et.pointShadowMap[m]=u,void 0===Et.pointShadowMatrix[m]&&(Et.pointShadowMatrix[m]=new a.Matrix4),St.setFromMatrixPosition(i.matrixWorld).negate(),Et.pointShadowMatrix[m].identity().setPosition(St),Et.point[m++]=y}else if(i instanceof a.HemisphereLight){var y=Ot.get(i);y.direction.setFromMatrixPosition(i.matrixWorld),y.direction.transformDirection(p),y.direction.normalize(),y.skyColor.copy(i.color).multiplyScalar(s),y.groundColor.copy(i.groundColor).multiplyScalar(s),Et.hemi[v++]=y}Et.ambient[0]=l,Et.ambient[1]=h,Et.ambient[2]=f,Et.directional.length=d,Et.spot.length=g,Et.point.length=m,Et.hemi.length=v,Et.hash=d+","+m+","+g+","+v+","+Et.shadows.length}function B(){var t=ut;return t>=Pt.maxTextures&&console.warn("WebGLRenderer: trying to use "+t+" texture units while this GPU supports only "+Pt.maxTextures),ut+=1,t}function I(t){var e;if(t===a.RepeatWrapping)return At.REPEAT;if(t===a.ClampToEdgeWrapping)return At.CLAMP_TO_EDGE;if(t===a.MirroredRepeatWrapping)return At.MIRRORED_REPEAT;if(t===a.NearestFilter)return At.NEAREST;if(t===a.NearestMipMapNearestFilter)return At.NEAREST_MIPMAP_NEAREST;if(t===a.NearestMipMapLinearFilter)return At.NEAREST_MIPMAP_LINEAR;if(t===a.LinearFilter)return At.LINEAR;if(t===a.LinearMipMapNearestFilter)return At.LINEAR_MIPMAP_NEAREST;if(t===a.LinearMipMapLinearFilter)return At.LINEAR_MIPMAP_LINEAR;if(t===a.UnsignedByteType)return At.UNSIGNED_BYTE;if(t===a.UnsignedShort4444Type)return At.UNSIGNED_SHORT_4_4_4_4;if(t===a.UnsignedShort5551Type)return At.UNSIGNED_SHORT_5_5_5_1;if(t===a.UnsignedShort565Type)return At.UNSIGNED_SHORT_5_6_5;if(t===a.ByteType)return At.BYTE;if(t===a.ShortType)return At.SHORT;if(t===a.UnsignedShortType)return At.UNSIGNED_SHORT;if(t===a.IntType)return At.INT;if(t===a.UnsignedIntType)return At.UNSIGNED_INT;if(t===a.FloatType)return At.FLOAT;if(e=Rt.get("OES_texture_half_float"),null!==e&&t===a.HalfFloatType)return e.HALF_FLOAT_OES;if(t===a.AlphaFormat)return At.ALPHA;if(t===a.RGBFormat)return At.RGB;if(t===a.RGBAFormat)return At.RGBA;if(t===a.LuminanceFormat)return At.LUMINANCE;if(t===a.LuminanceAlphaFormat)return At.LUMINANCE_ALPHA;if(t===a.DepthFormat)return At.DEPTH_COMPONENT;if(t===a.AddEquation)return At.FUNC_ADD;if(t===a.SubtractEquation)return At.FUNC_SUBTRACT;if(t===a.ReverseSubtractEquation)return At.FUNC_REVERSE_SUBTRACT;if(t===a.ZeroFactor)return At.ZERO;if(t===a.OneFactor)return At.ONE;if(t===a.SrcColorFactor)return At.SRC_COLOR;if(t===a.OneMinusSrcColorFactor)return At.ONE_MINUS_SRC_COLOR;if(t===a.SrcAlphaFactor)return At.SRC_ALPHA;if(t===a.OneMinusSrcAlphaFactor)return At.ONE_MINUS_SRC_ALPHA;if(t===a.DstAlphaFactor)return At.DST_ALPHA;if(t===a.OneMinusDstAlphaFactor)return At.ONE_MINUS_DST_ALPHA;if(t===a.DstColorFactor)return At.DST_COLOR;if(t===a.OneMinusDstColorFactor)return At.ONE_MINUS_DST_COLOR;if(t===a.SrcAlphaSaturateFactor)return At.SRC_ALPHA_SATURATE;if(e=Rt.get("WEBGL_compressed_texture_s3tc"),null!==e){if(t===a.RGB_S3TC_DXT1_Format)return e.COMPRESSED_RGB_S3TC_DXT1_EXT;if(t===a.RGBA_S3TC_DXT1_Format)return e.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(t===a.RGBA_S3TC_DXT3_Format)return e.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(t===a.RGBA_S3TC_DXT5_Format)return e.COMPRESSED_RGBA_S3TC_DXT5_EXT}if(e=Rt.get("WEBGL_compressed_texture_pvrtc"),null!==e){if(t===a.RGB_PVRTC_4BPPV1_Format)return e.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(t===a.RGB_PVRTC_2BPPV1_Format)return e.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(t===a.RGBA_PVRTC_4BPPV1_Format)return e.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(t===a.RGBA_PVRTC_2BPPV1_Format)return e.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}if(e=Rt.get("WEBGL_compressed_texture_etc1"),null!==e&&t===a.RGB_ETC1_Format)return e.COMPRESSED_RGB_ETC1_WEBGL;if(e=Rt.get("EXT_blend_minmax"),null!==e){if(t===a.MinEquation)return e.MIN_EXT;if(t===a.MaxEquation)return e.MAX_EXT}return 0}console.log("THREE.WebGLRenderer",a.REVISION),t=t||{};var O=void 0!==t.canvas?t.canvas:document.createElementNS("http://www.w3.org/1999/xhtml","canvas"),F=void 0!==t.context?t.context:null,V=void 0!==t.alpha&&t.alpha,G=void 0===t.depth||t.depth,k=void 0===t.stencil||t.stencil,z=void 0!==t.antialias&&t.antialias,H=void 0===t.premultipliedAlpha||t.premultipliedAlpha,j=void 0!==t.preserveDrawingBuffer&&t.preserveDrawingBuffer,W=[],X=[],q=-1,Y=[],Z=-1,K=new Float32Array(8),Q=[],J=[];this.domElement=O,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.LinearToneMapping,this.toneMappingExposure=1,this.toneMappingWhitePoint=1,this.maxMorphTargets=8,this.maxMorphNormals=4;
-var $=this,tt=null,et=null,nt=null,rt=-1,it="",at=null,ot=new a.Vector4,st=null,ct=new a.Vector4,ut=0,lt=new a.Color(0),ht=0,ft=O.width,pt=O.height,dt=1,mt=new a.Vector4(0,0,ft,pt),gt=!1,vt=new a.Vector4(0,0,ft,pt),yt=new a.Frustum,xt=new a.WebGLClipping,bt=!1,Mt=!1,_t=new a.Sphere,wt=new a.Matrix4,St=new a.Vector3,Et={hash:"",ambient:[0,0,0],directional:[],directionalShadowMap:[],directionalShadowMatrix:[],spot:[],spotShadowMap:[],spotShadowMatrix:[],point:[],pointShadowMap:[],pointShadowMatrix:[],hemi:[],shadows:[]},Tt={calls:0,vertices:0,faces:0,points:0};this.info={render:Tt,memory:{geometries:0,textures:0},programs:null};var At;try{var Lt={alpha:V,depth:G,stencil:k,antialias:z,premultipliedAlpha:H,preserveDrawingBuffer:j};if(At=F||O.getContext("webgl",Lt)||O.getContext("experimental-webgl",Lt),null===At)throw null!==O.getContext("webgl")?"Error creating WebGL context with your selected attributes.":"Error creating WebGL context.";void 0===At.getShaderPrecisionFormat&&(At.getShaderPrecisionFormat=function(){return{rangeMin:1,rangeMax:1,precision:1}}),O.addEventListener("webglcontextlost",o,!1)}catch(Ct){console.error("THREE.WebGLRenderer: "+Ct)}var Rt=new a.WebGLExtensions(At);Rt.get("WEBGL_depth_texture"),Rt.get("OES_texture_float"),Rt.get("OES_texture_float_linear"),Rt.get("OES_texture_half_float"),Rt.get("OES_texture_half_float_linear"),Rt.get("OES_standard_derivatives"),Rt.get("ANGLE_instanced_arrays"),Rt.get("OES_element_index_uint")&&(a.BufferGeometry.MaxIndex=4294967296);var Pt=new a.WebGLCapabilities(At,Rt,t),Dt=new a.WebGLState(At,Rt,I),Nt=new a.WebGLProperties,Ut=new a.WebGLTextures(At,Rt,Dt,Nt,Pt,I,this.info),Bt=new a.WebGLObjects(At,Nt,this.info),It=new a.WebGLPrograms(this,Pt),Ot=new a.WebGLLights;this.info.programs=It.programs;var Ft=new a.WebGLBufferRenderer(At,Rt,Tt),Vt=new a.WebGLIndexedBufferRenderer(At,Rt,Tt),Gt=new a.OrthographicCamera((-1),1,1,(-1),0,1),kt=new a.PerspectiveCamera,zt=new a.Mesh(new a.PlaneBufferGeometry(2,2),new a.MeshBasicMaterial({depthTest:!1,depthWrite:!1})),Ht=a.ShaderLib.cube,jt=new a.Mesh(new a.BoxBufferGeometry(5,5,5),new a.ShaderMaterial({uniforms:Ht.uniforms,vertexShader:Ht.vertexShader,fragmentShader:Ht.fragmentShader,depthTest:!1,depthWrite:!1,side:a.BackSide}));Bt.update(zt),Bt.update(jt),r(),this.context=At,this.capabilities=Pt,this.extensions=Rt,this.properties=Nt,this.state=Dt;var Wt=new a.WebGLShadowMap(this,Et,Bt);this.shadowMap=Wt;var Xt=new a.SpritePlugin(this,Q),qt=new a.LensFlarePlugin(this,J);this.getContext=function(){return At},this.getContextAttributes=function(){return At.getContextAttributes()},this.forceContextLoss=function(){Rt.get("WEBGL_lose_context").loseContext()},this.getMaxAnisotropy=function(){return Pt.getMaxAnisotropy()},this.getPrecision=function(){return Pt.precision},this.getPixelRatio=function(){return dt},this.setPixelRatio=function(t){void 0!==t&&(dt=t,this.setSize(vt.z,vt.w,!1))},this.getSize=function(){return{width:ft,height:pt}},this.setSize=function(t,e,n){ft=t,pt=e,O.width=t*dt,O.height=e*dt,n!==!1&&(O.style.width=t+"px",O.style.height=e+"px"),this.setViewport(0,0,t,e)},this.setViewport=function(t,e,n,r){Dt.viewport(vt.set(t,e,n,r))},this.setScissor=function(t,e,n,r){Dt.scissor(mt.set(t,e,n,r))},this.setScissorTest=function(t){Dt.setScissorTest(gt=t)},this.getClearColor=function(){return lt},this.setClearColor=function(t,e){lt.set(t),ht=void 0!==e?e:1,n(lt.r,lt.g,lt.b,ht)},this.getClearAlpha=function(){return ht},this.setClearAlpha=function(t){ht=t,n(lt.r,lt.g,lt.b,ht)},this.clear=function(t,e,n){var r=0;(void 0===t||t)&&(r|=At.COLOR_BUFFER_BIT),(void 0===e||e)&&(r|=At.DEPTH_BUFFER_BIT),(void 0===n||n)&&(r|=At.STENCIL_BUFFER_BIT),At.clear(r)},this.clearColor=function(){this.clear(!0,!1,!1)},this.clearDepth=function(){this.clear(!1,!0,!1)},this.clearStencil=function(){this.clear(!1,!1,!0)},this.clearTarget=function(t,e,n,r){this.setRenderTarget(t),this.clear(e,n,r)},this.resetGLState=i,this.dispose=function(){Y=[],Z=-1,X=[],q=-1,O.removeEventListener("webglcontextlost",o,!1)},this.renderBufferImmediate=function(t,e,n){Dt.initAttributes();var r=Nt.get(t);t.hasPositions&&!r.position&&(r.position=At.createBuffer()),t.hasNormals&&!r.normal&&(r.normal=At.createBuffer()),t.hasUvs&&!r.uv&&(r.uv=At.createBuffer()),t.hasColors&&!r.color&&(r.color=At.createBuffer());var i=e.getAttributes();if(t.hasPositions&&(At.bindBuffer(At.ARRAY_BUFFER,r.position),At.bufferData(At.ARRAY_BUFFER,t.positionArray,At.DYNAMIC_DRAW),Dt.enableAttribute(i.position),At.vertexAttribPointer(i.position,3,At.FLOAT,!1,0,0)),t.hasNormals){if(At.bindBuffer(At.ARRAY_BUFFER,r.normal),"MeshPhongMaterial"!==n.type&&"MeshStandardMaterial"!==n.type&&"MeshPhysicalMaterial"!==n.type&&n.shading===a.FlatShading)for(var o=0,s=3*t.count;o<s;o+=9){var c=t.normalArray,u=(c[o+0]+c[o+3]+c[o+6])/3,l=(c[o+1]+c[o+4]+c[o+7])/3,h=(c[o+2]+c[o+5]+c[o+8])/3;c[o+0]=u,c[o+1]=l,c[o+2]=h,c[o+3]=u,c[o+4]=l,c[o+5]=h,c[o+6]=u,c[o+7]=l,c[o+8]=h}At.bufferData(At.ARRAY_BUFFER,t.normalArray,At.DYNAMIC_DRAW),Dt.enableAttribute(i.normal),At.vertexAttribPointer(i.normal,3,At.FLOAT,!1,0,0)}t.hasUvs&&n.map&&(At.bindBuffer(At.ARRAY_BUFFER,r.uv),At.bufferData(At.ARRAY_BUFFER,t.uvArray,At.DYNAMIC_DRAW),Dt.enableAttribute(i.uv),At.vertexAttribPointer(i.uv,2,At.FLOAT,!1,0,0)),t.hasColors&&n.vertexColors!==a.NoColors&&(At.bindBuffer(At.ARRAY_BUFFER,r.color),At.bufferData(At.ARRAY_BUFFER,t.colorArray,At.DYNAMIC_DRAW),Dt.enableAttribute(i.color),At.vertexAttribPointer(i.color,3,At.FLOAT,!1,0,0)),Dt.disableUnusedAttributes(),At.drawArrays(At.TRIANGLES,0,t.count),t.count=0},this.renderBufferDirect=function(t,n,r,i,o,s){M(i);var c=_(t,n,i,o),u=!1,f=r.id+"_"+c.id+"_"+i.wireframe;f!==it&&(it=f,u=!0);var p=o.morphTargetInfluences;if(void 0!==p){for(var d=[],m=0,g=p.length;m<g;m++){var v=p[m];d.push([v,m])}d.sort(h),d.length>8&&(d.length=8);for(var y=r.morphAttributes,m=0,g=d.length;m<g;m++){var v=d[m];if(K[m]=v[0],0!==v[0]){var x=v[1];i.morphTargets===!0&&y.position&&r.addAttribute("morphTarget"+m,y.position[x]),i.morphNormals===!0&&y.normal&&r.addAttribute("morphNormal"+m,y.normal[x])}else i.morphTargets===!0&&r.removeAttribute("morphTarget"+m),i.morphNormals===!0&&r.removeAttribute("morphNormal"+m)}c.getUniforms().setValue(At,"morphTargetInfluences",K),u=!0}var x=r.index,b=r.attributes.position;i.wireframe===!0&&(x=Bt.getWireframeAttribute(r));var w;null!==x?(w=Vt,w.setIndex(x)):w=Ft,u&&(l(i,c,r),null!==x&&At.bindBuffer(At.ELEMENT_ARRAY_BUFFER,Bt.getAttributeBuffer(x)));var S=0,E=1/0;null!==x?E=x.count:void 0!==b&&(E=b.count);var T=r.drawRange.start,A=r.drawRange.count,L=null!==s?s.start:0,C=null!==s?s.count:1/0,R=Math.max(S,T,L),P=Math.min(S+E,T+A,L+C)-1,D=Math.max(0,P-R+1);if(o instanceof a.Mesh)if(i.wireframe===!0)Dt.setLineWidth(i.wireframeLinewidth*e()),w.setMode(At.LINES);else switch(o.drawMode){case a.TrianglesDrawMode:w.setMode(At.TRIANGLES);break;case a.TriangleStripDrawMode:w.setMode(At.TRIANGLE_STRIP);break;case a.TriangleFanDrawMode:w.setMode(At.TRIANGLE_FAN)}else if(o instanceof a.Line){var N=i.linewidth;void 0===N&&(N=1),Dt.setLineWidth(N*e()),o instanceof a.LineSegments?w.setMode(At.LINES):w.setMode(At.LINE_STRIP)}else o instanceof a.Points&&w.setMode(At.POINTS);r instanceof a.InstancedBufferGeometry?r.maxInstancedCount>0&&w.renderInstances(r,R,D):w.render(R,D)},this.render=function(t,e,r,i){if(e instanceof a.Camera==!1)return void console.error("THREE.WebGLRenderer.render: camera is not an instance of THREE.Camera.");var o=t.fog;it="",rt=-1,at=null,t.autoUpdate===!0&&t.updateMatrixWorld(),null===e.parent&&e.updateMatrixWorld(),e.matrixWorldInverse.getInverse(e.matrixWorld),wt.multiplyMatrices(e.projectionMatrix,e.matrixWorldInverse),yt.setFromMatrix(wt),W.length=0,q=-1,Z=-1,Q.length=0,J.length=0,Mt=this.localClippingEnabled,bt=xt.init(this.clippingPlanes,Mt,e),y(t,e),X.length=q+1,Y.length=Z+1,$.sortObjects===!0&&(X.sort(f),Y.sort(p)),bt&&xt.beginShadows(),N(W),Wt.render(t,e),U(W,e),bt&&xt.endShadows(),Tt.calls=0,Tt.vertices=0,Tt.faces=0,Tt.points=0,void 0===r&&(r=null),this.setRenderTarget(r);var s=t.background;if(null===s?n(lt.r,lt.g,lt.b,ht):s instanceof a.Color&&n(s.r,s.g,s.b,1),(this.autoClear||i)&&this.clear(this.autoClearColor,this.autoClearDepth,this.autoClearStencil),s instanceof a.CubeTexture?(kt.projectionMatrix.copy(e.projectionMatrix),kt.matrixWorld.extractRotation(e.matrixWorld),kt.matrixWorldInverse.getInverse(kt.matrixWorld),jt.material.uniforms.tCube.value=s,jt.modelViewMatrix.multiplyMatrices(kt.matrixWorldInverse,jt.matrixWorld),$.renderBufferDirect(kt,null,jt.geometry,jt.material,jt,null)):s instanceof a.Texture&&(zt.material.map=s,$.renderBufferDirect(Gt,null,zt.geometry,zt.material,zt,null)),t.overrideMaterial){var c=t.overrideMaterial;x(X,e,o,c),x(Y,e,o,c)}else Dt.setBlending(a.NoBlending),x(X,e,o),x(Y,e,o);Xt.render(t,e),qt.render(t,e,ct),r&&Ut.updateRenderTargetMipmap(r),Dt.setDepthTest(!0),Dt.setDepthWrite(!0),Dt.setColorWrite(!0)},this.setFaceCulling=function(t,e){Dt.setCullFace(t),Dt.setFlipSided(e===a.FrontFaceDirectionCW)},this.allocTextureUnit=B,this.setTexture2D=function(){var t=!1;return function(e,n){e instanceof a.WebGLRenderTarget&&(t||(console.warn("THREE.WebGLRenderer.setTexture2D: don't use render targets as textures. Use their .texture property instead."),t=!0),e=e.texture),Ut.setTexture2D(e,n)}}(),this.setTexture=function(){var t=!1;return function(e,n){t||(console.warn("THREE.WebGLRenderer: .setTexture is deprecated, use setTexture2D instead."),t=!0),Ut.setTexture2D(e,n)}}(),this.setTextureCube=function(){var t=!1;return function(e,n){e instanceof a.WebGLRenderTargetCube&&(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 instanceof a.CubeTexture||Array.isArray(e.image)&&6===e.image.length?Ut.setTextureCube(e,n):Ut.setTextureCubeDynamic(e,n)}}(),this.getCurrentRenderTarget=function(){return et},this.setRenderTarget=function(t){et=t,t&&void 0===Nt.get(t).__webglFramebuffer&&Ut.setupRenderTarget(t);var e,n=t instanceof a.WebGLRenderTargetCube;if(t){var r=Nt.get(t);e=n?r.__webglFramebuffer[t.activeCubeFace]:r.__webglFramebuffer,ot.copy(t.scissor),st=t.scissorTest,ct.copy(t.viewport)}else e=null,ot.copy(mt).multiplyScalar(dt),st=gt,ct.copy(vt).multiplyScalar(dt);if(nt!==e&&(At.bindFramebuffer(At.FRAMEBUFFER,e),nt=e),Dt.scissor(ot),Dt.setScissorTest(st),Dt.viewport(ct),n){var i=Nt.get(t.texture);At.framebufferTexture2D(At.FRAMEBUFFER,At.COLOR_ATTACHMENT0,At.TEXTURE_CUBE_MAP_POSITIVE_X+t.activeCubeFace,i.__webglTexture,t.activeMipMapLevel)}},this.readRenderTargetPixels=function(t,e,n,r,i,o){if(t instanceof a.WebGLRenderTarget==!1)return void console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");var s=Nt.get(t).__webglFramebuffer;if(s){var c=!1;s!==nt&&(At.bindFramebuffer(At.FRAMEBUFFER,s),c=!0);try{var u=t.texture;if(u.format!==a.RGBAFormat&&I(u.format)!==At.getParameter(At.IMPLEMENTATION_COLOR_READ_FORMAT))return void console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.");if(!(u.type===a.UnsignedByteType||I(u.type)===At.getParameter(At.IMPLEMENTATION_COLOR_READ_TYPE)||u.type===a.FloatType&&Rt.get("WEBGL_color_buffer_float")||u.type===a.HalfFloatType&&Rt.get("EXT_color_buffer_half_float")))return void console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.");At.checkFramebufferStatus(At.FRAMEBUFFER)===At.FRAMEBUFFER_COMPLETE?e>=0&&e<=t.width-r&&n>=0&&n<=t.height-i&&At.readPixels(e,n,r,i,I(u.format),I(u.type),o):console.error("THREE.WebGLRenderer.readRenderTargetPixels: readPixels from renderTarget failed. Framebuffer not complete.")}finally{c&&At.bindFramebuffer(At.FRAMEBUFFER,nt)}}}},a.WebGLRenderTarget=function(t,e,n){this.uuid=a.Math.generateUUID(),this.width=t,this.height=e,this.scissor=new a.Vector4(0,0,t,e),this.scissorTest=!1,this.viewport=new a.Vector4(0,0,t,e),n=n||{},void 0===n.minFilter&&(n.minFilter=a.LinearFilter),this.texture=new a.Texture((void 0),(void 0),n.wrapS,n.wrapT,n.magFilter,n.minFilter,n.format,n.type,n.anisotropy,n.encoding),this.depthBuffer=void 0===n.depthBuffer||n.depthBuffer,this.stencilBuffer=void 0===n.stencilBuffer||n.stencilBuffer,this.depthTexture=null},Object.assign(a.WebGLRenderTarget.prototype,a.EventDispatcher.prototype,{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"})}}),a.WebGLRenderTargetCube=function(t,e,n){a.WebGLRenderTarget.call(this,t,e,n),this.activeCubeFace=0,this.activeMipMapLevel=0},a.WebGLRenderTargetCube.prototype=Object.create(a.WebGLRenderTarget.prototype),a.WebGLRenderTargetCube.prototype.constructor=a.WebGLRenderTargetCube,a.WebGLBufferRenderer=function(t,e,n){function r(t){s=t}function i(e,r){t.drawArrays(s,e,r),n.calls++,n.vertices+=r,s===t.TRIANGLES&&(n.faces+=r/3)}function o(r){var i=e.get("ANGLE_instanced_arrays");if(null===i)return void console.error("THREE.WebGLBufferRenderer: using THREE.InstancedBufferGeometry but hardware does not support extension ANGLE_instanced_arrays.");var o=r.attributes.position,c=0;o instanceof a.InterleavedBufferAttribute?(c=o.data.count,i.drawArraysInstancedANGLE(s,0,c,r.maxInstancedCount)):(c=o.count,i.drawArraysInstancedANGLE(s,0,c,r.maxInstancedCount)),n.calls++,n.vertices+=c*r.maxInstancedCount,s===t.TRIANGLES&&(n.faces+=r.maxInstancedCount*c/3)}var s;this.setMode=r,this.render=i,this.renderInstances=o},a.WebGLClipping=function(){function t(){l.value!==r&&(l.value=r,l.needsUpdate=i>0),n.numPlanes=i}function e(t,e,r,i){var a=null!==t?t.length:0,o=null;if(0!==a){if(o=l.value,i!==!0||null===o){var s=r+4*a,h=e.matrixWorldInverse;u.getNormalMatrix(h),(null===o||o.length<s)&&(o=new Float32Array(s));for(var f=0,p=r;f!==a;++f,p+=4)c.copy(t[f]).applyMatrix4(h,u),c.normal.toArray(o,p),o[p+3]=c.constant}l.value=o,l.needsUpdate=!0}return n.numPlanes=a,o}var n=this,r=null,i=0,o=!1,s=!1,c=new a.Plane,u=new a.Matrix3,l={value:null,needsUpdate:!1};this.uniform=l,this.numPlanes=0,this.init=function(t,n,a){var s=0!==t.length||n||0!==i||o;return o=n,r=e(t,a,0),i=t.length,s},this.beginShadows=function(){s=!0,e(null)},this.endShadows=function(){s=!1,t()},this.setState=function(n,a,c,u,h){if(!o||null===n||0===n.length||s&&!a)s?e(null):t();else{var f=s?0:i,p=4*f,d=u.clippingState||null;l.value=d,d=e(n,c,p,h);for(var m=0;m!==p;++m)d[m]=r[m];u.clippingState=d,this.numPlanes+=f}}},a.WebGLIndexedBufferRenderer=function(t,e,n){function r(t){s=t}function i(n){n.array instanceof Uint32Array&&e.get("OES_element_index_uint")?(c=t.UNSIGNED_INT,u=4):(c=t.UNSIGNED_SHORT,u=2)}function a(e,r){t.drawElements(s,r,c,e*u),n.calls++,n.vertices+=r,s===t.TRIANGLES&&(n.faces+=r/3)}function o(r,i,a){var o=e.get("ANGLE_instanced_arrays");return null===o?void console.error("THREE.WebGLBufferRenderer: using THREE.InstancedBufferGeometry but hardware does not support extension ANGLE_instanced_arrays."):(o.drawElementsInstancedANGLE(s,a,c,i*u,r.maxInstancedCount),n.calls++,n.vertices+=a*r.maxInstancedCount,void(s===t.TRIANGLES&&(n.faces+=r.maxInstancedCount*a/3)))}var s,c,u;this.setMode=r,this.setIndex=i,this.render=a,this.renderInstances=o},a.WebGLExtensions=function(t){var e={};this.get=function(n){if(void 0!==e[n])return e[n];var r;switch(n){case"WEBGL_depth_texture":r=t.getExtension("WEBGL_depth_texture")||t.getExtension("MOZ_WEBGL_depth_texture")||t.getExtension("WEBKIT_WEBGL_depth_texture");break;case"EXT_texture_filter_anisotropic":r=t.getExtension("EXT_texture_filter_anisotropic")||t.getExtension("MOZ_EXT_texture_filter_anisotropic")||t.getExtension("WEBKIT_EXT_texture_filter_anisotropic");break;case"WEBGL_compressed_texture_s3tc":r=t.getExtension("WEBGL_compressed_texture_s3tc")||t.getExtension("MOZ_WEBGL_compressed_texture_s3tc")||t.getExtension("WEBKIT_WEBGL_compressed_texture_s3tc");break;case"WEBGL_compressed_texture_pvrtc":r=t.getExtension("WEBGL_compressed_texture_pvrtc")||t.getExtension("WEBKIT_WEBGL_compressed_texture_pvrtc");break;case"WEBGL_compressed_texture_etc1":r=t.getExtension("WEBGL_compressed_texture_etc1");break;default:r=t.getExtension(n)}return null===r&&console.warn("THREE.WebGLRenderer: "+n+" extension not supported."),e[n]=r,r}},a.WebGLCapabilities=function(t,e,n){function r(){if(void 0!==a)return a;var n=e.get("EXT_texture_filter_anisotropic");return a=null!==n?t.getParameter(n.MAX_TEXTURE_MAX_ANISOTROPY_EXT):0}function i(e){if("highp"===e){if(t.getShaderPrecisionFormat(t.VERTEX_SHADER,t.HIGH_FLOAT).precision>0&&t.getShaderPrecisionFormat(t.FRAGMENT_SHADER,t.HIGH_FLOAT).precision>0)return"highp";e="mediump"}return"mediump"===e&&t.getShaderPrecisionFormat(t.VERTEX_SHADER,t.MEDIUM_FLOAT).precision>0&&t.getShaderPrecisionFormat(t.FRAGMENT_SHADER,t.MEDIUM_FLOAT).precision>0?"mediump":"lowp"}var a;this.getMaxAnisotropy=r,this.getMaxPrecision=i,this.precision=void 0!==n.precision?n.precision:"highp",this.logarithmicDepthBuffer=void 0!==n.logarithmicDepthBuffer&&n.logarithmicDepthBuffer,this.maxTextures=t.getParameter(t.MAX_TEXTURE_IMAGE_UNITS),this.maxVertexTextures=t.getParameter(t.MAX_VERTEX_TEXTURE_IMAGE_UNITS),this.maxTextureSize=t.getParameter(t.MAX_TEXTURE_SIZE),this.maxCubemapSize=t.getParameter(t.MAX_CUBE_MAP_TEXTURE_SIZE),this.maxAttributes=t.getParameter(t.MAX_VERTEX_ATTRIBS),this.maxVertexUniforms=t.getParameter(t.MAX_VERTEX_UNIFORM_VECTORS),this.maxVaryings=t.getParameter(t.MAX_VARYING_VECTORS),this.maxFragmentUniforms=t.getParameter(t.MAX_FRAGMENT_UNIFORM_VECTORS),this.vertexTextures=this.maxVertexTextures>0,this.floatFragmentTextures=!!e.get("OES_texture_float"),this.floatVertexTextures=this.vertexTextures&&this.floatFragmentTextures;var o=i(this.precision);o!==this.precision&&(console.warn("THREE.WebGLRenderer:",this.precision,"not supported, using",o,"instead."),this.precision=o),this.logarithmicDepthBuffer&&(this.logarithmicDepthBuffer=!!e.get("EXT_frag_depth"))},a.WebGLGeometries=function(t,e,n){function r(t){var e=t.geometry;if(void 0!==l[e.id])return l[e.id];e.addEventListener("dispose",i);var r;return e instanceof a.BufferGeometry?r=e:e instanceof a.Geometry&&(void 0===e._bufferGeometry&&(e._bufferGeometry=(new a.BufferGeometry).setFromObject(t)),r=e._bufferGeometry),l[e.id]=r,n.memory.geometries++,r}function i(t){var r=t.target,a=l[r.id];null!==a.index&&s(a.index),c(a.attributes),r.removeEventListener("dispose",i),delete l[r.id];var o=e.get(r);o.wireframe&&s(o.wireframe),e["delete"](r);var u=e.get(a);u.wireframe&&s(u.wireframe),e["delete"](a),n.memory.geometries--}function o(t){return t instanceof a.InterleavedBufferAttribute?e.get(t.data).__webglBuffer:e.get(t).__webglBuffer}function s(e){var n=o(e);void 0!==n&&(t.deleteBuffer(n),u(e))}function c(t){for(var e in t)s(t[e])}function u(t){t instanceof a.InterleavedBufferAttribute?e["delete"](t.data):e["delete"](t)}var l={};this.get=r},a.WebGLLights=function(){var t={};this.get=function(e){if(void 0!==t[e.id])return t[e.id];var n;switch(e.type){case"DirectionalLight":n={direction:new a.Vector3,color:new a.Color,shadow:!1,shadowBias:0,shadowRadius:1,shadowMapSize:new a.Vector2};break;case"SpotLight":n={position:new a.Vector3,direction:new a.Vector3,color:new a.Color,distance:0,coneCos:0,penumbraCos:0,decay:0,shadow:!1,shadowBias:0,shadowRadius:1,shadowMapSize:new a.Vector2};break;case"PointLight":n={position:new a.Vector3,color:new a.Color,distance:0,decay:0,shadow:!1,shadowBias:0,shadowRadius:1,shadowMapSize:new a.Vector2};break;case"HemisphereLight":n={direction:new a.Vector3,skyColor:new a.Color,groundColor:new a.Color}}return t[e.id]=n,n}},a.WebGLObjects=function(t,e,n){function r(e){var n=h.get(e);e.geometry instanceof a.Geometry&&n.updateFromObject(e);var r=n.index,o=n.attributes;null!==r&&i(r,t.ELEMENT_ARRAY_BUFFER);for(var s in o)i(o[s],t.ARRAY_BUFFER);var c=n.morphAttributes;for(var s in c)for(var u=c[s],l=0,f=u.length;l<f;l++)i(u[l],t.ARRAY_BUFFER);return n}function i(t,n){var r=t instanceof a.InterleavedBufferAttribute?t.data:t,i=e.get(r);void 0===i.__webglBuffer?o(i,r,n):i.version!==r.version&&s(i,r,n)}function o(e,n,r){e.__webglBuffer=t.createBuffer(),t.bindBuffer(r,e.__webglBuffer);var i=n.dynamic?t.DYNAMIC_DRAW:t.STATIC_DRAW;t.bufferData(r,n.array,i),e.version=n.version}function s(e,n,r){t.bindBuffer(r,e.__webglBuffer),n.dynamic===!1||n.updateRange.count===-1?t.bufferSubData(r,0,n.array):0===n.updateRange.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(r,n.updateRange.offset*n.array.BYTES_PER_ELEMENT,n.array.subarray(n.updateRange.offset,n.updateRange.offset+n.updateRange.count)),n.updateRange.count=0),e.version=n.version}function c(t){return t instanceof a.InterleavedBufferAttribute?e.get(t.data).__webglBuffer:e.get(t).__webglBuffer}function u(n){var r=e.get(n);if(void 0!==r.wireframe)return r.wireframe;var o=[],s=n.index,c=n.attributes,u=c.position;if(null!==s)for(var h={},f=s.array,p=0,d=f.length;p<d;p+=3){var m=f[p+0],g=f[p+1],v=f[p+2];l(h,m,g)&&o.push(m,g),l(h,g,v)&&o.push(g,v),l(h,v,m)&&o.push(v,m)}else for(var f=c.position.array,p=0,d=f.length/3-1;p<d;p+=3){var m=p+0,g=p+1,v=p+2;o.push(m,g,g,v,v,m)}var y=u.count>65535?Uint32Array:Uint16Array,x=new a.BufferAttribute(new y(o),1);return i(x,t.ELEMENT_ARRAY_BUFFER),r.wireframe=x,x}function l(t,e,n){if(e>n){var r=e;e=n,n=r}var i=t[e];return void 0===i?(t[e]=[n],!0):i.indexOf(n)===-1&&(i.push(n),!0)}var h=new a.WebGLGeometries(t,e,n);this.getAttributeBuffer=c,this.getWireframeAttribute=u,this.update=r},a.WebGLProgram=function(){function t(t){switch(t){case a.LinearEncoding:return["Linear","( value )"];case a.sRGBEncoding:return["sRGB","( value )"];case a.RGBEEncoding:return["RGBE","( value )"];case a.RGBM7Encoding:return["RGBM","( value, 7.0 )"];case a.RGBM16Encoding:return["RGBM","( value, 16.0 )"];case a.RGBDEncoding:return["RGBD","( value, 256.0 )"];case a.GammaEncoding:return["Gamma","( value, float( GAMMA_FACTOR ) )"];default:throw new Error("unsupported encoding: "+t)}}function e(e,n){var r=t(n);return"vec4 "+e+"( vec4 value ) { return "+r[0]+"ToLinear"+r[1]+"; }"}function n(e,n){var r=t(n);return"vec4 "+e+"( vec4 value ) { return LinearTo"+r[0]+r[1]+"; }"}function r(t,e){var n;switch(e){case a.LinearToneMapping:n="Linear";break;case a.ReinhardToneMapping:n="Reinhard";break;case a.Uncharted2ToneMapping:n="Uncharted2";break;case a.CineonToneMapping:n="OptimizedCineon";break;default:throw new Error("unsupported toneMapping: "+e)}return"vec3 "+t+"( vec3 color ) { return "+n+"ToneMapping( color ); }"}function i(t,e,n){t=t||{};var r=[t.derivatives||e.envMapCubeUV||e.bumpMap||e.normalMap||e.flatShading?"#extension GL_OES_standard_derivatives : enable":"",(t.fragDepth||e.logarithmicDepthBuffer)&&n.get("EXT_frag_depth")?"#extension GL_EXT_frag_depth : enable":"",t.drawBuffers&&n.get("WEBGL_draw_buffers")?"#extension GL_EXT_draw_buffers : require":"",(t.shaderTextureLOD||e.envMap)&&n.get("EXT_shader_texture_lod")?"#extension GL_EXT_shader_texture_lod : enable":""];return r.filter(c).join("\n")}function o(t){var e=[];for(var n in t){var r=t[n];r!==!1&&e.push("#define "+n+" "+r)}return e.join("\n")}function s(t,e,n){for(var r={},i=t.getProgramParameter(e,t.ACTIVE_ATTRIBUTES),a=0;a<i;a++){var o=t.getActiveAttrib(e,a),s=o.name;r[s]=t.getAttribLocation(e,s)}return r}function c(t){return""!==t}function u(t,e){return t.replace(/NUM_DIR_LIGHTS/g,e.numDirLights).replace(/NUM_SPOT_LIGHTS/g,e.numSpotLights).replace(/NUM_POINT_LIGHTS/g,e.numPointLights).replace(/NUM_HEMI_LIGHTS/g,e.numHemiLights)}function l(t){function e(t,e){var n=a.ShaderChunk[e];if(void 0===n)throw new Error("Can not resolve #include <"+e+">");return l(n)}var n=/#include +<([\w\d.]+)>/g;return t.replace(n,e)}function h(t){function e(t,e,n,r){for(var i="",a=parseInt(e);a<parseInt(n);a++)i+=r.replace(/\[ i \]/g,"[ "+a+" ]");return i}var n=/for \( int i \= (\d+)\; i < (\d+)\; i \+\+ \) \{([\s\S]+?)(?=\})\}/g;return t.replace(n,e)}var f=0;return function(t,p,d,m){var g=t.context,v=d.extensions,y=d.defines,x=d.__webglShader.vertexShader,b=d.__webglShader.fragmentShader,M="SHADOWMAP_TYPE_BASIC";m.shadowMapType===a.PCFShadowMap?M="SHADOWMAP_TYPE_PCF":m.shadowMapType===a.PCFSoftShadowMap&&(M="SHADOWMAP_TYPE_PCF_SOFT");var _="ENVMAP_TYPE_CUBE",w="ENVMAP_MODE_REFLECTION",S="ENVMAP_BLENDING_MULTIPLY";if(m.envMap){switch(d.envMap.mapping){case a.CubeReflectionMapping:case a.CubeRefractionMapping:_="ENVMAP_TYPE_CUBE";break;case a.CubeUVReflectionMapping:case a.CubeUVRefractionMapping:_="ENVMAP_TYPE_CUBE_UV";break;case a.EquirectangularReflectionMapping:case a.EquirectangularRefractionMapping:_="ENVMAP_TYPE_EQUIREC";break;case a.SphericalReflectionMapping:_="ENVMAP_TYPE_SPHERE"}switch(d.envMap.mapping){case a.CubeRefractionMapping:case a.EquirectangularRefractionMapping:w="ENVMAP_MODE_REFRACTION"}switch(d.combine){case a.MultiplyOperation:S="ENVMAP_BLENDING_MULTIPLY";break;case a.MixOperation:S="ENVMAP_BLENDING_MIX";break;case a.AddOperation:S="ENVMAP_BLENDING_ADD"}}var E,T,A=t.gammaFactor>0?t.gammaFactor:1,L=i(v,m,t.extensions),C=o(y),R=g.createProgram();d instanceof a.RawShaderMaterial?(E=[C].filter(c).join("\n"),T=[C].filter(c).join("\n")):(E=["precision "+m.precision+" float;","precision "+m.precision+" int;","#define SHADER_NAME "+d.__webglShader.name,C,m.supportsVertexTextures?"#define VERTEX_TEXTURES":"","#define GAMMA_FACTOR "+A,"#define MAX_BONES "+m.maxBones,m.map?"#define USE_MAP":"",m.envMap?"#define USE_ENVMAP":"",m.envMap?"#define "+w:"",m.lightMap?"#define USE_LIGHTMAP":"",m.aoMap?"#define USE_AOMAP":"",m.emissiveMap?"#define USE_EMISSIVEMAP":"",m.bumpMap?"#define USE_BUMPMAP":"",m.normalMap?"#define USE_NORMALMAP":"",m.displacementMap&&m.supportsVertexTextures?"#define USE_DISPLACEMENTMAP":"",m.specularMap?"#define USE_SPECULARMAP":"",m.roughnessMap?"#define USE_ROUGHNESSMAP":"",m.metalnessMap?"#define USE_METALNESSMAP":"",m.alphaMap?"#define USE_ALPHAMAP":"",m.vertexColors?"#define USE_COLOR":"",m.flatShading?"#define FLAT_SHADED":"",m.skinning?"#define USE_SKINNING":"",m.useVertexTexture?"#define BONE_TEXTURE":"",m.morphTargets?"#define USE_MORPHTARGETS":"",m.morphNormals&&m.flatShading===!1?"#define USE_MORPHNORMALS":"",m.doubleSided?"#define DOUBLE_SIDED":"",m.flipSided?"#define FLIP_SIDED":"","#define NUM_CLIPPING_PLANES "+m.numClippingPlanes,m.shadowMapEnabled?"#define USE_SHADOWMAP":"",m.shadowMapEnabled?"#define "+M:"",m.sizeAttenuation?"#define USE_SIZEATTENUATION":"",m.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",m.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(c).join("\n"),T=[L,"precision "+m.precision+" float;","precision "+m.precision+" int;","#define SHADER_NAME "+d.__webglShader.name,C,m.alphaTest?"#define ALPHATEST "+m.alphaTest:"","#define GAMMA_FACTOR "+A,m.useFog&&m.fog?"#define USE_FOG":"",m.useFog&&m.fogExp?"#define FOG_EXP2":"",m.map?"#define USE_MAP":"",m.envMap?"#define USE_ENVMAP":"",m.envMap?"#define "+_:"",m.envMap?"#define "+w:"",m.envMap?"#define "+S:"",m.lightMap?"#define USE_LIGHTMAP":"",m.aoMap?"#define USE_AOMAP":"",m.emissiveMap?"#define USE_EMISSIVEMAP":"",m.bumpMap?"#define USE_BUMPMAP":"",m.normalMap?"#define USE_NORMALMAP":"",m.specularMap?"#define USE_SPECULARMAP":"",m.roughnessMap?"#define USE_ROUGHNESSMAP":"",m.metalnessMap?"#define USE_METALNESSMAP":"",m.alphaMap?"#define USE_ALPHAMAP":"",m.vertexColors?"#define USE_COLOR":"",m.flatShading?"#define FLAT_SHADED":"",m.doubleSided?"#define DOUBLE_SIDED":"",m.flipSided?"#define FLIP_SIDED":"","#define NUM_CLIPPING_PLANES "+m.numClippingPlanes,m.shadowMapEnabled?"#define USE_SHADOWMAP":"",m.shadowMapEnabled?"#define "+M:"",m.premultipliedAlpha?"#define PREMULTIPLIED_ALPHA":"",m.physicallyCorrectLights?"#define PHYSICALLY_CORRECT_LIGHTS":"",m.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",m.logarithmicDepthBuffer&&t.extensions.get("EXT_frag_depth")?"#define USE_LOGDEPTHBUF_EXT":"",m.envMap&&t.extensions.get("EXT_shader_texture_lod")?"#define TEXTURE_LOD_EXT":"","uniform mat4 viewMatrix;","uniform vec3 cameraPosition;",m.toneMapping!==a.NoToneMapping?"#define TONE_MAPPING":"",m.toneMapping!==a.NoToneMapping?a.ShaderChunk.tonemapping_pars_fragment:"",m.toneMapping!==a.NoToneMapping?r("toneMapping",m.toneMapping):"",m.outputEncoding||m.mapEncoding||m.envMapEncoding||m.emissiveMapEncoding?a.ShaderChunk.encodings_pars_fragment:"",m.mapEncoding?e("mapTexelToLinear",m.mapEncoding):"",m.envMapEncoding?e("envMapTexelToLinear",m.envMapEncoding):"",m.emissiveMapEncoding?e("emissiveMapTexelToLinear",m.emissiveMapEncoding):"",m.outputEncoding?n("linearToOutputTexel",m.outputEncoding):"",m.depthPacking?"#define DEPTH_PACKING "+d.depthPacking:"","\n"].filter(c).join("\n")),x=l(x,m),x=u(x,m),b=l(b,m),b=u(b,m),d instanceof a.ShaderMaterial==!1&&(x=h(x),b=h(b));var P=E+x,D=T+b,N=a.WebGLShader(g,g.VERTEX_SHADER,P),U=a.WebGLShader(g,g.FRAGMENT_SHADER,D);g.attachShader(R,N),g.attachShader(R,U),void 0!==d.index0AttributeName?g.bindAttribLocation(R,0,d.index0AttributeName):m.morphTargets===!0&&g.bindAttribLocation(R,0,"position"),g.linkProgram(R);var B=g.getProgramInfoLog(R),I=g.getShaderInfoLog(N),O=g.getShaderInfoLog(U),F=!0,V=!0;g.getProgramParameter(R,g.LINK_STATUS)===!1?(F=!1,console.error("THREE.WebGLProgram: shader error: ",g.getError(),"gl.VALIDATE_STATUS",g.getProgramParameter(R,g.VALIDATE_STATUS),"gl.getProgramInfoLog",B,I,O)):""!==B?console.warn("THREE.WebGLProgram: gl.getProgramInfoLog()",B):""!==I&&""!==O||(V=!1),V&&(this.diagnostics={runnable:F,material:d,programLog:B,vertexShader:{log:I,prefix:E},fragmentShader:{log:O,prefix:T}}),g.deleteShader(N),g.deleteShader(U);var G;this.getUniforms=function(){return void 0===G&&(G=new a.WebGLUniforms(g,R,t)),G};var k;return this.getAttributes=function(){return void 0===k&&(k=s(g,R)),k},this.destroy=function(){g.deleteProgram(R),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=f++,this.code=p,this.usedTimes=1,this.program=R,this.vertexShader=N,this.fragmentShader=U,this}}(),a.WebGLPrograms=function(t,e){function n(t){if(e.floatVertexTextures&&t&&t.skeleton&&t.skeleton.useVertexTexture)return 1024;var n=e.maxVertexUniforms,r=Math.floor((n-20)/4),i=r;return void 0!==t&&t instanceof a.SkinnedMesh&&(i=Math.min(t.skeleton.bones.length,i),i<t.skeleton.bones.length&&console.warn("WebGLRenderer: too many bones - "+t.skeleton.bones.length+", this GPU supports just "+i+" (try OpenGL instead of ANGLE)")),
-i}function r(t,e){var n;return t?t instanceof a.Texture?n=t.encoding:t instanceof a.WebGLRenderTarget&&(console.warn("THREE.WebGLPrograms.getTextureEncodingFromMap: don't use render targets as textures. Use their .texture property instead."),n=t.texture.encoding):n=a.LinearEncoding,n===a.LinearEncoding&&e&&(n=a.GammaEncoding),n}var i=[],o={MeshDepthMaterial:"depth",MeshNormalMaterial:"normal",MeshBasicMaterial:"basic",MeshLambertMaterial:"lambert",MeshPhongMaterial:"phong",MeshStandardMaterial:"physical",MeshPhysicalMaterial:"physical",LineBasicMaterial:"basic",LineDashedMaterial:"dashed",PointsMaterial:"points"},s=["precision","supportsVertexTextures","map","mapEncoding","envMap","envMapMode","envMapEncoding","lightMap","aoMap","emissiveMap","emissiveMapEncoding","bumpMap","normalMap","displacementMap","specularMap","roughnessMap","metalnessMap","alphaMap","combine","vertexColors","fog","useFog","fogExp","flatShading","sizeAttenuation","logarithmicDepthBuffer","skinning","maxBones","useVertexTexture","morphTargets","morphNormals","maxMorphTargets","maxMorphNormals","premultipliedAlpha","numDirLights","numPointLights","numSpotLights","numHemiLights","shadowMapEnabled","shadowMapType","toneMapping","physicallyCorrectLights","alphaTest","doubleSided","flipSided","numClippingPlanes","depthPacking"];this.getParameters=function(i,s,c,u,l){var h=o[i.type],f=n(l),p=t.getPrecision();null!==i.precision&&(p=e.getMaxPrecision(i.precision),p!==i.precision&&console.warn("THREE.WebGLProgram.getParameters:",i.precision,"not supported, using",p,"instead."));var d=t.getCurrentRenderTarget(),m={shaderID:h,precision:p,supportsVertexTextures:e.vertexTextures,outputEncoding:r(d?d.texture:null,t.gammaOutput),map:!!i.map,mapEncoding:r(i.map,t.gammaInput),envMap:!!i.envMap,envMapMode:i.envMap&&i.envMap.mapping,envMapEncoding:r(i.envMap,t.gammaInput),envMapCubeUV:!!i.envMap&&(i.envMap.mapping===a.CubeUVReflectionMapping||i.envMap.mapping===a.CubeUVRefractionMapping),lightMap:!!i.lightMap,aoMap:!!i.aoMap,emissiveMap:!!i.emissiveMap,emissiveMapEncoding:r(i.emissiveMap,t.gammaInput),bumpMap:!!i.bumpMap,normalMap:!!i.normalMap,displacementMap:!!i.displacementMap,roughnessMap:!!i.roughnessMap,metalnessMap:!!i.metalnessMap,specularMap:!!i.specularMap,alphaMap:!!i.alphaMap,combine:i.combine,vertexColors:i.vertexColors,fog:c,useFog:i.fog,fogExp:c instanceof a.FogExp2,flatShading:i.shading===a.FlatShading,sizeAttenuation:i.sizeAttenuation,logarithmicDepthBuffer:e.logarithmicDepthBuffer,skinning:i.skinning,maxBones:f,useVertexTexture:e.floatVertexTextures&&l&&l.skeleton&&l.skeleton.useVertexTexture,morphTargets:i.morphTargets,morphNormals:i.morphNormals,maxMorphTargets:t.maxMorphTargets,maxMorphNormals:t.maxMorphNormals,numDirLights:s.directional.length,numPointLights:s.point.length,numSpotLights:s.spot.length,numHemiLights:s.hemi.length,numClippingPlanes:u,shadowMapEnabled:t.shadowMap.enabled&&l.receiveShadow&&s.shadows.length>0,shadowMapType:t.shadowMap.type,toneMapping:t.toneMapping,physicallyCorrectLights:t.physicallyCorrectLights,premultipliedAlpha:i.premultipliedAlpha,alphaTest:i.alphaTest,doubleSided:i.side===a.DoubleSide,flipSided:i.side===a.BackSide,depthPacking:void 0!==i.depthPacking&&i.depthPacking};return m},this.getProgramCode=function(t,e){var n=[];if(e.shaderID?n.push(e.shaderID):(n.push(t.fragmentShader),n.push(t.vertexShader)),void 0!==t.defines)for(var r in t.defines)n.push(r),n.push(t.defines[r]);for(var i=0;i<s.length;i++)n.push(e[s[i]]);return n.join()},this.acquireProgram=function(e,n,r){for(var o,s=0,c=i.length;s<c;s++){var u=i[s];if(u.code===r){o=u,++o.usedTimes;break}}return void 0===o&&(o=new a.WebGLProgram(t,r,e,n),i.push(o)),o},this.releaseProgram=function(t){if(0===--t.usedTimes){var e=i.indexOf(t);i[e]=i[i.length-1],i.pop(),t.destroy()}},this.programs=i},a.WebGLProperties=function(){var t={};this.get=function(e){var n=e.uuid,r=t[n];return void 0===r&&(r={},t[n]=r),r},this["delete"]=function(e){delete t[e.uuid]},this.clear=function(){t={}}},a.WebGLShader=function(){function t(t){for(var e=t.split("\n"),n=0;n<e.length;n++)e[n]=n+1+": "+e[n];return e.join("\n")}return function(e,n,r){var i=e.createShader(n);return e.shaderSource(i,r),e.compileShader(i),e.getShaderParameter(i,e.COMPILE_STATUS)===!1&&console.error("THREE.WebGLShader: Shader couldn't compile."),""!==e.getShaderInfoLog(i)&&console.warn("THREE.WebGLShader: gl.getShaderInfoLog()",n===e.VERTEX_SHADER?"vertex":"fragment",e.getShaderInfoLog(i),t(r)),i}}(),a.WebGLShadowMap=function(t,e,n){function r(e,n,r,i){var o=e.geometry,s=null,c=y,u=e.customDepthMaterial;if(r&&(c=x,u=e.customDistanceMaterial),u)s=u;else{var l=void 0!==o.morphTargets&&o.morphTargets.length>0&&n.morphTargets,h=e instanceof a.SkinnedMesh&&n.skinning,f=0;l&&(f|=m),h&&(f|=g),s=c[f]}if(t.localClippingEnabled&&n.clipShadows===!0&&0!==n.clippingPlanes.length){var p=s.uuid,d=n.uuid,v=b[p];void 0===v&&(v={},b[p]=v);var M=v[d];void 0===M&&(M=s.clone(),v[d]=M),s=M}s.visible=n.visible,s.wireframe=n.wireframe;var _=n.side;return D.renderSingleSided&&_==a.DoubleSide&&(_=a.FrontSide),D.renderReverseSided&&(_===a.FrontSide?_=a.BackSide:_===a.BackSide&&(_=a.FrontSide)),s.side=_,s.clipShadows=n.clipShadows,s.clippingPlanes=n.clippingPlanes,s.wireframeLinewidth=n.wireframeLinewidth,s.linewidth=n.linewidth,r&&void 0!==s.uniforms.lightPos&&s.uniforms.lightPos.value.copy(i),s}function i(t,e,n){if(t.visible!==!1){if(t.layers.test(e.layers)&&(t instanceof a.Mesh||t instanceof a.Line||t instanceof a.Points)&&t.castShadow&&(t.frustumCulled===!1||c.intersectsObject(t)===!0)){var r=t.material;r.visible===!0&&(t.modelViewMatrix.multiplyMatrices(n.matrixWorldInverse,t.matrixWorld),d.push(t))}for(var o=t.children,s=0,u=o.length;s<u;s++)i(o[s],e,n)}}var o=t.context,s=t.state,c=new a.Frustum,u=new a.Matrix4,l=e.shadows,h=new a.Vector2,f=new a.Vector3,p=new a.Vector3,d=[],m=1,g=2,v=(m|g)+1,y=new Array(v),x=new Array(v),b={},M=[new a.Vector3(1,0,0),new a.Vector3((-1),0,0),new a.Vector3(0,0,1),new a.Vector3(0,0,(-1)),new a.Vector3(0,1,0),new a.Vector3(0,(-1),0)],_=[new a.Vector3(0,1,0),new a.Vector3(0,1,0),new a.Vector3(0,1,0),new a.Vector3(0,1,0),new a.Vector3(0,0,1),new a.Vector3(0,0,(-1))],w=[new a.Vector4,new a.Vector4,new a.Vector4,new a.Vector4,new a.Vector4,new a.Vector4],S=new a.MeshDepthMaterial;S.depthPacking=a.RGBADepthPacking,S.clipping=!0;for(var E=a.ShaderLib.distanceRGBA,T=a.UniformsUtils.clone(E.uniforms),A=0;A!==v;++A){var L=0!==(A&m),C=0!==(A&g),R=S.clone();R.morphTargets=L,R.skinning=C,y[A]=R;var P=new a.ShaderMaterial({defines:{USE_SHADOWMAP:""},uniforms:T,vertexShader:E.vertexShader,fragmentShader:E.fragmentShader,morphTargets:L,skinning:C,clipping:!0});x[A]=P}var D=this;this.enabled=!1,this.autoUpdate=!0,this.needsUpdate=!1,this.type=a.PCFShadowMap,this.renderReverseSided=!0,this.renderSingleSided=!0,this.render=function(e,m){if(D.enabled!==!1&&(D.autoUpdate!==!1||D.needsUpdate!==!1)&&0!==l.length){s.clearColor(1,1,1,1),s.disable(o.BLEND),s.setDepthTest(!0),s.setScissorTest(!1);for(var g,v,y=0,x=l.length;y<x;y++){var b=l[y],S=b.shadow;if(void 0!==S){var E=S.camera;if(h.copy(S.mapSize),b instanceof a.PointLight){g=6,v=!0;var T=h.x,A=h.y;w[0].set(2*T,A,T,A),w[1].set(0,A,T,A),w[2].set(3*T,A,T,A),w[3].set(T,A,T,A),w[4].set(3*T,0,T,A),w[5].set(T,0,T,A),h.x*=4,h.y*=2}else g=1,v=!1;if(null===S.map){var L={minFilter:a.NearestFilter,magFilter:a.NearestFilter,format:a.RGBAFormat};S.map=new a.WebGLRenderTarget(h.x,h.y,L),E.updateProjectionMatrix()}S instanceof a.SpotLightShadow&&S.update(b);var C=S.map,R=S.matrix;p.setFromMatrixPosition(b.matrixWorld),E.position.copy(p),t.setRenderTarget(C),t.clear();for(var P=0;P<g;P++){if(v){f.copy(E.position),f.add(M[P]),E.up.copy(_[P]),E.lookAt(f);var N=w[P];s.viewport(N)}else f.setFromMatrixPosition(b.target.matrixWorld),E.lookAt(f);E.updateMatrixWorld(),E.matrixWorldInverse.getInverse(E.matrixWorld),R.set(.5,0,0,.5,0,.5,0,.5,0,0,.5,.5,0,0,0,1),R.multiply(E.projectionMatrix),R.multiply(E.matrixWorldInverse),u.multiplyMatrices(E.projectionMatrix,E.matrixWorldInverse),c.setFromMatrix(u),d.length=0,i(e,m,E);for(var U=0,B=d.length;U<B;U++){var I=d[U],O=n.update(I),F=I.material;if(F instanceof a.MultiMaterial)for(var V=O.groups,G=F.materials,k=0,z=V.length;k<z;k++){var H=V[k],j=G[H.materialIndex];if(j.visible===!0){var W=r(I,j,v,p);t.renderBufferDirect(E,null,O,W,I,H)}}else{var W=r(I,F,v,p);t.renderBufferDirect(E,null,O,W,I,null)}}}}else console.warn("THREE.WebGLShadowMap:",b,"has no shadow.")}var X=t.getClearColor(),q=t.getClearAlpha();t.setClearColor(X,q),D.needsUpdate=!1}}},a.WebGLState=function(t,e,n){function r(e,n,r){var i=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<r;o++)t.texImage2D(n+o,0,t.RGBA,1,1,0,t.RGBA,t.UNSIGNED_BYTE,i);return a}var i=this;this.buffers={color:new a.WebGLColorBuffer(t,this),depth:new a.WebGLDepthBuffer(t,this),stencil:new a.WebGLStencilBuffer(t,this)};var o=t.getParameter(t.MAX_VERTEX_ATTRIBS),s=new Uint8Array(o),c=new Uint8Array(o),u=new Uint8Array(o),l={},h=null,f=null,p=null,d=null,m=null,g=null,v=null,y=null,x=!1,b=null,M=null,_=null,w=null,S=null,E=null,T=t.getParameter(t.MAX_TEXTURE_IMAGE_UNITS),A=null,L={},C=new a.Vector4,R=new a.Vector4,P={};P[t.TEXTURE_2D]=r(t.TEXTURE_2D,t.TEXTURE_2D,1),P[t.TEXTURE_CUBE_MAP]=r(t.TEXTURE_CUBE_MAP,t.TEXTURE_CUBE_MAP_POSITIVE_X,6),this.init=function(){this.clearColor(0,0,0,1),this.clearDepth(1),this.clearStencil(0),this.enable(t.DEPTH_TEST),this.setDepthFunc(a.LessEqualDepth),this.setFlipSided(!1),this.setCullFace(a.CullFaceBack),this.enable(t.CULL_FACE),this.enable(t.BLEND),this.setBlending(a.NormalBlending)},this.initAttributes=function(){for(var t=0,e=s.length;t<e;t++)s[t]=0},this.enableAttribute=function(n){if(s[n]=1,0===c[n]&&(t.enableVertexAttribArray(n),c[n]=1),0!==u[n]){var r=e.get("ANGLE_instanced_arrays");r.vertexAttribDivisorANGLE(n,0),u[n]=0}},this.enableAttributeAndDivisor=function(e,n,r){s[e]=1,0===c[e]&&(t.enableVertexAttribArray(e),c[e]=1),u[e]!==n&&(r.vertexAttribDivisorANGLE(e,n),u[e]=n)},this.disableUnusedAttributes=function(){for(var e=0,n=c.length;e!==n;++e)c[e]!==s[e]&&(t.disableVertexAttribArray(e),c[e]=0)},this.enable=function(e){l[e]!==!0&&(t.enable(e),l[e]=!0)},this.disable=function(e){l[e]!==!1&&(t.disable(e),l[e]=!1)},this.getCompressedTextureFormats=function(){if(null===h&&(h=[],e.get("WEBGL_compressed_texture_pvrtc")||e.get("WEBGL_compressed_texture_s3tc")||e.get("WEBGL_compressed_texture_etc1")))for(var n=t.getParameter(t.COMPRESSED_TEXTURE_FORMATS),r=0;r<n.length;r++)h.push(n[r]);return h},this.setBlending=function(e,r,i,o,s,c,u,l){return e===a.NoBlending?(this.disable(t.BLEND),void(f=e)):(this.enable(t.BLEND),e===f&&l===x||(e===a.AdditiveBlending?l?(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===a.SubtractiveBlending?l?(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===a.MultiplyBlending?l?(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)):l?(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)),f=e,x=l),void(e===a.CustomBlending?(s=s||r,c=c||i,u=u||o,r===p&&s===g||(t.blendEquationSeparate(n(r),n(s)),p=r,g=s),i===d&&o===m&&c===v&&u===y||(t.blendFuncSeparate(n(i),n(o),n(c),n(u)),d=i,m=o,v=c,y=u)):(p=null,d=null,m=null,g=null,v=null,y=null)))},this.setColorWrite=function(t){this.buffers.color.setMask(t)},this.setDepthTest=function(t){this.buffers.depth.setTest(t)},this.setDepthWrite=function(t){this.buffers.depth.setMask(t)},this.setDepthFunc=function(t){this.buffers.depth.setFunc(t)},this.setStencilTest=function(t){this.buffers.stencil.setTest(t)},this.setStencilWrite=function(t){this.buffers.stencil.setMask(t)},this.setStencilFunc=function(t,e,n){this.buffers.stencil.setFunc(t,e,n)},this.setStencilOp=function(t,e,n){this.buffers.stencil.setOp(t,e,n)},this.setFlipSided=function(e){b!==e&&(e?t.frontFace(t.CW):t.frontFace(t.CCW),b=e)},this.setCullFace=function(e){e!==a.CullFaceNone?(this.enable(t.CULL_FACE),e!==M&&(e===a.CullFaceBack?t.cullFace(t.BACK):e===a.CullFaceFront?t.cullFace(t.FRONT):t.cullFace(t.FRONT_AND_BACK))):this.disable(t.CULL_FACE),M=e},this.setLineWidth=function(e){e!==_&&(t.lineWidth(e),_=e)},this.setPolygonOffset=function(e,n,r){e?(this.enable(t.POLYGON_OFFSET_FILL),w===n&&S===r||(t.polygonOffset(n,r),w=n,S=r)):this.disable(t.POLYGON_OFFSET_FILL)},this.getScissorTest=function(){return E},this.setScissorTest=function(e){E=e,e?this.enable(t.SCISSOR_TEST):this.disable(t.SCISSOR_TEST)},this.activeTexture=function(e){void 0===e&&(e=t.TEXTURE0+T-1),A!==e&&(t.activeTexture(e),A=e)},this.bindTexture=function(e,n){null===A&&i.activeTexture();var r=L[A];void 0===r&&(r={type:void 0,texture:void 0},L[A]=r),r.type===e&&r.texture===n||(t.bindTexture(e,n||P[e]),r.type=e,r.texture=n)},this.compressedTexImage2D=function(){try{t.compressedTexImage2D.apply(t,arguments)}catch(e){console.error(e)}},this.texImage2D=function(){try{t.texImage2D.apply(t,arguments)}catch(e){console.error(e)}},this.clearColor=function(t,e,n,r){this.buffers.color.setClear(t,e,n,r)},this.clearDepth=function(t){this.buffers.depth.setClear(t)},this.clearStencil=function(t){this.buffers.stencil.setClear(t)},this.scissor=function(e){C.equals(e)===!1&&(t.scissor(e.x,e.y,e.z,e.w),C.copy(e))},this.viewport=function(e){R.equals(e)===!1&&(t.viewport(e.x,e.y,e.z,e.w),R.copy(e))},this.reset=function(){for(var e=0;e<c.length;e++)1===c[e]&&(t.disableVertexAttribArray(e),c[e]=0);l={},h=null,A=null,L={},f=null,b=null,M=null,this.buffers.color.reset(),this.buffers.depth.reset(),this.buffers.stencil.reset()}},a.WebGLColorBuffer=function(t,e){var n=!1,r=new a.Vector4,i=null,o=new a.Vector4;this.setMask=function(e){i===e||n||(t.colorMask(e,e,e,e),i=e)},this.setLocked=function(t){n=t},this.setClear=function(e,n,i,a){r.set(e,n,i,a),o.equals(r)===!1&&(t.clearColor(e,n,i,a),o.copy(r))},this.reset=function(){n=!1,i=null,o=new a.Vector4}},a.WebGLDepthBuffer=function(t,e){var n=!1,r=null,i=null,o=null;this.setTest=function(n){n?e.enable(t.DEPTH_TEST):e.disable(t.DEPTH_TEST)},this.setMask=function(e){r===e||n||(t.depthMask(e),r=e)},this.setFunc=function(e){if(i!==e){if(e)switch(e){case a.NeverDepth:t.depthFunc(t.NEVER);break;case a.AlwaysDepth:t.depthFunc(t.ALWAYS);break;case a.LessDepth:t.depthFunc(t.LESS);break;case a.LessEqualDepth:t.depthFunc(t.LEQUAL);break;case a.EqualDepth:t.depthFunc(t.EQUAL);break;case a.GreaterEqualDepth:t.depthFunc(t.GEQUAL);break;case a.GreaterDepth:t.depthFunc(t.GREATER);break;case a.NotEqualDepth:t.depthFunc(t.NOTEQUAL);break;default:t.depthFunc(t.LEQUAL)}else t.depthFunc(t.LEQUAL);i=e}},this.setLocked=function(t){n=t},this.setClear=function(e){o!==e&&(t.clearDepth(e),o=e)},this.reset=function(){n=!1,r=null,i=null,o=null}},a.WebGLStencilBuffer=function(t,e){var n=!1,r=null,i=null,a=null,o=null,s=null,c=null,u=null,l=null;this.setTest=function(n){n?e.enable(t.STENCIL_TEST):e.disable(t.STENCIL_TEST)},this.setMask=function(e){r===e||n||(t.stencilMask(e),r=e)},this.setFunc=function(e,n,r){i===e&&a===n&&o===r||(t.stencilFunc(e,n,r),i=e,a=n,o=r)},this.setOp=function(e,n,r){s===e&&c===n&&u===r||(t.stencilOp(e,n,r),s=e,c=n,u=r)},this.setLocked=function(t){n=t},this.setClear=function(e){l!==e&&(t.clearStencil(e),l=e)},this.reset=function(){n=!1,r=null,i=null,a=null,o=null,s=null,c=null,u=null,l=null}},a.WebGLTextures=function(t,e,n,r,i,o,s){function c(t,e){if(t.width>e||t.height>e){var n=e/Math.max(t.width,t.height),r=document.createElementNS("http://www.w3.org/1999/xhtml","canvas");r.width=Math.floor(t.width*n),r.height=Math.floor(t.height*n);var i=r.getContext("2d");return i.drawImage(t,0,0,t.width,t.height,0,0,r.width,r.height),console.warn("THREE.WebGLRenderer: image is too big ("+t.width+"x"+t.height+"). Resized to "+r.width+"x"+r.height,t),r}return t}function u(t){return a.Math.isPowerOfTwo(t.width)&&a.Math.isPowerOfTwo(t.height)}function l(t){if(t instanceof HTMLImageElement||t instanceof HTMLCanvasElement){var e=document.createElementNS("http://www.w3.org/1999/xhtml","canvas");e.width=a.Math.nearestPowerOfTwo(t.width),e.height=a.Math.nearestPowerOfTwo(t.height);var n=e.getContext("2d");return n.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 h(t){return t.wrapS!==a.ClampToEdgeWrapping||t.wrapT!==a.ClampToEdgeWrapping||t.minFilter!==a.NearestFilter&&t.minFilter!==a.LinearFilter}function f(e){return e===a.NearestFilter||e===a.NearestMipMapNearestFilter||e===a.NearestMipMapLinearFilter?t.NEAREST:t.LINEAR}function p(t){var e=t.target;e.removeEventListener("dispose",p),m(e),L.textures--}function d(t){var e=t.target;e.removeEventListener("dispose",d),g(e),L.textures--}function m(e){var n=r.get(e);if(e.image&&n.__image__webglTextureCube)t.deleteTexture(n.__image__webglTextureCube);else{if(void 0===n.__webglInit)return;t.deleteTexture(n.__webglTexture)}r["delete"](e)}function g(e){var n=r.get(e),i=r.get(e.texture);if(e){if(void 0!==i.__webglTexture&&t.deleteTexture(i.__webglTexture),e.depthTexture&&e.depthTexture.dispose(),e instanceof a.WebGLRenderTargetCube)for(var o=0;o<6;o++)t.deleteFramebuffer(n.__webglFramebuffer[o]),n.__webglDepthbuffer&&t.deleteRenderbuffer(n.__webglDepthbuffer[o]);else t.deleteFramebuffer(n.__webglFramebuffer),n.__webglDepthbuffer&&t.deleteRenderbuffer(n.__webglDepthbuffer);r["delete"](e.texture),r["delete"](e)}}function v(e,i){var a=r.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(o.complete!==!1)return void M(a,e,i);console.warn("THREE.WebGLRenderer: Texture marked for update but image is incomplete",e)}}n.activeTexture(t.TEXTURE0+i),n.bindTexture(t.TEXTURE_2D,a.__webglTexture)}function y(e,s){var l=r.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(),L.textures++),n.activeTexture(t.TEXTURE0+s),n.bindTexture(t.TEXTURE_CUBE_MAP,l.__image__webglTextureCube),t.pixelStorei(t.UNPACK_FLIP_Y_WEBGL,e.flipY);for(var h=e instanceof a.CompressedTexture,f=e.image[0]instanceof a.DataTexture,d=[],m=0;m<6;m++)h||f?d[m]=f?e.image[m].image:e.image[m]:d[m]=c(e.image[m],i.maxCubemapSize);var g=d[0],v=u(g),y=o(e.format),x=o(e.type);b(t.TEXTURE_CUBE_MAP,e,v);for(var m=0;m<6;m++)if(h)for(var M,_=d[m].mipmaps,w=0,S=_.length;w<S;w++)M=_[w],e.format!==a.RGBAFormat&&e.format!==a.RGBFormat?n.getCompressedTextureFormats().indexOf(y)>-1?n.compressedTexImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+m,w,y,M.width,M.height,0,M.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .setTextureCube()"):n.texImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+m,w,y,M.width,M.height,0,y,x,M.data);else f?n.texImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+m,0,y,d[m].width,d[m].height,0,y,x,d[m].data):n.texImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+m,0,y,y,x,d[m]);e.generateMipmaps&&v&&t.generateMipmap(t.TEXTURE_CUBE_MAP),l.__version=e.version,e.onUpdate&&e.onUpdate(e)}else n.activeTexture(t.TEXTURE0+s),n.bindTexture(t.TEXTURE_CUBE_MAP,l.__image__webglTextureCube)}function x(e,i){n.activeTexture(t.TEXTURE0+i),n.bindTexture(t.TEXTURE_CUBE_MAP,r.get(e).__webglTexture)}function b(n,s,c){var u;if(c?(t.texParameteri(n,t.TEXTURE_WRAP_S,o(s.wrapS)),t.texParameteri(n,t.TEXTURE_WRAP_T,o(s.wrapT)),t.texParameteri(n,t.TEXTURE_MAG_FILTER,o(s.magFilter)),t.texParameteri(n,t.TEXTURE_MIN_FILTER,o(s.minFilter))):(t.texParameteri(n,t.TEXTURE_WRAP_S,t.CLAMP_TO_EDGE),t.texParameteri(n,t.TEXTURE_WRAP_T,t.CLAMP_TO_EDGE),s.wrapS===a.ClampToEdgeWrapping&&s.wrapT===a.ClampToEdgeWrapping||console.warn("THREE.WebGLRenderer: Texture is not power of two. Texture.wrapS and Texture.wrapT should be set to THREE.ClampToEdgeWrapping.",s),t.texParameteri(n,t.TEXTURE_MAG_FILTER,f(s.magFilter)),t.texParameteri(n,t.TEXTURE_MIN_FILTER,f(s.minFilter)),s.minFilter!==a.NearestFilter&&s.minFilter!==a.LinearFilter&&console.warn("THREE.WebGLRenderer: Texture is not power of two. Texture.minFilter should be set to THREE.NearestFilter or THREE.LinearFilter.",s)),u=e.get("EXT_texture_filter_anisotropic")){if(s.type===a.FloatType&&null===e.get("OES_texture_float_linear"))return;if(s.type===a.HalfFloatType&&null===e.get("OES_texture_half_float_linear"))return;(s.anisotropy>1||r.get(s).__currentAnisotropy)&&(t.texParameterf(n,u.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(s.anisotropy,i.getMaxAnisotropy())),r.get(s).__currentAnisotropy=s.anisotropy)}}function M(e,r,s){void 0===e.__webglInit&&(e.__webglInit=!0,r.addEventListener("dispose",p),e.__webglTexture=t.createTexture(),L.textures++),n.activeTexture(t.TEXTURE0+s),n.bindTexture(t.TEXTURE_2D,e.__webglTexture),t.pixelStorei(t.UNPACK_FLIP_Y_WEBGL,r.flipY),t.pixelStorei(t.UNPACK_PREMULTIPLY_ALPHA_WEBGL,r.premultiplyAlpha),t.pixelStorei(t.UNPACK_ALIGNMENT,r.unpackAlignment);var f=c(r.image,i.maxTextureSize);h(r)&&u(f)===!1&&(f=l(f));var d=u(f),m=o(r.format),g=o(r.type);b(t.TEXTURE_2D,r,d);var v,y=r.mipmaps;if(r instanceof a.DepthTexture){var x=t.DEPTH_COMPONENT;if(r.type===a.FloatType){if(!C)throw new Error("Float Depth Texture only supported in WebGL2.0");x=t.DEPTH_COMPONENT32F}else C&&(x=t.DEPTH_COMPONENT16);n.texImage2D(t.TEXTURE_2D,0,x,f.width,f.height,0,m,g,null)}else if(r instanceof a.DataTexture)if(y.length>0&&d){for(var M=0,_=y.length;M<_;M++)v=y[M],n.texImage2D(t.TEXTURE_2D,M,m,v.width,v.height,0,m,g,v.data);r.generateMipmaps=!1}else n.texImage2D(t.TEXTURE_2D,0,m,f.width,f.height,0,m,g,f.data);else if(r instanceof a.CompressedTexture)for(var M=0,_=y.length;M<_;M++)v=y[M],r.format!==a.RGBAFormat&&r.format!==a.RGBFormat?n.getCompressedTextureFormats().indexOf(m)>-1?n.compressedTexImage2D(t.TEXTURE_2D,M,m,v.width,v.height,0,v.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()"):n.texImage2D(t.TEXTURE_2D,M,m,v.width,v.height,0,m,g,v.data);else if(y.length>0&&d){for(var M=0,_=y.length;M<_;M++)v=y[M],n.texImage2D(t.TEXTURE_2D,M,m,m,g,v);r.generateMipmaps=!1}else n.texImage2D(t.TEXTURE_2D,0,m,m,g,f);r.generateMipmaps&&d&&t.generateMipmap(t.TEXTURE_2D),e.__version=r.version,r.onUpdate&&r.onUpdate(r)}function _(e,i,a,s){var c=o(i.texture.format),u=o(i.texture.type);n.texImage2D(s,0,c,i.width,i.height,0,c,u,null),t.bindFramebuffer(t.FRAMEBUFFER,e),t.framebufferTexture2D(t.FRAMEBUFFER,a,s,r.get(i.texture).__webglTexture,0),t.bindFramebuffer(t.FRAMEBUFFER,null)}function w(e,n){t.bindRenderbuffer(t.RENDERBUFFER,e),n.depthBuffer&&!n.stencilBuffer?(t.renderbufferStorage(t.RENDERBUFFER,t.DEPTH_COMPONENT16,n.width,n.height),t.framebufferRenderbuffer(t.FRAMEBUFFER,t.DEPTH_ATTACHMENT,t.RENDERBUFFER,e)):n.depthBuffer&&n.stencilBuffer?(t.renderbufferStorage(t.RENDERBUFFER,t.DEPTH_STENCIL,n.width,n.height),t.framebufferRenderbuffer(t.FRAMEBUFFER,t.DEPTH_STENCIL_ATTACHMENT,t.RENDERBUFFER,e)):t.renderbufferStorage(t.RENDERBUFFER,t.RGBA4,n.width,n.height),t.bindRenderbuffer(t.RENDERBUFFER,null)}function S(e,n){var i=n instanceof a.WebGLRenderTargetCube;if(i)throw new Error("Depth Texture with cube render targets is not supported!");if(t.bindFramebuffer(t.FRAMEBUFFER,e),!(n.depthTexture instanceof a.DepthTexture))throw new Error("renderTarget.depthTexture must be an instance of THREE.DepthTexture");r.get(n.depthTexture).__webglTexture&&n.depthTexture.image.width===n.width&&n.depthTexture.image.height===n.height||(n.depthTexture.image.width=n.width,n.depthTexture.image.height=n.height,n.depthTexture.needsUpdate=!0),v(n.depthTexture,0);var o=r.get(n.depthTexture).__webglTexture;t.framebufferTexture2D(t.FRAMEBUFFER,t.DEPTH_ATTACHMENT,t.TEXTURE_2D,o,0)}function E(e){var n=r.get(e),i=e instanceof a.WebGLRenderTargetCube;if(e.depthTexture){if(i)throw new Error("target.depthTexture not supported in Cube render targets");S(n.__webglFramebuffer,e)}else if(i){n.__webglDepthbuffer=[];for(var o=0;o<6;o++)t.bindFramebuffer(t.FRAMEBUFFER,n.__webglFramebuffer[o]),n.__webglDepthbuffer[o]=t.createRenderbuffer(),w(n.__webglDepthbuffer[o],e)}else t.bindFramebuffer(t.FRAMEBUFFER,n.__webglFramebuffer),n.__webglDepthbuffer=t.createRenderbuffer(),w(n.__webglDepthbuffer,e);t.bindFramebuffer(t.FRAMEBUFFER,null)}function T(e){var i=r.get(e),o=r.get(e.texture);e.addEventListener("dispose",d),o.__webglTexture=t.createTexture(),L.textures++;var s=e instanceof a.WebGLRenderTargetCube,c=u(e);if(s){i.__webglFramebuffer=[];for(var l=0;l<6;l++)i.__webglFramebuffer[l]=t.createFramebuffer()}else i.__webglFramebuffer=t.createFramebuffer();if(s){n.bindTexture(t.TEXTURE_CUBE_MAP,o.__webglTexture),b(t.TEXTURE_CUBE_MAP,e.texture,c);for(var l=0;l<6;l++)_(i.__webglFramebuffer[l],e,t.COLOR_ATTACHMENT0,t.TEXTURE_CUBE_MAP_POSITIVE_X+l);e.texture.generateMipmaps&&c&&t.generateMipmap(t.TEXTURE_CUBE_MAP),n.bindTexture(t.TEXTURE_CUBE_MAP,null)}else n.bindTexture(t.TEXTURE_2D,o.__webglTexture),b(t.TEXTURE_2D,e.texture,c),_(i.__webglFramebuffer,e,t.COLOR_ATTACHMENT0,t.TEXTURE_2D),e.texture.generateMipmaps&&c&&t.generateMipmap(t.TEXTURE_2D),n.bindTexture(t.TEXTURE_2D,null);e.depthBuffer&&E(e)}function A(e){var i=e.texture;if(i.generateMipmaps&&u(e)&&i.minFilter!==a.NearestFilter&&i.minFilter!==a.LinearFilter){var o=e instanceof a.WebGLRenderTargetCube?t.TEXTURE_CUBE_MAP:t.TEXTURE_2D,s=r.get(i).__webglTexture;n.bindTexture(o,s),t.generateMipmap(o),n.bindTexture(o,null)}}var L=s.memory,C="undefined"!=typeof WebGL2RenderingContext&&t instanceof WebGL2RenderingContext;this.setTexture2D=v,this.setTextureCube=y,this.setTextureCubeDynamic=x,this.setupRenderTarget=T,this.updateRenderTargetMipmap=A},a.WebGLUniforms=function(){var t=new a.Texture,e=new a.CubeTexture,n=function(){this.seq=[],this.map={}},r=[],i=[],o=function(t,e,n){var i=t[0];if(i<=0||i>0)return t;var a=e*n,o=r[a];if(void 0===o&&(o=new Float32Array(a),r[a]=o),0!==e){i.toArray(o,0);for(var s=1,c=0;s!==e;++s)c+=n,t[s].toArray(o,c)}return o},s=function(t,e){var n=i[e];void 0===n&&(n=new Int32Array(e),i[e]=n);for(var r=0;r!==e;++r)n[r]=t.allocTextureUnit();return n},c=function(t,e){t.uniform1f(this.addr,e)},u=function(t,e){t.uniform1i(this.addr,e)},l=function(t,e){void 0===e.x?t.uniform2fv(this.addr,e):t.uniform2f(this.addr,e.x,e.y)},h=function(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)},f=function(t,e){void 0===e.x?t.uniform4fv(this.addr,e):t.uniform4f(this.addr,e.x,e.y,e.z,e.w)},p=function(t,e){t.uniformMatrix2fv(this.addr,!1,e.elements||e)},d=function(t,e){t.uniformMatrix3fv(this.addr,!1,e.elements||e)},m=function(t,e){t.uniformMatrix4fv(this.addr,!1,e.elements||e)},g=function(e,n,r){var i=r.allocTextureUnit();e.uniform1i(this.addr,i),r.setTexture2D(n||t,i)},v=function(t,n,r){var i=r.allocTextureUnit();t.uniform1i(this.addr,i),r.setTextureCube(n||e,i)},y=function(t,e){t.uniform2iv(this.addr,e)},x=function(t,e){t.uniform3iv(this.addr,e)},b=function(t,e){t.uniform4iv(this.addr,e)},M=function(t){switch(t){case 5126:return c;case 35664:return l;case 35665:return h;case 35666:return f;case 35674:return p;case 35675:return d;case 35676:return m;case 35678:return g;case 35680:return v;case 5124:case 35670:return u;case 35667:case 35671:return y;case 35668:case 35672:return x;case 35669:case 35673:return b}},_=function(t,e){t.uniform1fv(this.addr,e)},w=function(t,e){t.uniform1iv(this.addr,e)},S=function(t,e){t.uniform2fv(this.addr,o(e,this.size,2))},E=function(t,e){t.uniform3fv(this.addr,o(e,this.size,3))},T=function(t,e){t.uniform4fv(this.addr,o(e,this.size,4))},A=function(t,e){t.uniformMatrix2fv(this.addr,!1,o(e,this.size,4))},L=function(t,e){t.uniformMatrix3fv(this.addr,!1,o(e,this.size,9))},C=function(t,e){t.uniformMatrix4fv(this.addr,!1,o(e,this.size,16))},R=function(e,n,r){var i=n.length,a=s(r,i);e.uniform1iv(this.addr,a);for(var o=0;o!==i;++o)r.setTexture2D(n[o]||t,a[o])},P=function(t,n,r){var i=n.length,a=s(r,i);t.uniform1iv(this.addr,a);for(var o=0;o!==i;++o)r.setTextureCube(n[o]||e,a[o])},D=function(t){switch(t){case 5126:return _;case 35664:return S;case 35665:return E;case 35666:return T;case 35674:return A;case 35675:return L;case 35676:return C;case 35678:return R;case 35680:return P;case 5124:case 35670:return w;case 35667:case 35671:return y;case 35668:case 35672:return x;case 35669:case 35673:return b}},N=function(t,e,n){this.id=t,this.addr=n,this.setValue=M(e.type)},U=function(t,e,n){this.id=t,this.addr=n,this.size=e.size,this.setValue=D(e.type)},B=function(t){this.id=t,n.call(this)};B.prototype.setValue=function(t,e){for(var n=this.seq,r=0,i=n.length;r!==i;++r){var a=n[r];a.setValue(t,e[a.id])}};var I=/([\w\d_]+)(\])?(\[|\.)?/g,O=function(t,e){t.seq.push(e),t.map[e.id]=e},F=function(t,e,n){var r=t.name,i=r.length;for(I.lastIndex=0;;){var a=I.exec(r),o=I.lastIndex,s=a[1],c="]"===a[2],u=a[3];if(c&&(s=0|s),void 0===u||"["===u&&o+2===i){O(n,void 0===u?new N(s,t,e):new U(s,t,e));break}var l=n.map,h=l[s];void 0===h&&(h=new B(s),O(n,h)),n=h}},V=function(t,e,r){n.call(this),this.renderer=r;for(var i=t.getProgramParameter(e,t.ACTIVE_UNIFORMS),a=0;a!==i;++a){var o=t.getActiveUniform(e,a),s=o.name,c=t.getUniformLocation(e,s);F(o,c,this)}};return V.prototype.setValue=function(t,e,n){var r=this.map[e];void 0!==r&&r.setValue(t,n,this.renderer)},V.prototype.set=function(t,e,n){var r=this.map[n];void 0!==r&&r.setValue(t,e[n],this.renderer)},V.prototype.setOptional=function(t,e,n){var r=e[n];void 0!==r&&this.setValue(t,n,r)},V.upload=function(t,e,n,r){for(var i=0,a=e.length;i!==a;++i){var o=e[i],s=n[o.id];s.needsUpdate!==!1&&o.setValue(t,s.value,r)}},V.seqWithValue=function(t,e){for(var n=[],r=0,i=t.length;r!==i;++r){var a=t[r];a.id in e&&n.push(a)}return n},V.splitDynamic=function(t,e){for(var n=null,r=t.length,i=0,a=0;a!==r;++a){var o=t[a],s=e[o.id];s&&s.dynamic===!0?(null===n&&(n=[]),n.push(o)):(i<a&&(t[i]=o),++i)}return i<r&&(t.length=i),n},V.evalDynamic=function(t,e,n,r){for(var i=0,a=t.length;i!==a;++i){var o=e[t[i].id],s=o.onUpdateCallback;void 0!==s&&s.call(o,n,r)}},V}(),a.LensFlarePlugin=function(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]);i=p.createBuffer(),o=p.createBuffer(),p.bindBuffer(p.ARRAY_BUFFER,i),p.bufferData(p.ARRAY_BUFFER,t,p.STATIC_DRAW),p.bindBuffer(p.ELEMENT_ARRAY_BUFFER,o),p.bufferData(p.ELEMENT_ARRAY_BUFFER,e,p.STATIC_DRAW),h=p.createTexture(),f=p.createTexture(),d.bindTexture(p.TEXTURE_2D,h),p.texImage2D(p.TEXTURE_2D,0,p.RGB,16,16,0,p.RGB,p.UNSIGNED_BYTE,null),p.texParameteri(p.TEXTURE_2D,p.TEXTURE_WRAP_S,p.CLAMP_TO_EDGE),p.texParameteri(p.TEXTURE_2D,p.TEXTURE_WRAP_T,p.CLAMP_TO_EDGE),p.texParameteri(p.TEXTURE_2D,p.TEXTURE_MAG_FILTER,p.NEAREST),p.texParameteri(p.TEXTURE_2D,p.TEXTURE_MIN_FILTER,p.NEAREST),d.bindTexture(p.TEXTURE_2D,f),p.texImage2D(p.TEXTURE_2D,0,p.RGBA,16,16,0,p.RGBA,p.UNSIGNED_BYTE,null),p.texParameteri(p.TEXTURE_2D,p.TEXTURE_WRAP_S,p.CLAMP_TO_EDGE),p.texParameteri(p.TEXTURE_2D,p.TEXTURE_WRAP_T,p.CLAMP_TO_EDGE),p.texParameteri(p.TEXTURE_2D,p.TEXTURE_MAG_FILTER,p.NEAREST),p.texParameteri(p.TEXTURE_2D,p.TEXTURE_MIN_FILTER,p.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")},c=r(s),u={vertex:p.getAttribLocation(c,"position"),uv:p.getAttribLocation(c,"uv")},l={renderType:p.getUniformLocation(c,"renderType"),map:p.getUniformLocation(c,"map"),occlusionMap:p.getUniformLocation(c,"occlusionMap"),opacity:p.getUniformLocation(c,"opacity"),color:p.getUniformLocation(c,"color"),scale:p.getUniformLocation(c,"scale"),rotation:p.getUniformLocation(c,"rotation"),screenPosition:p.getUniformLocation(c,"screenPosition")}}function r(e){var n=p.createProgram(),r=p.createShader(p.FRAGMENT_SHADER),i=p.createShader(p.VERTEX_SHADER),a="precision "+t.getPrecision()+" float;\n";return p.shaderSource(r,a+e.fragmentShader),p.shaderSource(i,a+e.vertexShader),p.compileShader(r),p.compileShader(i),p.attachShader(n,r),p.attachShader(n,i),p.linkProgram(n),n}var i,o,s,c,u,l,h,f,p=t.context,d=t.state;this.render=function(r,s,m){if(0!==e.length){var g=new a.Vector3,v=m.w/m.z,y=.5*m.z,x=.5*m.w,b=16/m.w,M=new a.Vector2(b*v,b),_=new a.Vector3(1,1,0),w=new a.Vector2(1,1),S=new a.Box2;S.min.set(0,0),S.max.set(m.z-16,m.w-16),void 0===c&&n(),p.useProgram(c),d.initAttributes(),d.enableAttribute(u.vertex),d.enableAttribute(u.uv),d.disableUnusedAttributes(),p.uniform1i(l.occlusionMap,0),p.uniform1i(l.map,1),p.bindBuffer(p.ARRAY_BUFFER,i),p.vertexAttribPointer(u.vertex,2,p.FLOAT,!1,16,0),p.vertexAttribPointer(u.uv,2,p.FLOAT,!1,16,8),p.bindBuffer(p.ELEMENT_ARRAY_BUFFER,o),d.disable(p.CULL_FACE),d.setDepthWrite(!1);for(var E=0,T=e.length;E<T;E++){b=16/m.w,M.set(b*v,b);var A=e[E];if(g.set(A.matrixWorld.elements[12],A.matrixWorld.elements[13],A.matrixWorld.elements[14]),g.applyMatrix4(s.matrixWorldInverse),g.applyProjection(s.projectionMatrix),_.copy(g),w.x=m.x+_.x*y+y-8,w.y=m.y+_.y*x+x-8,S.containsPoint(w)===!0){d.activeTexture(p.TEXTURE0),d.bindTexture(p.TEXTURE_2D,null),d.activeTexture(p.TEXTURE1),d.bindTexture(p.TEXTURE_2D,h),p.copyTexImage2D(p.TEXTURE_2D,0,p.RGB,w.x,w.y,16,16,0),p.uniform1i(l.renderType,0),p.uniform2f(l.scale,M.x,M.y),p.uniform3f(l.screenPosition,_.x,_.y,_.z),d.disable(p.BLEND),d.enable(p.DEPTH_TEST),p.drawElements(p.TRIANGLES,6,p.UNSIGNED_SHORT,0),d.activeTexture(p.TEXTURE0),d.bindTexture(p.TEXTURE_2D,f),p.copyTexImage2D(p.TEXTURE_2D,0,p.RGBA,w.x,w.y,16,16,0),p.uniform1i(l.renderType,1),d.disable(p.DEPTH_TEST),d.activeTexture(p.TEXTURE1),d.bindTexture(p.TEXTURE_2D,h),p.drawElements(p.TRIANGLES,6,p.UNSIGNED_SHORT,0),A.positionScreen.copy(_),A.customUpdateCallback?A.customUpdateCallback(A):A.updateLensFlares(),p.uniform1i(l.renderType,2),d.enable(p.BLEND);for(var L=0,C=A.lensFlares.length;L<C;L++){var R=A.lensFlares[L];R.opacity>.001&&R.scale>.001&&(_.x=R.x,_.y=R.y,_.z=R.z,b=R.size*R.scale/m.w,M.x=b*v,M.y=b,p.uniform3f(l.screenPosition,_.x,_.y,_.z),p.uniform2f(l.scale,M.x,M.y),p.uniform1f(l.rotation,R.rotation),p.uniform1f(l.opacity,R.opacity),p.uniform3f(l.color,R.color.r,R.color.g,R.color.b),d.setBlending(R.blending,R.blendEquation,R.blendSrc,R.blendDst),t.setTexture2D(R.texture,1),p.drawElements(p.TRIANGLES,6,p.UNSIGNED_SHORT,0))}}}d.enable(p.CULL_FACE),d.enable(p.DEPTH_TEST),d.setDepthWrite(!0),t.resetGLState()}}},a.SpritePlugin=function(t,e){function n(){var t=new Float32Array([-.5,-.5,0,0,.5,-.5,1,0,.5,.5,1,1,-.5,.5,0,1]),e=new Uint16Array([0,1,2,0,2,3]);o=f.createBuffer(),s=f.createBuffer(),f.bindBuffer(f.ARRAY_BUFFER,o),f.bufferData(f.ARRAY_BUFFER,t,f.STATIC_DRAW),f.bindBuffer(f.ELEMENT_ARRAY_BUFFER,s),f.bufferData(f.ELEMENT_ARRAY_BUFFER,e,f.STATIC_DRAW),c=r(),u={position:f.getAttribLocation(c,"position"),uv:f.getAttribLocation(c,"uv")},l={uvOffset:f.getUniformLocation(c,"uvOffset"),uvScale:f.getUniformLocation(c,"uvScale"),rotation:f.getUniformLocation(c,"rotation"),scale:f.getUniformLocation(c,"scale"),color:f.getUniformLocation(c,"color"),map:f.getUniformLocation(c,"map"),opacity:f.getUniformLocation(c,"opacity"),modelViewMatrix:f.getUniformLocation(c,"modelViewMatrix"),projectionMatrix:f.getUniformLocation(c,"projectionMatrix"),fogType:f.getUniformLocation(c,"fogType"),fogDensity:f.getUniformLocation(c,"fogDensity"),fogNear:f.getUniformLocation(c,"fogNear"),fogFar:f.getUniformLocation(c,"fogFar"),fogColor:f.getUniformLocation(c,"fogColor"),alphaTest:f.getUniformLocation(c,"alphaTest")};var n=document.createElementNS("http://www.w3.org/1999/xhtml","canvas");n.width=8,n.height=8;var i=n.getContext("2d");i.fillStyle="white",i.fillRect(0,0,8,8),h=new a.Texture(n),h.needsUpdate=!0}function r(){var e=f.createProgram(),n=f.createShader(f.VERTEX_SHADER),r=f.createShader(f.FRAGMENT_SHADER);return f.shaderSource(n,["precision "+t.getPrecision()+" float;","uniform mat4 modelViewMatrix;","uniform mat4 projectionMatrix;","uniform float rotation;","uniform vec2 scale;","uniform vec2 uvOffset;","uniform vec2 uvScale;","attribute vec2 position;","attribute vec2 uv;","varying vec2 vUV;","void main() {","vUV = uvOffset + uv * uvScale;","vec2 alignedPosition = position * scale;","vec2 rotatedPosition;","rotatedPosition.x = cos( rotation ) * alignedPosition.x - sin( rotation ) * alignedPosition.y;","rotatedPosition.y = sin( rotation ) * alignedPosition.x + cos( rotation ) * alignedPosition.y;","vec4 finalPosition;","finalPosition = modelViewMatrix * vec4( 0.0, 0.0, 0.0, 1.0 );","finalPosition.xy += rotatedPosition;","finalPosition = projectionMatrix * finalPosition;","gl_Position = finalPosition;","}"].join("\n")),f.shaderSource(r,["precision "+t.getPrecision()+" float;","uniform vec3 color;","uniform sampler2D map;","uniform float opacity;","uniform int fogType;","uniform vec3 fogColor;","uniform float fogDensity;","uniform float fogNear;","uniform float fogFar;","uniform float alphaTest;","varying vec2 vUV;","void main() {","vec4 texture = texture2D( map, vUV );","if ( texture.a < alphaTest ) discard;","gl_FragColor = vec4( color * texture.xyz, texture.a * opacity );","if ( fogType > 0 ) {","float depth = gl_FragCoord.z / gl_FragCoord.w;","float fogFactor = 0.0;","if ( fogType == 1 ) {","fogFactor = smoothstep( fogNear, fogFar, depth );","} else {","const float LOG2 = 1.442695;","fogFactor = exp2( - fogDensity * fogDensity * depth * depth * LOG2 );","fogFactor = 1.0 - clamp( fogFactor, 0.0, 1.0 );","}","gl_FragColor = mix( gl_FragColor, vec4( fogColor, gl_FragColor.w ), fogFactor );","}","}"].join("\n")),f.compileShader(n),f.compileShader(r),f.attachShader(e,n),f.attachShader(e,r),f.linkProgram(e),e}function i(t,e){return t.renderOrder!==e.renderOrder?t.renderOrder-e.renderOrder:t.z!==e.z?e.z-t.z:e.id-t.id}var o,s,c,u,l,h,f=t.context,p=t.state,d=new a.Vector3,m=new a.Quaternion,g=new a.Vector3;this.render=function(r,v){if(0!==e.length){void 0===c&&n(),f.useProgram(c),p.initAttributes(),p.enableAttribute(u.position),p.enableAttribute(u.uv),p.disableUnusedAttributes(),p.disable(f.CULL_FACE),p.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,s),f.uniformMatrix4fv(l.projectionMatrix,!1,v.projectionMatrix.elements),p.activeTexture(f.TEXTURE0),f.uniform1i(l.map,0);var y=0,x=0,b=r.fog;b?(f.uniform3f(l.fogColor,b.color.r,b.color.g,b.color.b),b instanceof a.Fog?(f.uniform1f(l.fogNear,b.near),f.uniform1f(l.fogFar,b.far),f.uniform1i(l.fogType,1),y=1,x=1):b instanceof a.FogExp2&&(f.uniform1f(l.fogDensity,b.density),f.uniform1i(l.fogType,2),y=2,x=2)):(f.uniform1i(l.fogType,0),y=0,x=0);for(var M=0,_=e.length;M<_;M++){var w=e[M];w.modelViewMatrix.multiplyMatrices(v.matrixWorldInverse,w.matrixWorld),w.z=-w.modelViewMatrix.elements[14]}e.sort(i);for(var S=[],M=0,_=e.length;M<_;M++){var w=e[M],E=w.material;f.uniform1f(l.alphaTest,E.alphaTest),f.uniformMatrix4fv(l.modelViewMatrix,!1,w.modelViewMatrix.elements),w.matrixWorld.decompose(d,m,g),S[0]=g.x,S[1]=g.y;var T=0;r.fog&&E.fog&&(T=x),y!==T&&(f.uniform1i(l.fogType,T),y=T),null!==E.map?(f.uniform2f(l.uvOffset,E.map.offset.x,E.map.offset.y),f.uniform2f(l.uvScale,E.map.repeat.x,E.map.repeat.y)):(f.uniform2f(l.uvOffset,0,0),f.uniform2f(l.uvScale,1,1)),f.uniform1f(l.opacity,E.opacity),f.uniform3f(l.color,E.color.r,E.color.g,E.color.b),f.uniform1f(l.rotation,E.rotation),f.uniform2fv(l.scale,S),p.setBlending(E.blending,E.blendEquation,E.blendSrc,E.blendDst),p.setDepthTest(E.depthTest),p.setDepthWrite(E.depthWrite),E.map?t.setTexture2D(E.map,0):t.setTexture2D(h,0),f.drawElements(f.TRIANGLES,6,f.UNSIGNED_SHORT,0)}p.enable(f.CULL_FACE),t.resetGLState()}}},Object.assign(a,{Face4:function(t,e,n,r,i,o,s){return console.warn("THREE.Face4 has been removed. A THREE.Face3 will be created instead."),new a.Face3(t,e,n,i,o,s)},LineStrip:0,LinePieces:1,MeshFaceMaterial:a.MultiMaterial,PointCloud:function(t,e){return console.warn("THREE.PointCloud has been renamed to THREE.Points."),new a.Points(t,e)},Particle:a.Sprite,ParticleSystem:function(t,e){return console.warn("THREE.ParticleSystem has been renamed to THREE.Points."),new a.Points(t,e)},PointCloudMaterial:function(t){return console.warn("THREE.PointCloudMaterial has been renamed to THREE.PointsMaterial."),new a.PointsMaterial(t)},ParticleBasicMaterial:function(t){return console.warn("THREE.ParticleBasicMaterial has been renamed to THREE.PointsMaterial."),new a.PointsMaterial(t)},ParticleSystemMaterial:function(t){return console.warn("THREE.ParticleSystemMaterial has been renamed to THREE.PointsMaterial."),new a.PointsMaterial(t)},Vertex:function(t,e,n){return console.warn("THREE.Vertex has been removed. Use THREE.Vector3 instead."),new a.Vector3(t,e,n)}}),Object.assign(a.Box2.prototype,{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)}}),Object.assign(a.Box3.prototype,{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)}}),Object.assign(a.Matrix3.prototype,{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)}}),Object.assign(a.Matrix4.prototype,{extractPosition:function(t){return console.warn("THREE.Matrix4: .extractPosition() has been renamed to .copyPosition()."),this.copyPosition(t)},setRotationFromQuaternion:function(t){return console.warn("THREE.Matrix4: .setRotationFromQuaternion() has been renamed to .makeRotationFromQuaternion()."),this.makeRotationFromQuaternion(t)},multiplyVector3:function(t){return console.warn("THREE.Matrix4: .multiplyVector3() has been removed. Use vector.applyMatrix4( matrix ) or vector.applyProjection( matrix ) instead."),t.applyProjection(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(t){console.error("THREE.Matrix4: .translate() has been removed.")},rotateX:function(t){console.error("THREE.Matrix4: .rotateX() has been removed.")},rotateY:function(t){console.error("THREE.Matrix4: .rotateY() has been removed.")},rotateZ:function(t){console.error("THREE.Matrix4: .rotateZ() has been removed.")},rotateByAxis:function(t,e){console.error("THREE.Matrix4: .rotateByAxis() has been removed.")}}),Object.assign(a.Plane.prototype,{isIntersectionLine:function(t){return console.warn("THREE.Plane: .isIntersectionLine() has been renamed to .intersectsLine()."),this.intersectsLine(t)}}),Object.assign(a.Quaternion.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(a.Ray.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(a.Vector3.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)}}),Object.assign(a.Object3D.prototype,{getChildByName:function(t){return console.warn("THREE.Object3D: .getChildByName() has been renamed to .getObjectByName()."),this.getObjectByName(t)},renderDepth:function(t){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(a.Object3D.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(t){console.warn("THREE.Object3D: .useQuaternion has been removed. The library now uses quaternions by default.")}}}),Object.defineProperties(a.LOD.prototype,{objects:{get:function(){return console.warn("THREE.LOD: .objects has been renamed to .levels."),this.levels}}}),a.PerspectiveCamera.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(a.Light.prototype,{onlyShadow:{set:function(t){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(t){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(t){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(a.BufferAttribute.prototype,{length:{get:function(){return console.warn("THREE.BufferAttribute: .length has been deprecated. Please use .count."),this.array.length}}}),Object.assign(a.BufferGeometry.prototype,{addIndex:function(t){console.warn("THREE.BufferGeometry: .addIndex() has been renamed to .setIndex()."),this.setIndex(t)},addDrawCall:function(t,e,n){void 0!==n&&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(a.BufferGeometry.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(a.Material.prototype,{wrapAround:{get:function(){console.warn("THREE."+this.type+": .wrapAround has been removed.")},set:function(t){console.warn("THREE."+this.type+": .wrapAround has been removed.")}},wrapRGB:{get:function(){return console.warn("THREE."+this.type+": .wrapRGB has been removed."),new a.Color}}}),Object.defineProperties(a.MeshPhongMaterial.prototype,{metal:{get:function(){return console.warn("THREE.MeshPhongMaterial: .metal has been removed. Use THREE.MeshStandardMaterial instead."),!1},set:function(t){console.warn("THREE.MeshPhongMaterial: .metal has been removed. Use THREE.MeshStandardMaterial instead")}}}),Object.defineProperties(a.ShaderMaterial.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}}}),a.EventDispatcher.prototype=Object.assign(Object.create({constructor:a.EventDispatcher,apply:function(t){console.warn("THREE.EventDispatcher: .apply is deprecated, just inherit or Object.assign the prototype to mix-in."),Object.assign(t,this)}}),a.EventDispatcher.prototype),Object.assign(a.WebGLRenderer.prototype,{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 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(a.WebGLRenderer.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(a.WebGLShadowMap.prototype,{cullFace:{get:function(){return this.renderReverseSided?a.CullFaceFront:a.CullFaceBack},set:function(t){var e=t!==a.CullFaceBack;console.warn("WebGLRenderer: .shadowMap.cullFace is deprecated. Set .shadowMap.renderReverseSided to "+e+"."),this.renderReverseSided=e}}}),Object.defineProperties(a.WebGLRenderTarget.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}}}),Object.assign(a.Audio.prototype,{load:function(t){console.warn("THREE.Audio: .load has been deprecated. Please use THREE.AudioLoader.");var e=this,n=new a.AudioLoader;return n.load(t,function(t){e.setBuffer(t)}),this}}),Object.assign(a.AudioAnalyser.prototype,{getData:function(t){return console.warn("THREE.AudioAnalyser: .getData() is now .getFrequencyData()."),this.getFrequencyData()}}),a.GeometryUtils={merge:function(t,e,n){console.warn("THREE.GeometryUtils: .merge() has been moved to Geometry. Use geometry.merge( geometry2, matrix, materialIndexOffset ) instead.");var r;e instanceof a.Mesh&&(e.matrixAutoUpdate&&e.updateMatrix(),r=e.matrix,e=e.geometry),t.merge(e,r,n)},center:function(t){return console.warn("THREE.GeometryUtils: .center() has been moved to Geometry. Use geometry.center() instead."),t.center()}},a.ImageUtils={crossOrigin:void 0,loadTexture:function(t,e,n,r){console.warn("THREE.ImageUtils.loadTexture has been deprecated. Use THREE.TextureLoader() instead.");var i=new a.TextureLoader;i.setCrossOrigin(this.crossOrigin);var o=i.load(t,n,void 0,r);return e&&(o.mapping=e),o},loadTextureCube:function(t,e,n,r){console.warn("THREE.ImageUtils.loadTextureCube has been deprecated. Use THREE.CubeTextureLoader() instead.");var i=new a.CubeTextureLoader;i.setCrossOrigin(this.crossOrigin);var o=i.load(t,n,void 0,r);return e&&(o.mapping=e),o},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.")}},a.Projector=function(){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(t,e){console.error("THREE.Projector: .pickingRay() is now raycaster.setFromCamera().")}},a.CanvasRenderer=function(){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(){}},a.CurveUtils={tangentQuadraticBezier:function(t,e,n,r){return 2*(1-t)*(n-e)+2*t*(r-n)},tangentCubicBezier:function(t,e,n,r,i){return-3*e*(1-t)*(1-t)+3*n*(1-t)*(1-t)-6*t*n*(1-t)+6*t*r*(1-t)-3*t*t*r+3*t*t*i},tangentSpline:function(t,e,n,r,i){var a=6*t*t-6*t,o=3*t*t-4*t+1,s=-6*t*t+6*t,c=3*t*t-2*t;return a+o+s+c},interpolate:function(t,e,n,r,i){var a=.5*(n-t),o=.5*(r-e),s=i*i,c=i*s;return(2*e-2*n+a+o)*c+(-3*e+3*n-2*a-o)*s+a*i+e}},a.SceneUtils={createMultiMaterialObject:function(t,e){for(var n=new a.Group,r=0,i=e.length;r<i;r++)n.add(new a.Mesh(t,e[r]));return n},detach:function(t,e,n){t.applyMatrix(e.matrixWorld),e.remove(t),n.add(t)},attach:function(t,e,n){var r=new a.Matrix4;r.getInverse(n.matrixWorld),t.applyMatrix(r),e.remove(t),n.add(t)}},a.ShapeUtils={area:function(t){for(var e=t.length,n=0,r=e-1,i=0;i<e;r=i++)n+=t[r].x*t[i].y-t[i].x*t[r].y;return.5*n},triangulate:function(){function t(t,e,n,r,i,a){var o,s,c,u,l,h,f,p,d;if(s=t[a[e]].x,c=t[a[e]].y,u=t[a[n]].x,l=t[a[n]].y,h=t[a[r]].x,f=t[a[r]].y,Number.EPSILON>(u-s)*(f-c)-(l-c)*(h-s))return!1;var m,g,v,y,x,b,M,_,w,S,E,T,A,L,C;for(m=h-u,g=f-l,v=s-h,y=c-f,x=u-s,b=l-c,o=0;o<i;o++)if(p=t[a[o]].x,d=t[a[o]].y,!(p===s&&d===c||p===u&&d===l||p===h&&d===f)&&(M=p-s,_=d-c,w=p-u,S=d-l,E=p-h,T=d-f,C=m*S-g*w,A=x*_-b*M,L=v*T-y*E,C>=-Number.EPSILON&&L>=-Number.EPSILON&&A>=-Number.EPSILON))return!1;return!0}return function(e,n){var r=e.length;if(r<3)return null;var i,o,s,c=[],u=[],l=[];if(a.ShapeUtils.area(e)>0)for(o=0;o<r;o++)u[o]=o;else for(o=0;o<r;o++)u[o]=r-1-o;var h=r,f=2*h;for(o=h-1;h>2;){if(f--<=0)return console.warn("THREE.ShapeUtils: Unable to triangulate polygon! in triangulate()"),n?l:c;if(i=o,h<=i&&(i=0),o=i+1,h<=o&&(o=0),s=o+1,h<=s&&(s=0),t(e,i,o,s,h,u)){var p,d,m,g,v;for(p=u[i],d=u[o],m=u[s],c.push([e[p],e[d],e[m]]),l.push([u[i],u[o],u[s]]),g=o,v=o+1;v<h;g++,v++)u[g]=u[v];h--,f=2*h}}return n?l:c}}(),triangulateShape:function(t,e){function n(t,e,n){return t.x!==e.x?t.x<e.x?t.x<=n.x&&n.x<=e.x:e.x<=n.x&&n.x<=t.x:t.y<e.y?t.y<=n.y&&n.y<=e.y:e.y<=n.y&&n.y<=t.y}function r(t,e,r,i,a){var o=e.x-t.x,s=e.y-t.y,c=i.x-r.x,u=i.y-r.y,l=t.x-r.x,h=t.y-r.y,f=s*c-o*u,p=s*l-o*h;if(Math.abs(f)>Number.EPSILON){var d;if(f>0){if(p<0||p>f)return[];if(d=u*l-c*h,d<0||d>f)return[]}else{if(p>0||p<f)return[];if(d=u*l-c*h,d>0||d<f)return[]}if(0===d)return!a||0!==p&&p!==f?[t]:[];if(d===f)return!a||0!==p&&p!==f?[e]:[];if(0===p)return[r];if(p===f)return[i];var m=d/f;return[{x:t.x+m*o,y:t.y+m*s}]}if(0!==p||u*l!==c*h)return[];var g=0===o&&0===s,v=0===c&&0===u;if(g&&v)return t.x!==r.x||t.y!==r.y?[]:[t];if(g)return n(r,i,t)?[t]:[];if(v)return n(t,e,r)?[r]:[];var y,x,b,M,_,w,S,E;return 0!==o?(t.x<e.x?(y=t,b=t.x,x=e,M=e.x):(y=e,b=e.x,x=t,M=t.x),r.x<i.x?(_=r,S=r.x,w=i,E=i.x):(_=i,S=i.x,w=r,E=r.x)):(t.y<e.y?(y=t,b=t.y,x=e,M=e.y):(y=e,b=e.y,x=t,M=t.y),r.y<i.y?(_=r,S=r.y,w=i,E=i.y):(_=i,S=i.y,w=r,E=r.y)),b<=S?M<S?[]:M===S?a?[]:[_]:M<=E?[_,x]:[_,w]:b>E?[]:b===E?a?[]:[y]:M<=E?[y,x]:[y,w]}function i(t,e,n,r){var i=e.x-t.x,a=e.y-t.y,o=n.x-t.x,s=n.y-t.y,c=r.x-t.x,u=r.y-t.y,l=i*s-a*o,h=i*u-a*c;if(Math.abs(l)>Number.EPSILON){var f=c*s-u*o;return l>0?h>=0&&f>=0:h>=0||f>=0}return h>0}function o(t,e){function n(t,e){var n=y.length-1,r=t-1;r<0&&(r=n);var a=t+1;a>n&&(a=0);var o=i(y[t],y[r],y[a],s[e]);if(!o)return!1;var c=s.length-1,u=e-1;u<0&&(u=c);var l=e+1;return l>c&&(l=0),o=i(s[e],s[u],s[l],y[t]),!!o}function a(t,e){var n,i,a;for(n=0;n<y.length;n++)if(i=n+1,i%=y.length,a=r(t,e,y[n],y[i],!0),a.length>0)return!0;return!1}function o(t,n){var i,a,o,s,c;for(i=0;i<x.length;i++)for(a=e[x[i]],o=0;o<a.length;o++)if(s=o+1,s%=a.length,c=r(t,n,a[o],a[s],!0),c.length>0)return!0;return!1}for(var s,c,u,l,h,f,p,d,m,g,v,y=t.concat(),x=[],b=[],M=0,_=e.length;M<_;M++)x.push(M);for(var w=0,S=2*x.length;x.length>0;){if(S--,S<0){console.log("Infinite Loop! Holes left:"+x.length+", Probably Hole outside Shape!");
-break}for(u=w;u<y.length;u++){l=y[u],c=-1;for(var M=0;M<x.length;M++)if(f=x[M],p=l.x+":"+l.y+":"+f,void 0===b[p]){s=e[f];for(var E=0;E<s.length;E++)if(h=s[E],n(u,E)&&!a(l,h)&&!o(l,h)){c=E,x.splice(M,1),d=y.slice(0,u+1),m=y.slice(u),g=s.slice(c),v=s.slice(0,c+1),y=d.concat(g).concat(v).concat(m),w=u;break}if(c>=0)break;b[p]=!0}if(c>=0)break}}return y}for(var s,c,u,l,h,f,p={},d=t.concat(),m=0,g=e.length;m<g;m++)Array.prototype.push.apply(d,e[m]);for(s=0,c=d.length;s<c;s++)h=d[s].x+":"+d[s].y,void 0!==p[h]&&console.warn("THREE.Shape: Duplicate point",h),p[h]=s;var v=o(t,e),y=a.ShapeUtils.triangulate(v,!1);for(s=0,c=y.length;s<c;s++)for(l=y[s],u=0;u<3;u++)h=l[u].x+":"+l[u].y,f=p[h],void 0!==f&&(l[u]=f);return y.concat()},isClockWise:function(t){return a.ShapeUtils.area(t)<0},b2:function(){function t(t,e){var n=1-t;return n*n*e}function e(t,e){return 2*(1-t)*t*e}function n(t,e){return t*t*e}return function(r,i,a,o){return t(r,i)+e(r,a)+n(r,o)}}(),b3:function(){function t(t,e){var n=1-t;return n*n*n*e}function e(t,e){var n=1-t;return 3*n*n*t*e}function n(t,e){var n=1-t;return 3*n*t*t*e}function r(t,e){return t*t*t*e}return function(i,a,o,s,c){return t(i,a)+e(i,o)+n(i,s)+r(i,c)}}()},a.Curve=function(){},a.Curve.prototype={constructor:a.Curve,getPoint:function(t){return console.warn("THREE.Curve: Warning, getPoint() not implemented!"),null},getPointAt:function(t){var e=this.getUtoTmapping(t);return this.getPoint(e)},getPoints:function(t){t||(t=5);var e,n=[];for(e=0;e<=t;e++)n.push(this.getPoint(e/t));return n},getSpacedPoints:function(t){t||(t=5);var e,n=[];for(e=0;e<=t;e++)n.push(this.getPointAt(e/t));return n},getLength:function(){var t=this.getLengths();return t[t.length-1]},getLengths:function(t){if(t||(t=this.__arcLengthDivisions?this.__arcLengthDivisions:200),this.cacheArcLengths&&this.cacheArcLengths.length===t+1&&!this.needsUpdate)return this.cacheArcLengths;this.needsUpdate=!1;var e,n,r=[],i=this.getPoint(0),a=0;for(r.push(0),n=1;n<=t;n++)e=this.getPoint(n/t),a+=e.distanceTo(i),r.push(a),i=e;return this.cacheArcLengths=r,r},updateArcLengths:function(){this.needsUpdate=!0,this.getLengths()},getUtoTmapping:function(t,e){var n,r=this.getLengths(),i=0,a=r.length;n=e?e:t*r[a-1];for(var o,s=0,c=a-1;s<=c;)if(i=Math.floor(s+(c-s)/2),o=r[i]-n,o<0)s=i+1;else{if(!(o>0)){c=i;break}c=i-1}if(i=c,r[i]===n){var u=i/(a-1);return u}var l=r[i],h=r[i+1],f=h-l,p=(n-l)/f,u=(i+p)/(a-1);return u},getTangent:function(t){var e=1e-4,n=t-e,r=t+e;n<0&&(n=0),r>1&&(r=1);var i=this.getPoint(n),a=this.getPoint(r),o=a.clone().sub(i);return o.normalize()},getTangentAt:function(t){var e=this.getUtoTmapping(t);return this.getTangent(e)}},a.Curve.create=function(t,e){return t.prototype=Object.create(a.Curve.prototype),t.prototype.constructor=t,t.prototype.getPoint=e,t},a.CurvePath=function(){this.curves=[],this.autoClose=!1},a.CurvePath.prototype=Object.assign(Object.create(a.Curve.prototype),{constructor:a.CurvePath,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 a.LineCurve(e,t))},getPoint:function(t){for(var e=t*this.getLength(),n=this.getCurveLengths(),r=0;r<n.length;){if(n[r]>=e){var i=n[r]-e,a=this.curves[r],o=1-i/a.getLength();return a.getPointAt(o)}r++}return null},getLength:function(){var t=this.getCurveLengths();return t[t.length-1]},updateArcLengths:function(){this.needsUpdate=!0,this.cacheLengths=null,this.getLengths()},getCurveLengths:function(){if(this.cacheLengths&&this.cacheLengths.length===this.curves.length)return this.cacheLengths;for(var t=[],e=0,n=0,r=this.curves.length;n<r;n++)e+=this.curves[n].getLength(),t.push(e);return this.cacheLengths=t,t},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 a.Geometry,n=0,r=t.length;n<r;n++){var i=t[n];e.vertices.push(new a.Vector3(i.x,i.y,i.z||0))}return e}}),a.Font=function(t){this.data=t},Object.assign(a.Font.prototype,{generateShapes:function(t,e,n){function r(t){for(var n=String(t).split(""),r=e/o.resolution,a=0,s=[],c=0;c<n.length;c++){var u=i(n[c],r,a);a+=u.offset,s.push(u.path)}return s}function i(t,e,r){var i=o.glyphs[t]||o.glyphs["?"];if(i){var s,c,u,l,h,f,p,d,m,g,v,y=new a.Path,x=[],b=a.ShapeUtils.b2,M=a.ShapeUtils.b3;if(i.o)for(var _=i._cachedOutline||(i._cachedOutline=i.o.split(" ")),w=0,S=_.length;w<S;){var E=_[w++];switch(E){case"m":s=_[w++]*e+r,c=_[w++]*e,y.moveTo(s,c);break;case"l":s=_[w++]*e+r,c=_[w++]*e,y.lineTo(s,c);break;case"q":if(u=_[w++]*e+r,l=_[w++]*e,p=_[w++]*e+r,d=_[w++]*e,y.quadraticCurveTo(p,d,u,l),v=x[x.length-1]){h=v.x,f=v.y;for(var T=1;T<=n;T++){var A=T/n;b(A,h,p,u),b(A,f,d,l)}}break;case"b":if(u=_[w++]*e+r,l=_[w++]*e,p=_[w++]*e+r,d=_[w++]*e,m=_[w++]*e+r,g=_[w++]*e,y.bezierCurveTo(p,d,m,g,u,l),v=x[x.length-1]){h=v.x,f=v.y;for(var T=1;T<=n;T++){var A=T/n;M(A,h,p,m,u),M(A,f,d,g,l)}}}}return{offset:i.ha*e,path:y}}}void 0===e&&(e=100),void 0===n&&(n=4);for(var o=this.data,s=r(t),c=[],u=0,l=s.length;u<l;u++)Array.prototype.push.apply(c,s[u].toShapes());return c}}),a.Path=function(t){a.CurvePath.call(this),this.actions=[],t&&this.fromPoints(t)},a.Path.prototype=Object.assign(Object.create(a.CurvePath.prototype),{constructor:a.Path,fromPoints:function(t){this.moveTo(t[0].x,t[0].y);for(var e=1,n=t.length;e<n;e++)this.lineTo(t[e].x,t[e].y)},moveTo:function(t,e){this.actions.push({action:"moveTo",args:[t,e]})},lineTo:function(t,e){var n=this.actions[this.actions.length-1].args,r=n[n.length-2],i=n[n.length-1],o=new a.LineCurve(new a.Vector2(r,i),new a.Vector2(t,e));this.curves.push(o),this.actions.push({action:"lineTo",args:[t,e]})},quadraticCurveTo:function(t,e,n,r){var i=this.actions[this.actions.length-1].args,o=i[i.length-2],s=i[i.length-1],c=new a.QuadraticBezierCurve(new a.Vector2(o,s),new a.Vector2(t,e),new a.Vector2(n,r));this.curves.push(c),this.actions.push({action:"quadraticCurveTo",args:[t,e,n,r]})},bezierCurveTo:function(t,e,n,r,i,o){var s=this.actions[this.actions.length-1].args,c=s[s.length-2],u=s[s.length-1],l=new a.CubicBezierCurve(new a.Vector2(c,u),new a.Vector2(t,e),new a.Vector2(n,r),new a.Vector2(i,o));this.curves.push(l),this.actions.push({action:"bezierCurveTo",args:[t,e,n,r,i,o]})},splineThru:function(t){var e=Array.prototype.slice.call(arguments),n=this.actions[this.actions.length-1].args,r=n[n.length-2],i=n[n.length-1],o=[new a.Vector2(r,i)];Array.prototype.push.apply(o,t);var s=new a.SplineCurve(o);this.curves.push(s);var c=t[t.length-1];e.push(c.x),e.push(c.y),this.actions.push({action:"splineThru",args:e})},arc:function(t,e,n,r,i,a){var o=this.actions[this.actions.length-1].args,s=o[o.length-2],c=o[o.length-1];this.absarc(t+s,e+c,n,r,i,a)},absarc:function(t,e,n,r,i,a){this.absellipse(t,e,n,n,r,i,a)},ellipse:function(t,e,n,r,i,a,o,s){var c=this.actions[this.actions.length-1].args,u=c[c.length-2],l=c[c.length-1];this.absellipse(t+u,e+l,n,r,i,a,o,s)},absellipse:function(t,e,n,r,i,o,s,c){var u=[t,e,n,r,i,o,s,c||0],l=new a.EllipseCurve(t,e,n,r,i,o,s,c);this.curves.push(l);var h=l.getPoint(1);u.push(h.x),u.push(h.y),this.actions.push({action:"ellipse",args:u})},getSpacedPoints:function(t){t||(t=40);for(var e=[],n=0;n<t;n++)e.push(this.getPoint(n/t));return this.autoClose&&e.push(e[0]),e},getPoints:function(t){t=t||12;for(var e,n,r,i,o,s,c,u,l,h,f,p=a.ShapeUtils.b2,d=a.ShapeUtils.b3,m=[],g=0,v=this.actions.length;g<v;g++){var y=this.actions[g],x=y.action,b=y.args;switch(x){case"moveTo":m.push(new a.Vector2(b[0],b[1]));break;case"lineTo":m.push(new a.Vector2(b[0],b[1]));break;case"quadraticCurveTo":e=b[2],n=b[3],o=b[0],s=b[1],m.length>0?(l=m[m.length-1],c=l.x,u=l.y):(l=this.actions[g-1].args,c=l[l.length-2],u=l[l.length-1]);for(var M=1;M<=t;M++){var _=M/t;h=p(_,c,o,e),f=p(_,u,s,n),m.push(new a.Vector2(h,f))}break;case"bezierCurveTo":e=b[4],n=b[5],o=b[0],s=b[1],r=b[2],i=b[3],m.length>0?(l=m[m.length-1],c=l.x,u=l.y):(l=this.actions[g-1].args,c=l[l.length-2],u=l[l.length-1]);for(var M=1;M<=t;M++){var _=M/t;h=d(_,c,o,r,e),f=d(_,u,s,i,n),m.push(new a.Vector2(h,f))}break;case"splineThru":l=this.actions[g-1].args;var w=new a.Vector2(l[l.length-2],l[l.length-1]),S=[w],E=t*b[0].length;S=S.concat(b[0]);for(var T=new a.SplineCurve(S),M=1;M<=E;M++)m.push(T.getPointAt(M/E));break;case"arc":for(var A,L=b[0],C=b[1],R=b[2],P=b[3],D=b[4],N=!!b[5],U=D-P,B=2*t,M=1;M<=B;M++){var _=M/B;N||(_=1-_),A=P+_*U,h=L+R*Math.cos(A),f=C+R*Math.sin(A),m.push(new a.Vector2(h,f))}break;case"ellipse":var A,I,O,L=b[0],C=b[1],F=b[2],V=b[3],P=b[4],D=b[5],N=!!b[6],G=b[7],U=D-P,B=2*t;0!==G&&(I=Math.cos(G),O=Math.sin(G));for(var M=1;M<=B;M++){var _=M/B;if(N||(_=1-_),A=P+_*U,h=L+F*Math.cos(A),f=C+V*Math.sin(A),0!==G){var k=h,z=f;h=(k-L)*I-(z-C)*O+L,f=(k-L)*O+(z-C)*I+C}m.push(new a.Vector2(h,f))}}}var H=m[m.length-1];return Math.abs(H.x-m[0].x)<Number.EPSILON&&Math.abs(H.y-m[0].y)<Number.EPSILON&&m.splice(m.length-1,1),this.autoClose&&m.push(m[0]),m},toShapes:function(t,e){function n(t){for(var e=[],n=new a.Path,r=0,i=t.length;r<i;r++){var o=t[r],s=o.args,c=o.action;"moveTo"===c&&0!==n.actions.length&&(e.push(n),n=new a.Path),n[c].apply(n,s)}return 0!==n.actions.length&&e.push(n),e}function r(t){for(var e=[],n=0,r=t.length;n<r;n++){var i=t[n],o=new a.Shape;o.actions=i.actions,o.curves=i.curves,e.push(o)}return e}function i(t,e){for(var n=e.length,r=!1,i=n-1,a=0;a<n;i=a++){var o=e[i],s=e[a],c=s.x-o.x,u=s.y-o.y;if(Math.abs(u)>Number.EPSILON){if(u<0&&(o=e[a],c=-c,s=e[i],u=-u),t.y<o.y||t.y>s.y)continue;if(t.y===o.y){if(t.x===o.x)return!0}else{var l=u*(t.x-o.x)-c*(t.y-o.y);if(0===l)return!0;if(l<0)continue;r=!r}}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 r}var o=a.ShapeUtils.isClockWise,s=n(this.actions);if(0===s.length)return[];if(e===!0)return r(s);var c,u,l,h=[];if(1===s.length)return u=s[0],l=new a.Shape,l.actions=u.actions,l.curves=u.curves,h.push(l),h;var f=!o(s[0].getPoints());f=t?!f:f;var p,d=[],m=[],g=[],v=0;m[v]=void 0,g[v]=[];for(var y=0,x=s.length;y<x;y++)u=s[y],p=u.getPoints(),c=o(p),c=t?!c:c,c?(!f&&m[v]&&v++,m[v]={s:new a.Shape,p:p},m[v].s.actions=u.actions,m[v].s.curves=u.curves,f&&v++,g[v]=[]):g[v].push({h:u,p:p[0]});if(!m[0])return r(s);if(m.length>1){for(var b=!1,M=[],_=0,w=m.length;_<w;_++)d[_]=[];for(var _=0,w=m.length;_<w;_++)for(var S=g[_],E=0;E<S.length;E++){for(var T=S[E],A=!0,L=0;L<m.length;L++)i(T.p,m[L].p)&&(_!==L&&M.push({froms:_,tos:L,hole:E}),A?(A=!1,d[L].push(T)):b=!0);A&&d[_].push(T)}M.length>0&&(b||(g=d))}for(var C,y=0,R=m.length;y<R;y++){l=m[y].s,h.push(l),C=g[y];for(var P=0,D=C.length;P<D;P++)l.holes.push(C[P].h)}return h}}),a.Shape=function(){a.Path.apply(this,arguments),this.holes=[]},a.Shape.prototype=Object.assign(Object.create(a.Path.prototype),{constructor:a.Shape,extrude:function(t){return new a.ExtrudeGeometry(this,t)},makeGeometry:function(t){return new a.ShapeGeometry(this,t)},getPointsHoles:function(t){for(var e=[],n=0,r=this.holes.length;n<r;n++)e[n]=this.holes[n].getPoints(t);return e},extractAllPoints:function(t){return{shape:this.getPoints(t),holes:this.getPointsHoles(t)}},extractPoints:function(t){return this.extractAllPoints(t)}}),a.LineCurve=function(t,e){this.v1=t,this.v2=e},a.LineCurve.prototype=Object.create(a.Curve.prototype),a.LineCurve.prototype.constructor=a.LineCurve,a.LineCurve.prototype.getPoint=function(t){var e=this.v2.clone().sub(this.v1);return e.multiplyScalar(t).add(this.v1),e},a.LineCurve.prototype.getPointAt=function(t){return this.getPoint(t)},a.LineCurve.prototype.getTangent=function(t){var e=this.v2.clone().sub(this.v1);return e.normalize()},a.QuadraticBezierCurve=function(t,e,n){this.v0=t,this.v1=e,this.v2=n},a.QuadraticBezierCurve.prototype=Object.create(a.Curve.prototype),a.QuadraticBezierCurve.prototype.constructor=a.QuadraticBezierCurve,a.QuadraticBezierCurve.prototype.getPoint=function(t){var e=a.ShapeUtils.b2;return new a.Vector2(e(t,this.v0.x,this.v1.x,this.v2.x),e(t,this.v0.y,this.v1.y,this.v2.y))},a.QuadraticBezierCurve.prototype.getTangent=function(t){var e=a.CurveUtils.tangentQuadraticBezier;return new a.Vector2(e(t,this.v0.x,this.v1.x,this.v2.x),e(t,this.v0.y,this.v1.y,this.v2.y)).normalize()},a.CubicBezierCurve=function(t,e,n,r){this.v0=t,this.v1=e,this.v2=n,this.v3=r},a.CubicBezierCurve.prototype=Object.create(a.Curve.prototype),a.CubicBezierCurve.prototype.constructor=a.CubicBezierCurve,a.CubicBezierCurve.prototype.getPoint=function(t){var e=a.ShapeUtils.b3;return new a.Vector2(e(t,this.v0.x,this.v1.x,this.v2.x,this.v3.x),e(t,this.v0.y,this.v1.y,this.v2.y,this.v3.y))},a.CubicBezierCurve.prototype.getTangent=function(t){var e=a.CurveUtils.tangentCubicBezier;return new a.Vector2(e(t,this.v0.x,this.v1.x,this.v2.x,this.v3.x),e(t,this.v0.y,this.v1.y,this.v2.y,this.v3.y)).normalize()},a.SplineCurve=function(t){this.points=void 0==t?[]:t},a.SplineCurve.prototype=Object.create(a.Curve.prototype),a.SplineCurve.prototype.constructor=a.SplineCurve,a.SplineCurve.prototype.getPoint=function(t){var e=this.points,n=(e.length-1)*t,r=Math.floor(n),i=n-r,o=e[0===r?r:r-1],s=e[r],c=e[r>e.length-2?e.length-1:r+1],u=e[r>e.length-3?e.length-1:r+2],l=a.CurveUtils.interpolate;return new a.Vector2(l(o.x,s.x,c.x,u.x,i),l(o.y,s.y,c.y,u.y,i))},a.EllipseCurve=function(t,e,n,r,i,a,o,s){this.aX=t,this.aY=e,this.xRadius=n,this.yRadius=r,this.aStartAngle=i,this.aEndAngle=a,this.aClockwise=o,this.aRotation=s||0},a.EllipseCurve.prototype=Object.create(a.Curve.prototype),a.EllipseCurve.prototype.constructor=a.EllipseCurve,a.EllipseCurve.prototype.getPoint=function(t){var e=this.aEndAngle-this.aStartAngle;e<0&&(e+=2*Math.PI),e>2*Math.PI&&(e-=2*Math.PI);var n;n=this.aClockwise===!0?this.aEndAngle+(1-t)*(2*Math.PI-e):this.aStartAngle+t*e;var r=this.aX+this.xRadius*Math.cos(n),i=this.aY+this.yRadius*Math.sin(n);if(0!==this.aRotation){var o=Math.cos(this.aRotation),s=Math.sin(this.aRotation),c=r,u=i;r=(c-this.aX)*o-(u-this.aY)*s+this.aX,i=(c-this.aX)*s+(u-this.aY)*o+this.aY}return new a.Vector2(r,i)},a.ArcCurve=function(t,e,n,r,i,o){a.EllipseCurve.call(this,t,e,n,n,r,i,o)},a.ArcCurve.prototype=Object.create(a.EllipseCurve.prototype),a.ArcCurve.prototype.constructor=a.ArcCurve,a.LineCurve3=a.Curve.create(function(t,e){this.v1=t,this.v2=e},function(t){var e=new a.Vector3;return e.subVectors(this.v2,this.v1),e.multiplyScalar(t),e.add(this.v1),e}),a.QuadraticBezierCurve3=a.Curve.create(function(t,e,n){this.v0=t,this.v1=e,this.v2=n},function(t){var e=a.ShapeUtils.b2;return new a.Vector3(e(t,this.v0.x,this.v1.x,this.v2.x),e(t,this.v0.y,this.v1.y,this.v2.y),e(t,this.v0.z,this.v1.z,this.v2.z))}),a.CubicBezierCurve3=a.Curve.create(function(t,e,n,r){this.v0=t,this.v1=e,this.v2=n,this.v3=r},function(t){var e=a.ShapeUtils.b3;return new a.Vector3(e(t,this.v0.x,this.v1.x,this.v2.x,this.v3.x),e(t,this.v0.y,this.v1.y,this.v2.y,this.v3.y),e(t,this.v0.z,this.v1.z,this.v2.z,this.v3.z))}),a.SplineCurve3=a.Curve.create(function(t){console.warn("THREE.SplineCurve3 will be deprecated. Please use THREE.CatmullRomCurve3"),this.points=void 0==t?[]:t},function(t){var e=this.points,n=(e.length-1)*t,r=Math.floor(n),i=n-r,o=e[0==r?r:r-1],s=e[r],c=e[r>e.length-2?e.length-1:r+1],u=e[r>e.length-3?e.length-1:r+2],l=a.CurveUtils.interpolate;return new a.Vector3(l(o.x,s.x,c.x,u.x,i),l(o.y,s.y,c.y,u.y,i),l(o.z,s.z,c.z,u.z,i))}),a.CatmullRomCurve3=function(){function t(){}var e=new a.Vector3,n=new t,r=new t,i=new t;return t.prototype.init=function(t,e,n,r){this.c0=t,this.c1=n,this.c2=-3*t+3*e-2*n-r,this.c3=2*t-2*e+n+r},t.prototype.initNonuniformCatmullRom=function(t,e,n,r,i,a,o){var s=(e-t)/i-(n-t)/(i+a)+(n-e)/a,c=(n-e)/a-(r-e)/(a+o)+(r-n)/o;s*=a,c*=a,this.init(e,n,s,c)},t.prototype.initCatmullRom=function(t,e,n,r,i){this.init(e,n,i*(n-t),i*(r-e))},t.prototype.calc=function(t){var e=t*t,n=e*t;return this.c0+this.c1*t+this.c2*e+this.c3*n},a.Curve.create(function(t){this.points=t||[],this.closed=!1},function(t){var o,s,c,u,l=this.points;u=l.length,u<2&&console.log("duh, you need at least 2 points"),o=(u-(this.closed?0:1))*t,s=Math.floor(o),c=o-s,this.closed?s+=s>0?0:(Math.floor(Math.abs(s)/l.length)+1)*l.length:0===c&&s===u-1&&(s=u-2,c=1);var h,f,p,d;if(this.closed||s>0?h=l[(s-1)%u]:(e.subVectors(l[0],l[1]).add(l[0]),h=e),f=l[s%u],p=l[(s+1)%u],this.closed||s+2<u?d=l[(s+2)%u]:(e.subVectors(l[u-1],l[u-2]).add(l[u-1]),d=e),void 0===this.type||"centripetal"===this.type||"chordal"===this.type){var m="chordal"===this.type?.5:.25,g=Math.pow(h.distanceToSquared(f),m),v=Math.pow(f.distanceToSquared(p),m),y=Math.pow(p.distanceToSquared(d),m);v<1e-4&&(v=1),g<1e-4&&(g=v),y<1e-4&&(y=v),n.initNonuniformCatmullRom(h.x,f.x,p.x,d.x,g,v,y),r.initNonuniformCatmullRom(h.y,f.y,p.y,d.y,g,v,y),i.initNonuniformCatmullRom(h.z,f.z,p.z,d.z,g,v,y)}else if("catmullrom"===this.type){var x=void 0!==this.tension?this.tension:.5;n.initCatmullRom(h.x,f.x,p.x,d.x,x),r.initCatmullRom(h.y,f.y,p.y,d.y,x),i.initCatmullRom(h.z,f.z,p.z,d.z,x)}var b=new a.Vector3(n.calc(c),r.calc(c),i.calc(c));return b})}(),a.ClosedSplineCurve3=function(t){console.warn("THREE.ClosedSplineCurve3 has been deprecated. Please use THREE.CatmullRomCurve3."),a.CatmullRomCurve3.call(this,t),this.type="catmullrom",this.closed=!0},a.ClosedSplineCurve3.prototype=Object.create(a.CatmullRomCurve3.prototype),a.BoxGeometry=function(t,e,n,r,i,o){a.Geometry.call(this),this.type="BoxGeometry",this.parameters={width:t,height:e,depth:n,widthSegments:r,heightSegments:i,depthSegments:o},this.fromBufferGeometry(new a.BoxBufferGeometry(t,e,n,r,i,o)),this.mergeVertices()},a.BoxGeometry.prototype=Object.create(a.Geometry.prototype),a.BoxGeometry.prototype.constructor=a.BoxGeometry,a.CubeGeometry=a.BoxGeometry,a.BoxBufferGeometry=function(t,e,n,r,i,o){function s(t,e,n){var r=0;return r+=(t+1)*(e+1)*2,r+=(t+1)*(n+1)*2,r+=(n+1)*(e+1)*2}function c(t,e,n){var r=0;return r+=t*e*2,r+=t*n*2,r+=n*e*2,6*r}function u(t,e,n,r,i,o,s,c,u,h,f){for(var _=o/u,w=s/h,S=o/2,E=s/2,T=c/2,A=u+1,L=h+1,C=0,R=0,P=new a.Vector3,D=0;D<L;D++)for(var N=D*w-E,U=0;U<A;U++){var B=U*_-S;P[t]=B*r,P[e]=N*i,P[n]=T,d[v]=P.x,d[v+1]=P.y,d[v+2]=P.z,P[t]=0,P[e]=0,P[n]=c>0?1:-1,m[v]=P.x,m[v+1]=P.y,m[v+2]=P.z,g[y]=U/u,g[y+1]=1-D/h,v+=3,y+=2,C+=1}for(D=0;D<h;D++)for(U=0;U<u;U++){var I=b+U+A*D,O=b+U+A*(D+1),F=b+(U+1)+A*(D+1),V=b+(U+1)+A*D;p[x]=I,p[x+1]=O,p[x+2]=V,p[x+3]=O,p[x+4]=F,p[x+5]=V,x+=6,R+=6}l.addGroup(M,R,f),M+=R,b+=C}a.BufferGeometry.call(this),this.type="BoxBufferGeometry",this.parameters={width:t,height:e,depth:n,widthSegments:r,heightSegments:i,depthSegments:o};var l=this;r=Math.floor(r)||1,i=Math.floor(i)||1,o=Math.floor(o)||1;var h=s(r,i,o),f=c(r,i,o),p=new(f>65535?Uint32Array:Uint16Array)(f),d=new Float32Array(3*h),m=new Float32Array(3*h),g=new Float32Array(2*h),v=0,y=0,x=0,b=0,M=0;u("z","y","x",-1,-1,n,e,t,o,i,0),u("z","y","x",1,-1,n,e,-t,o,i,1),u("x","z","y",1,1,t,n,e,r,o,2),u("x","z","y",1,-1,t,n,-e,r,o,3),u("x","y","z",1,-1,t,e,n,r,i,4),u("x","y","z",-1,-1,t,e,-n,r,i,5),this.setIndex(new a.BufferAttribute(p,1)),this.addAttribute("position",new a.BufferAttribute(d,3)),this.addAttribute("normal",new a.BufferAttribute(m,3)),this.addAttribute("uv",new a.BufferAttribute(g,2))},a.BoxBufferGeometry.prototype=Object.create(a.BufferGeometry.prototype),a.BoxBufferGeometry.prototype.constructor=a.BoxBufferGeometry,a.CircleGeometry=function(t,e,n,r){a.Geometry.call(this),this.type="CircleGeometry",this.parameters={radius:t,segments:e,thetaStart:n,thetaLength:r},this.fromBufferGeometry(new a.CircleBufferGeometry(t,e,n,r))},a.CircleGeometry.prototype=Object.create(a.Geometry.prototype),a.CircleGeometry.prototype.constructor=a.CircleGeometry,a.CircleBufferGeometry=function(t,e,n,r){a.BufferGeometry.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 i=e+2,o=new Float32Array(3*i),s=new Float32Array(3*i),c=new Float32Array(2*i);s[2]=1,c[0]=.5,c[1]=.5;for(var u=0,l=3,h=2;u<=e;u++,l+=3,h+=2){var f=n+u/e*r;o[l]=t*Math.cos(f),o[l+1]=t*Math.sin(f),s[l+2]=1,c[h]=(o[l]/t+1)/2,c[h+1]=(o[l+1]/t+1)/2}for(var p=[],l=1;l<=e;l++)p.push(l,l+1,0);this.setIndex(new a.BufferAttribute(new Uint16Array(p),1)),this.addAttribute("position",new a.BufferAttribute(o,3)),this.addAttribute("normal",new a.BufferAttribute(s,3)),this.addAttribute("uv",new a.BufferAttribute(c,2)),this.boundingSphere=new a.Sphere(new a.Vector3,t)},a.CircleBufferGeometry.prototype=Object.create(a.BufferGeometry.prototype),a.CircleBufferGeometry.prototype.constructor=a.CircleBufferGeometry,a.CylinderBufferGeometry=function(t,e,n,r,i,o,s,c){function u(){var t=(r+1)*(i+1);return o===!1&&(t+=(r+1)*d+r*d),t}function l(){var t=r*i*2*3;return o===!1&&(t+=r*d*3),t}function h(){var o,u,l=new a.Vector3,h=new a.Vector3,f=0,d=(e-t)/n;for(u=0;u<=i;u++){var m=[],g=u/i,T=g*(e-t)+t;for(o=0;o<=r;o++){var A=o/r;h.x=T*Math.sin(A*c+s),h.y=-g*n+S,h.z=T*Math.cos(A*c+s),y.setXYZ(M,h.x,h.y,h.z),l.copy(h),(0===t&&0===u||0===e&&u===i)&&(l.x=Math.sin(A*c+s),l.z=Math.cos(A*c+s)),l.setY(Math.sqrt(l.x*l.x+l.z*l.z)*d).normalize(),x.setXYZ(M,l.x,l.y,l.z),b.setXY(M,A,1-g),m.push(M),M++}w.push(m)}for(o=0;o<r;o++)for(u=0;u<i;u++){var L=w[u][o],C=w[u+1][o],R=w[u+1][o+1],P=w[u][o+1];v.setX(_,L),_++,v.setX(_,C),_++,v.setX(_,P),_++,v.setX(_,C),_++,v.setX(_,R),_++,v.setX(_,P),_++,f+=6}p.addGroup(E,f,0),E+=f}function f(n){var i,o,u,l=new a.Vector2,h=new a.Vector3,f=0,d=n===!0?t:e,m=n===!0?1:-1;for(o=M,i=1;i<=r;i++)y.setXYZ(M,0,S*m,0),x.setXYZ(M,0,m,0),l.x=.5,l.y=.5,b.setXY(M,l.x,l.y),M++;for(u=M,i=0;i<=r;i++){var g=i/r,w=g*c+s,T=Math.cos(w),A=Math.sin(w);h.x=d*A,h.y=S*m,h.z=d*T,y.setXYZ(M,h.x,h.y,h.z),x.setXYZ(M,0,m,0),l.x=.5*T+.5,l.y=.5*A*m+.5,b.setXY(M,l.x,l.y),M++}for(i=0;i<r;i++){var L=o+i,C=u+i;n===!0?(v.setX(_,C),_++,v.setX(_,C+1),_++,v.setX(_,L),_++):(v.setX(_,C+1),_++,v.setX(_,C),_++,v.setX(_,L),_++),f+=3}p.addGroup(E,f,n===!0?1:2),E+=f}a.BufferGeometry.call(this),this.type="CylinderBufferGeometry",this.parameters={radiusTop:t,radiusBottom:e,height:n,radialSegments:r,heightSegments:i,openEnded:o,thetaStart:s,thetaLength:c};var p=this;t=void 0!==t?t:20,e=void 0!==e?e:20,n=void 0!==n?n:100,r=Math.floor(r)||8,i=Math.floor(i)||1,o=void 0!==o&&o,s=void 0!==s?s:0,c=void 0!==c?c:2*Math.PI;var d=0;o===!1&&(t>0&&d++,e>0&&d++);var m=u(),g=l(),v=new a.BufferAttribute(new(g>65535?Uint32Array:Uint16Array)(g),1),y=new a.BufferAttribute(new Float32Array(3*m),3),x=new a.BufferAttribute(new Float32Array(3*m),3),b=new a.BufferAttribute(new Float32Array(2*m),2),M=0,_=0,w=[],S=n/2,E=0;h(),o===!1&&(t>0&&f(!0),e>0&&f(!1)),this.setIndex(v),this.addAttribute("position",y),this.addAttribute("normal",x),this.addAttribute("uv",b)},a.CylinderBufferGeometry.prototype=Object.create(a.BufferGeometry.prototype),a.CylinderBufferGeometry.prototype.constructor=a.CylinderBufferGeometry,a.CylinderGeometry=function(t,e,n,r,i,o,s,c){a.Geometry.call(this),this.type="CylinderGeometry",this.parameters={radiusTop:t,radiusBottom:e,height:n,radialSegments:r,heightSegments:i,openEnded:o,thetaStart:s,thetaLength:c},this.fromBufferGeometry(new a.CylinderBufferGeometry(t,e,n,r,i,o,s,c)),this.mergeVertices()},a.CylinderGeometry.prototype=Object.create(a.Geometry.prototype),a.CylinderGeometry.prototype.constructor=a.CylinderGeometry,a.ConeBufferGeometry=function(t,e,n,r,i,o,s){a.CylinderBufferGeometry.call(this,0,t,e,n,r,i,o,s),this.type="ConeBufferGeometry",this.parameters={radius:t,height:e,radialSegments:n,heightSegments:r,thetaStart:o,thetaLength:s}},a.ConeBufferGeometry.prototype=Object.create(a.BufferGeometry.prototype),a.ConeBufferGeometry.prototype.constructor=a.ConeBufferGeometry,a.ConeGeometry=function(t,e,n,r,i,o,s){a.CylinderGeometry.call(this,0,t,e,n,r,i,o,s),this.type="ConeGeometry",this.parameters={radius:t,height:e,radialSegments:n,heightSegments:r,openEnded:i,thetaStart:o,thetaLength:s}},a.ConeGeometry.prototype=Object.create(a.CylinderGeometry.prototype),a.ConeGeometry.prototype.constructor=a.ConeGeometry,a.EdgesGeometry=function(t,e){function n(t,e){return t-e}a.BufferGeometry.call(this),e=void 0!==e?e:1;var r,i=Math.cos(a.Math.DEG2RAD*e),o=[0,0],s={},c=["a","b","c"];t instanceof a.BufferGeometry?(r=new a.Geometry,r.fromBufferGeometry(t)):r=t.clone(),r.mergeVertices(),r.computeFaceNormals();for(var u=r.vertices,l=r.faces,h=0,f=l.length;h<f;h++)for(var p=l[h],d=0;d<3;d++){o[0]=p[c[d]],o[1]=p[c[(d+1)%3]],o.sort(n);var m=o.toString();void 0===s[m]?s[m]={vert1:o[0],vert2:o[1],face1:h,face2:void 0}:s[m].face2=h}var g=[];for(var m in s){var v=s[m];if(void 0===v.face2||l[v.face1].normal.dot(l[v.face2].normal)<=i){var y=u[v.vert1];g.push(y.x),g.push(y.y),g.push(y.z),y=u[v.vert2],g.push(y.x),g.push(y.y),g.push(y.z)}}this.addAttribute("position",new a.BufferAttribute(new Float32Array(g),3))},a.EdgesGeometry.prototype=Object.create(a.BufferGeometry.prototype),a.EdgesGeometry.prototype.constructor=a.EdgesGeometry,a.ExtrudeGeometry=function(t,e){return"undefined"==typeof t?void(t=[]):(a.Geometry.call(this),this.type="ExtrudeGeometry",t=Array.isArray(t)?t:[t],this.addShapeList(t,e),void this.computeFaceNormals())},a.ExtrudeGeometry.prototype=Object.create(a.Geometry.prototype),a.ExtrudeGeometry.prototype.constructor=a.ExtrudeGeometry,a.ExtrudeGeometry.prototype.addShapeList=function(t,e){for(var n=t.length,r=0;r<n;r++){var i=t[r];this.addShape(i,e)}},a.ExtrudeGeometry.prototype.addShape=function(t,e){function n(t,e,n){return e||console.error("THREE.ExtrudeGeometry: vec does not exist"),e.clone().multiplyScalar(n).add(t)}function r(t,e,n){var r,i,o=1,s=t.x-e.x,c=t.y-e.y,u=n.x-t.x,l=n.y-t.y,h=s*s+c*c,f=s*l-c*u;if(Math.abs(f)>Number.EPSILON){var p=Math.sqrt(h),d=Math.sqrt(u*u+l*l),m=e.x-c/p,g=e.y+s/p,v=n.x-l/d,y=n.y+u/d,x=((v-m)*l-(y-g)*u)/(s*l-c*u);r=m+s*x-t.x,i=g+c*x-t.y;var b=r*r+i*i;if(b<=2)return new a.Vector2(r,i);o=Math.sqrt(b/2)}else{var M=!1;s>Number.EPSILON?u>Number.EPSILON&&(M=!0):s<-Number.EPSILON?u<-Number.EPSILON&&(M=!0):Math.sign(c)===Math.sign(l)&&(M=!0),M?(r=-c,i=s,o=Math.sqrt(h)):(r=s,i=c,o=Math.sqrt(h/2))}return new a.Vector2(r/o,i/o)}function i(){if(b){var t=0,e=H*t;for(X=0;X<j;X++)z=B[X],u(z[2]+e,z[1]+e,z[0]+e);for(t=_+2*x,e=H*t,X=0;X<j;X++)z=B[X],u(z[0]+e,z[1]+e,z[2]+e)}else{for(X=0;X<j;X++)z=B[X],u(z[2],z[1],z[0]);for(X=0;X<j;X++)z=B[X],u(z[0]+H*_,z[1]+H*_,z[2]+H*_)}}function o(){var t=0;for(s(I,t),t+=I.length,A=0,L=N.length;A<L;A++)T=N[A],s(T,t),t+=T.length}function s(t,e){var n,r;for(X=t.length;--X>=0;){n=X,r=X-1,r<0&&(r=t.length-1);var i=0,a=_+2*x;for(i=0;i<a;i++){var o=H*i,s=H*(i+1),c=e+n+o,u=e+r+o,h=e+r+s,f=e+n+s;l(c,u,h,f,t,i,a,n,r)}}}function c(t,e,n){C.vertices.push(new a.Vector3(t,e,n))}function u(t,e,n){t+=R,e+=R,n+=R,C.faces.push(new a.Face3(t,e,n,null,null,0));var r=E.generateTopUV(C,t,e,n);C.faceVertexUvs[0].push(r)}function l(t,e,n,r,i,o,s,c,u){t+=R,e+=R,n+=R,r+=R,C.faces.push(new a.Face3(t,e,r,null,null,1)),C.faces.push(new a.Face3(e,n,r,null,null,1));var l=E.generateSideWallUV(C,t,e,n,r);C.faceVertexUvs[0].push([l[0],l[1],l[3]]),C.faceVertexUvs[0].push([l[1],l[2],l[3]])}var h,f,p,d,m,g=void 0!==e.amount?e.amount:100,v=void 0!==e.bevelThickness?e.bevelThickness:6,y=void 0!==e.bevelSize?e.bevelSize:v-2,x=void 0!==e.bevelSegments?e.bevelSegments:3,b=void 0===e.bevelEnabled||e.bevelEnabled,M=void 0!==e.curveSegments?e.curveSegments:12,_=void 0!==e.steps?e.steps:1,w=e.extrudePath,S=!1,E=void 0!==e.UVGenerator?e.UVGenerator:a.ExtrudeGeometry.WorldUVGenerator;w&&(h=w.getSpacedPoints(_),S=!0,b=!1,f=void 0!==e.frames?e.frames:new a.TubeGeometry.FrenetFrames(w,_,(!1)),p=new a.Vector3,d=new a.Vector3,m=new a.Vector3),b||(x=0,v=0,y=0);var T,A,L,C=this,R=this.vertices.length,P=t.extractPoints(M),D=P.shape,N=P.holes,U=!a.ShapeUtils.isClockWise(D);if(U){for(D=D.reverse(),A=0,L=N.length;A<L;A++)T=N[A],a.ShapeUtils.isClockWise(T)&&(N[A]=T.reverse());U=!1}var B=a.ShapeUtils.triangulateShape(D,N),I=D;for(A=0,L=N.length;A<L;A++)T=N[A],D=D.concat(T);for(var O,F,V,G,k,z,H=D.length,j=B.length,W=[],X=0,q=I.length,Y=q-1,Z=X+1;X<q;X++,Y++,Z++)Y===q&&(Y=0),Z===q&&(Z=0),W[X]=r(I[X],I[Y],I[Z]);var K,Q=[],J=W.concat();for(A=0,L=N.length;A<L;A++){for(T=N[A],K=[],X=0,q=T.length,Y=q-1,Z=X+1;X<q;X++,Y++,Z++)Y===q&&(Y=0),Z===q&&(Z=0),K[X]=r(T[X],T[Y],T[Z]);Q.push(K),J=J.concat(K)}for(O=0;O<x;O++){for(V=O/x,G=v*(1-V),F=y*Math.sin(V*Math.PI/2),X=0,q=I.length;X<q;X++)k=n(I[X],W[X],F),c(k.x,k.y,-G);for(A=0,L=N.length;A<L;A++)for(T=N[A],K=Q[A],X=0,q=T.length;X<q;X++)k=n(T[X],K[X],F),c(k.x,k.y,-G)}for(F=y,X=0;X<H;X++)k=b?n(D[X],J[X],F):D[X],S?(d.copy(f.normals[0]).multiplyScalar(k.x),p.copy(f.binormals[0]).multiplyScalar(k.y),m.copy(h[0]).add(d).add(p),c(m.x,m.y,m.z)):c(k.x,k.y,0);var $;for($=1;$<=_;$++)for(X=0;X<H;X++)k=b?n(D[X],J[X],F):D[X],S?(d.copy(f.normals[$]).multiplyScalar(k.x),p.copy(f.binormals[$]).multiplyScalar(k.y),m.copy(h[$]).add(d).add(p),c(m.x,m.y,m.z)):c(k.x,k.y,g/_*$);for(O=x-1;O>=0;O--){for(V=O/x,G=v*(1-V),F=y*Math.sin(V*Math.PI/2),X=0,q=I.length;X<q;X++)k=n(I[X],W[X],F),c(k.x,k.y,g+G);for(A=0,L=N.length;A<L;A++)for(T=N[A],K=Q[A],X=0,q=T.length;X<q;X++)k=n(T[X],K[X],F),S?c(k.x,k.y+h[_-1].y,h[_-1].x+G):c(k.x,k.y,g+G)}i(),o()},a.ExtrudeGeometry.WorldUVGenerator={generateTopUV:function(t,e,n,r){var i=t.vertices,o=i[e],s=i[n],c=i[r];return[new a.Vector2(o.x,o.y),new a.Vector2(s.x,s.y),new a.Vector2(c.x,c.y)]},generateSideWallUV:function(t,e,n,r,i){var o=t.vertices,s=o[e],c=o[n],u=o[r],l=o[i];return Math.abs(s.y-c.y)<.01?[new a.Vector2(s.x,1-s.z),new a.Vector2(c.x,1-c.z),new a.Vector2(u.x,1-u.z),new a.Vector2(l.x,1-l.z)]:[new a.Vector2(s.y,1-s.z),new a.Vector2(c.y,1-c.z),new a.Vector2(u.y,1-u.z),new a.Vector2(l.y,1-l.z)]}},a.ShapeGeometry=function(t,e){a.Geometry.call(this),this.type="ShapeGeometry",Array.isArray(t)===!1&&(t=[t]),this.addShapeList(t,e),this.computeFaceNormals()},a.ShapeGeometry.prototype=Object.create(a.Geometry.prototype),a.ShapeGeometry.prototype.constructor=a.ShapeGeometry,a.ShapeGeometry.prototype.addShapeList=function(t,e){for(var n=0,r=t.length;n<r;n++)this.addShape(t[n],e);return this},a.ShapeGeometry.prototype.addShape=function(t,e){void 0===e&&(e={});var n,r,i,o=void 0!==e.curveSegments?e.curveSegments:12,s=e.material,c=void 0===e.UVGenerator?a.ExtrudeGeometry.WorldUVGenerator:e.UVGenerator,u=this.vertices.length,l=t.extractPoints(o),h=l.shape,f=l.holes,p=!a.ShapeUtils.isClockWise(h);if(p){for(h=h.reverse(),n=0,r=f.length;n<r;n++)i=f[n],a.ShapeUtils.isClockWise(i)&&(f[n]=i.reverse());p=!1}var d=a.ShapeUtils.triangulateShape(h,f);for(n=0,r=f.length;n<r;n++)i=f[n],h=h.concat(i);var m,g,v=h.length,y=d.length;for(n=0;n<v;n++)m=h[n],this.vertices.push(new a.Vector3(m.x,m.y,0));for(n=0;n<y;n++){g=d[n];var x=g[0]+u,b=g[1]+u,M=g[2]+u;this.faces.push(new a.Face3(x,b,M,null,null,s)),this.faceVertexUvs[0].push(c.generateTopUV(this,x,b,M))}},a.LatheBufferGeometry=function(t,e,n,r){a.BufferGeometry.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=a.Math.clamp(r,0,2*Math.PI);var i,o,s,c=(e+1)*t.length,u=e*t.length*2*3,l=new a.BufferAttribute(new(u>65535?Uint32Array:Uint16Array)(u),1),h=new a.BufferAttribute(new Float32Array(3*c),3),f=new a.BufferAttribute(new Float32Array(2*c),2),p=0,d=0,m=(1/(t.length-1),1/e),g=new a.Vector3,v=new a.Vector2;for(o=0;o<=e;o++){var y=n+o*m*r,x=Math.sin(y),b=Math.cos(y);for(s=0;s<=t.length-1;s++)g.x=t[s].x*x,g.y=t[s].y,g.z=t[s].x*b,h.setXYZ(p,g.x,g.y,g.z),v.x=o/e,v.y=s/(t.length-1),f.setXY(p,v.x,v.y),p++}for(o=0;o<e;o++)for(s=0;s<t.length-1;s++){i=s+o*t.length;var M=i,_=i+t.length,w=i+t.length+1,S=i+1;l.setX(d,M),d++,l.setX(d,_),d++,l.setX(d,S),d++,l.setX(d,_),d++,l.setX(d,w),d++,l.setX(d,S),d++}if(this.setIndex(l),this.addAttribute("position",h),this.addAttribute("uv",f),this.computeVertexNormals(),r===2*Math.PI){var E=this.attributes.normal.array,T=new a.Vector3,A=new a.Vector3,L=new a.Vector3;for(i=e*t.length*3,o=0,s=0;o<t.length;o++,s+=3)T.x=E[s+0],T.y=E[s+1],T.z=E[s+2],A.x=E[i+s+0],
-A.y=E[i+s+1],A.z=E[i+s+2],L.addVectors(T,A).normalize(),E[s+0]=E[i+s+0]=L.x,E[s+1]=E[i+s+1]=L.y,E[s+2]=E[i+s+2]=L.z}},a.LatheBufferGeometry.prototype=Object.create(a.BufferGeometry.prototype),a.LatheBufferGeometry.prototype.constructor=a.LatheBufferGeometry,a.LatheGeometry=function(t,e,n,r){a.Geometry.call(this),this.type="LatheGeometry",this.parameters={points:t,segments:e,phiStart:n,phiLength:r},this.fromBufferGeometry(new a.LatheBufferGeometry(t,e,n,r)),this.mergeVertices()},a.LatheGeometry.prototype=Object.create(a.Geometry.prototype),a.LatheGeometry.prototype.constructor=a.LatheGeometry,a.PlaneGeometry=function(t,e,n,r){a.Geometry.call(this),this.type="PlaneGeometry",this.parameters={width:t,height:e,widthSegments:n,heightSegments:r},this.fromBufferGeometry(new a.PlaneBufferGeometry(t,e,n,r))},a.PlaneGeometry.prototype=Object.create(a.Geometry.prototype),a.PlaneGeometry.prototype.constructor=a.PlaneGeometry,a.PlaneBufferGeometry=function(t,e,n,r){a.BufferGeometry.call(this),this.type="PlaneBufferGeometry",this.parameters={width:t,height:e,widthSegments:n,heightSegments:r};for(var i=t/2,o=e/2,s=Math.floor(n)||1,c=Math.floor(r)||1,u=s+1,l=c+1,h=t/s,f=e/c,p=new Float32Array(u*l*3),d=new Float32Array(u*l*3),m=new Float32Array(u*l*2),g=0,v=0,y=0;y<l;y++)for(var x=y*f-o,b=0;b<u;b++){var M=b*h-i;p[g]=M,p[g+1]=-x,d[g+2]=1,m[v]=b/s,m[v+1]=1-y/c,g+=3,v+=2}g=0;for(var _=new(p.length/3>65535?Uint32Array:Uint16Array)(s*c*6),y=0;y<c;y++)for(var b=0;b<s;b++){var w=b+u*y,S=b+u*(y+1),E=b+1+u*(y+1),T=b+1+u*y;_[g]=w,_[g+1]=S,_[g+2]=T,_[g+3]=S,_[g+4]=E,_[g+5]=T,g+=6}this.setIndex(new a.BufferAttribute(_,1)),this.addAttribute("position",new a.BufferAttribute(p,3)),this.addAttribute("normal",new a.BufferAttribute(d,3)),this.addAttribute("uv",new a.BufferAttribute(m,2))},a.PlaneBufferGeometry.prototype=Object.create(a.BufferGeometry.prototype),a.PlaneBufferGeometry.prototype.constructor=a.PlaneBufferGeometry,a.RingBufferGeometry=function(t,e,n,r,i,o){a.BufferGeometry.call(this),this.type="RingBufferGeometry",this.parameters={innerRadius:t,outerRadius:e,thetaSegments:n,phiSegments:r,thetaStart:i,thetaLength:o},t=t||20,e=e||50,i=void 0!==i?i: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,c,u,l=(n+1)*(r+1),h=n*r*2*3,f=new a.BufferAttribute(new(h>65535?Uint32Array:Uint16Array)(h),1),p=new a.BufferAttribute(new Float32Array(3*l),3),d=new a.BufferAttribute(new Float32Array(3*l),3),m=new a.BufferAttribute(new Float32Array(2*l),2),g=0,v=0,y=t,x=(e-t)/r,b=new a.Vector3,M=new a.Vector2;for(c=0;c<=r;c++){for(u=0;u<=n;u++)s=i+u/n*o,b.x=y*Math.cos(s),b.y=y*Math.sin(s),p.setXYZ(g,b.x,b.y,b.z),d.setXYZ(g,0,0,1),M.x=(b.x/e+1)/2,M.y=(b.y/e+1)/2,m.setXY(g,M.x,M.y),g++;y+=x}for(c=0;c<r;c++){var _=c*(n+1);for(u=0;u<n;u++){s=u+_;var w=s,S=s+n+1,E=s+n+2,T=s+1;f.setX(v,w),v++,f.setX(v,S),v++,f.setX(v,E),v++,f.setX(v,w),v++,f.setX(v,E),v++,f.setX(v,T),v++}}this.setIndex(f),this.addAttribute("position",p),this.addAttribute("normal",d),this.addAttribute("uv",m)},a.RingBufferGeometry.prototype=Object.create(a.BufferGeometry.prototype),a.RingBufferGeometry.prototype.constructor=a.RingBufferGeometry,a.RingGeometry=function(t,e,n,r,i,o){a.Geometry.call(this),this.type="RingGeometry",this.parameters={innerRadius:t,outerRadius:e,thetaSegments:n,phiSegments:r,thetaStart:i,thetaLength:o},this.fromBufferGeometry(new a.RingBufferGeometry(t,e,n,r,i,o))},a.RingGeometry.prototype=Object.create(a.Geometry.prototype),a.RingGeometry.prototype.constructor=a.RingGeometry,a.SphereGeometry=function(t,e,n,r,i,o,s){a.Geometry.call(this),this.type="SphereGeometry",this.parameters={radius:t,widthSegments:e,heightSegments:n,phiStart:r,phiLength:i,thetaStart:o,thetaLength:s},this.fromBufferGeometry(new a.SphereBufferGeometry(t,e,n,r,i,o,s))},a.SphereGeometry.prototype=Object.create(a.Geometry.prototype),a.SphereGeometry.prototype.constructor=a.SphereGeometry,a.SphereBufferGeometry=function(t,e,n,r,i,o,s){a.BufferGeometry.call(this),this.type="SphereBufferGeometry",this.parameters={radius:t,widthSegments:e,heightSegments:n,phiStart:r,phiLength:i,thetaStart:o,thetaLength:s},t=t||50,e=Math.max(3,Math.floor(e)||8),n=Math.max(2,Math.floor(n)||6),r=void 0!==r?r:0,i=void 0!==i?i:2*Math.PI,o=void 0!==o?o:0,s=void 0!==s?s:Math.PI;for(var c=o+s,u=(e+1)*(n+1),l=new a.BufferAttribute(new Float32Array(3*u),3),h=new a.BufferAttribute(new Float32Array(3*u),3),f=new a.BufferAttribute(new Float32Array(2*u),2),p=0,d=[],m=new a.Vector3,g=0;g<=n;g++){for(var v=[],y=g/n,x=0;x<=e;x++){var b=x/e,M=-t*Math.cos(r+b*i)*Math.sin(o+y*s),_=t*Math.cos(o+y*s),w=t*Math.sin(r+b*i)*Math.sin(o+y*s);m.set(M,_,w).normalize(),l.setXYZ(p,M,_,w),h.setXYZ(p,m.x,m.y,m.z),f.setXY(p,b,1-y),v.push(p),p++}d.push(v)}for(var S=[],g=0;g<n;g++)for(var x=0;x<e;x++){var E=d[g][x+1],T=d[g][x],A=d[g+1][x],L=d[g+1][x+1];(0!==g||o>0)&&S.push(E,T,L),(g!==n-1||c<Math.PI)&&S.push(T,A,L)}this.setIndex(new(l.count>65535?a.Uint32Attribute:a.Uint16Attribute)(S,1)),this.addAttribute("position",l),this.addAttribute("normal",h),this.addAttribute("uv",f),this.boundingSphere=new a.Sphere(new a.Vector3,t)},a.SphereBufferGeometry.prototype=Object.create(a.BufferGeometry.prototype),a.SphereBufferGeometry.prototype.constructor=a.SphereBufferGeometry,a.TextGeometry=function(t,e){e=e||{};var n=e.font;if(n instanceof a.Font==!1)return console.error("THREE.TextGeometry: font parameter is not an instance of THREE.Font."),new a.Geometry;var r=n.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),a.ExtrudeGeometry.call(this,r,e),this.type="TextGeometry"},a.TextGeometry.prototype=Object.create(a.ExtrudeGeometry.prototype),a.TextGeometry.prototype.constructor=a.TextGeometry,a.TorusBufferGeometry=function(t,e,n,r,i){a.BufferGeometry.call(this),this.type="TorusBufferGeometry",this.parameters={radius:t,tube:e,radialSegments:n,tubularSegments:r,arc:i},t=t||100,e=e||40,n=Math.floor(n)||8,r=Math.floor(r)||6,i=i||2*Math.PI;var o,s,c=(n+1)*(r+1),u=n*r*2*3,l=new(u>65535?Uint32Array:Uint16Array)(u),h=new Float32Array(3*c),f=new Float32Array(3*c),p=new Float32Array(2*c),d=0,m=0,g=0,v=new a.Vector3,y=new a.Vector3,x=new a.Vector3;for(o=0;o<=n;o++)for(s=0;s<=r;s++){var b=s/r*i,M=o/n*Math.PI*2;y.x=(t+e*Math.cos(M))*Math.cos(b),y.y=(t+e*Math.cos(M))*Math.sin(b),y.z=e*Math.sin(M),h[d]=y.x,h[d+1]=y.y,h[d+2]=y.z,v.x=t*Math.cos(b),v.y=t*Math.sin(b),x.subVectors(y,v).normalize(),f[d]=x.x,f[d+1]=x.y,f[d+2]=x.z,p[m]=s/r,p[m+1]=o/n,d+=3,m+=2}for(o=1;o<=n;o++)for(s=1;s<=r;s++){var _=(r+1)*o+s-1,w=(r+1)*(o-1)+s-1,S=(r+1)*(o-1)+s,E=(r+1)*o+s;l[g]=_,l[g+1]=w,l[g+2]=E,l[g+3]=w,l[g+4]=S,l[g+5]=E,g+=6}this.setIndex(new a.BufferAttribute(l,1)),this.addAttribute("position",new a.BufferAttribute(h,3)),this.addAttribute("normal",new a.BufferAttribute(f,3)),this.addAttribute("uv",new a.BufferAttribute(p,2))},a.TorusBufferGeometry.prototype=Object.create(a.BufferGeometry.prototype),a.TorusBufferGeometry.prototype.constructor=a.TorusBufferGeometry,a.TorusGeometry=function(t,e,n,r,i){a.Geometry.call(this),this.type="TorusGeometry",this.parameters={radius:t,tube:e,radialSegments:n,tubularSegments:r,arc:i},this.fromBufferGeometry(new a.TorusBufferGeometry(t,e,n,r,i))},a.TorusGeometry.prototype=Object.create(a.Geometry.prototype),a.TorusGeometry.prototype.constructor=a.TorusGeometry,a.TorusKnotBufferGeometry=function(t,e,n,r,i,o){function s(t,e,n,r,i){var a=Math.cos(t),o=Math.sin(t),s=n/e*t,c=Math.cos(s);i.x=r*(2+c)*.5*a,i.y=r*(2+c)*o*.5,i.z=r*Math.sin(s)*.5}a.BufferGeometry.call(this),this.type="TorusKnotBufferGeometry",this.parameters={radius:t,tube:e,tubularSegments:n,radialSegments:r,p:i,q:o},t=t||100,e=e||40,n=Math.floor(n)||64,r=Math.floor(r)||8,i=i||2,o=o||3;var c,u,l=(r+1)*(n+1),h=r*n*2*3,f=new a.BufferAttribute(new(h>65535?Uint32Array:Uint16Array)(h),1),p=new a.BufferAttribute(new Float32Array(3*l),3),d=new a.BufferAttribute(new Float32Array(3*l),3),m=new a.BufferAttribute(new Float32Array(2*l),2),g=0,v=0,y=new a.Vector3,x=new a.Vector3,b=new a.Vector2,M=new a.Vector3,_=new a.Vector3,w=new a.Vector3,S=new a.Vector3,E=new a.Vector3;for(c=0;c<=n;++c){var T=c/n*i*Math.PI*2;for(s(T,i,o,t,M),s(T+.01,i,o,t,_),S.subVectors(_,M),E.addVectors(_,M),w.crossVectors(S,E),E.crossVectors(w,S),w.normalize(),E.normalize(),u=0;u<=r;++u){var A=u/r*Math.PI*2,L=-e*Math.cos(A),C=e*Math.sin(A);y.x=M.x+(L*E.x+C*w.x),y.y=M.y+(L*E.y+C*w.y),y.z=M.z+(L*E.z+C*w.z),p.setXYZ(g,y.x,y.y,y.z),x.subVectors(y,M).normalize(),d.setXYZ(g,x.x,x.y,x.z),b.x=c/n,b.y=u/r,m.setXY(g,b.x,b.y),g++}}for(u=1;u<=n;u++)for(c=1;c<=r;c++){var R=(r+1)*(u-1)+(c-1),P=(r+1)*u+(c-1),D=(r+1)*u+c,N=(r+1)*(u-1)+c;f.setX(v,R),v++,f.setX(v,P),v++,f.setX(v,N),v++,f.setX(v,P),v++,f.setX(v,D),v++,f.setX(v,N),v++}this.setIndex(f),this.addAttribute("position",p),this.addAttribute("normal",d),this.addAttribute("uv",m)},a.TorusKnotBufferGeometry.prototype=Object.create(a.BufferGeometry.prototype),a.TorusKnotBufferGeometry.prototype.constructor=a.TorusKnotBufferGeometry,a.TorusKnotGeometry=function(t,e,n,r,i,o,s){a.Geometry.call(this),this.type="TorusKnotGeometry",this.parameters={radius:t,tube:e,tubularSegments:n,radialSegments:r,p:i,q:o},void 0!==s&&console.warn("THREE.TorusKnotGeometry: heightScale has been deprecated. Use .scale( x, y, z ) instead."),this.fromBufferGeometry(new a.TorusKnotBufferGeometry(t,e,n,r,i,o)),this.mergeVertices()},a.TorusKnotGeometry.prototype=Object.create(a.Geometry.prototype),a.TorusKnotGeometry.prototype.constructor=a.TorusKnotGeometry,a.TubeGeometry=function(t,e,n,r,i,o){function s(t,e,n){return R.vertices.push(new a.Vector3(t,e,n))-1}a.Geometry.call(this),this.type="TubeGeometry",this.parameters={path:t,segments:e,radius:n,radialSegments:r,closed:i,taper:o},e=e||64,n=n||1,r=r||8,i=i||!1,o=o||a.TubeGeometry.NoTaper;var c,u,l,h,f,p,d,m,g,v,y,x,b,M,_,w,S,E,T,A,L,C=[],R=this,P=e+1,D=new a.Vector3,N=new a.TubeGeometry.FrenetFrames(t,e,i),U=N.tangents,B=N.normals,I=N.binormals;for(this.tangents=U,this.normals=B,this.binormals=I,v=0;v<P;v++)for(C[v]=[],h=v/(P-1),g=t.getPointAt(h),c=U[v],u=B[v],l=I[v],p=n*o(h),y=0;y<r;y++)f=y/r*2*Math.PI,d=-p*Math.cos(f),m=p*Math.sin(f),D.copy(g),D.x+=d*u.x+m*l.x,D.y+=d*u.y+m*l.y,D.z+=d*u.z+m*l.z,C[v][y]=s(D.x,D.y,D.z);for(v=0;v<e;v++)for(y=0;y<r;y++)x=i?(v+1)%e:v+1,b=(y+1)%r,M=C[v][y],_=C[x][y],w=C[x][b],S=C[v][b],E=new a.Vector2(v/e,y/r),T=new a.Vector2((v+1)/e,y/r),A=new a.Vector2((v+1)/e,(y+1)/r),L=new a.Vector2(v/e,(y+1)/r),this.faces.push(new a.Face3(M,_,S)),this.faceVertexUvs[0].push([E,T,L]),this.faces.push(new a.Face3(_,w,S)),this.faceVertexUvs[0].push([T.clone(),A,L.clone()]);this.computeFaceNormals(),this.computeVertexNormals()},a.TubeGeometry.prototype=Object.create(a.Geometry.prototype),a.TubeGeometry.prototype.constructor=a.TubeGeometry,a.TubeGeometry.NoTaper=function(t){return 1},a.TubeGeometry.SinusoidalTaper=function(t){return Math.sin(Math.PI*t)},a.TubeGeometry.FrenetFrames=function(t,e,n){function r(){d[0]=new a.Vector3,m[0]=new a.Vector3,o=Number.MAX_VALUE,s=Math.abs(p[0].x),c=Math.abs(p[0].y),u=Math.abs(p[0].z),s<=o&&(o=s,f.set(1,0,0)),c<=o&&(o=c,f.set(0,1,0)),u<=o&&f.set(0,0,1),g.crossVectors(p[0],f).normalize(),d[0].crossVectors(p[0],g),m[0].crossVectors(p[0],d[0])}var i,o,s,c,u,l,h,f=new a.Vector3,p=[],d=[],m=[],g=new a.Vector3,v=new a.Matrix4,y=e+1;for(this.tangents=p,this.normals=d,this.binormals=m,l=0;l<y;l++)h=l/(y-1),p[l]=t.getTangentAt(h),p[l].normalize();for(r(),l=1;l<y;l++)d[l]=d[l-1].clone(),m[l]=m[l-1].clone(),g.crossVectors(p[l-1],p[l]),g.length()>Number.EPSILON&&(g.normalize(),i=Math.acos(a.Math.clamp(p[l-1].dot(p[l]),-1,1)),d[l].applyMatrix4(v.makeRotationAxis(g,i))),m[l].crossVectors(p[l],d[l]);if(n)for(i=Math.acos(a.Math.clamp(d[0].dot(d[y-1]),-1,1)),i/=y-1,p[0].dot(g.crossVectors(d[0],d[y-1]))>0&&(i=-i),l=1;l<y;l++)d[l].applyMatrix4(v.makeRotationAxis(p[l],i*l)),m[l].crossVectors(p[l],d[l])},a.PolyhedronGeometry=function(t,e,n,r){function i(t){var e=t.normalize().clone();e.index=h.vertices.push(e)-1;var n=c(t)/2/Math.PI+.5,r=u(t)/Math.PI+.5;return e.uv=new a.Vector2(n,1-r),e}function o(t,e,n){var r=new a.Face3(t.index,e.index,n.index,[t.clone(),e.clone(),n.clone()]);h.faces.push(r),b.copy(t).add(e).add(n).divideScalar(3);var i=c(b);h.faceVertexUvs[0].push([l(t.uv,t,i),l(e.uv,e,i),l(n.uv,n,i)])}function s(t,e){for(var n=Math.pow(2,e),r=i(h.vertices[t.a]),a=i(h.vertices[t.b]),s=i(h.vertices[t.c]),c=[],u=0;u<=n;u++){c[u]=[];for(var l=i(r.clone().lerp(s,u/n)),f=i(a.clone().lerp(s,u/n)),p=n-u,d=0;d<=p;d++)0===d&&u===n?c[u][d]=l:c[u][d]=i(l.clone().lerp(f,d/p))}for(var u=0;u<n;u++)for(var d=0;d<2*(n-u)-1;d++){var m=Math.floor(d/2);d%2===0?o(c[u][m+1],c[u+1][m],c[u][m]):o(c[u][m+1],c[u+1][m+1],c[u+1][m])}}function c(t){return Math.atan2(t.z,-t.x)}function u(t){return Math.atan2(-t.y,Math.sqrt(t.x*t.x+t.z*t.z))}function l(t,e,n){return n<0&&1===t.x&&(t=new a.Vector2(t.x-1,t.y)),0===e.x&&0===e.z&&(t=new a.Vector2(n/2/Math.PI+.5,t.y)),t.clone()}a.Geometry.call(this),this.type="PolyhedronGeometry",this.parameters={vertices:t,indices:e,radius:n,detail:r},n=n||1,r=r||0;for(var h=this,f=0,p=t.length;f<p;f+=3)i(new a.Vector3(t[f],t[f+1],t[f+2]));for(var d=this.vertices,m=[],f=0,g=0,p=e.length;f<p;f+=3,g++){var v=d[e[f]],y=d[e[f+1]],x=d[e[f+2]];m[g]=new a.Face3(v.index,y.index,x.index,[v.clone(),y.clone(),x.clone()])}for(var b=new a.Vector3,f=0,p=m.length;f<p;f++)s(m[f],r);for(var f=0,p=this.faceVertexUvs[0].length;f<p;f++){var M=this.faceVertexUvs[0][f],_=M[0].x,w=M[1].x,S=M[2].x,E=Math.max(_,w,S),T=Math.min(_,w,S);E>.9&&T<.1&&(_<.2&&(M[0].x+=1),w<.2&&(M[1].x+=1),S<.2&&(M[2].x+=1))}for(var f=0,p=this.vertices.length;f<p;f++)this.vertices[f].multiplyScalar(n);this.mergeVertices(),this.computeFaceNormals(),this.boundingSphere=new a.Sphere(new a.Vector3,n)},a.PolyhedronGeometry.prototype=Object.create(a.Geometry.prototype),a.PolyhedronGeometry.prototype.constructor=a.PolyhedronGeometry,a.DodecahedronGeometry=function(t,e){var n=(1+Math.sqrt(5))/2,r=1/n,i=[-1,-1,-1,-1,-1,1,-1,1,-1,-1,1,1,1,-1,-1,1,-1,1,1,1,-1,1,1,1,0,-r,-n,0,-r,n,0,r,-n,0,r,n,-r,-n,0,-r,n,0,r,-n,0,r,n,0,-n,0,-r,n,0,-r,-n,0,r,n,0,r],o=[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];a.PolyhedronGeometry.call(this,i,o,t,e),this.type="DodecahedronGeometry",this.parameters={radius:t,detail:e}},a.DodecahedronGeometry.prototype=Object.create(a.PolyhedronGeometry.prototype),a.DodecahedronGeometry.prototype.constructor=a.DodecahedronGeometry,a.IcosahedronGeometry=function(t,e){var n=(1+Math.sqrt(5))/2,r=[-1,n,0,1,n,0,-1,-n,0,1,-n,0,0,-1,n,0,1,n,0,-1,-n,0,1,-n,n,0,-1,n,0,1,-n,0,-1,-n,0,1],i=[0,11,5,0,5,1,0,1,7,0,7,10,0,10,11,1,5,9,5,11,4,11,10,2,10,7,6,7,1,8,3,9,4,3,4,2,3,2,6,3,6,8,3,8,9,4,9,5,2,4,11,6,2,10,8,6,7,9,8,1];a.PolyhedronGeometry.call(this,r,i,t,e),this.type="IcosahedronGeometry",this.parameters={radius:t,detail:e}},a.IcosahedronGeometry.prototype=Object.create(a.PolyhedronGeometry.prototype),a.IcosahedronGeometry.prototype.constructor=a.IcosahedronGeometry,a.OctahedronGeometry=function(t,e){var n=[1,0,0,-1,0,0,0,1,0,0,-1,0,0,0,1,0,0,-1],r=[0,2,4,0,4,3,0,3,5,0,5,2,1,2,5,1,5,3,1,3,4,1,4,2];a.PolyhedronGeometry.call(this,n,r,t,e),this.type="OctahedronGeometry",this.parameters={radius:t,detail:e}},a.OctahedronGeometry.prototype=Object.create(a.PolyhedronGeometry.prototype),a.OctahedronGeometry.prototype.constructor=a.OctahedronGeometry,a.TetrahedronGeometry=function(t,e){var n=[1,1,1,-1,-1,1,-1,1,-1,1,-1,-1],r=[2,1,0,0,3,2,1,3,0,2,3,1];a.PolyhedronGeometry.call(this,n,r,t,e),this.type="TetrahedronGeometry",this.parameters={radius:t,detail:e}},a.TetrahedronGeometry.prototype=Object.create(a.PolyhedronGeometry.prototype),a.TetrahedronGeometry.prototype.constructor=a.TetrahedronGeometry,a.ParametricGeometry=function(t,e,n){a.Geometry.call(this),this.type="ParametricGeometry",this.parameters={func:t,slices:e,stacks:n};var r,i,o,s,c,u=this.vertices,l=this.faces,h=this.faceVertexUvs[0],f=e+1;for(r=0;r<=n;r++)for(c=r/n,i=0;i<=e;i++)s=i/e,o=t(s,c),u.push(o);var p,d,m,g,v,y,x,b;for(r=0;r<n;r++)for(i=0;i<e;i++)p=r*f+i,d=r*f+i+1,m=(r+1)*f+i+1,g=(r+1)*f+i,v=new a.Vector2(i/e,r/n),y=new a.Vector2((i+1)/e,r/n),x=new a.Vector2((i+1)/e,(r+1)/n),b=new a.Vector2(i/e,(r+1)/n),l.push(new a.Face3(p,d,g)),h.push([v,y,b]),l.push(new a.Face3(d,m,g)),h.push([y.clone(),x,b.clone()]);this.computeFaceNormals(),this.computeVertexNormals()},a.ParametricGeometry.prototype=Object.create(a.Geometry.prototype),a.ParametricGeometry.prototype.constructor=a.ParametricGeometry,a.WireframeGeometry=function(t){function e(t,e){return t-e}a.BufferGeometry.call(this);var n=[0,0],r={},i=["a","b","c"];if(t instanceof a.Geometry){for(var o=t.vertices,s=t.faces,c=0,u=new Uint32Array(6*s.length),l=0,h=s.length;l<h;l++)for(var f=s[l],p=0;p<3;p++){n[0]=f[i[p]],n[1]=f[i[(p+1)%3]],n.sort(e);var d=n.toString();void 0===r[d]&&(u[2*c]=n[0],u[2*c+1]=n[1],r[d]=!0,c++)}for(var m=new Float32Array(2*c*3),l=0,h=c;l<h;l++)for(var p=0;p<2;p++){var g=o[u[2*l+p]],v=6*l+3*p;m[v+0]=g.x,m[v+1]=g.y,m[v+2]=g.z}this.addAttribute("position",new a.BufferAttribute(m,3))}else if(t instanceof a.BufferGeometry)if(null!==t.index){var y=t.index.array,o=t.attributes.position,x=t.groups,c=0;0===x.length&&t.addGroup(0,y.length);for(var u=new Uint32Array(2*y.length),b=0,M=x.length;b<M;++b)for(var _=x[b],w=_.start,S=_.count,l=w,E=w+S;l<E;l+=3)for(var p=0;p<3;p++){n[0]=y[l+p],n[1]=y[l+(p+1)%3],n.sort(e);var d=n.toString();void 0===r[d]&&(u[2*c]=n[0],u[2*c+1]=n[1],r[d]=!0,c++)}for(var m=new Float32Array(2*c*3),l=0,h=c;l<h;l++)for(var p=0;p<2;p++){var v=6*l+3*p,T=u[2*l+p];m[v+0]=o.getX(T),m[v+1]=o.getY(T),m[v+2]=o.getZ(T)}this.addAttribute("position",new a.BufferAttribute(m,3))}else{for(var o=t.attributes.position.array,c=o.length/3,A=c/3,m=new Float32Array(2*c*3),l=0,h=A;l<h;l++)for(var p=0;p<3;p++){var v=18*l+6*p,L=9*l+3*p;m[v+0]=o[L],m[v+1]=o[L+1],m[v+2]=o[L+2];var T=9*l+3*((p+1)%3);m[v+3]=o[T],m[v+4]=o[T+1],m[v+5]=o[T+2]}this.addAttribute("position",new a.BufferAttribute(m,3))}},a.WireframeGeometry.prototype=Object.create(a.BufferGeometry.prototype),a.WireframeGeometry.prototype.constructor=a.WireframeGeometry,a.AxisHelper=function(t){t=t||1;var e=new Float32Array([0,0,0,t,0,0,0,0,0,0,t,0,0,0,0,0,0,t]),n=new Float32Array([1,0,0,1,.6,0,0,1,0,.6,1,0,0,0,1,0,.6,1]),r=new a.BufferGeometry;r.addAttribute("position",new a.BufferAttribute(e,3)),r.addAttribute("color",new a.BufferAttribute(n,3));var i=new a.LineBasicMaterial({vertexColors:a.VertexColors});a.LineSegments.call(this,r,i)},a.AxisHelper.prototype=Object.create(a.LineSegments.prototype),a.AxisHelper.prototype.constructor=a.AxisHelper,a.ArrowHelper=function(){var t=new a.BufferGeometry;t.addAttribute("position",new a.Float32Attribute([0,0,0,0,1,0],3));var e=new a.CylinderBufferGeometry(0,.5,1,5,1);return e.translate(0,-.5,0),function(n,r,i,o,s,c){a.Object3D.call(this),void 0===o&&(o=16776960),void 0===i&&(i=1),void 0===s&&(s=.2*i),void 0===c&&(c=.2*s),this.position.copy(r),this.line=new a.Line(t,new a.LineBasicMaterial({color:o})),this.line.matrixAutoUpdate=!1,this.add(this.line),this.cone=new a.Mesh(e,new a.MeshBasicMaterial({color:o})),this.cone.matrixAutoUpdate=!1,this.add(this.cone),this.setDirection(n),this.setLength(i,s,c)}}(),a.ArrowHelper.prototype=Object.create(a.Object3D.prototype),a.ArrowHelper.prototype.constructor=a.ArrowHelper,a.ArrowHelper.prototype.setDirection=function(){var t,e=new a.Vector3;return function(n){n.y>.99999?this.quaternion.set(0,0,0,1):n.y<-.99999?this.quaternion.set(1,0,0,0):(e.set(n.z,0,-n.x).normalize(),t=Math.acos(n.y),this.quaternion.setFromAxisAngle(e,t))}}(),a.ArrowHelper.prototype.setLength=function(t,e,n){void 0===e&&(e=.2*t),void 0===n&&(n=.2*e),this.line.scale.set(1,Math.max(0,t-e),1),this.line.updateMatrix(),this.cone.scale.set(n,e,n),this.cone.position.y=t,this.cone.updateMatrix()},a.ArrowHelper.prototype.setColor=function(t){this.line.material.color.copy(t),this.cone.material.color.copy(t)},a.BoxHelper=function(t,e){void 0===e&&(e=16776960);var n=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]),r=new Float32Array(24),i=new a.BufferGeometry;i.setIndex(new a.BufferAttribute(n,1)),i.addAttribute("position",new a.BufferAttribute(r,3)),a.LineSegments.call(this,i,new a.LineBasicMaterial({color:e})),void 0!==t&&this.update(t)},a.BoxHelper.prototype=Object.create(a.LineSegments.prototype),a.BoxHelper.prototype.constructor=a.BoxHelper,a.BoxHelper.prototype.update=function(){var t=new a.Box3;return function(e){if(e instanceof a.Box3?t.copy(e):t.setFromObject(e),!t.isEmpty()){var n=t.min,r=t.max,i=this.geometry.attributes.position,o=i.array;o[0]=r.x,o[1]=r.y,o[2]=r.z,o[3]=n.x,o[4]=r.y,o[5]=r.z,o[6]=n.x,o[7]=n.y,o[8]=r.z,o[9]=r.x,o[10]=n.y,o[11]=r.z,o[12]=r.x,o[13]=r.y,o[14]=n.z,o[15]=n.x,o[16]=r.y,o[17]=n.z,o[18]=n.x,o[19]=n.y,o[20]=n.z,o[21]=r.x,o[22]=n.y,o[23]=n.z,i.needsUpdate=!0,this.geometry.computeBoundingSphere()}}}(),a.BoundingBoxHelper=function(t,e){var n=void 0!==e?e:8947848;this.object=t,this.box=new a.Box3,a.Mesh.call(this,new a.BoxGeometry(1,1,1),new a.MeshBasicMaterial({color:n,wireframe:!0}))},a.BoundingBoxHelper.prototype=Object.create(a.Mesh.prototype),a.BoundingBoxHelper.prototype.constructor=a.BoundingBoxHelper,a.BoundingBoxHelper.prototype.update=function(){this.box.setFromObject(this.object),this.box.size(this.scale),this.box.center(this.position)},a.CameraHelper=function(t){function e(t,e,r){n(t,r),n(e,r)}function n(t,e){r.vertices.push(new a.Vector3),r.colors.push(new a.Color(e)),void 0===o[t]&&(o[t]=[]),o[t].push(r.vertices.length-1)}var r=new a.Geometry,i=new a.LineBasicMaterial({color:16777215,vertexColors:a.FaceColors}),o={},s=16755200,c=16711680,u=43775,l=16777215,h=3355443;e("n1","n2",s),e("n2","n4",s),e("n4","n3",s),e("n3","n1",s),e("f1","f2",s),e("f2","f4",s),e("f4","f3",s),e("f3","f1",s),e("n1","f1",s),e("n2","f2",s),e("n3","f3",s),e("n4","f4",s),e("p","n1",c),e("p","n2",c),e("p","n3",c),e("p","n4",c),e("u1","u2",u),e("u2","u3",u),e("u3","u1",u),e("c","t",l),e("p","c",h),e("cn1","cn2",h),e("cn3","cn4",h),e("cf1","cf2",h),e("cf3","cf4",h),a.LineSegments.call(this,r,i),this.camera=t,this.camera.updateProjectionMatrix&&this.camera.updateProjectionMatrix(),this.matrix=t.matrixWorld,this.matrixAutoUpdate=!1,this.pointMap=o,this.update()},a.CameraHelper.prototype=Object.create(a.LineSegments.prototype),a.CameraHelper.prototype.constructor=a.CameraHelper,a.CameraHelper.prototype.update=function(){function t(t,a,o,s){r.set(a,o,s).unproject(i);var c=n[t];if(void 0!==c)for(var u=0,l=c.length;u<l;u++)e.vertices[c[u]].copy(r)}var e,n,r=new a.Vector3,i=new a.Camera;return function(){e=this.geometry,n=this.pointMap;var r=1,a=1;i.projectionMatrix.copy(this.camera.projectionMatrix),t("c",0,0,-1),t("t",0,0,1),t("n1",-r,-a,-1),t("n2",r,-a,-1),t("n3",-r,a,-1),t("n4",r,a,-1),t("f1",-r,-a,1),t("f2",r,-a,1),t("f3",-r,a,1),t("f4",r,a,1),t("u1",.7*r,1.1*a,-1),t("u2",.7*-r,1.1*a,-1),t("u3",0,2*a,-1),t("cf1",-r,0,1),t("cf2",r,0,1),t("cf3",0,-a,1),t("cf4",0,a,1),t("cn1",-r,0,-1),t("cn2",r,0,-1),t("cn3",0,-a,-1),t("cn4",0,a,-1),e.verticesNeedUpdate=!0}}(),a.DirectionalLightHelper=function(t,e){a.Object3D.call(this),this.light=t,this.light.updateMatrixWorld(),this.matrix=t.matrixWorld,this.matrixAutoUpdate=!1,void 0===e&&(e=1);var n=new a.BufferGeometry;n.addAttribute("position",new a.Float32Attribute([-e,e,0,e,e,0,e,-e,0,-e,-e,0,-e,e,0],3));var r=new a.LineBasicMaterial({fog:!1});this.add(new a.Line(n,r)),n=new a.BufferGeometry,n.addAttribute("position",new a.Float32Attribute([0,0,0,0,0,1],3)),this.add(new a.Line(n,r)),this.update()},a.DirectionalLightHelper.prototype=Object.create(a.Object3D.prototype),a.DirectionalLightHelper.prototype.constructor=a.DirectionalLightHelper,a.DirectionalLightHelper.prototype.dispose=function(){var t=this.children[0],e=this.children[1];t.geometry.dispose(),t.material.dispose(),e.geometry.dispose(),e.material.dispose()},a.DirectionalLightHelper.prototype.update=function(){var t=new a.Vector3,e=new a.Vector3,n=new a.Vector3;return function(){t.setFromMatrixPosition(this.light.matrixWorld),e.setFromMatrixPosition(this.light.target.matrixWorld),n.subVectors(e,t);var r=this.children[0],i=this.children[1];r.lookAt(n),r.material.color.copy(this.light.color).multiplyScalar(this.light.intensity),i.lookAt(n),i.scale.z=n.length()}}(),a.EdgesHelper=function(t,e,n){var r=void 0!==e?e:16777215;a.LineSegments.call(this,new a.EdgesGeometry(t.geometry,n),new a.LineBasicMaterial({color:r})),this.matrix=t.matrixWorld,this.matrixAutoUpdate=!1},a.EdgesHelper.prototype=Object.create(a.LineSegments.prototype),a.EdgesHelper.prototype.constructor=a.EdgesHelper,a.FaceNormalsHelper=function(t,e,n,r){this.object=t,this.size=void 0!==e?e:1;var i=void 0!==n?n:16776960,o=void 0!==r?r:1,s=0,c=this.object.geometry;c instanceof a.Geometry?s=c.faces.length:console.warn("THREE.FaceNormalsHelper: only THREE.Geometry is supported. Use THREE.VertexNormalsHelper, instead.");var u=new a.BufferGeometry,l=new a.Float32Attribute(2*s*3,3);u.addAttribute("position",l),a.LineSegments.call(this,u,new a.LineBasicMaterial({color:i,linewidth:o})),this.matrixAutoUpdate=!1,this.update()},a.FaceNormalsHelper.prototype=Object.create(a.LineSegments.prototype),a.FaceNormalsHelper.prototype.constructor=a.FaceNormalsHelper,a.FaceNormalsHelper.prototype.update=function(){var t=new a.Vector3,e=new a.Vector3,n=new a.Matrix3;return function(){this.object.updateMatrixWorld(!0),n.getNormalMatrix(this.object.matrixWorld);for(var r=this.object.matrixWorld,i=this.geometry.attributes.position,a=this.object.geometry,o=a.vertices,s=a.faces,c=0,u=0,l=s.length;u<l;u++){var h=s[u],f=h.normal;t.copy(o[h.a]).add(o[h.b]).add(o[h.c]).divideScalar(3).applyMatrix4(r),e.copy(f).applyMatrix3(n).normalize().multiplyScalar(this.size).add(t),i.setXYZ(c,t.x,t.y,t.z),c+=1,i.setXYZ(c,e.x,e.y,e.z),c+=1}return i.needsUpdate=!0,this}}(),a.GridHelper=function(t,e,n,r){n=new a.Color(void 0!==n?n:4473924),r=new a.Color(void 0!==r?r:8947848);for(var i=[],o=[],s=-t,c=0;s<=t;s+=e){i.push(-t,0,s,t,0,s),i.push(s,0,-t,s,0,t);var u=0===s?n:r;u.toArray(o,c),c+=3,u.toArray(o,c),c+=3,u.toArray(o,c),c+=3,u.toArray(o,c),c+=3}var l=new a.BufferGeometry;l.addAttribute("position",new a.Float32Attribute(i,3)),l.addAttribute("color",new a.Float32Attribute(o,3));var h=new a.LineBasicMaterial({vertexColors:a.VertexColors});a.LineSegments.call(this,l,h)},a.GridHelper.prototype=Object.create(a.LineSegments.prototype),a.GridHelper.prototype.constructor=a.GridHelper,a.GridHelper.prototype.setColors=function(){console.error("THREE.GridHelper: setColors() has been deprecated, pass them in the constructor instead.")},a.HemisphereLightHelper=function(t,e){a.Object3D.call(this),this.light=t,this.light.updateMatrixWorld(),this.matrix=t.matrixWorld,this.matrixAutoUpdate=!1,this.colors=[new a.Color,new a.Color];var n=new a.SphereGeometry(e,4,2);n.rotateX(-Math.PI/2);for(var r=0,i=8;r<i;r++)n.faces[r].color=this.colors[r<4?0:1];var o=new a.MeshBasicMaterial({vertexColors:a.FaceColors,wireframe:!0});this.lightSphere=new a.Mesh(n,o),this.add(this.lightSphere),this.update()},a.HemisphereLightHelper.prototype=Object.create(a.Object3D.prototype),a.HemisphereLightHelper.prototype.constructor=a.HemisphereLightHelper,a.HemisphereLightHelper.prototype.dispose=function(){this.lightSphere.geometry.dispose(),this.lightSphere.material.dispose()},a.HemisphereLightHelper.prototype.update=function(){var t=new a.Vector3;return function(){this.colors[0].copy(this.light.color).multiplyScalar(this.light.intensity),this.colors[1].copy(this.light.groundColor).multiplyScalar(this.light.intensity),this.lightSphere.lookAt(t.setFromMatrixPosition(this.light.matrixWorld).negate()),this.lightSphere.geometry.colorsNeedUpdate=!0}}(),a.PointLightHelper=function(t,e){this.light=t,this.light.updateMatrixWorld();var n=new a.SphereBufferGeometry(e,4,2),r=new a.MeshBasicMaterial({wireframe:!0,fog:!1});r.color.copy(this.light.color).multiplyScalar(this.light.intensity),a.Mesh.call(this,n,r),this.matrix=this.light.matrixWorld,this.matrixAutoUpdate=!1},a.PointLightHelper.prototype=Object.create(a.Mesh.prototype),a.PointLightHelper.prototype.constructor=a.PointLightHelper,a.PointLightHelper.prototype.dispose=function(){this.geometry.dispose(),this.material.dispose()},a.PointLightHelper.prototype.update=function(){this.material.color.copy(this.light.color).multiplyScalar(this.light.intensity)},a.SkeletonHelper=function(t){this.bones=this.getBoneList(t);for(var e=new a.Geometry,n=0;n<this.bones.length;n++){var r=this.bones[n];r.parent instanceof a.Bone&&(e.vertices.push(new a.Vector3),e.vertices.push(new a.Vector3),e.colors.push(new a.Color(0,0,1)),e.colors.push(new a.Color(0,1,0)))}e.dynamic=!0;var i=new a.LineBasicMaterial({vertexColors:a.VertexColors,depthTest:!1,depthWrite:!1,transparent:!0});a.LineSegments.call(this,e,i),this.root=t,this.matrix=t.matrixWorld,this.matrixAutoUpdate=!1,this.update()},a.SkeletonHelper.prototype=Object.create(a.LineSegments.prototype),a.SkeletonHelper.prototype.constructor=a.SkeletonHelper,a.SkeletonHelper.prototype.getBoneList=function(t){var e=[];t instanceof a.Bone&&e.push(t);for(var n=0;n<t.children.length;n++)e.push.apply(e,this.getBoneList(t.children[n]));return e},a.SkeletonHelper.prototype.update=function(){for(var t=this.geometry,e=(new a.Matrix4).getInverse(this.root.matrixWorld),n=new a.Matrix4,r=0,i=0;i<this.bones.length;i++){var o=this.bones[i];o.parent instanceof a.Bone&&(n.multiplyMatrices(e,o.matrixWorld),t.vertices[r].setFromMatrixPosition(n),n.multiplyMatrices(e,o.parent.matrixWorld),t.vertices[r+1].setFromMatrixPosition(n),r+=2)}t.verticesNeedUpdate=!0,t.computeBoundingSphere()},a.SpotLightHelper=function(t){a.Object3D.call(this),this.light=t,this.light.updateMatrixWorld(),this.matrix=t.matrixWorld,this.matrixAutoUpdate=!1;for(var e=new a.BufferGeometry,n=[0,0,0,0,0,1,0,0,0,1,0,1,0,0,0,-1,0,1,0,0,0,0,1,1,0,0,0,0,-1,1],r=0,i=1,o=32;r<o;r++,i++){var s=r/o*Math.PI*2,c=i/o*Math.PI*2;n.push(Math.cos(s),Math.sin(s),1,Math.cos(c),Math.sin(c),1)}e.addAttribute("position",new a.Float32Attribute(n,3));var u=new a.LineBasicMaterial({fog:!1});this.cone=new a.LineSegments(e,u),this.add(this.cone),this.update()},a.SpotLightHelper.prototype=Object.create(a.Object3D.prototype),a.SpotLightHelper.prototype.constructor=a.SpotLightHelper,a.SpotLightHelper.prototype.dispose=function(){this.cone.geometry.dispose(),this.cone.material.dispose()},a.SpotLightHelper.prototype.update=function(){var t=new a.Vector3,e=new a.Vector3;return function(){var n=this.light.distance?this.light.distance:1e3,r=n*Math.tan(this.light.angle);this.cone.scale.set(r,r,n),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).multiplyScalar(this.light.intensity)}}(),a.VertexNormalsHelper=function(t,e,n,r){this.object=t,this.size=void 0!==e?e:1;var i=void 0!==n?n:16711680,o=void 0!==r?r:1,s=0,c=this.object.geometry;c instanceof a.Geometry?s=3*c.faces.length:c instanceof a.BufferGeometry&&(s=c.attributes.normal.count);var u=new a.BufferGeometry,l=new a.Float32Attribute(2*s*3,3);u.addAttribute("position",l),a.LineSegments.call(this,u,new a.LineBasicMaterial({color:i,linewidth:o})),this.matrixAutoUpdate=!1,this.update()},a.VertexNormalsHelper.prototype=Object.create(a.LineSegments.prototype),a.VertexNormalsHelper.prototype.constructor=a.VertexNormalsHelper,a.VertexNormalsHelper.prototype.update=function(){var t=new a.Vector3,e=new a.Vector3,n=new a.Matrix3;return function(){var r=["a","b","c"];this.object.updateMatrixWorld(!0),n.getNormalMatrix(this.object.matrixWorld);var i=this.object.matrixWorld,o=this.geometry.attributes.position,s=this.object.geometry;
-if(s instanceof a.Geometry)for(var c=s.vertices,u=s.faces,l=0,h=0,f=u.length;h<f;h++)for(var p=u[h],d=0,m=p.vertexNormals.length;d<m;d++){var g=c[p[r[d]]],v=p.vertexNormals[d];t.copy(g).applyMatrix4(i),e.copy(v).applyMatrix3(n).normalize().multiplyScalar(this.size).add(t),o.setXYZ(l,t.x,t.y,t.z),l+=1,o.setXYZ(l,e.x,e.y,e.z),l+=1}else if(s instanceof a.BufferGeometry)for(var y=s.attributes.position,x=s.attributes.normal,l=0,d=0,m=y.count;d<m;d++)t.set(y.getX(d),y.getY(d),y.getZ(d)).applyMatrix4(i),e.set(x.getX(d),x.getY(d),x.getZ(d)),e.applyMatrix3(n).normalize().multiplyScalar(this.size).add(t),o.setXYZ(l,t.x,t.y,t.z),l+=1,o.setXYZ(l,e.x,e.y,e.z),l+=1;return o.needsUpdate=!0,this}}(),a.WireframeHelper=function(t,e){var n=void 0!==e?e:16777215;a.LineSegments.call(this,new a.WireframeGeometry(t.geometry),new a.LineBasicMaterial({color:n})),this.matrix=t.matrixWorld,this.matrixAutoUpdate=!1},a.WireframeHelper.prototype=Object.create(a.LineSegments.prototype),a.WireframeHelper.prototype.constructor=a.WireframeHelper,a.ImmediateRenderObject=function(t){a.Object3D.call(this),this.material=t,this.render=function(t){}},a.ImmediateRenderObject.prototype=Object.create(a.Object3D.prototype),a.ImmediateRenderObject.prototype.constructor=a.ImmediateRenderObject,a.MorphBlendMesh=function(t,e){a.Mesh.call(this,t,e),this.animationsMap={},this.animationsList=[];var n=this.geometry.morphTargets.length,r="__default",i=0,o=n-1,s=n/1;this.createAnimation(r,i,o,s),this.setAnimationWeight(r,1)},a.MorphBlendMesh.prototype=Object.create(a.Mesh.prototype),a.MorphBlendMesh.prototype.constructor=a.MorphBlendMesh,a.MorphBlendMesh.prototype.createAnimation=function(t,e,n,r){var i={start:e,end:n,length:n-e+1,fps:r,duration:(n-e)/r,lastFrame:0,currentFrame:0,active:!1,time:0,direction:1,weight:1,directionBackwards:!1,mirroredLoop:!1};this.animationsMap[t]=i,this.animationsList.push(i)},a.MorphBlendMesh.prototype.autoCreateAnimations=function(t){for(var e,n=/([a-z]+)_?(\d+)/i,r={},i=this.geometry,a=0,o=i.morphTargets.length;a<o;a++){var s=i.morphTargets[a],c=s.name.match(n);if(c&&c.length>1){var u=c[1];r[u]||(r[u]={start:1/0,end:-(1/0)});var l=r[u];a<l.start&&(l.start=a),a>l.end&&(l.end=a),e||(e=u)}}for(var u in r){var l=r[u];this.createAnimation(u,l.start,l.end,t)}this.firstAnimation=e},a.MorphBlendMesh.prototype.setAnimationDirectionForward=function(t){var e=this.animationsMap[t];e&&(e.direction=1,e.directionBackwards=!1)},a.MorphBlendMesh.prototype.setAnimationDirectionBackward=function(t){var e=this.animationsMap[t];e&&(e.direction=-1,e.directionBackwards=!0)},a.MorphBlendMesh.prototype.setAnimationFPS=function(t,e){var n=this.animationsMap[t];n&&(n.fps=e,n.duration=(n.end-n.start)/n.fps)},a.MorphBlendMesh.prototype.setAnimationDuration=function(t,e){var n=this.animationsMap[t];n&&(n.duration=e,n.fps=(n.end-n.start)/n.duration)},a.MorphBlendMesh.prototype.setAnimationWeight=function(t,e){var n=this.animationsMap[t];n&&(n.weight=e)},a.MorphBlendMesh.prototype.setAnimationTime=function(t,e){var n=this.animationsMap[t];n&&(n.time=e)},a.MorphBlendMesh.prototype.getAnimationTime=function(t){var e=0,n=this.animationsMap[t];return n&&(e=n.time),e},a.MorphBlendMesh.prototype.getAnimationDuration=function(t){var e=-1,n=this.animationsMap[t];return n&&(e=n.duration),e},a.MorphBlendMesh.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()")},a.MorphBlendMesh.prototype.stopAnimation=function(t){var e=this.animationsMap[t];e&&(e.active=!1)},a.MorphBlendMesh.prototype.update=function(t){for(var e=0,n=this.animationsList.length;e<n;e++){var r=this.animationsList[e];if(r.active){var i=r.duration/r.length;r.time+=r.direction*t,r.mirroredLoop?(r.time>r.duration||r.time<0)&&(r.direction*=-1,r.time>r.duration&&(r.time=r.duration,r.directionBackwards=!0),r.time<0&&(r.time=0,r.directionBackwards=!1)):(r.time=r.time%r.duration,r.time<0&&(r.time+=r.duration));var o=r.start+a.Math.clamp(Math.floor(r.time/i),0,r.length-1),s=r.weight;o!==r.currentFrame&&(this.morphTargetInfluences[r.lastFrame]=0,this.morphTargetInfluences[r.currentFrame]=1*s,this.morphTargetInfluences[o]=0,r.lastFrame=r.currentFrame,r.currentFrame=o);var c=r.time%i/i;r.directionBackwards&&(c=1-c),r.currentFrame!==r.lastFrame?(this.morphTargetInfluences[r.currentFrame]=c*s,this.morphTargetInfluences[r.lastFrame]=(1-c)*s):this.morphTargetInfluences[r.currentFrame]=s}}}},function(t,e){t.exports=function(t){function e(e){this.object=e,this.target=new t.Vector3,this.minDistance=0,this.maxDistance=1/0,this.minZoom=0,this.maxZoom=1/0,this.minPolarAngle=0,this.maxPolarAngle=Math.PI,this.minAzimuthAngle=-(1/0),this.maxAzimuthAngle=1/0,this.enableDamping=!1,this.dampingFactor=.25;var n,r,i=this,a=1e-6,o=0,s=0,c=1,u=new t.Vector3,l=!1;this.getPolarAngle=function(){return r},this.getAzimuthalAngle=function(){return n},this.rotateLeft=function(t){s-=t},this.rotateUp=function(t){o-=t},this.panLeft=function(){var e=new t.Vector3;return function(t){var n=this.object.matrix.elements;e.set(n[0],n[1],n[2]),e.multiplyScalar(-t),u.add(e)}}(),this.panUp=function(){var e=new t.Vector3;return function(t){var n=this.object.matrix.elements;e.set(n[4],n[5],n[6]),e.multiplyScalar(t),u.add(e)}}(),this.pan=function(e,n,r,a){if(i.object instanceof t.PerspectiveCamera){var o=i.object.position,s=o.clone().sub(i.target),c=s.length();c*=Math.tan(i.object.fov/2*Math.PI/180),i.panLeft(2*e*c/a),i.panUp(2*n*c/a)}else i.object instanceof t.OrthographicCamera?(i.panLeft(e*(i.object.right-i.object.left)/r),i.panUp(n*(i.object.top-i.object.bottom)/a)):console.warn("WARNING: OrbitControls.js encountered an unknown camera type - pan disabled.")},this.dollyIn=function(e){i.object instanceof t.PerspectiveCamera?c/=e:i.object instanceof t.OrthographicCamera?(i.object.zoom=Math.max(this.minZoom,Math.min(this.maxZoom,this.object.zoom*e)),i.object.updateProjectionMatrix(),l=!0):console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled.")},this.dollyOut=function(e){i.object instanceof t.PerspectiveCamera?c*=e:i.object instanceof t.OrthographicCamera?(i.object.zoom=Math.max(this.minZoom,Math.min(this.maxZoom,this.object.zoom/e)),i.object.updateProjectionMatrix(),l=!0):console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled.")},this.update=function(){var i=new t.Vector3,h=(new t.Quaternion).setFromUnitVectors(e.up,new t.Vector3(0,1,0)),f=h.clone().inverse(),p=new t.Vector3,d=new t.Quaternion;return function(){var t=this.object.position;i.copy(t).sub(this.target),i.applyQuaternion(h),n=Math.atan2(i.x,i.z),r=Math.atan2(Math.sqrt(i.x*i.x+i.z*i.z),i.y),n+=s,r+=o,n=Math.max(this.minAzimuthAngle,Math.min(this.maxAzimuthAngle,n)),r=Math.max(this.minPolarAngle,Math.min(this.maxPolarAngle,r)),r=Math.max(a,Math.min(Math.PI-a,r));var e=i.length()*c;return e=Math.max(this.minDistance,Math.min(this.maxDistance,e)),this.target.add(u),i.x=e*Math.sin(r)*Math.sin(n),i.y=e*Math.cos(r),i.z=e*Math.sin(r)*Math.cos(n),i.applyQuaternion(f),t.copy(this.target).add(i),this.object.lookAt(this.target),this.enableDamping===!0?(s*=1-this.dampingFactor,o*=1-this.dampingFactor):(s=0,o=0),c=1,u.set(0,0,0),!!(l||p.distanceToSquared(this.object.position)>a||8*(1-d.dot(this.object.quaternion))>a)&&(p.copy(this.object.position),d.copy(this.object.quaternion),l=!1,!0)}}()}function n(n,r){function i(t,e){var n=v.domElement===document?v.domElement.body:v.domElement;g.pan(t,e,n.clientWidth,n.clientHeight)}function a(){return 2*Math.PI/60/60*v.autoRotateSpeed}function o(){return Math.pow(.95,v.zoomSpeed)}function s(t){if(v.enabled!==!1){if(t.preventDefault(),t.button===v.mouseButtons.ORBIT){if(v.enableRotate===!1)return;L=A.ROTATE,y.set(t.clientX,t.clientY)}else if(t.button===v.mouseButtons.ZOOM){if(v.enableZoom===!1)return;L=A.DOLLY,S.set(t.clientX,t.clientY)}else if(t.button===v.mouseButtons.PAN){if(v.enablePan===!1)return;L=A.PAN,M.set(t.clientX,t.clientY)}L!==A.NONE&&(document.addEventListener("mousemove",c,!1),document.addEventListener("mouseup",u,!1),v.dispatchEvent(R))}}function c(t){if(v.enabled!==!1){t.preventDefault();var e=v.domElement===document?v.domElement.body:v.domElement;if(L===A.ROTATE){if(v.enableRotate===!1)return;x.set(t.clientX,t.clientY),b.subVectors(x,y),g.rotateLeft(2*Math.PI*b.x/e.clientWidth*v.rotateSpeed),g.rotateUp(2*Math.PI*b.y/e.clientHeight*v.rotateSpeed),y.copy(x)}else if(L===A.DOLLY){if(v.enableZoom===!1)return;E.set(t.clientX,t.clientY),T.subVectors(E,S),T.y>0?g.dollyIn(o()):T.y<0&&g.dollyOut(o()),S.copy(E)}else if(L===A.PAN){if(v.enablePan===!1)return;_.set(t.clientX,t.clientY),w.subVectors(_,M),i(w.x,w.y),M.copy(_)}L!==A.NONE&&v.update()}}function u(){v.enabled!==!1&&(document.removeEventListener("mousemove",c,!1),document.removeEventListener("mouseup",u,!1),v.dispatchEvent(P),L=A.NONE)}function l(t){if(v.enabled!==!1&&v.enableZoom!==!1&&L===A.NONE){t.preventDefault(),t.stopPropagation();var e=0;void 0!==t.wheelDelta?e=t.wheelDelta:void 0!==t.detail&&(e=-t.detail),e>0?g.dollyOut(o()):e<0&&g.dollyIn(o()),v.update(),v.dispatchEvent(R),v.dispatchEvent(P)}}function h(t){if(v.enabled!==!1&&v.enableKeys!==!1&&v.enablePan!==!1)switch(t.keyCode){case v.keys.UP:i(0,v.keyPanSpeed),v.update();break;case v.keys.BOTTOM:i(0,-v.keyPanSpeed),v.update();break;case v.keys.LEFT:i(v.keyPanSpeed,0),v.update();break;case v.keys.RIGHT:i(-v.keyPanSpeed,0),v.update()}}function f(t){if(v.enabled!==!1){switch(t.touches.length){case 1:if(v.enableRotate===!1)return;L=A.TOUCH_ROTATE,y.set(t.touches[0].pageX,t.touches[0].pageY);break;case 2:if(v.enableZoom===!1)return;L=A.TOUCH_DOLLY;var e=t.touches[0].pageX-t.touches[1].pageX,n=t.touches[0].pageY-t.touches[1].pageY,r=Math.sqrt(e*e+n*n);S.set(0,r);break;case 3:if(v.enablePan===!1)return;L=A.TOUCH_PAN,M.set(t.touches[0].pageX,t.touches[0].pageY);break;default:L=A.NONE}L!==A.NONE&&v.dispatchEvent(R)}}function p(t){if(v.enabled!==!1){t.preventDefault(),t.stopPropagation();var e=v.domElement===document?v.domElement.body:v.domElement;switch(t.touches.length){case 1:if(v.enableRotate===!1)return;if(L!==A.TOUCH_ROTATE)return;x.set(t.touches[0].pageX,t.touches[0].pageY),b.subVectors(x,y),g.rotateLeft(2*Math.PI*b.x/e.clientWidth*v.rotateSpeed),g.rotateUp(2*Math.PI*b.y/e.clientHeight*v.rotateSpeed),y.copy(x),v.update();break;case 2:if(v.enableZoom===!1)return;if(L!==A.TOUCH_DOLLY)return;var n=t.touches[0].pageX-t.touches[1].pageX,r=t.touches[0].pageY-t.touches[1].pageY,a=Math.sqrt(n*n+r*r);E.set(0,a),T.subVectors(E,S),T.y>0?g.dollyOut(o()):T.y<0&&g.dollyIn(o()),S.copy(E),v.update();break;case 3:if(v.enablePan===!1)return;if(L!==A.TOUCH_PAN)return;_.set(t.touches[0].pageX,t.touches[0].pageY),w.subVectors(_,M),i(w.x,w.y),M.copy(_),v.update();break;default:L=A.NONE}}}function d(){v.enabled!==!1&&(v.dispatchEvent(P),L=A.NONE)}function m(t){t.preventDefault()}var g=new e(n);this.domElement=void 0!==r?r:document,Object.defineProperty(this,"constraint",{get:function(){return g}}),this.getPolarAngle=function(){return g.getPolarAngle()},this.getAzimuthalAngle=function(){return g.getAzimuthalAngle()},this.enabled=!0,this.center=this.target,this.enableZoom=!0,this.zoomSpeed=1,this.enableRotate=!0,this.rotateSpeed=1,this.enablePan=!0,this.keyPanSpeed=7,this.autoRotate=!1,this.autoRotateSpeed=2,this.enableKeys=!0,this.keys={LEFT:37,UP:38,RIGHT:39,BOTTOM:40},this.mouseButtons={ORBIT:t.MOUSE.LEFT,ZOOM:t.MOUSE.MIDDLE,PAN:t.MOUSE.RIGHT};var v=this,y=new t.Vector2,x=new t.Vector2,b=new t.Vector2,M=new t.Vector2,_=new t.Vector2,w=new t.Vector2,S=new t.Vector2,E=new t.Vector2,T=new t.Vector2,A={NONE:-1,ROTATE:0,DOLLY:1,PAN:2,TOUCH_ROTATE:3,TOUCH_DOLLY:4,TOUCH_PAN:5},L=A.NONE;this.target0=this.target.clone(),this.position0=this.object.position.clone(),this.zoom0=this.object.zoom;var C={type:"change"},R={type:"start"},P={type:"end"};this.update=function(){this.autoRotate&&L===A.NONE&&g.rotateLeft(a()),g.update()===!0&&this.dispatchEvent(C)},this.reset=function(){L=A.NONE,this.target.copy(this.target0),this.object.position.copy(this.position0),this.object.zoom=this.zoom0,this.object.updateProjectionMatrix(),this.dispatchEvent(C),this.update()},this.dispose=function(){this.domElement.removeEventListener("contextmenu",m,!1),this.domElement.removeEventListener("mousedown",s,!1),this.domElement.removeEventListener("mousewheel",l,!1),this.domElement.removeEventListener("MozMousePixelScroll",l,!1),this.domElement.removeEventListener("touchstart",f,!1),this.domElement.removeEventListener("touchend",d,!1),this.domElement.removeEventListener("touchmove",p,!1),document.removeEventListener("mousemove",c,!1),document.removeEventListener("mouseup",u,!1),window.removeEventListener("keydown",h,!1)},this.domElement.addEventListener("contextmenu",m,!1),this.domElement.addEventListener("mousedown",s,!1),this.domElement.addEventListener("mousewheel",l,!1),this.domElement.addEventListener("MozMousePixelScroll",l,!1),this.domElement.addEventListener("touchstart",f,!1),this.domElement.addEventListener("touchend",d,!1),this.domElement.addEventListener("touchmove",p,!1),window.addEventListener("keydown",h,!1),this.update()}var r=t.MOUSE;return r||(r={LEFT:0,MIDDLE:1,RIGHT:2}),n.prototype=Object.create(t.EventDispatcher.prototype),n.prototype.constructor=n,Object.defineProperties(n.prototype,{object:{get:function(){return this.constraint.object}},target:{get:function(){return this.constraint.target},set:function(t){console.warn("THREE.OrbitControls: target is now immutable. Use target.set() instead."),this.constraint.target.copy(t)}},minDistance:{get:function(){return this.constraint.minDistance},set:function(t){this.constraint.minDistance=t}},maxDistance:{get:function(){return this.constraint.maxDistance},set:function(t){this.constraint.maxDistance=t}},minZoom:{get:function(){return this.constraint.minZoom},set:function(t){this.constraint.minZoom=t}},maxZoom:{get:function(){return this.constraint.maxZoom},set:function(t){this.constraint.maxZoom=t}},minPolarAngle:{get:function(){return this.constraint.minPolarAngle},set:function(t){this.constraint.minPolarAngle=t}},maxPolarAngle:{get:function(){return this.constraint.maxPolarAngle},set:function(t){this.constraint.maxPolarAngle=t}},minAzimuthAngle:{get:function(){return this.constraint.minAzimuthAngle},set:function(t){this.constraint.minAzimuthAngle=t}},maxAzimuthAngle:{get:function(){return this.constraint.maxAzimuthAngle},set:function(t){this.constraint.maxAzimuthAngle=t}},enableDamping:{get:function(){return this.constraint.enableDamping},set:function(t){this.constraint.enableDamping=t}},dampingFactor:{get:function(){return this.constraint.dampingFactor},set:function(t){this.constraint.dampingFactor=t}},noZoom:{get:function(){return console.warn("THREE.OrbitControls: .noZoom has been deprecated. Use .enableZoom instead."),!this.enableZoom},set:function(t){console.warn("THREE.OrbitControls: .noZoom has been deprecated. Use .enableZoom instead."),this.enableZoom=!t}},noRotate:{get:function(){return console.warn("THREE.OrbitControls: .noRotate has been deprecated. Use .enableRotate instead."),!this.enableRotate},set:function(t){console.warn("THREE.OrbitControls: .noRotate has been deprecated. Use .enableRotate instead."),this.enableRotate=!t}},noPan:{get:function(){return console.warn("THREE.OrbitControls: .noPan has been deprecated. Use .enablePan instead."),!this.enablePan},set:function(t){console.warn("THREE.OrbitControls: .noPan has been deprecated. Use .enablePan instead."),this.enablePan=!t}},noKeys:{get:function(){return console.warn("THREE.OrbitControls: .noKeys has been deprecated. Use .enableKeys instead."),!this.enableKeys},set:function(t){console.warn("THREE.OrbitControls: .noKeys has been deprecated. Use .enableKeys instead."),this.enableKeys=!t}},staticMoving:{get:function(){return console.warn("THREE.OrbitControls: .staticMoving has been deprecated. Use .enableDamping instead."),!this.constraint.enableDamping},set:function(t){console.warn("THREE.OrbitControls: .staticMoving has been deprecated. Use .enableDamping instead."),this.constraint.enableDamping=!t}},dynamicDampingFactor:{get:function(){return console.warn("THREE.OrbitControls: .dynamicDampingFactor has been renamed. Use .dampingFactor instead."),this.constraint.dampingFactor},set:function(t){console.warn("THREE.OrbitControls: .dynamicDampingFactor has been renamed. Use .dampingFactor instead."),this.constraint.dampingFactor=t}}}),n}},function(t,e,n){var r,i;!function(){function a(t){return t&&(t.ownerDocument||t.document||t).documentElement}function o(t){return t&&(t.ownerDocument&&t.ownerDocument.defaultView||t.document&&t||t.defaultView)}function s(t,e){return t<e?-1:t>e?1:t>=e?0:NaN}function c(t){return null===t?NaN:+t}function u(t){return!isNaN(t)}function l(t){return{left:function(e,n,r,i){for(arguments.length<3&&(r=0),arguments.length<4&&(i=e.length);r<i;){var a=r+i>>>1;t(e[a],n)<0?r=a+1:i=a}return r},right:function(e,n,r,i){for(arguments.length<3&&(r=0),arguments.length<4&&(i=e.length);r<i;){var a=r+i>>>1;t(e[a],n)>0?i=a:r=a+1}return r}}}function h(t){return t.length}function f(t){for(var e=1;t*e%1;)e*=10;return e}function p(t,e){for(var n in e)Object.defineProperty(t.prototype,n,{value:e[n],enumerable:!1})}function d(){this._=Object.create(null)}function m(t){return(t+="")===To||t[0]===Ao?Ao+t:t}function g(t){return(t+="")[0]===Ao?t.slice(1):t}function v(t){return m(t)in this._}function y(t){return(t=m(t))in this._&&delete this._[t]}function x(){var t=[];for(var e in this._)t.push(g(e));return t}function b(){var t=0;for(var e in this._)++t;return t}function M(){for(var t in this._)return!1;return!0}function _(){this._=Object.create(null)}function w(t){return t}function S(t,e,n){return function(){var r=n.apply(e,arguments);return r===e?t:r}}function E(t,e){if(e in t)return e;e=e.charAt(0).toUpperCase()+e.slice(1);for(var n=0,r=Lo.length;n<r;++n){var i=Lo[n]+e;if(i in t)return i}}function T(){}function A(){}function L(t){function e(){for(var e,r=n,i=-1,a=r.length;++i<a;)(e=r[i].on)&&e.apply(this,arguments);return t}var n=[],r=new d;return e.on=function(e,i){var a,o=r.get(e);return arguments.length<2?o&&o.on:(o&&(o.on=null,n=n.slice(0,a=n.indexOf(o)).concat(n.slice(a+1)),r.remove(e)),i&&n.push(r.set(e,{on:i})),t)},e}function C(){fo.event.preventDefault()}function R(){for(var t,e=fo.event;t=e.sourceEvent;)e=t;return e}function P(t){for(var e=new A,n=0,r=arguments.length;++n<r;)e[arguments[n]]=L(e);return e.of=function(n,r){return function(i){try{var a=i.sourceEvent=fo.event;i.target=t,fo.event=i,e[i.type].apply(n,r)}finally{fo.event=a}}},e}function D(t){return Ro(t,Uo),t}function N(t){return"function"==typeof t?t:function(){return Po(t,this)}}function U(t){return"function"==typeof t?t:function(){return Do(t,this)}}function B(t,e){function n(){this.removeAttribute(t)}function r(){this.removeAttributeNS(t.space,t.local)}function i(){this.setAttribute(t,e)}function a(){this.setAttributeNS(t.space,t.local,e)}function o(){var n=e.apply(this,arguments);null==n?this.removeAttribute(t):this.setAttribute(t,n)}function s(){var n=e.apply(this,arguments);null==n?this.removeAttributeNS(t.space,t.local):this.setAttributeNS(t.space,t.local,n)}return t=fo.ns.qualify(t),null==e?t.local?r:n:"function"==typeof e?t.local?s:o:t.local?a:i}function I(t){return t.trim().replace(/\s+/g," ")}function O(t){return new RegExp("(?:^|\\s+)"+fo.requote(t)+"(?:\\s+|$)","g")}function F(t){return(t+"").trim().split(/^|\s+/)}function V(t,e){function n(){for(var n=-1;++n<i;)t[n](this,e)}function r(){for(var n=-1,r=e.apply(this,arguments);++n<i;)t[n](this,r)}t=F(t).map(G);var i=t.length;return"function"==typeof e?r:n}function G(t){var e=O(t);return function(n,r){if(i=n.classList)return r?i.add(t):i.remove(t);var i=n.getAttribute("class")||"";r?(e.lastIndex=0,e.test(i)||n.setAttribute("class",I(i+" "+t))):n.setAttribute("class",I(i.replace(e," ")))}}function k(t,e,n){function r(){this.style.removeProperty(t)}function i(){this.style.setProperty(t,e,n)}function a(){var r=e.apply(this,arguments);null==r?this.style.removeProperty(t):this.style.setProperty(t,r,n)}return null==e?r:"function"==typeof e?a:i}function z(t,e){function n(){delete this[t]}function r(){this[t]=e}function i(){var n=e.apply(this,arguments);null==n?delete this[t]:this[t]=n}return null==e?n:"function"==typeof e?i:r}function H(t){function e(){var e=this.ownerDocument,n=this.namespaceURI;return n===Bo&&e.documentElement.namespaceURI===Bo?e.createElement(t):e.createElementNS(n,t)}function n(){return this.ownerDocument.createElementNS(t.space,t.local)}return"function"==typeof t?t:(t=fo.ns.qualify(t)).local?n:e}function j(){var t=this.parentNode;t&&t.removeChild(this)}function W(t){return{__data__:t}}function X(t){return function(){return No(this,t)}}function q(t){return arguments.length||(t=s),function(e,n){return e&&n?t(e.__data__,n.__data__):!e-!n}}function Y(t,e){for(var n=0,r=t.length;n<r;n++)for(var i,a=t[n],o=0,s=a.length;o<s;o++)(i=a[o])&&e(i,o,n);return t}function Z(t){return Ro(t,Oo),t}function K(t){var e,n;return function(r,i,a){var o,s=t[a].update,c=s.length;for(a!=n&&(n=a,e=0),i>=e&&(e=i+1);!(o=s[e])&&++e<c;);return o}}function Q(t,e,n){function r(){var e=this[o];e&&(this.removeEventListener(t,e,e.$),delete this[o])}function i(){var i=c(e,mo(arguments));r.call(this),this.addEventListener(t,this[o]=i,i.$=n),i._=e}function a(){var e,n=new RegExp("^__on([^.]+)"+fo.requote(t)+"$");for(var r in this)if(e=r.match(n)){var i=this[r];this.removeEventListener(e[1],i,i.$),delete this[r]}}var o="__on"+t,s=t.indexOf("."),c=J;s>0&&(t=t.slice(0,s));var u=Fo.get(t);return u&&(t=u,c=$),s?e?i:r:e?T:a}function J(t,e){return function(n){var r=fo.event;fo.event=n,e[0]=this.__data__;try{t.apply(this,e)}finally{fo.event=r}}}function $(t,e){var n=J(t,e);return function(t){var e=this,r=t.relatedTarget;r&&(r===e||8&r.compareDocumentPosition(e))||n.call(e,t)}}function tt(t){var e=".dragsuppress-"+ ++Go,n="click"+e,r=fo.select(o(t)).on("touchmove"+e,C).on("dragstart"+e,C).on("selectstart"+e,C);if(null==Vo&&(Vo=!("onselectstart"in t)&&E(t.style,"userSelect")),Vo){var i=a(t).style,s=i[Vo];i[Vo]="none"}return function(t){if(r.on(e,null),Vo&&(i[Vo]=s),t){var a=function(){r.on(n,null)};r.on(n,function(){C(),a()},!0),setTimeout(a,0)}}}function et(t,e){e.changedTouches&&(e=e.changedTouches[0]);var n=t.ownerSVGElement||t;if(n.createSVGPoint){var r=n.createSVGPoint();if(ko<0){var i=o(t);if(i.scrollX||i.scrollY){n=fo.select("body").append("svg").style({position:"absolute",top:0,left:0,margin:0,padding:0,border:"none"},"important");var a=n[0][0].getScreenCTM();ko=!(a.f||a.e),n.remove()}}return ko?(r.x=e.pageX,r.y=e.pageY):(r.x=e.clientX,r.y=e.clientY),r=r.matrixTransform(t.getScreenCTM().inverse()),[r.x,r.y]}var s=t.getBoundingClientRect();return[e.clientX-s.left-t.clientLeft,e.clientY-s.top-t.clientTop]}function nt(){return fo.event.changedTouches[0].identifier}function rt(t){return t>0?1:t<0?-1:0}function it(t,e,n){return(e[0]-t[0])*(n[1]-t[1])-(e[1]-t[1])*(n[0]-t[0])}function at(t){return t>1?0:t<-1?jo:Math.acos(t)}function ot(t){return t>1?qo:t<-1?-qo:Math.asin(t)}function st(t){return((t=Math.exp(t))-1/t)/2}function ct(t){return((t=Math.exp(t))+1/t)/2}function ut(t){return((t=Math.exp(2*t))-1)/(t+1)}function lt(t){return(t=Math.sin(t/2))*t}function ht(){}function ft(t,e,n){return this instanceof ft?(this.h=+t,this.s=+e,void(this.l=+n)):arguments.length<2?t instanceof ft?new ft(t.h,t.s,t.l):Tt(""+t,At,ft):new ft(t,e,n)}function pt(t,e,n){function r(t){return t>360?t-=360:t<0&&(t+=360),t<60?a+(o-a)*t/60:t<180?o:t<240?a+(o-a)*(240-t)/60:a}function i(t){return Math.round(255*r(t))}var a,o;return t=isNaN(t)?0:(t%=360)<0?t+360:t,e=isNaN(e)?0:e<0?0:e>1?1:e,n=n<0?0:n>1?1:n,o=n<=.5?n*(1+e):n+e-n*e,a=2*n-o,new _t(i(t+120),i(t),i(t-120))}function dt(t,e,n){return this instanceof dt?(this.h=+t,this.c=+e,void(this.l=+n)):arguments.length<2?t instanceof dt?new dt(t.h,t.c,t.l):t instanceof gt?yt(t.l,t.a,t.b):yt((t=Lt((t=fo.rgb(t)).r,t.g,t.b)).l,t.a,t.b):new dt(t,e,n)}function mt(t,e,n){return isNaN(t)&&(t=0),isNaN(e)&&(e=0),new gt(n,Math.cos(t*=Yo)*e,Math.sin(t)*e)}function gt(t,e,n){return this instanceof gt?(this.l=+t,this.a=+e,void(this.b=+n)):arguments.length<2?t instanceof gt?new gt(t.l,t.a,t.b):t instanceof dt?mt(t.h,t.c,t.l):Lt((t=_t(t)).r,t.g,t.b):new gt(t,e,n)}function vt(t,e,n){var r=(t+16)/116,i=r+e/500,a=r-n/200;return i=xt(i)*as,r=xt(r)*os,a=xt(a)*ss,new _t(Mt(3.2404542*i-1.5371385*r-.4985314*a),Mt(-.969266*i+1.8760108*r+.041556*a),Mt(.0556434*i-.2040259*r+1.0572252*a))}function yt(t,e,n){return t>0?new dt(Math.atan2(n,e)*Zo,Math.sqrt(e*e+n*n),t):new dt(NaN,NaN,t)}function xt(t){return t>.206893034?t*t*t:(t-4/29)/7.787037}function bt(t){return t>.008856?Math.pow(t,1/3):7.787037*t+4/29}function Mt(t){return Math.round(255*(t<=.00304?12.92*t:1.055*Math.pow(t,1/2.4)-.055))}function _t(t,e,n){return this instanceof _t?(this.r=~~t,this.g=~~e,void(this.b=~~n)):arguments.length<2?t instanceof _t?new _t(t.r,t.g,t.b):Tt(""+t,_t,pt):new _t(t,e,n)}function wt(t){return new _t(t>>16,t>>8&255,255&t)}function St(t){return wt(t)+""}function Et(t){return t<16?"0"+Math.max(0,t).toString(16):Math.min(255,t).toString(16)}function Tt(t,e,n){var r,i,a,o=0,s=0,c=0;if(r=/([a-z]+)\((.*)\)/.exec(t=t.toLowerCase()))switch(i=r[2].split(","),r[1]){case"hsl":return n(parseFloat(i[0]),parseFloat(i[1])/100,parseFloat(i[2])/100);case"rgb":return e(Rt(i[0]),Rt(i[1]),Rt(i[2]))}return(a=ls.get(t))?e(a.r,a.g,a.b):(null==t||"#"!==t.charAt(0)||isNaN(a=parseInt(t.slice(1),16))||(4===t.length?(o=(3840&a)>>4,o=o>>4|o,s=240&a,s=s>>4|s,c=15&a,c=c<<4|c):7===t.length&&(o=(16711680&a)>>16,s=(65280&a)>>8,c=255&a)),e(o,s,c))}function At(t,e,n){var r,i,a=Math.min(t/=255,e/=255,n/=255),o=Math.max(t,e,n),s=o-a,c=(o+a)/2;return s?(i=c<.5?s/(o+a):s/(2-o-a),r=t==o?(e-n)/s+(e<n?6:0):e==o?(n-t)/s+2:(t-e)/s+4,r*=60):(r=NaN,i=c>0&&c<1?0:r),new ft(r,i,c)}function Lt(t,e,n){t=Ct(t),e=Ct(e),n=Ct(n);var r=bt((.4124564*t+.3575761*e+.1804375*n)/as),i=bt((.2126729*t+.7151522*e+.072175*n)/os),a=bt((.0193339*t+.119192*e+.9503041*n)/ss);return gt(116*i-16,500*(r-i),200*(i-a))}function Ct(t){return(t/=255)<=.04045?t/12.92:Math.pow((t+.055)/1.055,2.4)}function Rt(t){var e=parseFloat(t);return"%"===t.charAt(t.length-1)?Math.round(2.55*e):e}function Pt(t){return"function"==typeof t?t:function(){return t}}function Dt(t){return function(e,n,r){return 2===arguments.length&&"function"==typeof n&&(r=n,n=null),Nt(e,n,t,r)}}function Nt(t,e,n,r){function i(){var t,e=c.status;if(!e&&Bt(c)||e>=200&&e<300||304===e){try{t=n.call(a,c)}catch(r){return void o.error.call(a,r)}o.load.call(a,t)}else o.error.call(a,c)}var a={},o=fo.dispatch("beforesend","progress","load","error"),s={},c=new XMLHttpRequest,u=null;return!this.XDomainRequest||"withCredentials"in c||!/^(http(s)?:)?\/\//.test(t)||(c=new XDomainRequest),"onload"in c?c.onload=c.onerror=i:c.onreadystatechange=function(){c.readyState>3&&i()},c.onprogress=function(t){var e=fo.event;fo.event=t;try{o.progress.call(a,c)}finally{fo.event=e}},a.header=function(t,e){return t=(t+"").toLowerCase(),arguments.length<2?s[t]:(null==e?delete s[t]:s[t]=e+"",a)},a.mimeType=function(t){return arguments.length?(e=null==t?null:t+"",a):e},a.responseType=function(t){return arguments.length?(u=t,a):u},a.response=function(t){return n=t,a},["get","post"].forEach(function(t){a[t]=function(){return a.send.apply(a,[t].concat(mo(arguments)))}}),a.send=function(n,r,i){if(2===arguments.length&&"function"==typeof r&&(i=r,r=null),c.open(n,t,!0),null==e||"accept"in s||(s.accept=e+",*/*"),c.setRequestHeader)for(var l in s)c.setRequestHeader(l,s[l]);return null!=e&&c.overrideMimeType&&c.overrideMimeType(e),null!=u&&(c.responseType=u),null!=i&&a.on("error",i).on("load",function(t){i(null,t)}),o.beforesend.call(a,c),c.send(null==r?null:r),a},a.abort=function(){return c.abort(),a},fo.rebind(a,o,"on"),null==r?a:a.get(Ut(r))}function Ut(t){return 1===t.length?function(e,n){t(null==e?n:null)}:t}function Bt(t){var e=t.responseType;return e&&"text"!==e?t.response:t.responseText}function It(t,e,n){var r=arguments.length;r<2&&(e=0),r<3&&(n=Date.now());var i=n+e,a={c:t,t:i,n:null};return fs?fs.n=a:hs=a,fs=a,ps||(ds=clearTimeout(ds),ps=1,ms(Ot)),a}function Ot(){var t=Ft(),e=Vt()-t;e>24?(isFinite(e)&&(clearTimeout(ds),ds=setTimeout(Ot,e)),ps=0):(ps=1,ms(Ot))}function Ft(){for(var t=Date.now(),e=hs;e;)t>=e.t&&e.c(t-e.t)&&(e.c=null),e=e.n;return t}function Vt(){for(var t,e=hs,n=1/0;e;)e.c?(e.t<n&&(n=e.t),e=(t=e).n):e=t?t.n=e.n:hs=e.n;return fs=t,n}function Gt(t,e){return e-(t?Math.ceil(Math.log(t)/Math.LN10):1)}function kt(t,e){var n=Math.pow(10,3*Eo(8-e));return{scale:e>8?function(t){return t/n}:function(t){return t*n},symbol:t}}function zt(t){var e=t.decimal,n=t.thousands,r=t.grouping,i=t.currency,a=r&&n?function(t,e){for(var i=t.length,a=[],o=0,s=r[0],c=0;i>0&&s>0&&(c+s+1>e&&(s=Math.max(1,e-c)),a.push(t.substring(i-=s,i+s)),!((c+=s+1)>e));)s=r[o=(o+1)%r.length];return a.reverse().join(n)}:w;return function(t){var n=vs.exec(t),r=n[1]||" ",o=n[2]||">",s=n[3]||"-",c=n[4]||"",u=n[5],l=+n[6],h=n[7],f=n[8],p=n[9],d=1,m="",g="",v=!1,y=!0;switch(f&&(f=+f.substring(1)),(u||"0"===r&&"="===o)&&(u=r="0",o="="),p){case"n":h=!0,p="g";break;case"%":d=100,g="%",p="f";break;case"p":d=100,g="%",p="r";break;case"b":case"o":case"x":case"X":"#"===c&&(m="0"+p.toLowerCase());case"c":y=!1;case"d":v=!0,f=0;break;case"s":d=-1,p="r"}"$"===c&&(m=i[0],g=i[1]),"r"!=p||f||(p="g"),null!=f&&("g"==p?f=Math.max(1,Math.min(21,f)):"e"!=p&&"f"!=p||(f=Math.max(0,Math.min(20,f)))),p=ys.get(p)||Ht;var x=u&&h;return function(t){var n=g;if(v&&t%1)return"";var i=t<0||0===t&&1/t<0?(t=-t,"-"):"-"===s?"":s;if(d<0){var c=fo.formatPrefix(t,f);t=c.scale(t),n=c.symbol+g}else t*=d;t=p(t,f);var b,M,_=t.lastIndexOf(".");if(_<0){var w=y?t.lastIndexOf("e"):-1;w<0?(b=t,M=""):(b=t.substring(0,w),M=t.substring(w))}else b=t.substring(0,_),M=e+t.substring(_+1);!u&&h&&(b=a(b,1/0));var S=m.length+b.length+M.length+(x?0:i.length),E=S<l?new Array(S=l-S+1).join(r):"";return x&&(b=a(E+b,E.length?l-M.length:1/0)),i+=m,t=b+M,("<"===o?i+t+E:">"===o?E+i+t:"^"===o?E.substring(0,S>>=1)+i+t+E.substring(S):i+(x?t:E+t))+n}}}function Ht(t){return t+""}function jt(){this._=new Date(arguments.length>1?Date.UTC.apply(this,arguments):arguments[0])}function Wt(t,e,n){function r(e){var n=t(e),r=a(n,1);return e-n<r-e?n:r}function i(n){return e(n=t(new bs(n-1)),1),n}function a(t,n){return e(t=new bs((+t)),n),t}function o(t,r,a){var o=i(t),s=[];if(a>1)for(;o<r;)n(o)%a||s.push(new Date((+o))),e(o,1);else for(;o<r;)s.push(new Date((+o))),e(o,1);return s}function s(t,e,n){try{bs=jt;var r=new jt;return r._=t,o(r,e,n)}finally{bs=Date}}t.floor=t,t.round=r,t.ceil=i,t.offset=a,t.range=o;var c=t.utc=Xt(t);return c.floor=c,c.round=Xt(r),c.ceil=Xt(i),c.offset=Xt(a),c.range=s,t}function Xt(t){return function(e,n){try{bs=jt;var r=new jt;return r._=e,t(r,n)._}finally{bs=Date}}}function qt(t){function e(t){function e(e){for(var n,i,a,o=[],s=-1,c=0;++s<r;)37===t.charCodeAt(s)&&(o.push(t.slice(c,s)),null!=(i=_s[n=t.charAt(++s)])&&(n=t.charAt(++s)),(a=L[n])&&(n=a(e,null==i?"e"===n?" ":"0":i)),o.push(n),c=s+1);return o.push(t.slice(c,s)),o.join("")}var r=t.length;return e.parse=function(e){var r={y:1900,m:0,d:1,H:0,M:0,S:0,L:0,Z:null},i=n(r,t,e,0);if(i!=e.length)return null;"p"in r&&(r.H=r.H%12+12*r.p);var a=null!=r.Z&&bs!==jt,o=new(a?jt:bs);return"j"in r?o.setFullYear(r.y,0,r.j):"W"in r||"U"in r?("w"in r||(r.w="W"in r?1:0),o.setFullYear(r.y,0,1),o.setFullYear(r.y,0,"W"in r?(r.w+6)%7+7*r.W-(o.getDay()+5)%7:r.w+7*r.U-(o.getDay()+6)%7)):o.setFullYear(r.y,r.m,r.d),o.setHours(r.H+(r.Z/100|0),r.M+r.Z%100,r.S,r.L),a?o._:o},e.toString=function(){return t},e}function n(t,e,n,r){for(var i,a,o,s=0,c=e.length,u=n.length;s<c;){if(r>=u)return-1;if(i=e.charCodeAt(s++),37===i){if(o=e.charAt(s++),a=C[o in _s?e.charAt(s++):o],!a||(r=a(t,n,r))<0)return-1}else if(i!=n.charCodeAt(r++))return-1}return r}function r(t,e,n){_.lastIndex=0;var r=_.exec(e.slice(n));
-return r?(t.w=w.get(r[0].toLowerCase()),n+r[0].length):-1}function i(t,e,n){b.lastIndex=0;var r=b.exec(e.slice(n));return r?(t.w=M.get(r[0].toLowerCase()),n+r[0].length):-1}function a(t,e,n){T.lastIndex=0;var r=T.exec(e.slice(n));return r?(t.m=A.get(r[0].toLowerCase()),n+r[0].length):-1}function o(t,e,n){S.lastIndex=0;var r=S.exec(e.slice(n));return r?(t.m=E.get(r[0].toLowerCase()),n+r[0].length):-1}function s(t,e,r){return n(t,L.c.toString(),e,r)}function c(t,e,r){return n(t,L.x.toString(),e,r)}function u(t,e,r){return n(t,L.X.toString(),e,r)}function l(t,e,n){var r=x.get(e.slice(n,n+=2).toLowerCase());return null==r?-1:(t.p=r,n)}var h=t.dateTime,f=t.date,p=t.time,d=t.periods,m=t.days,g=t.shortDays,v=t.months,y=t.shortMonths;e.utc=function(t){function n(t){try{bs=jt;var e=new bs;return e._=t,r(e)}finally{bs=Date}}var r=e(t);return n.parse=function(t){try{bs=jt;var e=r.parse(t);return e&&e._}finally{bs=Date}},n.toString=r.toString,n},e.multi=e.utc.multi=pe;var x=fo.map(),b=Zt(m),M=Kt(m),_=Zt(g),w=Kt(g),S=Zt(v),E=Kt(v),T=Zt(y),A=Kt(y);d.forEach(function(t,e){x.set(t.toLowerCase(),e)});var L={a:function(t){return g[t.getDay()]},A:function(t){return m[t.getDay()]},b:function(t){return y[t.getMonth()]},B:function(t){return v[t.getMonth()]},c:e(h),d:function(t,e){return Yt(t.getDate(),e,2)},e:function(t,e){return Yt(t.getDate(),e,2)},H:function(t,e){return Yt(t.getHours(),e,2)},I:function(t,e){return Yt(t.getHours()%12||12,e,2)},j:function(t,e){return Yt(1+xs.dayOfYear(t),e,3)},L:function(t,e){return Yt(t.getMilliseconds(),e,3)},m:function(t,e){return Yt(t.getMonth()+1,e,2)},M:function(t,e){return Yt(t.getMinutes(),e,2)},p:function(t){return d[+(t.getHours()>=12)]},S:function(t,e){return Yt(t.getSeconds(),e,2)},U:function(t,e){return Yt(xs.sundayOfYear(t),e,2)},w:function(t){return t.getDay()},W:function(t,e){return Yt(xs.mondayOfYear(t),e,2)},x:e(f),X:e(p),y:function(t,e){return Yt(t.getFullYear()%100,e,2)},Y:function(t,e){return Yt(t.getFullYear()%1e4,e,4)},Z:he,"%":function(){return"%"}},C={a:r,A:i,b:a,B:o,c:s,d:ae,e:ae,H:se,I:se,j:oe,L:le,m:ie,M:ce,p:l,S:ue,U:Jt,w:Qt,W:$t,x:c,X:u,y:ee,Y:te,Z:ne,"%":fe};return e}function Yt(t,e,n){var r=t<0?"-":"",i=(r?-t:t)+"",a=i.length;return r+(a<n?new Array(n-a+1).join(e)+i:i)}function Zt(t){return new RegExp("^(?:"+t.map(fo.requote).join("|")+")","i")}function Kt(t){for(var e=new d,n=-1,r=t.length;++n<r;)e.set(t[n].toLowerCase(),n);return e}function Qt(t,e,n){ws.lastIndex=0;var r=ws.exec(e.slice(n,n+1));return r?(t.w=+r[0],n+r[0].length):-1}function Jt(t,e,n){ws.lastIndex=0;var r=ws.exec(e.slice(n));return r?(t.U=+r[0],n+r[0].length):-1}function $t(t,e,n){ws.lastIndex=0;var r=ws.exec(e.slice(n));return r?(t.W=+r[0],n+r[0].length):-1}function te(t,e,n){ws.lastIndex=0;var r=ws.exec(e.slice(n,n+4));return r?(t.y=+r[0],n+r[0].length):-1}function ee(t,e,n){ws.lastIndex=0;var r=ws.exec(e.slice(n,n+2));return r?(t.y=re(+r[0]),n+r[0].length):-1}function ne(t,e,n){return/^[+-]\d{4}$/.test(e=e.slice(n,n+5))?(t.Z=-e,n+5):-1}function re(t){return t+(t>68?1900:2e3)}function ie(t,e,n){ws.lastIndex=0;var r=ws.exec(e.slice(n,n+2));return r?(t.m=r[0]-1,n+r[0].length):-1}function ae(t,e,n){ws.lastIndex=0;var r=ws.exec(e.slice(n,n+2));return r?(t.d=+r[0],n+r[0].length):-1}function oe(t,e,n){ws.lastIndex=0;var r=ws.exec(e.slice(n,n+3));return r?(t.j=+r[0],n+r[0].length):-1}function se(t,e,n){ws.lastIndex=0;var r=ws.exec(e.slice(n,n+2));return r?(t.H=+r[0],n+r[0].length):-1}function ce(t,e,n){ws.lastIndex=0;var r=ws.exec(e.slice(n,n+2));return r?(t.M=+r[0],n+r[0].length):-1}function ue(t,e,n){ws.lastIndex=0;var r=ws.exec(e.slice(n,n+2));return r?(t.S=+r[0],n+r[0].length):-1}function le(t,e,n){ws.lastIndex=0;var r=ws.exec(e.slice(n,n+3));return r?(t.L=+r[0],n+r[0].length):-1}function he(t){var e=t.getTimezoneOffset(),n=e>0?"-":"+",r=Eo(e)/60|0,i=Eo(e)%60;return n+Yt(r,"0",2)+Yt(i,"0",2)}function fe(t,e,n){Ss.lastIndex=0;var r=Ss.exec(e.slice(n,n+1));return r?n+r[0].length:-1}function pe(t){for(var e=t.length,n=-1;++n<e;)t[n][0]=this(t[n][0]);return function(e){for(var n=0,r=t[n];!r[1](e);)r=t[++n];return r[0](e)}}function de(){}function me(t,e,n){var r=n.s=t+e,i=r-t,a=r-i;n.t=t-a+(e-i)}function ge(t,e){t&&Ls.hasOwnProperty(t.type)&&Ls[t.type](t,e)}function ve(t,e,n){var r,i=-1,a=t.length-n;for(e.lineStart();++i<a;)r=t[i],e.point(r[0],r[1],r[2]);e.lineEnd()}function ye(t,e){var n=-1,r=t.length;for(e.polygonStart();++n<r;)ve(t[n],e,1);e.polygonEnd()}function xe(){function t(t,e){t*=Yo,e=e*Yo/2+jo/4;var n=t-r,o=n>=0?1:-1,s=o*n,c=Math.cos(e),u=Math.sin(e),l=a*u,h=i*c+l*Math.cos(s),f=l*o*Math.sin(s);Rs.add(Math.atan2(f,h)),r=t,i=c,a=u}var e,n,r,i,a;Ps.point=function(o,s){Ps.point=t,r=(e=o)*Yo,i=Math.cos(s=(n=s)*Yo/2+jo/4),a=Math.sin(s)},Ps.lineEnd=function(){t(e,n)}}function be(t){var e=t[0],n=t[1],r=Math.cos(n);return[r*Math.cos(e),r*Math.sin(e),Math.sin(n)]}function Me(t,e){return t[0]*e[0]+t[1]*e[1]+t[2]*e[2]}function _e(t,e){return[t[1]*e[2]-t[2]*e[1],t[2]*e[0]-t[0]*e[2],t[0]*e[1]-t[1]*e[0]]}function we(t,e){t[0]+=e[0],t[1]+=e[1],t[2]+=e[2]}function Se(t,e){return[t[0]*e,t[1]*e,t[2]*e]}function Ee(t){var e=Math.sqrt(t[0]*t[0]+t[1]*t[1]+t[2]*t[2]);t[0]/=e,t[1]/=e,t[2]/=e}function Te(t){return[Math.atan2(t[1],t[0]),ot(t[2])]}function Ae(t,e){return Eo(t[0]-e[0])<zo&&Eo(t[1]-e[1])<zo}function Le(t,e){t*=Yo;var n=Math.cos(e*=Yo);Ce(n*Math.cos(t),n*Math.sin(t),Math.sin(e))}function Ce(t,e,n){++Ds,Us+=(t-Us)/Ds,Bs+=(e-Bs)/Ds,Is+=(n-Is)/Ds}function Re(){function t(t,i){t*=Yo;var a=Math.cos(i*=Yo),o=a*Math.cos(t),s=a*Math.sin(t),c=Math.sin(i),u=Math.atan2(Math.sqrt((u=n*c-r*s)*u+(u=r*o-e*c)*u+(u=e*s-n*o)*u),e*o+n*s+r*c);Ns+=u,Os+=u*(e+(e=o)),Fs+=u*(n+(n=s)),Vs+=u*(r+(r=c)),Ce(e,n,r)}var e,n,r;Hs.point=function(i,a){i*=Yo;var o=Math.cos(a*=Yo);e=o*Math.cos(i),n=o*Math.sin(i),r=Math.sin(a),Hs.point=t,Ce(e,n,r)}}function Pe(){Hs.point=Le}function De(){function t(t,e){t*=Yo;var n=Math.cos(e*=Yo),o=n*Math.cos(t),s=n*Math.sin(t),c=Math.sin(e),u=i*c-a*s,l=a*o-r*c,h=r*s-i*o,f=Math.sqrt(u*u+l*l+h*h),p=r*o+i*s+a*c,d=f&&-at(p)/f,m=Math.atan2(f,p);Gs+=d*u,ks+=d*l,zs+=d*h,Ns+=m,Os+=m*(r+(r=o)),Fs+=m*(i+(i=s)),Vs+=m*(a+(a=c)),Ce(r,i,a)}var e,n,r,i,a;Hs.point=function(o,s){e=o,n=s,Hs.point=t,o*=Yo;var c=Math.cos(s*=Yo);r=c*Math.cos(o),i=c*Math.sin(o),a=Math.sin(s),Ce(r,i,a)},Hs.lineEnd=function(){t(e,n),Hs.lineEnd=Pe,Hs.point=Le}}function Ne(t,e){function n(n,r){return n=t(n,r),e(n[0],n[1])}return t.invert&&e.invert&&(n.invert=function(n,r){return n=e.invert(n,r),n&&t.invert(n[0],n[1])}),n}function Ue(){return!0}function Be(t,e,n,r,i){var a=[],o=[];if(t.forEach(function(t){if(!((e=t.length-1)<=0)){var e,n=t[0],r=t[e];if(Ae(n,r)){i.lineStart();for(var s=0;s<e;++s)i.point((n=t[s])[0],n[1]);return void i.lineEnd()}var c=new Oe(n,t,null,(!0)),u=new Oe(n,null,c,(!1));c.o=u,a.push(c),o.push(u),c=new Oe(r,t,null,(!1)),u=new Oe(r,null,c,(!0)),c.o=u,a.push(c),o.push(u)}}),o.sort(e),Ie(a),Ie(o),a.length){for(var s=0,c=n,u=o.length;s<u;++s)o[s].e=c=!c;for(var l,h,f=a[0];;){for(var p=f,d=!0;p.v;)if((p=p.n)===f)return;l=p.z,i.lineStart();do{if(p.v=p.o.v=!0,p.e){if(d)for(var s=0,u=l.length;s<u;++s)i.point((h=l[s])[0],h[1]);else r(p.x,p.n.x,1,i);p=p.n}else{if(d){l=p.p.z;for(var s=l.length-1;s>=0;--s)i.point((h=l[s])[0],h[1])}else r(p.x,p.p.x,-1,i);p=p.p}p=p.o,l=p.z,d=!d}while(!p.v);i.lineEnd()}}}function Ie(t){if(e=t.length){for(var e,n,r=0,i=t[0];++r<e;)i.n=n=t[r],n.p=i,i=n;i.n=n=t[0],n.p=i}}function Oe(t,e,n,r){this.x=t,this.z=e,this.o=n,this.e=r,this.v=!1,this.n=this.p=null}function Fe(t,e,n,r){return function(i,a){function o(e,n){var r=i(e,n);t(e=r[0],n=r[1])&&a.point(e,n)}function s(t,e){var n=i(t,e);g.point(n[0],n[1])}function c(){y.point=s,g.lineStart()}function u(){y.point=o,g.lineEnd()}function l(t,e){m.push([t,e]);var n=i(t,e);b.point(n[0],n[1])}function h(){b.lineStart(),m=[]}function f(){l(m[0][0],m[0][1]),b.lineEnd();var t,e=b.clean(),n=x.buffer(),r=n.length;if(m.pop(),d.push(m),m=null,r)if(1&e){t=n[0];var i,r=t.length-1,o=-1;if(r>0){for(M||(a.polygonStart(),M=!0),a.lineStart();++o<r;)a.point((i=t[o])[0],i[1]);a.lineEnd()}}else r>1&&2&e&&n.push(n.pop().concat(n.shift())),p.push(n.filter(Ve))}var p,d,m,g=e(a),v=i.invert(r[0],r[1]),y={point:o,lineStart:c,lineEnd:u,polygonStart:function(){y.point=l,y.lineStart=h,y.lineEnd=f,p=[],d=[]},polygonEnd:function(){y.point=o,y.lineStart=c,y.lineEnd=u,p=fo.merge(p);var t=We(v,d);p.length?(M||(a.polygonStart(),M=!0),Be(p,ke,t,n,a)):t&&(M||(a.polygonStart(),M=!0),a.lineStart(),n(null,null,1,a),a.lineEnd()),M&&(a.polygonEnd(),M=!1),p=d=null},sphere:function(){a.polygonStart(),a.lineStart(),n(null,null,1,a),a.lineEnd(),a.polygonEnd()}},x=Ge(),b=e(x),M=!1;return y}}function Ve(t){return t.length>1}function Ge(){var t,e=[];return{lineStart:function(){e.push(t=[])},point:function(e,n){t.push([e,n])},lineEnd:T,buffer:function(){var n=e;return e=[],t=null,n},rejoin:function(){e.length>1&&e.push(e.pop().concat(e.shift()))}}}function ke(t,e){return((t=t.x)[0]<0?t[1]-qo-zo:qo-t[1])-((e=e.x)[0]<0?e[1]-qo-zo:qo-e[1])}function ze(t){var e,n=NaN,r=NaN,i=NaN;return{lineStart:function(){t.lineStart(),e=1},point:function(a,o){var s=a>0?jo:-jo,c=Eo(a-n);Eo(c-jo)<zo?(t.point(n,r=(r+o)/2>0?qo:-qo),t.point(i,r),t.lineEnd(),t.lineStart(),t.point(s,r),t.point(a,r),e=0):i!==s&&c>=jo&&(Eo(n-i)<zo&&(n-=i*zo),Eo(a-s)<zo&&(a-=s*zo),r=He(n,r,a,o),t.point(i,r),t.lineEnd(),t.lineStart(),t.point(s,r),e=0),t.point(n=a,r=o),i=s},lineEnd:function(){t.lineEnd(),n=r=NaN},clean:function(){return 2-e}}}function He(t,e,n,r){var i,a,o=Math.sin(t-n);return Eo(o)>zo?Math.atan((Math.sin(e)*(a=Math.cos(r))*Math.sin(n)-Math.sin(r)*(i=Math.cos(e))*Math.sin(t))/(i*a*o)):(e+r)/2}function je(t,e,n,r){var i;if(null==t)i=n*qo,r.point(-jo,i),r.point(0,i),r.point(jo,i),r.point(jo,0),r.point(jo,-i),r.point(0,-i),r.point(-jo,-i),r.point(-jo,0),r.point(-jo,i);else if(Eo(t[0]-e[0])>zo){var a=t[0]<e[0]?jo:-jo;i=n*a/2,r.point(-a,i),r.point(0,i),r.point(a,i)}else r.point(e[0],e[1])}function We(t,e){var n=t[0],r=t[1],i=[Math.sin(n),-Math.cos(n),0],a=0,o=0;Rs.reset();for(var s=0,c=e.length;s<c;++s){var u=e[s],l=u.length;if(l)for(var h=u[0],f=h[0],p=h[1]/2+jo/4,d=Math.sin(p),m=Math.cos(p),g=1;;){g===l&&(g=0),t=u[g];var v=t[0],y=t[1]/2+jo/4,x=Math.sin(y),b=Math.cos(y),M=v-f,_=M>=0?1:-1,w=_*M,S=w>jo,E=d*x;if(Rs.add(Math.atan2(E*_*Math.sin(w),m*b+E*Math.cos(w))),a+=S?M+_*Wo:M,S^f>=n^v>=n){var T=_e(be(h),be(t));Ee(T);var A=_e(i,T);Ee(A);var L=(S^M>=0?-1:1)*ot(A[2]);(r>L||r===L&&(T[0]||T[1]))&&(o+=S^M>=0?1:-1)}if(!g++)break;f=v,d=x,m=b,h=t}}return(a<-zo||a<zo&&Rs<-zo)^1&o}function Xe(t){function e(t,e){return Math.cos(t)*Math.cos(e)>a}function n(t){var n,a,c,u,l;return{lineStart:function(){u=c=!1,l=1},point:function(h,f){var p,d=[h,f],m=e(h,f),g=o?m?0:i(h,f):m?i(h+(h<0?jo:-jo),f):0;if(!n&&(u=c=m)&&t.lineStart(),m!==c&&(p=r(n,d),(Ae(n,p)||Ae(d,p))&&(d[0]+=zo,d[1]+=zo,m=e(d[0],d[1]))),m!==c)l=0,m?(t.lineStart(),p=r(d,n),t.point(p[0],p[1])):(p=r(n,d),t.point(p[0],p[1]),t.lineEnd()),n=p;else if(s&&n&&o^m){var v;g&a||!(v=r(d,n,!0))||(l=0,o?(t.lineStart(),t.point(v[0][0],v[0][1]),t.point(v[1][0],v[1][1]),t.lineEnd()):(t.point(v[1][0],v[1][1]),t.lineEnd(),t.lineStart(),t.point(v[0][0],v[0][1])))}!m||n&&Ae(n,d)||t.point(d[0],d[1]),n=d,c=m,a=g},lineEnd:function(){c&&t.lineEnd(),n=null},clean:function(){return l|(u&&c)<<1}}}function r(t,e,n){var r=be(t),i=be(e),o=[1,0,0],s=_e(r,i),c=Me(s,s),u=s[0],l=c-u*u;if(!l)return!n&&t;var h=a*c/l,f=-a*u/l,p=_e(o,s),d=Se(o,h),m=Se(s,f);we(d,m);var g=p,v=Me(d,g),y=Me(g,g),x=v*v-y*(Me(d,d)-1);if(!(x<0)){var b=Math.sqrt(x),M=Se(g,(-v-b)/y);if(we(M,d),M=Te(M),!n)return M;var _,w=t[0],S=e[0],E=t[1],T=e[1];S<w&&(_=w,w=S,S=_);var A=S-w,L=Eo(A-jo)<zo,C=L||A<zo;if(!L&&T<E&&(_=E,E=T,T=_),C?L?E+T>0^M[1]<(Eo(M[0]-w)<zo?E:T):E<=M[1]&&M[1]<=T:A>jo^(w<=M[0]&&M[0]<=S)){var R=Se(g,(-v+b)/y);return we(R,d),[M,Te(R)]}}}function i(e,n){var r=o?t:jo-t,i=0;return e<-r?i|=1:e>r&&(i|=2),n<-r?i|=4:n>r&&(i|=8),i}var a=Math.cos(t),o=a>0,s=Eo(a)>zo,c=bn(t,6*Yo);return Fe(e,n,c,o?[0,-t]:[-jo,t-jo])}function qe(t,e,n,r){return function(i){var a,o=i.a,s=i.b,c=o.x,u=o.y,l=s.x,h=s.y,f=0,p=1,d=l-c,m=h-u;if(a=t-c,d||!(a>0)){if(a/=d,d<0){if(a<f)return;a<p&&(p=a)}else if(d>0){if(a>p)return;a>f&&(f=a)}if(a=n-c,d||!(a<0)){if(a/=d,d<0){if(a>p)return;a>f&&(f=a)}else if(d>0){if(a<f)return;a<p&&(p=a)}if(a=e-u,m||!(a>0)){if(a/=m,m<0){if(a<f)return;a<p&&(p=a)}else if(m>0){if(a>p)return;a>f&&(f=a)}if(a=r-u,m||!(a<0)){if(a/=m,m<0){if(a>p)return;a>f&&(f=a)}else if(m>0){if(a<f)return;a<p&&(p=a)}return f>0&&(i.a={x:c+f*d,y:u+f*m}),p<1&&(i.b={x:c+p*d,y:u+p*m}),i}}}}}}function Ye(t,e,n,r){function i(r,i){return Eo(r[0]-t)<zo?i>0?0:3:Eo(r[0]-n)<zo?i>0?2:1:Eo(r[1]-e)<zo?i>0?1:0:i>0?3:2}function a(t,e){return o(t.x,e.x)}function o(t,e){var n=i(t,1),r=i(e,1);return n!==r?n-r:0===n?e[1]-t[1]:1===n?t[0]-e[0]:2===n?t[1]-e[1]:e[0]-t[0]}return function(s){function c(t){for(var e=0,n=g.length,r=t[1],i=0;i<n;++i)for(var a,o=1,s=g[i],c=s.length,u=s[0];o<c;++o)a=s[o],u[1]<=r?a[1]>r&&it(u,a,t)>0&&++e:a[1]<=r&&it(u,a,t)<0&&--e,u=a;return 0!==e}function u(a,s,c,u){var l=0,h=0;if(null==a||(l=i(a,c))!==(h=i(s,c))||o(a,s)<0^c>0){do u.point(0===l||3===l?t:n,l>1?r:e);while((l=(l+c+4)%4)!==h)}else u.point(s[0],s[1])}function l(i,a){return t<=i&&i<=n&&e<=a&&a<=r}function h(t,e){l(t,e)&&s.point(t,e)}function f(){C.point=d,g&&g.push(v=[]),S=!0,w=!1,M=_=NaN}function p(){m&&(d(y,x),b&&w&&A.rejoin(),m.push(A.buffer())),C.point=h,w&&s.lineEnd()}function d(t,e){t=Math.max(-Ws,Math.min(Ws,t)),e=Math.max(-Ws,Math.min(Ws,e));var n=l(t,e);if(g&&v.push([t,e]),S)y=t,x=e,b=n,S=!1,n&&(s.lineStart(),s.point(t,e));else if(n&&w)s.point(t,e);else{var r={a:{x:M,y:_},b:{x:t,y:e}};L(r)?(w||(s.lineStart(),s.point(r.a.x,r.a.y)),s.point(r.b.x,r.b.y),n||s.lineEnd(),E=!1):n&&(s.lineStart(),s.point(t,e),E=!1)}M=t,_=e,w=n}var m,g,v,y,x,b,M,_,w,S,E,T=s,A=Ge(),L=qe(t,e,n,r),C={point:h,lineStart:f,lineEnd:p,polygonStart:function(){s=A,m=[],g=[],E=!0},polygonEnd:function(){s=T,m=fo.merge(m);var e=c([t,r]),n=E&&e,i=m.length;(n||i)&&(s.polygonStart(),n&&(s.lineStart(),u(null,null,1,s),s.lineEnd()),i&&Be(m,a,e,u,s),s.polygonEnd()),m=g=v=null}};return C}}function Ze(t){var e=0,n=jo/3,r=fn(t),i=r(e,n);return i.parallels=function(t){return arguments.length?r(e=t[0]*jo/180,n=t[1]*jo/180):[e/jo*180,n/jo*180]},i}function Ke(t,e){function n(t,e){var n=Math.sqrt(a-2*i*Math.sin(e))/i;return[n*Math.sin(t*=i),o-n*Math.cos(t)]}var r=Math.sin(t),i=(r+Math.sin(e))/2,a=1+r*(2*i-r),o=Math.sqrt(a)/i;return n.invert=function(t,e){var n=o-e;return[Math.atan2(t,n)/i,ot((a-(t*t+n*n)*i*i)/(2*i))]},n}function Qe(){function t(t,e){qs+=i*t-r*e,r=t,i=e}var e,n,r,i;Js.point=function(a,o){Js.point=t,e=r=a,n=i=o},Js.lineEnd=function(){t(e,n)}}function Je(t,e){t<Ys&&(Ys=t),t>Ks&&(Ks=t),e<Zs&&(Zs=e),e>Qs&&(Qs=e)}function $e(){function t(t,e){o.push("M",t,",",e,a)}function e(t,e){o.push("M",t,",",e),s.point=n}function n(t,e){o.push("L",t,",",e)}function r(){s.point=t}function i(){o.push("Z")}var a=tn(4.5),o=[],s={point:t,lineStart:function(){s.point=e},lineEnd:r,polygonStart:function(){s.lineEnd=i},polygonEnd:function(){s.lineEnd=r,s.point=t},pointRadius:function(t){return a=tn(t),s},result:function(){if(o.length){var t=o.join("");return o=[],t}}};return s}function tn(t){return"m0,"+t+"a"+t+","+t+" 0 1,1 0,"+-2*t+"a"+t+","+t+" 0 1,1 0,"+2*t+"z"}function en(t,e){Us+=t,Bs+=e,++Is}function nn(){function t(t,r){var i=t-e,a=r-n,o=Math.sqrt(i*i+a*a);Os+=o*(e+t)/2,Fs+=o*(n+r)/2,Vs+=o,en(e=t,n=r)}var e,n;tc.point=function(r,i){tc.point=t,en(e=r,n=i)}}function rn(){tc.point=en}function an(){function t(t,e){var n=t-r,a=e-i,o=Math.sqrt(n*n+a*a);Os+=o*(r+t)/2,Fs+=o*(i+e)/2,Vs+=o,o=i*t-r*e,Gs+=o*(r+t),ks+=o*(i+e),zs+=3*o,en(r=t,i=e)}var e,n,r,i;tc.point=function(a,o){tc.point=t,en(e=r=a,n=i=o)},tc.lineEnd=function(){t(e,n)}}function on(t){function e(e,n){t.moveTo(e+o,n),t.arc(e,n,o,0,Wo)}function n(e,n){t.moveTo(e,n),s.point=r}function r(e,n){t.lineTo(e,n)}function i(){s.point=e}function a(){t.closePath()}var o=4.5,s={point:e,lineStart:function(){s.point=n},lineEnd:i,polygonStart:function(){s.lineEnd=a},polygonEnd:function(){s.lineEnd=i,s.point=e},pointRadius:function(t){return o=t,s},result:T};return s}function sn(t){function e(t){return(s?r:n)(t)}function n(e){return ln(e,function(n,r){n=t(n,r),e.point(n[0],n[1])})}function r(e){function n(n,r){n=t(n,r),e.point(n[0],n[1])}function r(){x=NaN,S.point=a,e.lineStart()}function a(n,r){var a=be([n,r]),o=t(n,r);i(x,b,y,M,_,w,x=o[0],b=o[1],y=n,M=a[0],_=a[1],w=a[2],s,e),e.point(x,b)}function o(){S.point=n,e.lineEnd()}function c(){r(),S.point=u,S.lineEnd=l}function u(t,e){a(h=t,f=e),p=x,d=b,m=M,g=_,v=w,S.point=a}function l(){i(x,b,y,M,_,w,p,d,h,m,g,v,s,e),S.lineEnd=o,o()}var h,f,p,d,m,g,v,y,x,b,M,_,w,S={point:n,lineStart:r,lineEnd:o,polygonStart:function(){e.polygonStart(),S.lineStart=c},polygonEnd:function(){e.polygonEnd(),S.lineStart=r}};return S}function i(e,n,r,s,c,u,l,h,f,p,d,m,g,v){var y=l-e,x=h-n,b=y*y+x*x;if(b>4*a&&g--){var M=s+p,_=c+d,w=u+m,S=Math.sqrt(M*M+_*_+w*w),E=Math.asin(w/=S),T=Eo(Eo(w)-1)<zo||Eo(r-f)<zo?(r+f)/2:Math.atan2(_,M),A=t(T,E),L=A[0],C=A[1],R=L-e,P=C-n,D=x*R-y*P;(D*D/b>a||Eo((y*R+x*P)/b-.5)>.3||s*p+c*d+u*m<o)&&(i(e,n,r,s,c,u,L,C,T,M/=S,_/=S,w,g,v),v.point(L,C),i(L,C,T,M,_,w,l,h,f,p,d,m,g,v))}}var a=.5,o=Math.cos(30*Yo),s=16;return e.precision=function(t){return arguments.length?(s=(a=t*t)>0&&16,e):Math.sqrt(a)},e}function cn(t){var e=sn(function(e,n){return t([e*Zo,n*Zo])});return function(t){return pn(e(t))}}function un(t){this.stream=t}function ln(t,e){return{point:e,sphere:function(){t.sphere()},lineStart:function(){t.lineStart()},lineEnd:function(){t.lineEnd()},polygonStart:function(){t.polygonStart()},polygonEnd:function(){t.polygonEnd()}}}function hn(t){return fn(function(){return t})()}function fn(t){function e(t){return t=s(t[0]*Yo,t[1]*Yo),[t[0]*f+c,u-t[1]*f]}function n(t){return t=s.invert((t[0]-c)/f,(u-t[1])/f),t&&[t[0]*Zo,t[1]*Zo]}function r(){s=Ne(o=gn(v,y,x),a);var t=a(m,g);return c=p-t[0]*f,u=d+t[1]*f,i()}function i(){return l&&(l.valid=!1,l=null),e}var a,o,s,c,u,l,h=sn(function(t,e){return t=a(t,e),[t[0]*f+c,u-t[1]*f]}),f=150,p=480,d=250,m=0,g=0,v=0,y=0,x=0,b=js,M=w,_=null,S=null;return e.stream=function(t){return l&&(l.valid=!1),l=pn(b(o,h(M(t)))),l.valid=!0,l},e.clipAngle=function(t){return arguments.length?(b=null==t?(_=t,js):Xe((_=+t)*Yo),i()):_},e.clipExtent=function(t){return arguments.length?(S=t,M=t?Ye(t[0][0],t[0][1],t[1][0],t[1][1]):w,i()):S},e.scale=function(t){return arguments.length?(f=+t,r()):f},e.translate=function(t){return arguments.length?(p=+t[0],d=+t[1],r()):[p,d]},e.center=function(t){return arguments.length?(m=t[0]%360*Yo,g=t[1]%360*Yo,r()):[m*Zo,g*Zo]},e.rotate=function(t){return arguments.length?(v=t[0]%360*Yo,y=t[1]%360*Yo,x=t.length>2?t[2]%360*Yo:0,r()):[v*Zo,y*Zo,x*Zo]},fo.rebind(e,h,"precision"),function(){return a=t.apply(this,arguments),e.invert=a.invert&&n,r()}}function pn(t){return ln(t,function(e,n){t.point(e*Yo,n*Yo)})}function dn(t,e){return[t,e]}function mn(t,e){return[t>jo?t-Wo:t<-jo?t+Wo:t,e]}function gn(t,e,n){return t?e||n?Ne(yn(t),xn(e,n)):yn(t):e||n?xn(e,n):mn}function vn(t){return function(e,n){return e+=t,[e>jo?e-Wo:e<-jo?e+Wo:e,n]}}function yn(t){var e=vn(t);return e.invert=vn(-t),e}function xn(t,e){function n(t,e){var n=Math.cos(e),s=Math.cos(t)*n,c=Math.sin(t)*n,u=Math.sin(e),l=u*r+s*i;return[Math.atan2(c*a-l*o,s*r-u*i),ot(l*a+c*o)]}var r=Math.cos(t),i=Math.sin(t),a=Math.cos(e),o=Math.sin(e);return n.invert=function(t,e){var n=Math.cos(e),s=Math.cos(t)*n,c=Math.sin(t)*n,u=Math.sin(e),l=u*a-c*o;return[Math.atan2(c*a+u*o,s*r+l*i),ot(l*r-s*i)]},n}function bn(t,e){var n=Math.cos(t),r=Math.sin(t);return function(i,a,o,s){var c=o*e;null!=i?(i=Mn(n,i),a=Mn(n,a),(o>0?i<a:i>a)&&(i+=o*Wo)):(i=t+o*Wo,a=t-.5*c);for(var u,l=i;o>0?l>a:l<a;l-=c)s.point((u=Te([n,-r*Math.cos(l),-r*Math.sin(l)]))[0],u[1])}}function Mn(t,e){var n=be(e);n[0]-=t,Ee(n);var r=at(-n[1]);return((-n[2]<0?-r:r)+2*Math.PI-zo)%(2*Math.PI)}function _n(t,e,n){var r=fo.range(t,e-zo,n).concat(e);return function(t){return r.map(function(e){return[t,e]})}}function wn(t,e,n){var r=fo.range(t,e-zo,n).concat(e);return function(t){return r.map(function(e){return[e,t]})}}function Sn(t){return t.source}function En(t){return t.target}function Tn(t,e,n,r){var i=Math.cos(e),a=Math.sin(e),o=Math.cos(r),s=Math.sin(r),c=i*Math.cos(t),u=i*Math.sin(t),l=o*Math.cos(n),h=o*Math.sin(n),f=2*Math.asin(Math.sqrt(lt(r-e)+i*o*lt(n-t))),p=1/Math.sin(f),d=f?function(t){var e=Math.sin(t*=f)*p,n=Math.sin(f-t)*p,r=n*c+e*l,i=n*u+e*h,o=n*a+e*s;return[Math.atan2(i,r)*Zo,Math.atan2(o,Math.sqrt(r*r+i*i))*Zo]}:function(){return[t*Zo,e*Zo]};return d.distance=f,d}function An(){function t(t,i){var a=Math.sin(i*=Yo),o=Math.cos(i),s=Eo((t*=Yo)-e),c=Math.cos(s);ec+=Math.atan2(Math.sqrt((s=o*Math.sin(s))*s+(s=r*a-n*o*c)*s),n*a+r*o*c),e=t,n=a,r=o}var e,n,r;nc.point=function(i,a){e=i*Yo,n=Math.sin(a*=Yo),r=Math.cos(a),nc.point=t},nc.lineEnd=function(){nc.point=nc.lineEnd=T}}function Ln(t,e){function n(e,n){var r=Math.cos(e),i=Math.cos(n),a=t(r*i);return[a*i*Math.sin(e),a*Math.sin(n)]}return n.invert=function(t,n){var r=Math.sqrt(t*t+n*n),i=e(r),a=Math.sin(i),o=Math.cos(i);return[Math.atan2(t*a,r*o),Math.asin(r&&n*a/r)]},n}function Cn(t,e){function n(t,e){o>0?e<-qo+zo&&(e=-qo+zo):e>qo-zo&&(e=qo-zo);var n=o/Math.pow(i(e),a);return[n*Math.sin(a*t),o-n*Math.cos(a*t)]}var r=Math.cos(t),i=function(t){return Math.tan(jo/4+t/2)},a=t===e?Math.sin(t):Math.log(r/Math.cos(e))/Math.log(i(e)/i(t)),o=r*Math.pow(i(t),a)/a;return a?(n.invert=function(t,e){var n=o-e,r=rt(a)*Math.sqrt(t*t+n*n);return[Math.atan2(t,n)/a,2*Math.atan(Math.pow(o/r,1/a))-qo]},n):Pn}function Rn(t,e){function n(t,e){var n=a-e;return[n*Math.sin(i*t),a-n*Math.cos(i*t)]}var r=Math.cos(t),i=t===e?Math.sin(t):(r-Math.cos(e))/(e-t),a=r/i+t;return Eo(i)<zo?dn:(n.invert=function(t,e){var n=a-e;return[Math.atan2(t,n)/i,a-rt(i)*Math.sqrt(t*t+n*n)]},n)}function Pn(t,e){return[t,Math.log(Math.tan(jo/4+e/2))]}function Dn(t){var e,n=hn(t),r=n.scale,i=n.translate,a=n.clipExtent;return n.scale=function(){var t=r.apply(n,arguments);return t===n?e?n.clipExtent(null):n:t},n.translate=function(){var t=i.apply(n,arguments);return t===n?e?n.clipExtent(null):n:t},n.clipExtent=function(t){var o=a.apply(n,arguments);if(o===n){if(e=null==t){var s=jo*r(),c=i();a([[c[0]-s,c[1]-s],[c[0]+s,c[1]+s]])}}else e&&(o=null);return o},n.clipExtent(null)}function Nn(t,e){return[Math.log(Math.tan(jo/4+e/2)),-t]}function Un(t){return t[0]}function Bn(t){return t[1]}function In(t){for(var e=t.length,n=[0,1],r=2,i=2;i<e;i++){for(;r>1&&it(t[n[r-2]],t[n[r-1]],t[i])<=0;)--r;n[r++]=i}return n.slice(0,r)}function On(t,e){return t[0]-e[0]||t[1]-e[1]}function Fn(t,e,n){return(n[0]-e[0])*(t[1]-e[1])<(n[1]-e[1])*(t[0]-e[0])}function Vn(t,e,n,r){var i=t[0],a=n[0],o=e[0]-i,s=r[0]-a,c=t[1],u=n[1],l=e[1]-c,h=r[1]-u,f=(s*(c-u)-h*(i-a))/(h*o-s*l);return[i+f*o,c+f*l]}function Gn(t){var e=t[0],n=t[t.length-1];return!(e[0]-n[0]||e[1]-n[1])}function kn(){cr(this),this.edge=this.site=this.circle=null}function zn(t){var e=dc.pop()||new kn;return e.site=t,e}function Hn(t){$n(t),hc.remove(t),dc.push(t),cr(t)}function jn(t){var e=t.circle,n=e.x,r=e.cy,i={x:n,y:r},a=t.P,o=t.N,s=[t];Hn(t);for(var c=a;c.circle&&Eo(n-c.circle.x)<zo&&Eo(r-c.circle.cy)<zo;)a=c.P,s.unshift(c),Hn(c),c=a;s.unshift(c),$n(c);for(var u=o;u.circle&&Eo(n-u.circle.x)<zo&&Eo(r-u.circle.cy)<zo;)o=u.N,s.push(u),Hn(u),u=o;s.push(u),$n(u);var l,h=s.length;for(l=1;l<h;++l)u=s[l],c=s[l-1],ar(u.edge,c.site,u.site,i);c=s[0],u=s[h-1],u.edge=rr(c.site,u.site,null,i),Jn(c),Jn(u)}function Wn(t){for(var e,n,r,i,a=t.x,o=t.y,s=hc._;s;)if(r=Xn(s,o)-a,r>zo)s=s.L;else{if(i=a-qn(s,o),!(i>zo)){r>-zo?(e=s.P,n=s):i>-zo?(e=s,n=s.N):e=n=s;break}if(!s.R){e=s;break}s=s.R}var c=zn(t);if(hc.insert(e,c),e||n){if(e===n)return $n(e),n=zn(e.site),hc.insert(c,n),c.edge=n.edge=rr(e.site,c.site),Jn(e),void Jn(n);if(!n)return void(c.edge=rr(e.site,c.site));$n(e),$n(n);var u=e.site,l=u.x,h=u.y,f=t.x-l,p=t.y-h,d=n.site,m=d.x-l,g=d.y-h,v=2*(f*g-p*m),y=f*f+p*p,x=m*m+g*g,b={x:(g*y-p*x)/v+l,y:(f*x-m*y)/v+h};ar(n.edge,u,d,b),c.edge=rr(u,t,null,b),n.edge=rr(t,d,null,b),Jn(e),Jn(n)}}function Xn(t,e){var n=t.site,r=n.x,i=n.y,a=i-e;if(!a)return r;var o=t.P;if(!o)return-(1/0);n=o.site;var s=n.x,c=n.y,u=c-e;if(!u)return s;var l=s-r,h=1/a-1/u,f=l/u;return h?(-f+Math.sqrt(f*f-2*h*(l*l/(-2*u)-c+u/2+i-a/2)))/h+r:(r+s)/2}function qn(t,e){var n=t.N;if(n)return Xn(n,e);var r=t.site;return r.y===e?r.x:1/0}function Yn(t){this.site=t,this.edges=[]}function Zn(t){for(var e,n,r,i,a,o,s,c,u,l,h=t[0][0],f=t[1][0],p=t[0][1],d=t[1][1],m=lc,g=m.length;g--;)if(a=m[g],a&&a.prepare())for(s=a.edges,c=s.length,o=0;o<c;)l=s[o].end(),r=l.x,i=l.y,u=s[++o%c].start(),e=u.x,n=u.y,(Eo(r-e)>zo||Eo(i-n)>zo)&&(s.splice(o,0,new or(ir(a.site,l,Eo(r-h)<zo&&d-i>zo?{x:h,y:Eo(e-h)<zo?n:d}:Eo(i-d)<zo&&f-r>zo?{x:Eo(n-d)<zo?e:f,y:d}:Eo(r-f)<zo&&i-p>zo?{x:f,y:Eo(e-f)<zo?n:p}:Eo(i-p)<zo&&r-h>zo?{x:Eo(n-p)<zo?e:h,y:p}:null),a.site,null)),++c)}function Kn(t,e){return e.angle-t.angle}function Qn(){cr(this),this.x=this.y=this.arc=this.site=this.cy=null}function Jn(t){var e=t.P,n=t.N;if(e&&n){var r=e.site,i=t.site,a=n.site;if(r!==a){var o=i.x,s=i.y,c=r.x-o,u=r.y-s,l=a.x-o,h=a.y-s,f=2*(c*h-u*l);if(!(f>=-Ho)){var p=c*c+u*u,d=l*l+h*h,m=(h*p-u*d)/f,g=(c*d-l*p)/f,h=g+s,v=mc.pop()||new Qn;v.arc=t,v.site=i,v.x=m+o,v.y=h+Math.sqrt(m*m+g*g),v.cy=h,t.circle=v;for(var y=null,x=pc._;x;)if(v.y<x.y||v.y===x.y&&v.x<=x.x){if(!x.L){y=x.P;break}x=x.L}else{if(!x.R){y=x;break}x=x.R}pc.insert(y,v),y||(fc=v)}}}}function $n(t){var e=t.circle;e&&(e.P||(fc=e.N),pc.remove(e),mc.push(e),cr(e),t.circle=null)}function tr(t){for(var e,n=uc,r=qe(t[0][0],t[0][1],t[1][0],t[1][1]),i=n.length;i--;)e=n[i],(!er(e,t)||!r(e)||Eo(e.a.x-e.b.x)<zo&&Eo(e.a.y-e.b.y)<zo)&&(e.a=e.b=null,n.splice(i,1))}function er(t,e){var n=t.b;if(n)return!0;var r,i,a=t.a,o=e[0][0],s=e[1][0],c=e[0][1],u=e[1][1],l=t.l,h=t.r,f=l.x,p=l.y,d=h.x,m=h.y,g=(f+d)/2,v=(p+m)/2;if(m===p){if(g<o||g>=s)return;if(f>d){if(a){if(a.y>=u)return}else a={x:g,y:c};n={x:g,y:u}}else{if(a){if(a.y<c)return}else a={x:g,y:u};n={x:g,y:c}}}else if(r=(f-d)/(m-p),i=v-r*g,r<-1||r>1)if(f>d){if(a){if(a.y>=u)return}else a={x:(c-i)/r,y:c};n={x:(u-i)/r,y:u}}else{if(a){if(a.y<c)return}else a={x:(u-i)/r,y:u};n={x:(c-i)/r,y:c}}else if(p<m){if(a){if(a.x>=s)return}else a={x:o,y:r*o+i};n={x:s,y:r*s+i}}else{if(a){if(a.x<o)return}else a={x:s,y:r*s+i};n={x:o,y:r*o+i}}return t.a=a,t.b=n,!0}function nr(t,e){this.l=t,this.r=e,this.a=this.b=null}function rr(t,e,n,r){var i=new nr(t,e);return uc.push(i),n&&ar(i,t,e,n),r&&ar(i,e,t,r),lc[t.i].edges.push(new or(i,t,e)),lc[e.i].edges.push(new or(i,e,t)),i}function ir(t,e,n){var r=new nr(t,null);return r.a=e,r.b=n,uc.push(r),r}function ar(t,e,n,r){t.a||t.b?t.l===n?t.b=r:t.a=r:(t.a=r,t.l=e,t.r=n)}function or(t,e,n){var r=t.a,i=t.b;this.edge=t,this.site=e,this.angle=n?Math.atan2(n.y-e.y,n.x-e.x):t.l===e?Math.atan2(i.x-r.x,r.y-i.y):Math.atan2(r.x-i.x,i.y-r.y)}function sr(){this._=null}function cr(t){t.U=t.C=t.L=t.R=t.P=t.N=null}function ur(t,e){var n=e,r=e.R,i=n.U;i?i.L===n?i.L=r:i.R=r:t._=r,r.U=i,n.U=r,n.R=r.L,n.R&&(n.R.U=n),r.L=n}function lr(t,e){var n=e,r=e.L,i=n.U;i?i.L===n?i.L=r:i.R=r:t._=r,r.U=i,n.U=r,n.L=r.R,n.L&&(n.L.U=n),r.R=n}function hr(t){for(;t.L;)t=t.L;return t}function fr(t,e){var n,r,i,a=t.sort(pr).pop();for(uc=[],lc=new Array(t.length),hc=new sr,pc=new sr;;)if(i=fc,a&&(!i||a.y<i.y||a.y===i.y&&a.x<i.x))a.x===n&&a.y===r||(lc[a.i]=new Yn(a),Wn(a),n=a.x,r=a.y),a=t.pop();else{if(!i)break;jn(i.arc)}e&&(tr(e),Zn(e));var o={cells:lc,edges:uc};return hc=pc=uc=lc=null,o}function pr(t,e){return e.y-t.y||e.x-t.x}function dr(t,e,n){return(t.x-n.x)*(e.y-t.y)-(t.x-e.x)*(n.y-t.y)}function mr(t){return t.x}function gr(t){return t.y}function vr(){return{leaf:!0,nodes:[],point:null,x:null,y:null}}function yr(t,e,n,r,i,a){if(!t(e,n,r,i,a)){var o=.5*(n+i),s=.5*(r+a),c=e.nodes;c[0]&&yr(t,c[0],n,r,o,s),c[1]&&yr(t,c[1],o,r,i,s),c[2]&&yr(t,c[2],n,s,o,a),c[3]&&yr(t,c[3],o,s,i,a)}}function xr(t,e,n,r,i,a,o){var s,c=1/0;return function u(t,l,h,f,p){if(!(l>a||h>o||f<r||p<i)){if(d=t.point){var d,m=e-t.x,g=n-t.y,v=m*m+g*g;if(v<c){var y=Math.sqrt(c=v);r=e-y,i=n-y,a=e+y,o=n+y,s=d}}for(var x=t.nodes,b=.5*(l+f),M=.5*(h+p),_=e>=b,w=n>=M,S=w<<1|_,E=S+4;S<E;++S)if(t=x[3&S])switch(3&S){case 0:u(t,l,h,b,M);break;case 1:u(t,b,h,f,M);break;case 2:u(t,l,M,b,p);break;case 3:u(t,b,M,f,p)}}}(t,r,i,a,o),s}function br(t,e){t=fo.rgb(t),e=fo.rgb(e);var n=t.r,r=t.g,i=t.b,a=e.r-n,o=e.g-r,s=e.b-i;return function(t){return"#"+Et(Math.round(n+a*t))+Et(Math.round(r+o*t))+Et(Math.round(i+s*t))}}function Mr(t,e){var n,r={},i={};for(n in t)n in e?r[n]=Sr(t[n],e[n]):i[n]=t[n];for(n in e)n in t||(i[n]=e[n]);return function(t){for(n in r)i[n]=r[n](t);return i}}function _r(t,e){return t=+t,e=+e,function(n){return t*(1-n)+e*n}}function wr(t,e){var n,r,i,a=vc.lastIndex=yc.lastIndex=0,o=-1,s=[],c=[];for(t+="",e+="";(n=vc.exec(t))&&(r=yc.exec(e));)(i=r.index)>a&&(i=e.slice(a,i),s[o]?s[o]+=i:s[++o]=i),(n=n[0])===(r=r[0])?s[o]?s[o]+=r:s[++o]=r:(s[++o]=null,c.push({i:o,x:_r(n,r)})),a=yc.lastIndex;return a<e.length&&(i=e.slice(a),s[o]?s[o]+=i:s[++o]=i),s.length<2?c[0]?(e=c[0].x,function(t){return e(t)+""}):function(){return e}:(e=c.length,function(t){for(var n,r=0;r<e;++r)s[(n=c[r]).i]=n.x(t);return s.join("")})}function Sr(t,e){for(var n,r=fo.interpolators.length;--r>=0&&!(n=fo.interpolators[r](t,e)););return n}function Er(t,e){var n,r=[],i=[],a=t.length,o=e.length,s=Math.min(t.length,e.length);for(n=0;n<s;++n)r.push(Sr(t[n],e[n]));for(;n<a;++n)i[n]=t[n];for(;n<o;++n)i[n]=e[n];return function(t){for(n=0;n<s;++n)i[n]=r[n](t);return i}}function Tr(t){return function(e){return e<=0?0:e>=1?1:t(e)}}function Ar(t){return function(e){return 1-t(1-e)}}function Lr(t){return function(e){return.5*(e<.5?t(2*e):2-t(2-2*e))}}function Cr(t){return t*t}function Rr(t){return t*t*t}function Pr(t){if(t<=0)return 0;if(t>=1)return 1;var e=t*t,n=e*t;return 4*(t<.5?n:3*(t-e)+n-.75)}function Dr(t){return function(e){return Math.pow(e,t)}}function Nr(t){return 1-Math.cos(t*qo)}function Ur(t){return Math.pow(2,10*(t-1))}function Br(t){return 1-Math.sqrt(1-t*t)}function Ir(t,e){var n;return arguments.length<2&&(e=.45),arguments.length?n=e/Wo*Math.asin(1/t):(t=1,n=e/4),function(r){return 1+t*Math.pow(2,-10*r)*Math.sin((r-n)*Wo/e)}}function Or(t){return t||(t=1.70158),function(e){return e*e*((t+1)*e-t)}}function Fr(t){return t<1/2.75?7.5625*t*t:t<2/2.75?7.5625*(t-=1.5/2.75)*t+.75:t<2.5/2.75?7.5625*(t-=2.25/2.75)*t+.9375:7.5625*(t-=2.625/2.75)*t+.984375}function Vr(t,e){t=fo.hcl(t),e=fo.hcl(e);var n=t.h,r=t.c,i=t.l,a=e.h-n,o=e.c-r,s=e.l-i;return isNaN(o)&&(o=0,r=isNaN(r)?e.c:r),isNaN(a)?(a=0,n=isNaN(n)?e.h:n):a>180?a-=360:a<-180&&(a+=360),function(t){return mt(n+a*t,r+o*t,i+s*t)+""}}function Gr(t,e){t=fo.hsl(t),e=fo.hsl(e);var n=t.h,r=t.s,i=t.l,a=e.h-n,o=e.s-r,s=e.l-i;return isNaN(o)&&(o=0,r=isNaN(r)?e.s:r),isNaN(a)?(a=0,n=isNaN(n)?e.h:n):a>180?a-=360:a<-180&&(a+=360),function(t){return pt(n+a*t,r+o*t,i+s*t)+""}}function kr(t,e){t=fo.lab(t),e=fo.lab(e);var n=t.l,r=t.a,i=t.b,a=e.l-n,o=e.a-r,s=e.b-i;return function(t){return vt(n+a*t,r+o*t,i+s*t)+""}}function zr(t,e){return e-=t,function(n){return Math.round(t+e*n)}}function Hr(t){var e=[t.a,t.b],n=[t.c,t.d],r=Wr(e),i=jr(e,n),a=Wr(Xr(n,e,-i))||0;e[0]*n[1]<n[0]*e[1]&&(e[0]*=-1,e[1]*=-1,r*=-1,i*=-1),this.rotate=(r?Math.atan2(e[1],e[0]):Math.atan2(-n[0],n[1]))*Zo,this.translate=[t.e,t.f],this.scale=[r,a],this.skew=a?Math.atan2(i,a)*Zo:0}function jr(t,e){return t[0]*e[0]+t[1]*e[1]}function Wr(t){var e=Math.sqrt(jr(t,t));return e&&(t[0]/=e,t[1]/=e),e}function Xr(t,e,n){return t[0]+=n*e[0],t[1]+=n*e[1],t}function qr(t){return t.length?t.pop()+",":""}function Yr(t,e,n,r){if(t[0]!==e[0]||t[1]!==e[1]){var i=n.push("translate(",null,",",null,")");r.push({i:i-4,x:_r(t[0],e[0])},{i:i-2,x:_r(t[1],e[1])})}else(e[0]||e[1])&&n.push("translate("+e+")")}function Zr(t,e,n,r){t!==e?(t-e>180?e+=360:e-t>180&&(t+=360),r.push({i:n.push(qr(n)+"rotate(",null,")")-2,x:_r(t,e)})):e&&n.push(qr(n)+"rotate("+e+")");
-}function Kr(t,e,n,r){t!==e?r.push({i:n.push(qr(n)+"skewX(",null,")")-2,x:_r(t,e)}):e&&n.push(qr(n)+"skewX("+e+")")}function Qr(t,e,n,r){if(t[0]!==e[0]||t[1]!==e[1]){var i=n.push(qr(n)+"scale(",null,",",null,")");r.push({i:i-4,x:_r(t[0],e[0])},{i:i-2,x:_r(t[1],e[1])})}else 1===e[0]&&1===e[1]||n.push(qr(n)+"scale("+e+")")}function Jr(t,e){var n=[],r=[];return t=fo.transform(t),e=fo.transform(e),Yr(t.translate,e.translate,n,r),Zr(t.rotate,e.rotate,n,r),Kr(t.skew,e.skew,n,r),Qr(t.scale,e.scale,n,r),t=e=null,function(t){for(var e,i=-1,a=r.length;++i<a;)n[(e=r[i]).i]=e.x(t);return n.join("")}}function $r(t,e){return e=(e-=t=+t)||1/e,function(n){return(n-t)/e}}function ti(t,e){return e=(e-=t=+t)||1/e,function(n){return Math.max(0,Math.min(1,(n-t)/e))}}function ei(t){for(var e=t.source,n=t.target,r=ri(e,n),i=[e];e!==r;)e=e.parent,i.push(e);for(var a=i.length;n!==r;)i.splice(a,0,n),n=n.parent;return i}function ni(t){for(var e=[],n=t.parent;null!=n;)e.push(t),t=n,n=n.parent;return e.push(t),e}function ri(t,e){if(t===e)return t;for(var n=ni(t),r=ni(e),i=n.pop(),a=r.pop(),o=null;i===a;)o=i,i=n.pop(),a=r.pop();return o}function ii(t){t.fixed|=2}function ai(t){t.fixed&=-7}function oi(t){t.fixed|=4,t.px=t.x,t.py=t.y}function si(t){t.fixed&=-5}function ci(t,e,n){var r=0,i=0;if(t.charge=0,!t.leaf)for(var a,o=t.nodes,s=o.length,c=-1;++c<s;)a=o[c],null!=a&&(ci(a,e,n),t.charge+=a.charge,r+=a.charge*a.cx,i+=a.charge*a.cy);if(t.point){t.leaf||(t.point.x+=Math.random()-.5,t.point.y+=Math.random()-.5);var u=e*n[t.point.index];t.charge+=t.pointCharge=u,r+=u*t.point.x,i+=u*t.point.y}t.cx=r/t.charge,t.cy=i/t.charge}function ui(t,e){return fo.rebind(t,e,"sort","children","value"),t.nodes=t,t.links=mi,t}function li(t,e){for(var n=[t];null!=(t=n.pop());)if(e(t),(i=t.children)&&(r=i.length))for(var r,i;--r>=0;)n.push(i[r])}function hi(t,e){for(var n=[t],r=[];null!=(t=n.pop());)if(r.push(t),(a=t.children)&&(i=a.length))for(var i,a,o=-1;++o<i;)n.push(a[o]);for(;null!=(t=r.pop());)e(t)}function fi(t){return t.children}function pi(t){return t.value}function di(t,e){return e.value-t.value}function mi(t){return fo.merge(t.map(function(t){return(t.children||[]).map(function(e){return{source:t,target:e}})}))}function gi(t){return t.x}function vi(t){return t.y}function yi(t,e,n){t.y0=e,t.y=n}function xi(t){return fo.range(t.length)}function bi(t){for(var e=-1,n=t[0].length,r=[];++e<n;)r[e]=0;return r}function Mi(t){for(var e,n=1,r=0,i=t[0][1],a=t.length;n<a;++n)(e=t[n][1])>i&&(r=n,i=e);return r}function _i(t){return t.reduce(wi,0)}function wi(t,e){return t+e[1]}function Si(t,e){return Ei(t,Math.ceil(Math.log(e.length)/Math.LN2+1))}function Ei(t,e){for(var n=-1,r=+t[0],i=(t[1]-r)/e,a=[];++n<=e;)a[n]=i*n+r;return a}function Ti(t){return[fo.min(t),fo.max(t)]}function Ai(t,e){return t.value-e.value}function Li(t,e){var n=t._pack_next;t._pack_next=e,e._pack_prev=t,e._pack_next=n,n._pack_prev=e}function Ci(t,e){t._pack_next=e,e._pack_prev=t}function Ri(t,e){var n=e.x-t.x,r=e.y-t.y,i=t.r+e.r;return.999*i*i>n*n+r*r}function Pi(t){function e(t){l=Math.min(t.x-t.r,l),h=Math.max(t.x+t.r,h),f=Math.min(t.y-t.r,f),p=Math.max(t.y+t.r,p)}if((n=t.children)&&(u=n.length)){var n,r,i,a,o,s,c,u,l=1/0,h=-(1/0),f=1/0,p=-(1/0);if(n.forEach(Di),r=n[0],r.x=-r.r,r.y=0,e(r),u>1&&(i=n[1],i.x=i.r,i.y=0,e(i),u>2))for(a=n[2],Bi(r,i,a),e(a),Li(r,a),r._pack_prev=a,Li(a,i),i=r._pack_next,o=3;o<u;o++){Bi(r,i,a=n[o]);var d=0,m=1,g=1;for(s=i._pack_next;s!==i;s=s._pack_next,m++)if(Ri(s,a)){d=1;break}if(1==d)for(c=r._pack_prev;c!==s._pack_prev&&!Ri(c,a);c=c._pack_prev,g++);d?(m<g||m==g&&i.r<r.r?Ci(r,i=s):Ci(r=c,i),o--):(Li(r,a),i=a,e(a))}var v=(l+h)/2,y=(f+p)/2,x=0;for(o=0;o<u;o++)a=n[o],a.x-=v,a.y-=y,x=Math.max(x,a.r+Math.sqrt(a.x*a.x+a.y*a.y));t.r=x,n.forEach(Ni)}}function Di(t){t._pack_next=t._pack_prev=t}function Ni(t){delete t._pack_next,delete t._pack_prev}function Ui(t,e,n,r){var i=t.children;if(t.x=e+=r*t.x,t.y=n+=r*t.y,t.r*=r,i)for(var a=-1,o=i.length;++a<o;)Ui(i[a],e,n,r)}function Bi(t,e,n){var r=t.r+n.r,i=e.x-t.x,a=e.y-t.y;if(r&&(i||a)){var o=e.r+n.r,s=i*i+a*a;o*=o,r*=r;var c=.5+(r-o)/(2*s),u=Math.sqrt(Math.max(0,2*o*(r+s)-(r-=s)*r-o*o))/(2*s);n.x=t.x+c*i+u*a,n.y=t.y+c*a-u*i}else n.x=t.x+r,n.y=t.y}function Ii(t,e){return t.parent==e.parent?1:2}function Oi(t){var e=t.children;return e.length?e[0]:t.t}function Fi(t){var e,n=t.children;return(e=n.length)?n[e-1]:t.t}function Vi(t,e,n){var r=n/(e.i-t.i);e.c-=r,e.s+=n,t.c+=r,e.z+=n,e.m+=n}function Gi(t){for(var e,n=0,r=0,i=t.children,a=i.length;--a>=0;)e=i[a],e.z+=n,e.m+=n,n+=e.s+(r+=e.c)}function ki(t,e,n){return t.a.parent===e.parent?t.a:n}function zi(t){return 1+fo.max(t,function(t){return t.y})}function Hi(t){return t.reduce(function(t,e){return t+e.x},0)/t.length}function ji(t){var e=t.children;return e&&e.length?ji(e[0]):t}function Wi(t){var e,n=t.children;return n&&(e=n.length)?Wi(n[e-1]):t}function Xi(t){return{x:t.x,y:t.y,dx:t.dx,dy:t.dy}}function qi(t,e){var n=t.x+e[3],r=t.y+e[0],i=t.dx-e[1]-e[3],a=t.dy-e[0]-e[2];return i<0&&(n+=i/2,i=0),a<0&&(r+=a/2,a=0),{x:n,y:r,dx:i,dy:a}}function Yi(t){var e=t[0],n=t[t.length-1];return e<n?[e,n]:[n,e]}function Zi(t){return t.rangeExtent?t.rangeExtent():Yi(t.range())}function Ki(t,e,n,r){var i=n(t[0],t[1]),a=r(e[0],e[1]);return function(t){return a(i(t))}}function Qi(t,e){var n,r=0,i=t.length-1,a=t[r],o=t[i];return o<a&&(n=r,r=i,i=n,n=a,a=o,o=n),t[r]=e.floor(a),t[i]=e.ceil(o),t}function Ji(t){return t?{floor:function(e){return Math.floor(e/t)*t},ceil:function(e){return Math.ceil(e/t)*t}}:Cc}function $i(t,e,n,r){var i=[],a=[],o=0,s=Math.min(t.length,e.length)-1;for(t[s]<t[0]&&(t=t.slice().reverse(),e=e.slice().reverse());++o<=s;)i.push(n(t[o-1],t[o])),a.push(r(e[o-1],e[o]));return function(e){var n=fo.bisect(t,e,1,s)-1;return a[n](i[n](e))}}function ta(t,e,n,r){function i(){var i=Math.min(t.length,e.length)>2?$i:Ki,c=r?ti:$r;return o=i(t,e,c,n),s=i(e,t,c,Sr),a}function a(t){return o(t)}var o,s;return a.invert=function(t){return s(t)},a.domain=function(e){return arguments.length?(t=e.map(Number),i()):t},a.range=function(t){return arguments.length?(e=t,i()):e},a.rangeRound=function(t){return a.range(t).interpolate(zr)},a.clamp=function(t){return arguments.length?(r=t,i()):r},a.interpolate=function(t){return arguments.length?(n=t,i()):n},a.ticks=function(e){return ia(t,e)},a.tickFormat=function(e,n){return aa(t,e,n)},a.nice=function(e){return na(t,e),i()},a.copy=function(){return ta(t,e,n,r)},i()}function ea(t,e){return fo.rebind(t,e,"range","rangeRound","interpolate","clamp")}function na(t,e){return Qi(t,Ji(ra(t,e)[2])),Qi(t,Ji(ra(t,e)[2])),t}function ra(t,e){null==e&&(e=10);var n=Yi(t),r=n[1]-n[0],i=Math.pow(10,Math.floor(Math.log(r/e)/Math.LN10)),a=e/r*i;return a<=.15?i*=10:a<=.35?i*=5:a<=.75&&(i*=2),n[0]=Math.ceil(n[0]/i)*i,n[1]=Math.floor(n[1]/i)*i+.5*i,n[2]=i,n}function ia(t,e){return fo.range.apply(fo,ra(t,e))}function aa(t,e,n){var r=ra(t,e);if(n){var i=vs.exec(n);if(i.shift(),"s"===i[8]){var a=fo.formatPrefix(Math.max(Eo(r[0]),Eo(r[1])));return i[7]||(i[7]="."+oa(a.scale(r[2]))),i[8]="f",n=fo.format(i.join("")),function(t){return n(a.scale(t))+a.symbol}}i[7]||(i[7]="."+sa(i[8],r)),n=i.join("")}else n=",."+oa(r[2])+"f";return fo.format(n)}function oa(t){return-Math.floor(Math.log(t)/Math.LN10+.01)}function sa(t,e){var n=oa(e[2]);return t in Rc?Math.abs(n-oa(Math.max(Eo(e[0]),Eo(e[1]))))+ +("e"!==t):n-2*("%"===t)}function ca(t,e,n,r){function i(t){return(n?Math.log(t<0?0:t):-Math.log(t>0?0:-t))/Math.log(e)}function a(t){return n?Math.pow(e,t):-Math.pow(e,-t)}function o(e){return t(i(e))}return o.invert=function(e){return a(t.invert(e))},o.domain=function(e){return arguments.length?(n=e[0]>=0,t.domain((r=e.map(Number)).map(i)),o):r},o.base=function(n){return arguments.length?(e=+n,t.domain(r.map(i)),o):e},o.nice=function(){var e=Qi(r.map(i),n?Math:Dc);return t.domain(e),r=e.map(a),o},o.ticks=function(){var t=Yi(r),o=[],s=t[0],c=t[1],u=Math.floor(i(s)),l=Math.ceil(i(c)),h=e%1?2:e;if(isFinite(l-u)){if(n){for(;u<l;u++)for(var f=1;f<h;f++)o.push(a(u)*f);o.push(a(u))}else for(o.push(a(u));u++<l;)for(var f=h-1;f>0;f--)o.push(a(u)*f);for(u=0;o[u]<s;u++);for(l=o.length;o[l-1]>c;l--);o=o.slice(u,l)}return o},o.tickFormat=function(t,n){if(!arguments.length)return Pc;arguments.length<2?n=Pc:"function"!=typeof n&&(n=fo.format(n));var r=Math.max(1,e*t/o.ticks().length);return function(t){var o=t/a(Math.round(i(t)));return o*e<e-.5&&(o*=e),o<=r?n(t):""}},o.copy=function(){return ca(t.copy(),e,n,r)},ea(o,t)}function ua(t,e,n){function r(e){return t(i(e))}var i=la(e),a=la(1/e);return r.invert=function(e){return a(t.invert(e))},r.domain=function(e){return arguments.length?(t.domain((n=e.map(Number)).map(i)),r):n},r.ticks=function(t){return ia(n,t)},r.tickFormat=function(t,e){return aa(n,t,e)},r.nice=function(t){return r.domain(na(n,t))},r.exponent=function(o){return arguments.length?(i=la(e=o),a=la(1/e),t.domain(n.map(i)),r):e},r.copy=function(){return ua(t.copy(),e,n)},ea(r,t)}function la(t){return function(e){return e<0?-Math.pow(-e,t):Math.pow(e,t)}}function ha(t,e){function n(n){return a[((i.get(n)||("range"===e.t?i.set(n,t.push(n)):NaN))-1)%a.length]}function r(e,n){return fo.range(t.length).map(function(t){return e+n*t})}var i,a,o;return n.domain=function(r){if(!arguments.length)return t;t=[],i=new d;for(var a,o=-1,s=r.length;++o<s;)i.has(a=r[o])||i.set(a,t.push(a));return n[e.t].apply(n,e.a)},n.range=function(t){return arguments.length?(a=t,o=0,e={t:"range",a:arguments},n):a},n.rangePoints=function(i,s){arguments.length<2&&(s=0);var c=i[0],u=i[1],l=t.length<2?(c=(c+u)/2,0):(u-c)/(t.length-1+s);return a=r(c+l*s/2,l),o=0,e={t:"rangePoints",a:arguments},n},n.rangeRoundPoints=function(i,s){arguments.length<2&&(s=0);var c=i[0],u=i[1],l=t.length<2?(c=u=Math.round((c+u)/2),0):(u-c)/(t.length-1+s)|0;return a=r(c+Math.round(l*s/2+(u-c-(t.length-1+s)*l)/2),l),o=0,e={t:"rangeRoundPoints",a:arguments},n},n.rangeBands=function(i,s,c){arguments.length<2&&(s=0),arguments.length<3&&(c=s);var u=i[1]<i[0],l=i[u-0],h=i[1-u],f=(h-l)/(t.length-s+2*c);return a=r(l+f*c,f),u&&a.reverse(),o=f*(1-s),e={t:"rangeBands",a:arguments},n},n.rangeRoundBands=function(i,s,c){arguments.length<2&&(s=0),arguments.length<3&&(c=s);var u=i[1]<i[0],l=i[u-0],h=i[1-u],f=Math.floor((h-l)/(t.length-s+2*c));return a=r(l+Math.round((h-l-(t.length-s)*f)/2),f),u&&a.reverse(),o=Math.round(f*(1-s)),e={t:"rangeRoundBands",a:arguments},n},n.rangeBand=function(){return o},n.rangeExtent=function(){return Yi(e.a[0])},n.copy=function(){return ha(t,e)},n.domain(t)}function fa(t,e){function n(){var n=0,a=e.length;for(i=[];++n<a;)i[n-1]=fo.quantile(t,n/a);return r}function r(t){if(!isNaN(t=+t))return e[fo.bisect(i,t)]}var i;return r.domain=function(e){return arguments.length?(t=e.map(c).filter(u).sort(s),n()):t},r.range=function(t){return arguments.length?(e=t,n()):e},r.quantiles=function(){return i},r.invertExtent=function(n){return n=e.indexOf(n),n<0?[NaN,NaN]:[n>0?i[n-1]:t[0],n<i.length?i[n]:t[t.length-1]]},r.copy=function(){return fa(t,e)},n()}function pa(t,e,n){function r(e){return n[Math.max(0,Math.min(o,Math.floor(a*(e-t))))]}function i(){return a=n.length/(e-t),o=n.length-1,r}var a,o;return r.domain=function(n){return arguments.length?(t=+n[0],e=+n[n.length-1],i()):[t,e]},r.range=function(t){return arguments.length?(n=t,i()):n},r.invertExtent=function(e){return e=n.indexOf(e),e=e<0?NaN:e/a+t,[e,e+1/a]},r.copy=function(){return pa(t,e,n)},i()}function da(t,e){function n(n){if(n<=n)return e[fo.bisect(t,n)]}return n.domain=function(e){return arguments.length?(t=e,n):t},n.range=function(t){return arguments.length?(e=t,n):e},n.invertExtent=function(n){return n=e.indexOf(n),[t[n-1],t[n]]},n.copy=function(){return da(t,e)},n}function ma(t){function e(t){return+t}return e.invert=e,e.domain=e.range=function(n){return arguments.length?(t=n.map(e),e):t},e.ticks=function(e){return ia(t,e)},e.tickFormat=function(e,n){return aa(t,e,n)},e.copy=function(){return ma(t)},e}function ga(){return 0}function va(t){return t.innerRadius}function ya(t){return t.outerRadius}function xa(t){return t.startAngle}function ba(t){return t.endAngle}function Ma(t){return t&&t.padAngle}function _a(t,e,n,r){return(t-n)*e-(e-r)*t>0?0:1}function wa(t,e,n,r,i){var a=t[0]-e[0],o=t[1]-e[1],s=(i?r:-r)/Math.sqrt(a*a+o*o),c=s*o,u=-s*a,l=t[0]+c,h=t[1]+u,f=e[0]+c,p=e[1]+u,d=(l+f)/2,m=(h+p)/2,g=f-l,v=p-h,y=g*g+v*v,x=n-r,b=l*p-f*h,M=(v<0?-1:1)*Math.sqrt(Math.max(0,x*x*y-b*b)),_=(b*v-g*M)/y,w=(-b*g-v*M)/y,S=(b*v+g*M)/y,E=(-b*g+v*M)/y,T=_-d,A=w-m,L=S-d,C=E-m;return T*T+A*A>L*L+C*C&&(_=S,w=E),[[_-c,w-u],[_*n/x,w*n/x]]}function Sa(t){function e(e){function o(){u.push("M",a(t(l),s))}for(var c,u=[],l=[],h=-1,f=e.length,p=Pt(n),d=Pt(r);++h<f;)i.call(this,c=e[h],h)?l.push([+p.call(this,c,h),+d.call(this,c,h)]):l.length&&(o(),l=[]);return l.length&&o(),u.length?u.join(""):null}var n=Un,r=Bn,i=Ue,a=Ea,o=a.key,s=.7;return e.x=function(t){return arguments.length?(n=t,e):n},e.y=function(t){return arguments.length?(r=t,e):r},e.defined=function(t){return arguments.length?(i=t,e):i},e.interpolate=function(t){return arguments.length?(o="function"==typeof t?a=t:(a=Fc.get(t)||Ea).key,e):o},e.tension=function(t){return arguments.length?(s=t,e):s},e}function Ea(t){return t.length>1?t.join("L"):t+"Z"}function Ta(t){return t.join("L")+"Z"}function Aa(t){for(var e=0,n=t.length,r=t[0],i=[r[0],",",r[1]];++e<n;)i.push("H",(r[0]+(r=t[e])[0])/2,"V",r[1]);return n>1&&i.push("H",r[0]),i.join("")}function La(t){for(var e=0,n=t.length,r=t[0],i=[r[0],",",r[1]];++e<n;)i.push("V",(r=t[e])[1],"H",r[0]);return i.join("")}function Ca(t){for(var e=0,n=t.length,r=t[0],i=[r[0],",",r[1]];++e<n;)i.push("H",(r=t[e])[0],"V",r[1]);return i.join("")}function Ra(t,e){return t.length<4?Ea(t):t[1]+Na(t.slice(1,-1),Ua(t,e))}function Pa(t,e){return t.length<3?Ta(t):t[0]+Na((t.push(t[0]),t),Ua([t[t.length-2]].concat(t,[t[1]]),e))}function Da(t,e){return t.length<3?Ea(t):t[0]+Na(t,Ua(t,e))}function Na(t,e){if(e.length<1||t.length!=e.length&&t.length!=e.length+2)return Ea(t);var n=t.length!=e.length,r="",i=t[0],a=t[1],o=e[0],s=o,c=1;if(n&&(r+="Q"+(a[0]-2*o[0]/3)+","+(a[1]-2*o[1]/3)+","+a[0]+","+a[1],i=t[1],c=2),e.length>1){s=e[1],a=t[c],c++,r+="C"+(i[0]+o[0])+","+(i[1]+o[1])+","+(a[0]-s[0])+","+(a[1]-s[1])+","+a[0]+","+a[1];for(var u=2;u<e.length;u++,c++)a=t[c],s=e[u],r+="S"+(a[0]-s[0])+","+(a[1]-s[1])+","+a[0]+","+a[1]}if(n){var l=t[c];r+="Q"+(a[0]+2*s[0]/3)+","+(a[1]+2*s[1]/3)+","+l[0]+","+l[1]}return r}function Ua(t,e){for(var n,r=[],i=(1-e)/2,a=t[0],o=t[1],s=1,c=t.length;++s<c;)n=a,a=o,o=t[s],r.push([i*(o[0]-n[0]),i*(o[1]-n[1])]);return r}function Ba(t){if(t.length<3)return Ea(t);var e=1,n=t.length,r=t[0],i=r[0],a=r[1],o=[i,i,i,(r=t[1])[0]],s=[a,a,a,r[1]],c=[i,",",a,"L",Va(kc,o),",",Va(kc,s)];for(t.push(t[n-1]);++e<=n;)r=t[e],o.shift(),o.push(r[0]),s.shift(),s.push(r[1]),Ga(c,o,s);return t.pop(),c.push("L",r),c.join("")}function Ia(t){if(t.length<4)return Ea(t);for(var e,n=[],r=-1,i=t.length,a=[0],o=[0];++r<3;)e=t[r],a.push(e[0]),o.push(e[1]);for(n.push(Va(kc,a)+","+Va(kc,o)),--r;++r<i;)e=t[r],a.shift(),a.push(e[0]),o.shift(),o.push(e[1]),Ga(n,a,o);return n.join("")}function Oa(t){for(var e,n,r=-1,i=t.length,a=i+4,o=[],s=[];++r<4;)n=t[r%i],o.push(n[0]),s.push(n[1]);for(e=[Va(kc,o),",",Va(kc,s)],--r;++r<a;)n=t[r%i],o.shift(),o.push(n[0]),s.shift(),s.push(n[1]),Ga(e,o,s);return e.join("")}function Fa(t,e){var n=t.length-1;if(n)for(var r,i,a=t[0][0],o=t[0][1],s=t[n][0]-a,c=t[n][1]-o,u=-1;++u<=n;)r=t[u],i=u/n,r[0]=e*r[0]+(1-e)*(a+i*s),r[1]=e*r[1]+(1-e)*(o+i*c);return Ba(t)}function Va(t,e){return t[0]*e[0]+t[1]*e[1]+t[2]*e[2]+t[3]*e[3]}function Ga(t,e,n){t.push("C",Va(Vc,e),",",Va(Vc,n),",",Va(Gc,e),",",Va(Gc,n),",",Va(kc,e),",",Va(kc,n))}function ka(t,e){return(e[1]-t[1])/(e[0]-t[0])}function za(t){for(var e=0,n=t.length-1,r=[],i=t[0],a=t[1],o=r[0]=ka(i,a);++e<n;)r[e]=(o+(o=ka(i=a,a=t[e+1])))/2;return r[e]=o,r}function Ha(t){for(var e,n,r,i,a=[],o=za(t),s=-1,c=t.length-1;++s<c;)e=ka(t[s],t[s+1]),Eo(e)<zo?o[s]=o[s+1]=0:(n=o[s]/e,r=o[s+1]/e,i=n*n+r*r,i>9&&(i=3*e/Math.sqrt(i),o[s]=i*n,o[s+1]=i*r));for(s=-1;++s<=c;)i=(t[Math.min(c,s+1)][0]-t[Math.max(0,s-1)][0])/(6*(1+o[s]*o[s])),a.push([i||0,o[s]*i||0]);return a}function ja(t){return t.length<3?Ea(t):t[0]+Na(t,Ha(t))}function Wa(t){for(var e,n,r,i=-1,a=t.length;++i<a;)e=t[i],n=e[0],r=e[1]-qo,e[0]=n*Math.cos(r),e[1]=n*Math.sin(r);return t}function Xa(t){function e(e){function c(){m.push("M",s(t(v),h),l,u(t(g.reverse()),h),"Z")}for(var f,p,d,m=[],g=[],v=[],y=-1,x=e.length,b=Pt(n),M=Pt(i),_=n===r?function(){return p}:Pt(r),w=i===a?function(){return d}:Pt(a);++y<x;)o.call(this,f=e[y],y)?(g.push([p=+b.call(this,f,y),d=+M.call(this,f,y)]),v.push([+_.call(this,f,y),+w.call(this,f,y)])):g.length&&(c(),g=[],v=[]);return g.length&&c(),m.length?m.join(""):null}var n=Un,r=Un,i=0,a=Bn,o=Ue,s=Ea,c=s.key,u=s,l="L",h=.7;return e.x=function(t){return arguments.length?(n=r=t,e):r},e.x0=function(t){return arguments.length?(n=t,e):n},e.x1=function(t){return arguments.length?(r=t,e):r},e.y=function(t){return arguments.length?(i=a=t,e):a},e.y0=function(t){return arguments.length?(i=t,e):i},e.y1=function(t){return arguments.length?(a=t,e):a},e.defined=function(t){return arguments.length?(o=t,e):o},e.interpolate=function(t){return arguments.length?(c="function"==typeof t?s=t:(s=Fc.get(t)||Ea).key,u=s.reverse||s,l=s.closed?"M":"L",e):c},e.tension=function(t){return arguments.length?(h=t,e):h},e}function qa(t){return t.radius}function Ya(t){return[t.x,t.y]}function Za(t){return function(){var e=t.apply(this,arguments),n=e[0],r=e[1]-qo;return[n*Math.cos(r),n*Math.sin(r)]}}function Ka(){return 64}function Qa(){return"circle"}function Ja(t){var e=Math.sqrt(t/jo);return"M0,"+e+"A"+e+","+e+" 0 1,1 0,"+-e+"A"+e+","+e+" 0 1,1 0,"+e+"Z"}function $a(t){return function(){var e,n,r;(e=this[t])&&(r=e[n=e.active])&&(r.timer.c=null,r.timer.t=NaN,--e.count?delete e[n]:delete this[t],e.active+=.5,r.event&&r.event.interrupt.call(this,this.__data__,r.index))}}function to(t,e,n){return Ro(t,Yc),t.namespace=e,t.id=n,t}function eo(t,e,n,r){var i=t.id,a=t.namespace;return Y(t,"function"==typeof n?function(t,o,s){t[a][i].tween.set(e,r(n.call(t,t.__data__,o,s)))}:(n=r(n),function(t){t[a][i].tween.set(e,n)}))}function no(t){return null==t&&(t=""),function(){this.textContent=t}}function ro(t){return null==t?"__transition__":"__transition_"+t+"__"}function io(t,e,n,r,i){function a(t){var e=m.delay;return u.t=e+c,e<=t?o(t-e):void(u.c=o)}function o(n){var i=p.active,a=p[i];a&&(a.timer.c=null,a.timer.t=NaN,--p.count,delete p[i],a.event&&a.event.interrupt.call(t,t.__data__,a.index));for(var o in p)if(+o<r){var d=p[o];d.timer.c=null,d.timer.t=NaN,--p.count,delete p[o]}u.c=s,It(function(){return u.c&&s(n||1)&&(u.c=null,u.t=NaN),1},0,c),p.active=r,m.event&&m.event.start.call(t,t.__data__,e),f=[],m.tween.forEach(function(n,r){(r=r.call(t,t.__data__,e))&&f.push(r)}),h=m.ease,l=m.duration}function s(i){for(var a=i/l,o=h(a),s=f.length;s>0;)f[--s].call(t,o);if(a>=1)return m.event&&m.event.end.call(t,t.__data__,e),--p.count?delete p[r]:delete t[n],1}var c,u,l,h,f,p=t[n]||(t[n]={active:0,count:0}),m=p[r];m||(c=i.time,u=It(a,0,c),m=p[r]={tween:new d,time:c,timer:u,delay:i.delay,duration:i.duration,ease:i.ease,index:e},i=null,++p.count)}function ao(t,e,n){t.attr("transform",function(t){var r=e(t);return"translate("+(isFinite(r)?r:n(t))+",0)"})}function oo(t,e,n){t.attr("transform",function(t){var r=e(t);return"translate(0,"+(isFinite(r)?r:n(t))+")"})}function so(t){return t.toISOString()}function co(t,e,n){function r(e){return t(e)}function i(t,n){var r=t[1]-t[0],i=r/n,a=fo.bisect(ru,i);return a==ru.length?[e.year,ra(t.map(function(t){return t/31536e6}),n)[2]]:a?e[i/ru[a-1]<ru[a]/i?a-1:a]:[ou,ra(t,n)[2]]}return r.invert=function(e){return uo(t.invert(e))},r.domain=function(e){return arguments.length?(t.domain(e),r):t.domain().map(uo)},r.nice=function(t,e){function n(n){return!isNaN(n)&&!t.range(n,uo(+n+1),e).length}var a=r.domain(),o=Yi(a),s=null==t?i(o,10):"number"==typeof t&&i(o,t);return s&&(t=s[0],e=s[1]),r.domain(Qi(a,e>1?{floor:function(e){for(;n(e=t.floor(e));)e=uo(e-1);return e},ceil:function(e){for(;n(e=t.ceil(e));)e=uo(+e+1);return e}}:t))},r.ticks=function(t,e){var n=Yi(r.domain()),a=null==t?i(n,10):"number"==typeof t?i(n,t):!t.range&&[{range:t},e];return a&&(t=a[0],e=a[1]),t.range(n[0],uo(+n[1]+1),e<1?1:e)},r.tickFormat=function(){return n},r.copy=function(){return co(t.copy(),e,n)},ea(r,t)}function uo(t){return new Date(t)}function lo(t){return JSON.parse(t.responseText)}function ho(t){var e=go.createRange();return e.selectNode(go.body),e.createContextualFragment(t.responseText)}var fo={version:"3.5.17"},po=[].slice,mo=function(t){return po.call(t)},go=this.document;if(go)try{mo(go.documentElement.childNodes)[0].nodeType}catch(vo){mo=function(t){for(var e=t.length,n=new Array(e);e--;)n[e]=t[e];return n}}if(Date.now||(Date.now=function(){return+new Date}),go)try{go.createElement("DIV").style.setProperty("opacity",0,"")}catch(yo){var xo=this.Element.prototype,bo=xo.setAttribute,Mo=xo.setAttributeNS,_o=this.CSSStyleDeclaration.prototype,wo=_o.setProperty;xo.setAttribute=function(t,e){bo.call(this,t,e+"")},xo.setAttributeNS=function(t,e,n){Mo.call(this,t,e,n+"")},_o.setProperty=function(t,e,n){wo.call(this,t,e+"",n)}}fo.ascending=s,fo.descending=function(t,e){return e<t?-1:e>t?1:e>=t?0:NaN},fo.min=function(t,e){var n,r,i=-1,a=t.length;if(1===arguments.length){for(;++i<a;)if(null!=(r=t[i])&&r>=r){n=r;break}for(;++i<a;)null!=(r=t[i])&&n>r&&(n=r)}else{for(;++i<a;)if(null!=(r=e.call(t,t[i],i))&&r>=r){n=r;break}for(;++i<a;)null!=(r=e.call(t,t[i],i))&&n>r&&(n=r)}return n},fo.max=function(t,e){var n,r,i=-1,a=t.length;if(1===arguments.length){for(;++i<a;)if(null!=(r=t[i])&&r>=r){n=r;break}for(;++i<a;)null!=(r=t[i])&&r>n&&(n=r)}else{for(;++i<a;)if(null!=(r=e.call(t,t[i],i))&&r>=r){n=r;break}for(;++i<a;)null!=(r=e.call(t,t[i],i))&&r>n&&(n=r)}return n},fo.extent=function(t,e){var n,r,i,a=-1,o=t.length;if(1===arguments.length){for(;++a<o;)if(null!=(r=t[a])&&r>=r){n=i=r;break}for(;++a<o;)null!=(r=t[a])&&(n>r&&(n=r),i<r&&(i=r))}else{for(;++a<o;)if(null!=(r=e.call(t,t[a],a))&&r>=r){n=i=r;break}for(;++a<o;)null!=(r=e.call(t,t[a],a))&&(n>r&&(n=r),i<r&&(i=r))}return[n,i]},fo.sum=function(t,e){var n,r=0,i=t.length,a=-1;if(1===arguments.length)for(;++a<i;)u(n=+t[a])&&(r+=n);else for(;++a<i;)u(n=+e.call(t,t[a],a))&&(r+=n);return r},fo.mean=function(t,e){var n,r=0,i=t.length,a=-1,o=i;if(1===arguments.length)for(;++a<i;)u(n=c(t[a]))?r+=n:--o;else for(;++a<i;)u(n=c(e.call(t,t[a],a)))?r+=n:--o;if(o)return r/o},fo.quantile=function(t,e){var n=(t.length-1)*e+1,r=Math.floor(n),i=+t[r-1],a=n-r;return a?i+a*(t[r]-i):i},fo.median=function(t,e){var n,r=[],i=t.length,a=-1;if(1===arguments.length)for(;++a<i;)u(n=c(t[a]))&&r.push(n);else for(;++a<i;)u(n=c(e.call(t,t[a],a)))&&r.push(n);if(r.length)return fo.quantile(r.sort(s),.5)},fo.variance=function(t,e){var n,r,i=t.length,a=0,o=0,s=-1,l=0;if(1===arguments.length)for(;++s<i;)u(n=c(t[s]))&&(r=n-a,a+=r/++l,o+=r*(n-a));else for(;++s<i;)u(n=c(e.call(t,t[s],s)))&&(r=n-a,a+=r/++l,o+=r*(n-a));if(l>1)return o/(l-1)},fo.deviation=function(){var t=fo.variance.apply(this,arguments);return t?Math.sqrt(t):t};var So=l(s);fo.bisectLeft=So.left,fo.bisect=fo.bisectRight=So.right,fo.bisector=function(t){return l(1===t.length?function(e,n){return s(t(e),n)}:t)},fo.shuffle=function(t,e,n){(a=arguments.length)<3&&(n=t.length,a<2&&(e=0));for(var r,i,a=n-e;a;)i=Math.random()*a--|0,r=t[a+e],t[a+e]=t[i+e],t[i+e]=r;return t},fo.permute=function(t,e){for(var n=e.length,r=new Array(n);n--;)r[n]=t[e[n]];return r},fo.pairs=function(t){for(var e,n=0,r=t.length-1,i=t[0],a=new Array(r<0?0:r);n<r;)a[n]=[e=i,i=t[++n]];return a},fo.transpose=function(t){if(!(i=t.length))return[];for(var e=-1,n=fo.min(t,h),r=new Array(n);++e<n;)for(var i,a=-1,o=r[e]=new Array(i);++a<i;)o[a]=t[a][e];return r},fo.zip=function(){return fo.transpose(arguments)},fo.keys=function(t){var e=[];for(var n in t)e.push(n);return e},fo.values=function(t){var e=[];for(var n in t)e.push(t[n]);return e},fo.entries=function(t){var e=[];for(var n in t)e.push({key:n,value:t[n]});return e},fo.merge=function(t){for(var e,n,r,i=t.length,a=-1,o=0;++a<i;)o+=t[a].length;for(n=new Array(o);--i>=0;)for(r=t[i],e=r.length;--e>=0;)n[--o]=r[e];return n};var Eo=Math.abs;fo.range=function(t,e,n){if(arguments.length<3&&(n=1,arguments.length<2&&(e=t,t=0)),(e-t)/n===1/0)throw new Error("infinite range");var r,i=[],a=f(Eo(n)),o=-1;if(t*=a,e*=a,n*=a,n<0)for(;(r=t+n*++o)>e;)i.push(r/a);else for(;(r=t+n*++o)<e;)i.push(r/a);return i},fo.map=function(t,e){var n=new d;if(t instanceof d)t.forEach(function(t,e){n.set(t,e)});else if(Array.isArray(t)){var r,i=-1,a=t.length;if(1===arguments.length)for(;++i<a;)n.set(i,t[i]);else for(;++i<a;)n.set(e.call(t,r=t[i],i),r)}else for(var o in t)n.set(o,t[o]);return n};var To="__proto__",Ao="\0";p(d,{has:v,get:function(t){return this._[m(t)]},set:function(t,e){return this._[m(t)]=e},remove:y,keys:x,values:function(){var t=[];for(var e in this._)t.push(this._[e]);return t},entries:function(){var t=[];for(var e in this._)t.push({key:g(e),value:this._[e]});return t},size:b,empty:M,forEach:function(t){for(var e in this._)t.call(this,g(e),this._[e])}}),fo.nest=function(){function t(e,o,s){if(s>=a.length)return r?r.call(i,o):n?o.sort(n):o;for(var c,u,l,h,f=-1,p=o.length,m=a[s++],g=new d;++f<p;)(h=g.get(c=m(u=o[f])))?h.push(u):g.set(c,[u]);return e?(u=e(),l=function(n,r){u.set(n,t(e,r,s))}):(u={},l=function(n,r){u[n]=t(e,r,s)}),g.forEach(l),u}function e(t,n){if(n>=a.length)return t;var r=[],i=o[n++];return t.forEach(function(t,i){r.push({key:t,values:e(i,n)})}),i?r.sort(function(t,e){return i(t.key,e.key)}):r}var n,r,i={},a=[],o=[];return i.map=function(e,n){return t(n,e,0)},i.entries=function(n){return e(t(fo.map,n,0),0)},i.key=function(t){return a.push(t),i},i.sortKeys=function(t){return o[a.length-1]=t,i},i.sortValues=function(t){return n=t,i},i.rollup=function(t){return r=t,i},i},fo.set=function(t){var e=new _;if(t)for(var n=0,r=t.length;n<r;++n)e.add(t[n]);return e},p(_,{has:v,add:function(t){return this._[m(t+="")]=!0,t},remove:y,values:x,size:b,empty:M,forEach:function(t){for(var e in this._)t.call(this,g(e))}}),fo.behavior={},fo.rebind=function(t,e){for(var n,r=1,i=arguments.length;++r<i;)t[n=arguments[r]]=S(t,e,e[n]);return t};var Lo=["webkit","ms","moz","Moz","o","O"];fo.dispatch=function(){for(var t=new A,e=-1,n=arguments.length;++e<n;)t[arguments[e]]=L(t);return t},A.prototype.on=function(t,e){var n=t.indexOf("."),r="";if(n>=0&&(r=t.slice(n+1),t=t.slice(0,n)),t)return arguments.length<2?this[t].on(r):this[t].on(r,e);if(2===arguments.length){if(null==e)for(t in this)this.hasOwnProperty(t)&&this[t].on(r,null);return this}},fo.event=null,fo.requote=function(t){return t.replace(Co,"\\$&")};var Co=/[\\\^\$\*\+\?\|\[\]\(\)\.\{\}]/g,Ro={}.__proto__?function(t,e){t.__proto__=e}:function(t,e){for(var n in e)t[n]=e[n]},Po=function(t,e){return e.querySelector(t)},Do=function(t,e){return e.querySelectorAll(t)},No=function(t,e){var n=t.matches||t[E(t,"matchesSelector")];return(No=function(t,e){return n.call(t,e)})(t,e)};"function"==typeof Sizzle&&(Po=function(t,e){return Sizzle(t,e)[0]||null},Do=Sizzle,No=Sizzle.matchesSelector),fo.selection=function(){return fo.select(go.documentElement)};var Uo=fo.selection.prototype=[];Uo.select=function(t){var e,n,r,i,a=[];t=N(t);for(var o=-1,s=this.length;++o<s;){a.push(e=[]),e.parentNode=(r=this[o]).parentNode;for(var c=-1,u=r.length;++c<u;)(i=r[c])?(e.push(n=t.call(i,i.__data__,c,o)),n&&"__data__"in i&&(n.__data__=i.__data__)):e.push(null)}return D(a)},Uo.selectAll=function(t){var e,n,r=[];t=U(t);for(var i=-1,a=this.length;++i<a;)for(var o=this[i],s=-1,c=o.length;++s<c;)(n=o[s])&&(r.push(e=mo(t.call(n,n.__data__,s,i))),e.parentNode=n);return D(r)};var Bo="http://www.w3.org/1999/xhtml",Io={svg:"http://www.w3.org/2000/svg",xhtml:Bo,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};fo.ns={prefix:Io,qualify:function(t){var e=t.indexOf(":"),n=t;return e>=0&&"xmlns"!==(n=t.slice(0,e))&&(t=t.slice(e+1)),Io.hasOwnProperty(n)?{space:Io[n],local:t}:t}},Uo.attr=function(t,e){if(arguments.length<2){if("string"==typeof t){var n=this.node();return t=fo.ns.qualify(t),t.local?n.getAttributeNS(t.space,t.local):n.getAttribute(t)}for(e in t)this.each(B(e,t[e]));return this}return this.each(B(t,e))},Uo.classed=function(t,e){if(arguments.length<2){if("string"==typeof t){var n=this.node(),r=(t=F(t)).length,i=-1;if(e=n.classList){for(;++i<r;)if(!e.contains(t[i]))return!1}else for(e=n.getAttribute("class");++i<r;)if(!O(t[i]).test(e))return!1;return!0}for(e in t)this.each(V(e,t[e]));return this}return this.each(V(t,e))},Uo.style=function(t,e,n){var r=arguments.length;if(r<3){if("string"!=typeof t){r<2&&(e="");for(n in t)this.each(k(n,t[n],e));return this}if(r<2){var i=this.node();return o(i).getComputedStyle(i,null).getPropertyValue(t)}n=""}return this.each(k(t,e,n))},Uo.property=function(t,e){if(arguments.length<2){if("string"==typeof t)return this.node()[t];for(e in t)this.each(z(e,t[e]));return this}return this.each(z(t,e))},Uo.text=function(t){return arguments.length?this.each("function"==typeof t?function(){var e=t.apply(this,arguments);this.textContent=null==e?"":e}:null==t?function(){this.textContent=""}:function(){this.textContent=t}):this.node().textContent},Uo.html=function(t){return arguments.length?this.each("function"==typeof t?function(){var e=t.apply(this,arguments);this.innerHTML=null==e?"":e}:null==t?function(){this.innerHTML=""}:function(){this.innerHTML=t}):this.node().innerHTML},Uo.append=function(t){return t=H(t),this.select(function(){return this.appendChild(t.apply(this,arguments))})},Uo.insert=function(t,e){return t=H(t),e=N(e),this.select(function(){return this.insertBefore(t.apply(this,arguments),e.apply(this,arguments)||null)})},Uo.remove=function(){return this.each(j)},Uo.data=function(t,e){function n(t,n){var r,i,a,o=t.length,l=n.length,h=Math.min(o,l),f=new Array(l),p=new Array(l),m=new Array(o);if(e){var g,v=new d,y=new Array(o);for(r=-1;++r<o;)(i=t[r])&&(v.has(g=e.call(i,i.__data__,r))?m[r]=i:v.set(g,i),y[r]=g);for(r=-1;++r<l;)(i=v.get(g=e.call(n,a=n[r],r)))?i!==!0&&(f[r]=i,i.__data__=a):p[r]=W(a),v.set(g,!0);for(r=-1;++r<o;)r in y&&v.get(y[r])!==!0&&(m[r]=t[r])}else{for(r=-1;++r<h;)i=t[r],a=n[r],i?(i.__data__=a,f[r]=i):p[r]=W(a);for(;r<l;++r)p[r]=W(n[r]);for(;r<o;++r)m[r]=t[r]}p.update=f,p.parentNode=f.parentNode=m.parentNode=t.parentNode,s.push(p),c.push(f),u.push(m)}var r,i,a=-1,o=this.length;if(!arguments.length){for(t=new Array(o=(r=this[0]).length);++a<o;)(i=r[a])&&(t[a]=i.__data__);return t}var s=Z([]),c=D([]),u=D([]);if("function"==typeof t)for(;++a<o;)n(r=this[a],t.call(r,r.parentNode.__data__,a));else for(;++a<o;)n(r=this[a],t);return c.enter=function(){return s},c.exit=function(){return u},c},Uo.datum=function(t){return arguments.length?this.property("__data__",t):this.property("__data__")},Uo.filter=function(t){var e,n,r,i=[];"function"!=typeof t&&(t=X(t));for(var a=0,o=this.length;a<o;a++){i.push(e=[]),e.parentNode=(n=this[a]).parentNode;for(var s=0,c=n.length;s<c;s++)(r=n[s])&&t.call(r,r.__data__,s,a)&&e.push(r)}return D(i)},Uo.order=function(){for(var t=-1,e=this.length;++t<e;)for(var n,r=this[t],i=r.length-1,a=r[i];--i>=0;)(n=r[i])&&(a&&a!==n.nextSibling&&a.parentNode.insertBefore(n,a),a=n);return this},Uo.sort=function(t){t=q.apply(this,arguments);for(var e=-1,n=this.length;++e<n;)this[e].sort(t);return this.order()},Uo.each=function(t){return Y(this,function(e,n,r){t.call(e,e.__data__,n,r)})},Uo.call=function(t){var e=mo(arguments);return t.apply(e[0]=this,e),this},Uo.empty=function(){return!this.node()},Uo.node=function(){for(var t=0,e=this.length;t<e;t++)for(var n=this[t],r=0,i=n.length;r<i;r++){var a=n[r];if(a)return a}return null},Uo.size=function(){var t=0;return Y(this,function(){++t}),t};var Oo=[];fo.selection.enter=Z,fo.selection.enter.prototype=Oo,
-Oo.append=Uo.append,Oo.empty=Uo.empty,Oo.node=Uo.node,Oo.call=Uo.call,Oo.size=Uo.size,Oo.select=function(t){for(var e,n,r,i,a,o=[],s=-1,c=this.length;++s<c;){r=(i=this[s]).update,o.push(e=[]),e.parentNode=i.parentNode;for(var u=-1,l=i.length;++u<l;)(a=i[u])?(e.push(r[u]=n=t.call(i.parentNode,a.__data__,u,s)),n.__data__=a.__data__):e.push(null)}return D(o)},Oo.insert=function(t,e){return arguments.length<2&&(e=K(this)),Uo.insert.call(this,t,e)},fo.select=function(t){var e;return"string"==typeof t?(e=[Po(t,go)],e.parentNode=go.documentElement):(e=[t],e.parentNode=a(t)),D([e])},fo.selectAll=function(t){var e;return"string"==typeof t?(e=mo(Do(t,go)),e.parentNode=go.documentElement):(e=mo(t),e.parentNode=null),D([e])},Uo.on=function(t,e,n){var r=arguments.length;if(r<3){if("string"!=typeof t){r<2&&(e=!1);for(n in t)this.each(Q(n,t[n],e));return this}if(r<2)return(r=this.node()["__on"+t])&&r._;n=!1}return this.each(Q(t,e,n))};var Fo=fo.map({mouseenter:"mouseover",mouseleave:"mouseout"});go&&Fo.forEach(function(t){"on"+t in go&&Fo.remove(t)});var Vo,Go=0;fo.mouse=function(t){return et(t,R())};var ko=this.navigator&&/WebKit/.test(this.navigator.userAgent)?-1:0;fo.touch=function(t,e,n){if(arguments.length<3&&(n=e,e=R().changedTouches),e)for(var r,i=0,a=e.length;i<a;++i)if((r=e[i]).identifier===n)return et(t,r)},fo.behavior.drag=function(){function t(){this.on("mousedown.drag",i).on("touchstart.drag",a)}function e(t,e,i,a,o){return function(){function s(){var t,n,r=e(f,m);r&&(t=r[0]-x[0],n=r[1]-x[1],d|=t|n,x=r,p({type:"drag",x:r[0]+u[0],y:r[1]+u[1],dx:t,dy:n}))}function c(){e(f,m)&&(v.on(a+g,null).on(o+g,null),y(d),p({type:"dragend"}))}var u,l=this,h=fo.event.target.correspondingElement||fo.event.target,f=l.parentNode,p=n.of(l,arguments),d=0,m=t(),g=".drag"+(null==m?"":"-"+m),v=fo.select(i(h)).on(a+g,s).on(o+g,c),y=tt(h),x=e(f,m);r?(u=r.apply(l,arguments),u=[u.x-x[0],u.y-x[1]]):u=[0,0],p({type:"dragstart"})}}var n=P(t,"drag","dragstart","dragend"),r=null,i=e(T,fo.mouse,o,"mousemove","mouseup"),a=e(nt,fo.touch,w,"touchmove","touchend");return t.origin=function(e){return arguments.length?(r=e,t):r},fo.rebind(t,n,"on")},fo.touches=function(t,e){return arguments.length<2&&(e=R().touches),e?mo(e).map(function(e){var n=et(t,e);return n.identifier=e.identifier,n}):[]};var zo=1e-6,Ho=zo*zo,jo=Math.PI,Wo=2*jo,Xo=Wo-zo,qo=jo/2,Yo=jo/180,Zo=180/jo,Ko=Math.SQRT2,Qo=2,Jo=4;fo.interpolateZoom=function(t,e){var n,r,i=t[0],a=t[1],o=t[2],s=e[0],c=e[1],u=e[2],l=s-i,h=c-a,f=l*l+h*h;if(f<Ho)r=Math.log(u/o)/Ko,n=function(t){return[i+t*l,a+t*h,o*Math.exp(Ko*t*r)]};else{var p=Math.sqrt(f),d=(u*u-o*o+Jo*f)/(2*o*Qo*p),m=(u*u-o*o-Jo*f)/(2*u*Qo*p),g=Math.log(Math.sqrt(d*d+1)-d),v=Math.log(Math.sqrt(m*m+1)-m);r=(v-g)/Ko,n=function(t){var e=t*r,n=ct(g),s=o/(Qo*p)*(n*ut(Ko*e+g)-st(g));return[i+s*l,a+s*h,o*n/ct(Ko*e+g)]}}return n.duration=1e3*r,n},fo.behavior.zoom=function(){function t(t){t.on(R,h).on(ts+".zoom",p).on("dblclick.zoom",d).on(U,f)}function e(t){return[(t[0]-S.x)/S.k,(t[1]-S.y)/S.k]}function n(t){return[t[0]*S.k+S.x,t[1]*S.k+S.y]}function r(t){S.k=Math.max(T[0],Math.min(T[1],t))}function i(t,e){e=n(e),S.x+=t[0]-e[0],S.y+=t[1]-e[1]}function a(e,n,a,o){e.__chart__={x:S.x,y:S.y,k:S.k},r(Math.pow(2,o)),i(g=n,a),e=fo.select(e),A>0&&(e=e.transition().duration(A)),e.call(t.event)}function s(){M&&M.domain(b.range().map(function(t){return(t-S.x)/S.k}).map(b.invert)),w&&w.domain(_.range().map(function(t){return(t-S.y)/S.k}).map(_.invert))}function c(t){L++||t({type:"zoomstart"})}function u(t){s(),t({type:"zoom",scale:S.k,translate:[S.x,S.y]})}function l(t){--L||(t({type:"zoomend"}),g=null)}function h(){function t(){s=1,i(fo.mouse(r),f),u(a)}function n(){h.on(D,null).on(N,null),p(s),l(a)}var r=this,a=B.of(r,arguments),s=0,h=fo.select(o(r)).on(D,t).on(N,n),f=e(fo.mouse(r)),p=tt(r);qc.call(r),c(a)}function f(){function t(){var t=fo.touches(d);return p=S.k,t.forEach(function(t){t.identifier in g&&(g[t.identifier]=e(t))}),t}function n(){var e=fo.event.target;fo.select(e).on(b,o).on(M,s),_.push(e);for(var n=fo.event.changedTouches,r=0,i=n.length;r<i;++r)g[n[r].identifier]=null;var c=t(),u=Date.now();if(1===c.length){if(u-x<500){var l=c[0];a(d,l,g[l.identifier],Math.floor(Math.log(S.k)/Math.LN2)+1),C()}x=u}else if(c.length>1){var l=c[0],h=c[1],f=l[0]-h[0],p=l[1]-h[1];v=f*f+p*p}}function o(){var t,e,n,a,o=fo.touches(d);qc.call(d);for(var s=0,c=o.length;s<c;++s,a=null)if(n=o[s],a=g[n.identifier]){if(e)break;t=n,e=a}if(a){var l=(l=n[0]-t[0])*l+(l=n[1]-t[1])*l,h=v&&Math.sqrt(l/v);t=[(t[0]+n[0])/2,(t[1]+n[1])/2],e=[(e[0]+a[0])/2,(e[1]+a[1])/2],r(h*p)}x=null,i(t,e),u(m)}function s(){if(fo.event.touches.length){for(var e=fo.event.changedTouches,n=0,r=e.length;n<r;++n)delete g[e[n].identifier];for(var i in g)return void t()}fo.selectAll(_).on(y,null),w.on(R,h).on(U,f),E(),l(m)}var p,d=this,m=B.of(d,arguments),g={},v=0,y=".zoom-"+fo.event.changedTouches[0].identifier,b="touchmove"+y,M="touchend"+y,_=[],w=fo.select(d),E=tt(d);n(),c(m),w.on(R,null).on(U,n)}function p(){var t=B.of(this,arguments);y?clearTimeout(y):(qc.call(this),m=e(g=v||fo.mouse(this)),c(t)),y=setTimeout(function(){y=null,l(t)},50),C(),r(Math.pow(2,.002*$o())*S.k),i(g,m),u(t)}function d(){var t=fo.mouse(this),n=Math.log(S.k)/Math.LN2;a(this,t,e(t),fo.event.shiftKey?Math.ceil(n)-1:Math.floor(n)+1)}var m,g,v,y,x,b,M,_,w,S={x:0,y:0,k:1},E=[960,500],T=es,A=250,L=0,R="mousedown.zoom",D="mousemove.zoom",N="mouseup.zoom",U="touchstart.zoom",B=P(t,"zoomstart","zoom","zoomend");return ts||(ts="onwheel"in go?($o=function(){return-fo.event.deltaY*(fo.event.deltaMode?120:1)},"wheel"):"onmousewheel"in go?($o=function(){return fo.event.wheelDelta},"mousewheel"):($o=function(){return-fo.event.detail},"MozMousePixelScroll")),t.event=function(t){t.each(function(){var t=B.of(this,arguments),e=S;Wc?fo.select(this).transition().each("start.zoom",function(){S=this.__chart__||{x:0,y:0,k:1},c(t)}).tween("zoom:zoom",function(){var n=E[0],r=E[1],i=g?g[0]:n/2,a=g?g[1]:r/2,o=fo.interpolateZoom([(i-S.x)/S.k,(a-S.y)/S.k,n/S.k],[(i-e.x)/e.k,(a-e.y)/e.k,n/e.k]);return function(e){var r=o(e),s=n/r[2];this.__chart__=S={x:i-r[0]*s,y:a-r[1]*s,k:s},u(t)}}).each("interrupt.zoom",function(){l(t)}).each("end.zoom",function(){l(t)}):(this.__chart__=S,c(t),u(t),l(t))})},t.translate=function(e){return arguments.length?(S={x:+e[0],y:+e[1],k:S.k},s(),t):[S.x,S.y]},t.scale=function(e){return arguments.length?(S={x:S.x,y:S.y,k:null},r(+e),s(),t):S.k},t.scaleExtent=function(e){return arguments.length?(T=null==e?es:[+e[0],+e[1]],t):T},t.center=function(e){return arguments.length?(v=e&&[+e[0],+e[1]],t):v},t.size=function(e){return arguments.length?(E=e&&[+e[0],+e[1]],t):E},t.duration=function(e){return arguments.length?(A=+e,t):A},t.x=function(e){return arguments.length?(M=e,b=e.copy(),S={x:0,y:0,k:1},t):M},t.y=function(e){return arguments.length?(w=e,_=e.copy(),S={x:0,y:0,k:1},t):w},fo.rebind(t,B,"on")};var $o,ts,es=[0,1/0];fo.color=ht,ht.prototype.toString=function(){return this.rgb()+""},fo.hsl=ft;var ns=ft.prototype=new ht;ns.brighter=function(t){return t=Math.pow(.7,arguments.length?t:1),new ft(this.h,this.s,this.l/t)},ns.darker=function(t){return t=Math.pow(.7,arguments.length?t:1),new ft(this.h,this.s,t*this.l)},ns.rgb=function(){return pt(this.h,this.s,this.l)},fo.hcl=dt;var rs=dt.prototype=new ht;rs.brighter=function(t){return new dt(this.h,this.c,Math.min(100,this.l+is*(arguments.length?t:1)))},rs.darker=function(t){return new dt(this.h,this.c,Math.max(0,this.l-is*(arguments.length?t:1)))},rs.rgb=function(){return mt(this.h,this.c,this.l).rgb()},fo.lab=gt;var is=18,as=.95047,os=1,ss=1.08883,cs=gt.prototype=new ht;cs.brighter=function(t){return new gt(Math.min(100,this.l+is*(arguments.length?t:1)),this.a,this.b)},cs.darker=function(t){return new gt(Math.max(0,this.l-is*(arguments.length?t:1)),this.a,this.b)},cs.rgb=function(){return vt(this.l,this.a,this.b)},fo.rgb=_t;var us=_t.prototype=new ht;us.brighter=function(t){t=Math.pow(.7,arguments.length?t:1);var e=this.r,n=this.g,r=this.b,i=30;return e||n||r?(e&&e<i&&(e=i),n&&n<i&&(n=i),r&&r<i&&(r=i),new _t(Math.min(255,e/t),Math.min(255,n/t),Math.min(255,r/t))):new _t(i,i,i)},us.darker=function(t){return t=Math.pow(.7,arguments.length?t:1),new _t(t*this.r,t*this.g,t*this.b)},us.hsl=function(){return At(this.r,this.g,this.b)},us.toString=function(){return"#"+Et(this.r)+Et(this.g)+Et(this.b)};var ls=fo.map({aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074});ls.forEach(function(t,e){ls.set(t,wt(e))}),fo.functor=Pt,fo.xhr=Dt(w),fo.dsv=function(t,e){function n(t,n,a){arguments.length<3&&(a=n,n=null);var o=Nt(t,e,null==n?r:i(n),a);return o.row=function(t){return arguments.length?o.response(null==(n=t)?r:i(t)):n},o}function r(t){return n.parse(t.responseText)}function i(t){return function(e){return n.parse(e.responseText,t)}}function a(e){return e.map(o).join(t)}function o(t){return s.test(t)?'"'+t.replace(/\"/g,'""')+'"':t}var s=new RegExp('["'+t+"\n]"),c=t.charCodeAt(0);return n.parse=function(t,e){var r;return n.parseRows(t,function(t,n){if(r)return r(t,n-1);var i=new Function("d","return {"+t.map(function(t,e){return JSON.stringify(t)+": d["+e+"]"}).join(",")+"}");r=e?function(t,n){return e(i(t),n)}:i})},n.parseRows=function(t,e){function n(){if(l>=u)return o;if(i)return i=!1,a;var e=l;if(34===t.charCodeAt(e)){for(var n=e;n++<u;)if(34===t.charCodeAt(n)){if(34!==t.charCodeAt(n+1))break;++n}l=n+2;var r=t.charCodeAt(n+1);return 13===r?(i=!0,10===t.charCodeAt(n+2)&&++l):10===r&&(i=!0),t.slice(e+1,n).replace(/""/g,'"')}for(;l<u;){var r=t.charCodeAt(l++),s=1;if(10===r)i=!0;else if(13===r)i=!0,10===t.charCodeAt(l)&&(++l,++s);else if(r!==c)continue;return t.slice(e,l-s)}return t.slice(e)}for(var r,i,a={},o={},s=[],u=t.length,l=0,h=0;(r=n())!==o;){for(var f=[];r!==a&&r!==o;)f.push(r),r=n();e&&null==(f=e(f,h++))||s.push(f)}return s},n.format=function(e){if(Array.isArray(e[0]))return n.formatRows(e);var r=new _,i=[];return e.forEach(function(t){for(var e in t)r.has(e)||i.push(r.add(e))}),[i.map(o).join(t)].concat(e.map(function(e){return i.map(function(t){return o(e[t])}).join(t)})).join("\n")},n.formatRows=function(t){return t.map(a).join("\n")},n},fo.csv=fo.dsv(",","text/csv"),fo.tsv=fo.dsv("\t","text/tab-separated-values");var hs,fs,ps,ds,ms=this[E(this,"requestAnimationFrame")]||function(t){setTimeout(t,17)};fo.timer=function(){It.apply(this,arguments)},fo.timer.flush=function(){Ft(),Vt()},fo.round=function(t,e){return e?Math.round(t*(e=Math.pow(10,e)))/e:Math.round(t)};var gs=["y","z","a","f","p","n","ยต","m","","k","M","G","T","P","E","Z","Y"].map(kt);fo.formatPrefix=function(t,e){var n=0;return(t=+t)&&(t<0&&(t*=-1),e&&(t=fo.round(t,Gt(t,e))),n=1+Math.floor(1e-12+Math.log(t)/Math.LN10),n=Math.max(-24,Math.min(24,3*Math.floor((n-1)/3)))),gs[8+n/3]};var vs=/(?:([^{])?([<>=^]))?([+\- ])?([$#])?(0)?(\d+)?(,)?(\.-?\d+)?([a-z%])?/i,ys=fo.map({b:function(t){return t.toString(2)},c:function(t){return String.fromCharCode(t)},o:function(t){return t.toString(8)},x:function(t){return t.toString(16)},X:function(t){return t.toString(16).toUpperCase()},g:function(t,e){return t.toPrecision(e)},e:function(t,e){return t.toExponential(e)},f:function(t,e){return t.toFixed(e)},r:function(t,e){return(t=fo.round(t,Gt(t,e))).toFixed(Math.max(0,Math.min(20,Gt(t*(1+1e-15),e))))}}),xs=fo.time={},bs=Date;jt.prototype={getDate:function(){return this._.getUTCDate()},getDay:function(){return this._.getUTCDay()},getFullYear:function(){return this._.getUTCFullYear()},getHours:function(){return this._.getUTCHours()},getMilliseconds:function(){return this._.getUTCMilliseconds()},getMinutes:function(){return this._.getUTCMinutes()},getMonth:function(){return this._.getUTCMonth()},getSeconds:function(){return this._.getUTCSeconds()},getTime:function(){return this._.getTime()},getTimezoneOffset:function(){return 0},valueOf:function(){return this._.valueOf()},setDate:function(){Ms.setUTCDate.apply(this._,arguments)},setDay:function(){Ms.setUTCDay.apply(this._,arguments)},setFullYear:function(){Ms.setUTCFullYear.apply(this._,arguments)},setHours:function(){Ms.setUTCHours.apply(this._,arguments)},setMilliseconds:function(){Ms.setUTCMilliseconds.apply(this._,arguments)},setMinutes:function(){Ms.setUTCMinutes.apply(this._,arguments)},setMonth:function(){Ms.setUTCMonth.apply(this._,arguments)},setSeconds:function(){Ms.setUTCSeconds.apply(this._,arguments)},setTime:function(){Ms.setTime.apply(this._,arguments)}};var Ms=Date.prototype;xs.year=Wt(function(t){return t=xs.day(t),t.setMonth(0,1),t},function(t,e){t.setFullYear(t.getFullYear()+e)},function(t){return t.getFullYear()}),xs.years=xs.year.range,xs.years.utc=xs.year.utc.range,xs.day=Wt(function(t){var e=new bs(2e3,0);return e.setFullYear(t.getFullYear(),t.getMonth(),t.getDate()),e},function(t,e){t.setDate(t.getDate()+e)},function(t){return t.getDate()-1}),xs.days=xs.day.range,xs.days.utc=xs.day.utc.range,xs.dayOfYear=function(t){var e=xs.year(t);return Math.floor((t-e-6e4*(t.getTimezoneOffset()-e.getTimezoneOffset()))/864e5)},["sunday","monday","tuesday","wednesday","thursday","friday","saturday"].forEach(function(t,e){e=7-e;var n=xs[t]=Wt(function(t){return(t=xs.day(t)).setDate(t.getDate()-(t.getDay()+e)%7),t},function(t,e){t.setDate(t.getDate()+7*Math.floor(e))},function(t){var n=xs.year(t).getDay();return Math.floor((xs.dayOfYear(t)+(n+e)%7)/7)-(n!==e)});xs[t+"s"]=n.range,xs[t+"s"].utc=n.utc.range,xs[t+"OfYear"]=function(t){var n=xs.year(t).getDay();return Math.floor((xs.dayOfYear(t)+(n+e)%7)/7)}}),xs.week=xs.sunday,xs.weeks=xs.sunday.range,xs.weeks.utc=xs.sunday.utc.range,xs.weekOfYear=xs.sundayOfYear;var _s={"-":"",_:" ",0:"0"},ws=/^\s*\d+/,Ss=/^%/;fo.locale=function(t){return{numberFormat:zt(t),timeFormat:qt(t)}};var Es=fo.locale({decimal:".",thousands:",",grouping:[3],currency:["$",""],dateTime:"%a %b %e %X %Y",date:"%m/%d/%Y",time:"%H:%M:%S",periods:["AM","PM"],days:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],shortDays:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],months:["January","February","March","April","May","June","July","August","September","October","November","December"],shortMonths:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"]});fo.format=Es.numberFormat,fo.geo={},de.prototype={s:0,t:0,add:function(t){me(t,this.t,Ts),me(Ts.s,this.s,this),this.s?this.t+=Ts.t:this.s=Ts.t},reset:function(){this.s=this.t=0},valueOf:function(){return this.s}};var Ts=new de;fo.geo.stream=function(t,e){t&&As.hasOwnProperty(t.type)?As[t.type](t,e):ge(t,e)};var As={Feature:function(t,e){ge(t.geometry,e)},FeatureCollection:function(t,e){for(var n=t.features,r=-1,i=n.length;++r<i;)ge(n[r].geometry,e)}},Ls={Sphere:function(t,e){e.sphere()},Point:function(t,e){t=t.coordinates,e.point(t[0],t[1],t[2])},MultiPoint:function(t,e){for(var n=t.coordinates,r=-1,i=n.length;++r<i;)t=n[r],e.point(t[0],t[1],t[2])},LineString:function(t,e){ve(t.coordinates,e,0)},MultiLineString:function(t,e){for(var n=t.coordinates,r=-1,i=n.length;++r<i;)ve(n[r],e,0)},Polygon:function(t,e){ye(t.coordinates,e)},MultiPolygon:function(t,e){for(var n=t.coordinates,r=-1,i=n.length;++r<i;)ye(n[r],e)},GeometryCollection:function(t,e){for(var n=t.geometries,r=-1,i=n.length;++r<i;)ge(n[r],e)}};fo.geo.area=function(t){return Cs=0,fo.geo.stream(t,Ps),Cs};var Cs,Rs=new de,Ps={sphere:function(){Cs+=4*jo},point:T,lineStart:T,lineEnd:T,polygonStart:function(){Rs.reset(),Ps.lineStart=xe},polygonEnd:function(){var t=2*Rs;Cs+=t<0?4*jo+t:t,Ps.lineStart=Ps.lineEnd=Ps.point=T}};fo.geo.bounds=function(){function t(t,e){x.push(b=[l=t,f=t]),e<h&&(h=e),e>p&&(p=e)}function e(e,n){var r=be([e*Yo,n*Yo]);if(v){var i=_e(v,r),a=[i[1],-i[0],0],o=_e(a,i);Ee(o),o=Te(o);var c=e-d,u=c>0?1:-1,m=o[0]*Zo*u,g=Eo(c)>180;if(g^(u*d<m&&m<u*e)){var y=o[1]*Zo;y>p&&(p=y)}else if(m=(m+360)%360-180,g^(u*d<m&&m<u*e)){var y=-o[1]*Zo;y<h&&(h=y)}else n<h&&(h=n),n>p&&(p=n);g?e<d?s(l,e)>s(l,f)&&(f=e):s(e,f)>s(l,f)&&(l=e):f>=l?(e<l&&(l=e),e>f&&(f=e)):e>d?s(l,e)>s(l,f)&&(f=e):s(e,f)>s(l,f)&&(l=e)}else t(e,n);v=r,d=e}function n(){M.point=e}function r(){b[0]=l,b[1]=f,M.point=t,v=null}function i(t,n){if(v){var r=t-d;y+=Eo(r)>180?r+(r>0?360:-360):r}else m=t,g=n;Ps.point(t,n),e(t,n)}function a(){Ps.lineStart()}function o(){i(m,g),Ps.lineEnd(),Eo(y)>zo&&(l=-(f=180)),b[0]=l,b[1]=f,v=null}function s(t,e){return(e-=t)<0?e+360:e}function c(t,e){return t[0]-e[0]}function u(t,e){return e[0]<=e[1]?e[0]<=t&&t<=e[1]:t<e[0]||e[1]<t}var l,h,f,p,d,m,g,v,y,x,b,M={point:t,lineStart:n,lineEnd:r,polygonStart:function(){M.point=i,M.lineStart=a,M.lineEnd=o,y=0,Ps.polygonStart()},polygonEnd:function(){Ps.polygonEnd(),M.point=t,M.lineStart=n,M.lineEnd=r,Rs<0?(l=-(f=180),h=-(p=90)):y>zo?p=90:y<-zo&&(h=-90),b[0]=l,b[1]=f}};return function(t){p=f=-(l=h=1/0),x=[],fo.geo.stream(t,M);var e=x.length;if(e){x.sort(c);for(var n,r=1,i=x[0],a=[i];r<e;++r)n=x[r],u(n[0],i)||u(n[1],i)?(s(i[0],n[1])>s(i[0],i[1])&&(i[1]=n[1]),s(n[0],i[1])>s(i[0],i[1])&&(i[0]=n[0])):a.push(i=n);for(var o,n,d=-(1/0),e=a.length-1,r=0,i=a[e];r<=e;i=n,++r)n=a[r],(o=s(i[1],n[0]))>d&&(d=o,l=n[0],f=i[1])}return x=b=null,l===1/0||h===1/0?[[NaN,NaN],[NaN,NaN]]:[[l,h],[f,p]]}}(),fo.geo.centroid=function(t){Ds=Ns=Us=Bs=Is=Os=Fs=Vs=Gs=ks=zs=0,fo.geo.stream(t,Hs);var e=Gs,n=ks,r=zs,i=e*e+n*n+r*r;return i<Ho&&(e=Os,n=Fs,r=Vs,Ns<zo&&(e=Us,n=Bs,r=Is),i=e*e+n*n+r*r,i<Ho)?[NaN,NaN]:[Math.atan2(n,e)*Zo,ot(r/Math.sqrt(i))*Zo]};var Ds,Ns,Us,Bs,Is,Os,Fs,Vs,Gs,ks,zs,Hs={sphere:T,point:Le,lineStart:Re,lineEnd:Pe,polygonStart:function(){Hs.lineStart=De},polygonEnd:function(){Hs.lineStart=Re}},js=Fe(Ue,ze,je,[-jo,-jo/2]),Ws=1e9;fo.geo.clipExtent=function(){var t,e,n,r,i,a,o={stream:function(t){return i&&(i.valid=!1),i=a(t),i.valid=!0,i},extent:function(s){return arguments.length?(a=Ye(t=+s[0][0],e=+s[0][1],n=+s[1][0],r=+s[1][1]),i&&(i.valid=!1,i=null),o):[[t,e],[n,r]]}};return o.extent([[0,0],[960,500]])},(fo.geo.conicEqualArea=function(){return Ze(Ke)}).raw=Ke,fo.geo.albers=function(){return fo.geo.conicEqualArea().rotate([96,0]).center([-.6,38.7]).parallels([29.5,45.5]).scale(1070)},fo.geo.albersUsa=function(){function t(t){var a=t[0],o=t[1];return e=null,n(a,o),e||(r(a,o),e)||i(a,o),e}var e,n,r,i,a=fo.geo.albers(),o=fo.geo.conicEqualArea().rotate([154,0]).center([-2,58.5]).parallels([55,65]),s=fo.geo.conicEqualArea().rotate([157,0]).center([-3,19.9]).parallels([8,18]),c={point:function(t,n){e=[t,n]}};return t.invert=function(t){var e=a.scale(),n=a.translate(),r=(t[0]-n[0])/e,i=(t[1]-n[1])/e;return(i>=.12&&i<.234&&r>=-.425&&r<-.214?o:i>=.166&&i<.234&&r>=-.214&&r<-.115?s:a).invert(t)},t.stream=function(t){var e=a.stream(t),n=o.stream(t),r=s.stream(t);return{point:function(t,i){e.point(t,i),n.point(t,i),r.point(t,i)},sphere:function(){e.sphere(),n.sphere(),r.sphere()},lineStart:function(){e.lineStart(),n.lineStart(),r.lineStart()},lineEnd:function(){e.lineEnd(),n.lineEnd(),r.lineEnd()},polygonStart:function(){e.polygonStart(),n.polygonStart(),r.polygonStart()},polygonEnd:function(){e.polygonEnd(),n.polygonEnd(),r.polygonEnd()}}},t.precision=function(e){return arguments.length?(a.precision(e),o.precision(e),s.precision(e),t):a.precision()},t.scale=function(e){return arguments.length?(a.scale(e),o.scale(.35*e),s.scale(e),t.translate(a.translate())):a.scale()},t.translate=function(e){if(!arguments.length)return a.translate();var u=a.scale(),l=+e[0],h=+e[1];return n=a.translate(e).clipExtent([[l-.455*u,h-.238*u],[l+.455*u,h+.238*u]]).stream(c).point,r=o.translate([l-.307*u,h+.201*u]).clipExtent([[l-.425*u+zo,h+.12*u+zo],[l-.214*u-zo,h+.234*u-zo]]).stream(c).point,i=s.translate([l-.205*u,h+.212*u]).clipExtent([[l-.214*u+zo,h+.166*u+zo],[l-.115*u-zo,h+.234*u-zo]]).stream(c).point,t},t.scale(1070)};var Xs,qs,Ys,Zs,Ks,Qs,Js={point:T,lineStart:T,lineEnd:T,polygonStart:function(){qs=0,Js.lineStart=Qe},polygonEnd:function(){Js.lineStart=Js.lineEnd=Js.point=T,Xs+=Eo(qs/2)}},$s={point:Je,lineStart:T,lineEnd:T,polygonStart:T,polygonEnd:T},tc={point:en,lineStart:nn,lineEnd:rn,polygonStart:function(){tc.lineStart=an},polygonEnd:function(){tc.point=en,tc.lineStart=nn,tc.lineEnd=rn}};fo.geo.path=function(){function t(t){return t&&("function"==typeof s&&a.pointRadius(+s.apply(this,arguments)),o&&o.valid||(o=i(a)),fo.geo.stream(t,o)),a.result()}function e(){return o=null,t}var n,r,i,a,o,s=4.5;return t.area=function(t){return Xs=0,fo.geo.stream(t,i(Js)),Xs},t.centroid=function(t){return Us=Bs=Is=Os=Fs=Vs=Gs=ks=zs=0,fo.geo.stream(t,i(tc)),zs?[Gs/zs,ks/zs]:Vs?[Os/Vs,Fs/Vs]:Is?[Us/Is,Bs/Is]:[NaN,NaN]},t.bounds=function(t){return Ks=Qs=-(Ys=Zs=1/0),fo.geo.stream(t,i($s)),[[Ys,Zs],[Ks,Qs]]},t.projection=function(t){return arguments.length?(i=(n=t)?t.stream||cn(t):w,e()):n},t.context=function(t){return arguments.length?(a=null==(r=t)?new $e:new on(t),"function"!=typeof s&&a.pointRadius(s),e()):r},t.pointRadius=function(e){return arguments.length?(s="function"==typeof e?e:(a.pointRadius(+e),+e),t):s},t.projection(fo.geo.albersUsa()).context(null)},fo.geo.transform=function(t){return{stream:function(e){var n=new un(e);for(var r in t)n[r]=t[r];return n}}},un.prototype={point:function(t,e){this.stream.point(t,e)},sphere:function(){this.stream.sphere()},lineStart:function(){this.stream.lineStart()},lineEnd:function(){this.stream.lineEnd()},polygonStart:function(){this.stream.polygonStart()},polygonEnd:function(){this.stream.polygonEnd()}},fo.geo.projection=hn,fo.geo.projectionMutator=fn,(fo.geo.equirectangular=function(){return hn(dn)}).raw=dn.invert=dn,fo.geo.rotation=function(t){function e(e){return e=t(e[0]*Yo,e[1]*Yo),e[0]*=Zo,e[1]*=Zo,e}return t=gn(t[0]%360*Yo,t[1]*Yo,t.length>2?t[2]*Yo:0),e.invert=function(e){return e=t.invert(e[0]*Yo,e[1]*Yo),e[0]*=Zo,e[1]*=Zo,e},e},mn.invert=dn,fo.geo.circle=function(){function t(){var t="function"==typeof r?r.apply(this,arguments):r,e=gn(-t[0]*Yo,-t[1]*Yo,0).invert,i=[];return n(null,null,1,{point:function(t,n){i.push(t=e(t,n)),t[0]*=Zo,t[1]*=Zo}}),{type:"Polygon",coordinates:[i]}}var e,n,r=[0,0],i=6;return t.origin=function(e){return arguments.length?(r=e,t):r},t.angle=function(r){return arguments.length?(n=bn((e=+r)*Yo,i*Yo),t):e},t.precision=function(r){return arguments.length?(n=bn(e*Yo,(i=+r)*Yo),t):i},t.angle(90)},fo.geo.distance=function(t,e){var n,r=(e[0]-t[0])*Yo,i=t[1]*Yo,a=e[1]*Yo,o=Math.sin(r),s=Math.cos(r),c=Math.sin(i),u=Math.cos(i),l=Math.sin(a),h=Math.cos(a);return Math.atan2(Math.sqrt((n=h*o)*n+(n=u*l-c*h*s)*n),c*l+u*h*s)},fo.geo.graticule=function(){function t(){return{type:"MultiLineString",coordinates:e()}}function e(){return fo.range(Math.ceil(a/g)*g,i,g).map(f).concat(fo.range(Math.ceil(u/v)*v,c,v).map(p)).concat(fo.range(Math.ceil(r/d)*d,n,d).filter(function(t){return Eo(t%g)>zo}).map(l)).concat(fo.range(Math.ceil(s/m)*m,o,m).filter(function(t){return Eo(t%v)>zo}).map(h))}var n,r,i,a,o,s,c,u,l,h,f,p,d=10,m=d,g=90,v=360,y=2.5;return t.lines=function(){return e().map(function(t){return{type:"LineString",coordinates:t}})},t.outline=function(){return{type:"Polygon",coordinates:[f(a).concat(p(c).slice(1),f(i).reverse().slice(1),p(u).reverse().slice(1))]}},t.extent=function(e){return arguments.length?t.majorExtent(e).minorExtent(e):t.minorExtent()},t.majorExtent=function(e){return arguments.length?(a=+e[0][0],i=+e[1][0],u=+e[0][1],c=+e[1][1],a>i&&(e=a,a=i,i=e),u>c&&(e=u,u=c,c=e),t.precision(y)):[[a,u],[i,c]]},t.minorExtent=function(e){return arguments.length?(r=+e[0][0],n=+e[1][0],s=+e[0][1],o=+e[1][1],r>n&&(e=r,r=n,n=e),s>o&&(e=s,s=o,o=e),t.precision(y)):[[r,s],[n,o]]},t.step=function(e){return arguments.length?t.majorStep(e).minorStep(e):t.minorStep()},t.majorStep=function(e){return arguments.length?(g=+e[0],v=+e[1],t):[g,v]},t.minorStep=function(e){return arguments.length?(d=+e[0],m=+e[1],t):[d,m]},t.precision=function(e){return arguments.length?(y=+e,l=_n(s,o,90),h=wn(r,n,y),f=_n(u,c,90),p=wn(a,i,y),t):y},t.majorExtent([[-180,-90+zo],[180,90-zo]]).minorExtent([[-180,-80-zo],[180,80+zo]])},fo.geo.greatArc=function(){function t(){return{type:"LineString",coordinates:[e||r.apply(this,arguments),n||i.apply(this,arguments)]}}var e,n,r=Sn,i=En;return t.distance=function(){return fo.geo.distance(e||r.apply(this,arguments),n||i.apply(this,arguments))},t.source=function(n){return arguments.length?(r=n,e="function"==typeof n?null:n,t):r},t.target=function(e){return arguments.length?(i=e,n="function"==typeof e?null:e,t):i},t.precision=function(){return arguments.length?t:0},t},fo.geo.interpolate=function(t,e){return Tn(t[0]*Yo,t[1]*Yo,e[0]*Yo,e[1]*Yo)},fo.geo.length=function(t){return ec=0,fo.geo.stream(t,nc),ec};var ec,nc={sphere:T,point:T,lineStart:An,lineEnd:T,polygonStart:T,polygonEnd:T},rc=Ln(function(t){return Math.sqrt(2/(1+t))},function(t){return 2*Math.asin(t/2)});(fo.geo.azimuthalEqualArea=function(){return hn(rc)}).raw=rc;var ic=Ln(function(t){var e=Math.acos(t);return e&&e/Math.sin(e)},w);(fo.geo.azimuthalEquidistant=function(){return hn(ic)}).raw=ic,(fo.geo.conicConformal=function(){return Ze(Cn)}).raw=Cn,(fo.geo.conicEquidistant=function(){return Ze(Rn)}).raw=Rn;var ac=Ln(function(t){return 1/t},Math.atan);(fo.geo.gnomonic=function(){return hn(ac)}).raw=ac,Pn.invert=function(t,e){return[t,2*Math.atan(Math.exp(e))-qo]},(fo.geo.mercator=function(){return Dn(Pn)}).raw=Pn;var oc=Ln(function(){return 1},Math.asin);(fo.geo.orthographic=function(){return hn(oc)}).raw=oc;var sc=Ln(function(t){return 1/(1+t)},function(t){return 2*Math.atan(t)});(fo.geo.stereographic=function(){return hn(sc)}).raw=sc,Nn.invert=function(t,e){return[-e,2*Math.atan(Math.exp(t))-qo]},(fo.geo.transverseMercator=function(){var t=Dn(Nn),e=t.center,n=t.rotate;return t.center=function(t){return t?e([-t[1],t[0]]):(t=e(),[t[1],-t[0]])},t.rotate=function(t){return t?n([t[0],t[1],t.length>2?t[2]+90:90]):(t=n(),[t[0],t[1],t[2]-90])},n([0,0,90])}).raw=Nn,fo.geom={},fo.geom.hull=function(t){function e(t){if(t.length<3)return[];var e,i=Pt(n),a=Pt(r),o=t.length,s=[],c=[];for(e=0;e<o;e++)s.push([+i.call(this,t[e],e),+a.call(this,t[e],e),e]);for(s.sort(On),e=0;e<o;e++)c.push([s[e][0],-s[e][1]]);var u=In(s),l=In(c),h=l[0]===u[0],f=l[l.length-1]===u[u.length-1],p=[];for(e=u.length-1;e>=0;--e)p.push(t[s[u[e]][2]]);for(e=+h;e<l.length-f;++e)p.push(t[s[l[e]][2]]);return p}var n=Un,r=Bn;return arguments.length?e(t):(e.x=function(t){return arguments.length?(n=t,e):n},e.y=function(t){return arguments.length?(r=t,e):r},e)},fo.geom.polygon=function(t){return Ro(t,cc),t};var cc=fo.geom.polygon.prototype=[];cc.area=function(){for(var t,e=-1,n=this.length,r=this[n-1],i=0;++e<n;)t=r,r=this[e],i+=t[1]*r[0]-t[0]*r[1];return.5*i},cc.centroid=function(t){var e,n,r=-1,i=this.length,a=0,o=0,s=this[i-1];for(arguments.length||(t=-1/(6*this.area()));++r<i;)e=s,s=this[r],n=e[0]*s[1]-s[0]*e[1],a+=(e[0]+s[0])*n,o+=(e[1]+s[1])*n;return[a*t,o*t]},cc.clip=function(t){for(var e,n,r,i,a,o,s=Gn(t),c=-1,u=this.length-Gn(this),l=this[u-1];++c<u;){for(e=t.slice(),t.length=0,i=this[c],a=e[(r=e.length-s)-1],n=-1;++n<r;)o=e[n],Fn(o,l,i)?(Fn(a,l,i)||t.push(Vn(a,o,l,i)),t.push(o)):Fn(a,l,i)&&t.push(Vn(a,o,l,i)),a=o;s&&t.push(t[0]),l=i}return t};var uc,lc,hc,fc,pc,dc=[],mc=[];Yn.prototype.prepare=function(){for(var t,e=this.edges,n=e.length;n--;)t=e[n].edge,t.b&&t.a||e.splice(n,1);return e.sort(Kn),e.length},or.prototype={start:function(){return this.edge.l===this.site?this.edge.a:this.edge.b},end:function(){return this.edge.l===this.site?this.edge.b:this.edge.a}},sr.prototype={insert:function(t,e){var n,r,i;if(t){if(e.P=t,e.N=t.N,t.N&&(t.N.P=e),t.N=e,t.R){for(t=t.R;t.L;)t=t.L;t.L=e}else t.R=e;n=t}else this._?(t=hr(this._),e.P=null,e.N=t,t.P=t.L=e,n=t):(e.P=e.N=null,this._=e,n=null);for(e.L=e.R=null,e.U=n,e.C=!0,t=e;n&&n.C;)r=n.U,n===r.L?(i=r.R,i&&i.C?(n.C=i.C=!1,r.C=!0,t=r):(t===n.R&&(ur(this,n),t=n,n=t.U),n.C=!1,r.C=!0,lr(this,r))):(i=r.L,i&&i.C?(n.C=i.C=!1,r.C=!0,t=r):(t===n.L&&(lr(this,n),t=n,n=t.U),n.C=!1,r.C=!0,ur(this,r))),n=t.U;this._.C=!1},remove:function(t){t.N&&(t.N.P=t.P),t.P&&(t.P.N=t.N),t.N=t.P=null;var e,n,r,i=t.U,a=t.L,o=t.R;if(n=a?o?hr(o):a:o,i?i.L===t?i.L=n:i.R=n:this._=n,a&&o?(r=n.C,n.C=t.C,n.L=a,a.U=n,n!==o?(i=n.U,n.U=t.U,t=n.R,i.L=t,n.R=o,o.U=n):(n.U=i,i=n,t=n.R)):(r=t.C,t=n),t&&(t.U=i),!r){if(t&&t.C)return void(t.C=!1);do{if(t===this._)break;if(t===i.L){if(e=i.R,e.C&&(e.C=!1,i.C=!0,ur(this,i),e=i.R),e.L&&e.L.C||e.R&&e.R.C){e.R&&e.R.C||(e.L.C=!1,e.C=!0,lr(this,e),e=i.R),e.C=i.C,i.C=e.R.C=!1,ur(this,i),t=this._;break}}else if(e=i.L,e.C&&(e.C=!1,i.C=!0,lr(this,i),e=i.L),e.L&&e.L.C||e.R&&e.R.C){e.L&&e.L.C||(e.R.C=!1,e.C=!0,ur(this,e),e=i.L),e.C=i.C,i.C=e.L.C=!1,lr(this,i),t=this._;break}e.C=!0,t=i,i=i.U}while(!t.C);t&&(t.C=!1)}}},fo.geom.voronoi=function(t){function e(t){var e=new Array(t.length),r=s[0][0],i=s[0][1],a=s[1][0],o=s[1][1];return fr(n(t),s).cells.forEach(function(n,s){var c=n.edges,u=n.site,l=e[s]=c.length?c.map(function(t){var e=t.start();return[e.x,e.y]}):u.x>=r&&u.x<=a&&u.y>=i&&u.y<=o?[[r,o],[a,o],[a,i],[r,i]]:[];l.point=t[s]}),e}function n(t){return t.map(function(t,e){return{x:Math.round(a(t,e)/zo)*zo,y:Math.round(o(t,e)/zo)*zo,i:e}})}var r=Un,i=Bn,a=r,o=i,s=gc;return t?e(t):(e.links=function(t){return fr(n(t)).edges.filter(function(t){return t.l&&t.r}).map(function(e){return{source:t[e.l.i],target:t[e.r.i]}})},e.triangles=function(t){var e=[];return fr(n(t)).cells.forEach(function(n,r){for(var i,a,o=n.site,s=n.edges.sort(Kn),c=-1,u=s.length,l=s[u-1].edge,h=l.l===o?l.r:l.l;++c<u;)i=l,a=h,l=s[c].edge,h=l.l===o?l.r:l.l,
-r<a.i&&r<h.i&&dr(o,a,h)<0&&e.push([t[r],t[a.i],t[h.i]])}),e},e.x=function(t){return arguments.length?(a=Pt(r=t),e):r},e.y=function(t){return arguments.length?(o=Pt(i=t),e):i},e.clipExtent=function(t){return arguments.length?(s=null==t?gc:t,e):s===gc?null:s},e.size=function(t){return arguments.length?e.clipExtent(t&&[[0,0],t]):s===gc?null:s&&s[1]},e)};var gc=[[-1e6,-1e6],[1e6,1e6]];fo.geom.delaunay=function(t){return fo.geom.voronoi().triangles(t)},fo.geom.quadtree=function(t,e,n,r,i){function a(t){function a(t,e,n,r,i,a,o,s){if(!isNaN(n)&&!isNaN(r))if(t.leaf){var c=t.x,l=t.y;if(null!=c)if(Eo(c-n)+Eo(l-r)<.01)u(t,e,n,r,i,a,o,s);else{var h=t.point;t.x=t.y=t.point=null,u(t,h,c,l,i,a,o,s),u(t,e,n,r,i,a,o,s)}else t.x=n,t.y=r,t.point=e}else u(t,e,n,r,i,a,o,s)}function u(t,e,n,r,i,o,s,c){var u=.5*(i+s),l=.5*(o+c),h=n>=u,f=r>=l,p=f<<1|h;t.leaf=!1,t=t.nodes[p]||(t.nodes[p]=vr()),h?i=u:s=u,f?o=l:c=l,a(t,e,n,r,i,o,s,c)}var l,h,f,p,d,m,g,v,y,x=Pt(s),b=Pt(c);if(null!=e)m=e,g=n,v=r,y=i;else if(v=y=-(m=g=1/0),h=[],f=[],d=t.length,o)for(p=0;p<d;++p)l=t[p],l.x<m&&(m=l.x),l.y<g&&(g=l.y),l.x>v&&(v=l.x),l.y>y&&(y=l.y),h.push(l.x),f.push(l.y);else for(p=0;p<d;++p){var M=+x(l=t[p],p),_=+b(l,p);M<m&&(m=M),_<g&&(g=_),M>v&&(v=M),_>y&&(y=_),h.push(M),f.push(_)}var w=v-m,S=y-g;w>S?y=g+w:v=m+S;var E=vr();if(E.add=function(t){a(E,t,+x(t,++p),+b(t,p),m,g,v,y)},E.visit=function(t){yr(t,E,m,g,v,y)},E.find=function(t){return xr(E,t[0],t[1],m,g,v,y)},p=-1,null==e){for(;++p<d;)a(E,t[p],h[p],f[p],m,g,v,y);--p}else t.forEach(E.add);return h=f=t=l=null,E}var o,s=Un,c=Bn;return(o=arguments.length)?(s=mr,c=gr,3===o&&(i=n,r=e,n=e=0),a(t)):(a.x=function(t){return arguments.length?(s=t,a):s},a.y=function(t){return arguments.length?(c=t,a):c},a.extent=function(t){return arguments.length?(null==t?e=n=r=i=null:(e=+t[0][0],n=+t[0][1],r=+t[1][0],i=+t[1][1]),a):null==e?null:[[e,n],[r,i]]},a.size=function(t){return arguments.length?(null==t?e=n=r=i=null:(e=n=0,r=+t[0],i=+t[1]),a):null==e?null:[r-e,i-n]},a)},fo.interpolateRgb=br,fo.interpolateObject=Mr,fo.interpolateNumber=_r,fo.interpolateString=wr;var vc=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,yc=new RegExp(vc.source,"g");fo.interpolate=Sr,fo.interpolators=[function(t,e){var n=typeof e;return("string"===n?ls.has(e.toLowerCase())||/^(#|rgb\(|hsl\()/i.test(e)?br:wr:e instanceof ht?br:Array.isArray(e)?Er:"object"===n&&isNaN(e)?Mr:_r)(t,e)}],fo.interpolateArray=Er;var xc=function(){return w},bc=fo.map({linear:xc,poly:Dr,quad:function(){return Cr},cubic:function(){return Rr},sin:function(){return Nr},exp:function(){return Ur},circle:function(){return Br},elastic:Ir,back:Or,bounce:function(){return Fr}}),Mc=fo.map({"in":w,out:Ar,"in-out":Lr,"out-in":function(t){return Lr(Ar(t))}});fo.ease=function(t){var e=t.indexOf("-"),n=e>=0?t.slice(0,e):t,r=e>=0?t.slice(e+1):"in";return n=bc.get(n)||xc,r=Mc.get(r)||w,Tr(r(n.apply(null,po.call(arguments,1))))},fo.interpolateHcl=Vr,fo.interpolateHsl=Gr,fo.interpolateLab=kr,fo.interpolateRound=zr,fo.transform=function(t){var e=go.createElementNS(fo.ns.prefix.svg,"g");return(fo.transform=function(t){if(null!=t){e.setAttribute("transform",t);var n=e.transform.baseVal.consolidate()}return new Hr(n?n.matrix:_c)})(t)},Hr.prototype.toString=function(){return"translate("+this.translate+")rotate("+this.rotate+")skewX("+this.skew+")scale("+this.scale+")"};var _c={a:1,b:0,c:0,d:1,e:0,f:0};fo.interpolateTransform=Jr,fo.layout={},fo.layout.bundle=function(){return function(t){for(var e=[],n=-1,r=t.length;++n<r;)e.push(ei(t[n]));return e}},fo.layout.chord=function(){function t(){var t,u,h,f,p,d={},m=[],g=fo.range(a),v=[];for(n=[],r=[],t=0,f=-1;++f<a;){for(u=0,p=-1;++p<a;)u+=i[f][p];m.push(u),v.push(fo.range(a)),t+=u}for(o&&g.sort(function(t,e){return o(m[t],m[e])}),s&&v.forEach(function(t,e){t.sort(function(t,n){return s(i[e][t],i[e][n])})}),t=(Wo-l*a)/t,u=0,f=-1;++f<a;){for(h=u,p=-1;++p<a;){var y=g[f],x=v[y][p],b=i[y][x],M=u,_=u+=b*t;d[y+"-"+x]={index:y,subindex:x,startAngle:M,endAngle:_,value:b}}r[y]={index:y,startAngle:h,endAngle:u,value:m[y]},u+=l}for(f=-1;++f<a;)for(p=f-1;++p<a;){var w=d[f+"-"+p],S=d[p+"-"+f];(w.value||S.value)&&n.push(w.value<S.value?{source:S,target:w}:{source:w,target:S})}c&&e()}function e(){n.sort(function(t,e){return c((t.source.value+t.target.value)/2,(e.source.value+e.target.value)/2)})}var n,r,i,a,o,s,c,u={},l=0;return u.matrix=function(t){return arguments.length?(a=(i=t)&&i.length,n=r=null,u):i},u.padding=function(t){return arguments.length?(l=t,n=r=null,u):l},u.sortGroups=function(t){return arguments.length?(o=t,n=r=null,u):o},u.sortSubgroups=function(t){return arguments.length?(s=t,n=null,u):s},u.sortChords=function(t){return arguments.length?(c=t,n&&e(),u):c},u.chords=function(){return n||t(),n},u.groups=function(){return r||t(),r},u},fo.layout.force=function(){function t(t){return function(e,n,r,i){if(e.point!==t){var a=e.cx-t.x,o=e.cy-t.y,s=i-n,c=a*a+o*o;if(s*s/v<c){if(c<m){var u=e.charge/c;t.px-=a*u,t.py-=o*u}return!0}if(e.point&&c&&c<m){var u=e.pointCharge/c;t.px-=a*u,t.py-=o*u}}return!e.charge}}function e(t){t.px=fo.event.x,t.py=fo.event.y,c.resume()}var n,r,i,a,o,s,c={},u=fo.dispatch("start","tick","end"),l=[1,1],h=.9,f=wc,p=Sc,d=-30,m=Ec,g=.1,v=.64,y=[],x=[];return c.tick=function(){if((i*=.99)<.005)return n=null,u.end({type:"end",alpha:i=0}),!0;var e,r,c,f,p,m,v,b,M,_=y.length,w=x.length;for(r=0;r<w;++r)c=x[r],f=c.source,p=c.target,b=p.x-f.x,M=p.y-f.y,(m=b*b+M*M)&&(m=i*o[r]*((m=Math.sqrt(m))-a[r])/m,b*=m,M*=m,p.x-=b*(v=f.weight+p.weight?f.weight/(f.weight+p.weight):.5),p.y-=M*v,f.x+=b*(v=1-v),f.y+=M*v);if((v=i*g)&&(b=l[0]/2,M=l[1]/2,r=-1,v))for(;++r<_;)c=y[r],c.x+=(b-c.x)*v,c.y+=(M-c.y)*v;if(d)for(ci(e=fo.geom.quadtree(y),i,s),r=-1;++r<_;)(c=y[r]).fixed||e.visit(t(c));for(r=-1;++r<_;)c=y[r],c.fixed?(c.x=c.px,c.y=c.py):(c.x-=(c.px-(c.px=c.x))*h,c.y-=(c.py-(c.py=c.y))*h);u.tick({type:"tick",alpha:i})},c.nodes=function(t){return arguments.length?(y=t,c):y},c.links=function(t){return arguments.length?(x=t,c):x},c.size=function(t){return arguments.length?(l=t,c):l},c.linkDistance=function(t){return arguments.length?(f="function"==typeof t?t:+t,c):f},c.distance=c.linkDistance,c.linkStrength=function(t){return arguments.length?(p="function"==typeof t?t:+t,c):p},c.friction=function(t){return arguments.length?(h=+t,c):h},c.charge=function(t){return arguments.length?(d="function"==typeof t?t:+t,c):d},c.chargeDistance=function(t){return arguments.length?(m=t*t,c):Math.sqrt(m)},c.gravity=function(t){return arguments.length?(g=+t,c):g},c.theta=function(t){return arguments.length?(v=t*t,c):Math.sqrt(v)},c.alpha=function(t){return arguments.length?(t=+t,i?t>0?i=t:(n.c=null,n.t=NaN,n=null,u.end({type:"end",alpha:i=0})):t>0&&(u.start({type:"start",alpha:i=t}),n=It(c.tick)),c):i},c.start=function(){function t(t,r){if(!n){for(n=new Array(i),c=0;c<i;++c)n[c]=[];for(c=0;c<u;++c){var a=x[c];n[a.source.index].push(a.target),n[a.target.index].push(a.source)}}for(var o,s=n[e],c=-1,l=s.length;++c<l;)if(!isNaN(o=s[c][t]))return o;return Math.random()*r}var e,n,r,i=y.length,u=x.length,h=l[0],m=l[1];for(e=0;e<i;++e)(r=y[e]).index=e,r.weight=0;for(e=0;e<u;++e)r=x[e],"number"==typeof r.source&&(r.source=y[r.source]),"number"==typeof r.target&&(r.target=y[r.target]),++r.source.weight,++r.target.weight;for(e=0;e<i;++e)r=y[e],isNaN(r.x)&&(r.x=t("x",h)),isNaN(r.y)&&(r.y=t("y",m)),isNaN(r.px)&&(r.px=r.x),isNaN(r.py)&&(r.py=r.y);if(a=[],"function"==typeof f)for(e=0;e<u;++e)a[e]=+f.call(this,x[e],e);else for(e=0;e<u;++e)a[e]=f;if(o=[],"function"==typeof p)for(e=0;e<u;++e)o[e]=+p.call(this,x[e],e);else for(e=0;e<u;++e)o[e]=p;if(s=[],"function"==typeof d)for(e=0;e<i;++e)s[e]=+d.call(this,y[e],e);else for(e=0;e<i;++e)s[e]=d;return c.resume()},c.resume=function(){return c.alpha(.1)},c.stop=function(){return c.alpha(0)},c.drag=function(){return r||(r=fo.behavior.drag().origin(w).on("dragstart.force",ii).on("drag.force",e).on("dragend.force",ai)),arguments.length?void this.on("mouseover.force",oi).on("mouseout.force",si).call(r):r},fo.rebind(c,u,"on")};var wc=20,Sc=1,Ec=1/0;fo.layout.hierarchy=function(){function t(i){var a,o=[i],s=[];for(i.depth=0;null!=(a=o.pop());)if(s.push(a),(u=n.call(t,a,a.depth))&&(c=u.length)){for(var c,u,l;--c>=0;)o.push(l=u[c]),l.parent=a,l.depth=a.depth+1;r&&(a.value=0),a.children=u}else r&&(a.value=+r.call(t,a,a.depth)||0),delete a.children;return hi(i,function(t){var n,i;e&&(n=t.children)&&n.sort(e),r&&(i=t.parent)&&(i.value+=t.value)}),s}var e=di,n=fi,r=pi;return t.sort=function(n){return arguments.length?(e=n,t):e},t.children=function(e){return arguments.length?(n=e,t):n},t.value=function(e){return arguments.length?(r=e,t):r},t.revalue=function(e){return r&&(li(e,function(t){t.children&&(t.value=0)}),hi(e,function(e){var n;e.children||(e.value=+r.call(t,e,e.depth)||0),(n=e.parent)&&(n.value+=e.value)})),e},t},fo.layout.partition=function(){function t(e,n,r,i){var a=e.children;if(e.x=n,e.y=e.depth*i,e.dx=r,e.dy=i,a&&(o=a.length)){var o,s,c,u=-1;for(r=e.value?r/e.value:0;++u<o;)t(s=a[u],n,c=s.value*r,i),n+=c}}function e(t){var n=t.children,r=0;if(n&&(i=n.length))for(var i,a=-1;++a<i;)r=Math.max(r,e(n[a]));return 1+r}function n(n,a){var o=r.call(this,n,a);return t(o[0],0,i[0],i[1]/e(o[0])),o}var r=fo.layout.hierarchy(),i=[1,1];return n.size=function(t){return arguments.length?(i=t,n):i},ui(n,r)},fo.layout.pie=function(){function t(o){var s,c=o.length,u=o.map(function(n,r){return+e.call(t,n,r)}),l=+("function"==typeof r?r.apply(this,arguments):r),h=("function"==typeof i?i.apply(this,arguments):i)-l,f=Math.min(Math.abs(h)/c,+("function"==typeof a?a.apply(this,arguments):a)),p=f*(h<0?-1:1),d=fo.sum(u),m=d?(h-c*p)/d:0,g=fo.range(c),v=[];return null!=n&&g.sort(n===Tc?function(t,e){return u[e]-u[t]}:function(t,e){return n(o[t],o[e])}),g.forEach(function(t){v[t]={data:o[t],value:s=u[t],startAngle:l,endAngle:l+=s*m+p,padAngle:f}}),v}var e=Number,n=Tc,r=0,i=Wo,a=0;return t.value=function(n){return arguments.length?(e=n,t):e},t.sort=function(e){return arguments.length?(n=e,t):n},t.startAngle=function(e){return arguments.length?(r=e,t):r},t.endAngle=function(e){return arguments.length?(i=e,t):i},t.padAngle=function(e){return arguments.length?(a=e,t):a},t};var Tc={};fo.layout.stack=function(){function t(s,c){if(!(f=s.length))return s;var u=s.map(function(n,r){return e.call(t,n,r)}),l=u.map(function(e){return e.map(function(e,n){return[a.call(t,e,n),o.call(t,e,n)]})}),h=n.call(t,l,c);u=fo.permute(u,h),l=fo.permute(l,h);var f,p,d,m,g=r.call(t,l,c),v=u[0].length;for(d=0;d<v;++d)for(i.call(t,u[0][d],m=g[d],l[0][d][1]),p=1;p<f;++p)i.call(t,u[p][d],m+=l[p-1][d][1],l[p][d][1]);return s}var e=w,n=xi,r=bi,i=yi,a=gi,o=vi;return t.values=function(n){return arguments.length?(e=n,t):e},t.order=function(e){return arguments.length?(n="function"==typeof e?e:Ac.get(e)||xi,t):n},t.offset=function(e){return arguments.length?(r="function"==typeof e?e:Lc.get(e)||bi,t):r},t.x=function(e){return arguments.length?(a=e,t):a},t.y=function(e){return arguments.length?(o=e,t):o},t.out=function(e){return arguments.length?(i=e,t):i},t};var Ac=fo.map({"inside-out":function(t){var e,n,r=t.length,i=t.map(Mi),a=t.map(_i),o=fo.range(r).sort(function(t,e){return i[t]-i[e]}),s=0,c=0,u=[],l=[];for(e=0;e<r;++e)n=o[e],s<c?(s+=a[n],u.push(n)):(c+=a[n],l.push(n));return l.reverse().concat(u)},reverse:function(t){return fo.range(t.length).reverse()},"default":xi}),Lc=fo.map({silhouette:function(t){var e,n,r,i=t.length,a=t[0].length,o=[],s=0,c=[];for(n=0;n<a;++n){for(e=0,r=0;e<i;e++)r+=t[e][n][1];r>s&&(s=r),o.push(r)}for(n=0;n<a;++n)c[n]=(s-o[n])/2;return c},wiggle:function(t){var e,n,r,i,a,o,s,c,u,l=t.length,h=t[0],f=h.length,p=[];for(p[0]=c=u=0,n=1;n<f;++n){for(e=0,i=0;e<l;++e)i+=t[e][n][1];for(e=0,a=0,s=h[n][0]-h[n-1][0];e<l;++e){for(r=0,o=(t[e][n][1]-t[e][n-1][1])/(2*s);r<e;++r)o+=(t[r][n][1]-t[r][n-1][1])/s;a+=o*t[e][n][1]}p[n]=c-=i?a/i*s:0,c<u&&(u=c)}for(n=0;n<f;++n)p[n]-=u;return p},expand:function(t){var e,n,r,i=t.length,a=t[0].length,o=1/i,s=[];for(n=0;n<a;++n){for(e=0,r=0;e<i;e++)r+=t[e][n][1];if(r)for(e=0;e<i;e++)t[e][n][1]/=r;else for(e=0;e<i;e++)t[e][n][1]=o}for(n=0;n<a;++n)s[n]=0;return s},zero:bi});fo.layout.histogram=function(){function t(t,a){for(var o,s,c=[],u=t.map(n,this),l=r.call(this,u,a),h=i.call(this,l,u,a),a=-1,f=u.length,p=h.length-1,d=e?1:1/f;++a<p;)o=c[a]=[],o.dx=h[a+1]-(o.x=h[a]),o.y=0;if(p>0)for(a=-1;++a<f;)s=u[a],s>=l[0]&&s<=l[1]&&(o=c[fo.bisect(h,s,1,p)-1],o.y+=d,o.push(t[a]));return c}var e=!0,n=Number,r=Ti,i=Si;return t.value=function(e){return arguments.length?(n=e,t):n},t.range=function(e){return arguments.length?(r=Pt(e),t):r},t.bins=function(e){return arguments.length?(i="number"==typeof e?function(t){return Ei(t,e)}:Pt(e),t):i},t.frequency=function(n){return arguments.length?(e=!!n,t):e},t},fo.layout.pack=function(){function t(t,a){var o=n.call(this,t,a),s=o[0],c=i[0],u=i[1],l=null==e?Math.sqrt:"function"==typeof e?e:function(){return e};if(s.x=s.y=0,hi(s,function(t){t.r=+l(t.value)}),hi(s,Pi),r){var h=r*(e?1:Math.max(2*s.r/c,2*s.r/u))/2;hi(s,function(t){t.r+=h}),hi(s,Pi),hi(s,function(t){t.r-=h})}return Ui(s,c/2,u/2,e?1:1/Math.max(2*s.r/c,2*s.r/u)),o}var e,n=fo.layout.hierarchy().sort(Ai),r=0,i=[1,1];return t.size=function(e){return arguments.length?(i=e,t):i},t.radius=function(n){return arguments.length?(e=null==n||"function"==typeof n?n:+n,t):e},t.padding=function(e){return arguments.length?(r=+e,t):r},ui(t,n)},fo.layout.tree=function(){function t(t,i){var l=o.call(this,t,i),h=l[0],f=e(h);if(hi(f,n),f.parent.m=-f.z,li(f,r),u)li(h,a);else{var p=h,d=h,m=h;li(h,function(t){t.x<p.x&&(p=t),t.x>d.x&&(d=t),t.depth>m.depth&&(m=t)});var g=s(p,d)/2-p.x,v=c[0]/(d.x+s(d,p)/2+g),y=c[1]/(m.depth||1);li(h,function(t){t.x=(t.x+g)*v,t.y=t.depth*y})}return l}function e(t){for(var e,n={A:null,children:[t]},r=[n];null!=(e=r.pop());)for(var i,a=e.children,o=0,s=a.length;o<s;++o)r.push((a[o]=i={_:a[o],parent:e,children:(i=a[o].children)&&i.slice()||[],A:null,a:null,z:0,m:0,c:0,s:0,t:null,i:o}).a=i);return n.children[0]}function n(t){var e=t.children,n=t.parent.children,r=t.i?n[t.i-1]:null;if(e.length){Gi(t);var a=(e[0].z+e[e.length-1].z)/2;r?(t.z=r.z+s(t._,r._),t.m=t.z-a):t.z=a}else r&&(t.z=r.z+s(t._,r._));t.parent.A=i(t,r,t.parent.A||n[0])}function r(t){t._.x=t.z+t.parent.m,t.m+=t.parent.m}function i(t,e,n){if(e){for(var r,i=t,a=t,o=e,c=i.parent.children[0],u=i.m,l=a.m,h=o.m,f=c.m;o=Fi(o),i=Oi(i),o&&i;)c=Oi(c),a=Fi(a),a.a=t,r=o.z+h-i.z-u+s(o._,i._),r>0&&(Vi(ki(o,t,n),t,r),u+=r,l+=r),h+=o.m,u+=i.m,f+=c.m,l+=a.m;o&&!Fi(a)&&(a.t=o,a.m+=h-l),i&&!Oi(c)&&(c.t=i,c.m+=u-f,n=t)}return n}function a(t){t.x*=c[0],t.y=t.depth*c[1]}var o=fo.layout.hierarchy().sort(null).value(null),s=Ii,c=[1,1],u=null;return t.separation=function(e){return arguments.length?(s=e,t):s},t.size=function(e){return arguments.length?(u=null==(c=e)?a:null,t):u?null:c},t.nodeSize=function(e){return arguments.length?(u=null==(c=e)?null:a,t):u?c:null},ui(t,o)},fo.layout.cluster=function(){function t(t,a){var o,s=e.call(this,t,a),c=s[0],u=0;hi(c,function(t){var e=t.children;e&&e.length?(t.x=Hi(e),t.y=zi(e)):(t.x=o?u+=n(t,o):0,t.y=0,o=t)});var l=ji(c),h=Wi(c),f=l.x-n(l,h)/2,p=h.x+n(h,l)/2;return hi(c,i?function(t){t.x=(t.x-c.x)*r[0],t.y=(c.y-t.y)*r[1]}:function(t){t.x=(t.x-f)/(p-f)*r[0],t.y=(1-(c.y?t.y/c.y:1))*r[1]}),s}var e=fo.layout.hierarchy().sort(null).value(null),n=Ii,r=[1,1],i=!1;return t.separation=function(e){return arguments.length?(n=e,t):n},t.size=function(e){return arguments.length?(i=null==(r=e),t):i?null:r},t.nodeSize=function(e){return arguments.length?(i=null!=(r=e),t):i?r:null},ui(t,e)},fo.layout.treemap=function(){function t(t,e){for(var n,r,i=-1,a=t.length;++i<a;)r=(n=t[i]).value*(e<0?0:e),n.area=isNaN(r)||r<=0?0:r}function e(n){var a=n.children;if(a&&a.length){var o,s,c,u=h(n),l=[],f=a.slice(),d=1/0,m="slice"===p?u.dx:"dice"===p?u.dy:"slice-dice"===p?1&n.depth?u.dy:u.dx:Math.min(u.dx,u.dy);for(t(f,u.dx*u.dy/n.value),l.area=0;(c=f.length)>0;)l.push(o=f[c-1]),l.area+=o.area,"squarify"!==p||(s=r(l,m))<=d?(f.pop(),d=s):(l.area-=l.pop().area,i(l,m,u,!1),m=Math.min(u.dx,u.dy),l.length=l.area=0,d=1/0);l.length&&(i(l,m,u,!0),l.length=l.area=0),a.forEach(e)}}function n(e){var r=e.children;if(r&&r.length){var a,o=h(e),s=r.slice(),c=[];for(t(s,o.dx*o.dy/e.value),c.area=0;a=s.pop();)c.push(a),c.area+=a.area,null!=a.z&&(i(c,a.z?o.dx:o.dy,o,!s.length),c.length=c.area=0);r.forEach(n)}}function r(t,e){for(var n,r=t.area,i=0,a=1/0,o=-1,s=t.length;++o<s;)(n=t[o].area)&&(n<a&&(a=n),n>i&&(i=n));return r*=r,e*=e,r?Math.max(e*i*d/r,r/(e*a*d)):1/0}function i(t,e,n,r){var i,a=-1,o=t.length,s=n.x,u=n.y,l=e?c(t.area/e):0;if(e==n.dx){for((r||l>n.dy)&&(l=n.dy);++a<o;)i=t[a],i.x=s,i.y=u,i.dy=l,s+=i.dx=Math.min(n.x+n.dx-s,l?c(i.area/l):0);i.z=!0,i.dx+=n.x+n.dx-s,n.y+=l,n.dy-=l}else{for((r||l>n.dx)&&(l=n.dx);++a<o;)i=t[a],i.x=s,i.y=u,i.dx=l,u+=i.dy=Math.min(n.y+n.dy-u,l?c(i.area/l):0);i.z=!1,i.dy+=n.y+n.dy-u,n.x+=l,n.dx-=l}}function a(r){var i=o||s(r),a=i[0];return a.x=a.y=0,a.value?(a.dx=u[0],a.dy=u[1]):a.dx=a.dy=0,o&&s.revalue(a),t([a],a.dx*a.dy/a.value),(o?n:e)(a),f&&(o=i),i}var o,s=fo.layout.hierarchy(),c=Math.round,u=[1,1],l=null,h=Xi,f=!1,p="squarify",d=.5*(1+Math.sqrt(5));return a.size=function(t){return arguments.length?(u=t,a):u},a.padding=function(t){function e(e){var n=t.call(a,e,e.depth);return null==n?Xi(e):qi(e,"number"==typeof n?[n,n,n,n]:n)}function n(e){return qi(e,t)}if(!arguments.length)return l;var r;return h=null==(l=t)?Xi:"function"==(r=typeof t)?e:"number"===r?(t=[t,t,t,t],n):n,a},a.round=function(t){return arguments.length?(c=t?Math.round:Number,a):c!=Number},a.sticky=function(t){return arguments.length?(f=t,o=null,a):f},a.ratio=function(t){return arguments.length?(d=t,a):d},a.mode=function(t){return arguments.length?(p=t+"",a):p},ui(a,s)},fo.random={normal:function(t,e){var n=arguments.length;return n<2&&(e=1),n<1&&(t=0),function(){var n,r,i;do n=2*Math.random()-1,r=2*Math.random()-1,i=n*n+r*r;while(!i||i>1);return t+e*n*Math.sqrt(-2*Math.log(i)/i)}},logNormal:function(){var t=fo.random.normal.apply(fo,arguments);return function(){return Math.exp(t())}},bates:function(t){var e=fo.random.irwinHall(t);return function(){return e()/t}},irwinHall:function(t){return function(){for(var e=0,n=0;n<t;n++)e+=Math.random();return e}}},fo.scale={};var Cc={floor:w,ceil:w};fo.scale.linear=function(){return ta([0,1],[0,1],Sr,!1)};var Rc={s:1,g:1,p:1,r:1,e:1};fo.scale.log=function(){return ca(fo.scale.linear().domain([0,1]),10,!0,[1,10])};var Pc=fo.format(".0e"),Dc={floor:function(t){return-Math.ceil(-t)},ceil:function(t){return-Math.floor(-t)}};fo.scale.pow=function(){return ua(fo.scale.linear(),1,[0,1])},fo.scale.sqrt=function(){return fo.scale.pow().exponent(.5)},fo.scale.ordinal=function(){return ha([],{t:"range",a:[[]]})},fo.scale.category10=function(){return fo.scale.ordinal().range(Nc)},fo.scale.category20=function(){return fo.scale.ordinal().range(Uc)},fo.scale.category20b=function(){return fo.scale.ordinal().range(Bc)},fo.scale.category20c=function(){return fo.scale.ordinal().range(Ic)};var Nc=[2062260,16744206,2924588,14034728,9725885,9197131,14907330,8355711,12369186,1556175].map(St),Uc=[2062260,11454440,16744206,16759672,2924588,10018698,14034728,16750742,9725885,12955861,9197131,12885140,14907330,16234194,8355711,13092807,12369186,14408589,1556175,10410725].map(St),Bc=[3750777,5395619,7040719,10264286,6519097,9216594,11915115,13556636,9202993,12426809,15186514,15190932,8666169,11356490,14049643,15177372,8077683,10834324,13528509,14589654].map(St),Ic=[3244733,7057110,10406625,13032431,15095053,16616764,16625259,16634018,3253076,7652470,10607003,13101504,7695281,10394312,12369372,14342891,6513507,9868950,12434877,14277081].map(St);fo.scale.quantile=function(){return fa([],[])},fo.scale.quantize=function(){return pa(0,1,[0,1])},fo.scale.threshold=function(){return da([.5],[0,1])},fo.scale.identity=function(){return ma([0,1])},fo.svg={},fo.svg.arc=function(){function t(){var t=Math.max(0,+n.apply(this,arguments)),u=Math.max(0,+r.apply(this,arguments)),l=o.apply(this,arguments)-qo,h=s.apply(this,arguments)-qo,f=Math.abs(h-l),p=l>h?0:1;if(u<t&&(d=u,u=t,t=d),f>=Xo)return e(u,p)+(t?e(t,1-p):"")+"Z";var d,m,g,v,y,x,b,M,_,w,S,E,T=0,A=0,L=[];if((v=(+c.apply(this,arguments)||0)/2)&&(g=a===Oc?Math.sqrt(t*t+u*u):+a.apply(this,arguments),p||(A*=-1),u&&(A=ot(g/u*Math.sin(v))),t&&(T=ot(g/t*Math.sin(v)))),u){y=u*Math.cos(l+A),x=u*Math.sin(l+A),b=u*Math.cos(h-A),M=u*Math.sin(h-A);var C=Math.abs(h-l-2*A)<=jo?0:1;if(A&&_a(y,x,b,M)===p^C){var R=(l+h)/2;y=u*Math.cos(R),x=u*Math.sin(R),b=M=null}}else y=x=0;if(t){_=t*Math.cos(h-T),w=t*Math.sin(h-T),S=t*Math.cos(l+T),E=t*Math.sin(l+T);var P=Math.abs(l-h+2*T)<=jo?0:1;if(T&&_a(_,w,S,E)===1-p^P){var D=(l+h)/2;_=t*Math.cos(D),w=t*Math.sin(D),S=E=null}}else _=w=0;if(f>zo&&(d=Math.min(Math.abs(u-t)/2,+i.apply(this,arguments)))>.001){m=t<u^p?0:1;var N=d,U=d;if(f<jo){var B=null==S?[_,w]:null==b?[y,x]:Vn([y,x],[S,E],[b,M],[_,w]),I=y-B[0],O=x-B[1],F=b-B[0],V=M-B[1],G=1/Math.sin(Math.acos((I*F+O*V)/(Math.sqrt(I*I+O*O)*Math.sqrt(F*F+V*V)))/2),k=Math.sqrt(B[0]*B[0]+B[1]*B[1]);U=Math.min(d,(t-k)/(G-1)),N=Math.min(d,(u-k)/(G+1))}if(null!=b){var z=wa(null==S?[_,w]:[S,E],[y,x],u,N,p),H=wa([b,M],[_,w],u,N,p);d===N?L.push("M",z[0],"A",N,",",N," 0 0,",m," ",z[1],"A",u,",",u," 0 ",1-p^_a(z[1][0],z[1][1],H[1][0],H[1][1]),",",p," ",H[1],"A",N,",",N," 0 0,",m," ",H[0]):L.push("M",z[0],"A",N,",",N," 0 1,",m," ",H[0])}else L.push("M",y,",",x);if(null!=S){var j=wa([y,x],[S,E],t,-U,p),W=wa([_,w],null==b?[y,x]:[b,M],t,-U,p);d===U?L.push("L",W[0],"A",U,",",U," 0 0,",m," ",W[1],"A",t,",",t," 0 ",p^_a(W[1][0],W[1][1],j[1][0],j[1][1]),",",1-p," ",j[1],"A",U,",",U," 0 0,",m," ",j[0]):L.push("L",W[0],"A",U,",",U," 0 0,",m," ",j[0])}else L.push("L",_,",",w)}else L.push("M",y,",",x),null!=b&&L.push("A",u,",",u," 0 ",C,",",p," ",b,",",M),L.push("L",_,",",w),null!=S&&L.push("A",t,",",t," 0 ",P,",",1-p," ",S,",",E);return L.push("Z"),L.join("")}function e(t,e){return"M0,"+t+"A"+t+","+t+" 0 1,"+e+" 0,"+-t+"A"+t+","+t+" 0 1,"+e+" 0,"+t}var n=va,r=ya,i=ga,a=Oc,o=xa,s=ba,c=Ma;return t.innerRadius=function(e){return arguments.length?(n=Pt(e),t):n},t.outerRadius=function(e){return arguments.length?(r=Pt(e),t):r},t.cornerRadius=function(e){return arguments.length?(i=Pt(e),t):i},t.padRadius=function(e){return arguments.length?(a=e==Oc?Oc:Pt(e),t):a},t.startAngle=function(e){return arguments.length?(o=Pt(e),t):o},t.endAngle=function(e){return arguments.length?(s=Pt(e),t):s},t.padAngle=function(e){return arguments.length?(c=Pt(e),t):c},t.centroid=function(){var t=(+n.apply(this,arguments)+ +r.apply(this,arguments))/2,e=(+o.apply(this,arguments)+ +s.apply(this,arguments))/2-qo;return[Math.cos(e)*t,Math.sin(e)*t]},t};var Oc="auto";fo.svg.line=function(){return Sa(w)};var Fc=fo.map({linear:Ea,"linear-closed":Ta,step:Aa,"step-before":La,"step-after":Ca,basis:Ba,"basis-open":Ia,"basis-closed":Oa,bundle:Fa,cardinal:Da,"cardinal-open":Ra,"cardinal-closed":Pa,monotone:ja});Fc.forEach(function(t,e){e.key=t,e.closed=/-closed$/.test(t)});var Vc=[0,2/3,1/3,0],Gc=[0,1/3,2/3,0],kc=[0,1/6,2/3,1/6];fo.svg.line.radial=function(){var t=Sa(Wa);return t.radius=t.x,delete t.x,t.angle=t.y,delete t.y,t},La.reverse=Ca,Ca.reverse=La,fo.svg.area=function(){return Xa(w)},fo.svg.area.radial=function(){var t=Xa(Wa);return t.radius=t.x,delete t.x,t.innerRadius=t.x0,delete t.x0,t.outerRadius=t.x1,delete t.x1,t.angle=t.y,delete t.y,t.startAngle=t.y0,delete t.y0,t.endAngle=t.y1,delete t.y1,t},fo.svg.chord=function(){function t(t,s){var c=e(this,a,t,s),u=e(this,o,t,s);return"M"+c.p0+r(c.r,c.p1,c.a1-c.a0)+(n(c,u)?i(c.r,c.p1,c.r,c.p0):i(c.r,c.p1,u.r,u.p0)+r(u.r,u.p1,u.a1-u.a0)+i(u.r,u.p1,c.r,c.p0))+"Z"}function e(t,e,n,r){var i=e.call(t,n,r),a=s.call(t,i,r),o=c.call(t,i,r)-qo,l=u.call(t,i,r)-qo;return{r:a,a0:o,a1:l,p0:[a*Math.cos(o),a*Math.sin(o)],p1:[a*Math.cos(l),a*Math.sin(l)]}}function n(t,e){return t.a0==e.a0&&t.a1==e.a1}function r(t,e,n){return"A"+t+","+t+" 0 "+ +(n>jo)+",1 "+e}function i(t,e,n,r){return"Q 0,0 "+r}var a=Sn,o=En,s=qa,c=xa,u=ba;return t.radius=function(e){return arguments.length?(s=Pt(e),t):s},t.source=function(e){return arguments.length?(a=Pt(e),t):a},t.target=function(e){return arguments.length?(o=Pt(e),t):o},t.startAngle=function(e){return arguments.length?(c=Pt(e),t):c},t.endAngle=function(e){return arguments.length?(u=Pt(e),t):u},t},fo.svg.diagonal=function(){function t(t,i){var a=e.call(this,t,i),o=n.call(this,t,i),s=(a.y+o.y)/2,c=[a,{x:a.x,y:s},{x:o.x,y:s},o];return c=c.map(r),"M"+c[0]+"C"+c[1]+" "+c[2]+" "+c[3]}var e=Sn,n=En,r=Ya;return t.source=function(n){return arguments.length?(e=Pt(n),t):e},t.target=function(e){return arguments.length?(n=Pt(e),t):n},t.projection=function(e){return arguments.length?(r=e,t):r},t},fo.svg.diagonal.radial=function(){var t=fo.svg.diagonal(),e=Ya,n=t.projection;return t.projection=function(t){return arguments.length?n(Za(e=t)):e},t},fo.svg.symbol=function(){function t(t,r){return(zc.get(e.call(this,t,r))||Ja)(n.call(this,t,r))}var e=Qa,n=Ka;return t.type=function(n){return arguments.length?(e=Pt(n),t):e},t.size=function(e){return arguments.length?(n=Pt(e),t):n},t};var zc=fo.map({circle:Ja,cross:function(t){var e=Math.sqrt(t/5)/2;return"M"+-3*e+","+-e+"H"+-e+"V"+-3*e+"H"+e+"V"+-e+"H"+3*e+"V"+e+"H"+e+"V"+3*e+"H"+-e+"V"+e+"H"+-3*e+"Z"},diamond:function(t){var e=Math.sqrt(t/(2*jc)),n=e*jc;return"M0,"+-e+"L"+n+",0 0,"+e+" "+-n+",0Z"},square:function(t){var e=Math.sqrt(t)/2;return"M"+-e+","+-e+"L"+e+","+-e+" "+e+","+e+" "+-e+","+e+"Z"},"triangle-down":function(t){var e=Math.sqrt(t/Hc),n=e*Hc/2;return"M0,"+n+"L"+e+","+-n+" "+-e+","+-n+"Z"},"triangle-up":function(t){var e=Math.sqrt(t/Hc),n=e*Hc/2;return"M0,"+-n+"L"+e+","+n+" "+-e+","+n+"Z"}});fo.svg.symbolTypes=zc.keys();var Hc=Math.sqrt(3),jc=Math.tan(30*Yo);Uo.transition=function(t){for(var e,n,r=Wc||++Zc,i=ro(t),a=[],o=Xc||{time:Date.now(),ease:Pr,delay:0,duration:250},s=-1,c=this.length;++s<c;){a.push(e=[]);for(var u=this[s],l=-1,h=u.length;++l<h;)(n=u[l])&&io(n,l,i,r,o),e.push(n)}return to(a,i,r)},Uo.interrupt=function(t){return this.each(null==t?qc:$a(ro(t)))};var Wc,Xc,qc=$a(ro()),Yc=[],Zc=0;Yc.call=Uo.call,Yc.empty=Uo.empty,Yc.node=Uo.node,Yc.size=Uo.size,fo.transition=function(t,e){return t&&t.transition?Wc?t.transition(e):t:fo.selection().transition(t)},fo.transition.prototype=Yc,Yc.select=function(t){var e,n,r,i=this.id,a=this.namespace,o=[];t=N(t);for(var s=-1,c=this.length;++s<c;){o.push(e=[]);for(var u=this[s],l=-1,h=u.length;++l<h;)(r=u[l])&&(n=t.call(r,r.__data__,l,s))?("__data__"in r&&(n.__data__=r.__data__),io(n,l,a,i,r[a][i]),e.push(n)):e.push(null)}return to(o,a,i)},Yc.selectAll=function(t){var e,n,r,i,a,o=this.id,s=this.namespace,c=[];t=U(t);for(var u=-1,l=this.length;++u<l;)for(var h=this[u],f=-1,p=h.length;++f<p;)if(r=h[f]){a=r[s][o],n=t.call(r,r.__data__,f,u),c.push(e=[]);for(var d=-1,m=n.length;++d<m;)(i=n[d])&&io(i,d,s,o,a),e.push(i)}return to(c,s,o)},Yc.filter=function(t){var e,n,r,i=[];"function"!=typeof t&&(t=X(t));for(var a=0,o=this.length;a<o;a++){i.push(e=[]);for(var n=this[a],s=0,c=n.length;s<c;s++)(r=n[s])&&t.call(r,r.__data__,s,a)&&e.push(r)}return to(i,this.namespace,this.id)},Yc.tween=function(t,e){var n=this.id,r=this.namespace;return arguments.length<2?this.node()[r][n].tween.get(t):Y(this,null==e?function(e){e[r][n].tween.remove(t)}:function(i){i[r][n].tween.set(t,e)})},Yc.attr=function(t,e){function n(){this.removeAttribute(s)}function r(){this.removeAttributeNS(s.space,s.local)}function i(t){return null==t?n:(t+="",function(){var e,n=this.getAttribute(s);return n!==t&&(e=o(n,t),function(t){this.setAttribute(s,e(t))})})}function a(t){return null==t?r:(t+="",function(){var e,n=this.getAttributeNS(s.space,s.local);return n!==t&&(e=o(n,t),function(t){this.setAttributeNS(s.space,s.local,e(t))})})}if(arguments.length<2){for(e in t)this.attr(e,t[e]);return this}var o="transform"==t?Jr:Sr,s=fo.ns.qualify(t);return eo(this,"attr."+t,e,s.local?a:i)},Yc.attrTween=function(t,e){function n(t,n){var r=e.call(this,t,n,this.getAttribute(i));return r&&function(t){this.setAttribute(i,r(t))}}function r(t,n){var r=e.call(this,t,n,this.getAttributeNS(i.space,i.local));return r&&function(t){this.setAttributeNS(i.space,i.local,r(t))}}var i=fo.ns.qualify(t);return this.tween("attr."+t,i.local?r:n)},Yc.style=function(t,e,n){function r(){this.style.removeProperty(t)}function i(e){return null==e?r:(e+="",function(){var r,i=o(this).getComputedStyle(this,null).getPropertyValue(t);return i!==e&&(r=Sr(i,e),function(e){this.style.setProperty(t,r(e),n)})})}var a=arguments.length;if(a<3){if("string"!=typeof t){a<2&&(e="");for(n in t)this.style(n,t[n],e);return this}n=""}return eo(this,"style."+t,e,i)},Yc.styleTween=function(t,e,n){function r(r,i){var a=e.call(this,r,i,o(this).getComputedStyle(this,null).getPropertyValue(t));return a&&function(e){this.style.setProperty(t,a(e),n)}}return arguments.length<3&&(n=""),this.tween("style."+t,r)},Yc.text=function(t){return eo(this,"text",t,no)},Yc.remove=function(){var t=this.namespace;return this.each("end.transition",function(){var e;this[t].count<2&&(e=this.parentNode)&&e.removeChild(this)})},Yc.ease=function(t){var e=this.id,n=this.namespace;return arguments.length<1?this.node()[n][e].ease:("function"!=typeof t&&(t=fo.ease.apply(fo,arguments)),Y(this,function(r){r[n][e].ease=t}))},Yc.delay=function(t){var e=this.id,n=this.namespace;return arguments.length<1?this.node()[n][e].delay:Y(this,"function"==typeof t?function(r,i,a){r[n][e].delay=+t.call(r,r.__data__,i,a)}:(t=+t,function(r){r[n][e].delay=t}))},Yc.duration=function(t){var e=this.id,n=this.namespace;return arguments.length<1?this.node()[n][e].duration:Y(this,"function"==typeof t?function(r,i,a){r[n][e].duration=Math.max(1,t.call(r,r.__data__,i,a))}:(t=Math.max(1,t),function(r){r[n][e].duration=t}))},Yc.each=function(t,e){var n=this.id,r=this.namespace;if(arguments.length<2){var i=Xc,a=Wc;try{Wc=n,Y(this,function(e,i,a){Xc=e[r][n],t.call(e,e.__data__,i,a)})}finally{Xc=i,Wc=a}}else Y(this,function(i){var a=i[r][n];(a.event||(a.event=fo.dispatch("start","end","interrupt"))).on(t,e)});return this},Yc.transition=function(){for(var t,e,n,r,i=this.id,a=++Zc,o=this.namespace,s=[],c=0,u=this.length;c<u;c++){s.push(t=[]);for(var e=this[c],l=0,h=e.length;l<h;l++)(n=e[l])&&(r=n[o][i],io(n,l,o,a,{time:r.time,ease:r.ease,delay:r.delay+r.duration,duration:r.duration})),t.push(n)}return to(s,o,a)},fo.svg.axis=function(){function t(t){t.each(function(){var t,u=fo.select(this),l=this.__chart__||n,h=this.__chart__=n.copy(),f=null==c?h.ticks?h.ticks.apply(h,s):h.domain():c,p=null==e?h.tickFormat?h.tickFormat.apply(h,s):w:e,d=u.selectAll(".tick").data(f,h),m=d.enter().insert("g",".domain").attr("class","tick").style("opacity",zo),g=fo.transition(d.exit()).style("opacity",zo).remove(),v=fo.transition(d.order()).style("opacity",1),y=Math.max(i,0)+o,x=Zi(h),b=u.selectAll(".domain").data([0]),M=(b.enter().append("path").attr("class","domain"),fo.transition(b));m.append("line"),m.append("text");var _,S,E,T,A=m.select("line"),L=v.select("line"),C=d.select("text").text(p),R=m.select("text"),P=v.select("text"),D="top"===r||"left"===r?-1:1;if("bottom"===r||"top"===r?(t=ao,_="x",E="y",S="x2",T="y2",C.attr("dy",D<0?"0em":".71em").style("text-anchor","middle"),M.attr("d","M"+x[0]+","+D*a+"V0H"+x[1]+"V"+D*a)):(t=oo,_="y",E="x",S="y2",T="x2",C.attr("dy",".32em").style("text-anchor",D<0?"end":"start"),M.attr("d","M"+D*a+","+x[0]+"H0V"+x[1]+"H"+D*a)),A.attr(T,D*i),R.attr(E,D*y),L.attr(S,0).attr(T,D*i),P.attr(_,0).attr(E,D*y),h.rangeBand){var N=h,U=N.rangeBand()/2;l=h=function(t){return N(t)+U}}else l.rangeBand?l=h:g.call(t,h,l);m.call(t,l,h),v.call(t,h,h)})}var e,n=fo.scale.linear(),r=Kc,i=6,a=6,o=3,s=[10],c=null;return t.scale=function(e){return arguments.length?(n=e,t):n},t.orient=function(e){return arguments.length?(r=e in Qc?e+"":Kc,t):r},t.ticks=function(){return arguments.length?(s=mo(arguments),t):s},t.tickValues=function(e){return arguments.length?(c=e,t):c},t.tickFormat=function(n){
-return arguments.length?(e=n,t):e},t.tickSize=function(e){var n=arguments.length;return n?(i=+e,a=+arguments[n-1],t):i},t.innerTickSize=function(e){return arguments.length?(i=+e,t):i},t.outerTickSize=function(e){return arguments.length?(a=+e,t):a},t.tickPadding=function(e){return arguments.length?(o=+e,t):o},t.tickSubdivide=function(){return arguments.length&&t},t};var Kc="bottom",Qc={top:1,right:1,bottom:1,left:1};fo.svg.brush=function(){function t(a){a.each(function(){var a=fo.select(this).style("pointer-events","all").style("-webkit-tap-highlight-color","rgba(0,0,0,0)").on("mousedown.brush",i).on("touchstart.brush",i),o=a.selectAll(".background").data([0]);o.enter().append("rect").attr("class","background").style("visibility","hidden").style("cursor","crosshair"),a.selectAll(".extent").data([0]).enter().append("rect").attr("class","extent").style("cursor","move");var s=a.selectAll(".resize").data(m,w);s.exit().remove(),s.enter().append("g").attr("class",function(t){return"resize "+t}).style("cursor",function(t){return Jc[t]}).append("rect").attr("x",function(t){return/[ew]$/.test(t)?-3:null}).attr("y",function(t){return/^[ns]/.test(t)?-3:null}).attr("width",6).attr("height",6).style("visibility","hidden"),s.style("display",t.empty()?"none":null);var c,h=fo.transition(a),f=fo.transition(o);u&&(c=Zi(u),f.attr("x",c[0]).attr("width",c[1]-c[0]),n(h)),l&&(c=Zi(l),f.attr("y",c[0]).attr("height",c[1]-c[0]),r(h)),e(h)})}function e(t){t.selectAll(".resize").attr("transform",function(t){return"translate("+h[+/e$/.test(t)]+","+f[+/^s/.test(t)]+")"})}function n(t){t.select(".extent").attr("x",h[0]),t.selectAll(".extent,.n>rect,.s>rect").attr("width",h[1]-h[0])}function r(t){t.select(".extent").attr("y",f[0]),t.selectAll(".extent,.e>rect,.w>rect").attr("height",f[1]-f[0])}function i(){function i(){32==fo.event.keyCode&&(L||(x=null,P[0]-=h[1],P[1]-=f[1],L=2),C())}function m(){32==fo.event.keyCode&&2==L&&(P[0]+=h[1],P[1]+=f[1],L=0,C())}function g(){var t=fo.mouse(M),i=!1;b&&(t[0]+=b[0],t[1]+=b[1]),L||(fo.event.altKey?(x||(x=[(h[0]+h[1])/2,(f[0]+f[1])/2]),P[0]=h[+(t[0]<x[0])],P[1]=f[+(t[1]<x[1])]):x=null),T&&v(t,u,0)&&(n(S),i=!0),A&&v(t,l,1)&&(r(S),i=!0),i&&(e(S),w({type:"brush",mode:L?"move":"resize"}))}function v(t,e,n){var r,i,o=Zi(e),c=o[0],u=o[1],l=P[n],m=n?f:h,g=m[1]-m[0];if(L&&(c-=l,u-=g+l),r=(n?d:p)?Math.max(c,Math.min(u,t[n])):t[n],L?i=(r+=l)+g:(x&&(l=Math.max(c,Math.min(u,2*x[n]-r))),l<r?(i=r,r=l):i=l),m[0]!=r||m[1]!=i)return n?s=null:a=null,m[0]=r,m[1]=i,!0}function y(){g(),S.style("pointer-events","all").selectAll(".resize").style("display",t.empty()?"none":null),fo.select("body").style("cursor",null),D.on("mousemove.brush",null).on("mouseup.brush",null).on("touchmove.brush",null).on("touchend.brush",null).on("keydown.brush",null).on("keyup.brush",null),R(),w({type:"brushend"})}var x,b,M=this,_=fo.select(fo.event.target),w=c.of(M,arguments),S=fo.select(M),E=_.datum(),T=!/^(n|s)$/.test(E)&&u,A=!/^(e|w)$/.test(E)&&l,L=_.classed("extent"),R=tt(M),P=fo.mouse(M),D=fo.select(o(M)).on("keydown.brush",i).on("keyup.brush",m);if(fo.event.changedTouches?D.on("touchmove.brush",g).on("touchend.brush",y):D.on("mousemove.brush",g).on("mouseup.brush",y),S.interrupt().selectAll("*").interrupt(),L)P[0]=h[0]-P[0],P[1]=f[0]-P[1];else if(E){var N=+/w$/.test(E),U=+/^n/.test(E);b=[h[1-N]-P[0],f[1-U]-P[1]],P[0]=h[N],P[1]=f[U]}else fo.event.altKey&&(x=P.slice());S.style("pointer-events","none").selectAll(".resize").style("display",null),fo.select("body").style("cursor",_.style("cursor")),w({type:"brushstart"}),g()}var a,s,c=P(t,"brushstart","brush","brushend"),u=null,l=null,h=[0,0],f=[0,0],p=!0,d=!0,m=$c[0];return t.event=function(t){t.each(function(){var t=c.of(this,arguments),e={x:h,y:f,i:a,j:s},n=this.__chart__||e;this.__chart__=e,Wc?fo.select(this).transition().each("start.brush",function(){a=n.i,s=n.j,h=n.x,f=n.y,t({type:"brushstart"})}).tween("brush:brush",function(){var n=Er(h,e.x),r=Er(f,e.y);return a=s=null,function(i){h=e.x=n(i),f=e.y=r(i),t({type:"brush",mode:"resize"})}}).each("end.brush",function(){a=e.i,s=e.j,t({type:"brush",mode:"resize"}),t({type:"brushend"})}):(t({type:"brushstart"}),t({type:"brush",mode:"resize"}),t({type:"brushend"}))})},t.x=function(e){return arguments.length?(u=e,m=$c[!u<<1|!l],t):u},t.y=function(e){return arguments.length?(l=e,m=$c[!u<<1|!l],t):l},t.clamp=function(e){return arguments.length?(u&&l?(p=!!e[0],d=!!e[1]):u?p=!!e:l&&(d=!!e),t):u&&l?[p,d]:u?p:l?d:null},t.extent=function(e){var n,r,i,o,c;return arguments.length?(u&&(n=e[0],r=e[1],l&&(n=n[0],r=r[0]),a=[n,r],u.invert&&(n=u(n),r=u(r)),r<n&&(c=n,n=r,r=c),n==h[0]&&r==h[1]||(h=[n,r])),l&&(i=e[0],o=e[1],u&&(i=i[1],o=o[1]),s=[i,o],l.invert&&(i=l(i),o=l(o)),o<i&&(c=i,i=o,o=c),i==f[0]&&o==f[1]||(f=[i,o])),t):(u&&(a?(n=a[0],r=a[1]):(n=h[0],r=h[1],u.invert&&(n=u.invert(n),r=u.invert(r)),r<n&&(c=n,n=r,r=c))),l&&(s?(i=s[0],o=s[1]):(i=f[0],o=f[1],l.invert&&(i=l.invert(i),o=l.invert(o)),o<i&&(c=i,i=o,o=c))),u&&l?[[n,i],[r,o]]:u?[n,r]:l&&[i,o])},t.clear=function(){return t.empty()||(h=[0,0],f=[0,0],a=s=null),t},t.empty=function(){return!!u&&h[0]==h[1]||!!l&&f[0]==f[1]},fo.rebind(t,c,"on")};var Jc={n:"ns-resize",e:"ew-resize",s:"ns-resize",w:"ew-resize",nw:"nwse-resize",ne:"nesw-resize",se:"nwse-resize",sw:"nesw-resize"},$c=[["n","e","s","w","nw","ne","se","sw"],["e","w"],["n","s"],[]],tu=xs.format=Es.timeFormat,eu=tu.utc,nu=eu("%Y-%m-%dT%H:%M:%S.%LZ");tu.iso=Date.prototype.toISOString&&+new Date("2000-01-01T00:00:00.000Z")?so:nu,so.parse=function(t){var e=new Date(t);return isNaN(e)?null:e},so.toString=nu.toString,xs.second=Wt(function(t){return new bs(1e3*Math.floor(t/1e3))},function(t,e){t.setTime(t.getTime()+1e3*Math.floor(e))},function(t){return t.getSeconds()}),xs.seconds=xs.second.range,xs.seconds.utc=xs.second.utc.range,xs.minute=Wt(function(t){return new bs(6e4*Math.floor(t/6e4))},function(t,e){t.setTime(t.getTime()+6e4*Math.floor(e))},function(t){return t.getMinutes()}),xs.minutes=xs.minute.range,xs.minutes.utc=xs.minute.utc.range,xs.hour=Wt(function(t){var e=t.getTimezoneOffset()/60;return new bs(36e5*(Math.floor(t/36e5-e)+e))},function(t,e){t.setTime(t.getTime()+36e5*Math.floor(e))},function(t){return t.getHours()}),xs.hours=xs.hour.range,xs.hours.utc=xs.hour.utc.range,xs.month=Wt(function(t){return t=xs.day(t),t.setDate(1),t},function(t,e){t.setMonth(t.getMonth()+e)},function(t){return t.getMonth()}),xs.months=xs.month.range,xs.months.utc=xs.month.utc.range;var ru=[1e3,5e3,15e3,3e4,6e4,3e5,9e5,18e5,36e5,108e5,216e5,432e5,864e5,1728e5,6048e5,2592e6,7776e6,31536e6],iu=[[xs.second,1],[xs.second,5],[xs.second,15],[xs.second,30],[xs.minute,1],[xs.minute,5],[xs.minute,15],[xs.minute,30],[xs.hour,1],[xs.hour,3],[xs.hour,6],[xs.hour,12],[xs.day,1],[xs.day,2],[xs.week,1],[xs.month,1],[xs.month,3],[xs.year,1]],au=tu.multi([[".%L",function(t){return t.getMilliseconds()}],[":%S",function(t){return t.getSeconds()}],["%I:%M",function(t){return t.getMinutes()}],["%I %p",function(t){return t.getHours()}],["%a %d",function(t){return t.getDay()&&1!=t.getDate()}],["%b %d",function(t){return 1!=t.getDate()}],["%B",function(t){return t.getMonth()}],["%Y",Ue]]),ou={range:function(t,e,n){return fo.range(Math.ceil(t/n)*n,+e,n).map(uo)},floor:w,ceil:w};iu.year=xs.year,xs.scale=function(){return co(fo.scale.linear(),iu,au)};var su=iu.map(function(t){return[t[0].utc,t[1]]}),cu=eu.multi([[".%L",function(t){return t.getUTCMilliseconds()}],[":%S",function(t){return t.getUTCSeconds()}],["%I:%M",function(t){return t.getUTCMinutes()}],["%I %p",function(t){return t.getUTCHours()}],["%a %d",function(t){return t.getUTCDay()&&1!=t.getUTCDate()}],["%b %d",function(t){return 1!=t.getUTCDate()}],["%B",function(t){return t.getUTCMonth()}],["%Y",Ue]]);su.year=xs.year.utc,xs.scale.utc=function(){return co(fo.scale.linear(),su,cu)},fo.text=Dt(function(t){return t.responseText}),fo.json=function(t,e){return Nt(t,"application/json",lo,e)},fo.html=function(t,e){return Nt(t,"text/html",ho,e)},fo.xml=Dt(function(t){return t.responseXML}),this.d3=fo,r=fo,i="function"==typeof r?r.call(e,n,e,t):r,!(void 0!==i&&(t.exports=i))}()}]); \ No newline at end of file
+!function(t){function e(r){if(n[r])return n[r].exports;var i=n[r]={i:r,l:!1,exports:{}};return t[r].call(i.exports,i,i.exports,e),i.l=!0,i.exports}var n={};return e.m=t,e.c=n,e.i=function(t){return t},e.d=function(t,n,r){e.o(t,n)||Object.defineProperty(t,n,{configurable:!1,enumerable:!0,get:r})},e.n=function(t){var n=t&&t.__esModule?function(){return t.default}:function(){return t};return e.d(n,"a",n),n},e.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},e.p="",e(e.s=5)}([function(t,e,n){"use strict";function r(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function i(t){function e(t){var e=2*Math.PI/(t*n/r);return new y(0,e,0)}var n=86400,r=.1*n,i=new b(1.98855e30,new y(0,0,0),new y(0,0,0),696342e3,"sun",e(25.38)),o=new b(3.3011e23,new y(38371302887.33682,28770253502.43919,-1175806982.200703),new y(-38787.66588423944,41093.05229662527,6918.459013107025),2439700,"mercury",e(58.64)),a=new b(4.8675e24,new y(-5377313296.255215,-108595640391.1222,-1164748440.839313),new y(34741.48284671561,-1865.747137359618,-2031.505677951714),6051800,"venus",e(-243.02)),s=new b(5.997219e24,new y(-27007428594.39665,144600702142.9538,9687450.72542131),new y(-29770.44214085218,-5568.042062189587,.3960050738736065),6371e3,"earth",e(.997)),u=new b(7.3477e22,new y(-27391801660.63208,144525214256.4551,-5966407.74730593),new y(-29515.49140447329,-6529.794009827214,-76.15838122417217),1737100,"moon",e(27.32)),c=new b(6.4171e23,new y(198382454336.9704,74229240656.11902,-3334840409.383859),new y(-7557.626093692695,24761.2652479582,704.7458490385097),3389500,"mars",e(1.026)),l=new b(1.8986e27,new y(-749650178421.0088,-320171238261.7047,18111584337.18784),new y(4982.523623046754,-11417.82925514267,-64.66474051600457),69911e3,"jupiter",e(.41)),h=new b(5.6836e26,new y(1082806087546.906,851084072618.1986,-57934875833.71094),new y(-6487.121289267689,7565.952106845154,125.4418330224025),58232e3,"saturn",e(.426)),f=new b(8.681e25,new y(-2724615970786.758,-289401931770.462,34288240158.31023),new y(671.2348901080567,-7099.101277978575,-35.28579247809205),25362e3,"uranus",e(-.71833)),d=new b(1.0243e26,new y(-2328070851258,-3891087698123.372,133743983241.2817),new y(4633.959234836657,-2767.419818371484,-49.57409060715667),24622e3,"neptune",e(.671)),p=new b(1.305e22,new y(-4551131153197.412,317539648237.7141,1282172026454.296),new y(635.4565491262041,-5762.636149150082,440.9493397386148),1186e3,"pluto",e(-6.387)),m=[i,o,a,s,u,c,l,h,f,d,p],g=function(t){return.2*Math.pow(t,.25)},v=!0,x=!1,_=void 0;try{for(var w,M=m[Symbol.iterator]();!(v=(w=M.next()).done);v=!0){var E=w.value;E.rad=g(E.rad)}}catch(t){x=!0,_=t}finally{try{!v&&M.return&&M.return()}finally{if(x)throw _}}return{bodies:m,stepsize:r,stepsPerFrame:1,scalePosition:function(t){return t.multiplyScalar(1e-9)},camera:{x:0,y:0,z:1300},collisions:!1,sunOn:t,sphereP:32,boundary:1e13,counter:"date"}}function o(t){var e=new b(1e19,new y(0,0,0),new y(0,-90,0),12,"sun",new y(0,0,w())),n=new b(1e18,new y(200,0,0),new y(0,900,0),8,"earth",new y(0,0,w())),r=[e,n];return{bodies:r,stepsize:5e-6,stepsPerFrame:300,camera:{x:0,y:0,z:250},collisions:!1,sunOn:t,sphereP:32,boundary:2e3}}function a(t){var e=new b(1e19,new y(0,0,0),new y(0,2,0),12,"sun",new y(0,0,w())),n=new b(1e18,new y(200,0,0),new y(0,900,0),8,"venus",new y(0,0,w())),r=new b(1e18,new y(-200,0,0),new y(0,-900,0),8,"earth",new y(0,0,w())),i=[e,n,r];return{bodies:i,stepsize:3e-6,stepsPerFrame:300,camera:{x:0,y:0,z:250},collisions:!1,sunOn:t,sphereP:32,boundary:2e3}}function s(t,e,n,r){e||(_=[]);for(var i=[],o=0;o<t;o++){var a=new y(f(-300,300),f(-300,300),f(-300,300)),s=new y(f(-500,500),f(-500,500),f(-500,500)),u=new y(0,w(),0),c=15*Math.random()+4;i.push(new b(1e15*(3^c),a,s,c,h(x.solar),u))}return{bodies:i,stepsize:.001,stepsPerFrame:1,camera:{x:0,y:0,z:400},collisions:r,sunOn:n,sphereP:32,boundary:2e3}}function u(t,e,n,r){var i=x[e],o=[],a=new y(0,4,0);o.push(new b(1e18,new y(0,0,0),new y(0,0,0),12,"sun",new y(0,.01,0)));for(var s=0;s<t;s++){var u=new y(f(-300,300),f(-300,300),f(-300,300)),c=new y(0,0,0),l=new y(0,w(),0),d=15*Math.random()+4;c.crossVectors(u,a).multiplyScalar(Math.random()+.1),o.push(new b(1e14*d,u,c,d,h(i),l))}return{bodies:o,stepsize:5e-4,stepsPerFrame:1,camera:{x:0,y:0,z:400},collisions:r,sunOn:n,sphereP:32,boundary:2e3}}function c(t,e){var n=function(){var n=1/p.c,r=d(x.all,3),i=m(r,3),o=i[0],a=i[1],s=i[2],u=new b(n,new y(-1,0,0),new y(t,e,0),.05,o,new y(0,w(),0)),c=new b(n,new y(-u.r.x,0,0),new y(u.v.x,u.v.y,0),.05,a,new y(0,w(),0)),l=new b(n,new y(0,0,0),new y(-2*u.v.x,-2*u.v.y),.05,s,new y(0,w(),0));return{bodies:[u,c,l],stepsize:2e-5,stepsPerFrame:5e3,camera:{x:0,y:0,z:2},collisions:!1,boundary:2e3}};return n}function l(t,e,n,r){var i={},o=new v.TextureLoader;if(e){var a=o.load("textures/"+t+"map.jpg");a.minFilter=v.LinearFilter,i.texture=a}if(n){var s=o.load("textures/"+t+"bump.jpg");s.minFilter=v.LinearFilter,i.bumpMap=s}if(r){var u=o.load("textures/"+t+"specular.jpg");u.minFilter=v.LinearFilter,i.specularMap=u}return i}function h(t){return t[f(0,t.length)]}function f(t,e){return Math.floor(Math.random()*(e-t))+t}function d(t,e){for(var n=[];n.length<e;){var r=h(t);n.indexOf(r)===-1&&n.push(r)}return n}var p=n(2);e.a=i,e.p=o,e.q=a,e.r=s,e.o=u,n.d(e,"b",function(){return M}),n.d(e,"c",function(){return E}),n.d(e,"f",function(){return T}),n.d(e,"g",function(){return S}),n.d(e,"h",function(){return A}),n.d(e,"d",function(){return L}),n.d(e,"i",function(){return R}),n.d(e,"j",function(){return P}),n.d(e,"e",function(){return C}),n.d(e,"k",function(){return N}),n.d(e,"l",function(){return I}),n.d(e,"m",function(){return U}),n.d(e,"n",function(){return O});var m=function(){function t(t,e){var n=[],r=!0,i=!1,o=void 0;try{for(var a,s=t[Symbol.iterator]();!(r=(a=s.next()).done)&&(n.push(a.value),!e||n.length!==e);r=!0);}catch(t){i=!0,o=t}finally{try{!r&&s.return&&s.return()}finally{if(i)throw o}}return n}return function(e,n){if(Array.isArray(e))return e;if(Symbol.iterator in Object(e))return t(e,n);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}(),g=function(){function t(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}return function(e,n,r){return n&&t(e.prototype,n),r&&t(e,r),e}}(),v=n(1),y=v.Vector3,x={solar:["sun","mercury","venus","earth","moon","mars","jupiter","saturn","uranus","neptune","pluto"],balls:["tennisball","softball"]};x.all=x.solar.concat(x.balls);var b=function(){function t(e,n,i,o,a,s){r(this,t),this.m=e,this.r=n,this.v=i,this.rad=o,this.texture=a,this.rot=s}return g(t,[{key:"getTexture",value:function(){return _[this.texture].texture}},{key:"getBumpMap",value:function(){return _[this.texture].bumpMap}},{key:"getSpecularMap",value:function(){return _[this.texture].specularMap}},{key:"set",value:function(t,e){return this.r=t,this.v=e,this}},{key:"clone",value:function(){return new t(this.m,this.r,this.v,this.rad,this.texture,this.rot)}}]),t}(),_={sun:l("sun",!0,!1,!1),mercury:l("mercury",!0,!0,!1),venus:l("venus",!0,!0,!1),earth:l("earth",!0,!0,!0),mars:l("mars",!0,!0,!1),moon:l("moon",!0,!0,!1),jupiter:l("jupiter",!0,!1,!1),saturn:l("saturn",!0,!1,!1),uranus:l("uranus",!0,!1,!1),neptune:l("neptune",!0,!1,!1),pluto:l("pluto",!0,!0,!1),tennisball:l("tennisball",!0,!0,!0),softball:l("softball",!0,!0,!1)},w=function(){return Math.random()/30},M=c(.30689,.12551),E=c(.39295,.09758),T=c(.18428,.58719),S=c(.46444,.39606),A=c(.43917,.45297),L=c(.40592,.23016),R=c(.38344,.37736),P=c(.0833,.12789),C=c(.350112,.07934),N=c(.08058,.58884),I=c(.55906,.34919),U=c(.51394,.30474),O=c(.41682,.33033)},function(t,e,n){"use strict";function r(){}function i(t,e){this.x=t||0,this.y=e||0}function o(t,e,n,r,a,s,u,c,l,h){Object.defineProperty(this,"id",{value:ps++}),this.uuid=ds.generateUUID(),this.name="",this.image=void 0!==t?t:o.DEFAULT_IMAGE,this.mipmaps=[],this.mapping=void 0!==e?e:o.DEFAULT_MAPPING,this.wrapS=void 0!==n?n:ua,this.wrapT=void 0!==r?r:ua,this.magFilter=void 0!==a?a:da,this.minFilter=void 0!==s?s:ma,this.anisotropy=void 0!==l?l:1,this.format=void 0!==u?u:Pa,this.type=void 0!==c?c:ga,this.offset=new i(0,0),this.repeat=new i(1,1),this.generateMipmaps=!0,this.premultiplyAlpha=!1,this.flipY=!0,this.unpackAlignment=4,this.encoding=void 0!==h?h:rs,this.version=0,this.onUpdate=null}function a(t,e,n,r){this.x=t||0,this.y=e||0,this.z=n||0,this.w=void 0!==r?r:1}function s(t,e,n){this.uuid=ds.generateUUID(),this.width=t,this.height=e,this.scissor=new a(0,0,t,e),this.scissorTest=!1,this.viewport=new a(0,0,t,e),n=n||{},void 0===n.minFilter&&(n.minFilter=da),this.texture=new o(void 0,void 0,n.wrapS,n.wrapT,n.magFilter,n.minFilter,n.format,n.type,n.anisotropy,n.encoding),this.depthBuffer=void 0===n.depthBuffer||n.depthBuffer,this.stencilBuffer=void 0===n.stencilBuffer||n.stencilBuffer,this.depthTexture=void 0!==n.depthTexture?n.depthTexture:null}function u(t,e,n){s.call(this,t,e,n),this.activeCubeFace=0,this.activeMipMapLevel=0}function c(t,e,n,r){this._x=t||0,this._y=e||0,this._z=n||0,this._w=void 0!==r?r:1}function l(t,e,n){this.x=t||0,this.y=e||0,this.z=n||0}function h(){this.elements=new Float32Array([1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1]),arguments.length>0&&console.error("THREE.Matrix4: the constructor no longer reads arguments. use .set() instead.")}function f(t,e,n,r,i,a,s,u,c,l){t=void 0!==t?t:[],e=void 0!==e?e:ta,o.call(this,t,e,n,r,i,a,s,u,c,l),this.flipY=!1}function d(){this.seq=[],this.map={}}function p(t,e,n){var r=t[0];if(r<=0||r>0)return t;var i=e*n,o=vs[i];if(void 0===o&&(o=new Float32Array(i),vs[i]=o),0!==e){r.toArray(o,0);for(var a=1,s=0;a!==e;++a)s+=n,t[a].toArray(o,s)}return o}function m(t,e){var n=ys[e];void 0===n&&(n=new Int32Array(e),ys[e]=n);for(var r=0;r!==e;++r)n[r]=t.allocTextureUnit();return n}function g(t,e){t.uniform1f(this.addr,e)}function v(t,e){t.uniform1i(this.addr,e)}function y(t,e){void 0===e.x?t.uniform2fv(this.addr,e):t.uniform2f(this.addr,e.x,e.y)}function x(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 b(t,e){void 0===e.x?t.uniform4fv(this.addr,e):t.uniform4f(this.addr,e.x,e.y,e.z,e.w)}function _(t,e){t.uniformMatrix2fv(this.addr,!1,e.elements||e)}function w(t,e){t.uniformMatrix3fv(this.addr,!1,e.elements||e)}function M(t,e){t.uniformMatrix4fv(this.addr,!1,e.elements||e)}function E(t,e,n){var r=n.allocTextureUnit();t.uniform1i(this.addr,r),n.setTexture2D(e||ms,r)}function T(t,e,n){var r=n.allocTextureUnit();t.uniform1i(this.addr,r),n.setTextureCube(e||gs,r)}function S(t,e){t.uniform2iv(this.addr,e)}function A(t,e){t.uniform3iv(this.addr,e)}function L(t,e){t.uniform4iv(this.addr,e)}function R(t){switch(t){case 5126:return g;case 35664:return y;case 35665:return x;case 35666:return b;case 35674:return _;case 35675:return w;case 35676:return M;case 35678:return E;case 35680:return T;case 5124:case 35670:return v;case 35667:case 35671:return S;case 35668:case 35672:return A;case 35669:case 35673:return L}}function P(t,e){t.uniform1fv(this.addr,e)}function C(t,e){t.uniform1iv(this.addr,e)}function N(t,e){t.uniform2fv(this.addr,p(e,this.size,2))}function I(t,e){t.uniform3fv(this.addr,p(e,this.size,3))}function U(t,e){t.uniform4fv(this.addr,p(e,this.size,4))}function O(t,e){t.uniformMatrix2fv(this.addr,!1,p(e,this.size,4))}function D(t,e){t.uniformMatrix3fv(this.addr,!1,p(e,this.size,9))}function z(t,e){t.uniformMatrix4fv(this.addr,!1,p(e,this.size,16))}function F(t,e,n){var r=e.length,i=m(n,r);t.uniform1iv(this.addr,i);for(var o=0;o!==r;++o)n.setTexture2D(e[o]||ms,i[o])}function B(t,e,n){var r=e.length,i=m(n,r);t.uniform1iv(this.addr,i);for(var o=0;o!==r;++o)n.setTextureCube(e[o]||gs,i[o])}function k(t){switch(t){case 5126:return P;case 35664:return N;case 35665:return I;case 35666:return U;case 35674:return O;case 35675:return D;case 35676:return z;case 35678:return F;case 35680:return B;case 5124:case 35670:return C;case 35667:case 35671:return S;case 35668:case 35672:return A;case 35669:case 35673:return L}}function G(t,e,n){this.id=t,this.addr=n,this.setValue=R(e.type)}function H(t,e,n){this.id=t,this.addr=n,this.size=e.size,this.setValue=k(e.type)}function V(t){this.id=t,d.call(this)}function j(t,e){t.seq.push(e),t.map[e.id]=e}function W(t,e,n){var r=t.name,i=r.length;for(xs.lastIndex=0;;){var o=xs.exec(r),a=xs.lastIndex,s=o[1],u="]"===o[2],c=o[3];if(u&&(s|=0),void 0===c||"["===c&&a+2===i){j(n,void 0===c?new G(s,t,e):new H(s,t,e));break}var l=n.map,h=l[s];void 0===h&&(h=new V(s),j(n,h)),n=h}}function X(t,e,n){d.call(this),this.renderer=n;for(var r=t.getProgramParameter(e,t.ACTIVE_UNIFORMS),i=0;i<r;++i){var o=t.getActiveUniform(e,i),a=o.name,s=t.getUniformLocation(e,a);W(o,s,this)}}function q(t,e,n){return void 0===e&&void 0===n?this.set(t):this.setRGB(t,e,n)}function Y(t,e,n,r,i,a,s,u,c,l,h,f){o.call(this,null,a,s,u,c,l,r,i,h,f),this.image={data:t,width:e,height:n},this.magFilter=void 0!==c?c:la,this.minFilter=void 0!==l?l:la,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}function Z(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 J(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]);o=p.createBuffer(),a=p.createBuffer(),p.bindBuffer(p.ARRAY_BUFFER,o),p.bufferData(p.ARRAY_BUFFER,t,p.STATIC_DRAW),p.bindBuffer(p.ELEMENT_ARRAY_BUFFER,a),p.bufferData(p.ELEMENT_ARRAY_BUFFER,e,p.STATIC_DRAW),f=p.createTexture(),d=p.createTexture(),m.bindTexture(p.TEXTURE_2D,f),p.texImage2D(p.TEXTURE_2D,0,p.RGB,16,16,0,p.RGB,p.UNSIGNED_BYTE,null),p.texParameteri(p.TEXTURE_2D,p.TEXTURE_WRAP_S,p.CLAMP_TO_EDGE),p.texParameteri(p.TEXTURE_2D,p.TEXTURE_WRAP_T,p.CLAMP_TO_EDGE),p.texParameteri(p.TEXTURE_2D,p.TEXTURE_MAG_FILTER,p.NEAREST),p.texParameteri(p.TEXTURE_2D,p.TEXTURE_MIN_FILTER,p.NEAREST),m.bindTexture(p.TEXTURE_2D,d),p.texImage2D(p.TEXTURE_2D,0,p.RGBA,16,16,0,p.RGBA,p.UNSIGNED_BYTE,null),p.texParameteri(p.TEXTURE_2D,p.TEXTURE_WRAP_S,p.CLAMP_TO_EDGE),p.texParameteri(p.TEXTURE_2D,p.TEXTURE_WRAP_T,p.CLAMP_TO_EDGE),p.texParameteri(p.TEXTURE_2D,p.TEXTURE_MAG_FILTER,p.NEAREST),p.texParameteri(p.TEXTURE_2D,p.TEXTURE_MIN_FILTER,p.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")},u=r(s),c={vertex:p.getAttribLocation(u,"position"),uv:p.getAttribLocation(u,"uv")},h={renderType:p.getUniformLocation(u,"renderType"),map:p.getUniformLocation(u,"map"),occlusionMap:p.getUniformLocation(u,"occlusionMap"),opacity:p.getUniformLocation(u,"opacity"),color:p.getUniformLocation(u,"color"),scale:p.getUniformLocation(u,"scale"),rotation:p.getUniformLocation(u,"rotation"),screenPosition:p.getUniformLocation(u,"screenPosition")}}function r(e){var n=p.createProgram(),r=p.createShader(p.FRAGMENT_SHADER),i=p.createShader(p.VERTEX_SHADER),o="precision "+t.getPrecision()+" float;\n";return p.shaderSource(r,o+e.fragmentShader),p.shaderSource(i,o+e.vertexShader),p.compileShader(r),p.compileShader(i),p.attachShader(n,r),p.attachShader(n,i),p.linkProgram(n),n}var o,a,s,u,c,h,f,d,p=t.context,m=t.state;this.render=function(r,s,g){if(0!==e.length){var v=new l,y=g.w/g.z,x=.5*g.z,b=.5*g.w,_=16/g.w,w=new i(_*y,_),M=new l(1,1,0),E=new i(1,1),T=new Z;T.min.set(g.x,g.y),T.max.set(g.x+(g.z-16),g.y+(g.w-16)),void 0===u&&n(),p.useProgram(u),m.initAttributes(),m.enableAttribute(c.vertex),m.enableAttribute(c.uv),m.disableUnusedAttributes(),p.uniform1i(h.occlusionMap,0),p.uniform1i(h.map,1),p.bindBuffer(p.ARRAY_BUFFER,o),p.vertexAttribPointer(c.vertex,2,p.FLOAT,!1,16,0),p.vertexAttribPointer(c.uv,2,p.FLOAT,!1,16,8),p.bindBuffer(p.ELEMENT_ARRAY_BUFFER,a),m.disable(p.CULL_FACE),m.setDepthWrite(!1);for(var S=0,A=e.length;S<A;S++){_=16/g.w,w.set(_*y,_);var L=e[S];if(v.set(L.matrixWorld.elements[12],L.matrixWorld.elements[13],L.matrixWorld.elements[14]),v.applyMatrix4(s.matrixWorldInverse),v.applyMatrix4(s.projectionMatrix),M.copy(v),E.x=g.x+M.x*x+x-8,E.y=g.y+M.y*b+b-8,T.containsPoint(E)===!0){m.activeTexture(p.TEXTURE0),m.bindTexture(p.TEXTURE_2D,null),m.activeTexture(p.TEXTURE1),m.bindTexture(p.TEXTURE_2D,f),p.copyTexImage2D(p.TEXTURE_2D,0,p.RGB,E.x,E.y,16,16,0),p.uniform1i(h.renderType,0),p.uniform2f(h.scale,w.x,w.y),p.uniform3f(h.screenPosition,M.x,M.y,M.z),m.disable(p.BLEND),m.enable(p.DEPTH_TEST),p.drawElements(p.TRIANGLES,6,p.UNSIGNED_SHORT,0),m.activeTexture(p.TEXTURE0),m.bindTexture(p.TEXTURE_2D,d),p.copyTexImage2D(p.TEXTURE_2D,0,p.RGBA,E.x,E.y,16,16,0),p.uniform1i(h.renderType,1),m.disable(p.DEPTH_TEST),m.activeTexture(p.TEXTURE1),m.bindTexture(p.TEXTURE_2D,f),p.drawElements(p.TRIANGLES,6,p.UNSIGNED_SHORT,0),L.positionScreen.copy(M),L.customUpdateCallback?L.customUpdateCallback(L):L.updateLensFlares(),p.uniform1i(h.renderType,2),m.enable(p.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/g.w,w.x=_*y,w.y=_,p.uniform3f(h.screenPosition,M.x,M.y,M.z),p.uniform2f(h.scale,w.x,w.y),p.uniform1f(h.rotation,C.rotation),p.uniform1f(h.opacity,C.opacity),p.uniform3f(h.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),p.drawElements(p.TRIANGLES,6,p.UNSIGNED_SHORT,0))}}}m.enable(p.CULL_FACE),m.enable(p.DEPTH_TEST),m.setDepthWrite(!0),t.resetGLState()}}}function Q(t,e){function n(){var t=new Float32Array([-.5,-.5,0,0,.5,-.5,1,0,.5,.5,1,1,-.5,.5,0,1]),e=new Uint16Array([0,1,2,0,2,3]);a=p.createBuffer(),s=p.createBuffer(),p.bindBuffer(p.ARRAY_BUFFER,a),p.bufferData(p.ARRAY_BUFFER,t,p.STATIC_DRAW),p.bindBuffer(p.ELEMENT_ARRAY_BUFFER,s),p.bufferData(p.ELEMENT_ARRAY_BUFFER,e,p.STATIC_DRAW),u=r(),h={position:p.getAttribLocation(u,"position"),uv:p.getAttribLocation(u,"uv")},f={uvOffset:p.getUniformLocation(u,"uvOffset"),uvScale:p.getUniformLocation(u,"uvScale"),rotation:p.getUniformLocation(u,"rotation"),scale:p.getUniformLocation(u,"scale"),color:p.getUniformLocation(u,"color"),map:p.getUniformLocation(u,"map"),opacity:p.getUniformLocation(u,"opacity"),modelViewMatrix:p.getUniformLocation(u,"modelViewMatrix"),projectionMatrix:p.getUniformLocation(u,"projectionMatrix"),fogType:p.getUniformLocation(u,"fogType"),fogDensity:p.getUniformLocation(u,"fogDensity"),fogNear:p.getUniformLocation(u,"fogNear"),fogFar:p.getUniformLocation(u,"fogFar"),fogColor:p.getUniformLocation(u,"fogColor"),alphaTest:p.getUniformLocation(u,"alphaTest")};var n=document.createElementNS("http://www.w3.org/1999/xhtml","canvas");n.width=8,n.height=8;var i=n.getContext("2d");i.fillStyle="white",i.fillRect(0,0,8,8),d=new o(n),d.needsUpdate=!0}function r(){var e=p.createProgram(),n=p.createShader(p.VERTEX_SHADER),r=p.createShader(p.FRAGMENT_SHADER);return p.shaderSource(n,["precision "+t.getPrecision()+" float;","uniform mat4 modelViewMatrix;","uniform mat4 projectionMatrix;","uniform float rotation;","uniform vec2 scale;","uniform vec2 uvOffset;","uniform vec2 uvScale;","attribute vec2 position;","attribute vec2 uv;","varying vec2 vUV;","void main() {","vUV = uvOffset + uv * uvScale;","vec2 alignedPosition = position * scale;","vec2 rotatedPosition;","rotatedPosition.x = cos( rotation ) * alignedPosition.x - sin( rotation ) * alignedPosition.y;","rotatedPosition.y = sin( rotation ) * alignedPosition.x + cos( rotation ) * alignedPosition.y;","vec4 finalPosition;","finalPosition = modelViewMatrix * vec4( 0.0, 0.0, 0.0, 1.0 );","finalPosition.xy += rotatedPosition;","finalPosition = projectionMatrix * finalPosition;","gl_Position = finalPosition;","}"].join("\n")),p.shaderSource(r,["precision "+t.getPrecision()+" float;","uniform vec3 color;","uniform sampler2D map;","uniform float opacity;","uniform int fogType;","uniform vec3 fogColor;","uniform float fogDensity;","uniform float fogNear;","uniform float fogFar;","uniform float alphaTest;","varying vec2 vUV;","void main() {","vec4 texture = texture2D( map, vUV );","if ( texture.a < alphaTest ) discard;","gl_FragColor = vec4( color * texture.xyz, texture.a * opacity );","if ( fogType > 0 ) {","float depth = gl_FragCoord.z / gl_FragCoord.w;","float fogFactor = 0.0;","if ( fogType == 1 ) {","fogFactor = smoothstep( fogNear, fogFar, depth );","} else {","const float LOG2 = 1.442695;","fogFactor = exp2( - fogDensity * fogDensity * depth * depth * LOG2 );","fogFactor = 1.0 - clamp( fogFactor, 0.0, 1.0 );","}","gl_FragColor = mix( gl_FragColor, vec4( fogColor, gl_FragColor.w ), fogFactor );","}","}"].join("\n")),p.compileShader(n),p.compileShader(r),p.attachShader(e,n),p.attachShader(e,r),p.linkProgram(e),e}function i(t,e){return t.renderOrder!==e.renderOrder?t.renderOrder-e.renderOrder:t.z!==e.z?e.z-t.z:e.id-t.id}var a,s,u,h,f,d,p=t.context,m=t.state,g=new l,v=new c,y=new l;this.render=function(r,o){if(0!==e.length){void 0===u&&n(),p.useProgram(u),m.initAttributes(),m.enableAttribute(h.position),m.enableAttribute(h.uv),m.disableUnusedAttributes(),m.disable(p.CULL_FACE),m.enable(p.BLEND),p.bindBuffer(p.ARRAY_BUFFER,a),p.vertexAttribPointer(h.position,2,p.FLOAT,!1,16,0),p.vertexAttribPointer(h.uv,2,p.FLOAT,!1,16,8),p.bindBuffer(p.ELEMENT_ARRAY_BUFFER,s),p.uniformMatrix4fv(f.projectionMatrix,!1,o.projectionMatrix.elements),m.activeTexture(p.TEXTURE0),p.uniform1i(f.map,0);var c=0,l=0,x=r.fog;x?(p.uniform3f(f.fogColor,x.color.r,x.color.g,x.color.b),x.isFog?(p.uniform1f(f.fogNear,x.near),p.uniform1f(f.fogFar,x.far),p.uniform1i(f.fogType,1),c=1,l=1):x.isFogExp2&&(p.uniform1f(f.fogDensity,x.density),p.uniform1i(f.fogType,2),c=2,l=2)):(p.uniform1i(f.fogType,0),c=0,l=0);for(var b=0,_=e.length;b<_;b++){var w=e[b];w.modelViewMatrix.multiplyMatrices(o.matrixWorldInverse,w.matrixWorld),w.z=-w.modelViewMatrix.elements[14]}e.sort(i);for(var M=[],b=0,_=e.length;b<_;b++){var w=e[b],E=w.material;if(E.visible!==!1){p.uniform1f(f.alphaTest,E.alphaTest),p.uniformMatrix4fv(f.modelViewMatrix,!1,w.modelViewMatrix.elements),w.matrixWorld.decompose(g,v,y),M[0]=y.x,M[1]=y.y;var T=0;r.fog&&E.fog&&(T=l),c!==T&&(p.uniform1i(f.fogType,T),c=T),null!==E.map?(p.uniform2f(f.uvOffset,E.map.offset.x,E.map.offset.y),p.uniform2f(f.uvScale,E.map.repeat.x,E.map.repeat.y)):(p.uniform2f(f.uvOffset,0,0),p.uniform2f(f.uvScale,1,1)),p.uniform1f(f.opacity,E.opacity),p.uniform3f(f.color,E.color.r,E.color.g,E.color.b),p.uniform1f(f.rotation,E.rotation),p.uniform2fv(f.scale,M),m.setBlending(E.blending,E.blendEquation,E.blendSrc,E.blendDst),m.setDepthTest(E.depthTest),m.setDepthWrite(E.depthWrite),E.map?t.setTexture2D(E.map,0):t.setTexture2D(d,0),p.drawElements(p.TRIANGLES,6,p.UNSIGNED_SHORT,0)}}m.enable(p.CULL_FACE),t.resetGLState()}}}function K(){Object.defineProperty(this,"id",{value:Tc++}),this.uuid=ds.generateUUID(),this.name="",this.type="Material",this.fog=!0,this.lights=!0,this.blending=go,this.side=ao,this.shading=lo,this.vertexColors=ho,this.opacity=1,this.transparent=!1,this.blendSrc=Po,this.blendDst=Co,this.blendEquation=_o,this.blendSrcAlpha=null,this.blendDstAlpha=null,this.blendEquationAlpha=null,this.depthFunc=ko,this.depthTest=!0,this.depthWrite=!0,this.clippingPlanes=null,this.clipIntersection=!1,this.clipShadows=!1,this.colorWrite=!0,this.precision=null,this.polygonOffset=!1,this.polygonOffsetFactor=0,this.polygonOffsetUnits=0,this.alphaTest=0,this.premultipliedAlpha=!1,this.overdraw=0,this.visible=!0,this._needsUpdate=!0}function $(t){K.call(this),this.type="ShaderMaterial",this.defines={},this.uniforms={},this.vertexShader="void main() {\n\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",this.fragmentShader="void main() {\n\tgl_FragColor = vec4( 1.0, 0.0, 0.0, 1.0 );\n}",this.linewidth=1,this.wireframe=!1,this.wireframeLinewidth=1,this.fog=!1,this.lights=!1,this.clipping=!1,this.skinning=!1,this.morphTargets=!1,this.morphNormals=!1,this.extensions={derivatives:!1,fragDepth:!1,drawBuffers:!1,shaderTextureLOD:!1},this.defaultAttributeValues={color:[1,1,1],uv:[0,0],uv2:[0,0]},this.index0AttributeName=void 0,void 0!==t&&(void 0!==t.attributes&&console.error("THREE.ShaderMaterial: attributes should now be defined in THREE.BufferGeometry instead."),this.setValues(t))}function tt(t){K.call(this),this.type="MeshDepthMaterial",this.depthPacking=hs,this.skinning=!1,this.morphTargets=!1,this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.wireframe=!1,this.wireframeLinewidth=1,this.fog=!1,this.lights=!1,this.setValues(t)}function et(t,e){this.min=void 0!==t?t:new l(+(1/0),+(1/0),+(1/0)),this.max=void 0!==e?e:new l(-(1/0),-(1/0),-(1/0))}function nt(t,e){this.center=void 0!==t?t:new l,this.radius=void 0!==e?e:0}function rt(){this.elements=new Float32Array([1,0,0,0,1,0,0,0,1]),arguments.length>0&&console.error("THREE.Matrix3: the constructor no longer reads arguments. use .set() instead.")}function it(t,e){this.normal=void 0!==t?t:new l(1,0,0),this.constant=void 0!==e?e:0}function ot(t,e,n,r,i,o){this.planes=[void 0!==t?t:new it,void 0!==e?e:new it,void 0!==n?n:new it,void 0!==r?r:new it,void 0!==i?i:new it,void 0!==o?o:new it]}function at(t,e,n,r){function o(e,n,r,i){var o=e.geometry,a=null,s=E,u=e.customDepthMaterial;if(r&&(s=T,u=e.customDistanceMaterial),u)a=u;else{var c=!1;n.morphTargets&&(o&&o.isBufferGeometry?c=o.morphAttributes&&o.morphAttributes.position&&o.morphAttributes.position.length>0:o&&o.isGeometry&&(c=o.morphTargets&&o.morphTargets.length>0));var l=e.isSkinnedMesh&&n.skinning,h=0;c&&(h|=_),l&&(h|=w),a=s[h]}if(t.localClippingEnabled&&n.clipShadows===!0&&0!==n.clippingPlanes.length){var f=a.uuid,d=n.uuid,p=S[f];void 0===p&&(p={},S[f]=p);var m=p[d];void 0===m&&(m=a.clone(),p[d]=m),a=m}a.visible=n.visible,a.wireframe=n.wireframe;var g=n.side;return F.renderSingleSided&&g==uo&&(g=ao),F.renderReverseSided&&(g===ao?g=so:g===so&&(g=ao)),a.side=g,a.clipShadows=n.clipShadows,a.clippingPlanes=n.clippingPlanes,a.wireframeLinewidth=n.wireframeLinewidth,a.linewidth=n.linewidth,r&&void 0!==a.uniforms.lightPos&&a.uniforms.lightPos.value.copy(i),a}function u(t,e,n){if(t.visible!==!1){var r=0!==(t.layers.mask&e.layers.mask);if(r&&(t.isMesh||t.isLine||t.isPoints)&&t.castShadow&&(t.frustumCulled===!1||d.intersectsObject(t)===!0)){var i=t.material;i.visible===!0&&(t.modelViewMatrix.multiplyMatrices(n.matrixWorldInverse,t.matrixWorld),b.push(t))}for(var o=t.children,a=0,s=o.length;a<s;a++)u(o[a],e,n)}}var c=t.context,f=t.state,d=new ot,p=new h,m=e.shadows,g=new i,v=new i(r.maxTextureSize,r.maxTextureSize),y=new l,x=new l,b=[],_=1,w=2,M=(_|w)+1,E=new Array(M),T=new Array(M),S={},A=[new l(1,0,0),new l(-1,0,0),new l(0,0,1),new l(0,0,-1),new l(0,1,0),new l(0,-1,0)],L=[new l(0,1,0),new l(0,1,0),new l(0,1,0),new l(0,1,0),new l(0,0,1),new l(0,0,-1)],R=[new a,new a,new a,new a,new a,new a],P=new tt;P.depthPacking=fs,P.clipping=!0;for(var C=Ec.distanceRGBA,N=bs.clone(C.uniforms),I=0;I!==M;++I){var U=0!==(I&_),O=0!==(I&w),D=P.clone();D.morphTargets=U,D.skinning=O,E[I]=D;var z=new $({defines:{USE_SHADOWMAP:""},uniforms:N,vertexShader:C.vertexShader,fragmentShader:C.fragmentShader,morphTargets:U,skinning:O,clipping:!0});T[I]=z}var F=this;this.enabled=!1,this.autoUpdate=!0,this.needsUpdate=!1,this.type=io,this.renderReverseSided=!0,this.renderSingleSided=!0,this.render=function(e,r){if(F.enabled!==!1&&(F.autoUpdate!==!1||F.needsUpdate!==!1)&&0!==m.length){f.buffers.color.setClear(1,1,1,1),f.disable(c.BLEND),f.setDepthTest(!0),f.setScissorTest(!1);for(var i,a,l=0,h=m.length;l<h;l++){var _=m[l],w=_.shadow;if(void 0!==w){var M=w.camera;if(g.copy(w.mapSize),g.min(v),_&&_.isPointLight){i=6,a=!0;var E=g.x,T=g.y;R[0].set(2*E,T,E,T),R[1].set(0,T,E,T),R[2].set(3*E,T,E,T),R[3].set(E,T,E,T),R[4].set(3*E,0,E,T),R[5].set(E,0,E,T),g.x*=4,g.y*=2}else i=1,a=!1;if(null===w.map){var S={minFilter:la,magFilter:la,format:Pa};w.map=new s(g.x,g.y,S),M.updateProjectionMatrix()}w.isSpotLightShadow&&w.update(_),w&&w.isRectAreaLightShadow&&w.update(_);var P=w.map,C=w.matrix;x.setFromMatrixPosition(_.matrixWorld),M.position.copy(x),t.setRenderTarget(P),t.clear();for(var N=0;N<i;N++){if(a){y.copy(M.position),y.add(A[N]),M.up.copy(L[N]),M.lookAt(y);var I=R[N];f.viewport(I)}else y.setFromMatrixPosition(_.target.matrixWorld),M.lookAt(y);M.updateMatrixWorld(),M.matrixWorldInverse.getInverse(M.matrixWorld),C.set(.5,0,0,.5,0,.5,0,.5,0,0,.5,.5,0,0,0,1),C.multiply(M.projectionMatrix),C.multiply(M.matrixWorldInverse),p.multiplyMatrices(M.projectionMatrix,M.matrixWorldInverse),d.setFromMatrix(p),b.length=0,u(e,r,M);for(var U=0,O=b.length;U<O;U++){var D=b[U],z=n.update(D),B=D.material;if(B&&B.isMultiMaterial)for(var k=z.groups,G=B.materials,H=0,V=k.length;H<V;H++){var j=k[H],W=G[j.materialIndex];if(W.visible===!0){var X=o(D,W,a,x);t.renderBufferDirect(M,null,z,X,D,j)}}else{var X=o(D,B,a,x);t.renderBufferDirect(M,null,z,X,D,null)}}}}else console.warn("THREE.WebGLShadowMap:",_,"has no shadow.")}var q=t.getClearColor(),Y=t.getClearAlpha();t.setClearColor(q,Y),F.needsUpdate=!1}}}function st(t,e){this.origin=void 0!==t?t:new l,this.direction=void 0!==e?e:new l}function ut(t,e,n,r){this._x=t||0,this._y=e||0,this._z=n||0,this._order=r||ut.DefaultOrder}function ct(){this.mask=1}function lt(){function t(){i.setFromEuler(r,!1)}function e(){r.setFromQuaternion(i,void 0,!1)}Object.defineProperty(this,"id",{value:Sc++}),this.uuid=ds.generateUUID(),this.name="",this.type="Object3D",this.parent=null,this.children=[],this.up=lt.DefaultUp.clone();var n=new l,r=new ut,i=new c,o=new l(1,1,1);r.onChange(t),i.onChange(e),Object.defineProperties(this,{position:{enumerable:!0,value:n},rotation:{enumerable:!0,value:r},quaternion:{enumerable:!0,value:i},scale:{enumerable:!0,value:o},modelViewMatrix:{value:new h},normalMatrix:{value:new rt}}),this.matrix=new h,this.matrixWorld=new h,this.matrixAutoUpdate=lt.DefaultMatrixAutoUpdate,this.matrixWorldNeedsUpdate=!1,this.layers=new ct,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 l,this.end=void 0!==e?e:new l}function ft(t,e,n){this.a=void 0!==t?t:new l,this.b=void 0!==e?e:new l,this.c=void 0!==n?n:new l}function dt(t,e,n,r,i,o){this.a=t,this.b=e,this.c=n,this.normal=r&&r.isVector3?r:new l,
+this.vertexNormals=Array.isArray(r)?r:[],this.color=i&&i.isColor?i:new q,this.vertexColors=Array.isArray(i)?i:[],this.materialIndex=void 0!==o?o:0}function pt(t){K.call(this),this.type="MeshBasicMaterial",this.color=new q(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=Wo,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.skinning=!1,this.morphTargets=!1,this.lights=!1,this.setValues(t)}function mt(t,e,n){if(Array.isArray(t))throw new TypeError("THREE.BufferAttribute: array should be a Typed Array.");this.uuid=ds.generateUUID(),this.array=t,this.itemSize=e,this.count=void 0!==t?t.length/e:0,this.normalized=n===!0,this.dynamic=!1,this.updateRange={offset:0,count:-1},this.onUploadCallback=function(){},this.version=0}function gt(t,e){mt.call(this,new Int8Array(t),e)}function vt(t,e){mt.call(this,new Uint8Array(t),e)}function yt(t,e){mt.call(this,new Uint8ClampedArray(t),e)}function xt(t,e){mt.call(this,new Int16Array(t),e)}function bt(t,e){mt.call(this,new Uint16Array(t),e)}function _t(t,e){mt.call(this,new Int32Array(t),e)}function wt(t,e){mt.call(this,new Uint32Array(t),e)}function Mt(t,e){mt.call(this,new Float32Array(t),e)}function Et(t,e){mt.call(this,new Float64Array(t),e)}function Tt(){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 St(t){for(var e=t.length,n=-(1/0);e--;)t[e]>n&&(n=t[e]);return n}function At(){return Ac++}function Lt(){Object.defineProperty(this,"id",{value:At()}),this.uuid=ds.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 Rt(){Object.defineProperty(this,"id",{value:At()}),this.uuid=ds.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 Pt(t,e){lt.call(this),this.type="Mesh",this.geometry=void 0!==t?t:new Rt,this.material=void 0!==e?e:new pt({color:16777215*Math.random()}),this.drawMode=ts,this.updateMorphTargets()}function Ct(t,e,n,r,i,o){Lt.call(this),this.type="BoxGeometry",this.parameters={width:t,height:e,depth:n,widthSegments:r,heightSegments:i,depthSegments:o},this.fromBufferGeometry(new Nt(t,e,n,r,i,o)),this.mergeVertices()}function Nt(t,e,n,r,i,o){function a(t,e,n,r,i,o,a,m,g,v,y){var x,b,_=o/g,w=a/v,M=o/2,E=a/2,T=m/2,S=g+1,A=v+1,L=0,R=0,P=new l;for(b=0;b<A;b++){var C=b*w-E;for(x=0;x<S;x++){var N=x*_-M;P[t]=N*r,P[e]=C*i,P[n]=T,c.push(P.x,P.y,P.z),P[t]=0,P[e]=0,P[n]=m>0?1:-1,h.push(P.x,P.y,P.z),f.push(x/g),f.push(1-b/v),L+=1}}for(b=0;b<v;b++)for(x=0;x<g;x++){var I=d+x+S*b,U=d+x+S*(b+1),O=d+(x+1)+S*(b+1),D=d+(x+1)+S*b;u.push(I,U,D),u.push(U,O,D),R+=6}s.addGroup(p,R,y),p+=R,d+=L}Rt.call(this),this.type="BoxBufferGeometry",this.parameters={width:t,height:e,depth:n,widthSegments:r,heightSegments:i,depthSegments:o};var s=this;r=Math.floor(r)||1,i=Math.floor(i)||1,o=Math.floor(o)||1;var u=[],c=[],h=[],f=[],d=0,p=0;a("z","y","x",-1,-1,n,e,t,o,i,0),a("z","y","x",1,-1,n,e,-t,o,i,1),a("x","z","y",1,1,t,n,e,r,o,2),a("x","z","y",1,-1,t,n,-e,r,o,3),a("x","y","z",1,-1,t,e,n,r,i,4),a("x","y","z",-1,-1,t,e,-n,r,i,5),this.setIndex(u),this.addAttribute("position",new Mt(c,3)),this.addAttribute("normal",new Mt(h,3)),this.addAttribute("uv",new Mt(f,2))}function It(t,e,n,r){Lt.call(this),this.type="PlaneGeometry",this.parameters={width:t,height:e,widthSegments:n,heightSegments:r},this.fromBufferGeometry(new Ut(t,e,n,r))}function Ut(t,e,n,r){Rt.call(this),this.type="PlaneBufferGeometry",this.parameters={width:t,height:e,widthSegments:n,heightSegments:r};var i,o,a=t/2,s=e/2,u=Math.floor(n)||1,c=Math.floor(r)||1,l=u+1,h=c+1,f=t/u,d=e/c,p=[],m=[],g=[],v=[];for(o=0;o<h;o++){var y=o*d-s;for(i=0;i<l;i++){var x=i*f-a;m.push(x,-y,0),g.push(0,0,1),v.push(i/u),v.push(1-o/c)}}for(o=0;o<c;o++)for(i=0;i<u;i++){var b=i+l*o,_=i+l*(o+1),w=i+1+l*(o+1),M=i+1+l*o;p.push(b,_,M),p.push(_,w,M)}this.setIndex(p),this.addAttribute("position",new Mt(m,3)),this.addAttribute("normal",new Mt(g,3)),this.addAttribute("uv",new Mt(v,2))}function Ot(){lt.call(this),this.type="Camera",this.matrixWorldInverse=new h,this.projectionMatrix=new h}function Dt(t,e,n,r){Ot.call(this),this.type="PerspectiveCamera",this.fov=void 0!==t?t:50,this.zoom=1,this.near=void 0!==n?n:.1,this.far=void 0!==r?r:2e3,this.focus=10,this.aspect=void 0!==e?e:1,this.view=null,this.filmGauge=35,this.filmOffset=0,this.updateProjectionMatrix()}function zt(t,e,n,r,i,o){Ot.call(this),this.type="OrthographicCamera",this.zoom=1,this.view=null,this.left=t,this.right=e,this.top=n,this.bottom=r,this.near=void 0!==i?i:.1,this.far=void 0!==o?o:2e3,this.updateProjectionMatrix()}function Ft(t,e,n){function r(t){s=t}function i(n){n.array instanceof Uint32Array&&e.get("OES_element_index_uint")?(u=t.UNSIGNED_INT,c=4):n.array instanceof Uint16Array?(u=t.UNSIGNED_SHORT,c=2):(u=t.UNSIGNED_BYTE,c=1)}function o(e,r){t.drawElements(s,r,u,e*c),n.calls++,n.vertices+=r,s===t.TRIANGLES&&(n.faces+=r/3)}function a(r,i,o){var a=e.get("ANGLE_instanced_arrays");return null===a?void console.error("THREE.WebGLBufferRenderer: using THREE.InstancedBufferGeometry but hardware does not support extension ANGLE_instanced_arrays."):(a.drawElementsInstancedANGLE(s,o,u,i*c,r.maxInstancedCount),n.calls++,n.vertices+=o*r.maxInstancedCount,void(s===t.TRIANGLES&&(n.faces+=r.maxInstancedCount*o/3)))}var s,u,c;return{setMode:r,setIndex:i,render:o,renderInstances:a}}function Bt(t,e,n){function r(t){a=t}function i(e,r){t.drawArrays(a,e,r),n.calls++,n.vertices+=r,a===t.TRIANGLES&&(n.faces+=r/3)}function o(r){var i=e.get("ANGLE_instanced_arrays");if(null===i)return void console.error("THREE.WebGLBufferRenderer: using THREE.InstancedBufferGeometry but hardware does not support extension ANGLE_instanced_arrays.");var o=r.attributes.position,s=0;o.isInterleavedBufferAttribute?(s=o.data.count,i.drawArraysInstancedANGLE(a,0,s,r.maxInstancedCount)):(s=o.count,i.drawArraysInstancedANGLE(a,0,s,r.maxInstancedCount)),n.calls++,n.vertices+=s*r.maxInstancedCount,a===t.TRIANGLES&&(n.faces+=r.maxInstancedCount*s/3)}var a;return{setMode:r,render:i,renderInstances:o}}function kt(){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 l,color:new q,shadow:!1,shadowBias:0,shadowRadius:1,shadowMapSize:new i};break;case"SpotLight":n={position:new l,direction:new l,color:new q,distance:0,coneCos:0,penumbraCos:0,decay:0,shadow:!1,shadowBias:0,shadowRadius:1,shadowMapSize:new i};break;case"PointLight":n={position:new l,color:new q,distance:0,decay:0,shadow:!1,shadowBias:0,shadowRadius:1,shadowMapSize:new i};break;case"HemisphereLight":n={direction:new l,skyColor:new q,groundColor:new q};break;case"RectAreaLight":n={color:new q,position:new l,halfWidth:new l,halfHeight:new l}}return t[e.id]=n,n}}}function Gt(t){for(var e=t.split("\n"),n=0;n<e.length;n++)e[n]=n+1+": "+e[n];return e.join("\n")}function Ht(t,e,n){var r=t.createShader(e);return t.shaderSource(r,n),t.compileShader(r),t.getShaderParameter(r,t.COMPILE_STATUS)===!1&&console.error("THREE.WebGLShader: Shader couldn't compile."),""!==t.getShaderInfoLog(r)&&console.warn("THREE.WebGLShader: gl.getShaderInfoLog()",e===t.VERTEX_SHADER?"vertex":"fragment",t.getShaderInfoLog(r),Gt(n)),r}function Vt(t){switch(t){case rs:return["Linear","( value )"];case is:return["sRGB","( value )"];case as:return["RGBE","( value )"];case us:return["RGBM","( value, 7.0 )"];case cs:return["RGBM","( value, 16.0 )"];case ls:return["RGBD","( value, 256.0 )"];case os:return["Gamma","( value, float( GAMMA_FACTOR ) )"];default:throw new Error("unsupported encoding: "+t)}}function jt(t,e){var n=Vt(e);return"vec4 "+t+"( vec4 value ) { return "+n[0]+"ToLinear"+n[1]+"; }"}function Wt(t,e){var n=Vt(e);return"vec4 "+t+"( vec4 value ) { return LinearTo"+n[0]+n[1]+"; }"}function Xt(t,e){var n;switch(e){case Zo:n="Linear";break;case Jo:n="Reinhard";break;case Qo:n="Uncharted2";break;case Ko:n="OptimizedCineon";break;default:throw new Error("unsupported toneMapping: "+e)}return"vec3 "+t+"( vec3 color ) { return "+n+"ToneMapping( color ); }"}function qt(t,e,n){t=t||{};var r=[t.derivatives||e.envMapCubeUV||e.bumpMap||e.normalMap||e.flatShading?"#extension GL_OES_standard_derivatives : enable":"",(t.fragDepth||e.logarithmicDepthBuffer)&&n.get("EXT_frag_depth")?"#extension GL_EXT_frag_depth : enable":"",t.drawBuffers&&n.get("WEBGL_draw_buffers")?"#extension GL_EXT_draw_buffers : require":"",(t.shaderTextureLOD||e.envMap)&&n.get("EXT_shader_texture_lod")?"#extension GL_EXT_shader_texture_lod : enable":""];return r.filter(Jt).join("\n")}function Yt(t){var e=[];for(var n in t){var r=t[n];r!==!1&&e.push("#define "+n+" "+r)}return e.join("\n")}function Zt(t,e,n){for(var r={},i=t.getProgramParameter(e,t.ACTIVE_ATTRIBUTES),o=0;o<i;o++){var a=t.getActiveAttrib(e,o),s=a.name;r[s]=t.getAttribLocation(e,s)}return r}function Jt(t){return""!==t}function Qt(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 Kt(t){function e(t,e){var n=_c[e];if(void 0===n)throw new Error("Can not resolve #include <"+e+">");return Kt(n)}var n=/#include +<([\w\d.]+)>/g;return t.replace(n,e)}function $t(t){function e(t,e,n,r){for(var i="",o=parseInt(e);o<parseInt(n);o++)i+=r.replace(/\[ i \]/g,"[ "+o+" ]");return i}var n=/for \( int i \= (\d+)\; i < (\d+)\; i \+\+ \) \{([\s\S]+?)(?=\})\}/g;return t.replace(n,e)}function te(t,e,n,r){var i=t.context,o=n.extensions,a=n.defines,s=n.__webglShader.vertexShader,u=n.__webglShader.fragmentShader,c="SHADOWMAP_TYPE_BASIC";r.shadowMapType===io?c="SHADOWMAP_TYPE_PCF":r.shadowMapType===oo&&(c="SHADOWMAP_TYPE_PCF_SOFT");var l="ENVMAP_TYPE_CUBE",h="ENVMAP_MODE_REFLECTION",f="ENVMAP_BLENDING_MULTIPLY";if(r.envMap){switch(n.envMap.mapping){case ta:case ea:l="ENVMAP_TYPE_CUBE";break;case oa:case aa:l="ENVMAP_TYPE_CUBE_UV";break;case na:case ra:l="ENVMAP_TYPE_EQUIREC";break;case ia:l="ENVMAP_TYPE_SPHERE"}switch(n.envMap.mapping){case ea:case ra:h="ENVMAP_MODE_REFRACTION"}switch(n.combine){case Wo:f="ENVMAP_BLENDING_MULTIPLY";break;case Xo:f="ENVMAP_BLENDING_MIX";break;case qo:f="ENVMAP_BLENDING_ADD"}}var d,p,m=t.gammaFactor>0?t.gammaFactor:1,g=qt(o,r,t.extensions),v=Yt(a),y=i.createProgram();n.isRawShaderMaterial?(d=[v,"\n"].filter(Jt).join("\n"),p=[g,v,"\n"].filter(Jt).join("\n")):(d=["precision "+r.precision+" float;","precision "+r.precision+" int;","#define SHADER_NAME "+n.__webglShader.name,v,r.supportsVertexTextures?"#define VERTEX_TEXTURES":"","#define GAMMA_FACTOR "+m,"#define MAX_BONES "+r.maxBones,r.useFog&&r.fog?"#define USE_FOG":"",r.useFog&&r.fogExp?"#define FOG_EXP2":"",r.map?"#define USE_MAP":"",r.envMap?"#define USE_ENVMAP":"",r.envMap?"#define "+h:"",r.lightMap?"#define USE_LIGHTMAP":"",r.aoMap?"#define USE_AOMAP":"",r.emissiveMap?"#define USE_EMISSIVEMAP":"",r.bumpMap?"#define USE_BUMPMAP":"",r.normalMap?"#define USE_NORMALMAP":"",r.displacementMap&&r.supportsVertexTextures?"#define USE_DISPLACEMENTMAP":"",r.specularMap?"#define USE_SPECULARMAP":"",r.roughnessMap?"#define USE_ROUGHNESSMAP":"",r.metalnessMap?"#define USE_METALNESSMAP":"",r.alphaMap?"#define USE_ALPHAMAP":"",r.vertexColors?"#define USE_COLOR":"",r.flatShading?"#define FLAT_SHADED":"",r.skinning?"#define USE_SKINNING":"",r.useVertexTexture?"#define BONE_TEXTURE":"",r.morphTargets?"#define USE_MORPHTARGETS":"",r.morphNormals&&r.flatShading===!1?"#define USE_MORPHNORMALS":"",r.doubleSided?"#define DOUBLE_SIDED":"",r.flipSided?"#define FLIP_SIDED":"","#define NUM_CLIPPING_PLANES "+r.numClippingPlanes,r.shadowMapEnabled?"#define USE_SHADOWMAP":"",r.shadowMapEnabled?"#define "+c:"",r.sizeAttenuation?"#define USE_SIZEATTENUATION":"",r.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",r.logarithmicDepthBuffer&&t.extensions.get("EXT_frag_depth")?"#define USE_LOGDEPTHBUF_EXT":"","uniform mat4 modelMatrix;","uniform mat4 modelViewMatrix;","uniform mat4 projectionMatrix;","uniform mat4 viewMatrix;","uniform mat3 normalMatrix;","uniform vec3 cameraPosition;","attribute vec3 position;","attribute vec3 normal;","attribute vec2 uv;","#ifdef USE_COLOR","\tattribute vec3 color;","#endif","#ifdef USE_MORPHTARGETS","\tattribute vec3 morphTarget0;","\tattribute vec3 morphTarget1;","\tattribute vec3 morphTarget2;","\tattribute vec3 morphTarget3;","\t#ifdef USE_MORPHNORMALS","\t\tattribute vec3 morphNormal0;","\t\tattribute vec3 morphNormal1;","\t\tattribute vec3 morphNormal2;","\t\tattribute vec3 morphNormal3;","\t#else","\t\tattribute vec3 morphTarget4;","\t\tattribute vec3 morphTarget5;","\t\tattribute vec3 morphTarget6;","\t\tattribute vec3 morphTarget7;","\t#endif","#endif","#ifdef USE_SKINNING","\tattribute vec4 skinIndex;","\tattribute vec4 skinWeight;","#endif","\n"].filter(Jt).join("\n"),p=[g,"precision "+r.precision+" float;","precision "+r.precision+" int;","#define SHADER_NAME "+n.__webglShader.name,v,r.alphaTest?"#define ALPHATEST "+r.alphaTest:"","#define GAMMA_FACTOR "+m,r.useFog&&r.fog?"#define USE_FOG":"",r.useFog&&r.fogExp?"#define FOG_EXP2":"",r.map?"#define USE_MAP":"",r.envMap?"#define USE_ENVMAP":"",r.envMap?"#define "+l:"",r.envMap?"#define "+h:"",r.envMap?"#define "+f:"",r.lightMap?"#define USE_LIGHTMAP":"",r.aoMap?"#define USE_AOMAP":"",r.emissiveMap?"#define USE_EMISSIVEMAP":"",r.bumpMap?"#define USE_BUMPMAP":"",r.normalMap?"#define USE_NORMALMAP":"",r.specularMap?"#define USE_SPECULARMAP":"",r.roughnessMap?"#define USE_ROUGHNESSMAP":"",r.metalnessMap?"#define USE_METALNESSMAP":"",r.alphaMap?"#define USE_ALPHAMAP":"",r.vertexColors?"#define USE_COLOR":"",r.gradientMap?"#define USE_GRADIENTMAP":"",r.flatShading?"#define FLAT_SHADED":"",r.doubleSided?"#define DOUBLE_SIDED":"",r.flipSided?"#define FLIP_SIDED":"","#define NUM_CLIPPING_PLANES "+r.numClippingPlanes,"#define UNION_CLIPPING_PLANES "+(r.numClippingPlanes-r.numClipIntersection),r.shadowMapEnabled?"#define USE_SHADOWMAP":"",r.shadowMapEnabled?"#define "+c:"",r.premultipliedAlpha?"#define PREMULTIPLIED_ALPHA":"",r.physicallyCorrectLights?"#define PHYSICALLY_CORRECT_LIGHTS":"",r.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",r.logarithmicDepthBuffer&&t.extensions.get("EXT_frag_depth")?"#define USE_LOGDEPTHBUF_EXT":"",r.envMap&&t.extensions.get("EXT_shader_texture_lod")?"#define TEXTURE_LOD_EXT":"","uniform mat4 viewMatrix;","uniform vec3 cameraPosition;",r.toneMapping!==Yo?"#define TONE_MAPPING":"",r.toneMapping!==Yo?_c.tonemapping_pars_fragment:"",r.toneMapping!==Yo?Xt("toneMapping",r.toneMapping):"",r.outputEncoding||r.mapEncoding||r.envMapEncoding||r.emissiveMapEncoding?_c.encodings_pars_fragment:"",r.mapEncoding?jt("mapTexelToLinear",r.mapEncoding):"",r.envMapEncoding?jt("envMapTexelToLinear",r.envMapEncoding):"",r.emissiveMapEncoding?jt("emissiveMapTexelToLinear",r.emissiveMapEncoding):"",r.outputEncoding?Wt("linearToOutputTexel",r.outputEncoding):"",r.depthPacking?"#define DEPTH_PACKING "+n.depthPacking:"","\n"].filter(Jt).join("\n")),s=Kt(s,r),s=Qt(s,r),u=Kt(u,r),u=Qt(u,r),n.isShaderMaterial||(s=$t(s),u=$t(u));var x=d+s,b=p+u,_=Ht(i,i.VERTEX_SHADER,x),w=Ht(i,i.FRAGMENT_SHADER,b);i.attachShader(y,_),i.attachShader(y,w),void 0!==n.index0AttributeName?i.bindAttribLocation(y,0,n.index0AttributeName):r.morphTargets===!0&&i.bindAttribLocation(y,0,"position"),i.linkProgram(y);var M=i.getProgramInfoLog(y),E=i.getShaderInfoLog(_),T=i.getShaderInfoLog(w),S=!0,A=!0;i.getProgramParameter(y,i.LINK_STATUS)===!1?(S=!1,console.error("THREE.WebGLProgram: shader error: ",i.getError(),"gl.VALIDATE_STATUS",i.getProgramParameter(y,i.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:n,programLog:M,vertexShader:{log:E,prefix:d},fragmentShader:{log:T,prefix:p}}),i.deleteShader(_),i.deleteShader(w);var L;this.getUniforms=function(){return void 0===L&&(L=new X(i,y,t)),L};var R;return this.getAttributes=function(){return void 0===R&&(R=Zt(i,y)),R},this.destroy=function(){i.deleteProgram(y),this.program=void 0},Object.defineProperties(this,{uniforms:{get:function(){return console.warn("THREE.WebGLProgram: .uniforms is now .getUniforms()."),this.getUniforms()}},attributes:{get:function(){return console.warn("THREE.WebGLProgram: .attributes is now .getAttributes()."),this.getAttributes()}}}),this.id=Lc++,this.code=e,this.usedTimes=1,this.program=y,this.vertexShader=_,this.fragmentShader=w,this}function ee(t,e){function n(t){if(e.floatVertexTextures&&t&&t.skeleton&&t.skeleton.useVertexTexture)return 1024;var n=e.maxVertexUniforms,r=Math.floor((n-20)/4),i=r;return void 0!==t&&t&&t.isSkinnedMesh&&(i=Math.min(t.skeleton.bones.length,i),i<t.skeleton.bones.length&&console.warn("WebGLRenderer: too many bones - "+t.skeleton.bones.length+", this GPU supports just "+i+" (try OpenGL instead of ANGLE)")),i}function r(t,e){var n;return t?t.isTexture?n=t.encoding:t.isWebGLRenderTarget&&(console.warn("THREE.WebGLPrograms.getTextureEncodingFromMap: don't use render targets as textures. Use their .texture property instead."),n=t.texture.encoding):n=rs,n===rs&&e&&(n=os),n}var i=[],o={MeshDepthMaterial:"depth",MeshNormalMaterial:"normal",MeshBasicMaterial:"basic",MeshLambertMaterial:"lambert",MeshPhongMaterial:"phong",MeshToonMaterial:"phong",MeshStandardMaterial:"physical",MeshPhysicalMaterial:"physical",LineBasicMaterial:"basic",LineDashedMaterial:"dashed",PointsMaterial:"points"},a=["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"];this.getParameters=function(i,a,s,u,c,l){var h=o[i.type],f=n(l),d=t.getPrecision();null!==i.precision&&(d=e.getMaxPrecision(i.precision),d!==i.precision&&console.warn("THREE.WebGLProgram.getParameters:",i.precision,"not supported, using",d,"instead."));var p=t.getCurrentRenderTarget(),m={shaderID:h,precision:d,supportsVertexTextures:e.vertexTextures,outputEncoding:r(p?p.texture:null,t.gammaOutput),map:!!i.map,mapEncoding:r(i.map,t.gammaInput),envMap:!!i.envMap,envMapMode:i.envMap&&i.envMap.mapping,envMapEncoding:r(i.envMap,t.gammaInput),envMapCubeUV:!!i.envMap&&(i.envMap.mapping===oa||i.envMap.mapping===aa),lightMap:!!i.lightMap,aoMap:!!i.aoMap,emissiveMap:!!i.emissiveMap,emissiveMapEncoding:r(i.emissiveMap,t.gammaInput),bumpMap:!!i.bumpMap,normalMap:!!i.normalMap,displacementMap:!!i.displacementMap,roughnessMap:!!i.roughnessMap,metalnessMap:!!i.metalnessMap,specularMap:!!i.specularMap,alphaMap:!!i.alphaMap,gradientMap:!!i.gradientMap,combine:i.combine,vertexColors:i.vertexColors,fog:!!s,useFog:i.fog,fogExp:s&&s.isFogExp2,flatShading:i.shading===co,sizeAttenuation:i.sizeAttenuation,logarithmicDepthBuffer:e.logarithmicDepthBuffer,skinning:i.skinning,maxBones:f,useVertexTexture:e.floatVertexTextures&&l&&l.skeleton&&l.skeleton.useVertexTexture,morphTargets:i.morphTargets,morphNormals:i.morphNormals,maxMorphTargets:t.maxMorphTargets,maxMorphNormals:t.maxMorphNormals,numDirLights:a.directional.length,numPointLights:a.point.length,numSpotLights:a.spot.length,numRectAreaLights:a.rectArea.length,numHemiLights:a.hemi.length,numClippingPlanes:u,numClipIntersection:c,shadowMapEnabled:t.shadowMap.enabled&&l.receiveShadow&&a.shadows.length>0,shadowMapType:t.shadowMap.type,toneMapping:t.toneMapping,physicallyCorrectLights:t.physicallyCorrectLights,premultipliedAlpha:i.premultipliedAlpha,alphaTest:i.alphaTest,doubleSided:i.side===uo,flipSided:i.side===so,depthPacking:void 0!==i.depthPacking&&i.depthPacking};return m},this.getProgramCode=function(t,e){var n=[];if(e.shaderID?n.push(e.shaderID):(n.push(t.fragmentShader),n.push(t.vertexShader)),void 0!==t.defines)for(var r in t.defines)n.push(r),n.push(t.defines[r]);for(var i=0;i<a.length;i++)n.push(e[a[i]]);return n.join()},this.acquireProgram=function(e,n,r){for(var o,a=0,s=i.length;a<s;a++){var u=i[a];if(u.code===r){o=u,++o.usedTimes;break}}return void 0===o&&(o=new te(t,r,e,n),i.push(o)),o},this.releaseProgram=function(t){if(0===--t.usedTimes){var e=i.indexOf(t);i[e]=i[i.length-1],i.pop(),t.destroy()}},this.programs=i}function ne(t,e,n){function r(t){var i=t.target,s=u[i.id];null!==s.index&&o(s.index),a(s.attributes),i.removeEventListener("dispose",r),delete u[i.id];var c=e.get(i);c.wireframe&&o(c.wireframe),e.delete(i);var l=e.get(s);l.wireframe&&o(l.wireframe),e.delete(s),n.memory.geometries--}function i(t){return t.isInterleavedBufferAttribute?e.get(t.data).__webglBuffer:e.get(t).__webglBuffer}function o(e){var n=i(e);void 0!==n&&(t.deleteBuffer(n),s(e))}function a(t){for(var e in t)o(t[e])}function s(t){t.isInterleavedBufferAttribute?e.delete(t.data):e.delete(t)}var u={};return{get:function(t){var e=t.geometry;if(void 0!==u[e.id])return u[e.id];e.addEventListener("dispose",r);var i;return e.isBufferGeometry?i=e:e.isGeometry&&(void 0===e._bufferGeometry&&(e._bufferGeometry=(new Rt).setFromObject(t)),i=e._bufferGeometry),u[e.id]=i,n.memory.geometries++,i}}}function re(t,e,n){function r(e){var n=l.get(e);e.geometry.isGeometry&&n.updateFromObject(e);var r=n.index,o=n.attributes;null!==r&&i(r,t.ELEMENT_ARRAY_BUFFER);for(var a in o)i(o[a],t.ARRAY_BUFFER);var s=n.morphAttributes;for(var a in s)for(var u=s[a],c=0,h=u.length;c<h;c++)i(u[c],t.ARRAY_BUFFER);return n}function i(t,n){var r=t.isInterleavedBufferAttribute?t.data:t,i=e.get(r);void 0===i.__webglBuffer?o(i,r,n):i.version!==r.version&&a(i,r,n)}function o(e,n,r){e.__webglBuffer=t.createBuffer(),t.bindBuffer(r,e.__webglBuffer);var i=n.dynamic?t.DYNAMIC_DRAW:t.STATIC_DRAW;t.bufferData(r,n.array,i);var o=t.FLOAT,a=n.array;a instanceof Float32Array?o=t.FLOAT:a instanceof Float64Array?console.warn("Unsupported data buffer format: Float64Array"):a instanceof Uint16Array?o=t.UNSIGNED_SHORT:a instanceof Int16Array?o=t.SHORT:a instanceof Uint32Array?o=t.UNSIGNED_INT:a instanceof Int32Array?o=t.INT:a instanceof Int8Array?o=t.BYTE:a instanceof Uint8Array&&(o=t.UNSIGNED_BYTE),e.bytesPerElement=a.BYTES_PER_ELEMENT,e.type=o,e.version=n.version,n.onUploadCallback()}function a(e,n,r){t.bindBuffer(r,e.__webglBuffer),n.dynamic===!1?t.bufferData(r,n.array,t.STATIC_DRAW):n.updateRange.count===-1?t.bufferSubData(r,0,n.array):0===n.updateRange.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(r,n.updateRange.offset*n.array.BYTES_PER_ELEMENT,n.array.subarray(n.updateRange.offset,n.updateRange.offset+n.updateRange.count)),n.updateRange.count=0),e.version=n.version}function s(t){return t.isInterleavedBufferAttribute?e.get(t.data).__webglBuffer:e.get(t).__webglBuffer}function u(t){return t.isInterleavedBufferAttribute?e.get(t.data):e.get(t)}function c(n){var r=e.get(n);if(void 0!==r.wireframe)return r.wireframe;var o=[],a=n.index,s=n.attributes;if(null!==a)for(var u=a.array,c=0,l=u.length;c<l;c+=3){var h=u[c+0],f=u[c+1],d=u[c+2];o.push(h,f,f,d,d,h)}else for(var u=s.position.array,c=0,l=u.length/3-1;c<l;c+=3){var h=c+0,f=c+1,d=c+2;o.push(h,f,f,d,d,h)}var p=new(St(o)>65535?wt:bt)(o,1);return i(p,t.ELEMENT_ARRAY_BUFFER),r.wireframe=p,p}var l=new ne(t,e,n);return{getAttributeBuffer:s,getAttributeProperties:u,getWireframeAttribute:c,update:r}}function ie(t,e,n,r,i,o,a){function s(t,e){if(t.width>e||t.height>e){var n=e/Math.max(t.width,t.height),r=document.createElementNS("http://www.w3.org/1999/xhtml","canvas");r.width=Math.floor(t.width*n),r.height=Math.floor(t.height*n);var i=r.getContext("2d");return i.drawImage(t,0,0,t.width,t.height,0,0,r.width,r.height),console.warn("THREE.WebGLRenderer: image is too big ("+t.width+"x"+t.height+"). Resized to "+r.width+"x"+r.height,t),r}return t}function u(t){return ds.isPowerOfTwo(t.width)&&ds.isPowerOfTwo(t.height)}function c(t){if(t instanceof HTMLImageElement||t instanceof HTMLCanvasElement){var e=document.createElementNS("http://www.w3.org/1999/xhtml","canvas");e.width=ds.nearestPowerOfTwo(t.width),e.height=ds.nearestPowerOfTwo(t.height);var n=e.getContext("2d");return n.drawImage(t,0,0,e.width,e.height),console.warn("THREE.WebGLRenderer: image is not power of two ("+t.width+"x"+t.height+"). Resized to "+e.width+"x"+e.height,t),e}return t}function l(t){return t.wrapS!==ua||t.wrapT!==ua||t.minFilter!==la&&t.minFilter!==da}function h(e){return e===la||e===ha||e===fa?t.NEAREST:t.LINEAR}function f(t){var e=t.target;e.removeEventListener("dispose",f),p(e),A.textures--}function d(t){var e=t.target;e.removeEventListener("dispose",d),m(e),A.textures--}function p(e){var n=r.get(e);if(e.image&&n.__image__webglTextureCube)t.deleteTexture(n.__image__webglTextureCube);else{if(void 0===n.__webglInit)return;t.deleteTexture(n.__webglTexture)}r.delete(e)}function m(e){var n=r.get(e),i=r.get(e.texture);if(e){if(void 0!==i.__webglTexture&&t.deleteTexture(i.__webglTexture),e.depthTexture&&e.depthTexture.dispose(),e.isWebGLRenderTargetCube)for(var o=0;o<6;o++)t.deleteFramebuffer(n.__webglFramebuffer[o]),n.__webglDepthbuffer&&t.deleteRenderbuffer(n.__webglDepthbuffer[o]);else t.deleteFramebuffer(n.__webglFramebuffer),n.__webglDepthbuffer&&t.deleteRenderbuffer(n.__webglDepthbuffer);r.delete(e.texture),r.delete(e)}}function g(e,i){var o=r.get(e);if(e.version>0&&o.__version!==e.version){var a=e.image;if(void 0===a)console.warn("THREE.WebGLRenderer: Texture marked for update but image is undefined",e);else{if(a.complete!==!1)return void b(o,e,i);console.warn("THREE.WebGLRenderer: Texture marked for update but image is incomplete",e)}}n.activeTexture(t.TEXTURE0+i),n.bindTexture(t.TEXTURE_2D,o.__webglTexture)}function v(e,a){var c=r.get(e);if(6===e.image.length)if(e.version>0&&c.__version!==e.version){c.__image__webglTextureCube||(e.addEventListener("dispose",f),c.__image__webglTextureCube=t.createTexture(),A.textures++),n.activeTexture(t.TEXTURE0+a),n.bindTexture(t.TEXTURE_CUBE_MAP,c.__image__webglTextureCube),t.pixelStorei(t.UNPACK_FLIP_Y_WEBGL,e.flipY);for(var l=e&&e.isCompressedTexture,h=e.image[0]&&e.image[0].isDataTexture,d=[],p=0;p<6;p++)l||h?d[p]=h?e.image[p].image:e.image[p]:d[p]=s(e.image[p],i.maxCubemapSize);var m=d[0],g=u(m),v=o(e.format),y=o(e.type);x(t.TEXTURE_CUBE_MAP,e,g);for(var p=0;p<6;p++)if(l)for(var b,_=d[p].mipmaps,w=0,M=_.length;w<M;w++)b=_[w],e.format!==Pa&&e.format!==Ra?n.getCompressedTextureFormats().indexOf(v)>-1?n.compressedTexImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+p,w,v,b.width,b.height,0,b.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .setTextureCube()"):n.texImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+p,w,v,b.width,b.height,0,v,y,b.data);else h?n.texImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+p,0,v,d[p].width,d[p].height,0,v,y,d[p].data):n.texImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+p,0,v,v,y,d[p]);e.generateMipmaps&&g&&t.generateMipmap(t.TEXTURE_CUBE_MAP),c.__version=e.version,e.onUpdate&&e.onUpdate(e)}else n.activeTexture(t.TEXTURE0+a),n.bindTexture(t.TEXTURE_CUBE_MAP,c.__image__webglTextureCube)}function y(e,i){n.activeTexture(t.TEXTURE0+i),n.bindTexture(t.TEXTURE_CUBE_MAP,r.get(e).__webglTexture)}function x(n,a,s){var u;if(s?(t.texParameteri(n,t.TEXTURE_WRAP_S,o(a.wrapS)),t.texParameteri(n,t.TEXTURE_WRAP_T,o(a.wrapT)),t.texParameteri(n,t.TEXTURE_MAG_FILTER,o(a.magFilter)),t.texParameteri(n,t.TEXTURE_MIN_FILTER,o(a.minFilter))):(t.texParameteri(n,t.TEXTURE_WRAP_S,t.CLAMP_TO_EDGE),t.texParameteri(n,t.TEXTURE_WRAP_T,t.CLAMP_TO_EDGE),a.wrapS===ua&&a.wrapT===ua||console.warn("THREE.WebGLRenderer: Texture is not power of two. Texture.wrapS and Texture.wrapT should be set to THREE.ClampToEdgeWrapping.",a),t.texParameteri(n,t.TEXTURE_MAG_FILTER,h(a.magFilter)),t.texParameteri(n,t.TEXTURE_MIN_FILTER,h(a.minFilter)),a.minFilter!==la&&a.minFilter!==da&&console.warn("THREE.WebGLRenderer: Texture is not power of two. Texture.minFilter should be set to THREE.NearestFilter or THREE.LinearFilter.",a)),u=e.get("EXT_texture_filter_anisotropic")){if(a.type===wa&&null===e.get("OES_texture_float_linear"))return;if(a.type===Ma&&null===e.get("OES_texture_half_float_linear"))return;(a.anisotropy>1||r.get(a).__currentAnisotropy)&&(t.texParameterf(n,u.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(a.anisotropy,i.getMaxAnisotropy())),r.get(a).__currentAnisotropy=a.anisotropy)}}function b(e,r,a){void 0===e.__webglInit&&(e.__webglInit=!0,r.addEventListener("dispose",f),e.__webglTexture=t.createTexture(),A.textures++),n.activeTexture(t.TEXTURE0+a),n.bindTexture(t.TEXTURE_2D,e.__webglTexture),t.pixelStorei(t.UNPACK_FLIP_Y_WEBGL,r.flipY),t.pixelStorei(t.UNPACK_PREMULTIPLY_ALPHA_WEBGL,r.premultiplyAlpha),t.pixelStorei(t.UNPACK_ALIGNMENT,r.unpackAlignment);var h=s(r.image,i.maxTextureSize);l(r)&&u(h)===!1&&(h=c(h));var d=u(h),p=o(r.format),m=o(r.type);x(t.TEXTURE_2D,r,d);var g,v=r.mipmaps;if(r.isDepthTexture){var y=t.DEPTH_COMPONENT;if(r.type===wa){if(!L)throw new Error("Float Depth Texture only supported in WebGL2.0");y=t.DEPTH_COMPONENT32F}else L&&(y=t.DEPTH_COMPONENT16);r.format===Ua&&y===t.DEPTH_COMPONENT&&r.type!==xa&&r.type!==_a&&(console.warn("THREE.WebGLRenderer: Use UnsignedShortType or UnsignedIntType for DepthFormat DepthTexture."),r.type=xa,m=o(r.type)),r.format===Oa&&(y=t.DEPTH_STENCIL,r.type!==Aa&&(console.warn("THREE.WebGLRenderer: Use UnsignedInt248Type for DepthStencilFormat DepthTexture."),r.type=Aa,m=o(r.type))),n.texImage2D(t.TEXTURE_2D,0,y,h.width,h.height,0,p,m,null)}else if(r.isDataTexture)if(v.length>0&&d){for(var b=0,_=v.length;b<_;b++)g=v[b],n.texImage2D(t.TEXTURE_2D,b,p,g.width,g.height,0,p,m,g.data);r.generateMipmaps=!1}else n.texImage2D(t.TEXTURE_2D,0,p,h.width,h.height,0,p,m,h.data);else if(r.isCompressedTexture)for(var b=0,_=v.length;b<_;b++)g=v[b],r.format!==Pa&&r.format!==Ra?n.getCompressedTextureFormats().indexOf(p)>-1?n.compressedTexImage2D(t.TEXTURE_2D,b,p,g.width,g.height,0,g.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()"):n.texImage2D(t.TEXTURE_2D,b,p,g.width,g.height,0,p,m,g.data);else if(v.length>0&&d){for(var b=0,_=v.length;b<_;b++)g=v[b],n.texImage2D(t.TEXTURE_2D,b,p,p,m,g);r.generateMipmaps=!1}else n.texImage2D(t.TEXTURE_2D,0,p,p,m,h);r.generateMipmaps&&d&&t.generateMipmap(t.TEXTURE_2D),e.__version=r.version,r.onUpdate&&r.onUpdate(r)}function _(e,i,a,s){var u=o(i.texture.format),c=o(i.texture.type);n.texImage2D(s,0,u,i.width,i.height,0,u,c,null),t.bindFramebuffer(t.FRAMEBUFFER,e),t.framebufferTexture2D(t.FRAMEBUFFER,a,s,r.get(i.texture).__webglTexture,0),
+t.bindFramebuffer(t.FRAMEBUFFER,null)}function w(e,n){t.bindRenderbuffer(t.RENDERBUFFER,e),n.depthBuffer&&!n.stencilBuffer?(t.renderbufferStorage(t.RENDERBUFFER,t.DEPTH_COMPONENT16,n.width,n.height),t.framebufferRenderbuffer(t.FRAMEBUFFER,t.DEPTH_ATTACHMENT,t.RENDERBUFFER,e)):n.depthBuffer&&n.stencilBuffer?(t.renderbufferStorage(t.RENDERBUFFER,t.DEPTH_STENCIL,n.width,n.height),t.framebufferRenderbuffer(t.FRAMEBUFFER,t.DEPTH_STENCIL_ATTACHMENT,t.RENDERBUFFER,e)):t.renderbufferStorage(t.RENDERBUFFER,t.RGBA4,n.width,n.height),t.bindRenderbuffer(t.RENDERBUFFER,null)}function M(e,n){var i=n&&n.isWebGLRenderTargetCube;if(i)throw new Error("Depth Texture with cube render targets is not supported!");if(t.bindFramebuffer(t.FRAMEBUFFER,e),!n.depthTexture||!n.depthTexture.isDepthTexture)throw new Error("renderTarget.depthTexture must be an instance of THREE.DepthTexture");r.get(n.depthTexture).__webglTexture&&n.depthTexture.image.width===n.width&&n.depthTexture.image.height===n.height||(n.depthTexture.image.width=n.width,n.depthTexture.image.height=n.height,n.depthTexture.needsUpdate=!0),g(n.depthTexture,0);var o=r.get(n.depthTexture).__webglTexture;if(n.depthTexture.format===Ua)t.framebufferTexture2D(t.FRAMEBUFFER,t.DEPTH_ATTACHMENT,t.TEXTURE_2D,o,0);else{if(n.depthTexture.format!==Oa)throw new Error("Unknown depthTexture format");t.framebufferTexture2D(t.FRAMEBUFFER,t.DEPTH_STENCIL_ATTACHMENT,t.TEXTURE_2D,o,0)}}function E(e){var n=r.get(e),i=e.isWebGLRenderTargetCube===!0;if(e.depthTexture){if(i)throw new Error("target.depthTexture not supported in Cube render targets");M(n.__webglFramebuffer,e)}else if(i){n.__webglDepthbuffer=[];for(var o=0;o<6;o++)t.bindFramebuffer(t.FRAMEBUFFER,n.__webglFramebuffer[o]),n.__webglDepthbuffer[o]=t.createRenderbuffer(),w(n.__webglDepthbuffer[o],e)}else t.bindFramebuffer(t.FRAMEBUFFER,n.__webglFramebuffer),n.__webglDepthbuffer=t.createRenderbuffer(),w(n.__webglDepthbuffer,e);t.bindFramebuffer(t.FRAMEBUFFER,null)}function T(e){var i=r.get(e),o=r.get(e.texture);e.addEventListener("dispose",d),o.__webglTexture=t.createTexture(),A.textures++;var a=e.isWebGLRenderTargetCube===!0,s=u(e);if(a){i.__webglFramebuffer=[];for(var c=0;c<6;c++)i.__webglFramebuffer[c]=t.createFramebuffer()}else i.__webglFramebuffer=t.createFramebuffer();if(a){n.bindTexture(t.TEXTURE_CUBE_MAP,o.__webglTexture),x(t.TEXTURE_CUBE_MAP,e.texture,s);for(var c=0;c<6;c++)_(i.__webglFramebuffer[c],e,t.COLOR_ATTACHMENT0,t.TEXTURE_CUBE_MAP_POSITIVE_X+c);e.texture.generateMipmaps&&s&&t.generateMipmap(t.TEXTURE_CUBE_MAP),n.bindTexture(t.TEXTURE_CUBE_MAP,null)}else n.bindTexture(t.TEXTURE_2D,o.__webglTexture),x(t.TEXTURE_2D,e.texture,s),_(i.__webglFramebuffer,e,t.COLOR_ATTACHMENT0,t.TEXTURE_2D),e.texture.generateMipmaps&&s&&t.generateMipmap(t.TEXTURE_2D),n.bindTexture(t.TEXTURE_2D,null);e.depthBuffer&&E(e)}function S(e){var i=e.texture;if(i.generateMipmaps&&u(e)&&i.minFilter!==la&&i.minFilter!==da){var o=e&&e.isWebGLRenderTargetCube?t.TEXTURE_CUBE_MAP:t.TEXTURE_2D,a=r.get(i).__webglTexture;n.bindTexture(o,a),t.generateMipmap(o),n.bindTexture(o,null)}}var A=a.memory,L="undefined"!=typeof WebGL2RenderingContext&&t instanceof WebGL2RenderingContext;this.setTexture2D=g,this.setTextureCube=v,this.setTextureCubeDynamic=y,this.setupRenderTarget=T,this.updateRenderTargetMipmap=S}function oe(){var t={};return{get:function(e){var n=e.uuid,r=t[n];return void 0===r&&(r={},t[n]=r),r},delete:function(e){delete t[e.uuid]},clear:function(){t={}}}}function ae(t,e,n){function r(){var e=!1,n=new a,r=null,i=new a;return{setMask:function(n){r===n||e||(t.colorMask(n,n,n,n),r=n)},setLocked:function(t){e=t},setClear:function(e,r,o,a,s){s===!0&&(e*=a,r*=a,o*=a),n.set(e,r,o,a),i.equals(n)===!1&&(t.clearColor(e,r,o,a),i.copy(n))},reset:function(){e=!1,r=null,i.set(0,0,0,1)}}}function i(){var e=!1,n=null,r=null,i=null;return{setTest:function(e){e?d(t.DEPTH_TEST):p(t.DEPTH_TEST)},setMask:function(r){n===r||e||(t.depthMask(r),n=r)},setFunc:function(e){if(r!==e){if(e)switch(e){case zo:t.depthFunc(t.NEVER);break;case Fo:t.depthFunc(t.ALWAYS);break;case Bo:t.depthFunc(t.LESS);break;case ko:t.depthFunc(t.LEQUAL);break;case Go:t.depthFunc(t.EQUAL);break;case Ho:t.depthFunc(t.GEQUAL);break;case Vo:t.depthFunc(t.GREATER);break;case jo:t.depthFunc(t.NOTEQUAL);break;default:t.depthFunc(t.LEQUAL)}else t.depthFunc(t.LEQUAL);r=e}},setLocked:function(t){e=t},setClear:function(e){i!==e&&(t.clearDepth(e),i=e)},reset:function(){e=!1,n=null,r=null,i=null}}}function o(){var e=!1,n=null,r=null,i=null,o=null,a=null,s=null,u=null,c=null;return{setTest:function(e){e?d(t.STENCIL_TEST):p(t.STENCIL_TEST)},setMask:function(r){n===r||e||(t.stencilMask(r),n=r)},setFunc:function(e,n,a){r===e&&i===n&&o===a||(t.stencilFunc(e,n,a),r=e,i=n,o=a)},setOp:function(e,n,r){a===e&&s===n&&u===r||(t.stencilOp(e,n,r),a=e,s=n,u=r)},setLocked:function(t){e=t},setClear:function(e){c!==e&&(t.clearStencil(e),c=e)},reset:function(){e=!1,n=null,r=null,i=null,o=null,a=null,s=null,u=null,c=null}}}function s(e,n,r){var i=new Uint8Array(4),o=t.createTexture();t.bindTexture(e,o),t.texParameteri(e,t.TEXTURE_MIN_FILTER,t.NEAREST),t.texParameteri(e,t.TEXTURE_MAG_FILTER,t.NEAREST);for(var a=0;a<r;a++)t.texImage2D(n+a,0,t.RGBA,1,1,0,t.RGBA,t.UNSIGNED_BYTE,i);return o}function u(){F.setClear(0,0,0,1),B.setClear(1),k.setClear(0),d(t.DEPTH_TEST),b(ko),T(!1),S(Ki),d(t.CULL_FACE),d(t.BLEND),g(go)}function c(){for(var t=0,e=H.length;t<e;t++)H[t]=0}function l(n){if(H[n]=1,0===V[n]&&(t.enableVertexAttribArray(n),V[n]=1),0!==j[n]){var r=e.get("ANGLE_instanced_arrays");r.vertexAttribDivisorANGLE(n,0),j[n]=0}}function h(e,n,r){H[e]=1,0===V[e]&&(t.enableVertexAttribArray(e),V[e]=1),j[e]!==n&&(r.vertexAttribDivisorANGLE(e,n),j[e]=n)}function f(){for(var e=0,n=V.length;e!==n;++e)V[e]!==H[e]&&(t.disableVertexAttribArray(e),V[e]=0)}function d(e){W[e]!==!0&&(t.enable(e),W[e]=!0)}function p(e){W[e]!==!1&&(t.disable(e),W[e]=!1)}function m(){if(null===X&&(X=[],e.get("WEBGL_compressed_texture_pvrtc")||e.get("WEBGL_compressed_texture_s3tc")||e.get("WEBGL_compressed_texture_etc1")))for(var n=t.getParameter(t.COMPRESSED_TEXTURE_FORMATS),r=0;r<n.length;r++)X.push(n[r]);return X}function g(e,r,i,o,a,s,u,c){e!==mo?d(t.BLEND):p(t.BLEND),e===q&&c===tt||(e===vo?c?(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===yo?c?(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===xo?c?(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)):c?(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)),q=e,tt=c),e===bo?(a=a||r,s=s||i,u=u||o,r===Y&&a===Q||(t.blendEquationSeparate(n(r),n(a)),Y=r,Q=a),i===Z&&o===J&&s===K&&u===$||(t.blendFuncSeparate(n(i),n(o),n(s),n(u)),Z=i,J=o,K=s,$=u)):(Y=null,Z=null,J=null,Q=null,K=null,$=null)}function v(t){F.setMask(t)}function y(t){B.setTest(t)}function x(t){B.setMask(t)}function b(t){B.setFunc(t)}function _(t){k.setTest(t)}function w(t){k.setMask(t)}function M(t,e,n){k.setFunc(t,e,n)}function E(t,e,n){k.setOp(t,e,n)}function T(e){et!==e&&(e?t.frontFace(t.CW):t.frontFace(t.CCW),et=e)}function S(e){e!==Qi?(d(t.CULL_FACE),e!==nt&&(e===Ki?t.cullFace(t.BACK):e===$i?t.cullFace(t.FRONT):t.cullFace(t.FRONT_AND_BACK))):p(t.CULL_FACE),nt=e}function A(e){e!==rt&&(ct&&t.lineWidth(e),rt=e)}function L(e,n,r){e?(d(t.POLYGON_OFFSET_FILL),it===n&&ot===r||(t.polygonOffset(n,r),it=n,ot=r)):p(t.POLYGON_OFFSET_FILL)}function R(){return at}function P(e){at=e,e?d(t.SCISSOR_TEST):p(t.SCISSOR_TEST)}function C(e){void 0===e&&(e=t.TEXTURE0+st-1),lt!==e&&(t.activeTexture(e),lt=e)}function N(e,n){null===lt&&C();var r=ht[lt];void 0===r&&(r={type:void 0,texture:void 0},ht[lt]=r),r.type===e&&r.texture===n||(t.bindTexture(e,n||pt[e]),r.type=e,r.texture=n)}function I(){try{t.compressedTexImage2D.apply(t,arguments)}catch(t){console.error(t)}}function U(){try{t.texImage2D.apply(t,arguments)}catch(t){console.error(t)}}function O(e){ft.equals(e)===!1&&(t.scissor(e.x,e.y,e.z,e.w),ft.copy(e))}function D(e){dt.equals(e)===!1&&(t.viewport(e.x,e.y,e.z,e.w),dt.copy(e))}function z(){for(var e=0;e<V.length;e++)1===V[e]&&(t.disableVertexAttribArray(e),V[e]=0);W={},X=null,lt=null,ht={},q=null,et=null,nt=null,F.reset(),B.reset(),k.reset()}var F=new r,B=new i,k=new o,G=t.getParameter(t.MAX_VERTEX_ATTRIBS),H=new Uint8Array(G),V=new Uint8Array(G),j=new Uint8Array(G),W={},X=null,q=null,Y=null,Z=null,J=null,Q=null,K=null,$=null,tt=!1,et=null,nt=null,rt=null,it=null,ot=null,at=null,st=t.getParameter(t.MAX_TEXTURE_IMAGE_UNITS),ut=parseFloat(/^WebGL\ ([0-9])/.exec(t.getParameter(t.VERSION))[1]),ct=parseFloat(ut)>=1,lt=null,ht={},ft=new a,dt=new a,pt={};return pt[t.TEXTURE_2D]=s(t.TEXTURE_2D,t.TEXTURE_2D,1),pt[t.TEXTURE_CUBE_MAP]=s(t.TEXTURE_CUBE_MAP,t.TEXTURE_CUBE_MAP_POSITIVE_X,6),{buffers:{color:F,depth:B,stencil:k},init:u,initAttributes:c,enableAttribute:l,enableAttributeAndDivisor:h,disableUnusedAttributes:f,enable:d,disable:p,getCompressedTextureFormats:m,setBlending:g,setColorWrite:v,setDepthTest:y,setDepthWrite:x,setDepthFunc:b,setStencilTest:_,setStencilWrite:w,setStencilFunc:M,setStencilOp:E,setFlipSided:T,setCullFace:S,setLineWidth:A,setPolygonOffset:L,getScissorTest:R,setScissorTest:P,activeTexture:C,bindTexture:N,compressedTexImage2D:I,texImage2D:U,scissor:O,viewport:D,reset:z}}function se(t,e,n){function r(){if(void 0!==o)return o;var n=e.get("EXT_texture_filter_anisotropic");return o=null!==n?t.getParameter(n.MAX_TEXTURE_MAX_ANISOTROPY_EXT):0}function i(e){if("highp"===e){if(t.getShaderPrecisionFormat(t.VERTEX_SHADER,t.HIGH_FLOAT).precision>0&&t.getShaderPrecisionFormat(t.FRAGMENT_SHADER,t.HIGH_FLOAT).precision>0)return"highp";e="mediump"}return"mediump"===e&&t.getShaderPrecisionFormat(t.VERTEX_SHADER,t.MEDIUM_FLOAT).precision>0&&t.getShaderPrecisionFormat(t.FRAGMENT_SHADER,t.MEDIUM_FLOAT).precision>0?"mediump":"lowp"}var o,a=void 0!==n.precision?n.precision:"highp",s=i(a);s!==a&&(console.warn("THREE.WebGLRenderer:",a,"not supported, using",s,"instead."),a=s);var u=n.logarithmicDepthBuffer===!0&&!!e.get("EXT_frag_depth"),c=t.getParameter(t.MAX_TEXTURE_IMAGE_UNITS),l=t.getParameter(t.MAX_VERTEX_TEXTURE_IMAGE_UNITS),h=t.getParameter(t.MAX_TEXTURE_SIZE),f=t.getParameter(t.MAX_CUBE_MAP_TEXTURE_SIZE),d=t.getParameter(t.MAX_VERTEX_ATTRIBS),p=t.getParameter(t.MAX_VERTEX_UNIFORM_VECTORS),m=t.getParameter(t.MAX_VARYING_VECTORS),g=t.getParameter(t.MAX_FRAGMENT_UNIFORM_VECTORS),v=l>0,y=!!e.get("OES_texture_float"),x=v&&y;return{getMaxAnisotropy:r,getMaxPrecision:i,precision:a,logarithmicDepthBuffer:u,maxTextures:c,maxVertexTextures:l,maxTextureSize:h,maxCubemapSize:f,maxAttributes:d,maxVertexUniforms:p,maxVaryings:m,maxFragmentUniforms:g,vertexTextures:v,floatFragmentTextures:y,floatVertexTextures:x}}function ue(t){var e={};return{get:function(n){if(void 0!==e[n])return e[n];var r;switch(n){case"WEBGL_depth_texture":r=t.getExtension("WEBGL_depth_texture")||t.getExtension("MOZ_WEBGL_depth_texture")||t.getExtension("WEBKIT_WEBGL_depth_texture");break;case"EXT_texture_filter_anisotropic":r=t.getExtension("EXT_texture_filter_anisotropic")||t.getExtension("MOZ_EXT_texture_filter_anisotropic")||t.getExtension("WEBKIT_EXT_texture_filter_anisotropic");break;case"WEBGL_compressed_texture_s3tc":r=t.getExtension("WEBGL_compressed_texture_s3tc")||t.getExtension("MOZ_WEBGL_compressed_texture_s3tc")||t.getExtension("WEBKIT_WEBGL_compressed_texture_s3tc");break;case"WEBGL_compressed_texture_pvrtc":r=t.getExtension("WEBGL_compressed_texture_pvrtc")||t.getExtension("WEBKIT_WEBGL_compressed_texture_pvrtc");break;case"WEBGL_compressed_texture_etc1":r=t.getExtension("WEBGL_compressed_texture_etc1");break;default:r=t.getExtension(n)}return null===r&&console.warn("THREE.WebGLRenderer: "+n+" extension not supported."),e[n]=r,r}}}function ce(){function t(){c.value!==r&&(c.value=r,c.needsUpdate=i>0),n.numPlanes=i,n.numIntersection=0}function e(t,e,r,i){var o=null!==t?t.length:0,a=null;if(0!==o){if(a=c.value,i!==!0||null===a){var l=r+4*o,h=e.matrixWorldInverse;u.getNormalMatrix(h),(null===a||a.length<l)&&(a=new Float32Array(l));for(var f=0,d=r;f!==o;++f,d+=4)s.copy(t[f]).applyMatrix4(h,u),s.normal.toArray(a,d),a[d+3]=s.constant}c.value=a,c.needsUpdate=!0}return n.numPlanes=o,a}var n=this,r=null,i=0,o=!1,a=!1,s=new it,u=new rt,c={value:null,needsUpdate:!1};this.uniform=c,this.numPlanes=0,this.numIntersection=0,this.init=function(t,n,a){var s=0!==t.length||n||0!==i||o;return o=n,r=e(t,a,0),i=t.length,s},this.beginShadows=function(){a=!0,e(null)},this.endShadows=function(){a=!1,t()},this.setState=function(n,s,u,l,h,f){if(!o||null===n||0===n.length||a&&!u)a?e(null):t();else{var d=a?0:i,p=4*d,m=h.clippingState||null;c.value=m,m=e(n,l,p,f);for(var g=0;g!==p;++g)m[g]=r[g];h.clippingState=m,this.numIntersection=s?this.numPlanes:0,this.numPlanes+=d}}}function le(t){function e(){return null===ft?St:1}function n(){te.init(),te.scissor(yt.copy(At).multiplyScalar(St)),te.viewport(bt.copy(Ct).multiplyScalar(St)),te.buffers.color.setClear(wt.r,wt.g,wt.b,Mt,Y)}function r(){ht=null,vt=null,gt="",mt=-1,te.reset()}function i(t){t.preventDefault(),r(),n(),ne.clear()}function o(t){var e=t.target;e.removeEventListener("dispose",o),s(e)}function s(t){u(t),ne.delete(t)}function u(t){var e=ne.get(t).program;t.program=void 0,void 0!==e&&fe.releaseProgram(e)}function c(t,e,n,r){var i;if(n&&n.isInstancedBufferGeometry&&(i=Kt.get("ANGLE_instanced_arrays"),null===i))return void console.error("THREE.WebGLRenderer.setupVertexAttributes: using THREE.InstancedBufferGeometry but hardware does not support extension ANGLE_instanced_arrays.");void 0===r&&(r=0),te.initAttributes();var o=n.attributes,a=e.getAttributes(),s=t.defaultAttributeValues;for(var u in a){var c=a[u];if(c>=0){var l=o[u];if(void 0!==l){var h=l.normalized,f=l.itemSize,d=he.getAttributeProperties(l),p=d.__webglBuffer,m=d.type,g=d.bytesPerElement;if(l.isInterleavedBufferAttribute){var v=l.data,y=v.stride,x=l.offset;v&&v.isInstancedInterleavedBuffer?(te.enableAttributeAndDivisor(c,v.meshPerAttribute,i),void 0===n.maxInstancedCount&&(n.maxInstancedCount=v.meshPerAttribute*v.count)):te.enableAttribute(c),Jt.bindBuffer(Jt.ARRAY_BUFFER,p),Jt.vertexAttribPointer(c,f,m,h,y*g,(r*y+x)*g)}else l.isInstancedBufferAttribute?(te.enableAttributeAndDivisor(c,l.meshPerAttribute,i),void 0===n.maxInstancedCount&&(n.maxInstancedCount=l.meshPerAttribute*l.count)):te.enableAttribute(c),Jt.bindBuffer(Jt.ARRAY_BUFFER,p),Jt.vertexAttribPointer(c,f,m,h,0,r*f*g)}else if(void 0!==s){var b=s[u];if(void 0!==b)switch(b.length){case 2:Jt.vertexAttrib2fv(c,b);break;case 3:Jt.vertexAttrib3fv(c,b);break;case 4:Jt.vertexAttrib4fv(c,b);break;default:Jt.vertexAttrib1fv(c,b)}}}}te.disableUnusedAttributes()}function f(t,e){return Math.abs(e[0])-Math.abs(t[0])}function d(t,e){return t.object.renderOrder!==e.object.renderOrder?t.object.renderOrder-e.object.renderOrder:t.material.program&&e.material.program&&t.material.program!==e.material.program?t.material.program.id-e.material.program.id:t.material.id!==e.material.id?t.material.id-e.material.id:t.z!==e.z?t.z-e.z:t.id-e.id}function p(t,e){return t.object.renderOrder!==e.object.renderOrder?t.object.renderOrder-e.object.renderOrder:t.z!==e.z?e.z-t.z:t.id-e.id}function m(t,e,n,r,i){var o,a;n.transparent?(o=rt,a=++it):(o=tt,a=++et);var s=o[a];void 0!==s?(s.id=t.id,s.object=t,s.geometry=e,s.material=n,s.z=Wt.z,s.group=i):(s={id:t.id,object:t,geometry:e,material:n,z:Wt.z,group:i},o.push(s))}function g(t){var e=t.geometry;return null===e.boundingSphere&&e.computeBoundingSphere(),Vt.copy(e.boundingSphere).applyMatrix4(t.matrixWorld),y(Vt)}function v(t){return Vt.center.set(0,0,0),Vt.radius=.7071067811865476,Vt.applyMatrix4(t.matrixWorld),y(Vt)}function y(t){if(!It.intersectsSphere(t))return!1;var e=Ot.numPlanes;if(0===e)return!0;var n=lt.clippingPlanes,r=t.center,i=-t.radius,o=0;do if(n[o].distanceToPoint(r)<i)return!1;while(++o!==e);return!0}function x(t,e){if(t.visible!==!1){var n=0!==(t.layers.mask&e.layers.mask);if(n)if(t.isLight)K.push(t);else if(t.isSprite)t.frustumCulled!==!1&&v(t)!==!0||ut.push(t);else if(t.isLensFlare)ct.push(t);else if(t.isImmediateRenderObject)lt.sortObjects===!0&&(Wt.setFromMatrixPosition(t.matrixWorld),Wt.applyMatrix4(jt)),m(t,null,t.material,Wt.z,null);else if((t.isMesh||t.isLine||t.isPoints)&&(t.isSkinnedMesh&&t.skeleton.update(),t.frustumCulled===!1||g(t)===!0)){var r=t.material;if(r.visible===!0){lt.sortObjects===!0&&(Wt.setFromMatrixPosition(t.matrixWorld),Wt.applyMatrix4(jt));var i=he.update(t);if(r.isMultiMaterial)for(var o=i.groups,a=r.materials,s=0,u=o.length;s<u;s++){var c=o[s],l=a[c.materialIndex];l.visible===!0&&m(t,i,l,Wt.z,c)}else m(t,i,r,Wt.z,null)}}for(var h=t.children,s=0,u=h.length;s<u;s++)x(h[s],e)}}function b(t,e,n,r){for(var i=0,o=t.length;i<o;i++){var a=t[i],s=a.object,u=a.geometry,c=void 0===r?a.material:r,l=a.group;if(s.modelViewMatrix.multiplyMatrices(n.matrixWorldInverse,s.matrixWorld),s.normalMatrix.getNormalMatrix(s.modelViewMatrix),s.onBeforeRender(lt,e,n,u,c,l),s.isImmediateRenderObject){w(c);var h=M(n,e.fog,c,s);gt="",s.render(function(t){lt.renderBufferImmediate(t,h,c)})}else lt.renderBufferDirect(n,e.fog,u,c,s,l);s.onAfterRender(lt,e,n,u,c,l)}}function _(t,e,n){var r=ne.get(t),i=fe.getParameters(t,Yt,e,Ot.numPlanes,Ot.numIntersection,n),a=fe.getProgramCode(t,i),s=r.program,c=!0;if(void 0===s)t.addEventListener("dispose",o);else if(s.code!==a)u(t);else{if(void 0!==i.shaderID)return;c=!1}if(c){if(i.shaderID){var l=Ec[i.shaderID];r.__webglShader={name:t.type,uniforms:bs.clone(l.uniforms),vertexShader:l.vertexShader,fragmentShader:l.fragmentShader}}else r.__webglShader={name:t.type,uniforms:t.uniforms,vertexShader:t.vertexShader,fragmentShader:t.fragmentShader};t.__webglShader=r.__webglShader,s=fe.acquireProgram(t,i,a),r.program=s,t.program=s}var h=s.getAttributes();if(t.morphTargets){t.numSupportedMorphTargets=0;for(var f=0;f<lt.maxMorphTargets;f++)h["morphTarget"+f]>=0&&t.numSupportedMorphTargets++}if(t.morphNormals){t.numSupportedMorphNormals=0;for(var f=0;f<lt.maxMorphNormals;f++)h["morphNormal"+f]>=0&&t.numSupportedMorphNormals++}var d=r.__webglShader.uniforms;(t.isShaderMaterial||t.isRawShaderMaterial)&&t.clipping!==!0||(r.numClippingPlanes=Ot.numPlanes,r.numIntersection=Ot.numIntersection,d.clippingPlanes=Ot.uniform),r.fog=e,r.lightsHash=Yt.hash,t.lights&&(d.ambientLightColor.value=Yt.ambient,d.directionalLights.value=Yt.directional,d.spotLights.value=Yt.spot,d.rectAreaLights.value=Yt.rectArea,d.pointLights.value=Yt.point,d.hemisphereLights.value=Yt.hemi,d.directionalShadowMap.value=Yt.directionalShadowMap,d.directionalShadowMatrix.value=Yt.directionalShadowMatrix,d.spotShadowMap.value=Yt.spotShadowMap,d.spotShadowMatrix.value=Yt.spotShadowMatrix,d.pointShadowMap.value=Yt.pointShadowMap,d.pointShadowMatrix.value=Yt.pointShadowMatrix);var p=r.program.getUniforms(),m=X.seqWithValue(p.seq,d);r.uniformsList=m}function w(t){t.side===uo?te.disable(Jt.CULL_FACE):te.enable(Jt.CULL_FACE),te.setFlipSided(t.side===so),t.transparent===!0?te.setBlending(t.blending,t.blendEquation,t.blendSrc,t.blendDst,t.blendEquationAlpha,t.blendSrcAlpha,t.blendDstAlpha,t.premultipliedAlpha):te.setBlending(mo),te.setDepthFunc(t.depthFunc),te.setDepthTest(t.depthTest),te.setDepthWrite(t.depthWrite),te.setColorWrite(t.colorWrite),te.setPolygonOffset(t.polygonOffset,t.polygonOffsetFactor,t.polygonOffsetUnits)}function M(t,e,n,r){_t=0;var i=ne.get(n);if(Gt&&(Ht||t!==vt)){var o=t===vt&&n.id===mt;Ot.setState(n.clippingPlanes,n.clipIntersection,n.clipShadows,t,i,o)}n.needsUpdate===!1&&(void 0===i.program?n.needsUpdate=!0:n.fog&&i.fog!==e?n.needsUpdate=!0:n.lights&&i.lightsHash!==Yt.hash?n.needsUpdate=!0:void 0===i.numClippingPlanes||i.numClippingPlanes===Ot.numPlanes&&i.numIntersection===Ot.numIntersection||(n.needsUpdate=!0)),n.needsUpdate&&(_(n,e,r),n.needsUpdate=!1);var a=!1,s=!1,u=!1,c=i.program,l=c.getUniforms(),h=i.__webglShader.uniforms;if(c.id!==ht&&(Jt.useProgram(c.program),ht=c.id,a=!0,s=!0,u=!0),n.id!==mt&&(mt=n.id,s=!0),a||t!==vt){if(l.set(Jt,t,"projectionMatrix"),$t.logarithmicDepthBuffer&&l.setValue(Jt,"logDepthBufFC",2/(Math.log(t.far+1)/Math.LN2)),t!==vt&&(vt=t,s=!0,u=!0),n.isShaderMaterial||n.isMeshPhongMaterial||n.isMeshStandardMaterial||n.envMap){var f=l.map.cameraPosition;void 0!==f&&f.setValue(Jt,Wt.setFromMatrixPosition(t.matrixWorld))}(n.isMeshPhongMaterial||n.isMeshLambertMaterial||n.isMeshBasicMaterial||n.isMeshStandardMaterial||n.isShaderMaterial||n.skinning)&&l.setValue(Jt,"viewMatrix",t.matrixWorldInverse),l.set(Jt,lt,"toneMappingExposure"),l.set(Jt,lt,"toneMappingWhitePoint")}if(n.skinning){l.setOptional(Jt,r,"bindMatrix"),l.setOptional(Jt,r,"bindMatrixInverse");var d=r.skeleton;d&&($t.floatVertexTextures&&d.useVertexTexture?(l.set(Jt,d,"boneTexture"),l.set(Jt,d,"boneTextureWidth"),l.set(Jt,d,"boneTextureHeight")):l.setOptional(Jt,d,"boneMatrices"))}return s&&(n.lights&&O(h,u),e&&n.fog&&L(h,e),(n.isMeshBasicMaterial||n.isMeshLambertMaterial||n.isMeshPhongMaterial||n.isMeshStandardMaterial||n.isMeshNormalMaterial||n.isMeshDepthMaterial)&&E(h,n),n.isLineBasicMaterial?T(h,n):n.isLineDashedMaterial?(T(h,n),S(h,n)):n.isPointsMaterial?A(h,n):n.isMeshLambertMaterial?R(h,n):n.isMeshToonMaterial?C(h,n):n.isMeshPhongMaterial?P(h,n):n.isMeshPhysicalMaterial?I(h,n):n.isMeshStandardMaterial?N(h,n):n.isMeshDepthMaterial?n.displacementMap&&(h.displacementMap.value=n.displacementMap,h.displacementScale.value=n.displacementScale,h.displacementBias.value=n.displacementBias):n.isMeshNormalMaterial&&U(h,n),void 0!==h.ltcMat&&(h.ltcMat.value=THREE.UniformsLib.LTC_MAT_TEXTURE),void 0!==h.ltcMag&&(h.ltcMag.value=THREE.UniformsLib.LTC_MAG_TEXTURE),X.upload(Jt,i.uniformsList,h,lt)),l.set(Jt,r,"modelViewMatrix"),l.set(Jt,r,"normalMatrix"),l.setValue(Jt,"modelMatrix",r.matrixWorld),c}function E(t,e){t.opacity.value=e.opacity,t.diffuse.value=e.color,e.emissive&&t.emissive.value.copy(e.emissive).multiplyScalar(e.emissiveIntensity),t.map.value=e.map,t.specularMap.value=e.specularMap,t.alphaMap.value=e.alphaMap,e.lightMap&&(t.lightMap.value=e.lightMap,t.lightMapIntensity.value=e.lightMapIntensity),e.aoMap&&(t.aoMap.value=e.aoMap,t.aoMapIntensity.value=e.aoMapIntensity);var n;if(e.map?n=e.map:e.specularMap?n=e.specularMap:e.displacementMap?n=e.displacementMap:e.normalMap?n=e.normalMap:e.bumpMap?n=e.bumpMap:e.roughnessMap?n=e.roughnessMap:e.metalnessMap?n=e.metalnessMap:e.alphaMap?n=e.alphaMap:e.emissiveMap&&(n=e.emissiveMap),void 0!==n){n.isWebGLRenderTarget&&(n=n.texture);var r=n.offset,i=n.repeat;t.offsetRepeat.value.set(r.x,r.y,i.x,i.y)}t.envMap.value=e.envMap,t.flipEnvMap.value=e.envMap&&e.envMap.isCubeTexture?-1:1,t.reflectivity.value=e.reflectivity,t.refractionRatio.value=e.refractionRatio}function T(t,e){t.diffuse.value=e.color,t.opacity.value=e.opacity}function S(t,e){t.dashSize.value=e.dashSize,t.totalSize.value=e.dashSize+e.gapSize,t.scale.value=e.scale}function A(t,e){if(t.diffuse.value=e.color,t.opacity.value=e.opacity,t.size.value=e.size*St,t.scale.value=.5*Tt,t.map.value=e.map,null!==e.map){var n=e.map.offset,r=e.map.repeat;t.offsetRepeat.value.set(n.x,n.y,r.x,r.y)}}function L(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 R(t,e){e.emissiveMap&&(t.emissiveMap.value=e.emissiveMap)}function P(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 C(t,e){P(t,e),e.gradientMap&&(t.gradientMap.value=e.gradientMap)}function N(t,e){t.roughness.value=e.roughness,t.metalness.value=e.metalness,e.roughnessMap&&(t.roughnessMap.value=e.roughnessMap),e.metalnessMap&&(t.metalnessMap.value=e.metalnessMap),e.emissiveMap&&(t.emissiveMap.value=e.emissiveMap),e.bumpMap&&(t.bumpMap.value=e.bumpMap,t.bumpScale.value=e.bumpScale),e.normalMap&&(t.normalMap.value=e.normalMap,t.normalScale.value.copy(e.normalScale)),e.displacementMap&&(t.displacementMap.value=e.displacementMap,t.displacementScale.value=e.displacementScale,t.displacementBias.value=e.displacementBias),e.envMap&&(t.envMapIntensity.value=e.envMapIntensity)}function I(t,e){t.clearCoat.value=e.clearCoat,t.clearCoatRoughness.value=e.clearCoatRoughness,N(t,e)}function U(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 O(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 D(t){for(var e=0,n=0,r=t.length;n<r;n++){var i=t[n];i.castShadow&&(Yt.shadows[e++]=i)}Yt.shadows.length=e}function z(t,e){var n,r,i,o,a,s,u,c=0,l=0,f=0,d=e.matrixWorldInverse,p=0,m=0,g=0,v=0,y=0;for(n=0,r=t.length;n<r;n++)if(i=t[n],o=i.color,a=i.intensity,s=i.distance,u=i.shadow&&i.shadow.map?i.shadow.map.texture:null,i.isAmbientLight)c+=o.r*a,l+=o.g*a,f+=o.b*a;else if(i.isDirectionalLight){var x=de.get(i);x.color.copy(i.color).multiplyScalar(i.intensity),x.direction.setFromMatrixPosition(i.matrixWorld),Wt.setFromMatrixPosition(i.target.matrixWorld),x.direction.sub(Wt),x.direction.transformDirection(d),x.shadow=i.castShadow,i.castShadow&&(x.shadowBias=i.shadow.bias,x.shadowRadius=i.shadow.radius,x.shadowMapSize=i.shadow.mapSize),Yt.directionalShadowMap[p]=u,Yt.directionalShadowMatrix[p]=i.shadow.matrix,Yt.directional[p++]=x}else if(i.isSpotLight){var x=de.get(i);x.position.setFromMatrixPosition(i.matrixWorld),x.position.applyMatrix4(d),x.color.copy(o).multiplyScalar(a),x.distance=s,x.direction.setFromMatrixPosition(i.matrixWorld),Wt.setFromMatrixPosition(i.target.matrixWorld),x.direction.sub(Wt),x.direction.transformDirection(d),x.coneCos=Math.cos(i.angle),x.penumbraCos=Math.cos(i.angle*(1-i.penumbra)),x.decay=0===i.distance?0:i.decay,x.shadow=i.castShadow,i.castShadow&&(x.shadowBias=i.shadow.bias,x.shadowRadius=i.shadow.radius,x.shadowMapSize=i.shadow.mapSize),Yt.spotShadowMap[g]=u,Yt.spotShadowMatrix[g]=i.shadow.matrix,Yt.spot[g++]=x}else if(i.isRectAreaLight){var x=de.get(i);x.color.copy(o).multiplyScalar(a/(i.width*i.height)),x.position.setFromMatrixPosition(i.matrixWorld),x.position.applyMatrix4(d),qt.identity(),Xt.copy(i.matrixWorld),Xt.premultiply(d),qt.extractRotation(Xt),x.halfWidth.set(.5*i.width,0,0),x.halfHeight.set(0,.5*i.height,0),x.halfWidth.applyMatrix4(qt),x.halfHeight.applyMatrix4(qt),Yt.rectArea[v++]=x}else if(i.isPointLight){var x=de.get(i);x.position.setFromMatrixPosition(i.matrixWorld),x.position.applyMatrix4(d),x.color.copy(i.color).multiplyScalar(i.intensity),x.distance=i.distance,x.decay=0===i.distance?0:i.decay,x.shadow=i.castShadow,i.castShadow&&(x.shadowBias=i.shadow.bias,x.shadowRadius=i.shadow.radius,x.shadowMapSize=i.shadow.mapSize),Yt.pointShadowMap[m]=u,void 0===Yt.pointShadowMatrix[m]&&(Yt.pointShadowMatrix[m]=new h),Wt.setFromMatrixPosition(i.matrixWorld).negate(),Yt.pointShadowMatrix[m].identity().setPosition(Wt),Yt.point[m++]=x}else if(i.isHemisphereLight){var x=de.get(i);x.direction.setFromMatrixPosition(i.matrixWorld),x.direction.transformDirection(d),x.direction.normalize(),x.skyColor.copy(i.color).multiplyScalar(a),x.groundColor.copy(i.groundColor).multiplyScalar(a),Yt.hemi[y++]=x}Yt.ambient[0]=c,Yt.ambient[1]=l,Yt.ambient[2]=f,Yt.directional.length=p,Yt.spot.length=g,Yt.rectArea.length=v,Yt.point.length=m,Yt.hemi.length=y,Yt.hash=p+","+m+","+g+","+v+","+y+","+Yt.shadows.length}function F(){var t=_t;return t>=$t.maxTextures&&console.warn("WebGLRenderer: trying to use "+t+" texture units while this GPU supports only "+$t.maxTextures),_t+=1,t}function B(t){var e;if(t===sa)return Jt.REPEAT;if(t===ua)return Jt.CLAMP_TO_EDGE;if(t===ca)return Jt.MIRRORED_REPEAT;if(t===la)return Jt.NEAREST;if(t===ha)return Jt.NEAREST_MIPMAP_NEAREST;if(t===fa)return Jt.NEAREST_MIPMAP_LINEAR;if(t===da)return Jt.LINEAR;if(t===pa)return Jt.LINEAR_MIPMAP_NEAREST;if(t===ma)return Jt.LINEAR_MIPMAP_LINEAR;if(t===ga)return Jt.UNSIGNED_BYTE;if(t===Ea)return Jt.UNSIGNED_SHORT_4_4_4_4;if(t===Ta)return Jt.UNSIGNED_SHORT_5_5_5_1;if(t===Sa)return Jt.UNSIGNED_SHORT_5_6_5;if(t===va)return Jt.BYTE;if(t===ya)return Jt.SHORT;if(t===xa)return Jt.UNSIGNED_SHORT;if(t===ba)return Jt.INT;if(t===_a)return Jt.UNSIGNED_INT;if(t===wa)return Jt.FLOAT;if(t===Ma&&(e=Kt.get("OES_texture_half_float"),null!==e))return e.HALF_FLOAT_OES;if(t===La)return Jt.ALPHA;if(t===Ra)return Jt.RGB;if(t===Pa)return Jt.RGBA;if(t===Ca)return Jt.LUMINANCE;if(t===Na)return Jt.LUMINANCE_ALPHA;if(t===Ua)return Jt.DEPTH_COMPONENT;if(t===Oa)return Jt.DEPTH_STENCIL;if(t===_o)return Jt.FUNC_ADD;if(t===wo)return Jt.FUNC_SUBTRACT;if(t===Mo)return Jt.FUNC_REVERSE_SUBTRACT;if(t===So)return Jt.ZERO;if(t===Ao)return Jt.ONE;if(t===Lo)return Jt.SRC_COLOR;if(t===Ro)return Jt.ONE_MINUS_SRC_COLOR;if(t===Po)return Jt.SRC_ALPHA;if(t===Co)return Jt.ONE_MINUS_SRC_ALPHA;if(t===No)return Jt.DST_ALPHA;if(t===Io)return Jt.ONE_MINUS_DST_ALPHA;if(t===Uo)return Jt.DST_COLOR;if(t===Oo)return Jt.ONE_MINUS_DST_COLOR;if(t===Do)return Jt.SRC_ALPHA_SATURATE;if((t===Da||t===za||t===Fa||t===Ba)&&(e=Kt.get("WEBGL_compressed_texture_s3tc"),null!==e)){if(t===Da)return e.COMPRESSED_RGB_S3TC_DXT1_EXT;if(t===za)return e.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(t===Fa)return e.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(t===Ba)return e.COMPRESSED_RGBA_S3TC_DXT5_EXT}if((t===ka||t===Ga||t===Ha||t===Va)&&(e=Kt.get("WEBGL_compressed_texture_pvrtc"),null!==e)){if(t===ka)return e.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(t===Ga)return e.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(t===Ha)return e.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(t===Va)return e.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}if(t===ja&&(e=Kt.get("WEBGL_compressed_texture_etc1"),null!==e))return e.COMPRESSED_RGB_ETC1_WEBGL;if((t===Eo||t===To)&&(e=Kt.get("EXT_blend_minmax"),null!==e)){if(t===Eo)return e.MIN_EXT;if(t===To)return e.MAX_EXT}return t===Aa&&(e=Kt.get("WEBGL_depth_texture"),null!==e)?e.UNSIGNED_INT_24_8_WEBGL:0}console.log("THREE.WebGLRenderer",Zi),t=t||{};var k=void 0!==t.canvas?t.canvas:document.createElementNS("http://www.w3.org/1999/xhtml","canvas"),G=void 0!==t.context?t.context:null,H=void 0!==t.alpha&&t.alpha,V=void 0===t.depth||t.depth,j=void 0===t.stencil||t.stencil,W=void 0!==t.antialias&&t.antialias,Y=void 0===t.premultipliedAlpha||t.premultipliedAlpha,Z=void 0!==t.preserveDrawingBuffer&&t.preserveDrawingBuffer,K=[],tt=[],et=-1,rt=[],it=-1,st=new Float32Array(8),ut=[],ct=[];this.domElement=k,this.context=null,this.autoClear=!0,this.autoClearColor=!0,this.autoClearDepth=!0,this.autoClearStencil=!0,this.sortObjects=!0,this.clippingPlanes=[],this.localClippingEnabled=!1,this.gammaFactor=2,this.gammaInput=!1,this.gammaOutput=!1,this.physicallyCorrectLights=!1,this.toneMapping=Zo,this.toneMappingExposure=1,this.toneMappingWhitePoint=1,this.maxMorphTargets=8,this.maxMorphNormals=4;var lt=this,ht=null,ft=null,dt=null,mt=-1,gt="",vt=null,yt=new a,xt=null,bt=new a,_t=0,wt=new q(0),Mt=0,Et=k.width,Tt=k.height,St=1,At=new a(0,0,Et,Tt),Lt=!1,Ct=new a(0,0,Et,Tt),It=new ot,Ot=new ce,Gt=!1,Ht=!1,Vt=new nt,jt=new h,Wt=new l,Xt=new h,qt=new h,Yt={
+hash:"",ambient:[0,0,0],directional:[],directionalShadowMap:[],directionalShadowMatrix:[],spot:[],spotShadowMap:[],spotShadowMatrix:[],rectArea:[],point:[],pointShadowMap:[],pointShadowMatrix:[],hemi:[],shadows:[]},Zt={calls:0,vertices:0,faces:0,points:0};this.info={render:Zt,memory:{geometries:0,textures:0},programs:null};var Jt;try{var Qt={alpha:H,depth:V,stencil:j,antialias:W,premultipliedAlpha:Y,preserveDrawingBuffer:Z};if(Jt=G||k.getContext("webgl",Qt)||k.getContext("experimental-webgl",Qt),null===Jt)throw null!==k.getContext("webgl")?"Error creating WebGL context with your selected attributes.":"Error creating WebGL context.";void 0===Jt.getShaderPrecisionFormat&&(Jt.getShaderPrecisionFormat=function(){return{rangeMin:1,rangeMax:1,precision:1}}),k.addEventListener("webglcontextlost",i,!1)}catch(t){console.error("THREE.WebGLRenderer: "+t)}var Kt=new ue(Jt);Kt.get("WEBGL_depth_texture"),Kt.get("OES_texture_float"),Kt.get("OES_texture_float_linear"),Kt.get("OES_texture_half_float"),Kt.get("OES_texture_half_float_linear"),Kt.get("OES_standard_derivatives"),Kt.get("ANGLE_instanced_arrays"),Kt.get("OES_element_index_uint")&&(Rt.MaxIndex=4294967296);var $t=new se(Jt,Kt,t),te=new ae(Jt,Kt,B),ne=new oe,le=new ie(Jt,Kt,te,ne,$t,B,this.info),he=new re(Jt,ne,this.info),fe=new ee(this,$t),de=new kt;this.info.programs=fe.programs;var pe,me,ge,ve,ye=new Bt(Jt,Kt,Zt),xe=new Ft(Jt,Kt,Zt);n(),this.context=Jt,this.capabilities=$t,this.extensions=Kt,this.properties=ne,this.state=te;var be=new at(this,Yt,he,$t);this.shadowMap=be;var _e=new Q(this,ut),we=new J(this,ct);this.getContext=function(){return Jt},this.getContextAttributes=function(){return Jt.getContextAttributes()},this.forceContextLoss=function(){Kt.get("WEBGL_lose_context").loseContext()},this.getMaxAnisotropy=function(){return $t.getMaxAnisotropy()},this.getPrecision=function(){return $t.precision},this.getPixelRatio=function(){return St},this.setPixelRatio=function(t){void 0!==t&&(St=t,this.setSize(Ct.z,Ct.w,!1))},this.getSize=function(){return{width:Et,height:Tt}},this.setSize=function(t,e,n){Et=t,Tt=e,k.width=t*St,k.height=e*St,n!==!1&&(k.style.width=t+"px",k.style.height=e+"px"),this.setViewport(0,0,t,e)},this.setViewport=function(t,e,n,r){te.viewport(Ct.set(t,e,n,r))},this.setScissor=function(t,e,n,r){te.scissor(At.set(t,e,n,r))},this.setScissorTest=function(t){te.setScissorTest(Lt=t)},this.getClearColor=function(){return wt},this.setClearColor=function(t,e){wt.set(t),Mt=void 0!==e?e:1,te.buffers.color.setClear(wt.r,wt.g,wt.b,Mt,Y)},this.getClearAlpha=function(){return Mt},this.setClearAlpha=function(t){Mt=t,te.buffers.color.setClear(wt.r,wt.g,wt.b,Mt,Y)},this.clear=function(t,e,n){var r=0;(void 0===t||t)&&(r|=Jt.COLOR_BUFFER_BIT),(void 0===e||e)&&(r|=Jt.DEPTH_BUFFER_BIT),(void 0===n||n)&&(r|=Jt.STENCIL_BUFFER_BIT),Jt.clear(r)},this.clearColor=function(){this.clear(!0,!1,!1)},this.clearDepth=function(){this.clear(!1,!0,!1)},this.clearStencil=function(){this.clear(!1,!1,!0)},this.clearTarget=function(t,e,n,r){this.setRenderTarget(t),this.clear(e,n,r)},this.resetGLState=r,this.dispose=function(){rt=[],it=-1,tt=[],et=-1,k.removeEventListener("webglcontextlost",i,!1)},this.renderBufferImmediate=function(t,e,n){te.initAttributes();var r=ne.get(t);t.hasPositions&&!r.position&&(r.position=Jt.createBuffer()),t.hasNormals&&!r.normal&&(r.normal=Jt.createBuffer()),t.hasUvs&&!r.uv&&(r.uv=Jt.createBuffer()),t.hasColors&&!r.color&&(r.color=Jt.createBuffer());var i=e.getAttributes();if(t.hasPositions&&(Jt.bindBuffer(Jt.ARRAY_BUFFER,r.position),Jt.bufferData(Jt.ARRAY_BUFFER,t.positionArray,Jt.DYNAMIC_DRAW),te.enableAttribute(i.position),Jt.vertexAttribPointer(i.position,3,Jt.FLOAT,!1,0,0)),t.hasNormals){if(Jt.bindBuffer(Jt.ARRAY_BUFFER,r.normal),!n.isMeshPhongMaterial&&!n.isMeshStandardMaterial&&!n.isMeshNormalMaterial&&n.shading===co)for(var o=0,a=3*t.count;o<a;o+=9){var s=t.normalArray,u=(s[o+0]+s[o+3]+s[o+6])/3,c=(s[o+1]+s[o+4]+s[o+7])/3,l=(s[o+2]+s[o+5]+s[o+8])/3;s[o+0]=u,s[o+1]=c,s[o+2]=l,s[o+3]=u,s[o+4]=c,s[o+5]=l,s[o+6]=u,s[o+7]=c,s[o+8]=l}Jt.bufferData(Jt.ARRAY_BUFFER,t.normalArray,Jt.DYNAMIC_DRAW),te.enableAttribute(i.normal),Jt.vertexAttribPointer(i.normal,3,Jt.FLOAT,!1,0,0)}t.hasUvs&&n.map&&(Jt.bindBuffer(Jt.ARRAY_BUFFER,r.uv),Jt.bufferData(Jt.ARRAY_BUFFER,t.uvArray,Jt.DYNAMIC_DRAW),te.enableAttribute(i.uv),Jt.vertexAttribPointer(i.uv,2,Jt.FLOAT,!1,0,0)),t.hasColors&&n.vertexColors!==ho&&(Jt.bindBuffer(Jt.ARRAY_BUFFER,r.color),Jt.bufferData(Jt.ARRAY_BUFFER,t.colorArray,Jt.DYNAMIC_DRAW),te.enableAttribute(i.color),Jt.vertexAttribPointer(i.color,3,Jt.FLOAT,!1,0,0)),te.disableUnusedAttributes(),Jt.drawArrays(Jt.TRIANGLES,0,t.count),t.count=0},this.renderBufferDirect=function(t,n,r,i,o,a){w(i);var s=M(t,n,i,o),u=!1,l=r.id+"_"+s.id+"_"+i.wireframe;l!==gt&&(gt=l,u=!0);var h=o.morphTargetInfluences;if(void 0!==h){for(var d=[],p=0,m=h.length;p<m;p++){var g=h[p];d.push([g,p])}d.sort(f),d.length>8&&(d.length=8);for(var v=r.morphAttributes,p=0,m=d.length;p<m;p++){var g=d[p];if(st[p]=g[0],0!==g[0]){var y=g[1];i.morphTargets===!0&&v.position&&r.addAttribute("morphTarget"+p,v.position[y]),i.morphNormals===!0&&v.normal&&r.addAttribute("morphNormal"+p,v.normal[y])}else i.morphTargets===!0&&r.removeAttribute("morphTarget"+p),i.morphNormals===!0&&r.removeAttribute("morphNormal"+p)}for(var p=d.length,x=st.length;p<x;p++)st[p]=0;s.getUniforms().setValue(Jt,"morphTargetInfluences",st),u=!0}var y=r.index,b=r.attributes.position,_=1;i.wireframe===!0&&(y=he.getWireframeAttribute(r),_=2);var E;null!==y?(E=xe,E.setIndex(y)):E=ye,u&&(c(i,s,r),null!==y&&Jt.bindBuffer(Jt.ELEMENT_ARRAY_BUFFER,he.getAttributeBuffer(y)));var T=0;null!==y?T=y.count:void 0!==b&&(T=b.count);var S=r.drawRange.start*_,A=r.drawRange.count*_,L=null!==a?a.start*_:0,R=null!==a?a.count*_:1/0,P=Math.max(S,L),C=Math.min(T,S+A,L+R)-1,N=Math.max(0,C-P+1);if(0!==N){if(o.isMesh)if(i.wireframe===!0)te.setLineWidth(i.wireframeLinewidth*e()),E.setMode(Jt.LINES);else switch(o.drawMode){case ts:E.setMode(Jt.TRIANGLES);break;case es:E.setMode(Jt.TRIANGLE_STRIP);break;case ns:E.setMode(Jt.TRIANGLE_FAN)}else if(o.isLine){var I=i.linewidth;void 0===I&&(I=1),te.setLineWidth(I*e()),o.isLineSegments?E.setMode(Jt.LINES):E.setMode(Jt.LINE_STRIP)}else o.isPoints&&E.setMode(Jt.POINTS);r&&r.isInstancedBufferGeometry?r.maxInstancedCount>0&&E.renderInstances(r,P,N):E.render(P,N)}},this.render=function(t,e,n,r){if(void 0!==e&&e.isCamera!==!0)return void console.error("THREE.WebGLRenderer.render: camera is not an instance of THREE.Camera.");gt="",mt=-1,vt=null,t.autoUpdate===!0&&t.updateMatrixWorld(),null===e.parent&&e.updateMatrixWorld(),e.matrixWorldInverse.getInverse(e.matrixWorld),jt.multiplyMatrices(e.projectionMatrix,e.matrixWorldInverse),It.setFromMatrix(jt),K.length=0,et=-1,it=-1,ut.length=0,ct.length=0,Ht=this.localClippingEnabled,Gt=Ot.init(this.clippingPlanes,Ht,e),x(t,e),tt.length=et+1,rt.length=it+1,lt.sortObjects===!0&&(tt.sort(d),rt.sort(p)),Gt&&Ot.beginShadows(),D(K),be.render(t,e),z(K,e),Gt&&Ot.endShadows(),Zt.calls=0,Zt.vertices=0,Zt.faces=0,Zt.points=0,void 0===n&&(n=null),this.setRenderTarget(n);var i=t.background;if(null===i?te.buffers.color.setClear(wt.r,wt.g,wt.b,Mt,Y):i&&i.isColor&&(te.buffers.color.setClear(i.r,i.g,i.b,1,Y),r=!0),(this.autoClear||r)&&this.clear(this.autoClearColor,this.autoClearDepth,this.autoClearStencil),i&&i.isCubeTexture?(void 0===ge&&(ge=new Dt,ve=new Pt(new Nt(5,5,5),new $({uniforms:Ec.cube.uniforms,vertexShader:Ec.cube.vertexShader,fragmentShader:Ec.cube.fragmentShader,side:so,depthTest:!1,depthWrite:!1,fog:!1}))),ge.projectionMatrix.copy(e.projectionMatrix),ge.matrixWorld.extractRotation(e.matrixWorld),ge.matrixWorldInverse.getInverse(ge.matrixWorld),ve.material.uniforms.tCube.value=i,ve.modelViewMatrix.multiplyMatrices(ge.matrixWorldInverse,ve.matrixWorld),he.update(ve),lt.renderBufferDirect(ge,null,ve.geometry,ve.material,ve,null)):i&&i.isTexture&&(void 0===pe&&(pe=new zt(-1,1,1,-1,0,1),me=new Pt(new Ut(2,2),new pt({depthTest:!1,depthWrite:!1,fog:!1}))),me.material.map=i,he.update(me),lt.renderBufferDirect(pe,null,me.geometry,me.material,me,null)),t.overrideMaterial){var o=t.overrideMaterial;b(tt,t,e,o),b(rt,t,e,o)}else te.setBlending(mo),b(tt,t,e),b(rt,t,e);_e.render(t,e),we.render(t,e,bt),n&&le.updateRenderTargetMipmap(n),te.setDepthTest(!0),te.setDepthWrite(!0),te.setColorWrite(!0)},this.setFaceCulling=function(t,e){te.setCullFace(t),te.setFlipSided(e===eo)},this.allocTextureUnit=F,this.setTexture2D=function(){var t=!1;return function(e,n){e&&e.isWebGLRenderTarget&&(t||(console.warn("THREE.WebGLRenderer.setTexture2D: don't use render targets as textures. Use their .texture property instead."),t=!0),e=e.texture),le.setTexture2D(e,n)}}(),this.setTexture=function(){var t=!1;return function(e,n){t||(console.warn("THREE.WebGLRenderer: .setTexture is deprecated, use setTexture2D instead."),t=!0),le.setTexture2D(e,n)}}(),this.setTextureCube=function(){var t=!1;return function(e,n){e&&e.isWebGLRenderTargetCube&&(t||(console.warn("THREE.WebGLRenderer.setTextureCube: don't use cube render targets as textures. Use their .texture property instead."),t=!0),e=e.texture),e&&e.isCubeTexture||Array.isArray(e.image)&&6===e.image.length?le.setTextureCube(e,n):le.setTextureCubeDynamic(e,n)}}(),this.getCurrentRenderTarget=function(){return ft},this.setRenderTarget=function(t){ft=t,t&&void 0===ne.get(t).__webglFramebuffer&&le.setupRenderTarget(t);var e,n=t&&t.isWebGLRenderTargetCube;if(t){var r=ne.get(t);e=n?r.__webglFramebuffer[t.activeCubeFace]:r.__webglFramebuffer,yt.copy(t.scissor),xt=t.scissorTest,bt.copy(t.viewport)}else e=null,yt.copy(At).multiplyScalar(St),xt=Lt,bt.copy(Ct).multiplyScalar(St);if(dt!==e&&(Jt.bindFramebuffer(Jt.FRAMEBUFFER,e),dt=e),te.scissor(yt),te.setScissorTest(xt),te.viewport(bt),n){var i=ne.get(t.texture);Jt.framebufferTexture2D(Jt.FRAMEBUFFER,Jt.COLOR_ATTACHMENT0,Jt.TEXTURE_CUBE_MAP_POSITIVE_X+t.activeCubeFace,i.__webglTexture,t.activeMipMapLevel)}},this.readRenderTargetPixels=function(t,e,n,r,i,o){if((t&&t.isWebGLRenderTarget)===!1)return void console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");var a=ne.get(t).__webglFramebuffer;if(a){var s=!1;a!==dt&&(Jt.bindFramebuffer(Jt.FRAMEBUFFER,a),s=!0);try{var u=t.texture,c=u.format,l=u.type;if(c!==Pa&&B(c)!==Jt.getParameter(Jt.IMPLEMENTATION_COLOR_READ_FORMAT))return void console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.");if(!(l===ga||B(l)===Jt.getParameter(Jt.IMPLEMENTATION_COLOR_READ_TYPE)||l===wa&&(Kt.get("OES_texture_float")||Kt.get("WEBGL_color_buffer_float"))||l===Ma&&Kt.get("EXT_color_buffer_half_float")))return void console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.");Jt.checkFramebufferStatus(Jt.FRAMEBUFFER)===Jt.FRAMEBUFFER_COMPLETE?e>=0&&e<=t.width-r&&n>=0&&n<=t.height-i&&Jt.readPixels(e,n,r,i,B(c),B(l),o):console.error("THREE.WebGLRenderer.readRenderTargetPixels: readPixels from renderTarget failed. Framebuffer not complete.")}finally{s&&Jt.bindFramebuffer(Jt.FRAMEBUFFER,dt)}}}}function he(t,e){this.name="",this.color=new q(t),this.density=void 0!==e?e:25e-5}function fe(t,e,n){this.name="",this.color=new q(t),this.near=void 0!==e?e:1,this.far=void 0!==n?n:1e3}function de(){lt.call(this),this.type="Scene",this.background=null,this.fog=null,this.overrideMaterial=null,this.autoUpdate=!0}function pe(t,e,n,r,i){lt.call(this),this.lensFlares=[],this.positionScreen=new l,this.customUpdateCallback=void 0,void 0!==t&&this.add(t,e,n,r,i)}function me(t){K.call(this),this.type="SpriteMaterial",this.color=new q(16777215),this.map=null,this.rotation=0,this.fog=!1,this.lights=!1,this.setValues(t)}function ge(t){lt.call(this),this.type="Sprite",this.material=void 0!==t?t:new me}function ve(){lt.call(this),this.type="LOD",Object.defineProperties(this,{levels:{enumerable:!0,value:[]}})}function ye(t,e,n){if(this.useVertexTexture=void 0===n||n,this.identityMatrix=new h,t=t||[],this.bones=t.slice(0),this.useVertexTexture){var r=Math.sqrt(4*this.bones.length);r=ds.nextPowerOfTwo(Math.ceil(r)),r=Math.max(r,4),this.boneTextureWidth=r,this.boneTextureHeight=r,this.boneMatrices=new Float32Array(this.boneTextureWidth*this.boneTextureHeight*4),this.boneTexture=new Y(this.boneMatrices,this.boneTextureWidth,this.boneTextureHeight,Pa,wa)}else this.boneMatrices=new Float32Array(16*this.bones.length);if(void 0===e)this.calculateInverses();else if(this.bones.length===e.length)this.boneInverses=e.slice(0);else{console.warn("THREE.Skeleton bonInverses is the wrong length."),this.boneInverses=[];for(var i=0,o=this.bones.length;i<o;i++)this.boneInverses.push(new h)}}function xe(){lt.call(this),this.type="Bone"}function be(t,e,n){Pt.call(this,t,e),this.type="SkinnedMesh",this.bindMode="attached",this.bindMatrix=new h,this.bindMatrixInverse=new h;var r=[];if(this.geometry&&void 0!==this.geometry.bones){for(var i,o,a=0,s=this.geometry.bones.length;a<s;++a)o=this.geometry.bones[a],i=new xe,r.push(i),i.name=o.name,i.position.fromArray(o.pos),i.quaternion.fromArray(o.rotq),void 0!==o.scl&&i.scale.fromArray(o.scl);for(var a=0,s=this.geometry.bones.length;a<s;++a)o=this.geometry.bones[a],o.parent!==-1&&null!==o.parent&&void 0!==r[o.parent]?r[o.parent].add(r[a]):this.add(r[a])}this.normalizeSkinWeights(),this.updateMatrixWorld(!0),this.bind(new ye(r,void 0,n),this.matrixWorld)}function _e(t){K.call(this),this.type="LineBasicMaterial",this.color=new q(16777215),this.linewidth=1,this.linecap="round",this.linejoin="round",this.lights=!1,this.setValues(t)}function we(t,e,n){return 1===n?(console.warn("THREE.Line: parameter THREE.LinePieces no longer supported. Created THREE.LineSegments instead."),new Me(t,e)):(lt.call(this),this.type="Line",this.geometry=void 0!==t?t:new Rt,void(this.material=void 0!==e?e:new _e({color:16777215*Math.random()})))}function Me(t,e){we.call(this,t,e),this.type="LineSegments"}function Ee(t){K.call(this),this.type="PointsMaterial",this.color=new q(16777215),this.map=null,this.size=1,this.sizeAttenuation=!0,this.lights=!1,this.setValues(t)}function Te(t,e){lt.call(this),this.type="Points",this.geometry=void 0!==t?t:new Rt,this.material=void 0!==e?e:new Ee({color:16777215*Math.random()})}function Se(){lt.call(this),this.type="Group"}function Ae(t,e,n,r,i,a,s,u,c){function l(){requestAnimationFrame(l),t.readyState>=t.HAVE_CURRENT_DATA&&(h.needsUpdate=!0)}o.call(this,t,e,n,r,i,a,s,u,c),this.generateMipmaps=!1;var h=this;l()}function Le(t,e,n,r,i,a,s,u,c,l,h,f){o.call(this,null,a,s,u,c,l,r,i,h,f),this.image={width:e,height:n},this.mipmaps=t,this.flipY=!1,this.generateMipmaps=!1}function Re(t,e,n,r,i,a,s,u,c){o.call(this,t,e,n,r,i,a,s,u,c),this.needsUpdate=!0}function Pe(t,e,n,r,i,a,s,u,c,l){if(l=void 0!==l?l:Ua,l!==Ua&&l!==Oa)throw new Error("DepthTexture format must be either THREE.DepthFormat or THREE.DepthStencilFormat");void 0===n&&l===Ua&&(n=xa),void 0===n&&l===Oa&&(n=Aa),o.call(this,null,r,i,a,s,u,l,n,c),this.image={width:t,height:e},this.magFilter=void 0!==s?s:la,this.minFilter=void 0!==u?u:la,this.flipY=!1,this.generateMipmaps=!1}function Ce(t){function e(t,e){return t-e}Rt.call(this),this.type="WireframeGeometry";var n,r,i,o,a,s,u,c,h=[],f=[0,0],d={},p=["a","b","c"];if(t&&t.isGeometry){var m=t.faces;for(n=0,i=m.length;n<i;n++){var g=m[n];for(r=0;r<3;r++)f[0]=g[p[r]],f[1]=g[p[(r+1)%3]],f.sort(e),u=f.toString(),void 0===d[u]&&(d[u]={index1:f[0],index2:f[1]})}for(u in d)s=d[u],c=t.vertices[s.index1],h.push(c.x,c.y,c.z),c=t.vertices[s.index2],h.push(c.x,c.y,c.z)}else if(t&&t.isBufferGeometry){var v,y,x,b,_,w,M,E;if(c=new l,null!==t.index){for(v=t.attributes.position,y=t.index,x=t.groups,0===x.length&&t.addGroup(0,y.count),o=0,a=x.length;o<a;++o)for(b=x[o],_=b.start,w=b.count,n=_,i=_+w;n<i;n+=3)for(r=0;r<3;r++)f[0]=y.getX(n+r),f[1]=y.getX(n+(r+1)%3),f.sort(e),u=f.toString(),void 0===d[u]&&(d[u]={index1:f[0],index2:f[1]});for(u in d)s=d[u],c.fromBufferAttribute(v,s.index1),h.push(c.x,c.y,c.z),c.fromBufferAttribute(v,s.index2),h.push(c.x,c.y,c.z)}else for(v=t.attributes.position,n=0,i=v.count/3;n<i;n++)for(r=0;r<3;r++)M=3*n+r,c.fromBufferAttribute(v,M),h.push(c.x,c.y,c.z),E=3*n+(r+1)%3,c.fromBufferAttribute(v,E),h.push(c.x,c.y,c.z)}this.addAttribute("position",new Mt(h,3))}function Ne(t,e,n){Lt.call(this),this.type="ParametricGeometry",this.parameters={func:t,slices:e,stacks:n},this.fromBufferGeometry(new Ie(t,e,n)),this.mergeVertices()}function Ie(t,e,n){Rt.call(this),this.type="ParametricBufferGeometry",this.parameters={func:t,slices:e,stacks:n};var r,i,o=[],a=[],s=[],u=e+1;for(r=0;r<=n;r++){var c=r/n;for(i=0;i<=e;i++){var l=i/e,h=t(l,c);a.push(h.x,h.y,h.z),s.push(l,c)}}for(r=0;r<n;r++)for(i=0;i<e;i++){var f=r*u+i,d=r*u+i+1,p=(r+1)*u+i+1,m=(r+1)*u+i;o.push(f,d,m),o.push(d,p,m)}this.setIndex(o),this.addAttribute("position",new Mt(a,3)),this.addAttribute("uv",new Mt(s,2)),this.computeVertexNormals()}function Ue(t,e,n,r){Lt.call(this),this.type="PolyhedronGeometry",this.parameters={vertices:t,indices:e,radius:n,detail:r},this.fromBufferGeometry(new Oe(t,e,n,r)),this.mergeVertices()}function Oe(t,e,n,r){function o(t){for(var n=new l,r=new l,i=new l,o=0;o<e.length;o+=3)f(e[o+0],n),f(e[o+1],r),f(e[o+2],i),a(n,r,i,t)}function a(t,e,n,r){var i,o,a=Math.pow(2,r),s=[];for(i=0;i<=a;i++){s[i]=[];var u=t.clone().lerp(n,i/a),c=e.clone().lerp(n,i/a),l=a-i;for(o=0;o<=l;o++)0===o&&i===a?s[i][o]=u:s[i][o]=u.clone().lerp(c,o/l)}for(i=0;i<a;i++)for(o=0;o<2*(a-i)-1;o++){var f=Math.floor(o/2);o%2===0?(h(s[i][f+1]),h(s[i+1][f]),h(s[i][f])):(h(s[i][f+1]),h(s[i+1][f+1]),h(s[i+1][f]))}}function s(t){for(var e=new l,n=0;n<v.length;n+=3)e.x=v[n+0],e.y=v[n+1],e.z=v[n+2],e.normalize().multiplyScalar(t),v[n+0]=e.x,v[n+1]=e.y,v[n+2]=e.z}function u(){for(var t=new l,e=0;e<v.length;e+=3){t.x=v[e+0],t.y=v[e+1],t.z=v[e+2];var n=m(t)/2/Math.PI+.5,r=g(t)/Math.PI+.5;y.push(n,1-r)}d(),c()}function c(){for(var t=0;t<y.length;t+=6){var e=y[t+0],n=y[t+2],r=y[t+4],i=Math.max(e,n,r),o=Math.min(e,n,r);i>.9&&o<.1&&(e<.2&&(y[t+0]+=1),n<.2&&(y[t+2]+=1),r<.2&&(y[t+4]+=1))}}function h(t){v.push(t.x,t.y,t.z)}function f(e,n){var r=3*e;n.x=t[r+0],n.y=t[r+1],n.z=t[r+2]}function d(){for(var t=new l,e=new l,n=new l,r=new l,o=new i,a=new i,s=new i,u=0,c=0;u<v.length;u+=9,c+=6){t.set(v[u+0],v[u+1],v[u+2]),e.set(v[u+3],v[u+4],v[u+5]),n.set(v[u+6],v[u+7],v[u+8]),o.set(y[c+0],y[c+1]),a.set(y[c+2],y[c+3]),s.set(y[c+4],y[c+5]),r.copy(t).add(e).add(n).divideScalar(3);var h=m(r);p(o,c+0,t,h),p(a,c+2,e,h),p(s,c+4,n,h)}}function p(t,e,n,r){r<0&&1===t.x&&(y[e]=t.x-1),0===n.x&&0===n.z&&(y[e]=r/2/Math.PI+.5)}function m(t){return Math.atan2(t.z,-t.x)}function g(t){return Math.atan2(-t.y,Math.sqrt(t.x*t.x+t.z*t.z))}Rt.call(this),this.type="PolyhedronBufferGeometry",this.parameters={vertices:t,indices:e,radius:n,detail:r},n=n||1,r=r||0;var v=[],y=[];o(r),s(n),u(),this.addAttribute("position",new Mt(v,3)),this.addAttribute("normal",new Mt(v.slice(),3)),this.addAttribute("uv",new Mt(y,2)),this.normalizeNormals()}function De(t,e){Lt.call(this),this.type="TetrahedronGeometry",this.parameters={radius:t,detail:e},this.fromBufferGeometry(new ze(t,e)),this.mergeVertices()}function ze(t,e){var n=[1,1,1,-1,-1,1,-1,1,-1,1,-1,-1],r=[2,1,0,0,3,2,1,3,0,2,3,1];Oe.call(this,n,r,t,e),this.type="TetrahedronBufferGeometry",this.parameters={radius:t,detail:e}}function Fe(t,e){Lt.call(this),this.type="OctahedronGeometry",this.parameters={radius:t,detail:e},this.fromBufferGeometry(new Be(t,e)),this.mergeVertices()}function Be(t,e){var n=[1,0,0,-1,0,0,0,1,0,0,-1,0,0,0,1,0,0,-1],r=[0,2,4,0,4,3,0,3,5,0,5,2,1,2,5,1,5,3,1,3,4,1,4,2];Oe.call(this,n,r,t,e),this.type="OctahedronBufferGeometry",this.parameters={radius:t,detail:e}}function ke(t,e){Lt.call(this),this.type="IcosahedronGeometry",this.parameters={radius:t,detail:e},this.fromBufferGeometry(new Ge(t,e)),this.mergeVertices()}function Ge(t,e){var n=(1+Math.sqrt(5))/2,r=[-1,n,0,1,n,0,-1,-n,0,1,-n,0,0,-1,n,0,1,n,0,-1,-n,0,1,-n,n,0,-1,n,0,1,-n,0,-1,-n,0,1],i=[0,11,5,0,5,1,0,1,7,0,7,10,0,10,11,1,5,9,5,11,4,11,10,2,10,7,6,7,1,8,3,9,4,3,4,2,3,2,6,3,6,8,3,8,9,4,9,5,2,4,11,6,2,10,8,6,7,9,8,1];Oe.call(this,r,i,t,e),this.type="IcosahedronBufferGeometry",this.parameters={radius:t,detail:e}}function He(t,e){Lt.call(this),this.type="DodecahedronGeometry",this.parameters={radius:t,detail:e},this.fromBufferGeometry(new Ve(t,e)),this.mergeVertices()}function Ve(t,e){var n=(1+Math.sqrt(5))/2,r=1/n,i=[-1,-1,-1,-1,-1,1,-1,1,-1,-1,1,1,1,-1,-1,1,-1,1,1,1,-1,1,1,1,0,-r,-n,0,-r,n,0,r,-n,0,r,n,-r,-n,0,-r,n,0,r,-n,0,r,n,0,-n,0,-r,n,0,-r,-n,0,r,n,0,r],o=[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];Oe.call(this,i,o,t,e),this.type="DodecahedronBufferGeometry",this.parameters={radius:t,detail:e}}function je(t,e,n,r,i,o){Lt.call(this),this.type="TubeGeometry",this.parameters={path:t,tubularSegments:e,radius:n,radialSegments:r,closed:i},void 0!==o&&console.warn("THREE.TubeGeometry: taper has been removed.");var a=new We(t,e,n,r,i);this.tangents=a.tangents,this.normals=a.normals,this.binormals=a.binormals,this.fromBufferGeometry(a),this.mergeVertices()}function We(t,e,n,r,o){function a(){for(f=0;f<e;f++)s(f);s(o===!1?e:0),c(),u()}function s(i){var o=t.getPointAt(i/e),a=h.normals[i],s=h.binormals[i];for(d=0;d<=r;d++){var u=d/r*Math.PI*2,c=Math.sin(u),l=-Math.cos(u);m.x=l*a.x+c*s.x,m.y=l*a.y+c*s.y,m.z=l*a.z+c*s.z,m.normalize(),y.push(m.x,m.y,m.z),p.x=o.x+n*m.x,p.y=o.y+n*m.y,p.z=o.z+n*m.z,v.push(p.x,p.y,p.z)}}function u(){for(d=1;d<=e;d++)for(f=1;f<=r;f++){var t=(r+1)*(d-1)+(f-1),n=(r+1)*d+(f-1),i=(r+1)*d+f,o=(r+1)*(d-1)+f;b.push(t,n,o),b.push(n,i,o)}}function c(){for(f=0;f<=e;f++)for(d=0;d<=r;d++)g.x=f/e,g.y=d/r,x.push(g.x,g.y)}Rt.call(this),this.type="TubeBufferGeometry",this.parameters={path:t,tubularSegments:e,radius:n,radialSegments:r,closed:o},e=e||64,n=n||1,r=r||8,o=o||!1;var h=t.computeFrenetFrames(e,o);this.tangents=h.tangents,this.normals=h.normals,this.binormals=h.binormals;var f,d,p=new l,m=new l,g=new i,v=[],y=[],x=[],b=[];a(),this.setIndex(b),this.addAttribute("position",new Mt(v,3)),this.addAttribute("normal",new Mt(y,3)),this.addAttribute("uv",new Mt(x,2))}function Xe(t,e,n,r,i,o,a){Lt.call(this),this.type="TorusKnotGeometry",this.parameters={radius:t,tube:e,tubularSegments:n,radialSegments:r,p:i,q:o},void 0!==a&&console.warn("THREE.TorusKnotGeometry: heightScale has been deprecated. Use .scale( x, y, z ) instead."),this.fromBufferGeometry(new qe(t,e,n,r,i,o)),this.mergeVertices()}function qe(t,e,n,r,o,a){function s(t,e,n,r,i){var o=Math.cos(t),a=Math.sin(t),s=n/e*t,u=Math.cos(s);i.x=r*(2+u)*.5*o,i.y=r*(2+u)*a*.5,i.z=r*Math.sin(s)*.5}Rt.call(this),this.type="TorusKnotBufferGeometry",this.parameters={radius:t,tube:e,tubularSegments:n,radialSegments:r,p:o,q:a},t=t||100,e=e||40,n=Math.floor(n)||64,r=Math.floor(r)||8,o=o||2,a=a||3;var u,c,h=[],f=[],d=[],p=[],m=new l,g=new l,v=(new i,new l),y=new l,x=new l,b=new l,_=new l;for(u=0;u<=n;++u){var w=u/n*o*Math.PI*2;for(s(w,o,a,t,v),s(w+.01,o,a,t,y),b.subVectors(y,v),_.addVectors(y,v),x.crossVectors(b,_),_.crossVectors(x,b),x.normalize(),_.normalize(),c=0;c<=r;++c){var M=c/r*Math.PI*2,E=-e*Math.cos(M),T=e*Math.sin(M);m.x=v.x+(E*_.x+T*x.x),m.y=v.y+(E*_.y+T*x.y),m.z=v.z+(E*_.z+T*x.z),f.push(m.x,m.y,m.z),g.subVectors(m,v).normalize(),d.push(g.x,g.y,g.z),p.push(u/n),p.push(c/r)}}for(c=1;c<=n;c++)for(u=1;u<=r;u++){var S=(r+1)*(c-1)+(u-1),A=(r+1)*c+(u-1),L=(r+1)*c+u,R=(r+1)*(c-1)+u;h.push(S,A,R),h.push(A,L,R)}this.setIndex(h),this.addAttribute("position",new Mt(f,3)),this.addAttribute("normal",new Mt(d,3)),this.addAttribute("uv",new Mt(p,2))}function Ye(t,e,n,r,i){Lt.call(this),this.type="TorusGeometry",this.parameters={radius:t,tube:e,radialSegments:n,tubularSegments:r,arc:i},this.fromBufferGeometry(new Ze(t,e,n,r,i))}function Ze(t,e,n,r,i){Rt.call(this),this.type="TorusBufferGeometry",this.parameters={radius:t,tube:e,radialSegments:n,tubularSegments:r,arc:i},t=t||100,e=e||40,n=Math.floor(n)||8,r=Math.floor(r)||6,i=i||2*Math.PI;var o,a,s=[],u=[],c=[],h=[],f=new l,d=new l,p=new l;for(o=0;o<=n;o++)for(a=0;a<=r;a++){var m=a/r*i,g=o/n*Math.PI*2;d.x=(t+e*Math.cos(g))*Math.cos(m),d.y=(t+e*Math.cos(g))*Math.sin(m),d.z=e*Math.sin(g),u.push(d.x,d.y,d.z),f.x=t*Math.cos(m),f.y=t*Math.sin(m),p.subVectors(d,f).normalize(),c.push(p.x,p.y,p.z),h.push(a/r),h.push(o/n)}for(o=1;o<=n;o++)for(a=1;a<=r;a++){var v=(r+1)*o+a-1,y=(r+1)*(o-1)+a-1,x=(r+1)*(o-1)+a,b=(r+1)*o+a;s.push(v,y,b),s.push(y,x,b)}this.setIndex(s),this.addAttribute("position",new Mt(u,3)),this.addAttribute("normal",new Mt(c,3)),this.addAttribute("uv",new Mt(h,2))}function Je(t,e){return"undefined"==typeof t?void(t=[]):(Lt.call(this),this.type="ExtrudeGeometry",t=Array.isArray(t)?t:[t],this.addShapeList(t,e),void this.computeFaceNormals())}function Qe(t,e){e=e||{};var n=e.font;if((n&&n.isFont)===!1)return console.error("THREE.TextGeometry: font parameter is not an instance of THREE.Font."),new Lt;var r=n.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),Je.call(this,r,e),this.type="TextGeometry"}function Ke(t,e,n,r,i,o,a){Lt.call(this),this.type="SphereGeometry",this.parameters={radius:t,widthSegments:e,heightSegments:n,phiStart:r,phiLength:i,thetaStart:o,thetaLength:a},this.fromBufferGeometry(new $e(t,e,n,r,i,o,a))}function $e(t,e,n,r,i,o,a){Rt.call(this),this.type="SphereBufferGeometry",this.parameters={radius:t,widthSegments:e,heightSegments:n,phiStart:r,phiLength:i,thetaStart:o,thetaLength:a},t=t||50,e=Math.max(3,Math.floor(e)||8),n=Math.max(2,Math.floor(n)||6),r=void 0!==r?r:0,i=void 0!==i?i:2*Math.PI,o=void 0!==o?o:0,a=void 0!==a?a:Math.PI;var s,u,c=o+a,h=0,f=[],d=new l,p=new l,m=[],g=[],v=[],y=[];for(u=0;u<=n;u++){var x=[],b=u/n;for(s=0;s<=e;s++){var _=s/e;d.x=-t*Math.cos(r+_*i)*Math.sin(o+b*a),d.y=t*Math.cos(o+b*a),d.z=t*Math.sin(r+_*i)*Math.sin(o+b*a),g.push(d.x,d.y,d.z),p.set(d.x,d.y,d.z).normalize(),v.push(p.x,p.y,p.z),y.push(_,1-b),x.push(h++)}f.push(x)}for(u=0;u<n;u++)for(s=0;s<e;s++){var w=f[u][s+1],M=f[u][s],E=f[u+1][s],T=f[u+1][s+1];(0!==u||o>0)&&m.push(w,M,T),(u!==n-1||c<Math.PI)&&m.push(M,E,T)}this.setIndex(m),this.addAttribute("position",new Mt(g,3)),this.addAttribute("normal",new Mt(v,3)),this.addAttribute("uv",new Mt(y,2))}function tn(t,e,n,r,i,o){Lt.call(this),this.type="RingGeometry",this.parameters={innerRadius:t,outerRadius:e,thetaSegments:n,phiSegments:r,thetaStart:i,thetaLength:o},this.fromBufferGeometry(new en(t,e,n,r,i,o))}function en(t,e,n,r,o,a){Rt.call(this),this.type="RingBufferGeometry",this.parameters={innerRadius:t,outerRadius:e,thetaSegments:n,phiSegments:r,thetaStart:o,thetaLength:a},t=t||20,e=e||50,o=void 0!==o?o:0,a=void 0!==a?a:2*Math.PI,n=void 0!==n?Math.max(3,n):8,r=void 0!==r?Math.max(1,r):1;var s,u,c,h=[],f=[],d=[],p=[],m=t,g=(e-t)/r,v=new l,y=new i;for(u=0;u<=r;u++){for(c=0;c<=n;c++)s=o+c/n*a,v.x=m*Math.cos(s),v.y=m*Math.sin(s),f.push(v.x,v.y,v.z),d.push(0,0,1),y.x=(v.x/e+1)/2,y.y=(v.y/e+1)/2,p.push(y.x,y.y);m+=g}for(u=0;u<r;u++){var x=u*(n+1);for(c=0;c<n;c++){s=c+x;var b=s,_=s+n+1,w=s+n+2,M=s+1;h.push(b,_,M),h.push(_,w,M)}}this.setIndex(h),this.addAttribute("position",new Mt(f,3)),this.addAttribute("normal",new Mt(d,3)),this.addAttribute("uv",new Mt(p,2))}function nn(t,e,n,r){Lt.call(this),this.type="LatheGeometry",this.parameters={points:t,segments:e,phiStart:n,phiLength:r},this.fromBufferGeometry(new rn(t,e,n,r)),this.mergeVertices()}function rn(t,e,n,r){Rt.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=ds.clamp(r,0,2*Math.PI);var o,a,s,u=[],c=[],h=[],f=1/e,d=new l,p=new i;for(a=0;a<=e;a++){var m=n+a*f*r,g=Math.sin(m),v=Math.cos(m);for(s=0;s<=t.length-1;s++)d.x=t[s].x*g,d.y=t[s].y,d.z=t[s].x*v,c.push(d.x,d.y,d.z),p.x=a/e,p.y=s/(t.length-1),h.push(p.x,p.y)}for(a=0;a<e;a++)for(s=0;s<t.length-1;s++){o=s+a*t.length;var y=o,x=o+t.length,b=o+t.length+1,_=o+1;u.push(y,x,_),u.push(x,b,_)}if(this.setIndex(u),this.addAttribute("position",new Mt(c,3)),this.addAttribute("uv",new Mt(h,2)),this.computeVertexNormals(),r===2*Math.PI){var w=this.attributes.normal.array,M=new l,E=new l,T=new l;for(o=e*t.length*3,a=0,s=0;a<t.length;a++,s+=3)M.x=w[s+0],M.y=w[s+1],M.z=w[s+2],E.x=w[o+s+0],E.y=w[o+s+1],E.z=w[o+s+2],T.addVectors(M,E).normalize(),w[s+0]=w[o+s+0]=T.x,w[s+1]=w[o+s+1]=T.y,w[s+2]=w[o+s+2]=T.z}}function on(t,e){Lt.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 an(t,e)),this.mergeVertices()}function an(t,e){function n(t){var n,s,c,l=i.length/3,h=t.extractPoints(e),f=h.shape,d=h.holes;if(Rc.isClockWise(f)===!1)for(f=f.reverse(),n=0,s=d.length;n<s;n++)c=d[n],Rc.isClockWise(c)===!0&&(d[n]=c.reverse());var p=Rc.triangulateShape(f,d);for(n=0,s=d.length;n<s;n++)c=d[n],f=f.concat(c);for(n=0,s=f.length;n<s;n++){var m=f[n];i.push(m.x,m.y,0),o.push(0,0,1),a.push(m.x,m.y)}for(n=0,s=p.length;n<s;n++){var g=p[n],v=g[0]+l,y=g[1]+l,x=g[2]+l;r.push(v,y,x),u+=3}}Rt.call(this),this.type="ShapeBufferGeometry",this.parameters={shapes:t,curveSegments:e},e=e||12;var r=[],i=[],o=[],a=[],s=0,u=0;if(Array.isArray(t)===!1)n(t);else for(var c=0;c<t.length;c++)n(t[c]),this.addGroup(s,u,c),s+=u,u=0;this.setIndex(r),this.addAttribute("position",new Mt(i,3)),this.addAttribute("normal",new Mt(o,3)),this.addAttribute("uv",new Mt(a,2))}function sn(t,e){function n(t,e){return t-e}Rt.call(this),this.type="EdgesGeometry",this.parameters={thresholdAngle:e},e=void 0!==e?e:1;var r,i,o=[],a=Math.cos(ds.DEG2RAD*e),s=[0,0],u={},c=["a","b","c"];t.isBufferGeometry?(i=new Lt,i.fromBufferGeometry(t)):i=t.clone(),i.mergeVertices(),i.computeFaceNormals();for(var l=i.vertices,h=i.faces,f=0,d=h.length;f<d;f++)for(var p=h[f],m=0;m<3;m++)s[0]=p[c[m]],s[1]=p[c[(m+1)%3]],s.sort(n),r=s.toString(),void 0===u[r]?u[r]={index1:s[0],index2:s[1],face1:f,face2:void 0}:u[r].face2=f;for(r in u){var g=u[r];if(void 0===g.face2||h[g.face1].normal.dot(h[g.face2].normal)<=a){var v=l[g.index1];o.push(v.x,v.y,v.z),v=l[g.index2],o.push(v.x,v.y,v.z)}}this.addAttribute("position",new Mt(o,3))}function un(t,e,n,r,i,o,a,s){Lt.call(this),this.type="CylinderGeometry",this.parameters={radiusTop:t,radiusBottom:e,height:n,radialSegments:r,heightSegments:i,openEnded:o,thetaStart:a,thetaLength:s},this.fromBufferGeometry(new cn(t,e,n,r,i,o,a,s)),this.mergeVertices()}function cn(t,e,n,r,o,a,s,u){function c(){var i,a,c=new l,h=new l,_=0,w=(e-t)/n;for(a=0;a<=o;a++){var M=[],E=a/o,T=E*(e-t)+t;for(i=0;i<=r;i++){var S=i/r,A=S*u+s,L=Math.sin(A),R=Math.cos(A);h.x=T*L,h.y=-E*n+x,h.z=T*R,p.push(h.x,h.y,h.z),c.set(L,w,R).normalize(),m.push(c.x,c.y,c.z),g.push(S,1-E),M.push(v++)}y.push(M)}for(i=0;i<r;i++)for(a=0;a<o;a++){var P=y[a][i],C=y[a+1][i],N=y[a+1][i+1],I=y[a][i+1];d.push(P,C,I),d.push(C,N,I),_+=6}f.addGroup(b,_,0),b+=_}function h(n){var o,a,c,h=new i,y=new l,_=0,w=n===!0?t:e,M=n===!0?1:-1;for(a=v,o=1;o<=r;o++)p.push(0,x*M,0),m.push(0,M,0),g.push(.5,.5),v++;for(c=v,o=0;o<=r;o++){var E=o/r,T=E*u+s,S=Math.cos(T),A=Math.sin(T);y.x=w*A,y.y=x*M,y.z=w*S,p.push(y.x,y.y,y.z),m.push(0,M,0),h.x=.5*S+.5,h.y=.5*A*M+.5,g.push(h.x,h.y),v++}for(o=0;o<r;o++){var L=a+o,R=c+o;n===!0?d.push(R,R+1,L):d.push(R+1,R,L),_+=3}f.addGroup(b,_,n===!0?1:2),b+=_}Rt.call(this),this.type="CylinderBufferGeometry",this.parameters={radiusTop:t,radiusBottom:e,height:n,radialSegments:r,heightSegments:o,openEnded:a,thetaStart:s,thetaLength:u};var f=this;t=void 0!==t?t:20,e=void 0!==e?e:20,n=void 0!==n?n:100,r=Math.floor(r)||8,o=Math.floor(o)||1,
+a=void 0!==a&&a,s=void 0!==s?s:0,u=void 0!==u?u:2*Math.PI;var d=[],p=[],m=[],g=[],v=0,y=[],x=n/2,b=0;c(),a===!1&&(t>0&&h(!0),e>0&&h(!1)),this.setIndex(d),this.addAttribute("position",new Mt(p,3)),this.addAttribute("normal",new Mt(m,3)),this.addAttribute("uv",new Mt(g,2))}function ln(t,e,n,r,i,o,a){un.call(this,0,t,e,n,r,i,o,a),this.type="ConeGeometry",this.parameters={radius:t,height:e,radialSegments:n,heightSegments:r,openEnded:i,thetaStart:o,thetaLength:a}}function hn(t,e,n,r,i,o,a){cn.call(this,0,t,e,n,r,i,o,a),this.type="ConeBufferGeometry",this.parameters={radius:t,height:e,radialSegments:n,heightSegments:r,openEnded:i,thetaStart:o,thetaLength:a}}function fn(t,e,n,r){Lt.call(this),this.type="CircleGeometry",this.parameters={radius:t,segments:e,thetaStart:n,thetaLength:r},this.fromBufferGeometry(new dn(t,e,n,r))}function dn(t,e,n,r){Rt.call(this),this.type="CircleBufferGeometry",this.parameters={radius:t,segments:e,thetaStart:n,thetaLength:r},t=t||50,e=void 0!==e?Math.max(3,e):8,n=void 0!==n?n:0,r=void 0!==r?r:2*Math.PI;var o,a,s=[],u=[],c=[],h=[],f=new l,d=new i;for(u.push(0,0,0),c.push(0,0,1),h.push(.5,.5),a=0,o=3;a<=e;a++,o+=3){var p=n+a/e*r;f.x=t*Math.cos(p),f.y=t*Math.sin(p),u.push(f.x,f.y,f.z),c.push(0,0,1),d.x=(u[o]/t+1)/2,d.y=(u[o+1]/t+1)/2,h.push(d.x,d.y)}for(o=1;o<=e;o++)s.push(o,o+1,0);this.setIndex(s),this.addAttribute("position",new Mt(u,3)),this.addAttribute("normal",new Mt(c,3)),this.addAttribute("uv",new Mt(h,2))}function pn(){$.call(this,{uniforms:bs.merge([Mc.lights,{opacity:{value:1}}]),vertexShader:_c.shadow_vert,fragmentShader:_c.shadow_frag}),this.lights=!0,this.transparent=!0,Object.defineProperties(this,{opacity:{enumerable:!0,get:function(){return this.uniforms.opacity.value},set:function(t){this.uniforms.opacity.value=t}}})}function mn(t){$.call(this,t),this.type="RawShaderMaterial"}function gn(t){this.uuid=ds.generateUUID(),this.type="MultiMaterial",this.materials=Array.isArray(t)?t:[],this.visible=!0}function vn(t){K.call(this),this.defines={STANDARD:""},this.type="MeshStandardMaterial",this.color=new q(16777215),this.roughness=.5,this.metalness=.5,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new q(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalScale=new i(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.roughnessMap=null,this.metalnessMap=null,this.alphaMap=null,this.envMap=null,this.envMapIntensity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.skinning=!1,this.morphTargets=!1,this.morphNormals=!1,this.setValues(t)}function yn(t){vn.call(this),this.defines={PHYSICAL:""},this.type="MeshPhysicalMaterial",this.reflectivity=.5,this.clearCoat=0,this.clearCoatRoughness=0,this.setValues(t)}function xn(t){K.call(this),this.type="MeshPhongMaterial",this.color=new q(16777215),this.specular=new q(1118481),this.shininess=30,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new q(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalScale=new i(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.combine=Wo,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.skinning=!1,this.morphTargets=!1,this.morphNormals=!1,this.setValues(t)}function bn(t){xn.call(this),this.defines={TOON:""},this.type="MeshToonMaterial",this.gradientMap=null,this.setValues(t)}function _n(t){K.call(this,t),this.type="MeshNormalMaterial",this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalScale=new i(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.wireframe=!1,this.wireframeLinewidth=1,this.fog=!1,this.lights=!1,this.skinning=!1,this.morphTargets=!1,this.morphNormals=!1,this.setValues(t)}function wn(t){K.call(this),this.type="MeshLambertMaterial",this.color=new q(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new q(0),this.emissiveIntensity=1,this.emissiveMap=null,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.combine=Wo,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.skinning=!1,this.morphTargets=!1,this.morphNormals=!1,this.setValues(t)}function Mn(t){K.call(this),this.type="LineDashedMaterial",this.color=new q(16777215),this.linewidth=1,this.scale=1,this.dashSize=3,this.gapSize=1,this.lights=!1,this.setValues(t)}function En(t,e,n){var r=this,i=!1,o=0,a=0;this.onStart=void 0,this.onLoad=t,this.onProgress=e,this.onError=n,this.itemStart=function(t){a++,i===!1&&void 0!==r.onStart&&r.onStart(t,o,a),i=!0},this.itemEnd=function(t){o++,void 0!==r.onProgress&&r.onProgress(t,o,a),o===a&&(i=!1,void 0!==r.onLoad&&r.onLoad())},this.itemError=function(t){void 0!==r.onError&&r.onError(t)}}function Tn(t){this.manager=void 0!==t?t:Ic}function Sn(t){this.manager=void 0!==t?t:Ic,this._parser=null}function An(t){this.manager=void 0!==t?t:Ic,this._parser=null}function Ln(t){this.manager=void 0!==t?t:Ic}function Rn(t){this.manager=void 0!==t?t:Ic}function Pn(t){this.manager=void 0!==t?t:Ic}function Cn(t,e){lt.call(this),this.type="Light",this.color=new q(t),this.intensity=void 0!==e?e:1,this.receiveShadow=void 0}function Nn(t,e,n){Cn.call(this,t,n),this.type="HemisphereLight",this.castShadow=void 0,this.position.copy(lt.DefaultUp),this.updateMatrix(),this.groundColor=new q(e)}function In(t){this.camera=t,this.bias=0,this.radius=1,this.mapSize=new i(512,512),this.map=null,this.matrix=new h}function Un(){In.call(this,new Dt(50,1,.5,500))}function On(t,e,n,r,i,o){Cn.call(this,t,e),this.type="SpotLight",this.position.copy(lt.DefaultUp),this.updateMatrix(),this.target=new lt,Object.defineProperty(this,"power",{get:function(){return this.intensity*Math.PI},set:function(t){this.intensity=t/Math.PI}}),this.distance=void 0!==n?n:0,this.angle=void 0!==r?r:Math.PI/3,this.penumbra=void 0!==i?i:0,this.decay=void 0!==o?o:1,this.shadow=new Un}function Dn(t,e,n,r){Cn.call(this,t,e),this.type="PointLight",Object.defineProperty(this,"power",{get:function(){return 4*this.intensity*Math.PI},set:function(t){this.intensity=t/(4*Math.PI)}}),this.distance=void 0!==n?n:0,this.decay=void 0!==r?r:1,this.shadow=new In(new Dt(90,1,.5,500))}function zn(){In.call(this,new zt(-5,5,5,-5,.5,500))}function Fn(t,e){Cn.call(this,t,e),this.type="DirectionalLight",this.position.copy(lt.DefaultUp),this.updateMatrix(),this.target=new lt,this.shadow=new zn}function Bn(t,e){Cn.call(this,t,e),this.type="AmbientLight",this.castShadow=void 0}function kn(t,e,n,r){this.parameterPositions=t,this._cachedIndex=0,this.resultBuffer=void 0!==r?r:new e.constructor(n),this.sampleValues=e,this.valueSize=n}function Gn(t,e,n,r){kn.call(this,t,e,n,r),this._weightPrev=-0,this._offsetPrev=-0,this._weightNext=-0,this._offsetNext=-0}function Hn(t,e,n,r){kn.call(this,t,e,n,r)}function Vn(t,e,n,r){kn.call(this,t,e,n,r)}function jn(t,e,n,r){if(void 0===t)throw new Error("track name is undefined");if(void 0===e||0===e.length)throw new Error("no keyframes in track named "+t);this.name=t,this.times=Uc.convertArray(e,this.TimeBufferType),this.values=Uc.convertArray(n,this.ValueBufferType),this.setInterpolation(r||this.DefaultInterpolation),this.validate(),this.optimize()}function Wn(t,e,n,r){jn.call(this,t,e,n,r)}function Xn(t,e,n,r){kn.call(this,t,e,n,r)}function qn(t,e,n,r){jn.call(this,t,e,n,r)}function Yn(t,e,n,r){jn.call(this,t,e,n,r)}function Zn(t,e,n,r){jn.call(this,t,e,n,r)}function Jn(t,e,n){jn.call(this,t,e,n)}function Qn(t,e,n,r){jn.call(this,t,e,n,r)}function Kn(t,e,n,r){jn.apply(this,arguments)}function $n(t,e,n){this.name=t,this.tracks=n,this.duration=void 0!==e?e:-1,this.uuid=ds.generateUUID(),this.duration<0&&this.resetDuration(),this.optimize()}function tr(t){this.manager=void 0!==t?t:Ic,this.textures={}}function er(t){this.manager=void 0!==t?t:Ic}function nr(){this.onLoadStart=function(){},this.onLoadProgress=function(){},this.onLoadComplete=function(){}}function rr(t){"boolean"==typeof t&&(console.warn("THREE.JSONLoader: showStatus parameter has been removed from constructor."),t=void 0),this.manager=void 0!==t?t:Ic,this.withCredentials=!1}function ir(t){this.manager=void 0!==t?t:Ic,this.texturePath=""}function or(t,e,n,r,i){var o=.5*(r-e),a=.5*(i-n),s=t*t,u=t*s;return(2*n-2*r+o+a)*u+(-3*n+3*r-2*o-a)*s+o*t+n}function ar(t,e){var n=1-t;return n*n*e}function sr(t,e){return 2*(1-t)*t*e}function ur(t,e){return t*t*e}function cr(t,e,n,r){return ar(t,e)+sr(t,n)+ur(t,r)}function lr(t,e){var n=1-t;return n*n*n*e}function hr(t,e){var n=1-t;return 3*n*n*t*e}function fr(t,e){return 3*(1-t)*t*t*e}function dr(t,e){return t*t*t*e}function pr(t,e,n,r,i){return lr(t,e)+hr(t,n)+fr(t,r)+dr(t,i)}function mr(){}function gr(t,e){this.v1=t,this.v2=e}function vr(){this.curves=[],this.autoClose=!1}function yr(t,e,n,r,i,o,a,s){this.aX=t,this.aY=e,this.xRadius=n,this.yRadius=r,this.aStartAngle=i,this.aEndAngle=o,this.aClockwise=a,this.aRotation=s||0}function xr(t){this.points=void 0===t?[]:t}function br(t,e,n,r){this.v0=t,this.v1=e,this.v2=n,this.v3=r}function _r(t,e,n){this.v0=t,this.v1=e,this.v2=n}function wr(t){vr.call(this),this.currentPoint=new i,t&&this.fromPoints(t)}function Mr(){wr.apply(this,arguments),this.holes=[]}function Er(){this.subPaths=[],this.currentPath=null}function Tr(t){this.data=t}function Sr(t){this.manager=void 0!==t?t:Ic}function Ar(t){this.manager=void 0!==t?t:Ic}function Lr(t,e,n,r){Cn.call(this,t,e),this.type="RectAreaLight",this.position.set(0,1,0),this.updateMatrix(),this.width=void 0!==n?n:10,this.height=void 0!==r?r:10}function Rr(){this.type="StereoCamera",this.aspect=1,this.eyeSep=.064,this.cameraL=new Dt,this.cameraL.layers.enable(1),this.cameraL.matrixAutoUpdate=!1,this.cameraR=new Dt,this.cameraR.layers.enable(2),this.cameraR.matrixAutoUpdate=!1}function Pr(t,e,n){lt.call(this),this.type="CubeCamera";var r=90,i=1,o=new Dt(r,i,t,e);o.up.set(0,-1,0),o.lookAt(new l(1,0,0)),this.add(o);var a=new Dt(r,i,t,e);a.up.set(0,-1,0),a.lookAt(new l(-1,0,0)),this.add(a);var s=new Dt(r,i,t,e);s.up.set(0,0,1),s.lookAt(new l(0,1,0)),this.add(s);var c=new Dt(r,i,t,e);c.up.set(0,0,-1),c.lookAt(new l(0,-1,0)),this.add(c);var h=new Dt(r,i,t,e);h.up.set(0,-1,0),h.lookAt(new l(0,0,1)),this.add(h);var f=new Dt(r,i,t,e);f.up.set(0,-1,0),f.lookAt(new l(0,0,-1)),this.add(f);var d={format:Ra,magFilter:da,minFilter:da};this.renderTarget=new u(n,n,d),this.updateCubeMap=function(t,e){null===this.parent&&this.updateMatrixWorld();var n=this.renderTarget,r=n.texture.generateMipmaps;n.texture.generateMipmaps=!1,n.activeCubeFace=0,t.render(e,o,n),n.activeCubeFace=1,t.render(e,a,n),n.activeCubeFace=2,t.render(e,s,n),n.activeCubeFace=3,t.render(e,c,n),n.activeCubeFace=4,t.render(e,h,n),n.texture.generateMipmaps=r,n.activeCubeFace=5,t.render(e,f,n),t.setRenderTarget(null)}}function Cr(){lt.call(this),this.type="AudioListener",this.context=Fc.getContext(),this.gain=this.context.createGain(),this.gain.connect(this.context.destination),this.filter=null}function Nr(t){lt.call(this),this.type="Audio",this.context=t.context,this.gain=this.context.createGain(),this.gain.connect(t.getInput()),this.autoplay=!1,this.buffer=null,this.loop=!1,this.startTime=0,this.playbackRate=1,this.isPlaying=!1,this.hasPlaybackControl=!0,this.sourceType="empty",this.filters=[]}function Ir(t){Nr.call(this,t),this.panner=this.context.createPanner(),this.panner.connect(this.gain)}function Ur(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 Or(t,e,n){this.binding=t,this.valueSize=n;var r,i=Float64Array;switch(e){case"quaternion":r=this._slerp;break;case"string":case"bool":i=Array,r=this._select;break;default:r=this._lerp}this.buffer=new i(4*n),this._mixBufferRegion=r,this.cumulativeWeight=0,this.useCount=0,this.referenceCount=0}function Dr(t,e,n){this.path=e,this.parsedPath=n||Dr.parseTrackName(e),this.node=Dr.findNode(t,this.parsedPath.nodeName)||t,this.rootNode=t}function zr(t){this.uuid=ds.generateUUID(),this._objects=Array.prototype.slice.call(arguments),this.nCachedObjects_=0;var e={};this._indicesByUUID=e;for(var n=0,r=arguments.length;n!==r;++n)e[arguments[n].uuid]=n;this._paths=[],this._parsedPaths=[],this._bindings=[],this._bindingsIndicesByPath={};var i=this;this.stats={objects:{get total(){return i._objects.length},get inUse(){return this.total-i.nCachedObjects_}},get bindingsPerObject(){return i._bindings.length}}}function Fr(t,e,n){this._mixer=t,this._clip=e,this._localRoot=n||null;for(var r=e.tracks,i=r.length,o=new Array(i),a={endingStart:Qa,endingEnd:Qa},s=0;s!==i;++s){var u=r[s].createInterpolant(null);o[s]=u,u.settings=a}this._interpolantSettings=a,this._interpolants=o,this._propertyBindings=new Array(i),this._cacheIndex=null,this._byClipCacheIndex=null,this._timeScaleInterpolant=null,this._weightInterpolant=null,this.loop=Xa,this._loopCount=-1,this._startTime=null,this.time=0,this.timeScale=1,this._effectiveTimeScale=1,this.weight=1,this._effectiveWeight=1,this.repetitions=1/0,this.paused=!1,this.enabled=!0,this.clampWhenFinished=!1,this.zeroSlopeAtStart=!0,this.zeroSlopeAtEnd=!0}function Br(t){this._root=t,this._initMemoryManager(),this._accuIndex=0,this.time=0,this.timeScale=1}function kr(t){"string"==typeof t&&(console.warn("THREE.Uniform: Type parameter is no longer needed."),t=arguments[1]),this.value=t}function Gr(){Rt.call(this),this.type="InstancedBufferGeometry",this.maxInstancedCount=void 0}function Hr(t,e,n,r){this.uuid=ds.generateUUID(),this.data=t,this.itemSize=e,this.offset=n,this.normalized=r===!0}function Vr(t,e){this.uuid=ds.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 jr(t,e,n){Vr.call(this,t,e),this.meshPerAttribute=n||1}function Wr(t,e,n){mt.call(this,t,e),this.meshPerAttribute=n||1}function Xr(t,e,n,r){this.ray=new st(t,e),this.near=n||0,this.far=r||1/0,this.params={Mesh:{},Line:{},LOD:{},Points:{threshold:1},Sprite:{}},Object.defineProperties(this.params,{PointCloud:{get:function(){return console.warn("THREE.Raycaster: params.PointCloud has been renamed to params.Points."),this.Points}}})}function qr(t,e){return t.distance-e.distance}function Yr(t,e,n,r){if(t.visible!==!1&&(t.raycast(e,n),r===!0))for(var i=t.children,o=0,a=i.length;o<a;o++)Yr(i[o],e,n,!0)}function Zr(t){this.autoStart=void 0===t||t,this.startTime=0,this.oldTime=0,this.elapsedTime=0,this.running=!1}function Jr(t,e,n){return this.radius=void 0!==t?t:1,this.phi=void 0!==e?e:0,this.theta=void 0!==n?n:0,this}function Qr(t,e,n){return this.radius=void 0!==t?t:1,this.theta=void 0!==e?e:0,this.y=void 0!==n?n:0,this}function Kr(t,e){Pt.call(this,t,e),this.animationsMap={},this.animationsList=[];var n=this.geometry.morphTargets.length,r="__default",i=0,o=n-1,a=n/1;this.createAnimation(r,i,o,a),this.setAnimationWeight(r,1)}function $r(t){lt.call(this),this.material=t,this.render=function(t){}}function ti(t,e,n,r){this.object=t,this.size=void 0!==e?e:1;var i=void 0!==n?n:16711680,o=void 0!==r?r:1,a=0,s=this.object.geometry;s&&s.isGeometry?a=3*s.faces.length:s&&s.isBufferGeometry&&(a=s.attributes.normal.count);var u=new Rt,c=new Mt(2*a*3,3);u.addAttribute("position",c),Me.call(this,u,new _e({color:i,linewidth:o})),this.matrixAutoUpdate=!1,this.update()}function ei(t){lt.call(this),this.light=t,this.light.updateMatrixWorld(),this.matrix=t.matrixWorld,this.matrixAutoUpdate=!1;for(var e=new Rt,n=[0,0,0,0,0,1,0,0,0,1,0,1,0,0,0,-1,0,1,0,0,0,0,1,1,0,0,0,0,-1,1],r=0,i=1,o=32;r<o;r++,i++){var a=r/o*Math.PI*2,s=i/o*Math.PI*2;n.push(Math.cos(a),Math.sin(a),1,Math.cos(s),Math.sin(s),1)}e.addAttribute("position",new Mt(n,3));var u=new _e({fog:!1});this.cone=new Me(e,u),this.add(this.cone),this.update()}function ni(t){this.bones=this.getBoneList(t);for(var e=new Rt,n=[],r=[],i=new q(0,0,1),o=new q(0,1,0),a=0;a<this.bones.length;a++){var s=this.bones[a];s.parent&&s.parent.isBone&&(n.push(0,0,0),n.push(0,0,0),r.push(i.r,i.g,i.b),r.push(o.r,o.g,o.b))}e.addAttribute("position",new Mt(n,3)),e.addAttribute("color",new Mt(r,3));var u=new _e({vertexColors:po,depthTest:!1,depthWrite:!1,transparent:!0});Me.call(this,e,u),this.root=t,this.matrix=t.matrixWorld,this.matrixAutoUpdate=!1,this.update()}function ri(t,e){this.light=t,this.light.updateMatrixWorld();var n=new $e(e,4,2),r=new pt({wireframe:!0,fog:!1});r.color.copy(this.light.color).multiplyScalar(this.light.intensity),Pt.call(this,n,r),this.matrix=this.light.matrixWorld,this.matrixAutoUpdate=!1}function ii(t){lt.call(this),this.light=t,this.light.updateMatrixWorld();var e=new pt({color:t.color,fog:!1}),n=new pt({color:t.color,fog:!1,wireframe:!0}),r=new Rt;r.addAttribute("position",new mt(new Float32Array(18),3)),this.add(new Pt(r,e)),this.add(new Pt(r,n)),this.update()}function oi(t,e){lt.call(this),this.light=t,this.light.updateMatrixWorld(),this.matrix=t.matrixWorld,this.matrixAutoUpdate=!1;var n=new Be(e);n.rotateY(.5*Math.PI);var r=new pt({vertexColors:po,wireframe:!0}),i=n.getAttribute("position"),o=new Float32Array(3*i.count);n.addAttribute("color",new mt(o,3)),this.add(new Pt(n,r)),this.update()}function ai(t,e,n,r){t=t||10,e=e||10,n=new q(void 0!==n?n:4473924),r=new q(void 0!==r?r:8947848);for(var i=e/2,o=t/e,a=t/2,s=[],u=[],c=0,l=0,h=-a;c<=e;c++,h+=o){s.push(-a,0,h,a,0,h),s.push(h,0,-a,h,0,a);var f=c===i?n:r;f.toArray(u,l),l+=3,f.toArray(u,l),l+=3,f.toArray(u,l),l+=3,f.toArray(u,l),l+=3}var d=new Rt;d.addAttribute("position",new Mt(s,3)),d.addAttribute("color",new Mt(u,3));var p=new _e({vertexColors:po});Me.call(this,d,p)}function si(t,e,n,r,i,o){t=t||10,e=e||16,n=n||8,r=r||64,i=new q(void 0!==i?i:4473924),o=new q(void 0!==o?o:8947848);var a,s,u,c,l,h,f,d=[],p=[];for(c=0;c<=e;c++)u=c/e*(2*Math.PI),a=Math.sin(u)*t,s=Math.cos(u)*t,d.push(0,0,0),d.push(a,0,s),f=1&c?i:o,p.push(f.r,f.g,f.b),p.push(f.r,f.g,f.b);for(c=0;c<=n;c++)for(f=1&c?i:o,h=t-t/n*c,l=0;l<r;l++)u=l/r*(2*Math.PI),a=Math.sin(u)*h,s=Math.cos(u)*h,d.push(a,0,s),p.push(f.r,f.g,f.b),u=(l+1)/r*(2*Math.PI),a=Math.sin(u)*h,s=Math.cos(u)*h,d.push(a,0,s),p.push(f.r,f.g,f.b);var m=new Rt;m.addAttribute("position",new Mt(d,3)),m.addAttribute("color",new Mt(p,3));var g=new _e({vertexColors:po});Me.call(this,m,g)}function ui(t,e,n,r){this.object=t,this.size=void 0!==e?e:1;var i=void 0!==n?n:16776960,o=void 0!==r?r:1,a=0,s=this.object.geometry;s&&s.isGeometry?a=s.faces.length:console.warn("THREE.FaceNormalsHelper: only THREE.Geometry is supported. Use THREE.VertexNormalsHelper, instead.");var u=new Rt,c=new Mt(2*a*3,3);u.addAttribute("position",c),Me.call(this,u,new _e({color:i,linewidth:o})),this.matrixAutoUpdate=!1,this.update()}function ci(t,e){lt.call(this),this.light=t,this.light.updateMatrixWorld(),this.matrix=t.matrixWorld,this.matrixAutoUpdate=!1,void 0===e&&(e=1);var n=new Rt;n.addAttribute("position",new Mt([-e,e,0,e,e,0,e,-e,0,-e,-e,0,-e,e,0],3));var r=new _e({fog:!1});this.add(new we(n,r)),n=new Rt,n.addAttribute("position",new Mt([0,0,0,0,0,1],3)),this.add(new we(n,r)),this.update()}function li(t){function e(t,e,r){n(t,r),n(e,r)}function n(t,e){o.push(0,0,0),a.push(e.r,e.g,e.b),void 0===s[t]&&(s[t]=[]),s[t].push(o.length/3-1)}var r=new Rt,i=new _e({color:16777215,vertexColors:fo}),o=[],a=[],s={},u=new q(16755200),c=new q(16711680),l=new q(43775),h=new q(16777215),f=new q(3355443);e("n1","n2",u),e("n2","n4",u),e("n4","n3",u),e("n3","n1",u),e("f1","f2",u),e("f2","f4",u),e("f4","f3",u),e("f3","f1",u),e("n1","f1",u),e("n2","f2",u),e("n3","f3",u),e("n4","f4",u),e("p","n1",c),e("p","n2",c),e("p","n3",c),e("p","n4",c),e("u1","u2",l),e("u2","u3",l),e("u3","u1",l),e("c","t",h),e("p","c",f),e("cn1","cn2",f),e("cn3","cn4",f),e("cf1","cf2",f),e("cf3","cf4",f),r.addAttribute("position",new Mt(o,3)),r.addAttribute("color",new Mt(a,3)),Me.call(this,r,i),this.camera=t,this.camera.updateProjectionMatrix&&this.camera.updateProjectionMatrix(),this.matrix=t.matrixWorld,this.matrixAutoUpdate=!1,this.pointMap=s,this.update()}function hi(t,e){void 0===e&&(e=16776960);var n=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]),r=new Float32Array(24),i=new Rt;i.setIndex(new mt(n,1)),i.addAttribute("position",new mt(r,3)),Me.call(this,i,new _e({color:e})),void 0!==t&&this.update(t)}function fi(t,e,n,r,i,o){lt.call(this),void 0===r&&(r=16776960),void 0===n&&(n=1),void 0===i&&(i=.2*n),void 0===o&&(o=.2*i),void 0===Bc&&(Bc=new Rt,Bc.addAttribute("position",new Mt([0,0,0,0,1,0],3)),kc=new cn(0,.5,1,5,1),kc.translate(0,-.5,0)),this.position.copy(e),this.line=new we(Bc,new _e({color:r})),this.line.matrixAutoUpdate=!1,this.add(this.line),this.cone=new Pt(kc,new pt({color:r})),this.cone.matrixAutoUpdate=!1,this.add(this.cone),this.setDirection(t),this.setLength(n,i,o)}function di(t){t=t||1;var e=[0,0,0,t,0,0,0,0,0,0,t,0,0,0,0,0,0,t],n=[1,0,0,1,.6,0,0,1,0,.6,1,0,0,0,1,0,.6,1],r=new Rt;r.addAttribute("position",new Mt(e,3)),r.addAttribute("color",new Mt(n,3));var i=new _e({vertexColors:po});Me.call(this,r,i)}function pi(){function t(t,o,a,s){e=t,n=a,r=-3*t+3*o-2*a-s,i=2*t-2*o+a+s}var e=0,n=0,r=0,i=0;return{initCatmullRom:function(e,n,r,i,o){t(n,r,o*(r-e),o*(i-n))},initNonuniformCatmullRom:function(e,n,r,i,o,a,s){var u=(n-e)/o-(r-e)/(o+a)+(r-n)/a,c=(r-n)/a-(i-n)/(a+s)+(i-r)/s;u*=a,c*=a,t(n,r,u,c)},calc:function(t){var o=t*t,a=o*t;return e+n*t+r*o+i*a}}}function mi(t){this.points=t||[],this.closed=!1}function gi(t,e,n,r){this.v0=t,this.v1=e,this.v2=n,this.v3=r}function vi(t,e,n){this.v0=t,this.v1=e,this.v2=n}function yi(t,e){this.v1=t,this.v2=e}function xi(t,e,n,r,i,o){yr.call(this,t,e,n,n,r,i,o)}function bi(t,e,n,r,i,o,a){return console.warn("THREE.Face4 has been removed. A THREE.Face3 will be created instead."),new dt(t,e,n,i,o,a)}function _i(t){return console.warn("THREE.MeshFaceMaterial has been renamed to THREE.MultiMaterial."),new gn(t)}function wi(t,e){return console.warn("THREE.PointCloud has been renamed to THREE.Points."),new Te(t,e)}function Mi(t){return console.warn("THREE.Particle has been renamed to THREE.Sprite."),new ge(t)}function Ei(t,e){return console.warn("THREE.ParticleSystem has been renamed to THREE.Points."),new Te(t,e)}function Ti(t){return console.warn("THREE.PointCloudMaterial has been renamed to THREE.PointsMaterial."),new Ee(t)}function Si(t){return console.warn("THREE.ParticleBasicMaterial has been renamed to THREE.PointsMaterial."),new Ee(t)}function Ai(t){return console.warn("THREE.ParticleSystemMaterial has been renamed to THREE.PointsMaterial."),new Ee(t)}function Li(t,e,n){return console.warn("THREE.Vertex has been removed. Use THREE.Vector3 instead."),new l(t,e,n)}function Ri(t,e){return console.warn("THREE.DynamicBufferAttribute has been removed. Use new THREE.BufferAttribute().setDynamic( true ) instead."),new mt(t,e).setDynamic(!0)}function Pi(t,e){return console.warn("THREE.Int8Attribute has been removed. Use new THREE.Int8BufferAttribute() instead."),new gt(t,e)}function Ci(t,e){return console.warn("THREE.Uint8Attribute has been removed. Use new THREE.Uint8BufferAttribute() instead."),new vt(t,e)}function Ni(t,e){return console.warn("THREE.Uint8ClampedAttribute has been removed. Use new THREE.Uint8ClampedBufferAttribute() instead."),new yt(t,e)}function Ii(t,e){return console.warn("THREE.Int16Attribute has been removed. Use new THREE.Int16BufferAttribute() instead."),new xt(t,e)}function Ui(t,e){return console.warn("THREE.Uint16Attribute has been removed. Use new THREE.Uint16BufferAttribute() instead."),new bt(t,e)}function Oi(t,e){return console.warn("THREE.Int32Attribute has been removed. Use new THREE.Int32BufferAttribute() instead."),new _t(t,e)}function Di(t,e){return console.warn("THREE.Uint32Attribute has been removed. Use new THREE.Uint32BufferAttribute() instead."),new wt(t,e)}function zi(t,e){return console.warn("THREE.Float32Attribute has been removed. Use new THREE.Float32BufferAttribute() instead."),new Mt(t,e)}function Fi(t,e){return console.warn("THREE.Float64Attribute has been removed. Use new THREE.Float64BufferAttribute() instead."),new Et(t,e)}function Bi(t){console.warn("THREE.ClosedSplineCurve3 has been deprecated. Use THREE.CatmullRomCurve3 instead."),mi.call(this,t),this.type="catmullrom",this.closed=!0}function ki(t){console.warn("THREE.SplineCurve3 has been deprecated. Use THREE.CatmullRomCurve3 instead."),mi.call(this,t),this.type="catmullrom"}function Gi(t){console.warn("THREE.Spline has been removed. Use THREE.CatmullRomCurve3 instead."),mi.call(this,t),this.type="catmullrom"}function Hi(t,e){return console.warn("THREE.BoundingBoxHelper has been deprecated. Creating a THREE.BoxHelper instead."),new hi(t,e)}function Vi(t,e){return console.warn("THREE.EdgesHelper has been removed. Use THREE.EdgesGeometry instead."),new Me(new sn(t.geometry),new _e({color:void 0!==e?e:16777215}))}function ji(t,e){return console.warn("THREE.WireframeHelper has been removed. Use THREE.WireframeGeometry instead."),new Me(new Ce(t.geometry),new _e({color:void 0!==e?e:16777215}))}function Wi(t){return console.warn("THREE.XHRLoader has been renamed to THREE.FileLoader."),new Tn(t)}function Xi(t){return console.warn("THREE.BinaryTextureLoader has been renamed to THREE.DataTextureLoader."),new An(t)}function qi(){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 Yi(){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(){}}Object.defineProperty(e,"__esModule",{value:!0}),n.d(e,"WebGLRenderTargetCube",function(){return u}),n.d(e,"WebGLRenderTarget",function(){return s}),n.d(e,"WebGLRenderer",function(){return le}),n.d(e,"ShaderLib",function(){return Ec}),n.d(e,"UniformsLib",function(){return Mc}),n.d(e,"UniformsUtils",function(){return bs}),n.d(e,"ShaderChunk",function(){return _c}),n.d(e,"FogExp2",function(){return he}),n.d(e,"Fog",function(){return fe}),n.d(e,"Scene",function(){return de}),n.d(e,"LensFlare",function(){return pe}),n.d(e,"Sprite",function(){return ge}),n.d(e,"LOD",function(){return ve}),n.d(e,"SkinnedMesh",function(){return be}),n.d(e,"Skeleton",function(){return ye}),n.d(e,"Bone",function(){return xe}),n.d(e,"Mesh",function(){return Pt}),n.d(e,"LineSegments",function(){return Me}),n.d(e,"Line",function(){return we}),n.d(e,"Points",function(){return Te}),n.d(e,"Group",function(){return Se}),n.d(e,"VideoTexture",function(){return Ae}),n.d(e,"DataTexture",function(){return Y}),n.d(e,"CompressedTexture",function(){return Le}),n.d(e,"CubeTexture",function(){return f}),n.d(e,"CanvasTexture",function(){return Re}),n.d(e,"DepthTexture",function(){return Pe}),n.d(e,"Texture",function(){return o}),n.d(e,"CompressedTextureLoader",function(){return Sn}),n.d(e,"DataTextureLoader",function(){return An}),n.d(e,"CubeTextureLoader",function(){return Rn}),n.d(e,"TextureLoader",function(){return Pn}),n.d(e,"ObjectLoader",function(){return ir}),n.d(e,"MaterialLoader",function(){return tr}),n.d(e,"BufferGeometryLoader",function(){return er}),n.d(e,"DefaultLoadingManager",function(){return Ic}),n.d(e,"LoadingManager",function(){return En}),n.d(e,"JSONLoader",function(){return rr}),n.d(e,"ImageLoader",function(){return Ln}),n.d(e,"FontLoader",function(){return Sr}),n.d(e,"FileLoader",function(){return Tn}),n.d(e,"Loader",function(){return nr}),n.d(e,"Cache",function(){return Nc}),n.d(e,"AudioLoader",function(){return Ar}),n.d(e,"SpotLightShadow",function(){return Un}),n.d(e,"SpotLight",function(){return On}),n.d(e,"PointLight",function(){return Dn}),n.d(e,"RectAreaLight",function(){return Lr}),n.d(e,"HemisphereLight",function(){return Nn}),n.d(e,"DirectionalLightShadow",function(){return zn}),n.d(e,"DirectionalLight",function(){return Fn}),n.d(e,"AmbientLight",function(){return Bn}),n.d(e,"LightShadow",function(){return In}),n.d(e,"Light",function(){return Cn}),n.d(e,"StereoCamera",function(){return Rr}),n.d(e,"PerspectiveCamera",function(){return Dt}),n.d(e,"OrthographicCamera",function(){return zt}),n.d(e,"CubeCamera",function(){return Pr}),n.d(e,"Camera",function(){return Ot}),n.d(e,"AudioListener",function(){return Cr}),n.d(e,"PositionalAudio",function(){return Ir}),n.d(e,"AudioContext",function(){return Fc}),n.d(e,"AudioAnalyser",function(){return Ur}),n.d(e,"Audio",function(){return Nr}),n.d(e,"VectorKeyframeTrack",function(){return Wn}),n.d(e,"StringKeyframeTrack",function(){return Zn}),n.d(e,"QuaternionKeyframeTrack",function(){return qn}),n.d(e,"NumberKeyframeTrack",function(){return Yn}),n.d(e,"ColorKeyframeTrack",function(){return Qn}),n.d(e,"BooleanKeyframeTrack",function(){return Jn}),n.d(e,"PropertyMixer",function(){return Or}),n.d(e,"PropertyBinding",function(){return Dr}),n.d(e,"KeyframeTrack",function(){return Kn}),n.d(e,"AnimationUtils",function(){return Uc}),n.d(e,"AnimationObjectGroup",function(){return zr}),n.d(e,"AnimationMixer",function(){return Br}),n.d(e,"AnimationClip",function(){return $n}),n.d(e,"Uniform",function(){return kr}),n.d(e,"InstancedBufferGeometry",function(){return Gr}),n.d(e,"BufferGeometry",function(){return Rt}),n.d(e,"GeometryIdCount",function(){return At}),n.d(e,"Geometry",function(){return Lt}),n.d(e,"InterleavedBufferAttribute",function(){return Hr}),n.d(e,"InstancedInterleavedBuffer",function(){return jr}),n.d(e,"InterleavedBuffer",function(){return Vr}),n.d(e,"InstancedBufferAttribute",function(){return Wr}),n.d(e,"Face3",function(){return dt}),n.d(e,"Object3D",function(){return lt}),n.d(e,"Raycaster",function(){return Xr}),n.d(e,"Layers",function(){return ct}),n.d(e,"EventDispatcher",function(){return r}),n.d(e,"Clock",function(){return Zr}),n.d(e,"QuaternionLinearInterpolant",function(){return Xn}),n.d(e,"LinearInterpolant",function(){return Hn}),n.d(e,"DiscreteInterpolant",function(){return Vn}),n.d(e,"CubicInterpolant",function(){return Gn}),n.d(e,"Interpolant",function(){return kn}),n.d(e,"Triangle",function(){return ft}),n.d(e,"Math",function(){return ds}),n.d(e,"Spherical",function(){return Jr}),n.d(e,"Cylindrical",function(){return Qr}),n.d(e,"Plane",function(){return it}),n.d(e,"Frustum",function(){return ot}),n.d(e,"Sphere",function(){return nt}),n.d(e,"Ray",function(){return st}),n.d(e,"Matrix4",function(){return h}),n.d(e,"Matrix3",function(){return rt}),n.d(e,"Box3",function(){return et}),n.d(e,"Box2",function(){return Z}),n.d(e,"Line3",function(){return ht}),n.d(e,"Euler",function(){return ut}),n.d(e,"Vector4",function(){return a}),n.d(e,"Vector3",function(){return l}),n.d(e,"Vector2",function(){return i}),n.d(e,"Quaternion",function(){return c}),n.d(e,"Color",function(){return q}),n.d(e,"MorphBlendMesh",function(){return Kr}),n.d(e,"ImmediateRenderObject",function(){return $r}),n.d(e,"VertexNormalsHelper",function(){return ti}),n.d(e,"SpotLightHelper",function(){return ei}),n.d(e,"SkeletonHelper",function(){return ni}),n.d(e,"PointLightHelper",function(){return ri}),n.d(e,"RectAreaLightHelper",function(){return ii}),n.d(e,"HemisphereLightHelper",function(){
+return oi}),n.d(e,"GridHelper",function(){return ai}),n.d(e,"PolarGridHelper",function(){return si}),n.d(e,"FaceNormalsHelper",function(){return ui}),n.d(e,"DirectionalLightHelper",function(){return ci}),n.d(e,"CameraHelper",function(){return li}),n.d(e,"BoxHelper",function(){return hi}),n.d(e,"ArrowHelper",function(){return fi}),n.d(e,"AxisHelper",function(){return di}),n.d(e,"CatmullRomCurve3",function(){return mi}),n.d(e,"CubicBezierCurve3",function(){return gi}),n.d(e,"QuadraticBezierCurve3",function(){return vi}),n.d(e,"LineCurve3",function(){return yi}),n.d(e,"ArcCurve",function(){return xi}),n.d(e,"EllipseCurve",function(){return yr}),n.d(e,"SplineCurve",function(){return xr}),n.d(e,"CubicBezierCurve",function(){return br}),n.d(e,"QuadraticBezierCurve",function(){return _r}),n.d(e,"LineCurve",function(){return gr}),n.d(e,"Shape",function(){return Mr}),n.d(e,"Path",function(){return wr}),n.d(e,"ShapePath",function(){return Er}),n.d(e,"Font",function(){return Tr}),n.d(e,"CurvePath",function(){return vr}),n.d(e,"Curve",function(){return mr}),n.d(e,"ShapeUtils",function(){return Rc}),n.d(e,"SceneUtils",function(){return Wc}),n.d(e,"WireframeGeometry",function(){return Ce}),n.d(e,"ParametricGeometry",function(){return Ne}),n.d(e,"ParametricBufferGeometry",function(){return Ie}),n.d(e,"TetrahedronGeometry",function(){return De}),n.d(e,"TetrahedronBufferGeometry",function(){return ze}),n.d(e,"OctahedronGeometry",function(){return Fe}),n.d(e,"OctahedronBufferGeometry",function(){return Be}),n.d(e,"IcosahedronGeometry",function(){return ke}),n.d(e,"IcosahedronBufferGeometry",function(){return Ge}),n.d(e,"DodecahedronGeometry",function(){return He}),n.d(e,"DodecahedronBufferGeometry",function(){return Ve}),n.d(e,"PolyhedronGeometry",function(){return Ue}),n.d(e,"PolyhedronBufferGeometry",function(){return Oe}),n.d(e,"TubeGeometry",function(){return je}),n.d(e,"TubeBufferGeometry",function(){return We}),n.d(e,"TorusKnotGeometry",function(){return Xe}),n.d(e,"TorusKnotBufferGeometry",function(){return qe}),n.d(e,"TorusGeometry",function(){return Ye}),n.d(e,"TorusBufferGeometry",function(){return Ze}),n.d(e,"TextGeometry",function(){return Qe}),n.d(e,"SphereGeometry",function(){return Ke}),n.d(e,"SphereBufferGeometry",function(){return $e}),n.d(e,"RingGeometry",function(){return tn}),n.d(e,"RingBufferGeometry",function(){return en}),n.d(e,"PlaneGeometry",function(){return It}),n.d(e,"PlaneBufferGeometry",function(){return Ut}),n.d(e,"LatheGeometry",function(){return nn}),n.d(e,"LatheBufferGeometry",function(){return rn}),n.d(e,"ShapeGeometry",function(){return on}),n.d(e,"ShapeBufferGeometry",function(){return an}),n.d(e,"ExtrudeGeometry",function(){return Je}),n.d(e,"EdgesGeometry",function(){return sn}),n.d(e,"ConeGeometry",function(){return ln}),n.d(e,"ConeBufferGeometry",function(){return hn}),n.d(e,"CylinderGeometry",function(){return un}),n.d(e,"CylinderBufferGeometry",function(){return cn}),n.d(e,"CircleGeometry",function(){return fn}),n.d(e,"CircleBufferGeometry",function(){return dn}),n.d(e,"BoxGeometry",function(){return Ct}),n.d(e,"BoxBufferGeometry",function(){return Nt}),n.d(e,"ShadowMaterial",function(){return pn}),n.d(e,"SpriteMaterial",function(){return me}),n.d(e,"RawShaderMaterial",function(){return mn}),n.d(e,"ShaderMaterial",function(){return $}),n.d(e,"PointsMaterial",function(){return Ee}),n.d(e,"MultiMaterial",function(){return gn}),n.d(e,"MeshPhysicalMaterial",function(){return yn}),n.d(e,"MeshStandardMaterial",function(){return vn}),n.d(e,"MeshPhongMaterial",function(){return xn});n.d(e,"MeshToonMaterial",function(){return bn});n.d(e,"MeshNormalMaterial",function(){return _n}),n.d(e,"MeshLambertMaterial",function(){return wn}),n.d(e,"MeshDepthMaterial",function(){return tt}),n.d(e,"MeshBasicMaterial",function(){return pt}),n.d(e,"LineDashedMaterial",function(){return Mn}),n.d(e,"LineBasicMaterial",function(){return _e}),n.d(e,"Material",function(){return K}),n.d(e,"Float64BufferAttribute",function(){return Et}),n.d(e,"Float32BufferAttribute",function(){return Mt}),n.d(e,"Uint32BufferAttribute",function(){return wt}),n.d(e,"Int32BufferAttribute",function(){return _t}),n.d(e,"Uint16BufferAttribute",function(){return bt}),n.d(e,"Int16BufferAttribute",function(){return xt}),n.d(e,"Uint8ClampedBufferAttribute",function(){return yt}),n.d(e,"Uint8BufferAttribute",function(){return vt}),n.d(e,"Int8BufferAttribute",function(){return gt}),n.d(e,"BufferAttribute",function(){return mt}),n.d(e,"REVISION",function(){return Zi}),n.d(e,"MOUSE",function(){return Ji}),n.d(e,"CullFaceNone",function(){return Qi}),n.d(e,"CullFaceBack",function(){return Ki}),n.d(e,"CullFaceFront",function(){return $i}),n.d(e,"CullFaceFrontBack",function(){return to}),n.d(e,"FrontFaceDirectionCW",function(){return eo}),n.d(e,"FrontFaceDirectionCCW",function(){return no}),n.d(e,"BasicShadowMap",function(){return ro}),n.d(e,"PCFShadowMap",function(){return io}),n.d(e,"PCFSoftShadowMap",function(){return oo}),n.d(e,"FrontSide",function(){return ao}),n.d(e,"BackSide",function(){return so}),n.d(e,"DoubleSide",function(){return uo}),n.d(e,"FlatShading",function(){return co}),n.d(e,"SmoothShading",function(){return lo}),n.d(e,"NoColors",function(){return ho}),n.d(e,"FaceColors",function(){return fo}),n.d(e,"VertexColors",function(){return po}),n.d(e,"NoBlending",function(){return mo}),n.d(e,"NormalBlending",function(){return go}),n.d(e,"AdditiveBlending",function(){return vo}),n.d(e,"SubtractiveBlending",function(){return yo}),n.d(e,"MultiplyBlending",function(){return xo}),n.d(e,"CustomBlending",function(){return bo}),n.d(e,"AddEquation",function(){return _o}),n.d(e,"SubtractEquation",function(){return wo}),n.d(e,"ReverseSubtractEquation",function(){return Mo}),n.d(e,"MinEquation",function(){return Eo}),n.d(e,"MaxEquation",function(){return To}),n.d(e,"ZeroFactor",function(){return So}),n.d(e,"OneFactor",function(){return Ao}),n.d(e,"SrcColorFactor",function(){return Lo}),n.d(e,"OneMinusSrcColorFactor",function(){return Ro}),n.d(e,"SrcAlphaFactor",function(){return Po}),n.d(e,"OneMinusSrcAlphaFactor",function(){return Co}),n.d(e,"DstAlphaFactor",function(){return No}),n.d(e,"OneMinusDstAlphaFactor",function(){return Io}),n.d(e,"DstColorFactor",function(){return Uo}),n.d(e,"OneMinusDstColorFactor",function(){return Oo}),n.d(e,"SrcAlphaSaturateFactor",function(){return Do}),n.d(e,"NeverDepth",function(){return zo}),n.d(e,"AlwaysDepth",function(){return Fo}),n.d(e,"LessDepth",function(){return Bo}),n.d(e,"LessEqualDepth",function(){return ko}),n.d(e,"EqualDepth",function(){return Go}),n.d(e,"GreaterEqualDepth",function(){return Ho}),n.d(e,"GreaterDepth",function(){return Vo}),n.d(e,"NotEqualDepth",function(){return jo}),n.d(e,"MultiplyOperation",function(){return Wo}),n.d(e,"MixOperation",function(){return Xo}),n.d(e,"AddOperation",function(){return qo}),n.d(e,"NoToneMapping",function(){return Yo}),n.d(e,"LinearToneMapping",function(){return Zo}),n.d(e,"ReinhardToneMapping",function(){return Jo}),n.d(e,"Uncharted2ToneMapping",function(){return Qo}),n.d(e,"CineonToneMapping",function(){return Ko}),n.d(e,"UVMapping",function(){return $o}),n.d(e,"CubeReflectionMapping",function(){return ta}),n.d(e,"CubeRefractionMapping",function(){return ea}),n.d(e,"EquirectangularReflectionMapping",function(){return na}),n.d(e,"EquirectangularRefractionMapping",function(){return ra}),n.d(e,"SphericalReflectionMapping",function(){return ia}),n.d(e,"CubeUVReflectionMapping",function(){return oa}),n.d(e,"CubeUVRefractionMapping",function(){return aa}),n.d(e,"RepeatWrapping",function(){return sa}),n.d(e,"ClampToEdgeWrapping",function(){return ua}),n.d(e,"MirroredRepeatWrapping",function(){return ca}),n.d(e,"NearestFilter",function(){return la}),n.d(e,"NearestMipMapNearestFilter",function(){return ha}),n.d(e,"NearestMipMapLinearFilter",function(){return fa}),n.d(e,"LinearFilter",function(){return da}),n.d(e,"LinearMipMapNearestFilter",function(){return pa}),n.d(e,"LinearMipMapLinearFilter",function(){return ma}),n.d(e,"UnsignedByteType",function(){return ga}),n.d(e,"ByteType",function(){return va}),n.d(e,"ShortType",function(){return ya}),n.d(e,"UnsignedShortType",function(){return xa}),n.d(e,"IntType",function(){return ba}),n.d(e,"UnsignedIntType",function(){return _a}),n.d(e,"FloatType",function(){return wa}),n.d(e,"HalfFloatType",function(){return Ma}),n.d(e,"UnsignedShort4444Type",function(){return Ea}),n.d(e,"UnsignedShort5551Type",function(){return Ta}),n.d(e,"UnsignedShort565Type",function(){return Sa}),n.d(e,"UnsignedInt248Type",function(){return Aa}),n.d(e,"AlphaFormat",function(){return La}),n.d(e,"RGBFormat",function(){return Ra}),n.d(e,"RGBAFormat",function(){return Pa}),n.d(e,"LuminanceFormat",function(){return Ca}),n.d(e,"LuminanceAlphaFormat",function(){return Na}),n.d(e,"RGBEFormat",function(){return Ia}),n.d(e,"DepthFormat",function(){return Ua}),n.d(e,"DepthStencilFormat",function(){return Oa}),n.d(e,"RGB_S3TC_DXT1_Format",function(){return Da}),n.d(e,"RGBA_S3TC_DXT1_Format",function(){return za}),n.d(e,"RGBA_S3TC_DXT3_Format",function(){return Fa}),n.d(e,"RGBA_S3TC_DXT5_Format",function(){return Ba}),n.d(e,"RGB_PVRTC_4BPPV1_Format",function(){return ka}),n.d(e,"RGB_PVRTC_2BPPV1_Format",function(){return Ga}),n.d(e,"RGBA_PVRTC_4BPPV1_Format",function(){return Ha}),n.d(e,"RGBA_PVRTC_2BPPV1_Format",function(){return Va}),n.d(e,"RGB_ETC1_Format",function(){return ja}),n.d(e,"LoopOnce",function(){return Wa}),n.d(e,"LoopRepeat",function(){return Xa}),n.d(e,"LoopPingPong",function(){return qa}),n.d(e,"InterpolateDiscrete",function(){return Ya}),n.d(e,"InterpolateLinear",function(){return Za}),n.d(e,"InterpolateSmooth",function(){return Ja}),n.d(e,"ZeroCurvatureEnding",function(){return Qa}),n.d(e,"ZeroSlopeEnding",function(){return Ka}),n.d(e,"WrapAroundEnding",function(){return $a}),n.d(e,"TrianglesDrawMode",function(){return ts}),n.d(e,"TriangleStripDrawMode",function(){return es}),n.d(e,"TriangleFanDrawMode",function(){return ns}),n.d(e,"LinearEncoding",function(){return rs}),n.d(e,"sRGBEncoding",function(){return is}),n.d(e,"GammaEncoding",function(){return os}),n.d(e,"RGBEEncoding",function(){return as}),n.d(e,"LogLuvEncoding",function(){return ss}),n.d(e,"RGBM7Encoding",function(){return us}),n.d(e,"RGBM16Encoding",function(){return cs}),n.d(e,"RGBDEncoding",function(){return ls}),n.d(e,"BasicDepthPacking",function(){return hs}),n.d(e,"RGBADepthPacking",function(){return fs}),n.d(e,"CubeGeometry",function(){return Ct}),n.d(e,"Face4",function(){return bi}),n.d(e,"LineStrip",function(){return Xc}),n.d(e,"LinePieces",function(){return qc}),n.d(e,"MeshFaceMaterial",function(){return _i}),n.d(e,"PointCloud",function(){return wi}),n.d(e,"Particle",function(){return Mi}),n.d(e,"ParticleSystem",function(){return Ei}),n.d(e,"PointCloudMaterial",function(){return Ti}),n.d(e,"ParticleBasicMaterial",function(){return Si}),n.d(e,"ParticleSystemMaterial",function(){return Ai}),n.d(e,"Vertex",function(){return Li}),n.d(e,"DynamicBufferAttribute",function(){return Ri}),n.d(e,"Int8Attribute",function(){return Pi}),n.d(e,"Uint8Attribute",function(){return Ci}),n.d(e,"Uint8ClampedAttribute",function(){return Ni}),n.d(e,"Int16Attribute",function(){return Ii}),n.d(e,"Uint16Attribute",function(){return Ui}),n.d(e,"Int32Attribute",function(){return Oi}),n.d(e,"Uint32Attribute",function(){return Di}),n.d(e,"Float32Attribute",function(){return zi}),n.d(e,"Float64Attribute",function(){return Fi}),n.d(e,"ClosedSplineCurve3",function(){return Bi}),n.d(e,"SplineCurve3",function(){return ki}),n.d(e,"Spline",function(){return Gi}),n.d(e,"BoundingBoxHelper",function(){return Hi}),n.d(e,"EdgesHelper",function(){return Vi}),n.d(e,"WireframeHelper",function(){return ji}),n.d(e,"XHRLoader",function(){return Wi}),n.d(e,"BinaryTextureLoader",function(){return Xi}),n.d(e,"GeometryUtils",function(){return Yc}),n.d(e,"ImageUtils",function(){return Zc}),n.d(e,"Projector",function(){return qi}),n.d(e,"CanvasRenderer",function(){return Yi}),void 0===Number.EPSILON&&(Number.EPSILON=Math.pow(2,-52)),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),n=1;n<arguments.length;n++){var r=arguments[n];if(void 0!==r&&null!==r)for(var i in r)Object.prototype.hasOwnProperty.call(r,i)&&(e[i]=r[i])}return e}}(),r.prototype={addEventListener:function(t,e){void 0===this._listeners&&(this._listeners={});var n=this._listeners;void 0===n[t]&&(n[t]=[]),n[t].indexOf(e)===-1&&n[t].push(e)},hasEventListener:function(t,e){if(void 0===this._listeners)return!1;var n=this._listeners;return void 0!==n[t]&&n[t].indexOf(e)!==-1},removeEventListener:function(t,e){if(void 0!==this._listeners){var n=this._listeners,r=n[t];if(void 0!==r){var i=r.indexOf(e);i!==-1&&r.splice(i,1)}}},dispatchEvent:function(t){if(void 0!==this._listeners){var e=this._listeners,n=e[t.type];if(void 0!==n){t.target=this;var r=[],i=0,o=n.length;for(i=0;i<o;i++)r[i]=n[i];for(i=0;i<o;i++)r[i].call(this,t)}}}};var Zi="84",Ji={LEFT:0,MIDDLE:1,RIGHT:2},Qi=0,Ki=1,$i=2,to=3,eo=0,no=1,ro=0,io=1,oo=2,ao=0,so=1,uo=2,co=1,lo=2,ho=0,fo=1,po=2,mo=0,go=1,vo=2,yo=3,xo=4,bo=5,_o=100,wo=101,Mo=102,Eo=103,To=104,So=200,Ao=201,Lo=202,Ro=203,Po=204,Co=205,No=206,Io=207,Uo=208,Oo=209,Do=210,zo=0,Fo=1,Bo=2,ko=3,Go=4,Ho=5,Vo=6,jo=7,Wo=0,Xo=1,qo=2,Yo=0,Zo=1,Jo=2,Qo=3,Ko=4,$o=300,ta=301,ea=302,na=303,ra=304,ia=305,oa=306,aa=307,sa=1e3,ua=1001,ca=1002,la=1003,ha=1004,fa=1005,da=1006,pa=1007,ma=1008,ga=1009,va=1010,ya=1011,xa=1012,ba=1013,_a=1014,wa=1015,Ma=1016,Ea=1017,Ta=1018,Sa=1019,Aa=1020,La=1021,Ra=1022,Pa=1023,Ca=1024,Na=1025,Ia=Pa,Ua=1026,Oa=1027,Da=2001,za=2002,Fa=2003,Ba=2004,ka=2100,Ga=2101,Ha=2102,Va=2103,ja=2151,Wa=2200,Xa=2201,qa=2202,Ya=2300,Za=2301,Ja=2302,Qa=2400,Ka=2401,$a=2402,ts=0,es=1,ns=2,rs=3e3,is=3001,os=3007,as=3002,ss=3003,us=3004,cs=3005,ls=3006,hs=3200,fs=3201,ds={DEG2RAD:Math.PI/180,RAD2DEG:180/Math.PI,generateUUID:function(){var t,e="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz".split(""),n=new Array(36),r=0;return function(){for(var i=0;i<36;i++)8===i||13===i||18===i||23===i?n[i]="-":14===i?n[i]="4":(r<=2&&(r=33554432+16777216*Math.random()|0),t=15&r,r>>=4,n[i]=e[19===i?3&t|8:t]);return n.join("")}}(),clamp:function(t,e,n){return Math.max(e,Math.min(n,t))},euclideanModulo:function(t,e){return(t%e+e)%e},mapLinear:function(t,e,n,r,i){return r+(t-e)*(i-r)/(n-e)},lerp:function(t,e,n){return(1-n)*t+n*e},smoothstep:function(t,e,n){return t<=e?0:t>=n?1:(t=(t-e)/(n-e),t*t*(3-2*t))},smootherstep:function(t,e,n){return t<=e?0:t>=n?1:(t=(t-e)/(n-e),t*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*ds.DEG2RAD},radToDeg:function(t){return t*ds.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++,t}};i.prototype={constructor:i,isVector2:!0,get width(){return this.x},set width(t){this.x=t},get height(){return this.y},set height(t){this.y=t},set:function(t,e){return this.x=t,this.y=e,this},setScalar:function(t){return this.x=t,this.y=t,this},setX:function(t){return this.x=t,this},setY:function(t){return this.y=t,this},setComponent:function(t,e){switch(t){case 0:this.x=e;break;case 1:this.y=e;break;default:throw new Error("index is out of range: "+t)}return this},getComponent:function(t){switch(t){case 0:return this.x;case 1:return this.y;default:throw new Error("index is out of range: "+t)}},clone:function(){return new this.constructor(this.x,this.y)},copy:function(t){return this.x=t.x,this.y=t.y,this},add:function(t,e){return void 0!==e?(console.warn("THREE.Vector2: .add() now only accepts one argument. Use .addVectors( a, b ) instead."),this.addVectors(t,e)):(this.x+=t.x,this.y+=t.y,this)},addScalar:function(t){return this.x+=t,this.y+=t,this},addVectors:function(t,e){return this.x=t.x+e.x,this.y=t.y+e.y,this},addScaledVector:function(t,e){return this.x+=t.x*e,this.y+=t.y*e,this},sub:function(t,e){return void 0!==e?(console.warn("THREE.Vector2: .sub() now only accepts one argument. Use .subVectors( a, b ) instead."),this.subVectors(t,e)):(this.x-=t.x,this.y-=t.y,this)},subScalar:function(t){return this.x-=t,this.y-=t,this},subVectors:function(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this},multiply:function(t){return this.x*=t.x,this.y*=t.y,this},multiplyScalar:function(t){return isFinite(t)?(this.x*=t,this.y*=t):(this.x=0,this.y=0),this},divide:function(t){return this.x/=t.x,this.y/=t.y,this},divideScalar:function(t){return this.multiplyScalar(1/t)},min:function(t){return this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y),this},max:function(t){return this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y),this},clamp:function(t,e){return this.x=Math.max(t.x,Math.min(e.x,this.x)),this.y=Math.max(t.y,Math.min(e.y,this.y)),this},clampScalar:function(){var t,e;return function(n,r){return void 0===t&&(t=new i,e=new i),t.set(n,n),e.set(r,r),this.clamp(t,e)}}(),clampLength:function(t,e){var n=this.length();return this.multiplyScalar(Math.max(t,Math.min(e,n))/n)},floor:function(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this},ceil:function(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this},round:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this},roundToZero:function(){return this.x=this.x<0?Math.ceil(this.x):Math.floor(this.x),this.y=this.y<0?Math.ceil(this.y):Math.floor(this.y),this},negate:function(){return this.x=-this.x,this.y=-this.y,this},dot:function(t){return this.x*t.x+this.y*t.y},lengthSq:function(){return this.x*this.x+this.y*this.y},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y)},lengthManhattan:function(){return Math.abs(this.x)+Math.abs(this.y)},normalize:function(){return this.divideScalar(this.length())},angle:function(){var t=Math.atan2(this.y,this.x);return t<0&&(t+=2*Math.PI),t},distanceTo:function(t){return Math.sqrt(this.distanceToSquared(t))},distanceToSquared:function(t){var e=this.x-t.x,n=this.y-t.y;return e*e+n*n},distanceToManhattan:function(t){return Math.abs(this.x-t.x)+Math.abs(this.y-t.y)},setLength:function(t){return this.multiplyScalar(t/this.length())},lerp:function(t,e){return this.x+=(t.x-this.x)*e,this.y+=(t.y-this.y)*e,this},lerpVectors:function(t,e,n){return this.subVectors(e,t).multiplyScalar(n).add(t)},equals:function(t){return t.x===this.x&&t.y===this.y},fromArray:function(t,e){return void 0===e&&(e=0),this.x=t[e],this.y=t[e+1],this},toArray:function(t,e){return void 0===t&&(t=[]),void 0===e&&(e=0),t[e]=this.x,t[e+1]=this.y,t},fromBufferAttribute:function(t,e,n){return void 0!==n&&console.warn("THREE.Vector2: offset has been removed from .fromBufferAttribute()."),this.x=t.getX(e),this.y=t.getY(e),this},rotateAround:function(t,e){var n=Math.cos(e),r=Math.sin(e),i=this.x-t.x,o=this.y-t.y;return this.x=i*n-o*r+t.x,this.y=i*r+o*n+t.y,this}};var ps=0;o.DEFAULT_IMAGE=void 0,o.DEFAULT_MAPPING=$o,o.prototype={constructor:o,isTexture:!0,set needsUpdate(t){t===!0&&this.version++},clone:function(){return(new this.constructor).copy(this)},copy:function(t){return this.image=t.image,this.mipmaps=t.mipmaps.slice(0),this.mapping=t.mapping,this.wrapS=t.wrapS,this.wrapT=t.wrapT,this.magFilter=t.magFilter,this.minFilter=t.minFilter,this.anisotropy=t.anisotropy,this.format=t.format,this.type=t.type,this.offset.copy(t.offset),this.repeat.copy(t.repeat),this.generateMipmaps=t.generateMipmaps,this.premultiplyAlpha=t.premultiplyAlpha,this.flipY=t.flipY,this.unpackAlignment=t.unpackAlignment,this.encoding=t.encoding,this},toJSON:function(t){function e(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")}if(void 0!==t.textures[this.uuid])return t.textures[this.uuid];var n={metadata:{version:4.4,type:"Texture",generator:"Texture.toJSON"},uuid:this.uuid,name:this.name,mapping:this.mapping,repeat:[this.repeat.x,this.repeat.y],offset:[this.offset.x,this.offset.y],wrap:[this.wrapS,this.wrapT],minFilter:this.minFilter,magFilter:this.magFilter,anisotropy:this.anisotropy,flipY:this.flipY};if(void 0!==this.image){var r=this.image;void 0===r.uuid&&(r.uuid=ds.generateUUID()),void 0===t.images[r.uuid]&&(t.images[r.uuid]={uuid:r.uuid,url:e(r)}),n.image=r.uuid}return t.textures[this.uuid]=n,n},dispose:function(){this.dispatchEvent({type:"dispose"})},transformUv:function(t){if(this.mapping===$o){if(t.multiply(this.repeat),t.add(this.offset),t.x<0||t.x>1)switch(this.wrapS){case sa:t.x=t.x-Math.floor(t.x);break;case ua:t.x=t.x<0?0:1;break;case ca:1===Math.abs(Math.floor(t.x)%2)?t.x=Math.ceil(t.x)-t.x:t.x=t.x-Math.floor(t.x)}if(t.y<0||t.y>1)switch(this.wrapT){case sa:t.y=t.y-Math.floor(t.y);break;case ua:t.y=t.y<0?0:1;break;case ca:1===Math.abs(Math.floor(t.y)%2)?t.y=Math.ceil(t.y)-t.y:t.y=t.y-Math.floor(t.y)}this.flipY&&(t.y=1-t.y)}}},Object.assign(o.prototype,r.prototype),a.prototype={constructor:a,isVector4:!0,set:function(t,e,n,r){return this.x=t,this.y=e,this.z=n,this.w=r,this},setScalar:function(t){return this.x=t,this.y=t,this.z=t,this.w=t,this},setX:function(t){return this.x=t,this},setY:function(t){return this.y=t,this},setZ:function(t){return this.z=t,this},setW:function(t){return this.w=t,this},setComponent:function(t,e){switch(t){case 0:this.x=e;break;case 1:this.y=e;break;case 2:this.z=e;break;case 3:this.w=e;break;default:throw new Error("index is out of range: "+t)}return this},getComponent:function(t){switch(t){case 0:return this.x;case 1:return this.y;case 2:return this.z;case 3:return this.w;default:throw new Error("index is out of range: "+t)}},clone:function(){return new this.constructor(this.x,this.y,this.z,this.w)},copy:function(t){return this.x=t.x,this.y=t.y,this.z=t.z,this.w=void 0!==t.w?t.w:1,this},add:function(t,e){return void 0!==e?(console.warn("THREE.Vector4: .add() now only accepts one argument. Use .addVectors( a, b ) instead."),this.addVectors(t,e)):(this.x+=t.x,this.y+=t.y,this.z+=t.z,this.w+=t.w,this)},addScalar:function(t){return this.x+=t,this.y+=t,this.z+=t,this.w+=t,this},addVectors:function(t,e){return this.x=t.x+e.x,this.y=t.y+e.y,this.z=t.z+e.z,this.w=t.w+e.w,this},addScaledVector:function(t,e){return this.x+=t.x*e,this.y+=t.y*e,this.z+=t.z*e,this.w+=t.w*e,this},sub:function(t,e){return void 0!==e?(console.warn("THREE.Vector4: .sub() now only accepts one argument. Use .subVectors( a, b ) instead."),this.subVectors(t,e)):(this.x-=t.x,this.y-=t.y,this.z-=t.z,this.w-=t.w,this)},subScalar:function(t){return this.x-=t,this.y-=t,this.z-=t,this.w-=t,this},subVectors:function(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this.z=t.z-e.z,this.w=t.w-e.w,this},multiplyScalar:function(t){return isFinite(t)?(this.x*=t,this.y*=t,this.z*=t,this.w*=t):(this.x=0,this.y=0,this.z=0,this.w=0),this},applyMatrix4:function(t){var e=this.x,n=this.y,r=this.z,i=this.w,o=t.elements;return this.x=o[0]*e+o[4]*n+o[8]*r+o[12]*i,this.y=o[1]*e+o[5]*n+o[9]*r+o[13]*i,this.z=o[2]*e+o[6]*n+o[10]*r+o[14]*i,this.w=o[3]*e+o[7]*n+o[11]*r+o[15]*i,this},divideScalar:function(t){return this.multiplyScalar(1/t)},setAxisAngleFromQuaternion:function(t){this.w=2*Math.acos(t.w);var e=Math.sqrt(1-t.w*t.w);return e<1e-4?(this.x=1,this.y=0,this.z=0):(this.x=t.x/e,this.y=t.y/e,this.z=t.z/e),this},setAxisAngleFromRotationMatrix:function(t){var e,n,r,i,o=.01,a=.1,s=t.elements,u=s[0],c=s[4],l=s[8],h=s[1],f=s[5],d=s[9],p=s[2],m=s[6],g=s[10];if(Math.abs(c-h)<o&&Math.abs(l-p)<o&&Math.abs(d-m)<o){if(Math.abs(c+h)<a&&Math.abs(l+p)<a&&Math.abs(d+m)<a&&Math.abs(u+f+g-3)<a)return this.set(1,0,0,0),this;e=Math.PI;var v=(u+1)/2,y=(f+1)/2,x=(g+1)/2,b=(c+h)/4,_=(l+p)/4,w=(d+m)/4;return v>y&&v>x?v<o?(n=0,r=.707106781,i=.707106781):(n=Math.sqrt(v),r=b/n,i=_/n):y>x?y<o?(n=.707106781,r=0,i=.707106781):(r=Math.sqrt(y),n=b/r,i=w/r):x<o?(n=.707106781,r=.707106781,i=0):(i=Math.sqrt(x),n=_/i,r=w/i),this.set(n,r,i,e),this}var M=Math.sqrt((m-d)*(m-d)+(l-p)*(l-p)+(h-c)*(h-c));return Math.abs(M)<.001&&(M=1),this.x=(m-d)/M,this.y=(l-p)/M,this.z=(h-c)/M,this.w=Math.acos((u+f+g-1)/2),this},min:function(t){return this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y),this.z=Math.min(this.z,t.z),this.w=Math.min(this.w,t.w),this},max:function(t){return this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y),this.z=Math.max(this.z,t.z),this.w=Math.max(this.w,t.w),this},clamp:function(t,e){return this.x=Math.max(t.x,Math.min(e.x,this.x)),this.y=Math.max(t.y,Math.min(e.y,this.y)),this.z=Math.max(t.z,Math.min(e.z,this.z)),this.w=Math.max(t.w,Math.min(e.w,this.w)),this},clampScalar:function(){var t,e;return function(n,r){return void 0===t&&(t=new a,e=new a),t.set(n,n,n,n),e.set(r,r,r,r),this.clamp(t,e)}}(),floor:function(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this.w=Math.floor(this.w),this},ceil:function(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this.w=Math.ceil(this.w),this},round:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this.w=Math.round(this.w),this},roundToZero:function(){return this.x=this.x<0?Math.ceil(this.x):Math.floor(this.x),this.y=this.y<0?Math.ceil(this.y):Math.floor(this.y),this.z=this.z<0?Math.ceil(this.z):Math.floor(this.z),this.w=this.w<0?Math.ceil(this.w):Math.floor(this.w),this},negate:function(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this.w=-this.w,this},dot:function(t){return this.x*t.x+this.y*t.y+this.z*t.z+this.w*t.w},lengthSq:function(){return this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)},lengthManhattan:function(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)+Math.abs(this.w)},normalize:function(){return this.divideScalar(this.length())},setLength:function(t){return this.multiplyScalar(t/this.length())},lerp:function(t,e){return this.x+=(t.x-this.x)*e,this.y+=(t.y-this.y)*e,this.z+=(t.z-this.z)*e,this.w+=(t.w-this.w)*e,this},lerpVectors:function(t,e,n){return this.subVectors(e,t).multiplyScalar(n).add(t)},equals:function(t){return t.x===this.x&&t.y===this.y&&t.z===this.z&&t.w===this.w},fromArray:function(t,e){return void 0===e&&(e=0),this.x=t[e],this.y=t[e+1],this.z=t[e+2],this.w=t[e+3],this},toArray:function(t,e){return void 0===t&&(t=[]),void 0===e&&(e=0),t[e]=this.x,t[e+1]=this.y,t[e+2]=this.z,t[e+3]=this.w,t},fromBufferAttribute:function(t,e,n){return void 0!==n&&console.warn("THREE.Vector4: offset has been removed from .fromBufferAttribute()."),this.x=t.getX(e),this.y=t.getY(e),this.z=t.getZ(e),this.w=t.getW(e),this}},s.prototype={constructor:s,isWebGLRenderTarget:!0,setSize:function(t,e){this.width===t&&this.height===e||(this.width=t,this.height=e,this.dispose()),this.viewport.set(0,0,t,e),this.scissor.set(0,0,t,e)},clone:function(){return(new this.constructor).copy(this)},copy:function(t){return this.width=t.width,this.height=t.height,this.viewport.copy(t.viewport),this.texture=t.texture.clone(),this.depthBuffer=t.depthBuffer,this.stencilBuffer=t.stencilBuffer,this.depthTexture=t.depthTexture,this},dispose:function(){this.dispatchEvent({type:"dispose"})}},Object.assign(s.prototype,r.prototype),u.prototype=Object.create(s.prototype),u.prototype.constructor=u,u.prototype.isWebGLRenderTargetCube=!0,c.prototype={constructor:c,get x(){return this._x},set x(t){this._x=t,this.onChangeCallback()},get y(){return this._y},set y(t){this._y=t,this.onChangeCallback()},get z(){return this._z},set z(t){this._z=t,this.onChangeCallback()},get w(){return this._w},set w(t){this._w=t,this.onChangeCallback()},set:function(t,e,n,r){return this._x=t,this._y=e,this._z=n,this._w=r,this.onChangeCallback(),this},clone:function(){return new this.constructor(this._x,this._y,this._z,this._w)},copy:function(t){return this._x=t.x,this._y=t.y,this._z=t.z,this._w=t.w,this.onChangeCallback(),this},setFromEuler:function(t,e){if((t&&t.isEuler)===!1)throw new Error("THREE.Quaternion: .setFromEuler() now expects an Euler rotation rather than a Vector3 and order.");var n=Math.cos(t._x/2),r=Math.cos(t._y/2),i=Math.cos(t._z/2),o=Math.sin(t._x/2),a=Math.sin(t._y/2),s=Math.sin(t._z/2),u=t.order;return"XYZ"===u?(this._x=o*r*i+n*a*s,this._y=n*a*i-o*r*s,this._z=n*r*s+o*a*i,this._w=n*r*i-o*a*s):"YXZ"===u?(this._x=o*r*i+n*a*s,this._y=n*a*i-o*r*s,this._z=n*r*s-o*a*i,this._w=n*r*i+o*a*s):"ZXY"===u?(this._x=o*r*i-n*a*s,this._y=n*a*i+o*r*s,this._z=n*r*s+o*a*i,this._w=n*r*i-o*a*s):"ZYX"===u?(this._x=o*r*i-n*a*s,this._y=n*a*i+o*r*s,this._z=n*r*s-o*a*i,this._w=n*r*i+o*a*s):"YZX"===u?(this._x=o*r*i+n*a*s,this._y=n*a*i+o*r*s,this._z=n*r*s-o*a*i,this._w=n*r*i-o*a*s):"XZY"===u&&(this._x=o*r*i-n*a*s,this._y=n*a*i-o*r*s,this._z=n*r*s+o*a*i,this._w=n*r*i+o*a*s),e!==!1&&this.onChangeCallback(),this},setFromAxisAngle:function(t,e){var n=e/2,r=Math.sin(n);return this._x=t.x*r,this._y=t.y*r,this._z=t.z*r,this._w=Math.cos(n),this.onChangeCallback(),this},setFromRotationMatrix:function(t){var e,n=t.elements,r=n[0],i=n[4],o=n[8],a=n[1],s=n[5],u=n[9],c=n[2],l=n[6],h=n[10],f=r+s+h;return f>0?(e=.5/Math.sqrt(f+1),this._w=.25/e,this._x=(l-u)*e,this._y=(o-c)*e,this._z=(a-i)*e):r>s&&r>h?(e=2*Math.sqrt(1+r-s-h),this._w=(l-u)/e,this._x=.25*e,this._y=(i+a)/e,this._z=(o+c)/e):s>h?(e=2*Math.sqrt(1+s-r-h),this._w=(o-c)/e,this._x=(i+a)/e,this._y=.25*e,this._z=(u+l)/e):(e=2*Math.sqrt(1+h-r-s),this._w=(a-i)/e,this._x=(o+c)/e,this._y=(u+l)/e,this._z=.25*e),this.onChangeCallback(),this},setFromUnitVectors:function(){var t,e,n=1e-6;return function(r,i){return void 0===t&&(t=new l),e=r.dot(i)+1,e<n?(e=0,Math.abs(r.x)>Math.abs(r.z)?t.set(-r.y,r.x,0):t.set(0,-r.z,r.y)):t.crossVectors(r,i),this._x=t.x,this._y=t.y,this._z=t.z,this._w=e,this.normalize()}}(),inverse:function(){return this.conjugate().normalize()},conjugate:function(){return this._x*=-1,this._y*=-1,this._z*=-1,this.onChangeCallback(),this},dot:function(t){return this._x*t._x+this._y*t._y+this._z*t._z+this._w*t._w},lengthSq:function(){return this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w},length:function(){return Math.sqrt(this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w)},normalize:function(){var t=this.length();return 0===t?(this._x=0,this._y=0,this._z=0,this._w=1):(t=1/t,this._x=this._x*t,this._y=this._y*t,this._z=this._z*t,this._w=this._w*t),this.onChangeCallback(),this},multiply:function(t,e){return void 0!==e?(console.warn("THREE.Quaternion: .multiply() now only accepts one argument. Use .multiplyQuaternions( a, b ) instead."),this.multiplyQuaternions(t,e)):this.multiplyQuaternions(this,t)},premultiply:function(t){return this.multiplyQuaternions(t,this)},multiplyQuaternions:function(t,e){var n=t._x,r=t._y,i=t._z,o=t._w,a=e._x,s=e._y,u=e._z,c=e._w;return this._x=n*c+o*a+r*u-i*s,this._y=r*c+o*s+i*a-n*u,this._z=i*c+o*u+n*s-r*a,this._w=o*c-n*a-r*s-i*u,this.onChangeCallback(),this},slerp:function(t,e){if(0===e)return this;if(1===e)return this.copy(t);var n=this._x,r=this._y,i=this._z,o=this._w,a=o*t._w+n*t._x+r*t._y+i*t._z;if(a<0?(this._w=-t._w,this._x=-t._x,this._y=-t._y,this._z=-t._z,a=-a):this.copy(t),a>=1)return this._w=o,this._x=n,this._y=r,this._z=i,this;var s=Math.sqrt(1-a*a);if(Math.abs(s)<.001)return this._w=.5*(o+this._w),this._x=.5*(n+this._x),this._y=.5*(r+this._y),this._z=.5*(i+this._z),this;var u=Math.atan2(s,a),c=Math.sin((1-e)*u)/s,l=Math.sin(e*u)/s;return this._w=o*c+this._w*l,
+this._x=n*c+this._x*l,this._y=r*c+this._y*l,this._z=i*c+this._z*l,this.onChangeCallback(),this},equals:function(t){return t._x===this._x&&t._y===this._y&&t._z===this._z&&t._w===this._w},fromArray:function(t,e){return void 0===e&&(e=0),this._x=t[e],this._y=t[e+1],this._z=t[e+2],this._w=t[e+3],this.onChangeCallback(),this},toArray:function(t,e){return void 0===t&&(t=[]),void 0===e&&(e=0),t[e]=this._x,t[e+1]=this._y,t[e+2]=this._z,t[e+3]=this._w,t},onChange:function(t){return this.onChangeCallback=t,this},onChangeCallback:function(){}},Object.assign(c,{slerp:function(t,e,n,r){return n.copy(t).slerp(e,r)},slerpFlat:function(t,e,n,r,i,o,a){var s=n[r+0],u=n[r+1],c=n[r+2],l=n[r+3],h=i[o+0],f=i[o+1],d=i[o+2],p=i[o+3];if(l!==p||s!==h||u!==f||c!==d){var m=1-a,g=s*h+u*f+c*d+l*p,v=g>=0?1:-1,y=1-g*g;if(y>Number.EPSILON){var x=Math.sqrt(y),b=Math.atan2(x,g*v);m=Math.sin(m*b)/x,a=Math.sin(a*b)/x}var _=a*v;if(s=s*m+h*_,u=u*m+f*_,c=c*m+d*_,l=l*m+p*_,m===1-a){var w=1/Math.sqrt(s*s+u*u+c*c+l*l);s*=w,u*=w,c*=w,l*=w}}t[e]=s,t[e+1]=u,t[e+2]=c,t[e+3]=l}}),l.prototype={constructor:l,isVector3:!0,set:function(t,e,n){return this.x=t,this.y=e,this.z=n,this},setScalar:function(t){return this.x=t,this.y=t,this.z=t,this},setX:function(t){return this.x=t,this},setY:function(t){return this.y=t,this},setZ:function(t){return this.z=t,this},setComponent:function(t,e){switch(t){case 0:this.x=e;break;case 1:this.y=e;break;case 2:this.z=e;break;default:throw new Error("index is out of range: "+t)}return this},getComponent:function(t){switch(t){case 0:return this.x;case 1:return this.y;case 2:return this.z;default:throw new Error("index is out of range: "+t)}},clone:function(){return new this.constructor(this.x,this.y,this.z)},copy:function(t){return this.x=t.x,this.y=t.y,this.z=t.z,this},add:function(t,e){return void 0!==e?(console.warn("THREE.Vector3: .add() now only accepts one argument. Use .addVectors( a, b ) instead."),this.addVectors(t,e)):(this.x+=t.x,this.y+=t.y,this.z+=t.z,this)},addScalar:function(t){return this.x+=t,this.y+=t,this.z+=t,this},addVectors:function(t,e){return this.x=t.x+e.x,this.y=t.y+e.y,this.z=t.z+e.z,this},addScaledVector:function(t,e){return this.x+=t.x*e,this.y+=t.y*e,this.z+=t.z*e,this},sub:function(t,e){return void 0!==e?(console.warn("THREE.Vector3: .sub() now only accepts one argument. Use .subVectors( a, b ) instead."),this.subVectors(t,e)):(this.x-=t.x,this.y-=t.y,this.z-=t.z,this)},subScalar:function(t){return this.x-=t,this.y-=t,this.z-=t,this},subVectors:function(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this.z=t.z-e.z,this},multiply:function(t,e){return void 0!==e?(console.warn("THREE.Vector3: .multiply() now only accepts one argument. Use .multiplyVectors( a, b ) instead."),this.multiplyVectors(t,e)):(this.x*=t.x,this.y*=t.y,this.z*=t.z,this)},multiplyScalar:function(t){return isFinite(t)?(this.x*=t,this.y*=t,this.z*=t):(this.x=0,this.y=0,this.z=0),this},multiplyVectors:function(t,e){return this.x=t.x*e.x,this.y=t.y*e.y,this.z=t.z*e.z,this},applyEuler:function(){var t;return function(e){return(e&&e.isEuler)===!1&&console.error("THREE.Vector3: .applyEuler() now expects an Euler rotation rather than a Vector3 and order."),void 0===t&&(t=new c),this.applyQuaternion(t.setFromEuler(e))}}(),applyAxisAngle:function(){var t;return function(e,n){return void 0===t&&(t=new c),this.applyQuaternion(t.setFromAxisAngle(e,n))}}(),applyMatrix3:function(t){var e=this.x,n=this.y,r=this.z,i=t.elements;return this.x=i[0]*e+i[3]*n+i[6]*r,this.y=i[1]*e+i[4]*n+i[7]*r,this.z=i[2]*e+i[5]*n+i[8]*r,this},applyMatrix4:function(t){var e=this.x,n=this.y,r=this.z,i=t.elements;this.x=i[0]*e+i[4]*n+i[8]*r+i[12],this.y=i[1]*e+i[5]*n+i[9]*r+i[13],this.z=i[2]*e+i[6]*n+i[10]*r+i[14];var o=i[3]*e+i[7]*n+i[11]*r+i[15];return this.divideScalar(o)},applyQuaternion:function(t){var e=this.x,n=this.y,r=this.z,i=t.x,o=t.y,a=t.z,s=t.w,u=s*e+o*r-a*n,c=s*n+a*e-i*r,l=s*r+i*n-o*e,h=-i*e-o*n-a*r;return this.x=u*s+h*-i+c*-a-l*-o,this.y=c*s+h*-o+l*-i-u*-a,this.z=l*s+h*-a+u*-o-c*-i,this},project:function(){var t;return function(e){return void 0===t&&(t=new h),t.multiplyMatrices(e.projectionMatrix,t.getInverse(e.matrixWorld)),this.applyMatrix4(t)}}(),unproject:function(){var t;return function(e){return void 0===t&&(t=new h),t.multiplyMatrices(e.matrixWorld,t.getInverse(e.projectionMatrix)),this.applyMatrix4(t)}}(),transformDirection:function(t){var e=this.x,n=this.y,r=this.z,i=t.elements;return this.x=i[0]*e+i[4]*n+i[8]*r,this.y=i[1]*e+i[5]*n+i[9]*r,this.z=i[2]*e+i[6]*n+i[10]*r,this.normalize()},divide:function(t){return this.x/=t.x,this.y/=t.y,this.z/=t.z,this},divideScalar:function(t){return this.multiplyScalar(1/t)},min:function(t){return this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y),this.z=Math.min(this.z,t.z),this},max:function(t){return this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y),this.z=Math.max(this.z,t.z),this},clamp:function(t,e){return this.x=Math.max(t.x,Math.min(e.x,this.x)),this.y=Math.max(t.y,Math.min(e.y,this.y)),this.z=Math.max(t.z,Math.min(e.z,this.z)),this},clampScalar:function(){var t,e;return function(n,r){return void 0===t&&(t=new l,e=new l),t.set(n,n,n),e.set(r,r,r),this.clamp(t,e)}}(),clampLength:function(t,e){var n=this.length();return this.multiplyScalar(Math.max(t,Math.min(e,n))/n)},floor:function(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this},ceil:function(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this},round:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this},roundToZero:function(){return this.x=this.x<0?Math.ceil(this.x):Math.floor(this.x),this.y=this.y<0?Math.ceil(this.y):Math.floor(this.y),this.z=this.z<0?Math.ceil(this.z):Math.floor(this.z),this},negate:function(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this},dot:function(t){return this.x*t.x+this.y*t.y+this.z*t.z},lengthSq:function(){return this.x*this.x+this.y*this.y+this.z*this.z},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)},lengthManhattan:function(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)},normalize:function(){return this.divideScalar(this.length())},setLength:function(t){return this.multiplyScalar(t/this.length())},lerp:function(t,e){return this.x+=(t.x-this.x)*e,this.y+=(t.y-this.y)*e,this.z+=(t.z-this.z)*e,this},lerpVectors:function(t,e,n){return this.subVectors(e,t).multiplyScalar(n).add(t)},cross:function(t,e){if(void 0!==e)return console.warn("THREE.Vector3: .cross() now only accepts one argument. Use .crossVectors( a, b ) instead."),this.crossVectors(t,e);var n=this.x,r=this.y,i=this.z;return this.x=r*t.z-i*t.y,this.y=i*t.x-n*t.z,this.z=n*t.y-r*t.x,this},crossVectors:function(t,e){var n=t.x,r=t.y,i=t.z,o=e.x,a=e.y,s=e.z;return this.x=r*s-i*a,this.y=i*o-n*s,this.z=n*a-r*o,this},projectOnVector:function(t){var e=t.dot(this)/t.lengthSq();return this.copy(t).multiplyScalar(e)},projectOnPlane:function(){var t;return function(e){return void 0===t&&(t=new l),t.copy(this).projectOnVector(e),this.sub(t)}}(),reflect:function(){var t;return function(e){return void 0===t&&(t=new l),this.sub(t.copy(e).multiplyScalar(2*this.dot(e)))}}(),angleTo:function(t){var e=this.dot(t)/Math.sqrt(this.lengthSq()*t.lengthSq());return Math.acos(ds.clamp(e,-1,1))},distanceTo:function(t){return Math.sqrt(this.distanceToSquared(t))},distanceToSquared:function(t){var e=this.x-t.x,n=this.y-t.y,r=this.z-t.z;return e*e+n*n+r*r},distanceToManhattan:function(t){return Math.abs(this.x-t.x)+Math.abs(this.y-t.y)+Math.abs(this.z-t.z)},setFromSpherical:function(t){var e=Math.sin(t.phi)*t.radius;return this.x=e*Math.sin(t.theta),this.y=Math.cos(t.phi)*t.radius,this.z=e*Math.cos(t.theta),this},setFromCylindrical:function(t){return this.x=t.radius*Math.sin(t.theta),this.y=t.y,this.z=t.radius*Math.cos(t.theta),this},setFromMatrixPosition:function(t){return this.setFromMatrixColumn(t,3)},setFromMatrixScale:function(t){var e=this.setFromMatrixColumn(t,0).length(),n=this.setFromMatrixColumn(t,1).length(),r=this.setFromMatrixColumn(t,2).length();return this.x=e,this.y=n,this.z=r,this},setFromMatrixColumn:function(t,e){if("number"==typeof t){console.warn("THREE.Vector3: setFromMatrixColumn now expects ( matrix, index ).");var n=t;t=e,e=n}return this.fromArray(t.elements,4*e)},equals:function(t){return t.x===this.x&&t.y===this.y&&t.z===this.z},fromArray:function(t,e){return void 0===e&&(e=0),this.x=t[e],this.y=t[e+1],this.z=t[e+2],this},toArray:function(t,e){return void 0===t&&(t=[]),void 0===e&&(e=0),t[e]=this.x,t[e+1]=this.y,t[e+2]=this.z,t},fromBufferAttribute:function(t,e,n){return void 0!==n&&console.warn("THREE.Vector3: offset has been removed from .fromBufferAttribute()."),this.x=t.getX(e),this.y=t.getY(e),this.z=t.getZ(e),this}},h.prototype={constructor:h,isMatrix4:!0,set:function(t,e,n,r,i,o,a,s,u,c,l,h,f,d,p,m){var g=this.elements;return g[0]=t,g[4]=e,g[8]=n,g[12]=r,g[1]=i,g[5]=o,g[9]=a,g[13]=s,g[2]=u,g[6]=c,g[10]=l,g[14]=h,g[3]=f,g[7]=d,g[11]=p,g[15]=m,this},identity:function(){return this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1),this},clone:function(){return(new h).fromArray(this.elements)},copy:function(t){return this.elements.set(t.elements),this},copyPosition:function(t){var e=this.elements,n=t.elements;return e[12]=n[12],e[13]=n[13],e[14]=n[14],this},extractBasis:function(t,e,n){return t.setFromMatrixColumn(this,0),e.setFromMatrixColumn(this,1),n.setFromMatrixColumn(this,2),this},makeBasis:function(t,e,n){return this.set(t.x,e.x,n.x,0,t.y,e.y,n.y,0,t.z,e.z,n.z,0,0,0,0,1),this},extractRotation:function(){var t;return function(e){void 0===t&&(t=new l);var n=this.elements,r=e.elements,i=1/t.setFromMatrixColumn(e,0).length(),o=1/t.setFromMatrixColumn(e,1).length(),a=1/t.setFromMatrixColumn(e,2).length();return n[0]=r[0]*i,n[1]=r[1]*i,n[2]=r[2]*i,n[4]=r[4]*o,n[5]=r[5]*o,n[6]=r[6]*o,n[8]=r[8]*a,n[9]=r[9]*a,n[10]=r[10]*a,this}}(),makeRotationFromEuler:function(t){(t&&t.isEuler)===!1&&console.error("THREE.Matrix: .makeRotationFromEuler() now expects a Euler rotation rather than a Vector3 and order.");var e=this.elements,n=t.x,r=t.y,i=t.z,o=Math.cos(n),a=Math.sin(n),s=Math.cos(r),u=Math.sin(r),c=Math.cos(i),l=Math.sin(i);if("XYZ"===t.order){var h=o*c,f=o*l,d=a*c,p=a*l;e[0]=s*c,e[4]=-s*l,e[8]=u,e[1]=f+d*u,e[5]=h-p*u,e[9]=-a*s,e[2]=p-h*u,e[6]=d+f*u,e[10]=o*s}else if("YXZ"===t.order){var m=s*c,g=s*l,v=u*c,y=u*l;e[0]=m+y*a,e[4]=v*a-g,e[8]=o*u,e[1]=o*l,e[5]=o*c,e[9]=-a,e[2]=g*a-v,e[6]=y+m*a,e[10]=o*s}else if("ZXY"===t.order){var m=s*c,g=s*l,v=u*c,y=u*l;e[0]=m-y*a,e[4]=-o*l,e[8]=v+g*a,e[1]=g+v*a,e[5]=o*c,e[9]=y-m*a,e[2]=-o*u,e[6]=a,e[10]=o*s}else if("ZYX"===t.order){var h=o*c,f=o*l,d=a*c,p=a*l;e[0]=s*c,e[4]=d*u-f,e[8]=h*u+p,e[1]=s*l,e[5]=p*u+h,e[9]=f*u-d,e[2]=-u,e[6]=a*s,e[10]=o*s}else if("YZX"===t.order){var x=o*s,b=o*u,_=a*s,w=a*u;e[0]=s*c,e[4]=w-x*l,e[8]=_*l+b,e[1]=l,e[5]=o*c,e[9]=-a*c,e[2]=-u*c,e[6]=b*l+_,e[10]=x-w*l}else if("XZY"===t.order){var x=o*s,b=o*u,_=a*s,w=a*u;e[0]=s*c,e[4]=-l,e[8]=u*c,e[1]=x*l+w,e[5]=o*c,e[9]=b*l-_,e[2]=_*l-b,e[6]=a*c,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,n=t.x,r=t.y,i=t.z,o=t.w,a=n+n,s=r+r,u=i+i,c=n*a,l=n*s,h=n*u,f=r*s,d=r*u,p=i*u,m=o*a,g=o*s,v=o*u;return e[0]=1-(f+p),e[4]=l-v,e[8]=h+g,e[1]=l+v,e[5]=1-(c+p),e[9]=d-m,e[2]=h-g,e[6]=d+m,e[10]=1-(c+f),e[3]=0,e[7]=0,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,this},lookAt:function(){var t,e,n;return function(r,i,o){void 0===t&&(t=new l,e=new l,n=new l);var a=this.elements;return n.subVectors(r,i).normalize(),0===n.lengthSq()&&(n.z=1),t.crossVectors(o,n).normalize(),0===t.lengthSq()&&(n.z+=1e-4,t.crossVectors(o,n).normalize()),e.crossVectors(n,t),a[0]=t.x,a[4]=e.x,a[8]=n.x,a[1]=t.y,a[5]=e.y,a[9]=n.y,a[2]=t.z,a[6]=e.z,a[10]=n.z,this}}(),multiply:function(t,e){return void 0!==e?(console.warn("THREE.Matrix4: .multiply() now only accepts one argument. Use .multiplyMatrices( a, b ) instead."),this.multiplyMatrices(t,e)):this.multiplyMatrices(this,t)},premultiply:function(t){return this.multiplyMatrices(t,this)},multiplyMatrices:function(t,e){var n=t.elements,r=e.elements,i=this.elements,o=n[0],a=n[4],s=n[8],u=n[12],c=n[1],l=n[5],h=n[9],f=n[13],d=n[2],p=n[6],m=n[10],g=n[14],v=n[3],y=n[7],x=n[11],b=n[15],_=r[0],w=r[4],M=r[8],E=r[12],T=r[1],S=r[5],A=r[9],L=r[13],R=r[2],P=r[6],C=r[10],N=r[14],I=r[3],U=r[7],O=r[11],D=r[15];return i[0]=o*_+a*T+s*R+u*I,i[4]=o*w+a*S+s*P+u*U,i[8]=o*M+a*A+s*C+u*O,i[12]=o*E+a*L+s*N+u*D,i[1]=c*_+l*T+h*R+f*I,i[5]=c*w+l*S+h*P+f*U,i[9]=c*M+l*A+h*C+f*O,i[13]=c*E+l*L+h*N+f*D,i[2]=d*_+p*T+m*R+g*I,i[6]=d*w+p*S+m*P+g*U,i[10]=d*M+p*A+m*C+g*O,i[14]=d*E+p*L+m*N+g*D,i[3]=v*_+y*T+x*R+b*I,i[7]=v*w+y*S+x*P+b*U,i[11]=v*M+y*A+x*C+b*O,i[15]=v*E+y*L+x*N+b*D,this},multiplyToArray:function(t,e,n){var r=this.elements;return this.multiplyMatrices(t,e),n[0]=r[0],n[1]=r[1],n[2]=r[2],n[3]=r[3],n[4]=r[4],n[5]=r[5],n[6]=r[6],n[7]=r[7],n[8]=r[8],n[9]=r[9],n[10]=r[10],n[11]=r[11],n[12]=r[12],n[13]=r[13],n[14]=r[14],n[15]=r[15],this},multiplyScalar:function(t){var e=this.elements;return e[0]*=t,e[4]*=t,e[8]*=t,e[12]*=t,e[1]*=t,e[5]*=t,e[9]*=t,e[13]*=t,e[2]*=t,e[6]*=t,e[10]*=t,e[14]*=t,e[3]*=t,e[7]*=t,e[11]*=t,e[15]*=t,this},applyToBufferAttribute:function(){var t;return function(e){void 0===t&&(t=new l);for(var n=0,r=e.count;n<r;n++)t.x=e.getX(n),t.y=e.getY(n),t.z=e.getZ(n),t.applyMatrix4(this),e.setXYZ(n,t.x,t.y,t.z);return e}}(),determinant:function(){var t=this.elements,e=t[0],n=t[4],r=t[8],i=t[12],o=t[1],a=t[5],s=t[9],u=t[13],c=t[2],l=t[6],h=t[10],f=t[14],d=t[3],p=t[7],m=t[11],g=t[15];return d*(+i*s*l-r*u*l-i*a*h+n*u*h+r*a*f-n*s*f)+p*(+e*s*f-e*u*h+i*o*h-r*o*f+r*u*c-i*s*c)+m*(+e*u*l-e*a*f-i*o*l+n*o*f+i*a*c-n*u*c)+g*(-r*a*c-e*s*l+e*a*h+r*o*l-n*o*h+n*s*c)},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 n=this.elements,r=t.elements,i=r[0],o=r[1],a=r[2],s=r[3],u=r[4],c=r[5],l=r[6],h=r[7],f=r[8],d=r[9],p=r[10],m=r[11],g=r[12],v=r[13],y=r[14],x=r[15],b=d*y*h-v*p*h+v*l*m-c*y*m-d*l*x+c*p*x,_=g*p*h-f*y*h-g*l*m+u*y*m+f*l*x-u*p*x,w=f*v*h-g*d*h+g*c*m-u*v*m-f*c*x+u*d*x,M=g*d*l-f*v*l-g*c*p+u*v*p+f*c*y-u*d*y,E=i*b+o*_+a*w+s*M;if(0===E){var T="THREE.Matrix4.getInverse(): can't invert matrix, determinant is 0";if(e===!0)throw new Error(T);return console.warn(T),this.identity()}var S=1/E;return n[0]=b*S,n[1]=(v*p*s-d*y*s-v*a*m+o*y*m+d*a*x-o*p*x)*S,n[2]=(c*y*s-v*l*s+v*a*h-o*y*h-c*a*x+o*l*x)*S,n[3]=(d*l*s-c*p*s-d*a*h+o*p*h+c*a*m-o*l*m)*S,n[4]=_*S,n[5]=(f*y*s-g*p*s+g*a*m-i*y*m-f*a*x+i*p*x)*S,n[6]=(g*l*s-u*y*s-g*a*h+i*y*h+u*a*x-i*l*x)*S,n[7]=(u*p*s-f*l*s+f*a*h-i*p*h-u*a*m+i*l*m)*S,n[8]=w*S,n[9]=(g*d*s-f*v*s-g*o*m+i*v*m+f*o*x-i*d*x)*S,n[10]=(u*v*s-g*c*s+g*o*h-i*v*h-u*o*x+i*c*x)*S,n[11]=(f*c*s-u*d*s-f*o*h+i*d*h+u*o*m-i*c*m)*S,n[12]=M*S,n[13]=(f*v*a-g*d*a+g*o*p-i*v*p-f*o*y+i*d*y)*S,n[14]=(g*c*a-u*v*a-g*o*l+i*v*l+u*o*y-i*c*y)*S,n[15]=(u*d*a-f*c*a+f*o*l-i*d*l-u*o*p+i*c*p)*S,this},scale:function(t){var e=this.elements,n=t.x,r=t.y,i=t.z;return e[0]*=n,e[4]*=r,e[8]*=i,e[1]*=n,e[5]*=r,e[9]*=i,e[2]*=n,e[6]*=r,e[10]*=i,e[3]*=n,e[7]*=r,e[11]*=i,this},getMaxScaleOnAxis:function(){var t=this.elements,e=t[0]*t[0]+t[1]*t[1]+t[2]*t[2],n=t[4]*t[4]+t[5]*t[5]+t[6]*t[6],r=t[8]*t[8]+t[9]*t[9]+t[10]*t[10];return Math.sqrt(Math.max(e,n,r))},makeTranslation:function(t,e,n){return this.set(1,0,0,t,0,1,0,e,0,0,1,n,0,0,0,1),this},makeRotationX:function(t){var e=Math.cos(t),n=Math.sin(t);return this.set(1,0,0,0,0,e,-n,0,0,n,e,0,0,0,0,1),this},makeRotationY:function(t){var e=Math.cos(t),n=Math.sin(t);return this.set(e,0,n,0,0,1,0,0,-n,0,e,0,0,0,0,1),this},makeRotationZ:function(t){var e=Math.cos(t),n=Math.sin(t);return this.set(e,-n,0,0,n,e,0,0,0,0,1,0,0,0,0,1),this},makeRotationAxis:function(t,e){var n=Math.cos(e),r=Math.sin(e),i=1-n,o=t.x,a=t.y,s=t.z,u=i*o,c=i*a;return this.set(u*o+n,u*a-r*s,u*s+r*a,0,u*a+r*s,c*a+n,c*s-r*o,0,u*s-r*a,c*s+r*o,i*s*s+n,0,0,0,0,1),this},makeScale:function(t,e,n){return this.set(t,0,0,0,0,e,0,0,0,0,n,0,0,0,0,1),this},makeShear:function(t,e,n){return this.set(1,e,n,0,t,1,n,0,t,e,1,0,0,0,0,1),this},compose:function(t,e,n){return this.makeRotationFromQuaternion(e),this.scale(n),this.setPosition(t),this},decompose:function(){var t,e;return function(n,r,i){void 0===t&&(t=new l,e=new h);var o=this.elements,a=t.set(o[0],o[1],o[2]).length(),s=t.set(o[4],o[5],o[6]).length(),u=t.set(o[8],o[9],o[10]).length(),c=this.determinant();c<0&&(a=-a),n.x=o[12],n.y=o[13],n.z=o[14],e.elements.set(this.elements);var f=1/a,d=1/s,p=1/u;return e.elements[0]*=f,e.elements[1]*=f,e.elements[2]*=f,e.elements[4]*=d,e.elements[5]*=d,e.elements[6]*=d,e.elements[8]*=p,e.elements[9]*=p,e.elements[10]*=p,r.setFromRotationMatrix(e),i.x=a,i.y=s,i.z=u,this}}(),makePerspective:function(t,e,n,r,i,o){void 0===o&&console.warn("THREE.Matrix4: .makePerspective() has been redefined and has a new signature. Please check the docs.");var a=this.elements,s=2*i/(e-t),u=2*i/(n-r),c=(e+t)/(e-t),l=(n+r)/(n-r),h=-(o+i)/(o-i),f=-2*o*i/(o-i);return a[0]=s,a[4]=0,a[8]=c,a[12]=0,a[1]=0,a[5]=u,a[9]=l,a[13]=0,a[2]=0,a[6]=0,a[10]=h,a[14]=f,a[3]=0,a[7]=0,a[11]=-1,a[15]=0,this},makeOrthographic:function(t,e,n,r,i,o){var a=this.elements,s=1/(e-t),u=1/(n-r),c=1/(o-i),l=(e+t)*s,h=(n+r)*u,f=(o+i)*c;return a[0]=2*s,a[4]=0,a[8]=0,a[12]=-l,a[1]=0,a[5]=2*u,a[9]=0,a[13]=-h,a[2]=0,a[6]=0,a[10]=-2*c,a[14]=-f,a[3]=0,a[7]=0,a[11]=0,a[15]=1,this},equals:function(t){for(var e=this.elements,n=t.elements,r=0;r<16;r++)if(e[r]!==n[r])return!1;return!0},fromArray:function(t,e){void 0===e&&(e=0);for(var n=0;n<16;n++)this.elements[n]=t[n+e];return this},toArray:function(t,e){void 0===t&&(t=[]),void 0===e&&(e=0);var n=this.elements;return t[e]=n[0],t[e+1]=n[1],t[e+2]=n[2],t[e+3]=n[3],t[e+4]=n[4],t[e+5]=n[5],t[e+6]=n[6],t[e+7]=n[7],t[e+8]=n[8],t[e+9]=n[9],t[e+10]=n[10],t[e+11]=n[11],t[e+12]=n[12],t[e+13]=n[13],t[e+14]=n[14],t[e+15]=n[15],t}},f.prototype=Object.create(o.prototype),f.prototype.constructor=f,f.prototype.isCubeTexture=!0,Object.defineProperty(f.prototype,"images",{get:function(){return this.image},set:function(t){this.image=t}});var ms=new o,gs=new f,vs=[],ys=[];V.prototype.setValue=function(t,e){for(var n=this.seq,r=0,i=n.length;r!==i;++r){var o=n[r];o.setValue(t,e[o.id])}};var xs=/([\w\d_]+)(\])?(\[|\.)?/g;X.prototype.setValue=function(t,e,n){var r=this.map[e];void 0!==r&&r.setValue(t,n,this.renderer)},X.prototype.set=function(t,e,n){var r=this.map[n];void 0!==r&&r.setValue(t,e[n],this.renderer)},X.prototype.setOptional=function(t,e,n){var r=e[n];void 0!==r&&this.setValue(t,n,r)},X.upload=function(t,e,n,r){for(var i=0,o=e.length;i!==o;++i){var a=e[i],s=n[a.id];s.needsUpdate!==!1&&a.setValue(t,s.value,r)}},X.seqWithValue=function(t,e){for(var n=[],r=0,i=t.length;r!==i;++r){var o=t[r];o.id in e&&n.push(o)}return n};var bs={merge:function(t){for(var e={},n=0;n<t.length;n++){var r=this.clone(t[n]);for(var i in r)e[i]=r[i]}return e},clone:function(t){var e={};for(var n in t){e[n]={};for(var r in t[n]){var i=t[n][r];i&&(i.isColor||i.isMatrix3||i.isMatrix4||i.isVector2||i.isVector3||i.isVector4||i.isTexture)?e[n][r]=i.clone():Array.isArray(i)?e[n][r]=i.slice():e[n][r]=i}}return e}},_s="#ifdef USE_ALPHAMAP\n\tdiffuseColor.a *= texture2D( alphaMap, vUv ).g;\n#endif\n",ws="#ifdef USE_ALPHAMAP\n\tuniform sampler2D alphaMap;\n#endif\n",Ms="#ifdef ALPHATEST\n\tif ( diffuseColor.a < ALPHATEST ) discard;\n#endif\n",Es="#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",Ts="#ifdef USE_AOMAP\n\tuniform sampler2D aoMap;\n\tuniform float aoMapIntensity;\n#endif",Ss="\nvec3 transformed = vec3( position );\n",As="\nvec3 objectNormal = vec3( normal );\n",Ls="float punctualLightIntensityToIrradianceFactor( const in float lightDistance, const in float cutoffDistance, const in float decayExponent ) {\n\t\tif( decayExponent > 0.0 ) {\n#if defined ( PHYSICALLY_CORRECT_LIGHTS )\n\t\t\tfloat distanceFalloff = 1.0 / max( pow( lightDistance, decayExponent ), 0.01 );\n\t\t\tfloat maxDistanceCutoffFactor = pow2( saturate( 1.0 - pow4( lightDistance / cutoffDistance ) ) );\n\t\t\treturn distanceFalloff * maxDistanceCutoffFactor;\n#else\n\t\t\treturn pow( saturate( -lightDistance / cutoffDistance + 1.0 ), decayExponent );\n#endif\n\t\t}\n\t\treturn 1.0;\n}\nvec3 BRDF_Diffuse_Lambert( const in vec3 diffuseColor ) {\n\treturn RECIPROCAL_PI * diffuseColor;\n}\nvec3 F_Schlick( const in vec3 specularColor, const in float dotLH ) {\n\tfloat fresnel = exp2( ( -5.55473 * dotLH - 6.98316 ) * dotLH );\n\treturn ( 1.0 - specularColor ) * fresnel + specularColor;\n}\nfloat G_GGX_Smith( const in float alpha, const in float dotNL, const in float dotNV ) {\n\tfloat a2 = pow2( alpha );\n\tfloat gl = dotNL + sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNL ) );\n\tfloat gv = dotNV + sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNV ) );\n\treturn 1.0 / ( gl * gv );\n}\nfloat G_GGX_SmithCorrelated( const in float alpha, const in float dotNL, const in float dotNV ) {\n\tfloat a2 = pow2( alpha );\n\tfloat gv = dotNL * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNV ) );\n\tfloat gl = dotNV * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNL ) );\n\treturn 0.5 / max( gv + gl, EPSILON );\n}\nfloat D_GGX( const in float alpha, const in float dotNH ) {\n\tfloat a2 = pow2( alpha );\n\tfloat denom = pow2( dotNH ) * ( a2 - 1.0 ) + 1.0;\n\treturn RECIPROCAL_PI * a2 / pow2( denom );\n}\nvec3 BRDF_Specular_GGX( const in IncidentLight incidentLight, const in GeometricContext geometry, const in vec3 specularColor, const in float roughness ) {\n\tfloat alpha = pow2( roughness );\n\tvec3 halfDir = normalize( incidentLight.direction + geometry.viewDir );\n\tfloat dotNL = saturate( dot( geometry.normal, incidentLight.direction ) );\n\tfloat dotNV = saturate( dot( geometry.normal, geometry.viewDir ) );\n\tfloat dotNH = saturate( dot( geometry.normal, halfDir ) );\n\tfloat dotLH = saturate( dot( incidentLight.direction, halfDir ) );\n\tvec3 F = F_Schlick( specularColor, dotLH );\n\tfloat G = G_GGX_SmithCorrelated( alpha, dotNL, dotNV );\n\tfloat D = D_GGX( alpha, dotNH );\n\treturn F * ( G * D );\n}\nvec2 ltcTextureCoords( const in GeometricContext geometry, const in float roughness ) {\n\tconst float LUT_SIZE = 64.0;\n\tconst float LUT_SCALE = (LUT_SIZE - 1.0)/LUT_SIZE;\n\tconst float LUT_BIAS = 0.5/LUT_SIZE;\n\tvec3 N = geometry.normal;\n\tvec3 V = geometry.viewDir;\n\tvec3 P = geometry.position;\n\tfloat theta = acos( dot( N, V ) );\n\tvec2 uv = vec2(\n\t\tsqrt( saturate( roughness ) ),\n\t\tsaturate( theta / ( 0.5 * PI ) ) );\n\tuv = uv * LUT_SCALE + LUT_BIAS;\n\treturn uv;\n}\nvoid clipQuadToHorizon( inout vec3 L[5], out int n ) {\n\tint config = 0;\n\tif ( L[0].z > 0.0 ) config += 1;\n\tif ( L[1].z > 0.0 ) config += 2;\n\tif ( L[2].z > 0.0 ) config += 4;\n\tif ( L[3].z > 0.0 ) config += 8;\n\tn = 0;\n\tif ( config == 0 ) {\n\t} else if ( config == 1 ) {\n\t\tn = 3;\n\t\tL[1] = -L[1].z * L[0] + L[0].z * L[1];\n\t\tL[2] = -L[3].z * L[0] + L[0].z * L[3];\n\t} else if ( config == 2 ) {\n\t\tn = 3;\n\t\tL[0] = -L[0].z * L[1] + L[1].z * L[0];\n\t\tL[2] = -L[2].z * L[1] + L[1].z * L[2];\n\t} else if ( config == 3 ) {\n\t\tn = 4;\n\t\tL[2] = -L[2].z * L[1] + L[1].z * L[2];\n\t\tL[3] = -L[3].z * L[0] + L[0].z * L[3];\n\t} else if ( config == 4 ) {\n\t\tn = 3;\n\t\tL[0] = -L[3].z * L[2] + L[2].z * L[3];\n\t\tL[1] = -L[1].z * L[2] + L[2].z * L[1];\n\t} else if ( config == 5 ) {\n\t\tn = 0;\n\t} else if ( config == 6 ) {\n\t\tn = 4;\n\t\tL[0] = -L[0].z * L[1] + L[1].z * L[0];\n\t\tL[3] = -L[3].z * L[2] + L[2].z * L[3];\n\t} else if ( config == 7 ) {\n\t\tn = 5;\n\t\tL[4] = -L[3].z * L[0] + L[0].z * L[3];\n\t\tL[3] = -L[3].z * L[2] + L[2].z * L[3];\n\t} else if ( config == 8 ) {\n\t\tn = 3;\n\t\tL[0] = -L[0].z * L[3] + L[3].z * L[0];\n\t\tL[1] = -L[2].z * L[3] + L[3].z * L[2];\n\t\tL[2] = L[3];\n\t} else if ( config == 9 ) {\n\t\tn = 4;\n\t\tL[1] = -L[1].z * L[0] + L[0].z * L[1];\n\t\tL[2] = -L[2].z * L[3] + L[3].z * L[2];\n\t} else if ( config == 10 ) {\n\t\tn = 0;\n\t} else if ( config == 11 ) {\n\t\tn = 5;\n\t\tL[4] = L[3];\n\t\tL[3] = -L[2].z * L[3] + L[3].z * L[2];\n\t\tL[2] = -L[2].z * L[1] + L[1].z * L[2];\n\t} else if ( config == 12 ) {\n\t\tn = 4;\n\t\tL[1] = -L[1].z * L[2] + L[2].z * L[1];\n\t\tL[0] = -L[0].z * L[3] + L[3].z * L[0];\n\t} else if ( config == 13 ) {\n\t\tn = 5;\n\t\tL[4] = L[3];\n\t\tL[3] = L[2];\n\t\tL[2] = -L[1].z * L[2] + L[2].z * L[1];\n\t\tL[1] = -L[1].z * L[0] + L[0].z * L[1];\n\t} else if ( config == 14 ) {\n\t\tn = 5;\n\t\tL[4] = -L[0].z * L[3] + L[3].z * L[0];\n\t\tL[0] = -L[0].z * L[1] + L[1].z * L[0];\n\t} else if ( config == 15 ) {\n\t\tn = 4;\n\t}\n\tif ( n == 3 )\n\t\tL[3] = L[0];\n\tif ( n == 4 )\n\t\tL[4] = L[0];\n}\nfloat integrateLtcBrdfOverRectEdge( vec3 v1, vec3 v2 ) {\n\tfloat cosTheta = dot( v1, v2 );\n\tfloat theta = acos( cosTheta );\n\tfloat res = cross( v1, v2 ).z * ( ( theta > 0.001 ) ? theta / sin( theta ) : 1.0 );\n\treturn res;\n}\nvoid initRectPoints( const in vec3 pos, const in vec3 halfWidth, const in vec3 halfHeight, out vec3 rectPoints[4] ) {\n\trectPoints[0] = pos - halfWidth - halfHeight;\n\trectPoints[1] = pos + halfWidth - halfHeight;\n\trectPoints[2] = pos + halfWidth + halfHeight;\n\trectPoints[3] = pos - halfWidth + halfHeight;\n}\nvec3 integrateLtcBrdfOverRect( const in GeometricContext geometry, const in mat3 brdfMat, const in vec3 rectPoints[4] ) {\n\tvec3 N = geometry.normal;\n\tvec3 V = geometry.viewDir;\n\tvec3 P = geometry.position;\n\tvec3 T1, T2;\n\tT1 = normalize(V - N * dot( V, N ));\n\tT2 = - cross( N, T1 );\n\tmat3 brdfWrtSurface = brdfMat * transpose( mat3( T1, T2, N ) );\n\tvec3 clippedRect[5];\n\tclippedRect[0] = brdfWrtSurface * ( rectPoints[0] - P );\n\tclippedRect[1] = brdfWrtSurface * ( rectPoints[1] - P );\n\tclippedRect[2] = brdfWrtSurface * ( rectPoints[2] - P );\n\tclippedRect[3] = brdfWrtSurface * ( rectPoints[3] - P );\n\tint n;\n\tclipQuadToHorizon(clippedRect, n);\n\tif ( n == 0 )\n\t\treturn vec3( 0, 0, 0 );\n\tclippedRect[0] = normalize( clippedRect[0] );\n\tclippedRect[1] = normalize( clippedRect[1] );\n\tclippedRect[2] = normalize( clippedRect[2] );\n\tclippedRect[3] = normalize( clippedRect[3] );\n\tclippedRect[4] = normalize( clippedRect[4] );\n\tfloat sum = 0.0;\n\tsum += integrateLtcBrdfOverRectEdge( clippedRect[0], clippedRect[1] );\n\tsum += integrateLtcBrdfOverRectEdge( clippedRect[1], clippedRect[2] );\n\tsum += integrateLtcBrdfOverRectEdge( clippedRect[2], clippedRect[3] );\n\tif (n >= 4)\n\t\tsum += integrateLtcBrdfOverRectEdge( clippedRect[3], clippedRect[4] );\n\tif (n == 5)\n\t\tsum += integrateLtcBrdfOverRectEdge( clippedRect[4], clippedRect[0] );\n\tsum = max( 0.0, sum );\n\tvec3 Lo_i = vec3( sum, sum, sum );\n\treturn Lo_i;\n}\nvec3 Rect_Area_Light_Specular_Reflectance(\n\t\tconst in GeometricContext geometry,\n\t\tconst in vec3 lightPos, const in vec3 lightHalfWidth, const in vec3 lightHalfHeight,\n\t\tconst in float roughness,\n\t\tconst in sampler2D ltcMat, const in sampler2D ltcMag ) {\n\tvec3 rectPoints[4];\n\tinitRectPoints( lightPos, lightHalfWidth, lightHalfHeight, rectPoints );\n\tvec2 uv = ltcTextureCoords( geometry, roughness );\n\tvec4 brdfLtcApproxParams, t;\n\tbrdfLtcApproxParams = texture2D( ltcMat, uv );\n\tt = texture2D( ltcMat, uv );\n\tfloat brdfLtcScalar = texture2D( ltcMag, uv ).a;\n\tmat3 brdfLtcApproxMat = mat3(\n\t\tvec3( 1, 0, t.y ),\n\t\tvec3( 0, t.z, 0 ),\n\t\tvec3( t.w, 0, t.x )\n\t);\n\tvec3 specularReflectance = integrateLtcBrdfOverRect( geometry, brdfLtcApproxMat, rectPoints );\n\tspecularReflectance *= brdfLtcScalar;\n\treturn specularReflectance;\n}\nvec3 Rect_Area_Light_Diffuse_Reflectance(\n\t\tconst in GeometricContext geometry,\n\t\tconst in vec3 lightPos, const in vec3 lightHalfWidth, const in vec3 lightHalfHeight ) {\n\tvec3 rectPoints[4];\n\tinitRectPoints( lightPos, lightHalfWidth, lightHalfHeight, rectPoints );\n\tmat3 diffuseBrdfMat = mat3(1);\n\tvec3 diffuseReflectance = integrateLtcBrdfOverRect( geometry, diffuseBrdfMat, rectPoints );\n\treturn diffuseReflectance;\n}\nvec3 BRDF_Specular_GGX_Environment( const in GeometricContext geometry, const in vec3 specularColor, const in float roughness ) {\n\tfloat dotNV = saturate( dot( geometry.normal, geometry.viewDir ) );\n\tconst vec4 c0 = vec4( - 1, - 0.0275, - 0.572, 0.022 );\n\tconst vec4 c1 = vec4( 1, 0.0425, 1.04, - 0.04 );\n\tvec4 r = roughness * c0 + c1;\n\tfloat a004 = min( r.x * r.x, exp2( - 9.28 * dotNV ) ) * r.x + r.y;\n\tvec2 AB = vec2( -1.04, 1.04 ) * a004 + r.zw;\n\treturn specularColor * AB.x + AB.y;\n}\nfloat G_BlinnPhong_Implicit( ) {\n\treturn 0.25;\n}\nfloat D_BlinnPhong( const in float shininess, const in float dotNH ) {\n\treturn RECIPROCAL_PI * ( shininess * 0.5 + 1.0 ) * pow( dotNH, shininess );\n}\nvec3 BRDF_Specular_BlinnPhong( const in IncidentLight incidentLight, const in GeometricContext geometry, const in vec3 specularColor, const in float shininess ) {\n\tvec3 halfDir = normalize( incidentLight.direction + geometry.viewDir );\n\tfloat dotNH = saturate( dot( geometry.normal, halfDir ) );\n\tfloat dotLH = saturate( dot( incidentLight.direction, halfDir ) );\n\tvec3 F = F_Schlick( specularColor, dotLH );\n\tfloat G = G_BlinnPhong_Implicit( );\n\tfloat D = D_BlinnPhong( shininess, dotNH );\n\treturn F * ( G * D );\n}\nfloat GGXRoughnessToBlinnExponent( const in float ggxRoughness ) {\n\treturn ( 2.0 / pow2( ggxRoughness + 0.0001 ) - 2.0 );\n}\nfloat BlinnExponentToGGXRoughness( const in float blinnExponent ) {\n\treturn sqrt( 2.0 / ( blinnExponent + 2.0 ) );\n}\n",Rs="#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",Ps="#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",Cs="#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",Ns="#if NUM_CLIPPING_PLANES > 0 && ! defined( PHYSICAL ) && ! defined( PHONG )\n\tvarying vec3 vViewPosition;\n#endif\n",Is="#if NUM_CLIPPING_PLANES > 0 && ! defined( PHYSICAL ) && ! defined( PHONG )\n\tvViewPosition = - mvPosition.xyz;\n#endif\n",Us="#ifdef USE_COLOR\n\tdiffuseColor.rgb *= vColor;\n#endif",Os="#ifdef USE_COLOR\n\tvarying vec3 vColor;\n#endif\n",Ds="#ifdef USE_COLOR\n\tvarying vec3 vColor;\n#endif",zs="#ifdef USE_COLOR\n\tvColor.xyz = color.xyz;\n#endif",Fs="#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",Bs="#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",ks="#ifdef FLIP_SIDED\n\tobjectNormal = -objectNormal;\n#endif\nvec3 transformedNormal = normalMatrix * objectNormal;\n",Gs="#ifdef USE_DISPLACEMENTMAP\n\tuniform sampler2D displacementMap;\n\tuniform float displacementScale;\n\tuniform float displacementBias;\n#endif\n",Hs="#ifdef USE_DISPLACEMENTMAP\n\ttransformed += normal * ( texture2D( displacementMap, uv ).x * displacementScale + displacementBias );\n#endif\n",Vs="#ifdef USE_EMISSIVEMAP\n\tvec4 emissiveColor = texture2D( emissiveMap, vUv );\n\temissiveColor.rgb = emissiveMapTexelToLinear( emissiveColor ).rgb;\n\ttotalEmissiveRadiance *= emissiveColor.rgb;\n#endif\n",js="#ifdef USE_EMISSIVEMAP\n\tuniform sampler2D emissiveMap;\n#endif\n",Ws=" gl_FragColor = linearToOutputTexel( gl_FragColor );\n",Xs="\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",qs="#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",Ys="#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",Zs="#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",Js="#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",Qs="\n#ifdef USE_FOG\nfogDepth = -mvPosition.z;\n#endif",Ks="#ifdef USE_FOG\n varying float fogDepth;\n#endif\n",$s="#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",tu="#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",eu="#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",nu="#ifdef USE_LIGHTMAP\n\treflectedLight.indirectDiffuse += PI * texture2D( lightMap, vUv2 ).xyz * lightMapIntensity;\n#endif\n",ru="#ifdef USE_LIGHTMAP\n\tuniform sampler2D lightMap;\n\tuniform float lightMapIntensity;\n#endif",iu="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",ou="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",au="BlinnPhongMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb;\nmaterial.specularColor = specular;\nmaterial.specularShininess = shininess;\nmaterial.specularStrength = specularStrength;\n",su="varying vec3 vViewPosition;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\nstruct BlinnPhongMaterial {\n\tvec3\tdiffuseColor;\n\tvec3\tspecularColor;\n\tfloat\tspecularShininess;\n\tfloat\tspecularStrength;\n};\n#if NUM_RECT_AREA_LIGHTS > 0\n\tvoid RE_Direct_RectArea_BlinnPhong( const in RectAreaLight rectAreaLight, const in GeometricContext geometry, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {\n\t\tvec3 matDiffColor = material.diffuseColor;\n\t\tvec3 matSpecColor = material.specularColor;\n\t\tvec3 lightColor = rectAreaLight.color;\n\t\tfloat roughness = BlinnExponentToGGXRoughness( material.specularShininess );\n\t\tvec3 spec = Rect_Area_Light_Specular_Reflectance(\n\t\t\t\tgeometry,\n\t\t\t\trectAreaLight.position, rectAreaLight.halfWidth, rectAreaLight.halfHeight,\n\t\t\t\troughness,\n\t\t\t\tltcMat, ltcMag );\n\t\tvec3 diff = Rect_Area_Light_Diffuse_Reflectance(\n\t\t\t\tgeometry,\n\t\t\t\trectAreaLight.position, rectAreaLight.halfWidth, rectAreaLight.halfHeight );\n\t\treflectedLight.directSpecular += lightColor * matSpecColor * spec / PI2;\n\t\treflectedLight.directDiffuse += lightColor * matDiffColor * diff / PI2;\n\t}\n#endif\nvoid RE_Direct_BlinnPhong( const in IncidentLight directLight, const in GeometricContext geometry, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {\n\t#ifdef TOON\n\t\tvec3 irradiance = getGradientIrradiance( geometry.normal, directLight.direction ) * directLight.color;\n\t#else\n\t\tfloat dotNL = saturate( dot( geometry.normal, directLight.direction ) );\n\t\tvec3 irradiance = dotNL * directLight.color;\n\t#endif\n\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\t\tirradiance *= PI;\n\t#endif\n\treflectedLight.directDiffuse += irradiance * BRDF_Diffuse_Lambert( material.diffuseColor );\n\treflectedLight.directSpecular += irradiance * BRDF_Specular_BlinnPhong( directLight, geometry, material.specularColor, material.specularShininess ) * material.specularStrength;\n}\nvoid RE_IndirectDiffuse_BlinnPhong( const in vec3 irradiance, const in GeometricContext geometry, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {\n\treflectedLight.indirectDiffuse += irradiance * BRDF_Diffuse_Lambert( material.diffuseColor );\n}\n#define RE_Direct\t\t\t\tRE_Direct_BlinnPhong\n#define RE_Direct_RectArea\t\tRE_Direct_RectArea_BlinnPhong\n#define RE_IndirectDiffuse\t\tRE_IndirectDiffuse_BlinnPhong\n#define Material_LightProbeLOD( material )\t(0)\n",uu="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",cu="struct PhysicalMaterial {\n\tvec3\tdiffuseColor;\n\tfloat\tspecularRoughness;\n\tvec3\tspecularColor;\n\t#ifndef STANDARD\n\t\tfloat clearCoat;\n\t\tfloat clearCoatRoughness;\n\t#endif\n};\n#define MAXIMUM_SPECULAR_COEFFICIENT 0.16\n#define DEFAULT_SPECULAR_COEFFICIENT 0.04\nfloat clearCoatDHRApprox( const in float roughness, const in float dotNL ) {\n\treturn DEFAULT_SPECULAR_COEFFICIENT + ( 1.0 - DEFAULT_SPECULAR_COEFFICIENT ) * ( pow( 1.0 - dotNL, 5.0 ) * pow( 1.0 - roughness, 2.0 ) );\n}\n#if NUM_RECT_AREA_LIGHTS > 0\n\tvoid RE_Direct_RectArea_Physical( const in RectAreaLight rectAreaLight, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n\t\tvec3 matDiffColor = material.diffuseColor;\n\t\tvec3 matSpecColor = material.specularColor;\n\t\tvec3 lightColor = rectAreaLight.color;\n\t\tfloat roughness = material.specularRoughness;\n\t\tvec3 spec = Rect_Area_Light_Specular_Reflectance(\n\t\t\t\tgeometry,\n\t\t\t\trectAreaLight.position, rectAreaLight.halfWidth, rectAreaLight.halfHeight,\n\t\t\t\troughness,\n\t\t\t\tltcMat, ltcMag );\n\t\tvec3 diff = Rect_Area_Light_Diffuse_Reflectance(\n\t\t\t\tgeometry,\n\t\t\t\trectAreaLight.position, rectAreaLight.halfWidth, rectAreaLight.halfHeight );\n\t\treflectedLight.directSpecular += lightColor * matSpecColor * spec;\n\t\treflectedLight.directDiffuse += lightColor * matDiffColor * diff;\n\t}\n#endif\nvoid RE_Direct_Physical( const in IncidentLight directLight, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n\tfloat dotNL = saturate( dot( geometry.normal, directLight.direction ) );\n\tvec3 irradiance = dotNL * directLight.color;\n\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\t\tirradiance *= PI;\n\t#endif\n\t#ifndef STANDARD\n\t\tfloat clearCoatDHR = material.clearCoat * clearCoatDHRApprox( material.clearCoatRoughness, dotNL );\n\t#else\n\t\tfloat clearCoatDHR = 0.0;\n\t#endif\n\treflectedLight.directSpecular += ( 1.0 - clearCoatDHR ) * irradiance * BRDF_Specular_GGX( directLight, geometry, material.specularColor, material.specularRoughness );\n\treflectedLight.directDiffuse += ( 1.0 - clearCoatDHR ) * irradiance * BRDF_Diffuse_Lambert( material.diffuseColor );\n\t#ifndef STANDARD\n\t\treflectedLight.directSpecular += irradiance * material.clearCoat * BRDF_Specular_GGX( directLight, geometry, vec3( DEFAULT_SPECULAR_COEFFICIENT ), material.clearCoatRoughness );\n\t#endif\n}\nvoid RE_IndirectDiffuse_Physical( const in vec3 irradiance, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n\treflectedLight.indirectDiffuse += irradiance * BRDF_Diffuse_Lambert( material.diffuseColor );\n}\nvoid RE_IndirectSpecular_Physical( const in vec3 radiance, const in vec3 clearCoatRadiance, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n\t#ifndef STANDARD\n\t\tfloat dotNV = saturate( dot( geometry.normal, geometry.viewDir ) );\n\t\tfloat dotNL = dotNV;\n\t\tfloat clearCoatDHR = material.clearCoat * clearCoatDHRApprox( material.clearCoatRoughness, dotNL );\n\t#else\n\t\tfloat clearCoatDHR = 0.0;\n\t#endif\n\treflectedLight.indirectSpecular += ( 1.0 - clearCoatDHR ) * radiance * BRDF_Specular_GGX_Environment( geometry, material.specularColor, material.specularRoughness );\n\t#ifndef STANDARD\n\t\treflectedLight.indirectSpecular += clearCoatRadiance * material.clearCoat * BRDF_Specular_GGX_Environment( geometry, vec3( DEFAULT_SPECULAR_COEFFICIENT ), material.clearCoatRoughness );\n\t#endif\n}\n#define RE_Direct\t\t\t\tRE_Direct_Physical\n#define RE_Direct_RectArea\t\tRE_Direct_RectArea_Physical\n#define RE_IndirectDiffuse\t\tRE_IndirectDiffuse_Physical\n#define RE_IndirectSpecular\t\tRE_IndirectSpecular_Physical\n#define Material_BlinnShininessExponent( material ) GGXRoughnessToBlinnExponent( material.specularRoughness )\n#define Material_ClearCoat_BlinnShininessExponent( material ) GGXRoughnessToBlinnExponent( material.clearCoatRoughness )\nfloat computeSpecularOcclusion( const in float dotNV, const in float ambientOcclusion, const in float roughness ) {\n\treturn saturate( pow( dotNV + ambientOcclusion, exp2( - 16.0 * roughness - 1.0 ) ) - 1.0 + ambientOcclusion );\n}\n",lu="\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",hu="#if defined(USE_LOGDEPTHBUF) && defined(USE_LOGDEPTHBUF_EXT)\n\tgl_FragDepthEXT = log2(vFragDepth) * logDepthBufFC * 0.5;\n#endif",fu="#ifdef USE_LOGDEPTHBUF\n\tuniform float logDepthBufFC;\n\t#ifdef USE_LOGDEPTHBUF_EXT\n\t\tvarying float vFragDepth;\n\t#endif\n#endif\n",du="#ifdef USE_LOGDEPTHBUF\n\t#ifdef USE_LOGDEPTHBUF_EXT\n\t\tvarying float vFragDepth;\n\t#endif\n\tuniform float logDepthBufFC;\n#endif",pu="#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",mu="#ifdef USE_MAP\n\tvec4 texelColor = texture2D( map, vUv );\n\ttexelColor = mapTexelToLinear( texelColor );\n\tdiffuseColor *= texelColor;\n#endif\n",gu="#ifdef USE_MAP\n\tuniform sampler2D map;\n#endif\n",vu="#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",yu="#ifdef USE_MAP\n\tuniform vec4 offsetRepeat;\n\tuniform sampler2D map;\n#endif\n",xu="float metalnessFactor = metalness;\n#ifdef USE_METALNESSMAP\n\tvec4 texelMetalness = texture2D( metalnessMap, vUv );\n\tmetalnessFactor *= texelMetalness.r;\n#endif\n",bu="#ifdef USE_METALNESSMAP\n\tuniform sampler2D metalnessMap;\n#endif",_u="#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",wu="#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",Mu="#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",Eu="#ifdef DOUBLE_SIDED\n\tfloat flipNormal = ( float( gl_FrontFacing ) * 2.0 - 1.0 );\n#else\n\tfloat flipNormal = 1.0;\n#endif\n",Tu="#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",Su="#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",Au="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",Lu="#ifdef PREMULTIPLIED_ALPHA\n\tgl_FragColor.rgb *= gl_FragColor.a;\n#endif\n",Ru="#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",Pu="float roughnessFactor = roughness;\n#ifdef USE_ROUGHNESSMAP\n\tvec4 texelRoughness = texture2D( roughnessMap, vUv );\n\troughnessFactor *= texelRoughness.r;\n#endif\n",Cu="#ifdef USE_ROUGHNESSMAP\n\tuniform sampler2D roughnessMap;\n#endif",Nu="#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",Iu="#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",Uu="#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",Ou="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",Du="#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",zu="#ifdef USE_SKINNING\n\tuniform mat4 bindMatrix;\n\tuniform mat4 bindMatrixInverse;\n\t#ifdef BONE_TEXTURE\n\t\tuniform sampler2D boneTexture;\n\t\tuniform int boneTextureWidth;\n\t\tuniform int boneTextureHeight;\n\t\tmat4 getBoneMatrix( const in float i ) {\n\t\t\tfloat j = i * 4.0;\n\t\t\tfloat x = mod( j, float( boneTextureWidth ) );\n\t\t\tfloat y = floor( j / float( boneTextureWidth ) );\n\t\t\tfloat dx = 1.0 / float( boneTextureWidth );\n\t\t\tfloat dy = 1.0 / float( boneTextureHeight );\n\t\t\ty = dy * ( y + 0.5 );\n\t\t\tvec4 v1 = texture2D( boneTexture, vec2( dx * ( x + 0.5 ), y ) );\n\t\t\tvec4 v2 = texture2D( boneTexture, vec2( dx * ( x + 1.5 ), y ) );\n\t\t\tvec4 v3 = texture2D( boneTexture, vec2( dx * ( x + 2.5 ), y ) );\n\t\t\tvec4 v4 = texture2D( boneTexture, vec2( dx * ( x + 3.5 ), y ) );\n\t\t\tmat4 bone = mat4( v1, v2, v3, v4 );\n\t\t\treturn bone;\n\t\t}\n\t#else\n\t\tuniform mat4 boneMatrices[ MAX_BONES ];\n\t\tmat4 getBoneMatrix( const in float i ) {\n\t\t\tmat4 bone = boneMatrices[ int(i) ];\n\t\t\treturn bone;\n\t\t}\n\t#endif\n#endif\n",Fu="#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",Bu="#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",ku="float specularStrength;\n#ifdef USE_SPECULARMAP\n\tvec4 texelSpecular = texture2D( specularMap, vUv );\n\tspecularStrength = texelSpecular.r;\n#else\n\tspecularStrength = 1.0;\n#endif",Gu="#ifdef USE_SPECULARMAP\n\tuniform sampler2D specularMap;\n#endif",Hu="#if defined( TONE_MAPPING )\n gl_FragColor.rgb = toneMapping( gl_FragColor.rgb );\n#endif\n",Vu="#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",ju="#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",Wu="#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",Xu="#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",qu="#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP )\n\tvarying vec2 vUv2;\n#endif",Yu="#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP )\n\tattribute vec2 uv2;\n\tvarying vec2 vUv2;\n#endif",Zu="#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP )\n\tvUv2 = uv2;\n#endif",Ju="#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",Qu="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",Ku="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",$u="#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",tc="#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",ec="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",nc="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",rc="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",ic="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",oc="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",ac="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",sc="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",uc="#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",cc="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 <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 <premultiplied_alpha_fragment>\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n}\n",lc="#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",hc="#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 <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 <premultiplied_alpha_fragment>\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n}\n",fc="#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",dc="#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 <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 <premultiplied_alpha_fragment>\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n}\n",pc="#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",mc="#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",gc="#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",vc="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",yc="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",xc="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",bc="#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",_c={
+alphamap_fragment:_s,alphamap_pars_fragment:ws,alphatest_fragment:Ms,aomap_fragment:Es,aomap_pars_fragment:Ts,begin_vertex:Ss,beginnormal_vertex:As,bsdfs:Ls,bumpmap_pars_fragment:Rs,clipping_planes_fragment:Ps,clipping_planes_pars_fragment:Cs,clipping_planes_pars_vertex:Ns,clipping_planes_vertex:Is,color_fragment:Us,color_pars_fragment:Os,color_pars_vertex:Ds,color_vertex:zs,common:Fs,cube_uv_reflection_fragment:Bs,defaultnormal_vertex:ks,displacementmap_pars_vertex:Gs,displacementmap_vertex:Hs,emissivemap_fragment:Vs,emissivemap_pars_fragment:js,encodings_fragment:Ws,encodings_pars_fragment:Xs,envmap_fragment:qs,envmap_pars_fragment:Ys,envmap_pars_vertex:Zs,envmap_vertex:Js,fog_vertex:Qs,fog_pars_vertex:Ks,fog_fragment:$s,fog_pars_fragment:tu,gradientmap_pars_fragment:eu,lightmap_fragment:nu,lightmap_pars_fragment:ru,lights_lambert_vertex:iu,lights_pars:ou,lights_phong_fragment:au,lights_phong_pars_fragment:su,lights_physical_fragment:uu,lights_physical_pars_fragment:cu,lights_template:lu,logdepthbuf_fragment:hu,logdepthbuf_pars_fragment:fu,logdepthbuf_pars_vertex:du,logdepthbuf_vertex:pu,map_fragment:mu,map_pars_fragment:gu,map_particle_fragment:vu,map_particle_pars_fragment:yu,metalnessmap_fragment:xu,metalnessmap_pars_fragment:bu,morphnormal_vertex:_u,morphtarget_pars_vertex:wu,morphtarget_vertex:Mu,normal_flip:Eu,normal_fragment:Tu,normalmap_pars_fragment:Su,packing:Au,premultiplied_alpha_fragment:Lu,project_vertex:Ru,roughnessmap_fragment:Pu,roughnessmap_pars_fragment:Cu,shadowmap_pars_fragment:Nu,shadowmap_pars_vertex:Iu,shadowmap_vertex:Uu,shadowmask_pars_fragment:Ou,skinbase_vertex:Du,skinning_pars_vertex:zu,skinning_vertex:Fu,skinnormal_vertex:Bu,specularmap_fragment:ku,specularmap_pars_fragment:Gu,tonemapping_fragment:Hu,tonemapping_pars_fragment:Vu,uv_pars_fragment:ju,uv_pars_vertex:Wu,uv_vertex:Xu,uv2_pars_fragment:qu,uv2_pars_vertex:Yu,uv2_vertex:Zu,worldpos_vertex:Ju,cube_frag:Qu,cube_vert:Ku,depth_frag:$u,depth_vert:tc,distanceRGBA_frag:ec,distanceRGBA_vert:nc,equirect_frag:rc,equirect_vert:ic,linedashed_frag:oc,linedashed_vert:ac,meshbasic_frag:sc,meshbasic_vert:uc,meshlambert_frag:cc,meshlambert_vert:lc,meshphong_frag:hc,meshphong_vert:fc,meshphysical_frag:dc,meshphysical_vert:pc,normal_frag:mc,normal_vert:gc,points_frag:vc,points_vert:yc,shadow_frag:xc,shadow_vert:bc};q.prototype={constructor:q,isColor:!0,r:1,g:1,b:1,set:function(t){return t&&t.isColor?this.copy(t):"number"==typeof t?this.setHex(t):"string"==typeof t&&this.setStyle(t),this},setScalar:function(t){return this.r=t,this.g=t,this.b=t,this},setHex:function(t){return t=Math.floor(t),this.r=(t>>16&255)/255,this.g=(t>>8&255)/255,this.b=(255&t)/255,this},setRGB:function(t,e,n){return this.r=t,this.g=e,this.b=n,this},setHSL:function(){function t(t,e,n){return n<0&&(n+=1),n>1&&(n-=1),n<1/6?t+6*(e-t)*n:n<.5?e:n<2/3?t+6*(e-t)*(2/3-n):t}return function(e,n,r){if(e=ds.euclideanModulo(e,1),n=ds.clamp(n,0,1),r=ds.clamp(r,0,1),0===n)this.r=this.g=this.b=r;else{var i=r<=.5?r*(1+n):r+n-r*n,o=2*r-i;this.r=t(o,i,e+1/3),this.g=t(o,i,e),this.b=t(o,i,e-1/3)}return this}}(),setStyle:function(t){function e(e){void 0!==e&&parseFloat(e)<1&&console.warn("THREE.Color: Alpha component of "+t+" will be ignored.")}var n;if(n=/^((?:rgb|hsl)a?)\(\s*([^\)]*)\)/.exec(t)){var r,i=n[1],o=n[2];switch(i){case"rgb":case"rgba":if(r=/^(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(,\s*([0-9]*\.?[0-9]+)\s*)?$/.exec(o))return this.r=Math.min(255,parseInt(r[1],10))/255,this.g=Math.min(255,parseInt(r[2],10))/255,this.b=Math.min(255,parseInt(r[3],10))/255,e(r[5]),this;if(r=/^(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(,\s*([0-9]*\.?[0-9]+)\s*)?$/.exec(o))return this.r=Math.min(100,parseInt(r[1],10))/100,this.g=Math.min(100,parseInt(r[2],10))/100,this.b=Math.min(100,parseInt(r[3],10))/100,e(r[5]),this;break;case"hsl":case"hsla":if(r=/^([0-9]*\.?[0-9]+)\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(,\s*([0-9]*\.?[0-9]+)\s*)?$/.exec(o)){var a=parseFloat(r[1])/360,s=parseInt(r[2],10)/100,u=parseInt(r[3],10)/100;return e(r[5]),this.setHSL(a,s,u)}}}else if(n=/^\#([A-Fa-f0-9]+)$/.exec(t)){var c=n[1],l=c.length;if(3===l)return this.r=parseInt(c.charAt(0)+c.charAt(0),16)/255,this.g=parseInt(c.charAt(1)+c.charAt(1),16)/255,this.b=parseInt(c.charAt(2)+c.charAt(2),16)/255,this;if(6===l)return this.r=parseInt(c.charAt(0)+c.charAt(1),16)/255,this.g=parseInt(c.charAt(2)+c.charAt(3),16)/255,this.b=parseInt(c.charAt(4)+c.charAt(5),16)/255,this}if(t&&t.length>0){var c=wc[t];void 0!==c?this.setHex(c):console.warn("THREE.Color: Unknown color "+t)}return this},clone:function(){return new this.constructor(this.r,this.g,this.b)},copy:function(t){return this.r=t.r,this.g=t.g,this.b=t.b,this},copyGammaToLinear:function(t,e){return void 0===e&&(e=2),this.r=Math.pow(t.r,e),this.g=Math.pow(t.g,e),this.b=Math.pow(t.b,e),this},copyLinearToGamma:function(t,e){void 0===e&&(e=2);var n=e>0?1/e:1;return this.r=Math.pow(t.r,n),this.g=Math.pow(t.g,n),this.b=Math.pow(t.b,n),this},convertGammaToLinear:function(){var t=this.r,e=this.g,n=this.b;return this.r=t*t,this.g=e*e,this.b=n*n,this},convertLinearToGamma:function(){return this.r=Math.sqrt(this.r),this.g=Math.sqrt(this.g),this.b=Math.sqrt(this.b),this},getHex:function(){return 255*this.r<<16^255*this.g<<8^255*this.b<<0},getHexString:function(){return("000000"+this.getHex().toString(16)).slice(-6)},getHSL:function(t){var e,n,r=t||{h:0,s:0,l:0},i=this.r,o=this.g,a=this.b,s=Math.max(i,o,a),u=Math.min(i,o,a),c=(u+s)/2;if(u===s)e=0,n=0;else{var l=s-u;switch(n=c<=.5?l/(s+u):l/(2-s-u),s){case i:e=(o-a)/l+(o<a?6:0);break;case o:e=(a-i)/l+2;break;case a:e=(i-o)/l+4}e/=6}return r.h=e,r.s=n,r.l=c,r},getStyle:function(){return"rgb("+(255*this.r|0)+","+(255*this.g|0)+","+(255*this.b|0)+")"},offsetHSL:function(t,e,n){var r=this.getHSL();return r.h+=t,r.s+=e,r.l+=n,this.setHSL(r.h,r.s,r.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 wc={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};Y.prototype=Object.create(o.prototype),Y.prototype.constructor=Y,Y.prototype.isDataTexture=!0;var Mc={common:{diffuse:{value:new q(15658734)},opacity:{value:1},map:{value:null},offsetRepeat:{value:new a(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 q(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 q(15658734)},opacity:{value:1},size:{value:1},scale:{value:1},map:{value:null},offsetRepeat:{value:new a(0,0,1,1)}}},Ec={basic:{uniforms:bs.merge([Mc.common,Mc.aomap,Mc.lightmap,Mc.fog]),vertexShader:_c.meshbasic_vert,fragmentShader:_c.meshbasic_frag},lambert:{uniforms:bs.merge([Mc.common,Mc.aomap,Mc.lightmap,Mc.emissivemap,Mc.fog,Mc.lights,{emissive:{value:new q(0)}}]),vertexShader:_c.meshlambert_vert,fragmentShader:_c.meshlambert_frag},phong:{uniforms:bs.merge([Mc.common,Mc.aomap,Mc.lightmap,Mc.emissivemap,Mc.bumpmap,Mc.normalmap,Mc.displacementmap,Mc.gradientmap,Mc.fog,Mc.lights,{emissive:{value:new q(0)},specular:{value:new q(1118481)},shininess:{value:30}}]),vertexShader:_c.meshphong_vert,fragmentShader:_c.meshphong_frag},standard:{uniforms:bs.merge([Mc.common,Mc.aomap,Mc.lightmap,Mc.emissivemap,Mc.bumpmap,Mc.normalmap,Mc.displacementmap,Mc.roughnessmap,Mc.metalnessmap,Mc.fog,Mc.lights,{emissive:{value:new q(0)},roughness:{value:.5},metalness:{value:0},envMapIntensity:{value:1}}]),vertexShader:_c.meshphysical_vert,fragmentShader:_c.meshphysical_frag},points:{uniforms:bs.merge([Mc.points,Mc.fog]),vertexShader:_c.points_vert,fragmentShader:_c.points_frag},dashed:{uniforms:bs.merge([Mc.common,Mc.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:_c.linedashed_vert,fragmentShader:_c.linedashed_frag},depth:{uniforms:bs.merge([Mc.common,Mc.displacementmap]),vertexShader:_c.depth_vert,fragmentShader:_c.depth_frag},normal:{uniforms:bs.merge([Mc.common,Mc.bumpmap,Mc.normalmap,Mc.displacementmap,{opacity:{value:1}}]),vertexShader:_c.normal_vert,fragmentShader:_c.normal_frag},cube:{uniforms:{tCube:{value:null},tFlip:{value:-1},opacity:{value:1}},vertexShader:_c.cube_vert,fragmentShader:_c.cube_frag},equirect:{uniforms:{tEquirect:{value:null},tFlip:{value:-1}},vertexShader:_c.equirect_vert,fragmentShader:_c.equirect_frag},distanceRGBA:{uniforms:{lightPos:{value:new l}},vertexShader:_c.distanceRGBA_vert,fragmentShader:_c.distanceRGBA_frag}};Ec.physical={uniforms:bs.merge([Ec.standard.uniforms,{clearCoat:{value:0},clearCoatRoughness:{value:0}}]),vertexShader:_c.meshphysical_vert,fragmentShader:_c.meshphysical_frag},Z.prototype={constructor:Z,set:function(t,e){return this.min.copy(t),this.max.copy(e),this},setFromPoints:function(t){this.makeEmpty();for(var e=0,n=t.length;e<n;e++)this.expandByPoint(t[e]);return this},setFromCenterAndSize:function(){var t=new i;return function(e,n){var r=t.copy(n).multiplyScalar(.5);return this.min.copy(e).sub(r),this.max.copy(e).add(r),this}}(),clone:function(){return(new this.constructor).copy(this)},copy:function(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){var n=e||new i;return n.set((t.x-this.min.x)/(this.max.x-this.min.x),(t.y-this.min.y)/(this.max.y-this.min.y))},intersectsBox:function(t){return!(t.max.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){var n=e||new i;return n.copy(t).clamp(this.min,this.max)},distanceToPoint:function(){var t=new i;return function(e){var n=t.copy(e).clamp(this.min,this.max);return n.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 Tc=0;K.prototype={constructor:K,isMaterial:!0,get needsUpdate(){return this._needsUpdate},set needsUpdate(t){t===!0&&this.update(),this._needsUpdate=t},setValues:function(t){if(void 0!==t)for(var e in t){var n=t[e];if(void 0!==n){var r=this[e];void 0!==r?r&&r.isColor?r.set(n):r&&r.isVector3&&n&&n.isVector3?r.copy(n):"overdraw"===e?this[e]=Number(n):this[e]=n:console.warn("THREE."+this.type+": '"+e+"' is not a property of this material.")}else console.warn("THREE.Material: '"+e+"' parameter is undefined.")}},toJSON:function(t){function e(t){var e=[];for(var n in t){var r=t[n];delete r.metadata,e.push(r)}return e}var n=void 0===t;n&&(t={textures:{},images:{}});var r={metadata:{version:4.4,type:"Material",generator:"Material.toJSON"}};if(r.uuid=this.uuid,r.type=this.type,""!==this.name&&(r.name=this.name),this.color&&this.color.isColor&&(r.color=this.color.getHex()),void 0!==this.roughness&&(r.roughness=this.roughness),void 0!==this.metalness&&(r.metalness=this.metalness),this.emissive&&this.emissive.isColor&&(r.emissive=this.emissive.getHex()),this.specular&&this.specular.isColor&&(r.specular=this.specular.getHex()),void 0!==this.shininess&&(r.shininess=this.shininess),void 0!==this.clearCoat&&(r.clearCoat=this.clearCoat),void 0!==this.clearCoatRoughness&&(r.clearCoatRoughness=this.clearCoatRoughness),this.map&&this.map.isTexture&&(r.map=this.map.toJSON(t).uuid),this.alphaMap&&this.alphaMap.isTexture&&(r.alphaMap=this.alphaMap.toJSON(t).uuid),this.lightMap&&this.lightMap.isTexture&&(r.lightMap=this.lightMap.toJSON(t).uuid),this.bumpMap&&this.bumpMap.isTexture&&(r.bumpMap=this.bumpMap.toJSON(t).uuid,r.bumpScale=this.bumpScale),this.normalMap&&this.normalMap.isTexture&&(r.normalMap=this.normalMap.toJSON(t).uuid,r.normalScale=this.normalScale.toArray()),this.displacementMap&&this.displacementMap.isTexture&&(r.displacementMap=this.displacementMap.toJSON(t).uuid,r.displacementScale=this.displacementScale,r.displacementBias=this.displacementBias),this.roughnessMap&&this.roughnessMap.isTexture&&(r.roughnessMap=this.roughnessMap.toJSON(t).uuid),this.metalnessMap&&this.metalnessMap.isTexture&&(r.metalnessMap=this.metalnessMap.toJSON(t).uuid),this.emissiveMap&&this.emissiveMap.isTexture&&(r.emissiveMap=this.emissiveMap.toJSON(t).uuid),this.specularMap&&this.specularMap.isTexture&&(r.specularMap=this.specularMap.toJSON(t).uuid),this.envMap&&this.envMap.isTexture&&(r.envMap=this.envMap.toJSON(t).uuid,r.reflectivity=this.reflectivity),this.gradientMap&&this.gradientMap.isTexture&&(r.gradientMap=this.gradientMap.toJSON(t).uuid),void 0!==this.size&&(r.size=this.size),void 0!==this.sizeAttenuation&&(r.sizeAttenuation=this.sizeAttenuation),this.blending!==go&&(r.blending=this.blending),this.shading!==lo&&(r.shading=this.shading),this.side!==ao&&(r.side=this.side),this.vertexColors!==ho&&(r.vertexColors=this.vertexColors),this.opacity<1&&(r.opacity=this.opacity),this.transparent===!0&&(r.transparent=this.transparent),r.depthFunc=this.depthFunc,r.depthTest=this.depthTest,r.depthWrite=this.depthWrite,this.alphaTest>0&&(r.alphaTest=this.alphaTest),this.premultipliedAlpha===!0&&(r.premultipliedAlpha=this.premultipliedAlpha),this.wireframe===!0&&(r.wireframe=this.wireframe),this.wireframeLinewidth>1&&(r.wireframeLinewidth=this.wireframeLinewidth),"round"!==this.wireframeLinecap&&(r.wireframeLinecap=this.wireframeLinecap),"round"!==this.wireframeLinejoin&&(r.wireframeLinejoin=this.wireframeLinejoin),r.skinning=this.skinning,r.morphTargets=this.morphTargets,n){var i=e(t.textures),o=e(t.images);i.length>0&&(r.textures=i),o.length>0&&(r.images=o)}return r},clone:function(){return(new this.constructor).copy(this)},copy:function(t){this.name=t.name,this.fog=t.fog,this.lights=t.lights,this.blending=t.blending,this.side=t.side,this.shading=t.shading,this.vertexColors=t.vertexColors,this.opacity=t.opacity,this.transparent=t.transparent,this.blendSrc=t.blendSrc,this.blendDst=t.blendDst,this.blendEquation=t.blendEquation,this.blendSrcAlpha=t.blendSrcAlpha,this.blendDstAlpha=t.blendDstAlpha,this.blendEquationAlpha=t.blendEquationAlpha,this.depthFunc=t.depthFunc,this.depthTest=t.depthTest,this.depthWrite=t.depthWrite,this.colorWrite=t.colorWrite,this.precision=t.precision,this.polygonOffset=t.polygonOffset,this.polygonOffsetFactor=t.polygonOffsetFactor,this.polygonOffsetUnits=t.polygonOffsetUnits,this.alphaTest=t.alphaTest,this.premultipliedAlpha=t.premultipliedAlpha,this.overdraw=t.overdraw,this.visible=t.visible,this.clipShadows=t.clipShadows,this.clipIntersection=t.clipIntersection;var e=t.clippingPlanes,n=null;if(null!==e){var r=e.length;n=new Array(r);for(var i=0;i!==r;++i)n[i]=e[i].clone()}return this.clippingPlanes=n,this},update:function(){this.dispatchEvent({type:"update"})},dispose:function(){this.dispatchEvent({type:"dispose"})}},Object.assign(K.prototype,r.prototype),$.prototype=Object.create(K.prototype),$.prototype.constructor=$,$.prototype.isShaderMaterial=!0,$.prototype.copy=function(t){return K.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},$.prototype.toJSON=function(t){var e=K.prototype.toJSON.call(this,t);return e.uniforms=this.uniforms,e.vertexShader=this.vertexShader,e.fragmentShader=this.fragmentShader,e},tt.prototype=Object.create(K.prototype),tt.prototype.constructor=tt,tt.prototype.isMeshDepthMaterial=!0,tt.prototype.copy=function(t){return K.prototype.copy.call(this,t),this.depthPacking=t.depthPacking,this.skinning=t.skinning,this.morphTargets=t.morphTargets,this.map=t.map,this.alphaMap=t.alphaMap,this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this},et.prototype={constructor:et,isBox3:!0,set:function(t,e){return this.min.copy(t),this.max.copy(e),this},setFromArray:function(t){for(var e=+(1/0),n=+(1/0),r=+(1/0),i=-(1/0),o=-(1/0),a=-(1/0),s=0,u=t.length;s<u;s+=3){var c=t[s],l=t[s+1],h=t[s+2];c<e&&(e=c),l<n&&(n=l),h<r&&(r=h),c>i&&(i=c),l>o&&(o=l),h>a&&(a=h)}return this.min.set(e,n,r),this.max.set(i,o,a),this},setFromBufferAttribute:function(t){for(var e=+(1/0),n=+(1/0),r=+(1/0),i=-(1/0),o=-(1/0),a=-(1/0),s=0,u=t.count;s<u;s++){var c=t.getX(s),l=t.getY(s),h=t.getZ(s);c<e&&(e=c),l<n&&(n=l),h<r&&(r=h),c>i&&(i=c),l>o&&(o=l),h>a&&(a=h)}return this.min.set(e,n,r),this.max.set(i,o,a),this},setFromPoints:function(t){this.makeEmpty();for(var e=0,n=t.length;e<n;e++)this.expandByPoint(t[e]);return this},setFromCenterAndSize:function(){var t=new l;return function(e,n){var r=t.copy(n).multiplyScalar(.5);return this.min.copy(e).sub(r),this.max.copy(e).add(r),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 l;return this.isEmpty()?e.set(0,0,0):e.addVectors(this.min,this.max).multiplyScalar(.5)},getSize:function(t){var e=t||new l;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 l;return function(e){var n=this;return e.updateMatrixWorld(!0),e.traverse(function(e){var r,i,o=e.geometry;if(void 0!==o)if(o.isGeometry){var a=o.vertices;for(r=0,i=a.length;r<i;r++)t.copy(a[r]),t.applyMatrix4(e.matrixWorld),n.expandByPoint(t)}else if(o.isBufferGeometry){var s=o.attributes.position;if(void 0!==s)for(r=0,i=s.count;r<i;r++)t.fromBufferAttribute(s,r).applyMatrix4(e.matrixWorld),n.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){var n=e||new l;return n.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;return function(e){return void 0===t&&(t=new l),this.clampPoint(e.center,t),t.distanceToSquared(e.center)<=e.radius*e.radius}}(),intersectsPlane:function(t){var e,n;return t.normal.x>0?(e=t.normal.x*this.min.x,n=t.normal.x*this.max.x):(e=t.normal.x*this.max.x,n=t.normal.x*this.min.x),t.normal.y>0?(e+=t.normal.y*this.min.y,n+=t.normal.y*this.max.y):(e+=t.normal.y*this.max.y,n+=t.normal.y*this.min.y),t.normal.z>0?(e+=t.normal.z*this.min.z,n+=t.normal.z*this.max.z):(e+=t.normal.z*this.max.z,n+=t.normal.z*this.min.z),e<=t.constant&&n>=t.constant},clampPoint:function(t,e){var n=e||new l;return n.copy(t).clamp(this.min,this.max)},distanceToPoint:function(){var t=new l;return function(e){var n=t.copy(e).clamp(this.min,this.max);return n.sub(e).length()}}(),getBoundingSphere:function(){var t=new l;return function(e){var n=e||new nt;return this.getCenter(n.center),n.radius=.5*this.getSize(t).length(),n}}(),intersect:function(t){return this.min.max(t.min),this.max.min(t.max),this.isEmpty()&&this.makeEmpty(),this},union:function(t){return this.min.min(t.min),this.max.max(t.max),this},applyMatrix4:function(){var t=[new l,new l,new l,new l,new l,new l,new l,new l];return function(e){return this.isEmpty()?this:(t[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(e),t[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(e),t[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(e),t[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(e),t[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(e),t[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(e),t[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(e),t[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(e),this.setFromPoints(t),this)}}(),translate:function(t){return this.min.add(t),this.max.add(t),this},equals:function(t){return t.min.equals(this.min)&&t.max.equals(this.max)}},nt.prototype={constructor:nt,set:function(t,e){return this.center.copy(t),this.radius=e,this},setFromPoints:function(){var t;return function(e,n){void 0===t&&(t=new et);var r=this.center;void 0!==n?r.copy(n):t.setFromPoints(e).getCenter(r);for(var i=0,o=0,a=e.length;o<a;o++)i=Math.max(i,r.distanceToSquared(e[o]));return this.radius=Math.sqrt(i),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:func