@aurigma/ui-framework
Version:
A platform which allows building print product personalization editors based on Aurigma's Customer's Canvas.
3 lines • 645 kB
JavaScript
(window.multistep_editor_jsonpFunction=window.multistep_editor_jsonpFunction||[]).push([[2],{545:function(e,t,n){n.d(t,"i",function(){return i}),n.d(t,"j",function(){return r}),n.d(t,"f",function(){return a}),n.d(t,"g",function(){return o}),n.d(t,"d",function(){return s}),n.d(t,"b",function(){return c}),n.d(t,"e",function(){return l}),n.d(t,"h",function(){return h}),n.d(t,"k",function(){return u}),n.d(t,"c",function(){return d}),n.d(t,"a",function(){return p});var i="static/images/3d-viewer/1x.svg",r="static/images/3d-viewer/2x.svg",a="static/images/3d-viewer/pause.svg",o="static/images/3d-viewer/play.svg",s="static/images/3d-viewer/front.svg",c="static/images/3d-viewer/back.svg",l="static/images/3d-viewer/left.svg",h="static/images/3d-viewer/right.svg",u="static/images/3d-viewer/top.svg",d="static/images/3d-viewer/bottom.svg",p="#f5f5f5"},736:function(e,t){e.exports='<style>\n body {\n background: #fff;\n padding: 0;\n margin: 0;\n overflow: hidden;\n }\n\n #divControls {\n top: 6px;\n left: 6px;\n opacity: 0.9;\n display: flex;\n flex-direction: column;\n width: 80px;\n padding-left: 20px;\n padding-top: 2px;\n\n }\n @media (max-width: 769px){\n #divControls {\n flex-direction: column !important;\n width: fit-content !important;\n }\n #cameraButtons{\n width: fit-content !important;\n }\n #animationControls{\n width: fit-content !important;\n }\n #progress {\n width: 100% !important;\n }\n }\n\n .icon {\n outline: none;\n height: 40px;\n background: none;\n border-radius: 4px;\n width: 40px;\n display: flex;\n justify-content: center;\n align-items: center;\n margin-bottom: 5px;\n border: 2px solid white;\n cursor: pointer;\n }\n\n .icon:hover {\n background-color: #f5f5f5;\n }\n\n .icon.selected {\n border: 2px solid var(--primary-color);\n }\n\n i {\n display: inline-block;\n width: 24px;\n height: 24px;\n background-size: contain;\n background-repeat: no-repeat;\n }\n\n #divContainer {\n width: calc(100% - 100px);\n height: 100%;\n }\n\n canvas {\n background-color: #f5f5f5 !important;\n }\n\n .shell {\n width: 100%;\n height: 100%;\n display: flex;\n flex-direction: row;\n }\n\n #animationControls {\n display: inline-block;\n }\n\n .slider {\n overflow: hidden;\n width: 280px;\n display: inline-block;\n -webkit-appearance: none;\n background-color: #d3d3d3;\n position: relative;\n cursor: pointer;\n top: -10px;\n height: 8px;\n outline: none;\n margin: 0px 8px;\n }\n\n .slider::-webkit-slider-runnable-track {\n height: 5px;\n -webkit-appearance: none;\n color: var(--primary-color);\n margin-top: -1px;\n }\n\n .slider::-webkit-slider-thumb {\n width: 1px;\n -webkit-appearance: none;\n height: 10px;\n cursor: pointer;\n background: #d3d3d3;\n box-shadow: -280px 0 0 280px var(--primary-color);\n }\n\n .slider::-moz-range-progress {\n background-color: var(--primary-color);\n }\n\n .slider::-moz-range-track {\n background-color: #d3d3d3;\n }\n\n .slider::-ms-fill-lower {\n background-color: var(--primary-color);\n }\n\n .slider::-ms-fill-upper {\n background-color: #d3d3d3;\n }\n</style>\n\n<div class="shell">\n <div id="divControls" style="display:none;">\n\n <div id="cameraButtons" style="display: initial;">\n <div tabindex="1" role="menuitemradio" id="cameraFront" title="Front" class="selected icon">\n <i></i>\n </div>\n <div tabindex="1" role="menuitemradio" id="cameraTop" title="Top" class="icon">\n <i></i>\n </div>\n <div tabindex="1" role="menuitemradio" id="cameraBack" title="Back" class="icon">\n <i></i>\n </div>\n <div tabindex="1" role="menuitemradio" id="cameraLeft" title="Left" class="icon">\n <i></i>\n </div>\n <div tabindex="1" role="menuitemradio" id="cameraBottom" title="Bottom" class="icon">\n <i></i>\n </div>\n <div tabindex="1" role="menuitemradio" id="cameraRight" title="Right" class="icon">\n <i></i>\n </div>\n </div>\n\n <div id="divMultipleElements" style="display: none;">\n <div tabindex="1" role="menuitemradio" id="btnAction" title="Action" class="icon">\n <i></i>\n </div>\n </div>\n\n <div id="animationControls" style="display: none; align-items: baseline;">\n <div role="button" id="playpause" title="Pause" class="icon">\n <i></i>\n </div>\n <input type="range" id="progress" value="0" class="slider">\n <div role="button" id="speedDiv" title="1x speed" class="icon">\n <i></i>\n </div>\n </div>\n\n </div>\n\n <div id="divContainer"></div>\n</div>\n'},737:function(e,t,n){n.d(t,"a",function(){return a});var i,d=n(0),s=n(1),t=n(160),r=n(2),c=n(545),a=(n(856),i=t.c,Object(d.d)(o,i),o.prototype.connectedCallback=function(){i.prototype.connectedCallback.call(this),this.inited||(this.inited=!0,this._initCameraButtons(),this._initAnimationButtons(),this._initAnimationControls())},o.prototype._initCameraButtons=function(){var e,r=this,t=window.Aurigma.Origami.Camera.positions,a={cameraFront:{position:t.FRONT,image:c.d},cameraBack:{position:t.BACK,image:c.b},cameraLeft:{position:t.LEFT,image:c.e},cameraRight:{position:t.RIGHT,image:c.h},cameraTop:{position:t.TOP,image:c.k},cameraBottom:{position:t.BOTTOM,image:c.c}},o=this;for(e in a)(e=>{var t=a[e],n=o.querySelectorShadow("#".concat(e)),e=(n.addEventListener("click",function(){Array.from(n.parentElement.children).forEach(function(e){return e.classList.remove("selected")}),n.classList.add("selected"),r._moveCamera(t.position,!0)}),n.firstElementChild),i=s.a.getPatchedUrl(t.image);e.style.backgroundImage="url('".concat(i,"')")})(e)},o.prototype._initAnimationButtons=function(){var e=this,t=this.querySelectorShadow("#btnAction"),t=(t.addEventListener("click",function(){e._isOpened?e.closeBox():e.openBox(),e._isOpened=!e._isOpened}),t.firstElementChild),n=s.a.getPatchedUrl("static/images/3d-viewer/action.svg");t.style.backgroundImage="url('".concat(n,"')")},o.prototype._initAnimationControls=function(){var e=this,t=this.querySelectorShadow("#playpause"),n=t.firstElementChild,i=s.a.getPatchedUrl(c.f),n=(n.style.backgroundImage="url('".concat(i,"')"),t.addEventListener("click",function(){e.paused=!e.paused,e.paused?e.PauseAnimation():e.PlayAnimation(),e.__changePlayPauseIcon()}),this.querySelectorShadow("#speedDiv"));n.firstElementChild.style.backgroundImage="url('".concat(s.a.getPatchedUrl(c.i),"')"),n.addEventListener("click",function(){e.SetAnimationSpeed(1===e.speed?2:1)})},o.prototype._moveCamera=function(e,t){var n,i;this.params.saveDistanceWhenMoveCamera&&(n=new window.THREE.Spherical,i=this.origamiViewer.camera.position,n.setFromVector3(new window.THREE.Vector3(i.y,i.z,i.x)),i=n.radius),this.origamiViewer.moveCamera(e,t,i)},o.prototype.applyInterfaceParams=function(e){var t,n=this.querySelectorShadow("#divControls");if(!0===e.showCameraButtons?n.style.display="flex":n.style.display="none",e.cameraButtons){var i=this.querySelectorAllShadow("div#cameraButtons div");Array.from(i).forEach(function(e){return e.style.display="none"});try{for(var r=Object(d.k)(Object.keys(e.cameraButtons).entries()),a=r.next();!a.done;a=r.next()){var o=Object(d.h)(a.value,2),s=o[0],c=o[1],l=c[0].toUpperCase()+c.toLowerCase().slice(1),h=this.querySelectorShadow("div#cameraButtons [title='".concat(l,"']"));h.style.display="flex",0===s&&(this.querySelectorShadow("#cameraFront").classList.remove("selected"),h.classList.add("selected"),this._moveCamera(window.Aurigma.Origami.Camera.positions[c],!0)),h.style.order="".concat(s)}}catch(e){t={error:e}}finally{try{a&&!a.done&&(u=r.return)&&u.call(r)}finally{if(t)throw t.error}}}var i=this.querySelectorShadow("#divMultipleElements"),u=(!0===e.showAnimationButtons?i.style.display="block":i.style.display="none",this.querySelectorShadow("#animationControls"));!0===e.showAnimationControls?(u.style.display="flex",this.__initAnimationControls()):u.style.display="none",void 0===e.buttonsPosition||"left"===e.buttonsPosition?(n.style.order="0",i.style.marginTop="10px"):"right"===e.buttonsPosition?n.style.order="11":"top"===e.buttonsPosition&&(n.style.flexDirection="row",n.style.width="auto",n.style.justifyContent="space-between",i.style.marginLeft="10px",i.style.marginRight="10px",this.querySelectorShadow("#cameraButtons").style.display="inherit",this.querySelectorShadow("#divContainer").style.width="100%",n.style.paddingLeft="0px",n.style.paddingTop="0px",this.querySelectorShadow(".shell").style.flexDirection="column")},o.prototype.__initAnimationControls=function(){var n=this;setTimeout(function(){var t=n.querySelectorShadow("#progress");t.min=0,t.value=0,t.max=n.GetAnimationDuration()*n.__animTimeKoef,t.oninput=function(){n.PauseAnimation(),n.SetAnimationAt(Number(t.value)/n.__animTimeKoef)},null!==n.__intervalValue&&clearInterval(n.__intervalValue),n.__intervalValue=setInterval(function(){var e=n.origamiViewer.GetAnimationTime();0!==t.max&&"0"!==t.max||(t.max=n.GetAnimationDuration()*n.__animTimeKoef),0!==e&&e===t.max/n.__animTimeKoef&&n.params.pauseAtEnd&&(n.PauseAnimation(),t.value=t.max),!1===n.paused&&(t.value=e*n.__animTimeKoef)},500)},250)},o.prototype.openBox=function(){this.origamiViewer.animate()},o.prototype.closeBox=function(){this.origamiViewer.animate(!0)},o.prototype.GetAnimationDuration=function(){return this.origamiViewer.GetAnimationDuration()},o.prototype.SetAnimationAt=function(e){this.origamiViewer.SetAnimationAt(e),this.querySelectorShadow("#progress").value=e*this.__animTimeKoef},o.prototype.PlayAnimation=function(){!0===this.paused&&(this.paused=!1),this.origamiViewer.StartAnimation(),this.__changePlayPauseIcon()},o.prototype.PauseAnimation=function(){!1===this.paused&&(this.paused=!0),this.origamiViewer.PauseAnimation(),this.__changePlayPauseIcon()},o.prototype.__changePlayPauseIcon=function(){var e=this.querySelectorShadow("#playpause"),t=e.firstElementChild,n=s.a.getPatchedUrl(this.paused?c.g:c.f);t.style.backgroundImage="url('".concat(n,"')"),e.title=this.paused?"Play":"Pause"},o.prototype.SetAnimationSpeed=function(e){this.speed=e,this.origamiViewer.SetAnimationSpeed(e);var e=this.querySelectorShadow("#speedDiv"),t=e.firstElementChild,n=s.a.getPatchedUrl(1===this.speed?c.i:c.j);t.style.backgroundImage="url('".concat(n,"')"),e.title=this.speed+"x speed"},Object(d.c)([Object(r.c)(),Object(d.g)("design:type",String)],o.prototype,"image",void 0),o);function o(){var e=null!==i&&i.apply(this,arguments)||this;return e.inited=!1,e._isOpened=!1,e.speed=1,e.paused=!1,e.__animTimeKoef=100,e.__intervalValue=null,e}},856:function(e,t){function S(e,t){var n,i,r,a,o="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(o)return i=!(n=!0),{s:function(){o=o.call(e)},n:function(){var e=o.next();return n=e.done,e},e:function(e){i=!0,r=e},f:function(){try{n||null==o.return||o.return()}finally{if(i)throw r}}};if(Array.isArray(e)||(o=((e,t)=>{var n;if(e)return"string"==typeof e?s(e,t):"Map"===(n="Object"===(n=Object.prototype.toString.call(e).slice(8,-1))&&e.constructor?e.constructor.name:n)||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?s(e,t):void 0})(e))||t&&e&&"number"==typeof e.length)return o&&(e=o),a=0,{s:t=function(){},n:function(){return a>=e.length?{done:!0}:{done:!1,value:e[a++]}},e:function(e){throw e},f:t};throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function s(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,i=new Array(t);n<t;n++)i[n]=e[n];return i}function A(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}function v(e,t,n){t&&i(e.prototype,t),n&&i(e,n)}function Xh(e){return(Xh="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function r(e){var t;return(a[e]||(t=a[e]={i:e,l:!1,exports:{}},n[e].call(t.exports,t,t.exports,r),t.l=!0,t)).exports}var n,a;n=[function(l,e,u){function p(){}function te(e,t){this.x=e||0,this.y=t||0}function Re(){this.elements=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],0<arguments.length&&console.error("THREE.Matrix4: the constructor no longer reads arguments. use .set() instead.")}function h(e,t,n,i){this._x=e||0,this._y=t||0,this._z=n||0,this._w=void 0!==i?i:1}function Ce(e,t,n){this.x=e||0,this.y=t||0,this.z=n||0}function S(){this.elements=[1,0,0,0,1,0,0,0,1],0<arguments.length&&console.error("THREE.Matrix3: the constructor no longer reads arguments. use .set() instead.")}function d(e,t,n,i,r,a,o,s,c,l){Object.defineProperty(this,"id",{value:ds++}),this.uuid=Pe.generateUUID(),this.name="",this.image=void 0!==e?e:d.DEFAULT_IMAGE,this.mipmaps=[],this.mapping=void 0!==t?t:d.DEFAULT_MAPPING,this.wrapS=void 0!==n?n:A,this.wrapT=void 0!==i?i:A,this.magFilter=void 0!==r?r:C,this.minFilter=void 0!==a?a:Eo,this.anisotropy=void 0!==c?c:1,this.format=void 0!==o?o:Bo,this.type=void 0!==s?s:To,this.offset=new te(0,0),this.repeat=new te(1,1),this.center=new te(0,0),this.rotation=0,this.matrixAutoUpdate=!0,this.matrix=new S,this.generateMipmaps=!0,this.premultiplyAlpha=!1,this.flipY=!0,this.unpackAlignment=4,this.encoding=void 0!==l?l:ts,this.version=0,this.onUpdate=null}function Le(e,t,n,i){this.x=e||0,this.y=t||0,this.z=n||0,this.w=void 0!==i?i:1}function L(e,t,n){this.uuid=Pe.generateUUID(),this.width=e,this.height=t,this.scissor=new Le(0,0,e,t),this.scissorTest=!1,this.viewport=new Le(0,0,e,t),void 0===(n=n||{}).minFilter&&(n.minFilter=C),this.texture=new d(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 P(e,t,n){L.call(this,e,t,n),this.activeCubeFace=0,this.activeMipMapLevel=0}function Oe(e,t,n,i,r,a,o,s,c,l,h,u){d.call(this,null,a,o,s,c,l,i,r,h,u),this.image={data:e,width:t,height:n},this.magFilter=void 0!==c?c:R,this.minFilter=void 0!==l?l:R,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}function O(e,t,n,i,r,a,o,s,c,l){d.call(this,e=void 0!==e?e:[],t=void 0!==t?t:ho,n,i,r,a,o,s,c,l),this.flipY=!1}function I(){this.seq=[],this.map={}}function U(e,t,n){var i=e[0];if(i<=0||0<i)return e;var r=t*n,a=ms[r];if(void 0===a&&(a=new Float32Array(r),ms[r]=a),0!==t){i.toArray(a,0);for(var o=1,s=0;o!==t;++o)e[o].toArray(a,s+=n)}return a}function D(e,t){var n=gs[t];void 0===n&&(n=new Int32Array(t),gs[t]=n);for(var i=0;i!==t;++i)n[i]=e.allocTextureUnit();return n}function F(e,t){e.uniform1f(this.addr,t)}function B(e,t){e.uniform1i(this.addr,t)}function k(e,t){void 0===t.x?e.uniform2fv(this.addr,t):e.uniform2f(this.addr,t.x,t.y)}function H(e,t){void 0!==t.x?e.uniform3f(this.addr,t.x,t.y,t.z):void 0!==t.r?e.uniform3f(this.addr,t.r,t.g,t.b):e.uniform3fv(this.addr,t)}function z(e,t){void 0===t.x?e.uniform4fv(this.addr,t):e.uniform4f(this.addr,t.x,t.y,t.z,t.w)}function G(e,t){e.uniformMatrix2fv(this.addr,!1,t.elements||t)}function V(e,t){void 0===t.elements?e.uniformMatrix3fv(this.addr,!1,t):(ys.set(t.elements),e.uniformMatrix3fv(this.addr,!1,ys))}function j(e,t){void 0===t.elements?e.uniformMatrix4fv(this.addr,!1,t):(vs.set(t.elements),e.uniformMatrix4fv(this.addr,!1,vs))}function W(e,t,n){var i=n.allocTextureUnit();e.uniform1i(this.addr,i),n.setTexture2D(t||ps,i)}function X(e,t,n){var i=n.allocTextureUnit();e.uniform1i(this.addr,i),n.setTextureCube(t||fs,i)}function q(e,t){e.uniform2iv(this.addr,t)}function Y(e,t){e.uniform3iv(this.addr,t)}function Z(e,t){e.uniform4iv(this.addr,t)}function K(e,t){e.uniform1fv(this.addr,t)}function Q(e,t){e.uniform1iv(this.addr,t)}function $(e,t){e.uniform2fv(this.addr,U(t,this.size,2))}function ee(e,t){e.uniform3fv(this.addr,U(t,this.size,3))}function ie(e,t){e.uniform4fv(this.addr,U(t,this.size,4))}function re(e,t){e.uniformMatrix2fv(this.addr,!1,U(t,this.size,4))}function ae(e,t){e.uniformMatrix3fv(this.addr,!1,U(t,this.size,9))}function oe(e,t){e.uniformMatrix4fv(this.addr,!1,U(t,this.size,16))}function se(e,t,n){var i=t.length,r=D(n,i);e.uniform1iv(this.addr,r);for(var a=0;a!==i;++a)n.setTexture2D(t[a]||ps,r[a])}function ce(e,t,n){var i=t.length,r=D(n,i);e.uniform1iv(this.addr,r);for(var a=0;a!==i;++a)n.setTextureCube(t[a]||fs,r[a])}function le(e,t,n){this.id=e,this.addr=n,this.setValue=(()=>{switch(t.type){case 5126:return F;case 35664:return k;case 35665:return H;case 35666:return z;case 35674:return G;case 35675:return V;case 35676:return j;case 35678:case 36198:return W;case 35680:return X;case 5124:case 35670:return B;case 35667:case 35671:return q;case 35668:case 35672:return Y;case 35669:case 35673:return Z}})()}function he(e,t,n){this.id=e,this.addr=n,this.size=t.size,this.setValue=(()=>{switch(t.type){case 5126:return K;case 35664:return $;case 35665:return ee;case 35666:return ie;case 35674:return re;case 35675:return ae;case 35676:return oe;case 35678:return se;case 35680:return ce;case 5124:case 35670:return Q;case 35667:case 35671:return q;case 35668:case 35672:return Y;case 35669:case 35673:return Z}})()}function ue(e){this.id=e,I.call(this)}function de(e,t){e.seq.push(t),e.map[t.id]=t}function Ie(e,t,n){I.call(this),this.renderer=n;for(var i=e.getProgramParameter(t,e.ACTIVE_UNIFORMS),r=0;r<i;++r){var a=e.getActiveUniform(t,r),o=a.name,o=e.getUniformLocation(t,o),s=(m=f=p=d=u=h=l=c=s=void 0,a),c=o,l=this,h=s.name,u=h.length;for(xs.lastIndex=0;;){var d=xs.exec(h),p=xs.lastIndex,f=d[1],m=d[3];if("]"===d[2]&&(f|=0),void 0===m||"["===m&&p+2===u){de(l,new(void 0===m?le:he)(f,s,c));break}d=l.map[f];void 0===d&&de(l,d=new ue(f)),l=d}}}function N(e,t,n){return void 0===t&&void 0===n?this.set(e):this.setRGB(e,t,n)}function pe(e,t,n){return n<0&&(n+=1),1<n&&--n,n<1/6?e+6*(t-e)*n:n<.5?t:n<2/3?e+6*(t-e)*(2/3-n):e}function fe(e,t){this.min=void 0!==e?e:new te(1/0,1/0),this.max=void 0!==t?t:new te(-1/0,-1/0)}function Ue(e,T,M,S,A){var R,C,L,P,N,O,I;this.render=function(e,t,n,i){if(0!==e.length){var r=new Ce,a=i.w/i.z,o=.5*i.z,s=.5*i.w,c=16/i.w,l=new te(c*a,c),h=new Ce(1,1,0),u=new te(1,1),d=new fe;d.min.set(i.x,i.y),d.max.set(i.x+(i.z-16),i.y+(i.w-16)),void 0===L&&(_=new Float32Array([-1,-1,0,0,1,-1,1,0,1,1,1,1,-1,1,0,1]),E=new Uint16Array([0,1,2,0,2,3]),R=T.createBuffer(),C=T.createBuffer(),T.bindBuffer(T.ARRAY_BUFFER,R),T.bufferData(T.ARRAY_BUFFER,_,T.STATIC_DRAW),T.bindBuffer(T.ELEMENT_ARRAY_BUFFER,C),T.bufferData(T.ELEMENT_ARRAY_BUFFER,E,T.STATIC_DRAW),O=T.createTexture(),I=T.createTexture(),M.bindTexture(T.TEXTURE_2D,O),T.texImage2D(T.TEXTURE_2D,0,T.RGB,16,16,0,T.RGB,T.UNSIGNED_BYTE,null),T.texParameteri(T.TEXTURE_2D,T.TEXTURE_WRAP_S,T.CLAMP_TO_EDGE),T.texParameteri(T.TEXTURE_2D,T.TEXTURE_WRAP_T,T.CLAMP_TO_EDGE),T.texParameteri(T.TEXTURE_2D,T.TEXTURE_MAG_FILTER,T.NEAREST),T.texParameteri(T.TEXTURE_2D,T.TEXTURE_MIN_FILTER,T.NEAREST),M.bindTexture(T.TEXTURE_2D,I),T.texImage2D(T.TEXTURE_2D,0,T.RGBA,16,16,0,T.RGBA,T.UNSIGNED_BYTE,null),T.texParameteri(T.TEXTURE_2D,T.TEXTURE_WRAP_S,T.CLAMP_TO_EDGE),T.texParameteri(T.TEXTURE_2D,T.TEXTURE_WRAP_T,T.CLAMP_TO_EDGE),T.texParameteri(T.TEXTURE_2D,T.TEXTURE_MAG_FILTER,T.NEAREST),T.texParameteri(T.TEXTURE_2D,T.TEXTURE_MIN_FILTER,T.NEAREST),P={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() {","\tvUV = uv;","\tvec2 pos = position;","\tif ( renderType == 2 ) {","\t\tvec4 visibility = texture2D( occlusionMap, vec2( 0.1, 0.1 ) );","\t\tvisibility += texture2D( occlusionMap, vec2( 0.5, 0.1 ) );","\t\tvisibility += texture2D( occlusionMap, vec2( 0.9, 0.1 ) );","\t\tvisibility += texture2D( occlusionMap, vec2( 0.9, 0.5 ) );","\t\tvisibility += texture2D( occlusionMap, vec2( 0.9, 0.9 ) );","\t\tvisibility += texture2D( occlusionMap, vec2( 0.5, 0.9 ) );","\t\tvisibility += texture2D( occlusionMap, vec2( 0.1, 0.9 ) );","\t\tvisibility += texture2D( occlusionMap, vec2( 0.1, 0.5 ) );","\t\tvisibility += texture2D( occlusionMap, vec2( 0.5, 0.5 ) );","\t\tvVisibility = visibility.r / 9.0;","\t\tvVisibility *= 1.0 - visibility.g / 9.0;","\t\tvVisibility *= visibility.b / 9.0;","\t\tvVisibility *= 1.0 - visibility.a / 9.0;","\t\tpos.x = cos( rotation ) * position.x - sin( rotation ) * position.y;","\t\tpos.y = sin( rotation ) * position.x + cos( rotation ) * position.y;","\t}","\tgl_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() {","\tif ( renderType == 0 ) {","\t\tgl_FragColor = vec4( 1.0, 0.0, 1.0, 0.0 );","\t} else if ( renderType == 1 ) {","\t\tgl_FragColor = texture2D( map, vUV );","\t} else {","\t\tvec4 texture = texture2D( map, vUV );","\t\ttexture.a *= opacity * vVisibility;","\t\tgl_FragColor = texture;","\t\tgl_FragColor.rgb *= color;","\t}","}"].join("\n")},_=P,E=T.createProgram(),x=T.createShader(T.FRAGMENT_SHADER),b=T.createShader(T.VERTEX_SHADER),w="precision "+A.precision+" float;\n",T.shaderSource(x,w+_.fragmentShader),T.shaderSource(b,w+_.vertexShader),T.compileShader(x),T.compileShader(b),T.attachShader(E,x),T.attachShader(E,b),T.linkProgram(E),L=E,P={vertex:T.getAttribLocation(L,"position"),uv:T.getAttribLocation(L,"uv")},N={renderType:T.getUniformLocation(L,"renderType"),map:T.getUniformLocation(L,"map"),occlusionMap:T.getUniformLocation(L,"occlusionMap"),opacity:T.getUniformLocation(L,"opacity"),color:T.getUniformLocation(L,"color"),scale:T.getUniformLocation(L,"scale"),rotation:T.getUniformLocation(L,"rotation"),screenPosition:T.getUniformLocation(L,"screenPosition")}),M.useProgram(L),M.initAttributes(),M.enableAttribute(P.vertex),M.enableAttribute(P.uv),M.disableUnusedAttributes(),T.uniform1i(N.occlusionMap,0),T.uniform1i(N.map,1),T.bindBuffer(T.ARRAY_BUFFER,R),T.vertexAttribPointer(P.vertex,2,T.FLOAT,!1,16,0),T.vertexAttribPointer(P.uv,2,T.FLOAT,!1,16,8),T.bindBuffer(T.ELEMENT_ARRAY_BUFFER,C),M.disable(T.CULL_FACE),M.buffers.depth.setMask(!1);for(var p=0,f=e.length;p<f;p++){c=16/i.w,l.set(c*a,c);var m=e[p];if(r.set(m.matrixWorld.elements[12],m.matrixWorld.elements[13],m.matrixWorld.elements[14]),r.applyMatrix4(n.matrixWorldInverse),r.applyMatrix4(n.projectionMatrix),h.copy(r),u.x=i.x+h.x*o+o-8,u.y=i.y+h.y*s+s-8,!0===d.containsPoint(u)){M.activeTexture(T.TEXTURE0),M.bindTexture(T.TEXTURE_2D,null),M.activeTexture(T.TEXTURE1),M.bindTexture(T.TEXTURE_2D,O),T.copyTexImage2D(T.TEXTURE_2D,0,T.RGB,u.x,u.y,16,16,0),T.uniform1i(N.renderType,0),T.uniform2f(N.scale,l.x,l.y),T.uniform3f(N.screenPosition,h.x,h.y,h.z),M.disable(T.BLEND),M.enable(T.DEPTH_TEST),T.drawElements(T.TRIANGLES,6,T.UNSIGNED_SHORT,0),M.activeTexture(T.TEXTURE0),M.bindTexture(T.TEXTURE_2D,I),T.copyTexImage2D(T.TEXTURE_2D,0,T.RGBA,u.x,u.y,16,16,0),T.uniform1i(N.renderType,1),M.disable(T.DEPTH_TEST),M.activeTexture(T.TEXTURE1),M.bindTexture(T.TEXTURE_2D,O),T.drawElements(T.TRIANGLES,6,T.UNSIGNED_SHORT,0),m.positionScreen.copy(h),m.customUpdateCallback?m.customUpdateCallback(m):m.updateLensFlares(),T.uniform1i(N.renderType,2),M.enable(T.BLEND);for(var g=0,v=m.lensFlares.length;g<v;g++){var y=m.lensFlares[g];.001<y.opacity&&.001<y.scale&&(h.x=y.x,h.y=y.y,h.z=y.z,c=y.size*y.scale/i.w,l.x=c*a,l.y=c,T.uniform3f(N.screenPosition,h.x,h.y,h.z),T.uniform2f(N.scale,l.x,l.y),T.uniform1f(N.rotation,y.rotation),T.uniform1f(N.opacity,y.opacity),T.uniform3f(N.color,y.color.r,y.color.g,y.color.b),M.setBlending(y.blending,y.blendEquation,y.blendSrc,y.blendDst),S.setTexture2D(y.texture,1),T.drawElements(T.TRIANGLES,6,T.UNSIGNED_SHORT,0))}}}M.enable(T.CULL_FACE),M.enable(T.DEPTH_TEST),M.buffers.depth.setMask(!0),M.reset()}var x,b,w,_,E}}function me(e,t,n,i,r,a,o,s,c){d.call(this,e,t,n,i,r,a,o,s,c),this.needsUpdate=!0}function De(f,m,g,v,y){var x,b,w,_,E,T,M=new Ce,S=new h,A=new Ce;function R(e,t){return e.renderOrder!==t.renderOrder?e.renderOrder-t.renderOrder:e.z!==t.z?t.z-e.z:t.id-e.id}this.render=function(e,t,n){if(0!==e.length){if(void 0===w){var i=new Float32Array([-.5,-.5,0,0,.5,-.5,1,0,.5,.5,1,1,-.5,.5,0,1]),r=new Uint16Array([0,1,2,0,2,3]),a=(x=m.createBuffer(),b=m.createBuffer(),m.bindBuffer(m.ARRAY_BUFFER,x),m.bufferData(m.ARRAY_BUFFER,i,m.STATIC_DRAW),m.bindBuffer(m.ELEMENT_ARRAY_BUFFER,b),m.bufferData(m.ELEMENT_ARRAY_BUFFER,r,m.STATIC_DRAW),i=m.createProgram(),r=m.createShader(m.VERTEX_SHADER),a=m.createShader(m.FRAGMENT_SHADER),m.shaderSource(r,["precision "+y.precision+" float;","#define SHADER_NAME SpriteMaterial","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;","varying float fogDepth;","void main() {","\tvUV = uvOffset + uv * uvScale;","\tvec2 alignedPosition = position * scale;","\tvec2 rotatedPosition;","\trotatedPosition.x = cos( rotation ) * alignedPosition.x - sin( rotation ) * alignedPosition.y;","\trotatedPosition.y = sin( rotation ) * alignedPosition.x + cos( rotation ) * alignedPosition.y;","\tvec4 mvPosition;","\tmvPosition = modelViewMatrix * vec4( 0.0, 0.0, 0.0, 1.0 );","\tmvPosition.xy += rotatedPosition;","\tgl_Position = projectionMatrix * mvPosition;","\tfogDepth = - mvPosition.z;","}"].join("\n")),m.shaderSource(a,["precision "+y.precision+" float;","#define SHADER_NAME SpriteMaterial","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;","varying float fogDepth;","void main() {","\tvec4 texture = texture2D( map, vUV );","\tgl_FragColor = vec4( color * texture.xyz, texture.a * opacity );","\tif ( gl_FragColor.a < alphaTest ) discard;","\tif ( fogType > 0 ) {","\t\tfloat fogFactor = 0.0;","\t\tif ( fogType == 1 ) {","\t\t\tfogFactor = smoothstep( fogNear, fogFar, fogDepth );","\t\t} else {","\t\t\tconst float LOG2 = 1.442695;","\t\t\tfogFactor = exp2( - fogDensity * fogDensity * fogDepth * fogDepth * LOG2 );","\t\t\tfogFactor = 1.0 - clamp( fogFactor, 0.0, 1.0 );","\t\t}","\t\tgl_FragColor.rgb = mix( gl_FragColor.rgb, fogColor, fogFactor );","\t}","}"].join("\n")),m.compileShader(r),m.compileShader(a),m.attachShader(i,r),m.attachShader(i,a),m.linkProgram(i),w=i,_={position:m.getAttribLocation(w,"position"),uv:m.getAttribLocation(w,"uv")},E={uvOffset:m.getUniformLocation(w,"uvOffset"),uvScale:m.getUniformLocation(w,"uvScale"),rotation:m.getUniformLocation(w,"rotation"),scale:m.getUniformLocation(w,"scale"),color:m.getUniformLocation(w,"color"),map:m.getUniformLocation(w,"map"),opacity:m.getUniformLocation(w,"opacity"),modelViewMatrix:m.getUniformLocation(w,"modelViewMatrix"),projectionMatrix:m.getUniformLocation(w,"projectionMatrix"),fogType:m.getUniformLocation(w,"fogType"),fogDensity:m.getUniformLocation(w,"fogDensity"),fogNear:m.getUniformLocation(w,"fogNear"),fogFar:m.getUniformLocation(w,"fogFar"),fogColor:m.getUniformLocation(w,"fogColor"),fogDepth:m.getUniformLocation(w,"fogDepth"),alphaTest:m.getUniformLocation(w,"alphaTest")},(r=document.createElementNS("http://www.w3.org/1999/xhtml","canvas")).width=8,r.height=8,r.getContext("2d"));a.fillStyle="white",a.fillRect(0,0,8,8),T=new me(r)}g.useProgram(w),g.initAttributes(),g.enableAttribute(_.position),g.enableAttribute(_.uv),g.disableUnusedAttributes(),g.disable(m.CULL_FACE),g.enable(m.BLEND),m.bindBuffer(m.ARRAY_BUFFER,x),m.vertexAttribPointer(_.position,2,m.FLOAT,!1,16,0),m.vertexAttribPointer(_.uv,2,m.FLOAT,!1,16,8),m.bindBuffer(m.ELEMENT_ARRAY_BUFFER,b),m.uniformMatrix4fv(E.projectionMatrix,!1,n.projectionMatrix.elements),g.activeTexture(m.TEXTURE0),m.uniform1i(E.map,0);var o=0,s=0,i=t.fog;i?(m.uniform3f(E.fogColor,i.color.r,i.color.g,i.color.b),i.isFog?(m.uniform1f(E.fogNear,i.near),m.uniform1f(E.fogFar,i.far),m.uniform1i(E.fogType,1),s=o=1):i.isFogExp2&&(m.uniform1f(E.fogDensity,i.density),m.uniform1i(E.fogType,2),s=o=2)):(m.uniform1i(E.fogType,0),s=o=0);for(var c=0,l=e.length;c<l;c++)(u=e[c]).modelViewMatrix.multiplyMatrices(n.matrixWorldInverse,u.matrixWorld),u.z=-u.modelViewMatrix.elements[14];e.sort(R);for(var h=[],c=0,l=e.length;c<l;c++){var u,d,p=(u=e[c]).material;!1!==p.visible&&(u.onBeforeRender(f,t,n,void 0,p,void 0),m.uniform1f(E.alphaTest,p.alphaTest),m.uniformMatrix4fv(E.modelViewMatrix,!1,u.modelViewMatrix.elements),u.matrixWorld.decompose(M,S,A),h[0]=A.x,h[1]=A.y,d=0,o!==(d=t.fog&&p.fog?s:d)&&(m.uniform1i(E.fogType,d),o=d),null!==p.map?(m.uniform2f(E.uvOffset,p.map.offset.x,p.map.offset.y),m.uniform2f(E.uvScale,p.map.repeat.x,p.map.repeat.y)):(m.uniform2f(E.uvOffset,0,0),m.uniform2f(E.uvScale,1,1)),m.uniform1f(E.opacity,p.opacity),m.uniform3f(E.color,p.color.r,p.color.g,p.color.b),m.uniform1f(E.rotation,p.rotation),m.uniform2fv(E.scale,h),g.setBlending(p.blending,p.blendEquation,p.blendSrc,p.blendDst,p.blendEquationAlpha,p.blendSrcAlpha,p.blendDstAlpha,p.premultipliedAlpha),g.buffers.depth.setTest(p.depthTest),g.buffers.depth.setMask(p.depthWrite),g.buffers.color.setMask(p.colorWrite),v.setTexture2D(p.map||T,0),m.drawElements(m.TRIANGLES,6,m.UNSIGNED_SHORT,0),u.onAfterRender(f,t,n,void 0,p,void 0))}g.enable(m.CULL_FACE),g.reset()}}}function t(){Object.defineProperty(this,"id",{value:Xs++}),this.uuid=Pe.generateUUID(),this.name="",this.type="Material",this.fog=!0,this.lights=!0,this.blending=Aa,this.side=Ea,this.flatShading=!1,this.vertexColors=0,this.opacity=1,this.transparent=!1,this.blendSrc=za,this.blendDst=Ga,this.blendEquation=Na,this.blendSrcAlpha=null,this.blendDstAlpha=null,this.blendEquationAlpha=null,this.depthFunc=Ka,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.userData={},this.needsUpdate=!0}function ge(e){t.call(this),this.type="MeshDepthMaterial",this.depthPacking=cs,this.skinning=!1,this.morphTargets=!1,this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.wireframe=!1,this.wireframeLinewidth=1,this.fog=!1,this.lights=!1,this.setValues(e)}function ve(e){t.call(this),this.type="MeshDistanceMaterial",this.referencePosition=new Ce,this.nearDistance=1,this.farDistance=1e3,this.skinning=!1,this.morphTargets=!1,this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.fog=!1,this.lights=!1,this.setValues(e)}function ye(e,t){this.min=void 0!==e?e:new Ce(1/0,1/0,1/0),this.max=void 0!==t?t:new Ce(-1/0,-1/0,-1/0)}function xe(e,t){this.center=void 0!==e?e:new Ce,this.radius=void 0!==t?t:0}function be(e,t){this.normal=void 0!==e?e:new Ce(1,0,0),this.constant=void 0!==t?t:0}function Fe(e,t,n,i,r,a){this.planes=[void 0!==e?e:new be,void 0!==t?t:new be,void 0!==n?n:new be,void 0!==i?i:new be,void 0!==r?r:new be,void 0!==a?a:new be]}function Be(g,v,e){for(var y=new Fe,m=new Re,x=new te,b=new te(e,e),w=new Ce,_=new Ce,h=1,u=2,t=1+(h|u),d=new Array(t),p=new Array(t),f={},E=[new Ce(1,0,0),new Ce(-1,0,0),new Ce(0,0,1),new Ce(0,0,-1),new Ce(0,1,0),new Ce(0,-1,0)],T=[new Ce(0,1,0),new Ce(0,1,0),new Ce(0,1,0),new Ce(0,1,0),new Ce(0,0,1),new Ce(0,0,-1)],M=[new Le,new Le,new Le,new Le,new Le,new Le],n=0;n!==t;++n){var i=0!=(n&h),r=0!=(n&u),a=new ge({depthPacking:ls,morphTargets:i,skinning:r}),a=(d[n]=a,new ve({morphTargets:i,skinning:r}));p[n]=a}var S=this;function A(e,t,n,i,r,a){var o=e.geometry,s=null,c=d,l=e.customDepthMaterial,l=(n&&(c=p,l=e.customDistanceMaterial),s=l||(l=!1,t.morphTargets&&(o&&o.isBufferGeometry?l=o.morphAttributes&&o.morphAttributes.position&&0<o.morphAttributes.position.length:o&&o.isGeometry&&(l=o.morphTargets&&0<o.morphTargets.length)),e.isSkinnedMesh&&!1===t.skinning&&console.warn("THREE.WebGLShadowMap: THREE.SkinnedMesh with material.skinning set to false:",e),o=e.isSkinnedMesh&&t.skinning,e=0,l&&(e|=h),o&&(e|=u),c[e]),g.localClippingEnabled&&!0===t.clipShadows&&0!==t.clippingPlanes.length&&(l=s.uuid,o=t.uuid,void 0===(c=f[l])&&(f[l]=c={}),void 0===(e=c[o])&&(e=s.clone(),c[o]=e),s=e),s.visible=t.visible,s.wireframe=t.wireframe,t.side);return S.renderSingleSided&&l==Ma&&(l=Ea),S.renderReverseSided&&(l===Ea?l=Ta:l===Ta&&(l=Ea)),s.side=l,s.clipShadows=t.clipShadows,s.clippingPlanes=t.clippingPlanes,s.clipIntersection=t.clipIntersection,s.wireframeLinewidth=t.wireframeLinewidth,s.linewidth=t.linewidth,n&&s.isMeshDistanceMaterial&&(s.referencePosition.copy(i),s.nearDistance=r,s.farDistance=a),s}this.enabled=!1,this.autoUpdate=!0,this.needsUpdate=!1,this.type=wa,this.renderReverseSided=!0,this.renderSingleSided=!0,this.render=function(e,t,n){if(!1!==S.enabled&&(!1!==S.autoUpdate||!1!==S.needsUpdate)&&0!==e.length){var i,r=g.context,a=g.state;a.disable(r.BLEND),a.buffers.color.setClear(1,1,1,1),a.buffers.depth.setTest(!0),a.setScissorTest(!1);for(var o=0,s=e.length;o<s;o++){var c=e[o],l=c.shadow,h=c&&c.isPointLight;if(void 0!==l){var u=l.camera,d=(x.copy(l.mapSize),x.min(b),h&&(d=x.x,p=x.y,M[0].set(2*d,p,d,p),M[1].set(0,p,d,p),M[2].set(3*d,p,d,p),M[3].set(d,p,d,p),M[4].set(3*d,0,d,p),M[5].set(d,0,d,p),x.x*=4,x.y*=2),null===l.map&&(l.map=new L(x.x,x.y,{minFilter:R,magFilter:R,format:Bo}),l.map.texture.name=c.name+".shadowMap",u.updateProjectionMatrix()),l.isSpotLightShadow&&l.update(c),l.map),p=l.matrix;_.setFromMatrixPosition(c.matrixWorld),u.position.copy(_),h?(i=6,p.makeTranslation(-_.x,-_.y,-_.z)):(i=1,w.setFromMatrixPosition(c.target.matrixWorld),u.lookAt(w),u.updateMatrixWorld(),p.set(.5,0,0,.5,0,.5,0,.5,0,0,.5,.5,0,0,0,1),p.multiply(u.projectionMatrix),p.multiply(u.matrixWorldInverse)),g.setRenderTarget(d),g.clear();for(var f=0;f<i;f++)h&&(w.copy(u.position),w.add(E[f]),u.up.copy(T[f]),u.lookAt(w),u.updateMatrixWorld(),a.viewport(M[f])),m.multiplyMatrices(u.projectionMatrix,u.matrixWorldInverse),y.setFromMatrix(m),function e(t,n,i,r){if(!1!==t.visible){if(t.layers.test(n.layers)&&(t.isMesh||t.isLine||t.isPoints)&&t.castShadow&&(!t.frustumCulled||y.intersectsObject(t))){t.modelViewMatrix.multiplyMatrices(i.matrixWorldInverse,t.matrixWorld);var a=v.update(t),o=t.material;if(Array.isArray(o))for(var s=a.groups,c=0,l=s.length;c<l;c++){var h,u=s[c],d=o[u.materialIndex];d&&d.visible&&(h=A(t,d,r,_,i.near,i.far),g.renderBufferDirect(i,null,a,h,t,u))}else o.visible&&(h=A(t,o,r,_,i.near,i.far),g.renderBufferDirect(i,null,a,h,t,null))}for(var p=t.children,f=0,m=p.length;f<m;f++)e(p[f],n,i,r)}}(t,n,u,h)}else console.warn("THREE.WebGLShadowMap:",c,"has no shadow.")}S.needsUpdate=!1}}}function ke(c){var l={};return{get:function(e){return e.isInterleavedBufferAttribute&&(e=e.data),l[e.uuid]},remove:function(e){e.isInterleavedBufferAttribute&&(e=e.data);var t=l[e.uuid];t&&(c.deleteBuffer(t.buffer),delete l[e.uuid])},update:function(e,t){e.isInterleavedBufferAttribute&&(e=e.data);var n,i,r,a,o,s=l[e.uuid];void 0===s?l[e.uuid]=(i=t,r=(n=e).array,a=n.dynamic?c.DYNAMIC_DRAW:c.STATIC_DRAW,o=c.createBuffer(),c.bindBuffer(i,o),c.bufferData(i,r,a),n.onUploadCallback(),i=c.FLOAT,r instanceof Float32Array?i=c.FLOAT:r instanceof Float64Array?console.warn("THREE.WebGLAttributes: Unsupported data buffer format: Float64Array."):r instanceof Uint16Array?i=c.UNSIGNED_SHORT:r instanceof Int16Array?i=c.SHORT:r instanceof Uint32Array?i=c.UNSIGNED_INT:r instanceof Int32Array?i=c.INT:r instanceof Int8Array?i=c.BYTE:r instanceof Uint8Array&&(i=c.UNSIGNED_BYTE),{buffer:o,type:i,bytesPerElement:r.BYTES_PER_ELEMENT,version:n.version}):s.version<e.version&&(a=s.buffer,o=t,r=(i=e).array,n=i.updateRange,c.bindBuffer(o,a),!1===i.dynamic?c.bufferData(o,r,c.STATIC_DRAW):-1===n.count?c.bufferSubData(o,0,r):0===n.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."):(c.bufferSubData(o,n.offset*r.BYTES_PER_ELEMENT,r.subarray(n.offset,n.offset+n.count)),n.count=-1),s.version=e.version)}}}function we(e,t,n,i){this._x=e||0,this._y=t||0,this._z=n||0,this._order=i||we.DefaultOrder}function _e(){this.mask=1}function Ee(e){var t=e.geometry;if(void 0!==t)if(t.isGeometry){var n=t.vertices;for(Gs=0,Vs=n.length;Gs<Vs;Gs++)js.copy(n[Gs]),js.applyMatrix4(e.matrixWorld),zs.expandByPoint(js)}else if(t.isBufferGeometry){var i=t.attributes.position;if(void 0!==i)for(Gs=0,Vs=i.count;Gs<Vs;Gs++)js.fromBufferAttribute(i,Gs).applyMatrix4(e.matrixWorld),zs.expandByPoint(js)}}function f(){Object.defineProperty(this,"id",{value:dc++}),this.uuid=Pe.generateUUID(),this.name="",this.type="Object3D",this.parent=null,this.children=[],this.up=f.DefaultUp.clone();var e=new Ce,t=new we,n=new h,i=new Ce(1,1,1);t.onChange(function(){n.setFromEuler(t,!1)}),n.onChange(function(){t.setFromQuaternion(n,void 0,!1)}),Object.defineProperties(this,{position:{enumerable:!0,value:e},rotation:{enumerable:!0,value:t},quaternion:{enumerable:!0,value:n},scale:{enumerable:!0,value:i},modelViewMatrix:{value:new Re},normalMatrix:{value:new S}}),this.matrix=new Re,this.matrixWorld=new Re,this.matrixAutoUpdate=f.DefaultMatrixAutoUpdate,this.matrixWorldNeedsUpdate=!1,this.layers=new _e,this.visible=!0,this.castShadow=!1,this.receiveShadow=!1,this.frustumCulled=!0,this.renderOrder=0,this.userData={}}function Te(){f.call(this),this.type="Camera",this.matrixWorldInverse=new Re,this.projectionMatrix=new Re}function Me(e,t,n,i,r,a){Te.call(this),this.type="OrthographicCamera",this.zoom=1,this.view=null,this.left=e,this.right=t,this.top=n,this.bottom=i,this.near=void 0!==r?r:.1,this.far=void 0!==a?a:2e3,this.updateProjectionMatrix()}function Se(e,t,n,i,r,a){this.a=e,this.b=t,this.c=n,this.normal=i&&i.isVector3?i:new Ce,this.vertexNormals=Array.isArray(i)?i:[],this.color=r&&r.isColor?r:new N,this.vertexColors=Array.isArray(r)?r:[],this.materialIndex=void 0!==a?a:0}function x(){Object.defineProperty(this,"id",{value:xc+=2}),this.uuid=Pe.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 w(e,t,n){if(Array.isArray(e))throw new TypeError("THREE.BufferAttribute: array should be a Typed Array.");this.uuid=Pe.generateUUID(),this.name="",this.array=e,this.itemSize=t,this.count=void 0!==e?e.length/t:0,this.normalized=!0===n,this.dynamic=!1,this.updateRange={offset:0,count:-1},this.onUploadCallback=function(){},this.version=0}function Ae(e,t,n){w.call(this,new Int8Array(e),t,n)}function He(e,t,n){w.call(this,new Uint8Array(e),t,n)}function ze(e,t,n){w.call(this,new Uint8ClampedArray(e),t,n)}function Ge(e,t,n){w.call(this,new Int16Array(e),t,n)}function Ve(e,t,n){w.call(this,new Uint16Array(e),t,n)}function je(e,t,n){w.call(this,new Int32Array(e),t,n)}function We(e,t,n){w.call(this,new Uint32Array(e),t,n)}function ne(e,t,n){w.call(this,new Float32Array(e),t,n)}function Xe(e,t,n){w.call(this,new Float64Array(e),t,n)}function qe(){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 Ye(e){if(0===e.length)return-1/0;for(var t=e[0],n=1,i=e.length;n<i;++n)e[n]>t&&(t=e[n]);return t}function J(){Object.defineProperty(this,"id",{value:fl+=2}),this.uuid=Pe.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 Ze(e,t,n,i,r,a){x.call(this),this.type="BoxGeometry",this.parameters={width:e,height:t,depth:n,widthSegments:i,heightSegments:r,depthSegments:a},this.fromBufferGeometry(new Je(e,t,n,i,r,a)),this.mergeVertices()}function Je(e,t,n,i,r,a){J.call(this),this.type="BoxBufferGeometry",this.parameters={width:e,height:t,depth:n,widthSegments:i,heightSegments:r,depthSegments:a};var R=this,C=(e=e||1,t=t||1,n=n||1,i=Math.floor(i)||1,r=Math.floor(r)||1,a=Math.floor(a)||1,[]),L=[],P=[],N=[],O=0,I=0;function o(e,t,n,i,r,a,o,s,c,l,h){for(var u=a/c,d=o/l,p=a/2,f=o/2,m=s/2,g=c+1,v=l+1,y=0,x=0,b=new Ce,w=0;w<v;w++)for(var _=w*d-f,E=0;E<g;E++)b[e]=(E*u-p)*i,b[t]=_*r,b[n]=m,L.push(b.x,b.y,b.z),b[e]=0,b[t]=0,b[n]=0<s?1:-1,P.push(b.x,b.y,b.z),N.push(E/c),N.push(1-w/l),y+=1;for(w=0;w<l;w++)for(E=0;E<c;E++){var T=O+E+g*w,M=O+E+g*(w+1),S=O+(E+1)+g*(w+1),A=O+(E+1)+g*w;C.push(T,M,A),C.push(M,S,A),x+=6}R.addGroup(I,x,h),I+=x,O+=y}o("z","y","x",-1,-1,n,t,e,a,r,0),o("z","y","x",1,-1,n,t,-e,a,r,1),o("x","z","y",1,1,e,n,t,i,a,2),o("x","z","y",1,-1,e,n,-t,i,a,3),o("x","y","z",1,-1,e,t,n,i,r,4),o("x","y","z",-1,-1,e,t,-n,i,r,5),this.setIndex(C),this.addAttribute("position",new ne(L,3)),this.addAttribute("normal",new ne(P,3)),this.addAttribute("uv",new ne(N,2))}function Ke(e,t,n,i){x.call(this),this.type="PlaneGeometry",this.parameters={width:e,height:t,widthSegments:n,heightSegments:i},this.fromBufferGeometry(new Qe(e,t,n,i)),this.mergeVertices()}function Qe(e,t,n,i){J.call(this),this.type="PlaneBufferGeometry",this.parameters={width:e,height:t,widthSegments:n,heightSegments:i};for(var r=(e=e||1)/2,a=(t=t||1)/2,o=Math.floor(n)||1,s=Math.floor(i)||1,c=o+1,l=s+1,h=e/o,u=t/s,d=[],p=[],f=[],m=[],g=0;g<l;g++)for(var v=g*u-a,y=0;y<c;y++)p.push(y*h-r,-v,0),f.push(0,0,1),m.push(y/o),m.push(1-g/s);for(g=0;g<s;g++)for(y=0;y<o;y++){var x=y+c*(g+1),b=y+1+c*(g+1),w=y+1+c*g;d.push(y+c*g,x,w),d.push(x,b,w)}this.setIndex(d),this.addAttribute("position",new ne(p,3)),this.addAttribute("normal",new ne(f,3)),this.addAttribute("uv",new ne(m,2))}function $e(e){t.call(this),this.type="MeshBasicMaterial",this.color=new N(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=no,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.skinning=!1,this.morphTargets=!1,this.lights=!1,this.setValues(e)}function et(e){t.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)!==e&&(void 0!==e.attributes&&console.error("THREE.ShaderMaterial: attributes should now be defined in THREE.BufferGeometry instead."),this.setValues(e))}function tt(e,t){this.origin=void 0!==e?e:new Ce,this.direction=void 0!==t?t:new Ce}function nt(e,t){this.start=void 0!==e?e:new Ce,this.end=void 0!==t?t:new Ce}function it(e,t,n){this.a=void 0!==e?e:new Ce,this.b=void 0!==t?t:new Ce,this.c=void 0!==n?n:new Ce}function m(e,t){f.call(this),this.type="Mesh",this.geometry=void 0!==e?e:new J,this.material=void 0!==t?t:new $e({color:16777215*Math.random()}),this.drawMode=es,this.updateMorphTargets()}function rt(r,n,a,i){var o,s,c,l=new N(0),h=0;function u(e,t){n.buffers.color.setClear(e.r,e.g,e.b,t,i)}return{getClearColor:function(){return l},setClearColor:function(e,t){l.set(e),u(l,h=void 0!==t?t:1)},getClearAlpha:function(){return h},setClearAlpha:function(e){u(l,h=e)},render:function(e,t,n,i){t=t.background;null===t?u(l,h):t&&t.isColor&&(u(t,1),i=!0),(r.autoClear||i)&&r.clear(r.autoClearColor,r.autoClearDepth,r.autoClearStencil),t&&t.isCubeTexture?(void 0===c&&((c=new m(new Je(1,1,1),new et({uniforms:Ts.cube.uniforms,vertexShader:Ts.cube.vertexShader,fragmentShader:Ts.cube.fragmentShader,side:Ta,depthTest:!0,depthWrite:!1,fog:!1}))).geometry.removeAttribute("normal"),c.geometry.removeAttribute("uv"),c.onBeforeRender=function(e,t,n){this.matrixWorld.copyPosition(n.matrixWorld)},a.update(c.geometry)),c.material.uniforms.tCube.value=t,e.push(c,c.geometry,c.material,0,null)):t&&t.isTexture&&(void 0===o&&(o=new Me(-1,1,1,-1,0,1),s=new m(new Qe(2,2),new $e({depthTest:!1,depthWrite:!1,fog:!1})),a.update(s.geometry)),s.material.map=t,r.renderBufferDirect(o,null,s.geometry,s.material,s,null))}}}function at(e,t){return e.renderOrder!==t.renderOrder?e.renderOrder-t.renderOrder:e.program&&t.program&&e.program!==t.program?e.program.id-t.program.id:e.material.id!==t.material.id?e.material.id-t.material.id:e.z!==t.z?e.z-t.z:e.id-t.id}function ot(e,t){return e.renderOrder!==t.renderOrder?e.renderOrder-t.renderOrder:e.z!==t.z?t.z-e.z:e.id-t.id}function st(){var o=[],s=0,c=[],l=[];return{opaque:c,transparent:l,init:function(){s=0,l.length=c.length=0},push:function(e,t,n,i,r){var a=o[s];void 0===a?(a={id:e.id,object:e,geometry:t,material:n,program:n.program,renderOrder:e.renderOrder,z:i,group:r},o[s]=a):(a.id=e.id,a.object=e,a.geometry=t,a.material=n,a.program=n.program,a.renderOrder=e.renderOrder,a.z=i,a.group=r),(!0===n.transparent?l:c).push(a),s++},sort:function(){1<c.length&&c.sort(at),1<l.length&&l.sort(ot)}}}function ct(){var n={};return{get:function(e,t){e=e.id+","+t.id,t=n[e];return void 0===t&&(t=new st,n[e]=t),t},dispose:function(){n={}}}}function lt(e,t){return Math.abs(t[1])-Math.abs(e[1])}function ht(p){var f={},m=new Float32Array(8);return{update:function(e,t,n,i){var r=e.morphTargetInfluences,a=r.length;if(void 0===(o=f[t.id])){for(var o=[],s=0;s<a;s++)o[s]=[s,0];f[t.id]=o}for(var c=n.morphTargets&&t.morphAttributes.position,l=n.morphNormals&&t.morphAttributes.normal,s=0;s<a;s++)0!==(h=o[s])[1]&&(c&&t.removeAttribute("morphTarget"+s),l)&&t.removeAttribute("morphNormal"+s);for(s=0;s<a;s++)(h=o[s])[0]=s,h[1]=r[s];o.sort(lt);for(var h,s=0;s<8;s++){if(h=o[s]){var u=h[0],d=h[1];if(d){c&&t.addAttribute("morphTarget"+s,c[u]),l&&t.addAttribute("morphNormal"+s,l[u]),m[s]=d;continue}}m[s]=0}i.getUniforms().setValue(p,"morphTargetInfluences",m)}}}function ut(r,a,o){var s,c,l;this.setMode=function(e){s=e},this.setIndex=function(e){c=e.type,l=e.bytesPerElement},this.render=function(e,t){r.drawElements(s,t,c,e*l),o.calls++,o.vertices+=t,s===r.TRIANGLES?o.faces+=t/3:s===r.POINTS&&(o.points+=t)},this.renderInstances=function(e,t,n){var i=a.get("ANGLE_instanced_arrays");null!==i?(i.drawElementsInstancedANGLE(s,n,c,t*l,e.maxInstancedCount),o.calls++,o.vertices+=n*e.maxInstancedCount,s===r.TRIANGLES?o.faces+=e.maxInstancedCount*n/3:s===r.POINTS&&(o.points+=e.maxInstancedCount*n)):console.error("THREE.WebGLIndexedBufferRenderer: using THREE.InstancedBufferGeometry but hardware does not support extension ANGLE_instanced_arrays.")}}function dt(a,o,s){var c;this.setMode=function(e){c=e},this.render=function(e,t){a.drawArrays(c,e,t),s.calls++,s.vertices+=t,c===a.TRIANGLES?s.faces+=t/3:c===a.POINTS&&(s.points+=t)},this.renderInstances=function(e,t,n){var i,r=o.get("ANGLE_instanced_arrays");null!==r?((i=e.attributes.position).isInterleavedBufferAttribute?(n=i.data.count,r.drawArraysInstancedANGLE(c,0,n,e.maxInstancedCount)):r.drawArraysInstancedANGLE(c,t,n,e.maxInstancedCount),s.calls++,s.vertices+=n*e.maxInstancedCount,c===a.TRIANGLES?s.faces+=e.maxInstancedCount*n/3:c===a.POINTS&&(s.points+=e.maxInstancedCount*n)):console.error("THREE.WebGLBufferRenderer: using THREE.InstancedBufferGeometry but hardware does not support extension ANGLE_instanced_arrays.")}}function pt(u,d,r){var a={},p={};function o(e){var t,e=e.target,n=a[e.id];for(t in null!==n.index&&d.remove(n.index),n.attributes)d.remove(n.attributes[t]);e.removeEventListener("dispose",o),delete a[e.id];var i=p[e.id];i&&(d.remove(i),delete p[e.id]),(i=p[n.id])&&(d.remove(i),delete p[n.id]),r.geometries--}return{get:function(e,t){var n=a[t.id];return n||(t.addEventListener("dispose",o),t.isBufferGeometry?n=t:t.isGeometry&&(void 0===t._bufferGeometry&&(t._bufferGeometry=(new J).setFromObject(e)),n=t._bufferGeometry),a[t.id]=n,r.geometries++,n)},update:function(e){var t=e.index,n=e.attributes;for(i in null!==t&&d.update(t,u.ELEMENT_ARRAY_BUFFER),n)d.update(n[i],u.ARRAY_BUFFER);var i,r=e.morphAttributes;for(i in r)for(var a=r[i],o=0,s=a.length;o<s;o++)d.update(a[o],u.ARRAY_BUFFER)},getWireframeAttribute:function(e){var t=p[e.id];if(!t){var n=[],i=e.index,r=e.attributes;if(null!==i)for(var a=i.array,o=0,s=a.length;o<s;o+=3){var c=a[o+0],l=a[o+1],h=a[o+2];n.push(c,l,l,h,h,c)}else for(o=0,s=(a=r.position.array).length/3-1;o<s;o+=3){c=o+0,l=o+1,h=o+2;n.push(c,l,l,h,h,c)}t=new(65535<Ye(n)?We:Ve)(n,1),d.update(t,u.ELEMENT_ARRAY_BUFFER),p[e.id]=t}return t}}}function ft(){var n={};return{get:function(e){if(void 0!==n[e.id])return n[e.id];var t;switch(e.type){case"DirectionalLight":t={direction:new Ce,color:new N,shadow:!1,shadowBias:0,shadowRadius:1,shadowMapSize:new te};break;case"SpotLight":t={position:new Ce,direction:new Ce,color:new N,distance:0,coneCos:0,penumbraCos:0,decay:0,shadow:!1,shadowBias:0,shadowRadius:1,shadowMapSize:new te};break;case"PointLight":t={position:new Ce,color:new N,distance:0,decay:0,shadow:!1,shadowBias:0,shadowRadius:1,shadowMapSize:new te,shadowCameraNear:1,shadowCameraFar:1e3};break;case"HemisphereLight":t={direction:new Ce,skyColor:new N,groundColor:new N};break;case"RectAreaLight":t={color:new N,position:new Ce,halfWidth:new Ce,halfHeight:new Ce}}return n[e.id]=t}}}function mt(){var w=new ft,_={hash:"",ambient:[0,0,0],directional:[],directionalShadowMap:[],directionalShadowMatrix:[],spot:[],spotShadowMap:[],spotShadowMatrix:[],rectArea:[],point:[],pointShadowMap:[],pointShadowMatrix:[],hemi:[]},E=new Ce,T=new Re,M=new Re;return{setup:function(e,t,n){for(var i=0,r=0,a=0,o=0,s=0,c=0,l=0,h=0,u=n.matrixWorldInverse,d=0,p=e.length;d<p;d++){var f,m,g=e[d],v=g.color,y=g.intensity,x=g.distance,b=g.shadow&&g.shadow.map?g.shadow.map.texture:null;g.isAmbientLight?(i+=v.r*y,r+=v.g*y,a+=v.b*y):g.isDirectionalLight?((m=w.get(g)).color.copy(g.color).multiplyScalar(g.intensity),m.direction.setFromMatrixPosition(g.matrixWorld),E.setFromMatrixPosition(g.target.matrixWorld),m.direction.sub(E),m.direction.transformDirection(u),m.shadow=g.castShadow,g.castShadow&&(f=g.shadow,m.shadowBias=f.bias,m.shadowRadius=f.radius,m.shadowMapSize=f.mapSize),_.directionalShadowMap[o]=b,_.directionalShadowMatrix[o]=g.shadow.matrix,_.directional[o]=m,o++):g.isSpotLight?((m=w.get(g)).position.setFromMatrixPosition(g.matrixWorld),m.position.applyMatrix4(u),m.color.copy(v).multiplyScalar(y),m.distance=x,m.direction.setFromMatrixPosition(g.matrixWorld),E.setFromMatrixPosition(g.target.matrixWorld),m.direction.sub(E),m.direction.transformDirection(u),m.coneCos=Math.cos(g.angle),m.penumbraCos=Math.cos(g.angle*(1-g.penumbra)),m.decay=0===g.distance?0:g.decay,m.shadow=g.castShadow,g.castShadow&&(f=g.shadow,m.shadowBias=f.bias,m.shadowRadius=f.radius,m.shadowMapSize=f.mapSize),_.spotShadowMap[c]=b,_.spotShadowMatrix[c]=g.shadow.matrix,_.spot[c]=m,c++):g.isRectAreaLight?((m=w.get(g)).color.copy(v).multiplyScalar(y/(g.width*g.height)),m.position.setFromMatrixPosition(g.matrixWorld),m.position.applyMatrix4(u),M.identity(),T.copy(g.matrixWorld),T.premultiply(u),M.extractRotation(T),m.halfWidth.set(.5*g.width,0,0),m.halfHeight.set(0,.5*g.height,0),m.halfWidth.applyMatrix4(M),m.halfHeight.applyMatrix4(M),_.rectArea[l]=m,l++):g.isPointLight?((m=w.get(g)).position.setFromMatrixPosition(g.matrixWorld),m.position.applyMatrix4(u),m.color.copy(g.color).multiplyScalar(g.intensity),m.distance=g.distance,m.decay=0===g.distance?0:g.decay,m.shadow=g.castShadow,g.castShadow&&(f=g.shadow,m.shadowBias=f.bias,m.shadowRadius=f.radius,m.shadowMapSize=f.mapSize,m.shadowCameraNear=f.camera.near,m.shadowCameraFar=f.camera.far),_.pointShadowMap[s]=b,_.pointShadowMatrix[s]=g.shadow.matrix,_.point[s]=m,s++):g.isHemisphereLight&&((m=w.get(g)).direction.setFromMatrixPosition(g.matrixWorld),m.direction.transformDirection(u),m.direction.normalize(),m.skyColor.copy(g.color).multiplyScalar(y),m.groundColor.copy(g.groundColor).multiplyScalar(y),_.hemi[h]=m,h++)}_.ambient[0]=i,_.ambient[1]=r,_.ambient[2]=a,_.directional.length=o,_.spot.length=c,_.rectArea.length=l,_.point.length=s,_.hemi.length=h,_.hash=o+","+s+","+c+","+l+","+h+","+t.length},state:_}}function gt(r,a){var o={};return{update:function(e){var t=a.frame,n=e.geometry,i=r.get(e,n);return o[i.id]!==t&&(n.isGeometry&&i.updateFromObject(e),r.update(i),o[i.id]=t),i},clear:function(){o={}}}}function vt(e,t,n){var i=e.createShader(t);return e.shaderSource(i,n),e.compileShader(i),!1===e.getShaderParameter(i,e.COMPILE_STATUS)&&console.error("THREE.WebGLShader: Shader couldn't compile."),""!==e.getShaderInfoLog(i)&&console.warn("THREE.WebGLShader: gl.getShaderInfoLog()",t===e.VERTEX_SHADER?"vertex":"fragment",e.getShaderInfoLog(i),(()=>{for(var e=n.split("\n"),t=0;t<e.length;t++)e[t]=t+1+": "+e[t];return e.join("\n")})()),i}function yt(e,t,n,i,r,a,o){return it.barycoordFromPoint(e,t,n,i,kc),r.multiplyScalar(kc.x),a.multiplyScalar(kc.y),o.multiplyScalar(kc.z),r.add(a).add(o),r.clone()}function xt(e,t,n,i,r,a,o,s){if(null===(t.side===Ta?i.intersectTriangle(o,a,r,!0,s):i.intersectTriangle(r,a,o,t.side!==Ma,s)))return null;zc.copy(s),zc.applyMatrix4(e.matrixWorld);i=n.ray.origin.distanceTo(zc);return i<n.near||i>n.far?null:{distance:i,point:zc.clone(),object:e}}function bt(e,t,n,i,r,a,o,s){Lc.fromBufferAttribute(i,a),Pc.fromBufferAttribute(i,o),Nc.fromBufferAttribute(i,s);i=xt(e,e.material,t,n,Lc,Pc,Nc,Hc);return i&&(r&&(Dc.fromBufferAttribute(r,a),Fc.fromBufferAttribute(r,o),Bc.fromBufferAttribute(r,s),i.uv=yt(Hc,Lc,Pc,Nc,Dc,Fc,Bc)),i.face=new Se(a,o,s,it.normal(Lc,Pc,Nc)),i.faceIndex=a),i}function wt(e){switch(e){case ts:return["Linear","( value )"];case ns:return["sRGB","( value )"];case rs:return["RGBE","( value )"];case as:return["RGBM","( value, 7.0 )"];case os:return["RGBM","( value, 16.0 )"];case ss:return["RGBD","( value, 256.0 )"];case is:return["Gamma","( value, float( GAMMA_FACTOR ) )"];default:throw new Error("unsupported encoding: "+e)}}function _t(e,t){t=wt(t);return"vec4 "+e+"( vec4 value ) { return "+t[0]+"ToLinear"+t[1]+"; }"}function Et(e){return""!==e}function Tt(e,t){return e.replace(/NUM_DIR_LIGHTS/g,t.numDirLights).replace(/NUM_SPOT_LIGHTS/g,t.numSpotLights).replace(/NUM_RECT_AREA_LIGHTS/g,t.numRectAreaLights).replace(/NUM_POINT_LIGHTS/g,t.numPointLights).replace(/NUM_HEMI_LIGHTS/g,t.numHemiLights)}function Mt(e){return e.replace(/^[ \t]*#include +<([\w\d.]+)>/gm,function(e,t){var n=E[t];if(void 0===n)throw new Error("Can not resolve #include <"+t+">");return Mt(n)})}function St(e){return e.replace(/for \( int i \= (\d+)\; i < (\d+)\; i \+\+ \) \{([\s\S]+?)(?=\})\}/g,function(e,t,n,i){for(var r="",a=parseInt(t);a<parseInt(n);a++)r+=i.replace(/\[ i \]/g,"[ "+a+" ]");return r})}function At(e,t,n,i,r,a){var o=e.context,s=i.defines,c=r.vertexShader,l=r.fragmentShader,h="SHADOWMAP_TYPE_BASIC",u=(a.shadowMapType===wa?h="SHADOWMAP_TYPE_PCF":a.shadowMapType===_a&&(h="SHADOWMAP_TYPE_PCF_SOFT"),"ENVMAP_TYPE_CUBE"),d="ENVMAP_MODE_REFLECTION",p="ENVMAP_BLENDING_MULTIPLY";if(a.envMap){switch(i.envMap.mapping){case ho:case uo:u="ENVMAP_TYPE_CUBE";break;case go:case vo:u="ENVMAP_TYPE_CUBE_UV";break;case po:case fo:u="ENVMAP_TYPE_EQUIREC";break;case mo:u="ENVMAP_TYPE_SPHERE"}switch(i.envMap.mapping){case uo:case fo:d="ENVMAP_MODE_REFRACTION"}switch(i.combine){case no:p="ENVMAP_BLENDING_MULTIPLY";break;case io:p="ENVMAP_BLENDING_MIX";break;case ro:p="ENVMAP_BLENDING_ADD"}}var f,m,g=0<e.gammaFactor?e.gammaFactor:1,v=(y=a,_=t,[(v=i.extensions||{}).derivatives||y.envMapCubeUV||y.bumpMap||y.normalMap||y.flatShading?"#extension GL_OES_standard_derivatives : enable":"",(v.fragDepth||y.logarithmicDepthBuffer)&&_.get("EXT_frag_depth")?"#extension GL_EXT_frag_depth : enable":"",v.drawBuffers&&_.get("WEBGL_draw_buffers")?"#extension GL_EXT_draw_buffers : require":"",(v.shaderTextureLOD||y.envMap)&&_.get("EXT_shader_texture_lod")?"#extension GL_EXT_shader_texture_lod : enable":""].filter(Et).join("\n")),y=(e=>{var t,n=[];for(t in e){var i=e[t];!1!==i&&n.push("#define "+t+" "+i)}return n.join("\n")})(s),x=o.createProgram(),s=(i.isRawShaderMaterial?(0<(f=[y].filter(Et).join("\n")).length&&(f+="\n"),0<(m=[v,y].filter(Et).join("\n")).length&&(m+="\n")):(f=["precision "+a.precision+" float;","precision "+a.precision+" int;","#define SHADER_NAME "+r.name,y,a.supportsVertexTextures?"#define VERTEX_TEXTURES":"","#define GAMMA_FACTOR "+g,"#define MAX_BONES "+a.maxBones,a.useFog&&a.fog?"#define USE_FOG":"",a.useFog&&a.fogExp?"#define FOG_EXP2":"",a.map?"#define USE_MAP":"",a.envMap?"#define USE_ENVMAP":"",a.envMap?"#define "+d:"",a.lightMap?"#define USE_LIGHTMAP":"",a.aoMap?"#define USE_AOMAP":"",a.emissiveMap?"#define USE_EMISSIVEMAP":"",a.bumpMap?"#define USE_BUMPMAP":"",a.normalMap?"#define USE_NORMALMAP":"",a.displacementMap&&a.supportsVertexTextures?"#define USE_DISPLACEMENTMAP":"",a.specularMap?"#define USE_SPECULARMAP":"",a.roughnessMap?"#define USE_ROUGHNESSMAP":"",a.metalnessMap?"#define USE_METALNESSMAP":"",a.alphaMap?"#define USE_ALPHAMAP":"",a.vertexColors?"#define USE_COLOR":"",a.flatShading?"#define FLAT_SHADED":"",a.skinning?"#define USE_SKINNING":"",a.useVertexTexture?"#define BONE_TEXTURE":"",a.morphTargets?"#define USE_MORPHTARGETS":"",a.morphNormals&&!1===a.flatShading?"#define USE_MORPHNORMALS":"",a.doubleSided?"#define DOUBLE_SIDED":"",a.flipSided?"#define FLIP_SIDED":"","#define NUM_CLIPPING_PLANES "+a.numClippingPlanes,a.shadowMapEnabled?"#define USE_SHADOWMAP":"",a.shadowMapEnabled?"#define "+h:"",a.sizeAttenuation?"#define USE_SIZEATTENUATION":"",a.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",a.logarithmicDepthBuffer&&t.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(Et).join("\n"),m=[v,"precision "+a.precision+" float;","precision "+a.precision+" int;","#define SHADER_NAME "+r.name,y,a.alphaTest?"#define ALPHATEST "+a.alphaTest:"","#define GAMMA_FACTOR "+g,a.useFog&&a.fog?"#define USE_FOG":"",a.useFog&&a.fogExp?"#define FOG_EXP2":"",a.map?"#define USE_MAP":"",a.envMap?"#define USE_ENVMAP":"",a.envMap?"#define "+u:"",a.envMap?"#define "+d:"",a.envMap?"#define "+p:"",a.lightMap?"#define USE_LIGHTMAP":"",a.aoMap?"#define USE_AOMAP":"",a.emissiveMap?"#define USE_EMISSIVEMAP":"",a.bumpMap?"#define USE_BUMPMAP":"",a.normalMap?"#define USE_NORMALMAP":"",a.specularMap?"#define USE_SPECULARMAP":"",a.roughnessMap?"#define USE_ROUGHNESSMAP":"",a.metalnessMap?"#define USE_METALNESSMAP":"",a.alphaMap?"#define USE_ALPHAMAP":"",a.vertexColors?"#define USE_COLOR":"",a.gradientMap?"#define USE_GRADIENTMAP":"",a.flatShading?"#define FLAT_SHADED":"",a.doubleSided?"#define DOUBLE_SIDED":"",a.flipSided?"#define FLIP_SIDED":"","#define NUM_CLIPPING_PLANES "+a.numClippingPlanes,"#define UNION_CLIPPING_PLANES "+(a.numClippingPlanes-a.numClipIntersection),a.shadowMapEnabled?"#define USE_SHADOWMAP":"",a.shadowMapEnabled?"#define "+h:"",a.premultipliedAlpha?"#define PREMULTIPLIED_ALPHA":"",a.physicallyCorrectLights?"#define PHYSICALLY_CORRECT_LIGHTS":"",a.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",a.logarithmicDepthBuffer&&t.get("EXT_frag_depth")?"#define USE_LOGDEPTHBUF_EXT":"",a.envMap&&t.get("EXT_shader_texture_lod")?"#define TEXTURE_LOD_EXT":"","uniform mat4 viewMatrix;","uniform vec3 cameraPosition;",a.toneMapping!==ao?"#define TONE_MAPPING":"",a.toneMapping!==ao?E.tonemapping_pars_fragment:"",a.toneMapping!==ao?((e,t)=>{var n;switch(t){case oo:n="Linear";break;case so:n="Reinhard";break;case co:n="Uncharted2";break;case lo:n="OptimizedCineon";break;default:throw new Error("unsupported toneMapping: "+t)}return"vec3 "+e+"( vec3 color ) { return "+n+"ToneMapping( color ); }"})("toneMapping",a.toneMapping):"",a.dithering?"#define DITHERING":"",a.outputEncoding||a.mapEncoding||a.envMapEncoding||a.emissiveMapEncoding?E.encodings_pars_fragment:"",a.mapEncoding?_t("mapTexelToLinear",a.mapEncoding):"",a.envMapEncoding?_t("envMapTexelToLinear",a.envMapEncoding):"",a.emissiveMapEncoding?_t("emissiveMapTexelToLinear",a.emissiveMapEncoding):"",a.outputEncoding?"vec4 linearToOutputTexel( vec4 value ) { return LinearTo"+(_=wt(a.outputEncoding))[0]+_[1]+"; }":"",a.depthPacking?"#define DEPTH_PACKING "+i.depthPacking:"","\n"].filter(Et).join("\n")),c=Tt(c=Mt(c),a),l=Tt(l=Mt(l),a),i.isShaderMaterial||(c=St(c),l=St(l)),f+c),v=m+l,r=vt(o,o.VERTEX_SHADER,s),y=vt(o,o.FRAGMENT_SHADER,v);o.attachShader(x,r),o.attachShader(x,y),void 0!==i.index0AttributeName?o.bindAttribLocation(x,0,i.index0AttributeName):!0===a.morphTargets&&o.bindAttribLocation(x,0,"position"),o.linkProgram(x);var b,w,g=o.getProgramInfoLog(x),h=o.getShaderInfoLog(r),t=o.getShaderInfoLog(y),_=!0,c=!0;return!1===o.getProgramParameter(x,o.LINK_STATUS)?(_=!1,console.error("THREE.WebGLProgram: shader error: ",o.getError(),"gl.VALIDATE_STATUS",o.getProgramParameter(x,o.VALIDATE_STATUS),"gl.getProgramInfoLog",g,h,t)):""!==g?console.warn("THREE.WebGLProgram: gl.getProgramInfoLog()",g):""!==h&&""!==t||(c=!1),c&&(this.diagnostics={runnable:_,material:i,programLog:g,vertexShader:{log:h,prefix:f},fragmentShader:{log:t,prefix:m}}),o.deleteShader(r),o.deleteShader(y),this.getUniforms=function(){return b=void 0===b?new Ie(o,x,e):b},this.getAttributes=function(){return w=void 0===w?((e,t)=>{for(var n={},i=e.getProgramParameter(t,e.ACTIVE_ATTRIBUTES),r=0;r<i;r++){var a=e.getActiveAttrib(t,r).name;n[a]=e.getAttribLocation(t,a)}return n})(o,x):w},this.destroy=function(){o.deleteProgram(x),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=Cl++,this.code=n,this.usedTimes=1,this.program=x,this.vertexShader=r,this.fragmentShader=y,this}function Rt(u,c,d){var l=[],p={MeshDepthMaterial:"depth",MeshDistanceMaterial:"distanceRGBA",MeshNormalMaterial:"normal",MeshBasicMaterial:"basic",MeshLambertMaterial:"lambert",MeshPhongMaterial:"phong",MeshToonMaterial:"phong",MeshStandardMaterial:"physical",MeshPhysicalMaterial:"physical",LineBasicMaterial:"basic",LineDashedMaterial:"dashed",PointsMaterial:"points",ShadowMaterial:"shadow"},a=["precision","supportsVertexTextures","map","mapEncoding","envMap","envMapMode","envMapEncoding","lightMap","aoMap","emissiveMap","emissiveMapEncoding","bumpMap","normalMap","displacementMap","specularMap","roughnessMap","metalnessMap","gradientMap","alphaMap","combine","vertexColors","fog","useFog","fogExp","flatShading","sizeAttenuation","logarithmicDepthBuffer","skinning","maxBones","useVertexTexture","morphTargets","morphNormals","maxMorphTargets","maxMorphNormals","premultipliedAlpha","numDirLights","numPointLights","numSpotLights","numHemiLights","numRectAreaLights","shadowMapEnabled","shadowMapType","toneMapping","physicallyCorrectLights","alphaTest","doubleSided","flipSided","numClippingPlanes","numClipIntersection","depthPacking","dithering"];function f(e,t){var n;return e?e.isTexture?n=e.encoding:e.isWebGLRenderTarget&&(console.warn("THREE.WebGLPrograms.getTextureEncodingFromMap: don't use render targets as textures. Use their .texture property instead."),n=e.texture.encoding):n=ts,n=n===ts&&t?is:n}this.getParameters=function(e,t,n,i,r,a,o){var s=p[e.type],c=o.isSkinnedMesh?(c=o.skeleton.bones,d.floatVertexTextures?1024:(l=Math.floor((d.maxVertexUniforms-20)/4),(l=Math.min(l,c.length))<c.length?(console.warn("THREE.WebGLRenderer: Skeleton has "+c.length+" bones. This GPU supports "+l+"."),0):l)):0,l=d.precision,h=(null!==e.precision&&(l=d.getMaxPrecision(e.precision))!==e.precision&&console.warn("THREE.WebGLProgram.getParameters:",e.precision,"not supported, using",l,"instead."),u.getRenderTarget());return{shaderID:s,precision:l,supportsVertexTextures:d.vertexTextures,outputEncoding:f(h?h.texture:null,u.gammaOutput),map:!!e.map,mapEncoding:f(e.map,u.gammaInput),envMap:!!e.envMap,envMapMode:e.envMap&&e.envMap.mapping,envMapEncoding:f(e.envMap,u.gammaInput),envMapCubeUV:!!e.envMap&&(e.envMap.mapping===go||e.envMap.mapping===vo),lightMap:!!e.lightMap,aoMap:!!e.aoMap,emissiveMap:!!e.emissiveMap,emissiveMapEncoding:f(e.emissiveMap,u.gammaInput),bumpMap:!!e.bumpMap,normalMap:!!e.normalMap,displacementMap:!!e.displacementMap,roughnessMap:!!e.roughnessMap,metalnessMap:!!e.metalnessMap,specularMap:!!e.specularMap,alphaMap:!!e.alphaMap,gradientMap:!!e.gradientMap,combine:e.combine,vertexColors:e.vertexColors,fog:!!i,useFog:e.fog,fogExp:i&&i.isFogExp2,flatShading:e.flatShading,sizeAttenuation:e.sizeAttenuation,logarithmicDepthBuffer:d.logarithmicDepthBuffer,skinning:e.skinning&&0<c,maxBones:c,useVertexTexture:d.floatVertexTextures,morphTargets:e.morphTargets,morphNormals:e.morphNormals,maxMorphTargets:u.maxMorphTargets,maxMorphNormals:u.maxMorphNormals,numDirLights:t.directional.length,numPointLights:t.point.length,numSpotLights:t.spot.length,numRectAreaLights:t.rectArea.length,numHemiLights:t.hemi.length,numClippingPlanes:r,numClipIntersection:a,dithering:e.dithering,shadowMapEnabled:u.shadowMap.enabled&&o.receiveShadow&&0<n.length,shadowMapType:u.shadowMap.type,toneMapping:u.toneMapping,physicallyCorrectLights:u.physicallyCorrectLights,premultipliedAlpha:e.premultipliedAlpha,alphaTest:e.alphaTest,doubleSided:e.side===Ma,flipSided:e.side===Ta,depthPacking:void 0!==e.depthPacking&&e.depthPacking}},this.getProgramCode=function(e,t){var n=[];if(t.shaderID?n.push(t.shaderID):(n.push(e.fragmentShader),n.push(e.vertexShader)),void 0!==e.defines)for(var i in e.defines)n.push(i),n.push(e.defines[i]);for(var r=0;r<a.length;r++)n.push(t[a[r]]);return n.push(e.onBeforeCompile.toString()),n.push(u.gammaOutput),n.join()},this.acquireProgram=function(e,t,n,i){for(var r,a=0,o=l.length;a<o;a++){var s=l[a];if(s.code===i){++(r=s).usedTimes;break}}return void 0===r&&(r=new At(u,c,i,e,t,n),l.push(r)),r},this.releaseProgram=function(e){var t;0==--e.usedTimes&&(t=l.indexOf(e),l[t]=l[l.length-1],l.pop(),e.destroy())},this.programs=l}function Ct(f,i,m,g,v,y,x){var b="undefined"!=typeof WebGL2RenderingContext&&f instanceof window.WebGL2RenderingContext,w={};function _(e,t){var n;return e.width>t||e.height>t?(t=t/Math.max(e.width,e.height),(n=document.createElementNS("http://www.w3.org/1999/xhtml","canvas")).width=Math.floor(e.width*t),n.height=Math.floor(e.height*t),n.getContext("2d").drawImage(e,0,0,e.width,e.height,0,0,n.width,n.height),console.warn("THREE.WebGLRenderer: image is too big ("+e.width+"x"+e.height+"). Resized to "+n.width+"x"+n.height,e),n):e}function E(e){return Pe.isPowerOfTwo(e.width)&&Pe.isPowerOfTwo(e.height)}function T(e,t){return e.generateMipmaps&&t&&e.minFilter!==R&&e.minFilter!==C}function r(e){return e===R||e===bo||e===wo?f.NEAREST:f.LINEAR}function M(e){e=e.target;e.removeEventListener("dispose",M),(e=>{var t=g.get(e);if(e.image&&t.__image__webglTextureCube)f.deleteTexture(t.__image__webglTextureCube);else{if(void 0===t.__webglInit)return;f.deleteTexture(t.__webglTexture)}g.remove(e)})(e),e.isVideoTexture&&delete w[e.id],x.textures--}function l(e){var e=e.target,t=(e.removeEventListener("dispose",l),g.get(e)),n=g.get(e.texture);if(e){if(void 0!==n.__webglTexture&&f.deleteTexture(n.__webglTexture),e.depthTexture&&e.depthTexture.dispose(),e.isWebGLRenderTargetCube)for(var i=0;i<6;i++)f.deleteFramebuffer(t.__webglFramebuffer[i]),t.__webglDepthbuffer&&f.deleteRenderbuffer(t.__webglDepthbuffer[i]);else f.deleteFramebuffer(t.__webglFramebuffer),t.__webglDepthbuffer&&f.deleteRenderbuffer(t.__webglDepthbuffer);g.remove(e.texture),g.remove(e)}x.textures--}function h(e,t){var n=g.get(e);if(0<e.version&&n.__version!==e.version){var i=e.image;if(void 0===i)console.warn("THREE.WebGLRenderer: Texture marked for update but image is undefined",e);else{if(!1!==i.complete){i=n;var r=e;var a=t;void 0===i.__webglInit&&(i.__webglInit=!0,r.addEventListener("dispose",M),i.__webglTexture=f.createTexture(),r.isVideoTexture&&(w[r.id]=r),x.textures++),m.activeTexture(f.TEXTURE0+a),m.bindTexture(f.TEXTURE_2D,i.__webglTexture),f.pixelStorei(f.UNPACK_FLIP_Y_WEBGL,r.flipY),f.pixelStorei(f.UNPACK_PREMULTIPLY_ALPHA_WEBGL,r.premultiplyAlpha),f.pixelStorei(f.UNPACK_ALIGNMENT,r.unpackAlignment);var a=_(r.image,v.maxTextureSize),o=((r.wrapS!==A||r.wrapT!==A||r.minFilter!==R&&r.minFilter!==C)&&!1===E(a)&&(a=(u=a)instanceof HTMLImageElement||u instanceof HTMLCanvasElement||u instanceof ImageBitmap?((o=document.createElementNS("http://www.w3.org/1999/xhtml","canvas")).width=Pe.floorPowerOfTwo(u.width),o.height=Pe.floorPowerOfTwo(u.height),o.getContext("2d").drawImage(u,0,0,o.width,o.height),o):u),E(a)),s=y.convert(r.format),c=y.convert(r.type);S(f.TEXTURE_2D,r,o);var l,h=r.mipmaps;if(r.isDepthTexture){var u=f.DEPTH_COMPONENT;if(r.type===Lo){if(!b)throw new Error("Float Depth Texture only supported in WebGL2.0");u=f.DEPTH_COMPONENT32F}else b&&(u=f.DEPTH_COMPONENT16);r.format===Go&&u===f.DEPTH_COMPONENT&&r.type!==Ao&&r.type!==Co&&(console.warn("THREE.WebGLRenderer: Use UnsignedShortType or UnsignedIntType for DepthFormat DepthTexture."),r.type=Ao,c=y.convert(r.type)),r.format===Vo&&(u=f.DEPTH_STENCIL,r.type!==Uo)&&(console.warn("THREE.WebGLRenderer: Use UnsignedInt248Type for DepthStencilFormat DepthTexture."),r.type=Uo,c=y.convert(r.type)),m.texImage2D(f.TEXTURE_2D,0,u,a.width,a.height,0,s,c,null)}else if(r.isDataTexture)if(0<h.length&&o){for(var d=0,p=h.length;d<p;d++)l=h[d],m.texImage2D(f.TEXTURE_2D,d,s,l.width,l.height,0,s,c,l.data);r.generateMipmaps=!1}else m.texImage2D(f.TEXTURE_2D,0,s,a.width,a.height,0,s,c,a.data);else if(r.isCompressedTexture)for(d=0,p=h.length;d<p;d++)l=h[d],r.format!==Bo&&r.format!==Fo?-1<m.getCompressedTextureFormats().indexOf(s)?m.compressedTexImage2D(f.TEXTURE_2D,d,s,l.width,l.height,0,l.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()"):m.texImage2D(f.TEXTURE_2D,d,s,l.width,l.height,0,s,c,l.data);else if(0<h.length&&o){for(d=0,p=h.length;d<p;d++)l=h[d],m.texImage2D(f.TEXTURE_2D,d,s,s,c,l);r.generateMipmaps=!1}else m.texImage2D(f.TEXTURE_2D,0,s,s,c,a);T(r,o)&&f.generateMipmap(f.TEXTURE_2D),i.__version=r.version,r.onUpdate&&r.onUpdate(r);return}console.warn("THREE.WebGLRenderer: Texture marked for update but image is incomplete",e)}}m.activeTexture(f.TEXTURE0+t),m.bindTexture(f.TEXTURE_2D,n.__webglTexture)}function S(e,t,n){n?(f.texParameteri(e,f.TEXTURE_WRAP_S,y.convert(t.wrapS)),f.texParameteri(e,f.TEXTURE_WRAP_T,y.convert(t.wrapT)),f.texParameteri(e,f.TEXTURE_MAG_FILTER,y.convert(t.magFilter)),f.texParameteri(e,f.TEXTURE_MIN_FILTER,y.convert(t.minFilter))):(f.texParameteri(e,f.TEXTURE_WRAP_S,f.CLAMP_TO_EDGE),f.texParameteri(e,f.TEXTURE_WRAP_T,f.CLAMP_TO_EDGE),t.wrapS===A&&t.wrapT===A||console.warn("THREE.WebGLRenderer: Texture is not power of two. Texture.wrapS and Texture.wrapT should be set to THREE.ClampToEdgeWrapping.",t),f.texParameteri(e,f.TEXTURE_MAG_FILTER,r(t.magFilter)),f.texParameteri(e,f.TEXTURE_MIN_FILTER,r(t.minFilter)),t.minFilter!==R&&t.minFilter!==C&&console.warn("THREE.WebGLRenderer: Texture is not power of two. Texture.minFilter should be set to THREE.NearestFilter or THREE.LinearFilter.",t)),!(n=i.get("EXT_texture_filter_anisotropic"))||t.type===Lo&&null===i.get("OES_texture_float_linear")||t.type===Po&&null===i.get("OES_texture_half_float_linear")||(1<t.anisotropy||g.get(t).__currentAnisotropy)&&(f.texParameterf(e,n.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(t.anisotropy,v.getMaxAnisotropy())),g.get(t).__currentAnisotropy=t.anisotropy)}function u(e,t,n,i){var r=y.convert(t.texture.format),a=y.convert(t.texture.type);m.texImage2D(i,0,r,t.width,t.height,0,r,a,null),f.bindFramebuffer(f.FRAMEBUFFER,e),f.framebufferTexture2D(f.FRAMEBUFFER,n,i,g.get(t.texture).__webglTexture,0),f.bindFramebuffer(f.FRAMEBUFFER,null)}function d(e,t){f.bindRenderbuffer(f.RENDERBUFFER,e),t.depthBuffer&&!t.stencilBuffer?(f.renderbufferStorage(f.RENDERBUFFER,f.DEPTH_COMPONENT16,t.width,t.height),f.framebufferRenderbuffer(f.FRAMEBUFFER,f.DEPTH_ATTACHMENT,f.RENDERBUFFER,e)):t.depthBuffer&&t.stencilBuffer?(f.renderbufferStorage(f.RENDERBUFFER,f.DEPTH_STENCIL,t.width,t.height),f.framebufferRenderbuffer(f.FRAMEBUFFER,f.DEPTH_STENCIL_ATTACHMENT,f.RENDERBUFFER,e)):f.renderbufferStorage(f.RENDERBUFFER,f.RGBA4,t.width,t.height),f.bindRenderbuffer(f.RENDERBUFFER,null)}this.setTexture2D=h,this.setTextureCube=function(e,t){var n=g.get(e);if(6===e.image.length)if(0<e.version&&n.__version!==e.version){n.__image__webglTextureCube||(e.addEventListener("dispose",M),n.__image__webglTextureCube=f.createTexture(),x.textures++),m.activeTexture(f.TEXTURE0+t),m.bindTexture(f.TEXTURE_CUBE_MAP,n.__image__webglTextureCube),f.pixelStorei(f.UNPACK_FLIP_Y_WEBGL,e.flipY);for(var i=e&&e.isCompressedTexture,r=e.image[0]&&e.image[0].isDataTexture,a=[],o=0;o<6;o++)a[o]=i||r?r?e.image[o].image:e.image[o]:_(e.image[o],v.maxCubemapSize);var s=E(a[0]),c=y.convert(e.format),l=y.convert(e.type);S(f.TEXTURE_CUBE_MAP,e,s);for(o=0;o<6;o++)if(i)for(var h,u=a[o].mipmaps,d=0,p=u.length;d<p;d++)h=u[d],e.format!==Bo&&e.format!==Fo?-1<m.getCompressedTextureFormats().indexOf(c)?m.compressedTexImage2D(f.TEXTURE_CUBE_MAP_POSITIVE_X+o,d,c,h.width,h.height,0,h.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .setTextureCube()"):m.texImage2D(f.TEXTURE_CUBE_MAP_POSITIVE_X+o,d,c,h.width,h.height,0,c,l,h.data);else r?m.texImage2D(f.TEXTURE_CUBE_MAP_POSITIVE_X+o,0,c,a[o].width,a[o].height,0,c,l,a[o].data):m.texImage2D(f.TEXTURE_CUBE_MAP_POSITIVE_X+o,0,c,c,l,a[o]);T(e,s)&&f.generateMipmap(f.TEXTURE_CUBE_MAP),n.__version=e.version,e.onUpdate&&e.onUpdate(e)}else m.activeTexture(f.TEXTURE0+t),m.bindTexture(f.TEXTURE_CUBE_MAP,n.__image__webglTextureCube)},this.setTextureCubeDynamic=function(e,t){m.activeTexture(f.TEXTURE0+t),m.bindTexture(f.TEXTURE_CUBE_MAP,g.get(e).__webglTexture)},this.setupRenderTarget=function(e){var t=g.get(e),n=g.get(e.texture),i=(e.addEventListener("dispose",l),n.__webglTexture=f.createTexture(),x.textures++,!0===e.isWebGLRenderTargetCube),r=E(e);if(i){t.__webglFramebuffer=[];for(var a=0;a<6;a++)t.__webglFramebuffer[a]=f.createFramebuffer()}else t.__webglFramebuffer=f.createFramebuffer();if(i){m.bindTexture(f.TEXTURE_CUBE_MAP,n.__webglTexture),S(f.TEXTURE_CUBE_MAP,e.texture,r);for(a=0;a<6;a++)u(t.__webglFramebuffer[a],e,f.COLOR_ATTACHMENT0,f.TEXTURE_CUBE_MAP_POSITIVE_X+a);T(e.texture,r)&&f.generateMipmap(f.TEXTURE_CUBE_MAP),m.bindTexture(f.TEXTURE_CUBE_MAP,null)}else m.bindTexture(f.TEXTURE_2D,n.__webglTexture),S(f.TEXTURE_2D,e.texture,r),u(t.__webglFramebuffer,e,f.COLOR_ATTACHMENT0,f.TEXTURE_2D),T(e.texture,r)&&f.generateMipmap(f.TEXTURE_2D),m.bindTexture(f.TEXTURE_2D,null);if(e.depthBuffer){var o=e,s=g.get(o),i=!0===o.isWebGLRenderTargetCube;if(o.depthTexture){if(i)throw new Error("target.depthTexture not supported in Cube render targets");n=s.__webglFramebuffer,r=o;if(r&&r.isWebGLRenderTargetCube)throw new Error("Depth Texture with cube render targets is not supported");if(f.bindFramebuffer(f.FRAMEBUFFER,n),!r.depthTexture||!r.depthTexture.isDepthTexture)throw new Error("renderTarget.depthTexture must be an instance of THREE.DepthTexture");if(g.get(r.depthTexture).__webglTexture&&r.depthTexture.image.width===r.width&&r.depthTexture.image.height===r.height||(r.depthTexture.image.width=r.width,r.depthTexture.image.height=r.height,r.depthTexture.needsUpdate=!0),h(r.depthTexture,0),n=g.get(r.depthTexture).__webglTexture,r.depthTexture.format===Go)f.framebufferTexture2D(f.FRAMEBUFFER,f.DEPTH_ATTACHMENT,f.TEXTURE_2D,n,0);else{if(r.depthTexture.format!==Vo)throw new Error("Unknown depthTexture format");f.framebufferTexture2D(f.FRAMEBUFFER,f.DEPTH_STENCIL_ATTACHMENT,f.TEXTURE_2D,n,0)}}else if(i){s.__webglDepthbuffer=[];for(var c=0;c<6;c++)f.bindFramebuffer(f.FRAMEBUFFER,s.__webglFramebuffer[c]),s.__webglDepthbuffer[c]=f.createRenderbuffer(),d(s.__webglDepthbuffer[c],o)}else f.bindFramebuffer(f.FRAMEBUFFER,s.__webglFramebuffer),s.__webglDepthbuffer=f.createRenderbuffer(),d(s.__webglDepthbuffer,o);f.bindFramebuffer(f.FRAMEBUFFER,null)}},this.updateRenderTargetMipmap=function(e){var t=e.texture;T(t,E(e))&&(e=e.isWebGLRenderTargetCube?f.TEXTURE_CUBE_MAP:f.TEXTURE_2D,t=g.get(t).__webglTexture,m.bindTexture(e,t),f.generateMipmap(e),m.bindTexture(e,null))},this.updateVideoTextures=function(){for(var e in w)w[e].update()}}function Lt(){var n={};return{get:function(e){var e=e.uuid,t=n[e];return void 0===t&&(n[e]=t={}),t},remove:function(e){delete n[e.uuid]},clear:function(){n={}}}}function Pt(h,n,c){var i=new function(){var t=!1,a=new Le,n=null,o=new Le(0,0,0,0);return{setMask:function(e){n===e||t||(h.colorMask(e,e,e,e),n=e)},setLocked:function(e){t=e},setClear:function(e,t,n,i,r){!0===r&&(e*=i,t*=i,n*=i),a.set(e,t,n,i),!1===o.equals(a)&&(h.clearColor(e,t,n,i),o.copy(a))},reset:function(){t=!1,n=null,o.set(-1,0,0,0)}}},r=new function(){var t=!1,n=null,i=null,r=null;return{setTest:function(e){(e?N:O)(h.DEPTH_TEST)},setMask:function(e){n===e||t||(h.depthMask(e),n=e)},setFunc:function(e){if(i!==e){if(e)switch(e){case Ya:h.depthFunc(h.NEVER);break;case Za:h.depthFunc(h.ALWAYS);break;case Ja:h.depthFunc(h.LESS);break;case Ka:h.depthFunc(h.LEQUAL);break;case Qa:h.depthFunc(h.EQUAL);break;case $a:h.depthFunc(h.GEQUAL);break;case eo:h.depthFunc(h.GREATER);break;case to:h.depthFunc(h.NOTEQUAL);break;default:h.depthFunc(h.LEQUAL)}else h.depthFunc(h.LEQUAL);i=e}},setLocked:function(e){t=e},setClear:function(e){r!==e&&(h.clearDepth(e),r=e)},reset:function(){t=!1,r=i=n=null}}},t=new function(){var t=!1,n=null,i=null,r=null,a=null,o=null,s=null,c=null,l=null;return{setTest:function(e){(e?N:O)(h.STENCIL_TEST)},setMask:function(e){n===e||t||(h.stencilMask(e),n=e)},setFunc:function(e,t,n){i===e&&r===t&&a===n||(h.stencilFunc(e,t,n),i=e,r=t,a=n)},setOp:function(e,t,n){o===e&&s===t&&c===n||(h.stencilOp(e,t,n),o=e,s=t,c=n)},setLocked:function(e){t=e},setClear:function(e){l!==e&&(h.clearStencil(e),l=e)},reset:function(){t=!1,l=c=s=o=a=r=i=n=null}}},e=h.getParameter(h.MAX_VERTEX_ATTRIBS),a=new Uint8Array(e),o=new Uint8Array(e),s=new Uint8Array(e),l={},u=null,d=null,p=null,f=null,m=null,g=null,v=null,y=null,x=null,b=!1,w=null,_=null,E=null,T=null,M=null,D=h.getParameter(h.MAX_COMBINED_TEXTURE_IMAGE_UNITS),e=parseFloat(/^WebGL\ ([0-9])/.exec(h.getParameter(h.VERSION))[1]),F=1<=parseFloat(e),S=null,A={},R=new Le,C=new Le;function L(e,t,n){var i=new Uint8Array(4),r=h.createTexture();h.bindTexture(e,r),h.texParameteri(e,h.TEXTURE_MIN_FILTER,h.NEAREST),h.texParameteri(e,h.TEXTURE_MAG_FILTER,h.NEAREST);for(var a=0;a<n;a++)h.texImage2D(t+a,0,h.RGBA,1,1,0,h.RGBA,h.UNSIGNED_BYTE,i);return r}var P={};function N(e){!0!==l[e]&&(h.enable(e),l[e]=!0)}function O(e){!1!==l[e]&&(h.disable(e),l[e]=!1)}function I(e,t,n,i,r,a,o,s){if((e!==Sa?N:O)(h.BLEND),e!==Pa){if(e!==p||s!==b)switch(e){case Ra:s?(h.blendEquationSeparate(h.FUNC_ADD,h.FUNC_ADD),h.blendFuncSeparate(h.ONE,h.ONE,h.ONE,h.ONE)):(h.blendEquation(h.FUNC_ADD),h.blendFunc(h.SRC_ALPHA,h.ONE));break;case Ca:s?(h.blendEquationSeparate(h.FUNC_ADD,h.FUNC_ADD),h.blendFuncSeparate(h.ZERO,h.ZERO,h.ONE_MINUS_SRC_COLOR,h.ONE_MINUS_SRC_ALPHA)):(h.blendEquation(h.FUNC_ADD),h.blendFunc(h.ZERO,h.ONE_MINUS_SRC_COLOR));break;case La:s?(h.blendEquationSeparate(h.FUNC_ADD,h.FUNC_ADD),h.blendFuncSeparate(h.ZERO,h.SRC_COLOR,h.ZERO,h.SRC_ALPHA)):(h.blendEquation(h.FUNC_ADD),h.blendFunc(h.ZERO,h.SRC_COLOR));break;default:s?(h.blendEquationSeparate(h.FUNC_ADD,h.FUNC_ADD),h.blendFuncSeparate(h.ONE,h.ONE_MINUS_SRC_ALPHA,h.ONE,h.ONE_MINUS_SRC_ALPHA)):(h.blendEquationSeparate(h.FUNC_ADD,h.FUNC_ADD),h.blendFuncSeparate(h.SRC_ALPHA,h.ONE_MINUS_SRC_ALPHA,h.ONE,h.ONE_MINUS_SRC_ALPHA))}x=y=v=g=m=f=null}else r=r||t,a=a||n,o=o||i,t===f&&r===v||(h.blendEquationSeparate(c.convert(t),c.convert(r)),f=t,v=r),n===m&&i===g&&a===y&&o===x||(h.blendFuncSeparate(c.convert(n),c.convert(i),c.convert(a),c.convert(o)),m=n,g=i,y=a,x=o);p=e,b=s}function U(e){w!==e&&(e?h.frontFace(h.CW):h.frontFace(h.CCW),w=e)}function B(e){e!==ya?(N(h.CULL_FACE),e!==_&&(e===xa?h.cullFace(h.BACK):e===ba?h.cullFace(h.FRONT):h.cullFace(h.FRONT_AND_BACK))):O(h.CULL_FACE),_=e}function k(e,t,n){e?(N(h.POLYGON_OFFSET_FILL),T===t&&M===n||(h.polygonOffset(t,n),T=t,M=n)):O(h.POLYGON_OFFSET_FILL)}function H(e){void 0===e&&(e=h.TEXTURE0+D-1),S!==e&&(h.activeTexture(e),S=e)}return P[h.TEXTURE_2D]=L(h.TEXTURE_2D,h.TEXTURE_2D,1),P[h.TEXTURE_CUBE_MAP]=L(h.TEXTURE_CUBE_MAP,h.TEXTURE_CUBE_MAP_POSITIVE_X,6),i.setClear(0,0,0,1),r.setClear(1),t.setClear(0),N(h.DEPTH_TEST),r.setFunc(Ka),U(!1),B(xa),N(h.CULL_FACE),N(h.BLEND),I(Aa),{buffers:{color:i,depth:r,stencil:t},initAttributes:function(){for(var e=0,t=a.length;e<t;e++)a[e]=0},enableAttribute:function(e){a[e]=1,0===o[e]&&(h.enableVertexAttribArray(e),o[e]=1),0!==s[e]&&(n.get("ANGLE_instanced_arrays").vertexAttribDivisorANGLE(e,0),s[e]=0)},enableAttributeAndDivisor:function(e,t){a[e]=1,0===o[e]&&(h.enableVertexAttribArray(e),o[e]=1),s[e]!==t&&(n.get("ANGLE_instanced_arrays").vertexAttribDivisorANGLE(e,t),s[e]=t)},disableUnusedAttributes:function(){for(var e=0,t=o.length;e!==t;++e)o[e]!==a[e]&&(h.disableVertexAttribArray(e),o[e]=0)},enable:N,disable:O,getCompressedTextureFormats:function(){if(null===u&&(u=[],n.get("WEBGL_compressed_texture_pvrtc")||n.get("WEBGL_compressed_texture_s3tc")||n.get("WEBGL_compressed_texture_etc1")))for(var e=h.getParameter(h.COMPRESSED_TEXTURE_FORMATS),t=0;t<e.length;t++)u.push(e[t]);return u},useProgram:function(e){return d!==e&&(h.useProgram(e),d=e,!0)},setBlending:I,setMaterial:function(e,t){(e.side===Ma?O:N)(h.CULL_FACE);var n=e.side===Ta;U(n=t?!n:n),!0===e.transparent?I(e.blending,e.blendEquation,e.blendSrc,e.blendDst,e.blendEquationAlpha,e.blendSrcAlpha,e.blendDstAlpha,e.premultipliedAlpha):I(Sa),r.setFunc(e.depthFunc),r.setTest(e.depthTest),r.setMask(e.depthWrite),i.setMask(e.colorWrite),k(e.polygonOffset,e.polygonOffsetFactor,e.polygonOffsetUnits)},setFlipSided:U,setCullFace:B,setLineWidth:function(e){e!==E&&(F&&h.lineWidth(e),E=e)},setPolygonOffset:k,setScissorTest:function(e){(e?N:O)(h.SCISSOR_TEST)},activeTexture:H,bindTexture:function(e,t){null===S&&H();var n=A[S];void 0===n&&(A[S]=n={type:void 0,texture:void 0}),n.type===e&&n.texture===t||(h.bindTexture(e,t||P[e]),n.type=e,n.texture=t)},compressedTexImage2D:function(){try{h.compressedTexImage2D.apply(h,arguments)}catch(e){console.error("THREE.WebGLState:",e)}},texImage2D:function(){try{h.texImage2D.apply(h,arguments)}catch(e){console.error("THREE.WebGLState:",e)}},scissor:function(e){!1===R.equals(e)&&(h.scissor(e.x,e.y,e.z,e.w),R.copy(e))},viewport:function(e){!1===C.equals(e)&&(h.viewport(e.x,e.y,e.z,e.w),C.copy(e))},reset:function(){for(var e=0;e<o.length;e++)1===o[e]&&(h.disableVertexAttribArray(e),o[e]=0);l={},A={},_=w=p=d=S=u=null,i.reset(),r.reset(),t.reset()}}}function Nt(t,n,e){var i;function r(e){if("highp"===e){if(0<t.getShaderPrecisionFormat(t.VERTEX_SHADER,t.HIGH_FLOAT).precision&&0<t.getShaderPrecisionFormat(t.FRAGMENT_SHADER,t.HIGH_FLOAT).precision)return"highp";e="mediump"}return"mediump"===e&&0<t.getShaderPrecisionFormat(t.VERTEX_SHADER,t.MEDIUM_FLOAT).precision&&0<t.getShaderPrecisionFormat(t.FRAGMENT_SHADER,t.MEDIUM_FLOAT).precision?"mediump":"lowp"}var a=void 0!==e.precision?e.precision:"highp",o=r(a),o=(o!==a&&(console.warn("THREE.WebGLRenderer:",a,"not supported, using",o,"instead."),a=o),!0===e.logarithmicDepthBuffer),e=t.getParameter(t.MAX_TEXTURE_IMAGE_UNITS),s=t.getParameter(t.MAX_VERTEX_TEXTURE_IMAGE_UNITS),c=t.getParameter(t.MAX_TEXTURE_SIZE),l=t.getParameter(t.MAX_CUBE_MAP_TEXTURE_SIZE),h=t.getParameter(t.MAX_VERTEX_ATTRIBS),u=t.getParameter(t.MAX_VERTEX_UNIFORM_VECTORS),d=t.getParameter(t.MAX_VARYING_VECTORS),p=t.getParameter(t.MAX_FRAGMENT_UNIFORM_VECTORS),f=0<s,m=!!n.get("OES_texture_float");return{getMaxAnisotropy:function(){var e;return void 0!==i?i:(e=n.get("EXT_texture_filter_anisotropic"),i=null!==e?t.getParameter(e.MAX_TEXTURE_MAX_ANISOTROPY_EXT):0)},getMaxPrecision:r,precision:a,logarithmicDepthBuffer:o,maxTextures:e,maxVertexTextures:s,maxTextureSize:c,maxCubemapSize:l,maxAttributes:h,maxVertexUniforms:u,maxVaryings:d,maxFragmentUniforms:p,vertexTextures:f,floatFragmentTextures:m,floatVertexTextures:f&&m}}function g(e,t,n,i){Te.call(this),this.type="PerspectiveCamera",this.fov=void 0!==e?e: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!==t?t:1,this.view=null,this.filmGauge=35,this.filmOffset=0,this.updateProjectionMatrix()}function Ot(e){g.call(this),this.cameras=e||[]}function It(n){var i=this,r=null,a=null,o=null,s=("undefined"!=typeof window&&"VRFrameData"in window&&(a=new window.VRFrameData),new Re),c=new g,l=(c.bounds=new Le(0,0,.5,1),c.layers.enable(1),new g);l.bounds=new Le(.5,0,.5,1),l.layers.enable(2);var h,u,d=new Ot([c,l]);function e(){var e,t;null!==r&&r.isPresenting?(e=(t=r.getEyeParameters("left")).renderWidth,t=t.renderHeight,u=n.getPixelRatio(),h=n.getSize(),n.setDrawingBufferSize(2*e,t,1)):i.enabled&&n.setDrawingBufferSize(h.width,h.height,u)}d.layers.enable(1),d.layers.enable(2),"undefined"!=typeof window&&window.addEventListener("vrdisplaypresentchange",e,!1),this.enabled=!1,this.getDevice=function(){return r},this.setDevice=function(e){void 0!==e&&(r=e)},this.setPoseTarget=function(e){void 0!==e&&(o=e)},this.getCamera=function(e){if(null===r)return e;r.depthNear=e.near,r.depthFar=e.far,r.getFrameData(a);var t=a.pose,n=null!==o?o:e;if(null!==t.position?n.position.fromArray(t.position):n.position.set(0,0,0),null!==t.orientation&&n.quaternion.fromArray(t.orientation),n.updateMatrixWorld(),!1===r.isPresenting)return e;c.near=e.near,l.near=e.near,c.far=e.far,l.far=e.far,d.matrixWorld.copy(e.matrixWorld),d.matrixWorldInverse.copy(e.matrixWorldInverse),c.matrixWorldInverse.fromArray(a.leftViewMatrix),l.matrixWorldInverse.fromArray(a.rightViewMatrix);t=n.parent,null!==t&&(s.getInverse(t.matrixWorld),c.matrixWorldInverse.multiply(s),l.matrixWorldInverse.multiply(s)),c.matrixWorld.getInverse(c.matrixWorldInverse),l.matrixWorld.getInverse(l.matrixWorldInverse),c.projectionMatrix.fromArray(a.leftProjectionMatrix),l.projectionMatrix.fromArray(a.rightProjectionMatrix),d.projectionMatrix.copy(c.projectionMatrix),e=r.getLayers();return e.length&&(null!==(n=e[0]).leftBounds&&4===n.leftBounds.length&&c.bounds.fromArray(n.leftBounds),null!==n.rightBounds)&&4===n.rightBounds.length&&l.bounds.fromArray(n.rightBounds),d},this.submitFrame=function(){r&&r.isPresenting&&r.submitFrame()},this.dispose=function(){"undefined"!=typeof window&&window.removeEventListener("vrdisplaypresentchange",e)}}function Ut(n){var i={};return{get:function(e){if(void 0!==i[e])return i[e];var t;switch(e){case"WEBGL_depth_texture":t=n.getExtension("WEBGL_depth_texture")||n.getExtension("MOZ_WEBGL_depth_texture")||n.getExtension("WEBKIT_WEBGL_depth_texture");break;case"EXT_texture_filter_anisotropic":t=n.getExtension("EXT_texture_filter_anisotropic")||n.getExtension("MOZ_EXT_texture_filter_anisotropic")||n.getExtension("WEBKIT_EXT_texture_filter_anisotropic");break;case"WEBGL_compressed_texture_s3tc":t=n.getExtension("WEBGL_compressed_texture_s3tc")||n.getExtension("MOZ_WEBGL_compressed_texture_s3tc")||n.getExtension("WEBKIT_WEBGL_compressed_texture_s3tc");break;case"WEBGL_compressed_texture_pvrtc":t=n.getExtension("WEBGL_compressed_texture_pvrtc")||n.getExtension("WEBKIT_WEBGL_compressed_texture_pvrtc");break;case"WEBGL_compressed_texture_etc1":t=n.getExtension("WEBGL_compressed_texture_etc1");break;default:t=n.getExtension(e)}return null===t&&console.warn("THREE.WebGLRenderer: "+e+" extension not supported."),i[e]=t}}}function Dt(){var l=this,h=null,u=0,d=!1,p=!1,f=new be,m=new S,g={value:null,needsUpdate:!1};function v(){g.value!==h&&(g.value=h,g.needsUpdate=0<u),l.numPlanes=u,l.numIntersection=0}function y(e,t,n,i){var r=null!==e?e.length:0,a=null;if(0!==r){if(a=g.value,!0!==i||null===a){var i=n+4*r,o=t.matrixWorldInverse;m.getNormalMatrix(o),(null===a||a.length<i)&&(a=new Float32Array(i));for(var s=0,c=n;s!==r;++s,c+=4)f.copy(e[s]).applyMatrix4(o,m),f.normal.toArray(a,c),a[c+3]=f.constant}g.value=a,g.needsUpdate=!0}return l.numPlanes=r,a}this.uniform=g,this.numPlanes=0,this.numIntersection=0,this.init=function(e,t,n){var i=0!==e.length||t||0!==u||d;return d=t,h=y(e,n,0),u=e.length,i},this.beginShadows=function(){p=!0,y(null)},this.endShadows=function(){p=!1,v()},this.setState=function(e,t,n,i,r,a){if(!d||null===e||0===e.length||p&&!n)p?y(null):v();else{var n=p?0:u,o=4*n,s=r.clippingState||null;g.value=s;for(var s=y(e,i,o,a),c=0;c!==o;++c)s[c]=h[c];r.clippingState=s,this.numIntersection=t?this.numPlanes:0,this.numPlanes+=n}}}function Ft(n,i){return{convert:function(e){var t;if(e===yo)return n.REPEAT;if(e===A)return n.CLAMP_TO_EDGE;if(e===xo)return n.MIRRORED_REPEAT;if(e===R)return n.NEAREST;if(e===bo)return n.NEAREST_MIPMAP_NEAREST;if(e===wo)return n.NEAREST_MIPMAP_LINEAR;if(e===C)return n.LINEAR;if(e===_o)return n.LINEAR_MIPMAP_NEAREST;if(e===Eo)return n.LINEAR_MIPMAP_LINEAR;if(e===To)return n.UNSIGNED_BYTE;if(e===No)return n.UNSIGNED_SHORT_4_4_4_4;if(e===Oo)return n.UNSIGNED_SHORT_5_5_5_1;if(e===Io)return n.UNSIGNED_SHORT_5_6_5;if(e===Mo)return n.BYTE;if(e===So)return n.SHORT;if(e===Ao)return n.UNSIGNED_SHORT;if(e===Ro)return n.INT;if(e===Co)return n.UNSIGNED_INT;if(e===Lo)return n.FLOAT;if(e===Po&&null!==(t=i.get("OES_texture_half_float")))return t.HALF_FLOAT_OES;if(e===Do)return n.ALPHA;if(e===Fo)return n.RGB;if(e===Bo)return n.RGBA;if(e===ko)return n.LUMINANCE;if(e===Ho)return n.LUMINANCE_ALPHA;if(e===Go)return n.DEPTH_COMPONENT;if(e===Vo)return n.DEPTH_STENCIL;if(e===Na)return n.FUNC_ADD;if(e===Oa)return n.FUNC_SUBTRACT;if(e===Ia)return n.FUNC_REVERSE_SUBTRACT;if(e===Fa)return n.ZERO;if(e===Ba)return n.ONE;if(e===ka)return n.SRC_COLOR;if(e===Ha)return n.ONE_MINUS_SRC_COLOR;if(e===za)return n.SRC_ALPHA;if(e===Ga)return n.ONE_MINUS_SRC_ALPHA;if(e===Va)return n.DST_ALPHA;if(e===ja)return n.ONE_MINUS_DST_ALPHA;if(e===Wa)return n.DST_COLOR;if(e===Xa)return n.ONE_MINUS_DST_COLOR;if(e===qa)return n.SRC_ALPHA_SATURATE;if((e===jo||e===Wo||e===Xo||e===qo)&&null!==(t=i.get("WEBGL_compressed_texture_s3tc"))){if(e===jo)return t.COMPRESSED_RGB_S3TC_DXT1_EXT;if(e===Wo)return t.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(e===Xo)return t.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(e===qo)return t.COMPRESSED_RGBA_S3TC_DXT5_EXT}if((e===Yo||e===Zo||e===Jo||e===Ko)&&null!==(t=i.get("WEBGL_compressed_texture_pvrtc"))){if(e===Yo)return t.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(e===Zo)return t.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(e===Jo)return t.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(e===Ko)return t.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}if(e===Qo&&null!==(t=i.get("WEBGL_compressed_texture_etc1")))return t.COMPRESSED_RGB_ETC1_WEBGL;if((e===Ua||e===Da)&&null!==(t=i.get("EXT_blend_minmax"))){if(e===Ua)return t.MIN_EXT;if(e===Da)return t.MAX_EXT}return e===Uo&&null!==(t=i.get("WEBGL_depth_texture"))?t.UNSIGNED_INT_24_8_WEBGL:0}}}function Bt(e){var r=void 0!==(e=e||{}).canvas?e.canvas:document.createElementNS("http://www.w3.org/1999/xhtml","canvas"),t=void 0!==e.context?e.context:null,n=void 0!==e.alpha&&e.alpha,i=void 0===e.depth||e.depth,k=void 0===e.stencil||e.stencil,H=void 0!==e.antialias&&e.antialias,z=void 0===e.premultipliedAlpha||e.premultipliedAlpha,G=void 0!==e.preserveDrawingBuffer&&e.preserveDrawingBuffer,V=void 0!==e.powerPreference?e.powerPreference:"default",d=[],p=[],f=null,j=[],W=[];this.domElement=r,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=oo,this.toneMappingExposure=1,this.toneMappingWhitePoint=1,this.maxMorphTargets=8,this.maxMorphNormals=4;var x,b,m,w,g,o,_,u,X,v,l,s,c,q,Y,Z,J,K,y,E=this,Q=!1,$=null,T=null,M=-1,S="",A=null,R=null,C=new Le,a=new Le,ee=null,te=0,L=r.width,P=r.height,N=1,h=new Le(0,0,L,P),O=new Le(0,0,L,P),ne=!1,ie=new Fe,I=new Dt,re=!1,ae=!1,oe=new Re,U=new Ce,se={geometries:0,textures:0},D={frame:0,calls:0,vertices:0,faces:0,points:0};function ce(){return null===$?N:1}this.info={render:D,memory:se,programs:null};try{var le={alpha:n,depth:i,stencil:k,antialias:H,premultipliedAlpha:z,preserveDrawingBuffer:G,powerPreference:V};if(r.addEventListener("webglcontextlost",de,!1),r.addEventListener("webglcontextrestored",pe,!1),null===(x=t||r.getContext("webgl",le)||r.getContext("experimental-webgl",le)))throw null!==r.getContext("webgl")?new Error("Error creating WebGL context with your selected attributes."):new Error("Error creating WebGL context.");void 0===x.getShaderPrecisionFormat&&(x.getShaderPrecisionFormat=function(){return{rangeMin:1,rangeMax:1,precision:1}})}catch(e){console.error("THREE.WebGLRenderer: "+e.message)}function he(){(b=new Ut(x)).get("WEBGL_depth_texture"),b.get("OES_texture_float"),b.get("OES_texture_float_linear"),b.get("OES_texture_half_float"),b.get("OES_texture_half_float_linear"),b.get("OES_standard_derivatives"),b.get("OES_element_index_uint"),b.get("ANGLE_instanced_arrays"),y=new Ft(x,b),m=new Nt(x,b,e),(w=new Pt(x,b,y)).scissor(a.copy(O).multiplyScalar(N)),w.viewport(C.copy(h).multiplyScalar(N)),g=new Lt,o=new Ct(x,b,w,g,m,y,se),_=new ke(x),u=new pt(x,_,se),X=new gt(u,D),q=new ht(x),l=new Rt(E,b,m),v=new mt,s=new ct,c=new rt(E,w,u,z),Y=new dt(x,b,D),Z=new ut(x,b,D),J=new Ue(0,x,w,o,m),K=new De(E,x,w,o,m),E.info.programs=l.programs,E.context=x,E.capabilities=m,E.extensions=b,E.properties=g,E.renderLists=s,E.state=w}he();var F=new It(E),ue=(this.vr=F,new Be(E,X,m.maxTextureSize));function de(e){e.preventDefault(),console.log("THREE.WebGLRenderer: Context Lost."),Q=!0}function pe(){console.log("THREE.WebGLRenderer: Context Restored."),Q=!1,he()}function fe(e){var e=e.target;e.removeEventListener("dispose",fe),me(e=e),g.remove(e)}function me(e){var t=g.get(e).program;(e.program=void 0)!==t&&l.releaseProgram(t)}this.shadowMap=ue,this.getContext=function(){return x},this.getContextAttributes=function(){return x.getContextAttributes()},this.forceContextLoss=function(){var e=b.get("WEBGL_lose_context");e&&e.loseContext()},this.forceContextRestore=function(){var e=b.get("WEBGL_lose_context");e&&e.restoreContext()},this.getPixelRatio=function(){return N},this.setPixelRatio=function(e){void 0!==e&&(N=e,this.setSize(L,P,!1))},this.getSize=function(){return{width:L,height:P}},this.setSize=function(e,t,n){var i=F.getDevice();i&&i.isPresenting?console.warn("THREE.WebGLRenderer: Can't change size while VR device is presenting."):(L=e,P=t,r.width=e*N,r.height=t*N,!1!==n&&(r.style.width=e+"px",r.style.height=t+"px"),this.setViewport(0,0,e,t))},this.getDrawingBufferSize=function(){return{width:L*N,height:P*N}},this.setDrawingBufferSize=function(e,t,n){L=e,P=t,N=n,r.width=e*n,r.height=t*n,this.setViewport(0,0,e,t)},this.setViewport=function(e,t,n,i){h.set(e,P-t-i,n,i),w.viewport(C.copy(h).multiplyScalar(N))},this.setScissor=function(e,t,n,i){O.set(e,P-t-i,n,i),w.scissor(a.copy(O).multiplyScalar(N))},this.setScissorTest=function(e){w.setScissorTest(ne=e)},this.getClearColor=function(){return c.getClearColor()},this.setClearColor=function(){c.setClearColor.apply(c,arguments)},this.getClearAlpha=function(){return c.getClearAlpha()},this.setClearAlpha=function(){c.setClearAlpha.apply(c,arguments)},this.clear=function(e,t,n){var i=0;void 0!==e&&!e||(i|=x.COLOR_BUFFER_BIT),void 0!==t&&!t||(i|=x.DEPTH_BUFFER_BIT),void 0!==n&&!n||(i|=x.STENCIL_BUFFER_BIT),x.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(e,t,n,i){this.setRenderTarget(e),this.clear(t,n,i)},this.dispose=function(){r.removeEventListener("webglcontextlost",de,!1),r.removeEventListener("webglcontextrestored",pe,!1),s.dispose(),F.dispose()},this.renderBufferImmediate=function(e,t,n){w.initAttributes();var i=g.get(e),t=(e.hasPositions&&!i.position&&(i.position=x.createBuffer()),e.hasNormals&&!i.normal&&(i.normal=x.createBuffer()),e.hasUvs&&!i.uv&&(i.uv=x.createBuffer()),e.hasColors&&!i.color&&(i.color=x.createBuffer()),t.getAttributes());if(e.hasPositions&&(x.bindBuffer(x.ARRAY_BUFFER,i.position),x.bufferData(x.ARRAY_BUFFER,e.positionArray,x.DYNAMIC_DRAW),w.enableAttribute(t.position),x.vertexAttribPointer(t.position,3,x.FLOAT,!1,0,0)),e.hasNormals){if(x.bindBuffer(x.ARRAY_BUFFER,i.normal),!n.isMeshPhongMaterial&&!n.isMeshStandardMaterial&&!n.isMeshNormalMaterial&&!0===n.flatShading)for(var r=0,a=3*e.count;r<a;r+=9){var o=e.normalArray,s=(o[r+0]+o[r+3]+o[r+6])/3,c=(o[r+1]+o[r+4]+o[r+7])/3,l=(o[r+2]+o[r+5]+o[r+8])/3;o[r+0]=s,o[r+1]=c,o[r+2]=l,o[r+3]=s,o[r+4]=c,o[r+5]=l,o[r+6]=s,o[r+7]=c,o[r+8]=l}x.bufferData(x.ARRAY_BUFFER,e.normalArray,x.DYNAMIC_DRAW),w.enableAttribute(t.normal),x.vertexAttribPointer(t.normal,3,x.FLOAT,!1,0,0)}e.hasUvs&&n.map&&(x.bindBuffer(x.ARRAY_BUFFER,i.uv),x.bufferData(x.ARRAY_BUFFER,e.uvArray,x.DYNAMIC_DRAW),w.enableAttribute(t.uv),x.vertexAttribPointer(t.uv,2,x.FLOAT,!1,0,0)),e.hasColors&&0!==n.vertexColors&&(x.bindBuffer(x.ARRAY_BUFFER,i.color),x.bufferData(x.ARRAY_BUFFER,e.colorArray,x.DYNAMIC_DRAW),w.enableAttribute(t.color),x.vertexAttribPointer(t.color,3,x.FLOAT,!1,0,0)),w.disableUnusedAttributes(),x.drawArrays(x.TRIANGLES,0,e.count),e.count=0},this.renderBufferDirect=function(e,t,n,i,r,a){var o=r.isMesh&&r.matrixWorld.determinant()<0,o=(w.setMaterial(i,o),Me(e,t,i,r)),e=n.id+"_"+o.id+"_"+(!0===i.wireframe),t=!1;e!==S&&(S=e,t=!0),r.morphTargetInfluences&&(q.update(r,n,i,o),t=!0);var e=n.index,s=n.attributes.position,c=1,l=(!0===i.wireframe&&(e=u.getWireframeAttribute(n),c=2),Y),t=(null!==e&&(h=_.get(e),(l=Z).setIndex(h)),t&&(((e,t,n,i)=>{if(n&&n.isInstancedBufferGeometry&&null===b.get("ANGLE_instanced_arrays"))console.error("THREE.WebGLRenderer.setupVertexAttributes: using THREE.InstancedBufferGeometry but hardware does not support extension ANGLE_instanced_arrays.");else{void 0===i&&(i=0),w.initAttributes();var r,a=n.attributes,o=t.getAttributes(),s=e.defaultAttributeValues;for(r in o){var c=o[r];if(0<=c){var l=a[r];if(void 0!==l){var h,u,d,p,f,m=l.normalized,g=l.itemSize,v=_.get(l);void 0!==v&&(h=v.buffer,u=v.type,v=v.bytesPerElement,l.isInterleavedBufferAttribute?(p=(d=l.data).stride,f=l.offset,d&&d.isInstancedInterleavedBuffer?(w.enableAttributeAndDivisor(c,d.meshPerAttribute),void 0===n.maxInstancedCount&&(n.maxInstancedCount=d.meshPerAttribute*d.count)):w.enableAttribute(c),x.bindBuffer(x.ARRAY_BUFFER,h),x.vertexAttribPointer(c,g,u,m,p*v,(i*p+f)*v)):(l.isInstancedBufferAttribute?(w.enableAttributeAndDivisor(c,l.meshPerAttribute),void 0===n.maxInstancedCount&&(n.maxInstancedCount=l.meshPerAttribute*l.count)):w.enableAttribute(c),x.bindBuffer(x.ARRAY_BUFFER,h),x.vertexAttribPointer(c,g,u,m,0,i*g*v)))}else if(void 0!==s){var y=s[r];if(void 0!==y)switch(y.length){case 2:x.vertexAttrib2fv(c,y);break;case 3:x.vertexAttrib3fv(c,y);break;case 4:x.vertexAttrib4fv(c,y);break;default:x.vertexAttrib1fv(c,y)}}}}w.disableUnusedAttributes()}})(i,o,n),null!==e)&&x.bindBuffer(x.ELEMENT_ARRAY_BUFFER,h.buffer),0),o=(null!==e?t=e.count:void 0!==s&&(t=s.count),n.drawRange.start*c),h=n.drawRange.count*c,e=null!==a?a.start*c:0,s=null!==a?a.count*c:1/0,a=Math.max(o,e),c=Math.min(t,o+h,e+s)-1,t=Math.max(0,c-a+1);if(0!==t){if(r.isMesh)if(!0===i.wireframe)w.setLineWidth(i.wireframeLinewidth*ce()),l.setMode(x.LINES);else switch(r.drawMode){case es:l.setMode(x.TRIANGLES);break;case 1:l.setMode(x.TRIANGLE_STRIP);break;case 2:l.setMode(x.TRIANGLE_FAN)}else r.isLine?(o=i.linewidth,w.setLineWidth((o=void 0===o?1:o)*ce()),r.isLineSegments?l.setMode(x.LINES):r.isLineLoop?l.setMode(x.LINE_LOOP):l.setMode(x.LINE_STRIP)):r.isPoints&&l.setMode(x.POINTS);n&&n.isInstancedBufferGeometry?0<n.maxInstancedCount&&l.renderInstances(n,a,t):l.render(a,t)}};var ge,ve,ye,xe=!(this.compile=function(n,e){d.length=0,p.length=0,n.traverse(function(e){e.isLight&&(d.push(e),e.castShadow)&&p.push(e)}),v.setup(d,p,e),n.traverse(function(e){if(e.material)if(Array.isArray(e.material))for(var t=0;t<e.material.length;t++)Te(e.material[t],n.fog,e);else Te(e.material,n.fog,e)})}),be=null;function we(e){null!==be&&be(e);e=F.getDevice();(e&&e.isPresenting?e:window).requestAnimationFrame(we)}function _e(e,t,n,i){for(var r=0,a=e.length;r<a;r++){var o=e[r],s=o.object,c=o.geometry,l=void 0===i?o.material:i,h=o.group;if(n.isArrayCamera)for(var u=(R=n).cameras,d=0,p=u.length;d<p;d++){var f,m,g,v,y=u[d];s.layers.test(y.layers)&&(f=(v=y.bounds).x*L,m=v.y*P,g=v.z*L,v=v.w*P,w.viewport(C.set(f,m,g,v).multiplyScalar(N)),Ee(s,t,y,c,l,h))}else R=null,Ee(s,t,n,c,l,h)}}function Ee(e,t,n,i,r,a){var o,s,c;e.onBeforeRender(E,t,n,i,r,a),e.modelViewMatrix.multiplyMatrices(n.matrixWorldInverse,e.matrixWorld),e.normalMatrix.getNormalMatrix(e.modelViewMatrix),e.isImmediateRenderObject?(o=e.isMesh&&e.matrixWorld.determinant()<0,w.setMaterial(r,o),o=Me(n,t.fog,r,e),S="",s=o,c=r,e.render(function(e){E.renderBufferImmediate(e,s,c)})):E.renderBufferDirect(n,t.fog,i,r,e,a),e.onAfterRender(E,t,n,i,r,a)}function Te(e,t,n){var i=g.get(e),n=l.getParameters(e,v.state,p,t,I.numPlanes,I.numIntersection,n),r=l.getProgramCode(e,n),a=i.program,o=!0;if(void 0===a)e.addEventListener("dispose",fe);else if(a.code!==r)me(e);else{if(void 0!==n.shaderID)return;o=!1}o&&(n.shaderID?(o=Ts[n.shaderID],i.shader={name:e.type,uniforms:Es.clone(o.uniforms),vertexShader:o.vertexShader,fragmentShader:o.fragmentShader}):i.shader={name:e.type,uniforms:e.uniforms,vertexShader:e.vertexShader,fragmentShader:e.fragmentShader},e.onBeforeCompile(i.shader),a=l.acquireProgram(e,i.shader,n,r),i.program=a,e.program=a);var s=a.getAttributes();if(e.morphTargets)for(var c=e.numSupportedMorphTargets=0;c<E.maxMorphTargets;c++)0<=s["morphTarget"+c]&&e.numSupportedMorphTargets++;if(e.morphNormals)for(c=e.numSupportedMorphNormals=0;c<E.maxMorphNormals;c++)0<=s["morphNormal"+c]&&e.numSupportedMorphNormals++;o=i.shader.uniforms,(e.isShaderMaterial||e.isRawShaderMaterial)&&!0!==e.clipping||(i.numClippingPlanes=I.numPlanes,i.numIntersection=I.numIntersection,o.clippingPlanes=I.uniform),i.fog=t,i.lightsHash=v.state.hash,e.lights&&(o.ambientLightColor.value=v.state.ambient,o.directionalLights.value=v.state.directional,o.spotLights.value=v.state.spot,o.rectAreaLights.value=v.state.rectArea,o.pointLights.value=v.state.point,o.hemisphereLights.value=v.state.hemi,o.directionalShadowMap.value=v.state.directionalShadowMap,o.directionalShadowMatrix.value=v.state.directionalShadowMatrix,o.spotShadowMap.value=v.state.spotShadowMap,o.spotShadowMatrix.value=v.state.spotShadowMatrix,o.pointShadowMap.value=v.state.pointShadowMap,o.pointShadowMatrix.value=v.state.pointShadowMatrix),n=i.program.getUniforms(),r=Ie.seqWithValue(n.seq,o);i.uniformsList=r}function Me(e,t,n,i){te=0;var r=g.get(n);re&&(ae||e!==A)&&(l=e===A&&n.id===M,I.setState(n.clippingPlanes,n.clipIntersection,n.clipShadows,e,r,l)),!1===n.needsUpdate&&(void 0===r.program||n.fog&&r.fog!==t||n.lights&&r.lightsHash!==v.state.hash||void 0!==r.numClippingPlanes&&(r.numClippingPlanes!==I.numPlanes||r.numIntersection!==I.numIntersection))&&(n.needsUpdate=!0),n.needsUpdate&&(Te(n,t,i),n.needsUpdate=!1);var a,o,s,c,l=!1,h=!1,u=!1,d=r.program,p=d.getUniforms(),f=r.shader.uniforms;return w.useProgram(d.program)&&(u=h=l=!0),n.id!==M&&(M=n.id,h=!0),(l||e!==A)&&(p.setValue(x,"projectionMatrix",e.projectionMatrix),m.logarithmicDepthBuffer&&p.setValue(x,"logDepthBufFC",2/(Math.log(e.far+1)/Math.LN2)),A!==(R||e)&&(A=R||e,u=h=!0),(n.isShaderMaterial||n.isMeshPhongMaterial||n.isMeshStandardMaterial||n.envMap)&&void 0!==(l=p.map.cameraPosition)&&l.setValue(x,U.setFromMatrixPosition(e.matrixWorld)),n.isMeshPhongMaterial||n.isMeshLambertMaterial||n.isMeshBasicMaterial||n.isMeshStandardMaterial||n.isShaderMaterial||n.skinning)&&p.setValue(x,"viewMatrix",e.matrixWorldInverse),n.skinning&&(p.setOptional(x,i,"bindMatrix"),p.setOptional(x,i,"bindMatrixInverse"),l=i.skeleton)&&(e=l.bones,m.floatVertexTextures?(void 0===l.boneTexture&&(e=Math.sqrt(4*e.length),e=Pe.ceilPowerOfTwo(e),e=Math.max(e,4),(s=new Float32Array(e*e*4)).set(l.boneMatrices),c=new Oe(s,e,e,Bo,Lo),l.boneMatrices=s,l.boneTexture=c,l.boneTextureSize=e),p.setValue(x,"boneTexture",l.boneTexture),p.setValue(x,"boneTextureSize",l.boneTextureSize)):p.setOptional(x,l,"boneMatrices")),h&&(p.setValue(x,"toneMappingExposure",E.toneMappingExposure),p.setValue(x,"toneMappingWhitePoint",E.toneMappingWhitePoint),n.lights&&(s=u,(c=f).ambientLightColor.needsUpdate=s,c.directionalLights.needsUpdate=s,c.pointLights.needsUpdate=s,c.spotLights.needsUpdate=s,c.rectAreaLights.needsUpdate=s,c.hemisphereLights.needsUpdate=s),t&&n.fog&&(e=t,(l=f).fogColor.value=e.color,e.isFog?(l.fogNear.value=e.near,l.fogFar.value=e.far):e.isFogExp2&&(l.fogDensity.value=e.density)),n.isMeshBasicMaterial?B(f,n):n.isMeshLambertMaterial?(B(f,n),h=f,n.emissiveMap&&(h.emissiveMap.value=n.emissiveMap)):n.isMeshPhongMaterial?(B(f,n),n.isMeshToonMaterial?(Se(u=f,c=n),c.gradientMap&&(u.gradientMap.value=c.gradientMap)):Se(f,n)):n.isMeshStandardMaterial?(B(f,n),n.isMeshPhysicalMaterial?(s=n,(t=f).clearCoat.value=s.clearCoat,t.clearCoatRoughness.value=s.clearCoatRoughness,Ae(t,s)):Ae(f,n)):n.isMeshDepthMaterial?(B(f,n),e=f,(h=n).displacementMap&&(e.displacementMap.value=h.displacementMap,e.displacementScale.value=h.displacementScale,e.displacementBias.value=h.displacementBias)):n.isMeshDistanceMaterial?(B(f,n),u=f,(t=n).displacementMap&&(u.displacementMap.value=t.displacementMap,u.displacementScale.value=t.displacementScale,u.displacementBias.value=t.displacementBias),u.referencePosition.value.copy(t.referencePosition),u.nearDistance.value=t.nearDistance,u.farDistance.value=t.farDistance):n.isMeshNormalMaterial?(B(f,n),e=f,(h=n).bumpMap&&(e.bumpMap.value=h.bumpMap,e.bumpScale.value=h.bumpScale),h.normalMap&&(e.normalMap.value=h.normalMap,e.normalScale.value.copy(h.normalScale)),h.displacementMap&&(e.displacementMap.value=h.displacementMap,e.displacementScale.value=h.displacementScale,e.displacementBias.value=h.displacementBias)):n.isLineBasicMaterial?(u=n,(t=f).diffuse.value=u.color,t.opacity.value=u.opacity,n.isLineDashedMaterial&&(e=n,(h=f).dashSize.value=e.dashSize,h.totalSize.value=e.dashSize+e.gapSize,h.scale.value=e.scale)):n.isPointsMaterial?(t=n,(u=f).diffuse.value=t.color,u.opacity.value=t.opacity,u.size.value=t.size*N,u.scale.value=.5*P,u.map.value=t.map,null!==t.map&&(!0===t.map.matrixAutoUpdate&&(h=t.map.offset,e=t.map.repeat,a=t.map.rotation,o=t.map.center,t.map.matrix.setUvTransform(h.x,h.y,e.x,e.y,a,o.x,o.y)),u.uvTransform.value.copy(t.map.matrix))):n.isShadowMaterial&&(f.color.value=n.color,f.opacity.value=n.opacity),void 0!==f.ltcMat&&(f.ltcMat.value=Ne.LTC_MAT_TEXTURE),void 0!==f.ltcMag&&(f.ltcMag.value=Ne.LTC_MAG_TEXTURE),Ie.upload(x,r.uniformsList,f,E)),p.setValue(x,"modelViewMatrix",i.modelViewMatrix),p.setValue(x,"normalMatrix",i.normalMatrix),p.setValue(x,"modelMatrix",i.matrixWorld),d}function B(e,t){var n,i,r,a;e.opacity.value=t.opacity,t.color&&(e.diffuse.value=t.color),t.emissive&&e.emissive.value.copy(t.emissive).multiplyScalar(t.emissiveIntensity),t.map&&(e.map.value=t.map),t.alphaMap&&(e.alphaMap.value=t.alphaMap),t.specularMap&&(e.specularMap.value=t.specularMap),t.envMap&&(e.envMap.value=t.envMap,e.flipEnvMap.value=t.envMap&&t.envMap.isCubeTexture?-1:1,e.reflectivity.value=t.reflectivity,e.refractionRatio.value=t.refractionRatio),t.lightMap&&(e.lightMap.value=t.lightMap,e.lightMapIntensity.value=t.lightMapIntensity),t.aoMap&&(e.aoMap.value=t.aoMap,e.aoMapIntensity.value=t.aoMapIntensity),t.map?n=t.map:t.specularMap?n=t.specularMap:t.displacementMap?n=t.displacementMap:t.normalMap?n=t.normalMap:t.bumpMap?n=t.bumpMap:t.roughnessMap?n=t.roughnessMap:t.metalnessMap?n=t.metalnessMap:t.alphaMap?n=t.alphaMap:t.emissiveMap&&(n=t.emissiveMap),void 0!==n&&(!0===(n=n.isWebGLRenderTarget?n.texture:n).matrixAutoUpdate&&(t=n.offset,i=n.repeat,r=n.rotation,a=n.center,n.matrix.setUvTransform(t.x,t.y,i.x,i.y,r,a.x,a.y)),e.uvTransform.value.copy(n.matrix))}function Se(e,t){e.specular.value=t.specular,e.shininess.value=Math.max(t.shininess,1e-4),t.emissiveMap&&(e.emissiveMap.value=t.emissiveMap),t.bumpMap&&(e.bumpMap.value=t.bumpMap,e.bumpScale.value=t.bumpScale),t.normalMap&&(e.normalMap.value=t.normalMap,e.normalScale.value.copy(t.normalScale)),t.displacementMap&&(e.displacementMap.value=t.displacementMap,e.displacementScale.value=t.displacementScale,e.displacementBias.value=t.displacementBias)}function Ae(e,t){e.roughness.value=t.roughness,e.metalness.value=t.metalness,t.roughnessMap&&(e.roughnessMap.value=t.roughnessMap),t.metalnessMap&&(e.metalnessMap.value=t.metalnessMap),t.emissiveMap&&(e.emissiveMap.value=t.emissiveMap),t.bumpMap&&(e.bumpMap.value=t.bumpMap,e.bumpScale.value=t.bumpScale),t.normalMap&&(e.normalMap.value=t.normalMap,e.normalScale.value.copy(t.normalScale)),t.displacementMap&&(e.displacementMap.value=t.displacementMap,e.displacementScale.value=t.displacementScale,e.displacementBias.value=t.displacementBias),t.envMap&&(e.envMapIntensity.value=t.envMapIntensity)}this.animate=function(e){be=e,xe||(((e=F.getDevice())&&e.isPresenting?e:window).requestAnimationFrame(we),xe=!0)},this.render=function(e,t,n,i){var r,a;t&&t.isCamera?Q||(S="",M=-1,!(A=null)===e.autoUpdate&&e.updateMatrixWorld(),null===t.parent&&t.updateMatrixWorld(),F.enabled&&(t=F.getCamera(t)),oe.multiplyMatrices(t.projectionMatrix,t.matrixWorldInverse),ie.setFromMatrix(oe),d.length=0,p.length=0,W.length=j.length=0,ae=this.localClippingEnabled,re=I.init(this.clippingPlanes,ae,t),(f=s.get(e,t)).init(),function e(t,n,i){if(!1!==t.visible){if(t.layers.test(n.layers))if(t.isLight)d.push(t),t.castShadow&&p.push(t);else if(t.isSprite)t.frustumCulled&&!ie.intersectsSprite(t)||j.push(t);else if(t.isLensFlare)W.push(t);else if(t.isImmediateRenderObject)i&&U.setFromMatrixPosition(t.matrixWorld).applyMatrix4(oe),f.push(t,null,t.material,U.z,null);else if((t.isMesh||t.isLine||t.isPoints)&&(t.isSkinnedMesh&&t.skeleton.update(),!t.frustumCulled||ie.intersectsObject(t))){i&&U.setFromMatrixPosition(t.matrixWorld).applyMatrix4(oe);var r=X.update(t),a=t.material;if(Array.isArray(a))for(var o=r.groups,s=0,c=o.length;s<c;s++){var l=o[s],h=a[l.materialIndex];h&&h.visible&&f.push(t,r,h,U.z,l)}else a.visible&&f.push(t,r,a,U.z,null)}for(var u=t.children,s=0,c=u.length;s<c;s++)e(u[s],n,i)}}(e,t,E.sortObjects),!0===E.sortObjects&&f.sort(),o.updateVideoTextures(),re&&I.beginShadows(),ue.render(p,e,t),v.setup(d,p,t),re&&I.endShadows(),D.frame++,D.calls=0,D.vertices=0,D.faces=0,D.points=0,this.setRenderTarget(n=void 0===n?null:n),c.render(f,e,t,i),i=f.opaque,r=f.transparent,e.overrideMaterial?(a=e.overrideMaterial,i.length&&_e(i,e,t,a),r.length&&_e(r,e,t,a)):(i.length&&_e(i,e,t),r.length&&_e(r,e,t)),K.render(j,e,t),J.render(W,e,t,C),n&&o.updateRenderTargetMipmap(n),w.buffers.depth.setTest(!0),w.buffers.depth.setMask(!0),w.buffers.color.setMask(!0),w.setPolygonOffset(!1),F.enabled&&F.submitFrame()):console.error("THREE.WebGLRenderer.render: camera is not an instance of THREE.Camera.")},this.setFaceCulling=function(e,t){w.setCullFace(e),w.setFlipSided(0===t)},this.allocTextureUnit=function(){var e=te;return e>=m.maxTextures&&console.warn("THREE.WebGLRenderer: Trying to use "+e+" texture units while this GPU supports only "+m.maxTextures),te+=1,e},this.setTexture2D=(ge=!1,function(e,t){e&&e.isWebGLRenderTarget&&(ge||(console.warn("THREE.WebGLRenderer.setTexture2D: don't use render targets as textures. Use their .texture property instead."),ge=!0),e=e.texture),o.setTexture2D(e,t)}),this.setTexture=(ye=!1,function(e,t){ye||(console.warn("THREE.WebGLRenderer: .setTexture is deprecated, use setTexture2D instead."),ye=!0),o.setTexture2D(e,t)}),this.setTextureCube=(ve=!1,function(e,t){e&&e.isWebGLRenderTargetCube&&(ve||(console.warn("THREE.WebGLRenderer.setTextureCube: don't use cube render targets as textures. Use their .texture property instead."),ve=!0),e=e.texture),e&&e.isCubeTexture||Array.isArray(e.image)&&6===e.image.length?o.setTextureCube(e,t):o.setTextureCubeDynamic(e,t)}),this.getRenderTarget=function(){return $},this.setRenderTarget=function(e){($=e)&&void 0===g.get(e).__webglFramebuffer&&o.setupRenderTarget(e);var t,n=null,i=!1;ee=e?(t=g.get(e).__webglFramebuffer,e.isWebGLRenderTargetCube?(n=t[e.activeCubeFace],i=!0):n=t,C.copy(e.viewport),a.copy(e.scissor),e.scissorTest):(C.copy(h).multiplyScalar(N),a.copy(O).multiplyScalar(N),ne),T!==n&&(x.bindFramebuffer(x.FRAMEBUFFER,n),T=n),w.viewport(C),w.scissor(a),w.setScissorTest(ee),i&&(t=g.get(e.texture),x.framebufferTexture2D(x.FRAMEBUFFER,x.COLOR_ATTACHMENT0,x.TEXTURE_CUBE_MAP_POSITIVE_X+e.activeCubeFace,t.__webglTexture,e.activeMipMapLevel))},this.readRenderTargetPixels=function(e,t,n,i,r,a){if(e&&e.isWebGLRenderTarget){var o=g.get(e).__webglFramebuffer;if(o){var s=!1;o!==T&&(x.bindFramebuffer(x.FRAMEBUFFER,o),s=!0);try{var c=e.texture,l=c.format,h=c.type;l!==Bo&&y.convert(l)!==x.getParameter(x.IMPLEMENTATION_COLOR_READ_FORMAT)?console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format."):h===To||y.convert(h)===x.getParameter(x.IMPLEMENTATION_COLOR_READ_TYPE)||h===Lo&&(b.get("OES_texture_float")||b.get("WEBGL_color_buffer_float"))||h===Po&&b.get("EXT_color_buffer_half_float")?x.checkFramebufferStatus(x.FRAMEBUFFER)===x.FRAMEBUFFER_COMPLETE?0<=t&&t<=e.width-i&&0<=n&&n<=e.height-r&&x.readPixels(t,n,i,r,y.convert(l),y.convert(h),a):console.error("THREE.WebGLRenderer.readRenderTargetPixels: readPixels from renderTarget failed. Framebuffer not complete."):console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.")}finally{s&&x.bindFramebuffer(x.FRAMEBUFFER,T)}}}else console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.")}}function kt(e,t){this.name="",this.color=new N(e),this.density=void 0!==t?t:25e-5}function Ht(e,t,n){this.name="",this.color=new N(e),this.near=void 0!==t?t:1,this.far=void 0!==n?n:1e3}function zt(){f.call(this),this.type="Scene",this.background=null,this.fog=null,this.overrideMaterial=null,this.autoUpdate=!0}function Gt(e,t,n,i,r){f.call(this),this.lensFlares=[],this.positionScreen=new Ce,(this.customUpdateCallback=void 0)!==e&&this.add(e,t,n,i,r)}function Vt(e){t.call(this),this.type="SpriteMaterial",this.color=new N(16777215),this.map=null,this.rotation=0,this.fog=!1,this.lights=!1,this.setValues(e)}function jt(e){f.call(this),this.type="Sprite",this.material=void 0!==e?e:new Vt}function Wt(){f.call(this),this.type="LOD",Object.defineProperties(this,{levels:{enumerable:!0,value:[]}})}function Xt(e,t){if(this.bones=(e=e||[]).slice(0),this.boneMatrices=new Float32Array(16*this.bones.length),void 0===t)this.calculateInverses();else if(this.bones.length===t.length)this.boneInverses=t.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 Re)}}function qt(){f.call(this),this.type="Bone"}function Yt(e,t){m.call(this,e,t),this.type="SkinnedMesh",this.bindMode="attached",this.bindMatrix=new Re,this.bindMatrixInverse=new Re;e=new Xt(this.initBones());this.bind(e,this.matrixWorld),this.normalizeSkinWeights()}function v(e){t.call(this),this.type="LineBasicMaterial",this.color=new N(16777215),this.linewidth=1,this.linecap="round",this.linejoin="round",this.lights=!1,this.setValues(e)}function y(e,t,n){if(1===n)return console.warn("THREE.Line: parameter THREE.LinePieces no longer supported. Created THREE.LineSegments instead."),new b(e,t);f.call(this),this.type="Line",this.geometry=void 0!==e?e:new J,this.material=void 0!==t?t:new v({color:16777215*Math.random()})}function b(e,t){y.call(this,e,t),this.type="LineSegments"}function Zt(e,t){y.call(this,e,t),this.type="LineLoop"}function Jt(e){t.call(this),this.type="PointsMaterial",this.color=new N(16777215),this.map=null,this.size=1,this.sizeAttenuation=!0,this.lights=!1,this.setValues(e)}function Kt(e,t){f.call(this),this.type="Points",this.geometry=void 0!==e?e:new J,this.material=void 0!==t?t:new Jt({color:16777215*Math.random()})}function Qt(){f.call(this),this.type="Group"}function $t(t,e,n,i,r,a,o,s,c){d.call(this,t,e,n,i,r,a,o,s,c),this.generateMipmaps=!1;var l=this;t.addEventListener("loadeddata",function e(){t.removeEventListener("loadeddata",e,!1),l.needsUpdate=!0},!1)}function en(e,t,n,i,r,a,o,s,c,l,h,u){d.call(this,null,a,o,s,c,l,i,r,h,u),this.image={width:t,height:n},this.mipmaps=e,this.flipY=!1,this.generateMipmaps=!1}function tn(e,t,n,i,r,a,o,s,c,l){if((l=void 0!==l?l:Go)!==Go&&l!==Vo)throw new Error("DepthTexture format must be either THREE.DepthFormat or THREE.DepthStencilFormat");d.call(this,null,i,r,a,o,s,l,n=void 0===(n=void 0===n&&l===Go?Ao:n)&&l===Vo?Uo:n,c),this.image={width:e,height:t},this.magFilter=void 0!==o?o:R,this.minFilter=void 0!==s?s:R,this.flipY=!1,this.generateMipmaps=!1}function nn(e){J.call(this),this.type="WireframeGeometry";var t,n,i,r,a,o,s=[],c=[0,0],l={},h=["a","b","c"];if(e&&e.isGeometry){for(var u=e.faces,d=0,p=u.length;d<p;d++)for(var f=u[d],m=0;m<3;m++)r=f[h[m]],a=f[h[(m+1)%3]],c[0]=Math.min(r,a),c[1]=Math.max(r,a),void 0===l[o=c[0]+","+c[1]]&&(l[o]={index1:c[0],index2:c[1]});for(o in l)b=e.vertices[(i=l[o]).index1],s.push(b.x,b.y,b.z),b=e.vertices[i.index2],s.push(b.x,b.y,b.z)}else if(e&&e.isBufferGeometry){var g,v,y,x,b=new Ce;if(null!==e.index){for(g=e.attributes.position,v=e.index,n=(y=(t=0)===(y=e.groups).length?[{start:0,count:v.count,materialIndex:0}]:y).length;t<n;++t)for(p=(d=(x=y[t]).start)+x.count;d<p;d+=3)for(m=0;m<3;m++)r=v.getX(d+m),a=v.getX(d+(m+1)%3),c[0]=Math.min(r,a),c[1]=Math.max(r,a),void 0===l[o=c[0]+","+c[1]]&&(l[o]={index1:c[0],index2:c[1]});for(o in l)b.fromBufferAttribute(g,(i=l[o]).index1),s.push(b.x,b.y,b.z),b.fromBufferAttribute(g,i.index2),s.push(b.x,b.y,b.z)}else for(d=0,p=(g=e.attributes.position).count/3;d<p;d++)for(m=0;m<3;m++)b.fromBufferAttribute(g,3*d+m),s.push(b.x,b.y,b.z),b.fromBufferAttribute(g,3*d+(m+1)%3),s.push(b.x,b.y,b.z)}this.addAttribute("position",new ne(s,3))}function rn(e,t,n){x.call(this),this.type="ParametricGeometry",this.parameters={func:e,slices:t,stacks:n},this.fromBufferGeometry(new an(e,t,n)),this.mergeVertices()}function an(e,t,n){J.call(this),this.type="ParametricBufferGeometry",this.parameters={func:e,slices:t,stacks:n};for(var i=[],r=[],a=[],o=[],s=new Ce,c=new Ce,l=new Ce,h=new Ce,u=new Ce,d=t+1,p=0;p<=n;p++)for(var f=p/n,m=0;m<=t;m++){var g=m/t,c=e(g,f,c);r.push(c.x,c.y,c.z),0<=g-1e-5?(l=e(g-1e-5,f,l),h.subVectors(c,l)):(l=e(1e-5+g,f,l),h.subVectors(l,c)),0<=f-1e-5?(l=e(g,f-1e-5,l),u.subVectors(c,l)):(l=e(g,1e-5+f,l),u.subVectors(l,c)),s.crossVectors(h,u).normalize(),a.push(s.x,s.y,s.z),o.push(g,f)}for(p=0;p<n;p++)for(m=0;m<t;m++){var v=p*d+m+1,y=(p+1)*d+m+1,x=(p+1)*d+m;i.push(p*d+m,v,x),i.push(v,y,x)}this.setIndex(i),this.addAttribute("position",new ne(r,3)),this.addAttribute("normal",new ne(a,3)),this.addAttribute("uv",new ne(o,2))}function on(e,t,n,i){x.call(this),this.type="PolyhedronGeometry",this.parameters={vertices:e,indices:t,radius:n,detail:i},this.fromBufferGeometry(new sn(e,t,n,i)),this.mergeVertices()}function sn(n,e,t,i){J.call(this),this.type="PolyhedronBufferGeometry",this.parameters={vertices:n,indices:e,radius:t,detail:i},t=t||1;var r=[],a=[];function o(e){r.push(e.x,e.y,e.z)}function s(e,t){e*=3;t.x=n[0+e],t.y=n[1+e],t.z=n[2+e]}function c(e,t,n,i){i<0&&1===e.x&&(a[t]=e.x-1),0===n.x&&0===n.z&&(a[t]=i/2/Math.PI+.5)}function l(e){return Math.atan2(e.z,-e.x)}for(var D=i=i||0,h=new Ce,u=new Ce,d=new Ce,p=0;p<e.length;p+=3){s(e[p+0],h),s(e[p+1],u),s(e[p+2],d),w=x=H=y=g=m=b=v=k=f=B=F=void 0;for(var F=h,B=u,f=d,k=D,m=Math.pow(2,k),g=[],v=0;v<=m;v++){g[v]=[];for(var y=F.clone().lerp(f,v/m),H=B.clone().lerp(f,v/m),x=m-v,b=0;b<=x;b++)g[v][b]=0===b&&v===m?y:y.clone().lerp(H,b/x)}for(v=0;v<m;v++)for(b=0;b<2*(m-v)-1;b++){var w=Math.floor(b/2);b%2==0?(o(g[v][w+1]),o(g[v+1][w]),o(g[v][w])):(o(g[v][w+1]),o(g[v+1][w+1]),o(g[v+1][w]))}}for(var z=t,_=new Ce,E=0;E<r.length;E+=3)_.x=r[E+0],_.y=r[E+1],_.z=r[E+2],_.normalize().multiplyScalar(z),r[E+0]=_.x,r[E+1]=_.y,r[E+2]=_.z;for(var T=new Ce,M=0;M<r.length;M+=3){T.x=r[M+0],T.y=r[M+1],T.z=r[M+2];var G=l(T)/2/Math.PI+.5,V=Math.atan2(-T.y,Math.sqrt(T.x*T.x+T.z*T.z))/Math.PI+.5;a.push(G,1-V)}for(var S=new Ce,A=new Ce,R=new Ce,j=new Ce,W=new te,X=new te,q=new te,C=0,L=0;C<r.length;C+=9,L+=6){S.set(r[C+0],r[C+1],r[C+2]),A.set(r[C+3],r[C+4],r[C+5]),R.set(r[C+6],r[C+7],r[C+8]),W.set(a[L+0],a[L+1]),X.set(a[L+2],a[L+3]),q.set(a[L+4],a[L+5]),j.copy(S).add(A).add(R).divideScalar(3);var P=l(j);c(W,L+0,S,P),c(X,L+2,A,P),c(q,L+4,R,P)}for(var N=0;N<a.length;N+=6){var O=a[N+0],I=a[N+2],U=a[N+4],Y=Math.max(O,I,U),Z=Math.min(O,I,U);.9<Y&&Z<.1&&(O<.2&&(a[N+0]+=1),I<.2&&(a[N+2]+=1),U<.2)&&(a[N+4]+=1)}this.addAttribute("position",new ne(r,3)),this.addAttribute("normal",new ne(r.slice(),3)),this.addAttribute("uv",new ne(a,2)),0===i?this.computeVertexNormals():this.normalizeNormals()}function cn(e,t){x.call(this),this.type="TetrahedronGeometry",this.parameters={radius:e,detail:t},this.fromBufferGeometry(new ln(e,t)),this.mergeVertices()}function ln(e,t){sn.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],e,t),this.type="TetrahedronBufferGeometry",this.parameters={radius:e,detail:t}}function hn(e,t){x.call(this),this.type="OctahedronGeometry",this.parameters={radius:e,detail:t},this.fromBufferGeometry(new un(e,t)),this.mergeVertices()}function un(e,t){sn.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],e,t),this.type="OctahedronBufferGeometry",this.parameters={radius:e,detail:t}}function dn(e,t){x.call(this),this.type="IcosahedronGeometry",this.parameters={radius:e,detail:t},this.fromBufferGeometry(new pn(e,t)),this.mergeVertices()}function pn(e,t){var n=(1+Math.sqrt(5))/2;sn.call(this,[-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],[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],e,t),this.type="IcosahedronBufferGeometry",this.parameters={radius:e,detail:t}}function fn(e,t){x.call(this),this.type="DodecahedronGeometry",this.parameters={radius:e,detail:t},this.fromBufferGeometry(new mn(e,t)),this.mergeVertices()}function mn(e,t){var n=(1+Math.sqrt(5))/2,i=1/n;sn.call(this,[-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],[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],e,t),this.type="DodecahedronBufferGeometry",this.parameters={radius:e,detail:t}}function gn(e,t,n,i,r,a){x.call(this),this.type="TubeGeometry",this.parameters={path:e,tubularSegments:t,radius:n,radialSegments:i,closed:r},void 0!==a&&console.warn("THREE.TubeGeometry: taper has been removed.");a=new vn(e,t,n,i,r);this.tangents=a.tangents,this.normals=a.normals,this.binormals=a.binormals,this.fromBufferGeometry(a),this.mergeVertices()}function vn(a,o,s,c,e){J.call(this),this.type="TubeBufferGeometry",this.parameters={path:a,tubularSegments:o,radius:s,radialSegments:c,closed:e},o=o||64,s=s||1,c=c||8,e=e||!1;var l=a.computeFrenetFrames(o,e);this.tangents=l.tangents,this.normals=l.normals,this.binormals=l.binormals;var t,h,u=new Ce,d=new Ce,n=new te,p=new Ce,f=[],m=[],i=[],r=[];function g(e){p=a.getPointAt(e/o,p);var t=l.normals[e],n=l.binormals[e];for(h=0;h<=c;h++){var i=h/c*Math.PI*2,r=Math.sin(i),i=-Math.cos(i);d.x=i*t.x+r*n.x,d.y=i*t.y+r*n.y,d.z=i*t.z+r*n.z,d.normalize(),m.push(d.x,d.y,d.z),u.x=p.x+s*d.x,u.y=p.y+s*d.y,u.z=p.z+s*d.z,f.push(u.x,u.y,u.z)}}for(t=0;t<o;t++)g(t);for(g(!1===e?o:0),t=0;t<=o;t++)for(h=0;h<=c;h++)n.x=t/o,n.y=h/c,i.push(n.x,n.y);for(h=1;h<=o;h++)for(t=1;t<=c;t++){var v=(c+1)*(h-1)+(t-1),y=(c+1)*h+(t-1),x=(c+1)*h+t,b=(c+1)*(h-1)+t;r.push(v,y,b),r.push(y,x,b)}this.setIndex(r),this.addAttribute("position",new ne(f,3)),this.addAttribute("normal",new ne(m,3)),this.addAttribute("uv",new ne(i,2))}function yn(e,t,n,i,r,a,o){x.call(this),this.type="TorusKnotGeometry",this.parameters={radius:e,tube:t,tubularSegments:n,radialSegments:i,p:r,q:a},void 0!==o&&console.warn("THREE.TorusKnotGeometry: heightScale has been deprecated. Use .scale( x, y, z ) instead."),this.fromBufferGeometry(new xn(e,t,n,i,r,a)),this.mergeVertices()}function xn(e,t,n,i,r,a){J.call(this),this.type="TorusKnotBufferGeometry",this.parameters={radius:e,tube:t,tubularSegments:n,radialSegments:i,p:r,q:a},e=e||1,t=t||.4,n=Math.floor(n)||64,i=Math.floor(i)||8,r=r||2,a=a||3;for(var o,s=[],c=[],l=[],h=[],u=new Ce,d=new Ce,p=new Ce,f=new Ce,m=new Ce,g=new Ce,v=new Ce,y=0;y<=n;++y){var x=y/n*r*Math.PI*2;for(M(x,r,a,e,p),M(.01+x,r,a,e,f),g.subVectors(f,p),v.addVectors(f,p),m.crossVectors(g,v),v.crossVectors(m,g),m.normalize(),v.normalize(),o=0;o<=i;++o){var b=o/i*Math.PI*2,w=-t*Math.cos(b),b=t*Math.sin(b);u.x=p.x+(w*v.x+b*m.x),u.y=p.y+(w*v.y+b*m.y),u.z=p.z+(w*v.z+b*m.z),c.push(u.x,u.y,u.z),d.subVectors(u,p).normalize(),l.push(d.x,d.y,d.z),h.push(y/n),h.push(o/i)}}for(o=1;o<=n;o++)for(y=1;y<=i;y++){var _=(i+1)*o+(y-1),E=(i+1)*o+y,T=(i+1)*(o-1)+y;s.push((i+1)*(o-1)+(y-1),_,T),s.push(_,E,T)}function M(e,t,n,i,r){var a=Math.cos(e),o=Math.sin(e),n=n/t*e,t=Math.cos(n);r.x=i*(2+t)*.5*a,r.y=i*(2+t)*o*.5,r.z=i*Math.sin(n)*.5}this.setIndex(s),this.addAttribute("position",new ne(c,3)),this.addAttribute("normal",new ne(l,3)),this.addAttribute("uv",new ne(h,2))}function bn(e,t,n,i,r){x.call(this),this.type="TorusGeometry",this.parameters={radius:e,tube:t,radialSegments:n,tubularSegments:i,arc:r},this.fromBufferGeometry(new wn(e,t,n,i,r)),this.mergeVertices()}function wn(e,t,n,i,r){J.call(this),this.type="TorusBufferGeometry",this.parameters={radius:e,tube:t,radialSegments:n,tubularSegments:i,arc:r},e=e||1,t=t||.4,n=Math.floor(n)||8,i=Math.floor(i)||6,r=r||2*Math.PI;for(var a,o=[],s=[],c=[],l=[],h=new Ce,u=new Ce,d=new Ce,p=0;p<=n;p++)for(a=0;a<=i;a++){var f=a/i*r,m=p/n*Math.PI*2;u.x=(e+t*Math.cos(m))*Math.cos(f),u.y=(e+t*Math.cos(m))*Math.sin(f),u.z=t*Math.sin(m),s.push(u.x,u.y,u.z),h.x=e*Math.cos(f),h.y=e*Math.sin(f),d.subVectors(u,h).normalize(),c.push(d.x,d.y,d.z),l.push(a/i),l.push(p/n)}for(p=1;p<=n;p++)for(a=1;a<=i;a++){var g=(i+1)*(p-1)+a-1,v=(i+1)*(p-1)+a,y=(i+1)*p+a;o.push((i+1)*p+a-1,g,y),o.push(g,v,y)}this.setIndex(o),this.addAttribute("position",new ne(s,3)),this.addAttribute("normal",new ne(c,3)),this.addAttribute("uv",new ne(l,2))}function _n(e,o,t,n,i){var r,a;if(i===0<((e,t,n)=>{for(var i=0,r=o,a=t-n;r<t;r+=n)i+=(e[a]-e[r])*(e[r+1]+e[a+1]),a=r;return i})(e,t,n))for(r=o;r<t;r+=n)a=Nn(r,e[r],e[r+1],a);else for(r=t-n;o<=r;r-=n)a=Nn(r,e[r],e[r+1],a);return a&&Rn(a,a.next)&&(On(a),a=a.next),a}function En(e,t){if(!e)return e;t=t||e;var n,i=e;do{if(n=!1,i.steiner||!Rn(i,i.next)&&0!==M(i.prev,i,i.next))i=i.next;else{if(On(i),(i=t=i.prev)===i.next)break;n=!0}}while(n||i!==t);return t}function Tn(e,t,n,i,r,a,o){if(e){if(!o&&a){var s=e;var c=i;var l=r;var h=a;for(var u=s;null===u.z&&(u.z=Sn(u.x,u.y,c,l,h)),u.prevZ=u.prev,u.nextZ=u.next,(u=u.next)!==s;);u.prevZ.nextZ=null,u.prevZ=null;var d,p,f,m,g,v,y,x,b=u,w=1;do{for(p=b,g=b=null,v=0;p;){for(v++,f=p,d=y=0;d<w&&(y++,f=f.nextZ);d++);for(x=w;0<y||0<x&&f;)0!==y&&(0===x||!f||p.z<=f.z)?(p=(m=p).nextZ,y--):(f=(m=f).nextZ,x--),g?g.nextZ=m:b=m,m.prevZ=g,g=m;p=f}}while(g.nextZ=null,w*=2,1<v)}for(var _,E,T=e;e.prev!==e.next;)if(_=e.prev,E=e.next,a?((e,t,n,i)=>{var r=e.prev,a=e,o=e.next;if(!(0<=M(r,a,o))){for(var s=(r.x<a.x?r.x<o.x?r:o:a.x<o.x?a:o).x,c=(r.y<a.y?r.y<o.y?r:o:a.y<o.y?a:o).y,l=(a.x<r.x?r.x>o.x?r:o:a.x>o.x?a:o).x,h=(a.y<r.y?r.y>o.y?r:o:a.y>o.y?a:o).y,u=Sn(s,c,t,n,i),d=Sn(l,h,t,n,i),p=e.nextZ;p&&p.z<=d;){if(p!==e.prev&&p!==e.next&&An(r.x,r.y,a.x,a.y,o.x,o.y,p.x,p.y)&&0<=M(p.prev,p,p.next))return;p=p.nextZ}for(p=e.prevZ;p&&p.z>=u;){if(p!==e.prev&&p!==e.next&&An(r.x,r.y,a.x,a.y,o.x,o.y,p.x,p.y)&&0<=M(p.prev,p,p.next))return;p=p.prevZ}return 1}})(e,i,r,a):(e=>{var t=e.prev,n=e,i=e.next;if(!(0<=M(t,n,i))){for(var r=e.next.next;r!==e.prev;){if(An(t.x,t.y,n.x,n.y,i.x,i.y,r.x,r.y)&&0<=M(r.prev,r,r.next))return;r=r.next}return 1}})(e))t.push(_.i/n),t.push(e.i/n),t.push(E.i/n),On(e),e=E.next,T=E.next;else if((e=E)===T){o?1===o?Tn(e=((e,t,n)=>{var i=e;do{var r=i.prev,a=i.next.next}while(!Rn(r,a)&&Cn(r,i,i.next,a)&&Ln(r,a)&&Ln(a,r)&&(t.push(r.i/n),t.push(i.i/n),t.push(a.i/n),On(i),On(i.next),i=e=a),(i=i.next)!==e);return i})(e,t,n),t,n,i,r,a,2):2===o&&((e,t,n,i,r,a)=>{var o=e;do{for(var s,c=o.next.next;c!==o.prev;){if(o.i!==c.i&&((e,t)=>e.next.i!==t.i&&e.prev.i!==t.i&&!((e,t)=>{var n=e;do{if(n.i!==e.i&&n.next.i!==e.i&&n.i!==t.i&&n.next.i!==t.i&&Cn(n,n.next,e,t))return 1}while((n=n.next)!==e)})(e,t)&&Ln(e,t)&&Ln(t,e)&&((e,t)=>{for(var n=e,i=!1,r=(e.x+t.x)/2,a=(e.y+t.y)/2;n.y>a!=n.next.y>a&&n.next.y!==n.y&&r<(n.next.x-n.x)*(a-n.y)/(n.next.y-n.y)+n.x&&(i=!i),(n=n.next)!==e;);return i})(e,t))(o,c))return s=Pn(o,c),o=En(o,o.next),s=En(s,s.next),Tn(o,t,n,i,r,a),Tn(s,t,n,i,r,a);c=c.next}}while((o=o.next)!==e)})(e,t,n,i,r,a):Tn(En(e),t,n,i,r,a,1);break}}}function Mn(e,t){return e.x-t.x}function Sn(e,t,n,i,r){return(e=1431655765&((e=858993459&((e=252645135&((e=16711935&((e=32767*(e-n)*r)|e<<8))|e<<4))|e<<2))|e<<1))|(1431655765&((t=858993459&((t=252645135&((t=16711935&((t=32767*(t-i)*r)|t<<8))|t<<4))|t<<2))|t<<1))<<1}function An(e,t,n,i,r,a,o,s){return 0<=(r-o)*(t-s)-(e-o)*(a-s)&&0<=(e-o)*(i-s)-(n-o)*(t-s)&&0<=(n-o)*(a-s)-(r-o)*(i-s)}function M(e,t,n){return(t.y-e.y)*(n.x-t.x)-(t.x-e.x)*(n.y-t.y)}function Rn(e,t){return e.x===t.x&&e.y===t.y}function Cn(e,t,n,i){return Rn(e,t)&&Rn(n,i)||Rn(e,i)&&Rn(n,t)||0<M(e,t,n)!=0<M(e,t,i)&&0<M(n,i,e)!=0<M(n,i,t)}function Ln(e,t){return M(e.prev,e,e.next)<0?0<=M(e,t,e.next)&&0<=M(e,e.prev,t):M(e,t,e.prev)<0||M(e,e.next,t)<0}function Pn(e,t){var n=new In(e.i,e.x,e.y),i=new In(t.i,t.x,t.y),r=e.next,a=t.prev;return(e.next=t).prev=e,(n.next=r).prev=n,i.next=n,(a.next=n.prev=i).prev=a,i}function Nn(e,t,n,i){e=new In(e,t,n);return i?(e.next=i.next,(e.prev=i).next.prev=e,i.next=e):(e.prev=e).next=e,e}function On(e){e.next.prev=e.prev,e.prev.next=e.next,e.prevZ&&(e.prevZ.nextZ=e.nextZ),e.nextZ&&(e.nextZ.prevZ=e.prevZ)}function In(e,t,n){this.i=e,this.x=t,this.y=n,this.prev=null,this.next=null,this.z=null,this.prevZ=null,this.nextZ=null,this.steiner=!1}function Un(e,t){x.call(this),this.type="ExtrudeGeometry",this.parameters={shapes:e,options:t},this.fromBufferGeometry(new Dn(e,t)),this.mergeVertices()}function Dn(e,t){void 0!==e&&(J.call(this),this.type="ExtrudeBufferGeometry",e=Array.isArray(e)?e:[e],this.addShapeList(e,t),this.computeVertexNormals())}function Fn(e,t){x.call(this),this.type="TextGeometry",this.parameters={text:e,parameters:t},this.fromBufferGeometry(new Bn(e,t)),this.mergeVertices()}function Bn(e,t){var n=(t=t||{}).font;if(!n||!n.isFont)return console.error("THREE.TextGeometry: font parameter is not an instance of THREE.Font."),new x;n=n.generateShapes(e,t.size,t.curveSegments);t.amount=void 0!==t.height?t.height:50,void 0===t.bevelThickness&&(t.bevelThickness=10),void 0===t.bevelSize&&(t.bevelSize=8),void 0===t.bevelEnabled&&(t.bevelEnabled=!1),Dn.call(this,n,t),this.type="TextBufferGeometry"}function kn(e,t,n,i,r,a,o){x.call(this),this.type="SphereGeometry",this.parameters={radius:e,widthSegments:t,heightSegments:n,phiStart:i,phiLength:r,thetaStart:a,thetaLength:o},this.fromBufferGeometry(new Hn(e,t,n,i,r,a,o)),this.mergeVertices()}function Hn(e,t,n,i,r,a,o){J.call(this),this.type="SphereBufferGeometry",this.parameters={radius:e,widthSegments:t,heightSegments:n,phiStart:i,phiLength:r,thetaStart:a,thetaLength:o},e=e||1,t=Math.max(3,Math.floor(t)||8),n=Math.max(2,Math.floor(n)||6),i=void 0!==i?i:0,r=void 0!==r?r:2*Math.PI;for(var s=(a=void 0!==a?a:0)+(o=void 0!==o?o:Math.PI),c=0,l=[],h=new Ce,u=new Ce,d=[],p=[],f=[],m=[],g=0;g<=n;g++){for(var v=[],y=g/n,x=0;x<=t;x++){var b=x/t;h.x=-e*Math.cos(i+b*r)*Math.sin(a+y*o),h.y=e*Math.cos(a+y*o),h.z=e*Math.sin(i+b*r)*Math.sin(a+y*o),p.push(h.x,h.y,h.z),u.set(h.x,h.y,h.z).normalize(),f.push(u.x,u.y,u.z),m.push(b,1-y),v.push(c++)}l.push(v)}for(g=0;g<n;g++)for(x=0;x<t;x++){var w=l[g][x+1],_=l[g][x],E=l[g+1][x],T=l[g+1][x+1];(0!==g||0<a)&&d.push(w,_,T),(g!==n-1||s<Math.PI)&&d.push(_,E,T)}this.setIndex(d),this.addAttribute("position",new ne(p,3)),this.addAttribute("normal",new ne(f,3)),this.addAttribute("uv",new ne(m,2))}function zn(e,t,n,i,r,a){x.call(this),this.type="RingGeometry",this.parameters={innerRadius:e,outerRadius:t,thetaSegments:n,phiSegments:i,thetaStart:r,thetaLength:a},this.fromBufferGeometry(new Gn(e,t,n,i,r,a)),this.mergeVertices()}function Gn(e,t,n,i,r,a){J.call(this),this.type="RingBufferGeometry",this.parameters={innerRadius:e,outerRadius:t,thetaSegments:n,phiSegments:i,thetaStart:r,thetaLength:a},e=e||.5,t=t||1,r=void 0!==r?r:0,a=void 0!==a?a:2*Math.PI,n=void 0!==n?Math.max(3,n):8;for(var o,s=[],c=[],l=[],h=[],u=e,d=(t-e)/(i=void 0!==i?Math.max(1,i):1),p=new Ce,f=new te,m=0;m<=i;m++){for(v=0;v<=n;v++)o=r+v/n*a,p.x=u*Math.cos(o),p.y=u*Math.sin(o),c.push(p.x,p.y,p.z),l.push(0,0,1),f.x=(p.x/t+1)/2,f.y=(p.y/t+1)/2,h.push(f.x,f.y);u+=d}for(m=0;m<i;m++)for(var g=m*(n+1),v=0;v<n;v++){var y=o=v+g,x=o+n+1,b=o+n+2,w=o+1;s.push(y,x,w),s.push(x,b,w)}this.setIndex(s),this.addAttribute("position",new ne(c,3)),this.addAttribute("normal",new ne(l,3)),this.addAttribute("uv",new ne(h,2))}function Vn(e,t,n,i){x.call(this),this.type="LatheGeometry",this.parameters={points:e,segments:t,phiStart:n,phiLength:i},this.fromBufferGeometry(new jn(e,t,n,i)),this.mergeVertices()}function jn(e,t,n,i){J.call(this),this.type="LatheBufferGeometry",this.parameters={points:e,segments:t,phiStart:n,phiLength:i},t=Math.floor(t)||12,n=n||0,i=i||2*Math.PI,i=Pe.clamp(i,0,2*Math.PI);var r=[],a=[],o=[],s=1/t,c=new Ce,l=new te;for(E=0;E<=t;E++)for(var h=n+E*s*i,u=Math.sin(h),d=Math.cos(h),p=0;p<=e.length-1;p++)c.x=e[p].x*u,c.y=e[p].y,c.z=e[p].x*d,a.push(c.x,c.y,c.z),l.x=E/t,l.y=p/(e.length-1),o.push(l.x,l.y);for(E=0;E<t;E++)for(p=0;p<e.length-1;p++){var f=_=p+E*e.length,m=_+e.length,g=_+e.length+1,v=_+1;r.push(f,m,v),r.push(m,g,v)}if(this.setIndex(r),this.addAttribute("position",new ne(a,3)),this.addAttribute("uv",new ne(o,2)),this.computeVertexNormals(),i===2*Math.PI){var y=this.attributes.normal.array,x=new Ce,b=new Ce,w=new Ce,_=t*e.length*3,E=0;for(p=0;E<e.length;E++,p+=3)x.x=y[p+0],x.y=y[p+1],x.z=y[p+2],b.x=y[_+p+0],b.y=y[_+p+1],b.z=y[_+p+2],w.addVectors(x,b).normalize(),y[p+0]=y[_+p+0]=w.x,y[p+1]=y[_+p+1]=w.y,y[p+2]=y[_+p+2]=w.z}}function Wn(e,t){x.call(this),this.type="ShapeGeometry","object"==Xh(t)&&(console.warn("THREE.ShapeGeometry: Options parameter has been removed."),t=t.curveSegments),this.parameters={shapes:e,curveSegments:t},this.fromBufferGeometry(new Xn(e,t)),this.mergeVertices()}function Xn(e,u){J.call(this),this.type="ShapeBufferGeometry",this.parameters={shapes:e,curveSegments:u},u=u||12;var d=[],p=[],f=[],m=[],t=0,g=0;if(!1===Array.isArray(e))i(e);else for(var n=0;n<e.length;n++)i(e[n]),this.addGroup(t,g,n),t+=g,g=0;function i(e){var t,n=p.length/3,e=e.extractPoints(u),i=e.shape,r=e.holes;if(!1===Pl.isClockWise(i))for(i=i.reverse(),o=0,s=r.length;o<s;o++)t=r[o],!0===Pl.isClockWise(t)&&(r[o]=t.reverse());for(var a=Pl.triangulateShape(i,r),o=0,s=r.length;o<s;o++)t=r[o],i=i.concat(t);for(o=0,s=i.length;o<s;o++){var c=i[o];p.push(c.x,c.y,0),f.push(0,0,1),m.push(c.x,c.y)}for(o=0,s=a.length;o<s;o++){var l=a[o],h=l[0]+n;d.push(h,l[1]+n,l[2]+n),g+=3}}this.setIndex(d),this.addAttribute("position",new ne(p,3)),this.addAttribute("normal",new ne(f,3)),this.addAttribute("uv",new ne(m,2))}function qn(e,t){if(t.shapes=[],Array.isArray(e))for(var n=0,i=e.length;n<i;n++){var r=e[n];t.shapes.push(r.uuid)}else t.shapes.push(e.uuid);return t}function Yn(e,t){J.call(this),this.type="EdgesGeometry",this.parameters={thresholdAngle:t},t=void 0!==t?t:1;var n,i,r,a,o=[],s=Math.cos(Pe.DEG2RAD*t),c=[0,0],l={},h=["a","b","c"];e.isBufferGeometry?(a=new x).fromBufferGeometry(e):a=e.clone(),a.mergeVertices(),a.computeFaceNormals();for(var u=a.vertices,d=a.faces,p=0,f=d.length;p<f;p++)for(var m=d[p],g=0;g<3;g++)n=m[h[g]],i=m[h[(g+1)%3]],c[0]=Math.min(n,i),c[1]=Math.max(n,i),void 0===l[r=c[0]+","+c[1]]?l[r]={index1:c[0],index2:c[1],face1:p,face2:void 0}:l[r].face2=p;for(r in l){var v,y=l[r];(void 0===y.face2||d[y.face1].normal.dot(d[y.face2].normal)<=s)&&(v=u[y.index1],o.push(v.x,v.y,v.z),v=u[y.index2],o.push(v.x,v.y,v.z))}this.addAttribute("position",new ne(o,3))}function Zn(e,t,n,i,r,a,o,s){x.call(this),this.type="CylinderGeometry",this.parameters={radiusTop:e,radiusBottom:t,height:n,radialSegments:i,heightSegments:r,openEnded:a,thetaStart:o,thetaLength:s},this.fromBufferGeometry(new Jn(e,t,n,i,r,a,o,s)),this.mergeVertices()}function Jn(p,f,e,m,t,n,g,v){J.call(this),this.type="CylinderBufferGeometry",this.parameters={radiusTop:p,radiusBottom:f,height:e,radialSegments:m,heightSegments:t,openEnded:n,thetaStart:g,thetaLength:v};var y=this,x=(p=void 0!==p?p:1,f=void 0!==f?f:1,e=e||1,m=Math.floor(m)||8,t=Math.floor(t)||1,n=void 0!==n&&n,g=void 0!==g?g:0,v=void 0!==v?v:2*Math.PI,[]),b=[],w=[],_=[],E=0,i=[],T=e/2,M=0;function r(e){for(var t,n=new te,i=new Ce,r=0,a=!0===e?p:f,o=!0===e?1:-1,s=E,c=1;c<=m;c++)b.push(0,T*o,0),w.push(0,o,0),_.push(.5,.5),E++;for(t=E,c=0;c<=m;c++){var l=c/m*v+g,h=Math.cos(l),l=Math.sin(l);i.x=a*l,i.y=T*o,i.z=a*h,b.push(i.x,i.y,i.z),w.push(0,o,0),n.x=.5*h+.5,n.y=.5*l*o+.5,_.push(n.x,n.y),E++}for(c=0;c<m;c++){var u=s+c,d=t+c;!0===e?x.push(d,d+1,u):x.push(d+1,d,u),r+=3}y.addGroup(M,r,!0===e?1:2),M+=r}for(var a=new Ce,o=new Ce,s=0,c=(f-p)/e,l=0;l<=t;l++){for(var h=[],u=l/t,d=u*(f-p)+p,S=0;S<=m;S++){var A=S/m,R=A*v+g,C=Math.sin(R),R=Math.cos(R);o.x=d*C,o.y=-u*e+T,o.z=d*R,b.push(o.x,o.y,o.z),a.set(C,c,R).normalize(),w.push(a.x,a.y,a.z),_.push(A,1-u),h.push(E++)}i.push(h)}for(S=0;S<m;S++)for(l=0;l<t;l++){var L=i[l][S],P=i[l+1][S],N=i[l+1][S+1],O=i[l][S+1];x.push(L,P,O),x.push(P,N,O),s+=6}y.addGroup(M,s,0),M+=s,!1===n&&(0<p&&r(!0),0<f)&&r(!1),this.setIndex(x),this.addAttribute("position",new ne(b,3)),this.addAttribute("normal",new ne(w,3)),this.addAttribute("uv",new ne(_,2))}function Kn(e,t,n,i,r,a,o){Zn.call(this,0,e,t,n,i,r,a,o),this.type="ConeGeometry",this.parameters={radius:e,height:t,radialSegments:n,heightSegments:i,openEnded:r,thetaStart:a,thetaLength:o}}function Qn(e,t,n,i,r,a,o){Jn.call(this,0,e,t,n,i,r,a,o),this.type="ConeBufferGeometry",this.parameters={radius:e,height:t,radialSegments:n,heightSegments:i,openEnded:r,thetaStart:a,thetaLength:o}}function $n(e,t,n,i){x.call(this),this.type="CircleGeometry",this.parameters={radius:e,segments:t,thetaStart:n,thetaLength:i},this.fromBufferGeometry(new ei(e,t,n,i)),this.mergeVertices()}function ei(e,t,n,i){J.call(this),this.type="CircleBufferGeometry",this.parameters={radius:e,segments:t,thetaStart:n,thetaLength:i},e=e||1,t=void 0!==t?Math.max(3,t):8,n=void 0!==n?n:0,i=void 0!==i?i:2*Math.PI;var r,a,o=[],s=[],c=[],l=[],h=new Ce,u=new te;for(s.push(0,0,0),c.push(0,0,1),l.push(.5,.5),a=0,r=3;a<=t;a++,r+=3){var d=n+a/t*i;h.x=e*Math.cos(d),h.y=e*Math.sin(d),s.push(h.x,h.y,h.z),c.push(0,0,1),u.x=(s[r]/e+1)/2,u.y=(s[r+1]/e+1)/2,l.push(u.x,u.y)}for(r=1;r<=t;r++)o.push(r,r+1,0);this.setIndex(o),this.addAttribute("position",new ne(s,3)),this.addAttribute("normal",new ne(c,3)),this.addAttribute("uv",new ne(l,2))}function ti(e){t.call(this),this.type="ShadowMaterial",this.color=new N(0),this.opacity=1,this.lights=!0,this.transparent=!0,this.setValues(e)}function ni(e){et.call(this,e),this.type="RawShaderMaterial"}function ii(e){t.call(this),this.defines={STANDARD:""},this.type="MeshStandardMaterial",this.color=new N(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 N(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalScale=new te(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.roughnessMap=null,this.metalnessMap=null,this.alphaMap=null,this.envMap=null,this.envMapIntensity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.skinning=!1,this.morphTargets=!1,this.morphNormals=!1,this.setValues(e)}function ri(e){ii.call(this),this.defines={PHYSICAL:""},this.type="MeshPhysicalMaterial",this.reflectivity=.5,this.clearCoat=0,this.clearCoatRoughness=0,this.setValues(e)}function ai(e){t.call(this),this.type="MeshPhongMaterial",this.color=new N(16777215),this.specular=new N(1118481),this.shininess=30,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new N(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalScale=new te(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.combine=no,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.skinning=!1,this.morphTargets=!1,this.morphNormals=!1,this.setValues(e)}function oi(e){ai.call(this),this.defines={TOON:""},this.type="MeshToonMaterial",this.gradientMap=null,this.setValues(e)}function si(e){t.call(this),this.type="MeshNormalMaterial",this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalScale=new te(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(e)}function ci(e){t.call(this),this.type="MeshLambertMaterial",this.color=new N(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new N(0),this.emissiveIntensity=1,this.emissiveMap=null,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.combine=no,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.skinning=!1,this.morphTargets=!1,this.morphNormals=!1,this.setValues(e)}function li(e){v.call(this),this.type="LineDashedMaterial",this.scale=1,this.dashSize=3,this.gapSize=1,this.setValues(e)}function hi(e,t,n){var i=this,r=!1,a=0,o=0,s=void 0;this.onStart=void 0,this.onLoad=e,this.onProgress=t,this.onError=n,this.itemStart=function(e){o++,!1===r&&void 0!==i.onStart&&i.onStart(e,a,o),r=!0},this.itemEnd=function(e){a++,void 0!==i.onProgress&&i.onProgress(e,a,o),a===o&&(r=!1,void 0!==i.onLoad)&&i.onLoad()},this.itemError=function(e){void 0!==i.onError&&i.onError(e)},this.resolveURL=function(e){return s?s(e):e},this.setURLModifier=function(e){return s=e,this}}function ui(e){this.manager=void 0!==e?e:a}function di(e){this.manager=void 0!==e?e:a,this._parser=null}function pi(e){this.manager=void 0!==e?e:a,this._parser=null}function fi(e){this.manager=void 0!==e?e:a}function mi(e){this.manager=void 0!==e?e:a}function gi(e){this.manager=void 0!==e?e:a}function c(){this.type="Curve",this.arcLengthDivisions=200}function vi(e,t,n,i,r,a,o,s){c.call(this),this.type="EllipseCurve",this.aX=e||0,this.aY=t||0,this.xRadius=n||1,this.yRadius=i||1,this.aStartAngle=r||0,this.aEndAngle=a||2*Math.PI,this.aClockwise=o||!1,this.aRotation=s||0}function yi(e,t,n,i,r,a){vi.call(this,e,t,n,n,i,r,a),this.type="ArcCurve"}function xi(){var r=0,a=0,o=0,s=0;function c(e,t,n,i){o=-3*(r=e)+3*t-2*(a=n)-i,s=2*e-2*t+n+i}return{initCatmullRom:function(e,t,n,i,r){c(t,n,r*(n-e),r*(i-t))},initNonuniformCatmullRom:function(e,t,n,i,r,a,o){e=(t-e)/r-(n-e)/(r+a)+(n-t)/a,r=(n-t)/a-(i-t)/(a+o)+(i-n)/o;c(t,n,e*=a,r*=a)},calc:function(e){var t=e*e;return r+a*e+o*t+s*(t*e)}}}function n(e,t,n,i){c.call(this),this.type="CatmullRomCurve3",this.points=e||[],this.closed=t||!1,this.curveType=n||"centripetal",this.tension=i||.5}function bi(e,t,n,i,r){var t=.5*(i-t),r=.5*(r-n),a=e*e;return(2*n-2*i+t+r)*(e*a)+(-3*n+3*i-2*t-r)*a+t*e+n}function wi(e,t,n,i){return(r=1-e)*r*t+2*(1-e)*e*n+e*e*i;var r}function _i(e,t,n,i,r){return(a=1-e)*a*a*t+3*(a=1-e)*a*e*n+3*(1-e)*e*e*i+e*e*e*r;var a}function Ei(e,t,n,i){c.call(this),this.type="CubicBezierCurve",this.v0=e||new te,this.v1=t||new te,this.v2=n||new te,this.v3=i||new te}function Ti(e,t,n,i){c.call(this),this.type="CubicBezierCurve3",this.v0=e||new Ce,this.v1=t||new Ce,this.v2=n||new Ce,this.v3=i||new Ce}function Mi(e,t){c.call(this),this.type="LineCurve",this.v1=e||new te,this.v2=t||new te}function Si(e,t){c.call(this),this.type="LineCurve3",this.v1=e||new Ce,this.v2=t||new Ce}function Ai(e,t,n){c.call(this),this.type="QuadraticBezierCurve",this.v0=e||new te,this.v1=t||new te,this.v2=n||new te}function Ri(e,t,n){c.call(this),this.type="QuadraticBezierCurve3",this.v0=e||new Ce,this.v1=t||new Ce,this.v2=n||new Ce}function Ci(e){c.call(this),this.type="SplineCurve",this.points=e||[]}function Li(){c.call(this),this.type="CurvePath",this.curves=[],this.autoClose=!1}function Pi(e){Li.call(this),this.type="Path",this.currentPoint=new te,e&&this.setFromPoints(e)}function Ni(e){Pi.call(this,e),this.uuid=Pe.generateUUID(),this.type="Shape",this.holes=[]}function o(e,t){f.call(this),this.type="Light",this.color=new N(e),this.intensity=void 0!==t?t:1,this.receiveShadow=void 0}function Oi(e,t,n){o.call(this,e,n),this.type="HemisphereLight",this.castShadow=void 0,this.position.copy(f.DefaultUp),this.updateMatrix(),this.groundColor=new N(t)}function Ii(e){this.camera=e,this.bias=0,this.radius=1,this.mapSize=new te(512,512),this.map=null,this.matrix=new Re}function Ui(){Ii.call(this,new g(50,1,.5,500))}function Di(e,t,n,i,r,a){o.call(this,e,t),this.type="SpotLight",this.position.copy(f.DefaultUp),this.updateMatrix(),this.target=new f,Object.defineProperty(this,"power",{get:function(){return this.intensity*Math.PI},set:function(e){this.intensity=e/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!==a?a:1,this.shadow=new Ui}function Fi(e,t,n,i){o.call(this,e,t),this.type="PointLight",Object.defineProperty(this,"power",{get:function(){return 4*this.intensity*Math.PI},set:function(e){this.intensity=e/(4*Math.PI)}}),this.distance=void 0!==n?n:0,this.decay=void 0!==i?i:1,this.shadow=new Ii(new g(90,1,.5,500))}function Bi(){Ii.call(this,new Me(-5,5,5,-5,.5,500))}function ki(e,t){o.call(this,e,t),this.type="DirectionalLight",this.position.copy(f.DefaultUp),this.updateMatrix(),this.target=new f,this.shadow=new Bi}function Hi(e,t){o.call(this,e,t),this.type="AmbientLight",this.castShadow=void 0}function zi(e,t,n,i){o.call(this,e,t),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}function Gi(e,t,n,i){s.call(this,e,t,n,i)}function Vi(e,t,n){s.call(this,e,t,n)}function ji(e,t,n,i){this.parameterPositions=e,this._cachedIndex=0,this.resultBuffer=void 0!==i?i:new t.constructor(n),this.sampleValues=t,this.valueSize=n}function Wi(e,t,n,i){ji.call(this,e,t,n,i)}function Xi(e,t,n,i){s.call(this,e,t,n,i)}function qi(e,t,n,i){s.call(this,e,t,n,i)}function Yi(e,t,n,i){s.call(this,e,t,n,i)}function Zi(e,t,n,i){ji.call(this,e,t,n,i),this._weightPrev=-0,this._offsetPrev=-0,this._weightNext=-0,this._offsetNext=-0}function Ji(e,t,n,i){ji.call(this,e,t,n,i)}function Ki(e,t,n,i){ji.call(this,e,t,n,i)}function s(e,t,n,i){if(void 0===e)throw new Error("THREE.KeyframeTrack: track name is undefined");if(void 0===t||0===t.length)throw new Error("THREE.KeyframeTrack: no keyframes in track named "+e);this.name=e,this.times=T.convertArray(t,this.TimeBufferType),this.values=T.convertArray(n,this.ValueBufferType),this.setInterpolation(i||this.DefaultInterpolation),this.validate(),this.optimize()}function Qi(e,t,n,i){s.call(this,e,t,n,i)}function $i(e,t,n){this.name=e,this.tracks=n,this.duration=void 0!==t?t:-1,this.uuid=Pe.generateUUID(),this.duration<0&&this.resetDuration(),this.optimize()}function er(e){this.manager=void 0!==e?e:a,this.textures={}}function tr(e){this.manager=void 0!==e?e:a}function nr(){this.onLoadStart=function(){},this.onLoadProgress=function(){},this.onLoadComplete=function(){}}function ir(e){"boolean"==typeof e&&(console.warn("THREE.JSONLoader: showStatus parameter has been removed from constructor."),e=void 0),this.manager=void 0!==e?e:a,this.withCredentials=!1}function rr(e){this.manager=void 0!==e?e:a,this.texturePath=""}function ar(e){"undefined"==typeof createImageBitmap&&console.warn("THREE.ImageBitmapLoader: createImageBitmap() not supported."),"undefined"==typeof fetch&&console.warn("THREE.ImageBitmapLoader: fetch() not supported."),this.manager=void 0!==e?e:a,this.options=void 0}function or(){this.type="ShapePath",this.subPaths=[],this.currentPath=null}function sr(e){this.type="Font",this.data=e}function cr(e){this.manager=void 0!==e?e:a}function lr(e){this.manager=void 0!==e?e:a}function hr(){this.type="StereoCamera",this.aspect=1,this.eyeSep=.064,this.cameraL=new g,this.cameraL.layers.enable(1),this.cameraL.matrixAutoUpdate=!1,this.cameraR=new g,this.cameraR.layers.enable(2),this.cameraR.matrixAutoUpdate=!1}function ur(e,t,n){f.call(this),this.type="CubeCamera";var r=new g(90,1,e,t),a=(r.up.set(0,-1,0),r.lookAt(new Ce(1,0,0)),this.add(r),new g(90,1,e,t)),o=(a.up.set(0,-1,0),a.lookAt(new Ce(-1,0,0)),this.add(a),new g(90,1,e,t)),s=(o.up.set(0,0,1),o.lookAt(new Ce(0,1,0)),this.add(o),new g(90,1,e,t)),c=(s.up.set(0,0,-1),s.lookAt(new Ce(0,-1,0)),this.add(s),new g(90,1,e,t)),l=(c.up.set(0,-1,0),c.lookAt(new Ce(0,0,1)),this.add(c),new g(90,1,e,t)),e=(l.up.set(0,-1,0),l.lookAt(new Ce(0,0,-1)),this.add(l),{format:Fo,magFilter:C,minFilter:C});this.renderTarget=new P(n,n,e),this.renderTarget.texture.name="CubeCamera",this.update=function(e,t){null===this.parent&&this.updateMatrixWorld();var n=this.renderTarget,i=n.texture.generateMipmaps;n.texture.generateMipmaps=!1,n.activeCubeFace=0,e.render(t,r,n),n.activeCubeFace=1,e.render(t,a,n),n.activeCubeFace=2,e.render(t,o,n),n.activeCubeFace=3,e.render(t,s,n),n.activeCubeFace=4,e.render(t,c,n),n.texture.generateMipmaps=i,n.activeCubeFace=5,e.render(t,l,n),e.setRenderTarget(null)},this.clear=function(e,t,n,i){for(var r=this.renderTarget,a=0;a<6;a++)r.activeCubeFace=a,e.setRenderTarget(r),e.clear(t,n,i);e.setRenderTarget(null)}}function dr(){f.call(this),this.type="AudioListener",this.context=zh.getContext(),this.gain=this.context.createGain(),this.gain.connect(this.context.destination),this.filter=null}function pr(e){f.call(this),this.type="Audio",this.context=e.context,this.gain=this.context.createGain(),this.gain.connect(e.getInput()),this.autoplay=!1,this.buffer=null,this.loop=!1,this.startTime=0,this.offset=0,this.playbackRate=1,this.isPlaying=!1,this.hasPlaybackControl=!0,this.sourceType="empty",this.filters=[]}function fr(e){pr.call(this,e),this.panner=this.context.createPanner(),this.panner.connect(this.gain)}function mr(e,t){this.analyser=e.context.createAnalyser(),this.analyser.fftSize=void 0!==t?t:2048,this.data=new Uint8Array(this.analyser.frequencyBinCount),e.getOutput().connect(this.analyser)}function gr(e,t,n){this.binding=e,this.valueSize=n;var i,r=Float64Array;switch(t){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 vr(e,t,n){n=n||_.parseTrackName(t);this._targetGroup=e,this._bindings=e.subscribe_(t,n)}function _(e,t,n){this.path=t,this.parsedPath=n||_.parseTrackName(t),this.node=_.findNode(e,this.parsedPath.nodeName)||e,this.rootNode=e}function yr(){this.uuid=Pe.generateUUID(),this._objects=Array.prototype.slice.call(arguments),this.nCachedObjects_=0;var e={};this._indicesByUUID=e;for(var t=0,n=arguments.length;t!==n;++t)e[arguments[t].uuid]=t;this._paths=[],this._parsedPaths=[],this._bindings=[],this._bindingsIndicesByPath={};var i=this;this.stats={objects:{get total(){return i._objects.length},get inUse(){return this.total-i.nCachedObjects_}},get bindingsPerObject(){return i._bindings.length}}}function xr(e,t,n){this._mixer=e,this._clip=t,this._localRoot=n||null;for(var i=t.tracks,r=i.length,a=new Array(r),o={endingStart:$o,endingEnd:$o},s=0;s!==r;++s){var c=i[s].createInterpolant(null);(a[s]=c).settings=o}this._interpolantSettings=o,this._interpolants=a,this._propertyBindings=new Array(r),this._cacheIndex=null,this._byClipCacheIndex=null,this._timeScaleInterpolant=null,this._weightInterpolant=null,this.loop=2201,this._loopCount=-1,this._startTime=null,this.time=0,this.timeScale=1,this._effectiveTimeScale=1,this.weight=1,this._effectiveWeight=1,this.repetitions=1/0,this.paused=!1,this.enabled=!0,this.clampWhenFinished=!1,this.zeroSlopeAtStart=!0,this.zeroSlopeAtEnd=!0}function br(e){this._root=e,this._initMemoryManager(),this._accuIndex=0,this.time=0,this.timeScale=1}function wr(e){"string"==typeof e&&(console.warn("THREE.Uniform: Type parameter is no longer needed."),e=arguments[1]),this.value=e}function _r(){J.call(this),this.type="InstancedBufferGeometry",this.maxInstancedCount=void 0}function Er(e,t,n,i){this.uuid=Pe.generateUUID(),this.data=e,this.itemSize=t,this.offset=n,this.normalized=!0===i}function Tr(e,t){this.uuid=Pe.generateUUID(),this.array=e,this.stride=t,this.count=void 0!==e?e.length/t:0,this.dynamic=!1,this.updateRange={offset:0,count:-1},this.onUploadCallback=function(){},this.version=0}function Mr(e,t,n){Tr.call(this,e,t),this.meshPerAttribute=n||1}function Sr(e,t,n){w.call(this,e,t),this.meshPerAttribute=n||1}function Ar(e,t,n,i){this.ray=new tt(e,t),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 Rr(e,t){return e.distance-t.distance}function Cr(e,t,n,i){if(!1!==e.visible&&(e.raycast(t,n),!0===i))for(var r=e.children,a=0,o=r.length;a<o;a++)Cr(r[a],t,n,!0)}function Lr(e){this.autoStart=void 0===e||e,this.startTime=0,this.oldTime=0,this.elapsedTime=0,this.running=!1}function Pr(e,t,n){return this.radius=void 0!==e?e:1,this.phi=void 0!==t?t:0,this.theta=void 0!==n?n:0,this}function Nr(e,t,n){return this.radius=void 0!==e?e:1,this.theta=void 0!==t?t:0,this.y=void 0!==n?n:0,this}function Or(e){f.call(this),this.material=e,this.render=function(){}}function Ir(e,t,n,i){this.object=e,this.size=void 0!==t?t:1;e=void 0!==n?n:16711680,t=void 0!==i?i:1,n=0,i=this.object.geometry,i&&i.isGeometry?n=3*i.faces.length:i&&i.isBufferGeometry&&(n=i.attributes.normal.count),i=new J,n=new ne(2*n*3,3);i.addAttribute("position",n),b.call(this,i,new v({color:e,linewidth:t})),this.matrixAutoUpdate=!1,this.update()}function Ur(e,t){f.call(this),this.light=e,this.light.updateMatrixWorld(),this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1,this.color=t;for(var e=new J,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 a=i/32*Math.PI*2,o=r/32*Math.PI*2;n.push(Math.cos(a),Math.sin(a),1,Math.cos(o),Math.sin(o),1)}e.addAttribute("position",new ne(n,3));t=new v({fog:!1});this.cone=new b(e,t),this.add(this.cone),this.update()}function Dr(e){for(var t=function e(t){var n=[];t&&t.isBone&&n.push(t);for(var i=0;i<t.children.length;i++)n.push.apply(n,e(t.children[i]));return n}(e),n=new J,i=[],r=[],a=new N(0,0,1),o=new N(0,1,0),s=0;s<t.length;s++){var c=t[s];c.parent&&c.parent.isBone&&(i.push(0,0,0),i.push(0,0,0),r.push(a.r,a.g,a.b),r.push(o.r,o.g,o.b))}n.addAttribute("position",new ne(i,3)),n.addAttribute("color",new ne(r,3));var l=new v({vertexColors:2,depthTest:!1,depthWrite:!1,transparent:!0});b.call(this,n,l),this.root=e,this.bones=t,this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1}function Fr(e,t,n){this.light=e,this.light.updateMatrixWorld(),this.color=n;e=new Hn(t,4,2),n=new $e({wireframe:!0,fog:!1});m.call(this,e,n),this.matrix=this.light.matrixWorld,this.matrixAutoUpdate=!1,this.update()}function Br(e,t){f.call(this),this.light=e,this.light.updateMatrixWorld(),this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1,this.color=t;e=new v({fog:!1}),t=new J;t.addAttribute("position",new w(new Float32Array(15),3)),this.line=new y(t,e),this.add(this.line),this.update()}function kr(e,t,n){f.call(this),this.light=e,this.light.updateMatrixWorld(),this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1,this.color=n;e=new un(t),e.rotateY(.5*Math.PI),this.material=new $e({wireframe:!0,fog:!1}),void 0===this.color&&(this.material.vertexColors=2),n=e.getAttribute("position"),t=new Float32Array(3*n.count);e.addAttribute("color",new w(t,3)),this.add(new m(e,this.material)),this.update()}function Hr(e,t,n,i){e=e||10,t=t||10,n=new N(void 0!==n?n:4473924),i=new N(void 0!==i?i:8947848);for(var r=t/2,a=e/t,o=e/2,s=[],c=[],l=0,h=0,u=-o;l<=t;l++,u+=a){s.push(-o,0,u,o,0,u),s.push(u,0,-o,u,0,o);var d=l===r?n:i;d.toArray(c,h),h+=3,d.toArray(c,h),h+=3,d.toArray(c,h),h+=3,d.toArray(c,h),h+=3}var e=new J,p=(e.addAttribute("position",new ne(s,3)),e.addAttribute("color",new ne(c,3)),new v({vertexColors:2}));b.call(this,e,p)}function zr(e,t,n,i,r,a){e=e||10,t=t||16,n=n||8,i=i||64,r=new N(void 0!==r?r:4473924),a=new N(void 0!==a?a:8947848);for(var o,s,c,l,h,u,d=[],p=[],f=0;f<=t;f++)c=f/t*(2*Math.PI),o=Math.sin(c)*e,s=Math.cos(c)*e,d.push(0,0,0),d.push(o,0,s),p.push((u=1&f?r:a).r,u.g,u.b),p.push(u.r,u.g,u.b);for(f=0;f<=n;f++)for(u=1&f?r:a,h=e-e/n*f,l=0;l<i;l++)c=l/i*(2*Math.PI),o=Math.sin(c)*h,s=Math.cos(c)*h,d.push(o,0,s),p.push(u.r,u.g,u.b),c=(l+1)/i*(2*Math.PI),o=Math.sin(c)*h,s=Math.cos(c)*h,d.push(o,0,s),p.push(u.r,u.g,u.b);var m=new J,g=(m.addAttribute("position",new ne(d,3)),m.addAttribute("color",new ne(p,3)),new v({vertexColors:2}));b.call(this,m,g)}function Gr(e,t,n,i){this.object=e,this.size=void 0!==t?t:1;e=void 0!==n?n:16776960,t=void 0!==i?i:1,n=0,i=this.object.geometry,i&&i.isGeometry?n=i.faces.length:console.warn("THREE.FaceNormalsHelper: only THREE.Geometry is supported. Use THREE.VertexNormalsHelper, instead."),i=new J,n=new ne(2*n*3,3);i.addAttribute("position",n),b.call(this,i,new v({color:e,linewidth:t})),this.matrixAutoUpdate=!1,this.update()}function Vr(e,t,n){f.call(this),this.light=e,this.light.updateMatrixWorld(),this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1,this.color=n,void 0===t&&(t=1);e=new J,e.addAttribute("position",new ne([-t,t,0,t,t,0,t,-t,0,-t,-t,0,-t,t,0],3)),n=new v({fog:!1});this.lightPlane=new y(e,n),this.add(this.lightPlane),(e=new J).addAttribute("position",new ne([0,0,0,0,0,1],3)),this.targetLine=new y(e,n),this.add(this.targetLine),this.update()}function jr(e){var t=new J,n=new v({color:16777215,vertexColors:1}),i=[],r=[],a={},o=new N(16755200),s=new N(16711680),c=new N(43775),l=new N(16777215),h=new N(3355443);function u(e,t,n){d(e,n),d(t,n)}function d(e,t){i.push(0,0,0),r.push(t.r,t.g,t.b),void 0===a[e]&&(a[e]=[]),a[e].push(i.length/3-1)}u("n1","n2",o),u("n2","n4",o),u("n4","n3",o),u("n3","n1",o),u("f1","f2",o),u("f2","f4",o),u("f4","f3",o),u("f3","f1",o),u("n1","f1",o),u("n2","f2",o),u("n3","f3",o),u("n4","f4",o),u("p","n1",s),u("p","n2",s),u("p","n3",s),u("p","n4",s),u("u1","u2",c),u("u2","u3",c),u("u3","u1",c),u("c","t",l),u("p","c",h),u("cn1","cn2",h),u("cn3","cn4",h),u("cf1","cf2",h),u("cf3","cf4",h),t.addAttribute("position",new ne(i,3)),t.addAttribute("color",new ne(r,3)),b.call(this,t,n),this.camera=e,this.camera.updateProjectionMatrix&&this.camera.updateProjectionMatrix(),this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1,this.pointMap=a,this.update()}function Wr(e,t){this.object=e,void 0===t&&(t=16776960);var e=new Uint16Array([0,1,1,2,2,3,3,0,4,5,5,6,6,7,7,4,0,4,1,5,2,6,3,7]),n=new Float32Array(24),i=new J;i.setIndex(new w(e,1)),i.addAttribute("position",new w(n,3)),b.call(this,i,new v({color:t})),this.matrixAutoUpdate=!1,this.update()}function Xr(e,t){this.type="Box3Helper",this.box=e;var e=void 0!==t?t:16776960,t=new Uint16Array([0,1,1,2,2,3,3,0,4,5,5,6,6,7,7,4,0,4,1,5,2,6,3,7]),n=new J;n.setIndex(new w(t,1)),n.addAttribute("position",new ne([1,1,1,-1,1,1,-1,-1,1,1,-1,1,1,1,-1,-1,1,-1,-1,-1,-1,1,-1,-1],3)),b.call(this,n,new v({color:e})),this.geometry.computeBoundingSphere()}function qr(e,t,n){this.type="PlaneHelper",this.plane=e,this.size=void 0===t?1:t;e=void 0!==n?n:16776960,t=new J,t.addAttribute("position",new ne([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,0,1,0,0,0],3)),t.computeBoundingSphere(),y.call(this,t,new v({color:e})),n=new J;n.addAttribute("position",new ne([1,1,1,-1,1,1,-1,-1,1,1,1,1,-1,-1,1,1,-1,1],3)),n.computeBoundingSphere(),this.add(new m(n,new $e({color:e,opacity:.2,transparent:!0,depthWrite:!1})))}function Yr(e,t,n,i,r,a){f.call(this),void 0===i&&(i=16776960),void 0===n&&(n=1),void 0===r&&(r=.2*n),void 0===a&&(a=.2*r),void 0===Ql&&((Ql=new J).addAttribute("position",new ne([0,0,0,0,1,0],3)),($l=new Jn(0,.5,1,5,1)).translate(0,-.5,0)),this.position.copy(t),this.line=new y(Ql,new v({color:i})),this.line.matrixAutoUpdate=!1,this.add(this.line),this.cone=new m($l,new $e({color:i})),this.cone.matrixAutoUpdate=!1,this.add(this.cone),this.setDirection(e),this.setLength(n,r,a)}function Zr(e){var e=[0,0,0,e=e||1,0,0,0,0,0,0,e,0,0,0,0,0,0,e],t=new J,e=(t.addAttribute("position",new ne(e,3)),t.addAttribute("color",new ne([1,0,0,1,.6,0,0,1,0,.6,1,0,0,0,1,0,.6,1],3)),new v({vertexColors:2}));b.call(this,t,e)}function i(e,t,n,i){vh.set(t,n,i).unproject(yh);var r=gh[e];if(void 0!==r)for(var a=mh.getAttribute("position"),o=0,s=r.length;o<s;o++)a.setXYZ(r[o],vh.x,vh.y,vh.z)}function Jr(e){console.warn("THREE.ClosedSplineCurve3 has been deprecated. Use THREE.CatmullRomCurve3 instead."),n.call(this,e),this.type="catmullrom",this.closed=!0}function Kr(e){console.warn("THREE.SplineCurve3 has been deprecated. Use THREE.CatmullRomCurve3 instead."),n.call(this,e),this.type="catmullrom"}function Qr(e){console.warn("THREE.Spline has been removed. Use THREE.CatmullRomCurve3 instead."),n.call(this,e),this.type="catmullrom"}var $r,ea,ta,na,ia,r,ra,aa,oa,sa,ca,la,ha,ua,da,pa,fa,ma,ga,va,ya,xa,ba,wa,_a,Ea,Ta,Ma,Sa,Aa,Ra,Ca,La,Pa,Na,Oa,Ia,Ua,Da,Fa,Ba,ka,Ha,za,Ga,Va,ja,Wa,Xa,qa,Ya,Za,Ja,Ka,Qa,$a,eo,to,no,io,ro,ao,oo,so,co,lo,ho,uo,po,fo,mo,go,vo,yo,A,xo,R,bo,wo,C,_o,Eo,To,Mo,So,Ao,Ro,Co,Lo,Po,No,Oo,Io,Uo,Do,Fo,Bo,ko,Ho,zo,Go,Vo,jo,Wo,Xo,qo,Yo,Zo,Jo,Ko,Qo,$o,es,ts,ns,is,rs,as,os,ss,cs,ls,Pe,hs,us,ds,ps,fs,ms,gs,vs,ys,xs,bs,ws,_s,Ne,Es,E,Ts,Ms,Ss,As,Rs,Cs,Ls,Ps,Ns,Os,Is,Us,Ds,Fs,Bs,ks,Hs,zs,Gs,Vs,js,Ws,Xs,qs,Ys,Zs,Js,Ks,Qs,$s,ec,tc,nc,ic,rc,ac,oc,sc,cc,lc,hc,uc,dc,pc,fc,mc,gc,vc,yc,xc,bc,wc,_c,Ec,Tc,Mc,Sc,Ac,Rc,Cc,Lc,Pc,Nc,Oc,Ic,Uc,Dc,Fc,Bc,kc,Hc,zc,Gc,Vc,jc,Wc,Xc,qc,Yc,Zc,Jc,Kc,Qc,$c,el,tl,nl,il,rl,al,ol,sl,cl,ll,hl,ul,dl,pl,fl,ml,gl,vl,yl,xl,bl,wl,_l,El,Tl,Ml,Sl,Al,Rl,Cl,Ll,Pl,Nl,Ol,Il,a,Ul,Dl,Fl,Bl,kl,Hl,T,zl,Gl,Vl,jl,Wl,Xl,ql,Yl,Zl,Jl,Kl,Ql,$l,eh,th,nh,ih,rh,ah,oh,sh,ch,lh,hh,uh,dh,ph,fh,mh,gh,vh,yh,xh,bh,wh,_h,Eh,Th,Mh,Sh,Ah,Rh,Ch,Lh,Ph,Nh,Oh,Ih,Uh,Dh,Fh,Bh,kh,Hh,zh,Gh,Vh,jh,Wh;e=e,void 0===Number.EPSILON&&(Number.EPSILON=Math.pow(2,-52)),void 0===Number.isInteger&&(Number.isInteger=function(e){return"number"==typeof e&&isFinite(e)&&Math.floor(e)===e}),void 0===Math.sign&&(Math.sign=function(e){return e<0?-1:0<e?1:+e}),"name"in Function.prototype==0&&Object.defineProperty(Function.prototype,"name",{get:function(){return this.toString().match(/^\s*function\s*([^\(\s]*)/)[1]}}),void 0===Object.assign&&(Object.assign=function(e){if(null==e)throw new TypeError("Cannot convert undefined or null to object");for(var t=Object(e),n=1;n<arguments.length;n++){var i=arguments[n];if(null!=i)for(var r in i)Object.prototype.hasOwnProperty.call(i,r)&&(t[r]=i[r])}return t}),Object.assign(p.prototype,{addEventListener:function(e,t){void 0===this._listeners&&(this._listeners={});var n=this._listeners;void 0===n[e]&&(n[e]=[]),-1===n[e].indexOf(t)&&n[e].push(t)},hasEventListener:function(e,t){var n;return void 0!==this._listeners&&void 0!==(n=this._listeners)[e]&&-1!==n[e].indexOf(t)},removeEventListener:function(e,t){void 0!==this._listeners&&void 0!==(e=this._listeners[e])&&-1!==(t=e.indexOf(t))&&e.splice(t,1)},dispatchEvent:function(e){if(void 0!==this._listeners){var t=this._listeners[e.type];if(void 0!==t){e.target=this;for(var n=t.slice(0),i=0,r=n.length;i<r;i++)n[i].call(this,e)}}}}),Na=100,Oa=101,Ia=102,Ua=103,Da=104,Fa=200,Ba=201,ka=202,Ha=203,za=204,Ga=205,Va=206,ja=207,Wa=208,Xa=209,qa=210,$a=Pa=5,eo=6,to=7,oo=io=Za=Aa=Ta=wa=xa=1,so=ro=Ja=Ra=Ma=_a=ba=2,co=Ka=Ca=3,lo=Qa=La=4,ho=301,uo=302,po=303,fo=304,mo=305,go=306,vo=307,yo=1e3,A=1001,xo=1002,R=1003,bo=1004,wo=1005,C=1006,_o=1007,Eo=1008,To=1009,Mo=1010,So=1011,Ao=1012,Ro=1013,Co=1014,Lo=1015,Po=1016,No=1017,Oo=1018,Io=1019,Uo=1020,Do=1021,Fo=1022,ko=1024,Ho=1025,zo=Bo=1023,Go=1026,Vo=1027,jo=2001,Wo=2002,Xo=2003,qo=2004,Yo=2100,Zo=2101,Jo=2102,Ko=2103,Qo=2151,$o=2400,es=ao=no=Ya=Sa=Ea=ya=0,ts=3e3,ns=3001,is=3007,rs=3002,as=3004,os=3005,ss=3006,cs=3200,ls=3201,Pe={DEG2RAD:Math.PI/180,RAD2DEG:180/Math.PI,generateUUID:(()=>{for(var r=[],e=0;e<256;e++)r[e]=(e<16?"0":"")+e.toString(16).toUpperCase();return function(){var e=4294967295*Math.random()|0,t=4294967295*Math.random()|0,n=4294967295*Math.random()|0,i=4294967295*Math.random()|0;return r[255&e]+r[e>>8&255]+r[e>>16&255]+r[e>>24&255]+"-"+r[255&t]+r[t>>8&255]+"-"+r[t>>16&15|64]+r[t>>24&255]+"-"+r[63&n|128]+r[n>>8&255]+"-"+r[n>>16&255]+r[n>>24&255]+r[255&i]+r[i>>8&255]+r[i>>16&255]+r[i>>24&255]}})(),clamp:function(e,t,n){return Math.max(t,Math.min(n,e))},euclideanModulo:function(e,t){return(e%t+t)%t},mapLinear:function(e,t,n,i,r){return i+(e-t)*(r-i)/(n-t)},lerp:function(e,t,n){return(1-n)*e+n*t},smoothstep:function(e,t,n){return e<=t?0:n<=e?1:(e=(e-t)/(n-t))*e*(3-2*e)},smootherstep:function(e,t,n){return e<=t?0:n<=e?1:(e=(e-t)/(n-t))*e*e*(e*(6*e-15)+10)},randInt:function(e,t){return e+Math.floor(Math.random()*(t-e+1))},randFloat:function(e,t){return e+Math.random()*(t-e)},randFloatSpread:function(e){return e*(.5-Math.random())},degToRad:function(e){return e*Pe.DEG2RAD},radToDeg:function(e){return e*Pe.RAD2DEG},isPowerOfTwo:function(e){return 0==(e&e-1)&&0!==e},ceilPowerOfTwo:function(e){return Math.pow(2,Math.ceil(Math.log(e)/Math.LN2))},floorPowerOfTwo:function(e){return Math.pow(2,Math.floor(Math.log(e)/Math.LN2))}},Object.defineProperties(te.prototype,{width:{get:function(){return this.x},set:function(e){this.x=e}},height:{get:function(){return this.y},set:function(e){this.y=e}}}),Object.assign(te.prototype,{isVector2:!0,set:function(e,t){return this.x=e,this.y=t,this},setScalar:function(e){return this.x=e,this.y=e,this},setX:function(e){return this.x=e,this},setY:function(e){return this.y=e,this},setComponent:function(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;default:throw new Error("index is out of range: "+e)}return this},getComponent:function(e){switch(e){case 0:return this.x;case 1:return this.y;default:throw new Error("index is out of range: "+e)}},clone:function(){return new this.constructor(this.x,this.y)},copy:function(e){return this.x=e.x,this.y=e.y,this},add:function(e,t){return void 0!==t?(console.warn("THREE.Vector2: .add() now only accepts one argument. Use .addVectors( a, b ) instead."),this.addVectors(e,t)):(this.x+=e.x,this.y+=e.y,this)},addScalar:function(e){return this.x+=e,this.y+=e,this},addVectors:function(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this},addScaledVector:function(e,t){return this.x+=e.x*t,this.y+=e.y*t,this},sub:function(e,t){return void 0!==t?(console.warn("THREE.Vector2: .sub() now only accepts one argument. Use .subVectors( a, b ) instead."),this.subVectors(e,t)):(this.x-=e.x,this.y-=e.y,this)},subScalar:function(e){return this.x-=e,this.y-=e,this},subVectors:function(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this},multiply:function(e){return this.x*=e.x,this.y*=e.y,this},multiplyScalar:function(e){return this.x*=e,this.y*=e,this},divide:function(e){return this.x/=e.x,this.y/=e.y,this},divideScalar:function(e){return this.multiplyScalar(1/e)},applyMatrix3:function(e){var t=this.x,n=this.y,e=e.elements;return this.x=e[0]*t+e[3]*n+e[6],this.y=e[1]*t+e[4]*n+e[7],this},min:function(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this},max:function(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this},clamp:function(e,t){return this.x=Math.max(e.x,Math.min(t.x,this.x)),this.y=Math.max(e.y,Math.min(t.y,this.y)),this},clampScalar:(aa=new te,oa=new te,function(e,t){return aa.set(e,e),oa.set(t,t),this.clamp(aa,oa)}),clampLength:function(e,t){var n=this.length();return this.divideScalar(n||1).multiplyScalar(Math.max(e,Math.min(t,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(e){return this.x*e.x+this.y*e.y},lengthSq:function(){return this.x*this.x+this.y*this.y},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y)},manhattanLength:function(){return Math.abs(this.x)+Math.abs(this.y)},normalize:function(){return this.divideScalar(this.length()||1)},angle:function(){var e=Math.atan2(this.y,this.x);return e<0&&(e+=2*Math.PI),e},distanceTo:function(e){return Math.sqrt(this.distanceToSquared(e))},distanceToSquared:function(e){var t=this.x-e.x,e=this.y-e.y;return t*t+e*e},manhattanDistanceTo:function(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)},setLength:function(e){return this.normalize().multiplyScalar(e)},lerp:function(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this},lerpVectors:function(e,t,n){return this.subVectors(t,e).multiplyScalar(n).add(e)},equals:function(e){return e.x===this.x&&e.y===this.y},fromArray:function(e,t){return this.x=e[t=void 0===t?0:t],this.y=e[t+1],this},toArray:function(e,t){return(e=void 0===e?[]:e)[t=void 0===t?0:t]=this.x,e[t+1]=this.y,e},fromBufferAttribute:function(e,t,n){return void 0!==n&&console.warn("THREE.Vector2: offset has been removed from .fromBufferAttribute()."),this.x=e.getX(t),this.y=e.getY(t),this},rotateAround:function(e,t){var n=Math.cos(t),t=Math.sin(t),i=this.x-e.x,r=this.y-e.y;return this.x=i*n-r*t+e.x,this.y=i*t+r*n+e.y,this}}),Object.assign(Re.prototype,{isMatrix4:!0,set:function(e,t,n,i,r,a,o,s,c,l,h,u,d,p,f,m){var g=this.elements;return g[0]=e,g[4]=t,g[8]=n,g[12]=i,g[1]=r,g[5]=a,g[9]=o,g[13]=s,g[2]=c,g[6]=l,g[10]=h,g[14]=u,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 Re).fromArray(this.elements)},copy:function(e){var t=this.elements,e=e.elements;return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[4]=e[4],t[5]=e[5],t[6]=e[6],t[7]=e[7],t[8]=e[8],t[9]=e[9],t[10]=e[10],t[11]=e[11],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15],this},copyPosition:function(e){var t=this.elements,e=e.elements;return t[12]=e[12],t[13]=e[13],t[14]=e[14],this},extractBasis:function(e,t,n){return e.setFromMatrixColumn(this,0),t.setFromMatrixColumn(this,1),n.setFromMatrixColumn(this,2),this},makeBasis:function(e,t,n){return this.set(e.x,t.x,n.x,0,e.y,t.y,n.y,0,e.z,t.z,n.z,0,0,0,0,1),this},extractRotation:(ra=new Ce,function(e){var t=this.elements,n=e.elements,i=1/ra.setFromMatrixColumn(e,0).length(),r=1/ra.setFromMatrixColumn(e,1).length(),e=1/ra.setFromMatrixColumn(e,2).length();return t[0]=n[0]*i,t[1]=n[1]*i,t[2]=n[2]*i,t[4]=n[4]*r,t[5]=n[5]*r,t[6]=n[6]*r,t[8]=n[8]*e,t[9]=n[9]*e,t[10]=n[10]*e,this}),makeRotationFromEuler:function(e){e&&e.isEuler||console.error("THREE.Matrix4: .makeRotationFromEuler() now expects a Euler rotation rather than a Vector3 and order.");var t,n,i,r,a,o,s,c,l,h,u,d,p=this.elements,f=e.x,m=e.y,g=e.z,v=Math.cos(f),f=Math.sin(f),y=Math.cos(m),m=Math.sin(m),x=Math.cos(g),g=Math.sin(g);return"XYZ"===e.order?(a=v*x,o=v*g,s=f*x,c=f*g,p[0]=y*x,p[4]=-y*g,p[8]=m,p[1]=o+s*m,p[5]=a-c*m,p[9]=-f*y,p[2]=c-a*m,p[6]=s+o*m,p[10]=v*y):"YXZ"===e.order?(n=y*g,i=m*x,p[0]=(t=y*x)+(r=m*g)*f,p[4]=i*f-n,p[8]=v*m,p[1]=v*g,p[5]=v*x,p[9]=-f,p[2]=n*f-i,p[6]=r+t*f,p[10]=v*y):"ZXY"===e.order?(n=y*g,i=m*x,p[0]=(t=y*x)-(r=m*g)*f,p[4]=-v*g,p[8]=i+n*f,p[1]=n+i*f,p[5]=v*x,p[9]=r-t*f,p[2]=-v*m,p[6]=f,p[10]=v*y):"ZYX"===e.order?(a=v*x,o=v*g,s=f*x,c=f*g,p[0]=y*x,p[4]=s*m-o,p[8]=a*m+c,p[1]=y*g,p[5]=c*m+a,p[9]=o*m-s,p[2]=-m,p[6]=f*y,p[10]=v*y):"YZX"===e.order?(l=v*y,h=v*m,u=f*y,d=f*m,p[0]=y*x,p[4]=d-l*g,p[8]=u*g+h,p[1]=g,p[5]=v*x,p[9]=-f*x,p[2]=-m*x,p[6]=h*g+u,p[10]=l-d*g):"XZY"===e.order&&(l=v*y,h=v*m,u=f*y,d=f*m,p[0]=y*x,p[4]=-g,p[8]=m*x,p[1]=l*g+d,p[5]=v*x,p[9]=h*g-u,p[2]=u*g-h,p[6]=f*x,p[10]=d*g+l),p[3]=0,p[7]=0,p[11]=0,p[12]=0,p[13]=0,p[14]=0,p[15]=1,this},makeRotationFromQuaternion:function(e){var t=this.elements,n=e._x,i=e._y,r=e._z,e=e._w,a=n+n,o=i+i,s=r+r,c=n*a,l=n*o,n=n*s,h=i*o,i=i*s,r=r*s,a=e*a,o=e*o,e=e*s;return t[0]=1-(h+r),t[4]=l-e,t[8]=n+o,t[1]=l+e,t[5]=1-(c+r),t[9]=i-a,t[2]=n-o,t[6]=i+a,t[10]=1-(c+h),t[3]=0,t[7]=0,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this},lookAt:(na=new Ce,ia=new Ce,r=new Ce,function(e,t,n){var i=this.elements;return r.subVectors(e,t),0===r.lengthSq()&&(r.z=1),r.normalize(),na.crossVectors(n,r),0===na.lengthSq()&&(1===Math.abs(n.z)?r.x+=1e-4:r.z+=1e-4,r.normalize(),na.crossVectors(n,r)),na.normalize(),ia.crossVectors(r,na),i[0]=na.x,i[4]=ia.x,i[8]=r.x,i[1]=na.y,i[5]=ia.y,i[9]=r.y,i[2]=na.z,i[6]=ia.z,i[10]=r.z,this}),multiply:function(e,t){return void 0!==t?(console.warn("THREE.Matrix4: .multiply() now only accepts one argument. Use .multiplyMatrices( a, b ) instead."),this.multiplyMatrices(e,t)):this.multiplyMatrices(this,e)},premultiply:function(e){return this.multiplyMatrices(e,this)},multiplyMatrices:function(e,t){var e=e.elements,t=t.elements,n=this.elements,i=e[0],r=e[4],a=e[8],o=e[12],s=e[1],c=e[5],l=e[9],h=e[13],u=e[2],d=e[6],p=e[10],f=e[14],m=e[3],g=e[7],v=e[11],e=e[15],y=t[0],x=t[4],b=t[8],w=t[12],_=t[1],E=t[5],T=t[9],M=t[13],S=t[2],A=t[6],R=t[10],C=t[14],L=t[3],P=t[7],N=t[11],t=t[15];return n[0]=i*y+r*_+a*S+o*L,n[4]=i*x+r*E+a*A+o*P,n[8]=i*b+r*T+a*R+o*N,n[12]=i*w+r*M+a*C+o*t,n[1]=s*y+c*_+l*S+h*L,n[5]=s*x+c*E+l*A+h*P,n[9]=s*b+c*T+l*R+h*N,n[13]=s*w+c*M+l*C+h*t,n[2]=u*y+d*_+p*S+f*L,n[6]=u*x+d*E+p*A+f*P,n[10]=u*b+d*T+p*R+f*N,n[14]=u*w+d*M+p*C+f*t,n[3]=m*y+g*_+v*S+e*L,n[7]=m*x+g*E+v*A+e*P,n[11]=m*b+g*T+v*R+e*N,n[15]=m*w+g*M+v*C+e*t,this},multiplyScalar:function(e){var t=this.elements;return t[0]*=e,t[4]*=e,t[8]*=e,t[12]*=e,t[1]*=e,t[5]*=e,t[9]*=e,t[13]*=e,t[2]*=e,t[6]*=e,t[10]*=e,t[14]*=e,t[3]*=e,t[7]*=e,t[11]*=e,t[15]*=e,this},applyToBufferAttribute:(va=new Ce,function(e){for(var t=0,n=e.count;t<n;t++)va.x=e.getX(t),va.y=e.getY(t),va.z=e.getZ(t),va.applyMatrix4(this),e.setXYZ(t,va.x,va.y,va.z);return e}),determinant:function(){var e=this.elements,t=e[0],n=e[4],i=e[8],r=e[12],a=e[1],o=e[5],s=e[9],c=e[13],l=e[2],h=e[6],u=e[10],d=e[14];return e[3]*(+r*s*h-i*c*h-r*o*u+n*c*u+i*o*d-n*s*d)+e[7]*(+t*s*d-t*c*u+r*a*u-i*a*d+i*c*l-r*s*l)+e[11]*(+t*c*h-t*o*d-r*a*h+n*a*d+r*o*l-n*c*l)+e[15]*(-i*o*l-t*s*h+t*o*u+i*a*h-n*a*u+n*s*l)},transpose:function(){var e=this.elements,t=e[1];return 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(e){var t=this.elements;return t[12]=e.x,t[13]=e.y,t[14]=e.z,this},getInverse:function(e,t){var n=this.elements,e=e.elements,i=e[0],r=e[1],a=e[2],o=e[3],s=e[4],c=e[5],l=e[6],h=e[7],u=e[8],d=e[9],p=e[10],f=e[11],m=e[12],g=e[13],v=e[14],e=e[15],y=d*v*h-g*p*h+g*l*f-c*v*f-d*l*e+c*p*e,x=m*p*h-u*v*h-m*l*f+s*v*f+u*l*e-s*p*e,b=u*g*h-m*d*h+m*c*f-s*g*f-u*c*e+s*d*e,w=m*d*l-u*g*l-m*c*p+s*g*p+u*c*v-s*d*v,_=i*y+r*x+a*b+o*w;if(0==_){var E="THREE.Matrix4: .getInverse() can't invert matrix, determinant is 0";if(!0===t)throw new Error(E);return console.warn(E),this.identity()}t=1/_;return n[0]=y*t,n[1]=(g*p*o-d*v*o-g*a*f+r*v*f+d*a*e-r*p*e)*t,n[2]=(c*v*o-g*l*o+g*a*h-r*v*h-c*a*e+r*l*e)*t,n[3]=(d*l*o-c*p*o-d*a*h+r*p*h+c*a*f-r*l*f)*t,n[4]=x*t,n[5]=(u*v*o-m*p*o+m*a*f-i*v*f-u*a*e+i*p*e)*t,n[6]=(m*l*o-s*v*o-m*a*h+i*v*h+s*a*e-i*l*e)*t,n[7]=(s*p*o-u*l*o+u*a*h-i*p*h-s*a*f+i*l*f)*t,n[8]=b*t,n[9]=(m*d*o-u*g*o-m*r*f+i*g*f+u*r*e-i*d*e)*t,n[10]=(s*g*o-m*c*o+m*r*h-i*g*h-s*r*e+i*c*e)*t,n[11]=(u*c*o-s*d*o-u*r*h+i*d*h+s*r*f-i*c*f)*t,n[12]=w*t,n[13]=(u*g*a-m*d*a+m*r*p-i*g*p-u*r*v+i*d*v)*t,n[14]=(m*c*a-s*g*a-m*r*l+i*g*l+s*r*v-i*c*v)*t,n[15]=(s*d*a-u*c*a+u*r*l-i*d*l-s*r*p+i*c*p)*t,this},scale:function(e){var t=this.elements,n=e.x,i=e.y,e=e.z;return t[0]*=n,t[4]*=i,t[8]*=e,t[1]*=n,t[5]*=i,t[9]*=e,t[2]*=n,t[6]*=i,t[10]*=e,t[3]*=n,t[7]*=i,t[11]*=e,this},getMaxScaleOnAxis:function(){var e=this.elements,t=e[0]*e[0]+e[1]*e[1]+e[2]*e[2];return Math.sqrt(Math.max(t,e[4]*e[4]+e[5]*e[5]+e[6]*e[6],e[8]*e[8]+e[9]*e[9]+e[10]*e[10]))},makeTranslation:function(e,t,n){return this.set(1,0,0,e,0,1,0,t,0,0,1,n,0,0,0,1),this},makeRotationX:function(e){var t=Math.cos(e),e=Math.sin(e);return this.set(1,0,0,0,0,t,-e,0,0,e,t,0,0,0,0,1),this},makeRotationY:function(e){var t=Math.cos(e),e=Math.sin(e);return this.set(t,0,e,0,0,1,0,0,-e,0,t,0,0,0,0,1),this},makeRotationZ:function(e){var t=Math.cos(e),e=Math.sin(e);return this.set(t,-e,0,0,e,t,0,0,0,0,1,0,0,0,0,1),this},makeRotationAxis:function(e,t){var n=Math.cos(t),t=Math.sin(t),i=1-n,r=e.x,a=e.y,e=e.z,o=i*r,s=i*a;return this.set(o*r+n,o*a-t*e,o*e+t*a,0,o*a+t*e,s*a+n,s*e-t*r,0,o*e-t*a,s*e+t*r,i*e*e+n,0,0,0,0,1),this},makeScale:function(e,t,n){return this.set(e,0,0,0,0,t,0,0,0,0,n,0,0,0,0,1),this},makeShear:function(e,t,n){return this.set(1,t,n,0,e,1,n,0,e,t,1,0,0,0,0,1),this},compose:function(e,t,n){return this.makeRotationFromQuaternion(t),this.scale(n),this.setPosition(e),this},decompose:(ea=new Ce,ta=new Re,function(e,t,n){var i=this.elements,r=ea.set(i[0],i[1],i[2]).length(),a=ea.set(i[4],i[5],i[6]).length(),o=ea.set(i[8],i[9],i[10]).length(),e=(this.determinant()<0&&(r=-r),e.x=i[12],e.y=i[13],e.z=i[14],ta.copy(this),1/r),i=1/a,s=1/o;return ta.elements[0]*=e,ta.elements[1]*=e,ta.elements[2]*=e,ta.elements[4]*=i,ta.elements[5]*=i,ta.elements[6]*=i,ta.elements[8]*=s,ta.elements[9]*=s,ta.elements[10]*=s,t.setFromRotationMatrix(ta),n.x=r,n.y=a,n.z=o,this}),makePerspective:function(e,t,n,i,r,a){void 0===a&&console.warn("THREE.Matrix4: .makePerspective() has been redefined and has a new signature. Please check the docs.");var o=this.elements,s=2*r/(n-i),c=(t+e)/(t-e),n=(n+i)/(n-i),i=-(a+r)/(a-r),a=-2*a*r/(a-r);return o[0]=2*r/(t-e),o[4]=0,o[8]=c,o[12]=0,o[1]=0,o[5]=s,o[9]=n,o[13]=0,o[2]=0,o[6]=0,o[10]=i,o[14]=a,o[3]=0,o[7]=0,o[11]=-1,o[15]=0,this},makeOrthographic:function(e,t,n,i,r,a){var o=this.elements,s=1/(t-e),c=1/(n-i),l=1/(a-r),t=(t+e)*s,e=(n+i)*c,n=(a+r)*l;return o[0]=2*s,o[4]=0,o[8]=0,o[12]=-t,o[1]=0,o[5]=2*c,o[9]=0,o[13]=-e,o[2]=0,o[6]=0,o[10]=-2*l,o[14]=-n,o[3]=0,o[7]=0,o[11]=0,o[15]=1,this},equals:function(e){for(var t=this.elements,n=e.elements,i=0;i<16;i++)if(t[i]!==n[i])return!1;return!0},fromArray:function(e,t){void 0===t&&(t=0);for(var n=0;n<16;n++)this.elements[n]=e[n+t];return this},toArray:function(e,t){var n=this.elements;return(e=void 0===e?[]:e)[t=void 0===t?0:t]=n[0],e[t+1]=n[1],e[t+2]=n[2],e[t+3]=n[3],e[t+4]=n[4],e[t+5]=n[5],e[t+6]=n[6],e[t+7]=n[7],e[t+8]=n[8],e[t+9]=n[9],e[t+10]=n[10],e[t+11]=n[11],e[t+12]=n[12],e[t+13]=n[13],e[t+14]=n[14],e[t+15]=n[15],e}}),Object.assign(h,{slerp:function(e,t,n,i){return n.copy(e).slerp(t,i)},slerpFlat:function(e,t,n,i,r,a,o){var s,c,l,h=n[i+0],u=n[i+1],d=n[i+2],n=n[i+3],i=r[a+0],p=r[a+1],f=r[a+2],r=r[a+3];n===r&&h===i&&u===p&&d===f||(a=1-o,s=0<=(c=h*i+u*p+d*f+n*r)?1:-1,(l=1-c*c)>Number.EPSILON&&(l=Math.sqrt(l),c=Math.atan2(l,c*s),a=Math.sin(a*c)/l,o=Math.sin(o*c)/l),h=h*a+i*(c=o*s),u=u*a+p*c,d=d*a+f*c,n=n*a+r*c,a===1-o&&(h*=l=1/Math.sqrt(h*h+u*u+d*d+n*n),u*=l,d*=l,n*=l)),e[t]=h,e[t+1]=u,e[t+2]=d,e[t+3]=n}}),Object.defineProperties(h.prototype,{x:{get:function(){return this._x},set:function(e){this._x=e,this.onChangeCallback()}},y:{get:function(){return this._y},set:function(e){this._y=e,this.onChangeCallback()}},z:{get:function(){return this._z},set:function(e){this._z=e,this.onChangeCallback()}},w:{get:function(){return this._w},set:function(e){this._w=e,this.onChangeCallback()}}}),Object.assign(h.prototype,{set:function(e,t,n,i){return this._x=e,this._y=t,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(e){return this._x=e.x,this._y=e.y,this._z=e.z,this._w=e.w,this.onChangeCallback(),this},setFromEuler:function(e,t){var n,i,r,a,o,s,c;if(e&&e.isEuler)return o=e._x,s=e._y,n=e._z,e=e.order,a=Math.cos,c=Math.sin,i=a(o/2),r=a(s/2),a=a(n/2),o=c(o/2),s=c(s/2),c=c(n/2),"XYZ"===e?(this._x=o*r*a+i*s*c,this._y=i*s*a-o*r*c,this._z=i*r*c+o*s*a,this._w=i*r*a-o*s*c):"YXZ"===e?(this._x=o*r*a+i*s*c,this._y=i*s*a-o*r*c,this._z=i*r*c-o*s*a,this._w=i*r*a+o*s*c):"ZXY"===e?(this._x=o*r*a-i*s*c,this._y=i*s*a+o*r*c,this._z=i*r*c+o*s*a,this._w=i*r*a-o*s*c):"ZYX"===e?(this._x=o*r*a-i*s*c,this._y=i*s*a+o*r*c,this._z=i*r*c-o*s*a,this._w=i*r*a+o*s*c):"YZX"===e?(this._x=o*r*a+i*s*c,this._y=i*s*a+o*r*c,this._z=i*r*c-o*s*a,this._w=i*r*a-o*s*c):"XZY"===e&&(this._x=o*r*a-i*s*c,this._y=i*s*a-o*r*c,this._z=i*r*c+o*s*a,this._w=i*r*a+o*s*c),!1!==t&&this.onChangeCallback(),this;throw new Error("THREE.Quaternion: .setFromEuler() now expects an Euler rotation rather than a Vector3 and order.")},setFromAxisAngle:function(e,t){var t=t/2,n=Math.sin(t);return this._x=e.x*n,this._y=e.y*n,this._z=e.z*n,this._w=Math.cos(t),this.onChangeCallback(),this},setFromRotationMatrix:function(e){var t,e=e.elements,n=e[0],i=e[4],r=e[8],a=e[1],o=e[5],s=e[9],c=e[2],l=e[6],e=e[10],h=n+o+e;return 0<h?(t=.5/Math.sqrt(h+1),this._w=.25/t,this._x=(l-s)*t,this._y=(r-c)*t,this._z=(a-i)*t):o<n&&e<n?(t=2*Math.sqrt(1+n-o-e),this._w=(l-s)/t,this._x=.25*t,this._y=(i+a)/t,this._z=(r+c)/t):e<o?(t=2*Math.sqrt(1+o-n-e),this._w=(r-c)/t,this._x=(i+a)/t,this._y=.25*t,this._z=(s+l)/t):(t=2*Math.sqrt(1+e-n-o),this._w=(a-i)/t,this._x=(r+c)/t,this._y=(s+l)/t,this._z=.25*t),this.onChangeCallback(),this},setFromUnitVectors:(ga=new Ce,function(e,t){return void 0===ga&&(ga=new Ce),(ma=e.dot(t)+1)<1e-6?(ma=0,Math.abs(e.x)>Math.abs(e.z)?ga.set(-e.y,e.x,0):ga.set(0,-e.z,e.y)):ga.crossVectors(e,t),this._x=ga.x,this._y=ga.y,this._z=ga.z,this._w=ma,this.normalize()}),inverse:function(){return this.conjugate().normalize()},conjugate:function(){return this._x*=-1,this._y*=-1,this._z*=-1,this.onChangeCallback(),this},dot:function(e){return this._x*e._x+this._y*e._y+this._z*e._z+this._w*e._w},lengthSq:function(){return this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w},length:function(){return Math.sqrt(this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w)},normalize:function(){var e=this.length();return 0===e?(this._x=0,this._y=0,this._z=0,this._w=1):(this._x=this._x*(e=1/e),this._y=this._y*e,this._z=this._z*e,this._w=this._w*e),this.onChangeCallback(),this},multiply:function(e,t){return void 0!==t?(console.warn("THREE.Quaternion: .multiply() now only accepts one argument. Use .multiplyQuaternions( a, b ) instead."),this.multiplyQuaternions(e,t)):this.multiplyQuaternions(this,e)},premultiply:function(e){return this.multiplyQuaternions(e,this)},multiplyQuaternions:function(e,t){var n=e._x,i=e._y,r=e._z,e=e._w,a=t._x,o=t._y,s=t._z,t=t._w;return this._x=n*t+e*a+i*s-r*o,this._y=i*t+e*o+r*a-n*s,this._z=r*t+e*s+n*o-i*a,this._w=e*t-n*a-i*o-r*s,this.onChangeCallback(),this},slerp:function(e,t){if(0!==t){if(1===t)return this.copy(e);var n,i=this._x,r=this._y,a=this._z,o=this._w,s=o*e._w+i*e._x+r*e._y+a*e._z;s<0?(this._w=-e._w,this._x=-e._x,this._y=-e._y,this._z=-e._z,s=-s):this.copy(e),1<=s?(this._w=o,this._x=i,this._y=r,this._z=a):(e=Math.sqrt(1-s*s),Math.abs(e)<.001?(this._w=.5*(o+this._w),this._x=.5*(i+this._x),this._y=.5*(r+this._y),this._z=.5*(a+this._z)):(s=Math.atan2(e,s),n=Math.sin((1-t)*s)/e,t=Math.sin(t*s)/e,this._w=o*n+this._w*t,this._x=i*n+this._x*t,this._y=r*n+this._y*t,this._z=a*n+this._z*t,this.onChangeCallback()))}return this},equals:function(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._w===this._w},fromArray:function(e,t){return this._x=e[t=void 0===t?0:t],this._y=e[t+1],this._z=e[t+2],this._w=e[t+3],this.onChangeCallback(),this},toArray:function(e,t){return(e=void 0===e?[]:e)[t=void 0===t?0:t]=this._x,e[t+1]=this._y,e[t+2]=this._z,e[t+3]=this._w,e},onChange:function(e){return this.onChangeCallback=e,this},onChangeCallback:function(){}}),Object.assign(Ce.prototype,{isVector3:!0,set:function(e,t,n){return this.x=e,this.y=t,this.z=n,this},setScalar:function(e){return this.x=e,this.y=e,this.z=e,this},setX:function(e){return this.x=e,this},setY:function(e){return this.y=e,this},setZ:function(e){return this.z=e,this},setComponent:function(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;case 2:this.z=t;break;default:throw new Error("index is out of range: "+e)}return this},getComponent:function(e){switch(e){case 0:return this.x;case 1:return this.y;case 2:return this.z;default:throw new Error("index is out of range: "+e)}},clone:function(){return new this.constructor(this.x,this.y,this.z)},copy:function(e){return this.x=e.x,this.y=e.y,this.z=e.z,this},add:function(e,t){return void 0!==t?(console.warn("THREE.Vector3: .add() now only accepts one argument. Use .addVectors( a, b ) instead."),this.addVectors(e,t)):(this.x+=e.x,this.y+=e.y,this.z+=e.z,this)},addScalar:function(e){return this.x+=e,this.y+=e,this.z+=e,this},addVectors:function(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this.z=e.z+t.z,this},addScaledVector:function(e,t){return this.x+=e.x*t,this.y+=e.y*t,this.z+=e.z*t,this},sub:function(e,t){return void 0!==t?(console.warn("THREE.Vector3: .sub() now only accepts one argument. Use .subVectors( a, b ) instead."),this.subVectors(e,t)):(this.x-=e.x,this.y-=e.y,this.z-=e.z,this)},subScalar:function(e){return this.x-=e,this.y-=e,this.z-=e,this},subVectors:function(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this.z=e.z-t.z,this},multiply:function(e,t){return void 0!==t?(console.warn("THREE.Vector3: .multiply() now only accepts one argument. Use .multiplyVectors( a, b ) instead."),this.multiplyVectors(e,t)):(this.x*=e.x,this.y*=e.y,this.z*=e.z,this)},multiplyScalar:function(e){return this.x*=e,this.y*=e,this.z*=e,this},multiplyVectors:function(e,t){return this.x=e.x*t.x,this.y=e.y*t.y,this.z=e.z*t.z,this},applyEuler:($r=new h,function(e){return e&&e.isEuler||console.error("THREE.Vector3: .applyEuler() now expects an Euler rotation rather than a Vector3 and order."),this.applyQuaternion($r.setFromEuler(e))}),applyAxisAngle:(fa=new h,function(e,t){return this.applyQuaternion(fa.setFromAxisAngle(e,t))}),applyMatrix3:function(e){var t=this.x,n=this.y,i=this.z,e=e.elements;return this.x=e[0]*t+e[3]*n+e[6]*i,this.y=e[1]*t+e[4]*n+e[7]*i,this.z=e[2]*t+e[5]*n+e[8]*i,this},applyMatrix4:function(e){var t=this.x,n=this.y,i=this.z,e=e.elements,r=1/(e[3]*t+e[7]*n+e[11]*i+e[15]);return this.x=(e[0]*t+e[4]*n+e[8]*i+e[12])*r,this.y=(e[1]*t+e[5]*n+e[9]*i+e[13])*r,this.z=(e[2]*t+e[6]*n+e[10]*i+e[14])*r,this},applyQuaternion:function(e){var t=this.x,n=this.y,i=this.z,r=e.x,a=e.y,o=e.z,e=e.w,s=e*t+a*i-o*n,c=e*n+o*t-r*i,l=e*i+r*n-a*t,t=-r*t-a*n-o*i;return this.x=s*e+t*-r+c*-o-l*-a,this.y=c*e+t*-a+l*-r-s*-o,this.z=l*e+t*-o+s*-a-c*-r,this},project:(pa=new Re,function(e){return pa.multiplyMatrices(e.projectionMatrix,pa.getInverse(e.matrixWorld)),this.applyMatrix4(pa)}),unproject:(da=new Re,function(e){return da.multiplyMatrices(e.matrixWorld,da.getInverse(e.projectionMatrix)),this.applyMatrix4(da)}),transformDirection:function(e){var t=this.x,n=this.y,i=this.z,e=e.elements;return this.x=e[0]*t+e[4]*n+e[8]*i,this.y=e[1]*t+e[5]*n+e[9]*i,this.z=e[2]*t+e[6]*n+e[10]*i,this.normalize()},divide:function(e){return this.x/=e.x,this.y/=e.y,this.z/=e.z,this},divideScalar:function(e){return this.multiplyScalar(1/e)},min:function(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this.z=Math.min(this.z,e.z),this},max:function(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this.z=Math.max(this.z,e.z),this},clamp:function(e,t){return this.x=Math.max(e.x,Math.min(t.x,this.x)),this.y=Math.max(e.y,Math.min(t.y,this.y)),this.z=Math.max(e.z,Math.min(t.z,this.z)),this},clampScalar:(ha=new Ce,ua=new Ce,function(e,t){return ha.set(e,e,e),ua.set(t,t,t),this.clamp(ha,ua)}),clampLength:function(e,t){var n=this.length();return this.divideScalar(n||1).multiplyScalar(Math.max(e,Math.min(t,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(e){return this.x*e.x+this.y*e.y+this.z*e.z},lengthSq:function(){return this.x*this.x+this.y*this.y+this.z*this.z},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)},manhattanLength:function(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)},normalize:function(){return this.divideScalar(this.length()||1)},setLength:function(e){return this.normalize().multiplyScalar(e)},lerp:function(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this.z+=(e.z-this.z)*t,this},lerpVectors:function(e,t,n){return this.subVectors(t,e).multiplyScalar(n).add(e)},cross:function(e,t){return void 0!==t?(console.warn("THREE.Vector3: .cross() now only accepts one argument. Use .crossVectors( a, b ) instead."),this.crossVectors(e,t)):this.crossVectors(this,e)},crossVectors:function(e,t){var n=e.x,i=e.y,e=e.z,r=t.x,a=t.y,t=t.z;return this.x=i*t-e*a,this.y=e*r-n*t,this.z=n*a-i*r,this},projectOnVector:function(e){var t=e.dot(this)/e.lengthSq();return this.copy(e).multiplyScalar(t)},projectOnPlane:(la=new Ce,function(e){return la.copy(this).projectOnVector(e),this.sub(la)}),reflect:(ca=new Ce,function(e){return this.sub(ca.copy(e).multiplyScalar(2*this.dot(e)))}),angleTo:function(e){e=this.dot(e)/Math.sqrt(this.lengthSq()*e.lengthSq());return Math.acos(Pe.clamp(e,-1,1))},distanceTo:function(e){return Math.sqrt(this.distanceToSquared(e))},distanceToSquared:function(e){var t=this.x-e.x,n=this.y-e.y,e=this.z-e.z;return t*t+n*n+e*e},manhattanDistanceTo:function(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)+Math.abs(this.z-e.z)},setFromSpherical:function(e){var t=Math.sin(e.phi)*e.radius;return this.x=t*Math.sin(e.theta),this.y=Math.cos(e.phi)*e.radius,this.z=t*Math.cos(e.theta),this},setFromCylindrical:function(e){return this.x=e.radius*Math.sin(e.theta),this.y=e.y,this.z=e.radius*Math.cos(e.theta),this},setFromMatrixPosition:function(e){e=e.elements;return this.x=e[12],this.y=e[13],this.z=e[14],this},setFromMatrixScale:function(e){var t=this.setFromMatrixColumn(e,0).length(),n=this.setFromMatrixColumn(e,1).length(),e=this.setFromMatrixColumn(e,2).length();return this.x=t,this.y=n,this.z=e,this},setFromMatrixColumn:function(e,t){return this.fromArray(e.elements,4*t)},equals:function(e){return e.x===this.x&&e.y===this.y&&e.z===this.z},fromArray:function(e,t){return this.x=e[t=void 0===t?0:t],this.y=e[t+1],this.z=e[t+2],this},toArray:function(e,t){return(e=void 0===e?[]:e)[t=void 0===t?0:t]=this.x,e[t+1]=this.y,e[t+2]=this.z,e},fromBufferAttribute:function(e,t,n){return void 0!==n&&console.warn("THREE.Vector3: offset has been removed from .fromBufferAttribute()."),this.x=e.getX(t),this.y=e.getY(t),this.z=e.getZ(t),this}}),Object.assign(S.prototype,{isMatrix3:!0,set:function(e,t,n,i,r,a,o,s,c){var l=this.elements;return l[0]=e,l[1]=i,l[2]=o,l[3]=t,l[4]=r,l[5]=s,l[6]=n,l[7]=a,l[8]=c,this},identity:function(){return this.set(1,0,0,0,1,0,0,0,1),this},clone:function(){return(new this.constructor).fromArray(this.elements)},copy:function(e){var t=this.elements,e=e.elements;return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[4]=e[4],t[5]=e[5],t[6]=e[6],t[7]=e[7],t[8]=e[8],this},setFromMatrix4:function(e){e=e.elements;return this.set(e[0],e[4],e[8],e[1],e[5],e[9],e[2],e[6],e[10]),this},applyToBufferAttribute:(sa=new Ce,function(e){for(var t=0,n=e.count;t<n;t++)sa.x=e.getX(t),sa.y=e.getY(t),sa.z=e.getZ(t),sa.applyMatrix3(this),e.setXYZ(t,sa.x,sa.y,sa.z);return e}),multiply:function(e){return this.multiplyMatrices(this,e)},premultiply:function(e){return this.multiplyMatrices(e,this)},multiplyMatrices:function(e,t){var e=e.elements,t=t.elements,n=this.elements,i=e[0],r=e[3],a=e[6],o=e[1],s=e[4],c=e[7],l=e[2],h=e[5],e=e[8],u=t[0],d=t[3],p=t[6],f=t[1],m=t[4],g=t[7],v=t[2],y=t[5],t=t[8];return n[0]=i*u+r*f+a*v,n[3]=i*d+r*m+a*y,n[6]=i*p+r*g+a*t,n[1]=o*u+s*f+c*v,n[4]=o*d+s*m+c*y,n[7]=o*p+s*g+c*t,n[2]=l*u+h*f+e*v,n[5]=l*d+h*m+e*y,n[8]=l*p+h*g+e*t,this},multiplyScalar:function(e){var t=this.elements;return t[0]*=e,t[3]*=e,t[6]*=e,t[1]*=e,t[4]*=e,t[7]*=e,t[2]*=e,t[5]*=e,t[8]*=e,this},determinant:function(){var e=this.elements,t=e[0],n=e[1],i=e[2],r=e[3],a=e[4],o=e[5],s=e[6],c=e[7],e=e[8];return t*a*e-t*o*c-n*r*e+n*o*s+i*r*c-i*a*s},getInverse:function(e,t){e&&e.isMatrix4&&console.error("THREE.Matrix3: .getInverse() no longer takes a Matrix4 argument.");var e=e.elements,n=this.elements,i=e[0],r=e[1],a=e[2],o=e[3],s=e[4],c=e[5],l=e[6],h=e[7],e=e[8],u=e*s-c*h,d=c*l-e*o,p=h*o-s*l,f=i*u+r*d+a*p;if(0==f){var m="THREE.Matrix3: .getInverse() can't invert matrix, determinant is 0";if(!0===t)throw new Error(m);return console.warn(m),this.identity()}t=1/f;return n[0]=u*t,n[1]=(a*h-e*r)*t,n[2]=(c*r-a*s)*t,n[3]=d*t,n[4]=(e*i-a*l)*t,n[5]=(a*o-c*i)*t,n[6]=p*t,n[7]=(r*l-h*i)*t,n[8]=(s*i-r*o)*t,this},transpose:function(){var e=this.elements,t=e[1];return 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(e){return this.setFromMatrix4(e).getInverse(this).transpose()},transposeIntoArray:function(e){var t=this.elements;return e[0]=t[0],e[1]=t[3],e[2]=t[6],e[3]=t[1],e[4]=t[4],e[5]=t[7],e[6]=t[2],e[7]=t[5],e[8]=t[8],this},setUvTransform:function(e,t,n,i,r,a,o){var s=Math.cos(r),r=Math.sin(r);this.set(n*s,n*r,-n*(s*a+r*o)+a+e,-i*r,i*s,-i*(-r*a+s*o)+o+t,0,0,1)},scale:function(e,t){var n=this.elements;return n[0]*=e,n[3]*=e,n[6]*=e,n[1]*=t,n[4]*=t,n[7]*=t,this},rotate:function(e){var t=Math.cos(e),e=Math.sin(e),n=this.elements,i=n[0],r=n[3],a=n[6],o=n[1],s=n[4],c=n[7];return n[0]=t*i+e*o,n[3]=t*r+e*s,n[6]=t*a+e*c,n[1]=-e*i+t*o,n[4]=-e*r+t*s,n[7]=-e*a+t*c,this},translate:function(e,t){var n=this.elements;return n[0]+=e*n[2],n[3]+=e*n[5],n[6]+=e*n[8],n[1]+=t*n[2],n[4]+=t*n[5],n[7]+=t*n[8],this},equals:function(e){for(var t=this.elements,n=e.elements,i=0;i<9;i++)if(t[i]!==n[i])return!1;return!0},fromArray:function(e,t){void 0===t&&(t=0);for(var n=0;n<9;n++)this.elements[n]=e[n+t];return this},toArray:function(e,t){var n=this.elements;return(e=void 0===e?[]:e)[t=void 0===t?0:t]=n[0],e[t+1]=n[1],e[t+2]=n[2],e[t+3]=n[3],e[t+4]=n[4],e[t+5]=n[5],e[t+6]=n[6],e[t+7]=n[7],e[t+8]=n[8],e}}),ds=0,d.DEFAULT_IMAGE=void 0,d.DEFAULT_MAPPING=300,d.prototype=Object.assign(Object.create(p.prototype),{constructor:d,isTexture:!0,clone:function(){return(new this.constructor).copy(this)},copy:function(e){return this.name=e.name,this.image=e.image,this.mipmaps=e.mipmaps.slice(0),this.mapping=e.mapping,this.wrapS=e.wrapS,this.wrapT=e.wrapT,this.magFilter=e.magFilter,this.minFilter=e.minFilter,this.anisotropy=e.anisotropy,this.format=e.format,this.type=e.type,this.offset.copy(e.offset),this.repeat.copy(e.repeat),this.center.copy(e.center),this.rotation=e.rotation,this.matrixAutoUpdate=e.matrixAutoUpdate,this.matrix.copy(e.matrix),this.generateMipmaps=e.generateMipmaps,this.premultiplyAlpha=e.premultiplyAlpha,this.flipY=e.flipY,this.unpackAlignment=e.unpackAlignment,this.encoding=e.encoding,this},toJSON:function(e){var t,n,i,r,a,o=void 0===e||"string"==typeof e;return o||void 0===e.textures[this.uuid]?(t={metadata:{version:4.5,type:"Texture",generator:"Texture.toJSON"},uuid:this.uuid,name:this.name,mapping:this.mapping,repeat:[this.repeat.x,this.repeat.y],offset:[this.offset.x,this.offset.y],center:[this.center.x,this.center.y],rotation:this.rotation,wrap:[this.wrapS,this.wrapT],minFilter:this.minFilter,magFilter:this.magFilter,anisotropy:this.anisotropy,flipY:this.flipY},void 0!==this.image&&(void 0===(n=this.image).uuid&&(n.uuid=Pe.generateUUID()),o||void 0!==e.images[n.uuid]||(e.images[n.uuid]={uuid:n.uuid,url:((i=n)instanceof HTMLCanvasElement?r=i:((r=document.createElementNS("http://www.w3.org/1999/xhtml","canvas")).width=i.width,r.height=i.height,a=r.getContext("2d"),i instanceof ImageData?a.putImageData(i,0,0):a.drawImage(i,0,0,i.width,i.height)),2048<r.width||2048<r.height?r.toDataURL("image/jpeg",.6):r.toDataURL("image/png"))}),t.image=n.uuid),o||(e.textures[this.uuid]=t),t):e.textures[this.uuid]},dispose:function(){this.dispatchEvent({type:"dispose"})},transformUv:function(e){if(300===this.mapping){if(e.applyMatrix3(this.matrix),e.x<0||1<e.x)switch(this.wrapS){case yo:e.x=e.x-Math.floor(e.x);break;case A:e.x=e.x<0?0:1;break;case xo:1===Math.abs(Math.floor(e.x)%2)?e.x=Math.ceil(e.x)-e.x:e.x=e.x-Math.floor(e.x)}if(e.y<0||1<e.y)switch(this.wrapT){case yo:e.y=e.y-Math.floor(e.y);break;case A:e.y=e.y<0?0:1;break;case xo:1===Math.abs(Math.floor(e.y)%2)?e.y=Math.ceil(e.y)-e.y:e.y=e.y-Math.floor(e.y)}this.flipY&&(e.y=1-e.y)}}}),Object.defineProperty(d.prototype,"needsUpdate",{set:function(e){!0===e&&this.version++}}),Object.assign(Le.prototype,{isVector4:!0,set:function(e,t,n,i){return this.x=e,this.y=t,this.z=n,this.w=i,this},setScalar:function(e){return this.x=e,this.y=e,this.z=e,this.w=e,this},setX:function(e){return this.x=e,this},setY:function(e){return this.y=e,this},setZ:function(e){return this.z=e,this},setW:function(e){return this.w=e,this},setComponent:function(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;case 2:this.z=t;break;case 3:this.w=t;break;default:throw new Error("index is out of range: "+e)}return this},getComponent:function(e){switch(e){case 0:return this.x;case 1:return this.y;case 2:return this.z;case 3:return this.w;default:throw new Error("index is out of range: "+e)}},clone:function(){return new this.constructor(this.x,this.y,this.z,this.w)},copy:function(e){return this.x=e.x,this.y=e.y,this.z=e.z,this.w=void 0!==e.w?e.w:1,this},add:function(e,t){return void 0!==t?(console.warn("THREE.Vector4: .add() now only accepts one argument. Use .addVectors( a, b ) instead."),this.addVectors(e,t)):(this.x+=e.x,this.y+=e.y,this.z+=e.z,this.w+=e.w,this)},addScalar:function(e){return this.x+=e,this.y+=e,this.z+=e,this.w+=e,this},addVectors:function(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this.z=e.z+t.z,this.w=e.w+t.w,this},addScaledVector:function(e,t){return this.x+=e.x*t,this.y+=e.y*t,this.z+=e.z*t,this.w+=e.w*t,this},sub:function(e,t){return void 0!==t?(console.warn("THREE.Vector4: .sub() now only accepts one argument. Use .subVectors( a, b ) instead."),this.subVectors(e,t)):(this.x-=e.x,this.y-=e.y,this.z-=e.z,this.w-=e.w,this)},subScalar:function(e){return this.x-=e,this.y-=e,this.z-=e,this.w-=e,this},subVectors:function(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this.z=e.z-t.z,this.w=e.w-t.w,this},multiplyScalar:function(e){return this.x*=e,this.y*=e,this.z*=e,this.w*=e,this},applyMatrix4:function(e){var t=this.x,n=this.y,i=this.z,r=this.w,e=e.elements;return this.x=e[0]*t+e[4]*n+e[8]*i+e[12]*r,this.y=e[1]*t+e[5]*n+e[9]*i+e[13]*r,this.z=e[2]*t+e[6]*n+e[10]*i+e[14]*r,this.w=e[3]*t+e[7]*n+e[11]*i+e[15]*r,this},divideScalar:function(e){return this.multiplyScalar(1/e)},setAxisAngleFromQuaternion:function(e){this.w=2*Math.acos(e.w);var t=Math.sqrt(1-e.w*e.w);return t<1e-4?(this.x=1,this.y=0,this.z=0):(this.x=e.x/t,this.y=e.y/t,this.z=e.z/t),this},setAxisAngleFromRotationMatrix:function(e){var t,n,i,r,a,o,s,c,l,h,e=e.elements,u=e[0],d=e[4],p=e[8],f=e[1],m=e[5],g=e[9],v=e[2],y=e[6],e=e[10];return Math.abs(d-f)<.01&&Math.abs(p-v)<.01&&Math.abs(g-y)<.01?Math.abs(d+f)<.1&&Math.abs(p+v)<.1&&Math.abs(g+y)<.1&&Math.abs(u+m+e-3)<.1?this.set(1,0,0,0):(r=Math.PI,o=(e+1)/2,s=(d+f)/4,c=(p+v)/4,l=(g+y)/4,(a=(m+1)/2)<(h=(u+1)/2)&&o<h?i=h<.01?(t=0,n=.707106781):(n=s/(t=Math.sqrt(h)),c/t):o<a?i=a<.01?(n=0,t=.707106781):(t=s/(n=Math.sqrt(a)),l/n):o<.01?(n=t=.707106781,i=0):(t=c/(i=Math.sqrt(o)),n=l/i),this.set(t,n,i,r)):(h=Math.sqrt((y-g)*(y-g)+(p-v)*(p-v)+(f-d)*(f-d)),Math.abs(h)<.001&&(h=1),this.x=(y-g)/h,this.y=(p-v)/h,this.z=(f-d)/h,this.w=Math.acos((u+m+e-1)/2)),this},min:function(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this.z=Math.min(this.z,e.z),this.w=Math.min(this.w,e.w),this},max:function(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this.z=Math.max(this.z,e.z),this.w=Math.max(this.w,e.w),this},clamp:function(e,t){return this.x=Math.max(e.x,Math.min(t.x,this.x)),this.y=Math.max(e.y,Math.min(t.y,this.y)),this.z=Math.max(e.z,Math.min(t.z,this.z)),this.w=Math.max(e.w,Math.min(t.w,this.w)),this},clampScalar:function(e,t){return void 0===hs&&(hs=new Le,us=new Le),hs.set(e,e,e,e),us.set(t,t,t,t),this.clamp(hs,us)},clampLength:function(e,t){var n=this.length();return this.divideScalar(n||1).multiplyScalar(Math.max(e,Math.min(t,n)))},floor:function(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this.w=Math.floor(this.w),this},ceil:function(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this.w=Math.ceil(this.w),this},round:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this.w=Math.round(this.w),this},roundToZero:function(){return this.x=this.x<0?Math.ceil(this.x):Math.floor(this.x),this.y=this.y<0?Math.ceil(this.y):Math.floor(this.y),this.z=this.z<0?Math.ceil(this.z):Math.floor(this.z),this.w=this.w<0?Math.ceil(this.w):Math.floor(this.w),this},negate:function(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this.w=-this.w,this},dot:function(e){return this.x*e.x+this.y*e.y+this.z*e.z+this.w*e.w},lengthSq:function(){return this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)},manhattanLength:function(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)+Math.abs(this.w)},normalize:function(){return this.divideScalar(this.length()||1)},setLength:function(e){return this.normalize().multiplyScalar(e)},lerp:function(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this.z+=(e.z-this.z)*t,this.w+=(e.w-this.w)*t,this},lerpVectors:function(e,t,n){return this.subVectors(t,e).multiplyScalar(n).add(e)},equals:function(e){return e.x===this.x&&e.y===this.y&&e.z===this.z&&e.w===this.w},fromArray:function(e,t){return this.x=e[t=void 0===t?0:t],this.y=e[t+1],this.z=e[t+2],this.w=e[t+3],this},toArray:function(e,t){return(e=void 0===e?[]:e)[t=void 0===t?0:t]=this.x,e[t+1]=this.y,e[t+2]=this.z,e[t+3]=this.w,e},fromBufferAttribute:function(e,t,n){return void 0!==n&&console.warn("THREE.Vector4: offset has been removed from .fromBufferAttribute()."),this.x=e.getX(t),this.y=e.getY(t),this.z=e.getZ(t),this.w=e.getW(t),this}}),L.prototype=Object.assign(Object.create(p.prototype),{constructor:L,isWebGLRenderTarget:!0,setSize:function(e,t){this.width===e&&this.height===t||(this.width=e,this.height=t,this.dispose()),this.viewport.set(0,0,e,t),this.scissor.set(0,0,e,t)},clone:function(){return(new this.constructor).copy(this)},copy:function(e){return this.width=e.width,this.height=e.height,this.viewport.copy(e.viewport),this.texture=e.texture.clone(),this.depthBuffer=e.depthBuffer,this.stencilBuffer=e.stencilBuffer,this.depthTexture=e.depthTexture,this},dispose:function(){this.dispatchEvent({type:"dispose"})}}),((P.prototype=Object.create(L.prototype)).constructor=P).prototype.isWebGLRenderTargetCube=!0,((Oe.prototype=Object.create(d.prototype)).constructor=Oe).prototype.isDataTexture=!0,((O.prototype=Object.create(d.prototype)).constructor=O).prototype.isCubeTexture=!0,Object.defineProperty(O.prototype,"images",{get:function(){return this.image},set:function(e){this.image=e}}),ps=new d,fs=new O,ms=[],gs=[],vs=new Float32Array(16),ys=new Float32Array(9),ue.prototype.setValue=function(e,t){for(var n=this.seq,i=0,r=n.length;i!==r;++i){var a=n[i];a.setValue(e,t[a.id])}},xs=/([\w\d_]+)(\])?(\[|\.)?/g,Ie.prototype.setValue=function(e,t,n){t=this.map[t];void 0!==t&&t.setValue(e,n,this.renderer)},Ie.prototype.setOptional=function(e,t,n){t=t[n];void 0!==t&&this.setValue(e,n,t)},Ie.upload=function(e,t,n,i){for(var r=0,a=t.length;r!==a;++r){var o=t[r],s=n[o.id];!1!==s.needsUpdate&&o.setValue(e,s.value,i)}},Ie.seqWithValue=function(e,t){for(var n=[],i=0,r=e.length;i!==r;++i){var a=e[i];a.id in t&&n.push(a)}return n},bs={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074},Object.assign(N.prototype,{isColor:!0,r:1,g:1,b:1,set:function(e){return e&&e.isColor?this.copy(e):"number"==typeof e?this.setHex(e):"string"==typeof e&&this.setStyle(e),this},setScalar:function(e){return this.r=e,this.g=e,this.b=e,this},setHex:function(e){return e=Math.floor(e),this.r=(e>>16&255)/255,this.g=(e>>8&255)/255,this.b=(255&e)/255,this},setRGB:function(e,t,n){return this.r=e,this.g=t,this.b=n,this},setHSL:function(e,t,n){return e=Pe.euclideanModulo(e,1),t=Pe.clamp(t,0,1),n=Pe.clamp(n,0,1),0===t?this.r=this.g=this.b=n:(this.r=pe(t=2*n-(n=n<=.5?n*(1+t):n+t-n*t),n,e+1/3),this.g=pe(t,n,e),this.b=pe(t,n,e-1/3)),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,a,o,s=n[1],c=n[2];switch(s){case"rgb":case"rgba":if(i=/^(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(,\s*([0-9]*\.?[0-9]+)\s*)?$/.exec(c))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(c))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(c))return r=parseFloat(i[1])/360,a=parseInt(i[2],10)/100,o=parseInt(i[3],10)/100,e(i[5]),this.setHSL(r,a,o)}}else if(n=/^\#([A-Fa-f0-9]+)$/.exec(t)){var l,s=(l=n[1]).length;if(3===s)return this.r=parseInt(l.charAt(0)+l.charAt(0),16)/255,this.g=parseInt(l.charAt(1)+l.charAt(1),16)/255,this.b=parseInt(l.charAt(2)+l.charAt(2),16)/255,this;if(6===s)return this.r=parseInt(l.charAt(0)+l.charAt(1),16)/255,this.g=parseInt(l.charAt(2)+l.charAt(3),16)/255,this.b=parseInt(l.charAt(4)+l.charAt(5),16)/255,this}return t&&0<t.length&&(void 0!==(l=bs[t])?this.setHex(l):console.warn("THREE.Color: Unknown color "+t)),this},clone:function(){return new this.constructor(this.r,this.g,this.b)},copy:function(e){return this.r=e.r,this.g=e.g,this.b=e.b,this},copyGammaToLinear:function(e,t){return void 0===t&&(t=2),this.r=Math.pow(e.r,t),this.g=Math.pow(e.g,t),this.b=Math.pow(e.b,t),this},copyLinearToGamma:function(e,t){t=0<(t=void 0===t?2:t)?1/t:1;return this.r=Math.pow(e.r,t),this.g=Math.pow(e.g,t),this.b=Math.pow(e.b,t),this},convertGammaToLinear:function(){var e=this.r,t=this.g,n=this.b;return this.r=e*e,this.g=t*t,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(e){var t,e=e||{h:0,s:0,l:0},n=this.r,i=this.g,r=this.b,a=Math.max(n,i,r),o=Math.min(n,i,r),s=(o+a)/2;if(o===a)l=t=0;else{var c=a-o,l=s<=.5?c/(a+o):c/(2-a-o);switch(a){case n:t=(i-r)/c+(i<r?6:0);break;case i:t=(r-n)/c+2;break;case r:t=(n-i)/c+4}t/=6}return e.h=t,e.s=l,e.l=s,e},getStyle:function(){return"rgb("+(255*this.r|0)+","+(255*this.g|0)+","+(255*this.b|0)+")"},offsetHSL:function(e,t,n){var i=this.getHSL();return i.h+=e,i.s+=t,i.l+=n,this.setHSL(i.h,i.s,i.l),this},add:function(e){return this.r+=e.r,this.g+=e.g,this.b+=e.b,this},addColors:function(e,t){return this.r=e.r+t.r,this.g=e.g+t.g,this.b=e.b+t.b,this},addScalar:function(e){return this.r+=e,this.g+=e,this.b+=e,this},sub:function(e){return this.r=Math.max(0,this.r-e.r),this.g=Math.max(0,this.g-e.g),this.b=Math.max(0,this.b-e.b),this},multiply:function(e){return this.r*=e.r,this.g*=e.g,this.b*=e.b,this},multiplyScalar:function(e){return this.r*=e,this.g*=e,this.b*=e,this},lerp:function(e,t){return this.r+=(e.r-this.r)*t,this.g+=(e.g-this.g)*t,this.b+=(e.b-this.b)*t,this},equals:function(e){return e.r===this.r&&e.g===this.g&&e.b===this.b},fromArray:function(e,t){return this.r=e[t=void 0===t?0:t],this.g=e[t+1],this.b=e[t+2],this},toArray:function(e,t){return(e=void 0===e?[]:e)[t=void 0===t?0:t]=this.r,e[t+1]=this.g,e[t+2]=this.b,e},toJSON:function(){return this.getHex()}}),Ne={common:{diffuse:{value:new N(15658734)},opacity:{value:1},map:{value:null},uvTransform:{value:new S},alphaMap:{value:null}},specularmap:{specularMap:{value:null}},envmap:{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 te(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 N(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:{},shadowCameraNear:{},shadowCameraFar:{}}},pointShadowMap:{value:[]},pointShadowMatrix:{value:[]},hemisphereLights:{value:[],properties:{direction:{},skyColor:{},groundColor:{}}},rectAreaLights:{value:[],properties:{color:{},position:{},width:{},height:{}}}},points:{diffuse:{value:new N(15658734)},opacity:{value:1},size:{value:1},scale:{value:1},map:{value:null},uvTransform:{value:new S}}},E={alphamap_fragment:"#ifdef USE_ALPHAMAP\n\tdiffuseColor.a *= texture2D( alphaMap, vUv ).g;\n#endif\n",alphamap_pars_fragment:"#ifdef USE_ALPHAMAP\n\tuniform sampler2D alphaMap;\n#endif\n",alphatest_fragment:"#ifdef ALPHATEST\n\tif ( diffuseColor.a < ALPHATEST ) discard;\n#endif\n",aomap_fragment:"#ifdef USE_AOMAP\n\tfloat ambientOcclusion = ( texture2D( aoMap, vUv2 ).r - 1.0 ) * aoMapIntensity + 1.0;\n\treflectedLight.indirectDiffuse *= ambientOcclusion;\n\t#if defined( USE_ENVMAP ) && defined( PHYSICAL )\n\t\tfloat dotNV = saturate( dot( geometry.normal, geometry.viewDir ) );\n\t\treflectedLight.indirectSpecular *= computeSpecularOcclusion( dotNV, ambientOcclusion, material.specularRoughness );\n\t#endif\n#endif\n",aomap_pars_fragment:"#ifdef USE_AOMAP\n\tuniform sampler2D aoMap;\n\tuniform float aoMapIntensity;\n#endif",begin_vertex:"\nvec3 transformed = vec3( position );\n",beginnormal_vertex:"\nvec3 objectNormal = vec3( normal );\n",bsdfs:"float punctualLightIntensityToIrradianceFactor( const in float lightDistance, const in float cutoffDistance, const in float decayExponent ) {\n\tif( decayExponent > 0.0 ) {\n#if defined ( PHYSICALLY_CORRECT_LIGHTS )\n\t\tfloat distanceFalloff = 1.0 / max( pow( lightDistance, decayExponent ), 0.01 );\n\t\tfloat maxDistanceCutoffFactor = pow2( saturate( 1.0 - pow4( lightDistance / cutoffDistance ) ) );\n\t\treturn distanceFalloff * maxDistanceCutoffFactor;\n#else\n\t\treturn pow( saturate( -lightDistance / cutoffDistance + 1.0 ), decayExponent );\n#endif\n\t}\n\treturn 1.0;\n}\nvec3 BRDF_Diffuse_Lambert( const in vec3 diffuseColor ) {\n\treturn RECIPROCAL_PI * diffuseColor;\n}\nvec3 F_Schlick( const in vec3 specularColor, const in float dotLH ) {\n\tfloat fresnel = exp2( ( -5.55473 * dotLH - 6.98316 ) * dotLH );\n\treturn ( 1.0 - specularColor ) * fresnel + specularColor;\n}\nfloat G_GGX_Smith( const in float alpha, const in float dotNL, const in float dotNV ) {\n\tfloat a2 = pow2( alpha );\n\tfloat gl = dotNL + sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNL ) );\n\tfloat gv = dotNV + sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNV ) );\n\treturn 1.0 / ( gl * gv );\n}\nfloat G_GGX_SmithCorrelated( const in float alpha, const in float dotNL, const in float dotNV ) {\n\tfloat a2 = pow2( alpha );\n\tfloat gv = dotNL * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNV ) );\n\tfloat gl = dotNV * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNL ) );\n\treturn 0.5 / max( gv + gl, EPSILON );\n}\nfloat D_GGX( const in float alpha, const in float dotNH ) {\n\tfloat a2 = pow2( alpha );\n\tfloat denom = pow2( dotNH ) * ( a2 - 1.0 ) + 1.0;\n\treturn RECIPROCAL_PI * a2 / pow2( denom );\n}\nvec3 BRDF_Specular_GGX( const in IncidentLight incidentLight, const in GeometricContext geometry, const in vec3 specularColor, const in float roughness ) {\n\tfloat alpha = pow2( roughness );\n\tvec3 halfDir = normalize( incidentLight.direction + geometry.viewDir );\n\tfloat dotNL = saturate( dot( geometry.normal, incidentLight.direction ) );\n\tfloat dotNV = saturate( dot( geometry.normal, geometry.viewDir ) );\n\tfloat dotNH = saturate( dot( geometry.normal, halfDir ) );\n\tfloat dotLH = saturate( dot( incidentLight.direction, halfDir ) );\n\tvec3 F = F_Schlick( specularColor, dotLH );\n\tfloat G = G_GGX_SmithCorrelated( alpha, dotNL, dotNV );\n\tfloat D = D_GGX( alpha, dotNH );\n\treturn F * ( G * D );\n}\nvec2 LTC_Uv( const in vec3 N, const in vec3 V, const in float roughness ) {\n\tconst float LUT_SIZE = 64.0;\n\tconst float LUT_SCALE = ( LUT_SIZE - 1.0 ) / LUT_SIZE;\n\tconst float LUT_BIAS = 0.5 / LUT_SIZE;\n\tfloat theta = acos( dot( N, V ) );\n\tvec2 uv = vec2(\n\t\tsqrt( saturate( roughness ) ),\n\t\tsaturate( theta / ( 0.5 * PI ) ) );\n\tuv = uv * LUT_SCALE + LUT_BIAS;\n\treturn uv;\n}\nfloat LTC_ClippedSphereFormFactor( const in vec3 f ) {\n\tfloat l = length( f );\n\treturn max( ( l * l + f.z ) / ( l + 1.0 ), 0.0 );\n}\nvec3 LTC_EdgeVectorFormFactor( const in vec3 v1, const in vec3 v2 ) {\n\tfloat x = dot( v1, v2 );\n\tfloat y = abs( x );\n\tfloat a = 0.86267 + (0.49788 + 0.01436 * y ) * y;\n\tfloat b = 3.45068 + (4.18814 + y) * y;\n\tfloat v = a / b;\n\tfloat theta_sintheta = (x > 0.0) ? v : 0.5 * inversesqrt( 1.0 - x * x ) - v;\n\treturn cross( v1, v2 ) * theta_sintheta;\n}\nvec3 LTC_Evaluate( const in vec3 N, const in vec3 V, const in vec3 P, const in mat3 mInv, const in vec3 rectCoords[ 4 ] ) {\n\tvec3 v1 = rectCoords[ 1 ] - rectCoords[ 0 ];\n\tvec3 v2 = rectCoords[ 3 ] - rectCoords[ 0 ];\n\tvec3 lightNormal = cross( v1, v2 );\n\tif( dot( lightNormal, P - rectCoords[ 0 ] ) < 0.0 ) return vec3( 0.0 );\n\tvec3 T1, T2;\n\tT1 = normalize( V - N * dot( V, N ) );\n\tT2 = - cross( N, T1 );\n\tmat3 mat = mInv * transposeMat3( mat3( T1, T2, N ) );\n\tvec3 coords[ 4 ];\n\tcoords[ 0 ] = mat * ( rectCoords[ 0 ] - P );\n\tcoords[ 1 ] = mat * ( rectCoords[ 1 ] - P );\n\tcoords[ 2 ] = mat * ( rectCoords[ 2 ] - P );\n\tcoords[ 3 ] = mat * ( rectCoords[ 3 ] - P );\n\tcoords[ 0 ] = normalize( coords[ 0 ] );\n\tcoords[ 1 ] = normalize( coords[ 1 ] );\n\tcoords[ 2 ] = normalize( coords[ 2 ] );\n\tcoords[ 3 ] = normalize( coords[ 3 ] );\n\tvec3 vectorFormFactor = vec3( 0.0 );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 0 ], coords[ 1 ] );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 1 ], coords[ 2 ] );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 2 ], coords[ 3 ] );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 3 ], coords[ 0 ] );\n\tvec3 result = vec3( LTC_ClippedSphereFormFactor( vectorFormFactor ) );\n\treturn result;\n}\nvec3 BRDF_Specular_GGX_Environment( const in GeometricContext geometry, const in vec3 specularColor, const in float roughness ) {\n\tfloat dotNV = saturate( dot( geometry.normal, geometry.viewDir ) );\n\tconst vec4 c0 = vec4( - 1, - 0.0275, - 0.572, 0.022 );\n\tconst vec4 c1 = vec4( 1, 0.0425, 1.04, - 0.04 );\n\tvec4 r = roughness * c0 + c1;\n\tfloat a004 = min( r.x * r.x, exp2( - 9.28 * dotNV ) ) * r.x + r.y;\n\tvec2 AB = vec2( -1.04, 1.04 ) * a004 + r.zw;\n\treturn specularColor * AB.x + AB.y;\n}\nfloat G_BlinnPhong_Implicit( ) {\n\treturn 0.25;\n}\nfloat D_BlinnPhong( const in float shininess, const in float dotNH ) {\n\treturn RECIPROCAL_PI * ( shininess * 0.5 + 1.0 ) * pow( dotNH, shininess );\n}\nvec3 BRDF_Specular_BlinnPhong( const in IncidentLight incidentLight, const in GeometricContext geometry, const in vec3 specularColor, const in float shininess ) {\n\tvec3 halfDir = normalize( incidentLight.direction + geometry.viewDir );\n\tfloat dotNH = saturate( dot( geometry.normal, halfDir ) );\n\tfloat dotLH = saturate( dot( incidentLight.direction, halfDir ) );\n\tvec3 F = F_Schlick( specularColor, dotLH );\n\tfloat G = G_BlinnPhong_Implicit( );\n\tfloat D = D_BlinnPhong( shininess, dotNH );\n\treturn F * ( G * D );\n}\nfloat GGXRoughnessToBlinnExponent( const in float ggxRoughness ) {\n\treturn ( 2.0 / pow2( ggxRoughness + 0.0001 ) - 2.0 );\n}\nfloat BlinnExponentToGGXRoughness( const in float blinnExponent ) {\n\treturn sqrt( 2.0 / ( blinnExponent + 2.0 ) );\n}\n",bumpmap_pars_fragment:"#ifdef USE_BUMPMAP\n\tuniform sampler2D bumpMap;\n\tuniform float bumpScale;\n\tvec2 dHdxy_fwd() {\n\t\tvec2 dSTdx = dFdx( vUv );\n\t\tvec2 dSTdy = dFdy( vUv );\n\t\tfloat Hll = bumpScale * texture2D( bumpMap, vUv ).x;\n\t\tfloat dBx = bumpScale * texture2D( bumpMap, vUv + dSTdx ).x - Hll;\n\t\tfloat dBy = bumpScale * texture2D( bumpMap, vUv + dSTdy ).x - Hll;\n\t\treturn vec2( dBx, dBy );\n\t}\n\tvec3 perturbNormalArb( vec3 surf_pos, vec3 surf_norm, vec2 dHdxy ) {\n\t\tvec3 vSigmaX = vec3( dFdx( surf_pos.x ), dFdx( surf_pos.y ), dFdx( surf_pos.z ) );\n\t\tvec3 vSigmaY = vec3( dFdy( surf_pos.x ), dFdy( surf_pos.y ), dFdy( surf_pos.z ) );\n\t\tvec3 vN = surf_norm;\n\t\tvec3 R1 = cross( vSigmaY, vN );\n\t\tvec3 R2 = cross( vN, vSigmaX );\n\t\tfloat fDet = dot( vSigmaX, R1 );\n\t\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 transposeMat3( const in mat3 m ) {\n\tmat3 tmp;\n\ttmp[ 0 ] = vec3( m[ 0 ].x, m[ 1 ].x, m[ 2 ].x );\n\ttmp[ 1 ] = vec3( m[ 0 ].y, m[ 1 ].y, m[ 2 ].y );\n\ttmp[ 2 ] = vec3( m[ 0 ].z, m[ 1 ].z, m[ 2 ].z );\n\treturn tmp;\n}\nfloat linearToRelativeLuminance( const in vec3 color ) {\n\tvec3 weights = vec3( 0.2126, 0.7152, 0.0722 );\n\treturn dot( weights, color.rgb );\n}\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:"vec3 transformedNormal = normalMatrix * objectNormal;\n#ifdef FLIP_SIDED\n\ttransformedNormal = - transformedNormal;\n#endif\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 += normalize( objectNormal ) * ( 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, vec3( flipEnvMap * reflectVec.x, reflectVec.yz ) );\n\t#elif defined( ENVMAP_TYPE_EQUIREC )\n\t\tvec2 sampleUV;\n\t\treflectVec = normalize( reflectVec );\n\t\tsampleUV.y = asin( clamp( reflectVec.y, - 1.0, 1.0 ) ) * RECIPROCAL_PI + 0.5;\n\t\tsampleUV.x = atan( reflectVec.z, reflectVec.x ) * RECIPROCAL_PI2 + 0.5;\n\t\tvec4 envColor = texture2D( envMap, sampleUV );\n\t#elif defined( ENVMAP_TYPE_SPHERE )\n\t\treflectVec = normalize( reflectVec );\n\t\tvec3 reflectView = normalize( ( viewMatrix * vec4( reflectVec, 0.0 ) ).xyz + vec3( 0.0, 0.0, 1.0 ) );\n\t\tvec4 envColor = texture2D( envMap, reflectView.xy * 0.5 + 0.5 );\n\t#else\n\t\tvec4 envColor = vec4( 0.0 );\n\t#endif\n\tenvColor = envMapTexelToLinear( envColor );\n\t#ifdef ENVMAP_BLENDING_MULTIPLY\n\t\toutgoingLight = mix( outgoingLight, outgoingLight * envColor.xyz, specularStrength * reflectivity );\n\t#elif defined( ENVMAP_BLENDING_MIX )\n\t\toutgoingLight = mix( outgoingLight, envColor.xyz, specularStrength * reflectivity );\n\t#elif defined( ENVMAP_BLENDING_ADD )\n\t\toutgoingLight += envColor.xyz * specularStrength * reflectivity;\n\t#endif\n#endif\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\tfloat shadowCameraNear;\n\t\tfloat shadowCameraFar;\n\t};\n\tuniform PointLight pointLights[ NUM_POINT_LIGHTS ];\n\tvoid getPointDirectLightIrradiance( const in PointLight pointLight, const in GeometricContext geometry, out IncidentLight directLight ) {\n\t\tvec3 lVector = pointLight.position - geometry.position;\n\t\tdirectLight.direction = normalize( lVector );\n\t\tfloat lightDistance = length( lVector );\n\t\tdirectLight.color = pointLight.color;\n\t\tdirectLight.color *= punctualLightIntensityToIrradianceFactor( lightDistance, pointLight.distance, pointLight.decay );\n\t\tdirectLight.visible = ( directLight.color != vec3( 0.0 ) );\n\t}\n#endif\n#if NUM_SPOT_LIGHTS > 0\n\tstruct SpotLight {\n\t\tvec3 position;\n\t\tvec3 direction;\n\t\tvec3 color;\n\t\tfloat distance;\n\t\tfloat decay;\n\t\tfloat coneCos;\n\t\tfloat penumbraCos;\n\t\tint shadow;\n\t\tfloat shadowBias;\n\t\tfloat shadowRadius;\n\t\tvec2 shadowMapSize;\n\t};\n\tuniform SpotLight spotLights[ NUM_SPOT_LIGHTS ];\n\tvoid getSpotDirectLightIrradiance( const in SpotLight spotLight, const in GeometricContext geometry, out IncidentLight directLight ) {\n\t\tvec3 lVector = spotLight.position - geometry.position;\n\t\tdirectLight.direction = normalize( lVector );\n\t\tfloat lightDistance = length( lVector );\n\t\tfloat angleCos = dot( directLight.direction, spotLight.direction );\n\t\tif ( angleCos > spotLight.coneCos ) {\n\t\t\tfloat spotEffect = smoothstep( spotLight.coneCos, spotLight.penumbraCos, angleCos );\n\t\t\tdirectLight.color = spotLight.color;\n\t\t\tdirectLight.color *= spotEffect * punctualLightIntensityToIrradianceFactor( lightDistance, spotLight.distance, spotLight.decay );\n\t\t\tdirectLight.visible = true;\n\t\t} else {\n\t\t\tdirectLight.color = vec3( 0.0 );\n\t\t\tdirectLight.visible = false;\n\t\t}\n\t}\n#endif\n#if NUM_RECT_AREA_LIGHTS > 0\n\tstruct RectAreaLight {\n\t\tvec3 color;\n\t\tvec3 position;\n\t\tvec3 halfWidth;\n\t\tvec3 halfHeight;\n\t};\n\tuniform sampler2D 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 = asin( clamp( reflectVec.y, - 1.0, 1.0 ) ) * RECIPROCAL_PI + 0.5;\n\t\t\tsampleUV.x = atan( reflectVec.z, reflectVec.x ) * RECIPROCAL_PI2 + 0.5;\n\t\t\t#ifdef TEXTURE_LOD_EXT\n\t\t\t\tvec4 envMapColor = texture2DLodEXT( envMap, sampleUV, specularMIPLevel );\n\t\t\t#else\n\t\t\t\tvec4 envMapColor = texture2D( envMap, sampleUV, specularMIPLevel );\n\t\t\t#endif\n\t\t\tenvMapColor.rgb = envMapTexelToLinear( envMapColor ).rgb;\n\t\t#elif defined( ENVMAP_TYPE_SPHERE )\n\t\t\tvec3 reflectView = normalize( ( viewMatrix * vec4( reflectVec, 0.0 ) ).xyz + vec3( 0.0,0.0,1.0 ) );\n\t\t\t#ifdef TEXTURE_LOD_EXT\n\t\t\t\tvec4 envMapColor = texture2DLodEXT( envMap, reflectView.xy * 0.5 + 0.5, specularMIPLevel );\n\t\t\t#else\n\t\t\t\tvec4 envMapColor = texture2D( envMap, reflectView.xy * 0.5 + 0.5, specularMIPLevel );\n\t\t\t#endif\n\t\t\tenvMapColor.rgb = envMapTexelToLinear( envMapColor ).rgb;\n\t\t#endif\n\t\treturn envMapColor.rgb * envMapIntensity;\n\t}\n#endif\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};\nvoid RE_Direct_BlinnPhong( const in IncidentLight directLight, const in GeometricContext geometry, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {\n\t#ifdef TOON\n\t\tvec3 irradiance = getGradientIrradiance( geometry.normal, directLight.direction ) * directLight.color;\n\t#else\n\t\tfloat dotNL = saturate( dot( geometry.normal, directLight.direction ) );\n\t\tvec3 irradiance = dotNL * directLight.color;\n\t#endif\n\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\t\tirradiance *= PI;\n\t#endif\n\treflectedLight.directDiffuse += irradiance * BRDF_Diffuse_Lambert( material.diffuseColor );\n\treflectedLight.directSpecular += irradiance * BRDF_Specular_BlinnPhong( directLight, geometry, material.specularColor, material.specularShininess ) * material.specularStrength;\n}\nvoid RE_IndirectDiffuse_BlinnPhong( const in vec3 irradiance, const in GeometricContext geometry, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {\n\treflectedLight.indirectDiffuse += irradiance * BRDF_Diffuse_Lambert( material.diffuseColor );\n}\n#define RE_Direct\t\t\t\tRE_Direct_BlinnPhong\n#define RE_IndirectDiffuse\t\tRE_IndirectDiffuse_BlinnPhong\n#define Material_LightProbeLOD( material )\t(0)\n",lights_physical_fragment:"PhysicalMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb * ( 1.0 - metalnessFactor );\nmaterial.specularRoughness = clamp( roughnessFactor, 0.04, 1.0 );\n#ifdef STANDARD\n\tmaterial.specularColor = mix( vec3( DEFAULT_SPECULAR_COEFFICIENT ), diffuseColor.rgb, metalnessFactor );\n#else\n\tmaterial.specularColor = mix( vec3( MAXIMUM_SPECULAR_COEFFICIENT * pow2( reflectivity ) ), diffuseColor.rgb, metalnessFactor );\n\tmaterial.clearCoat = saturate( clearCoat );\tmaterial.clearCoatRoughness = clamp( clearCoatRoughness, 0.04, 1.0 );\n#endif\n",lights_physical_pars_fragment:"struct PhysicalMaterial {\n\tvec3\tdiffuseColor;\n\tfloat\tspecularRoughness;\n\tvec3\tspecularColor;\n\t#ifndef STANDARD\n\t\tfloat clearCoat;\n\t\tfloat clearCoatRoughness;\n\t#endif\n};\n#define MAXIMUM_SPECULAR_COEFFICIENT 0.16\n#define DEFAULT_SPECULAR_COEFFICIENT 0.04\nfloat clearCoatDHRApprox( const in float roughness, const in float dotNL ) {\n\treturn DEFAULT_SPECULAR_COEFFICIENT + ( 1.0 - DEFAULT_SPECULAR_COEFFICIENT ) * ( pow( 1.0 - dotNL, 5.0 ) * pow( 1.0 - roughness, 2.0 ) );\n}\n#if NUM_RECT_AREA_LIGHTS > 0\n\tvoid RE_Direct_RectArea_Physical( const in RectAreaLight rectAreaLight, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n\t\tvec3 normal = geometry.normal;\n\t\tvec3 viewDir = geometry.viewDir;\n\t\tvec3 position = geometry.position;\n\t\tvec3 lightPos = rectAreaLight.position;\n\t\tvec3 halfWidth = rectAreaLight.halfWidth;\n\t\tvec3 halfHeight = rectAreaLight.halfHeight;\n\t\tvec3 lightColor = rectAreaLight.color;\n\t\tfloat roughness = material.specularRoughness;\n\t\tvec3 rectCoords[ 4 ];\n\t\trectCoords[ 0 ] = lightPos - halfWidth - halfHeight;\t\trectCoords[ 1 ] = lightPos + halfWidth - halfHeight;\n\t\trectCoords[ 2 ] = lightPos + halfWidth + halfHeight;\n\t\trectCoords[ 3 ] = lightPos - halfWidth + halfHeight;\n\t\tvec2 uv = LTC_Uv( normal, viewDir, roughness );\n\t\tfloat norm = texture2D( ltcMag, uv ).a;\n\t\tvec4 t = texture2D( ltcMat, uv );\n\t\tmat3 mInv = mat3(\n\t\t\tvec3( 1, 0, t.y ),\n\t\t\tvec3( 0, t.z, 0 ),\n\t\t\tvec3( t.w, 0, t.x )\n\t\t);\n\t\treflectedLight.directSpecular += lightColor * material.specularColor * norm * LTC_Evaluate( normal, viewDir, position, mInv, rectCoords );\n\t\treflectedLight.directDiffuse += lightColor * material.diffuseColor * LTC_Evaluate( normal, viewDir, position, mat3( 1 ), rectCoords );\n\t}\n#endif\nvoid RE_Direct_Physical( const in IncidentLight directLight, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n\tfloat dotNL = saturate( dot( geometry.normal, directLight.direction ) );\n\tvec3 irradiance = dotNL * directLight.color;\n\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\t\tirradiance *= PI;\n\t#endif\n\t#ifndef STANDARD\n\t\tfloat clearCoatDHR = material.clearCoat * clearCoatDHRApprox( material.clearCoatRoughness, dotNL );\n\t#else\n\t\tfloat clearCoatDHR = 0.0;\n\t#endif\n\treflectedLight.directSpecular += ( 1.0 - clearCoatDHR ) * irradiance * BRDF_Specular_GGX( directLight, geometry, material.specularColor, material.specularRoughness );\n\treflectedLight.directDiffuse += ( 1.0 - clearCoatDHR ) * irradiance * BRDF_Diffuse_Lambert( material.diffuseColor );\n\t#ifndef STANDARD\n\t\treflectedLight.directSpecular += irradiance * material.clearCoat * BRDF_Specular_GGX( directLight, geometry, vec3( DEFAULT_SPECULAR_COEFFICIENT ), material.clearCoatRoughness );\n\t#endif\n}\nvoid RE_IndirectDiffuse_Physical( const in vec3 irradiance, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n\treflectedLight.indirectDiffuse += irradiance * BRDF_Diffuse_Lambert( material.diffuseColor );\n}\nvoid RE_IndirectSpecular_Physical( const in vec3 radiance, const in vec3 clearCoatRadiance, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n\t#ifndef STANDARD\n\t\tfloat dotNV = saturate( dot( geometry.normal, geometry.viewDir ) );\n\t\tfloat dotNL = dotNV;\n\t\tfloat clearCoatDHR = material.clearCoat * clearCoatDHRApprox( material.clearCoatRoughness, dotNL );\n\t#else\n\t\tfloat clearCoatDHR = 0.0;\n\t#endif\n\treflectedLight.indirectSpecular += ( 1.0 - clearCoatDHR ) * radiance * BRDF_Specular_GGX_Environment( geometry, material.specularColor, material.specularRoughness );\n\t#ifndef STANDARD\n\t\treflectedLight.indirectSpecular += clearCoatRadiance * material.clearCoat * BRDF_Specular_GGX_Environment( geometry, vec3( DEFAULT_SPECULAR_COEFFICIENT ), material.clearCoatRoughness );\n\t#endif\n}\n#define RE_Direct\t\t\t\tRE_Direct_Physical\n#define RE_Direct_RectArea\t\tRE_Direct_RectArea_Physical\n#define RE_IndirectDiffuse\t\tRE_IndirectDiffuse_Physical\n#define RE_IndirectSpecular\t\tRE_IndirectSpecular_Physical\n#define Material_BlinnShininessExponent( material ) GGXRoughnessToBlinnExponent( material.specularRoughness )\n#define Material_ClearCoat_BlinnShininessExponent( material ) GGXRoughnessToBlinnExponent( material.clearCoatRoughness )\nfloat computeSpecularOcclusion( const in float dotNV, const in float ambientOcclusion, const in float roughness ) {\n\treturn saturate( pow( dotNV + ambientOcclusion, exp2( - 16.0 * roughness - 1.0 ) ) - 1.0 + ambientOcclusion );\n}\n",lights_template:"\nGeometricContext geometry;\ngeometry.position = - vViewPosition;\ngeometry.normal = normal;\ngeometry.viewDir = normalize( vViewPosition );\nIncidentLight directLight;\n#if ( NUM_POINT_LIGHTS > 0 ) && defined( RE_Direct )\n\tPointLight pointLight;\n\tfor ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {\n\t\tpointLight = pointLights[ i ];\n\t\tgetPointDirectLightIrradiance( pointLight, geometry, directLight );\n\t\t#ifdef USE_SHADOWMAP\n\t\tdirectLight.color *= all( bvec2( pointLight.shadow, directLight.visible ) ) ? getPointShadow( pointShadowMap[ i ], pointLight.shadowMapSize, pointLight.shadowBias, pointLight.shadowRadius, vPointShadowCoord[ i ], pointLight.shadowCameraNear, pointLight.shadowCameraFar ) : 1.0;\n\t\t#endif\n\t\tRE_Direct( directLight, geometry, material, reflectedLight );\n\t}\n#endif\n#if ( NUM_SPOT_LIGHTS > 0 ) && defined( RE_Direct )\n\tSpotLight spotLight;\n\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\t#ifdef USE_LOGDEPTHBUF_EXT\n\t\tvFragDepth = 1.0 + gl_Position.w;\n\t#else\n\t\tgl_Position.z = log2( max( EPSILON, gl_Position.w + 1.0 ) ) * logDepthBufFC - 1.0;\n\t\tgl_Position.z *= 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\tvec2 uv = ( uvTransform * vec3( gl_PointCoord.x, 1.0 - gl_PointCoord.y, 1 ) ).xy;\n\tvec4 mapTexel = texture2D( map, uv );\n\tdiffuseColor *= mapTexelToLinear( mapTexel );\n#endif\n",map_particle_pars_fragment:"#ifdef USE_MAP\n\tuniform mat3 uvTransform;\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_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 );\n\t#ifdef DOUBLE_SIDED\n\t\tnormal = normal * ( float( gl_FrontFacing ) * 2.0 - 1.0 );\n\t#endif\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 = vec3( dFdx( eye_pos.x ), dFdx( eye_pos.y ), dFdx( eye_pos.z ) );\n\t\tvec3 q1 = vec3( dFdy( eye_pos.x ), dFdy( eye_pos.y ), dFdy( eye_pos.z ) );\n\t\tvec2 st0 = dFdx( vUv.st );\n\t\tvec2 st1 = dFdy( vUv.st );\n\t\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 2.0 * rgb.xyz - 1.0;\n}\nconst float PackUpscale = 256. / 255.;const float UnpackDownscale = 255. / 256.;\nconst vec3 PackFactors = vec3( 256. * 256. * 256., 256. * 256., 256. );\nconst vec4 UnpackFactors = UnpackDownscale / vec4( PackFactors, 1. );\nconst float ShiftRight8 = 1. / 256.;\nvec4 packDepthToRGBA( const in float v ) {\n\tvec4 r = vec4( fract( v * PackFactors ), v );\n\tr.yzw -= r.xyz * ShiftRight8;\treturn r * PackUpscale;\n}\nfloat unpackRGBAToDepth( const in vec4 v ) {\n\treturn dot( v, UnpackFactors );\n}\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:"vec4 mvPosition = modelViewMatrix * vec4( transformed, 1.0 );\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\tfloat shadow = 1.0;\n\t\tshadowCoord.xyz /= shadowCoord.w;\n\t\tshadowCoord.z += shadowBias;\n\t\tbvec4 inFrustumVec = bvec4 ( shadowCoord.x >= 0.0, shadowCoord.x <= 1.0, shadowCoord.y >= 0.0, shadowCoord.y <= 1.0 );\n\t\tbool inFrustum = all( inFrustumVec );\n\t\tbvec2 frustumTestVec = bvec2( inFrustum, shadowCoord.z <= 1.0 );\n\t\tbool frustumTest = all( frustumTestVec );\n\t\tif ( frustumTest ) {\n\t\t#if defined( SHADOWMAP_TYPE_PCF )\n\t\t\tvec2 texelSize = vec2( 1.0 ) / shadowMapSize;\n\t\t\tfloat dx0 = - texelSize.x * shadowRadius;\n\t\t\tfloat dy0 = - texelSize.y * shadowRadius;\n\t\t\tfloat dx1 = + texelSize.x * shadowRadius;\n\t\t\tfloat dy1 = + texelSize.y * shadowRadius;\n\t\t\tshadow = (\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 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\tshadow = (\n\t\t\t\ttexture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy + vec2( dx0, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy + vec2( 0.0, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy + vec2( dx1, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy + vec2( dx0, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy, shadowCoord.z ) +\n\t\t\t\ttexture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy + vec2( dx1, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy + vec2( dx0, dy1 ), shadowCoord.z ) +\n\t\t\t\ttexture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy + vec2( 0.0, dy1 ), shadowCoord.z ) +\n\t\t\t\ttexture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy + vec2( dx1, dy1 ), shadowCoord.z )\n\t\t\t) * ( 1.0 / 9.0 );\n\t\t#else\n\t\t\tshadow = texture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z );\n\t\t#endif\n\t\t}\n\t\treturn shadow;\n\t}\n\tvec2 cubeToUV( vec3 v, float texelSizeY ) {\n\t\tvec3 absV = abs( v );\n\t\tfloat scaleToCube = 1.0 / max( absV.x, max( absV.y, absV.z ) );\n\t\tabsV *= scaleToCube;\n\t\tv *= scaleToCube * ( 1.0 - 2.0 * texelSizeY );\n\t\tvec2 planar = v.xy;\n\t\tfloat almostATexel = 1.5 * texelSizeY;\n\t\tfloat almostOne = 1.0 - almostATexel;\n\t\tif ( absV.z >= almostOne ) {\n\t\t\tif ( v.z > 0.0 )\n\t\t\t\tplanar.x = 4.0 - v.x;\n\t\t} else if ( absV.x >= almostOne ) {\n\t\t\tfloat signX = sign( v.x );\n\t\t\tplanar.x = v.z * signX + 2.0 * signX;\n\t\t} else if ( absV.y >= almostOne ) {\n\t\t\tfloat signY = sign( v.y );\n\t\t\tplanar.x = v.x + 2.0 * signY + 2.0;\n\t\t\tplanar.y = v.z * signY - 2.0;\n\t\t}\n\t\treturn vec2( 0.125, 0.25 ) * planar + vec2( 0.375, 0.75 );\n\t}\n\tfloat getPointShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowBias, float shadowRadius, vec4 shadowCoord, float shadowCameraNear, float shadowCameraFar ) {\n\t\tvec2 texelSize = vec2( 1.0 ) / ( shadowMapSize * vec2( 4.0, 2.0 ) );\n\t\tvec3 lightToPosition = shadowCoord.xyz;\n\t\tfloat dp = ( length( lightToPosition ) - shadowCameraNear ) / ( shadowCameraFar - shadowCameraNear );\t\tdp += shadowBias;\n\t\tvec3 bd3D = normalize( lightToPosition );\n\t\t#if defined( SHADOWMAP_TYPE_PCF ) || defined( SHADOWMAP_TYPE_PCF_SOFT )\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 ], pointLight.shadowCameraNear, pointLight.shadowCameraFar ) : 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\ttransformed = ( bindMatrixInverse * skinned ).xyz;\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:"#ifndef saturate\n\t#define saturate(a) clamp( a, 0.0, 1.0 )\n#endif\nuniform float toneMappingExposure;\nuniform float toneMappingWhitePoint;\nvec3 LinearToneMapping( vec3 color ) {\n\treturn toneMappingExposure * color;\n}\nvec3 ReinhardToneMapping( vec3 color ) {\n\tcolor *= toneMappingExposure;\n\treturn saturate( color / ( vec3( 1.0 ) + color ) );\n}\n#define Uncharted2Helper( x ) max( ( ( x * ( 0.15 * x + 0.10 * 0.50 ) + 0.20 * 0.02 ) / ( x * ( 0.15 * x + 0.50 ) + 0.20 * 0.30 ) ) - 0.02 / 0.30, vec3( 0.0 ) )\nvec3 Uncharted2ToneMapping( vec3 color ) {\n\tcolor *= toneMappingExposure;\n\treturn saturate( Uncharted2Helper( color ) / Uncharted2Helper( vec3( toneMappingWhitePoint ) ) );\n}\nvec3 OptimizedCineonToneMapping( vec3 color ) {\n\tcolor *= toneMappingExposure;\n\tcolor = max( vec3( 0.0 ), color - 0.004 );\n\treturn pow( ( color * ( 6.2 * color + 0.5 ) ) / ( color * ( 6.2 * color + 1.7 ) + 0.06 ), vec3( 2.2 ) );\n}\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 mat3 uvTransform;\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 = ( uvTransform * vec3( uv, 1 ) ).xy;\n#endif",uv2_pars_fragment:"#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP )\n\tvarying vec2 vUv2;\n#endif",uv2_pars_vertex:"#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP )\n\tattribute vec2 uv2;\n\tvarying vec2 vUv2;\n#endif",uv2_vertex:"#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP )\n\tvUv2 = uv2;\n#endif",worldpos_vertex:"#if defined( USE_ENVMAP ) || defined( DISTANCE ) || defined ( USE_SHADOWMAP )\n\tvec4 worldPosition = modelMatrix * vec4( transformed, 1.0 );\n#endif\n",cube_frag:"uniform samplerCube tCube;\nuniform float tFlip;\nuniform float opacity;\nvarying vec3 vWorldPosition;\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\tgl_Position.z = gl_Position.w;\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#ifdef USE_DISPLACEMENTMAP\n\t\t#include <beginnormal_vertex>\n\t\t#include <morphnormal_vertex>\n\t\t#include <skinnormal_vertex>\n\t#endif\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n}\n",distanceRGBA_frag:"#define DISTANCE\nuniform vec3 referencePosition;\nuniform float nearDistance;\nuniform float farDistance;\nvarying vec3 vWorldPosition;\n#include <common>\n#include <packing>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main () {\n\t#include <clipping_planes_fragment>\n\tvec4 diffuseColor = vec4( 1.0 );\n\t#include <map_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\tfloat dist = length( vWorldPosition - referencePosition );\n\tdist = ( dist - nearDistance ) / ( farDistance - nearDistance );\n\tdist = saturate( dist );\n\tgl_FragColor = packDepthToRGBA( dist );\n}\n",distanceRGBA_vert:"#define DISTANCE\nvarying vec3 vWorldPosition;\n#include <common>\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <skinbase_vertex>\n\t#ifdef USE_DISPLACEMENTMAP\n\t\t#include <beginnormal_vertex>\n\t\t#include <morphnormal_vertex>\n\t\t#include <skinnormal_vertex>\n\t#endif\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <worldpos_vertex>\n\t#include <clipping_planes_vertex>\n\tvWorldPosition = worldPosition.xyz;\n}\n",equirect_frag:"uniform sampler2D tEquirect;\nvarying vec3 vWorldPosition;\n#include <common>\nvoid main() {\n\tvec3 direction = normalize( vWorldPosition );\n\tvec2 sampleUV;\n\tsampleUV.y = asin( clamp( direction.y, - 1.0, 1.0 ) ) * RECIPROCAL_PI + 0.5;\n\tsampleUV.x = atan( direction.z, direction.x ) * RECIPROCAL_PI2 + 0.5;\n\tgl_FragColor = texture2D( tEquirect, sampleUV );\n}\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 <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 <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_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 <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_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 <roughnessmap_fragment>\n\t#include <metalnessmap_fragment>\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 <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 <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_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_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 <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_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 vec3 color;\nuniform float opacity;\n#include <common>\n#include <packing>\n#include <fog_pars_fragment>\n#include <bsdfs>\n#include <lights_pars>\n#include <shadowmap_pars_fragment>\n#include <shadowmask_pars_fragment>\nvoid main() {\n\tgl_FragColor = vec4( color, opacity * ( 1.0 - getShadowMask() ) );\n\t#include <fog_fragment>\n}\n",shadow_vert:"#include <fog_pars_vertex>\n#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\t#include <fog_vertex>\n}\n"},(Ts={basic:{uniforms:(Es={merge:function(e){for(var t={},n=0;n<e.length;n++){var i,r=this.clone(e[n]);for(i in r)t[i]=r[i]}return t},clone:function(e){var t,n={};for(t in e)for(var i in n[t]={},e[t]){var r=e[t][i];r&&(r.isColor||r.isMatrix3||r.isMatrix4||r.isVector2||r.isVector3||r.isVector4||r.isTexture)?n[t][i]=r.clone():Array.isArray(r)?n[t][i]=r.slice():n[t][i]=r}return n}}).merge([Ne.common,Ne.specularmap,Ne.envmap,Ne.aomap,Ne.lightmap,Ne.fog]),vertexShader:E.meshbasic_vert,fragmentShader:E.meshbasic_frag},lambert:{uniforms:Es.merge([Ne.common,Ne.specularmap,Ne.envmap,Ne.aomap,Ne.lightmap,Ne.emissivemap,Ne.fog,Ne.lights,{emissive:{value:new N(0)}}]),vertexShader:E.meshlambert_vert,fragmentShader:E.meshlambert_frag},phong:{uniforms:Es.merge([Ne.common,Ne.specularmap,Ne.envmap,Ne.aomap,Ne.lightmap,Ne.emissivemap,Ne.bumpmap,Ne.normalmap,Ne.displacementmap,Ne.gradientmap,Ne.fog,Ne.lights,{emissive:{value:new N(0)},specular:{value:new N(1118481)},shininess:{value:30}}]),vertexShader:E.meshphong_vert,fragmentShader:E.meshphong_frag},standard:{uniforms:Es.merge([Ne.common,Ne.envmap,Ne.aomap,Ne.lightmap,Ne.emissivemap,Ne.bumpmap,Ne.normalmap,Ne.displacementmap,Ne.roughnessmap,Ne.metalnessmap,Ne.fog,Ne.lights,{emissive:{value:new N(0)},roughness:{value:.5},metalness:{value:.5},envMapIntensity:{value:1}}]),vertexShader:E.meshphysical_vert,fragmentShader:E.meshphysical_frag},points:{uniforms:Es.merge([Ne.points,Ne.fog]),vertexShader:E.points_vert,fragmentShader:E.points_frag},dashed:{uniforms:Es.merge([Ne.common,Ne.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:E.linedashed_vert,fragmentShader:E.linedashed_frag},depth:{uniforms:Es.merge([Ne.common,Ne.displacementmap]),vertexShader:E.depth_vert,fragmentShader:E.depth_frag},normal:{uniforms:Es.merge([Ne.common,Ne.bumpmap,Ne.normalmap,Ne.displacementmap,{opacity:{value:1}}]),vertexShader:E.normal_vert,fragmentShader:E.normal_frag},cube:{uniforms:{tCube:{value:null},tFlip:{value:-1},opacity:{value:1}},vertexShader:E.cube_vert,fragmentShader:E.cube_frag},equirect:{uniforms:{tEquirect:{value:null}},vertexShader:E.equirect_vert,fragmentShader:E.equirect_frag},distanceRGBA:{uniforms:Es.merge([Ne.common,Ne.displacementmap,{referencePosition:{value:new Ce},nearDistance:{value:1},farDistance:{value:1e3}}]),vertexShader:E.distanceRGBA_vert,fragmentShader:E.distanceRGBA_frag},shadow:{uniforms:Es.merge([Ne.lights,Ne.fog,{color:{value:new N(0)},opacity:{value:1}}]),vertexShader:E.shadow_vert,fragmentShader:E.shadow_frag}}).physical={uniforms:Es.merge([Ts.standard.uniforms,{clearCoat:{value:0},clearCoatRoughness:{value:0}}]),vertexShader:E.meshphysical_vert,fragmentShader:E.meshphysical_frag},Object.assign(fe.prototype,{set:function(e,t){return this.min.copy(e),this.max.copy(t),this},setFromPoints:function(e){this.makeEmpty();for(var t=0,n=e.length;t<n;t++)this.expandByPoint(e[t]);return this},setFromCenterAndSize:(_s=new te,function(e,t){t=_s.copy(t).multiplyScalar(.5);return this.min.copy(e).sub(t),this.max.copy(e).add(t),this}),clone:function(){return(new this.constructor).copy(this)},copy:function(e){return this.min.copy(e.min),this.max.copy(e.max),this},makeEmpty:function(){return this.min.x=this.min.y=1/0,this.max.x=this.max.y=-1/0,this},isEmpty:function(){return this.max.x<this.min.x||this.max.y<this.min.y},getCenter:function(e){e=e||new te;return this.isEmpty()?e.set(0,0):e.addVectors(this.min,this.max).multiplyScalar(.5)},getSize:function(e){e=e||new te;return this.isEmpty()?e.set(0,0):e.subVectors(this.max,this.min)},expandByPoint:function(e){return this.min.min(e),this.max.max(e),this},expandByVector:function(e){return this.min.sub(e),this.max.add(e),this},expandByScalar:function(e){return this.min.addScalar(-e),this.max.addScalar(e),this},containsPoint:function(e){return!(e.x<this.min.x||e.x>this.max.x||e.y<this.min.y||e.y>this.max.y)},containsBox:function(e){return this.min.x<=e.min.x&&e.max.x<=this.max.x&&this.min.y<=e.min.y&&e.max.y<=this.max.y},getParameter:function(e,t){return(t||new te).set((e.x-this.min.x)/(this.max.x-this.min.x),(e.y-this.min.y)/(this.max.y-this.min.y))},intersectsBox:function(e){return!(e.max.x<this.min.x||e.min.x>this.max.x||e.max.y<this.min.y||e.min.y>this.max.y)},clampPoint:function(e,t){return(t||new te).copy(e).clamp(this.min,this.max)},distanceToPoint:(ws=new te,function(e){return ws.copy(e).clamp(this.min,this.max).sub(e).length()}),intersect:function(e){return this.min.max(e.min),this.max.min(e.max),this},union:function(e){return this.min.min(e.min),this.max.max(e.max),this},translate:function(e){return this.min.add(e),this.max.add(e),this},equals:function(e){return e.min.equals(this.min)&&e.max.equals(this.max)}}),(me.prototype=Object.create(d.prototype)).constructor=me,Xs=0,t.prototype=Object.assign(Object.create(p.prototype),{constructor:t,isMaterial:!0,onBeforeCompile:function(){},setValues:function(e){if(void 0!==e)for(var t in e){var n,i=e[t];void 0!==i?"shading"!==t?void 0!==(n=this[t])?n&&n.isColor?n.set(i):n&&n.isVector3&&i&&i.isVector3?n.copy(i):this[t]="overdraw"===t?Number(i):i:console.warn("THREE."+this.type+": '"+t+"' is not a property of this material."):(console.warn("THREE."+this.type+": .shading has been removed. Use the boolean .flatShading instead."),this.flatShading=1===i):console.warn("THREE.Material: '"+t+"' parameter is undefined.")}},toJSON:function(e){var t=void 0===e||"string"==typeof e,n=(t&&(e={textures:{},images:{}}),{metadata:{version:4.5,type:"Material",generator:"Material.toJSON"}});function i(e){var t,n=[];for(t in e){var i=e[t];delete i.metadata,n.push(i)}return n}return 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()),1!==this.emissiveIntensity&&(n.emissiveIntensity=this.emissiveIntensity),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(e).uuid),this.alphaMap&&this.alphaMap.isTexture&&(n.alphaMap=this.alphaMap.toJSON(e).uuid),this.lightMap&&this.lightMap.isTexture&&(n.lightMap=this.lightMap.toJSON(e).uuid),this.bumpMap&&this.bumpMap.isTexture&&(n.bumpMap=this.bumpMap.toJSON(e).uuid,n.bumpScale=this.bumpScale),this.normalMap&&this.normalMap.isTexture&&(n.normalMap=this.normalMap.toJSON(e).uuid,n.normalScale=this.normalScale.toArray()),this.displacementMap&&this.displacementMap.isTexture&&(n.displacementMap=this.displacementMap.toJSON(e).uuid,n.displacementScale=this.displacementScale,n.displacementBias=this.displacementBias),this.roughnessMap&&this.roughnessMap.isTexture&&(n.roughnessMap=this.roughnessMap.toJSON(e).uuid),this.metalnessMap&&this.metalnessMap.isTexture&&(n.metalnessMap=this.metalnessMap.toJSON(e).uuid),this.emissiveMap&&this.emissiveMap.isTexture&&(n.emissiveMap=this.emissiveMap.toJSON(e).uuid),this.specularMap&&this.specularMap.isTexture&&(n.specularMap=this.specularMap.toJSON(e).uuid),this.envMap&&this.envMap.isTexture&&(n.envMap=this.envMap.toJSON(e).uuid,n.reflectivity=this.reflectivity),this.gradientMap&&this.gradientMap.isTexture&&(n.gradientMap=this.gradientMap.toJSON(e).uuid),void 0!==this.size&&(n.size=this.size),void 0!==this.sizeAttenuation&&(n.sizeAttenuation=this.sizeAttenuation),this.blending!==Aa&&(n.blending=this.blending),!0===this.flatShading&&(n.flatShading=this.flatShading),this.side!==Ea&&(n.side=this.side),0!==this.vertexColors&&(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,0!==this.rotation&&(n.rotation=this.rotation),1!==this.linewidth&&(n.linewidth=this.linewidth),void 0!==this.dashSize&&(n.dashSize=this.dashSize),void 0!==this.gapSize&&(n.gapSize=this.gapSize),void 0!==this.scale&&(n.scale=this.scale),!0===this.dithering&&(n.dithering=!0),0<this.alphaTest&&(n.alphaTest=this.alphaTest),!0===this.premultipliedAlpha&&(n.premultipliedAlpha=this.premultipliedAlpha),!0===this.wireframe&&(n.wireframe=this.wireframe),1<this.wireframeLinewidth&&(n.wireframeLinewidth=this.wireframeLinewidth),"round"!==this.wireframeLinecap&&(n.wireframeLinecap=this.wireframeLinecap),"round"!==this.wireframeLinejoin&&(n.wireframeLinejoin=this.wireframeLinejoin),!0===this.morphTargets&&(n.morphTargets=!0),!0===this.skinning&&(n.skinning=!0),!1===this.visible&&(n.visible=!1),"{}"!==JSON.stringify(this.userData)&&(n.userData=this.userData),t&&(t=i(e.textures),e=i(e.images),0<t.length&&(n.textures=t),0<e.length)&&(n.images=e),n},clone:function(){return(new this.constructor).copy(this)},copy:function(e){this.name=e.name,this.fog=e.fog,this.lights=e.lights,this.blending=e.blending,this.side=e.side,this.flatShading=e.flatShading,this.vertexColors=e.vertexColors,this.opacity=e.opacity,this.transparent=e.transparent,this.blendSrc=e.blendSrc,this.blendDst=e.blendDst,this.blendEquation=e.blendEquation,this.blendSrcAlpha=e.blendSrcAlpha,this.blendDstAlpha=e.blendDstAlpha,this.blendEquationAlpha=e.blendEquationAlpha,this.depthFunc=e.depthFunc,this.depthTest=e.depthTest,this.depthWrite=e.depthWrite,this.colorWrite=e.colorWrite,this.precision=e.precision,this.polygonOffset=e.polygonOffset,this.polygonOffsetFactor=e.polygonOffsetFactor,this.polygonOffsetUnits=e.polygonOffsetUnits,this.dithering=e.dithering,this.alphaTest=e.alphaTest,this.premultipliedAlpha=e.premultipliedAlpha,this.overdraw=e.overdraw,this.visible=e.visible,this.userData=JSON.parse(JSON.stringify(e.userData)),this.clipShadows=e.clipShadows,this.clipIntersection=e.clipIntersection;var t=e.clippingPlanes,n=null;if(null!==t)for(var i=t.length,n=new Array(i),r=0;r!==i;++r)n[r]=t[r].clone();return this.clippingPlanes=n,this},dispose:function(){this.dispatchEvent({type:"dispose"})}}),((ge.prototype=Object.create(t.prototype)).constructor=ge).prototype.isMeshDepthMaterial=!0,ge.prototype.copy=function(e){return t.prototype.copy.call(this,e),this.depthPacking=e.depthPacking,this.skinning=e.skinning,this.morphTargets=e.morphTargets,this.map=e.map,this.alphaMap=e.alphaMap,this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this},((ve.prototype=Object.create(t.prototype)).constructor=ve).prototype.isMeshDistanceMaterial=!0,ve.prototype.copy=function(e){return t.prototype.copy.call(this,e),this.referencePosition.copy(e.referencePosition),this.nearDistance=e.nearDistance,this.farDistance=e.farDistance,this.skinning=e.skinning,this.morphTargets=e.morphTargets,this.map=e.map,this.alphaMap=e.alphaMap,this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this},Object.assign(ye.prototype,{isBox3:!0,set:function(e,t){return this.min.copy(e),this.max.copy(t),this},setFromArray:function(e){for(var t=1/0,n=1/0,i=1/0,r=-1/0,a=-1/0,o=-1/0,s=0,c=e.length;s<c;s+=3){var l=e[s],h=e[s+1],u=e[s+2];l<t&&(t=l),h<n&&(n=h),u<i&&(i=u),r<l&&(r=l),a<h&&(a=h),o<u&&(o=u)}return this.min.set(t,n,i),this.max.set(r,a,o),this},setFromBufferAttribute:function(e){for(var t=1/0,n=1/0,i=1/0,r=-1/0,a=-1/0,o=-1/0,s=0,c=e.count;s<c;s++){var l=e.getX(s),h=e.getY(s),u=e.getZ(s);l<t&&(t=l),h<n&&(n=h),u<i&&(i=u),r<l&&(r=l),a<h&&(a=h),o<u&&(o=u)}return this.min.set(t,n,i),this.max.set(r,a,o),this},setFromPoints:function(e){this.makeEmpty();for(var t=0,n=e.length;t<n;t++)this.expandByPoint(e[t]);return this},setFromCenterAndSize:(Ws=new Ce,function(e,t){t=Ws.copy(t).multiplyScalar(.5);return this.min.copy(e).sub(t),this.max.copy(e).add(t),this}),setFromObject:function(e){return this.makeEmpty(),this.expandByObject(e)},clone:function(){return(new this.constructor).copy(this)},copy:function(e){return this.min.copy(e.min),this.max.copy(e.max),this},makeEmpty:function(){return this.min.x=this.min.y=this.min.z=1/0,this.max.x=this.max.y=this.max.z=-1/0,this},isEmpty:function(){return this.max.x<this.min.x||this.max.y<this.min.y||this.max.z<this.min.z},getCenter:function(e){e=e||new Ce;return this.isEmpty()?e.set(0,0,0):e.addVectors(this.min,this.max).multiplyScalar(.5)},getSize:function(e){e=e||new Ce;return this.isEmpty()?e.set(0,0,0):e.subVectors(this.max,this.min)},expandByPoint:function(e){return this.min.min(e),this.max.max(e),this},expandByVector:function(e){return this.min.sub(e),this.max.add(e),this},expandByScalar:function(e){return this.min.addScalar(-e),this.max.addScalar(e),this},expandByObject:(js=new Ce,function(e){return zs=this,e.updateMatrixWorld(!0),e.traverse(Ee),this}),containsPoint:function(e){return!(e.x<this.min.x||e.x>this.max.x||e.y<this.min.y||e.y>this.max.y||e.z<this.min.z||e.z>this.max.z)},containsBox:function(e){return this.min.x<=e.min.x&&e.max.x<=this.max.x&&this.min.y<=e.min.y&&e.max.y<=this.max.y&&this.min.z<=e.min.z&&e.max.z<=this.max.z},getParameter:function(e,t){return(t||new Ce).set((e.x-this.min.x)/(this.max.x-this.min.x),(e.y-this.min.y)/(this.max.y-this.min.y),(e.z-this.min.z)/(this.max.z-this.min.z))},intersectsBox:function(e){return!(e.max.x<this.min.x||e.min.x>this.max.x||e.max.y<this.min.y||e.min.y>this.max.y||e.max.z<this.min.z||e.min.z>this.max.z)},intersectsSphere:(Ps=new Ce,function(e){return this.clampPoint(e.center,Ps),Ps.distanceToSquared(e.center)<=e.radius*e.radius}),intersectsPlane:function(e){var t,n=0<e.normal.x?(t=e.normal.x*this.min.x,e.normal.x*this.max.x):(t=e.normal.x*this.max.x,e.normal.x*this.min.x);return 0<e.normal.y?(t+=e.normal.y*this.min.y,n+=e.normal.y*this.max.y):(t+=e.normal.y*this.max.y,n+=e.normal.y*this.min.y),0<e.normal.z?(t+=e.normal.z*this.min.z,n+=e.normal.z*this.max.z):(t+=e.normal.z*this.max.z,n+=e.normal.z*this.min.z),t<=e.constant&&n>=e.constant},clampPoint:function(e,t){return(t||new Ce).copy(e).clamp(this.min,this.max)},distanceToPoint:(Hs=new Ce,function(e){return Hs.copy(e).clamp(this.min,this.max).sub(e).length()}),getBoundingSphere:(ks=new Ce,function(e){e=e||new xe;return this.getCenter(e.center),e.radius=.5*this.getSize(ks).length(),e}),intersect:function(e){return this.min.max(e.min),this.max.min(e.max),this.isEmpty()&&this.makeEmpty(),this},union:function(e){return this.min.min(e.min),this.max.max(e.max),this},applyMatrix4:(Ls=[new Ce,new Ce,new Ce,new Ce,new Ce,new Ce,new Ce,new Ce],function(e){return this.isEmpty()||(Ls[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(e),Ls[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(e),Ls[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(e),Ls[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(e),Ls[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(e),Ls[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(e),Ls[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(e),Ls[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(e),this.setFromPoints(Ls)),this}),translate:function(e){return this.min.add(e),this.max.add(e),this},equals:function(e){return e.min.equals(this.min)&&e.max.equals(this.max)}}),Object.assign(xe.prototype,{set:function(e,t){return this.center.copy(e),this.radius=t,this},setFromPoints:(Cs=new ye,function(e,t){var n=this.center;void 0!==t?n.copy(t):Cs.setFromPoints(e).getCenter(n);for(var i=0,r=0,a=e.length;r<a;r++)i=Math.max(i,n.distanceToSquared(e[r]));return this.radius=Math.sqrt(i),this}),clone:function(){return(new this.constructor).copy(this)},copy:function(e){return this.center.copy(e.center),this.radius=e.radius,this},empty:function(){return this.radius<=0},containsPoint:function(e){return e.distanceToSquared(this.center)<=this.radius*this.radius},distanceToPoint:function(e){return e.distanceTo(this.center)-this.radius},intersectsSphere:function(e){var t=this.radius+e.radius;return e.center.distanceToSquared(this.center)<=t*t},intersectsBox:function(e){return e.intersectsSphere(this)},intersectsPlane:function(e){return Math.abs(e.distanceToPoint(this.center))<=this.radius},clampPoint:function(e,t){var n=this.center.distanceToSquared(e),t=t||new Ce;return t.copy(e),n>this.radius*this.radius&&(t.sub(this.center).normalize(),t.multiplyScalar(this.radius).add(this.center)),t},getBoundingBox:function(e){e=e||new ye;return e.set(this.center,this.center),e.expandByScalar(this.radius),e},applyMatrix4:function(e){return this.center.applyMatrix4(e),this.radius=this.radius*e.getMaxScaleOnAxis(),this},translate:function(e){return this.center.add(e),this},equals:function(e){return e.center.equals(this.center)&&e.radius===this.radius}}),Object.assign(be.prototype,{set:function(e,t){return this.normal.copy(e),this.constant=t,this},setComponents:function(e,t,n,i){return this.normal.set(e,t,n),this.constant=i,this},setFromNormalAndCoplanarPoint:function(e,t){return this.normal.copy(e),this.constant=-t.dot(this.normal),this},setFromCoplanarPoints:(Fs=new Ce,Bs=new Ce,function(e,t,n){n=Fs.subVectors(n,t).cross(Bs.subVectors(e,t)).normalize();return this.setFromNormalAndCoplanarPoint(n,e),this}),clone:function(){return(new this.constructor).copy(this)},copy:function(e){return this.normal.copy(e.normal),this.constant=e.constant,this},normalize:function(){var e=1/this.normal.length();return this.normal.multiplyScalar(e),this.constant*=e,this},negate:function(){return this.constant*=-1,this.normal.negate(),this},distanceToPoint:function(e){return this.normal.dot(e)+this.constant},distanceToSphere:function(e){return this.distanceToPoint(e.center)-e.radius},projectPoint:function(e,t){return(t||new Ce).copy(this.normal).multiplyScalar(-this.distanceToPoint(e)).add(e)},intersectLine:(Ds=new Ce,function(e,t){var t=t||new Ce,n=e.delta(Ds),i=this.normal.dot(n);return 0===i?0===this.distanceToPoint(e.start)?t.copy(e.start):void 0:(i=-(e.start.dot(this.normal)+this.constant)/i)<0||1<i?void 0:t.copy(n).multiplyScalar(i).add(e.start)}),intersectsLine:function(e){var t=this.distanceToPoint(e.start),e=this.distanceToPoint(e.end);return t<0&&0<e||e<0&&0<t},intersectsBox:function(e){return e.intersectsPlane(this)},intersectsSphere:function(e){return e.intersectsPlane(this)},coplanarPoint:function(e){return(e||new Ce).copy(this.normal).multiplyScalar(-this.constant)},applyMatrix4:(Is=new Ce,Us=new S,function(e,t){t=t||Us.getNormalMatrix(e),e=this.coplanarPoint(Is).applyMatrix4(e),t=this.normal.applyMatrix3(t).normalize();return this.constant=-e.dot(t),this}),translate:function(e){return this.constant-=e.dot(this.normal),this},equals:function(e){return e.normal.equals(this.normal)&&e.constant===this.constant}}),Object.assign(Fe.prototype,{set:function(e,t,n,i,r,a){var o=this.planes;return o[0].copy(e),o[1].copy(t),o[2].copy(n),o[3].copy(i),o[4].copy(r),o[5].copy(a),this},clone:function(){return(new this.constructor).copy(this)},copy:function(e){for(var t=this.planes,n=0;n<6;n++)t[n].copy(e.planes[n]);return this},setFromMatrix:function(e){var t=this.planes,e=e.elements,n=e[0],i=e[1],r=e[2],a=e[3],o=e[4],s=e[5],c=e[6],l=e[7],h=e[8],u=e[9],d=e[10],p=e[11],f=e[12],m=e[13],g=e[14],e=e[15];return t[0].setComponents(a-n,l-o,p-h,e-f).normalize(),t[1].setComponents(a+n,l+o,p+h,e+f).normalize(),t[2].setComponents(a+i,l+s,p+u,e+m).normalize(),t[3].setComponents(a-i,l-s,p-u,e-m).normalize(),t[4].setComponents(a-r,l-c,p-d,e-g).normalize(),t[5].setComponents(a+r,l+c,p+d,e+g).normalize(),this},intersectsObject:(Rs=new xe,function(e){var t=e.geometry;return null===t.boundingSphere&&t.computeBoundingSphere(),Rs.copy(t.boundingSphere).applyMatrix4(e.matrixWorld),this.intersectsSphere(Rs)}),intersectsSprite:(Os=new xe,function(e){return Os.center.set(0,0,0),Os.radius=.7071067811865476,Os.applyMatrix4(e.matrixWorld),this.intersectsSphere(Os)}),intersectsSphere:function(e){for(var t=this.planes,n=e.center,i=-e.radius,r=0;r<6;r++)if(t[r].distanceToPoint(n)<i)return!1;return!0},intersectsBox:(Ss=new Ce,As=new Ce,function(e){for(var t=this.planes,n=0;n<6;n++){var i=t[n],r=(Ss.x=(0<i.normal.x?e.min:e.max).x,As.x=(0<i.normal.x?e.max:e.min).x,Ss.y=(0<i.normal.y?e.min:e.max).y,As.y=(0<i.normal.y?e.max:e.min).y,Ss.z=(0<i.normal.z?e.min:e.max).z,As.z=(0<i.normal.z?e.max:e.min).z,i.distanceToPoint(Ss)),i=i.distanceToPoint(As);if(r<0&&i<0)return!1}return!0}),containsPoint:function(e){for(var t=this.planes,n=0;n<6;n++)if(t[n].distanceToPoint(e)<0)return!1;return!0}}),we.RotationOrders=["XYZ","YZX","ZXY","XZY","YXZ","ZYX"],we.DefaultOrder="XYZ",Object.defineProperties(we.prototype,{x:{get:function(){return this._x},set:function(e){this._x=e,this.onChangeCallback()}},y:{get:function(){return this._y},set:function(e){this._y=e,this.onChangeCallback()}},z:{get:function(){return this._z},set:function(e){this._z=e,this.onChangeCallback()}},order:{get:function(){return this._order},set:function(e){this._order=e,this.onChangeCallback()}}}),Object.assign(we.prototype,{isEuler:!0,set:function(e,t,n,i){return this._x=e,this._y=t,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(e){return this._x=e._x,this._y=e._y,this._z=e._z,this._order=e._order,this.onChangeCallback(),this},setFromRotationMatrix:function(e,t,n){var i=Pe.clamp,e=e.elements,r=e[0],a=e[4],o=e[8],s=e[1],c=e[5],l=e[9],h=e[2],u=e[6],e=e[10];return"XYZ"===(t=t||this._order)?(this._y=Math.asin(i(o,-1,1)),Math.abs(o)<.99999?(this._x=Math.atan2(-l,e),this._z=Math.atan2(-a,r)):(this._x=Math.atan2(u,c),this._z=0)):"YXZ"===t?(this._x=Math.asin(-i(l,-1,1)),Math.abs(l)<.99999?(this._y=Math.atan2(o,e),this._z=Math.atan2(s,c)):(this._y=Math.atan2(-h,r),this._z=0)):"ZXY"===t?(this._x=Math.asin(i(u,-1,1)),Math.abs(u)<.99999?(this._y=Math.atan2(-h,e),this._z=Math.atan2(-a,c)):(this._y=0,this._z=Math.atan2(s,r))):"ZYX"===t?(this._y=Math.asin(-i(h,-1,1)),Math.abs(h)<.99999?(this._x=Math.atan2(u,e),this._z=Math.atan2(s,r)):(this._x=0,this._z=Math.atan2(-a,c))):"YZX"===t?(this._z=Math.asin(i(s,-1,1)),Math.abs(s)<.99999?(this._x=Math.atan2(-l,c),this._y=Math.atan2(-h,r)):(this._x=0,this._y=Math.atan2(o,e))):"XZY"===t?(this._z=Math.asin(-i(a,-1,1)),Math.abs(a)<.99999?(this._x=Math.atan2(u,c),this._y=Math.atan2(o,r)):(this._x=Math.atan2(-l,e),this._y=0)):console.warn("THREE.Euler: .setFromRotationMatrix() given unsupported order: "+t),this._order=t,!1!==n&&this.onChangeCallback(),this},setFromQuaternion:(Ns=new Re,function(e,t,n){return Ns.makeRotationFromQuaternion(e),this.setFromRotationMatrix(Ns,t,n)}),setFromVector3:function(e,t){return this.set(e.x,e.y,e.z,t||this._order)},reorder:(Ms=new h,function(e){return Ms.setFromEuler(this),this.setFromQuaternion(Ms,e)}),equals:function(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._order===this._order},fromArray:function(e){return this._x=e[0],this._y=e[1],this._z=e[2],void 0!==e[3]&&(this._order=e[3]),this.onChangeCallback(),this},toArray:function(e,t){return(e=void 0===e?[]:e)[t=void 0===t?0:t]=this._x,e[t+1]=this._y,e[t+2]=this._z,e[t+3]=this._order,e},toVector3:function(e){return e?e.set(this._x,this._y,this._z):new Ce(this._x,this._y,this._z)},onChange:function(e){return this.onChangeCallback=e,this},onChangeCallback:function(){}}),Object.assign(_e.prototype,{set:function(e){this.mask=1<<e|0},enable:function(e){this.mask|=1<<e|0},toggle:function(e){this.mask^=1<<e|0},disable:function(e){this.mask&=~(1<<e|0)},test:function(e){return 0!=(this.mask&e.mask)}}),dc=0,f.DefaultUp=new Ce(0,1,0),f.DefaultMatrixAutoUpdate=!0,f.prototype=Object.assign(Object.create(p.prototype),{constructor:f,isObject3D:!0,onBeforeRender:function(){},onAfterRender:function(){},applyMatrix:function(e){this.matrix.multiplyMatrices(e,this.matrix),this.matrix.decompose(this.position,this.quaternion,this.scale)},applyQuaternion:function(e){return this.quaternion.premultiply(e),this},setRotationFromAxisAngle:function(e,t){this.quaternion.setFromAxisAngle(e,t)},setRotationFromEuler:function(e){this.quaternion.setFromEuler(e,!0)},setRotationFromMatrix:function(e){this.quaternion.setFromRotationMatrix(e)},setRotationFromQuaternion:function(e){this.quaternion.copy(e)},rotateOnAxis:(Js=new h,function(e,t){return Js.setFromAxisAngle(e,t),this.quaternion.multiply(Js),this}),rotateOnWorldAxis:(uc=new h,function(e,t){return uc.setFromAxisAngle(e,t),this.quaternion.premultiply(uc),this}),rotateX:(hc=new Ce(1,0,0),function(e){return this.rotateOnAxis(hc,e)}),rotateY:(lc=new Ce(0,1,0),function(e){return this.rotateOnAxis(lc,e)}),rotateZ:(cc=new Ce(0,0,1),function(e){return this.rotateOnAxis(cc,e)}),translateOnAxis:(sc=new Ce,function(e,t){return sc.copy(e).applyQuaternion(this.quaternion),this.position.add(sc.multiplyScalar(t)),this}),translateX:(oc=new Ce(1,0,0),function(e){return this.translateOnAxis(oc,e)}),translateY:(ac=new Ce(0,1,0),function(e){return this.translateOnAxis(ac,e)}),translateZ:(rc=new Ce(0,0,1),function(e){return this.translateOnAxis(rc,e)}),localToWorld:function(e){return e.applyMatrix4(this.matrixWorld)},worldToLocal:(Zs=new Re,function(e){return e.applyMatrix4(Zs.getInverse(this.matrixWorld))}),lookAt:(nc=new Re,ic=new Ce,function(e,t,n){e.isVector3?ic.copy(e):ic.set(e,t,n),this.isCamera?nc.lookAt(this.position,ic,this.up):nc.lookAt(ic,this.position,this.up),this.quaternion.setFromRotationMatrix(nc)}),add:function(e){if(1<arguments.length)for(var t=0;t<arguments.length;t++)this.add(arguments[t]);else e===this?console.error("THREE.Object3D.add: object can't be added as a child of itself.",e):e&&e.isObject3D?(null!==e.parent&&e.parent.remove(e),e.parent=this,e.dispatchEvent({type:"added"}),this.children.push(e)):console.error("THREE.Object3D.add: object not an instance of THREE.Object3D.",e);return this},remove:function(e){if(1<arguments.length)for(var t=0;t<arguments.length;t++)this.remove(arguments[t]);else{var n=this.children.indexOf(e);-1!==n&&(e.parent=null,e.dispatchEvent({type:"removed"}),this.children.splice(n,1))}return this},getObjectById:function(e){return this.getObjectByProperty("id",e)},getObjectByName:function(e){return this.getObjectByProperty("name",e)},getObjectByProperty:function(e,t){if(this[e]===t)return this;for(var n=0,i=this.children.length;n<i;n++){var r=this.children[n].getObjectByProperty(e,t);if(void 0!==r)return r}},getWorldPosition:function(e){e=e||new Ce;return this.updateMatrixWorld(!0),e.setFromMatrixPosition(this.matrixWorld)},getWorldQuaternion:(qs=new Ce,Ys=new Ce,function(e){e=e||new h;return this.updateMatrixWorld(!0),this.matrixWorld.decompose(qs,e,Ys),e}),getWorldRotation:(tc=new h,function(e){e=e||new we;return this.getWorldQuaternion(tc),e.setFromQuaternion(tc,this.rotation.order,!1)}),getWorldScale:($s=new Ce,ec=new h,function(e){e=e||new Ce;return this.updateMatrixWorld(!0),this.matrixWorld.decompose($s,ec,e),e}),getWorldDirection:(Qs=new h,function(e){e=e||new Ce;return this.getWorldQuaternion(Qs),e.set(0,0,1).applyQuaternion(Qs)}),raycast:function(){},traverse:function(e){e(this);for(var t=this.children,n=0,i=t.length;n<i;n++)t[n].traverse(e)},traverseVisible:function(e){if(!1!==this.visible){e(this);for(var t=this.children,n=0,i=t.length;n<i;n++)t[n].traverseVisible(e)}},traverseAncestors:function(e){var t=this.parent;null!==t&&(e(t),t.traverseAncestors(e))},updateMatrix:function(){this.matrix.compose(this.position,this.quaternion,this.scale),this.matrixWorldNeedsUpdate=!0},updateMatrixWorld:function(e){this.matrixAutoUpdate&&this.updateMatrix(),(this.matrixWorldNeedsUpdate||e)&&(null===this.parent?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix),e=!(this.matrixWorldNeedsUpdate=!1));for(var t=this.children,n=0,i=t.length;n<i;n++)t[n].updateMatrixWorld(e)},toJSON:function(n){var e,t,i=void 0===n||"string"==typeof n,r={},a=(i&&(n={geometries:{},materials:{},textures:{},images:{},shapes:{}},r.metadata={version:4.5,type:"Object",generator:"Object3D.toJSON"}),{});function o(e,t){return void 0===e[t.uuid]&&(e[t.uuid]=t.toJSON(n)),t.uuid}if(a.uuid=this.uuid,a.type=this.type,""!==this.name&&(a.name=this.name),!0===this.castShadow&&(a.castShadow=!0),!0===this.receiveShadow&&(a.receiveShadow=!0),!1===this.visible&&(a.visible=!1),"{}"!==JSON.stringify(this.userData)&&(a.userData=this.userData),a.matrix=this.matrix.toArray(),void 0!==this.geometry){a.geometry=o(n.geometries,this.geometry);var s=this.geometry.parameters;if(void 0!==s&&void 0!==s.shapes){var c=s.shapes;if(Array.isArray(c))for(var l=0,h=c.length;l<h;l++){var u=c[l];o(n.shapes,u)}else o(n.shapes,c)}}if(void 0!==this.material)if(Array.isArray(this.material)){for(var d=[],l=0,h=this.material.length;l<h;l++)d.push(o(n.materials,this.material[l]));a.material=d}else a.material=o(n.materials,this.material);if(0<this.children.length){a.children=[];for(l=0;l<this.children.length;l++)a.children.push(this.children[l].toJSON(n).object)}return i&&(s=p(n.geometries),i=p(n.materials),e=p(n.textures),t=p(n.images),c=p(n.shapes),0<s.length&&(r.geometries=s),0<i.length&&(r.materials=i),0<e.length&&(r.textures=e),0<t.length&&(r.images=t),0<c.length)&&(r.shapes=c),r.object=a,r;function p(e){var t,n=[];for(t in e){var i=e[t];delete i.metadata,n.push(i)}return n}},clone:function(e){return(new this.constructor).copy(this,e)},copy:function(e,t){if(void 0===t&&(t=!0),this.name=e.name,this.up.copy(e.up),this.position.copy(e.position),this.quaternion.copy(e.quaternion),this.scale.copy(e.scale),this.matrix.copy(e.matrix),this.matrixWorld.copy(e.matrixWorld),this.matrixAutoUpdate=e.matrixAutoUpdate,this.matrixWorldNeedsUpdate=e.matrixWorldNeedsUpdate,this.layers.mask=e.layers.mask,this.visible=e.visible,this.castShadow=e.castShadow,this.receiveShadow=e.receiveShadow,this.frustumCulled=e.frustumCulled,this.renderOrder=e.renderOrder,this.userData=JSON.parse(JSON.stringify(e.userData)),!0===t)for(var n=0;n<e.children.length;n++){var i=e.children[n];this.add(i.clone())}return this}}),Te.prototype=Object.assign(Object.create(f.prototype),{constructor:Te,isCamera:!0,copy:function(e,t){return f.prototype.copy.call(this,e,t),this.matrixWorldInverse.copy(e.matrixWorldInverse),this.projectionMatrix.copy(e.projectionMatrix),this},getWorldDirection:(Ks=new h,function(e){e=e||new Ce;return this.getWorldQuaternion(Ks),e.set(0,0,-1).applyQuaternion(Ks)}),updateMatrixWorld:function(e){f.prototype.updateMatrixWorld.call(this,e),this.matrixWorldInverse.getInverse(this.matrixWorld)},clone:function(){return(new this.constructor).copy(this)}}),Me.prototype=Object.assign(Object.create(Te.prototype),{constructor:Me,isOrthographicCamera:!0,copy:function(e,t){return Te.prototype.copy.call(this,e,t),this.left=e.left,this.right=e.right,this.top=e.top,this.bottom=e.bottom,this.near=e.near,this.far=e.far,this.zoom=e.zoom,this.view=null===e.view?null:Object.assign({},e.view),this},setViewOffset:function(e,t,n,i,r,a){null===this.view&&(this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1}),this.view.enabled=!0,this.view.fullWidth=e,this.view.fullHeight=t,this.view.offsetX=n,this.view.offsetY=i,this.view.width=r,this.view.height=a,this.updateProjectionMatrix()},clearViewOffset:function(){null!==this.view&&(this.view.enabled=!1),this.updateProjectionMatrix()},updateProjectionMatrix:function(){var e,t,n,i=(this.right-this.left)/(2*this.zoom),r=(this.top-this.bottom)/(2*this.zoom),a=(this.right+this.left)/2,o=(this.top+this.bottom)/2,s=a-i,a=a+i,i=o+r,o=o-r;null!==this.view&&this.view.enabled&&(r=this.zoom/(this.view.width/this.view.fullWidth),e=this.zoom/(this.view.height/this.view.fullHeight),t=(this.right-this.left)/this.view.width,n=(this.top-this.bottom)/this.view.height,a=(s+=t*(this.view.offsetX/r))+t*(this.view.width/r),o=(i-=n*(this.view.offsetY/e))-n*(this.view.height/e)),this.projectionMatrix.makeOrthographic(s,a,i,o,this.near,this.far)},toJSON:function(e){e=f.prototype.toJSON.call(this,e);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}}),Object.assign(Se.prototype,{clone:function(){return(new this.constructor).copy(this)},copy:function(e){this.a=e.a,this.b=e.b,this.c=e.c,this.normal.copy(e.normal),this.color.copy(e.color),this.materialIndex=e.materialIndex;for(var t=0,n=e.vertexNormals.length;t<n;t++)this.vertexNormals[t]=e.vertexNormals[t].clone();for(t=0,n=e.vertexColors.length;t<n;t++)this.vertexColors[t]=e.vertexColors[t].clone();return this}}),xc=0,x.prototype=Object.assign(Object.create(p.prototype),{constructor:x,isGeometry:!0,applyMatrix:function(e){for(var t=(new S).getNormalMatrix(e),n=0,i=this.vertices.length;n<i;n++)this.vertices[n].applyMatrix4(e);for(n=0,i=this.faces.length;n<i;n++){var r=this.faces[n];r.normal.applyMatrix3(t).normalize();for(var a=0,o=r.vertexNormals.length;a<o;a++)r.vertexNormals[a].applyMatrix3(t).normalize()}return null!==this.boundingBox&&this.computeBoundingBox(),null!==this.boundingSphere&&this.computeBoundingSphere(),this.verticesNeedUpdate=!0,this.normalsNeedUpdate=!0,this},rotateX:(yc=new Re,function(e){return yc.makeRotationX(e),this.applyMatrix(yc),this}),rotateY:(vc=new Re,function(e){return vc.makeRotationY(e),this.applyMatrix(vc),this}),rotateZ:(gc=new Re,function(e){return gc.makeRotationZ(e),this.applyMatrix(gc),this}),translate:(mc=new Re,function(e,t,n){return mc.makeTranslation(e,t,n),this.applyMatrix(mc),this}),scale:(fc=new Re,function(e,t,n){return fc.makeScale(e,t,n),this.applyMatrix(fc),this}),lookAt:(pc=new f,function(e){pc.lookAt(e),pc.updateMatrix(),this.applyMatrix(pc.matrix)}),fromBufferGeometry:function(e){var r=this,t=null!==e.index?e.index.array:void 0,n=e.attributes,i=n.position.array,a=void 0!==n.normal?n.normal.array:void 0,o=void 0!==n.color?n.color.array:void 0,s=void 0!==n.uv?n.uv.array:void 0,c=void 0!==n.uv2?n.uv2.array:void 0;void 0!==c&&(this.faceVertexUvs[1]=[]);for(var l=[],h=[],u=[],d=0,p=0;d<i.length;d+=3,p+=2)r.vertices.push(new Ce(i[d],i[d+1],i[d+2])),void 0!==a&&l.push(new Ce(a[d],a[d+1],a[d+2])),void 0!==o&&r.colors.push(new N(o[d],o[d+1],o[d+2])),void 0!==s&&h.push(new te(s[p],s[p+1])),void 0!==c&&u.push(new te(c[p],c[p+1]));function f(e,t,n,i){i=new Se(e,t,n,void 0!==a?[l[e].clone(),l[t].clone(),l[n].clone()]:[],void 0!==o?[r.colors[e].clone(),r.colors[t].clone(),r.colors[n].clone()]:[],i);r.faces.push(i),void 0!==s&&r.faceVertexUvs[0].push([h[e].clone(),h[t].clone(),h[n].clone()]),void 0!==c&&r.faceVertexUvs[1].push([u[e].clone(),u[t].clone(),u[n].clone()])}var m=e.groups;if(0<m.length)for(d=0;d<m.length;d++)for(var g=m[d],v=g.start,p=v,y=v+g.count;p<y;p+=3)void 0!==t?f(t[p],t[p+1],t[p+2],g.materialIndex):f(p,p+1,p+2,g.materialIndex);else if(void 0!==t)for(d=0;d<t.length;d+=3)f(t[d],t[d+1],t[d+2]);else for(d=0;d<i.length/3;d+=3)f(d,d+1,d+2);return this.computeFaceNormals(),null!==e.boundingBox&&(this.boundingBox=e.boundingBox.clone()),null!==e.boundingSphere&&(this.boundingSphere=e.boundingSphere.clone()),this},center:function(){this.computeBoundingBox();var e=this.boundingBox.getCenter().negate();return this.translate(e.x,e.y,e.z),e},normalize:function(){this.computeBoundingSphere();var e=this.boundingSphere.center,t=this.boundingSphere.radius,t=0===t?1:1/t,n=new Re;return n.set(t,0,0,-t*e.x,0,t,0,-t*e.y,0,0,t,-t*e.z,0,0,0,1),this.applyMatrix(n),this},computeFaceNormals:function(){for(var e=new Ce,t=new Ce,n=0,i=this.faces.length;n<i;n++){var r=this.faces[n],a=this.vertices[r.a],o=this.vertices[r.b],s=this.vertices[r.c];e.subVectors(s,o),t.subVectors(a,o),e.cross(t),e.normalize(),r.normal.copy(e)}},computeVertexNormals:function(e){var t,n,i,r;for(void 0===e&&(e=!0),r=new Array(this.vertices.length),t=0,n=this.vertices.length;t<n;t++)r[t]=new Ce;if(e)for(var a,o,s,c=new Ce,l=new Ce,h=0,u=this.faces.length;h<u;h++)i=this.faces[h],a=this.vertices[i.a],o=this.vertices[i.b],s=this.vertices[i.c],c.subVectors(s,o),l.subVectors(a,o),c.cross(l),r[i.a].add(c),r[i.b].add(c),r[i.c].add(c);else for(this.computeFaceNormals(),h=0,u=this.faces.length;h<u;h++)r[(i=this.faces[h]).a].add(i.normal),r[i.b].add(i.normal),r[i.c].add(i.normal);for(t=0,n=this.vertices.length;t<n;t++)r[t].normalize();for(h=0,u=this.faces.length;h<u;h++){var d=(i=this.faces[h]).vertexNormals;3===d.length?(d[0].copy(r[i.a]),d[1].copy(r[i.b]),d[2].copy(r[i.c])):(d[0]=r[i.a].clone(),d[1]=r[i.b].clone(),d[2]=r[i.c].clone())}0<this.faces.length&&(this.normalsNeedUpdate=!0)},computeFlatVertexNormals:function(){var e,t,n;for(this.computeFaceNormals(),e=0,t=this.faces.length;e<t;e++){var i=(n=this.faces[e]).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())}0<this.faces.length&&(this.normalsNeedUpdate=!0)},computeMorphNormals:function(){var e,t,n;for(o=0,s=this.faces.length;o<s;o++)for((n=this.faces[o]).__originalFaceNormal?n.__originalFaceNormal.copy(n.normal):n.__originalFaceNormal=n.normal.clone(),n.__originalVertexNormals||(n.__originalVertexNormals=[]),e=0,t=n.vertexNormals.length;e<t;e++)n.__originalVertexNormals[e]?n.__originalVertexNormals[e].copy(n.vertexNormals[e]):n.__originalVertexNormals[e]=n.vertexNormals[e].clone();var i=new x;for(i.faces=this.faces,e=0,t=this.morphTargets.length;e<t;e++){if(!this.morphNormals[e]){this.morphNormals[e]={},this.morphNormals[e].faceNormals=[],this.morphNormals[e].vertexNormals=[];for(var r=this.morphNormals[e].faceNormals,a=this.morphNormals[e].vertexNormals,o=0,s=this.faces.length;o<s;o++)c=new Ce,l={a:new Ce,b:new Ce,c:new Ce},r.push(c),a.push(l)}var c,l,h=this.morphNormals[e];for(i.vertices=this.morphTargets[e].vertices,i.computeFaceNormals(),i.computeVertexNormals(),o=0,s=this.faces.length;o<s;o++)n=this.faces[o],c=h.faceNormals[o],l=h.vertexNormals[o],c.copy(n.normal),l.a.copy(n.vertexNormals[0]),l.b.copy(n.vertexNormals[1]),l.c.copy(n.vertexNormals[2])}for(o=0,s=this.faces.length;o<s;o++)(n=this.faces[o]).normal=n.__originalFaceNormal,n.vertexNormals=n.__originalVertexNormals},computeLineDistances:function(){for(var e=0,t=this.vertices,n=0,i=t.length;n<i;n++)0<n&&(e+=t[n].distanceTo(t[n-1])),this.lineDistances[n]=e},computeBoundingBox:function(){null===this.boundingBox&&(this.boundingBox=new ye),this.boundingBox.setFromPoints(this.vertices)},computeBoundingSphere:function(){null===this.boundingSphere&&(this.boundingSphere=new xe),this.boundingSphere.setFromPoints(this.vertices)},merge:function(e,t,n){if(e&&e.isGeometry){var i,r=this.vertices.length,a=this.vertices,o=e.vertices,s=this.faces,c=e.faces,l=this.faceVertexUvs[0],h=e.faceVertexUvs[0],u=this.colors,d=e.colors;void 0===n&&(n=0),void 0!==t&&(i=(new S).getNormalMatrix(t));for(var p=0,f=o.length;p<f;p++){var m=o[p].clone();void 0!==t&&m.applyMatrix4(t),a.push(m)}for(p=0,f=d.length;p<f;p++)u.push(d[p].clone());for(p=0,f=c.length;p<f;p++){var g,v,y,x=c[p],b=x.vertexNormals,w=x.vertexColors;(g=new Se(x.a+r,x.b+r,x.c+r)).normal.copy(x.normal),void 0!==i&&g.normal.applyMatrix3(i).normalize();for(var _=0,E=b.length;_<E;_++)v=b[_].clone(),void 0!==i&&v.applyMatrix3(i).normalize(),g.vertexNormals.push(v);g.color.copy(x.color);for(_=0,E=w.length;_<E;_++)y=w[_],g.vertexColors.push(y.clone());g.materialIndex=x.materialIndex+n,s.push(g)}for(p=0,f=h.length;p<f;p++){var T=h[p],M=[];if(void 0!==T){for(_=0,E=T.length;_<E;_++)M.push(T[_].clone());l.push(M)}}}else console.error("THREE.Geometry.merge(): geometry not an instance of THREE.Geometry.",e)},mergeMesh:function(e){e&&e.isMesh?(e.matrixAutoUpdate&&e.updateMatrix(),this.merge(e.geometry,e.matrix)):console.error("THREE.Geometry.mergeMesh(): mesh not an instance of THREE.Mesh.",e)},mergeVertices:function(){for(var e,t,n,i,r={},a=[],o=[],s=Math.pow(10,4),c=0,l=this.vertices.length;c<l;c++)e=this.vertices[c],void 0===r[e=Math.round(e.x*s)+"_"+Math.round(e.y*s)+"_"+Math.round(e.z*s)]?(r[e]=c,a.push(this.vertices[c]),o[c]=a.length-1):o[c]=o[r[e]];var h=[];for(c=0,l=this.faces.length;c<l;c++){(t=this.faces[c]).a=o[t.a],t.b=o[t.b],t.c=o[t.c];for(var u=[t.a,t.b,t.c],d=0;d<3;d++)if(u[d]===u[(d+1)%3]){h.push(c);break}}for(c=h.length-1;0<=c;c--){var p=h[c];for(this.faces.splice(p,1),n=0,i=this.faceVertexUvs.length;n<i;n++)this.faceVertexUvs[n].splice(p,1)}var f=this.vertices.length-a.length;return this.vertices=a,f},setFromPoints:function(e){this.vertices=[];for(var t=0,n=e.length;t<n;t++){var i=e[t];this.vertices.push(new Ce(i.x,i.y,i.z||0))}return this},sortFacesByMaterialIndex:function(){for(var e=this.faces,t=e.length,n=0;n<t;n++)e[n]._id=n;e.sort(function(e,t){return e.materialIndex-t.materialIndex});var i,r,a=this.faceVertexUvs[0],o=this.faceVertexUvs[1];a&&a.length===t&&(i=[]),o&&o.length===t&&(r=[]);for(n=0;n<t;n++){var s=e[n]._id;i&&i.push(a[s]),r&&r.push(o[s])}i&&(this.faceVertexUvs[0]=i),r&&(this.faceVertexUvs[1]=r)},toJSON:function(){var e={metadata:{version:4.5,type:"Geometry",generator:"Geometry.toJSON"}};if(e.uuid=this.uuid,e.type=this.type,""!==this.name&&(e.name=this.name),void 0!==this.parameters){var t,n=this.parameters;for(t in n)void 0!==n[t]&&(e[t]=n[t])}else{for(var i=[],r=0;r<this.vertices.length;r++){var a=this.vertices[r];i.push(a.x,a.y,a.z)}for(var o=[],s=[],c={},l=[],h={},u=[],d={},r=0;r<this.faces.length;r++){var p,f=this.faces[r],m=void 0!==this.faceVertexUvs[0][r],g=0<f.normal.length(),v=0<f.vertexNormals.length,y=1!==f.color.r||1!==f.color.g||1!==f.color.b,x=0<f.vertexColors.length;p=b(2,3,m),p=b(p,4,g),p=b(p,5,v),p=b(p,6,y),p=b(p,7,x),o.push(p),o.push(f.a,f.b,f.c),o.push(f.materialIndex),m&&(p=this.faceVertexUvs[0][r],o.push(E(p[0]),E(p[1]),E(p[2]))),g&&o.push(w(f.normal)),v&&(m=f.vertexNormals,o.push(w(m[0]),w(m[1]),w(m[2]))),y&&o.push(_(f.color)),x&&(p=f.vertexColors,o.push(_(p[0]),_(p[1]),_(p[2])))}e.data={},e.data.vertices=i,e.data.normals=s,0<l.length&&(e.data.colors=l),0<u.length&&(e.data.uvs=[u]),e.data.faces=o}return e;function b(e,t,n){return n?e|1<<t:e&~(1<<t)}function w(e){var t=e.x.toString()+e.y.toString()+e.z.toString();return void 0!==c[t]||(c[t]=s.length/3,s.push(e.x,e.y,e.z)),c[t]}function _(e){var t=e.r.toString()+e.g.toString()+e.b.toString();return void 0!==h[t]||(h[t]=l.length,l.push(e.getHex())),h[t]}function E(e){var t=e.x.toString()+e.y.toString();return void 0!==d[t]||(d[t]=u.length/2,u.push(e.x,e.y)),d[t]}},clone:function(){return(new x).copy(this)},copy:function(e){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=e.name;for(var t,n,i=e.vertices,r=0,a=i.length;r<a;r++)this.vertices.push(i[r].clone());var o=e.colors;for(r=0,a=o.length;r<a;r++)this.colors.push(o[r].clone());var s=e.faces;for(r=0,a=s.length;r<a;r++)this.faces.push(s[r].clone());for(r=0,a=e.faceVertexUvs.length;r<a;r++){var c=e.faceVertexUvs[r];for(void 0===this.faceVertexUvs[r]&&(this.faceVertexUvs[r]=[]),t=0,n=c.length;t<n;t++){for(var l=c[t],h=[],u=0,d=l.length;u<d;u++){var p=l[u];h.push(p.clone())}this.faceVertexUvs[r].push(h)}}var f=e.morphTargets;for(r=0,a=f.length;r<a;r++){var m={};if(m.name=f[r].name,void 0!==f[r].vertices)for(m.vertices=[],t=0,n=f[r].vertices.length;t<n;t++)m.vertices.push(f[r].vertices[t].clone());if(void 0!==f[r].normals)for(m.normals=[],t=0,n=f[r].normals.length;t<n;t++)m.normals.push(f[r].normals[t].clone());this.morphTargets.push(m)}var g=e.morphNormals;for(r=0,a=g.length;r<a;r++){var v={};if(void 0!==g[r].vertexNormals)for(v.vertexNormals=[],t=0,n=g[r].vertexNormals.length;t<n;t++){var y=g[r].vertexNormals[t],x={};x.a=y.a.clone(),x.b=y.b.clone(),x.c=y.c.clone(),v.vertexNormals.push(x)}if(void 0!==g[r].faceNormals)for(v.faceNormals=[],t=0,n=g[r].faceNormals.length;t<n;t++)v.faceNormals.push(g[r].faceNormals[t].clone());this.morphNormals.push(v)}var b=e.skinWeights;for(r=0,a=b.length;r<a;r++)this.skinWeights.push(b[r].clone());var w=e.skinIndices;for(r=0,a=w.length;r<a;r++)this.skinIndices.push(w[r].clone());var _=e.lineDistances;for(r=0,a=_.length;r<a;r++)this.lineDistances.push(_[r]);var E=e.boundingBox,E=(null!==E&&(this.boundingBox=E.clone()),e.boundingSphere);return null!==E&&(this.boundingSphere=E.clone()),this.elementsNeedUpdate=e.elementsNeedUpdate,this.verticesNeedUpdate=e.verticesNeedUpdate,this.uvsNeedUpdate=e.uvsNeedUpdate,this.normalsNeedUpdate=e.normalsNeedUpdate,this.colorsNeedUpdate=e.colorsNeedUpdate,this.lineDistancesNeedUpdate=e.lineDistancesNeedUpdate,this.groupsNeedUpdate=e.groupsNeedUpdate,this},dispose:function(){this.dispatchEvent({type:"dispose"})}}),Object.defineProperty(w.prototype,"needsUpdate",{set:function(e){!0===e&&this.version++}}),Object.assign(w.prototype,{isBufferAttribute:!0,setArray:function(e){if(Array.isArray(e))throw new TypeError("THREE.BufferAttribute: array should be a Typed Array.");this.count=void 0!==e?e.length/this.itemSize:0,this.array=e},setDynamic:function(e){return this.dynamic=e,this},copy:function(e){return this.array=new e.array.constructor(e.array),this.itemSize=e.itemSize,this.count=e.count,this.normalized=e.normalized,this.dynamic=e.dynamic,this},copyAt:function(e,t,n){e*=this.itemSize,n*=t.itemSize;for(var i=0,r=this.itemSize;i<r;i++)this.array[e+i]=t.array[n+i];return this},copyArray:function(e){return this.array.set(e),this},copyColorsArray:function(e){for(var t=this.array,n=0,i=0,r=e.length;i<r;i++){var a=e[i];void 0===a&&(console.warn("THREE.BufferAttribute.copyColorsArray(): color is undefined",i),a=new N),t[n++]=a.r,t[n++]=a.g,t[n++]=a.b}return this},copyIndicesArray:function(e){for(var t=this.array,n=0,i=0,r=e.length;i<r;i++){var a=e[i];t[n++]=a.a,t[n++]=a.b,t[n++]=a.c}return this},copyVector2sArray:function(e){for(var t=this.array,n=0,i=0,r=e.length;i<r;i++){var a=e[i];void 0===a&&(console.warn("THREE.BufferAttribute.copyVector2sArray(): vector is undefined",i),a=new te),t[n++]=a.x,t[n++]=a.y}return this},copyVector3sArray:function(e){for(var t=this.array,n=0,i=0,r=e.length;i<r;i++){var a=e[i];void 0===a&&(console.warn("THREE.BufferAttribute.copyVector3sArray(): vector is undefined",i),a=new Ce),t[n++]=a.x,t[n++]=a.y,t[n++]=a.z}return this},copyVector4sArray:function(e){for(var t=this.array,n=0,i=0,r=e.length;i<r;i++){var a=e[i];void 0===a&&(console.warn("THREE.BufferAttribute.copyVector4sArray(): vector is undefined",i),a=new Le),t[n++]=a.x,t[n++]=a.y,t[n++]=a.z,t[n++]=a.w}return this},set:function(e,t){return this.array.set(e,t=void 0===t?0:t),this},getX:function(e){return this.array[e*this.itemSize]},setX:function(e,t){return this.array[e*this.itemSize]=t,this},getY:function(e){return this.array[e*this.itemSize+1]},setY:function(e,t){return this.array[e*this.itemSize+1]=t,this},getZ:function(e){return this.array[e*this.itemSize+2]},setZ:function(e,t){return this.array[e*this.itemSize+2]=t,this},getW:function(e){return this.array[e*this.itemSize+3]},setW:function(e,t){return this.array[e*this.itemSize+3]=t,this},setXY:function(e,t,n){return e*=this.itemSize,this.array[e+0]=t,this.array[e+1]=n,this},setXYZ:function(e,t,n,i){return e*=this.itemSize,this.array[e+0]=t,this.array[e+1]=n,this.array[e+2]=i,this},setXYZW:function(e,t,n,i,r){return e*=this.itemSize,this.array[e+0]=t,this.array[e+1]=n,this.array[e+2]=i,this.array[e+3]=r,this},onUpload:function(e){return this.onUploadCallback=e,this},clone:function(){return new this.constructor(this.array,this.itemSize).copy(this)}}),(Ae.prototype=Object.create(w.prototype)).constructor=Ae,(He.prototype=Object.create(w.prototype)).constructor=He,(ze.prototype=Object.create(w.prototype)).constructor=ze,(Ge.prototype=Object.create(w.prototype)).constructor=Ge,Ve.prototype=Object.create(w.prototype),Ve.prototype.constructor=Ve,(je.prototype=Object.create(w.prototype)).constructor=je,We.prototype=Object.create(w.prototype),We.prototype.constructor=We,(ne.prototype=Object.create(w.prototype)).constructor=ne,(Xe.prototype=Object.create(w.prototype)).constructor=Xe,Object.assign(qe.prototype,{computeGroups:function(e){for(var t,n=[],i=void 0,r=e.faces,a=0;a<r.length;a++){var o=r[a];o.materialIndex!==i&&(i=o.materialIndex,void 0!==t&&(t.count=3*a-t.start,n.push(t)),t={start:3*a,materialIndex:i})}void 0!==t&&(t.count=3*a-t.start,n.push(t)),this.groups=n},fromGeometry:function(e){var t=e.faces,n=e.vertices,i=e.faceVertexUvs,r=i[0]&&0<i[0].length,a=i[1]&&0<i[1].length,o=e.morphTargets,s=o.length;if(0<s){for(var c=[],l=0;l<s;l++)c[l]=[];this.morphTargets.position=c}var h=e.morphNormals,u=h.length;if(0<u){for(var d=[],l=0;l<u;l++)d[l]=[];this.morphTargets.normal=d}for(var p=e.skinIndices,f=e.skinWeights,m=p.length===n.length,g=f.length===n.length,l=0;l<t.length;l++){var v,y=t[l],x=(this.vertices.push(n[y.a],n[y.b],n[y.c]),y.vertexNormals),x=(3===x.length?this.normals.push(x[0],x[1],x[2]):(x=y.normal,this.normals.push(x,x,x)),y.vertexColors);3===x.length?this.colors.push(x[0],x[1],x[2]):(x=y.color,this.colors.push(x,x,x)),!0===r&&(void 0!==(v=i[0][l])?this.uvs.push(v[0],v[1],v[2]):(console.warn("THREE.DirectGeometry.fromGeometry(): Undefined vertexUv ",l),this.uvs.push(new te,new te,new te))),!0===a&&(void 0!==(v=i[1][l])?this.uvs2.push(v[0],v[1],v[2]):(console.warn("THREE.DirectGeometry.fromGeometry(): Undefined vertexUv2 ",l),this.uvs2.push(new te,new te,new te)));for(var b=0;b<s;b++){var w=o[b].vertices;c[b].push(w[y.a],w[y.b],w[y.c])}for(b=0;b<u;b++){var _=h[b].vertexNormals[l];d[b].push(_.a,_.b,_.c)}m&&this.skinIndices.push(p[y.a],p[y.b],p[y.c]),g&&this.skinWeights.push(f[y.a],f[y.b],f[y.c])}return this.computeGroups(e),this.verticesNeedUpdate=e.verticesNeedUpdate,this.normalsNeedUpdate=e.normalsNeedUpdate,this.colorsNeedUpdate=e.colorsNeedUpdate,this.uvsNeedUpdate=e.uvsNeedUpdate,this.groupsNeedUpdate=e.groupsNeedUpdate,this}}),fl=1,J.prototype=Object.assign(Object.create(p.prototype),{constructor:J,isBufferGeometry:!0,getIndex:function(){return this.index},setIndex:function(e){Array.isArray(e)?this.index=new(65535<Ye(e)?We:Ve)(e,1):this.index=e},addAttribute:function(e,t){return t&&t.isBufferAttribute||t&&t.isInterleavedBufferAttribute?"index"===e?(console.warn("THREE.BufferGeometry.addAttribute: Use .setIndex() for index attribute."),void this.setIndex(t)):(this.attributes[e]=t,this):(console.warn("THREE.BufferGeometry: .addAttribute() now expects ( name, attribute )."),void this.addAttribute(e,new w(t,arguments[2])))},getAttribute:function(e){return this.attributes[e]},removeAttribute:function(e){return delete this.attributes[e],this},addGroup:function(e,t,n){this.groups.push({start:e,count:t,materialIndex:void 0!==n?n:0})},clearGroups:function(){this.groups=[]},setDrawRange:function(e,t){this.drawRange.start=e,this.drawRange.count=t},applyMatrix:function(e){var t=this.attributes.position,t=(void 0!==t&&(e.applyToBufferAttribute(t),t.needsUpdate=!0),this.attributes.normal);return void 0!==t&&((new S).getNormalMatrix(e).applyToBufferAttribute(t),t.needsUpdate=!0),null!==this.boundingBox&&this.computeBoundingBox(),null!==this.boundingSphere&&this.computeBoundingSphere(),this},rotateX:(pl=new Re,function(e){return pl.makeRotationX(e),this.applyMatrix(pl),this}),rotateY:(dl=new Re,function(e){return dl.makeRotationY(e),this.applyMatrix(dl),this}),rotateZ:(ul=new Re,function(e){return ul.makeRotationZ(e),this.applyMatrix(ul),this}),translate:(hl=new Re,function(e,t,n){return hl.makeTranslation(e,t,n),this.applyMatrix(hl),this}),scale:(ll=new Re,function(e,t,n){return ll.makeScale(e,t,n),this.applyMatrix(ll),this}),lookAt:(cl=new f,function(e){cl.lookAt(e),cl.updateMatrix(),this.applyMatrix(cl.matrix)}),center:function(){this.computeBoundingBox();var e=this.boundingBox.getCenter().negate();return this.translate(e.x,e.y,e.z),e},setFromObject:function(e){var t,n,i=e.geometry;return e.isPoints||e.isLine?(n=new ne(3*i.vertices.length,3),t=new ne(3*i.colors.length,3),this.addAttribute("position",n.copyVector3sArray(i.vertices)),this.addAttribute("color",t.copyColorsArray(i.colors)),i.lineDistances&&i.lineDistances.length===i.vertices.length&&(n=new ne(i.lineDistances.length,1),this.addAttribute("lineDistance",n.copyArray(i.lineDistances))),null!==i.boundingSphere&&(this.boundingSphere=i.boundingSphere.clone()),null!==i.boundingBox&&(this.boundingBox=i.boundingBox.clone())):e.isMesh&&i&&i.isGeometry&&this.fromGeometry(i),this},setFromPoints:function(e){for(var t=[],n=0,i=e.length;n<i;n++){var r=e[n];t.push(r.x,r.y,r.z||0)}return this.addAttribute("position",new ne(t,3)),this},updateFromObject:function(e){var t,n=e.geometry;if(e.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!==(t=this.attributes.position)&&(t.copyVector3sArray(n.vertices),t.needsUpdate=!0),n.verticesNeedUpdate=!1),!0===n.normalsNeedUpdate&&(void 0!==(t=this.attributes.normal)&&(t.copyVector3sArray(n.normals),t.needsUpdate=!0),n.normalsNeedUpdate=!1),!0===n.colorsNeedUpdate&&(void 0!==(t=this.attributes.color)&&(t.copyColorsArray(n.colors),t.needsUpdate=!0),n.colorsNeedUpdate=!1),n.uvsNeedUpdate&&(void 0!==(t=this.attributes.uv)&&(t.copyVector2sArray(n.uvs),t.needsUpdate=!0),n.uvsNeedUpdate=!1),n.lineDistancesNeedUpdate&&(void 0!==(t=this.attributes.lineDistance)&&(t.copyArray(n.lineDistances),t.needsUpdate=!0),n.lineDistancesNeedUpdate=!1),n.groupsNeedUpdate&&(n.computeGroups(e.geometry),this.groups=n.groups,n.groupsNeedUpdate=!1),this},fromGeometry:function(e){return e.__directGeometry=(new qe).fromGeometry(e),this.fromDirectGeometry(e.__directGeometry)},fromDirectGeometry:function(e){var t,n=new Float32Array(3*e.vertices.length);for(t in this.addAttribute("position",new w(n,3).copyVector3sArray(e.vertices)),0<e.normals.length&&(n=new Float32Array(3*e.normals.length),this.addAttribute("normal",new w(n,3).copyVector3sArray(e.normals))),0<e.colors.length&&(n=new Float32Array(3*e.colors.length),this.addAttribute("color",new w(n,3).copyColorsArray(e.colors))),0<e.uvs.length&&(n=new Float32Array(2*e.uvs.length),this.addAttribute("uv",new w(n,2).copyVector2sArray(e.uvs))),0<e.uvs2.length&&(n=new Float32Array(2*e.uvs2.length),this.addAttribute("uv2",new w(n,2).copyVector2sArray(e.uvs2))),0<e.indices.length&&(n=new(65535<Ye(e.indices)?Uint32Array:Uint16Array)(3*e.indices.length),this.setIndex(new w(n,1).copyIndicesArray(e.indices))),this.groups=e.groups,e.morphTargets){for(var i=[],r=e.morphTargets[t],a=0,o=r.length;a<o;a++){var s=r[a],c=new ne(3*s.length,3);i.push(c.copyVector3sArray(s))}this.morphAttributes[t]=i}return 0<e.skinIndices.length&&(n=new ne(4*e.skinIndices.length,4),this.addAttribute("skinIndex",n.copyVector4sArray(e.skinIndices))),0<e.skinWeights.length&&(n=new ne(4*e.skinWeights.length,4),this.addAttribute("skinWeight",n.copyVector4sArray(e.skinWeights))),null!==e.boundingSphere&&(this.boundingSphere=e.boundingSphere.clone()),null!==e.boundingBox&&(this.boundingBox=e.boundingBox.clone()),this},computeBoundingBox:function(){null===this.boundingBox&&(this.boundingBox=new ye);var e=this.attributes.position;void 0!==e?this.boundingBox.setFromBufferAttribute(e):this.boundingBox.makeEmpty(),(isNaN(this.boundingBox.min.x)||isNaN(this.boundingBox.min.y)||isNaN(this.boundingBox.min.z))&&console.error('THREE.BufferGeometry.computeBoundingBox: Computed min/max have NaN values. The "position" attribute is likely to have NaN values.',this)},computeBoundingSphere:(ol=new ye,sl=new Ce,function(){null===this.boundingSphere&&(this.boundingSphere=new xe);var e=this.attributes.position;if(e){var t=this.boundingSphere.center;ol.setFromBufferAttribute(e),ol.getCenter(t);for(var n=0,i=0,r=e.count;i<r;i++)sl.x=e.getX(i),sl.y=e.getY(i),sl.z=e.getZ(i),n=Math.max(n,t.distanceToSquared(sl));this.boundingSphere.radius=Math.sqrt(n),isNaN(this.boundingSphere.radius)}}),computeFaceNormals:function(){},computeVertexNormals:function(){var e=this.index,t=this.attributes,n=this.groups;if(t.position){var i=t.position.array;if(void 0===t.normal)this.addAttribute("normal",new w(new Float32Array(i.length),3));else for(var r=t.normal.array,a=0,o=r.length;a<o;a++)r[a]=0;var s,c,l,h=t.normal.array,u=new Ce,d=new Ce,p=new Ce,f=new Ce,m=new Ce;if(e){var g=e.array;0===n.length&&this.addGroup(0,g.length);for(var v=0,y=n.length;v<y;++v)for(var x=n[v],b=x.start,a=b,o=b+x.count;a<o;a+=3)s=3*g[a+0],c=3*g[a+1],l=3*g[a+2],u.fromArray(i,s),d.fromArray(i,c),p.fromArray(i,l),f.subVectors(p,d),m.subVectors(u,d),f.cross(m),h[s]+=f.x,h[1+s]+=f.y,h[2+s]+=f.z,h[c]+=f.x,h[1+c]+=f.y,h[2+c]+=f.z,h[l]+=f.x,h[1+l]+=f.y,h[2+l]+=f.z}else for(a=0,o=i.length;a<o;a+=9)u.fromArray(i,a),d.fromArray(i,a+3),p.fromArray(i,a+6),f.subVectors(p,d),m.subVectors(u,d),f.cross(m),h[a]=f.x,h[a+1]=f.y,h[a+2]=f.z,h[a+3]=f.x,h[a+4]=f.y,h[a+5]=f.z,h[a+6]=f.x,h[a+7]=f.y,h[a+8]=f.z;this.normalizeNormals(),t.normal.needsUpdate=!0}},merge:function(e,t){if(e&&e.isBufferGeometry){void 0===t&&(t=0);var n,i=this.attributes;for(n in i)if(void 0!==e.attributes[n])for(var r=i[n].array,a=e.attributes[n],o=a.array,s=0,c=a.itemSize*t;s<o.length;s++,c++)r[c]=o[s];return this}console.error("THREE.BufferGeometry.merge(): geometry not an instance of THREE.BufferGeometry.",e)},normalizeNormals:(al=new Ce,function(){for(var e=this.attributes.normal,t=0,n=e.count;t<n;t++)al.x=e.getX(t),al.y=e.getY(t),al.z=e.getZ(t),al.normalize(),e.setXYZ(t,al.x,al.y,al.z)}),toNonIndexed:function(){if(null===this.index)return console.warn("THREE.BufferGeometry.toNonIndexed(): Geometry is already non-indexed."),this;var e,t=new J,n=this.index.array,i=this.attributes;for(e in i){for(var r=i[e],a=r.array,o=r.itemSize,s=new a.constructor(n.length*o),c=0,l=0,h=0,u=n.length;h<u;h++)for(var c=n[h]*o,d=0;d<o;d++)s[l++]=a[c++];t.addAttribute(e,new w(s,o))}return t},toJSON:function(){var e={metadata:{version:4.5,type:"BufferGeometry",generator:"BufferGeometry.toJSON"}};if(e.uuid=this.uuid,e.type=this.type,""!==this.name&&(e.name=this.name),void 0!==this.parameters){var t=this.parameters;for(n in t)void 0!==t[n]&&(e[n]=t[n])}else{e.data={attributes:{}};var n,i=this.index,r=(null!==i&&(o=Array.prototype.slice.call(i.array),e.data.index={type:i.array.constructor.name,array:o}),this.attributes);for(n in r){var a=r[n],o=Array.prototype.slice.call(a.array);e.data.attributes[n]={itemSize:a.itemSize,type:a.array.constructor.name,array:o,normalized:a.normalized}}i=this.groups,i=(0<i.length&&(e.data.groups=JSON.parse(JSON.stringify(i))),this.boundingSphere);null!==i&&(e.data.boundingSphere={center:i.center.toArray(),radius:i.radius})}return e},clone:function(){return(new J).copy(this)},copy:function(e){this.index=null,this.attributes={},this.morphAttributes={},this.groups=[],this.boundingBox=null,this.boundingSphere=null,this.name=e.name;var t,n=e.index,i=(null!==n&&this.setIndex(n.clone()),e.attributes);for(t in i){var r=i[t];this.addAttribute(t,r.clone())}var a=e.morphAttributes;for(t in a){for(var o=[],s=a[t],c=0,l=s.length;c<l;c++)o.push(s[c].clone());this.morphAttributes[t]=o}var h=e.groups;for(c=0,l=h.length;c<l;c++){var u=h[c];this.addGroup(u.start,u.count,u.materialIndex)}n=e.boundingBox,null!==n&&(this.boundingBox=n.clone()),n=e.boundingSphere;return null!==n&&(this.boundingSphere=n.clone()),this.drawRange.start=e.drawRange.start,this.drawRange.count=e.drawRange.count,this},dispose:function(){this.dispatchEvent({type:"dispose"})}}),(Ze.prototype=Object.create(x.prototype)).constructor=Ze,(Je.prototype=Object.create(J.prototype)).constructor=Je,(Ke.prototype=Object.create(x.prototype)).constructor=Ke,(Qe.prototype=Object.create(J.prototype)).constructor=Qe,(($e.prototype=Object.create(t.prototype)).constructor=$e).prototype.isMeshBasicMaterial=!0,$e.prototype.copy=function(e){return t.prototype.copy.call(this,e),this.color.copy(e.color),this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.combine=e.combine,this.reflectivity=e.reflectivity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.skinning=e.skinning,this.morphTargets=e.morphTargets,this},((et.prototype=Object.create(t.prototype)).constructor=et).prototype.isShaderMaterial=!0,et.prototype.copy=function(e){return t.prototype.copy.call(this,e),this.fragmentShader=e.fragmentShader,this.vertexShader=e.vertexShader,this.uniforms=Es.clone(e.uniforms),this.defines=e.defines,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.lights=e.lights,this.clipping=e.clipping,this.skinning=e.skinning,this.morphTargets=e.morphTargets,this.morphNormals=e.morphNormals,this.extensions=e.extensions,this},et.prototype.toJSON=function(e){e=t.prototype.toJSON.call(this,e);return e.uniforms=this.uniforms,e.vertexShader=this.vertexShader,e.fragmentShader=this.fragmentShader,e},Object.assign(tt.prototype,{set:function(e,t){return this.origin.copy(e),this.direction.copy(t),this},clone:function(){return(new this.constructor).copy(this)},copy:function(e){return this.origin.copy(e.origin),this.direction.copy(e.direction),this},at:function(e,t){return(t||new Ce).copy(this.direction).multiplyScalar(e).add(this.origin)},lookAt:function(e){return this.direction.copy(e).sub(this.origin).normalize(),this},recast:(rl=new Ce,function(e){return this.origin.copy(this.at(e,rl)),this}),closestPointToPoint:function(e,t){t=t||new Ce,t.subVectors(e,this.origin),e=t.dot(this.direction);return e<0?t.copy(this.origin):t.copy(this.direction).multiplyScalar(e).add(this.origin)},distanceToPoint:function(e){return Math.sqrt(this.distanceSqToPoint(e))},distanceSqToPoint:(il=new Ce,function(e){var t=il.subVectors(e,this.origin).dot(this.direction);return(t<0?this.origin:(il.copy(this.direction).multiplyScalar(t).add(this.origin),il)).distanceToSquared(e)}),distanceSqToSegment:(Tc=new Ce,Mc=new Ce,Sc=new Ce,function(e,t,n,i){Tc.copy(e).add(t).multiplyScalar(.5),Mc.copy(t).sub(e).normalize(),Sc.copy(this.origin).sub(Tc);var r,a,o,e=.5*e.distanceTo(t),t=-this.direction.dot(Mc),s=Sc.dot(this.direction),c=-Sc.dot(Mc),l=Sc.lengthSq(),h=Math.abs(1-t*t);return h=0<h?(a=t*s-c,o=e*h,0<=(r=t*c-s)?-o<=a?a<=o?(r*=h=1/h)*(r+t*(a*=h)+2*s)+a*(t*r+a+2*c)+l:(a=e,-(r=Math.max(0,-(t*a+s)))*r+a*(a+2*c)+l):(a=-e,-(r=Math.max(0,-(t*a+s)))*r+a*(a+2*c)+l):a<=-o?-(r=Math.max(0,-(-t*e+s)))*r+(a=0<r?-e:Math.min(Math.max(-e,-c),e))*(a+2*c)+l:a<=o?(r=0,(a=Math.min(Math.max(-e,-c),e))*(a+2*c)+l):-(r=Math.max(0,-(t*e+s)))*r+(a=0<r?e:Math.min(Math.max(-e,-c),e))*(a+2*c)+l):(a=0<t?-e:e,-(r=Math.max(0,-(t*a+s)))*r+a*(a+2*c)+l),n&&n.copy(this.direction).multiplyScalar(r).add(this.origin),i&&i.copy(Mc).multiplyScalar(a).add(Tc),h}),intersectSphere:(nl=new Ce,function(e,t){nl.subVectors(e.center,this.origin);var n=nl.dot(this.direction),i=nl.dot(nl)-n*n,e=e.radius*e.radius;return e<i||(i=n+(e=Math.sqrt(e-i)),(n=n-e)<0&&i<0)?null:n<0?this.at(i,t):this.at(n,t)}),intersectsSphere:function(e){return this.distanceToPoint(e.center)<=e.radius},distanceToPlane:function(e){var t=e.normal.dot(this.direction);return 0===t?0===e.distanceToPoint(this.origin)?0:null:0<=(e=-(this.origin.dot(e.normal)+e.constant)/t)?e:null},intersectPlane:function(e,t){e=this.distanceToPlane(e);return null===e?null:this.at(e,t)},intersectsPlane:function(e){var t=e.distanceToPoint(this.origin);return 0===t||e.normal.dot(this.direction)*t<0},intersectBox:function(e,t){var n,i,r,a=1/this.direction.x,o=1/this.direction.y,s=1/this.direction.z,c=this.origin,a=0<=a?(n=(e.min.x-c.x)*a,(e.max.x-c.x)*a):(n=(e.max.x-c.x)*a,(e.min.x-c.x)*a),o=0<=o?(r=(e.min.y-c.y)*o,(e.max.y-c.y)*o):(r=(e.max.y-c.y)*o,(e.min.y-c.y)*o);return o<n||a<r||((n<r||n!=n)&&(n=r),(o<a||a!=a)&&(a=o),(r=0<=s?(i=(e.min.z-c.z)*s,(e.max.z-c.z)*s):(i=(e.max.z-c.z)*s,(e.min.z-c.z)*s))<n)||a<i||((n<i||n!=n)&&(n=i),(a=r<a||a!=a?r:a)<0)?null:this.at(0<=n?n:a,t)},intersectsBox:(Ec=new Ce,function(e){return null!==this.intersectBox(e,Ec)}),intersectTriangle:(Qc=new Ce,$c=new Ce,el=new Ce,tl=new Ce,function(e,t,n,i,r){$c.subVectors(t,e),el.subVectors(n,e),tl.crossVectors($c,el);var a,t=this.direction.dot(tl);if(0<t){if(i)return null;a=1}else{if(!(t<0))return null;a=-1,t=-t}Qc.subVectors(this.origin,e);n=a*this.direction.dot(el.crossVectors(Qc,el));return n<0||(i=a*this.direction.dot($c.cross(Qc)))<0||t<n+i||(e=-a*Qc.dot(tl))<0?null:this.at(e/t,r)}),applyMatrix4:function(e){return this.origin.applyMatrix4(e),this.direction.transformDirection(e),this},equals:function(e){return e.origin.equals(this.origin)&&e.direction.equals(this.direction)}}),Object.assign(nt.prototype,{set:function(e,t){return this.start.copy(e),this.end.copy(t),this},clone:function(){return(new this.constructor).copy(this)},copy:function(e){return this.start.copy(e.start),this.end.copy(e.end),this},getCenter:function(e){return(e||new Ce).addVectors(this.start,this.end).multiplyScalar(.5)},delta:function(e){return(e||new Ce).subVectors(this.end,this.start)},distanceSq:function(){return this.start.distanceToSquared(this.end)},distance:function(){return this.start.distanceTo(this.end)},at:function(e,t){t=t||new Ce;return this.delta(t).multiplyScalar(e).add(this.start)},closestPointToPointParameter:(wc=new Ce,_c=new Ce,function(e,t){wc.subVectors(e,this.start),_c.subVectors(this.end,this.start);e=_c.dot(_c),e=_c.dot(wc)/e;return e=t?Pe.clamp(e,0,1):e}),closestPointToPoint:function(e,t,n){e=this.closestPointToPointParameter(e,t),t=n||new Ce;return this.delta(t).multiplyScalar(e).add(this.start)},applyMatrix4:function(e){return this.start.applyMatrix4(e),this.end.applyMatrix4(e),this},equals:function(e){return e.start.equals(this.start)&&e.end.equals(this.end)}}),Object.assign(it,{normal:(bc=new Ce,function(e,t,n,i){i=i||new Ce,i.subVectors(n,t),bc.subVectors(e,t),i.cross(bc),n=i.lengthSq();return 0<n?i.multiplyScalar(1/Math.sqrt(n)):i.set(0,0,0)}),barycoordFromPoint:(Zc=new Ce,Jc=new Ce,Kc=new Ce,function(e,t,n,i,r){Zc.subVectors(i,t),Jc.subVectors(n,t),Kc.subVectors(e,t);var i=Zc.dot(Zc),n=Zc.dot(Jc),e=Zc.dot(Kc),t=Jc.dot(Jc),a=Jc.dot(Kc),o=i*t-n*n,r=r||new Ce;return 0==o?r.set(-2,-1,-1):r.set(1-(t=(t*e-n*a)*(r=1/o))-(o=(i*a-n*e)*r),o,t)}),containsPoint:(Yc=new Ce,function(e,t,n,i){e=it.barycoordFromPoint(e,t,n,i,Yc);return 0<=e.x&&0<=e.y&&e.x+e.y<=1})}),Object.assign(it.prototype,{set:function(e,t,n){return this.a.copy(e),this.b.copy(t),this.c.copy(n),this},setFromPointsAndIndices:function(e,t,n,i){return this.a.copy(e[t]),this.b.copy(e[n]),this.c.copy(e[i]),this},clone:function(){return(new this.constructor).copy(this)},copy:function(e){return this.a.copy(e.a),this.b.copy(e.b),this.c.copy(e.c),this},area:(Xc=new Ce,qc=new Ce,function(){return Xc.subVectors(this.c,this.b),qc.subVectors(this.a,this.b),.5*Xc.cross(qc).length()}),midpoint:function(e){return(e||new Ce).addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)},normal:function(e){return it.normal(this.a,this.b,this.c,e)},plane:function(e){return(e||new be).setFromCoplanarPoints(this.a,this.b,this.c)},barycoordFromPoint:function(e,t){return it.barycoordFromPoint(e,this.a,this.b,this.c,t)},containsPoint:function(e){return it.containsPoint(e,this.a,this.b,this.c)},closestPointToPoint:(Gc=new be,Vc=[new nt,new nt,new nt],jc=new Ce,Wc=new Ce,function(e,t){var n=t||new Ce,i=1/0;if(Gc.setFromCoplanarPoints(this.a,this.b,this.c),Gc.projectPoint(e,jc),!0===this.containsPoint(jc))n.copy(jc);else{Vc[0].set(this.a,this.b),Vc[1].set(this.b,this.c),Vc[2].set(this.c,this.a);for(var r=0;r<Vc.length;r++){Vc[r].closestPointToPoint(jc,!0,Wc);var a=jc.distanceToSquared(Wc);a<i&&(i=a,n.copy(Wc))}}return n}),equals:function(e){return e.a.equals(this.a)&&e.b.equals(this.b)&&e.c.equals(this.c)}}),m.prototype=Object.assign(Object.create(f.prototype),{constructor:m,isMesh:!0,setDrawMode:function(e){this.drawMode=e},copy:function(e){return f.prototype.copy.call(this,e),this.drawMode=e.drawMode,void 0!==e.morphTargetInfluences&&(this.morphTargetInfluences=e.morphTargetInfluences.slice()),void 0!==e.morphTargetDictionary&&(this.morphTargetDictionary=Object.assign({},e.morphTargetDictionary)),this},updateMorphTargets:function(){var e,t,n,i=this.geometry;if(i.isBufferGeometry){var r=i.morphAttributes,a=Object.keys(r);if(0<a.length){var o=r[a[0]];if(void 0!==o)for(this.morphTargetInfluences=[],this.morphTargetDictionary={},e=0,t=o.length;e<t;e++)n=o[e].name||String(e),this.morphTargetInfluences.push(0),this.morphTargetDictionary[n]=e}}else{var s=i.morphTargets;if(void 0!==s&&0<s.length)for(this.morphTargetInfluences=[],this.morphTargetDictionary={},e=0,t=s.length;e<t;e++)n=s[e].name||String(e),this.morphTargetInfluences.push(0),this.morphTargetDictionary[n]=e}},raycast:(Ac=new Re,Rc=new tt,Cc=new xe,Lc=new Ce,Pc=new Ce,Nc=new Ce,Oc=new Ce,Ic=new Ce,Uc=new Ce,Dc=new te,Fc=new te,Bc=new te,kc=new Ce,Hc=new Ce,zc=new Ce,function(e,t){var n,i=this.geometry,r=this.material,a=this.matrixWorld;if(void 0!==r&&(null===i.boundingSphere&&i.computeBoundingSphere(),Cc.copy(i.boundingSphere),Cc.applyMatrix4(a),!1!==e.ray.intersectsSphere(Cc))&&(Ac.getInverse(a),Rc.copy(e.ray).applyMatrix4(Ac),null===i.boundingBox||!1!==Rc.intersectsBox(i.boundingBox)))if(i.isBufferGeometry){var o,s,c,l,h,u=i.index,d=i.attributes.position,p=i.attributes.uv;if(null!==u)for(l=0,h=u.count;l<h;l+=3)o=u.getX(l),s=u.getX(l+1),c=u.getX(l+2),(n=bt(this,e,Rc,d,p,o,s,c))&&(n.faceIndex=Math.floor(l/3),t.push(n));else if(void 0!==d)for(l=0,h=d.count;l<h;l+=3)(n=bt(this,e,Rc,d,p,o=l,s=l+1,c=l+2))&&(n.index=o,t.push(n))}else if(i.isGeometry){var f,m,g,v,y=Array.isArray(r),x=i.vertices,b=i.faces,a=i.faceVertexUvs[0];0<a.length&&(v=a);for(var w=0,_=b.length;w<_;w++){var E=b[w],T=y?r[E.materialIndex]:r;if(void 0!==T){if(f=x[E.a],m=x[E.b],g=x[E.c],!0===T.morphTargets){var M=i.morphTargets,S=this.morphTargetInfluences;Lc.set(0,0,0),Pc.set(0,0,0),Nc.set(0,0,0);for(var A=0,R=M.length;A<R;A++){var C,L=S[A];0!==L&&(C=M[A].vertices,Lc.addScaledVector(Oc.subVectors(C[E.a],f),L),Pc.addScaledVector(Ic.subVectors(C[E.b],m),L),Nc.addScaledVector(Uc.subVectors(C[E.c],g),L))}Lc.add(f),Pc.add(m),Nc.add(g),f=Lc,m=Pc,g=Nc}(n=xt(this,T,e,Rc,f,m,g,Hc))&&(v&&v[w]&&(T=v[w],Dc.copy(T[0]),Fc.copy(T[1]),Bc.copy(T[2]),n.uv=yt(Hc,f,m,g,Dc,Fc,Bc)),n.face=E,n.faceIndex=w,t.push(n))}}}}),clone:function(){return new this.constructor(this.geometry,this.material).copy(this)}}),Cl=0,g.prototype=Object.assign(Object.create(Te.prototype),{constructor:g,isPerspectiveCamera:!0,copy:function(e,t){return Te.prototype.copy.call(this,e,t),this.fov=e.fov,this.zoom=e.zoom,this.near=e.near,this.far=e.far,this.focus=e.focus,this.aspect=e.aspect,this.view=null===e.view?null:Object.assign({},e.view),this.filmGauge=e.filmGauge,this.filmOffset=e.filmOffset,this},setFocalLength:function(e){e=.5*this.getFilmHeight()/e;this.fov=2*Pe.RAD2DEG*Math.atan(e),this.updateProjectionMatrix()},getFocalLength:function(){var e=Math.tan(.5*Pe.DEG2RAD*this.fov);return.5*this.getFilmHeight()/e},getEffectiveFOV:function(){return 2*Pe.RAD2DEG*Math.atan(Math.tan(.5*Pe.DEG2RAD*this.fov)/this.zoom)},getFilmWidth:function(){return this.filmGauge*Math.min(this.aspect,1)},getFilmHeight:function(){return this.filmGauge/Math.max(this.aspect,1)},setViewOffset:function(e,t,n,i,r,a){this.aspect=e/t,null===this.view&&(this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1}),this.view.enabled=!0,this.view.fullWidth=e,this.view.fullHeight=t,this.view.offsetX=n,this.view.offsetY=i,this.view.width=r,this.view.height=a,this.updateProjectionMatrix()},clearViewOffset:function(){null!==this.view&&(this.view.enabled=!1),this.updateProjectionMatrix()},updateProjectionMatrix:function(){var e,t=this.near,n=t*Math.tan(.5*Pe.DEG2RAD*this.fov)/this.zoom,i=2*n,r=this.aspect*i,a=-.5*r,o=this.view,s=(null!==this.view&&this.view.enabled&&(s=o.fullWidth,e=o.fullHeight,a+=o.offsetX*r/s,n-=o.offsetY*i/e,r*=o.width/s,i*=o.height/e),this.filmOffset);0!==s&&(a+=t*s/this.getFilmWidth()),this.projectionMatrix.makePerspective(a,a+r,n,n-i,t,this.far)},toJSON:function(e){e=f.prototype.toJSON.call(this,e);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}}),Ot.prototype=Object.assign(Object.create(g.prototype),{constructor:Ot,isArrayCamera:!0}),kt.prototype.isFogExp2=!0,kt.prototype.clone=function(){return new kt(this.color.getHex(),this.density)},kt.prototype.toJSON=function(){return{type:"FogExp2",color:this.color.getHex(),density:this.density}},Ht.prototype.isFog=!0,Ht.prototype.clone=function(){return new Ht(this.color.getHex(),this.near,this.far)},Ht.prototype.toJSON=function(){return{type:"Fog",color:this.color.getHex(),near:this.near,far:this.far}},zt.prototype=Object.assign(Object.create(f.prototype),{constructor:zt,copy:function(e,t){return f.prototype.copy.call(this,e,t),null!==e.background&&(this.background=e.background.clone()),null!==e.fog&&(this.fog=e.fog.clone()),null!==e.overrideMaterial&&(this.overrideMaterial=e.overrideMaterial.clone()),this.autoUpdate=e.autoUpdate,this.matrixAutoUpdate=e.matrixAutoUpdate,this},toJSON:function(e){var t=f.prototype.toJSON.call(this,e);return null!==this.background&&(t.object.background=this.background.toJSON(e)),null!==this.fog&&(t.object.fog=this.fog.toJSON()),t}}),Gt.prototype=Object.assign(Object.create(f.prototype),{constructor:Gt,isLensFlare:!0,copy:function(e){f.prototype.copy.call(this,e),this.positionScreen.copy(e.positionScreen),this.customUpdateCallback=e.customUpdateCallback;for(var t=0,n=e.lensFlares.length;t<n;t++)this.lensFlares.push(e.lensFlares[t]);return this},add:function(e,t,n,i,r,a){void 0===t&&(t=-1),void 0===n&&(n=0),void 0===a&&(a=1),void 0===r&&(r=new N(16777215)),void 0===i&&(i=Aa),n=Math.min(n,Math.max(0,n)),this.lensFlares.push({texture:e,size:t,distance:n,x:0,y:0,z:0,scale:1,rotation:0,opacity:a,color:r,blending:i})},updateLensFlares:function(){for(var e,t=this.lensFlares.length,n=2*-this.positionScreen.x,i=2*-this.positionScreen.y,r=0;r<t;r++)(e=this.lensFlares[r]).x=this.positionScreen.x+n*e.distance,e.y=this.positionScreen.y+i*e.distance,e.wantedRotation=e.x*Math.PI*.25,e.rotation+=.25*(e.wantedRotation-e.rotation)}}),((Vt.prototype=Object.create(t.prototype)).constructor=Vt).prototype.isSpriteMaterial=!0,Vt.prototype.copy=function(e){return t.prototype.copy.call(this,e),this.color.copy(e.color),this.map=e.map,this.rotation=e.rotation,this},jt.prototype=Object.assign(Object.create(f.prototype),{constructor:jt,isSprite:!0,raycast:(yl=new Ce,xl=new Ce,bl=new Ce,function(e,t){xl.setFromMatrixPosition(this.matrixWorld),e.ray.closestPointToPoint(xl,yl),bl.setFromMatrixScale(this.matrixWorld);var n=bl.x*bl.y/4;xl.distanceToSquared(yl)>n||(n=e.ray.origin.distanceTo(yl))<e.near||n>e.far||t.push({distance:n,point:yl.clone(),face:null,object:this})}),clone:function(){return new this.constructor(this.material).copy(this)}}),Wt.prototype=Object.assign(Object.create(f.prototype),{constructor:Wt,copy:function(e){f.prototype.copy.call(this,e,!1);for(var t=e.levels,n=0,i=t.length;n<i;n++){var r=t[n];this.addLevel(r.object.clone(),r.distance)}return this},addLevel:function(e,t){void 0===t&&(t=0),t=Math.abs(t);for(var n=this.levels,i=0;i<n.length&&!(t<n[i].distance);i++);n.splice(i,0,{distance:t,object:e}),this.add(e)},getObjectForDistance:function(e){for(var t=this.levels,n=1,i=t.length;n<i&&!(e<t[n].distance);n++);return t[n-1].object},raycast:(vl=new Ce,function(e,t){vl.setFromMatrixPosition(this.matrixWorld);var n=e.ray.origin.distanceTo(vl);this.getObjectForDistance(n).raycast(e,t)}),update:(Al=new Ce,Rl=new Ce,function(e){var t=this.levels;if(1<t.length){Al.setFromMatrixPosition(e.matrixWorld),Rl.setFromMatrixPosition(this.matrixWorld);var n=Al.distanceTo(Rl);t[0].object.visible=!0;for(var i=1,r=t.length;i<r&&n>=t[i].distance;i++)t[i-1].object.visible=!1,t[i].object.visible=!0;for(;i<r;i++)t[i].object.visible=!1}}),toJSON:function(e){var t=f.prototype.toJSON.call(this,e);t.object.levels=[];for(var n=this.levels,i=0,r=n.length;i<r;i++){var a=n[i];t.object.levels.push({object:a.object.uuid,distance:a.distance})}return t}}),Object.assign(Xt.prototype,{calculateInverses:function(){this.boneInverses=[];for(var e=0,t=this.bones.length;e<t;e++){var n=new Re;this.bones[e]&&n.getInverse(this.bones[e].matrixWorld),this.boneInverses.push(n)}},pose:function(){for(var e,t=0,n=this.bones.length;t<n;t++)(e=this.bones[t])&&e.matrixWorld.getInverse(this.boneInverses[t]);for(t=0,n=this.bones.length;t<n;t++)(e=this.bones[t])&&(e.parent&&e.parent.isBone?(e.matrix.getInverse(e.parent.matrixWorld),e.matrix.multiply(e.matrixWorld)):e.matrix.copy(e.matrixWorld),e.matrix.decompose(e.position,e.quaternion,e.scale))},update:(ml=new Re,gl=new Re,function(){for(var e=this.bones,t=this.boneInverses,n=this.boneMatrices,i=this.boneTexture,r=0,a=e.length;r<a;r++){var o=e[r]?e[r].matrixWorld:gl;ml.multiplyMatrices(o,t[r]),ml.toArray(n,16*r)}void 0!==i&&(i.needsUpdate=!0)}),clone:function(){return new Xt(this.bones,this.boneInverses)}}),qt.prototype=Object.assign(Object.create(f.prototype),{constructor:qt,isBone:!0}),Yt.prototype=Object.assign(Object.create(m.prototype),{constructor:Yt,isSkinnedMesh:!0,initBones:function(){var e,t,n,i,r=[];if(this.geometry&&void 0!==this.geometry.bones){for(n=0,i=this.geometry.bones.length;n<i;n++)t=this.geometry.bones[n],e=new qt,r.push(e),e.name=t.name,e.position.fromArray(t.pos),e.quaternion.fromArray(t.rotq),void 0!==t.scl&&e.scale.fromArray(t.scl);for(n=0,i=this.geometry.bones.length;n<i;n++)(-1!==(t=this.geometry.bones[n]).parent&&null!==t.parent&&void 0!==r[t.parent]?r[t.parent]:this).add(r[n])}return this.updateMatrixWorld(!0),r},bind:function(e,t){this.skeleton=e,void 0===t&&(this.updateMatrixWorld(!0),this.skeleton.calculateInverses(),t=this.matrixWorld),this.bindMatrix.copy(t),this.bindMatrixInverse.getInverse(t)},pose:function(){this.skeleton.pose()},normalizeSkinWeights:function(){var e;if(this.geometry&&this.geometry.isGeometry)for(r=0;r<this.geometry.skinWeights.length;r++){var t=this.geometry.skinWeights[r];(e=1/t.manhattanLength())!=1/0?t.multiplyScalar(e):t.set(1,0,0,0)}else if(this.geometry&&this.geometry.isBufferGeometry)for(var n=new Le,i=this.geometry.attributes.skinWeight,r=0;r<i.count;r++)n.x=i.getX(r),n.y=i.getY(r),n.z=i.getZ(r),n.w=i.getW(r),(e=1/n.manhattanLength())!=1/0?n.multiplyScalar(e):n.set(1,0,0,0),i.setXYZW(r,n.x,n.y,n.z,n.w)},updateMatrixWorld:function(e){m.prototype.updateMatrixWorld.call(this,e),"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)}}),((v.prototype=Object.create(t.prototype)).constructor=v).prototype.isLineBasicMaterial=!0,v.prototype.copy=function(e){return t.prototype.copy.call(this,e),this.color.copy(e.color),this.linewidth=e.linewidth,this.linecap=e.linecap,this.linejoin=e.linejoin,this},y.prototype=Object.assign(Object.create(f.prototype),{constructor:y,isLine:!0,raycast:(Tl=new Re,Ml=new tt,Sl=new xe,function(e,t){var n=e.linePrecision,i=n*n,n=this.geometry,r=this.matrixWorld;if(null===n.boundingSphere&&n.computeBoundingSphere(),Sl.copy(n.boundingSphere),Sl.applyMatrix4(r),!1!==e.ray.intersectsSphere(Sl)){Tl.getInverse(r),Ml.copy(e.ray).applyMatrix4(Tl);var a=new Ce,o=new Ce,s=new Ce,c=new Ce,l=this&&this.isLineSegments?2:1;if(n.isBufferGeometry){var r=n.index,h=n.attributes.position.array;if(null!==r)for(var u=r.array,d=0,p=u.length-1;d<p;d+=l){var f,m=u[d],g=u[d+1];a.fromArray(h,3*m),o.fromArray(h,3*g),i<Ml.distanceSqToSegment(a,o,c,s)||(c.applyMatrix4(this.matrixWorld),(f=e.ray.origin.distanceTo(c))<e.near)||f>e.far||t.push({distance:f,point:s.clone().applyMatrix4(this.matrixWorld),index:d,face:null,faceIndex:null,object:this})}else for(d=0,p=h.length/3-1;d<p;d+=l)a.fromArray(h,3*d),o.fromArray(h,3*d+3),i<Ml.distanceSqToSegment(a,o,c,s)||(c.applyMatrix4(this.matrixWorld),(f=e.ray.origin.distanceTo(c))<e.near)||f>e.far||t.push({distance:f,point:s.clone().applyMatrix4(this.matrixWorld),index:d,face:null,faceIndex:null,object:this})}else if(n.isGeometry)for(var v=n.vertices,y=v.length,d=0;d<y-1;d+=l)i<Ml.distanceSqToSegment(v[d],v[d+1],c,s)||(c.applyMatrix4(this.matrixWorld),(f=e.ray.origin.distanceTo(c))<e.near)||f>e.far||t.push({distance:f,point:s.clone().applyMatrix4(this.matrixWorld),index:d,face:null,faceIndex:null,object:this})}}),clone:function(){return new this.constructor(this.geometry,this.material).copy(this)}}),b.prototype=Object.assign(Object.create(y.prototype),{constructor:b,isLineSegments:!0}),Zt.prototype=Object.assign(Object.create(y.prototype),{constructor:Zt,isLineLoop:!0}),((Jt.prototype=Object.create(t.prototype)).constructor=Jt).prototype.isPointsMaterial=!0,Jt.prototype.copy=function(e){return t.prototype.copy.call(this,e),this.color.copy(e.color),this.map=e.map,this.size=e.size,this.sizeAttenuation=e.sizeAttenuation,this},Kt.prototype=Object.assign(Object.create(f.prototype),{constructor:Kt,isPoints:!0,raycast:(wl=new Re,_l=new tt,El=new xe,function(r,a){var o=this,e=this.geometry,s=this.matrixWorld,t=r.params.Points.threshold;if(null===e.boundingSphere&&e.computeBoundingSphere(),El.copy(e.boundingSphere),El.applyMatrix4(s),El.radius+=t,!1!==r.ray.intersectsSphere(El)){wl.getInverse(s),_l.copy(r.ray).applyMatrix4(wl);var t=t/((this.scale.x+this.scale.y+this.scale.z)/3),c=t*t,n=new Ce;if(e.isBufferGeometry){var t=e.index,i=e.attributes.position.array;if(null!==t)for(var l=t.array,h=0,u=l.length;h<u;h++){var d=l[h];n.fromArray(i,3*d),m(n,d)}else for(var h=0,p=i.length/3;h<p;h++)n.fromArray(i,3*h),m(n,h)}else for(var f=e.vertices,h=0,p=f.length;h<p;h++)m(f[h],h)}function m(e,t){var n,i=_l.distanceSqToPoint(e);i<c&&((e=_l.closestPointToPoint(e)).applyMatrix4(s),(n=r.ray.origin.distanceTo(e))<r.near||n>r.far||a.push({distance:n,distanceToRay:Math.sqrt(i),point:e.clone(),index:t,face:null,object:o}))}}),clone:function(){return new this.constructor(this.geometry,this.material).copy(this)}}),Qt.prototype=Object.assign(Object.create(f.prototype),{constructor:Qt,isGroup:!0}),$t.prototype=Object.assign(Object.create(d.prototype),{constructor:$t,isVideoTexture:!0,update:function(){var e=this.image;e.readyState>=e.HAVE_CURRENT_DATA&&(this.needsUpdate=!0)}}),((en.prototype=Object.create(d.prototype)).constructor=en).prototype.isCompressedTexture=!0,((tn.prototype=Object.create(d.prototype)).constructor=tn).prototype.isDepthTexture=!0,(nn.prototype=Object.create(J.prototype)).constructor=nn,(rn.prototype=Object.create(x.prototype)).constructor=rn,(an.prototype=Object.create(J.prototype)).constructor=an,(on.prototype=Object.create(x.prototype)).constructor=on,(sn.prototype=Object.create(J.prototype)).constructor=sn,(cn.prototype=Object.create(x.prototype)).constructor=cn,(ln.prototype=Object.create(sn.prototype)).constructor=ln,(hn.prototype=Object.create(x.prototype)).constructor=hn,(un.prototype=Object.create(sn.prototype)).constructor=un,(dn.prototype=Object.create(x.prototype)).constructor=dn,(pn.prototype=Object.create(sn.prototype)).constructor=pn,(fn.prototype=Object.create(x.prototype)).constructor=fn,(mn.prototype=Object.create(sn.prototype)).constructor=mn,(gn.prototype=Object.create(x.prototype)).constructor=gn,(vn.prototype=Object.create(J.prototype)).constructor=vn,(yn.prototype=Object.create(x.prototype)).constructor=yn,(xn.prototype=Object.create(J.prototype)).constructor=xn,(bn.prototype=Object.create(x.prototype)).constructor=bn,(wn.prototype=Object.create(J.prototype)).constructor=wn,Ll=function(e,t,n){n=n||2;var i,r,a,o,s,c=t&&t.length,l=c?t[0]*n:e.length,h=_n(e,0,l,n,!0),u=[];if(h){if(c&&(h=((e,t,n,i)=>{for(var r,a,o,s=[],c=0,l=t.length;c<l;c++)(r=_n(e,t[c]*i,c<l-1?t[c+1]*i:e.length,i,!1))===r.next&&(r.steiner=!0),s.push((e=>{for(var t=e,n=e;t.x<n.x&&(n=t),(t=t.next)!==e;);return n})(r));for(s.sort(Mn),c=0;c<s.length;c++)(o=((e,t)=>{var n,i=t,r=e.x,a=e.y,o=-1/0;do{if(a<=i.y&&a>=i.next.y&&i.next.y!==i.y){var s=i.x+(a-i.y)*(i.next.x-i.x)/(i.next.y-i.y);if(s<=r&&o<s){if((o=s)===r){if(a===i.y)return i;if(a===i.next.y)return i.next}n=i.x<i.next.x?i:i.next}}}while((i=i.next)!==t);if(!n)return null;if(r===o)return n.prev;for(var c,l=n,h=n.x,u=n.y,d=1/0,i=n.next;i!==l;)r>=i.x&&i.x>=h&&r!==i.x&&An(a<u?r:o,a,h,u,a<u?o:r,a,i.x,i.y)&&((c=Math.abs(a-i.y)/(r-i.x))<d||c===d&&i.x>n.x)&&Ln(i,e)&&(n=i,d=c),i=i.next;return n})(a=s[c],o=n))&&En(o=Pn(o,a),o.next),n=En(n,n.next);return n})(e,t,h,n)),e.length>80*n){for(var d=i=e[0],p=r=e[1],f=n;f<l;f+=n)(a=e[f])<d&&(d=a),(o=e[f+1])<p&&(p=o),i<a&&(i=a),r<o&&(r=o);s=0!==(s=Math.max(i-d,r-p))?1/s:0}Tn(h,u,n,d,p,s)}return u},Pl={area:function(e){for(var t=e.length,n=0,i=t-1,r=0;r<t;i=r++)n+=e[i].x*e[r].y-e[r].x*e[i].y;return.5*n},isClockWise:function(e){return Pl.area(e)<0},triangulateShape:function(e,t){function n(e){var t=e.length;2<t&&e[t-1].equals(e[0])&&e.pop()}function i(e,t){for(var n=0;n<t.length;n++)e.push(t[n].x),e.push(t[n].y)}var r=[],a=[],o=[],s=(n(e),i(r,e),e.length);for(t.forEach(n),l=0;l<t.length;l++)a.push(s),s+=t[l].length,i(r,t[l]);for(var c=Ll(r,a),l=0;l<c.length;l+=3)o.push(c.slice(l,l+3));return o}},(Un.prototype=Object.create(x.prototype)).constructor=Un,((Dn.prototype=Object.create(J.prototype)).constructor=Dn).prototype.getArrays=function(){var e=this.getAttribute("position"),e=e?Array.prototype.slice.call(e.array):[],t=this.getAttribute("uv"),t=t?Array.prototype.slice.call(t.array):[],n=this.index;return{position:e,uv:t,index:n?Array.prototype.slice.call(n.array):[]}},Dn.prototype.addShapeList=function(e,t){var n=e.length;t.arrays=this.getArrays();for(var i=0;i<n;i++){var r=e[i];this.addShape(r,t)}this.setIndex(t.arrays.index),this.addAttribute("position",new ne(t.arrays.position,3)),this.addAttribute("uv",new ne(t.arrays.uv,2))},Dn.prototype.addShape=function(D,e){var t,n,i,r,a,o,s=e.arrays||this.getArrays(),d=s.position,F=s.index,B=s.uv,c=[],k=void 0!==e.amount?e.amount:100,H=void 0!==e.bevelThickness?e.bevelThickness:6,z=void 0!==e.bevelSize?e.bevelSize:H-2,p=void 0!==e.bevelSegments?e.bevelSegments:3,l=void 0===e.bevelEnabled||e.bevelEnabled,s=void 0!==e.curveSegments?e.curveSegments:12,f=void 0!==e.steps?e.steps:1,G=e.extrudePath,V=!1,j=void 0!==e.UVGenerator?e.UVGenerator:Un.WorldUVGenerator,W=(G&&(t=G.getSpacedPoints(f),l=!(V=!0),n=void 0!==e.frames?e.frames:G.computeFrenetFrames(f,!1),i=new Ce,r=new Ce,a=new Ce),l||(z=H=p=0),this),G=D.extractPoints(s),h=G.shape,u=G.holes;if(!Pl.isClockWise(h))for(h=h.reverse(),g=0,v=u.length;g<v;g++)o=u[g],Pl.isClockWise(o)&&(u[g]=o.reverse());for(var X=Pl.triangulateShape(h,u),m=h,g=0,v=u.length;g<v;g++)o=u[g],h=h.concat(o);function y(e,t,n){return t||console.error("THREE.ExtrudeGeometry: vec does not exist"),t.clone().multiplyScalar(n).add(e)}var x,b,w,_,E,T,M=h.length,q=X.length;function Y(e,t,n){var i=e.x-t.x,r=e.y-t.y,a=n.x-e.x,o=n.y-e.y,s=i*i+r*r;if(Math.abs(i*o-r*a)>Number.EPSILON){var c=Math.sqrt(s),l=Math.sqrt(a*a+o*o),h=t.x-r/c,t=t.y+i/c,c=((n.x-o/l-h)*o-(n.y+a/l-t)*a)/(i*o-r*a),n=(l=h+i*c-e.x)*l+(h=t+r*c-e.y)*h;if(n<=2)return new te(l,h);c=Math.sqrt(n/2)}else{t=!1;i>Number.EPSILON?a>Number.EPSILON&&(t=!0):i<-Number.EPSILON?a<-Number.EPSILON&&(t=!0):Math.sign(r)===Math.sign(o)&&(t=!0),c=t?(l=-r,h=i,Math.sqrt(s)):(l=i,h=r,Math.sqrt(s/2))}return new te(l/c,h/c)}for(var Z=[],S=0,A=m.length,R=A-1,C=S+1;S<A;S++,R++,C++)Z[S]=Y(m[S],m[R=R===A?0:R],m[C=C===A?0:C]);var L,P,J=[],K=Z.concat();for(g=0,v=u.length;g<v;g++){for(o=u[g],L=[],S=0,R=(A=o.length)-1,C=S+1;S<A;S++,R++,C++)R===A&&(R=0),C===A&&(C=0),L[S]=Y(o[S],o[R],o[C]);J.push(L),K=K.concat(L)}for(x=0;x<p;x++){for(w=x/p,_=H*Math.cos(w*Math.PI/2),b=z*Math.sin(w*Math.PI/2),S=0,A=m.length;S<A;S++)N((E=y(m[S],Z[S],b)).x,E.y,-_);for(g=0,v=u.length;g<v;g++)for(o=u[g],L=J[g],S=0,A=o.length;S<A;S++)N((E=y(o[S],L[S],b)).x,E.y,-_)}for(b=z,S=0;S<M;S++)E=l?y(h[S],K[S],b):h[S],V?(r.copy(n.normals[0]).multiplyScalar(E.x),i.copy(n.binormals[0]).multiplyScalar(E.y),a.copy(t[0]).add(r).add(i),N(a.x,a.y,a.z)):N(E.x,E.y,0);for(P=1;P<=f;P++)for(S=0;S<M;S++)E=l?y(h[S],K[S],b):h[S],V?(r.copy(n.normals[P]).multiplyScalar(E.x),i.copy(n.binormals[P]).multiplyScalar(E.y),a.copy(t[P]).add(r).add(i),N(a.x,a.y,a.z)):N(E.x,E.y,k/f*P);for(x=p-1;0<=x;x--){for(w=x/p,_=H*Math.cos(w*Math.PI/2),b=z*Math.sin(w*Math.PI/2),S=0,A=m.length;S<A;S++)N((E=y(m[S],Z[S],b)).x,E.y,k+_);for(g=0,v=u.length;g<v;g++)for(o=u[g],L=J[g],S=0,A=o.length;S<A;S++)E=y(o[S],L[S],b),V?N(E.x,E.y+t[f-1].y,t[f-1].x+_):N(E.x,E.y,k+_)}function Q(e,t){var n,i;for(S=e.length;0<=--S;){(i=(n=S)-1)<0&&(i=e.length-1);for(var r=0,a=f+2*p,r=0;r<a;r++){var o=M*r,s=M*(r+1),c=(u=h=l=c=void 0,t+n+o),l=t+i+o,h=t+i+s,u=t+n+s;O(c),O(l),O(u),O(l),O(h),O(u),c=d.length/3,I((l=j.generateSideWallUV(W,d,c-6,c-3,c-2,c-1))[0]),I(l[1]),I(l[3]),I(l[1]),I(l[2]),I(l[3])}}}function N(e,t,n){c.push(e),c.push(t),c.push(n)}function $(e,t,n){O(e),O(t),O(n);e=d.length/3,t=j.generateTopUV(W,d,e-3,e-2,e-1);I(t[0]),I(t[1]),I(t[2])}function O(e){F.push(d.length/3),d.push(c[3*e+0]),d.push(c[3*e+1]),d.push(c[3*e+2])}function I(e){B.push(e.x),B.push(e.y)}D=d.length/3;if(l){var U=0*M;for(S=0;S<q;S++)$((T=X[S])[2]+U,T[1]+U,T[0]+U);for(U=M*(f+2*p),S=0;S<q;S++)$((T=X[S])[0]+U,T[1]+U,T[2]+U)}else{for(S=0;S<q;S++)$((T=X[S])[2],T[1],T[0]);for(S=0;S<q;S++)$((T=X[S])[0]+M*f,T[1]+M*f,T[2]+M*f)}W.addGroup(D,d.length/3-D,void 0!==e.material?e.material:0);var s=d.length/3,ee=0;for(Q(m,ee),ee+=m.length,g=0,v=u.length;g<v;g++)Q(o=u[g],ee),ee+=o.length;W.addGroup(s,d.length/3-s,void 0!==e.extrudeMaterial?e.extrudeMaterial:1),e.arrays||(this.setIndex(F),this.addAttribute("position",new ne(d,3)),this.addAttribute("uv",new ne(B,2)))},Un.WorldUVGenerator={generateTopUV:function(e,t,n,i,r){var a=t[3*n],o=t[3*i],i=t[3*i+1],s=t[3*r],r=t[3*r+1];return[new te(a,t[3*n+1]),new te(o,i),new te(s,r)]},generateSideWallUV:function(e,t,n,i,r,a){var o=t[3*n],s=t[3*n+1],n=t[3*n+2],c=t[3*i],l=t[3*i+1],i=t[3*i+2],h=t[3*r],u=t[3*r+1],r=t[3*r+2],d=t[3*a],p=t[3*a+1],t=t[3*a+2];return Math.abs(s-l)<.01?[new te(o,1-n),new te(c,1-i),new te(h,1-r),new te(d,1-t)]:[new te(s,1-n),new te(l,1-i),new te(u,1-r),new te(p,1-t)]}},(Fn.prototype=Object.create(x.prototype)).constructor=Fn,(Bn.prototype=Object.create(Dn.prototype)).constructor=Bn,(kn.prototype=Object.create(x.prototype)).constructor=kn,(Hn.prototype=Object.create(J.prototype)).constructor=Hn,(zn.prototype=Object.create(x.prototype)).constructor=zn,(Gn.prototype=Object.create(J.prototype)).constructor=Gn,(Vn.prototype=Object.create(x.prototype)).constructor=Vn,(jn.prototype=Object.create(J.prototype)).constructor=jn,((Wn.prototype=Object.create(x.prototype)).constructor=Wn).prototype.toJSON=function(){var e=x.prototype.toJSON.call(this);return qn(this.parameters.shapes,e)},((Xn.prototype=Object.create(J.prototype)).constructor=Xn).prototype.toJSON=function(){var e=J.prototype.toJSON.call(this);return qn(this.parameters.shapes,e)},(Yn.prototype=Object.create(J.prototype)).constructor=Yn,(Zn.prototype=Object.create(x.prototype)).constructor=Zn,(Jn.prototype=Object.create(J.prototype)).constructor=Jn,(Kn.prototype=Object.create(Zn.prototype)).constructor=Kn,(Qn.prototype=Object.create(Jn.prototype)).constructor=Qn,($n.prototype=Object.create(x.prototype)).constructor=$n,(ei.prototype=Object.create(J.prototype)).constructor=ei,Nl=Object.freeze({WireframeGeometry:nn,ParametricGeometry:rn,ParametricBufferGeometry:an,TetrahedronGeometry:cn,TetrahedronBufferGeometry:ln,OctahedronGeometry:hn,OctahedronBufferGeometry:un,IcosahedronGeometry:dn,IcosahedronBufferGeometry:pn,DodecahedronGeometry:fn,DodecahedronBufferGeometry:mn,PolyhedronGeometry:on,PolyhedronBufferGeometry:sn,TubeGeometry:gn,TubeBufferGeometry:vn,TorusKnotGeometry:yn,TorusKnotBufferGeometry:xn,TorusGeometry:bn,TorusBufferGeometry:wn,TextGeometry:Fn,TextBufferGeometry:Bn,SphereGeometry:kn,SphereBufferGeometry:Hn,RingGeometry:zn,RingBufferGeometry:Gn,PlaneGeometry:Ke,PlaneBufferGeometry:Qe,LatheGeometry:Vn,LatheBufferGeometry:jn,ShapeGeometry:Wn,ShapeBufferGeometry:Xn,ExtrudeGeometry:Un,ExtrudeBufferGeometry:Dn,EdgesGeometry:Yn,ConeGeometry:Kn,ConeBufferGeometry:Qn,CylinderGeometry:Zn,CylinderBufferGeometry:Jn,CircleGeometry:$n,CircleBufferGeometry:ei,BoxGeometry:Ze,BoxBufferGeometry:Je}),((ti.prototype=Object.create(t.prototype)).constructor=ti).prototype.isShadowMaterial=!0,((ni.prototype=Object.create(et.prototype)).constructor=ni).prototype.isRawShaderMaterial=!0,((ii.prototype=Object.create(t.prototype)).constructor=ii).prototype.isMeshStandardMaterial=!0,ii.prototype.copy=function(e){return t.prototype.copy.call(this,e),this.defines={STANDARD:""},this.color.copy(e.color),this.roughness=e.roughness,this.metalness=e.metalness,this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.roughnessMap=e.roughnessMap,this.metalnessMap=e.metalnessMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.envMapIntensity=e.envMapIntensity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.skinning=e.skinning,this.morphTargets=e.morphTargets,this.morphNormals=e.morphNormals,this},((ri.prototype=Object.create(ii.prototype)).constructor=ri).prototype.isMeshPhysicalMaterial=!0,ri.prototype.copy=function(e){return ii.prototype.copy.call(this,e),this.defines={PHYSICAL:""},this.reflectivity=e.reflectivity,this.clearCoat=e.clearCoat,this.clearCoatRoughness=e.clearCoatRoughness,this},((ai.prototype=Object.create(t.prototype)).constructor=ai).prototype.isMeshPhongMaterial=!0,ai.prototype.copy=function(e){return t.prototype.copy.call(this,e),this.color.copy(e.color),this.specular.copy(e.specular),this.shininess=e.shininess,this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.combine=e.combine,this.reflectivity=e.reflectivity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.skinning=e.skinning,this.morphTargets=e.morphTargets,this.morphNormals=e.morphNormals,this},((oi.prototype=Object.create(ai.prototype)).constructor=oi).prototype.isMeshToonMaterial=!0,oi.prototype.copy=function(e){return ai.prototype.copy.call(this,e),this.gradientMap=e.gradientMap,this},((si.prototype=Object.create(t.prototype)).constructor=si).prototype.isMeshNormalMaterial=!0,si.prototype.copy=function(e){return t.prototype.copy.call(this,e),this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.skinning=e.skinning,this.morphTargets=e.morphTargets,this.morphNormals=e.morphNormals,this},((ci.prototype=Object.create(t.prototype)).constructor=ci).prototype.isMeshLambertMaterial=!0,ci.prototype.copy=function(e){return t.prototype.copy.call(this,e),this.color.copy(e.color),this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.combine=e.combine,this.reflectivity=e.reflectivity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.skinning=e.skinning,this.morphTargets=e.morphTargets,this.morphNormals=e.morphNormals,this},((li.prototype=Object.create(v.prototype)).constructor=li).prototype.isLineDashedMaterial=!0,li.prototype.copy=function(e){return v.prototype.copy.call(this,e),this.scale=e.scale,this.dashSize=e.dashSize,this.gapSize=e.gapSize,this},Ol=Object.freeze({ShadowMaterial:ti,SpriteMaterial:Vt,RawShaderMaterial:ni,ShaderMaterial:et,PointsMaterial:Jt,MeshPhysicalMaterial:ri,MeshStandardMaterial:ii,MeshPhongMaterial:ai,MeshToonMaterial:oi,MeshNormalMaterial:si,MeshLambertMaterial:ci,MeshDepthMaterial:ge,MeshDistanceMaterial:ve,MeshBasicMaterial:$e,LineDashedMaterial:li,LineBasicMaterial:v,Material:t}),Il={enabled:!1,files:{},add:function(e,t){!1!==this.enabled&&(this.files[e]=t)},get:function(e){if(!1!==this.enabled)return this.files[e]},remove:function(e){delete this.files[e]},clear:function(){this.files={}}},a=new hi,Ul={},Object.assign(ui.prototype,{load:function(o,e,t,n){void 0===o&&(o=""),void 0!==this.path&&(o=this.path+o),o=this.manager.resolveURL(o);var s=this,i=Il.get(o);if(void 0!==i)return s.manager.itemStart(o),setTimeout(function(){e&&e(i),s.manager.itemEnd(o)},0),i;if(void 0===Ul[o]){var r=o.match(/^data:(.*?)(;base64)?,(.*)$/);if(r){var a=r[1],c=!!r[2],l=r[3],l=window.decodeURIComponent(l);c&&(l=window.atob(l));try{var h=(this.responseType||"").toLowerCase();switch(h){case"arraybuffer":case"blob":for(var u=new Uint8Array(l.length),d=0;d<l.length;d++)u[d]=l.charCodeAt(d);p="blob"===h?new Blob([u.buffer],{type:a}):u.buffer;break;case"document":var p=(new DOMParser).parseFromString(l,a);break;case"json":p=JSON.parse(l);break;default:p=l}window.setTimeout(function(){e&&e(p),s.manager.itemEnd(o)},0)}catch(e){window.setTimeout(function(){n&&n(e),s.manager.itemEnd(o),s.manager.itemError(o)},0)}}else{Ul[o]=[],Ul[o].push({onLoad:e,onProgress:t,onError:n});var f,m=new XMLHttpRequest;for(f in m.open("GET",o,!0),m.addEventListener("load",function(e){var t=this.response,n=(Il.add(o,t),Ul[o]);if(delete Ul[o],200===this.status){for(var i=0,r=n.length;i<r;i++)(a=n[i]).onLoad&&a.onLoad(t);s.manager.itemEnd(o)}else if(0===this.status){console.warn("THREE.FileLoader: HTTP Status 0 received.");for(i=0,r=n.length;i<r;i++)(a=n[i]).onLoad&&a.onLoad(t);s.manager.itemEnd(o)}else{for(var a,i=0,r=n.length;i<r;i++)(a=n[i]).onError&&a.onError(e);s.manager.itemEnd(o),s.manager.itemError(o)}},!1),m.addEventListener("progress",function(e){for(var t=Ul[o],n=0,i=t.length;n<i;n++){var r=t[n];r.onProgress&&r.onProgress(e)}},!1),m.addEventListener("error",function(e){var t=Ul[o];delete Ul[o];for(var n=0,i=t.length;n<i;n++){var r=t[n];r.onError&&r.onError(e)}s.manager.itemEnd(o),s.manager.itemError(o)},!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(f,this.requestHeader[f]);m.send(null)}return s.manager.itemStart(o),m}Ul[o].push({onLoad:e,onProgress:t,onError:n})},setPath:function(e){return this.path=e,this},setResponseType:function(e){return this.responseType=e,this},setWithCredentials:function(e){return this.withCredentials=e,this},setMimeType:function(e){return this.mimeType=e,this},setRequestHeader:function(e){return this.requestHeader=e,this}}),Object.assign(di.prototype,{load:function(e,a,n,i){var o=this,s=[],c=new en,r=(c.image=s,new ui(this.manager));if(r.setPath(this.path),r.setResponseType("arraybuffer"),Array.isArray(e))for(var l=0,t=0,h=e.length;t<h;++t)(t=>{r.load(e[t],function(e){e=o._parser(e,!0);s[t]={width:e.width,height:e.height,format:e.format,mipmaps:e.mipmaps},6===(l+=1)&&(1===e.mipmapCount&&(c.minFilter=C),c.format=e.format,c.needsUpdate=!0,a)&&a(c)},n,i)})(t);else r.load(e,function(e){var t=o._parser(e,!0);if(t.isCubemap)for(var n=t.mipmaps.length/t.mipmapCount,i=0;i<n;i++){s[i]={mipmaps:[]};for(var r=0;r<t.mipmapCount;r++)s[i].mipmaps.push(t.mipmaps[i*t.mipmapCount+r]),s[i].format=t.format,s[i].width=t.width,s[i].height=t.height}else c.image.width=t.width,c.image.height=t.height,c.mipmaps=t.mipmaps;1===t.mipmapCount&&(c.minFilter=C),c.format=t.format,c.needsUpdate=!0,a&&a(c)},n,i);return c},setPath:function(e){return this.path=e,this}}),Object.assign(pi.prototype,{load:function(e,t,n,i){var r=this,a=new Oe,o=new ui(this.manager);return o.setResponseType("arraybuffer"),o.load(e,function(e){e=r._parser(e);e&&(void 0!==e.image?a.image=e.image:void 0!==e.data&&(a.image.width=e.width,a.image.height=e.height,a.image.data=e.data),a.wrapS=void 0!==e.wrapS?e.wrapS:A,a.wrapT=void 0!==e.wrapT?e.wrapT:A,a.magFilter=void 0!==e.magFilter?e.magFilter:C,a.minFilter=void 0!==e.minFilter?e.minFilter:Eo,a.anisotropy=void 0!==e.anisotropy?e.anisotropy:1,void 0!==e.format&&(a.format=e.format),void 0!==e.type&&(a.type=e.type),void 0!==e.mipmaps&&(a.mipmaps=e.mipmaps),1===e.mipmapCount&&(a.minFilter=C),a.needsUpdate=!0,t)&&t(a,e)},n,i),a}}),Object.assign(fi.prototype,{crossOrigin:"Anonymous",load:function(t,e,n,i){void 0===t&&(t=""),void 0!==this.path&&(t=this.path+t),t=this.manager.resolveURL(t);var r,a=this,o=Il.get(t);return void 0!==o?(a.manager.itemStart(t),setTimeout(function(){e&&e(o),a.manager.itemEnd(t)},0),o):((r=document.createElementNS("http://www.w3.org/1999/xhtml","img")).addEventListener("load",function(){Il.add(t,this),e&&e(this),a.manager.itemEnd(t)},!1),r.addEventListener("error",function(e){i&&i(e),a.manager.itemEnd(t),a.manager.itemError(t)},!1),"data:"!==t.substr(0,5)&&void 0!==this.crossOrigin&&(r.crossOrigin=this.crossOrigin),a.manager.itemStart(t),r.src=t,r)},setCrossOrigin:function(e){return this.crossOrigin=e,this},setPath:function(e){return this.path=e,this}}),Object.assign(mi.prototype,{crossOrigin:"Anonymous",load:function(e,n,t,i){var r=new O,a=new fi(this.manager),o=(a.setCrossOrigin(this.crossOrigin),a.setPath(this.path),0);for(var s=0;s<e.length;++s)(t=>{a.load(e[t],function(e){r.images[t]=e,6==++o&&(r.needsUpdate=!0,n)&&n(r)},void 0,i)})(s);return r},setCrossOrigin:function(e){return this.crossOrigin=e,this},setPath:function(e){return this.path=e,this}}),Object.assign(gi.prototype,{crossOrigin:"Anonymous",load:function(t,n,e,i){var r=new d,a=new fi(this.manager);return a.setCrossOrigin(this.crossOrigin),a.setPath(this.path),a.load(t,function(e){r.image=e;e=0<t.search(/\.(jpg|jpeg)$/)||0===t.search(/^data\:image\/jpeg/);r.format=e?Fo:Bo,r.needsUpdate=!0,void 0!==n&&n(r)},e,i),r},setCrossOrigin:function(e){return this.crossOrigin=e,this},setPath:function(e){return this.path=e,this}}),Object.assign(c.prototype,{getPoint:function(){return console.warn("THREE.Curve: .getPoint() not implemented."),null},getPointAt:function(e,t){e=this.getUtoTmapping(e);return this.getPoint(e,t)},getPoints:function(e){void 0===e&&(e=5);for(var t=[],n=0;n<=e;n++)t.push(this.getPoint(n/e));return t},getSpacedPoints:function(e){void 0===e&&(e=5);for(var t=[],n=0;n<=e;n++)t.push(this.getPointAt(n/e));return t},getLength:function(){var e=this.getLengths();return e[e.length-1]},getLengths:function(e){if(void 0===e&&(e=this.arcLengthDivisions),this.cacheArcLengths&&this.cacheArcLengths.length===e+1&&!this.needsUpdate)return this.cacheArcLengths;this.needsUpdate=!1;var t,n,i=[],r=this.getPoint(0),a=0;for(i.push(0),n=1;n<=e;n++)a+=(t=this.getPoint(n/e)).distanceTo(r),i.push(a),r=t;return this.cacheArcLengths=i},updateArcLengths:function(){this.needsUpdate=!0,this.getLengths()},getUtoTmapping:function(e,t){for(var n,i=this.getLengths(),r=0,a=i.length,o=t||e*i[a-1],s=0,c=a-1;s<=c;)if((n=i[r=Math.floor(s+(c-s)/2)]-o)<0)s=r+1;else{if(!(0<n)){c=r;break}c=r-1}return i[r=c]===o?r/(a-1):(r+(o-(t=i[r]))/(i[r+1]-t))/(a-1)},getTangent:function(e){var t=e-1e-4,e=e+1e-4,t=(1<e&&(e=1),this.getPoint(t=t<0?0:t));return this.getPoint(e).clone().sub(t).normalize()},getTangentAt:function(e){e=this.getUtoTmapping(e);return this.getTangent(e)},computeFrenetFrames:function(e,t){for(var n,i=new Ce,r=[],a=[],o=[],s=new Ce,c=new Re,l=0;l<=e;l++)r[l]=this.getTangentAt(l/e),r[l].normalize();a[0]=new Ce,o[0]=new Ce;var h=Number.MAX_VALUE,u=Math.abs(r[0].x),d=Math.abs(r[0].y),p=Math.abs(r[0].z);for(u<=h&&(h=u,i.set(1,0,0)),d<=h&&(h=d,i.set(0,1,0)),p<=h&&i.set(0,0,1),s.crossVectors(r[0],i).normalize(),a[0].crossVectors(r[0],s),o[0].crossVectors(r[0],a[0]),l=1;l<=e;l++)a[l]=a[l-1].clone(),o[l]=o[l-1].clone(),s.crossVectors(r[l-1],r[l]),s.length()>Number.EPSILON&&(s.normalize(),n=Math.acos(Pe.clamp(r[l-1].dot(r[l]),-1,1)),a[l].applyMatrix4(c.makeRotationAxis(s,n))),o[l].crossVectors(r[l],a[l]);if(!0===t)for(n=Math.acos(Pe.clamp(a[0].dot(a[e]),-1,1)),n/=e,0<r[0].dot(s.crossVectors(a[0],a[e]))&&(n=-n),l=1;l<=e;l++)a[l].applyMatrix4(c.makeRotationAxis(r[l],n*l)),o[l].crossVectors(r[l],a[l]);return{tangents:r,normals:a,binormals:o}},clone:function(){return(new this.constructor).copy(this)},copy:function(e){return this.arcLengthDivisions=e.arcLengthDivisions,this},toJSON:function(){var e={metadata:{version:4.5,type:"Curve",generator:"Curve.toJSON"}};return e.arcLengthDivisions=this.arcLengthDivisions,e.type=this.type,e},fromJSON:function(e){return this.arcLengthDivisions=e.arcLengthDivisions,this}}),((vi.prototype=Object.create(c.prototype)).constructor=vi).prototype.isEllipseCurve=!0,vi.prototype.getPoint=function(e,t){for(var t=t||new te,n=2*Math.PI,i=this.aEndAngle-this.aStartAngle,r=Math.abs(i)<Number.EPSILON;i<0;)i+=n;for(;n<i;)i-=n;i<Number.EPSILON&&(i=r?0:n),!0!==this.aClockwise||r||(i===n?i=-n:i-=n);var a,o,s,c,r=this.aStartAngle+e*i,e=this.aX+this.xRadius*Math.cos(r),r=this.aY+this.yRadius*Math.sin(r);return 0!==this.aRotation&&(a=Math.cos(this.aRotation),o=Math.sin(this.aRotation),e=(s=e-this.aX)*a-(c=r-this.aY)*o+this.aX,r=s*o+c*a+this.aY),t.set(e,r)},vi.prototype.copy=function(e){return c.prototype.copy.call(this,e),this.aX=e.aX,this.aY=e.aY,this.xRadius=e.xRadius,this.yRadius=e.yRadius,this.aStartAngle=e.aStartAngle,this.aEndAngle=e.aEndAngle,this.aClockwise=e.aClockwise,this.aRotation=e.aRotation,this},vi.prototype.toJSON=function(){var e=c.prototype.toJSON.call(this);return e.aX=this.aX,e.aY=this.aY,e.xRadius=this.xRadius,e.yRadius=this.yRadius,e.aStartAngle=this.aStartAngle,e.aEndAngle=this.aEndAngle,e.aClockwise=this.aClockwise,e.aRotation=this.aRotation,e},vi.prototype.fromJSON=function(e){return c.prototype.fromJSON.call(this,e),this.aX=e.aX,this.aY=e.aY,this.xRadius=e.xRadius,this.yRadius=e.yRadius,this.aStartAngle=e.aStartAngle,this.aEndAngle=e.aEndAngle,this.aClockwise=e.aClockwise,this.aRotation=e.aRotation,this},((yi.prototype=Object.create(vi.prototype)).constructor=yi).prototype.isArcCurve=!0,Dl=new Ce,Fl=new xi,Bl=new xi,kl=new xi,((n.prototype=Object.create(c.prototype)).constructor=n).prototype.isCatmullRomCurve3=!0,n.prototype.getPoint=function(e,t){var n,i,r,a,t=t||new Ce,o=this.points,s=o.length,e=(s-(this.closed?0:1))*e,c=Math.floor(e),e=e-c;return this.closed?c+=0<c?0:(Math.floor(Math.abs(c)/o.length)+1)*o.length:0===e&&c===s-1&&(c=s-2,e=1),n=this.closed||0<c?o[(c-1)%s]:(Dl.subVectors(o[0],o[1]).add(o[0]),Dl),i=o[c%s],r=o[(c+1)%s],c=this.closed||c+2<s?o[(c+2)%s]:(Dl.subVectors(o[s-1],o[s-2]).add(o[s-1]),Dl),"centripetal"===this.curveType||"chordal"===this.curveType?(o="chordal"===this.curveType?.5:.25,s=Math.pow(n.distanceToSquared(i),o),(a=Math.pow(i.distanceToSquared(r),o))<1e-4&&(a=1),s<1e-4&&(s=a),(o=Math.pow(r.distanceToSquared(c),o))<1e-4&&(o=a),Fl.initNonuniformCatmullRom(n.x,i.x,r.x,c.x,s,a,o),Bl.initNonuniformCatmullRom(n.y,i.y,r.y,c.y,s,a,o),kl.initNonuniformCatmullRom(n.z,i.z,r.z,c.z,s,a,o)):"catmullrom"===this.curveType&&(Fl.initCatmullRom(n.x,i.x,r.x,c.x,this.tension),Bl.initCatmullRom(n.y,i.y,r.y,c.y,this.tension),kl.initCatmullRom(n.z,i.z,r.z,c.z,this.tension)),t.set(Fl.calc(e),Bl.calc(e),kl.calc(e)),t},n.prototype.copy=function(e){c.prototype.copy.call(this,e),this.points=[];for(var t=0,n=e.points.length;t<n;t++){var i=e.points[t];this.points.push(i.clone())}return this.closed=e.closed,this.curveType=e.curveType,this.tension=e.tension,this},n.prototype.toJSON=function(){var e=c.prototype.toJSON.call(this);e.points=[];for(var t=0,n=this.points.length;t<n;t++){var i=this.points[t];e.points.push(i.toArray())}return e.closed=this.closed,e.curveType=this.curveType,e.tension=this.tension,e},n.prototype.fromJSON=function(e){c.prototype.fromJSON.call(this,e),this.points=[];for(var t=0,n=e.points.length;t<n;t++){var i=e.points[t];this.points.push((new Ce).fromArray(i))}return this.closed=e.closed,this.curveType=e.curveType,this.tension=e.tension,this},((Ei.prototype=Object.create(c.prototype)).constructor=Ei).prototype.isCubicBezierCurve=!0,Ei.prototype.getPoint=function(e,t){var t=t||new te,n=this.v0,i=this.v1,r=this.v2,a=this.v3;return t.set(_i(e,n.x,i.x,r.x,a.x),_i(e,n.y,i.y,r.y,a.y)),t},Ei.prototype.copy=function(e){return c.prototype.copy.call(this,e),this.v0.copy(e.v0),this.v1.copy(e.v1),this.v2.copy(e.v2),this.v3.copy(e.v3),this},Ei.prototype.toJSON=function(){var e=c.prototype.toJSON.call(this);return e.v0=this.v0.toArray(),e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e.v3=this.v3.toArray(),e},Ei.prototype.fromJSON=function(e){return c.prototype.fromJSON.call(this,e),this.v0.fromArray(e.v0),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this.v3.fromArray(e.v3),this},((Ti.prototype=Object.create(c.prototype)).constructor=Ti).prototype.isCubicBezierCurve3=!0,Ti.prototype.getPoint=function(e,t){var t=t||new Ce,n=this.v0,i=this.v1,r=this.v2,a=this.v3;return t.set(_i(e,n.x,i.x,r.x,a.x),_i(e,n.y,i.y,r.y,a.y),_i(e,n.z,i.z,r.z,a.z)),t},Ti.prototype.copy=function(e){return c.prototype.copy.call(this,e),this.v0.copy(e.v0),this.v1.copy(e.v1),this.v2.copy(e.v2),this.v3.copy(e.v3),this},Ti.prototype.toJSON=function(){var e=c.prototype.toJSON.call(this);return e.v0=this.v0.toArray(),e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e.v3=this.v3.toArray(),e},Ti.prototype.fromJSON=function(e){return c.prototype.fromJSON.call(this,e),this.v0.fromArray(e.v0),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this.v3.fromArray(e.v3),this},((Mi.prototype=Object.create(c.prototype)).constructor=Mi).prototype.isLineCurve=!0,Mi.prototype.getPoint=function(e,t){t=t||new te;return 1===e?t.copy(this.v2):(t.copy(this.v2).sub(this.v1),t.multiplyScalar(e).add(this.v1)),t},Mi.prototype.getPointAt=function(e,t){return this.getPoint(e,t)},Mi.prototype.getTangent=function(){return this.v2.clone().sub(this.v1).normalize()},Mi.prototype.copy=function(e){return c.prototype.copy.call(this,e),this.v1.copy(e.v1),this.v2.copy(e.v2),this},Mi.prototype.toJSON=function(){var e=c.prototype.toJSON.call(this);return e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e},Mi.prototype.fromJSON=function(e){return c.prototype.fromJSON.call(this,e),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this},((Si.prototype=Object.create(c.prototype)).constructor=Si).prototype.isLineCurve3=!0,Si.prototype.getPoint=function(e,t){t=t||new Ce;return 1===e?t.copy(this.v2):(t.copy(this.v2).sub(this.v1),t.multiplyScalar(e).add(this.v1)),t},Si.prototype.getPointAt=function(e,t){return this.getPoint(e,t)},Si.prototype.copy=function(e){return c.prototype.copy.call(this,e),this.v1.copy(e.v1),this.v2.copy(e.v2),this},Si.prototype.toJSON=function(){var e=c.prototype.toJSON.call(this);return e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e},Si.prototype.fromJSON=function(e){return c.prototype.fromJSON.call(this,e),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this},((Ai.prototype=Object.create(c.prototype)).constructor=Ai).prototype.isQuadraticBezierCurve=!0,Ai.prototype.getPoint=function(e,t){var t=t||new te,n=this.v0,i=this.v1,r=this.v2;return t.set(wi(e,n.x,i.x,r.x),wi(e,n.y,i.y,r.y)),t},Ai.prototype.copy=function(e){return c.prototype.copy.call(this,e),this.v0.copy(e.v0),this.v1.copy(e.v1),this.v2.copy(e.v2),this},Ai.prototype.toJSON=function(){var e=c.prototype.toJSON.call(this);return e.v0=this.v0.toArray(),e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e},Ai.prototype.fromJSON=function(e){return c.prototype.fromJSON.call(this,e),this.v0.fromArray(e.v0),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this},((Ri.prototype=Object.create(c.prototype)).constructor=Ri).prototype.isQuadraticBezierCurve3=!0,Ri.prototype.getPoint=function(e,t){var t=t||new Ce,n=this.v0,i=this.v1,r=this.v2;return t.set(wi(e,n.x,i.x,r.x),wi(e,n.y,i.y,r.y),wi(e,n.z,i.z,r.z)),t},Ri.prototype.copy=function(e){return c.prototype.copy.call(this,e),this.v0.copy(e.v0),this.v1.copy(e.v1),this.v2.copy(e.v2),this},Ri.prototype.toJSON=function(){var e=c.prototype.toJSON.call(this);return e.v0=this.v0.toArray(),e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e},Ri.prototype.fromJSON=function(e){return c.prototype.fromJSON.call(this,e),this.v0.fromArray(e.v0),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this},((Ci.prototype=Object.create(c.prototype)).constructor=Ci).prototype.isSplineCurve=!0,Ci.prototype.getPoint=function(e,t){var t=t||new te,n=this.points,e=(n.length-1)*e,i=Math.floor(e),e=e-i,r=n[0===i?i:i-1],a=n[i],o=n[i>n.length-2?n.length-1:i+1],n=n[i>n.length-3?n.length-1:i+2];return t.set(bi(e,r.x,a.x,o.x,n.x),bi(e,r.y,a.y,o.y,n.y)),t},Ci.prototype.copy=function(e){c.prototype.copy.call(this,e),this.points=[];for(var t=0,n=e.points.length;t<n;t++){var i=e.points[t];this.points.push(i.clone())}return this},Ci.prototype.toJSON=function(){var e=c.prototype.toJSON.call(this);e.points=[];for(var t=0,n=this.points.length;t<n;t++){var i=this.points[t];e.points.push(i.toArray())}return e},Ci.prototype.fromJSON=function(e){c.prototype.fromJSON.call(this,e),this.points=[];for(var t=0,n=e.points.length;t<n;t++){var i=e.points[t];this.points.push((new te).fromArray(i))}return this},Hl=Object.freeze({ArcCurve:yi,CatmullRomCurve3:n,CubicBezierCurve:Ei,CubicBezierCurve3:Ti,EllipseCurve:vi,LineCurve:Mi,LineCurve3:Si,QuadraticBezierCurve:Ai,QuadraticBezierCurve3:Ri,SplineCurve:Ci}),Li.prototype=Object.assign(Object.create(c.prototype),{constructor:Li,add:function(e){this.curves.push(e)},closePath:function(){var e=this.curves[0].getPoint(0),t=this.curves[this.curves.length-1].getPoint(1);e.equals(t)||this.curves.push(new Mi(t,e))},getPoint:function(e){for(var t,n,i,r=e*this.getLength(),a=this.getCurveLengths(),o=0;o<a.length;){if(a[o]>=r)return t=a[o]-r,i=(n=this.curves[o]).getLength(),n.getPointAt(0===i?0:1-t/i);o++}return null},getLength:function(){var e=this.getCurveLengths();return e[e.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 e=[],t=0,n=0,i=this.curves.length;n<i;n++)t+=this.curves[n].getLength(),e.push(t);return this.cacheLengths=e},getSpacedPoints:function(e){void 0===e&&(e=40);for(var t=[],n=0;n<=e;n++)t.push(this.getPoint(n/e));return this.autoClose&&t.push(t[0]),t},getPoints:function(e){e=e||12;for(var t,n=[],i=0,r=this.curves;i<r.length;i++)for(var a=r[i],o=a&&a.isEllipseCurve?2*e:a&&a.isLineCurve?1:a&&a.isSplineCurve?e*a.points.length:e,s=a.getPoints(o),c=0;c<s.length;c++){var l=s[c];t&&t.equals(l)||(n.push(l),t=l)}return this.autoClose&&1<n.length&&!n[n.length-1].equals(n[0])&&n.push(n[0]),n},copy:function(e){c.prototype.copy.call(this,e),this.curves=[];for(var t=0,n=e.curves.length;t<n;t++){var i=e.curves[t];this.curves.push(i.clone())}return this.autoClose=e.autoClose,this},toJSON:function(){var e=c.prototype.toJSON.call(this);e.autoClose=this.autoClose,e.curves=[];for(var t=0,n=this.curves.length;t<n;t++){var i=this.curves[t];e.curves.push(i.toJSON())}return e},fromJSON:function(e){c.prototype.fromJSON.call(this,e),this.autoClose=e.autoClose,this.curves=[];for(var t=0,n=e.curves.length;t<n;t++){var i=e.curves[t];this.curves.push((new Hl[i.type]).fromJSON(i))}return this}}),Pi.prototype=Object.assign(Object.create(Li.prototype),{constructor:Pi,setFromPoints:function(e){this.moveTo(e[0].x,e[0].y);for(var t=1,n=e.length;t<n;t++)this.lineTo(e[t].x,e[t].y)},moveTo:function(e,t){this.currentPoint.set(e,t)},lineTo:function(e,t){var n=new Mi(this.currentPoint.clone(),new te(e,t));this.curves.push(n),this.currentPoint.set(e,t)},quadraticCurveTo:function(e,t,n,i){e=new Ai(this.currentPoint.clone(),new te(e,t),new te(n,i));this.curves.push(e),this.currentPoint.set(n,i)},bezierCurveTo:function(e,t,n,i,r,a){e=new Ei(this.currentPoint.clone(),new te(e,t),new te(n,i),new te(r,a));this.curves.push(e),this.currentPoint.set(r,a)},splineThru:function(e){var t=new Ci([this.currentPoint.clone()].concat(e));this.curves.push(t),this.currentPoint.copy(e[e.length-1])},arc:function(e,t,n,i,r,a){var o=this.currentPoint.x,s=this.currentPoint.y;this.absarc(e+o,t+s,n,i,r,a)},absarc:function(e,t,n,i,r,a){this.absellipse(e,t,n,n,i,r,a)},ellipse:function(e,t,n,i,r,a,o,s){var c=this.currentPoint.x,l=this.currentPoint.y;this.absellipse(e+c,t+l,n,i,r,a,o,s)},absellipse:function(e,t,n,i,r,a,o,s){e=new vi(e,t,n,i,r,a,o,s),0<this.curves.length&&((t=e.getPoint(0)).equals(this.currentPoint)||this.lineTo(t.x,t.y)),this.curves.push(e),n=e.getPoint(1);this.currentPoint.copy(n)},copy:function(e){return Li.prototype.copy.call(this,e),this.currentPoint.copy(e.currentPoint),this},toJSON:function(){var e=Li.prototype.toJSON.call(this);return e.currentPoint=this.currentPoint.toArray(),e},fromJSON:function(e){return Li.prototype.fromJSON.call(this,e),this.currentPoint.fromArray(e.currentPoint),this}}),Ni.prototype=Object.assign(Object.create(Pi.prototype),{constructor:Ni,getPointsHoles:function(e){for(var t=[],n=0,i=this.holes.length;n<i;n++)t[n]=this.holes[n].getPoints(e);return t},extractPoints:function(e){return{shape:this.getPoints(e),holes:this.getPointsHoles(e)}},copy:function(e){Pi.prototype.copy.call(this,e),this.holes=[];for(var t=0,n=e.holes.length;t<n;t++){var i=e.holes[t];this.holes.push(i.clone())}return this},toJSON:function(){var e=Pi.prototype.toJSON.call(this);e.uuid=this.uuid,e.holes=[];for(var t=0,n=this.holes.length;t<n;t++){var i=this.holes[t];e.holes.push(i.toJSON())}return e},fromJSON:function(e){Pi.prototype.fromJSON.call(this,e),this.uuid=e.uuid,this.holes=[];for(var t=0,n=e.holes.length;t<n;t++){var i=e.holes[t];this.holes.push((new Pi).fromJSON(i))}return this}}),o.prototype=Object.assign(Object.create(f.prototype),{constructor:o,isLight:!0,copy:function(e){return f.prototype.copy.call(this,e),this.color.copy(e.color),this.intensity=e.intensity,this},toJSON:function(e){e=f.prototype.toJSON.call(this,e);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}}),Oi.prototype=Object.assign(Object.create(o.prototype),{constructor:Oi,isHemisphereLight:!0,copy:function(e){return o.prototype.copy.call(this,e),this.groundColor.copy(e.groundColor),this}}),Object.assign(Ii.prototype,{copy:function(e){return this.camera=e.camera.clone(),this.bias=e.bias,this.radius=e.radius,this.mapSize.copy(e.mapSize),this},clone:function(){return(new this.constructor).copy(this)},toJSON:function(){var e={};return 0!==this.bias&&(e.bias=this.bias),1!==this.radius&&(e.radius=this.radius),512===this.mapSize.x&&512===this.mapSize.y||(e.mapSize=this.mapSize.toArray()),e.camera=this.camera.toJSON(!1).object,delete e.camera.matrix,e}}),Ui.prototype=Object.assign(Object.create(Ii.prototype),{constructor:Ui,isSpotLightShadow:!0,update:function(e){var t=this.camera,n=2*Pe.RAD2DEG*e.angle,i=this.mapSize.width/this.mapSize.height,e=e.distance||t.far;n===t.fov&&i===t.aspect&&e===t.far||(t.fov=n,t.aspect=i,t.far=e,t.updateProjectionMatrix())}}),Di.prototype=Object.assign(Object.create(o.prototype),{constructor:Di,isSpotLight:!0,copy:function(e){return o.prototype.copy.call(this,e),this.distance=e.distance,this.angle=e.angle,this.penumbra=e.penumbra,this.decay=e.decay,this.target=e.target.clone(),this.shadow=e.shadow.clone(),this}}),Fi.prototype=Object.assign(Object.create(o.prototype),{constructor:Fi,isPointLight:!0,copy:function(e){return o.prototype.copy.call(this,e),this.distance=e.distance,this.decay=e.decay,this.shadow=e.shadow.clone(),this}}),Bi.prototype=Object.assign(Object.create(Ii.prototype),{constructor:Bi}),ki.prototype=Object.assign(Object.create(o.prototype),{constructor:ki,isDirectionalLight:!0,copy:function(e){return o.prototype.copy.call(this,e),this.target=e.target.clone(),this.shadow=e.shadow.clone(),this}}),Hi.prototype=Object.assign(Object.create(o.prototype),{constructor:Hi,isAmbientLight:!0}),zi.prototype=Object.assign(Object.create(o.prototype),{constructor:zi,isRectAreaLight:!0,copy:function(e){return o.prototype.copy.call(this,e),this.width=e.width,this.height=e.height,this},toJSON:function(e){e=o.prototype.toJSON.call(this,e);return e.object.width=this.width,e.object.height=this.height,e}}),Gi.prototype=Object.assign(Object.create(s.prototype),{constructor:Gi,ValueTypeName:"string",ValueBufferType:Array,DefaultInterpolation:2300,InterpolantFactoryMethodLinear:void 0,InterpolantFactoryMethodSmooth:void 0}),Vi.prototype=Object.assign(Object.create(s.prototype),{constructor:Vi,ValueTypeName:"bool",ValueBufferType:Array,DefaultInterpolation:2300,InterpolantFactoryMethodLinear:void 0,InterpolantFactoryMethodSmooth:void 0}),Object.assign(ji.prototype,{evaluate:function(e){var t,n=this.parameterPositions,i=this._cachedIndex,r=n[i],a=n[i-1];e:{t:{n:{i:if(!(e<r)){for(var o=i+2;;){if(void 0===r){if(e<a)break i;return i=n.length,this._cachedIndex=i,this.afterEnd_(i-1,e,a)}if(i===o)break;if(a=r,e<(r=n[++i]))break t}t=n.length;break n}if(a<=e)break e;var s=n[1];e<s&&(i=2,a=s);for(o=i-2;;){if(void 0===a)return this._cachedIndex=0,this.beforeStart_(0,e,r);if(i===o)break;if(r=a,(a=n[--i-1])<=e)break t}t=i,i=0}for(;i<t;){var c=i+t>>>1;e<n[c]?t=c:i=1+c}if(r=n[i],void 0===(a=n[i-1]))return this._cachedIndex=0,this.beforeStart_(0,e,r);if(void 0===r)return i=n.length,this._cachedIndex=i,this.afterEnd_(i-1,a,e)}this._cachedIndex=i,this.intervalChanged_(i,a,r)}return this.interpolate_(i,a,e,r)},settings:null,DefaultSettings_:{},getSettings_:function(){return this.settings||this.DefaultSettings_},copySampleValue_:function(e){for(var t=this.resultBuffer,n=this.sampleValues,i=this.valueSize,r=e*i,a=0;a!==i;++a)t[a]=n[r+a];return t},interpolate_:function(){throw new Error("call to abstract method")},intervalChanged_:function(){}}),//!\ DECLARE ALIAS AFTER assign prototype !
Object.assign(ji.prototype,{beforeStart_:ji.prototype.copySampleValue_,afterEnd_:ji.prototype.copySampleValue_}),Wi.prototype=Object.assign(Object.create(ji.prototype),{constructor:Wi,interpolate_:function(e,t,n,i){for(var r=this.resultBuffer,a=this.sampleValues,o=this.valueSize,s=e*o,c=(n-t)/(i-t),l=s+o;s!==l;s+=4)h.slerpFlat(r,0,a,s-o,a,s,c);return r}}),Xi.prototype=Object.assign(Object.create(s.prototype),{constructor:Xi,ValueTypeName:"quaternion",DefaultInterpolation:2301,InterpolantFactoryMethodLinear:function(e){return new Wi(this.times,this.values,this.getValueSize(),e)},InterpolantFactoryMethodSmooth:void 0}),qi.prototype=Object.assign(Object.create(s.prototype),{constructor:qi,ValueTypeName:"color"}),Yi.prototype=Object.assign(Object.create(s.prototype),{constructor:Yi,ValueTypeName:"number"}),Zi.prototype=Object.assign(Object.create(ji.prototype),{constructor:Zi,DefaultSettings_:{endingStart:$o,endingEnd:$o},intervalChanged_:function(e,t,n){var i=this.parameterPositions,r=e-2,a=e+1,o=i[r],s=i[a];if(void 0===o)switch(this.getSettings_().endingStart){case 2401:r=e,o=2*t-n;break;case 2402:o=t+i[r=i.length-2]-i[r+1];break;default:r=e,o=n}if(void 0===s)switch(this.getSettings_().endingEnd){case 2401:a=e,s=2*n-t;break;case 2402:s=n+i[a=1]-i[0];break;default:a=e-1,s=t}var c=.5*(n-t),l=this.valueSize;this._weightPrev=c/(t-o),this._weightNext=c/(s-n),this._offsetPrev=r*l,this._offsetNext=a*l},interpolate_:function(e,t,n,i){for(var r=this.resultBuffer,a=this.sampleValues,o=this.valueSize,s=e*o,c=s-o,l=this._offsetPrev,h=this._offsetNext,e=this._weightPrev,u=this._weightNext,n=(n-t)/(i-t),i=n*n,t=i*n,d=-e*t+2*e*i-e*n,p=(1+e)*t+(-1.5-2*e)*i+(-.5+e)*n+1,f=(-1-u)*t+(1.5+u)*i+.5*n,m=u*t-u*i,g=0;g!==o;++g)r[g]=d*a[l+g]+p*a[c+g]+f*a[s+g]+m*a[h+g];return r}}),Ji.prototype=Object.assign(Object.create(ji.prototype),{constructor:Ji,interpolate_:function(e,t,n,i){for(var r=this.resultBuffer,a=this.sampleValues,o=this.valueSize,s=e*o,c=s-o,l=(n-t)/(i-t),h=1-l,u=0;u!==o;++u)r[u]=a[c+u]*h+a[s+u]*l;return r}}),Ki.prototype=Object.assign(Object.create(ji.prototype),{constructor:Ki,interpolate_:function(e){return this.copySampleValue_(e-1)}}),T={arraySlice:function(e,t,n){return T.isTypedArray(e)?new e.constructor(e.subarray(t,void 0!==n?n:e.length)):e.slice(t,n)},convertArray:function(e,t,n){return!e||!n&&e.constructor===t?e:"number"==typeof t.BYTES_PER_ELEMENT?new t(e):Array.prototype.slice.call(e)},isTypedArray:function(e){return ArrayBuffer.isView(e)&&!(e instanceof DataView)},getKeyframeOrder:function(n){for(var e=n.length,t=new Array(e),i=0;i!==e;++i)t[i]=i;return t.sort(function(e,t){return n[e]-n[t]}),t},sortedArray:function(e,t,n){for(var i=e.length,r=new e.constructor(i),a=0,o=0;o!==i;++a)for(var s=n[a]*t,c=0;c!==t;++c)r[o++]=e[s+c];return r},flattenJSON:function(e,t,n,i){for(var r=1,a=e[0];void 0!==a&&void 0===a[i];)a=e[r++];if(void 0!==a){var o=a[i];if(void 0!==o)if(Array.isArray(o))for(;void 0!==(o=a[i])&&(t.push(a.time),n.push.apply(n,o)),void 0!==(a=e[r++]););else if(void 0!==o.toArray)for(;void 0!==(o=a[i])&&(t.push(a.time),o.toArray(n,n.length)),void 0!==(a=e[r++]););else for(;void 0!==(o=a[i])&&(t.push(a.time),n.push(o)),void 0!==(a=e[r++]););}}},Object.assign(s,{parse:function(e){if(void 0===e.type)throw new Error("THREE.KeyframeTrack: track type undefined, can not parse");var t,n,i=s._getTrackTypeForValueTypeName(e.type);return void 0===e.times&&(T.flattenJSON(e.keys,t=[],n=[],"value"),e.times=t,e.values=n),void 0!==i.parse?i.parse(e):new i(e.name,e.times,e.values,e.interpolation)},toJSON:function(e){var t,n=e.constructor;return void 0!==n.toJSON?t=n.toJSON(e):(t={name:e.name,times:T.convertArray(e.times,Array),values:T.convertArray(e.values,Array)},(n=e.getInterpolation())!==e.DefaultInterpolation&&(t.interpolation=n)),t.type=e.ValueTypeName,t},_getTrackTypeForValueTypeName:function(e){switch(e.toLowerCase()){case"scalar":case"double":case"float":case"number":case"integer":return Yi;case"vector":case"vector2":case"vector3":case"vector4":return Qi;case"color":return qi;case"quaternion":return Xi;case"bool":case"boolean":return Vi;case"string":return Gi}throw new Error("THREE.KeyframeTrack: Unsupported typeName: "+e)}}),Object.assign(s.prototype,{constructor:s,TimeBufferType:Float32Array,ValueBufferType:Float32Array,DefaultInterpolation:2301,InterpolantFactoryMethodDiscrete:function(e){return new Ki(this.times,this.values,this.getValueSize(),e)},InterpolantFactoryMethodLinear:function(e){return new Ji(this.times,this.values,this.getValueSize(),e)},InterpolantFactoryMethodSmooth:function(e){return new Zi(this.times,this.values,this.getValueSize(),e)},setInterpolation:function(e){var t;switch(e){case 2300:t=this.InterpolantFactoryMethodDiscrete;break;case 2301:t=this.InterpolantFactoryMethodLinear;break;case 2302:t=this.InterpolantFactoryMethodSmooth}if(void 0!==t)this.createInterpolant=t;else{var n="unsupported interpolation for "+this.ValueTypeName+" keyframe track named "+this.name;if(void 0===this.createInterpolant){if(e===this.DefaultInterpolation)throw new Error(n);this.setInterpolation(this.DefaultInterpolation)}console.warn("THREE.KeyframeTrack:",n)}},getInterpolation:function(){switch(this.createInterpolant){case this.InterpolantFactoryMethodDiscrete:return 2300;case this.InterpolantFactoryMethodLinear:return 2301;case this.InterpolantFactoryMethodSmooth:return 2302}},getValueSize:function(){return this.values.length/this.times.length},shift:function(e){if(0!==e)for(var t=this.times,n=0,i=t.length;n!==i;++n)t[n]+=e;return this},scale:function(e){if(1!==e)for(var t=this.times,n=0,i=t.length;n!==i;++n)t[n]*=e;return this},trim:function(e,t){for(var n,i=this.times,r=i.length,a=0,o=r-1;a!==r&&i[a]<e;)++a;for(;-1!==o&&i[o]>t;)--o;return++o,0===a&&o===r||(o<=a&&(a=(o=Math.max(o,1))-1),n=this.getValueSize(),this.times=T.arraySlice(i,a,o),this.values=T.arraySlice(this.values,a*n,o*n)),this},validate:function(){var e=!0,t=this.getValueSize(),n=(t-Math.floor(t)!=0&&(console.error("THREE.KeyframeTrack: Invalid value size in track.",this),e=!1),this.times),i=this.values,r=n.length;0===r&&(console.error("THREE.KeyframeTrack: Track is empty.",this),e=!1);for(var a=null,o=0;o!==r;o++){var s=n[o];if("number"==typeof s&&isNaN(s)){console.error("THREE.KeyframeTrack: Time is not a valid number.",this,o,s),e=!1;break}if(null!==a&&s<a){console.error("THREE.KeyframeTrack: Out of order keys.",this,o,s,a),e=!1;break}a=s}if(void 0!==i&&T.isTypedArray(i))for(var o=0,c=i.length;o!==c;++o){var l=i[o];if(isNaN(l)){console.error("THREE.KeyframeTrack: Value is not a valid number.",this,o,l),e=!1;break}}return e},optimize:function(){for(var e=this.times,t=this.values,n=this.getValueSize(),i=2302===this.getInterpolation(),r=1,a=e.length-1,o=1;o<a;++o){var s=!1,c=e[o];if(c!==e[o+1]&&(1!==o||c!==c[0]))if(i)s=!0;else for(var l=o*n,h=l-n,u=l+n,d=0;d!==n;++d){var p=t[l+d];if(p!==t[h+d]||p!==t[u+d]){s=!0;break}}if(s){if(o!==r){e[r]=e[o];for(var f=o*n,m=r*n,d=0;d!==n;++d)t[m+d]=t[f+d]}++r}}if(0<a){e[r]=e[a];for(f=a*n,m=r*n,d=0;d!==n;++d)t[m+d]=t[f+d];++r}return r!==e.length&&(this.times=T.arraySlice(e,0,r),this.values=T.arraySlice(t,0,r*n)),this}}),Qi.prototype=Object.assign(Object.create(s.prototype),{constructor:Qi,ValueTypeName:"vector"}),Object.assign($i,{parse:function(e){for(var t=[],n=e.tracks,i=1/(e.fps||1),r=0,a=n.length;r!==a;++r)t.push(s.parse(n[r]).scale(i));return new $i(e.name,e.duration,t)},toJSON:function(e){for(var t=[],n=e.tracks,e={name:e.name,duration:e.duration,tracks:t},i=0,r=n.length;i!==r;++i)t.push(s.toJSON(n[i]));return e},CreateFromMorphTargetSequence:function(e,t,n,i){for(var r=t.length,a=[],o=0;o<r;o++){var s=[],c=((l=[]).push((o+r-1)%r,o,(o+1)%r),s.push(0,1,0),T.getKeyframeOrder(l)),l=T.sortedArray(l,1,c),s=T.sortedArray(s,1,c);i||0!==l[0]||(l.push(r),s.push(s[0])),a.push(new Yi(".morphTargetInfluences["+t[o].name+"]",l,s).scale(1/n))}return new $i(e,-1,a)},findByName:function(e,t){var n=e;Array.isArray(e)||(n=e.geometry&&e.geometry.animations||e.animations);for(var i=0;i<n.length;i++)if(n[i].name===t)return n[i];return null},CreateClipsFromMorphTargetSequences:function(e,t,n){for(var i={},r=/^([\w-]*?)([\d]+)$/,a=0,o=e.length;a<o;a++){var s=e[a],c=s.name.match(r);c&&1<c.length&&((c=i[l=c[1]])||(i[l]=c=[]),c.push(s))}var l,h=[];for(l in i)h.push($i.CreateFromMorphTargetSequence(l,i[l],t,n));return h},parseAnimation:function(e,t){if(!e)return console.error("THREE.AnimationClip: No animation in JSONLoader data."),null;for(var n=function(e,t,n,i,r){var a;0!==n.length&&(T.flattenJSON(n,n=[],a=[],i),0!==n.length)&&r.push(new e(t,n,a))},i=[],r=e.name||"default",a=e.length||-1,o=e.fps||30,s=e.hierarchy||[],c=0;c<s.length;c++){var l=s[c].keys;if(l&&0!==l.length)if(l[0].morphTargets){for(var h,u={},d=0;d<l.length;d++)if(l[d].morphTargets)for(var p=0;p<l[d].morphTargets.length;p++)u[l[d].morphTargets[p]]=-1;for(h in u){for(var f=[],m=[],p=0;p!==l[d].morphTargets.length;++p){var g=l[d];f.push(g.time),m.push(g.morphTarget===h?1:0)}i.push(new Yi(".morphTargetInfluence["+h+"]",f,m))}a=u.length*(o||1)}else{var v=".bones["+t[c].name+"]";n(Qi,v+".position",l,"pos",i),n(Xi,v+".quaternion",l,"rot",i),n(Qi,v+".scale",l,"scl",i)}}return 0===i.length?null:new $i(r,a,i)}}),Object.assign($i.prototype,{resetDuration:function(){for(var e=0,t=0,n=this.tracks.length;t!==n;++t)var i=this.tracks[t],e=Math.max(e,i.times[i.times.length-1]);this.duration=e},trim:function(){for(var e=0;e<this.tracks.length;e++)this.tracks[e].trim(0,this.duration);return this},optimize:function(){for(var e=0;e<this.tracks.length;e++)this.tracks[e].optimize();return this}}),Object.assign(er.prototype,{load:function(e,t,n,i){var r=this;new ui(r.manager).load(e,function(e){t(r.parse(JSON.parse(e)))},n,i)},setTextures:function(e){this.textures=e},parse:function(e){var t=this.textures;function n(e){return void 0===t[e]&&console.warn("THREE.MaterialLoader: Undefined texture",e),t[e]}var i,r=new Ol[e.type];return void 0!==e.uuid&&(r.uuid=e.uuid),void 0!==e.name&&(r.name=e.name),void 0!==e.color&&r.color.setHex(e.color),void 0!==e.roughness&&(r.roughness=e.roughness),void 0!==e.metalness&&(r.metalness=e.metalness),void 0!==e.emissive&&r.emissive.setHex(e.emissive),void 0!==e.specular&&r.specular.setHex(e.specular),void 0!==e.shininess&&(r.shininess=e.shininess),void 0!==e.clearCoat&&(r.clearCoat=e.clearCoat),void 0!==e.clearCoatRoughness&&(r.clearCoatRoughness=e.clearCoatRoughness),void 0!==e.uniforms&&(r.uniforms=e.uniforms),void 0!==e.vertexShader&&(r.vertexShader=e.vertexShader),void 0!==e.fragmentShader&&(r.fragmentShader=e.fragmentShader),void 0!==e.vertexColors&&(r.vertexColors=e.vertexColors),void 0!==e.fog&&(r.fog=e.fog),void 0!==e.flatShading&&(r.flatShading=e.flatShading),void 0!==e.blending&&(r.blending=e.blending),void 0!==e.side&&(r.side=e.side),void 0!==e.opacity&&(r.opacity=e.opacity),void 0!==e.transparent&&(r.transparent=e.transparent),void 0!==e.alphaTest&&(r.alphaTest=e.alphaTest),void 0!==e.depthTest&&(r.depthTest=e.depthTest),void 0!==e.depthWrite&&(r.depthWrite=e.depthWrite),void 0!==e.colorWrite&&(r.colorWrite=e.colorWrite),void 0!==e.wireframe&&(r.wireframe=e.wireframe),void 0!==e.wireframeLinewidth&&(r.wireframeLinewidth=e.wireframeLinewidth),void 0!==e.wireframeLinecap&&(r.wireframeLinecap=e.wireframeLinecap),void 0!==e.wireframeLinejoin&&(r.wireframeLinejoin=e.wireframeLinejoin),void 0!==e.rotation&&(r.rotation=e.rotation),1!==e.linewidth&&(r.linewidth=e.linewidth),void 0!==e.dashSize&&(r.dashSize=e.dashSize),void 0!==e.gapSize&&(r.gapSize=e.gapSize),void 0!==e.scale&&(r.scale=e.scale),void 0!==e.skinning&&(r.skinning=e.skinning),void 0!==e.morphTargets&&(r.morphTargets=e.morphTargets),void 0!==e.dithering&&(r.dithering=e.dithering),void 0!==e.visible&&(r.visible=e.visible),void 0!==e.userData&&(r.userData=e.userData),void 0!==e.shading&&(r.flatShading=1===e.shading),void 0!==e.size&&(r.size=e.size),void 0!==e.sizeAttenuation&&(r.sizeAttenuation=e.sizeAttenuation),void 0!==e.map&&(r.map=n(e.map)),void 0!==e.alphaMap&&(r.alphaMap=n(e.alphaMap),r.transparent=!0),void 0!==e.bumpMap&&(r.bumpMap=n(e.bumpMap)),void 0!==e.bumpScale&&(r.bumpScale=e.bumpScale),void 0!==e.normalMap&&(r.normalMap=n(e.normalMap)),void 0!==e.normalScale&&(i=e.normalScale,!1===Array.isArray(i)&&(i=[i,i]),r.normalScale=(new te).fromArray(i)),void 0!==e.displacementMap&&(r.displacementMap=n(e.displacementMap)),void 0!==e.displacementScale&&(r.displacementScale=e.displacementScale),void 0!==e.displacementBias&&(r.displacementBias=e.displacementBias),void 0!==e.roughnessMap&&(r.roughnessMap=n(e.roughnessMap)),void 0!==e.metalnessMap&&(r.metalnessMap=n(e.metalnessMap)),void 0!==e.emissiveMap&&(r.emissiveMap=n(e.emissiveMap)),void 0!==e.emissiveIntensity&&(r.emissiveIntensity=e.emissiveIntensity),void 0!==e.specularMap&&(r.specularMap=n(e.specularMap)),void 0!==e.envMap&&(r.envMap=n(e.envMap)),void 0!==e.reflectivity&&(r.reflectivity=e.reflectivity),void 0!==e.lightMap&&(r.lightMap=n(e.lightMap)),void 0!==e.lightMapIntensity&&(r.lightMapIntensity=e.lightMapIntensity),void 0!==e.aoMap&&(r.aoMap=n(e.aoMap)),void 0!==e.aoMapIntensity&&(r.aoMapIntensity=e.aoMapIntensity),void 0!==e.gradientMap&&(r.gradientMap=n(e.gradientMap)),r}}),Object.assign(tr.prototype,{load:function(e,t,n,i){var r=this;new ui(r.manager).load(e,function(e){t(r.parse(JSON.parse(e)))},n,i)},parse:function(e){var t,n=new J,i=e.data.index,r=(void 0!==i&&(o=new Wl[i.type](i.array),n.setIndex(new w(o,1))),e.data.attributes);for(t in r){var a=r[t],o=new Wl[a.type](a.array);n.addAttribute(t,new w(o,a.itemSize,a.normalized))}var s=e.data.groups||e.data.drawcalls||e.data.offsets;if(void 0!==s)for(var c=0,l=s.length;c!==l;++c){var h=s[c];n.addGroup(h.start,h.count,h.materialIndex)}i=e.data.boundingSphere;return void 0!==i&&(e=new Ce,void 0!==i.center&&e.fromArray(i.center),n.boundingSphere=new xe(e,i.radius)),n}}),Wl={Int8Array:Int8Array,Uint8Array:Uint8Array,Uint8ClampedArray:"undefined"!=typeof Uint8ClampedArray?Uint8ClampedArray:Uint8Array,Int16Array:Int16Array,Uint16Array:Uint16Array,Int32Array:Int32Array,Uint32Array:Uint32Array,Float32Array:Float32Array,Float64Array:Float64Array},nr.Handlers={handlers:[],add:function(e,t){this.handlers.push(e,t)},get:function(e){for(var t=this.handlers,n=0,i=t.length;n<i;n+=2){var r=t[n],a=t[n+1];if(r.test(e))return a}return null}},Object.assign(nr.prototype,{crossOrigin:void 0,initMaterials:function(e,t,n){for(var i=[],r=0;r<e.length;++r)i[r]=this.createMaterial(e[r],t,n);return i},createMaterial:(zl={NoBlending:Sa,NormalBlending:Aa,AdditiveBlending:Ra,SubtractiveBlending:Ca,MultiplyBlending:La,CustomBlending:Pa},Gl=new N,Vl=new gi,jl=new er,function(e,o,s){var c={};function t(e,t,n,i,r){var e=o+e,a=nr.Handlers.get(e),a=(null!==a?a:(Vl.setCrossOrigin(s),Vl)).load(e),e=(void 0!==t&&(a.repeat.fromArray(t),1!==t[0]&&(a.wrapS=yo),1!==t[1])&&(a.wrapT=yo),void 0!==n&&a.offset.fromArray(n),void 0!==i&&("repeat"===i[0]&&(a.wrapS=yo),"mirror"===i[0]&&(a.wrapS=xo),"repeat"===i[1]&&(a.wrapT=yo),"mirror"===i[1])&&(a.wrapT=xo),void 0!==r&&(a.anisotropy=r),Pe.generateUUID());return c[e]=a,e}var n,i={uuid:Pe.generateUUID(),type:"MeshLambertMaterial"};for(n in e){var r=e[n];switch(n){case"DbgColor":case"DbgIndex":case"opticalDensity":case"illumination":break;case"DbgName":i.name=r;break;case"blending":i.blending=zl[r];break;case"colorAmbient":case"mapAmbient":console.warn("THREE.Loader.createMaterial:",n,"is no longer supported.");break;case"colorDiffuse":i.color=Gl.fromArray(r).getHex();break;case"colorSpecular":i.specular=Gl.fromArray(r).getHex();break;case"colorEmissive":i.emissive=Gl.fromArray(r).getHex();break;case"specularCoef":i.shininess=r;break;case"shading":"basic"===r.toLowerCase()&&(i.type="MeshBasicMaterial"),"phong"===r.toLowerCase()&&(i.type="MeshPhongMaterial"),"standard"===r.toLowerCase()&&(i.type="MeshStandardMaterial");break;case"mapDiffuse":i.map=t(r,e.mapDiffuseRepeat,e.mapDiffuseOffset,e.mapDiffuseWrap,e.mapDiffuseAnisotropy);break;case"mapDiffuseRepeat":case"mapDiffuseOffset":case"mapDiffuseWrap":case"mapDiffuseAnisotropy":break;case"mapEmissive":i.emissiveMap=t(r,e.mapEmissiveRepeat,e.mapEmissiveOffset,e.mapEmissiveWrap,e.mapEmissiveAnisotropy);break;case"mapEmissiveRepeat":case"mapEmissiveOffset":case"mapEmissiveWrap":case"mapEmissiveAnisotropy":break;case"mapLight":i.lightMap=t(r,e.mapLightRepeat,e.mapLightOffset,e.mapLightWrap,e.mapLightAnisotropy);break;case"mapLightRepeat":case"mapLightOffset":case"mapLightWrap":case"mapLightAnisotropy":break;case"mapAO":i.aoMap=t(r,e.mapAORepeat,e.mapAOOffset,e.mapAOWrap,e.mapAOAnisotropy);break;case"mapAORepeat":case"mapAOOffset":case"mapAOWrap":case"mapAOAnisotropy":break;case"mapBump":i.bumpMap=t(r,e.mapBumpRepeat,e.mapBumpOffset,e.mapBumpWrap,e.mapBumpAnisotropy);break;case"mapBumpScale":i.bumpScale=r;break;case"mapBumpRepeat":case"mapBumpOffset":case"mapBumpWrap":case"mapBumpAnisotropy":break;case"mapNormal":i.normalMap=t(r,e.mapNormalRepeat,e.mapNormalOffset,e.mapNormalWrap,e.mapNormalAnisotropy);break;case"mapNormalFactor":i.normalScale=[r,r];break;case"mapNormalRepeat":case"mapNormalOffset":case"mapNormalWrap":case"mapNormalAnisotropy":break;case"mapSpecular":i.specularMap=t(r,e.mapSpecularRepeat,e.mapSpecularOffset,e.mapSpecularWrap,e.mapSpecularAnisotropy);break;case"mapSpecularRepeat":case"mapSpecularOffset":case"mapSpecularWrap":case"mapSpecularAnisotropy":break;case"mapMetalness":i.metalnessMap=t(r,e.mapMetalnessRepeat,e.mapMetalnessOffset,e.mapMetalnessWrap,e.mapMetalnessAnisotropy);break;case"mapMetalnessRepeat":case"mapMetalnessOffset":case"mapMetalnessWrap":case"mapMetalnessAnisotropy":break;case"mapRoughness":i.roughnessMap=t(r,e.mapRoughnessRepeat,e.mapRoughnessOffset,e.mapRoughnessWrap,e.mapRoughnessAnisotropy);break;case"mapRoughnessRepeat":case"mapRoughnessOffset":case"mapRoughnessWrap":case"mapRoughnessAnisotropy":break;case"mapAlpha":i.alphaMap=t(r,e.mapAlphaRepeat,e.mapAlphaOffset,e.mapAlphaWrap,e.mapAlphaAnisotropy);break;case"mapAlphaRepeat":case"mapAlphaOffset":case"mapAlphaWrap":case"mapAlphaAnisotropy":break;case"flipSided":i.side=Ta;break;case"doubleSided":i.side=Ma;break;case"transparency":console.warn("THREE.Loader.createMaterial: transparency has been renamed to opacity"),i.opacity=r;break;case"depthTest":case"depthWrite":case"colorWrite":case"opacity":case"reflectivity":case"transparent":case"visible":case"wireframe":i[n]=r;break;case"vertexColors":!0===r&&(i.vertexColors=2),"face"===r&&(i.vertexColors=1);break;default:console.error("THREE.Loader.createMaterial: Unsupported",n,r)}}return"MeshBasicMaterial"===i.type&&delete i.emissive,"MeshPhongMaterial"!==i.type&&delete i.specular,i.opacity<1&&(i.transparent=!0),jl.setTextures(c),jl.parse(i)})}),ql={decodeText:function(e){if("undefined"!=typeof TextDecoder)return(new TextDecoder).decode(e);for(var t="",n=0,i=e.length;n<i;n++)t+=String.fromCharCode(e[n]);return t},extractUrlBase:function(e){e=e.split("/");return 1===e.length?"./":(e.pop(),e.join("/")+"/")}},Object.assign(ir.prototype,{load:function(n,i,e,t){var r=this,a=this.texturePath&&"string"==typeof this.texturePath?this.texturePath:ql.extractUrlBase(n),o=new ui(this.manager);o.setWithCredentials(this.withCredentials),o.load(n,function(e){var e=JSON.parse(e),t=e.metadata;if(void 0!==t){t=t.type;if(void 0!==t){if("object"===t.toLowerCase())return void console.error("THREE.JSONLoader: "+n+" should be loaded with THREE.ObjectLoader instead.");if("scene"===t.toLowerCase())return void console.error("THREE.JSONLoader: "+n+" should be loaded with THREE.SceneLoader instead.")}}t=r.parse(e,a);i(t.geometry,t.materials)},e,t)},setTexturePath:function(e){this.texturePath=e},parse:function(e,t){void 0!==(e=void 0!==e.data?e.data:e).scale?e.scale=1/e.scale:e.scale=1;var n=new x;return((e,t)=>{var n,i,r,a,o,s,c,l,h,u,d,p,f,m,g,v,y,x,b,w,_,E,T,M,S=e.faces,A=e.vertices,R=e.normals,C=e.colors,L=e.scale,P=0;if(void 0!==e.uvs){for(n=0;n<e.uvs.length;n++)e.uvs[n].length&&P++;for(n=0;n<P;n++)t.faceVertexUvs[n]=[]}for(a=0,o=A.length;a<o;)(y=new Ce).x=A[a++]*L,y.y=A[a++]*L,y.z=A[a++]*L,t.vertices.push(y);for(a=0,o=S.length;a<o;)if(d=(u=S[a++])&2,p=u&8,f=u&16,m=u&32,g=u&64,v=u&128,u&1){if((b=new Se).a=S[a],b.b=S[a+1],b.c=S[a+3],(w=new Se).a=S[a+1],w.b=S[a+2],w.c=S[a+3],a+=4,d&&(h=S[a++],b.materialIndex=h,w.materialIndex=h),r=t.faces.length,p)for(n=0;n<P;n++)for(T=e.uvs[n],t.faceVertexUvs[n][r]=[],t.faceVertexUvs[n][r+1]=[],i=0;i<4;i++)M=new te(T[2*(l=S[a++])],T[2*l+1]),2!==i&&t.faceVertexUvs[n][r].push(M),0!==i&&t.faceVertexUvs[n][r+1].push(M);if(f&&(c=3*S[a++],b.normal.set(R[c++],R[c++],R[c]),w.normal.copy(b.normal)),m)for(n=0;n<4;n++)c=3*S[a++],E=new Ce(R[c++],R[c++],R[c]),2!==n&&b.vertexNormals.push(E),0!==n&&w.vertexNormals.push(E);if(g&&(_=C[s=S[a++]],b.color.setHex(_),w.color.setHex(_)),v)for(n=0;n<4;n++)_=C[s=S[a++]],2!==n&&b.vertexColors.push(new N(_)),0!==n&&w.vertexColors.push(new N(_));t.faces.push(b),t.faces.push(w)}else{if((x=new Se).a=S[a++],x.b=S[a++],x.c=S[a++],d&&(h=S[a++],x.materialIndex=h),r=t.faces.length,p)for(n=0;n<P;n++)for(T=e.uvs[n],t.faceVertexUvs[n][r]=[],i=0;i<3;i++)M=new te(T[2*(l=S[a++])],T[2*l+1]),t.faceVertexUvs[n][r].push(M);if(f&&(c=3*S[a++],x.normal.set(R[c++],R[c++],R[c])),m)for(n=0;n<3;n++)c=3*S[a++],E=new Ce(R[c++],R[c++],R[c]),x.vertexNormals.push(E);if(g&&(s=S[a++],x.color.setHex(C[s])),v)for(n=0;n<3;n++)s=S[a++],x.vertexColors.push(new N(C[s]));t.faces.push(x)}})(e,n),((e,t)=>{var n=void 0!==e.influencesPerVertex?e.influencesPerVertex:2;if(e.skinWeights)for(var i=0,r=e.skinWeights.length;i<r;i+=n){var a=e.skinWeights[i],o=1<n?e.skinWeights[i+1]:0,s=2<n?e.skinWeights[i+2]:0,c=3<n?e.skinWeights[i+3]:0;t.skinWeights.push(new Le(a,o,s,c))}if(e.skinIndices)for(i=0,r=e.skinIndices.length;i<r;i+=n){var l=e.skinIndices[i],h=1<n?e.skinIndices[i+1]:0,u=2<n?e.skinIndices[i+2]:0,d=3<n?e.skinIndices[i+3]:0;t.skinIndices.push(new Le(l,h,u,d))}t.bones=e.bones,t.bones&&0<t.bones.length&&(t.skinWeights.length!==t.skinIndices.length||t.skinIndices.length!==t.vertices.length)&&console.warn("When skinning, number of vertices ("+t.vertices.length+"), skinIndices ("+t.skinIndices.length+"), and skinWeights ("+t.skinWeights.length+") should match.")})(e,n),((e,t)=>{var n=e.scale;if(void 0!==e.morphTargets)for(var i=0,r=e.morphTargets.length;i<r;i++){t.morphTargets[i]={},t.morphTargets[i].name=e.morphTargets[i].name,t.morphTargets[i].vertices=[];for(var a=t.morphTargets[i].vertices,o=e.morphTargets[i].vertices,s=0,c=o.length;s<c;s+=3){var l=new Ce;l.x=o[s]*n,l.y=o[s+1]*n,l.z=o[s+2]*n,a.push(l)}}if(void 0!==e.morphColors&&0<e.morphColors.length){console.warn('THREE.JSONLoader: "morphColors" no longer supported. Using them as face colors.');for(var h=t.faces,u=e.morphColors[0].colors,i=0,r=h.length;i<r;i++)h[i].color.fromArray(u,3*i)}})(e,n),((e,t)=>{var n=[],i=[];void 0!==e.animation&&i.push(e.animation),void 0!==e.animations&&(e.animations.length?i=i.concat(e.animations):i.push(e.animations));for(var r=0;r<i.length;r++){var a=$i.parseAnimation(i[r],t.bones);a&&n.push(a)}t.morphTargets&&(e=$i.CreateClipsFromMorphTargetSequences(t.morphTargets,10),n=n.concat(e)),0<n.length&&(t.animations=n)})(e,n),n.computeFaceNormals(),n.computeBoundingSphere(),void 0===e.materials||0===e.materials.length?{geometry:n}:{geometry:n,materials:nr.prototype.initMaterials(e.materials,t,this.crossOrigin)}}}),Object.assign(rr.prototype,{load:function(n,i,e,r){""===this.texturePath&&(this.texturePath=n.substring(0,n.lastIndexOf("/")+1));var a=this;new ui(a.manager).load(n,function(e){var t=null;try{t=JSON.parse(e)}catch(e){return void 0!==r&&r(e),void console.error("THREE:ObjectLoader: Can't parse "+n+".",e.message)}e=t.metadata;void 0!==e&&void 0!==e.type&&"geometry"!==e.type.toLowerCase()?a.parse(t,i):console.error("THREE.ObjectLoader: Can't load "+n+". Use THREE.JSONLoader instead.")},e,r)},setTexturePath:function(e){this.texturePath=e},setCrossOrigin:function(e){this.crossOrigin=e},parse:function(e,t){var n=this.parseShape(e.shapes),n=this.parseGeometries(e.geometries,n),i=this.parseImages(e.images,function(){void 0!==t&&t(r)}),i=this.parseTextures(e.textures,i),i=this.parseMaterials(e.materials,i),r=this.parseObject(e.object,n,i);return e.animations&&(r.animations=this.parseAnimations(e.animations)),void 0!==e.images&&0!==e.images.length||void 0!==t&&t(r),r},parseShape:function(e){var t={};if(void 0!==e)for(var n=0,i=e.length;n<i;n++){var r=(new Ni).fromJSON(e[n]);t[r.uuid]=r}return t},parseGeometries:function(e,t){var n={};if(void 0!==e)for(var i=new ir,r=new tr,a=0,o=e.length;a<o;a++){var s,c=e[a];switch(c.type){case"PlaneGeometry":case"PlaneBufferGeometry":s=new Nl[c.type](c.width,c.height,c.widthSegments,c.heightSegments);break;case"BoxGeometry":case"BoxBufferGeometry":case"CubeGeometry":s=new Nl[c.type](c.width,c.height,c.depth,c.widthSegments,c.heightSegments,c.depthSegments);break;case"CircleGeometry":case"CircleBufferGeometry":s=new Nl[c.type](c.radius,c.segments,c.thetaStart,c.thetaLength);break;case"CylinderGeometry":case"CylinderBufferGeometry":s=new Nl[c.type](c.radiusTop,c.radiusBottom,c.height,c.radialSegments,c.heightSegments,c.openEnded,c.thetaStart,c.thetaLength);break;case"ConeGeometry":case"ConeBufferGeometry":s=new Nl[c.type](c.radius,c.height,c.radialSegments,c.heightSegments,c.openEnded,c.thetaStart,c.thetaLength);break;case"SphereGeometry":case"SphereBufferGeometry":s=new Nl[c.type](c.radius,c.widthSegments,c.heightSegments,c.phiStart,c.phiLength,c.thetaStart,c.thetaLength);break;case"DodecahedronGeometry":case"DodecahedronBufferGeometry":case"IcosahedronGeometry":case"IcosahedronBufferGeometry":case"OctahedronGeometry":case"OctahedronBufferGeometry":case"TetrahedronGeometry":case"TetrahedronBufferGeometry":s=new Nl[c.type](c.radius,c.detail);break;case"RingGeometry":case"RingBufferGeometry":s=new Nl[c.type](c.innerRadius,c.outerRadius,c.thetaSegments,c.phiSegments,c.thetaStart,c.thetaLength);break;case"TorusGeometry":case"TorusBufferGeometry":s=new Nl[c.type](c.radius,c.tube,c.radialSegments,c.tubularSegments,c.arc);break;case"TorusKnotGeometry":case"TorusKnotBufferGeometry":s=new Nl[c.type](c.radius,c.tube,c.tubularSegments,c.radialSegments,c.p,c.q);break;case"LatheGeometry":case"LatheBufferGeometry":s=new Nl[c.type](c.points,c.segments,c.phiStart,c.phiLength);break;case"PolyhedronGeometry":case"PolyhedronBufferGeometry":s=new Nl[c.type](c.vertices,c.indices,c.radius,c.details);break;case"ShapeGeometry":case"ShapeBufferGeometry":for(var l=[],a=0,o=c.shapes.length;a<o;a++){var h=t[c.shapes[a]];l.push(h)}s=new Nl[c.type](l,c.curveSegments);break;case"BufferGeometry":s=r.parse(c);break;case"Geometry":s=i.parse(c,this.texturePath).geometry;break;default:console.warn('THREE.ObjectLoader: Unsupported geometry type "'+c.type+'"');continue}s.uuid=c.uuid,void 0!==c.name&&(s.name=c.name),n[c.uuid]=s}return n},parseMaterials:function(e,t){var n={};if(void 0!==e){var i=new er;i.setTextures(t);for(var r=0,a=e.length;r<a;r++){var o=e[r];if("MultiMaterial"===o.type){for(var s=[],c=0;c<o.materials.length;c++)s.push(i.parse(o.materials[c]));n[o.uuid]=s}else n[o.uuid]=i.parse(o)}}return n},parseAnimations:function(e){for(var t=[],n=0;n<e.length;n++){var i=$i.parse(e[n]);t.push(i)}return t},parseImages:function(e,t){var n=this,i={};if(void 0!==e&&0<e.length){var r=new fi(new hi(t));r.setCrossOrigin(this.crossOrigin);for(var a=0,o=e.length;a<o;a++){var s=e[a],c=/^(\/\/)|([a-z]+:(\/\/)?)/i.test(s.url)?s.url:n.texturePath+s.url;i[s.uuid]=(e=>(n.manager.itemStart(e),r.load(e,function(){n.manager.itemEnd(e)},void 0,function(){n.manager.itemEnd(e),n.manager.itemError(e)})))(c)}}return i},parseTextures:function(e,t){function n(e,t){return"number"==typeof e?e:(console.warn("THREE.ObjectLoader.parseTexture: Constant should be in numeric form.",e),t[e])}var i={};if(void 0!==e)for(var r=0,a=e.length;r<a;r++){var o=e[r],s=(void 0===o.image&&console.warn('THREE.ObjectLoader: No "image" specified for',o.uuid),void 0===t[o.image]&&console.warn("THREE.ObjectLoader: Undefined image",o.image),new d(t[o.image]));s.needsUpdate=!0,s.uuid=o.uuid,void 0!==o.name&&(s.name=o.name),void 0!==o.mapping&&(s.mapping=n(o.mapping,Zl)),void 0!==o.offset&&s.offset.fromArray(o.offset),void 0!==o.repeat&&s.repeat.fromArray(o.repeat),void 0!==o.center&&s.center.fromArray(o.center),void 0!==o.rotation&&(s.rotation=o.rotation),void 0!==o.wrap&&(s.wrapS=n(o.wrap[0],Jl),s.wrapT=n(o.wrap[1],Jl)),void 0!==o.minFilter&&(s.minFilter=n(o.minFilter,Kl)),void 0!==o.magFilter&&(s.magFilter=n(o.magFilter,Kl)),void 0!==o.anisotropy&&(s.anisotropy=o.anisotropy),void 0!==o.flipY&&(s.flipY=o.flipY),i[o.uuid]=s}return i},parseObject:(Xl=new Re,function(e,t,a){function n(e){return void 0===t[e]&&console.warn("THREE.ObjectLoader: Undefined geometry",e),t[e]}function i(e){if(void 0!==e){if(Array.isArray(e)){for(var t=[],n=0,i=e.length;n<i;n++){var r=e[n];void 0===a[r]&&console.warn("THREE.ObjectLoader: Undefined material",r),t.push(a[r])}return t}return void 0===a[e]&&console.warn("THREE.ObjectLoader: Undefined material",e),a[e]}}switch(e.type){case"Scene":s=new zt,void 0!==e.background&&Number.isInteger(e.background)&&(s.background=new N(e.background)),void 0!==e.fog&&("Fog"===e.fog.type?s.fog=new Ht(e.fog.color,e.fog.near,e.fog.far):"FogExp2"===e.fog.type&&(s.fog=new kt(e.fog.color,e.fog.density)));break;case"PerspectiveCamera":s=new g(e.fov,e.aspect,e.near,e.far),void 0!==e.focus&&(s.focus=e.focus),void 0!==e.zoom&&(s.zoom=e.zoom),void 0!==e.filmGauge&&(s.filmGauge=e.filmGauge),void 0!==e.filmOffset&&(s.filmOffset=e.filmOffset),void 0!==e.view&&(s.view=Object.assign({},e.view));break;case"OrthographicCamera":s=new Me(e.left,e.right,e.top,e.bottom,e.near,e.far);break;case"AmbientLight":s=new Hi(e.color,e.intensity);break;case"DirectionalLight":s=new ki(e.color,e.intensity);break;case"PointLight":s=new Fi(e.color,e.intensity,e.distance,e.decay);break;case"RectAreaLight":s=new zi(e.color,e.intensity,e.width,e.height);break;case"SpotLight":s=new Di(e.color,e.intensity,e.distance,e.angle,e.penumbra,e.decay);break;case"HemisphereLight":s=new Oi(e.color,e.groundColor,e.intensity);break;case"SkinnedMesh":console.warn("THREE.ObjectLoader.parseObject() does not support SkinnedMesh yet.");case"Mesh":var r=n(e.geometry),o=i(e.material),s=new(r.bones&&0<r.bones.length?Yt:m)(r,o);break;case"LOD":s=new Wt;break;case"Line":s=new y(n(e.geometry),i(e.material),e.mode);break;case"LineLoop":s=new Zt(n(e.geometry),i(e.material));break;case"LineSegments":s=new b(n(e.geometry),i(e.material));break;case"PointCloud":case"Points":s=new Kt(n(e.geometry),i(e.material));break;case"Sprite":s=new jt(i(e.material));break;case"Group":s=new Qt;break;default:s=new f}if(s.uuid=e.uuid,void 0!==e.name&&(s.name=e.name),void 0!==e.matrix?(Xl.fromArray(e.matrix),Xl.decompose(s.position,s.quaternion,s.scale)):(void 0!==e.position&&s.position.fromArray(e.position),void 0!==e.rotation&&s.rotation.fromArray(e.rotation),void 0!==e.quaternion&&s.quaternion.fromArray(e.quaternion),void 0!==e.scale&&s.scale.fromArray(e.scale)),void 0!==e.castShadow&&(s.castShadow=e.castShadow),void 0!==e.receiveShadow&&(s.receiveShadow=e.receiveShadow),e.shadow&&(void 0!==e.shadow.bias&&(s.shadow.bias=e.shadow.bias),void 0!==e.shadow.radius&&(s.shadow.radius=e.shadow.radius),void 0!==e.shadow.mapSize&&s.shadow.mapSize.fromArray(e.shadow.mapSize),void 0!==e.shadow.camera)&&(s.shadow.camera=this.parseObject(e.shadow.camera)),void 0!==e.visible&&(s.visible=e.visible),void 0!==e.userData&&(s.userData=e.userData),void 0!==e.children)for(var c=e.children,l=0;l<c.length;l++)s.add(this.parseObject(c[l],t,a));if("LOD"===e.type)for(var h=e.levels,u=0;u<h.length;u++){var d=h[u],p=s.getObjectByProperty("uuid",d.object);void 0!==p&&s.addLevel(p,d.distance)}return s})}),Zl={UVMapping:300,CubeReflectionMapping:ho,CubeRefractionMapping:uo,EquirectangularReflectionMapping:po,EquirectangularRefractionMapping:fo,SphericalReflectionMapping:mo,CubeUVReflectionMapping:go,CubeUVRefractionMapping:vo},Jl={RepeatWrapping:yo,ClampToEdgeWrapping:A,MirroredRepeatWrapping:xo},Kl={NearestFilter:R,NearestMipMapNearestFilter:bo,NearestMipMapLinearFilter:wo,LinearFilter:C,LinearMipMapNearestFilter:_o,LinearMipMapLinearFilter:Eo},ar.prototype={constructor:ar,setOptions:function(e){return this.options=e,this},load:function(t,n,e,i){void 0===t&&(t=""),void 0!==this.path&&(t=this.path+t);var r=this,a=Il.get(t);if(void 0!==a)return r.manager.itemStart(t),setTimeout(function(){n&&n(a),r.manager.itemEnd(t)},0),a;fetch(t).then(function(e){return e.blob()}).then(function(e){return createImageBitmap(e,r.options)}).then(function(e){Il.add(t,e),n&&n(e),r.manager.itemEnd(t)}).catch(function(e){i&&i(e),r.manager.itemEnd(t),r.manager.itemError(t)})},setCrossOrigin:function(){return this},setPath:function(e){return this.path=e,this}},Object.assign(or.prototype,{moveTo:function(e,t){this.currentPath=new Pi,this.subPaths.push(this.currentPath),this.currentPath.moveTo(e,t)},lineTo:function(e,t){this.currentPath.lineTo(e,t)},quadraticCurveTo:function(e,t,n,i){this.currentPath.quadraticCurveTo(e,t,n,i)},bezierCurveTo:function(e,t,n,i,r,a){this.currentPath.bezierCurveTo(e,t,n,i,r,a)},splineThru:function(e){this.currentPath.splineThru(e)},toShapes:function(e,t){function n(e){for(var t=[],n=0,i=e.length;n<i;n++){var r=e[n],a=new Ni;a.curves=r.curves,t.push(a)}return t}var i=Pl.isClockWise,r=this.subPaths;if(0===r.length)return[];if(!0===t)return n(r);var a,o,s,c=[];if(1===r.length)o=r[0],(s=new Ni).curves=o.curves,c.push(s);else{var l,h=!i(r[0].getPoints()),h=e?!h:h,u=[],d=[],p=[],f=0;d[f]=void 0,p[f]=[];for(var m=0,g=r.length;m<g;m++)a=i(l=(o=r[m]).getPoints()),(e?!a:a)?(!h&&d[f]&&f++,d[f]={s:new Ni,p:l},d[f].s.curves=o.curves,h&&f++,p[f]=[]):p[f].push({h:o,p:l[0]});if(!d[0])return n(r);if(1<d.length){for(var v=!1,y=[],x=0,b=d.length;x<b;x++)u[x]=[];for(x=0,b=d.length;x<b;x++)for(var w=p[x],_=0;_<w.length;_++){for(var E=w[_],T=!0,M=0;M<d.length;M++)((e,t)=>{for(var n=t.length,i=!1,r=n-1,a=0;a<n;r=a++){var o=t[r],s=t[a],c=s.x-o.x,l=s.y-o.y;if(Math.abs(l)>Number.EPSILON){if(l<0&&(o=t[a],c=-c,s=t[r],l=-l),!(e.y<o.y||e.y>s.y))if(e.y===o.y){if(e.x===o.x)return 1}else{l=l*(e.x-o.x)-c*(e.y-o.y);if(0==l)return 1;l<0||(i=!i)}}else if(e.y===o.y&&(s.x<=e.x&&e.x<=o.x||o.x<=e.x&&e.x<=s.x))return 1}return i})(E.p,d[M].p)&&(x!==M&&y.push({froms:x,tos:M,hole:_}),T?(T=!1,u[M].push(E)):v=!0);T&&u[x].push(E)}0<y.length&&(v||(p=u))}for(var m=0,S=d.length;m<S;m++){s=d[m].s,c.push(s);for(var A,R=0,C=(A=p[m]).length;R<C;R++)s.holes.push(A[R].h)}}return c}}),Object.assign(sr.prototype,{isFont:!0,generateShapes:function(c,l,e){void 0===l&&(l=100),void 0===e&&(e=4);for(var y=this.data,t=(()=>{for(var e=String(c).split(""),t=l/y.resolution,n=(y.boundingBox.yMax-y.boundingBox.yMin+y.underlineThickness)*t,i=0,r=0,a=[],o=0;o<e.length;o++){var s=e[o];"\n"===s?(i=0,r-=n):(i+=(s=((e,t,n,i)=>{if(e=y.glyphs[e]||y.glyphs["?"]){var r,a,o,s,c,l,h,u,d,p=new or,f=[];if(e.o)for(var m=e._cachedOutline||(e._cachedOutline=e.o.split(" ")),g=0,v=m.length;g<v;)switch(m[g++]){case"m":r=m[g++]*t+n,a=m[g++]*t+i,p.moveTo(r,a);break;case"l":r=m[g++]*t+n,a=m[g++]*t+i,p.lineTo(r,a);break;case"q":o=m[g++]*t+n,s=m[g++]*t+i,c=m[g++]*t+n,l=m[g++]*t+i,p.quadraticCurveTo(c,l,o,s),(d=f[f.length-1])&&(d.x,d.y);break;case"b":o=m[g++]*t+n,s=m[g++]*t+i,c=m[g++]*t+n,l=m[g++]*t+i,h=m[g++]*t+n,u=m[g++]*t+i,p.bezierCurveTo(c,l,h,u,o,s),(d=f[f.length-1])&&(d.x,d.y)}return{offsetX:e.ha*t,path:p}}})(s,t,i,r)).offsetX,a.push(s.path))}return a})(),n=[],i=0,r=t.length;i<r;i++)Array.prototype.push.apply(n,t[i].toShapes());return n}}),Object.assign(cr.prototype,{load:function(e,i,t,n){var r=this,a=new ui(this.manager);a.setPath(this.path),a.load(e,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))}t=r.parse(n);i&&i(t)},t,n)},parse:function(e){return new sr(e)},setPath:function(e){return this.path=e,this}}),zh={getContext:function(){return Yl=void 0===Yl?new(window.AudioContext||window.webkitAudioContext):Yl},setContext:function(e){Yl=e}},Object.assign(lr.prototype,{load:function(e,t,n,i){var r=new ui(this.manager);r.setResponseType("arraybuffer"),r.load(e,function(e){zh.getContext().decodeAudioData(e,function(e){t(e)})},n,i)}}),Object.assign(hr.prototype,{update:(dh=new Re,ph=new Re,function(e){var t,n,i,r,a;rh===this&&ah===e.focus&&oh===e.fov&&sh===e.aspect*this.aspect&&ch===e.near&&lh===e.far&&hh===e.zoom&&uh===this.eyeSep||(rh=this,ah=e.focus,oh=e.fov,sh=e.aspect*this.aspect,ch=e.near,lh=e.far,hh=e.zoom,i=e.projectionMatrix.clone(),r=(uh=this.eyeSep/2)*ch/ah,a=ch*Math.tan(Pe.DEG2RAD*oh*.5)/hh,ph.elements[12]=-uh,dh.elements[12]=uh,t=-a*sh+r,n=a*sh+r,i.elements[0]=2*ch/(n-t),i.elements[8]=(n+t)/(n-t),this.cameraL.projectionMatrix.copy(i),t=-a*sh-r,n=a*sh-r,i.elements[0]=2*ch/(n-t),i.elements[8]=(n+t)/(n-t),this.cameraR.projectionMatrix.copy(i)),this.cameraL.matrixWorld.copy(e.matrixWorld).multiply(ph),this.cameraR.matrixWorld.copy(e.matrixWorld).multiply(dh)})}),(ur.prototype=Object.create(f.prototype)).constructor=ur,dr.prototype=Object.assign(Object.create(f.prototype),{constructor:dr,getInput:function(){return this.gain},removeFilter:function(){null!==this.filter&&(this.gain.disconnect(this.filter),this.filter.disconnect(this.context.destination),this.gain.connect(this.context.destination),this.filter=null)},getFilter:function(){return this.filter},setFilter:function(e){(null!==this.filter?(this.gain.disconnect(this.filter),this.filter):this.gain).disconnect(this.context.destination),this.filter=e,this.gain.connect(this.filter),this.filter.connect(this.context.destination)},getMasterVolume:function(){return this.gain.gain.value},setMasterVolume:function(e){this.gain.gain.value=e},updateMatrixWorld:(Fh=new Ce,Bh=new h,kh=new Ce,Hh=new Ce,function(e){f.prototype.updateMatrixWorld.call(this,e);var e=this.context.listener,t=this.up;this.matrixWorld.decompose(Fh,Bh,kh),Hh.set(0,0,-1).applyQuaternion(Bh),e.positionX?(e.positionX.setValueAtTime(Fh.x,this.context.currentTime),e.positionY.setValueAtTime(Fh.y,this.context.currentTime),e.positionZ.setValueAtTime(Fh.z,this.context.currentTime),e.forwardX.setValueAtTime(Hh.x,this.context.currentTime),e.forwardY.setValueAtTime(Hh.y,this.context.currentTime),e.forwardZ.setValueAtTime(Hh.z,this.context.currentTime),e.upX.setValueAtTime(t.x,this.context.currentTime),e.upY.setValueAtTime(t.y,this.context.currentTime),e.upZ.setValueAtTime(t.z,this.context.currentTime)):(e.setPosition(Fh.x,Fh.y,Fh.z),e.setOrientation(Hh.x,Hh.y,Hh.z,t.x,t.y,t.z))})}),pr.prototype=Object.assign(Object.create(f.prototype),{constructor:pr,getOutput:function(){return this.gain},setNodeSource:function(e){return this.hasPlaybackControl=!1,this.sourceType="audioNode",this.source=e,this.connect(),this},setBuffer:function(e){return this.buffer=e,this.sourceType="buffer",this.autoplay&&this.play(),this},play:function(){if(!0!==this.isPlaying){var e;if(!1!==this.hasPlaybackControl)return(e=this.context.createBufferSource()).buffer=this.buffer,e.loop=this.loop,e.onended=this.onEnded.bind(this),e.playbackRate.setValueAtTime(this.playbackRate,this.startTime),this.startTime=this.context.currentTime,e.start(this.startTime,this.offset),this.isPlaying=!0,this.source=e,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!0===this.isPlaying&&(this.source.stop(),this.offset+=(this.context.currentTime-this.startTime)*this.playbackRate,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.offset=0,this.isPlaying=!1,this;console.warn("THREE.Audio: this Audio has no playback control.")},connect:function(){if(0<this.filters.length){this.source.connect(this.filters[0]);for(var e=1,t=this.filters.length;e<t;e++)this.filters[e-1].connect(this.filters[e]);this.filters[this.filters.length-1].connect(this.getOutput())}else this.source.connect(this.getOutput());return this},disconnect:function(){if(0<this.filters.length){this.source.disconnect(this.filters[0]);for(var e=1,t=this.filters.length;e<t;e++)this.filters[e-1].disconnect(this.filters[e]);this.filters[this.filters.length-1].disconnect(this.getOutput())}else this.source.disconnect(this.getOutput());return this},getFilters:function(){return this.filters},setFilters:function(e){return e=e||[],!0===this.isPlaying?(this.disconnect(),this.filters=e,this.connect()):this.filters=e,this},getFilter:function(){return this.getFilters()[0]},setFilter:function(e){return this.setFilters(e?[e]:[])},setPlaybackRate:function(e){if(!1!==this.hasPlaybackControl)return this.playbackRate=e,!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(e){if(!1!==this.hasPlaybackControl)return this.loop=e,!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(e){return this.gain.gain.value=e,this}}),fr.prototype=Object.assign(Object.create(pr.prototype),{constructor:fr,getOutput:function(){return this.panner},getRefDistance:function(){return this.panner.refDistance},setRefDistance:function(e){this.panner.refDistance=e},getRolloffFactor:function(){return this.panner.rolloffFactor},setRolloffFactor:function(e){this.panner.rolloffFactor=e},getDistanceModel:function(){return this.panner.distanceModel},setDistanceModel:function(e){this.panner.distanceModel=e},getMaxDistance:function(){return this.panner.maxDistance},setMaxDistance:function(e){this.panner.maxDistance=e},updateMatrixWorld:(Dh=new Ce,function(e){f.prototype.updateMatrixWorld.call(this,e),Dh.setFromMatrixPosition(this.matrixWorld),this.panner.setPosition(Dh.x,Dh.y,Dh.z)})}),Object.assign(mr.prototype,{getFrequencyData:function(){return this.analyser.getByteFrequencyData(this.data),this.data},getAverageFrequency:function(){for(var e=0,t=this.getFrequencyData(),n=0;n<t.length;n++)e+=t[n];return e/t.length}}),Object.assign(gr.prototype,{accumulate:function(e,t){var n=this.buffer,i=this.valueSize,r=e*i+i,e=this.cumulativeWeight;if(0===e){for(var a=0;a!==i;++a)n[r+a]=n[a];e=t}else{t=t/(e+=t);this._mixBufferRegion(n,r,0,t,i)}this.cumulativeWeight=e},apply:function(e){var t=this.valueSize,n=this.buffer,i=e*t+t,e=this.cumulativeWeight,r=this.binding;this.cumulativeWeight=0,e<1&&this._mixBufferRegion(n,i,3*t,1-e,t);for(var a=t,o=t+t;a!==o;++a)if(n[a]!==n[a+t]){r.setValue(n,i);break}},saveOriginalState:function(){var e=this.binding,t=this.buffer,n=this.valueSize,i=3*n;e.getValue(t,i);for(var r=n,a=i;r!==a;++r)t[r]=t[i+r%n];this.cumulativeWeight=0},restoreOriginalState:function(){var e=3*this.valueSize;this.binding.setValue(this.buffer,e)},_select:function(e,t,n,i,r){if(.5<=i)for(var a=0;a!==r;++a)e[t+a]=e[n+a]},_slerp:function(e,t,n,i){h.slerpFlat(e,t,e,t,e,n,i)},_lerp:function(e,t,n,i,r){for(var a=1-i,o=0;o!==r;++o){var s=t+o;e[s]=e[s]*a+e[n+o]*i}}}),Object.assign(vr.prototype,{getValue:function(e,t){this.bind();var n=this._targetGroup.nCachedObjects_,n=this._bindings[n];void 0!==n&&n.getValue(e,t)},setValue:function(e,t){for(var n=this._bindings,i=this._targetGroup.nCachedObjects_,r=n.length;i!==r;++i)n[i].setValue(e,t)},bind:function(){for(var e=this._bindings,t=this._targetGroup.nCachedObjects_,n=e.length;t!==n;++t)e[t].bind()},unbind:function(){for(var e=this._bindings,t=this._targetGroup.nCachedObjects_,n=e.length;t!==n;++t)e[t].unbind()}}),Object.assign(_,{Composite:vr,create:function(e,t,n){return new(e&&e.isAnimationObjectGroup?_.Composite:_)(e,t,n)},sanitizeNodeName:function(e){return e.replace(/\s/g,"_").replace(/[^\w-]/g,"")},parseTrackName:(nh=new RegExp("^"+/((?:[\w-]+[\/:])*)/.source+/([\w-\.]+)?/.source+/(?:\.([\w-]+)(?:\[(.+)\])?)?/.source+/\.([\w-]+)(?:\[(.+)\])?/.source+"$"),ih=["material","materials","bones"],function(e){var t=nh.exec(e);if(!t)throw new Error("PropertyBinding: Cannot parse trackName: "+e);var n,t={nodeName:t[2],objectName:t[3],objectIndex:t[4],propertyName:t[5],propertyIndex:t[6]},i=t.nodeName&&t.nodeName.lastIndexOf(".");if(void 0!==i&&-1!==i&&(n=t.nodeName.substring(i+1),-1!==ih.indexOf(n))&&(t.nodeName=t.nodeName.substring(0,i),t.objectName=n),null===t.propertyName||0===t.propertyName.length)throw new Error("PropertyBinding: can not parse propertyName from trackName: "+e);return t}),findNode:function(e,r){if(!r||""===r||"root"===r||"."===r||-1===r||r===e.name||r===e.uuid)return e;if(e.skeleton){var t=(e=>{for(var t=0;t<e.bones.length;t++){var n=e.bones[t];if(n.name===r)return n}return null})(e.skeleton);if(t)return t}if(e.children){t=function e(t){for(var n=0;n<t.length;n++){var i=t[n];if(i.name===r||i.uuid===r)return i;i=e(i.children);if(i)return i}return null}(e.children);if(t)return t}return null}}),Object.assign(_.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(e,t){e[t]=this.node[this.propertyName]},function(e,t){for(var n=this.resolvedProperty,i=0,r=n.length;i!==r;++i)e[t++]=n[i]},function(e,t){e[t]=this.resolvedProperty[this.propertyIndex]},function(e,t){this.resolvedProperty.toArray(e,t)}],SetterByBindingTypeAndVersioning:[[function(e,t){this.targetObject[this.propertyName]=e[t]},function(e,t){this.targetObject[this.propertyName]=e[t],this.targetObject.needsUpdate=!0},function(e,t){this.targetObject[this.propertyName]=e[t],this.targetObject.matrixWorldNeedsUpdate=!0}],[function(e,t){for(var n=this.resolvedProperty,i=0,r=n.length;i!==r;++i)n[i]=e[t++]},function(e,t){for(var n=this.resolvedProperty,i=0,r=n.length;i!==r;++i)n[i]=e[t++];this.targetObject.needsUpdate=!0},function(e,t){for(var n=this.resolvedProperty,i=0,r=n.length;i!==r;++i)n[i]=e[t++];this.targetObject.matrixWorldNeedsUpdate=!0}],[function(e,t){this.resolvedProperty[this.propertyIndex]=e[t]},function(e,t){this.resolvedProperty[this.propertyIndex]=e[t],this.targetObject.needsUpdate=!0},function(e,t){this.resolvedProperty[this.propertyIndex]=e[t],this.targetObject.matrixWorldNeedsUpdate=!0}],[function(e,t){this.resolvedProperty.fromArray(e,t)},function(e,t){this.resolvedProperty.fromArray(e,t),this.targetObject.needsUpdate=!0},function(e,t){this.resolvedProperty.fromArray(e,t),this.targetObject.matrixWorldNeedsUpdate=!0}]],getValue:function(e,t){this.bind(),this.getValue(e,t)},setValue:function(e,t){this.bind(),this.setValue(e,t)},bind:function(){var e=this.node,t=this.parsedPath,n=t.objectName,i=t.propertyName,r=t.propertyIndex;if(e||(e=_.findNode(this.rootNode,t.nodeName)||this.rootNode,this.node=e),this.getValue=this._getValue_unavailable,this.setValue=this._setValue_unavailable,e){if(n){var a=t.objectIndex;switch(n){case"materials":if(!e.material)return void console.error("THREE.PropertyBinding: Can not bind to material as node does not have a material.",this);if(!e.material.materials)return void console.error("THREE.PropertyBinding: Can not bind to material.materials as node.material does not have a materials array.",this);e=e.material.materials;break;case"bones":if(!e.skeleton)return void console.error("THREE.PropertyBinding: Can not bind to bones as node does not have a skeleton.",this);for(var e=e.skeleton.bones,o=0;o<e.length;o++)if(e[o].name===a){a=o;break}break;default:if(void 0===e[n])return void console.error("THREE.PropertyBinding: Can not bind to objectName of node undefined.",this);e=e[n]}if(void 0!==a){if(void 0===e[a])return void console.error("THREE.PropertyBinding: Trying to bind to objectIndex of objectName, but is undefined.",this,e);e=e[a]}}var s=e[i];if(void 0!==s){var c=this.Versioning.None,l=(void 0!==e.needsUpdate?(c=this.Versioning.NeedsUpdate,this.targetObject=e):void 0!==e.matrixWorldNeedsUpdate&&(c=this.Versioning.MatrixWorldNeedsUpdate,this.targetObject=e),this.BindingType.Direct);if(void 0!==r){if("morphTargetInfluences"===i){if(!e.geometry)return void console.error("THREE.PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.",this);if(e.geometry.isBufferGeometry){if(!e.geometry.morphAttributes)return void console.error("THREE.PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.morphAttributes.",this);for(o=0;o<this.node.geometry.morphAttributes.position.length;o++)if(e.geometry.morphAttributes.position[o].name===r){r=o;break}}else{if(!e.geometry.morphTargets)return void console.error("THREE.PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.morphTargets.",this);for(o=0;o<this.node.geometry.morphTargets.length;o++)if(e.geometry.morphTargets[o].name===r){r=o;break}}}l=this.BindingType.ArrayElement,this.resolvedProperty=s,this.propertyIndex=r}else void 0!==s.fromArray&&void 0!==s.toArray?(l=this.BindingType.HasFromToArray,this.resolvedProperty=s):Array.isArray(s)?(l=this.BindingType.EntireArray,this.resolvedProperty=s):this.propertyName=i;this.getValue=this.GetterByBindingType[l],this.setValue=this.SetterByBindingTypeAndVersioning[l][c]}else{s=t.nodeName;console.error("THREE.PropertyBinding: Trying to update property for track: "+s+"."+i+" but it wasn't found.",e)}}else console.error("THREE.PropertyBinding: 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}}),//!\ DECLARE ALIAS AFTER assign prototype !
Object.assign(_.prototype,{_getValue_unbound:_.prototype.getValue,_setValue_unbound:_.prototype.setValue}),Object.assign(yr.prototype,{isAnimationObjectGroup:!0,add:function(){for(var e=this._objects,t=e.length,n=this.nCachedObjects_,i=this._indicesByUUID,r=this._paths,a=this._parsedPaths,o=this._bindings,s=o.length,c=0,l=arguments.length;c!==l;++c){var h=arguments[c],u=h.uuid,d=i[u],p=void 0;if(void 0===d){d=t++,i[u]=d,e.push(h);for(var f=0,m=s;f!==m;++f)o[f].push(new _(h,r[f],a[f]))}else if(d<n){var p=e[d],g=--n,v=e[g];e[i[v.uuid]=d]=v,e[i[u]=g]=h;for(f=0,m=s;f!==m;++f){var y=o[f],x=y[g],b=y[d];y[d]=x,void 0===b&&(b=new _(h,r[f],a[f])),y[g]=b}}else e[d]!==p&&console.error("THREE.AnimationObjectGroup: Different objects with the same UUID detected. Clean the caches or recreate your infrastructure when reloading scenes.")}this.nCachedObjects_=n},remove:function(){for(var e=this._objects,t=this.nCachedObjects_,n=this._indicesByUUID,i=this._bindings,r=i.length,a=0,o=arguments.length;a!==o;++a){var s=arguments[a],c=s.uuid,l=n[c];if(void 0!==l&&t<=l){var h=t++,u=e[h];e[n[u.uuid]=l]=u,e[n[c]=h]=s;for(var d=0,p=r;d!==p;++d){var f=i[d],m=f[h],g=f[l];f[l]=m,f[h]=g}}}this.nCachedObjects_=t},uncache:function(){for(var e=this._objects,t=e.length,n=this.nCachedObjects_,i=this._indicesByUUID,r=this._bindings,a=r.length,o=0,s=arguments.length;o!==s;++o){var c=arguments[o].uuid,l=i[c];if(void 0!==l)if(delete i[c],l<n){var h,u=--n,c=e[u],d=e[h=--t];e[i[c.uuid]=l]=c,e[i[d.uuid]=u]=d,e.pop();for(var p=0,f=a;p!==f;++p){var m=(v=r[p])[u],g=v[h];v[l]=m,v[u]=g,v.pop()}}else{e[i[(d=e[h=--t]).uuid]=l]=d,e.pop();for(var v,p=0,f=a;p!==f;++p)(v=r[p])[l]=v[h],v.pop()}}this.nCachedObjects_=n},subscribe_:function(e,t){var n=this._bindingsIndicesByPath,i=n[e],r=this._bindings;if(void 0!==i)return r[i];var a=this._paths,o=this._parsedPaths,s=this._objects,c=s.length,l=this.nCachedObjects_,h=new Array(c),i=r.length;n[e]=i,a.push(e),o.push(t),r.push(h);for(var u=l,d=s.length;u!==d;++u){var p=s[u];h[u]=new _(p,e,t)}return h},unsubscribe_:function(e){var t,n,i,r,a,o=this._bindingsIndicesByPath,s=o[e];void 0!==s&&(t=this._paths,n=this._parsedPaths,a=(i=this._bindings)[r=i.length-1],i[o[e[r]]=s]=a,i.pop(),n[s]=n[r],n.pop(),t[s]=t[r],t.pop())}}),Object.assign(xr.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(e){return this._startTime=e,this},setLoop:function(e,t){return this.loop=e,this.repetitions=t,this},setEffectiveWeight:function(e){return this.weight=e,this._effectiveWeight=this.enabled?e:0,this.stopFading()},getEffectiveWeight:function(){return this._effectiveWeight},fadeIn:function(e){return this._scheduleFading(e,0,1)},fadeOut:function(e){return this._scheduleFading(e,1,0)},crossFadeFrom:function(e,t,n){var i,r;return e.fadeOut(t),this.fadeIn(t),n&&(r=(n=this._clip.duration)/(i=e._clip.duration),e.warp(1,i/n,t),this.warp(r,1,t)),this},crossFadeTo:function(e,t,n){return e.crossFadeFrom(this,t,n)},stopFading:function(){var e=this._weightInterpolant;return null!==e&&(this._weightInterpolant=null,this._mixer._takeBackControlInterpolant(e)),this},setEffectiveTimeScale:function(e){return this.timeScale=e,this._effectiveTimeScale=this.paused?0:e,this.stopWarping()},getEffectiveTimeScale:function(){return this._effectiveTimeScale},setDuration:function(e){return this.timeScale=this._clip.duration/e,this.stopWarping()},syncWith:function(e){return this.time=e.time,this.timeScale=e.timeScale,this.stopWarping()},halt:function(e){return this.warp(this._effectiveTimeScale,0,e)},warp:function(e,t,n){var i=this._mixer,r=i.time,a=this._timeScaleInterpolant,o=this.timeScale,i=(null===a&&(a=i._lendControlInterpolant(),this._timeScaleInterpolant=a),a.parameterPositions),a=a.sampleValues;return i[0]=r,i[1]=r+n,a[0]=e/o,a[1]=t/o,this},stopWarping:function(){var e=this._timeScaleInterpolant;return null!==e&&(this._timeScaleInterpolant=null,this._mixer._takeBackControlInterpolant(e)),this},getMixer:function(){return this._mixer},getClip:function(){return this._clip},getRoot:function(){return this._localRoot||this._mixer._root},_update:function(e,t,n,i){if(this.enabled){var r=this._startTime;if(null!==r){r=(e-r)*n;if(r<0||0===n)return;this._startTime=null,t=n*r}t*=this._updateTimeScale(e);var a=this._updateTime(t),o=this._updateWeight(e);if(0<o)for(var s=this._interpolants,c=this._propertyBindings,l=0,h=s.length;l!==h;++l)s[l].evaluate(a),c[l].accumulate(i,o)}else this._updateWeight(e)},_updateWeight:function(e){var t,n,i=0;return this.enabled&&(i=this.weight,null!==(t=this._weightInterpolant))&&(i*=n=t.evaluate(e)[0],e>t.parameterPositions[1])&&(this.stopFading(),0===n)&&(this.enabled=!1),this._effectiveWeight=i},_updateTimeScale:function(e){var t,n=0;return this.paused||(n=this.timeScale,null!==(t=this._timeScaleInterpolant)&&(n*=t.evaluate(e)[0],e>t.parameterPositions[1])&&(this.stopWarping(),0===n?this.paused=!0:this.timeScale=n)),this._effectiveTimeScale=n},_updateTime:function(e){var t=this.time+e;if(0!==e){var n=this._clip.duration,i=this.loop,r=this._loopCount;if(2200===i){-1===r&&(this._loopCount=0,this._setEndings(!0,!0,!1));e:{if(n<=t)t=n;else{if(!(t<0))break e;t=0}this.clampWhenFinished?this.paused=!0:this.enabled=!1,this._mixer.dispatchEvent({type:"finished",action:this,direction:e<0?-1:1})}}else{var a,o,i=2202===i;if(-1===r&&(0<=e?this._setEndings(!(r=0),0===this.repetitions,i):this._setEndings(0===this.repetitions,!0,i)),(n<=t||t<0)&&(t-=n*(a=Math.floor(t/n)),r+=Math.abs(a),(o=this.repetitions-r)<0?(this.clampWhenFinished?this.paused=!0:this.enabled=!1,t=0<e?n:0,this._mixer.dispatchEvent({type:"finished",action:this,direction:0<e?1:-1})):(0==o?this._setEndings(o=e<0,!o,i):this._setEndings(!1,!1,i),this._loopCount=r,this._mixer.dispatchEvent({type:"loop",action:this,loopDelta:a}))),i&&1==(1&r))return n-(this.time=t)}this.time=t}return t},_setEndings:function(e,t,n){var i=this._interpolantSettings;n?(i.endingStart=2401,i.endingEnd=2401):(i.endingStart=e?this.zeroSlopeAtStart?2401:$o:2402,i.endingEnd=t?this.zeroSlopeAtEnd?2401:$o:2402)},_scheduleFading:function(e,t,n){var i=this._mixer,r=i.time,a=this._weightInterpolant,i=(null===a&&(a=i._lendControlInterpolant(),this._weightInterpolant=a),a.parameterPositions),a=a.sampleValues;return i[0]=r,a[0]=t,i[1]=r+e,a[1]=n,this}}),br.prototype=Object.assign(Object.create(p.prototype),{constructor:br,_bindAction:function(e,t){var n=e._localRoot||this._root,i=e._clip.tracks,r=i.length,a=e._propertyBindings,o=e._interpolants,s=n.uuid,e=this._bindingsByRootAndName,c=e[s];void 0===c&&(e[s]=c={});for(var l=0;l!==r;++l){var h=i[l],u=h.name,d=c[u];if(void 0===d){if(void 0!==(d=a[l])){null===d._cacheIndex&&(++d.referenceCount,this._addInactiveBinding(d,s,u));continue}var p=t&&t._propertyBindings[l].binding.parsedPath;++(d=new gr(_.create(n,u,p),h.ValueTypeName,h.getValueSize())).referenceCount,this._addInactiveBinding(d,s,u)}a[l]=d,o[l].resultBuffer=d.buffer}},_activateAction:function(e){if(!this._isActiveAction(e)){var t,n,i;null===e._cacheIndex&&(t=(e._localRoot||this._root).uuid,n=e._clip.uuid,i=this._actionsByClip[n],this._bindAction(e,i&&i.knownActions[0]),this._addInactiveAction(e,n,t));for(var r=e._propertyBindings,a=0,o=r.length;a!==o;++a){var s=r[a];0==s.useCount++&&(this._lendBinding(s),s.saveOriginalState())}this._lendAction(e)}},_deactivateAction:function(e){if(this._isActiveAction(e)){for(var t=e._propertyBindings,n=0,i=t.length;n!==i;++n){var r=t[n];0==--r.useCount&&(r.restoreOriginalState(),this._takeBackBinding(r))}this._takeBackAction(e)}},_initMemoryManager:function(){this._actions=[],this._nActiveActions=0,this._actionsByClip={},this._bindings=[],this._nActiveBindings=0,this._bindingsByRootAndName={},this._controlInterpolants=[],this._nActiveControlInterpolants=0;var e=this;this.stats={actions:{get total(){return e._actions.length},get inUse(){return e._nActiveActions}},bindings:{get total(){return e._bindings.length},get inUse(){return e._nActiveBindings}},controlInterpolants:{get total(){return e._controlInterpolants.length},get inUse(){return e._nActiveControlInterpolants}}}},_isActiveAction:function(e){e=e._cacheIndex;return null!==e&&e<this._nActiveActions},_addInactiveAction:function(e,t,n){var i=this._actions,r=this._actionsByClip,a=r[t];void 0===a?(a={knownActions:[e],actionByRoot:{}},e._byClipCacheIndex=0,r[t]=a):(r=a.knownActions,e._byClipCacheIndex=r.length,r.push(e)),e._cacheIndex=i.length,i.push(e),a.actionByRoot[n]=e},_removeInactiveAction:function(e){var t=this._actions,n=t[t.length-1],i=e._cacheIndex,i=(t[n._cacheIndex=i]=n,t.pop(),e._cacheIndex=null,e._clip.uuid),n=this._actionsByClip,t=n[i],r=t.knownActions,a=r[r.length-1],o=e._byClipCacheIndex;r[a._byClipCacheIndex=o]=a,r.pop(),e._byClipCacheIndex=null,delete t.actionByRoot[(e._localRoot||this._root).uuid],0===r.length&&delete n[i],this._removeInactiveBindingsForAction(e)},_removeInactiveBindingsForAction:function(e){for(var t=e._propertyBindings,n=0,i=t.length;n!==i;++n){var r=t[n];0==--r.referenceCount&&this._removeInactiveBinding(r)}},_lendAction:function(e){var t=this._actions,n=e._cacheIndex,i=this._nActiveActions++,r=t[i];t[e._cacheIndex=i]=e,t[r._cacheIndex=n]=r},_takeBackAction:function(e){var t=this._actions,n=e._cacheIndex,i=--this._nActiveActions,r=t[i];t[e._cacheIndex=i]=e,t[r._cacheIndex=n]=r},_addInactiveBinding:function(e,t,n){var i=this._bindingsByRootAndName,r=i[t],a=this._bindings;void 0===r&&(i[t]=r={}),(r[n]=e)._cacheIndex=a.length,a.push(e)},_removeInactiveBinding:function(e){var t=this._bindings,n=e.binding,i=n.rootNode.uuid,n=n.path,r=this._bindingsByRootAndName,a=r[i],o=t[t.length-1],e=e._cacheIndex;t[o._cacheIndex=e]=o,t.pop(),delete a[n];e:{for(var s in a)break e;delete r[i]}},_lendBinding:function(e){var t=this._bindings,n=e._cacheIndex,i=this._nActiveBindings++,r=t[i];t[e._cacheIndex=i]=e,t[r._cacheIndex=n]=r},_takeBackBinding:function(e){var t=this._bindings,n=e._cacheIndex,i=--this._nActiveBindings,r=t[i];t[e._cacheIndex=i]=e,t[r._cacheIndex=n]=r},_lendControlInterpolant:function(){var e=this._controlInterpolants,t=this._nActiveControlInterpolants++,n=e[t];return void 0===n&&(e[(n=new Ji(new Float32Array(2),new Float32Array(2),1,this._controlInterpolantsResultBuffer)).__cacheIndex=t]=n),n},_takeBackControlInterpolant:function(e){var t=this._controlInterpolants,n=e.__cacheIndex,i=--this._nActiveControlInterpolants,r=t[i];t[e.__cacheIndex=i]=e,t[r.__cacheIndex=n]=r},_controlInterpolantsResultBuffer:new Float32Array(1),clipAction:function(e,t){var n=t||this._root,i=n.uuid,n="string"==typeof e?$i.findByName(n,e):e,e=null!==n?n.uuid:e,r=this._actionsByClip[e],a=null;if(void 0!==r){var o=r.actionByRoot[i];if(void 0!==o)return o;a=r.knownActions[0],null===n&&(n=a._clip)}return null===n?null:(o=new xr(this,n,t),this._bindAction(o,a),this._addInactiveAction(o,e,i),o)},existingAction:function(e,t){var t=t||this._root,n=t.uuid,t="string"==typeof e?$i.findByName(t,e):e,t=t?t.uuid:e,e=this._actionsByClip[t];return void 0!==e&&e.actionByRoot[n]||null},stopAllAction:function(){var e=this._actions,t=this._nActiveActions,n=this._bindings,i=this._nActiveBindings;this._nActiveActions=0;for(var r=this._nActiveBindings=0;r!==t;++r)e[r].reset();for(r=0;r!==i;++r)n[r].useCount=0;return this},update:function(e){e*=this.timeScale;for(var t=this._actions,n=this._nActiveActions,i=this.time+=e,r=Math.sign(e),a=this._accuIndex^=1,o=0;o!==n;++o)t[o]._update(i,e,r,a);for(var s=this._bindings,c=this._nActiveBindings,o=0;o!==c;++o)s[o].apply(a);return this},getRoot:function(){return this._root},uncacheClip:function(e){var t=this._actions,e=e.uuid,n=this._actionsByClip,i=n[e];if(void 0!==i){for(var r=i.knownActions,a=0,o=r.length;a!==o;++a){var s=r[a],c=(this._deactivateAction(s),s._cacheIndex),l=t[t.length-1];s._cacheIndex=null,s._byClipCacheIndex=null,t[l._cacheIndex=c]=l,t.pop(),this._removeInactiveBindingsForAction(s)}delete n[e]}},uncacheRoot:function(e){var t,n=e.uuid,i=this._actionsByClip;for(t in i){var r=i[t].actionByRoot[n];void 0!==r&&(this._deactivateAction(r),this._removeInactiveAction(r))}var a=this._bindingsByRootAndName[n];if(void 0!==a)for(var o in a){o=a[o];o.restoreOriginalState(),this._removeInactiveBinding(o)}},uncacheAction:function(e,t){e=this.existingAction(e,t);null!==e&&(this._deactivateAction(e),this._removeInactiveAction(e))}}),wr.prototype.clone=function(){return new wr(void 0===this.value.clone?this.value:this.value.clone())},_r.prototype=Object.assign(Object.create(J.prototype),{constructor:_r,isInstancedBufferGeometry:!0,copy:function(e){return J.prototype.copy.call(this,e),this.maxInstancedCount=e.maxInstancedCount,this},clone:function(){return(new this.constructor).copy(this)}}),Object.defineProperties(Er.prototype,{count:{get:function(){return this.data.count}},array:{get:function(){return this.data.array}}}),Object.assign(Er.prototype,{isInterleavedBufferAttribute:!0,setX:function(e,t){return this.data.array[e*this.data.stride+this.offset]=t,this},setY:function(e,t){return this.data.array[e*this.data.stride+this.offset+1]=t,this},setZ:function(e,t){return this.data.array[e*this.data.stride+this.offset+2]=t,this},setW:function(e,t){return this.data.array[e*this.data.stride+this.offset+3]=t,this},getX:function(e){return this.data.array[e*this.data.stride+this.offset]},getY:function(e){return this.data.array[e*this.data.stride+this.offset+1]},getZ:function(e){return this.data.array[e*this.data.stride+this.offset+2]},getW:function(e){return this.data.array[e*this.data.stride+this.offset+3]},setXY:function(e,t,n){return e=e*this.data.stride+this.offset,this.data.array[e+0]=t,this.data.array[e+1]=n,this},setXYZ:function(e,t,n,i){return e=e*this.data.stride+this.offset,this.data.array[e+0]=t,this.data.array[e+1]=n,this.data.array[e+2]=i,this},setXYZW:function(e,t,n,i,r){return e=e*this.data.stride+this.offset,this.data.array[e+0]=t,this.data.array[e+1]=n,this.data.array[e+2]=i,this.data.array[e+3]=r,this}}),Object.defineProperty(Tr.prototype,"needsUpdate",{set:function(e){!0===e&&this.version++}}),Object.assign(Tr.prototype,{isInterleavedBuffer:!0,setArray:function(e){if(Array.isArray(e))throw new TypeError("THREE.BufferAttribute: array should be a Typed Array.");this.count=void 0!==e?e.length/this.stride:0,this.array=e},setDynamic:function(e){return this.dynamic=e,this},copy:function(e){return this.array=new e.array.constructor(e.array),this.count=e.count,this.stride=e.stride,this.dynamic=e.dynamic,this},copyAt:function(e,t,n){e*=this.stride,n*=t.stride;for(var i=0,r=this.stride;i<r;i++)this.array[e+i]=t.array[n+i];return this},set:function(e,t){return this.array.set(e,t=void 0===t?0:t),this},clone:function(){return(new this.constructor).copy(this)},onUpload:function(e){return this.onUploadCallback=e,this}}),Mr.prototype=Object.assign(Object.create(Tr.prototype),{constructor:Mr,isInstancedInterleavedBuffer:!0,copy:function(e){return Tr.prototype.copy.call(this,e),this.meshPerAttribute=e.meshPerAttribute,this}}),Sr.prototype=Object.assign(Object.create(w.prototype),{constructor:Sr,isInstancedBufferAttribute:!0,copy:function(e){return w.prototype.copy.call(this,e),this.meshPerAttribute=e.meshPerAttribute,this}}),Object.assign(Ar.prototype,{linePrecision:1,set:function(e,t){this.ray.set(e,t)},setFromCamera:function(e,t){t&&t.isPerspectiveCamera?(this.ray.origin.setFromMatrixPosition(t.matrixWorld),this.ray.direction.set(e.x,e.y,.5).unproject(t).sub(this.ray.origin).normalize()):t&&t.isOrthographicCamera?(this.ray.origin.set(e.x,e.y,(t.near+t.far)/(t.near-t.far)).unproject(t),this.ray.direction.set(0,0,-1).transformDirection(t.matrixWorld)):console.error("THREE.Raycaster: Unsupported camera type.")},intersectObject:function(e,t){var n=[];return Cr(e,this,n,t),n.sort(Rr),n},intersectObjects:function(e,t){var n=[];if(!1===Array.isArray(e))console.warn("THREE.Raycaster.intersectObjects: objects is not an Array.");else{for(var i=0,r=e.length;i<r;i++)Cr(e[i],this,n,t);n.sort(Rr)}return n}}),Object.assign(Lr.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,this.autoStart=!1},getElapsedTime:function(){return this.getDelta(),this.elapsedTime},getDelta:function(){var e,t=0;return this.autoStart&&!this.running?(this.start(),0):(this.running&&(t=((e=("undefined"==typeof performance?Date:performance).now())-this.oldTime)/1e3,this.oldTime=e,this.elapsedTime+=t),t)}}),Object.assign(Pr.prototype,{set:function(e,t,n){return this.radius=e,this.phi=t,this.theta=n,this},clone:function(){return(new this.constructor).copy(this)},copy:function(e){return this.radius=e.radius,this.phi=e.phi,this.theta=e.theta,this},makeSafe:function(){return this.phi=Math.max(1e-6,Math.min(Math.PI-1e-6,this.phi)),this},setFromVector3:function(e){return this.radius=e.length(),0===this.radius?(this.theta=0,this.phi=0):(this.theta=Math.atan2(e.x,e.z),this.phi=Math.acos(Pe.clamp(e.y/this.radius,-1,1))),this}}),Object.assign(Nr.prototype,{set:function(e,t,n){return this.radius=e,this.theta=t,this.y=n,this},clone:function(){return(new this.constructor).copy(this)},copy:function(e){return this.radius=e.radius,this.theta=e.theta,this.y=e.y,this},setFromVector3:function(e){return this.radius=Math.sqrt(e.x*e.x+e.z*e.z),this.theta=Math.atan2(e.x,e.z),this.y=e.y,this}}),((Or.prototype=Object.create(f.prototype)).constructor=Or).prototype.isImmediateRenderObject=!0,((Ir.prototype=Object.create(b.prototype)).constructor=Ir).prototype.update=(Oh=new Ce,Ih=new Ce,Uh=new S,function(){var e=["a","b","c"],t=(this.object.updateMatrixWorld(!0),Uh.getNormalMatrix(this.object.matrixWorld),this.object.matrixWorld),n=this.geometry.attributes.position,i=this.object.geometry;if(i&&i.isGeometry)for(var r=i.vertices,a=i.faces,o=0,s=0,c=a.length;s<c;s++)for(var l=a[s],h=0,u=l.vertexNormals.length;h<u;h++){var d=r[l[e[h]]],p=l.vertexNormals[h];Oh.copy(d).applyMatrix4(t),Ih.copy(p).applyMatrix3(Uh).normalize().multiplyScalar(this.size).add(Oh),n.setXYZ(o,Oh.x,Oh.y,Oh.z),o+=1,n.setXYZ(o,Ih.x,Ih.y,Ih.z),o+=1}else if(i&&i.isBufferGeometry)for(var f=i.attributes.position,m=i.attributes.normal,o=0,h=0,u=f.count;h<u;h++)Oh.set(f.getX(h),f.getY(h),f.getZ(h)).applyMatrix4(t),Ih.set(m.getX(h),m.getY(h),m.getZ(h)),Ih.applyMatrix3(Uh).normalize().multiplyScalar(this.size).add(Oh),n.setXYZ(o,Oh.x,Oh.y,Oh.z),n.setXYZ(o+=1,Ih.x,Ih.y,Ih.z),o+=1;n.needsUpdate=!0}),((Ur.prototype=Object.create(f.prototype)).constructor=Ur).prototype.dispose=function(){this.cone.geometry.dispose(),this.cone.material.dispose()},Ur.prototype.update=(Ph=new Ce,Nh=new Ce,function(){this.light.updateMatrixWorld();var e=this.light.distance||1e3,t=e*Math.tan(this.light.angle);this.cone.scale.set(t,t,e),Ph.setFromMatrixPosition(this.light.matrixWorld),Nh.setFromMatrixPosition(this.light.target.matrixWorld),this.cone.lookAt(Nh.sub(Ph)),void 0!==this.color?this.cone.material.color.set(this.color):this.cone.material.color.copy(this.light.color)}),((Dr.prototype=Object.create(b.prototype)).constructor=Dr).prototype.updateMatrixWorld=(Rh=new Ce,Ch=new Re,Lh=new Re,function(e){var t=this.bones,n=this.geometry,i=n.getAttribute("position");Lh.getInverse(this.root.matrixWorld);for(var r=0,a=0;r<t.length;r++){var o=t[r];o.parent&&o.parent.isBone&&(Ch.multiplyMatrices(Lh,o.matrixWorld),Rh.setFromMatrixPosition(Ch),i.setXYZ(a,Rh.x,Rh.y,Rh.z),Ch.multiplyMatrices(Lh,o.parent.matrixWorld),Rh.setFromMatrixPosition(Ch),i.setXYZ(a+1,Rh.x,Rh.y,Rh.z),a+=2)}n.getAttribute("position").needsUpdate=!0,f.prototype.updateMatrixWorld.call(this,e)}),((Fr.prototype=Object.create(m.prototype)).constructor=Fr).prototype.dispose=function(){this.geometry.dispose(),this.material.dispose()},Fr.prototype.update=function(){void 0!==this.color?this.material.color.set(this.color):this.material.color.copy(this.light.color)},((Br.prototype=Object.create(f.prototype)).constructor=Br).prototype.dispose=function(){this.children[0].geometry.dispose(),this.children[0].material.dispose()},Br.prototype.update=function(){var e=.5*this.light.width,t=.5*this.light.height,n=this.line.geometry.attributes.position,i=n.array;i[0]=e,i[1]=-t,i[2]=0,i[3]=e,i[4]=t,i[5]=0,i[6]=-e,i[7]=t,i[8]=0,i[9]=-e,i[10]=-t,i[11]=0,i[12]=e,i[13]=-t,n.needsUpdate=!(i[14]=0),void 0!==this.color?this.line.material.color.set(this.color):this.line.material.color.copy(this.light.color)},((kr.prototype=Object.create(f.prototype)).constructor=kr).prototype.dispose=function(){this.children[0].geometry.dispose(),this.children[0].material.dispose()},kr.prototype.update=(Mh=new Ce,Sh=new N,Ah=new N,function(){var e=this.children[0];if(void 0!==this.color)this.material.color.set(this.color);else{var t=e.geometry.getAttribute("color");Sh.copy(this.light.color),Ah.copy(this.light.groundColor);for(var n=0,i=t.count;n<i;n++){var r=n<i/2?Sh:Ah;t.setXYZ(n,r.r,r.g,r.b)}t.needsUpdate=!0}e.lookAt(Mh.setFromMatrixPosition(this.light.matrixWorld).negate())}),(Hr.prototype=Object.create(b.prototype)).constructor=Hr,(zr.prototype=Object.create(b.prototype)).constructor=zr,((Gr.prototype=Object.create(b.prototype)).constructor=Gr).prototype.update=(_h=new Ce,Eh=new Ce,Th=new S,function(){this.object.updateMatrixWorld(!0),Th.getNormalMatrix(this.object.matrixWorld);for(var e=this.object.matrixWorld,t=this.geometry.attributes.position,n=this.object.geometry,i=n.vertices,r=n.faces,a=0,o=0,s=r.length;o<s;o++){var c=r[o],l=c.normal;_h.copy(i[c.a]).add(i[c.b]).add(i[c.c]).divideScalar(3).applyMatrix4(e),Eh.copy(l).applyMatrix3(Th).normalize().multiplyScalar(this.size).add(_h),t.setXYZ(a,_h.x,_h.y,_h.z),a+=1,t.setXYZ(a,Eh.x,Eh.y,Eh.z),a+=1}t.needsUpdate=!0}),((Vr.prototype=Object.create(f.prototype)).constructor=Vr).prototype.dispose=function(){this.lightPlane.geometry.dispose(),this.lightPlane.material.dispose(),this.targetLine.geometry.dispose(),this.targetLine.material.dispose()},Vr.prototype.update=(xh=new Ce,bh=new Ce,wh=new Ce,function(){xh.setFromMatrixPosition(this.light.matrixWorld),bh.setFromMatrixPosition(this.light.target.matrixWorld),wh.subVectors(bh,xh),this.lightPlane.lookAt(wh),void 0!==this.color?(this.lightPlane.material.color.set(this.color),this.targetLine.material.color.set(this.color)):(this.lightPlane.material.color.copy(this.light.color),this.targetLine.material.color.copy(this.light.color)),this.targetLine.lookAt(wh),this.targetLine.scale.z=wh.length()}),((jr.prototype=Object.create(b.prototype)).constructor=jr).prototype.update=(vh=new Ce,yh=new Te,function(){mh=this.geometry,gh=this.pointMap,yh.projectionMatrix.copy(this.camera.projectionMatrix),i("c",0,0,-1),i("t",0,0,1),i("n1",-1,-1,-1),i("n2",1,-1,-1),i("n3",-1,1,-1),i("n4",1,1,-1),i("f1",-1,-1,1),i("f2",1,-1,1),i("f3",-1,1,1),i("f4",1,1,1),i("u1",.7,1.1,-1),i("u2",-.7,1.1,-1),i("u3",0,2,-1),i("cf1",-1,0,1),i("cf2",1,0,1),i("cf3",0,-1,1),i("cf4",0,1,1),i("cn1",-1,0,-1),i("cn2",1,0,-1),i("cn3",0,-1,-1),i("cn4",0,1,-1),mh.getAttribute("position").needsUpdate=!0}),((Wr.prototype=Object.create(b.prototype)).constructor=Wr).prototype.update=(fh=new ye,function(e){var t,n,i;void 0!==e&&console.warn("THREE.BoxHelper: .update() has no longer arguments."),void 0!==this.object&&fh.setFromObject(this.object),fh.isEmpty()||(e=fh.min,t=fh.max,(i=(n=this.geometry.attributes.position).array)[0]=t.x,i[1]=t.y,i[2]=t.z,i[3]=e.x,i[4]=t.y,i[5]=t.z,i[6]=e.x,i[7]=e.y,i[8]=t.z,i[9]=t.x,i[10]=e.y,i[11]=t.z,i[12]=t.x,i[13]=t.y,i[14]=e.z,i[15]=e.x,i[16]=t.y,i[17]=e.z,i[18]=e.x,i[19]=e.y,i[20]=e.z,i[21]=t.x,i[22]=e.y,i[23]=e.z,n.needsUpdate=!0,this.geometry.computeBoundingSphere())}),Wr.prototype.setFromObject=function(e){return this.object=e,this.update(),this},((Xr.prototype=Object.create(b.prototype)).constructor=Xr).prototype.updateMatrixWorld=function(e){var t=this.box;t.isEmpty()||(t.getCenter(this.position),t.getSize(this.scale),this.scale.multiplyScalar(.5),f.prototype.updateMatrixWorld.call(this,e))},((qr.prototype=Object.create(y.prototype)).constructor=qr).prototype.updateMatrixWorld=function(e){var t=-this.plane.constant;Math.abs(t)<1e-8&&(t=1e-8),this.scale.set(.5*this.size,.5*this.size,t),this.lookAt(this.plane.normal),f.prototype.updateMatrixWorld.call(this,e)},((Yr.prototype=Object.create(f.prototype)).constructor=Yr).prototype.setDirection=(th=new Ce,function(e){.99999<e.y?this.quaternion.set(0,0,0,1):e.y<-.99999?this.quaternion.set(1,0,0,0):(th.set(e.z,0,-e.x).normalize(),eh=Math.acos(e.y),this.quaternion.setFromAxisAngle(th,eh))}),Yr.prototype.setLength=function(e,t,n){void 0===t&&(t=.2*e),void 0===n&&(n=.2*t),this.line.scale.set(1,Math.max(0,e-t),1),this.line.updateMatrix(),this.cone.scale.set(n,t,n),this.cone.position.y=e,this.cone.updateMatrix()},Yr.prototype.setColor=function(e){this.line.material.color.copy(e),this.cone.material.color.copy(e)},(Zr.prototype=Object.create(b.prototype)).constructor=Zr,Vh={createMultiMaterialObject:function(e,t){for(var n=new Qt,i=0,r=t.length;i<r;i++)n.add(new m(e,t[i]));return n},detach:function(e,t,n){e.applyMatrix(t.matrixWorld),t.remove(e),n.add(e)},attach:function(e,t,n){e.applyMatrix((new Re).getInverse(n.matrixWorld)),t.remove(e),n.add(e)}},c.create=function(e,t){return console.log("THREE.Curve.create() has been deprecated"),e.prototype=Object.create(c.prototype),(e.prototype.constructor=e).prototype.getPoint=t,e},Object.assign(Li.prototype,{createPointsGeometry:function(e){console.warn("THREE.CurvePath: .createPointsGeometry() has been removed. Use new THREE.Geometry().setFromPoints( points ) instead.");e=this.getPoints(e);return this.createGeometry(e)},createSpacedPointsGeometry:function(e){console.warn("THREE.CurvePath: .createSpacedPointsGeometry() has been removed. Use new THREE.Geometry().setFromPoints( points ) instead.");e=this.getSpacedPoints(e);return this.createGeometry(e)},createGeometry:function(e){console.warn("THREE.CurvePath: .createGeometry() has been removed. Use new THREE.Geometry().setFromPoints( points ) instead.");for(var t=new x,n=0,i=e.length;n<i;n++){var r=e[n];t.vertices.push(new Ce(r.x,r.y,r.z||0))}return t}}),Object.assign(Pi.prototype,{fromPoints:function(e){console.warn("THREE.Path: .fromPoints() has been renamed to .setFromPoints()."),this.setFromPoints(e)}}),Jr.prototype=Object.create(n.prototype),Kr.prototype=Object.create(n.prototype),Qr.prototype=Object.create(n.prototype),Object.assign(Qr.prototype,{initFromArray:function(){console.error("THREE.Spline: .initFromArray() has been removed.")},getControlPointsArray:function(){console.error("THREE.Spline: .getControlPointsArray() has been removed.")},reparametrizeByArcLength:function(){console.error("THREE.Spline: .reparametrizeByArcLength() has been removed.")}}),Hr.prototype.setColors=function(){console.error("THREE.GridHelper: setColors() has been deprecated, pass them in the constructor instead.")},Dr.prototype.update=function(){console.error("THREE.SkeletonHelper: update() no longer needs to be called.")},Object.assign(nr.prototype,{extractUrlBase:function(e){return console.warn("THREE.Loader: .extractUrlBase() has been deprecated. Use THREE.LoaderUtils.extractUrlBase() instead."),ql.extractUrlBase(e)}}),Object.assign(fe.prototype,{center:function(e){return console.warn("THREE.Box2: .center() has been renamed to .getCenter()."),this.getCenter(e)},empty:function(){return console.warn("THREE.Box2: .empty() has been renamed to .isEmpty()."),this.isEmpty()},isIntersectionBox:function(e){return console.warn("THREE.Box2: .isIntersectionBox() has been renamed to .intersectsBox()."),this.intersectsBox(e)},size:function(e){return console.warn("THREE.Box2: .size() has been renamed to .getSize()."),this.getSize(e)}}),Object.assign(ye.prototype,{center:function(e){return console.warn("THREE.Box3: .center() has been renamed to .getCenter()."),this.getCenter(e)},empty:function(){return console.warn("THREE.Box3: .empty() has been renamed to .isEmpty()."),this.isEmpty()},isIntersectionBox:function(e){return console.warn("THREE.Box3: .isIntersectionBox() has been renamed to .intersectsBox()."),this.intersectsBox(e)},isIntersectionSphere:function(e){return console.warn("THREE.Box3: .isIntersectionSphere() has been renamed to .intersectsSphere()."),this.intersectsSphere(e)},size:function(e){return console.warn("THREE.Box3: .size() has been renamed to .getSize()."),this.getSize(e)}}),nt.prototype.center=function(e){return console.warn("THREE.Line3: .center() has been renamed to .getCenter()."),this.getCenter(e)},Object.assign(Pe,{random16:function(){return console.warn("THREE.Math: .random16() has been deprecated. Use Math.random() instead."),Math.random()},nearestPowerOfTwo:function(e){return console.warn("THREE.Math: .nearestPowerOfTwo() has been renamed to .floorPowerOfTwo()."),Pe.floorPowerOfTwo(e)},nextPowerOfTwo:function(e){return console.warn("THREE.Math: .nextPowerOfTwo() has been renamed to .ceilPowerOfTwo()."),Pe.ceilPowerOfTwo(e)}}),Object.assign(S.prototype,{flattenToArrayOffset:function(e,t){return console.warn("THREE.Matrix3: .flattenToArrayOffset() has been deprecated. Use .toArray() instead."),this.toArray(e,t)},multiplyVector3:function(e){return console.warn("THREE.Matrix3: .multiplyVector3() has been removed. Use vector.applyMatrix3( matrix ) instead."),e.applyMatrix3(this)},multiplyVector3Array:function(){console.error("THREE.Matrix3: .multiplyVector3Array() has been removed.")},applyToBuffer:function(e){return console.warn("THREE.Matrix3: .applyToBuffer() has been removed. Use matrix.applyToBufferAttribute( attribute ) instead."),this.applyToBufferAttribute(e)},applyToVector3Array:function(){console.error("THREE.Matrix3: .applyToVector3Array() has been removed.")}}),Object.assign(Re.prototype,{extractPosition:function(e){return console.warn("THREE.Matrix4: .extractPosition() has been renamed to .copyPosition()."),this.copyPosition(e)},flattenToArrayOffset:function(e,t){return console.warn("THREE.Matrix4: .flattenToArrayOffset() has been deprecated. Use .toArray() instead."),this.toArray(e,t)},getPosition:function(){return void 0===Gh&&(Gh=new Ce),console.warn("THREE.Matrix4: .getPosition() has been removed. Use Vector3.setFromMatrixPosition( matrix ) instead."),Gh.setFromMatrixColumn(this,3)},setRotationFromQuaternion:function(e){return console.warn("THREE.Matrix4: .setRotationFromQuaternion() has been renamed to .makeRotationFromQuaternion()."),this.makeRotationFromQuaternion(e)},multiplyToArray:function(){console.warn("THREE.Matrix4: .multiplyToArray() has been removed.")},multiplyVector3:function(e){return console.warn("THREE.Matrix4: .multiplyVector3() has been removed. Use vector.applyMatrix4( matrix ) instead."),e.applyMatrix4(this)},multiplyVector4:function(e){return console.warn("THREE.Matrix4: .multiplyVector4() has been removed. Use vector.applyMatrix4( matrix ) instead."),e.applyMatrix4(this)},multiplyVector3Array:function(){console.error("THREE.Matrix4: .multiplyVector3Array() has been removed.")},rotateAxis:function(e){console.warn("THREE.Matrix4: .rotateAxis() has been removed. Use Vector3.transformDirection( matrix ) instead."),e.transformDirection(this)},crossVector:function(e){return console.warn("THREE.Matrix4: .crossVector() has been removed. Use vector.applyMatrix4( matrix ) instead."),e.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(e){return console.warn("THREE.Matrix4: .applyToBuffer() has been removed. Use matrix.applyToBufferAttribute( attribute ) instead."),this.applyToBufferAttribute(e)},applyToVector3Array:function(){console.error("THREE.Matrix4: .applyToVector3Array() has been removed.")},makeFrustum:function(e,t,n,i,r,a){return console.warn("THREE.Matrix4: .makeFrustum() has been removed. Use .makePerspective( left, right, top, bottom, near, far ) instead."),this.makePerspective(e,t,i,n,r,a)}}),be.prototype.isIntersectionLine=function(e){return console.warn("THREE.Plane: .isIntersectionLine() has been renamed to .intersectsLine()."),this.intersectsLine(e)},h.prototype.multiplyVector3=function(e){return console.warn("THREE.Quaternion: .multiplyVector3() has been removed. Use is now vector.applyQuaternion( quaternion ) instead."),e.applyQuaternion(this)},Object.assign(tt.prototype,{isIntersectionBox:function(e){return console.warn("THREE.Ray: .isIntersectionBox() has been renamed to .intersectsBox()."),this.intersectsBox(e)},isIntersectionPlane:function(e){return console.warn("THREE.Ray: .isIntersectionPlane() has been renamed to .intersectsPlane()."),this.intersectsPlane(e)},isIntersectionSphere:function(e){return console.warn("THREE.Ray: .isIntersectionSphere() has been renamed to .intersectsSphere()."),this.intersectsSphere(e)}}),Object.assign(Ni.prototype,{extractAllPoints:function(e){return console.warn("THREE.Shape: .extractAllPoints() has been removed. Use .extractPoints() instead."),this.extractPoints(e)},extrude:function(e){return console.warn("THREE.Shape: .extrude() has been removed. Use ExtrudeGeometry() instead."),new Un(this,e)},makeGeometry:function(e){return console.warn("THREE.Shape: .makeGeometry() has been removed. Use ShapeGeometry() instead."),new Wn(this,e)}}),Object.assign(te.prototype,{fromAttribute:function(e,t,n){return console.warn("THREE.Vector2: .fromAttribute() has been renamed to .fromBufferAttribute()."),this.fromBufferAttribute(e,t,n)},distanceToManhattan:function(e){return console.warn("THREE.Vector2: .distanceToManhattan() has been renamed to .manhattanDistanceTo()."),this.manhattanDistanceTo(e)},lengthManhattan:function(){return console.warn("THREE.Vector2: .lengthManhattan() has been renamed to .manhattanLength()."),this.manhattanLength()}}),Object.assign(Ce.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(e){return console.warn("THREE.Vector3: .getPositionFromMatrix() has been renamed to .setFromMatrixPosition()."),this.setFromMatrixPosition(e)},getScaleFromMatrix:function(e){return console.warn("THREE.Vector3: .getScaleFromMatrix() has been renamed to .setFromMatrixScale()."),this.setFromMatrixScale(e)},getColumnFromMatrix:function(e,t){return console.warn("THREE.Vector3: .getColumnFromMatrix() has been renamed to .setFromMatrixColumn()."),this.setFromMatrixColumn(t,e)},applyProjection:function(e){return console.warn("THREE.Vector3: .applyProjection() has been removed. Use .applyMatrix4( m ) instead."),this.applyMatrix4(e)},fromAttribute:function(e,t,n){return console.warn("THREE.Vector3: .fromAttribute() has been renamed to .fromBufferAttribute()."),this.fromBufferAttribute(e,t,n)},distanceToManhattan:function(e){return console.warn("THREE.Vector3: .distanceToManhattan() has been renamed to .manhattanDistanceTo()."),this.manhattanDistanceTo(e)},lengthManhattan:function(){return console.warn("THREE.Vector3: .lengthManhattan() has been renamed to .manhattanLength()."),this.manhattanLength()}}),Object.assign(Le.prototype,{fromAttribute:function(e,t,n){return console.warn("THREE.Vector4: .fromAttribute() has been renamed to .fromBufferAttribute()."),this.fromBufferAttribute(e,t,n)},lengthManhattan:function(){return console.warn("THREE.Vector4: .lengthManhattan() has been renamed to .manhattanLength()."),this.manhattanLength()}}),x.prototype.computeTangents=function(){console.warn("THREE.Geometry: .computeTangents() has been removed.")},Object.assign(f.prototype,{getChildByName:function(e){return console.warn("THREE.Object3D: .getChildByName() has been renamed to .getObjectByName()."),this.getObjectByName(e)},renderDepth:function(){console.warn("THREE.Object3D: .renderDepth has been removed. Use .renderOrder, instead.")},translate:function(e,t){return console.warn("THREE.Object3D: .translate() has been removed. Use .translateOnAxis( axis, distance ) instead."),this.translateOnAxis(t,e)}}),Object.defineProperties(f.prototype,{eulerOrder:{get:function(){return console.warn("THREE.Object3D: .eulerOrder is now .rotation.order."),this.rotation.order},set:function(e){console.warn("THREE.Object3D: .eulerOrder is now .rotation.order."),this.rotation.order=e}},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(Wt.prototype,{objects:{get:function(){return console.warn("THREE.LOD: .objects has been renamed to .levels."),this.levels}}}),Object.defineProperty(Xt.prototype,"useVertexTexture",{get:function(){console.warn("THREE.Skeleton: useVertexTexture has been removed.")},set:function(){console.warn("THREE.Skeleton: useVertexTexture has been removed.")}}),Object.defineProperty(c.prototype,"__arcLengthDivisions",{get:function(){return console.warn("THREE.Curve: .__arcLengthDivisions is now .arcLengthDivisions."),this.arcLengthDivisions},set:function(e){console.warn("THREE.Curve: .__arcLengthDivisions is now .arcLengthDivisions."),this.arcLengthDivisions=e}}),g.prototype.setLens=function(e,t){console.warn("THREE.PerspectiveCamera.setLens is deprecated. Use .setFocalLength and .filmGauge for a photographic setup."),void 0!==t&&(this.filmGauge=t),this.setFocalLength(e)},Object.defineProperties(o.prototype,{onlyShadow:{set:function(){console.warn("THREE.Light: .onlyShadow has been removed.")}},shadowCameraFov:{set:function(e){console.warn("THREE.Light: .shadowCameraFov is now .shadow.camera.fov."),this.shadow.camera.fov=e}},shadowCameraLeft:{set:function(e){console.warn("THREE.Light: .shadowCameraLeft is now .shadow.camera.left."),this.shadow.camera.left=e}},shadowCameraRight:{set:function(e){console.warn("THREE.Light: .shadowCameraRight is now .shadow.camera.right."),this.shadow.camera.right=e}},shadowCameraTop:{set:function(e){console.warn("THREE.Light: .shadowCameraTop is now .shadow.camera.top."),this.shadow.camera.top=e}},shadowCameraBottom:{set:function(e){console.warn("THREE.Light: .shadowCameraBottom is now .shadow.camera.bottom."),this.shadow.camera.bottom=e}},shadowCameraNear:{set:function(e){console.warn("THREE.Light: .shadowCameraNear is now .shadow.camera.near."),this.shadow.camera.near=e}},shadowCameraFar:{set:function(e){console.warn("THREE.Light: .shadowCameraFar is now .shadow.camera.far."),this.shadow.camera.far=e}},shadowCameraVisible:{set:function(){console.warn("THREE.Light: .shadowCameraVisible has been removed. Use new THREE.CameraHelper( light.shadow.camera ) instead.")}},shadowBias:{set:function(e){console.warn("THREE.Light: .shadowBias is now .shadow.bias."),this.shadow.bias=e}},shadowDarkness:{set:function(){console.warn("THREE.Light: .shadowDarkness has been removed.")}},shadowMapWidth:{set:function(e){console.warn("THREE.Light: .shadowMapWidth is now .shadow.mapSize.width."),this.shadow.mapSize.width=e}},shadowMapHeight:{set:function(e){console.warn("THREE.Light: .shadowMapHeight is now .shadow.mapSize.height."),this.shadow.mapSize.height=e}}}),Object.defineProperties(w.prototype,{length:{get:function(){return console.warn("THREE.BufferAttribute: .length has been deprecated. Use .count instead."),this.array.length}}}),Object.assign(J.prototype,{addIndex:function(e){console.warn("THREE.BufferGeometry: .addIndex() has been renamed to .setIndex()."),this.setIndex(e)},addDrawCall:function(e,t,n){void 0!==n&&console.warn("THREE.BufferGeometry: .addDrawCall() no longer supports indexOffset."),console.warn("THREE.BufferGeometry: .addDrawCall() is now .addGroup()."),this.addGroup(e,t)},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(J.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(wr.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(t.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 N}},shading:{get:function(){console.error("THREE."+this.type+": .shading has been removed. Use the boolean .flatShading instead.")},set:function(e){console.warn("THREE."+this.type+": .shading has been removed. Use the boolean .flatShading instead."),this.flatShading=1===e}}}),Object.defineProperties(ai.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(et.prototype,{derivatives:{get:function(){return console.warn("THREE.ShaderMaterial: .derivatives has been moved to .extensions.derivatives."),this.extensions.derivatives},set:function(e){console.warn("THREE. ShaderMaterial: .derivatives has been moved to .extensions.derivatives."),this.extensions.derivatives=e}}}),Object.assign(Bt.prototype,{getCurrentRenderTarget:function(){return console.warn("THREE.WebGLRenderer: .getCurrentRenderTarget() is now .getRenderTarget()."),this.getRenderTarget()},getMaxAnisotropy:function(){return console.warn("THREE.WebGLRenderer: .getMaxAnisotropy() is now .capabilities.getMaxAnisotropy()."),this.capabilities.getMaxAnisotropy()},getPrecision:function(){return console.warn("THREE.WebGLRenderer: .getPrecision() is now .capabilities.precision."),this.capabilities.precision},resetGLState:function(){return console.warn("THREE.WebGLRenderer: .resetGLState() is now .state.reset()."),this.state.reset()},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(e){console.warn("THREE.WebGLRenderer: .enableScissorTest() is now .setScissorTest()."),this.setScissorTest(e)},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(Bt.prototype,{shadowMapEnabled:{get:function(){return this.shadowMap.enabled},set:function(e){console.warn("THREE.WebGLRenderer: .shadowMapEnabled is now .shadowMap.enabled."),this.shadowMap.enabled=e}},shadowMapType:{get:function(){return this.shadowMap.type},set:function(e){console.warn("THREE.WebGLRenderer: .shadowMapType is now .shadowMap.type."),this.shadowMap.type=e}},shadowMapCullFace:{get:function(){return this.shadowMap.cullFace},set:function(e){console.warn("THREE.WebGLRenderer: .shadowMapCullFace is now .shadowMap.cullFace."),this.shadowMap.cullFace=e}}}),Object.defineProperties(Be.prototype,{cullFace:{get:function(){return this.renderReverseSided?ba:xa},set:function(e){e=e!==xa;console.warn("WebGLRenderer: .shadowMap.cullFace is deprecated. Set .shadowMap.renderReverseSided to "+e+"."),this.renderReverseSided=e}}}),Object.defineProperties(L.prototype,{wrapS:{get:function(){return console.warn("THREE.WebGLRenderTarget: .wrapS is now .texture.wrapS."),this.texture.wrapS},set:function(e){console.warn("THREE.WebGLRenderTarget: .wrapS is now .texture.wrapS."),this.texture.wrapS=e}},wrapT:{get:function(){return console.warn("THREE.WebGLRenderTarget: .wrapT is now .texture.wrapT."),this.texture.wrapT},set:function(e){console.warn("THREE.WebGLRenderTarget: .wrapT is now .texture.wrapT."),this.texture.wrapT=e}},magFilter:{get:function(){return console.warn("THREE.WebGLRenderTarget: .magFilter is now .texture.magFilter."),this.texture.magFilter},set:function(e){console.warn("THREE.WebGLRenderTarget: .magFilter is now .texture.magFilter."),this.texture.magFilter=e}},minFilter:{get:function(){return console.warn("THREE.WebGLRenderTarget: .minFilter is now .texture.minFilter."),this.texture.minFilter},set:function(e){console.warn("THREE.WebGLRenderTarget: .minFilter is now .texture.minFilter."),this.texture.minFilter=e}},anisotropy:{get:function(){return console.warn("THREE.WebGLRenderTarget: .anisotropy is now .texture.anisotropy."),this.texture.anisotropy},set:function(e){console.warn("THREE.WebGLRenderTarget: .anisotropy is now .texture.anisotropy."),this.texture.anisotropy=e}},offset:{get:function(){return console.warn("THREE.WebGLRenderTarget: .offset is now .texture.offset."),this.texture.offset},set:function(e){console.warn("THREE.WebGLRenderTarget: .offset is now .texture.offset."),this.texture.offset=e}},repeat:{get:function(){return console.warn("THREE.WebGLRenderTarget: .repeat is now .texture.repeat."),this.texture.repeat},set:function(e){console.warn("THREE.WebGLRenderTarget: .repeat is now .texture.repeat."),this.texture.repeat=e}},format:{get:function(){return console.warn("THREE.WebGLRenderTarget: .format is now .texture.format."),this.texture.format},set:function(e){console.warn("THREE.WebGLRenderTarget: .format is now .texture.format."),this.texture.format=e}},type:{get:function(){return console.warn("THREE.WebGLRenderTarget: .type is now .texture.type."),this.texture.type},set:function(e){console.warn("THREE.WebGLRenderTarget: .type is now .texture.type."),this.texture.type=e}},generateMipmaps:{get:function(){return console.warn("THREE.WebGLRenderTarget: .generateMipmaps is now .texture.generateMipmaps."),this.texture.generateMipmaps},set:function(e){console.warn("THREE.WebGLRenderTarget: .generateMipmaps is now .texture.generateMipmaps."),this.texture.generateMipmaps=e}}}),Object.assign(It.prototype,{getStandingMatrix:function(){console.warn("THREE.WebVRManager: .getStandingMatrix() has been removed.")}}),Object.defineProperties(It.prototype,{standing:{set:function(){console.warn("THREE.WebVRManager: .standing has been removed.")}}}),pr.prototype.load=function(e){console.warn("THREE.Audio: .load has been deprecated. Use THREE.AudioLoader instead.");var t=this;return(new lr).load(e,function(e){t.setBuffer(e)}),this},mr.prototype.getData=function(){return console.warn("THREE.AudioAnalyser: .getData() is now .getFrequencyData()."),this.getFrequencyData()},ur.prototype.updateCubeMap=function(e,t){return console.warn("THREE.CubeCamera: .updateCubeMap() is now .update()."),this.update(e,t)},jh={merge:function(e,t,n){var i;console.warn("THREE.GeometryUtils: .merge() has been moved to Geometry. Use geometry.merge( geometry2, matrix, materialIndexOffset ) instead."),t.isMesh&&(t.matrixAutoUpdate&&t.updateMatrix(),i=t.matrix,t=t.geometry),e.merge(t,i,n)},center:function(e){return console.warn("THREE.GeometryUtils: .center() has been moved to Geometry. Use geometry.center() instead."),e.center()}},Wh={crossOrigin:void 0,loadTexture:function(e,t,n,i){console.warn("THREE.ImageUtils.loadTexture has been deprecated. Use THREE.TextureLoader() instead.");var r=new gi,r=(r.setCrossOrigin(this.crossOrigin),r.load(e,n,void 0,i));return t&&(r.mapping=t),r},loadTextureCube:function(e,t,n,i){console.warn("THREE.ImageUtils.loadTextureCube has been deprecated. Use THREE.CubeTextureLoader() instead.");var r=new mi,r=(r.setCrossOrigin(this.crossOrigin),r.load(e,n,void 0,i));return t&&(r.mapping=t),r},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.")}},e.WebGLRenderTargetCube=P,e.WebGLRenderTarget=L,e.WebGLRenderer=Bt,e.ShaderLib=Ts,e.UniformsLib=Ne,e.UniformsUtils=Es,e.ShaderChunk=E,e.FogExp2=kt,e.Fog=Ht,e.Scene=zt,e.LensFlare=Gt,e.Sprite=jt,e.LOD=Wt,e.SkinnedMesh=Yt,e.Skeleton=Xt,e.Bone=qt,e.Mesh=m,e.LineSegments=b,e.LineLoop=Zt,e.Line=y,e.Points=Kt,e.Group=Qt,e.VideoTexture=$t,e.DataTexture=Oe,e.CompressedTexture=en,e.CubeTexture=O,e.CanvasTexture=me,e.DepthTexture=tn,e.Texture=d,e.CompressedTextureLoader=di,e.DataTextureLoader=pi,e.CubeTextureLoader=mi,e.TextureLoader=gi,e.ObjectLoader=rr,e.MaterialLoader=er,e.BufferGeometryLoader=tr,e.DefaultLoadingManager=a,e.LoadingManager=hi,e.JSONLoader=ir,e.ImageLoader=fi,e.ImageBitmapLoader=ar,e.FontLoader=cr,e.FileLoader=ui,e.Loader=nr,e.LoaderUtils=ql,e.Cache=Il,e.AudioLoader=lr,e.SpotLightShadow=Ui,e.SpotLight=Di,e.PointLight=Fi,e.RectAreaLight=zi,e.HemisphereLight=Oi,e.DirectionalLightShadow=Bi,e.DirectionalLight=ki,e.AmbientLight=Hi,e.LightShadow=Ii,e.Light=o,e.StereoCamera=hr,e.PerspectiveCamera=g,e.OrthographicCamera=Me,e.CubeCamera=ur,e.ArrayCamera=Ot,e.OrigamiCamera=Te,e.AudioListener=dr,e.PositionalAudio=fr,e.AudioContext=zh,e.AudioAnalyser=mr,e.Audio=pr,e.VectorKeyframeTrack=Qi,e.StringKeyframeTrack=Gi,e.QuaternionKeyframeTrack=Xi,e.NumberKeyframeTrack=Yi,e.ColorKeyframeTrack=qi,e.BooleanKeyframeTrack=Vi,e.PropertyMixer=gr,e.PropertyBinding=_,e.KeyframeTrack=s,e.AnimationUtils=T,e.AnimationObjectGroup=yr,e.AnimationMixer=br,e.AnimationClip=$i,e.Uniform=wr,e.InstancedBufferGeometry=_r,e.BufferGeometry=J,e.Geometry=x,e.InterleavedBufferAttribute=Er,e.InstancedInterleavedBuffer=Mr,e.InterleavedBuffer=Tr,e.InstancedBufferAttribute=Sr,e.Face3=Se,e.Object3D=f,e.Raycaster=Ar,e.Layers=_e,e.EventDispatcher=p,e.Clock=Lr,e.QuaternionLinearInterpolant=Wi,e.LinearInterpolant=Ji,e.DiscreteInterpolant=Ki,e.CubicInterpolant=Zi,e.Interpolant=ji,e.Triangle=it,e.Math=Pe,e.Spherical=Pr,e.Cylindrical=Nr,e.Plane=be,e.Frustum=Fe,e.Sphere=xe,e.Ray=tt,e.Matrix4=Re,e.Matrix3=S,e.Box3=ye,e.Box2=fe,e.Line3=nt,e.Euler=we,e.Vector4=Le,e.Vector3=Ce,e.Vector2=te,e.Quaternion=h,e.Color=N,e.ImmediateRenderObject=Or,e.VertexNormalsHelper=Ir,e.SpotLightHelper=Ur,e.SkeletonHelper=Dr,e.PointLightHelper=Fr,e.RectAreaLightHelper=Br,e.HemisphereLightHelper=kr,e.GridHelper=Hr,e.PolarGridHelper=zr,e.FaceNormalsHelper=Gr,e.DirectionalLightHelper=Vr,e.CameraHelper=jr,e.BoxHelper=Wr,e.Box3Helper=Xr,e.PlaneHelper=qr,e.ArrowHelper=Yr,e.AxesHelper=Zr,e.Shape=Ni,e.Path=Pi,e.ShapePath=or,e.Font=sr,e.CurvePath=Li,e.Curve=c,e.ShapeUtils=Pl,e.SceneUtils=Vh,e.WebGLUtils=Ft,e.WireframeGeometry=nn,e.ParametricGeometry=rn,e.ParametricBufferGeometry=an,e.TetrahedronGeometry=cn,e.TetrahedronBufferGeometry=ln,e.OctahedronGeometry=hn,e.OctahedronBufferGeometry=un,e.IcosahedronGeometry=dn,e.IcosahedronBufferGeometry=pn,e.DodecahedronGeometry=fn,e.DodecahedronBufferGeometry=mn,e.PolyhedronGeometry=on,e.PolyhedronBufferGeometry=sn,e.TubeGeometry=gn,e.TubeBufferGeometry=vn,e.TorusKnotGeometry=yn,e.TorusKnotBufferGeometry=xn,e.TorusGeometry=bn,e.TorusBufferGeometry=wn,e.TextGeometry=Fn,e.TextBufferGeometry=Bn,e.SphereGeometry=kn,e.SphereBufferGeometry=Hn,e.RingGeometry=zn,e.RingBufferGeometry=Gn,e.PlaneGeometry=Ke,e.PlaneBufferGeometry=Qe,e.LatheGeometry=Vn,e.LatheBufferGeometry=jn,e.ShapeGeometry=Wn,e.ShapeBufferGeometry=Xn,e.ExtrudeGeometry=Un,e.ExtrudeBufferGeometry=Dn,e.EdgesGeometry=Yn,e.ConeGeometry=Kn,e.ConeBufferGeometry=Qn,e.CylinderGeometry=Zn,e.CylinderBufferGeometry=Jn,e.CircleGeometry=$n,e.CircleBufferGeometry=ei,e.BoxGeometry=Ze,e.BoxBufferGeometry=Je,e.ShadowMaterial=ti,e.SpriteMaterial=Vt,e.RawShaderMaterial=ni,e.ShaderMaterial=et,e.PointsMaterial=Jt,e.MeshPhysicalMaterial=ri,e.MeshStandardMaterial=ii,e.MeshPhongMaterial=ai,e.MeshToonMaterial=oi,e.MeshNormalMaterial=si,e.MeshLambertMaterial=ci,e.MeshDepthMaterial=ge,e.MeshDistanceMaterial=ve,e.MeshBasicMaterial=$e,e.LineDashedMaterial=li,e.LineBasicMaterial=v,e.Material=t,e.Float64BufferAttribute=Xe,e.Float32BufferAttribute=ne,e.Uint32BufferAttribute=We,e.Int32BufferAttribute=je,e.Uint16BufferAttribute=Ve,e.Int16BufferAttribute=Ge,e.Uint8ClampedBufferAttribute=ze,e.Uint8BufferAttribute=He,e.Int8BufferAttribute=Ae,e.BufferAttribute=w,e.ArcCurve=yi,e.CatmullRomCurve3=n,e.CubicBezierCurve=Ei,e.CubicBezierCurve3=Ti,e.EllipseCurve=vi,e.LineCurve=Mi,e.LineCurve3=Si,e.QuadraticBezierCurve=Ai,e.QuadraticBezierCurve3=Ri,e.SplineCurve=Ci,e.REVISION="89",e.MOUSE={LEFT:0,MIDDLE:1,RIGHT:2},e.CullFaceNone=ya,e.CullFaceBack=xa,e.CullFaceFront=ba,e.CullFaceFrontBack=3,e.FrontFaceDirectionCW=0,e.FrontFaceDirectionCCW=1,e.BasicShadowMap=0,e.PCFShadowMap=wa,e.PCFSoftShadowMap=_a,e.FrontSide=Ea,e.BackSide=Ta,e.DoubleSide=Ma,e.FlatShading=1,e.SmoothShading=2,e.NoColors=0,e.FaceColors=1,e.VertexColors=2,e.NoBlending=Sa,e.NormalBlending=Aa,e.AdditiveBlending=Ra,e.SubtractiveBlending=Ca,e.MultiplyBlending=La,e.CustomBlending=Pa,e.AddEquation=Na,e.SubtractEquation=Oa,e.ReverseSubtractEquation=Ia,e.MinEquation=Ua,e.MaxEquation=Da,e.ZeroFactor=Fa,e.OneFactor=Ba,e.SrcColorFactor=ka,e.OneMinusSrcColorFactor=Ha,e.SrcAlphaFactor=za,e.OneMinusSrcAlphaFactor=Ga,e.DstAlphaFactor=Va,e.OneMinusDstAlphaFactor=ja,e.DstColorFactor=Wa,e.OneMinusDstColorFactor=Xa,e.SrcAlphaSaturateFactor=qa,e.NeverDepth=Ya,e.AlwaysDepth=Za,e.LessDepth=Ja,e.LessEqualDepth=Ka,e.EqualDepth=Qa,e.GreaterEqualDepth=$a,e.GreaterDepth=eo,e.NotEqualDepth=to,e.MultiplyOperation=no,e.MixOperation=io,e.AddOperation=ro,e.NoToneMapping=ao,e.LinearToneMapping=oo,e.ReinhardToneMapping=so,e.Uncharted2ToneMapping=co,e.CineonToneMapping=lo,e.UVMapping=300,e.CubeReflectionMapping=ho,e.CubeRefractionMapping=uo,e.EquirectangularReflectionMapping=po,e.EquirectangularRefractionMapping=fo,e.SphericalReflectionMapping=mo,e.CubeUVReflectionMapping=go,e.CubeUVRefractionMapping=vo,e.RepeatWrapping=yo,e.ClampToEdgeWrapping=A,e.MirroredRepeatWrapping=xo,e.NearestFilter=R,e.NearestMipMapNearestFilter=bo,e.NearestMipMapLinearFilter=wo,e.LinearFilter=C,e.LinearMipMapNearestFilter=_o,e.LinearMipMapLinearFilter=Eo,e.UnsignedByteType=To,e.ByteType=Mo,e.ShortType=So,e.UnsignedShortType=Ao,e.IntType=Ro,e.UnsignedIntType=Co,e.FloatType=Lo,e.HalfFloatType=Po,e.UnsignedShort4444Type=No,e.UnsignedShort5551Type=Oo,e.UnsignedShort565Type=Io,e.UnsignedInt248Type=Uo,e.AlphaFormat=Do,e.RGBFormat=Fo,e.RGBAFormat=Bo,e.LuminanceFormat=ko,e.LuminanceAlphaFormat=Ho,e.RGBEFormat=zo,e.DepthFormat=Go,e.DepthStencilFormat=Vo,e.RGB_S3TC_DXT1_Format=jo,e.RGBA_S3TC_DXT1_Format=Wo,e.RGBA_S3TC_DXT3_Format=Xo,e.RGBA_S3TC_DXT5_Format=qo,e.RGB_PVRTC_4BPPV1_Format=Yo,e.RGB_PVRTC_2BPPV1_Format=Zo,e.RGBA_PVRTC_4BPPV1_Format=Jo,e.RGBA_PVRTC_2BPPV1_Format=Ko,e.RGB_ETC1_Format=Qo,e.LoopOnce=2200,e.LoopRepeat=2201,e.LoopPingPong=2202,e.InterpolateDiscrete=2300,e.InterpolateLinear=2301,e.InterpolateSmooth=2302,e.ZeroCurvatureEnding=$o,e.ZeroSlopeEnding=2401,e.WrapAroundEnding=2402,e.TrianglesDrawMode=es,e.TriangleStripDrawMode=1,e.TriangleFanDrawMode=2,e.LinearEncoding=ts,e.sRGBEncoding=ns,e.GammaEncoding=is,e.RGBEEncoding=rs,e.LogLuvEncoding=3003,e.RGBM7Encoding=as,e.RGBM16Encoding=os,e.RGBDEncoding=ss,e.BasicDepthPacking=cs,e.RGBADepthPacking=ls,e.CubeGeometry=Ze,e.Face4=function(e,t,n,i,r,a,o){return console.warn("THREE.Face4 has been removed. A THREE.Face3 will be created instead."),new Se(e,t,n,r,a,o)},e.LineStrip=0,e.LinePieces=1,e.MeshFaceMaterial=function(e){return console.warn("THREE.MeshFaceMaterial has been removed. Use an Array instead."),e},e.MultiMaterial=function(e){return void 0===e&&(e=[]),console.warn("THREE.MultiMaterial has been removed. Use an Array instead."),e.isMultiMaterial=!0,(e.materials=e).clone=function(){return e.slice()},e},e.PointCloud=function(e,t){return console.warn("THREE.PointCloud has been renamed to THREE.Points."),new Kt(e,t)},e.Particle=function(e){return console.warn("THREE.Particle has been renamed to THREE.Sprite."),new jt(e)},e.ParticleSystem=function(e,t){return console.warn("THREE.ParticleSystem has been renamed to THREE.Points."),new Kt(e,t)},e.PointCloudMaterial=function(e){return console.warn("THREE.PointCloudMaterial has been renamed to THREE.PointsMaterial."),new Jt(e)},e.ParticleBasicMaterial=function(e){return console.warn("THREE.ParticleBasicMaterial has been renamed to THREE.PointsMaterial."),new Jt(e)},e.ParticleSystemMaterial=function(e){return console.warn("THREE.ParticleSystemMaterial has been renamed to THREE.PointsMaterial."),new Jt(e)},e.Vertex=function(e,t,n){return console.warn("THREE.Vertex has been removed. Use THREE.Vector3 instead."),new Ce(e,t,n)},e.DynamicBufferAttribute=function(e,t){return console.warn("THREE.DynamicBufferAttribute has been removed. Use new THREE.BufferAttribute().setDynamic( true ) instead."),new w(e,t).setDynamic(!0)},e.Int8Attribute=function(e,t){return console.warn("THREE.Int8Attribute has been removed. Use new THREE.Int8BufferAttribute() instead."),new Ae(e,t)},e.Uint8Attribute=function(e,t){return console.warn("THREE.Uint8Attribute has been removed. Use new THREE.Uint8BufferAttribute() instead."),new He(e,t)},e.Uint8ClampedAttribute=function(e,t){return console.warn("THREE.Uint8ClampedAttribute has been removed. Use new THREE.Uint8ClampedBufferAttribute() instead."),new ze(e,t)},e.Int16Attribute=function(e,t){return console.warn("THREE.Int16Attribute has been removed. Use new THREE.Int16BufferAttribute() instead."),new Ge(e,t)},e.Uint16Attribute=function(e,t){return console.warn("THREE.Uint16Attribute has been removed. Use new THREE.Uint16BufferAttribute() instead."),new Ve(e,t)},e.Int32Attribute=function(e,t){return console.warn("THREE.Int32Attribute has been removed. Use new THREE.Int32BufferAttribute() instead."),new je(e,t)},e.Uint32Attribute=function(e,t){return console.warn("THREE.Uint32Attribute has been removed. Use new THREE.Uint32BufferAttribute() instead."),new We(e,t)},e.Float32Attribute=function(e,t){return console.warn("THREE.Float32Attribute has been removed. Use new THREE.Float32BufferAttribute() instead."),new ne(e,t)},e.Float64Attribute=function(e,t){return console.warn("THREE.Float64Attribute has been removed. Use new THREE.Float64BufferAttribute() instead."),new Xe(e,t)},e.ClosedSplineCurve3=Jr,e.SplineCurve3=Kr,e.Spline=Qr,e.AxisHelper=function(e){return console.warn("THREE.AxisHelper has been renamed to THREE.AxesHelper."),new Zr(e)},e.BoundingBoxHelper=function(e,t){return console.warn("THREE.BoundingBoxHelper has been deprecated. Creating a THREE.BoxHelper instead."),new Wr(e,t)},e.EdgesHelper=function(e,t){return console.warn("THREE.EdgesHelper has been removed. Use THREE.EdgesGeometry instead."),new b(new Yn(e.geometry),new v({color:void 0!==t?t:16777215}))},e.WireframeHelper=function(e,t){return console.warn("THREE.WireframeHelper has been removed. Use THREE.WireframeGeometry instead."),new b(new nn(e.geometry),new v({color:void 0!==t?t:16777215}))},e.XHRLoader=function(e){return console.warn("THREE.XHRLoader has been renamed to THREE.FileLoader."),new ui(e)},e.BinaryTextureLoader=function(e){return console.warn("THREE.BinaryTextureLoader has been renamed to THREE.DataTextureLoader."),new pi(e)},e.GeometryUtils=jh,e.ImageUtils=Wh,e.Projector=function(){console.error("THREE.Projector has been moved to /examples/js/renderers/Projector.js."),this.projectVector=function(e,t){console.warn("THREE.Projector: .projectVector() is now vector.project()."),e.project(t)},this.unprojectVector=function(e,t){console.warn("THREE.Projector: .unprojectVector() is now vector.unproject()."),e.unproject(t)},this.pickingRay=function(){console.error("THREE.Projector: .pickingRay() is now raycaster.setFromCamera().")}},e.CanvasRenderer=function(){console.error("THREE.CanvasRenderer has been moved to /examples/js/renderers/CanvasRenderer.js"),this.domElement=document.createElementNS("http://www.w3.org/1999/xhtml","canvas"),this.clear=function(){},this.render=function(){},this.setClearColor=function(){},this.setSize=function(){}},window.THREE=e,Object.defineProperty(e,"__esModule",{value:!0})},function(r,a,e){!function(t){function e(){this._tweens={},this._tweensAddedDuringUpdate={}}var n;e.prototype={getAll:function(){return Object.keys(this._tweens).map(function(e){return this._tweens[e]}.bind(this))},removeAll:function(){this._tweens={}},add:function(e){this._tweens[e.getId()]=e,this._tweensAddedDuringUpdate[e.getId()]=e},remove:function(e){delete this._tweens[e.getId()],delete this._tweensAddedDuringUpdate[e.getId()]},update:function(e,t){var n=Object.keys(this._tweens);if(0===n.length)return!1;for(e=void 0!==e?e:s.now();0<n.length;){this._tweensAddedDuringUpdate={};for(var i=0;i<n.length;i++){var r=this._tweens[n[i]];r&&!1===r.update(e)&&(r._isPlaying=!1,t||delete this._tweens[n[i]])}n=Object.keys(this._tweensAddedDuringUpdate)}return!0}};var i,s=new e;s.Group=e,s._nextId=0,s.nextId=function(){return s._nextId++},"undefined"==typeof window&&void 0!==t?s.now=function(){var e=t.hrtime();return 1e3*e[0]+e[1]/1e6}:"undefined"!=typeof window&&void 0!==window.performance&&void 0!==window.performance.now?s.now=window.performance.now.bind(window.performance):void 0!==Date.now?s.now=Date.now:s.now=function(){return(new Date).getTime()},s.Tween=function(e,t){this._object=e,this._valuesStart={},this._valuesEnd={},this._valuesStartRepeat={},this._duration=1e3,this._repeat=0,this._repeatDelayTime=void 0,this._yoyo=!1,this._isPlaying=!1,this._reversed=!1,this._delayTime=0,this._startTime=null,this._easingFunction=s.Easing.Linear.None,this._interpolationFunction=s.Interpolation.Linear,this._chainedTweens=[],this._onStartCallback=null,this._onStartCallbackFired=!1,this._onUpdateCallback=null,this._onCompleteCallback=null,this._onStopCallback=null,this._group=t||s,this._id=s.nextId()},s.Tween.prototype={getId:function(){return this._id},isPlaying:function(){return this._isPlaying},to:function(e,t){return this._valuesEnd=e,void 0!==t&&(this._duration=t),this},start:function(e){for(var t in this._group.add(this),this._isPlaying=!0,this._onStartCallbackFired=!1,this._startTime=void 0!==e?"string"==typeof e?s.now()+parseFloat(e):e:s.now(),this._startTime+=this._delayTime,this._valuesEnd){if(this._valuesEnd[t]instanceof Array){if(0===this._valuesEnd[t].length)continue;this._valuesEnd[t]=[this._object[t]].concat(this._valuesEnd[t])}void 0!==this._object[t]&&(this._valuesStart[t]=this._object[t],this._valuesStart[t]instanceof Array==0&&(this._valuesStart[t]*=1),this._valuesStartRepeat[t]=this._valuesStart[t]||0)}return this},stop:function(){return this._isPlaying&&(this._group.remove(this),this._isPlaying=!1,null!==this._onStopCallback&&this._onStopCallback(this._object),this.stopChainedTweens()),this},end:function(){return this.update(this._startTime+this._duration),this},stopChainedTweens:function(){for(var e=0,t=this._chainedTweens.length;e<t;e++)this._chainedTweens[e].stop()},group:function(e){return this._group=e,this},delay:function(e){return this._delayTime=e,this},repeat:function(e){return this._repeat=e,this},repeatDelay:function(e){return this._repeatDelayTime=e,this},yoyo:function(e){return this._yoyo=e,this},easing:function(e){return this._easingFunction=e,this},interpolation:function(e){return this._interpolationFunction=e,this},chain:function(){return this._chainedTweens=arguments,this},onStart:function(e){return this._onStartCallback=e,this},onUpdate:function(e){return this._onUpdateCallback=e,this},onComplete:function(e){return this._onCompleteCallback=e,this},onStop:function(e){return this._onStopCallback=e,this},update:function(e){var t,n,i,r,a,o;if(e<this._startTime)return!0;for(t in!1===this._onStartCallbackFired&&(null!==this._onStartCallback&&this._onStartCallback(this._object),this._onStartCallbackFired=!0),n=(e-this._startTime)/this._duration,n=0===this._duration||1<n?1:n,i=this._easingFunction(n),this._valuesEnd)void 0!==this._valuesStart[t]&&(r=this._valuesStart[t]||0,(a=this._valuesEnd[t])instanceof Array?this._object[t]=this._interpolationFunction(a,i):"number"==typeof(a="string"==typeof a?"+"===a.charAt(0)||"-"===a.charAt(0)?r+parseFloat(a):parseFloat(a):a)&&(this._object[t]=r+(a-r)*i));if(null!==this._onUpdateCallback&&this._onUpdateCallback(this._object),1!=n)return!0;if(0<this._repeat){for(t in isFinite(this._repeat)&&this._repeat--,this._valuesStartRepeat)"string"==typeof this._valuesEnd[t]&&(this._valuesStartRepeat[t]=this._valuesStartRepeat[t]+parseFloat(this._valuesEnd[t])),this._yoyo&&(o=this._valuesStartRepeat[t],this._valuesStartRepeat[t]=this._valuesEnd[t],this._valuesEnd[t]=o),this._valuesStart[t]=this._valuesStartRepeat[t];return this._yoyo&&(this._reversed=!this._reversed),void 0!==this._repeatDelayTime?this._startTime=e+this._repeatDelayTime:this._startTime=e+this._delayTime,!0}null!==this._onCompleteCallback&&this._onCompleteCallback(this._object);for(var s=0,c=this._chainedTweens.length;s<c;s++)this._chainedTweens[s].start(this._startTime+this._duration);return!1}},s.Easing={Linear:{None:function(e){return e}},Quadratic:{In:function(e){return e*e},Out:function(e){return e*(2-e)},InOut:function(e){return(e*=2)<1?.5*e*e:-.5*(--e*(e-2)-1)}},Cubic:{In:function(e){return e*e*e},Out:function(e){return--e*e*e+1},InOut:function(e){return(e*=2)<1?.5*e*e*e:.5*((e-=2)*e*e+2)}},Quartic:{In:function(e){return e*e*e*e},Out:function(e){return 1- --e*e*e*e},InOut:function(e){return(e*=2)<1?.5*e*e*e*e:-.5*((e-=2)*e*e*e-2)}},Quintic:{In:function(e){return e*e*e*e*e},Out:function(e){return--e*e*e*e*e+1},InOut:function(e){return(e*=2)<1?.5*e*e*e*e*e:.5*((e-=2)*e*e*e*e+2)}},Sinusoidal:{In:function(e){return 1-Math.cos(e*Math.PI/2)},Out:function(e){return Math.sin(e*Math.PI/2)},InOut:function(e){return.5*(1-Math.cos(Math.PI*e))}},Exponential:{In:function(e){return 0===e?0:Math.pow(1024,e-1)},Out:function(e){return 1===e?1:1-Math.pow(2,-10*e)},InOut:function(e){return 0===e?0:1===e?1:(e*=2)<1?.5*Math.pow(1024,e-1):.5*(2-Math.pow(2,-10*(e-1)))}},Circular:{In:function(e){return 1-Math.sqrt(1-e*e)},Out:function(e){return Math.sqrt(1- --e*e)},InOut:function(e){return(e*=2)<1?-.5*(Math.sqrt(1-e*e)-1):.5*(Math.sqrt(1-(e-=2)*e)+1)}},Elastic:{In:function(e){return 0===e?0:1===e?1:-Math.pow(2,10*(e-1))*Math.sin(5*(e-1.1)*Math.PI)},Out:function(e){return 0===e?0:1===e?1:Math.pow(2,-10*e)*Math.sin(5*(e-.1)*Math.PI)+1},InOut:function(e){return 0===e?0:1===e?1:(e*=2)<1?-.5*Math.pow(2,10*(e-1))*Math.sin(5*(e-1.1)*Math.PI):.5*Math.pow(2,-10*(e-1))*Math.sin(5*(e-1.1)*Math.PI)+1}},Back:{In:function(e){return e*e*(2.70158*e-1.70158)},Out:function(e){return--e*e*(2.70158*e+1.70158)+1},InOut:function(e){var t=2.5949095;return(e*=2)<1?e*e*((1+t)*e-t)*.5:.5*((e-=2)*e*((1+t)*e+t)+2)}},Bounce:{In:function(e){return 1-s.Easing.Bounce.Out(1-e)},Out:function(e){return e<1/2.75?7.5625*e*e:e<2/2.75?7.5625*(e-=1.5/2.75)*e+.75:e<2.5/2.75?7.5625*(e-=2.25/2.75)*e+.9375:7.5625*(e-=2.625/2.75)*e+.984375},InOut:function(e){return e<.5?.5*s.Easing.Bounce.In(2*e):.5*s.Easing.Bounce.Out(2*e-1)+.5}}},s.Interpolation={Linear:function(e,t){var n=e.length-1,i=n*t,r=Math.floor(i),a=s.Interpolation.Utils.Linear;return t<0?a(e[0],e[1],i):1<t?a(e[n],e[n-1],n-i):a(e[r],e[n<r+1?n:r+1],i-r)},Bezier:function(e,t){for(var n=0,i=e.length-1,r=Math.pow,a=s.Interpolation.Utils.Bernstein,o=0;o<=i;o++)n+=r(1-t,i-o)*r(t,o)*e[o]*a(i,o);return n},CatmullRom:function(e,t){var n=e.length-1,i=n*t,r=Math.floor(i),a=s.Interpolation.Utils.CatmullRom;return e[0]===e[n]?a(e[((r=t<0?Math.floor(i=n*(1+t)):r)-1+n)%n],e[r],e[(r+1)%n],e[(r+2)%n],i-r):t<0?e[0]-(a(e[0],e[0],e[1],e[1],-i)-e[0]):1<t?e[n]-(a(e[n],e[n],e[n-1],e[n-1],i-n)-e[n]):a(e[r?r-1:0],e[r],e[n<r+1?n:r+1],e[n<r+2?n:r+2],i-r)},Utils:{Linear:function(e,t,n){return(t-e)*n+e},Bernstein:function(e,t){var n=s.Interpolation.Utils.Factorial;return n(e)/n(t)/n(e-t)},Factorial:(i=[1],function(e){var t=1;if(i[e])return i[e];for(var n=e;1<n;n--)t*=n;return i[e]=t}),CatmullRom:function(e,t,n,i,r){var e=.5*(n-e),i=.5*(i-t),a=r*r;return r*a*(2*t-2*n+e+i)+(-3*t+3*n-2*e-i)*a+e*r+t}}},void 0!==(n=function(){return s}.apply(a,[]))&&(r.exports=n)}.call(this,e(9))},function(e,t){var i={canvas:!!window.CanvasRenderingContext2D,webgl:(()=>{try{var e=document.createElement("canvas");return!(!window.WebGLRenderingContext||!e.getContext("webgl")&&!e.getContext("experimental-webgl"))}catch(e){return!1}})(),workers:!!window.Worker,fileapi:window.File&&window.FileReader&&window.FileList&&window.Blob,getWebGLErrorMessage:function(){var e=document.createElement("div");return e.id="webgl-error-message",e.style.fontFamily="monospace",e.style.fontSize="13px",e.style.fontWeight="normal",e.style.textAlign="center",e.style.background="#fff",e.style.color="#000",e.style.padding="1.5em",e.style.width="400px",e.style.margin="5em auto 0",this.webgl||(e.innerHTML=(window.WebGLRenderingContext?['Your graphics card does not seem to support <a href="http://khronos.org/webgl/wiki/Getting_a_WebGL_Implementation" style="color:#000">WebGL</a>.<br />','Find out how to get it <a href="http://get.webgl.org/" style="color:#000">here</a>.']:['Your browser does not seem to support <a href="http://khronos.org/webgl/wiki/Getting_a_WebGL_Implementation" style="color:#000">WebGL</a>.<br/>','Find out how to get it <a href="http://get.webgl.org/" style="color:#000">here</a>.']).join("\n")),e},addGetWebGLMessage:function(e){var t,n=void 0!==(e=e||{}).parent?e.parent:document.body,e=void 0!==e.id?e.id:"oldie";(t=i.getWebGLErrorMessage()).id=e,n.appendChild(t)}};e.exports=i},function(e,t){e.exports='<div class="preloader">\r\n <div class="cube-wrapper">\r\n <div class="cube-folding">\r\n <span class="leaf1"></span>\r\n <span class="leaf2"></span>\r\n <span class="leaf3"></span>\r\n <span class="leaf4"></span>\r\n </div>\r\n <span class="processing">Processing...</span>\r\n </div>\r\n</div>'},function(e,t){e.exports="<style id=\"preloaderStyles\">\r\n .preloader {\r\n position: relative;\r\n left: 0;\r\n right: 0;\r\n top: 0;\r\n bottom: 0;\r\n background-color: #fff;\r\n z-index: 9999;\r\n opacity: 1;\r\n }\r\n\r\n .cube-folding {\r\n width: 50px;\r\n height: 50px;\r\n display: inline-block;\r\n -moz-transform: rotate(45deg);\r\n -ms-transform: rotate(45deg);\r\n -webkit-transform: rotate(45deg);\r\n transform: rotate(45deg);\r\n font-size: 0;\r\n }\r\n\r\n .cube-folding span {\r\n position: relative;\r\n width: 25px;\r\n height: 25px;\r\n -moz-transform: scale(1.1);\r\n -ms-transform: scale(1.1);\r\n -webkit-transform: scale(1.1);\r\n transform: scale(1.1);\r\n display: inline-block;\r\n }\r\n\r\n .cube-folding span::before {\r\n content: '';\r\n background-color: #30c2ff;\r\n position: absolute;\r\n left: 0;\r\n top: 0;\r\n display: block;\r\n width: 25px;\r\n height: 25px;\r\n -moz-transform-origin: 100% 100%;\r\n -ms-transform-origin: 100% 100%;\r\n -webkit-transform-origin: 100% 100%;\r\n transform-origin: 100% 100%;\r\n -moz-animation: folding 2.5s infinite linear both;\r\n -webkit-animation: folding 2.5s infinite linear both;\r\n animation: folding 2.5s infinite linear both;\r\n }\r\n\r\n .cube-folding .leaf2 {\r\n -moz-transform: rotateZ(90deg) scale(1.1);\r\n -ms-transform: rotateZ(90deg) scale(1.1);\r\n -webkit-transform: rotateZ(90deg) scale(1.1);\r\n transform: rotateZ(90deg) scale(1.1);\r\n }\r\n\r\n .cube-folding .leaf2::before {\r\n -moz-animation-delay: 0.3s;\r\n -webkit-animation-delay: 0.3s;\r\n animation-delay: 0.3s;\r\n background-color: #17baff;\r\n }\r\n\r\n .cube-folding .leaf3 {\r\n -moz-transform: rotateZ(270deg) scale(1.1);\r\n -ms-transform: rotateZ(270deg) scale(1.1);\r\n -webkit-transform: rotateZ(270deg) scale(1.1);\r\n transform: rotateZ(270deg) scale(1.1);\r\n }\r\n\r\n .cube-folding .leaf3::before {\r\n -moz-animation-delay: 0.9s;\r\n -webkit-animation-delay: 0.9s;\r\n animation-delay: 0.9s;\r\n background-color: #17baff;\r\n }\r\n\r\n .cube-folding .leaf4 {\r\n -moz-transform: rotateZ(180deg) scale(1.1);\r\n -ms-transform: rotateZ(180deg) scale(1.1);\r\n -webkit-transform: rotateZ(180deg) scale(1.1);\r\n transform: rotateZ(180deg) scale(1.1);\r\n }\r\n\r\n .cube-folding .leaf4::before {\r\n -moz-animation-delay: 0.6s;\r\n -webkit-animation-delay: 0.6s;\r\n animation-delay: 0.6s;\r\n background-color: #00b2fc;\r\n }\r\n\r\n @-moz-keyframes folding {\r\n\r\n 0%,\r\n 10% {\r\n -moz-transform: perspective(140px) rotateX(-180deg);\r\n transform: perspective(140px) rotateX(-180deg);\r\n opacity: 0;\r\n }\r\n\r\n 25%,\r\n 75% {\r\n -moz-transform: perspective(140px) rotateX(0deg);\r\n transform: perspective(140px) rotateX(0deg);\r\n opacity: 1;\r\n }\r\n\r\n 90%,\r\n 100% {\r\n -moz-transform: perspective(140px) rotateY(180deg);\r\n transform: perspective(140px) rotateY(180deg);\r\n opacity: 0;\r\n }\r\n }\r\n\r\n @-webkit-keyframes folding {\r\n\r\n 0%,\r\n 10% {\r\n -webkit-transform: perspective(140px) rotateX(-180deg);\r\n transform: perspective(140px) rotateX(-180deg);\r\n opacity: 0;\r\n }\r\n\r\n 25%,\r\n 75% {\r\n -webkit-transform: perspective(140px) rotateX(0deg);\r\n transform: perspective(140px) rotateX(0deg);\r\n opacity: 1;\r\n }\r\n\r\n 90%,\r\n 100% {\r\n -webkit-transform: perspective(140px) rotateY(180deg);\r\n transform: perspective(140px) rotateY(180deg);\r\n opacity: 0;\r\n }\r\n }\r\n\r\n @keyframes folding {\r\n\r\n 0%,\r\n 10% {\r\n -moz-transform: perspective(140px) rotateX(-180deg);\r\n -ms-transform: perspective(140px) rotateX(-180deg);\r\n -webkit-transform: perspective(140px) rotateX(-180deg);\r\n transform: perspective(140px) rotateX(-180deg);\r\n opacity: 0;\r\n }\r\n\r\n 25%,\r\n 75% {\r\n -moz-transform: perspective(140px) rotateX(0deg);\r\n -ms-transform: perspective(140px) rotateX(0deg);\r\n -webkit-transform: perspective(140px) rotateX(0deg);\r\n transform: perspective(140px) rotateX(0deg);\r\n opacity: 1;\r\n }\r\n\r\n 90%,\r\n 100% {\r\n -moz-transform: perspective(140px) rotateY(180deg);\r\n -ms-transform: perspective(140px) rotateY(180deg);\r\n -webkit-transform: perspective(140px) rotateY(180deg);\r\n transform: perspective(140px) rotateY(180deg);\r\n opacity: 0;\r\n }\r\n }\r\n\r\n .cube-wrapper {\r\n width: 100px;\r\n height: 100px;\r\n text-align: center;\r\n }\r\n\r\n .cube-wrapper .processing {\r\n display: block;\r\n margin-top: 26px;\r\n font-size: 16px;\r\n line-height: 19px;\r\n }\r\n</style>"},function(e,t){e.exports='<style id="containerStyles">\r\n .canvasContainer {\r\n width: 100%;\r\n height: 100%;\r\n display: block;\r\n }\r\n\r\n .preloadContainer {\r\n position: relative;\r\n width: 100%;\r\n height: 100%;\r\n display: flex;\r\n justify-content: center;\r\n align-items: center;\r\n }\r\n\r\n .mainContainer {\r\n width: 100%;\r\n height: 100%;\r\n display: flex;\r\n justify-content: center;\r\n align-items: center;\r\n }\r\n\r\n .canvasContainer>canvas {\r\n height: 100% !important;\r\n width: 100% !important;\r\n }\r\n</style>'},function(e,t){THREE.BlenderColladaLoader=function(e){THREE.Loader.call(this,e)},THREE.BlenderColladaLoader.prototype=Object.assign(Object.create(THREE.Loader.prototype),{constructor:THREE.BlenderColladaLoader,load:function(e,t,n,i){var r=this,a=""===r.path?THREE.LoaderUtils.extractUrlBase(e):r.path,o=new THREE.FileLoader(r.manager);o.setPath(r.path),o.load(e,function(e){t(r.parse(e,a))},n,i)},options:{set convertUpAxis(e){console.warn("THREE.ColladaLoader: options.convertUpAxis() has been removed. Up axis is converted automatically.")}},parse:function(e,t){function s(e,t){for(var n=[],i=e.childNodes,r=0,a=i.length;r<a;r++){var o=i[r];o.nodeName===t&&n.push(o)}return n}function c(e){if(0===e.length)return[];for(var t=e.trim().split(/\s+/),n=new Array(t.length),i=0,r=t.length;i<r;i++)n[i]=parseFloat(t[i]);return n}function l(e){if(0===e.length)return[];for(var t=e.trim().split(/\s+/),n=new Array(t.length),i=0,r=t.length;i<r;i++)n[i]=parseInt(t[i]);return n}function h(e){return e.substring(1)}function d(e){return 0===Object.keys(e).length}function n(e,t,n,i){e=s(e,t)[0];if(void 0!==e)for(var r=s(e,n),a=0;a<r.length;a++)i(r[a])}function i(e,t){for(var n in e)e[n].build=t(e[n])}function T(e,t){return void 0!==e.build||(e.build=t(e)),e.build}function r(e){var t,n=[],i=e.channels,r=e.samplers,a=e.sources;for(t in i)if(i.hasOwnProperty(t)){for(var o=i[t],s=r[o.sampler],c=s.inputs.INPUT,s=s.inputs.OUTPUT,l=(x=y=v=g=m=f=p=d=u=h=l=void 0,((e,t,n)=>{var i,r,a,o,s,c,l=M((u=A.nodes[e.id]).id),h=u.transforms[e.sid],u=u.matrix.clone().transpose(),d={};switch(h){case"matrix":for(a=0,o=t.array.length;a<o;a++)if(i=t.array[a],r=a*n.stride,void 0===d[i]&&(d[i]={}),!0===e.arraySyntax){var p=n.array[r],f=e.indices[0]+4*e.indices[1];d[i][f]=p}else for(s=0,c=n.stride;s<c;s++)d[i][s]=n.array[r+s];break;case"translate":case"rotate":case"scale":console.warn('THREE.ColladaLoader: Animation transform type "%s" not yet implemented.',h)}return u=((e,t)=>{var n,i=[];for(n in e)i.push({time:parseFloat(n),value:e[n]});i.sort(function(e,t){return e.time-t.time});for(var r=0;r<16;r++){y=v=g=p=d=m=f=u=s=o=a=h=l=c=void 0;var a,o,s,c=i,l=r,h=t.elements[r],u=!0;for(o=0,s=c.length;o<s;o++)void 0===(a=c[o]).value[l]?a.value[l]=null:u=!1;if(!0===u)for(o=0,s=c.length;o<s;o++)(a=c[o]).value[l]=h;else for(var d,p,f=c,m=l,g=0,v=f.length;g<v;g++){var y=f[g];null===y.value[m]&&(d=((e,t,n)=>{for(;0<=t;){var i=e[t];if(null!==i.value[n])return i;t--}return null})(f,g,m),p=((e,t,n)=>{for(;t<e.length;){var i=e[t];if(null!==i.value[n])return i;t++}return null})(f,g,m),null===d?y.value[m]=p.value[m]:null===p?y.value[m]=d.value[m]:((e,t,n,i)=>{n.time-t.time!=0?e.value[i]=(e.time-t.time)*(n.value[i]-t.value[i])/(n.time-t.time)+t.value[i]:e.value[i]=t.value[i]})(y,d,p,m))}}return i})(d,u),{name:l.uuid,keyframes:u}})(o,a[c],a[s])),h=n,u=l.keyframes,l=l.name,d=[],p=[],f=[],m=[],g=0,v=u.length;g<v;g++){var y=u[g],x=y.time,y=y.value;E.fromArray(y).transpose(),E.decompose(b,_,w),d.push(x),p.push(b.x,b.y,b.z),f.push(_.x,_.y,_.z,_.w),m.push(w.x,w.y,w.z)}0<p.length&&h.push(new THREE.VectorKeyframeTrack(l+".position",d,p)),0<f.length&&h.push(new THREE.QuaternionKeyframeTrack(l+".quaternion",d,f)),0<m.length&&h.push(new THREE.VectorKeyframeTrack(l+".scale",d,m))}return n}function u(e){return T(A.animations[e],r)}var b=new THREE.Vector3,w=new THREE.Vector3,_=new THREE.Quaternion;function D(e){for(var t=[],n=e.name,i=e.end-e.start||-1,r=e.animations,a=0,o=r.length;a<o;a++)for(var s=u(r[a]),c=0,l=s.length;c<l;c++)t.push(s[c]);return new THREE.AnimationClip(n,i,t)}function F(e){for(var t={sources:{}},n=0,i=e.childNodes.length;n<i;n++){var r=e.childNodes[n];if(1===r.nodeType)switch(r.nodeName){case"bind_shape_matrix":t.bindShapeMatrix=c(r.textContent);break;case"source":var a=r.getAttribute("id");t.sources[a]=o(r);break;case"joints":t.joints=(e=>{for(var t={inputs:{}},n=0,i=e.childNodes.length;n<i;n++){var r,a=e.childNodes[n];1===a.nodeType&&"input"===a.nodeName&&(r=a.getAttribute("semantic"),a=h(a.getAttribute("source")),t.inputs[r]=a)}return t})(r);break;case"vertex_weights":t.vertexWeights=(e=>{for(var t={inputs:{}},n=0,i=e.childNodes.length;n<i;n++){var r=e.childNodes[n];if(1===r.nodeType)switch(r.nodeName){case"input":var a=r.getAttribute("semantic"),o=h(r.getAttribute("source")),s=parseInt(r.getAttribute("offset"));t.inputs[a]={id:o,offset:s};break;case"vcount":t.vcount=l(r.textContent);break;case"v":t.v=l(r.textContent)}}return t})(r)}}return t}function B(e){var t={id:e.id},n=A.geometries[t.id];return void 0!==e.skin&&(t.skin=(e=>{for(var t={joints:[],indices:{array:[],stride:4},weights:{array:[],stride:4}},n=e.sources,i=e.vertexWeights,r=i.vcount,a=i.v,o=i.inputs.JOINT.offset,s=i.inputs.WEIGHT.offset,c=e.sources[e.joints.inputs.JOINT],l=e.sources[e.joints.inputs.INV_BIND_MATRIX],h=n[i.inputs.WEIGHT.id].array,u=0,d=0,p=r.length;d<p;d++){for(var f=r[d],m=[],g=0;g<f;g++){var v=a[u+o],y=h[a[u+s]];m.push({index:v,weight:y}),u+=2}for(m.sort(_),g=0;g<4;g++){var x=m[g];void 0!==x?(t.indices.array.push(x.index),t.weights.array.push(x.weight)):(t.indices.array.push(0),t.weights.array.push(0))}}for(t.bindMatrix=e.bindShapeMatrix?(new THREE.Matrix4).fromArray(e.bindShapeMatrix).transpose():(new THREE.Matrix4).identity(),d=0,p=c.array.length;d<p;d++){var b=c.array[d],w=(new THREE.Matrix4).fromArray(l.array,d*l.stride).transpose();t.joints.push({name:b,boneInverse:w})}return t;function _(e,t){return t.weight-e.weight}})(e.skin),n.sources.skinIndices=t.skin.indices,n.sources.skinWeights=t.skin.weights),t}function k(e){return void 0!==e.build?e.build:e.init_from}function H(e){var t=A.images[e];return void 0!==t?T(t,k):(console.warn("THREE.ColladaLoader: Couldn't find image with ID:",e),null)}function z(e){for(var t={surfaces:{},samplers:{}},n=0,i=e.childNodes.length;n<i;n++){var r=e.childNodes[n];if(1===r.nodeType)switch(r.nodeName){case"newparam":h=l=c=s=o=a=void 0;for(var a=r,o=t,s=a.getAttribute("sid"),c=0,l=a.childNodes.length;c<l;c++){var h=a.childNodes[c];if(1===h.nodeType)switch(h.nodeName){case"surface":o.surfaces[s]=(e=>{for(var t={},n=0,i=e.childNodes.length;n<i;n++){var r=e.childNodes[n];1===r.nodeType&&"init_from"===r.nodeName&&(t.init_from=r.textContent)}return t})(h);break;case"sampler2D":o.samplers[s]=(e=>{for(var t={},n=0,i=e.childNodes.length;n<i;n++){var r=e.childNodes[n];1===r.nodeType&&"source"===r.nodeName&&(t.source=r.textContent)}return t})(h)}}break;case"technique":t.technique=(e=>{for(var t={},n=0,i=e.childNodes.length;n<i;n++){var r=e.childNodes[n];if(1===r.nodeType)switch(r.nodeName){case"constant":case"lambert":case"blinn":case"phong":t.type=r.nodeName,t.parameters=(e=>{for(var t={},n=0,i=e.childNodes.length;n<i;n++){var r=e.childNodes[n];if(1===r.nodeType)switch(r.nodeName){case"emission":case"diffuse":case"specular":case"bump":case"ambient":case"shininess":case"transparency":t[r.nodeName]=G(r);break;case"transparent":t[r.nodeName]={opaque:r.getAttribute("opaque"),data:G(r)}}}return t})(r)}}return t})(r);break;case"extra":t.extra=(e=>{for(var t={},n=0,i=e.childNodes.length;n<i;n++){var r=e.childNodes[n];1===r.nodeType&&"technique"===r.nodeName&&(t.technique=(e=>{for(var t={},n=0,i=e.childNodes.length;n<i;n++){var r=e.childNodes[n];1===r.nodeType&&"double_sided"===r.nodeName&&(t[r.nodeName]=parseInt(r.textContent))}return t})(r))}return t})(r)}}return t}function G(e){for(var t={},n=0,i=e.childNodes.length;n<i;n++){var r=e.childNodes[n];if(1===r.nodeType)switch(r.nodeName){case"color":t[r.nodeName]=c(r.textContent);break;case"float":t[r.nodeName]=parseFloat(r.textContent);break;case"texture":t[r.nodeName]={id:r.getAttribute("texture"),extra:(e=>{for(var t={technique:{}},n=0,i=e.childNodes.length;n<i;n++){var r=e.childNodes[n];1===r.nodeType&&"extra"===r.nodeName&&((e,t)=>{for(var n=0,i=e.childNodes.length;n<i;n++){var r=e.childNodes[n];1===r.nodeType&&"technique"===r.nodeName&&((e,t)=>{for(var n=0,i=e.childNodes.length;n<i;n++){var r=e.childNodes[n];if(1===r.nodeType)switch(r.nodeName){case"repeatU":case"repeatV":case"offsetU":case"offsetV":t.technique[r.nodeName]=parseFloat(r.textContent);break;case"wrapU":case"wrapV":"TRUE"===r.textContent.toUpperCase()?t.technique[r.nodeName]=1:"FALSE"===r.textContent.toUpperCase()?t.technique[r.nodeName]=0:t.technique[r.nodeName]=parseInt(r.textContent)}}})(r,t)}})(r,t)}return t})(r)}}}return t}function V(e){return e}function j(e){n=e.url;var t,r=T(A.effects[n],V),n=r.profile.technique,i=r.profile.extra;switch(n.type){case"phong":case"blinn":t=new THREE.MeshPhongMaterial;break;case"lambert":t=new THREE.MeshLambertMaterial;break;default:t=new THREE.MeshBasicMaterial}function a(e){var t,n=r.profile.samplers[e.id],i=null;return null!==(i=void 0!==n?H(r.profile.surfaces[n.source].init_from):(console.warn("THREE.ColladaLoader: Undefined sampler. Access image directly (see #12530)."),H(e.id)))?void 0!==(n=(e=>e="tga"===e.slice(2+(e.lastIndexOf(".")-1>>>0)).toLowerCase()?de:g)(i))?(n=n.load(i),void 0!==(t=e.extra)&&void 0!==t.technique&&!1===d(t.technique)?(t=t.technique,n.wrapS=t.wrapU?THREE.RepeatWrapping:THREE.ClampToEdgeWrapping,n.wrapT=t.wrapV?THREE.RepeatWrapping:THREE.ClampToEdgeWrapping,n.offset.set(t.offsetU||0,t.offsetV||0),n.repeat.set(t.repeatU||1,t.repeatV||1)):(n.wrapS=THREE.RepeatWrapping,n.wrapT=THREE.RepeatWrapping),n):(console.warn("THREE.ColladaLoader: Loader for texture %s not found.",i),null):(console.warn("THREE.ColladaLoader: Couldn't create texture with ID:",e.id),null)}t.name=e.name||"";var o,s=n.parameters;for(o in s){var c=s[o];switch(o){case"diffuse":c.color&&t.color.fromArray(c.color),c.texture&&(t.map=a(c.texture));break;case"specular":c.color&&t.specular&&t.specular.fromArray(c.color),c.texture&&(t.specularMap=a(c.texture));break;case"bump":c.texture&&(t.normalMap=a(c.texture));break;case"ambient":c.texture&&(t.lightMap=a(c.texture));break;case"shininess":c.float&&t.shininess&&(t.shininess=c.float);break;case"emission":c.color&&t.emissive&&t.emissive.fromArray(c.color),c.texture&&(t.emissiveMap=a(c.texture))}}var l=s.transparent,h=s.transparency;if(void 0===h&&l&&(h={float:1}),(l=void 0===l&&h?{opaque:"A_ONE",data:{color:[1,1,1,1]}}:l)&&h)if(l.data.texture)t.transparent=!0;else{var u=l.data.color;switch(l.opaque){case"A_ONE":t.opacity=u[3]*h.float;break;case"RGB_ZERO":t.opacity=1-u[0]*h.float;break;case"A_ZERO":t.opacity=1-u[3]*h.float;break;case"RGB_ONE":t.opacity=u[0]*h.float;break;default:console.warn('THREE.ColladaLoader: Invalid opaque type "%s" of transparent tag.',l.opaque)}t.opacity<1&&(t.transparent=!0)}return void 0!==i&&void 0!==i.technique&&1===i.technique.double_sided&&(t.side=THREE.DoubleSide),t}function W(e){for(var t=0;t<e.childNodes.length;t++){var n=e.childNodes[t];if("technique_common"===n.nodeName){for(var i=n,r={},a=0;a<i.childNodes.length;a++){var o=i.childNodes[a];switch(o.nodeName){case"perspective":case"orthographic":r.technique=o.nodeName,r.parameters=(e=>{for(var t={},n=0;n<e.childNodes.length;n++){var i=e.childNodes[n];switch(i.nodeName){case"xfov":case"yfov":case"xmag":case"ymag":case"znear":case"zfar":case"aspect_ratio":t[i.nodeName]=parseFloat(i.textContent)}}return t})(o)}}return r}}return{}}function X(e){var t;switch(e.optics.technique){case"perspective":t=new THREE.PerspectiveCamera(e.optics.parameters.yfov,e.optics.parameters.aspect_ratio,e.optics.parameters.znear,e.optics.parameters.zfar);break;case"orthographic":var n=e.optics.parameters.ymag,i=e.optics.parameters.xmag,r=e.optics.parameters.aspect_ratio,i=void 0===i?n*r:i,n=void 0===n?i/r:n;i*=.5,n*=.5,t=new THREE.OrthographicCamera(-i,i,n,-n,e.optics.parameters.znear,e.optics.parameters.zfar);break;default:t=new THREE.PerspectiveCamera}return t.name=e.name||"",t}function q(e){for(var t={},n=0,i=e.childNodes.length;n<i;n++){var r=e.childNodes[n];if(1===r.nodeType)switch(r.nodeName){case"directional":case"point":case"spot":case"ambient":t.technique=r.nodeName,t.parameters=(e=>{for(var t={},n=0,i=e.childNodes.length;n<i;n++){var r=e.childNodes[n];if(1===r.nodeType)switch(r.nodeName){case"color":var a=c(r.textContent);t.color=(new THREE.Color).fromArray(a);break;case"falloff_angle":t.falloffAngle=parseFloat(r.textContent);break;case"quadratic_attenuation":a=parseFloat(r.textContent);t.distance=a?Math.sqrt(1/a):0}}return t})(r)}}return t}function Y(e){var t;switch(e.technique){case"directional":t=new THREE.DirectionalLight;break;case"point":t=new THREE.PointLight;break;case"spot":t=new THREE.SpotLight;break;case"ambient":t=new THREE.AmbientLight}return e.parameters.color&&t.color.copy(e.parameters.color),e.parameters.distance&&(t.distance=e.parameters.distance),t}function o(e){for(var t={array:[],stride:3},n=0;n<e.childNodes.length;n++){var i=e.childNodes[n];if(1===i.nodeType)switch(i.nodeName){case"float_array":t.array=c(i.textContent);break;case"Name_array":t.array=(e=>{if(0===e.length)return[];for(var t=e.trim().split(/\s+/),n=new Array(t.length),i=0,r=t.length;i<r;i++)n[i]=t[i];return n})(i.textContent);break;case"technique_common":var r=s(i,"accessor")[0];void 0!==r&&(t.stride=parseInt(r.getAttribute("stride")))}}return t}function Z(e){var t={},n=e.sources,i=e.vertices,e=e.primitives;if(0===e.length)return{};var r,a=(e=>{for(var t={},n=0;n<e.length;n++){var i=e[n];void 0===t[i.type]&&(t[i.type]=[]),t[i.type].push(i)}return t})(e);for(r in a){for(var o=a[r],s=(h=l=c=s=void 0,o),c=0,l=0,h=s.length;l<h;l++)!0===s[l].hasUV&&c++;0<c&&c<s.length&&(s.uvsNeedsFix=!0),t[r]=((e,t,n)=>{for(var i={},r={array:[],stride:0},a={array:[],stride:0},o={array:[],stride:0},s={array:[],stride:0},c={array:[],stride:0},l=[],h=[],u=new THREE.BufferGeometry,d=[],p=0,f=0;f<e.length;f++){var m,g=e[f],v=g.inputs,y=0;switch(g.type){case"lines":case"linestrips":y=2*g.count;break;case"triangles":y=3*g.count;break;case"polylist":for(var x=0;x<g.count;x++){var b=g.vcount[x];switch(b){case 3:y+=3;break;case 4:y+=6;break;default:y+=3*(b-2)}}break;default:console.warn("THREE.ColladaLoader: Unknow primitive type:",g.type)}for(m in u.addGroup(p,y,f),p+=y,g.material&&d.push(g.material),v){var w=v[m];switch(m){case"VERTEX":for(var _ in n){var E=n[_];switch(_){case"POSITION":var T=r.array.length;if(S(g,t[E],w.offset,r.array),r.stride=t[E].stride,t.skinWeights&&t.skinIndices&&(S(g,t.skinIndices,w.offset,l),S(g,t.skinWeights,w.offset,h)),!1===g.hasUV&&!0===e.uvsNeedsFix){y=(r.array.length-T)/r.stride;for(var M=0;M<y;M++)o.array.push(0,0)}break;case"NORMAL":S(g,t[E],w.offset,a.array),a.stride=t[E].stride;break;case"COLOR":S(g,t[E],w.offset,c.array),c.stride=t[E].stride;break;case"TEXCOORD":S(g,t[E],w.offset,o.array),o.stride=t[E].stride;break;case"TEXCOORD1":S(g,t[E],w.offset,s.array),o.stride=t[E].stride;break;default:console.warn('THREE.ColladaLoader: Semantic "%s" not handled in geometry build process.',_)}}break;case"NORMAL":S(g,t[w.id],w.offset,a.array),a.stride=t[w.id].stride;break;case"COLOR":S(g,t[w.id],w.offset,c.array),c.stride=t[w.id].stride;break;case"TEXCOORD":S(g,t[w.id],w.offset,o.array),o.stride=t[w.id].stride;break;case"TEXCOORD1":S(g,t[w.id],w.offset,s.array),s.stride=t[w.id].stride}}}return 0<r.array.length&&(u.attributes.position=new THREE.Float32BufferAttribute(r.array,r.stride)),0<a.array.length&&(u.attributes.normal=new THREE.Float32BufferAttribute(a.array,a.stride)),0<c.array.length&&(u.attributes.color=new THREE.Float32BufferAttribute(c.array,c.stride)),0<o.array.length&&(u.attributes.uv=new THREE.Float32BufferAttribute(o.array,o.stride)),0<s.array.length&&(u.attributes.uv2=new THREE.Float32BufferAttribute(s.array,s.stride)),0<l.length&&(u.attributes.skinIndex=new THREE.Float32BufferAttribute(l,4)),0<h.length&&(u.attributes.skinWeight=new THREE.Float32BufferAttribute(h,4)),i.data=u,i.type=e[0].type,i.materialKeys=d,i})(o,n,i)}return t}function S(e,t,i,r){var a=e.p,n=e.stride,o=e.vcount;function s(e){for(var t=a[e+i]*l,n=t+l;t<n;t++)r.push(c[t])}var c=t.array,l=t.stride;if(void 0!==e.vcount)for(var h=0,u=0,d=o.length;u<d;u++){var p=o[u];if(4===p){var f=h+ +n,m=h+2*n,g=h+3*n;s(h+0*n),s(f),s(g),s(f),s(m),s(g)}else if(3===p)f=h+ +n,m=h+2*n,s(h+0*n),s(f),s(m);else if(4<p)for(var v=1,y=p-2;v<=y;v++)f=h+n*v,m=h+n*(v+1),s(h+0*n),s(f),s(m);h+=n*p}else for(u=0,d=a.length;u<d;u+=n)s(u)}function J(e){return T(A.geometries[e],Z)}function K(e){return void 0!==e.build?e.build:e}function Q(e,t){for(var n=0;n<e.childNodes.length;n++){var i=e.childNodes[n];if(1===i.nodeType)switch(i.nodeName){case"joint":t.joints[i.getAttribute("sid")]=(e=>{for(var t,n=0;n<e.childNodes.length;n++){var i=e.childNodes[n];if(1===i.nodeType)switch(i.nodeName){case"prismatic":case"revolute":t=((e,t)=>{t={sid:e.getAttribute("sid"),name:e.getAttribute("name")||"",axis:new THREE.Vector3,limits:{min:0,max:0},type:e.nodeName,static:!1,zeroPosition:0,middlePosition:0};for(var n=0;n<e.childNodes.length;n++){var i=e.childNodes[n];if(1===i.nodeType)switch(i.nodeName){case"axis":var r=c(i.textContent);t.axis.fromArray(r);break;case"limits":var r=i.getElementsByTagName("max")[0],a=i.getElementsByTagName("min")[0];t.limits.max=parseFloat(r.textContent),t.limits.min=parseFloat(a.textContent)}}return t.limits.min>=t.limits.max&&(t.static=!0),t.middlePosition=(t.limits.min+t.limits.max)/2,t})(i)}}return t})(i);break;case"link":t.links.push($(i))}}}function $(e){for(var t={sid:e.getAttribute("sid"),name:e.getAttribute("name")||"",attachments:[],transforms:[]},n=0;n<e.childNodes.length;n++){var i=e.childNodes[n];if(1===i.nodeType)switch(i.nodeName){case"attachment_full":t.attachments.push((e=>{for(var t={joint:e.getAttribute("joint").split("/").pop(),transforms:[],links:[]},n=0;n<e.childNodes.length;n++){var i=e.childNodes[n];if(1===i.nodeType)switch(i.nodeName){case"link":t.links.push($(i));break;case"matrix":case"translate":case"rotate":t.transforms.push(ee(i))}}return t})(i));break;case"matrix":case"translate":case"rotate":t.transforms.push(ee(i))}}return t}function ee(e){var t={type:e.nodeName},n=c(e.textContent);switch(t.type){case"matrix":t.obj=new THREE.Matrix4,t.obj.fromArray(n).transpose();break;case"translate":t.obj=new THREE.Vector3,t.obj.fromArray(n);break;case"rotate":t.obj=new THREE.Vector3,t.obj.fromArray(n),t.angle=THREE.MathUtils.degToRad(n[3])}return t}function te(e,t){for(var n=0;n<e.childNodes.length;n++){var i=e.childNodes[n];if(1===i.nodeType&&"technique_common"===i.nodeName){s=o=a=r=void 0;for(var r=i,a=t,o=0;o<r.childNodes.length;o++){var s=r.childNodes[o];if(1===s.nodeType)switch(s.nodeName){case"inertia":a.inertia=c(s.textContent);break;case"mass":a.mass=c(s.textContent)[0]}}}}}function ne(e){return void 0!==e.build?e.build:e}var E=new THREE.Matrix4,p=new THREE.Vector3;function f(e){for(var t={name:e.getAttribute("name")||"",type:e.getAttribute("type"),id:e.getAttribute("id"),sid:e.getAttribute("sid"),matrix:new THREE.Matrix4,nodes:[],instanceCameras:[],instanceControllers:[],instanceLights:[],instanceGeometries:[],instanceNodes:[],transforms:{}},n=0;n<e.childNodes.length;n++){var i=e.childNodes[n];if(1===i.nodeType)switch(i.nodeName){case"node":t.nodes.push(i.getAttribute("id")),f(i);break;case"instance_camera":t.instanceCameras.push(h(i.getAttribute("url")));break;case"instance_controller":t.instanceControllers.push(ie(i));break;case"instance_light":t.instanceLights.push(h(i.getAttribute("url")));break;case"instance_geometry":t.instanceGeometries.push(ie(i));break;case"instance_node":t.instanceNodes.push(h(i.getAttribute("url")));break;case"matrix":var r=c(i.textContent);t.matrix.multiply(E.fromArray(r).transpose()),t.transforms[i.getAttribute("sid")]=i.nodeName;break;case"translate":r=c(i.textContent),p.fromArray(r),t.matrix.multiply(E.makeTranslation(p.x,p.y,p.z)),t.transforms[i.getAttribute("sid")]=i.nodeName;break;case"rotate":var r=c(i.textContent),a=THREE.MathUtils.degToRad(r[3]);t.matrix.multiply(E.makeRotationAxis(p.fromArray(r),a)),t.transforms[i.getAttribute("sid")]=i.nodeName;break;case"scale":r=c(i.textContent),t.matrix.scale(p.fromArray(r)),t.transforms[i.getAttribute("sid")]=i.nodeName;break;case"extra":break;default:console.log(i)}}return le(t.id)?console.warn("THREE.ColladaLoader: There is already a node with ID %s. Exclude current node from further processing.",t.id):A.nodes[t.id]=t,t}function ie(e){for(var t={id:h(e.getAttribute("url")),materials:{},skeletons:[]},n=0;n<e.childNodes.length;n++){var i=e.childNodes[n];switch(i.nodeName){case"bind_material":for(var r=i.getElementsByTagName("instance_material"),a=0;a<r.length;a++){var o=r[a],s=o.getAttribute("symbol"),o=o.getAttribute("target");t.materials[s]=h(o)}break;case"skeleton":t.skeletons.push(h(i.textContent))}}return t}function re(e,r,a){e.traverse(function(e){if(!0===e.isBone){for(var t,n=0;n<r.length;n++){var i=r[n];if(i.name===e.name){t=i.boneInverse;break}}void 0===t&&(t=new THREE.Matrix4),a.push({bone:e,boneInverse:t,processed:!1})}})}function ae(e){for(var t,n,i,r=[],a=e.matrix,o=e.nodes,s=e.type,c=e.instanceCameras,l=e.instanceControllers,h=e.instanceLights,u=e.instanceGeometries,d=e.instanceNodes,p=0,f=o.length;p<f;p++)r.push(M(o[p]));for(p=0,f=c.length;p<f;p++){n=c[p];var m=(m=void 0)!==(m=A.cameras[n])?T(m,X):(console.warn("THREE.ColladaLoader: Couldn't find camera with ID:",n),null);null!==m&&r.push(m.clone())}for(p=0,f=l.length;p<f;p++)for(var g,v=l[p],y=(t=v.id,T(A.controllers[t],B)),x=ce(J(y.id),v.materials),b=((e,t)=>{for(var n,i=[],r=[],a=0;a<e.length;a++){var o=e[a];if(le(o))re(M(o),t,i);else if(void 0!==A.visualScenes[o])for(var s=A.visualScenes[o].children,c=0;c<s.length;c++){var l=s[c];"JOINT"===l.type&&re(M(l.id),t,i)}else console.error("THREE.ColladaLoader: Unable to find root bone of skeleton with ID:",o)}for(a=0;a<t.length;a++)for(c=0;c<i.length;c++)if((n=i[c]).bone.name===t[a].name){(r[a]=n).processed=!0;break}for(a=0;a<i.length;a++)!1===(n=i[a]).processed&&(r.push(n),n.processed=!0);var h=[],u=[];for(a=0;a<r.length;a++)h.push((n=r[a]).bone),u.push(n.boneInverse);return new THREE.Skeleton(h,u)})(v.skeletons,y.skin.joints),w=0,_=x.length;w<_;w++)(g=x[w]).isSkinnedMesh&&(g.bind(b,y.skin.bindMatrix),g.normalizeSkinWeights()),r.push(g);for(p=0,f=h.length;p<f;p++){i=h[p];var E=(E=void 0)!==(E=A.lights[i])?T(E,Y):(console.warn("THREE.ColladaLoader: Couldn't find light with ID:",i),null);null!==E&&r.push(E.clone())}for(p=0,f=u.length;p<f;p++)for(w=0,_=(x=ce(J((v=u[p]).id),v.materials)).length;w<_;w++)r.push(x[w]);for(p=0,f=d.length;p<f;p++)r.push(M(d[p]).clone());if(0===o.length&&1===r.length)g=r[0];else for(g=new("JOINT"===s?THREE.Bone:THREE.Group),p=0;p<r.length;p++)g.add(r[p]);return""===g.name&&(g.name="JOINT"===s?e.sid:e.name),g.matrix.copy(a),g.matrix.decompose(g.position,g.quaternion,g.scale),g}var oe=new THREE.MeshBasicMaterial({color:16711935});function se(e,t){for(var n=[],i=0,r=e.length;i<r;i++){var a=t[e[i]];void 0===a?(console.warn("THREE.ColladaLoader: Material with key %s not found. Apply fallback material.",e[i]),n.push(oe)):n.push(T(A.materials[a],j))}return n}function ce(e,t){var n,i=[];for(n in e){var r=e[n],a=se(r.materialKeys,t),o=(0===a.length&&("lines"===n||"linestrips"===n?a.push(new THREE.LineBasicMaterial):a.push(new THREE.MeshPhongMaterial)),void 0!==r.data.attributes.skinIndex);if(o)for(var s=0,c=a.length;s<c;s++)a[s].skinning=!0;var l,h=1===a.length?a[0]:a;switch(n){case"lines":l=new THREE.LineSegments(r.data,h);break;case"linestrips":l=new THREE.Line(r.data,h);break;case"triangles":case"polylist":l=new(o?THREE.SkinnedMesh:THREE.Mesh)(r.data,h)}i.push(l)}return i}function le(e){return void 0!==A.nodes[e]}function M(e){return T(A.nodes[e],ae)}function he(e){var t=new THREE.Group;t.name=e.name;for(var n=e.children,i=0;i<n.length;i++){var r=n[i];t.add(M(r.id))}return t}function ue(e){return T(A.visualScenes[e],he)}if(0===e.length)return{scene:new THREE.Scene};var e=(new DOMParser).parseFromString(e,"application/xml"),m=s(e,"COLLADA")[0],a=e.getElementsByTagName("parsererror")[0];if(void 0!==a)return e=(e=s(a,"div")[0])?e.textContent:(()=>{for(var e="",t=[a];t.length;){var n=t.shift();n.nodeType===Node.TEXT_NODE?e+=n.textContent:(e+="\n",t.push.apply(t,n.childNodes))}return e.trim()})(),console.error("THREE.ColladaLoader: Failed to parse collada file.\n",e),null;e=m.getAttribute("version");console.log("THREE.ColladaLoader: File version",e);e=s(m,"asset")[0];var de,e={unit:void 0!==(y=s(e,"unit")[0])&&!0===y.hasAttribute("meter")?parseFloat(y.getAttribute("meter")):1,upAxis:void 0!==(y=s(e,"up_axis")[0])?y.textContent:"Y_UP"},g=new THREE.TextureLoader(this.manager),v=(g.setPath(this.resourcePath||t).setCrossOrigin(this.crossOrigin),g.setCrossOrigin("anonymous"),THREE.TGALoader&&(de=new THREE.TGALoader(this.manager)).setPath(this.resourcePath||t),[]),y={},pe=0,A={animations:{},clips:{},controllers:{},images:{},effects:{},materials:{},cameras:{},lights:{},geometries:{},nodes:{},visualScenes:{},kinematicsModels:{},physicsModels:{},kinematicsScenes:{}};n(m,"library_animations","animation",function(e){for(var t={sources:{},samplers:{},channels:{}},n=0,i=e.childNodes.length;n<i;n++){var r,a=e.childNodes[n];if(1===a.nodeType)switch(a.nodeName){case"source":r=a.getAttribute("id"),t.sources[r]=o(a);break;case"sampler":r=a.getAttribute("id"),t.samplers[r]=(e=>{for(var t={inputs:{}},n=0,i=e.childNodes.length;n<i;n++){var r,a=e.childNodes[n];1===a.nodeType&&"input"===a.nodeName&&(r=h(a.getAttribute("source")),a=a.getAttribute("semantic"),t.inputs[a]=r)}return t})(a);break;case"channel":r=a.getAttribute("target"),t.channels[r]=(e=>{var t={},n=e.getAttribute("target").split("/"),i=n.shift(),r=-1!==(s=n.shift()).indexOf("("),a=-1!==s.indexOf(".");if(a)s=(n=s.split(".")).shift(),t.member=n.shift();else if(r){for(var o=s.split("("),s=o.shift(),c=0;c<o.length;c++)o[c]=parseInt(o[c].replace(/\)/,""));t.indices=o}return t.id=i,t.sid=s,t.arraySyntax=r,t.memberSyntax=a,t.sampler=h(e.getAttribute("source")),t})(a);break;default:console.log(a)}}A.animations[e.getAttribute("id")]=t}),n(m,"library_animation_clips","animation_clip",function(e){for(var t={name:e.getAttribute("id")||"default",start:parseFloat(e.getAttribute("start")||0),end:parseFloat(e.getAttribute("end")||0),animations:[]},n=0,i=e.childNodes.length;n<i;n++){var r=e.childNodes[n];1===r.nodeType&&"instance_animation"===r.nodeName&&t.animations.push(h(r.getAttribute("url")))}A.clips[e.getAttribute("id")]=t}),n(m,"library_controllers","controller",function(e){for(var t={},n=0,i=e.childNodes.length;n<i;n++){var r=e.childNodes[n];if(1===r.nodeType)switch(r.nodeName){case"skin":t.id=h(r.getAttribute("source")),t.skin=F(r);break;case"morph":t.id=h(r.getAttribute("source")),console.warn("THREE.ColladaLoader: Morph target animation not supported yet.")}}A.controllers[e.getAttribute("id")]=t}),n(m,"library_images","image",function(e){var t={init_from:s(e,"init_from")[0].textContent};A.images[e.getAttribute("id")]=t}),n(m,"library_effects","effect",function(e){for(var t={},n=0,i=e.childNodes.length;n<i;n++){var r=e.childNodes[n];1===r.nodeType&&"profile_COMMON"===r.nodeName&&(t.profile=z(r))}A.effects[e.getAttribute("id")]=t}),n(m,"library_materials","material",function(e){for(var t={name:e.getAttribute("name")},n=0,i=e.childNodes.length;n<i;n++){var r=e.childNodes[n];1===r.nodeType&&"instance_effect"===r.nodeName&&(t.url=h(r.getAttribute("url")))}A.materials[e.getAttribute("id")]=t}),n(m,"library_cameras","camera",function(e){for(var t={name:e.getAttribute("name")},n=0,i=e.childNodes.length;n<i;n++){var r=e.childNodes[n];1===r.nodeType&&"optics"===r.nodeName&&(t.optics=W(r))}A.cameras[e.getAttribute("id")]=t}),n(m,"library_lights","light",function(e){for(var t={},n=0,i=e.childNodes.length;n<i;n++){var r=e.childNodes[n];1===r.nodeType&&"technique_common"===r.nodeName&&(t=q(r))}A.lights[e.getAttribute("id")]=t}),n(m,"library_geometries","geometry",function(e){var t={name:e.getAttribute("name"),sources:{},vertices:{},primitives:[]},n=s(e,"mesh")[0];if(void 0!==n){for(var i=0;i<n.childNodes.length;i++){var r=n.childNodes[i];if(1===r.nodeType){var a=r.getAttribute("id");switch(r.nodeName){case"source":t.sources[a]=o(r);break;case"vertices":t.vertices=(e=>{for(var t={},n=0;n<e.childNodes.length;n++){var i=e.childNodes[n];1===i.nodeType&&(t[i.getAttribute("semantic")]=h(i.getAttribute("source")))}return t})(r);break;case"polygons":console.warn("THREE.ColladaLoader: Unsupported primitive type: ",r.nodeName);break;case"lines":case"linestrips":case"polylist":case"triangles":t.primitives.push((e=>{for(var t={type:e.nodeName,material:e.getAttribute("material"),count:parseInt(e.getAttribute("count")),inputs:{},stride:0,hasUV:!1},n=0,i=e.childNodes.length;n<i;n++){var r=e.childNodes[n];if(1===r.nodeType)switch(r.nodeName){case"input":var a=h(r.getAttribute("source")),o=r.getAttribute("semantic"),s=parseInt(r.getAttribute("offset")),c=parseInt(r.getAttribute("set"));t.inputs[0<c?o+c:o]={id:a,offset:s},t.stride=Math.max(t.stride,s+1),"TEXCOORD"===o&&(t.hasUV=!0);break;case"vcount":t.vcount=l(r.textContent);break;case"p":t.p=l(r.textContent)}}return t})(r));break;default:console.log(r)}}}A.geometries[e.getAttribute("id")]=t}}),n(m,"library_nodes","node",f),n(m,"library_visual_scenes","visual_scene",function(e){for(var t={name:e.getAttribute("name"),children:[]},n=e.getElementsByTagName("node"),i=0;i<n.length;i++){var r=n[i];!1===r.hasAttribute("id")&&r.setAttribute("id","three_default_"+pe++)}for(var a=s(e,"node"),o=0;o<a.length;o++)t.children.push(f(a[o]));A.visualScenes[e.getAttribute("id")]=t}),n(m,"library_kinematics_models","kinematics_model",function(e){for(var t={name:e.getAttribute("name")||"",joints:{},links:[]},n=0;n<e.childNodes.length;n++){var i=e.childNodes[n];1===i.nodeType&&"technique_common"===i.nodeName&&Q(i,t)}A.kinematicsModels[e.getAttribute("id")]=t}),n(m,"library_physics_models","physics_model",function(e){for(var t={name:e.getAttribute("name")||"",rigidBodies:{}},n=0;n<e.childNodes.length;n++){var i=e.childNodes[n];1===i.nodeType&&"rigid_body"===i.nodeName&&(t.rigidBodies[i.getAttribute("name")]={},te(i,t.rigidBodies[i.getAttribute("name")]))}A.physicsModels[e.getAttribute("id")]=t}),n(m,"scene","instance_kinematics_scene",function(e){for(var t={bindJointAxis:[]},n=0;n<e.childNodes.length;n++){var i=e.childNodes[n];1===i.nodeType&&"bind_joint_axis"===i.nodeName&&t.bindJointAxis.push((e=>{for(var t={target:e.getAttribute("target").split("/").pop()},n=0;n<e.childNodes.length;n++){var i=e.childNodes[n];1===i.nodeType&&"axis"===i.nodeName&&(i=i.getElementsByTagName("param")[0],t.axis=i.textContent,i=t.axis.split("inst_").pop().split("axis")[0],t.jointIndex=i.substr(0,i.length-1))}return t})(i))}A.kinematicsScenes[h(e.getAttribute("url"))]=t}),i(A.animations,r),i(A.clips,D),i(A.controllers,B),i(A.images,k),i(A.effects,V),i(A.materials,j),i(A.cameras,X),i(A.lights,Y),i(A.geometries,Z),i(A.visualScenes,he);var fe,t=A.clips;if(!0===d(t)){if(!1===d(A.animations)){var me=[];for(R in A.animations)for(var ge=u(R),x=0,ve=ge.length;x<ve;x++)me.push(ge[x]);v.push(new THREE.AnimationClip("default",-1,me))}}else for(var R in t)v.push((fe=R,T(A.clips[fe],D)));var t=Object.keys(A.kinematicsModels)[0],C=Object.keys(A.kinematicsScenes)[0],L=Object.keys(A.visualScenes)[0];if(void 0!==t&&void 0!==C){for(var P=T(A.kinematicsModels[t],K),t=T(A.kinematicsScenes[C],ne),ye=ue(L),xe=t.bindJointAxis,N={},O=0,be=xe.length;O<be;O++){var we=xe[O],I=m.querySelector('[sid="'+we.target+'"]');I&&(I=I.parentElement,((t,n)=>{var i=n.getAttribute("name"),r=P.joints[t];ye.traverse(function(e){e.name===i&&(N[t]={object:e,transforms:(e=>{for(var t=[],n=m.querySelector('[id="'+e.id+'"]'),i=0;i<n.childNodes.length;i++){var r=n.childNodes[i];if(1===r.nodeType)switch(r.nodeName){case"matrix":var a=c(r.textContent),o=(new THREE.Matrix4).fromArray(a).transpose();t.push({sid:r.getAttribute("sid"),type:r.nodeName,obj:o});break;case"translate":case"scale":var a=c(r.textContent),s=(new THREE.Vector3).fromArray(a);t.push({sid:r.getAttribute("sid"),type:r.nodeName,obj:s});break;case"rotate":a=c(r.textContent);s=(new THREE.Vector3).fromArray(a),o=THREE.MathUtils.degToRad(a[3]);t.push({sid:r.getAttribute("sid"),type:r.nodeName,obj:s,angle:o})}}return t})(n),joint:r,position:r.zeroPosition})})})(we.jointIndex,I))}var U=new THREE.Matrix4;y={joints:P&&P.joints,getJointValue:function(e){var t=N[e];if(t)return t.position;console.warn("THREE.ColladaLoader: Joint "+e+" doesn't exist.")},setJointValue:function(e,t){var n=N[e];if(n){var i=n.joint;if(t>i.limits.max||t<i.limits.min)console.warn("THREE.ColladaLoader: Joint "+e+" value "+t+" outside of limits (min: "+i.limits.min+", max: "+i.limits.max+").");else if(i.static)console.warn("THREE.ColladaLoader: Joint "+e+" is static.");else{var r=n.object,a=i.axis,o=n.transforms;E.identity();for(var s=0;s<o.length;s++){var c=o[s];if(c.sid&&-1!==c.sid.indexOf(e))switch(i.type){case"revolute":E.multiply(U.makeRotationAxis(a,THREE.MathUtils.degToRad(t)));break;case"prismatic":E.multiply(U.makeTranslation(a.x*t,a.y*t,a.z*t));break;default:console.warn("THREE.ColladaLoader: Unknown joint type: "+i.type)}else switch(c.type){case"matrix":E.multiply(c.obj);break;case"translate":E.multiply(U.makeTranslation(c.obj.x,c.obj.y,c.obj.z));break;case"scale":E.scale(c.obj);break;case"rotate":E.multiply(U.makeRotationAxis(c.obj,c.angle))}}r.matrix.copy(E),r.matrix.decompose(r.position,r.quaternion,r.scale),N[e].position=t}}else console.log("THREE.ColladaLoader: "+e+" does not exist.")}}}C=s(m,"scene")[0];L=ue(h(s(C,"instance_visual_scene")[0].getAttribute("url")));return"Z_UP"===e.upAxis&&L.quaternion.setFromEuler(new THREE.Euler(-Math.PI/2,0,0)),L.scale.multiplyScalar(e.unit),{animations:v,kinematics:y,library:A,scene:L}}})},function(e,t){THREE.ColladaLoader=function(e){this.manager=void 0!==e?e:THREE.DefaultLoadingManager},THREE.ColladaLoader.prototype={constructor:THREE.ColladaLoader,crossOrigin:"Anonymous",load:function(e,t,n,i){var r=this,a=THREE.Loader.prototype.extractUrlBase(e);new THREE.FileLoader(r.manager).load(e,function(e){t(r.parse(e,a))},n,i)},options:{set convertUpAxis(e){console.warn("THREE.ColladaLoader: options.convertUpAxis() has been removed. Up axis is converted automatically.")}},setCrossOrigin:function(e){this.crossOrigin=e},parse:function(e,t){function o(e,t){for(var n=[],i=e.childNodes,r=0,a=i.length;r<a;r++){var o=i[r];o.nodeName===t&&n.push(o)}return n}function u(e){if(0===e.length)return[];for(var t=e.trim().split(/\s+/),n=new Array(t.length),i=0,r=t.length;i<r;i++)n[i]=parseFloat(t[i]);return n}function c(e){if(0===e.length)return[];for(var t=e.trim().split(/\s+/),n=new Array(t.length),i=0,r=t.length;i<r;i++)n[i]=parseInt(t[i]);return n}function l(e){return e.substring(1)}function h(e){return 0===Object.keys(e).length}function n(e,t,n,i){e=o(e,t)[0];if(void 0!==e)for(var r=o(e,n),a=0;a<r.length;a++)i(r[a])}function i(e,t){for(var n in e)e[n].build=t(e[n])}function _(e,t){return void 0!==e.build||(e.build=t(e)),e.build}function r(e){var t,n=[],i=e.channels,r=e.samplers,a=e.sources;for(t in i)if(i.hasOwnProperty(t)){for(var o=i[t],s=r[o.sampler],c=s.inputs.INPUT,s=s.inputs.OUTPUT,l=(x=y=v=g=m=f=p=d=u=h=l=void 0,((e,t,n)=>{var i,r,a,o,s,c,l=A((u=R.nodes[e.id]).id),h=u.transforms[e.sid],u=u.matrix.clone().transpose(),d={};switch(h){case"matrix":for(a=0,o=t.array.length;a<o;a++)if(i=t.array[a],r=a*n.stride,void 0===d[i]&&(d[i]={}),!0===e.arraySyntax){var p=n.array[r],f=e.indices[0]+4*e.indices[1];d[i][f]=p}else for(s=0,c=n.stride;s<c;s++)d[i][s]=n.array[r+s];break;case"translate":case"rotate":case"scale":console.warn('THREE.ColladaLoader: Animation transform type "%s" not yet implemented.',h)}return u=((e,t)=>{var n,i=[];for(n in e)i.push({time:parseFloat(n),value:e[n]});i.sort(function(e,t){return e.time-t.time});for(var r=0;r<16;r++){y=v=g=p=d=m=f=u=s=o=a=h=l=c=void 0;var a,o,s,c=i,l=r,h=t.elements[r],u=!0;for(o=0,s=c.length;o<s;o++)void 0===(a=c[o]).value[l]?a.value[l]=null:u=!1;if(!0===u)for(o=0,s=c.length;o<s;o++)(a=c[o]).value[l]=h;else for(var d,p,f=c,m=l,g=0,v=f.length;g<v;g++){var y=f[g];null===y.value[m]&&(d=((e,t,n)=>{for(;0<=t;){var i=e[t];if(null!==i.value[n])return i;t--}return null})(f,g,m),p=((e,t,n)=>{for(;t<e.length;){var i=e[t];if(null!==i.value[n])return i;t++}return null})(f,g,m),null===d?y.value[m]=p.value[m]:null===p?y.value[m]=d.value[m]:((e,t,n,i)=>{n.time-t.time!=0?e.value[i]=(e.time-t.time)*(n.value[i]-t.value[i])/(n.time-t.time)+t.value[i]:e.value[i]=t.value[i]})(y,d,p,m))}}return i})(d,u),{name:l.uuid,keyframes:u}})(o,a[c],a[s])),h=n,u=l.keyframes,l=l.name,d=[],p=[],f=[],m=[],g=0,v=u.length;g<v;g++){var y=u[g],x=y.time,y=y.value;S.fromArray(y).transpose(),S.decompose(b,E,w),d.push(x),p.push(b.x,b.y,b.z),f.push(E.x,E.y,E.z,E.w),m.push(w.x,w.y,w.z)}0<p.length&&h.push(new THREE.VectorKeyframeTrack(l+".position",d,p)),0<f.length&&h.push(new THREE.QuaternionKeyframeTrack(l+".quaternion",d,f)),0<m.length&&h.push(new THREE.VectorKeyframeTrack(l+".scale",d,m))}return n}function d(e){return _(R.animations[e],r)}var b=new THREE.Vector3,w=new THREE.Vector3,E=new THREE.Quaternion;function a(e){for(var t=[],n=e.name,i=e.end-e.start||-1,r=e.animations,a=0,o=r.length;a<o;a++)for(var s=d(r[a]),c=0,l=s.length;c<l;c++)t.push(s[c]);return new THREE.AnimationClip(n,i,t)}function D(e){for(var t={sources:{}},n=0,i=e.childNodes.length;n<i;n++){var r=e.childNodes[n];if(1===r.nodeType)switch(r.nodeName){case"bind_shape_matrix":t.bindShapeMatrix=u(r.textContent);break;case"source":var a=r.getAttribute("id");t.sources[a]=s(r);break;case"joints":t.joints=(e=>{for(var t={inputs:{}},n=0,i=e.childNodes.length;n<i;n++){var r,a=e.childNodes[n];1===a.nodeType&&"input"===a.nodeName&&(r=a.getAttribute("semantic"),a=l(a.getAttribute("source")),t.inputs[r]=a)}return t})(r);break;case"vertex_weights":t.vertexWeights=(e=>{for(var t={inputs:{}},n=0,i=e.childNodes.length;n<i;n++){var r=e.childNodes[n];if(1===r.nodeType)switch(r.nodeName){case"input":var a=r.getAttribute("semantic"),o=l(r.getAttribute("source")),s=parseInt(r.getAttribute("offset"));t.inputs[a]={id:o,offset:s};break;case"vcount":t.vcount=c(r.textContent);break;case"v":t.v=c(r.textContent)}}return t})(r)}}return t}function T(e){var t={id:e.id},n=R.geometries[t.id];return void 0!==e.skin&&(t.skin=(e=>{for(var t={joints:[],indices:{array:[],stride:4},weights:{array:[],stride:4}},n=e.sources,i=e.vertexWeights,r=i.vcount,a=i.v,o=i.inputs.JOINT.offset,s=i.inputs.WEIGHT.offset,c=e.sources[e.joints.inputs.JOINT],l=e.sources[e.joints.inputs.INV_BIND_MATRIX],h=n[i.inputs.WEIGHT.id].array,u=0,d=0,p=r.length;d<p;d++){for(var f=r[d],m=[],g=0;g<f;g++){var v=a[u+o],y=h[a[u+s]];m.push({index:v,weight:y}),u+=2}for(m.sort(_),g=0;g<4;g++){var x=m[g];void 0!==x?(t.indices.array.push(x.index),t.weights.array.push(x.weight)):(t.indices.array.push(0),t.weights.array.push(0))}}for(t.bindMatrix=(new THREE.Matrix4).fromArray(e.bindShapeMatrix).transpose(),d=0,p=c.array.length;d<p;d++){var b=c.array[d],w=(new THREE.Matrix4).fromArray(l.array,d*l.stride).transpose();t.joints.push({name:b,boneInverse:w})}return t;function _(e,t){return t.weight-e.weight}})(e.skin),n.sources.skinIndices=t.skin.indices,n.sources.skinWeights=t.skin.weights),t}function F(e){return void 0!==e.build?e.build:e.init_from}function B(e){for(var t={surfaces:{},samplers:{}},n=0,i=e.childNodes.length;n<i;n++){var r=e.childNodes[n];if(1===r.nodeType)switch(r.nodeName){case"newparam":h=l=c=s=o=a=void 0;for(var a=r,o=t,s=a.getAttribute("sid"),c=0,l=a.childNodes.length;c<l;c++){var h=a.childNodes[c];if(1===h.nodeType)switch(h.nodeName){case"surface":o.surfaces[s]=(e=>{for(var t={},n=0,i=e.childNodes.length;n<i;n++){var r=e.childNodes[n];1===r.nodeType&&"init_from"===r.nodeName&&(t.init_from=r.textContent)}return t})(h);break;case"sampler2D":o.samplers[s]=(e=>{for(var t={},n=0,i=e.childNodes.length;n<i;n++){var r=e.childNodes[n];1===r.nodeType&&"source"===r.nodeName&&(t.source=r.textContent)}return t})(h)}}break;case"technique":t.technique=(e=>{for(var t={},n=0,i=e.childNodes.length;n<i;n++){var r=e.childNodes[n];if(1===r.nodeType)switch(r.nodeName){case"constant":case"lambert":case"blinn":case"phong":t.type=r.nodeName,t.parameters=(e=>{for(var t={},n=0,i=e.childNodes.length;n<i;n++){var r=e.childNodes[n];if(1===r.nodeType)switch(r.nodeName){case"emission":case"diffuse":case"specular":case"shininess":case"transparent":case"transparency":t[r.nodeName]=(e=>{for(var t={},n=0,i=e.childNodes.length;n<i;n++){var r=e.childNodes[n];if(1===r.nodeType)switch(r.nodeName){case"color":t[r.nodeName]=u(r.textContent);break;case"float":t[r.nodeName]=parseFloat(r.textContent);break;case"texture":null==t.texture?t.texture={id:r.getAttribute("texture"),extra:k(r)}:(t.texture2={id:r.getAttribute("texture"),extra:k(r)},t.intensity=r.getAttribute("intensity"))}}return t})(r)}}return t})(r)}}return t})(r)}}return t}function k(e){for(var t={technique:{}},n=0,i=e.childNodes.length;n<i;n++){var r=e.childNodes[n];if(1===r.nodeType&&"extra"===r.nodeName){l=c=s=o=a=void 0;for(var a=r,o=t,s=0,c=a.childNodes.length;s<c;s++){var l=a.childNodes[s];1===l.nodeType&&"technique"===l.nodeName&&((e,t)=>{for(var n=0,i=e.childNodes.length;n<i;n++){var r=e.childNodes[n];if(1===r.nodeType)switch(r.nodeName){case"repeatU":case"repeatV":case"offsetU":case"offsetV":t.technique[r.nodeName]=parseFloat(r.textContent);break;case"wrapU":case"wrapV":"TRUE"===r.textContent.toUpperCase()?t.technique[r.nodeName]=1:"FALSE"===r.textContent.toUpperCase()?t.technique[r.nodeName]=0:t.technique[r.nodeName]=parseInt(r.textContent)}}})(l,o)}}}return t}function H(e){return e}function z(e){n=e.url;var t,i=_(R.effects[n],H),n=i.profile.technique;switch(n.type){case"phong":case"blinn":new THREE.Color(255),t=new THREE.MeshPhongMaterial;break;case"lambert":t=new THREE.MeshLambertMaterial;break;default:t=new THREE.MeshBasicMaterial}function r(e){var t,n=i.profile.samplers[e.id];return void 0!==n?(n=i.profile.surfaces[n.source],n=oe.load((n=n.init_from,_(R.images[n],F))),void 0!==(t=e.extra)&&void 0!==t.technique&&!1===h(t.technique)?(t=t.technique,n.wrapS=t.wrapU?THREE.RepeatWrapping:THREE.ClampToEdgeWrapping,n.wrapT=t.wrapV?THREE.RepeatWrapping:THREE.ClampToEdgeWrapping,n.offset.set(t.offsetU||0,t.offsetV||0),n.repeat.set(t.repeatU||1,t.repeatV||1)):(n.wrapS=THREE.RepeatWrapping,n.wrapT=THREE.RepeatWrapping),n):(console.error("THREE.ColladaLoader: Undefined sampler",e.id),null)}t.name=e.name;var a,o=n.parameters;for(a in o){var s=o[a];switch(a){case"diffuse":s.color&&t.color.fromArray(s.color),s.texture&&(t.map=r(s.texture)),s.texture2&&(t.lightMap=r(s.texture2),t.lightMapIntensity=s.intensity);break;case"specular":s.color&&t.specular&&t.specular.fromArray(s.color),s.texture&&(t.specularMap=r(s.texture));break;case"shininess":s.float&&t.shininess&&(t.shininess=s.float);break;case"emission":s.color&&t.emissive&&t.emissive.fromArray(s.color);break;case"transparent":t.transparent=!0;break;case"transparency":void 0!==s.float&&(t.opacity=s.float),t.transparent=!0}}return t}function G(e){for(var t=0;t<e.childNodes.length;t++){var n=e.childNodes[t];if("technique_common"===n.nodeName){for(var i=n,r={},a=0;a<i.childNodes.length;a++){var o=i.childNodes[a];switch(o.nodeName){case"perspective":case"orthographic":r.technique=o.nodeName,r.parameters=(e=>{for(var t={},n=0;n<e.childNodes.length;n++){var i=e.childNodes[n];switch(i.nodeName){case"xfov":case"yfov":case"xmag":case"ymag":case"znear":case"zfar":case"aspect_ratio":t[i.nodeName]=parseFloat(i.textContent)}}return t})(o)}}return r}}return{}}function V(e){var t;switch(e.optics.technique){case"perspective":t=new THREE.PerspectiveCamera(e.optics.parameters.yfov,e.optics.parameters.aspect_ratio,e.optics.parameters.znear,e.optics.parameters.zfar);break;case"orthographic":var n=e.optics.parameters.ymag,i=e.optics.parameters.xmag,r=e.optics.parameters.aspect_ratio,i=void 0===i?n*r:i,n=void 0===n?i/r:n;i*=.5,n*=.5,t=new THREE.OrthographicCamera(-i,i,n,-n,e.optics.parameters.znear,e.optics.parameters.zfar);break;default:t=new THREE.PerspectiveCamera}return t.name=e.name,t}function j(e){for(var t={},n=0,i=e.childNodes.length;n<i;n++){var r=e.childNodes[n];if(1===r.nodeType)switch(r.nodeName){case"directional":case"point":case"spot":case"ambient":t.technique=r.nodeName,t.parameters=(e=>{for(var t={},n=0,i=e.childNodes.length;n<i;n++){var r=e.childNodes[n];if(1===r.nodeType)switch(r.nodeName){case"color":var a=u(r.textContent);t.color=(new THREE.Color).fromArray(a);break;case"falloff_angle":t.falloffAngle=parseFloat(r.textContent);break;case"quadratic_attenuation":a=parseFloat(r.textContent);t.distance=a?Math.sqrt(1/a):0}}return t})(r)}}return t}function W(e){var t;switch(e.technique){case"directional":t=new THREE.DirectionalLight;break;case"point":t=new THREE.PointLight;break;case"spot":t=new THREE.SpotLight;break;case"ambient":t=new THREE.AmbientLight}return e.parameters.color&&t.color.copy(e.parameters.color),e.parameters.distance&&(t.distance=e.parameters.distance),t}function s(e){for(var t={array:[],stride:3},n=0;n<e.childNodes.length;n++){var i=e.childNodes[n];if(1===i.nodeType)switch(i.nodeName){case"float_array":t.array=u(i.textContent);break;case"Name_array":t.array=(e=>{if(0===e.length)return[];for(var t=e.trim().split(/\s+/),n=new Array(t.length),i=0,r=t.length;i<r;i++)n[i]=t[i];return n})(i.textContent);break;case"technique_common":var r=o(i,"accessor")[0];void 0!==r&&(t.stride=parseInt(r.getAttribute("stride")))}}return t}function X(e){var t={},n=e.sources,i=e.vertices,e=e.primitives;if(0===e.length)return{};var r,a=(e=>{for(var t={},n=0;n<e.length;n++){var i=e[n];void 0===t[i.type]&&(t[i.type]=[]),t[i.type].push(i)}return t})(e);for(r in a)t[r]=((e,t,n)=>{for(var i={},r={array:[],stride:0},a={array:[],stride:0},o={array:[],stride:0},s={array:[],stride:0},c=[],l=[],h=new THREE.BufferGeometry,u=[],d=0,p=0,f=0;f<e.length;f++){var m,g=e[f],v=g.inputs,y=1;for(m in g.vcount&&4===g.vcount[0]&&(y=2),p="lines"===g.type||"linestrips"===g.type?2*g.count:3*g.count*y,h.addGroup(d,p,f),d+=p,g.material&&u.push(g.material),v){var x=v[m];switch(m){case"VERTEX":for(var b in n){var w=n[b];switch(b){case"POSITION":M(g,t[w],x.offset,r.array),r.stride=t[w].stride,t.skinWeights&&t.skinIndices&&(M(g,t.skinIndices,x.offset,c),M(g,t.skinWeights,x.offset,l));break;case"NORMAL":M(g,t[w],x.offset,a.array),a.stride=t[w].stride;break;case"COLOR":M(g,t[w],x.offset,s.array),s.stride=t[w].stride;break;case"TEXCOORD":M(g,t[w],x.offset,o.array),o.stride=t[w].stride;break;default:console.warn('THREE.ColladaLoader: Semantic "%s" not handled in geometry build process.',b)}}break;case"NORMAL":M(g,t[x.id],x.offset,a.array),a.stride=t[x.id].stride;break;case"COLOR":M(g,t[x.id],x.offset,s.array),s.stride=t[x.id].stride;break;case"TEXCOORD":M(g,t[x.id],x.offset,o.array),o.stride=t[x.id].stride}}}return 0<r.array.length&&h.addAttribute("position",new THREE.Float32BufferAttribute(r.array,r.stride)),0<a.array.length&&h.addAttribute("normal",new THREE.Float32BufferAttribute(a.array,a.stride)),0<s.array.length&&h.addAttribute("color",new THREE.Float32BufferAttribute(s.array,s.stride)),0<o.array.length&&(h.addAttribute("uv",new THREE.Float32BufferAttribute(o.array,o.stride)),h.addAttribute("uv2",new THREE.Float32BufferAttribute(o.array,o.stride))),0<c.length&&h.addAttribute("skinIndex",new THREE.Float32BufferAttribute(c,4)),0<l.length&&h.addAttribute("skinWeight",new THREE.Float32BufferAttribute(l,4)),i.data=h,i.type=e[0].type,i.materialKeys=u,i})(a[r],n,i);return t}function M(e,t,i,r){var a=e.p,n=e.stride,o=e.vcount;function s(e){for(var t=a[e+i]*h,n=t+h;t<n;t++)r.push(l[t])}var c=0,l=t.array,h=t.stride;if(void 0!==e.vcount)for(var u=0,d=0,p=o.length;d<p;d++){var f,m,g,v=o[d];4===v?(f=u+ +n,m=u+2*n,g=u+3*n,s(u+0*n),s(f),s(g),s(f),s(m),s(g)):3===v?(f=u+ +n,m=u+2*n,s(u+0*n),s(f),s(m)):c=Math.max(c,v),u+=n*v}else for(d=0,p=a.length;d<p;d+=n)s(d)}function q(e){return _(R.geometries[e],X)}function Y(e){return void 0!==e.build?e.build:e}function Z(e,t){for(var n=0;n<e.childNodes.length;n++){var i=e.childNodes[n];if(1===i.nodeType)switch(i.nodeName){case"joint":t.joints[i.getAttribute("sid")]=(e=>{for(var t,n=0;n<e.childNodes.length;n++){var i=e.childNodes[n];if(1===i.nodeType)switch(i.nodeName){case"prismatic":case"revolute":t=((e,t)=>{t={sid:e.getAttribute("sid"),name:e.getAttribute("name")||"",axis:new THREE.Vector3,limits:{min:0,max:0},type:e.nodeName,static:!1,zeroPosition:0,middlePosition:0};for(var n=0;n<e.childNodes.length;n++){var i=e.childNodes[n];if(1===i.nodeType)switch(i.nodeName){case"axis":var r=u(i.textContent);t.axis.fromArray(r);break;case"limits":var r=i.getElementsByTagName("max")[0],a=i.getElementsByTagName("min")[0];t.limits.max=parseFloat(r.textContent),t.limits.min=parseFloat(a.textContent)}}return t.limits.min>=t.limits.max&&(t.static=!0),t.middlePosition=(t.limits.min+t.limits.max)/2,t})(i)}}return t})(i);break;case"link":t.links.push(J(i))}}}function J(e){for(var t={sid:e.getAttribute("sid"),name:e.getAttribute("name")||"",attachments:[],transforms:[]},n=0;n<e.childNodes.length;n++){var i=e.childNodes[n];if(1===i.nodeType)switch(i.nodeName){case"attachment_full":t.attachments.push((e=>{for(var t={joint:e.getAttribute("joint").split("/").pop(),transforms:[],links:[]},n=0;n<e.childNodes.length;n++){var i=e.childNodes[n];if(1===i.nodeType)switch(i.nodeName){case"link":t.links.push(J(i));break;case"matrix":case"translate":case"rotate":t.transforms.push(K(i))}}return t})(i));break;case"matrix":case"translate":case"rotate":t.transforms.push(K(i))}}return t}function K(e){var t={type:e.nodeName},n=u(e.textContent);switch(t.type){case"matrix":t.obj=new THREE.Matrix4,t.obj.fromArray(n).transpose();break;case"translate":t.obj=new THREE.Vector3,t.obj.fromArray(n);break;case"rotate":t.obj=new THREE.Vector3,t.obj.fromArray(n),t.angle=THREE.Math.degToRad(n[3])}return t}function Q(e){return void 0!==e.build?e.build:e}var S=new THREE.Matrix4,p=new THREE.Vector3;function f(e){for(var t={name:e.getAttribute("name"),type:e.getAttribute("type"),id:e.getAttribute("id"),sid:e.getAttribute("sid"),matrix:new THREE.Matrix4,nodes:[],instanceCameras:[],instanceControllers:[],instanceLights:[],instanceGeometries:[],instanceNodes:[],transforms:{}},n=0;n<e.childNodes.length;n++){var i=e.childNodes[n];if(1===i.nodeType)switch(i.nodeName){case"node":i.hasAttribute("id")&&(t.nodes.push(i.getAttribute("id")),f(i));break;case"instance_camera":t.instanceCameras.push(l(i.getAttribute("url")));break;case"instance_controller":t.instanceControllers.push($(i));break;case"instance_light":t.instanceLights.push(l(i.getAttribute("url")));break;case"instance_geometry":t.instanceGeometries.push($(i));break;case"instance_node":t.instanceNodes.push(l(i.getAttribute("url")));break;case"matrix":var r=u(i.textContent);t.matrix.multiply(S.fromArray(r).transpose()),t.transforms[i.getAttribute("sid")]=i.nodeName;break;case"translate":r=u(i.textContent),p.fromArray(r),t.matrix.multiply(S.makeTranslation(p.x,p.y,p.z)),t.transforms[i.getAttribute("sid")]=i.nodeName;break;case"rotate":var r=u(i.textContent),a=THREE.Math.degToRad(r[3]);t.matrix.multiply(S.makeRotationAxis(p.fromArray(r),a)),t.transforms[i.getAttribute("sid")]=i.nodeName;break;case"scale":r=u(i.textContent),t.matrix.scale(p.fromArray(r)),t.transforms[i.getAttribute("sid")]=i.nodeName}}return e.hasAttribute("id")&&(R.nodes[e.getAttribute("id")]=t),t}function $(e){for(var t={id:l(e.getAttribute("url")),materials:{},skeletons:[]},n=0;n<e.childNodes.length;n++){var i=e.childNodes[n];switch(i.nodeName){case"bind_material":for(var r=i.getElementsByTagName("instance_material"),a=0;a<r.length;a++){var o=r[a],s=o.getAttribute("symbol"),o=o.getAttribute("target");t.materials[s]=l(o)}break;case"skeleton":t.skeletons.push(l(i.textContent))}}return t}function ee(e,t){for(var n,i,r=[],a=[],o=0;o<e.length;o++)((e,r,a)=>{e.traverse(function(e){if(!0===e.isBone){for(var t,n=0;n<r.length;n++){var i=r[n];if(i.name===e.name){t=i.boneInverse;break}}void 0===t&&(t=new THREE.Matrix4),a.push({bone:e,boneInverse:t,processed:!1})}})})(A(e[o]),t,r);for(o=0;o<t.length;o++)for(n=0;n<r.length;n++)if((i=r[n]).bone.name===t[o].name){(a[o]=i).processed=!0;break}for(o=0;o<r.length;o++)!1===(i=r[o]).processed&&(a.push(i),i.processed=!0);var s=[],c=[];for(o=0;o<a.length;o++)s.push((i=a[o]).bone),c.push(i.boneInverse);return new THREE.Skeleton(s,c)}function te(e){for(var t,n,i,r=[],a=e.matrix,o=e.nodes,s=e.type,c=e.instanceCameras,l=e.instanceControllers,h=e.instanceLights,u=e.instanceGeometries,d=e.instanceNodes,p=0,f=o.length;p<f;p++)r.push(A(o[p]));for(p=0,f=c.length;p<f;p++)r.push((t=c[p],_(R.cameras[t],V).clone()));for(p=0,f=l.length;p<f;p++){n=(w=l[p]).id;for(var m,g=_(R.controllers[n],T),v=ie(q(g.id),w.materials),y=ee(w.skeletons,g.skin.joints),x=0,b=v.length;x<b;x++)(m=v[x]).isSkinnedMesh&&(m.bind(y,g.skin.bindMatrix),m.normalizeSkinWeights()),r.push(m)}for(p=0,f=h.length;p<f;p++)r.push((i=h[p],_(R.lights[i],W).clone()));for(p=0,f=u.length;p<f;p++)for(var w,x=0,b=(v=ie(q((w=u[p]).id),w.materials)).length;x<b;x++)r.push(v[x]);for(p=0,f=d.length;p<f;p++)r.push(A(d[p]).clone());if(0===o.length&&1===r.length)m=r[0];else for(m=new("JOINT"===s?THREE.Bone:THREE.Group),p=0;p<r.length;p++)m.add(r[p]);return m.name="JOINT"===s?e.sid:e.name,m.matrix.copy(a),m.matrix.decompose(m.position,m.quaternion,m.scale),m}function ne(e,t){for(var n=[],i=0,r=e.length;i<r;i++){var a=t[e[i]];n.push(_(R.materials[a],z))}return n}function ie(e,t){var n,i=[];for(n in e){var r=e[n],a=ne(r.materialKeys,t),o=(0===a.length&&("lines"===n||"linestrips"===n?a.push(new THREE.LineBasicMaterial):a.push(new THREE.MeshPhongMaterial)),void 0!==r.data.attributes.skinIndex);if(o)for(var s=0,c=a.length;s<c;s++)a[s].skinning=!0;var l,h=1===a.length?a[0]:a;switch(n){case"lines":l=new THREE.LineSegments(r.data,h);break;case"linestrips":l=new THREE.Line(r.data,h);break;case"triangles":case"polylist":l=new(o?THREE.SkinnedMesh:THREE.Mesh)(r.data,h)}i.push(l)}return i}function A(e){return _(R.nodes[e],te)}function re(e){var t=new THREE.Group;t.name=e.name,t.rotation.x=e.rx,t.rotation.y=e.ry,t.rotation.z=e.rz,t.position.x=e.tx,t.position.y=e.ty,t.position.z=e.tz,t.scale.x=e.sx,t.scale.y=e.sy,t.scale.z=e.sz;for(var n=e.children,i=0;i<n.length;i++){var r=n[i];null===r.id?t.add(te(r)):t.add(A(r.id))}return t}function ae(e){return _(R.visualScenes[e],re)}if(0===e.length)return{scene:new THREE.Scene};var m=o((new DOMParser).parseFromString(e,"application/xml"),"COLLADA")[0],e=(m.getAttribute("version"),e=o(m,"asset")[0],{unit:void 0!==(v=o(e,"unit")[0])?parseFloat(v.getAttribute("meter")):1,upAxis:void 0!==(v=o(e,"up_axis")[0])?v.textContent:"Y_UP"}),oe=new THREE.TextureLoader(this.manager),g=(oe.setPath(t).setCrossOrigin(this.crossOrigin),[]),v={},R={animations:{},clips:{},controllers:{},images:{},effects:{},materials:{},cameras:{},lights:{},geometries:{},nodes:{},visualScenes:{},kinematicsModels:{},kinematicsScenes:{}};n(m,"library_animations","animation",function(e){for(var t={sources:{},samplers:{},channels:{}},n=0,i=e.childNodes.length;n<i;n++){var r,a=e.childNodes[n];if(1===a.nodeType)switch(a.nodeName){case"source":r=a.getAttribute("id"),t.sources[r]=s(a);break;case"sampler":r=a.getAttribute("id"),t.samplers[r]=(e=>{for(var t={inputs:{}},n=0,i=e.childNodes.length;n<i;n++){var r,a=e.childNodes[n];1===a.nodeType&&"input"===a.nodeName&&(r=l(a.getAttribute("source")),a=a.getAttribute("semantic"),t.inputs[a]=r)}return t})(a);break;case"channel":r=a.getAttribute("target"),t.channels[r]=(e=>{var t={},n=e.getAttribute("target").split("/"),i=n.shift(),r=-1!==(s=n.shift()).indexOf("("),a=-1!==s.indexOf(".");if(a)s=(n=s.split(".")).shift(),t.member=n.shift();else if(r){for(var o=s.split("("),s=o.shift(),c=0;c<o.length;c++)o[c]=parseInt(o[c].replace(/\)/,""));t.indices=o}return t.id=i,t.sid=s,t.arraySyntax=r,t.memberSyntax=a,t.sampler=l(e.getAttribute("source")),t})(a)}}R.animations[e.getAttribute("id")]=t}),n(m,"library_animation_clips","animation_clip",function(e){for(var t={name:e.getAttribute("id")||"default",start:parseFloat(e.getAttribute("start")||0),end:parseFloat(e.getAttribute("end")||0),animations:[]},n=0,i=e.childNodes.length;n<i;n++){var r=e.childNodes[n];1===r.nodeType&&"instance_animation"===r.nodeName&&t.animations.push(l(r.getAttribute("url")))}R.clips[e.getAttribute("id")]=t}),n(m,"library_controllers","controller",function(e){for(var t={},n=0,i=e.childNodes.length;n<i;n++){var r=e.childNodes[n];if(1===r.nodeType)switch(r.nodeName){case"skin":t.id=l(r.getAttribute("source")),t.skin=D(r);break;case"morph":t.id=l(r.getAttribute("source")),console.warn("THREE.ColladaLoader: Morph target animation not supported yet.")}}R.controllers[e.getAttribute("id")]=t}),n(m,"library_images","image",function(e){var t={init_from:o(e,"init_from")[0].textContent};R.images[e.getAttribute("id")]=t}),n(m,"library_effects","effect",function(e){for(var t={},n=0,i=e.childNodes.length;n<i;n++){var r=e.childNodes[n];1===r.nodeType&&"profile_COMMON"===r.nodeName&&(t.profile=B(r))}R.effects[e.getAttribute("id")]=t}),n(m,"library_materials","material",function(e){for(var t={name:e.getAttribute("name")},n=0,i=e.childNodes.length;n<i;n++){var r=e.childNodes[n];1===r.nodeType&&"instance_effect"===r.nodeName&&(t.url=l(r.getAttribute("url")))}R.materials[e.getAttribute("id")]=t}),n(m,"library_cameras","camera",function(e){for(var t={name:e.getAttribute("name")},n=0,i=e.childNodes.length;n<i;n++){var r=e.childNodes[n];1===r.nodeType&&"optics"===r.nodeName&&(t.optics=G(r))}R.cameras[e.getAttribute("id")]=t}),n(m,"library_lights","light",function(e){for(var t={},n=0,i=e.childNodes.length;n<i;n++){var r=e.childNodes[n];1===r.nodeType&&"technique_common"===r.nodeName&&(t=j(r))}R.lights[e.getAttribute("id")]=t}),n(m,"library_geometries","geometry",function(e){for(var t={name:e.getAttribute("name"),sources:{},vertices:{},primitives:[]},n=o(e,"mesh")[0],i=0;i<n.childNodes.length;i++){var r=n.childNodes[i];if(1===r.nodeType){var a=r.getAttribute("id");switch(r.nodeName){case"source":t.sources[a]=s(r);break;case"vertices":t.vertices=(e=>{for(var t={},n=0;n<e.childNodes.length;n++){var i=e.childNodes[n];1===i.nodeType&&(t[i.getAttribute("semantic")]=l(i.getAttribute("source")))}return t})(r);break;case"polygons":console.warn("THREE.ColladaLoader: Unsupported primitive type: ",r.nodeName);break;case"lines":case"linestrips":case"polylist":case"triangles":t.primitives.push((e=>{for(var t={type:e.nodeName,material:e.getAttribute("material"),count:parseInt(e.getAttribute("count")),inputs:{},stride:0},n=0,i=e.childNodes.length;n<i;n++){var r=e.childNodes[n];if(1===r.nodeType)switch(r.nodeName){case"input":var a=l(r.getAttribute("source")),o=r.getAttribute("semantic"),s=parseInt(r.getAttribute("offset"));t.inputs[o]={id:a,offset:s},t.stride=Math.max(t.stride,s+1);break;case"vcount":t.vcount=c(r.textContent);break;case"p":t.p=c(r.textContent)}}return t})(r))}}}R.geometries[e.getAttribute("id")]=t}),n(m,"library_nodes","node",f),n(m,"library_visual_scenes","visual_scene",function(e){for(var t={name:e.getAttribute("name"),rx:parseFloat(e.getAttribute("rx")),ry:parseFloat(e.getAttribute("ry")),rz:parseFloat(e.getAttribute("rz")),tx:parseFloat(e.getAttribute("tx")),ty:parseFloat(e.getAttribute("ty")),tz:parseFloat(e.getAttribute("tz")),sx:parseFloat(e.getAttribute("sx")),sy:parseFloat(e.getAttribute("sy")),sz:parseFloat(e.getAttribute("sz")),children:[]},n=o(e,"node"),i=0;i<n.length;i++)t.children.push(f(n[i]));R.visualScenes[e.getAttribute("id")]=t}),n(m,"library_kinematics_models","kinematics_model",function(e){for(var t={name:e.getAttribute("name")||"",joints:{},links:[]},n=0;n<e.childNodes.length;n++){var i=e.childNodes[n];1===i.nodeType&&"technique_common"===i.nodeName&&Z(i,t)}R.kinematicsModels[e.getAttribute("id")]=t}),n(m,"scene","instance_kinematics_scene",function(e){for(var t={bindJointAxis:[]},n=0;n<e.childNodes.length;n++){var i=e.childNodes[n];1===i.nodeType&&"bind_joint_axis"===i.nodeName&&t.bindJointAxis.push((e=>{for(var t={target:e.getAttribute("target").split("/").pop()},n=0;n<e.childNodes.length;n++){var i=e.childNodes[n];1===i.nodeType&&"axis"===i.nodeName&&(i=i.getElementsByTagName("param")[0],t.axis=i.textContent,i=t.axis.split("inst_").pop().split("axis")[0],t.jointIndex=i.substr(0,i.length-1))}return t})(i))}R.kinematicsScenes[l(e.getAttribute("url"))]=t}),i(R.animations,r),i(R.clips,a),i(R.controllers,T),i(R.images,F),i(R.effects,H),i(R.materials,z),i(R.cameras,V),i(R.lights,W),i(R.geometries,X),i(R.visualScenes,re);var se,t=R.clips;if(!0===h(t)){if(!1===h(R.animations)){var ce=[];for(x in R.animations)for(var le=d(x),y=0,he=le.length;y<he;y++)ce.push(le[y]);g.push(new THREE.AnimationClip("default",-1,ce))}}else for(var x in t)g.push((se=x,_(R.clips[se],a)));var t=Object.keys(R.kinematicsModels)[0],C=Object.keys(R.kinematicsScenes)[0],L=Object.keys(R.visualScenes)[0];if(void 0!==t&&void 0!==C){for(var P=_(R.kinematicsModels[t],Y),t=_(R.kinematicsScenes[C],Q),ue=ae(L),de=t.bindJointAxis,N={},O=0,pe=de.length;O<pe;O++){var fe=de[O],I=m.querySelector('[sid="'+fe.target+'"]');I&&(I=I.parentElement,((t,n)=>{var i=n.getAttribute("name"),r=P.joints[t];ue.traverse(function(e){e.name===i&&(N[t]={object:e,transforms:(e=>{for(var t=[],n=m.querySelector('[id="'+e.id+'"]'),i=0;i<n.childNodes.length;i++){var r=n.childNodes[i];if(1===r.nodeType)switch(r.nodeName){case"matrix":var a=u(r.textContent),o=(new THREE.Matrix4).fromArray(a).transpose();t.push({sid:r.getAttribute("sid"),type:r.nodeName,obj:o});break;case"translate":case"scale":var a=u(r.textContent),s=(new THREE.Vector3).fromArray(a);t.push({sid:r.getAttribute("sid"),type:r.nodeName,obj:s});break;case"rotate":a=u(r.textContent);s=(new THREE.Vector3).fromArray(a),o=THREE.Math.degToRad(a[3]);t.push({sid:r.getAttribute("sid"),type:r.nodeName,obj:s,angle:o})}}return t})(n),joint:r,position:r.zeroPosition})})})(fe.jointIndex,I))}var U=new THREE.Matrix4;v={joints:P&&P.joints,getJointValue:function(e){var t=N[e];if(t)return t.position;console.warn("THREE.ColladaLoader: Joint "+e+" doesn't exist.")},setJointValue:function(e,t){var n=N[e];if(n){var i=n.joint;if(t>i.limits.max||t<i.limits.min)console.warn("THREE.ColladaLoader: Joint "+e+" value "+t+" outside of limits (min: "+i.limits.min+", max: "+i.limits.max+").");else if(i.static)console.warn("THREE.ColladaLoader: Joint "+e+" is static.");else{var r=n.object,a=i.axis,o=n.transforms;S.identity();for(var s=0;s<o.length;s++){var c=o[s];if(c.sid&&-1!==c.sid.indexOf(e))switch(i.type){case"revolute":S.multiply(U.makeRotationAxis(a,THREE.Math.degToRad(t)));break;case"prismatic":S.multiply(U.makeTranslation(a.x*t,a.y*t,a.z*t));break;default:console.warn("THREE.ColladaLoader: Unknown joint type: "+i.type)}else switch(c.type){case"matrix":S.multiply(c.obj);break;case"translate":S.multiply(U.makeTranslation(c.obj.x,c.obj.y,c.obj.z));break;case"scale":S.scale(c.obj);break;case"rotate":S.multiply(U.makeRotationAxis(c.obj,c.angle))}}r.matrix.copy(S),r.matrix.decompose(r.position,r.quaternion,r.scale),N[e].position=t}}}}}C=o(m,"scene")[0];L=ae(l(o(C,"instance_visual_scene")[0].getAttribute("url")));return L.scale.multiplyScalar(e.unit),{animations:g,kinematics:v,library:R,scene:L}}},e.exports=THREE.ColladaLoader},function(e,t){THREE.OrbitControls=function(e,t){this.object=e,this.domElement=void 0!==t?t:document,this.enabled=!0,this.target=new THREE.Vector3,this.minDistance=0,this.maxDistance=1/0,this.minZoom=0,this.maxZoom=1/0,this.minPolarAngle=0,this.maxPolarAngle=Math.PI,this.minAzimuthAngle=-1/0,this.maxAzimuthAngle=1/0,this.enableDamping=!1,this.dampingFactor=.25,this.enableZoom=!0,this.zoomSpeed=1,this.enableRotate=!0,this.rotateSpeed=1,this.enablePan=!0,this.keyPanSpeed=7,this.autoRotate=!1,this.autoRotateSpeed=2,this.enableKeys=!0,this.keys={LEFT:37,UP:38,RIGHT:39,BOTTOM:40},this.mouseButtons={ORBIT:THREE.MOUSE.LEFT,ZOOM:THREE.MOUSE.MIDDLE,PAN:THREE.MOUSE.RIGHT},this.target0=this.target.clone(),this.position0=this.object.position.clone(),this.zoom0=this.object.zoom,this.getPolarAngle=function(){return d.phi},this.getAzimuthalAngle=function(){return d.theta},this.saveState=function(){s.target0.copy(s.target),s.position0.copy(s.object.position),s.zoom0=s.object.zoom},this.reset=function(){s.target.copy(s.target0),s.object.position.copy(s.position0),s.object.zoom=s.zoom0,s.object.updateProjectionMatrix(),s.dispatchEvent(D),s.update(),u=h.NONE},this.update=(n=new THREE.Vector3,i=(new THREE.Quaternion).setFromUnitVectors(e.up,new THREE.Vector3(0,1,0)),r=i.clone().inverse(),a=new THREE.Vector3,o=new THREE.Quaternion,function(){var e=s.object.position;return n.copy(e).sub(s.target),n.applyQuaternion(i),d.setFromVector3(n),s.autoRotate&&u===h.NONE&&A(2*Math.PI/60/60*s.autoRotateSpeed),d.theta+=p.theta,d.phi+=p.phi,d.theta=Math.max(s.minAzimuthAngle,Math.min(s.maxAzimuthAngle,d.theta)),d.phi=Math.max(s.minPolarAngle,Math.min(s.maxPolarAngle,d.phi)),d.makeSafe(),d.radius*=f,d.radius=Math.max(s.minDistance,Math.min(s.maxDistance,d.radius)),s.target.add(m),n.setFromSpherical(d),n.applyQuaternion(r),e.copy(s.target).add(n),s.object.lookAt(s.target),!0===s.enableDamping?(p.theta*=1-s.dampingFactor,p.phi*=1-s.dampingFactor):p.set(0,0,0),f=1,m.set(0,0,0),!!(g||a.distanceToSquared(s.object.position)>F||8*(1-o.dot(s.object.quaternion))>F)&&(s.dispatchEvent(D),a.copy(s.object.position),o.copy(s.object.quaternion),!(g=!1))}),this.dispose=function(){s.domElement.removeEventListener("contextmenu",q,!1),s.domElement.removeEventListener("mousedown",z,!1),s.domElement.removeEventListener("wheel",G,!1),s.domElement.removeEventListener("touchstart",j,!1),s.domElement.removeEventListener("touchend",X,!1),s.domElement.removeEventListener("touchmove",W,!1),document.removeEventListener("mousemove",I,!1),document.removeEventListener("mouseup",U,!1),window.removeEventListener("keydown",V,!1)};var n,i,r,a,o,s=this,D={type:"change"},c={type:"start"},l={type:"end"},h={NONE:-1,ROTATE:0,DOLLY:1,PAN:2,TOUCH_ROTATE:3,TOUCH_DOLLY:4,TOUCH_PAN:5},u=h.NONE,F=1e-6,d=new THREE.Spherical,p=new THREE.Spherical,f=1,m=new THREE.Vector3,g=!1,v=new THREE.Vector2,y=new THREE.Vector2,x=new THREE.Vector2,b=new THREE.Vector2,w=new THREE.Vector2,_=new THREE.Vector2,E=new THREE.Vector2,T=new THREE.Vector2,M=new THREE.Vector2;function S(){return Math.pow(.95,s.zoomSpeed)}function A(e){p.theta-=e}function B(e){p.phi-=e}function k(e,t){R.setFromMatrixColumn(t,0),R.multiplyScalar(-e),m.add(R)}R=new THREE.Vector3;L=new THREE.Vector3;var R,C,L,H=function(e,t){L.setFromMatrixColumn(t,1),L.multiplyScalar(e),m.add(L)},P=(C=new THREE.Vector3,function(e,t){var n,i=s.domElement===document?s.domElement.body:s.domElement;s.object.isPerspectiveCamera?(n=s.object.position,C.copy(n).sub(s.target),n=C.length(),n*=Math.tan(s.object.fov/2*Math.PI/180),k(2*e*n/i.clientHeight,s.object.matrix),H(2*t*n/i.clientHeight,s.object.matrix)):s.object.isOrthographicCamera?(k(e*(s.object.right-s.object.left)/s.object.zoom/i.clientWidth,s.object.matrix),H(t*(s.object.top-s.object.bottom)/s.object.zoom/i.clientHeight,s.object.matrix)):(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - pan disabled."),s.enablePan=!1)});function N(e){s.object.isPerspectiveCamera?f/=e:s.object.isOrthographicCamera?(s.object.zoom=Math.max(s.minZoom,Math.min(s.maxZoom,s.object.zoom*e)),s.object.updateProjectionMatrix(),g=!0):(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."),s.enableZoom=!1)}function O(e){s.object.isPerspectiveCamera?f*=e:s.object.isOrthographicCamera?(s.object.zoom=Math.max(s.minZoom,Math.min(s.maxZoom,s.object.zoom/e)),s.object.updateProjectionMatrix(),g=!0):(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."),s.enableZoom=!1)}function z(e){if(!1!==s.enabled){switch(e.preventDefault(),e.button){case s.mouseButtons.ORBIT:if(!1===s.enableRotate)return;v.set(e.clientX,e.clientY),u=h.ROTATE;break;case s.mouseButtons.ZOOM:if(!1===s.enableZoom)return;E.set(e.clientX,e.clientY),u=h.DOLLY;break;case s.mouseButtons.PAN:if(!1===s.enablePan)return;b.set(e.clientX,e.clientY),u=h.PAN}u!==h.NONE&&(document.addEventListener("mousemove",I,!1),document.addEventListener("mouseup",U,!1),s.dispatchEvent(c))}}function I(e){if(!1!==s.enabled)switch(e.preventDefault(),u){case h.ROTATE:!1!==s.enableRotate&&(y.set(e.clientX,e.clientY),x.subVectors(y,v),t=s.domElement===document?s.domElement.body:s.domElement,A(2*Math.PI*x.x/t.clientWidth*s.rotateSpeed),B(2*Math.PI*x.y/t.clientHeight*s.rotateSpeed),v.copy(y),s.update());break;case h.DOLLY:!1!==s.enableZoom&&(T.set(e.clientX,e.clientY),M.subVectors(T,E),0<M.y?N(S()):M.y<0&&O(S()),E.copy(T),s.update());break;case h.PAN:if(!1===s.enablePan)return;w.set(e.clientX,e.clientY),_.subVectors(w,b),P(_.x,_.y),b.copy(w),s.update()}var t}function U(e){!1!==s.enabled&&(document.removeEventListener("mousemove",I,!1),document.removeEventListener("mouseup",U,!1),s.dispatchEvent(l),u=h.NONE)}function G(e){!1===s.enabled||!1===s.enableZoom||u!==h.NONE&&u!==h.ROTATE||(e.preventDefault(),e.stopPropagation(),(e=e).deltaY<0?O(S()):0<e.deltaY&&N(S()),s.update(),s.dispatchEvent(c),s.dispatchEvent(l))}function V(e){if(!1!==s.enabled&&!1!==s.enableKeys&&!1!==s.enablePan)switch(e.keyCode){case s.keys.UP:P(0,s.keyPanSpeed),s.update();break;case s.keys.BOTTOM:P(0,-s.keyPanSpeed),s.update();break;case s.keys.LEFT:P(s.keyPanSpeed,0),s.update();break;case s.keys.RIGHT:P(-s.keyPanSpeed,0),s.update()}}function j(e){if(!1!==s.enabled){switch(e.touches.length){case 1:if(!1===s.enableRotate)return;v.set(e.touches[0].pageX,e.touches[0].pageY),u=h.TOUCH_ROTATE;break;case 2:if(!1===s.enableZoom)return;t=e.touches[0].pageX-e.touches[1].pageX,n=e.touches[0].pageY-e.touches[1].pageY,t=Math.sqrt(t*t+n*n),E.set(0,t),u=h.TOUCH_DOLLY;break;case 3:if(!1===s.enablePan)return;b.set(e.touches[0].pageX,e.touches[0].pageY),u=h.TOUCH_PAN;break;default:u=h.NONE}u!==h.NONE&&s.dispatchEvent(c)}var t,n}function W(e){if(!1!==s.enabled)switch(e.preventDefault(),e.stopPropagation(),e.touches.length){case 1:!1!==s.enableRotate&&u===h.TOUCH_ROTATE&&(y.set(e.touches[0].pageX,e.touches[0].pageY),x.subVectors(y,v),n=s.domElement===document?s.domElement.body:s.domElement,A(2*Math.PI*x.x/n.clientWidth*s.rotateSpeed),B(2*Math.PI*x.y/n.clientHeight*s.rotateSpeed),v.copy(y),s.update());break;case 2:!1!==s.enableZoom&&u===h.TOUCH_DOLLY&&(n=e.touches[0].pageX-e.touches[1].pageX,t=e.touches[0].pageY-e.touches[1].pageY,n=Math.sqrt(n*n+t*t),T.set(0,n),M.subVectors(T,E),0<M.y?O(S()):M.y<0&&N(S()),E.copy(T),s.update());break;case 3:!1!==s.enablePan&&u===h.TOUCH_PAN&&(w.set(e.touches[0].pageX,e.touches[0].pageY),_.subVectors(w,b),P(_.x,_.y),b.copy(w),s.update());break;default:u=h.NONE}var t,n}function X(e){!1!==s.enabled&&(s.dispatchEvent(l),u=h.NONE)}function q(e){!1!==s.enabled&&e.preventDefault()}s.domElement.addEventListener("contextmenu",q,!1),s.domElement.addEventListener("mousedown",z,!1),s.domElement.addEventListener("wheel",G,!1),s.domElement.addEventListener("touchstart",j,!1),s.domElement.addEventListener("touchend",X,!1),s.domElement.addEventListener("touchmove",W,!1),window.addEventListener("keydown",V,!1),this.update()},THREE.OrbitControls.prototype=Object.create(THREE.EventDispatcher.prototype),THREE.OrbitControls.prototype.constructor=THREE.OrbitControls,Object.defineProperties(THREE.OrbitControls.prototype,{center:{get:function(){return console.warn("THREE.OrbitControls: .center has been renamed to .target"),this.target}},noZoom:{get:function(){return console.warn("THREE.OrbitControls: .noZoom has been deprecated. Use .enableZoom instead."),!this.enableZoom},set:function(e){console.warn("THREE.OrbitControls: .noZoom has been deprecated. Use .enableZoom instead."),this.enableZoom=!e}},noRotate:{get:function(){return console.warn("THREE.OrbitControls: .noRotate has been deprecated. Use .enableRotate instead."),!this.enableRotate},set:function(e){console.warn("THREE.OrbitControls: .noRotate has been deprecated. Use .enableRotate instead."),this.enableRotate=!e}},noPan:{get:function(){return console.warn("THREE.OrbitControls: .noPan has been deprecated. Use .enablePan instead."),!this.enablePan},set:function(e){console.warn("THREE.OrbitControls: .noPan has been deprecated. Use .enablePan instead."),this.enablePan=!e}},noKeys:{get:function(){return console.warn("THREE.OrbitControls: .noKeys has been deprecated. Use .enableKeys instead."),!this.enableKeys},set:function(e){console.warn("THREE.OrbitControls: .noKeys has been deprecated. Use .enableKeys instead."),this.enableKeys=!e}},staticMoving:{get:function(){return console.warn("THREE.OrbitControls: .staticMoving has been deprecated. Use .enableDamping instead."),!this.enableDamping},set:function(e){console.warn("THREE.OrbitControls: .staticMoving has been deprecated. Use .enableDamping instead."),this.enableDamping=!e}},dynamicDampingFactor:{get:function(){return console.warn("THREE.OrbitControls: .dynamicDampingFactor has been renamed. Use .dampingFactor instead."),this.dampingFactor},set:function(e){console.warn("THREE.OrbitControls: .dynamicDampingFactor has been renamed. Use .dampingFactor instead."),this.dampingFactor=e}}}),e.exports=THREE.OrbitControls},function(e,t){var n,i,e=e.exports={};function r(){throw new Error("setTimeout has not been defined")}function a(){throw new Error("clearTimeout has not been defined")}function o(t){if(n===setTimeout)return setTimeout(t,0);if((n===r||!n)&&setTimeout)return(n=setTimeout)(t,0);try{return n(t,0)}catch(e){try{return n.call(null,t,0)}catch(e){return n.call(this,t,0)}}}try{n="function"==typeof setTimeout?setTimeout:r}catch(e){n=r}try{i="function"==typeof clearTimeout?clearTimeout:a}catch(e){i=a}var s,c=[],l=!1,h=-1;function u(){l&&s&&(l=!1,s.length?c=s.concat(c):h=-1,c.length)&&d()}function d(){if(!l){var e=o(u);l=!0;for(var t=c.length;t;){for(s=c,c=[];++h<t;)s&&s[h].run();h=-1,t=c.length}s=null,l=!1,function(t){if(i===clearTimeout)return clearTimeout(t);if((i===a||!i)&&clearTimeout)return(i=clearTimeout)(t);try{i(t)}catch(e){try{return i.call(null,t)}catch(e){return i.call(this,t)}}}(e)}}function p(e,t){this.fun=e,this.array=t}function f(){}e.nextTick=function(e){var t=new Array(arguments.length-1);if(1<arguments.length)for(var n=1;n<arguments.length;n++)t[n-1]=arguments[n];c.push(new p(e,t)),1!==c.length||l||o(d)},p.prototype.run=function(){this.fun.apply(null,this.array)},e.title="browser",e.browser=!0,e.env={},e.argv=[],e.version="",e.versions={},e.on=f,e.addListener=f,e.once=f,e.off=f,e.removeListener=f,e.removeAllListeners=f,e.emit=f,e.prependListener=f,e.prependOnceListener=f,e.listeners=function(e){return[]},e.binding=function(e){throw new Error("process.binding is not supported")},e.cwd=function(){return"/"},e.chdir=function(e){throw new Error("process.chdir is not supported")},e.umask=function(){return 0}},function(e,t,n){n.r(t);var t={},x=(n.r(t),n.d(t,"Camera",function(){return M}),n.d(t,"Version",function(){return g}),n.d(t,"Viewer",function(){return m}),n(0)),i=(n(6),n(7),n(8),n(2));function r(){A(this,r)}v(r,null,[{key:"init",value:function(){window.THREE=x,window.Detector=i}}]);function a(){var e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:b.default;A(this,a),e===b.blender?(this[_.FRONT]=new h(l.hPhi,0),this[_.BACK]=new h(1.2*l.hPhi,Math.PI),this[_.LEFT]=new h(l.hPhi,-Math.PI/2+l.hTheta/2),this[_.RIGHT]=new h(l.hPhi,Math.PI/2-l.hTheta/2),this[_.TOP]=new h(Math.PI/2-1.2*l.hPhi,0),this[_.BOTTOM]=new h(Math.PI/2+1.2*l.hPhi,Math.PI)):(this[_.FRONT]=new h(l.hPhi,l.hTheta),this[_.BACK]=new h(l.hPhi,Math.PI-l.hTheta),this[_.LEFT]=new h(l.hPhi,-Math.PI/2+l.hTheta),this[_.RIGHT]=new h(l.hPhi,Math.PI/2-l.hTheta),this[_.TOP]=new h(Math.PI/2-l.hPhi,l.vTheta),this[_.BOTTOM]=new h(Math.PI/2+l.hPhi,l.vTheta))}function o(e){A(this,o),this.all=e.slice().map(function(e){return null==e?"":e+(0<=e.indexOf("?")?"&":"?")+"t="+Date.now().toString()}),this.front=this.all[0]||"",this.back=this.all[1]||"",this.other=this.all.slice(2)}function s(e){A(this,s),this.model=e.model,this.images=new o(e.images),e.animation?this.animation=e.animation:delete this.animation,e.position?this.position=e.position:delete this.position}var b,w,c,_={FRONT:0,BACK:1,LEFT:2,RIGHT:3,TOP:4,BOTTOM:5},l=function e(){A(this,e)},h=(l.hPhi=Math.PI/2.5,l.hTheta=Math.PI/10,l.vTheta=Math.PI/20,function e(t,n){A(this,e),this.phi=t,this.theta=n}),u={backgroundColor:"#f5f5f5",preloader:!1,fullSceneLoad:!1,axesHelperEnabled:!1,orbitsControlEnabled:!0,onLoadCallback:function(){},aspectRatio:"container",modelType:"default",pauseAtEnd:!1},E=(0,(c=b=b||{}).default="default",c.blender="blender",(c=w=w||{}).window="window",c.container="container",(()=>{function e(){A(this,e),this.promise=new Promise(function(e,t){this._resolve=e,this._reject=t}.bind(this))}return v(e,[{key:"then",value:function(e){return this.promise.then(e)}},{key:"catch",value:function(e){return this.promise.catch(e)}},{key:"resolve",value:function(){this._resolve(0<arguments.length&&void 0!==arguments[0]?arguments[0]:null)}},{key:"reject",value:function(){this._reject(0<arguments.length&&void 0!==arguments[0]?arguments[0]:null)}}]),e})()),d=n(3),p=n(4),T=n(1),f=n(5),m=(()=>{function y(s){var t,n,a,r=this,e=1<arguments.length&&void 0!==arguments[1]&&arguments[1],o=(A(this,y),this.elementModels=[],this.PauseAnimation=function(){var e,t=S(r.mixer._actions);try{for(t.s();!(e=t.n()).done;)e.value.paused=!0}catch(e){t.e(e)}finally{t.f()}},this.StopAnimation=function(){var e,t=S(r.mixer._actions);try{for(t.s();!(e=t.n()).done;){var n=e.value;n.paused=!0,n.time=0}}catch(e){t.e(e)}finally{t.f()}},this.ResetAnimation=function(){var e,t=S(r.mixer._actions);try{for(t.s();!(e=t.n()).done;)e.value.time=0}catch(e){t.e(e)}finally{t.f()}},this.StartAnimation=function(){var e,t=S(r.mixer._actions);try{for(t.s();!(e=t.n()).done;){var n=e.value;n.time===n._clip.duration&&(n.time=0),n.paused=!1}}catch(e){t.e(e)}finally{t.f()}},this.SetAnimationAt=function(e){var t,n=S(r.mixer._actions);try{for(n.s();!(t=n.n()).done;)t.value.time=e}catch(e){n.e(e)}finally{n.f()}},this.GetAnimationDuration=function(){var e,t=0,n=S(r.mixer._actions);try{for(n.s();!(e=n.n()).done;){var i=e.value;i._clip.duration>t&&(t=i._clip.duration)}}catch(e){n.e(e)}finally{n.f()}return t},this.GetAnimationTime=function(){var e,t=0,n=S(r.mixer._actions);try{for(n.s();!(e=n.n()).done;){var i=e.value;i.time>t&&(t=i.time)}}catch(e){n.e(e)}finally{n.f()}return t},this.DecreaseAnimationSpeed=function(){var e,t=0<arguments.length&&void 0!==arguments[0]?arguments[0]:.1,n=S(r.mixer._actions);try{for(n.s();!(e=n.n()).done;){var i=e.value;0<i.timeScale&&.04<i.timeScale-t&&(i.timeScale-=t),i.timeScale<0&&Math.abs(i.timeScale+t)>Math.abs(.04)&&(i.timeScale-=-1*t)}}catch(e){n.e(e)}finally{n.f()}},this.EncreaseAnimationSpeed=function(){var e,t=0<arguments.length&&void 0!==arguments[0]?arguments[0]:.25,n=S(r.mixer._actions);try{for(n.s();!(e=n.n()).done;){var i=e.value;i.timeScale+=t*(i.timeScale<0?-1:1)}}catch(e){n.e(e)}finally{n.f()}},this.SetAnimationSpeed=function(){var e,t=0<arguments.length&&void 0!==arguments[0]?arguments[0]:1,n=S(r.mixer._actions);try{for(n.s();!(e=n.n()).done;){var i=e.value;i.timeScale=t*(i.timeScale<0?-1:1)}}catch(e){n.e(e)}finally{n.f()}},this.RevertAnimation=function(){var e,t=S(r.mixer._actions);try{for(t.s();!(e=t.n()).done;)e.value.timeScale*=-1}catch(e){t.e(e)}finally{t.f()}},this.PauseAtEnd=function(e){var t,n=S(r.mixer._actions);try{for(n.s();!(t=n.n()).done;)t.value.clampWhenFinished=e}catch(e){n.e(e)}finally{n.f()}},this),i=((s=this._validateParams(s)).elements=this._getElementsFromParams(s),this._params=s,this.initContainers(s),this.showPreloader(),new E),c=new E;function l(){return o._params.aspectRatio===w.window?window.innerWidth/window.innerHeight:o._params.container.offsetWidth/o._params.container.offsetHeight}function h(){function e(){o._params.aspectRatio===w.container&&(t=(e=o._params.container).offsetWidth,e=e.offsetHeight,o.canvasContainer.style.width=t+"px",o.canvasContainer.style.height=e+"px"),o.camera.aspect=l(),o.camera.updateProjectionMatrix();var e,t=o._params.aspectRatio===w.window?{width:window.innerWidth,height:window.innerHeight}:{width:o._params.container.offsetWidth,height:o._params.container.offsetHeight};o.renderer.setSize(t.width,t.height)}var t;!0===(0<arguments.length&&void 0!==arguments[0]&&arguments[0])?t=setInterval(function(){e(),"0px"!==o.canvasContainer.style.width&&"0px"!==o.canvasContainer.style.height&&clearInterval(t)},250):e()}function u(){var e=t.getDelta();void 0!==o.mixer&&o.mixer.update(e),o.renderer.render(a,o.camera)}if((s.modelType===b.blender?x.BlenderColladaLoader:x.ColladaLoader).prototype.load=e?function(e,t){e=e.replace("<up_axis>Z_UP</up_axis>","<up_axis>Y_UP</up_axis>");for(var n=0;n<s.elements.length;n++){var i=s.elements[n].images.front,r=s.elements[n].images.back;i&&(e=e.replace("<init_from>{front}.jpg</init_from>","<init_from>"+i+"</init_from>")),r&&(e=e.replace("<init_from>{back}.jpg</init_from>","<init_from>"+r+"</init_from>"))}t(this.parse(e,""))}:function(r,a,e,t){var o=this;new x.FileLoader(o.manager).load(r,function(e){e=e.replace("<up_axis>Z_UP</up_axis>","<up_axis>Y_UP</up_axis>");for(var t,n,i=0;i<s.elements.length;i++)-1!=r.indexOf(s.elements[i].model)&&(t=s.elements[i].images.front,n=s.elements[i].images.back,t&&(e=e.replace("<init_from>{front}.jpg</init_from>","<init_from>"+t+"</init_from>")),n)&&(e=e.replace("<init_from>{back}.jpg</init_from>","<init_from>"+n+"</init_from>"));a(o.parse(e,""))},e,t)},x.DefaultLoadingManager.onProgress=function(e,t,n){t===n&&i.resolve()},window.Detector.webgl){M.settings=new M.settings.constructor(o._params.modelType),o.camera=new x.PerspectiveCamera(45,l(),.05,1e4),o.camera.up.set(0,0,1),o.camera.position.copy(new x.Vector3(60,60,60)),o.camera.lookAt(new x.Vector3(0,0,0)),a=new x.Scene,t=new x.Clock,o.mixer=new x.AnimationMixer;var d=0,p=(o.mixer.addEventListener("loop",function(){++d==s.elements.length&&c.resolve()}),s.axesHelperEnabled&&(p=new x.AxesHelper(1e3),a.add(p)),new x.AmbientLight(16777200,.45));a.add(p),a.background=new x.Color(s.backgroundColor),(p=new x.SpotLight(16777215,.07)).position.set(300,300,300),a.add(p),(p=new x.HemisphereLight(16777200,11184810,.45)).position.set(0,0,1),a.add(p);for(var f=[i.promise],m=(s.fullSceneLoad&&f.push(c.promise),o._params.modelType===b.blender?x.BlenderColladaLoader:x.ColladaLoader),g=function(e){var r,t=new m;r=e,f.push(new Promise(function(i){t.load(s.elements[e].model,function(e){function t(e){null!=e.material&&(e.material.flatShading=x.FlatShading),null!=e.children&&0<e.children.length&&e.children.forEach(t)}var n=e.animations;0<n.length&&(n=o.mixer.clipAction(n[0],e.scene),!0===o._params.pauseAtEnd&&(n.clampWhenFinished=!0,n.loop=x.LoopOnce),n.play());e.scene.children.forEach(t),s.elements[r].position&&e.scene.position.add(s.elements[r].position),a.add(e.scene),e.scene.visible=!1,o.elementModels[r]=e.scene,i()})}))},v=0;v<s.elements.length;v++)g(v);o.renderer=new x.WebGLRenderer({antialias:!0,alpha:!0,preserveDrawingBuffer:!0,logarithmicDepthBuffer:!0}),o.renderer.setClearColor(new x.Color(s.backgroundColor)),o.renderer.setPixelRatio(window.devicePixelRatio),h(),o.canvasContainer.innerHTML="",o.canvasContainer.appendChild(o.renderer.domElement),s.orbitsControlEnabled&&((n=new x.OrbitControls(o.camera,o.renderer.domElement)).addEventListener("change",u),n.enableZoom=!0),window.addEventListener("resize",h,!1),Promise.all(f).then(function(){for(var e=0;e<o.elementModels.length;e++)o.elementModels[e].visible=!0;h(!0),o.moveCamera(_.FRONT),o.hidePreloader(),o.ResetAnimation(),"function"==typeof s.onLoadCallback&&setTimeout(function(){s.onLoadCallback()},0)}),!function e(){T.update(),requestAnimationFrame(e),null!=n&&n.update(),u()}()}else window.Detector.addGetWebGLMessage({parent:o.canvasContainer})}return v(y,[{key:"moveElement",value:function(e,t,n){Array.isArray(t)||(t=[t]);var i=this.elementModels[e];if(void 0===n)i.position.copy(t[t.length-1]);else{for(var e=new T.Tween(i.position).to(t[0],1e3),r=e,a=1;a<t.length;a++){var o=new T.Tween(i.position).to(t[a],1e3).easing(T.Easing.Quadratic.InOut);r.chain(o),r=o}e.easing(T.Easing.Quadratic.InOut).start()}}},{key:"getElementPositions",value:function(e,t){Array.isArray(t)||(t=[t]);var n=[],i=this.elementModels[e].position.clone();n.push(i);for(var r=0;r<t.length;r++){var a=i.clone();a.add(t[r]),n.push(a),i=a}return n}},{key:"animate",value:function(e){void 0===e&&(e=!1);for(var t,n=this._params.elements,i=0;i<n.length;i++)n[i].animation&&(void 0===n[i].animationPositions&&(t=this.getElementPositions(i,n[i].animation),n[i].animationPositions=t.slice(1,t.length),n[i].reverseAnimationPositions=t.slice(0,t.length-1),n[i].reverseAnimationPositions.reverse()),e?this.moveElement(i,n[i].reverseAnimationPositions,!0):this.moveElement(i,n[i].animationPositions,!0))}},{key:"toggleElement",value:function(e,t){this.elementModels[e].visible=t}},{key:"moveCamera",value:function(e,t,n){void 0===n&&(n=this.getCameraDistance());var i,r,n=M.getSphericalPosition(n,e);void 0===t?this.camera.position.copy(this.getVector3FromSpherical(n)):(T.removeAll(),i=this.getSphericalFromVector3(this.camera.position),r=this,new T.Tween(i).to(n,1e3).easing(T.Easing.Quadratic.InOut).onUpdate(function(){r.camera.position.copy(r.getVector3FromSpherical(i))}).start())}},{key:"getBoundingSize",value:function(){var a=new x.Vector3(0,0,0),o=a.clone();if(this._params.modelType===b.blender)this.elementModels.forEach(function(e){e=(new x.Box3).setFromObject(e);a.min(e.min),o.max(e.max)});else for(var e=function e(t){for(var n=0;n<t.children.length;n++){var i,r=t.children[n];r instanceof x.Bone&&(i=r.getWorldPosition(),a.min(i),o.max(i)),e(r)}},t=0;t<this.elementModels.length;t++)e(this.elementModels[t]);return a.distanceTo(o)}},{key:"getCameraDistance",value:function(){return 1.5*this.getBoundingSize()}},{key:"getVector3FromSpherical",value:function(e){var t=new x.Vector3;return t.setFromSpherical(e),new x.Vector3(t.z,t.x,t.y)}},{key:"getSphericalFromVector3",value:function(e){var t=new x.Spherical;return t.setFromVector3(new x.Vector3(e.y,e.z,e.x)),t}},{key:"_getElementsFromParams",value:function(e){return e.items.map(function(e){return new s(e)})}},{key:"_validateParams",value:function(e){return e.aspectRatio=e.aspectRatio||w.container,void 0===e.axesHelperEnabled&&(e.axesHelperEnabled=!1),void 0===e.orbitsControlEnabled&&(e.orbitsControlEnabled=!0),void 0===e.modelType&&(e.modelType=b.default),void 0===(e=Object.assign({},u,e)).preloader&&(e.preloader=!0),e}},{key:"_htmlToDomElement",value:function(e){var t=document.createElement("template");return e=e.trim(),t.innerHTML=e,t.content.firstChild}},{key:"_initMainContainer",value:function(e){var t=document.createElement("div");t.classList.add("mainContainer"),this.mainContainer=t,e.container.append(this.mainContainer)}},{key:"_initPreloaderContainer",value:function(e){var t=document.createElement("div"),t=(t.classList.add("preloadContainer"),t.style.display="none",t.appendChild(this._htmlToDomElement(d)),this.preloadContainer=t,this.mainContainer.appendChild(this.preloadContainer),this._htmlToDomElement(p)),e=e.container.parentElement||e.container.parentNode;e.querySelector("style[id='preloaderStyles']")||e.prepend(t)}},{key:"_initCanvasContainer",value:function(e){var t=document.createElement("div");t.classList.add("canvasContainer"),this.canvasContainer=t,this.mainContainer.append(this.canvasContainer)}},{key:"_initContainerStyles",value:function(e){var t=this._htmlToDomElement(f),e=e.container.parentElement||e.container.parentNode;e.querySelector("style[id='containerStyles']")||e.prepend(t)}},{key:"showPreloader",value:function(){!1!==this._params.preloader&&(this.preloadContainer.style.display="",this.canvasContainer.style.display="none")}},{key:"hidePreloader",value:function(){!1!==this._params.preloader&&(this.canvasContainer.style.display="",this.preloadContainer.style.display="none")}},{key:"initContainers",value:function(e){e.container.innerHTML="",this._initMainContainer(e),this._initContainerStyles(e),this._initCanvasContainer(e),this._initPreloaderContainer(e)}}]),y})(),M=new((()=>{function e(){A(this,e),this.positions=_,this.settings=new a}return v(e,[{key:"getSphericalPosition",value:function(e,t){t=this.settings[t];return new x.Spherical(e,t.phi,t.theta)}}]),e})()),g="1.3.2";window.Aurigma=window.Aurigma||{},window.Aurigma.Origami=t}],a={},r.m=n,r.c=a,r.d=function(e,t,n){r.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:n})},r.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},r.t=function(t,e){if(1&e&&(t=r(t)),8&e)return t;if(4&e&&"object"==Xh(t)&&t&&t.__esModule)return t;var n=Object.create(null);if(r.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var i in t)r.d(n,i,function(e){return t[e]}.bind(null,i));return n},r.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return r.d(t,"a",t),t},r.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r.p="",r(r.s=10)}}]);