tpanorama.js 522 KB

12345
  1. !function(t){var e={};function n(i){if(e[i])return e[i].exports;var r=e[i]={i:i,l:!1,exports:{}};return t[i].call(r.exports,r,r.exports,n),r.l=!0,r.exports}n.m=t,n.c=e,n.d=function(t,e,i){n.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:i})},n.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},n.t=function(t,e){if(1&e&&(t=n(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var i=Object.create(null);if(n.r(i),Object.defineProperty(i,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var r in t)n.d(i,r,function(e){return t[e]}.bind(null,r));return i},n.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return n.d(e,"a",e),e},n.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},n.p="",n(n.s=0)}([function(t,e,n){"use strict";var i=function(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}(n(1));var r=i.Vector2,o=i.PerspectiveCamera,a=i.Vector3,s=i.OrthographicCamera,c=i.Scene,h=i.SphereGeometry,u=i.Mesh,l=i.MeshBasicMaterial,d=i.Raycaster,p=i.ImageUtils,f=i.WebGLRenderer,m=i.Texture,g=i.SpriteMaterial,v=i.Sprite,y=i.TextureLoader,x=i.Math;console.log(222,THREE),function(t,e){var n,i,b,_,w,M,E,T,S=75,A=1e3,L=!1,R=0,P=0,C=0,I=0,U=0,N=0,O=new r,D=[],F=[],B=[],z={container:"panoramaConianer",url:"resources/img/panorama/pano-7.jpg",lables:[],widthSegments:60,heightSegments:40,pRadius:1e3,minFocalLength:1,maxFocalLength:100,showlable:"show"};function G(t){this.render(t)}function H(t,e,n){for(var i in e)!e.hasOwnProperty(i)||t.hasOwnProperty(i)&&!n||(t[i]=e[i]);return t}function V(t){if(t==e||null==t||""==t||void 0===t)return!0}function k(t){t.preventDefault(),L=!0,U=t.clientX,N=t.clientY,C=R,I=P}function j(t){L&&(R=.1*(U-t.clientX)+C,P=.1*(t.clientY-N)+I)}function W(){L=!1}function X(t){O.x=t.clientX/window.innerWidth*2-1,O.y=-t.clientY/window.innerHeight*2+1,M.setFromCamera(O,_),M.intersectObjects(D).forEach(function(t){alert("Intersection: "+t.object.name)})}function q(t,e,i){t=t||window.event;var r=n.getFocalLength();return(t.wheelDelta?t.wheelDelta<0:t.detail>0)?r>e&&(r-=.05*r,n.setFocalLength(r)):r<i&&(r+=.05*r,n.setFocalLength(r)),t.preventDefault&&t.preventDefault(),!1}function Y(){n.aspect=window.innerWidth/window.innerHeight,n.projectionMatrix.makePerspective(S,n.aspect,1,1100),n.updateProjectionMatrix(),_.left=-window.innerWidth/2,_.right=window.innerWidth/2,_.top=window.innerHeight/2,_.bottom=-window.innerHeight/2,_.updateProjectionMatrix(),b.setSize(window.innerWidth,window.innerHeight)}function Z(t,e,n){var i=document.createElement("canvas"),r=i.getContext("2d"),o=1.5*r.measureText(e).width;r.font="10px 宋体",r.fillStyle="rgba(0,0,0,0.95)",r.fillRect(0,0,o+8,28),r.fillStyle="rgba(0,0,0,0.2)",r.fillRect(2,2,o+4,24),r.fillStyle="rgba(255,255,255,0.95)",r.fillText(e,4,20);var a=new m(i);a.needsUpdate=!0;var s=new g({map:a}),c=new v(s);c.scale.set(1,1,1),c.position.set(0,0,0),c.name=e;var h={name:e,pos:n,canvas:i,context:r,texture:a,sprite:c};return w.add(h.sprite),h}function J(t,e,n){var i=new y,r=new g({map:i.load(e)}),o={pos:t,name:n,sprite:new v(r)};return o.sprite.scale.set(32,32,1),o.sprite.position.set(0,0,0),o.sprite.name=n,w.add(o.sprite),D.push(o.sprite),o}function Q(){requestAnimationFrame(Q),function(){P=Math.max(-85,Math.min(85,P));var t=x.degToRad(90-P),e=x.degToRad(R);n.target.x=A*Math.sin(t)*Math.cos(e),n.target.y=A*Math.cos(t),n.target.z=A*Math.sin(t)*Math.sin(e),n.lookAt(n.target)}(),function(){if(void 0!==F)for(var t=0;t<F.length;t++){var e=K(F[t].pos.lon,F[t].pos.lat),i=$(e,n),r=e.clone();r.project(n),r.x>-1&&r.x<1&&r.y>-1&&r.y<1&&r.z>-1&&r.z<1?(F[t].sprite.scale.set(32,32,32),F[t].sprite.position.set(i.x,i.y,1)):(F[t].sprite.scale.set(1,1,1),F[t].sprite.position.set(0,0,0))}if(void 0!==B)for(var t=0;t<B.length;t++){var e=K(B[t].pos.lon,B[t].pos.lat),i=$(e,n),r=e.clone();if(r.project(n),r.x>-1&&r.x<1&&r.y>-1&&r.y<1&&r.z>-1&&r.z<1){var o=B[t].context.measureText(B[t].name),a=3.5*o.width;B[t].sprite.scale.set(400,150,1),B[t].sprite.position.set(i.x+a,i.y-40,1)}else B[t].sprite.scale.set(1,1,1),B[t].sprite.position.set(0,0,0)}}(),b.clear(),b.render(i,n),b.clearDepth(),b.render(w,_)}function K(t,e){e=Math.max(-85,Math.min(85,e));var n=x.degToRad(90-e),i=x.degToRad(t),r={x:A*Math.sin(n)*Math.cos(i),y:A*Math.cos(n),z:A*Math.sin(n)*Math.sin(i)};return new a(r.x,r.y,r.z)}function $(t,e){var n=t.clone();n.project(e);var i={x:Math.round((n.x+1)*window.innerWidth/2-window.innerWidth/2),y:Math.round(window.innerHeight/2-(1-n.y)*window.innerHeight/2),z:0};return new a(i.x,i.y,i.z)}G.prototype={constructor:this,def:{},render:function(e){var r,m,g,v,y,x,T=this;this.def=H(z,e,!0),document.getElementById(this.def.container).innerHTML="",B=[],r=this.def.container,E=document.getElementById(r),(n=new o(S,window.innerWidth/window.innerHeight,1,1100)).target=new a(0,0,0),(_=new s(-window.innerWidth/2,window.innerWidth/2,window.innerHeight/2,-window.innerHeight/2,1,10)).position.z=10,i=new c,w=new c,M=new d,m=this.def.pRadius,g=this.def.widthSegments,v=this.def.heightSegments,y=this.def.url,(x=new u(new h(m,g,v),new l({map:p.loadTexture(y)}))).scale.x=-1,i.add(x),(b=new f).setSize(window.innerWidth,window.innerHeight),b.autoClear=!1,E.appendChild(b.domElement),function(t,e){if("show"==e)for(var n=0;n<t.length;n++)B.push(Z(w,t[n].text,t[n].position));else if("click"==e)for(var n=0;n<t.length;n++)F.push(J(t[n].position,t[n].logoUrl,t[n].text))}(this.def.lables,this.def.showlable),E.addEventListener("mousedown",k,!1),E.addEventListener("mousemove",j,!1),E.addEventListener("mouseup",W,!1),E.addEventListener("mousewheel",function(t){q(t,T.def.minFocalLength,T.def.maxFocalLength)},!1),E.addEventListener("DOMMouseScroll",function(t){q(t,T.def.minFocalLength,T.def.maxFocalLength)},!1),E.addEventListener("click",X,!1),t.addEventListener("resize",Y,!1),Q()}};var tt,et,nt,it="hideimgid825",rt="cv825",ot="info825",at=[],st=1,ct={container:"myDiv",imgUrl:"resources/img/panorama/3.jpg",width:"",showGrid:!0,showPosition:!0,lableColor:"#9400D3",gridColor:"#48D1CC",lables:[],addLable:!0,getLable:!0,deleteLbale:!0};function ht(t){this.config(t)}function ut(t){var e=document.documentElement.scrollTop||document.body.scrollTop;return{x:(document.documentElement.scrollLeft||document.body.scrollLeft)+t.clientX,y:e+t.clientY}}function lt(t){var e=T.style.height.split("px")[0],n=T.style.width.split("px")[0],i=T.offsetLeft,r=T.offsetTop;r+=e;var o=(t.clientX-i)/n,a=(r-t.clientY)/e,s=0;return s=a>.5?180*(a-.5):180*(.5-a)*-1,{lon:(o>.5?360*-(1-o):360*o).toFixed(2),lat:s=s.toFixed(2)}}function dt(t,e,n,i){var r=et.getContext("2d");r.font="bold 20px 楷体",r.fillStyle=i,r.fillText(n,t,e)}function pt(t,e){var n=et.getContext("2d");n.fillStyle="#0000ff",n.beginPath(),n.arc(t,e,5,0,2*Math.PI,!0),n.closePath(),n.stroke(),n.fill(),n.fillStyle="#ff0000",n.beginPath(),n.arc(t,e,2,0,2*Math.PI,!0),n.closePath(),n.fill()}function ft(t,e){var n=T.style.height.split("px")[0],i=T.style.width.split("px")[0];return{x:t>0?1*t/180*.5*i:.5*(1+t/180)*i+.5*i,y:e>0?(1-e/90)*n*.5:-1*e/90*.5*n+.5*n}}function mt(t,e,n){var i=ut(t),r=T.offsetLeft,o=T.offsetTop,a=i.x-r,s=i.y-o;pt(a,s),dt(a,s,n,e);var c=lt(t),h={lon:c.lon,lat:c.lat,text:n};return at.push(h),h}function gt(t){for(var e,n=!1,i=0;i<at.length;i++){var r=ft((e=at[i]).lon,e.lat),o=T.offsetLeft,a=T.offsetTop,s=t.clientX,c=t.clientY-a,h=s-o-r.x,u=c-r.y;if(Math.sqrt(h*h+u*u)<=5){n=!0;break}}return n?e:{}}function vt(t,e){for(var n=0;n<t.length;n++)if(t[n].lon==e.lon&&t[n].lat==e.lat){t.splice(n,1);break}}ht.prototype={constructor:this,def:{},config:function(t){this.def=H(ct,t,!0)},init:function(){var t=this;at=this.def.lables,function(t,e){T=document.getElementById(t),null!=(tt=document.getElementById(it))&&document.body.removeChild(tt);(tt=document.createElement("img")).style.visibility="hidden",tt.id=it,tt.src=e,null!=(et=document.getElementById(rt))&&T.removeChild(et);et=document.createElement("canvas"),T.appendChild(et),et.id=rt,null!=(nt=document.getElementById(ot))?document.body.removeChild(nt):nt=document.createElement("div");nt.id=ot,nt.style.height="40px",nt.style.width="110px",nt.style.backgroundColor="#3C8DBC",nt.style.display="none",nt.style.position="absolute",nt.style.filter="alpha(Opacity=80)",nt.style.mozOpacity=.5,nt.style.opacity=.8,nt.style.fontFamily="楷体",nt.style.fontWeight="bold",nt.style.textShadow="0 0 0.2em #fffd84",nt.style.textAlign="center",document.body.appendChild(nt)}(this.def.container,this.def.imgUrl),setTimeout(function(){var e,n,i,r,o,a,s;!function(t,e){V(t)||(T.style.width=t);T.style.backgroundImage="";var n=tt.naturalHeight,i=tt.naturalWidth,r=n/i*T.style.width.split("px")[0];T.style.height=r+"px",setTimeout(function(){T.style.backgroundRepeat="no-repeat",T.style.backgroundPosition="0% 0%",T.style.backgroundSize="cover",T.style.backgroundImage="url("+e+")"},100)}(t.def.width,t.def.imgUrl),e=et.getContext("2d"),n=T.height,i=T.width,e.clearRect(0,0,i,n),t.def.showGrid&&function(t){if(et.width=T.style.width.split("px")[0],et.height=T.style.height.split("px")[0],et.getContext){var e=et.getContext("2d"),n=et.width,i=et.height;e.strokeStyle=t;for(var r=1;r<19;r++)e.lineWidth=9==r?3:.8,e.beginPath(),e.moveTo(0,r*i/18),e.lineTo(n,r*i/18),e.stroke();for(var o=1;o<37;o++)e.lineWidth=18==o?3:.8,e.beginPath(),e.moveTo(o*n/36,0),e.lineTo(o*n/36,i),e.stroke()}}(t.def.gridColor),t.def.showPosition&&(r=T.offsetLeft,o=r+T.style.width.split("px")[0],a=T.offsetTop,s=a+T.style.height.split("px")[0],document.onmousemove=function(t){var e,n,i=t||event,c=ut(i);c.x<o&&c.x>r&&c.y<s&&c.y>a?(nt.style.display="block",nt.style.left=c.x+"px",nt.style.top=c.y+"px",e=lt(t),n="经度:"+e.lon+"</br>纬度:"+e.lat,nt.innerHTML=n):nt.style.display="none"}),function(t,e){for(var n in t){var i=t[n],r=ft(i.lon,i.lat);pt(r.x,r.y),dt(r.x,r.y,i.text,e)}}(t.def.lables,t.def.lableColor);var c=t;2==st&&(t.def.addLable&&nt.addEventListener("dblclick",function(t){var e=prompt("标记名称");V(e)||mt(t,c.def.lableColor,e)}),t.def.getLable&&(document.oncontextmenu=function(t){t.preventDefault()},nt.addEventListener("mousedown",function(t){if(2==t.button){var e=gt(t);V(e.lon)||alert("经度"+e.lon+",纬度"+e.lat+",名称"+e.text)}})),t.def.deleteLbale&&nt.addEventListener("mousedown",function(e){if(1==e.button){var n=gt(e);if(!V(n.lon))confirm("您确认要删除该标记吗?")&&(vt(at,n),t.clean(),t.init())}}))},100),st++},getAllLables:function(){return at},addLable:function(t,e){mt(t,this.def.lableColor,e)},getLable:function(t){return gt(t)},listen:function(t,e){nt.addEventListener(t,function(t){e(t)})},delete:function(t){V(t.lon)||vt(at,t)},clean:function(){document.getElementById(this.def.container).innerHTML=""}},t.tpanorama=G,t.tpanoramaSetting=ht,t.tpanoramaSetContainer=T}(window)},function(t,e,n){"use strict";function i(){}n.r(e),n.d(e,"WebGLRenderTargetCube",function(){return ze}),n.d(e,"WebGLRenderTarget",function(){return Be}),n.d(e,"WebGLRenderer",function(){return Ar}),n.d(e,"ShaderLib",function(){return Dn}),n.d(e,"UniformsLib",function(){return Un}),n.d(e,"UniformsUtils",function(){return Nn}),n.d(e,"ShaderChunk",function(){return On}),n.d(e,"FogExp2",function(){return Lr}),n.d(e,"Fog",function(){return Rr}),n.d(e,"Scene",function(){return Pr}),n.d(e,"LensFlare",function(){return Cr}),n.d(e,"Sprite",function(){return Ur}),n.d(e,"LOD",function(){return Nr}),n.d(e,"SkinnedMesh",function(){return Fr}),n.d(e,"Skeleton",function(){return Or}),n.d(e,"Bone",function(){return Dr}),n.d(e,"Mesh",function(){return Gi}),n.d(e,"LineSegments",function(){return Gr}),n.d(e,"LineLoop",function(){return Hr}),n.d(e,"Line",function(){return zr}),n.d(e,"Points",function(){return kr}),n.d(e,"Group",function(){return jr}),n.d(e,"VideoTexture",function(){return Wr}),n.d(e,"DataTexture",function(){return ke}),n.d(e,"CompressedTexture",function(){return Xr}),n.d(e,"CubeTexture",function(){return je}),n.d(e,"CanvasTexture",function(){return qr}),n.d(e,"DepthTexture",function(){return Yr}),n.d(e,"Texture",function(){return De}),n.d(e,"CompressedTextureLoader",function(){return Jo}),n.d(e,"DataTextureLoader",function(){return Qo}),n.d(e,"CubeTextureLoader",function(){return $o}),n.d(e,"TextureLoader",function(){return ta}),n.d(e,"ObjectLoader",function(){return Da}),n.d(e,"MaterialLoader",function(){return Aa}),n.d(e,"BufferGeometryLoader",function(){return La}),n.d(e,"DefaultLoadingManager",function(){return Yo}),n.d(e,"LoadingManager",function(){return qo}),n.d(e,"JSONLoader",function(){return Oa}),n.d(e,"ImageLoader",function(){return Ko}),n.d(e,"FontLoader",function(){return ns}),n.d(e,"FileLoader",function(){return Zo}),n.d(e,"Loader",function(){return Na}),n.d(e,"Cache",function(){return Xo}),n.d(e,"AudioLoader",function(){return ws}),n.d(e,"SpotLightShadow",function(){return ra}),n.d(e,"SpotLight",function(){return oa}),n.d(e,"PointLight",function(){return aa}),n.d(e,"RectAreaLight",function(){return ua}),n.d(e,"HemisphereLight",function(){return na}),n.d(e,"DirectionalLightShadow",function(){return sa}),n.d(e,"DirectionalLight",function(){return ca}),n.d(e,"AmbientLight",function(){return ha}),n.d(e,"LightShadow",function(){return ia}),n.d(e,"Light",function(){return ea}),n.d(e,"StereoCamera",function(){return Ms}),n.d(e,"PerspectiveCamera",function(){return Xi}),n.d(e,"OrthographicCamera",function(){return qi}),n.d(e,"CubeCamera",function(){return Es}),n.d(e,"ArrayCamera",function(){return Ts}),n.d(e,"Camera",function(){return Wi}),n.d(e,"AudioListener",function(){return Ss}),n.d(e,"PositionalAudio",function(){return Ls}),n.d(e,"AudioContext",function(){return _s}),n.d(e,"AudioAnalyser",function(){return Rs}),n.d(e,"Audio",function(){return As}),n.d(e,"VectorKeyframeTrack",function(){return ya}),n.d(e,"StringKeyframeTrack",function(){return wa}),n.d(e,"QuaternionKeyframeTrack",function(){return ba}),n.d(e,"NumberKeyframeTrack",function(){return _a}),n.d(e,"ColorKeyframeTrack",function(){return Ea}),n.d(e,"BooleanKeyframeTrack",function(){return Ma}),n.d(e,"PropertyMixer",function(){return Ps}),n.d(e,"PropertyBinding",function(){return Is}),n.d(e,"KeyframeTrack",function(){return Ta}),n.d(e,"AnimationUtils",function(){return da}),n.d(e,"AnimationObjectGroup",function(){return Us}),n.d(e,"AnimationMixer",function(){return Os}),n.d(e,"AnimationClip",function(){return Sa}),n.d(e,"Uniform",function(){return Ds}),n.d(e,"InstancedBufferGeometry",function(){return Fs}),n.d(e,"BufferGeometry",function(){return zi}),n.d(e,"GeometryIdCount",function(){return Fi}),n.d(e,"Geometry",function(){return Bi}),n.d(e,"InterleavedBufferAttribute",function(){return Bs}),n.d(e,"InstancedInterleavedBuffer",function(){return Gs}),n.d(e,"InterleavedBuffer",function(){return zs}),n.d(e,"InstancedBufferAttribute",function(){return Hs}),n.d(e,"Face3",function(){return _i}),n.d(e,"Object3D",function(){return yi}),n.d(e,"Raycaster",function(){return Vs}),n.d(e,"Layers",function(){return hi}),n.d(e,"EventDispatcher",function(){return i}),n.d(e,"Clock",function(){return Ws}),n.d(e,"QuaternionLinearInterpolant",function(){return xa}),n.d(e,"LinearInterpolant",function(){return ma}),n.d(e,"DiscreteInterpolant",function(){return ga}),n.d(e,"CubicInterpolant",function(){return fa}),n.d(e,"Interpolant",function(){return pa}),n.d(e,"Triangle",function(){return bi}),n.d(e,"Math",function(){return Ae}),n.d(e,"Spherical",function(){return Xs}),n.d(e,"Cylindrical",function(){return qs}),n.d(e,"Plane",function(){return ri}),n.d(e,"Frustum",function(){return oi}),n.d(e,"Sphere",function(){return ni}),n.d(e,"Ray",function(){return si}),n.d(e,"Matrix4",function(){return Ve}),n.d(e,"Matrix3",function(){return ii}),n.d(e,"Box3",function(){return ei}),n.d(e,"Box2",function(){return Fn}),n.d(e,"Line3",function(){return xi}),n.d(e,"Euler",function(){return ci}),n.d(e,"Vector4",function(){return Fe}),n.d(e,"Vector3",function(){return He}),n.d(e,"Vector2",function(){return Le}),n.d(e,"Quaternion",function(){return Ge}),n.d(e,"Color",function(){return In}),n.d(e,"MorphBlendMesh",function(){return Ys}),n.d(e,"ImmediateRenderObject",function(){return Zs}),n.d(e,"VertexNormalsHelper",function(){return Js}),n.d(e,"SpotLightHelper",function(){return Qs}),n.d(e,"SkeletonHelper",function(){return Ks}),n.d(e,"PointLightHelper",function(){return $s}),n.d(e,"RectAreaLightHelper",function(){return tc}),n.d(e,"HemisphereLightHelper",function(){return ec}),n.d(e,"GridHelper",function(){return nc}),n.d(e,"PolarGridHelper",function(){return ic}),n.d(e,"FaceNormalsHelper",function(){return rc}),n.d(e,"DirectionalLightHelper",function(){return oc}),n.d(e,"CameraHelper",function(){return ac}),n.d(e,"BoxHelper",function(){return sc}),n.d(e,"ArrowHelper",function(){return cc}),n.d(e,"AxisHelper",function(){return hc}),n.d(e,"CatmullRomCurve3",function(){return mc}),n.d(e,"CubicBezierCurve3",function(){return gc}),n.d(e,"QuadraticBezierCurve3",function(){return vc}),n.d(e,"LineCurve3",function(){return yc}),n.d(e,"ArcCurve",function(){return xc}),n.d(e,"EllipseCurve",function(){return Xa}),n.d(e,"SplineCurve",function(){return qa}),n.d(e,"CubicBezierCurve",function(){return Ya}),n.d(e,"QuadraticBezierCurve",function(){return Za}),n.d(e,"LineCurve",function(){return ja}),n.d(e,"Shape",function(){return $a}),n.d(e,"Path",function(){return Ka}),n.d(e,"ShapePath",function(){return ts}),n.d(e,"Font",function(){return es}),n.d(e,"CurvePath",function(){return Wa}),n.d(e,"Curve",function(){return ka}),n.d(e,"ShapeUtils",function(){return mo}),n.d(e,"SceneUtils",function(){return bc}),n.d(e,"WireframeGeometry",function(){return Zr}),n.d(e,"ParametricGeometry",function(){return Jr}),n.d(e,"ParametricBufferGeometry",function(){return Qr}),n.d(e,"TetrahedronGeometry",function(){return to}),n.d(e,"TetrahedronBufferGeometry",function(){return eo}),n.d(e,"OctahedronGeometry",function(){return no}),n.d(e,"OctahedronBufferGeometry",function(){return io}),n.d(e,"IcosahedronGeometry",function(){return ro}),n.d(e,"IcosahedronBufferGeometry",function(){return oo}),n.d(e,"DodecahedronGeometry",function(){return ao}),n.d(e,"DodecahedronBufferGeometry",function(){return so}),n.d(e,"PolyhedronGeometry",function(){return Kr}),n.d(e,"PolyhedronBufferGeometry",function(){return $r}),n.d(e,"TubeGeometry",function(){return co}),n.d(e,"TubeBufferGeometry",function(){return ho}),n.d(e,"TorusKnotGeometry",function(){return uo}),n.d(e,"TorusKnotBufferGeometry",function(){return lo}),n.d(e,"TorusGeometry",function(){return po}),n.d(e,"TorusBufferGeometry",function(){return fo}),n.d(e,"TextGeometry",function(){return yo}),n.d(e,"TextBufferGeometry",function(){return xo}),n.d(e,"SphereGeometry",function(){return bo}),n.d(e,"SphereBufferGeometry",function(){return _o}),n.d(e,"RingGeometry",function(){return wo}),n.d(e,"RingBufferGeometry",function(){return Mo}),n.d(e,"PlaneGeometry",function(){return ki}),n.d(e,"PlaneBufferGeometry",function(){return ji}),n.d(e,"LatheGeometry",function(){return Eo}),n.d(e,"LatheBufferGeometry",function(){return To}),n.d(e,"ShapeGeometry",function(){return So}),n.d(e,"ShapeBufferGeometry",function(){return Ao}),n.d(e,"ExtrudeGeometry",function(){return go}),n.d(e,"ExtrudeBufferGeometry",function(){return vo}),n.d(e,"EdgesGeometry",function(){return Lo}),n.d(e,"ConeGeometry",function(){return Co}),n.d(e,"ConeBufferGeometry",function(){return Io}),n.d(e,"CylinderGeometry",function(){return Ro}),n.d(e,"CylinderBufferGeometry",function(){return Po}),n.d(e,"CircleGeometry",function(){return Uo}),n.d(e,"CircleBufferGeometry",function(){return No}),n.d(e,"BoxGeometry",function(){return Hi}),n.d(e,"BoxBufferGeometry",function(){return Vi}),n.d(e,"ShadowMaterial",function(){return Do}),n.d(e,"SpriteMaterial",function(){return Ir}),n.d(e,"RawShaderMaterial",function(){return Fo}),n.d(e,"ShaderMaterial",function(){return $n}),n.d(e,"PointsMaterial",function(){return Vr}),n.d(e,"MeshPhysicalMaterial",function(){return zo}),n.d(e,"MeshStandardMaterial",function(){return Bo}),n.d(e,"MeshPhongMaterial",function(){return Go}),n.d(e,"MeshToonMaterial",function(){return Ho}),n.d(e,"MeshNormalMaterial",function(){return Vo}),n.d(e,"MeshLambertMaterial",function(){return ko}),n.d(e,"MeshDepthMaterial",function(){return ti}),n.d(e,"MeshBasicMaterial",function(){return wi}),n.d(e,"LineDashedMaterial",function(){return jo}),n.d(e,"LineBasicMaterial",function(){return Br}),n.d(e,"Material",function(){return Kn}),n.d(e,"Float64BufferAttribute",function(){return Ii}),n.d(e,"Float32BufferAttribute",function(){return Ci}),n.d(e,"Uint32BufferAttribute",function(){return Pi}),n.d(e,"Int32BufferAttribute",function(){return Ri}),n.d(e,"Uint16BufferAttribute",function(){return Li}),n.d(e,"Int16BufferAttribute",function(){return Ai}),n.d(e,"Uint8ClampedBufferAttribute",function(){return Si}),n.d(e,"Uint8BufferAttribute",function(){return Ti}),n.d(e,"Int8BufferAttribute",function(){return Ei}),n.d(e,"BufferAttribute",function(){return Mi}),n.d(e,"REVISION",function(){return u}),n.d(e,"MOUSE",function(){return l}),n.d(e,"CullFaceNone",function(){return d}),n.d(e,"CullFaceBack",function(){return p}),n.d(e,"CullFaceFront",function(){return f}),n.d(e,"CullFaceFrontBack",function(){return m}),n.d(e,"FrontFaceDirectionCW",function(){return g}),n.d(e,"FrontFaceDirectionCCW",function(){return v}),n.d(e,"BasicShadowMap",function(){return y}),n.d(e,"PCFShadowMap",function(){return x}),n.d(e,"PCFSoftShadowMap",function(){return b}),n.d(e,"FrontSide",function(){return _}),n.d(e,"BackSide",function(){return w}),n.d(e,"DoubleSide",function(){return M}),n.d(e,"FlatShading",function(){return E}),n.d(e,"SmoothShading",function(){return T}),n.d(e,"NoColors",function(){return S}),n.d(e,"FaceColors",function(){return A}),n.d(e,"VertexColors",function(){return L}),n.d(e,"NoBlending",function(){return R}),n.d(e,"NormalBlending",function(){return P}),n.d(e,"AdditiveBlending",function(){return C}),n.d(e,"SubtractiveBlending",function(){return I}),n.d(e,"MultiplyBlending",function(){return U}),n.d(e,"CustomBlending",function(){return N}),n.d(e,"AddEquation",function(){return O}),n.d(e,"SubtractEquation",function(){return D}),n.d(e,"ReverseSubtractEquation",function(){return F}),n.d(e,"MinEquation",function(){return B}),n.d(e,"MaxEquation",function(){return z}),n.d(e,"ZeroFactor",function(){return G}),n.d(e,"OneFactor",function(){return H}),n.d(e,"SrcColorFactor",function(){return V}),n.d(e,"OneMinusSrcColorFactor",function(){return k}),n.d(e,"SrcAlphaFactor",function(){return j}),n.d(e,"OneMinusSrcAlphaFactor",function(){return W}),n.d(e,"DstAlphaFactor",function(){return X}),n.d(e,"OneMinusDstAlphaFactor",function(){return q}),n.d(e,"DstColorFactor",function(){return Y}),n.d(e,"OneMinusDstColorFactor",function(){return Z}),n.d(e,"SrcAlphaSaturateFactor",function(){return J}),n.d(e,"NeverDepth",function(){return Q}),n.d(e,"AlwaysDepth",function(){return K}),n.d(e,"LessDepth",function(){return $}),n.d(e,"LessEqualDepth",function(){return tt}),n.d(e,"EqualDepth",function(){return et}),n.d(e,"GreaterEqualDepth",function(){return nt}),n.d(e,"GreaterDepth",function(){return it}),n.d(e,"NotEqualDepth",function(){return rt}),n.d(e,"MultiplyOperation",function(){return ot}),n.d(e,"MixOperation",function(){return at}),n.d(e,"AddOperation",function(){return st}),n.d(e,"NoToneMapping",function(){return ct}),n.d(e,"LinearToneMapping",function(){return ht}),n.d(e,"ReinhardToneMapping",function(){return ut}),n.d(e,"Uncharted2ToneMapping",function(){return lt}),n.d(e,"CineonToneMapping",function(){return dt}),n.d(e,"UVMapping",function(){return pt}),n.d(e,"CubeReflectionMapping",function(){return ft}),n.d(e,"CubeRefractionMapping",function(){return mt}),n.d(e,"EquirectangularReflectionMapping",function(){return gt}),n.d(e,"EquirectangularRefractionMapping",function(){return vt}),n.d(e,"SphericalReflectionMapping",function(){return yt}),n.d(e,"CubeUVReflectionMapping",function(){return xt}),n.d(e,"CubeUVRefractionMapping",function(){return bt}),n.d(e,"RepeatWrapping",function(){return _t}),n.d(e,"ClampToEdgeWrapping",function(){return wt}),n.d(e,"MirroredRepeatWrapping",function(){return Mt}),n.d(e,"NearestFilter",function(){return Et}),n.d(e,"NearestMipMapNearestFilter",function(){return Tt}),n.d(e,"NearestMipMapLinearFilter",function(){return St}),n.d(e,"LinearFilter",function(){return At}),n.d(e,"LinearMipMapNearestFilter",function(){return Lt}),n.d(e,"LinearMipMapLinearFilter",function(){return Rt}),n.d(e,"UnsignedByteType",function(){return Pt}),n.d(e,"ByteType",function(){return Ct}),n.d(e,"ShortType",function(){return It}),n.d(e,"UnsignedShortType",function(){return Ut}),n.d(e,"IntType",function(){return Nt}),n.d(e,"UnsignedIntType",function(){return Ot}),n.d(e,"FloatType",function(){return Dt}),n.d(e,"HalfFloatType",function(){return Ft}),n.d(e,"UnsignedShort4444Type",function(){return Bt}),n.d(e,"UnsignedShort5551Type",function(){return zt}),n.d(e,"UnsignedShort565Type",function(){return Gt}),n.d(e,"UnsignedInt248Type",function(){return Ht}),n.d(e,"AlphaFormat",function(){return Vt}),n.d(e,"RGBFormat",function(){return kt}),n.d(e,"RGBAFormat",function(){return jt}),n.d(e,"LuminanceFormat",function(){return Wt}),n.d(e,"LuminanceAlphaFormat",function(){return Xt}),n.d(e,"RGBEFormat",function(){return qt}),n.d(e,"DepthFormat",function(){return Yt}),n.d(e,"DepthStencilFormat",function(){return Zt}),n.d(e,"RGB_S3TC_DXT1_Format",function(){return Jt}),n.d(e,"RGBA_S3TC_DXT1_Format",function(){return Qt}),n.d(e,"RGBA_S3TC_DXT3_Format",function(){return Kt}),n.d(e,"RGBA_S3TC_DXT5_Format",function(){return $t}),n.d(e,"RGB_PVRTC_4BPPV1_Format",function(){return te}),n.d(e,"RGB_PVRTC_2BPPV1_Format",function(){return ee}),n.d(e,"RGBA_PVRTC_4BPPV1_Format",function(){return ne}),n.d(e,"RGBA_PVRTC_2BPPV1_Format",function(){return ie}),n.d(e,"RGB_ETC1_Format",function(){return re}),n.d(e,"LoopOnce",function(){return oe}),n.d(e,"LoopRepeat",function(){return ae}),n.d(e,"LoopPingPong",function(){return se}),n.d(e,"InterpolateDiscrete",function(){return ce}),n.d(e,"InterpolateLinear",function(){return he}),n.d(e,"InterpolateSmooth",function(){return ue}),n.d(e,"ZeroCurvatureEnding",function(){return le}),n.d(e,"ZeroSlopeEnding",function(){return de}),n.d(e,"WrapAroundEnding",function(){return pe}),n.d(e,"TrianglesDrawMode",function(){return fe}),n.d(e,"TriangleStripDrawMode",function(){return me}),n.d(e,"TriangleFanDrawMode",function(){return ge}),n.d(e,"LinearEncoding",function(){return ve}),n.d(e,"sRGBEncoding",function(){return ye}),n.d(e,"GammaEncoding",function(){return xe}),n.d(e,"RGBEEncoding",function(){return be}),n.d(e,"LogLuvEncoding",function(){return _e}),n.d(e,"RGBM7Encoding",function(){return we}),n.d(e,"RGBM16Encoding",function(){return Me}),n.d(e,"RGBDEncoding",function(){return Ee}),n.d(e,"BasicDepthPacking",function(){return Te}),n.d(e,"RGBADepthPacking",function(){return Se}),n.d(e,"CubeGeometry",function(){return Hi}),n.d(e,"Face4",function(){return _c}),n.d(e,"LineStrip",function(){return wc}),n.d(e,"LinePieces",function(){return Mc}),n.d(e,"MeshFaceMaterial",function(){return Ec}),n.d(e,"MultiMaterial",function(){return Tc}),n.d(e,"PointCloud",function(){return Sc}),n.d(e,"Particle",function(){return Ac}),n.d(e,"ParticleSystem",function(){return Lc}),n.d(e,"PointCloudMaterial",function(){return Rc}),n.d(e,"ParticleBasicMaterial",function(){return Pc}),n.d(e,"ParticleSystemMaterial",function(){return Cc}),n.d(e,"Vertex",function(){return Ic}),n.d(e,"DynamicBufferAttribute",function(){return Uc}),n.d(e,"Int8Attribute",function(){return Nc}),n.d(e,"Uint8Attribute",function(){return Oc}),n.d(e,"Uint8ClampedAttribute",function(){return Dc}),n.d(e,"Int16Attribute",function(){return Fc}),n.d(e,"Uint16Attribute",function(){return Bc}),n.d(e,"Int32Attribute",function(){return zc}),n.d(e,"Uint32Attribute",function(){return Gc}),n.d(e,"Float32Attribute",function(){return Hc}),n.d(e,"Float64Attribute",function(){return Vc}),n.d(e,"ClosedSplineCurve3",function(){return kc}),n.d(e,"SplineCurve3",function(){return jc}),n.d(e,"Spline",function(){return Wc}),n.d(e,"BoundingBoxHelper",function(){return Xc}),n.d(e,"EdgesHelper",function(){return qc}),n.d(e,"WireframeHelper",function(){return Yc}),n.d(e,"XHRLoader",function(){return Zc}),n.d(e,"BinaryTextureLoader",function(){return Jc}),n.d(e,"GeometryUtils",function(){return Qc}),n.d(e,"ImageUtils",function(){return Kc}),n.d(e,"Projector",function(){return $c}),n.d(e,"CanvasRenderer",function(){return th}),void 0===Number.EPSILON&&(Number.EPSILON=Math.pow(2,-52)),void 0===Number.isInteger&&(Number.isInteger=function(t){return"number"==typeof t&&isFinite(t)&&Math.floor(t)===t}),void 0===Math.sign&&(Math.sign=function(t){return t<0?-1:t>0?1:+t}),void 0===Function.prototype.name&&Object.defineProperty(Function.prototype,"name",{get:function(){return this.toString().match(/^\s*function\s*([^\(\s]*)/)[1]}}),void 0===Object.assign&&(Object.assign=function(t){if(null==t)throw new TypeError("Cannot convert undefined or null to object");for(var e=Object(t),n=1;n<arguments.length;n++){var i=arguments[n];if(null!=i)for(var r in i)Object.prototype.hasOwnProperty.call(i,r)&&(e[r]=i[r])}return e}),Object.assign(i.prototype,{addEventListener:function(t,e){void 0===this._listeners&&(this._listeners={});var n=this._listeners;void 0===n[t]&&(n[t]=[]),-1===n[t].indexOf(e)&&n[t].push(e)},hasEventListener:function(t,e){if(void 0===this._listeners)return!1;var n=this._listeners;return void 0!==n[t]&&-1!==n[t].indexOf(e)},removeEventListener:function(t,e){if(void 0!==this._listeners){var n=this._listeners[t];if(void 0!==n){var i=n.indexOf(e);-1!==i&&n.splice(i,1)}}},dispatchEvent:function(t){if(void 0!==this._listeners){var e=this._listeners[t.type];if(void 0!==e){t.target=this;var n=[],i=0,r=e.length;for(i=0;i<r;i++)n[i]=e[i];for(i=0;i<r;i++)n[i].call(this,t)}}}});var r,o,a,s,c,h,u="85",l={LEFT:0,MIDDLE:1,RIGHT:2},d=0,p=1,f=2,m=3,g=0,v=1,y=0,x=1,b=2,_=0,w=1,M=2,E=1,T=2,S=0,A=1,L=2,R=0,P=1,C=2,I=3,U=4,N=5,O=100,D=101,F=102,B=103,z=104,G=200,H=201,V=202,k=203,j=204,W=205,X=206,q=207,Y=208,Z=209,J=210,Q=0,K=1,$=2,tt=3,et=4,nt=5,it=6,rt=7,ot=0,at=1,st=2,ct=0,ht=1,ut=2,lt=3,dt=4,pt=300,ft=301,mt=302,gt=303,vt=304,yt=305,xt=306,bt=307,_t=1e3,wt=1001,Mt=1002,Et=1003,Tt=1004,St=1005,At=1006,Lt=1007,Rt=1008,Pt=1009,Ct=1010,It=1011,Ut=1012,Nt=1013,Ot=1014,Dt=1015,Ft=1016,Bt=1017,zt=1018,Gt=1019,Ht=1020,Vt=1021,kt=1022,jt=1023,Wt=1024,Xt=1025,qt=jt,Yt=1026,Zt=1027,Jt=2001,Qt=2002,Kt=2003,$t=2004,te=2100,ee=2101,ne=2102,ie=2103,re=2151,oe=2200,ae=2201,se=2202,ce=2300,he=2301,ue=2302,le=2400,de=2401,pe=2402,fe=0,me=1,ge=2,ve=3e3,ye=3001,xe=3007,be=3002,_e=3003,we=3004,Me=3005,Ee=3006,Te=3200,Se=3201,Ae={DEG2RAD:Math.PI/180,RAD2DEG:180/Math.PI,generateUUID:(o="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz".split(""),a=new Array(36),s=0,function(){for(var t=0;t<36;t++)8===t||13===t||18===t||23===t?a[t]="-":14===t?a[t]="4":(s<=2&&(s=33554432+16777216*Math.random()|0),r=15&s,s>>=4,a[t]=o[19===t?3&r|8:r]);return a.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,i,r){return i+(t-e)*(r-i)/(n-e)},lerp:function(t,e,n){return(1-n)*t+n*e},smoothstep:function(t,e,n){return t<=e?0:t>=n?1:(t=(t-e)/(n-e))*t*(3-2*t)},smootherstep:function(t,e,n){return t<=e?0:t>=n?1:(t=(t-e)/(n-e))*t*t*(t*(6*t-15)+10)},randInt:function(t,e){return t+Math.floor(Math.random()*(e-t+1))},randFloat:function(t,e){return t+Math.random()*(e-t)},randFloatSpread:function(t){return t*(.5-Math.random())},degToRad:function(t){return t*Ae.DEG2RAD},radToDeg:function(t){return t*Ae.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}};function Le(t,e){this.x=t||0,this.y=e||0}Object.defineProperties(Le.prototype,{width:{get:function(){return this.x},set:function(t){this.x=t}},height:{get:function(){return this.y},set:function(t){this.y=t}}}),Object.assign(Le.prototype,{isVector2:!0,set:function(t,e){return this.x=t,this.y=e,this},setScalar:function(t){return this.x=t,this.y=t,this},setX:function(t){return this.x=t,this},setY:function(t){return this.y=t,this},setComponent:function(t,e){switch(t){case 0:this.x=e;break;case 1:this.y=e;break;default:throw new Error("index is out of range: "+t)}return this},getComponent:function(t){switch(t){case 0:return this.x;case 1:return this.y;default:throw new Error("index is out of range: "+t)}},clone:function(){return new this.constructor(this.x,this.y)},copy:function(t){return this.x=t.x,this.y=t.y,this},add:function(t,e){return void 0!==e?(console.warn("THREE.Vector2: .add() now only accepts one argument. Use .addVectors( a, b ) instead."),this.addVectors(t,e)):(this.x+=t.x,this.y+=t.y,this)},addScalar:function(t){return this.x+=t,this.y+=t,this},addVectors:function(t,e){return this.x=t.x+e.x,this.y=t.y+e.y,this},addScaledVector:function(t,e){return this.x+=t.x*e,this.y+=t.y*e,this},sub:function(t,e){return void 0!==e?(console.warn("THREE.Vector2: .sub() now only accepts one argument. Use .subVectors( a, b ) instead."),this.subVectors(t,e)):(this.x-=t.x,this.y-=t.y,this)},subScalar:function(t){return this.x-=t,this.y-=t,this},subVectors:function(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this},multiply:function(t){return this.x*=t.x,this.y*=t.y,this},multiplyScalar:function(t){return this.x*=t,this.y*=t,this},divide:function(t){return this.x/=t.x,this.y/=t.y,this},divideScalar:function(t){return this.multiplyScalar(1/t)},min:function(t){return this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y),this},max:function(t){return this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y),this},clamp:function(t,e){return this.x=Math.max(t.x,Math.min(e.x,this.x)),this.y=Math.max(t.y,Math.min(e.y,this.y)),this},clampScalar:(c=new Le,h=new Le,function(t,e){return c.set(t,t),h.set(e,e),this.clamp(c,h)}),clampLength:function(t,e){var n=this.length();return this.multiplyScalar(Math.max(t,Math.min(e,n))/n)},floor:function(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this},ceil:function(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this},round:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this},roundToZero:function(){return this.x=this.x<0?Math.ceil(this.x):Math.floor(this.x),this.y=this.y<0?Math.ceil(this.y):Math.floor(this.y),this},negate:function(){return this.x=-this.x,this.y=-this.y,this},dot:function(t){return this.x*t.x+this.y*t.y},lengthSq:function(){return this.x*this.x+this.y*this.y},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y)},lengthManhattan:function(){return Math.abs(this.x)+Math.abs(this.y)},normalize:function(){return this.divideScalar(this.length())},angle:function(){var t=Math.atan2(this.y,this.x);return t<0&&(t+=2*Math.PI),t},distanceTo:function(t){return Math.sqrt(this.distanceToSquared(t))},distanceToSquared:function(t){var e=this.x-t.x,n=this.y-t.y;return e*e+n*n},distanceToManhattan:function(t){return Math.abs(this.x-t.x)+Math.abs(this.y-t.y)},setLength:function(t){return this.multiplyScalar(t/this.length())},lerp:function(t,e){return this.x+=(t.x-this.x)*e,this.y+=(t.y-this.y)*e,this},lerpVectors:function(t,e,n){return this.subVectors(e,t).multiplyScalar(n).add(t)},equals:function(t){return t.x===this.x&&t.y===this.y},fromArray:function(t,e){return void 0===e&&(e=0),this.x=t[e],this.y=t[e+1],this},toArray:function(t,e){return void 0===t&&(t=[]),void 0===e&&(e=0),t[e]=this.x,t[e+1]=this.y,t},fromBufferAttribute:function(t,e,n){return void 0!==n&&console.warn("THREE.Vector2: offset has been removed from .fromBufferAttribute()."),this.x=t.getX(e),this.y=t.getY(e),this},rotateAround:function(t,e){var n=Math.cos(e),i=Math.sin(e),r=this.x-t.x,o=this.y-t.y;return this.x=r*n-o*i+t.x,this.y=r*i+o*n+t.y,this}});var Re,Pe,Ce,Ie,Ue,Ne,Oe=0;function De(t,e,n,i,r,o,a,s,c,h){Object.defineProperty(this,"id",{value:Oe++}),this.uuid=Ae.generateUUID(),this.name="",this.image=void 0!==t?t:De.DEFAULT_IMAGE,this.mipmaps=[],this.mapping=void 0!==e?e:De.DEFAULT_MAPPING,this.wrapS=void 0!==n?n:wt,this.wrapT=void 0!==i?i:wt,this.magFilter=void 0!==r?r:At,this.minFilter=void 0!==o?o:Rt,this.anisotropy=void 0!==c?c:1,this.format=void 0!==a?a:jt,this.type=void 0!==s?s:Pt,this.offset=new Le(0,0),this.repeat=new Le(1,1),this.generateMipmaps=!0,this.premultiplyAlpha=!1,this.flipY=!0,this.unpackAlignment=4,this.encoding=void 0!==h?h:ve,this.version=0,this.onUpdate=null}function Fe(t,e,n,i){this.x=t||0,this.y=e||0,this.z=n||0,this.w=void 0!==i?i:1}function Be(t,e,n){this.uuid=Ae.generateUUID(),this.width=t,this.height=e,this.scissor=new Fe(0,0,t,e),this.scissorTest=!1,this.viewport=new Fe(0,0,t,e),void 0===(n=n||{}).minFilter&&(n.minFilter=At),this.texture=new De(void 0,void 0,n.wrapS,n.wrapT,n.magFilter,n.minFilter,n.format,n.type,n.anisotropy,n.encoding),this.depthBuffer=void 0===n.depthBuffer||n.depthBuffer,this.stencilBuffer=void 0===n.stencilBuffer||n.stencilBuffer,this.depthTexture=void 0!==n.depthTexture?n.depthTexture:null}function ze(t,e,n){Be.call(this,t,e,n),this.activeCubeFace=0,this.activeMipMapLevel=0}function Ge(t,e,n,i){this._x=t||0,this._y=e||0,this._z=n||0,this._w=void 0!==i?i:1}function He(t,e,n){this.x=t||0,this.y=e||0,this.z=n||0}function Ve(){this.elements=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],arguments.length>0&&console.error("THREE.Matrix4: the constructor no longer reads arguments. use .set() instead.")}function ke(t,e,n,i,r,o,a,s,c,h,u,l){De.call(this,null,o,a,s,c,h,i,r,u,l),this.image={data:t,width:e,height:n},this.magFilter=void 0!==c?c:Et,this.minFilter=void 0!==h?h:Et,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}function je(t,e,n,i,r,o,a,s,c,h){t=void 0!==t?t:[],e=void 0!==e?e:ft,De.call(this,t,e,n,i,r,o,a,s,c,h),this.flipY=!1}De.DEFAULT_IMAGE=void 0,De.DEFAULT_MAPPING=pt,Object.defineProperty(De.prototype,"needsUpdate",{set:function(t){!0===t&&this.version++}}),Object.assign(De.prototype,i.prototype,{constructor:De,isTexture:!0,clone:function(){return(new this.constructor).copy(this)},copy:function(t){return this.name=t.name,this.image=t.image,this.mipmaps=t.mipmaps.slice(0),this.mapping=t.mapping,this.wrapS=t.wrapS,this.wrapT=t.wrapT,this.magFilter=t.magFilter,this.minFilter=t.minFilter,this.anisotropy=t.anisotropy,this.format=t.format,this.type=t.type,this.offset.copy(t.offset),this.repeat.copy(t.repeat),this.generateMipmaps=t.generateMipmaps,this.premultiplyAlpha=t.premultiplyAlpha,this.flipY=t.flipY,this.unpackAlignment=t.unpackAlignment,this.encoding=t.encoding,this},toJSON:function(t){if(void 0!==t.textures[this.uuid])return t.textures[this.uuid];var e={metadata:{version:4.5,type:"Texture",generator:"Texture.toJSON"},uuid:this.uuid,name:this.name,mapping:this.mapping,repeat:[this.repeat.x,this.repeat.y],offset:[this.offset.x,this.offset.y],wrap:[this.wrapS,this.wrapT],minFilter:this.minFilter,magFilter:this.magFilter,anisotropy:this.anisotropy,flipY:this.flipY};if(void 0!==this.image){var n=this.image;void 0===n.uuid&&(n.uuid=Ae.generateUUID()),void 0===t.images[n.uuid]&&(t.images[n.uuid]={uuid:n.uuid,url:function(t){var e;return void 0!==t.toDataURL?e=t:((e=document.createElementNS("http://www.w3.org/1999/xhtml","canvas")).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")}(n)}),e.image=n.uuid}return t.textures[this.uuid]=e,e},dispose:function(){this.dispatchEvent({type:"dispose"})},transformUv:function(t){if(this.mapping===pt){if(t.multiply(this.repeat),t.add(this.offset),t.x<0||t.x>1)switch(this.wrapS){case _t:t.x=t.x-Math.floor(t.x);break;case wt:t.x=t.x<0?0:1;break;case Mt: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 _t:t.y=t.y-Math.floor(t.y);break;case wt:t.y=t.y<0?0:1;break;case Mt: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(Fe.prototype,{isVector4:!0,set:function(t,e,n,i){return this.x=t,this.y=e,this.z=n,this.w=i,this},setScalar:function(t){return this.x=t,this.y=t,this.z=t,this.w=t,this},setX:function(t){return this.x=t,this},setY:function(t){return this.y=t,this},setZ:function(t){return this.z=t,this},setW:function(t){return this.w=t,this},setComponent:function(t,e){switch(t){case 0:this.x=e;break;case 1:this.y=e;break;case 2:this.z=e;break;case 3:this.w=e;break;default:throw new Error("index is out of range: "+t)}return this},getComponent:function(t){switch(t){case 0:return this.x;case 1:return this.y;case 2:return this.z;case 3:return this.w;default:throw new Error("index is out of range: "+t)}},clone:function(){return new this.constructor(this.x,this.y,this.z,this.w)},copy:function(t){return this.x=t.x,this.y=t.y,this.z=t.z,this.w=void 0!==t.w?t.w:1,this},add:function(t,e){return void 0!==e?(console.warn("THREE.Vector4: .add() now only accepts one argument. Use .addVectors( a, b ) instead."),this.addVectors(t,e)):(this.x+=t.x,this.y+=t.y,this.z+=t.z,this.w+=t.w,this)},addScalar:function(t){return this.x+=t,this.y+=t,this.z+=t,this.w+=t,this},addVectors:function(t,e){return this.x=t.x+e.x,this.y=t.y+e.y,this.z=t.z+e.z,this.w=t.w+e.w,this},addScaledVector:function(t,e){return this.x+=t.x*e,this.y+=t.y*e,this.z+=t.z*e,this.w+=t.w*e,this},sub:function(t,e){return void 0!==e?(console.warn("THREE.Vector4: .sub() now only accepts one argument. Use .subVectors( a, b ) instead."),this.subVectors(t,e)):(this.x-=t.x,this.y-=t.y,this.z-=t.z,this.w-=t.w,this)},subScalar:function(t){return this.x-=t,this.y-=t,this.z-=t,this.w-=t,this},subVectors:function(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this.z=t.z-e.z,this.w=t.w-e.w,this},multiplyScalar:function(t){return this.x*=t,this.y*=t,this.z*=t,this.w*=t,this},applyMatrix4:function(t){var e=this.x,n=this.y,i=this.z,r=this.w,o=t.elements;return this.x=o[0]*e+o[4]*n+o[8]*i+o[12]*r,this.y=o[1]*e+o[5]*n+o[9]*i+o[13]*r,this.z=o[2]*e+o[6]*n+o[10]*i+o[14]*r,this.w=o[3]*e+o[7]*n+o[11]*i+o[15]*r,this},divideScalar:function(t){return this.multiplyScalar(1/t)},setAxisAngleFromQuaternion:function(t){this.w=2*Math.acos(t.w);var e=Math.sqrt(1-t.w*t.w);return e<1e-4?(this.x=1,this.y=0,this.z=0):(this.x=t.x/e,this.y=t.y/e,this.z=t.z/e),this},setAxisAngleFromRotationMatrix:function(t){var e,n,i,r,o=t.elements,a=o[0],s=o[4],c=o[8],h=o[1],u=o[5],l=o[9],d=o[2],p=o[6],f=o[10];if(Math.abs(s-h)<.01&&Math.abs(c-d)<.01&&Math.abs(l-p)<.01){if(Math.abs(s+h)<.1&&Math.abs(c+d)<.1&&Math.abs(l+p)<.1&&Math.abs(a+u+f-3)<.1)return this.set(1,0,0,0),this;e=Math.PI;var m=(a+1)/2,g=(u+1)/2,v=(f+1)/2,y=(s+h)/4,x=(c+d)/4,b=(l+p)/4;return m>g&&m>v?m<.01?(n=0,i=.707106781,r=.707106781):(i=y/(n=Math.sqrt(m)),r=x/n):g>v?g<.01?(n=.707106781,i=0,r=.707106781):(n=y/(i=Math.sqrt(g)),r=b/i):v<.01?(n=.707106781,i=.707106781,r=0):(n=x/(r=Math.sqrt(v)),i=b/r),this.set(n,i,r,e),this}var _=Math.sqrt((p-l)*(p-l)+(c-d)*(c-d)+(h-s)*(h-s));return Math.abs(_)<.001&&(_=1),this.x=(p-l)/_,this.y=(c-d)/_,this.z=(h-s)/_,this.w=Math.acos((a+u+f-1)/2),this},min:function(t){return this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y),this.z=Math.min(this.z,t.z),this.w=Math.min(this.w,t.w),this},max:function(t){return this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y),this.z=Math.max(this.z,t.z),this.w=Math.max(this.w,t.w),this},clamp:function(t,e){return this.x=Math.max(t.x,Math.min(e.x,this.x)),this.y=Math.max(t.y,Math.min(e.y,this.y)),this.z=Math.max(t.z,Math.min(e.z,this.z)),this.w=Math.max(t.w,Math.min(e.w,this.w)),this},clampScalar:function(){var t=new Fe,e=new Fe;return function(n,i){return t.set(n,n,n,n),e.set(i,i,i,i),this.clamp(t,e)}}(),floor:function(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this.w=Math.floor(this.w),this},ceil:function(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this.w=Math.ceil(this.w),this},round:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this.w=Math.round(this.w),this},roundToZero:function(){return this.x=this.x<0?Math.ceil(this.x):Math.floor(this.x),this.y=this.y<0?Math.ceil(this.y):Math.floor(this.y),this.z=this.z<0?Math.ceil(this.z):Math.floor(this.z),this.w=this.w<0?Math.ceil(this.w):Math.floor(this.w),this},negate:function(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this.w=-this.w,this},dot:function(t){return this.x*t.x+this.y*t.y+this.z*t.z+this.w*t.w},lengthSq:function(){return this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)},lengthManhattan:function(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)+Math.abs(this.w)},normalize:function(){return this.divideScalar(this.length())},setLength:function(t){return this.multiplyScalar(t/this.length())},lerp:function(t,e){return this.x+=(t.x-this.x)*e,this.y+=(t.y-this.y)*e,this.z+=(t.z-this.z)*e,this.w+=(t.w-this.w)*e,this},lerpVectors:function(t,e,n){return this.subVectors(e,t).multiplyScalar(n).add(t)},equals:function(t){return t.x===this.x&&t.y===this.y&&t.z===this.z&&t.w===this.w},fromArray:function(t,e){return void 0===e&&(e=0),this.x=t[e],this.y=t[e+1],this.z=t[e+2],this.w=t[e+3],this},toArray:function(t,e){return void 0===t&&(t=[]),void 0===e&&(e=0),t[e]=this.x,t[e+1]=this.y,t[e+2]=this.z,t[e+3]=this.w,t},fromBufferAttribute:function(t,e,n){return void 0!==n&&console.warn("THREE.Vector4: offset has been removed from .fromBufferAttribute()."),this.x=t.getX(e),this.y=t.getY(e),this.z=t.getZ(e),this.w=t.getW(e),this}}),Object.assign(Be.prototype,i.prototype,{isWebGLRenderTarget:!0,setSize:function(t,e){this.width===t&&this.height===e||(this.width=t,this.height=e,this.dispose()),this.viewport.set(0,0,t,e),this.scissor.set(0,0,t,e)},clone:function(){return(new this.constructor).copy(this)},copy:function(t){return this.width=t.width,this.height=t.height,this.viewport.copy(t.viewport),this.texture=t.texture.clone(),this.depthBuffer=t.depthBuffer,this.stencilBuffer=t.stencilBuffer,this.depthTexture=t.depthTexture,this},dispose:function(){this.dispatchEvent({type:"dispose"})}}),ze.prototype=Object.create(Be.prototype),ze.prototype.constructor=ze,ze.prototype.isWebGLRenderTargetCube=!0,Object.assign(Ge,{slerp:function(t,e,n,i){return n.copy(t).slerp(e,i)},slerpFlat:function(t,e,n,i,r,o,a){var s=n[i+0],c=n[i+1],h=n[i+2],u=n[i+3],l=r[o+0],d=r[o+1],p=r[o+2],f=r[o+3];if(u!==f||s!==l||c!==d||h!==p){var m=1-a,g=s*l+c*d+h*p+u*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,a=Math.sin(a*b)/x}var _=a*v;if(s=s*m+l*_,c=c*m+d*_,h=h*m+p*_,u=u*m+f*_,m===1-a){var w=1/Math.sqrt(s*s+c*c+h*h+u*u);s*=w,c*=w,h*=w,u*=w}}t[e]=s,t[e+1]=c,t[e+2]=h,t[e+3]=u}}),Object.defineProperties(Ge.prototype,{x:{get:function(){return this._x},set:function(t){this._x=t,this.onChangeCallback()}},y:{get:function(){return this._y},set:function(t){this._y=t,this.onChangeCallback()}},z:{get:function(){return this._z},set:function(t){this._z=t,this.onChangeCallback()}},w:{get:function(){return this._w},set:function(t){this._w=t,this.onChangeCallback()}}}),Object.assign(Ge.prototype,{set:function(t,e,n,i){return this._x=t,this._y=e,this._z=n,this._w=i,this.onChangeCallback(),this},clone:function(){return new this.constructor(this._x,this._y,this._z,this._w)},copy:function(t){return this._x=t.x,this._y=t.y,this._z=t.z,this._w=t.w,this.onChangeCallback(),this},setFromEuler:function(t,e){if(!1===(t&&t.isEuler))throw new Error("THREE.Quaternion: .setFromEuler() now expects an Euler rotation rather than a Vector3 and order.");var n=t._x,i=t._y,r=t._z,o=t.order,a=Math.cos,s=Math.sin,c=a(n/2),h=a(i/2),u=a(r/2),l=s(n/2),d=s(i/2),p=s(r/2);return"XYZ"===o?(this._x=l*h*u+c*d*p,this._y=c*d*u-l*h*p,this._z=c*h*p+l*d*u,this._w=c*h*u-l*d*p):"YXZ"===o?(this._x=l*h*u+c*d*p,this._y=c*d*u-l*h*p,this._z=c*h*p-l*d*u,this._w=c*h*u+l*d*p):"ZXY"===o?(this._x=l*h*u-c*d*p,this._y=c*d*u+l*h*p,this._z=c*h*p+l*d*u,this._w=c*h*u-l*d*p):"ZYX"===o?(this._x=l*h*u-c*d*p,this._y=c*d*u+l*h*p,this._z=c*h*p-l*d*u,this._w=c*h*u+l*d*p):"YZX"===o?(this._x=l*h*u+c*d*p,this._y=c*d*u+l*h*p,this._z=c*h*p-l*d*u,this._w=c*h*u-l*d*p):"XZY"===o&&(this._x=l*h*u-c*d*p,this._y=c*d*u-l*h*p,this._z=c*h*p+l*d*u,this._w=c*h*u+l*d*p),!1!==e&&this.onChangeCallback(),this},setFromAxisAngle:function(t,e){var n=e/2,i=Math.sin(n);return this._x=t.x*i,this._y=t.y*i,this._z=t.z*i,this._w=Math.cos(n),this.onChangeCallback(),this},setFromRotationMatrix:function(t){var e,n=t.elements,i=n[0],r=n[4],o=n[8],a=n[1],s=n[5],c=n[9],h=n[2],u=n[6],l=n[10],d=i+s+l;return d>0?(e=.5/Math.sqrt(d+1),this._w=.25/e,this._x=(u-c)*e,this._y=(o-h)*e,this._z=(a-r)*e):i>s&&i>l?(e=2*Math.sqrt(1+i-s-l),this._w=(u-c)/e,this._x=.25*e,this._y=(r+a)/e,this._z=(o+h)/e):s>l?(e=2*Math.sqrt(1+s-i-l),this._w=(o-h)/e,this._x=(r+a)/e,this._y=.25*e,this._z=(c+u)/e):(e=2*Math.sqrt(1+l-i-s),this._w=(a-r)/e,this._x=(o+h)/e,this._y=(c+u)/e,this._z=.25*e),this.onChangeCallback(),this},setFromUnitVectors:function(){var t,e=new He;return function(n,i){return void 0===e&&(e=new He),(t=n.dot(i)+1)<1e-6?(t=0,Math.abs(n.x)>Math.abs(n.z)?e.set(-n.y,n.x,0):e.set(0,-n.z,n.y)):e.crossVectors(n,i),this._x=e.x,this._y=e.y,this._z=e.z,this._w=t,this.normalize()}}(),inverse:function(){return this.conjugate().normalize()},conjugate:function(){return this._x*=-1,this._y*=-1,this._z*=-1,this.onChangeCallback(),this},dot:function(t){return this._x*t._x+this._y*t._y+this._z*t._z+this._w*t._w},lengthSq:function(){return this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w},length:function(){return Math.sqrt(this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w)},normalize:function(){var t=this.length();return 0===t?(this._x=0,this._y=0,this._z=0,this._w=1):(t=1/t,this._x=this._x*t,this._y=this._y*t,this._z=this._z*t,this._w=this._w*t),this.onChangeCallback(),this},multiply:function(t,e){return void 0!==e?(console.warn("THREE.Quaternion: .multiply() now only accepts one argument. Use .multiplyQuaternions( a, b ) instead."),this.multiplyQuaternions(t,e)):this.multiplyQuaternions(this,t)},premultiply:function(t){return this.multiplyQuaternions(t,this)},multiplyQuaternions:function(t,e){var n=t._x,i=t._y,r=t._z,o=t._w,a=e._x,s=e._y,c=e._z,h=e._w;return this._x=n*h+o*a+i*c-r*s,this._y=i*h+o*s+r*a-n*c,this._z=r*h+o*c+n*s-i*a,this._w=o*h-n*a-i*s-r*c,this.onChangeCallback(),this},slerp:function(t,e){if(0===e)return this;if(1===e)return this.copy(t);var n=this._x,i=this._y,r=this._z,o=this._w,a=o*t._w+n*t._x+i*t._y+r*t._z;if(a<0?(this._w=-t._w,this._x=-t._x,this._y=-t._y,this._z=-t._z,a=-a):this.copy(t),a>=1)return this._w=o,this._x=n,this._y=i,this._z=r,this;var s=Math.sqrt(1-a*a);if(Math.abs(s)<.001)return this._w=.5*(o+this._w),this._x=.5*(n+this._x),this._y=.5*(i+this._y),this._z=.5*(r+this._z),this;var c=Math.atan2(s,a),h=Math.sin((1-e)*c)/s,u=Math.sin(e*c)/s;return this._w=o*h+this._w*u,this._x=n*h+this._x*u,this._y=i*h+this._y*u,this._z=r*h+this._z*u,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(He.prototype,{isVector3:!0,set:function(t,e,n){return this.x=t,this.y=e,this.z=n,this},setScalar:function(t){return this.x=t,this.y=t,this.z=t,this},setX:function(t){return this.x=t,this},setY:function(t){return this.y=t,this},setZ:function(t){return this.z=t,this},setComponent:function(t,e){switch(t){case 0:this.x=e;break;case 1:this.y=e;break;case 2:this.z=e;break;default:throw new Error("index is out of range: "+t)}return this},getComponent:function(t){switch(t){case 0:return this.x;case 1:return this.y;case 2:return this.z;default:throw new Error("index is out of range: "+t)}},clone:function(){return new this.constructor(this.x,this.y,this.z)},copy:function(t){return this.x=t.x,this.y=t.y,this.z=t.z,this},add:function(t,e){return void 0!==e?(console.warn("THREE.Vector3: .add() now only accepts one argument. Use .addVectors( a, b ) instead."),this.addVectors(t,e)):(this.x+=t.x,this.y+=t.y,this.z+=t.z,this)},addScalar:function(t){return this.x+=t,this.y+=t,this.z+=t,this},addVectors:function(t,e){return this.x=t.x+e.x,this.y=t.y+e.y,this.z=t.z+e.z,this},addScaledVector:function(t,e){return this.x+=t.x*e,this.y+=t.y*e,this.z+=t.z*e,this},sub:function(t,e){return void 0!==e?(console.warn("THREE.Vector3: .sub() now only accepts one argument. Use .subVectors( a, b ) instead."),this.subVectors(t,e)):(this.x-=t.x,this.y-=t.y,this.z-=t.z,this)},subScalar:function(t){return this.x-=t,this.y-=t,this.z-=t,this},subVectors:function(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this.z=t.z-e.z,this},multiply:function(t,e){return void 0!==e?(console.warn("THREE.Vector3: .multiply() now only accepts one argument. Use .multiplyVectors( a, b ) instead."),this.multiplyVectors(t,e)):(this.x*=t.x,this.y*=t.y,this.z*=t.z,this)},multiplyScalar:function(t){return this.x*=t,this.y*=t,this.z*=t,this},multiplyVectors:function(t,e){return this.x=t.x*e.x,this.y=t.y*e.y,this.z=t.z*e.z,this},applyEuler:(Ce=new Ge,function(t){return!1===(t&&t.isEuler)&&console.error("THREE.Vector3: .applyEuler() now expects an Euler rotation rather than a Vector3 and order."),this.applyQuaternion(Ce.setFromEuler(t))}),applyAxisAngle:function(){var t=new Ge;return function(e,n){return this.applyQuaternion(t.setFromAxisAngle(e,n))}}(),applyMatrix3:function(t){var e=this.x,n=this.y,i=this.z,r=t.elements;return this.x=r[0]*e+r[3]*n+r[6]*i,this.y=r[1]*e+r[4]*n+r[7]*i,this.z=r[2]*e+r[5]*n+r[8]*i,this},applyMatrix4:function(t){var e=this.x,n=this.y,i=this.z,r=t.elements;this.x=r[0]*e+r[4]*n+r[8]*i+r[12],this.y=r[1]*e+r[5]*n+r[9]*i+r[13],this.z=r[2]*e+r[6]*n+r[10]*i+r[14];var o=r[3]*e+r[7]*n+r[11]*i+r[15];return this.divideScalar(o)},applyQuaternion:function(t){var e=this.x,n=this.y,i=this.z,r=t.x,o=t.y,a=t.z,s=t.w,c=s*e+o*i-a*n,h=s*n+a*e-r*i,u=s*i+r*n-o*e,l=-r*e-o*n-a*i;return this.x=c*s+l*-r+h*-a-u*-o,this.y=h*s+l*-o+u*-r-c*-a,this.z=u*s+l*-a+c*-o-h*-r,this},project:(Pe=new Ve,function(t){return Pe.multiplyMatrices(t.projectionMatrix,Pe.getInverse(t.matrixWorld)),this.applyMatrix4(Pe)}),unproject:function(){var t=new Ve;return function(e){return t.multiplyMatrices(e.matrixWorld,t.getInverse(e.projectionMatrix)),this.applyMatrix4(t)}}(),transformDirection:function(t){var e=this.x,n=this.y,i=this.z,r=t.elements;return this.x=r[0]*e+r[4]*n+r[8]*i,this.y=r[1]*e+r[5]*n+r[9]*i,this.z=r[2]*e+r[6]*n+r[10]*i,this.normalize()},divide:function(t){return this.x/=t.x,this.y/=t.y,this.z/=t.z,this},divideScalar:function(t){return this.multiplyScalar(1/t)},min:function(t){return this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y),this.z=Math.min(this.z,t.z),this},max:function(t){return this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y),this.z=Math.max(this.z,t.z),this},clamp:function(t,e){return this.x=Math.max(t.x,Math.min(e.x,this.x)),this.y=Math.max(t.y,Math.min(e.y,this.y)),this.z=Math.max(t.z,Math.min(e.z,this.z)),this},clampScalar:function(){var t=new He,e=new He;return function(n,i){return t.set(n,n,n),e.set(i,i,i),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,i=this.y,r=this.z;return this.x=i*t.z-r*t.y,this.y=r*t.x-n*t.z,this.z=n*t.y-i*t.x,this},crossVectors:function(t,e){var n=t.x,i=t.y,r=t.z,o=e.x,a=e.y,s=e.z;return this.x=i*s-r*a,this.y=r*o-n*s,this.z=n*a-i*o,this},projectOnVector:function(t){var e=t.dot(this)/t.lengthSq();return this.copy(t).multiplyScalar(e)},projectOnPlane:(Re=new He,function(t){return Re.copy(this).projectOnVector(t),this.sub(Re)}),reflect:function(){var t=new He;return function(e){return this.sub(t.copy(e).multiplyScalar(2*this.dot(e)))}}(),angleTo:function(t){var e=this.dot(t)/Math.sqrt(this.lengthSq()*t.lengthSq());return Math.acos(Ae.clamp(e,-1,1))},distanceTo:function(t){return Math.sqrt(this.distanceToSquared(t))},distanceToSquared:function(t){var e=this.x-t.x,n=this.y-t.y,i=this.z-t.z;return e*e+n*n+i*i},distanceToManhattan:function(t){return Math.abs(this.x-t.x)+Math.abs(this.y-t.y)+Math.abs(this.z-t.z)},setFromSpherical:function(t){var e=Math.sin(t.phi)*t.radius;return this.x=e*Math.sin(t.theta),this.y=Math.cos(t.phi)*t.radius,this.z=e*Math.cos(t.theta),this},setFromCylindrical:function(t){return this.x=t.radius*Math.sin(t.theta),this.y=t.y,this.z=t.radius*Math.cos(t.theta),this},setFromMatrixPosition:function(t){return this.setFromMatrixColumn(t,3)},setFromMatrixScale:function(t){var e=this.setFromMatrixColumn(t,0).length(),n=this.setFromMatrixColumn(t,1).length(),i=this.setFromMatrixColumn(t,2).length();return this.x=e,this.y=n,this.z=i,this},setFromMatrixColumn:function(t,e){return this.fromArray(t.elements,4*e)},equals:function(t){return t.x===this.x&&t.y===this.y&&t.z===this.z},fromArray:function(t,e){return void 0===e&&(e=0),this.x=t[e],this.y=t[e+1],this.z=t[e+2],this},toArray:function(t,e){return void 0===t&&(t=[]),void 0===e&&(e=0),t[e]=this.x,t[e+1]=this.y,t[e+2]=this.z,t},fromBufferAttribute:function(t,e,n){return void 0!==n&&console.warn("THREE.Vector3: offset has been removed from .fromBufferAttribute()."),this.x=t.getX(e),this.y=t.getY(e),this.z=t.getZ(e),this}}),Object.assign(Ve.prototype,{isMatrix4:!0,set:function(t,e,n,i,r,o,a,s,c,h,u,l,d,p,f,m){var g=this.elements;return g[0]=t,g[4]=e,g[8]=n,g[12]=i,g[1]=r,g[5]=o,g[9]=a,g[13]=s,g[2]=c,g[6]=h,g[10]=u,g[14]=l,g[3]=d,g[7]=p,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 Ve).fromArray(this.elements)},copy:function(t){var e=this.elements,n=t.elements;return e[0]=n[0],e[1]=n[1],e[2]=n[2],e[3]=n[3],e[4]=n[4],e[5]=n[5],e[6]=n[6],e[7]=n[7],e[8]=n[8],e[9]=n[9],e[10]=n[10],e[11]=n[11],e[12]=n[12],e[13]=n[13],e[14]=n[14],e[15]=n[15],this},copyPosition:function(t){var e=this.elements,n=t.elements;return e[12]=n[12],e[13]=n[13],e[14]=n[14],this},extractBasis:function(t,e,n){return t.setFromMatrixColumn(this,0),e.setFromMatrixColumn(this,1),n.setFromMatrixColumn(this,2),this},makeBasis:function(t,e,n){return this.set(t.x,e.x,n.x,0,t.y,e.y,n.y,0,t.z,e.z,n.z,0,0,0,0,1),this},extractRotation:function(){var t=new He;return function(e){var n=this.elements,i=e.elements,r=1/t.setFromMatrixColumn(e,0).length(),o=1/t.setFromMatrixColumn(e,1).length(),a=1/t.setFromMatrixColumn(e,2).length();return n[0]=i[0]*r,n[1]=i[1]*r,n[2]=i[2]*r,n[4]=i[4]*o,n[5]=i[5]*o,n[6]=i[6]*o,n[8]=i[8]*a,n[9]=i[9]*a,n[10]=i[10]*a,this}}(),makeRotationFromEuler:function(t){!1===(t&&t.isEuler)&&console.error("THREE.Matrix: .makeRotationFromEuler() now expects a Euler rotation rather than a Vector3 and order.");var e=this.elements,n=t.x,i=t.y,r=t.z,o=Math.cos(n),a=Math.sin(n),s=Math.cos(i),c=Math.sin(i),h=Math.cos(r),u=Math.sin(r);if("XYZ"===t.order){var l=o*h,d=o*u,p=a*h,f=a*u;e[0]=s*h,e[4]=-s*u,e[8]=c,e[1]=d+p*c,e[5]=l-f*c,e[9]=-a*s,e[2]=f-l*c,e[6]=p+d*c,e[10]=o*s}else if("YXZ"===t.order){var m=s*h,g=s*u,v=c*h,y=c*u;e[0]=m+y*a,e[4]=v*a-g,e[8]=o*c,e[1]=o*u,e[5]=o*h,e[9]=-a,e[2]=g*a-v,e[6]=y+m*a,e[10]=o*s}else if("ZXY"===t.order){m=s*h,g=s*u,v=c*h,y=c*u;e[0]=m-y*a,e[4]=-o*u,e[8]=v+g*a,e[1]=g+v*a,e[5]=o*h,e[9]=y-m*a,e[2]=-o*c,e[6]=a,e[10]=o*s}else if("ZYX"===t.order){l=o*h,d=o*u,p=a*h,f=a*u;e[0]=s*h,e[4]=p*c-d,e[8]=l*c+f,e[1]=s*u,e[5]=f*c+l,e[9]=d*c-p,e[2]=-c,e[6]=a*s,e[10]=o*s}else if("YZX"===t.order){var x=o*s,b=o*c,_=a*s,w=a*c;e[0]=s*h,e[4]=w-x*u,e[8]=_*u+b,e[1]=u,e[5]=o*h,e[9]=-a*h,e[2]=-c*h,e[6]=b*u+_,e[10]=x-w*u}else if("XZY"===t.order){x=o*s,b=o*c,_=a*s,w=a*c;e[0]=s*h,e[4]=-u,e[8]=c*h,e[1]=x*u+w,e[5]=o*h,e[9]=b*u-_,e[2]=_*u-b,e[6]=a*h,e[10]=w*u+x}return e[3]=0,e[7]=0,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,this},makeRotationFromQuaternion:function(t){var e=this.elements,n=t._x,i=t._y,r=t._z,o=t._w,a=n+n,s=i+i,c=r+r,h=n*a,u=n*s,l=n*c,d=i*s,p=i*c,f=r*c,m=o*a,g=o*s,v=o*c;return e[0]=1-(d+f),e[4]=u-v,e[8]=l+g,e[1]=u+v,e[5]=1-(h+f),e[9]=p-m,e[2]=l-g,e[6]=p+m,e[10]=1-(h+d),e[3]=0,e[7]=0,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,this},lookAt:(Ie=new He,Ue=new He,Ne=new He,function(t,e,n){var i=this.elements;return Ne.subVectors(t,e),0===Ne.lengthSq()&&(Ne.z=1),Ne.normalize(),Ie.crossVectors(n,Ne),0===Ie.lengthSq()&&(Ne.z+=1e-4,Ie.crossVectors(n,Ne)),Ie.normalize(),Ue.crossVectors(Ne,Ie),i[0]=Ie.x,i[4]=Ue.x,i[8]=Ne.x,i[1]=Ie.y,i[5]=Ue.y,i[9]=Ne.y,i[2]=Ie.z,i[6]=Ue.z,i[10]=Ne.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,i=e.elements,r=this.elements,o=n[0],a=n[4],s=n[8],c=n[12],h=n[1],u=n[5],l=n[9],d=n[13],p=n[2],f=n[6],m=n[10],g=n[14],v=n[3],y=n[7],x=n[11],b=n[15],_=i[0],w=i[4],M=i[8],E=i[12],T=i[1],S=i[5],A=i[9],L=i[13],R=i[2],P=i[6],C=i[10],I=i[14],U=i[3],N=i[7],O=i[11],D=i[15];return r[0]=o*_+a*T+s*R+c*U,r[4]=o*w+a*S+s*P+c*N,r[8]=o*M+a*A+s*C+c*O,r[12]=o*E+a*L+s*I+c*D,r[1]=h*_+u*T+l*R+d*U,r[5]=h*w+u*S+l*P+d*N,r[9]=h*M+u*A+l*C+d*O,r[13]=h*E+u*L+l*I+d*D,r[2]=p*_+f*T+m*R+g*U,r[6]=p*w+f*S+m*P+g*N,r[10]=p*M+f*A+m*C+g*O,r[14]=p*E+f*L+m*I+g*D,r[3]=v*_+y*T+x*R+b*U,r[7]=v*w+y*S+x*P+b*N,r[11]=v*M+y*A+x*C+b*O,r[15]=v*E+y*L+x*I+b*D,this},multiplyScalar:function(t){var e=this.elements;return e[0]*=t,e[4]*=t,e[8]*=t,e[12]*=t,e[1]*=t,e[5]*=t,e[9]*=t,e[13]*=t,e[2]*=t,e[6]*=t,e[10]*=t,e[14]*=t,e[3]*=t,e[7]*=t,e[11]*=t,e[15]*=t,this},applyToBufferAttribute:function(){var t=new He;return function(e){for(var n=0,i=e.count;n<i;n++)t.x=e.getX(n),t.y=e.getY(n),t.z=e.getZ(n),t.applyMatrix4(this),e.setXYZ(n,t.x,t.y,t.z);return e}}(),determinant:function(){var t=this.elements,e=t[0],n=t[4],i=t[8],r=t[12],o=t[1],a=t[5],s=t[9],c=t[13],h=t[2],u=t[6],l=t[10],d=t[14];return t[3]*(+r*s*u-i*c*u-r*a*l+n*c*l+i*a*d-n*s*d)+t[7]*(+e*s*d-e*c*l+r*o*l-i*o*d+i*c*h-r*s*h)+t[11]*(+e*c*u-e*a*d-r*o*u+n*o*d+r*a*h-n*c*h)+t[15]*(-i*a*h-e*s*u+e*a*l+i*o*u-n*o*l+n*s*h)},transpose:function(){var t,e=this.elements;return t=e[1],e[1]=e[4],e[4]=t,t=e[2],e[2]=e[8],e[8]=t,t=e[6],e[6]=e[9],e[9]=t,t=e[3],e[3]=e[12],e[12]=t,t=e[7],e[7]=e[13],e[13]=t,t=e[11],e[11]=e[14],e[14]=t,this},setPosition:function(t){var e=this.elements;return e[12]=t.x,e[13]=t.y,e[14]=t.z,this},getInverse:function(t,e){var n=this.elements,i=t.elements,r=i[0],o=i[1],a=i[2],s=i[3],c=i[4],h=i[5],u=i[6],l=i[7],d=i[8],p=i[9],f=i[10],m=i[11],g=i[12],v=i[13],y=i[14],x=i[15],b=p*y*l-v*f*l+v*u*m-h*y*m-p*u*x+h*f*x,_=g*f*l-d*y*l-g*u*m+c*y*m+d*u*x-c*f*x,w=d*v*l-g*p*l+g*h*m-c*v*m-d*h*x+c*p*x,M=g*p*u-d*v*u-g*h*f+c*v*f+d*h*y-c*p*y,E=r*b+o*_+a*w+s*M;if(0===E){var T="THREE.Matrix4.getInverse(): can't invert matrix, determinant is 0";if(!0===e)throw new Error(T);return console.warn(T),this.identity()}var S=1/E;return n[0]=b*S,n[1]=(v*f*s-p*y*s-v*a*m+o*y*m+p*a*x-o*f*x)*S,n[2]=(h*y*s-v*u*s+v*a*l-o*y*l-h*a*x+o*u*x)*S,n[3]=(p*u*s-h*f*s-p*a*l+o*f*l+h*a*m-o*u*m)*S,n[4]=_*S,n[5]=(d*y*s-g*f*s+g*a*m-r*y*m-d*a*x+r*f*x)*S,n[6]=(g*u*s-c*y*s-g*a*l+r*y*l+c*a*x-r*u*x)*S,n[7]=(c*f*s-d*u*s+d*a*l-r*f*l-c*a*m+r*u*m)*S,n[8]=w*S,n[9]=(g*p*s-d*v*s-g*o*m+r*v*m+d*o*x-r*p*x)*S,n[10]=(c*v*s-g*h*s+g*o*l-r*v*l-c*o*x+r*h*x)*S,n[11]=(d*h*s-c*p*s-d*o*l+r*p*l+c*o*m-r*h*m)*S,n[12]=M*S,n[13]=(d*v*a-g*p*a+g*o*f-r*v*f-d*o*y+r*p*y)*S,n[14]=(g*h*a-c*v*a-g*o*u+r*v*u+c*o*y-r*h*y)*S,n[15]=(c*p*a-d*h*a+d*o*u-r*p*u-c*o*f+r*h*f)*S,this},scale:function(t){var e=this.elements,n=t.x,i=t.y,r=t.z;return e[0]*=n,e[4]*=i,e[8]*=r,e[1]*=n,e[5]*=i,e[9]*=r,e[2]*=n,e[6]*=i,e[10]*=r,e[3]*=n,e[7]*=i,e[11]*=r,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],i=t[8]*t[8]+t[9]*t[9]+t[10]*t[10];return Math.sqrt(Math.max(e,n,i))},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),i=Math.sin(e),r=1-n,o=t.x,a=t.y,s=t.z,c=r*o,h=r*a;return this.set(c*o+n,c*a-i*s,c*s+i*a,0,c*a+i*s,h*a+n,h*s-i*o,0,c*s-i*a,h*s+i*o,r*s*s+n,0,0,0,0,1),this},makeScale:function(t,e,n){return this.set(t,0,0,0,0,e,0,0,0,0,n,0,0,0,0,1),this},makeShear:function(t,e,n){return this.set(1,e,n,0,t,1,n,0,t,e,1,0,0,0,0,1),this},compose:function(t,e,n){return this.makeRotationFromQuaternion(e),this.scale(n),this.setPosition(t),this},decompose:function(){var t=new He,e=new Ve;return function(n,i,r){var o=this.elements,a=t.set(o[0],o[1],o[2]).length(),s=t.set(o[4],o[5],o[6]).length(),c=t.set(o[8],o[9],o[10]).length();this.determinant()<0&&(a=-a),n.x=o[12],n.y=o[13],n.z=o[14],e.copy(this);var h=1/a,u=1/s,l=1/c;return e.elements[0]*=h,e.elements[1]*=h,e.elements[2]*=h,e.elements[4]*=u,e.elements[5]*=u,e.elements[6]*=u,e.elements[8]*=l,e.elements[9]*=l,e.elements[10]*=l,i.setFromRotationMatrix(e),r.x=a,r.y=s,r.z=c,this}}(),makePerspective:function(t,e,n,i,r,o){void 0===o&&console.warn("THREE.Matrix4: .makePerspective() has been redefined and has a new signature. Please check the docs.");var a=this.elements,s=2*r/(e-t),c=2*r/(n-i),h=(e+t)/(e-t),u=(n+i)/(n-i),l=-(o+r)/(o-r),d=-2*o*r/(o-r);return a[0]=s,a[4]=0,a[8]=h,a[12]=0,a[1]=0,a[5]=c,a[9]=u,a[13]=0,a[2]=0,a[6]=0,a[10]=l,a[14]=d,a[3]=0,a[7]=0,a[11]=-1,a[15]=0,this},makeOrthographic:function(t,e,n,i,r,o){var a=this.elements,s=1/(e-t),c=1/(n-i),h=1/(o-r),u=(e+t)*s,l=(n+i)*c,d=(o+r)*h;return a[0]=2*s,a[4]=0,a[8]=0,a[12]=-u,a[1]=0,a[5]=2*c,a[9]=0,a[13]=-l,a[2]=0,a[6]=0,a[10]=-2*h,a[14]=-d,a[3]=0,a[7]=0,a[11]=0,a[15]=1,this},equals:function(t){for(var e=this.elements,n=t.elements,i=0;i<16;i++)if(e[i]!==n[i])return!1;return!0},fromArray:function(t,e){void 0===e&&(e=0);for(var n=0;n<16;n++)this.elements[n]=t[n+e];return this},toArray:function(t,e){void 0===t&&(t=[]),void 0===e&&(e=0);var n=this.elements;return t[e]=n[0],t[e+1]=n[1],t[e+2]=n[2],t[e+3]=n[3],t[e+4]=n[4],t[e+5]=n[5],t[e+6]=n[6],t[e+7]=n[7],t[e+8]=n[8],t[e+9]=n[9],t[e+10]=n[10],t[e+11]=n[11],t[e+12]=n[12],t[e+13]=n[13],t[e+14]=n[14],t[e+15]=n[15],t}}),ke.prototype=Object.create(De.prototype),ke.prototype.constructor=ke,ke.prototype.isDataTexture=!0,je.prototype=Object.create(De.prototype),je.prototype.constructor=je,je.prototype.isCubeTexture=!0,Object.defineProperty(je.prototype,"images",{get:function(){return this.image},set:function(t){this.image=t}});var We=new De,Xe=new je;function qe(){this.seq=[],this.map={}}var Ye=[],Ze=[],Je=new Float32Array(16),Qe=new Float32Array(9);function Ke(t,e,n){var i=t[0];if(i<=0||i>0)return t;var r=e*n,o=Ye[r];if(void 0===o&&(o=new Float32Array(r),Ye[r]=o),0!==e){i.toArray(o,0);for(var a=1,s=0;a!==e;++a)s+=n,t[a].toArray(o,s)}return o}function $e(t,e){var n=Ze[e];void 0===n&&(n=new Int32Array(e),Ze[e]=n);for(var i=0;i!==e;++i)n[i]=t.allocTextureUnit();return n}function tn(t,e){t.uniform1f(this.addr,e)}function en(t,e){t.uniform1i(this.addr,e)}function nn(t,e){void 0===e.x?t.uniform2fv(this.addr,e):t.uniform2f(this.addr,e.x,e.y)}function rn(t,e){void 0!==e.x?t.uniform3f(this.addr,e.x,e.y,e.z):void 0!==e.r?t.uniform3f(this.addr,e.r,e.g,e.b):t.uniform3fv(this.addr,e)}function on(t,e){void 0===e.x?t.uniform4fv(this.addr,e):t.uniform4f(this.addr,e.x,e.y,e.z,e.w)}function an(t,e){t.uniformMatrix2fv(this.addr,!1,e.elements||e)}function sn(t,e){void 0===e.elements?t.uniformMatrix3fv(this.addr,!1,e):(Qe.set(e.elements),t.uniformMatrix3fv(this.addr,!1,Qe))}function cn(t,e){void 0===e.elements?t.uniformMatrix4fv(this.addr,!1,e):(Je.set(e.elements),t.uniformMatrix4fv(this.addr,!1,Je))}function hn(t,e,n){var i=n.allocTextureUnit();t.uniform1i(this.addr,i),n.setTexture2D(e||We,i)}function un(t,e,n){var i=n.allocTextureUnit();t.uniform1i(this.addr,i),n.setTextureCube(e||Xe,i)}function ln(t,e){t.uniform2iv(this.addr,e)}function dn(t,e){t.uniform3iv(this.addr,e)}function pn(t,e){t.uniform4iv(this.addr,e)}function fn(t,e){t.uniform1fv(this.addr,e)}function mn(t,e){t.uniform1iv(this.addr,e)}function gn(t,e){t.uniform2fv(this.addr,Ke(e,this.size,2))}function vn(t,e){t.uniform3fv(this.addr,Ke(e,this.size,3))}function yn(t,e){t.uniform4fv(this.addr,Ke(e,this.size,4))}function xn(t,e){t.uniformMatrix2fv(this.addr,!1,Ke(e,this.size,4))}function bn(t,e){t.uniformMatrix3fv(this.addr,!1,Ke(e,this.size,9))}function _n(t,e){t.uniformMatrix4fv(this.addr,!1,Ke(e,this.size,16))}function wn(t,e,n){var i=e.length,r=$e(n,i);t.uniform1iv(this.addr,r);for(var o=0;o!==i;++o)n.setTexture2D(e[o]||We,r[o])}function Mn(t,e,n){var i=e.length,r=$e(n,i);t.uniform1iv(this.addr,r);for(var o=0;o!==i;++o)n.setTextureCube(e[o]||Xe,r[o])}function En(t,e,n){this.id=t,this.addr=n,this.setValue=function(t){switch(t){case 5126:return tn;case 35664:return nn;case 35665:return rn;case 35666:return on;case 35674:return an;case 35675:return sn;case 35676:return cn;case 35678:return hn;case 35680:return un;case 5124:case 35670:return en;case 35667:case 35671:return ln;case 35668:case 35672:return dn;case 35669:case 35673:return pn}}(e.type)}function Tn(t,e,n){this.id=t,this.addr=n,this.size=e.size,this.setValue=function(t){switch(t){case 5126:return fn;case 35664:return gn;case 35665:return vn;case 35666:return yn;case 35674:return xn;case 35675:return bn;case 35676:return _n;case 35678:return wn;case 35680:return Mn;case 5124:case 35670:return mn;case 35667:case 35671:return ln;case 35668:case 35672:return dn;case 35669:case 35673:return pn}}(e.type)}function Sn(t){this.id=t,qe.call(this)}Sn.prototype.setValue=function(t,e){for(var n=this.seq,i=0,r=n.length;i!==r;++i){var o=n[i];o.setValue(t,e[o.id])}};var An=/([\w\d_]+)(\])?(\[|\.)?/g;function Ln(t,e){t.seq.push(e),t.map[e.id]=e}function Rn(t,e,n){var i=t.name,r=i.length;for(An.lastIndex=0;;){var o=An.exec(i),a=An.lastIndex,s=o[1],c="]"===o[2],h=o[3];if(c&&(s|=0),void 0===h||"["===h&&a+2===r){Ln(n,void 0===h?new En(s,t,e):new Tn(s,t,e));break}var u=n.map[s];void 0===u&&Ln(n,u=new Sn(s)),n=u}}function Pn(t,e,n){qe.call(this),this.renderer=n;for(var i=t.getProgramParameter(e,t.ACTIVE_UNIFORMS),r=0;r<i;++r){var o=t.getActiveUniform(e,r),a=o.name;Rn(o,t.getUniformLocation(e,a),this)}}Pn.prototype.setValue=function(t,e,n){var i=this.map[e];void 0!==i&&i.setValue(t,n,this.renderer)},Pn.prototype.setOptional=function(t,e,n){var i=e[n];void 0!==i&&this.setValue(t,n,i)},Pn.upload=function(t,e,n,i){for(var r=0,o=e.length;r!==o;++r){var a=e[r],s=n[a.id];!1!==s.needsUpdate&&a.setValue(t,s.value,i)}},Pn.seqWithValue=function(t,e){for(var n=[],i=0,r=t.length;i!==r;++i){var o=t[i];o.id in e&&n.push(o)}return n};var Cn={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};function In(t,e,n){return void 0===e&&void 0===n?this.set(t):this.setRGB(t,e,n)}Object.assign(In.prototype,{isColor:!0,r:1,g:1,b:1,set:function(t){return t&&t.isColor?this.copy(t):"number"==typeof t?this.setHex(t):"string"==typeof t&&this.setStyle(t),this},setScalar:function(t){return this.r=t,this.g=t,this.b=t,this},setHex:function(t){return t=Math.floor(t),this.r=(t>>16&255)/255,this.g=(t>>8&255)/255,this.b=(255&t)/255,this},setRGB:function(t,e,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,i){if(e=Ae.euclideanModulo(e,1),n=Ae.clamp(n,0,1),i=Ae.clamp(i,0,1),0===n)this.r=this.g=this.b=i;else{var r=i<=.5?i*(1+n):i+n-i*n,o=2*i-r;this.r=t(o,r,e+1/3),this.g=t(o,r,e),this.b=t(o,r,e-1/3)}return this}}(),setStyle:function(t){function e(e){void 0!==e&&parseFloat(e)<1&&console.warn("THREE.Color: Alpha component of "+t+" will be ignored.")}var n;if(n=/^((?:rgb|hsl)a?)\(\s*([^\)]*)\)/.exec(t)){var i,r=n[1],o=n[2];switch(r){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,e(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,e(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 a=parseFloat(i[1])/360,s=parseInt(i[2],10)/100,c=parseInt(i[3],10)/100;return e(i[5]),this.setHSL(a,s,c)}}}else if(n=/^\#([A-Fa-f0-9]+)$/.exec(t)){var h,u=(h=n[1]).length;if(3===u)return this.r=parseInt(h.charAt(0)+h.charAt(0),16)/255,this.g=parseInt(h.charAt(1)+h.charAt(1),16)/255,this.b=parseInt(h.charAt(2)+h.charAt(2),16)/255,this;if(6===u)return this.r=parseInt(h.charAt(0)+h.charAt(1),16)/255,this.g=parseInt(h.charAt(2)+h.charAt(3),16)/255,this.b=parseInt(h.charAt(4)+h.charAt(5),16)/255,this}t&&t.length>0&&(void 0!==(h=Cn[t])?this.setHex(h):console.warn("THREE.Color: Unknown color "+t));return this},clone:function(){return new this.constructor(this.r,this.g,this.b)},copy:function(t){return this.r=t.r,this.g=t.g,this.b=t.b,this},copyGammaToLinear:function(t,e){return void 0===e&&(e=2),this.r=Math.pow(t.r,e),this.g=Math.pow(t.g,e),this.b=Math.pow(t.b,e),this},copyLinearToGamma:function(t,e){void 0===e&&(e=2);var 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,i=t||{h:0,s:0,l:0},r=this.r,o=this.g,a=this.b,s=Math.max(r,o,a),c=Math.min(r,o,a),h=(c+s)/2;if(c===s)e=0,n=0;else{var u=s-c;switch(n=h<=.5?u/(s+c):u/(2-s-c),s){case r:e=(o-a)/u+(o<a?6:0);break;case o:e=(a-r)/u+2;break;case a:e=(r-o)/u+4}e/=6}return i.h=e,i.s=n,i.l=h,i},getStyle:function(){return"rgb("+(255*this.r|0)+","+(255*this.g|0)+","+(255*this.b|0)+")"},offsetHSL:function(t,e,n){var i=this.getHSL();return i.h+=t,i.s+=e,i.l+=n,this.setHSL(i.h,i.s,i.l),this},add:function(t){return this.r+=t.r,this.g+=t.g,this.b+=t.b,this},addColors:function(t,e){return this.r=t.r+e.r,this.g=t.g+e.g,this.b=t.b+e.b,this},addScalar:function(t){return this.r+=t,this.g+=t,this.b+=t,this},sub:function(t){return this.r=Math.max(0,this.r-t.r),this.g=Math.max(0,this.g-t.g),this.b=Math.max(0,this.b-t.b),this},multiply:function(t){return this.r*=t.r,this.g*=t.g,this.b*=t.b,this},multiplyScalar:function(t){return this.r*=t,this.g*=t,this.b*=t,this},lerp:function(t,e){return this.r+=(t.r-this.r)*e,this.g+=(t.g-this.g)*e,this.b+=(t.b-this.b)*e,this},equals:function(t){return t.r===this.r&&t.g===this.g&&t.b===this.b},fromArray:function(t,e){return void 0===e&&(e=0),this.r=t[e],this.g=t[e+1],this.b=t[e+2],this},toArray:function(t,e){return void 0===t&&(t=[]),void 0===e&&(e=0),t[e]=this.r,t[e+1]=this.g,t[e+2]=this.b,t},toJSON:function(){return this.getHex()}});var Un={common:{diffuse:{value:new In(15658734)},opacity:{value:1},map:{value:null},offsetRepeat:{value:new Fe(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 Le(1,1)}},displacementmap:{displacementMap:{value:null},displacementScale:{value:1},displacementBias:{value:0}},roughnessmap:{roughnessMap:{value:null}},metalnessmap:{metalnessMap:{value:null}},gradientmap:{gradientMap:{value:null}},fog:{fogDensity:{value:25e-5},fogNear:{value:1},fogFar:{value:2e3},fogColor:{value:new In(16777215)}},lights:{ambientLightColor:{value:[]},directionalLights:{value:[],properties:{direction:{},color:{},shadow:{},shadowBias:{},shadowRadius:{},shadowMapSize:{}}},directionalShadowMap:{value:[]},directionalShadowMatrix:{value:[]},spotLights:{value:[],properties:{color:{},position:{},direction:{},distance:{},coneCos:{},penumbraCos:{},decay:{},shadow:{},shadowBias:{},shadowRadius:{},shadowMapSize:{}}},spotShadowMap:{value:[]},spotShadowMatrix:{value:[]},pointLights:{value:[],properties:{color:{},position:{},decay:{},distance:{},shadow:{},shadowBias:{},shadowRadius:{},shadowMapSize:{}}},pointShadowMap:{value:[]},pointShadowMatrix:{value:[]},hemisphereLights:{value:[],properties:{direction:{},skyColor:{},groundColor:{}}},rectAreaLights:{value:[],properties:{color:{},position:{},width:{},height:{}}}},points:{diffuse:{value:new In(15658734)},opacity:{value:1},size:{value:1},scale:{value:1},map:{value:null},offsetRepeat:{value:new Fe(0,0,1,1)}}},Nn={merge:function(t){for(var e={},n=0;n<t.length;n++){var i=this.clone(t[n]);for(var r in i)e[r]=i[r]}return e},clone:function(t){var e={};for(var n in t)for(var i in e[n]={},t[n]){var r=t[n][i];r&&(r.isColor||r.isMatrix3||r.isMatrix4||r.isVector2||r.isVector3||r.isVector4||r.isTexture)?e[n][i]=r.clone():Array.isArray(r)?e[n][i]=r.slice():e[n][i]=r}return e}},On={alphamap_fragment:"#ifdef USE_ALPHAMAP\n\tdiffuseColor.a *= texture2D( alphaMap, vUv ).g;\n#endif\n",alphamap_pars_fragment:"#ifdef USE_ALPHAMAP\n\tuniform sampler2D alphaMap;\n#endif\n",alphatest_fragment:"#ifdef ALPHATEST\n\tif ( diffuseColor.a < ALPHATEST ) discard;\n#endif\n",aomap_fragment:"#ifdef USE_AOMAP\n\tfloat ambientOcclusion = ( texture2D( aoMap, vUv2 ).r - 1.0 ) * aoMapIntensity + 1.0;\n\treflectedLight.indirectDiffuse *= ambientOcclusion;\n\t#if defined( USE_ENVMAP ) && defined( PHYSICAL )\n\t\tfloat dotNV = saturate( dot( geometry.normal, geometry.viewDir ) );\n\t\treflectedLight.indirectSpecular *= computeSpecularOcclusion( dotNV, ambientOcclusion, material.specularRoughness );\n\t#endif\n#endif\n",aomap_pars_fragment:"#ifdef USE_AOMAP\n\tuniform sampler2D aoMap;\n\tuniform float aoMapIntensity;\n#endif",begin_vertex:"\nvec3 transformed = vec3( position );\n",beginnormal_vertex:"\nvec3 objectNormal = vec3( normal );\n",bsdfs:"float punctualLightIntensityToIrradianceFactor( const in float lightDistance, const in float cutoffDistance, const in float decayExponent ) {\n\t\tif( decayExponent > 0.0 ) {\n#if defined ( PHYSICALLY_CORRECT_LIGHTS )\n\t\t\tfloat distanceFalloff = 1.0 / max( pow( lightDistance, decayExponent ), 0.01 );\n\t\t\tfloat maxDistanceCutoffFactor = pow2( saturate( 1.0 - pow4( lightDistance / cutoffDistance ) ) );\n\t\t\treturn distanceFalloff * maxDistanceCutoffFactor;\n#else\n\t\t\treturn pow( saturate( -lightDistance / cutoffDistance + 1.0 ), decayExponent );\n#endif\n\t\t}\n\t\treturn 1.0;\n}\nvec3 BRDF_Diffuse_Lambert( const in vec3 diffuseColor ) {\n\treturn RECIPROCAL_PI * diffuseColor;\n}\nvec3 F_Schlick( const in vec3 specularColor, const in float dotLH ) {\n\tfloat fresnel = exp2( ( -5.55473 * dotLH - 6.98316 ) * dotLH );\n\treturn ( 1.0 - specularColor ) * fresnel + specularColor;\n}\nfloat G_GGX_Smith( const in float alpha, const in float dotNL, const in float dotNV ) {\n\tfloat a2 = pow2( alpha );\n\tfloat gl = dotNL + sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNL ) );\n\tfloat gv = dotNV + sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNV ) );\n\treturn 1.0 / ( gl * gv );\n}\nfloat G_GGX_SmithCorrelated( const in float alpha, const in float dotNL, const in float dotNV ) {\n\tfloat a2 = pow2( alpha );\n\tfloat gv = dotNL * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNV ) );\n\tfloat gl = dotNV * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNL ) );\n\treturn 0.5 / max( gv + gl, EPSILON );\n}\nfloat D_GGX( const in float alpha, const in float dotNH ) {\n\tfloat a2 = pow2( alpha );\n\tfloat denom = pow2( dotNH ) * ( a2 - 1.0 ) + 1.0;\n\treturn RECIPROCAL_PI * a2 / pow2( denom );\n}\nvec3 BRDF_Specular_GGX( const in IncidentLight incidentLight, const in GeometricContext geometry, const in vec3 specularColor, const in float roughness ) {\n\tfloat alpha = pow2( roughness );\n\tvec3 halfDir = normalize( incidentLight.direction + geometry.viewDir );\n\tfloat dotNL = saturate( dot( geometry.normal, incidentLight.direction ) );\n\tfloat dotNV = saturate( dot( geometry.normal, geometry.viewDir ) );\n\tfloat dotNH = saturate( dot( geometry.normal, halfDir ) );\n\tfloat dotLH = saturate( dot( incidentLight.direction, halfDir ) );\n\tvec3 F = F_Schlick( specularColor, dotLH );\n\tfloat G = G_GGX_SmithCorrelated( alpha, dotNL, dotNV );\n\tfloat D = D_GGX( alpha, dotNH );\n\treturn F * ( G * D );\n}\nvec2 ltcTextureCoords( const in GeometricContext geometry, const in float roughness ) {\n\tconst float LUT_SIZE = 64.0;\n\tconst float LUT_SCALE = (LUT_SIZE - 1.0)/LUT_SIZE;\n\tconst float LUT_BIAS = 0.5/LUT_SIZE;\n\tvec3 N = geometry.normal;\n\tvec3 V = geometry.viewDir;\n\tvec3 P = geometry.position;\n\tfloat theta = acos( dot( N, V ) );\n\tvec2 uv = vec2(\n\t\tsqrt( saturate( roughness ) ),\n\t\tsaturate( theta / ( 0.5 * PI ) ) );\n\tuv = uv * LUT_SCALE + LUT_BIAS;\n\treturn uv;\n}\nvoid clipQuadToHorizon( inout vec3 L[5], out int n ) {\n\tint config = 0;\n\tif ( L[0].z > 0.0 ) config += 1;\n\tif ( L[1].z > 0.0 ) config += 2;\n\tif ( L[2].z > 0.0 ) config += 4;\n\tif ( L[3].z > 0.0 ) config += 8;\n\tn = 0;\n\tif ( config == 0 ) {\n\t} else if ( config == 1 ) {\n\t\tn = 3;\n\t\tL[1] = -L[1].z * L[0] + L[0].z * L[1];\n\t\tL[2] = -L[3].z * L[0] + L[0].z * L[3];\n\t} else if ( config == 2 ) {\n\t\tn = 3;\n\t\tL[0] = -L[0].z * L[1] + L[1].z * L[0];\n\t\tL[2] = -L[2].z * L[1] + L[1].z * L[2];\n\t} else if ( config == 3 ) {\n\t\tn = 4;\n\t\tL[2] = -L[2].z * L[1] + L[1].z * L[2];\n\t\tL[3] = -L[3].z * L[0] + L[0].z * L[3];\n\t} else if ( config == 4 ) {\n\t\tn = 3;\n\t\tL[0] = -L[3].z * L[2] + L[2].z * L[3];\n\t\tL[1] = -L[1].z * L[2] + L[2].z * L[1];\n\t} else if ( config == 5 ) {\n\t\tn = 0;\n\t} else if ( config == 6 ) {\n\t\tn = 4;\n\t\tL[0] = -L[0].z * L[1] + L[1].z * L[0];\n\t\tL[3] = -L[3].z * L[2] + L[2].z * L[3];\n\t} else if ( config == 7 ) {\n\t\tn = 5;\n\t\tL[4] = -L[3].z * L[0] + L[0].z * L[3];\n\t\tL[3] = -L[3].z * L[2] + L[2].z * L[3];\n\t} else if ( config == 8 ) {\n\t\tn = 3;\n\t\tL[0] = -L[0].z * L[3] + L[3].z * L[0];\n\t\tL[1] = -L[2].z * L[3] + L[3].z * L[2];\n\t\tL[2] = L[3];\n\t} else if ( config == 9 ) {\n\t\tn = 4;\n\t\tL[1] = -L[1].z * L[0] + L[0].z * L[1];\n\t\tL[2] = -L[2].z * L[3] + L[3].z * L[2];\n\t} else if ( config == 10 ) {\n\t\tn = 0;\n\t} else if ( config == 11 ) {\n\t\tn = 5;\n\t\tL[4] = L[3];\n\t\tL[3] = -L[2].z * L[3] + L[3].z * L[2];\n\t\tL[2] = -L[2].z * L[1] + L[1].z * L[2];\n\t} else if ( config == 12 ) {\n\t\tn = 4;\n\t\tL[1] = -L[1].z * L[2] + L[2].z * L[1];\n\t\tL[0] = -L[0].z * L[3] + L[3].z * L[0];\n\t} else if ( config == 13 ) {\n\t\tn = 5;\n\t\tL[4] = L[3];\n\t\tL[3] = L[2];\n\t\tL[2] = -L[1].z * L[2] + L[2].z * L[1];\n\t\tL[1] = -L[1].z * L[0] + L[0].z * L[1];\n\t} else if ( config == 14 ) {\n\t\tn = 5;\n\t\tL[4] = -L[0].z * L[3] + L[3].z * L[0];\n\t\tL[0] = -L[0].z * L[1] + L[1].z * L[0];\n\t} else if ( config == 15 ) {\n\t\tn = 4;\n\t}\n\tif ( n == 3 )\n\t\tL[3] = L[0];\n\tif ( n == 4 )\n\t\tL[4] = L[0];\n}\nfloat integrateLtcBrdfOverRectEdge( vec3 v1, vec3 v2 ) {\n\tfloat cosTheta = dot( v1, v2 );\n\tfloat theta = acos( cosTheta );\n\tfloat res = cross( v1, v2 ).z * ( ( theta > 0.001 ) ? theta / sin( theta ) : 1.0 );\n\treturn res;\n}\nvoid initRectPoints( const in vec3 pos, const in vec3 halfWidth, const in vec3 halfHeight, out vec3 rectPoints[4] ) {\n\trectPoints[0] = pos - halfWidth - halfHeight;\n\trectPoints[1] = pos + halfWidth - halfHeight;\n\trectPoints[2] = pos + halfWidth + halfHeight;\n\trectPoints[3] = pos - halfWidth + halfHeight;\n}\nvec3 integrateLtcBrdfOverRect( const in GeometricContext geometry, const in mat3 brdfMat, const in vec3 rectPoints[4] ) {\n\tvec3 N = geometry.normal;\n\tvec3 V = geometry.viewDir;\n\tvec3 P = geometry.position;\n\tvec3 T1, T2;\n\tT1 = normalize(V - N * dot( V, N ));\n\tT2 = - cross( N, T1 );\n\tmat3 brdfWrtSurface = brdfMat * transpose( mat3( T1, T2, N ) );\n\tvec3 clippedRect[5];\n\tclippedRect[0] = brdfWrtSurface * ( rectPoints[0] - P );\n\tclippedRect[1] = brdfWrtSurface * ( rectPoints[1] - P );\n\tclippedRect[2] = brdfWrtSurface * ( rectPoints[2] - P );\n\tclippedRect[3] = brdfWrtSurface * ( rectPoints[3] - P );\n\tint n;\n\tclipQuadToHorizon(clippedRect, n);\n\tif ( n == 0 )\n\t\treturn vec3( 0, 0, 0 );\n\tclippedRect[0] = normalize( clippedRect[0] );\n\tclippedRect[1] = normalize( clippedRect[1] );\n\tclippedRect[2] = normalize( clippedRect[2] );\n\tclippedRect[3] = normalize( clippedRect[3] );\n\tclippedRect[4] = normalize( clippedRect[4] );\n\tfloat sum = 0.0;\n\tsum += integrateLtcBrdfOverRectEdge( clippedRect[0], clippedRect[1] );\n\tsum += integrateLtcBrdfOverRectEdge( clippedRect[1], clippedRect[2] );\n\tsum += integrateLtcBrdfOverRectEdge( clippedRect[2], clippedRect[3] );\n\tif (n >= 4)\n\t\tsum += integrateLtcBrdfOverRectEdge( clippedRect[3], clippedRect[4] );\n\tif (n == 5)\n\t\tsum += integrateLtcBrdfOverRectEdge( clippedRect[4], clippedRect[0] );\n\tsum = max( 0.0, sum );\n\tvec3 Lo_i = vec3( sum, sum, sum );\n\treturn Lo_i/(2.0 * PI);\n}\nfloat ClippedSphereFormFactor( const in vec3 f ) {\n\tfloat l = length(f);\n\treturn max((l*l + f.z)/(l+1.0), 0.0);\n}\nvec3 EdgeVectorFormFactor( const in vec3 v1, const in vec3 v2 ) {\n\tfloat x = dot(v1, v2);\n\tfloat y = abs(x);\n\tfloat a = 0.86267 + (0.49788 + 0.01436*y)*y;\n\tfloat b = 3.45068 + (4.18814 + y)*y;\n\tfloat v = a/b;\n\tfloat theta_sintheta = (x > 0.0) ? v : 0.5*inversesqrt(1.0 - x*x) - v;\n\treturn cross(v1, v2)*theta_sintheta;\n}\nvec3 integrateLtcBrdfOverRectOptimized( const in GeometricContext geometry, const in mat3 brdfMat, const in vec3 rectPoints[4] ) {\n\tvec3 N = geometry.normal;\n\tvec3 V = geometry.viewDir;\n\tvec3 P = geometry.position;\n\tvec3 T1, T2;\n\tT1 = normalize(V - N * dot( V, N ));\n\tT2 = - cross( N, T1 );\n\tmat3 brdfWrtSurface = brdfMat * transpose( mat3( T1, T2, N ) );\n\tvec3 clippedRect[4];\n\tclippedRect[0] = brdfWrtSurface * ( rectPoints[0] - P );\n\tclippedRect[1] = brdfWrtSurface * ( rectPoints[1] - P );\n\tclippedRect[2] = brdfWrtSurface * ( rectPoints[2] - P );\n\tclippedRect[3] = brdfWrtSurface * ( rectPoints[3] - P );\n\tvec3 v1 = clippedRect[1] - clippedRect[0];\n\tvec3 v2 = clippedRect[3] - clippedRect[0];\n\tvec3 lightNormal = cross(v1, v2);\n\tbool bSameSide = dot(lightNormal, clippedRect[0]) > 0.0;\n\tif( !bSameSide )\n\t\treturn vec3(0.0);\n\tclippedRect[0] = normalize( clippedRect[0] );\n\tclippedRect[1] = normalize( clippedRect[1] );\n\tclippedRect[2] = normalize( clippedRect[2] );\n\tclippedRect[3] = normalize( clippedRect[3] );\n\tvec3 edgeVectorFormFactor = vec3(0.0);\n\tedgeVectorFormFactor += EdgeVectorFormFactor( clippedRect[0], clippedRect[1] );\n\tedgeVectorFormFactor += EdgeVectorFormFactor( clippedRect[1], clippedRect[2] );\n\tedgeVectorFormFactor += EdgeVectorFormFactor( clippedRect[2], clippedRect[3] );\n\tedgeVectorFormFactor += EdgeVectorFormFactor( clippedRect[3], clippedRect[0] );\n\tvec3 Lo_i = vec3( ClippedSphereFormFactor( edgeVectorFormFactor ) );\n\treturn Lo_i;\n}\nvec3 Rect_Area_Light_Specular_Reflectance(\n\t\tconst in GeometricContext geometry,\n\t\tconst in vec3 lightPos, const in vec3 lightHalfWidth, const in vec3 lightHalfHeight,\n\t\tconst in float roughness,\n\t\tconst in sampler2D ltcMat, const in sampler2D ltcMag ) {\n\tvec3 rectPoints[4];\n\tinitRectPoints( lightPos, lightHalfWidth, lightHalfHeight, rectPoints );\n\tvec2 uv = ltcTextureCoords( geometry, roughness );\n\tvec4 brdfLtcApproxParams, t;\n\tbrdfLtcApproxParams = texture2D( ltcMat, uv );\n\tt = texture2D( ltcMat, uv );\n\tfloat brdfLtcScalar = texture2D( ltcMag, uv ).a;\n\tmat3 brdfLtcApproxMat = mat3(\n\t\tvec3( 1, 0, t.y ),\n\t\tvec3( 0, t.z, 0 ),\n\t\tvec3( t.w, 0, t.x )\n\t);\n\tvec3 specularReflectance = integrateLtcBrdfOverRectOptimized( geometry, brdfLtcApproxMat, rectPoints );\n\tspecularReflectance *= brdfLtcScalar;\n\treturn specularReflectance;\n}\nvec3 Rect_Area_Light_Diffuse_Reflectance(\n\t\tconst in GeometricContext geometry,\n\t\tconst in vec3 lightPos, const in vec3 lightHalfWidth, const in vec3 lightHalfHeight ) {\n\tvec3 rectPoints[4];\n\tinitRectPoints( lightPos, lightHalfWidth, lightHalfHeight, rectPoints );\n\tmat3 diffuseBrdfMat = mat3(1);\n\tvec3 diffuseReflectance = integrateLtcBrdfOverRectOptimized( geometry, diffuseBrdfMat, rectPoints );\n\treturn diffuseReflectance;\n}\nvec3 BRDF_Specular_GGX_Environment( const in GeometricContext geometry, const in vec3 specularColor, const in float roughness ) {\n\tfloat dotNV = saturate( dot( geometry.normal, geometry.viewDir ) );\n\tconst vec4 c0 = vec4( - 1, - 0.0275, - 0.572, 0.022 );\n\tconst vec4 c1 = vec4( 1, 0.0425, 1.04, - 0.04 );\n\tvec4 r = roughness * c0 + c1;\n\tfloat a004 = min( r.x * r.x, exp2( - 9.28 * dotNV ) ) * r.x + r.y;\n\tvec2 AB = vec2( -1.04, 1.04 ) * a004 + r.zw;\n\treturn specularColor * AB.x + AB.y;\n}\nfloat G_BlinnPhong_Implicit( ) {\n\treturn 0.25;\n}\nfloat D_BlinnPhong( const in float shininess, const in float dotNH ) {\n\treturn RECIPROCAL_PI * ( shininess * 0.5 + 1.0 ) * pow( dotNH, shininess );\n}\nvec3 BRDF_Specular_BlinnPhong( const in IncidentLight incidentLight, const in GeometricContext geometry, const in vec3 specularColor, const in float shininess ) {\n\tvec3 halfDir = normalize( incidentLight.direction + geometry.viewDir );\n\tfloat dotNH = saturate( dot( geometry.normal, halfDir ) );\n\tfloat dotLH = saturate( dot( incidentLight.direction, halfDir ) );\n\tvec3 F = F_Schlick( specularColor, dotLH );\n\tfloat G = G_BlinnPhong_Implicit( );\n\tfloat D = D_BlinnPhong( shininess, dotNH );\n\treturn F * ( G * D );\n}\nfloat GGXRoughnessToBlinnExponent( const in float ggxRoughness ) {\n\treturn ( 2.0 / pow2( ggxRoughness + 0.0001 ) - 2.0 );\n}\nfloat BlinnExponentToGGXRoughness( const in float blinnExponent ) {\n\treturn sqrt( 2.0 / ( blinnExponent + 2.0 ) );\n}\n",bumpmap_pars_fragment:"#ifdef USE_BUMPMAP\n\tuniform sampler2D bumpMap;\n\tuniform float bumpScale;\n\tvec2 dHdxy_fwd() {\n\t\tvec2 dSTdx = dFdx( vUv );\n\t\tvec2 dSTdy = dFdy( vUv );\n\t\tfloat Hll = bumpScale * texture2D( bumpMap, vUv ).x;\n\t\tfloat dBx = bumpScale * texture2D( bumpMap, vUv + dSTdx ).x - Hll;\n\t\tfloat dBy = bumpScale * texture2D( bumpMap, vUv + dSTdy ).x - Hll;\n\t\treturn vec2( dBx, dBy );\n\t}\n\tvec3 perturbNormalArb( vec3 surf_pos, vec3 surf_norm, vec2 dHdxy ) {\n\t\tvec3 vSigmaX = dFdx( surf_pos );\n\t\tvec3 vSigmaY = dFdy( surf_pos );\n\t\tvec3 vN = surf_norm;\n\t\tvec3 R1 = cross( vSigmaY, vN );\n\t\tvec3 R2 = cross( vN, vSigmaX );\n\t\tfloat fDet = dot( vSigmaX, R1 );\n\t\tvec3 vGrad = sign( fDet ) * ( dHdxy.x * R1 + dHdxy.y * R2 );\n\t\treturn normalize( abs( fDet ) * surf_norm - vGrad );\n\t}\n#endif\n",clipping_planes_fragment:"#if NUM_CLIPPING_PLANES > 0\n\tfor ( int i = 0; i < UNION_CLIPPING_PLANES; ++ i ) {\n\t\tvec4 plane = clippingPlanes[ i ];\n\t\tif ( dot( vViewPosition, plane.xyz ) > plane.w ) discard;\n\t}\n\t\t\n\t#if UNION_CLIPPING_PLANES < NUM_CLIPPING_PLANES\n\t\tbool clipped = true;\n\t\tfor ( int i = UNION_CLIPPING_PLANES; i < NUM_CLIPPING_PLANES; ++ i ) {\n\t\t\tvec4 plane = clippingPlanes[ i ];\n\t\t\tclipped = ( dot( vViewPosition, plane.xyz ) > plane.w ) && clipped;\n\t\t}\n\t\tif ( clipped ) discard;\n\t\n\t#endif\n#endif\n",clipping_planes_pars_fragment:"#if NUM_CLIPPING_PLANES > 0\n\t#if ! defined( PHYSICAL ) && ! defined( PHONG )\n\t\tvarying vec3 vViewPosition;\n\t#endif\n\tuniform vec4 clippingPlanes[ NUM_CLIPPING_PLANES ];\n#endif\n",clipping_planes_pars_vertex:"#if NUM_CLIPPING_PLANES > 0 && ! defined( PHYSICAL ) && ! defined( PHONG )\n\tvarying vec3 vViewPosition;\n#endif\n",clipping_planes_vertex:"#if NUM_CLIPPING_PLANES > 0 && ! defined( PHYSICAL ) && ! defined( PHONG )\n\tvViewPosition = - mvPosition.xyz;\n#endif\n",color_fragment:"#ifdef USE_COLOR\n\tdiffuseColor.rgb *= vColor;\n#endif",color_pars_fragment:"#ifdef USE_COLOR\n\tvarying vec3 vColor;\n#endif\n",color_pars_vertex:"#ifdef USE_COLOR\n\tvarying vec3 vColor;\n#endif",color_vertex:"#ifdef USE_COLOR\n\tvColor.xyz = color.xyz;\n#endif",common:"#define PI 3.14159265359\n#define PI2 6.28318530718\n#define PI_HALF 1.5707963267949\n#define RECIPROCAL_PI 0.31830988618\n#define RECIPROCAL_PI2 0.15915494\n#define LOG2 1.442695\n#define EPSILON 1e-6\n#define saturate(a) clamp( a, 0.0, 1.0 )\n#define whiteCompliment(a) ( 1.0 - saturate( a ) )\nfloat pow2( const in float x ) { return x*x; }\nfloat pow3( const in float x ) { return x*x*x; }\nfloat pow4( const in float x ) { float x2 = x*x; return x2*x2; }\nfloat average( const in vec3 color ) { return dot( color, vec3( 0.3333 ) ); }\nhighp float rand( const in vec2 uv ) {\n\tconst highp float a = 12.9898, b = 78.233, c = 43758.5453;\n\thighp float dt = dot( uv.xy, vec2( a,b ) ), sn = mod( dt, PI );\n\treturn fract(sin(sn) * c);\n}\nstruct IncidentLight {\n\tvec3 color;\n\tvec3 direction;\n\tbool visible;\n};\nstruct ReflectedLight {\n\tvec3 directDiffuse;\n\tvec3 directSpecular;\n\tvec3 indirectDiffuse;\n\tvec3 indirectSpecular;\n};\nstruct GeometricContext {\n\tvec3 position;\n\tvec3 normal;\n\tvec3 viewDir;\n};\nvec3 transformDirection( in vec3 dir, in mat4 matrix ) {\n\treturn normalize( ( matrix * vec4( dir, 0.0 ) ).xyz );\n}\nvec3 inverseTransformDirection( in vec3 dir, in mat4 matrix ) {\n\treturn normalize( ( vec4( dir, 0.0 ) * matrix ).xyz );\n}\nvec3 projectOnPlane(in vec3 point, in vec3 pointOnPlane, in vec3 planeNormal ) {\n\tfloat distance = dot( planeNormal, point - pointOnPlane );\n\treturn - distance * planeNormal + point;\n}\nfloat sideOfPlane( in vec3 point, in vec3 pointOnPlane, in vec3 planeNormal ) {\n\treturn sign( dot( point - pointOnPlane, planeNormal ) );\n}\nvec3 linePlaneIntersect( in vec3 pointOnLine, in vec3 lineDirection, in vec3 pointOnPlane, in vec3 planeNormal ) {\n\treturn lineDirection * ( dot( planeNormal, pointOnPlane - pointOnLine ) / dot( planeNormal, lineDirection ) ) + pointOnLine;\n}\nmat3 transpose( const in mat3 v ) {\n\tmat3 tmp;\n\ttmp[0] = vec3(v[0].x, v[1].x, v[2].x);\n\ttmp[1] = vec3(v[0].y, v[1].y, v[2].y);\n\ttmp[2] = vec3(v[0].z, v[1].z, v[2].z);\n\treturn tmp;\n}\n",cube_uv_reflection_fragment:"#ifdef ENVMAP_TYPE_CUBE_UV\n#define cubeUV_textureSize (1024.0)\nint getFaceFromDirection(vec3 direction) {\n\tvec3 absDirection = abs(direction);\n\tint face = -1;\n\tif( absDirection.x > absDirection.z ) {\n\t\tif(absDirection.x > absDirection.y )\n\t\t\tface = direction.x > 0.0 ? 0 : 3;\n\t\telse\n\t\t\tface = direction.y > 0.0 ? 1 : 4;\n\t}\n\telse {\n\t\tif(absDirection.z > absDirection.y )\n\t\t\tface = direction.z > 0.0 ? 2 : 5;\n\t\telse\n\t\t\tface = direction.y > 0.0 ? 1 : 4;\n\t}\n\treturn face;\n}\n#define cubeUV_maxLods1 (log2(cubeUV_textureSize*0.25) - 1.0)\n#define cubeUV_rangeClamp (exp2((6.0 - 1.0) * 2.0))\nvec2 MipLevelInfo( vec3 vec, float roughnessLevel, float roughness ) {\n\tfloat scale = exp2(cubeUV_maxLods1 - roughnessLevel);\n\tfloat dxRoughness = dFdx(roughness);\n\tfloat dyRoughness = dFdy(roughness);\n\tvec3 dx = dFdx( vec * scale * dxRoughness );\n\tvec3 dy = dFdy( vec * scale * dyRoughness );\n\tfloat d = max( dot( dx, dx ), dot( dy, dy ) );\n\td = clamp(d, 1.0, cubeUV_rangeClamp);\n\tfloat mipLevel = 0.5 * log2(d);\n\treturn vec2(floor(mipLevel), fract(mipLevel));\n}\n#define cubeUV_maxLods2 (log2(cubeUV_textureSize*0.25) - 2.0)\n#define cubeUV_rcpTextureSize (1.0 / cubeUV_textureSize)\nvec2 getCubeUV(vec3 direction, float roughnessLevel, float mipLevel) {\n\tmipLevel = roughnessLevel > cubeUV_maxLods2 - 3.0 ? 0.0 : mipLevel;\n\tfloat a = 16.0 * cubeUV_rcpTextureSize;\n\tvec2 exp2_packed = exp2( vec2( roughnessLevel, mipLevel ) );\n\tvec2 rcp_exp2_packed = vec2( 1.0 ) / exp2_packed;\n\tfloat powScale = exp2_packed.x * exp2_packed.y;\n\tfloat scale = rcp_exp2_packed.x * rcp_exp2_packed.y * 0.25;\n\tfloat mipOffset = 0.75*(1.0 - rcp_exp2_packed.y) * rcp_exp2_packed.x;\n\tbool bRes = mipLevel == 0.0;\n\tscale = bRes && (scale < a) ? a : scale;\n\tvec3 r;\n\tvec2 offset;\n\tint face = getFaceFromDirection(direction);\n\tfloat rcpPowScale = 1.0 / powScale;\n\tif( face == 0) {\n\t\tr = vec3(direction.x, -direction.z, direction.y);\n\t\toffset = vec2(0.0+mipOffset,0.75 * rcpPowScale);\n\t\toffset.y = bRes && (offset.y < 2.0*a) ? a : offset.y;\n\t}\n\telse if( face == 1) {\n\t\tr = vec3(direction.y, direction.x, direction.z);\n\t\toffset = vec2(scale+mipOffset, 0.75 * rcpPowScale);\n\t\toffset.y = bRes && (offset.y < 2.0*a) ? a : offset.y;\n\t}\n\telse if( face == 2) {\n\t\tr = vec3(direction.z, direction.x, direction.y);\n\t\toffset = vec2(2.0*scale+mipOffset, 0.75 * rcpPowScale);\n\t\toffset.y = bRes && (offset.y < 2.0*a) ? a : offset.y;\n\t}\n\telse if( face == 3) {\n\t\tr = vec3(direction.x, direction.z, direction.y);\n\t\toffset = vec2(0.0+mipOffset,0.5 * rcpPowScale);\n\t\toffset.y = bRes && (offset.y < 2.0*a) ? 0.0 : offset.y;\n\t}\n\telse if( face == 4) {\n\t\tr = vec3(direction.y, direction.x, -direction.z);\n\t\toffset = vec2(scale+mipOffset, 0.5 * rcpPowScale);\n\t\toffset.y = bRes && (offset.y < 2.0*a) ? 0.0 : offset.y;\n\t}\n\telse {\n\t\tr = vec3(direction.z, -direction.x, direction.y);\n\t\toffset = vec2(2.0*scale+mipOffset, 0.5 * rcpPowScale);\n\t\toffset.y = bRes && (offset.y < 2.0*a) ? 0.0 : offset.y;\n\t}\n\tr = normalize(r);\n\tfloat texelOffset = 0.5 * cubeUV_rcpTextureSize;\n\tvec2 s = ( r.yz / abs( r.x ) + vec2( 1.0 ) ) * 0.5;\n\tvec2 base = offset + vec2( texelOffset );\n\treturn base + s * ( scale - 2.0 * texelOffset );\n}\n#define cubeUV_maxLods3 (log2(cubeUV_textureSize*0.25) - 3.0)\nvec4 textureCubeUV(vec3 reflectedDirection, float roughness ) {\n\tfloat roughnessVal = roughness* cubeUV_maxLods3;\n\tfloat r1 = floor(roughnessVal);\n\tfloat r2 = r1 + 1.0;\n\tfloat t = fract(roughnessVal);\n\tvec2 mipInfo = MipLevelInfo(reflectedDirection, r1, roughness);\n\tfloat s = mipInfo.y;\n\tfloat level0 = mipInfo.x;\n\tfloat level1 = level0 + 1.0;\n\tlevel1 = level1 > 5.0 ? 5.0 : level1;\n\tlevel0 += min( floor( s + 0.5 ), 5.0 );\n\tvec2 uv_10 = getCubeUV(reflectedDirection, r1, level0);\n\tvec4 color10 = envMapTexelToLinear(texture2D(envMap, uv_10));\n\tvec2 uv_20 = getCubeUV(reflectedDirection, r2, level0);\n\tvec4 color20 = envMapTexelToLinear(texture2D(envMap, uv_20));\n\tvec4 result = mix(color10, color20, t);\n\treturn vec4(result.rgb, 1.0);\n}\n#endif\n",defaultnormal_vertex:"#ifdef FLIP_SIDED\n\tobjectNormal = -objectNormal;\n#endif\nvec3 transformedNormal = normalMatrix * objectNormal;\n",displacementmap_pars_vertex:"#ifdef USE_DISPLACEMENTMAP\n\tuniform sampler2D displacementMap;\n\tuniform float displacementScale;\n\tuniform float displacementBias;\n#endif\n",displacementmap_vertex:"#ifdef USE_DISPLACEMENTMAP\n\ttransformed += normal * ( texture2D( displacementMap, uv ).x * displacementScale + displacementBias );\n#endif\n",emissivemap_fragment:"#ifdef USE_EMISSIVEMAP\n\tvec4 emissiveColor = texture2D( emissiveMap, vUv );\n\temissiveColor.rgb = emissiveMapTexelToLinear( emissiveColor ).rgb;\n\ttotalEmissiveRadiance *= emissiveColor.rgb;\n#endif\n",emissivemap_pars_fragment:"#ifdef USE_EMISSIVEMAP\n\tuniform sampler2D emissiveMap;\n#endif\n",encodings_fragment:" gl_FragColor = linearToOutputTexel( gl_FragColor );\n",encodings_pars_fragment:"\nvec4 LinearToLinear( in vec4 value ) {\n\treturn value;\n}\nvec4 GammaToLinear( in vec4 value, in float gammaFactor ) {\n\treturn vec4( pow( value.xyz, vec3( gammaFactor ) ), value.w );\n}\nvec4 LinearToGamma( in vec4 value, in float gammaFactor ) {\n\treturn vec4( pow( value.xyz, vec3( 1.0 / gammaFactor ) ), value.w );\n}\nvec4 sRGBToLinear( in vec4 value ) {\n\treturn vec4( mix( pow( value.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), value.rgb * 0.0773993808, vec3( lessThanEqual( value.rgb, vec3( 0.04045 ) ) ) ), value.w );\n}\nvec4 LinearTosRGB( in vec4 value ) {\n\treturn vec4( mix( pow( value.rgb, vec3( 0.41666 ) ) * 1.055 - vec3( 0.055 ), value.rgb * 12.92, vec3( lessThanEqual( value.rgb, vec3( 0.0031308 ) ) ) ), value.w );\n}\nvec4 RGBEToLinear( in vec4 value ) {\n\treturn vec4( value.rgb * exp2( value.a * 255.0 - 128.0 ), 1.0 );\n}\nvec4 LinearToRGBE( in vec4 value ) {\n\tfloat maxComponent = max( max( value.r, value.g ), value.b );\n\tfloat fExp = clamp( ceil( log2( maxComponent ) ), -128.0, 127.0 );\n\treturn vec4( value.rgb / exp2( fExp ), ( fExp + 128.0 ) / 255.0 );\n}\nvec4 RGBMToLinear( in vec4 value, in float maxRange ) {\n\treturn vec4( value.xyz * value.w * maxRange, 1.0 );\n}\nvec4 LinearToRGBM( in vec4 value, in float maxRange ) {\n\tfloat maxRGB = max( value.x, max( value.g, value.b ) );\n\tfloat M = clamp( maxRGB / maxRange, 0.0, 1.0 );\n\tM = ceil( M * 255.0 ) / 255.0;\n\treturn vec4( value.rgb / ( M * maxRange ), M );\n}\nvec4 RGBDToLinear( in vec4 value, in float maxRange ) {\n\treturn vec4( value.rgb * ( ( maxRange / 255.0 ) / value.a ), 1.0 );\n}\nvec4 LinearToRGBD( in vec4 value, in float maxRange ) {\n\tfloat maxRGB = max( value.x, max( value.g, value.b ) );\n\tfloat D = max( maxRange / maxRGB, 1.0 );\n\tD = min( floor( D ) / 255.0, 1.0 );\n\treturn vec4( value.rgb * ( D * ( 255.0 / maxRange ) ), D );\n}\nconst mat3 cLogLuvM = mat3( 0.2209, 0.3390, 0.4184, 0.1138, 0.6780, 0.7319, 0.0102, 0.1130, 0.2969 );\nvec4 LinearToLogLuv( in vec4 value ) {\n\tvec3 Xp_Y_XYZp = value.rgb * cLogLuvM;\n\tXp_Y_XYZp = max(Xp_Y_XYZp, vec3(1e-6, 1e-6, 1e-6));\n\tvec4 vResult;\n\tvResult.xy = Xp_Y_XYZp.xy / Xp_Y_XYZp.z;\n\tfloat Le = 2.0 * log2(Xp_Y_XYZp.y) + 127.0;\n\tvResult.w = fract(Le);\n\tvResult.z = (Le - (floor(vResult.w*255.0))/255.0)/255.0;\n\treturn vResult;\n}\nconst mat3 cLogLuvInverseM = mat3( 6.0014, -2.7008, -1.7996, -1.3320, 3.1029, -5.7721, 0.3008, -1.0882, 5.6268 );\nvec4 LogLuvToLinear( in vec4 value ) {\n\tfloat Le = value.z * 255.0 + value.w;\n\tvec3 Xp_Y_XYZp;\n\tXp_Y_XYZp.y = exp2((Le - 127.0) / 2.0);\n\tXp_Y_XYZp.z = Xp_Y_XYZp.y / value.y;\n\tXp_Y_XYZp.x = value.x * Xp_Y_XYZp.z;\n\tvec3 vRGB = Xp_Y_XYZp.rgb * cLogLuvInverseM;\n\treturn vec4( max(vRGB, 0.0), 1.0 );\n}\n",envmap_fragment:"#ifdef USE_ENVMAP\n\t#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG )\n\t\tvec3 cameraToVertex = normalize( vWorldPosition - cameraPosition );\n\t\tvec3 worldNormal = inverseTransformDirection( normal, viewMatrix );\n\t\t#ifdef ENVMAP_MODE_REFLECTION\n\t\t\tvec3 reflectVec = reflect( cameraToVertex, worldNormal );\n\t\t#else\n\t\t\tvec3 reflectVec = refract( cameraToVertex, worldNormal, refractionRatio );\n\t\t#endif\n\t#else\n\t\tvec3 reflectVec = vReflect;\n\t#endif\n\t#ifdef ENVMAP_TYPE_CUBE\n\t\tvec4 envColor = textureCube( envMap, flipNormal * vec3( flipEnvMap * reflectVec.x, reflectVec.yz ) );\n\t#elif defined( ENVMAP_TYPE_EQUIREC )\n\t\tvec2 sampleUV;\n\t\tsampleUV.y = saturate( flipNormal * reflectVec.y * 0.5 + 0.5 );\n\t\tsampleUV.x = atan( flipNormal * reflectVec.z, flipNormal * reflectVec.x ) * RECIPROCAL_PI2 + 0.5;\n\t\tvec4 envColor = texture2D( envMap, sampleUV );\n\t#elif defined( ENVMAP_TYPE_SPHERE )\n\t\tvec3 reflectView = flipNormal * normalize( ( viewMatrix * vec4( reflectVec, 0.0 ) ).xyz + vec3( 0.0, 0.0, 1.0 ) );\n\t\tvec4 envColor = texture2D( envMap, reflectView.xy * 0.5 + 0.5 );\n\t#else\n\t\tvec4 envColor = vec4( 0.0 );\n\t#endif\n\tenvColor = envMapTexelToLinear( envColor );\n\t#ifdef ENVMAP_BLENDING_MULTIPLY\n\t\toutgoingLight = mix( outgoingLight, outgoingLight * envColor.xyz, specularStrength * reflectivity );\n\t#elif defined( ENVMAP_BLENDING_MIX )\n\t\toutgoingLight = mix( outgoingLight, envColor.xyz, specularStrength * reflectivity );\n\t#elif defined( ENVMAP_BLENDING_ADD )\n\t\toutgoingLight += envColor.xyz * specularStrength * reflectivity;\n\t#endif\n#endif\n",envmap_pars_fragment:"#if defined( USE_ENVMAP ) || defined( PHYSICAL )\n\tuniform float reflectivity;\n\tuniform float envMapIntensity;\n#endif\n#ifdef USE_ENVMAP\n\t#if ! defined( PHYSICAL ) && ( defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) )\n\t\tvarying vec3 vWorldPosition;\n\t#endif\n\t#ifdef ENVMAP_TYPE_CUBE\n\t\tuniform samplerCube envMap;\n\t#else\n\t\tuniform sampler2D envMap;\n\t#endif\n\tuniform float flipEnvMap;\n\t#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( PHYSICAL )\n\t\tuniform float refractionRatio;\n\t#else\n\t\tvarying vec3 vReflect;\n\t#endif\n#endif\n",envmap_pars_vertex:"#ifdef USE_ENVMAP\n\t#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG )\n\t\tvarying vec3 vWorldPosition;\n\t#else\n\t\tvarying vec3 vReflect;\n\t\tuniform float refractionRatio;\n\t#endif\n#endif\n",envmap_vertex:"#ifdef USE_ENVMAP\n\t#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG )\n\t\tvWorldPosition = worldPosition.xyz;\n\t#else\n\t\tvec3 cameraToVertex = normalize( worldPosition.xyz - cameraPosition );\n\t\tvec3 worldNormal = inverseTransformDirection( transformedNormal, viewMatrix );\n\t\t#ifdef ENVMAP_MODE_REFLECTION\n\t\t\tvReflect = reflect( cameraToVertex, worldNormal );\n\t\t#else\n\t\t\tvReflect = refract( cameraToVertex, worldNormal, refractionRatio );\n\t\t#endif\n\t#endif\n#endif\n",fog_vertex:"\n#ifdef USE_FOG\nfogDepth = -mvPosition.z;\n#endif",fog_pars_vertex:"#ifdef USE_FOG\n varying float fogDepth;\n#endif\n",fog_fragment:"#ifdef USE_FOG\n\t#ifdef FOG_EXP2\n\t\tfloat fogFactor = whiteCompliment( exp2( - fogDensity * fogDensity * fogDepth * fogDepth * LOG2 ) );\n\t#else\n\t\tfloat fogFactor = smoothstep( fogNear, fogFar, fogDepth );\n\t#endif\n\tgl_FragColor.rgb = mix( gl_FragColor.rgb, fogColor, fogFactor );\n#endif\n",fog_pars_fragment:"#ifdef USE_FOG\n\tuniform vec3 fogColor;\n\tvarying float fogDepth;\n\t#ifdef FOG_EXP2\n\t\tuniform float fogDensity;\n\t#else\n\t\tuniform float fogNear;\n\t\tuniform float fogFar;\n\t#endif\n#endif\n",gradientmap_pars_fragment:"#ifdef TOON\n\tuniform sampler2D gradientMap;\n\tvec3 getGradientIrradiance( vec3 normal, vec3 lightDirection ) {\n\t\tfloat dotNL = dot( normal, lightDirection );\n\t\tvec2 coord = vec2( dotNL * 0.5 + 0.5, 0.0 );\n\t\t#ifdef USE_GRADIENTMAP\n\t\t\treturn texture2D( gradientMap, coord ).rgb;\n\t\t#else\n\t\t\treturn ( coord.x < 0.7 ) ? vec3( 0.7 ) : vec3( 1.0 );\n\t\t#endif\n\t}\n#endif\n",lightmap_fragment:"#ifdef USE_LIGHTMAP\n\treflectedLight.indirectDiffuse += PI * texture2D( lightMap, vUv2 ).xyz * lightMapIntensity;\n#endif\n",lightmap_pars_fragment:"#ifdef USE_LIGHTMAP\n\tuniform sampler2D lightMap;\n\tuniform float lightMapIntensity;\n#endif",lights_lambert_vertex:"vec3 diffuse = vec3( 1.0 );\nGeometricContext geometry;\ngeometry.position = mvPosition.xyz;\ngeometry.normal = normalize( transformedNormal );\ngeometry.viewDir = normalize( -mvPosition.xyz );\nGeometricContext backGeometry;\nbackGeometry.position = geometry.position;\nbackGeometry.normal = -geometry.normal;\nbackGeometry.viewDir = geometry.viewDir;\nvLightFront = vec3( 0.0 );\n#ifdef DOUBLE_SIDED\n\tvLightBack = vec3( 0.0 );\n#endif\nIncidentLight directLight;\nfloat dotNL;\nvec3 directLightColor_Diffuse;\n#if NUM_POINT_LIGHTS > 0\n\tfor ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {\n\t\tgetPointDirectLightIrradiance( pointLights[ i ], geometry, directLight );\n\t\tdotNL = dot( geometry.normal, directLight.direction );\n\t\tdirectLightColor_Diffuse = PI * directLight.color;\n\t\tvLightFront += saturate( dotNL ) * directLightColor_Diffuse;\n\t\t#ifdef DOUBLE_SIDED\n\t\t\tvLightBack += saturate( -dotNL ) * directLightColor_Diffuse;\n\t\t#endif\n\t}\n#endif\n#if NUM_SPOT_LIGHTS > 0\n\tfor ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {\n\t\tgetSpotDirectLightIrradiance( spotLights[ i ], geometry, directLight );\n\t\tdotNL = dot( geometry.normal, directLight.direction );\n\t\tdirectLightColor_Diffuse = PI * directLight.color;\n\t\tvLightFront += saturate( dotNL ) * directLightColor_Diffuse;\n\t\t#ifdef DOUBLE_SIDED\n\t\t\tvLightBack += saturate( -dotNL ) * directLightColor_Diffuse;\n\t\t#endif\n\t}\n#endif\n#if NUM_DIR_LIGHTS > 0\n\tfor ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {\n\t\tgetDirectionalDirectLightIrradiance( directionalLights[ i ], geometry, directLight );\n\t\tdotNL = dot( geometry.normal, directLight.direction );\n\t\tdirectLightColor_Diffuse = PI * directLight.color;\n\t\tvLightFront += saturate( dotNL ) * directLightColor_Diffuse;\n\t\t#ifdef DOUBLE_SIDED\n\t\t\tvLightBack += saturate( -dotNL ) * directLightColor_Diffuse;\n\t\t#endif\n\t}\n#endif\n#if NUM_HEMI_LIGHTS > 0\n\tfor ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) {\n\t\tvLightFront += getHemisphereLightIrradiance( hemisphereLights[ i ], geometry );\n\t\t#ifdef DOUBLE_SIDED\n\t\t\tvLightBack += getHemisphereLightIrradiance( hemisphereLights[ i ], backGeometry );\n\t\t#endif\n\t}\n#endif\n",lights_pars:"uniform vec3 ambientLightColor;\nvec3 getAmbientLightIrradiance( const in vec3 ambientLightColor ) {\n\tvec3 irradiance = ambientLightColor;\n\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\t\tirradiance *= PI;\n\t#endif\n\treturn irradiance;\n}\n#if NUM_DIR_LIGHTS > 0\n\tstruct DirectionalLight {\n\t\tvec3 direction;\n\t\tvec3 color;\n\t\tint shadow;\n\t\tfloat shadowBias;\n\t\tfloat shadowRadius;\n\t\tvec2 shadowMapSize;\n\t};\n\tuniform DirectionalLight directionalLights[ NUM_DIR_LIGHTS ];\n\tvoid getDirectionalDirectLightIrradiance( const in DirectionalLight directionalLight, const in GeometricContext geometry, out IncidentLight directLight ) {\n\t\tdirectLight.color = directionalLight.color;\n\t\tdirectLight.direction = directionalLight.direction;\n\t\tdirectLight.visible = true;\n\t}\n#endif\n#if NUM_POINT_LIGHTS > 0\n\tstruct PointLight {\n\t\tvec3 position;\n\t\tvec3 color;\n\t\tfloat distance;\n\t\tfloat decay;\n\t\tint shadow;\n\t\tfloat shadowBias;\n\t\tfloat shadowRadius;\n\t\tvec2 shadowMapSize;\n\t};\n\tuniform PointLight pointLights[ NUM_POINT_LIGHTS ];\n\tvoid getPointDirectLightIrradiance( const in PointLight pointLight, const in GeometricContext geometry, out IncidentLight directLight ) {\n\t\tvec3 lVector = pointLight.position - geometry.position;\n\t\tdirectLight.direction = normalize( lVector );\n\t\tfloat lightDistance = length( lVector );\n\t\tdirectLight.color = pointLight.color;\n\t\tdirectLight.color *= punctualLightIntensityToIrradianceFactor( lightDistance, pointLight.distance, pointLight.decay );\n\t\tdirectLight.visible = ( directLight.color != vec3( 0.0 ) );\n\t}\n#endif\n#if NUM_SPOT_LIGHTS > 0\n\tstruct SpotLight {\n\t\tvec3 position;\n\t\tvec3 direction;\n\t\tvec3 color;\n\t\tfloat distance;\n\t\tfloat decay;\n\t\tfloat coneCos;\n\t\tfloat penumbraCos;\n\t\tint shadow;\n\t\tfloat shadowBias;\n\t\tfloat shadowRadius;\n\t\tvec2 shadowMapSize;\n\t};\n\tuniform SpotLight spotLights[ NUM_SPOT_LIGHTS ];\n\tvoid getSpotDirectLightIrradiance( const in SpotLight spotLight, const in GeometricContext geometry, out IncidentLight directLight ) {\n\t\tvec3 lVector = spotLight.position - geometry.position;\n\t\tdirectLight.direction = normalize( lVector );\n\t\tfloat lightDistance = length( lVector );\n\t\tfloat angleCos = dot( directLight.direction, spotLight.direction );\n\t\tif ( angleCos > spotLight.coneCos ) {\n\t\t\tfloat spotEffect = smoothstep( spotLight.coneCos, spotLight.penumbraCos, angleCos );\n\t\t\tdirectLight.color = spotLight.color;\n\t\t\tdirectLight.color *= spotEffect * punctualLightIntensityToIrradianceFactor( lightDistance, spotLight.distance, spotLight.decay );\n\t\t\tdirectLight.visible = true;\n\t\t} else {\n\t\t\tdirectLight.color = vec3( 0.0 );\n\t\t\tdirectLight.visible = false;\n\t\t}\n\t}\n#endif\n#if NUM_RECT_AREA_LIGHTS > 0\n\tstruct RectAreaLight {\n\t\tvec3 color;\n\t\tvec3 position;\n\t\tvec3 halfWidth;\n\t\tvec3 halfHeight;\n\t};\n\tuniform sampler2D ltcMat;\tuniform sampler2D ltcMag;\n\tuniform RectAreaLight rectAreaLights[ NUM_RECT_AREA_LIGHTS ];\n#endif\n#if NUM_HEMI_LIGHTS > 0\n\tstruct HemisphereLight {\n\t\tvec3 direction;\n\t\tvec3 skyColor;\n\t\tvec3 groundColor;\n\t};\n\tuniform HemisphereLight hemisphereLights[ NUM_HEMI_LIGHTS ];\n\tvec3 getHemisphereLightIrradiance( const in HemisphereLight hemiLight, const in GeometricContext geometry ) {\n\t\tfloat dotNL = dot( geometry.normal, hemiLight.direction );\n\t\tfloat hemiDiffuseWeight = 0.5 * dotNL + 0.5;\n\t\tvec3 irradiance = mix( hemiLight.groundColor, hemiLight.skyColor, hemiDiffuseWeight );\n\t\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\t\t\tirradiance *= PI;\n\t\t#endif\n\t\treturn irradiance;\n\t}\n#endif\n#if defined( USE_ENVMAP ) && defined( PHYSICAL )\n\tvec3 getLightProbeIndirectIrradiance( const in GeometricContext geometry, const in int maxMIPLevel ) {\n\t\tvec3 worldNormal = inverseTransformDirection( geometry.normal, viewMatrix );\n\t\t#ifdef ENVMAP_TYPE_CUBE\n\t\t\tvec3 queryVec = vec3( flipEnvMap * worldNormal.x, worldNormal.yz );\n\t\t\t#ifdef TEXTURE_LOD_EXT\n\t\t\t\tvec4 envMapColor = textureCubeLodEXT( envMap, queryVec, float( maxMIPLevel ) );\n\t\t\t#else\n\t\t\t\tvec4 envMapColor = textureCube( envMap, queryVec, float( maxMIPLevel ) );\n\t\t\t#endif\n\t\t\tenvMapColor.rgb = envMapTexelToLinear( envMapColor ).rgb;\n\t\t#elif defined( ENVMAP_TYPE_CUBE_UV )\n\t\t\tvec3 queryVec = vec3( flipEnvMap * worldNormal.x, worldNormal.yz );\n\t\t\tvec4 envMapColor = textureCubeUV( queryVec, 1.0 );\n\t\t#else\n\t\t\tvec4 envMapColor = vec4( 0.0 );\n\t\t#endif\n\t\treturn PI * envMapColor.rgb * envMapIntensity;\n\t}\n\tfloat getSpecularMIPLevel( const in float blinnShininessExponent, const in int maxMIPLevel ) {\n\t\tfloat maxMIPLevelScalar = float( maxMIPLevel );\n\t\tfloat desiredMIPLevel = maxMIPLevelScalar - 0.79248 - 0.5 * log2( pow2( blinnShininessExponent ) + 1.0 );\n\t\treturn clamp( desiredMIPLevel, 0.0, maxMIPLevelScalar );\n\t}\n\tvec3 getLightProbeIndirectRadiance( const in GeometricContext geometry, const in float blinnShininessExponent, const in int maxMIPLevel ) {\n\t\t#ifdef ENVMAP_MODE_REFLECTION\n\t\t\tvec3 reflectVec = reflect( -geometry.viewDir, geometry.normal );\n\t\t#else\n\t\t\tvec3 reflectVec = refract( -geometry.viewDir, geometry.normal, refractionRatio );\n\t\t#endif\n\t\treflectVec = inverseTransformDirection( reflectVec, viewMatrix );\n\t\tfloat specularMIPLevel = getSpecularMIPLevel( blinnShininessExponent, maxMIPLevel );\n\t\t#ifdef ENVMAP_TYPE_CUBE\n\t\t\tvec3 queryReflectVec = vec3( flipEnvMap * reflectVec.x, reflectVec.yz );\n\t\t\t#ifdef TEXTURE_LOD_EXT\n\t\t\t\tvec4 envMapColor = textureCubeLodEXT( envMap, queryReflectVec, specularMIPLevel );\n\t\t\t#else\n\t\t\t\tvec4 envMapColor = textureCube( envMap, queryReflectVec, specularMIPLevel );\n\t\t\t#endif\n\t\t\tenvMapColor.rgb = envMapTexelToLinear( envMapColor ).rgb;\n\t\t#elif defined( ENVMAP_TYPE_CUBE_UV )\n\t\t\tvec3 queryReflectVec = vec3( flipEnvMap * reflectVec.x, reflectVec.yz );\n\t\t\tvec4 envMapColor = textureCubeUV(queryReflectVec, BlinnExponentToGGXRoughness(blinnShininessExponent));\n\t\t#elif defined( ENVMAP_TYPE_EQUIREC )\n\t\t\tvec2 sampleUV;\n\t\t\tsampleUV.y = saturate( reflectVec.y * 0.5 + 0.5 );\n\t\t\tsampleUV.x = atan( reflectVec.z, reflectVec.x ) * RECIPROCAL_PI2 + 0.5;\n\t\t\t#ifdef TEXTURE_LOD_EXT\n\t\t\t\tvec4 envMapColor = texture2DLodEXT( envMap, sampleUV, specularMIPLevel );\n\t\t\t#else\n\t\t\t\tvec4 envMapColor = texture2D( envMap, sampleUV, specularMIPLevel );\n\t\t\t#endif\n\t\t\tenvMapColor.rgb = envMapTexelToLinear( envMapColor ).rgb;\n\t\t#elif defined( ENVMAP_TYPE_SPHERE )\n\t\t\tvec3 reflectView = normalize( ( viewMatrix * vec4( reflectVec, 0.0 ) ).xyz + vec3( 0.0,0.0,1.0 ) );\n\t\t\t#ifdef TEXTURE_LOD_EXT\n\t\t\t\tvec4 envMapColor = texture2DLodEXT( envMap, reflectView.xy * 0.5 + 0.5, specularMIPLevel );\n\t\t\t#else\n\t\t\t\tvec4 envMapColor = texture2D( envMap, reflectView.xy * 0.5 + 0.5, specularMIPLevel );\n\t\t\t#endif\n\t\t\tenvMapColor.rgb = envMapTexelToLinear( envMapColor ).rgb;\n\t\t#endif\n\t\treturn envMapColor.rgb * envMapIntensity;\n\t}\n#endif\n",lights_phong_fragment:"BlinnPhongMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb;\nmaterial.specularColor = specular;\nmaterial.specularShininess = shininess;\nmaterial.specularStrength = specularStrength;\n",lights_phong_pars_fragment:"varying vec3 vViewPosition;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\nstruct BlinnPhongMaterial {\n\tvec3\tdiffuseColor;\n\tvec3\tspecularColor;\n\tfloat\tspecularShininess;\n\tfloat\tspecularStrength;\n};\n#if NUM_RECT_AREA_LIGHTS > 0\n\tvoid RE_Direct_RectArea_BlinnPhong( const in RectAreaLight rectAreaLight, const in GeometricContext geometry, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {\n\t\tvec3 matDiffColor = material.diffuseColor;\n\t\tvec3 matSpecColor = material.specularColor;\n\t\tvec3 lightColor = rectAreaLight.color;\n\t\tfloat roughness = BlinnExponentToGGXRoughness( material.specularShininess );\n\t\tvec3 spec = Rect_Area_Light_Specular_Reflectance(\n\t\t\t\tgeometry,\n\t\t\t\trectAreaLight.position, rectAreaLight.halfWidth, rectAreaLight.halfHeight,\n\t\t\t\troughness,\n\t\t\t\tltcMat, ltcMag );\n\t\tvec3 diff = Rect_Area_Light_Diffuse_Reflectance(\n\t\t\t\tgeometry,\n\t\t\t\trectAreaLight.position, rectAreaLight.halfWidth, rectAreaLight.halfHeight );\n\t\treflectedLight.directSpecular += lightColor * matSpecColor * spec;\n\t\treflectedLight.directDiffuse += lightColor * matDiffColor * diff;\n\t}\n#endif\nvoid RE_Direct_BlinnPhong( const in IncidentLight directLight, const in GeometricContext geometry, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {\n\t#ifdef TOON\n\t\tvec3 irradiance = getGradientIrradiance( geometry.normal, directLight.direction ) * directLight.color;\n\t#else\n\t\tfloat dotNL = saturate( dot( geometry.normal, directLight.direction ) );\n\t\tvec3 irradiance = dotNL * directLight.color;\n\t#endif\n\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\t\tirradiance *= PI;\n\t#endif\n\treflectedLight.directDiffuse += irradiance * BRDF_Diffuse_Lambert( material.diffuseColor );\n\treflectedLight.directSpecular += irradiance * BRDF_Specular_BlinnPhong( directLight, geometry, material.specularColor, material.specularShininess ) * material.specularStrength;\n}\nvoid RE_IndirectDiffuse_BlinnPhong( const in vec3 irradiance, const in GeometricContext geometry, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {\n\treflectedLight.indirectDiffuse += irradiance * BRDF_Diffuse_Lambert( material.diffuseColor );\n}\n#define RE_Direct\t\t\t\tRE_Direct_BlinnPhong\n#define RE_Direct_RectArea\t\tRE_Direct_RectArea_BlinnPhong\n#define RE_IndirectDiffuse\t\tRE_IndirectDiffuse_BlinnPhong\n#define Material_LightProbeLOD( material )\t(0)\n",lights_physical_fragment:"PhysicalMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb * ( 1.0 - metalnessFactor );\nmaterial.specularRoughness = clamp( roughnessFactor, 0.04, 1.0 );\n#ifdef STANDARD\n\tmaterial.specularColor = mix( vec3( DEFAULT_SPECULAR_COEFFICIENT ), diffuseColor.rgb, metalnessFactor );\n#else\n\tmaterial.specularColor = mix( vec3( MAXIMUM_SPECULAR_COEFFICIENT * pow2( reflectivity ) ), diffuseColor.rgb, metalnessFactor );\n\tmaterial.clearCoat = saturate( clearCoat );\tmaterial.clearCoatRoughness = clamp( clearCoatRoughness, 0.04, 1.0 );\n#endif\n",lights_physical_pars_fragment:"struct PhysicalMaterial {\n\tvec3\tdiffuseColor;\n\tfloat\tspecularRoughness;\n\tvec3\tspecularColor;\n\t#ifndef STANDARD\n\t\tfloat clearCoat;\n\t\tfloat clearCoatRoughness;\n\t#endif\n};\n#define MAXIMUM_SPECULAR_COEFFICIENT 0.16\n#define DEFAULT_SPECULAR_COEFFICIENT 0.04\nfloat clearCoatDHRApprox( const in float roughness, const in float dotNL ) {\n\treturn DEFAULT_SPECULAR_COEFFICIENT + ( 1.0 - DEFAULT_SPECULAR_COEFFICIENT ) * ( pow( 1.0 - dotNL, 5.0 ) * pow( 1.0 - roughness, 2.0 ) );\n}\n#if NUM_RECT_AREA_LIGHTS > 0\n\tvoid RE_Direct_RectArea_Physical( const in RectAreaLight rectAreaLight, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n\t\tvec3 matDiffColor = material.diffuseColor;\n\t\tvec3 matSpecColor = material.specularColor;\n\t\tvec3 lightColor = rectAreaLight.color;\n\t\tfloat roughness = material.specularRoughness;\n\t\tvec3 spec = Rect_Area_Light_Specular_Reflectance(\n\t\t\t\tgeometry,\n\t\t\t\trectAreaLight.position, rectAreaLight.halfWidth, rectAreaLight.halfHeight,\n\t\t\t\troughness,\n\t\t\t\tltcMat, ltcMag );\n\t\tvec3 diff = Rect_Area_Light_Diffuse_Reflectance(\n\t\t\t\tgeometry,\n\t\t\t\trectAreaLight.position, rectAreaLight.halfWidth, rectAreaLight.halfHeight );\n\t\treflectedLight.directSpecular += lightColor * matSpecColor * spec;\n\t\treflectedLight.directDiffuse += lightColor * matDiffColor * diff;\n\t}\n#endif\nvoid RE_Direct_Physical( const in IncidentLight directLight, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n\tfloat dotNL = saturate( dot( geometry.normal, directLight.direction ) );\n\tvec3 irradiance = dotNL * directLight.color;\n\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\t\tirradiance *= PI;\n\t#endif\n\t#ifndef STANDARD\n\t\tfloat clearCoatDHR = material.clearCoat * clearCoatDHRApprox( material.clearCoatRoughness, dotNL );\n\t#else\n\t\tfloat clearCoatDHR = 0.0;\n\t#endif\n\treflectedLight.directSpecular += ( 1.0 - clearCoatDHR ) * irradiance * BRDF_Specular_GGX( directLight, geometry, material.specularColor, material.specularRoughness );\n\treflectedLight.directDiffuse += ( 1.0 - clearCoatDHR ) * irradiance * BRDF_Diffuse_Lambert( material.diffuseColor );\n\t#ifndef STANDARD\n\t\treflectedLight.directSpecular += irradiance * material.clearCoat * BRDF_Specular_GGX( directLight, geometry, vec3( DEFAULT_SPECULAR_COEFFICIENT ), material.clearCoatRoughness );\n\t#endif\n}\nvoid RE_IndirectDiffuse_Physical( const in vec3 irradiance, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n\treflectedLight.indirectDiffuse += irradiance * BRDF_Diffuse_Lambert( material.diffuseColor );\n}\nvoid RE_IndirectSpecular_Physical( const in vec3 radiance, const in vec3 clearCoatRadiance, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n\t#ifndef STANDARD\n\t\tfloat dotNV = saturate( dot( geometry.normal, geometry.viewDir ) );\n\t\tfloat dotNL = dotNV;\n\t\tfloat clearCoatDHR = material.clearCoat * clearCoatDHRApprox( material.clearCoatRoughness, dotNL );\n\t#else\n\t\tfloat clearCoatDHR = 0.0;\n\t#endif\n\treflectedLight.indirectSpecular += ( 1.0 - clearCoatDHR ) * radiance * BRDF_Specular_GGX_Environment( geometry, material.specularColor, material.specularRoughness );\n\t#ifndef STANDARD\n\t\treflectedLight.indirectSpecular += clearCoatRadiance * material.clearCoat * BRDF_Specular_GGX_Environment( geometry, vec3( DEFAULT_SPECULAR_COEFFICIENT ), material.clearCoatRoughness );\n\t#endif\n}\n#define RE_Direct\t\t\t\tRE_Direct_Physical\n#define RE_Direct_RectArea\t\tRE_Direct_RectArea_Physical\n#define RE_IndirectDiffuse\t\tRE_IndirectDiffuse_Physical\n#define RE_IndirectSpecular\t\tRE_IndirectSpecular_Physical\n#define Material_BlinnShininessExponent( material ) GGXRoughnessToBlinnExponent( material.specularRoughness )\n#define Material_ClearCoat_BlinnShininessExponent( material ) GGXRoughnessToBlinnExponent( material.clearCoatRoughness )\nfloat computeSpecularOcclusion( const in float dotNV, const in float ambientOcclusion, const in float roughness ) {\n\treturn saturate( pow( dotNV + ambientOcclusion, exp2( - 16.0 * roughness - 1.0 ) ) - 1.0 + ambientOcclusion );\n}\n",lights_template:"\nGeometricContext geometry;\ngeometry.position = - vViewPosition;\ngeometry.normal = normal;\ngeometry.viewDir = normalize( vViewPosition );\nIncidentLight directLight;\n#if ( NUM_POINT_LIGHTS > 0 ) && defined( RE_Direct )\n\tPointLight pointLight;\n\tfor ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {\n\t\tpointLight = pointLights[ i ];\n\t\tgetPointDirectLightIrradiance( pointLight, geometry, directLight );\n\t\t#ifdef USE_SHADOWMAP\n\t\tdirectLight.color *= all( bvec2( pointLight.shadow, directLight.visible ) ) ? getPointShadow( pointShadowMap[ i ], pointLight.shadowMapSize, pointLight.shadowBias, pointLight.shadowRadius, vPointShadowCoord[ i ] ) : 1.0;\n\t\t#endif\n\t\tRE_Direct( directLight, geometry, material, reflectedLight );\n\t}\n#endif\n#if ( NUM_SPOT_LIGHTS > 0 ) && defined( RE_Direct )\n\tSpotLight spotLight;\n\tfor ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {\n\t\tspotLight = spotLights[ i ];\n\t\tgetSpotDirectLightIrradiance( spotLight, geometry, directLight );\n\t\t#ifdef USE_SHADOWMAP\n\t\tdirectLight.color *= all( bvec2( spotLight.shadow, directLight.visible ) ) ? getShadow( spotShadowMap[ i ], spotLight.shadowMapSize, spotLight.shadowBias, spotLight.shadowRadius, vSpotShadowCoord[ i ] ) : 1.0;\n\t\t#endif\n\t\tRE_Direct( directLight, geometry, material, reflectedLight );\n\t}\n#endif\n#if ( NUM_DIR_LIGHTS > 0 ) && defined( RE_Direct )\n\tDirectionalLight directionalLight;\n\tfor ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {\n\t\tdirectionalLight = directionalLights[ i ];\n\t\tgetDirectionalDirectLightIrradiance( directionalLight, geometry, directLight );\n\t\t#ifdef USE_SHADOWMAP\n\t\tdirectLight.color *= all( bvec2( directionalLight.shadow, directLight.visible ) ) ? getShadow( directionalShadowMap[ i ], directionalLight.shadowMapSize, directionalLight.shadowBias, directionalLight.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;\n\t\t#endif\n\t\tRE_Direct( directLight, geometry, material, reflectedLight );\n\t}\n#endif\n#if ( NUM_RECT_AREA_LIGHTS > 0 ) && defined( RE_Direct_RectArea )\n\tRectAreaLight rectAreaLight;\n\tfor ( int i = 0; i < NUM_RECT_AREA_LIGHTS; i ++ ) {\n\t\trectAreaLight = rectAreaLights[ i ];\n\t\tRE_Direct_RectArea( rectAreaLight, geometry, material, reflectedLight );\n\t}\n#endif\n#if defined( RE_IndirectDiffuse )\n\tvec3 irradiance = getAmbientLightIrradiance( ambientLightColor );\n\t#ifdef USE_LIGHTMAP\n\t\tvec3 lightMapIrradiance = texture2D( lightMap, vUv2 ).xyz * lightMapIntensity;\n\t\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\t\t\tlightMapIrradiance *= PI;\n\t\t#endif\n\t\tirradiance += lightMapIrradiance;\n\t#endif\n\t#if ( NUM_HEMI_LIGHTS > 0 )\n\t\tfor ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) {\n\t\t\tirradiance += getHemisphereLightIrradiance( hemisphereLights[ i ], geometry );\n\t\t}\n\t#endif\n\t#if defined( USE_ENVMAP ) && defined( PHYSICAL ) && defined( ENVMAP_TYPE_CUBE_UV )\n\t\tirradiance += getLightProbeIndirectIrradiance( geometry, 8 );\n\t#endif\n\tRE_IndirectDiffuse( irradiance, geometry, material, reflectedLight );\n#endif\n#if defined( USE_ENVMAP ) && defined( RE_IndirectSpecular )\n\tvec3 radiance = getLightProbeIndirectRadiance( geometry, Material_BlinnShininessExponent( material ), 8 );\n\t#ifndef STANDARD\n\t\tvec3 clearCoatRadiance = getLightProbeIndirectRadiance( geometry, Material_ClearCoat_BlinnShininessExponent( material ), 8 );\n\t#else\n\t\tvec3 clearCoatRadiance = vec3( 0.0 );\n\t#endif\n\tRE_IndirectSpecular( radiance, clearCoatRadiance, geometry, material, reflectedLight );\n#endif\n",logdepthbuf_fragment:"#if defined(USE_LOGDEPTHBUF) && defined(USE_LOGDEPTHBUF_EXT)\n\tgl_FragDepthEXT = log2(vFragDepth) * logDepthBufFC * 0.5;\n#endif",logdepthbuf_pars_fragment:"#ifdef USE_LOGDEPTHBUF\n\tuniform float logDepthBufFC;\n\t#ifdef USE_LOGDEPTHBUF_EXT\n\t\tvarying float vFragDepth;\n\t#endif\n#endif\n",logdepthbuf_pars_vertex:"#ifdef USE_LOGDEPTHBUF\n\t#ifdef USE_LOGDEPTHBUF_EXT\n\t\tvarying float vFragDepth;\n\t#endif\n\tuniform float logDepthBufFC;\n#endif",logdepthbuf_vertex:"#ifdef USE_LOGDEPTHBUF\n\tgl_Position.z = log2(max( EPSILON, gl_Position.w + 1.0 )) * logDepthBufFC;\n\t#ifdef USE_LOGDEPTHBUF_EXT\n\t\tvFragDepth = 1.0 + gl_Position.w;\n\t#else\n\t\tgl_Position.z = (gl_Position.z - 1.0) * gl_Position.w;\n\t#endif\n#endif\n",map_fragment:"#ifdef USE_MAP\n\tvec4 texelColor = texture2D( map, vUv );\n\ttexelColor = mapTexelToLinear( texelColor );\n\tdiffuseColor *= texelColor;\n#endif\n",map_pars_fragment:"#ifdef USE_MAP\n\tuniform sampler2D map;\n#endif\n",map_particle_fragment:"#ifdef USE_MAP\n\tvec4 mapTexel = texture2D( map, vec2( gl_PointCoord.x, 1.0 - gl_PointCoord.y ) * offsetRepeat.zw + offsetRepeat.xy );\n\tdiffuseColor *= mapTexelToLinear( mapTexel );\n#endif\n",map_particle_pars_fragment:"#ifdef USE_MAP\n\tuniform vec4 offsetRepeat;\n\tuniform sampler2D map;\n#endif\n",metalnessmap_fragment:"float metalnessFactor = metalness;\n#ifdef USE_METALNESSMAP\n\tvec4 texelMetalness = texture2D( metalnessMap, vUv );\n\tmetalnessFactor *= texelMetalness.b;\n#endif\n",metalnessmap_pars_fragment:"#ifdef USE_METALNESSMAP\n\tuniform sampler2D metalnessMap;\n#endif",morphnormal_vertex:"#ifdef USE_MORPHNORMALS\n\tobjectNormal += ( morphNormal0 - normal ) * morphTargetInfluences[ 0 ];\n\tobjectNormal += ( morphNormal1 - normal ) * morphTargetInfluences[ 1 ];\n\tobjectNormal += ( morphNormal2 - normal ) * morphTargetInfluences[ 2 ];\n\tobjectNormal += ( morphNormal3 - normal ) * morphTargetInfluences[ 3 ];\n#endif\n",morphtarget_pars_vertex:"#ifdef USE_MORPHTARGETS\n\t#ifndef USE_MORPHNORMALS\n\tuniform float morphTargetInfluences[ 8 ];\n\t#else\n\tuniform float morphTargetInfluences[ 4 ];\n\t#endif\n#endif",morphtarget_vertex:"#ifdef USE_MORPHTARGETS\n\ttransformed += ( morphTarget0 - position ) * morphTargetInfluences[ 0 ];\n\ttransformed += ( morphTarget1 - position ) * morphTargetInfluences[ 1 ];\n\ttransformed += ( morphTarget2 - position ) * morphTargetInfluences[ 2 ];\n\ttransformed += ( morphTarget3 - position ) * morphTargetInfluences[ 3 ];\n\t#ifndef USE_MORPHNORMALS\n\ttransformed += ( morphTarget4 - position ) * morphTargetInfluences[ 4 ];\n\ttransformed += ( morphTarget5 - position ) * morphTargetInfluences[ 5 ];\n\ttransformed += ( morphTarget6 - position ) * morphTargetInfluences[ 6 ];\n\ttransformed += ( morphTarget7 - position ) * morphTargetInfluences[ 7 ];\n\t#endif\n#endif\n",normal_flip:"#ifdef DOUBLE_SIDED\n\tfloat flipNormal = ( float( gl_FrontFacing ) * 2.0 - 1.0 );\n#else\n\tfloat flipNormal = 1.0;\n#endif\n",normal_fragment:"#ifdef FLAT_SHADED\n\tvec3 fdx = vec3( dFdx( vViewPosition.x ), dFdx( vViewPosition.y ), dFdx( vViewPosition.z ) );\n\tvec3 fdy = vec3( dFdy( vViewPosition.x ), dFdy( vViewPosition.y ), dFdy( vViewPosition.z ) );\n\tvec3 normal = normalize( cross( fdx, fdy ) );\n#else\n\tvec3 normal = normalize( vNormal ) * flipNormal;\n#endif\n#ifdef USE_NORMALMAP\n\tnormal = perturbNormal2Arb( -vViewPosition, normal );\n#elif defined( USE_BUMPMAP )\n\tnormal = perturbNormalArb( -vViewPosition, normal, dHdxy_fwd() );\n#endif\n",normalmap_pars_fragment:"#ifdef USE_NORMALMAP\n\tuniform sampler2D normalMap;\n\tuniform vec2 normalScale;\n\tvec3 perturbNormal2Arb( vec3 eye_pos, vec3 surf_norm ) {\n\t\tvec3 q0 = dFdx( eye_pos.xyz );\n\t\tvec3 q1 = dFdy( eye_pos.xyz );\n\t\tvec2 st0 = dFdx( vUv.st );\n\t\tvec2 st1 = dFdy( vUv.st );\n\t\tvec3 S = normalize( q0 * st1.t - q1 * st0.t );\n\t\tvec3 T = normalize( -q0 * st1.s + q1 * st0.s );\n\t\tvec3 N = normalize( surf_norm );\n\t\tvec3 mapN = texture2D( normalMap, vUv ).xyz * 2.0 - 1.0;\n\t\tmapN.xy = normalScale * mapN.xy;\n\t\tmat3 tsn = mat3( S, T, N );\n\t\treturn normalize( tsn * mapN );\n\t}\n#endif\n",packing:"vec3 packNormalToRGB( const in vec3 normal ) {\n\treturn normalize( normal ) * 0.5 + 0.5;\n}\nvec3 unpackRGBToNormal( const in vec3 rgb ) {\n\treturn 1.0 - 2.0 * rgb.xyz;\n}\nconst float PackUpscale = 256. / 255.;const float UnpackDownscale = 255. / 256.;\nconst vec3 PackFactors = vec3( 256. * 256. * 256., 256. * 256., 256. );\nconst vec4 UnpackFactors = UnpackDownscale / vec4( PackFactors, 1. );\nconst float ShiftRight8 = 1. / 256.;\nvec4 packDepthToRGBA( const in float v ) {\n\tvec4 r = vec4( fract( v * PackFactors ), v );\n\tr.yzw -= r.xyz * ShiftRight8;\treturn r * PackUpscale;\n}\nfloat unpackRGBAToDepth( const in vec4 v ) {\n\treturn dot( v, UnpackFactors );\n}\nfloat viewZToOrthographicDepth( const in float viewZ, const in float near, const in float far ) {\n\treturn ( viewZ + near ) / ( near - far );\n}\nfloat orthographicDepthToViewZ( const in float linearClipZ, const in float near, const in float far ) {\n\treturn linearClipZ * ( near - far ) - near;\n}\nfloat viewZToPerspectiveDepth( const in float viewZ, const in float near, const in float far ) {\n\treturn (( near + viewZ ) * far ) / (( far - near ) * viewZ );\n}\nfloat perspectiveDepthToViewZ( const in float invClipZ, const in float near, const in float far ) {\n\treturn ( near * far ) / ( ( far - near ) * invClipZ - far );\n}\n",premultiplied_alpha_fragment:"#ifdef PREMULTIPLIED_ALPHA\n\tgl_FragColor.rgb *= gl_FragColor.a;\n#endif\n",project_vertex:"#ifdef USE_SKINNING\n\tvec4 mvPosition = modelViewMatrix * skinned;\n#else\n\tvec4 mvPosition = modelViewMatrix * vec4( transformed, 1.0 );\n#endif\ngl_Position = projectionMatrix * mvPosition;\n",dithering_fragment:"#if defined( DITHERING )\n gl_FragColor.rgb = dithering( gl_FragColor.rgb );\n#endif\n",dithering_pars_fragment:"#if defined( DITHERING )\n\tvec3 dithering( vec3 color ) {\n\t\tfloat grid_position = rand( gl_FragCoord.xy );\n\t\tvec3 dither_shift_RGB = vec3( 0.25 / 255.0, -0.25 / 255.0, 0.25 / 255.0 );\n\t\tdither_shift_RGB = mix( 2.0 * dither_shift_RGB, -2.0 * dither_shift_RGB, grid_position );\n\t\treturn color + dither_shift_RGB;\n\t}\n#endif\n",roughnessmap_fragment:"float roughnessFactor = roughness;\n#ifdef USE_ROUGHNESSMAP\n\tvec4 texelRoughness = texture2D( roughnessMap, vUv );\n\troughnessFactor *= texelRoughness.g;\n#endif\n",roughnessmap_pars_fragment:"#ifdef USE_ROUGHNESSMAP\n\tuniform sampler2D roughnessMap;\n#endif",shadowmap_pars_fragment:"#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHTS > 0\n\t\tuniform sampler2D directionalShadowMap[ NUM_DIR_LIGHTS ];\n\t\tvarying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHTS ];\n\t#endif\n\t#if NUM_SPOT_LIGHTS > 0\n\t\tuniform sampler2D spotShadowMap[ NUM_SPOT_LIGHTS ];\n\t\tvarying vec4 vSpotShadowCoord[ NUM_SPOT_LIGHTS ];\n\t#endif\n\t#if NUM_POINT_LIGHTS > 0\n\t\tuniform sampler2D pointShadowMap[ NUM_POINT_LIGHTS ];\n\t\tvarying vec4 vPointShadowCoord[ NUM_POINT_LIGHTS ];\n\t#endif\n\tfloat texture2DCompare( sampler2D depths, vec2 uv, float compare ) {\n\t\treturn step( compare, unpackRGBAToDepth( texture2D( depths, uv ) ) );\n\t}\n\tfloat texture2DShadowLerp( sampler2D depths, vec2 size, vec2 uv, float compare ) {\n\t\tconst vec2 offset = vec2( 0.0, 1.0 );\n\t\tvec2 texelSize = vec2( 1.0 ) / size;\n\t\tvec2 centroidUV = floor( uv * size + 0.5 ) / size;\n\t\tfloat lb = texture2DCompare( depths, centroidUV + texelSize * offset.xx, compare );\n\t\tfloat lt = texture2DCompare( depths, centroidUV + texelSize * offset.xy, compare );\n\t\tfloat rb = texture2DCompare( depths, centroidUV + texelSize * offset.yx, compare );\n\t\tfloat rt = texture2DCompare( depths, centroidUV + texelSize * offset.yy, compare );\n\t\tvec2 f = fract( uv * size + 0.5 );\n\t\tfloat a = mix( lb, lt, f.y );\n\t\tfloat b = mix( rb, rt, f.y );\n\t\tfloat c = mix( a, b, f.x );\n\t\treturn c;\n\t}\n\tfloat getShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowBias, float shadowRadius, vec4 shadowCoord ) {\n\t\tshadowCoord.xyz /= shadowCoord.w;\n\t\tshadowCoord.z += shadowBias;\n\t\tbvec4 inFrustumVec = bvec4 ( shadowCoord.x >= 0.0, shadowCoord.x <= 1.0, shadowCoord.y >= 0.0, shadowCoord.y <= 1.0 );\n\t\tbool inFrustum = all( inFrustumVec );\n\t\tbvec2 frustumTestVec = bvec2( inFrustum, shadowCoord.z <= 1.0 );\n\t\tbool frustumTest = all( frustumTestVec );\n\t\tif ( frustumTest ) {\n\t\t#if defined( SHADOWMAP_TYPE_PCF )\n\t\t\tvec2 texelSize = vec2( 1.0 ) / shadowMapSize;\n\t\t\tfloat dx0 = - texelSize.x * shadowRadius;\n\t\t\tfloat dy0 = - texelSize.y * shadowRadius;\n\t\t\tfloat dx1 = + texelSize.x * shadowRadius;\n\t\t\tfloat dy1 = + texelSize.y * shadowRadius;\n\t\t\treturn (\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy1 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy1 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy1 ), shadowCoord.z )\n\t\t\t) * ( 1.0 / 9.0 );\n\t\t#elif defined( SHADOWMAP_TYPE_PCF_SOFT )\n\t\t\tvec2 texelSize = vec2( 1.0 ) / shadowMapSize;\n\t\t\tfloat dx0 = - texelSize.x * shadowRadius;\n\t\t\tfloat dy0 = - texelSize.y * shadowRadius;\n\t\t\tfloat dx1 = + texelSize.x * shadowRadius;\n\t\t\tfloat dy1 = + texelSize.y * shadowRadius;\n\t\t\treturn (\n\t\t\t\ttexture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy + vec2( dx0, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy + vec2( 0.0, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy + vec2( dx1, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy + vec2( dx0, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy, shadowCoord.z ) +\n\t\t\t\ttexture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy + vec2( dx1, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy + vec2( dx0, dy1 ), shadowCoord.z ) +\n\t\t\t\ttexture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy + vec2( 0.0, dy1 ), shadowCoord.z ) +\n\t\t\t\ttexture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy + vec2( dx1, dy1 ), shadowCoord.z )\n\t\t\t) * ( 1.0 / 9.0 );\n\t\t#else\n\t\t\treturn texture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z );\n\t\t#endif\n\t\t}\n\t\treturn 1.0;\n\t}\n\tvec2 cubeToUV( vec3 v, float texelSizeY ) {\n\t\tvec3 absV = abs( v );\n\t\tfloat scaleToCube = 1.0 / max( absV.x, max( absV.y, absV.z ) );\n\t\tabsV *= scaleToCube;\n\t\tv *= scaleToCube * ( 1.0 - 2.0 * texelSizeY );\n\t\tvec2 planar = v.xy;\n\t\tfloat almostATexel = 1.5 * texelSizeY;\n\t\tfloat almostOne = 1.0 - almostATexel;\n\t\tif ( absV.z >= almostOne ) {\n\t\t\tif ( v.z > 0.0 )\n\t\t\t\tplanar.x = 4.0 - v.x;\n\t\t} else if ( absV.x >= almostOne ) {\n\t\t\tfloat signX = sign( v.x );\n\t\t\tplanar.x = v.z * signX + 2.0 * signX;\n\t\t} else if ( absV.y >= almostOne ) {\n\t\t\tfloat signY = sign( v.y );\n\t\t\tplanar.x = v.x + 2.0 * signY + 2.0;\n\t\t\tplanar.y = v.z * signY - 2.0;\n\t\t}\n\t\treturn vec2( 0.125, 0.25 ) * planar + vec2( 0.375, 0.75 );\n\t}\n\tfloat getPointShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowBias, float shadowRadius, vec4 shadowCoord ) {\n\t\tvec2 texelSize = vec2( 1.0 ) / ( shadowMapSize * vec2( 4.0, 2.0 ) );\n\t\tvec3 lightToPosition = shadowCoord.xyz;\n\t\tvec3 bd3D = normalize( lightToPosition );\n\t\tfloat dp = ( length( lightToPosition ) - shadowBias ) / 1000.0;\n\t\t#if defined( SHADOWMAP_TYPE_PCF ) || defined( SHADOWMAP_TYPE_PCF_SOFT )\n\t\t\tvec2 offset = vec2( - 1, 1 ) * shadowRadius * texelSize.y;\n\t\t\treturn (\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyy, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyy, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyx, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyx, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxy, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxy, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxx, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxx, texelSize.y ), dp )\n\t\t\t) * ( 1.0 / 9.0 );\n\t\t#else\n\t\t\treturn texture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp );\n\t\t#endif\n\t}\n#endif\n",shadowmap_pars_vertex:"#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHTS > 0\n\t\tuniform mat4 directionalShadowMatrix[ NUM_DIR_LIGHTS ];\n\t\tvarying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHTS ];\n\t#endif\n\t#if NUM_SPOT_LIGHTS > 0\n\t\tuniform mat4 spotShadowMatrix[ NUM_SPOT_LIGHTS ];\n\t\tvarying vec4 vSpotShadowCoord[ NUM_SPOT_LIGHTS ];\n\t#endif\n\t#if NUM_POINT_LIGHTS > 0\n\t\tuniform mat4 pointShadowMatrix[ NUM_POINT_LIGHTS ];\n\t\tvarying vec4 vPointShadowCoord[ NUM_POINT_LIGHTS ];\n\t#endif\n#endif\n",shadowmap_vertex:"#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHTS > 0\n\tfor ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {\n\t\tvDirectionalShadowCoord[ i ] = directionalShadowMatrix[ i ] * worldPosition;\n\t}\n\t#endif\n\t#if NUM_SPOT_LIGHTS > 0\n\tfor ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {\n\t\tvSpotShadowCoord[ i ] = spotShadowMatrix[ i ] * worldPosition;\n\t}\n\t#endif\n\t#if NUM_POINT_LIGHTS > 0\n\tfor ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {\n\t\tvPointShadowCoord[ i ] = pointShadowMatrix[ i ] * worldPosition;\n\t}\n\t#endif\n#endif\n",shadowmask_pars_fragment:"float getShadowMask() {\n\tfloat shadow = 1.0;\n\t#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHTS > 0\n\tDirectionalLight directionalLight;\n\tfor ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {\n\t\tdirectionalLight = directionalLights[ i ];\n\t\tshadow *= bool( directionalLight.shadow ) ? getShadow( directionalShadowMap[ i ], directionalLight.shadowMapSize, directionalLight.shadowBias, directionalLight.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;\n\t}\n\t#endif\n\t#if NUM_SPOT_LIGHTS > 0\n\tSpotLight spotLight;\n\tfor ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {\n\t\tspotLight = spotLights[ i ];\n\t\tshadow *= bool( spotLight.shadow ) ? getShadow( spotShadowMap[ i ], spotLight.shadowMapSize, spotLight.shadowBias, spotLight.shadowRadius, vSpotShadowCoord[ i ] ) : 1.0;\n\t}\n\t#endif\n\t#if NUM_POINT_LIGHTS > 0\n\tPointLight pointLight;\n\tfor ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {\n\t\tpointLight = pointLights[ i ];\n\t\tshadow *= bool( pointLight.shadow ) ? getPointShadow( pointShadowMap[ i ], pointLight.shadowMapSize, pointLight.shadowBias, pointLight.shadowRadius, vPointShadowCoord[ i ] ) : 1.0;\n\t}\n\t#endif\n\t#endif\n\treturn shadow;\n}\n",skinbase_vertex:"#ifdef USE_SKINNING\n\tmat4 boneMatX = getBoneMatrix( skinIndex.x );\n\tmat4 boneMatY = getBoneMatrix( skinIndex.y );\n\tmat4 boneMatZ = getBoneMatrix( skinIndex.z );\n\tmat4 boneMatW = getBoneMatrix( skinIndex.w );\n#endif",skinning_pars_vertex:"#ifdef USE_SKINNING\n\tuniform mat4 bindMatrix;\n\tuniform mat4 bindMatrixInverse;\n\t#ifdef BONE_TEXTURE\n\t\tuniform sampler2D boneTexture;\n\t\tuniform int boneTextureSize;\n\t\tmat4 getBoneMatrix( const in float i ) {\n\t\t\tfloat j = i * 4.0;\n\t\t\tfloat x = mod( j, float( boneTextureSize ) );\n\t\t\tfloat y = floor( j / float( boneTextureSize ) );\n\t\t\tfloat dx = 1.0 / float( boneTextureSize );\n\t\t\tfloat dy = 1.0 / float( boneTextureSize );\n\t\t\ty = dy * ( y + 0.5 );\n\t\t\tvec4 v1 = texture2D( boneTexture, vec2( dx * ( x + 0.5 ), y ) );\n\t\t\tvec4 v2 = texture2D( boneTexture, vec2( dx * ( x + 1.5 ), y ) );\n\t\t\tvec4 v3 = texture2D( boneTexture, vec2( dx * ( x + 2.5 ), y ) );\n\t\t\tvec4 v4 = texture2D( boneTexture, vec2( dx * ( x + 3.5 ), y ) );\n\t\t\tmat4 bone = mat4( v1, v2, v3, v4 );\n\t\t\treturn bone;\n\t\t}\n\t#else\n\t\tuniform mat4 boneMatrices[ MAX_BONES ];\n\t\tmat4 getBoneMatrix( const in float i ) {\n\t\t\tmat4 bone = boneMatrices[ int(i) ];\n\t\t\treturn bone;\n\t\t}\n\t#endif\n#endif\n",skinning_vertex:"#ifdef USE_SKINNING\n\tvec4 skinVertex = bindMatrix * vec4( transformed, 1.0 );\n\tvec4 skinned = vec4( 0.0 );\n\tskinned += boneMatX * skinVertex * skinWeight.x;\n\tskinned += boneMatY * skinVertex * skinWeight.y;\n\tskinned += boneMatZ * skinVertex * skinWeight.z;\n\tskinned += boneMatW * skinVertex * skinWeight.w;\n\tskinned = bindMatrixInverse * skinned;\n#endif\n",skinnormal_vertex:"#ifdef USE_SKINNING\n\tmat4 skinMatrix = mat4( 0.0 );\n\tskinMatrix += skinWeight.x * boneMatX;\n\tskinMatrix += skinWeight.y * boneMatY;\n\tskinMatrix += skinWeight.z * boneMatZ;\n\tskinMatrix += skinWeight.w * boneMatW;\n\tskinMatrix = bindMatrixInverse * skinMatrix * bindMatrix;\n\tobjectNormal = vec4( skinMatrix * vec4( objectNormal, 0.0 ) ).xyz;\n#endif\n",specularmap_fragment:"float specularStrength;\n#ifdef USE_SPECULARMAP\n\tvec4 texelSpecular = texture2D( specularMap, vUv );\n\tspecularStrength = texelSpecular.r;\n#else\n\tspecularStrength = 1.0;\n#endif",specularmap_pars_fragment:"#ifdef USE_SPECULARMAP\n\tuniform sampler2D specularMap;\n#endif",tonemapping_fragment:"#if defined( TONE_MAPPING )\n gl_FragColor.rgb = toneMapping( gl_FragColor.rgb );\n#endif\n",tonemapping_pars_fragment:"#define saturate(a) clamp( a, 0.0, 1.0 )\nuniform float toneMappingExposure;\nuniform float toneMappingWhitePoint;\nvec3 LinearToneMapping( vec3 color ) {\n\treturn toneMappingExposure * color;\n}\nvec3 ReinhardToneMapping( vec3 color ) {\n\tcolor *= toneMappingExposure;\n\treturn saturate( color / ( vec3( 1.0 ) + color ) );\n}\n#define Uncharted2Helper( x ) max( ( ( x * ( 0.15 * x + 0.10 * 0.50 ) + 0.20 * 0.02 ) / ( x * ( 0.15 * x + 0.50 ) + 0.20 * 0.30 ) ) - 0.02 / 0.30, vec3( 0.0 ) )\nvec3 Uncharted2ToneMapping( vec3 color ) {\n\tcolor *= toneMappingExposure;\n\treturn saturate( Uncharted2Helper( color ) / Uncharted2Helper( vec3( toneMappingWhitePoint ) ) );\n}\nvec3 OptimizedCineonToneMapping( vec3 color ) {\n\tcolor *= toneMappingExposure;\n\tcolor = max( vec3( 0.0 ), color - 0.004 );\n\treturn pow( ( color * ( 6.2 * color + 0.5 ) ) / ( color * ( 6.2 * color + 1.7 ) + 0.06 ), vec3( 2.2 ) );\n}\n",uv_pars_fragment:"#if defined( USE_MAP ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( USE_SPECULARMAP ) || defined( USE_ALPHAMAP ) || defined( USE_EMISSIVEMAP ) || defined( USE_ROUGHNESSMAP ) || defined( USE_METALNESSMAP )\n\tvarying vec2 vUv;\n#endif",uv_pars_vertex:"#if defined( USE_MAP ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( USE_SPECULARMAP ) || defined( USE_ALPHAMAP ) || defined( USE_EMISSIVEMAP ) || defined( USE_ROUGHNESSMAP ) || defined( USE_METALNESSMAP )\n\tvarying vec2 vUv;\n\tuniform vec4 offsetRepeat;\n#endif\n",uv_vertex:"#if defined( USE_MAP ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( USE_SPECULARMAP ) || defined( USE_ALPHAMAP ) || defined( USE_EMISSIVEMAP ) || defined( USE_ROUGHNESSMAP ) || defined( USE_METALNESSMAP )\n\tvUv = uv * offsetRepeat.zw + offsetRepeat.xy;\n#endif",uv2_pars_fragment:"#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP )\n\tvarying vec2 vUv2;\n#endif",uv2_pars_vertex:"#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP )\n\tattribute vec2 uv2;\n\tvarying vec2 vUv2;\n#endif",uv2_vertex:"#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP )\n\tvUv2 = uv2;\n#endif",worldpos_vertex:"#if defined( USE_ENVMAP ) || defined( PHONG ) || defined( PHYSICAL ) || defined( LAMBERT ) || defined ( USE_SHADOWMAP )\n\t#ifdef USE_SKINNING\n\t\tvec4 worldPosition = modelMatrix * skinned;\n\t#else\n\t\tvec4 worldPosition = modelMatrix * vec4( transformed, 1.0 );\n\t#endif\n#endif\n",cube_frag:"uniform samplerCube tCube;\nuniform float tFlip;\nuniform float opacity;\nvarying vec3 vWorldPosition;\n#include <common>\nvoid main() {\n\tgl_FragColor = textureCube( tCube, vec3( tFlip * vWorldPosition.x, vWorldPosition.yz ) );\n\tgl_FragColor.a *= opacity;\n}\n",cube_vert:"varying vec3 vWorldPosition;\n#include <common>\nvoid main() {\n\tvWorldPosition = transformDirection( position, modelMatrix );\n\t#include <begin_vertex>\n\t#include <project_vertex>\n}\n",depth_frag:"#if DEPTH_PACKING == 3200\n\tuniform float opacity;\n#endif\n#include <common>\n#include <packing>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tvec4 diffuseColor = vec4( 1.0 );\n\t#if DEPTH_PACKING == 3200\n\t\tdiffuseColor.a = opacity;\n\t#endif\n\t#include <map_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <logdepthbuf_fragment>\n\t#if DEPTH_PACKING == 3200\n\t\tgl_FragColor = vec4( vec3( gl_FragCoord.z ), opacity );\n\t#elif DEPTH_PACKING == 3201\n\t\tgl_FragColor = packDepthToRGBA( gl_FragCoord.z );\n\t#endif\n}\n",depth_vert:"#include <common>\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <skinbase_vertex>\n\t#include <begin_vertex>\n\t#include <displacementmap_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n}\n",distanceRGBA_frag:"uniform vec3 lightPos;\nvarying vec4 vWorldPosition;\n#include <common>\n#include <packing>\n#include <clipping_planes_pars_fragment>\nvoid main () {\n\t#include <clipping_planes_fragment>\n\tgl_FragColor = packDepthToRGBA( length( vWorldPosition.xyz - lightPos.xyz ) / 1000.0 );\n}\n",distanceRGBA_vert:"varying vec4 vWorldPosition;\n#include <common>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <skinbase_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <project_vertex>\n\t#include <worldpos_vertex>\n\t#include <clipping_planes_vertex>\n\tvWorldPosition = worldPosition;\n}\n",equirect_frag:"uniform sampler2D tEquirect;\nuniform float tFlip;\nvarying vec3 vWorldPosition;\n#include <common>\nvoid main() {\n\tvec3 direction = normalize( vWorldPosition );\n\tvec2 sampleUV;\n\tsampleUV.y = saturate( tFlip * direction.y * -0.5 + 0.5 );\n\tsampleUV.x = atan( direction.z, direction.x ) * RECIPROCAL_PI2 + 0.5;\n\tgl_FragColor = texture2D( tEquirect, sampleUV );\n}\n",equirect_vert:"varying vec3 vWorldPosition;\n#include <common>\nvoid main() {\n\tvWorldPosition = transformDirection( position, modelMatrix );\n\t#include <begin_vertex>\n\t#include <project_vertex>\n}\n",linedashed_frag:"uniform vec3 diffuse;\nuniform float opacity;\nuniform float dashSize;\nuniform float totalSize;\nvarying float vLineDistance;\n#include <common>\n#include <color_pars_fragment>\n#include <fog_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tif ( mod( vLineDistance, totalSize ) > dashSize ) {\n\t\tdiscard;\n\t}\n\tvec3 outgoingLight = vec3( 0.0 );\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <logdepthbuf_fragment>\n\t#include <color_fragment>\n\toutgoingLight = diffuseColor.rgb;\n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include <premultiplied_alpha_fragment>\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n}\n",linedashed_vert:"uniform float scale;\nattribute float lineDistance;\nvarying float vLineDistance;\n#include <common>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <color_vertex>\n\tvLineDistance = scale * lineDistance;\n\tvec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );\n\tgl_Position = projectionMatrix * mvPosition;\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\t#include <fog_vertex>\n}\n",meshbasic_frag:"uniform vec3 diffuse;\nuniform float opacity;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\n#include <common>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <uv2_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <envmap_pars_fragment>\n#include <fog_pars_fragment>\n#include <specularmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <specularmap_fragment>\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\t#ifdef USE_LIGHTMAP\n\t\treflectedLight.indirectDiffuse += texture2D( lightMap, vUv2 ).xyz * lightMapIntensity;\n\t#else\n\t\treflectedLight.indirectDiffuse += vec3( 1.0 );\n\t#endif\n\t#include <aomap_fragment>\n\treflectedLight.indirectDiffuse *= diffuseColor.rgb;\n\tvec3 outgoingLight = reflectedLight.indirectDiffuse;\n\t#include <normal_flip>\n\t#include <envmap_fragment>\n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include <premultiplied_alpha_fragment>\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n}\n",meshbasic_vert:"#include <common>\n#include <uv_pars_vertex>\n#include <uv2_pars_vertex>\n#include <envmap_pars_vertex>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <uv2_vertex>\n\t#include <color_vertex>\n\t#include <skinbase_vertex>\n\t#ifdef USE_ENVMAP\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n\t#endif\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <worldpos_vertex>\n\t#include <clipping_planes_vertex>\n\t#include <envmap_vertex>\n\t#include <fog_vertex>\n}\n",meshlambert_frag:"uniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float opacity;\nvarying vec3 vLightFront;\n#ifdef DOUBLE_SIDED\n\tvarying vec3 vLightBack;\n#endif\n#include <common>\n#include <packing>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <uv2_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <emissivemap_pars_fragment>\n#include <envmap_pars_fragment>\n#include <bsdfs>\n#include <lights_pars>\n#include <fog_pars_fragment>\n#include <shadowmap_pars_fragment>\n#include <shadowmask_pars_fragment>\n#include <specularmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <specularmap_fragment>\n\t#include <emissivemap_fragment>\n\treflectedLight.indirectDiffuse = getAmbientLightIrradiance( ambientLightColor );\n\t#include <lightmap_fragment>\n\treflectedLight.indirectDiffuse *= BRDF_Diffuse_Lambert( diffuseColor.rgb );\n\t#ifdef DOUBLE_SIDED\n\t\treflectedLight.directDiffuse = ( gl_FrontFacing ) ? vLightFront : vLightBack;\n\t#else\n\t\treflectedLight.directDiffuse = vLightFront;\n\t#endif\n\treflectedLight.directDiffuse *= BRDF_Diffuse_Lambert( diffuseColor.rgb ) * getShadowMask();\n\t#include <aomap_fragment>\n\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;\n\t#include <normal_flip>\n\t#include <envmap_fragment>\n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n\t#include <dithering_fragment>\n}\n",meshlambert_vert:"#define LAMBERT\nvarying vec3 vLightFront;\n#ifdef DOUBLE_SIDED\n\tvarying vec3 vLightBack;\n#endif\n#include <common>\n#include <uv_pars_vertex>\n#include <uv2_pars_vertex>\n#include <envmap_pars_vertex>\n#include <bsdfs>\n#include <lights_pars>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <shadowmap_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <uv2_vertex>\n\t#include <color_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\t#include <worldpos_vertex>\n\t#include <envmap_vertex>\n\t#include <lights_lambert_vertex>\n\t#include <shadowmap_vertex>\n\t#include <fog_vertex>\n}\n",meshphong_frag:"#define PHONG\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform vec3 specular;\nuniform float shininess;\nuniform float opacity;\n#include <common>\n#include <packing>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <uv2_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <emissivemap_pars_fragment>\n#include <envmap_pars_fragment>\n#include <gradientmap_pars_fragment>\n#include <fog_pars_fragment>\n#include <bsdfs>\n#include <lights_pars>\n#include <lights_phong_pars_fragment>\n#include <shadowmap_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <specularmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <specularmap_fragment>\n\t#include <normal_flip>\n\t#include <normal_fragment>\n\t#include <emissivemap_fragment>\n\t#include <lights_phong_fragment>\n\t#include <lights_template>\n\t#include <aomap_fragment>\n\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveRadiance;\n\t#include <envmap_fragment>\n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n\t#include <dithering_fragment>\n}\n",meshphong_vert:"#define PHONG\nvarying vec3 vViewPosition;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\n#include <common>\n#include <uv_pars_vertex>\n#include <uv2_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <envmap_pars_vertex>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <shadowmap_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <uv2_vertex>\n\t#include <color_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n#ifndef FLAT_SHADED\n\tvNormal = normalize( transformedNormal );\n#endif\n\t#include <begin_vertex>\n\t#include <displacementmap_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\tvViewPosition = - mvPosition.xyz;\n\t#include <worldpos_vertex>\n\t#include <envmap_vertex>\n\t#include <shadowmap_vertex>\n\t#include <fog_vertex>\n}\n",meshphysical_frag:"#define PHYSICAL\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float roughness;\nuniform float metalness;\nuniform float opacity;\n#ifndef STANDARD\n\tuniform float clearCoat;\n\tuniform float clearCoatRoughness;\n#endif\nvarying vec3 vViewPosition;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\n#include <common>\n#include <packing>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <uv2_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <emissivemap_pars_fragment>\n#include <envmap_pars_fragment>\n#include <fog_pars_fragment>\n#include <bsdfs>\n#include <cube_uv_reflection_fragment>\n#include <lights_pars>\n#include <lights_physical_pars_fragment>\n#include <shadowmap_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <roughnessmap_pars_fragment>\n#include <metalnessmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <specularmap_fragment>\n\t#include <roughnessmap_fragment>\n\t#include <metalnessmap_fragment>\n\t#include <normal_flip>\n\t#include <normal_fragment>\n\t#include <emissivemap_fragment>\n\t#include <lights_physical_fragment>\n\t#include <lights_template>\n\t#include <aomap_fragment>\n\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveRadiance;\n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n\t#include <dithering_fragment>\n}\n",meshphysical_vert:"#define PHYSICAL\nvarying vec3 vViewPosition;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\n#include <common>\n#include <uv_pars_vertex>\n#include <uv2_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <shadowmap_pars_vertex>\n#include <specularmap_pars_fragment>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <uv2_vertex>\n\t#include <color_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n#ifndef FLAT_SHADED\n\tvNormal = normalize( transformedNormal );\n#endif\n\t#include <begin_vertex>\n\t#include <displacementmap_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\tvViewPosition = - mvPosition.xyz;\n\t#include <worldpos_vertex>\n\t#include <shadowmap_vertex>\n\t#include <fog_vertex>\n}\n",normal_frag:"#define NORMAL\nuniform float opacity;\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP )\n\tvarying vec3 vViewPosition;\n#endif\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\n#include <packing>\n#include <uv_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\nvoid main() {\n\t#include <logdepthbuf_fragment>\n\t#include <normal_flip>\n\t#include <normal_fragment>\n\tgl_FragColor = vec4( packNormalToRGB( normal ), opacity );\n}\n",normal_vert:"#define NORMAL\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP )\n\tvarying vec3 vViewPosition;\n#endif\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <logdepthbuf_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n#ifndef FLAT_SHADED\n\tvNormal = normalize( transformedNormal );\n#endif\n\t#include <begin_vertex>\n\t#include <displacementmap_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP )\n\tvViewPosition = - mvPosition.xyz;\n#endif\n}\n",points_frag:"uniform vec3 diffuse;\nuniform float opacity;\n#include <common>\n#include <packing>\n#include <color_pars_fragment>\n#include <map_particle_pars_fragment>\n#include <fog_pars_fragment>\n#include <shadowmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tvec3 outgoingLight = vec3( 0.0 );\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <logdepthbuf_fragment>\n\t#include <map_particle_fragment>\n\t#include <color_fragment>\n\t#include <alphatest_fragment>\n\toutgoingLight = diffuseColor.rgb;\n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include <premultiplied_alpha_fragment>\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n}\n",points_vert:"uniform float size;\nuniform float scale;\n#include <common>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <shadowmap_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <color_vertex>\n\t#include <begin_vertex>\n\t#include <project_vertex>\n\t#ifdef USE_SIZEATTENUATION\n\t\tgl_PointSize = size * ( scale / - mvPosition.z );\n\t#else\n\t\tgl_PointSize = size;\n\t#endif\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\t#include <worldpos_vertex>\n\t#include <shadowmap_vertex>\n\t#include <fog_vertex>\n}\n",shadow_frag:"uniform float opacity;\n#include <common>\n#include <packing>\n#include <bsdfs>\n#include <lights_pars>\n#include <shadowmap_pars_fragment>\n#include <shadowmask_pars_fragment>\nvoid main() {\n\tgl_FragColor = vec4( 0.0, 0.0, 0.0, opacity * ( 1.0 - getShadowMask() ) );\n}\n",shadow_vert:"#include <shadowmap_pars_vertex>\nvoid main() {\n\t#include <begin_vertex>\n\t#include <project_vertex>\n\t#include <worldpos_vertex>\n\t#include <shadowmap_vertex>\n}\n"},Dn={basic:{uniforms:Nn.merge([Un.common,Un.aomap,Un.lightmap,Un.fog]),vertexShader:On.meshbasic_vert,fragmentShader:On.meshbasic_frag},lambert:{uniforms:Nn.merge([Un.common,Un.aomap,Un.lightmap,Un.emissivemap,Un.fog,Un.lights,{emissive:{value:new In(0)}}]),vertexShader:On.meshlambert_vert,fragmentShader:On.meshlambert_frag},phong:{uniforms:Nn.merge([Un.common,Un.aomap,Un.lightmap,Un.emissivemap,Un.bumpmap,Un.normalmap,Un.displacementmap,Un.gradientmap,Un.fog,Un.lights,{emissive:{value:new In(0)},specular:{value:new In(1118481)},shininess:{value:30}}]),vertexShader:On.meshphong_vert,fragmentShader:On.meshphong_frag},standard:{uniforms:Nn.merge([Un.common,Un.aomap,Un.lightmap,Un.emissivemap,Un.bumpmap,Un.normalmap,Un.displacementmap,Un.roughnessmap,Un.metalnessmap,Un.fog,Un.lights,{emissive:{value:new In(0)},roughness:{value:.5},metalness:{value:.5},envMapIntensity:{value:1}}]),vertexShader:On.meshphysical_vert,fragmentShader:On.meshphysical_frag},points:{uniforms:Nn.merge([Un.points,Un.fog]),vertexShader:On.points_vert,fragmentShader:On.points_frag},dashed:{uniforms:Nn.merge([Un.common,Un.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:On.linedashed_vert,fragmentShader:On.linedashed_frag},depth:{uniforms:Nn.merge([Un.common,Un.displacementmap]),vertexShader:On.depth_vert,fragmentShader:On.depth_frag},normal:{uniforms:Nn.merge([Un.common,Un.bumpmap,Un.normalmap,Un.displacementmap,{opacity:{value:1}}]),vertexShader:On.normal_vert,fragmentShader:On.normal_frag},cube:{uniforms:{tCube:{value:null},tFlip:{value:-1},opacity:{value:1}},vertexShader:On.cube_vert,fragmentShader:On.cube_frag},equirect:{uniforms:{tEquirect:{value:null},tFlip:{value:-1}},vertexShader:On.equirect_vert,fragmentShader:On.equirect_frag},distanceRGBA:{uniforms:{lightPos:{value:new He}},vertexShader:On.distanceRGBA_vert,fragmentShader:On.distanceRGBA_frag}};function Fn(t,e){this.min=void 0!==t?t:new Le(1/0,1/0),this.max=void 0!==e?e:new Le(-1/0,-1/0)}function Bn(t,e){var n,i,r,o,a,s,c,h,u=t.context,l=t.state;function d(){var e=new Float32Array([-1,-1,0,0,1,-1,1,0,1,1,1,1,-1,1,0,1]),d=new Uint16Array([0,1,2,0,2,3]);n=u.createBuffer(),i=u.createBuffer(),u.bindBuffer(u.ARRAY_BUFFER,n),u.bufferData(u.ARRAY_BUFFER,e,u.STATIC_DRAW),u.bindBuffer(u.ELEMENT_ARRAY_BUFFER,i),u.bufferData(u.ELEMENT_ARRAY_BUFFER,d,u.STATIC_DRAW),c=u.createTexture(),h=u.createTexture(),l.bindTexture(u.TEXTURE_2D,c),u.texImage2D(u.TEXTURE_2D,0,u.RGB,16,16,0,u.RGB,u.UNSIGNED_BYTE,null),u.texParameteri(u.TEXTURE_2D,u.TEXTURE_WRAP_S,u.CLAMP_TO_EDGE),u.texParameteri(u.TEXTURE_2D,u.TEXTURE_WRAP_T,u.CLAMP_TO_EDGE),u.texParameteri(u.TEXTURE_2D,u.TEXTURE_MAG_FILTER,u.NEAREST),u.texParameteri(u.TEXTURE_2D,u.TEXTURE_MIN_FILTER,u.NEAREST),l.bindTexture(u.TEXTURE_2D,h),u.texImage2D(u.TEXTURE_2D,0,u.RGBA,16,16,0,u.RGBA,u.UNSIGNED_BYTE,null),u.texParameteri(u.TEXTURE_2D,u.TEXTURE_WRAP_S,u.CLAMP_TO_EDGE),u.texParameteri(u.TEXTURE_2D,u.TEXTURE_WRAP_T,u.CLAMP_TO_EDGE),u.texParameteri(u.TEXTURE_2D,u.TEXTURE_MAG_FILTER,u.NEAREST),u.texParameteri(u.TEXTURE_2D,u.TEXTURE_MIN_FILTER,u.NEAREST),r={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")},o=function(e){var n=u.createProgram(),i=u.createShader(u.FRAGMENT_SHADER),r=u.createShader(u.VERTEX_SHADER),o="precision "+t.getPrecision()+" float;\n";return u.shaderSource(i,o+e.fragmentShader),u.shaderSource(r,o+e.vertexShader),u.compileShader(i),u.compileShader(r),u.attachShader(n,i),u.attachShader(n,r),u.linkProgram(n),n}(r),a={vertex:u.getAttribLocation(o,"position"),uv:u.getAttribLocation(o,"uv")},s={renderType:u.getUniformLocation(o,"renderType"),map:u.getUniformLocation(o,"map"),occlusionMap:u.getUniformLocation(o,"occlusionMap"),opacity:u.getUniformLocation(o,"opacity"),color:u.getUniformLocation(o,"color"),scale:u.getUniformLocation(o,"scale"),rotation:u.getUniformLocation(o,"rotation"),screenPosition:u.getUniformLocation(o,"screenPosition")}}this.render=function(r,p,f){if(0!==e.length){var m=new He,g=f.w/f.z,v=.5*f.z,y=.5*f.w,x=16/f.w,b=new Le(x*g,x),_=new He(1,1,0),w=new Le(1,1),M=new Fn;M.min.set(f.x,f.y),M.max.set(f.x+(f.z-16),f.y+(f.w-16)),void 0===o&&d(),u.useProgram(o),l.initAttributes(),l.enableAttribute(a.vertex),l.enableAttribute(a.uv),l.disableUnusedAttributes(),u.uniform1i(s.occlusionMap,0),u.uniform1i(s.map,1),u.bindBuffer(u.ARRAY_BUFFER,n),u.vertexAttribPointer(a.vertex,2,u.FLOAT,!1,16,0),u.vertexAttribPointer(a.uv,2,u.FLOAT,!1,16,8),u.bindBuffer(u.ELEMENT_ARRAY_BUFFER,i),l.disable(u.CULL_FACE),l.buffers.depth.setMask(!1);for(var E=0,T=e.length;E<T;E++){x=16/f.w,b.set(x*g,x);var S=e[E];if(m.set(S.matrixWorld.elements[12],S.matrixWorld.elements[13],S.matrixWorld.elements[14]),m.applyMatrix4(p.matrixWorldInverse),m.applyMatrix4(p.projectionMatrix),_.copy(m),w.x=f.x+_.x*v+v-8,w.y=f.y+_.y*y+y-8,!0===M.containsPoint(w)){l.activeTexture(u.TEXTURE0),l.bindTexture(u.TEXTURE_2D,null),l.activeTexture(u.TEXTURE1),l.bindTexture(u.TEXTURE_2D,c),u.copyTexImage2D(u.TEXTURE_2D,0,u.RGB,w.x,w.y,16,16,0),u.uniform1i(s.renderType,0),u.uniform2f(s.scale,b.x,b.y),u.uniform3f(s.screenPosition,_.x,_.y,_.z),l.disable(u.BLEND),l.enable(u.DEPTH_TEST),u.drawElements(u.TRIANGLES,6,u.UNSIGNED_SHORT,0),l.activeTexture(u.TEXTURE0),l.bindTexture(u.TEXTURE_2D,h),u.copyTexImage2D(u.TEXTURE_2D,0,u.RGBA,w.x,w.y,16,16,0),u.uniform1i(s.renderType,1),l.disable(u.DEPTH_TEST),l.activeTexture(u.TEXTURE1),l.bindTexture(u.TEXTURE_2D,c),u.drawElements(u.TRIANGLES,6,u.UNSIGNED_SHORT,0),S.positionScreen.copy(_),S.customUpdateCallback?S.customUpdateCallback(S):S.updateLensFlares(),u.uniform1i(s.renderType,2),l.enable(u.BLEND);for(var A=0,L=S.lensFlares.length;A<L;A++){var R=S.lensFlares[A];R.opacity>.001&&R.scale>.001&&(_.x=R.x,_.y=R.y,_.z=R.z,x=R.size*R.scale/f.w,b.x=x*g,b.y=x,u.uniform3f(s.screenPosition,_.x,_.y,_.z),u.uniform2f(s.scale,b.x,b.y),u.uniform1f(s.rotation,R.rotation),u.uniform1f(s.opacity,R.opacity),u.uniform3f(s.color,R.color.r,R.color.g,R.color.b),l.setBlending(R.blending,R.blendEquation,R.blendSrc,R.blendDst),t.setTexture2D(R.texture,1),u.drawElements(u.TRIANGLES,6,u.UNSIGNED_SHORT,0))}}}l.enable(u.CULL_FACE),l.enable(u.DEPTH_TEST),l.buffers.depth.setMask(!0),t.resetGLState()}}}function zn(t,e){var n,i,r,o,a,s,c=t.context,h=t.state,u=new He,l=new Ge,d=new He;function p(){var e=new Float32Array([-.5,-.5,0,0,.5,-.5,1,0,.5,.5,1,1,-.5,.5,0,1]),h=new Uint16Array([0,1,2,0,2,3]);n=c.createBuffer(),i=c.createBuffer(),c.bindBuffer(c.ARRAY_BUFFER,n),c.bufferData(c.ARRAY_BUFFER,e,c.STATIC_DRAW),c.bindBuffer(c.ELEMENT_ARRAY_BUFFER,i),c.bufferData(c.ELEMENT_ARRAY_BUFFER,h,c.STATIC_DRAW),r=function(){var e=c.createProgram(),n=c.createShader(c.VERTEX_SHADER),i=c.createShader(c.FRAGMENT_SHADER);return c.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")),c.shaderSource(i,["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")),c.compileShader(n),c.compileShader(i),c.attachShader(e,n),c.attachShader(e,i),c.linkProgram(e),e}(),o={position:c.getAttribLocation(r,"position"),uv:c.getAttribLocation(r,"uv")},a={uvOffset:c.getUniformLocation(r,"uvOffset"),uvScale:c.getUniformLocation(r,"uvScale"),rotation:c.getUniformLocation(r,"rotation"),scale:c.getUniformLocation(r,"scale"),color:c.getUniformLocation(r,"color"),map:c.getUniformLocation(r,"map"),opacity:c.getUniformLocation(r,"opacity"),modelViewMatrix:c.getUniformLocation(r,"modelViewMatrix"),projectionMatrix:c.getUniformLocation(r,"projectionMatrix"),fogType:c.getUniformLocation(r,"fogType"),fogDensity:c.getUniformLocation(r,"fogDensity"),fogNear:c.getUniformLocation(r,"fogNear"),fogFar:c.getUniformLocation(r,"fogFar"),fogColor:c.getUniformLocation(r,"fogColor"),alphaTest:c.getUniformLocation(r,"alphaTest")};var u=document.createElementNS("http://www.w3.org/1999/xhtml","canvas");u.width=8,u.height=8;var l=u.getContext("2d");l.fillStyle="white",l.fillRect(0,0,8,8),(s=new De(u)).needsUpdate=!0}function f(t,e){return t.renderOrder!==e.renderOrder?t.renderOrder-e.renderOrder:t.z!==e.z?e.z-t.z:e.id-t.id}this.render=function(m,g){if(0!==e.length){void 0===r&&p(),c.useProgram(r),h.initAttributes(),h.enableAttribute(o.position),h.enableAttribute(o.uv),h.disableUnusedAttributes(),h.disable(c.CULL_FACE),h.enable(c.BLEND),c.bindBuffer(c.ARRAY_BUFFER,n),c.vertexAttribPointer(o.position,2,c.FLOAT,!1,16,0),c.vertexAttribPointer(o.uv,2,c.FLOAT,!1,16,8),c.bindBuffer(c.ELEMENT_ARRAY_BUFFER,i),c.uniformMatrix4fv(a.projectionMatrix,!1,g.projectionMatrix.elements),h.activeTexture(c.TEXTURE0),c.uniform1i(a.map,0);var v=0,y=0,x=m.fog;x?(c.uniform3f(a.fogColor,x.color.r,x.color.g,x.color.b),x.isFog?(c.uniform1f(a.fogNear,x.near),c.uniform1f(a.fogFar,x.far),c.uniform1i(a.fogType,1),v=1,y=1):x.isFogExp2&&(c.uniform1f(a.fogDensity,x.density),c.uniform1i(a.fogType,2),v=2,y=2)):(c.uniform1i(a.fogType,0),v=0,y=0);for(var b=0,_=e.length;b<_;b++){(M=e[b]).modelViewMatrix.multiplyMatrices(g.matrixWorldInverse,M.matrixWorld),M.z=-M.modelViewMatrix.elements[14]}e.sort(f);var w=[];for(b=0,_=e.length;b<_;b++){var M,E=(M=e[b]).material;if(!1!==E.visible){c.uniform1f(a.alphaTest,E.alphaTest),c.uniformMatrix4fv(a.modelViewMatrix,!1,M.modelViewMatrix.elements),M.matrixWorld.decompose(u,l,d),w[0]=d.x,w[1]=d.y;var T=0;m.fog&&E.fog&&(T=y),v!==T&&(c.uniform1i(a.fogType,T),v=T),null!==E.map?(c.uniform2f(a.uvOffset,E.map.offset.x,E.map.offset.y),c.uniform2f(a.uvScale,E.map.repeat.x,E.map.repeat.y)):(c.uniform2f(a.uvOffset,0,0),c.uniform2f(a.uvScale,1,1)),c.uniform1f(a.opacity,E.opacity),c.uniform3f(a.color,E.color.r,E.color.g,E.color.b),c.uniform1f(a.rotation,E.rotation),c.uniform2fv(a.scale,w),h.setBlending(E.blending,E.blendEquation,E.blendSrc,E.blendDst),h.buffers.depth.setTest(E.depthTest),h.buffers.depth.setMask(E.depthWrite),E.map?t.setTexture2D(E.map,0):t.setTexture2D(s,0),c.drawElements(c.TRIANGLES,6,c.UNSIGNED_SHORT,0)}}h.enable(c.CULL_FACE),t.resetGLState()}}}Dn.physical={uniforms:Nn.merge([Dn.standard.uniforms,{clearCoat:{value:0},clearCoatRoughness:{value:0}}]),vertexShader:On.meshphysical_vert,fragmentShader:On.meshphysical_frag},Object.assign(Fn.prototype,{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 Le;return function(e,n){var i=t.copy(n).multiplyScalar(.5);return this.min.copy(e).sub(i),this.max.copy(e).add(i),this}}(),clone:function(){return(new this.constructor).copy(this)},copy:function(t){return this.min.copy(t.min),this.max.copy(t.max),this},makeEmpty:function(){return this.min.x=this.min.y=1/0,this.max.x=this.max.y=-1/0,this},isEmpty:function(){return this.max.x<this.min.x||this.max.y<this.min.y},getCenter:function(t){var e=t||new Le;return this.isEmpty()?e.set(0,0):e.addVectors(this.min,this.max).multiplyScalar(.5)},getSize:function(t){var e=t||new Le;return this.isEmpty()?e.set(0,0):e.subVectors(this.max,this.min)},expandByPoint:function(t){return this.min.min(t),this.max.max(t),this},expandByVector:function(t){return this.min.sub(t),this.max.add(t),this},expandByScalar:function(t){return this.min.addScalar(-t),this.max.addScalar(t),this},containsPoint:function(t){return!(t.x<this.min.x||t.x>this.max.x||t.y<this.min.y||t.y>this.max.y)},containsBox:function(t){return this.min.x<=t.min.x&&t.max.x<=this.max.x&&this.min.y<=t.min.y&&t.max.y<=this.max.y},getParameter:function(t,e){return(e||new Le).set((t.x-this.min.x)/(this.max.x-this.min.x),(t.y-this.min.y)/(this.max.y-this.min.y))},intersectsBox:function(t){return!(t.max.x<this.min.x||t.min.x>this.max.x||t.max.y<this.min.y||t.min.y>this.max.y)},clampPoint:function(t,e){return(e||new Le).copy(t).clamp(this.min,this.max)},distanceToPoint:function(){var t=new Le;return function(e){return t.copy(e).clamp(this.min,this.max).sub(e).length()}}(),intersect:function(t){return this.min.max(t.min),this.max.min(t.max),this},union:function(t){return this.min.min(t.min),this.max.max(t.max),this},translate:function(t){return this.min.add(t),this.max.add(t),this},equals:function(t){return t.min.equals(this.min)&&t.max.equals(this.max)}});var Gn,Hn,Vn,kn,jn,Wn,Xn,qn,Yn,Zn,Jn,Qn=0;function Kn(){Object.defineProperty(this,"id",{value:Qn++}),this.uuid=Ae.generateUUID(),this.name="",this.type="Material",this.fog=!0,this.lights=!0,this.blending=P,this.side=_,this.shading=T,this.vertexColors=S,this.opacity=1,this.transparent=!1,this.blendSrc=j,this.blendDst=W,this.blendEquation=O,this.blendSrcAlpha=null,this.blendDstAlpha=null,this.blendEquationAlpha=null,this.depthFunc=tt,this.depthTest=!0,this.depthWrite=!0,this.clippingPlanes=null,this.clipIntersection=!1,this.clipShadows=!1,this.colorWrite=!0,this.precision=null,this.polygonOffset=!1,this.polygonOffsetFactor=0,this.polygonOffsetUnits=0,this.dithering=!1,this.alphaTest=0,this.premultipliedAlpha=!1,this.overdraw=0,this.visible=!0,this.needsUpdate=!0}function $n(t){Kn.call(this),this.type="ShaderMaterial",this.defines={},this.uniforms={},this.vertexShader="void main() {\n\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",this.fragmentShader="void main() {\n\tgl_FragColor = vec4( 1.0, 0.0, 0.0, 1.0 );\n}",this.linewidth=1,this.wireframe=!1,this.wireframeLinewidth=1,this.fog=!1,this.lights=!1,this.clipping=!1,this.skinning=!1,this.morphTargets=!1,this.morphNormals=!1,this.extensions={derivatives:!1,fragDepth:!1,drawBuffers:!1,shaderTextureLOD:!1},this.defaultAttributeValues={color:[1,1,1],uv:[0,0],uv2:[0,0]},this.index0AttributeName=void 0,void 0!==t&&(void 0!==t.attributes&&console.error("THREE.ShaderMaterial: attributes should now be defined in THREE.BufferGeometry instead."),this.setValues(t))}function ti(t){Kn.call(this),this.type="MeshDepthMaterial",this.depthPacking=Te,this.skinning=!1,this.morphTargets=!1,this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.wireframe=!1,this.wireframeLinewidth=1,this.fog=!1,this.lights=!1,this.setValues(t)}function ei(t,e){this.min=void 0!==t?t:new He(1/0,1/0,1/0),this.max=void 0!==e?e:new He(-1/0,-1/0,-1/0)}function ni(t,e){this.center=void 0!==t?t:new He,this.radius=void 0!==e?e:0}function ii(){this.elements=[1,0,0,0,1,0,0,0,1],arguments.length>0&&console.error("THREE.Matrix3: the constructor no longer reads arguments. use .set() instead.")}function ri(t,e){this.normal=void 0!==t?t:new He(1,0,0),this.constant=void 0!==e?e:0}function oi(t,e,n,i,r,o){this.planes=[void 0!==t?t:new ri,void 0!==e?e:new ri,void 0!==n?n:new ri,void 0!==i?i:new ri,void 0!==r?r:new ri,void 0!==o?o:new ri]}function ai(t,e,n,i){var r=t.context,o=t.state,a=new oi,s=new Ve,c=e.shadows,h=new Le,u=new Le(i.maxTextureSize,i.maxTextureSize),l=new He,d=new He,p=1,f=2,m=1+(p|f),g=new Array(m),v=new Array(m),y={},b=[new He(1,0,0),new He(-1,0,0),new He(0,0,1),new He(0,0,-1),new He(0,1,0),new He(0,-1,0)],E=[new He(0,1,0),new He(0,1,0),new He(0,1,0),new He(0,1,0),new He(0,0,1),new He(0,0,-1)],T=[new Fe,new Fe,new Fe,new Fe,new Fe,new Fe],S=new ti;S.depthPacking=Se,S.clipping=!0;for(var A=Dn.distanceRGBA,L=Nn.clone(A.uniforms),R=0;R!==m;++R){var P=0!=(R&p),C=0!=(R&f),I=S.clone();I.morphTargets=P,I.skinning=C,g[R]=I;var U=new $n({defines:{USE_SHADOWMAP:""},uniforms:L,vertexShader:A.vertexShader,fragmentShader:A.fragmentShader,morphTargets:P,skinning:C,clipping:!0});v[R]=U}var N=this;function O(e,n,i,r){var o=e.geometry,a=null,s=g,c=e.customDepthMaterial;if(i&&(s=v,c=e.customDistanceMaterial),c)a=c;else{var h=!1;n.morphTargets&&(o&&o.isBufferGeometry?h=o.morphAttributes&&o.morphAttributes.position&&o.morphAttributes.position.length>0:o&&o.isGeometry&&(h=o.morphTargets&&o.morphTargets.length>0)),e.isSkinnedMesh&&!1===n.skinning&&console.warn("THREE.WebGLShadowMap: THREE.SkinnedMesh with material.skinning set to false:",e);var u=e.isSkinnedMesh&&n.skinning,l=0;h&&(l|=p),u&&(l|=f),a=s[l]}if(t.localClippingEnabled&&!0===n.clipShadows&&0!==n.clippingPlanes.length){var d=a.uuid,m=n.uuid,x=y[d];void 0===x&&(x={},y[d]=x);var b=x[m];void 0===b&&(b=a.clone(),x[m]=b),a=b}a.visible=n.visible,a.wireframe=n.wireframe;var E=n.side;return N.renderSingleSided&&E==M&&(E=_),N.renderReverseSided&&(E===_?E=w:E===w&&(E=_)),a.side=E,a.clipShadows=n.clipShadows,a.clippingPlanes=n.clippingPlanes,a.wireframeLinewidth=n.wireframeLinewidth,a.linewidth=n.linewidth,i&&void 0!==a.uniforms.lightPos&&a.uniforms.lightPos.value.copy(r),a}function D(e,i,r,o){if(!1!==e.visible){if(e.layers.test(i.layers)&&(e.isMesh||e.isLine||e.isPoints)&&e.castShadow&&(!e.frustumCulled||a.intersectsObject(e))){e.modelViewMatrix.multiplyMatrices(r.matrixWorldInverse,e.matrixWorld);var s=n.update(e),c=e.material;if(Array.isArray(c))for(var h=s.groups,u=0,l=h.length;u<l;u++){var p=h[u],f=c[p.materialIndex];if(f&&f.visible){var m=O(e,f,o,d);t.renderBufferDirect(r,null,s,m,e,p)}}else if(c.visible){m=O(e,c,o,d);t.renderBufferDirect(r,null,s,m,e,null)}}for(var g=e.children,v=0,y=g.length;v<y;v++)D(g[v],i,r,o)}}this.enabled=!1,this.autoUpdate=!0,this.needsUpdate=!1,this.type=x,this.renderReverseSided=!0,this.renderSingleSided=!0,this.render=function(e,n){if(!1!==N.enabled&&(!1!==N.autoUpdate||!1!==N.needsUpdate)&&0!==c.length){var i,p;o.disable(r.BLEND),o.buffers.color.setClear(1,1,1,1),o.buffers.depth.setTest(!0),o.setScissorTest(!1);for(var f=0,m=c.length;f<m;f++){var g=c[f],v=g.shadow;if(void 0!==v){var y=v.camera,x=v.matrix;if(d.setFromMatrixPosition(g.matrixWorld),y.position.copy(d),h.copy(v.mapSize),h.min(u),g&&g.isPointLight){i=6,p=!0;var _=h.x,w=h.y;T[0].set(2*_,w,_,w),T[1].set(0,w,_,w),T[2].set(3*_,w,_,w),T[3].set(_,w,_,w),T[4].set(3*_,0,_,w),T[5].set(_,0,_,w),h.x*=4,h.y*=2,x.makeTranslation(-d.x,-d.y,-d.z)}else i=1,p=!1,l.setFromMatrixPosition(g.target.matrixWorld),y.lookAt(l),y.updateMatrixWorld(),y.matrixWorldInverse.getInverse(y.matrixWorld),x.set(.5,0,0,.5,0,.5,0,.5,0,0,.5,.5,0,0,0,1),x.multiply(y.projectionMatrix),x.multiply(y.matrixWorldInverse);if(null===v.map){var M={minFilter:Et,magFilter:Et,format:jt};v.map=new Be(h.x,h.y,M),v.map.texture.name=g.name+".shadowMap",y.updateProjectionMatrix()}v.isSpotLightShadow&&v.update(g);var S=v.map;t.setRenderTarget(S),t.clear();for(var A=0;A<i;A++){if(p){l.copy(y.position),l.add(b[A]),y.up.copy(E[A]),y.lookAt(l),y.updateMatrixWorld(),y.matrixWorldInverse.getInverse(y.matrixWorld);var L=T[A];o.viewport(L)}s.multiplyMatrices(y.projectionMatrix,y.matrixWorldInverse),a.setFromMatrix(s),D(e,n,y,p)}}else console.warn("THREE.WebGLShadowMap:",g,"has no shadow.")}var R=t.getClearColor(),P=t.getClearAlpha();t.setClearColor(R,P),N.needsUpdate=!1}}}function si(t,e){this.origin=void 0!==t?t:new He,this.direction=void 0!==e?e:new He}function ci(t,e,n,i){this._x=t||0,this._y=e||0,this._z=n||0,this._order=i||ci.DefaultOrder}function hi(){this.mask=1}Object.assign(Kn.prototype,i.prototype,{isMaterial:!0,setValues:function(t){if(void 0!==t)for(var e in t){var n=t[e];if(void 0!==n){var i=this[e];void 0!==i?i&&i.isColor?i.set(n):i&&i.isVector3&&n&&n.isVector3?i.copy(n):this[e]="overdraw"===e?Number(n):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){var e=void 0===t;e&&(t={textures:{},images:{}});var n={metadata:{version:4.5,type:"Material",generator:"Material.toJSON"}};function i(t){var e=[];for(var n in t){var i=t[n];delete i.metadata,e.push(i)}return e}if(n.uuid=this.uuid,n.type=this.type,""!==this.name&&(n.name=this.name),this.color&&this.color.isColor&&(n.color=this.color.getHex()),void 0!==this.roughness&&(n.roughness=this.roughness),void 0!==this.metalness&&(n.metalness=this.metalness),this.emissive&&this.emissive.isColor&&(n.emissive=this.emissive.getHex()),this.specular&&this.specular.isColor&&(n.specular=this.specular.getHex()),void 0!==this.shininess&&(n.shininess=this.shininess),void 0!==this.clearCoat&&(n.clearCoat=this.clearCoat),void 0!==this.clearCoatRoughness&&(n.clearCoatRoughness=this.clearCoatRoughness),this.map&&this.map.isTexture&&(n.map=this.map.toJSON(t).uuid),this.alphaMap&&this.alphaMap.isTexture&&(n.alphaMap=this.alphaMap.toJSON(t).uuid),this.lightMap&&this.lightMap.isTexture&&(n.lightMap=this.lightMap.toJSON(t).uuid),this.bumpMap&&this.bumpMap.isTexture&&(n.bumpMap=this.bumpMap.toJSON(t).uuid,n.bumpScale=this.bumpScale),this.normalMap&&this.normalMap.isTexture&&(n.normalMap=this.normalMap.toJSON(t).uuid,n.normalScale=this.normalScale.toArray()),this.displacementMap&&this.displacementMap.isTexture&&(n.displacementMap=this.displacementMap.toJSON(t).uuid,n.displacementScale=this.displacementScale,n.displacementBias=this.displacementBias),this.roughnessMap&&this.roughnessMap.isTexture&&(n.roughnessMap=this.roughnessMap.toJSON(t).uuid),this.metalnessMap&&this.metalnessMap.isTexture&&(n.metalnessMap=this.metalnessMap.toJSON(t).uuid),this.emissiveMap&&this.emissiveMap.isTexture&&(n.emissiveMap=this.emissiveMap.toJSON(t).uuid),this.specularMap&&this.specularMap.isTexture&&(n.specularMap=this.specularMap.toJSON(t).uuid),this.envMap&&this.envMap.isTexture&&(n.envMap=this.envMap.toJSON(t).uuid,n.reflectivity=this.reflectivity),this.gradientMap&&this.gradientMap.isTexture&&(n.gradientMap=this.gradientMap.toJSON(t).uuid),void 0!==this.size&&(n.size=this.size),void 0!==this.sizeAttenuation&&(n.sizeAttenuation=this.sizeAttenuation),this.blending!==P&&(n.blending=this.blending),this.shading!==T&&(n.shading=this.shading),this.side!==_&&(n.side=this.side),this.vertexColors!==S&&(n.vertexColors=this.vertexColors),this.opacity<1&&(n.opacity=this.opacity),!0===this.transparent&&(n.transparent=this.transparent),n.depthFunc=this.depthFunc,n.depthTest=this.depthTest,n.depthWrite=this.depthWrite,this.alphaTest>0&&(n.alphaTest=this.alphaTest),!0===this.premultipliedAlpha&&(n.premultipliedAlpha=this.premultipliedAlpha),!0===this.wireframe&&(n.wireframe=this.wireframe),this.wireframeLinewidth>1&&(n.wireframeLinewidth=this.wireframeLinewidth),"round"!==this.wireframeLinecap&&(n.wireframeLinecap=this.wireframeLinecap),"round"!==this.wireframeLinejoin&&(n.wireframeLinejoin=this.wireframeLinejoin),n.skinning=this.skinning,n.morphTargets=this.morphTargets,n.dithering=this.dithering,e){var r=i(t.textures),o=i(t.images);r.length>0&&(n.textures=r),o.length>0&&(n.images=o)}return n},clone:function(){return(new this.constructor).copy(this)},copy:function(t){this.name=t.name,this.fog=t.fog,this.lights=t.lights,this.blending=t.blending,this.side=t.side,this.shading=t.shading,this.vertexColors=t.vertexColors,this.opacity=t.opacity,this.transparent=t.transparent,this.blendSrc=t.blendSrc,this.blendDst=t.blendDst,this.blendEquation=t.blendEquation,this.blendSrcAlpha=t.blendSrcAlpha,this.blendDstAlpha=t.blendDstAlpha,this.blendEquationAlpha=t.blendEquationAlpha,this.depthFunc=t.depthFunc,this.depthTest=t.depthTest,this.depthWrite=t.depthWrite,this.colorWrite=t.colorWrite,this.precision=t.precision,this.polygonOffset=t.polygonOffset,this.polygonOffsetFactor=t.polygonOffsetFactor,this.polygonOffsetUnits=t.polygonOffsetUnits,this.dithering=t.dithering,this.alphaTest=t.alphaTest,this.premultipliedAlpha=t.premultipliedAlpha,this.overdraw=t.overdraw,this.visible=t.visible,this.clipShadows=t.clipShadows,this.clipIntersection=t.clipIntersection;var e=t.clippingPlanes,n=null;if(null!==e){var i=e.length;n=new Array(i);for(var r=0;r!==i;++r)n[r]=e[r].clone()}return this.clippingPlanes=n,this},dispose:function(){this.dispatchEvent({type:"dispose"})}}),$n.prototype=Object.create(Kn.prototype),$n.prototype.constructor=$n,$n.prototype.isShaderMaterial=!0,$n.prototype.copy=function(t){return Kn.prototype.copy.call(this,t),this.fragmentShader=t.fragmentShader,this.vertexShader=t.vertexShader,this.uniforms=Nn.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},$n.prototype.toJSON=function(t){var e=Kn.prototype.toJSON.call(this,t);return e.uniforms=this.uniforms,e.vertexShader=this.vertexShader,e.fragmentShader=this.fragmentShader,e},ti.prototype=Object.create(Kn.prototype),ti.prototype.constructor=ti,ti.prototype.isMeshDepthMaterial=!0,ti.prototype.copy=function(t){return Kn.prototype.copy.call(this,t),this.depthPacking=t.depthPacking,this.skinning=t.skinning,this.morphTargets=t.morphTargets,this.map=t.map,this.alphaMap=t.alphaMap,this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this},Object.assign(ei.prototype,{isBox3:!0,set:function(t,e){return this.min.copy(t),this.max.copy(e),this},setFromArray:function(t){for(var e=1/0,n=1/0,i=1/0,r=-1/0,o=-1/0,a=-1/0,s=0,c=t.length;s<c;s+=3){var h=t[s],u=t[s+1],l=t[s+2];h<e&&(e=h),u<n&&(n=u),l<i&&(i=l),h>r&&(r=h),u>o&&(o=u),l>a&&(a=l)}return this.min.set(e,n,i),this.max.set(r,o,a),this},setFromBufferAttribute:function(t){for(var e=1/0,n=1/0,i=1/0,r=-1/0,o=-1/0,a=-1/0,s=0,c=t.count;s<c;s++){var h=t.getX(s),u=t.getY(s),l=t.getZ(s);h<e&&(e=h),u<n&&(n=u),l<i&&(i=l),h>r&&(r=h),u>o&&(o=u),l>a&&(a=l)}return this.min.set(e,n,i),this.max.set(r,o,a),this},setFromPoints:function(t){this.makeEmpty();for(var e=0,n=t.length;e<n;e++)this.expandByPoint(t[e]);return this},setFromCenterAndSize:function(){var t=new He;return function(e,n){var i=t.copy(n).multiplyScalar(.5);return this.min.copy(e).sub(i),this.max.copy(e).add(i),this}}(),setFromObject:function(t){return this.makeEmpty(),this.expandByObject(t)},clone:function(){return(new this.constructor).copy(this)},copy:function(t){return this.min.copy(t.min),this.max.copy(t.max),this},makeEmpty:function(){return this.min.x=this.min.y=this.min.z=1/0,this.max.x=this.max.y=this.max.z=-1/0,this},isEmpty:function(){return this.max.x<this.min.x||this.max.y<this.min.y||this.max.z<this.min.z},getCenter:function(t){var e=t||new He;return this.isEmpty()?e.set(0,0,0):e.addVectors(this.min,this.max).multiplyScalar(.5)},getSize:function(t){var e=t||new He;return this.isEmpty()?e.set(0,0,0):e.subVectors(this.max,this.min)},expandByPoint:function(t){return this.min.min(t),this.max.max(t),this},expandByVector:function(t){return this.min.sub(t),this.max.add(t),this},expandByScalar:function(t){return this.min.addScalar(-t),this.max.addScalar(t),this},expandByObject:function(){var t=new He;return function(e){var n=this;return e.updateMatrixWorld(!0),e.traverse(function(e){var i,r,o=e.geometry;if(void 0!==o)if(o.isGeometry){var a=o.vertices;for(i=0,r=a.length;i<r;i++)t.copy(a[i]),t.applyMatrix4(e.matrixWorld),n.expandByPoint(t)}else if(o.isBufferGeometry){var s=o.attributes.position;if(void 0!==s)for(i=0,r=s.count;i<r;i++)t.fromBufferAttribute(s,i).applyMatrix4(e.matrixWorld),n.expandByPoint(t)}}),this}}(),containsPoint:function(t){return!(t.x<this.min.x||t.x>this.max.x||t.y<this.min.y||t.y>this.max.y||t.z<this.min.z||t.z>this.max.z)},containsBox:function(t){return this.min.x<=t.min.x&&t.max.x<=this.max.x&&this.min.y<=t.min.y&&t.max.y<=this.max.y&&this.min.z<=t.min.z&&t.max.z<=this.max.z},getParameter:function(t,e){return(e||new He).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:(Hn=new He,function(t){return this.clampPoint(t.center,Hn),Hn.distanceToSquared(t.center)<=t.radius*t.radius}),intersectsPlane:function(t){var e,n;return t.normal.x>0?(e=t.normal.x*this.min.x,n=t.normal.x*this.max.x):(e=t.normal.x*this.max.x,n=t.normal.x*this.min.x),t.normal.y>0?(e+=t.normal.y*this.min.y,n+=t.normal.y*this.max.y):(e+=t.normal.y*this.max.y,n+=t.normal.y*this.min.y),t.normal.z>0?(e+=t.normal.z*this.min.z,n+=t.normal.z*this.max.z):(e+=t.normal.z*this.max.z,n+=t.normal.z*this.min.z),e<=t.constant&&n>=t.constant},clampPoint:function(t,e){return(e||new He).copy(t).clamp(this.min,this.max)},distanceToPoint:function(){var t=new He;return function(e){return t.copy(e).clamp(this.min,this.max).sub(e).length()}}(),getBoundingSphere:function(){var t=new He;return function(e){var n=e||new ni;return this.getCenter(n.center),n.radius=.5*this.getSize(t).length(),n}}(),intersect:function(t){return this.min.max(t.min),this.max.min(t.max),this.isEmpty()&&this.makeEmpty(),this},union:function(t){return this.min.min(t.min),this.max.max(t.max),this},applyMatrix4:(Gn=[new He,new He,new He,new He,new He,new He,new He,new He],function(t){return this.isEmpty()?this:(Gn[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(t),Gn[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(t),Gn[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(t),Gn[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(t),Gn[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(t),Gn[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(t),Gn[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(t),Gn[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(t),this.setFromPoints(Gn),this)}),translate:function(t){return this.min.add(t),this.max.add(t),this},equals:function(t){return t.min.equals(this.min)&&t.max.equals(this.max)}}),Object.assign(ni.prototype,{set:function(t,e){return this.center.copy(t),this.radius=e,this},setFromPoints:(Vn=new ei,function(t,e){var n=this.center;void 0!==e?n.copy(e):Vn.setFromPoints(t).getCenter(n);for(var i=0,r=0,o=t.length;r<o;r++)i=Math.max(i,n.distanceToSquared(t[r]));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),i=e||new He;return i.copy(t),n>this.radius*this.radius&&(i.sub(this.center).normalize(),i.multiplyScalar(this.radius).add(this.center)),i},getBoundingBox:function(t){var e=t||new ei;return e.set(this.center,this.center),e.expandByScalar(this.radius),e},applyMatrix4:function(t){return this.center.applyMatrix4(t),this.radius=this.radius*t.getMaxScaleOnAxis(),this},translate:function(t){return this.center.add(t),this},equals:function(t){return t.center.equals(this.center)&&t.radius===this.radius}}),Object.assign(ii.prototype,{isMatrix3:!0,set:function(t,e,n,i,r,o,a,s,c){var h=this.elements;return h[0]=t,h[1]=i,h[2]=a,h[3]=e,h[4]=r,h[5]=s,h[6]=n,h[7]=o,h[8]=c,this},identity:function(){return this.set(1,0,0,0,1,0,0,0,1),this},clone:function(){return(new this.constructor).fromArray(this.elements)},copy:function(t){var e=this.elements,n=t.elements;return e[0]=n[0],e[1]=n[1],e[2]=n[2],e[3]=n[3],e[4]=n[4],e[5]=n[5],e[6]=n[6],e[7]=n[7],e[8]=n[8],this},setFromMatrix4:function(t){var e=t.elements;return this.set(e[0],e[4],e[8],e[1],e[5],e[9],e[2],e[6],e[10]),this},applyToBufferAttribute:function(){var t=new He;return function(e){for(var n=0,i=e.count;n<i;n++)t.x=e.getX(n),t.y=e.getY(n),t.z=e.getZ(n),t.applyMatrix3(this),e.setXYZ(n,t.x,t.y,t.z);return e}}(),multiply:function(t){return this.multiplyMatrices(this,t)},premultiply:function(t){return this.multiplyMatrices(t,this)},multiplyMatrices:function(t,e){var n=t.elements,i=e.elements,r=this.elements,o=n[0],a=n[3],s=n[6],c=n[1],h=n[4],u=n[7],l=n[2],d=n[5],p=n[8],f=i[0],m=i[3],g=i[6],v=i[1],y=i[4],x=i[7],b=i[2],_=i[5],w=i[8];return r[0]=o*f+a*v+s*b,r[3]=o*m+a*y+s*_,r[6]=o*g+a*x+s*w,r[1]=c*f+h*v+u*b,r[4]=c*m+h*y+u*_,r[7]=c*g+h*x+u*w,r[2]=l*f+d*v+p*b,r[5]=l*m+d*y+p*_,r[8]=l*g+d*x+p*w,this},multiplyScalar:function(t){var e=this.elements;return e[0]*=t,e[3]*=t,e[6]*=t,e[1]*=t,e[4]*=t,e[7]*=t,e[2]*=t,e[5]*=t,e[8]*=t,this},determinant:function(){var t=this.elements,e=t[0],n=t[1],i=t[2],r=t[3],o=t[4],a=t[5],s=t[6],c=t[7],h=t[8];return e*o*h-e*a*c-n*r*h+n*a*s+i*r*c-i*o*s},getInverse:function(t,e){t&&t.isMatrix4&&console.error("THREE.Matrix3.getInverse no longer takes a Matrix4 argument.");var n=t.elements,i=this.elements,r=n[0],o=n[1],a=n[2],s=n[3],c=n[4],h=n[5],u=n[6],l=n[7],d=n[8],p=d*c-h*l,f=h*u-d*s,m=l*s-c*u,g=r*p+o*f+a*m;if(0===g){var v="THREE.Matrix3.getInverse(): can't invert matrix, determinant is 0";if(!0===e)throw new Error(v);return console.warn(v),this.identity()}var y=1/g;return i[0]=p*y,i[1]=(a*l-d*o)*y,i[2]=(h*o-a*c)*y,i[3]=f*y,i[4]=(d*r-a*u)*y,i[5]=(a*s-h*r)*y,i[6]=m*y,i[7]=(o*u-l*r)*y,i[8]=(c*r-o*s)*y,this},transpose:function(){var t,e=this.elements;return t=e[1],e[1]=e[3],e[3]=t,t=e[2],e[2]=e[6],e[6]=t,t=e[5],e[5]=e[7],e[7]=t,this},getNormalMatrix:function(t){return this.setFromMatrix4(t).getInverse(this).transpose()},transposeIntoArray:function(t){var e=this.elements;return t[0]=e[0],t[1]=e[3],t[2]=e[6],t[3]=e[1],t[4]=e[4],t[5]=e[7],t[6]=e[2],t[7]=e[5],t[8]=e[8],this},equals:function(t){for(var e=this.elements,n=t.elements,i=0;i<9;i++)if(e[i]!==n[i])return!1;return!0},fromArray:function(t,e){void 0===e&&(e=0);for(var n=0;n<9;n++)this.elements[n]=t[n+e];return this},toArray:function(t,e){void 0===t&&(t=[]),void 0===e&&(e=0);var n=this.elements;return t[e]=n[0],t[e+1]=n[1],t[e+2]=n[2],t[e+3]=n[3],t[e+4]=n[4],t[e+5]=n[5],t[e+6]=n[6],t[e+7]=n[7],t[e+8]=n[8],t}}),Object.assign(ri.prototype,{set:function(t,e){return this.normal.copy(t),this.constant=e,this},setComponents:function(t,e,n,i){return this.normal.set(t,e,n),this.constant=i,this},setFromNormalAndCoplanarPoint:function(t,e){return this.normal.copy(t),this.constant=-e.dot(this.normal),this},setFromCoplanarPoints:function(){var t=new He,e=new He;return function(n,i,r){var o=t.subVectors(r,i).cross(e.subVectors(n,i)).normalize();return this.setFromNormalAndCoplanarPoint(o,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);return(e||new He).copy(this.normal).multiplyScalar(n)},intersectLine:function(){var t=new He;return function(e,n){var i=n||new He,r=e.delta(t),o=this.normal.dot(r);if(0===o)return 0===this.distanceToPoint(e.start)?i.copy(e.start):void 0;var a=-(e.start.dot(this.normal)+this.constant)/o;return a<0||a>1?void 0:i.copy(r).multiplyScalar(a).add(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){return(t||new He).copy(this.normal).multiplyScalar(-this.constant)},applyMatrix4:function(){var t=new He,e=new ii;return function(n,i){var r=this.coplanarPoint(t).applyMatrix4(n),o=i||e.getNormalMatrix(n),a=this.normal.applyMatrix3(o).normalize();return this.constant=-r.dot(a),this}}(),translate:function(t){return this.constant=this.constant-t.dot(this.normal),this},equals:function(t){return t.normal.equals(this.normal)&&t.constant===this.constant}}),Object.assign(oi.prototype,{set:function(t,e,n,i,r,o){var a=this.planes;return a[0].copy(t),a[1].copy(e),a[2].copy(n),a[3].copy(i),a[4].copy(r),a[5].copy(o),this},clone:function(){return(new this.constructor).copy(this)},copy:function(t){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,i=n[0],r=n[1],o=n[2],a=n[3],s=n[4],c=n[5],h=n[6],u=n[7],l=n[8],d=n[9],p=n[10],f=n[11],m=n[12],g=n[13],v=n[14],y=n[15];return e[0].setComponents(a-i,u-s,f-l,y-m).normalize(),e[1].setComponents(a+i,u+s,f+l,y+m).normalize(),e[2].setComponents(a+r,u+c,f+d,y+g).normalize(),e[3].setComponents(a-r,u-c,f-d,y-g).normalize(),e[4].setComponents(a-o,u-h,f-p,y-v).normalize(),e[5].setComponents(a+o,u+h,f+p,y+v).normalize(),this},intersectsObject:(Wn=new ni,function(t){var e=t.geometry;return null===e.boundingSphere&&e.computeBoundingSphere(),Wn.copy(e.boundingSphere).applyMatrix4(t.matrixWorld),this.intersectsSphere(Wn)}),intersectsSprite:function(){var t=new ni;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,i=-t.radius,r=0;r<6;r++){if(e[r].distanceToPoint(n)<i)return!1}return!0},intersectsBox:(kn=new He,jn=new He,function(t){for(var e=this.planes,n=0;n<6;n++){var i=e[n];kn.x=i.normal.x>0?t.min.x:t.max.x,jn.x=i.normal.x>0?t.max.x:t.min.x,kn.y=i.normal.y>0?t.min.y:t.max.y,jn.y=i.normal.y>0?t.max.y:t.min.y,kn.z=i.normal.z>0?t.min.z:t.max.z,jn.z=i.normal.z>0?t.max.z:t.min.z;var r=i.distanceToPoint(kn),o=i.distanceToPoint(jn);if(r<0&&o<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}}),Object.assign(si.prototype,{set:function(t,e){return this.origin.copy(t),this.direction.copy(e),this},clone:function(){return(new this.constructor).copy(this)},copy:function(t){return this.origin.copy(t.origin),this.direction.copy(t.direction),this},at:function(t,e){return(e||new He).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 He;return function(e){return this.origin.copy(this.at(e,t)),this}}(),closestPointToPoint:function(t,e){var n=e||new He;n.subVectors(t,this.origin);var i=n.dot(this.direction);return i<0?n.copy(this.origin):n.copy(this.direction).multiplyScalar(i).add(this.origin)},distanceToPoint:function(t){return Math.sqrt(this.distanceSqToPoint(t))},distanceSqToPoint:function(){var t=new He;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:(qn=new He,Yn=new He,Zn=new He,function(t,e,n,i){qn.copy(t).add(e).multiplyScalar(.5),Yn.copy(e).sub(t).normalize(),Zn.copy(this.origin).sub(qn);var r,o,a,s,c=.5*t.distanceTo(e),h=-this.direction.dot(Yn),u=Zn.dot(this.direction),l=-Zn.dot(Yn),d=Zn.lengthSq(),p=Math.abs(1-h*h);if(p>0)if(o=h*u-l,s=c*p,(r=h*l-u)>=0)if(o>=-s)if(o<=s){var f=1/p;a=(r*=f)*(r+h*(o*=f)+2*u)+o*(h*r+o+2*l)+d}else o=c,a=-(r=Math.max(0,-(h*o+u)))*r+o*(o+2*l)+d;else o=-c,a=-(r=Math.max(0,-(h*o+u)))*r+o*(o+2*l)+d;else o<=-s?a=-(r=Math.max(0,-(-h*c+u)))*r+(o=r>0?-c:Math.min(Math.max(-c,-l),c))*(o+2*l)+d:o<=s?(r=0,a=(o=Math.min(Math.max(-c,-l),c))*(o+2*l)+d):a=-(r=Math.max(0,-(h*c+u)))*r+(o=r>0?c:Math.min(Math.max(-c,-l),c))*(o+2*l)+d;else o=h>0?-c:c,a=-(r=Math.max(0,-(h*o+u)))*r+o*(o+2*l)+d;return n&&n.copy(this.direction).multiplyScalar(r).add(this.origin),i&&i.copy(Yn).multiplyScalar(o).add(qn),a}),intersectSphere:function(){var t=new He;return function(e,n){t.subVectors(e.center,this.origin);var i=t.dot(this.direction),r=t.dot(t)-i*i,o=e.radius*e.radius;if(r>o)return null;var a=Math.sqrt(o-r),s=i-a,c=i+a;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);return 0===e||t.normal.dot(this.direction)*e<0},intersectBox:function(t,e){var n,i,r,o,a,s,c=1/this.direction.x,h=1/this.direction.y,u=1/this.direction.z,l=this.origin;return c>=0?(n=(t.min.x-l.x)*c,i=(t.max.x-l.x)*c):(n=(t.max.x-l.x)*c,i=(t.min.x-l.x)*c),h>=0?(r=(t.min.y-l.y)*h,o=(t.max.y-l.y)*h):(r=(t.max.y-l.y)*h,o=(t.min.y-l.y)*h),n>o||r>i?null:((r>n||n!=n)&&(n=r),(o<i||i!=i)&&(i=o),u>=0?(a=(t.min.z-l.z)*u,s=(t.max.z-l.z)*u):(a=(t.max.z-l.z)*u,s=(t.min.z-l.z)*u),n>s||a>i?null:((a>n||n!=n)&&(n=a),(s<i||i!=i)&&(i=s),i<0?null:this.at(n>=0?n:i,e)))},intersectsBox:(Xn=new He,function(t){return null!==this.intersectBox(t,Xn)}),intersectTriangle:function(){var t=new He,e=new He,n=new He,i=new He;return function(r,o,a,s,c){e.subVectors(o,r),n.subVectors(a,r),i.crossVectors(e,n);var h,u=this.direction.dot(i);if(u>0){if(s)return null;h=1}else{if(!(u<0))return null;h=-1,u=-u}t.subVectors(this.origin,r);var l=h*this.direction.dot(n.crossVectors(t,n));if(l<0)return null;var d=h*this.direction.dot(e.cross(t));if(d<0)return null;if(l+d>u)return null;var p=-h*t.dot(i);return p<0?null:this.at(p/u,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)}}),ci.RotationOrders=["XYZ","YZX","ZXY","XZY","YXZ","ZYX"],ci.DefaultOrder="XYZ",Object.defineProperties(ci.prototype,{x:{get:function(){return this._x},set:function(t){this._x=t,this.onChangeCallback()}},y:{get:function(){return this._y},set:function(t){this._y=t,this.onChangeCallback()}},z:{get:function(){return this._z},set:function(t){this._z=t,this.onChangeCallback()}},order:{get:function(){return this._order},set:function(t){this._order=t,this.onChangeCallback()}}}),Object.assign(ci.prototype,{isEuler:!0,set:function(t,e,n,i){return this._x=t,this._y=e,this._z=n,this._order=i||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 i=Ae.clamp,r=t.elements,o=r[0],a=r[4],s=r[8],c=r[1],h=r[5],u=r[9],l=r[2],d=r[6],p=r[10];return"XYZ"===(e=e||this._order)?(this._y=Math.asin(i(s,-1,1)),Math.abs(s)<.99999?(this._x=Math.atan2(-u,p),this._z=Math.atan2(-a,o)):(this._x=Math.atan2(d,h),this._z=0)):"YXZ"===e?(this._x=Math.asin(-i(u,-1,1)),Math.abs(u)<.99999?(this._y=Math.atan2(s,p),this._z=Math.atan2(c,h)):(this._y=Math.atan2(-l,o),this._z=0)):"ZXY"===e?(this._x=Math.asin(i(d,-1,1)),Math.abs(d)<.99999?(this._y=Math.atan2(-l,p),this._z=Math.atan2(-a,h)):(this._y=0,this._z=Math.atan2(c,o))):"ZYX"===e?(this._y=Math.asin(-i(l,-1,1)),Math.abs(l)<.99999?(this._x=Math.atan2(d,p),this._z=Math.atan2(c,o)):(this._x=0,this._z=Math.atan2(-a,h))):"YZX"===e?(this._z=Math.asin(i(c,-1,1)),Math.abs(c)<.99999?(this._x=Math.atan2(-u,h),this._y=Math.atan2(-l,o)):(this._x=0,this._y=Math.atan2(s,p))):"XZY"===e?(this._z=Math.asin(-i(a,-1,1)),Math.abs(a)<.99999?(this._x=Math.atan2(d,h),this._y=Math.atan2(s,o)):(this._x=Math.atan2(-u,p),this._y=0)):console.warn("THREE.Euler: .setFromRotationMatrix() given unsupported order: "+e),this._order=e,!1!==n&&this.onChangeCallback(),this},setFromQuaternion:function(){var t=new Ve;return function(e,n,i){return t.makeRotationFromQuaternion(e),this.setFromRotationMatrix(t,n,i)}}(),setFromVector3:function(t,e){return this.set(t.x,t.y,t.z,e||this._order)},reorder:(Jn=new Ge,function(t){return Jn.setFromEuler(this),this.setFromQuaternion(Jn,t)}),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 He(this._x,this._y,this._z)},onChange:function(t){return this.onChangeCallback=t,this},onChangeCallback:function(){}}),Object.assign(hi.prototype,{set:function(t){this.mask=1<<t|0},enable:function(t){this.mask|=1<<t|0},toggle:function(t){this.mask^=1<<t|0},disable:function(t){this.mask&=~(1<<t|0)},test:function(t){return 0!=(this.mask&t.mask)}});var ui,li,di,pi,fi,mi,gi,vi=0;function yi(){Object.defineProperty(this,"id",{value:vi++}),this.uuid=Ae.generateUUID(),this.name="",this.type="Object3D",this.parent=null,this.children=[],this.up=yi.DefaultUp.clone();var t=new He,e=new ci,n=new Ge,i=new He(1,1,1);e.onChange(function(){n.setFromEuler(e,!1)}),n.onChange(function(){e.setFromQuaternion(n,void 0,!1)}),Object.defineProperties(this,{position:{enumerable:!0,value:t},rotation:{enumerable:!0,value:e},quaternion:{enumerable:!0,value:n},scale:{enumerable:!0,value:i},modelViewMatrix:{value:new Ve},normalMatrix:{value:new ii}}),this.matrix=new Ve,this.matrixWorld=new Ve,this.matrixAutoUpdate=yi.DefaultMatrixAutoUpdate,this.matrixWorldNeedsUpdate=!1,this.layers=new hi,this.visible=!0,this.castShadow=!1,this.receiveShadow=!1,this.frustumCulled=!0,this.renderOrder=0,this.userData={},this.onBeforeRender=function(){},this.onAfterRender=function(){}}function xi(t,e){this.start=void 0!==t?t:new He,this.end=void 0!==e?e:new He}function bi(t,e,n){this.a=void 0!==t?t:new He,this.b=void 0!==e?e:new He,this.c=void 0!==n?n:new He}function _i(t,e,n,i,r,o){this.a=t,this.b=e,this.c=n,this.normal=i&&i.isVector3?i:new He,this.vertexNormals=Array.isArray(i)?i:[],this.color=r&&r.isColor?r:new In,this.vertexColors=Array.isArray(r)?r:[],this.materialIndex=void 0!==o?o:0}function wi(t){Kn.call(this),this.type="MeshBasicMaterial",this.color=new In(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.combine=ot,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.skinning=!1,this.morphTargets=!1,this.lights=!1,this.setValues(t)}function Mi(t,e,n){if(Array.isArray(t))throw new TypeError("THREE.BufferAttribute: array should be a Typed Array.");this.uuid=Ae.generateUUID(),this.array=t,this.itemSize=e,this.count=void 0!==t?t.length/e:0,this.normalized=!0===n,this.dynamic=!1,this.updateRange={offset:0,count:-1},this.onUploadCallback=function(){},this.version=0}function Ei(t,e){Mi.call(this,new Int8Array(t),e)}function Ti(t,e){Mi.call(this,new Uint8Array(t),e)}function Si(t,e){Mi.call(this,new Uint8ClampedArray(t),e)}function Ai(t,e){Mi.call(this,new Int16Array(t),e)}function Li(t,e){Mi.call(this,new Uint16Array(t),e)}function Ri(t,e){Mi.call(this,new Int32Array(t),e)}function Pi(t,e){Mi.call(this,new Uint32Array(t),e)}function Ci(t,e){Mi.call(this,new Float32Array(t),e)}function Ii(t,e){Mi.call(this,new Float64Array(t),e)}function Ui(){this.indices=[],this.vertices=[],this.normals=[],this.colors=[],this.uvs=[],this.uvs2=[],this.groups=[],this.morphTargets={},this.skinWeights=[],this.skinIndices=[],this.boundingBox=null,this.boundingSphere=null,this.verticesNeedUpdate=!1,this.normalsNeedUpdate=!1,this.colorsNeedUpdate=!1,this.uvsNeedUpdate=!1,this.groupsNeedUpdate=!1}function Ni(t){if(0===t.length)return-1/0;for(var e=t[0],n=1,i=t.length;n<i;++n)t[n]>e&&(e=t[n]);return e}yi.DefaultUp=new He(0,1,0),yi.DefaultMatrixAutoUpdate=!0,Object.assign(yi.prototype,i.prototype,{isObject3D:!0,applyMatrix:function(t){this.matrix.multiplyMatrices(t,this.matrix),this.matrix.decompose(this.position,this.quaternion,this.scale)},setRotationFromAxisAngle:function(t,e){this.quaternion.setFromAxisAngle(t,e)},setRotationFromEuler:function(t){this.quaternion.setFromEuler(t,!0)},setRotationFromMatrix:function(t){this.quaternion.setFromRotationMatrix(t)},setRotationFromQuaternion:function(t){this.quaternion.copy(t)},rotateOnAxis:(pi=new Ge,function(t,e){return pi.setFromAxisAngle(t,e),this.quaternion.multiply(pi),this}),rotateX:function(){var t=new He(1,0,0);return function(e){return this.rotateOnAxis(t,e)}}(),rotateY:function(){var t=new He(0,1,0);return function(e){return this.rotateOnAxis(t,e)}}(),rotateZ:function(){var t=new He(0,0,1);return function(e){return this.rotateOnAxis(t,e)}}(),translateOnAxis:function(){var t=new He;return function(e,n){return t.copy(e).applyQuaternion(this.quaternion),this.position.add(t.multiplyScalar(n)),this}}(),translateX:function(){var t=new He(1,0,0);return function(e){return this.translateOnAxis(t,e)}}(),translateY:function(){var t=new He(0,1,0);return function(e){return this.translateOnAxis(t,e)}}(),translateZ:function(){var t=new He(0,0,1);return function(e){return this.translateOnAxis(t,e)}}(),localToWorld:function(t){return t.applyMatrix4(this.matrixWorld)},worldToLocal:(di=new Ve,function(t){return t.applyMatrix4(di.getInverse(this.matrixWorld))}),lookAt:function(){var t=new Ve;return function(e){this.isCamera?t.lookAt(this.position,e,this.up):t.lookAt(e,this.position,this.up),this.quaternion.setFromRotationMatrix(t)}}(),add:function(t){if(arguments.length>1){for(var e=0;e<arguments.length;e++)this.add(arguments[e]);return this}return t===this?(console.error("THREE.Object3D.add: object can't be added as a child of itself.",t),this):(t&&t.isObject3D?(null!==t.parent&&t.parent.remove(t),t.parent=this,t.dispatchEvent({type:"added"}),this.children.push(t)):console.error("THREE.Object3D.add: object not an instance of THREE.Object3D.",t),this)},remove:function(t){if(arguments.length>1)for(var e=0;e<arguments.length;e++)this.remove(arguments[e]);var n=this.children.indexOf(t);-1!==n&&(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,i=this.children.length;n<i;n++){var r=this.children[n].getObjectByProperty(t,e);if(void 0!==r)return r}},getWorldPosition:function(t){var e=t||new He;return this.updateMatrixWorld(!0),e.setFromMatrixPosition(this.matrixWorld)},getWorldQuaternion:(ui=new He,li=new He,function(t){var e=t||new Ge;return this.updateMatrixWorld(!0),this.matrixWorld.decompose(ui,e,li),e}),getWorldRotation:function(){var t=new Ge;return function(e){var n=e||new ci;return this.getWorldQuaternion(t),n.setFromQuaternion(t,this.rotation.order,!1)}}(),getWorldScale:function(){var t=new He,e=new Ge;return function(n){var i=n||new He;return this.updateMatrixWorld(!0),this.matrixWorld.decompose(t,e,i),i}}(),getWorldDirection:function(){var t=new Ge;return function(e){var n=e||new He;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,i=e.length;n<i;n++)e[n].traverse(t)},traverseVisible:function(t){if(!1!==this.visible){t(this);for(var e=this.children,n=0,i=e.length;n<i;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&&this.updateMatrix(),(this.matrixWorldNeedsUpdate||t)&&(null===this.parent?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix),this.matrixWorldNeedsUpdate=!1,t=!0);for(var e=this.children,n=0,i=e.length;n<i;n++)e[n].updateMatrixWorld(t)},toJSON:function(t){var e=void 0===t||""===t,n={};e&&(t={geometries:{},materials:{},textures:{},images:{}},n.metadata={version:4.5,type:"Object",generator:"Object3D.toJSON"});var i={};function r(e,n){return void 0===e[n.uuid]&&(e[n.uuid]=n.toJSON(t)),n.uuid}if(i.uuid=this.uuid,i.type=this.type,""!==this.name&&(i.name=this.name),"{}"!==JSON.stringify(this.userData)&&(i.userData=this.userData),!0===this.castShadow&&(i.castShadow=!0),!0===this.receiveShadow&&(i.receiveShadow=!0),!1===this.visible&&(i.visible=!1),i.matrix=this.matrix.toArray(),void 0!==this.geometry&&(i.geometry=r(t.geometries,this.geometry)),void 0!==this.material)if(Array.isArray(this.material)){for(var o=[],a=0,s=this.material.length;a<s;a++)o.push(r(t.materials,this.material[a]));i.material=o}else i.material=r(t.materials,this.material);if(this.children.length>0){i.children=[];for(a=0;a<this.children.length;a++)i.children.push(this.children[a].toJSON(t).object)}if(e){var c=d(t.geometries),h=d(t.materials),u=d(t.textures),l=d(t.images);c.length>0&&(n.geometries=c),h.length>0&&(n.materials=h),u.length>0&&(n.textures=u),l.length>0&&(n.images=l)}return n.object=i,n;function d(t){var e=[];for(var n in t){var i=t[n];delete i.metadata,e.push(i)}return e}},clone:function(t){return(new this.constructor).copy(this,t)},copy:function(t,e){if(void 0===e&&(e=!0),this.name=t.name,this.up.copy(t.up),this.position.copy(t.position),this.quaternion.copy(t.quaternion),this.scale.copy(t.scale),this.matrix.copy(t.matrix),this.matrixWorld.copy(t.matrixWorld),this.matrixAutoUpdate=t.matrixAutoUpdate,this.matrixWorldNeedsUpdate=t.matrixWorldNeedsUpdate,this.layers.mask=t.layers.mask,this.visible=t.visible,this.castShadow=t.castShadow,this.receiveShadow=t.receiveShadow,this.frustumCulled=t.frustumCulled,this.renderOrder=t.renderOrder,this.userData=JSON.parse(JSON.stringify(t.userData)),!0===e)for(var n=0;n<t.children.length;n++){var i=t.children[n];this.add(i.clone())}return this}}),Object.assign(xi.prototype,{set:function(t,e){return this.start.copy(t),this.end.copy(e),this},clone:function(){return(new this.constructor).copy(this)},copy:function(t){return this.start.copy(t.start),this.end.copy(t.end),this},getCenter:function(t){return(t||new He).addVectors(this.start,this.end).multiplyScalar(.5)},delta:function(t){return(t||new He).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 He;return this.delta(n).multiplyScalar(t).add(this.start)},closestPointToPointParameter:(fi=new He,mi=new He,function(t,e){fi.subVectors(t,this.start),mi.subVectors(this.end,this.start);var n=mi.dot(mi),i=mi.dot(fi)/n;return e&&(i=Ae.clamp(i,0,1)),i}),closestPointToPoint:function(t,e,n){var i=this.closestPointToPointParameter(t,e),r=n||new He;return this.delta(r).multiplyScalar(i).add(this.start)},applyMatrix4:function(t){return this.start.applyMatrix4(t),this.end.applyMatrix4(t),this},equals:function(t){return t.start.equals(this.start)&&t.end.equals(this.end)}}),Object.assign(bi,{normal:(gi=new He,function(t,e,n,i){var r=i||new He;r.subVectors(n,e),gi.subVectors(t,e),r.cross(gi);var o=r.lengthSq();return o>0?r.multiplyScalar(1/Math.sqrt(o)):r.set(0,0,0)}),barycoordFromPoint:function(){var t=new He,e=new He,n=new He;return function(i,r,o,a,s){t.subVectors(a,r),e.subVectors(o,r),n.subVectors(i,r);var c=t.dot(t),h=t.dot(e),u=t.dot(n),l=e.dot(e),d=e.dot(n),p=c*l-h*h,f=s||new He;if(0===p)return f.set(-2,-1,-1);var m=1/p,g=(l*u-h*d)*m,v=(c*d-h*u)*m;return f.set(1-g-v,v,g)}}(),containsPoint:function(){var t=new He;return function(e,n,i,r){var o=bi.barycoordFromPoint(e,n,i,r,t);return o.x>=0&&o.y>=0&&o.x+o.y<=1}}()}),Object.assign(bi.prototype,{set:function(t,e,n){return this.a.copy(t),this.b.copy(e),this.c.copy(n),this},setFromPointsAndIndices:function(t,e,n,i){return this.a.copy(t[e]),this.b.copy(t[n]),this.c.copy(t[i]),this},clone:function(){return(new this.constructor).copy(this)},copy:function(t){return this.a.copy(t.a),this.b.copy(t.b),this.c.copy(t.c),this},area:function(){var t=new He,e=new He;return function(){return t.subVectors(this.c,this.b),e.subVectors(this.a,this.b),.5*t.cross(e).length()}}(),midpoint:function(t){return(t||new He).addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)},normal:function(t){return bi.normal(this.a,this.b,this.c,t)},plane:function(t){return(t||new ri).setFromCoplanarPoints(this.a,this.b,this.c)},barycoordFromPoint:function(t,e){return bi.barycoordFromPoint(t,this.a,this.b,this.c,e)},containsPoint:function(t){return bi.containsPoint(t,this.a,this.b,this.c)},closestPointToPoint:function(){var t=new ri,e=[new xi,new xi,new xi],n=new He,i=new He;return function(r,o){var a=o||new He,s=1/0;if(t.setFromCoplanarPoints(this.a,this.b,this.c),t.projectPoint(r,n),!0===this.containsPoint(n))a.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 c=0;c<e.length;c++){e[c].closestPointToPoint(n,!0,i);var h=n.distanceToSquared(i);h<s&&(s=h,a.copy(i))}}return a}}(),equals:function(t){return t.a.equals(this.a)&&t.b.equals(this.b)&&t.c.equals(this.c)}}),Object.assign(_i.prototype,{clone:function(){return(new this.constructor).copy(this)},copy:function(t){this.a=t.a,this.b=t.b,this.c=t.c,this.normal.copy(t.normal),this.color.copy(t.color),this.materialIndex=t.materialIndex;for(var e=0,n=t.vertexNormals.length;e<n;e++)this.vertexNormals[e]=t.vertexNormals[e].clone();for(e=0,n=t.vertexColors.length;e<n;e++)this.vertexColors[e]=t.vertexColors[e].clone();return this}}),wi.prototype=Object.create(Kn.prototype),wi.prototype.constructor=wi,wi.prototype.isMeshBasicMaterial=!0,wi.prototype.copy=function(t){return Kn.prototype.copy.call(this,t),this.color.copy(t.color),this.map=t.map,this.lightMap=t.lightMap,this.lightMapIntensity=t.lightMapIntensity,this.aoMap=t.aoMap,this.aoMapIntensity=t.aoMapIntensity,this.specularMap=t.specularMap,this.alphaMap=t.alphaMap,this.envMap=t.envMap,this.combine=t.combine,this.reflectivity=t.reflectivity,this.refractionRatio=t.refractionRatio,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.wireframeLinecap=t.wireframeLinecap,this.wireframeLinejoin=t.wireframeLinejoin,this.skinning=t.skinning,this.morphTargets=t.morphTargets,this},Object.defineProperty(Mi.prototype,"needsUpdate",{set:function(t){!0===t&&this.version++}}),Object.assign(Mi.prototype,{isBufferAttribute:!0,setArray:function(t){if(Array.isArray(t))throw new TypeError("THREE.BufferAttribute: array should be a Typed Array.");this.count=void 0!==t?t.length/this.itemSize:0,this.array=t},setDynamic:function(t){return this.dynamic=t,this},copy:function(t){return this.array=new t.array.constructor(t.array),this.itemSize=t.itemSize,this.count=t.count,this.normalized=t.normalized,this.dynamic=t.dynamic,this},copyAt:function(t,e,n){t*=this.itemSize,n*=e.itemSize;for(var i=0,r=this.itemSize;i<r;i++)this.array[t+i]=e.array[n+i];return this},copyArray:function(t){return this.array.set(t),this},copyColorsArray:function(t){for(var e=this.array,n=0,i=0,r=t.length;i<r;i++){var o=t[i];void 0===o&&(console.warn("THREE.BufferAttribute.copyColorsArray(): color is undefined",i),o=new In),e[n++]=o.r,e[n++]=o.g,e[n++]=o.b}return this},copyIndicesArray:function(t){for(var e=this.array,n=0,i=0,r=t.length;i<r;i++){var o=t[i];e[n++]=o.a,e[n++]=o.b,e[n++]=o.c}return this},copyVector2sArray:function(t){for(var e=this.array,n=0,i=0,r=t.length;i<r;i++){var o=t[i];void 0===o&&(console.warn("THREE.BufferAttribute.copyVector2sArray(): vector is undefined",i),o=new Le),e[n++]=o.x,e[n++]=o.y}return this},copyVector3sArray:function(t){for(var e=this.array,n=0,i=0,r=t.length;i<r;i++){var o=t[i];void 0===o&&(console.warn("THREE.BufferAttribute.copyVector3sArray(): vector is undefined",i),o=new He),e[n++]=o.x,e[n++]=o.y,e[n++]=o.z}return this},copyVector4sArray:function(t){for(var e=this.array,n=0,i=0,r=t.length;i<r;i++){var o=t[i];void 0===o&&(console.warn("THREE.BufferAttribute.copyVector4sArray(): vector is undefined",i),o=new Fe),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,i){return t*=this.itemSize,this.array[t+0]=e,this.array[t+1]=n,this.array[t+2]=i,this},setXYZW:function(t,e,n,i,r){return t*=this.itemSize,this.array[t+0]=e,this.array[t+1]=n,this.array[t+2]=i,this.array[t+3]=r,this},onUpload:function(t){return this.onUploadCallback=t,this},clone:function(){return new this.constructor(this.array,this.itemSize).copy(this)}}),Ei.prototype=Object.create(Mi.prototype),Ei.prototype.constructor=Ei,Ti.prototype=Object.create(Mi.prototype),Ti.prototype.constructor=Ti,Si.prototype=Object.create(Mi.prototype),Si.prototype.constructor=Si,Ai.prototype=Object.create(Mi.prototype),Ai.prototype.constructor=Ai,Li.prototype=Object.create(Mi.prototype),Li.prototype.constructor=Li,Ri.prototype=Object.create(Mi.prototype),Ri.prototype.constructor=Ri,Pi.prototype=Object.create(Mi.prototype),Pi.prototype.constructor=Pi,Ci.prototype=Object.create(Mi.prototype),Ci.prototype.constructor=Ci,Ii.prototype=Object.create(Mi.prototype),Ii.prototype.constructor=Ii,Object.assign(Ui.prototype,{computeGroups:function(t){for(var e,n=[],i=void 0,r=t.faces,o=0;o<r.length;o++){var a=r[o];a.materialIndex!==i&&(i=a.materialIndex,void 0!==e&&(e.count=3*o-e.start,n.push(e)),e={start:3*o,materialIndex:i})}void 0!==e&&(e.count=3*o-e.start,n.push(e)),this.groups=n},fromGeometry:function(t){var e,n=t.faces,i=t.vertices,r=t.faceVertexUvs,o=r[0]&&r[0].length>0,a=r[1]&&r[1].length>0,s=t.morphTargets,c=s.length;if(c>0){e=[];for(var h=0;h<c;h++)e[h]=[];this.morphTargets.position=e}var u,l=t.morphNormals,d=l.length;if(d>0){u=[];for(h=0;h<d;h++)u[h]=[];this.morphTargets.normal=u}var p=t.skinIndices,f=t.skinWeights,m=p.length===i.length,g=f.length===i.length;for(h=0;h<n.length;h++){var v=n[h];this.vertices.push(i[v.a],i[v.b],i[v.c]);var y=v.vertexNormals;if(3===y.length)this.normals.push(y[0],y[1],y[2]);else{var x=v.normal;this.normals.push(x,x,x)}var b,_=v.vertexColors;if(3===_.length)this.colors.push(_[0],_[1],_[2]);else{var w=v.color;this.colors.push(w,w,w)}if(!0===o)void 0!==(b=r[0][h])?this.uvs.push(b[0],b[1],b[2]):(console.warn("THREE.DirectGeometry.fromGeometry(): Undefined vertexUv ",h),this.uvs.push(new Le,new Le,new Le));if(!0===a)void 0!==(b=r[1][h])?this.uvs2.push(b[0],b[1],b[2]):(console.warn("THREE.DirectGeometry.fromGeometry(): Undefined vertexUv2 ",h),this.uvs2.push(new Le,new Le,new Le));for(var M=0;M<c;M++){var E=s[M].vertices;e[M].push(E[v.a],E[v.b],E[v.c])}for(M=0;M<d;M++){var T=l[M].vertexNormals[h];u[M].push(T.a,T.b,T.c)}m&&this.skinIndices.push(p[v.a],p[v.b],p[v.c]),g&&this.skinWeights.push(f[v.a],f[v.b],f[v.c])}return this.computeGroups(t),this.verticesNeedUpdate=t.verticesNeedUpdate,this.normalsNeedUpdate=t.normalsNeedUpdate,this.colorsNeedUpdate=t.colorsNeedUpdate,this.uvsNeedUpdate=t.uvsNeedUpdate,this.groupsNeedUpdate=t.groupsNeedUpdate,this}});var Oi,Di=0;function Fi(){return Di++}function Bi(){Object.defineProperty(this,"id",{value:Fi()}),this.uuid=Ae.generateUUID(),this.name="",this.type="Geometry",this.vertices=[],this.colors=[],this.faces=[],this.faceVertexUvs=[[]],this.morphTargets=[],this.morphNormals=[],this.skinWeights=[],this.skinIndices=[],this.lineDistances=[],this.boundingBox=null,this.boundingSphere=null,this.elementsNeedUpdate=!1,this.verticesNeedUpdate=!1,this.uvsNeedUpdate=!1,this.normalsNeedUpdate=!1,this.colorsNeedUpdate=!1,this.lineDistancesNeedUpdate=!1,this.groupsNeedUpdate=!1}function zi(){Object.defineProperty(this,"id",{value:Fi()}),this.uuid=Ae.generateUUID(),this.name="",this.type="BufferGeometry",this.index=null,this.attributes={},this.morphAttributes={},this.groups=[],this.boundingBox=null,this.boundingSphere=null,this.drawRange={start:0,count:1/0}}function Gi(t,e){yi.call(this),this.type="Mesh",this.geometry=void 0!==t?t:new zi,this.material=void 0!==e?e:new wi({color:16777215*Math.random()}),this.drawMode=fe,this.updateMorphTargets()}function Hi(t,e,n,i,r,o){Bi.call(this),this.type="BoxGeometry",this.parameters={width:t,height:e,depth:n,widthSegments:i,heightSegments:r,depthSegments:o},this.fromBufferGeometry(new Vi(t,e,n,i,r,o)),this.mergeVertices()}function Vi(t,e,n,i,r,o){zi.call(this),this.type="BoxBufferGeometry",this.parameters={width:t,height:e,depth:n,widthSegments:i,heightSegments:r,depthSegments:o};var a=this;i=Math.floor(i)||1,r=Math.floor(r)||1,o=Math.floor(o)||1;var s=[],c=[],h=[],u=[],l=0,d=0;function p(t,e,n,i,r,o,p,f,m,g,v){var y,x,b=o/m,_=p/g,w=o/2,M=p/2,E=f/2,T=m+1,S=g+1,A=0,L=0,R=new He;for(x=0;x<S;x++){var P=x*_-M;for(y=0;y<T;y++){var C=y*b-w;R[t]=C*i,R[e]=P*r,R[n]=E,c.push(R.x,R.y,R.z),R[t]=0,R[e]=0,R[n]=f>0?1:-1,h.push(R.x,R.y,R.z),u.push(y/m),u.push(1-x/g),A+=1}}for(x=0;x<g;x++)for(y=0;y<m;y++){var I=l+y+T*x,U=l+y+T*(x+1),N=l+(y+1)+T*(x+1),O=l+(y+1)+T*x;s.push(I,U,O),s.push(U,N,O),L+=6}a.addGroup(d,L,v),d+=L,l+=A}p("z","y","x",-1,-1,n,e,t,o,r,0),p("z","y","x",1,-1,n,e,-t,o,r,1),p("x","z","y",1,1,t,n,e,i,o,2),p("x","z","y",1,-1,t,n,-e,i,o,3),p("x","y","z",1,-1,t,e,n,i,r,4),p("x","y","z",-1,-1,t,e,-n,i,r,5),this.setIndex(s),this.addAttribute("position",new Ci(c,3)),this.addAttribute("normal",new Ci(h,3)),this.addAttribute("uv",new Ci(u,2))}function ki(t,e,n,i){Bi.call(this),this.type="PlaneGeometry",this.parameters={width:t,height:e,widthSegments:n,heightSegments:i},this.fromBufferGeometry(new ji(t,e,n,i)),this.mergeVertices()}function ji(t,e,n,i){zi.call(this),this.type="PlaneBufferGeometry",this.parameters={width:t,height:e,widthSegments:n,heightSegments:i};var r,o,a=t/2,s=e/2,c=Math.floor(n)||1,h=Math.floor(i)||1,u=c+1,l=h+1,d=t/c,p=e/h,f=[],m=[],g=[],v=[];for(o=0;o<l;o++){var y=o*p-s;for(r=0;r<u;r++){var x=r*d-a;m.push(x,-y,0),g.push(0,0,1),v.push(r/c),v.push(1-o/h)}}for(o=0;o<h;o++)for(r=0;r<c;r++){var b=r+u*o,_=r+u*(o+1),w=r+1+u*(o+1),M=r+1+u*o;f.push(b,_,M),f.push(_,w,M)}this.setIndex(f),this.addAttribute("position",new Ci(m,3)),this.addAttribute("normal",new Ci(g,3)),this.addAttribute("uv",new Ci(v,2))}function Wi(){yi.call(this),this.type="Camera",this.matrixWorldInverse=new Ve,this.projectionMatrix=new Ve}function Xi(t,e,n,i){Wi.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!==i?i:2e3,this.focus=10,this.aspect=void 0!==e?e:1,this.view=null,this.filmGauge=35,this.filmOffset=0,this.updateProjectionMatrix()}function qi(t,e,n,i,r,o){Wi.call(this),this.type="OrthographicCamera",this.zoom=1,this.view=null,this.left=t,this.right=e,this.top=n,this.bottom=i,this.near=void 0!==r?r:.1,this.far=void 0!==o?o:2e3,this.updateProjectionMatrix()}function Yi(t){var e={};return{get:function(t){return t.isInterleavedBufferAttribute&&(t=t.data),e[t.uuid]},remove:function(n){var i=e[n.uuid];i&&(t.deleteBuffer(i.buffer),delete e[n.uuid])},update:function(n,i){n.isInterleavedBufferAttribute&&(n=n.data);var r=e[n.uuid];void 0===r?e[n.uuid]=function(e,n){var i=e.array,r=e.dynamic?t.DYNAMIC_DRAW:t.STATIC_DRAW,o=t.createBuffer();t.bindBuffer(n,o),t.bufferData(n,i,r),e.onUploadCallback();var a=t.FLOAT;return i instanceof Float32Array?a=t.FLOAT:i instanceof Float64Array?console.warn("Unsupported data buffer format: Float64Array"):i instanceof Uint16Array?a=t.UNSIGNED_SHORT:i instanceof Int16Array?a=t.SHORT:i instanceof Uint32Array?a=t.UNSIGNED_INT:i instanceof Int32Array?a=t.INT:i instanceof Int8Array?a=t.BYTE:i instanceof Uint8Array&&(a=t.UNSIGNED_BYTE),{buffer:o,type:a,bytesPerElement:i.BYTES_PER_ELEMENT,version:e.version}}(n,i):r.version<n.version&&(function(e,n,i){var r=n.array,o=n.updateRange;t.bindBuffer(i,e),!1===n.dynamic?t.bufferData(i,r,t.STATIC_DRAW):-1===o.count?t.bufferSubData(i,0,r):0===o.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(i,o.offset*r.BYTES_PER_ELEMENT,r.subarray(o.offset,o.offset+o.count)),o.count=0)}(r.buffer,n,i),r.version=n.version)}}}function Zi(t,e){return t.renderOrder!==e.renderOrder?t.renderOrder-e.renderOrder:t.program&&e.program&&t.program!==e.program?t.program.id-e.program.id:t.material.id!==e.material.id?t.material.id-e.material.id:t.z!==e.z?t.z-e.z:t.id-e.id}function Ji(t,e){return t.renderOrder!==e.renderOrder?t.renderOrder-e.renderOrder:t.z!==e.z?e.z-t.z:t.id-e.id}function Qi(){var t=[],e=-1,n=[],i=-1;return{opaque:t,transparent:n,init:function(){e=-1,i=-1},push:function(r,o,a,s,c){var h,u;a.transparent?(h=n,u=++i):(h=t,u=++e);var l=h[u];l?(l.id=r.id,l.object=r,l.geometry=o,l.material=a,l.program=a.program,l.renderOrder=r.renderOrder,l.z=s,l.group=c):(l={id:r.id,object:r,geometry:o,material:a,program:a.program,renderOrder:r.renderOrder,z:s,group:c},h.push(l))},finish:function(){t.length=e+1,n.length=i+1},sort:function(){t.sort(Zi),n.sort(Ji)}}}function Ki(){var t={};return{get:function(e,n){var i=e.id+","+n.id,r=t[i];return void 0===r&&(r=new Qi,t[i]=r),r},dispose:function(){t={}}}}function $i(t,e,n){var i,r,o;this.setMode=function(t){i=t},this.setIndex=function(n){n.array instanceof Uint32Array&&e.get("OES_element_index_uint")?(r=t.UNSIGNED_INT,o=4):n.array instanceof Uint16Array?(r=t.UNSIGNED_SHORT,o=2):(r=t.UNSIGNED_BYTE,o=1)},this.render=function(e,a){t.drawElements(i,a,r,e*o),n.calls++,n.vertices+=a,i===t.TRIANGLES&&(n.faces+=a/3)},this.renderInstances=function(a,s,c){var h=e.get("ANGLE_instanced_arrays");null!==h?(h.drawElementsInstancedANGLE(i,c,r,s*o,a.maxInstancedCount),n.calls++,n.vertices+=c*a.maxInstancedCount,i===t.TRIANGLES&&(n.faces+=a.maxInstancedCount*c/3)):console.error("THREE.WebGLIndexedBufferRenderer: using THREE.InstancedBufferGeometry but hardware does not support extension ANGLE_instanced_arrays.")}}function tr(t,e,n){var i;this.setMode=function(t){i=t},this.render=function(e,r){t.drawArrays(i,e,r),n.calls++,n.vertices+=r,i===t.TRIANGLES&&(n.faces+=r/3)},this.renderInstances=function(r,o,a){var s=e.get("ANGLE_instanced_arrays");if(null!==s){var c=r.attributes.position;c.isInterleavedBufferAttribute?(a=c.data.count,s.drawArraysInstancedANGLE(i,0,a,r.maxInstancedCount)):s.drawArraysInstancedANGLE(i,o,a,r.maxInstancedCount),n.calls++,n.vertices+=a*r.maxInstancedCount,i===t.TRIANGLES&&(n.faces+=r.maxInstancedCount*a/3)}else console.error("THREE.WebGLBufferRenderer: using THREE.InstancedBufferGeometry but hardware does not support extension ANGLE_instanced_arrays.")}}function er(t,e,n){var i={},r={};function o(t){var a=t.target,s=i[a.id];for(var c in null!==s.index&&e.remove(s.index),s.attributes)e.remove(s.attributes[c]);a.removeEventListener("dispose",o),delete i[a.id];var h=r[a.id];h&&(e.remove(h),delete r[a.id]),(h=r[s.id])&&(e.remove(h),delete r[s.id]),n.geometries--}return{get:function(t,e){var r=i[e.id];return r||(e.addEventListener("dispose",o),e.isBufferGeometry?r=e:e.isGeometry&&(void 0===e._bufferGeometry&&(e._bufferGeometry=(new zi).setFromObject(t)),r=e._bufferGeometry),i[e.id]=r,n.geometries++,r)},update:function(n){var i=n.index,r=n.attributes;for(var o in null!==i&&e.update(i,t.ELEMENT_ARRAY_BUFFER),r)e.update(r[o],t.ARRAY_BUFFER);var a=n.morphAttributes;for(var o in a)for(var s=a[o],c=0,h=s.length;c<h;c++)e.update(s[c],t.ARRAY_BUFFER)},getWireframeAttribute:function(n){var i=r[n.id];if(i)return i;var o,a=[],s=n.index,c=n.attributes;if(null!==s)for(var h=0,u=(o=s.array).length;h<u;h+=3){var l=o[h+0],d=o[h+1],p=o[h+2];a.push(l,d,d,p,p,l)}else for(h=0,u=(o=c.position.array).length/3-1;h<u;h+=3)l=h+0,d=h+1,p=h+2,a.push(l,d,d,p,p,l);return i=new(Ni(a)>65535?Pi:Li)(a,1),e.update(i,t.ELEMENT_ARRAY_BUFFER),r[n.id]=i,i}}}function nr(){var t={};return{get:function(e){if(void 0!==t[e.id])return t[e.id];var n;switch(e.type){case"DirectionalLight":n={direction:new He,color:new In,shadow:!1,shadowBias:0,shadowRadius:1,shadowMapSize:new Le};break;case"SpotLight":n={position:new He,direction:new He,color:new In,distance:0,coneCos:0,penumbraCos:0,decay:0,shadow:!1,shadowBias:0,shadowRadius:1,shadowMapSize:new Le};break;case"PointLight":n={position:new He,color:new In,distance:0,decay:0,shadow:!1,shadowBias:0,shadowRadius:1,shadowMapSize:new Le};break;case"HemisphereLight":n={direction:new He,skyColor:new In,groundColor:new In};break;case"RectAreaLight":n={color:new In,position:new He,halfWidth:new He,halfHeight:new He}}return t[e.id]=n,n}}}function ir(t,e,n){var i={};return{update:function(t){var r=n.frame,o=t.geometry,a=e.get(t,o);return i[a.id]!==r&&(o.isGeometry&&a.updateFromObject(t),e.update(a),i[a.id]=r),a},clear:function(){i={}}}}function rr(t,e,n){var i=t.createShader(e);return t.shaderSource(i,n),t.compileShader(i),!1===t.getShaderParameter(i,t.COMPILE_STATUS)&&console.error("THREE.WebGLShader: Shader couldn't compile."),""!==t.getShaderInfoLog(i)&&console.warn("THREE.WebGLShader: gl.getShaderInfoLog()",e===t.VERTEX_SHADER?"vertex":"fragment",t.getShaderInfoLog(i),function(t){for(var e=t.split("\n"),n=0;n<e.length;n++)e[n]=n+1+": "+e[n];return e.join("\n")}(n)),i}Object.assign(Bi.prototype,i.prototype,{isGeometry:!0,applyMatrix:function(t){for(var e=(new ii).getNormalMatrix(t),n=0,i=this.vertices.length;n<i;n++){this.vertices[n].applyMatrix4(t)}for(n=0,i=this.faces.length;n<i;n++){var r=this.faces[n];r.normal.applyMatrix3(e).normalize();for(var o=0,a=r.vertexNormals.length;o<a;o++)r.vertexNormals[o].applyMatrix3(e).normalize()}return null!==this.boundingBox&&this.computeBoundingBox(),null!==this.boundingSphere&&this.computeBoundingSphere(),this.verticesNeedUpdate=!0,this.normalsNeedUpdate=!0,this},rotateX:function(){var t=new Ve;return function(e){return t.makeRotationX(e),this.applyMatrix(t),this}}(),rotateY:function(){var t=new Ve;return function(e){return t.makeRotationY(e),this.applyMatrix(t),this}}(),rotateZ:function(){var t=new Ve;return function(e){return t.makeRotationZ(e),this.applyMatrix(t),this}}(),translate:function(){var t=new Ve;return function(e,n,i){return t.makeTranslation(e,n,i),this.applyMatrix(t),this}}(),scale:function(){var t=new Ve;return function(e,n,i){return t.makeScale(e,n,i),this.applyMatrix(t),this}}(),lookAt:(Oi=new yi,function(t){Oi.lookAt(t),Oi.updateMatrix(),this.applyMatrix(Oi.matrix)}),fromBufferGeometry:function(t){var e=this,n=null!==t.index?t.index.array:void 0,i=t.attributes,r=i.position.array,o=void 0!==i.normal?i.normal.array:void 0,a=void 0!==i.color?i.color.array:void 0,s=void 0!==i.uv?i.uv.array:void 0,c=void 0!==i.uv2?i.uv2.array:void 0;void 0!==c&&(this.faceVertexUvs[1]=[]);for(var h=[],u=[],l=[],d=0,p=0;d<r.length;d+=3,p+=2)e.vertices.push(new He(r[d],r[d+1],r[d+2])),void 0!==o&&h.push(new He(o[d],o[d+1],o[d+2])),void 0!==a&&e.colors.push(new In(a[d],a[d+1],a[d+2])),void 0!==s&&u.push(new Le(s[p],s[p+1])),void 0!==c&&l.push(new Le(c[p],c[p+1]));function f(t,n,i,r){var d=new _i(t,n,i,void 0!==o?[h[t].clone(),h[n].clone(),h[i].clone()]:[],void 0!==a?[e.colors[t].clone(),e.colors[n].clone(),e.colors[i].clone()]:[],r);e.faces.push(d),void 0!==s&&e.faceVertexUvs[0].push([u[t].clone(),u[n].clone(),u[i].clone()]),void 0!==c&&e.faceVertexUvs[1].push([l[t].clone(),l[n].clone(),l[i].clone()])}var m=t.groups;if(m.length>0)for(d=0;d<m.length;d++)for(var g=m[d],v=g.start,y=(p=v,v+g.count);p<y;p+=3)void 0!==n?f(n[p],n[p+1],n[p+2],g.materialIndex):f(p,p+1,p+2,g.materialIndex);else if(void 0!==n)for(d=0;d<n.length;d+=3)f(n[d],n[d+1],n[d+2]);else for(d=0;d<r.length/3;d+=3)f(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.getCenter().negate();return this.translate(t.x,t.y,t.z),t},normalize:function(){this.computeBoundingSphere();var t=this.boundingSphere.center,e=this.boundingSphere.radius,n=0===e?1:1/e,i=new Ve;return i.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(i),this},computeFaceNormals:function(){for(var t=new He,e=new He,n=0,i=this.faces.length;n<i;n++){var r=this.faces[n],o=this.vertices[r.a],a=this.vertices[r.b],s=this.vertices[r.c];t.subVectors(s,a),e.subVectors(o,a),t.cross(e),t.normalize(),r.normal.copy(t)}},computeVertexNormals:function(t){var e,n,i,r,o,a;for(void 0===t&&(t=!0),a=new Array(this.vertices.length),e=0,n=this.vertices.length;e<n;e++)a[e]=new He;if(t){var s,c,h,u=new He,l=new He;for(i=0,r=this.faces.length;i<r;i++)o=this.faces[i],s=this.vertices[o.a],c=this.vertices[o.b],h=this.vertices[o.c],u.subVectors(h,c),l.subVectors(s,c),u.cross(l),a[o.a].add(u),a[o.b].add(u),a[o.c].add(u)}else for(this.computeFaceNormals(),i=0,r=this.faces.length;i<r;i++)a[(o=this.faces[i]).a].add(o.normal),a[o.b].add(o.normal),a[o.c].add(o.normal);for(e=0,n=this.vertices.length;e<n;e++)a[e].normalize();for(i=0,r=this.faces.length;i<r;i++){var d=(o=this.faces[i]).vertexNormals;3===d.length?(d[0].copy(a[o.a]),d[1].copy(a[o.b]),d[2].copy(a[o.c])):(d[0]=a[o.a].clone(),d[1]=a[o.b].clone(),d[2]=a[o.c].clone())}this.faces.length>0&&(this.normalsNeedUpdate=!0)},computeFlatVertexNormals:function(){var t,e,n;for(this.computeFaceNormals(),t=0,e=this.faces.length;t<e;t++){var i=(n=this.faces[t]).vertexNormals;3===i.length?(i[0].copy(n.normal),i[1].copy(n.normal),i[2].copy(n.normal)):(i[0]=n.normal.clone(),i[1]=n.normal.clone(),i[2]=n.normal.clone())}this.faces.length>0&&(this.normalsNeedUpdate=!0)},computeMorphNormals:function(){var t,e,n,i,r;for(n=0,i=this.faces.length;n<i;n++)for((r=this.faces[n]).__originalFaceNormal?r.__originalFaceNormal.copy(r.normal):r.__originalFaceNormal=r.normal.clone(),r.__originalVertexNormals||(r.__originalVertexNormals=[]),t=0,e=r.vertexNormals.length;t<e;t++)r.__originalVertexNormals[t]?r.__originalVertexNormals[t].copy(r.vertexNormals[t]):r.__originalVertexNormals[t]=r.vertexNormals[t].clone();var o=new Bi;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 a=this.morphNormals[t].faceNormals,s=this.morphNormals[t].vertexNormals;for(n=0,i=this.faces.length;n<i;n++)c=new He,h={a:new He,b:new He,c:new He},a.push(c),s.push(h)}var c,h,u=this.morphNormals[t];for(o.vertices=this.morphTargets[t].vertices,o.computeFaceNormals(),o.computeVertexNormals(),n=0,i=this.faces.length;n<i;n++)r=this.faces[n],c=u.faceNormals[n],h=u.vertexNormals[n],c.copy(r.normal),h.a.copy(r.vertexNormals[0]),h.b.copy(r.vertexNormals[1]),h.c.copy(r.vertexNormals[2])}for(n=0,i=this.faces.length;n<i;n++)(r=this.faces[n]).normal=r.__originalFaceNormal,r.vertexNormals=r.__originalVertexNormals},computeLineDistances:function(){for(var t=0,e=this.vertices,n=0,i=e.length;n<i;n++)n>0&&(t+=e[n].distanceTo(e[n-1])),this.lineDistances[n]=t},computeBoundingBox:function(){null===this.boundingBox&&(this.boundingBox=new ei),this.boundingBox.setFromPoints(this.vertices)},computeBoundingSphere:function(){null===this.boundingSphere&&(this.boundingSphere=new ni),this.boundingSphere.setFromPoints(this.vertices)},merge:function(t,e,n){if(!1!==(t&&t.isGeometry)){var i,r=this.vertices.length,o=this.vertices,a=t.vertices,s=this.faces,c=t.faces,h=this.faceVertexUvs[0],u=t.faceVertexUvs[0],l=this.colors,d=t.colors;void 0===n&&(n=0),void 0!==e&&(i=(new ii).getNormalMatrix(e));for(var p=0,f=a.length;p<f;p++){var m=a[p].clone();void 0!==e&&m.applyMatrix4(e),o.push(m)}for(p=0,f=d.length;p<f;p++)l.push(d[p].clone());for(p=0,f=c.length;p<f;p++){var g,v,y,x=c[p],b=x.vertexNormals,_=x.vertexColors;(g=new _i(x.a+r,x.b+r,x.c+r)).normal.copy(x.normal),void 0!==i&&g.normal.applyMatrix3(i).normalize();for(var w=0,M=b.length;w<M;w++)v=b[w].clone(),void 0!==i&&v.applyMatrix3(i).normalize(),g.vertexNormals.push(v);g.color.copy(x.color);for(w=0,M=_.length;w<M;w++)y=_[w],g.vertexColors.push(y.clone());g.materialIndex=x.materialIndex+n,s.push(g)}for(p=0,f=u.length;p<f;p++){var E=u[p],T=[];if(void 0!==E){for(w=0,M=E.length;w<M;w++)T.push(E[w].clone());h.push(T)}}}else console.error("THREE.Geometry.merge(): geometry not an instance of THREE.Geometry.",t)},mergeMesh:function(t){!1!==(t&&t.isMesh)?(t.matrixAutoUpdate&&t.updateMatrix(),this.merge(t.geometry,t.matrix)):console.error("THREE.Geometry.mergeMesh(): mesh not an instance of THREE.Mesh.",t)},mergeVertices:function(){var t,e,n,i,r,o,a,s,c={},h=[],u=[],l=Math.pow(10,4);for(n=0,i=this.vertices.length;n<i;n++)t=this.vertices[n],void 0===c[e=Math.round(t.x*l)+"_"+Math.round(t.y*l)+"_"+Math.round(t.z*l)]?(c[e]=n,h.push(this.vertices[n]),u[n]=h.length-1):u[n]=u[c[e]];var d=[];for(n=0,i=this.faces.length;n<i;n++){(r=this.faces[n]).a=u[r.a],r.b=u[r.b],r.c=u[r.c],o=[r.a,r.b,r.c];for(var p=0;p<3;p++)if(o[p]===o[(p+1)%3]){d.push(n);break}}for(n=d.length-1;n>=0;n--){var f=d[n];for(this.faces.splice(f,1),a=0,s=this.faceVertexUvs.length;a<s;a++)this.faceVertexUvs[a].splice(f,1)}var m=this.vertices.length-h.length;return this.vertices=h,m},sortFacesByMaterialIndex:function(){for(var t=this.faces,e=t.length,n=0;n<e;n++)t[n]._id=n;t.sort(function(t,e){return t.materialIndex-e.materialIndex});var i,r,o=this.faceVertexUvs[0],a=this.faceVertexUvs[1];o&&o.length===e&&(i=[]),a&&a.length===e&&(r=[]);for(n=0;n<e;n++){var s=t[n]._id;i&&i.push(o[s]),r&&r.push(a[s])}i&&(this.faceVertexUvs[0]=i),r&&(this.faceVertexUvs[1]=r)},toJSON:function(){var t={metadata:{version:4.5,type:"Geometry",generator:"Geometry.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}for(var i=[],r=0;r<this.vertices.length;r++){var o=this.vertices[r];i.push(o.x,o.y,o.z)}var a=[],s=[],c={},h=[],u={},l=[],d={};for(r=0;r<this.faces.length;r++){var p=this.faces[r],f=void 0!==this.faceVertexUvs[0][r],m=p.normal.length()>0,g=p.vertexNormals.length>0,v=1!==p.color.r||1!==p.color.g||1!==p.color.b,y=p.vertexColors.length>0,x=0;if(x=M(x,0,0),x=M(x,1,!0),x=M(x,2,!1),x=M(x,3,f),x=M(x,4,m),x=M(x,5,g),x=M(x,6,v),x=M(x,7,y),a.push(x),a.push(p.a,p.b,p.c),a.push(p.materialIndex),f){var b=this.faceVertexUvs[0][r];a.push(S(b[0]),S(b[1]),S(b[2]))}if(m&&a.push(E(p.normal)),g){var _=p.vertexNormals;a.push(E(_[0]),E(_[1]),E(_[2]))}if(v&&a.push(T(p.color)),y){var w=p.vertexColors;a.push(T(w[0]),T(w[1]),T(w[2]))}}function M(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!==c[e]?c[e]:(c[e]=s.length/3,s.push(t.x,t.y,t.z),c[e])}function T(t){var e=t.r.toString()+t.g.toString()+t.b.toString();return void 0!==u[e]?u[e]:(u[e]=h.length,h.push(t.getHex()),u[e])}function S(t){var e=t.x.toString()+t.y.toString();return void 0!==d[e]?d[e]:(d[e]=l.length/2,l.push(t.x,t.y),d[e])}return t.data={},t.data.vertices=i,t.data.normals=s,h.length>0&&(t.data.colors=h),l.length>0&&(t.data.uvs=[l]),t.data.faces=a,t},clone:function(){return(new Bi).copy(this)},copy:function(t){var e,n,i,r,o,a;this.vertices=[],this.colors=[],this.faces=[],this.faceVertexUvs=[[]],this.morphTargets=[],this.morphNormals=[],this.skinWeights=[],this.skinIndices=[],this.lineDistances=[],this.boundingBox=null,this.boundingSphere=null,this.name=t.name;var s=t.vertices;for(e=0,n=s.length;e<n;e++)this.vertices.push(s[e].clone());var c=t.colors;for(e=0,n=c.length;e<n;e++)this.colors.push(c[e].clone());var h=t.faces;for(e=0,n=h.length;e<n;e++)this.faces.push(h[e].clone());for(e=0,n=t.faceVertexUvs.length;e<n;e++){var u=t.faceVertexUvs[e];for(void 0===this.faceVertexUvs[e]&&(this.faceVertexUvs[e]=[]),i=0,r=u.length;i<r;i++){var l=u[i],d=[];for(o=0,a=l.length;o<a;o++){var p=l[o];d.push(p.clone())}this.faceVertexUvs[e].push(d)}}var f=t.morphTargets;for(e=0,n=f.length;e<n;e++){var m={};if(m.name=f[e].name,void 0!==f[e].vertices)for(m.vertices=[],i=0,r=f[e].vertices.length;i<r;i++)m.vertices.push(f[e].vertices[i].clone());if(void 0!==f[e].normals)for(m.normals=[],i=0,r=f[e].normals.length;i<r;i++)m.normals.push(f[e].normals[i].clone());this.morphTargets.push(m)}var g=t.morphNormals;for(e=0,n=g.length;e<n;e++){var v={};if(void 0!==g[e].vertexNormals)for(v.vertexNormals=[],i=0,r=g[e].vertexNormals.length;i<r;i++){var y=g[e].vertexNormals[i],x={};x.a=y.a.clone(),x.b=y.b.clone(),x.c=y.c.clone(),v.vertexNormals.push(x)}if(void 0!==g[e].faceNormals)for(v.faceNormals=[],i=0,r=g[e].faceNormals.length;i<r;i++)v.faceNormals.push(g[e].faceNormals[i].clone());this.morphNormals.push(v)}var b=t.skinWeights;for(e=0,n=b.length;e<n;e++)this.skinWeights.push(b[e].clone());var _=t.skinIndices;for(e=0,n=_.length;e<n;e++)this.skinIndices.push(_[e].clone());var w=t.lineDistances;for(e=0,n=w.length;e<n;e++)this.lineDistances.push(w[e]);var M=t.boundingBox;null!==M&&(this.boundingBox=M.clone());var E=t.boundingSphere;return null!==E&&(this.boundingSphere=E.clone()),this.elementsNeedUpdate=t.elementsNeedUpdate,this.verticesNeedUpdate=t.verticesNeedUpdate,this.uvsNeedUpdate=t.uvsNeedUpdate,this.normalsNeedUpdate=t.normalsNeedUpdate,this.colorsNeedUpdate=t.colorsNeedUpdate,this.lineDistancesNeedUpdate=t.lineDistancesNeedUpdate,this.groupsNeedUpdate=t.groupsNeedUpdate,this},dispose:function(){this.dispatchEvent({type:"dispose"})}}),zi.MaxIndex=65535,Object.assign(zi.prototype,i.prototype,{isBufferGeometry:!0,getIndex:function(){return this.index},setIndex:function(t){Array.isArray(t)?this.index=new(Ni(t)>65535?Pi:Li)(t,1):this.index=t},addAttribute:function(t,e){return!1===(e&&e.isBufferAttribute)&&!1===(e&&e.isInterleavedBufferAttribute)?(console.warn("THREE.BufferGeometry: .addAttribute() now expects ( name, attribute )."),void this.addAttribute(t,new Mi(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.applyToBufferAttribute(e),e.needsUpdate=!0);var n=this.attributes.normal;void 0!==n&&((new ii).getNormalMatrix(t).applyToBufferAttribute(n),n.needsUpdate=!0);return null!==this.boundingBox&&this.computeBoundingBox(),null!==this.boundingSphere&&this.computeBoundingSphere(),this},rotateX:function(){var t=new Ve;return function(e){return t.makeRotationX(e),this.applyMatrix(t),this}}(),rotateY:function(){var t=new Ve;return function(e){return t.makeRotationY(e),this.applyMatrix(t),this}}(),rotateZ:function(){var t=new Ve;return function(e){return t.makeRotationZ(e),this.applyMatrix(t),this}}(),translate:function(){var t=new Ve;return function(e,n,i){return t.makeTranslation(e,n,i),this.applyMatrix(t),this}}(),scale:function(){var t=new Ve;return function(e,n,i){return t.makeScale(e,n,i),this.applyMatrix(t),this}}(),lookAt:function(){var t=new yi;return function(e){t.lookAt(e),t.updateMatrix(),this.applyMatrix(t.matrix)}}(),center:function(){this.computeBoundingBox();var t=this.boundingBox.getCenter().negate();return this.translate(t.x,t.y,t.z),t},setFromObject:function(t){var e=t.geometry;if(t.isPoints||t.isLine){var n=new Ci(3*e.vertices.length,3),i=new Ci(3*e.colors.length,3);if(this.addAttribute("position",n.copyVector3sArray(e.vertices)),this.addAttribute("color",i.copyColorsArray(e.colors)),e.lineDistances&&e.lineDistances.length===e.vertices.length){var r=new Ci(e.lineDistances.length,1);this.addAttribute("lineDistance",r.copyArray(e.lineDistances))}null!==e.boundingSphere&&(this.boundingSphere=e.boundingSphere.clone()),null!==e.boundingBox&&(this.boundingBox=e.boundingBox.clone())}else t.isMesh&&e&&e.isGeometry&&this.fromGeometry(e);return this},updateFromObject:function(t){var e,n=t.geometry;if(t.isMesh){var i=n.__directGeometry;if(!0===n.elementsNeedUpdate&&(i=void 0,n.elementsNeedUpdate=!1),void 0===i)return this.fromGeometry(n);i.verticesNeedUpdate=n.verticesNeedUpdate,i.normalsNeedUpdate=n.normalsNeedUpdate,i.colorsNeedUpdate=n.colorsNeedUpdate,i.uvsNeedUpdate=n.uvsNeedUpdate,i.groupsNeedUpdate=n.groupsNeedUpdate,n.verticesNeedUpdate=!1,n.normalsNeedUpdate=!1,n.colorsNeedUpdate=!1,n.uvsNeedUpdate=!1,n.groupsNeedUpdate=!1,n=i}return!0===n.verticesNeedUpdate&&(void 0!==(e=this.attributes.position)&&(e.copyVector3sArray(n.vertices),e.needsUpdate=!0),n.verticesNeedUpdate=!1),!0===n.normalsNeedUpdate&&(void 0!==(e=this.attributes.normal)&&(e.copyVector3sArray(n.normals),e.needsUpdate=!0),n.normalsNeedUpdate=!1),!0===n.colorsNeedUpdate&&(void 0!==(e=this.attributes.color)&&(e.copyColorsArray(n.colors),e.needsUpdate=!0),n.colorsNeedUpdate=!1),n.uvsNeedUpdate&&(void 0!==(e=this.attributes.uv)&&(e.copyVector2sArray(n.uvs),e.needsUpdate=!0),n.uvsNeedUpdate=!1),n.lineDistancesNeedUpdate&&(void 0!==(e=this.attributes.lineDistance)&&(e.copyArray(n.lineDistances),e.needsUpdate=!0),n.lineDistancesNeedUpdate=!1),n.groupsNeedUpdate&&(n.computeGroups(t.geometry),this.groups=n.groups,n.groupsNeedUpdate=!1),this},fromGeometry:function(t){return t.__directGeometry=(new Ui).fromGeometry(t),this.fromDirectGeometry(t.__directGeometry)},fromDirectGeometry:function(t){var e=new Float32Array(3*t.vertices.length);if(this.addAttribute("position",new Mi(e,3).copyVector3sArray(t.vertices)),t.normals.length>0){var n=new Float32Array(3*t.normals.length);this.addAttribute("normal",new Mi(n,3).copyVector3sArray(t.normals))}if(t.colors.length>0){var i=new Float32Array(3*t.colors.length);this.addAttribute("color",new Mi(i,3).copyColorsArray(t.colors))}if(t.uvs.length>0){var r=new Float32Array(2*t.uvs.length);this.addAttribute("uv",new Mi(r,2).copyVector2sArray(t.uvs))}if(t.uvs2.length>0){var o=new Float32Array(2*t.uvs2.length);this.addAttribute("uv2",new Mi(o,2).copyVector2sArray(t.uvs2))}if(t.indices.length>0){var a=new(Ni(t.indices)>65535?Uint32Array:Uint16Array)(3*t.indices.length);this.setIndex(new Mi(a,1).copyIndicesArray(t.indices))}for(var s in this.groups=t.groups,t.morphTargets){for(var c=[],h=t.morphTargets[s],u=0,l=h.length;u<l;u++){var d=h[u],p=new Ci(3*d.length,3);c.push(p.copyVector3sArray(d))}this.morphAttributes[s]=c}if(t.skinIndices.length>0){var f=new Ci(4*t.skinIndices.length,4);this.addAttribute("skinIndex",f.copyVector4sArray(t.skinIndices))}if(t.skinWeights.length>0){var m=new Ci(4*t.skinWeights.length,4);this.addAttribute("skinWeight",m.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 ei);var t=this.attributes.position;void 0!==t?this.boundingBox.setFromBufferAttribute(t):this.boundingBox.makeEmpty(),(isNaN(this.boundingBox.min.x)||isNaN(this.boundingBox.min.y)||isNaN(this.boundingBox.min.z))&&console.error('THREE.BufferGeometry.computeBoundingBox: Computed min/max have NaN values. The "position" attribute is likely to have NaN values.',this)},computeBoundingSphere:function(){var t=new ei,e=new He;return function(){null===this.boundingSphere&&(this.boundingSphere=new ni);var n=this.attributes.position;if(n){var i=this.boundingSphere.center;t.setFromBufferAttribute(n),t.getCenter(i);for(var r=0,o=0,a=n.count;o<a;o++)e.x=n.getX(o),e.y=n.getY(o),e.z=n.getZ(o),r=Math.max(r,i.distanceToSquared(e));this.boundingSphere.radius=Math.sqrt(r),isNaN(this.boundingSphere.radius)&&console.error('THREE.BufferGeometry.computeBoundingSphere(): Computed radius is NaN. The "position" attribute is likely to have NaN values.',this)}}}(),computeFaceNormals:function(){},computeVertexNormals:function(){var t=this.index,e=this.attributes,n=this.groups;if(e.position){var i=e.position.array;if(void 0===e.normal)this.addAttribute("normal",new Mi(new Float32Array(i.length),3));else for(var r=e.normal.array,o=0,a=r.length;o<a;o++)r[o]=0;var s,c,h,u=e.normal.array,l=new He,d=new He,p=new He,f=new He,m=new He;if(t){var g=t.array;0===n.length&&this.addGroup(0,g.length);for(var v=0,y=n.length;v<y;++v){var x=n[v],b=x.start;for(o=b,a=b+x.count;o<a;o+=3)s=3*g[o+0],c=3*g[o+1],h=3*g[o+2],l.fromArray(i,s),d.fromArray(i,c),p.fromArray(i,h),f.subVectors(p,d),m.subVectors(l,d),f.cross(m),u[s]+=f.x,u[s+1]+=f.y,u[s+2]+=f.z,u[c]+=f.x,u[c+1]+=f.y,u[c+2]+=f.z,u[h]+=f.x,u[h+1]+=f.y,u[h+2]+=f.z}}else for(o=0,a=i.length;o<a;o+=9)l.fromArray(i,o),d.fromArray(i,o+3),p.fromArray(i,o+6),f.subVectors(p,d),m.subVectors(l,d),f.cross(m),u[o]=f.x,u[o+1]=f.y,u[o+2]=f.z,u[o+3]=f.x,u[o+4]=f.y,u[o+5]=f.z,u[o+6]=f.x,u[o+7]=f.y,u[o+8]=f.z;this.normalizeNormals(),e.normal.needsUpdate=!0}},merge:function(t,e){if(!1!==(t&&t.isBufferGeometry)){void 0===e&&(e=0);var n=this.attributes;for(var i in n)if(void 0!==t.attributes[i])for(var r=n[i].array,o=t.attributes[i],a=o.array,s=0,c=o.itemSize*e;s<a.length;s++,c++)r[c]=a[s];return this}console.error("THREE.BufferGeometry.merge(): geometry not an instance of THREE.BufferGeometry.",t)},normalizeNormals:function(){for(var t,e,n,i,r=this.attributes.normal,o=0,a=r.count;o<a;o++)t=r.getX(o),e=r.getY(o),n=r.getZ(o),i=1/Math.sqrt(t*t+e*e+n*n),r.setXYZ(o,t*i,e*i,n*i)},toNonIndexed:function(){if(null===this.index)return console.warn("THREE.BufferGeometry.toNonIndexed(): Geometry is already non-indexed."),this;var t=new zi,e=this.index.array,n=this.attributes;for(var i in n){for(var r=n[i],o=r.array,a=r.itemSize,s=new o.constructor(e.length*a),c=0,h=0,u=0,l=e.length;u<l;u++){c=e[u]*a;for(var d=0;d<a;d++)s[h++]=o[c++]}t.addAttribute(i,new Mi(s,a))}return t},toJSON:function(){var t={metadata:{version:4.5,type:"BufferGeometry",generator:"BufferGeometry.toJSON"}};if(t.uuid=this.uuid,t.type=this.type,""!==this.name&&(t.name=this.name),void 0!==this.parameters){var e=this.parameters;for(var n in e)void 0!==e[n]&&(t[n]=e[n]);return t}t.data={attributes:{}};var i=this.index;if(null!==i){var r=Array.prototype.slice.call(i.array);t.data.index={type:i.array.constructor.name,array:r}}var o=this.attributes;for(var n in o){var a=o[n];r=Array.prototype.slice.call(a.array);t.data.attributes[n]={itemSize:a.itemSize,type:a.array.constructor.name,array:r,normalized:a.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 zi).copy(this)},copy:function(t){var e,n,i;this.index=null,this.attributes={},this.morphAttributes={},this.groups=[],this.boundingBox=null,this.boundingSphere=null,this.name=t.name;var r=t.index;null!==r&&this.setIndex(r.clone());var o=t.attributes;for(e in o){var a=o[e];this.addAttribute(e,a.clone())}var s=t.morphAttributes;for(e in s){var c=[],h=s[e];for(n=0,i=h.length;n<i;n++)c.push(h[n].clone());this.morphAttributes[e]=c}var u=t.groups;for(n=0,i=u.length;n<i;n++){var l=u[n];this.addGroup(l.start,l.count,l.materialIndex)}var d=t.boundingBox;null!==d&&(this.boundingBox=d.clone());var p=t.boundingSphere;return null!==p&&(this.boundingSphere=p.clone()),this.drawRange.start=t.drawRange.start,this.drawRange.count=t.drawRange.count,this},dispose:function(){this.dispatchEvent({type:"dispose"})}}),Gi.prototype=Object.assign(Object.create(yi.prototype),{constructor:Gi,isMesh:!0,setDrawMode:function(t){this.drawMode=t},copy:function(t){return yi.prototype.copy.call(this,t),this.drawMode=t.drawMode,this},updateMorphTargets:function(){var t=this.geometry.morphTargets;if(void 0!==t&&t.length>0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(var e=0,n=t.length;e<n;e++)this.morphTargetInfluences.push(0),this.morphTargetDictionary[t[e].name]=e}},raycast:function(){var t=new Ve,e=new si,n=new ni,i=new He,r=new He,o=new He,a=new He,s=new He,c=new He,h=new Le,u=new Le,l=new Le,d=new He,p=new He,f=new He;function m(t,e,n,i,r,o,a){return bi.barycoordFromPoint(t,e,n,i,d),r.multiplyScalar(d.x),o.multiplyScalar(d.y),a.multiplyScalar(d.z),r.add(o).add(a),r.clone()}function g(t,e,n,i,r,o,a){var s=t.material;if(null===(s.side===w?n.intersectTriangle(o,r,i,!0,a):n.intersectTriangle(i,r,o,s.side!==M,a)))return null;f.copy(a),f.applyMatrix4(t.matrixWorld);var c=e.ray.origin.distanceTo(f);return c<e.near||c>e.far?null:{distance:c,point:f.clone(),object:t}}function v(t,e,n,a,s,c,d,f){i.fromBufferAttribute(a,c),r.fromBufferAttribute(a,d),o.fromBufferAttribute(a,f);var v=g(t,e,n,i,r,o,p);return v&&(s&&(h.fromBufferAttribute(s,c),u.fromBufferAttribute(s,d),l.fromBufferAttribute(s,f),v.uv=m(p,i,r,o,h,u,l)),v.face=new _i(c,d,f,bi.normal(i,r,o)),v.faceIndex=c),v}return function(d,f){var y,x=this.geometry,b=this.material,_=this.matrixWorld;if(void 0!==b&&(null===x.boundingSphere&&x.computeBoundingSphere(),n.copy(x.boundingSphere),n.applyMatrix4(_),!1!==d.ray.intersectsSphere(n)&&(t.getInverse(_),e.copy(d.ray).applyMatrix4(t),null===x.boundingBox||!1!==e.intersectsBox(x.boundingBox))))if(x.isBufferGeometry){var w,M,E,T,S,A=x.index,L=x.attributes.position,R=x.attributes.uv;if(null!==A)for(T=0,S=A.count;T<S;T+=3)w=A.getX(T),M=A.getX(T+1),E=A.getX(T+2),(y=v(this,d,e,L,R,w,M,E))&&(y.faceIndex=Math.floor(T/3),f.push(y));else for(T=0,S=L.count;T<S;T+=3)(y=v(this,d,e,L,R,w=T,M=T+1,E=T+2))&&(y.index=w,f.push(y))}else if(x.isGeometry){var P,C,I,U,N=Array.isArray(b),O=x.vertices,D=x.faces,F=x.faceVertexUvs[0];F.length>0&&(U=F);for(var B=0,z=D.length;B<z;B++){var G=D[B],H=N?b[G.materialIndex]:b;if(void 0!==H){if(P=O[G.a],C=O[G.b],I=O[G.c],!0===H.morphTargets){var V=x.morphTargets,k=this.morphTargetInfluences;i.set(0,0,0),r.set(0,0,0),o.set(0,0,0);for(var j=0,W=V.length;j<W;j++){var X=k[j];if(0!==X){var q=V[j].vertices;i.addScaledVector(a.subVectors(q[G.a],P),X),r.addScaledVector(s.subVectors(q[G.b],C),X),o.addScaledVector(c.subVectors(q[G.c],I),X)}}i.add(P),r.add(C),o.add(I),P=i,C=r,I=o}if(y=g(this,d,e,P,C,I,p)){if(U&&U[B]){var Y=U[B];h.copy(Y[0]),u.copy(Y[1]),l.copy(Y[2]),y.uv=m(p,P,C,I,h,u,l)}y.face=G,y.faceIndex=B,f.push(y)}}}}}}(),clone:function(){return new this.constructor(this.geometry,this.material).copy(this)}}),Hi.prototype=Object.create(Bi.prototype),Hi.prototype.constructor=Hi,Vi.prototype=Object.create(zi.prototype),Vi.prototype.constructor=Vi,ki.prototype=Object.create(Bi.prototype),ki.prototype.constructor=ki,ji.prototype=Object.create(zi.prototype),ji.prototype.constructor=ji,Wi.prototype=Object.assign(Object.create(yi.prototype),{constructor:Wi,isCamera:!0,copy:function(t){return yi.prototype.copy.call(this,t),this.matrixWorldInverse.copy(t.matrixWorldInverse),this.projectionMatrix.copy(t.projectionMatrix),this},getWorldDirection:function(){var t=new Ge;return function(e){var n=e||new He;return this.getWorldQuaternion(t),n.set(0,0,-1).applyQuaternion(t)}}(),clone:function(){return(new this.constructor).copy(this)}}),Xi.prototype=Object.assign(Object.create(Wi.prototype),{constructor:Xi,isPerspectiveCamera:!0,copy:function(t){return Wi.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*Ae.RAD2DEG*Math.atan(e),this.updateProjectionMatrix()},getFocalLength:function(){var t=Math.tan(.5*Ae.DEG2RAD*this.fov);return.5*this.getFilmHeight()/t},getEffectiveFOV:function(){return 2*Ae.RAD2DEG*Math.atan(Math.tan(.5*Ae.DEG2RAD*this.fov)/this.zoom)},getFilmWidth:function(){return this.filmGauge*Math.min(this.aspect,1)},getFilmHeight:function(){return this.filmGauge/Math.max(this.aspect,1)},setViewOffset:function(t,e,n,i,r,o){this.aspect=t/e,this.view={fullWidth:t,fullHeight:e,offsetX:n,offsetY:i,width:r,height:o},this.updateProjectionMatrix()},clearViewOffset:function(){this.view=null,this.updateProjectionMatrix()},updateProjectionMatrix:function(){var t=this.near,e=t*Math.tan(.5*Ae.DEG2RAD*this.fov)/this.zoom,n=2*e,i=this.aspect*n,r=-.5*i,o=this.view;if(null!==o){var a=o.fullWidth,s=o.fullHeight;r+=o.offsetX*i/a,e-=o.offsetY*n/s,i*=o.width/a,n*=o.height/s}var c=this.filmOffset;0!==c&&(r+=t*c/this.getFilmWidth()),this.projectionMatrix.makePerspective(r,r+i,e,e-n,t,this.far)},toJSON:function(t){var e=yi.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}}),qi.prototype=Object.assign(Object.create(Wi.prototype),{constructor:qi,isOrthographicCamera:!0,copy:function(t){return Wi.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,i,r,o){this.view={fullWidth:t,fullHeight:e,offsetX:n,offsetY:i,width:r,height:o},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,i=(this.top+this.bottom)/2,r=n-t,o=n+t,a=i+e,s=i-e;if(null!==this.view){var c=this.zoom/(this.view.width/this.view.fullWidth),h=this.zoom/(this.view.height/this.view.fullHeight),u=(this.right-this.left)/this.view.width,l=(this.top-this.bottom)/this.view.height;o=(r+=u*(this.view.offsetX/c))+u*(this.view.width/c),s=(a-=l*(this.view.offsetY/h))-l*(this.view.height/h)}this.projectionMatrix.makeOrthographic(r,o,a,s,this.near,this.far)},toJSON:function(t){var e=yi.prototype.toJSON.call(this,t);return e.object.zoom=this.zoom,e.object.left=this.left,e.object.right=this.right,e.object.top=this.top,e.object.bottom=this.bottom,e.object.near=this.near,e.object.far=this.far,null!==this.view&&(e.object.view=Object.assign({},this.view)),e}});var or,ar,sr,cr,hr,ur,lr=0;function dr(t){switch(t){case ve:return["Linear","( value )"];case ye:return["sRGB","( value )"];case be:return["RGBE","( value )"];case we:return["RGBM","( value, 7.0 )"];case Me:return["RGBM","( value, 16.0 )"];case Ee:return["RGBD","( value, 256.0 )"];case xe:return["Gamma","( value, float( GAMMA_FACTOR ) )"];default:throw new Error("unsupported encoding: "+t)}}function pr(t,e){var n=dr(e);return"vec4 "+t+"( vec4 value ) { return "+n[0]+"ToLinear"+n[1]+"; }"}function fr(t,e){var n;switch(e){case ht:n="Linear";break;case ut:n="Reinhard";break;case lt:n="Uncharted2";break;case dt:n="OptimizedCineon";break;default:throw new Error("unsupported toneMapping: "+e)}return"vec3 "+t+"( vec3 color ) { return "+n+"ToneMapping( color ); }"}function mr(t){return""!==t}function gr(t,e){return t.replace(/NUM_DIR_LIGHTS/g,e.numDirLights).replace(/NUM_SPOT_LIGHTS/g,e.numSpotLights).replace(/NUM_RECT_AREA_LIGHTS/g,e.numRectAreaLights).replace(/NUM_POINT_LIGHTS/g,e.numPointLights).replace(/NUM_HEMI_LIGHTS/g,e.numHemiLights)}function vr(t){return t.replace(/^[ \t]*#include +<([\w\d.]+)>/gm,function(t,e){var n=On[e];if(void 0===n)throw new Error("Can not resolve #include <"+e+">");return vr(n)})}function yr(t){return t.replace(/for \( int i \= (\d+)\; i < (\d+)\; i \+\+ \) \{([\s\S]+?)(?=\})\}/g,function(t,e,n,i){for(var r="",o=parseInt(e);o<parseInt(n);o++)r+=i.replace(/\[ i \]/g,"[ "+o+" ]");return r})}function xr(t,e,n,i){var r=t.context,o=n.extensions,a=n.defines,s=n.__webglShader.vertexShader,c=n.__webglShader.fragmentShader,h="SHADOWMAP_TYPE_BASIC";i.shadowMapType===x?h="SHADOWMAP_TYPE_PCF":i.shadowMapType===b&&(h="SHADOWMAP_TYPE_PCF_SOFT");var u="ENVMAP_TYPE_CUBE",l="ENVMAP_MODE_REFLECTION",d="ENVMAP_BLENDING_MULTIPLY";if(i.envMap){switch(n.envMap.mapping){case ft:case mt:u="ENVMAP_TYPE_CUBE";break;case xt:case bt:u="ENVMAP_TYPE_CUBE_UV";break;case gt:case vt:u="ENVMAP_TYPE_EQUIREC";break;case yt:u="ENVMAP_TYPE_SPHERE"}switch(n.envMap.mapping){case mt:case vt:l="ENVMAP_MODE_REFRACTION"}switch(n.combine){case ot:d="ENVMAP_BLENDING_MULTIPLY";break;case at:d="ENVMAP_BLENDING_MIX";break;case st:d="ENVMAP_BLENDING_ADD"}}var p,f,m,g,v,y=t.gammaFactor>0?t.gammaFactor:1,_=function(t,e,n){return[(t=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":""].filter(mr).join("\n")}(o,i,t.extensions),w=function(t){var e=[];for(var n in t){var i=t[n];!1!==i&&e.push("#define "+n+" "+i)}return e.join("\n")}(a),M=r.createProgram();n.isRawShaderMaterial?(p=[w,"\n"].filter(mr).join("\n"),f=[_,w,"\n"].filter(mr).join("\n")):(p=["precision "+i.precision+" float;","precision "+i.precision+" int;","#define SHADER_NAME "+n.__webglShader.name,w,i.supportsVertexTextures?"#define VERTEX_TEXTURES":"","#define GAMMA_FACTOR "+y,"#define MAX_BONES "+i.maxBones,i.useFog&&i.fog?"#define USE_FOG":"",i.useFog&&i.fogExp?"#define FOG_EXP2":"",i.map?"#define USE_MAP":"",i.envMap?"#define USE_ENVMAP":"",i.envMap?"#define "+l:"",i.lightMap?"#define USE_LIGHTMAP":"",i.aoMap?"#define USE_AOMAP":"",i.emissiveMap?"#define USE_EMISSIVEMAP":"",i.bumpMap?"#define USE_BUMPMAP":"",i.normalMap?"#define USE_NORMALMAP":"",i.displacementMap&&i.supportsVertexTextures?"#define USE_DISPLACEMENTMAP":"",i.specularMap?"#define USE_SPECULARMAP":"",i.roughnessMap?"#define USE_ROUGHNESSMAP":"",i.metalnessMap?"#define USE_METALNESSMAP":"",i.alphaMap?"#define USE_ALPHAMAP":"",i.vertexColors?"#define USE_COLOR":"",i.flatShading?"#define FLAT_SHADED":"",i.skinning?"#define USE_SKINNING":"",i.useVertexTexture?"#define BONE_TEXTURE":"",i.morphTargets?"#define USE_MORPHTARGETS":"",i.morphNormals&&!1===i.flatShading?"#define USE_MORPHNORMALS":"",i.doubleSided?"#define DOUBLE_SIDED":"",i.flipSided?"#define FLIP_SIDED":"","#define NUM_CLIPPING_PLANES "+i.numClippingPlanes,i.shadowMapEnabled?"#define USE_SHADOWMAP":"",i.shadowMapEnabled?"#define "+h:"",i.sizeAttenuation?"#define USE_SIZEATTENUATION":"",i.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",i.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(mr).join("\n"),f=[_,"precision "+i.precision+" float;","precision "+i.precision+" int;","#define SHADER_NAME "+n.__webglShader.name,w,i.alphaTest?"#define ALPHATEST "+i.alphaTest:"","#define GAMMA_FACTOR "+y,i.useFog&&i.fog?"#define USE_FOG":"",i.useFog&&i.fogExp?"#define FOG_EXP2":"",i.map?"#define USE_MAP":"",i.envMap?"#define USE_ENVMAP":"",i.envMap?"#define "+u:"",i.envMap?"#define "+l:"",i.envMap?"#define "+d:"",i.lightMap?"#define USE_LIGHTMAP":"",i.aoMap?"#define USE_AOMAP":"",i.emissiveMap?"#define USE_EMISSIVEMAP":"",i.bumpMap?"#define USE_BUMPMAP":"",i.normalMap?"#define USE_NORMALMAP":"",i.specularMap?"#define USE_SPECULARMAP":"",i.roughnessMap?"#define USE_ROUGHNESSMAP":"",i.metalnessMap?"#define USE_METALNESSMAP":"",i.alphaMap?"#define USE_ALPHAMAP":"",i.vertexColors?"#define USE_COLOR":"",i.gradientMap?"#define USE_GRADIENTMAP":"",i.flatShading?"#define FLAT_SHADED":"",i.doubleSided?"#define DOUBLE_SIDED":"",i.flipSided?"#define FLIP_SIDED":"","#define NUM_CLIPPING_PLANES "+i.numClippingPlanes,"#define UNION_CLIPPING_PLANES "+(i.numClippingPlanes-i.numClipIntersection),i.shadowMapEnabled?"#define USE_SHADOWMAP":"",i.shadowMapEnabled?"#define "+h:"",i.premultipliedAlpha?"#define PREMULTIPLIED_ALPHA":"",i.physicallyCorrectLights?"#define PHYSICALLY_CORRECT_LIGHTS":"",i.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",i.logarithmicDepthBuffer&&t.extensions.get("EXT_frag_depth")?"#define USE_LOGDEPTHBUF_EXT":"",i.envMap&&t.extensions.get("EXT_shader_texture_lod")?"#define TEXTURE_LOD_EXT":"","uniform mat4 viewMatrix;","uniform vec3 cameraPosition;",i.toneMapping!==ct?"#define TONE_MAPPING":"",i.toneMapping!==ct?On.tonemapping_pars_fragment:"",i.toneMapping!==ct?fr("toneMapping",i.toneMapping):"",i.dithering?"#define DITHERING":"",i.outputEncoding||i.mapEncoding||i.envMapEncoding||i.emissiveMapEncoding?On.encodings_pars_fragment:"",i.mapEncoding?pr("mapTexelToLinear",i.mapEncoding):"",i.envMapEncoding?pr("envMapTexelToLinear",i.envMapEncoding):"",i.emissiveMapEncoding?pr("emissiveMapTexelToLinear",i.emissiveMapEncoding):"",i.outputEncoding?(m="linearToOutputTexel",g=i.outputEncoding,v=dr(g),"vec4 "+m+"( vec4 value ) { return LinearTo"+v[0]+v[1]+"; }"):"",i.depthPacking?"#define DEPTH_PACKING "+n.depthPacking:"","\n"].filter(mr).join("\n")),s=gr(s=vr(s),i),c=gr(c=vr(c),i),n.isShaderMaterial||(s=yr(s),c=yr(c));var E=p+s,T=f+c,S=rr(r,r.VERTEX_SHADER,E),A=rr(r,r.FRAGMENT_SHADER,T);r.attachShader(M,S),r.attachShader(M,A),void 0!==n.index0AttributeName?r.bindAttribLocation(M,0,n.index0AttributeName):!0===i.morphTargets&&r.bindAttribLocation(M,0,"position"),r.linkProgram(M);var L,R,P=r.getProgramInfoLog(M),C=r.getShaderInfoLog(S),I=r.getShaderInfoLog(A),U=!0,N=!0;return!1===r.getProgramParameter(M,r.LINK_STATUS)?(U=!1,console.error("THREE.WebGLProgram: shader error: ",r.getError(),"gl.VALIDATE_STATUS",r.getProgramParameter(M,r.VALIDATE_STATUS),"gl.getProgramInfoLog",P,C,I)):""!==P?console.warn("THREE.WebGLProgram: gl.getProgramInfoLog()",P):""!==C&&""!==I||(N=!1),N&&(this.diagnostics={runnable:U,material:n,programLog:P,vertexShader:{log:C,prefix:p},fragmentShader:{log:I,prefix:f}}),r.deleteShader(S),r.deleteShader(A),this.getUniforms=function(){return void 0===L&&(L=new Pn(r,M,t)),L},this.getAttributes=function(){return void 0===R&&(R=function(t,e,n){for(var i={},r=t.getProgramParameter(e,t.ACTIVE_ATTRIBUTES),o=0;o<r;o++){var a=t.getActiveAttrib(e,o).name;i[a]=t.getAttribLocation(e,a)}return i}(r,M)),R},this.destroy=function(){r.deleteProgram(M),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=lr++,this.code=e,this.usedTimes=1,this.program=M,this.vertexShader=S,this.fragmentShader=A,this}function br(t,e){var n=[],i={MeshDepthMaterial:"depth",MeshNormalMaterial:"normal",MeshBasicMaterial:"basic",MeshLambertMaterial:"lambert",MeshPhongMaterial:"phong",MeshToonMaterial:"phong",MeshStandardMaterial:"physical",MeshPhysicalMaterial:"physical",LineBasicMaterial:"basic",LineDashedMaterial:"dashed",PointsMaterial:"points"},r=["precision","supportsVertexTextures","map","mapEncoding","envMap","envMapMode","envMapEncoding","lightMap","aoMap","emissiveMap","emissiveMapEncoding","bumpMap","normalMap","displacementMap","specularMap","roughnessMap","metalnessMap","gradientMap","alphaMap","combine","vertexColors","fog","useFog","fogExp","flatShading","sizeAttenuation","logarithmicDepthBuffer","skinning","maxBones","useVertexTexture","morphTargets","morphNormals","maxMorphTargets","maxMorphNormals","premultipliedAlpha","numDirLights","numPointLights","numSpotLights","numHemiLights","numRectAreaLights","shadowMapEnabled","shadowMapType","toneMapping","physicallyCorrectLights","alphaTest","doubleSided","flipSided","numClippingPlanes","numClipIntersection","depthPacking","dithering"];function o(t,e){var n;return t?t.isTexture?n=t.encoding:t.isWebGLRenderTarget&&(console.warn("THREE.WebGLPrograms.getTextureEncodingFromMap: don't use render targets as textures. Use their .texture property instead."),n=t.texture.encoding):n=ve,n===ve&&e&&(n=xe),n}this.getParameters=function(n,r,a,s,c,h){var u=i[n.type],l=h.isSkinnedMesh?function(t){var n=t.skeleton.bones;if(e.floatVertexTextures)return 1024;var i=e.maxVertexUniforms,r=Math.floor((i-20)/4),o=Math.min(r,n.length);return o<n.length?(console.warn("THREE.WebGLRenderer: Skeleton has "+n.length+" bones. This GPU supports "+o+"."),0):o}(h):0,d=t.getPrecision();null!==n.precision&&(d=e.getMaxPrecision(n.precision))!==n.precision&&console.warn("THREE.WebGLProgram.getParameters:",n.precision,"not supported, using",d,"instead.");var p=t.getRenderTarget();return{shaderID:u,precision:d,supportsVertexTextures:e.vertexTextures,outputEncoding:o(p?p.texture:null,t.gammaOutput),map:!!n.map,mapEncoding:o(n.map,t.gammaInput),envMap:!!n.envMap,envMapMode:n.envMap&&n.envMap.mapping,envMapEncoding:o(n.envMap,t.gammaInput),envMapCubeUV:!!n.envMap&&(n.envMap.mapping===xt||n.envMap.mapping===bt),lightMap:!!n.lightMap,aoMap:!!n.aoMap,emissiveMap:!!n.emissiveMap,emissiveMapEncoding:o(n.emissiveMap,t.gammaInput),bumpMap:!!n.bumpMap,normalMap:!!n.normalMap,displacementMap:!!n.displacementMap,roughnessMap:!!n.roughnessMap,metalnessMap:!!n.metalnessMap,specularMap:!!n.specularMap,alphaMap:!!n.alphaMap,gradientMap:!!n.gradientMap,combine:n.combine,vertexColors:n.vertexColors,fog:!!a,useFog:n.fog,fogExp:a&&a.isFogExp2,flatShading:n.shading===E,sizeAttenuation:n.sizeAttenuation,logarithmicDepthBuffer:e.logarithmicDepthBuffer,skinning:n.skinning&&l>0,maxBones:l,useVertexTexture:e.floatVertexTextures,morphTargets:n.morphTargets,morphNormals:n.morphNormals,maxMorphTargets:t.maxMorphTargets,maxMorphNormals:t.maxMorphNormals,numDirLights:r.directional.length,numPointLights:r.point.length,numSpotLights:r.spot.length,numRectAreaLights:r.rectArea.length,numHemiLights:r.hemi.length,numClippingPlanes:s,numClipIntersection:c,dithering:n.dithering,shadowMapEnabled:t.shadowMap.enabled&&h.receiveShadow&&r.shadows.length>0,shadowMapType:t.shadowMap.type,toneMapping:t.toneMapping,physicallyCorrectLights:t.physicallyCorrectLights,premultipliedAlpha:n.premultipliedAlpha,alphaTest:n.alphaTest,doubleSided:n.side===M,flipSided:n.side===w,depthPacking:void 0!==n.depthPacking&&n.depthPacking}},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 i in t.defines)n.push(i),n.push(t.defines[i]);for(var o=0;o<r.length;o++)n.push(e[r[o]]);return n.join()},this.acquireProgram=function(e,i,r){for(var o,a=0,s=n.length;a<s;a++){var c=n[a];if(c.code===r){++(o=c).usedTimes;break}}return void 0===o&&(o=new xr(t,r,e,i),n.push(o)),o},this.releaseProgram=function(t){if(0==--t.usedTimes){var e=n.indexOf(t);n[e]=n[n.length-1],n.pop(),t.destroy()}},this.programs=n}function _r(t,e,n,i,r,o,a){var s="undefined"!=typeof WebGL2RenderingContext&&t instanceof WebGL2RenderingContext;function c(t,e){if(t.width>e||t.height>e){var n=e/Math.max(t.width,t.height),i=document.createElementNS("http://www.w3.org/1999/xhtml","canvas");return i.width=Math.floor(t.width*n),i.height=Math.floor(t.height*n),i.getContext("2d").drawImage(t,0,0,t.width,t.height,0,0,i.width,i.height),console.warn("THREE.WebGLRenderer: image is too big ("+t.width+"x"+t.height+"). Resized to "+i.width+"x"+i.height,t),i}return t}function h(t){return Ae.isPowerOfTwo(t.width)&&Ae.isPowerOfTwo(t.height)}function u(e){return e===Et||e===Tt||e===St?t.NEAREST:t.LINEAR}function l(e){var n=e.target;n.removeEventListener("dispose",l),function(e){var n=i.get(e);if(e.image&&n.__image__webglTextureCube)t.deleteTexture(n.__image__webglTextureCube);else{if(void 0===n.__webglInit)return;t.deleteTexture(n.__webglTexture)}i.remove(e)}(n),a.textures--}function d(e){var n=e.target;n.removeEventListener("dispose",d),function(e){var n=i.get(e),r=i.get(e.texture);if(!e)return;void 0!==r.__webglTexture&&t.deleteTexture(r.__webglTexture);e.depthTexture&&e.depthTexture.dispose();if(e.isWebGLRenderTargetCube)for(var o=0;o<6;o++)t.deleteFramebuffer(n.__webglFramebuffer[o]),n.__webglDepthbuffer&&t.deleteRenderbuffer(n.__webglDepthbuffer[o]);else t.deleteFramebuffer(n.__webglFramebuffer),n.__webglDepthbuffer&&t.deleteRenderbuffer(n.__webglDepthbuffer);i.remove(e.texture),i.remove(e)}(n),a.textures--}function p(e,u){var d=i.get(e);if(e.version>0&&d.__version!==e.version){var p=e.image;if(void 0===p)console.warn("THREE.WebGLRenderer: Texture marked for update but image is undefined",e);else{if(!1!==p.complete)return void function(e,i,u){void 0===e.__webglInit&&(e.__webglInit=!0,i.addEventListener("dispose",l),e.__webglTexture=t.createTexture(),a.textures++);n.activeTexture(t.TEXTURE0+u),n.bindTexture(t.TEXTURE_2D,e.__webglTexture),t.pixelStorei(t.UNPACK_FLIP_Y_WEBGL,i.flipY),t.pixelStorei(t.UNPACK_PREMULTIPLY_ALPHA_WEBGL,i.premultiplyAlpha),t.pixelStorei(t.UNPACK_ALIGNMENT,i.unpackAlignment);var d=c(i.image,r.maxTextureSize);(function(t){return t.wrapS!==wt||t.wrapT!==wt||t.minFilter!==Et&&t.minFilter!==At})(i)&&!1===h(d)&&(d=function(t){if(t instanceof HTMLImageElement||t instanceof HTMLCanvasElement){var e=document.createElementNS("http://www.w3.org/1999/xhtml","canvas");return e.width=Ae.nearestPowerOfTwo(t.width),e.height=Ae.nearestPowerOfTwo(t.height),e.getContext("2d").drawImage(t,0,0,e.width,e.height),console.warn("THREE.WebGLRenderer: image is not power of two ("+t.width+"x"+t.height+"). Resized to "+e.width+"x"+e.height,t),e}return t}(d));var p=h(d),m=o(i.format),g=o(i.type);f(t.TEXTURE_2D,i,p);var v,y=i.mipmaps;if(i.isDepthTexture){var x=t.DEPTH_COMPONENT;if(i.type===Dt){if(!s)throw new Error("Float Depth Texture only supported in WebGL2.0");x=t.DEPTH_COMPONENT32F}else s&&(x=t.DEPTH_COMPONENT16);i.format===Yt&&x===t.DEPTH_COMPONENT&&i.type!==Ut&&i.type!==Ot&&(console.warn("THREE.WebGLRenderer: Use UnsignedShortType or UnsignedIntType for DepthFormat DepthTexture."),i.type=Ut,g=o(i.type)),i.format===Zt&&(x=t.DEPTH_STENCIL,i.type!==Ht&&(console.warn("THREE.WebGLRenderer: Use UnsignedInt248Type for DepthStencilFormat DepthTexture."),i.type=Ht,g=o(i.type))),n.texImage2D(t.TEXTURE_2D,0,x,d.width,d.height,0,m,g,null)}else if(i.isDataTexture)if(y.length>0&&p){for(var b=0,_=y.length;b<_;b++)v=y[b],n.texImage2D(t.TEXTURE_2D,b,m,v.width,v.height,0,m,g,v.data);i.generateMipmaps=!1}else n.texImage2D(t.TEXTURE_2D,0,m,d.width,d.height,0,m,g,d.data);else if(i.isCompressedTexture)for(var b=0,_=y.length;b<_;b++)v=y[b],i.format!==jt&&i.format!==kt?n.getCompressedTextureFormats().indexOf(m)>-1?n.compressedTexImage2D(t.TEXTURE_2D,b,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,b,m,v.width,v.height,0,m,g,v.data);else if(y.length>0&&p){for(var b=0,_=y.length;b<_;b++)v=y[b],n.texImage2D(t.TEXTURE_2D,b,m,m,g,v);i.generateMipmaps=!1}else n.texImage2D(t.TEXTURE_2D,0,m,m,g,d);i.generateMipmaps&&p&&t.generateMipmap(t.TEXTURE_2D);e.__version=i.version,i.onUpdate&&i.onUpdate(i)}(d,e,u);console.warn("THREE.WebGLRenderer: Texture marked for update but image is incomplete",e)}}n.activeTexture(t.TEXTURE0+u),n.bindTexture(t.TEXTURE_2D,d.__webglTexture)}function f(n,a,s){var c;if(s?(t.texParameteri(n,t.TEXTURE_WRAP_S,o(a.wrapS)),t.texParameteri(n,t.TEXTURE_WRAP_T,o(a.wrapT)),t.texParameteri(n,t.TEXTURE_MAG_FILTER,o(a.magFilter)),t.texParameteri(n,t.TEXTURE_MIN_FILTER,o(a.minFilter))):(t.texParameteri(n,t.TEXTURE_WRAP_S,t.CLAMP_TO_EDGE),t.texParameteri(n,t.TEXTURE_WRAP_T,t.CLAMP_TO_EDGE),a.wrapS===wt&&a.wrapT===wt||console.warn("THREE.WebGLRenderer: Texture is not power of two. Texture.wrapS and Texture.wrapT should be set to THREE.ClampToEdgeWrapping.",a),t.texParameteri(n,t.TEXTURE_MAG_FILTER,u(a.magFilter)),t.texParameteri(n,t.TEXTURE_MIN_FILTER,u(a.minFilter)),a.minFilter!==Et&&a.minFilter!==At&&console.warn("THREE.WebGLRenderer: Texture is not power of two. Texture.minFilter should be set to THREE.NearestFilter or THREE.LinearFilter.",a)),c=e.get("EXT_texture_filter_anisotropic")){if(a.type===Dt&&null===e.get("OES_texture_float_linear"))return;if(a.type===Ft&&null===e.get("OES_texture_half_float_linear"))return;(a.anisotropy>1||i.get(a).__currentAnisotropy)&&(t.texParameterf(n,c.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(a.anisotropy,r.getMaxAnisotropy())),i.get(a).__currentAnisotropy=a.anisotropy)}}function m(e,r,a,s){var c=o(r.texture.format),h=o(r.texture.type);n.texImage2D(s,0,c,r.width,r.height,0,c,h,null),t.bindFramebuffer(t.FRAMEBUFFER,e),t.framebufferTexture2D(t.FRAMEBUFFER,a,s,i.get(r.texture).__webglTexture,0),t.bindFramebuffer(t.FRAMEBUFFER,null)}function g(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 v(e){var n=i.get(e),r=!0===e.isWebGLRenderTargetCube;if(e.depthTexture){if(r)throw new Error("target.depthTexture not supported in Cube render targets");!function(e,n){if(n&&n.isWebGLRenderTargetCube)throw new Error("Depth Texture with cube render targets is not supported!");if(t.bindFramebuffer(t.FRAMEBUFFER,e),!n.depthTexture||!n.depthTexture.isDepthTexture)throw new Error("renderTarget.depthTexture must be an instance of THREE.DepthTexture");i.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),p(n.depthTexture,0);var r=i.get(n.depthTexture).__webglTexture;if(n.depthTexture.format===Yt)t.framebufferTexture2D(t.FRAMEBUFFER,t.DEPTH_ATTACHMENT,t.TEXTURE_2D,r,0);else{if(n.depthTexture.format!==Zt)throw new Error("Unknown depthTexture format");t.framebufferTexture2D(t.FRAMEBUFFER,t.DEPTH_STENCIL_ATTACHMENT,t.TEXTURE_2D,r,0)}}(n.__webglFramebuffer,e)}else if(r){n.__webglDepthbuffer=[];for(var o=0;o<6;o++)t.bindFramebuffer(t.FRAMEBUFFER,n.__webglFramebuffer[o]),n.__webglDepthbuffer[o]=t.createRenderbuffer(),g(n.__webglDepthbuffer[o],e)}else t.bindFramebuffer(t.FRAMEBUFFER,n.__webglFramebuffer),n.__webglDepthbuffer=t.createRenderbuffer(),g(n.__webglDepthbuffer,e);t.bindFramebuffer(t.FRAMEBUFFER,null)}this.setTexture2D=p,this.setTextureCube=function(e,s){var u=i.get(e);if(6===e.image.length)if(e.version>0&&u.__version!==e.version){u.__image__webglTextureCube||(e.addEventListener("dispose",l),u.__image__webglTextureCube=t.createTexture(),a.textures++),n.activeTexture(t.TEXTURE0+s),n.bindTexture(t.TEXTURE_CUBE_MAP,u.__image__webglTextureCube),t.pixelStorei(t.UNPACK_FLIP_Y_WEBGL,e.flipY);for(var d=e&&e.isCompressedTexture,p=e.image[0]&&e.image[0].isDataTexture,m=[],g=0;g<6;g++)m[g]=d||p?p?e.image[g].image:e.image[g]:c(e.image[g],r.maxCubemapSize);var v=h(m[0]),y=o(e.format),x=o(e.type);for(f(t.TEXTURE_CUBE_MAP,e,v),g=0;g<6;g++)if(d)for(var b,_=m[g].mipmaps,w=0,M=_.length;w<M;w++)b=_[w],e.format!==jt&&e.format!==kt?n.getCompressedTextureFormats().indexOf(y)>-1?n.compressedTexImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+g,w,y,b.width,b.height,0,b.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .setTextureCube()"):n.texImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+g,w,y,b.width,b.height,0,y,x,b.data);else p?n.texImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+g,0,y,m[g].width,m[g].height,0,y,x,m[g].data):n.texImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+g,0,y,y,x,m[g]);e.generateMipmaps&&v&&t.generateMipmap(t.TEXTURE_CUBE_MAP),u.__version=e.version,e.onUpdate&&e.onUpdate(e)}else n.activeTexture(t.TEXTURE0+s),n.bindTexture(t.TEXTURE_CUBE_MAP,u.__image__webglTextureCube)},this.setTextureCubeDynamic=function(e,r){n.activeTexture(t.TEXTURE0+r),n.bindTexture(t.TEXTURE_CUBE_MAP,i.get(e).__webglTexture)},this.setupRenderTarget=function(e){var r=i.get(e),o=i.get(e.texture);e.addEventListener("dispose",d),o.__webglTexture=t.createTexture(),a.textures++;var s=!0===e.isWebGLRenderTargetCube,c=h(e);if(s){r.__webglFramebuffer=[];for(var u=0;u<6;u++)r.__webglFramebuffer[u]=t.createFramebuffer()}else r.__webglFramebuffer=t.createFramebuffer();if(s){for(n.bindTexture(t.TEXTURE_CUBE_MAP,o.__webglTexture),f(t.TEXTURE_CUBE_MAP,e.texture,c),u=0;u<6;u++)m(r.__webglFramebuffer[u],e,t.COLOR_ATTACHMENT0,t.TEXTURE_CUBE_MAP_POSITIVE_X+u);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),f(t.TEXTURE_2D,e.texture,c),m(r.__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&&v(e)},this.updateRenderTargetMipmap=function(e){var r=e.texture;if(r.generateMipmaps&&h(e)&&r.minFilter!==Et&&r.minFilter!==At){var o=e&&e.isWebGLRenderTargetCube?t.TEXTURE_CUBE_MAP:t.TEXTURE_2D,a=i.get(r).__webglTexture;n.bindTexture(o,a),t.generateMipmap(o),n.bindTexture(o,null)}}}function wr(){var t={};return{get:function(e){var n=e.uuid,i=t[n];return void 0===i&&(i={},t[n]=i),i},remove:function(e){delete t[e.uuid]},clear:function(){t={}}}}function Mr(t,e,n){var i=new function(){var e=!1,n=new Fe,i=null,r=new Fe;return{setMask:function(n){i===n||e||(t.colorMask(n,n,n,n),i=n)},setLocked:function(t){e=t},setClear:function(e,i,o,a,s){!0===s&&(e*=a,i*=a,o*=a),n.set(e,i,o,a),!1===r.equals(n)&&(t.clearColor(e,i,o,a),r.copy(n))},reset:function(){e=!1,i=null,r.set(0,0,0,1)}}},r=new function(){var e=!1,n=null,i=null,r=null;return{setTest:function(e){e?X(t.DEPTH_TEST):q(t.DEPTH_TEST)},setMask:function(i){n===i||e||(t.depthMask(i),n=i)},setFunc:function(e){if(i!==e){if(e)switch(e){case Q:t.depthFunc(t.NEVER);break;case K:t.depthFunc(t.ALWAYS);break;case $:t.depthFunc(t.LESS);break;case tt:t.depthFunc(t.LEQUAL);break;case et:t.depthFunc(t.EQUAL);break;case nt:t.depthFunc(t.GEQUAL);break;case it:t.depthFunc(t.GREATER);break;case rt:t.depthFunc(t.NOTEQUAL);break;default:t.depthFunc(t.LEQUAL)}else t.depthFunc(t.LEQUAL);i=e}},setLocked:function(t){e=t},setClear:function(e){r!==e&&(t.clearDepth(e),r=e)},reset:function(){e=!1,n=null,i=null,r=null}}},o=new function(){var e=!1,n=null,i=null,r=null,o=null,a=null,s=null,c=null,h=null;return{setTest:function(e){e?X(t.STENCIL_TEST):q(t.STENCIL_TEST)},setMask:function(i){n===i||e||(t.stencilMask(i),n=i)},setFunc:function(e,n,a){i===e&&r===n&&o===a||(t.stencilFunc(e,n,a),i=e,r=n,o=a)},setOp:function(e,n,i){a===e&&s===n&&c===i||(t.stencilOp(e,n,i),a=e,s=n,c=i)},setLocked:function(t){e=t},setClear:function(e){h!==e&&(t.clearStencil(e),h=e)},reset:function(){e=!1,n=null,i=null,r=null,o=null,a=null,s=null,c=null,h=null}}},a=t.getParameter(t.MAX_VERTEX_ATTRIBS),s=new Uint8Array(a),c=new Uint8Array(a),h=new Uint8Array(a),u={},l=null,m=null,g=null,v=null,y=null,x=null,b=null,_=null,E=!1,T=null,S=null,A=null,L=null,O=null,D=null,F=t.getParameter(t.MAX_TEXTURE_IMAGE_UNITS),B=parseFloat(/^WebGL\ ([0-9])/.exec(t.getParameter(t.VERSION))[1]),z=parseFloat(B)>=1,G=null,H={},V=new Fe,k=new Fe;function j(e,n,i){var r=new Uint8Array(4),o=t.createTexture();t.bindTexture(e,o),t.texParameteri(e,t.TEXTURE_MIN_FILTER,t.NEAREST),t.texParameteri(e,t.TEXTURE_MAG_FILTER,t.NEAREST);for(var a=0;a<i;a++)t.texImage2D(n+a,0,t.RGBA,1,1,0,t.RGBA,t.UNSIGNED_BYTE,r);return o}var W={};function X(e){!0!==u[e]&&(t.enable(e),u[e]=!0)}function q(e){!1!==u[e]&&(t.disable(e),u[e]=!1)}function Y(e,i,r,o,a,s,c,h){e!==R?X(t.BLEND):q(t.BLEND),e===m&&h===E||(e===C?h?(t.blendEquationSeparate(t.FUNC_ADD,t.FUNC_ADD),t.blendFuncSeparate(t.ONE,t.ONE,t.ONE,t.ONE)):(t.blendEquation(t.FUNC_ADD),t.blendFunc(t.SRC_ALPHA,t.ONE)):e===I?h?(t.blendEquationSeparate(t.FUNC_ADD,t.FUNC_ADD),t.blendFuncSeparate(t.ZERO,t.ZERO,t.ONE_MINUS_SRC_COLOR,t.ONE_MINUS_SRC_ALPHA)):(t.blendEquation(t.FUNC_ADD),t.blendFunc(t.ZERO,t.ONE_MINUS_SRC_COLOR)):e===U?h?(t.blendEquationSeparate(t.FUNC_ADD,t.FUNC_ADD),t.blendFuncSeparate(t.ZERO,t.SRC_COLOR,t.ZERO,t.SRC_ALPHA)):(t.blendEquation(t.FUNC_ADD),t.blendFunc(t.ZERO,t.SRC_COLOR)):h?(t.blendEquationSeparate(t.FUNC_ADD,t.FUNC_ADD),t.blendFuncSeparate(t.ONE,t.ONE_MINUS_SRC_ALPHA,t.ONE,t.ONE_MINUS_SRC_ALPHA)):(t.blendEquationSeparate(t.FUNC_ADD,t.FUNC_ADD),t.blendFuncSeparate(t.SRC_ALPHA,t.ONE_MINUS_SRC_ALPHA,t.ONE,t.ONE_MINUS_SRC_ALPHA)),m=e,E=h),e===N?(a=a||i,s=s||r,c=c||o,i===g&&a===x||(t.blendEquationSeparate(n(i),n(a)),g=i,x=a),r===v&&o===y&&s===b&&c===_||(t.blendFuncSeparate(n(r),n(o),n(s),n(c)),v=r,y=o,b=s,_=c)):(g=null,v=null,y=null,x=null,b=null,_=null)}function Z(e){T!==e&&(e?t.frontFace(t.CW):t.frontFace(t.CCW),T=e)}function J(e){e!==d?(X(t.CULL_FACE),e!==S&&(e===p?t.cullFace(t.BACK):e===f?t.cullFace(t.FRONT):t.cullFace(t.FRONT_AND_BACK))):q(t.CULL_FACE),S=e}function ot(e,n,i){e?(X(t.POLYGON_OFFSET_FILL),L===n&&O===i||(t.polygonOffset(n,i),L=n,O=i)):q(t.POLYGON_OFFSET_FILL)}function at(e){void 0===e&&(e=t.TEXTURE0+F-1),G!==e&&(t.activeTexture(e),G=e)}return W[t.TEXTURE_2D]=j(t.TEXTURE_2D,t.TEXTURE_2D,1),W[t.TEXTURE_CUBE_MAP]=j(t.TEXTURE_CUBE_MAP,t.TEXTURE_CUBE_MAP_POSITIVE_X,6),{buffers:{color:i,depth:r,stencil:o},init:function(){i.setClear(0,0,0,1),r.setClear(1),o.setClear(0),X(t.DEPTH_TEST),r.setFunc(tt),Z(!1),J(p),X(t.CULL_FACE),X(t.BLEND),Y(P)},initAttributes:function(){for(var t=0,e=s.length;t<e;t++)s[t]=0},enableAttribute:function(n){s[n]=1,0===c[n]&&(t.enableVertexAttribArray(n),c[n]=1),0!==h[n]&&(e.get("ANGLE_instanced_arrays").vertexAttribDivisorANGLE(n,0),h[n]=0)},enableAttributeAndDivisor:function(n,i){s[n]=1,0===c[n]&&(t.enableVertexAttribArray(n),c[n]=1),h[n]!==i&&(e.get("ANGLE_instanced_arrays").vertexAttribDivisorANGLE(n,i),h[n]=i)},disableUnusedAttributes:function(){for(var e=0,n=c.length;e!==n;++e)c[e]!==s[e]&&(t.disableVertexAttribArray(e),c[e]=0)},enable:X,disable:q,getCompressedTextureFormats:function(){if(null===l&&(l=[],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),i=0;i<n.length;i++)l.push(n[i]);return l},setBlending:Y,setMaterial:function(e){e.side===M?q(t.CULL_FACE):X(t.CULL_FACE),Z(e.side===w),!0===e.transparent?Y(e.blending,e.blendEquation,e.blendSrc,e.blendDst,e.blendEquationAlpha,e.blendSrcAlpha,e.blendDstAlpha,e.premultipliedAlpha):Y(R),r.setFunc(e.depthFunc),r.setTest(e.depthTest),r.setMask(e.depthWrite),i.setMask(e.colorWrite),ot(e.polygonOffset,e.polygonOffsetFactor,e.polygonOffsetUnits)},setFlipSided:Z,setCullFace:J,setLineWidth:function(e){e!==A&&(z&&t.lineWidth(e),A=e)},setPolygonOffset:ot,getScissorTest:function(){return D},setScissorTest:function(e){D=e,e?X(t.SCISSOR_TEST):q(t.SCISSOR_TEST)},activeTexture:at,bindTexture:function(e,n){null===G&&at();var i=H[G];void 0===i&&(i={type:void 0,texture:void 0},H[G]=i),i.type===e&&i.texture===n||(t.bindTexture(e,n||W[e]),i.type=e,i.texture=n)},compressedTexImage2D:function(){try{t.compressedTexImage2D.apply(t,arguments)}catch(t){console.error(t)}},texImage2D:function(){try{t.texImage2D.apply(t,arguments)}catch(t){console.error(t)}},scissor:function(e){!1===V.equals(e)&&(t.scissor(e.x,e.y,e.z,e.w),V.copy(e))},viewport:function(e){!1===k.equals(e)&&(t.viewport(e.x,e.y,e.z,e.w),k.copy(e))},reset:function(){for(var e=0;e<c.length;e++)1===c[e]&&(t.disableVertexAttribArray(e),c[e]=0);u={},l=null,G=null,H={},m=null,T=null,S=null,i.reset(),r.reset(),o.reset()}}}function Er(t,e,n){var i;function r(e){if("highp"===e){if(t.getShaderPrecisionFormat(t.VERTEX_SHADER,t.HIGH_FLOAT).precision>0&&t.getShaderPrecisionFormat(t.FRAGMENT_SHADER,t.HIGH_FLOAT).precision>0)return"highp";e="mediump"}return"mediump"===e&&t.getShaderPrecisionFormat(t.VERTEX_SHADER,t.MEDIUM_FLOAT).precision>0&&t.getShaderPrecisionFormat(t.FRAGMENT_SHADER,t.MEDIUM_FLOAT).precision>0?"mediump":"lowp"}var o=void 0!==n.precision?n.precision:"highp",a=r(o);a!==o&&(console.warn("THREE.WebGLRenderer:",o,"not supported, using",a,"instead."),o=a);var s=!0===n.logarithmicDepthBuffer&&!!e.get("EXT_frag_depth"),c=t.getParameter(t.MAX_TEXTURE_IMAGE_UNITS),h=t.getParameter(t.MAX_VERTEX_TEXTURE_IMAGE_UNITS),u=t.getParameter(t.MAX_TEXTURE_SIZE),l=t.getParameter(t.MAX_CUBE_MAP_TEXTURE_SIZE),d=t.getParameter(t.MAX_VERTEX_ATTRIBS),p=t.getParameter(t.MAX_VERTEX_UNIFORM_VECTORS),f=t.getParameter(t.MAX_VARYING_VECTORS),m=t.getParameter(t.MAX_FRAGMENT_UNIFORM_VECTORS),g=h>0,v=!!e.get("OES_texture_float");return{getMaxAnisotropy:function(){if(void 0!==i)return i;var n=e.get("EXT_texture_filter_anisotropic");return i=null!==n?t.getParameter(n.MAX_TEXTURE_MAX_ANISOTROPY_EXT):0},getMaxPrecision:r,precision:o,logarithmicDepthBuffer:s,maxTextures:c,maxVertexTextures:h,maxTextureSize:u,maxCubemapSize:l,maxAttributes:d,maxVertexUniforms:p,maxVaryings:f,maxFragmentUniforms:m,vertexTextures:g,floatFragmentTextures:v,floatVertexTextures:g&&v}}function Tr(t){var e={};return{get:function(n){if(void 0!==e[n])return e[n];var i;switch(n){case"WEBGL_depth_texture":i=t.getExtension("WEBGL_depth_texture")||t.getExtension("MOZ_WEBGL_depth_texture")||t.getExtension("WEBKIT_WEBGL_depth_texture");break;case"EXT_texture_filter_anisotropic":i=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":i=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":i=t.getExtension("WEBGL_compressed_texture_pvrtc")||t.getExtension("WEBKIT_WEBGL_compressed_texture_pvrtc");break;case"WEBGL_compressed_texture_etc1":i=t.getExtension("WEBGL_compressed_texture_etc1");break;default:i=t.getExtension(n)}return null===i&&console.warn("THREE.WebGLRenderer: "+n+" extension not supported."),e[n]=i,i}}}function Sr(){var t=this,e=null,n=0,i=!1,r=!1,o=new ri,a=new ii,s={value:null,needsUpdate:!1};function c(){s.value!==e&&(s.value=e,s.needsUpdate=n>0),t.numPlanes=n,t.numIntersection=0}function h(e,n,i,r){var c=null!==e?e.length:0,h=null;if(0!==c){if(h=s.value,!0!==r||null===h){var u=i+4*c,l=n.matrixWorldInverse;a.getNormalMatrix(l),(null===h||h.length<u)&&(h=new Float32Array(u));for(var d=0,p=i;d!==c;++d,p+=4)o.copy(e[d]).applyMatrix4(l,a),o.normal.toArray(h,p),h[p+3]=o.constant}s.value=h,s.needsUpdate=!0}return t.numPlanes=c,h}this.uniform=s,this.numPlanes=0,this.numIntersection=0,this.init=function(t,r,o){var a=0!==t.length||r||0!==n||i;return i=r,e=h(t,o,0),n=t.length,a},this.beginShadows=function(){r=!0,h(null)},this.endShadows=function(){r=!1,c()},this.setState=function(t,o,a,u,l,d){if(!i||null===t||0===t.length||r&&!a)r?h(null):c();else{var p=r?0:n,f=4*p,m=l.clippingState||null;s.value=m,m=h(t,u,f,d);for(var g=0;g!==f;++g)m[g]=e[g];l.clippingState=m,this.numIntersection=o?this.numPlanes:0,this.numPlanes+=p}}}function Ar(t){console.log("THREE.WebGLRenderer",u);var e=void 0!==(t=t||{}).canvas?t.canvas:document.createElementNS("http://www.w3.org/1999/xhtml","canvas"),n=void 0!==t.context?t.context:null,i=void 0!==t.alpha&&t.alpha,r=void 0===t.depth||t.depth,o=void 0===t.stencil||t.stencil,a=void 0!==t.antialias&&t.antialias,s=void 0===t.premultipliedAlpha||t.premultipliedAlpha,c=void 0!==t.preserveDrawingBuffer&&t.preserveDrawingBuffer,h=[],l=null,d=new Float32Array(8),p=[],f=[];this.domElement=e,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=ht,this.toneMappingExposure=1,this.toneMappingWhitePoint=1,this.maxMorphTargets=8,this.maxMorphNormals=4;var m,v=this,y=null,x=null,b=null,_=-1,M="",T=null,A=new Fe,L=null,R=new Fe,P=0,C=new In(0),I=0,U=e.width,N=e.height,Q=1,K=new Fe(0,0,U,N),$=!1,tt=new Fe(0,0,U,N),et=new oi,nt=new Sr,it=!1,rt=!1,ot=new Ve,at=new He,st=new Ve,ct=new Ve,ut={hash:"",ambient:[0,0,0],directional:[],directionalShadowMap:[],directionalShadowMatrix:[],spot:[],spotShadowMap:[],spotShadowMatrix:[],rectArea:[],point:[],pointShadowMap:[],pointShadowMatrix:[],hemi:[],shadows:[]},lt={geometries:0,textures:0},dt={frame:0,calls:0,vertices:0,faces:0,points:0};this.info={render:dt,memory:lt,programs:null};try{var pt={alpha:i,depth:r,stencil:o,antialias:a,premultipliedAlpha:s,preserveDrawingBuffer:c};if(null===(m=n||e.getContext("webgl",pt)||e.getContext("experimental-webgl",pt)))throw null!==e.getContext("webgl")?"Error creating WebGL context with your selected attributes.":"Error creating WebGL context.";void 0===m.getShaderPrecisionFormat&&(m.getShaderPrecisionFormat=function(){return{rangeMin:1,rangeMax:1,precision:1}}),e.addEventListener("webglcontextlost",Ee,!1)}catch(t){console.error("THREE.WebGLRenderer: "+t)}var ft=new Tr(m);ft.get("WEBGL_depth_texture"),ft.get("OES_texture_float"),ft.get("OES_texture_float_linear"),ft.get("OES_texture_half_float"),ft.get("OES_texture_half_float_linear"),ft.get("OES_standard_derivatives"),ft.get("ANGLE_instanced_arrays"),ft.get("OES_element_index_uint")&&(zi.MaxIndex=4294967296);var mt=new Er(m,ft,t),gt=new Mr(m,ft,Be),vt=new wr,yt=new _r(m,ft,gt,vt,mt,Be,lt),xt=new Yi(m),bt=new er(m,xt,lt),qt=new ir(m,bt,dt),oe=new br(this,mt),ae=new nr,se=new Ki;this.info.programs=oe.programs;var ce,he,ue,le,de=new tr(m,ft,dt),pe=new $i(m,ft,dt);function ve(){return null===x?Q:1}function ye(){gt.init(),gt.scissor(A.copy(K).multiplyScalar(Q)),gt.viewport(R.copy(tt).multiplyScalar(Q)),gt.buffers.color.setClear(C.r,C.g,C.b,I,s)}function xe(){y=null,T=null,M="",_=-1,gt.reset()}ye(),this.context=m,this.capabilities=mt,this.extensions=ft,this.properties=vt,this.state=gt;var be=new ai(this,ut,qt,mt);this.shadowMap=be;var _e,we=new zn(this,p),Me=new Bn(this,f);function Ee(t){t.preventDefault(),xe(),ye(),vt.clear(),qt.clear()}function Te(t){var e=t.target;e.removeEventListener("dispose",Te),function(t){Se(t),vt.remove(t)}(e)}function Se(t){var e=vt.get(t).program;t.program=void 0,void 0!==e&&oe.releaseProgram(e)}function Le(t,e){return Math.abs(e[0])-Math.abs(t[0])}function Re(t,e,n,i){for(var r=0,o=t.length;r<o;r++){var a=t[r],s=a.object,c=a.geometry,h=void 0===i?a.material:i,u=a.group;if(s.onBeforeRender(v,e,n,c,h,u),n.isArrayCamera&&n.enabled)for(var l=n.cameras,d=0,p=l.length;d<p;d++){var f=l[d],m=f.bounds;v.setViewport(m.x*U*Q,m.y*N*Q,m.z*U*Q,m.w*N*Q),v.setScissor(m.x*U*Q,m.y*N*Q,m.z*U*Q,m.w*N*Q),v.setScissorTest(!0),Pe(s,e,f,c,h,u)}else Pe(s,e,n,c,h,u);s.onAfterRender(v,e,n,c,h,u)}}function Pe(t,e,n,i,r,o){if(t.modelViewMatrix.multiplyMatrices(n.matrixWorldInverse,t.matrixWorld),t.normalMatrix.getNormalMatrix(t.modelViewMatrix),t.isImmediateRenderObject){gt.setMaterial(r);var a=Ie(n,e.fog,r,t);M="",function(t,e,n){t.render(function(t){v.renderBufferImmediate(t,e,n)})}(t,a,r)}else v.renderBufferDirect(n,e.fog,i,r,t,o)}function Ce(t,e,n){var i=vt.get(t),r=oe.getParameters(t,ut,e,nt.numPlanes,nt.numIntersection,n),o=oe.getProgramCode(t,r),a=i.program,s=!0;if(void 0===a)t.addEventListener("dispose",Te);else if(a.code!==o)Se(t);else{if(void 0!==r.shaderID)return;s=!1}if(s){if(r.shaderID){var c=Dn[r.shaderID];i.__webglShader={name:t.type,uniforms:Nn.clone(c.uniforms),vertexShader:c.vertexShader,fragmentShader:c.fragmentShader}}else i.__webglShader={name:t.type,uniforms:t.uniforms,vertexShader:t.vertexShader,fragmentShader:t.fragmentShader};t.__webglShader=i.__webglShader,a=oe.acquireProgram(t,r,o),i.program=a,t.program=a}var h=a.getAttributes();if(t.morphTargets){t.numSupportedMorphTargets=0;for(var u=0;u<v.maxMorphTargets;u++)h["morphTarget"+u]>=0&&t.numSupportedMorphTargets++}if(t.morphNormals){t.numSupportedMorphNormals=0;for(u=0;u<v.maxMorphNormals;u++)h["morphNormal"+u]>=0&&t.numSupportedMorphNormals++}var l=i.__webglShader.uniforms;(t.isShaderMaterial||t.isRawShaderMaterial)&&!0!==t.clipping||(i.numClippingPlanes=nt.numPlanes,i.numIntersection=nt.numIntersection,l.clippingPlanes=nt.uniform),i.fog=e,i.lightsHash=ut.hash,t.lights&&(l.ambientLightColor.value=ut.ambient,l.directionalLights.value=ut.directional,l.spotLights.value=ut.spot,l.rectAreaLights.value=ut.rectArea,l.pointLights.value=ut.point,l.hemisphereLights.value=ut.hemi,l.directionalShadowMap.value=ut.directionalShadowMap,l.directionalShadowMatrix.value=ut.directionalShadowMatrix,l.spotShadowMap.value=ut.spotShadowMap,l.spotShadowMatrix.value=ut.spotShadowMatrix,l.pointShadowMap.value=ut.pointShadowMap,l.pointShadowMatrix.value=ut.pointShadowMatrix);var d=i.program.getUniforms(),p=Pn.seqWithValue(d.seq,l);i.uniformsList=p}function Ie(t,e,n,i){P=0;var r=vt.get(n);if(it&&(rt||t!==T)){var o=t===T&&n.id===_;nt.setState(n.clippingPlanes,n.clipIntersection,n.clipShadows,t,r,o)}!1===n.needsUpdate&&(void 0===r.program?n.needsUpdate=!0:n.fog&&r.fog!==e?n.needsUpdate=!0:n.lights&&r.lightsHash!==ut.hash?n.needsUpdate=!0:void 0===r.numClippingPlanes||r.numClippingPlanes===nt.numPlanes&&r.numIntersection===nt.numIntersection||(n.needsUpdate=!0)),n.needsUpdate&&(Ce(n,e,i),n.needsUpdate=!1);var a,s,c=!1,h=!1,u=!1,l=r.program,d=l.getUniforms(),p=r.__webglShader.uniforms;if(l.id!==y&&(m.useProgram(l.program),y=l.id,c=!0,h=!0,u=!0),n.id!==_&&(_=n.id,h=!0),c||t!==T){if(d.setValue(m,"projectionMatrix",t.projectionMatrix),mt.logarithmicDepthBuffer&&d.setValue(m,"logDepthBufFC",2/(Math.log(t.far+1)/Math.LN2)),t!==T&&(T=t,h=!0,u=!0),n.isShaderMaterial||n.isMeshPhongMaterial||n.isMeshStandardMaterial||n.envMap){var f=d.map.cameraPosition;void 0!==f&&f.setValue(m,at.setFromMatrixPosition(t.matrixWorld))}(n.isMeshPhongMaterial||n.isMeshLambertMaterial||n.isMeshBasicMaterial||n.isMeshStandardMaterial||n.isShaderMaterial||n.skinning)&&d.setValue(m,"viewMatrix",t.matrixWorldInverse),d.setValue(m,"toneMappingExposure",v.toneMappingExposure),d.setValue(m,"toneMappingWhitePoint",v.toneMappingWhitePoint)}if(n.skinning){d.setOptional(m,i,"bindMatrix"),d.setOptional(m,i,"bindMatrixInverse");var g=i.skeleton;if(g){var x=g.bones;if(mt.floatVertexTextures){if(void 0===g.boneTexture){var b=Math.sqrt(4*x.length);b=Ae.nextPowerOfTwo(Math.ceil(b)),b=Math.max(b,4);var w=new Float32Array(b*b*4);w.set(g.boneMatrices);var M=new ke(w,b,b,jt,Dt);g.boneMatrices=w,g.boneTexture=M,g.boneTextureSize=b}d.setValue(m,"boneTexture",g.boneTexture),d.setValue(m,"boneTextureSize",g.boneTextureSize)}else d.setOptional(m,g,"boneMatrices")}}return h&&(n.lights&&(s=u,(a=p).ambientLightColor.needsUpdate=s,a.directionalLights.needsUpdate=s,a.pointLights.needsUpdate=s,a.spotLights.needsUpdate=s,a.rectAreaLights.needsUpdate=s,a.hemisphereLights.needsUpdate=s),e&&n.fog&&function(t,e){t.fogColor.value=e.color,e.isFog?(t.fogNear.value=e.near,t.fogFar.value=e.far):e.isFogExp2&&(t.fogDensity.value=e.density)}(p,e),(n.isMeshBasicMaterial||n.isMeshLambertMaterial||n.isMeshPhongMaterial||n.isMeshStandardMaterial||n.isMeshNormalMaterial||n.isMeshDepthMaterial)&&function(t,e){t.opacity.value=e.opacity,t.diffuse.value=e.color,e.emissive&&t.emissive.value.copy(e.emissive).multiplyScalar(e.emissiveIntensity);t.map.value=e.map,t.specularMap.value=e.specularMap,t.alphaMap.value=e.alphaMap,e.lightMap&&(t.lightMap.value=e.lightMap,t.lightMapIntensity.value=e.lightMapIntensity);e.aoMap&&(t.aoMap.value=e.aoMap,t.aoMapIntensity.value=e.aoMapIntensity);var n;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);if(void 0!==n){n.isWebGLRenderTarget&&(n=n.texture);var i=n.offset,r=n.repeat;t.offsetRepeat.value.set(i.x,i.y,r.x,r.y)}t.envMap.value=e.envMap,t.flipEnvMap.value=e.envMap&&e.envMap.isCubeTexture?-1:1,t.reflectivity.value=e.reflectivity,t.refractionRatio.value=e.refractionRatio}(p,n),n.isLineBasicMaterial?Ue(p,n):n.isLineDashedMaterial?(Ue(p,n),function(t,e){t.dashSize.value=e.dashSize,t.totalSize.value=e.dashSize+e.gapSize,t.scale.value=e.scale}(p,n)):n.isPointsMaterial?function(t,e){if(t.diffuse.value=e.color,t.opacity.value=e.opacity,t.size.value=e.size*Q,t.scale.value=.5*N,t.map.value=e.map,null!==e.map){var n=e.map.offset,i=e.map.repeat;t.offsetRepeat.value.set(n.x,n.y,i.x,i.y)}}(p,n):n.isMeshLambertMaterial?function(t,e){e.emissiveMap&&(t.emissiveMap.value=e.emissiveMap)}(p,n):n.isMeshToonMaterial?function(t,e){Ne(t,e),e.gradientMap&&(t.gradientMap.value=e.gradientMap)}(p,n):n.isMeshPhongMaterial?Ne(p,n):n.isMeshPhysicalMaterial?function(t,e){t.clearCoat.value=e.clearCoat,t.clearCoatRoughness.value=e.clearCoatRoughness,Oe(t,e)}(p,n):n.isMeshStandardMaterial?Oe(p,n):n.isMeshDepthMaterial?n.displacementMap&&(p.displacementMap.value=n.displacementMap,p.displacementScale.value=n.displacementScale,p.displacementBias.value=n.displacementBias):n.isMeshNormalMaterial&&function(t,e){e.bumpMap&&(t.bumpMap.value=e.bumpMap,t.bumpScale.value=e.bumpScale);e.normalMap&&(t.normalMap.value=e.normalMap,t.normalScale.value.copy(e.normalScale));e.displacementMap&&(t.displacementMap.value=e.displacementMap,t.displacementScale.value=e.displacementScale,t.displacementBias.value=e.displacementBias)}(p,n),void 0!==p.ltcMat&&(p.ltcMat.value=Un.LTC_MAT_TEXTURE),void 0!==p.ltcMag&&(p.ltcMag.value=Un.LTC_MAG_TEXTURE),Pn.upload(m,r.uniformsList,p,v)),d.setValue(m,"modelViewMatrix",i.modelViewMatrix),d.setValue(m,"normalMatrix",i.normalMatrix),d.setValue(m,"modelMatrix",i.matrixWorld),l}function Ue(t,e){t.diffuse.value=e.color,t.opacity.value=e.opacity}function Ne(t,e){t.specular.value=e.specular,t.shininess.value=Math.max(e.shininess,1e-4),e.emissiveMap&&(t.emissiveMap.value=e.emissiveMap),e.bumpMap&&(t.bumpMap.value=e.bumpMap,t.bumpScale.value=e.bumpScale),e.normalMap&&(t.normalMap.value=e.normalMap,t.normalScale.value.copy(e.normalScale)),e.displacementMap&&(t.displacementMap.value=e.displacementMap,t.displacementScale.value=e.displacementScale,t.displacementBias.value=e.displacementBias)}function Oe(t,e){t.roughness.value=e.roughness,t.metalness.value=e.metalness,e.roughnessMap&&(t.roughnessMap.value=e.roughnessMap),e.metalnessMap&&(t.metalnessMap.value=e.metalnessMap),e.emissiveMap&&(t.emissiveMap.value=e.emissiveMap),e.bumpMap&&(t.bumpMap.value=e.bumpMap,t.bumpScale.value=e.bumpScale),e.normalMap&&(t.normalMap.value=e.normalMap,t.normalScale.value.copy(e.normalScale)),e.displacementMap&&(t.displacementMap.value=e.displacementMap,t.displacementScale.value=e.displacementScale,t.displacementBias.value=e.displacementBias),e.envMap&&(t.envMapIntensity.value=e.envMapIntensity)}function De(t,e){var n,i,r,o,a,s,c,h,u=0,l=0,d=0,p=e.matrixWorldInverse,f=0,m=0,g=0,v=0,y=0;for(n=0,i=t.length;n<i;n++)if(a=(r=t[n]).color,s=r.intensity,c=r.distance,h=r.shadow&&r.shadow.map?r.shadow.map.texture:null,r.isAmbientLight)u+=a.r*s,l+=a.g*s,d+=a.b*s;else if(r.isDirectionalLight){(x=ae.get(r)).color.copy(r.color).multiplyScalar(r.intensity),x.direction.setFromMatrixPosition(r.matrixWorld),at.setFromMatrixPosition(r.target.matrixWorld),x.direction.sub(at),x.direction.transformDirection(p),x.shadow=r.castShadow,r.castShadow&&(o=r.shadow,x.shadowBias=o.bias,x.shadowRadius=o.radius,x.shadowMapSize=o.mapSize),ut.directionalShadowMap[f]=h,ut.directionalShadowMatrix[f]=r.shadow.matrix,ut.directional[f]=x,f++}else if(r.isSpotLight){(x=ae.get(r)).position.setFromMatrixPosition(r.matrixWorld),x.position.applyMatrix4(p),x.color.copy(a).multiplyScalar(s),x.distance=c,x.direction.setFromMatrixPosition(r.matrixWorld),at.setFromMatrixPosition(r.target.matrixWorld),x.direction.sub(at),x.direction.transformDirection(p),x.coneCos=Math.cos(r.angle),x.penumbraCos=Math.cos(r.angle*(1-r.penumbra)),x.decay=0===r.distance?0:r.decay,x.shadow=r.castShadow,r.castShadow&&(o=r.shadow,x.shadowBias=o.bias,x.shadowRadius=o.radius,x.shadowMapSize=o.mapSize),ut.spotShadowMap[g]=h,ut.spotShadowMatrix[g]=r.shadow.matrix,ut.spot[g]=x,g++}else if(r.isRectAreaLight){(x=ae.get(r)).color.copy(a).multiplyScalar(s/(r.width*r.height)),x.position.setFromMatrixPosition(r.matrixWorld),x.position.applyMatrix4(p),ct.identity(),st.copy(r.matrixWorld),st.premultiply(p),ct.extractRotation(st),x.halfWidth.set(.5*r.width,0,0),x.halfHeight.set(0,.5*r.height,0),x.halfWidth.applyMatrix4(ct),x.halfHeight.applyMatrix4(ct),ut.rectArea[v]=x,v++}else if(r.isPointLight){(x=ae.get(r)).position.setFromMatrixPosition(r.matrixWorld),x.position.applyMatrix4(p),x.color.copy(r.color).multiplyScalar(r.intensity),x.distance=r.distance,x.decay=0===r.distance?0:r.decay,x.shadow=r.castShadow,r.castShadow&&(o=r.shadow,x.shadowBias=o.bias,x.shadowRadius=o.radius,x.shadowMapSize=o.mapSize),ut.pointShadowMap[m]=h,ut.pointShadowMatrix[m]=r.shadow.matrix,ut.point[m]=x,m++}else if(r.isHemisphereLight){var x;(x=ae.get(r)).direction.setFromMatrixPosition(r.matrixWorld),x.direction.transformDirection(p),x.direction.normalize(),x.skyColor.copy(r.color).multiplyScalar(s),x.groundColor.copy(r.groundColor).multiplyScalar(s),ut.hemi[y]=x,y++}ut.ambient[0]=u,ut.ambient[1]=l,ut.ambient[2]=d,ut.directional.length=f,ut.spot.length=g,ut.rectArea.length=v,ut.point.length=m,ut.hemi.length=y,ut.hash=f+","+m+","+g+","+v+","+y+","+ut.shadows.length}function Be(t){var e;if(t===_t)return m.REPEAT;if(t===wt)return m.CLAMP_TO_EDGE;if(t===Mt)return m.MIRRORED_REPEAT;if(t===Et)return m.NEAREST;if(t===Tt)return m.NEAREST_MIPMAP_NEAREST;if(t===St)return m.NEAREST_MIPMAP_LINEAR;if(t===At)return m.LINEAR;if(t===Lt)return m.LINEAR_MIPMAP_NEAREST;if(t===Rt)return m.LINEAR_MIPMAP_LINEAR;if(t===Pt)return m.UNSIGNED_BYTE;if(t===Bt)return m.UNSIGNED_SHORT_4_4_4_4;if(t===zt)return m.UNSIGNED_SHORT_5_5_5_1;if(t===Gt)return m.UNSIGNED_SHORT_5_6_5;if(t===Ct)return m.BYTE;if(t===It)return m.SHORT;if(t===Ut)return m.UNSIGNED_SHORT;if(t===Nt)return m.INT;if(t===Ot)return m.UNSIGNED_INT;if(t===Dt)return m.FLOAT;if(t===Ft&&null!==(e=ft.get("OES_texture_half_float")))return e.HALF_FLOAT_OES;if(t===Vt)return m.ALPHA;if(t===kt)return m.RGB;if(t===jt)return m.RGBA;if(t===Wt)return m.LUMINANCE;if(t===Xt)return m.LUMINANCE_ALPHA;if(t===Yt)return m.DEPTH_COMPONENT;if(t===Zt)return m.DEPTH_STENCIL;if(t===O)return m.FUNC_ADD;if(t===D)return m.FUNC_SUBTRACT;if(t===F)return m.FUNC_REVERSE_SUBTRACT;if(t===G)return m.ZERO;if(t===H)return m.ONE;if(t===V)return m.SRC_COLOR;if(t===k)return m.ONE_MINUS_SRC_COLOR;if(t===j)return m.SRC_ALPHA;if(t===W)return m.ONE_MINUS_SRC_ALPHA;if(t===X)return m.DST_ALPHA;if(t===q)return m.ONE_MINUS_DST_ALPHA;if(t===Y)return m.DST_COLOR;if(t===Z)return m.ONE_MINUS_DST_COLOR;if(t===J)return m.SRC_ALPHA_SATURATE;if((t===Jt||t===Qt||t===Kt||t===$t)&&null!==(e=ft.get("WEBGL_compressed_texture_s3tc"))){if(t===Jt)return e.COMPRESSED_RGB_S3TC_DXT1_EXT;if(t===Qt)return e.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(t===Kt)return e.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(t===$t)return e.COMPRESSED_RGBA_S3TC_DXT5_EXT}if((t===te||t===ee||t===ne||t===ie)&&null!==(e=ft.get("WEBGL_compressed_texture_pvrtc"))){if(t===te)return e.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(t===ee)return e.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(t===ne)return e.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(t===ie)return e.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}if(t===re&&null!==(e=ft.get("WEBGL_compressed_texture_etc1")))return e.COMPRESSED_RGB_ETC1_WEBGL;if((t===B||t===z)&&null!==(e=ft.get("EXT_blend_minmax"))){if(t===B)return e.MIN_EXT;if(t===z)return e.MAX_EXT}return t===Ht&&null!==(e=ft.get("WEBGL_depth_texture"))?e.UNSIGNED_INT_24_8_WEBGL:0}this.getContext=function(){return m},this.getContextAttributes=function(){return m.getContextAttributes()},this.forceContextLoss=function(){var t=ft.get("WEBGL_lose_context");t&&t.loseContext()},this.getMaxAnisotropy=function(){return mt.getMaxAnisotropy()},this.getPrecision=function(){return mt.precision},this.getPixelRatio=function(){return Q},this.setPixelRatio=function(t){void 0!==t&&(Q=t,this.setSize(tt.z,tt.w,!1))},this.getSize=function(){return{width:U,height:N}},this.setSize=function(t,n,i){U=t,N=n,e.width=t*Q,e.height=n*Q,!1!==i&&(e.style.width=t+"px",e.style.height=n+"px"),this.setViewport(0,0,t,n)},this.setViewport=function(t,e,n,i){gt.viewport(tt.set(t,e,n,i))},this.setScissor=function(t,e,n,i){gt.scissor(K.set(t,e,n,i))},this.setScissorTest=function(t){gt.setScissorTest($=t)},this.getClearColor=function(){return C},this.setClearColor=function(t,e){C.set(t),I=void 0!==e?e:1,gt.buffers.color.setClear(C.r,C.g,C.b,I,s)},this.getClearAlpha=function(){return I},this.setClearAlpha=function(t){I=t,gt.buffers.color.setClear(C.r,C.g,C.b,I,s)},this.clear=function(t,e,n){var i=0;(void 0===t||t)&&(i|=m.COLOR_BUFFER_BIT),(void 0===e||e)&&(i|=m.DEPTH_BUFFER_BIT),(void 0===n||n)&&(i|=m.STENCIL_BUFFER_BIT),m.clear(i)},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,i){this.setRenderTarget(t),this.clear(e,n,i)},this.resetGLState=xe,this.dispose=function(){e.removeEventListener("webglcontextlost",Ee,!1),se.dispose()},this.renderBufferImmediate=function(t,e,n){gt.initAttributes();var i=vt.get(t);t.hasPositions&&!i.position&&(i.position=m.createBuffer()),t.hasNormals&&!i.normal&&(i.normal=m.createBuffer()),t.hasUvs&&!i.uv&&(i.uv=m.createBuffer()),t.hasColors&&!i.color&&(i.color=m.createBuffer());var r=e.getAttributes();if(t.hasPositions&&(m.bindBuffer(m.ARRAY_BUFFER,i.position),m.bufferData(m.ARRAY_BUFFER,t.positionArray,m.DYNAMIC_DRAW),gt.enableAttribute(r.position),m.vertexAttribPointer(r.position,3,m.FLOAT,!1,0,0)),t.hasNormals){if(m.bindBuffer(m.ARRAY_BUFFER,i.normal),!n.isMeshPhongMaterial&&!n.isMeshStandardMaterial&&!n.isMeshNormalMaterial&&n.shading===E)for(var o=0,a=3*t.count;o<a;o+=9){var s=t.normalArray,c=(s[o+0]+s[o+3]+s[o+6])/3,h=(s[o+1]+s[o+4]+s[o+7])/3,u=(s[o+2]+s[o+5]+s[o+8])/3;s[o+0]=c,s[o+1]=h,s[o+2]=u,s[o+3]=c,s[o+4]=h,s[o+5]=u,s[o+6]=c,s[o+7]=h,s[o+8]=u}m.bufferData(m.ARRAY_BUFFER,t.normalArray,m.DYNAMIC_DRAW),gt.enableAttribute(r.normal),m.vertexAttribPointer(r.normal,3,m.FLOAT,!1,0,0)}t.hasUvs&&n.map&&(m.bindBuffer(m.ARRAY_BUFFER,i.uv),m.bufferData(m.ARRAY_BUFFER,t.uvArray,m.DYNAMIC_DRAW),gt.enableAttribute(r.uv),m.vertexAttribPointer(xt.uv,2,m.FLOAT,!1,0,0)),t.hasColors&&n.vertexColors!==S&&(m.bindBuffer(m.ARRAY_BUFFER,i.color),m.bufferData(m.ARRAY_BUFFER,t.colorArray,m.DYNAMIC_DRAW),gt.enableAttribute(r.color),m.vertexAttribPointer(r.color,3,m.FLOAT,!1,0,0)),gt.disableUnusedAttributes(),m.drawArrays(m.TRIANGLES,0,t.count),t.count=0},this.renderBufferDirect=function(t,e,n,i,r,o){gt.setMaterial(i);var a=Ie(t,e,i,r),s=n.id+"_"+a.id+"_"+(!0===i.wireframe),c=!1;s!==M&&(M=s,c=!0);var h=r.morphTargetInfluences;if(void 0!==h){for(var u=[],l=0,p=h.length;l<p;l++){var f=h[l];u.push([f,l])}u.sort(Le),u.length>8&&(u.length=8);var g=n.morphAttributes;for(l=0,p=u.length;l<p;l++){f=u[l];if(d[l]=f[0],0!==f[0]){var v=f[1];!0===i.morphTargets&&g.position&&n.addAttribute("morphTarget"+l,g.position[v]),!0===i.morphNormals&&g.normal&&n.addAttribute("morphNormal"+l,g.normal[v])}else!0===i.morphTargets&&n.removeAttribute("morphTarget"+l),!0===i.morphNormals&&n.removeAttribute("morphNormal"+l)}l=u.length;for(var y=d.length;l<y;l++)d[l]=0;a.getUniforms().setValue(m,"morphTargetInfluences",d),c=!0}v=n.index;var x=n.attributes.position,b=1;!0===i.wireframe&&(v=bt.getWireframeAttribute(n),b=2);var _=de;null!==v&&(_=pe).setIndex(v),c&&(!function(t,e,n,i){if(n&&n.isInstancedBufferGeometry&&null===ft.get("ANGLE_instanced_arrays"))return void console.error("THREE.WebGLRenderer.setupVertexAttributes: using THREE.InstancedBufferGeometry but hardware does not support extension ANGLE_instanced_arrays.");void 0===i&&(i=0);gt.initAttributes();var r=n.attributes,o=e.getAttributes(),a=t.defaultAttributeValues;for(var s in o){var c=o[s];if(c>=0){var h=r[s];if(void 0!==h){var u=h.normalized,l=h.itemSize,d=xt.get(h),p=d.buffer,f=d.type,g=d.bytesPerElement;if(h.isInterleavedBufferAttribute){var v=h.data,y=v.stride,x=h.offset;v&&v.isInstancedInterleavedBuffer?(gt.enableAttributeAndDivisor(c,v.meshPerAttribute),void 0===n.maxInstancedCount&&(n.maxInstancedCount=v.meshPerAttribute*v.count)):gt.enableAttribute(c),m.bindBuffer(m.ARRAY_BUFFER,p),m.vertexAttribPointer(c,l,f,u,y*g,(i*y+x)*g)}else h.isInstancedBufferAttribute?(gt.enableAttributeAndDivisor(c,h.meshPerAttribute),void 0===n.maxInstancedCount&&(n.maxInstancedCount=h.meshPerAttribute*h.count)):gt.enableAttribute(c),m.bindBuffer(m.ARRAY_BUFFER,p),m.vertexAttribPointer(c,l,f,u,0,i*l*g)}else if(void 0!==a){var b=a[s];if(void 0!==b)switch(b.length){case 2:m.vertexAttrib2fv(c,b);break;case 3:m.vertexAttrib3fv(c,b);break;case 4:m.vertexAttrib4fv(c,b);break;default:m.vertexAttrib1fv(c,b)}}}}gt.disableUnusedAttributes()}(i,a,n),null!==v&&m.bindBuffer(m.ELEMENT_ARRAY_BUFFER,xt.get(v).buffer));var w=0;null!==v?w=v.count:void 0!==x&&(w=x.count);var E=n.drawRange.start*b,T=n.drawRange.count*b,S=null!==o?o.start*b:0,A=null!==o?o.count*b:1/0,L=Math.max(E,S),R=Math.min(w,E+T,S+A)-1,P=Math.max(0,R-L+1);if(0!==P){if(r.isMesh)if(!0===i.wireframe)gt.setLineWidth(i.wireframeLinewidth*ve()),_.setMode(m.LINES);else switch(r.drawMode){case fe:_.setMode(m.TRIANGLES);break;case me:_.setMode(m.TRIANGLE_STRIP);break;case ge:_.setMode(m.TRIANGLE_FAN)}else if(r.isLine){var C=i.linewidth;void 0===C&&(C=1),gt.setLineWidth(C*ve()),r.isLineSegments?_.setMode(m.LINES):r.isLineLoop?_.setMode(m.LINE_LOOP):_.setMode(m.LINE_STRIP)}else r.isPoints&&_.setMode(m.POINTS);n&&n.isInstancedBufferGeometry?n.maxInstancedCount>0&&_.renderInstances(n,L,P):_.render(L,P)}},this.compile=function(t,e){h=[],t.traverse(function(t){t.isLight&&h.push(t)}),De(h,e),t.traverse(function(e){if(e.material)if(Array.isArray(e.material))for(var n=0;n<e.material.length;n++)Ce(e.material[n],t.fog,e);else Ce(e.material,t.fog,e)})},this.render=function(t,e,n,i){if(void 0===e||!0===e.isCamera){M="",_=-1,T=null,!0===t.autoUpdate&&t.updateMatrixWorld(),e.onBeforeRender(v),null===e.parent&&e.updateMatrixWorld(),e.matrixWorldInverse.getInverse(e.matrixWorld),ot.multiplyMatrices(e.projectionMatrix,e.matrixWorldInverse),et.setFromMatrix(ot),h.length=0,p.length=0,f.length=0,rt=this.localClippingEnabled,it=nt.init(this.clippingPlanes,rt,e),(l=se.get(t,e)).init(),function t(e,n,i){if(!e.visible)return;var r=e.layers.test(n.layers);if(r)if(e.isLight)h.push(e);else if(e.isSprite)e.frustumCulled&&!et.intersectsSprite(e)||p.push(e);else if(e.isLensFlare)f.push(e);else if(e.isImmediateRenderObject)i&&at.setFromMatrixPosition(e.matrixWorld).applyMatrix4(ot),l.push(e,null,e.material,at.z,null);else if((e.isMesh||e.isLine||e.isPoints)&&(e.isSkinnedMesh&&e.skeleton.update(),!e.frustumCulled||et.intersectsObject(e))){i&&at.setFromMatrixPosition(e.matrixWorld).applyMatrix4(ot);var o=qt.update(e),a=e.material;if(Array.isArray(a))for(var s=o.groups,c=0,u=s.length;c<u;c++){var d=s[c],m=a[d.materialIndex];m&&m.visible&&l.push(e,o,m,at.z,d)}else a.visible&&l.push(e,o,a,at.z,null)}var g=e.children;for(var c=0,u=g.length;c<u;c++)t(g[c],n,i)}(t,e,v.sortObjects),l.finish(),!0===v.sortObjects&&l.sort(),it&&nt.beginShadows(),function(t){for(var e=0,n=0,i=t.length;n<i;n++){var r=t[n];r.castShadow&&(ut.shadows[e]=r,e++)}ut.shadows.length=e}(h),be.render(t,e),De(h,e),it&&nt.endShadows(),dt.frame++,dt.calls=0,dt.vertices=0,dt.faces=0,dt.points=0,void 0===n&&(n=null),this.setRenderTarget(n);var r=t.background;null===r?gt.buffers.color.setClear(C.r,C.g,C.b,I,s):r&&r.isColor&&(gt.buffers.color.setClear(r.r,r.g,r.b,1,s),i=!0),(this.autoClear||i)&&this.clear(this.autoClearColor,this.autoClearDepth,this.autoClearStencil),r&&r.isCubeTexture?(void 0===ue&&(ue=new Xi,le=new Gi(new Vi(5,5,5),new $n({uniforms:Dn.cube.uniforms,vertexShader:Dn.cube.vertexShader,fragmentShader:Dn.cube.fragmentShader,side:w,depthTest:!1,depthWrite:!1,fog:!1}))),ue.projectionMatrix.copy(e.projectionMatrix),ue.matrixWorld.extractRotation(e.matrixWorld),ue.matrixWorldInverse.getInverse(ue.matrixWorld),le.material.uniforms.tCube.value=r,le.modelViewMatrix.multiplyMatrices(ue.matrixWorldInverse,le.matrixWorld),qt.update(le),v.renderBufferDirect(ue,null,le.geometry,le.material,le,null)):r&&r.isTexture&&(void 0===ce&&(ce=new qi(-1,1,1,-1,0,1),he=new Gi(new ji(2,2),new wi({depthTest:!1,depthWrite:!1,fog:!1}))),he.material.map=r,qt.update(he),v.renderBufferDirect(ce,null,he.geometry,he.material,he,null));var o=l.opaque,a=l.transparent;if(t.overrideMaterial){var c=t.overrideMaterial;o.length&&Re(o,t,e,c),a.length&&Re(a,t,e,c)}else o.length&&Re(o,t,e),a.length&&Re(a,t,e);we.render(t,e),Me.render(t,e,R),n&&yt.updateRenderTargetMipmap(n),gt.buffers.depth.setTest(!0),gt.buffers.depth.setMask(!0),gt.buffers.color.setMask(!0),e.isArrayCamera&&e.enabled&&v.setScissorTest(!1),e.onAfterRender(v)}else console.error("THREE.WebGLRenderer.render: camera is not an instance of THREE.Camera.")},this.setFaceCulling=function(t,e){gt.setCullFace(t),gt.setFlipSided(e===g)},this.allocTextureUnit=function(){var t=P;return t>=mt.maxTextures&&console.warn("WebGLRenderer: trying to use "+t+" texture units while this GPU supports only "+mt.maxTextures),P+=1,t},this.setTexture2D=(_e=!1,function(t,e){t&&t.isWebGLRenderTarget&&(_e||(console.warn("THREE.WebGLRenderer.setTexture2D: don't use render targets as textures. Use their .texture property instead."),_e=!0),t=t.texture),yt.setTexture2D(t,e)}),this.setTexture=function(){var t=!1;return function(e,n){t||(console.warn("THREE.WebGLRenderer: .setTexture is deprecated, use setTexture2D instead."),t=!0),yt.setTexture2D(e,n)}}(),this.setTextureCube=function(){var t=!1;return function(e,n){e&&e.isWebGLRenderTargetCube&&(t||(console.warn("THREE.WebGLRenderer.setTextureCube: don't use cube render targets as textures. Use their .texture property instead."),t=!0),e=e.texture),e&&e.isCubeTexture||Array.isArray(e.image)&&6===e.image.length?yt.setTextureCube(e,n):yt.setTextureCubeDynamic(e,n)}}(),this.getRenderTarget=function(){return x},this.setRenderTarget=function(t){x=t,t&&void 0===vt.get(t).__webglFramebuffer&&yt.setupRenderTarget(t);var e,n=t&&t.isWebGLRenderTargetCube;if(t){var i=vt.get(t);e=n?i.__webglFramebuffer[t.activeCubeFace]:i.__webglFramebuffer,A.copy(t.scissor),L=t.scissorTest,R.copy(t.viewport)}else e=null,A.copy(K).multiplyScalar(Q),L=$,R.copy(tt).multiplyScalar(Q);if(b!==e&&(m.bindFramebuffer(m.FRAMEBUFFER,e),b=e),gt.scissor(A),gt.setScissorTest(L),gt.viewport(R),n){var r=vt.get(t.texture);m.framebufferTexture2D(m.FRAMEBUFFER,m.COLOR_ATTACHMENT0,m.TEXTURE_CUBE_MAP_POSITIVE_X+t.activeCubeFace,r.__webglTexture,t.activeMipMapLevel)}},this.readRenderTargetPixels=function(t,e,n,i,r,o){if(!1!==(t&&t.isWebGLRenderTarget)){var a=vt.get(t).__webglFramebuffer;if(a){var s=!1;a!==b&&(m.bindFramebuffer(m.FRAMEBUFFER,a),s=!0);try{var c=t.texture,h=c.format,u=c.type;if(h!==jt&&Be(h)!==m.getParameter(m.IMPLEMENTATION_COLOR_READ_FORMAT))return void console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.");if(!(u===Pt||Be(u)===m.getParameter(m.IMPLEMENTATION_COLOR_READ_TYPE)||u===Dt&&(ft.get("OES_texture_float")||ft.get("WEBGL_color_buffer_float"))||u===Ft&&ft.get("EXT_color_buffer_half_float")))return void console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.");m.checkFramebufferStatus(m.FRAMEBUFFER)===m.FRAMEBUFFER_COMPLETE?e>=0&&e<=t.width-i&&n>=0&&n<=t.height-r&&m.readPixels(e,n,i,r,Be(h),Be(u),o):console.error("THREE.WebGLRenderer.readRenderTargetPixels: readPixels from renderTarget failed. Framebuffer not complete.")}finally{s&&m.bindFramebuffer(m.FRAMEBUFFER,b)}}}else console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.")}}function Lr(t,e){this.name="",this.color=new In(t),this.density=void 0!==e?e:25e-5}function Rr(t,e,n){this.name="",this.color=new In(t),this.near=void 0!==e?e:1,this.far=void 0!==n?n:1e3}function Pr(){yi.call(this),this.type="Scene",this.background=null,this.fog=null,this.overrideMaterial=null,this.autoUpdate=!0}function Cr(t,e,n,i,r){yi.call(this),this.lensFlares=[],this.positionScreen=new He,this.customUpdateCallback=void 0,void 0!==t&&this.add(t,e,n,i,r)}function Ir(t){Kn.call(this),this.type="SpriteMaterial",this.color=new In(16777215),this.map=null,this.rotation=0,this.fog=!1,this.lights=!1,this.setValues(t)}function Ur(t){yi.call(this),this.type="Sprite",this.material=void 0!==t?t:new Ir}function Nr(){yi.call(this),this.type="LOD",Object.defineProperties(this,{levels:{enumerable:!0,value:[]}})}function Or(t,e){if(t=t||[],this.bones=t.slice(0),this.boneMatrices=new Float32Array(16*this.bones.length),void 0===e)this.calculateInverses();else if(this.bones.length===e.length)this.boneInverses=e.slice(0);else{console.warn("THREE.Skeleton boneInverses is the wrong length."),this.boneInverses=[];for(var n=0,i=this.bones.length;n<i;n++)this.boneInverses.push(new Ve)}}function Dr(){yi.call(this),this.type="Bone"}function Fr(t,e){Gi.call(this,t,e),this.type="SkinnedMesh",this.bindMode="attached",this.bindMatrix=new Ve,this.bindMatrixInverse=new Ve;var n=new Or(this.initBones());this.bind(n,this.matrixWorld),this.normalizeSkinWeights()}function Br(t){Kn.call(this),this.type="LineBasicMaterial",this.color=new In(16777215),this.linewidth=1,this.linecap="round",this.linejoin="round",this.lights=!1,this.setValues(t)}function zr(t,e,n){if(1===n)return console.warn("THREE.Line: parameter THREE.LinePieces no longer supported. Created THREE.LineSegments instead."),new Gr(t,e);yi.call(this),this.type="Line",this.geometry=void 0!==t?t:new zi,this.material=void 0!==e?e:new Br({color:16777215*Math.random()})}function Gr(t,e){zr.call(this,t,e),this.type="LineSegments"}function Hr(t,e){zr.call(this,t,e),this.type="LineLoop"}function Vr(t){Kn.call(this),this.type="PointsMaterial",this.color=new In(16777215),this.map=null,this.size=1,this.sizeAttenuation=!0,this.lights=!1,this.setValues(t)}function kr(t,e){yi.call(this),this.type="Points",this.geometry=void 0!==t?t:new zi,this.material=void 0!==e?e:new Vr({color:16777215*Math.random()})}function jr(){yi.call(this),this.type="Group"}function Wr(t,e,n,i,r,o,a,s,c){De.call(this,t,e,n,i,r,o,a,s,c),this.generateMipmaps=!1;var h=this;!function e(){requestAnimationFrame(e),t.readyState>=t.HAVE_CURRENT_DATA&&(h.needsUpdate=!0)}()}function Xr(t,e,n,i,r,o,a,s,c,h,u,l){De.call(this,null,o,a,s,c,h,i,r,u,l),this.image={width:e,height:n},this.mipmaps=t,this.flipY=!1,this.generateMipmaps=!1}function qr(t,e,n,i,r,o,a,s,c){De.call(this,t,e,n,i,r,o,a,s,c),this.needsUpdate=!0}function Yr(t,e,n,i,r,o,a,s,c,h){if((h=void 0!==h?h:Yt)!==Yt&&h!==Zt)throw new Error("DepthTexture format must be either THREE.DepthFormat or THREE.DepthStencilFormat");void 0===n&&h===Yt&&(n=Ut),void 0===n&&h===Zt&&(n=Ht),De.call(this,null,i,r,o,a,s,h,n,c),this.image={width:t,height:e},this.magFilter=void 0!==a?a:Et,this.minFilter=void 0!==s?s:Et,this.flipY=!1,this.generateMipmaps=!1}function Zr(t){zi.call(this),this.type="WireframeGeometry";var e,n,i,r,o,a,s,c,h,u,l=[],d=[0,0],p={},f=["a","b","c"];if(t&&t.isGeometry){var m=t.faces;for(e=0,i=m.length;e<i;e++){var g=m[e];for(n=0;n<3;n++)s=g[f[n]],c=g[f[(n+1)%3]],d[0]=Math.min(s,c),d[1]=Math.max(s,c),void 0===p[h=d[0]+","+d[1]]&&(p[h]={index1:d[0],index2:d[1]})}for(h in p)a=p[h],u=t.vertices[a.index1],l.push(u.x,u.y,u.z),u=t.vertices[a.index2],l.push(u.x,u.y,u.z)}else if(t&&t.isBufferGeometry){var v,y,x,b,_,w,M;if(u=new He,null!==t.index){for(v=t.attributes.position,y=t.index,0===(x=t.groups).length&&(x=[{start:0,count:y.count,materialIndex:0}]),r=0,o=x.length;r<o;++r)for(e=_=(b=x[r]).start,i=_+b.count;e<i;e+=3)for(n=0;n<3;n++)s=y.getX(e+n),c=y.getX(e+(n+1)%3),d[0]=Math.min(s,c),d[1]=Math.max(s,c),void 0===p[h=d[0]+","+d[1]]&&(p[h]={index1:d[0],index2:d[1]});for(h in p)a=p[h],u.fromBufferAttribute(v,a.index1),l.push(u.x,u.y,u.z),u.fromBufferAttribute(v,a.index2),l.push(u.x,u.y,u.z)}else for(e=0,i=(v=t.attributes.position).count/3;e<i;e++)for(n=0;n<3;n++)w=3*e+n,u.fromBufferAttribute(v,w),l.push(u.x,u.y,u.z),M=3*e+(n+1)%3,u.fromBufferAttribute(v,M),l.push(u.x,u.y,u.z)}this.addAttribute("position",new Ci(l,3))}function Jr(t,e,n){Bi.call(this),this.type="ParametricGeometry",this.parameters={func:t,slices:e,stacks:n},this.fromBufferGeometry(new Qr(t,e,n)),this.mergeVertices()}function Qr(t,e,n){zi.call(this),this.type="ParametricBufferGeometry",this.parameters={func:t,slices:e,stacks:n};var i,r,o=[],a=[],s=[],c=[],h=new He,u=new He,l=new He,d=new He,p=new He,f=e+1;for(i=0;i<=n;i++){var m=i/n;for(r=0;r<=e;r++){var g=r/e;u=t(g,m,u),a.push(u.x,u.y,u.z),g-1e-5>=0?(l=t(g-1e-5,m,l),d.subVectors(u,l)):(l=t(g+1e-5,m,l),d.subVectors(l,u)),m-1e-5>=0?(l=t(g,m-1e-5,l),p.subVectors(u,l)):(l=t(g,m+1e-5,l),p.subVectors(l,u)),h.crossVectors(d,p).normalize(),s.push(h.x,h.y,h.z),c.push(g,m)}}for(i=0;i<n;i++)for(r=0;r<e;r++){var v=i*f+r,y=i*f+r+1,x=(i+1)*f+r+1,b=(i+1)*f+r;o.push(v,y,b),o.push(y,x,b)}this.setIndex(o),this.addAttribute("position",new Ci(a,3)),this.addAttribute("normal",new Ci(s,3)),this.addAttribute("uv",new Ci(c,2))}function Kr(t,e,n,i){Bi.call(this),this.type="PolyhedronGeometry",this.parameters={vertices:t,indices:e,radius:n,detail:i},this.fromBufferGeometry(new $r(t,e,n,i)),this.mergeVertices()}function $r(t,e,n,i){zi.call(this),this.type="PolyhedronBufferGeometry",this.parameters={vertices:t,indices:e,radius:n,detail:i},n=n||1;var r=[],o=[];function a(t,e,n,i){var r,o,a=Math.pow(2,i),c=[];for(r=0;r<=a;r++){c[r]=[];var h=t.clone().lerp(n,r/a),u=e.clone().lerp(n,r/a),l=a-r;for(o=0;o<=l;o++)c[r][o]=0===o&&r===a?h:h.clone().lerp(u,o/l)}for(r=0;r<a;r++)for(o=0;o<2*(a-r)-1;o++){var d=Math.floor(o/2);o%2==0?(s(c[r][d+1]),s(c[r+1][d]),s(c[r][d])):(s(c[r][d+1]),s(c[r+1][d+1]),s(c[r+1][d]))}}function s(t){r.push(t.x,t.y,t.z)}function c(e,n){var i=3*e;n.x=t[i+0],n.y=t[i+1],n.z=t[i+2]}function h(t,e,n,i){i<0&&1===t.x&&(o[e]=t.x-1),0===n.x&&0===n.z&&(o[e]=i/2/Math.PI+.5)}function u(t){return Math.atan2(t.z,-t.x)}!function(t){for(var n=new He,i=new He,r=new He,o=0;o<e.length;o+=3)c(e[o+0],n),c(e[o+1],i),c(e[o+2],r),a(n,i,r,t)}(i=i||0),function(t){for(var e=new He,n=0;n<r.length;n+=3)e.x=r[n+0],e.y=r[n+1],e.z=r[n+2],e.normalize().multiplyScalar(t),r[n+0]=e.x,r[n+1]=e.y,r[n+2]=e.z}(n),function(){for(var t=new He,e=0;e<r.length;e+=3){t.x=r[e+0],t.y=r[e+1],t.z=r[e+2];var n=u(t)/2/Math.PI+.5,i=(a=t,Math.atan2(-a.y,Math.sqrt(a.x*a.x+a.z*a.z))/Math.PI+.5);o.push(n,1-i)}var a;(function(){for(var t=new He,e=new He,n=new He,i=new He,a=new Le,s=new Le,c=new Le,l=0,d=0;l<r.length;l+=9,d+=6){t.set(r[l+0],r[l+1],r[l+2]),e.set(r[l+3],r[l+4],r[l+5]),n.set(r[l+6],r[l+7],r[l+8]),a.set(o[d+0],o[d+1]),s.set(o[d+2],o[d+3]),c.set(o[d+4],o[d+5]),i.copy(t).add(e).add(n).divideScalar(3);var p=u(i);h(a,d+0,t,p),h(s,d+2,e,p),h(c,d+4,n,p)}})(),function(){for(var t=0;t<o.length;t+=6){var e=o[t+0],n=o[t+2],i=o[t+4],r=Math.max(e,n,i),a=Math.min(e,n,i);r>.9&&a<.1&&(e<.2&&(o[t+0]+=1),n<.2&&(o[t+2]+=1),i<.2&&(o[t+4]+=1))}}()}(),this.addAttribute("position",new Ci(r,3)),this.addAttribute("normal",new Ci(r.slice(),3)),this.addAttribute("uv",new Ci(o,2)),this.normalizeNormals()}function to(t,e){Bi.call(this),this.type="TetrahedronGeometry",this.parameters={radius:t,detail:e},this.fromBufferGeometry(new eo(t,e)),this.mergeVertices()}function eo(t,e){$r.call(this,[1,1,1,-1,-1,1,-1,1,-1,1,-1,-1],[2,1,0,0,3,2,1,3,0,2,3,1],t,e),this.type="TetrahedronBufferGeometry",this.parameters={radius:t,detail:e}}function no(t,e){Bi.call(this),this.type="OctahedronGeometry",this.parameters={radius:t,detail:e},this.fromBufferGeometry(new io(t,e)),this.mergeVertices()}function io(t,e){$r.call(this,[1,0,0,-1,0,0,0,1,0,0,-1,0,0,0,1,0,0,-1],[0,2,4,0,4,3,0,3,5,0,5,2,1,2,5,1,5,3,1,3,4,1,4,2],t,e),this.type="OctahedronBufferGeometry",this.parameters={radius:t,detail:e}}function ro(t,e){Bi.call(this),this.type="IcosahedronGeometry",this.parameters={radius:t,detail:e},this.fromBufferGeometry(new oo(t,e)),this.mergeVertices()}function oo(t,e){var n=(1+Math.sqrt(5))/2,i=[-1,n,0,1,n,0,-1,-n,0,1,-n,0,0,-1,n,0,1,n,0,-1,-n,0,1,-n,n,0,-1,n,0,1,-n,0,-1,-n,0,1];$r.call(this,i,[0,11,5,0,5,1,0,1,7,0,7,10,0,10,11,1,5,9,5,11,4,11,10,2,10,7,6,7,1,8,3,9,4,3,4,2,3,2,6,3,6,8,3,8,9,4,9,5,2,4,11,6,2,10,8,6,7,9,8,1],t,e),this.type="IcosahedronBufferGeometry",this.parameters={radius:t,detail:e}}function ao(t,e){Bi.call(this),this.type="DodecahedronGeometry",this.parameters={radius:t,detail:e},this.fromBufferGeometry(new so(t,e)),this.mergeVertices()}function so(t,e){var n=(1+Math.sqrt(5))/2,i=1/n,r=[-1,-1,-1,-1,-1,1,-1,1,-1,-1,1,1,1,-1,-1,1,-1,1,1,1,-1,1,1,1,0,-i,-n,0,-i,n,0,i,-n,0,i,n,-i,-n,0,-i,n,0,i,-n,0,i,n,0,-n,0,-i,n,0,-i,-n,0,i,n,0,i];$r.call(this,r,[3,11,7,3,7,15,3,15,13,7,19,17,7,17,6,7,6,15,17,4,8,17,8,10,17,10,6,8,0,16,8,16,2,8,2,10,0,12,1,0,1,18,0,18,16,6,10,2,6,2,13,6,13,15,2,16,18,2,18,3,2,3,13,18,1,9,18,9,11,18,11,3,4,14,12,4,12,0,4,0,8,11,9,5,11,5,19,11,19,7,19,5,14,19,14,4,19,4,17,1,12,14,1,14,5,1,5,9],t,e),this.type="DodecahedronBufferGeometry",this.parameters={radius:t,detail:e}}function co(t,e,n,i,r,o){Bi.call(this),this.type="TubeGeometry",this.parameters={path:t,tubularSegments:e,radius:n,radialSegments:i,closed:r},void 0!==o&&console.warn("THREE.TubeGeometry: taper has been removed.");var a=new ho(t,e,n,i,r);this.tangents=a.tangents,this.normals=a.normals,this.binormals=a.binormals,this.fromBufferGeometry(a),this.mergeVertices()}function ho(t,e,n,i,r){zi.call(this),this.type="TubeBufferGeometry",this.parameters={path:t,tubularSegments:e,radius:n,radialSegments:i,closed:r},e=e||64,n=n||1,i=i||8,r=r||!1;var o=t.computeFrenetFrames(e,r);this.tangents=o.tangents,this.normals=o.normals,this.binormals=o.binormals;var a,s,c=new He,h=new He,u=new Le,l=[],d=[],p=[],f=[];function m(r){var a=t.getPointAt(r/e),u=o.normals[r],p=o.binormals[r];for(s=0;s<=i;s++){var f=s/i*Math.PI*2,m=Math.sin(f),g=-Math.cos(f);h.x=g*u.x+m*p.x,h.y=g*u.y+m*p.y,h.z=g*u.z+m*p.z,h.normalize(),d.push(h.x,h.y,h.z),c.x=a.x+n*h.x,c.y=a.y+n*h.y,c.z=a.z+n*h.z,l.push(c.x,c.y,c.z)}}!function(){for(a=0;a<e;a++)m(a);m(!1===r?e:0),function(){for(a=0;a<=e;a++)for(s=0;s<=i;s++)u.x=a/e,u.y=s/i,p.push(u.x,u.y)}(),function(){for(s=1;s<=e;s++)for(a=1;a<=i;a++){var t=(i+1)*(s-1)+(a-1),n=(i+1)*s+(a-1),r=(i+1)*s+a,o=(i+1)*(s-1)+a;f.push(t,n,o),f.push(n,r,o)}}()}(),this.setIndex(f),this.addAttribute("position",new Ci(l,3)),this.addAttribute("normal",new Ci(d,3)),this.addAttribute("uv",new Ci(p,2))}function uo(t,e,n,i,r,o,a){Bi.call(this),this.type="TorusKnotGeometry",this.parameters={radius:t,tube:e,tubularSegments:n,radialSegments:i,p:r,q:o},void 0!==a&&console.warn("THREE.TorusKnotGeometry: heightScale has been deprecated. Use .scale( x, y, z ) instead."),this.fromBufferGeometry(new lo(t,e,n,i,r,o)),this.mergeVertices()}function lo(t,e,n,i,r,o){zi.call(this),this.type="TorusKnotBufferGeometry",this.parameters={radius:t,tube:e,tubularSegments:n,radialSegments:i,p:r,q:o},t=t||100,e=e||40,n=Math.floor(n)||64,i=Math.floor(i)||8,r=r||2,o=o||3;var a,s,c=[],h=[],u=[],l=[],d=new He,p=new He,f=new He,m=new He,g=new He,v=new He,y=new He;for(a=0;a<=n;++a){var x=a/n*r*Math.PI*2;for(A(x,r,o,t,f),A(x+.01,r,o,t,m),v.subVectors(m,f),y.addVectors(m,f),g.crossVectors(v,y),y.crossVectors(g,v),g.normalize(),y.normalize(),s=0;s<=i;++s){var b=s/i*Math.PI*2,_=-e*Math.cos(b),w=e*Math.sin(b);d.x=f.x+(_*y.x+w*g.x),d.y=f.y+(_*y.y+w*g.y),d.z=f.z+(_*y.z+w*g.z),h.push(d.x,d.y,d.z),p.subVectors(d,f).normalize(),u.push(p.x,p.y,p.z),l.push(a/n),l.push(s/i)}}for(s=1;s<=n;s++)for(a=1;a<=i;a++){var M=(i+1)*(s-1)+(a-1),E=(i+1)*s+(a-1),T=(i+1)*s+a,S=(i+1)*(s-1)+a;c.push(M,E,S),c.push(E,T,S)}function A(t,e,n,i,r){var o=Math.cos(t),a=Math.sin(t),s=n/e*t,c=Math.cos(s);r.x=i*(2+c)*.5*o,r.y=i*(2+c)*a*.5,r.z=i*Math.sin(s)*.5}this.setIndex(c),this.addAttribute("position",new Ci(h,3)),this.addAttribute("normal",new Ci(u,3)),this.addAttribute("uv",new Ci(l,2))}function po(t,e,n,i,r){Bi.call(this),this.type="TorusGeometry",this.parameters={radius:t,tube:e,radialSegments:n,tubularSegments:i,arc:r},this.fromBufferGeometry(new fo(t,e,n,i,r)),this.mergeVertices()}function fo(t,e,n,i,r){zi.call(this),this.type="TorusBufferGeometry",this.parameters={radius:t,tube:e,radialSegments:n,tubularSegments:i,arc:r},t=t||100,e=e||40,n=Math.floor(n)||8,i=Math.floor(i)||6,r=r||2*Math.PI;var o,a,s=[],c=[],h=[],u=[],l=new He,d=new He,p=new He;for(o=0;o<=n;o++)for(a=0;a<=i;a++){var f=a/i*r,m=o/n*Math.PI*2;d.x=(t+e*Math.cos(m))*Math.cos(f),d.y=(t+e*Math.cos(m))*Math.sin(f),d.z=e*Math.sin(m),c.push(d.x,d.y,d.z),l.x=t*Math.cos(f),l.y=t*Math.sin(f),p.subVectors(d,l).normalize(),h.push(p.x,p.y,p.z),u.push(a/i),u.push(o/n)}for(o=1;o<=n;o++)for(a=1;a<=i;a++){var g=(i+1)*o+a-1,v=(i+1)*(o-1)+a-1,y=(i+1)*(o-1)+a,x=(i+1)*o+a;s.push(g,v,x),s.push(v,y,x)}this.setIndex(s),this.addAttribute("position",new Ci(c,3)),this.addAttribute("normal",new Ci(h,3)),this.addAttribute("uv",new Ci(u,2))}Lr.prototype.isFogExp2=!0,Lr.prototype.clone=function(){return new Lr(this.color.getHex(),this.density)},Lr.prototype.toJSON=function(t){return{type:"FogExp2",color:this.color.getHex(),density:this.density}},Rr.prototype.isFog=!0,Rr.prototype.clone=function(){return new Rr(this.color.getHex(),this.near,this.far)},Rr.prototype.toJSON=function(t){return{type:"Fog",color:this.color.getHex(),near:this.near,far:this.far}},Pr.prototype=Object.assign(Object.create(yi.prototype),{constructor:Pr,copy:function(t,e){return yi.prototype.copy.call(this,t,e),null!==t.background&&(this.background=t.background.clone()),null!==t.fog&&(this.fog=t.fog.clone()),null!==t.overrideMaterial&&(this.overrideMaterial=t.overrideMaterial.clone()),this.autoUpdate=t.autoUpdate,this.matrixAutoUpdate=t.matrixAutoUpdate,this},toJSON:function(t){var e=yi.prototype.toJSON.call(this,t);return null!==this.background&&(e.object.background=this.background.toJSON(t)),null!==this.fog&&(e.object.fog=this.fog.toJSON()),e}}),Cr.prototype=Object.assign(Object.create(yi.prototype),{constructor:Cr,isLensFlare:!0,copy:function(t){yi.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,i,r,o){void 0===e&&(e=-1),void 0===n&&(n=0),void 0===o&&(o=1),void 0===r&&(r=new In(16777215)),void 0===i&&(i=P),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:r,blending:i})},updateLensFlares:function(){var t,e,n=this.lensFlares.length,i=2*-this.positionScreen.x,r=2*-this.positionScreen.y;for(t=0;t<n;t++)(e=this.lensFlares[t]).x=this.positionScreen.x+i*e.distance,e.y=this.positionScreen.y+r*e.distance,e.wantedRotation=e.x*Math.PI*.25,e.rotation+=.25*(e.wantedRotation-e.rotation)}}),Ir.prototype=Object.create(Kn.prototype),Ir.prototype.constructor=Ir,Ir.prototype.isSpriteMaterial=!0,Ir.prototype.copy=function(t){return Kn.prototype.copy.call(this,t),this.color.copy(t.color),this.map=t.map,this.rotation=t.rotation,this},Ur.prototype=Object.assign(Object.create(yi.prototype),{constructor:Ur,isSprite:!0,raycast:(or=new He,ar=new He,sr=new He,function(t,e){ar.setFromMatrixPosition(this.matrixWorld),t.ray.closestPointToPoint(ar,or),sr.setFromMatrixScale(this.matrixWorld);var n=sr.x*sr.y/4;if(!(ar.distanceToSquared(or)>n)){var i=t.ray.origin.distanceTo(or);i<t.near||i>t.far||e.push({distance:i,point:or.clone(),face:null,object:this})}}),clone:function(){return new this.constructor(this.material).copy(this)}}),Nr.prototype=Object.assign(Object.create(yi.prototype),{constructor:Nr,copy:function(t){yi.prototype.copy.call(this,t,!1);for(var e=t.levels,n=0,i=e.length;n<i;n++){var r=e[n];this.addLevel(r.object.clone(),r.distance)}return this},addLevel:function(t,e){void 0===e&&(e=0),e=Math.abs(e);for(var n=this.levels,i=0;i<n.length&&!(e<n[i].distance);i++);n.splice(i,0,{distance:e,object:t}),this.add(t)},getObjectForDistance:function(t){for(var e=this.levels,n=1,i=e.length;n<i&&!(t<e[n].distance);n++);return e[n-1].object},raycast:(cr=new He,function(t,e){cr.setFromMatrixPosition(this.matrixWorld);var n=t.ray.origin.distanceTo(cr);this.getObjectForDistance(n).raycast(t,e)}),update:function(){var t=new He,e=new He;return function(n){var i=this.levels;if(i.length>1){t.setFromMatrixPosition(n.matrixWorld),e.setFromMatrixPosition(this.matrixWorld);var r=t.distanceTo(e);i[0].object.visible=!0;for(var o=1,a=i.length;o<a&&r>=i[o].distance;o++)i[o-1].object.visible=!1,i[o].object.visible=!0;for(;o<a;o++)i[o].object.visible=!1}}}(),toJSON:function(t){var e=yi.prototype.toJSON.call(this,t);e.object.levels=[];for(var n=this.levels,i=0,r=n.length;i<r;i++){var o=n[i];e.object.levels.push({object:o.object.uuid,distance:o.distance})}return e}}),Object.assign(Or.prototype,{calculateInverses:function(){this.boneInverses=[];for(var t=0,e=this.bones.length;t<e;t++){var n=new Ve;this.bones[t]&&n.getInverse(this.bones[t].matrixWorld),this.boneInverses.push(n)}},pose:function(){var t,e,n;for(e=0,n=this.bones.length;e<n;e++)(t=this.bones[e])&&t.matrixWorld.getInverse(this.boneInverses[e]);for(e=0,n=this.bones.length;e<n;e++)(t=this.bones[e])&&(t.parent&&t.parent.isBone?(t.matrix.getInverse(t.parent.matrixWorld),t.matrix.multiply(t.matrixWorld)):t.matrix.copy(t.matrixWorld),t.matrix.decompose(t.position,t.quaternion,t.scale))},update:(hr=new Ve,ur=new Ve,function(){for(var t=this.bones,e=this.boneInverses,n=this.boneMatrices,i=this.boneTexture,r=0,o=t.length;r<o;r++){var a=t[r]?t[r].matrixWorld:ur;hr.multiplyMatrices(a,e[r]),hr.toArray(n,16*r)}void 0!==i&&(i.needsUpdate=!0)}),clone:function(){return new Or(this.bones,this.boneInverses)}}),Dr.prototype=Object.assign(Object.create(yi.prototype),{constructor:Dr,isBone:!0}),Fr.prototype=Object.assign(Object.create(Gi.prototype),{constructor:Fr,isSkinnedMesh:!0,initBones:function(){var t,e,n,i,r=[];if(this.geometry&&void 0!==this.geometry.bones){for(n=0,i=this.geometry.bones.length;n<i;n++)e=this.geometry.bones[n],t=new Dr,r.push(t),t.name=e.name,t.position.fromArray(e.pos),t.quaternion.fromArray(e.rotq),void 0!==e.scl&&t.scale.fromArray(e.scl);for(n=0,i=this.geometry.bones.length;n<i;n++)-1!==(e=this.geometry.bones[n]).parent&&null!==e.parent&&void 0!==r[e.parent]?r[e.parent].add(r[n]):this.add(r[n])}return this.updateMatrixWorld(!0),r},bind:function(t,e){this.skeleton=t,void 0===e&&(this.updateMatrixWorld(!0),this.skeleton.calculateInverses(),e=this.matrixWorld),this.bindMatrix.copy(e),this.bindMatrixInverse.getInverse(e)},pose:function(){this.skeleton.pose()},normalizeSkinWeights:function(){var t,e;if(this.geometry&&this.geometry.isGeometry)for(e=0;e<this.geometry.skinWeights.length;e++){var n=this.geometry.skinWeights[e];(t=1/n.lengthManhattan())!==1/0?n.multiplyScalar(t):n.set(1,0,0,0)}else if(this.geometry&&this.geometry.isBufferGeometry){var i=new Fe,r=this.geometry.attributes.skinWeight;for(e=0;e<r.count;e++)i.x=r.getX(e),i.y=r.getY(e),i.z=r.getZ(e),i.w=r.getW(e),(t=1/i.lengthManhattan())!==1/0?i.multiplyScalar(t):i.set(1,0,0,0),r.setXYZW(e,i.x,i.y,i.z,i.w)}},updateMatrixWorld:function(t){Gi.prototype.updateMatrixWorld.call(this,t),"attached"===this.bindMode?this.bindMatrixInverse.getInverse(this.matrixWorld):"detached"===this.bindMode?this.bindMatrixInverse.getInverse(this.bindMatrix):console.warn("THREE.SkinnedMesh: Unrecognized bindMode: "+this.bindMode)},clone:function(){return new this.constructor(this.geometry,this.material).copy(this)}}),Br.prototype=Object.create(Kn.prototype),Br.prototype.constructor=Br,Br.prototype.isLineBasicMaterial=!0,Br.prototype.copy=function(t){return Kn.prototype.copy.call(this,t),this.color.copy(t.color),this.linewidth=t.linewidth,this.linecap=t.linecap,this.linejoin=t.linejoin,this},zr.prototype=Object.assign(Object.create(yi.prototype),{constructor:zr,isLine:!0,raycast:function(){var t=new Ve,e=new si,n=new ni;return function(i,r){var o=i.linePrecision,a=o*o,s=this.geometry,c=this.matrixWorld;if(null===s.boundingSphere&&s.computeBoundingSphere(),n.copy(s.boundingSphere),n.applyMatrix4(c),!1!==i.ray.intersectsSphere(n)){t.getInverse(c),e.copy(i.ray).applyMatrix4(t);var h=new He,u=new He,l=new He,d=new He,p=this&&this.isLineSegments?2:1;if(s.isBufferGeometry){var f=s.index,m=s.attributes.position.array;if(null!==f)for(var g=f.array,v=0,y=g.length-1;v<y;v+=p){var x=g[v],b=g[v+1];if(h.fromArray(m,3*x),u.fromArray(m,3*b),!(e.distanceSqToSegment(h,u,d,l)>a))d.applyMatrix4(this.matrixWorld),(M=i.ray.origin.distanceTo(d))<i.near||M>i.far||r.push({distance:M,point:l.clone().applyMatrix4(this.matrixWorld),index:v,face:null,faceIndex:null,object:this})}else for(v=0,y=m.length/3-1;v<y;v+=p){if(h.fromArray(m,3*v),u.fromArray(m,3*v+3),!(e.distanceSqToSegment(h,u,d,l)>a))d.applyMatrix4(this.matrixWorld),(M=i.ray.origin.distanceTo(d))<i.near||M>i.far||r.push({distance:M,point:l.clone().applyMatrix4(this.matrixWorld),index:v,face:null,faceIndex:null,object:this})}}else if(s.isGeometry){var _=s.vertices,w=_.length;for(v=0;v<w-1;v+=p){var M;if(!(e.distanceSqToSegment(_[v],_[v+1],d,l)>a))d.applyMatrix4(this.matrixWorld),(M=i.ray.origin.distanceTo(d))<i.near||M>i.far||r.push({distance:M,point:l.clone().applyMatrix4(this.matrixWorld),index:v,face:null,faceIndex:null,object:this})}}}}}(),clone:function(){return new this.constructor(this.geometry,this.material).copy(this)}}),Gr.prototype=Object.assign(Object.create(zr.prototype),{constructor:Gr,isLineSegments:!0}),Hr.prototype=Object.assign(Object.create(zr.prototype),{constructor:Hr,isLineLoop:!0}),Vr.prototype=Object.create(Kn.prototype),Vr.prototype.constructor=Vr,Vr.prototype.isPointsMaterial=!0,Vr.prototype.copy=function(t){return Kn.prototype.copy.call(this,t),this.color.copy(t.color),this.map=t.map,this.size=t.size,this.sizeAttenuation=t.sizeAttenuation,this},kr.prototype=Object.assign(Object.create(yi.prototype),{constructor:kr,isPoints:!0,raycast:function(){var t=new Ve,e=new si,n=new ni;return function(i,r){var o=this,a=this.geometry,s=this.matrixWorld,c=i.params.Points.threshold;if(null===a.boundingSphere&&a.computeBoundingSphere(),n.copy(a.boundingSphere),n.applyMatrix4(s),n.radius+=c,!1!==i.ray.intersectsSphere(n)){t.getInverse(s),e.copy(i.ray).applyMatrix4(t);var h=c/((this.scale.x+this.scale.y+this.scale.z)/3),u=h*h,l=new He;if(a.isBufferGeometry){var d=a.index,p=a.attributes.position.array;if(null!==d)for(var f=d.array,m=0,g=f.length;m<g;m++){var v=f[m];l.fromArray(p,3*v),b(l,v)}else{m=0;for(var y=p.length/3;m<y;m++)l.fromArray(p,3*m),b(l,m)}}else{var x=a.vertices;for(m=0,y=x.length;m<y;m++)b(x[m],m)}}function b(t,n){var a=e.distanceSqToPoint(t);if(a<u){var c=e.closestPointToPoint(t);c.applyMatrix4(s);var h=i.ray.origin.distanceTo(c);if(h<i.near||h>i.far)return;r.push({distance:h,distanceToRay:Math.sqrt(a),point:c.clone(),index:n,face:null,object:o})}}}}(),clone:function(){return new this.constructor(this.geometry,this.material).copy(this)}}),jr.prototype=Object.assign(Object.create(yi.prototype),{constructor:jr}),Wr.prototype=Object.create(De.prototype),Wr.prototype.constructor=Wr,Xr.prototype=Object.create(De.prototype),Xr.prototype.constructor=Xr,Xr.prototype.isCompressedTexture=!0,qr.prototype=Object.create(De.prototype),qr.prototype.constructor=qr,Yr.prototype=Object.create(De.prototype),Yr.prototype.constructor=Yr,Yr.prototype.isDepthTexture=!0,Zr.prototype=Object.create(zi.prototype),Zr.prototype.constructor=Zr,Jr.prototype=Object.create(Bi.prototype),Jr.prototype.constructor=Jr,Qr.prototype=Object.create(zi.prototype),Qr.prototype.constructor=Qr,Kr.prototype=Object.create(Bi.prototype),Kr.prototype.constructor=Kr,$r.prototype=Object.create(zi.prototype),$r.prototype.constructor=$r,to.prototype=Object.create(Bi.prototype),to.prototype.constructor=to,eo.prototype=Object.create($r.prototype),eo.prototype.constructor=eo,no.prototype=Object.create(Bi.prototype),no.prototype.constructor=no,io.prototype=Object.create($r.prototype),io.prototype.constructor=io,ro.prototype=Object.create(Bi.prototype),ro.prototype.constructor=ro,oo.prototype=Object.create($r.prototype),oo.prototype.constructor=oo,ao.prototype=Object.create(Bi.prototype),ao.prototype.constructor=ao,so.prototype=Object.create($r.prototype),so.prototype.constructor=so,co.prototype=Object.create(Bi.prototype),co.prototype.constructor=co,ho.prototype=Object.create(zi.prototype),ho.prototype.constructor=ho,uo.prototype=Object.create(Bi.prototype),uo.prototype.constructor=uo,lo.prototype=Object.create(zi.prototype),lo.prototype.constructor=lo,po.prototype=Object.create(Bi.prototype),po.prototype.constructor=po,fo.prototype=Object.create(zi.prototype),fo.prototype.constructor=fo;var mo={area:function(t){for(var e=t.length,n=0,i=e-1,r=0;r<e;i=r++)n+=t[i].x*t[r].y-t[r].x*t[i].y;return.5*n},triangulate:function(){function t(t,e,n,i,r,o){var a,s,c,h,u,l,d,p,f,m,g,v,y,x,b,_,w;if(s=t[o[e]].x,c=t[o[e]].y,h=t[o[n]].x,u=t[o[n]].y,l=t[o[i]].x,(h-s)*((d=t[o[i]].y)-c)-(u-c)*(l-s)<=0)return!1;for(m=l-h,g=d-u,v=s-l,y=c-d,x=h-s,b=u-c,a=0;a<r;a++)if(p=t[o[a]].x,f=t[o[a]].y,!(p===s&&f===c||p===h&&f===u||p===l&&f===d)&&(_=x*(f-c)-b*(p-s),w=v*(f-d)-y*(p-l),m*(f-u)-g*(p-h)>=-Number.EPSILON&&w>=-Number.EPSILON&&_>=-Number.EPSILON))return!1;return!0}return function(e,n){var i=e.length;if(i<3)return null;var r,o,a,s=[],c=[],h=[];if(mo.area(e)>0)for(o=0;o<i;o++)c[o]=o;else for(o=0;o<i;o++)c[o]=i-1-o;var u=i,l=2*u;for(o=u-1;u>2;){if(l--<=0)return console.warn("THREE.ShapeUtils: Unable to triangulate polygon! in triangulate()"),n?h:s;if(u<=(r=o)&&(r=0),u<=(o=r+1)&&(o=0),u<=(a=o+1)&&(a=0),t(e,r,o,a,u,c)){var d,p,f,m,g;for(d=c[r],p=c[o],f=c[a],s.push([e[d],e[p],e[f]]),h.push([c[r],c[o],c[a]]),m=o,g=o+1;g<u;m++,g++)c[m]=c[g];l=2*--u}}return n?h:s}}(),triangulateShape:function(t,e){function n(t){var e=t.length;e>2&&t[e-1].equals(t[0])&&t.pop()}function i(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,n,r,o){var a=e.x-t.x,s=e.y-t.y,c=r.x-n.x,h=r.y-n.y,u=t.x-n.x,l=t.y-n.y,d=s*c-a*h,p=s*u-a*l;if(Math.abs(d)>Number.EPSILON){var f;if(d>0){if(p<0||p>d)return[];if((f=h*u-c*l)<0||f>d)return[]}else{if(p>0||p<d)return[];if((f=h*u-c*l)>0||f<d)return[]}if(0===f)return!o||0!==p&&p!==d?[t]:[];if(f===d)return!o||0!==p&&p!==d?[e]:[];if(0===p)return[n];if(p===d)return[r];var m=f/d;return[{x:t.x+m*a,y:t.y+m*s}]}if(0!==p||h*u!=c*l)return[];var g,v,y,x,b,_,w,M,E=0===a&&0===s,T=0===c&&0===h;return E&&T?t.x!==n.x||t.y!==n.y?[]:[t]:E?i(n,r,t)?[t]:[]:T?i(t,e,n)?[n]:[]:(0!==a?(t.x<e.x?(g=t,y=t.x,v=e,x=e.x):(g=e,y=e.x,v=t,x=t.x),n.x<r.x?(b=n,w=n.x,_=r,M=r.x):(b=r,w=r.x,_=n,M=n.x)):(t.y<e.y?(g=t,y=t.y,v=e,x=e.y):(g=e,y=e.y,v=t,x=t.y),n.y<r.y?(b=n,w=n.y,_=r,M=r.y):(b=r,w=r.y,_=n,M=n.y)),y<=w?x<w?[]:x===w?o?[]:[b]:x<=M?[b,v]:[b,_]:y>M?[]:y===M?o?[]:[g]:x<=M?[g,v]:[g,_])}function o(t,e,n,i){var r=e.x-t.x,o=e.y-t.y,a=n.x-t.x,s=n.y-t.y,c=i.x-t.x,h=i.y-t.y,u=r*s-o*a,l=r*h-o*c;if(Math.abs(u)>Number.EPSILON){var d=c*s-h*a;return u>0?l>=0&&d>=0:l>=0||d>=0}return l>0}n(t),e.forEach(n);for(var a,s,c,h,u,l,d={},p=t.concat(),f=0,m=e.length;f<m;f++)Array.prototype.push.apply(p,e[f]);for(a=0,s=p.length;a<s;a++)void 0!==d[u=p[a].x+":"+p[a].y]&&console.warn("THREE.ShapeUtils: Duplicate point",u,a),d[u]=a;var g=function(t,e){var n,i=t.concat();function a(t,e){var r=i.length-1,a=t-1;a<0&&(a=r);var s=t+1;s>r&&(s=0);var c=o(i[t],i[a],i[s],n[e]);if(!c)return!1;var h=n.length-1,u=e-1;u<0&&(u=h);var l=e+1;return l>h&&(l=0),!!(c=o(n[e],n[u],n[l],i[t]))}function s(t,e){var n,o;for(n=0;n<i.length;n++)if(o=n+1,o%=i.length,r(t,e,i[n],i[o],!0).length>0)return!0;return!1}var c=[];function h(t,n){var i,o,a,s;for(i=0;i<c.length;i++)for(o=e[c[i]],a=0;a<o.length;a++)if(s=a+1,s%=o.length,r(t,n,o[a],o[s],!0).length>0)return!0;return!1}for(var u,l,d,p,f,m,g,v,y,x,b=[],_=0,w=e.length;_<w;_++)c.push(_);for(var M=0,E=2*c.length;c.length>0;){if(--E<0){console.log("Infinite Loop! Holes left:"+c.length+", Probably Hole outside Shape!");break}for(l=M;l<i.length;l++){for(d=i[l],u=-1,_=0;_<c.length;_++)if(f=c[_],void 0===b[m=d.x+":"+d.y+":"+f]){n=e[f];for(var T=0;T<n.length;T++)if(p=n[T],a(l,T)&&!s(d,p)&&!h(d,p)){u=T,c.splice(_,1),g=i.slice(0,l+1),v=i.slice(l),y=n.slice(u),x=n.slice(0,u+1),i=g.concat(y).concat(x).concat(v),M=l;break}if(u>=0)break;b[m]=!0}if(u>=0)break}}return i}(t,e),v=mo.triangulate(g,!1);for(a=0,s=v.length;a<s;a++)for(h=v[a],c=0;c<3;c++)void 0!==(l=d[u=h[c].x+":"+h[c].y])&&(h[c]=l);return v.concat()},isClockWise:function(t){return mo.area(t)<0}};function go(t,e){Bi.call(this),this.type="ExtrudeGeometry",this.parameters={shapes:t,options:e},this.fromBufferGeometry(new vo(t,e)),this.mergeVertices()}function vo(t,e){void 0!==t?(zi.call(this),this.type="ExtrudeBufferGeometry",t=Array.isArray(t)?t:[t],this.addShapeList(t,e),this.computeVertexNormals()):t=[]}function yo(t,e){Bi.call(this),this.type="TextGeometry",this.parameters={text:t,parameters:e},this.fromBufferGeometry(new xo(t,e)),this.mergeVertices()}function xo(t,e){var n=(e=e||{}).font;if(!1===(n&&n.isFont))return console.error("THREE.TextGeometry: font parameter is not an instance of THREE.Font."),new Bi;var i=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),vo.call(this,i,e),this.type="TextBufferGeometry"}function bo(t,e,n,i,r,o,a){Bi.call(this),this.type="SphereGeometry",this.parameters={radius:t,widthSegments:e,heightSegments:n,phiStart:i,phiLength:r,thetaStart:o,thetaLength:a},this.fromBufferGeometry(new _o(t,e,n,i,r,o,a)),this.mergeVertices()}function _o(t,e,n,i,r,o,a){zi.call(this),this.type="SphereBufferGeometry",this.parameters={radius:t,widthSegments:e,heightSegments:n,phiStart:i,phiLength:r,thetaStart:o,thetaLength:a},t=t||50,e=Math.max(3,Math.floor(e)||8),n=Math.max(2,Math.floor(n)||6),i=void 0!==i?i:0,r=void 0!==r?r:2*Math.PI;var s,c,h=(o=void 0!==o?o:0)+(a=void 0!==a?a:Math.PI),u=0,l=[],d=new He,p=new He,f=[],m=[],g=[],v=[];for(c=0;c<=n;c++){var y=[],x=c/n;for(s=0;s<=e;s++){var b=s/e;d.x=-t*Math.cos(i+b*r)*Math.sin(o+x*a),d.y=t*Math.cos(o+x*a),d.z=t*Math.sin(i+b*r)*Math.sin(o+x*a),m.push(d.x,d.y,d.z),p.set(d.x,d.y,d.z).normalize(),g.push(p.x,p.y,p.z),v.push(b,1-x),y.push(u++)}l.push(y)}for(c=0;c<n;c++)for(s=0;s<e;s++){var _=l[c][s+1],w=l[c][s],M=l[c+1][s],E=l[c+1][s+1];(0!==c||o>0)&&f.push(_,w,E),(c!==n-1||h<Math.PI)&&f.push(w,M,E)}this.setIndex(f),this.addAttribute("position",new Ci(m,3)),this.addAttribute("normal",new Ci(g,3)),this.addAttribute("uv",new Ci(v,2))}function wo(t,e,n,i,r,o){Bi.call(this),this.type="RingGeometry",this.parameters={innerRadius:t,outerRadius:e,thetaSegments:n,phiSegments:i,thetaStart:r,thetaLength:o},this.fromBufferGeometry(new Mo(t,e,n,i,r,o)),this.mergeVertices()}function Mo(t,e,n,i,r,o){zi.call(this),this.type="RingBufferGeometry",this.parameters={innerRadius:t,outerRadius:e,thetaSegments:n,phiSegments:i,thetaStart:r,thetaLength:o},t=t||20,e=e||50,r=void 0!==r?r:0,o=void 0!==o?o:2*Math.PI,n=void 0!==n?Math.max(3,n):8;var a,s,c,h=[],u=[],l=[],d=[],p=t,f=(e-t)/(i=void 0!==i?Math.max(1,i):1),m=new He,g=new Le;for(s=0;s<=i;s++){for(c=0;c<=n;c++)a=r+c/n*o,m.x=p*Math.cos(a),m.y=p*Math.sin(a),u.push(m.x,m.y,m.z),l.push(0,0,1),g.x=(m.x/e+1)/2,g.y=(m.y/e+1)/2,d.push(g.x,g.y);p+=f}for(s=0;s<i;s++){var v=s*(n+1);for(c=0;c<n;c++){var y=a=c+v,x=a+n+1,b=a+n+2,_=a+1;h.push(y,x,_),h.push(x,b,_)}}this.setIndex(h),this.addAttribute("position",new Ci(u,3)),this.addAttribute("normal",new Ci(l,3)),this.addAttribute("uv",new Ci(d,2))}function Eo(t,e,n,i){Bi.call(this),this.type="LatheGeometry",this.parameters={points:t,segments:e,phiStart:n,phiLength:i},this.fromBufferGeometry(new To(t,e,n,i)),this.mergeVertices()}function To(t,e,n,i){zi.call(this),this.type="LatheBufferGeometry",this.parameters={points:t,segments:e,phiStart:n,phiLength:i},e=Math.floor(e)||12,n=n||0,i=i||2*Math.PI,i=Ae.clamp(i,0,2*Math.PI);var r,o,a,s=[],c=[],h=[],u=1/e,l=new He,d=new Le;for(o=0;o<=e;o++){var p=n+o*u*i,f=Math.sin(p),m=Math.cos(p);for(a=0;a<=t.length-1;a++)l.x=t[a].x*f,l.y=t[a].y,l.z=t[a].x*m,c.push(l.x,l.y,l.z),d.x=o/e,d.y=a/(t.length-1),h.push(d.x,d.y)}for(o=0;o<e;o++)for(a=0;a<t.length-1;a++){var g=r=a+o*t.length,v=r+t.length,y=r+t.length+1,x=r+1;s.push(g,v,x),s.push(v,y,x)}if(this.setIndex(s),this.addAttribute("position",new Ci(c,3)),this.addAttribute("uv",new Ci(h,2)),this.computeVertexNormals(),i===2*Math.PI){var b=this.attributes.normal.array,_=new He,w=new He,M=new He;for(r=e*t.length*3,o=0,a=0;o<t.length;o++,a+=3)_.x=b[a+0],_.y=b[a+1],_.z=b[a+2],w.x=b[r+a+0],w.y=b[r+a+1],w.z=b[r+a+2],M.addVectors(_,w).normalize(),b[a+0]=b[r+a+0]=M.x,b[a+1]=b[r+a+1]=M.y,b[a+2]=b[r+a+2]=M.z}}function So(t,e){Bi.call(this),this.type="ShapeGeometry","object"==typeof e&&(console.warn("THREE.ShapeGeometry: Options parameter has been removed."),e=e.curveSegments),this.parameters={shapes:t,curveSegments:e},this.fromBufferGeometry(new Ao(t,e)),this.mergeVertices()}function Ao(t,e){zi.call(this),this.type="ShapeBufferGeometry",this.parameters={shapes:t,curveSegments:e},e=e||12;var n=[],i=[],r=[],o=[],a=0,s=0;if(!1===Array.isArray(t))h(t);else for(var c=0;c<t.length;c++)h(t[c]),this.addGroup(a,s,c),a+=s,s=0;function h(t){var a,c,h,u=i.length/3,l=t.extractPoints(e),d=l.shape,p=l.holes;if(!1===mo.isClockWise(d))for(d=d.reverse(),a=0,c=p.length;a<c;a++)h=p[a],!0===mo.isClockWise(h)&&(p[a]=h.reverse());var f=mo.triangulateShape(d,p);for(a=0,c=p.length;a<c;a++)h=p[a],d=d.concat(h);for(a=0,c=d.length;a<c;a++){var m=d[a];i.push(m.x,m.y,0),r.push(0,0,1),o.push(m.x,m.y)}for(a=0,c=f.length;a<c;a++){var g=f[a],v=g[0]+u,y=g[1]+u,x=g[2]+u;n.push(v,y,x),s+=3}}this.setIndex(n),this.addAttribute("position",new Ci(i,3)),this.addAttribute("normal",new Ci(r,3)),this.addAttribute("uv",new Ci(o,2))}function Lo(t,e){zi.call(this),this.type="EdgesGeometry",this.parameters={thresholdAngle:e},e=void 0!==e?e:1;var n,i,r,o,a=[],s=Math.cos(Ae.DEG2RAD*e),c=[0,0],h={},u=["a","b","c"];t.isBufferGeometry?(o=new Bi).fromBufferGeometry(t):o=t.clone(),o.mergeVertices(),o.computeFaceNormals();for(var l=o.vertices,d=o.faces,p=0,f=d.length;p<f;p++)for(var m=d[p],g=0;g<3;g++)n=m[u[g]],i=m[u[(g+1)%3]],c[0]=Math.min(n,i),c[1]=Math.max(n,i),void 0===h[r=c[0]+","+c[1]]?h[r]={index1:c[0],index2:c[1],face1:p,face2:void 0}:h[r].face2=p;for(r in h){var v=h[r];if(void 0===v.face2||d[v.face1].normal.dot(d[v.face2].normal)<=s){var y=l[v.index1];a.push(y.x,y.y,y.z),y=l[v.index2],a.push(y.x,y.y,y.z)}}this.addAttribute("position",new Ci(a,3))}function Ro(t,e,n,i,r,o,a,s){Bi.call(this),this.type="CylinderGeometry",this.parameters={radiusTop:t,radiusBottom:e,height:n,radialSegments:i,heightSegments:r,openEnded:o,thetaStart:a,thetaLength:s},this.fromBufferGeometry(new Po(t,e,n,i,r,o,a,s)),this.mergeVertices()}function Po(t,e,n,i,r,o,a,s){zi.call(this),this.type="CylinderBufferGeometry",this.parameters={radiusTop:t,radiusBottom:e,height:n,radialSegments:i,heightSegments:r,openEnded:o,thetaStart:a,thetaLength:s};var c=this;t=void 0!==t?t:20,e=void 0!==e?e:20,n=void 0!==n?n:100,i=Math.floor(i)||8,r=Math.floor(r)||1,o=void 0!==o&&o,a=void 0!==a?a:0,s=void 0!==s?s:2*Math.PI;var h=[],u=[],l=[],d=[],p=0,f=[],m=n/2,g=0;function v(n){var r,o,f,v=new Le,y=new He,x=0,b=!0===n?t:e,_=!0===n?1:-1;for(o=p,r=1;r<=i;r++)u.push(0,m*_,0),l.push(0,_,0),d.push(.5,.5),p++;for(f=p,r=0;r<=i;r++){var w=r/i*s+a,M=Math.cos(w),E=Math.sin(w);y.x=b*E,y.y=m*_,y.z=b*M,u.push(y.x,y.y,y.z),l.push(0,_,0),v.x=.5*M+.5,v.y=.5*E*_+.5,d.push(v.x,v.y),p++}for(r=0;r<i;r++){var T=o+r,S=f+r;!0===n?h.push(S,S+1,T):h.push(S+1,S,T),x+=3}c.addGroup(g,x,!0===n?1:2),g+=x}!function(){var o,v,y=new He,x=new He,b=0,_=(e-t)/n;for(v=0;v<=r;v++){var w=[],M=v/r,E=M*(e-t)+t;for(o=0;o<=i;o++){var T=o/i,S=T*s+a,A=Math.sin(S),L=Math.cos(S);x.x=E*A,x.y=-M*n+m,x.z=E*L,u.push(x.x,x.y,x.z),y.set(A,_,L).normalize(),l.push(y.x,y.y,y.z),d.push(T,1-M),w.push(p++)}f.push(w)}for(o=0;o<i;o++)for(v=0;v<r;v++){var R=f[v][o],P=f[v+1][o],C=f[v+1][o+1],I=f[v][o+1];h.push(R,P,I),h.push(P,C,I),b+=6}c.addGroup(g,b,0),g+=b}(),!1===o&&(t>0&&v(!0),e>0&&v(!1)),this.setIndex(h),this.addAttribute("position",new Ci(u,3)),this.addAttribute("normal",new Ci(l,3)),this.addAttribute("uv",new Ci(d,2))}function Co(t,e,n,i,r,o,a){Ro.call(this,0,t,e,n,i,r,o,a),this.type="ConeGeometry",this.parameters={radius:t,height:e,radialSegments:n,heightSegments:i,openEnded:r,thetaStart:o,thetaLength:a}}function Io(t,e,n,i,r,o,a){Po.call(this,0,t,e,n,i,r,o,a),this.type="ConeBufferGeometry",this.parameters={radius:t,height:e,radialSegments:n,heightSegments:i,openEnded:r,thetaStart:o,thetaLength:a}}function Uo(t,e,n,i){Bi.call(this),this.type="CircleGeometry",this.parameters={radius:t,segments:e,thetaStart:n,thetaLength:i},this.fromBufferGeometry(new No(t,e,n,i)),this.mergeVertices()}function No(t,e,n,i){zi.call(this),this.type="CircleBufferGeometry",this.parameters={radius:t,segments:e,thetaStart:n,thetaLength:i},t=t||50,e=void 0!==e?Math.max(3,e):8,n=void 0!==n?n:0,i=void 0!==i?i:2*Math.PI;var r,o,a=[],s=[],c=[],h=[],u=new He,l=new Le;for(s.push(0,0,0),c.push(0,0,1),h.push(.5,.5),o=0,r=3;o<=e;o++,r+=3){var d=n+o/e*i;u.x=t*Math.cos(d),u.y=t*Math.sin(d),s.push(u.x,u.y,u.z),c.push(0,0,1),l.x=(s[r]/t+1)/2,l.y=(s[r+1]/t+1)/2,h.push(l.x,l.y)}for(r=1;r<=e;r++)a.push(r,r+1,0);this.setIndex(a),this.addAttribute("position",new Ci(s,3)),this.addAttribute("normal",new Ci(c,3)),this.addAttribute("uv",new Ci(h,2))}go.prototype=Object.create(Bi.prototype),go.prototype.constructor=go,vo.prototype=Object.create(zi.prototype),vo.prototype.constructor=vo,vo.prototype.getArrays=function(){var t=this.getAttribute("position"),e=t?Array.prototype.slice.call(t.array):[],n=this.getAttribute("uv"),i=n?Array.prototype.slice.call(n.array):[],r=this.index;return{position:e,uv:i,index:r?Array.prototype.slice.call(r.array):[]}},vo.prototype.addShapeList=function(t,e){var n=t.length;e.arrays=this.getArrays();for(var i=0;i<n;i++){var r=t[i];this.addShape(r,e)}this.setIndex(e.arrays.index),this.addAttribute("position",new Ci(e.arrays.position,3)),this.addAttribute("uv",new Ci(e.arrays.uv,2))},vo.prototype.addShape=function(t,e){var n,i,r,o,a,s,c,h,u=e.arrays?e.arrays:this.getArrays(),l=u.position,d=u.index,p=u.uv,f=[],m=void 0!==e.amount?e.amount:100,g=void 0!==e.bevelThickness?e.bevelThickness:6,v=void 0!==e.bevelSize?e.bevelSize:g-2,y=void 0!==e.bevelSegments?e.bevelSegments:3,x=void 0===e.bevelEnabled||e.bevelEnabled,b=void 0!==e.curveSegments?e.curveSegments:12,_=void 0!==e.steps?e.steps:1,w=e.extrudePath,M=!1,E=void 0!==e.UVGenerator?e.UVGenerator:go.WorldUVGenerator;w&&(n=w.getSpacedPoints(_),M=!0,x=!1,i=void 0!==e.frames?e.frames:w.computeFrenetFrames(_,!1),r=new He,o=new He,a=new He),x||(y=0,g=0,v=0);var T=this,S=t.extractPoints(b),A=S.shape,L=S.holes,R=!mo.isClockWise(A);if(R){for(A=A.reverse(),c=0,h=L.length;c<h;c++)s=L[c],mo.isClockWise(s)&&(L[c]=s.reverse());R=!1}var P=mo.triangulateShape(A,L),C=A;for(c=0,h=L.length;c<h;c++)s=L[c],A=A.concat(s);function I(t,e,n){return e||console.error("THREE.ExtrudeGeometry: vec does not exist"),e.clone().multiplyScalar(n).add(t)}var U,N,O,D,F,B,z=A.length,G=P.length;function H(t,e,n){var i,r,o=1,a=t.x-e.x,s=t.y-e.y,c=n.x-t.x,h=n.y-t.y,u=a*a+s*s,l=a*h-s*c;if(Math.abs(l)>Number.EPSILON){var d=Math.sqrt(u),p=Math.sqrt(c*c+h*h),f=e.x-s/d,m=e.y+a/d,g=((n.x-h/p-f)*h-(n.y+c/p-m)*c)/(a*h-s*c),v=(i=f+a*g-t.x)*i+(r=m+s*g-t.y)*r;if(v<=2)return new Le(i,r);o=Math.sqrt(v/2)}else{var y=!1;a>Number.EPSILON?c>Number.EPSILON&&(y=!0):a<-Number.EPSILON?c<-Number.EPSILON&&(y=!0):Math.sign(s)===Math.sign(h)&&(y=!0),y?(i=-s,r=a,o=Math.sqrt(u)):(i=a,r=s,o=Math.sqrt(u/2))}return new Le(i/o,r/o)}for(var V=[],k=0,j=C.length,W=j-1,X=k+1;k<j;k++,W++,X++)W===j&&(W=0),X===j&&(X=0),V[k]=H(C[k],C[W],C[X]);var q,Y,Z=[],J=V.concat();for(c=0,h=L.length;c<h;c++){for(s=L[c],q=[],k=0,W=(j=s.length)-1,X=k+1;k<j;k++,W++,X++)W===j&&(W=0),X===j&&(X=0),q[k]=H(s[k],s[W],s[X]);Z.push(q),J=J.concat(q)}for(U=0;U<y;U++){for(O=U/y,D=g*Math.cos(O*Math.PI/2),N=v*Math.sin(O*Math.PI/2),k=0,j=C.length;k<j;k++)K((F=I(C[k],V[k],N)).x,F.y,-D);for(c=0,h=L.length;c<h;c++)for(s=L[c],q=Z[c],k=0,j=s.length;k<j;k++)K((F=I(s[k],q[k],N)).x,F.y,-D)}for(N=v,k=0;k<z;k++)F=x?I(A[k],J[k],N):A[k],M?(o.copy(i.normals[0]).multiplyScalar(F.x),r.copy(i.binormals[0]).multiplyScalar(F.y),a.copy(n[0]).add(o).add(r),K(a.x,a.y,a.z)):K(F.x,F.y,0);for(Y=1;Y<=_;Y++)for(k=0;k<z;k++)F=x?I(A[k],J[k],N):A[k],M?(o.copy(i.normals[Y]).multiplyScalar(F.x),r.copy(i.binormals[Y]).multiplyScalar(F.y),a.copy(n[Y]).add(o).add(r),K(a.x,a.y,a.z)):K(F.x,F.y,m/_*Y);for(U=y-1;U>=0;U--){for(O=U/y,D=g*Math.cos(O*Math.PI/2),N=v*Math.sin(O*Math.PI/2),k=0,j=C.length;k<j;k++)K((F=I(C[k],V[k],N)).x,F.y,m+D);for(c=0,h=L.length;c<h;c++)for(s=L[c],q=Z[c],k=0,j=s.length;k<j;k++)F=I(s[k],q[k],N),M?K(F.x,F.y+n[_-1].y,n[_-1].x+D):K(F.x,F.y,m+D)}function Q(t,e){var n,i;for(k=t.length;--k>=0;){n=k,(i=k-1)<0&&(i=t.length-1);var r=0,o=_+2*y;for(r=0;r<o;r++){var a=z*r,s=z*(r+1);tt(e+n+a,e+i+a,e+i+s,e+n+s,t,r,o,n,i)}}}function K(t,e,n){f.push(t),f.push(e),f.push(n)}function $(t,e,n){et(t),et(e),et(n);var i=l.length/3,r=E.generateTopUV(T,l,i-3,i-2,i-1);nt(r[0]),nt(r[1]),nt(r[2])}function tt(t,e,n,i,r,o,a,s,c){et(t),et(e),et(i),et(e),et(n),et(i);var h=l.length/3,u=E.generateSideWallUV(T,l,h-6,h-3,h-2,h-1);nt(u[0]),nt(u[1]),nt(u[3]),nt(u[1]),nt(u[2]),nt(u[3])}function et(t){d.push(l.length/3),l.push(f[3*t+0]),l.push(f[3*t+1]),l.push(f[3*t+2])}function nt(t){p.push(t.x),p.push(t.y)}!function(){var t=l.length/3;if(x){var n=0,i=z*n;for(k=0;k<G;k++)$((B=P[k])[2]+i,B[1]+i,B[0]+i);for(i=z*(n=_+2*y),k=0;k<G;k++)$((B=P[k])[0]+i,B[1]+i,B[2]+i)}else{for(k=0;k<G;k++)$((B=P[k])[2],B[1],B[0]);for(k=0;k<G;k++)$((B=P[k])[0]+z*_,B[1]+z*_,B[2]+z*_)}T.addGroup(t,l.length/3-t,void 0!==e.material?e.material:0)}(),function(){var t=l.length/3,n=0;for(Q(C,n),n+=C.length,c=0,h=L.length;c<h;c++)Q(s=L[c],n),n+=s.length;T.addGroup(t,l.length/3-t,void 0!==e.extrudeMaterial?e.extrudeMaterial:1)}(),e.arrays||(this.setIndex(d),this.addAttribute("position",new Ci(l,3)),this.addAttribute("uv",new Ci(e.arrays.uv,2)))},go.WorldUVGenerator={generateTopUV:function(t,e,n,i,r){var o=e[3*n],a=e[3*n+1],s=e[3*i],c=e[3*i+1],h=e[3*r],u=e[3*r+1];return[new Le(o,a),new Le(s,c),new Le(h,u)]},generateSideWallUV:function(t,e,n,i,r,o){var a=e[3*n],s=e[3*n+1],c=e[3*n+2],h=e[3*i],u=e[3*i+1],l=e[3*i+2],d=e[3*r],p=e[3*r+1],f=e[3*r+2],m=e[3*o],g=e[3*o+1],v=e[3*o+2];return Math.abs(s-u)<.01?[new Le(a,1-c),new Le(h,1-l),new Le(d,1-f),new Le(m,1-v)]:[new Le(s,1-c),new Le(u,1-l),new Le(p,1-f),new Le(g,1-v)]}},yo.prototype=Object.create(Bi.prototype),yo.prototype.constructor=yo,xo.prototype=Object.create(vo.prototype),xo.prototype.constructor=xo,bo.prototype=Object.create(Bi.prototype),bo.prototype.constructor=bo,_o.prototype=Object.create(zi.prototype),_o.prototype.constructor=_o,wo.prototype=Object.create(Bi.prototype),wo.prototype.constructor=wo,Mo.prototype=Object.create(zi.prototype),Mo.prototype.constructor=Mo,Eo.prototype=Object.create(Bi.prototype),Eo.prototype.constructor=Eo,To.prototype=Object.create(zi.prototype),To.prototype.constructor=To,So.prototype=Object.create(Bi.prototype),So.prototype.constructor=So,Ao.prototype=Object.create(zi.prototype),Ao.prototype.constructor=Ao,Lo.prototype=Object.create(zi.prototype),Lo.prototype.constructor=Lo,Ro.prototype=Object.create(Bi.prototype),Ro.prototype.constructor=Ro,Po.prototype=Object.create(zi.prototype),Po.prototype.constructor=Po,Co.prototype=Object.create(Ro.prototype),Co.prototype.constructor=Co,Io.prototype=Object.create(Po.prototype),Io.prototype.constructor=Io,Uo.prototype=Object.create(Bi.prototype),Uo.prototype.constructor=Uo,No.prototype=Object.create(zi.prototype),No.prototype.constructor=No;var Oo=Object.freeze({WireframeGeometry:Zr,ParametricGeometry:Jr,ParametricBufferGeometry:Qr,TetrahedronGeometry:to,TetrahedronBufferGeometry:eo,OctahedronGeometry:no,OctahedronBufferGeometry:io,IcosahedronGeometry:ro,IcosahedronBufferGeometry:oo,DodecahedronGeometry:ao,DodecahedronBufferGeometry:so,PolyhedronGeometry:Kr,PolyhedronBufferGeometry:$r,TubeGeometry:co,TubeBufferGeometry:ho,TorusKnotGeometry:uo,TorusKnotBufferGeometry:lo,TorusGeometry:po,TorusBufferGeometry:fo,TextGeometry:yo,TextBufferGeometry:xo,SphereGeometry:bo,SphereBufferGeometry:_o,RingGeometry:wo,RingBufferGeometry:Mo,PlaneGeometry:ki,PlaneBufferGeometry:ji,LatheGeometry:Eo,LatheBufferGeometry:To,ShapeGeometry:So,ShapeBufferGeometry:Ao,ExtrudeGeometry:go,ExtrudeBufferGeometry:vo,EdgesGeometry:Lo,ConeGeometry:Co,ConeBufferGeometry:Io,CylinderGeometry:Ro,CylinderBufferGeometry:Po,CircleGeometry:Uo,CircleBufferGeometry:No,BoxGeometry:Hi,BoxBufferGeometry:Vi});function Do(t){$n.call(this,{uniforms:Nn.merge([Un.lights,{opacity:{value:1}}]),vertexShader:On.shadow_vert,fragmentShader:On.shadow_frag}),this.lights=!0,this.transparent=!0,Object.defineProperties(this,{opacity:{enumerable:!0,get:function(){return this.uniforms.opacity.value},set:function(t){this.uniforms.opacity.value=t}}}),this.setValues(t)}function Fo(t){$n.call(this,t),this.type="RawShaderMaterial"}function Bo(t){Kn.call(this),this.defines={STANDARD:""},this.type="MeshStandardMaterial",this.color=new In(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 In(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalScale=new Le(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.roughnessMap=null,this.metalnessMap=null,this.alphaMap=null,this.envMap=null,this.envMapIntensity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.skinning=!1,this.morphTargets=!1,this.morphNormals=!1,this.setValues(t)}function zo(t){Bo.call(this),this.defines={PHYSICAL:""},this.type="MeshPhysicalMaterial",this.reflectivity=.5,this.clearCoat=0,this.clearCoatRoughness=0,this.setValues(t)}function Go(t){Kn.call(this),this.type="MeshPhongMaterial",this.color=new In(16777215),this.specular=new In(1118481),this.shininess=30,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new In(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalScale=new Le(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.combine=ot,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.skinning=!1,this.morphTargets=!1,this.morphNormals=!1,this.setValues(t)}function Ho(t){Go.call(this),this.defines={TOON:""},this.type="MeshToonMaterial",this.gradientMap=null,this.setValues(t)}function Vo(t){Kn.call(this,t),this.type="MeshNormalMaterial",this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalScale=new Le(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.wireframe=!1,this.wireframeLinewidth=1,this.fog=!1,this.lights=!1,this.skinning=!1,this.morphTargets=!1,this.morphNormals=!1,this.setValues(t)}function ko(t){Kn.call(this),this.type="MeshLambertMaterial",this.color=new In(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new In(0),this.emissiveIntensity=1,this.emissiveMap=null,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.combine=ot,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.skinning=!1,this.morphTargets=!1,this.morphNormals=!1,this.setValues(t)}function jo(t){Kn.call(this),this.type="LineDashedMaterial",this.color=new In(16777215),this.linewidth=1,this.scale=1,this.dashSize=3,this.gapSize=1,this.lights=!1,this.setValues(t)}Do.prototype=Object.create($n.prototype),Do.prototype.constructor=Do,Do.prototype.isShadowMaterial=!0,Fo.prototype=Object.create($n.prototype),Fo.prototype.constructor=Fo,Fo.prototype.isRawShaderMaterial=!0,Bo.prototype=Object.create(Kn.prototype),Bo.prototype.constructor=Bo,Bo.prototype.isMeshStandardMaterial=!0,Bo.prototype.copy=function(t){return Kn.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},zo.prototype=Object.create(Bo.prototype),zo.prototype.constructor=zo,zo.prototype.isMeshPhysicalMaterial=!0,zo.prototype.copy=function(t){return Bo.prototype.copy.call(this,t),this.defines={PHYSICAL:""},this.reflectivity=t.reflectivity,this.clearCoat=t.clearCoat,this.clearCoatRoughness=t.clearCoatRoughness,this},Go.prototype=Object.create(Kn.prototype),Go.prototype.constructor=Go,Go.prototype.isMeshPhongMaterial=!0,Go.prototype.copy=function(t){return Kn.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},Ho.prototype=Object.create(Go.prototype),Ho.prototype.constructor=Ho,Ho.prototype.isMeshToonMaterial=!0,Ho.prototype.copy=function(t){return Go.prototype.copy.call(this,t),this.gradientMap=t.gradientMap,this},Vo.prototype=Object.create(Kn.prototype),Vo.prototype.constructor=Vo,Vo.prototype.isMeshNormalMaterial=!0,Vo.prototype.copy=function(t){return Kn.prototype.copy.call(this,t),this.bumpMap=t.bumpMap,this.bumpScale=t.bumpScale,this.normalMap=t.normalMap,this.normalScale.copy(t.normalScale),this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.skinning=t.skinning,this.morphTargets=t.morphTargets,this.morphNormals=t.morphNormals,this},ko.prototype=Object.create(Kn.prototype),ko.prototype.constructor=ko,ko.prototype.isMeshLambertMaterial=!0,ko.prototype.copy=function(t){return Kn.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},jo.prototype=Object.create(Kn.prototype),jo.prototype.constructor=jo,jo.prototype.isLineDashedMaterial=!0,jo.prototype.copy=function(t){return Kn.prototype.copy.call(this,t),this.color.copy(t.color),this.linewidth=t.linewidth,this.scale=t.scale,this.dashSize=t.dashSize,this.gapSize=t.gapSize,this};var Wo=Object.freeze({ShadowMaterial:Do,SpriteMaterial:Ir,RawShaderMaterial:Fo,ShaderMaterial:$n,PointsMaterial:Vr,MeshPhysicalMaterial:zo,MeshStandardMaterial:Bo,MeshPhongMaterial:Go,MeshToonMaterial:Ho,MeshNormalMaterial:Vo,MeshLambertMaterial:ko,MeshDepthMaterial:ti,MeshBasicMaterial:wi,LineDashedMaterial:jo,LineBasicMaterial:Br,Material:Kn}),Xo={enabled:!1,files:{},add:function(t,e){!1!==this.enabled&&(this.files[t]=e)},get:function(t){if(!1!==this.enabled)return this.files[t]},remove:function(t){delete this.files[t]},clear:function(){this.files={}}};function qo(t,e,n){var i=this,r=!1,o=0,a=0;this.onStart=void 0,this.onLoad=t,this.onProgress=e,this.onError=n,this.itemStart=function(t){a++,!1===r&&void 0!==i.onStart&&i.onStart(t,o,a),r=!0},this.itemEnd=function(t){o++,void 0!==i.onProgress&&i.onProgress(t,o,a),o===a&&(r=!1,void 0!==i.onLoad&&i.onLoad())},this.itemError=function(t){void 0!==i.onError&&i.onError(t)}}var Yo=new qo;function Zo(t){this.manager=void 0!==t?t:Yo}function Jo(t){this.manager=void 0!==t?t:Yo,this._parser=null}function Qo(t){this.manager=void 0!==t?t:Yo,this._parser=null}function Ko(t){this.manager=void 0!==t?t:Yo}function $o(t){this.manager=void 0!==t?t:Yo}function ta(t){this.manager=void 0!==t?t:Yo}function ea(t,e){yi.call(this),this.type="Light",this.color=new In(t),this.intensity=void 0!==e?e:1,this.receiveShadow=void 0}function na(t,e,n){ea.call(this,t,n),this.type="HemisphereLight",this.castShadow=void 0,this.position.copy(yi.DefaultUp),this.updateMatrix(),this.groundColor=new In(e)}function ia(t){this.camera=t,this.bias=0,this.radius=1,this.mapSize=new Le(512,512),this.map=null,this.matrix=new Ve}function ra(){ia.call(this,new Xi(50,1,.5,500))}function oa(t,e,n,i,r,o){ea.call(this,t,e),this.type="SpotLight",this.position.copy(yi.DefaultUp),this.updateMatrix(),this.target=new yi,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!==i?i:Math.PI/3,this.penumbra=void 0!==r?r:0,this.decay=void 0!==o?o:1,this.shadow=new ra}function aa(t,e,n,i){ea.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!==i?i:1,this.shadow=new ia(new Xi(90,1,.5,500))}function sa(){ia.call(this,new qi(-5,5,5,-5,.5,500))}function ca(t,e){ea.call(this,t,e),this.type="DirectionalLight",this.position.copy(yi.DefaultUp),this.updateMatrix(),this.target=new yi,this.shadow=new sa}function ha(t,e){ea.call(this,t,e),this.type="AmbientLight",this.castShadow=void 0}function ua(t,e,n,i){ea.call(this,t,e),this.type="RectAreaLight",this.position.set(0,1,0),this.updateMatrix(),this.width=void 0!==n?n:10,this.height=void 0!==i?i:10}Object.assign(Zo.prototype,{load:function(t,e,n,i){void 0===t&&(t=""),void 0!==this.path&&(t=this.path+t);var r=this,o=Xo.get(t);if(void 0!==o)return r.manager.itemStart(t),setTimeout(function(){e&&e(o),r.manager.itemEnd(t)},0),o;var a=t.match(/^data:(.*?)(;base64)?,(.*)$/);if(a){var s=a[1],c=!!a[2],h=a[3];h=window.decodeURIComponent(h),c&&(h=window.atob(h));try{var u,l=(this.responseType||"").toLowerCase();switch(l){case"arraybuffer":case"blob":u=new ArrayBuffer(h.length);for(var d=new Uint8Array(u),p=0;p<h.length;p++)d[p]=h.charCodeAt(p);"blob"===l&&(u=new Blob([u],{type:s}));break;case"document":var f=new DOMParser;u=f.parseFromString(h,s);break;case"json":u=JSON.parse(h);break;default:u=h}window.setTimeout(function(){e&&e(u),r.manager.itemEnd(t)},0)}catch(e){window.setTimeout(function(){i&&i(e),r.manager.itemEnd(t),r.manager.itemError(t)},0)}}else{var m=new XMLHttpRequest;for(var g in m.open("GET",t,!0),m.addEventListener("load",function(n){var o=n.target.response;Xo.add(t,o),200===this.status?(e&&e(o),r.manager.itemEnd(t)):0===this.status?(console.warn("THREE.FileLoader: HTTP Status 0 received."),e&&e(o),r.manager.itemEnd(t)):(i&&i(n),r.manager.itemEnd(t),r.manager.itemError(t))},!1),void 0!==n&&m.addEventListener("progress",function(t){n(t)},!1),m.addEventListener("error",function(e){i&&i(e),r.manager.itemEnd(t),r.manager.itemError(t)},!1),void 0!==this.responseType&&(m.responseType=this.responseType),void 0!==this.withCredentials&&(m.withCredentials=this.withCredentials),m.overrideMimeType&&m.overrideMimeType(void 0!==this.mimeType?this.mimeType:"text/plain"),this.requestHeader)m.setRequestHeader(g,this.requestHeader[g]);m.send(null)}return r.manager.itemStart(t),m},setPath:function(t){return this.path=t,this},setResponseType:function(t){return this.responseType=t,this},setWithCredentials:function(t){return this.withCredentials=t,this},setMimeType:function(t){return this.mimeType=t,this},setRequestHeader:function(t){return this.requestHeader=t,this}}),Object.assign(Jo.prototype,{load:function(t,e,n,i){var r=this,o=[],a=new Xr;a.image=o;var s=new Zo(this.manager);function c(c){s.load(t[c],function(t){var n=r._parser(t,!0);o[c]={width:n.width,height:n.height,format:n.format,mipmaps:n.mipmaps},6===(h+=1)&&(1===n.mipmapCount&&(a.minFilter=At),a.format=n.format,a.needsUpdate=!0,e&&e(a))},n,i)}if(s.setPath(this.path),s.setResponseType("arraybuffer"),Array.isArray(t))for(var h=0,u=0,l=t.length;u<l;++u)c(u);else s.load(t,function(t){var n=r._parser(t,!0);if(n.isCubemap)for(var i=n.mipmaps.length/n.mipmapCount,s=0;s<i;s++){o[s]={mipmaps:[]};for(var c=0;c<n.mipmapCount;c++)o[s].mipmaps.push(n.mipmaps[s*n.mipmapCount+c]),o[s].format=n.format,o[s].width=n.width,o[s].height=n.height}else a.image.width=n.width,a.image.height=n.height,a.mipmaps=n.mipmaps;1===n.mipmapCount&&(a.minFilter=At),a.format=n.format,a.needsUpdate=!0,e&&e(a)},n,i);return a},setPath:function(t){return this.path=t,this}}),Object.assign(Qo.prototype,{load:function(t,e,n,i){var r=this,o=new ke,a=new Zo(this.manager);return a.setResponseType("arraybuffer"),a.load(t,function(t){var n=r._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:wt,o.wrapT=void 0!==n.wrapT?n.wrapT:wt,o.magFilter=void 0!==n.magFilter?n.magFilter:At,o.minFilter=void 0!==n.minFilter?n.minFilter:Rt,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=At),o.needsUpdate=!0,e&&e(o,n))},n,i),o}}),Object.assign(Ko.prototype,{load:function(t,e,n,i){void 0===t&&(t=""),void 0!==this.path&&(t=this.path+t);var r=this,o=Xo.get(t);if(void 0!==o)return r.manager.itemStart(t),setTimeout(function(){e&&e(o),r.manager.itemEnd(t)},0),o;var a=document.createElementNS("http://www.w3.org/1999/xhtml","img");return a.addEventListener("load",function(){Xo.add(t,this),e&&e(this),r.manager.itemEnd(t)},!1),a.addEventListener("error",function(e){i&&i(e),r.manager.itemEnd(t),r.manager.itemError(t)},!1),"data:"!==t.substr(0,5)&&void 0!==this.crossOrigin&&(a.crossOrigin=this.crossOrigin),r.manager.itemStart(t),a.src=t,a},setCrossOrigin:function(t){return this.crossOrigin=t,this},setPath:function(t){return this.path=t,this}}),Object.assign($o.prototype,{load:function(t,e,n,i){var r=new je,o=new Ko(this.manager);o.setCrossOrigin(this.crossOrigin),o.setPath(this.path);var a=0;function s(n){o.load(t[n],function(t){r.images[n]=t,6===++a&&(r.needsUpdate=!0,e&&e(r))},void 0,i)}for(var c=0;c<t.length;++c)s(c);return r},setCrossOrigin:function(t){return this.crossOrigin=t,this},setPath:function(t){return this.path=t,this}}),Object.assign(ta.prototype,{load:function(t,e,n,i){var r=new Ko(this.manager);r.setCrossOrigin(this.crossOrigin),r.setPath(this.path);var o=new De;return o.image=r.load(t,function(){var n=t.search(/\.(jpg|jpeg)$/)>0||0===t.search(/^data\:image\/jpeg/);o.format=n?kt:jt,o.needsUpdate=!0,void 0!==e&&e(o)},n,i),o},setCrossOrigin:function(t){return this.crossOrigin=t,this},setPath:function(t){return this.path=t,this}}),ea.prototype=Object.assign(Object.create(yi.prototype),{constructor:ea,isLight:!0,copy:function(t){return yi.prototype.copy.call(this,t),this.color.copy(t.color),this.intensity=t.intensity,this},toJSON:function(t){var e=yi.prototype.toJSON.call(this,t);return e.object.color=this.color.getHex(),e.object.intensity=this.intensity,void 0!==this.groundColor&&(e.object.groundColor=this.groundColor.getHex()),void 0!==this.distance&&(e.object.distance=this.distance),void 0!==this.angle&&(e.object.angle=this.angle),void 0!==this.decay&&(e.object.decay=this.decay),void 0!==this.penumbra&&(e.object.penumbra=this.penumbra),void 0!==this.shadow&&(e.object.shadow=this.shadow.toJSON()),e}}),na.prototype=Object.assign(Object.create(ea.prototype),{constructor:na,isHemisphereLight:!0,copy:function(t){return ea.prototype.copy.call(this,t),this.groundColor.copy(t.groundColor),this}}),Object.assign(ia.prototype,{copy:function(t){return this.camera=t.camera.clone(),this.bias=t.bias,this.radius=t.radius,this.mapSize.copy(t.mapSize),this},clone:function(){return(new this.constructor).copy(this)},toJSON:function(){var t={};return 0!==this.bias&&(t.bias=this.bias),1!==this.radius&&(t.radius=this.radius),512===this.mapSize.x&&512===this.mapSize.y||(t.mapSize=this.mapSize.toArray()),t.camera=this.camera.toJSON(!1).object,delete t.camera.matrix,t}}),ra.prototype=Object.assign(Object.create(ia.prototype),{constructor:ra,isSpotLightShadow:!0,update:function(t){var e=this.camera,n=2*Ae.RAD2DEG*t.angle,i=this.mapSize.width/this.mapSize.height,r=t.distance||e.far;n===e.fov&&i===e.aspect&&r===e.far||(e.fov=n,e.aspect=i,e.far=r,e.updateProjectionMatrix())}}),oa.prototype=Object.assign(Object.create(ea.prototype),{constructor:oa,isSpotLight:!0,copy:function(t){return ea.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}}),aa.prototype=Object.assign(Object.create(ea.prototype),{constructor:aa,isPointLight:!0,copy:function(t){return ea.prototype.copy.call(this,t),this.distance=t.distance,this.decay=t.decay,this.shadow=t.shadow.clone(),this}}),sa.prototype=Object.assign(Object.create(ia.prototype),{constructor:sa}),ca.prototype=Object.assign(Object.create(ea.prototype),{constructor:ca,isDirectionalLight:!0,copy:function(t){return ea.prototype.copy.call(this,t),this.target=t.target.clone(),this.shadow=t.shadow.clone(),this}}),ha.prototype=Object.assign(Object.create(ea.prototype),{constructor:ha,isAmbientLight:!0}),ua.prototype=Object.assign(Object.create(ea.prototype),{constructor:ua,isRectAreaLight:!0,copy:function(t){return ea.prototype.copy.call(this,t),this.width=t.width,this.height=t.height,this},toJSON:function(t){var e=ea.prototype.toJSON.call(this,t);return e.object.width=this.width,e.object.height=this.height,e}});var la,da={arraySlice:function(t,e,n){return da.isTypedArray(t)?new t.constructor(t.subarray(e,void 0!==n?n:t.length)):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){for(var e=t.length,n=new Array(e),i=0;i!==e;++i)n[i]=i;return n.sort(function(e,n){return t[e]-t[n]}),n},sortedArray:function(t,e,n){for(var i=t.length,r=new t.constructor(i),o=0,a=0;a!==i;++o)for(var s=n[o]*e,c=0;c!==e;++c)r[a++]=t[s+c];return r},flattenJSON:function(t,e,n,i){for(var r=1,o=t[0];void 0!==o&&void 0===o[i];)o=t[r++];if(void 0!==o){var a=o[i];if(void 0!==a)if(Array.isArray(a))do{void 0!==(a=o[i])&&(e.push(o.time),n.push.apply(n,a)),o=t[r++]}while(void 0!==o);else if(void 0!==a.toArray)do{void 0!==(a=o[i])&&(e.push(o.time),a.toArray(n,n.length)),o=t[r++]}while(void 0!==o);else do{void 0!==(a=o[i])&&(e.push(o.time),n.push(a)),o=t[r++]}while(void 0!==o)}}};function pa(t,e,n,i){this.parameterPositions=t,this._cachedIndex=0,this.resultBuffer=void 0!==i?i:new e.constructor(n),this.sampleValues=e,this.valueSize=n}function fa(t,e,n,i){pa.call(this,t,e,n,i),this._weightPrev=-0,this._offsetPrev=-0,this._weightNext=-0,this._offsetNext=-0}function ma(t,e,n,i){pa.call(this,t,e,n,i)}function ga(t,e,n,i){pa.call(this,t,e,n,i)}function va(t,e,n,i){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=da.convertArray(e,this.TimeBufferType),this.values=da.convertArray(n,this.ValueBufferType),this.setInterpolation(i||this.DefaultInterpolation),this.validate(),this.optimize()}function ya(t,e,n,i){va.call(this,t,e,n,i)}function xa(t,e,n,i){pa.call(this,t,e,n,i)}function ba(t,e,n,i){va.call(this,t,e,n,i)}function _a(t,e,n,i){va.call(this,t,e,n,i)}function wa(t,e,n,i){va.call(this,t,e,n,i)}function Ma(t,e,n){va.call(this,t,e,n)}function Ea(t,e,n,i){va.call(this,t,e,n,i)}function Ta(t,e,n,i){va.apply(this,arguments)}function Sa(t,e,n){this.name=t,this.tracks=n,this.duration=void 0!==e?e:-1,this.uuid=Ae.generateUUID(),this.duration<0&&this.resetDuration(),this.optimize()}function Aa(t){this.manager=void 0!==t?t:Yo,this.textures={}}function La(t){this.manager=void 0!==t?t:Yo}Object.assign(pa.prototype,{evaluate:function(t){var e=this.parameterPositions,n=this._cachedIndex,i=e[n],r=e[n-1];t:{e:{var o;n:{i:if(!(t<i)){for(var a=n+2;;){if(void 0===i){if(t<r)break i;return n=e.length,this._cachedIndex=n,this.afterEnd_(n-1,t,r)}if(n===a)break;if(r=i,t<(i=e[++n]))break e}o=e.length;break n}if(t>=r)break t;var s=e[1];t<s&&(n=2,r=s);for(a=n-2;;){if(void 0===r)return this._cachedIndex=0,this.beforeStart_(0,t,i);if(n===a)break;if(i=r,t>=(r=e[--n-1]))break e}o=n,n=0}for(;n<o;){var c=n+o>>>1;t<e[c]?o=c:n=c+1}if(i=e[n],void 0===(r=e[n-1]))return this._cachedIndex=0,this.beforeStart_(0,t,i);if(void 0===i)return n=e.length,this._cachedIndex=n,this.afterEnd_(n-1,r,t)}this._cachedIndex=n,this.intervalChanged_(n,r,i)}return this.interpolate_(n,r,t,i)},settings:null,DefaultSettings_:{},getSettings_:function(){return this.settings||this.DefaultSettings_},copySampleValue_:function(t){for(var e=this.resultBuffer,n=this.sampleValues,i=this.valueSize,r=t*i,o=0;o!==i;++o)e[o]=n[r+o];return e},interpolate_:function(t,e,n,i){throw new Error("call to abstract method")},intervalChanged_:function(t,e,n){}}),
  2. //!\ DECLARE ALIAS AFTER assign prototype !
  3. Object.assign(pa.prototype,{beforeStart_:pa.prototype.copySampleValue_,afterEnd_:pa.prototype.copySampleValue_}),fa.prototype=Object.assign(Object.create(pa.prototype),{constructor:fa,DefaultSettings_:{endingStart:le,endingEnd:le},intervalChanged_:function(t,e,n){var i=this.parameterPositions,r=t-2,o=t+1,a=i[r],s=i[o];if(void 0===a)switch(this.getSettings_().endingStart){case de:r=t,a=2*e-n;break;case pe:a=e+i[r=i.length-2]-i[r+1];break;default:r=t,a=n}if(void 0===s)switch(this.getSettings_().endingEnd){case de:o=t,s=2*n-e;break;case pe:o=1,s=n+i[1]-i[0];break;default:o=t-1,s=e}var c=.5*(n-e),h=this.valueSize;this._weightPrev=c/(e-a),this._weightNext=c/(s-n),this._offsetPrev=r*h,this._offsetNext=o*h},interpolate_:function(t,e,n,i){for(var r=this.resultBuffer,o=this.sampleValues,a=this.valueSize,s=t*a,c=s-a,h=this._offsetPrev,u=this._offsetNext,l=this._weightPrev,d=this._weightNext,p=(n-e)/(i-e),f=p*p,m=f*p,g=-l*m+2*l*f-l*p,v=(1+l)*m+(-1.5-2*l)*f+(-.5+l)*p+1,y=(-1-d)*m+(1.5+d)*f+.5*p,x=d*m-d*f,b=0;b!==a;++b)r[b]=g*o[h+b]+v*o[c+b]+y*o[s+b]+x*o[u+b];return r}}),ma.prototype=Object.assign(Object.create(pa.prototype),{constructor:ma,interpolate_:function(t,e,n,i){for(var r=this.resultBuffer,o=this.sampleValues,a=this.valueSize,s=t*a,c=s-a,h=(n-e)/(i-e),u=1-h,l=0;l!==a;++l)r[l]=o[c+l]*u+o[s+l]*h;return r}}),ga.prototype=Object.assign(Object.create(pa.prototype),{constructor:ga,interpolate_:function(t,e,n,i){return this.copySampleValue_(t-1)}}),la={TimeBufferType:Float32Array,ValueBufferType:Float32Array,DefaultInterpolation:he,InterpolantFactoryMethodDiscrete:function(t){return new ga(this.times,this.values,this.getValueSize(),t)},InterpolantFactoryMethodLinear:function(t){return new ma(this.times,this.values,this.getValueSize(),t)},InterpolantFactoryMethodSmooth:function(t){return new fa(this.times,this.values,this.getValueSize(),t)},setInterpolation:function(t){var e;switch(t){case ce:e=this.InterpolantFactoryMethodDiscrete;break;case he:e=this.InterpolantFactoryMethodLinear;break;case ue:e=this.InterpolantFactoryMethodSmooth}if(void 0!==e)this.createInterpolant=e;else{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)}console.warn(n)}},getInterpolation:function(){switch(this.createInterpolant){case this.InterpolantFactoryMethodDiscrete:return ce;case this.InterpolantFactoryMethodLinear:return he;case this.InterpolantFactoryMethodSmooth:return ue}},getValueSize:function(){return this.values.length/this.times.length},shift:function(t){if(0!==t)for(var e=this.times,n=0,i=e.length;n!==i;++n)e[n]+=t;return this},scale:function(t){if(1!==t)for(var e=this.times,n=0,i=e.length;n!==i;++n)e[n]*=t;return this},trim:function(t,e){for(var n=this.times,i=n.length,r=0,o=i-1;r!==i&&n[r]<t;)++r;for(;-1!==o&&n[o]>e;)--o;if(++o,0!==r||o!==i){r>=o&&(r=(o=Math.max(o,1))-1);var a=this.getValueSize();this.times=da.arraySlice(n,r,o),this.values=da.arraySlice(this.values,r*a,o*a)}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,i=this.values,r=n.length;0===r&&(console.error("track is empty",this),t=!1);for(var o=null,a=0;a!==r;a++){var s=n[a];if("number"==typeof s&&isNaN(s)){console.error("time is not a valid number",this,a,s),t=!1;break}if(null!==o&&o>s){console.error("out of order keys",this,a,s,o),t=!1;break}o=s}if(void 0!==i&&da.isTypedArray(i)){a=0;for(var c=i.length;a!==c;++a){var h=i[a];if(isNaN(h)){console.error("value is not a valid number",this,a,h),t=!1;break}}}return t},optimize:function(){for(var t=this.times,e=this.values,n=this.getValueSize(),i=this.getInterpolation()===ue,r=1,o=t.length-1,a=1;a<o;++a){var s=!1,c=t[a];if(c!==t[a+1]&&(1!==a||c!==c[0]))if(i)s=!0;else for(var h=a*n,u=h-n,l=h+n,d=0;d!==n;++d){var p=e[h+d];if(p!==e[u+d]||p!==e[l+d]){s=!0;break}}if(s){if(a!==r){t[r]=t[a];var f=a*n,m=r*n;for(d=0;d!==n;++d)e[m+d]=e[f+d]}++r}}if(o>0){t[r]=t[o];for(f=o*n,m=r*n,d=0;d!==n;++d)e[m+d]=e[f+d];++r}return r!==t.length&&(this.times=da.arraySlice(t,0,r),this.values=da.arraySlice(e,0,r*n)),this}},ya.prototype=Object.assign(Object.create(la),{constructor:ya,ValueTypeName:"vector"}),xa.prototype=Object.assign(Object.create(pa.prototype),{constructor:xa,interpolate_:function(t,e,n,i){for(var r=this.resultBuffer,o=this.sampleValues,a=this.valueSize,s=t*a,c=(n-e)/(i-e),h=s+a;s!==h;s+=4)Ge.slerpFlat(r,0,o,s-a,o,s,c);return r}}),ba.prototype=Object.assign(Object.create(la),{constructor:ba,ValueTypeName:"quaternion",DefaultInterpolation:he,InterpolantFactoryMethodLinear:function(t){return new xa(this.times,this.values,this.getValueSize(),t)},InterpolantFactoryMethodSmooth:void 0}),_a.prototype=Object.assign(Object.create(la),{constructor:_a,ValueTypeName:"number"}),wa.prototype=Object.assign(Object.create(la),{constructor:wa,ValueTypeName:"string",ValueBufferType:Array,DefaultInterpolation:ce,InterpolantFactoryMethodLinear:void 0,InterpolantFactoryMethodSmooth:void 0}),Ma.prototype=Object.assign(Object.create(la),{constructor:Ma,ValueTypeName:"bool",ValueBufferType:Array,DefaultInterpolation:ce,InterpolantFactoryMethodLinear:void 0,InterpolantFactoryMethodSmooth:void 0}),Ea.prototype=Object.assign(Object.create(la),{constructor:Ea,ValueTypeName:"color"}),Ta.prototype=la,la.constructor=Ta,Object.assign(Ta,{parse:function(t){if(void 0===t.type)throw new Error("track type undefined, can not parse");var e=Ta._getTrackTypeForValueTypeName(t.type);if(void 0===t.times){var n=[],i=[];da.flattenJSON(t.keys,n,i,"value"),t.times=n,t.values=i}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:da.convertArray(t.times,Array),values:da.convertArray(t.values,Array)};var i=t.getInterpolation();i!==t.DefaultInterpolation&&(e.interpolation=i)}return e.type=t.ValueTypeName,e},_getTrackTypeForValueTypeName:function(t){switch(t.toLowerCase()){case"scalar":case"double":case"float":case"number":case"integer":return _a;case"vector":case"vector2":case"vector3":case"vector4":return ya;case"color":return Ea;case"quaternion":return ba;case"bool":case"boolean":return Ma;case"string":return wa}throw new Error("Unsupported typeName: "+t)}}),Object.assign(Sa,{parse:function(t){for(var e=[],n=t.tracks,i=1/(t.fps||1),r=0,o=n.length;r!==o;++r)e.push(Ta.parse(n[r]).scale(i));return new Sa(t.name,t.duration,e)},toJSON:function(t){for(var e=[],n=t.tracks,i={name:t.name,duration:t.duration,tracks:e},r=0,o=n.length;r!==o;++r)e.push(Ta.toJSON(n[r]));return i},CreateFromMorphTargetSequence:function(t,e,n,i){for(var r=e.length,o=[],a=0;a<r;a++){var s=[],c=[];s.push((a+r-1)%r,a,(a+1)%r),c.push(0,1,0);var h=da.getKeyframeOrder(s);s=da.sortedArray(s,1,h),c=da.sortedArray(c,1,h),i||0!==s[0]||(s.push(r),c.push(c[0])),o.push(new _a(".morphTargetInfluences["+e[a].name+"]",s,c).scale(1/n))}return new Sa(t,-1,o)},findByName:function(t,e){var n=t;if(!Array.isArray(t)){var i=t;n=i.geometry&&i.geometry.animations||i.animations}for(var r=0;r<n.length;r++)if(n[r].name===e)return n[r];return null},CreateClipsFromMorphTargetSequences:function(t,e,n){for(var i={},r=/^([\w-]*?)([\d]+)$/,o=0,a=t.length;o<a;o++){var s=t[o],c=s.name.match(r);if(c&&c.length>1){var h=i[l=c[1]];h||(i[l]=h=[]),h.push(s)}}var u=[];for(var l in i)u.push(Sa.CreateFromMorphTargetSequence(l,i[l],e,n));return u},parseAnimation:function(t,e){if(!t)return console.error(" no animation in JSONLoader data"),null;for(var n=function(t,e,n,i,r){if(0!==n.length){var o=[],a=[];da.flattenJSON(n,o,a,i),0!==o.length&&r.push(new t(e,o,a))}},i=[],r=t.name||"default",o=t.length||-1,a=t.fps||30,s=t.hierarchy||[],c=0;c<s.length;c++){var h=s[c].keys;if(h&&0!==h.length)if(h[0].morphTargets){for(var u={},l=0;l<h.length;l++)if(h[l].morphTargets)for(var d=0;d<h[l].morphTargets.length;d++)u[h[l].morphTargets[d]]=-1;for(var p in u){var f=[],m=[];for(d=0;d!==h[l].morphTargets.length;++d){var g=h[l];f.push(g.time),m.push(g.morphTarget===p?1:0)}i.push(new _a(".morphTargetInfluence["+p+"]",f,m))}o=u.length*(a||1)}else{var v=".bones["+e[c].name+"]";n(ya,v+".position",h,"pos",i),n(ba,v+".quaternion",h,"rot",i),n(ya,v+".scale",h,"scl",i)}}return 0===i.length?null:new Sa(r,o,i)}}),Object.assign(Sa.prototype,{resetDuration:function(){for(var t=0,e=0,n=this.tracks.length;e!==n;++e){var i=this.tracks[e];t=Math.max(t,i.times[i.times.length-1])}this.duration=t},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(Aa.prototype,{load:function(t,e,n,i){var r=this,o=new Zo(r.manager);o.setResponseType("json"),o.load(t,function(t){e(r.parse(t))},n,i)},setTextures:function(t){this.textures=t},parse:function(t){var e=this.textures;function n(t){return void 0===e[t]&&console.warn("THREE.MaterialLoader: Undefined texture",t),e[t]}var i=new Wo[t.type];if(void 0!==t.uuid&&(i.uuid=t.uuid),void 0!==t.name&&(i.name=t.name),void 0!==t.color&&i.color.setHex(t.color),void 0!==t.roughness&&(i.roughness=t.roughness),void 0!==t.metalness&&(i.metalness=t.metalness),void 0!==t.emissive&&i.emissive.setHex(t.emissive),void 0!==t.specular&&i.specular.setHex(t.specular),void 0!==t.shininess&&(i.shininess=t.shininess),void 0!==t.clearCoat&&(i.clearCoat=t.clearCoat),void 0!==t.clearCoatRoughness&&(i.clearCoatRoughness=t.clearCoatRoughness),void 0!==t.uniforms&&(i.uniforms=t.uniforms),void 0!==t.vertexShader&&(i.vertexShader=t.vertexShader),void 0!==t.fragmentShader&&(i.fragmentShader=t.fragmentShader),void 0!==t.vertexColors&&(i.vertexColors=t.vertexColors),void 0!==t.fog&&(i.fog=t.fog),void 0!==t.shading&&(i.shading=t.shading),void 0!==t.blending&&(i.blending=t.blending),void 0!==t.side&&(i.side=t.side),void 0!==t.opacity&&(i.opacity=t.opacity),void 0!==t.transparent&&(i.transparent=t.transparent),void 0!==t.alphaTest&&(i.alphaTest=t.alphaTest),void 0!==t.depthTest&&(i.depthTest=t.depthTest),void 0!==t.depthWrite&&(i.depthWrite=t.depthWrite),void 0!==t.colorWrite&&(i.colorWrite=t.colorWrite),void 0!==t.wireframe&&(i.wireframe=t.wireframe),void 0!==t.wireframeLinewidth&&(i.wireframeLinewidth=t.wireframeLinewidth),void 0!==t.wireframeLinecap&&(i.wireframeLinecap=t.wireframeLinecap),void 0!==t.wireframeLinejoin&&(i.wireframeLinejoin=t.wireframeLinejoin),void 0!==t.skinning&&(i.skinning=t.skinning),void 0!==t.morphTargets&&(i.morphTargets=t.morphTargets),void 0!==t.size&&(i.size=t.size),void 0!==t.sizeAttenuation&&(i.sizeAttenuation=t.sizeAttenuation),void 0!==t.map&&(i.map=n(t.map)),void 0!==t.alphaMap&&(i.alphaMap=n(t.alphaMap),i.transparent=!0),void 0!==t.bumpMap&&(i.bumpMap=n(t.bumpMap)),void 0!==t.bumpScale&&(i.bumpScale=t.bumpScale),void 0!==t.normalMap&&(i.normalMap=n(t.normalMap)),void 0!==t.normalScale){var r=t.normalScale;!1===Array.isArray(r)&&(r=[r,r]),i.normalScale=(new Le).fromArray(r)}if(void 0!==t.displacementMap&&(i.displacementMap=n(t.displacementMap)),void 0!==t.displacementScale&&(i.displacementScale=t.displacementScale),void 0!==t.displacementBias&&(i.displacementBias=t.displacementBias),void 0!==t.roughnessMap&&(i.roughnessMap=n(t.roughnessMap)),void 0!==t.metalnessMap&&(i.metalnessMap=n(t.metalnessMap)),void 0!==t.emissiveMap&&(i.emissiveMap=n(t.emissiveMap)),void 0!==t.emissiveIntensity&&(i.emissiveIntensity=t.emissiveIntensity),void 0!==t.specularMap&&(i.specularMap=n(t.specularMap)),void 0!==t.envMap&&(i.envMap=n(t.envMap)),void 0!==t.reflectivity&&(i.reflectivity=t.reflectivity),void 0!==t.lightMap&&(i.lightMap=n(t.lightMap)),void 0!==t.lightMapIntensity&&(i.lightMapIntensity=t.lightMapIntensity),void 0!==t.aoMap&&(i.aoMap=n(t.aoMap)),void 0!==t.aoMapIntensity&&(i.aoMapIntensity=t.aoMapIntensity),void 0!==t.gradientMap&&(i.gradientMap=n(t.gradientMap)),void 0!==t.materials)for(var o=0,a=t.materials.length;o<a;o++)i.materials.push(this.parse(t.materials[o]));return i}}),Object.assign(La.prototype,{load:function(t,e,n,i){var r=this,o=new Zo(r.manager);o.setResponseType("json"),o.load(t,function(t){e(r.parse(t))},n,i)},parse:function(t){var e=new zi,n=t.data.index;if(void 0!==n){var i=new Ua[n.type](n.array);e.setIndex(new Mi(i,1))}var r=t.data.attributes;for(var o in r){var a=r[o];i=new Ua[a.type](a.array);e.addAttribute(o,new Mi(i,a.itemSize,a.normalized))}var s=t.data.groups||t.data.drawcalls||t.data.offsets;if(void 0!==s)for(var c=0,h=s.length;c!==h;++c){var u=s[c];e.addGroup(u.start,u.count,u.materialIndex)}var l=t.data.boundingSphere;if(void 0!==l){var d=new He;void 0!==l.center&&d.fromArray(l.center),e.boundingSphere=new ni(d,l.radius)}return e}});var Ra,Pa,Ca,Ia,Ua={Int8Array:Int8Array,Uint8Array:Uint8Array,Uint8ClampedArray:Uint8ClampedArray,Int16Array:Int16Array,Uint16Array:Uint16Array,Int32Array:Int32Array,Uint32Array:Uint32Array,Float32Array:Float32Array,Float64Array:Float64Array};function Na(){this.onLoadStart=function(){},this.onLoadProgress=function(){},this.onLoadComplete=function(){}}function Oa(t){"boolean"==typeof t&&(console.warn("THREE.JSONLoader: showStatus parameter has been removed from constructor."),t=void 0),this.manager=void 0!==t?t:Yo,this.withCredentials=!1}function Da(t){this.manager=void 0!==t?t:Yo,this.texturePath=""}Na.Handlers={handlers:[],add:function(t,e){this.handlers.push(t,e)},get:function(t){for(var e=this.handlers,n=0,i=e.length;n<i;n+=2){var r=e[n],o=e[n+1];if(r.test(t))return o}return null}},Object.assign(Na.prototype,{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 i=[],r=0;r<t.length;++r)i[r]=this.createMaterial(t[r],e,n);return i},createMaterial:(Ra={NoBlending:R,NormalBlending:P,AdditiveBlending:C,SubtractiveBlending:I,MultiplyBlending:U,CustomBlending:N},Pa=new In,Ca=new ta,Ia=new Aa,function(t,e,n){var i={};function r(t,r,o,a,s){var c,h=e+t,u=Na.Handlers.get(h);null!==u?c=u.load(h):(Ca.setCrossOrigin(n),c=Ca.load(h)),void 0!==r&&(c.repeat.fromArray(r),1!==r[0]&&(c.wrapS=_t),1!==r[1]&&(c.wrapT=_t)),void 0!==o&&c.offset.fromArray(o),void 0!==a&&("repeat"===a[0]&&(c.wrapS=_t),"mirror"===a[0]&&(c.wrapS=Mt),"repeat"===a[1]&&(c.wrapT=_t),"mirror"===a[1]&&(c.wrapT=Mt)),void 0!==s&&(c.anisotropy=s);var l=Ae.generateUUID();return i[l]=c,l}var o={uuid:Ae.generateUUID(),type:"MeshLambertMaterial"};for(var a in t){var s=t[a];switch(a){case"DbgColor":case"DbgIndex":case"opticalDensity":case"illumination":break;case"DbgName":o.name=s;break;case"blending":o.blending=Ra[s];break;case"colorAmbient":case"mapAmbient":console.warn("THREE.Loader.createMaterial:",a,"is no longer supported.");break;case"colorDiffuse":o.color=Pa.fromArray(s).getHex();break;case"colorSpecular":o.specular=Pa.fromArray(s).getHex();break;case"colorEmissive":o.emissive=Pa.fromArray(s).getHex();break;case"specularCoef":o.shininess=s;break;case"shading":"basic"===s.toLowerCase()&&(o.type="MeshBasicMaterial"),"phong"===s.toLowerCase()&&(o.type="MeshPhongMaterial"),"standard"===s.toLowerCase()&&(o.type="MeshStandardMaterial");break;case"mapDiffuse":o.map=r(s,t.mapDiffuseRepeat,t.mapDiffuseOffset,t.mapDiffuseWrap,t.mapDiffuseAnisotropy);break;case"mapDiffuseRepeat":case"mapDiffuseOffset":case"mapDiffuseWrap":case"mapDiffuseAnisotropy":break;case"mapEmissive":o.emissiveMap=r(s,t.mapEmissiveRepeat,t.mapEmissiveOffset,t.mapEmissiveWrap,t.mapEmissiveAnisotropy);break;case"mapEmissiveRepeat":case"mapEmissiveOffset":case"mapEmissiveWrap":case"mapEmissiveAnisotropy":break;case"mapLight":o.lightMap=r(s,t.mapLightRepeat,t.mapLightOffset,t.mapLightWrap,t.mapLightAnisotropy);break;case"mapLightRepeat":case"mapLightOffset":case"mapLightWrap":case"mapLightAnisotropy":break;case"mapAO":o.aoMap=r(s,t.mapAORepeat,t.mapAOOffset,t.mapAOWrap,t.mapAOAnisotropy);break;case"mapAORepeat":case"mapAOOffset":case"mapAOWrap":case"mapAOAnisotropy":break;case"mapBump":o.bumpMap=r(s,t.mapBumpRepeat,t.mapBumpOffset,t.mapBumpWrap,t.mapBumpAnisotropy);break;case"mapBumpScale":o.bumpScale=s;break;case"mapBumpRepeat":case"mapBumpOffset":case"mapBumpWrap":case"mapBumpAnisotropy":break;case"mapNormal":o.normalMap=r(s,t.mapNormalRepeat,t.mapNormalOffset,t.mapNormalWrap,t.mapNormalAnisotropy);break;case"mapNormalFactor":o.normalScale=[s,s];break;case"mapNormalRepeat":case"mapNormalOffset":case"mapNormalWrap":case"mapNormalAnisotropy":break;case"mapSpecular":o.specularMap=r(s,t.mapSpecularRepeat,t.mapSpecularOffset,t.mapSpecularWrap,t.mapSpecularAnisotropy);break;case"mapSpecularRepeat":case"mapSpecularOffset":case"mapSpecularWrap":case"mapSpecularAnisotropy":break;case"mapMetalness":o.metalnessMap=r(s,t.mapMetalnessRepeat,t.mapMetalnessOffset,t.mapMetalnessWrap,t.mapMetalnessAnisotropy);break;case"mapMetalnessRepeat":case"mapMetalnessOffset":case"mapMetalnessWrap":case"mapMetalnessAnisotropy":break;case"mapRoughness":o.roughnessMap=r(s,t.mapRoughnessRepeat,t.mapRoughnessOffset,t.mapRoughnessWrap,t.mapRoughnessAnisotropy);break;case"mapRoughnessRepeat":case"mapRoughnessOffset":case"mapRoughnessWrap":case"mapRoughnessAnisotropy":break;case"mapAlpha":o.alphaMap=r(s,t.mapAlphaRepeat,t.mapAlphaOffset,t.mapAlphaWrap,t.mapAlphaAnisotropy);break;case"mapAlphaRepeat":case"mapAlphaOffset":case"mapAlphaWrap":case"mapAlphaAnisotropy":break;case"flipSided":o.side=w;break;case"doubleSided":o.side=M;break;case"transparency":console.warn("THREE.Loader.createMaterial: transparency has been renamed to opacity"),o.opacity=s;break;case"depthTest":case"depthWrite":case"colorWrite":case"opacity":case"reflectivity":case"transparent":case"visible":case"wireframe":o[a]=s;break;case"vertexColors":!0===s&&(o.vertexColors=L),"face"===s&&(o.vertexColors=A);break;default:console.error("THREE.Loader.createMaterial: Unsupported",a,s)}}return"MeshBasicMaterial"===o.type&&delete o.emissive,"MeshPhongMaterial"!==o.type&&delete o.specular,o.opacity<1&&(o.transparent=!0),Ia.setTextures(i),Ia.parse(o)})}),Object.assign(Oa.prototype,{load:function(t,e,n,i){var r=this,o=this.texturePath&&"string"==typeof this.texturePath?this.texturePath:Na.prototype.extractUrlBase(t),a=new Zo(this.manager);a.setResponseType("json"),a.setWithCredentials(this.withCredentials),a.load(t,function(n){var i=n.metadata;if(void 0!==i){var a=i.type;if(void 0!==a){if("object"===a.toLowerCase())return void console.error("THREE.JSONLoader: "+t+" should be loaded with THREE.ObjectLoader instead.");if("scene"===a.toLowerCase())return void console.error("THREE.JSONLoader: "+t+" should be loaded with THREE.SceneLoader instead.")}}var s=r.parse(n,o);e(s.geometry,s.materials)},n,i)},setTexturePath:function(t){this.texturePath=t},parse:function(){return function(t,e){void 0!==t.data&&(t=t.data),void 0!==t.scale?t.scale=1/t.scale:t.scale=1;var n=new Bi;return function(t,e){function n(t,e){return t&1<<e}var i,r,o,a,s,c,h,u,l,d,p,f,m,g,v,y,x,b,_,w,M,E,T,S,A,L=t.faces,R=t.vertices,P=t.normals,C=t.colors,I=t.scale,U=0;if(void 0!==t.uvs){for(i=0;i<t.uvs.length;i++)t.uvs[i].length&&U++;for(i=0;i<U;i++)e.faceVertexUvs[i]=[]}for(a=0,s=R.length;a<s;)(b=new He).x=R[a++]*I,b.y=R[a++]*I,b.z=R[a++]*I,e.vertices.push(b);for(a=0,s=L.length;a<s;)if(p=n(d=L[a++],0),f=n(d,1),m=n(d,3),g=n(d,4),v=n(d,5),y=n(d,6),x=n(d,7),p){if((w=new _i).a=L[a],w.b=L[a+1],w.c=L[a+3],(M=new _i).a=L[a+1],M.b=L[a+2],M.c=L[a+3],a+=4,f&&(l=L[a++],w.materialIndex=l,M.materialIndex=l),o=e.faces.length,m)for(i=0;i<U;i++)for(S=t.uvs[i],e.faceVertexUvs[i][o]=[],e.faceVertexUvs[i][o+1]=[],r=0;r<4;r++)A=new Le(S[2*(u=L[a++])],S[2*u+1]),2!==r&&e.faceVertexUvs[i][o].push(A),0!==r&&e.faceVertexUvs[i][o+1].push(A);if(g&&(h=3*L[a++],w.normal.set(P[h++],P[h++],P[h]),M.normal.copy(w.normal)),v)for(i=0;i<4;i++)h=3*L[a++],T=new He(P[h++],P[h++],P[h]),2!==i&&w.vertexNormals.push(T),0!==i&&M.vertexNormals.push(T);if(y&&(E=C[c=L[a++]],w.color.setHex(E),M.color.setHex(E)),x)for(i=0;i<4;i++)E=C[c=L[a++]],2!==i&&w.vertexColors.push(new In(E)),0!==i&&M.vertexColors.push(new In(E));e.faces.push(w),e.faces.push(M)}else{if((_=new _i).a=L[a++],_.b=L[a++],_.c=L[a++],f&&(l=L[a++],_.materialIndex=l),o=e.faces.length,m)for(i=0;i<U;i++)for(S=t.uvs[i],e.faceVertexUvs[i][o]=[],r=0;r<3;r++)A=new Le(S[2*(u=L[a++])],S[2*u+1]),e.faceVertexUvs[i][o].push(A);if(g&&(h=3*L[a++],_.normal.set(P[h++],P[h++],P[h])),v)for(i=0;i<3;i++)h=3*L[a++],T=new He(P[h++],P[h++],P[h]),_.vertexNormals.push(T);if(y&&(c=L[a++],_.color.setHex(C[c])),x)for(i=0;i<3;i++)c=L[a++],_.vertexColors.push(new In(C[c]));e.faces.push(_)}}(t,n),function(t,e){var n=void 0!==t.influencesPerVertex?t.influencesPerVertex:2;if(t.skinWeights)for(var i=0,r=t.skinWeights.length;i<r;i+=n){var o=t.skinWeights[i],a=n>1?t.skinWeights[i+1]:0,s=n>2?t.skinWeights[i+2]:0,c=n>3?t.skinWeights[i+3]:0;e.skinWeights.push(new Fe(o,a,s,c))}if(t.skinIndices)for(i=0,r=t.skinIndices.length;i<r;i+=n){var h=t.skinIndices[i],u=n>1?t.skinIndices[i+1]:0,l=n>2?t.skinIndices[i+2]:0,d=n>3?t.skinIndices[i+3]:0;e.skinIndices.push(new Fe(h,u,l,d))}e.bones=t.bones,e.bones&&e.bones.length>0&&(e.skinWeights.length!==e.skinIndices.length||e.skinIndices.length!==e.vertices.length)&&console.warn("When skinning, number of vertices ("+e.vertices.length+"), skinIndices ("+e.skinIndices.length+"), and skinWeights ("+e.skinWeights.length+") should match.")}(t,n),function(t,e){var n=t.scale;if(void 0!==t.morphTargets)for(var i=0,r=t.morphTargets.length;i<r;i++){e.morphTargets[i]={},e.morphTargets[i].name=t.morphTargets[i].name,e.morphTargets[i].vertices=[];for(var o=e.morphTargets[i].vertices,a=t.morphTargets[i].vertices,s=0,c=a.length;s<c;s+=3){var h=new He;h.x=a[s]*n,h.y=a[s+1]*n,h.z=a[s+2]*n,o.push(h)}}if(void 0!==t.morphColors&&t.morphColors.length>0){console.warn('THREE.JSONLoader: "morphColors" no longer supported. Using them as face colors.');var u=e.faces,l=t.morphColors[0].colors;for(i=0,r=u.length;i<r;i++)u[i].color.fromArray(l,3*i)}}(t,n),function(t,e){var n=[],i=[];void 0!==t.animation&&i.push(t.animation),void 0!==t.animations&&(t.animations.length?i=i.concat(t.animations):i.push(t.animations));for(var r=0;r<i.length;r++){var o=Sa.parseAnimation(i[r],e.bones);o&&n.push(o)}if(e.morphTargets){var a=Sa.CreateClipsFromMorphTargetSequences(e.morphTargets,10);n=n.concat(a)}n.length>0&&(e.animations=n)}(t,n),n.computeFaceNormals(),n.computeBoundingSphere(),void 0===t.materials||0===t.materials.length?{geometry:n}:{geometry:n,materials:Na.prototype.initMaterials(t.materials,e,this.crossOrigin)}}}()}),Object.assign(Da.prototype,{load:function(t,e,n,i){""===this.texturePath&&(this.texturePath=t.substring(0,t.lastIndexOf("/")+1));var r=this;new Zo(r.manager).load(t,function(n){var o=null;try{o=JSON.parse(n)}catch(e){return void 0!==i&&i(e),void console.error("THREE:ObjectLoader: Can't parse "+t+".",e.message)}var a=o.metadata;void 0!==a&&void 0!==a.type&&"geometry"!==a.type.toLowerCase()?r.parse(o,e):console.error("THREE.ObjectLoader: Can't load "+t+". Use THREE.JSONLoader instead.")},n,i)},setTexturePath:function(t){this.texturePath=t},setCrossOrigin:function(t){this.crossOrigin=t},parse:function(t,e){var n=this.parseGeometries(t.geometries),i=this.parseImages(t.images,function(){void 0!==e&&e(a)}),r=this.parseTextures(t.textures,i),o=this.parseMaterials(t.materials,r),a=this.parseObject(t.object,n,o);return t.animations&&(a.animations=this.parseAnimations(t.animations)),void 0!==t.images&&0!==t.images.length||void 0!==e&&e(a),a},parseGeometries:function(t){var e={};if(void 0!==t)for(var n=new Oa,i=new La,r=0,o=t.length;r<o;r++){var a,s=t[r];switch(s.type){case"PlaneGeometry":case"PlaneBufferGeometry":a=new Oo[s.type](s.width,s.height,s.widthSegments,s.heightSegments);break;case"BoxGeometry":case"BoxBufferGeometry":case"CubeGeometry":a=new Oo[s.type](s.width,s.height,s.depth,s.widthSegments,s.heightSegments,s.depthSegments);break;case"CircleGeometry":case"CircleBufferGeometry":a=new Oo[s.type](s.radius,s.segments,s.thetaStart,s.thetaLength);break;case"CylinderGeometry":case"CylinderBufferGeometry":a=new Oo[s.type](s.radiusTop,s.radiusBottom,s.height,s.radialSegments,s.heightSegments,s.openEnded,s.thetaStart,s.thetaLength);break;case"ConeGeometry":case"ConeBufferGeometry":a=new Oo[s.type](s.radius,s.height,s.radialSegments,s.heightSegments,s.openEnded,s.thetaStart,s.thetaLength);break;case"SphereGeometry":case"SphereBufferGeometry":a=new Oo[s.type](s.radius,s.widthSegments,s.heightSegments,s.phiStart,s.phiLength,s.thetaStart,s.thetaLength);break;case"DodecahedronGeometry":case"IcosahedronGeometry":case"OctahedronGeometry":case"TetrahedronGeometry":a=new Oo[s.type](s.radius,s.detail);break;case"RingGeometry":case"RingBufferGeometry":a=new Oo[s.type](s.innerRadius,s.outerRadius,s.thetaSegments,s.phiSegments,s.thetaStart,s.thetaLength);break;case"TorusGeometry":case"TorusBufferGeometry":a=new Oo[s.type](s.radius,s.tube,s.radialSegments,s.tubularSegments,s.arc);break;case"TorusKnotGeometry":case"TorusKnotBufferGeometry":a=new Oo[s.type](s.radius,s.tube,s.tubularSegments,s.radialSegments,s.p,s.q);break;case"LatheGeometry":case"LatheBufferGeometry":a=new Oo[s.type](s.points,s.segments,s.phiStart,s.phiLength);break;case"BufferGeometry":a=i.parse(s);break;case"Geometry":a=n.parse(s,this.texturePath).geometry;break;default:console.warn('THREE.ObjectLoader: Unsupported geometry type "'+s.type+'"');continue}a.uuid=s.uuid,void 0!==s.name&&(a.name=s.name),e[s.uuid]=a}return e},parseMaterials:function(t,e){var n={};if(void 0!==t){var i=new Aa;i.setTextures(e);for(var r=0,o=t.length;r<o;r++){var a=i.parse(t[r]);n[a.uuid]=a}}return n},parseAnimations:function(t){for(var e=[],n=0;n<t.length;n++){var i=Sa.parse(t[n]);e.push(i)}return e},parseImages:function(t,e){var n=this,i={};function r(t){return n.manager.itemStart(t),o.load(t,function(){n.manager.itemEnd(t)},void 0,function(){n.manager.itemEnd(t),n.manager.itemError(t)})}if(void 0!==t&&t.length>0){var o=new Ko(new qo(e));o.setCrossOrigin(this.crossOrigin);for(var a=0,s=t.length;a<s;a++){var c=t[a],h=/^(\/\/)|([a-z]+:(\/\/)?)/i.test(c.url)?c.url:n.texturePath+c.url;i[c.uuid]=r(h)}}return i},parseTextures:function(t,e){function n(t,e){return"number"==typeof t?t:(console.warn("THREE.ObjectLoader.parseTexture: Constant should be in numeric form.",t),e[t])}var i={};if(void 0!==t)for(var r=0,o=t.length;r<o;r++){var a=t[r];void 0===a.image&&console.warn('THREE.ObjectLoader: No "image" specified for',a.uuid),void 0===e[a.image]&&console.warn("THREE.ObjectLoader: Undefined image",a.image);var s=new De(e[a.image]);s.needsUpdate=!0,s.uuid=a.uuid,void 0!==a.name&&(s.name=a.name),void 0!==a.mapping&&(s.mapping=n(a.mapping,Fa)),void 0!==a.offset&&s.offset.fromArray(a.offset),void 0!==a.repeat&&s.repeat.fromArray(a.repeat),void 0!==a.wrap&&(s.wrapS=n(a.wrap[0],Ba),s.wrapT=n(a.wrap[1],Ba)),void 0!==a.minFilter&&(s.minFilter=n(a.minFilter,za)),void 0!==a.magFilter&&(s.magFilter=n(a.magFilter,za)),void 0!==a.anisotropy&&(s.anisotropy=a.anisotropy),void 0!==a.flipY&&(s.flipY=a.flipY),i[a.uuid]=s}return i},parseObject:function(){var t=new Ve;return function(e,n,i){var r;function o(t){return void 0===n[t]&&console.warn("THREE.ObjectLoader: Undefined geometry",t),n[t]}function a(t){if(void 0!==t){if(Array.isArray(t)){for(var e=[],n=0,r=t.length;n<r;n++){var o=t[n];void 0===i[o]&&console.warn("THREE.ObjectLoader: Undefined material",o),e.push(i[o])}return e}return void 0===i[t]&&console.warn("THREE.ObjectLoader: Undefined material",t),i[t]}}switch(e.type){case"Scene":r=new Pr,void 0!==e.background&&Number.isInteger(e.background)&&(r.background=new In(e.background)),void 0!==e.fog&&("Fog"===e.fog.type?r.fog=new Rr(e.fog.color,e.fog.near,e.fog.far):"FogExp2"===e.fog.type&&(r.fog=new Lr(e.fog.color,e.fog.density)));break;case"PerspectiveCamera":r=new Xi(e.fov,e.aspect,e.near,e.far),void 0!==e.focus&&(r.focus=e.focus),void 0!==e.zoom&&(r.zoom=e.zoom),void 0!==e.filmGauge&&(r.filmGauge=e.filmGauge),void 0!==e.filmOffset&&(r.filmOffset=e.filmOffset),void 0!==e.view&&(r.view=Object.assign({},e.view));break;case"OrthographicCamera":r=new qi(e.left,e.right,e.top,e.bottom,e.near,e.far);break;case"AmbientLight":r=new ha(e.color,e.intensity);break;case"DirectionalLight":r=new ca(e.color,e.intensity);break;case"PointLight":r=new aa(e.color,e.intensity,e.distance,e.decay);break;case"RectAreaLight":r=new ua(e.color,e.intensity,e.width,e.height);break;case"SpotLight":r=new oa(e.color,e.intensity,e.distance,e.angle,e.penumbra,e.decay);break;case"HemisphereLight":r=new na(e.color,e.groundColor,e.intensity);break;case"SkinnedMesh":console.warn("THREE.ObjectLoader.parseObject() does not support SkinnedMesh yet.");case"Mesh":var s=o(e.geometry),c=a(e.material);r=s.bones&&s.bones.length>0?new Fr(s,c):new Gi(s,c);break;case"LOD":r=new Nr;break;case"Line":r=new zr(o(e.geometry),a(e.material),e.mode);break;case"LineLoop":r=new Hr(o(e.geometry),a(e.material));break;case"LineSegments":r=new Gr(o(e.geometry),a(e.material));break;case"PointCloud":case"Points":r=new kr(o(e.geometry),a(e.material));break;case"Sprite":r=new Ur(a(e.material));break;case"Group":r=new jr;break;default:r=new yi}if(r.uuid=e.uuid,void 0!==e.name&&(r.name=e.name),void 0!==e.matrix?(t.fromArray(e.matrix),t.decompose(r.position,r.quaternion,r.scale)):(void 0!==e.position&&r.position.fromArray(e.position),void 0!==e.rotation&&r.rotation.fromArray(e.rotation),void 0!==e.quaternion&&r.quaternion.fromArray(e.quaternion),void 0!==e.scale&&r.scale.fromArray(e.scale)),void 0!==e.castShadow&&(r.castShadow=e.castShadow),void 0!==e.receiveShadow&&(r.receiveShadow=e.receiveShadow),e.shadow&&(void 0!==e.shadow.bias&&(r.shadow.bias=e.shadow.bias),void 0!==e.shadow.radius&&(r.shadow.radius=e.shadow.radius),void 0!==e.shadow.mapSize&&r.shadow.mapSize.fromArray(e.shadow.mapSize),void 0!==e.shadow.camera&&(r.shadow.camera=this.parseObject(e.shadow.camera))),void 0!==e.visible&&(r.visible=e.visible),void 0!==e.userData&&(r.userData=e.userData),void 0!==e.children)for(var h in e.children)r.add(this.parseObject(e.children[h],n,i));if("LOD"===e.type)for(var u=e.levels,l=0;l<u.length;l++){var d=u[l];void 0!==(h=r.getObjectByProperty("uuid",d.object))&&r.addLevel(h,d.distance)}return r}}()});var Fa={UVMapping:pt,CubeReflectionMapping:ft,CubeRefractionMapping:mt,EquirectangularReflectionMapping:gt,EquirectangularRefractionMapping:vt,SphericalReflectionMapping:yt,CubeUVReflectionMapping:xt,CubeUVRefractionMapping:bt},Ba={RepeatWrapping:_t,ClampToEdgeWrapping:wt,MirroredRepeatWrapping:Mt},za={NearestFilter:Et,NearestMipMapNearestFilter:Tt,NearestMipMapLinearFilter:St,LinearFilter:At,LinearMipMapNearestFilter:Lt,LinearMipMapLinearFilter:Rt};function Ga(t,e,n,i,r){var o=.5*(i-e),a=.5*(r-n),s=t*t;return(2*n-2*i+o+a)*(t*s)+(-3*n+3*i-2*o-a)*s+o*t+n}function Ha(t,e,n,i){return function(t,e){var n=1-t;return n*n*e}(t,e)+function(t,e){return 2*(1-t)*t*e}(t,n)+function(t,e){return t*t*e}(t,i)}function Va(t,e,n,i,r){return function(t,e){var n=1-t;return n*n*n*e}(t,e)+function(t,e){var n=1-t;return 3*n*n*t*e}(t,n)+function(t,e){return 3*(1-t)*t*t*e}(t,i)+function(t,e){return t*t*t*e}(t,r)}function ka(){this.arcLengthDivisions=200}function ja(t,e){ka.call(this),this.v1=t,this.v2=e}function Wa(){ka.call(this),this.curves=[],this.autoClose=!1}function Xa(t,e,n,i,r,o,a,s){ka.call(this),this.aX=t,this.aY=e,this.xRadius=n,this.yRadius=i,this.aStartAngle=r,this.aEndAngle=o,this.aClockwise=a,this.aRotation=s||0}function qa(t){ka.call(this),this.points=void 0===t?[]:t}function Ya(t,e,n,i){ka.call(this),this.v0=t,this.v1=e,this.v2=n,this.v3=i}function Za(t,e,n){ka.call(this),this.v0=t,this.v1=e,this.v2=n}Object.assign(ka.prototype,{getPoint:function(){return console.warn("THREE.Curve: .getPoint() not implemented."),null},getPointAt:function(t){var e=this.getUtoTmapping(t);return this.getPoint(e)},getPoints:function(t){void 0===t&&(t=5);for(var e=[],n=0;n<=t;n++)e.push(this.getPoint(n/t));return e},getSpacedPoints:function(t){void 0===t&&(t=5);for(var e=[],n=0;n<=t;n++)e.push(this.getPointAt(n/t));return e},getLength:function(){var t=this.getLengths();return t[t.length-1]},getLengths:function(t){if(void 0===t&&(t=this.arcLengthDivisions),this.cacheArcLengths&&this.cacheArcLengths.length===t+1&&!this.needsUpdate)return this.cacheArcLengths;this.needsUpdate=!1;var e,n,i=[],r=this.getPoint(0),o=0;for(i.push(0),n=1;n<=t;n++)o+=(e=this.getPoint(n/t)).distanceTo(r),i.push(o),r=e;return this.cacheArcLengths=i,i},updateArcLengths:function(){this.needsUpdate=!0,this.getLengths()},getUtoTmapping:function(t,e){var n,i=this.getLengths(),r=0,o=i.length;n=e||t*i[o-1];for(var a,s=0,c=o-1;s<=c;)if((a=i[r=Math.floor(s+(c-s)/2)]-n)<0)s=r+1;else{if(!(a>0)){c=r;break}c=r-1}if(i[r=c]===n)return r/(o-1);var h=i[r];return(r+(n-h)/(i[r+1]-h))/(o-1)},getTangent:function(t){var e=t-1e-4,n=t+1e-4;e<0&&(e=0),n>1&&(n=1);var i=this.getPoint(e);return this.getPoint(n).clone().sub(i).normalize()},getTangentAt:function(t){var e=this.getUtoTmapping(t);return this.getTangent(e)},computeFrenetFrames:function(t,e){var n,i,r,o=new He,a=[],s=[],c=[],h=new He,u=new Ve;for(n=0;n<=t;n++)i=n/t,a[n]=this.getTangentAt(i),a[n].normalize();s[0]=new He,c[0]=new He;var l=Number.MAX_VALUE,d=Math.abs(a[0].x),p=Math.abs(a[0].y),f=Math.abs(a[0].z);for(d<=l&&(l=d,o.set(1,0,0)),p<=l&&(l=p,o.set(0,1,0)),f<=l&&o.set(0,0,1),h.crossVectors(a[0],o).normalize(),s[0].crossVectors(a[0],h),c[0].crossVectors(a[0],s[0]),n=1;n<=t;n++)s[n]=s[n-1].clone(),c[n]=c[n-1].clone(),h.crossVectors(a[n-1],a[n]),h.length()>Number.EPSILON&&(h.normalize(),r=Math.acos(Ae.clamp(a[n-1].dot(a[n]),-1,1)),s[n].applyMatrix4(u.makeRotationAxis(h,r))),c[n].crossVectors(a[n],s[n]);if(!0===e)for(r=Math.acos(Ae.clamp(s[0].dot(s[t]),-1,1)),r/=t,a[0].dot(h.crossVectors(s[0],s[t]))>0&&(r=-r),n=1;n<=t;n++)s[n].applyMatrix4(u.makeRotationAxis(a[n],r*n)),c[n].crossVectors(a[n],s[n]);return{tangents:a,normals:s,binormals:c}}}),ja.prototype=Object.create(ka.prototype),ja.prototype.constructor=ja,ja.prototype.isLineCurve=!0,ja.prototype.getPoint=function(t){if(1===t)return this.v2.clone();var e=this.v2.clone().sub(this.v1);return e.multiplyScalar(t).add(this.v1),e},ja.prototype.getPointAt=function(t){return this.getPoint(t)},ja.prototype.getTangent=function(t){return this.v2.clone().sub(this.v1).normalize()},Wa.prototype=Object.assign(Object.create(ka.prototype),{constructor:Wa,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 ja(e,t))},getPoint:function(t){for(var e=t*this.getLength(),n=this.getCurveLengths(),i=0;i<n.length;){if(n[i]>=e){var r=n[i]-e,o=this.curves[i],a=o.getLength(),s=0===a?0:1-r/a;return o.getPointAt(s)}i++}return null},getLength:function(){var t=this.getCurveLengths();return t[t.length-1]},updateArcLengths:function(){this.needsUpdate=!0,this.cacheLengths=null,this.getCurveLengths()},getCurveLengths:function(){if(this.cacheLengths&&this.cacheLengths.length===this.curves.length)return this.cacheLengths;for(var t=[],e=0,n=0,i=this.curves.length;n<i;n++)e+=this.curves[n].getLength(),t.push(e);return this.cacheLengths=t,t},getSpacedPoints:function(t){void 0===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=[],i=0,r=this.curves;i<r.length;i++)for(var o=r[i],a=o&&o.isEllipseCurve?2*t:o&&o.isLineCurve?1:o&&o.isSplineCurve?t*o.points.length:t,s=o.getPoints(a),c=0;c<s.length;c++){var h=s[c];e&&e.equals(h)||(n.push(h),e=h)}return this.autoClose&&n.length>1&&!n[n.length-1].equals(n[0])&&n.push(n[0]),n},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 Bi,n=0,i=t.length;n<i;n++){var r=t[n];e.vertices.push(new He(r.x,r.y,r.z||0))}return e}}),Xa.prototype=Object.create(ka.prototype),Xa.prototype.constructor=Xa,Xa.prototype.isEllipseCurve=!0,Xa.prototype.getPoint=function(t){for(var e=2*Math.PI,n=this.aEndAngle-this.aStartAngle,i=Math.abs(n)<Number.EPSILON;n<0;)n+=e;for(;n>e;)n-=e;n<Number.EPSILON&&(n=i?0:e),!0!==this.aClockwise||i||(n===e?n=-e:n-=e);var r=this.aStartAngle+t*n,o=this.aX+this.xRadius*Math.cos(r),a=this.aY+this.yRadius*Math.sin(r);if(0!==this.aRotation){var s=Math.cos(this.aRotation),c=Math.sin(this.aRotation),h=o-this.aX,u=a-this.aY;o=h*s-u*c+this.aX,a=h*c+u*s+this.aY}return new Le(o,a)},qa.prototype=Object.create(ka.prototype),qa.prototype.constructor=qa,qa.prototype.isSplineCurve=!0,qa.prototype.getPoint=function(t){var e=this.points,n=(e.length-1)*t,i=Math.floor(n),r=n-i,o=e[0===i?i:i-1],a=e[i],s=e[i>e.length-2?e.length-1:i+1],c=e[i>e.length-3?e.length-1:i+2];return new Le(Ga(r,o.x,a.x,s.x,c.x),Ga(r,o.y,a.y,s.y,c.y))},Ya.prototype=Object.create(ka.prototype),Ya.prototype.constructor=Ya,Ya.prototype.getPoint=function(t){var e=this.v0,n=this.v1,i=this.v2,r=this.v3;return new Le(Va(t,e.x,n.x,i.x,r.x),Va(t,e.y,n.y,i.y,r.y))},Za.prototype=Object.create(ka.prototype),Za.prototype.constructor=Za,Za.prototype.getPoint=function(t){var e=this.v0,n=this.v1,i=this.v2;return new Le(Ha(t,e.x,n.x,i.x),Ha(t,e.y,n.y,i.y))};var Ja,Qa=Object.assign(Object.create(Wa.prototype),{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.currentPoint.set(t,e)},lineTo:function(t,e){var n=new ja(this.currentPoint.clone(),new Le(t,e));this.curves.push(n),this.currentPoint.set(t,e)},quadraticCurveTo:function(t,e,n,i){var r=new Za(this.currentPoint.clone(),new Le(t,e),new Le(n,i));this.curves.push(r),this.currentPoint.set(n,i)},bezierCurveTo:function(t,e,n,i,r,o){var a=new Ya(this.currentPoint.clone(),new Le(t,e),new Le(n,i),new Le(r,o));this.curves.push(a),this.currentPoint.set(r,o)},splineThru:function(t){var e=new qa([this.currentPoint.clone()].concat(t));this.curves.push(e),this.currentPoint.copy(t[t.length-1])},arc:function(t,e,n,i,r,o){var a=this.currentPoint.x,s=this.currentPoint.y;this.absarc(t+a,e+s,n,i,r,o)},absarc:function(t,e,n,i,r,o){this.absellipse(t,e,n,n,i,r,o)},ellipse:function(t,e,n,i,r,o,a,s){var c=this.currentPoint.x,h=this.currentPoint.y;this.absellipse(t+c,e+h,n,i,r,o,a,s)},absellipse:function(t,e,n,i,r,o,a,s){var c=new Xa(t,e,n,i,r,o,a,s);if(this.curves.length>0){var h=c.getPoint(0);h.equals(this.currentPoint)||this.lineTo(h.x,h.y)}this.curves.push(c);var u=c.getPoint(1);this.currentPoint.copy(u)}});function Ka(t){Wa.call(this),this.currentPoint=new Le,t&&this.fromPoints(t)}function $a(){Ka.apply(this,arguments),this.holes=[]}function ts(){this.subPaths=[],this.currentPath=null}function es(t){this.data=t}function ns(t){this.manager=void 0!==t?t:Yo}Ka.prototype=Qa,Qa.constructor=Ka,$a.prototype=Object.assign(Object.create(Qa),{constructor:$a,getPointsHoles:function(t){for(var e=[],n=0,i=this.holes.length;n<i;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)}}),Object.assign(ts.prototype,{moveTo:function(t,e){this.currentPath=new Ka,this.subPaths.push(this.currentPath),this.currentPath.moveTo(t,e)},lineTo:function(t,e){this.currentPath.lineTo(t,e)},quadraticCurveTo:function(t,e,n,i){this.currentPath.quadraticCurveTo(t,e,n,i)},bezierCurveTo:function(t,e,n,i,r,o){this.currentPath.bezierCurveTo(t,e,n,i,r,o)},splineThru:function(t){this.currentPath.splineThru(t)},toShapes:function(t,e){function n(t){for(var e=[],n=0,i=t.length;n<i;n++){var r=t[n],o=new $a;o.curves=r.curves,e.push(o)}return e}function i(t,e){for(var n=e.length,i=!1,r=n-1,o=0;o<n;r=o++){var a=e[r],s=e[o],c=s.x-a.x,h=s.y-a.y;if(Math.abs(h)>Number.EPSILON){if(h<0&&(a=e[o],c=-c,s=e[r],h=-h),t.y<a.y||t.y>s.y)continue;if(t.y===a.y){if(t.x===a.x)return!0}else{var u=h*(t.x-a.x)-c*(t.y-a.y);if(0===u)return!0;if(u<0)continue;i=!i}}else{if(t.y!==a.y)continue;if(s.x<=t.x&&t.x<=a.x||a.x<=t.x&&t.x<=s.x)return!0}}return i}var r=mo.isClockWise,o=this.subPaths;if(0===o.length)return[];if(!0===e)return n(o);var a,s,c,h=[];if(1===o.length)return s=o[0],(c=new $a).curves=s.curves,h.push(c),h;var u=!r(o[0].getPoints());u=t?!u:u;var l,d,p=[],f=[],m=[],g=0;f[g]=void 0,m[g]=[];for(var v=0,y=o.length;v<y;v++)a=r(l=(s=o[v]).getPoints()),(a=t?!a:a)?(!u&&f[g]&&g++,f[g]={s:new $a,p:l},f[g].s.curves=s.curves,u&&g++,m[g]=[]):m[g].push({h:s,p:l[0]});if(!f[0])return n(o);if(f.length>1){for(var x=!1,b=[],_=0,w=f.length;_<w;_++)p[_]=[];for(_=0,w=f.length;_<w;_++)for(var M=m[_],E=0;E<M.length;E++){for(var T=M[E],S=!0,A=0;A<f.length;A++)i(T.p,f[A].p)&&(_!==A&&b.push({froms:_,tos:A,hole:E}),S?(S=!1,p[A].push(T)):x=!0);S&&p[_].push(T)}b.length>0&&(x||(m=p))}v=0;for(var L=f.length;v<L;v++){c=f[v].s,h.push(c);for(var R=0,P=(d=m[v]).length;R<P;R++)c.holes.push(d[R].h)}return h}}),Object.assign(es.prototype,{isFont:!0,generateShapes:function(t,e,n){function i(t,e,i,o){var a=r.glyphs[t]||r.glyphs["?"];if(a){var s,c,h,u,l,d,p,f,m,g,v,y=new ts,x=[];if(a.o)for(var b=a._cachedOutline||(a._cachedOutline=a.o.split(" ")),_=0,w=b.length;_<w;){switch(b[_++]){case"m":s=b[_++]*e+i,c=b[_++]*e+o,y.moveTo(s,c);break;case"l":s=b[_++]*e+i,c=b[_++]*e+o,y.lineTo(s,c);break;case"q":if(h=b[_++]*e+i,u=b[_++]*e+o,p=b[_++]*e+i,f=b[_++]*e+o,y.quadraticCurveTo(p,f,h,u),v=x[x.length-1]){l=v.x,d=v.y;for(var M=1;M<=n;M++){Ha(E=M/n,l,p,h),Ha(E,d,f,u)}}break;case"b":if(h=b[_++]*e+i,u=b[_++]*e+o,p=b[_++]*e+i,f=b[_++]*e+o,m=b[_++]*e+i,g=b[_++]*e+o,y.bezierCurveTo(p,f,m,g,h,u),v=x[x.length-1]){l=v.x,d=v.y;for(M=1;M<=n;M++){var E;Va(E=M/n,l,p,m,h),Va(E,d,f,g,u)}}}}return{offsetX:a.ha*e,path:y}}}void 0===e&&(e=100),void 0===n&&(n=4);for(var r=this.data,o=function(t){for(var n=String(t).split(""),o=e/r.resolution,a=(r.boundingBox.yMax-r.boundingBox.yMin+r.underlineThickness)*o,s=0,c=0,h=[],u=0;u<n.length;u++){var l=n[u];if("\n"===l)s=0,c-=a;else{var d=i(l,o,s,c);s+=d.offsetX,h.push(d.path)}}return h}(t),a=[],s=0,c=o.length;s<c;s++)Array.prototype.push.apply(a,o[s].toShapes());return a}}),Object.assign(ns.prototype,{load:function(t,e,n,i){var r=this;new Zo(this.manager).load(t,function(t){var n;try{n=JSON.parse(t)}catch(e){console.warn("THREE.FontLoader: typeface.js support is being deprecated. Use typeface.json instead."),n=JSON.parse(t.substring(65,t.length-2))}var i=r.parse(n);e&&e(i)},n,i)},parse:function(t){return new es(t)}});var is,rs,os,as,ss,cs,hs,us,ls,ds,ps,fs,ms,gs,vs,ys,xs,bs,_s={getContext:function(){return void 0===Ja&&(Ja=new(window.AudioContext||window.webkitAudioContext)),Ja},setContext:function(t){Ja=t}};function ws(t){this.manager=void 0!==t?t:Yo}function Ms(){this.type="StereoCamera",this.aspect=1,this.eyeSep=.064,this.cameraL=new Xi,this.cameraL.layers.enable(1),this.cameraL.matrixAutoUpdate=!1,this.cameraR=new Xi,this.cameraR.layers.enable(2),this.cameraR.matrixAutoUpdate=!1}function Es(t,e,n){yi.call(this),this.type="CubeCamera";var i=new Xi(90,1,t,e);i.up.set(0,-1,0),i.lookAt(new He(1,0,0)),this.add(i);var r=new Xi(90,1,t,e);r.up.set(0,-1,0),r.lookAt(new He(-1,0,0)),this.add(r);var o=new Xi(90,1,t,e);o.up.set(0,0,1),o.lookAt(new He(0,1,0)),this.add(o);var a=new Xi(90,1,t,e);a.up.set(0,0,-1),a.lookAt(new He(0,-1,0)),this.add(a);var s=new Xi(90,1,t,e);s.up.set(0,-1,0),s.lookAt(new He(0,0,1)),this.add(s);var c=new Xi(90,1,t,e);c.up.set(0,-1,0),c.lookAt(new He(0,0,-1)),this.add(c);var h={format:kt,magFilter:At,minFilter:At};this.renderTarget=new ze(n,n,h),this.renderTarget.texture.name="CubeCamera",this.updateCubeMap=function(t,e){null===this.parent&&this.updateMatrixWorld();var n=this.renderTarget,h=n.texture.generateMipmaps;n.texture.generateMipmaps=!1,n.activeCubeFace=0,t.render(e,i,n),n.activeCubeFace=1,t.render(e,r,n),n.activeCubeFace=2,t.render(e,o,n),n.activeCubeFace=3,t.render(e,a,n),n.activeCubeFace=4,t.render(e,s,n),n.texture.generateMipmaps=h,n.activeCubeFace=5,t.render(e,c,n),t.setRenderTarget(null)}}function Ts(t){Xi.call(this),this.enabled=!1,this.cameras=t||[]}function Ss(){yi.call(this),this.type="AudioListener",this.context=_s.getContext(),this.gain=this.context.createGain(),this.gain.connect(this.context.destination),this.filter=null}function As(t){yi.call(this),this.type="Audio",this.context=t.context,this.gain=this.context.createGain(),this.gain.connect(t.getInput()),this.autoplay=!1,this.buffer=null,this.loop=!1,this.startTime=0,this.playbackRate=1,this.isPlaying=!1,this.hasPlaybackControl=!0,this.sourceType="empty",this.filters=[]}function Ls(t){As.call(this,t),this.panner=this.context.createPanner(),this.panner.connect(this.gain)}function Rs(t,e){this.analyser=t.context.createAnalyser(),this.analyser.fftSize=void 0!==e?e:2048,this.data=new Uint8Array(this.analyser.frequencyBinCount),t.getOutput().connect(this.analyser)}function Ps(t,e,n){this.binding=t,this.valueSize=n;var i,r=Float64Array;switch(e){case"quaternion":i=this._slerp;break;case"string":case"bool":r=Array,i=this._select;break;default:i=this._lerp}this.buffer=new r(4*n),this._mixBufferRegion=i,this.cumulativeWeight=0,this.useCount=0,this.referenceCount=0}function Cs(t,e,n){var i=n||Is.parseTrackName(e);this._targetGroup=t,this._bindings=t.subscribe_(e,i)}function Is(t,e,n){this.path=e,this.parsedPath=n||Is.parseTrackName(e),this.node=Is.findNode(t,this.parsedPath.nodeName)||t,this.rootNode=t}function Us(t){this.uuid=Ae.generateUUID(),this._objects=Array.prototype.slice.call(arguments),this.nCachedObjects_=0;var e={};this._indicesByUUID=e;for(var n=0,i=arguments.length;n!==i;++n)e[arguments[n].uuid]=n;this._paths=[],this._parsedPaths=[],this._bindings=[],this._bindingsIndicesByPath={};var r=this;this.stats={objects:{get total(){return r._objects.length},get inUse(){return this.total-r.nCachedObjects_}},get bindingsPerObject(){return r._bindings.length}}}function Ns(t,e,n){this._mixer=t,this._clip=e,this._localRoot=n||null;for(var i=e.tracks,r=i.length,o=new Array(r),a={endingStart:le,endingEnd:le},s=0;s!==r;++s){var c=i[s].createInterpolant(null);o[s]=c,c.settings=a}this._interpolantSettings=a,this._interpolants=o,this._propertyBindings=new Array(r),this._cacheIndex=null,this._byClipCacheIndex=null,this._timeScaleInterpolant=null,this._weightInterpolant=null,this.loop=ae,this._loopCount=-1,this._startTime=null,this.time=0,this.timeScale=1,this._effectiveTimeScale=1,this.weight=1,this._effectiveWeight=1,this.repetitions=1/0,this.paused=!1,this.enabled=!0,this.clampWhenFinished=!1,this.zeroSlopeAtStart=!0,this.zeroSlopeAtEnd=!0}function Os(t){this._root=t,this._initMemoryManager(),this._accuIndex=0,this.time=0,this.timeScale=1}function Ds(t){"string"==typeof t&&(console.warn("THREE.Uniform: Type parameter is no longer needed."),t=arguments[1]),this.value=t}function Fs(){zi.call(this),this.type="InstancedBufferGeometry",this.maxInstancedCount=void 0}function Bs(t,e,n,i){this.uuid=Ae.generateUUID(),this.data=t,this.itemSize=e,this.offset=n,this.normalized=!0===i}function zs(t,e){this.uuid=Ae.generateUUID(),this.array=t,this.stride=e,this.count=void 0!==t?t.length/e:0,this.dynamic=!1,this.updateRange={offset:0,count:-1},this.onUploadCallback=function(){},this.version=0}function Gs(t,e,n){zs.call(this,t,e),this.meshPerAttribute=n||1}function Hs(t,e,n){Mi.call(this,t,e),this.meshPerAttribute=n||1}function Vs(t,e,n,i){this.ray=new si(t,e),this.near=n||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}}})}function ks(t,e){return t.distance-e.distance}function js(t,e,n,i){if(!1!==t.visible&&(t.raycast(e,n),!0===i))for(var r=t.children,o=0,a=r.length;o<a;o++)js(r[o],e,n,!0)}function Ws(t){this.autoStart=void 0===t||t,this.startTime=0,this.oldTime=0,this.elapsedTime=0,this.running=!1}function Xs(t,e,n){return this.radius=void 0!==t?t:1,this.phi=void 0!==e?e:0,this.theta=void 0!==n?n:0,this}function qs(t,e,n){return this.radius=void 0!==t?t:1,this.theta=void 0!==e?e:0,this.y=void 0!==n?n:0,this}function Ys(t,e){Gi.call(this,t,e),this.animationsMap={},this.animationsList=[];var n=this.geometry.morphTargets.length,i=n-1,r=n/1;this.createAnimation("__default",0,i,r),this.setAnimationWeight("__default",1)}function Zs(t){yi.call(this),this.material=t,this.render=function(t){}}function Js(t,e,n,i){this.object=t,this.size=void 0!==e?e:1;var r=void 0!==n?n:16711680,o=void 0!==i?i:1,a=0,s=this.object.geometry;s&&s.isGeometry?a=3*s.faces.length:s&&s.isBufferGeometry&&(a=s.attributes.normal.count);var c=new zi,h=new Ci(2*a*3,3);c.addAttribute("position",h),Gr.call(this,c,new Br({color:r,linewidth:o})),this.matrixAutoUpdate=!1,this.update()}function Qs(t){yi.call(this),this.light=t,this.light.updateMatrixWorld(),this.matrix=t.matrixWorld,this.matrixAutoUpdate=!1;for(var e=new zi,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],i=0,r=1;i<32;i++,r++){var o=i/32*Math.PI*2,a=r/32*Math.PI*2;n.push(Math.cos(o),Math.sin(o),1,Math.cos(a),Math.sin(a),1)}e.addAttribute("position",new Ci(n,3));var s=new Br({fog:!1});this.cone=new Gr(e,s),this.add(this.cone),this.update()}function Ks(t){this.bones=this.getBoneList(t);for(var e=new zi,n=[],i=[],r=new In(0,0,1),o=new In(0,1,0),a=0;a<this.bones.length;a++){var s=this.bones[a];s.parent&&s.parent.isBone&&(n.push(0,0,0),n.push(0,0,0),i.push(r.r,r.g,r.b),i.push(o.r,o.g,o.b))}e.addAttribute("position",new Ci(n,3)),e.addAttribute("color",new Ci(i,3));var c=new Br({vertexColors:L,depthTest:!1,depthWrite:!1,transparent:!0});Gr.call(this,e,c),this.root=t,this.matrix=t.matrixWorld,this.matrixAutoUpdate=!1,this.update()}function $s(t,e){this.light=t,this.light.updateMatrixWorld();var n=new _o(e,4,2),i=new wi({wireframe:!0,fog:!1});i.color.copy(this.light.color).multiplyScalar(this.light.intensity),Gi.call(this,n,i),this.matrix=this.light.matrixWorld,this.matrixAutoUpdate=!1}function tc(t){yi.call(this),this.light=t,this.light.updateMatrixWorld();var e=new wi({color:t.color,fog:!1}),n=new wi({color:t.color,fog:!1,wireframe:!0}),i=new zi;i.addAttribute("position",new Mi(new Float32Array(18),3)),this.add(new Gi(i,e)),this.add(new Gi(i,n)),this.update()}function ec(t,e){yi.call(this),this.light=t,this.light.updateMatrixWorld(),this.matrix=t.matrixWorld,this.matrixAutoUpdate=!1;var n=new io(e);n.rotateY(.5*Math.PI);var i=new wi({vertexColors:L,wireframe:!0}),r=n.getAttribute("position"),o=new Float32Array(3*r.count);n.addAttribute("color",new Mi(o,3)),this.add(new Gi(n,i)),this.update()}function nc(t,e,n,i){t=t||10,e=e||10,n=new In(void 0!==n?n:4473924),i=new In(void 0!==i?i:8947848);for(var r=e/2,o=t/e,a=t/2,s=[],c=[],h=0,u=0,l=-a;h<=e;h++,l+=o){s.push(-a,0,l,a,0,l),s.push(l,0,-a,l,0,a);var d=h===r?n:i;d.toArray(c,u),u+=3,d.toArray(c,u),u+=3,d.toArray(c,u),u+=3,d.toArray(c,u),u+=3}var p=new zi;p.addAttribute("position",new Ci(s,3)),p.addAttribute("color",new Ci(c,3));var f=new Br({vertexColors:L});Gr.call(this,p,f)}function ic(t,e,n,i,r,o){t=t||10,e=e||16,n=n||8,i=i||64,r=new In(void 0!==r?r:4473924),o=new In(void 0!==o?o:8947848);var a,s,c,h,u,l,d,p=[],f=[];for(h=0;h<=e;h++)c=h/e*(2*Math.PI),a=Math.sin(c)*t,s=Math.cos(c)*t,p.push(0,0,0),p.push(a,0,s),d=1&h?r:o,f.push(d.r,d.g,d.b),f.push(d.r,d.g,d.b);for(h=0;h<=n;h++)for(d=1&h?r:o,l=t-t/n*h,u=0;u<i;u++)c=u/i*(2*Math.PI),a=Math.sin(c)*l,s=Math.cos(c)*l,p.push(a,0,s),f.push(d.r,d.g,d.b),c=(u+1)/i*(2*Math.PI),a=Math.sin(c)*l,s=Math.cos(c)*l,p.push(a,0,s),f.push(d.r,d.g,d.b);var m=new zi;m.addAttribute("position",new Ci(p,3)),m.addAttribute("color",new Ci(f,3));var g=new Br({vertexColors:L});Gr.call(this,m,g)}function rc(t,e,n,i){this.object=t,this.size=void 0!==e?e:1;var r=void 0!==n?n:16776960,o=void 0!==i?i:1,a=0,s=this.object.geometry;s&&s.isGeometry?a=s.faces.length:console.warn("THREE.FaceNormalsHelper: only THREE.Geometry is supported. Use THREE.VertexNormalsHelper, instead.");var c=new zi,h=new Ci(2*a*3,3);c.addAttribute("position",h),Gr.call(this,c,new Br({color:r,linewidth:o})),this.matrixAutoUpdate=!1,this.update()}function oc(t,e){yi.call(this),this.light=t,this.light.updateMatrixWorld(),this.matrix=t.matrixWorld,this.matrixAutoUpdate=!1,void 0===e&&(e=1);var n=new zi;n.addAttribute("position",new Ci([-e,e,0,e,e,0,e,-e,0,-e,-e,0,-e,e,0],3));var i=new Br({fog:!1});this.add(new zr(n,i)),(n=new zi).addAttribute("position",new Ci([0,0,0,0,0,1],3)),this.add(new zr(n,i)),this.update()}function ac(t){var e=new zi,n=new Br({color:16777215,vertexColors:A}),i=[],r=[],o={},a=new In(16755200),s=new In(16711680),c=new In(43775),h=new In(16777215),u=new In(3355443);function l(t,e,n){d(t,n),d(e,n)}function d(t,e){i.push(0,0,0),r.push(e.r,e.g,e.b),void 0===o[t]&&(o[t]=[]),o[t].push(i.length/3-1)}l("n1","n2",a),l("n2","n4",a),l("n4","n3",a),l("n3","n1",a),l("f1","f2",a),l("f2","f4",a),l("f4","f3",a),l("f3","f1",a),l("n1","f1",a),l("n2","f2",a),l("n3","f3",a),l("n4","f4",a),l("p","n1",s),l("p","n2",s),l("p","n3",s),l("p","n4",s),l("u1","u2",c),l("u2","u3",c),l("u3","u1",c),l("c","t",h),l("p","c",u),l("cn1","cn2",u),l("cn3","cn4",u),l("cf1","cf2",u),l("cf3","cf4",u),e.addAttribute("position",new Ci(i,3)),e.addAttribute("color",new Ci(r,3)),Gr.call(this,e,n),this.camera=t,this.camera.updateProjectionMatrix&&this.camera.updateProjectionMatrix(),this.matrix=t.matrixWorld,this.matrixAutoUpdate=!1,this.pointMap=o,this.update()}function sc(t,e){this.object=t,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]),i=new Float32Array(24),r=new zi;r.setIndex(new Mi(n,1)),r.addAttribute("position",new Mi(i,3)),Gr.call(this,r,new Br({color:e})),this.matrixAutoUpdate=!1,this.update()}function cc(t,e,n,i,r,o){yi.call(this),void 0===i&&(i=16776960),void 0===n&&(n=1),void 0===r&&(r=.2*n),void 0===o&&(o=.2*r),void 0===vs&&((vs=new zi).addAttribute("position",new Ci([0,0,0,0,1,0],3)),(ys=new Po(0,.5,1,5,1)).translate(0,-.5,0)),this.position.copy(e),this.line=new zr(vs,new Br({color:i})),this.line.matrixAutoUpdate=!1,this.add(this.line),this.cone=new Gi(ys,new wi({color:i})),this.cone.matrixAutoUpdate=!1,this.add(this.cone),this.setDirection(t),this.setLength(n,r,o)}function hc(t){var e=[0,0,0,t=t||1,0,0,0,0,0,0,t,0,0,0,0,0,0,t],n=new zi;n.addAttribute("position",new Ci(e,3)),n.addAttribute("color",new Ci([1,0,0,1,.6,0,0,1,0,.6,1,0,0,0,1,0,.6,1],3));var i=new Br({vertexColors:L});Gr.call(this,n,i)}function uc(){var t=0,e=0,n=0,i=0;function r(r,o,a,s){t=r,e=a,n=-3*r+3*o-2*a-s,i=2*r-2*o+a+s}return{initCatmullRom:function(t,e,n,i,o){r(e,n,o*(n-t),o*(i-e))},initNonuniformCatmullRom:function(t,e,n,i,o,a,s){var c=(e-t)/o-(n-t)/(o+a)+(n-e)/a,h=(n-e)/a-(i-e)/(a+s)+(i-n)/s;r(e,n,c*=a,h*=a)},calc:function(r){var o=r*r;return t+e*r+n*o+i*(o*r)}}}Object.assign(ws.prototype,{load:function(t,e,n,i){var r=new Zo(this.manager);r.setResponseType("arraybuffer"),r.load(t,function(t){_s.getContext().decodeAudioData(t,function(t){e(t)})},n,i)}}),Object.assign(Ms.prototype,{update:(ls=new Ve,ds=new Ve,function(t){if(is!==this||rs!==t.focus||os!==t.fov||as!==t.aspect*this.aspect||ss!==t.near||cs!==t.far||hs!==t.zoom||us!==this.eyeSep){is=this,rs=t.focus,os=t.fov,as=t.aspect*this.aspect,ss=t.near,cs=t.far,hs=t.zoom;var e,n,i=t.projectionMatrix.clone(),r=(us=this.eyeSep/2)*ss/rs,o=ss*Math.tan(Ae.DEG2RAD*os*.5)/hs;ds.elements[12]=-us,ls.elements[12]=us,e=-o*as+r,n=o*as+r,i.elements[0]=2*ss/(n-e),i.elements[8]=(n+e)/(n-e),this.cameraL.projectionMatrix.copy(i),e=-o*as-r,n=o*as-r,i.elements[0]=2*ss/(n-e),i.elements[8]=(n+e)/(n-e),this.cameraR.projectionMatrix.copy(i)}this.cameraL.matrixWorld.copy(t.matrixWorld).multiply(ds),this.cameraR.matrixWorld.copy(t.matrixWorld).multiply(ls)})}),Es.prototype=Object.create(yi.prototype),Es.prototype.constructor=Es,Ts.prototype=Object.assign(Object.create(Xi.prototype),{constructor:Ts,isArrayCamera:!0}),Ss.prototype=Object.assign(Object.create(yi.prototype),{constructor:Ss,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 He,e=new Ge,n=new He,i=new He;return function(r){yi.prototype.updateMatrixWorld.call(this,r);var o=this.context.listener,a=this.up;this.matrixWorld.decompose(t,e,n),i.set(0,0,-1).applyQuaternion(e),o.positionX?(o.positionX.setValueAtTime(t.x,this.context.currentTime),o.positionY.setValueAtTime(t.y,this.context.currentTime),o.positionZ.setValueAtTime(t.z,this.context.currentTime),o.forwardX.setValueAtTime(i.x,this.context.currentTime),o.forwardY.setValueAtTime(i.y,this.context.currentTime),o.forwardZ.setValueAtTime(i.z,this.context.currentTime),o.upX.setValueAtTime(a.x,this.context.currentTime),o.upY.setValueAtTime(a.y,this.context.currentTime),o.upZ.setValueAtTime(a.z,this.context.currentTime)):(o.setPosition(t.x,t.y,t.z),o.setOrientation(i.x,i.y,i.z,a.x,a.y,a.z))}}()}),As.prototype=Object.assign(Object.create(yi.prototype),{constructor:As,getOutput:function(){return this.gain},setNodeSource:function(t){return this.hasPlaybackControl=!1,this.sourceType="audioNode",this.source=t,this.connect(),this},setBuffer:function(t){return this.buffer=t,this.sourceType="buffer",this.autoplay&&this.play(),this},play:function(){if(!0!==this.isPlaying){if(!1!==this.hasPlaybackControl){var t=this.context.createBufferSource();return t.buffer=this.buffer,t.loop=this.loop,t.onended=this.onEnded.bind(this),t.playbackRate.setValueAtTime(this.playbackRate,this.startTime),t.start(0,this.startTime),this.isPlaying=!0,this.source=t,this.connect()}console.warn("THREE.Audio: this Audio has no playback control.")}else console.warn("THREE.Audio: Audio is already playing.")},pause:function(){if(!1!==this.hasPlaybackControl)return this.source.stop(),this.startTime=this.context.currentTime,this.isPlaying=!1,this;console.warn("THREE.Audio: this Audio has no playback control.")},stop:function(){if(!1!==this.hasPlaybackControl)return this.source.stop(),this.startTime=0,this.isPlaying=!1,this;console.warn("THREE.Audio: this Audio has no playback control.")},connect:function(){if(this.filters.length>0){this.source.connect(this.filters[0]);for(var t=1,e=this.filters.length;t<e;t++)this.filters[t-1].connect(this.filters[t]);this.filters[this.filters.length-1].connect(this.getOutput())}else this.source.connect(this.getOutput());return this},disconnect:function(){if(this.filters.length>0){this.source.disconnect(this.filters[0]);for(var t=1,e=this.filters.length;t<e;t++)this.filters[t-1].disconnect(this.filters[t]);this.filters[this.filters.length-1].disconnect(this.getOutput())}else this.source.disconnect(this.getOutput());return this},getFilters:function(){return this.filters},setFilters:function(t){return t||(t=[]),!0===this.isPlaying?(this.disconnect(),this.filters=t,this.connect()):this.filters=t,this},getFilter:function(){return this.getFilters()[0]},setFilter:function(t){return this.setFilters(t?[t]:[])},setPlaybackRate:function(t){if(!1!==this.hasPlaybackControl)return this.playbackRate=t,!0===this.isPlaying&&this.source.playbackRate.setValueAtTime(this.playbackRate,this.context.currentTime),this;console.warn("THREE.Audio: this Audio has no playback control.")},getPlaybackRate:function(){return this.playbackRate},onEnded:function(){this.isPlaying=!1},getLoop:function(){return!1===this.hasPlaybackControl?(console.warn("THREE.Audio: this Audio has no playback control."),!1):this.loop},setLoop:function(t){if(!1!==this.hasPlaybackControl)return this.loop=t,!0===this.isPlaying&&(this.source.loop=this.loop),this;console.warn("THREE.Audio: this Audio has no playback control.")},getVolume:function(){return this.gain.gain.value},setVolume:function(t){return this.gain.gain.value=t,this}}),Ls.prototype=Object.assign(Object.create(As.prototype),{constructor:Ls,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 He;return function(e){yi.prototype.updateMatrixWorld.call(this,e),t.setFromMatrixPosition(this.matrixWorld),this.panner.setPosition(t.x,t.y,t.z)}}()}),Object.assign(Rs.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.assign(Ps.prototype,{accumulate:function(t,e){var n=this.buffer,i=this.valueSize,r=t*i+i,o=this.cumulativeWeight;if(0===o){for(var a=0;a!==i;++a)n[r+a]=n[a];o=e}else{var s=e/(o+=e);this._mixBufferRegion(n,r,0,s,i)}this.cumulativeWeight=o},apply:function(t){var e=this.valueSize,n=this.buffer,i=t*e+e,r=this.cumulativeWeight,o=this.binding;if(this.cumulativeWeight=0,r<1){var a=3*e;this._mixBufferRegion(n,i,a,1-r,e)}for(var s=e,c=e+e;s!==c;++s)if(n[s]!==n[s+e]){o.setValue(n,i);break}},saveOriginalState:function(){var t=this.binding,e=this.buffer,n=this.valueSize,i=3*n;t.getValue(e,i);for(var r=n,o=i;r!==o;++r)e[r]=e[i+r%n];this.cumulativeWeight=0},restoreOriginalState:function(){var t=3*this.valueSize;this.binding.setValue(this.buffer,t)},_select:function(t,e,n,i,r){if(i>=.5)for(var o=0;o!==r;++o)t[e+o]=t[n+o]},_slerp:function(t,e,n,i){Ge.slerpFlat(t,e,t,e,t,n,i)},_lerp:function(t,e,n,i,r){for(var o=1-i,a=0;a!==r;++a){var s=e+a;t[s]=t[s]*o+t[n+a]*i}}}),Object.assign(Cs.prototype,{getValue:function(t,e){this.bind();var n=this._targetGroup.nCachedObjects_,i=this._bindings[n];void 0!==i&&i.getValue(t,e)},setValue:function(t,e){for(var n=this._bindings,i=this._targetGroup.nCachedObjects_,r=n.length;i!==r;++i)n[i].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()}}),Object.assign(Is,{Composite:Cs,create:function(t,e,n){return t&&t.isAnimationObjectGroup?new Is.Composite(t,e,n):new Is(t,e,n)},parseTrackName:(ps=new RegExp("^"+/((?:[\w-]+[\/:])*)/.source+/([\w-\.]+)?/.source+/(?:\.([\w-]+)(?:\[(.+)\])?)?/.source+/\.([\w-]+)(?:\[(.+)\])?/.source+"$"),fs=["material","materials","bones"],function(t){var e=ps.exec(t);if(!e)throw new Error("PropertyBinding: Cannot parse trackName: "+t);var n={nodeName:e[2],objectName:e[3],objectIndex:e[4],propertyName:e[5],propertyIndex:e[6]},i=n.nodeName&&n.nodeName.lastIndexOf(".");if(void 0!==i&&-1!==i){var r=n.nodeName.substring(i+1);-1!==fs.indexOf(r)&&(n.nodeName=n.nodeName.substring(0,i),n.objectName=r)}if(null===n.propertyName||0===n.propertyName.length)throw new Error("PropertyBinding: can not parse propertyName from trackName: "+t);return n}),findNode:function(t,e){if(!e||""===e||"root"===e||"."===e||-1===e||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 i=t.bones[n];if(i.name===e)return i}return null}(t.skeleton);if(n)return n}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 o=i(r.children);if(o)return o}return null},r=i(t.children);if(r)return r}return null}}),Object.assign(Is.prototype,{_getValue_unavailable:function(){},_setValue_unavailable:function(){},BindingType:{Direct:0,EntireArray:1,ArrayElement:2,HasFromToArray:3},Versioning:{None:0,NeedsUpdate:1,MatrixWorldNeedsUpdate:2},GetterByBindingType:[function(t,e){t[e]=this.node[this.propertyName]},function(t,e){for(var n=this.resolvedProperty,i=0,r=n.length;i!==r;++i)t[e++]=n[i]},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,i=0,r=n.length;i!==r;++i)n[i]=t[e++]},function(t,e){for(var n=this.resolvedProperty,i=0,r=n.length;i!==r;++i)n[i]=t[e++];this.targetObject.needsUpdate=!0},function(t,e){for(var n=this.resolvedProperty,i=0,r=n.length;i!==r;++i)n[i]=t[e++];this.targetObject.matrixWorldNeedsUpdate=!0}],[function(t,e){this.resolvedProperty[this.propertyIndex]=t[e]},function(t,e){this.resolvedProperty[this.propertyIndex]=t[e],this.targetObject.needsUpdate=!0},function(t,e){this.resolvedProperty[this.propertyIndex]=t[e],this.targetObject.matrixWorldNeedsUpdate=!0}],[function(t,e){this.resolvedProperty.fromArray(t,e)},function(t,e){this.resolvedProperty.fromArray(t,e),this.targetObject.needsUpdate=!0},function(t,e){this.resolvedProperty.fromArray(t,e),this.targetObject.matrixWorldNeedsUpdate=!0}]],getValue:function(t,e){this.bind(),this.getValue(t,e)},setValue:function(t,e){this.bind(),this.setValue(t,e)},bind:function(){var t=this.node,e=this.parsedPath,n=e.objectName,i=e.propertyName,r=e.propertyIndex;if(t||(t=Is.findNode(this.rootNode,e.nodeName)||this.rootNode,this.node=t),this.getValue=this._getValue_unavailable,this.setValue=this._setValue_unavailable,t){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 a=0;a<t.length;a++)if(t[a].name===o){o=a;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 s=t[i];if(void 0!==s){var c=this.Versioning.None;void 0!==t.needsUpdate?(c=this.Versioning.NeedsUpdate,this.targetObject=t):void 0!==t.matrixWorldNeedsUpdate&&(c=this.Versioning.MatrixWorldNeedsUpdate,this.targetObject=t);var h=this.BindingType.Direct;if(void 0!==r){if("morphTargetInfluences"===i){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(a=0;a<this.node.geometry.morphTargets.length;a++)if(t.geometry.morphTargets[a].name===r){r=a;break}}h=this.BindingType.ArrayElement,this.resolvedProperty=s,this.propertyIndex=r}else void 0!==s.fromArray&&void 0!==s.toArray?(h=this.BindingType.HasFromToArray,this.resolvedProperty=s):Array.isArray(s)?(h=this.BindingType.EntireArray,this.resolvedProperty=s):this.propertyName=i;this.getValue=this.GetterByBindingType[h],this.setValue=this.SetterByBindingTypeAndVersioning[h][c]}else{var u=e.nodeName;console.error(" trying to update property for track: "+u+"."+i+" but it wasn't found.",t)}}else console.error(" trying to update node for track: "+this.path+" but it wasn't found.")},unbind:function(){this.node=null,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}}),
  4. //!\ DECLARE ALIAS AFTER assign prototype !
  5. Object.assign(Is.prototype,{_getValue_unbound:Is.prototype.getValue,_setValue_unbound:Is.prototype.setValue}),Object.assign(Us.prototype,{isAnimationObjectGroup:!0,add:function(t){for(var e=this._objects,n=e.length,i=this.nCachedObjects_,r=this._indicesByUUID,o=this._paths,a=this._parsedPaths,s=this._bindings,c=s.length,h=0,u=arguments.length;h!==u;++h){var l=arguments[h],d=l.uuid,p=r[d],f=void 0;if(void 0===p){p=n++,r[d]=p,e.push(l);for(var m=0,g=c;m!==g;++m)s[m].push(new Is(l,o[m],a[m]))}else if(p<i){f=e[p];var v=--i,y=e[v];r[y.uuid]=p,e[p]=y,r[d]=v,e[v]=l;for(m=0,g=c;m!==g;++m){var x=s[m],b=x[v],_=x[p];x[p]=b,void 0===_&&(_=new Is(l,o[m],a[m])),x[v]=_}}else e[p]!==f&&console.error("Different objects with the same UUID detected. Clean the caches or recreate your infrastructure when reloading scenes...")}this.nCachedObjects_=i},remove:function(t){for(var e=this._objects,n=this.nCachedObjects_,i=this._indicesByUUID,r=this._bindings,o=r.length,a=0,s=arguments.length;a!==s;++a){var c=arguments[a],h=c.uuid,u=i[h];if(void 0!==u&&u>=n){var l=n++,d=e[l];i[d.uuid]=u,e[u]=d,i[h]=l,e[l]=c;for(var p=0,f=o;p!==f;++p){var m=r[p],g=m[l],v=m[u];m[u]=g,m[l]=v}}}this.nCachedObjects_=n},uncache:function(t){for(var e=this._objects,n=e.length,i=this.nCachedObjects_,r=this._indicesByUUID,o=this._bindings,a=o.length,s=0,c=arguments.length;s!==c;++s){var h=arguments[s].uuid,u=r[h];if(void 0!==u)if(delete r[h],u<i){var l=--i,d=e[l],p=e[y=--n];r[d.uuid]=u,e[u]=d,r[p.uuid]=l,e[l]=p,e.pop();for(var f=0,m=a;f!==m;++f){var g=(x=o[f])[l],v=x[y];x[u]=g,x[l]=v,x.pop()}}else{var y;r[(p=e[y=--n]).uuid]=u,e[u]=p,e.pop();for(f=0,m=a;f!==m;++f){var x;(x=o[f])[u]=x[y],x.pop()}}}this.nCachedObjects_=i},subscribe_:function(t,e){var n=this._bindingsIndicesByPath,i=n[t],r=this._bindings;if(void 0!==i)return r[i];var o=this._paths,a=this._parsedPaths,s=this._objects,c=s.length,h=this.nCachedObjects_,u=new Array(c);i=r.length,n[t]=i,o.push(t),a.push(e),r.push(u);for(var l=h,d=s.length;l!==d;++l){var p=s[l];u[l]=new Is(p,t,e)}return u},unsubscribe_:function(t){var e=this._bindingsIndicesByPath,n=e[t];if(void 0!==n){var i=this._paths,r=this._parsedPaths,o=this._bindings,a=o.length-1,s=o[a];e[t[a]]=n,o[n]=s,o.pop(),r[n]=r[a],r.pop(),i[n]=i[a],i.pop()}}}),Object.assign(Ns.prototype,{play:function(){return this._mixer._activateAction(this),this},stop:function(){return this._mixer._deactivateAction(this),this.reset()},reset:function(){return this.paused=!1,this.enabled=!0,this.time=0,this._loopCount=-1,this._startTime=null,this.stopFading().stopWarping()},isRunning:function(){return this.enabled&&!this.paused&&0!==this.timeScale&&null===this._startTime&&this._mixer._isActiveAction(this)},isScheduled:function(){return this._mixer._isActiveAction(this)},startAt:function(t){return this._startTime=t,this},setLoop:function(t,e){return this.loop=t,this.repetitions=e,this},setEffectiveWeight:function(t){return this.weight=t,this._effectiveWeight=this.enabled?t:0,this.stopFading()},getEffectiveWeight:function(){return this._effectiveWeight},fadeIn:function(t){return this._scheduleFading(t,0,1)},fadeOut:function(t){return this._scheduleFading(t,1,0)},crossFadeFrom:function(t,e,n){if(t.fadeOut(e),this.fadeIn(e),n){var i=this._clip.duration,r=t._clip.duration,o=r/i,a=i/r;t.warp(1,o,e),this.warp(a,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 i=this._mixer,r=i.time,o=this._timeScaleInterpolant,a=this.timeScale;null===o&&(o=i._lendControlInterpolant(),this._timeScaleInterpolant=o);var s=o.parameterPositions,c=o.sampleValues;return s[0]=r,s[1]=r+n,c[0]=t/a,c[1]=e/a,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,i){if(this.enabled){var r=this._startTime;if(null!==r){var o=(t-r)*n;if(o<0||0===n)return;this._startTime=null,e=n*o}e*=this._updateTimeScale(t);var a=this._updateTime(e),s=this._updateWeight(t);if(s>0)for(var c=this._interpolants,h=this._propertyBindings,u=0,l=c.length;u!==l;++u)c[u].evaluate(a),h[u].accumulate(i,s)}else this._updateWeight(t)},_updateWeight:function(t){var e=0;if(this.enabled){e=this.weight;var n=this._weightInterpolant;if(null!==n){var i=n.evaluate(t)[0];e*=i,t>n.parameterPositions[1]&&(this.stopFading(),0===i&&(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)e*=n.evaluate(t)[0],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,i=this.loop,r=this._loopCount;if(i===oe){-1===r&&(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=i===se;if(-1===r&&(t>=0?(r=0,this._setEndings(!0,0===this.repetitions,o)):this._setEndings(0===this.repetitions,!0,o)),e>=n||e<0){var a=Math.floor(e/n);e-=n*a,r+=Math.abs(a);var s=this.repetitions-r;if(s<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===s){var c=t<0;this._setEndings(c,!c,o)}else this._setEndings(!1,!1,o);this._loopCount=r,this._mixer.dispatchEvent({type:"loop",action:this,loopDelta:a})}}if(o&&1==(1&r))return this.time=e,n-e}return this.time=e,e},_setEndings:function(t,e,n){var i=this._interpolantSettings;n?(i.endingStart=de,i.endingEnd=de):(i.endingStart=t?this.zeroSlopeAtStart?de:le:pe,i.endingEnd=e?this.zeroSlopeAtEnd?de:le:pe)},_scheduleFading:function(t,e,n){var i=this._mixer,r=i.time,o=this._weightInterpolant;null===o&&(o=i._lendControlInterpolant(),this._weightInterpolant=o);var a=o.parameterPositions,s=o.sampleValues;return a[0]=r,s[0]=e,a[1]=r+t,s[1]=n,this}}),Object.assign(Os.prototype,i.prototype,{_bindAction:function(t,e){var n=t._localRoot||this._root,i=t._clip.tracks,r=i.length,o=t._propertyBindings,a=t._interpolants,s=n.uuid,c=this._bindingsByRootAndName,h=c[s];void 0===h&&(h={},c[s]=h);for(var u=0;u!==r;++u){var l=i[u],d=l.name,p=h[d];if(void 0!==p)o[u]=p;else{if(void 0!==(p=o[u])){null===p._cacheIndex&&(++p.referenceCount,this._addInactiveBinding(p,s,d));continue}var f=e&&e._propertyBindings[u].binding.parsedPath;++(p=new Ps(Is.create(n,d,f),l.ValueTypeName,l.getValueSize())).referenceCount,this._addInactiveBinding(p,s,d),o[u]=p}a[u].resultBuffer=p.buffer}},_activateAction:function(t){if(!this._isActiveAction(t)){if(null===t._cacheIndex){var e=(t._localRoot||this._root).uuid,n=t._clip.uuid,i=this._actionsByClip[n];this._bindAction(t,i&&i.knownActions[0]),this._addInactiveAction(t,n,e)}for(var r=t._propertyBindings,o=0,a=r.length;o!==a;++o){var s=r[o];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,i=e.length;n!==i;++n){var r=e[n];0==--r.useCount&&(r.restoreOriginalState(),this._takeBackBinding(r))}this._takeBackAction(t)}},_initMemoryManager:function(){this._actions=[],this._nActiveActions=0,this._actionsByClip={},this._bindings=[],this._nActiveBindings=0,this._bindingsByRootAndName={},this._controlInterpolants=[],this._nActiveControlInterpolants=0;var t=this;this.stats={actions:{get total(){return t._actions.length},get inUse(){return t._nActiveActions}},bindings:{get total(){return t._bindings.length},get inUse(){return t._nActiveBindings}},controlInterpolants:{get total(){return t._controlInterpolants.length},get inUse(){return t._nActiveControlInterpolants}}}},_isActiveAction:function(t){var e=t._cacheIndex;return null!==e&&e<this._nActiveActions},_addInactiveAction:function(t,e,n){var i=this._actions,r=this._actionsByClip,o=r[e];if(void 0===o)o={knownActions:[t],actionByRoot:{}},t._byClipCacheIndex=0,r[e]=o;else{var a=o.knownActions;t._byClipCacheIndex=a.length,a.push(t)}t._cacheIndex=i.length,i.push(t),o.actionByRoot[n]=t},_removeInactiveAction:function(t){var e=this._actions,n=e[e.length-1],i=t._cacheIndex;n._cacheIndex=i,e[i]=n,e.pop(),t._cacheIndex=null;var r=t._clip.uuid,o=this._actionsByClip,a=o[r],s=a.knownActions,c=s[s.length-1],h=t._byClipCacheIndex;c._byClipCacheIndex=h,s[h]=c,s.pop(),t._byClipCacheIndex=null,delete a.actionByRoot[(t._localRoot||this._root).uuid],0===s.length&&delete o[r],this._removeInactiveBindingsForAction(t)},_removeInactiveBindingsForAction:function(t){for(var e=t._propertyBindings,n=0,i=e.length;n!==i;++n){var r=e[n];0==--r.referenceCount&&this._removeInactiveBinding(r)}},_lendAction:function(t){var e=this._actions,n=t._cacheIndex,i=this._nActiveActions++,r=e[i];t._cacheIndex=i,e[i]=t,r._cacheIndex=n,e[n]=r},_takeBackAction:function(t){var e=this._actions,n=t._cacheIndex,i=--this._nActiveActions,r=e[i];t._cacheIndex=i,e[i]=t,r._cacheIndex=n,e[n]=r},_addInactiveBinding:function(t,e,n){var i=this._bindingsByRootAndName,r=i[e],o=this._bindings;void 0===r&&(r={},i[e]=r),r[n]=t,t._cacheIndex=o.length,o.push(t)},_removeInactiveBinding:function(t){var e=this._bindings,n=t.binding,i=n.rootNode.uuid,r=n.path,o=this._bindingsByRootAndName,a=o[i],s=e[e.length-1],c=t._cacheIndex;s._cacheIndex=c,e[c]=s,e.pop(),delete a[r];t:{for(var h in a)break t;delete o[i]}},_lendBinding:function(t){var e=this._bindings,n=t._cacheIndex,i=this._nActiveBindings++,r=e[i];t._cacheIndex=i,e[i]=t,r._cacheIndex=n,e[n]=r},_takeBackBinding:function(t){var e=this._bindings,n=t._cacheIndex,i=--this._nActiveBindings,r=e[i];t._cacheIndex=i,e[i]=t,r._cacheIndex=n,e[n]=r},_lendControlInterpolant:function(){var t=this._controlInterpolants,e=this._nActiveControlInterpolants++,n=t[e];return void 0===n&&((n=new ma(new Float32Array(2),new Float32Array(2),1,this._controlInterpolantsResultBuffer)).__cacheIndex=e,t[e]=n),n},_takeBackControlInterpolant:function(t){var e=this._controlInterpolants,n=t.__cacheIndex,i=--this._nActiveControlInterpolants,r=e[i];t.__cacheIndex=i,e[i]=t,r.__cacheIndex=n,e[n]=r},_controlInterpolantsResultBuffer:new Float32Array(1),clipAction:function(t,e){var n=e||this._root,i=n.uuid,r="string"==typeof t?Sa.findByName(n,t):t,o=null!==r?r.uuid:t,a=this._actionsByClip[o],s=null;if(void 0!==a){var c=a.actionByRoot[i];if(void 0!==c)return c;s=a.knownActions[0],null===r&&(r=s._clip)}if(null===r)return null;var h=new Ns(this,r,e);return this._bindAction(h,s),this._addInactiveAction(h,o,i),h},existingAction:function(t,e){var n=e||this._root,i=n.uuid,r="string"==typeof t?Sa.findByName(n,t):t,o=r?r.uuid:t,a=this._actionsByClip[o];return void 0!==a&&a.actionByRoot[i]||null},stopAllAction:function(){var t=this._actions,e=this._nActiveActions,n=this._bindings,i=this._nActiveBindings;this._nActiveActions=0,this._nActiveBindings=0;for(var r=0;r!==e;++r)t[r].reset();for(r=0;r!==i;++r)n[r].useCount=0;return this},update:function(t){t*=this.timeScale;for(var e=this._actions,n=this._nActiveActions,i=this.time+=t,r=Math.sign(t),o=this._accuIndex^=1,a=0;a!==n;++a){e[a]._update(i,t,r,o)}var s=this._bindings,c=this._nActiveBindings;for(a=0;a!==c;++a)s[a].apply(o);return this},getRoot:function(){return this._root},uncacheClip:function(t){var e=this._actions,n=t.uuid,i=this._actionsByClip,r=i[n];if(void 0!==r){for(var o=r.knownActions,a=0,s=o.length;a!==s;++a){var c=o[a];this._deactivateAction(c);var h=c._cacheIndex,u=e[e.length-1];c._cacheIndex=null,c._byClipCacheIndex=null,u._cacheIndex=h,e[h]=u,e.pop(),this._removeInactiveBindingsForAction(c)}delete i[n]}},uncacheRoot:function(t){var e=t.uuid,n=this._actionsByClip;for(var i in n){var r=n[i].actionByRoot[e];void 0!==r&&(this._deactivateAction(r),this._removeInactiveAction(r))}var o=this._bindingsByRootAndName[e];if(void 0!==o)for(var a in o){var s=o[a];s.restoreOriginalState(),this._removeInactiveBinding(s)}},uncacheAction:function(t,e){var n=this.existingAction(t,e);null!==n&&(this._deactivateAction(n),this._removeInactiveAction(n))}}),Ds.prototype.clone=function(){return new Ds(void 0===this.value.clone?this.value:this.value.clone())},Fs.prototype=Object.assign(Object.create(zi.prototype),{constructor:Fs,isInstancedBufferGeometry:!0,addGroup:function(t,e,n){this.groups.push({start:t,count:e,materialIndex:n})},copy:function(t){var e=t.index;null!==e&&this.setIndex(e.clone());var n=t.attributes;for(var i in n){var r=n[i];this.addAttribute(i,r.clone())}for(var o=t.groups,a=0,s=o.length;a<s;a++){var c=o[a];this.addGroup(c.start,c.count,c.materialIndex)}return this}}),Object.defineProperties(Bs.prototype,{count:{get:function(){return this.data.count}},array:{get:function(){return this.data.array}}}),Object.assign(Bs.prototype,{isInterleavedBufferAttribute:!0,setX:function(t,e){return this.data.array[t*this.data.stride+this.offset]=e,this},setY:function(t,e){return this.data.array[t*this.data.stride+this.offset+1]=e,this},setZ:function(t,e){return this.data.array[t*this.data.stride+this.offset+2]=e,this},setW:function(t,e){return this.data.array[t*this.data.stride+this.offset+3]=e,this},getX:function(t){return this.data.array[t*this.data.stride+this.offset]},getY:function(t){return this.data.array[t*this.data.stride+this.offset+1]},getZ:function(t){return this.data.array[t*this.data.stride+this.offset+2]},getW:function(t){return this.data.array[t*this.data.stride+this.offset+3]},setXY:function(t,e,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,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]=i,this},setXYZW:function(t,e,n,i,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]=i,this.data.array[t+3]=r,this}}),Object.defineProperty(zs.prototype,"needsUpdate",{set:function(t){!0===t&&this.version++}}),Object.assign(zs.prototype,{isInterleavedBuffer:!0,setArray:function(t){if(Array.isArray(t))throw new TypeError("THREE.BufferAttribute: array should be a Typed Array.");this.count=void 0!==t?t.length/this.stride:0,this.array=t},setDynamic:function(t){return this.dynamic=t,this},copy:function(t){return this.array=new t.array.constructor(t.array),this.count=t.count,this.stride=t.stride,this.dynamic=t.dynamic,this},copyAt:function(t,e,n){t*=this.stride,n*=e.stride;for(var i=0,r=this.stride;i<r;i++)this.array[t+i]=e.array[n+i];return this},set:function(t,e){return void 0===e&&(e=0),this.array.set(t,e),this},clone:function(){return(new this.constructor).copy(this)},onUpload:function(t){return this.onUploadCallback=t,this}}),Gs.prototype=Object.assign(Object.create(zs.prototype),{constructor:Gs,isInstancedInterleavedBuffer:!0,copy:function(t){return zs.prototype.copy.call(this,t),this.meshPerAttribute=t.meshPerAttribute,this}}),Hs.prototype=Object.assign(Object.create(Mi.prototype),{constructor:Hs,isInstancedBufferAttribute:!0,copy:function(t){return Mi.prototype.copy.call(this,t),this.meshPerAttribute=t.meshPerAttribute,this}}),Object.assign(Vs.prototype,{linePrecision:1,set:function(t,e){this.ray.set(t,e)},setFromCamera:function(t,e){e&&e.isPerspectiveCamera?(this.ray.origin.setFromMatrixPosition(e.matrixWorld),this.ray.direction.set(t.x,t.y,.5).unproject(e).sub(this.ray.origin).normalize()):e&&e.isOrthographicCamera?(this.ray.origin.set(t.x,t.y,(e.near+e.far)/(e.near-e.far)).unproject(e),this.ray.direction.set(0,0,-1).transformDirection(e.matrixWorld)):console.error("THREE.Raycaster: Unsupported camera type.")},intersectObject:function(t,e){var n=[];return js(t,this,n,e),n.sort(ks),n},intersectObjects:function(t,e){var n=[];if(!1===Array.isArray(t))return console.warn("THREE.Raycaster.intersectObjects: objects is not an Array."),n;for(var i=0,r=t.length;i<r;i++)js(t[i],this,n,e);return n.sort(ks),n}}),Object.assign(Ws.prototype,{start:function(){this.startTime=("undefined"==typeof performance?Date:performance).now(),this.oldTime=this.startTime,this.elapsedTime=0,this.running=!0},stop:function(){this.getElapsedTime(),this.running=!1},getElapsedTime:function(){return this.getDelta(),this.elapsedTime},getDelta:function(){var t=0;if(this.autoStart&&!this.running)return this.start(),0;if(this.running){var e=("undefined"==typeof performance?Date:performance).now();t=(e-this.oldTime)/1e3,this.oldTime=e,this.elapsedTime+=t}return t}}),Object.assign(Xs.prototype,{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=t.radius,this.phi=t.phi,this.theta=t.theta,this},makeSafe:function(){return this.phi=Math.max(1e-6,Math.min(Math.PI-1e-6,this.phi)),this},setFromVector3:function(t){return this.radius=t.length(),0===this.radius?(this.theta=0,this.phi=0):(this.theta=Math.atan2(t.x,t.z),this.phi=Math.acos(Ae.clamp(t.y/this.radius,-1,1))),this}}),Object.assign(qs.prototype,{set:function(t,e,n){return this.radius=t,this.theta=e,this.y=n,this},clone:function(){return(new this.constructor).copy(this)},copy:function(t){return this.radius=t.radius,this.theta=t.theta,this.y=t.y,this},setFromVector3:function(t){return this.radius=Math.sqrt(t.x*t.x+t.z*t.z),this.theta=Math.atan2(t.x,t.z),this.y=t.y,this}}),Ys.prototype=Object.create(Gi.prototype),Ys.prototype.constructor=Ys,Ys.prototype.createAnimation=function(t,e,n,i){var r={start:e,end:n,length:n-e+1,fps:i,duration:(n-e)/i,lastFrame:0,currentFrame:0,active:!1,time:0,direction:1,weight:1,directionBackwards:!1,mirroredLoop:!1};this.animationsMap[t]=r,this.animationsList.push(r)},Ys.prototype.autoCreateAnimations=function(t){for(var e,n=/([a-z]+)_?(\d+)/i,i={},r=this.geometry,o=0,a=r.morphTargets.length;o<a;o++){var s=r.morphTargets[o].name.match(n);if(s&&s.length>1)i[c=s[1]]||(i[c]={start:1/0,end:-1/0}),o<(h=i[c]).start&&(h.start=o),o>h.end&&(h.end=o),e||(e=c)}for(var c in i){var h=i[c];this.createAnimation(c,h.start,h.end,t)}this.firstAnimation=e},Ys.prototype.setAnimationDirectionForward=function(t){var e=this.animationsMap[t];e&&(e.direction=1,e.directionBackwards=!1)},Ys.prototype.setAnimationDirectionBackward=function(t){var e=this.animationsMap[t];e&&(e.direction=-1,e.directionBackwards=!0)},Ys.prototype.setAnimationFPS=function(t,e){var n=this.animationsMap[t];n&&(n.fps=e,n.duration=(n.end-n.start)/n.fps)},Ys.prototype.setAnimationDuration=function(t,e){var n=this.animationsMap[t];n&&(n.duration=e,n.fps=(n.end-n.start)/n.duration)},Ys.prototype.setAnimationWeight=function(t,e){var n=this.animationsMap[t];n&&(n.weight=e)},Ys.prototype.setAnimationTime=function(t,e){var n=this.animationsMap[t];n&&(n.time=e)},Ys.prototype.getAnimationTime=function(t){var e=0,n=this.animationsMap[t];return n&&(e=n.time),e},Ys.prototype.getAnimationDuration=function(t){var e=-1,n=this.animationsMap[t];return n&&(e=n.duration),e},Ys.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()")},Ys.prototype.stopAnimation=function(t){var e=this.animationsMap[t];e&&(e.active=!1)},Ys.prototype.update=function(t){for(var e=0,n=this.animationsList.length;e<n;e++){var i=this.animationsList[e];if(i.active){var r=i.duration/i.length;i.time+=i.direction*t,i.mirroredLoop?(i.time>i.duration||i.time<0)&&(i.direction*=-1,i.time>i.duration&&(i.time=i.duration,i.directionBackwards=!0),i.time<0&&(i.time=0,i.directionBackwards=!1)):(i.time=i.time%i.duration,i.time<0&&(i.time+=i.duration));var o=i.start+Ae.clamp(Math.floor(i.time/r),0,i.length-1),a=i.weight;o!==i.currentFrame&&(this.morphTargetInfluences[i.lastFrame]=0,this.morphTargetInfluences[i.currentFrame]=1*a,this.morphTargetInfluences[o]=0,i.lastFrame=i.currentFrame,i.currentFrame=o);var s=i.time%r/r;i.directionBackwards&&(s=1-s),i.currentFrame!==i.lastFrame?(this.morphTargetInfluences[i.currentFrame]=s*a,this.morphTargetInfluences[i.lastFrame]=(1-s)*a):this.morphTargetInfluences[i.currentFrame]=a}}},Zs.prototype=Object.create(yi.prototype),Zs.prototype.constructor=Zs,Zs.prototype.isImmediateRenderObject=!0,Js.prototype=Object.create(Gr.prototype),Js.prototype.constructor=Js,Js.prototype.update=function(){var t=new He,e=new He,n=new ii;return function(){var i=["a","b","c"];this.object.updateMatrixWorld(!0),n.getNormalMatrix(this.object.matrixWorld);var r=this.object.matrixWorld,o=this.geometry.attributes.position,a=this.object.geometry;if(a&&a.isGeometry)for(var s=a.vertices,c=a.faces,h=0,u=0,l=c.length;u<l;u++)for(var d=c[u],p=0,f=d.vertexNormals.length;p<f;p++){var m=s[d[i[p]]],g=d.vertexNormals[p];t.copy(m).applyMatrix4(r),e.copy(g).applyMatrix3(n).normalize().multiplyScalar(this.size).add(t),o.setXYZ(h,t.x,t.y,t.z),h+=1,o.setXYZ(h,e.x,e.y,e.z),h+=1}else if(a&&a.isBufferGeometry){var v=a.attributes.position,y=a.attributes.normal;for(h=0,p=0,f=v.count;p<f;p++)t.set(v.getX(p),v.getY(p),v.getZ(p)).applyMatrix4(r),e.set(y.getX(p),y.getY(p),y.getZ(p)),e.applyMatrix3(n).normalize().multiplyScalar(this.size).add(t),o.setXYZ(h,t.x,t.y,t.z),h+=1,o.setXYZ(h,e.x,e.y,e.z),h+=1}o.needsUpdate=!0}}(),Qs.prototype=Object.create(yi.prototype),Qs.prototype.constructor=Qs,Qs.prototype.dispose=function(){this.cone.geometry.dispose(),this.cone.material.dispose()},Qs.prototype.update=(ms=new He,gs=new He,function(){var t=this.light.distance?this.light.distance:1e3,e=t*Math.tan(this.light.angle);this.cone.scale.set(e,e,t),ms.setFromMatrixPosition(this.light.matrixWorld),gs.setFromMatrixPosition(this.light.target.matrixWorld),this.cone.lookAt(gs.sub(ms)),this.cone.material.color.copy(this.light.color).multiplyScalar(this.light.intensity)}),Ks.prototype=Object.create(Gr.prototype),Ks.prototype.constructor=Ks,Ks.prototype.getBoneList=function(t){var e=[];t&&t.isBone&&e.push(t);for(var n=0;n<t.children.length;n++)e.push.apply(e,this.getBoneList(t.children[n]));return e},Ks.prototype.update=function(){var t=new He,e=new Ve,n=new Ve;return function(){var i=this.geometry,r=i.getAttribute("position");n.getInverse(this.root.matrixWorld);for(var o=0,a=0;o<this.bones.length;o++){var s=this.bones[o];s.parent&&s.parent.isBone&&(e.multiplyMatrices(n,s.matrixWorld),t.setFromMatrixPosition(e),r.setXYZ(a,t.x,t.y,t.z),e.multiplyMatrices(n,s.parent.matrixWorld),t.setFromMatrixPosition(e),r.setXYZ(a+1,t.x,t.y,t.z),a+=2)}i.getAttribute("position").needsUpdate=!0}}(),$s.prototype=Object.create(Gi.prototype),$s.prototype.constructor=$s,$s.prototype.dispose=function(){this.geometry.dispose(),this.material.dispose()},$s.prototype.update=function(){this.material.color.copy(this.light.color).multiplyScalar(this.light.intensity)},tc.prototype=Object.create(yi.prototype),tc.prototype.constructor=tc,tc.prototype.dispose=function(){this.children[0].geometry.dispose(),this.children[0].material.dispose(),this.children[1].geometry.dispose(),this.children[1].material.dispose()},tc.prototype.update=function(){var t=new He,e=new He;return function(){var n=this.children[0],i=this.children[1];if(this.light.target){t.setFromMatrixPosition(this.light.matrixWorld),e.setFromMatrixPosition(this.light.target.matrixWorld);var r=e.clone().sub(t);n.lookAt(r),i.lookAt(r)}n.material.color.copy(this.light.color).multiplyScalar(this.light.intensity),i.material.color.copy(this.light.color).multiplyScalar(this.light.intensity);var o=.5*this.light.width,a=.5*this.light.height,s=n.geometry.getAttribute("position"),c=s.array;c[0]=o,c[1]=-a,c[2]=0,c[3]=o,c[4]=a,c[5]=0,c[6]=-o,c[7]=a,c[8]=0,c[9]=-o,c[10]=a,c[11]=0,c[12]=-o,c[13]=-a,c[14]=0,c[15]=o,c[16]=-a,c[17]=0,s.needsUpdate=!0}}(),ec.prototype=Object.create(yi.prototype),ec.prototype.constructor=ec,ec.prototype.dispose=function(){this.children[0].geometry.dispose(),this.children[0].material.dispose()},ec.prototype.update=function(){var t=new He,e=new In,n=new In;return function(){var i=this.children[0],r=i.geometry.getAttribute("color");e.copy(this.light.color).multiplyScalar(this.light.intensity),n.copy(this.light.groundColor).multiplyScalar(this.light.intensity);for(var o=0,a=r.count;o<a;o++){var s=o<a/2?e:n;r.setXYZ(o,s.r,s.g,s.b)}i.lookAt(t.setFromMatrixPosition(this.light.matrixWorld).negate()),r.needsUpdate=!0}}(),nc.prototype=Object.create(Gr.prototype),nc.prototype.constructor=nc,ic.prototype=Object.create(Gr.prototype),ic.prototype.constructor=ic,rc.prototype=Object.create(Gr.prototype),rc.prototype.constructor=rc,rc.prototype.update=function(){var t=new He,e=new He,n=new ii;return function(){this.object.updateMatrixWorld(!0),n.getNormalMatrix(this.object.matrixWorld);for(var i=this.object.matrixWorld,r=this.geometry.attributes.position,o=this.object.geometry,a=o.vertices,s=o.faces,c=0,h=0,u=s.length;h<u;h++){var l=s[h],d=l.normal;t.copy(a[l.a]).add(a[l.b]).add(a[l.c]).divideScalar(3).applyMatrix4(i),e.copy(d).applyMatrix3(n).normalize().multiplyScalar(this.size).add(t),r.setXYZ(c,t.x,t.y,t.z),c+=1,r.setXYZ(c,e.x,e.y,e.z),c+=1}r.needsUpdate=!0}}(),oc.prototype=Object.create(yi.prototype),oc.prototype.constructor=oc,oc.prototype.dispose=function(){var t=this.children[0],e=this.children[1];t.geometry.dispose(),t.material.dispose(),e.geometry.dispose(),e.material.dispose()},oc.prototype.update=function(){var t=new He,e=new He,n=new He;return function(){t.setFromMatrixPosition(this.light.matrixWorld),e.setFromMatrixPosition(this.light.target.matrixWorld),n.subVectors(e,t);var i=this.children[0],r=this.children[1];i.lookAt(n),i.material.color.copy(this.light.color).multiplyScalar(this.light.intensity),r.lookAt(n),r.scale.z=n.length()}}(),ac.prototype=Object.create(Gr.prototype),ac.prototype.constructor=ac,ac.prototype.update=function(){var t,e,n=new He,i=new Wi;function r(r,o,a,s){n.set(o,a,s).unproject(i);var c=e[r];if(void 0!==c)for(var h=t.getAttribute("position"),u=0,l=c.length;u<l;u++)h.setXYZ(c[u],n.x,n.y,n.z)}return function(){t=this.geometry,e=this.pointMap;i.projectionMatrix.copy(this.camera.projectionMatrix),r("c",0,0,-1),r("t",0,0,1),r("n1",-1,-1,-1),r("n2",1,-1,-1),r("n3",-1,1,-1),r("n4",1,1,-1),r("f1",-1,-1,1),r("f2",1,-1,1),r("f3",-1,1,1),r("f4",1,1,1),r("u1",.7,1.1,-1),r("u2",-.7,1.1,-1),r("u3",0,2,-1),r("cf1",-1,0,1),r("cf2",1,0,1),r("cf3",0,-1,1),r("cf4",0,1,1),r("cn1",-1,0,-1),r("cn2",1,0,-1),r("cn3",0,-1,-1),r("cn4",0,1,-1),t.getAttribute("position").needsUpdate=!0}}(),sc.prototype=Object.create(Gr.prototype),sc.prototype.constructor=sc,sc.prototype.update=function(){var t=new ei;return function(e){if(void 0!==e&&console.warn("THREE.BoxHelper: .update() has no longer arguments."),void 0!==this.object&&t.setFromObject(this.object),!t.isEmpty()){var n=t.min,i=t.max,r=this.geometry.attributes.position,o=r.array;o[0]=i.x,o[1]=i.y,o[2]=i.z,o[3]=n.x,o[4]=i.y,o[5]=i.z,o[6]=n.x,o[7]=n.y,o[8]=i.z,o[9]=i.x,o[10]=n.y,o[11]=i.z,o[12]=i.x,o[13]=i.y,o[14]=n.z,o[15]=n.x,o[16]=i.y,o[17]=n.z,o[18]=n.x,o[19]=n.y,o[20]=n.z,o[21]=i.x,o[22]=n.y,o[23]=n.z,r.needsUpdate=!0,this.geometry.computeBoundingSphere()}}}(),sc.prototype.setFromObject=function(t){return this.object=t,this.update(),this},cc.prototype=Object.create(yi.prototype),cc.prototype.constructor=cc,cc.prototype.setDirection=(bs=new He,function(t){t.y>.99999?this.quaternion.set(0,0,0,1):t.y<-.99999?this.quaternion.set(1,0,0,0):(bs.set(t.z,0,-t.x).normalize(),xs=Math.acos(t.y),this.quaternion.setFromAxisAngle(bs,xs))}),cc.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()},cc.prototype.setColor=function(t){this.line.material.color.copy(t),this.cone.material.color.copy(t)},hc.prototype=Object.create(Gr.prototype),hc.prototype.constructor=hc;var lc=new He,dc=new uc,pc=new uc,fc=new uc;function mc(t){ka.call(this),this.points=t||[],this.closed=!1}function gc(t,e,n,i){ka.call(this),this.v0=t,this.v1=e,this.v2=n,this.v3=i}function vc(t,e,n){ka.call(this),this.v0=t,this.v1=e,this.v2=n}function yc(t,e){ka.call(this),this.v1=t,this.v2=e}function xc(t,e,n,i,r,o){Xa.call(this,t,e,n,n,i,r,o)}mc.prototype=Object.create(ka.prototype),mc.prototype.constructor=mc,mc.prototype.getPoint=function(t){var e=this.points,n=e.length;n<2&&console.log("duh, you need at least 2 points");var i,r,o,a,s=(n-(this.closed?0:1))*t,c=Math.floor(s),h=s-c;if(this.closed?c+=c>0?0:(Math.floor(Math.abs(c)/e.length)+1)*e.length:0===h&&c===n-1&&(c=n-2,h=1),this.closed||c>0?i=e[(c-1)%n]:(lc.subVectors(e[0],e[1]).add(e[0]),i=lc),r=e[c%n],o=e[(c+1)%n],this.closed||c+2<n?a=e[(c+2)%n]:(lc.subVectors(e[n-1],e[n-2]).add(e[n-1]),a=lc),void 0===this.type||"centripetal"===this.type||"chordal"===this.type){var u="chordal"===this.type?.5:.25,l=Math.pow(i.distanceToSquared(r),u),d=Math.pow(r.distanceToSquared(o),u),p=Math.pow(o.distanceToSquared(a),u);d<1e-4&&(d=1),l<1e-4&&(l=d),p<1e-4&&(p=d),dc.initNonuniformCatmullRom(i.x,r.x,o.x,a.x,l,d,p),pc.initNonuniformCatmullRom(i.y,r.y,o.y,a.y,l,d,p),fc.initNonuniformCatmullRom(i.z,r.z,o.z,a.z,l,d,p)}else if("catmullrom"===this.type){var f=void 0!==this.tension?this.tension:.5;dc.initCatmullRom(i.x,r.x,o.x,a.x,f),pc.initCatmullRom(i.y,r.y,o.y,a.y,f),fc.initCatmullRom(i.z,r.z,o.z,a.z,f)}return new He(dc.calc(h),pc.calc(h),fc.calc(h))},gc.prototype=Object.create(ka.prototype),gc.prototype.constructor=gc,gc.prototype.getPoint=function(t){var e=this.v0,n=this.v1,i=this.v2,r=this.v3;return new He(Va(t,e.x,n.x,i.x,r.x),Va(t,e.y,n.y,i.y,r.y),Va(t,e.z,n.z,i.z,r.z))},vc.prototype=Object.create(ka.prototype),vc.prototype.constructor=vc,vc.prototype.getPoint=function(t){var e=this.v0,n=this.v1,i=this.v2;return new He(Ha(t,e.x,n.x,i.x),Ha(t,e.y,n.y,i.y),Ha(t,e.z,n.z,i.z))},yc.prototype=Object.create(ka.prototype),yc.prototype.constructor=yc,yc.prototype.getPoint=function(t){if(1===t)return this.v2.clone();var e=new He;return e.subVectors(this.v2,this.v1),e.multiplyScalar(t),e.add(this.v1),e},xc.prototype=Object.create(Xa.prototype),xc.prototype.constructor=xc;var bc={createMultiMaterialObject:function(t,e){for(var n=new jr,i=0,r=e.length;i<r;i++)n.add(new Gi(t,e[i]));return n},detach:function(t,e,n){t.applyMatrix(e.matrixWorld),e.remove(t),n.add(t)},attach:function(t,e,n){var i=new Ve;i.getInverse(n.matrixWorld),t.applyMatrix(i),e.remove(t),n.add(t)}};function _c(t,e,n,i,r,o,a){return console.warn("THREE.Face4 has been removed. A THREE.Face3 will be created instead."),new _i(t,e,n,r,o,a)}var wc=0,Mc=1;function Ec(t){return console.warn("THREE.MeshFaceMaterial has been removed. Use an Array instead."),t}function Tc(t){return void 0===t&&(t=[]),console.warn("THREE.MultiMaterial has been removed. Use an Array instead."),t.isMultiMaterial=!0,t.materials=t,t.clone=function(){return t.slice()},t}function Sc(t,e){return console.warn("THREE.PointCloud has been renamed to THREE.Points."),new kr(t,e)}function Ac(t){return console.warn("THREE.Particle has been renamed to THREE.Sprite."),new Ur(t)}function Lc(t,e){return console.warn("THREE.ParticleSystem has been renamed to THREE.Points."),new kr(t,e)}function Rc(t){return console.warn("THREE.PointCloudMaterial has been renamed to THREE.PointsMaterial."),new Vr(t)}function Pc(t){return console.warn("THREE.ParticleBasicMaterial has been renamed to THREE.PointsMaterial."),new Vr(t)}function Cc(t){return console.warn("THREE.ParticleSystemMaterial has been renamed to THREE.PointsMaterial."),new Vr(t)}function Ic(t,e,n){return console.warn("THREE.Vertex has been removed. Use THREE.Vector3 instead."),new He(t,e,n)}function Uc(t,e){return console.warn("THREE.DynamicBufferAttribute has been removed. Use new THREE.BufferAttribute().setDynamic( true ) instead."),new Mi(t,e).setDynamic(!0)}function Nc(t,e){return console.warn("THREE.Int8Attribute has been removed. Use new THREE.Int8BufferAttribute() instead."),new Ei(t,e)}function Oc(t,e){return console.warn("THREE.Uint8Attribute has been removed. Use new THREE.Uint8BufferAttribute() instead."),new Ti(t,e)}function Dc(t,e){return console.warn("THREE.Uint8ClampedAttribute has been removed. Use new THREE.Uint8ClampedBufferAttribute() instead."),new Si(t,e)}function Fc(t,e){return console.warn("THREE.Int16Attribute has been removed. Use new THREE.Int16BufferAttribute() instead."),new Ai(t,e)}function Bc(t,e){return console.warn("THREE.Uint16Attribute has been removed. Use new THREE.Uint16BufferAttribute() instead."),new Li(t,e)}function zc(t,e){return console.warn("THREE.Int32Attribute has been removed. Use new THREE.Int32BufferAttribute() instead."),new Ri(t,e)}function Gc(t,e){return console.warn("THREE.Uint32Attribute has been removed. Use new THREE.Uint32BufferAttribute() instead."),new Pi(t,e)}function Hc(t,e){return console.warn("THREE.Float32Attribute has been removed. Use new THREE.Float32BufferAttribute() instead."),new Ci(t,e)}function Vc(t,e){return console.warn("THREE.Float64Attribute has been removed. Use new THREE.Float64BufferAttribute() instead."),new Ii(t,e)}function kc(t){console.warn("THREE.ClosedSplineCurve3 has been deprecated. Use THREE.CatmullRomCurve3 instead."),mc.call(this,t),this.type="catmullrom",this.closed=!0}function jc(t){console.warn("THREE.SplineCurve3 has been deprecated. Use THREE.CatmullRomCurve3 instead."),mc.call(this,t),this.type="catmullrom"}function Wc(t){console.warn("THREE.Spline has been removed. Use THREE.CatmullRomCurve3 instead."),mc.call(this,t),this.type="catmullrom"}function Xc(t,e){return console.warn("THREE.BoundingBoxHelper has been deprecated. Creating a THREE.BoxHelper instead."),new sc(t,e)}function qc(t,e){return console.warn("THREE.EdgesHelper has been removed. Use THREE.EdgesGeometry instead."),new Gr(new Lo(t.geometry),new Br({color:void 0!==e?e:16777215}))}function Yc(t,e){return console.warn("THREE.WireframeHelper has been removed. Use THREE.WireframeGeometry instead."),new Gr(new Zr(t.geometry),new Br({color:void 0!==e?e:16777215}))}function Zc(t){return console.warn("THREE.XHRLoader has been renamed to THREE.FileLoader."),new Zo(t)}function Jc(t){return console.warn("THREE.BinaryTextureLoader has been renamed to THREE.DataTextureLoader."),new Qo(t)}ka.create=function(t,e){return console.log("THREE.Curve.create() has been deprecated"),t.prototype=Object.create(ka.prototype),t.prototype.constructor=t,t.prototype.getPoint=e,t},kc.prototype=Object.create(mc.prototype),jc.prototype=Object.create(mc.prototype),Wc.prototype=Object.create(mc.prototype),Object.assign(Wc.prototype,{initFromArray:function(t){console.error("THREE.Spline: .initFromArray() has been removed.")},getControlPointsArray:function(t){console.error("THREE.Spline: .getControlPointsArray() has been removed.")},reparametrizeByArcLength:function(t){console.error("THREE.Spline: .reparametrizeByArcLength() has been removed.")}}),nc.prototype.setColors=function(){console.error("THREE.GridHelper: setColors() has been deprecated, pass them in the constructor instead.")},Object.assign(Fn.prototype,{center:function(t){return console.warn("THREE.Box2: .center() has been renamed to .getCenter()."),this.getCenter(t)},empty:function(){return console.warn("THREE.Box2: .empty() has been renamed to .isEmpty()."),this.isEmpty()},isIntersectionBox:function(t){return console.warn("THREE.Box2: .isIntersectionBox() has been renamed to .intersectsBox()."),this.intersectsBox(t)},size:function(t){return console.warn("THREE.Box2: .size() has been renamed to .getSize()."),this.getSize(t)}}),Object.assign(ei.prototype,{center:function(t){return console.warn("THREE.Box3: .center() has been renamed to .getCenter()."),this.getCenter(t)},empty:function(){return console.warn("THREE.Box3: .empty() has been renamed to .isEmpty()."),this.isEmpty()},isIntersectionBox:function(t){return console.warn("THREE.Box3: .isIntersectionBox() has been renamed to .intersectsBox()."),this.intersectsBox(t)},isIntersectionSphere:function(t){return console.warn("THREE.Box3: .isIntersectionSphere() has been renamed to .intersectsSphere()."),this.intersectsSphere(t)},size:function(t){return console.warn("THREE.Box3: .size() has been renamed to .getSize()."),this.getSize(t)}}),xi.prototype.center=function(t){return console.warn("THREE.Line3: .center() has been renamed to .getCenter()."),this.getCenter(t)},Ae.random16=function(){return console.warn("THREE.Math.random16() has been deprecated. Use Math.random() instead."),Math.random()},Object.assign(ii.prototype,{flattenToArrayOffset:function(t,e){return console.warn("THREE.Matrix3: .flattenToArrayOffset() has been deprecated. Use .toArray() instead."),this.toArray(t,e)},multiplyVector3:function(t){return console.warn("THREE.Matrix3: .multiplyVector3() has been removed. Use vector.applyMatrix3( matrix ) instead."),t.applyMatrix3(this)},multiplyVector3Array:function(t){return console.warn("THREE.Matrix3: .multiplyVector3Array() has been renamed. Use matrix.applyToVector3Array( array ) instead."),this.applyToVector3Array(t)},applyToBuffer:function(t,e,n){return console.warn("THREE.Matrix3: .applyToBuffer() has been removed. Use matrix.applyToBufferAttribute( attribute ) instead."),this.applyToBufferAttribute(t)},applyToVector3Array:function(t,e,n){console.error("THREE.Matrix3: .applyToVector3Array() has been removed.")}}),Object.assign(Ve.prototype,{extractPosition:function(t){return console.warn("THREE.Matrix4: .extractPosition() has been renamed to .copyPosition()."),this.copyPosition(t)},flattenToArrayOffset:function(t,e){return console.warn("THREE.Matrix4: .flattenToArrayOffset() has been deprecated. Use .toArray() instead."),this.toArray(t,e)},getPosition:function(){var t;return function(){return void 0===t&&(t=new He),console.warn("THREE.Matrix4: .getPosition() has been removed. Use Vector3.setFromMatrixPosition( matrix ) instead."),t.setFromMatrixColumn(this,3)}}(),setRotationFromQuaternion:function(t){return console.warn("THREE.Matrix4: .setRotationFromQuaternion() has been renamed to .makeRotationFromQuaternion()."),this.makeRotationFromQuaternion(t)},multiplyToArray:function(){console.warn("THREE.Matrix4: .multiplyToArray() has been removed.")},multiplyVector3:function(t){return console.warn("THREE.Matrix4: .multiplyVector3() has been removed. Use vector.applyMatrix4( matrix ) instead."),t.applyMatrix4(this)},multiplyVector4:function(t){return console.warn("THREE.Matrix4: .multiplyVector4() has been removed. Use vector.applyMatrix4( matrix ) instead."),t.applyMatrix4(this)},multiplyVector3Array:function(t){return console.warn("THREE.Matrix4: .multiplyVector3Array() has been renamed. Use matrix.applyToVector3Array( array ) instead."),this.applyToVector3Array(t)},rotateAxis:function(t){console.warn("THREE.Matrix4: .rotateAxis() has been removed. Use Vector3.transformDirection( matrix ) instead."),t.transformDirection(this)},crossVector:function(t){return console.warn("THREE.Matrix4: .crossVector() has been removed. Use vector.applyMatrix4( matrix ) instead."),t.applyMatrix4(this)},translate:function(){console.error("THREE.Matrix4: .translate() has been removed.")},rotateX:function(){console.error("THREE.Matrix4: .rotateX() has been removed.")},rotateY:function(){console.error("THREE.Matrix4: .rotateY() has been removed.")},rotateZ:function(){console.error("THREE.Matrix4: .rotateZ() has been removed.")},rotateByAxis:function(){console.error("THREE.Matrix4: .rotateByAxis() has been removed.")},applyToBuffer:function(t,e,n){return console.warn("THREE.Matrix4: .applyToBuffer() has been removed. Use matrix.applyToBufferAttribute( attribute ) instead."),this.applyToBufferAttribute(t)},applyToVector3Array:function(t,e,n){console.error("THREE.Matrix4: .applyToVector3Array() has been removed.")},makeFrustum:function(t,e,n,i,r,o){return console.warn("THREE.Matrix4: .makeFrustum() has been removed. Use .makePerspective( left, right, top, bottom, near, far ) instead."),this.makePerspective(t,e,i,n,r,o)}}),ri.prototype.isIntersectionLine=function(t){return console.warn("THREE.Plane: .isIntersectionLine() has been renamed to .intersectsLine()."),this.intersectsLine(t)},Ge.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(si.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.prototype,{extrude:function(t){return console.warn("THREE.Shape: .extrude() has been removed. Use ExtrudeGeometry() instead."),new go(this,t)},makeGeometry:function(t){return console.warn("THREE.Shape: .makeGeometry() has been removed. Use ShapeGeometry() instead."),new So(this,t)}}),Object.assign(Le.prototype,{fromAttribute:function(t,e,n){return console.error("THREE.Vector2: .fromAttribute() has been renamed to .fromBufferAttribute()."),this.fromBufferAttribute(t,e,n)}}),Object.assign(He.prototype,{setEulerFromRotationMatrix:function(){console.error("THREE.Vector3: .setEulerFromRotationMatrix() has been removed. Use Euler.setFromRotationMatrix() instead.")},setEulerFromQuaternion:function(){console.error("THREE.Vector3: .setEulerFromQuaternion() has been removed. Use Euler.setFromQuaternion() instead.")},getPositionFromMatrix:function(t){return console.warn("THREE.Vector3: .getPositionFromMatrix() has been renamed to .setFromMatrixPosition()."),this.setFromMatrixPosition(t)},getScaleFromMatrix:function(t){return console.warn("THREE.Vector3: .getScaleFromMatrix() has been renamed to .setFromMatrixScale()."),this.setFromMatrixScale(t)},getColumnFromMatrix:function(t,e){return console.warn("THREE.Vector3: .getColumnFromMatrix() has been renamed to .setFromMatrixColumn()."),this.setFromMatrixColumn(e,t)},applyProjection:function(t){return console.warn("THREE.Vector3: .applyProjection() has been removed. Use .applyMatrix4( m ) instead."),this.applyMatrix4(t)},fromAttribute:function(t,e,n){return console.error("THREE.Vector3: .fromAttribute() has been renamed to .fromBufferAttribute()."),this.fromBufferAttribute(t,e,n)}}),Object.assign(Fe.prototype,{fromAttribute:function(t,e,n){return console.error("THREE.Vector4: .fromAttribute() has been renamed to .fromBufferAttribute()."),this.fromBufferAttribute(t,e,n)}}),Bi.prototype.computeTangents=function(){console.warn("THREE.Geometry: .computeTangents() has been removed.")},Object.assign(yi.prototype,{getChildByName:function(t){return console.warn("THREE.Object3D: .getChildByName() has been renamed to .getObjectByName()."),this.getObjectByName(t)},renderDepth:function(){console.warn("THREE.Object3D: .renderDepth has been removed. Use .renderOrder, instead.")},translate:function(t,e){return console.warn("THREE.Object3D: .translate() has been removed. Use .translateOnAxis( axis, distance ) instead."),this.translateOnAxis(e,t)}}),Object.defineProperties(yi.prototype,{eulerOrder:{get:function(){return console.warn("THREE.Object3D: .eulerOrder is now .rotation.order."),this.rotation.order},set:function(t){console.warn("THREE.Object3D: .eulerOrder is now .rotation.order."),this.rotation.order=t}},useQuaternion:{get:function(){console.warn("THREE.Object3D: .useQuaternion has been removed. The library now uses quaternions by default.")},set:function(){console.warn("THREE.Object3D: .useQuaternion has been removed. The library now uses quaternions by default.")}}}),Object.defineProperties(Nr.prototype,{objects:{get:function(){return console.warn("THREE.LOD: .objects has been renamed to .levels."),this.levels}}}),Object.defineProperty(Or.prototype,"useVertexTexture",{get:function(){console.warn("THREE.Skeleton: useVertexTexture has been removed.")},set:function(){console.warn("THREE.Skeleton: useVertexTexture has been removed.")}}),Object.defineProperty(ka.prototype,"__arcLengthDivisions",{get:function(){return console.warn("THREE.Curve: .__arcLengthDivisions is now .arcLengthDivisions."),this.arcLengthDivisions},set:function(t){console.warn("THREE.Curve: .__arcLengthDivisions is now .arcLengthDivisions."),this.arcLengthDivisions=t}}),Xi.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(ea.prototype,{onlyShadow:{set:function(){console.warn("THREE.Light: .onlyShadow has been removed.")}},shadowCameraFov:{set:function(t){console.warn("THREE.Light: .shadowCameraFov is now .shadow.camera.fov."),this.shadow.camera.fov=t}},shadowCameraLeft:{set:function(t){console.warn("THREE.Light: .shadowCameraLeft is now .shadow.camera.left."),this.shadow.camera.left=t}},shadowCameraRight:{set:function(t){console.warn("THREE.Light: .shadowCameraRight is now .shadow.camera.right."),this.shadow.camera.right=t}},shadowCameraTop:{set:function(t){console.warn("THREE.Light: .shadowCameraTop is now .shadow.camera.top."),this.shadow.camera.top=t}},shadowCameraBottom:{set:function(t){console.warn("THREE.Light: .shadowCameraBottom is now .shadow.camera.bottom."),this.shadow.camera.bottom=t}},shadowCameraNear:{set:function(t){console.warn("THREE.Light: .shadowCameraNear is now .shadow.camera.near."),this.shadow.camera.near=t}},shadowCameraFar:{set:function(t){console.warn("THREE.Light: .shadowCameraFar is now .shadow.camera.far."),this.shadow.camera.far=t}},shadowCameraVisible:{set:function(){console.warn("THREE.Light: .shadowCameraVisible has been removed. Use new THREE.CameraHelper( light.shadow.camera ) instead.")}},shadowBias:{set:function(t){console.warn("THREE.Light: .shadowBias is now .shadow.bias."),this.shadow.bias=t}},shadowDarkness:{set:function(){console.warn("THREE.Light: .shadowDarkness has been removed.")}},shadowMapWidth:{set:function(t){console.warn("THREE.Light: .shadowMapWidth is now .shadow.mapSize.width."),this.shadow.mapSize.width=t}},shadowMapHeight:{set:function(t){console.warn("THREE.Light: .shadowMapHeight is now .shadow.mapSize.height."),this.shadow.mapSize.height=t}}}),Object.defineProperties(Mi.prototype,{length:{get:function(){return console.warn("THREE.BufferAttribute: .length has been deprecated. Use .count instead."),this.array.length}}}),Object.assign(zi.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(zi.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(Ds.prototype,{dynamic:{set:function(){console.warn("THREE.Uniform: .dynamic has been removed. Use object.onBeforeRender() instead.")}},onUpdate:{value:function(){return console.warn("THREE.Uniform: .onUpdate() has been removed. Use object.onBeforeRender() instead."),this}}}),Object.defineProperties(Kn.prototype,{wrapAround:{get:function(){console.warn("THREE.Material: .wrapAround has been removed.")},set:function(){console.warn("THREE.Material: .wrapAround has been removed.")}},wrapRGB:{get:function(){return console.warn("THREE.Material: .wrapRGB has been removed."),new In}}}),Object.defineProperties(Go.prototype,{metal:{get:function(){return console.warn("THREE.MeshPhongMaterial: .metal has been removed. Use THREE.MeshStandardMaterial instead."),!1},set:function(){console.warn("THREE.MeshPhongMaterial: .metal has been removed. Use THREE.MeshStandardMaterial instead")}}}),Object.defineProperties($n.prototype,{derivatives:{get:function(){return console.warn("THREE.ShaderMaterial: .derivatives has been moved to .extensions.derivatives."),this.extensions.derivatives},set:function(t){console.warn("THREE. ShaderMaterial: .derivatives has been moved to .extensions.derivatives."),this.extensions.derivatives=t}}}),Object.assign(Ar.prototype,{getCurrentRenderTarget:function(){return console.warn("THREE.WebGLRenderer: .getCurrentRenderTarget() is now .getRenderTarget()."),this.getRenderTarget()},supportsFloatTextures:function(){return console.warn("THREE.WebGLRenderer: .supportsFloatTextures() is now .extensions.get( 'OES_texture_float' )."),this.extensions.get("OES_texture_float")},supportsHalfFloatTextures:function(){return console.warn("THREE.WebGLRenderer: .supportsHalfFloatTextures() is now .extensions.get( 'OES_texture_half_float' )."),this.extensions.get("OES_texture_half_float")},supportsStandardDerivatives:function(){return console.warn("THREE.WebGLRenderer: .supportsStandardDerivatives() is now .extensions.get( 'OES_standard_derivatives' )."),this.extensions.get("OES_standard_derivatives")},supportsCompressedTextureS3TC:function(){return console.warn("THREE.WebGLRenderer: .supportsCompressedTextureS3TC() is now .extensions.get( 'WEBGL_compressed_texture_s3tc' )."),this.extensions.get("WEBGL_compressed_texture_s3tc")},supportsCompressedTexturePVRTC:function(){return console.warn("THREE.WebGLRenderer: .supportsCompressedTexturePVRTC() is now .extensions.get( 'WEBGL_compressed_texture_pvrtc' )."),this.extensions.get("WEBGL_compressed_texture_pvrtc")},supportsBlendMinMax:function(){return console.warn("THREE.WebGLRenderer: .supportsBlendMinMax() is now .extensions.get( 'EXT_blend_minmax' )."),this.extensions.get("EXT_blend_minmax")},supportsVertexTextures:function(){return console.warn("THREE.WebGLRenderer: .supportsVertexTextures() is now .capabilities.vertexTextures."),this.capabilities.vertexTextures},supportsInstancedArrays:function(){return console.warn("THREE.WebGLRenderer: .supportsInstancedArrays() is now .extensions.get( 'ANGLE_instanced_arrays' )."),this.extensions.get("ANGLE_instanced_arrays")},enableScissorTest:function(t){console.warn("THREE.WebGLRenderer: .enableScissorTest() is now .setScissorTest()."),this.setScissorTest(t)},initMaterial:function(){console.warn("THREE.WebGLRenderer: .initMaterial() has been removed.")},addPrePlugin:function(){console.warn("THREE.WebGLRenderer: .addPrePlugin() has been removed.")},addPostPlugin:function(){console.warn("THREE.WebGLRenderer: .addPostPlugin() has been removed.")},updateShadowMap:function(){console.warn("THREE.WebGLRenderer: .updateShadowMap() has been removed.")}}),Object.defineProperties(Ar.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(ai.prototype,{cullFace:{get:function(){return this.renderReverseSided?f:p},set:function(t){var e=t!==p;console.warn("WebGLRenderer: .shadowMap.cullFace is deprecated. Set .shadowMap.renderReverseSided to "+e+"."),this.renderReverseSided=e}}}),Object.defineProperties(Be.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}}}),As.prototype.load=function(t){console.warn("THREE.Audio: .load has been deprecated. Use THREE.AudioLoader instead.");var e=this;return(new ws).load(t,function(t){e.setBuffer(t)}),this},Rs.prototype.getData=function(){return console.warn("THREE.AudioAnalyser: .getData() is now .getFrequencyData()."),this.getFrequencyData()};var Qc={merge:function(t,e,n){var i;console.warn("THREE.GeometryUtils: .merge() has been moved to Geometry. Use geometry.merge( geometry2, matrix, materialIndexOffset ) instead."),e.isMesh&&(e.matrixAutoUpdate&&e.updateMatrix(),i=e.matrix,e=e.geometry),t.merge(e,i,n)},center:function(t){return console.warn("THREE.GeometryUtils: .center() has been moved to Geometry. Use geometry.center() instead."),t.center()}},Kc={crossOrigin:void 0,loadTexture:function(t,e,n,i){console.warn("THREE.ImageUtils.loadTexture has been deprecated. Use THREE.TextureLoader() instead.");var r=new ta;r.setCrossOrigin(this.crossOrigin);var o=r.load(t,n,void 0,i);return e&&(o.mapping=e),o},loadTextureCube:function(t,e,n,i){console.warn("THREE.ImageUtils.loadTextureCube has been deprecated. Use THREE.CubeTextureLoader() instead.");var r=new $o;r.setCrossOrigin(this.crossOrigin);var o=r.load(t,n,void 0,i);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.")}};function $c(){console.error("THREE.Projector has been moved to /examples/js/renderers/Projector.js."),this.projectVector=function(t,e){console.warn("THREE.Projector: .projectVector() is now vector.project()."),t.project(e)},this.unprojectVector=function(t,e){console.warn("THREE.Projector: .unprojectVector() is now vector.unproject()."),t.unproject(e)},this.pickingRay=function(){console.error("THREE.Projector: .pickingRay() is now raycaster.setFromCamera().")}}function th(){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(){}}}]);