aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorRahiel Kasim <rahielkasim@gmail.com>2016-06-30 16:20:35 +0200
committerRahiel Kasim <rahielkasim@gmail.com>2016-06-30 16:20:35 +0200
commitd355322816ff62bdf237f0883bd0938a86ba69e9 (patch)
treee316ac199b54a3383b4b30661c993e496d7d62de
parent705698151ca56ccaf65967036e59585407c34c29 (diff)
publish website from sunsistemo's own repo
-rw-r--r--CNAME1
-rw-r--r--sunsistemo.js22
-rw-r--r--validation/validation.js17
3 files changed, 40 insertions, 0 deletions
diff --git a/CNAME b/CNAME
new file mode 100644
index 0000000..4491783
--- /dev/null
+++ b/CNAME
@@ -0,0 +1 @@
+sunsistemo.js.org
diff --git a/sunsistemo.js b/sunsistemo.js
new file mode 100644
index 0000000..097b9ca
--- /dev/null
+++ b/sunsistemo.js
@@ -0,0 +1,22 @@
+!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
diff --git a/validation/validation.js b/validation/validation.js
new file mode 100644
index 0000000..1754c64
--- /dev/null
+++ b/validation/validation.js
@@ -0,0 +1,17 @@
+!function(e){function t(i){if(r[i])return r[i].exports;var n=r[i]={exports:{},id:i,loaded:!1};return e[i].call(n.exports,n,n.exports,t),n.loaded=!0,n.exports}var r={};return t.m=e,t.c=r,t.p="",t(0)}([function(e,t,r){"use strict";function i(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t["default"]=e,t}function n(){for(var e=o.genSolarSystem(),t=e.bodies,r=new Date(0),i=46,n=[],a=new Date(0),s=0;s<i;s++)n.push(a.getTime()),a.setFullYear(a.getFullYear()+1);e.stepsize=43200,t=c.leapfrog_initial(t,e.stepsize);var h=Math.round(31536e3*i/e.stepsize),l={},u=!0,p=!1,d=void 0;try{for(var f,m=t[Symbol.iterator]();!(u=(f=m.next()).done);u=!0){var g=f.value;l[g.texture]={}}}catch(v){p=!0,d=v}finally{try{!u&&m["return"]&&m["return"]()}finally{if(p)throw d}}for(var y=1970,x=0;x<h;x++){if(n.indexOf(r.getTime())>-1){var b=!0,_=!1,M=void 0;try{for(var w,S=t[Symbol.iterator]();!(b=(w=S.next()).done);b=!0){var E=w.value;l[E.texture][y]={position:[E.r.x,E.r.y,E.r.z]}}}catch(v){_=!0,M=v}finally{try{!b&&S["return"]&&S["return"]()}finally{if(_)throw M}}console.log(y),y++}t=c.leapfrog(t,e.stepsize),r.setTime(r.getTime()+1e3*e.stepsize)}document.write(JSON.stringify(l))}var a=r(1),o=i(a),s=r(2),c=i(s);n()},function(e,t,r){"use strict";function i(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t["default"]=e,t}function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function a(e){function t(e){var t=2*Math.PI/(e*r/i);return new b(0,t,0)}var r=86400,i=.1*r,n=new M(1.98855e30,new b(0,0,0),new b(0,0,0),696342e3,"sun",t(25.38)),a=new M(3.3011e23,new b(38371302887.33682,28770253502.43919,(-1175806982.200703)),new b((-38787.66588423944),41093.05229662527,6918.459013107025),2439700,"mercury",t(58.64)),o=new M(4.8675e24,new b((-5377313296.255215),(-108595640391.1222),(-1164748440.839313)),new b(34741.48284671561,(-1865.747137359618),(-2031.505677951714)),6051800,"venus",t(-243.02)),s=new M(5.997219e24,new b((-27007428594.39665),144600702142.9538,9687450.72542131),new b((-29770.44214085218),(-5568.042062189587),.3960050738736065),6371e3,"earth",t(.997)),c=new M(7.3477e22,new b((-27391801660.63208),144525214256.4551,(-5966407.74730593)),new b((-29515.49140447329),(-6529.794009827214),(-76.15838122417217)),1737100,"moon",t(27.32)),h=new M(6.4171e23,new b(198382454336.9704,74229240656.11902,(-3334840409.383859)),new b((-7557.626093692695),24761.2652479582,704.7458490385097),3389500,"mars",t(1.026)),l=new M(1.8986e27,new b((-749650178421.0088),(-320171238261.7047),18111584337.18784),new b(4982.523623046754,(-11417.82925514267),(-64.66474051600457)),69911e3,"jupiter",t(.41)),u=new M(5.6836e26,new b(1082806087546.906,851084072618.1986,(-57934875833.71094)),new b((-6487.121289267689),7565.952106845154,125.4418330224025),58232e3,"saturn",t(.426)),p=new M(8.681e25,new b((-2724615970786.758),(-289401931770.462),34288240158.31023),new b(671.2348901080567,(-7099.101277978575),(-35.28579247809205)),25362e3,"uranus",t(-.71833)),d=new M(1.0243e26,new b((-2328070851258),(-3891087698123.372),133743983241.2817),new b(4633.959234836657,(-2767.419818371484),(-49.57409060715667)),24622e3,"neptune",t(.671)),f=new M(1.305e22,new b((-4551131153197.412),317539648237.7141,1282172026454.296),new b(635.4565491262041,(-5762.636149150082),440.9493397386148),1186e3,"pluto",t(-6.387)),m=[n,a,o,s,c,h,l,u,p,d,f],g=function(e){return.2*Math.pow(e,.25)},v=!0,y=!1,x=void 0;try{for(var _,w=m[Symbol.iterator]();!(v=(_=w.next()).done);v=!0){var S=_.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:i,stepsPerFrame:1,scalePosition:function(e){return e.multiplyScalar(1e-9)},camera:{x:0,y:0,z:1300},collisions:!1,sunOn:e,sphereP:32,boundary:1e13,counter:"date"}}function o(e){var t=new M(1e19,new b(0,0,0),new b(0,(-90),0),12,"sun",new b(0,0,S())),r=new M(1e18,new b(200,0,0),new b(0,900,0),8,"earth",new b(0,0,S())),i=[t,r];return{bodies:i,stepsize:5e-6,stepsPerFrame:300,camera:{x:0,y:0,z:250},collisions:!1,sunOn:e,sphereP:32,boundary:2e3}}function s(e){var t=new M(1e19,new b(0,0,0),new b(0,2,0),12,"sun",new b(0,0,S())),r=new M(1e18,new b(200,0,0),new b(0,900,0),8,"venus",new b(0,0,S())),i=new M(1e18,new b((-200),0,0),new b(0,(-900),0),8,"earth",new b(0,0,S())),n=[t,r,i];return{bodies:n,stepsize:3e-6,stepsPerFrame:300,camera:{x:0,y:0,z:250},collisions:!1,sunOn:e,sphereP:32,boundary:2e3}}function c(e,t,r,i){t||(w=[]);for(var n=[],a=0;a<e;a++){var o=new b(d(-300,300),d(-300,300),d(-300,300)),s=new b(d(-500,500),d(-500,500),d(-500,500)),c=new b(0,S(),0),h=15*Math.random()+4;n.push(new M(1e15*(3^h),o,s,h,p(_.solar),c))}return{bodies:n,stepsize:.001,stepsPerFrame:1,camera:{x:0,y:0,z:400},collisions:i,sunOn:r,sphereP:32,boundary:2e3}}function h(e,t,r,i){var n=_[t],a=[],o=new b(0,4,0);a.push(new M(1e18,new b(0,0,0),new b(0,0,0),12,"sun",new b(0,.01,0)));for(var s=0;s<e;s++){var c=new b(d(-300,300),d(-300,300),d(-300,300)),h=new b(0,0,0),l=new b(0,S(),0),u=15*Math.random()+4;h.crossVectors(c,o).multiplyScalar(Math.random()+.1),a.push(new M(1e14*u,c,h,u,p(n),l))}return{bodies:a,stepsize:5e-4,stepsPerFrame:1,camera:{x:0,y:0,z:400},collisions:i,sunOn:r,sphereP:32,boundary:2e3}}function l(e,t){var r=function(){var r=1/y.G,i=f(_.all,3),n=m(i,3),a=n[0],o=n[1],s=n[2],c=new M(r,new b((-1),0,0),new b(e,t,0),.05,a,new b(0,S(),0)),h=new M(r,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 M(r,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,h,l],stepsize:2e-5,stepsPerFrame:5e3,camera:{x:0,y:0,z:2},collisions:!1,boundary:2e3}};return r}function u(e,t,r,i){var n={},a=new x.TextureLoader;if(t){var o=a.load("textures/"+e+"map.jpg");o.minFilter=x.LinearFilter,n.texture=o}if(r){var s=a.load("textures/"+e+"bump.jpg");s.minFilter=x.LinearFilter,n.bumpMap=s}if(i){var c=a.load("textures/"+e+"specular.jpg");c.minFilter=x.LinearFilter,n.specularMap=c}return n}function p(e){return e[d(0,e.length)]}function d(e,t){return Math.floor(Math.random()*(t-e))+e}function f(e,t){for(var r=[];r.length<t;){var i=p(e);r.indexOf(i)===-1&&r.push(i)}return r}Object.defineProperty(t,"__esModule",{value:!0}),t.genYinYang2=t.genYinYang1=t.genYarn=t.genDragonfly=t.genButterfly4=t.genGoggles=t.genMoth3=t.genButterfly3=t.genMoth2=t.genMoth1=t.genBumblebee=t.genButterFly2=t.genButterFly1=void 0;var m=function(){function e(e,t){var r=[],i=!0,n=!1,a=void 0;try{for(var o,s=e[Symbol.iterator]();!(i=(o=s.next()).done)&&(r.push(o.value),!t||r.length!==t);i=!0);}catch(c){n=!0,a=c}finally{try{!i&&s["return"]&&s["return"]()}finally{if(n)throw a}}return r}return function(t,r){if(Array.isArray(t))return t;if(Symbol.iterator in Object(t))return e(t,r);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}(),g=function(){function e(e,t){for(var r=0;r<t.length;r++){var i=t[r];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,r,i){return r&&e(t.prototype,r),i&&e(t,i),t}}();t.genSolarSystem=a,t.gen2Bodies=o,t.gen3Bodies=s,t.genBodies=c,t.genBodiesRot=h,t.getRandomInt=d;var v=r(2),y=i(v),x=r(3),b=x.Vector3,_={solar:["sun","mercury","venus","earth","moon","mars","jupiter","saturn","uranus","neptune","pluto"],balls:["tennisball","softball"]};_.all=_.solar.concat(_.balls);var M=function(){function e(t,r,i,a,o,s){n(this,e),this.m=t,this.r=r,this.v=i,this.rad=a,this.texture=o,this.rot=s}return g(e,[{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(e,t){return this.r=e,this.v=t,this}},{key:"clone",value:function(){return new e(this.m,this.r,this.v,this.rad,this.texture,this.rot)}}]),e}();t["default"]=M;var w={sun:u("sun",!0,!1,!1),mercury:u("mercury",!0,!0,!1),venus:u("venus",!0,!0,!1),earth:u("earth",!0,!0,!0),mars:u("mars",!0,!0,!1),moon:u("moon",!0,!0,!1),jupiter:u("jupiter",!0,!1,!1),saturn:u("saturn",!0,!1,!1),uranus:u("uranus",!0,!1,!1),neptune:u("neptune",!0,!1,!1),pluto:u("pluto",!0,!0,!1),tennisball:u("tennisball",!0,!0,!0),softball:u("softball",!0,!0,!1)},S=function(){return Math.random()/30};t.genButterFly1=l(.30689,.12551),t.genButterFly2=l(.39295,.09758),t.genBumblebee=l(.18428,.58719),t.genMoth1=l(.46444,.39606),t.genMoth2=l(.43917,.45297),t.genButterfly3=l(.40592,.23016),t.genMoth3=l(.38344,.37736),t.genGoggles=l(.0833,.12789),t.genButterfly4=l(.350112,.07934),t.genDragonfly=l(.08058,.58884),t.genYarn=l(.55906,.34919),t.genYinYang1=l(.51394,.30474),t.genYinYang2=l(.41682,.33033)},function(e,t,r){"use strict";function i(e){return e&&e.__esModule?e:{"default":e}}function n(e,t){for(var r=new g(0,0,0),i=0;i<t.length;i++)if(i!==e){var n=t[i].r.clone().sub(t[e].r),a=v*t[i].m/Math.pow(n.length(),3);r.add(n.multiplyScalar(a))}return r}function a(e,t){for(var r=[],i=0;i<e.length;i++){var a=e[i].r.clone().add(e[i].v.clone().multiplyScalar(t)),o=e[i].v.clone().add(n(i,e).multiplyScalar(t));r.push(e[i].clone().set(a,o))}return r}function o(e,t){for(var r=[],i=0;i<e.length;i++){var a=e[i].v.clone().add(n(i,e).multiplyScalar(t)),o=e[i].r.clone().add(a.clone().multiplyScalar(t));r.push(e[i].clone().set(o,a))}return r}function s(e,t){for(var r=0;r<e.length;r++)e[r].v.add(n(r,e).multiplyScalar(.5*t));return e}function c(e,t){for(var r=0;r<e.length;r++)e[r].r.add(e[r].v.clone().multiplyScalar(t));for(var i=0;i<e.length;i++)e[i].v.add(n(i,e).multiplyScalar(t));return e}function h(e){for(var t=new g(0,0,0),r=0,i=0;i<e.length;i++)t.add(e[i].r.clone().multiplyScalar(e[i].m)),r+=e[i].m;return t.divideScalar(r)}function l(e,t,r,i){for(var n=h(e),a=0;a<e.length;a++){var o=e[a].r.clone(),s=new g(0,0,0);s.subVectors(o,n),s.length()>i&&(e.splice(a,1),r.remove(t[a]),t.splice(a,1))}return[e,t]}function u(e,t){var r=new g(0,0,0);return r.subVectors(e.r,t.r),r.length()<=e.rad+t.rad}function p(e,t){var r=new g(0,0,0),i=new g(0,0,0);return r.subVectors(e.r,t.r),i.subVectors(e.v,t.v),i.dot(r)<0}function d(e,t){var r=e.m,i=t.m,n=e.v.clone(),a=t.v.clone(),o=new g(0,0,0),s=new g(0,0,0),c=e.r.clone(),h=t.r.clone(),l=new g(0,0,0),u=new g(0,0,0),p=new g(0,0,0),d=new g(0,0,0);o.subVectors(n,a),s.subVectors(a,n),l.subVectors(c,h),u.subVectors(h,c),p.subVectors(n,l.multiplyScalar(o.dot(l)/l.lengthSq()*(2*i/(r+i)))),d.subVectors(a,u.multiplyScalar(s.dot(u)/u.lengthSq()*(2*r/(r+i)))),e.v=p,t.v=d}function f(e,t,r,i,n){var a=void 0,o=void 0;i.m>n.m?(a=i,o=n,console.log("merge!")):(a=n,o=i,console.log("merge!")),a.m+=o.m,a.rad+=2,e.splice(e.indexOf(o),1),r.remove(t[e.indexOf(o)]),t.splice(e.indexOf(o),1),console.log("merge!")}Object.defineProperty(t,"__esModule",{value:!0}),t.G=void 0,t.accel=n,t.euler=a,t.symplectic_euler=o,t.leapfrog_initial=s,t.leapfrog=c,t.getGravCenter=h,t.removeLostBodies=l,t.touch=u,t.checkBodiesApproach=p,t.elasticCollision=d,t.mergeCollision=f;var m=r(1),g=(i(m),r(3).Vector3),v=t.G=6.67408e-11},function(e,t,r){var i,n,a={REVISION:"78"};i=a,n="function"==typeof i?i.call(t,r,t,e):i,!(void 0!==n&&(e.exports=n)),void 0===Number.EPSILON&&(Number.EPSILON=Math.pow(2,-52)),void 0===Math.sign&&(Math.sign=function(e){return e<0?-1:e>0?1:+e}),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(e){"use strict";if(void 0===e||null===e)throw new TypeError("Cannot convert undefined or null to object");for(var t=Object(e),r=1;r<arguments.length;r++){var i=arguments[r];if(void 0!==i&&null!==i)for(var n in i)Object.prototype.hasOwnProperty.call(i,n)&&(t[n]=i[n])}return t}}(),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(e,t,r){return void 0===t&&void 0===r?this.set(e):this.setRGB(e,t,r)},a.Color.prototype={constructor:a.Color,r:1,g:1,b:1,set:function(e){return e instanceof a.Color?this.copy(e):"number"==typeof e?this.setHex(e):"string"==typeof e&&this.setStyle(e),this},setScalar:function(e){this.r=e,this.g=e,this.b=e},setHex:function(e){return e=Math.floor(e),this.r=(e>>16&255)/255,this.g=(e>>8&255)/255,this.b=(255&e)/255,this},setRGB:function(e,t,r){return this.r=e,this.g=t,this.b=r,this},setHSL:function(){function e(e,t,r){return r<0&&(r+=1),r>1&&(r-=1),r<1/6?e+6*(t-e)*r:r<.5?t:r<2/3?e+6*(t-e)*(2/3-r):e}return function(t,r,i){if(t=a.Math.euclideanModulo(t,1),r=a.Math.clamp(r,0,1),i=a.Math.clamp(i,0,1),0===r)this.r=this.g=this.b=i;else{var n=i<=.5?i*(1+r):i+r-i*r,o=2*i-n;this.r=e(o,n,t+1/3),this.g=e(o,n,t),this.b=e(o,n,t-1/3)}return this}}(),setStyle:function(e){function t(t){void 0!==t&&parseFloat(t)<1&&console.warn("THREE.Color: Alpha component of "+e+" will be ignored.")}var r;if(r=/^((?:rgb|hsl)a?)\(\s*([^\)]*)\)/.exec(e)){var i,n=r[1],o=r[2];switch(n){case"rgb":case"rgba":if(i=/^(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(,\s*([0-9]*\.?[0-9]+)\s*)?$/.exec(o))return this.r=Math.min(255,parseInt(i[1],10))/255,this.g=Math.min(255,parseInt(i[2],10))/255,this.b=Math.min(255,parseInt(i[3],10))/255,t(i[5]),this;if(i=/^(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(,\s*([0-9]*\.?[0-9]+)\s*)?$/.exec(o))return this.r=Math.min(100,parseInt(i[1],10))/100,this.g=Math.min(100,parseInt(i[2],10))/100,this.b=Math.min(100,parseInt(i[3],10))/100,t(i[5]),this;break;case"hsl":case"hsla":if(i=/^([0-9]*\.?[0-9]+)\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(,\s*([0-9]*\.?[0-9]+)\s*)?$/.exec(o)){var s=parseFloat(i[1])/360,c=parseInt(i[2],10)/100,h=parseInt(i[3],10)/100;return t(i[5]),this.setHSL(s,c,h)}}}else if(r=/^\#([A-Fa-f0-9]+)$/.exec(e)){var l=r[1],u=l.length;if(3===u)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===u)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(e&&e.length>0){var l=a.ColorKeywords[e];void 0!==l?this.setHex(l):console.warn("THREE.Color: Unknown color "+e)}return this},clone:function(){return new this.constructor(this.r,this.g,this.b)},copy:function(e){return this.r=e.r,this.g=e.g,this.b=e.b,this},copyGammaToLinear:function(e,t){return void 0===t&&(t=2),this.r=Math.pow(e.r,t),this.g=Math.pow(e.g,t),this.b=Math.pow(e.b,t),this},copyLinearToGamma:function(e,t){void 0===t&&(t=2);var r=t>0?1/t:1;return this.r=Math.pow(e.r,r),this.g=Math.pow(e.g,r),this.b=Math.pow(e.b,r),this},convertGammaToLinear:function(){var e=this.r,t=this.g,r=this.b;return this.r=e*e,this.g=t*t,this.b=r*r,this},convertLinearToGamma:function(){return this.r=Math.sqrt(this.r),this.g=Math.sqrt(this.g),this.b=Math.sqrt(this.b),this},getHex:function(){return 255*this.r<<16^255*this.g<<8^255*this.b<<0},getHexString:function(){return("000000"+this.getHex().toString(16)).slice(-6)},getHSL:function(e){var t,r,i=e||{h:0,s:0,l:0},n=this.r,a=this.g,o=this.b,s=Math.max(n,a,o),c=Math.min(n,a,o),h=(c+s)/2;if(c===s)t=0,r=0;else{var l=s-c;switch(r=h<=.5?l/(s+c):l/(2-s-c),s){case n:t=(a-o)/l+(a<o?6:0);break;case a:t=(o-n)/l+2;break;case o:t=(n-a)/l+4}t/=6}return i.h=t,i.s=r,i.l=h,i},getStyle:function(){return"rgb("+(255*this.r|0)+","+(255*this.g|0)+","+(255*this.b|0)+")"},offsetHSL:function(e,t,r){var i=this.getHSL();return i.h+=e,i.s+=t,i.l+=r,this.setHSL(i.h,i.s,i.l),this},add:function(e){return this.r+=e.r,this.g+=e.g,this.b+=e.b,this},addColors:function(e,t){return this.r=e.r+t.r,this.g=e.g+t.g,this.b=e.b+t.b,this},addScalar:function(e){return this.r+=e,this.g+=e,this.b+=e,this},multiply:function(e){return this.r*=e.r,this.g*=e.g,this.b*=e.b,this},multiplyScalar:function(e){return this.r*=e,this.g*=e,this.b*=e,this},lerp:function(e,t){return this.r+=(e.r-this.r)*t,this.g+=(e.g-this.g)*t,this.b+=(e.b-this.b)*t,this},equals:function(e){return e.r===this.r&&e.g===this.g&&e.b===this.b},fromArray:function(e,t){return void 0===t&&(t=0),this.r=e[t],this.g=e[t+1],this.b=e[t+2],this},toArray:function(e,t){return void 0===e&&(e=[]),void 0===t&&(t=0),e[t]=this.r,e[t+1]=this.g,e[t+2]=this.b,e}},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(e,t,r,i){this._x=e||0,this._y=t||0,this._z=r||0,this._w=void 0!==i?i:1},a.Quaternion.prototype={constructor:a.Quaternion,get x(){return this._x},set x(e){this._x=e,this.onChangeCallback()},get y(){return this._y},set y(e){this._y=e,this.onChangeCallback()},get z(){return this._z},set z(e){this._z=e,this.onChangeCallback()},get w(){return this._w},set w(e){this._w=e,this.onChangeCallback()},set:function(e,t,r,i){return this._x=e,this._y=t,this._z=r,this._w=i,this.onChangeCallback(),this},clone:function(){return new this.constructor(this._x,this._y,this._z,this._w)},copy:function(e){return this._x=e.x,this._y=e.y,this._z=e.z,this._w=e.w,this.onChangeCallback(),this},setFromEuler:function(e,t){if(e instanceof a.Euler==!1)throw new Error("THREE.Quaternion: .setFromEuler() now expects a Euler rotation rather than a Vector3 and order.");var r=Math.cos(e._x/2),i=Math.cos(e._y/2),n=Math.cos(e._z/2),o=Math.sin(e._x/2),s=Math.sin(e._y/2),c=Math.sin(e._z/2),h=e.order;return"XYZ"===h?(this._x=o*i*n+r*s*c,this._y=r*s*n-o*i*c,this._z=r*i*c+o*s*n,this._w=r*i*n-o*s*c):"YXZ"===h?(this._x=o*i*n+r*s*c,this._y=r*s*n-o*i*c,this._z=r*i*c-o*s*n,this._w=r*i*n+o*s*c):"ZXY"===h?(this._x=o*i*n-r*s*c,this._y=r*s*n+o*i*c,this._z=r*i*c+o*s*n,this._w=r*i*n-o*s*c):"ZYX"===h?(this._x=o*i*n-r*s*c,this._y=r*s*n+o*i*c,this._z=r*i*c-o*s*n,this._w=r*i*n+o*s*c):"YZX"===h?(this._x=o*i*n+r*s*c,this._y=r*s*n+o*i*c,this._z=r*i*c-o*s*n,this._w=r*i*n-o*s*c):"XZY"===h&&(this._x=o*i*n-r*s*c,this._y=r*s*n-o*i*c,this._z=r*i*c+o*s*n,this._w=r*i*n+o*s*c),t!==!1&&this.onChangeCallback(),this},setFromAxisAngle:function(e,t){var r=t/2,i=Math.sin(r);return this._x=e.x*i,this._y=e.y*i,this._z=e.z*i,this._w=Math.cos(r),this.onChangeCallback(),this},setFromRotationMatrix:function(e){var t,r=e.elements,i=r[0],n=r[4],a=r[8],o=r[1],s=r[5],c=r[9],h=r[2],l=r[6],u=r[10],p=i+s+u;return p>0?(t=.5/Math.sqrt(p+1),this._w=.25/t,this._x=(l-c)*t,this._y=(a-h)*t,this._z=(o-n)*t):i>s&&i>u?(t=2*Math.sqrt(1+i-s-u),this._w=(l-c)/t,this._x=.25*t,this._y=(n+o)/t,this._z=(a+h)/t):s>u?(t=2*Math.sqrt(1+s-i-u),this._w=(a-h)/t,this._x=(n+o)/t,this._y=.25*t,this._z=(c+l)/t):(t=2*Math.sqrt(1+u-i-s),this._w=(o-n)/t,this._x=(a+h)/t,this._y=(c+l)/t,this._z=.25*t),this.onChangeCallback(),this},setFromUnitVectors:function(){var e,t,r=1e-6;return function(i,n){return void 0===e&&(e=new a.Vector3),t=i.dot(n)+1,t<r?(t=0,Math.abs(i.x)>Math.abs(i.z)?e.set(-i.y,i.x,0):e.set(0,-i.z,i.y)):e.crossVectors(i,n),this._x=e.x,this._y=e.y,this._z=e.z,this._w=t,this.normalize()}}(),inverse:function(){return this.conjugate().normalize()},conjugate:function(){return this._x*=-1,this._y*=-1,this._z*=-1,this.onChangeCallback(),this},dot:function(e){return this._x*e._x+this._y*e._y+this._z*e._z+this._w*e._w},lengthSq:function(){return this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w},length:function(){return Math.sqrt(this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w)},normalize:function(){var e=this.length();return 0===e?(this._x=0,this._y=0,this._z=0,this._w=1):(e=1/e,this._x=this._x*e,this._y=this._y*e,this._z=this._z*e,this._w=this._w*e),this.onChangeCallback(),this},multiply:function(e,t){return void 0!==t?(console.warn("THREE.Quaternion: .multiply() now only accepts one argument. Use .multiplyQuaternions( a, b ) instead."),this.multiplyQuaternions(e,t)):this.multiplyQuaternions(this,e)},premultiply:function(e){return this.multiplyQuaternions(e,this)},multiplyQuaternions:function(e,t){var r=e._x,i=e._y,n=e._z,a=e._w,o=t._x,s=t._y,c=t._z,h=t._w;return this._x=r*h+a*o+i*c-n*s,this._y=i*h+a*s+n*o-r*c,this._z=n*h+a*c+r*s-i*o,this._w=a*h-r*o-i*s-n*c,this.onChangeCallback(),this},slerp:function(e,t){if(0===t)return this;if(1===t)return this.copy(e);var r=this._x,i=this._y,n=this._z,a=this._w,o=a*e._w+r*e._x+i*e._y+n*e._z;if(o<0?(this._w=-e._w,this._x=-e._x,this._y=-e._y,this._z=-e._z,o=-o):this.copy(e),o>=1)return this._w=a,this._x=r,this._y=i,this._z=n,this;var s=Math.sqrt(1-o*o);if(Math.abs(s)<.001)return this._w=.5*(a+this._w),this._x=.5*(r+this._x),this._y=.5*(i+this._y),this._z=.5*(n+this._z),this;var c=Math.atan2(s,o),h=Math.sin((1-t)*c)/s,l=Math.sin(t*c)/s;return this._w=a*h+this._w*l,this._x=r*h+this._x*l,this._y=i*h+this._y*l,this._z=n*h+this._z*l,this.onChangeCallback(),this},equals:function(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._w===this._w},fromArray:function(e,t){return void 0===t&&(t=0),this._x=e[t],this._y=e[t+1],this._z=e[t+2],this._w=e[t+3],this.onChangeCallback(),this},toArray:function(e,t){return void 0===e&&(e=[]),void 0===t&&(t=0),e[t]=this._x,e[t+1]=this._y,e[t+2]=this._z,e[t+3]=this._w,e},onChange:function(e){return this.onChangeCallback=e,this},onChangeCallback:function(){}},Object.assign(a.Quaternion,{slerp:function(e,t,r,i){return r.copy(e).slerp(t,i)},slerpFlat:function(e,t,r,i,n,a,o){var s=r[i+0],c=r[i+1],h=r[i+2],l=r[i+3],u=n[a+0],p=n[a+1],d=n[a+2],f=n[a+3];if(l!==f||s!==u||c!==p||h!==d){var m=1-o,g=s*u+c*p+h*d+l*f,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 _=o*v;if(s=s*m+u*_,c=c*m+p*_,h=h*m+d*_,l=l*m+f*_,m===1-o){var M=1/Math.sqrt(s*s+c*c+h*h+l*l);s*=M,c*=M,h*=M,l*=M}}e[t]=s,e[t+1]=c,e[t+2]=h,e[t+3]=l}}),a.Vector2=function(e,t){this.x=e||0,this.y=t||0},a.Vector2.prototype={constructor:a.Vector2,get width(){return this.x},set width(e){this.x=e},get height(){return this.y},set height(e){this.y=e},set:function(e,t){return this.x=e,this.y=t,this},setScalar:function(e){return this.x=e,this.y=e,this},setX:function(e){return this.x=e,this},setY:function(e){return this.y=e,this},setComponent:function(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;default:throw new Error("index is out of range: "+e)}},getComponent:function(e){switch(e){case 0:return this.x;case 1:return this.y;default:throw new Error("index is out of range: "+e)}},clone:function(){return new this.constructor(this.x,this.y)},copy:function(e){return this.x=e.x,this.y=e.y,this},add:function(e,t){return void 0!==t?(console.warn("THREE.Vector2: .add() now only accepts one argument. Use .addVectors( a, b ) instead."),this.addVectors(e,t)):(this.x+=e.x,this.y+=e.y,this)},addScalar:function(e){return this.x+=e,this.y+=e,this},addVectors:function(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this},addScaledVector:function(e,t){return this.x+=e.x*t,this.y+=e.y*t,this},sub:function(e,t){return void 0!==t?(console.warn("THREE.Vector2: .sub() now only accepts one argument. Use .subVectors( a, b ) instead."),this.subVectors(e,t)):(this.x-=e.x,this.y-=e.y,this)},subScalar:function(e){return this.x-=e,this.y-=e,this},subVectors:function(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this},multiply:function(e){return this.x*=e.x,this.y*=e.y,this},multiplyScalar:function(e){return isFinite(e)?(this.x*=e,this.y*=e):(this.x=0,this.y=0),this},divide:function(e){return this.x/=e.x,this.y/=e.y,this},divideScalar:function(e){return this.multiplyScalar(1/e)},min:function(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this},max:function(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this},clamp:function(e,t){return this.x=Math.max(e.x,Math.min(t.x,this.x)),this.y=Math.max(e.y,Math.min(t.y,this.y)),this},clampScalar:function(){var e,t;return function(r,i){return void 0===e&&(e=new a.Vector2,t=new a.Vector2),e.set(r,r),t.set(i,i),this.clamp(e,t)}}(),clampLength:function(e,t){var r=this.length();return this.multiplyScalar(Math.max(e,Math.min(t,r))/r)},floor:function(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this},ceil:function(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this},round:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this},roundToZero:function(){return this.x=this.x<0?Math.ceil(this.x):Math.floor(this.x),this.y=this.y<0?Math.ceil(this.y):Math.floor(this.y),this},negate:function(){return this.x=-this.x,this.y=-this.y,this},dot:function(e){return this.x*e.x+this.y*e.y},lengthSq:function(){return this.x*this.x+this.y*this.y},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y)},lengthManhattan:function(){return Math.abs(this.x)+Math.abs(this.y)},normalize:function(){return this.divideScalar(this.length())},angle:function(){var e=Math.atan2(this.y,this.x);return e<0&&(e+=2*Math.PI),e},distanceTo:function(e){return Math.sqrt(this.distanceToSquared(e))},distanceToSquared:function(e){var t=this.x-e.x,r=this.y-e.y;return t*t+r*r},setLength:function(e){return this.multiplyScalar(e/this.length())},lerp:function(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this},lerpVectors:function(e,t,r){return this.subVectors(t,e).multiplyScalar(r).add(e)},equals:function(e){return e.x===this.x&&e.y===this.y},fromArray:function(e,t){return void 0===t&&(t=0),this.x=e[t],this.y=e[t+1],this},toArray:function(e,t){return void 0===e&&(e=[]),void 0===t&&(t=0),e[t]=this.x,e[t+1]=this.y,e},fromAttribute:function(e,t,r){return void 0===r&&(r=0),t=t*e.itemSize+r,this.x=e.array[t],this.y=e.array[t+1],this},rotateAround:function(e,t){var r=Math.cos(t),i=Math.sin(t),n=this.x-e.x,a=this.y-e.y;return this.x=n*r-a*i+e.x,this.y=n*i+a*r+e.y,this}},a.Vector3=function(e,t,r){this.x=e||0,this.y=t||0,this.z=r||0},a.Vector3.prototype={constructor:a.Vector3,set:function(e,t,r){return this.x=e,this.y=t,this.z=r,this},setScalar:function(e){return this.x=e,this.y=e,this.z=e,this},setX:function(e){return this.x=e,this},setY:function(e){return this.y=e,this},setZ:function(e){return this.z=e,this},setComponent:function(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;case 2:this.z=t;break;default:throw new Error("index is out of range: "+e)}},getComponent:function(e){switch(e){case 0:return this.x;case 1:return this.y;case 2:return this.z;default:throw new Error("index is out of range: "+e)}},clone:function(){return new this.constructor(this.x,this.y,this.z)},copy:function(e){return this.x=e.x,this.y=e.y,this.z=e.z,this},add:function(e,t){return void 0!==t?(console.warn("THREE.Vector3: .add() now only accepts one argument. Use .addVectors( a, b ) instead."),this.addVectors(e,t)):(this.x+=e.x,this.y+=e.y,this.z+=e.z,this)},addScalar:function(e){return this.x+=e,this.y+=e,this.z+=e,this},addVectors:function(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this.z=e.z+t.z,this},addScaledVector:function(e,t){return this.x+=e.x*t,this.y+=e.y*t,this.z+=e.z*t,this},sub:function(e,t){return void 0!==t?(console.warn("THREE.Vector3: .sub() now only accepts one argument. Use .subVectors( a, b ) instead."),
+this.subVectors(e,t)):(this.x-=e.x,this.y-=e.y,this.z-=e.z,this)},subScalar:function(e){return this.x-=e,this.y-=e,this.z-=e,this},subVectors:function(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this.z=e.z-t.z,this},multiply:function(e,t){return void 0!==t?(console.warn("THREE.Vector3: .multiply() now only accepts one argument. Use .multiplyVectors( a, b ) instead."),this.multiplyVectors(e,t)):(this.x*=e.x,this.y*=e.y,this.z*=e.z,this)},multiplyScalar:function(e){return isFinite(e)?(this.x*=e,this.y*=e,this.z*=e):(this.x=0,this.y=0,this.z=0),this},multiplyVectors:function(e,t){return this.x=e.x*t.x,this.y=e.y*t.y,this.z=e.z*t.z,this},applyEuler:function(){var e;return function(t){return t instanceof a.Euler==!1&&console.error("THREE.Vector3: .applyEuler() now expects an Euler rotation rather than a Vector3 and order."),void 0===e&&(e=new a.Quaternion),this.applyQuaternion(e.setFromEuler(t))}}(),applyAxisAngle:function(){var e;return function(t,r){return void 0===e&&(e=new a.Quaternion),this.applyQuaternion(e.setFromAxisAngle(t,r))}}(),applyMatrix3:function(e){var t=this.x,r=this.y,i=this.z,n=e.elements;return this.x=n[0]*t+n[3]*r+n[6]*i,this.y=n[1]*t+n[4]*r+n[7]*i,this.z=n[2]*t+n[5]*r+n[8]*i,this},applyMatrix4:function(e){var t=this.x,r=this.y,i=this.z,n=e.elements;return this.x=n[0]*t+n[4]*r+n[8]*i+n[12],this.y=n[1]*t+n[5]*r+n[9]*i+n[13],this.z=n[2]*t+n[6]*r+n[10]*i+n[14],this},applyProjection:function(e){var t=this.x,r=this.y,i=this.z,n=e.elements,a=1/(n[3]*t+n[7]*r+n[11]*i+n[15]);return this.x=(n[0]*t+n[4]*r+n[8]*i+n[12])*a,this.y=(n[1]*t+n[5]*r+n[9]*i+n[13])*a,this.z=(n[2]*t+n[6]*r+n[10]*i+n[14])*a,this},applyQuaternion:function(e){var t=this.x,r=this.y,i=this.z,n=e.x,a=e.y,o=e.z,s=e.w,c=s*t+a*i-o*r,h=s*r+o*t-n*i,l=s*i+n*r-a*t,u=-n*t-a*r-o*i;return this.x=c*s+u*-n+h*-o-l*-a,this.y=h*s+u*-a+l*-n-c*-o,this.z=l*s+u*-o+c*-a-h*-n,this},project:function(){var e;return function(t){return void 0===e&&(e=new a.Matrix4),e.multiplyMatrices(t.projectionMatrix,e.getInverse(t.matrixWorld)),this.applyProjection(e)}}(),unproject:function(){var e;return function(t){return void 0===e&&(e=new a.Matrix4),e.multiplyMatrices(t.matrixWorld,e.getInverse(t.projectionMatrix)),this.applyProjection(e)}}(),transformDirection:function(e){var t=this.x,r=this.y,i=this.z,n=e.elements;return this.x=n[0]*t+n[4]*r+n[8]*i,this.y=n[1]*t+n[5]*r+n[9]*i,this.z=n[2]*t+n[6]*r+n[10]*i,this.normalize()},divide:function(e){return this.x/=e.x,this.y/=e.y,this.z/=e.z,this},divideScalar:function(e){return this.multiplyScalar(1/e)},min:function(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this.z=Math.min(this.z,e.z),this},max:function(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this.z=Math.max(this.z,e.z),this},clamp:function(e,t){return this.x=Math.max(e.x,Math.min(t.x,this.x)),this.y=Math.max(e.y,Math.min(t.y,this.y)),this.z=Math.max(e.z,Math.min(t.z,this.z)),this},clampScalar:function(){var e,t;return function(r,i){return void 0===e&&(e=new a.Vector3,t=new a.Vector3),e.set(r,r,r),t.set(i,i,i),this.clamp(e,t)}}(),clampLength:function(e,t){var r=this.length();return this.multiplyScalar(Math.max(e,Math.min(t,r))/r)},floor:function(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this},ceil:function(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this},round:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this},roundToZero:function(){return this.x=this.x<0?Math.ceil(this.x):Math.floor(this.x),this.y=this.y<0?Math.ceil(this.y):Math.floor(this.y),this.z=this.z<0?Math.ceil(this.z):Math.floor(this.z),this},negate:function(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this},dot:function(e){return this.x*e.x+this.y*e.y+this.z*e.z},lengthSq:function(){return this.x*this.x+this.y*this.y+this.z*this.z},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)},lengthManhattan:function(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)},normalize:function(){return this.divideScalar(this.length())},setLength:function(e){return this.multiplyScalar(e/this.length())},lerp:function(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this.z+=(e.z-this.z)*t,this},lerpVectors:function(e,t,r){return this.subVectors(t,e).multiplyScalar(r).add(e)},cross:function(e,t){if(void 0!==t)return console.warn("THREE.Vector3: .cross() now only accepts one argument. Use .crossVectors( a, b ) instead."),this.crossVectors(e,t);var r=this.x,i=this.y,n=this.z;return this.x=i*e.z-n*e.y,this.y=n*e.x-r*e.z,this.z=r*e.y-i*e.x,this},crossVectors:function(e,t){var r=e.x,i=e.y,n=e.z,a=t.x,o=t.y,s=t.z;return this.x=i*s-n*o,this.y=n*a-r*s,this.z=r*o-i*a,this},projectOnVector:function(e){var t=e.dot(this)/e.lengthSq();return this.copy(e).multiplyScalar(t)},projectOnPlane:function(){var e;return function(t){return void 0===e&&(e=new a.Vector3),e.copy(this).projectOnVector(t),this.sub(e)}}(),reflect:function(){var e;return function(t){return void 0===e&&(e=new a.Vector3),this.sub(e.copy(t).multiplyScalar(2*this.dot(t)))}}(),angleTo:function(e){var t=this.dot(e)/Math.sqrt(this.lengthSq()*e.lengthSq());return Math.acos(a.Math.clamp(t,-1,1))},distanceTo:function(e){return Math.sqrt(this.distanceToSquared(e))},distanceToSquared:function(e){var t=this.x-e.x,r=this.y-e.y,i=this.z-e.z;return t*t+r*r+i*i},setFromSpherical:function(e){var t=Math.sin(e.phi)*e.radius;return this.x=t*Math.sin(e.theta),this.y=Math.cos(e.phi)*e.radius,this.z=t*Math.cos(e.theta),this},setFromMatrixPosition:function(e){return this.setFromMatrixColumn(e,3)},setFromMatrixScale:function(e){var t=this.setFromMatrixColumn(e,0).length(),r=this.setFromMatrixColumn(e,1).length(),i=this.setFromMatrixColumn(e,2).length();return this.x=t,this.y=r,this.z=i,this},setFromMatrixColumn:function(e,t){if("number"==typeof e){console.warn("THREE.Vector3: setFromMatrixColumn now expects ( matrix, index ).");var r=e;e=t,t=r}return this.fromArray(e.elements,4*t)},equals:function(e){return e.x===this.x&&e.y===this.y&&e.z===this.z},fromArray:function(e,t){return void 0===t&&(t=0),this.x=e[t],this.y=e[t+1],this.z=e[t+2],this},toArray:function(e,t){return void 0===e&&(e=[]),void 0===t&&(t=0),e[t]=this.x,e[t+1]=this.y,e[t+2]=this.z,e},fromAttribute:function(e,t,r){return void 0===r&&(r=0),t=t*e.itemSize+r,this.x=e.array[t],this.y=e.array[t+1],this.z=e.array[t+2],this}},a.Vector4=function(e,t,r,i){this.x=e||0,this.y=t||0,this.z=r||0,this.w=void 0!==i?i:1},a.Vector4.prototype={constructor:a.Vector4,set:function(e,t,r,i){return this.x=e,this.y=t,this.z=r,this.w=i,this},setScalar:function(e){return this.x=e,this.y=e,this.z=e,this.w=e,this},setX:function(e){return this.x=e,this},setY:function(e){return this.y=e,this},setZ:function(e){return this.z=e,this},setW:function(e){return this.w=e,this},setComponent:function(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;case 2:this.z=t;break;case 3:this.w=t;break;default:throw new Error("index is out of range: "+e)}},getComponent:function(e){switch(e){case 0:return this.x;case 1:return this.y;case 2:return this.z;case 3:return this.w;default:throw new Error("index is out of range: "+e)}},clone:function(){return new this.constructor(this.x,this.y,this.z,this.w)},copy:function(e){return this.x=e.x,this.y=e.y,this.z=e.z,this.w=void 0!==e.w?e.w:1,this},add:function(e,t){return void 0!==t?(console.warn("THREE.Vector4: .add() now only accepts one argument. Use .addVectors( a, b ) instead."),this.addVectors(e,t)):(this.x+=e.x,this.y+=e.y,this.z+=e.z,this.w+=e.w,this)},addScalar:function(e){return this.x+=e,this.y+=e,this.z+=e,this.w+=e,this},addVectors:function(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this.z=e.z+t.z,this.w=e.w+t.w,this},addScaledVector:function(e,t){return this.x+=e.x*t,this.y+=e.y*t,this.z+=e.z*t,this.w+=e.w*t,this},sub:function(e,t){return void 0!==t?(console.warn("THREE.Vector4: .sub() now only accepts one argument. Use .subVectors( a, b ) instead."),this.subVectors(e,t)):(this.x-=e.x,this.y-=e.y,this.z-=e.z,this.w-=e.w,this)},subScalar:function(e){return this.x-=e,this.y-=e,this.z-=e,this.w-=e,this},subVectors:function(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this.z=e.z-t.z,this.w=e.w-t.w,this},multiplyScalar:function(e){return isFinite(e)?(this.x*=e,this.y*=e,this.z*=e,this.w*=e):(this.x=0,this.y=0,this.z=0,this.w=0),this},applyMatrix4:function(e){var t=this.x,r=this.y,i=this.z,n=this.w,a=e.elements;return this.x=a[0]*t+a[4]*r+a[8]*i+a[12]*n,this.y=a[1]*t+a[5]*r+a[9]*i+a[13]*n,this.z=a[2]*t+a[6]*r+a[10]*i+a[14]*n,this.w=a[3]*t+a[7]*r+a[11]*i+a[15]*n,this},divideScalar:function(e){return this.multiplyScalar(1/e)},setAxisAngleFromQuaternion:function(e){this.w=2*Math.acos(e.w);var t=Math.sqrt(1-e.w*e.w);return t<1e-4?(this.x=1,this.y=0,this.z=0):(this.x=e.x/t,this.y=e.y/t,this.z=e.z/t),this},setAxisAngleFromRotationMatrix:function(e){var t,r,i,n,a=.01,o=.1,s=e.elements,c=s[0],h=s[4],l=s[8],u=s[1],p=s[5],d=s[9],f=s[2],m=s[6],g=s[10];if(Math.abs(h-u)<a&&Math.abs(l-f)<a&&Math.abs(d-m)<a){if(Math.abs(h+u)<o&&Math.abs(l+f)<o&&Math.abs(d+m)<o&&Math.abs(c+p+g-3)<o)return this.set(1,0,0,0),this;t=Math.PI;var v=(c+1)/2,y=(p+1)/2,x=(g+1)/2,b=(h+u)/4,_=(l+f)/4,M=(d+m)/4;return v>y&&v>x?v<a?(r=0,i=.707106781,n=.707106781):(r=Math.sqrt(v),i=b/r,n=_/r):y>x?y<a?(r=.707106781,i=0,n=.707106781):(i=Math.sqrt(y),r=b/i,n=M/i):x<a?(r=.707106781,i=.707106781,n=0):(n=Math.sqrt(x),r=_/n,i=M/n),this.set(r,i,n,t),this}var w=Math.sqrt((m-d)*(m-d)+(l-f)*(l-f)+(u-h)*(u-h));return Math.abs(w)<.001&&(w=1),this.x=(m-d)/w,this.y=(l-f)/w,this.z=(u-h)/w,this.w=Math.acos((c+p+g-1)/2),this},min:function(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this.z=Math.min(this.z,e.z),this.w=Math.min(this.w,e.w),this},max:function(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this.z=Math.max(this.z,e.z),this.w=Math.max(this.w,e.w),this},clamp:function(e,t){return this.x=Math.max(e.x,Math.min(t.x,this.x)),this.y=Math.max(e.y,Math.min(t.y,this.y)),this.z=Math.max(e.z,Math.min(t.z,this.z)),this.w=Math.max(e.w,Math.min(t.w,this.w)),this},clampScalar:function(){var e,t;return function(r,i){return void 0===e&&(e=new a.Vector4,t=new a.Vector4),e.set(r,r,r,r),t.set(i,i,i,i),this.clamp(e,t)}}(),floor:function(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this.w=Math.floor(this.w),this},ceil:function(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this.w=Math.ceil(this.w),this},round:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this.w=Math.round(this.w),this},roundToZero:function(){return this.x=this.x<0?Math.ceil(this.x):Math.floor(this.x),this.y=this.y<0?Math.ceil(this.y):Math.floor(this.y),this.z=this.z<0?Math.ceil(this.z):Math.floor(this.z),this.w=this.w<0?Math.ceil(this.w):Math.floor(this.w),this},negate:function(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this.w=-this.w,this},dot:function(e){return this.x*e.x+this.y*e.y+this.z*e.z+this.w*e.w},lengthSq:function(){return this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)},lengthManhattan:function(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)+Math.abs(this.w)},normalize:function(){return this.divideScalar(this.length())},setLength:function(e){return this.multiplyScalar(e/this.length())},lerp:function(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this.z+=(e.z-this.z)*t,this.w+=(e.w-this.w)*t,this},lerpVectors:function(e,t,r){return this.subVectors(t,e).multiplyScalar(r).add(e)},equals:function(e){return e.x===this.x&&e.y===this.y&&e.z===this.z&&e.w===this.w},fromArray:function(e,t){return void 0===t&&(t=0),this.x=e[t],this.y=e[t+1],this.z=e[t+2],this.w=e[t+3],this},toArray:function(e,t){return void 0===e&&(e=[]),void 0===t&&(t=0),e[t]=this.x,e[t+1]=this.y,e[t+2]=this.z,e[t+3]=this.w,e},fromAttribute:function(e,t,r){return void 0===r&&(r=0),t=t*e.itemSize+r,this.x=e.array[t],this.y=e.array[t+1],this.z=e.array[t+2],this.w=e.array[t+3],this}},a.Euler=function(e,t,r,i){this._x=e||0,this._y=t||0,this._z=r||0,this._order=i||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(e){this._x=e,this.onChangeCallback()},get y(){return this._y},set y(e){this._y=e,this.onChangeCallback()},get z(){return this._z},set z(e){this._z=e,this.onChangeCallback()},get order(){return this._order},set order(e){this._order=e,this.onChangeCallback()},set:function(e,t,r,i){return this._x=e,this._y=t,this._z=r,this._order=i||this._order,this.onChangeCallback(),this},clone:function(){return new this.constructor(this._x,this._y,this._z,this._order)},copy:function(e){return this._x=e._x,this._y=e._y,this._z=e._z,this._order=e._order,this.onChangeCallback(),this},setFromRotationMatrix:function(e,t,r){var i=a.Math.clamp,n=e.elements,o=n[0],s=n[4],c=n[8],h=n[1],l=n[5],u=n[9],p=n[2],d=n[6],f=n[10];return t=t||this._order,"XYZ"===t?(this._y=Math.asin(i(c,-1,1)),Math.abs(c)<.99999?(this._x=Math.atan2(-u,f),this._z=Math.atan2(-s,o)):(this._x=Math.atan2(d,l),this._z=0)):"YXZ"===t?(this._x=Math.asin(-i(u,-1,1)),Math.abs(u)<.99999?(this._y=Math.atan2(c,f),this._z=Math.atan2(h,l)):(this._y=Math.atan2(-p,o),this._z=0)):"ZXY"===t?(this._x=Math.asin(i(d,-1,1)),Math.abs(d)<.99999?(this._y=Math.atan2(-p,f),this._z=Math.atan2(-s,l)):(this._y=0,this._z=Math.atan2(h,o))):"ZYX"===t?(this._y=Math.asin(-i(p,-1,1)),Math.abs(p)<.99999?(this._x=Math.atan2(d,f),this._z=Math.atan2(h,o)):(this._x=0,this._z=Math.atan2(-s,l))):"YZX"===t?(this._z=Math.asin(i(h,-1,1)),Math.abs(h)<.99999?(this._x=Math.atan2(-u,l),this._y=Math.atan2(-p,o)):(this._x=0,this._y=Math.atan2(c,f))):"XZY"===t?(this._z=Math.asin(-i(s,-1,1)),Math.abs(s)<.99999?(this._x=Math.atan2(d,l),this._y=Math.atan2(c,o)):(this._x=Math.atan2(-u,f),this._y=0)):console.warn("THREE.Euler: .setFromRotationMatrix() given unsupported order: "+t),this._order=t,r!==!1&&this.onChangeCallback(),this},setFromQuaternion:function(){var e;return function(t,r,i){return void 0===e&&(e=new a.Matrix4),e.makeRotationFromQuaternion(t),this.setFromRotationMatrix(e,r,i)}}(),setFromVector3:function(e,t){return this.set(e.x,e.y,e.z,t||this._order)},reorder:function(){var e=new a.Quaternion;return function(t){return e.setFromEuler(this),this.setFromQuaternion(e,t)}}(),equals:function(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._order===this._order},fromArray:function(e){return this._x=e[0],this._y=e[1],this._z=e[2],void 0!==e[3]&&(this._order=e[3]),this.onChangeCallback(),this},toArray:function(e,t){return void 0===e&&(e=[]),void 0===t&&(t=0),e[t]=this._x,e[t+1]=this._y,e[t+2]=this._z,e[t+3]=this._order,e},toVector3:function(e){return e?e.set(this._x,this._y,this._z):new a.Vector3(this._x,this._y,this._z)},onChange:function(e){return this.onChangeCallback=e,this},onChangeCallback:function(){}},a.Line3=function(e,t){this.start=void 0!==e?e:new a.Vector3,this.end=void 0!==t?t:new a.Vector3},a.Line3.prototype={constructor:a.Line3,set:function(e,t){return this.start.copy(e),this.end.copy(t),this},clone:function(){return(new this.constructor).copy(this)},copy:function(e){return this.start.copy(e.start),this.end.copy(e.end),this},center:function(e){var t=e||new a.Vector3;return t.addVectors(this.start,this.end).multiplyScalar(.5)},delta:function(e){var t=e||new a.Vector3;return t.subVectors(this.end,this.start)},distanceSq:function(){return this.start.distanceToSquared(this.end)},distance:function(){return this.start.distanceTo(this.end)},at:function(e,t){var r=t||new a.Vector3;return this.delta(r).multiplyScalar(e).add(this.start)},closestPointToPointParameter:function(){var e=new a.Vector3,t=new a.Vector3;return function(r,i){e.subVectors(r,this.start),t.subVectors(this.end,this.start);var n=t.dot(t),o=t.dot(e),s=o/n;return i&&(s=a.Math.clamp(s,0,1)),s}}(),closestPointToPoint:function(e,t,r){var i=this.closestPointToPointParameter(e,t),n=r||new a.Vector3;return this.delta(n).multiplyScalar(i).add(this.start)},applyMatrix4:function(e){return this.start.applyMatrix4(e),this.end.applyMatrix4(e),this},equals:function(e){return e.start.equals(this.start)&&e.end.equals(this.end)}},a.Box2=function(e,t){this.min=void 0!==e?e:new a.Vector2((+(1/0)),(+(1/0))),this.max=void 0!==t?t:new a.Vector2((-(1/0)),(-(1/0)))},a.Box2.prototype={constructor:a.Box2,set:function(e,t){return this.min.copy(e),this.max.copy(t),this},setFromPoints:function(e){this.makeEmpty();for(var t=0,r=e.length;t<r;t++)this.expandByPoint(e[t]);return this},setFromCenterAndSize:function(){var e=new a.Vector2;return function(t,r){var i=e.copy(r).multiplyScalar(.5);return this.min.copy(t).sub(i),this.max.copy(t).add(i),this}}(),clone:function(){return(new this.constructor).copy(this)},copy:function(e){return this.min.copy(e.min),this.max.copy(e.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(e){var t=e||new a.Vector2;return t.addVectors(this.min,this.max).multiplyScalar(.5)},size:function(e){var t=e||new a.Vector2;return t.subVectors(this.max,this.min)},expandByPoint:function(e){return this.min.min(e),this.max.max(e),this},expandByVector:function(e){return this.min.sub(e),this.max.add(e),this},expandByScalar:function(e){return this.min.addScalar(-e),this.max.addScalar(e),this},containsPoint:function(e){return!(e.x<this.min.x||e.x>this.max.x||e.y<this.min.y||e.y>this.max.y)},containsBox:function(e){return this.min.x<=e.min.x&&e.max.x<=this.max.x&&this.min.y<=e.min.y&&e.max.y<=this.max.y},getParameter:function(e,t){var r=t||new a.Vector2;return r.set((e.x-this.min.x)/(this.max.x-this.min.x),(e.y-this.min.y)/(this.max.y-this.min.y))},intersectsBox:function(e){return!(e.max.x<this.min.x||e.min.x>this.max.x||e.max.y<this.min.y||e.min.y>this.max.y)},clampPoint:function(e,t){var r=t||new a.Vector2;return r.copy(e).clamp(this.min,this.max)},distanceToPoint:function(){var e=new a.Vector2;return function(t){var r=e.copy(t).clamp(this.min,this.max);return r.sub(t).length()}}(),intersect:function(e){return this.min.max(e.min),this.max.min(e.max),this},union:function(e){return this.min.min(e.min),this.max.max(e.max),this},translate:function(e){return this.min.add(e),this.max.add(e),this},equals:function(e){return e.min.equals(this.min)&&e.max.equals(this.max)}},a.Box3=function(e,t){this.min=void 0!==e?e:new a.Vector3((+(1/0)),(+(1/0)),(+(1/0))),this.max=void 0!==t?t:new a.Vector3((-(1/0)),(-(1/0)),(-(1/0)))},a.Box3.prototype={constructor:a.Box3,set:function(e,t){return this.min.copy(e),this.max.copy(t),this},setFromArray:function(e){for(var t=+(1/0),r=+(1/0),i=+(1/0),n=-(1/0),a=-(1/0),o=-(1/0),s=0,c=e.length;s<c;s+=3){var h=e[s],l=e[s+1],u=e[s+2];h<t&&(t=h),l<r&&(r=l),u<i&&(i=u),h>n&&(n=h),l>a&&(a=l),u>o&&(o=u)}this.min.set(t,r,i),this.max.set(n,a,o)},setFromPoints:function(e){this.makeEmpty();for(var t=0,r=e.length;t<r;t++)this.expandByPoint(e[t]);return this},setFromCenterAndSize:function(){var e=new a.Vector3;return function(t,r){var i=e.copy(r).multiplyScalar(.5);return this.min.copy(t).sub(i),this.max.copy(t).add(i),this}}(),setFromObject:function(){var e=new a.Vector3;return function(t){var r=this;return t.updateMatrixWorld(!0),this.makeEmpty(),t.traverse(function(t){var i=t.geometry;if(void 0!==i)if(i instanceof a.Geometry)for(var n=i.vertices,o=0,s=n.length;o<s;o++)e.copy(n[o]),e.applyMatrix4(t.matrixWorld),r.expandByPoint(e);else if(i instanceof a.BufferGeometry&&void 0!==i.attributes.position)for(var c=i.attributes.position.array,o=0,s=c.length;o<s;o+=3)e.fromArray(c,o),e.applyMatrix4(t.matrixWorld),r.expandByPoint(e)}),this}}(),clone:function(){return(new this.constructor).copy(this)},copy:function(e){return this.min.copy(e.min),this.max.copy(e.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(e){var t=e||new a.Vector3;return t.addVectors(this.min,this.max).multiplyScalar(.5)},size:function(e){var t=e||new a.Vector3;return t.subVectors(this.max,this.min)},expandByPoint:function(e){return this.min.min(e),this.max.max(e),this},expandByVector:function(e){return this.min.sub(e),this.max.add(e),this},expandByScalar:function(e){return this.min.addScalar(-e),this.max.addScalar(e),this},containsPoint:function(e){return!(e.x<this.min.x||e.x>this.max.x||e.y<this.min.y||e.y>this.max.y||e.z<this.min.z||e.z>this.max.z)},containsBox:function(e){return this.min.x<=e.min.x&&e.max.x<=this.max.x&&this.min.y<=e.min.y&&e.max.y<=this.max.y&&this.min.z<=e.min.z&&e.max.z<=this.max.z},getParameter:function(e,t){var r=t||new a.Vector3;return r.set((e.x-this.min.x)/(this.max.x-this.min.x),(e.y-this.min.y)/(this.max.y-this.min.y),(e.z-this.min.z)/(this.max.z-this.min.z))},intersectsBox:function(e){return!(e.max.x<this.min.x||e.min.x>this.max.x||e.max.y<this.min.y||e.min.y>this.max.y||e.max.z<this.min.z||e.min.z>this.max.z)},intersectsSphere:function(){var e;return function(t){return void 0===e&&(e=new a.Vector3),this.clampPoint(t.center,e),e.distanceToSquared(t.center)<=t.radius*t.radius}}(),intersectsPlane:function(e){var t,r;return e.normal.x>0?(t=e.normal.x*this.min.x,r=e.normal.x*this.max.x):(t=e.normal.x*this.max.x,r=e.normal.x*this.min.x),e.normal.y>0?(t+=e.normal.y*this.min.y,r+=e.normal.y*this.max.y):(t+=e.normal.y*this.max.y,r+=e.normal.y*this.min.y),e.normal.z>0?(t+=e.normal.z*this.min.z,r+=e.normal.z*this.max.z):(t+=e.normal.z*this.max.z,r+=e.normal.z*this.min.z),t<=e.constant&&r>=e.constant},clampPoint:function(e,t){var r=t||new a.Vector3;return r.copy(e).clamp(this.min,this.max)},distanceToPoint:function(){var e=new a.Vector3;return function(t){var r=e.copy(t).clamp(this.min,this.max);return r.sub(t).length()}}(),getBoundingSphere:function(){var e=new a.Vector3;return function(t){var r=t||new a.Sphere;return r.center=this.center(),r.radius=.5*this.size(e).length(),r}}(),intersect:function(e){return this.min.max(e.min),this.max.min(e.max),this.isEmpty()&&this.makeEmpty(),this},union:function(e){return this.min.min(e.min),this.max.max(e.max),this},applyMatrix4:function(){var e=[new 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(t){return this.isEmpty()?this:(e[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(t),e[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(t),e[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(t),e[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(t),e[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(t),e[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(t),e[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(t),e[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(t),this.setFromPoints(e),this)}}(),translate:function(e){return this.min.add(e),this.max.add(e),this},equals:function(e){return e.min.equals(this.min)&&e.max.equals(this.max)}},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(e,t,r,i,n,a,o,s,c){var h=this.elements;return h[0]=e,h[1]=i,h[2]=o,h[3]=t,h[4]=n,h[5]=s,h[6]=r,h[7]=a,h[8]=c,this},identity:function(){return this.set(1,0,0,0,1,0,0,0,1),this},clone:function(){return(new this.constructor).fromArray(this.elements)},copy:function(e){var t=e.elements;return this.set(t[0],t[3],t[6],t[1],t[4],t[7],t[2],t[5],t[8]),this},setFromMatrix4:function(e){var t=e.elements;return this.set(t[0],t[4],t[8],t[1],t[5],t[9],t[2],t[6],t[10]),this},applyToVector3Array:function(){var e;return function(t,r,i){void 0===e&&(e=new a.Vector3),void 0===r&&(r=0),void 0===i&&(i=t.length);for(var n=0,o=r;n<i;n+=3,o+=3)e.fromArray(t,o),e.applyMatrix3(this),e.toArray(t,o);return t}}(),applyToBuffer:function(){var e;return function(t,r,i){void 0===e&&(e=new a.Vector3),void 0===r&&(r=0),void 0===i&&(i=t.length/t.itemSize);for(var n=0,o=r;n<i;n++,o++)e.x=t.getX(o),e.y=t.getY(o),e.z=t.getZ(o),e.applyMatrix3(this),t.setXYZ(e.x,e.y,e.z);return t}}(),multiplyScalar:function(e){var t=this.elements;return t[0]*=e,t[3]*=e,t[6]*=e,t[1]*=e,t[4]*=e,t[7]*=e,t[2]*=e,t[5]*=e,t[8]*=e,this},determinant:function(){var e=this.elements,t=e[0],r=e[1],i=e[2],n=e[3],a=e[4],o=e[5],s=e[6],c=e[7],h=e[8];return t*a*h-t*o*c-r*n*h+r*o*s+i*n*c-i*a*s},getInverse:function(e,t){e instanceof a.Matrix4&&console.error("THREE.Matrix3.getInverse no longer takes a Matrix4 argument.");var r=e.elements,i=this.elements,n=r[0],o=r[1],s=r[2],c=r[3],h=r[4],l=r[5],u=r[6],p=r[7],d=r[8],f=d*h-l*p,m=l*u-d*c,g=p*c-h*u,v=n*f+o*m+s*g;if(0===v){var y="THREE.Matrix3.getInverse(): can't invert matrix, determinant is 0";if(t)throw new Error(y);return console.warn(y),this.identity()}var x=1/v;return i[0]=f*x,i[1]=(s*p-d*o)*x,i[2]=(l*o-s*h)*x,i[3]=m*x,i[4]=(d*n-s*u)*x,i[5]=(s*c-l*n)*x,i[6]=g*x,i[7]=(o*u-p*n)*x,i[8]=(h*n-o*c)*x,this},transpose:function(){var e,t=this.elements;return e=t[1],t[1]=t[3],t[3]=e,e=t[2],t[2]=t[6],t[6]=e,e=t[5],t[5]=t[7],t[7]=e,this},flattenToArrayOffset:function(e,t){return console.warn("THREE.Matrix3: .flattenToArrayOffset is deprecated - just use .toArray instead."),this.toArray(e,t)},getNormalMatrix:function(e){return this.setFromMatrix4(e).getInverse(this).transpose()},transposeIntoArray:function(e){var t=this.elements;return e[0]=t[0],e[1]=t[3],e[2]=t[6],e[3]=t[1],e[4]=t[4],e[5]=t[7],e[6]=t[2],e[7]=t[5],e[8]=t[8],this},fromArray:function(e){return this.elements.set(e),this},toArray:function(e,t){void 0===e&&(e=[]),void 0===t&&(t=0);var r=this.elements;return e[t]=r[0],e[t+1]=r[1],e[t+2]=r[2],e[t+3]=r[3],e[t+4]=r[4],e[t+5]=r[5],e[t+6]=r[6],e[t+7]=r[7],e[t+8]=r[8],e}},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(e,t,r,i,n,a,o,s,c,h,l,u,p,d,f,m){var g=this.elements;return g[0]=e,g[4]=t,g[8]=r,g[12]=i,g[1]=n,g[5]=a,g[9]=o,g[13]=s,g[2]=c,g[6]=h,g[10]=l,g[14]=u,g[3]=p,g[7]=d,g[11]=f,g[15]=m,this},identity:function(){return this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1),this},clone:function(){return(new a.Matrix4).fromArray(this.elements)},copy:function(e){return this.elements.set(e.elements),this},copyPosition:function(e){var t=this.elements,r=e.elements;return t[12]=r[12],t[13]=r[13],t[14]=r[14],this},extractBasis:function(e,t,r){return e.setFromMatrixColumn(this,0),t.setFromMatrixColumn(this,1),r.setFromMatrixColumn(this,2),this},makeBasis:function(e,t,r){return this.set(e.x,t.x,r.x,0,e.y,t.y,r.y,0,e.z,t.z,r.z,0,0,0,0,1),this},extractRotation:function(){var e;return function(t){void 0===e&&(e=new a.Vector3);var r=this.elements,i=t.elements,n=1/e.setFromMatrixColumn(t,0).length(),o=1/e.setFromMatrixColumn(t,1).length(),s=1/e.setFromMatrixColumn(t,2).length();return r[0]=i[0]*n,r[1]=i[1]*n,r[2]=i[2]*n,r[4]=i[4]*o,r[5]=i[5]*o,r[6]=i[6]*o,r[8]=i[8]*s,r[9]=i[9]*s,r[10]=i[10]*s,this}}(),makeRotationFromEuler:function(e){e instanceof a.Euler==!1&&console.error("THREE.Matrix: .makeRotationFromEuler() now expects a Euler rotation rather than a Vector3 and order.");var t=this.elements,r=e.x,i=e.y,n=e.z,o=Math.cos(r),s=Math.sin(r),c=Math.cos(i),h=Math.sin(i),l=Math.cos(n),u=Math.sin(n);if("XYZ"===e.order){var p=o*l,d=o*u,f=s*l,m=s*u;t[0]=c*l,t[4]=-c*u,t[8]=h,t[1]=d+f*h,t[5]=p-m*h,t[9]=-s*c,t[2]=m-p*h,t[6]=f+d*h,t[10]=o*c}else if("YXZ"===e.order){var g=c*l,v=c*u,y=h*l,x=h*u;t[0]=g+x*s,t[4]=y*s-v,t[8]=o*h,t[1]=o*u,t[5]=o*l,t[9]=-s,t[2]=v*s-y,t[6]=x+g*s,t[10]=o*c}else if("ZXY"===e.order){var g=c*l,v=c*u,y=h*l,x=h*u;t[0]=g-x*s,t[4]=-o*u,t[8]=y+v*s,t[1]=v+y*s,t[5]=o*l,t[9]=x-g*s,t[2]=-o*h,t[6]=s,t[10]=o*c}else if("ZYX"===e.order){var p=o*l,d=o*u,f=s*l,m=s*u;t[0]=c*l,t[4]=f*h-d,t[8]=p*h+m,t[1]=c*u,t[5]=m*h+p,t[9]=d*h-f,t[2]=-h,t[6]=s*c,t[10]=o*c}else if("YZX"===e.order){var b=o*c,_=o*h,M=s*c,w=s*h;t[0]=c*l,t[4]=w-b*u,t[8]=M*u+_,t[1]=u,t[5]=o*l,t[9]=-s*l,t[2]=-h*l,t[6]=_*u+M,t[10]=b-w*u}else if("XZY"===e.order){var b=o*c,_=o*h,M=s*c,w=s*h;t[0]=c*l,t[4]=-u,t[8]=h*l,t[1]=b*u+w,t[5]=o*l,t[9]=_*u-M,t[2]=M*u-_,t[6]=s*l,t[10]=w*u+b}return t[3]=0,t[7]=0,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this},makeRotationFromQuaternion:function(e){var t=this.elements,r=e.x,i=e.y,n=e.z,a=e.w,o=r+r,s=i+i,c=n+n,h=r*o,l=r*s,u=r*c,p=i*s,d=i*c,f=n*c,m=a*o,g=a*s,v=a*c;return t[0]=1-(p+f),t[4]=l-v,t[8]=u+g,t[1]=l+v,t[5]=1-(h+f),t[9]=d-m,t[2]=u-g,t[6]=d+m,t[10]=1-(h+p),t[3]=0,t[7]=0,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this},lookAt:function(){var e,t,r;return function(i,n,o){void 0===e&&(e=new a.Vector3,t=new a.Vector3,r=new a.Vector3);var s=this.elements;return r.subVectors(i,n).normalize(),0===r.lengthSq()&&(r.z=1),e.crossVectors(o,r).normalize(),0===e.lengthSq()&&(r.z+=1e-4,e.crossVectors(o,r).normalize()),t.crossVectors(r,e),s[0]=e.x,s[4]=t.x,s[8]=r.x,s[1]=e.y,s[5]=t.y,s[9]=r.y,s[2]=e.z,s[6]=t.z,s[10]=r.z,this}}(),multiply:function(e,t){return void 0!==t?(console.warn("THREE.Matrix4: .multiply() now only accepts one argument. Use .multiplyMatrices( a, b ) instead."),this.multiplyMatrices(e,t)):this.multiplyMatrices(this,e)},premultiply:function(e){return this.multiplyMatrices(e,this)},multiplyMatrices:function(e,t){var r=e.elements,i=t.elements,n=this.elements,a=r[0],o=r[4],s=r[8],c=r[12],h=r[1],l=r[5],u=r[9],p=r[13],d=r[2],f=r[6],m=r[10],g=r[14],v=r[3],y=r[7],x=r[11],b=r[15],_=i[0],M=i[4],w=i[8],S=i[12],E=i[1],T=i[5],A=i[9],L=i[13],C=i[2],R=i[6],P=i[10],B=i[14],U=i[3],I=i[7],D=i[11],F=i[15];return n[0]=a*_+o*E+s*C+c*U,n[4]=a*M+o*T+s*R+c*I,n[8]=a*w+o*A+s*P+c*D,n[12]=a*S+o*L+s*B+c*F,n[1]=h*_+l*E+u*C+p*U,n[5]=h*M+l*T+u*R+p*I,n[9]=h*w+l*A+u*P+p*D,n[13]=h*S+l*L+u*B+p*F,n[2]=d*_+f*E+m*C+g*U,n[6]=d*M+f*T+m*R+g*I,n[10]=d*w+f*A+m*P+g*D,n[14]=d*S+f*L+m*B+g*F,n[3]=v*_+y*E+x*C+b*U,n[7]=v*M+y*T+x*R+b*I,n[11]=v*w+y*A+x*P+b*D,n[15]=v*S+y*L+x*B+b*F,this},multiplyToArray:function(e,t,r){var i=this.elements;return this.multiplyMatrices(e,t),r[0]=i[0],r[1]=i[1],r[2]=i[2],r[3]=i[3],r[4]=i[4],r[5]=i[5],r[6]=i[6],r[7]=i[7],r[8]=i[8],r[9]=i[9],r[10]=i[10],r[11]=i[11],r[12]=i[12],r[13]=i[13],r[14]=i[14],r[15]=i[15],this},multiplyScalar:function(e){var t=this.elements;return t[0]*=e,t[4]*=e,t[8]*=e,t[12]*=e,t[1]*=e,t[5]*=e,t[9]*=e,t[13]*=e,t[2]*=e,t[6]*=e,t[10]*=e,t[14]*=e,t[3]*=e,t[7]*=e,t[11]*=e,t[15]*=e,this},applyToVector3Array:function(){var e;return function(t,r,i){void 0===e&&(e=new a.Vector3),void 0===r&&(r=0),void 0===i&&(i=t.length);for(var n=0,o=r;n<i;n+=3,o+=3)e.fromArray(t,o),e.applyMatrix4(this),e.toArray(t,o);return t}}(),applyToBuffer:function(){var e;return function(t,r,i){void 0===e&&(e=new a.Vector3),void 0===r&&(r=0),void 0===i&&(i=t.length/t.itemSize);for(var n=0,o=r;n<i;n++,o++)e.x=t.getX(o),e.y=t.getY(o),e.z=t.getZ(o),e.applyMatrix4(this),t.setXYZ(e.x,e.y,e.z);return t}}(),determinant:function(){var e=this.elements,t=e[0],r=e[4],i=e[8],n=e[12],a=e[1],o=e[5],s=e[9],c=e[13],h=e[2],l=e[6],u=e[10],p=e[14],d=e[3],f=e[7],m=e[11],g=e[15];return d*(+n*s*l-i*c*l-n*o*u+r*c*u+i*o*p-r*s*p)+f*(+t*s*p-t*c*u+n*a*u-i*a*p+i*c*h-n*s*h)+m*(+t*c*l-t*o*p-n*a*l+r*a*p+n*o*h-r*c*h)+g*(-i*o*h-t*s*l+t*o*u+i*a*l-r*a*u+r*s*h)},transpose:function(){var e,t=this.elements;return e=t[1],t[1]=t[4],t[4]=e,e=t[2],t[2]=t[8],t[8]=e,e=t[6],t[6]=t[9],t[9]=e,e=t[3],t[3]=t[12],t[12]=e,e=t[7],t[7]=t[13],t[13]=e,e=t[11],t[11]=t[14],t[14]=e,this},flattenToArrayOffset:function(e,t){return console.warn("THREE.Matrix3: .flattenToArrayOffset is deprecated - just use .toArray instead."),this.toArray(e,t)},getPosition:function(){
+var e;return function(){return void 0===e&&(e=new a.Vector3),console.warn("THREE.Matrix4: .getPosition() has been removed. Use Vector3.setFromMatrixPosition( matrix ) instead."),e.setFromMatrixColumn(this,3)}}(),setPosition:function(e){var t=this.elements;return t[12]=e.x,t[13]=e.y,t[14]=e.z,this},getInverse:function(e,t){var r=this.elements,i=e.elements,n=i[0],a=i[1],o=i[2],s=i[3],c=i[4],h=i[5],l=i[6],u=i[7],p=i[8],d=i[9],f=i[10],m=i[11],g=i[12],v=i[13],y=i[14],x=i[15],b=d*y*u-v*f*u+v*l*m-h*y*m-d*l*x+h*f*x,_=g*f*u-p*y*u-g*l*m+c*y*m+p*l*x-c*f*x,M=p*v*u-g*d*u+g*h*m-c*v*m-p*h*x+c*d*x,w=g*d*l-p*v*l-g*h*f+c*v*f+p*h*y-c*d*y,S=n*b+a*_+o*M+s*w;if(0===S){var E="THREE.Matrix4.getInverse(): can't invert matrix, determinant is 0";if(t)throw new Error(E);return console.warn(E),this.identity()}var T=1/S;return r[0]=b*T,r[1]=(v*f*s-d*y*s-v*o*m+a*y*m+d*o*x-a*f*x)*T,r[2]=(h*y*s-v*l*s+v*o*u-a*y*u-h*o*x+a*l*x)*T,r[3]=(d*l*s-h*f*s-d*o*u+a*f*u+h*o*m-a*l*m)*T,r[4]=_*T,r[5]=(p*y*s-g*f*s+g*o*m-n*y*m-p*o*x+n*f*x)*T,r[6]=(g*l*s-c*y*s-g*o*u+n*y*u+c*o*x-n*l*x)*T,r[7]=(c*f*s-p*l*s+p*o*u-n*f*u-c*o*m+n*l*m)*T,r[8]=M*T,r[9]=(g*d*s-p*v*s-g*a*m+n*v*m+p*a*x-n*d*x)*T,r[10]=(c*v*s-g*h*s+g*a*u-n*v*u-c*a*x+n*h*x)*T,r[11]=(p*h*s-c*d*s-p*a*u+n*d*u+c*a*m-n*h*m)*T,r[12]=w*T,r[13]=(p*v*o-g*d*o+g*a*f-n*v*f-p*a*y+n*d*y)*T,r[14]=(g*h*o-c*v*o-g*a*l+n*v*l+c*a*y-n*h*y)*T,r[15]=(c*d*o-p*h*o+p*a*l-n*d*l-c*a*f+n*h*f)*T,this},scale:function(e){var t=this.elements,r=e.x,i=e.y,n=e.z;return t[0]*=r,t[4]*=i,t[8]*=n,t[1]*=r,t[5]*=i,t[9]*=n,t[2]*=r,t[6]*=i,t[10]*=n,t[3]*=r,t[7]*=i,t[11]*=n,this},getMaxScaleOnAxis:function(){var e=this.elements,t=e[0]*e[0]+e[1]*e[1]+e[2]*e[2],r=e[4]*e[4]+e[5]*e[5]+e[6]*e[6],i=e[8]*e[8]+e[9]*e[9]+e[10]*e[10];return Math.sqrt(Math.max(t,r,i))},makeTranslation:function(e,t,r){return this.set(1,0,0,e,0,1,0,t,0,0,1,r,0,0,0,1),this},makeRotationX:function(e){var t=Math.cos(e),r=Math.sin(e);return this.set(1,0,0,0,0,t,-r,0,0,r,t,0,0,0,0,1),this},makeRotationY:function(e){var t=Math.cos(e),r=Math.sin(e);return this.set(t,0,r,0,0,1,0,0,-r,0,t,0,0,0,0,1),this},makeRotationZ:function(e){var t=Math.cos(e),r=Math.sin(e);return this.set(t,-r,0,0,r,t,0,0,0,0,1,0,0,0,0,1),this},makeRotationAxis:function(e,t){var r=Math.cos(t),i=Math.sin(t),n=1-r,a=e.x,o=e.y,s=e.z,c=n*a,h=n*o;return this.set(c*a+r,c*o-i*s,c*s+i*o,0,c*o+i*s,h*o+r,h*s-i*a,0,c*s-i*o,h*s+i*a,n*s*s+r,0,0,0,0,1),this},makeScale:function(e,t,r){return this.set(e,0,0,0,0,t,0,0,0,0,r,0,0,0,0,1),this},compose:function(e,t,r){return this.makeRotationFromQuaternion(t),this.scale(r),this.setPosition(e),this},decompose:function(){var e,t;return function(r,i,n){void 0===e&&(e=new a.Vector3,t=new a.Matrix4);var o=this.elements,s=e.set(o[0],o[1],o[2]).length(),c=e.set(o[4],o[5],o[6]).length(),h=e.set(o[8],o[9],o[10]).length(),l=this.determinant();l<0&&(s=-s),r.x=o[12],r.y=o[13],r.z=o[14],t.elements.set(this.elements);var u=1/s,p=1/c,d=1/h;return t.elements[0]*=u,t.elements[1]*=u,t.elements[2]*=u,t.elements[4]*=p,t.elements[5]*=p,t.elements[6]*=p,t.elements[8]*=d,t.elements[9]*=d,t.elements[10]*=d,i.setFromRotationMatrix(t),n.x=s,n.y=c,n.z=h,this}}(),makeFrustum:function(e,t,r,i,n,a){var o=this.elements,s=2*n/(t-e),c=2*n/(i-r),h=(t+e)/(t-e),l=(i+r)/(i-r),u=-(a+n)/(a-n),p=-2*a*n/(a-n);return o[0]=s,o[4]=0,o[8]=h,o[12]=0,o[1]=0,o[5]=c,o[9]=l,o[13]=0,o[2]=0,o[6]=0,o[10]=u,o[14]=p,o[3]=0,o[7]=0,o[11]=-1,o[15]=0,this},makePerspective:function(e,t,r,i){var n=r*Math.tan(a.Math.DEG2RAD*e*.5),o=-n,s=o*t,c=n*t;return this.makeFrustum(s,c,o,n,r,i)},makeOrthographic:function(e,t,r,i,n,a){var o=this.elements,s=1/(t-e),c=1/(r-i),h=1/(a-n),l=(t+e)*s,u=(r+i)*c,p=(a+n)*h;return o[0]=2*s,o[4]=0,o[8]=0,o[12]=-l,o[1]=0,o[5]=2*c,o[9]=0,o[13]=-u,o[2]=0,o[6]=0,o[10]=-2*h,o[14]=-p,o[3]=0,o[7]=0,o[11]=0,o[15]=1,this},equals:function(e){for(var t=this.elements,r=e.elements,i=0;i<16;i++)if(t[i]!==r[i])return!1;return!0},fromArray:function(e){return this.elements.set(e),this},toArray:function(e,t){void 0===e&&(e=[]),void 0===t&&(t=0);var r=this.elements;return e[t]=r[0],e[t+1]=r[1],e[t+2]=r[2],e[t+3]=r[3],e[t+4]=r[4],e[t+5]=r[5],e[t+6]=r[6],e[t+7]=r[7],e[t+8]=r[8],e[t+9]=r[9],e[t+10]=r[10],e[t+11]=r[11],e[t+12]=r[12],e[t+13]=r[13],e[t+14]=r[14],e[t+15]=r[15],e}},a.Ray=function(e,t){this.origin=void 0!==e?e:new a.Vector3,this.direction=void 0!==t?t:new a.Vector3},a.Ray.prototype={constructor:a.Ray,set:function(e,t){return this.origin.copy(e),this.direction.copy(t),this},clone:function(){return(new this.constructor).copy(this)},copy:function(e){return this.origin.copy(e.origin),this.direction.copy(e.direction),this},at:function(e,t){var r=t||new a.Vector3;return r.copy(this.direction).multiplyScalar(e).add(this.origin)},lookAt:function(e){return this.direction.copy(e).sub(this.origin).normalize(),this},recast:function(){var e=new a.Vector3;return function(t){return this.origin.copy(this.at(t,e)),this}}(),closestPointToPoint:function(e,t){var r=t||new a.Vector3;r.subVectors(e,this.origin);var i=r.dot(this.direction);return i<0?r.copy(this.origin):r.copy(this.direction).multiplyScalar(i).add(this.origin)},distanceToPoint:function(e){return Math.sqrt(this.distanceSqToPoint(e))},distanceSqToPoint:function(){var e=new a.Vector3;return function(t){var r=e.subVectors(t,this.origin).dot(this.direction);return r<0?this.origin.distanceToSquared(t):(e.copy(this.direction).multiplyScalar(r).add(this.origin),e.distanceToSquared(t))}}(),distanceSqToSegment:function(){var e=new a.Vector3,t=new a.Vector3,r=new a.Vector3;return function(i,n,a,o){e.copy(i).add(n).multiplyScalar(.5),t.copy(n).sub(i).normalize(),r.copy(this.origin).sub(e);var s,c,h,l,u=.5*i.distanceTo(n),p=-this.direction.dot(t),d=r.dot(this.direction),f=-r.dot(t),m=r.lengthSq(),g=Math.abs(1-p*p);if(g>0)if(s=p*f-d,c=p*d-f,l=u*g,s>=0)if(c>=-l)if(c<=l){var v=1/g;s*=v,c*=v,h=s*(s+p*c+2*d)+c*(p*s+c+2*f)+m}else c=u,s=Math.max(0,-(p*c+d)),h=-s*s+c*(c+2*f)+m;else c=-u,s=Math.max(0,-(p*c+d)),h=-s*s+c*(c+2*f)+m;else c<=-l?(s=Math.max(0,-(-p*u+d)),c=s>0?-u:Math.min(Math.max(-u,-f),u),h=-s*s+c*(c+2*f)+m):c<=l?(s=0,c=Math.min(Math.max(-u,-f),u),h=c*(c+2*f)+m):(s=Math.max(0,-(p*u+d)),c=s>0?u:Math.min(Math.max(-u,-f),u),h=-s*s+c*(c+2*f)+m);else c=p>0?-u:u,s=Math.max(0,-(p*c+d)),h=-s*s+c*(c+2*f)+m;return a&&a.copy(this.direction).multiplyScalar(s).add(this.origin),o&&o.copy(t).multiplyScalar(c).add(e),h}}(),intersectSphere:function(){var e=new a.Vector3;return function(t,r){e.subVectors(t.center,this.origin);var i=e.dot(this.direction),n=e.dot(e)-i*i,a=t.radius*t.radius;if(n>a)return null;var o=Math.sqrt(a-n),s=i-o,c=i+o;return s<0&&c<0?null:s<0?this.at(c,r):this.at(s,r)}}(),intersectsSphere:function(e){return this.distanceToPoint(e.center)<=e.radius},distanceToPlane:function(e){var t=e.normal.dot(this.direction);if(0===t)return 0===e.distanceToPoint(this.origin)?0:null;var r=-(this.origin.dot(e.normal)+e.constant)/t;return r>=0?r:null},intersectPlane:function(e,t){var r=this.distanceToPlane(e);return null===r?null:this.at(r,t)},intersectsPlane:function(e){var t=e.distanceToPoint(this.origin);if(0===t)return!0;var r=e.normal.dot(this.direction);return r*t<0},intersectBox:function(e,t){var r,i,n,a,o,s,c=1/this.direction.x,h=1/this.direction.y,l=1/this.direction.z,u=this.origin;return c>=0?(r=(e.min.x-u.x)*c,i=(e.max.x-u.x)*c):(r=(e.max.x-u.x)*c,i=(e.min.x-u.x)*c),h>=0?(n=(e.min.y-u.y)*h,a=(e.max.y-u.y)*h):(n=(e.max.y-u.y)*h,a=(e.min.y-u.y)*h),r>a||n>i?null:((n>r||r!==r)&&(r=n),(a<i||i!==i)&&(i=a),l>=0?(o=(e.min.z-u.z)*l,s=(e.max.z-u.z)*l):(o=(e.max.z-u.z)*l,s=(e.min.z-u.z)*l),r>s||o>i?null:((o>r||r!==r)&&(r=o),(s<i||i!==i)&&(i=s),i<0?null:this.at(r>=0?r:i,t)))},intersectsBox:function(){var e=new a.Vector3;return function(t){return null!==this.intersectBox(t,e)}}(),intersectTriangle:function(){var e=new a.Vector3,t=new a.Vector3,r=new a.Vector3,i=new a.Vector3;return function(n,a,o,s,c){t.subVectors(a,n),r.subVectors(o,n),i.crossVectors(t,r);var h,l=this.direction.dot(i);if(l>0){if(s)return null;h=1}else{if(!(l<0))return null;h=-1,l=-l}e.subVectors(this.origin,n);var u=h*this.direction.dot(r.crossVectors(e,r));if(u<0)return null;var p=h*this.direction.dot(t.cross(e));if(p<0)return null;if(u+p>l)return null;var d=-h*e.dot(i);return d<0?null:this.at(d/l,c)}}(),applyMatrix4:function(e){return this.direction.add(this.origin).applyMatrix4(e),this.origin.applyMatrix4(e),this.direction.sub(this.origin),this.direction.normalize(),this},equals:function(e){return e.origin.equals(this.origin)&&e.direction.equals(this.direction)}},a.Sphere=function(e,t){this.center=void 0!==e?e:new a.Vector3,this.radius=void 0!==t?t:0},a.Sphere.prototype={constructor:a.Sphere,set:function(e,t){return this.center.copy(e),this.radius=t,this},setFromPoints:function(){var e=new a.Box3;return function(t,r){var i=this.center;void 0!==r?i.copy(r):e.setFromPoints(t).center(i);for(var n=0,a=0,o=t.length;a<o;a++)n=Math.max(n,i.distanceToSquared(t[a]));return this.radius=Math.sqrt(n),this}}(),clone:function(){return(new this.constructor).copy(this)},copy:function(e){return this.center.copy(e.center),this.radius=e.radius,this},empty:function(){return this.radius<=0},containsPoint:function(e){return e.distanceToSquared(this.center)<=this.radius*this.radius},distanceToPoint:function(e){return e.distanceTo(this.center)-this.radius},intersectsSphere:function(e){var t=this.radius+e.radius;return e.center.distanceToSquared(this.center)<=t*t},intersectsBox:function(e){return e.intersectsSphere(this)},intersectsPlane:function(e){return Math.abs(this.center.dot(e.normal)-e.constant)<=this.radius},clampPoint:function(e,t){var r=this.center.distanceToSquared(e),i=t||new a.Vector3;return i.copy(e),r>this.radius*this.radius&&(i.sub(this.center).normalize(),i.multiplyScalar(this.radius).add(this.center)),i},getBoundingBox:function(e){var t=e||new a.Box3;return t.set(this.center,this.center),t.expandByScalar(this.radius),t},applyMatrix4:function(e){return this.center.applyMatrix4(e),this.radius=this.radius*e.getMaxScaleOnAxis(),this},translate:function(e){return this.center.add(e),this},equals:function(e){return e.center.equals(this.center)&&e.radius===this.radius}},a.Frustum=function(e,t,r,i,n,o){this.planes=[void 0!==e?e:new a.Plane,void 0!==t?t:new a.Plane,void 0!==r?r:new a.Plane,void 0!==i?i:new a.Plane,void 0!==n?n:new a.Plane,void 0!==o?o:new a.Plane]},a.Frustum.prototype={constructor:a.Frustum,set:function(e,t,r,i,n,a){var o=this.planes;return o[0].copy(e),o[1].copy(t),o[2].copy(r),o[3].copy(i),o[4].copy(n),o[5].copy(a),this},clone:function(){return(new this.constructor).copy(this)},copy:function(e){for(var t=this.planes,r=0;r<6;r++)t[r].copy(e.planes[r]);return this},setFromMatrix:function(e){var t=this.planes,r=e.elements,i=r[0],n=r[1],a=r[2],o=r[3],s=r[4],c=r[5],h=r[6],l=r[7],u=r[8],p=r[9],d=r[10],f=r[11],m=r[12],g=r[13],v=r[14],y=r[15];return t[0].setComponents(o-i,l-s,f-u,y-m).normalize(),t[1].setComponents(o+i,l+s,f+u,y+m).normalize(),t[2].setComponents(o+n,l+c,f+p,y+g).normalize(),t[3].setComponents(o-n,l-c,f-p,y-g).normalize(),t[4].setComponents(o-a,l-h,f-d,y-v).normalize(),t[5].setComponents(o+a,l+h,f+d,y+v).normalize(),this},intersectsObject:function(){var e=new a.Sphere;return function(t){var r=t.geometry;return null===r.boundingSphere&&r.computeBoundingSphere(),e.copy(r.boundingSphere).applyMatrix4(t.matrixWorld),this.intersectsSphere(e)}}(),intersectsSprite:function(){var e=new a.Sphere;return function(t){return e.center.set(0,0,0),e.radius=.7071067811865476,e.applyMatrix4(t.matrixWorld),this.intersectsSphere(e)}}(),intersectsSphere:function(e){for(var t=this.planes,r=e.center,i=-e.radius,n=0;n<6;n++){var a=t[n].distanceToPoint(r);if(a<i)return!1}return!0},intersectsBox:function(){var e=new a.Vector3,t=new a.Vector3;return function(r){for(var i=this.planes,n=0;n<6;n++){var a=i[n];e.x=a.normal.x>0?r.min.x:r.max.x,t.x=a.normal.x>0?r.max.x:r.min.x,e.y=a.normal.y>0?r.min.y:r.max.y,t.y=a.normal.y>0?r.max.y:r.min.y,e.z=a.normal.z>0?r.min.z:r.max.z,t.z=a.normal.z>0?r.max.z:r.min.z;var o=a.distanceToPoint(e),s=a.distanceToPoint(t);if(o<0&&s<0)return!1}return!0}}(),containsPoint:function(e){for(var t=this.planes,r=0;r<6;r++)if(t[r].distanceToPoint(e)<0)return!1;return!0}},a.Plane=function(e,t){this.normal=void 0!==e?e:new a.Vector3(1,0,0),this.constant=void 0!==t?t:0},a.Plane.prototype={constructor:a.Plane,set:function(e,t){return this.normal.copy(e),this.constant=t,this},setComponents:function(e,t,r,i){return this.normal.set(e,t,r),this.constant=i,this},setFromNormalAndCoplanarPoint:function(e,t){return this.normal.copy(e),this.constant=-t.dot(this.normal),this},setFromCoplanarPoints:function(){var e=new a.Vector3,t=new a.Vector3;return function(r,i,n){var a=e.subVectors(n,i).cross(t.subVectors(r,i)).normalize();return this.setFromNormalAndCoplanarPoint(a,r),this}}(),clone:function(){return(new this.constructor).copy(this)},copy:function(e){return this.normal.copy(e.normal),this.constant=e.constant,this},normalize:function(){var e=1/this.normal.length();return this.normal.multiplyScalar(e),this.constant*=e,this},negate:function(){return this.constant*=-1,this.normal.negate(),this},distanceToPoint:function(e){return this.normal.dot(e)+this.constant},distanceToSphere:function(e){return this.distanceToPoint(e.center)-e.radius},projectPoint:function(e,t){return this.orthoPoint(e,t).sub(e).negate()},orthoPoint:function(e,t){var r=this.distanceToPoint(e),i=t||new a.Vector3;return i.copy(this.normal).multiplyScalar(r)},intersectLine:function(){var e=new a.Vector3;return function(t,r){var i=r||new a.Vector3,n=t.delta(e),o=this.normal.dot(n);if(0!==o){var s=-(t.start.dot(this.normal)+this.constant)/o;if(!(s<0||s>1))return i.copy(n).multiplyScalar(s).add(t.start)}else if(0===this.distanceToPoint(t.start))return i.copy(t.start)}}(),intersectsLine:function(e){var t=this.distanceToPoint(e.start),r=this.distanceToPoint(e.end);return t<0&&r>0||r<0&&t>0},intersectsBox:function(e){return e.intersectsPlane(this)},intersectsSphere:function(e){return e.intersectsPlane(this)},coplanarPoint:function(e){var t=e||new a.Vector3;return t.copy(this.normal).multiplyScalar(-this.constant)},applyMatrix4:function(){var e=new a.Vector3,t=new a.Matrix3;return function(r,i){var n=this.coplanarPoint(e).applyMatrix4(r),a=i||t.getNormalMatrix(r),o=this.normal.applyMatrix3(a).normalize();return this.constant=-n.dot(o),this}}(),translate:function(e){return this.constant=this.constant-e.dot(this.normal),this},equals:function(e){return e.normal.equals(this.normal)&&e.constant===this.constant}},a.Spherical=function(e,t,r){return this.radius=void 0!==e?e:1,this.phi=void 0!==t?t:0,this.theta=void 0!==r?r:0,this},a.Spherical.prototype={constructor:a.Spherical,set:function(e,t,r){return this.radius=e,this.phi=t,this.theta=r,this},clone:function(){return(new this.constructor).copy(this)},copy:function(e){return this.radius.copy(e.radius),this.phi.copy(e.phi),this.theta.copy(e.theta),this},makeSafe:function(){var e=1e-6;return this.phi=Math.max(e,Math.min(Math.PI-e,this.phi)),this},setFromVector3:function(e){return this.radius=e.length(),0===this.radius?(this.theta=0,this.phi=0):(this.theta=Math.atan2(e.x,e.z),this.phi=Math.acos(a.Math.clamp(e.y/this.radius,-1,1))),this}},a.Math={DEG2RAD:Math.PI/180,RAD2DEG:180/Math.PI,generateUUID:function(){var e,t="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz".split(""),r=new Array(36),i=0;return function(){for(var n=0;n<36;n++)8===n||13===n||18===n||23===n?r[n]="-":14===n?r[n]="4":(i<=2&&(i=33554432+16777216*Math.random()|0),e=15&i,i>>=4,r[n]=t[19===n?3&e|8:e]);return r.join("")}}(),clamp:function(e,t,r){return Math.max(t,Math.min(r,e))},euclideanModulo:function(e,t){return(e%t+t)%t},mapLinear:function(e,t,r,i,n){return i+(e-t)*(n-i)/(r-t)},smoothstep:function(e,t,r){return e<=t?0:e>=r?1:(e=(e-t)/(r-t),e*e*(3-2*e))},smootherstep:function(e,t,r){return e<=t?0:e>=r?1:(e=(e-t)/(r-t),e*e*e*(e*(6*e-15)+10))},random16:function(){return console.warn("THREE.Math.random16() has been deprecated. Use Math.random() instead."),Math.random()},randInt:function(e,t){return e+Math.floor(Math.random()*(t-e+1))},randFloat:function(e,t){return e+Math.random()*(t-e)},randFloatSpread:function(e){return e*(.5-Math.random())},degToRad:function(e){return e*a.Math.DEG2RAD},radToDeg:function(e){return e*a.Math.RAD2DEG},isPowerOfTwo:function(e){return 0===(e&e-1)&&0!==e},nearestPowerOfTwo:function(e){return Math.pow(2,Math.round(Math.log(e)/Math.LN2))},nextPowerOfTwo:function(e){return e--,e|=e>>1,e|=e>>2,e|=e>>4,e|=e>>8,e|=e>>16,e++,e}},a.Spline=function(e){function t(e,t,r,i,n,a,o){var s=.5*(r-e),c=.5*(i-t);return(2*(t-r)+s+c)*o+(-3*(t-r)-2*s-c)*a+s*n+t}this.points=e;var r,i,n,o,s,c,h,l,u,p=[],d={x:0,y:0,z:0};this.initFromArray=function(e){this.points=[];for(var t=0;t<e.length;t++)this.points[t]={x:e[t][0],y:e[t][1],z:e[t][2]}},this.getPoint=function(e){return r=(this.points.length-1)*e,i=Math.floor(r),n=r-i,p[0]=0===i?i:i-1,p[1]=i,p[2]=i>this.points.length-2?this.points.length-1:i+1,p[3]=i>this.points.length-3?this.points.length-1:i+2,c=this.points[p[0]],h=this.points[p[1]],l=this.points[p[2]],u=this.points[p[3]],o=n*n,s=n*o,d.x=t(c.x,h.x,l.x,u.x,n,o,s),d.y=t(c.y,h.y,l.y,u.y,n,o,s),d.z=t(c.z,h.z,l.z,u.z,n,o,s),d},this.getControlPointsArray=function(){var e,t,r=this.points.length,i=[];for(e=0;e<r;e++)t=this.points[e],i[e]=[t.x,t.y,t.z];return i},this.getLength=function(e){var t,r,i,n,o=0,s=0,c=0,h=new a.Vector3,l=new a.Vector3,u=[],p=0;for(u[0]=0,e||(e=100),i=this.points.length*e,h.copy(this.points[0]),t=1;t<i;t++)r=t/i,n=this.getPoint(r),l.copy(n),p+=l.distanceTo(h),h.copy(n),o=(this.points.length-1)*r,s=Math.floor(o),s!==c&&(u[s]=p,c=s);return u[u.length]=p,{chunks:u,total:p}},this.reparametrizeByArcLength=function(e){var t,r,i,n,o,s,c,h,l=[],u=new a.Vector3,p=this.getLength();for(l.push(u.copy(this.points[0]).clone()),t=1;t<this.points.length;t++){for(s=p.chunks[t]-p.chunks[t-1],c=Math.ceil(e*s/p.total),n=(t-1)/(this.points.length-1),o=t/(this.points.length-1),r=1;r<c-1;r++)i=n+r*(1/c)*(o-n),h=this.getPoint(i),l.push(u.copy(h).clone());l.push(u.copy(this.points[t]).clone())}this.points=l}},a.Triangle=function(e,t,r){this.a=void 0!==e?e:new a.Vector3,this.b=void 0!==t?t:new a.Vector3,this.c=void 0!==r?r:new a.Vector3},a.Triangle.normal=function(){var e=new a.Vector3;return function(t,r,i,n){var o=n||new a.Vector3;o.subVectors(i,r),e.subVectors(t,r),o.cross(e);var s=o.lengthSq();return s>0?o.multiplyScalar(1/Math.sqrt(s)):o.set(0,0,0)}}(),a.Triangle.barycoordFromPoint=function(){var e=new a.Vector3,t=new a.Vector3,r=new a.Vector3;return function(i,n,o,s,c){e.subVectors(s,n),t.subVectors(o,n),r.subVectors(i,n);var h=e.dot(e),l=e.dot(t),u=e.dot(r),p=t.dot(t),d=t.dot(r),f=h*p-l*l,m=c||new a.Vector3;if(0===f)return m.set(-2,-1,-1);var g=1/f,v=(p*u-l*d)*g,y=(h*d-l*u)*g;return m.set(1-v-y,y,v)}}(),a.Triangle.containsPoint=function(){var e=new a.Vector3;return function(t,r,i,n){var o=a.Triangle.barycoordFromPoint(t,r,i,n,e);return o.x>=0&&o.y>=0&&o.x+o.y<=1}}(),a.Triangle.prototype={constructor:a.Triangle,set:function(e,t,r){return this.a.copy(e),this.b.copy(t),this.c.copy(r),this},setFromPointsAndIndices:function(e,t,r,i){return this.a.copy(e[t]),this.b.copy(e[r]),this.c.copy(e[i]),this},clone:function(){return(new this.constructor).copy(this)},copy:function(e){return this.a.copy(e.a),this.b.copy(e.b),this.c.copy(e.c),this},area:function(){var e=new a.Vector3,t=new a.Vector3;return function(){return e.subVectors(this.c,this.b),t.subVectors(this.a,this.b),.5*e.cross(t).length()}}(),midpoint:function(e){var t=e||new a.Vector3;return t.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)},normal:function(e){return a.Triangle.normal(this.a,this.b,this.c,e)},plane:function(e){var t=e||new a.Plane;return t.setFromCoplanarPoints(this.a,this.b,this.c)},barycoordFromPoint:function(e,t){return a.Triangle.barycoordFromPoint(e,this.a,this.b,this.c,t)},containsPoint:function(e){return a.Triangle.containsPoint(e,this.a,this.b,this.c)},closestPointToPoint:function(){var e,t,r,i;return function(n,o){void 0===e&&(e=new a.Plane,t=[new a.Line3,new a.Line3,new a.Line3],r=new a.Vector3,i=new a.Vector3);var s=o||new a.Vector3,c=1/0;if(e.setFromCoplanarPoints(this.a,this.b,this.c),e.projectPoint(n,r),this.containsPoint(r)===!0)s.copy(r);else{t[0].set(this.a,this.b),t[1].set(this.b,this.c),t[2].set(this.c,this.a);for(var h=0;h<t.length;h++){t[h].closestPointToPoint(r,!0,i);var l=r.distanceToSquared(i);l<c&&(c=l,s.copy(i))}}return s}}(),equals:function(e){return e.a.equals(this.a)&&e.b.equals(this.b)&&e.c.equals(this.c)}},a.Interpolant=function(e,t,r,i){this.parameterPositions=e,this._cachedIndex=0,this.resultBuffer=void 0!==i?i:new t.constructor(r),this.sampleValues=t,this.valueSize=r},a.Interpolant.prototype={constructor:a.Interpolant,evaluate:function(e){var t=this.parameterPositions,r=this._cachedIndex,i=t[r],n=t[r-1];e:{t:{var a;r:{i:if(!(e<i)){for(var o=r+2;;){if(void 0===i){if(e<n)break i;return r=t.length,this._cachedIndex=r,this.afterEnd_(r-1,e,n)}if(r===o)break;if(n=i,i=t[++r],e<i)break t}a=t.length;break r}{if(e>=n)break e;var s=t[1];e<s&&(r=2,n=s);for(var o=r-2;;){if(void 0===n)return this._cachedIndex=0,this.beforeStart_(0,e,i);if(r===o)break;if(i=n,n=t[--r-1],e>=n)break t}a=r,r=0}}for(;r<a;){var c=r+a>>>1;e<t[c]?a=c:r=c+1}if(i=t[r],n=t[r-1],void 0===n)return this._cachedIndex=0,this.beforeStart_(0,e,i);if(void 0===i)return r=t.length,this._cachedIndex=r,this.afterEnd_(r-1,n,e)}this._cachedIndex=r,this.intervalChanged_(r,n,i)}return this.interpolate_(r,n,e,i)},settings:null,DefaultSettings_:{},getSettings_:function(){return this.settings||this.DefaultSettings_},copySampleValue_:function(e){for(var t=this.resultBuffer,r=this.sampleValues,i=this.valueSize,n=e*i,a=0;a!==i;++a)t[a]=r[n+a];return t},interpolate_:function(e,t,r,i){throw new Error("call to abstract method")},intervalChanged_:function(e,t,r){}},Object.assign(a.Interpolant.prototype,{beforeStart_:a.Interpolant.prototype.copySampleValue_,afterEnd_:a.Interpolant.prototype.copySampleValue_}),a.CubicInterpolant=function(e,t,r,i){a.Interpolant.call(this,e,t,r,i),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(e,t,r){var i=this.parameterPositions,n=e-2,o=e+1,s=i[n],c=i[o];if(void 0===s)switch(this.getSettings_().endingStart){case a.ZeroSlopeEnding:n=e,s=2*t-r;break;case a.WrapAroundEnding:n=i.length-2,s=t+i[n]-i[n+1];break;default:n=e,s=r}if(void 0===c)switch(this.getSettings_().endingEnd){case a.ZeroSlopeEnding:o=e,c=2*r-t;break;case a.WrapAroundEnding:o=1,c=r+i[1]-i[0];break;default:o=e-1,c=t}var h=.5*(r-t),l=this.valueSize;this._weightPrev=h/(t-s),this._weightNext=h/(c-r),this._offsetPrev=n*l,this._offsetNext=o*l},interpolate_:function(e,t,r,i){for(var n=this.resultBuffer,a=this.sampleValues,o=this.valueSize,s=e*o,c=s-o,h=this._offsetPrev,l=this._offsetNext,u=this._weightPrev,p=this._weightNext,d=(r-t)/(i-t),f=d*d,m=f*d,g=-u*m+2*u*f-u*d,v=(1+u)*m+(-1.5-2*u)*f+(-.5+u)*d+1,y=(-1-p)*m+(1.5+p)*f+.5*d,x=p*m-p*f,b=0;b!==o;++b)n[b]=g*a[h+b]+v*a[c+b]+y*a[s+b]+x*a[l+b];return n}}),a.DiscreteInterpolant=function(e,t,r,i){a.Interpolant.call(this,e,t,r,i)},a.DiscreteInterpolant.prototype=Object.assign(Object.create(a.Interpolant.prototype),{constructor:a.DiscreteInterpolant,interpolate_:function(e,t,r,i){return this.copySampleValue_(e-1)}}),a.LinearInterpolant=function(e,t,r,i){a.Interpolant.call(this,e,t,r,i)},a.LinearInterpolant.prototype=Object.assign(Object.create(a.Interpolant.prototype),{constructor:a.LinearInterpolant,interpolate_:function(e,t,r,i){for(var n=this.resultBuffer,a=this.sampleValues,o=this.valueSize,s=e*o,c=s-o,h=(r-t)/(i-t),l=1-h,u=0;u!==o;++u)n[u]=a[c+u]*l+a[s+u]*h;return n}}),a.QuaternionLinearInterpolant=function(e,t,r,i){a.Interpolant.call(this,e,t,r,i)},a.QuaternionLinearInterpolant.prototype=Object.assign(Object.create(a.Interpolant.prototype),{constructor:a.QuaternionLinearInterpolant,interpolate_:function(e,t,r,i){for(var n=this.resultBuffer,o=this.sampleValues,s=this.valueSize,c=e*s,h=(r-t)/(i-t),l=c+s;c!==l;c+=4)a.Quaternion.slerpFlat(n,0,o,c-s,o,c,h);return n}}),a.Clock=function(e){this.autoStart=void 0===e||e,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 e=0;if(this.autoStart&&!this.running&&this.start(),this.running){var t=(performance||Date).now();e=(t-this.oldTime)/1e3,this.oldTime=t,this.elapsedTime+=e}return e}},a.EventDispatcher=function(){},Object.assign(a.EventDispatcher.prototype,{addEventListener:function(e,t){void 0===this._listeners&&(this._listeners={});var r=this._listeners;void 0===r[e]&&(r[e]=[]),r[e].indexOf(t)===-1&&r[e].push(t)},hasEventListener:function(e,t){if(void 0===this._listeners)return!1;var r=this._listeners;return void 0!==r[e]&&r[e].indexOf(t)!==-1},removeEventListener:function(e,t){if(void 0!==this._listeners){var r=this._listeners,i=r[e];if(void 0!==i){var n=i.indexOf(t);n!==-1&&i.splice(n,1)}}},dispatchEvent:function(e){if(void 0!==this._listeners){var t=this._listeners,r=t[e.type];if(void 0!==r){e.target=this;var i=[],n=0,a=r.length;for(n=0;n<a;n++)i[n]=r[n];for(n=0;n<a;n++)i[n].call(this,e)}}}}),a.Layers=function(){this.mask=1},a.Layers.prototype={constructor:a.Layers,set:function(e){this.mask=1<<e},enable:function(e){this.mask|=1<<e},toggle:function(e){this.mask^=1<<e},disable:function(e){this.mask&=~(1<<e)},test:function(e){return 0!==(this.mask&e.mask)}},function(e){function t(e,t){return e.distance-t.distance}function r(e,t,i,n){if(e.visible!==!1&&(e.raycast(t,i),n===!0))for(var a=e.children,o=0,s=a.length;o<s;o++)r(a[o],t,i,!0)}e.Raycaster=function(t,r,i,n){this.ray=new e.Ray(t,r),this.near=i||0,this.far=n||1/0,this.params={Mesh:{},Line:{},LOD:{},Points:{threshold:1},Sprite:{}},Object.defineProperties(this.params,{PointCloud:{get:function(){return console.warn("THREE.Raycaster: params.PointCloud has been renamed to params.Points."),this.Points}}})},e.Raycaster.prototype={constructor:e.Raycaster,linePrecision:1,set:function(e,t){this.ray.set(e,t)},setFromCamera:function(t,r){r instanceof e.PerspectiveCamera?(this.ray.origin.setFromMatrixPosition(r.matrixWorld),this.ray.direction.set(t.x,t.y,.5).unproject(r).sub(this.ray.origin).normalize()):r instanceof e.OrthographicCamera?(this.ray.origin.set(t.x,t.y,(r.near+r.far)/(r.near-r.far)).unproject(r),this.ray.direction.set(0,0,-1).transformDirection(r.matrixWorld)):console.error("THREE.Raycaster: Unsupported camera type.")},intersectObject:function(e,i){var n=[];return r(e,this,n,i),n.sort(t),n},intersectObjects:function(e,i){var n=[];if(Array.isArray(e)===!1)return console.warn("THREE.Raycaster.intersectObjects: objects is not an Array."),n;for(var a=0,o=e.length;a<o;a++)r(e[a],this,n,i);return n.sort(t),n}}}(a),a.Object3D=function(){function e(){n.setFromEuler(i,!1)}function t(){i.setFromQuaternion(n,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 r=new a.Vector3,i=new a.Euler,n=new a.Quaternion,o=new a.Vector3(1,1,1);i.onChange(e),n.onChange(t),Object.defineProperties(this,{position:{enumerable:!0,value:r},rotation:{enumerable:!0,value:i},quaternion:{enumerable:!0,value:n},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(e){this.matrix.multiplyMatrices(e,this.matrix),this.matrix.decompose(this.position,this.quaternion,this.scale)},setRotationFromAxisAngle:function(e,t){this.quaternion.setFromAxisAngle(e,t)},setRotationFromEuler:function(e){this.quaternion.setFromEuler(e,!0)},setRotationFromMatrix:function(e){this.quaternion.setFromRotationMatrix(e)},setRotationFromQuaternion:function(e){this.quaternion.copy(e)},rotateOnAxis:function(){var e=new a.Quaternion;return function(t,r){return e.setFromAxisAngle(t,r),this.quaternion.multiply(e),this}}(),rotateX:function(){var e=new a.Vector3(1,0,0);return function(t){return this.rotateOnAxis(e,t)}}(),rotateY:function(){var e=new a.Vector3(0,1,0);return function(t){return this.rotateOnAxis(e,t)}}(),rotateZ:function(){var e=new a.Vector3(0,0,1);return function(t){return this.rotateOnAxis(e,t)}}(),translateOnAxis:function(){var e=new a.Vector3;return function(t,r){return e.copy(t).applyQuaternion(this.quaternion),this.position.add(e.multiplyScalar(r)),this}}(),translateX:function(){var e=new a.Vector3(1,0,0);return function(t){return this.translateOnAxis(e,t)}}(),translateY:function(){var e=new a.Vector3(0,1,0);return function(t){return this.translateOnAxis(e,t)}}(),translateZ:function(){var e=new a.Vector3(0,0,1);return function(t){return this.translateOnAxis(e,t)}}(),localToWorld:function(e){return e.applyMatrix4(this.matrixWorld)},worldToLocal:function(){var e=new a.Matrix4;return function(t){return t.applyMatrix4(e.getInverse(this.matrixWorld))}}(),lookAt:function(){var e=new a.Matrix4;return function(t){e.lookAt(t,this.position,this.up),this.quaternion.setFromRotationMatrix(e)}}(),add:function(e){if(arguments.length>1){for(var t=0;t<arguments.length;t++)this.add(arguments[t]);return this}return e===this?(console.error("THREE.Object3D.add: object can't be added as a child of itself.",e),this):(e instanceof a.Object3D?(null!==e.parent&&e.parent.remove(e),e.parent=this,e.dispatchEvent({type:"added"}),this.children.push(e)):console.error("THREE.Object3D.add: object not an instance of THREE.Object3D.",e),this)},remove:function(e){if(arguments.length>1)for(var t=0;t<arguments.length;t++)this.remove(arguments[t]);var r=this.children.indexOf(e);r!==-1&&(e.parent=null,e.dispatchEvent({type:"removed"}),this.children.splice(r,1))},getObjectById:function(e){return this.getObjectByProperty("id",e)},getObjectByName:function(e){return this.getObjectByProperty("name",e)},getObjectByProperty:function(e,t){if(this[e]===t)return this;for(var r=0,i=this.children.length;r<i;r++){var n=this.children[r],a=n.getObjectByProperty(e,t);if(void 0!==a)return a}},getWorldPosition:function(e){var t=e||new a.Vector3;return this.updateMatrixWorld(!0),t.setFromMatrixPosition(this.matrixWorld)},getWorldQuaternion:function(){var e=new a.Vector3,t=new a.Vector3;return function(r){var i=r||new a.Quaternion;return this.updateMatrixWorld(!0),this.matrixWorld.decompose(e,i,t),i}}(),getWorldRotation:function(){var e=new a.Quaternion;return function(t){var r=t||new a.Euler;return this.getWorldQuaternion(e),r.setFromQuaternion(e,this.rotation.order,!1)}}(),getWorldScale:function(){var e=new a.Vector3,t=new a.Quaternion;return function(r){var i=r||new a.Vector3;return this.updateMatrixWorld(!0),this.matrixWorld.decompose(e,t,i),i}}(),getWorldDirection:function(){var e=new a.Quaternion;return function(t){var r=t||new a.Vector3;return this.getWorldQuaternion(e),r.set(0,0,1).applyQuaternion(e)}}(),raycast:function(){},traverse:function(e){e(this);for(var t=this.children,r=0,i=t.length;r<i;r++)t[r].traverse(e)},traverseVisible:function(e){if(this.visible!==!1){e(this);for(var t=this.children,r=0,i=t.length;r<i;r++)t[r].traverseVisible(e)}},traverseAncestors:function(e){
+var t=this.parent;null!==t&&(e(t),t.traverseAncestors(e))},updateMatrix:function(){this.matrix.compose(this.position,this.quaternion,this.scale),this.matrixWorldNeedsUpdate=!0},updateMatrixWorld:function(e){this.matrixAutoUpdate===!0&&this.updateMatrix(),this.matrixWorldNeedsUpdate!==!0&&e!==!0||(null===this.parent?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix),this.matrixWorldNeedsUpdate=!1,e=!0);for(var t=0,r=this.children.length;t<r;t++)this.children[t].updateMatrixWorld(e)},toJSON:function(e){function t(e){var t=[];for(var r in e){var i=e[r];delete i.metadata,t.push(i)}return t}var r=void 0===e||""===e,i={};r&&(e={geometries:{},materials:{},textures:{},images:{}},i.metadata={version:4.4,type:"Object",generator:"Object3D.toJSON"});var n={};if(n.uuid=this.uuid,n.type=this.type,""!==this.name&&(n.name=this.name),"{}"!==JSON.stringify(this.userData)&&(n.userData=this.userData),this.castShadow===!0&&(n.castShadow=!0),this.receiveShadow===!0&&(n.receiveShadow=!0),this.visible===!1&&(n.visible=!1),n.matrix=this.matrix.toArray(),void 0!==this.geometry&&(void 0===e.geometries[this.geometry.uuid]&&(e.geometries[this.geometry.uuid]=this.geometry.toJSON(e)),n.geometry=this.geometry.uuid),void 0!==this.material&&(void 0===e.materials[this.material.uuid]&&(e.materials[this.material.uuid]=this.material.toJSON(e)),n.material=this.material.uuid),this.children.length>0){n.children=[];for(var a=0;a<this.children.length;a++)n.children.push(this.children[a].toJSON(e).object)}if(r){var o=t(e.geometries),s=t(e.materials),c=t(e.textures),h=t(e.images);o.length>0&&(i.geometries=o),s.length>0&&(i.materials=s),c.length>0&&(i.textures=c),h.length>0&&(i.images=h)}return i.object=n,i},clone:function(e){return(new this.constructor).copy(this,e)},copy:function(e,t){if(void 0===t&&(t=!0),this.name=e.name,this.up.copy(e.up),this.position.copy(e.position),this.quaternion.copy(e.quaternion),this.scale.copy(e.scale),this.matrix.copy(e.matrix),this.matrixWorld.copy(e.matrixWorld),this.matrixAutoUpdate=e.matrixAutoUpdate,this.matrixWorldNeedsUpdate=e.matrixWorldNeedsUpdate,this.visible=e.visible,this.castShadow=e.castShadow,this.receiveShadow=e.receiveShadow,this.frustumCulled=e.frustumCulled,this.renderOrder=e.renderOrder,this.userData=JSON.parse(JSON.stringify(e.userData)),t===!0)for(var r=0;r<e.children.length;r++){var i=e.children[r];this.add(i.clone())}return this}}),a.Object3DIdCount=0,a.Face3=function(e,t,r,i,n,o){this.a=e,this.b=t,this.c=r,this.normal=i instanceof a.Vector3?i:new a.Vector3,this.vertexNormals=Array.isArray(i)?i:[],this.color=n instanceof a.Color?n:new a.Color,this.vertexColors=Array.isArray(n)?n:[],this.materialIndex=void 0!==o?o:0},a.Face3.prototype={constructor:a.Face3,clone:function(){return(new this.constructor).copy(this)},copy:function(e){this.a=e.a,this.b=e.b,this.c=e.c,this.normal.copy(e.normal),this.color.copy(e.color),this.materialIndex=e.materialIndex;for(var t=0,r=e.vertexNormals.length;t<r;t++)this.vertexNormals[t]=e.vertexNormals[t].clone();for(var t=0,r=e.vertexColors.length;t<r;t++)this.vertexColors[t]=e.vertexColors[t].clone();return this}},a.BufferAttribute=function(e,t,r){this.uuid=a.Math.generateUUID(),this.array=e,this.itemSize=t,this.dynamic=!1,this.updateRange={offset:0,count:-1},this.version=0,this.normalized=r===!0},a.BufferAttribute.prototype={constructor:a.BufferAttribute,get count(){return this.array.length/this.itemSize},set needsUpdate(e){e===!0&&this.version++},setDynamic:function(e){return this.dynamic=e,this},copy:function(e){return this.array=new e.array.constructor(e.array),this.itemSize=e.itemSize,this.dynamic=e.dynamic,this},copyAt:function(e,t,r){e*=this.itemSize,r*=t.itemSize;for(var i=0,n=this.itemSize;i<n;i++)this.array[e+i]=t.array[r+i];return this},copyArray:function(e){return this.array.set(e),this},copyColorsArray:function(e){for(var t=this.array,r=0,i=0,n=e.length;i<n;i++){var o=e[i];void 0===o&&(console.warn("THREE.BufferAttribute.copyColorsArray(): color is undefined",i),o=new a.Color),t[r++]=o.r,t[r++]=o.g,t[r++]=o.b}return this},copyIndicesArray:function(e){for(var t=this.array,r=0,i=0,n=e.length;i<n;i++){var a=e[i];t[r++]=a.a,t[r++]=a.b,t[r++]=a.c}return this},copyVector2sArray:function(e){for(var t=this.array,r=0,i=0,n=e.length;i<n;i++){var o=e[i];void 0===o&&(console.warn("THREE.BufferAttribute.copyVector2sArray(): vector is undefined",i),o=new a.Vector2),t[r++]=o.x,t[r++]=o.y}return this},copyVector3sArray:function(e){for(var t=this.array,r=0,i=0,n=e.length;i<n;i++){var o=e[i];void 0===o&&(console.warn("THREE.BufferAttribute.copyVector3sArray(): vector is undefined",i),o=new a.Vector3),t[r++]=o.x,t[r++]=o.y,t[r++]=o.z}return this},copyVector4sArray:function(e){for(var t=this.array,r=0,i=0,n=e.length;i<n;i++){var o=e[i];void 0===o&&(console.warn("THREE.BufferAttribute.copyVector4sArray(): vector is undefined",i),o=new a.Vector4),t[r++]=o.x,t[r++]=o.y,t[r++]=o.z,t[r++]=o.w}return this},set:function(e,t){return void 0===t&&(t=0),this.array.set(e,t),this},getX:function(e){return this.array[e*this.itemSize]},setX:function(e,t){return this.array[e*this.itemSize]=t,this},getY:function(e){return this.array[e*this.itemSize+1]},setY:function(e,t){return this.array[e*this.itemSize+1]=t,this},getZ:function(e){return this.array[e*this.itemSize+2]},setZ:function(e,t){return this.array[e*this.itemSize+2]=t,this},getW:function(e){return this.array[e*this.itemSize+3]},setW:function(e,t){return this.array[e*this.itemSize+3]=t,this},setXY:function(e,t,r){return e*=this.itemSize,this.array[e+0]=t,this.array[e+1]=r,this},setXYZ:function(e,t,r,i){return e*=this.itemSize,this.array[e+0]=t,this.array[e+1]=r,this.array[e+2]=i,this},setXYZW:function(e,t,r,i,n){return e*=this.itemSize,this.array[e+0]=t,this.array[e+1]=r,this.array[e+2]=i,this.array[e+3]=n,this},clone:function(){return(new this.constructor).copy(this)}},a.Int8Attribute=function(e,t){return new a.BufferAttribute(new Int8Array(e),t)},a.Uint8Attribute=function(e,t){return new a.BufferAttribute(new Uint8Array(e),t)},a.Uint8ClampedAttribute=function(e,t){return new a.BufferAttribute(new Uint8ClampedArray(e),t)},a.Int16Attribute=function(e,t){return new a.BufferAttribute(new Int16Array(e),t)},a.Uint16Attribute=function(e,t){return new a.BufferAttribute(new Uint16Array(e),t)},a.Int32Attribute=function(e,t){return new a.BufferAttribute(new Int32Array(e),t)},a.Uint32Attribute=function(e,t){return new a.BufferAttribute(new Uint32Array(e),t)},a.Float32Attribute=function(e,t){return new a.BufferAttribute(new Float32Array(e),t)},a.Float64Attribute=function(e,t){return new a.BufferAttribute(new Float64Array(e),t)},a.DynamicBufferAttribute=function(e,t){return console.warn("THREE.DynamicBufferAttribute has been removed. Use new THREE.BufferAttribute().setDynamic( true ) instead."),new a.BufferAttribute(e,t).setDynamic(!0)},a.InstancedBufferAttribute=function(e,t,r){a.BufferAttribute.call(this,e,t),this.meshPerAttribute=r||1},a.InstancedBufferAttribute.prototype=Object.create(a.BufferAttribute.prototype),a.InstancedBufferAttribute.prototype.constructor=a.InstancedBufferAttribute,a.InstancedBufferAttribute.prototype.copy=function(e){return a.BufferAttribute.prototype.copy.call(this,e),this.meshPerAttribute=e.meshPerAttribute,this},a.InterleavedBuffer=function(e,t){this.uuid=a.Math.generateUUID(),this.array=e,this.stride=t,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(e){e===!0&&this.version++},setDynamic:function(e){return this.dynamic=e,this},copy:function(e){return this.array=new e.array.constructor(e.array),this.stride=e.stride,this.dynamic=e.dynamic,this},copyAt:function(e,t,r){e*=this.stride,r*=t.stride;for(var i=0,n=this.stride;i<n;i++)this.array[e+i]=t.array[r+i];return this},set:function(e,t){return void 0===t&&(t=0),this.array.set(e,t),this},clone:function(){return(new this.constructor).copy(this)}},a.InstancedInterleavedBuffer=function(e,t,r){a.InterleavedBuffer.call(this,e,t),this.meshPerAttribute=r||1},a.InstancedInterleavedBuffer.prototype=Object.create(a.InterleavedBuffer.prototype),a.InstancedInterleavedBuffer.prototype.constructor=a.InstancedInterleavedBuffer,a.InstancedInterleavedBuffer.prototype.copy=function(e){return a.InterleavedBuffer.prototype.copy.call(this,e),this.meshPerAttribute=e.meshPerAttribute,this},a.InterleavedBufferAttribute=function(e,t,r){this.uuid=a.Math.generateUUID(),this.data=e,this.itemSize=t,this.offset=r},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(e,t){return this.data.array[e*this.data.stride+this.offset]=t,this},setY:function(e,t){return this.data.array[e*this.data.stride+this.offset+1]=t,this},setZ:function(e,t){return this.data.array[e*this.data.stride+this.offset+2]=t,this},setW:function(e,t){return this.data.array[e*this.data.stride+this.offset+3]=t,this},getX:function(e){return this.data.array[e*this.data.stride+this.offset]},getY:function(e){return this.data.array[e*this.data.stride+this.offset+1]},getZ:function(e){return this.data.array[e*this.data.stride+this.offset+2]},getW:function(e){return this.data.array[e*this.data.stride+this.offset+3]},setXY:function(e,t,r){return e=e*this.data.stride+this.offset,this.data.array[e+0]=t,this.data.array[e+1]=r,this},setXYZ:function(e,t,r,i){return e=e*this.data.stride+this.offset,this.data.array[e+0]=t,this.data.array[e+1]=r,this.data.array[e+2]=i,this},setXYZW:function(e,t,r,i,n){return e=e*this.data.stride+this.offset,this.data.array[e+0]=t,this.data.array[e+1]=r,this.data.array[e+2]=i,this.data.array[e+3]=n,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(e){for(var t=(new a.Matrix3).getNormalMatrix(e),r=0,i=this.vertices.length;r<i;r++){var n=this.vertices[r];n.applyMatrix4(e)}for(var r=0,i=this.faces.length;r<i;r++){var o=this.faces[r];o.normal.applyMatrix3(t).normalize();for(var s=0,c=o.vertexNormals.length;s<c;s++)o.vertexNormals[s].applyMatrix3(t).normalize()}return null!==this.boundingBox&&this.computeBoundingBox(),null!==this.boundingSphere&&this.computeBoundingSphere(),this.verticesNeedUpdate=!0,this.normalsNeedUpdate=!0,this},rotateX:function(){var e;return function(t){return void 0===e&&(e=new a.Matrix4),e.makeRotationX(t),this.applyMatrix(e),this}}(),rotateY:function(){var e;return function(t){return void 0===e&&(e=new a.Matrix4),e.makeRotationY(t),this.applyMatrix(e),this}}(),rotateZ:function(){var e;return function(t){return void 0===e&&(e=new a.Matrix4),e.makeRotationZ(t),this.applyMatrix(e),this}}(),translate:function(){var e;return function(t,r,i){return void 0===e&&(e=new a.Matrix4),e.makeTranslation(t,r,i),this.applyMatrix(e),this}}(),scale:function(){var e;return function(t,r,i){return void 0===e&&(e=new a.Matrix4),e.makeScale(t,r,i),this.applyMatrix(e),this}}(),lookAt:function(){var e;return function(t){void 0===e&&(e=new a.Object3D),e.lookAt(t),e.updateMatrix(),this.applyMatrix(e.matrix)}}(),fromBufferGeometry:function(e){function t(e,t,i,n){var o=void 0!==s?[u[e].clone(),u[t].clone(),u[i].clone()]:[],f=void 0!==c?[r.colors[e].clone(),r.colors[t].clone(),r.colors[i].clone()]:[],m=new a.Face3(e,t,i,o,f,n);r.faces.push(m),void 0!==h&&r.faceVertexUvs[0].push([p[e].clone(),p[t].clone(),p[i].clone()]),void 0!==l&&r.faceVertexUvs[1].push([d[e].clone(),d[t].clone(),d[i].clone()])}var r=this,i=null!==e.index?e.index.array:void 0,n=e.attributes,o=n.position.array,s=void 0!==n.normal?n.normal.array:void 0,c=void 0!==n.color?n.color.array:void 0,h=void 0!==n.uv?n.uv.array:void 0,l=void 0!==n.uv2?n.uv2.array:void 0;void 0!==l&&(this.faceVertexUvs[1]=[]);for(var u=[],p=[],d=[],f=0,m=0;f<o.length;f+=3,m+=2)r.vertices.push(new a.Vector3(o[f],o[f+1],o[f+2])),void 0!==s&&u.push(new a.Vector3(s[f],s[f+1],s[f+2])),void 0!==c&&r.colors.push(new a.Color(c[f],c[f+1],c[f+2])),void 0!==h&&p.push(new a.Vector2(h[m],h[m+1])),void 0!==l&&d.push(new a.Vector2(l[m],l[m+1]));if(void 0!==i){var g=e.groups;if(g.length>0)for(var f=0;f<g.length;f++)for(var v=g[f],y=v.start,x=v.count,m=y,b=y+x;m<b;m+=3)t(i[m],i[m+1],i[m+2],v.materialIndex);else for(var f=0;f<i.length;f+=3)t(i[f],i[f+1],i[f+2])}else for(var f=0;f<o.length/3;f+=3)t(f,f+1,f+2);return this.computeFaceNormals(),null!==e.boundingBox&&(this.boundingBox=e.boundingBox.clone()),null!==e.boundingSphere&&(this.boundingSphere=e.boundingSphere.clone()),this},center:function(){this.computeBoundingBox();var e=this.boundingBox.center().negate();return this.translate(e.x,e.y,e.z),e},normalize:function(){this.computeBoundingSphere();var e=this.boundingSphere.center,t=this.boundingSphere.radius,r=0===t?1:1/t,i=new a.Matrix4;return i.set(r,0,0,-r*e.x,0,r,0,-r*e.y,0,0,r,-r*e.z,0,0,0,1),this.applyMatrix(i),this},computeFaceNormals:function(){for(var e=new a.Vector3,t=new a.Vector3,r=0,i=this.faces.length;r<i;r++){var n=this.faces[r],o=this.vertices[n.a],s=this.vertices[n.b],c=this.vertices[n.c];e.subVectors(c,s),t.subVectors(o,s),e.cross(t),e.normalize(),n.normal.copy(e)}},computeVertexNormals:function(e){void 0===e&&(e=!0);var t,r,i,n,o,s;for(s=new Array(this.vertices.length),t=0,r=this.vertices.length;t<r;t++)s[t]=new a.Vector3;if(e){var c,h,l,u=new a.Vector3,p=new a.Vector3;for(i=0,n=this.faces.length;i<n;i++)o=this.faces[i],c=this.vertices[o.a],h=this.vertices[o.b],l=this.vertices[o.c],u.subVectors(l,h),p.subVectors(c,h),u.cross(p),s[o.a].add(u),s[o.b].add(u),s[o.c].add(u)}else for(i=0,n=this.faces.length;i<n;i++)o=this.faces[i],s[o.a].add(o.normal),s[o.b].add(o.normal),s[o.c].add(o.normal);for(t=0,r=this.vertices.length;t<r;t++)s[t].normalize();for(i=0,n=this.faces.length;i<n;i++){o=this.faces[i];var d=o.vertexNormals;3===d.length?(d[0].copy(s[o.a]),d[1].copy(s[o.b]),d[2].copy(s[o.c])):(d[0]=s[o.a].clone(),d[1]=s[o.b].clone(),d[2]=s[o.c].clone())}this.faces.length>0&&(this.normalsNeedUpdate=!0)},computeMorphNormals:function(){var e,t,r,i,n;for(r=0,i=this.faces.length;r<i;r++)for(n=this.faces[r],n.__originalFaceNormal?n.__originalFaceNormal.copy(n.normal):n.__originalFaceNormal=n.normal.clone(),n.__originalVertexNormals||(n.__originalVertexNormals=[]),e=0,t=n.vertexNormals.length;e<t;e++)n.__originalVertexNormals[e]?n.__originalVertexNormals[e].copy(n.vertexNormals[e]):n.__originalVertexNormals[e]=n.vertexNormals[e].clone();var o=new a.Geometry;for(o.faces=this.faces,e=0,t=this.morphTargets.length;e<t;e++){if(!this.morphNormals[e]){this.morphNormals[e]={},this.morphNormals[e].faceNormals=[],this.morphNormals[e].vertexNormals=[];var s,c,h=this.morphNormals[e].faceNormals,l=this.morphNormals[e].vertexNormals;for(r=0,i=this.faces.length;r<i;r++)s=new a.Vector3,c={a:new a.Vector3,b:new a.Vector3,c:new a.Vector3},h.push(s),l.push(c)}var u=this.morphNormals[e];o.vertices=this.morphTargets[e].vertices,o.computeFaceNormals(),o.computeVertexNormals();var s,c;for(r=0,i=this.faces.length;r<i;r++)n=this.faces[r],s=u.faceNormals[r],c=u.vertexNormals[r],s.copy(n.normal),c.a.copy(n.vertexNormals[0]),c.b.copy(n.vertexNormals[1]),c.c.copy(n.vertexNormals[2])}for(r=0,i=this.faces.length;r<i;r++)n=this.faces[r],n.normal=n.__originalFaceNormal,n.vertexNormals=n.__originalVertexNormals},computeTangents:function(){console.warn("THREE.Geometry: .computeTangents() has been removed.")},computeLineDistances:function(){for(var e=0,t=this.vertices,r=0,i=t.length;r<i;r++)r>0&&(e+=t[r].distanceTo(t[r-1])),this.lineDistances[r]=e},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(e,t,r){if(e instanceof a.Geometry==!1)return void console.error("THREE.Geometry.merge(): geometry not an instance of THREE.Geometry.",e);var i,n=this.vertices.length,o=this.vertices,s=e.vertices,c=this.faces,h=e.faces,l=this.faceVertexUvs[0],u=e.faceVertexUvs[0];void 0===r&&(r=0),void 0!==t&&(i=(new a.Matrix3).getNormalMatrix(t));for(var p=0,d=s.length;p<d;p++){var f=s[p],m=f.clone();void 0!==t&&m.applyMatrix4(t),o.push(m)}for(p=0,d=h.length;p<d;p++){var g,v,y,x=h[p],b=x.vertexNormals,_=x.vertexColors;g=new a.Face3(x.a+n,x.b+n,x.c+n),g.normal.copy(x.normal),void 0!==i&&g.normal.applyMatrix3(i).normalize();for(var M=0,w=b.length;M<w;M++)v=b[M].clone(),void 0!==i&&v.applyMatrix3(i).normalize(),g.vertexNormals.push(v);g.color.copy(x.color);for(var M=0,w=_.length;M<w;M++)y=_[M],g.vertexColors.push(y.clone());g.materialIndex=x.materialIndex+r,c.push(g)}for(p=0,d=u.length;p<d;p++){var S=u[p],E=[];if(void 0!==S){for(var M=0,w=S.length;M<w;M++)E.push(S[M].clone());l.push(E)}}},mergeMesh:function(e){return e instanceof a.Mesh==!1?void console.error("THREE.Geometry.mergeMesh(): mesh not an instance of THREE.Mesh.",e):(e.matrixAutoUpdate&&e.updateMatrix(),void this.merge(e.geometry,e.matrix))},mergeVertices:function(){var e,t,r,i,n,a,o,s,c={},h=[],l=[],u=4,p=Math.pow(10,u);for(r=0,i=this.vertices.length;r<i;r++)e=this.vertices[r],t=Math.round(e.x*p)+"_"+Math.round(e.y*p)+"_"+Math.round(e.z*p),void 0===c[t]?(c[t]=r,h.push(this.vertices[r]),l[r]=h.length-1):l[r]=l[c[t]];var d=[];for(r=0,i=this.faces.length;r<i;r++){n=this.faces[r],n.a=l[n.a],n.b=l[n.b],n.c=l[n.c],a=[n.a,n.b,n.c];for(var f=-1,m=0;m<3;m++)if(a[m]===a[(m+1)%3]){f=m,d.push(r);break}}for(r=d.length-1;r>=0;r--){var g=d[r];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-h.length;return this.vertices=h,v},sortFacesByMaterialIndex:function(){function e(e,t){return e.materialIndex-t.materialIndex}for(var t=this.faces,r=t.length,i=0;i<r;i++)t[i]._id=i;t.sort(e);var n,a,o=this.faceVertexUvs[0],s=this.faceVertexUvs[1];o&&o.length===r&&(n=[]),s&&s.length===r&&(a=[]);for(var i=0;i<r;i++){var c=t[i]._id;n&&n.push(o[c]),a&&a.push(s[c])}n&&(this.faceVertexUvs[0]=n),a&&(this.faceVertexUvs[1]=a)},toJSON:function(){function e(e,t,r){return r?e|1<<t:e&~(1<<t)}function t(e){var t=e.x.toString()+e.y.toString()+e.z.toString();return void 0!==p[t]?p[t]:(p[t]=u.length/3,u.push(e.x,e.y,e.z),p[t])}function r(e){var t=e.r.toString()+e.g.toString()+e.b.toString();return void 0!==f[t]?f[t]:(f[t]=d.length,d.push(e.getHex()),f[t])}function i(e){var t=e.x.toString()+e.y.toString();return void 0!==g[t]?g[t]:(g[t]=m.length/2,m.push(e.x,e.y),g[t])}var n={metadata:{version:4.4,type:"Geometry",generator:"Geometry.toJSON"}};if(n.uuid=this.uuid,n.type=this.type,""!==this.name&&(n.name=this.name),void 0!==this.parameters){var a=this.parameters;for(var o in a)void 0!==a[o]&&(n[o]=a[o]);return n}for(var s=[],c=0;c<this.vertices.length;c++){var h=this.vertices[c];s.push(h.x,h.y,h.z)}for(var l=[],u=[],p={},d=[],f={},m=[],g={},c=0;c<this.faces.length;c++){var v=this.faces[c],y=!0,x=!1,b=void 0!==this.faceVertexUvs[0][c],_=v.normal.length()>0,M=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=e(E,0,0),E=e(E,1,y),E=e(E,2,x),E=e(E,3,b),E=e(E,4,_),E=e(E,5,M),E=e(E,6,w),E=e(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(i(T[0]),i(T[1]),i(T[2]))}if(_&&l.push(t(v.normal)),M){var A=v.vertexNormals;l.push(t(A[0]),t(A[1]),t(A[2]))}if(w&&l.push(r(v.color)),S){var L=v.vertexColors;l.push(r(L[0]),r(L[1]),r(L[2]))}}return n.data={},n.data.vertices=s,n.data.normals=u,d.length>0&&(n.data.colors=d),m.length>0&&(n.data.uvs=[m]),n.data.faces=l,n},clone:function(){return(new a.Geometry).copy(this)},copy:function(e){this.vertices=[],this.faces=[],this.faceVertexUvs=[[]];for(var t=e.vertices,r=0,i=t.length;r<i;r++)this.vertices.push(t[r].clone());for(var n=e.faces,r=0,i=n.length;r<i;r++)this.faces.push(n[r].clone());for(var r=0,i=e.faceVertexUvs.length;r<i;r++){var a=e.faceVertexUvs[r];void 0===this.faceVertexUvs[r]&&(this.faceVertexUvs[r]=[]);for(var o=0,s=a.length;o<s;o++){for(var c=a[o],h=[],l=0,u=c.length;l<u;l++){var p=c[l];h.push(p.clone())}this.faceVertexUvs[r].push(h)}}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(e){for(var t,r,i=[],n=e.faces,a=0;a<n.length;a++){var o=n[a];o.materialIndex!==r&&(r=o.materialIndex,void 0!==t&&(t.count=3*a-t.start,i.push(t)),t={start:3*a,materialIndex:r})}void 0!==t&&(t.count=3*a-t.start,i.push(t)),this.groups=i},fromGeometry:function(e){var t,r=e.faces,i=e.vertices,n=e.faceVertexUvs,o=n[0]&&n[0].length>0,s=n[1]&&n[1].length>0,c=e.morphTargets,h=c.length;if(h>0){t=[];for(var l=0;l<h;l++)t[l]=[];this.morphTargets.position=t}var u,p=e.morphNormals,d=p.length;if(d>0){u=[];for(var l=0;l<d;l++)u[l]=[];this.morphTargets.normal=u}for(var f=e.skinIndices,m=e.skinWeights,g=f.length===i.length,v=m.length===i.length,l=0;l<r.length;l++){var y=r[l];this.vertices.push(i[y.a],i[y.b],i[y.c]);var x=y.vertexNormals;if(3===x.length)this.normals.push(x[0],x[1],x[2]);else{var b=y.normal;this.normals.push(b,b,b)}var _=y.vertexColors;if(3===_.length)this.colors.push(_[0],_[1],_[2]);else{var M=y.color;this.colors.push(M,M,M)}if(o===!0){var w=n[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=n[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<h;S++){var E=c[S].vertices;t[S].push(E[y.a],E[y.b],E[y.c])}for(var S=0;S<d;S++){var T=p[S].vertexNormals[l];u[S].push(T.a,T.b,T.c)}g&&this.skinIndices.push(f[y.a],f[y.b],f[y.c]),v&&this.skinWeights.push(m[y.a],m[y.b],m[y.c])}return this.computeGroups(e),this.verticesNeedUpdate=e.verticesNeedUpdate,this.normalsNeedUpdate=e.normalsNeedUpdate,this.colorsNeedUpdate=e.colorsNeedUpdate,this.uvsNeedUpdate=e.uvsNeedUpdate,this.groupsNeedUpdate=e.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(e){this.index=e},addAttribute:function(e,t){return t instanceof a.BufferAttribute==!1&&t instanceof a.InterleavedBufferAttribute==!1?(console.warn("THREE.BufferGeometry: .addAttribute() now expects ( name, attribute )."),void this.addAttribute(e,new a.BufferAttribute(arguments[1],arguments[2]))):"index"===e?(console.warn("THREE.BufferGeometry.addAttribute: Use .setIndex() for index attribute."),void this.setIndex(t)):(this.attributes[e]=t,this)},getAttribute:function(e){return this.attributes[e]},removeAttribute:function(e){return delete this.attributes[e],this},addGroup:function(e,t,r){this.groups.push({start:e,count:t,materialIndex:void 0!==r?r:0})},clearGroups:function(){this.groups=[]},setDrawRange:function(e,t){this.drawRange.start=e,this.drawRange.count=t},applyMatrix:function(e){var t=this.attributes.position;void 0!==t&&(e.applyToVector3Array(t.array),t.needsUpdate=!0);var r=this.attributes.normal;if(void 0!==r){var i=(new a.Matrix3).getNormalMatrix(e);i.applyToVector3Array(r.array),r.needsUpdate=!0}return null!==this.boundingBox&&this.computeBoundingBox(),null!==this.boundingSphere&&this.computeBoundingSphere(),this},rotateX:function(){var e;return function(t){return void 0===e&&(e=new a.Matrix4),e.makeRotationX(t),this.applyMatrix(e),this}}(),rotateY:function(){var e;return function(t){return void 0===e&&(e=new a.Matrix4),e.makeRotationY(t),this.applyMatrix(e),this}}(),rotateZ:function(){var e;return function(t){return void 0===e&&(e=new a.Matrix4),e.makeRotationZ(t),this.applyMatrix(e),this}}(),translate:function(){var e;return function(t,r,i){return void 0===e&&(e=new a.Matrix4),e.makeTranslation(t,r,i),this.applyMatrix(e),this}}(),scale:function(){var e;return function(t,r,i){return void 0===e&&(e=new a.Matrix4),e.makeScale(t,r,i),this.applyMatrix(e),this}}(),lookAt:function(){var e;return function(t){void 0===e&&(e=new a.Object3D),e.lookAt(t),e.updateMatrix(),this.applyMatrix(e.matrix)}}(),center:function(){this.computeBoundingBox();var e=this.boundingBox.center().negate();return this.translate(e.x,e.y,e.z),e},setFromObject:function(e){var t=e.geometry;if(e instanceof a.Points||e instanceof a.Line){var r=new a.Float32Attribute(3*t.vertices.length,3),i=new a.Float32Attribute(3*t.colors.length,3);if(this.addAttribute("position",r.copyVector3sArray(t.vertices)),this.addAttribute("color",i.copyColorsArray(t.colors)),t.lineDistances&&t.lineDistances.length===t.vertices.length){var n=new a.Float32Attribute(t.lineDistances.length,1);this.addAttribute("lineDistance",n.copyArray(t.lineDistances))}null!==t.boundingSphere&&(this.boundingSphere=t.boundingSphere.clone()),null!==t.boundingBox&&(this.boundingBox=t.boundingBox.clone())}else e instanceof a.Mesh&&t instanceof a.Geometry&&this.fromGeometry(t);return this},updateFromObject:function(e){var t=e.geometry;if(e instanceof a.Mesh){var r=t.__directGeometry;if(void 0===r)return this.fromGeometry(t);r.verticesNeedUpdate=t.verticesNeedUpdate,r.normalsNeedUpdate=t.normalsNeedUpdate,r.colorsNeedUpdate=t.colorsNeedUpdate,r.uvsNeedUpdate=t.uvsNeedUpdate,r.groupsNeedUpdate=t.groupsNeedUpdate,t.verticesNeedUpdate=!1,t.normalsNeedUpdate=!1,t.colorsNeedUpdate=!1,t.uvsNeedUpdate=!1,t.groupsNeedUpdate=!1,t=r}if(t.verticesNeedUpdate===!0){var i=this.attributes.position;void 0!==i&&(i.copyVector3sArray(t.vertices),i.needsUpdate=!0),t.verticesNeedUpdate=!1}if(t.normalsNeedUpdate===!0){var i=this.attributes.normal;void 0!==i&&(i.copyVector3sArray(t.normals),i.needsUpdate=!0),t.normalsNeedUpdate=!1}if(t.colorsNeedUpdate===!0){var i=this.attributes.color;void 0!==i&&(i.copyColorsArray(t.colors),i.needsUpdate=!0),t.colorsNeedUpdate=!1}if(t.uvsNeedUpdate){var i=this.attributes.uv;void 0!==i&&(i.copyVector2sArray(t.uvs),i.needsUpdate=!0),t.uvsNeedUpdate=!1}if(t.lineDistancesNeedUpdate){var i=this.attributes.lineDistance;void 0!==i&&(i.copyArray(t.lineDistances),i.needsUpdate=!0),t.lineDistancesNeedUpdate=!1}return t.groupsNeedUpdate&&(t.computeGroups(e.geometry),this.groups=t.groups,t.groupsNeedUpdate=!1),this},fromGeometry:function(e){return e.__directGeometry=(new a.DirectGeometry).fromGeometry(e),this.fromDirectGeometry(e.__directGeometry)},fromDirectGeometry:function(e){var t=new Float32Array(3*e.vertices.length);if(this.addAttribute("position",new a.BufferAttribute(t,3).copyVector3sArray(e.vertices)),e.normals.length>0){var r=new Float32Array(3*e.normals.length);this.addAttribute("normal",new a.BufferAttribute(r,3).copyVector3sArray(e.normals))}if(e.colors.length>0){var i=new Float32Array(3*e.colors.length);this.addAttribute("color",new a.BufferAttribute(i,3).copyColorsArray(e.colors))}if(e.uvs.length>0){var n=new Float32Array(2*e.uvs.length);this.addAttribute("uv",new a.BufferAttribute(n,2).copyVector2sArray(e.uvs))}if(e.uvs2.length>0){var o=new Float32Array(2*e.uvs2.length);this.addAttribute("uv2",new a.BufferAttribute(o,2).copyVector2sArray(e.uvs2))}if(e.indices.length>0){var s=e.vertices.length>65535?Uint32Array:Uint16Array,c=new s(3*e.indices.length);this.setIndex(new a.BufferAttribute(c,1).copyIndicesArray(e.indices))}this.groups=e.groups;for(var h in e.morphTargets){for(var l=[],u=e.morphTargets[h],p=0,d=u.length;p<d;p++){var f=u[p],m=new a.Float32Attribute(3*f.length,3);l.push(m.copyVector3sArray(f))}this.morphAttributes[h]=l}if(e.skinIndices.length>0){var g=new a.Float32Attribute(4*e.skinIndices.length,4);this.addAttribute("skinIndex",g.copyVector4sArray(e.skinIndices))}if(e.skinWeights.length>0){var v=new a.Float32Attribute(4*e.skinWeights.length,4);this.addAttribute("skinWeight",v.copyVector4sArray(e.skinWeights))}return null!==e.boundingSphere&&(this.boundingSphere=e.boundingSphere.clone()),null!==e.boundingBox&&(this.boundingBox=e.boundingBox.clone()),this},computeBoundingBox:function(){null===this.boundingBox&&(this.boundingBox=new a.Box3);var e=this.attributes.position.array;void 0!==e?this.boundingBox.setFromArray(e):this.boundingBox.makeEmpty(),(isNaN(this.boundingBox.min.x)||isNaN(this.boundingBox.min.y)||isNaN(this.boundingBox.min.z))&&console.error('THREE.BufferGeometry.computeBoundingBox: Computed min/max have NaN values. The "position" attribute is likely to have NaN values.',this)},computeBoundingSphere:function(){var e=new a.Box3,t=new a.Vector3;return function(){null===this.boundingSphere&&(this.boundingSphere=new a.Sphere);var r=this.attributes.position;if(r){var i=r.array,n=this.boundingSphere.center;e.setFromArray(i),e.center(n);for(var o=0,s=0,c=i.length;s<c;s+=3)t.fromArray(i,s),o=Math.max(o,n.distanceToSquared(t));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 e=this.index,t=this.attributes,r=this.groups;if(t.position){var i=t.position.array;if(void 0===t.normal)this.addAttribute("normal",new a.BufferAttribute(new Float32Array(i.length),3));else for(var n=t.normal.array,o=0,s=n.length;o<s;o++)n[o]=0;var c,h,l,u=t.normal.array,p=new a.Vector3,d=new a.Vector3,f=new a.Vector3,m=new a.Vector3,g=new a.Vector3;if(e){var v=e.array;0===r.length&&this.addGroup(0,v.length);for(var y=0,x=r.length;y<x;++y)for(var b=r[y],_=b.start,M=b.count,o=_,s=_+M;o<s;o+=3)c=3*v[o+0],h=3*v[o+1],l=3*v[o+2],p.fromArray(i,c),d.fromArray(i,h),f.fromArray(i,l),m.subVectors(f,d),g.subVectors(p,d),m.cross(g),u[c]+=m.x,u[c+1]+=m.y,u[c+2]+=m.z,u[h]+=m.x,u[h+1]+=m.y,u[h+2]+=m.z,u[l]+=m.x,u[l+1]+=m.y,u[l+2]+=m.z}else for(var o=0,s=i.length;o<s;o+=9)p.fromArray(i,o),d.fromArray(i,o+3),f.fromArray(i,o+6),m.subVectors(f,d),g.subVectors(p,d),m.cross(g),u[o]=m.x,u[o+1]=m.y,u[o+2]=m.z,u[o+3]=m.x,u[o+4]=m.y,u[o+5]=m.z,
+u[o+6]=m.x,u[o+7]=m.y,u[o+8]=m.z;this.normalizeNormals(),t.normal.needsUpdate=!0}},merge:function(e,t){if(e instanceof a.BufferGeometry==!1)return void console.error("THREE.BufferGeometry.merge(): geometry not an instance of THREE.BufferGeometry.",e);void 0===t&&(t=0);var r=this.attributes;for(var i in r)if(void 0!==e.attributes[i])for(var n=r[i],o=n.array,s=e.attributes[i],c=s.array,h=s.itemSize,l=0,u=h*t;l<c.length;l++,u++)o[u]=c[l];return this},normalizeNormals:function(){for(var e,t,r,i,n=this.attributes.normal.array,a=0,o=n.length;a<o;a+=3)e=n[a],t=n[a+1],r=n[a+2],i=1/Math.sqrt(e*e+t*t+r*r),n[a]*=i,n[a+1]*=i,n[a+2]*=i},toNonIndexed:function(){if(null===this.index)return console.warn("THREE.BufferGeometry.toNonIndexed(): Geometry is already non-indexed."),this;var e=new a.BufferGeometry,t=this.index.array,r=this.attributes;for(var i in r){for(var n=r[i],o=n.array,s=n.itemSize,c=new o.constructor(t.length*s),h=0,l=0,u=0,p=t.length;u<p;u++){h=t[u]*s;for(var d=0;d<s;d++)c[l++]=o[h++]}e.addAttribute(i,new a.BufferAttribute(c,s))}return e},toJSON:function(){var e={metadata:{version:4.4,type:"BufferGeometry",generator:"BufferGeometry.toJSON"}};if(e.uuid=this.uuid,e.type=this.type,""!==this.name&&(e.name=this.name),void 0!==this.parameters){var t=this.parameters;for(var r in t)void 0!==t[r]&&(e[r]=t[r]);return e}e.data={attributes:{}};var i=this.index;if(null!==i){var n=Array.prototype.slice.call(i.array);e.data.index={type:i.array.constructor.name,array:n}}var a=this.attributes;for(var r in a){var o=a[r],n=Array.prototype.slice.call(o.array);e.data.attributes[r]={itemSize:o.itemSize,type:o.array.constructor.name,array:n,normalized:o.normalized}}var s=this.groups;s.length>0&&(e.data.groups=JSON.parse(JSON.stringify(s)));var c=this.boundingSphere;return null!==c&&(e.data.boundingSphere={center:c.center.toArray(),radius:c.radius}),e},clone:function(){return(new a.BufferGeometry).copy(this)},copy:function(e){var t=e.index;null!==t&&this.setIndex(t.clone());var r=e.attributes;for(var i in r){var n=r[i];this.addAttribute(i,n.clone())}for(var a=e.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(e,t,r){this.groups.push({start:e,count:t,instances:r})},a.InstancedBufferGeometry.prototype.copy=function(e){var t=e.index;null!==t&&this.setIndex(t.clone());var r=e.attributes;for(var i in r){var n=r[i];this.addAttribute(i,n.clone())}for(var a=e.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(e){"string"==typeof e&&(console.warn("THREE.Uniform: Type parameter is no longer needed."),e=arguments[1]),this.value=e,this.dynamic=!1},a.Uniform.prototype={constructor:a.Uniform,onUpdate:function(e){return this.dynamic=!0,this.onUpdateCallback=e,this}},a.AnimationAction=function(){throw new Error("THREE.AnimationAction: Use mixer.clipAction for construction.")},a.AnimationAction._new=function(e,t,r){this._mixer=e,this._clip=t,this._localRoot=r||null;for(var i=t.tracks,n=i.length,o=new Array(n),s={endingStart:a.ZeroCurvatureEnding,endingEnd:a.ZeroCurvatureEnding},c=0;c!==n;++c){var h=i[c].createInterpolant(null);o[c]=h,h.settings=s}this._interpolantSettings=s,this._interpolants=o,this._propertyBindings=new Array(n),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(e){return this._startTime=e,this},setLoop:function(e,t){return this.loop=e,this.repetitions=t,this},setEffectiveWeight:function(e){return this.weight=e,this._effectiveWeight=this.enabled?e:0,this.stopFading()},getEffectiveWeight:function(){return this._effectiveWeight},fadeIn:function(e){return this._scheduleFading(e,0,1)},fadeOut:function(e){return this._scheduleFading(e,1,0)},crossFadeFrom:function(e,t,r){this._mixer;if(e.fadeOut(t),this.fadeIn(t),r){var i=this._clip.duration,n=e._clip.duration,a=n/i,o=i/n;e.warp(1,a,t),this.warp(o,1,t)}return this},crossFadeTo:function(e,t,r){return e.crossFadeFrom(this,t,r)},stopFading:function(){var e=this._weightInterpolant;return null!==e&&(this._weightInterpolant=null,this._mixer._takeBackControlInterpolant(e)),this},setEffectiveTimeScale:function(e){return this.timeScale=e,this._effectiveTimeScale=this.paused?0:e,this.stopWarping()},getEffectiveTimeScale:function(){return this._effectiveTimeScale},setDuration:function(e){return this.timeScale=this._clip.duration/e,this.stopWarping()},syncWith:function(e){return this.time=e.time,this.timeScale=e.timeScale,this.stopWarping()},halt:function(e){return this.warp(this._effectiveTimeScale,0,e)},warp:function(e,t,r){var i=this._mixer,n=i.time,a=this._timeScaleInterpolant,o=this.timeScale;null===a&&(a=i._lendControlInterpolant(),this._timeScaleInterpolant=a);var s=a.parameterPositions,c=a.sampleValues;return s[0]=n,s[1]=n+r,c[0]=e/o,c[1]=t/o,this},stopWarping:function(){var e=this._timeScaleInterpolant;return null!==e&&(this._timeScaleInterpolant=null,this._mixer._takeBackControlInterpolant(e)),this},getMixer:function(){return this._mixer},getClip:function(){return this._clip},getRoot:function(){return this._localRoot||this._mixer._root},_update:function(e,t,r,i){var n=this._startTime;if(null!==n){var a=(e-n)*r;if(a<0||0===r)return;this._startTime=null,t=r*a}t*=this._updateTimeScale(e);var o=this._updateTime(t),s=this._updateWeight(e);if(s>0)for(var c=this._interpolants,h=this._propertyBindings,l=0,u=c.length;l!==u;++l)c[l].evaluate(o),h[l].accumulate(i,s)},_updateWeight:function(e){var t=0;if(this.enabled){t=this.weight;var r=this._weightInterpolant;if(null!==r){var i=r.evaluate(e)[0];t*=i,e>r.parameterPositions[1]&&(this.stopFading(),0===i&&(this.enabled=!1))}}return this._effectiveWeight=t,t},_updateTimeScale:function(e){var t=0;if(!this.paused){t=this.timeScale;var r=this._timeScaleInterpolant;if(null!==r){var i=r.evaluate(e)[0];t*=i,e>r.parameterPositions[1]&&(this.stopWarping(),0===t?this.paused=!0:this.timeScale=t)}}return this._effectiveTimeScale=t,t},_updateTime:function(e){var t=this.time+e;if(0===e)return t;var r=this._clip.duration,i=this.loop,n=this._loopCount;if(i===a.LoopOnce){n===-1&&(this.loopCount=0,this._setEndings(!0,!0,!1));e:{if(t>=r)t=r;else{if(!(t<0))break e;t=0}this.clampWhenFinished?this.paused=!0:this.enabled=!1,this._mixer.dispatchEvent({type:"finished",action:this,direction:e<0?-1:1})}}else{var o=i===a.LoopPingPong;if(n===-1&&(e>=0?(n=0,this._setEndings(!0,0===this.repetitions,o)):this._setEndings(0===this.repetitions,!0,o)),t>=r||t<0){var s=Math.floor(t/r);t-=r*s,n+=Math.abs(s);var c=this.repetitions-n;if(c<0)this.clampWhenFinished?this.paused=!0:this.enabled=!1,t=e>0?r:0,this._mixer.dispatchEvent({type:"finished",action:this,direction:e>0?1:-1});else{if(0===c){var h=e<0;this._setEndings(h,!h,o)}else this._setEndings(!1,!1,o);this._loopCount=n,this._mixer.dispatchEvent({type:"loop",action:this,loopDelta:s})}}if(o&&1===(1&n))return this.time=t,r-t}return this.time=t,t},_setEndings:function(e,t,r){var i=this._interpolantSettings;r?(i.endingStart=a.ZeroSlopeEnding,i.endingEnd=a.ZeroSlopeEnding):(e?i.endingStart=this.zeroSlopeAtStart?a.ZeroSlopeEnding:a.ZeroCurvatureEnding:i.endingStart=a.WrapAroundEnding,t?i.endingEnd=this.zeroSlopeAtEnd?a.ZeroSlopeEnding:a.ZeroCurvatureEnding:i.endingEnd=a.WrapAroundEnding)},_scheduleFading:function(e,t,r){var i=this._mixer,n=i.time,a=this._weightInterpolant;null===a&&(a=i._lendControlInterpolant(),this._weightInterpolant=a);var o=a.parameterPositions,s=a.sampleValues;return o[0]=n,s[0]=t,o[1]=n+e,s[1]=r,this}},a.AnimationClip=function(e,t,r){this.name=e,this.tracks=r,this.duration=void 0!==t?t:-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 e=this.tracks,t=0,r=0,i=e.length;r!==i;++r){var n=this.tracks[r];t=Math.max(t,n.times[n.times.length-1])}this.duration=t},trim:function(){for(var e=0;e<this.tracks.length;e++)this.tracks[e].trim(0,this.duration);return this},optimize:function(){for(var e=0;e<this.tracks.length;e++)this.tracks[e].optimize();return this}},Object.assign(a.AnimationClip,{parse:function(e){for(var t=[],r=e.tracks,i=1/(e.fps||1),n=0,o=r.length;n!==o;++n)t.push(a.KeyframeTrack.parse(r[n]).scale(i));return new a.AnimationClip(e.name,e.duration,t)},toJSON:function(e){for(var t=[],r=e.tracks,i={name:e.name,duration:e.duration,tracks:t},n=0,o=r.length;n!==o;++n)t.push(a.KeyframeTrack.toJSON(r[n]));return i},CreateFromMorphTargetSequence:function(e,t,r,i){for(var n=t.length,o=[],s=0;s<n;s++){var c=[],h=[];c.push((s+n-1)%n,s,(s+1)%n),h.push(0,1,0);var l=a.AnimationUtils.getKeyframeOrder(c);c=a.AnimationUtils.sortedArray(c,1,l),h=a.AnimationUtils.sortedArray(h,1,l),i||0!==c[0]||(c.push(n),h.push(h[0])),o.push(new a.NumberKeyframeTrack(".morphTargetInfluences["+t[s].name+"]",c,h).scale(1/r))}return new a.AnimationClip(e,(-1),o)},findByName:function(e,t){var r=e;if(!Array.isArray(e)){var i=e;r=i.geometry&&i.geometry.animations||i.animations}for(var n=0;n<r.length;n++)if(r[n].name===t)return r[n];return null},CreateClipsFromMorphTargetSequences:function(e,t,r){for(var i={},n=/^([\w-]*?)([\d]+)$/,o=0,s=e.length;o<s;o++){var c=e[o],h=c.name.match(n);if(h&&h.length>1){var l=h[1],u=i[l];u||(i[l]=u=[]),u.push(c)}}var p=[];for(var l in i)p.push(a.AnimationClip.CreateFromMorphTargetSequence(l,i[l],t,r));return p},parseAnimation:function(e,t,r){if(!e)return console.error(" no animation in JSONLoader data"),null;for(var i=function(e,t,r,i,n){if(0!==r.length){var o=[],s=[];a.AnimationUtils.flattenJSON(r,o,s,i),0!==o.length&&n.push(new e(t,o,s))}},n=[],o=e.name||"default",s=e.length||-1,c=e.fps||30,h=e.hierarchy||[],l=0;l<h.length;l++){var u=h[l].keys;if(u&&0!==u.length)if(u[0].morphTargets){for(var p={},d=0;d<u.length;d++)if(u[d].morphTargets)for(var f=0;f<u[d].morphTargets.length;f++)p[u[d].morphTargets[f]]=-1;for(var m in p){for(var g=[],v=[],f=0;f!==u[d].morphTargets.length;++f){var y=u[d];g.push(y.time),v.push(y.morphTarget===m?1:0)}n.push(new a.NumberKeyframeTrack(".morphTargetInfluence["+m+"]",g,v))}s=p.length*(c||1)}else{var x=".bones["+t[l].name+"]";i(a.VectorKeyframeTrack,x+".position",u,"pos",n),i(a.QuaternionKeyframeTrack,x+".quaternion",u,"rot",n),i(a.VectorKeyframeTrack,x+".scale",u,"scl",n)}}if(0===n.length)return null;var b=new a.AnimationClip(o,s,n);return b}}),a.AnimationMixer=function(e){this._root=e,this._initMemoryManager(),this._accuIndex=0,this.time=0,this.timeScale=1},Object.assign(a.AnimationMixer.prototype,a.EventDispatcher.prototype,{clipAction:function(e,t){var r=t||this._root,i=r.uuid,n="string"==typeof e?a.AnimationClip.findByName(r,e):e,o=null!==n?n.uuid:e,s=this._actionsByClip[o],c=null;if(void 0!==s){var h=s.actionByRoot[i];if(void 0!==h)return h;c=s.knownActions[0],null===n&&(n=c._clip)}if(null===n)return null;var l=new a.AnimationMixer._Action(this,n,t);return this._bindAction(l,c),this._addInactiveAction(l,o,i),l},existingAction:function(e,t){var r=t||this._root,i=r.uuid,n="string"==typeof e?a.AnimationClip.findByName(r,e):e,o=n?n.uuid:e,s=this._actionsByClip[o];return void 0!==s?s.actionByRoot[i]||null:null},stopAllAction:function(){var e=this._actions,t=this._nActiveActions,r=this._bindings,i=this._nActiveBindings;this._nActiveActions=0,this._nActiveBindings=0;for(var n=0;n!==t;++n)e[n].reset();for(var n=0;n!==i;++n)r[n].useCount=0;return this},update:function(e){e*=this.timeScale;for(var t=this._actions,r=this._nActiveActions,i=this.time+=e,n=Math.sign(e),a=this._accuIndex^=1,o=0;o!==r;++o){var s=t[o];s.enabled&&s._update(i,e,n,a)}for(var c=this._bindings,h=this._nActiveBindings,o=0;o!==h;++o)c[o].apply(a);return this},getRoot:function(){return this._root},uncacheClip:function(e){var t=this._actions,r=e.uuid,i=this._actionsByClip,n=i[r];if(void 0!==n){for(var a=n.knownActions,o=0,s=a.length;o!==s;++o){var c=a[o];this._deactivateAction(c);var h=c._cacheIndex,l=t[t.length-1];c._cacheIndex=null,c._byClipCacheIndex=null,l._cacheIndex=h,t[h]=l,t.pop(),this._removeInactiveBindingsForAction(c)}delete i[r]}},uncacheRoot:function(e){var t=e.uuid,r=this._actionsByClip;for(var i in r){var n=r[i].actionByRoot,a=n[t];void 0!==a&&(this._deactivateAction(a),this._removeInactiveAction(a))}var o=this._bindingsByRootAndName,s=o[t];if(void 0!==s)for(var c in s){var h=s[c];h.restoreOriginalState(),this._removeInactiveBinding(h)}},uncacheAction:function(e,t){var r=this.existingAction(e,t);null!==r&&(this._deactivateAction(r),this._removeInactiveAction(r))}}),a.AnimationMixer._Action=a.AnimationAction._new,Object.assign(a.AnimationMixer.prototype,{_bindAction:function(e,t){var r=e._localRoot||this._root,i=e._clip.tracks,n=i.length,o=e._propertyBindings,s=e._interpolants,c=r.uuid,h=this._bindingsByRootAndName,l=h[c];void 0===l&&(l={},h[c]=l);for(var u=0;u!==n;++u){var p=i[u],d=p.name,f=l[d];if(void 0!==f)o[u]=f;else{if(f=o[u],void 0!==f){null===f._cacheIndex&&(++f.referenceCount,this._addInactiveBinding(f,c,d));continue}var m=t&&t._propertyBindings[u].binding.parsedPath;f=new a.PropertyMixer(a.PropertyBinding.create(r,d,m),p.ValueTypeName,p.getValueSize()),++f.referenceCount,this._addInactiveBinding(f,c,d),o[u]=f}s[u].resultBuffer=f.buffer}},_activateAction:function(e){if(!this._isActiveAction(e)){if(null===e._cacheIndex){var t=(e._localRoot||this._root).uuid,r=e._clip.uuid,i=this._actionsByClip[r];this._bindAction(e,i&&i.knownActions[0]),this._addInactiveAction(e,r,t)}for(var n=e._propertyBindings,a=0,o=n.length;a!==o;++a){var s=n[a];0===s.useCount++&&(this._lendBinding(s),s.saveOriginalState())}this._lendAction(e)}},_deactivateAction:function(e){if(this._isActiveAction(e)){for(var t=e._propertyBindings,r=0,i=t.length;r!==i;++r){var n=t[r];0===--n.useCount&&(n.restoreOriginalState(),this._takeBackBinding(n))}this._takeBackAction(e)}},_initMemoryManager:function(){this._actions=[],this._nActiveActions=0,this._actionsByClip={},this._bindings=[],this._nActiveBindings=0,this._bindingsByRootAndName={},this._controlInterpolants=[],this._nActiveControlInterpolants=0;var e=this;this.stats={actions:{get total(){return e._actions.length},get inUse(){return e._nActiveActions}},bindings:{get total(){return e._bindings.length},get inUse(){return e._nActiveBindings}},controlInterpolants:{get total(){return e._controlInterpolants.length},get inUse(){return e._nActiveControlInterpolants}}}},_isActiveAction:function(e){var t=e._cacheIndex;return null!==t&&t<this._nActiveActions},_addInactiveAction:function(e,t,r){var i=this._actions,n=this._actionsByClip,a=n[t];if(void 0===a)a={knownActions:[e],actionByRoot:{}},e._byClipCacheIndex=0,n[t]=a;else{var o=a.knownActions;e._byClipCacheIndex=o.length,o.push(e)}e._cacheIndex=i.length,i.push(e),a.actionByRoot[r]=e},_removeInactiveAction:function(e){var t=this._actions,r=t[t.length-1],i=e._cacheIndex;r._cacheIndex=i,t[i]=r,t.pop(),e._cacheIndex=null;var n=e._clip.uuid,a=this._actionsByClip,o=a[n],s=o.knownActions,c=s[s.length-1],h=e._byClipCacheIndex;c._byClipCacheIndex=h,s[h]=c,s.pop(),e._byClipCacheIndex=null;var l=o.actionByRoot,u=(t._localRoot||this._root).uuid;delete l[u],0===s.length&&delete a[n],this._removeInactiveBindingsForAction(e)},_removeInactiveBindingsForAction:function(e){for(var t=e._propertyBindings,r=0,i=t.length;r!==i;++r){var n=t[r];0===--n.referenceCount&&this._removeInactiveBinding(n)}},_lendAction:function(e){var t=this._actions,r=e._cacheIndex,i=this._nActiveActions++,n=t[i];e._cacheIndex=i,t[i]=e,n._cacheIndex=r,t[r]=n},_takeBackAction:function(e){var t=this._actions,r=e._cacheIndex,i=--this._nActiveActions,n=t[i];e._cacheIndex=i,t[i]=e,n._cacheIndex=r,t[r]=n},_addInactiveBinding:function(e,t,r){var i=this._bindingsByRootAndName,n=i[t],a=this._bindings;void 0===n&&(n={},i[t]=n),n[r]=e,e._cacheIndex=a.length,a.push(e)},_removeInactiveBinding:function(e){var t=this._bindings,r=e.binding,i=r.rootNode.uuid,n=r.path,a=this._bindingsByRootAndName,o=a[i],s=t[t.length-1],c=e._cacheIndex;s._cacheIndex=c,t[c]=s,t.pop(),delete o[n];e:{for(var h in o)break e;delete a[i]}},_lendBinding:function(e){var t=this._bindings,r=e._cacheIndex,i=this._nActiveBindings++,n=t[i];e._cacheIndex=i,t[i]=e,n._cacheIndex=r,t[r]=n},_takeBackBinding:function(e){var t=this._bindings,r=e._cacheIndex,i=--this._nActiveBindings,n=t[i];e._cacheIndex=i,t[i]=e,n._cacheIndex=r,t[r]=n},_lendControlInterpolant:function(){var e=this._controlInterpolants,t=this._nActiveControlInterpolants++,r=e[t];return void 0===r&&(r=new a.LinearInterpolant(new Float32Array(2),new Float32Array(2),1,this._controlInterpolantsResultBuffer),r.__cacheIndex=t,e[t]=r),r},_takeBackControlInterpolant:function(e){var t=this._controlInterpolants,r=e.__cacheIndex,i=--this._nActiveControlInterpolants,n=t[i];e.__cacheIndex=i,t[i]=e,n.__cacheIndex=r,t[r]=n},_controlInterpolantsResultBuffer:new Float32Array(1)}),a.AnimationObjectGroup=function(e){this.uuid=a.Math.generateUUID(),this._objects=Array.prototype.slice.call(arguments),this.nCachedObjects_=0;var t={};this._indicesByUUID=t;for(var r=0,i=arguments.length;r!==i;++r)t[arguments[r].uuid]=r;this._paths=[],this._parsedPaths=[],this._bindings=[],this._bindingsIndicesByPath={};var n=this;this.stats={objects:{get total(){return n._objects.length},get inUse(){return this.total-n.nCachedObjects_}},get bindingsPerObject(){return n._bindings.length}}},a.AnimationObjectGroup.prototype={constructor:a.AnimationObjectGroup,add:function(e){for(var t=this._objects,r=t.length,i=this.nCachedObjects_,n=this._indicesByUUID,o=this._paths,s=this._parsedPaths,c=this._bindings,h=c.length,l=0,u=arguments.length;l!==u;++l){var p=arguments[l],d=p.uuid,f=n[d];if(void 0===f){f=r++,n[d]=f,t.push(p);for(var m=0,g=h;m!==g;++m)c[m].push(new a.PropertyBinding(p,o[m],s[m]))}else if(f<i){var v=t[f],y=--i,x=t[y];n[x.uuid]=f,t[f]=x,n[d]=y,t[y]=p;for(var m=0,g=h;m!==g;++m){var b=c[m],_=b[y],M=b[f];b[f]=_,void 0===M&&(M=new a.PropertyBinding(p,o[m],s[m])),b[y]=M}}else t[f]!==v&&console.error("Different objects with the same UUID detected. Clean the caches or recreate your infrastructure when reloading scenes...")}this.nCachedObjects_=i},remove:function(e){for(var t=this._objects,r=(t.length,this.nCachedObjects_),i=this._indicesByUUID,n=this._bindings,a=n.length,o=0,s=arguments.length;o!==s;++o){var c=arguments[o],h=c.uuid,l=i[h];if(void 0!==l&&l>=r){var u=r++,p=t[u];i[p.uuid]=l,t[l]=p,i[h]=u,t[u]=c;for(var d=0,f=a;d!==f;++d){var m=n[d],g=m[u],v=m[l];m[l]=g,m[u]=v}}}this.nCachedObjects_=r},uncache:function(e){for(var t=this._objects,r=t.length,i=this.nCachedObjects_,n=this._indicesByUUID,a=this._bindings,o=a.length,s=0,c=arguments.length;s!==c;++s){var h=arguments[s],l=h.uuid,u=n[l];if(void 0!==u)if(delete n[l],u<i){var p=--i,d=t[p],f=--r,m=t[f];n[d.uuid]=u,t[u]=d,n[m.uuid]=p,t[p]=m,t.pop();for(var g=0,v=o;g!==v;++g){var y=a[g],x=y[p],b=y[f];y[u]=x,y[p]=b,y.pop()}}else{var f=--r,m=t[f];n[m.uuid]=u,t[u]=m,t.pop();for(var g=0,v=o;g!==v;++g){var y=a[g];y[u]=y[f],y.pop()}}}this.nCachedObjects_=i},subscribe_:function(e,t){var r=this._bindingsIndicesByPath,i=r[e],n=this._bindings;if(void 0!==i)return n[i];var o=this._paths,s=this._parsedPaths,c=this._objects,h=c.length,l=this.nCachedObjects_,u=new Array(h);i=n.length,r[e]=i,o.push(e),s.push(t),n.push(u);for(var p=l,d=c.length;p!==d;++p){var f=c[p];u[p]=new a.PropertyBinding(f,e,t)}return u},unsubscribe_:function(e){var t=this._bindingsIndicesByPath,r=t[e];if(void 0!==r){var i=this._paths,n=this._parsedPaths,a=this._bindings,o=a.length-1,s=a[o],c=e[o];t[c]=r,a[r]=s,a.pop(),n[r]=n[o],n.pop(),i[r]=i[o],i.pop()}}},a.AnimationUtils={arraySlice:function(e,t,r){return a.AnimationUtils.isTypedArray(e)?new e.constructor(e.subarray(t,r)):e.slice(t,r)},convertArray:function(e,t,r){return!e||!r&&e.constructor===t?e:"number"==typeof t.BYTES_PER_ELEMENT?new t(e):Array.prototype.slice.call(e)},isTypedArray:function(e){return ArrayBuffer.isView(e)&&!(e instanceof DataView)},getKeyframeOrder:function(e){function t(t,r){return e[t]-e[r]}for(var r=e.length,i=new Array(r),n=0;n!==r;++n)i[n]=n;return i.sort(t),i},sortedArray:function(e,t,r){for(var i=e.length,n=new e.constructor(i),a=0,o=0;o!==i;++a)for(var s=r[a]*t,c=0;c!==t;++c)n[o++]=e[s+c];return n},flattenJSON:function(e,t,r,i){for(var n=1,a=e[0];void 0!==a&&void 0===a[i];)a=e[n++];if(void 0!==a){var o=a[i];if(void 0!==o)if(Array.isArray(o)){do o=a[i],void 0!==o&&(t.push(a.time),r.push.apply(r,o)),a=e[n++];while(void 0!==a)}else if(void 0!==o.toArray){do o=a[i],void 0!==o&&(t.push(a.time),o.toArray(r,r.length)),a=e[n++];while(void 0!==a)}else do o=a[i],void 0!==o&&(t.push(a.time),r.push(o)),a=e[n++];while(void 0!==a)}}},a.KeyframeTrack=function(e,t,r,i){if(void 0===e)throw new Error("track name is undefined");if(void 0===t||0===t.length)throw new Error("no keyframes in track named "+e);this.name=e,this.times=a.AnimationUtils.convertArray(t,this.TimeBufferType),this.values=a.AnimationUtils.convertArray(r,this.ValueBufferType),this.setInterpolation(i||this.DefaultInterpolation),this.validate(),this.optimize()},a.KeyframeTrack.prototype={constructor:a.KeyframeTrack,TimeBufferType:Float32Array,ValueBufferType:Float32Array,DefaultInterpolation:a.InterpolateLinear,InterpolantFactoryMethodDiscrete:function(e){return new a.DiscreteInterpolant(this.times,this.values,this.getValueSize(),e)},InterpolantFactoryMethodLinear:function(e){return new a.LinearInterpolant(this.times,this.values,this.getValueSize(),e)},InterpolantFactoryMethodSmooth:function(e){return new a.CubicInterpolant(this.times,this.values,this.getValueSize(),e)},setInterpolation:function(e){var t;switch(e){case a.InterpolateDiscrete:t=this.InterpolantFactoryMethodDiscrete;break;case a.InterpolateLinear:t=this.InterpolantFactoryMethodLinear;break;case a.InterpolateSmooth:t=this.InterpolantFactoryMethodSmooth}if(void 0===t){var r="unsupported interpolation for "+this.ValueTypeName+" keyframe track named "+this.name;if(void 0===this.createInterpolant){if(e===this.DefaultInterpolation)throw new Error(r);this.setInterpolation(this.DefaultInterpolation)}return void console.warn(r)}this.createInterpolant=t},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(e){if(0!==e)for(var t=this.times,r=0,i=t.length;r!==i;++r)t[r]+=e;return this},scale:function(e){if(1!==e)for(var t=this.times,r=0,i=t.length;r!==i;++r)t[r]*=e;return this},trim:function(e,t){for(var r=this.times,i=r.length,n=0,o=i-1;n!==i&&r[n]<e;)++n;for(;o!==-1&&r[o]>t;)--o;if(++o,0!==n||o!==i){n>=o&&(o=Math.max(o,1),n=o-1);var s=this.getValueSize();this.times=a.AnimationUtils.arraySlice(r,n,o),this.values=a.AnimationUtils.arraySlice(this.values,n*s,o*s)}return this},validate:function(){var e=!0,t=this.getValueSize();t-Math.floor(t)!==0&&(console.error("invalid value size in track",this),e=!1);var r=this.times,i=this.values,n=r.length;0===n&&(console.error("track is empty",this),e=!1);for(var o=null,s=0;s!==n;s++){var c=r[s];if("number"==typeof c&&isNaN(c)){console.error("time is not a valid number",this,s,c),e=!1;break}if(null!==o&&o>c){console.error("out of order keys",this,s,c,o),e=!1;break}o=c}if(void 0!==i&&a.AnimationUtils.isTypedArray(i))for(var s=0,h=i.length;s!==h;++s){var l=i[s];if(isNaN(l)){console.error("value is not a valid number",this,s,l),e=!1;break}}return e},optimize:function(){for(var e=this.times,t=this.values,r=this.getValueSize(),i=1,n=1,o=e.length-1;n<=o;++n){var s=!1,c=e[n],h=e[n+1];if(c!==h&&(1!==n||c!==c[0]))for(var l=n*r,u=l-r,p=l+r,d=0;d!==r;++d){var f=t[l+d];if(f!==t[u+d]||f!==t[p+d]){s=!0;break}}if(s){if(n!==i){e[i]=e[n];for(var m=n*r,g=i*r,d=0;d!==r;++d)t[g+d]=t[m+d]}++i}}return i!==e.length&&(this.times=a.AnimationUtils.arraySlice(e,0,i),this.values=a.AnimationUtils.arraySlice(t,0,i*r)),this}},Object.assign(a.KeyframeTrack,{parse:function(e){if(void 0===e.type)throw new Error("track type undefined, can not parse");var t=a.KeyframeTrack._getTrackTypeForValueTypeName(e.type);if(void 0===e.times){var r=[],i=[];a.AnimationUtils.flattenJSON(e.keys,r,i,"value"),e.times=r,e.values=i}return void 0!==t.parse?t.parse(e):new t(e.name,e.times,e.values,e.interpolation)},toJSON:function(e){var t,r=e.constructor;if(void 0!==r.toJSON)t=r.toJSON(e);else{t={name:e.name,times:a.AnimationUtils.convertArray(e.times,Array),values:a.AnimationUtils.convertArray(e.values,Array)};var i=e.getInterpolation();i!==e.DefaultInterpolation&&(t.interpolation=i)}return t.type=e.ValueTypeName,t},_getTrackTypeForValueTypeName:function(e){switch(e.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: "+e)}}),a.PropertyBinding=function(e,t,r){this.path=t,this.parsedPath=r||a.PropertyBinding.parseTrackName(t),this.node=a.PropertyBinding.findNode(e,this.parsedPath.nodeName)||e,this.rootNode=e},a.PropertyBinding.prototype={constructor:a.PropertyBinding,getValue:function(e,t){this.bind(),this.getValue(e,t)},setValue:function(e,t){this.bind(),this.setValue(e,t)},bind:function(){var e=this.node,t=this.parsedPath,r=t.objectName,i=t.propertyName,n=t.propertyIndex;if(e||(e=a.PropertyBinding.findNode(this.rootNode,t.nodeName)||this.rootNode,this.node=e),this.getValue=this._getValue_unavailable,this.setValue=this._setValue_unavailable,!e)return void console.error(" trying to update node for track: "+this.path+" but it wasn't found.");if(r){var o=t.objectIndex;switch(r){case"materials":if(!e.material)return void console.error(" can not bind to material as node does not have a material",this);if(!e.material.materials)return void console.error(" can not bind to material.materials as node.material does not have a materials array",this);e=e.material.materials;break;case"bones":if(!e.skeleton)return void console.error(" can not bind to bones as node does not have a skeleton",this);e=e.skeleton.bones;for(var s=0;s<e.length;s++)if(e[s].name===o){o=s;break}break;default:if(void 0===e[r])return void console.error(" can not bind to objectName of node, undefined",this);e=e[r]}if(void 0!==o){if(void 0===e[o])return void console.error(" trying to bind to objectIndex of objectName, but is undefined:",this,e);e=e[o]}}var c=e[i];if(void 0===c){var h=t.nodeName;return void console.error(" trying to update property for track: "+h+"."+i+" but it wasn't found.",e)}var l=this.Versioning.None;void 0!==e.needsUpdate?(l=this.Versioning.NeedsUpdate,this.targetObject=e):void 0!==e.matrixWorldNeedsUpdate&&(l=this.Versioning.MatrixWorldNeedsUpdate,this.targetObject=e);var u=this.BindingType.Direct;if(void 0!==n){if("morphTargetInfluences"===i){if(!e.geometry)return void console.error(" can not bind to morphTargetInfluences becasuse node does not have a geometry",this);if(!e.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(e.geometry.morphTargets[s].name===n){n=s;break}}u=this.BindingType.ArrayElement,this.resolvedProperty=c,this.propertyIndex=n}else void 0!==c.fromArray&&void 0!==c.toArray?(u=this.BindingType.HasFromToArray,this.resolvedProperty=c):void 0!==c.length?(u=this.BindingType.EntireArray,this.resolvedProperty=c):this.propertyName=i;this.getValue=this.GetterByBindingType[u],this.setValue=this.SetterByBindingTypeAndVersioning[u][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(e,t){e[t]=this.node[this.propertyName]},function(e,t){for(var r=this.resolvedProperty,i=0,n=r.length;i!==n;++i)e[t++]=r[i]},function(e,t){e[t]=this.resolvedProperty[this.propertyIndex]},function(e,t){this.resolvedProperty.toArray(e,t)}],SetterByBindingTypeAndVersioning:[[function(e,t){this.node[this.propertyName]=e[t]},function(e,t){this.node[this.propertyName]=e[t],this.targetObject.needsUpdate=!0},function(e,t){this.node[this.propertyName]=e[t],this.targetObject.matrixWorldNeedsUpdate=!0}],[function(e,t){for(var r=this.resolvedProperty,i=0,n=r.length;i!==n;++i)r[i]=e[t++]},function(e,t){for(var r=this.resolvedProperty,i=0,n=r.length;i!==n;++i)r[i]=e[t++];this.targetObject.needsUpdate=!0},function(e,t){for(var r=this.resolvedProperty,i=0,n=r.length;i!==n;++i)r[i]=e[t++];this.targetObject.matrixWorldNeedsUpdate=!0}],[function(e,t){this.resolvedProperty[this.propertyIndex]=e[t]},function(e,t){this.resolvedProperty[this.propertyIndex]=e[t],this.targetObject.needsUpdate=!0},function(e,t){this.resolvedProperty[this.propertyIndex]=e[t],this.targetObject.matrixWorldNeedsUpdate=!0}],[function(e,t){this.resolvedProperty.fromArray(e,t)},function(e,t){this.resolvedProperty.fromArray(e,t),this.targetObject.needsUpdate=!0},function(e,t){this.resolvedProperty.fromArray(e,t),this.targetObject.matrixWorldNeedsUpdate=!0}]]}),a.PropertyBinding.Composite=function(e,t,r){var i=r||a.PropertyBinding.parseTrackName(t);this._targetGroup=e,this._bindings=e.subscribe_(t,i)},a.PropertyBinding.Composite.prototype={constructor:a.PropertyBinding.Composite,getValue:function(e,t){this.bind();var r=this._targetGroup.nCachedObjects_,i=this._bindings[r];void 0!==i&&i.getValue(e,t)},setValue:function(e,t){for(var r=this._bindings,i=this._targetGroup.nCachedObjects_,n=r.length;i!==n;++i)r[i].setValue(e,t)},bind:function(){for(var e=this._bindings,t=this._targetGroup.nCachedObjects_,r=e.length;t!==r;++t)e[t].bind()},unbind:function(){for(var e=this._bindings,t=this._targetGroup.nCachedObjects_,r=e.length;t!==r;++t)e[t].unbind()}},a.PropertyBinding.create=function(e,t,r){return e instanceof a.AnimationObjectGroup?new a.PropertyBinding.Composite(e,t,r):new a.PropertyBinding(e,t,r)},a.PropertyBinding.parseTrackName=function(e){var t=/^(([\w]+\/)*)([\w-\d]+)?(\.([\w]+)(\[([\w\d\[\]\_.:\- ]+)\])?)?(\.([\w.]+)(\[([\w\d\[\]\_. ]+)\])?)$/,r=t.exec(e);if(!r)throw new Error("cannot parse trackName at all: "+e);
+r.index===t.lastIndex&&t.lastIndex++;var i={nodeName:r[3],objectName:r[5],objectIndex:r[7],propertyName:r[9],propertyIndex:r[11]};if(null===i.propertyName||0===i.propertyName.length)throw new Error("can not parse propertyName from trackName: "+e);return i},a.PropertyBinding.findNode=function(e,t){if(!t||""===t||"root"===t||"."===t||t===-1||t===e.name||t===e.uuid)return e;if(e.skeleton){var r=function(e){for(var r=0;r<e.bones.length;r++){var i=e.bones[r];if(i.name===t)return i}return null},i=r(e.skeleton);if(i)return i}if(e.children){var n=function(e){for(var r=0;r<e.length;r++){var i=e[r];if(i.name===t||i.uuid===t)return i;var a=n(i.children);if(a)return a}return null},a=n(e.children);if(a)return a}return null},a.PropertyMixer=function(e,t,r){this.binding=e,this.valueSize=r;var i,n=Float64Array;switch(t){case"quaternion":i=this._slerp;break;case"string":case"bool":n=Array,i=this._select;break;default:i=this._lerp}this.buffer=new n(4*r),this._mixBufferRegion=i,this.cumulativeWeight=0,this.useCount=0,this.referenceCount=0},a.PropertyMixer.prototype={constructor:a.PropertyMixer,accumulate:function(e,t){var r=this.buffer,i=this.valueSize,n=e*i+i,a=this.cumulativeWeight;if(0===a){for(var o=0;o!==i;++o)r[n+o]=r[o];a=t}else{a+=t;var s=t/a;this._mixBufferRegion(r,n,0,s,i)}this.cumulativeWeight=a},apply:function(e){var t=this.valueSize,r=this.buffer,i=e*t+t,n=this.cumulativeWeight,a=this.binding;if(this.cumulativeWeight=0,n<1){var o=3*t;this._mixBufferRegion(r,i,o,1-n,t)}for(var s=t,c=t+t;s!==c;++s)if(r[s]!==r[s+t]){a.setValue(r,i);break}},saveOriginalState:function(){var e=this.binding,t=this.buffer,r=this.valueSize,i=3*r;e.getValue(t,i);for(var n=r,a=i;n!==a;++n)t[n]=t[i+n%r];this.cumulativeWeight=0},restoreOriginalState:function(){var e=3*this.valueSize;this.binding.setValue(this.buffer,e)},_select:function(e,t,r,i,n){if(i>=.5)for(var a=0;a!==n;++a)e[t+a]=e[r+a]},_slerp:function(e,t,r,i,n){a.Quaternion.slerpFlat(e,t,e,t,e,r,i)},_lerp:function(e,t,r,i,n){for(var a=1-i,o=0;o!==n;++o){var s=t+o;e[s]=e[s]*a+e[r+o]*i}}},a.BooleanKeyframeTrack=function(e,t,r){a.KeyframeTrack.call(this,e,t,r)},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(e,t,r,i){a.KeyframeTrack.call(this,e,t,r,i)},a.ColorKeyframeTrack.prototype=Object.assign(Object.create(a.KeyframeTrack.prototype),{constructor:a.ColorKeyframeTrack,ValueTypeName:"color"}),a.NumberKeyframeTrack=function(e,t,r,i){a.KeyframeTrack.call(this,e,t,r,i)},a.NumberKeyframeTrack.prototype=Object.assign(Object.create(a.KeyframeTrack.prototype),{constructor:a.NumberKeyframeTrack,ValueTypeName:"number"}),a.QuaternionKeyframeTrack=function(e,t,r,i){a.KeyframeTrack.call(this,e,t,r,i)},a.QuaternionKeyframeTrack.prototype=Object.assign(Object.create(a.KeyframeTrack.prototype),{constructor:a.QuaternionKeyframeTrack,ValueTypeName:"quaternion",DefaultInterpolation:a.InterpolateLinear,InterpolantFactoryMethodLinear:function(e){return new a.QuaternionLinearInterpolant(this.times,this.values,this.getValueSize(),e)},InterpolantFactoryMethodSmooth:void 0}),a.StringKeyframeTrack=function(e,t,r,i){a.KeyframeTrack.call(this,e,t,r,i)},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(e,t,r,i){a.KeyframeTrack.call(this,e,t,r,i)},a.VectorKeyframeTrack.prototype=Object.assign(Object.create(a.KeyframeTrack.prototype),{constructor:a.VectorKeyframeTrack,ValueTypeName:"vector"}),a.Audio=function(e){a.Object3D.call(this),this.type="Audio",this.context=e.context,this.source=this.context.createBufferSource(),this.source.onended=this.onEnded.bind(this),this.gain=this.context.createGain(),this.gain.connect(e.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(e){return this.hasPlaybackControl=!1,this.sourceType="audioNode",this.source=e,this.connect(),this},setBuffer:function(e){return this.source.buffer=e,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 e=this.context.createBufferSource();return e.buffer=this.source.buffer,e.loop=this.source.loop,e.onended=this.source.onended,e.start(0,this.startTime),e.playbackRate.value=this.playbackRate,this.isPlaying=!0,this.source=e,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 e=1,t=this.filters.length;e<t;e++)this.filters[e-1].connect(this.filters[e]);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 e=1,t=this.filters.length;e<t;e++)this.filters[e-1].disconnect(this.filters[e]);this.filters[this.filters.length-1].disconnect(this.getOutput())}else this.source.disconnect(this.getOutput());return this},getFilters:function(){return this.filters},setFilters:function(e){return e||(e=[]),this.isPlaying===!0?(this.disconnect(),this.filters=e,this.connect()):this.filters=e,this},getFilter:function(){return this.getFilters()[0]},setFilter:function(e){return this.setFilters(e?[e]:[])},setPlaybackRate:function(e){return this.hasPlaybackControl===!1?void console.warn("THREE.Audio: this Audio has no playback control."):(this.playbackRate=e,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(e){return this.hasPlaybackControl===!1?void console.warn("THREE.Audio: this Audio has no playback control."):void(this.source.loop=e)},getVolume:function(){return this.gain.gain.value},setVolume:function(e){return this.gain.gain.value=e,this}}),a.AudioAnalyser=function(e,t){this.analyser=e.context.createAnalyser(),this.analyser.fftSize=void 0!==t?t:2048,this.data=new Uint8Array(this.analyser.frequencyBinCount),e.getOutput().connect(this.analyser)},Object.assign(a.AudioAnalyser.prototype,{getFrequencyData:function(){return this.analyser.getByteFrequencyData(this.data),this.data},getAverageFrequency:function(){for(var e=0,t=this.getFrequencyData(),r=0;r<t.length;r++)e+=t[r];return e/t.length}}),Object.defineProperty(a,"AudioContext",{get:function(){var e;return function(){return void 0===e&&(e=new(window.AudioContext||window.webkitAudioContext)),e}}()}),a.PositionalAudio=function(e){a.Audio.call(this,e),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(e){this.panner.refDistance=e},getRolloffFactor:function(){return this.panner.rolloffFactor},setRolloffFactor:function(e){this.panner.rolloffFactor=e},getDistanceModel:function(){return this.panner.distanceModel},setDistanceModel:function(e){this.panner.distanceModel=e},getMaxDistance:function(){return this.panner.maxDistance},setMaxDistance:function(e){this.panner.maxDistance=e},updateMatrixWorld:function(){var e=new a.Vector3;return function(t){a.Object3D.prototype.updateMatrixWorld.call(this,t),e.setFromMatrixPosition(this.matrixWorld),this.panner.setPosition(e.x,e.y,e.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(e){null!==this.filter?(this.gain.disconnect(this.filter),this.filter.disconnect(this.context.destination)):this.gain.disconnect(this.context.destination),this.filter=e,this.gain.connect(this.filter),this.filter.connect(this.context.destination)},getMasterVolume:function(){return this.gain.gain.value},setMasterVolume:function(e){this.gain.gain.value=e},updateMatrixWorld:function(){var e=new a.Vector3,t=new a.Quaternion,r=new a.Vector3,i=new a.Vector3;return function(n){a.Object3D.prototype.updateMatrixWorld.call(this,n);var o=this.context.listener,s=this.up;this.matrixWorld.decompose(e,t,r),i.set(0,0,-1).applyQuaternion(t),o.setPosition(e.x,e.y,e.z),o.setOrientation(i.x,i.y,i.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 e=new a.Quaternion;return function(t){var r=t||new a.Vector3;return this.getWorldQuaternion(e),r.set(0,0,-1).applyQuaternion(e)}}(),a.Camera.prototype.lookAt=function(){var e=new a.Matrix4;return function(t){e.lookAt(this.position,t,this.up),this.quaternion.setFromRotationMatrix(e)}}(),a.Camera.prototype.clone=function(){return(new this.constructor).copy(this)},a.Camera.prototype.copy=function(e){return a.Object3D.prototype.copy.call(this,e),this.matrixWorldInverse.copy(e.matrixWorldInverse),this.projectionMatrix.copy(e.projectionMatrix),this},a.CubeCamera=function(e,t,r){a.Object3D.call(this),this.type="CubeCamera";var i=90,n=1,o=new a.PerspectiveCamera(i,n,e,t);o.up.set(0,-1,0),o.lookAt(new a.Vector3(1,0,0)),this.add(o);var s=new a.PerspectiveCamera(i,n,e,t);s.up.set(0,-1,0),s.lookAt(new a.Vector3((-1),0,0)),this.add(s);var c=new a.PerspectiveCamera(i,n,e,t);c.up.set(0,0,1),c.lookAt(new a.Vector3(0,1,0)),this.add(c);var h=new a.PerspectiveCamera(i,n,e,t);h.up.set(0,0,-1),h.lookAt(new a.Vector3(0,(-1),0)),this.add(h);var l=new a.PerspectiveCamera(i,n,e,t);l.up.set(0,-1,0),l.lookAt(new a.Vector3(0,0,1)),this.add(l);var u=new a.PerspectiveCamera(i,n,e,t);u.up.set(0,-1,0),u.lookAt(new a.Vector3(0,0,(-1))),this.add(u);var p={format:a.RGBFormat,magFilter:a.LinearFilter,minFilter:a.LinearFilter};this.renderTarget=new a.WebGLRenderTargetCube(r,r,p),this.updateCubeMap=function(e,t){null===this.parent&&this.updateMatrixWorld();var r=this.renderTarget,i=r.texture.generateMipmaps;r.texture.generateMipmaps=!1,r.activeCubeFace=0,e.render(t,o,r),r.activeCubeFace=1,e.render(t,s,r),r.activeCubeFace=2,e.render(t,c,r),r.activeCubeFace=3,e.render(t,h,r),r.activeCubeFace=4,e.render(t,l,r),r.texture.generateMipmaps=i,r.activeCubeFace=5,e.render(t,u,r),e.setRenderTarget(null)}},a.CubeCamera.prototype=Object.create(a.Object3D.prototype),a.CubeCamera.prototype.constructor=a.CubeCamera,a.OrthographicCamera=function(e,t,r,i,n,o){a.Camera.call(this),this.type="OrthographicCamera",this.zoom=1,this.view=null,this.left=e,this.right=t,this.top=r,this.bottom=i,this.near=void 0!==n?n:.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(e){return a.Camera.prototype.copy.call(this,e),this.left=e.left,this.right=e.right,this.top=e.top,this.bottom=e.bottom,this.near=e.near,this.far=e.far,this.zoom=e.zoom,this.view=null===e.view?null:Object.assign({},e.view),this},setViewOffset:function(e,t,r,i,n,a){this.view={fullWidth:e,fullHeight:t,offsetX:r,offsetY:i,width:n,height:a},this.updateProjectionMatrix()},clearViewOffset:function(){this.view=null,this.updateProjectionMatrix()},updateProjectionMatrix:function(){var e=(this.right-this.left)/(2*this.zoom),t=(this.top-this.bottom)/(2*this.zoom),r=(this.right+this.left)/2,i=(this.top+this.bottom)/2,n=r-e,a=r+e,o=i+t,s=i-t;if(null!==this.view){var c=this.zoom/(this.view.width/this.view.fullWidth),h=this.zoom/(this.view.height/this.view.fullHeight),l=(this.right-this.left)/this.view.width,u=(this.top-this.bottom)/this.view.height;n+=l*(this.view.offsetX/c),a=n+l*(this.view.width/c),o-=u*(this.view.offsetY/h),s=o-u*(this.view.height/h)}this.projectionMatrix.makeOrthographic(n,a,o,s,this.near,this.far)},toJSON:function(e){var t=a.Object3D.prototype.toJSON.call(this,e);return t.object.zoom=this.zoom,t.object.left=this.left,t.object.right=this.right,t.object.top=this.top,t.object.bottom=this.bottom,t.object.near=this.near,t.object.far=this.far,null!==this.view&&(t.object.view=Object.assign({},this.view)),t}}),a.PerspectiveCamera=function(e,t,r,i){a.Camera.call(this),this.type="PerspectiveCamera",this.fov=void 0!==e?e:50,this.zoom=1,this.near=void 0!==r?r:.1,this.far=void 0!==i?i:2e3,this.focus=10,this.aspect=void 0!==t?t: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(e){return a.Camera.prototype.copy.call(this,e),this.fov=e.fov,this.zoom=e.zoom,this.near=e.near,this.far=e.far,this.focus=e.focus,this.aspect=e.aspect,this.view=null===e.view?null:Object.assign({},e.view),this.filmGauge=e.filmGauge,this.filmOffset=e.filmOffset,this},setFocalLength:function(e){var t=.5*this.getFilmHeight()/e;this.fov=2*a.Math.RAD2DEG*Math.atan(t),this.updateProjectionMatrix()},getFocalLength:function(){var e=Math.tan(.5*a.Math.DEG2RAD*this.fov);return.5*this.getFilmHeight()/e},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(e,t,r,i,n,a){this.aspect=e/t,this.view={fullWidth:e,fullHeight:t,offsetX:r,offsetY:i,width:n,height:a},this.updateProjectionMatrix()},clearViewOffset:function(){this.view=null,this.updateProjectionMatrix()},updateProjectionMatrix:function(){var e=this.near,t=e*Math.tan(.5*a.Math.DEG2RAD*this.fov)/this.zoom,r=2*t,i=this.aspect*r,n=-.5*i,o=this.view;if(null!==o){var s=o.fullWidth,c=o.fullHeight;n+=o.offsetX*i/s,t-=o.offsetY*r/c,i*=o.width/s,r*=o.height/c}var h=this.filmOffset;0!==h&&(n+=e*h/this.getFilmWidth()),this.projectionMatrix.makeFrustum(n,n+i,t-r,t,e,this.far)},toJSON:function(e){var t=a.Object3D.prototype.toJSON.call(this,e);return t.object.fov=this.fov,t.object.zoom=this.zoom,t.object.near=this.near,t.object.far=this.far,t.object.focus=this.focus,t.object.aspect=this.aspect,null!==this.view&&(t.object.view=Object.assign({},this.view)),t.object.filmGauge=this.filmGauge,t.object.filmOffset=this.filmOffset,t}}),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 e,t,r,i,n,o=new a.Matrix4,s=new a.Matrix4;return function(c){var h=e!==c.focus||t!==c.fov||r!==c.aspect*this.aspect||i!==c.near||n!==c.far;if(h){e=c.focus,t=c.fov,r=c.aspect*this.aspect,i=c.near,n=c.far;var l,u,p=c.projectionMatrix.clone(),d=.032,f=d*i/e,m=i*Math.tan(a.Math.DEG2RAD*t*.5);s.elements[12]=-d,o.elements[12]=d,l=-m*r+f,u=m*r+f,p.elements[0]=2*i/(u-l),p.elements[8]=(u+l)/(u-l),this.cameraL.projectionMatrix.copy(p),l=-m*r-f,u=m*r-f,p.elements[0]=2*i/(u-l),p.elements[8]=(u+l)/(u-l),this.cameraR.projectionMatrix.copy(p)}this.cameraL.matrixWorld.copy(c.matrixWorld).multiply(s),this.cameraR.matrixWorld.copy(c.matrixWorld).multiply(o)}}()}),a.Light=function(e,t){a.Object3D.call(this),this.type="Light",this.color=new a.Color(e),this.intensity=void 0!==t?t:1,this.receiveShadow=void 0},a.Light.prototype=Object.assign(Object.create(a.Object3D.prototype),{constructor:a.Light,copy:function(e){return a.Object3D.prototype.copy.call(this,e),this.color.copy(e.color),this.intensity=e.intensity,this},toJSON:function(e){var t=a.Object3D.prototype.toJSON.call(this,e);return t.object.color=this.color.getHex(),t.object.intensity=this.intensity,void 0!==this.groundColor&&(t.object.groundColor=this.groundColor.getHex()),void 0!==this.distance&&(t.object.distance=this.distance),void 0!==this.angle&&(t.object.angle=this.angle),void 0!==this.decay&&(t.object.decay=this.decay),void 0!==this.penumbra&&(t.object.penumbra=this.penumbra),t}}),a.LightShadow=function(e){this.camera=e,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(e){return this.camera=e.camera.clone(),this.bias=e.bias,this.radius=e.radius,this.mapSize.copy(e.mapSize),this},clone:function(){return(new this.constructor).copy(this)}}),a.AmbientLight=function(e,t){a.Light.call(this,e,t),this.type="AmbientLight",this.castShadow=void 0},a.AmbientLight.prototype=Object.assign(Object.create(a.Light.prototype),{constructor:a.AmbientLight}),a.DirectionalLight=function(e,t){a.Light.call(this,e,t),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(e){return a.Light.prototype.copy.call(this,e),this.target=e.target.clone(),this.shadow=e.shadow.clone(),this}}),a.DirectionalLightShadow=function(e){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(e,t,r){a.Light.call(this,e,r),this.type="HemisphereLight",this.castShadow=void 0,this.position.set(0,1,0),this.updateMatrix(),this.groundColor=new a.Color(t)},a.HemisphereLight.prototype=Object.assign(Object.create(a.Light.prototype),{constructor:a.HemisphereLight,copy:function(e){return a.Light.prototype.copy.call(this,e),this.groundColor.copy(e.groundColor),this}}),a.PointLight=function(e,t,r,i){a.Light.call(this,e,t),this.type="PointLight",Object.defineProperty(this,"power",{get:function(){return 4*this.intensity*Math.PI},set:function(e){this.intensity=e/(4*Math.PI)}}),this.distance=void 0!==r?r:0,this.decay=void 0!==i?i: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(e){return a.Light.prototype.copy.call(this,e),this.distance=e.distance,this.decay=e.decay,this.shadow=e.shadow.clone(),this}}),a.SpotLight=function(e,t,r,i,n,o){a.Light.call(this,e,t),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(e){this.intensity=e/Math.PI}}),this.distance=void 0!==r?r:0,this.angle=void 0!==i?i:Math.PI/3,this.penumbra=void 0!==n?n: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(e){return a.Light.prototype.copy.call(this,e),this.distance=e.distance,this.angle=e.angle,this.penumbra=e.penumbra,this.decay=e.decay,this.target=e.target.clone(),this.shadow=e.shadow.clone(),this}}),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(e){var t=2*a.Math.RAD2DEG*e.angle,r=this.mapSize.width/this.mapSize.height,i=e.distance||500,n=this.camera;t===n.fov&&r===n.aspect&&i===n.far||(n.fov=t,n.aspect=r,n.far=i,n.updateProjectionMatrix())}}),a.AudioLoader=function(e){this.manager=void 0!==e?e:a.DefaultLoadingManager},Object.assign(a.AudioLoader.prototype,{load:function(e,t,r,i){var n=new a.XHRLoader(this.manager);n.setResponseType("arraybuffer"),n.load(e,function(e){var r=a.AudioContext;r.decodeAudioData(e,function(e){t(e)})},r,i)}}),a.Cache={enabled:!1,files:{},add:function(e,t){this.enabled!==!1&&(this.files[e]=t)},get:function(e){if(this.enabled!==!1)return this.files[e]},remove:function(e){delete this.files[e]},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(e){var t=e.split("/");return 1===t.length?"./":(t.pop(),t.join("/")+"/")},initMaterials:function(e,t,r){for(var i=[],n=0;n<e.length;++n)i[n]=this.createMaterial(e[n],t,r);return i},createMaterial:function(){var e,t,r;return function(i,n,o){function s(e,r,i,s,h){var l,u=n+e,p=a.Loader.Handlers.get(u);null!==p?l=p.load(u):(t.setCrossOrigin(o),l=t.load(u)),void 0!==r&&(l.repeat.fromArray(r),1!==r[0]&&(l.wrapS=a.RepeatWrapping),1!==r[1]&&(l.wrapT=a.RepeatWrapping)),void 0!==i&&l.offset.fromArray(i),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!==h&&(l.anisotropy=h);var d=a.Math.generateUUID();return c[d]=l,d}void 0===e&&(e=new a.Color),void 0===t&&(t=new a.TextureLoader),void 0===r&&(r=new a.MaterialLoader);var c={},h={uuid:a.Math.generateUUID(),type:"MeshLambertMaterial"};for(var l in i){var u=i[l];switch(l){case"DbgColor":case"DbgIndex":case"opticalDensity":case"illumination":break;case"DbgName":h.name=u;break;case"blending":h.blending=a[u];break;case"colorAmbient":case"mapAmbient":console.warn("THREE.Loader.createMaterial:",l,"is no longer supported.");break;case"colorDiffuse":h.color=e.fromArray(u).getHex();break;case"colorSpecular":h.specular=e.fromArray(u).getHex();break;case"colorEmissive":h.emissive=e.fromArray(u).getHex();break;case"specularCoef":h.shininess=u;break;case"shading":"basic"===u.toLowerCase()&&(h.type="MeshBasicMaterial"),"phong"===u.toLowerCase()&&(h.type="MeshPhongMaterial"),"standard"===u.toLowerCase()&&(h.type="MeshStandardMaterial");break;case"mapDiffuse":h.map=s(u,i.mapDiffuseRepeat,i.mapDiffuseOffset,i.mapDiffuseWrap,i.mapDiffuseAnisotropy);break;case"mapDiffuseRepeat":case"mapDiffuseOffset":case"mapDiffuseWrap":case"mapDiffuseAnisotropy":break;case"mapEmissive":h.emissiveMap=s(u,i.mapEmissiveRepeat,i.mapEmissiveOffset,i.mapEmissiveWrap,i.mapEmissiveAnisotropy);break;case"mapEmissiveRepeat":case"mapEmissiveOffset":case"mapEmissiveWrap":case"mapEmissiveAnisotropy":break;case"mapLight":h.lightMap=s(u,i.mapLightRepeat,i.mapLightOffset,i.mapLightWrap,i.mapLightAnisotropy);break;case"mapLightRepeat":case"mapLightOffset":case"mapLightWrap":case"mapLightAnisotropy":break;case"mapAO":h.aoMap=s(u,i.mapAORepeat,i.mapAOOffset,i.mapAOWrap,i.mapAOAnisotropy);break;case"mapAORepeat":case"mapAOOffset":case"mapAOWrap":case"mapAOAnisotropy":break;case"mapBump":h.bumpMap=s(u,i.mapBumpRepeat,i.mapBumpOffset,i.mapBumpWrap,i.mapBumpAnisotropy);break;case"mapBumpScale":h.bumpScale=u;break;case"mapBumpRepeat":case"mapBumpOffset":case"mapBumpWrap":case"mapBumpAnisotropy":break;case"mapNormal":h.normalMap=s(u,i.mapNormalRepeat,i.mapNormalOffset,i.mapNormalWrap,i.mapNormalAnisotropy);break;case"mapNormalFactor":h.normalScale=[u,u];break;case"mapNormalRepeat":case"mapNormalOffset":case"mapNormalWrap":case"mapNormalAnisotropy":break;case"mapSpecular":h.specularMap=s(u,i.mapSpecularRepeat,i.mapSpecularOffset,i.mapSpecularWrap,i.mapSpecularAnisotropy);break;case"mapSpecularRepeat":case"mapSpecularOffset":case"mapSpecularWrap":case"mapSpecularAnisotropy":break;case"mapMetalness":h.metalnessMap=s(u,i.mapMetalnessRepeat,i.mapMetalnessOffset,i.mapMetalnessWrap,i.mapMetalnessAnisotropy);break;case"mapMetalnessRepeat":case"mapMetalnessOffset":case"mapMetalnessWrap":case"mapMetalnessAnisotropy":break;case"mapRoughness":h.roughnessMap=s(u,i.mapRoughnessRepeat,i.mapRoughnessOffset,i.mapRoughnessWrap,i.mapRoughnessAnisotropy);break;case"mapRoughnessRepeat":case"mapRoughnessOffset":case"mapRoughnessWrap":case"mapRoughnessAnisotropy":break;case"mapAlpha":h.alphaMap=s(u,i.mapAlphaRepeat,i.mapAlphaOffset,i.mapAlphaWrap,i.mapAlphaAnisotropy);break;case"mapAlphaRepeat":case"mapAlphaOffset":case"mapAlphaWrap":case"mapAlphaAnisotropy":break;case"flipSided":h.side=a.BackSide;break;case"doubleSided":h.side=a.DoubleSide;break;case"transparency":console.warn("THREE.Loader.createMaterial: transparency has been renamed to opacity"),h.opacity=u;break;case"depthTest":case"depthWrite":case"colorWrite":case"opacity":case"reflectivity":case"transparent":case"visible":case"wireframe":h[l]=u;break;case"vertexColors":u===!0&&(h.vertexColors=a.VertexColors),"face"===u&&(h.vertexColors=a.FaceColors);break;default:console.error("THREE.Loader.createMaterial: Unsupported",l,u)}}return"MeshBasicMaterial"===h.type&&delete h.emissive,"MeshPhongMaterial"!==h.type&&delete h.specular,h.opacity<1&&(h.transparent=!0),r.setTextures(c),r.parse(h)}}()},a.Loader.Handlers={handlers:[],add:function(e,t){this.handlers.push(e,t)},get:function(e){for(var t=this.handlers,r=0,i=t.length;r<i;r+=2){var n=t[r],a=t[r+1];if(n.test(e))return a}return null}},a.XHRLoader=function(e){this.manager=void 0!==e?e:a.DefaultLoadingManager},Object.assign(a.XHRLoader.prototype,{load:function(e,t,r,i){void 0!==this.path&&(e=this.path+e);var n=this,o=a.Cache.get(e);if(void 0!==o)return t&&setTimeout(function(){t(o)},0),o;var s=new XMLHttpRequest;return s.overrideMimeType("text/plain"),s.open("GET",e,!0),s.addEventListener("load",function(r){var o=r.target.response;a.Cache.add(e,o),200===this.status?(t&&t(o),n.manager.itemEnd(e)):0===this.status?(console.warn("THREE.XHRLoader: HTTP Status 0 received."),t&&t(o),n.manager.itemEnd(e)):(i&&i(r),n.manager.itemError(e))},!1),void 0!==r&&s.addEventListener("progress",function(e){r(e)},!1),s.addEventListener("error",function(t){i&&i(t),n.manager.itemError(e)},!1),void 0!==this.responseType&&(s.responseType=this.responseType),void 0!==this.withCredentials&&(s.withCredentials=this.withCredentials),s.send(null),n.manager.itemStart(e),s},setPath:function(e){return this.path=e,this},setResponseType:function(e){return this.responseType=e,this},setWithCredentials:function(e){return this.withCredentials=e,this}}),a.FontLoader=function(e){this.manager=void 0!==e?e:a.DefaultLoadingManager},Object.assign(a.FontLoader.prototype,{load:function(e,t,r,i){var n=this,o=new a.XHRLoader(this.manager);o.load(e,function(e){var r;try{r=JSON.parse(e)}catch(i){console.warn("THREE.FontLoader: typeface.js support is being deprecated. Use typeface.json instead."),r=JSON.parse(e.substring(65,e.length-2))}var a=n.parse(r);t&&t(a)},r,i)},parse:function(e){return new a.Font(e)}}),a.ImageLoader=function(e){this.manager=void 0!==e?e:a.DefaultLoadingManager},Object.assign(a.ImageLoader.prototype,{load:function(e,t,r,i){var n=document.createElementNS("http://www.w3.org/1999/xhtml","img");if(n.onload=function(){URL.revokeObjectURL(n.src),t&&t(n)},0===e.indexOf("data:"))n.src=e;else{var o=new a.XHRLoader(this.manager);o.setPath(this.path),o.setResponseType("blob"),o.load(e,function(e){n.src=URL.createObjectURL(e)},r,i)}return n},setCrossOrigin:function(e){return this.crossOrigin=e,this},setPath:function(e){return this.path=e,this}}),a.JSONLoader=function(e){"boolean"==typeof e&&(console.warn("THREE.JSONLoader: showStatus parameter has been removed from constructor."),e=void 0),this.manager=void 0!==e?e:a.DefaultLoadingManager,this.withCredentials=!1},Object.assign(a.JSONLoader.prototype,{load:function(e,t,r,i){var n=this,o=this.texturePath&&"string"==typeof this.texturePath?this.texturePath:a.Loader.prototype.extractUrlBase(e),s=new a.XHRLoader(this.manager);s.setWithCredentials(this.withCredentials),s.load(e,function(r){var i=JSON.parse(r),a=i.metadata;if(void 0!==a){var s=a.type;if(void 0!==s){if("object"===s.toLowerCase())return void console.error("THREE.JSONLoader: "+e+" should be loaded with THREE.ObjectLoader instead.");if("scene"===s.toLowerCase())return void console.error("THREE.JSONLoader: "+e+" should be loaded with THREE.SceneLoader instead.")}}var c=n.parse(i,o);t(c.geometry,c.materials)},r,i)},setTexturePath:function(e){this.texturePath=e},parse:function(e,t){function r(t){function r(e,t){return e&1<<t}var i,n,o,c,h,l,u,p,d,f,m,g,v,y,x,b,_,M,w,S,E,T,A,L,C,R,P,B=e.faces,U=e.vertices,I=e.normals,D=e.colors,F=0;if(void 0!==e.uvs){for(i=0;i<e.uvs.length;i++)e.uvs[i].length&&F++;for(i=0;i<F;i++)s.faceVertexUvs[i]=[]}for(c=0,h=U.length;c<h;)M=new a.Vector3,M.x=U[c++]*t,M.y=U[c++]*t,M.z=U[c++]*t,s.vertices.push(M);for(c=0,h=B.length;c<h;)if(f=B[c++],m=r(f,0),g=r(f,1),v=r(f,3),y=r(f,4),x=r(f,5),b=r(f,6),_=r(f,7),m){if(S=new a.Face3,S.a=B[c],S.b=B[c+1],S.c=B[c+3],E=new a.Face3,E.a=B[c+1],E.b=B[c+2],E.c=B[c+3],c+=4,g&&(d=B[c++],S.materialIndex=d,E.materialIndex=d),o=s.faces.length,v)for(i=0;i<F;i++)for(L=e.uvs[i],s.faceVertexUvs[i][o]=[],s.faceVertexUvs[i][o+1]=[],n=0;n<4;n++)p=B[c++],R=L[2*p],P=L[2*p+1],C=new a.Vector2(R,P),2!==n&&s.faceVertexUvs[i][o].push(C),0!==n&&s.faceVertexUvs[i][o+1].push(C);if(y&&(u=3*B[c++],S.normal.set(I[u++],I[u++],I[u]),E.normal.copy(S.normal)),x)for(i=0;i<4;i++)u=3*B[c++],A=new a.Vector3(I[u++],I[u++],I[u]),2!==i&&S.vertexNormals.push(A),0!==i&&E.vertexNormals.push(A);if(b&&(l=B[c++],T=D[l],S.color.setHex(T),E.color.setHex(T)),_)for(i=0;i<4;i++)l=B[c++],T=D[l],2!==i&&S.vertexColors.push(new a.Color(T)),0!==i&&E.vertexColors.push(new a.Color(T));s.faces.push(S),s.faces.push(E)}else{if(w=new a.Face3,w.a=B[c++],w.b=B[c++],w.c=B[c++],g&&(d=B[c++],w.materialIndex=d),o=s.faces.length,v)for(i=0;i<F;i++)for(L=e.uvs[i],s.faceVertexUvs[i][o]=[],n=0;n<3;n++)p=B[c++],R=L[2*p],P=L[2*p+1],C=new a.Vector2(R,P),s.faceVertexUvs[i][o].push(C);if(y&&(u=3*B[c++],w.normal.set(I[u++],I[u++],I[u])),x)for(i=0;i<3;i++)u=3*B[c++],A=new a.Vector3(I[u++],I[u++],I[u]),w.vertexNormals.push(A);if(b&&(l=B[c++],w.color.setHex(D[l])),_)for(i=0;i<3;i++)l=B[c++],w.vertexColors.push(new a.Color(D[l]));s.faces.push(w)}}function i(){var t=void 0!==e.influencesPerVertex?e.influencesPerVertex:2;if(e.skinWeights)for(var r=0,i=e.skinWeights.length;r<i;r+=t){var n=e.skinWeights[r],o=t>1?e.skinWeights[r+1]:0,c=t>2?e.skinWeights[r+2]:0,h=t>3?e.skinWeights[r+3]:0;s.skinWeights.push(new a.Vector4(n,o,c,h))}if(e.skinIndices)for(var r=0,i=e.skinIndices.length;r<i;r+=t){var l=e.skinIndices[r],u=t>1?e.skinIndices[r+1]:0,p=t>2?e.skinIndices[r+2]:0,d=t>3?e.skinIndices[r+3]:0;s.skinIndices.push(new a.Vector4(l,u,p,d))}s.bones=e.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 n(t){if(void 0!==e.morphTargets)for(var r=0,i=e.morphTargets.length;r<i;r++){s.morphTargets[r]={},s.morphTargets[r].name=e.morphTargets[r].name,s.morphTargets[r].vertices=[];for(var n=s.morphTargets[r].vertices,o=e.morphTargets[r].vertices,c=0,h=o.length;c<h;c+=3){var l=new a.Vector3;l.x=o[c]*t,l.y=o[c+1]*t,l.z=o[c+2]*t,n.push(l)}}if(void 0!==e.morphColors&&e.morphColors.length>0){console.warn('THREE.JSONLoader: "morphColors" no longer supported. Using them as face colors.');for(var u=s.faces,p=e.morphColors[0].colors,r=0,i=u.length;r<i;r++)u[r].color.fromArray(p,3*r)}}function o(){var t=[],r=[];void 0!==e.animation&&r.push(e.animation),void 0!==e.animations&&(e.animations.length?r=r.concat(e.animations):r.push(e.animations));for(var i=0;i<r.length;i++){var n=a.AnimationClip.parseAnimation(r[i],s.bones);n&&t.push(n)}if(s.morphTargets){var o=a.AnimationClip.CreateClipsFromMorphTargetSequences(s.morphTargets,10);t=t.concat(o)}t.length>0&&(s.animations=t)}var s=new a.Geometry,c=void 0!==e.scale?1/e.scale:1;if(r(c),i(),n(c),o(),s.computeFaceNormals(),s.computeBoundingSphere(),void 0===e.materials||0===e.materials.length)return{geometry:s};var h=a.Loader.prototype.initMaterials(e.materials,t,this.crossOrigin);return{geometry:s,materials:h}}}),a.LoadingManager=function(e,t,r){var i=this,n=!1,a=0,o=0;this.onStart=void 0,this.onLoad=e,this.onProgress=t,this.onError=r,this.itemStart=function(e){o++,n===!1&&void 0!==i.onStart&&i.onStart(e,a,o),n=!0},this.itemEnd=function(e){a++,void 0!==i.onProgress&&i.onProgress(e,a,o),a===o&&(n=!1,void 0!==i.onLoad&&i.onLoad())},this.itemError=function(e){void 0!==i.onError&&i.onError(e)}},a.DefaultLoadingManager=new a.LoadingManager,a.BufferGeometryLoader=function(e){this.manager=void 0!==e?e:a.DefaultLoadingManager},Object.assign(a.BufferGeometryLoader.prototype,{load:function(e,t,r,i){var n=this,o=new a.XHRLoader(n.manager);o.load(e,function(e){t(n.parse(JSON.parse(e)))},r,i)},parse:function(e){var t=new a.BufferGeometry,r=e.data.index,i={Int8Array:Int8Array,Uint8Array:Uint8Array,Uint8ClampedArray:Uint8ClampedArray,Int16Array:Int16Array,Uint16Array:Uint16Array,Int32Array:Int32Array,Uint32Array:Uint32Array,Float32Array:Float32Array,Float64Array:Float64Array};if(void 0!==r){var n=new i[r.type](r.array);t.setIndex(new a.BufferAttribute(n,1))}var o=e.data.attributes;for(var s in o){var c=o[s],n=new i[c.type](c.array);t.addAttribute(s,new a.BufferAttribute(n,c.itemSize,c.normalized))}var h=e.data.groups||e.data.drawcalls||e.data.offsets;if(void 0!==h)for(var l=0,u=h.length;l!==u;++l){var p=h[l];t.addGroup(p.start,p.count,p.materialIndex)}var d=e.data.boundingSphere;if(void 0!==d){var f=new a.Vector3;void 0!==d.center&&f.fromArray(d.center),t.boundingSphere=new a.Sphere(f,d.radius)}return t}}),a.MaterialLoader=function(e){this.manager=void 0!==e?e:a.DefaultLoadingManager,this.textures={}},Object.assign(a.MaterialLoader.prototype,{load:function(e,t,r,i){var n=this,o=new a.XHRLoader(n.manager);o.load(e,function(e){t(n.parse(JSON.parse(e)))},r,i)},setTextures:function(e){this.textures=e},getTexture:function(e){var t=this.textures;return void 0===t[e]&&console.warn("THREE.MaterialLoader: Undefined texture",e),t[e]},parse:function(e){var t=new a[e.type];if(void 0!==e.uuid&&(t.uuid=e.uuid),void 0!==e.name&&(t.name=e.name),void 0!==e.color&&t.color.setHex(e.color),void 0!==e.roughness&&(t.roughness=e.roughness),void 0!==e.metalness&&(t.metalness=e.metalness),void 0!==e.emissive&&t.emissive.setHex(e.emissive),void 0!==e.specular&&t.specular.setHex(e.specular),void 0!==e.shininess&&(t.shininess=e.shininess),void 0!==e.uniforms&&(t.uniforms=e.uniforms),void 0!==e.vertexShader&&(t.vertexShader=e.vertexShader),void 0!==e.fragmentShader&&(t.fragmentShader=e.fragmentShader),void 0!==e.vertexColors&&(t.vertexColors=e.vertexColors),void 0!==e.shading&&(t.shading=e.shading),void 0!==e.blending&&(t.blending=e.blending),void 0!==e.side&&(t.side=e.side),void 0!==e.opacity&&(t.opacity=e.opacity),void 0!==e.transparent&&(t.transparent=e.transparent),void 0!==e.alphaTest&&(t.alphaTest=e.alphaTest),void 0!==e.depthTest&&(t.depthTest=e.depthTest),void 0!==e.depthWrite&&(t.depthWrite=e.depthWrite),void 0!==e.colorWrite&&(t.colorWrite=e.colorWrite),void 0!==e.wireframe&&(t.wireframe=e.wireframe),void 0!==e.wireframeLinewidth&&(t.wireframeLinewidth=e.wireframeLinewidth),void 0!==e.size&&(t.size=e.size),void 0!==e.sizeAttenuation&&(t.sizeAttenuation=e.sizeAttenuation),void 0!==e.map&&(t.map=this.getTexture(e.map)),void 0!==e.alphaMap&&(t.alphaMap=this.getTexture(e.alphaMap),t.transparent=!0),void 0!==e.bumpMap&&(t.bumpMap=this.getTexture(e.bumpMap)),void 0!==e.bumpScale&&(t.bumpScale=e.bumpScale),void 0!==e.normalMap&&(t.normalMap=this.getTexture(e.normalMap)),void 0!==e.normalScale){var r=e.normalScale;Array.isArray(r)===!1&&(r=[r,r]),t.normalScale=(new a.Vector2).fromArray(r)}if(void 0!==e.displacementMap&&(t.displacementMap=this.getTexture(e.displacementMap)),void 0!==e.displacementScale&&(t.displacementScale=e.displacementScale),void 0!==e.displacementBias&&(t.displacementBias=e.displacementBias),void 0!==e.roughnessMap&&(t.roughnessMap=this.getTexture(e.roughnessMap)),void 0!==e.metalnessMap&&(t.metalnessMap=this.getTexture(e.metalnessMap)),void 0!==e.emissiveMap&&(t.emissiveMap=this.getTexture(e.emissiveMap)),void 0!==e.emissiveIntensity&&(t.emissiveIntensity=e.emissiveIntensity),void 0!==e.specularMap&&(t.specularMap=this.getTexture(e.specularMap)),void 0!==e.envMap&&(t.envMap=this.getTexture(e.envMap),t.combine=a.MultiplyOperation),void 0!==e.reflectivity&&(t.reflectivity=e.reflectivity),void 0!==e.lightMap&&(t.lightMap=this.getTexture(e.lightMap)),void 0!==e.lightMapIntensity&&(t.lightMapIntensity=e.lightMapIntensity),void 0!==e.aoMap&&(t.aoMap=this.getTexture(e.aoMap)),void 0!==e.aoMapIntensity&&(t.aoMapIntensity=e.aoMapIntensity),void 0!==e.materials)for(var i=0,n=e.materials.length;i<n;i++)t.materials.push(this.parse(e.materials[i]));return t}}),a.ObjectLoader=function(e){this.manager=void 0!==e?e:a.DefaultLoadingManager,this.texturePath=""},Object.assign(a.ObjectLoader.prototype,{load:function(e,t,r,i){""===this.texturePath&&(this.texturePath=e.substring(0,e.lastIndexOf("/")+1));var n=this,o=new a.XHRLoader(n.manager);o.load(e,function(e){n.parse(JSON.parse(e),t)},r,i)},setTexturePath:function(e){this.texturePath=e},setCrossOrigin:function(e){this.crossOrigin=e},parse:function(e,t){var r=this.parseGeometries(e.geometries),i=this.parseImages(e.images,function(){void 0!==t&&t(o)}),n=this.parseTextures(e.textures,i),a=this.parseMaterials(e.materials,n),o=this.parseObject(e.object,r,a);return e.animations&&(o.animations=this.parseAnimations(e.animations)),void 0!==e.images&&0!==e.images.length||void 0!==t&&t(o),o},parseGeometries:function(e){var t={};if(void 0!==e)for(var r=new a.JSONLoader,i=new a.BufferGeometryLoader,n=0,o=e.length;n<o;n++){var s,c=e[n];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=i.parse(c);break;case"Geometry":s=r.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),t[c.uuid]=s}return t},parseMaterials:function(e,t){var r={};if(void 0!==e){var i=new a.MaterialLoader;i.setTextures(t);for(var n=0,o=e.length;n<o;n++){var s=i.parse(e[n]);r[s.uuid]=s}}return r},parseAnimations:function(e){for(var t=[],r=0;r<e.length;r++){var i=a.AnimationClip.parse(e[r]);t.push(i)}return t},parseImages:function(e,t){function r(e){return i.manager.itemStart(e),s.load(e,function(){i.manager.itemEnd(e)})}var i=this,n={};if(void 0!==e&&e.length>0){var o=new a.LoadingManager(t),s=new a.ImageLoader(o);s.setCrossOrigin(this.crossOrigin);for(var c=0,h=e.length;c<h;c++){var l=e[c],u=/^(\/\/)|([a-z]+:(\/\/)?)/i.test(l.url)?l.url:i.texturePath+l.url;n[l.uuid]=r(u)}}return n},parseTextures:function(e,t){function r(e){return"number"==typeof e?e:(console.warn("THREE.ObjectLoader.parseTexture: Constant should be in numeric form.",e),a[e])}var i={};if(void 0!==e)for(var n=0,o=e.length;n<o;n++){var s=e[n];void 0===s.image&&console.warn('THREE.ObjectLoader: No "image" specified for',s.uuid),void 0===t[s.image]&&console.warn("THREE.ObjectLoader: Undefined image",s.image);var c=new a.Texture(t[s.image]);c.needsUpdate=!0,c.uuid=s.uuid,void 0!==s.name&&(c.name=s.name),void 0!==s.mapping&&(c.mapping=r(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=r(s.minFilter)),void 0!==s.magFilter&&(c.magFilter=r(s.magFilter)),void 0!==s.anisotropy&&(c.anisotropy=s.anisotropy),Array.isArray(s.wrap)&&(c.wrapS=r(s.wrap[0]),c.wrapT=r(s.wrap[1])),i[s.uuid]=c}return i},parseObject:function(){var e=new a.Matrix4;return function(t,r,i){function n(e){return void 0===r[e]&&console.warn("THREE.ObjectLoader: Undefined geometry",e),r[e]}function o(e){if(void 0!==e)return void 0===i[e]&&console.warn("THREE.ObjectLoader: Undefined material",e),i[e]}var s;switch(t.type){case"Scene":s=new a.Scene;break;case"PerspectiveCamera":s=new a.PerspectiveCamera(t.fov,t.aspect,t.near,t.far),void 0!==t.focus&&(s.focus=t.focus),void 0!==t.zoom&&(s.zoom=t.zoom),void 0!==t.filmGauge&&(s.filmGauge=t.filmGauge),void 0!==t.filmOffset&&(s.filmOffset=t.filmOffset),void 0!==t.view&&(s.view=Object.assign({},t.view));break;case"OrthographicCamera":s=new a.OrthographicCamera(t.left,t.right,t.top,t.bottom,t.near,t.far);break;case"AmbientLight":s=new a.AmbientLight(t.color,t.intensity);break;case"DirectionalLight":s=new a.DirectionalLight(t.color,t.intensity);break;case"PointLight":s=new a.PointLight(t.color,t.intensity,t.distance,t.decay);break;case"SpotLight":s=new a.SpotLight(t.color,t.intensity,t.distance,t.angle,t.penumbra,t.decay);break;case"HemisphereLight":s=new a.HemisphereLight(t.color,t.groundColor,t.intensity);break;case"Mesh":var c=n(t.geometry),h=o(t.material);s=c.bones&&c.bones.length>0?new a.SkinnedMesh(c,h):new a.Mesh(c,h);break;case"LOD":s=new a.LOD;break;case"Line":s=new a.Line(n(t.geometry),o(t.material),t.mode);break;case"PointCloud":case"Points":s=new a.Points(n(t.geometry),o(t.material));break;case"Sprite":s=new a.Sprite(o(t.material));break;case"Group":s=new a.Group;break;default:s=new a.Object3D}if(s.uuid=t.uuid,void 0!==t.name&&(s.name=t.name),void 0!==t.matrix?(e.fromArray(t.matrix),e.decompose(s.position,s.quaternion,s.scale)):(void 0!==t.position&&s.position.fromArray(t.position),void 0!==t.rotation&&s.rotation.fromArray(t.rotation),void 0!==t.scale&&s.scale.fromArray(t.scale)),void 0!==t.castShadow&&(s.castShadow=t.castShadow),void 0!==t.receiveShadow&&(s.receiveShadow=t.receiveShadow),void 0!==t.visible&&(s.visible=t.visible),void 0!==t.userData&&(s.userData=t.userData),void 0!==t.children)for(var l in t.children)s.add(this.parseObject(t.children[l],r,i));if("LOD"===t.type)for(var u=t.levels,p=0;p<u.length;p++){var d=u[p],l=s.getObjectByProperty("uuid",d.object);void 0!==l&&s.addLevel(l,d.distance)}return s}}()}),a.TextureLoader=function(e){this.manager=void 0!==e?e:a.DefaultLoadingManager},Object.assign(a.TextureLoader.prototype,{load:function(e,t,r,i){var n=new a.Texture,o=new a.ImageLoader(this.manager);return o.setCrossOrigin(this.crossOrigin),o.setPath(this.path),o.load(e,function(e){n.image=e,n.needsUpdate=!0,void 0!==t&&t(n)},r,i),n},setCrossOrigin:function(e){return this.crossOrigin=e,this},setPath:function(e){return this.path=e,this}}),a.CubeTextureLoader=function(e){this.manager=void 0!==e?e:a.DefaultLoadingManager},Object.assign(a.CubeTextureLoader.prototype,{load:function(e,t,r,i){function n(r){s.load(e[r],function(e){o.images[r]=e,c++,6===c&&(o.needsUpdate=!0,t&&t(o))},void 0,i)}var o=new a.CubeTexture,s=new a.ImageLoader(this.manager);s.setCrossOrigin(this.crossOrigin),s.setPath(this.path);for(var c=0,h=0;h<e.length;++h)n(h);return o},setCrossOrigin:function(e){return this.crossOrigin=e,this},setPath:function(e){return this.path=e,this}}),a.DataTextureLoader=a.BinaryTextureLoader=function(e){this.manager=void 0!==e?e:a.DefaultLoadingManager,this._parser=null},Object.assign(a.BinaryTextureLoader.prototype,{load:function(e,t,r,i){var n=this,o=new a.DataTexture,s=new a.XHRLoader(this.manager);return s.setResponseType("arraybuffer"),s.load(e,function(e){var r=n._parser(e);r&&(void 0!==r.image?o.image=r.image:void 0!==r.data&&(o.image.width=r.width,o.image.height=r.height,o.image.data=r.data),o.wrapS=void 0!==r.wrapS?r.wrapS:a.ClampToEdgeWrapping,o.wrapT=void 0!==r.wrapT?r.wrapT:a.ClampToEdgeWrapping,o.magFilter=void 0!==r.magFilter?r.magFilter:a.LinearFilter,o.minFilter=void 0!==r.minFilter?r.minFilter:a.LinearMipMapLinearFilter,o.anisotropy=void 0!==r.anisotropy?r.anisotropy:1,void 0!==r.format&&(o.format=r.format),void 0!==r.type&&(o.type=r.type),void 0!==r.mipmaps&&(o.mipmaps=r.mipmaps),1===r.mipmapCount&&(o.minFilter=a.LinearFilter),o.needsUpdate=!0,t&&t(o,r))},r,i),o}}),a.CompressedTextureLoader=function(e){this.manager=void 0!==e?e:a.DefaultLoadingManager,this._parser=null},Object.assign(a.CompressedTextureLoader.prototype,{load:function(e,t,r,i){function n(n){h.load(e[n],function(e){var r=o._parser(e,!0);s[n]={width:r.width,height:r.height,format:r.format,mipmaps:r.mipmaps},l+=1,6===l&&(1===r.mipmapCount&&(c.minFilter=a.LinearFilter),c.format=r.format,c.needsUpdate=!0,t&&t(c))},r,i)}var o=this,s=[],c=new a.CompressedTexture;c.image=s;var h=new a.XHRLoader(this.manager);if(h.setPath(this.path),h.setResponseType("arraybuffer"),Array.isArray(e))for(var l=0,u=0,p=e.length;u<p;++u)n(u);else h.load(e,function(e){var r=o._parser(e,!0);if(r.isCubemap)for(var i=r.mipmaps.length/r.mipmapCount,n=0;n<i;n++){s[n]={mipmaps:[]};for(var h=0;h<r.mipmapCount;h++)s[n].mipmaps.push(r.mipmaps[n*r.mipmapCount+h]),s[n].format=r.format,s[n].width=r.width,s[n].height=r.height}else c.image.width=r.width,c.image.height=r.height,c.mipmaps=r.mipmaps;1===r.mipmapCount&&(c.minFilter=a.LinearFilter),c.format=r.format,c.needsUpdate=!0,t&&t(c)},r,i);return c},setPath:function(e){return this.path=e,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(e){e===!0&&this.update(),this._needsUpdate=e},setValues:function(e){if(void 0!==e)for(var t in e){var r=e[t];if(void 0!==r){var i=this[t];void 0!==i?i instanceof a.Color?i.set(r):i instanceof a.Vector3&&r instanceof a.Vector3?i.copy(r):"overdraw"===t?this[t]=Number(r):this[t]=r:console.warn("THREE."+this.type+": '"+t+"' is not a property of this material.")}else console.warn("THREE.Material: '"+t+"' parameter is undefined.")}},toJSON:function(e){function t(e){var t=[];for(var r in e){var i=e[r];delete i.metadata,t.push(i)}return t}var r=void 0===e;r&&(e={textures:{},images:{}});var i={metadata:{version:4.4,type:"Material",generator:"Material.toJSON"}};if(i.uuid=this.uuid,i.type=this.type,""!==this.name&&(i.name=this.name),this.color instanceof a.Color&&(i.color=this.color.getHex()),void 0!==this.roughness&&(i.roughness=this.roughness),void 0!==this.metalness&&(i.metalness=this.metalness),this.emissive instanceof a.Color&&(i.emissive=this.emissive.getHex()),this.specular instanceof a.Color&&(i.specular=this.specular.getHex()),void 0!==this.shininess&&(i.shininess=this.shininess),this.map instanceof a.Texture&&(i.map=this.map.toJSON(e).uuid),this.alphaMap instanceof a.Texture&&(i.alphaMap=this.alphaMap.toJSON(e).uuid),this.lightMap instanceof a.Texture&&(i.lightMap=this.lightMap.toJSON(e).uuid),this.bumpMap instanceof a.Texture&&(i.bumpMap=this.bumpMap.toJSON(e).uuid,i.bumpScale=this.bumpScale),this.normalMap instanceof a.Texture&&(i.normalMap=this.normalMap.toJSON(e).uuid,i.normalScale=this.normalScale.toArray()),this.displacementMap instanceof a.Texture&&(i.displacementMap=this.displacementMap.toJSON(e).uuid,i.displacementScale=this.displacementScale,i.displacementBias=this.displacementBias),this.roughnessMap instanceof a.Texture&&(i.roughnessMap=this.roughnessMap.toJSON(e).uuid),this.metalnessMap instanceof a.Texture&&(i.metalnessMap=this.metalnessMap.toJSON(e).uuid),this.emissiveMap instanceof a.Texture&&(i.emissiveMap=this.emissiveMap.toJSON(e).uuid),this.specularMap instanceof a.Texture&&(i.specularMap=this.specularMap.toJSON(e).uuid),this.envMap instanceof a.Texture&&(i.envMap=this.envMap.toJSON(e).uuid,i.reflectivity=this.reflectivity),void 0!==this.size&&(i.size=this.size),void 0!==this.sizeAttenuation&&(i.sizeAttenuation=this.sizeAttenuation),this.blending!==a.NormalBlending&&(i.blending=this.blending),this.shading!==a.SmoothShading&&(i.shading=this.shading),this.side!==a.FrontSide&&(i.side=this.side),this.vertexColors!==a.NoColors&&(i.vertexColors=this.vertexColors),this.opacity<1&&(i.opacity=this.opacity),this.transparent===!0&&(i.transparent=this.transparent),this.alphaTest>0&&(i.alphaTest=this.alphaTest),this.premultipliedAlpha===!0&&(i.premultipliedAlpha=this.premultipliedAlpha),this.wireframe===!0&&(i.wireframe=this.wireframe),this.wireframeLinewidth>1&&(i.wireframeLinewidth=this.wireframeLinewidth),r){var n=t(e.textures),o=t(e.images);n.length>0&&(i.textures=n),o.length>0&&(i.images=o)}return i},clone:function(){return(new this.constructor).copy(this)},copy:function(e){this.name=e.name,this.fog=e.fog,this.lights=e.lights,this.blending=e.blending,this.side=e.side,this.shading=e.shading,this.vertexColors=e.vertexColors,this.opacity=e.opacity,this.transparent=e.transparent,this.blendSrc=e.blendSrc,this.blendDst=e.blendDst,this.blendEquation=e.blendEquation,this.blendSrcAlpha=e.blendSrcAlpha,this.blendDstAlpha=e.blendDstAlpha,this.blendEquationAlpha=e.blendEquationAlpha,this.depthFunc=e.depthFunc,this.depthTest=e.depthTest,this.depthWrite=e.depthWrite,this.colorWrite=e.colorWrite,this.precision=e.precision,this.polygonOffset=e.polygonOffset,this.polygonOffsetFactor=e.polygonOffsetFactor,this.polygonOffsetUnits=e.polygonOffsetUnits,this.alphaTest=e.alphaTest,this.premultipliedAlpha=e.premultipliedAlpha,this.overdraw=e.overdraw,this.visible=e.visible,this.clipShadows=e.clipShadows;var t=e.clippingPlanes,r=null;if(null!==t){var i=t.length;r=new Array(i);for(var n=0;n!==i;++n)r[n]=t[n].clone()}return this.clippingPlanes=r,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(e){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(e)},a.LineBasicMaterial.prototype=Object.create(a.Material.prototype),a.LineBasicMaterial.prototype.constructor=a.LineBasicMaterial,a.LineBasicMaterial.prototype.copy=function(e){return a.Material.prototype.copy.call(this,e),this.color.copy(e.color),this.linewidth=e.linewidth,this.linecap=e.linecap,this.linejoin=e.linejoin,this},a.LineDashedMaterial=function(e){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(e)},a.LineDashedMaterial.prototype=Object.create(a.Material.prototype),a.LineDashedMaterial.prototype.constructor=a.LineDashedMaterial,a.LineDashedMaterial.prototype.copy=function(e){return a.Material.prototype.copy.call(this,e),this.color.copy(e.color),this.linewidth=e.linewidth,this.scale=e.scale,this.dashSize=e.dashSize,this.gapSize=e.gapSize,this},a.MeshBasicMaterial=function(e){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(e)},a.MeshBasicMaterial.prototype=Object.create(a.Material.prototype),a.MeshBasicMaterial.prototype.constructor=a.MeshBasicMaterial,a.MeshBasicMaterial.prototype.copy=function(e){return a.Material.prototype.copy.call(this,e),this.color.copy(e.color),this.map=e.map,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.combine=e.combine,this.reflectivity=e.reflectivity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.skinning=e.skinning,this.morphTargets=e.morphTargets,this},a.MeshDepthMaterial=function(e){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(e)},a.MeshDepthMaterial.prototype=Object.create(a.Material.prototype),a.MeshDepthMaterial.prototype.constructor=a.MeshDepthMaterial,a.MeshDepthMaterial.prototype.copy=function(e){return a.Material.prototype.copy.call(this,e),this.depthPacking=e.depthPacking,this.skinning=e.skinning,this.morphTargets=e.morphTargets,this.map=e.map,this.alphaMap=e.alphaMap,this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this},a.MeshLambertMaterial=function(e){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(e)},a.MeshLambertMaterial.prototype=Object.create(a.Material.prototype),a.MeshLambertMaterial.prototype.constructor=a.MeshLambertMaterial,a.MeshLambertMaterial.prototype.copy=function(e){return a.Material.prototype.copy.call(this,e),this.color.copy(e.color),this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.combine=e.combine,this.reflectivity=e.reflectivity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.skinning=e.skinning,this.morphTargets=e.morphTargets,this.morphNormals=e.morphNormals,this},a.MeshNormalMaterial=function(e){a.Material.call(this,e),this.type="MeshNormalMaterial",this.wireframe=!1,this.wireframeLinewidth=1,this.fog=!1,this.lights=!1,this.morphTargets=!1,this.setValues(e)},a.MeshNormalMaterial.prototype=Object.create(a.Material.prototype),a.MeshNormalMaterial.prototype.constructor=a.MeshNormalMaterial,a.MeshNormalMaterial.prototype.copy=function(e){return a.Material.prototype.copy.call(this,e),this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this},a.MeshPhongMaterial=function(e){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(e)},a.MeshPhongMaterial.prototype=Object.create(a.Material.prototype),a.MeshPhongMaterial.prototype.constructor=a.MeshPhongMaterial,a.MeshPhongMaterial.prototype.copy=function(e){return a.Material.prototype.copy.call(this,e),this.color.copy(e.color),this.specular.copy(e.specular),this.shininess=e.shininess,this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.combine=e.combine,this.reflectivity=e.reflectivity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.skinning=e.skinning,this.morphTargets=e.morphTargets,this.morphNormals=e.morphNormals,this},a.MeshStandardMaterial=function(e){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(e)},a.MeshStandardMaterial.prototype=Object.create(a.Material.prototype),a.MeshStandardMaterial.prototype.constructor=a.MeshStandardMaterial,a.MeshStandardMaterial.prototype.copy=function(e){return a.Material.prototype.copy.call(this,e),this.defines={STANDARD:""},this.color.copy(e.color),this.roughness=e.roughness,this.metalness=e.metalness,this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.roughnessMap=e.roughnessMap,this.metalnessMap=e.metalnessMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.envMapIntensity=e.envMapIntensity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.skinning=e.skinning,this.morphTargets=e.morphTargets,this.morphNormals=e.morphNormals,this},a.MeshPhysicalMaterial=function(e){a.MeshStandardMaterial.call(this),this.defines={PHYSICAL:""},this.type="MeshPhysicalMaterial",this.reflectivity=.5,this.clearCoat=0,this.clearCoatRoughness=0,this.setValues(e)},a.MeshPhysicalMaterial.prototype=Object.create(a.MeshStandardMaterial.prototype),a.MeshPhysicalMaterial.prototype.constructor=a.MeshPhysicalMaterial,a.MeshPhysicalMaterial.prototype.copy=function(e){return a.MeshStandardMaterial.prototype.copy.call(this,e),this.defines={PHYSICAL:""},this.reflectivity=e.reflectivity,this.clearCoat=e.clearCoat,this.clearCoatRoughness=e.clearCoatRoughness,this},a.MultiMaterial=function(e){this.uuid=a.Math.generateUUID(),this.type="MultiMaterial",this.materials=e instanceof Array?e:[],this.visible=!0},a.MultiMaterial.prototype={constructor:a.MultiMaterial,toJSON:function(e){for(var t={metadata:{version:4.2,type:"material",generator:"MaterialExporter"},uuid:this.uuid,type:this.type,materials:[]},r=this.materials,i=0,n=r.length;i<n;i++){var a=r[i].toJSON(e);delete a.metadata,t.materials.push(a)}return t.visible=this.visible,t},clone:function(){for(var e=new this.constructor,t=0;t<this.materials.length;t++)e.materials.push(this.materials[t].clone());return e.visible=this.visible,e}},a.PointsMaterial=function(e){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(e)},a.PointsMaterial.prototype=Object.create(a.Material.prototype),a.PointsMaterial.prototype.constructor=a.PointsMaterial,a.PointsMaterial.prototype.copy=function(e){return a.Material.prototype.copy.call(this,e),this.color.copy(e.color),this.map=e.map,this.size=e.size,this.sizeAttenuation=e.sizeAttenuation,this},a.ShaderMaterial=function(e){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!==e&&(void 0!==e.attributes&&console.error("THREE.ShaderMaterial: attributes should now be defined in THREE.BufferGeometry instead."),this.setValues(e))},a.ShaderMaterial.prototype=Object.create(a.Material.prototype),a.ShaderMaterial.prototype.constructor=a.ShaderMaterial,a.ShaderMaterial.prototype.copy=function(e){return a.Material.prototype.copy.call(this,e),this.fragmentShader=e.fragmentShader,this.vertexShader=e.vertexShader,this.uniforms=a.UniformsUtils.clone(e.uniforms),this.defines=e.defines,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.lights=e.lights,this.clipping=e.clipping,this.skinning=e.skinning,this.morphTargets=e.morphTargets,this.morphNormals=e.morphNormals,this.extensions=e.extensions,this},a.ShaderMaterial.prototype.toJSON=function(e){var t=a.Material.prototype.toJSON.call(this,e);return t.uniforms=this.uniforms,t.vertexShader=this.vertexShader,t.fragmentShader=this.fragmentShader,t},a.RawShaderMaterial=function(e){a.ShaderMaterial.call(this,e),this.type="RawShaderMaterial"},a.RawShaderMaterial.prototype=Object.create(a.ShaderMaterial.prototype),a.RawShaderMaterial.prototype.constructor=a.RawShaderMaterial,a.SpriteMaterial=function(e){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(e)},a.SpriteMaterial.prototype=Object.create(a.Material.prototype),a.SpriteMaterial.prototype.constructor=a.SpriteMaterial,a.SpriteMaterial.prototype.copy=function(e){return a.Material.prototype.copy.call(this,e),this.color.copy(e.color),this.map=e.map,this.rotation=e.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(e){this.uniforms.opacity.value=e}}})},a.ShadowMaterial.prototype=Object.create(a.ShaderMaterial.prototype),a.ShadowMaterial.prototype.constructor=a.ShadowMaterial,a.Texture=function(e,t,r,i,n,o,s,c,h,l){Object.defineProperty(this,"id",{value:a.TextureIdCount++}),this.uuid=a.Math.generateUUID(),this.name="",this.sourceFile="",this.image=void 0!==e?e:a.Texture.DEFAULT_IMAGE,this.mipmaps=[],this.mapping=void 0!==t?t:a.Texture.DEFAULT_MAPPING,this.wrapS=void 0!==r?r:a.ClampToEdgeWrapping,this.wrapT=void 0!==i?i:a.ClampToEdgeWrapping,this.magFilter=void 0!==n?n:a.LinearFilter,this.minFilter=void 0!==o?o:a.LinearMipMapLinearFilter,this.anisotropy=void 0!==h?h: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(e){e===!0&&this.version++},clone:function(){return(new this.constructor).copy(this)},copy:function(e){return this.image=e.image,this.mipmaps=e.mipmaps.slice(0),this.mapping=e.mapping,this.wrapS=e.wrapS,this.wrapT=e.wrapT,this.magFilter=e.magFilter,this.minFilter=e.minFilter,this.anisotropy=e.anisotropy,this.format=e.format,this.type=e.type,this.offset.copy(e.offset),this.repeat.copy(e.repeat),this.generateMipmaps=e.generateMipmaps,this.premultiplyAlpha=e.premultiplyAlpha,this.flipY=e.flipY,this.unpackAlignment=e.unpackAlignment,this.encoding=e.encoding,this},toJSON:function(e){function t(e){var t;return void 0!==e.toDataURL?t=e:(t=document.createElementNS("http://www.w3.org/1999/xhtml","canvas"),t.width=e.width,t.height=e.height,t.getContext("2d").drawImage(e,0,0,e.width,e.height)),t.width>2048||t.height>2048?t.toDataURL("image/jpeg",.6):t.toDataURL("image/png")}if(void 0!==e.textures[this.uuid])return e.textures[this.uuid];var r={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 i=this.image;void 0===i.uuid&&(i.uuid=a.Math.generateUUID()),void 0===e.images[i.uuid]&&(e.images[i.uuid]={uuid:i.uuid,url:t(i)}),r.image=i.uuid}return e.textures[this.uuid]=r,r},dispose:function(){this.dispatchEvent({type:"dispose"})},transformUv:function(e){if(this.mapping===a.UVMapping){if(e.multiply(this.repeat),e.add(this.offset),e.x<0||e.x>1)switch(this.wrapS){case a.RepeatWrapping:e.x=e.x-Math.floor(e.x);break;case a.ClampToEdgeWrapping:e.x=e.x<0?0:1;break;case a.MirroredRepeatWrapping:1===Math.abs(Math.floor(e.x)%2)?e.x=Math.ceil(e.x)-e.x:e.x=e.x-Math.floor(e.x)}if(e.y<0||e.y>1)switch(this.wrapT){case a.RepeatWrapping:e.y=e.y-Math.floor(e.y);break;case a.ClampToEdgeWrapping:e.y=e.y<0?0:1;break;case a.MirroredRepeatWrapping:1===Math.abs(Math.floor(e.y)%2)?e.y=Math.ceil(e.y)-e.y:e.y=e.y-Math.floor(e.y)}this.flipY&&(e.y=1-e.y)}}},Object.assign(a.Texture.prototype,a.EventDispatcher.prototype),a.TextureIdCount=0,a.DepthTexture=function(e,t,r,i,n,o,s,c,h){a.Texture.call(this,null,i,n,o,s,c,a.DepthFormat,r,h),this.image={width:e,height:t},this.type=void 0!==r?r: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(e,t,r,i,n,o,s,c,h){a.Texture.call(this,e,t,r,i,n,o,s,c,h),this.needsUpdate=!0},a.CanvasTexture.prototype=Object.create(a.Texture.prototype),a.CanvasTexture.prototype.constructor=a.CanvasTexture,a.CubeTexture=function(e,t,r,i,n,o,s,c,h,l){e=void 0!==e?e:[],t=void 0!==t?t:a.CubeReflectionMapping,a.Texture.call(this,e,t,r,i,n,o,s,c,h,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(e){this.image=e}}),a.CompressedTexture=function(e,t,r,i,n,o,s,c,h,l,u,p){a.Texture.call(this,null,o,s,c,h,l,i,n,u,p),this.image={width:t,height:r},this.mipmaps=e,this.flipY=!1,this.generateMipmaps=!1},a.CompressedTexture.prototype=Object.create(a.Texture.prototype),a.CompressedTexture.prototype.constructor=a.CompressedTexture,a.DataTexture=function(e,t,r,i,n,o,s,c,h,l,u,p){a.Texture.call(this,null,o,s,c,h,l,i,n,u,p),this.image={data:e,width:t,height:r},this.magFilter=void 0!==h?h: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(e,t,r,i,n,o,s,c,h){function l(){requestAnimationFrame(l),e.readyState>=e.HAVE_CURRENT_DATA&&(u.needsUpdate=!0)}a.Texture.call(this,e,t,r,i,n,o,s,c,h),this.generateMipmaps=!1;var u=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(e,t){a.Object3D.call(this),this.type="Points",this.geometry=void 0!==e?e:new a.BufferGeometry,this.material=void 0!==t?t:new a.PointsMaterial({color:16777215*Math.random()})},a.Points.prototype=Object.assign(Object.create(a.Object3D.prototype),{constructor:a.Points,raycast:function(){var e=new a.Matrix4,t=new a.Ray,r=new a.Sphere;return function(i,n){function o(e,r){var a=t.distanceSqToPoint(e);if(a<p){var o=t.closestPointToPoint(e);o.applyMatrix4(h);var c=i.ray.origin.distanceTo(o);if(c<i.near||c>i.far)return;n.push({distance:c,distanceToRay:Math.sqrt(a),point:o.clone(),index:r,face:null,object:s})}}var s=this,c=this.geometry,h=this.matrixWorld,l=i.params.Points.threshold;if(null===c.boundingSphere&&c.computeBoundingSphere(),r.copy(c.boundingSphere),r.applyMatrix4(h),i.ray.intersectsSphere(r)!==!1){e.getInverse(h),t.copy(i.ray).applyMatrix4(e);var u=l/((this.scale.x+this.scale.y+this.scale.z)/3),p=u*u,d=new a.Vector3;if(c instanceof a.BufferGeometry){var f=c.index,m=c.attributes,g=m.position.array;if(null!==f)for(var v=f.array,y=0,x=v.length;y<x;y++){var b=v[y];d.fromArray(g,3*b),o(d,b)}else for(var y=0,_=g.length/3;y<_;y++)d.fromArray(g,3*y),o(d,y)}else for(var M=c.vertices,y=0,_=M.length;y<_;y++)o(M[y],y)}}}(),clone:function(){return new this.constructor(this.geometry,this.material).copy(this)}}),a.Line=function(e,t,r){return 1===r?(console.warn("THREE.Line: parameter THREE.LinePieces no longer supported. Created THREE.LineSegments instead."),new a.LineSegments(e,t)):(a.Object3D.call(this),this.type="Line",this.geometry=void 0!==e?e:new a.BufferGeometry,void(this.material=void 0!==t?t:new a.LineBasicMaterial({color:16777215*Math.random()})))},a.Line.prototype=Object.assign(Object.create(a.Object3D.prototype),{constructor:a.Line,raycast:function(){var e=new a.Matrix4,t=new a.Ray,r=new a.Sphere;return function(i,n){var o=i.linePrecision,s=o*o,c=this.geometry,h=this.matrixWorld;if(null===c.boundingSphere&&c.computeBoundingSphere(),r.copy(c.boundingSphere),r.applyMatrix4(h),i.ray.intersectsSphere(r)!==!1){e.getInverse(h),t.copy(i.ray).applyMatrix4(e);var l=new a.Vector3,u=new a.Vector3,p=new a.Vector3,d=new a.Vector3,f=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+=f){var _=y[x],M=y[x+1];l.fromArray(v,3*_),u.fromArray(v,3*M);var w=t.distanceSqToSegment(l,u,d,p);if(!(w>s)){d.applyMatrix4(this.matrixWorld);var S=i.ray.origin.distanceTo(d);S<i.near||S>i.far||n.push({distance:S,point:p.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+=f){l.fromArray(v,3*x),u.fromArray(v,3*x+3);var w=t.distanceSqToSegment(l,u,d,p);if(!(w>s)){d.applyMatrix4(this.matrixWorld);var S=i.ray.origin.distanceTo(d);S<i.near||S>i.far||n.push({distance:S,point:p.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+=f){var w=t.distanceSqToSegment(E[x],E[x+1],d,p);if(!(w>s)){d.applyMatrix4(this.matrixWorld);var S=i.ray.origin.distanceTo(d);S<i.near||S>i.far||n.push({distance:S,point:p.clone().applyMatrix4(this.matrixWorld),index:x,face:null,faceIndex:null,object:this})}}}}}(),clone:function(){return new this.constructor(this.geometry,this.material).copy(this)}}),a.LineSegments=function(e,t){a.Line.call(this,e,t),this.type="LineSegments"},a.LineSegments.prototype=Object.assign(Object.create(a.Line.prototype),{constructor:a.LineSegments}),a.Mesh=function(e,t){a.Object3D.call(this),this.type="Mesh",this.geometry=void 0!==e?e:new a.BufferGeometry,this.material=void 0!==t?t: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(e){this.drawMode=e},copy:function(e){return a.Object3D.prototype.copy.call(this,e),this.drawMode=e.drawMode,this},updateMorphTargets:function(){if(void 0!==this.geometry.morphTargets&&this.geometry.morphTargets.length>0){this.morphTargetBase=-1,this.morphTargetInfluences=[],this.morphTargetDictionary={};for(var e=0,t=this.geometry.morphTargets.length;e<t;e++)this.morphTargetInfluences.push(0),this.morphTargetDictionary[this.geometry.morphTargets[e].name]=e}},getMorphTargetIndexByName:function(e){return void 0!==this.morphTargetDictionary[e]?this.morphTargetDictionary[e]:(console.warn("THREE.Mesh.getMorphTargetIndexByName: morph target "+e+" does not exist. Returning 0."),0)},raycast:function(){function e(e,t,r,i,n,o,s){return a.Triangle.barycoordFromPoint(e,t,r,i,g),n.multiplyScalar(g.x),o.multiplyScalar(g.y),s.multiplyScalar(g.z),n.add(o).add(s),n.clone()}function t(e,t,r,i,n,o,s){var c,h=e.material;if(c=h.side===a.BackSide?r.intersectTriangle(o,n,i,!0,s):r.intersectTriangle(i,n,o,h.side!==a.DoubleSide,s),null===c)return null;y.copy(s),y.applyMatrix4(e.matrixWorld);var l=t.ray.origin.distanceTo(y);return l<t.near||l>t.far?null:{distance:l,point:y.clone(),object:e}}function r(r,i,n,o,l,u,p,g){s.fromArray(o,3*u),c.fromArray(o,3*p),h.fromArray(o,3*g);var y=t(r,i,n,s,c,h,v);return y&&(l&&(d.fromArray(l,2*u),f.fromArray(l,2*p),m.fromArray(l,2*g),y.uv=e(v,s,c,h,d,f,m)),y.face=new a.Face3(u,p,g,a.Triangle.normal(s,c,h)),y.faceIndex=u),y}var i=new a.Matrix4,n=new a.Ray,o=new a.Sphere,s=new a.Vector3,c=new a.Vector3,h=new a.Vector3,l=new a.Vector3,u=new a.Vector3,p=new a.Vector3,d=new a.Vector2,f=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,_=this.matrixWorld;if(void 0!==b&&(null===x.boundingSphere&&x.computeBoundingSphere(),o.copy(x.boundingSphere),o.applyMatrix4(_),g.ray.intersectsSphere(o)!==!1&&(i.getInverse(_),n.copy(g.ray).applyMatrix4(i),null===x.boundingBox||n.intersectsBox(x.boundingBox)!==!1))){var M,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&&(M=L.uv.array),null!==A)for(var R=A.array,P=0,B=R.length;P<B;P+=3)S=R[P],E=R[P+1],T=R[P+2],w=r(this,g,n,C,M,S,E,T),w&&(w.faceIndex=Math.floor(P/3),y.push(w));else for(var P=0,B=C.length;P<B;P+=9)S=P/3,E=S+1,T=S+2,w=r(this,g,n,C,M,S,E,T),w&&(w.index=S,y.push(w))}else if(x instanceof a.Geometry){var U,I,D,F=b instanceof a.MultiMaterial,O=F===!0?b.materials:null,G=x.vertices,N=x.faces,V=x.faceVertexUvs[0];V.length>0&&(M=V);for(var z=0,k=N.length;z<k;z++){var H=N[z],j=F===!0?O[H.materialIndex]:b;if(void 0!==j){if(U=G[H.a],I=G[H.b],D=G[H.c],j.morphTargets===!0){var W=x.morphTargets,X=this.morphTargetInfluences;s.set(0,0,0),c.set(0,0,0),h.set(0,0,0);for(var Y=0,q=W.length;Y<q;Y++){var Z=X[Y];if(0!==Z){var K=W[Y].vertices;s.addScaledVector(l.subVectors(K[H.a],U),Z),c.addScaledVector(u.subVectors(K[H.b],I),Z),h.addScaledVector(p.subVectors(K[H.c],D),Z)}}s.add(U),c.add(I),h.add(D),U=s,I=c,D=h}if(w=t(this,g,n,U,I,D,v)){if(M){var Q=M[z];d.copy(Q[0]),f.copy(Q[1]),m.copy(Q[2]),w.uv=e(v,U,I,D,d,f,m)}w.face=H,w.faceIndex=z,y.push(w)}}}}}}}(),clone:function(){return new this.constructor(this.geometry,this.material).copy(this)}}),a.Bone=function(e){a.Object3D.call(this),this.type="Bone",this.skin=e},a.Bone.prototype=Object.assign(Object.create(a.Object3D.prototype),{constructor:a.Bone,copy:function(e){return a.Object3D.prototype.copy.call(this,e),this.skin=e.skin,this}}),a.Skeleton=function(e,t,r){if(this.useVertexTexture=void 0===r||r,this.identityMatrix=new a.Matrix4,e=e||[],this.bones=e.slice(0),this.useVertexTexture){var i=Math.sqrt(4*this.bones.length);i=a.Math.nextPowerOfTwo(Math.ceil(i)),i=Math.max(i,4),this.boneTextureWidth=i,this.boneTextureHeight=i,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===t)this.calculateInverses();else if(this.bones.length===t.length)this.boneInverses=t.slice(0);else{console.warn("THREE.Skeleton bonInverses is the wrong length."),this.boneInverses=[];for(var n=0,o=this.bones.length;n<o;n++)this.boneInverses.push(new a.Matrix4)}},Object.assign(a.Skeleton.prototype,{calculateInverses:function(){this.boneInverses=[];for(var e=0,t=this.bones.length;e<t;e++){var r=new a.Matrix4;this.bones[e]&&r.getInverse(this.bones[e].matrixWorld),this.boneInverses.push(r)}},pose:function(){for(var e,t=0,r=this.bones.length;t<r;t++)e=this.bones[t],e&&e.matrixWorld.getInverse(this.boneInverses[t]);for(var t=0,r=this.bones.length;t<r;t++)e=this.bones[t],e&&(e.parent instanceof a.Bone?(e.matrix.getInverse(e.parent.matrixWorld),e.matrix.multiply(e.matrixWorld)):e.matrix.copy(e.matrixWorld),e.matrix.decompose(e.position,e.quaternion,e.scale))},update:function(){var e=new a.Matrix4;return function(){for(var t=0,r=this.bones.length;t<r;t++){var i=this.bones[t]?this.bones[t].matrixWorld:this.identityMatrix;e.multiplyMatrices(i,this.boneInverses[t]),e.toArray(this.boneMatrices,16*t)}this.useVertexTexture&&(this.boneTexture.needsUpdate=!0)}}(),clone:function(){return new a.Skeleton(this.bones,this.boneInverses,this.useVertexTexture)}}),a.SkinnedMesh=function(e,t,r){a.Mesh.call(this,e,t),this.type="SkinnedMesh",this.bindMode="attached",this.bindMatrix=new a.Matrix4,this.bindMatrixInverse=new a.Matrix4;var i=[];if(this.geometry&&void 0!==this.geometry.bones){for(var n,o,s=0,c=this.geometry.bones.length;s<c;++s)o=this.geometry.bones[s],n=new a.Bone(this),i.push(n),n.name=o.name,n.position.fromArray(o.pos),n.quaternion.fromArray(o.rotq),void 0!==o.scl&&n.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!==i[o.parent]?i[o.parent].add(i[s]):this.add(i[s])}this.normalizeSkinWeights(),this.updateMatrixWorld(!0),this.bind(new a.Skeleton(i,(void 0),r),this.matrixWorld)},a.SkinnedMesh.prototype=Object.assign(Object.create(a.Mesh.prototype),{constructor:a.SkinnedMesh,bind:function(e,t){this.skeleton=e,void 0===t&&(this.updateMatrixWorld(!0),this.skeleton.calculateInverses(),t=this.matrixWorld),this.bindMatrix.copy(t),this.bindMatrixInverse.getInverse(t)},pose:function(){this.skeleton.pose()},normalizeSkinWeights:function(){if(this.geometry instanceof a.Geometry)for(var e=0;e<this.geometry.skinWeights.length;e++){var t=this.geometry.skinWeights[e],r=1/t.lengthManhattan();r!==1/0?t.multiplyScalar(r):t.set(1,0,0,0)}else if(this.geometry instanceof a.BufferGeometry)for(var i=new a.Vector4,n=this.geometry.attributes.skinWeight,e=0;e<n.count;e++){i.x=n.getX(e),i.y=n.getY(e),i.z=n.getZ(e),i.w=n.getW(e);var r=1/i.lengthManhattan();r!==1/0?i.multiplyScalar(r):i.set(1,0,0,0),n.setXYZW(e,i.x,i.y,i.z,i.w)}},updateMatrixWorld:function(e){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(e){a.Object3D.prototype.copy.call(this,e,!1);for(var t=e.levels,r=0,i=t.length;r<i;r++){var n=t[r];this.addLevel(n.object.clone(),n.distance)}return this},addLevel:function(e,t){void 0===t&&(t=0),t=Math.abs(t);for(var r=this.levels,i=0;i<r.length&&!(t<r[i].distance);i++);r.splice(i,0,{distance:t,object:e}),this.add(e)},getObjectForDistance:function(e){for(var t=this.levels,r=1,i=t.length;r<i&&!(e<t[r].distance);r++);return t[r-1].object},raycast:function(){var e=new a.Vector3;return function(t,r){e.setFromMatrixPosition(this.matrixWorld);var i=t.ray.origin.distanceTo(e);this.getObjectForDistance(i).raycast(t,r)}}(),update:function(){var e=new a.Vector3,t=new a.Vector3;return function(r){var i=this.levels;if(i.length>1){e.setFromMatrixPosition(r.matrixWorld),t.setFromMatrixPosition(this.matrixWorld);var n=e.distanceTo(t);i[0].object.visible=!0;for(var a=1,o=i.length;a<o&&n>=i[a].distance;a++)i[a-1].object.visible=!1,i[a].object.visible=!0;for(;a<o;a++)i[a].object.visible=!1}}}(),toJSON:function(e){var t=a.Object3D.prototype.toJSON.call(this,e);t.object.levels=[];for(var r=this.levels,i=0,n=r.length;i<n;i++){var o=r[i];t.object.levels.push({object:o.object.uuid,distance:o.distance})}return t}}),a.Sprite=function(e){a.Object3D.call(this),this.type="Sprite",this.material=void 0!==e?e:new a.SpriteMaterial},a.Sprite.prototype=Object.assign(Object.create(a.Object3D.prototype),{constructor:a.Sprite,raycast:function(){var e=new a.Vector3;return function(t,r){e.setFromMatrixPosition(this.matrixWorld);var i=t.ray.distanceSqToPoint(e),n=this.scale.x*this.scale.y/4;i>n||r.push({distance:Math.sqrt(i),point:this.position,face:null,object:this})}}(),clone:function(){return new this.constructor(this.material).copy(this)}}),a.LensFlare=function(e,t,r,i,n){a.Object3D.call(this),this.lensFlares=[],this.positionScreen=new a.Vector3,this.customUpdateCallback=void 0,void 0!==e&&this.add(e,t,r,i,n)},a.LensFlare.prototype=Object.assign(Object.create(a.Object3D.prototype),{constructor:a.LensFlare,copy:function(e){a.Object3D.prototype.copy.call(this,e),this.positionScreen.copy(e.positionScreen),this.customUpdateCallback=e.customUpdateCallback;for(var t=0,r=e.lensFlares.length;t<r;t++)this.lensFlares.push(e.lensFlares[t]);return this},add:function(e,t,r,i,n,o){void 0===t&&(t=-1),void 0===r&&(r=0),void 0===o&&(o=1),void 0===n&&(n=new a.Color(16777215)),void 0===i&&(i=a.NormalBlending),r=Math.min(r,Math.max(0,r)),this.lensFlares.push({texture:e,size:t,distance:r,x:0,y:0,z:0,scale:1,rotation:0,opacity:o,color:n,blending:i})},updateLensFlares:function(){var e,t,r=this.lensFlares.length,i=2*-this.positionScreen.x,n=2*-this.positionScreen.y;for(e=0;e<r;e++)t=this.lensFlares[e],t.x=this.positionScreen.x+i*t.distance,t.y=this.positionScreen.y+n*t.distance,t.wantedRotation=t.x*Math.PI*.25,t.rotation+=.25*(t.wantedRotation-t.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(e,t){return a.Object3D.prototype.copy.call(this,e,t),null!==e.background&&(this.background=e.background.clone()),null!==e.fog&&(this.fog=e.fog.clone()),null!==e.overrideMaterial&&(this.overrideMaterial=e.overrideMaterial.clone()),this.autoUpdate=e.autoUpdate,this.matrixAutoUpdate=e.matrixAutoUpdate,this},a.Fog=function(e,t,r){this.name="",this.color=new a.Color(e),this.near=void 0!==t?t:1,this.far=void 0!==r?r:1e3},a.Fog.prototype.clone=function(){return new a.Fog(this.color.getHex(),this.near,this.far)},a.FogExp2=function(e,t){this.name="",this.color=new a.Color(e),this.density=void 0!==t?t: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(e){for(var t={},r=0;r<e.length;r++){var i=this.clone(e[r]);for(var n in i)t[n]=i[n]}return t},clone:function(e){var t={};for(var r in e){t[r]={};for(var i in e[r]){var n=e[r][i];n instanceof a.Color||n instanceof a.Vector2||n instanceof a.Vector3||n instanceof a.Vector4||n instanceof a.Matrix3||n instanceof a.Matrix4||n instanceof a.Texture?t[r][i]=n.clone():Array.isArray(n)?t[r][i]=n.slice():t[r][i]=n}}return t}},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;\