Difference between revisions of "Template:Humboldt Berlin"

Line 806: Line 806:
 
</div>
 
</div>
  
 
<script type="text/javascript">
 
var ScrollReveal=function(){"use strict";var t={delay:0,distance:"0",duration:600,easing:"cubic-bezier(0.5, 0, 0, 1)",interval:0,opacity:0,origin:"bottom",rotate:{x:0,y:0,z:0},scale:1,cleanup:!0,container:document.documentElement,desktop:!0,mobile:!0,reset:!1,useDelay:"always",viewFactor:0,viewOffset:{top:0,right:0,bottom:0,left:0},afterReset:function(){},afterReveal:function(){},beforeReset:function(){},beforeReveal:function(){}},e={clean:function(){},destroy:function(){},reveal:function(){},sync:function(){},get noop(){return!0}};function n(t){return"object"==typeof window.Node?t instanceof window.Node:null!==t&&"object"==typeof t&&"number"==typeof t.nodeType&&"string"==typeof t.nodeName}function i(t,e){if(void 0===e&&(e=document),t instanceof Array)return t.filter(n);if(n(t))return[t];if(i=t,r=Object.prototype.toString.call(i),"object"==typeof window.NodeList?i instanceof window.NodeList:null!==i&&"object"==typeof i&&"number"==typeof i.length&&/^\[object (HTMLCollection|NodeList|Object)\]$/.test(r)&&(0===i.length||n(i[0])))return Array.prototype.slice.call(t);var i,r;if("string"==typeof t)try{var o=e.querySelectorAll(t);return Array.prototype.slice.call(o)}catch(t){return[]}return[]}function r(t){return null!==t&&t instanceof Object&&(t.constructor===Object||"[object Object]"===Object.prototype.toString.call(t))}function o(t,e){if(r(t))return Object.keys(t).forEach(function(n){return e(t[n],n,t)});if(t instanceof Array)return t.forEach(function(n,i){return e(n,i,t)});throw new TypeError("Expected either an array or object literal.")}function a(t){for(var e=[],n=arguments.length-1;0<n--;)e[n]=arguments[n+1];if(this.constructor.debug&&console){var i="%cScrollReveal: "+t;e.forEach(function(t){return i+="\n — "+t}),console.log(i,"color: #ea654b;")}}function s(){var t=this,e={active:[],stale:[]},n={active:[],stale:[]},r={active:[],stale:[]};try{o(i("[data-sr-id]"),function(t){var n=parseInt(t.getAttribute("data-sr-id"));e.active.push(n)})}catch(t){throw t}o(this.store.elements,function(t){-1===e.active.indexOf(t.id)&&e.stale.push(t.id)}),o(e.stale,function(e){return delete t.store.elements[e]}),o(this.store.elements,function(t){-1===r.active.indexOf(t.containerId)&&r.active.push(t.containerId),t.hasOwnProperty("sequence")&&-1===n.active.indexOf(t.sequence.id)&&n.active.push(t.sequence.id)}),o(this.store.containers,function(t){-1===r.active.indexOf(t.id)&&r.stale.push(t.id)}),o(r.stale,function(e){var n=t.store.containers[e].node;n.removeEventListener("scroll",t.delegate),n.removeEventListener("resize",t.delegate),delete t.store.containers[e]}),o(this.store.sequences,function(t){-1===n.active.indexOf(t.id)&&n.stale.push(t.id)}),o(n.stale,function(e){return delete t.store.sequences[e]})}function c(t){var e,n=this;try{o(i(t),function(t){var i=t.getAttribute("data-sr-id");if(null!==i){e=!0;var r=n.store.elements[i];r.callbackTimer&&window.clearTimeout(r.callbackTimer.clock),t.setAttribute("style",r.styles.inline.generated),t.removeAttribute("data-sr-id"),delete n.store.elements[i]}})}catch(t){return a.call(this,"Clean failed.",t.message)}if(e)try{s.call(this)}catch(t){return a.call(this,"Clean failed.",t.message)}}function h(t){if(t.constructor!==Array)throw new TypeError("Expected array.");if(16===t.length)return t;if(6===t.length){var e=l();return e[0]=t[0],e[1]=t[1],e[4]=t[2],e[5]=t[3],e[12]=t[4],e[13]=t[5],e}throw new RangeError("Expected array with either 6 or 16 values.")}function l(){for(var t=[],e=0;e<16;e++)e%5==0?t.push(1):t.push(0);return t}function u(t,e){for(var n=h(t),i=h(e),r=[],o=0;o<4;o++)for(var a=[n[o],n[o+4],n[o+8],n[o+12]],s=0;s<4;s++){var c=4*s,l=[i[c],i[c+1],i[c+2],i[c+3]],u=a[0]*l[0]+a[1]*l[1]+a[2]*l[2]+a[3]*l[3];r[o+c]=u}return r}function p(t,e){var n=l();return n[0]=t,n[5]="number"==typeof e?e:t,n}var d=function(){var t={},e=document.documentElement.style;function n(n,i){if(void 0===i&&(i=e),n&&"string"==typeof n){if(t[n])return t[n];if("string"==typeof i[n])return t[n]=n;if("string"==typeof i["-webkit-"+n])return t[n]="-webkit-"+n;throw new RangeError('Unable to find "'+n+'" style property.')}throw new TypeError("Expected a string.")}return n.clearCache=function(){return t={}},n}();function f(t,e){void 0===e&&(e={});var n=e.pristine||this.pristine,i="always"===t.config.useDelay||"onload"===t.config.useDelay&&n||"once"===t.config.useDelay&&!t.seen,r=t.visible&&!t.revealed,o=!t.visible&&t.revealed&&t.config.reset;return e.reveal||r?function(t,e){var n=[t.styles.inline.generated,t.styles.opacity.computed,t.styles.transform.generated.final];e?n.push(t.styles.transition.generated.delayed):n.push(t.styles.transition.generated.instant),t.revealed=t.seen=!0,t.node.setAttribute("style",n.filter(function(t){return""!==t}).join(" ")),m.call(this,t,e)}.call(this,t,i):e.reset||o?function(t){var e=[t.styles.inline.generated,t.styles.opacity.generated,t.styles.transform.generated.initial,t.styles.transition.generated.instant];t.revealed=!1,t.node.setAttribute("style",e.filter(function(t){return""!==t}).join(" ")),m.call(this,t)}.call(this,t):void 0}function m(t,e){var n=this,i=e?t.config.duration+t.config.delay:t.config.duration,r=t.revealed?t.config.beforeReveal:t.config.beforeReset,o=t.revealed?t.config.afterReveal:t.config.afterReset,a=0;t.callbackTimer&&(a=Date.now()-t.callbackTimer.start,window.clearTimeout(t.callbackTimer.clock)),r(t.node),t.callbackTimer={start:Date.now(),clock:window.setTimeout(function(){o(t.node),t.callbackTimer=null,t.revealed&&!t.config.reset&&t.config.cleanup&&c.call(n,t.node)},i-a)}}var g,v=(g=0,function(){return g++});function y(t,e){if(void 0===e&&(e=this.pristine),!t.visible&&t.revealed&&t.config.reset)return f.call(this,t,{reset:!0});var n=this.store.sequences[t.sequence.id],i=t.sequence.index;if(n){var r=new x(n,"visible",this.store),o=new x(n,"revealed",this.store);if(n.models={visible:r,revealed:o},!o.body.length){var a=n.members[r.body[0]],s=this.store.elements[a];if(s)return b.call(this,n,r.body[0],-1,e),b.call(this,n,r.body[0],1,e),f.call(this,s,{reveal:!0,pristine:e})}if(!n.blocked.head&&i===[].concat(o.head).pop()&&i>=[].concat(r.body).shift())return b.call(this,n,i,-1,e),f.call(this,t,{reveal:!0,pristine:e});if(!n.blocked.foot&&i===[].concat(o.foot).shift()&&i<=[].concat(r.body).pop())return b.call(this,n,i,1,e),f.call(this,t,{reveal:!0,pristine:e})}}function x(t,e,n){var i=this;this.head=[],this.body=[],this.foot=[],o(t.members,function(t,r){var o=n.elements[t];o&&o[e]&&i.body.push(r)}),this.body.length&&o(t.members,function(t,r){var o=n.elements[t];o&&!o[e]&&(r<i.body[0]?i.head.push(r):i.foot.push(r))})}function b(t,e,n,i){var r=this,o=["head",null,"foot"][1+n],a=t.members[e+n],s=this.store.elements[a];t.blocked[o]=!0,setTimeout(function(){t.blocked[o]=!1,s&&y.call(r,s,i)},t.interval)}function w(){var t=this;s.call(this),o(this.store.elements,function(t){var e=[t.styles.inline.generated];t.visible?(e.push(t.styles.opacity.computed),e.push(t.styles.transform.generated.final)):(e.push(t.styles.opacity.generated),e.push(t.styles.transform.generated.initial)),t.node.setAttribute("style",e.filter(function(t){return""!==t}).join(" "))}),o(this.store.containers,function(e){var n=e.node===document.documentElement?window:e.node;n.addEventListener("scroll",t.delegate),n.addEventListener("resize",t.delegate)}),this.delegate(),this.initTimeout=null}function _(t){return void 0===t&&(t=navigator.userAgent),/Android|iPhone|iPad|iPod/i.test(t)}function M(t){for(var e=[],n=arguments.length-1;0<n--;)e[n]=arguments[n+1];if(r(t))return o(e,function(e){o(e,function(e,n){r(e)?(t[n]&&r(t[n])||(t[n]={}),M(t[n],e)):t[n]=e})}),t;throw new TypeError("Target must be an object literal.")}function E(e,n,r){var s=this;void 0===n&&(n={}),void 0===r&&(r=!1);var f,m=[],g=n.interval||t.interval;try{g&&(f=new function(t){var e=Math.abs(t);if(isNaN(e))throw new RangeError("Invalid sequence interval.");this.id=v(),this.interval=Math.max(e,16),this.members=[],this.models={},this.blocked={head:!1,foot:!1}}(g));var y=i(e);if(!y.length)throw new Error("Invalid reveal target.");o(y.reduce(function(t,e){var r={},a=e.getAttribute("data-sr-id");a?(M(r,s.store.elements[a]),r.node.setAttribute("style",r.styles.inline.computed)):(r.id=v(),r.node=e,r.seen=!1,r.revealed=!1,r.visible=!1);var g=M({},r.config||s.defaults,n);if(!g.mobile&&_()||!g.desktop&&!_())return a&&c.call(s,r),t;var y,x=i(g.container)[0];if(!x)throw new Error("Invalid container.");return x.contains(e)&&(null===(y=function(t){for(var e=[],n=arguments.length-1;0<n--;)e[n]=arguments[n+1];var i=null;return o(e,function(e){o(e,function(e){null===i&&e.node===t&&(i=e.id)})}),i}(x,m,s.store.containers))&&(y=v(),m.push({id:y,node:x})),r.config=g,r.containerId=y,r.styles=function(t){var e=window.getComputedStyle(t.node),n=e.position,i=t.config,r={},o=(t.node.getAttribute("style")||"").match(/[\w-]+\s*:\s*[^;]+\s*/gi)||[];r.computed=o?o.map(function(t){return t.trim()}).join("; ")+";":"",r.generated=o.some(function(t){return t.match(/visibility\s?:\s?visible/i)})?r.computed:o.concat(["visibility: visible"]).map(function(t){return t.trim()}).join("; ")+";";var a,s,c,f,m,g,v,y,x,b,w,_,M,E=parseFloat(e.opacity),T=isNaN(parseFloat(i.opacity))?parseFloat(e.opacity):parseFloat(i.opacity),S={computed:E!==T?"opacity: "+E+";":"",generated:E!==T?"opacity: "+T+";":""},A=[];if(parseFloat(i.distance)){var R="top"===i.origin||"bottom"===i.origin?"Y":"X",L=i.distance;"top"!==i.origin&&"left"!==i.origin||(L=/^-/.test(L)?L.substr(1):"-"+L);var P=L.match(/(^-?\d+\.?\d?)|(em$|px$|%$)/g),C=P[0];switch(P[1]){case"em":L=parseInt(e.fontSize)*C;break;case"px":L=C;break;case"%":L="Y"===R?t.node.getBoundingClientRect().height*C/100:t.node.getBoundingClientRect().width*C/100;break;default:throw new RangeError("Unrecognized or missing distance unit.")}"Y"===R?A.push((c=L,(f=l())[13]=c,f)):A.push((a=L,(s=l())[12]=a,s))}i.rotate.x&&A.push((m=i.rotate.x,g=Math.PI/180*m,(v=l())[5]=v[10]=Math.cos(g),v[6]=v[9]=Math.sin(g),v[9]*=-1,v)),i.rotate.y&&A.push((y=i.rotate.y,x=Math.PI/180*y,(b=l())[0]=b[10]=Math.cos(x),b[2]=b[8]=Math.sin(x),b[2]*=-1,b)),i.rotate.z&&A.push((w=i.rotate.z,_=Math.PI/180*w,(M=l())[0]=M[5]=Math.cos(_),M[1]=M[4]=Math.sin(_),M[4]*=-1,M)),1!==i.scale&&(0===i.scale?A.push(p(2e-4)):A.push(p(i.scale)));var O={};if(A.length){O.property=d("transform"),O.computed={raw:e[O.property],matrix:function(t){if("string"==typeof t){var e=t.match(/matrix(3d)?\(([^)]+)\)/);if(e)return h(e[2].split(", ").map(parseFloat))}return l()}(e[O.property])},A.unshift(O.computed.matrix);var I=A.reduce(u);O.generated={initial:O.property+": matrix3d("+I.join(", ")+");",final:O.property+": matrix3d("+O.computed.matrix.join(", ")+");"}}else O.generated={initial:"",final:""};var N={};if(S.generated||O.generated.initial){N.property=d("transition"),N.computed=e[N.property],N.fragments=[];var U=i.delay,D=i.duration,B=i.easing;S.generated&&N.fragments.push({delayed:"opacity "+D/1e3+"s "+B+" "+U/1e3+"s",instant:"opacity "+D/1e3+"s "+B+" 0s"}),O.generated.initial&&N.fragments.push({delayed:O.property+" "+D/1e3+"s "+B+" "+U/1e3+"s",instant:O.property+" "+D/1e3+"s "+B+" 0s"}),N.computed&&!N.computed.match(/all 0s/)&&N.fragments.unshift({delayed:N.computed,instant:N.computed});var F=N.fragments.reduce(function(t,e,n){return t.delayed+=0===n?e.delayed:", "+e.delayed,t.instant+=0===n?e.instant:", "+e.instant,t},{delayed:"",instant:""});N.generated={delayed:N.property+": "+F.delayed+";",instant:N.property+": "+F.instant+";"}}else N.generated={delayed:"",instant:""};return{inline:r,opacity:S,position:n,transform:O,transition:N}}(r),f&&(r.sequence={id:f.id,index:f.members.length},f.members.push(r.id)),t.push(r)),t},[]),function(t){(s.store.elements[t.id]=t).node.setAttribute("data-sr-id",t.id)})}catch(e){return a.call(this,"Reveal failed.",e.message)}o(m,function(t){s.store.containers[t.id]={id:t.id,node:t.node}}),f&&(this.store.sequences[f.id]=f),!0!==r&&(this.store.history.push({target:e,options:n}),this.initTimeout&&window.clearTimeout(this.initTimeout),this.initTimeout=window.setTimeout(w.bind(this),0))}var T,S=Math.sign||function(t){return(0<t)-(t<0)||+t},A=(T=Date.now(),function(t){var e=Date.now();16<e-T?t(T=e):setTimeout(function(){return A(t)},0)}),R=window.requestAnimationFrame||window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame||A;function L(t,e){for(var n=e?t.node.clientHeight:t.node.offsetHeight,i=e?t.node.clientWidth:t.node.offsetWidth,r=0,o=0,a=t.node;isNaN(a.offsetTop)||(r+=a.offsetTop),isNaN(a.offsetLeft)||(o+=a.offsetLeft),a=a.offsetParent;);return{bounds:{top:r,right:o+i,bottom:r+n,left:o},height:n,width:i}}var P,C,O,I,N,U,D,B,F="4.0.0";function z(n){var r;if(void 0===n&&(n={}),void 0===this||Object.getPrototypeOf(this)!==z.prototype)return new z(n);if(!z.isSupported())return a.call(this,"Instantiation failed.","This browser is not supported."),e;try{r=M({},U||t,n)}catch(n){return a.call(this,"Instantiation failed.","Invalid configuration.",n.message),e}try{if(!i(r.container)[0])throw new Error("Invalid container.");if(!r.mobile&&_()||!r.desktop&&!_())throw new Error("This device is disabled.")}catch(n){return a.call(this,"Instantiation failed.",n.message),e}return U=r,document.documentElement.classList.add("sr"),document.body?document.body.style.height="100%":document.addEventListener("DOMContentLoaded",function(){document.body.style.height="100%"}),this.store={containers:{},elements:{},history:[],sequences:{}},this.pristine=!0,P=P||function(t,e){var n=this;void 0===t&&(t={type:"init"}),void 0===e&&(e=this.store.elements),R(function(){var i="init"===t.type||"resize"===t.type;o(n.store.containers,function(t){i&&(t.geometry=L.call(n,t,!0));var e=function(t){var e,n;return t.node===document.documentElement?(e=window.pageYOffset,n=window.pageXOffset):(e=t.node.scrollTop,n=t.node.scrollLeft),{top:e,left:n}}.call(n,t);t.scroll&&(t.direction={x:S(e.left-t.scroll.left),y:S(e.top-t.scroll.top)}),t.scroll=e}),o(e,function(t){i&&(t.geometry=L.call(n,t)),t.visible=function(t){void 0===t&&(t={});var e=this.store.containers[t.containerId];if(e){var n=Math.max(0,Math.min(1,t.config.viewFactor)),i=t.config.viewOffset,r=t.geometry.bounds.top+t.geometry.height*n,o=t.geometry.bounds.right-t.geometry.width*n,a=t.geometry.bounds.bottom-t.geometry.height*n,s=t.geometry.bounds.left+t.geometry.width*n,c=e.geometry.bounds.top+e.scroll.top+i.top,h=e.geometry.bounds.right+e.scroll.left-i.right,l=e.geometry.bounds.bottom+e.scroll.top-i.bottom,u=e.geometry.bounds.left+e.scroll.left+i.left;return r<l&&u<o&&c<a&&s<h||"fixed"===t.styles.position}}.call(n,t)}),o(e,function(t){t.sequence?y.call(n,t):f.call(n,t)}),n.pristine=!1})}.bind(this),C=C||function(){var t=this;o(this.store.elements,function(t){t.node.setAttribute("style",t.styles.inline.generated),t.node.removeAttribute("data-sr-id")}),o(this.store.containers,function(e){var n=e.node===document.documentElement?window:e.node;n.removeEventListener("scroll",t.delegate),n.removeEventListener("resize",t.delegate)}),this.store={containers:{},elements:{},history:[],sequences:{}}}.bind(this),O=O||E.bind(this),I=I||c.bind(this),N=N||function(){var t=this;o(this.store.history,function(e){E.call(t,e.target,e.options,!0)}),w.call(this)}.bind(this),Object.defineProperty(this,"delegate",{get:function(){return P}}),Object.defineProperty(this,"destroy",{get:function(){return C}}),Object.defineProperty(this,"reveal",{get:function(){return O}}),Object.defineProperty(this,"clean",{get:function(){return I}}),Object.defineProperty(this,"sync",{get:function(){return N}}),Object.defineProperty(this,"defaults",{get:function(){return U}}),Object.defineProperty(this,"version",{get:function(){return F}}),Object.defineProperty(this,"noop",{get:function(){return!1}}),B||(B=this)}return z.isSupported=function(){return("transform"in(e=document.documentElement.style)||"WebkitTransform"in e)&&("transition"in(t=document.documentElement.style)||"WebkitTransition"in t);var t,e},Object.defineProperty(z,"debug",{get:function(){return D||!1},set:function(t){return D="boolean"==typeof t?t:D}}),z(),z}();function addScrollListener(t){for(var e=0;e<t.length;e++)t[e].addEventListener("click",function(t){t.preventDefault();var e=this.getAttribute("data-link"),n=document.getElementById(e);animate(document.scrollingElement||document.documentElement,"scrollTop","",0,n.offsetTop,300,!0)},!1)}function animate(t,e,n,i,r,o,a){if(t){var s=(new Date).getTime(),c=setInterval(function(){var h=Math.min(1,((new Date).getTime()-s)/o);a?t[e]=i+h*(r-i)+n:t.style[e]=i+h*(r-i)+n,1===h&&clearInterval(c)},25);a?t[e]=i+n:t.style[e]=i+n}}!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e(t.THREE={})}(this,function(t){function e(){}function n(t,e){this.x=t||0,this.y=e||0}function i(){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 r(t,e,n,i){this._x=t||0,this._y=e||0,this._z=n||0,this._w=void 0!==i?i:1}function o(t,e,n){this.x=t||0,this.y=e||0,this.z=n||0}function a(){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 s(t,e,i,r,o,c,h,l,u,p){Object.defineProperty(this,"id",{value:Rr++}),this.uuid=Ar.generateUUID(),this.name="",this.image=void 0!==t?t:s.DEFAULT_IMAGE,this.mipmaps=[],this.mapping=void 0!==e?e:s.DEFAULT_MAPPING,this.wrapS=void 0!==i?i:1001,this.wrapT=void 0!==r?r:1001,this.magFilter=void 0!==o?o:1006,this.minFilter=void 0!==c?c:1008,this.anisotropy=void 0!==u?u:1,this.format=void 0!==h?h:1023,this.type=void 0!==l?l:1009,this.offset=new n(0,0),this.repeat=new n(1,1),this.center=new n(0,0),this.rotation=0,this.matrixAutoUpdate=!0,this.matrix=new a,this.generateMipmaps=!0,this.premultiplyAlpha=!1,this.flipY=!0,this.unpackAlignment=4,this.encoding=void 0!==p?p:3e3,this.version=0,this.onUpdate=null}function c(t,e,n,i){this.x=t||0,this.y=e||0,this.z=n||0,this.w=void 0!==i?i:1}function h(t,e,n){this.width=t,this.height=e,this.scissor=new c(0,0,t,e),this.scissorTest=!1,this.viewport=new c(0,0,t,e),void 0===(n=n||{}).minFilter&&(n.minFilter=1006),this.texture=new s(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 l(t,e,n){h.call(this,t,e,n),this.activeMipMapLevel=this.activeCubeFace=0}function u(t,e,n,i,r,o,a,c,h,l,u,p){s.call(this,null,o,a,c,h,l,i,r,u,p),this.image={data:t,width:e,height:n},this.magFilter=void 0!==h?h:1003,this.minFilter=void 0!==l?l:1003,this.flipY=this.generateMipmaps=!1,this.unpackAlignment=1}function p(t,e){this.min=void 0!==t?t:new o(1/0,1/0,1/0),this.max=void 0!==e?e:new o(-1/0,-1/0,-1/0)}function d(t,e){this.center=void 0!==t?t:new o,this.radius=void 0!==e?e:0}function f(t,e){this.normal=void 0!==t?t:new o(1,0,0),this.constant=void 0!==e?e:0}function m(t,e,n,i,r,o){this.planes=[void 0!==t?t:new f,void 0!==e?e:new f,void 0!==n?n:new f,void 0!==i?i:new f,void 0!==r?r:new f,void 0!==o?o:new f]}function g(t,e,n){return void 0===e&&void 0===n?this.set(t):this.setRGB(t,e,n)}function v(t){var e=new WeakMap;return{get:function(t){return t.isInterleavedBufferAttribute&&(t=t.data),e.get(t)},remove:function(n){n.isInterleavedBufferAttribute&&(n=n.data);var i=e.get(n);i&&(t.deleteBuffer(i.buffer),e.delete(n))},update:function(n,i){n.isInterleavedBufferAttribute&&(n=n.data);var r=e.get(n);if(void 0===r)e.set(n,function(e,n){var i=e.array,r=e.dynamic?t.DYNAMIC_DRAW:t.STATIC_DRAW,o=t.createBuffer();return t.bindBuffer(n,o),t.bufferData(n,i,r),e.onUploadCallback(),n=t.FLOAT,i instanceof Float32Array?n=t.FLOAT:i instanceof Float64Array?console.warn("THREE.WebGLAttributes: Unsupported data buffer format: Float64Array."):i instanceof Uint16Array?n=t.UNSIGNED_SHORT:i instanceof Int16Array?n=t.SHORT:i instanceof Uint32Array?n=t.UNSIGNED_INT:i instanceof Int32Array?n=t.INT:i instanceof Int8Array?n=t.BYTE:i instanceof Uint8Array&&(n=t.UNSIGNED_BYTE),{buffer:o,type:n,bytesPerElement:i.BYTES_PER_ELEMENT,version:e.version}}(n,i));else if(r.version<n.version){var o=n,a=o.array,s=o.updateRange;t.bindBuffer(i,r.buffer),!1===o.dynamic?t.bufferData(i,a,t.STATIC_DRAW):-1===s.count?t.bufferSubData(i,0,a):0===s.count?console.error("THREE.WebGLObjects.updateBuffer: dynamic THREE.BufferAttribute marked as needsUpdate but updateRange.count is 0, ensure you are using set methods or updating manually."):(t.bufferSubData(i,s.offset*a.BYTES_PER_ELEMENT,a.subarray(s.offset,s.offset+s.count)),s.count=-1),r.version=n.version}}}}function y(t,e,n,i){this._x=t||0,this._y=e||0,this._z=n||0,this._order=i||y.DefaultOrder}function x(){this.mask=1}function b(){Object.defineProperty(this,"id",{value:Nr++}),this.uuid=Ar.generateUUID(),this.name="",this.type="Object3D",this.parent=null,this.children=[],this.up=b.DefaultUp.clone();var t=new o,e=new y,n=new r,s=new o(1,1,1);e.onChange(function(){n.setFromEuler(e,!1)}),n.onChange(function(){e.setFromQuaternion(n,void 0,!1)}),Object.defineProperties(this,{position:{enumerable:!0,value:t},rotation:{enumerable:!0,value:e},quaternion:{enumerable:!0,value:n},scale:{enumerable:!0,value:s},modelViewMatrix:{value:new i},normalMatrix:{value:new a}}),this.matrix=new i,this.matrixWorld=new i,this.matrixAutoUpdate=b.DefaultMatrixAutoUpdate,this.matrixWorldNeedsUpdate=!1,this.layers=new x,this.visible=!0,this.receiveShadow=this.castShadow=!1,this.frustumCulled=!0,this.renderOrder=0,this.userData={}}function w(){b.call(this),this.type="Camera",this.matrixWorldInverse=new i,this.projectionMatrix=new i}function _(t,e,n,i,r,o){w.call(this),this.type="OrthographicCamera",this.zoom=1,this.view=null,this.left=t,this.right=e,this.top=n,this.bottom=i,this.near=void 0!==r?r:.1,this.far=void 0!==o?o:2e3,this.updateProjectionMatrix()}function M(t,e,n,i,r,a){this.a=t,this.b=e,this.c=n,this.normal=i&&i.isVector3?i:new o,this.vertexNormals=Array.isArray(i)?i:[],this.color=r&&r.isColor?r:new g,this.vertexColors=Array.isArray(r)?r:[],this.materialIndex=void 0!==a?a:0}function E(){Object.defineProperty(this,"id",{value:Ur+=2}),this.uuid=Ar.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.boundingSphere=this.boundingBox=null,this.groupsNeedUpdate=this.lineDistancesNeedUpdate=this.colorsNeedUpdate=this.normalsNeedUpdate=this.uvsNeedUpdate=this.verticesNeedUpdate=this.elementsNeedUpdate=!1}function T(t,e,n){if(Array.isArray(t))throw new TypeError("THREE.BufferAttribute: array should be a Typed Array.");this.name="",this.array=t,this.itemSize=e,this.count=void 0!==t?t.length/e:0,this.normalized=!0===n,this.dynamic=!1,this.updateRange={offset:0,count:-1},this.version=0}function S(t,e,n){T.call(this,new Int8Array(t),e,n)}function A(t,e,n){T.call(this,new Uint8Array(t),e,n)}function R(t,e,n){T.call(this,new Uint8ClampedArray(t),e,n)}function L(t,e,n){T.call(this,new Int16Array(t),e,n)}function P(t,e,n){T.call(this,new Uint16Array(t),e,n)}function C(t,e,n){T.call(this,new Int32Array(t),e,n)}function O(t,e,n){T.call(this,new Uint32Array(t),e,n)}function I(t,e,n){T.call(this,new Float32Array(t),e,n)}function N(t,e,n){T.call(this,new Float64Array(t),e,n)}function U(){this.vertices=[],this.normals=[],this.colors=[],this.uvs=[],this.uvs2=[],this.groups=[],this.morphTargets={},this.skinWeights=[],this.skinIndices=[],this.boundingSphere=this.boundingBox=null,this.groupsNeedUpdate=this.uvsNeedUpdate=this.colorsNeedUpdate=this.normalsNeedUpdate=this.verticesNeedUpdate=!1}function D(t){if(0===t.length)return-1/0;for(var e=t[0],n=1,i=t.length;n<i;++n)t[n]>e&&(e=t[n]);return e}function B(){Object.defineProperty(this,"id",{value:Dr+=2}),this.uuid=Ar.generateUUID(),this.name="",this.type="BufferGeometry",this.index=null,this.attributes={},this.morphAttributes={},this.groups=[],this.boundingSphere=this.boundingBox=null,this.drawRange={start:0,count:1/0}}function F(t,e,n,i,r,o){E.call(this),this.type="BoxGeometry",this.parameters={width:t,height:e,depth:n,widthSegments:i,heightSegments:r,depthSegments:o},this.fromBufferGeometry(new z(t,e,n,i,r,o)),this.mergeVertices()}function z(t,e,n,i,r,a){function s(t,e,n,i,r,a,s,m,g,v,y){var x=a/g,b=s/v,w=a/2,_=s/2,M=m/2;s=g+1;var E,T,S=v+1,A=a=0,R=new o;for(T=0;T<S;T++){var L=T*b-_;for(E=0;E<s;E++)R[t]=(E*x-w)*i,R[e]=L*r,R[n]=M,l.push(R.x,R.y,R.z),R[t]=0,R[e]=0,R[n]=0<m?1:-1,u.push(R.x,R.y,R.z),p.push(E/g),p.push(1-T/v),a+=1}for(T=0;T<v;T++)for(E=0;E<g;E++)t=d+E+s*(T+1),e=d+(E+1)+s*(T+1),n=d+(E+1)+s*T,h.push(d+E+s*T,t,n),h.push(t,e,n),A+=6;c.addGroup(f,A,y),f+=A,d+=a}B.call(this),this.type="BoxBufferGeometry",this.parameters={width:t,height:e,depth:n,widthSegments:i,heightSegments:r,depthSegments:a};var c=this;t=t||1,e=e||1,n=n||1,i=Math.floor(i)||1,r=Math.floor(r)||1,a=Math.floor(a)||1;var h=[],l=[],u=[],p=[],d=0,f=0;s("z","y","x",-1,-1,n,e,t,a,r,0),s("z","y","x",1,-1,n,e,-t,a,r,1),s("x","z","y",1,1,t,n,e,i,a,2),s("x","z","y",1,-1,t,n,-e,i,a,3),s("x","y","z",1,-1,t,e,n,i,r,4),s("x","y","z",-1,-1,t,e,-n,i,r,5),this.setIndex(h),this.addAttribute("position",new I(l,3)),this.addAttribute("normal",new I(u,3)),this.addAttribute("uv",new I(p,2))}function H(t,e,n,i){E.call(this),this.type="PlaneGeometry",this.parameters={width:t,height:e,widthSegments:n,heightSegments:i},this.fromBufferGeometry(new G(t,e,n,i)),this.mergeVertices()}function G(t,e,n,i){B.call(this),this.type="PlaneBufferGeometry",this.parameters={width:t,height:e,widthSegments:n,heightSegments:i};var r=(t=t||1)/2,o=(e=e||1)/2,a=(n=Math.floor(n)||1)+1,s=(i=Math.floor(i)||1)+1,c=t/n,h=e/i,l=[],u=[],p=[],d=[];for(t=0;t<s;t++){var f=t*h-o;for(e=0;e<a;e++)u.push(e*c-r,-f,0),p.push(0,0,1),d.push(e/n),d.push(1-t/i)}for(t=0;t<i;t++)for(e=0;e<n;e++)r=e+a*(t+1),o=e+1+a*(t+1),s=e+1+a*t,l.push(e+a*t,r,s),l.push(r,o,s);this.setIndex(l),this.addAttribute("position",new I(u,3)),this.addAttribute("normal",new I(p,3)),this.addAttribute("uv",new I(d,2))}function k(){Object.defineProperty(this,"id",{value:Br++}),this.uuid=Ar.generateUUID(),this.name="",this.type="Material",this.lights=this.fog=!0,this.blending=1,this.side=0,this.flatShading=!1,this.vertexColors=0,this.opacity=1,this.transparent=!1,this.blendSrc=204,this.blendDst=205,this.blendEquation=100,this.blendEquationAlpha=this.blendDstAlpha=this.blendSrcAlpha=null,this.depthFunc=3,this.depthWrite=this.depthTest=!0,this.clippingPlanes=null,this.clipShadows=this.clipIntersection=!1,this.shadowSide=null,this.colorWrite=!0,this.precision=null,this.polygonOffset=!1,this.polygonOffsetUnits=this.polygonOffsetFactor=0,this.dithering=!1,this.alphaTest=0,this.premultipliedAlpha=!1,this.overdraw=0,this.visible=!0,this.userData={},this.needsUpdate=!0}function V(t){k.call(this),this.type="MeshBasicMaterial",this.color=new g(16777215),this.lightMap=this.map=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.envMap=this.alphaMap=this.specularMap=null,this.combine=0,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinejoin=this.wireframeLinecap="round",this.lights=this.morphTargets=this.skinning=!1,this.setValues(t)}function j(t){k.call(this),this.type="ShaderMaterial",this.defines={},this.uniforms={},this.vertexShader="void main() {\n\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",this.fragmentShader="void main() {\n\tgl_FragColor = vec4( 1.0, 0.0, 0.0, 1.0 );\n}",this.linewidth=1,this.wireframe=!1,this.wireframeLinewidth=1,this.morphNormals=this.morphTargets=this.skinning=this.clipping=this.lights=this.fog=!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,this.uniformsNeedUpdate=!1,void 0!==t&&(void 0!==t.attributes&&console.error("THREE.ShaderMaterial: attributes should now be defined in THREE.BufferGeometry instead."),this.setValues(t))}function W(t,e){this.origin=void 0!==t?t:new o,this.direction=void 0!==e?e:new o}function X(t,e){this.start=void 0!==t?t:new o,this.end=void 0!==e?e:new o}function q(t,e,n){this.a=void 0!==t?t:new o,this.b=void 0!==e?e:new o,this.c=void 0!==n?n:new o}function Y(t,e){b.call(this),this.type="Mesh",this.geometry=void 0!==t?t:new B,this.material=void 0!==e?e:new V({color:16777215*Math.random()}),this.drawMode=0,this.updateMorphTargets()}function Z(t,e,n,i){function r(t,n){e.buffers.color.setClear(t.r,t.g,t.b,n,i)}var o,a,s,c=new g(0),h=0;return{getClearColor:function(){return c},setClearColor:function(t,e){c.set(t),r(c,h=void 0!==e?e:1)},getClearAlpha:function(){return h},setClearAlpha:function(t){r(c,h=t)},render:function(e,i,l,u){null===(i=i.background)?r(c,h):i&&i.isColor&&(r(i,1),u=!0),(t.autoClear||u)&&t.clear(t.autoClearColor,t.autoClearDepth,t.autoClearStencil),i&&i.isCubeTexture?(void 0===s&&((s=new Y(new z(1,1,1),new j({uniforms:Ir.cube.uniforms,vertexShader:Ir.cube.vertexShader,fragmentShader:Ir.cube.fragmentShader,side:1,depthTest:!0,depthWrite:!1,fog:!1}))).geometry.removeAttribute("normal"),s.geometry.removeAttribute("uv"),s.onBeforeRender=function(t,e,n){this.matrixWorld.copyPosition(n.matrixWorld)},n.update(s.geometry)),s.material.uniforms.tCube.value=i,e.push(s,s.geometry,s.material,0,null)):i&&i.isTexture&&(void 0===o&&(o=new _(-1,1,1,-1,0,1),a=new Y(new G(2,2),new V({depthTest:!1,depthWrite:!1,fog:!1})),n.update(a.geometry)),a.material.map=i,t.renderBufferDirect(o,null,a.geometry,a.material,a,null))}}}function J(){function t(){l.value!==i&&(l.value=i,l.needsUpdate=0<r),n.numPlanes=r,n.numIntersection=0}function e(t,e,i,r){var o=null!==t?t.length:0,a=null;if(0!==o){if(a=l.value,!0!==r||null===a)for(r=i+4*o,e=e.matrixWorldInverse,h.getNormalMatrix(e),(null===a||a.length<r)&&(a=new Float32Array(r)),r=0;r!==o;++r,i+=4)c.copy(t[r]).applyMatrix4(e,h),c.normal.toArray(a,i),a[i+3]=c.constant;l.value=a,l.needsUpdate=!0}return n.numPlanes=o,a}var n=this,i=null,r=0,o=!1,s=!1,c=new f,h=new a,l={value:null,needsUpdate:!1};this.uniform=l,this.numIntersection=this.numPlanes=0,this.init=function(t,n,a){var s=0!==t.length||n||0!==r||o;return o=n,i=e(t,a,0),r=t.length,s},this.beginShadows=function(){s=!0,e(null)},this.endShadows=function(){s=!1,t()},this.setState=function(n,a,c,h,u,p){if(!o||null===n||0===n.length||s&&!c)s?e(null):t();else{var d=4*(c=s?0:r),f=u.clippingState||null;for(l.value=f,f=e(n,h,d,p),n=0;n!==d;++n)f[n]=i[n];u.clippingState=f,this.numIntersection=a?this.numPlanes:0,this.numPlanes+=c}}}function Q(t,e,n){function i(t){t=t.target;var a=r[t.id];for(var s in null!==a.index&&e.remove(a.index),a.attributes)e.remove(a.attributes[s]);t.removeEventListener("dispose",i),delete r[t.id],(s=o[t.id])&&(e.remove(s),delete o[t.id]),(s=o[a.id])&&(e.remove(s),delete o[a.id]),n.memory.geometries--}var r={},o={};return{get:function(t,e){var o=r[e.id];return o||(e.addEventListener("dispose",i),e.isBufferGeometry?o=e:e.isGeometry&&(void 0===e._bufferGeometry&&(e._bufferGeometry=(new B).setFromObject(t)),o=e._bufferGeometry),r[e.id]=o,n.memory.geometries++,o)},update:function(n){var i=n.index,r=n.attributes;for(var o in null!==i&&e.update(i,t.ELEMENT_ARRAY_BUFFER),r)e.update(r[o],t.ARRAY_BUFFER);for(o in n=n.morphAttributes){r=0;for(var a=(i=n[o]).length;r<a;r++)e.update(i[r],t.ARRAY_BUFFER)}},getWireframeAttribute:function(n){var i=o[n.id];if(i)return i;i=[];var r=n.index,a=n.attributes;if(null!==r){a=0;for(var s=(r=r.array).length;a<s;a+=3){var c=r[a+0],h=r[a+1],l=r[a+2];i.push(c,h,h,l,l,c)}}else for(r=a.position.array,a=0,s=r.length/3-1;a<s;a+=3)c=a+0,h=a+1,l=a+2,i.push(c,h,h,l,l,c);return i=new(65535<D(i)?O:P)(i,1),e.update(i,t.ELEMENT_ARRAY_BUFFER),o[n.id]=i}}}function K(t,e){return Math.abs(e[1])-Math.abs(t[1])}function $(t,e,n,i,r,o,a,c,h,l){t=void 0!==t?t:[],s.call(this,t,void 0!==e?e:301,n,i,r,o,a,c,h,l),this.flipY=!1}function tt(t,e,n){var i=t[0];if(0>=i||0<i)return t;var r=e*n,o=Hr[r];if(void 0===o&&(o=new Float32Array(r),Hr[r]=o),0!==e)for(i.toArray(o,0),i=1,r=0;i!==e;++i)r+=n,t[i].toArray(o,r);return o}function et(t,e){var n=Gr[e];void 0===n&&(n=new Int32Array(e),Gr[e]=n);for(var i=0;i!==e;++i)n[i]=t.allocTextureUnit();return n}function nt(t,e){t.uniform1f(this.addr,e)}function it(t,e){t.uniform1i(this.addr,e)}function rt(t,e){void 0===e.x?t.uniform2fv(this.addr,e):t.uniform2f(this.addr,e.x,e.y)}function ot(t,e){void 0!==e.x?t.uniform3f(this.addr,e.x,e.y,e.z):void 0!==e.r?t.uniform3f(this.addr,e.r,e.g,e.b):t.uniform3fv(this.addr,e)}function at(t,e){void 0===e.x?t.uniform4fv(this.addr,e):t.uniform4f(this.addr,e.x,e.y,e.z,e.w)}function st(t,e){t.uniformMatrix2fv(this.addr,!1,e.elements||e)}function ct(t,e){void 0===e.elements?t.uniformMatrix3fv(this.addr,!1,e):(Vr.set(e.elements),t.uniformMatrix3fv(this.addr,!1,Vr))}function ht(t,e){void 0===e.elements?t.uniformMatrix4fv(this.addr,!1,e):(kr.set(e.elements),t.uniformMatrix4fv(this.addr,!1,kr))}function lt(t,e,n){var i=n.allocTextureUnit();t.uniform1i(this.addr,i),n.setTexture2D(e||Fr,i)}function ut(t,e,n){var i=n.allocTextureUnit();t.uniform1i(this.addr,i),n.setTextureCube(e||zr,i)}function pt(t,e){t.uniform2iv(this.addr,e)}function dt(t,e){t.uniform3iv(this.addr,e)}function ft(t,e){t.uniform4iv(this.addr,e)}function mt(t,e){t.uniform1fv(this.addr,e)}function gt(t,e){t.uniform1iv(this.addr,e)}function vt(t,e){t.uniform2fv(this.addr,tt(e,this.size,2))}function yt(t,e){t.uniform3fv(this.addr,tt(e,this.size,3))}function xt(t,e){t.uniform4fv(this.addr,tt(e,this.size,4))}function bt(t,e){t.uniformMatrix2fv(this.addr,!1,tt(e,this.size,4))}function wt(t,e){t.uniformMatrix3fv(this.addr,!1,tt(e,this.size,9))}function _t(t,e){t.uniformMatrix4fv(this.addr,!1,tt(e,this.size,16))}function Mt(t,e,n){var i=e.length,r=et(n,i);for(t.uniform1iv(this.addr,r),t=0;t!==i;++t)n.setTexture2D(e[t]||Fr,r[t])}function Et(t,e,n){var i=e.length,r=et(n,i);for(t.uniform1iv(this.addr,r),t=0;t!==i;++t)n.setTextureCube(e[t]||zr,r[t])}function Tt(t,e,n){this.id=t,this.addr=n,this.setValue=function(t){switch(t){case 5126:return nt;case 35664:return rt;case 35665:return ot;case 35666:return at;case 35674:return st;case 35675:return ct;case 35676:return ht;case 35678:case 36198:return lt;case 35680:return ut;case 5124:case 35670:return it;case 35667:case 35671:return pt;case 35668:case 35672:return dt;case 35669:case 35673:return ft}}(e.type)}function St(t,e,n){this.id=t,this.addr=n,this.size=e.size,this.setValue=function(t){switch(t){case 5126:return mt;case 35664:return vt;case 35665:return yt;case 35666:return xt;case 35674:return bt;case 35675:return wt;case 35676:return _t;case 35678:return Mt;case 35680:return Et;case 5124:case 35670:return gt;case 35667:case 35671:return pt;case 35668:case 35672:return dt;case 35669:case 35673:return ft}}(e.type)}function At(t){this.id=t,this.seq=[],this.map={}}function Rt(t,e,n){this.seq=[],this.map={},this.renderer=n,n=t.getProgramParameter(e,t.ACTIVE_UNIFORMS);for(var i=0;i<n;++i){var r=t.getActiveUniform(e,i),o=t.getUniformLocation(e,r.name),a=this,s=r.name,c=s.length;for(jr.lastIndex=0;;){var h=jr.exec(s),l=jr.lastIndex,u=h[1],p=h[3];if("]"===h[2]&&(u|=0),void 0===p||"["===p&&l+2===c){s=a,r=void 0===p?new Tt(u,r,o):new St(u,r,o),s.seq.push(r),s.map[r.id]=r;break}void 0===(p=a.map[u])&&(p=new At(u),u=a,a=p,u.seq.push(a),u.map[a.id]=a),a=p}}}function Lt(t,e,n){var i=t.createShader(e);return t.shaderSource(i,n),t.compileShader(i),!1===t.getShaderParameter(i,t.COMPILE_STATUS)&&console.error("THREE.WebGLShader: Shader couldn't compile."),""!==t.getShaderInfoLog(i)&&console.warn("THREE.WebGLShader: gl.getShaderInfoLog()",e===t.VERTEX_SHADER?"vertex":"fragment",t.getShaderInfoLog(i),function(t){t=t.split("\n");for(var e=0;e<t.length;e++)t[e]=e+1+": "+t[e];return t.join("\n")}(n)),i}function Pt(t){switch(t){case 3e3:return["Linear","( value )"];case 3001:return["sRGB","( value )"];case 3002:return["RGBE","( value )"];case 3004:return["RGBM","( value, 7.0 )"];case 3005:return["RGBM","( value, 16.0 )"];case 3006:return["RGBD","( value, 256.0 )"];case 3007:return["Gamma","( value, float( GAMMA_FACTOR ) )"];default:throw Error("unsupported encoding: "+t)}}function Ct(t,e){return"vec4 "+t+"( vec4 value ) { return "+(e=Pt(e))[0]+"ToLinear"+e[1]+"; }"}function Ot(t){return""!==t}function It(t,e){return t.replace(/NUM_DIR_LIGHTS/g,e.numDirLights).replace(/NUM_SPOT_LIGHTS/g,e.numSpotLights).replace(/NUM_RECT_AREA_LIGHTS/g,e.numRectAreaLights).replace(/NUM_POINT_LIGHTS/g,e.numPointLights).replace(/NUM_HEMI_LIGHTS/g,e.numHemiLights)}function Nt(t,e){return t.replace(/NUM_CLIPPING_PLANES/g,e.numClippingPlanes).replace(/UNION_CLIPPING_PLANES/g,e.numClippingPlanes-e.numClipIntersection)}function Ut(t){return t.replace(/^[ \t]*#include +<([\w\d.]+)>/gm,function(t,e){if(void 0===(t=Lr[e]))throw Error("Can not resolve #include <"+e+">");return Ut(t)})}function Dt(t){return t.replace(/#pragma unroll_loop[\s]+?for \( int i = (\d+); i < (\d+); i \+\+ \) \{([\s\S]+?)(?=\})\}/g,function(t,e,n,i){for(t="",e=parseInt(e);e<parseInt(n);e++)t+=i.replace(/\[ i \]/g,"[ "+e+" ]");return t})}function Bt(t,e,n,i,r,o){var a=t.context,s=i.defines,c=r.vertexShader,h=r.fragmentShader,l="SHADOWMAP_TYPE_BASIC";1===o.shadowMapType?l="SHADOWMAP_TYPE_PCF":2===o.shadowMapType&&(l="SHADOWMAP_TYPE_PCF_SOFT");var u="ENVMAP_TYPE_CUBE",p="ENVMAP_MODE_REFLECTION",d="ENVMAP_BLENDING_MULTIPLY";if(o.envMap){switch(i.envMap.mapping){case 301:case 302:u="ENVMAP_TYPE_CUBE";break;case 306:case 307:u="ENVMAP_TYPE_CUBE_UV";break;case 303:case 304:u="ENVMAP_TYPE_EQUIREC";break;case 305:u="ENVMAP_TYPE_SPHERE"}switch(i.envMap.mapping){case 302:case 304:p="ENVMAP_MODE_REFRACTION"}switch(i.combine){case 0:d="ENVMAP_BLENDING_MULTIPLY";break;case 1:d="ENVMAP_BLENDING_MIX";break;case 2:d="ENVMAP_BLENDING_ADD"}}var f,m,g=0<t.gammaFactor?t.gammaFactor:1,v=function(t,e,n){return[(t=t||{}).derivatives||e.envMapCubeUV||e.bumpMap||e.normalMap||e.flatShading?"#extension GL_OES_standard_derivatives : enable":"",(t.fragDepth||e.logarithmicDepthBuffer)&&n.get("EXT_frag_depth")?"#extension GL_EXT_frag_depth : enable":"",t.drawBuffers&&n.get("WEBGL_draw_buffers")?"#extension GL_EXT_draw_buffers : require":"",(t.shaderTextureLOD||e.envMap)&&n.get("EXT_shader_texture_lod")?"#extension GL_EXT_shader_texture_lod : enable":""].filter(Ot).join("\n")}(i.extensions,o,e),y=function(t){var e,n=[];for(e in t){var i=t[e];!1!==i&&n.push("#define "+e+" "+i)}return n.join("\n")}(s),x=a.createProgram();return i.isRawShaderMaterial?(0<(s=[y].filter(Ot).join("\n")).length&&(s+="\n"),0<(e=[v,y].filter(Ot).join("\n")).length&&(e+="\n")):(s=["precision "+o.precision+" float;","precision "+o.precision+" int;","#define SHADER_NAME "+r.name,y,o.supportsVertexTextures?"#define VERTEX_TEXTURES":"","#define GAMMA_FACTOR "+g,"#define MAX_BONES "+o.maxBones,o.useFog&&o.fog?"#define USE_FOG":"",o.useFog&&o.fogExp?"#define FOG_EXP2":"",o.map?"#define USE_MAP":"",o.envMap?"#define USE_ENVMAP":"",o.envMap?"#define "+p:"",o.lightMap?"#define USE_LIGHTMAP":"",o.aoMap?"#define USE_AOMAP":"",o.emissiveMap?"#define USE_EMISSIVEMAP":"",o.bumpMap?"#define USE_BUMPMAP":"",o.normalMap?"#define USE_NORMALMAP":"",o.displacementMap&&o.supportsVertexTextures?"#define USE_DISPLACEMENTMAP":"",o.specularMap?"#define USE_SPECULARMAP":"",o.roughnessMap?"#define USE_ROUGHNESSMAP":"",o.metalnessMap?"#define USE_METALNESSMAP":"",o.alphaMap?"#define USE_ALPHAMAP":"",o.vertexColors?"#define USE_COLOR":"",o.flatShading?"#define FLAT_SHADED":"",o.skinning?"#define USE_SKINNING":"",o.useVertexTexture?"#define BONE_TEXTURE":"",o.morphTargets?"#define USE_MORPHTARGETS":"",o.morphNormals&&!1===o.flatShading?"#define USE_MORPHNORMALS":"",o.doubleSided?"#define DOUBLE_SIDED":"",o.flipSided?"#define FLIP_SIDED":"",o.shadowMapEnabled?"#define USE_SHADOWMAP":"",o.shadowMapEnabled?"#define "+l:"",o.sizeAttenuation?"#define USE_SIZEATTENUATION":"",o.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",o.logarithmicDepthBuffer&&e.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(Ot).join("\n"),e=[v,"precision "+o.precision+" float;","precision "+o.precision+" int;","#define SHADER_NAME "+r.name,y,o.alphaTest?"#define ALPHATEST "+o.alphaTest:"","#define GAMMA_FACTOR "+g,o.useFog&&o.fog?"#define USE_FOG":"",o.useFog&&o.fogExp?"#define FOG_EXP2":"",o.map?"#define USE_MAP":"",o.envMap?"#define USE_ENVMAP":"",o.envMap?"#define "+u:"",o.envMap?"#define "+p:"",o.envMap?"#define "+d:"",o.lightMap?"#define USE_LIGHTMAP":"",o.aoMap?"#define USE_AOMAP":"",o.emissiveMap?"#define USE_EMISSIVEMAP":"",o.bumpMap?"#define USE_BUMPMAP":"",o.normalMap?"#define USE_NORMALMAP":"",o.specularMap?"#define USE_SPECULARMAP":"",o.roughnessMap?"#define USE_ROUGHNESSMAP":"",o.metalnessMap?"#define USE_METALNESSMAP":"",o.alphaMap?"#define USE_ALPHAMAP":"",o.vertexColors?"#define USE_COLOR":"",o.gradientMap?"#define USE_GRADIENTMAP":"",o.flatShading?"#define FLAT_SHADED":"",o.doubleSided?"#define DOUBLE_SIDED":"",o.flipSided?"#define FLIP_SIDED":"",o.shadowMapEnabled?"#define USE_SHADOWMAP":"",o.shadowMapEnabled?"#define "+l:"",o.premultipliedAlpha?"#define PREMULTIPLIED_ALPHA":"",o.physicallyCorrectLights?"#define PHYSICALLY_CORRECT_LIGHTS":"",o.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",o.logarithmicDepthBuffer&&e.get("EXT_frag_depth")?"#define USE_LOGDEPTHBUF_EXT":"",o.envMap&&e.get("EXT_shader_texture_lod")?"#define TEXTURE_LOD_EXT":"","uniform mat4 viewMatrix;","uniform vec3 cameraPosition;",0!==o.toneMapping?"#define TONE_MAPPING":"",0!==o.toneMapping?Lr.tonemapping_pars_fragment:"",0!==o.toneMapping?function(t,e){switch(e){case 1:e="Linear";break;case 2:e="Reinhard";break;case 3:e="Uncharted2";break;case 4:e="OptimizedCineon";break;default:throw Error("unsupported toneMapping: "+e)}return"vec3 "+t+"( vec3 color ) { return "+e+"ToneMapping( color ); }"}("toneMapping",o.toneMapping):"",o.dithering?"#define DITHERING":"",o.outputEncoding||o.mapEncoding||o.envMapEncoding||o.emissiveMapEncoding?Lr.encodings_pars_fragment:"",o.mapEncoding?Ct("mapTexelToLinear",o.mapEncoding):"",o.envMapEncoding?Ct("envMapTexelToLinear",o.envMapEncoding):"",o.emissiveMapEncoding?Ct("emissiveMapTexelToLinear",o.emissiveMapEncoding):"",o.outputEncoding?function(t,e){return"vec4 "+t+"( vec4 value ) { return LinearTo"+(e=Pt(e))[0]+e[1]+"; }"}("linearToOutputTexel",o.outputEncoding):"",o.depthPacking?"#define DEPTH_PACKING "+i.depthPacking:"","\n"].filter(Ot).join("\n")),c=Nt(c=It(c=Ut(c),o),o),h=Nt(h=It(h=Ut(h),o),o),c=Dt(c),h=e+(h=Dt(h)),c=Lt(a,a.VERTEX_SHADER,s+c),h=Lt(a,a.FRAGMENT_SHADER,h),a.attachShader(x,c),a.attachShader(x,h),void 0!==i.index0AttributeName?a.bindAttribLocation(x,0,i.index0AttributeName):!0===o.morphTargets&&a.bindAttribLocation(x,0,"position"),a.linkProgram(x),o=a.getProgramInfoLog(x).trim(),l=a.getShaderInfoLog(c).trim(),u=a.getShaderInfoLog(h).trim(),d=p=!0,!1===a.getProgramParameter(x,a.LINK_STATUS)?(p=!1,console.error("THREE.WebGLProgram: shader error: ",a.getError(),"gl.VALIDATE_STATUS",a.getProgramParameter(x,a.VALIDATE_STATUS),"gl.getProgramInfoLog",o,l,u)):""!==o?console.warn("THREE.WebGLProgram: gl.getProgramInfoLog()",o):""!==l&&""!==u||(d=!1),d&&(this.diagnostics={runnable:p,material:i,programLog:o,vertexShader:{log:l,prefix:s},fragmentShader:{log:u,prefix:e}}),a.deleteShader(c),a.deleteShader(h),this.getUniforms=function(){return void 0===f&&(f=new Rt(a,x,t)),f},this.getAttributes=function(){if(void 0===m){for(var t={},e=a.getProgramParameter(x,a.ACTIVE_ATTRIBUTES),n=0;n<e;n++){var i=a.getActiveAttrib(x,n).name;t[i]=a.getAttribLocation(x,i)}m=t}return m},this.destroy=function(){a.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.name=r.name,this.id=Wr++,this.code=n,this.usedTimes=1,this.program=x,this.vertexShader=c,this.fragmentShader=h,this}function Ft(t,e){return t.renderOrder!==e.renderOrder?t.renderOrder-e.renderOrder:t.program&&e.program&&t.program!==e.program?t.program.id-e.program.id:t.material.id!==e.material.id?t.material.id-e.material.id:t.z!==e.z?t.z-e.z:t.id-e.id}function zt(t,e){return t.renderOrder!==e.renderOrder?t.renderOrder-e.renderOrder:t.z!==e.z?e.z-t.z:t.id-e.id}function Ht(){var t={};return{get:function(e,n){return e=e.id+","+n.id,void 0===(n=t[e])&&(n=new function(){var t=[],e=0,n=[],i=[];return{opaque:n,transparent:i,init:function(){e=0,n.length=0,i.length=0},push:function(r,o,a,s,c){var h=t[e];void 0===h?(h={id:r.id,object:r,geometry:o,material:a,program:a.program,renderOrder:r.renderOrder,z:s,group:c},t[e]=h):(h.id=r.id,h.object=r,h.geometry=o,h.material=a,h.program=a.program,h.renderOrder=r.renderOrder,h.z=s,h.group=c),(!0===a.transparent?i:n).push(h),e++},sort:function(){1<n.length&&n.sort(Ft),1<i.length&&i.sort(zt)}}},t[e]=n),n},dispose:function(){t={}}}}function Gt(){var t=new function(){var t={};return{get:function(e){if(void 0!==t[e.id])return t[e.id];switch(e.type){case"DirectionalLight":var i={direction:new o,color:new g,shadow:!1,shadowBias:0,shadowRadius:1,shadowMapSize:new n};break;case"SpotLight":i={position:new o,direction:new o,color:new g,distance:0,coneCos:0,penumbraCos:0,decay:0,shadow:!1,shadowBias:0,shadowRadius:1,shadowMapSize:new n};break;case"PointLight":i={position:new o,color:new g,distance:0,decay:0,shadow:!1,shadowBias:0,shadowRadius:1,shadowMapSize:new n,shadowCameraNear:1,shadowCameraFar:1e3};break;case"HemisphereLight":i={direction:new o,skyColor:new g,groundColor:new g};break;case"RectAreaLight":i={color:new g,position:new o,halfWidth:new o,halfHeight:new o}}return t[e.id]=i}}},e={id:Xr++,hash:"",ambient:[0,0,0],directional:[],directionalShadowMap:[],directionalShadowMatrix:[],spot:[],spotShadowMap:[],spotShadowMatrix:[],rectArea:[],point:[],pointShadowMap:[],pointShadowMatrix:[],hemi:[]},r=new o,a=new i,s=new i;return{setup:function(n,i,o){var c=0,h=0,l=0,u=0,p=0,d=0,f=0,m=0;o=o.matrixWorldInverse;for(var g=0,v=n.length;g<v;g++){var y=n[g],x=y.color,b=y.intensity,w=y.distance,_=y.shadow&&y.shadow.map?y.shadow.map.texture:null;if(y.isAmbientLight)c+=x.r*b,h+=x.g*b,l+=x.b*b;else if(y.isDirectionalLight){var M=t.get(y);M.color.copy(y.color).multiplyScalar(y.intensity),M.direction.setFromMatrixPosition(y.matrixWorld),r.setFromMatrixPosition(y.target.matrixWorld),M.direction.sub(r),M.direction.transformDirection(o),(M.shadow=y.castShadow)&&(x=y.shadow,M.shadowBias=x.bias,M.shadowRadius=x.radius,M.shadowMapSize=x.mapSize),e.directionalShadowMap[u]=_,e.directionalShadowMatrix[u]=y.shadow.matrix,e.directional[u]=M,u++}else y.isSpotLight?((M=t.get(y)).position.setFromMatrixPosition(y.matrixWorld),M.position.applyMatrix4(o),M.color.copy(x).multiplyScalar(b),M.distance=w,M.direction.setFromMatrixPosition(y.matrixWorld),r.setFromMatrixPosition(y.target.matrixWorld),M.direction.sub(r),M.direction.transformDirection(o),M.coneCos=Math.cos(y.angle),M.penumbraCos=Math.cos(y.angle*(1-y.penumbra)),M.decay=0===y.distance?0:y.decay,(M.shadow=y.castShadow)&&(x=y.shadow,M.shadowBias=x.bias,M.shadowRadius=x.radius,M.shadowMapSize=x.mapSize),e.spotShadowMap[d]=_,e.spotShadowMatrix[d]=y.shadow.matrix,e.spot[d]=M,d++):y.isRectAreaLight?((M=t.get(y)).color.copy(x).multiplyScalar(b),M.position.setFromMatrixPosition(y.matrixWorld),M.position.applyMatrix4(o),s.identity(),a.copy(y.matrixWorld),a.premultiply(o),s.extractRotation(a),M.halfWidth.set(.5*y.width,0,0),M.halfHeight.set(0,.5*y.height,0),M.halfWidth.applyMatrix4(s),M.halfHeight.applyMatrix4(s),e.rectArea[f]=M,f++):y.isPointLight?((M=t.get(y)).position.setFromMatrixPosition(y.matrixWorld),M.position.applyMatrix4(o),M.color.copy(y.color).multiplyScalar(y.intensity),M.distance=y.distance,M.decay=0===y.distance?0:y.decay,(M.shadow=y.castShadow)&&(x=y.shadow,M.shadowBias=x.bias,M.shadowRadius=x.radius,M.shadowMapSize=x.mapSize,M.shadowCameraNear=x.camera.near,M.shadowCameraFar=x.camera.far),e.pointShadowMap[p]=_,e.pointShadowMatrix[p]=y.shadow.matrix,e.point[p]=M,p++):y.isHemisphereLight&&((M=t.get(y)).direction.setFromMatrixPosition(y.matrixWorld),M.direction.transformDirection(o),M.direction.normalize(),M.skyColor.copy(y.color).multiplyScalar(b),M.groundColor.copy(y.groundColor).multiplyScalar(b),e.hemi[m]=M,m++)}e.ambient[0]=c,e.ambient[1]=h,e.ambient[2]=l,e.directional.length=u,e.spot.length=d,e.rectArea.length=f,e.point.length=p,e.hemi.length=m,e.hash=e.id+","+u+","+p+","+d+","+f+","+m+","+i.length},state:e}}function kt(){var t={};return{get:function(e,n){return e=e.id+","+n.id,void 0===(n=t[e])&&(n=new function(){var t=new Gt,e=[],n=[],i=[];return{init:function(){e.length=0,n.length=0,i.length=0},state:{lightsArray:e,shadowsArray:n,spritesArray:i,lights:t},setupLights:function(i){t.setup(e,n,i)},pushLight:function(t){e.push(t)},pushShadow:function(t){n.push(t)},pushSprite:function(t){i.push(t)}}},t[e]=n),n},dispose:function(){t={}}}}function Vt(t){k.call(this),this.type="MeshDepthMaterial",this.depthPacking=3200,this.morphTargets=this.skinning=!1,this.displacementMap=this.alphaMap=this.map=null,this.displacementScale=1,this.displacementBias=0,this.wireframe=!1,this.wireframeLinewidth=1,this.lights=this.fog=!1,this.setValues(t)}function jt(t){k.call(this),this.type="MeshDistanceMaterial",this.referencePosition=new o,this.nearDistance=1,this.farDistance=1e3,this.morphTargets=this.skinning=!1,this.displacementMap=this.alphaMap=this.map=null,this.displacementScale=1,this.displacementBias=0,this.lights=this.fog=!1,this.setValues(t)}function Wt(t,e,r){function a(e,n,i,r,o,a){var s=e.geometry,c=v,h=e.customDepthMaterial;return i&&(c=y,h=e.customDistanceMaterial),h?c=h:(h=!1,n.morphTargets&&(s&&s.isBufferGeometry?h=s.morphAttributes&&s.morphAttributes.position&&0<s.morphAttributes.position.length:s&&s.isGeometry&&(h=s.morphTargets&&0<s.morphTargets.length)),e.isSkinnedMesh&&!1===n.skinning&&console.warn("THREE.WebGLShadowMap: THREE.SkinnedMesh with material.skinning set to false:",e),s=0,h&&(s|=1),(e=e.isSkinnedMesh&&n.skinning)&&(s|=2),c=c[s]),t.localClippingEnabled&&!0===n.clipShadows&&0!==n.clippingPlanes.length&&(s=c.uuid,h=n.uuid,void 0===(e=x[s])&&(e={},x[s]=e),void 0===(s=e[h])&&(s=c.clone(),e[h]=s),c=s),c.visible=n.visible,c.wireframe=n.wireframe,c.side=null!=n.shadowSide?n.shadowSide:b[n.side],c.clipShadows=n.clipShadows,c.clippingPlanes=n.clippingPlanes,c.clipIntersection=n.clipIntersection,c.wireframeLinewidth=n.wireframeLinewidth,c.linewidth=n.linewidth,i&&c.isMeshDistanceMaterial&&(c.referencePosition.copy(r),c.nearDistance=o,c.farDistance=a),c}function s(n,i,r,o){if(!1!==n.visible){if(n.layers.test(i.layers)&&(n.isMesh||n.isLine||n.isPoints)&&n.castShadow&&(!n.frustumCulled||l.intersectsObject(n))){n.modelViewMatrix.multiplyMatrices(r.matrixWorldInverse,n.matrixWorld);var c=e.update(n),h=n.material;if(Array.isArray(h))for(var u=c.groups,p=0,d=u.length;p<d;p++){var f=u[p],m=h[f.materialIndex];m&&m.visible&&(m=a(n,m,o,g,r.near,r.far),t.renderBufferDirect(r,null,c,m,n,f))}else h.visible&&(m=a(n,h,o,g,r.near,r.far),t.renderBufferDirect(r,null,c,m,n,null))}for(c=0,h=(n=n.children).length;c<h;c++)s(n[c],i,r,o)}}var l=new m,u=new i,p=new n,d=new n(r,r),f=new o,g=new o,v=Array(4),y=Array(4),x={},b={0:1,1:0,2:2},w=[new o(1,0,0),new o(-1,0,0),new o(0,0,1),new o(0,0,-1),new o(0,1,0),new o(0,-1,0)],_=[new o(0,1,0),new o(0,1,0),new o(0,1,0),new o(0,1,0),new o(0,0,1),new o(0,0,-1)],M=[new c,new c,new c,new c,new c,new c];for(r=0;4!==r;++r){var E=0!=(1&r),T=0!=(2&r),S=new Vt({depthPacking:3201,morphTargets:E,skinning:T});v[r]=S,E=new jt({morphTargets:E,skinning:T}),y[r]=E}var A=this;this.enabled=!1,this.autoUpdate=!0,this.needsUpdate=!1,this.type=1,this.render=function(e,n,i){if(!1!==A.enabled&&(!1!==A.autoUpdate||!1!==A.needsUpdate)&&0!==e.length){var r=t.state;r.disable(t.context.BLEND),r.buffers.color.setClear(1,1,1,1),r.buffers.depth.setTest(!0),r.setScissorTest(!1);for(var o,a=0,c=e.length;a<c;a++){var m=e[a];o=m.shadow;var v=m&&m.isPointLight;if(void 0===o)console.warn("THREE.WebGLShadowMap:",m,"has no shadow.");else{var y=o.camera;if(p.copy(o.mapSize),p.min(d),v){var x=p.x,b=p.y;M[0].set(2*x,b,x,b),M[1].set(0,b,x,b),M[2].set(3*x,b,x,b),M[3].set(x,b,x,b),M[4].set(3*x,0,x,b),M[5].set(x,0,x,b),p.x*=4,p.y*=2}for(null===o.map&&(o.map=new h(p.x,p.y,{minFilter:1003,magFilter:1003,format:1023}),o.map.texture.name=m.name+".shadowMap",y.updateProjectionMatrix()),o.isSpotLightShadow&&o.update(m),x=o.map,b=o.matrix,g.setFromMatrixPosition(m.matrixWorld),y.position.copy(g),v?(o=6,b.makeTranslation(-g.x,-g.y,-g.z)):(o=1,f.setFromMatrixPosition(m.target.matrixWorld),y.lookAt(f),y.updateMatrixWorld(),b.set(.5,0,0,.5,0,.5,0,.5,0,0,.5,.5,0,0,0,1),b.multiply(y.projectionMatrix),b.multiply(y.matrixWorldInverse)),t.setRenderTarget(x),t.clear(),m=0;m<o;m++)v&&(f.copy(y.position),f.add(w[m]),y.up.copy(_[m]),y.lookAt(f),y.updateMatrixWorld(),r.viewport(M[m])),u.multiplyMatrices(y.projectionMatrix,y.matrixWorldInverse),l.setFromMatrix(u),s(n,i,y,v)}}A.needsUpdate=!1}}}function Xt(t,e,n,i,r,o,a,c,h){s.call(this,t,e,n,i,r,o,a,c,h),this.needsUpdate=!0}function qt(t,e,n,i,a){var s,c,h,l,u,p,d,f,m,g,v,y,x,b,w,_,M,E;function T(t,e){return t.renderOrder!==e.renderOrder?t.renderOrder-e.renderOrder:t.z!==e.z?e.z-t.z:e.id-t.id}var S,A,R,L,P=new o,C=new r,O=new o;this.render=function(r,o,I){if(0!==r.length){if(void 0===R){var N=new Float32Array([-.5,-.5,0,0,.5,-.5,1,0,.5,.5,1,1,-.5,.5,0,1]),U=new Uint16Array([0,1,2,0,2,3]);S=e.createBuffer(),A=e.createBuffer(),e.bindBuffer(e.ARRAY_BUFFER,S),e.bufferData(e.ARRAY_BUFFER,N,e.STATIC_DRAW),e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,A),e.bufferData(e.ELEMENT_ARRAY_BUFFER,U,e.STATIC_DRAW),N=e.createProgram(),U=e.createShader(e.VERTEX_SHADER);var D=e.createShader(e.FRAGMENT_SHADER);e.shaderSource(U,["precision "+a.precision+" float;","#define SHADER_NAME SpriteMaterial\nuniform mat4 modelViewMatrix;\nuniform mat4 projectionMatrix;\nuniform float rotation;\nuniform vec2 center;\nuniform vec2 scale;\nuniform vec2 uvOffset;\nuniform vec2 uvScale;\nattribute vec2 position;\nattribute vec2 uv;\nvarying vec2 vUV;\nvarying float fogDepth;\nvoid main() {\n\tvUV = uvOffset + uv * uvScale;\n\tvec2 alignedPosition = ( position - center ) * scale;\n\tvec2 rotatedPosition;\n\trotatedPosition.x = cos( rotation ) * alignedPosition.x - sin( rotation ) * alignedPosition.y;\n\trotatedPosition.y = sin( rotation ) * alignedPosition.x + cos( rotation ) * alignedPosition.y;\n\tvec4 mvPosition;\n\tmvPosition = modelViewMatrix * vec4( 0.0, 0.0, 0.0, 1.0 );\n\tmvPosition.xy += rotatedPosition;\n\tgl_Position = projectionMatrix * mvPosition;\n\tfogDepth = - mvPosition.z;\n}"].join("\n")),e.shaderSource(D,["precision "+a.precision+" float;","#define SHADER_NAME SpriteMaterial\nuniform vec3 color;\nuniform sampler2D map;\nuniform float opacity;\nuniform int fogType;\nuniform vec3 fogColor;\nuniform float fogDensity;\nuniform float fogNear;\nuniform float fogFar;\nuniform float alphaTest;\nvarying vec2 vUV;\nvarying float fogDepth;\nvoid main() {\n\tvec4 texture = texture2D( map, vUV );\n\tgl_FragColor = vec4( color * texture.xyz, texture.a * opacity );\n\tif ( gl_FragColor.a < alphaTest ) discard;\n\tif ( fogType > 0 ) {\n\t\tfloat fogFactor = 0.0;\n\t\tif ( fogType == 1 ) {\n\t\t\tfogFactor = smoothstep( fogNear, fogFar, fogDepth );\n\t\t} else {\n\t\t\tconst float LOG2 = 1.442695;\n\t\t\tfogFactor = exp2( - fogDensity * fogDensity * fogDepth * fogDepth * LOG2 );\n\t\t\tfogFactor = 1.0 - clamp( fogFactor, 0.0, 1.0 );\n\t\t}\n\t\tgl_FragColor.rgb = mix( gl_FragColor.rgb, fogColor, fogFactor );\n\t}\n}"].join("\n")),e.compileShader(U),e.compileShader(D),e.attachShader(N,U),e.attachShader(N,D),e.linkProgram(N),R=N,M=e.getAttribLocation(R,"position"),E=e.getAttribLocation(R,"uv"),s=e.getUniformLocation(R,"uvOffset"),c=e.getUniformLocation(R,"uvScale"),h=e.getUniformLocation(R,"rotation"),l=e.getUniformLocation(R,"center"),u=e.getUniformLocation(R,"scale"),p=e.getUniformLocation(R,"color"),d=e.getUniformLocation(R,"map"),f=e.getUniformLocation(R,"opacity"),m=e.getUniformLocation(R,"modelViewMatrix"),g=e.getUniformLocation(R,"projectionMatrix"),v=e.getUniformLocation(R,"fogType"),y=e.getUniformLocation(R,"fogDensity"),x=e.getUniformLocation(R,"fogNear"),b=e.getUniformLocation(R,"fogFar"),w=e.getUniformLocation(R,"fogColor"),e.getUniformLocation(R,"fogDepth"),_=e.getUniformLocation(R,"alphaTest"),(N=document.createElementNS("http://www.w3.org/1999/xhtml","canvas")).width=8,N.height=8,(U=N.getContext("2d")).fillStyle="white",U.fillRect(0,0,8,8),L=new Xt(N)}n.useProgram(R),n.initAttributes(),n.enableAttribute(M),n.enableAttribute(E),n.disableUnusedAttributes(),n.disable(e.CULL_FACE),n.enable(e.BLEND),e.bindBuffer(e.ARRAY_BUFFER,S),e.vertexAttribPointer(M,2,e.FLOAT,!1,16,0),e.vertexAttribPointer(E,2,e.FLOAT,!1,16,8),e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,A),e.uniformMatrix4fv(g,!1,I.projectionMatrix.elements),n.activeTexture(e.TEXTURE0),e.uniform1i(d,0),U=N=0,(D=o.fog)?(e.uniform3f(w,D.color.r,D.color.g,D.color.b),D.isFog?(e.uniform1f(x,D.near),e.uniform1f(b,D.far),e.uniform1i(v,1),U=N=1):D.isFogExp2&&(e.uniform1f(y,D.density),e.uniform1i(v,2),U=N=2)):(e.uniform1i(v,0),U=N=0),D=0;for(var B=r.length;D<B;D++){var F=r[D];F.modelViewMatrix.multiplyMatrices(I.matrixWorldInverse,F.matrixWorld),F.z=-F.modelViewMatrix.elements[14]}r.sort(T);var z=[],H=[];for(D=0,B=r.length;D<B;D++){var G=(F=r[D]).material;if(!1!==G.visible){F.onBeforeRender(t,o,I,void 0,G,void 0),e.uniform1f(_,G.alphaTest),e.uniformMatrix4fv(m,!1,F.modelViewMatrix.elements),F.matrixWorld.decompose(P,C,O),z[0]=O.x,z[1]=O.y,H[0]=F.center.x-.5,H[1]=F.center.y-.5;var k=0;o.fog&&G.fog&&(k=U),N!==k&&(e.uniform1i(v,k),N=k),null!==G.map?(e.uniform2f(s,G.map.offset.x,G.map.offset.y),e.uniform2f(c,G.map.repeat.x,G.map.repeat.y)):(e.uniform2f(s,0,0),e.uniform2f(c,1,1)),e.uniform1f(f,G.opacity),e.uniform3f(p,G.color.r,G.color.g,G.color.b),e.uniform1f(h,G.rotation),e.uniform2fv(l,H),e.uniform2fv(u,z),n.setBlending(G.blending,G.blendEquation,G.blendSrc,G.blendDst,G.blendEquationAlpha,G.blendSrcAlpha,G.blendDstAlpha,G.premultipliedAlpha),n.buffers.depth.setTest(G.depthTest),n.buffers.depth.setMask(G.depthWrite),n.buffers.color.setMask(G.colorWrite),i.setTexture2D(G.map||L,0),e.drawElements(e.TRIANGLES,6,e.UNSIGNED_SHORT,0),F.onAfterRender(t,o,I,void 0,G,void 0)}}n.enable(e.CULL_FACE),n.reset()}}}function Yt(t,e){return{convert:function(n){if(1e3===n)return t.REPEAT;if(1001===n)return t.CLAMP_TO_EDGE;if(1002===n)return t.MIRRORED_REPEAT;if(1003===n)return t.NEAREST;if(1004===n)return t.NEAREST_MIPMAP_NEAREST;if(1005===n)return t.NEAREST_MIPMAP_LINEAR;if(1006===n)return t.LINEAR;if(1007===n)return t.LINEAR_MIPMAP_NEAREST;if(1008===n)return t.LINEAR_MIPMAP_LINEAR;if(1009===n)return t.UNSIGNED_BYTE;if(1017===n)return t.UNSIGNED_SHORT_4_4_4_4;if(1018===n)return t.UNSIGNED_SHORT_5_5_5_1;if(1019===n)return t.UNSIGNED_SHORT_5_6_5;if(1010===n)return t.BYTE;if(1011===n)return t.SHORT;if(1012===n)return t.UNSIGNED_SHORT;if(1013===n)return t.INT;if(1014===n)return t.UNSIGNED_INT;if(1015===n)return t.FLOAT;if(1016===n){var i=e.get("OES_texture_half_float");if(null!==i)return i.HALF_FLOAT_OES}if(1021===n)return t.ALPHA;if(1022===n)return t.RGB;if(1023===n)return t.RGBA;if(1024===n)return t.LUMINANCE;if(1025===n)return t.LUMINANCE_ALPHA;if(1026===n)return t.DEPTH_COMPONENT;if(1027===n)return t.DEPTH_STENCIL;if(100===n)return t.FUNC_ADD;if(101===n)return t.FUNC_SUBTRACT;if(102===n)return t.FUNC_REVERSE_SUBTRACT;if(200===n)return t.ZERO;if(201===n)return t.ONE;if(202===n)return t.SRC_COLOR;if(203===n)return t.ONE_MINUS_SRC_COLOR;if(204===n)return t.SRC_ALPHA;if(205===n)return t.ONE_MINUS_SRC_ALPHA;if(206===n)return t.DST_ALPHA;if(207===n)return t.ONE_MINUS_DST_ALPHA;if(208===n)return t.DST_COLOR;if(209===n)return t.ONE_MINUS_DST_COLOR;if(210===n)return t.SRC_ALPHA_SATURATE;if((33776===n||33777===n||33778===n||33779===n)&&null!==(i=e.get("WEBGL_compressed_texture_s3tc"))){if(33776===n)return i.COMPRESSED_RGB_S3TC_DXT1_EXT;if(33777===n)return i.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(33778===n)return i.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(33779===n)return i.COMPRESSED_RGBA_S3TC_DXT5_EXT}if((35840===n||35841===n||35842===n||35843===n)&&null!==(i=e.get("WEBGL_compressed_texture_pvrtc"))){if(35840===n)return i.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(35841===n)return i.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(35842===n)return i.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(35843===n)return i.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}if(36196===n&&null!==(i=e.get("WEBGL_compressed_texture_etc1")))return i.COMPRESSED_RGB_ETC1_WEBGL;if((37808===n||37809===n||37810===n||37811===n||37812===n||37813===n||37814===n||37815===n||37816===n||37817===n||37818===n||37819===n||37820===n||37821===n)&&null!==(i=e.get("WEBGL_compressed_texture_astc")))return n;if((103===n||104===n)&&null!==(i=e.get("EXT_blend_minmax"))){if(103===n)return i.MIN_EXT;if(104===n)return i.MAX_EXT}return 1020===n&&null!==(i=e.get("WEBGL_depth_texture"))?i.UNSIGNED_INT_24_8_WEBGL:0}}}function Zt(t,e,n,i){w.call(this),this.type="PerspectiveCamera",this.fov=void 0!==t?t:50,this.zoom=1,this.near=void 0!==n?n:.1,this.far=void 0!==i?i:2e3,this.focus=10,this.aspect=void 0!==e?e:1,this.view=null,this.filmGauge=35,this.filmOffset=0,this.updateProjectionMatrix()}function Jt(t){Zt.call(this),this.cameras=t||[]}function Qt(t){function e(){if(null!==a&&!0===a.isPresenting){var e=a.getEyeParameters("left"),i=e.renderWidth;e=e.renderHeight,y=t.getPixelRatio(),v=t.getSize(),t.setDrawingBufferSize(2*i,e,1)}else n.enabled&&t.setDrawingBufferSize(v.width,v.height,y)}var n=this,a=null,s=null,h=null,l=new i,u=new i;"undefined"!=typeof window&&"VRFrameData"in window&&(s=new window.VRFrameData,window.addEventListener("vrdisplaypresentchange",e,!1));var p=new i,d=new r,f=new o,m=new Zt;m.bounds=new c(0,0,.5,1),m.layers.enable(1);var g=new Zt;g.bounds=new c(.5,0,.5,1),g.layers.enable(2);var v,y,x=new Jt([m,g]);x.layers.enable(1),x.layers.enable(2),this.enabled=!1,this.userHeight=1.6,this.getDevice=function(){return a},this.setDevice=function(t){void 0!==t&&(a=t)},this.setPoseTarget=function(t){void 0!==t&&(h=t)},this.getCamera=function(t){if(null===a)return t;a.depthNear=t.near,a.depthFar=t.far,a.getFrameData(s);var e=a.stageParameters;e?l.fromArray(e.sittingToStandingTransform):l.makeTranslation(0,n.userHeight,0),e=s.pose;var i=null!==h?h:t;return i.matrix.copy(l),i.matrix.decompose(i.position,i.quaternion,i.scale),null!==e.orientation&&(d.fromArray(e.orientation),i.quaternion.multiply(d)),null!==e.position&&(d.setFromRotationMatrix(l),f.fromArray(e.position),f.applyQuaternion(d),i.position.add(f)),i.updateMatrixWorld(),!1===a.isPresenting?t:(m.near=t.near,g.near=t.near,m.far=t.far,g.far=t.far,x.matrixWorld.copy(t.matrixWorld),x.matrixWorldInverse.copy(t.matrixWorldInverse),m.matrixWorldInverse.fromArray(s.leftViewMatrix),g.matrixWorldInverse.fromArray(s.rightViewMatrix),u.getInverse(l),m.matrixWorldInverse.multiply(u),g.matrixWorldInverse.multiply(u),null!==(t=i.parent)&&(p.getInverse(t.matrixWorld),m.matrixWorldInverse.multiply(p),g.matrixWorldInverse.multiply(p)),m.matrixWorld.getInverse(m.matrixWorldInverse),g.matrixWorld.getInverse(g.matrixWorldInverse),m.projectionMatrix.fromArray(s.leftProjectionMatrix),g.projectionMatrix.fromArray(s.rightProjectionMatrix),x.projectionMatrix.copy(m.projectionMatrix),(t=a.getLayers()).length&&(null!==(t=t[0]).leftBounds&&4===t.leftBounds.length&&m.bounds.fromArray(t.leftBounds),null!==t.rightBounds&&4===t.rightBounds.length&&g.bounds.fromArray(t.rightBounds)),x)},this.getStandingMatrix=function(){return l},this.submitFrame=function(){null!==a&&!0===a.isPresenting&&a.submitFrame()},this.dispose=function(){"undefined"!=typeof window&&window.removeEventListener("vrdisplaypresentchange",e)}}function Kt(t){function e(){(C=new function(t){var e={};return{get:function(n){if(void 0!==e[n])return e[n];switch(n){case"WEBGL_depth_texture":var i=t.getExtension("WEBGL_depth_texture")||t.getExtension("MOZ_WEBGL_depth_texture")||t.getExtension("WEBKIT_WEBGL_depth_texture");break;case"EXT_texture_filter_anisotropic":i=t.getExtension("EXT_texture_filter_anisotropic")||t.getExtension("MOZ_EXT_texture_filter_anisotropic")||t.getExtension("WEBKIT_EXT_texture_filter_anisotropic");break;case"WEBGL_compressed_texture_s3tc":i=t.getExtension("WEBGL_compressed_texture_s3tc")||t.getExtension("MOZ_WEBGL_compressed_texture_s3tc")||t.getExtension("WEBKIT_WEBGL_compressed_texture_s3tc");break;case"WEBGL_compressed_texture_pvrtc":i=t.getExtension("WEBGL_compressed_texture_pvrtc")||t.getExtension("WEBKIT_WEBGL_compressed_texture_pvrtc");break;default:i=t.getExtension(n)}return null===i&&console.warn("THREE.WebGLRenderer: "+n+" extension not supported."),e[n]=i}}}(Mt)).get("WEBGL_depth_texture"),C.get("OES_texture_float"),C.get("OES_texture_float_linear"),C.get("OES_texture_half_float"),C.get("OES_texture_half_float_linear"),C.get("OES_standard_derivatives"),C.get("OES_element_index_uint"),C.get("ANGLE_instanced_arrays"),Y=new Yt(Mt,C),O=new function(t,e,n){function i(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 r,o=void 0!==n.precision?n.precision:"highp",a=i(o);a!==o&&(console.warn("THREE.WebGLRenderer:",o,"not supported, using",a,"instead."),o=a),n=!0===n.logarithmicDepthBuffer,a=t.getParameter(t.MAX_TEXTURE_IMAGE_UNITS);var s=t.getParameter(t.MAX_VERTEX_TEXTURE_IMAGE_UNITS),c=t.getParameter(t.MAX_TEXTURE_SIZE),h=t.getParameter(t.MAX_CUBE_MAP_TEXTURE_SIZE),l=t.getParameter(t.MAX_VERTEX_ATTRIBS),u=t.getParameter(t.MAX_VERTEX_UNIFORM_VECTORS),p=t.getParameter(t.MAX_VARYING_VECTORS),d=t.getParameter(t.MAX_FRAGMENT_UNIFORM_VECTORS),f=0<s,m=!!e.get("OES_texture_float");return{getMaxAnisotropy:function(){if(void 0!==r)return r;var n=e.get("EXT_texture_filter_anisotropic");return r=null!==n?t.getParameter(n.MAX_TEXTURE_MAX_ANISOTROPY_EXT):0},getMaxPrecision:i,precision:o,logarithmicDepthBuffer:n,maxTextures:a,maxVertexTextures:s,maxTextureSize:c,maxCubemapSize:h,maxAttributes:l,maxVertexUniforms:u,maxVaryings:p,maxFragmentUniforms:d,vertexTextures:f,floatFragmentTextures:m,floatVertexTextures:f&&m}}(Mt,C,t),(I=new function(t,e,n){function i(e,n,i){var r=new Uint8Array(4),o=t.createTexture();for(t.bindTexture(e,o),t.texParameteri(e,t.TEXTURE_MIN_FILTER,t.NEAREST),t.texParameteri(e,t.TEXTURE_MAG_FILTER,t.NEAREST),e=0;e<i;e++)t.texImage2D(n+e,0,t.RGBA,1,1,0,t.RGBA,t.UNSIGNED_BYTE,r);return o}function r(e){!0!==x[e]&&(t.enable(e),x[e]=!0)}function o(e){!1!==x[e]&&(t.disable(e),x[e]=!1)}function a(e,i,a,s,c,h,l,u){if(0!==e?r(t.BLEND):o(t.BLEND),5!==e){if(e!==_||u!==L)switch(e){case 2:u?(t.blendEquationSeparate(t.FUNC_ADD,t.FUNC_ADD),t.blendFuncSeparate(t.ONE,t.ONE,t.ONE,t.ONE)):(t.blendEquation(t.FUNC_ADD),t.blendFunc(t.SRC_ALPHA,t.ONE));break;case 3:u?(t.blendEquationSeparate(t.FUNC_ADD,t.FUNC_ADD),t.blendFuncSeparate(t.ZERO,t.ZERO,t.ONE_MINUS_SRC_COLOR,t.ONE_MINUS_SRC_ALPHA)):(t.blendEquation(t.FUNC_ADD),t.blendFunc(t.ZERO,t.ONE_MINUS_SRC_COLOR));break;case 4:u?(t.blendEquationSeparate(t.FUNC_ADD,t.FUNC_ADD),t.blendFuncSeparate(t.ZERO,t.SRC_COLOR,t.ZERO,t.SRC_ALPHA)):(t.blendEquation(t.FUNC_ADD),t.blendFunc(t.ZERO,t.SRC_COLOR));break;default:u?(t.blendEquationSeparate(t.FUNC_ADD,t.FUNC_ADD),t.blendFuncSeparate(t.ONE,t.ONE_MINUS_SRC_ALPHA,t.ONE,t.ONE_MINUS_SRC_ALPHA)):(t.blendEquationSeparate(t.FUNC_ADD,t.FUNC_ADD),t.blendFuncSeparate(t.SRC_ALPHA,t.ONE_MINUS_SRC_ALPHA,t.ONE,t.ONE_MINUS_SRC_ALPHA))}R=A=S=T=E=M=null}else c=c||i,h=h||a,l=l||s,i===M&&c===S||(t.blendEquationSeparate(n.convert(i),n.convert(c)),M=i,S=c),a===E&&s===T&&h===A&&l===R||(t.blendFuncSeparate(n.convert(a),n.convert(s),n.convert(h),n.convert(l)),E=a,T=s,A=h,R=l);_=e,L=u}function s(e){P!==e&&(e?t.frontFace(t.CW):t.frontFace(t.CCW),P=e)}function h(e){0!==e?(r(t.CULL_FACE),e!==C&&(1===e?t.cullFace(t.BACK):2===e?t.cullFace(t.FRONT):t.cullFace(t.FRONT_AND_BACK))):o(t.CULL_FACE),C=e}function l(e,n,i){e?(r(t.POLYGON_OFFSET_FILL),(I!==n||N!==i)&&(t.polygonOffset(n,i),I=n,N=i)):o(t.POLYGON_OFFSET_FILL)}function u(e){void 0===e&&(e=t.TEXTURE0+U-1),B!==e&&(t.activeTexture(e),B=e)}var p=new function(){var e=!1,n=new c,i=null,r=new c(0,0,0,0);return{setMask:function(n){i===n||e||(t.colorMask(n,n,n,n),i=n)},setLocked:function(t){e=t},setClear:function(e,i,o,a,s){!0===s&&(e*=a,i*=a,o*=a),n.set(e,i,o,a),!1===r.equals(n)&&(t.clearColor(e,i,o,a),r.copy(n))},reset:function(){e=!1,i=null,r.set(-1,0,0,0)}}},d=new function(){var e=!1,n=null,i=null,a=null;return{setTest:function(e){e?r(t.DEPTH_TEST):o(t.DEPTH_TEST)},setMask:function(i){n===i||e||(t.depthMask(i),n=i)},setFunc:function(e){if(i!==e){if(e)switch(e){case 0:t.depthFunc(t.NEVER);break;case 1:t.depthFunc(t.ALWAYS);break;case 2:t.depthFunc(t.LESS);break;case 3:t.depthFunc(t.LEQUAL);break;case 4:t.depthFunc(t.EQUAL);break;case 5:t.depthFunc(t.GEQUAL);break;case 6:t.depthFunc(t.GREATER);break;case 7:t.depthFunc(t.NOTEQUAL);break;default:t.depthFunc(t.LEQUAL)}else t.depthFunc(t.LEQUAL);i=e}},setLocked:function(t){e=t},setClear:function(e){a!==e&&(t.clearDepth(e),a=e)},reset:function(){e=!1,a=i=n=null}}},f=new function(){var e=!1,n=null,i=null,a=null,s=null,c=null,h=null,l=null,u=null;return{setTest:function(e){e?r(t.STENCIL_TEST):o(t.STENCIL_TEST)},setMask:function(i){n===i||e||(t.stencilMask(i),n=i)},setFunc:function(e,n,r){i===e&&a===n&&s===r||(t.stencilFunc(e,n,r),i=e,a=n,s=r)},setOp:function(e,n,i){c===e&&h===n&&l===i||(t.stencilOp(e,n,i),c=e,h=n,l=i)},setLocked:function(t){e=t},setClear:function(e){u!==e&&(t.clearStencil(e),u=e)},reset:function(){e=!1,u=l=h=c=s=a=i=n=null}}},m=t.getParameter(t.MAX_VERTEX_ATTRIBS),g=new Uint8Array(m),v=new Uint8Array(m),y=new Uint8Array(m),x={},b=null,w=null,_=null,M=null,E=null,T=null,S=null,A=null,R=null,L=!1,P=null,C=null,O=null,I=null,N=null,U=t.getParameter(t.MAX_COMBINED_TEXTURE_IMAGE_UNITS),D=!1;m=0,-1!==(m=t.getParameter(t.VERSION)).indexOf("WebGL")?(m=parseFloat(/^WebGL ([0-9])/.exec(m)[1]),D=1<=m):-1!==m.indexOf("OpenGL ES")&&(m=parseFloat(/^OpenGL ES ([0-9])/.exec(m)[1]),D=2<=m);var B=null,F={},z=new c,H=new c,G={};return G[t.TEXTURE_2D]=i(t.TEXTURE_2D,t.TEXTURE_2D,1),G[t.TEXTURE_CUBE_MAP]=i(t.TEXTURE_CUBE_MAP,t.TEXTURE_CUBE_MAP_POSITIVE_X,6),p.setClear(0,0,0,1),d.setClear(1),f.setClear(0),r(t.DEPTH_TEST),d.setFunc(3),s(!1),h(1),r(t.CULL_FACE),r(t.BLEND),a(1),{buffers:{color:p,depth:d,stencil:f},initAttributes:function(){for(var t=0,e=g.length;t<e;t++)g[t]=0},enableAttribute:function(n){g[n]=1,0===v[n]&&(t.enableVertexAttribArray(n),v[n]=1),0!==y[n]&&(e.get("ANGLE_instanced_arrays").vertexAttribDivisorANGLE(n,0),y[n]=0)},enableAttributeAndDivisor:function(n,i){g[n]=1,0===v[n]&&(t.enableVertexAttribArray(n),v[n]=1),y[n]!==i&&(e.get("ANGLE_instanced_arrays").vertexAttribDivisorANGLE(n,i),y[n]=i)},disableUnusedAttributes:function(){for(var e=0,n=v.length;e!==n;++e)v[e]!==g[e]&&(t.disableVertexAttribArray(e),v[e]=0)},enable:r,disable:o,getCompressedTextureFormats:function(){if(null===b&&(b=[],e.get("WEBGL_compressed_texture_pvrtc")||e.get("WEBGL_compressed_texture_s3tc")||e.get("WEBGL_compressed_texture_etc1")||e.get("WEBGL_compressed_texture_astc")))for(var n=t.getParameter(t.COMPRESSED_TEXTURE_FORMATS),i=0;i<n.length;i++)b.push(n[i]);return b},useProgram:function(e){return w!==e&&(t.useProgram(e),w=e,!0)},setBlending:a,setMaterial:function(e,n){2===e.side?o(t.CULL_FACE):r(t.CULL_FACE);var i=1===e.side;n&&(i=!i),s(i),!0===e.transparent?a(e.blending,e.blendEquation,e.blendSrc,e.blendDst,e.blendEquationAlpha,e.blendSrcAlpha,e.blendDstAlpha,e.premultipliedAlpha):a(0),d.setFunc(e.depthFunc),d.setTest(e.depthTest),d.setMask(e.depthWrite),p.setMask(e.colorWrite),l(e.polygonOffset,e.polygonOffsetFactor,e.polygonOffsetUnits)},setFlipSided:s,setCullFace:h,setLineWidth:function(e){e!==O&&(D&&t.lineWidth(e),O=e)},setPolygonOffset:l,setScissorTest:function(e){e?r(t.SCISSOR_TEST):o(t.SCISSOR_TEST)},activeTexture:u,bindTexture:function(e,n){null===B&&u();var i=F[B];void 0===i&&(i={type:void 0,texture:void 0},F[B]=i),i.type===e&&i.texture===n||(t.bindTexture(e,n||G[e]),i.type=e,i.texture=n)},compressedTexImage2D:function(){try{t.compressedTexImage2D.apply(t,arguments)}catch(t){console.error("THREE.WebGLState:",t)}},texImage2D:function(){try{t.texImage2D.apply(t,arguments)}catch(t){console.error("THREE.WebGLState:",t)}},scissor:function(e){!1===z.equals(e)&&(t.scissor(e.x,e.y,e.z,e.w),z.copy(e))},viewport:function(e){!1===H.equals(e)&&(t.viewport(e.x,e.y,e.z,e.w),H.copy(e))},reset:function(){for(var e=0;e<v.length;e++)1===v[e]&&(t.disableVertexAttribArray(e),v[e]=0);x={},B=b=null,F={},C=P=_=w=null,p.reset(),d.reset(),f.reset()}}}(Mt,C,Y)).scissor(ct.copy(mt).multiplyScalar(dt)),I.viewport(st.copy(ft).multiplyScalar(dt)),N=new function(t){var e={frame:0,calls:0,triangles:0,points:0,lines:0};return{memory:{geometries:0,textures:0},render:e,programs:null,autoReset:!0,reset:function(){e.frame++,e.calls=0,e.triangles=0,e.points=0,e.lines=0},update:function(n,i,r){switch(r=r||1,e.calls++,i){case t.TRIANGLES:e.triangles+=n/3*r;break;case t.TRIANGLE_STRIP:case t.TRIANGLE_FAN:e.triangles+=r*(n-2);break;case t.LINES:e.lines+=n/2*r;break;case t.LINE_STRIP:e.lines+=r*(n-1);break;case t.LINE_LOOP:e.lines+=r*n;break;case t.POINTS:e.points+=r*n;break;default:console.error("THREE.WebGLInfo: Unknown draw mode:",i)}}}}(Mt),U=new function(){var t=new WeakMap;return{get:function(e){var n=t.get(e);return void 0===n&&(n={},t.set(e,n)),n},remove:function(e){t.delete(e)},update:function(e,n,i){t.get(e)[n]=i},dispose:function(){t=new WeakMap}}},D=new function(t,e,n,i,r,o,a){function s(t,e){if(t.width>e||t.height>e){if("data"in t)return void console.warn("THREE.WebGLRenderer: image in DataTexture is too big ("+t.width+"x"+t.height+").");e/=Math.max(t.width,t.height);var n=document.createElementNS("http://www.w3.org/1999/xhtml","canvas");return n.width=Math.floor(t.width*e),n.height=Math.floor(t.height*e),n.getContext("2d").drawImage(t,0,0,t.width,t.height,0,0,n.width,n.height),console.warn("THREE.WebGLRenderer: image is too big ("+t.width+"x"+t.height+"). Resized to "+n.width+"x"+n.height,t),n}return t}function c(t){return Ar.isPowerOfTwo(t.width)&&Ar.isPowerOfTwo(t.height)}function h(t,e){return t.generateMipmaps&&e&&1003!==t.minFilter&&1006!==t.minFilter}function l(e,n,r,o){t.generateMipmap(e),i.get(n).__maxMipLevel=Math.log(Math.max(r,o))*Math.LOG2E}function u(e){return 1003===e||1004===e||1005===e?t.NEAREST:t.LINEAR}function p(e){(e=e.target).removeEventListener("dispose",p);t:{var n=i.get(e);if(e.image&&n.__image__webglTextureCube)t.deleteTexture(n.__image__webglTextureCube);else{if(void 0===n.__webglInit)break t;t.deleteTexture(n.__webglTexture)}i.remove(e)}e.isVideoTexture&&delete b[e.id],a.memory.textures--}function d(e){(e=e.target).removeEventListener("dispose",d);var n=i.get(e),r=i.get(e.texture);if(e){if(void 0!==r.__webglTexture&&t.deleteTexture(r.__webglTexture),e.depthTexture&&e.depthTexture.dispose(),e.isWebGLRenderTargetCube)for(r=0;6>r;r++)t.deleteFramebuffer(n.__webglFramebuffer[r]),n.__webglDepthbuffer&&t.deleteRenderbuffer(n.__webglDepthbuffer[r]);else t.deleteFramebuffer(n.__webglFramebuffer),n.__webglDepthbuffer&&t.deleteRenderbuffer(n.__webglDepthbuffer);i.remove(e.texture),i.remove(e)}a.memory.textures--}function f(e,u){var d=i.get(e);if(e.isVideoTexture){var f=e.id,g=a.render.frame;b[f]!==g&&(b[f]=g,e.update())}if(0<e.version&&d.__version!==e.version)if(void 0===(f=e.image))console.warn("THREE.WebGLRenderer: Texture marked for update but image is undefined",e);else{if(!1!==f.complete){void 0===d.__webglInit&&(d.__webglInit=!0,e.addEventListener("dispose",p),d.__webglTexture=t.createTexture(),a.memory.textures++),n.activeTexture(t.TEXTURE0+u),n.bindTexture(t.TEXTURE_2D,d.__webglTexture),t.pixelStorei(t.UNPACK_FLIP_Y_WEBGL,e.flipY),t.pixelStorei(t.UNPACK_PREMULTIPLY_ALPHA_WEBGL,e.premultiplyAlpha),t.pixelStorei(t.UNPACK_ALIGNMENT,e.unpackAlignment),u=s(e.image,r.maxTextureSize),(1001!==e.wrapS||1001!==e.wrapT||1003!==e.minFilter&&1006!==e.minFilter)&&!1===c(u)&&(u instanceof HTMLImageElement||u instanceof HTMLCanvasElement||u instanceof ImageBitmap)&&(void 0===y&&(y=document.createElementNS("http://www.w3.org/1999/xhtml","canvas")),y.width=Ar.floorPowerOfTwo(u.width),y.height=Ar.floorPowerOfTwo(u.height),y.getContext("2d").drawImage(u,0,0,y.width,y.height),console.warn("THREE.WebGLRenderer: image is not power of two ("+u.width+"x"+u.height+"). Resized to "+y.width+"x"+y.height,u),u=y),f=c(u),g=o.convert(e.format);var v=o.convert(e.type);m(t.TEXTURE_2D,e,f);var w=e.mipmaps;if(e.isDepthTexture){var _=t.DEPTH_COMPONENT;if(1015===e.type){if(!x)throw Error("Float Depth Texture only supported in WebGL2.0");_=t.DEPTH_COMPONENT32F}else x&&(_=t.DEPTH_COMPONENT16);1026===e.format&&_===t.DEPTH_COMPONENT&&1012!==e.type&&1014!==e.type&&(console.warn("THREE.WebGLRenderer: Use UnsignedShortType or UnsignedIntType for DepthFormat DepthTexture."),e.type=1012,v=o.convert(e.type)),1027===e.format&&(_=t.DEPTH_STENCIL,1020!==e.type&&(console.warn("THREE.WebGLRenderer: Use UnsignedInt248Type for DepthStencilFormat DepthTexture."),e.type=1020,v=o.convert(e.type))),n.texImage2D(t.TEXTURE_2D,0,_,u.width,u.height,0,g,v,null)}else if(e.isDataTexture)if(0<w.length&&f){for(var M=0,E=w.length;M<E;M++)_=w[M],n.texImage2D(t.TEXTURE_2D,M,g,_.width,_.height,0,g,v,_.data);e.generateMipmaps=!1,d.__maxMipLevel=w.length-1}else n.texImage2D(t.TEXTURE_2D,0,g,u.width,u.height,0,g,v,u.data),d.__maxMipLevel=0;else if(e.isCompressedTexture){for(M=0,E=w.length;M<E;M++)_=w[M],1023!==e.format&&1022!==e.format?-1<n.getCompressedTextureFormats().indexOf(g)?n.compressedTexImage2D(t.TEXTURE_2D,M,g,_.width,_.height,0,_.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()"):n.texImage2D(t.TEXTURE_2D,M,g,_.width,_.height,0,g,v,_.data);d.__maxMipLevel=w.length-1}else if(0<w.length&&f){for(M=0,E=w.length;M<E;M++)_=w[M],n.texImage2D(t.TEXTURE_2D,M,g,g,v,_);e.generateMipmaps=!1,d.__maxMipLevel=w.length-1}else n.texImage2D(t.TEXTURE_2D,0,g,g,v,u),d.__maxMipLevel=0;return h(e,f)&&l(t.TEXTURE_2D,e,u.width,u.height),d.__version=e.version,void(e.onUpdate&&e.onUpdate(e))}console.warn("THREE.WebGLRenderer: Texture marked for update but image is incomplete",e)}n.activeTexture(t.TEXTURE0+u),n.bindTexture(t.TEXTURE_2D,d.__webglTexture)}function m(n,a,s){s?(t.texParameteri(n,t.TEXTURE_WRAP_S,o.convert(a.wrapS)),t.texParameteri(n,t.TEXTURE_WRAP_T,o.convert(a.wrapT)),t.texParameteri(n,t.TEXTURE_MAG_FILTER,o.convert(a.magFilter)),t.texParameteri(n,t.TEXTURE_MIN_FILTER,o.convert(a.minFilter))):(t.texParameteri(n,t.TEXTURE_WRAP_S,t.CLAMP_TO_EDGE),t.texParameteri(n,t.TEXTURE_WRAP_T,t.CLAMP_TO_EDGE),1001===a.wrapS&&1001===a.wrapT||console.warn("THREE.WebGLRenderer: Texture is not power of two. Texture.wrapS and Texture.wrapT should be set to THREE.ClampToEdgeWrapping.",a),t.texParameteri(n,t.TEXTURE_MAG_FILTER,u(a.magFilter)),t.texParameteri(n,t.TEXTURE_MIN_FILTER,u(a.minFilter)),1003!==a.minFilter&&1006!==a.minFilter&&console.warn("THREE.WebGLRenderer: Texture is not power of two. Texture.minFilter should be set to THREE.NearestFilter or THREE.LinearFilter.",a)),!(s=e.get("EXT_texture_filter_anisotropic"))||1015===a.type&&null===e.get("OES_texture_float_linear")||1016===a.type&&null===e.get("OES_texture_half_float_linear")||!(1<a.anisotropy||i.get(a).__currentAnisotropy)||(t.texParameterf(n,s.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(a.anisotropy,r.getMaxAnisotropy())),i.get(a).__currentAnisotropy=a.anisotropy)}function g(e,r,a,s){var c=o.convert(r.texture.format),h=o.convert(r.texture.type);n.texImage2D(s,0,c,r.width,r.height,0,c,h,null),t.bindFramebuffer(t.FRAMEBUFFER,e),t.framebufferTexture2D(t.FRAMEBUFFER,a,s,i.get(r.texture).__webglTexture,0),t.bindFramebuffer(t.FRAMEBUFFER,null)}function v(e,n){t.bindRenderbuffer(t.RENDERBUFFER,e),n.depthBuffer&&!n.stencilBuffer?(t.renderbufferStorage(t.RENDERBUFFER,t.DEPTH_COMPONENT16,n.width,n.height),t.framebufferRenderbuffer(t.FRAMEBUFFER,t.DEPTH_ATTACHMENT,t.RENDERBUFFER,e)):n.depthBuffer&&n.stencilBuffer?(t.renderbufferStorage(t.RENDERBUFFER,t.DEPTH_STENCIL,n.width,n.height),t.framebufferRenderbuffer(t.FRAMEBUFFER,t.DEPTH_STENCIL_ATTACHMENT,t.RENDERBUFFER,e)):t.renderbufferStorage(t.RENDERBUFFER,t.RGBA4,n.width,n.height),t.bindRenderbuffer(t.RENDERBUFFER,null)}var y,x="undefined"!=typeof WebGL2RenderingContext&&t instanceof WebGL2RenderingContext,b={};this.setTexture2D=f,this.setTextureCube=function(e,u){var d=i.get(e);if(6===e.image.length)if(0<e.version&&d.__version!==e.version){d.__image__webglTextureCube||(e.addEventListener("dispose",p),d.__image__webglTextureCube=t.createTexture(),a.memory.textures++),n.activeTexture(t.TEXTURE0+u),n.bindTexture(t.TEXTURE_CUBE_MAP,d.__image__webglTextureCube),t.pixelStorei(t.UNPACK_FLIP_Y_WEBGL,e.flipY),u=e&&e.isCompressedTexture;for(var f=e.image[0]&&e.image[0].isDataTexture,g=[],v=0;6>v;v++)g[v]=u||f?f?e.image[v].image:e.image[v]:s(e.image[v],r.maxCubemapSize);var y=g[0],x=c(y),b=o.convert(e.format),w=o.convert(e.type);for(m(t.TEXTURE_CUBE_MAP,e,x),v=0;6>v;v++)if(u)for(var _,M=g[v].mipmaps,E=0,T=M.length;E<T;E++)_=M[E],1023!==e.format&&1022!==e.format?-1<n.getCompressedTextureFormats().indexOf(b)?n.compressedTexImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+v,E,b,_.width,_.height,0,_.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .setTextureCube()"):n.texImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+v,E,b,_.width,_.height,0,b,w,_.data);else f?n.texImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+v,0,b,g[v].width,g[v].height,0,b,w,g[v].data):n.texImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+v,0,b,b,w,g[v]);d.__maxMipLevel=u?M.length-1:0,h(e,x)&&l(t.TEXTURE_CUBE_MAP,e,y.width,y.height),d.__version=e.version,e.onUpdate&&e.onUpdate(e)}else n.activeTexture(t.TEXTURE0+u),n.bindTexture(t.TEXTURE_CUBE_MAP,d.__image__webglTextureCube)},this.setTextureCubeDynamic=function(e,r){n.activeTexture(t.TEXTURE0+r),n.bindTexture(t.TEXTURE_CUBE_MAP,i.get(e).__webglTexture)},this.setupRenderTarget=function(e){var r=i.get(e),o=i.get(e.texture);e.addEventListener("dispose",d),o.__webglTexture=t.createTexture(),a.memory.textures++;var s=!0===e.isWebGLRenderTargetCube,u=c(e);if(s){r.__webglFramebuffer=[];for(var p=0;6>p;p++)r.__webglFramebuffer[p]=t.createFramebuffer()}else r.__webglFramebuffer=t.createFramebuffer();if(s){for(n.bindTexture(t.TEXTURE_CUBE_MAP,o.__webglTexture),m(t.TEXTURE_CUBE_MAP,e.texture,u),p=0;6>p;p++)g(r.__webglFramebuffer[p],e,t.COLOR_ATTACHMENT0,t.TEXTURE_CUBE_MAP_POSITIVE_X+p);h(e.texture,u)&&l(t.TEXTURE_CUBE_MAP,e.texture,e.width,e.height),n.bindTexture(t.TEXTURE_CUBE_MAP,null)}else n.bindTexture(t.TEXTURE_2D,o.__webglTexture),m(t.TEXTURE_2D,e.texture,u),g(r.__webglFramebuffer,e,t.COLOR_ATTACHMENT0,t.TEXTURE_2D),h(e.texture,u)&&l(t.TEXTURE_2D,e.texture,e.width,e.height),n.bindTexture(t.TEXTURE_2D,null);if(e.depthBuffer){if(r=i.get(e),o=!0===e.isWebGLRenderTargetCube,e.depthTexture){if(o)throw Error("target.depthTexture not supported in Cube render targets");if(e&&e.isWebGLRenderTargetCube)throw Error("Depth Texture with cube render targets is not supported");if(t.bindFramebuffer(t.FRAMEBUFFER,r.__webglFramebuffer),!e.depthTexture||!e.depthTexture.isDepthTexture)throw Error("renderTarget.depthTexture must be an instance of THREE.DepthTexture");if(i.get(e.depthTexture).__webglTexture&&e.depthTexture.image.width===e.width&&e.depthTexture.image.height===e.height||(e.depthTexture.image.width=e.width,e.depthTexture.image.height=e.height,e.depthTexture.needsUpdate=!0),f(e.depthTexture,0),r=i.get(e.depthTexture).__webglTexture,1026===e.depthTexture.format)t.framebufferTexture2D(t.FRAMEBUFFER,t.DEPTH_ATTACHMENT,t.TEXTURE_2D,r,0);else{if(1027!==e.depthTexture.format)throw Error("Unknown depthTexture format");t.framebufferTexture2D(t.FRAMEBUFFER,t.DEPTH_STENCIL_ATTACHMENT,t.TEXTURE_2D,r,0)}}else if(o)for(r.__webglDepthbuffer=[],o=0;6>o;o++)t.bindFramebuffer(t.FRAMEBUFFER,r.__webglFramebuffer[o]),r.__webglDepthbuffer[o]=t.createRenderbuffer(),v(r.__webglDepthbuffer[o],e);else t.bindFramebuffer(t.FRAMEBUFFER,r.__webglFramebuffer),r.__webglDepthbuffer=t.createRenderbuffer(),v(r.__webglDepthbuffer,e);t.bindFramebuffer(t.FRAMEBUFFER,null)}},this.updateRenderTargetMipmap=function(e){var r=e.texture,o=c(e);if(h(r,o)){o=e.isWebGLRenderTargetCube?t.TEXTURE_CUBE_MAP:t.TEXTURE_2D;var a=i.get(r).__webglTexture;n.bindTexture(o,a),l(o,r,e.width,e.height),n.bindTexture(o,null)}}}(Mt,C,I,U,O,Y,N),B=new v(Mt),F=new Q(Mt,B,N),z=new function(t,e){var n={};return{update:function(i){var r=e.render.frame,o=i.geometry,a=t.get(i,o);return n[a.id]!==r&&(o.isGeometry&&a.updateFromObject(i),t.update(a),n[a.id]=r),a},dispose:function(){n={}}}}(F,N),j=new function(t){var e={},n=new Float32Array(8);return{update:function(i,r,o,a){var s=i.morphTargetInfluences,c=s.length;if(void 0===(i=e[r.id])){i=[];for(var h=0;h<c;h++)i[h]=[h,0];e[r.id]=i}var l=o.morphTargets&&r.morphAttributes.position;for(o=o.morphNormals&&r.morphAttributes.normal,h=0;h<c;h++){var u=i[h];0!==u[1]&&(l&&r.removeAttribute("morphTarget"+h),o&&r.removeAttribute("morphNormal"+h))}for(h=0;h<c;h++)(u=i[h])[0]=h,u[1]=s[h];for(i.sort(K),h=0;8>h;h++)(u=i[h])&&(s=u[0],c=u[1])?(l&&r.addAttribute("morphTarget"+h,l[s]),o&&r.addAttribute("morphNormal"+h,o[s]),n[h]=c):n[h]=0;a.getUniforms().setValue(t,"morphTargetInfluences",n)}}}(Mt),H=new function(t,e,n){function i(t,e){if(t)t.isTexture?n=t.encoding:t.isWebGLRenderTarget&&(console.warn("THREE.WebGLPrograms.getTextureEncodingFromMap: don't use render targets as textures. Use their .texture property instead."),n=t.texture.encoding);else var n=3e3;return 3e3===n&&e&&(n=3007),n}var r=[],o={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".split(" ");this.getParameters=function(e,r,a,s,c,h,l){var u=o[e.type];if(l.isSkinnedMesh){var p=l.skeleton.bones;if(n.floatVertexTextures)p=1024;else{var d=Math.min(Math.floor((n.maxVertexUniforms-20)/4),p.length);d<p.length?(console.warn("THREE.WebGLRenderer: Skeleton has "+p.length+" bones. This GPU supports "+d+"."),p=0):p=d}}else p=0;d=n.precision,null!==e.precision&&(d=n.getMaxPrecision(e.precision))!==e.precision&&console.warn("THREE.WebGLProgram.getParameters:",e.precision,"not supported, using",d,"instead.");var f=t.getRenderTarget();return{shaderID:u,precision:d,supportsVertexTextures:n.vertexTextures,outputEncoding:i(f?f.texture:null,t.gammaOutput),map:!!e.map,mapEncoding:i(e.map,t.gammaInput),envMap:!!e.envMap,envMapMode:e.envMap&&e.envMap.mapping,envMapEncoding:i(e.envMap,t.gammaInput),envMapCubeUV:!!e.envMap&&(306===e.envMap.mapping||307===e.envMap.mapping),lightMap:!!e.lightMap,aoMap:!!e.aoMap,emissiveMap:!!e.emissiveMap,emissiveMapEncoding:i(e.emissiveMap,t.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:!!s,useFog:e.fog,fogExp:s&&s.isFogExp2,flatShading:e.flatShading,sizeAttenuation:e.sizeAttenuation,logarithmicDepthBuffer:n.logarithmicDepthBuffer,skinning:e.skinning&&0<p,maxBones:p,useVertexTexture:n.floatVertexTextures,morphTargets:e.morphTargets,morphNormals:e.morphNormals,maxMorphTargets:t.maxMorphTargets,maxMorphNormals:t.maxMorphNormals,numDirLights:r.directional.length,numPointLights:r.point.length,numSpotLights:r.spot.length,numRectAreaLights:r.rectArea.length,numHemiLights:r.hemi.length,numClippingPlanes:c,numClipIntersection:h,dithering:e.dithering,shadowMapEnabled:t.shadowMap.enabled&&l.receiveShadow&&0<a.length,shadowMapType:t.shadowMap.type,toneMapping:t.toneMapping,physicallyCorrectLights:t.physicallyCorrectLights,premultipliedAlpha:e.premultipliedAlpha,alphaTest:e.alphaTest,doubleSided:2===e.side,flipSided:1===e.side,depthPacking:void 0!==e.depthPacking&&e.depthPacking}},this.getProgramCode=function(e,n){var i=[];if(n.shaderID?i.push(n.shaderID):(i.push(e.fragmentShader),i.push(e.vertexShader)),void 0!==e.defines)for(var r in e.defines)i.push(r),i.push(e.defines[r]);for(r=0;r<a.length;r++)i.push(n[a[r]]);return i.push(e.onBeforeCompile.toString()),i.push(t.gammaOutput),i.join()},this.acquireProgram=function(n,i,o,a){for(var s,c=0,h=r.length;c<h;c++){var l=r[c];if(l.code===a){++(s=l).usedTimes;break}}return void 0===s&&(s=new Bt(t,e,a,n,i,o),r.push(s)),s},this.releaseProgram=function(t){if(0==--t.usedTimes){var e=r.indexOf(t);r[e]=r[r.length-1],r.pop(),t.destroy()}},this.programs=r}($,C,O),G=new Ht,k=new kt,V=new Z($,I,F,S),W=new function(t,e,n){var i;this.setMode=function(t){i=t},this.render=function(e,r){t.drawArrays(i,e,r),n.update(r,i)},this.renderInstances=function(t,r,o){var a=e.get("ANGLE_instanced_arrays");if(null===a)console.error("THREE.WebGLBufferRenderer: using THREE.InstancedBufferGeometry but hardware does not support extension ANGLE_instanced_arrays.");else{var s=t.attributes.position;s.isInterleavedBufferAttribute?(o=s.data.count,a.drawArraysInstancedANGLE(i,0,o,t.maxInstancedCount)):a.drawArraysInstancedANGLE(i,r,o,t.maxInstancedCount),n.update(o,i,t.maxInstancedCount)}}}(Mt,C,N),X=new function(t,e,n){var i,r,o;this.setMode=function(t){i=t},this.setIndex=function(t){r=t.type,o=t.bytesPerElement},this.render=function(e,a){t.drawElements(i,a,r,e*o),n.update(a,i)},this.renderInstances=function(t,a,s){var c=e.get("ANGLE_instanced_arrays");null===c?console.error("THREE.WebGLIndexedBufferRenderer: using THREE.InstancedBufferGeometry but hardware does not support extension ANGLE_instanced_arrays."):(c.drawElementsInstancedANGLE(i,s,r,a*o,t.maxInstancedCount),n.update(s,i,t.maxInstancedCount))}}(Mt,C,N),q=new qt($,Mt,I,D,O),N.programs=H.programs,$.context=Mt,$.capabilities=O,$.extensions=C,$.properties=U,$.renderLists=G,$.state=I,$.info=N}function n(t){t.preventDefault(),console.log("THREE.WebGLRenderer: Context Lost."),tt=!0}function r(){console.log("THREE.WebGLRenderer: Context Restored."),tt=!1,e()}function a(t){(t=t.target).removeEventListener("dispose",a),s(t),U.remove(t)}function s(t){var e=U.get(t).program;t.program=void 0,void 0!==e&&H.releaseProgram(e)}function h(){var t=Et.getDevice();t&&t.isPresenting?t.requestAnimationFrame(l):window.requestAnimationFrame(l)}function l(t){!1!==St&&(At(t),h())}function p(t,e,n,i){for(var r=0,o=t.length;r<o;r++){var a=t[r],s=a.object,c=a.geometry,h=void 0===i?a.material:i;if(a=a.group,n.isArrayCamera){at=n;for(var l=n.cameras,u=0,p=l.length;u<p;u++){var f=l[u];if(s.layers.test(f.layers)){var m=f.bounds;I.viewport(st.set(m.x*ut,m.y*pt,m.z*ut,m.w*pt).multiplyScalar(dt)),d(s,e,f,c,h,a)}}}else at=null,d(s,e,n,c,h,a)}}function d(t,e,n,i,r,o){if(t.onBeforeRender($,e,n,i,r,o),P=k.get(e,at||n),t.modelViewMatrix.multiplyMatrices(n.matrixWorldInverse,t.matrixWorld),t.normalMatrix.getNormalMatrix(t.modelViewMatrix),t.isImmediateRenderObject){var a=t.isMesh&&0>t.matrixWorld.determinant();I.setMaterial(r,a),a=g(n,e.fog,r,t),rt="",function(t,e,n){t.render(function(t){$.renderBufferImmediate(t,e,n)})}(t,a,r)}else $.renderBufferDirect(n,e.fog,i,r,t,o);t.onAfterRender($,e,n,i,r,o),P=k.get(e,at||n)}function f(t,e,n){var i=U.get(t),r=P.state.lights;n=H.getParameters(t,r.state,P.state.shadowsArray,e,yt.numPlanes,yt.numIntersection,n);var o=H.getProgramCode(t,n),c=i.program,h=!0;if(void 0===c)t.addEventListener("dispose",a);else if(c.code!==o)s(t);else{if(i.lightsHash!==r.state.hash)U.update(t,"lightsHash",r.state.hash);else if(void 0!==n.shaderID)return;h=!1}if(h&&(n.shaderID?(c=Ir[n.shaderID],i.shader={name:t.type,uniforms:Pr.clone(c.uniforms),vertexShader:c.vertexShader,fragmentShader:c.fragmentShader}):i.shader={name:t.type,uniforms:t.uniforms,vertexShader:t.vertexShader,fragmentShader:t.fragmentShader},t.onBeforeCompile(i.shader,$),c=H.acquireProgram(t,i.shader,n,o),i.program=c,t.program=c),n=c.getAttributes(),t.morphTargets)for(o=t.numSupportedMorphTargets=0;o<$.maxMorphTargets;o++)0<=n["morphTarget"+o]&&t.numSupportedMorphTargets++;if(t.morphNormals)for(o=t.numSupportedMorphNormals=0;o<$.maxMorphNormals;o++)0<=n["morphNormal"+o]&&t.numSupportedMorphNormals++;n=i.shader.uniforms,(t.isShaderMaterial||t.isRawShaderMaterial)&&!0!==t.clipping||(i.numClippingPlanes=yt.numPlanes,i.numIntersection=yt.numIntersection,n.clippingPlanes=yt.uniform),i.fog=e,i.lightsHash=r.state.hash,t.lights&&(n.ambientLightColor.value=r.state.ambient,n.directionalLights.value=r.state.directional,n.spotLights.value=r.state.spot,n.rectAreaLights.value=r.state.rectArea,n.pointLights.value=r.state.point,n.hemisphereLights.value=r.state.hemi,n.directionalShadowMap.value=r.state.directionalShadowMap,n.directionalShadowMatrix.value=r.state.directionalShadowMatrix,n.spotShadowMap.value=r.state.spotShadowMap,n.spotShadowMatrix.value=r.state.spotShadowMatrix,n.pointShadowMap.value=r.state.pointShadowMap,n.pointShadowMatrix.value=r.state.pointShadowMatrix),t=i.program.getUniforms(),t=Rt.seqWithValue(t.seq,n),i.uniformsList=t}function g(t,e,n,i){lt=0;var r=U.get(n),o=P.state.lights;xt&&(bt||t!==ot)&&yt.setState(n.clippingPlanes,n.clipIntersection,n.clipShadows,t,r,t===ot&&n.id===it),!1===n.needsUpdate&&(void 0===r.program?n.needsUpdate=!0:n.fog&&r.fog!==e?n.needsUpdate=!0:n.lights&&r.lightsHash!==o.state.hash?n.needsUpdate=!0:void 0===r.numClippingPlanes||r.numClippingPlanes===yt.numPlanes&&r.numIntersection===yt.numIntersection||(n.needsUpdate=!0)),n.needsUpdate&&(f(n,e,i),n.needsUpdate=!1);var a=!1,s=!1,c=!1,h=(o=r.program).getUniforms(),l=r.shader.uniforms;if(I.useProgram(o.program)&&(c=s=a=!0),n.id!==it&&(it=n.id,s=!0),(a||t!==ot)&&(h.setValue(Mt,"projectionMatrix",t.projectionMatrix),O.logarithmicDepthBuffer&&h.setValue(Mt,"logDepthBufFC",2/(Math.log(t.far+1)/Math.LN2)),ot!==(at||t)&&(ot=at||t,c=s=!0),(n.isShaderMaterial||n.isMeshPhongMaterial||n.isMeshStandardMaterial||n.envMap)&&(void 0!==(a=h.map.cameraPosition)&&a.setValue(Mt,_t.setFromMatrixPosition(t.matrixWorld))),(n.isMeshPhongMaterial||n.isMeshLambertMaterial||n.isMeshBasicMaterial||n.isMeshStandardMaterial||n.isShaderMaterial||n.skinning)&&h.setValue(Mt,"viewMatrix",t.matrixWorldInverse)),n.skinning&&(h.setOptional(Mt,i,"bindMatrix"),h.setOptional(Mt,i,"bindMatrixInverse"),t=i.skeleton))if(a=t.bones,O.floatVertexTextures){if(void 0===t.boneTexture){a=Math.sqrt(4*a.length),a=Ar.ceilPowerOfTwo(a),a=Math.max(a,4);var p=new Float32Array(a*a*4);p.set(t.boneMatrices);var d=new u(p,a,a,1023,1015);d.needsUpdate=!0,t.boneMatrices=p,t.boneTexture=d,t.boneTextureSize=a}h.setValue(Mt,"boneTexture",t.boneTexture),h.setValue(Mt,"boneTextureSize",t.boneTextureSize)}else h.setOptional(Mt,t,"boneMatrices");return s&&(h.setValue(Mt,"toneMappingExposure",$.toneMappingExposure),h.setValue(Mt,"toneMappingWhitePoint",$.toneMappingWhitePoint),n.lights&&(s=c,l.ambientLightColor.needsUpdate=s,l.directionalLights.needsUpdate=s,l.pointLights.needsUpdate=s,l.spotLights.needsUpdate=s,l.rectAreaLights.needsUpdate=s,l.hemisphereLights.needsUpdate=s),e&&n.fog&&(l.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?y(l,n):n.isMeshLambertMaterial?(y(l,n),n.emissiveMap&&(l.emissiveMap.value=n.emissiveMap)):n.isMeshPhongMaterial?(y(l,n),n.isMeshToonMaterial?(x(l,n),n.gradientMap&&(l.gradientMap.value=n.gradientMap)):x(l,n)):n.isMeshStandardMaterial?(y(l,n),n.isMeshPhysicalMaterial&&(l.clearCoat.value=n.clearCoat,l.clearCoatRoughness.value=n.clearCoatRoughness),l.roughness.value=n.roughness,l.metalness.value=n.metalness,n.roughnessMap&&(l.roughnessMap.value=n.roughnessMap),n.metalnessMap&&(l.metalnessMap.value=n.metalnessMap),n.emissiveMap&&(l.emissiveMap.value=n.emissiveMap),n.bumpMap&&(l.bumpMap.value=n.bumpMap,l.bumpScale.value=n.bumpScale),n.normalMap&&(l.normalMap.value=n.normalMap,l.normalScale.value.copy(n.normalScale)),n.displacementMap&&(l.displacementMap.value=n.displacementMap,l.displacementScale.value=n.displacementScale,l.displacementBias.value=n.displacementBias),n.envMap&&(l.envMapIntensity.value=n.envMapIntensity)):n.isMeshDepthMaterial?(y(l,n),n.displacementMap&&(l.displacementMap.value=n.displacementMap,l.displacementScale.value=n.displacementScale,l.displacementBias.value=n.displacementBias)):n.isMeshDistanceMaterial?(y(l,n),n.displacementMap&&(l.displacementMap.value=n.displacementMap,l.displacementScale.value=n.displacementScale,l.displacementBias.value=n.displacementBias),l.referencePosition.value.copy(n.referencePosition),l.nearDistance.value=n.nearDistance,l.farDistance.value=n.farDistance):n.isMeshNormalMaterial?(y(l,n),n.bumpMap&&(l.bumpMap.value=n.bumpMap,l.bumpScale.value=n.bumpScale),n.normalMap&&(l.normalMap.value=n.normalMap,l.normalScale.value.copy(n.normalScale)),n.displacementMap&&(l.displacementMap.value=n.displacementMap,l.displacementScale.value=n.displacementScale,l.displacementBias.value=n.displacementBias)):n.isLineBasicMaterial?(l.diffuse.value=n.color,l.opacity.value=n.opacity,n.isLineDashedMaterial&&(l.dashSize.value=n.dashSize,l.totalSize.value=n.dashSize+n.gapSize,l.scale.value=n.scale)):n.isPointsMaterial?(l.diffuse.value=n.color,l.opacity.value=n.opacity,l.size.value=n.size*dt,l.scale.value=.5*pt,l.map.value=n.map,null!==n.map&&(!0===n.map.matrixAutoUpdate&&n.map.updateMatrix(),l.uvTransform.value.copy(n.map.matrix))):n.isShadowMaterial&&(l.color.value=n.color,l.opacity.value=n.opacity),void 0!==l.ltc_1&&(l.ltc_1.value=Or.LTC_1),void 0!==l.ltc_2&&(l.ltc_2.value=Or.LTC_2),Rt.upload(Mt,r.uniformsList,l,$)),n.isShaderMaterial&&!0===n.uniformsNeedUpdate&&(Rt.upload(Mt,r.uniformsList,l,$),n.uniformsNeedUpdate=!1),h.setValue(Mt,"modelViewMatrix",i.modelViewMatrix),h.setValue(Mt,"normalMatrix",i.normalMatrix),h.setValue(Mt,"modelMatrix",i.matrixWorld),o}function y(t,e){if(t.opacity.value=e.opacity,e.color&&(t.diffuse.value=e.color),e.emissive&&t.emissive.value.copy(e.emissive).multiplyScalar(e.emissiveIntensity),e.map&&(t.map.value=e.map),e.alphaMap&&(t.alphaMap.value=e.alphaMap),e.specularMap&&(t.specularMap.value=e.specularMap),e.envMap&&(t.envMap.value=e.envMap,t.flipEnvMap.value=e.envMap&&e.envMap.isCubeTexture?-1:1,t.reflectivity.value=e.reflectivity,t.refractionRatio.value=e.refractionRatio,t.maxMipLevel.value=U.get(e.envMap).__maxMipLevel),e.lightMap&&(t.lightMap.value=e.lightMap,t.lightMapIntensity.value=e.lightMapIntensity),e.aoMap&&(t.aoMap.value=e.aoMap,t.aoMapIntensity.value=e.aoMapIntensity),e.map)var n=e.map;else e.specularMap?n=e.specularMap:e.displacementMap?n=e.displacementMap:e.normalMap?n=e.normalMap:e.bumpMap?n=e.bumpMap:e.roughnessMap?n=e.roughnessMap:e.metalnessMap?n=e.metalnessMap:e.alphaMap?n=e.alphaMap:e.emissiveMap&&(n=e.emissiveMap);void 0!==n&&(n.isWebGLRenderTarget&&(n=n.texture),!0===n.matrixAutoUpdate&&n.updateMatrix(),t.uvTransform.value.copy(n.matrix))}function x(t,e){t.specular.value=e.specular,t.shininess.value=Math.max(e.shininess,1e-4),e.emissiveMap&&(t.emissiveMap.value=e.emissiveMap),e.bumpMap&&(t.bumpMap.value=e.bumpMap,t.bumpScale.value=e.bumpScale),e.normalMap&&(t.normalMap.value=e.normalMap,t.normalScale.value.copy(e.normalScale)),e.displacementMap&&(t.displacementMap.value=e.displacementMap,t.displacementScale.value=e.displacementScale,t.displacementBias.value=e.displacementBias)}console.log("THREE.WebGLRenderer","92");var b=void 0!==(t=t||{}).canvas?t.canvas:document.createElementNS("http://www.w3.org/1999/xhtml","canvas"),w=void 0!==t.context?t.context:null,_=void 0!==t.alpha&&t.alpha,M=void 0===t.depth||t.depth,E=void 0===t.stencil||t.stencil,T=void 0!==t.antialias&&t.antialias,S=void 0===t.premultipliedAlpha||t.premultipliedAlpha,A=void 0!==t.preserveDrawingBuffer&&t.preserveDrawingBuffer,R=void 0!==t.powerPreference?t.powerPreference:"default",L=null,P=null;this.domElement=b,this.context=null,this.sortObjects=this.autoClearStencil=this.autoClearDepth=this.autoClearColor=this.autoClear=!0,this.clippingPlanes=[],this.localClippingEnabled=!1,this.gammaFactor=2,this.physicallyCorrectLights=this.gammaOutput=this.gammaInput=!1,this.toneMappingWhitePoint=this.toneMappingExposure=this.toneMapping=1,this.maxMorphTargets=8,this.maxMorphNormals=4;var C,O,I,N,U,D,B,F,z,H,G,k,V,j,W,X,q,Y,$=this,tt=!1,et=null,nt=null,it=-1,rt="",ot=null,at=null,st=new c,ct=new c,ht=null,lt=0,ut=b.width,pt=b.height,dt=1,ft=new c(0,0,ut,pt),mt=new c(0,0,ut,pt),gt=!1,vt=new m,yt=new J,xt=!1,bt=!1,wt=new i,_t=new o;try{_={alpha:_,depth:M,stencil:E,antialias:T,premultipliedAlpha:S,preserveDrawingBuffer:A,powerPreference:R},b.addEventListener("webglcontextlost",n,!1),b.addEventListener("webglcontextrestored",r,!1);var Mt=w||b.getContext("webgl",_)||b.getContext("experimental-webgl",_);if(null===Mt){if(null!==b.getContext("webgl"))throw Error("Error creating WebGL context with your selected attributes.");throw Error("Error creating WebGL context.")}void 0===Mt.getShaderPrecisionFormat&&(Mt.getShaderPrecisionFormat=function(){return{rangeMin:1,rangeMax:1,precision:1}})}catch(t){console.error("THREE.WebGLRenderer: "+t.message)}e();var Et=new Qt($);this.vr=Et;var Tt=new Wt($,z,O.maxTextureSize);this.shadowMap=Tt,this.getContext=function(){return Mt},this.getContextAttributes=function(){return Mt.getContextAttributes()},this.forceContextLoss=function(){var t=C.get("WEBGL_lose_context");t&&t.loseContext()},this.forceContextRestore=function(){var t=C.get("WEBGL_lose_context");t&&t.restoreContext()},this.getPixelRatio=function(){return dt},this.setPixelRatio=function(t){void 0!==t&&(dt=t,this.setSize(ut,pt,!1))},this.getSize=function(){return{width:ut,height:pt}},this.setSize=function(t,e,n){var i=Et.getDevice();i&&i.isPresenting?console.warn("THREE.WebGLRenderer: Can't change size while VR device is presenting."):(ut=t,pt=e,b.width=t*dt,b.height=e*dt,!1!==n&&(b.style.width=t+"px",b.style.height=e+"px"),this.setViewport(0,0,t,e))},this.getDrawingBufferSize=function(){return{width:ut*dt,height:pt*dt}},this.setDrawingBufferSize=function(t,e,n){ut=t,pt=e,dt=n,b.width=t*n,b.height=e*n,this.setViewport(0,0,t,e)},this.getCurrentViewport=function(){return st},this.setViewport=function(t,e,n,i){ft.set(t,pt-e-i,n,i),I.viewport(st.copy(ft).multiplyScalar(dt))},this.setScissor=function(t,e,n,i){mt.set(t,pt-e-i,n,i),I.scissor(ct.copy(mt).multiplyScalar(dt))},this.setScissorTest=function(t){I.setScissorTest(gt=t)},this.getClearColor=function(){return V.getClearColor()},this.setClearColor=function(){V.setClearColor.apply(V,arguments)},this.getClearAlpha=function(){return V.getClearAlpha()},this.setClearAlpha=function(){V.setClearAlpha.apply(V,arguments)},this.clear=function(t,e,n){var i=0;(void 0===t||t)&&(i|=Mt.COLOR_BUFFER_BIT),(void 0===e||e)&&(i|=Mt.DEPTH_BUFFER_BIT),(void 0===n||n)&&(i|=Mt.STENCIL_BUFFER_BIT),Mt.clear(i)},this.clearColor=function(){this.clear(!0,!1,!1)},this.clearDepth=function(){this.clear(!1,!0,!1)},this.clearStencil=function(){this.clear(!1,!1,!0)},this.clearTarget=function(t,e,n,i){this.setRenderTarget(t),this.clear(e,n,i)},this.dispose=function(){b.removeEventListener("webglcontextlost",n,!1),b.removeEventListener("webglcontextrestored",r,!1),G.dispose(),k.dispose(),U.dispose(),z.dispose(),Et.dispose(),St=!1},this.renderBufferImmediate=function(t,e,n){I.initAttributes();var i=U.get(t);if(t.hasPositions&&!i.position&&(i.position=Mt.createBuffer()),t.hasNormals&&!i.normal&&(i.normal=Mt.createBuffer()),t.hasUvs&&!i.uv&&(i.uv=Mt.createBuffer()),t.hasColors&&!i.color&&(i.color=Mt.createBuffer()),e=e.getAttributes(),t.hasPositions&&(Mt.bindBuffer(Mt.ARRAY_BUFFER,i.position),Mt.bufferData(Mt.ARRAY_BUFFER,t.positionArray,Mt.DYNAMIC_DRAW),I.enableAttribute(e.position),Mt.vertexAttribPointer(e.position,3,Mt.FLOAT,!1,0,0)),t.hasNormals){if(Mt.bindBuffer(Mt.ARRAY_BUFFER,i.normal),!n.isMeshPhongMaterial&&!n.isMeshStandardMaterial&&!n.isMeshNormalMaterial&&!0===n.flatShading)for(var r=0,o=3*t.count;r<o;r+=9){var a=t.normalArray,s=(a[r+0]+a[r+3]+a[r+6])/3,c=(a[r+1]+a[r+4]+a[r+7])/3,h=(a[r+2]+a[r+5]+a[r+8])/3;a[r+0]=s,a[r+1]=c,a[r+2]=h,a[r+3]=s,a[r+4]=c,a[r+5]=h,a[r+6]=s,a[r+7]=c,a[r+8]=h}Mt.bufferData(Mt.ARRAY_BUFFER,t.normalArray,Mt.DYNAMIC_DRAW),I.enableAttribute(e.normal),Mt.vertexAttribPointer(e.normal,3,Mt.FLOAT,!1,0,0)}t.hasUvs&&n.map&&(Mt.bindBuffer(Mt.ARRAY_BUFFER,i.uv),Mt.bufferData(Mt.ARRAY_BUFFER,t.uvArray,Mt.DYNAMIC_DRAW),I.enableAttribute(e.uv),Mt.vertexAttribPointer(e.uv,2,Mt.FLOAT,!1,0,0)),t.hasColors&&0!==n.vertexColors&&(Mt.bindBuffer(Mt.ARRAY_BUFFER,i.color),Mt.bufferData(Mt.ARRAY_BUFFER,t.colorArray,Mt.DYNAMIC_DRAW),I.enableAttribute(e.color),Mt.vertexAttribPointer(e.color,3,Mt.FLOAT,!1,0,0)),I.disableUnusedAttributes(),Mt.drawArrays(Mt.TRIANGLES,0,t.count),t.count=0},this.renderBufferDirect=function(t,e,n,i,r,o){var a=r.isMesh&&0>r.matrixWorld.determinant();I.setMaterial(i,a);var s=g(t,e,i,r),c=!1;(t=n.id+"_"+s.id+"_"+(!0===i.wireframe))!==rt&&(rt=t,c=!0),r.morphTargetInfluences&&(j.update(r,n,i,s),c=!0),a=n.index;var h=n.attributes.position;if(e=1,!0===i.wireframe&&(a=F.getWireframeAttribute(n),e=2),t=W,null!==a){var l=B.get(a);(t=X).setIndex(l)}if(c){if(n&&n.isInstancedBufferGeometry&&null===C.get("ANGLE_instanced_arrays"))console.error("THREE.WebGLRenderer.setupVertexAttributes: using THREE.InstancedBufferGeometry but hardware does not support extension ANGLE_instanced_arrays.");else{I.initAttributes(),c=n.attributes,s=s.getAttributes();var u=i.defaultAttributeValues;for(_ in s){var p=s[_];if(0<=p){var d=c[_];if(void 0!==d){var f=d.normalized,m=d.itemSize,v=B.get(d);if(void 0!==v){var y=v.buffer,x=v.type;if(v=v.bytesPerElement,d.isInterleavedBufferAttribute){var b=d.data,w=b.stride;d=d.offset,b&&b.isInstancedInterleavedBuffer?(I.enableAttributeAndDivisor(p,b.meshPerAttribute),void 0===n.maxInstancedCount&&(n.maxInstancedCount=b.meshPerAttribute*b.count)):I.enableAttribute(p),Mt.bindBuffer(Mt.ARRAY_BUFFER,y),Mt.vertexAttribPointer(p,m,x,f,w*v,d*v)}else d.isInstancedBufferAttribute?(I.enableAttributeAndDivisor(p,d.meshPerAttribute),void 0===n.maxInstancedCount&&(n.maxInstancedCount=d.meshPerAttribute*d.count)):I.enableAttribute(p),Mt.bindBuffer(Mt.ARRAY_BUFFER,y),Mt.vertexAttribPointer(p,m,x,f,0,0)}}else if(void 0!==u&&void 0!==(f=u[_]))switch(f.length){case 2:Mt.vertexAttrib2fv(p,f);break;case 3:Mt.vertexAttrib3fv(p,f);break;case 4:Mt.vertexAttrib4fv(p,f);break;default:Mt.vertexAttrib1fv(p,f)}}}I.disableUnusedAttributes()}null!==a&&Mt.bindBuffer(Mt.ELEMENT_ARRAY_BUFFER,l.buffer)}l=1/0,null!==a?l=a.count:void 0!==h&&(l=h.count),a=n.drawRange.start*e,h=null!==o?o.start*e:0;var _=Math.max(a,h);if(0!==(o=Math.max(0,Math.min(l,a+n.drawRange.count*e,h+(null!==o?o.count*e:1/0))-1-_+1))){if(r.isMesh)if(!0===i.wireframe)I.setLineWidth(i.wireframeLinewidth*(null===et?dt:1)),t.setMode(Mt.LINES);else switch(r.drawMode){case 0:t.setMode(Mt.TRIANGLES);break;case 1:t.setMode(Mt.TRIANGLE_STRIP);break;case 2:t.setMode(Mt.TRIANGLE_FAN)}else r.isLine?(void 0===(i=i.linewidth)&&(i=1),I.setLineWidth(i*(null===et?dt:1)),r.isLineSegments?t.setMode(Mt.LINES):r.isLineLoop?t.setMode(Mt.LINE_LOOP):t.setMode(Mt.LINE_STRIP)):r.isPoints&&t.setMode(Mt.POINTS);n&&n.isInstancedBufferGeometry?0<n.maxInstancedCount&&t.renderInstances(n,_,o):t.render(_,o)}},this.compile=function(t,e){(P=k.get(t,e)).init(),t.traverse(function(t){t.isLight&&(P.pushLight(t),t.castShadow&&P.pushShadow(t))}),P.setupLights(e),t.traverse(function(e){if(e.material)if(Array.isArray(e.material))for(var n=0;n<e.material.length;n++)f(e.material[n],t.fog,e);else f(e.material,t.fog,e)})};var St=!1,At=null;this.animate=function(t){null!==(At=t)?St||(h(),St=!0):St=!1},this.render=function(t,e,n,i){if(e&&e.isCamera){if(!tt){rt="",it=-1,ot=null,!0===t.autoUpdate&&t.updateMatrixWorld(),null===e.parent&&e.updateMatrixWorld(),Et.enabled&&(e=Et.getCamera(e)),(P=k.get(t,e)).init(),t.onBeforeRender($,t,e,n),wt.multiplyMatrices(e.projectionMatrix,e.matrixWorldInverse),vt.setFromMatrix(wt),bt=this.localClippingEnabled,xt=yt.init(this.clippingPlanes,bt,e),(L=G.get(t,e)).init(),function t(e,n,i){if(!1!==e.visible){if(e.layers.test(n.layers))if(e.isLight)P.pushLight(e),e.castShadow&&P.pushShadow(e);else if(e.isSprite)e.frustumCulled&&!vt.intersectsSprite(e)||P.pushSprite(e);else if(e.isImmediateRenderObject)i&&_t.setFromMatrixPosition(e.matrixWorld).applyMatrix4(wt),L.push(e,null,e.material,_t.z,null);else if((e.isMesh||e.isLine||e.isPoints)&&(e.isSkinnedMesh&&e.skeleton.update(),!e.frustumCulled||vt.intersectsObject(e))){i&&_t.setFromMatrixPosition(e.matrixWorld).applyMatrix4(wt);var r=z.update(e),o=e.material;if(Array.isArray(o))for(var a=r.groups,s=0,c=a.length;s<c;s++){var h=a[s],l=o[h.materialIndex];l&&l.visible&&L.push(e,r,l,_t.z,h)}else o.visible&&L.push(e,r,o,_t.z,null)}for(s=0,c=(e=e.children).length;s<c;s++)t(e[s],n,i)}}(t,e,$.sortObjects),!0===$.sortObjects&&L.sort(),xt&&yt.beginShadows(),Tt.render(P.state.shadowsArray,t,e),P.setupLights(e),xt&&yt.endShadows(),this.info.autoReset&&this.info.reset(),void 0===n&&(n=null),this.setRenderTarget(n),V.render(L,t,e,i),i=L.opaque;var r=L.transparent;if(t.overrideMaterial){var o=t.overrideMaterial;i.length&&p(i,t,e,o),r.length&&p(r,t,e,o)}else i.length&&p(i,t,e),r.length&&p(r,t,e);q.render(P.state.spritesArray,t,e),n&&D.updateRenderTargetMipmap(n),I.buffers.depth.setTest(!0),I.buffers.depth.setMask(!0),I.buffers.color.setMask(!0),I.setPolygonOffset(!1),t.onAfterRender($,t,e),Et.enabled&&Et.submitFrame(),P=L=null}}else console.error("THREE.WebGLRenderer.render: camera is not an instance of THREE.Camera.")},this.allocTextureUnit=function(){var t=lt;return t>=O.maxTextures&&console.warn("THREE.WebGLRenderer: Trying to use "+t+" texture units while this GPU supports only "+O.maxTextures),lt+=1,t},this.setTexture2D=function(){var t=!1;return function(e,n){e&&e.isWebGLRenderTarget&&(t||(console.warn("THREE.WebGLRenderer.setTexture2D: don't use render targets as textures. Use their .texture property instead."),t=!0),e=e.texture),D.setTexture2D(e,n)}}(),this.setTexture=function(){var t=!1;return function(e,n){t||(console.warn("THREE.WebGLRenderer: .setTexture is deprecated, use setTexture2D instead."),t=!0),D.setTexture2D(e,n)}}(),this.setTextureCube=function(){var t=!1;return function(e,n){e&&e.isWebGLRenderTargetCube&&(t||(console.warn("THREE.WebGLRenderer.setTextureCube: don't use cube render targets as textures. Use their .texture property instead."),t=!0),e=e.texture),e&&e.isCubeTexture||Array.isArray(e.image)&&6===e.image.length?D.setTextureCube(e,n):D.setTextureCubeDynamic(e,n)}}(),this.getRenderTarget=function(){return et},this.setRenderTarget=function(t){(et=t)&&void 0===U.get(t).__webglFramebuffer&&D.setupRenderTarget(t);var e=null,n=!1;t?(e=U.get(t).__webglFramebuffer,t.isWebGLRenderTargetCube&&(e=e[t.activeCubeFace],n=!0),st.copy(t.viewport),ct.copy(t.scissor),ht=t.scissorTest):(st.copy(ft).multiplyScalar(dt),ct.copy(mt).multiplyScalar(dt),ht=gt),nt!==e&&(Mt.bindFramebuffer(Mt.FRAMEBUFFER,e),nt=e),I.viewport(st),I.scissor(ct),I.setScissorTest(ht),n&&(n=U.get(t.texture),Mt.framebufferTexture2D(Mt.FRAMEBUFFER,Mt.COLOR_ATTACHMENT0,Mt.TEXTURE_CUBE_MAP_POSITIVE_X+t.activeCubeFace,n.__webglTexture,t.activeMipMapLevel))},this.readRenderTargetPixels=function(t,e,n,i,r,o){if(t&&t.isWebGLRenderTarget){var a=U.get(t).__webglFramebuffer;if(a){var s=!1;a!==nt&&(Mt.bindFramebuffer(Mt.FRAMEBUFFER,a),s=!0);try{var c=t.texture,h=c.format,l=c.type;1023!==h&&Y.convert(h)!==Mt.getParameter(Mt.IMPLEMENTATION_COLOR_READ_FORMAT)?console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format."):1009===l||Y.convert(l)===Mt.getParameter(Mt.IMPLEMENTATION_COLOR_READ_TYPE)||1015===l&&(C.get("OES_texture_float")||C.get("WEBGL_color_buffer_float"))||1016===l&&C.get("EXT_color_buffer_half_float")?Mt.checkFramebufferStatus(Mt.FRAMEBUFFER)===Mt.FRAMEBUFFER_COMPLETE?0<=e&&e<=t.width-i&&0<=n&&n<=t.height-r&&Mt.readPixels(e,n,i,r,Y.convert(h),Y.convert(l),o):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&&Mt.bindFramebuffer(Mt.FRAMEBUFFER,nt)}}}else console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.")},this.copyFramebufferToTexture=function(t,e,n){var i=e.image.width,r=e.image.height,o=Y.convert(e.format);this.setTexture2D(e,0),Mt.copyTexImage2D(Mt.TEXTURE_2D,n||0,o,t.x,t.y,i,r,0)},this.copyTextureToTexture=function(t,e,n,i){var r=e.image.width,o=e.image.height,a=Y.convert(n.format),s=Y.convert(n.type);e=e.isDataTexture?e.image.data:e.image,this.setTexture2D(n,0),Mt.texSubImage2D(Mt.TEXTURE_2D,i||0,t.x,t.y,r,o,a,s,e)}}function $t(t,e){this.name="",this.color=new g(t),this.density=void 0!==e?e:25e-5}function te(t,e,n){this.name="",this.color=new g(t),this.near=void 0!==e?e:1,this.far=void 0!==n?n:1e3}function ee(){b.call(this),this.type="Scene",this.overrideMaterial=this.fog=this.background=null,this.autoUpdate=!0}function ne(t){k.call(this),this.type="SpriteMaterial",this.color=new g(16777215),this.map=null,this.rotation=0,this.lights=this.fog=!1,this.setValues(t)}function ie(t){b.call(this),this.type="Sprite",this.material=void 0!==t?t:new ne,this.center=new n(.5,.5)}function re(){b.call(this),this.type="LOD",Object.defineProperties(this,{levels:{enumerable:!0,value:[]}})}function oe(t,e){if(t=t||[],this.bones=t.slice(0),this.boneMatrices=new Float32Array(16*this.bones.length),void 0===e)this.calculateInverses();else if(this.bones.length===e.length)this.boneInverses=e.slice(0);else for(console.warn("THREE.Skeleton boneInverses is the wrong length."),this.boneInverses=[],t=0,e=this.bones.length;t<e;t++)this.boneInverses.push(new i)}function ae(){b.call(this),this.type="Bone"}function se(t,e){Y.call(this,t,e),this.type="SkinnedMesh",this.bindMode="attached",this.bindMatrix=new i,this.bindMatrixInverse=new i,t=new oe(t=this.initBones()),this.bind(t,this.matrixWorld),this.normalizeSkinWeights()}function ce(t){k.call(this),this.type="LineBasicMaterial",this.color=new g(16777215),this.linewidth=1,this.linejoin=this.linecap="round",this.lights=!1,this.setValues(t)}function he(t,e,n){if(1===n)return console.warn("THREE.Line: parameter THREE.LinePieces no longer supported. Created THREE.LineSegments instead."),new le(t,e);b.call(this),this.type="Line",this.geometry=void 0!==t?t:new B,this.material=void 0!==e?e:new ce({color:16777215*Math.random()})}function le(t,e){he.call(this,t,e),this.type="LineSegments"}function ue(t,e){he.call(this,t,e),this.type="LineLoop"}function pe(t){k.call(this),this.type="PointsMaterial",this.color=new g(16777215),this.map=null,this.size=1,this.sizeAttenuation=!0,this.lights=!1,this.setValues(t)}function de(t,e){b.call(this),this.type="Points",this.geometry=void 0!==t?t:new B,this.material=void 0!==e?e:new pe({color:16777215*Math.random()})}function fe(){b.call(this),this.type="Group"}function me(t,e,n,i,r,o,a,c,h){s.call(this,t,e,n,i,r,o,a,c,h),this.generateMipmaps=!1}function ge(t,e,n,i,r,o,a,c,h,l,u,p){s.call(this,null,o,a,c,h,l,i,r,u,p),this.image={width:e,height:n},this.mipmaps=t,this.generateMipmaps=this.flipY=!1}function ve(t,e,n,i,r,o,a,c,h,l){if(1026!==(l=void 0!==l?l:1026)&&1027!==l)throw Error("DepthTexture format must be either THREE.DepthFormat or THREE.DepthStencilFormat");void 0===n&&1026===l&&(n=1012),void 0===n&&1027===l&&(n=1020),s.call(this,null,i,r,o,a,c,l,n,h),this.image={width:t,height:e},this.magFilter=void 0!==a?a:1003,this.minFilter=void 0!==c?c:1003,this.generateMipmaps=this.flipY=!1}function ye(t){B.call(this),this.type="WireframeGeometry";var e,n,i,r=[],a=[0,0],s={},c=["a","b","c"];if(t&&t.isGeometry){var h=t.faces,l=0;for(n=h.length;l<n;l++){var u=h[l];for(e=0;3>e;e++){var p=u[c[e]],d=u[c[(e+1)%3]];a[0]=Math.min(p,d),a[1]=Math.max(p,d),void 0===s[p=a[0]+","+a[1]]&&(s[p]={index1:a[0],index2:a[1]})}}for(p in s)l=s[p],c=t.vertices[l.index1],r.push(c.x,c.y,c.z),c=t.vertices[l.index2],r.push(c.x,c.y,c.z)}else if(t&&t.isBufferGeometry)if(c=new o,null!==t.index){h=t.attributes.position,u=t.index;var f=t.groups;for(0===f.length&&(f=[{start:0,count:u.count,materialIndex:0}]),t=0,i=f.length;t<i;++t)for(e=(l=f[t]).start,n=l.count,l=e,n=e+n;l<n;l+=3)for(e=0;3>e;e++)p=u.getX(l+e),d=u.getX(l+(e+1)%3),a[0]=Math.min(p,d),a[1]=Math.max(p,d),void 0===s[p=a[0]+","+a[1]]&&(s[p]={index1:a[0],index2:a[1]});for(p in s)l=s[p],c.fromBufferAttribute(h,l.index1),r.push(c.x,c.y,c.z),c.fromBufferAttribute(h,l.index2),r.push(c.x,c.y,c.z)}else for(l=0,n=(h=t.attributes.position).count/3;l<n;l++)for(e=0;3>e;e++)s=3*l+e,c.fromBufferAttribute(h,s),r.push(c.x,c.y,c.z),s=3*l+(e+1)%3,c.fromBufferAttribute(h,s),r.push(c.x,c.y,c.z);this.addAttribute("position",new I(r,3))}function xe(t,e,n){E.call(this),this.type="ParametricGeometry",this.parameters={func:t,slices:e,stacks:n},this.fromBufferGeometry(new be(t,e,n)),this.mergeVertices()}function be(t,e,n){B.call(this),this.type="ParametricBufferGeometry",this.parameters={func:t,slices:e,stacks:n};var i,r,a=[],s=[],c=[],h=[],l=new o,u=new o,p=new o,d=new o,f=new o,m=e+1;for(i=0;i<=n;i++){var g=i/n;for(r=0;r<=e;r++){var v=r/e;t(v,g,u),s.push(u.x,u.y,u.z),0<=v-1e-5?(t(v-1e-5,g,p),d.subVectors(u,p)):(t(v+1e-5,g,p),d.subVectors(p,u)),0<=g-1e-5?(t(v,g-1e-5,p),f.subVectors(u,p)):(t(v,g+1e-5,p),f.subVectors(p,u)),l.crossVectors(d,f).normalize(),c.push(l.x,l.y,l.z),h.push(v,g)}}for(i=0;i<n;i++)for(r=0;r<e;r++)t=i*m+r+1,l=(i+1)*m+r+1,u=(i+1)*m+r,a.push(i*m+r,t,u),a.push(t,l,u);this.setIndex(a),this.addAttribute("position",new I(s,3)),this.addAttribute("normal",new I(c,3)),this.addAttribute("uv",new I(h,2))}function we(t,e,n,i){E.call(this),this.type="PolyhedronGeometry",this.parameters={vertices:t,indices:e,radius:n,detail:i},this.fromBufferGeometry(new _e(t,e,n,i)),this.mergeVertices()}function _e(t,e,i,r){function a(t){h.push(t.x,t.y,t.z)}function s(e,n){e*=3,n.x=t[e+0],n.y=t[e+1],n.z=t[e+2]}function c(t,e,n,i){0>i&&1===t.x&&(l[e]=t.x-1),0===n.x&&0===n.z&&(l[e]=i/2/Math.PI+.5)}B.call(this),this.type="PolyhedronBufferGeometry",this.parameters={vertices:t,indices:e,radius:i,detail:r},i=i||1;var h=[],l=[];!function(t){for(var n=new o,i=new o,r=new o,c=0;c<e.length;c+=3){s(e[c+0],n),s(e[c+1],i),s(e[c+2],r);var h,l,u=n,p=i,d=r,f=Math.pow(2,t),m=[];for(l=0;l<=f;l++){m[l]=[];var g=u.clone().lerp(d,l/f),v=p.clone().lerp(d,l/f),y=f-l;for(h=0;h<=y;h++)m[l][h]=0===h&&l===f?g:g.clone().lerp(v,h/y)}for(l=0;l<f;l++)for(h=0;h<2*(f-l)-1;h++)u=Math.floor(h/2),0==h%2?(a(m[l][u+1]),a(m[l+1][u]),a(m[l][u])):(a(m[l][u+1]),a(m[l+1][u+1]),a(m[l+1][u]))}}(r=r||0),function(t){for(var e=new o,n=0;n<h.length;n+=3)e.x=h[n+0],e.y=h[n+1],e.z=h[n+2],e.normalize().multiplyScalar(t),h[n+0]=e.x,h[n+1]=e.y,h[n+2]=e.z}(i),function(){for(var t=new o,e=0;e<h.length;e+=3)t.x=h[e+0],t.y=h[e+1],t.z=h[e+2],l.push(Math.atan2(t.z,-t.x)/2/Math.PI+.5,1-(Math.atan2(-t.y,Math.sqrt(t.x*t.x+t.z*t.z))/Math.PI+.5));t=new o,e=new o;for(var i=new o,r=new o,a=new n,s=new n,u=new n,p=0,d=0;p<h.length;p+=9,d+=6){t.set(h[p+0],h[p+1],h[p+2]),e.set(h[p+3],h[p+4],h[p+5]),i.set(h[p+6],h[p+7],h[p+8]),a.set(l[d+0],l[d+1]),s.set(l[d+2],l[d+3]),u.set(l[d+4],l[d+5]),r.copy(t).add(e).add(i).divideScalar(3);var f=Math.atan2(r.z,-r.x);c(a,d+0,t,f),c(s,d+2,e,f),c(u,d+4,i,f)}for(t=0;t<l.length;t+=6)e=l[t+0],i=l[t+2],r=l[t+4],a=Math.min(e,i,r),.9<Math.max(e,i,r)&&.1>a&&(.2>e&&(l[t+0]+=1),.2>i&&(l[t+2]+=1),.2>r&&(l[t+4]+=1))}(),this.addAttribute("position",new I(h,3)),this.addAttribute("normal",new I(h.slice(),3)),this.addAttribute("uv",new I(l,2)),0===r?this.computeVertexNormals():this.normalizeNormals()}function Me(t,e){E.call(this),this.type="TetrahedronGeometry",this.parameters={radius:t,detail:e},this.fromBufferGeometry(new Ee(t,e)),this.mergeVertices()}function Ee(t,e){_e.call(this,[1,1,1,-1,-1,1,-1,1,-1,1,-1,-1],[2,1,0,0,3,2,1,3,0,2,3,1],t,e),this.type="TetrahedronBufferGeometry",this.parameters={radius:t,detail:e}}function Te(t,e){E.call(this),this.type="OctahedronGeometry",this.parameters={radius:t,detail:e},this.fromBufferGeometry(new Se(t,e)),this.mergeVertices()}function Se(t,e){_e.call(this,[1,0,0,-1,0,0,0,1,0,0,-1,0,0,0,1,0,0,-1],[0,2,4,0,4,3,0,3,5,0,5,2,1,2,5,1,5,3,1,3,4,1,4,2],t,e),this.type="OctahedronBufferGeometry",this.parameters={radius:t,detail:e}}function Ae(t,e){E.call(this),this.type="IcosahedronGeometry",this.parameters={radius:t,detail:e},this.fromBufferGeometry(new Re(t,e)),this.mergeVertices()}function Re(t,e){var n=(1+Math.sqrt(5))/2;_e.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],t,e),this.type="IcosahedronBufferGeometry",this.parameters={radius:t,detail:e}}function Le(t,e){E.call(this),this.type="DodecahedronGeometry",this.parameters={radius:t,detail:e},this.fromBufferGeometry(new Pe(t,e)),this.mergeVertices()}function Pe(t,e){var n=(1+Math.sqrt(5))/2,i=1/n;_e.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],t,e),this.type="DodecahedronBufferGeometry",this.parameters={radius:t,detail:e}}function Ce(t,e,n,i,r,o){E.call(this),this.type="TubeGeometry",this.parameters={path:t,tubularSegments:e,radius:n,radialSegments:i,closed:r},void 0!==o&&console.warn("THREE.TubeGeometry: taper has been removed."),t=new Oe(t,e,n,i,r),this.tangents=t.tangents,this.normals=t.normals,this.binormals=t.binormals,this.fromBufferGeometry(t),this.mergeVertices()}function Oe(t,e,i,r,a){function s(n){f=t.getPointAt(n/e,f);var o=c.normals[n];for(n=c.binormals[n],l=0;l<=r;l++){var a=l/r*Math.PI*2,s=Math.sin(a);a=-Math.cos(a),p.x=a*o.x+s*n.x,p.y=a*o.y+s*n.y,p.z=a*o.z+s*n.z,p.normalize(),g.push(p.x,p.y,p.z),u.x=f.x+i*p.x,u.y=f.y+i*p.y,u.z=f.z+i*p.z,m.push(u.x,u.y,u.z)}}B.call(this),this.type="TubeBufferGeometry",this.parameters={path:t,tubularSegments:e,radius:i,radialSegments:r,closed:a},e=e||64,i=i||1,r=r||8,a=a||!1;var c=t.computeFrenetFrames(e,a);this.tangents=c.tangents,this.normals=c.normals,this.binormals=c.binormals;var h,l,u=new o,p=new o,d=new n,f=new o,m=[],g=[],v=[],y=[];for(h=0;h<e;h++)s(h);for(s(!1===a?e:0),h=0;h<=e;h++)for(l=0;l<=r;l++)d.x=h/e,d.y=l/r,v.push(d.x,d.y);!function(){for(l=1;l<=e;l++)for(h=1;h<=r;h++){var t=(r+1)*l+(h-1),n=(r+1)*l+h,i=(r+1)*(l-1)+h;y.push((r+1)*(l-1)+(h-1),t,i),y.push(t,n,i)}}(),this.setIndex(y),this.addAttribute("position",new I(m,3)),this.addAttribute("normal",new I(g,3)),this.addAttribute("uv",new I(v,2))}function Ie(t,e,n,i,r,o,a){E.call(this),this.type="TorusKnotGeometry",this.parameters={radius:t,tube:e,tubularSegments:n,radialSegments:i,p:r,q:o},void 0!==a&&console.warn("THREE.TorusKnotGeometry: heightScale has been deprecated. Use .scale( x, y, z ) instead."),this.fromBufferGeometry(new Ne(t,e,n,i,r,o)),this.mergeVertices()}function Ne(t,e,n,i,r,a){function s(t,e,n,i,r){var o=Math.sin(t);e=n/e*t,n=Math.cos(e),r.x=i*(2+n)*.5*Math.cos(t),r.y=i*(2+n)*o*.5,r.z=i*Math.sin(e)*.5}B.call(this),this.type="TorusKnotBufferGeometry",this.parameters={radius:t,tube:e,tubularSegments:n,radialSegments:i,p:r,q:a},t=t||1,e=e||.4,n=Math.floor(n)||64,i=Math.floor(i)||8,r=r||2,a=a||3;var c,h=[],l=[],u=[],p=[],d=new o,f=new o,m=new o,g=new o,v=new o,y=new o,x=new o;for(c=0;c<=n;++c){var b=c/n*r*Math.PI*2;for(s(b,r,a,t,m),s(b+.01,r,a,t,g),y.subVectors(g,m),x.addVectors(g,m),v.crossVectors(y,x),x.crossVectors(v,y),v.normalize(),x.normalize(),b=0;b<=i;++b){var w=b/i*Math.PI*2,_=-e*Math.cos(w);w=e*Math.sin(w),d.x=m.x+(_*x.x+w*v.x),d.y=m.y+(_*x.y+w*v.y),d.z=m.z+(_*x.z+w*v.z),l.push(d.x,d.y,d.z),f.subVectors(d,m).normalize(),u.push(f.x,f.y,f.z),p.push(c/n),p.push(b/i)}}for(b=1;b<=n;b++)for(c=1;c<=i;c++)t=(i+1)*b+(c-1),e=(i+1)*b+c,r=(i+1)*(b-1)+c,h.push((i+1)*(b-1)+(c-1),t,r),h.push(t,e,r);this.setIndex(h),this.addAttribute("position",new I(l,3)),this.addAttribute("normal",new I(u,3)),this.addAttribute("uv",new I(p,2))}function Ue(t,e,n,i,r){E.call(this),this.type="TorusGeometry",this.parameters={radius:t,tube:e,radialSegments:n,tubularSegments:i,arc:r},this.fromBufferGeometry(new De(t,e,n,i,r)),this.mergeVertices()}function De(t,e,n,i,r){B.call(this),this.type="TorusBufferGeometry",this.parameters={radius:t,tube:e,radialSegments:n,tubularSegments:i,arc:r},t=t||1,e=e||.4,n=Math.floor(n)||8,i=Math.floor(i)||6,r=r||2*Math.PI;var a,s,c=[],h=[],l=[],u=[],p=new o,d=new o,f=new o;for(a=0;a<=n;a++)for(s=0;s<=i;s++){var m=s/i*r,g=a/n*Math.PI*2;d.x=(t+e*Math.cos(g))*Math.cos(m),d.y=(t+e*Math.cos(g))*Math.sin(m),d.z=e*Math.sin(g),h.push(d.x,d.y,d.z),p.x=t*Math.cos(m),p.y=t*Math.sin(m),f.subVectors(d,p).normalize(),l.push(f.x,f.y,f.z),u.push(s/i),u.push(a/n)}for(a=1;a<=n;a++)for(s=1;s<=i;s++)t=(i+1)*(a-1)+s-1,e=(i+1)*(a-1)+s,r=(i+1)*a+s,c.push((i+1)*a+s-1,t,r),c.push(t,e,r);this.setIndex(c),this.addAttribute("position",new I(h,3)),this.addAttribute("normal",new I(l,3)),this.addAttribute("uv",new I(u,2))}function Be(t,e,n,i,r){for(var o,a=0,s=e,c=n-i;s<n;s+=i)a+=(t[c]-t[s])*(t[s+1]+t[c+1]),c=s;if(r===0<a)for(r=e;r<n;r+=i)o=Ze(r,t[r],t[r+1],o);else for(r=n-i;r>=e;r-=i)o=Ze(r,t[r],t[r+1],o);return o&&We(o,o.next)&&(Je(o),o=o.next),o}function Fe(t,e){if(!t)return t;e||(e=t);do{var n=!1;if(t.steiner||!We(t,t.next)&&0!==je(t.prev,t,t.next))t=t.next;else{if(Je(t),(t=e=t.prev)===t.next)break;n=!0}}while(n||t!==e);return e}function ze(t,e){return t.x-e.x}function He(t,e){var n=e,i=t.x,r=t.y,o=-1/0;do{if(r<=n.y&&r>=n.next.y&&n.next.y!==n.y){var a=n.x+(r-n.y)*(n.next.x-n.x)/(n.next.y-n.y);if(a<=i&&a>o){if(o=a,a===i){if(r===n.y)return n;if(r===n.next.y)return n.next}var s=n.x<n.next.x?n:n.next}}n=n.next}while(n!==e);if(!s)return null;if(i===o)return s.prev;e=s,a=s.x;var c=s.y,h=1/0;for(n=s.next;n!==e;){if(i>=n.x&&n.x>=a&&i!==n.x&&Ve(r<c?i:o,r,a,c,r<c?o:i,r,n.x,n.y)){var l=Math.abs(r-n.y)/(i-n.x);(l<h||l===h&&n.x>s.x)&&qe(n,t)&&(s=n,h=l)}n=n.next}return s}function Ge(t,e,n,i,r){return 1431655765&((t=858993459&((t=252645135&((t=16711935&((t=32767*(t-n)*r)|t<<8))|t<<4))|t<<2))|t<<1)|(1431655765&((e=858993459&((e=252645135&((e=16711935&((e=32767*(e-i)*r)|e<<8))|e<<4))|e<<2))|e<<1))<<1}function ke(t){var e=t,n=t;do{e.x<n.x&&(n=e),e=e.next}while(e!==t);return n}function Ve(t,e,n,i,r,o,a,s){return 0<=(r-a)*(e-s)-(t-a)*(o-s)&&0<=(t-a)*(i-s)-(n-a)*(e-s)&&0<=(n-a)*(o-s)-(r-a)*(i-s)}function je(t,e,n){return(e.y-t.y)*(n.x-e.x)-(e.x-t.x)*(n.y-e.y)}function We(t,e){return t.x===e.x&&t.y===e.y}function Xe(t,e,n,i){return!!(We(t,e)&&We(n,i)||We(t,i)&&We(n,e))||0<je(t,e,n)!=0<je(t,e,i)&&0<je(n,i,t)!=0<je(n,i,e)}function qe(t,e){return 0>je(t.prev,t,t.next)?0<=je(t,e,t.next)&&0<=je(t,t.prev,e):0>je(t,e,t.prev)||0>je(t,t.next,e)}function Ye(t,e){var n=new Qe(t.i,t.x,t.y),i=new Qe(e.i,e.x,e.y),r=t.next,o=e.prev;return t.next=e,e.prev=t,n.next=r,r.prev=n,i.next=n,n.prev=i,o.next=i,i.prev=o,i}function Ze(t,e,n,i){return t=new Qe(t,e,n),i?(t.next=i.next,t.prev=i,i.next.prev=t,i.next=t):(t.prev=t,t.next=t),t}function Je(t){t.next.prev=t.prev,t.prev.next=t.next,t.prevZ&&(t.prevZ.nextZ=t.nextZ),t.nextZ&&(t.nextZ.prevZ=t.prevZ)}function Qe(t,e,n){this.i=t,this.x=e,this.y=n,this.nextZ=this.prevZ=this.z=this.next=this.prev=null,this.steiner=!1}function Ke(t){var e=t.length;2<e&&t[e-1].equals(t[0])&&t.pop()}function $e(t,e){for(var n=0;n<e.length;n++)t.push(e[n].x),t.push(e[n].y)}function tn(t,e){E.call(this),this.type="ExtrudeGeometry",this.parameters={shapes:t,options:e},this.fromBufferGeometry(new en(t,e)),this.mergeVertices()}function en(t,e){function i(t){function i(t,e,n){return e||console.error("THREE.ExtrudeGeometry: vec does not exist"),e.clone().multiplyScalar(n).add(t)}function c(t,e,i){var r=t.x-e.x,o=t.y-e.y,a=i.x-t.x,s=i.y-t.y,c=r*r+o*o;if(Math.abs(r*s-o*a)>Number.EPSILON){var h=Math.sqrt(c),l=Math.sqrt(a*a+s*s);if(c=e.x-o/h,e=e.y+r/h,2>=(o=(a=c+r*(s=((i.x-s/l-c)*s-(i.y+a/l-e)*a)/(r*s-o*a))-t.x)*a+(r=e+o*s-t.y)*r))return new n(a,r);o=Math.sqrt(o/2)}else t=!1,r>Number.EPSILON?a>Number.EPSILON&&(t=!0):r<-Number.EPSILON?a<-Number.EPSILON&&(t=!0):Math.sign(o)===Math.sign(s)&&(t=!0),t?(a=-o,o=Math.sqrt(c)):(a=r,r=o,o=Math.sqrt(c/2));return new n(a/o,r/o)}function h(t,e){for(H=t.length;0<=--H;){var n=H,i=H-1;0>i&&(i=t.length-1);var o,s=v+2*_;for(o=0;o<s;o++){var c=F*o,h=F*(o+1),l=e+i+c,u=e+i+h;h=e+n+h,p(e+n+c),p(l),p(h),p(l),p(u),p(h),c=a.length/3,d((c=E.generateSideWallUV(r,a,c-6,c-3,c-2,c-1))[0]),d(c[1]),d(c[3]),d(c[1]),d(c[2]),d(c[3])}}}function l(t,e,n){m.push(t),m.push(e),m.push(n)}function u(t,e,n){p(t),p(e),p(n),t=a.length/3,d((t=E.generateTopUV(r,a,t-3,t-2,t-1))[0]),d(t[1]),d(t[2])}function p(t){a.push(m[3*t]),a.push(m[3*t+1]),a.push(m[3*t+2])}function d(t){s.push(t.x),s.push(t.y)}var f,m=[],g=void 0!==e.curveSegments?e.curveSegments:12,v=void 0!==e.steps?e.steps:1,y=void 0!==e.amount?e.amount:100,x=void 0===e.bevelEnabled||e.bevelEnabled,b=void 0!==e.bevelThickness?e.bevelThickness:6,w=void 0!==e.bevelSize?e.bevelSize:b-2,_=void 0!==e.bevelSegments?e.bevelSegments:3,M=e.extrudePath,E=void 0!==e.UVGenerator?e.UVGenerator:Zr,T=!1;if(M){var S=M.getSpacedPoints(v);T=!0,x=!1;var A=M.computeFrenetFrames(v,!1),R=new o,L=new o,P=new o}x||(w=b=_=0),t=(g=t.extractPoints(g)).shape;var C=g.holes;if(!Yr.isClockWise(t)){t=t.reverse();var O=0;for(f=C.length;O<f;O++){var I=C[O];Yr.isClockWise(I)&&(C[O]=I.reverse())}}var N=Yr.triangulateShape(t,C),U=t;for(O=0,f=C.length;O<f;O++)I=C[O],t=t.concat(I);var D,B,F=t.length,z=N.length;g=[];var H=0,G=U.length,k=G-1;for(D=H+1;H<G;H++,k++,D++)k===G&&(k=0),D===G&&(D=0),g[H]=c(U[H],U[k],U[D]);M=[];var V=g.concat();for(O=0,f=C.length;O<f;O++){I=C[O];var j=[];for(H=0,k=(G=I.length)-1,D=H+1;H<G;H++,k++,D++)k===G&&(k=0),D===G&&(D=0),j[H]=c(I[H],I[k],I[D]);M.push(j),V=V.concat(j)}for(k=0;k<_;k++){G=k/_;var W=b*Math.cos(G*Math.PI/2);for(D=w*Math.sin(G*Math.PI/2),H=0,G=U.length;H<G;H++){var X=i(U[H],g[H],D);l(X.x,X.y,-W)}for(O=0,f=C.length;O<f;O++)for(I=C[O],j=M[O],H=0,G=I.length;H<G;H++)l((X=i(I[H],j[H],D)).x,X.y,-W)}for(D=w,H=0;H<F;H++)X=x?i(t[H],V[H],D):t[H],T?(L.copy(A.normals[0]).multiplyScalar(X.x),R.copy(A.binormals[0]).multiplyScalar(X.y),P.copy(S[0]).add(L).add(R),l(P.x,P.y,P.z)):l(X.x,X.y,0);for(G=1;G<=v;G++)for(H=0;H<F;H++)X=x?i(t[H],V[H],D):t[H],T?(L.copy(A.normals[G]).multiplyScalar(X.x),R.copy(A.binormals[G]).multiplyScalar(X.y),P.copy(S[G]).add(L).add(R),l(P.x,P.y,P.z)):l(X.x,X.y,y/v*G);for(k=_-1;0<=k;k--){for(G=k/_,W=b*Math.cos(G*Math.PI/2),D=w*Math.sin(G*Math.PI/2),H=0,G=U.length;H<G;H++)l((X=i(U[H],g[H],D)).x,X.y,y+W);for(O=0,f=C.length;O<f;O++)for(I=C[O],j=M[O],H=0,G=I.length;H<G;H++)X=i(I[H],j[H],D),T?l(X.x,X.y+S[v-1].y,S[v-1].x+W):l(X.x,X.y,y+W)}!function(){var t=a.length/3;if(x){var e=0*F;for(H=0;H<z;H++)u((B=N[H])[2]+e,B[1]+e,B[0]+e);for(e=F*(v+2*_),H=0;H<z;H++)u((B=N[H])[0]+e,B[1]+e,B[2]+e)}else{for(H=0;H<z;H++)u((B=N[H])[2],B[1],B[0]);for(H=0;H<z;H++)u((B=N[H])[0]+F*v,B[1]+F*v,B[2]+F*v)}r.addGroup(t,a.length/3-t,0)}(),function(){var t=a.length/3,e=0;for(h(U,e),e+=U.length,O=0,f=C.length;O<f;O++)h(I=C[O],e),e+=I.length;r.addGroup(t,a.length/3-t,1)}()}B.call(this),this.type="ExtrudeBufferGeometry",this.parameters={shapes:t,options:e},t=Array.isArray(t)?t:[t];for(var r=this,a=[],s=[],c=0,h=t.length;c<h;c++)i(t[c]);this.addAttribute("position",new I(a,3)),this.addAttribute("uv",new I(s,2)),this.computeVertexNormals()}function nn(t,e){E.call(this),this.type="TextGeometry",this.parameters={text:t,parameters:e},this.fromBufferGeometry(new rn(t,e)),this.mergeVertices()}function rn(t,e){var n=(e=e||{}).font;if(!n||!n.isFont)return console.error("THREE.TextGeometry: font parameter is not an instance of THREE.Font."),new E;t=n.generateShapes(t,e.size,e.curveSegments),e.amount=void 0!==e.height?e.height:50,void 0===e.bevelThickness&&(e.bevelThickness=10),void 0===e.bevelSize&&(e.bevelSize=8),void 0===e.bevelEnabled&&(e.bevelEnabled=!1),en.call(this,t,e),this.type="TextBufferGeometry"}function on(t,e,n,i,r,o,a){E.call(this),this.type="SphereGeometry",this.parameters={radius:t,widthSegments:e,heightSegments:n,phiStart:i,phiLength:r,thetaStart:o,thetaLength:a},this.fromBufferGeometry(new an(t,e,n,i,r,o,a)),this.mergeVertices()}function an(t,e,n,i,r,a,s){B.call(this),this.type="SphereBufferGeometry",this.parameters={radius:t,widthSegments:e,heightSegments:n,phiStart:i,phiLength:r,thetaStart:a,thetaLength:s},t=t||1,e=Math.max(3,Math.floor(e)||8),n=Math.max(2,Math.floor(n)||6),i=void 0!==i?i:0,r=void 0!==r?r:2*Math.PI;var c,h,l=(a=void 0!==a?a:0)+(s=void 0!==s?s:Math.PI),u=0,p=[],d=new o,f=new o,m=[],g=[],v=[],y=[];for(h=0;h<=n;h++){var x=[],b=h/n;for(c=0;c<=e;c++){var w=c/e;d.x=-t*Math.cos(i+w*r)*Math.sin(a+b*s),d.y=t*Math.cos(a+b*s),d.z=t*Math.sin(i+w*r)*Math.sin(a+b*s),g.push(d.x,d.y,d.z),f.set(d.x,d.y,d.z).normalize(),v.push(f.x,f.y,f.z),y.push(w,1-b),x.push(u++)}p.push(x)}for(h=0;h<n;h++)for(c=0;c<e;c++)t=p[h][c+1],i=p[h][c],r=p[h+1][c],s=p[h+1][c+1],(0!==h||0<a)&&m.push(t,i,s),(h!==n-1||l<Math.PI)&&m.push(i,r,s);this.setIndex(m),this.addAttribute("position",new I(g,3)),this.addAttribute("normal",new I(v,3)),this.addAttribute("uv",new I(y,2))}function sn(t,e,n,i,r,o){E.call(this),this.type="RingGeometry",this.parameters={innerRadius:t,outerRadius:e,thetaSegments:n,phiSegments:i,thetaStart:r,thetaLength:o},this.fromBufferGeometry(new cn(t,e,n,i,r,o)),this.mergeVertices()}function cn(t,e,i,r,a,s){B.call(this),this.type="RingBufferGeometry",this.parameters={innerRadius:t,outerRadius:e,thetaSegments:i,phiSegments:r,thetaStart:a,thetaLength:s},t=t||.5,e=e||1,a=void 0!==a?a:0,s=void 0!==s?s:2*Math.PI,i=void 0!==i?Math.max(3,i):8;var c,h,l=[],u=[],p=[],d=[],f=t,m=(e-t)/(r=void 0!==r?Math.max(1,r):1),g=new o,v=new n;for(c=0;c<=r;c++){for(h=0;h<=i;h++)t=a+h/i*s,g.x=f*Math.cos(t),g.y=f*Math.sin(t),u.push(g.x,g.y,g.z),p.push(0,0,1),v.x=(g.x/e+1)/2,v.y=(g.y/e+1)/2,d.push(v.x,v.y);f+=m}for(c=0;c<r;c++)for(e=c*(i+1),h=0;h<i;h++)a=(t=h+e)+i+1,s=t+i+2,f=t+1,l.push(t,a,f),l.push(a,s,f);this.setIndex(l),this.addAttribute("position",new I(u,3)),this.addAttribute("normal",new I(p,3)),this.addAttribute("uv",new I(d,2))}function hn(t,e,n,i){E.call(this),this.type="LatheGeometry",this.parameters={points:t,segments:e,phiStart:n,phiLength:i},this.fromBufferGeometry(new ln(t,e,n,i)),this.mergeVertices()}function ln(t,e,i,r){B.call(this),this.type="LatheBufferGeometry",this.parameters={points:t,segments:e,phiStart:i,phiLength:r},e=Math.floor(e)||12,i=i||0,r=r||2*Math.PI,r=Ar.clamp(r,0,2*Math.PI);var a,s=[],c=[],h=[],l=1/e,u=new o,p=new n;for(a=0;a<=e;a++){var d=i+a*l*r,f=Math.sin(d),m=Math.cos(d);for(d=0;d<=t.length-1;d++)u.x=t[d].x*f,u.y=t[d].y,u.z=t[d].x*m,c.push(u.x,u.y,u.z),p.x=a/e,p.y=d/(t.length-1),h.push(p.x,p.y)}for(a=0;a<e;a++)for(d=0;d<t.length-1;d++)l=(i=d+a*t.length)+t.length,u=i+t.length+1,p=i+1,s.push(i,l,p),s.push(l,u,p);if(this.setIndex(s),this.addAttribute("position",new I(c,3)),this.addAttribute("uv",new I(h,2)),this.computeVertexNormals(),r===2*Math.PI)for(r=this.attributes.normal.array,s=new o,c=new o,h=new o,i=e*t.length*3,d=a=0;a<t.length;a++,d+=3)s.x=r[d+0],s.y=r[d+1],s.z=r[d+2],c.x=r[i+d+0],c.y=r[i+d+1],c.z=r[i+d+2],h.addVectors(s,c).normalize(),r[d+0]=r[i+d+0]=h.x,r[d+1]=r[i+d+1]=h.y,r[d+2]=r[i+d+2]=h.z}function un(t,e){E.call(this),this.type="ShapeGeometry","object"==typeof e&&(console.warn("THREE.ShapeGeometry: Options parameter has been removed."),e=e.curveSegments),this.parameters={shapes:t,curveSegments:e},this.fromBufferGeometry(new pn(t,e)),this.mergeVertices()}function pn(t,e){function n(t){var n,s=r.length/3,h=(t=t.extractPoints(e)).shape,l=t.holes;if(!1===Yr.isClockWise(h))for(h=h.reverse(),t=0,n=l.length;t<n;t++){var u=l[t];!0===Yr.isClockWise(u)&&(l[t]=u.reverse())}var p=Yr.triangulateShape(h,l);for(t=0,n=l.length;t<n;t++)u=l[t],h=h.concat(u);for(t=0,n=h.length;t<n;t++)u=h[t],r.push(u.x,u.y,0),o.push(0,0,1),a.push(u.x,u.y);for(t=0,n=p.length;t<n;t++)h=p[t],i.push(h[0]+s,h[1]+s,h[2]+s),c+=3}B.call(this),this.type="ShapeBufferGeometry",this.parameters={shapes:t,curveSegments:e},e=e||12;var i=[],r=[],o=[],a=[],s=0,c=0;if(!1===Array.isArray(t))n(t);else for(var h=0;h<t.length;h++)n(t[h]),this.addGroup(s,c,h),s+=c,c=0;this.setIndex(i),this.addAttribute("position",new I(r,3)),this.addAttribute("normal",new I(o,3)),this.addAttribute("uv",new I(a,2))}function dn(t,e){if(e.shapes=[],Array.isArray(t))for(var n=0,i=t.length;n<i;n++)e.shapes.push(t[n].uuid);else e.shapes.push(t.uuid);return e}function fn(t,e){B.call(this),this.type="EdgesGeometry",this.parameters={thresholdAngle:e};var n=[];e=Math.cos(Ar.DEG2RAD*(void 0!==e?e:1));var i=[0,0],r={},o=["a","b","c"];if(t.isBufferGeometry){var a=new E;a.fromBufferGeometry(t)}else a=t.clone();a.mergeVertices(),a.computeFaceNormals(),t=a.vertices;for(var s=0,c=(a=a.faces).length;s<c;s++)for(var h=a[s],l=0;3>l;l++){var u=h[o[l]],p=h[o[(l+1)%3]];i[0]=Math.min(u,p),i[1]=Math.max(u,p),void 0===r[u=i[0]+","+i[1]]?r[u]={index1:i[0],index2:i[1],face1:s,face2:void 0}:r[u].face2=s}for(u in r)(void 0===(i=r[u]).face2||a[i.face1].normal.dot(a[i.face2].normal)<=e)&&(o=t[i.index1],n.push(o.x,o.y,o.z),o=t[i.index2],n.push(o.x,o.y,o.z));this.addAttribute("position",new I(n,3))}function mn(t,e,n,i,r,o,a,s){E.call(this),this.type="CylinderGeometry",this.parameters={radiusTop:t,radiusBottom:e,height:n,radialSegments:i,heightSegments:r,openEnded:o,thetaStart:a,thetaLength:s},this.fromBufferGeometry(new gn(t,e,n,i,r,o,a,s)),this.mergeVertices()}function gn(t,e,i,r,a,s,c,h){function l(i){var a,s=new n,l=new o,v=0,b=!0===i?t:e,w=!0===i?1:-1,_=g;for(a=1;a<=r;a++)d.push(0,y*w,0),f.push(0,w,0),m.push(.5,.5),g++;var M=g;for(a=0;a<=r;a++){var E=a/r*h+c,T=Math.cos(E);E=Math.sin(E),l.x=b*E,l.y=y*w,l.z=b*T,d.push(l.x,l.y,l.z),f.push(0,w,0),s.x=.5*T+.5,s.y=.5*E*w+.5,m.push(s.x,s.y),g++}for(a=0;a<r;a++)s=_+a,l=M+a,!0===i?p.push(l,l+1,s):p.push(l+1,l,s),v+=3;u.addGroup(x,v,!0===i?1:2),x+=v}B.call(this),this.type="CylinderBufferGeometry",this.parameters={radiusTop:t,radiusBottom:e,height:i,radialSegments:r,heightSegments:a,openEnded:s,thetaStart:c,thetaLength:h};var u=this;t=void 0!==t?t:1,e=void 0!==e?e:1,i=i||1,r=Math.floor(r)||8,a=Math.floor(a)||1,s=void 0!==s&&s,c=void 0!==c?c:0,h=void 0!==h?h:2*Math.PI;var p=[],d=[],f=[],m=[],g=0,v=[],y=i/2,x=0;!function(){var n,s,l=new o,b=new o,w=0,_=(e-t)/i;for(s=0;s<=a;s++){var M=[],E=s/a,T=E*(e-t)+t;for(n=0;n<=r;n++){var S=n/r,A=S*h+c,R=Math.sin(A);A=Math.cos(A),b.x=T*R,b.y=-E*i+y,b.z=T*A,d.push(b.x,b.y,b.z),l.set(R,_,A).normalize(),f.push(l.x,l.y,l.z),m.push(S,1-E),M.push(g++)}v.push(M)}for(n=0;n<r;n++)for(s=0;s<a;s++)l=v[s+1][n],b=v[s+1][n+1],_=v[s][n+1],p.push(v[s][n],l,_),p.push(l,b,_),w+=6;u.addGroup(x,w,0),x+=w}(),!1===s&&(0<t&&l(!0),0<e&&l(!1)),this.setIndex(p),this.addAttribute("position",new I(d,3)),this.addAttribute("normal",new I(f,3)),this.addAttribute("uv",new I(m,2))}function vn(t,e,n,i,r,o,a){mn.call(this,0,t,e,n,i,r,o,a),this.type="ConeGeometry",this.parameters={radius:t,height:e,radialSegments:n,heightSegments:i,openEnded:r,thetaStart:o,thetaLength:a}}function yn(t,e,n,i,r,o,a){gn.call(this,0,t,e,n,i,r,o,a),this.type="ConeBufferGeometry",this.parameters={radius:t,height:e,radialSegments:n,heightSegments:i,openEnded:r,thetaStart:o,thetaLength:a}}function xn(t,e,n,i){E.call(this),this.type="CircleGeometry",this.parameters={radius:t,segments:e,thetaStart:n,thetaLength:i},this.fromBufferGeometry(new bn(t,e,n,i)),this.mergeVertices()}function bn(t,e,i,r){B.call(this),this.type="CircleBufferGeometry",this.parameters={radius:t,segments:e,thetaStart:i,thetaLength:r},t=t||1,e=void 0!==e?Math.max(3,e):8,i=void 0!==i?i:0,r=void 0!==r?r:2*Math.PI;var a,s=[],c=[],h=[],l=[],u=new o,p=new n;c.push(0,0,0),h.push(0,0,1),l.push(.5,.5);var d=0;for(a=3;d<=e;d++,a+=3){var f=i+d/e*r;u.x=t*Math.cos(f),u.y=t*Math.sin(f),c.push(u.x,u.y,u.z),h.push(0,0,1),p.x=(c[a]/t+1)/2,p.y=(c[a+1]/t+1)/2,l.push(p.x,p.y)}for(a=1;a<=e;a++)s.push(a,a+1,0);this.setIndex(s),this.addAttribute("position",new I(c,3)),this.addAttribute("normal",new I(h,3)),this.addAttribute("uv",new I(l,2))}function wn(t){k.call(this),this.type="ShadowMaterial",this.color=new g(0),this.transparent=!0,this.setValues(t)}function _n(t){j.call(this,t),this.type="RawShaderMaterial"}function Mn(t){k.call(this),this.defines={STANDARD:""},this.type="MeshStandardMaterial",this.color=new g(16777215),this.metalness=this.roughness=.5,this.lightMap=this.map=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new g(0),this.emissiveIntensity=1,this.bumpMap=this.emissiveMap=null,this.bumpScale=1,this.normalMap=null,this.normalScale=new n(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.envMap=this.alphaMap=this.metalnessMap=this.roughnessMap=null,this.envMapIntensity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinejoin=this.wireframeLinecap="round",this.morphNormals=this.morphTargets=this.skinning=!1,this.setValues(t)}function En(t){Mn.call(this),this.defines={PHYSICAL:""},this.type="MeshPhysicalMaterial",this.reflectivity=.5,this.clearCoatRoughness=this.clearCoat=0,this.setValues(t)}function Tn(t){k.call(this),this.type="MeshPhongMaterial",this.color=new g(16777215),this.specular=new g(1118481),this.shininess=30,this.lightMap=this.map=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new g(0),this.emissiveIntensity=1,this.bumpMap=this.emissiveMap=null,this.bumpScale=1,this.normalMap=null,this.normalScale=new n(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.envMap=this.alphaMap=this.specularMap=null,this.combine=0,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinejoin=this.wireframeLinecap="round",this.morphNormals=this.morphTargets=this.skinning=!1,this.setValues(t)}function Sn(t){Tn.call(this),this.defines={TOON:""},this.type="MeshToonMaterial",this.gradientMap=null,this.setValues(t)}function An(t){k.call(this),this.type="MeshNormalMaterial",this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalScale=new n(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.wireframe=!1,this.wireframeLinewidth=1,this.morphNormals=this.morphTargets=this.skinning=this.lights=this.fog=!1,this.setValues(t)}function Rn(t){k.call(this),this.type="MeshLambertMaterial",this.color=new g(16777215),this.lightMap=this.map=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new g(0),this.emissiveIntensity=1,this.envMap=this.alphaMap=this.specularMap=this.emissiveMap=null,this.combine=0,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinejoin=this.wireframeLinecap="round",this.morphNormals=this.morphTargets=this.skinning=!1,this.setValues(t)}function Ln(t){ce.call(this),this.type="LineDashedMaterial",this.scale=1,this.dashSize=3,this.gapSize=1,this.setValues(t)}function Pn(t,e,n){var i=this,r=!1,o=0,a=0,s=void 0;this.onStart=void 0,this.onLoad=t,this.onProgress=e,this.onError=n,this.itemStart=function(t){a++,!1===r&&void 0!==i.onStart&&i.onStart(t,o,a),r=!0},this.itemEnd=function(t){o++,void 0!==i.onProgress&&i.onProgress(t,o,a),o===a&&(r=!1,void 0!==i.onLoad)&&i.onLoad()},this.itemError=function(t){void 0!==i.onError&&i.onError(t)},this.resolveURL=function(t){return s?s(t):t},this.setURLModifier=function(t){return s=t,this}}function Cn(t){this.manager=void 0!==t?t:$r}function On(t){this.manager=void 0!==t?t:$r,this._parser=null}function In(t){this.manager=void 0!==t?t:$r,this._parser=null}function Nn(t){this.manager=void 0!==t?t:$r}function Un(t){this.manager=void 0!==t?t:$r}function Dn(t){this.manager=void 0!==t?t:$r}function Bn(){this.type="Curve",this.arcLengthDivisions=200}function Fn(t,e,n,i,r,o,a,s){Bn.call(this),this.type="EllipseCurve",this.aX=t||0,this.aY=e||0,this.xRadius=n||1,this.yRadius=i||1,this.aStartAngle=r||0,this.aEndAngle=o||2*Math.PI,this.aClockwise=a||!1,this.aRotation=s||0}function zn(t,e,n,i,r,o){Fn.call(this,t,e,n,n,i,r,o),this.type="ArcCurve"}function Hn(){var t=0,e=0,n=0,i=0;return{initCatmullRom:function(r,o,a,s,c){t=o,e=r=c*(a-r),n=-3*o+3*a-2*r-(s=c*(s-o)),i=2*o-2*a+r+s},initNonuniformCatmullRom:function(r,o,a,s,c,h,l){t=o,e=r=((o-r)/c-(a-r)/(c+h)+(a-o)/h)*h,n=-3*o+3*a-2*r-(s=((a-o)/h-(s-o)/(h+l)+(s-a)/l)*h),i=2*o-2*a+r+s},calc:function(r){var o=r*r;return t+e*r+n*o+i*o*r}}}function Gn(t,e,n,i){Bn.call(this),this.type="CatmullRomCurve3",this.points=t||[],this.closed=e||!1,this.curveType=n||"centripetal",this.tension=i||.5}function kn(t,e,n,i,r){var o=t*t;return(2*n-2*i+(e=.5*(i-e))+(r=.5*(r-n)))*t*o+(-3*n+3*i-2*e-r)*o+e*t+n}function Vn(t,e,n,i){var r=1-t;return r*r*e+2*(1-t)*t*n+t*t*i}function jn(t,e,n,i,r){var o=1-t,a=1-t;return o*o*o*e+3*a*a*t*n+3*(1-t)*t*t*i+t*t*t*r}function Wn(t,e,i,r){Bn.call(this),this.type="CubicBezierCurve",this.v0=t||new n,this.v1=e||new n,this.v2=i||new n,this.v3=r||new n}function Xn(t,e,n,i){Bn.call(this),this.type="CubicBezierCurve3",this.v0=t||new o,this.v1=e||new o,this.v2=n||new o,this.v3=i||new o}function qn(t,e){Bn.call(this),this.type="LineCurve",this.v1=t||new n,this.v2=e||new n}function Yn(t,e){Bn.call(this),this.type="LineCurve3",this.v1=t||new o,this.v2=e||new o}function Zn(t,e,i){Bn.call(this),this.type="QuadraticBezierCurve",this.v0=t||new n,this.v1=e||new n,this.v2=i||new n}function Jn(t,e,n){Bn.call(this),this.type="QuadraticBezierCurve3",this.v0=t||new o,this.v1=e||new o,this.v2=n||new o}function Qn(t){Bn.call(this),this.type="SplineCurve",this.points=t||[]}function Kn(){Bn.call(this),this.type="CurvePath",this.curves=[],this.autoClose=!1}function $n(t){Kn.call(this),this.type="Path",this.currentPoint=new n,t&&this.setFromPoints(t)}function ti(t){$n.call(this,t),this.uuid=Ar.generateUUID(),this.type="Shape",this.holes=[]}function ei(t,e){b.call(this),this.type="Light",this.color=new g(t),this.intensity=void 0!==e?e:1,this.receiveShadow=void 0}function ni(t,e,n){ei.call(this,t,n),this.type="HemisphereLight",this.castShadow=void 0,this.position.copy(b.DefaultUp),this.updateMatrix(),this.groundColor=new g(e)}function ii(t){this.camera=t,this.bias=0,this.radius=1,this.mapSize=new n(512,512),this.map=null,this.matrix=new i}function ri(){ii.call(this,new Zt(50,1,.5,500))}function oi(t,e,n,i,r,o){ei.call(this,t,e),this.type="SpotLight",this.position.copy(b.DefaultUp),this.updateMatrix(),this.target=new b,Object.defineProperty(this,"power",{get:function(){return this.intensity*Math.PI},set:function(t){this.intensity=t/Math.PI}}),this.distance=void 0!==n?n:0,this.angle=void 0!==i?i:Math.PI/3,this.penumbra=void 0!==r?r:0,this.decay=void 0!==o?o:1,this.shadow=new ri}function ai(t,e,n,i){ei.call(this,t,e),this.type="PointLight",Object.defineProperty(this,"power",{get:function(){return 4*this.intensity*Math.PI},set:function(t){this.intensity=t/(4*Math.PI)}}),this.distance=void 0!==n?n:0,this.decay=void 0!==i?i:1,this.shadow=new ii(new Zt(90,1,.5,500))}function si(){ii.call(this,new _(-5,5,5,-5,.5,500))}function ci(t,e){ei.call(this,t,e),this.type="DirectionalLight",this.position.copy(b.DefaultUp),this.updateMatrix(),this.target=new b,this.shadow=new si}function hi(t,e){ei.call(this,t,e),this.type="AmbientLight",this.castShadow=void 0}function li(t,e,n,i){ei.call(this,t,e),this.type="RectAreaLight",this.width=void 0!==n?n:10,this.height=void 0!==i?i:10}function ui(t,e,n,i){wi.call(this,t,e,n,i)}function pi(t,e,n){wi.call(this,t,e,n)}function di(t,e,n,i){this.parameterPositions=t,this._cachedIndex=0,this.resultBuffer=void 0!==i?i:new e.constructor(n),this.sampleValues=e,this.valueSize=n}function fi(t,e,n,i){di.call(this,t,e,n,i)}function mi(t,e,n,i){wi.call(this,t,e,n,i)}function gi(t,e,n,i){wi.call(this,t,e,n,i)}function vi(t,e,n,i){wi.call(this,t,e,n,i)}function yi(t,e,n,i){di.call(this,t,e,n,i),this._offsetNext=this._weightNext=this._offsetPrev=this._weightPrev=-0}function xi(t,e,n,i){di.call(this,t,e,n,i)}function bi(t,e,n,i){di.call(this,t,e,n,i)}function wi(t,e,n,i){if(void 0===t)throw Error("THREE.KeyframeTrack: track name is undefined");if(void 0===e||0===e.length)throw Error("THREE.KeyframeTrack: no keyframes in track named "+t);this.name=t,this.times=ao.convertArray(e,this.TimeBufferType),this.values=ao.convertArray(n,this.ValueBufferType),this.setInterpolation(i||this.DefaultInterpolation),this.validate(),this.optimize()}function _i(t,e,n,i){wi.call(this,t,e,n,i)}function Mi(t,e,n){this.name=t,this.tracks=n,this.duration=void 0!==e?e:-1,this.uuid=Ar.generateUUID(),0>this.duration&&this.resetDuration(),this.optimize()}function Ei(t){this.manager=void 0!==t?t:$r,this.textures={}}function Ti(t){this.manager=void 0!==t?t:$r}function Si(){}function Ai(t){"boolean"==typeof t&&(console.warn("THREE.JSONLoader: showStatus parameter has been removed from constructor."),t=void 0),this.manager=void 0!==t?t:$r,this.withCredentials=!1}function Ri(t){this.manager=void 0!==t?t:$r,this.texturePath=""}function Li(t){"undefined"==typeof createImageBitmap&&console.warn("THREE.ImageBitmapLoader: createImageBitmap() not supported."),"undefined"==typeof fetch&&console.warn("THREE.ImageBitmapLoader: fetch() not supported."),this.manager=void 0!==t?t:$r,this.options=void 0}function Pi(){this.type="ShapePath",this.color=new g,this.subPaths=[],this.currentPath=null}function Ci(t){this.type="Font",this.data=t}function Oi(t){this.manager=void 0!==t?t:$r}function Ii(t){this.manager=void 0!==t?t:$r}function Ni(){this.type="StereoCamera",this.aspect=1,this.eyeSep=.064,this.cameraL=new Zt,this.cameraL.layers.enable(1),this.cameraL.matrixAutoUpdate=!1,this.cameraR=new Zt,this.cameraR.layers.enable(2),this.cameraR.matrixAutoUpdate=!1}function Ui(t,e,n){b.call(this),this.type="CubeCamera";var i=new Zt(90,1,t,e);i.up.set(0,-1,0),i.lookAt(new o(1,0,0)),this.add(i);var r=new Zt(90,1,t,e);r.up.set(0,-1,0),r.lookAt(new o(-1,0,0)),this.add(r);var a=new Zt(90,1,t,e);a.up.set(0,0,1),a.lookAt(new o(0,1,0)),this.add(a);var s=new Zt(90,1,t,e);s.up.set(0,0,-1),s.lookAt(new o(0,-1,0)),this.add(s);var c=new Zt(90,1,t,e);c.up.set(0,-1,0),c.lookAt(new o(0,0,1)),this.add(c);var h=new Zt(90,1,t,e);h.up.set(0,-1,0),h.lookAt(new o(0,0,-1)),this.add(h),this.renderTarget=new l(n,n,{format:1022,magFilter:1006,minFilter:1006}),this.renderTarget.texture.name="CubeCamera",this.update=function(t,e){null===this.parent&&this.updateMatrixWorld();var n=this.renderTarget,o=n.texture.generateMipmaps;n.texture.generateMipmaps=!1,n.activeCubeFace=0,t.render(e,i,n),n.activeCubeFace=1,t.render(e,r,n),n.activeCubeFace=2,t.render(e,a,n),n.activeCubeFace=3,t.render(e,s,n),n.activeCubeFace=4,t.render(e,c,n),n.texture.generateMipmaps=o,n.activeCubeFace=5,t.render(e,h,n),t.setRenderTarget(null)},this.clear=function(t,e,n,i){for(var r=this.renderTarget,o=0;6>o;o++)r.activeCubeFace=o,t.setRenderTarget(r),t.clear(e,n,i);t.setRenderTarget(null)}}function Di(){b.call(this),this.type="AudioListener",this.context=go.getContext(),this.gain=this.context.createGain(),this.gain.connect(this.context.destination),this.filter=null}function Bi(t){b.call(this),this.type="Audio",this.context=t.context,this.gain=this.context.createGain(),this.gain.connect(t.getInput()),this.autoplay=!1,this.buffer=null,this.loop=!1,this.offset=this.startTime=0,this.playbackRate=1,this.isPlaying=!1,this.hasPlaybackControl=!0,this.sourceType="empty",this.filters=[]}function Fi(t){Bi.call(this,t),this.panner=this.context.createPanner(),this.panner.connect(this.gain)}function zi(t,e){this.analyser=t.context.createAnalyser(),this.analyser.fftSize=void 0!==e?e:2048,this.data=new Uint8Array(this.analyser.frequencyBinCount),t.getOutput().connect(this.analyser)}function Hi(t,e,n){switch(this.binding=t,this.valueSize=n,t=Float64Array,e){case"quaternion":e=this._slerp;break;case"string":case"bool":t=Array,e=this._select;break;default:e=this._lerp}this.buffer=new t(4*n),this._mixBufferRegion=e,this.referenceCount=this.useCount=this.cumulativeWeight=0}function Gi(t,e,n){n=n||ki.parseTrackName(e),this._targetGroup=t,this._bindings=t.subscribe_(e,n)}function ki(t,e,n){this.path=e,this.parsedPath=n||ki.parseTrackName(e),this.node=ki.findNode(t,this.parsedPath.nodeName)||t,this.rootNode=t}function Vi(){this.uuid=Ar.generateUUID(),this._objects=Array.prototype.slice.call(arguments),this.nCachedObjects_=0;var t={};this._indicesByUUID=t;for(var e=0,n=arguments.length;e!==n;++e)t[arguments[e].uuid]=e;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 ji(t,e,n){this._mixer=t,this._clip=e,this._localRoot=n||null,e=(t=e.tracks).length,n=Array(e);for(var i={endingStart:2400,endingEnd:2400},r=0;r!==e;++r){var o=t[r].createInterpolant(null);n[r]=o,o.settings=i}this._interpolantSettings=i,this._interpolants=n,this._propertyBindings=Array(e),this._weightInterpolant=this._timeScaleInterpolant=this._byClipCacheIndex=this._cacheIndex=null,this.loop=2201,this._loopCount=-1,this._startTime=null,this.time=0,this._effectiveWeight=this.weight=this._effectiveTimeScale=this.timeScale=1,this.repetitions=1/0,this.paused=!1,this.enabled=!0,this.clampWhenFinished=!1,this.zeroSlopeAtEnd=this.zeroSlopeAtStart=!0}function Wi(t){this._root=t,this._initMemoryManager(),this.time=this._accuIndex=0,this.timeScale=1}function Xi(t,e){"string"==typeof t&&(console.warn("THREE.Uniform: Type parameter is no longer needed."),t=e),this.value=t}function qi(){B.call(this),this.type="InstancedBufferGeometry",this.maxInstancedCount=void 0}function Yi(t,e,n,i){this.data=t,this.itemSize=e,this.offset=n,this.normalized=!0===i}function Zi(t,e){this.array=t,this.stride=e,this.count=void 0!==t?t.length/e:0,this.dynamic=!1,this.updateRange={offset:0,count:-1},this.version=0}function Ji(t,e,n){Zi.call(this,t,e),this.meshPerAttribute=n||1}function Qi(t,e,n){T.call(this,t,e),this.meshPerAttribute=n||1}function Ki(t,e,n,i){this.ray=new W(t,e),this.near=n||0,this.far=i||1/0,this.params={Mesh:{},Line:{},LOD:{},Points:{threshold:1},Sprite:{}},Object.defineProperties(this.params,{PointCloud:{get:function(){return console.warn("THREE.Raycaster: params.PointCloud has been renamed to params.Points."),this.Points}}})}function $i(t,e){return t.distance-e.distance}function tr(t,e,n,i){if(!1!==t.visible&&(t.raycast(e,n),!0===i)){i=0;for(var r=(t=t.children).length;i<r;i++)tr(t[i],e,n,!0)}}function er(t){this.autoStart=void 0===t||t,this.elapsedTime=this.oldTime=this.startTime=0,this.running=!1}function nr(t,e,n){return this.radius=void 0!==t?t:1,this.phi=void 0!==e?e:0,this.theta=void 0!==n?n:0,this}function ir(t,e,n){return this.radius=void 0!==t?t:1,this.theta=void 0!==e?e:0,this.y=void 0!==n?n:0,this}function rr(t,e){this.min=void 0!==t?t:new n(1/0,1/0),this.max=void 0!==e?e:new n(-1/0,-1/0)}function or(t){b.call(this),this.material=t,this.render=function(){}}function ar(t,e,n,i){this.object=t,this.size=void 0!==e?e:1,t=void 0!==n?n:16711680,i=void 0!==i?i:1,e=0,(n=this.object.geometry)&&n.isGeometry?e=3*n.faces.length:n&&n.isBufferGeometry&&(e=n.attributes.normal.count),n=new B,e=new I(6*e,3),n.addAttribute("position",e),le.call(this,n,new ce({color:t,linewidth:i})),this.matrixAutoUpdate=!1,this.update()}function sr(t,e){b.call(this),this.light=t,this.light.updateMatrixWorld(),this.matrix=t.matrixWorld,this.matrixAutoUpdate=!1,this.color=e,t=new B,e=[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];for(var n=0,i=1;32>n;n++,i++){var r=n/32*Math.PI*2,o=i/32*Math.PI*2;e.push(Math.cos(r),Math.sin(r),1,Math.cos(o),Math.sin(o),1)}t.addAttribute("position",new I(e,3)),e=new ce({fog:!1}),this.cone=new le(t,e),this.add(this.cone),this.update()}function cr(t){for(var e=function t(e){var n=[];e&&e.isBone&&n.push(e);for(var i=0;i<e.children.length;i++)n.push.apply(n,t(e.children[i]));return n}(t),n=new B,i=[],r=[],o=new g(0,0,1),a=new g(0,1,0),s=0;s<e.length;s++){var c=e[s];c.parent&&c.parent.isBone&&(i.push(0,0,0),i.push(0,0,0),r.push(o.r,o.g,o.b),r.push(a.r,a.g,a.b))}n.addAttribute("position",new I(i,3)),n.addAttribute("color",new I(r,3)),i=new ce({vertexColors:2,depthTest:!1,depthWrite:!1,transparent:!0}),le.call(this,n,i),this.root=t,this.bones=e,this.matrix=t.matrixWorld,this.matrixAutoUpdate=!1}function hr(t,e,n){this.light=t,this.light.updateMatrixWorld(),this.color=n,t=new an(e,4,2),e=new V({wireframe:!0,fog:!1}),Y.call(this,t,e),this.matrix=this.light.matrixWorld,this.matrixAutoUpdate=!1,this.update()}function lr(t,e){b.call(this),this.light=t,this.light.updateMatrixWorld(),this.matrix=t.matrixWorld,this.matrixAutoUpdate=!1,this.color=e,t=new ce({fog:!1}),(e=new B).addAttribute("position",new T(new Float32Array(15),3)),this.line=new he(e,t),this.add(this.line),this.update()}function ur(t,e,n){b.call(this),this.light=t,this.light.updateMatrixWorld(),this.matrix=t.matrixWorld,this.matrixAutoUpdate=!1,this.color=n,(t=new Se(e)).rotateY(.5*Math.PI),this.material=new V({wireframe:!0,fog:!1}),void 0===this.color&&(this.material.vertexColors=2),e=t.getAttribute("position"),e=new Float32Array(3*e.count),t.addAttribute("color",new T(e,3)),this.add(new Y(t,this.material)),this.update()}function pr(t,e,n,i){t=t||10,e=e||10,n=new g(void 0!==n?n:4473924),i=new g(void 0!==i?i:8947848);var r=e/2,o=t/e,a=t/2;t=[];for(var s=[],c=0,h=0,l=-a;c<=e;c++,l+=o){t.push(-a,0,l,a,0,l),t.push(l,0,-a,l,0,a);var u=c===r?n:i;u.toArray(s,h),h+=3,u.toArray(s,h),h+=3,u.toArray(s,h),h+=3,u.toArray(s,h),h+=3}(e=new B).addAttribute("position",new I(t,3)),e.addAttribute("color",new I(s,3)),n=new ce({vertexColors:2}),le.call(this,e,n)}function dr(t,e,n,i,r,o){t=t||10,e=e||16,n=n||8,i=i||64,r=new g(void 0!==r?r:4473924),o=new g(void 0!==o?o:8947848);var a,s=[],c=[];for(a=0;a<=e;a++){var h=a/e*2*Math.PI,l=Math.sin(h)*t;h=Math.cos(h)*t,s.push(0,0,0),s.push(l,0,h);var u=1&a?r:o;c.push(u.r,u.g,u.b),c.push(u.r,u.g,u.b)}for(a=0;a<=n;a++){u=1&a?r:o;var p=t-t/n*a;for(e=0;e<i;e++)h=e/i*2*Math.PI,l=Math.sin(h)*p,h=Math.cos(h)*p,s.push(l,0,h),c.push(u.r,u.g,u.b),h=(e+1)/i*2*Math.PI,l=Math.sin(h)*p,h=Math.cos(h)*p,s.push(l,0,h),c.push(u.r,u.g,u.b)}(t=new B).addAttribute("position",new I(s,3)),t.addAttribute("color",new I(c,3)),s=new ce({vertexColors:2}),le.call(this,t,s)}function fr(t,e,n,i){this.object=t,this.size=void 0!==e?e:1,t=void 0!==n?n:16776960,i=void 0!==i?i:1,e=0,(n=this.object.geometry)&&n.isGeometry?e=n.faces.length:console.warn("THREE.FaceNormalsHelper: only THREE.Geometry is supported. Use THREE.VertexNormalsHelper, instead."),n=new B,e=new I(6*e,3),n.addAttribute("position",e),le.call(this,n,new ce({color:t,linewidth:i})),this.matrixAutoUpdate=!1,this.update()}function mr(t,e,n){b.call(this),this.light=t,this.light.updateMatrixWorld(),this.matrix=t.matrixWorld,this.matrixAutoUpdate=!1,this.color=n,void 0===e&&(e=1),(t=new B).addAttribute("position",new I([-e,e,0,e,e,0,e,-e,0,-e,-e,0,-e,e,0],3)),e=new ce({fog:!1}),this.lightPlane=new he(t,e),this.add(this.lightPlane),(t=new B).addAttribute("position",new I([0,0,0,0,0,1],3)),this.targetLine=new he(t,e),this.add(this.targetLine),this.update()}function gr(t){function e(t,e,i){n(t,i),n(e,i)}function n(t,e){o.push(0,0,0),a.push(e.r,e.g,e.b),void 0===s[t]&&(s[t]=[]),s[t].push(o.length/3-1)}var i=new B,r=new ce({color:16777215,vertexColors:1}),o=[],a=[],s={},c=new g(16755200),h=new g(16711680),l=new g(43775),u=new g(16777215),p=new g(3355443);e("n1","n2",c),e("n2","n4",c),e("n4","n3",c),e("n3","n1",c),e("f1","f2",c),e("f2","f4",c),e("f4","f3",c),e("f3","f1",c),e("n1","f1",c),e("n2","f2",c),e("n3","f3",c),e("n4","f4",c),e("p","n1",h),e("p","n2",h),e("p","n3",h),e("p","n4",h),e("u1","u2",l),e("u2","u3",l),e("u3","u1",l),e("c","t",u),e("p","c",p),e("cn1","cn2",p),e("cn3","cn4",p),e("cf1","cf2",p),e("cf3","cf4",p),i.addAttribute("position",new I(o,3)),i.addAttribute("color",new I(a,3)),le.call(this,i,r),this.camera=t,this.camera.updateProjectionMatrix&&this.camera.updateProjectionMatrix(),this.matrix=t.matrixWorld,this.matrixAutoUpdate=!1,this.pointMap=s,this.update()}function vr(t,e){this.object=t,void 0===e&&(e=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]);var n=new Float32Array(24),i=new B;i.setIndex(new T(t,1)),i.addAttribute("position",new T(n,3)),le.call(this,i,new ce({color:e})),this.matrixAutoUpdate=!1,this.update()}function yr(t,e){this.type="Box3Helper",this.box=t,t=void 0!==e?e:16776960,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]);var n=new B;n.setIndex(new T(e,1)),n.addAttribute("position",new I([1,1,1,-1,1,1,-1,-1,1,1,-1,1,1,1,-1,-1,1,-1,-1,-1,-1,1,-1,-1],3)),le.call(this,n,new ce({color:t})),this.geometry.computeBoundingSphere()}function xr(t,e,n){this.type="PlaneHelper",this.plane=t,this.size=void 0===e?1:e,t=void 0!==n?n:16776960,(e=new B).addAttribute("position",new I([1,-1,1,-1,1,1,-1,-1,1,1,1,1,-1,1,1,-1,-1,1,1,-1,1,1,1,1,0,0,1,0,0,0],3)),e.computeBoundingSphere(),he.call(this,e,new ce({color:t})),(e=new B).addAttribute("position",new I([1,1,1,-1,1,1,-1,-1,1,1,1,1,-1,-1,1,1,-1,1],3)),e.computeBoundingSphere(),this.add(new Y(e,new V({color:t,opacity:.2,transparent:!0,depthWrite:!1})))}function br(t,e,n,i,r,o){b.call(this),void 0===i&&(i=16776960),void 0===n&&(n=1),void 0===r&&(r=.2*n),void 0===o&&(o=.2*r),void 0===fo&&((fo=new B).addAttribute("position",new I([0,0,0,0,1,0],3)),(mo=new gn(0,.5,1,5,1)).translate(0,-.5,0)),this.position.copy(e),this.line=new he(fo,new ce({color:i})),this.line.matrixAutoUpdate=!1,this.add(this.line),this.cone=new Y(mo,new V({color:i})),this.cone.matrixAutoUpdate=!1,this.add(this.cone),this.setDirection(t),this.setLength(n,r,o)}function wr(t){var e=[0,0,0,t=t||1,0,0,0,0,0,0,t,0,0,0,0,0,0,t];(t=new B).addAttribute("position",new I(e,3)),t.addAttribute("color",new I([1,0,0,1,.6,0,0,1,0,.6,1,0,0,0,1,0,.6,1],3)),e=new ce({vertexColors:2}),le.call(this,t,e)}function _r(t){console.warn("THREE.ClosedSplineCurve3 has been deprecated. Use THREE.CatmullRomCurve3 instead."),Gn.call(this,t),this.type="catmullrom",this.closed=!0}function Mr(t){console.warn("THREE.SplineCurve3 has been deprecated. Use THREE.CatmullRomCurve3 instead."),Gn.call(this,t),this.type="catmullrom"}function Er(t){console.warn("THREE.Spline has been removed. Use THREE.CatmullRomCurve3 instead."),Gn.call(this,t),this.type="catmullrom"}void 0===Number.EPSILON&&(Number.EPSILON=Math.pow(2,-52)),void 0===Number.isInteger&&(Number.isInteger=function(t){return"number"==typeof t&&isFinite(t)&&Math.floor(t)===t}),void 0===Math.sign&&(Math.sign=function(t){return 0>t?-1:0<t?1:+t}),!1=="name"in Function.prototype&&Object.defineProperty(Function.prototype,"name",{get:function(){return this.toString().match(/^\s*function\s*([^\(\s]*)/)[1]}}),void 0===Object.assign&&(Object.assign=function(t){if(null==t)throw new TypeError("Cannot convert undefined or null to object");for(var e=Object(t),n=1;n<arguments.length;n++){var i=arguments[n];if(null!=i)for(var r in i)Object.prototype.hasOwnProperty.call(i,r)&&(e[r]=i[r])}return e}),Object.assign(e.prototype,{addEventListener:function(t,e){void 0===this._listeners&&(this._listeners={});var n=this._listeners;void 0===n[t]&&(n[t]=[]),-1===n[t].indexOf(e)&&n[t].push(e)},hasEventListener:function(t,e){if(void 0===this._listeners)return!1;var n=this._listeners;return void 0!==n[t]&&-1!==n[t].indexOf(e)},removeEventListener:function(t,e){void 0!==this._listeners&&(void 0!==(t=this._listeners[t])&&(-1!==(e=t.indexOf(e))&&t.splice(e,1)))},dispatchEvent:function(t){if(void 0!==this._listeners){var e=this._listeners[t.type];if(void 0!==e){t.target=this;for(var n=0,i=(e=e.slice(0)).length;n<i;n++)e[n].call(this,t)}}}});var Tr,Sr,Ar={DEG2RAD:Math.PI/180,RAD2DEG:180/Math.PI,generateUUID:function(){for(var t=[],e=0;256>e;e++)t[e]=(16>e?"0":"")+e.toString(16);return function(){var e=4294967295*Math.random()|0,n=4294967295*Math.random()|0,i=4294967295*Math.random()|0,r=4294967295*Math.random()|0;return(t[255&e]+t[e>>8&255]+t[e>>16&255]+t[e>>24&255]+"-"+t[255&n]+t[n>>8&255]+"-"+t[n>>16&15|64]+t[n>>24&255]+"-"+t[63&i|128]+t[i>>8&255]+"-"+t[i>>16&255]+t[i>>24&255]+t[255&r]+t[r>>8&255]+t[r>>16&255]+t[r>>24&255]).toUpperCase()}}(),clamp:function(t,e,n){return Math.max(e,Math.min(n,t))},euclideanModulo:function(t,e){return(t%e+e)%e},mapLinear:function(t,e,n,i,r){return i+(t-e)*(r-i)/(n-e)},lerp:function(t,e,n){return(1-n)*t+n*e},smoothstep:function(t,e,n){return t<=e?0:t>=n?1:(t=(t-e)/(n-e))*t*(3-2*t)},smootherstep:function(t,e,n){return t<=e?0:t>=n?1:(t=(t-e)/(n-e))*t*t*(t*(6*t-15)+10)},randInt:function(t,e){return t+Math.floor(Math.random()*(e-t+1))},randFloat:function(t,e){return t+Math.random()*(e-t)},randFloatSpread:function(t){return t*(.5-Math.random())},degToRad:function(t){return t*Ar.DEG2RAD},radToDeg:function(t){return t*Ar.RAD2DEG},isPowerOfTwo:function(t){return 0==(t&t-1)&&0!==t},ceilPowerOfTwo:function(t){return Math.pow(2,Math.ceil(Math.log(t)/Math.LN2))},floorPowerOfTwo:function(t){return Math.pow(2,Math.floor(Math.log(t)/Math.LN2))}};Object.defineProperties(n.prototype,{width:{get:function(){return this.x},set:function(t){this.x=t}},height:{get:function(){return this.y},set:function(t){this.y=t}}}),Object.assign(n.prototype,{isVector2:!0,set:function(t,e){return this.x=t,this.y=e,this},setScalar:function(t){return this.y=this.x=t,this},setX:function(t){return this.x=t,this},setY:function(t){return this.y=t,this},setComponent:function(t,e){switch(t){case 0:this.x=e;break;case 1:this.y=e;break;default:throw Error("index is out of range: "+t)}return this},getComponent:function(t){switch(t){case 0:return this.x;case 1:return this.y;default:throw Error("index is out of range: "+t)}},clone:function(){return new this.constructor(this.x,this.y)},copy:function(t){return this.x=t.x,this.y=t.y,this},add:function(t,e){return void 0!==e?(console.warn("THREE.Vector2: .add() now only accepts one argument. Use .addVectors( a, b ) instead."),this.addVectors(t,e)):(this.x+=t.x,this.y+=t.y,this)},addScalar:function(t){return this.x+=t,this.y+=t,this},addVectors:function(t,e){return this.x=t.x+e.x,this.y=t.y+e.y,this},addScaledVector:function(t,e){return this.x+=t.x*e,this.y+=t.y*e,this},sub:function(t,e){return void 0!==e?(console.warn("THREE.Vector2: .sub() now only accepts one argument. Use .subVectors( a, b ) instead."),this.subVectors(t,e)):(this.x-=t.x,this.y-=t.y,this)},subScalar:function(t){return this.x-=t,this.y-=t,this},subVectors:function(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this},multiply:function(t){return this.x*=t.x,this.y*=t.y,this},multiplyScalar:function(t){return this.x*=t,this.y*=t,this},divide:function(t){return this.x/=t.x,this.y/=t.y,this},divideScalar:function(t){return this.multiplyScalar(1/t)},applyMatrix3:function(t){var e=this.x,n=this.y;return t=t.elements,this.x=t[0]*e+t[3]*n+t[6],this.y=t[1]*e+t[4]*n+t[7],this},min:function(t){return this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y),this},max:function(t){return this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y),this},clamp:function(t,e){return this.x=Math.max(t.x,Math.min(e.x,this.x)),this.y=Math.max(t.y,Math.min(e.y,this.y)),this},clampScalar:(Tr=new n,Sr=new n,function(t,e){return Tr.set(t,t),Sr.set(e,e),this.clamp(Tr,Sr)}),clampLength:function(t,e){var n=this.length();return this.divideScalar(n||1).multiplyScalar(Math.max(t,Math.min(e,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=0>this.x?Math.ceil(this.x):Math.floor(this.x),this.y=0>this.y?Math.ceil(this.y):Math.floor(this.y),this},negate:function(){return this.x=-this.x,this.y=-this.y,this},dot:function(t){return this.x*t.x+this.y*t.y},lengthSq:function(){return this.x*this.x+this.y*this.y},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y)},manhattanLength:function(){return Math.abs(this.x)+Math.abs(this.y)},normalize:function(){return this.divideScalar(this.length()||1)},angle:function(){var t=Math.atan2(this.y,this.x);return 0>t&&(t+=2*Math.PI),t},distanceTo:function(t){return Math.sqrt(this.distanceToSquared(t))},distanceToSquared:function(t){var e=this.x-t.x;return e*e+(t=this.y-t.y)*t},manhattanDistanceTo:function(t){return Math.abs(this.x-t.x)+Math.abs(this.y-t.y)},setLength:function(t){return this.normalize().multiplyScalar(t)},lerp:function(t,e){return this.x+=(t.x-this.x)*e,this.y+=(t.y-this.y)*e,this},lerpVectors:function(t,e,n){return this.subVectors(e,t).multiplyScalar(n).add(t)},equals:function(t){return t.x===this.x&&t.y===this.y},fromArray:function(t,e){return void 0===e&&(e=0),this.x=t[e],this.y=t[e+1],this},toArray:function(t,e){return void 0===t&&(t=[]),void 0===e&&(e=0),t[e]=this.x,t[e+1]=this.y,t},fromBufferAttribute:function(t,e,n){return void 0!==n&&console.warn("THREE.Vector2: offset has been removed from .fromBufferAttribute()."),this.x=t.getX(e),this.y=t.getY(e),this},rotateAround:function(t,e){var n=Math.cos(e);e=Math.sin(e);var i=this.x-t.x,r=this.y-t.y;return this.x=i*n-r*e+t.x,this.y=i*e+r*n+t.y,this}}),Object.assign(i.prototype,{isMatrix4:!0,set:function(t,e,n,i,r,o,a,s,c,h,l,u,p,d,f,m){var g=this.elements;return g[0]=t,g[4]=e,g[8]=n,g[12]=i,g[1]=r,g[5]=o,g[9]=a,g[13]=s,g[2]=c,g[6]=h,g[10]=l,g[14]=u,g[3]=p,g[7]=d,g[11]=f,g[15]=m,this},identity:function(){return this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1),this},clone:function(){return(new i).fromArray(this.elements)},copy:function(t){var e=this.elements;return t=t.elements,e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e[4]=t[4],e[5]=t[5],e[6]=t[6],e[7]=t[7],e[8]=t[8],e[9]=t[9],e[10]=t[10],e[11]=t[11],e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15],this},copyPosition:function(t){var e=this.elements;return t=t.elements,e[12]=t[12],e[13]=t[13],e[14]=t[14],this},extractBasis:function(t,e,n){return t.setFromMatrixColumn(this,0),e.setFromMatrixColumn(this,1),n.setFromMatrixColumn(this,2),this},makeBasis:function(t,e,n){return this.set(t.x,e.x,n.x,0,t.y,e.y,n.y,0,t.z,e.z,n.z,0,0,0,0,1),this},extractRotation:function(){var t=new o;return function(e){var n=this.elements,i=e.elements,r=1/t.setFromMatrixColumn(e,0).length(),o=1/t.setFromMatrixColumn(e,1).length();return e=1/t.setFromMatrixColumn(e,2).length(),n[0]=i[0]*r,n[1]=i[1]*r,n[2]=i[2]*r,n[4]=i[4]*o,n[5]=i[5]*o,n[6]=i[6]*o,n[8]=i[8]*e,n[9]=i[9]*e,n[10]=i[10]*e,this}}(),makeRotationFromEuler:function(t){t&&t.isEuler||console.error("THREE.Matrix4: .makeRotationFromEuler() now expects a Euler rotation rather than a Vector3 and order.");var e=this.elements,n=t.x,i=t.y,r=t.z,o=Math.cos(n);n=Math.sin(n);var a=Math.cos(i);i=Math.sin(i);var s=Math.cos(r);if(r=Math.sin(r),"XYZ"===t.order){t=o*s;var c=o*r,h=n*s,l=n*r;e[0]=a*s,e[4]=-a*r,e[8]=i,e[1]=c+h*i,e[5]=t-l*i,e[9]=-n*a,e[2]=l-t*i,e[6]=h+c*i,e[10]=o*a}else"YXZ"===t.order?(t=a*s,c=a*r,h=i*s,l=i*r,e[0]=t+l*n,e[4]=h*n-c,e[8]=o*i,e[1]=o*r,e[5]=o*s,e[9]=-n,e[2]=c*n-h,e[6]=l+t*n,e[10]=o*a):"ZXY"===t.order?(t=a*s,c=a*r,h=i*s,l=i*r,e[0]=t-l*n,e[4]=-o*r,e[8]=h+c*n,e[1]=c+h*n,e[5]=o*s,e[9]=l-t*n,e[2]=-o*i,e[6]=n,e[10]=o*a):"ZYX"===t.order?(t=o*s,c=o*r,h=n*s,l=n*r,e[0]=a*s,e[4]=h*i-c,e[8]=t*i+l,e[1]=a*r,e[5]=l*i+t,e[9]=c*i-h,e[2]=-i,e[6]=n*a,e[10]=o*a):"YZX"===t.order?(t=o*a,c=o*i,h=n*a,l=n*i,e[0]=a*s,e[4]=l-t*r,e[8]=h*r+c,e[1]=r,e[5]=o*s,e[9]=-n*s,e[2]=-i*s,e[6]=c*r+h,e[10]=t-l*r):"XZY"===t.order&&(t=o*a,c=o*i,h=n*a,l=n*i,e[0]=a*s,e[4]=-r,e[8]=i*s,e[1]=t*r+l,e[5]=o*s,e[9]=c*r-h,e[2]=h*r-c,e[6]=n*s,e[10]=l*r+t);return e[3]=0,e[7]=0,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,this},makeRotationFromQuaternion:function(t){var e=this.elements,n=t._x,i=t._y,r=t._z,o=t._w,a=n+n,s=i+i,c=r+r;t=n*a;var h=n*s;n*=c;var l=i*s;return i*=c,r*=c,a*=o,s*=o,o*=c,e[0]=1-(l+r),e[4]=h-o,e[8]=n+s,e[1]=h+o,e[5]=1-(t+r),e[9]=i-a,e[2]=n-s,e[6]=i+a,e[10]=1-(t+l),e[3]=0,e[7]=0,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,this},lookAt:function(){var t=new o,e=new o,n=new o;return function(i,r,o){var a=this.elements;return n.subVectors(i,r),0===n.lengthSq()&&(n.z=1),n.normalize(),t.crossVectors(o,n),0===t.lengthSq()&&(1===Math.abs(o.z)?n.x+=1e-4:n.z+=1e-4,n.normalize(),t.crossVectors(o,n)),t.normalize(),e.crossVectors(n,t),a[0]=t.x,a[4]=e.x,a[8]=n.x,a[1]=t.y,a[5]=e.y,a[9]=n.y,a[2]=t.z,a[6]=e.z,a[10]=n.z,this}}(),multiply:function(t,e){return void 0!==e?(console.warn("THREE.Matrix4: .multiply() now only accepts one argument. Use .multiplyMatrices( a, b ) instead."),this.multiplyMatrices(t,e)):this.multiplyMatrices(this,t)},premultiply:function(t){return this.multiplyMatrices(t,this)},multiplyMatrices:function(t,e){var n=t.elements,i=e.elements;e=this.elements,t=n[0];var r=n[4],o=n[8],a=n[12],s=n[1],c=n[5],h=n[9],l=n[13],u=n[2],p=n[6],d=n[10],f=n[14],m=n[3],g=n[7],v=n[11];n=n[15];var y=i[0],x=i[4],b=i[8],w=i[12],_=i[1],M=i[5],E=i[9],T=i[13],S=i[2],A=i[6],R=i[10],L=i[14],P=i[3],C=i[7],O=i[11];return i=i[15],e[0]=t*y+r*_+o*S+a*P,e[4]=t*x+r*M+o*A+a*C,e[8]=t*b+r*E+o*R+a*O,e[12]=t*w+r*T+o*L+a*i,e[1]=s*y+c*_+h*S+l*P,e[5]=s*x+c*M+h*A+l*C,e[9]=s*b+c*E+h*R+l*O,e[13]=s*w+c*T+h*L+l*i,e[2]=u*y+p*_+d*S+f*P,e[6]=u*x+p*M+d*A+f*C,e[10]=u*b+p*E+d*R+f*O,e[14]=u*w+p*T+d*L+f*i,e[3]=m*y+g*_+v*S+n*P,e[7]=m*x+g*M+v*A+n*C,e[11]=m*b+g*E+v*R+n*O,e[15]=m*w+g*T+v*L+n*i,this},multiplyScalar:function(t){var e=this.elements;return e[0]*=t,e[4]*=t,e[8]*=t,e[12]*=t,e[1]*=t,e[5]*=t,e[9]*=t,e[13]*=t,e[2]*=t,e[6]*=t,e[10]*=t,e[14]*=t,e[3]*=t,e[7]*=t,e[11]*=t,e[15]*=t,this},applyToBufferAttribute:function(){var t=new o;return function(e){for(var n=0,i=e.count;n<i;n++)t.x=e.getX(n),t.y=e.getY(n),t.z=e.getZ(n),t.applyMatrix4(this),e.setXYZ(n,t.x,t.y,t.z);return e}}(),determinant:function(){var t=this.elements,e=t[0],n=t[4],i=t[8],r=t[12],o=t[1],a=t[5],s=t[9],c=t[13],h=t[2],l=t[6],u=t[10],p=t[14];return t[3]*(+r*s*l-i*c*l-r*a*u+n*c*u+i*a*p-n*s*p)+t[7]*(+e*s*p-e*c*u+r*o*u-i*o*p+i*c*h-r*s*h)+t[11]*(+e*c*l-e*a*p-r*o*l+n*o*p+r*a*h-n*c*h)+t[15]*(-i*a*h-e*s*l+e*a*u+i*o*l-n*o*u+n*s*h)},transpose:function(){var t=this.elements,e=t[1];return t[1]=t[4],t[4]=e,e=t[2],t[2]=t[8],t[8]=e,e=t[6],t[6]=t[9],t[9]=e,e=t[3],t[3]=t[12],t[12]=e,e=t[7],t[7]=t[13],t[13]=e,e=t[11],t[11]=t[14],t[14]=e,this},setPosition:function(t){var e=this.elements;return e[12]=t.x,e[13]=t.y,e[14]=t.z,this},getInverse:function(t,e){var n=this.elements,i=t.elements;t=i[0];var r=i[1],o=i[2],a=i[3],s=i[4],c=i[5],h=i[6],l=i[7],u=i[8],p=i[9],d=i[10],f=i[11],m=i[12],g=i[13],v=i[14],y=p*v*l-g*d*l+g*h*f-c*v*f-p*h*(i=i[15])+c*d*i,x=m*d*l-u*v*l-m*h*f+s*v*f+u*h*i-s*d*i,b=u*g*l-m*p*l+m*c*f-s*g*f-u*c*i+s*p*i,w=m*p*h-u*g*h-m*c*d+s*g*d+u*c*v-s*p*v,_=t*y+r*x+o*b+a*w;if(0===_){if(!0===e)throw Error("THREE.Matrix4: .getInverse() can't invert matrix, determinant is 0");return console.warn("THREE.Matrix4: .getInverse() can't invert matrix, determinant is 0"),this.identity()}return e=1/_,n[0]=y*e,n[1]=(g*d*a-p*v*a-g*o*f+r*v*f+p*o*i-r*d*i)*e,n[2]=(c*v*a-g*h*a+g*o*l-r*v*l-c*o*i+r*h*i)*e,n[3]=(p*h*a-c*d*a-p*o*l+r*d*l+c*o*f-r*h*f)*e,n[4]=x*e,n[5]=(u*v*a-m*d*a+m*o*f-t*v*f-u*o*i+t*d*i)*e,n[6]=(m*h*a-s*v*a-m*o*l+t*v*l+s*o*i-t*h*i)*e,n[7]=(s*d*a-u*h*a+u*o*l-t*d*l-s*o*f+t*h*f)*e,n[8]=b*e,n[9]=(m*p*a-u*g*a-m*r*f+t*g*f+u*r*i-t*p*i)*e,n[10]=(s*g*a-m*c*a+m*r*l-t*g*l-s*r*i+t*c*i)*e,n[11]=(u*c*a-s*p*a-u*r*l+t*p*l+s*r*f-t*c*f)*e,n[12]=w*e,n[13]=(u*g*o-m*p*o+m*r*d-t*g*d-u*r*v+t*p*v)*e,n[14]=(m*c*o-s*g*o-m*r*h+t*g*h+s*r*v-t*c*v)*e,n[15]=(s*p*o-u*c*o+u*r*h-t*p*h-s*r*d+t*c*d)*e,this},scale:function(t){var e=this.elements,n=t.x,i=t.y;return t=t.z,e[0]*=n,e[4]*=i,e[8]*=t,e[1]*=n,e[5]*=i,e[9]*=t,e[2]*=n,e[6]*=i,e[10]*=t,e[3]*=n,e[7]*=i,e[11]*=t,this},getMaxScaleOnAxis:function(){var t=this.elements;return Math.sqrt(Math.max(t[0]*t[0]+t[1]*t[1]+t[2]*t[2],t[4]*t[4]+t[5]*t[5]+t[6]*t[6],t[8]*t[8]+t[9]*t[9]+t[10]*t[10]))},makeTranslation:function(t,e,n){return this.set(1,0,0,t,0,1,0,e,0,0,1,n,0,0,0,1),this},makeRotationX:function(t){var e=Math.cos(t);return t=Math.sin(t),this.set(1,0,0,0,0,e,-t,0,0,t,e,0,0,0,0,1),this},makeRotationY:function(t){var e=Math.cos(t);return t=Math.sin(t),this.set(e,0,t,0,0,1,0,0,-t,0,e,0,0,0,0,1),this},makeRotationZ:function(t){var e=Math.cos(t);return t=Math.sin(t),this.set(e,-t,0,0,t,e,0,0,0,0,1,0,0,0,0,1),this},makeRotationAxis:function(t,e){var n=Math.cos(e);e=Math.sin(e);var i=1-n,r=t.x,o=t.y;t=t.z;var a=i*r,s=i*o;return this.set(a*r+n,a*o-e*t,a*t+e*o,0,a*o+e*t,s*o+n,s*t-e*r,0,a*t-e*o,s*t+e*r,i*t*t+n,0,0,0,0,1),this},makeScale:function(t,e,n){return this.set(t,0,0,0,0,e,0,0,0,0,n,0,0,0,0,1),this},makeShear:function(t,e,n){return this.set(1,e,n,0,t,1,n,0,t,e,1,0,0,0,0,1),this},compose:function(t,e,n){return this.makeRotationFromQuaternion(e),this.scale(n),this.setPosition(t),this},decompose:function(){var t=new o,e=new i;return function(n,i,r){var o=this.elements,a=t.set(o[0],o[1],o[2]).length(),s=t.set(o[4],o[5],o[6]).length(),c=t.set(o[8],o[9],o[10]).length();0>this.determinant()&&(a=-a),n.x=o[12],n.y=o[13],n.z=o[14],e.copy(this),n=1/a,o=1/s;var h=1/c;return e.elements[0]*=n,e.elements[1]*=n,e.elements[2]*=n,e.elements[4]*=o,e.elements[5]*=o,e.elements[6]*=o,e.elements[8]*=h,e.elements[9]*=h,e.elements[10]*=h,i.setFromRotationMatrix(e),r.x=a,r.y=s,r.z=c,this}}(),makePerspective:function(t,e,n,i,r,o){void 0===o&&console.warn("THREE.Matrix4: .makePerspective() has been redefined and has a new signature. Please check the docs.");var a=this.elements;return a[0]=2*r/(e-t),a[4]=0,a[8]=(e+t)/(e-t),a[12]=0,a[1]=0,a[5]=2*r/(n-i),a[9]=(n+i)/(n-i),a[13]=0,a[2]=0,a[6]=0,a[10]=-(o+r)/(o-r),a[14]=-2*o*r/(o-r),a[3]=0,a[7]=0,a[11]=-1,a[15]=0,this},makeOrthographic:function(t,e,n,i,r,o){var a=this.elements,s=1/(e-t),c=1/(n-i),h=1/(o-r);return a[0]=2*s,a[4]=0,a[8]=0,a[12]=-(e+t)*s,a[1]=0,a[5]=2*c,a[9]=0,a[13]=-(n+i)*c,a[2]=0,a[6]=0,a[10]=-2*h,a[14]=-(o+r)*h,a[3]=0,a[7]=0,a[11]=0,a[15]=1,this},equals:function(t){var e=this.elements;t=t.elements;for(var n=0;16>n;n++)if(e[n]!==t[n])return!1;return!0},fromArray:function(t,e){void 0===e&&(e=0);for(var n=0;16>n;n++)this.elements[n]=t[n+e];return this},toArray:function(t,e){void 0===t&&(t=[]),void 0===e&&(e=0);var n=this.elements;return t[e]=n[0],t[e+1]=n[1],t[e+2]=n[2],t[e+3]=n[3],t[e+4]=n[4],t[e+5]=n[5],t[e+6]=n[6],t[e+7]=n[7],t[e+8]=n[8],t[e+9]=n[9],t[e+10]=n[10],t[e+11]=n[11],t[e+12]=n[12],t[e+13]=n[13],t[e+14]=n[14],t[e+15]=n[15],t}}),Object.assign(r,{slerp:function(t,e,n,i){return n.copy(t).slerp(e,i)},slerpFlat:function(t,e,n,i,r,o,a){var s=n[i+0],c=n[i+1],h=n[i+2];n=n[i+3],i=r[o+0];var l=r[o+1],u=r[o+2];if(n!==(r=r[o+3])||s!==i||c!==l||h!==u){o=1-a;var p=s*i+c*l+h*u+n*r,d=0<=p?1:-1,f=1-p*p;f>Number.EPSILON&&(f=Math.sqrt(f),p=Math.atan2(f,p*d),o=Math.sin(o*p)/f,a=Math.sin(a*p)/f),s=s*o+i*(d*=a),c=c*o+l*d,h=h*o+u*d,n=n*o+r*d,o===1-a&&(s*=a=1/Math.sqrt(s*s+c*c+h*h+n*n),c*=a,h*=a,n*=a)}t[e]=s,t[e+1]=c,t[e+2]=h,t[e+3]=n}}),Object.defineProperties(r.prototype,{x:{get:function(){return this._x},set:function(t){this._x=t,this.onChangeCallback()}},y:{get:function(){return this._y},set:function(t){this._y=t,this.onChangeCallback()}},z:{get:function(){return this._z},set:function(t){this._z=t,this.onChangeCallback()}},w:{get:function(){return this._w},set:function(t){this._w=t,this.onChangeCallback()}}}),Object.assign(r.prototype,{set:function(t,e,n,i){return this._x=t,this._y=e,this._z=n,this._w=i,this.onChangeCallback(),this},clone:function(){return new this.constructor(this._x,this._y,this._z,this._w)},copy:function(t){return this._x=t.x,this._y=t.y,this._z=t.z,this._w=t.w,this.onChangeCallback(),this},setFromEuler:function(t,e){if(!t||!t.isEuler)throw Error("THREE.Quaternion: .setFromEuler() now expects an Euler rotation rather than a Vector3 and order.");var n=t._x,i=t._y,r=t._z;t=t.order;var o=Math.cos,a=Math.sin,s=o(n/2),c=o(i/2);return o=o(r/2),n=a(n/2),i=a(i/2),r=a(r/2),"XYZ"===t?(this._x=n*c*o+s*i*r,this._y=s*i*o-n*c*r,this._z=s*c*r+n*i*o,this._w=s*c*o-n*i*r):"YXZ"===t?(this._x=n*c*o+s*i*r,this._y=s*i*o-n*c*r,this._z=s*c*r-n*i*o,this._w=s*c*o+n*i*r):"ZXY"===t?(this._x=n*c*o-s*i*r,this._y=s*i*o+n*c*r,this._z=s*c*r+n*i*o,this._w=s*c*o-n*i*r):"ZYX"===t?(this._x=n*c*o-s*i*r,this._y=s*i*o+n*c*r,this._z=s*c*r-n*i*o,this._w=s*c*o+n*i*r):"YZX"===t?(this._x=n*c*o+s*i*r,this._y=s*i*o+n*c*r,this._z=s*c*r-n*i*o,this._w=s*c*o-n*i*r):"XZY"===t&&(this._x=n*c*o-s*i*r,this._y=s*i*o-n*c*r,this._z=s*c*r+n*i*o,this._w=s*c*o+n*i*r),!1!==e&&this.onChangeCallback(),this},setFromAxisAngle:function(t,e){e/=2;var n=Math.sin(e);return this._x=t.x*n,this._y=t.y*n,this._z=t.z*n,this._w=Math.cos(e),this.onChangeCallback(),this},setFromRotationMatrix:function(t){var e=t.elements,n=e[0];t=e[4];var i=e[8],r=e[1],o=e[5],a=e[9],s=e[2],c=e[6],h=n+o+(e=e[10]);return 0<h?(n=.5/Math.sqrt(h+1),this._w=.25/n,this._x=(c-a)*n,this._y=(i-s)*n,this._z=(r-t)*n):n>o&&n>e?(n=2*Math.sqrt(1+n-o-e),this._w=(c-a)/n,this._x=.25*n,this._y=(t+r)/n,this._z=(i+s)/n):o>e?(n=2*Math.sqrt(1+o-n-e),this._w=(i-s)/n,this._x=(t+r)/n,this._y=.25*n,this._z=(a+c)/n):(n=2*Math.sqrt(1+e-n-o),this._w=(r-t)/n,this._x=(i+s)/n,this._y=(a+c)/n,this._z=.25*n),this.onChangeCallback(),this},setFromUnitVectors:function(){var t,e=new o;return function(n,i){return void 0===e&&(e=new o),1e-6>(t=n.dot(i)+1)?(t=0,Math.abs(n.x)>Math.abs(n.z)?e.set(-n.y,n.x,0):e.set(0,-n.z,n.y)):e.crossVectors(n,i),this._x=e.x,this._y=e.y,this._z=e.z,this._w=t,this.normalize()}}(),inverse:function(){return this.conjugate()},conjugate:function(){return this._x*=-1,this._y*=-1,this._z*=-1,this.onChangeCallback(),this},dot:function(t){return this._x*t._x+this._y*t._y+this._z*t._z+this._w*t._w},lengthSq:function(){return this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w},length:function(){return Math.sqrt(this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w)},normalize:function(){var t=this.length();return 0===t?(this._z=this._y=this._x=0,this._w=1):(t=1/t,this._x*=t,this._y*=t,this._z*=t,this._w*=t),this.onChangeCallback(),this},multiply:function(t,e){return void 0!==e?(console.warn("THREE.Quaternion: .multiply() now only accepts one argument. Use .multiplyQuaternions( a, b ) instead."),this.multiplyQuaternions(t,e)):this.multiplyQuaternions(this,t)},premultiply:function(t){return this.multiplyQuaternions(t,this)},multiplyQuaternions:function(t,e){var n=t._x,i=t._y,r=t._z;t=t._w;var o=e._x,a=e._y,s=e._z;return e=e._w,this._x=n*e+t*o+i*s-r*a,this._y=i*e+t*a+r*o-n*s,this._z=r*e+t*s+n*a-i*o,this._w=t*e-n*o-i*a-r*s,this.onChangeCallback(),this},slerp:function(t,e){if(0===e)return this;if(1===e)return this.copy(t);var n=this._x,i=this._y,r=this._z,o=this._w,a=o*t._w+n*t._x+i*t._y+r*t._z;if(0>a?(this._w=-t._w,this._x=-t._x,this._y=-t._y,this._z=-t._z,a=-a):this.copy(t),1<=a)return this._w=o,this._x=n,this._y=i,this._z=r,this;if(t=Math.sqrt(1-a*a),.001>Math.abs(t))return this._w=.5*(o+this._w),this._x=.5*(n+this._x),this._y=.5*(i+this._y),this._z=.5*(r+this._z),this;var s=Math.atan2(t,a);return a=Math.sin((1-e)*s)/t,e=Math.sin(e*s)/t,this._w=o*a+this._w*e,this._x=n*a+this._x*e,this._y=i*a+this._y*e,this._z=r*a+this._z*e,this.onChangeCallback(),this},equals:function(t){return t._x===this._x&&t._y===this._y&&t._z===this._z&&t._w===this._w},fromArray:function(t,e){return void 0===e&&(e=0),this._x=t[e],this._y=t[e+1],this._z=t[e+2],this._w=t[e+3],this.onChangeCallback(),this},toArray:function(t,e){return void 0===t&&(t=[]),void 0===e&&(e=0),t[e]=this._x,t[e+1]=this._y,t[e+2]=this._z,t[e+3]=this._w,t},onChange:function(t){return this.onChangeCallback=t,this},onChangeCallback:function(){}}),Object.assign(o.prototype,{isVector3:!0,set:function(t,e,n){return this.x=t,this.y=e,this.z=n,this},setScalar:function(t){return this.z=this.y=this.x=t,this},setX:function(t){return this.x=t,this},setY:function(t){return this.y=t,this},setZ:function(t){return this.z=t,this},setComponent:function(t,e){switch(t){case 0:this.x=e;break;case 1:this.y=e;break;case 2:this.z=e;break;default:throw Error("index is out of range: "+t)}return this},getComponent:function(t){switch(t){case 0:return this.x;case 1:return this.y;case 2:return this.z;default:throw Error("index is out of range: "+t)}},clone:function(){return new this.constructor(this.x,this.y,this.z)},copy:function(t){return this.x=t.x,this.y=t.y,this.z=t.z,this},add:function(t,e){return void 0!==e?(console.warn("THREE.Vector3: .add() now only accepts one argument. Use .addVectors( a, b ) instead."),this.addVectors(t,e)):(this.x+=t.x,this.y+=t.y,this.z+=t.z,this)},addScalar:function(t){return this.x+=t,this.y+=t,this.z+=t,this},addVectors:function(t,e){return this.x=t.x+e.x,this.y=t.y+e.y,this.z=t.z+e.z,this},addScaledVector:function(t,e){return this.x+=t.x*e,this.y+=t.y*e,this.z+=t.z*e,this},sub:function(t,e){return void 0!==e?(console.warn("THREE.Vector3: .sub() now only accepts one argument. Use .subVectors( a, b ) instead."),this.subVectors(t,e)):(this.x-=t.x,this.y-=t.y,this.z-=t.z,this)},subScalar:function(t){return this.x-=t,this.y-=t,this.z-=t,this},subVectors:function(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this.z=t.z-e.z,this},multiply:function(t,e){return void 0!==e?(console.warn("THREE.Vector3: .multiply() now only accepts one argument. Use .multiplyVectors( a, b ) instead."),this.multiplyVectors(t,e)):(this.x*=t.x,this.y*=t.y,this.z*=t.z,this)},multiplyScalar:function(t){return this.x*=t,this.y*=t,this.z*=t,this},multiplyVectors:function(t,e){return this.x=t.x*e.x,this.y=t.y*e.y,this.z=t.z*e.z,this},applyEuler:function(){var t=new r;return function(e){return e&&e.isEuler||console.error("THREE.Vector3: .applyEuler() now expects an Euler rotation rather than a Vector3 and order."),this.applyQuaternion(t.setFromEuler(e))}}(),applyAxisAngle:function(){var t=new r;return function(e,n){return this.applyQuaternion(t.setFromAxisAngle(e,n))}}(),applyMatrix3:function(t){var e=this.x,n=this.y,i=this.z;return t=t.elements,this.x=t[0]*e+t[3]*n+t[6]*i,this.y=t[1]*e+t[4]*n+t[7]*i,this.z=t[2]*e+t[5]*n+t[8]*i,this},applyMatrix4:function(t){var e=this.x,n=this.y,i=this.z,r=1/((t=t.elements)[3]*e+t[7]*n+t[11]*i+t[15]);return this.x=(t[0]*e+t[4]*n+t[8]*i+t[12])*r,this.y=(t[1]*e+t[5]*n+t[9]*i+t[13])*r,this.z=(t[2]*e+t[6]*n+t[10]*i+t[14])*r,this},applyQuaternion:function(t){var e=this.x,n=this.y,i=this.z,r=t.x,o=t.y,a=t.z,s=(t=t.w)*e+o*i-a*n,c=t*n+a*e-r*i,h=t*i+r*n-o*e;return e=-r*e-o*n-a*i,this.x=s*t+e*-r+c*-a-h*-o,this.y=c*t+e*-o+h*-r-s*-a,this.z=h*t+e*-a+s*-o-c*-r,this},project:function(){var t=new i;return function(e){return t.multiplyMatrices(e.projectionMatrix,t.getInverse(e.matrixWorld)),this.applyMatrix4(t)}}(),unproject:function(){var t=new i;return function(e){return t.multiplyMatrices(e.matrixWorld,t.getInverse(e.projectionMatrix)),this.applyMatrix4(t)}}(),transformDirection:function(t){var e=this.x,n=this.y,i=this.z;return t=t.elements,this.x=t[0]*e+t[4]*n+t[8]*i,this.y=t[1]*e+t[5]*n+t[9]*i,this.z=t[2]*e+t[6]*n+t[10]*i,this.normalize()},divide:function(t){return this.x/=t.x,this.y/=t.y,this.z/=t.z,this},divideScalar:function(t){return this.multiplyScalar(1/t)},min:function(t){return this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y),this.z=Math.min(this.z,t.z),this},max:function(t){return this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y),this.z=Math.max(this.z,t.z),this},clamp:function(t,e){return this.x=Math.max(t.x,Math.min(e.x,this.x)),this.y=Math.max(t.y,Math.min(e.y,this.y)),this.z=Math.max(t.z,Math.min(e.z,this.z)),this},clampScalar:function(){var t=new o,e=new o;return function(n,i){return t.set(n,n,n),e.set(i,i,i),this.clamp(t,e)}}(),clampLength:function(t,e){var n=this.length();return this.divideScalar(n||1).multiplyScalar(Math.max(t,Math.min(e,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=0>this.x?Math.ceil(this.x):Math.floor(this.x),this.y=0>this.y?Math.ceil(this.y):Math.floor(this.y),this.z=0>this.z?Math.ceil(this.z):Math.floor(this.z),this},negate:function(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this},dot:function(t){return this.x*t.x+this.y*t.y+this.z*t.z},lengthSq:function(){return this.x*this.x+this.y*this.y+this.z*this.z},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)},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(t){return this.normalize().multiplyScalar(t)},lerp:function(t,e){return this.x+=(t.x-this.x)*e,this.y+=(t.y-this.y)*e,this.z+=(t.z-this.z)*e,this},lerpVectors:function(t,e,n){return this.subVectors(e,t).multiplyScalar(n).add(t)},cross:function(t,e){return void 0!==e?(console.warn("THREE.Vector3: .cross() now only accepts one argument. Use .crossVectors( a, b ) instead."),this.crossVectors(t,e)):this.crossVectors(this,t)},crossVectors:function(t,e){var n=t.x,i=t.y;t=t.z;var r=e.x,o=e.y;return e=e.z,this.x=i*e-t*o,this.y=t*r-n*e,this.z=n*o-i*r,this},projectOnVector:function(t){var e=t.dot(this)/t.lengthSq();return this.copy(t).multiplyScalar(e)},projectOnPlane:function(){var t=new o;return function(e){return t.copy(this).projectOnVector(e),this.sub(t)}}(),reflect:function(){var t=new o;return function(e){return this.sub(t.copy(e).multiplyScalar(2*this.dot(e)))}}(),angleTo:function(t){return t=this.dot(t)/Math.sqrt(this.lengthSq()*t.lengthSq()),Math.acos(Ar.clamp(t,-1,1))},distanceTo:function(t){return Math.sqrt(this.distanceToSquared(t))},distanceToSquared:function(t){var e=this.x-t.x,n=this.y-t.y;return e*e+n*n+(t=this.z-t.z)*t},manhattanDistanceTo:function(t){return Math.abs(this.x-t.x)+Math.abs(this.y-t.y)+Math.abs(this.z-t.z)},setFromSpherical:function(t){var e=Math.sin(t.phi)*t.radius;return this.x=e*Math.sin(t.theta),this.y=Math.cos(t.phi)*t.radius,this.z=e*Math.cos(t.theta),this},setFromCylindrical:function(t){return this.x=t.radius*Math.sin(t.theta),this.y=t.y,this.z=t.radius*Math.cos(t.theta),this},setFromMatrixPosition:function(t){return t=t.elements,this.x=t[12],this.y=t[13],this.z=t[14],this},setFromMatrixScale:function(t){var e=this.setFromMatrixColumn(t,0).length(),n=this.setFromMatrixColumn(t,1).length();return t=this.setFromMatrixColumn(t,2).length(),this.x=e,this.y=n,this.z=t,this},setFromMatrixColumn:function(t,e){return this.fromArray(t.elements,4*e)},equals:function(t){return t.x===this.x&&t.y===this.y&&t.z===this.z},fromArray:function(t,e){return void 0===e&&(e=0),this.x=t[e],this.y=t[e+1],this.z=t[e+2],this},toArray:function(t,e){return void 0===t&&(t=[]),void 0===e&&(e=0),t[e]=this.x,t[e+1]=this.y,t[e+2]=this.z,t},fromBufferAttribute:function(t,e,n){return void 0!==n&&console.warn("THREE.Vector3: offset has been removed from .fromBufferAttribute()."),this.x=t.getX(e),this.y=t.getY(e),this.z=t.getZ(e),this}}),Object.assign(a.prototype,{isMatrix3:!0,set:function(t,e,n,i,r,o,a,s,c){var h=this.elements;return h[0]=t,h[1]=i,h[2]=a,h[3]=e,h[4]=r,h[5]=s,h[6]=n,h[7]=o,h[8]=c,this},identity:function(){return this.set(1,0,0,0,1,0,0,0,1),this},clone:function(){return(new this.constructor).fromArray(this.elements)},copy:function(t){var e=this.elements;return t=t.elements,e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e[4]=t[4],e[5]=t[5],e[6]=t[6],e[7]=t[7],e[8]=t[8],this},setFromMatrix4:function(t){return t=t.elements,this.set(t[0],t[4],t[8],t[1],t[5],t[9],t[2],t[6],t[10]),this},applyToBufferAttribute:function(){var t=new o;return function(e){for(var n=0,i=e.count;n<i;n++)t.x=e.getX(n),t.y=e.getY(n),t.z=e.getZ(n),t.applyMatrix3(this),e.setXYZ(n,t.x,t.y,t.z);return e}}(),multiply:function(t){return this.multiplyMatrices(this,t)},premultiply:function(t){return this.multiplyMatrices(t,this)},multiplyMatrices:function(t,e){var n=t.elements,i=e.elements;e=this.elements,t=n[0];var r=n[3],o=n[6],a=n[1],s=n[4],c=n[7],h=n[2],l=n[5];n=n[8];var u=i[0],p=i[3],d=i[6],f=i[1],m=i[4],g=i[7],v=i[2],y=i[5];return i=i[8],e[0]=t*u+r*f+o*v,e[3]=t*p+r*m+o*y,e[6]=t*d+r*g+o*i,e[1]=a*u+s*f+c*v,e[4]=a*p+s*m+c*y,e[7]=a*d+s*g+c*i,e[2]=h*u+l*f+n*v,e[5]=h*p+l*m+n*y,e[8]=h*d+l*g+n*i,this},multiplyScalar:function(t){var e=this.elements;return e[0]*=t,e[3]*=t,e[6]*=t,e[1]*=t,e[4]*=t,e[7]*=t,e[2]*=t,e[5]*=t,e[8]*=t,this},determinant:function(){var t=this.elements,e=t[0],n=t[1],i=t[2],r=t[3],o=t[4],a=t[5],s=t[6],c=t[7];return e*o*(t=t[8])-e*a*c-n*r*t+n*a*s+i*r*c-i*o*s},getInverse:function(t,e){t&&t.isMatrix4&&console.error("THREE.Matrix3: .getInverse() no longer takes a Matrix4 argument.");var n=t.elements;t=this.elements;var i=n[0],r=n[1],o=n[2],a=n[3],s=n[4],c=n[5],h=n[6],l=n[7],u=(n=n[8])*s-c*l,p=c*h-n*a,d=l*a-s*h,f=i*u+r*p+o*d;if(0===f){if(!0===e)throw Error("THREE.Matrix3: .getInverse() can't invert matrix, determinant is 0");return console.warn("THREE.Matrix3: .getInverse() can't invert matrix, determinant is 0"),this.identity()}return e=1/f,t[0]=u*e,t[1]=(o*l-n*r)*e,t[2]=(c*r-o*s)*e,t[3]=p*e,t[4]=(n*i-o*h)*e,t[5]=(o*a-c*i)*e,t[6]=d*e,t[7]=(r*h-l*i)*e,t[8]=(s*i-r*a)*e,this},transpose:function(){var t=this.elements,e=t[1];return t[1]=t[3],t[3]=e,e=t[2],t[2]=t[6],t[6]=e,e=t[5],t[5]=t[7],t[7]=e,this},getNormalMatrix:function(t){return this.setFromMatrix4(t).getInverse(this).transpose()},transposeIntoArray:function(t){var e=this.elements;return t[0]=e[0],t[1]=e[3],t[2]=e[6],t[3]=e[1],t[4]=e[4],t[5]=e[7],t[6]=e[2],t[7]=e[5],t[8]=e[8],this},setUvTransform:function(t,e,n,i,r,o,a){var s=Math.cos(r);r=Math.sin(r),this.set(n*s,n*r,-n*(s*o+r*a)+o+t,-i*r,i*s,-i*(-r*o+s*a)+a+e,0,0,1)},scale:function(t,e){var n=this.elements;return n[0]*=t,n[3]*=t,n[6]*=t,n[1]*=e,n[4]*=e,n[7]*=e,this},rotate:function(t){var e=Math.cos(t);t=Math.sin(t);var n=this.elements,i=n[0],r=n[3],o=n[6],a=n[1],s=n[4],c=n[7];return n[0]=e*i+t*a,n[3]=e*r+t*s,n[6]=e*o+t*c,n[1]=-t*i+e*a,n[4]=-t*r+e*s,n[7]=-t*o+e*c,this},translate:function(t,e){var n=this.elements;return n[0]+=t*n[2],n[3]+=t*n[5],n[6]+=t*n[8],n[1]+=e*n[2],n[4]+=e*n[5],n[7]+=e*n[8],this},equals:function(t){var e=this.elements;t=t.elements;for(var n=0;9>n;n++)if(e[n]!==t[n])return!1;return!0},fromArray:function(t,e){void 0===e&&(e=0);for(var n=0;9>n;n++)this.elements[n]=t[n+e];return this},toArray:function(t,e){void 0===t&&(t=[]),void 0===e&&(e=0);var n=this.elements;return t[e]=n[0],t[e+1]=n[1],t[e+2]=n[2],t[e+3]=n[3],t[e+4]=n[4],t[e+5]=n[5],t[e+6]=n[6],t[e+7]=n[7],t[e+8]=n[8],t}});var Rr=0;s.DEFAULT_IMAGE=void 0,s.DEFAULT_MAPPING=300,s.prototype=Object.assign(Object.create(e.prototype),{constructor:s,isTexture:!0,updateMatrix:function(){this.matrix.setUvTransform(this.offset.x,this.offset.y,this.repeat.x,this.repeat.y,this.rotation,this.center.x,this.center.y)},clone:function(){return(new this.constructor).copy(this)},copy:function(t){return this.name=t.name,this.image=t.image,this.mipmaps=t.mipmaps.slice(0),this.mapping=t.mapping,this.wrapS=t.wrapS,this.wrapT=t.wrapT,this.magFilter=t.magFilter,this.minFilter=t.minFilter,this.anisotropy=t.anisotropy,this.format=t.format,this.type=t.type,this.offset.copy(t.offset),this.repeat.copy(t.repeat),this.center.copy(t.center),this.rotation=t.rotation,this.matrixAutoUpdate=t.matrixAutoUpdate,this.matrix.copy(t.matrix),this.generateMipmaps=t.generateMipmaps,this.premultiplyAlpha=t.premultiplyAlpha,this.flipY=t.flipY,this.unpackAlignment=t.unpackAlignment,this.encoding=t.encoding,this},toJSON:function(t){var e=void 0===t||"string"==typeof t;if(!e&&void 0!==t.textures[this.uuid])return t.textures[this.uuid];var n={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],format:this.format,minFilter:this.minFilter,magFilter:this.magFilter,anisotropy:this.anisotropy,flipY:this.flipY};if(void 0!==this.image){var i=this.image;if(void 0===i.uuid&&(i.uuid=Ar.generateUUID()),!e&&void 0===t.images[i.uuid]){var r=t.images,o=i.uuid,a=i.uuid;if(i instanceof HTMLCanvasElement)var s=i;else{(s=document.createElementNS("http://www.w3.org/1999/xhtml","canvas")).width=i.width,s.height=i.height;var c=s.getContext("2d");i instanceof ImageData?c.putImageData(i,0,0):c.drawImage(i,0,0,i.width,i.height)}s=2048<s.width||2048<s.height?s.toDataURL("image/jpeg",.6):s.toDataURL("image/png"),r[o]={uuid:a,url:s}}n.image=i.uuid}return e||(t.textures[this.uuid]=n),n},dispose:function(){this.dispatchEvent({type:"dispose"})},transformUv:function(t){if(300===this.mapping){if(t.applyMatrix3(this.matrix),0>t.x||1<t.x)switch(this.wrapS){case 1e3:t.x-=Math.floor(t.x);break;case 1001:t.x=0>t.x?0:1;break;case 1002:t.x=1===Math.abs(Math.floor(t.x)%2)?Math.ceil(t.x)-t.x:t.x-Math.floor(t.x)}if(0>t.y||1<t.y)switch(this.wrapT){case 1e3:t.y-=Math.floor(t.y);break;case 1001:t.y=0>t.y?0:1;break;case 1002:t.y=1===Math.abs(Math.floor(t.y)%2)?Math.ceil(t.y)-t.y:t.y-Math.floor(t.y)}this.flipY&&(t.y=1-t.y)}}}),Object.defineProperty(s.prototype,"needsUpdate",{set:function(t){!0===t&&this.version++}}),Object.assign(c.prototype,{isVector4:!0,set:function(t,e,n,i){return this.x=t,this.y=e,this.z=n,this.w=i,this},setScalar:function(t){return this.w=this.z=this.y=this.x=t,this},setX:function(t){return this.x=t,this},setY:function(t){return this.y=t,this},setZ:function(t){return this.z=t,this},setW:function(t){return this.w=t,this},setComponent:function(t,e){switch(t){case 0:this.x=e;break;case 1:this.y=e;break;case 2:this.z=e;break;case 3:this.w=e;break;default:throw Error("index is out of range: "+t)}return this},getComponent:function(t){switch(t){case 0:return this.x;case 1:return this.y;case 2:return this.z;case 3:return this.w;default:throw Error("index is out of range: "+t)}},clone:function(){return new this.constructor(this.x,this.y,this.z,this.w)},copy:function(t){return this.x=t.x,this.y=t.y,this.z=t.z,this.w=void 0!==t.w?t.w:1,this},add:function(t,e){return void 0!==e?(console.warn("THREE.Vector4: .add() now only accepts one argument. Use .addVectors( a, b ) instead."),this.addVectors(t,e)):(this.x+=t.x,this.y+=t.y,this.z+=t.z,this.w+=t.w,this)},addScalar:function(t){return this.x+=t,this.y+=t,this.z+=t,this.w+=t,this},addVectors:function(t,e){return this.x=t.x+e.x,this.y=t.y+e.y,this.z=t.z+e.z,this.w=t.w+e.w,this},addScaledVector:function(t,e){return this.x+=t.x*e,this.y+=t.y*e,this.z+=t.z*e,this.w+=t.w*e,this},sub:function(t,e){return void 0!==e?(console.warn("THREE.Vector4: .sub() now only accepts one argument. Use .subVectors( a, b ) instead."),this.subVectors(t,e)):(this.x-=t.x,this.y-=t.y,this.z-=t.z,this.w-=t.w,this)},subScalar:function(t){return this.x-=t,this.y-=t,this.z-=t,this.w-=t,this},subVectors:function(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this.z=t.z-e.z,this.w=t.w-e.w,this},multiplyScalar:function(t){return this.x*=t,this.y*=t,this.z*=t,this.w*=t,this},applyMatrix4:function(t){var e=this.x,n=this.y,i=this.z,r=this.w;return t=t.elements,this.x=t[0]*e+t[4]*n+t[8]*i+t[12]*r,this.y=t[1]*e+t[5]*n+t[9]*i+t[13]*r,this.z=t[2]*e+t[6]*n+t[10]*i+t[14]*r,this.w=t[3]*e+t[7]*n+t[11]*i+t[15]*r,this},divideScalar:function(t){return this.multiplyScalar(1/t)},setAxisAngleFromQuaternion:function(t){this.w=2*Math.acos(t.w);var e=Math.sqrt(1-t.w*t.w);return 1e-4>e?(this.x=1,this.z=this.y=0):(this.x=t.x/e,this.y=t.y/e,this.z=t.z/e),this},setAxisAngleFromRotationMatrix:function(t){var e=(t=t.elements)[0],n=t[4],i=t[8],r=t[1],o=t[5],a=t[9],s=t[2],c=t[6],h=t[10];return.01>Math.abs(n-r)&&.01>Math.abs(i-s)&&.01>Math.abs(a-c)?.1>Math.abs(n+r)&&.1>Math.abs(i+s)&&.1>Math.abs(a+c)&&.1>Math.abs(e+o+h-3)?(this.set(1,0,0,0),this):(t=Math.PI,h=(h+1)/2,n=(n+r)/4,i=(i+s)/4,a=(a+c)/4,(e=(e+1)/2)>(o=(o+1)/2)&&e>h?.01>e?(c=0,n=s=.707106781):(s=n/(c=Math.sqrt(e)),n=i/c):o>h?.01>o?(c=.707106781,s=0,n=.707106781):(c=n/(s=Math.sqrt(o)),n=a/s):.01>h?(s=c=.707106781,n=0):(c=i/(n=Math.sqrt(h)),s=a/n),this.set(c,s,n,t),this):(t=Math.sqrt((c-a)*(c-a)+(i-s)*(i-s)+(r-n)*(r-n)),.001>Math.abs(t)&&(t=1),this.x=(c-a)/t,this.y=(i-s)/t,this.z=(r-n)/t,this.w=Math.acos((e+o+h-1)/2),this)},min:function(t){return this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y),this.z=Math.min(this.z,t.z),this.w=Math.min(this.w,t.w),this},max:function(t){return this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y),this.z=Math.max(this.z,t.z),this.w=Math.max(this.w,t.w),this},clamp:function(t,e){return this.x=Math.max(t.x,Math.min(e.x,this.x)),this.y=Math.max(t.y,Math.min(e.y,this.y)),this.z=Math.max(t.z,Math.min(e.z,this.z)),this.w=Math.max(t.w,Math.min(e.w,this.w)),this},clampScalar:function(){var t,e;return function(n,i){return void 0===t&&(t=new c,e=new c),t.set(n,n,n,n),e.set(i,i,i,i),this.clamp(t,e)}}(),clampLength:function(t,e){var n=this.length();return this.divideScalar(n||1).multiplyScalar(Math.max(t,Math.min(e,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=0>this.x?Math.ceil(this.x):Math.floor(this.x),this.y=0>this.y?Math.ceil(this.y):Math.floor(this.y),this.z=0>this.z?Math.ceil(this.z):Math.floor(this.z),this.w=0>this.w?Math.ceil(this.w):Math.floor(this.w),this},negate:function(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this.w=-this.w,this},dot:function(t){return this.x*t.x+this.y*t.y+this.z*t.z+this.w*t.w},lengthSq:function(){return this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)},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(t){return this.normalize().multiplyScalar(t)},lerp:function(t,e){return this.x+=(t.x-this.x)*e,this.y+=(t.y-this.y)*e,this.z+=(t.z-this.z)*e,this.w+=(t.w-this.w)*e,this},lerpVectors:function(t,e,n){return this.subVectors(e,t).multiplyScalar(n).add(t)},equals:function(t){return t.x===this.x&&t.y===this.y&&t.z===this.z&&t.w===this.w},fromArray:function(t,e){return void 0===e&&(e=0),this.x=t[e],this.y=t[e+1],this.z=t[e+2],this.w=t[e+3],this},toArray:function(t,e){return void 0===t&&(t=[]),void 0===e&&(e=0),t[e]=this.x,t[e+1]=this.y,t[e+2]=this.z,t[e+3]=this.w,t},fromBufferAttribute:function(t,e,n){return void 0!==n&&console.warn("THREE.Vector4: offset has been removed from .fromBufferAttribute()."),this.x=t.getX(e),this.y=t.getY(e),this.z=t.getZ(e),this.w=t.getW(e),this}}),h.prototype=Object.assign(Object.create(e.prototype),{constructor:h,isWebGLRenderTarget:!0,setSize:function(t,e){this.width===t&&this.height===e||(this.width=t,this.height=e,this.dispose()),this.viewport.set(0,0,t,e),this.scissor.set(0,0,t,e)},clone:function(){return(new this.constructor).copy(this)},copy:function(t){return this.width=t.width,this.height=t.height,this.viewport.copy(t.viewport),this.texture=t.texture.clone(),this.depthBuffer=t.depthBuffer,this.stencilBuffer=t.stencilBuffer,this.depthTexture=t.depthTexture,this},dispose:function(){this.dispatchEvent({type:"dispose"})}}),l.prototype=Object.create(h.prototype),l.prototype.constructor=l,l.prototype.isWebGLRenderTargetCube=!0,u.prototype=Object.create(s.prototype),u.prototype.constructor=u,u.prototype.isDataTexture=!0,Object.assign(p.prototype,{isBox3:!0,set:function(t,e){return this.min.copy(t),this.max.copy(e),this},setFromArray:function(t){for(var e=1/0,n=1/0,i=1/0,r=-1/0,o=-1/0,a=-1/0,s=0,c=t.length;s<c;s+=3){var h=t[s],l=t[s+1],u=t[s+2];h<e&&(e=h),l<n&&(n=l),u<i&&(i=u),h>r&&(r=h),l>o&&(o=l),u>a&&(a=u)}return this.min.set(e,n,i),this.max.set(r,o,a),this},setFromBufferAttribute:function(t){for(var e=1/0,n=1/0,i=1/0,r=-1/0,o=-1/0,a=-1/0,s=0,c=t.count;s<c;s++){var h=t.getX(s),l=t.getY(s),u=t.getZ(s);h<e&&(e=h),l<n&&(n=l),u<i&&(i=u),h>r&&(r=h),l>o&&(o=l),u>a&&(a=u)}return this.min.set(e,n,i),this.max.set(r,o,a),this},setFromPoints:function(t){this.makeEmpty();for(var e=0,n=t.length;e<n;e++)this.expandByPoint(t[e]);return this},setFromCenterAndSize:function(){var t=new o;return function(e,n){return n=t.copy(n).multiplyScalar(.5),this.min.copy(e).sub(n),this.max.copy(e).add(n),this}}(),setFromObject:function(t){return this.makeEmpty(),this.expandByObject(t)},clone:function(){return(new this.constructor).copy(this)},copy:function(t){return this.min.copy(t.min),this.max.copy(t.max),this},makeEmpty:function(){return this.min.x=this.min.y=this.min.z=1/0,this.max.x=this.max.y=this.max.z=-1/0,this},isEmpty:function(){return this.max.x<this.min.x||this.max.y<this.min.y||this.max.z<this.min.z},getCenter:function(t){return void 0===t&&(console.warn("THREE.Box3: .getCenter() target is now required"),t=new o),this.isEmpty()?t.set(0,0,0):t.addVectors(this.min,this.max).multiplyScalar(.5)},getSize:function(t){return void 0===t&&(console.warn("THREE.Box3: .getSize() target is now required"),t=new o),this.isEmpty()?t.set(0,0,0):t.subVectors(this.max,this.min)},expandByPoint:function(t){return this.min.min(t),this.max.max(t),this},expandByVector:function(t){return this.min.sub(t),this.max.add(t),this},expandByScalar:function(t){return this.min.addScalar(-t),this.max.addScalar(t),this},expandByObject:function(){function t(t){var o=t.geometry;if(void 0!==o)if(o.isGeometry)for(o=o.vertices,n=0,i=o.length;n<i;n++)r.copy(o[n]),r.applyMatrix4(t.matrixWorld),e.expandByPoint(r);else if(o.isBufferGeometry&&void 0!==(o=o.attributes.position))for(n=0,i=o.count;n<i;n++)r.fromBufferAttribute(o,n).applyMatrix4(t.matrixWorld),e.expandByPoint(r)}var e,n,i,r=new o;return function(n){return e=this,n.updateMatrixWorld(!0),n.traverse(t),this}}(),containsPoint:function(t){return!(t.x<this.min.x||t.x>this.max.x||t.y<this.min.y||t.y>this.max.y||t.z<this.min.z||t.z>this.max.z)},containsBox:function(t){return this.min.x<=t.min.x&&t.max.x<=this.max.x&&this.min.y<=t.min.y&&t.max.y<=this.max.y&&this.min.z<=t.min.z&&t.max.z<=this.max.z},getParameter:function(t,e){return void 0===e&&(console.warn("THREE.Box3: .getParameter() target is now required"),e=new o),e.set((t.x-this.min.x)/(this.max.x-this.min.x),(t.y-this.min.y)/(this.max.y-this.min.y),(t.z-this.min.z)/(this.max.z-this.min.z))},intersectsBox:function(t){return!(t.max.x<this.min.x||t.min.x>this.max.x||t.max.y<this.min.y||t.min.y>this.max.y||t.max.z<this.min.z||t.min.z>this.max.z)},intersectsSphere:function(){var t=new o;return function(e){return this.clampPoint(e.center,t),t.distanceToSquared(e.center)<=e.radius*e.radius}}(),intersectsPlane:function(t){if(0<t.normal.x)var e=t.normal.x*this.min.x,n=t.normal.x*this.max.x;else e=t.normal.x*this.max.x,n=t.normal.x*this.min.x;return 0<t.normal.y?(e+=t.normal.y*this.min.y,n+=t.normal.y*this.max.y):(e+=t.normal.y*this.max.y,n+=t.normal.y*this.min.y),0<t.normal.z?(e+=t.normal.z*this.min.z,n+=t.normal.z*this.max.z):(e+=t.normal.z*this.max.z,n+=t.normal.z*this.min.z),e<=t.constant&&n>=t.constant},intersectsTriangle:function(){function t(t){var r,o=0;for(r=t.length-3;o<=r;o+=3){c.fromArray(t,o);var a=l.x*Math.abs(c.x)+l.y*Math.abs(c.y)+l.z*Math.abs(c.z),s=e.dot(c),h=n.dot(c),u=i.dot(c);if(Math.max(-Math.max(s,h,u),Math.min(s,h,u))>a)return!1}return!0}var e=new o,n=new o,i=new o,r=new o,a=new o,s=new o,c=new o,h=new o,l=new o,u=new o;return function(o){return!this.isEmpty()&&(this.getCenter(h),l.subVectors(this.max,h),e.subVectors(o.a,h),n.subVectors(o.b,h),i.subVectors(o.c,h),r.subVectors(n,e),a.subVectors(i,n),s.subVectors(e,i),!!t(o=[0,-r.z,r.y,0,-a.z,a.y,0,-s.z,s.y,r.z,0,-r.x,a.z,0,-a.x,s.z,0,-s.x,-r.y,r.x,0,-a.y,a.x,0,-s.y,s.x,0])&&(!!t(o=[1,0,0,0,1,0,0,0,1])&&(u.crossVectors(r,a),t(o=[u.x,u.y,u.z]))))}}(),clampPoint:function(t,e){return void 0===e&&(console.warn("THREE.Box3: .clampPoint() target is now required"),e=new o),e.copy(t).clamp(this.min,this.max)},distanceToPoint:function(){var t=new o;return function(e){return t.copy(e).clamp(this.min,this.max).sub(e).length()}}(),getBoundingSphere:function(){var t=new o;return function(e){return void 0===e&&(console.warn("THREE.Box3: .getBoundingSphere() target is now required"),e=new d),this.getCenter(e.center),e.radius=.5*this.getSize(t).length(),e}}(),intersect:function(t){return this.min.max(t.min),this.max.min(t.max),this.isEmpty()&&this.makeEmpty(),this},union:function(t){return this.min.min(t.min),this.max.max(t.max),this},applyMatrix4:function(){var t=[new o,new o,new o,new o,new o,new o,new o,new o];return function(e){return this.isEmpty()?this:(t[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(e),t[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(e),t[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(e),t[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(e),t[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(e),t[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(e),t[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(e),t[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(e),this.setFromPoints(t),this)}}(),translate:function(t){return this.min.add(t),this.max.add(t),this},equals:function(t){return t.min.equals(this.min)&&t.max.equals(this.max)}}),Object.assign(d.prototype,{set:function(t,e){return this.center.copy(t),this.radius=e,this},setFromPoints:function(){var t=new p;return function(e,n){var i=this.center;void 0!==n?i.copy(n):t.setFromPoints(e).getCenter(i);for(var r=n=0,o=e.length;r<o;r++)n=Math.max(n,i.distanceToSquared(e[r]));return this.radius=Math.sqrt(n),this}}(),clone:function(){return(new this.constructor).copy(this)},copy:function(t){return this.center.copy(t.center),this.radius=t.radius,this},empty:function(){return 0>=this.radius},containsPoint:function(t){return t.distanceToSquared(this.center)<=this.radius*this.radius},distanceToPoint:function(t){return t.distanceTo(this.center)-this.radius},intersectsSphere:function(t){var e=this.radius+t.radius;return t.center.distanceToSquared(this.center)<=e*e},intersectsBox:function(t){return t.intersectsSphere(this)},intersectsPlane:function(t){return Math.abs(t.distanceToPoint(this.center))<=this.radius},clampPoint:function(t,e){var n=this.center.distanceToSquared(t);return void 0===e&&(console.warn("THREE.Sphere: .clampPoint() target is now required"),e=new o),e.copy(t),n>this.radius*this.radius&&(e.sub(this.center).normalize(),e.multiplyScalar(this.radius).add(this.center)),e},getBoundingBox:function(t){return void 0===t&&(console.warn("THREE.Sphere: .getBoundingBox() target is now required"),t=new p),t.set(this.center,this.center),t.expandByScalar(this.radius),t},applyMatrix4:function(t){return this.center.applyMatrix4(t),this.radius*=t.getMaxScaleOnAxis(),this},translate:function(t){return this.center.add(t),this},equals:function(t){return t.center.equals(this.center)&&t.radius===this.radius}}),Object.assign(f.prototype,{set:function(t,e){return this.normal.copy(t),this.constant=e,this},setComponents:function(t,e,n,i){return this.normal.set(t,e,n),this.constant=i,this},setFromNormalAndCoplanarPoint:function(t,e){return this.normal.copy(t),this.constant=-e.dot(this.normal),this},setFromCoplanarPoints:function(){var t=new o,e=new o;return function(n,i,r){return i=t.subVectors(r,i).cross(e.subVectors(n,i)).normalize(),this.setFromNormalAndCoplanarPoint(i,n),this}}(),clone:function(){return(new this.constructor).copy(this)},copy:function(t){return this.normal.copy(t.normal),this.constant=t.constant,this},normalize:function(){var t=1/this.normal.length();return this.normal.multiplyScalar(t),this.constant*=t,this},negate:function(){return this.constant*=-1,this.normal.negate(),this},distanceToPoint:function(t){return this.normal.dot(t)+this.constant},distanceToSphere:function(t){return this.distanceToPoint(t.center)-t.radius},projectPoint:function(t,e){return void 0===e&&(console.warn("THREE.Plane: .projectPoint() target is now required"),e=new o),e.copy(this.normal).multiplyScalar(-this.distanceToPoint(t)).add(t)},intersectLine:function(){var t=new o;return function(e,n){void 0===n&&(console.warn("THREE.Plane: .intersectLine() target is now required"),n=new o);var i=e.delta(t),r=this.normal.dot(i);if(0===r){if(0===this.distanceToPoint(e.start))return n.copy(e.start)}else if(!(0>(r=-(e.start.dot(this.normal)+this.constant)/r)||1<r))return n.copy(i).multiplyScalar(r).add(e.start)}}(),intersectsLine:function(t){var e=this.distanceToPoint(t.start);return t=this.distanceToPoint(t.end),0>e&&0<t||0>t&&0<e},intersectsBox:function(t){return t.intersectsPlane(this)},intersectsSphere:function(t){return t.intersectsPlane(this)},coplanarPoint:function(t){return void 0===t&&(console.warn("THREE.Plane: .coplanarPoint() target is now required"),t=new o),t.copy(this.normal).multiplyScalar(-this.constant)},applyMatrix4:function(){var t=new o,e=new a;return function(n,i){return i=i||e.getNormalMatrix(n),n=this.coplanarPoint(t).applyMatrix4(n),i=this.normal.applyMatrix3(i).normalize(),this.constant=-n.dot(i),this}}(),translate:function(t){return this.constant-=t.dot(this.normal),this},equals:function(t){return t.normal.equals(this.normal)&&t.constant===this.constant}}),Object.assign(m.prototype,{set:function(t,e,n,i,r,o){var a=this.planes;return a[0].copy(t),a[1].copy(e),a[2].copy(n),a[3].copy(i),a[4].copy(r),a[5].copy(o),this},clone:function(){return(new this.constructor).copy(this)},copy:function(t){for(var e=this.planes,n=0;6>n;n++)e[n].copy(t.planes[n]);return this},setFromMatrix:function(t){var e=this.planes,n=t.elements;t=n[0];var i=n[1],r=n[2],o=n[3],a=n[4],s=n[5],c=n[6],h=n[7],l=n[8],u=n[9],p=n[10],d=n[11],f=n[12],m=n[13],g=n[14];return n=n[15],e[0].setComponents(o-t,h-a,d-l,n-f).normalize(),e[1].setComponents(o+t,h+a,d+l,n+f).normalize(),e[2].setComponents(o+i,h+s,d+u,n+m).normalize(),e[3].setComponents(o-i,h-s,d-u,n-m).normalize(),e[4].setComponents(o-r,h-c,d-p,n-g).normalize(),e[5].setComponents(o+r,h+c,d+p,n+g).normalize(),this},intersectsObject:function(){var t=new d;return function(e){var n=e.geometry;return null===n.boundingSphere&&n.computeBoundingSphere(),t.copy(n.boundingSphere).applyMatrix4(e.matrixWorld),this.intersectsSphere(t)}}(),intersectsSprite:function(){var t=new d;return function(e){return t.center.set(0,0,0),t.radius=.7071067811865476,t.applyMatrix4(e.matrixWorld),this.intersectsSphere(t)}}(),intersectsSphere:function(t){var e=this.planes,n=t.center;t=-t.radius;for(var i=0;6>i;i++)if(e[i].distanceToPoint(n)<t)return!1;return!0},intersectsBox:function(){var t=new o,e=new o;return function(n){for(var i=this.planes,r=0;6>r;r++){var o=i[r];t.x=0<o.normal.x?n.min.x:n.max.x,e.x=0<o.normal.x?n.max.x:n.min.x,t.y=0<o.normal.y?n.min.y:n.max.y,e.y=0<o.normal.y?n.max.y:n.min.y,t.z=0<o.normal.z?n.min.z:n.max.z,e.z=0<o.normal.z?n.max.z:n.min.z;var a=o.distanceToPoint(t);if(o=o.distanceToPoint(e),0>a&&0>o)return!1}return!0}}(),containsPoint:function(t){for(var e=this.planes,n=0;6>n;n++)if(0>e[n].distanceToPoint(t))return!1;return!0}});var Lr={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 dotNV = saturate( dot( N, V ) );\n\tvec2 uv = vec2( roughness, sqrt( 1.0 - dotNV ) );\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.8543985 + ( 0.4965155 + 0.0145206 * y ) * y;\n\tfloat b = 3.4175940 + ( 4.1616724 + y ) * y;\n\tfloat v = a / b;\n\tfloat theta_sintheta = ( x > 0.0 ) ? v : 0.5 * inversesqrt( max( 1.0 - x * x, 1e-7 ) ) - 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\tfloat result = LTC_ClippedSphereFormFactor( vectorFormFactor );\n\treturn vec3( 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\tvec4 plane;\n\t#pragma unroll_loop\n\tfor ( int i = 0; i < UNION_CLIPPING_PLANES; i ++ ) {\n\t\tplane = clippingPlanes[ i ];\n\t\tif ( dot( vViewPosition, plane.xyz ) > plane.w ) discard;\n\t}\n\t#if UNION_CLIPPING_PLANES < NUM_CLIPPING_PLANES\n\t\tbool clipped = true;\n\t\t#pragma unroll_loop\n\t\tfor ( int i = UNION_CLIPPING_PLANES; i < NUM_CLIPPING_PLANES; i ++ ) {\n\t\t\tplane = clippingPlanes[ i ];\n\t\t\tclipped = ( dot( vViewPosition, plane.xyz ) > plane.w ) && clipped;\n\t\t}\n\t\tif ( clipped ) discard;\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\tuniform int maxMipLevel;\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\t#pragma unroll_loop\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\t#pragma unroll_loop\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\t#pragma unroll_loop\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\t#pragma unroll_loop\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_begin:"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 ltc_1;\tuniform sampler2D ltc_2;\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",lights_pars_maps:"#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\tvec4 t1 = texture2D( ltc_1, uv );\n\t\tvec4 t2 = texture2D( ltc_2, uv );\n\t\tmat3 mInv = mat3(\n\t\t\tvec3( t1.x, 0, t1.y ),\n\t\t\tvec3(    0, 1,    0 ),\n\t\t\tvec3( t1.z, 0, t1.w )\n\t\t);\n\t\tvec3 fresnel = ( material.specularColor * t2.x + ( vec3( 1.0 ) - material.specularColor ) * t2.y );\n\t\treflectedLight.directSpecular += lightColor * fresnel * LTC_Evaluate( normal, viewDir, position, mInv, rectCoords );\n\t\treflectedLight.directDiffuse += lightColor * material.diffuseColor * LTC_Evaluate( normal, viewDir, position, mat3( 1.0 ), 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_fragment_begin:"\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\t#pragma unroll_loop\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\t#pragma unroll_loop\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\t#pragma unroll_loop\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\t#pragma unroll_loop\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#if ( NUM_HEMI_LIGHTS > 0 )\n\t\t#pragma unroll_loop\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#endif\n#if defined( RE_IndirectSpecular )\n\tvec3 radiance = vec3( 0.0 );\n\tvec3 clearCoatRadiance = vec3( 0.0 );\n#endif\n",lights_fragment_maps:"#if defined( RE_IndirectDiffuse )\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 defined( USE_ENVMAP ) && defined( PHYSICAL ) && defined( ENVMAP_TYPE_CUBE_UV )\n\t\tirradiance += getLightProbeIndirectIrradiance( geometry, maxMipLevel );\n\t#endif\n#endif\n#if defined( USE_ENVMAP ) && defined( RE_IndirectSpecular )\n\tradiance += getLightProbeIndirectRadiance( geometry, Material_BlinnShininessExponent( material ), maxMipLevel );\n\t#ifndef STANDARD\n\t\tclearCoatRadiance += getLightProbeIndirectRadiance( geometry, Material_ClearCoat_BlinnShininessExponent( material ), maxMipLevel );\n\t#endif\n#endif\n",lights_fragment_end:"#if defined( RE_IndirectDiffuse )\n\tRE_IndirectDiffuse( irradiance, geometry, material, reflectedLight );\n#endif\n#if defined( RE_IndirectSpecular )\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_begin:"#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",normal_fragment_maps:"#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\tfloat scale = sign( st1.t * st0.s - st0.t * st1.s );\t\tscale *= float( gl_FrontFacing ) * 2.0 - 1.0;\n\t\tvec3 S = normalize( ( q0 * st1.t - q1 * st0.t ) * scale );\n\t\tvec3 T = normalize( ( - q0 * st1.s + q1 * st0.s ) * scale );\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\t#pragma unroll_loop\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\t#pragma unroll_loop\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\t#pragma unroll_loop\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\t#pragma unroll_loop\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\t#pragma unroll_loop\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\t#pragma unroll_loop\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( 1.0 - 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_begin>\n#include <lights_pars_maps>\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_begin>\n#include <lights_pars_maps>\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_begin>\n#include <lights_pars_maps>\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_begin>\n\t#include <normal_fragment_maps>\n\t#include <emissivemap_fragment>\n\t#include <lights_phong_fragment>\n\t#include <lights_fragment_begin>\n\t#include <lights_fragment_maps>\n\t#include <lights_fragment_end>\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_begin>\n#include <lights_pars_maps>\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_begin>\n\t#include <normal_fragment_maps>\n\t#include <emissivemap_fragment>\n\t#include <lights_physical_fragment>\n\t#include <lights_fragment_begin>\n\t#include <lights_fragment_maps>\n\t#include <lights_fragment_end>\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_begin>\n\t#include <normal_fragment_maps>\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_begin>\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"},Pr={merge:function(t){for(var e={},n=0;n<t.length;n++){var i,r=this.clone(t[n]);for(i in r)e[i]=r[i]}return e},clone:function(t){var e,n={};for(e in t)for(var i in n[e]={},t[e]){var r=t[e][i];r&&(r.isColor||r.isMatrix3||r.isMatrix4||r.isVector2||r.isVector3||r.isVector4||r.isTexture)?n[e][i]=r.clone():Array.isArray(r)?n[e][i]=r.slice():n[e][i]=r}return n}},Cr={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(g.prototype,{isColor:!0,r:1,g:1,b:1,set:function(t){return t&&t.isColor?this.copy(t):"number"==typeof t?this.setHex(t):"string"==typeof t&&this.setStyle(t),this},setScalar:function(t){return this.b=this.g=this.r=t,this},setHex:function(t){return t=Math.floor(t),this.r=(t>>16&255)/255,this.g=(t>>8&255)/255,this.b=(255&t)/255,this},setRGB:function(t,e,n){return this.r=t,this.g=e,this.b=n,this},setHSL:function(){function t(t,e,n){return 0>n&&(n+=1),1<n&&--n,n<1/6?t+6*(e-t)*n:.5>n?e:n<2/3?t+6*(e-t)*(2/3-n):t}return function(e,n,i){return e=Ar.euclideanModulo(e,1),n=Ar.clamp(n,0,1),i=Ar.clamp(i,0,1),0===n?this.r=this.g=this.b=i:(i=2*i-(n=.5>=i?i*(1+n):i+n-i*n),this.r=t(i,n,e+1/3),this.g=t(i,n,e),this.b=t(i,n,e-1/3)),this}}(),setStyle:function(t){function e(e){void 0!==e&&1>parseFloat(e)&&console.warn("THREE.Color: Alpha component of "+t+" will be ignored.")}var n;if(n=/^((?:rgb|hsl)a?)\(\s*([^\)]*)\)/.exec(t)){var i=n[2];switch(n[1]){case"rgb":case"rgba":if(n=/^(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(,\s*([0-9]*\.?[0-9]+)\s*)?$/.exec(i))return this.r=Math.min(255,parseInt(n[1],10))/255,this.g=Math.min(255,parseInt(n[2],10))/255,this.b=Math.min(255,parseInt(n[3],10))/255,e(n[5]),this;if(n=/^(\d+)%\s*,\s*(\d+)%\s*,\s*(\d+)%\s*(,\s*([0-9]*\.?[0-9]+)\s*)?$/.exec(i))return this.r=Math.min(100,parseInt(n[1],10))/100,this.g=Math.min(100,parseInt(n[2],10))/100,this.b=Math.min(100,parseInt(n[3],10))/100,e(n[5]),this;break;case"hsl":case"hsla":if(n=/^([0-9]*\.?[0-9]+)\s*,\s*(\d+)%\s*,\s*(\d+)%\s*(,\s*([0-9]*\.?[0-9]+)\s*)?$/.exec(i)){i=parseFloat(n[1])/360;var r=parseInt(n[2],10)/100,o=parseInt(n[3],10)/100;return e(n[5]),this.setHSL(i,r,o)}}}else if(n=/^#([A-Fa-f0-9]+)$/.exec(t)){if(3===(i=(n=n[1]).length))return this.r=parseInt(n.charAt(0)+n.charAt(0),16)/255,this.g=parseInt(n.charAt(1)+n.charAt(1),16)/255,this.b=parseInt(n.charAt(2)+n.charAt(2),16)/255,this;if(6===i)return this.r=parseInt(n.charAt(0)+n.charAt(1),16)/255,this.g=parseInt(n.charAt(2)+n.charAt(3),16)/255,this.b=parseInt(n.charAt(4)+n.charAt(5),16)/255,this}return t&&0<t.length&&(void 0!==(n=Cr[t])?this.setHex(n):console.warn("THREE.Color: Unknown color "+t)),this},clone:function(){return new this.constructor(this.r,this.g,this.b)},copy:function(t){return this.r=t.r,this.g=t.g,this.b=t.b,this},copyGammaToLinear:function(t,e){return void 0===e&&(e=2),this.r=Math.pow(t.r,e),this.g=Math.pow(t.g,e),this.b=Math.pow(t.b,e),this},copyLinearToGamma:function(t,e){return void 0===e&&(e=2),e=0<e?1/e:1,this.r=Math.pow(t.r,e),this.g=Math.pow(t.g,e),this.b=Math.pow(t.b,e),this},convertGammaToLinear:function(){var t=this.r,e=this.g,n=this.b;return this.r=t*t,this.g=e*e,this.b=n*n,this},convertLinearToGamma:function(){return this.r=Math.sqrt(this.r),this.g=Math.sqrt(this.g),this.b=Math.sqrt(this.b),this},getHex:function(){return 255*this.r<<16^255*this.g<<8^255*this.b<<0},getHexString:function(){return("000000"+this.getHex().toString(16)).slice(-6)},getHSL:function(t){void 0===t&&(console.warn("THREE.Color: .getHSL() target is now required"),t={h:0,s:0,l:0});var e,n=this.r,i=this.g,r=this.b,o=Math.max(n,i,r),a=Math.min(n,i,r),s=(a+o)/2;if(a===o)a=e=0;else{var c=o-a;switch(a=.5>=s?c/(o+a):c/(2-o-a),o){case n:e=(i-r)/c+(i<r?6:0);break;case i:e=(r-n)/c+2;break;case r:e=(n-i)/c+4}e/=6}return t.h=e,t.s=a,t.l=s,t},getStyle:function(){return"rgb("+(255*this.r|0)+","+(255*this.g|0)+","+(255*this.b|0)+")"},offsetHSL:function(){var t={};return function(e,n,i){return this.getHSL(t),t.h+=e,t.s+=n,t.l+=i,this.setHSL(t.h,t.s,t.l),this}}(),add:function(t){return this.r+=t.r,this.g+=t.g,this.b+=t.b,this},addColors:function(t,e){return this.r=t.r+e.r,this.g=t.g+e.g,this.b=t.b+e.b,this},addScalar:function(t){return this.r+=t,this.g+=t,this.b+=t,this},sub:function(t){return this.r=Math.max(0,this.r-t.r),this.g=Math.max(0,this.g-t.g),this.b=Math.max(0,this.b-t.b),this},multiply:function(t){return this.r*=t.r,this.g*=t.g,this.b*=t.b,this},multiplyScalar:function(t){return this.r*=t,this.g*=t,this.b*=t,this},lerp:function(t,e){return this.r+=(t.r-this.r)*e,this.g+=(t.g-this.g)*e,this.b+=(t.b-this.b)*e,this},equals:function(t){return t.r===this.r&&t.g===this.g&&t.b===this.b},fromArray:function(t,e){return void 0===e&&(e=0),this.r=t[e],this.g=t[e+1],this.b=t[e+2],this},toArray:function(t,e){return void 0===t&&(t=[]),void 0===e&&(e=0),t[e]=this.r,t[e+1]=this.g,t[e+2]=this.b,t},toJSON:function(){return this.getHex()}});var Or={common:{diffuse:{value:new g(15658734)},opacity:{value:1},map:{value:null},uvTransform:{value:new a},alphaMap:{value:null}},specularmap:{specularMap:{value:null}},envmap:{envMap:{value:null},flipEnvMap:{value:-1},reflectivity:{value:1},refractionRatio:{value:.98},maxMipLevel:{value:0}},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 n(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 g(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 g(15658734)},opacity:{value:1},size:{value:1},scale:{value:1},map:{value:null},uvTransform:{value:new a}}},Ir={basic:{uniforms:Pr.merge([Or.common,Or.specularmap,Or.envmap,Or.aomap,Or.lightmap,Or.fog]),vertexShader:Lr.meshbasic_vert,fragmentShader:Lr.meshbasic_frag},lambert:{uniforms:Pr.merge([Or.common,Or.specularmap,Or.envmap,Or.aomap,Or.lightmap,Or.emissivemap,Or.fog,Or.lights,{emissive:{value:new g(0)}}]),vertexShader:Lr.meshlambert_vert,fragmentShader:Lr.meshlambert_frag},phong:{uniforms:Pr.merge([Or.common,Or.specularmap,Or.envmap,Or.aomap,Or.lightmap,Or.emissivemap,Or.bumpmap,Or.normalmap,Or.displacementmap,Or.gradientmap,Or.fog,Or.lights,{emissive:{value:new g(0)},specular:{value:new g(1118481)},shininess:{value:30}}]),vertexShader:Lr.meshphong_vert,fragmentShader:Lr.meshphong_frag},standard:{uniforms:Pr.merge([Or.common,Or.envmap,Or.aomap,Or.lightmap,Or.emissivemap,Or.bumpmap,Or.normalmap,Or.displacementmap,Or.roughnessmap,Or.metalnessmap,Or.fog,Or.lights,{emissive:{value:new g(0)},roughness:{value:.5},metalness:{value:.5},envMapIntensity:{value:1}}]),vertexShader:Lr.meshphysical_vert,fragmentShader:Lr.meshphysical_frag},points:{uniforms:Pr.merge([Or.points,Or.fog]),vertexShader:Lr.points_vert,fragmentShader:Lr.points_frag},dashed:{uniforms:Pr.merge([Or.common,Or.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:Lr.linedashed_vert,fragmentShader:Lr.linedashed_frag},depth:{uniforms:Pr.merge([Or.common,Or.displacementmap]),vertexShader:Lr.depth_vert,fragmentShader:Lr.depth_frag},normal:{uniforms:Pr.merge([Or.common,Or.bumpmap,Or.normalmap,Or.displacementmap,{opacity:{value:1}}]),vertexShader:Lr.normal_vert,fragmentShader:Lr.normal_frag},cube:{uniforms:{tCube:{value:null},tFlip:{value:-1},opacity:{value:1}},vertexShader:Lr.cube_vert,fragmentShader:Lr.cube_frag},equirect:{uniforms:{tEquirect:{value:null}},vertexShader:Lr.equirect_vert,fragmentShader:Lr.equirect_frag},distanceRGBA:{uniforms:Pr.merge([Or.common,Or.displacementmap,{referencePosition:{value:new o},nearDistance:{value:1},farDistance:{value:1e3}}]),vertexShader:Lr.distanceRGBA_vert,fragmentShader:Lr.distanceRGBA_frag},shadow:{uniforms:Pr.merge([Or.lights,Or.fog,{color:{value:new g(0)},opacity:{value:1}}]),vertexShader:Lr.shadow_vert,fragmentShader:Lr.shadow_frag}};Ir.physical={uniforms:Pr.merge([Ir.standard.uniforms,{clearCoat:{value:0},clearCoatRoughness:{value:0}}]),vertexShader:Lr.meshphysical_vert,fragmentShader:Lr.meshphysical_frag},y.RotationOrders="XYZ YZX ZXY XZY YXZ ZYX".split(" "),y.DefaultOrder="XYZ",Object.defineProperties(y.prototype,{x:{get:function(){return this._x},set:function(t){this._x=t,this.onChangeCallback()}},y:{get:function(){return this._y},set:function(t){this._y=t,this.onChangeCallback()}},z:{get:function(){return this._z},set:function(t){this._z=t,this.onChangeCallback()}},order:{get:function(){return this._order},set:function(t){this._order=t,this.onChangeCallback()}}}),Object.assign(y.prototype,{isEuler:!0,set:function(t,e,n,i){return this._x=t,this._y=e,this._z=n,this._order=i||this._order,this.onChangeCallback(),this},clone:function(){return new this.constructor(this._x,this._y,this._z,this._order)},copy:function(t){return this._x=t._x,this._y=t._y,this._z=t._z,this._order=t._order,this.onChangeCallback(),this},setFromRotationMatrix:function(t,e,n){var i=Ar.clamp,r=t.elements;t=r[0];var o=r[4],a=r[8],s=r[1],c=r[5],h=r[9],l=r[2],u=r[6];return r=r[10],"XYZ"===(e=e||this._order)?(this._y=Math.asin(i(a,-1,1)),.99999>Math.abs(a)?(this._x=Math.atan2(-h,r),this._z=Math.atan2(-o,t)):(this._x=Math.atan2(u,c),this._z=0)):"YXZ"===e?(this._x=Math.asin(-i(h,-1,1)),.99999>Math.abs(h)?(this._y=Math.atan2(a,r),this._z=Math.atan2(s,c)):(this._y=Math.atan2(-l,t),this._z=0)):"ZXY"===e?(this._x=Math.asin(i(u,-1,1)),.99999>Math.abs(u)?(this._y=Math.atan2(-l,r),this._z=Math.atan2(-o,c)):(this._y=0,this._z=Math.atan2(s,t))):"ZYX"===e?(this._y=Math.asin(-i(l,-1,1)),.99999>Math.abs(l)?(this._x=Math.atan2(u,r),this._z=Math.atan2(s,t)):(this._x=0,this._z=Math.atan2(-o,c))):"YZX"===e?(this._z=Math.asin(i(s,-1,1)),.99999>Math.abs(s)?(this._x=Math.atan2(-h,c),this._y=Math.atan2(-l,t)):(this._x=0,this._y=Math.atan2(a,r))):"XZY"===e?(this._z=Math.asin(-i(o,-1,1)),.99999>Math.abs(o)?(this._x=Math.atan2(u,c),this._y=Math.atan2(a,t)):(this._x=Math.atan2(-h,r),this._y=0)):console.warn("THREE.Euler: .setFromRotationMatrix() given unsupported order: "+e),this._order=e,!1!==n&&this.onChangeCallback(),this},setFromQuaternion:function(){var t=new i;return function(e,n,i){return t.makeRotationFromQuaternion(e),this.setFromRotationMatrix(t,n,i)}}(),setFromVector3:function(t,e){return this.set(t.x,t.y,t.z,e||this._order)},reorder:function(){var t=new r;return function(e){return t.setFromEuler(this),this.setFromQuaternion(t,e)}}(),equals:function(t){return t._x===this._x&&t._y===this._y&&t._z===this._z&&t._order===this._order},fromArray:function(t){return this._x=t[0],this._y=t[1],this._z=t[2],void 0!==t[3]&&(this._order=t[3]),this.onChangeCallback(),this},toArray:function(t,e){return void 0===t&&(t=[]),void 0===e&&(e=0),t[e]=this._x,t[e+1]=this._y,t[e+2]=this._z,t[e+3]=this._order,t},toVector3:function(t){return t?t.set(this._x,this._y,this._z):new o(this._x,this._y,this._z)},onChange:function(t){return this.onChangeCallback=t,this},onChangeCallback:function(){}}),Object.assign(x.prototype,{set:function(t){this.mask=1<<t|0},enable:function(t){this.mask=this.mask|1<<t|0},toggle:function(t){this.mask^=1<<t|0},disable:function(t){this.mask&=~(1<<t|0)},test:function(t){return 0!=(this.mask&t.mask)}});var Nr=0;b.DefaultUp=new o(0,1,0),b.DefaultMatrixAutoUpdate=!0,b.prototype=Object.assign(Object.create(e.prototype),{constructor:b,isObject3D:!0,onBeforeRender:function(){},onAfterRender:function(){},applyMatrix:function(t){this.matrix.multiplyMatrices(t,this.matrix),this.matrix.decompose(this.position,this.quaternion,this.scale)},applyQuaternion:function(t){return this.quaternion.premultiply(t),this},setRotationFromAxisAngle:function(t,e){this.quaternion.setFromAxisAngle(t,e)},setRotationFromEuler:function(t){this.quaternion.setFromEuler(t,!0)},setRotationFromMatrix:function(t){this.quaternion.setFromRotationMatrix(t)},setRotationFromQuaternion:function(t){this.quaternion.copy(t)},rotateOnAxis:function(){var t=new r;return function(e,n){return t.setFromAxisAngle(e,n),this.quaternion.multiply(t),this}}(),rotateOnWorldAxis:function(){var t=new r;return function(e,n){return t.setFromAxisAngle(e,n),this.quaternion.premultiply(t),this}}(),rotateX:function(){var t=new o(1,0,0);return function(e){return this.rotateOnAxis(t,e)}}(),rotateY:function(){var t=new o(0,1,0);return function(e){return this.rotateOnAxis(t,e)}}(),rotateZ:function(){var t=new o(0,0,1);return function(e){return this.rotateOnAxis(t,e)}}(),translateOnAxis:function(){var t=new o;return function(e,n){return t.copy(e).applyQuaternion(this.quaternion),this.position.add(t.multiplyScalar(n)),this}}(),translateX:function(){var t=new o(1,0,0);return function(e){return this.translateOnAxis(t,e)}}(),translateY:function(){var t=new o(0,1,0);return function(e){return this.translateOnAxis(t,e)}}(),translateZ:function(){var t=new o(0,0,1);return function(e){return this.translateOnAxis(t,e)}}(),localToWorld:function(t){return t.applyMatrix4(this.matrixWorld)},worldToLocal:function(){var t=new i;return function(e){return e.applyMatrix4(t.getInverse(this.matrixWorld))}}(),lookAt:function(){var t=new i,e=new o;return function(n,i,r){n.isVector3?e.copy(n):e.set(n,i,r),this.isCamera?t.lookAt(this.position,e,this.up):t.lookAt(e,this.position,this.up),this.quaternion.setFromRotationMatrix(t)}}(),add:function(t){if(1<arguments.length){for(var e=0;e<arguments.length;e++)this.add(arguments[e]);return this}return t===this?(console.error("THREE.Object3D.add: object can't be added as a child of itself.",t),this):(t&&t.isObject3D?(null!==t.parent&&t.parent.remove(t),t.parent=this,t.dispatchEvent({type:"added"}),this.children.push(t)):console.error("THREE.Object3D.add: object not an instance of THREE.Object3D.",t),this)},remove:function(t){if(1<arguments.length){for(var e=0;e<arguments.length;e++)this.remove(arguments[e]);return this}return-1!==(e=this.children.indexOf(t))&&(t.parent=null,t.dispatchEvent({type:"removed"}),this.children.splice(e,1)),this},getObjectById:function(t){return this.getObjectByProperty("id",t)},getObjectByName:function(t){return this.getObjectByProperty("name",t)},getObjectByProperty:function(t,e){if(this[t]===e)return this;for(var n=0,i=this.children.length;n<i;n++){var r=this.children[n].getObjectByProperty(t,e);if(void 0!==r)return r}},getWorldPosition:function(t){return void 0===t&&(console.warn("THREE.Object3D: .getWorldPosition() target is now required"),t=new o),this.updateMatrixWorld(!0),t.setFromMatrixPosition(this.matrixWorld)},getWorldQuaternion:function(){var t=new o,e=new o;return function(n){return void 0===n&&(console.warn("THREE.Object3D: .getWorldQuaternion() target is now required"),n=new r),this.updateMatrixWorld(!0),this.matrixWorld.decompose(t,n,e),n}}(),getWorldScale:function(){var t=new o,e=new r;return function(n){return void 0===n&&(console.warn("THREE.Object3D: .getWorldScale() target is now required"),n=new o),this.updateMatrixWorld(!0),this.matrixWorld.decompose(t,e,n),n}}(),getWorldDirection:function(){var t=new r;return function(e){return void 0===e&&(console.warn("THREE.Object3D: .getWorldDirection() target is now required"),e=new o),this.getWorldQuaternion(t),e.set(0,0,1).applyQuaternion(t)}}(),raycast:function(){},traverse:function(t){t(this);for(var e=this.children,n=0,i=e.length;n<i;n++)e[n].traverse(t)},traverseVisible:function(t){if(!1!==this.visible){t(this);for(var e=this.children,n=0,i=e.length;n<i;n++)e[n].traverseVisible(t)}},traverseAncestors:function(t){var e=this.parent;null!==e&&(t(e),e.traverseAncestors(t))},updateMatrix:function(){this.matrix.compose(this.position,this.quaternion,this.scale),this.matrixWorldNeedsUpdate=!0},updateMatrixWorld:function(t){this.matrixAutoUpdate&&this.updateMatrix(),(this.matrixWorldNeedsUpdate||t)&&(null===this.parent?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix),this.matrixWorldNeedsUpdate=!1,t=!0);for(var e=this.children,n=0,i=e.length;n<i;n++)e[n].updateMatrixWorld(t)},toJSON:function(t){function e(e,n){return void 0===e[n.uuid]&&(e[n.uuid]=n.toJSON(t)),n.uuid}function n(t){var e,n=[];for(e in t){var i=t[e];delete i.metadata,n.push(i)}return n}var i=void 0===t||"string"==typeof t,r={};i&&(t={geometries:{},materials:{},textures:{},images:{},shapes:{}},r.metadata={version:4.5,type:"Object",generator:"Object3D.toJSON"});var o={};if(o.uuid=this.uuid,o.type=this.type,""!==this.name&&(o.name=this.name),!0===this.castShadow&&(o.castShadow=!0),!0===this.receiveShadow&&(o.receiveShadow=!0),!1===this.visible&&(o.visible=!1),!1===this.frustumCulled&&(o.frustumCulled=!1),0!==this.renderOrder&&(o.renderOrder=this.renderOrder),"{}"!==JSON.stringify(this.userData)&&(o.userData=this.userData),o.matrix=this.matrix.toArray(),!1===this.matrixAutoUpdate&&(o.matrixAutoUpdate=!1),void 0!==this.geometry){o.geometry=e(t.geometries,this.geometry);var a=this.geometry.parameters;if(void 0!==a&&void 0!==a.shapes)if(a=a.shapes,Array.isArray(a))for(var s=0,c=a.length;s<c;s++)e(t.shapes,a[s]);else e(t.shapes,a)}if(void 0!==this.material)if(Array.isArray(this.material)){for(a=[],s=0,c=this.material.length;s<c;s++)a.push(e(t.materials,this.material[s]));o.material=a}else o.material=e(t.materials,this.material);if(0<this.children.length)for(o.children=[],s=0;s<this.children.length;s++)o.children.push(this.children[s].toJSON(t).object);if(i){i=n(t.geometries),s=n(t.materials),c=n(t.textures);var h=n(t.images);a=n(t.shapes),0<i.length&&(r.geometries=i),0<s.length&&(r.materials=s),0<c.length&&(r.textures=c),0<h.length&&(r.images=h),0<a.length&&(r.shapes=a)}return r.object=o,r},clone:function(t){return(new this.constructor).copy(this,t)},copy:function(t,e){if(void 0===e&&(e=!0),this.name=t.name,this.up.copy(t.up),this.position.copy(t.position),this.quaternion.copy(t.quaternion),this.scale.copy(t.scale),this.matrix.copy(t.matrix),this.matrixWorld.copy(t.matrixWorld),this.matrixAutoUpdate=t.matrixAutoUpdate,this.matrixWorldNeedsUpdate=t.matrixWorldNeedsUpdate,this.layers.mask=t.layers.mask,this.visible=t.visible,this.castShadow=t.castShadow,this.receiveShadow=t.receiveShadow,this.frustumCulled=t.frustumCulled,this.renderOrder=t.renderOrder,this.userData=JSON.parse(JSON.stringify(t.userData)),!0===e)for(e=0;e<t.children.length;e++)this.add(t.children[e].clone());return this}}),w.prototype=Object.assign(Object.create(b.prototype),{constructor:w,isCamera:!0,copy:function(t,e){return b.prototype.copy.call(this,t,e),this.matrixWorldInverse.copy(t.matrixWorldInverse),this.projectionMatrix.copy(t.projectionMatrix),this},getWorldDirection:function(){var t=new r;return function(e){return void 0===e&&(console.warn("THREE.Camera: .getWorldDirection() target is now required"),e=new o),this.getWorldQuaternion(t),e.set(0,0,-1).applyQuaternion(t)}}(),updateMatrixWorld:function(t){b.prototype.updateMatrixWorld.call(this,t),this.matrixWorldInverse.getInverse(this.matrixWorld)},clone:function(){return(new this.constructor).copy(this)}}),_.prototype=Object.assign(Object.create(w.prototype),{constructor:_,isOrthographicCamera:!0,copy:function(t,e){return w.prototype.copy.call(this,t,e),this.left=t.left,this.right=t.right,this.top=t.top,this.bottom=t.bottom,this.near=t.near,this.far=t.far,this.zoom=t.zoom,this.view=null===t.view?null:Object.assign({},t.view),this},setViewOffset:function(t,e,n,i,r,o){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=t,this.view.fullHeight=e,this.view.offsetX=n,this.view.offsetY=i,this.view.width=r,this.view.height=o,this.updateProjectionMatrix()},clearViewOffset:function(){null!==this.view&&(this.view.enabled=!1),this.updateProjectionMatrix()},updateProjectionMatrix:function(){var t=(this.right-this.left)/(2*this.zoom),e=(this.top-this.bottom)/(2*this.zoom),n=(this.right+this.left)/2,i=(this.top+this.bottom)/2,r=n-t;if(n+=t,t=i+e,e=i-e,null!==this.view&&this.view.enabled){n=this.zoom/(this.view.width/this.view.fullWidth),e=this.zoom/(this.view.height/this.view.fullHeight);var o=(this.right-this.left)/this.view.width;i=(this.top-this.bottom)/this.view.height,n=(r+=this.view.offsetX/n*o)+this.view.width/n*o,e=(t-=this.view.offsetY/e*i)-this.view.height/e*i}this.projectionMatrix.makeOrthographic(r,n,t,e,this.near,this.far)},toJSON:function(t){return(t=b.prototype.toJSON.call(this,t)).object.zoom=this.zoom,t.object.left=this.left,t.object.right=this.right,t.object.top=this.top,t.object.bottom=this.bottom,t.object.near=this.near,t.object.far=this.far,null!==this.view&&(t.object.view=Object.assign({},this.view)),t}}),Object.assign(M.prototype,{clone:function(){return(new this.constructor).copy(this)},copy:function(t){this.a=t.a,this.b=t.b,this.c=t.c,this.normal.copy(t.normal),this.color.copy(t.color),this.materialIndex=t.materialIndex;for(var e=0,n=t.vertexNormals.length;e<n;e++)this.vertexNormals[e]=t.vertexNormals[e].clone();for(e=0,n=t.vertexColors.length;e<n;e++)this.vertexColors[e]=t.vertexColors[e].clone();return this}});var Ur=0;E.prototype=Object.assign(Object.create(e.prototype),{constructor:E,isGeometry:!0,applyMatrix:function(t){for(var e=(new a).getNormalMatrix(t),n=0,i=this.vertices.length;n<i;n++)this.vertices[n].applyMatrix4(t);for(n=0,i=this.faces.length;n<i;n++){(t=this.faces[n]).normal.applyMatrix3(e).normalize();for(var r=0,o=t.vertexNormals.length;r<o;r++)t.vertexNormals[r].applyMatrix3(e).normalize()}return null!==this.boundingBox&&this.computeBoundingBox(),null!==this.boundingSphere&&this.computeBoundingSphere(),this.normalsNeedUpdate=this.verticesNeedUpdate=!0,this},rotateX:function(){var t=new i;return function(e){return t.makeRotationX(e),this.applyMatrix(t),this}}(),rotateY:function(){var t=new i;return function(e){return t.makeRotationY(e),this.applyMatrix(t),this}}(),rotateZ:function(){var t=new i;return function(e){return t.makeRotationZ(e),this.applyMatrix(t),this}}(),translate:function(){var t=new i;return function(e,n,i){return t.makeTranslation(e,n,i),this.applyMatrix(t),this}}(),scale:function(){var t=new i;return function(e,n,i){return t.makeScale(e,n,i),this.applyMatrix(t),this}}(),lookAt:function(){var t=new b;return function(e){t.lookAt(e),t.updateMatrix(),this.applyMatrix(t.matrix)}}(),fromBufferGeometry:function(t){function e(t,e,n,r){r=new M(t,e,n,void 0!==c?[p[t].clone(),p[e].clone(),p[n].clone()]:[],void 0!==h?[i.colors[t].clone(),i.colors[e].clone(),i.colors[n].clone()]:[],r),i.faces.push(r),void 0!==l&&i.faceVertexUvs[0].push([d[t].clone(),d[e].clone(),d[n].clone()]),void 0!==u&&i.faceVertexUvs[1].push([f[t].clone(),f[e].clone(),f[n].clone()])}var i=this,r=null!==t.index?t.index.array:void 0,a=t.attributes,s=a.position.array,c=void 0!==a.normal?a.normal.array:void 0,h=void 0!==a.color?a.color.array:void 0,l=void 0!==a.uv?a.uv.array:void 0,u=void 0!==a.uv2?a.uv2.array:void 0;void 0!==u&&(this.faceVertexUvs[1]=[]);for(var p=[],d=[],f=[],m=a=0;a<s.length;a+=3,m+=2)i.vertices.push(new o(s[a],s[a+1],s[a+2])),void 0!==c&&p.push(new o(c[a],c[a+1],c[a+2])),void 0!==h&&i.colors.push(new g(h[a],h[a+1],h[a+2])),void 0!==l&&d.push(new n(l[m],l[m+1])),void 0!==u&&f.push(new n(u[m],u[m+1]));var v=t.groups;if(0<v.length)for(a=0;a<v.length;a++){var y=(s=v[a]).start;for(m=y,y+=s.count;m<y;m+=3)void 0!==r?e(r[m],r[m+1],r[m+2],s.materialIndex):e(m,m+1,m+2,s.materialIndex)}else if(void 0!==r)for(a=0;a<r.length;a+=3)e(r[a],r[a+1],r[a+2]);else for(a=0;a<s.length/3;a+=3)e(a,a+1,a+2);return this.computeFaceNormals(),null!==t.boundingBox&&(this.boundingBox=t.boundingBox.clone()),null!==t.boundingSphere&&(this.boundingSphere=t.boundingSphere.clone()),this},center:function(){var t=new o;return function(){return this.computeBoundingBox(),this.boundingBox.getCenter(t).negate(),this.translate(t.x,t.y,t.z),this}}(),normalize:function(){this.computeBoundingSphere();var t=this.boundingSphere.center,e=this.boundingSphere.radius;e=0===e?1:1/e;var n=new i;return n.set(e,0,0,-e*t.x,0,e,0,-e*t.y,0,0,e,-e*t.z,0,0,0,1),this.applyMatrix(n),this},computeFaceNormals:function(){for(var t=new o,e=new o,n=0,i=this.faces.length;n<i;n++){var r=this.faces[n],a=this.vertices[r.a],s=this.vertices[r.b];t.subVectors(this.vertices[r.c],s),e.subVectors(a,s),t.cross(e),t.normalize(),r.normal.copy(t)}},computeVertexNormals:function(t){var e;void 0===t&&(t=!0);var n=Array(this.vertices.length),i=0;for(e=this.vertices.length;i<e;i++)n[i]=new o;if(t){var r=new o,a=new o;for(t=0,i=this.faces.length;t<i;t++){e=this.faces[t];var s=this.vertices[e.a],c=this.vertices[e.b],h=this.vertices[e.c];r.subVectors(h,c),a.subVectors(s,c),r.cross(a),n[e.a].add(r),n[e.b].add(r),n[e.c].add(r)}}else for(this.computeFaceNormals(),t=0,i=this.faces.length;t<i;t++)n[(e=this.faces[t]).a].add(e.normal),n[e.b].add(e.normal),n[e.c].add(e.normal);for(i=0,e=this.vertices.length;i<e;i++)n[i].normalize();for(t=0,i=this.faces.length;t<i;t++)3===(s=(e=this.faces[t]).vertexNormals).length?(s[0].copy(n[e.a]),s[1].copy(n[e.b]),s[2].copy(n[e.c])):(s[0]=n[e.a].clone(),s[1]=n[e.b].clone(),s[2]=n[e.c].clone());0<this.faces.length&&(this.normalsNeedUpdate=!0)},computeFlatVertexNormals:function(){var t;this.computeFaceNormals();var e=0;for(t=this.faces.length;e<t;e++){var n=this.faces[e],i=n.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 t,e,n=0;for(e=this.faces.length;n<e;n++){var i=this.faces[n];i.__originalFaceNormal?i.__originalFaceNormal.copy(i.normal):i.__originalFaceNormal=i.normal.clone(),i.__originalVertexNormals||(i.__originalVertexNormals=[]);var r=0;for(t=i.vertexNormals.length;r<t;r++)i.__originalVertexNormals[r]?i.__originalVertexNormals[r].copy(i.vertexNormals[r]):i.__originalVertexNormals[r]=i.vertexNormals[r].clone()}var a=new E;for(a.faces=this.faces,r=0,t=this.morphTargets.length;r<t;r++){if(!this.morphNormals[r]){this.morphNormals[r]={},this.morphNormals[r].faceNormals=[],this.morphNormals[r].vertexNormals=[],i=this.morphNormals[r].faceNormals;var s=this.morphNormals[r].vertexNormals;for(n=0,e=this.faces.length;n<e;n++){var c=new o,h={a:new o,b:new o,c:new o};i.push(c),s.push(h)}}for(s=this.morphNormals[r],a.vertices=this.morphTargets[r].vertices,a.computeFaceNormals(),a.computeVertexNormals(),n=0,e=this.faces.length;n<e;n++)i=this.faces[n],c=s.faceNormals[n],h=s.vertexNormals[n],c.copy(i.normal),h.a.copy(i.vertexNormals[0]),h.b.copy(i.vertexNormals[1]),h.c.copy(i.vertexNormals[2])}for(n=0,e=this.faces.length;n<e;n++)(i=this.faces[n]).normal=i.__originalFaceNormal,i.vertexNormals=i.__originalVertexNormals},computeBoundingBox:function(){null===this.boundingBox&&(this.boundingBox=new p),this.boundingBox.setFromPoints(this.vertices)},computeBoundingSphere:function(){null===this.boundingSphere&&(this.boundingSphere=new d),this.boundingSphere.setFromPoints(this.vertices)},merge:function(t,e,n){if(t&&t.isGeometry){var i,r=this.vertices.length,o=this.vertices,s=t.vertices,c=this.faces,h=t.faces,l=this.faceVertexUvs[0],u=t.faceVertexUvs[0],p=this.colors,d=t.colors;void 0===n&&(n=0),void 0!==e&&(i=(new a).getNormalMatrix(e)),t=0;for(var f=s.length;t<f;t++){var m=s[t].clone();void 0!==e&&m.applyMatrix4(e),o.push(m)}for(t=0,f=d.length;t<f;t++)p.push(d[t].clone());for(t=0,f=h.length;t<f;t++){var g=(s=h[t]).vertexNormals;for(d=s.vertexColors,(p=new M(s.a+r,s.b+r,s.c+r)).normal.copy(s.normal),void 0!==i&&p.normal.applyMatrix3(i).normalize(),e=0,o=g.length;e<o;e++)m=g[e].clone(),void 0!==i&&m.applyMatrix3(i).normalize(),p.vertexNormals.push(m);for(p.color.copy(s.color),e=0,o=d.length;e<o;e++)m=d[e],p.vertexColors.push(m.clone());p.materialIndex=s.materialIndex+n,c.push(p)}for(t=0,f=u.length;t<f;t++)if(i=[],void 0!==(n=u[t])){for(e=0,o=n.length;e<o;e++)i.push(n[e].clone());l.push(i)}}else console.error("THREE.Geometry.merge(): geometry not an instance of THREE.Geometry.",t)},mergeMesh:function(t){t&&t.isMesh?(t.matrixAutoUpdate&&t.updateMatrix(),this.merge(t.geometry,t.matrix)):console.error("THREE.Geometry.mergeMesh(): mesh not an instance of THREE.Mesh.",t)},mergeVertices:function(){var t,e={},n=[],i=[],r=Math.pow(10,4),o=0;for(t=this.vertices.length;o<t;o++){var a=this.vertices[o];void 0===e[a=Math.round(a.x*r)+"_"+Math.round(a.y*r)+"_"+Math.round(a.z*r)]?(e[a]=o,n.push(this.vertices[o]),i[o]=n.length-1):i[o]=i[e[a]]}for(e=[],o=0,t=this.faces.length;o<t;o++)for((r=this.faces[o]).a=i[r.a],r.b=i[r.b],r.c=i[r.c],r=[r.a,r.b,r.c],a=0;3>a;a++)if(r[a]===r[(a+1)%3]){e.push(o);break}for(o=e.length-1;0<=o;o--)for(r=e[o],this.faces.splice(r,1),i=0,t=this.faceVertexUvs.length;i<t;i++)this.faceVertexUvs[i].splice(r,1);return o=this.vertices.length-n.length,this.vertices=n,o},setFromPoints:function(t){this.vertices=[];for(var e=0,n=t.length;e<n;e++){var i=t[e];this.vertices.push(new o(i.x,i.y,i.z||0))}return this},sortFacesByMaterialIndex:function(){for(var t=this.faces,e=t.length,n=0;n<e;n++)t[n]._id=n;t.sort(function(t,e){return t.materialIndex-e.materialIndex});var i,r,o=this.faceVertexUvs[0],a=this.faceVertexUvs[1];for(o&&o.length===e&&(i=[]),a&&a.length===e&&(r=[]),n=0;n<e;n++){var s=t[n]._id;i&&i.push(o[s]),r&&r.push(a[s])}i&&(this.faceVertexUvs[0]=i),r&&(this.faceVertexUvs[1]=r)},toJSON:function(){function t(t,e,n){return n?t|1<<e:t&~(1<<e)}function e(t){var e=t.x.toString()+t.y.toString()+t.z.toString();return void 0!==h[e]?h[e]:(h[e]=c.length/3,c.push(t.x,t.y,t.z),h[e])}function n(t){var e=t.r.toString()+t.g.toString()+t.b.toString();return void 0!==u[e]?u[e]:(u[e]=l.length,l.push(t.getHex()),u[e])}function i(t){var e=t.x.toString()+t.y.toString();return void 0!==d[e]?d[e]:(d[e]=p.length/2,p.push(t.x,t.y),d[e])}var r={metadata:{version:4.5,type:"Geometry",generator:"Geometry.toJSON"}};if(r.uuid=this.uuid,r.type=this.type,""!==this.name&&(r.name=this.name),void 0!==this.parameters){var o,a=this.parameters;for(o in a)void 0!==a[o]&&(r[o]=a[o]);return r}for(a=[],o=0;o<this.vertices.length;o++){var s=this.vertices[o];a.push(s.x,s.y,s.z)}s=[];var c=[],h={},l=[],u={},p=[],d={};for(o=0;o<this.faces.length;o++){var f=this.faces[o],m=void 0!==this.faceVertexUvs[0][o],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,b=0;b=t(b=t(b=t(b=t(b=t(b=t(b=t(b=t(b,0,0),1,!0),2,!1),3,m),4,g),5,v),6,y),7,x),s.push(b),s.push(f.a,f.b,f.c),s.push(f.materialIndex),m&&(m=this.faceVertexUvs[0][o],s.push(i(m[0]),i(m[1]),i(m[2]))),g&&s.push(e(f.normal)),v&&(g=f.vertexNormals,s.push(e(g[0]),e(g[1]),e(g[2]))),y&&s.push(n(f.color)),x&&(f=f.vertexColors,s.push(n(f[0]),n(f[1]),n(f[2])))}return r.data={},r.data.vertices=a,r.data.normals=c,0<l.length&&(r.data.colors=l),0<p.length&&(r.data.uvs=[p]),r.data.faces=s,r},clone:function(){return(new E).copy(this)},copy:function(t){var e,n,i;this.vertices=[],this.colors=[],this.faces=[],this.faceVertexUvs=[[]],this.morphTargets=[],this.morphNormals=[],this.skinWeights=[],this.skinIndices=[],this.lineDistances=[],this.boundingSphere=this.boundingBox=null,this.name=t.name;var r=t.vertices,o=0;for(e=r.length;o<e;o++)this.vertices.push(r[o].clone());for(o=0,e=(r=t.colors).length;o<e;o++)this.colors.push(r[o].clone());for(o=0,e=(r=t.faces).length;o<e;o++)this.faces.push(r[o].clone());for(o=0,e=t.faceVertexUvs.length;o<e;o++){var a=t.faceVertexUvs[o];for(void 0===this.faceVertexUvs[o]&&(this.faceVertexUvs[o]=[]),r=0,n=a.length;r<n;r++){var s=a[r],c=[],h=0;for(i=s.length;h<i;h++)c.push(s[h].clone());this.faceVertexUvs[o].push(c)}}for(o=0,e=(h=t.morphTargets).length;o<e;o++){if((i={}).name=h[o].name,void 0!==h[o].vertices)for(i.vertices=[],r=0,n=h[o].vertices.length;r<n;r++)i.vertices.push(h[o].vertices[r].clone());if(void 0!==h[o].normals)for(i.normals=[],r=0,n=h[o].normals.length;r<n;r++)i.normals.push(h[o].normals[r].clone());this.morphTargets.push(i)}for(o=0,e=(h=t.morphNormals).length;o<e;o++){if(i={},void 0!==h[o].vertexNormals)for(i.vertexNormals=[],r=0,n=h[o].vertexNormals.length;r<n;r++)a=h[o].vertexNormals[r],(s={}).a=a.a.clone(),s.b=a.b.clone(),s.c=a.c.clone(),i.vertexNormals.push(s);if(void 0!==h[o].faceNormals)for(i.faceNormals=[],r=0,n=h[o].faceNormals.length;r<n;r++)i.faceNormals.push(h[o].faceNormals[r].clone());this.morphNormals.push(i)}for(o=0,e=(r=t.skinWeights).length;o<e;o++)this.skinWeights.push(r[o].clone());for(o=0,e=(r=t.skinIndices).length;o<e;o++)this.skinIndices.push(r[o].clone());for(o=0,e=(r=t.lineDistances).length;o<e;o++)this.lineDistances.push(r[o]);return null!==(o=t.boundingBox)&&(this.boundingBox=o.clone()),null!==(o=t.boundingSphere)&&(this.boundingSphere=o.clone()),this.elementsNeedUpdate=t.elementsNeedUpdate,this.verticesNeedUpdate=t.verticesNeedUpdate,this.uvsNeedUpdate=t.uvsNeedUpdate,this.normalsNeedUpdate=t.normalsNeedUpdate,this.colorsNeedUpdate=t.colorsNeedUpdate,this.lineDistancesNeedUpdate=t.lineDistancesNeedUpdate,this.groupsNeedUpdate=t.groupsNeedUpdate,this},dispose:function(){this.dispatchEvent({type:"dispose"})}}),Object.defineProperty(T.prototype,"needsUpdate",{set:function(t){!0===t&&this.version++}}),Object.assign(T.prototype,{isBufferAttribute:!0,onUploadCallback:function(){},setArray:function(t){if(Array.isArray(t))throw new TypeError("THREE.BufferAttribute: array should be a Typed Array.");return this.count=void 0!==t?t.length/this.itemSize:0,this.array=t,this},setDynamic:function(t){return this.dynamic=t,this},copy:function(t){return this.name=t.name,this.array=new t.array.constructor(t.array),this.itemSize=t.itemSize,this.count=t.count,this.normalized=t.normalized,this.dynamic=t.dynamic,this},copyAt:function(t,e,n){t*=this.itemSize,n*=e.itemSize;for(var i=0,r=this.itemSize;i<r;i++)this.array[t+i]=e.array[n+i];return this},copyArray:function(t){return this.array.set(t),this},copyColorsArray:function(t){for(var e=this.array,n=0,i=0,r=t.length;i<r;i++){var o=t[i];void 0===o&&(console.warn("THREE.BufferAttribute.copyColorsArray(): color is undefined",i),o=new g),e[n++]=o.r,e[n++]=o.g,e[n++]=o.b}return this},copyVector2sArray:function(t){for(var e=this.array,i=0,r=0,o=t.length;r<o;r++){var a=t[r];void 0===a&&(console.warn("THREE.BufferAttribute.copyVector2sArray(): vector is undefined",r),a=new n),e[i++]=a.x,e[i++]=a.y}return this},copyVector3sArray:function(t){for(var e=this.array,n=0,i=0,r=t.length;i<r;i++){var a=t[i];void 0===a&&(console.warn("THREE.BufferAttribute.copyVector3sArray(): vector is undefined",i),a=new o),e[n++]=a.x,e[n++]=a.y,e[n++]=a.z}return this},copyVector4sArray:function(t){for(var e=this.array,n=0,i=0,r=t.length;i<r;i++){var o=t[i];void 0===o&&(console.warn("THREE.BufferAttribute.copyVector4sArray(): vector is undefined",i),o=new c),e[n++]=o.x,e[n++]=o.y,e[n++]=o.z,e[n++]=o.w}return this},set:function(t,e){return void 0===e&&(e=0),this.array.set(t,e),this},getX:function(t){return this.array[t*this.itemSize]},setX:function(t,e){return this.array[t*this.itemSize]=e,this},getY:function(t){return this.array[t*this.itemSize+1]},setY:function(t,e){return this.array[t*this.itemSize+1]=e,this},getZ:function(t){return this.array[t*this.itemSize+2]},setZ:function(t,e){return this.array[t*this.itemSize+2]=e,this},getW:function(t){return this.array[t*this.itemSize+3]},setW:function(t,e){return this.array[t*this.itemSize+3]=e,this},setXY:function(t,e,n){return t*=this.itemSize,this.array[t+0]=e,this.array[t+1]=n,this},setXYZ:function(t,e,n,i){return t*=this.itemSize,this.array[t+0]=e,this.array[t+1]=n,this.array[t+2]=i,this},setXYZW:function(t,e,n,i,r){return t*=this.itemSize,this.array[t+0]=e,this.array[t+1]=n,this.array[t+2]=i,this.array[t+3]=r,this},onUpload:function(t){return this.onUploadCallback=t,this},clone:function(){return new this.constructor(this.array,this.itemSize).copy(this)}}),S.prototype=Object.create(T.prototype),S.prototype.constructor=S,A.prototype=Object.create(T.prototype),A.prototype.constructor=A,R.prototype=Object.create(T.prototype),R.prototype.constructor=R,L.prototype=Object.create(T.prototype),L.prototype.constructor=L,P.prototype=Object.create(T.prototype),P.prototype.constructor=P,C.prototype=Object.create(T.prototype),C.prototype.constructor=C,O.prototype=Object.create(T.prototype),O.prototype.constructor=O,I.prototype=Object.create(T.prototype),I.prototype.constructor=I,N.prototype=Object.create(T.prototype),N.prototype.constructor=N,Object.assign(U.prototype,{computeGroups:function(t){var e=[],n=void 0;t=t.faces;for(var i=0;i<t.length;i++){var r=t[i];if(r.materialIndex!==n){n=r.materialIndex,void 0!==o&&(o.count=3*i-o.start,e.push(o));var o={start:3*i,materialIndex:n}}}void 0!==o&&(o.count=3*i-o.start,e.push(o)),this.groups=e},fromGeometry:function(t){var e=t.faces,i=t.vertices,r=t.faceVertexUvs,o=r[0]&&0<r[0].length,a=r[1]&&0<r[1].length,s=t.morphTargets,c=s.length;if(0<c){for(var h=[],l=0;l<c;l++)h[l]=[];this.morphTargets.position=h}var u=t.morphNormals,p=u.length;if(0<p){var d=[];for(l=0;l<p;l++)d[l]=[];this.morphTargets.normal=d}var f=t.skinIndices,m=t.skinWeights,g=f.length===i.length,v=m.length===i.length;for(l=0;l<e.length;l++){var y=e[l];this.vertices.push(i[y.a],i[y.b],i[y.c]);var x=y.vertexNormals;for(3===x.length?this.normals.push(x[0],x[1],x[2]):(x=y.normal,this.normals.push(x,x,x)),3===(x=y.vertexColors).length?this.colors.push(x[0],x[1],x[2]):(x=y.color,this.colors.push(x,x,x)),!0===o&&(void 0!==(x=r[0][l])?this.uvs.push(x[0],x[1],x[2]):(console.warn("THREE.DirectGeometry.fromGeometry(): Undefined vertexUv ",l),this.uvs.push(new n,new n,new n))),!0===a&&(void 0!==(x=r[1][l])?this.uvs2.push(x[0],x[1],x[2]):(console.warn("THREE.DirectGeometry.fromGeometry(): Undefined vertexUv2 ",l),this.uvs2.push(new n,new n,new n))),x=0;x<c;x++){var b=s[x].vertices;h[x].push(b[y.a],b[y.b],b[y.c])}for(x=0;x<p;x++)b=u[x].vertexNormals[l],d[x].push(b.a,b.b,b.c);g&&this.skinIndices.push(f[y.a],f[y.b],f[y.c]),v&&this.skinWeights.push(m[y.a],m[y.b],m[y.c])}return this.computeGroups(t),this.verticesNeedUpdate=t.verticesNeedUpdate,this.normalsNeedUpdate=t.normalsNeedUpdate,this.colorsNeedUpdate=t.colorsNeedUpdate,this.uvsNeedUpdate=t.uvsNeedUpdate,this.groupsNeedUpdate=t.groupsNeedUpdate,this}});var Dr=1;B.prototype=Object.assign(Object.create(e.prototype),{constructor:B,isBufferGeometry:!0,getIndex:function(){return this.index},setIndex:function(t){Array.isArray(t)?this.index=new(65535<D(t)?O:P)(t,1):this.index=t},addAttribute:function(t,e,n){if(e&&e.isBufferAttribute||e&&e.isInterleavedBufferAttribute){if("index"!==t)return this.attributes[t]=e,this;console.warn("THREE.BufferGeometry.addAttribute: Use .setIndex() for index attribute."),this.setIndex(e)}else console.warn("THREE.BufferGeometry: .addAttribute() now expects ( name, attribute )."),this.addAttribute(t,new T(e,n))},getAttribute:function(t){return this.attributes[t]},removeAttribute:function(t){return delete this.attributes[t],this},addGroup:function(t,e,n){this.groups.push({start:t,count:e,materialIndex:void 0!==n?n:0})},clearGroups:function(){this.groups=[]},setDrawRange:function(t,e){this.drawRange.start=t,this.drawRange.count=e},applyMatrix:function(t){var e=this.attributes.position;return void 0!==e&&(t.applyToBufferAttribute(e),e.needsUpdate=!0),void 0!==(e=this.attributes.normal)&&((new a).getNormalMatrix(t).applyToBufferAttribute(e),e.needsUpdate=!0),null!==this.boundingBox&&this.computeBoundingBox(),null!==this.boundingSphere&&this.computeBoundingSphere(),this},rotateX:function(){var t=new i;return function(e){return t.makeRotationX(e),this.applyMatrix(t),this}}(),rotateY:function(){var t=new i;return function(e){return t.makeRotationY(e),this.applyMatrix(t),this}}(),rotateZ:function(){var t=new i;return function(e){return t.makeRotationZ(e),this.applyMatrix(t),this}}(),translate:function(){var t=new i;return function(e,n,i){return t.makeTranslation(e,n,i),this.applyMatrix(t),this}}(),scale:function(){var t=new i;return function(e,n,i){return t.makeScale(e,n,i),this.applyMatrix(t),this}}(),lookAt:function(){var t=new b;return function(e){t.lookAt(e),t.updateMatrix(),this.applyMatrix(t.matrix)}}(),center:function(){var t=new o;return function(){return this.computeBoundingBox(),this.boundingBox.getCenter(t).negate(),this.translate(t.x,t.y,t.z),this}}(),setFromObject:function(t){var e=t.geometry;if(t.isPoints||t.isLine){t=new I(3*e.vertices.length,3);var n=new I(3*e.colors.length,3);this.addAttribute("position",t.copyVector3sArray(e.vertices)),this.addAttribute("color",n.copyColorsArray(e.colors)),e.lineDistances&&e.lineDistances.length===e.vertices.length&&(t=new I(e.lineDistances.length,1),this.addAttribute("lineDistance",t.copyArray(e.lineDistances))),null!==e.boundingSphere&&(this.boundingSphere=e.boundingSphere.clone()),null!==e.boundingBox&&(this.boundingBox=e.boundingBox.clone())}else t.isMesh&&e&&e.isGeometry&&this.fromGeometry(e);return this},setFromPoints:function(t){for(var e=[],n=0,i=t.length;n<i;n++){var r=t[n];e.push(r.x,r.y,r.z||0)}return this.addAttribute("position",new I(e,3)),this},updateFromObject:function(t){var e=t.geometry;if(t.isMesh){var n=e.__directGeometry;if(!0===e.elementsNeedUpdate&&(n=void 0,e.elementsNeedUpdate=!1),void 0===n)return this.fromGeometry(e);n.verticesNeedUpdate=e.verticesNeedUpdate,n.normalsNeedUpdate=e.normalsNeedUpdate,n.colorsNeedUpdate=e.colorsNeedUpdate,n.uvsNeedUpdate=e.uvsNeedUpdate,n.groupsNeedUpdate=e.groupsNeedUpdate,e.verticesNeedUpdate=!1,e.normalsNeedUpdate=!1,e.colorsNeedUpdate=!1,e.uvsNeedUpdate=!1,e.groupsNeedUpdate=!1,e=n}return!0===e.verticesNeedUpdate&&(void 0!==(n=this.attributes.position)&&(n.copyVector3sArray(e.vertices),n.needsUpdate=!0),e.verticesNeedUpdate=!1),!0===e.normalsNeedUpdate&&(void 0!==(n=this.attributes.normal)&&(n.copyVector3sArray(e.normals),n.needsUpdate=!0),e.normalsNeedUpdate=!1),!0===e.colorsNeedUpdate&&(void 0!==(n=this.attributes.color)&&(n.copyColorsArray(e.colors),n.needsUpdate=!0),e.colorsNeedUpdate=!1),e.uvsNeedUpdate&&(void 0!==(n=this.attributes.uv)&&(n.copyVector2sArray(e.uvs),n.needsUpdate=!0),e.uvsNeedUpdate=!1),e.lineDistancesNeedUpdate&&(void 0!==(n=this.attributes.lineDistance)&&(n.copyArray(e.lineDistances),n.needsUpdate=!0),e.lineDistancesNeedUpdate=!1),e.groupsNeedUpdate&&(e.computeGroups(t.geometry),this.groups=e.groups,e.groupsNeedUpdate=!1),this},fromGeometry:function(t){return t.__directGeometry=(new U).fromGeometry(t),this.fromDirectGeometry(t.__directGeometry)},fromDirectGeometry:function(t){var e=new Float32Array(3*t.vertices.length);for(var n in this.addAttribute("position",new T(e,3).copyVector3sArray(t.vertices)),0<t.normals.length&&(e=new Float32Array(3*t.normals.length),this.addAttribute("normal",new T(e,3).copyVector3sArray(t.normals))),0<t.colors.length&&(e=new Float32Array(3*t.colors.length),this.addAttribute("color",new T(e,3).copyColorsArray(t.colors))),0<t.uvs.length&&(e=new Float32Array(2*t.uvs.length),this.addAttribute("uv",new T(e,2).copyVector2sArray(t.uvs))),0<t.uvs2.length&&(e=new Float32Array(2*t.uvs2.length),this.addAttribute("uv2",new T(e,2).copyVector2sArray(t.uvs2))),this.groups=t.groups,t.morphTargets){e=[];for(var i=t.morphTargets[n],r=0,o=i.length;r<o;r++){var a=i[r],s=new I(3*a.length,3);e.push(s.copyVector3sArray(a))}this.morphAttributes[n]=e}return 0<t.skinIndices.length&&(n=new I(4*t.skinIndices.length,4),this.addAttribute("skinIndex",n.copyVector4sArray(t.skinIndices))),0<t.skinWeights.length&&(n=new I(4*t.skinWeights.length,4),this.addAttribute("skinWeight",n.copyVector4sArray(t.skinWeights))),null!==t.boundingSphere&&(this.boundingSphere=t.boundingSphere.clone()),null!==t.boundingBox&&(this.boundingBox=t.boundingBox.clone()),this},computeBoundingBox:function(){null===this.boundingBox&&(this.boundingBox=new p);var t=this.attributes.position;void 0!==t?this.boundingBox.setFromBufferAttribute(t):this.boundingBox.makeEmpty(),(isNaN(this.boundingBox.min.x)||isNaN(this.boundingBox.min.y)||isNaN(this.boundingBox.min.z))&&console.error('THREE.BufferGeometry.computeBoundingBox: Computed min/max have NaN values. The "position" attribute is likely to have NaN values.',this)},computeBoundingSphere:function(){var t=new p,e=new o;return function(){null===this.boundingSphere&&(this.boundingSphere=new d);var n=this.attributes.position;if(n){var i=this.boundingSphere.center;t.setFromBufferAttribute(n),t.getCenter(i);for(var r=0,o=0,a=n.count;o<a;o++)e.x=n.getX(o),e.y=n.getY(o),e.z=n.getZ(o),r=Math.max(r,i.distanceToSquared(e));this.boundingSphere.radius=Math.sqrt(r),isNaN(this.boundingSphere.radius)&&console.error('THREE.BufferGeometry.computeBoundingSphere(): Computed radius is NaN. The "position" attribute is likely to have NaN values.',this)}}}(),computeFaceNormals:function(){},computeVertexNormals:function(){var t=this.index,e=this.attributes,n=this.groups;if(e.position){var i=e.position.array;if(void 0===e.normal)this.addAttribute("normal",new T(new Float32Array(i.length),3));else for(var r=e.normal.array,a=0,s=r.length;a<s;a++)r[a]=0;r=e.normal.array;var c=new o,h=new o,l=new o,u=new o,p=new o;if(t){t=t.array,0===n.length&&this.addGroup(0,t.length);for(var d=0,f=n.length;d<f;++d){s=(a=n[d]).start;var m=a.count;for(a=s,s+=m;a<s;a+=3){m=3*t[a+0];var g=3*t[a+1],v=3*t[a+2];c.fromArray(i,m),h.fromArray(i,g),l.fromArray(i,v),u.subVectors(l,h),p.subVectors(c,h),u.cross(p),r[m]+=u.x,r[m+1]+=u.y,r[m+2]+=u.z,r[g]+=u.x,r[g+1]+=u.y,r[g+2]+=u.z,r[v]+=u.x,r[v+1]+=u.y,r[v+2]+=u.z}}}else for(a=0,s=i.length;a<s;a+=9)c.fromArray(i,a),h.fromArray(i,a+3),l.fromArray(i,a+6),u.subVectors(l,h),p.subVectors(c,h),u.cross(p),r[a]=u.x,r[a+1]=u.y,r[a+2]=u.z,r[a+3]=u.x,r[a+4]=u.y,r[a+5]=u.z,r[a+6]=u.x,r[a+7]=u.y,r[a+8]=u.z;this.normalizeNormals(),e.normal.needsUpdate=!0}},merge:function(t,e){if(t&&t.isBufferGeometry){void 0===e&&(e=0,console.warn("THREE.BufferGeometry.merge(): Overwriting original geometry, starting at offset=0. Use BufferGeometryUtils.mergeBufferGeometries() for lossless merge."));var n,i=this.attributes;for(n in i)if(void 0!==t.attributes[n]){var r=i[n].array,o=t.attributes[n],a=o.array,s=0;for(o=o.itemSize*e;s<a.length;s++,o++)r[o]=a[s]}return this}console.error("THREE.BufferGeometry.merge(): geometry not an instance of THREE.BufferGeometry.",t)},normalizeNormals:function(){var t=new o;return function(){for(var e=this.attributes.normal,n=0,i=e.count;n<i;n++)t.x=e.getX(n),t.y=e.getY(n),t.z=e.getZ(n),t.normalize(),e.setXYZ(n,t.x,t.y,t.z)}}(),toNonIndexed:function(){if(null===this.index)return console.warn("THREE.BufferGeometry.toNonIndexed(): Geometry is already non-indexed."),this;var t,e=new B,n=this.index.array,i=this.attributes;for(t in i){var r=i[t],o=r.array,a=r.itemSize,s=new o.constructor(n.length*a),c=0;r=0;for(var h=n.length;r<h;r++)for(var l=n[r]*a,u=0;u<a;u++)s[c++]=o[l++];e.addAttribute(t,new T(s,a))}for(r=0,h=(n=this.groups).length;r<h;r++)i=n[r],e.addGroup(i.start,i.count,i.materialIndex);return e},toJSON:function(){var t={metadata:{version:4.5,type:"BufferGeometry",generator:"BufferGeometry.toJSON"}};if(t.uuid=this.uuid,t.type=this.type,""!==this.name&&(t.name=this.name),void 0!==this.parameters){var e=this.parameters;for(r in e)void 0!==e[r]&&(t[r]=e[r]);return t}t.data={attributes:{}};var n=this.index;for(r in null!==n&&(e=Array.prototype.slice.call(n.array),t.data.index={type:n.array.constructor.name,array:e}),n=this.attributes){var i=n[r];e=Array.prototype.slice.call(i.array),t.data.attributes[r]={itemSize:i.itemSize,type:i.array.constructor.name,array:e,normalized:i.normalized}}var r=this.groups;return 0<r.length&&(t.data.groups=JSON.parse(JSON.stringify(r))),null!==(r=this.boundingSphere)&&(t.data.boundingSphere={center:r.center.toArray(),radius:r.radius}),t},clone:function(){return(new B).copy(this)},copy:function(t){var e;this.index=null,this.attributes={},this.morphAttributes={},this.groups=[],this.boundingSphere=this.boundingBox=null,this.name=t.name;var n=t.index;for(a in null!==n&&this.setIndex(n.clone()),n=t.attributes)this.addAttribute(a,n[a].clone());var i=t.morphAttributes;for(a in i){var r=[],o=i[a];for(n=0,e=o.length;n<e;n++)r.push(o[n].clone());this.morphAttributes[a]=r}var a=t.groups;for(n=0,e=a.length;n<e;n++)i=a[n],this.addGroup(i.start,i.count,i.materialIndex);return null!==(a=t.boundingBox)&&(this.boundingBox=a.clone()),null!==(a=t.boundingSphere)&&(this.boundingSphere=a.clone()),this.drawRange.start=t.drawRange.start,this.drawRange.count=t.drawRange.count,this},dispose:function(){this.dispatchEvent({type:"dispose"})}}),F.prototype=Object.create(E.prototype),F.prototype.constructor=F,z.prototype=Object.create(B.prototype),z.prototype.constructor=z,H.prototype=Object.create(E.prototype),H.prototype.constructor=H,G.prototype=Object.create(B.prototype),G.prototype.constructor=G;var Br=0;k.prototype=Object.assign(Object.create(e.prototype),{constructor:k,isMaterial:!0,onBeforeCompile:function(){},setValues:function(t){if(void 0!==t)for(var e in t){var n=t[e];if(void 0===n)console.warn("THREE.Material: '"+e+"' parameter is undefined.");else if("shading"===e)console.warn("THREE."+this.type+": .shading has been removed. Use the boolean .flatShading instead."),this.flatShading=1===n;else{var i=this[e];void 0===i?console.warn("THREE."+this.type+": '"+e+"' is not a property of this material."):i&&i.isColor?i.set(n):i&&i.isVector3&&n&&n.isVector3?i.copy(n):this[e]="overdraw"===e?Number(n):n}}},toJSON:function(t){function e(t){var e,n=[];for(e in t){var i=t[e];delete i.metadata,n.push(i)}return n}var n=void 0===t||"string"==typeof t;n&&(t={textures:{},images:{}});var i={metadata:{version:4.5,type:"Material",generator:"Material.toJSON"}};return i.uuid=this.uuid,i.type=this.type,""!==this.name&&(i.name=this.name),this.color&&this.color.isColor&&(i.color=this.color.getHex()),void 0!==this.roughness&&(i.roughness=this.roughness),void 0!==this.metalness&&(i.metalness=this.metalness),this.emissive&&this.emissive.isColor&&(i.emissive=this.emissive.getHex()),1!==this.emissiveIntensity&&(i.emissiveIntensity=this.emissiveIntensity),this.specular&&this.specular.isColor&&(i.specular=this.specular.getHex()),void 0!==this.shininess&&(i.shininess=this.shininess),void 0!==this.clearCoat&&(i.clearCoat=this.clearCoat),void 0!==this.clearCoatRoughness&&(i.clearCoatRoughness=this.clearCoatRoughness),this.map&&this.map.isTexture&&(i.map=this.map.toJSON(t).uuid),this.alphaMap&&this.alphaMap.isTexture&&(i.alphaMap=this.alphaMap.toJSON(t).uuid),this.lightMap&&this.lightMap.isTexture&&(i.lightMap=this.lightMap.toJSON(t).uuid),this.bumpMap&&this.bumpMap.isTexture&&(i.bumpMap=this.bumpMap.toJSON(t).uuid,i.bumpScale=this.bumpScale),this.normalMap&&this.normalMap.isTexture&&(i.normalMap=this.normalMap.toJSON(t).uuid,i.normalScale=this.normalScale.toArray()),this.displacementMap&&this.displacementMap.isTexture&&(i.displacementMap=this.displacementMap.toJSON(t).uuid,i.displacementScale=this.displacementScale,i.displacementBias=this.displacementBias),this.roughnessMap&&this.roughnessMap.isTexture&&(i.roughnessMap=this.roughnessMap.toJSON(t).uuid),this.metalnessMap&&this.metalnessMap.isTexture&&(i.metalnessMap=this.metalnessMap.toJSON(t).uuid),this.emissiveMap&&this.emissiveMap.isTexture&&(i.emissiveMap=this.emissiveMap.toJSON(t).uuid),this.specularMap&&this.specularMap.isTexture&&(i.specularMap=this.specularMap.toJSON(t).uuid),this.envMap&&this.envMap.isTexture&&(i.envMap=this.envMap.toJSON(t).uuid,i.reflectivity=this.reflectivity),this.gradientMap&&this.gradientMap.isTexture&&(i.gradientMap=this.gradientMap.toJSON(t).uuid),void 0!==this.size&&(i.size=this.size),void 0!==this.sizeAttenuation&&(i.sizeAttenuation=this.sizeAttenuation),1!==this.blending&&(i.blending=this.blending),!0===this.flatShading&&(i.flatShading=this.flatShading),0!==this.side&&(i.side=this.side),0!==this.vertexColors&&(i.vertexColors=this.vertexColors),1>this.opacity&&(i.opacity=this.opacity),!0===this.transparent&&(i.transparent=this.transparent),i.depthFunc=this.depthFunc,i.depthTest=this.depthTest,i.depthWrite=this.depthWrite,0!==this.rotation&&(i.rotation=this.rotation),1!==this.linewidth&&(i.linewidth=this.linewidth),void 0!==this.dashSize&&(i.dashSize=this.dashSize),void 0!==this.gapSize&&(i.gapSize=this.gapSize),void 0!==this.scale&&(i.scale=this.scale),!0===this.dithering&&(i.dithering=!0),0<this.alphaTest&&(i.alphaTest=this.alphaTest),!0===this.premultipliedAlpha&&(i.premultipliedAlpha=this.premultipliedAlpha),!0===this.wireframe&&(i.wireframe=this.wireframe),1<this.wireframeLinewidth&&(i.wireframeLinewidth=this.wireframeLinewidth),"round"!==this.wireframeLinecap&&(i.wireframeLinecap=this.wireframeLinecap),"round"!==this.wireframeLinejoin&&(i.wireframeLinejoin=this.wireframeLinejoin),!0===this.morphTargets&&(i.morphTargets=!0),!0===this.skinning&&(i.skinning=!0),!1===this.visible&&(i.visible=!1),"{}"!==JSON.stringify(this.userData)&&(i.userData=this.userData),n&&(n=e(t.textures),t=e(t.images),0<n.length&&(i.textures=n),0<t.length&&(i.images=t)),i},clone:function(){return(new this.constructor).copy(this)},copy:function(t){this.name=t.name,this.fog=t.fog,this.lights=t.lights,this.blending=t.blending,this.side=t.side,this.flatShading=t.flatShading,this.vertexColors=t.vertexColors,this.opacity=t.opacity,this.transparent=t.transparent,this.blendSrc=t.blendSrc,this.blendDst=t.blendDst,this.blendEquation=t.blendEquation,this.blendSrcAlpha=t.blendSrcAlpha,this.blendDstAlpha=t.blendDstAlpha,this.blendEquationAlpha=t.blendEquationAlpha,this.depthFunc=t.depthFunc,this.depthTest=t.depthTest,this.depthWrite=t.depthWrite,this.colorWrite=t.colorWrite,this.precision=t.precision,this.polygonOffset=t.polygonOffset,this.polygonOffsetFactor=t.polygonOffsetFactor,this.polygonOffsetUnits=t.polygonOffsetUnits,this.dithering=t.dithering,this.alphaTest=t.alphaTest,this.premultipliedAlpha=t.premultipliedAlpha,this.overdraw=t.overdraw,this.visible=t.visible,this.userData=JSON.parse(JSON.stringify(t.userData)),this.clipShadows=t.clipShadows,this.clipIntersection=t.clipIntersection;var e=t.clippingPlanes,n=null;if(null!==e){var i=e.length;n=Array(i);for(var r=0;r!==i;++r)n[r]=e[r].clone()}return this.clippingPlanes=n,this.shadowSide=t.shadowSide,this},dispose:function(){this.dispatchEvent({type:"dispose"})}}),V.prototype=Object.create(k.prototype),V.prototype.constructor=V,V.prototype.isMeshBasicMaterial=!0,V.prototype.copy=function(t){return k.prototype.copy.call(this,t),this.color.copy(t.color),this.map=t.map,this.lightMap=t.lightMap,this.lightMapIntensity=t.lightMapIntensity,this.aoMap=t.aoMap,this.aoMapIntensity=t.aoMapIntensity,this.specularMap=t.specularMap,this.alphaMap=t.alphaMap,this.envMap=t.envMap,this.combine=t.combine,this.reflectivity=t.reflectivity,this.refractionRatio=t.refractionRatio,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.wireframeLinecap=t.wireframeLinecap,this.wireframeLinejoin=t.wireframeLinejoin,this.skinning=t.skinning,this.morphTargets=t.morphTargets,this},j.prototype=Object.create(k.prototype),j.prototype.constructor=j,j.prototype.isShaderMaterial=!0,j.prototype.copy=function(t){return k.prototype.copy.call(this,t),this.fragmentShader=t.fragmentShader,this.vertexShader=t.vertexShader,this.uniforms=Pr.clone(t.uniforms),this.defines=Object.assign({},t.defines),this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.lights=t.lights,this.clipping=t.clipping,this.skinning=t.skinning,this.morphTargets=t.morphTargets,this.morphNormals=t.morphNormals,this.extensions=t.extensions,this},j.prototype.toJSON=function(t){return(t=k.prototype.toJSON.call(this,t)).uniforms=this.uniforms,t.vertexShader=this.vertexShader,t.fragmentShader=this.fragmentShader,t},Object.assign(W.prototype,{set:function(t,e){return this.origin.copy(t),this.direction.copy(e),this},clone:function(){return(new this.constructor).copy(this)},copy:function(t){return this.origin.copy(t.origin),this.direction.copy(t.direction),this},at:function(t,e){return void 0===e&&(console.warn("THREE.Ray: .at() target is now required"),e=new o),e.copy(this.direction).multiplyScalar(t).add(this.origin)},lookAt:function(t){return this.direction.copy(t).sub(this.origin).normalize(),this},recast:function(){var t=new o;return function(e){return this.origin.copy(this.at(e,t)),this}}(),closestPointToPoint:function(t,e){return void 0===e&&(console.warn("THREE.Ray: .closestPointToPoint() target is now required"),e=new o),e.subVectors(t,this.origin),0>(t=e.dot(this.direction))?e.copy(this.origin):e.copy(this.direction).multiplyScalar(t).add(this.origin)},distanceToPoint:function(t){return Math.sqrt(this.distanceSqToPoint(t))},distanceSqToPoint:function(){var t=new o;return function(e){var n=t.subVectors(e,this.origin).dot(this.direction);return 0>n?this.origin.distanceToSquared(e):(t.copy(this.direction).multiplyScalar(n).add(this.origin),t.distanceToSquared(e))}}(),distanceSqToSegment:function(){var t=new o,e=new o,n=new o;return function(i,r,o,a){t.copy(i).add(r).multiplyScalar(.5),e.copy(r).sub(i).normalize(),n.copy(this.origin).sub(t);var s=.5*i.distanceTo(r),c=-this.direction.dot(e),h=n.dot(this.direction),l=-n.dot(e),u=n.lengthSq(),p=Math.abs(1-c*c);if(0<p){r=c*h-l;var d=s*p;0<=(i=c*l-h)?r>=-d?r<=d?c=(i*=s=1/p)*(i+c*(r*=s)+2*h)+r*(c*i+r+2*l)+u:(r=s,c=-(i=Math.max(0,-(c*r+h)))*i+r*(r+2*l)+u):(r=-s,c=-(i=Math.max(0,-(c*r+h)))*i+r*(r+2*l)+u):r<=-d?c=-(i=Math.max(0,-(-c*s+h)))*i+(r=0<i?-s:Math.min(Math.max(-s,-l),s))*(r+2*l)+u:r<=d?(i=0,c=(r=Math.min(Math.max(-s,-l),s))*(r+2*l)+u):c=-(i=Math.max(0,-(c*s+h)))*i+(r=0<i?s:Math.min(Math.max(-s,-l),s))*(r+2*l)+u}else r=0<c?-s:s,c=-(i=Math.max(0,-(c*r+h)))*i+r*(r+2*l)+u;return o&&o.copy(this.direction).multiplyScalar(i).add(this.origin),a&&a.copy(e).multiplyScalar(r).add(t),c}}(),intersectSphere:function(){var t=new o;return function(e,n){t.subVectors(e.center,this.origin);var i=t.dot(this.direction),r=t.dot(t)-i*i;return r>(e=e.radius*e.radius)?null:(r=i-(e=Math.sqrt(e-r)),i+=e,0>r&&0>i?null:0>r?this.at(i,n):this.at(r,n))}}(),intersectsSphere:function(t){return this.distanceToPoint(t.center)<=t.radius},distanceToPlane:function(t){var e=t.normal.dot(this.direction);return 0===e?0===t.distanceToPoint(this.origin)?0:null:0<=(t=-(this.origin.dot(t.normal)+t.constant)/e)?t:null},intersectPlane:function(t,e){return null===(t=this.distanceToPlane(t))?null:this.at(t,e)},intersectsPlane:function(t){var e=t.distanceToPoint(this.origin);return 0===e||0>t.normal.dot(this.direction)*e},intersectBox:function(t,e){var n=1/this.direction.x,i=1/this.direction.y,r=1/this.direction.z,o=this.origin;if(0<=n){var a=(t.min.x-o.x)*n;n*=t.max.x-o.x}else a=(t.max.x-o.x)*n,n*=t.min.x-o.x;if(0<=i){var s=(t.min.y-o.y)*i;i*=t.max.y-o.y}else s=(t.max.y-o.y)*i,i*=t.min.y-o.y;return a>i||s>n?null:((s>a||a!=a)&&(a=s),(i<n||n!=n)&&(n=i),0<=r?(s=(t.min.z-o.z)*r,t=(t.max.z-o.z)*r):(s=(t.max.z-o.z)*r,t=(t.min.z-o.z)*r),a>t||s>n?null:((s>a||a!=a)&&(a=s),(t<n||n!=n)&&(n=t),0>n?null:this.at(0<=a?a:n,e)))},intersectsBox:function(){var t=new o;return function(e){return null!==this.intersectBox(e,t)}}(),intersectTriangle:function(){var t=new o,e=new o,n=new o,i=new o;return function(r,o,a,s,c){if(e.subVectors(o,r),n.subVectors(a,r),i.crossVectors(e,n),0<(o=this.direction.dot(i))){if(s)return null;s=1}else{if(!(0>o))return null;s=-1,o=-o}return t.subVectors(this.origin,r),0>(r=s*this.direction.dot(n.crossVectors(t,n)))?null:0>(a=s*this.direction.dot(e.cross(t)))||r+a>o?null:0>(r=-s*t.dot(i))?null:this.at(r/o,c)}}(),applyMatrix4:function(t){return this.origin.applyMatrix4(t),this.direction.transformDirection(t),this},equals:function(t){return t.origin.equals(this.origin)&&t.direction.equals(this.direction)}}),Object.assign(X.prototype,{set:function(t,e){return this.start.copy(t),this.end.copy(e),this},clone:function(){return(new this.constructor).copy(this)},copy:function(t){return this.start.copy(t.start),this.end.copy(t.end),this},getCenter:function(t){return void 0===t&&(console.warn("THREE.Line3: .getCenter() target is now required"),t=new o),t.addVectors(this.start,this.end).multiplyScalar(.5)},delta:function(t){return void 0===t&&(console.warn("THREE.Line3: .delta() target is now required"),t=new o),t.subVectors(this.end,this.start)},distanceSq:function(){return this.start.distanceToSquared(this.end)},distance:function(){return this.start.distanceTo(this.end)},at:function(t,e){return void 0===e&&(console.warn("THREE.Line3: .at() target is now required"),e=new o),this.delta(e).multiplyScalar(t).add(this.start)},closestPointToPointParameter:function(){var t=new o,e=new o;return function(n,i){return t.subVectors(n,this.start),e.subVectors(this.end,this.start),n=e.dot(e),n=e.dot(t)/n,i&&(n=Ar.clamp(n,0,1)),n}}(),closestPointToPoint:function(t,e,n){return t=this.closestPointToPointParameter(t,e),void 0===n&&(console.warn("THREE.Line3: .closestPointToPoint() target is now required"),n=new o),this.delta(n).multiplyScalar(t).add(this.start)},applyMatrix4:function(t){return this.start.applyMatrix4(t),this.end.applyMatrix4(t),this},equals:function(t){return t.start.equals(this.start)&&t.end.equals(this.end)}}),Object.assign(q,{getNormal:function(){var t=new o;return function(e,n,i,r){return void 0===r&&(console.warn("THREE.Triangle: .getNormal() target is now required"),r=new o),r.subVectors(i,n),t.subVectors(e,n),r.cross(t),0<(e=r.lengthSq())?r.multiplyScalar(1/Math.sqrt(e)):r.set(0,0,0)}}(),getBarycoord:function(){var t=new o,e=new o,n=new o;return function(i,r,a,s,c){t.subVectors(s,r),e.subVectors(a,r),n.subVectors(i,r),i=t.dot(t),r=t.dot(e),a=t.dot(n);var h=e.dot(e);s=e.dot(n);var l=i*h-r*r;return void 0===c&&(console.warn("THREE.Triangle: .getBarycoord() target is now required"),c=new o),0===l?c.set(-2,-1,-1):(h=(h*a-r*s)*(l=1/l),i=(i*s-r*a)*l,c.set(1-h-i,i,h))}}(),containsPoint:function(){var t=new o;return function(e,n,i,r){return q.getBarycoord(e,n,i,r,t),0<=t.x&&0<=t.y&&1>=t.x+t.y}}()}),Object.assign(q.prototype,{set:function(t,e,n){return this.a.copy(t),this.b.copy(e),this.c.copy(n),this},setFromPointsAndIndices:function(t,e,n,i){return this.a.copy(t[e]),this.b.copy(t[n]),this.c.copy(t[i]),this},clone:function(){return(new this.constructor).copy(this)},copy:function(t){return this.a.copy(t.a),this.b.copy(t.b),this.c.copy(t.c),this},getArea:function(){var t=new o,e=new o;return function(){return t.subVectors(this.c,this.b),e.subVectors(this.a,this.b),.5*t.cross(e).length()}}(),getMidpoint:function(t){return void 0===t&&(console.warn("THREE.Triangle: .getMidpoint() target is now required"),t=new o),t.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)},getNormal:function(t){return q.getNormal(this.a,this.b,this.c,t)},getPlane:function(t){return void 0===t&&(console.warn("THREE.Triangle: .getPlane() target is now required"),t=new o),t.setFromCoplanarPoints(this.a,this.b,this.c)},getBarycoord:function(t,e){return q.getBarycoord(t,this.a,this.b,this.c,e)},containsPoint:function(t){return q.containsPoint(t,this.a,this.b,this.c)},intersectsBox:function(t){return t.intersectsTriangle(this)},closestPointToPoint:function(){var t=new f,e=[new X,new X,new X],n=new o,i=new o;return function(r,a){void 0===a&&(console.warn("THREE.Triangle: .closestPointToPoint() target is now required"),a=new o);var s=1/0;if(t.setFromCoplanarPoints(this.a,this.b,this.c),t.projectPoint(r,n),!0===this.containsPoint(n))a.copy(n);else for(e[0].set(this.a,this.b),e[1].set(this.b,this.c),e[2].set(this.c,this.a),r=0;r<e.length;r++){e[r].closestPointToPoint(n,!0,i);var c=n.distanceToSquared(i);c<s&&(s=c,a.copy(i))}return a}}(),equals:function(t){return t.a.equals(this.a)&&t.b.equals(this.b)&&t.c.equals(this.c)}}),Y.prototype=Object.assign(Object.create(b.prototype),{constructor:Y,isMesh:!0,setDrawMode:function(t){this.drawMode=t},copy:function(t){return b.prototype.copy.call(this,t),this.drawMode=t.drawMode,void 0!==t.morphTargetInfluences&&(this.morphTargetInfluences=t.morphTargetInfluences.slice()),void 0!==t.morphTargetDictionary&&(this.morphTargetDictionary=Object.assign({},t.morphTargetDictionary)),this},updateMorphTargets:function(){var t=this.geometry;if(t.isBufferGeometry){t=t.morphAttributes;var e=Object.keys(t);if(0<e.length){var n=t[e[0]];if(void 0!==n)for(this.morphTargetInfluences=[],this.morphTargetDictionary={},t=0,e=n.length;t<e;t++){var i=n[t].name||String(t);this.morphTargetInfluences.push(0),this.morphTargetDictionary[i]=t}}}else if(void 0!==(n=t.morphTargets)&&0<n.length)for(this.morphTargetInfluences=[],this.morphTargetDictionary={},t=0,e=n.length;t<e;t++)i=n[t].name||String(t),this.morphTargetInfluences.push(0),this.morphTargetDictionary[i]=t},raycast:function(){function t(t,e,n,i,r,o,a){return q.getBarycoord(t,e,n,i,x),r.multiplyScalar(x.x),o.multiplyScalar(x.y),a.multiplyScalar(x.z),r.add(o).add(a),r.clone()}function e(t,e,n,i,r,o,a,s){return null===(1===e.side?i.intersectTriangle(a,o,r,!0,s):i.intersectTriangle(r,o,a,2!==e.side,s))?null:(w.copy(s),w.applyMatrix4(t.matrixWorld),(e=n.ray.origin.distanceTo(w))<n.near||e>n.far?null:{distance:e,point:w.clone(),object:t})}function r(n,i,r,o,a,s,c,p){return h.fromBufferAttribute(o,s),l.fromBufferAttribute(o,c),u.fromBufferAttribute(o,p),(n=e(n,n.material,i,r,h,l,u,b))&&(a&&(g.fromBufferAttribute(a,s),v.fromBufferAttribute(a,c),y.fromBufferAttribute(a,p),n.uv=t(b,h,l,u,g,v,y)),a=new M(s,c,p),q.getNormal(h,l,u,a.normal),n.face=a,n.faceIndex=s),n}var a=new i,s=new W,c=new d,h=new o,l=new o,u=new o,p=new o,f=new o,m=new o,g=new n,v=new n,y=new n,x=new o,b=new o,w=new o;return function(n,i){var o,d=this.geometry,x=this.material,w=this.matrixWorld;if(void 0!==x&&(null===d.boundingSphere&&d.computeBoundingSphere(),c.copy(d.boundingSphere),c.applyMatrix4(w),!1!==n.ray.intersectsSphere(c)&&(a.getInverse(w),s.copy(n.ray).applyMatrix4(a),null===d.boundingBox||!1!==s.intersectsBox(d.boundingBox))))if(d.isBufferGeometry){x=d.index;var _,M=d.attributes.position;if(d=d.attributes.uv,null!==x)for(w=0,_=x.count;w<_;w+=3){var E=x.getX(w),T=x.getX(w+1),S=x.getX(w+2);(o=r(this,n,s,M,d,E,T,S))&&(o.faceIndex=Math.floor(w/3),i.push(o))}else if(void 0!==M)for(w=0,_=M.count;w<_;w+=3)(o=r(this,n,s,M,d,E=w,T=w+1,S=w+2))&&i.push(o)}else if(d.isGeometry){w=Array.isArray(x),_=d.vertices,E=d.faces,0<(T=d.faceVertexUvs[0]).length&&(M=T);for(var A=0,R=E.length;A<R;A++){var L=E[A];if(void 0!==(o=w?x[L.materialIndex]:x)){T=_[L.a],S=_[L.b];var P=_[L.c];if(!0===o.morphTargets){var C=d.morphTargets,O=this.morphTargetInfluences;h.set(0,0,0),l.set(0,0,0),u.set(0,0,0);for(var I=0,N=C.length;I<N;I++){var U=O[I];if(0!==U){var D=C[I].vertices;h.addScaledVector(p.subVectors(D[L.a],T),U),l.addScaledVector(f.subVectors(D[L.b],S),U),u.addScaledVector(m.subVectors(D[L.c],P),U)}}h.add(T),l.add(S),u.add(P),T=h,S=l,P=u}(o=e(this,o,n,s,T,S,P,b))&&(M&&M[A]&&(C=M[A],g.copy(C[0]),v.copy(C[1]),y.copy(C[2]),o.uv=t(b,T,S,P,g,v,y)),o.face=L,o.faceIndex=A,i.push(o))}}}}}(),clone:function(){return new this.constructor(this.geometry,this.material).copy(this)}}),$.prototype=Object.create(s.prototype),$.prototype.constructor=$,$.prototype.isCubeTexture=!0,Object.defineProperty($.prototype,"images",{get:function(){return this.image},set:function(t){this.image=t}});var Fr=new s,zr=new $,Hr=[],Gr=[],kr=new Float32Array(16),Vr=new Float32Array(9);At.prototype.setValue=function(t,e){for(var n=this.seq,i=0,r=n.length;i!==r;++i){var o=n[i];o.setValue(t,e[o.id])}};var jr=/([\w\d_]+)(\])?(\[|\.)?/g;Rt.prototype.setValue=function(t,e,n){void 0!==(e=this.map[e])&&e.setValue(t,n,this.renderer)},Rt.prototype.setOptional=function(t,e,n){void 0!==(e=e[n])&&this.setValue(t,n,e)},Rt.upload=function(t,e,n,i){for(var r=0,o=e.length;r!==o;++r){var a=e[r],s=n[a.id];!1!==s.needsUpdate&&a.setValue(t,s.value,i)}},Rt.seqWithValue=function(t,e){for(var n=[],i=0,r=t.length;i!==r;++i){var o=t[i];o.id in e&&n.push(o)}return n};var Wr=0,Xr=0;Vt.prototype=Object.create(k.prototype),Vt.prototype.constructor=Vt,Vt.prototype.isMeshDepthMaterial=!0,Vt.prototype.copy=function(t){return k.prototype.copy.call(this,t),this.depthPacking=t.depthPacking,this.skinning=t.skinning,this.morphTargets=t.morphTargets,this.map=t.map,this.alphaMap=t.alphaMap,this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this},jt.prototype=Object.create(k.prototype),jt.prototype.constructor=jt,jt.prototype.isMeshDistanceMaterial=!0,jt.prototype.copy=function(t){return k.prototype.copy.call(this,t),this.referencePosition.copy(t.referencePosition),this.nearDistance=t.nearDistance,this.farDistance=t.farDistance,this.skinning=t.skinning,this.morphTargets=t.morphTargets,this.map=t.map,this.alphaMap=t.alphaMap,this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this},Xt.prototype=Object.create(s.prototype),Xt.prototype.constructor=Xt,Zt.prototype=Object.assign(Object.create(w.prototype),{constructor:Zt,isPerspectiveCamera:!0,copy:function(t,e){return w.prototype.copy.call(this,t,e),this.fov=t.fov,this.zoom=t.zoom,this.near=t.near,this.far=t.far,this.focus=t.focus,this.aspect=t.aspect,this.view=null===t.view?null:Object.assign({},t.view),this.filmGauge=t.filmGauge,this.filmOffset=t.filmOffset,this},setFocalLength:function(t){t=.5*this.getFilmHeight()/t,this.fov=2*Ar.RAD2DEG*Math.atan(t),this.updateProjectionMatrix()},getFocalLength:function(){var t=Math.tan(.5*Ar.DEG2RAD*this.fov);return.5*this.getFilmHeight()/t},getEffectiveFOV:function(){return 2*Ar.RAD2DEG*Math.atan(Math.tan(.5*Ar.DEG2RAD*this.fov)/this.zoom)},getFilmWidth:function(){return this.filmGauge*Math.min(this.aspect,1)},getFilmHeight:function(){return this.filmGauge/Math.max(this.aspect,1)},setViewOffset:function(t,e,n,i,r,o){this.aspect=t/e,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=t,this.view.fullHeight=e,this.view.offsetX=n,this.view.offsetY=i,this.view.width=r,this.view.height=o,this.updateProjectionMatrix()},clearViewOffset:function(){null!==this.view&&(this.view.enabled=!1),this.updateProjectionMatrix()},updateProjectionMatrix:function(){var t=this.near,e=t*Math.tan(.5*Ar.DEG2RAD*this.fov)/this.zoom,n=2*e,i=this.aspect*n,r=-.5*i,o=this.view;if(null!==this.view&&this.view.enabled){var a=o.fullWidth,s=o.fullHeight;r+=o.offsetX*i/a,e-=o.offsetY*n/s,i*=o.width/a,n*=o.height/s}0!==(o=this.filmOffset)&&(r+=t*o/this.getFilmWidth()),this.projectionMatrix.makePerspective(r,r+i,e,e-n,t,this.far)},toJSON:function(t){return(t=b.prototype.toJSON.call(this,t)).object.fov=this.fov,t.object.zoom=this.zoom,t.object.near=this.near,t.object.far=this.far,t.object.focus=this.focus,t.object.aspect=this.aspect,null!==this.view&&(t.object.view=Object.assign({},this.view)),t.object.filmGauge=this.filmGauge,t.object.filmOffset=this.filmOffset,t}}),Jt.prototype=Object.assign(Object.create(Zt.prototype),{constructor:Jt,isArrayCamera:!0}),$t.prototype.isFogExp2=!0,$t.prototype.clone=function(){return new $t(this.color.getHex(),this.density)},$t.prototype.toJSON=function(){return{type:"FogExp2",color:this.color.getHex(),density:this.density}},te.prototype.isFog=!0,te.prototype.clone=function(){return new te(this.color.getHex(),this.near,this.far)},te.prototype.toJSON=function(){return{type:"Fog",color:this.color.getHex(),near:this.near,far:this.far}},ee.prototype=Object.assign(Object.create(b.prototype),{constructor:ee,copy:function(t,e){return b.prototype.copy.call(this,t,e),null!==t.background&&(this.background=t.background.clone()),null!==t.fog&&(this.fog=t.fog.clone()),null!==t.overrideMaterial&&(this.overrideMaterial=t.overrideMaterial.clone()),this.autoUpdate=t.autoUpdate,this.matrixAutoUpdate=t.matrixAutoUpdate,this},toJSON:function(t){var e=b.prototype.toJSON.call(this,t);return null!==this.background&&(e.object.background=this.background.toJSON(t)),null!==this.fog&&(e.object.fog=this.fog.toJSON()),e}}),ne.prototype=Object.create(k.prototype),ne.prototype.constructor=ne,ne.prototype.isSpriteMaterial=!0,ne.prototype.copy=function(t){return k.prototype.copy.call(this,t),this.color.copy(t.color),this.map=t.map,this.rotation=t.rotation,this},ie.prototype=Object.assign(Object.create(b.prototype),{constructor:ie,isSprite:!0,raycast:function(){var t=new o,e=new o,n=new o;return function(i,r){e.setFromMatrixPosition(this.matrixWorld),i.ray.closestPointToPoint(e,t),n.setFromMatrixScale(this.matrixWorld);var o=n.x*n.y/4;e.distanceToSquared(t)>o||((o=i.ray.origin.distanceTo(t))<i.near||o>i.far||r.push({distance:o,point:t.clone(),face:null,object:this}))}}(),clone:function(){return new this.constructor(this.material).copy(this)},copy:function(t){return b.prototype.copy.call(this,t),void 0!==t.center&&this.center.copy(t.center),this}}),re.prototype=Object.assign(Object.create(b.prototype),{constructor:re,copy:function(t){b.prototype.copy.call(this,t,!1);for(var e=0,n=(t=t.levels).length;e<n;e++){var i=t[e];this.addLevel(i.object.clone(),i.distance)}return this},addLevel:function(t,e){void 0===e&&(e=0),e=Math.abs(e);for(var n=this.levels,i=0;i<n.length&&!(e<n[i].distance);i++);n.splice(i,0,{distance:e,object:t}),this.add(t)},getObjectForDistance:function(t){for(var e=this.levels,n=1,i=e.length;n<i&&!(t<e[n].distance);n++);return e[n-1].object},raycast:function(){var t=new o;return function(e,n){t.setFromMatrixPosition(this.matrixWorld);var i=e.ray.origin.distanceTo(t);this.getObjectForDistance(i).raycast(e,n)}}(),update:function(){var t=new o,e=new o;return function(n){var i=this.levels;if(1<i.length){t.setFromMatrixPosition(n.matrixWorld),e.setFromMatrixPosition(this.matrixWorld),n=t.distanceTo(e),i[0].object.visible=!0;for(var r=1,o=i.length;r<o&&n>=i[r].distance;r++)i[r-1].object.visible=!1,i[r].object.visible=!0;for(;r<o;r++)i[r].object.visible=!1}}}(),toJSON:function(t){(t=b.prototype.toJSON.call(this,t)).object.levels=[];for(var e=this.levels,n=0,i=e.length;n<i;n++){var r=e[n];t.object.levels.push({object:r.object.uuid,distance:r.distance})}return t}}),Object.assign(oe.prototype,{calculateInverses:function(){this.boneInverses=[];for(var t=0,e=this.bones.length;t<e;t++){var n=new i;this.bones[t]&&n.getInverse(this.bones[t].matrixWorld),this.boneInverses.push(n)}},pose:function(){var t,e,n=0;for(e=this.bones.length;n<e;n++)(t=this.bones[n])&&t.matrixWorld.getInverse(this.boneInverses[n]);for(n=0,e=this.bones.length;n<e;n++)(t=this.bones[n])&&(t.parent&&t.parent.isBone?(t.matrix.getInverse(t.parent.matrixWorld),t.matrix.multiply(t.matrixWorld)):t.matrix.copy(t.matrixWorld),t.matrix.decompose(t.position,t.quaternion,t.scale))},update:function(){var t=new i,e=new i;return function(){for(var n=this.bones,i=this.boneInverses,r=this.boneMatrices,o=this.boneTexture,a=0,s=n.length;a<s;a++)t.multiplyMatrices(n[a]?n[a].matrixWorld:e,i[a]),t.toArray(r,16*a);void 0!==o&&(o.needsUpdate=!0)}}(),clone:function(){return new oe(this.bones,this.boneInverses)},getBoneByName:function(t){for(var e=0,n=this.bones.length;e<n;e++){var i=this.bones[e];if(i.name===t)return i}}}),ae.prototype=Object.assign(Object.create(b.prototype),{constructor:ae,isBone:!0}),se.prototype=Object.assign(Object.create(Y.prototype),{constructor:se,isSkinnedMesh:!0,initBones:function(){var t,e=[];if(this.geometry&&void 0!==this.geometry.bones){var n=0;for(t=this.geometry.bones.length;n<t;n++){var i=this.geometry.bones[n],r=new ae;e.push(r),r.name=i.name,r.position.fromArray(i.pos),r.quaternion.fromArray(i.rotq),void 0!==i.scl&&r.scale.fromArray(i.scl)}for(n=0,t=this.geometry.bones.length;n<t;n++)-1!==(i=this.geometry.bones[n]).parent&&null!==i.parent&&void 0!==e[i.parent]?e[i.parent].add(e[n]):this.add(e[n])}return this.updateMatrixWorld(!0),e},bind:function(t,e){this.skeleton=t,void 0===e&&(this.updateMatrixWorld(!0),this.skeleton.calculateInverses(),e=this.matrixWorld),this.bindMatrix.copy(e),this.bindMatrixInverse.getInverse(e)},pose:function(){this.skeleton.pose()},normalizeSkinWeights:function(){var t;if(this.geometry&&this.geometry.isGeometry)for(t=0;t<this.geometry.skinWeights.length;t++){var e=this.geometry.skinWeights[t],n=1/e.manhattanLength();1/0!==n?e.multiplyScalar(n):e.set(1,0,0,0)}else if(this.geometry&&this.geometry.isBufferGeometry){e=new c;var i=this.geometry.attributes.skinWeight;for(t=0;t<i.count;t++)e.x=i.getX(t),e.y=i.getY(t),e.z=i.getZ(t),e.w=i.getW(t),1/0!==(n=1/e.manhattanLength())?e.multiplyScalar(n):e.set(1,0,0,0),i.setXYZW(t,e.x,e.y,e.z,e.w)}},updateMatrixWorld:function(t){Y.prototype.updateMatrixWorld.call(this,t),"attached"===this.bindMode?this.bindMatrixInverse.getInverse(this.matrixWorld):"detached"===this.bindMode?this.bindMatrixInverse.getInverse(this.bindMatrix):console.warn("THREE.SkinnedMesh: Unrecognized bindMode: "+this.bindMode)},clone:function(){return new this.constructor(this.geometry,this.material).copy(this)}}),ce.prototype=Object.create(k.prototype),ce.prototype.constructor=ce,ce.prototype.isLineBasicMaterial=!0,ce.prototype.copy=function(t){return k.prototype.copy.call(this,t),this.color.copy(t.color),this.linewidth=t.linewidth,this.linecap=t.linecap,this.linejoin=t.linejoin,this},he.prototype=Object.assign(Object.create(b.prototype),{constructor:he,isLine:!0,computeLineDistances:function(){var t=new o,e=new o;return function(){var n=this.geometry;if(n.isBufferGeometry)if(null===n.index){for(var i=n.attributes.position,r=[0],o=1,a=i.count;o<a;o++)t.fromBufferAttribute(i,o-1),e.fromBufferAttribute(i,o),r[o]=r[o-1],r[o]+=t.distanceTo(e);n.addAttribute("lineDistance",new I(r,1))}else console.warn("THREE.Line.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");else if(n.isGeometry)for(i=n.vertices,(r=n.lineDistances)[0]=0,o=1,a=i.length;o<a;o++)r[o]=r[o-1],r[o]+=i[o-1].distanceTo(i[o]);return this}}(),raycast:function(){var t=new i,e=new W,n=new d;return function(i,r){var a=i.linePrecision;a*=a;var s=this.geometry,c=this.matrixWorld;if(null===s.boundingSphere&&s.computeBoundingSphere(),n.copy(s.boundingSphere),n.applyMatrix4(c),!1!==i.ray.intersectsSphere(n)){t.getInverse(c),e.copy(i.ray).applyMatrix4(t);var h=new o,l=new o;c=new o;var u=new o,p=this&&this.isLineSegments?2:1;if(s.isBufferGeometry){var d=s.index,f=s.attributes.position.array;if(null!==d){s=0;for(var m=(d=d.array).length-1;s<m;s+=p){var g=d[s+1];h.fromArray(f,3*d[s]),l.fromArray(f,3*g),(g=e.distanceSqToSegment(h,l,u,c))>a||(u.applyMatrix4(this.matrixWorld),(g=i.ray.origin.distanceTo(u))<i.near||g>i.far||r.push({distance:g,point:c.clone().applyMatrix4(this.matrixWorld),index:s,face:null,faceIndex:null,object:this}))}}else for(s=0,m=f.length/3-1;s<m;s+=p)h.fromArray(f,3*s),l.fromArray(f,3*s+3),(g=e.distanceSqToSegment(h,l,u,c))>a||(u.applyMatrix4(this.matrixWorld),(g=i.ray.origin.distanceTo(u))<i.near||g>i.far||r.push({distance:g,point:c.clone().applyMatrix4(this.matrixWorld),index:s,face:null,faceIndex:null,object:this}))}else if(s.isGeometry)for(l=(h=s.vertices).length,s=0;s<l-1;s+=p)(g=e.distanceSqToSegment(h[s],h[s+1],u,c))>a||(u.applyMatrix4(this.matrixWorld),(g=i.ray.origin.distanceTo(u))<i.near||g>i.far||r.push({distance:g,point:c.clone().applyMatrix4(this.matrixWorld),index:s,face:null,faceIndex:null,object:this}))}}}(),clone:function(){return new this.constructor(this.geometry,this.material).copy(this)}}),le.prototype=Object.assign(Object.create(he.prototype),{constructor:le,isLineSegments:!0,computeLineDistances:function(){var t=new o,e=new o;return function(){var n=this.geometry;if(n.isBufferGeometry)if(null===n.index){for(var i=n.attributes.position,r=[],o=0,a=i.count;o<a;o+=2)t.fromBufferAttribute(i,o),e.fromBufferAttribute(i,o+1),r[o]=0===o?0:r[o-1],r[o+1]=r[o]+t.distanceTo(e);n.addAttribute("lineDistance",new I(r,1))}else console.warn("THREE.LineSegments.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");else if(n.isGeometry)for(i=n.vertices,r=n.lineDistances,o=0,a=i.length;o<a;o+=2)t.copy(i[o]),e.copy(i[o+1]),r[o]=0===o?0:r[o-1],r[o+1]=r[o]+t.distanceTo(e);return this}}()}),ue.prototype=Object.assign(Object.create(he.prototype),{constructor:ue,isLineLoop:!0}),pe.prototype=Object.create(k.prototype),pe.prototype.constructor=pe,pe.prototype.isPointsMaterial=!0,pe.prototype.copy=function(t){return k.prototype.copy.call(this,t),this.color.copy(t.color),this.map=t.map,this.size=t.size,this.sizeAttenuation=t.sizeAttenuation,this},de.prototype=Object.assign(Object.create(b.prototype),{constructor:de,isPoints:!0,raycast:function(){var t=new i,e=new W,n=new d;return function(i,r){function a(t,n){var o=e.distanceSqToPoint(t);o<u&&(e.closestPointToPoint(t,p),p.applyMatrix4(h),(t=i.ray.origin.distanceTo(p))<i.near||t>i.far||r.push({distance:t,distanceToRay:Math.sqrt(o),point:p.clone(),index:n,face:null,object:s}))}var s=this,c=this.geometry,h=this.matrixWorld,l=i.params.Points.threshold;if(null===c.boundingSphere&&c.computeBoundingSphere(),n.copy(c.boundingSphere),n.applyMatrix4(h),n.radius+=l,!1!==i.ray.intersectsSphere(n)){t.getInverse(h),e.copy(i.ray).applyMatrix4(t);var u=(l/=(this.scale.x+this.scale.y+this.scale.z)/3)*l;l=new o;var p=new o;if(c.isBufferGeometry){var d=c.index;if(c=c.attributes.position.array,null!==d){var f=d.array;d=0;for(var m=f.length;d<m;d++){var g=f[d];l.fromArray(c,3*g),a(l,g)}}else for(d=0,f=c.length/3;d<f;d++)l.fromArray(c,3*d),a(l,d)}else for(d=0,f=(l=c.vertices).length;d<f;d++)a(l[d],d)}}}(),clone:function(){return new this.constructor(this.geometry,this.material).copy(this)}}),fe.prototype=Object.assign(Object.create(b.prototype),{constructor:fe,isGroup:!0}),me.prototype=Object.assign(Object.create(s.prototype),{constructor:me,isVideoTexture:!0,update:function(){var t=this.image;t.readyState>=t.HAVE_CURRENT_DATA&&(this.needsUpdate=!0)}}),ge.prototype=Object.create(s.prototype),ge.prototype.constructor=ge,ge.prototype.isCompressedTexture=!0,ve.prototype=Object.create(s.prototype),ve.prototype.constructor=ve,ve.prototype.isDepthTexture=!0,ye.prototype=Object.create(B.prototype),ye.prototype.constructor=ye,xe.prototype=Object.create(E.prototype),xe.prototype.constructor=xe,be.prototype=Object.create(B.prototype),be.prototype.constructor=be,we.prototype=Object.create(E.prototype),we.prototype.constructor=we,_e.prototype=Object.create(B.prototype),_e.prototype.constructor=_e,Me.prototype=Object.create(E.prototype),Me.prototype.constructor=Me,Ee.prototype=Object.create(_e.prototype),Ee.prototype.constructor=Ee,Te.prototype=Object.create(E.prototype),Te.prototype.constructor=Te,Se.prototype=Object.create(_e.prototype),Se.prototype.constructor=Se,Ae.prototype=Object.create(E.prototype),Ae.prototype.constructor=Ae,Re.prototype=Object.create(_e.prototype),Re.prototype.constructor=Re,Le.prototype=Object.create(E.prototype),Le.prototype.constructor=Le,Pe.prototype=Object.create(_e.prototype),Pe.prototype.constructor=Pe,Ce.prototype=Object.create(E.prototype),Ce.prototype.constructor=Ce,Oe.prototype=Object.create(B.prototype),Oe.prototype.constructor=Oe,Ie.prototype=Object.create(E.prototype),Ie.prototype.constructor=Ie,Ne.prototype=Object.create(B.prototype),Ne.prototype.constructor=Ne,Ue.prototype=Object.create(E.prototype),Ue.prototype.constructor=Ue,De.prototype=Object.create(B.prototype),De.prototype.constructor=De;var qr=function(t,e,n){n=n||2;var i,r=e&&e.length,o=r?e[0]*n:t.length,a=Be(t,0,o,n,!0),s=[];if(!a)return s;if(r){var c,h=n;r=[];var l=0;for(c=e.length;l<c;l++){var u=e[l]*h;(u=Be(t,u,l<c-1?e[l+1]*h:t.length,h,!1))===u.next&&(u.steiner=!0),r.push(ke(u))}for(r.sort(ze),l=0;l<r.length;l++)(h=He(e=r[l],h=a))&&Fe(e=Ye(h,e),e.next),a=Fe(a,a.next)}if(t.length>80*n){var p=i=t[0],d=r=t[1];for(h=n;h<o;h+=n)(l=t[h])<p&&(p=l),(e=t[h+1])<d&&(d=e),l>i&&(i=l),e>r&&(r=e);i=0!==(i=Math.max(i-p,r-d))?1/i:0}return function t(e,n,i,r,o,a,s){if(e){if(!s&&a){var c=e,h=c;do{null===h.z&&(h.z=Ge(h.x,h.y,r,o,a)),h.prevZ=h.prev,h=h.nextZ=h.next}while(h!==c);h.prevZ.nextZ=null,h.prevZ=null,c=h;var l,u,p,d,f=1;do{h=c;var m=c=null;for(u=0;h;){u++;var g=h;for(l=p=0;l<f&&(p++,g=g.nextZ);l++);for(d=f;0<p||0<d&&g;)0!==p&&(0===d||!g||h.z<=g.z)?(l=h,h=h.nextZ,p--):(l=g,g=g.nextZ,d--),m?m.nextZ=l:c=l,l.prevZ=m,m=l;h=g}m.nextZ=null,f*=2}while(1<u)}for(c=e;e.prev!==e.next;){if(h=e.prev,g=e.next,a)t:{d=r;var v=o,y=a;if(0<=je(u=(m=e).prev,p=m,f=m.next))m=!1;else{var x=u.x>p.x?u.x>f.x?u.x:f.x:p.x>f.x?p.x:f.x,b=u.y>p.y?u.y>f.y?u.y:f.y:p.y>f.y?p.y:f.y;for(l=Ge(u.x<p.x?u.x<f.x?u.x:f.x:p.x<f.x?p.x:f.x,u.y<p.y?u.y<f.y?u.y:f.y:p.y<f.y?p.y:f.y,d,v,y),d=Ge(x,b,d,v,y),v=m.nextZ;v&&v.z<=d;){if(v!==m.prev&&v!==m.next&&Ve(u.x,u.y,p.x,p.y,f.x,f.y,v.x,v.y)&&0<=je(v.prev,v,v.next)){m=!1;break t}v=v.nextZ}for(v=m.prevZ;v&&v.z>=l;){if(v!==m.prev&&v!==m.next&&Ve(u.x,u.y,p.x,p.y,f.x,f.y,v.x,v.y)&&0<=je(v.prev,v,v.next)){m=!1;break t}v=v.prevZ}m=!0}}else t:if(m=e,u=m.prev,p=m,f=m.next,0<=je(u,p,f))m=!1;else{for(l=m.next.next;l!==m.prev;){if(Ve(u.x,u.y,p.x,p.y,f.x,f.y,l.x,l.y)&&0<=je(l.prev,l,l.next)){m=!1;break t}l=l.next}m=!0}if(m)n.push(h.i/i),n.push(e.i/i),n.push(g.i/i),Je(e),c=e=g.next;else if((e=g)===c){if(s){if(1===s){s=n,c=i,h=e;do{!We(g=h.prev,m=h.next.next)&&Xe(g,h,h.next,m)&&qe(g,m)&&qe(m,g)&&(s.push(g.i/c),s.push(h.i/c),s.push(m.i/c),Je(h),Je(h.next),h=e=m),h=h.next}while(h!==e);t(e=h,n,i,r,o,a,2)}else if(2===s)t:{s=e;do{for(c=s.next.next;c!==s.prev;){if(h=s.i!==c.i){if(g=c,m=(h=s).next.i!==g.i&&h.prev.i!==g.i){e:{m=h;do{if(m.i!==h.i&&m.next.i!==h.i&&m.i!==g.i&&m.next.i!==g.i&&Xe(m,m.next,h,g)){m=!0;break e}m=m.next}while(m!==h);m=!1}m=!m}if(m=m&&qe(h,g)&&qe(g,h)){m=h,u=!1,p=(h.x+g.x)/2,g=(h.y+g.y)/2;do{m.y>g!=m.next.y>g&&m.next.y!==m.y&&p<(m.next.x-m.x)*(g-m.y)/(m.next.y-m.y)+m.x&&(u=!u),m=m.next}while(m!==h);m=u}h=m}if(h){e=Ye(s,c),s=Fe(s,s.next),e=Fe(e,e.next),t(s,n,i,r,o,a),t(e,n,i,r,o,a);break t}c=c.next}s=s.next}while(s!==e)}}else t(Fe(e),n,i,r,o,a,1);break}}}}(a,s,n,p,d,i),s},Yr={area:function(t){for(var e=t.length,n=0,i=e-1,r=0;r<e;i=r++)n+=t[i].x*t[r].y-t[r].x*t[i].y;return.5*n},isClockWise:function(t){return 0>Yr.area(t)},triangulateShape:function(t,e){var n=[],i=[],r=[];Ke(t),$e(n,t);var o=t.length;for(e.forEach(Ke),t=0;t<e.length;t++)i.push(o),o+=e[t].length,$e(n,e[t]);for(e=qr(n,i),t=0;t<e.length;t+=3)r.push(e.slice(t,t+3));return r}};tn.prototype=Object.create(E.prototype),tn.prototype.constructor=tn,en.prototype=Object.create(B.prototype),en.prototype.constructor=en;var Zr={generateTopUV:function(t,e,i,r,o){t=e[3*r],r=e[3*r+1];var a=e[3*o];return o=e[3*o+1],[new n(e[3*i],e[3*i+1]),new n(t,r),new n(a,o)]},generateSideWallUV:function(t,e,i,r,o,a){t=e[3*i];var s=e[3*i+1];i=e[3*i+2];var c=e[3*r],h=e[3*r+1];r=e[3*r+2];var l=e[3*o],u=e[3*o+1];o=e[3*o+2];var p=e[3*a],d=e[3*a+1];return e=e[3*a+2],.01>Math.abs(s-h)?[new n(t,1-i),new n(c,1-r),new n(l,1-o),new n(p,1-e)]:[new n(s,1-i),new n(h,1-r),new n(u,1-o),new n(d,1-e)]}};nn.prototype=Object.create(E.prototype),nn.prototype.constructor=nn,rn.prototype=Object.create(en.prototype),rn.prototype.constructor=rn,on.prototype=Object.create(E.prototype),on.prototype.constructor=on,an.prototype=Object.create(B.prototype),an.prototype.constructor=an,sn.prototype=Object.create(E.prototype),sn.prototype.constructor=sn,cn.prototype=Object.create(B.prototype),cn.prototype.constructor=cn,hn.prototype=Object.create(E.prototype),hn.prototype.constructor=hn,ln.prototype=Object.create(B.prototype),ln.prototype.constructor=ln,un.prototype=Object.create(E.prototype),un.prototype.constructor=un,un.prototype.toJSON=function(){var t=E.prototype.toJSON.call(this);return dn(this.parameters.shapes,t)},pn.prototype=Object.create(B.prototype),pn.prototype.constructor=pn,pn.prototype.toJSON=function(){var t=B.prototype.toJSON.call(this);return dn(this.parameters.shapes,t)},fn.prototype=Object.create(B.prototype),fn.prototype.constructor=fn,mn.prototype=Object.create(E.prototype),mn.prototype.constructor=mn,gn.prototype=Object.create(B.prototype),gn.prototype.constructor=gn,vn.prototype=Object.create(mn.prototype),vn.prototype.constructor=vn,yn.prototype=Object.create(gn.prototype),yn.prototype.constructor=yn,xn.prototype=Object.create(E.prototype),xn.prototype.constructor=xn,bn.prototype=Object.create(B.prototype),bn.prototype.constructor=bn;var Jr=Object.freeze({WireframeGeometry:ye,ParametricGeometry:xe,ParametricBufferGeometry:be,TetrahedronGeometry:Me,TetrahedronBufferGeometry:Ee,OctahedronGeometry:Te,OctahedronBufferGeometry:Se,IcosahedronGeometry:Ae,IcosahedronBufferGeometry:Re,DodecahedronGeometry:Le,DodecahedronBufferGeometry:Pe,PolyhedronGeometry:we,PolyhedronBufferGeometry:_e,TubeGeometry:Ce,TubeBufferGeometry:Oe,TorusKnotGeometry:Ie,TorusKnotBufferGeometry:Ne,TorusGeometry:Ue,TorusBufferGeometry:De,TextGeometry:nn,TextBufferGeometry:rn,SphereGeometry:on,SphereBufferGeometry:an,RingGeometry:sn,RingBufferGeometry:cn,PlaneGeometry:H,PlaneBufferGeometry:G,LatheGeometry:hn,LatheBufferGeometry:ln,ShapeGeometry:un,ShapeBufferGeometry:pn,ExtrudeGeometry:tn,ExtrudeBufferGeometry:en,EdgesGeometry:fn,ConeGeometry:vn,ConeBufferGeometry:yn,CylinderGeometry:mn,CylinderBufferGeometry:gn,CircleGeometry:xn,CircleBufferGeometry:bn,BoxGeometry:F,BoxBufferGeometry:z});wn.prototype=Object.create(k.prototype),wn.prototype.constructor=wn,wn.prototype.isShadowMaterial=!0,wn.prototype.copy=function(t){return k.prototype.copy.call(this,t),this.color.copy(t.color),this},_n.prototype=Object.create(j.prototype),_n.prototype.constructor=_n,_n.prototype.isRawShaderMaterial=!0,Mn.prototype=Object.create(k.prototype),Mn.prototype.constructor=Mn,Mn.prototype.isMeshStandardMaterial=!0,Mn.prototype.copy=function(t){return k.prototype.copy.call(this,t),this.defines={STANDARD:""},this.color.copy(t.color),this.roughness=t.roughness,this.metalness=t.metalness,this.map=t.map,this.lightMap=t.lightMap,this.lightMapIntensity=t.lightMapIntensity,this.aoMap=t.aoMap,this.aoMapIntensity=t.aoMapIntensity,this.emissive.copy(t.emissive),this.emissiveMap=t.emissiveMap,this.emissiveIntensity=t.emissiveIntensity,this.bumpMap=t.bumpMap,this.bumpScale=t.bumpScale,this.normalMap=t.normalMap,this.normalScale.copy(t.normalScale),this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this.roughnessMap=t.roughnessMap,this.metalnessMap=t.metalnessMap,this.alphaMap=t.alphaMap,this.envMap=t.envMap,this.envMapIntensity=t.envMapIntensity,this.refractionRatio=t.refractionRatio,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.wireframeLinecap=t.wireframeLinecap,this.wireframeLinejoin=t.wireframeLinejoin,this.skinning=t.skinning,this.morphTargets=t.morphTargets,this.morphNormals=t.morphNormals,this},En.prototype=Object.create(Mn.prototype),En.prototype.constructor=En,En.prototype.isMeshPhysicalMaterial=!0,En.prototype.copy=function(t){return Mn.prototype.copy.call(this,t),this.defines={PHYSICAL:""},this.reflectivity=t.reflectivity,this.clearCoat=t.clearCoat,this.clearCoatRoughness=t.clearCoatRoughness,this},Tn.prototype=Object.create(k.prototype),Tn.prototype.constructor=Tn,Tn.prototype.isMeshPhongMaterial=!0,Tn.prototype.copy=function(t){return k.prototype.copy.call(this,t),this.color.copy(t.color),this.specular.copy(t.specular),this.shininess=t.shininess,this.map=t.map,this.lightMap=t.lightMap,this.lightMapIntensity=t.lightMapIntensity,this.aoMap=t.aoMap,this.aoMapIntensity=t.aoMapIntensity,this.emissive.copy(t.emissive),this.emissiveMap=t.emissiveMap,this.emissiveIntensity=t.emissiveIntensity,this.bumpMap=t.bumpMap,this.bumpScale=t.bumpScale,this.normalMap=t.normalMap,this.normalScale.copy(t.normalScale),this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this.specularMap=t.specularMap,this.alphaMap=t.alphaMap,this.envMap=t.envMap,this.combine=t.combine,this.reflectivity=t.reflectivity,this.refractionRatio=t.refractionRatio,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.wireframeLinecap=t.wireframeLinecap,this.wireframeLinejoin=t.wireframeLinejoin,this.skinning=t.skinning,this.morphTargets=t.morphTargets,this.morphNormals=t.morphNormals,this},Sn.prototype=Object.create(Tn.prototype),Sn.prototype.constructor=Sn,Sn.prototype.isMeshToonMaterial=!0,Sn.prototype.copy=function(t){return Tn.prototype.copy.call(this,t),this.gradientMap=t.gradientMap,this},An.prototype=Object.create(k.prototype),An.prototype.constructor=An,An.prototype.isMeshNormalMaterial=!0,An.prototype.copy=function(t){return k.prototype.copy.call(this,t),this.bumpMap=t.bumpMap,this.bumpScale=t.bumpScale,this.normalMap=t.normalMap,this.normalScale.copy(t.normalScale),this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.skinning=t.skinning,this.morphTargets=t.morphTargets,this.morphNormals=t.morphNormals,this},Rn.prototype=Object.create(k.prototype),Rn.prototype.constructor=Rn,Rn.prototype.isMeshLambertMaterial=!0,Rn.prototype.copy=function(t){return k.prototype.copy.call(this,t),this.color.copy(t.color),this.map=t.map,this.lightMap=t.lightMap,this.lightMapIntensity=t.lightMapIntensity,this.aoMap=t.aoMap,this.aoMapIntensity=t.aoMapIntensity,this.emissive.copy(t.emissive),this.emissiveMap=t.emissiveMap,this.emissiveIntensity=t.emissiveIntensity,this.specularMap=t.specularMap,this.alphaMap=t.alphaMap,this.envMap=t.envMap,this.combine=t.combine,this.reflectivity=t.reflectivity,this.refractionRatio=t.refractionRatio,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.wireframeLinecap=t.wireframeLinecap,this.wireframeLinejoin=t.wireframeLinejoin,this.skinning=t.skinning,this.morphTargets=t.morphTargets,this.morphNormals=t.morphNormals,this},Ln.prototype=Object.create(ce.prototype),Ln.prototype.constructor=Ln,Ln.prototype.isLineDashedMaterial=!0,Ln.prototype.copy=function(t){return ce.prototype.copy.call(this,t),this.scale=t.scale,this.dashSize=t.dashSize,this.gapSize=t.gapSize,this};var Qr=Object.freeze({ShadowMaterial:wn,SpriteMaterial:ne,RawShaderMaterial:_n,ShaderMaterial:j,PointsMaterial:pe,MeshPhysicalMaterial:En,MeshStandardMaterial:Mn,MeshPhongMaterial:Tn,MeshToonMaterial:Sn,MeshNormalMaterial:An,MeshLambertMaterial:Rn,MeshDepthMaterial:Vt,MeshDistanceMaterial:jt,MeshBasicMaterial:V,LineDashedMaterial:Ln,LineBasicMaterial:ce,Material:k}),Kr={enabled:!1,files:{},add:function(t,e){!1!==this.enabled&&(this.files[t]=e)},get:function(t){if(!1!==this.enabled)return this.files[t]},remove:function(t){delete this.files[t]},clear:function(){this.files={}}},$r=new Pn,to={};Object.assign(Cn.prototype,{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=this,o=Kr.get(t);if(void 0!==o)return r.manager.itemStart(t),setTimeout(function(){e&&e(o),r.manager.itemEnd(t)},0),o;if(void 0===to[t]){var a=t.match(/^data:(.*?)(;base64)?,(.*)$/);if(a){n=a[1];var s=!!a[2];a=a[3],a=window.decodeURIComponent(a),s&&(a=window.atob(a));try{var c=(this.responseType||"").toLowerCase();switch(c){case"arraybuffer":case"blob":var h=new Uint8Array(a.length);for(s=0;s<a.length;s++)h[s]=a.charCodeAt(s);var l="blob"===c?new Blob([h.buffer],{type:n}):h.buffer;break;case"document":l=(new DOMParser).parseFromString(a,n);break;case"json":l=JSON.parse(a);break;default:l=a}window.setTimeout(function(){e&&e(l),r.manager.itemEnd(t)},0)}catch(e){window.setTimeout(function(){i&&i(e),r.manager.itemEnd(t),r.manager.itemError(t)},0)}}else{to[t]=[],to[t].push({onLoad:e,onProgress:n,onError:i});var u=new XMLHttpRequest;for(s in u.open("GET",t,!0),u.addEventListener("load",function(e){var n=this.response;Kr.add(t,n);var i=to[t];if(delete to[t],200===this.status){for(var o=0,a=i.length;o<a;o++){var s=i[o];s.onLoad&&s.onLoad(n)}r.manager.itemEnd(t)}else if(0===this.status){for(console.warn("THREE.FileLoader: HTTP Status 0 received."),o=0,a=i.length;o<a;o++)(s=i[o]).onLoad&&s.onLoad(n);r.manager.itemEnd(t)}else{for(o=0,a=i.length;o<a;o++)(s=i[o]).onError&&s.onError(e);r.manager.itemEnd(t),r.manager.itemError(t)}},!1),u.addEventListener("progress",function(e){for(var n=to[t],i=0,r=n.length;i<r;i++){var o=n[i];o.onProgress&&o.onProgress(e)}},!1),u.addEventListener("error",function(e){var n=to[t];delete to[t];for(var i=0,o=n.length;i<o;i++){var a=n[i];a.onError&&a.onError(e)}r.manager.itemEnd(t),r.manager.itemError(t)},!1),void 0!==this.responseType&&(u.responseType=this.responseType),void 0!==this.withCredentials&&(u.withCredentials=this.withCredentials),u.overrideMimeType&&u.overrideMimeType(void 0!==this.mimeType?this.mimeType:"text/plain"),this.requestHeader)u.setRequestHeader(s,this.requestHeader[s]);u.send(null)}return r.manager.itemStart(t),u}to[t].push({onLoad:e,onProgress:n,onError:i})},setPath:function(t){return this.path=t,this},setResponseType:function(t){return this.responseType=t,this},setWithCredentials:function(t){return this.withCredentials=t,this},setMimeType:function(t){return this.mimeType=t,this},setRequestHeader:function(t){return this.requestHeader=t,this}}),Object.assign(On.prototype,{load:function(t,e,n,i){function r(r){c.load(t[r],function(t){t=o._parser(t,!0),a[r]={width:t.width,height:t.height,format:t.format,mipmaps:t.mipmaps},6===(h+=1)&&(1===t.mipmapCount&&(s.minFilter=1006),s.format=t.format,s.needsUpdate=!0,e&&e(s))},n,i)}var o=this,a=[],s=new ge;s.image=a;var c=new Cn(this.manager);if(c.setPath(this.path),c.setResponseType("arraybuffer"),Array.isArray(t))for(var h=0,l=0,u=t.length;l<u;++l)r(l);else c.load(t,function(t){if((t=o._parser(t,!0)).isCubemap)for(var n=t.mipmaps.length/t.mipmapCount,i=0;i<n;i++){a[i]={mipmaps:[]};for(var r=0;r<t.mipmapCount;r++)a[i].mipmaps.push(t.mipmaps[i*t.mipmapCount+r]),a[i].format=t.format,a[i].width=t.width,a[i].height=t.height}else s.image.width=t.width,s.image.height=t.height,s.mipmaps=t.mipmaps;1===t.mipmapCount&&(s.minFilter=1006),s.format=t.format,s.needsUpdate=!0,e&&e(s)},n,i);return s},setPath:function(t){return this.path=t,this}}),Object.assign(In.prototype,{load:function(t,e,n,i){var r=this,o=new u,a=new Cn(this.manager);return a.setResponseType("arraybuffer"),a.load(t,function(t){(t=r._parser(t))&&(void 0!==t.image?o.image=t.image:void 0!==t.data&&(o.image.width=t.width,o.image.height=t.height,o.image.data=t.data),o.wrapS=void 0!==t.wrapS?t.wrapS:1001,o.wrapT=void 0!==t.wrapT?t.wrapT:1001,o.magFilter=void 0!==t.magFilter?t.magFilter:1006,o.minFilter=void 0!==t.minFilter?t.minFilter:1008,o.anisotropy=void 0!==t.anisotropy?t.anisotropy:1,void 0!==t.format&&(o.format=t.format),void 0!==t.type&&(o.type=t.type),void 0!==t.mipmaps&&(o.mipmaps=t.mipmaps),1===t.mipmapCount&&(o.minFilter=1006),o.needsUpdate=!0,e&&e(o,t))},n,i),o}}),Object.assign(Nn.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=this,o=Kr.get(t);return void 0!==o?(r.manager.itemStart(t),setTimeout(function(){e&&e(o),r.manager.itemEnd(t)},0),o):((n=document.createElementNS("http://www.w3.org/1999/xhtml","img")).addEventListener("load",function(){Kr.add(t,this),e&&e(this),r.manager.itemEnd(t)},!1),n.addEventListener("error",function(e){i&&i(e),r.manager.itemEnd(t),r.manager.itemError(t)},!1),"data:"!==t.substr(0,5)&&void 0!==this.crossOrigin&&(n.crossOrigin=this.crossOrigin),r.manager.itemStart(t),n.src=t,n)},setCrossOrigin:function(t){return this.crossOrigin=t,this},setPath:function(t){return this.path=t,this}}),Object.assign(Un.prototype,{crossOrigin:"Anonymous",load:function(t,e,n,i){function r(n){a.load(t[n],function(t){o.images[n]=t,6===++s&&(o.needsUpdate=!0,e&&e(o))},void 0,i)}var o=new $,a=new Nn(this.manager);a.setCrossOrigin(this.crossOrigin),a.setPath(this.path);var s=0;for(n=0;n<t.length;++n)r(n);return o},setCrossOrigin:function(t){return this.crossOrigin=t,this},setPath:function(t){return this.path=t,this}}),Object.assign(Dn.prototype,{crossOrigin:"Anonymous",load:function(t,e,n,i){var r=new s,o=new Nn(this.manager);return o.setCrossOrigin(this.crossOrigin),o.setPath(this.path),o.load(t,function(n){r.image=n,n=0<t.search(/\.(jpg|jpeg)$/)||0===t.search(/^data:image\/jpeg/),r.format=n?1022:1023,r.needsUpdate=!0,void 0!==e&&e(r)},n,i),r},setCrossOrigin:function(t){return this.crossOrigin=t,this},setPath:function(t){return this.path=t,this}}),Object.assign(Bn.prototype,{getPoint:function(){return console.warn("THREE.Curve: .getPoint() not implemented."),null},getPointAt:function(t,e){return t=this.getUtoTmapping(t),this.getPoint(t,e)},getPoints:function(t){void 0===t&&(t=5);for(var e=[],n=0;n<=t;n++)e.push(this.getPoint(n/t));return e},getSpacedPoints:function(t){void 0===t&&(t=5);for(var e=[],n=0;n<=t;n++)e.push(this.getPointAt(n/t));return e},getLength:function(){var t=this.getLengths();return t[t.length-1]},getLengths:function(t){if(void 0===t&&(t=this.arcLengthDivisions),this.cacheArcLengths&&this.cacheArcLengths.length===t+1&&!this.needsUpdate)return this.cacheArcLengths;this.needsUpdate=!1;var e,n=[],i=this.getPoint(0),r=0;for(n.push(0),e=1;e<=t;e++){var o=this.getPoint(e/t);r+=o.distanceTo(i),n.push(r),i=o}return this.cacheArcLengths=n},updateArcLengths:function(){this.needsUpdate=!0,this.getLengths()},getUtoTmapping:function(t,e){var n=this.getLengths(),i=n.length;e=e||t*n[i-1];for(var r,o=0,a=i-1;o<=a;)if(0>(r=n[t=Math.floor(o+(a-o)/2)]-e))o=t+1;else{if(!(0<r)){a=t;break}a=t-1}return n[t=a]===e?t/(i-1):(t+(e-(o=n[t]))/(n[t+1]-o))/(i-1)},getTangent:function(t){var e=t-1e-4;return 0>e&&(e=0),1<(t+=1e-4)&&(t=1),e=this.getPoint(e),this.getPoint(t).clone().sub(e).normalize()},getTangentAt:function(t){return t=this.getUtoTmapping(t),this.getTangent(t)},computeFrenetFrames:function(t,e){var n,r=new o,a=[],s=[],c=[],h=new o,l=new i;for(n=0;n<=t;n++){var u=n/t;a[n]=this.getTangentAt(u),a[n].normalize()}s[0]=new o,c[0]=new o,n=Number.MAX_VALUE,u=Math.abs(a[0].x);var p=Math.abs(a[0].y),d=Math.abs(a[0].z);for(u<=n&&(n=u,r.set(1,0,0)),p<=n&&(n=p,r.set(0,1,0)),d<=n&&r.set(0,0,1),h.crossVectors(a[0],r).normalize(),s[0].crossVectors(a[0],h),c[0].crossVectors(a[0],s[0]),n=1;n<=t;n++)s[n]=s[n-1].clone(),c[n]=c[n-1].clone(),h.crossVectors(a[n-1],a[n]),h.length()>Number.EPSILON&&(h.normalize(),r=Math.acos(Ar.clamp(a[n-1].dot(a[n]),-1,1)),s[n].applyMatrix4(l.makeRotationAxis(h,r))),c[n].crossVectors(a[n],s[n]);if(!0===e)for(r=Math.acos(Ar.clamp(s[0].dot(s[t]),-1,1)),r/=t,0<a[0].dot(h.crossVectors(s[0],s[t]))&&(r=-r),n=1;n<=t;n++)s[n].applyMatrix4(l.makeRotationAxis(a[n],r*n)),c[n].crossVectors(a[n],s[n]);return{tangents:a,normals:s,binormals:c}},clone:function(){return(new this.constructor).copy(this)},copy:function(t){return this.arcLengthDivisions=t.arcLengthDivisions,this},toJSON:function(){var t={metadata:{version:4.5,type:"Curve",generator:"Curve.toJSON"}};return t.arcLengthDivisions=this.arcLengthDivisions,t.type=this.type,t},fromJSON:function(t){return this.arcLengthDivisions=t.arcLengthDivisions,this}}),Fn.prototype=Object.create(Bn.prototype),Fn.prototype.constructor=Fn,Fn.prototype.isEllipseCurve=!0,Fn.prototype.getPoint=function(t,e){e=e||new n;for(var i=2*Math.PI,r=this.aEndAngle-this.aStartAngle,o=Math.abs(r)<Number.EPSILON;0>r;)r+=i;for(;r>i;)r-=i;r<Number.EPSILON&&(r=o?0:i),!0!==this.aClockwise||o||(r=r===i?-i:r-i),i=this.aStartAngle+t*r,t=this.aX+this.xRadius*Math.cos(i);var a=this.aY+this.yRadius*Math.sin(i);return 0!==this.aRotation&&(i=Math.cos(this.aRotation),r=Math.sin(this.aRotation),t=(o=t-this.aX)*i-(a-=this.aY)*r+this.aX,a=o*r+a*i+this.aY),e.set(t,a)},Fn.prototype.copy=function(t){return Bn.prototype.copy.call(this,t),this.aX=t.aX,this.aY=t.aY,this.xRadius=t.xRadius,this.yRadius=t.yRadius,this.aStartAngle=t.aStartAngle,this.aEndAngle=t.aEndAngle,this.aClockwise=t.aClockwise,this.aRotation=t.aRotation,this},Fn.prototype.toJSON=function(){var t=Bn.prototype.toJSON.call(this);return t.aX=this.aX,t.aY=this.aY,t.xRadius=this.xRadius,t.yRadius=this.yRadius,t.aStartAngle=this.aStartAngle,t.aEndAngle=this.aEndAngle,t.aClockwise=this.aClockwise,t.aRotation=this.aRotation,t},Fn.prototype.fromJSON=function(t){return Bn.prototype.fromJSON.call(this,t),this.aX=t.aX,this.aY=t.aY,this.xRadius=t.xRadius,this.yRadius=t.yRadius,this.aStartAngle=t.aStartAngle,this.aEndAngle=t.aEndAngle,this.aClockwise=t.aClockwise,this.aRotation=t.aRotation,this},zn.prototype=Object.create(Fn.prototype),zn.prototype.constructor=zn,zn.prototype.isArcCurve=!0;var eo=new o,no=new Hn,io=new Hn,ro=new Hn;Gn.prototype=Object.create(Bn.prototype),Gn.prototype.constructor=Gn,Gn.prototype.isCatmullRomCurve3=!0,Gn.prototype.getPoint=function(t,e){e=e||new o;var n=this.points,i=n.length;t*=i-(this.closed?0:1);var r=Math.floor(t);if(t-=r,this.closed?r+=0<r?0:(Math.floor(Math.abs(r)/i)+1)*i:0===t&&r===i-1&&(r=i-2,t=1),this.closed||0<r)var a=n[(r-1)%i];else eo.subVectors(n[0],n[1]).add(n[0]),a=eo;var s=n[r%i],c=n[(r+1)%i];if(this.closed||r+2<i?n=n[(r+2)%i]:(eo.subVectors(n[i-1],n[i-2]).add(n[i-1]),n=eo),"centripetal"===this.curveType||"chordal"===this.curveType){var h="chordal"===this.curveType?.5:.25;i=Math.pow(a.distanceToSquared(s),h),1e-4>(r=Math.pow(s.distanceToSquared(c),h))&&(r=1),1e-4>i&&(i=r),1e-4>(h=Math.pow(c.distanceToSquared(n),h))&&(h=r),no.initNonuniformCatmullRom(a.x,s.x,c.x,n.x,i,r,h),io.initNonuniformCatmullRom(a.y,s.y,c.y,n.y,i,r,h),ro.initNonuniformCatmullRom(a.z,s.z,c.z,n.z,i,r,h)}else"catmullrom"===this.curveType&&(no.initCatmullRom(a.x,s.x,c.x,n.x,this.tension),io.initCatmullRom(a.y,s.y,c.y,n.y,this.tension),ro.initCatmullRom(a.z,s.z,c.z,n.z,this.tension));return e.set(no.calc(t),io.calc(t),ro.calc(t)),e},Gn.prototype.copy=function(t){Bn.prototype.copy.call(this,t),this.points=[];for(var e=0,n=t.points.length;e<n;e++)this.points.push(t.points[e].clone());return this.closed=t.closed,this.curveType=t.curveType,this.tension=t.tension,this},Gn.prototype.toJSON=function(){var t=Bn.prototype.toJSON.call(this);t.points=[];for(var e=0,n=this.points.length;e<n;e++)t.points.push(this.points[e].toArray());return t.closed=this.closed,t.curveType=this.curveType,t.tension=this.tension,t},Gn.prototype.fromJSON=function(t){Bn.prototype.fromJSON.call(this,t),this.points=[];for(var e=0,n=t.points.length;e<n;e++){var i=t.points[e];this.points.push((new o).fromArray(i))}return this.closed=t.closed,this.curveType=t.curveType,this.tension=t.tension,this},Wn.prototype=Object.create(Bn.prototype),Wn.prototype.constructor=Wn,Wn.prototype.isCubicBezierCurve=!0,Wn.prototype.getPoint=function(t,e){e=e||new n;var i=this.v0,r=this.v1,o=this.v2,a=this.v3;return e.set(jn(t,i.x,r.x,o.x,a.x),jn(t,i.y,r.y,o.y,a.y)),e},Wn.prototype.copy=function(t){return Bn.prototype.copy.call(this,t),this.v0.copy(t.v0),this.v1.copy(t.v1),this.v2.copy(t.v2),this.v3.copy(t.v3),this},Wn.prototype.toJSON=function(){var t=Bn.prototype.toJSON.call(this);return t.v0=this.v0.toArray(),t.v1=this.v1.toArray(),t.v2=this.v2.toArray(),t.v3=this.v3.toArray(),t},Wn.prototype.fromJSON=function(t){return Bn.prototype.fromJSON.call(this,t),this.v0.fromArray(t.v0),this.v1.fromArray(t.v1),this.v2.fromArray(t.v2),this.v3.fromArray(t.v3),this},Xn.prototype=Object.create(Bn.prototype),Xn.prototype.constructor=Xn,Xn.prototype.isCubicBezierCurve3=!0,Xn.prototype.getPoint=function(t,e){e=e||new o;var n=this.v0,i=this.v1,r=this.v2,a=this.v3;return e.set(jn(t,n.x,i.x,r.x,a.x),jn(t,n.y,i.y,r.y,a.y),jn(t,n.z,i.z,r.z,a.z)),e},Xn.prototype.copy=function(t){return Bn.prototype.copy.call(this,t),this.v0.copy(t.v0),this.v1.copy(t.v1),this.v2.copy(t.v2),this.v3.copy(t.v3),this},Xn.prototype.toJSON=function(){var t=Bn.prototype.toJSON.call(this);return t.v0=this.v0.toArray(),t.v1=this.v1.toArray(),t.v2=this.v2.toArray(),t.v3=this.v3.toArray(),t},Xn.prototype.fromJSON=function(t){return Bn.prototype.fromJSON.call(this,t),this.v0.fromArray(t.v0),this.v1.fromArray(t.v1),this.v2.fromArray(t.v2),this.v3.fromArray(t.v3),this},qn.prototype=Object.create(Bn.prototype),qn.prototype.constructor=qn,qn.prototype.isLineCurve=!0,qn.prototype.getPoint=function(t,e){return e=e||new n,1===t?e.copy(this.v2):(e.copy(this.v2).sub(this.v1),e.multiplyScalar(t).add(this.v1)),e},qn.prototype.getPointAt=function(t,e){return this.getPoint(t,e)},qn.prototype.getTangent=function(){return this.v2.clone().sub(this.v1).normalize()},qn.prototype.copy=function(t){return Bn.prototype.copy.call(this,t),this.v1.copy(t.v1),this.v2.copy(t.v2),this},qn.prototype.toJSON=function(){var t=Bn.prototype.toJSON.call(this);return t.v1=this.v1.toArray(),t.v2=this.v2.toArray(),t},qn.prototype.fromJSON=function(t){return Bn.prototype.fromJSON.call(this,t),this.v1.fromArray(t.v1),this.v2.fromArray(t.v2),this},Yn.prototype=Object.create(Bn.prototype),Yn.prototype.constructor=Yn,Yn.prototype.isLineCurve3=!0,Yn.prototype.getPoint=function(t,e){return e=e||new o,1===t?e.copy(this.v2):(e.copy(this.v2).sub(this.v1),e.multiplyScalar(t).add(this.v1)),e},Yn.prototype.getPointAt=function(t,e){return this.getPoint(t,e)},Yn.prototype.copy=function(t){return Bn.prototype.copy.call(this,t),this.v1.copy(t.v1),this.v2.copy(t.v2),this},Yn.prototype.toJSON=function(){var t=Bn.prototype.toJSON.call(this);return t.v1=this.v1.toArray(),t.v2=this.v2.toArray(),t},Yn.prototype.fromJSON=function(t){return Bn.prototype.fromJSON.call(this,t),this.v1.fromArray(t.v1),this.v2.fromArray(t.v2),this},Zn.prototype=Object.create(Bn.prototype),Zn.prototype.constructor=Zn,Zn.prototype.isQuadraticBezierCurve=!0,Zn.prototype.getPoint=function(t,e){e=e||new n;var i=this.v0,r=this.v1,o=this.v2;return e.set(Vn(t,i.x,r.x,o.x),Vn(t,i.y,r.y,o.y)),e},Zn.prototype.copy=function(t){return Bn.prototype.copy.call(this,t),this.v0.copy(t.v0),this.v1.copy(t.v1),this.v2.copy(t.v2),this},Zn.prototype.toJSON=function(){var t=Bn.prototype.toJSON.call(this);return t.v0=this.v0.toArray(),t.v1=this.v1.toArray(),t.v2=this.v2.toArray(),t},Zn.prototype.fromJSON=function(t){return Bn.prototype.fromJSON.call(this,t),this.v0.fromArray(t.v0),this.v1.fromArray(t.v1),this.v2.fromArray(t.v2),this},Jn.prototype=Object.create(Bn.prototype),Jn.prototype.constructor=Jn,Jn.prototype.isQuadraticBezierCurve3=!0,Jn.prototype.getPoint=function(t,e){e=e||new o;var n=this.v0,i=this.v1,r=this.v2;return e.set(Vn(t,n.x,i.x,r.x),Vn(t,n.y,i.y,r.y),Vn(t,n.z,i.z,r.z)),e},Jn.prototype.copy=function(t){return Bn.prototype.copy.call(this,t),this.v0.copy(t.v0),this.v1.copy(t.v1),this.v2.copy(t.v2),this},Jn.prototype.toJSON=function(){var t=Bn.prototype.toJSON.call(this);return t.v0=this.v0.toArray(),t.v1=this.v1.toArray(),t.v2=this.v2.toArray(),t},Jn.prototype.fromJSON=function(t){return Bn.prototype.fromJSON.call(this,t),this.v0.fromArray(t.v0),this.v1.fromArray(t.v1),this.v2.fromArray(t.v2),this},Qn.prototype=Object.create(Bn.prototype),Qn.prototype.constructor=Qn,Qn.prototype.isSplineCurve=!0,Qn.prototype.getPoint=function(t,e){e=e||new n;var i=this.points,r=(i.length-1)*t;r-=t=Math.floor(r);var o=i[0===t?t:t-1],a=i[t],s=i[t>i.length-2?i.length-1:t+1];return i=i[t>i.length-3?i.length-1:t+2],e.set(kn(r,o.x,a.x,s.x,i.x),kn(r,o.y,a.y,s.y,i.y)),e},Qn.prototype.copy=function(t){Bn.prototype.copy.call(this,t),this.points=[];for(var e=0,n=t.points.length;e<n;e++)this.points.push(t.points[e].clone());return this},Qn.prototype.toJSON=function(){var t=Bn.prototype.toJSON.call(this);t.points=[];for(var e=0,n=this.points.length;e<n;e++)t.points.push(this.points[e].toArray());return t},Qn.prototype.fromJSON=function(t){Bn.prototype.fromJSON.call(this,t),this.points=[];for(var e=0,i=t.points.length;e<i;e++){var r=t.points[e];this.points.push((new n).fromArray(r))}return this};var oo=Object.freeze({ArcCurve:zn,CatmullRomCurve3:Gn,CubicBezierCurve:Wn,CubicBezierCurve3:Xn,EllipseCurve:Fn,LineCurve:qn,LineCurve3:Yn,QuadraticBezierCurve:Zn,QuadraticBezierCurve3:Jn,SplineCurve:Qn});Kn.prototype=Object.assign(Object.create(Bn.prototype),{constructor:Kn,add:function(t){this.curves.push(t)},closePath:function(){var t=this.curves[0].getPoint(0),e=this.curves[this.curves.length-1].getPoint(1);t.equals(e)||this.curves.push(new qn(e,t))},getPoint:function(t){var e=t*this.getLength(),n=this.getCurveLengths();for(t=0;t<n.length;){if(n[t]>=e)return e=n[t]-e,n=(t=this.curves[t]).getLength(),t.getPointAt(0===n?0:1-e/n);t++}return null},getLength:function(){var t=this.getCurveLengths();return t[t.length-1]},updateArcLengths:function(){this.needsUpdate=!0,this.cacheLengths=null,this.getCurveLengths()},getCurveLengths:function(){if(this.cacheLengths&&this.cacheLengths.length===this.curves.length)return this.cacheLengths;for(var t=[],e=0,n=0,i=this.curves.length;n<i;n++)e+=this.curves[n].getLength(),t.push(e);return this.cacheLengths=t},getSpacedPoints:function(t){void 0===t&&(t=40);for(var e=[],n=0;n<=t;n++)e.push(this.getPoint(n/t));return this.autoClose&&e.push(e[0]),e},getPoints:function(t){t=t||12;for(var e,n=[],i=0,r=this.curves;i<r.length;i++){var o=r[i];o=o.getPoints(o&&o.isEllipseCurve?2*t:o&&o.isLineCurve?1:o&&o.isSplineCurve?t*o.points.length:t);for(var a=0;a<o.length;a++){var s=o[a];e&&e.equals(s)||(n.push(s),e=s)}}return this.autoClose&&1<n.length&&!n[n.length-1].equals(n[0])&&n.push(n[0]),n},copy:function(t){Bn.prototype.copy.call(this,t),this.curves=[];for(var e=0,n=t.curves.length;e<n;e++)this.curves.push(t.curves[e].clone());return this.autoClose=t.autoClose,this},toJSON:function(){var t=Bn.prototype.toJSON.call(this);t.autoClose=this.autoClose,t.curves=[];for(var e=0,n=this.curves.length;e<n;e++)t.curves.push(this.curves[e].toJSON());return t},fromJSON:function(t){Bn.prototype.fromJSON.call(this,t),this.autoClose=t.autoClose,this.curves=[];for(var e=0,n=t.curves.length;e<n;e++){var i=t.curves[e];this.curves.push((new oo[i.type]).fromJSON(i))}return this}}),$n.prototype=Object.assign(Object.create(Kn.prototype),{constructor:$n,setFromPoints:function(t){this.moveTo(t[0].x,t[0].y);for(var e=1,n=t.length;e<n;e++)this.lineTo(t[e].x,t[e].y)},moveTo:function(t,e){this.currentPoint.set(t,e)},lineTo:function(t,e){var i=new qn(this.currentPoint.clone(),new n(t,e));this.curves.push(i),this.currentPoint.set(t,e)},quadraticCurveTo:function(t,e,i,r){t=new Zn(this.currentPoint.clone(),new n(t,e),new n(i,r)),this.curves.push(t),this.currentPoint.set(i,r)},bezierCurveTo:function(t,e,i,r,o,a){t=new Wn(this.currentPoint.clone(),new n(t,e),new n(i,r),new n(o,a)),this.curves.push(t),this.currentPoint.set(o,a)},splineThru:function(t){var e=[this.currentPoint.clone()].concat(t);e=new Qn(e),this.curves.push(e),this.currentPoint.copy(t[t.length-1])},arc:function(t,e,n,i,r,o){this.absarc(t+this.currentPoint.x,e+this.currentPoint.y,n,i,r,o)},absarc:function(t,e,n,i,r,o){this.absellipse(t,e,n,n,i,r,o)},ellipse:function(t,e,n,i,r,o,a,s){this.absellipse(t+this.currentPoint.x,e+this.currentPoint.y,n,i,r,o,a,s)},absellipse:function(t,e,n,i,r,o,a,s){t=new Fn(t,e,n,i,r,o,a,s),0<this.curves.length&&((e=t.getPoint(0)).equals(this.currentPoint)||this.lineTo(e.x,e.y)),this.curves.push(t),t=t.getPoint(1),this.currentPoint.copy(t)},copy:function(t){return Kn.prototype.copy.call(this,t),this.currentPoint.copy(t.currentPoint),this},toJSON:function(){var t=Kn.prototype.toJSON.call(this);return t.currentPoint=this.currentPoint.toArray(),t},fromJSON:function(t){return Kn.prototype.fromJSON.call(this,t),this.currentPoint.fromArray(t.currentPoint),this}}),ti.prototype=Object.assign(Object.create($n.prototype),{constructor:ti,getPointsHoles:function(t){for(var e=[],n=0,i=this.holes.length;n<i;n++)e[n]=this.holes[n].getPoints(t);return e},extractPoints:function(t){return{shape:this.getPoints(t),holes:this.getPointsHoles(t)}},copy:function(t){$n.prototype.copy.call(this,t),this.holes=[];for(var e=0,n=t.holes.length;e<n;e++)this.holes.push(t.holes[e].clone());return this},toJSON:function(){var t=$n.prototype.toJSON.call(this);t.uuid=this.uuid,t.holes=[];for(var e=0,n=this.holes.length;e<n;e++)t.holes.push(this.holes[e].toJSON());return t},fromJSON:function(t){$n.prototype.fromJSON.call(this,t),this.uuid=t.uuid,this.holes=[];for(var e=0,n=t.holes.length;e<n;e++){var i=t.holes[e];this.holes.push((new $n).fromJSON(i))}return this}}),ei.prototype=Object.assign(Object.create(b.prototype),{constructor:ei,isLight:!0,copy:function(t){return b.prototype.copy.call(this,t),this.color.copy(t.color),this.intensity=t.intensity,this},toJSON:function(t){return(t=b.prototype.toJSON.call(this,t)).object.color=this.color.getHex(),t.object.intensity=this.intensity,void 0!==this.groundColor&&(t.object.groundColor=this.groundColor.getHex()),void 0!==this.distance&&(t.object.distance=this.distance),void 0!==this.angle&&(t.object.angle=this.angle),void 0!==this.decay&&(t.object.decay=this.decay),void 0!==this.penumbra&&(t.object.penumbra=this.penumbra),void 0!==this.shadow&&(t.object.shadow=this.shadow.toJSON()),t}}),ni.prototype=Object.assign(Object.create(ei.prototype),{constructor:ni,isHemisphereLight:!0,copy:function(t){return ei.prototype.copy.call(this,t),this.groundColor.copy(t.groundColor),this}}),Object.assign(ii.prototype,{copy:function(t){return this.camera=t.camera.clone(),this.bias=t.bias,this.radius=t.radius,this.mapSize.copy(t.mapSize),this},clone:function(){return(new this.constructor).copy(this)},toJSON:function(){var t={};return 0!==this.bias&&(t.bias=this.bias),1!==this.radius&&(t.radius=this.radius),512===this.mapSize.x&&512===this.mapSize.y||(t.mapSize=this.mapSize.toArray()),t.camera=this.camera.toJSON(!1).object,delete t.camera.matrix,t}}),ri.prototype=Object.assign(Object.create(ii.prototype),{constructor:ri,isSpotLightShadow:!0,update:function(t){var e=this.camera,n=2*Ar.RAD2DEG*t.angle,i=this.mapSize.width/this.mapSize.height;t=t.distance||e.far,n===e.fov&&i===e.aspect&&t===e.far||(e.fov=n,e.aspect=i,e.far=t,e.updateProjectionMatrix())}}),oi.prototype=Object.assign(Object.create(ei.prototype),{constructor:oi,isSpotLight:!0,copy:function(t){return ei.prototype.copy.call(this,t),this.distance=t.distance,this.angle=t.angle,this.penumbra=t.penumbra,this.decay=t.decay,this.target=t.target.clone(),this.shadow=t.shadow.clone(),this}}),ai.prototype=Object.assign(Object.create(ei.prototype),{constructor:ai,isPointLight:!0,copy:function(t){return ei.prototype.copy.call(this,t),this.distance=t.distance,this.decay=t.decay,this.shadow=t.shadow.clone(),this}}),si.prototype=Object.assign(Object.create(ii.prototype),{constructor:si}),ci.prototype=Object.assign(Object.create(ei.prototype),{constructor:ci,isDirectionalLight:!0,copy:function(t){return ei.prototype.copy.call(this,t),this.target=t.target.clone(),this.shadow=t.shadow.clone(),this}}),hi.prototype=Object.assign(Object.create(ei.prototype),{constructor:hi,isAmbientLight:!0}),li.prototype=Object.assign(Object.create(ei.prototype),{constructor:li,isRectAreaLight:!0,copy:function(t){return ei.prototype.copy.call(this,t),this.width=t.width,this.height=t.height,this},toJSON:function(t){return(t=ei.prototype.toJSON.call(this,t)).object.width=this.width,t.object.height=this.height,t}}),ui.prototype=Object.assign(Object.create(wi.prototype),{constructor:ui,ValueTypeName:"string",ValueBufferType:Array,DefaultInterpolation:2300,InterpolantFactoryMethodLinear:void 0,InterpolantFactoryMethodSmooth:void 0}),pi.prototype=Object.assign(Object.create(wi.prototype),{constructor:pi,ValueTypeName:"bool",ValueBufferType:Array,DefaultInterpolation:2300,InterpolantFactoryMethodLinear:void 0,InterpolantFactoryMethodSmooth:void 0}),Object.assign(di.prototype,{evaluate:function(t){var e=this.parameterPositions,n=this._cachedIndex,i=e[n],r=e[n-1];t:{e:{n:{i:if(!(t<i)){for(var o=n+2;;){if(void 0===i){if(t<r)break i;return this._cachedIndex=n=e.length,this.afterEnd_(n-1,t,r)}if(n===o)break;if(r=i,t<(i=e[++n]))break e}i=e.length;break n}if(t>=r)break t;for(t<(o=e[1])&&(n=2,r=o),o=n-2;;){if(void 0===r)return this._cachedIndex=0,this.beforeStart_(0,t,i);if(n===o)break;if(i=r,t>=(r=e[--n-1]))break e}i=n,n=0}for(;n<i;)t<e[r=n+i>>>1]?i=r:n=r+1;if(i=e[n],void 0===(r=e[n-1]))return this._cachedIndex=0,this.beforeStart_(0,t,i);if(void 0===i)return this._cachedIndex=n=e.length,this.afterEnd_(n-1,r,t)}this._cachedIndex=n,this.intervalChanged_(n,r,i)}return this.interpolate_(n,r,t,i)},settings:null,DefaultSettings_:{},getSettings_:function(){return this.settings||this.DefaultSettings_},copySampleValue_:function(t){var e=this.resultBuffer,n=this.sampleValues,i=this.valueSize;t*=i;for(var r=0;r!==i;++r)e[r]=n[t+r];return e},interpolate_:function(){throw Error("call to abstract method")},intervalChanged_:function(){}}),Object.assign(di.prototype,{beforeStart_:di.prototype.copySampleValue_,afterEnd_:di.prototype.copySampleValue_}),fi.prototype=Object.assign(Object.create(di.prototype),{constructor:fi,interpolate_:function(t,e,n,i){var o=this.resultBuffer,a=this.sampleValues,s=this.valueSize;for(e=(n-e)/(i-e),n=(t*=s)+s;t!==n;t+=4)r.slerpFlat(o,0,a,t-s,a,t,e);return o}}),mi.prototype=Object.assign(Object.create(wi.prototype),{constructor:mi,ValueTypeName:"quaternion",DefaultInterpolation:2301,InterpolantFactoryMethodLinear:function(t){return new fi(this.times,this.values,this.getValueSize(),t)},InterpolantFactoryMethodSmooth:void 0}),gi.prototype=Object.assign(Object.create(wi.prototype),{constructor:gi,ValueTypeName:"color"}),vi.prototype=Object.assign(Object.create(wi.prototype),{constructor:vi,ValueTypeName:"number"}),yi.prototype=Object.assign(Object.create(di.prototype),{constructor:yi,DefaultSettings_:{endingStart:2400,endingEnd:2400},intervalChanged_:function(t,e,n){var i=this.parameterPositions,r=t-2,o=t+1,a=i[r],s=i[o];if(void 0===a)switch(this.getSettings_().endingStart){case 2401:r=t,a=2*e-n;break;case 2402:a=e+i[r=i.length-2]-i[r+1];break;default:r=t,a=n}if(void 0===s)switch(this.getSettings_().endingEnd){case 2401:o=t,s=2*n-e;break;case 2402:o=1,s=n+i[1]-i[0];break;default:o=t-1,s=e}t=.5*(n-e),i=this.valueSize,this._weightPrev=t/(e-a),this._weightNext=t/(s-n),this._offsetPrev=r*i,this._offsetNext=o*i},interpolate_:function(t,e,n,i){var r=this.resultBuffer,o=this.sampleValues,a=this.valueSize,s=(t*=a)-a,c=this._offsetPrev,h=this._offsetNext,l=this._weightPrev,u=this._weightNext,p=(n-e)/(i-e);for(e=-l*(i=(n=p*p)*p)+2*l*n-l*p,l=(1+l)*i+(-1.5-2*l)*n+(-.5+l)*p+1,p=(-1-u)*i+(1.5+u)*n+.5*p,u=u*i-u*n,n=0;n!==a;++n)r[n]=e*o[c+n]+l*o[s+n]+p*o[t+n]+u*o[h+n];return r}}),xi.prototype=Object.assign(Object.create(di.prototype),{constructor:xi,interpolate_:function(t,e,n,i){var r=this.resultBuffer,o=this.sampleValues,a=this.valueSize,s=(t*=a)-a;for(n=1-(e=(n-e)/(i-e)),i=0;i!==a;++i)r[i]=o[s+i]*n+o[t+i]*e;return r}}),bi.prototype=Object.assign(Object.create(di.prototype),{constructor:bi,interpolate_:function(t){return this.copySampleValue_(t-1)}});var ao={arraySlice:function(t,e,n){return ao.isTypedArray(t)?new t.constructor(t.subarray(e,void 0!==n?n:t.length)):t.slice(e,n)},convertArray:function(t,e,n){return!t||!n&&t.constructor===e?t:"number"==typeof e.BYTES_PER_ELEMENT?new e(t):Array.prototype.slice.call(t)},isTypedArray:function(t){return ArrayBuffer.isView(t)&&!(t instanceof DataView)},getKeyframeOrder:function(t){for(var e=t.length,n=Array(e),i=0;i!==e;++i)n[i]=i;return n.sort(function(e,n){return t[e]-t[n]}),n},sortedArray:function(t,e,n){for(var i=t.length,r=new t.constructor(i),o=0,a=0;a!==i;++o)for(var s=n[o]*e,c=0;c!==e;++c)r[a++]=t[s+c];return r},flattenJSON:function(t,e,n,i){for(var r=1,o=t[0];void 0!==o&&void 0===o[i];)o=t[r++];if(void 0!==o){var a=o[i];if(void 0!==a)if(Array.isArray(a))do{void 0!==(a=o[i])&&(e.push(o.time),n.push.apply(n,a)),o=t[r++]}while(void 0!==o);else if(void 0!==a.toArray)do{void 0!==(a=o[i])&&(e.push(o.time),a.toArray(n,n.length)),o=t[r++]}while(void 0!==o);else do{void 0!==(a=o[i])&&(e.push(o.time),n.push(a)),o=t[r++]}while(void 0!==o)}}};Object.assign(wi,{parse:function(t){if(void 0===t.type)throw Error("THREE.KeyframeTrack: track type undefined, can not parse");var e=wi._getTrackTypeForValueTypeName(t.type);if(void 0===t.times){var n=[],i=[];ao.flattenJSON(t.keys,n,i,"value"),t.times=n,t.values=i}return void 0!==e.parse?e.parse(t):new e(t.name,t.times,t.values,t.interpolation)},toJSON:function(t){var e=t.constructor;if(void 0!==e.toJSON)e=e.toJSON(t);else{e={name:t.name,times:ao.convertArray(t.times,Array),values:ao.convertArray(t.values,Array)};var n=t.getInterpolation();n!==t.DefaultInterpolation&&(e.interpolation=n)}return e.type=t.ValueTypeName,e},_getTrackTypeForValueTypeName:function(t){switch(t.toLowerCase()){case"scalar":case"double":case"float":case"number":case"integer":return vi;case"vector":case"vector2":case"vector3":case"vector4":return _i;case"color":return gi;case"quaternion":return mi;case"bool":case"boolean":return pi;case"string":return ui}throw Error("THREE.KeyframeTrack: Unsupported typeName: "+t)}}),Object.assign(wi.prototype,{constructor:wi,TimeBufferType:Float32Array,ValueBufferType:Float32Array,DefaultInterpolation:2301,InterpolantFactoryMethodDiscrete:function(t){return new bi(this.times,this.values,this.getValueSize(),t)},InterpolantFactoryMethodLinear:function(t){return new xi(this.times,this.values,this.getValueSize(),t)},InterpolantFactoryMethodSmooth:function(t){return new yi(this.times,this.values,this.getValueSize(),t)},setInterpolation:function(t){switch(t){case 2300:var e=this.InterpolantFactoryMethodDiscrete;break;case 2301:e=this.InterpolantFactoryMethodLinear;break;case 2302:e=this.InterpolantFactoryMethodSmooth}if(void 0===e){if(e="unsupported interpolation for "+this.ValueTypeName+" keyframe track named "+this.name,void 0===this.createInterpolant){if(t===this.DefaultInterpolation)throw Error(e);this.setInterpolation(this.DefaultInterpolation)}console.warn("THREE.KeyframeTrack:",e)}else this.createInterpolant=e},getInterpolation:function(){switch(this.createInterpolant){case this.InterpolantFactoryMethodDiscrete:return 2300;case this.InterpolantFactoryMethodLinear:return 2301;case this.InterpolantFactoryMethodSmooth:return 2302}},getValueSize:function(){return this.values.length/this.times.length},shift:function(t){if(0!==t)for(var e=this.times,n=0,i=e.length;n!==i;++n)e[n]+=t;return this},scale:function(t){if(1!==t)for(var e=this.times,n=0,i=e.length;n!==i;++n)e[n]*=t;return this},trim:function(t,e){for(var n=this.times,i=n.length,r=0,o=i-1;r!==i&&n[r]<t;)++r;for(;-1!==o&&n[o]>e;)--o;return++o,0===r&&o===i||(r>=o&&(r=(o=Math.max(o,1))-1),t=this.getValueSize(),this.times=ao.arraySlice(n,r,o),this.values=ao.arraySlice(this.values,r*t,o*t)),this},validate:function(){var t=!0,e=this.getValueSize();0!=e-Math.floor(e)&&(console.error("THREE.KeyframeTrack: Invalid value size in track.",this),t=!1);var n=this.times;e=this.values;var i=n.length;0===i&&(console.error("THREE.KeyframeTrack: Track is empty.",this),t=!1);for(var r=null,o=0;o!==i;o++){var a=n[o];if("number"==typeof a&&isNaN(a)){console.error("THREE.KeyframeTrack: Time is not a valid number.",this,o,a),t=!1;break}if(null!==r&&r>a){console.error("THREE.KeyframeTrack: Out of order keys.",this,o,a,r),t=!1;break}r=a}if(void 0!==e&&ao.isTypedArray(e))for(o=0,n=e.length;o!==n;++o)if(i=e[o],isNaN(i)){console.error("THREE.KeyframeTrack: Value is not a valid number.",this,o,i),t=!1;break}return t},optimize:function(){for(var t=this.times,e=this.values,n=this.getValueSize(),i=2302===this.getInterpolation(),r=1,o=t.length-1,a=1;a<o;++a){var s=!1,c=t[a];if(c!==t[a+1]&&(1!==a||c!==c[0]))if(i)s=!0;else{var h=a*n,l=h-n,u=h+n;for(c=0;c!==n;++c){var p=e[h+c];if(p!==e[l+c]||p!==e[u+c]){s=!0;break}}}if(s){if(a!==r)for(t[r]=t[a],s=a*n,h=r*n,c=0;c!==n;++c)e[h+c]=e[s+c];++r}}if(0<o){for(t[r]=t[o],s=o*n,h=r*n,c=0;c!==n;++c)e[h+c]=e[s+c];++r}return r!==t.length&&(this.times=ao.arraySlice(t,0,r),this.values=ao.arraySlice(e,0,r*n)),this}}),_i.prototype=Object.assign(Object.create(wi.prototype),{constructor:_i,ValueTypeName:"vector"}),Object.assign(Mi,{parse:function(t){for(var e=[],n=t.tracks,i=1/(t.fps||1),r=0,o=n.length;r!==o;++r)e.push(wi.parse(n[r]).scale(i));return new Mi(t.name,t.duration,e)},toJSON:function(t){var e=[],n=t.tracks;t={name:t.name,duration:t.duration,tracks:e};for(var i=0,r=n.length;i!==r;++i)e.push(wi.toJSON(n[i]));return t},CreateFromMorphTargetSequence:function(t,e,n,i){for(var r=e.length,o=[],a=0;a<r;a++){var s=[],c=[];s.push((a+r-1)%r,a,(a+1)%r),c.push(0,1,0);var h=ao.getKeyframeOrder(s);s=ao.sortedArray(s,1,h),c=ao.sortedArray(c,1,h),i||0!==s[0]||(s.push(r),c.push(c[0])),o.push(new vi(".morphTargetInfluences["+e[a].name+"]",s,c).scale(1/n))}return new Mi(t,-1,o)},findByName:function(t,e){var n=t;for(Array.isArray(t)||(n=t.geometry&&t.geometry.animations||t.animations),t=0;t<n.length;t++)if(n[t].name===e)return n[t];return null},CreateClipsFromMorphTargetSequences:function(t,e,n){for(var i={},r=/^([\w-]*?)([\d]+)$/,o=0,a=t.length;o<a;o++){var s=t[o],c=s.name.match(r);if(c&&1<c.length){var h=c[1];(c=i[h])||(i[h]=c=[]),c.push(s)}}for(h in t=[],i)t.push(Mi.CreateFromMorphTargetSequence(h,i[h],e,n));return t},parseAnimation:function(t,e){if(!t)return console.error("THREE.AnimationClip: No animation in JSONLoader data."),null;var n=function(t,e,n,i,r){if(0!==n.length){var o=[],a=[];ao.flattenJSON(n,o,a,i),0!==o.length&&r.push(new t(e,o,a))}},i=[],r=t.name||"default",o=t.length||-1,a=t.fps||30;t=t.hierarchy||[];for(var s=0;s<t.length;s++){var c=t[s].keys;if(c&&0!==c.length)if(c[0].morphTargets){o={};for(var h=0;h<c.length;h++)if(c[h].morphTargets)for(var l=0;l<c[h].morphTargets.length;l++)o[c[h].morphTargets[l]]=-1;for(var u in o){var p=[],d=[];for(l=0;l!==c[h].morphTargets.length;++l){var f=c[h];p.push(f.time),d.push(f.morphTarget===u?1:0)}i.push(new vi(".morphTargetInfluence["+u+"]",p,d))}o=o.length*(a||1)}else n(_i,(h=".bones["+e[s].name+"]")+".position",c,"pos",i),n(mi,h+".quaternion",c,"rot",i),n(_i,h+".scale",c,"scl",i)}return 0===i.length?null:new Mi(r,o,i)}}),Object.assign(Mi.prototype,{resetDuration:function(){for(var t=0,e=0,n=this.tracks.length;e!==n;++e){var i=this.tracks[e];t=Math.max(t,i.times[i.times.length-1])}this.duration=t},trim:function(){for(var t=0;t<this.tracks.length;t++)this.tracks[t].trim(0,this.duration);return this},optimize:function(){for(var t=0;t<this.tracks.length;t++)this.tracks[t].optimize();return this}}),Object.assign(Ei.prototype,{load:function(t,e,n,i){var r=this;new Cn(r.manager).load(t,function(t){e(r.parse(JSON.parse(t)))},n,i)},setTextures:function(t){this.textures=t},parse:function(t){function e(t){return void 0===i[t]&&console.warn("THREE.MaterialLoader: Undefined texture",t),i[t]}var i=this.textures,r=new Qr[t.type];if(void 0!==t.uuid&&(r.uuid=t.uuid),void 0!==t.name&&(r.name=t.name),void 0!==t.color&&r.color.setHex(t.color),void 0!==t.roughness&&(r.roughness=t.roughness),void 0!==t.metalness&&(r.metalness=t.metalness),void 0!==t.emissive&&r.emissive.setHex(t.emissive),void 0!==t.specular&&r.specular.setHex(t.specular),void 0!==t.shininess&&(r.shininess=t.shininess),void 0!==t.clearCoat&&(r.clearCoat=t.clearCoat),void 0!==t.clearCoatRoughness&&(r.clearCoatRoughness=t.clearCoatRoughness),void 0!==t.uniforms&&(r.uniforms=t.uniforms),void 0!==t.vertexShader&&(r.vertexShader=t.vertexShader),void 0!==t.fragmentShader&&(r.fragmentShader=t.fragmentShader),void 0!==t.vertexColors&&(r.vertexColors=t.vertexColors),void 0!==t.fog&&(r.fog=t.fog),void 0!==t.flatShading&&(r.flatShading=t.flatShading),void 0!==t.blending&&(r.blending=t.blending),void 0!==t.side&&(r.side=t.side),void 0!==t.opacity&&(r.opacity=t.opacity),void 0!==t.transparent&&(r.transparent=t.transparent),void 0!==t.alphaTest&&(r.alphaTest=t.alphaTest),void 0!==t.depthTest&&(r.depthTest=t.depthTest),void 0!==t.depthWrite&&(r.depthWrite=t.depthWrite),void 0!==t.colorWrite&&(r.colorWrite=t.colorWrite),void 0!==t.wireframe&&(r.wireframe=t.wireframe),void 0!==t.wireframeLinewidth&&(r.wireframeLinewidth=t.wireframeLinewidth),void 0!==t.wireframeLinecap&&(r.wireframeLinecap=t.wireframeLinecap),void 0!==t.wireframeLinejoin&&(r.wireframeLinejoin=t.wireframeLinejoin),void 0!==t.rotation&&(r.rotation=t.rotation),1!==t.linewidth&&(r.linewidth=t.linewidth),void 0!==t.dashSize&&(r.dashSize=t.dashSize),void 0!==t.gapSize&&(r.gapSize=t.gapSize),void 0!==t.scale&&(r.scale=t.scale),void 0!==t.polygonOffset&&(r.polygonOffset=t.polygonOffset),void 0!==t.polygonOffsetFactor&&(r.polygonOffsetFactor=t.polygonOffsetFactor),void 0!==t.polygonOffsetUnits&&(r.polygonOffsetUnits=t.polygonOffsetUnits),void 0!==t.skinning&&(r.skinning=t.skinning),void 0!==t.morphTargets&&(r.morphTargets=t.morphTargets),void 0!==t.dithering&&(r.dithering=t.dithering),void 0!==t.visible&&(r.visible=t.visible),void 0!==t.userData&&(r.userData=t.userData),void 0!==t.shading&&(r.flatShading=1===t.shading),void 0!==t.size&&(r.size=t.size),void 0!==t.sizeAttenuation&&(r.sizeAttenuation=t.sizeAttenuation),void 0!==t.map&&(r.map=e(t.map)),void 0!==t.alphaMap&&(r.alphaMap=e(t.alphaMap),r.transparent=!0),void 0!==t.bumpMap&&(r.bumpMap=e(t.bumpMap)),void 0!==t.bumpScale&&(r.bumpScale=t.bumpScale),void 0!==t.normalMap&&(r.normalMap=e(t.normalMap)),void 0!==t.normalScale){var o=t.normalScale;!1===Array.isArray(o)&&(o=[o,o]),r.normalScale=(new n).fromArray(o)}return void 0!==t.displacementMap&&(r.displacementMap=e(t.displacementMap)),void 0!==t.displacementScale&&(r.displacementScale=t.displacementScale),void 0!==t.displacementBias&&(r.displacementBias=t.displacementBias),void 0!==t.roughnessMap&&(r.roughnessMap=e(t.roughnessMap)),void 0!==t.metalnessMap&&(r.metalnessMap=e(t.metalnessMap)),void 0!==t.emissiveMap&&(r.emissiveMap=e(t.emissiveMap)),void 0!==t.emissiveIntensity&&(r.emissiveIntensity=t.emissiveIntensity),void 0!==t.specularMap&&(r.specularMap=e(t.specularMap)),void 0!==t.envMap&&(r.envMap=e(t.envMap)),void 0!==t.reflectivity&&(r.reflectivity=t.reflectivity),void 0!==t.lightMap&&(r.lightMap=e(t.lightMap)),void 0!==t.lightMapIntensity&&(r.lightMapIntensity=t.lightMapIntensity),void 0!==t.aoMap&&(r.aoMap=e(t.aoMap)),void 0!==t.aoMapIntensity&&(r.aoMapIntensity=t.aoMapIntensity),void 0!==t.gradientMap&&(r.gradientMap=e(t.gradientMap)),r}}),Object.assign(Ti.prototype,{load:function(t,e,n,i){var r=this;new Cn(r.manager).load(t,function(t){e(r.parse(JSON.parse(t)))},n,i)},parse:function(t){var e=new B,n=t.data.index;void 0!==n&&(n=new so[n.type](n.array),e.setIndex(new T(n,1)));var i=t.data.attributes;for(a in i){var r=i[a];n=new so[r.type](r.array),e.addAttribute(a,new T(n,r.itemSize,r.normalized))}var a=t.data.groups||t.data.drawcalls||t.data.offsets;if(void 0!==a)for(n=0,i=a.length;n!==i;++n)r=a[n],e.addGroup(r.start,r.count,r.materialIndex);return void 0!==(t=t.data.boundingSphere)&&(a=new o,void 0!==t.center&&a.fromArray(t.center),e.boundingSphere=new d(a,t.radius)),e}});var so={Int8Array:Int8Array,Uint8Array:Uint8Array,Uint8ClampedArray:"undefined"!=typeof Uint8ClampedArray?Uint8ClampedArray:Uint8Array,Int16Array:Int16Array,Uint16Array:Uint16Array,Int32Array:Int32Array,Uint32Array:Uint32Array,Float32Array:Float32Array,Float64Array:Float64Array};Si.Handlers={handlers:[],add:function(t,e){this.handlers.push(t,e)},get:function(t){for(var e=this.handlers,n=0,i=e.length;n<i;n+=2){var r=e[n+1];if(e[n].test(t))return r}return null}},Object.assign(Si.prototype,{crossOrigin:void 0,onLoadStart:function(){},onLoadProgress:function(){},onLoadComplete:function(){},initMaterials:function(t,e,n){for(var i=[],r=0;r<t.length;++r)i[r]=this.createMaterial(t[r],e,n);return i},createMaterial:function(){var t={NoBlending:0,NormalBlending:1,AdditiveBlending:2,SubtractiveBlending:3,MultiplyBlending:4,CustomBlending:5},e=new g,n=new Dn,i=new Ei;return function(r,o,a){function s(t,e,i,r,s){t=o+t;var c=Si.Handlers.get(t);return null!==c?t=c.load(t):(n.setCrossOrigin(a),t=n.load(t)),void 0!==e&&(t.repeat.fromArray(e),1!==e[0]&&(t.wrapS=1e3),1!==e[1]&&(t.wrapT=1e3)),void 0!==i&&t.offset.fromArray(i),void 0!==r&&("repeat"===r[0]&&(t.wrapS=1e3),"mirror"===r[0]&&(t.wrapS=1002),"repeat"===r[1]&&(t.wrapT=1e3),"mirror"===r[1]&&(t.wrapT=1002)),void 0!==s&&(t.anisotropy=s),e=Ar.generateUUID(),h[e]=t,e}var c,h={},l={uuid:Ar.generateUUID(),type:"MeshLambertMaterial"};for(c in r){var u=r[c];switch(c){case"DbgColor":case"DbgIndex":case"opticalDensity":case"illumination":break;case"DbgName":l.name=u;break;case"blending":l.blending=t[u];break;case"colorAmbient":case"mapAmbient":console.warn("THREE.Loader.createMaterial:",c,"is no longer supported.");break;case"colorDiffuse":l.color=e.fromArray(u).getHex();break;case"colorSpecular":l.specular=e.fromArray(u).getHex();break;case"colorEmissive":l.emissive=e.fromArray(u).getHex();break;case"specularCoef":l.shininess=u;break;case"shading":"basic"===u.toLowerCase()&&(l.type="MeshBasicMaterial"),"phong"===u.toLowerCase()&&(l.type="MeshPhongMaterial"),"standard"===u.toLowerCase()&&(l.type="MeshStandardMaterial");break;case"mapDiffuse":l.map=s(u,r.mapDiffuseRepeat,r.mapDiffuseOffset,r.mapDiffuseWrap,r.mapDiffuseAnisotropy);break;case"mapDiffuseRepeat":case"mapDiffuseOffset":case"mapDiffuseWrap":case"mapDiffuseAnisotropy":break;case"mapEmissive":l.emissiveMap=s(u,r.mapEmissiveRepeat,r.mapEmissiveOffset,r.mapEmissiveWrap,r.mapEmissiveAnisotropy);break;case"mapEmissiveRepeat":case"mapEmissiveOffset":case"mapEmissiveWrap":case"mapEmissiveAnisotropy":break;case"mapLight":l.lightMap=s(u,r.mapLightRepeat,r.mapLightOffset,r.mapLightWrap,r.mapLightAnisotropy);break;case"mapLightRepeat":case"mapLightOffset":case"mapLightWrap":case"mapLightAnisotropy":break;case"mapAO":l.aoMap=s(u,r.mapAORepeat,r.mapAOOffset,r.mapAOWrap,r.mapAOAnisotropy);break;case"mapAORepeat":case"mapAOOffset":case"mapAOWrap":case"mapAOAnisotropy":break;case"mapBump":l.bumpMap=s(u,r.mapBumpRepeat,r.mapBumpOffset,r.mapBumpWrap,r.mapBumpAnisotropy);break;case"mapBumpScale":l.bumpScale=u;break;case"mapBumpRepeat":case"mapBumpOffset":case"mapBumpWrap":case"mapBumpAnisotropy":break;case"mapNormal":l.normalMap=s(u,r.mapNormalRepeat,r.mapNormalOffset,r.mapNormalWrap,r.mapNormalAnisotropy);break;case"mapNormalFactor":l.normalScale=u;break;case"mapNormalRepeat":case"mapNormalOffset":case"mapNormalWrap":case"mapNormalAnisotropy":break;case"mapSpecular":l.specularMap=s(u,r.mapSpecularRepeat,r.mapSpecularOffset,r.mapSpecularWrap,r.mapSpecularAnisotropy);break;case"mapSpecularRepeat":case"mapSpecularOffset":case"mapSpecularWrap":case"mapSpecularAnisotropy":break;case"mapMetalness":l.metalnessMap=s(u,r.mapMetalnessRepeat,r.mapMetalnessOffset,r.mapMetalnessWrap,r.mapMetalnessAnisotropy);break;case"mapMetalnessRepeat":case"mapMetalnessOffset":case"mapMetalnessWrap":case"mapMetalnessAnisotropy":break;case"mapRoughness":l.roughnessMap=s(u,r.mapRoughnessRepeat,r.mapRoughnessOffset,r.mapRoughnessWrap,r.mapRoughnessAnisotropy);break;case"mapRoughnessRepeat":case"mapRoughnessOffset":case"mapRoughnessWrap":case"mapRoughnessAnisotropy":break;case"mapAlpha":l.alphaMap=s(u,r.mapAlphaRepeat,r.mapAlphaOffset,r.mapAlphaWrap,r.mapAlphaAnisotropy);break;case"mapAlphaRepeat":case"mapAlphaOffset":case"mapAlphaWrap":case"mapAlphaAnisotropy":break;case"flipSided":l.side=1;break;case"doubleSided":l.side=2;break;case"transparency":console.warn("THREE.Loader.createMaterial: transparency has been renamed to opacity"),l.opacity=u;break;case"depthTest":case"depthWrite":case"colorWrite":case"opacity":case"reflectivity":case"transparent":case"visible":case"wireframe":l[c]=u;break;case"vertexColors":!0===u&&(l.vertexColors=2),"face"===u&&(l.vertexColors=1);break;default:console.error("THREE.Loader.createMaterial: Unsupported",c,u)}}return"MeshBasicMaterial"===l.type&&delete l.emissive,"MeshPhongMaterial"!==l.type&&delete l.specular,1>l.opacity&&(l.transparent=!0),i.setTextures(h),i.parse(l)}}()});var co={decodeText:function(t){if("undefined"!=typeof TextDecoder)return(new TextDecoder).decode(t);for(var e="",n=0,i=t.length;n<i;n++)e+=String.fromCharCode(t[n]);return decodeURIComponent(escape(e))},extractUrlBase:function(t){var e=t.lastIndexOf("/");return-1===e?"./":t.substr(0,e+1)}};Object.assign(Ai.prototype,{load:function(t,e,n,i){var r=this,o=this.texturePath&&"string"==typeof this.texturePath?this.texturePath:co.extractUrlBase(t),a=new Cn(this.manager);a.setWithCredentials(this.withCredentials),a.load(t,function(n){var i=(n=JSON.parse(n)).metadata;void 0===i||(void 0===(i=i.type)||"object"!==i.toLowerCase())?(n=r.parse(n,o),e(n.geometry,n.materials)):console.error("THREE.JSONLoader: "+t+" should be loaded with THREE.ObjectLoader instead.")},n,i)},setTexturePath:function(t){this.texturePath=t},parse:function(t,e){void 0!==t.data&&(t=t.data),t.scale=void 0!==t.scale?1/t.scale:1;var i,r,a,s=new E,h=t,l=h.faces,u=h.vertices,p=h.normals,d=h.colors,f=h.scale,m=0;if(void 0!==h.uvs){for(i=0;i<h.uvs.length;i++)h.uvs[i].length&&m++;for(i=0;i<m;i++)s.faceVertexUvs[i]=[]}var v=0;for(a=u.length;v<a;)(i=new o).x=u[v++]*f,i.y=u[v++]*f,i.z=u[v++]*f,s.vertices.push(i);for(v=0,a=l.length;v<a;){var y=1&(u=l[v++]),x=2&u;i=8&u;var b=16&u,w=32&u;if(f=64&u,u&=128,y){(y=new M).a=l[v],y.b=l[v+1],y.c=l[v+3];var _=new M;if(_.a=l[v+1],_.b=l[v+2],_.c=l[v+3],v+=4,x&&(x=l[v++],y.materialIndex=x,_.materialIndex=x),x=s.faces.length,i)for(i=0;i<m;i++){var T=h.uvs[i];for(s.faceVertexUvs[i][x]=[],s.faceVertexUvs[i][x+1]=[],r=0;4>r;r++){var S=l[v++],A=T[2*S];A=new n(A,S=T[2*S+1]),2!==r&&s.faceVertexUvs[i][x].push(A),0!==r&&s.faceVertexUvs[i][x+1].push(A)}}if(b&&(b=3*l[v++],y.normal.set(p[b++],p[b++],p[b]),_.normal.copy(y.normal)),w)for(i=0;4>i;i++)b=3*l[v++],w=new o(p[b++],p[b++],p[b]),2!==i&&y.vertexNormals.push(w),0!==i&&_.vertexNormals.push(w);if(f&&(f=d[f=l[v++]],y.color.setHex(f),_.color.setHex(f)),u)for(i=0;4>i;i++)f=d[f=l[v++]],2!==i&&y.vertexColors.push(new g(f)),0!==i&&_.vertexColors.push(new g(f));s.faces.push(y),s.faces.push(_)}else{if((y=new M).a=l[v++],y.b=l[v++],y.c=l[v++],x&&(x=l[v++],y.materialIndex=x),x=s.faces.length,i)for(i=0;i<m;i++)for(T=h.uvs[i],s.faceVertexUvs[i][x]=[],r=0;3>r;r++)A=new n(A=T[2*(S=l[v++])],S=T[2*S+1]),s.faceVertexUvs[i][x].push(A);if(b&&(b=3*l[v++],y.normal.set(p[b++],p[b++],p[b])),w)for(i=0;3>i;i++)b=3*l[v++],w=new o(p[b++],p[b++],p[b]),y.vertexNormals.push(w);if(f&&(f=l[v++],y.color.setHex(d[f])),u)for(i=0;3>i;i++)f=l[v++],y.vertexColors.push(new g(d[f]));s.faces.push(y)}}if(v=void 0!==(h=t).influencesPerVertex?h.influencesPerVertex:2,h.skinWeights)for(a=0,l=h.skinWeights.length;a<l;a+=v)s.skinWeights.push(new c(h.skinWeights[a],1<v?h.skinWeights[a+1]:0,2<v?h.skinWeights[a+2]:0,3<v?h.skinWeights[a+3]:0));if(h.skinIndices)for(a=0,l=h.skinIndices.length;a<l;a+=v)s.skinIndices.push(new c(h.skinIndices[a],1<v?h.skinIndices[a+1]:0,2<v?h.skinIndices[a+2]:0,3<v?h.skinIndices[a+3]:0));if(s.bones=h.bones,s.bones&&0<s.bones.length&&(s.skinWeights.length!==s.skinIndices.length||s.skinIndices.length!==s.vertices.length)&&console.warn("When skinning, number of vertices ("+s.vertices.length+"), skinIndices ("+s.skinIndices.length+"), and skinWeights ("+s.skinWeights.length+") should match."),l=(a=t).scale,void 0!==a.morphTargets)for(h=0,v=a.morphTargets.length;h<v;h++)for(s.morphTargets[h]={},s.morphTargets[h].name=a.morphTargets[h].name,s.morphTargets[h].vertices=[],p=s.morphTargets[h].vertices,m=0,u=(d=a.morphTargets[h].vertices).length;m<u;m+=3)(f=new o).x=d[m]*l,f.y=d[m+1]*l,f.z=d[m+2]*l,p.push(f);if(void 0!==a.morphColors&&0<a.morphColors.length)for(console.warn('THREE.JSONLoader: "morphColors" no longer supported. Using them as face colors.'),l=s.faces,a=a.morphColors[0].colors,h=0,v=l.length;h<v;h++)l[h].color.fromArray(a,3*h);for(h=[],v=[],void 0!==(a=t).animation&&v.push(a.animation),void 0!==a.animations&&(a.animations.length?v=v.concat(a.animations):v.push(a.animations)),a=0;a<v.length;a++)(l=Mi.parseAnimation(v[a],s.bones))&&h.push(l);return s.morphTargets&&(v=Mi.CreateClipsFromMorphTargetSequences(s.morphTargets,10),h=h.concat(v)),0<h.length&&(s.animations=h),s.computeFaceNormals(),s.computeBoundingSphere(),void 0===t.materials||0===t.materials.length?{geometry:s}:{geometry:s,materials:t=Si.prototype.initMaterials(t.materials,e,this.crossOrigin)}}}),Object.assign(Ri.prototype,{load:function(t,e,n,i){""===this.texturePath&&(this.texturePath=t.substring(0,t.lastIndexOf("/")+1));var r=this;new Cn(r.manager).load(t,function(n){var o=null;try{o=JSON.parse(n)}catch(e){return void 0!==i&&i(e),void console.error("THREE:ObjectLoader: Can't parse "+t+".",e.message)}void 0===(n=o.metadata)||void 0===n.type||"geometry"===n.type.toLowerCase()?console.error("THREE.ObjectLoader: Can't load "+t+". Use THREE.JSONLoader instead."):r.parse(o,e)},n,i)},setTexturePath:function(t){this.texturePath=t},setCrossOrigin:function(t){this.crossOrigin=t},parse:function(t,e){var n=this.parseShape(t.shapes);n=this.parseGeometries(t.geometries,n);var i=this.parseImages(t.images,function(){void 0!==e&&e(r)});i=this.parseTextures(t.textures,i),i=this.parseMaterials(t.materials,i);var r=this.parseObject(t.object,n,i);return t.animations&&(r.animations=this.parseAnimations(t.animations)),void 0!==t.images&&0!==t.images.length||void 0===e||e(r),r},parseShape:function(t){var e={};if(void 0!==t)for(var n=0,i=t.length;n<i;n++){var r=(new ti).fromJSON(t[n]);e[r.uuid]=r}return e},parseGeometries:function(t,e){var n={};if(void 0!==t)for(var i=new Ai,r=new Ti,o=0,a=t.length;o<a;o++){var s=t[o];switch(s.type){case"PlaneGeometry":case"PlaneBufferGeometry":var c=new Jr[s.type](s.width,s.height,s.widthSegments,s.heightSegments);break;case"BoxGeometry":case"BoxBufferGeometry":case"CubeGeometry":c=new Jr[s.type](s.width,s.height,s.depth,s.widthSegments,s.heightSegments,s.depthSegments);break;case"CircleGeometry":case"CircleBufferGeometry":c=new Jr[s.type](s.radius,s.segments,s.thetaStart,s.thetaLength);break;case"CylinderGeometry":case"CylinderBufferGeometry":c=new Jr[s.type](s.radiusTop,s.radiusBottom,s.height,s.radialSegments,s.heightSegments,s.openEnded,s.thetaStart,s.thetaLength);break;case"ConeGeometry":case"ConeBufferGeometry":c=new Jr[s.type](s.radius,s.height,s.radialSegments,s.heightSegments,s.openEnded,s.thetaStart,s.thetaLength);break;case"SphereGeometry":case"SphereBufferGeometry":c=new Jr[s.type](s.radius,s.widthSegments,s.heightSegments,s.phiStart,s.phiLength,s.thetaStart,s.thetaLength);break;case"DodecahedronGeometry":case"DodecahedronBufferGeometry":case"IcosahedronGeometry":case"IcosahedronBufferGeometry":case"OctahedronGeometry":case"OctahedronBufferGeometry":case"TetrahedronGeometry":case"TetrahedronBufferGeometry":c=new Jr[s.type](s.radius,s.detail);break;case"RingGeometry":case"RingBufferGeometry":c=new Jr[s.type](s.innerRadius,s.outerRadius,s.thetaSegments,s.phiSegments,s.thetaStart,s.thetaLength);break;case"TorusGeometry":case"TorusBufferGeometry":c=new Jr[s.type](s.radius,s.tube,s.radialSegments,s.tubularSegments,s.arc);break;case"TorusKnotGeometry":case"TorusKnotBufferGeometry":c=new Jr[s.type](s.radius,s.tube,s.tubularSegments,s.radialSegments,s.p,s.q);break;case"LatheGeometry":case"LatheBufferGeometry":c=new Jr[s.type](s.points,s.segments,s.phiStart,s.phiLength);break;case"PolyhedronGeometry":case"PolyhedronBufferGeometry":c=new Jr[s.type](s.vertices,s.indices,s.radius,s.details);break;case"ShapeGeometry":case"ShapeBufferGeometry":c=[];for(var h=0,l=s.shapes.length;h<l;h++)c.push(e[s.shapes[h]]);c=new Jr[s.type](c,s.curveSegments);break;case"BufferGeometry":c=r.parse(s);break;case"Geometry":c=i.parse(s,this.texturePath).geometry;break;default:console.warn('THREE.ObjectLoader: Unsupported geometry type "'+s.type+'"');continue}c.uuid=s.uuid,void 0!==s.name&&(c.name=s.name),n[s.uuid]=c}return n},parseMaterials:function(t,e){var n={};if(void 0!==t){var i=new Ei;i.setTextures(e),e=0;for(var r=t.length;e<r;e++){var o=t[e];if("MultiMaterial"===o.type){for(var a=[],s=0;s<o.materials.length;s++)a.push(i.parse(o.materials[s]));n[o.uuid]=a}else n[o.uuid]=i.parse(o)}}return n},parseAnimations:function(t){for(var e=[],n=0;n<t.length;n++){var i=Mi.parse(t[n]);e.push(i)}return e},parseImages:function(t,e){function n(t){return i.manager.itemStart(t),o.load(t,function(){i.manager.itemEnd(t)},void 0,function(){i.manager.itemEnd(t),i.manager.itemError(t)})}var i=this,r={};if(void 0!==t&&0<t.length){var o=new Nn(e=new Pn(e));o.setCrossOrigin(this.crossOrigin),e=0;for(var a=t.length;e<a;e++){var s=t[e],c=/^(\/\/)|([a-z]+:(\/\/)?)/i.test(s.url)?s.url:i.texturePath+s.url;r[s.uuid]=n(c)}}return r},parseTextures:function(t,e){function n(t,e){return"number"==typeof t?t:(console.warn("THREE.ObjectLoader.parseTexture: Constant should be in numeric form.",t),e[t])}var i={};if(void 0!==t)for(var r=0,o=t.length;r<o;r++){var a=t[r];void 0===a.image&&console.warn('THREE.ObjectLoader: No "image" specified for',a.uuid),void 0===e[a.image]&&console.warn("THREE.ObjectLoader: Undefined image",a.image);var c=new s(e[a.image]);c.needsUpdate=!0,c.uuid=a.uuid,void 0!==a.name&&(c.name=a.name),void 0!==a.mapping&&(c.mapping=n(a.mapping,ho)),void 0!==a.offset&&c.offset.fromArray(a.offset),void 0!==a.repeat&&c.repeat.fromArray(a.repeat),void 0!==a.center&&c.center.fromArray(a.center),void 0!==a.rotation&&(c.rotation=a.rotation),void 0!==a.wrap&&(c.wrapS=n(a.wrap[0],lo),c.wrapT=n(a.wrap[1],lo)),void 0!==a.format&&(c.format=a.format),void 0!==a.minFilter&&(c.minFilter=n(a.minFilter,uo)),void 0!==a.magFilter&&(c.magFilter=n(a.magFilter,uo)),void 0!==a.anisotropy&&(c.anisotropy=a.anisotropy),void 0!==a.flipY&&(c.flipY=a.flipY),i[a.uuid]=c}return i},parseObject:function(t,e,n){function i(t){return void 0===e[t]&&console.warn("THREE.ObjectLoader: Undefined geometry",t),e[t]}function r(t){if(void 0!==t){if(Array.isArray(t)){for(var e=[],i=0,r=t.length;i<r;i++){var o=t[i];void 0===n[o]&&console.warn("THREE.ObjectLoader: Undefined material",o),e.push(n[o])}return e}return void 0===n[t]&&console.warn("THREE.ObjectLoader: Undefined material",t),n[t]}}switch(t.type){case"Scene":var o=new ee;void 0!==t.background&&Number.isInteger(t.background)&&(o.background=new g(t.background)),void 0!==t.fog&&("Fog"===t.fog.type?o.fog=new te(t.fog.color,t.fog.near,t.fog.far):"FogExp2"===t.fog.type&&(o.fog=new $t(t.fog.color,t.fog.density)));break;case"PerspectiveCamera":o=new Zt(t.fov,t.aspect,t.near,t.far),void 0!==t.focus&&(o.focus=t.focus),void 0!==t.zoom&&(o.zoom=t.zoom),void 0!==t.filmGauge&&(o.filmGauge=t.filmGauge),void 0!==t.filmOffset&&(o.filmOffset=t.filmOffset),void 0!==t.view&&(o.view=Object.assign({},t.view));break;case"OrthographicCamera":o=new _(t.left,t.right,t.top,t.bottom,t.near,t.far),void 0!==t.zoom&&(o.zoom=t.zoom),void 0!==t.view&&(o.view=Object.assign({},t.view));break;case"AmbientLight":o=new hi(t.color,t.intensity);break;case"DirectionalLight":o=new ci(t.color,t.intensity);break;case"PointLight":o=new ai(t.color,t.intensity,t.distance,t.decay);break;case"RectAreaLight":o=new li(t.color,t.intensity,t.width,t.height);break;case"SpotLight":o=new oi(t.color,t.intensity,t.distance,t.angle,t.penumbra,t.decay);break;case"HemisphereLight":o=new ni(t.color,t.groundColor,t.intensity);break;case"SkinnedMesh":console.warn("THREE.ObjectLoader.parseObject() does not support SkinnedMesh yet.");case"Mesh":o=i(t.geometry);var a=r(t.material);o=o.bones&&0<o.bones.length?new se(o,a):new Y(o,a);break;case"LOD":o=new re;break;case"Line":o=new he(i(t.geometry),r(t.material),t.mode);break;case"LineLoop":o=new ue(i(t.geometry),r(t.material));break;case"LineSegments":o=new le(i(t.geometry),r(t.material));break;case"PointCloud":case"Points":o=new de(i(t.geometry),r(t.material));break;case"Sprite":o=new ie(r(t.material));break;case"Group":o=new fe;break;default:o=new b}if(o.uuid=t.uuid,void 0!==t.name&&(o.name=t.name),void 0!==t.matrix?(o.matrix.fromArray(t.matrix),void 0!==t.matrixAutoUpdate&&(o.matrixAutoUpdate=t.matrixAutoUpdate),o.matrixAutoUpdate&&o.matrix.decompose(o.position,o.quaternion,o.scale)):(void 0!==t.position&&o.position.fromArray(t.position),void 0!==t.rotation&&o.rotation.fromArray(t.rotation),void 0!==t.quaternion&&o.quaternion.fromArray(t.quaternion),void 0!==t.scale&&o.scale.fromArray(t.scale)),void 0!==t.castShadow&&(o.castShadow=t.castShadow),void 0!==t.receiveShadow&&(o.receiveShadow=t.receiveShadow),t.shadow&&(void 0!==t.shadow.bias&&(o.shadow.bias=t.shadow.bias),void 0!==t.shadow.radius&&(o.shadow.radius=t.shadow.radius),void 0!==t.shadow.mapSize&&o.shadow.mapSize.fromArray(t.shadow.mapSize),void 0!==t.shadow.camera&&(o.shadow.camera=this.parseObject(t.shadow.camera))),void 0!==t.visible&&(o.visible=t.visible),void 0!==t.frustumCulled&&(o.frustumCulled=t.frustumCulled),void 0!==t.renderOrder&&(o.renderOrder=t.renderOrder),void 0!==t.userData&&(o.userData=t.userData),void 0!==t.children){a=t.children;for(var s=0;s<a.length;s++)o.add(this.parseObject(a[s],e,n))}if("LOD"===t.type)for(t=t.levels,a=0;a<t.length;a++){s=t[a];var c=o.getObjectByProperty("uuid",s.object);void 0!==c&&o.addLevel(c,s.distance)}return o}});var ho={UVMapping:300,CubeReflectionMapping:301,CubeRefractionMapping:302,EquirectangularReflectionMapping:303,EquirectangularRefractionMapping:304,SphericalReflectionMapping:305,CubeUVReflectionMapping:306,CubeUVRefractionMapping:307},lo={RepeatWrapping:1e3,ClampToEdgeWrapping:1001,MirroredRepeatWrapping:1002},uo={NearestFilter:1003,NearestMipMapNearestFilter:1004,NearestMipMapLinearFilter:1005,LinearFilter:1006,LinearMipMapNearestFilter:1007,LinearMipMapLinearFilter:1008};Li.prototype={constructor:Li,setOptions:function(t){return this.options=t,this},load:function(t,e,n,i){void 0===t&&(t=""),void 0!==this.path&&(t=this.path+t);var r=this,o=Kr.get(t);if(void 0!==o)return r.manager.itemStart(t),setTimeout(function(){e&&e(o),r.manager.itemEnd(t)},0),o;fetch(t).then(function(t){return t.blob()}).then(function(t){return createImageBitmap(t,r.options)}).then(function(n){Kr.add(t,n),e&&e(n),r.manager.itemEnd(t)}).catch(function(e){i&&i(e),r.manager.itemEnd(t),r.manager.itemError(t)})},setCrossOrigin:function(){return this},setPath:function(t){return this.path=t,this}},Object.assign(Pi.prototype,{moveTo:function(t,e){this.currentPath=new $n,this.subPaths.push(this.currentPath),this.currentPath.moveTo(t,e)},lineTo:function(t,e){this.currentPath.lineTo(t,e)},quadraticCurveTo:function(t,e,n,i){this.currentPath.quadraticCurveTo(t,e,n,i)},bezierCurveTo:function(t,e,n,i,r,o){this.currentPath.bezierCurveTo(t,e,n,i,r,o)},splineThru:function(t){this.currentPath.splineThru(t)},toShapes:function(t,e){function n(t){for(var e=[],n=0,i=t.length;n<i;n++){var r=t[n],o=new ti;o.curves=r.curves,e.push(o)}return e}function i(t,e){for(var n=e.length,i=!1,r=n-1,o=0;o<n;r=o++){var a=e[r],s=e[o],c=s.x-a.x,h=s.y-a.y;if(Math.abs(h)>Number.EPSILON){if(0>h&&(a=e[o],c=-c,s=e[r],h=-h),!(t.y<a.y||t.y>s.y))if(t.y===a.y){if(t.x===a.x)return!0}else{if(0===(r=h*(t.x-a.x)-c*(t.y-a.y)))return!0;0>r||(i=!i)}}else if(t.y===a.y&&(s.x<=t.x&&t.x<=a.x||a.x<=t.x&&t.x<=s.x))return!0}return i}var r=Yr.isClockWise,o=this.subPaths;if(0===o.length)return[];if(!0===e)return n(o);if(e=[],1===o.length){var a=o[0],s=new ti;return s.curves=a.curves,e.push(s),e}var c=!r(o[0].getPoints());c=t?!c:c,s=[];var h=[],l=[],u=0;h[u]=void 0,l[u]=[];for(var p=0,d=o.length;p<d;p++){var f=(a=o[p]).getPoints(),m=r(f);(m=t?!m:m)?(!c&&h[u]&&u++,h[u]={s:new ti,p:f},h[u].s.curves=a.curves,c&&u++,l[u]=[]):l[u].push({h:a,p:f[0]})}if(!h[0])return n(o);if(1<h.length){for(p=!1,t=[],r=0,o=h.length;r<o;r++)s[r]=[];for(r=0,o=h.length;r<o;r++)for(a=l[r],m=0;m<a.length;m++){for(c=a[m],u=!0,f=0;f<h.length;f++)i(c.p,h[f].p)&&(r!==f&&t.push({froms:r,tos:f,hole:m}),u?(u=!1,s[f].push(c)):p=!0);u&&s[r].push(c)}0<t.length&&(p||(l=s))}for(p=0,r=h.length;p<r;p++)for(s=h[p].s,e.push(s),o=0,a=(t=l[p]).length;o<a;o++)s.holes.push(t[o].h);return e}}),Object.assign(Ci.prototype,{isFont:!0,generateShapes:function(t,e,n){void 0===e&&(e=100),n=[];var i=e;e=this.data;var r=String(t).split("");i/=e.resolution;var o=(e.boundingBox.yMax-e.boundingBox.yMin+e.underlineThickness)*i;t=[];for(var a=0,s=0,c=0;c<r.length;c++){var h=r[c];if("\n"===h)a=0,s-=o;else{var l=i,u=a,p=s;if(h=e.glyphs[h]||e.glyphs["?"]){var d=new Pi;if(h.o)for(var f=h._cachedOutline||(h._cachedOutline=h.o.split(" ")),m=0,g=f.length;m<g;)switch(f[m++]){case"m":var v=f[m++]*l+u,y=f[m++]*l+p;d.moveTo(v,y);break;case"l":v=f[m++]*l+u,y=f[m++]*l+p,d.lineTo(v,y);break;case"q":var x=f[m++]*l+u,b=f[m++]*l+p,w=f[m++]*l+u,_=f[m++]*l+p;d.quadraticCurveTo(w,_,x,b);break;case"b":x=f[m++]*l+u,b=f[m++]*l+p,w=f[m++]*l+u,_=f[m++]*l+p,v=f[m++]*l+u,y=f[m++]*l+p,d.bezierCurveTo(w,_,v,y,x,b)}l={offsetX:h.ha*l,path:d}}else l=void 0;a+=l.offsetX,t.push(l.path)}}for(e=0,r=t.length;e<r;e++)Array.prototype.push.apply(n,t[e].toShapes());return n}}),Object.assign(Oi.prototype,{load:function(t,e,n,i){var r=this,o=new Cn(this.manager);o.setPath(this.path),o.load(t,function(t){try{var 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),e&&e(t)},n,i)},parse:function(t){return new Ci(t)},setPath:function(t){return this.path=t,this}});var po,fo,mo,go={getContext:function(){return void 0===po&&(po=new(window.AudioContext||window.webkitAudioContext)),po},setContext:function(t){po=t}};Object.assign(Ii.prototype,{load:function(t,e,n,i){var r=new Cn(this.manager);r.setResponseType("arraybuffer"),r.load(t,function(t){go.getContext().decodeAudioData(t,function(t){e(t)})},n,i)}}),Object.assign(Ni.prototype,{update:function(){var t,e,n,r,o,a,s,c,h=new i,l=new i;return function(i){if(t!==this||e!==i.focus||n!==i.fov||r!==i.aspect*this.aspect||o!==i.near||a!==i.far||s!==i.zoom||c!==this.eyeSep){t=this,e=i.focus,n=i.fov,r=i.aspect*this.aspect,o=i.near,a=i.far,s=i.zoom;var u=i.projectionMatrix.clone(),p=(c=this.eyeSep/2)*o/e,d=o*Math.tan(Ar.DEG2RAD*n*.5)/s;l.elements[12]=-c,h.elements[12]=c;var f=-d*r+p,m=d*r+p;u.elements[0]=2*o/(m-f),u.elements[8]=(m+f)/(m-f),this.cameraL.projectionMatrix.copy(u),f=-d*r-p,m=d*r-p,u.elements[0]=2*o/(m-f),u.elements[8]=(m+f)/(m-f),this.cameraR.projectionMatrix.copy(u)}this.cameraL.matrixWorld.copy(i.matrixWorld).multiply(l),this.cameraR.matrixWorld.copy(i.matrixWorld).multiply(h)}}()}),Ui.prototype=Object.create(b.prototype),Ui.prototype.constructor=Ui,Di.prototype=Object.assign(Object.create(b.prototype),{constructor:Di,getInput:function(){return this.gain},removeFilter:function(){null!==this.filter&&(this.gain.disconnect(this.filter),this.filter.disconnect(this.context.destination),this.gain.connect(this.context.destination),this.filter=null)},getFilter:function(){return this.filter},setFilter:function(t){null!==this.filter?(this.gain.disconnect(this.filter),this.filter.disconnect(this.context.destination)):this.gain.disconnect(this.context.destination),this.filter=t,this.gain.connect(this.filter),this.filter.connect(this.context.destination)},getMasterVolume:function(){return this.gain.gain.value},setMasterVolume:function(t){this.gain.gain.setTargetAtTime(t,this.context.currentTime,.01)},updateMatrixWorld:function(){var t=new o,e=new r,n=new o,i=new o;return function(r){b.prototype.updateMatrixWorld.call(this,r),r=this.context.listener;var o=this.up;this.matrixWorld.decompose(t,e,n),i.set(0,0,-1).applyQuaternion(e),r.positionX?(r.positionX.setValueAtTime(t.x,this.context.currentTime),r.positionY.setValueAtTime(t.y,this.context.currentTime),r.positionZ.setValueAtTime(t.z,this.context.currentTime),r.forwardX.setValueAtTime(i.x,this.context.currentTime),r.forwardY.setValueAtTime(i.y,this.context.currentTime),r.forwardZ.setValueAtTime(i.z,this.context.currentTime),r.upX.setValueAtTime(o.x,this.context.currentTime),r.upY.setValueAtTime(o.y,this.context.currentTime),r.upZ.setValueAtTime(o.z,this.context.currentTime)):(r.setPosition(t.x,t.y,t.z),r.setOrientation(i.x,i.y,i.z,o.x,o.y,o.z))}}()}),Bi.prototype=Object.assign(Object.create(b.prototype),{constructor:Bi,getOutput:function(){return this.gain},setNodeSource:function(t){return this.hasPlaybackControl=!1,this.sourceType="audioNode",this.source=t,this.connect(),this},setBuffer:function(t){return this.buffer=t,this.sourceType="buffer",this.autoplay&&this.play(),this},play:function(){if(!0===this.isPlaying)console.warn("THREE.Audio: Audio is already playing.");else{if(!1!==this.hasPlaybackControl){var t=this.context.createBufferSource();return t.buffer=this.buffer,t.loop=this.loop,t.onended=this.onEnded.bind(this),t.playbackRate.setValueAtTime(this.playbackRate,this.startTime),this.startTime=this.context.currentTime,t.start(this.startTime,this.offset),this.isPlaying=!0,this.source=t,this.connect()}console.warn("THREE.Audio: this Audio has no playback control.")}},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 t=1,e=this.filters.length;t<e;t++)this.filters[t-1].connect(this.filters[t]);this.filters[this.filters.length-1].connect(this.getOutput())}else this.source.connect(this.getOutput());return this},disconnect:function(){if(0<this.filters.length){this.source.disconnect(this.filters[0]);for(var t=1,e=this.filters.length;t<e;t++)this.filters[t-1].disconnect(this.filters[t]);this.filters[this.filters.length-1].disconnect(this.getOutput())}else this.source.disconnect(this.getOutput());return this},getFilters:function(){return this.filters},setFilters:function(t){return t||(t=[]),!0===this.isPlaying?(this.disconnect(),this.filters=t,this.connect()):this.filters=t,this},getFilter:function(){return this.getFilters()[0]},setFilter:function(t){return this.setFilters(t?[t]:[])},setPlaybackRate:function(t){if(!1!==this.hasPlaybackControl)return this.playbackRate=t,!0===this.isPlaying&&this.source.playbackRate.setValueAtTime(this.playbackRate,this.context.currentTime),this;console.warn("THREE.Audio: this Audio has no playback control.")},getPlaybackRate:function(){return this.playbackRate},onEnded:function(){this.isPlaying=!1},getLoop:function(){return!1===this.hasPlaybackControl?(console.warn("THREE.Audio: this Audio has no playback control."),!1):this.loop},setLoop:function(t){if(!1!==this.hasPlaybackControl)return this.loop=t,!0===this.isPlaying&&(this.source.loop=this.loop),this;console.warn("THREE.Audio: this Audio has no playback control.")},getVolume:function(){return this.gain.gain.value},setVolume:function(t){return this.gain.gain.setTargetAtTime(t,this.context.currentTime,.01),this}}),Fi.prototype=Object.assign(Object.create(Bi.prototype),{constructor:Fi,getOutput:function(){return this.panner},getRefDistance:function(){return this.panner.refDistance},setRefDistance:function(t){this.panner.refDistance=t},getRolloffFactor:function(){return this.panner.rolloffFactor},setRolloffFactor:function(t){this.panner.rolloffFactor=t},getDistanceModel:function(){return this.panner.distanceModel},setDistanceModel:function(t){this.panner.distanceModel=t},getMaxDistance:function(){return this.panner.maxDistance},setMaxDistance:function(t){this.panner.maxDistance=t},updateMatrixWorld:function(){var t=new o;return function(e){b.prototype.updateMatrixWorld.call(this,e),t.setFromMatrixPosition(this.matrixWorld),this.panner.setPosition(t.x,t.y,t.z)}}()}),Object.assign(zi.prototype,{getFrequencyData:function(){return this.analyser.getByteFrequencyData(this.data),this.data},getAverageFrequency:function(){for(var t=0,e=this.getFrequencyData(),n=0;n<e.length;n++)t+=e[n];return t/e.length}}),Object.assign(Hi.prototype,{accumulate:function(t,e){var n=this.buffer,i=this.valueSize;t=t*i+i;var r=this.cumulativeWeight;if(0===r){for(r=0;r!==i;++r)n[t+r]=n[r];r=e}else r+=e,this._mixBufferRegion(n,t,0,e/r,i);this.cumulativeWeight=r},apply:function(t){var e=this.valueSize,n=this.buffer;t=t*e+e;var i=this.cumulativeWeight,r=this.binding;this.cumulativeWeight=0,1>i&&this._mixBufferRegion(n,t,3*e,1-i,e),i=e;for(var o=e+e;i!==o;++i)if(n[i]!==n[i+e]){r.setValue(n,t);break}},saveOriginalState:function(){var t=this.buffer,e=this.valueSize,n=3*e;this.binding.getValue(t,n);for(var i=e;i!==n;++i)t[i]=t[n+i%e];this.cumulativeWeight=0},restoreOriginalState:function(){this.binding.setValue(this.buffer,3*this.valueSize)},_select:function(t,e,n,i,r){if(.5<=i)for(i=0;i!==r;++i)t[e+i]=t[n+i]},_slerp:function(t,e,n,i){r.slerpFlat(t,e,t,e,t,n,i)},_lerp:function(t,e,n,i,r){for(var o=1-i,a=0;a!==r;++a){var s=e+a;t[s]=t[s]*o+t[n+a]*i}}}),Object.assign(Gi.prototype,{getValue:function(t,e){this.bind();var n=this._bindings[this._targetGroup.nCachedObjects_];void 0!==n&&n.getValue(t,e)},setValue:function(t,e){for(var n=this._bindings,i=this._targetGroup.nCachedObjects_,r=n.length;i!==r;++i)n[i].setValue(t,e)},bind:function(){for(var t=this._bindings,e=this._targetGroup.nCachedObjects_,n=t.length;e!==n;++e)t[e].bind()},unbind:function(){for(var t=this._bindings,e=this._targetGroup.nCachedObjects_,n=t.length;e!==n;++e)t[e].unbind()}}),Object.assign(ki,{Composite:Gi,create:function(t,e,n){return t&&t.isAnimationObjectGroup?new ki.Composite(t,e,n):new ki(t,e,n)},sanitizeNodeName:function(){var t=/[\[\]\.:\/]/g;return function(e){return e.replace(/\s/g,"_").replace(t,"")}}(),parseTrackName:function(){var t="[^"+"\\[\\]\\.:\\/".replace("\\.","")+"]",e=/((?:WC+[\/:])*)/.source.replace("WC","[^\\[\\]\\.:\\/]");t=/(WCOD+)?/.source.replace("WCOD",t);var n=/(?:\.(WC+)(?:\[(.+)\])?)?/.source.replace("WC","[^\\[\\]\\.:\\/]"),i=/\.(WC+)(?:\[(.+)\])?/.source.replace("WC","[^\\[\\]\\.:\\/]"),r=new RegExp("^"+e+t+n+i+"$"),o=["material","materials","bones"];return function(t){var e=r.exec(t);if(!e)throw Error("PropertyBinding: Cannot parse trackName: "+t);var n=(e={nodeName:e[2],objectName:e[3],objectIndex:e[4],propertyName:e[5],propertyIndex:e[6]}).nodeName&&e.nodeName.lastIndexOf(".");if(void 0!==n&&-1!==n){var i=e.nodeName.substring(n+1);-1!==o.indexOf(i)&&(e.nodeName=e.nodeName.substring(0,n),e.objectName=i)}if(null===e.propertyName||0===e.propertyName.length)throw Error("PropertyBinding: can not parse propertyName from trackName: "+t);return e}}(),findNode:function(t,e){if(!e||""===e||"root"===e||"."===e||-1===e||e===t.name||e===t.uuid)return t;if(t.skeleton){var n=t.skeleton.getBoneByName(e);if(void 0!==n)return n}if(t.children){var i=function(t){for(var n=0;n<t.length;n++){var r=t[n];if(r.name===e||r.uuid===e||(r=i(r.children)))return r}return null};if(t=i(t.children))return t}return null}}),Object.assign(ki.prototype,{_getValue_unavailable:function(){},_setValue_unavailable:function(){},BindingType:{Direct:0,EntireArray:1,ArrayElement:2,HasFromToArray:3},Versioning:{None:0,NeedsUpdate:1,MatrixWorldNeedsUpdate:2},GetterByBindingType:[function(t,e){t[e]=this.node[this.propertyName]},function(t,e){for(var n=this.resolvedProperty,i=0,r=n.length;i!==r;++i)t[e++]=n[i]},function(t,e){t[e]=this.resolvedProperty[this.propertyIndex]},function(t,e){this.resolvedProperty.toArray(t,e)}],SetterByBindingTypeAndVersioning:[[function(t,e){this.targetObject[this.propertyName]=t[e]},function(t,e){this.targetObject[this.propertyName]=t[e],this.targetObject.needsUpdate=!0},function(t,e){this.targetObject[this.propertyName]=t[e],this.targetObject.matrixWorldNeedsUpdate=!0}],[function(t,e){for(var n=this.resolvedProperty,i=0,r=n.length;i!==r;++i)n[i]=t[e++]},function(t,e){for(var n=this.resolvedProperty,i=0,r=n.length;i!==r;++i)n[i]=t[e++];this.targetObject.needsUpdate=!0},function(t,e){for(var n=this.resolvedProperty,i=0,r=n.length;i!==r;++i)n[i]=t[e++];this.targetObject.matrixWorldNeedsUpdate=!0}],[function(t,e){this.resolvedProperty[this.propertyIndex]=t[e]},function(t,e){this.resolvedProperty[this.propertyIndex]=t[e],this.targetObject.needsUpdate=!0},function(t,e){this.resolvedProperty[this.propertyIndex]=t[e],this.targetObject.matrixWorldNeedsUpdate=!0}],[function(t,e){this.resolvedProperty.fromArray(t,e)},function(t,e){this.resolvedProperty.fromArray(t,e),this.targetObject.needsUpdate=!0},function(t,e){this.resolvedProperty.fromArray(t,e),this.targetObject.matrixWorldNeedsUpdate=!0}]],getValue:function(t,e){this.bind(),this.getValue(t,e)},setValue:function(t,e){this.bind(),this.setValue(t,e)},bind:function(){var t=this.node,e=this.parsedPath,n=e.objectName,i=e.propertyName,r=e.propertyIndex;if(t||(this.node=t=ki.findNode(this.rootNode,e.nodeName)||this.rootNode),this.getValue=this._getValue_unavailable,this.setValue=this._setValue_unavailable,t){if(n){var o=e.objectIndex;switch(n){case"materials":if(!t.material)return void console.error("THREE.PropertyBinding: Can not bind to material as node does not have a material.",this);if(!t.material.materials)return void console.error("THREE.PropertyBinding: Can not bind to material.materials as node.material does not have a materials array.",this);t=t.material.materials;break;case"bones":if(!t.skeleton)return void console.error("THREE.PropertyBinding: Can not bind to bones as node does not have a skeleton.",this);for(t=t.skeleton.bones,n=0;n<t.length;n++)if(t[n].name===o){o=n;break}break;default:if(void 0===t[n])return void console.error("THREE.PropertyBinding: Can not bind to objectName of node undefined.",this);t=t[n]}if(void 0!==o){if(void 0===t[o])return void console.error("THREE.PropertyBinding: Trying to bind to objectIndex of objectName, but is undefined.",this,t);t=t[o]}}if(void 0===(o=t[i]))console.error("THREE.PropertyBinding: Trying to update property for track: "+e.nodeName+"."+i+" but it wasn't found.",t);else{if(e=this.Versioning.None,void 0!==t.needsUpdate?(e=this.Versioning.NeedsUpdate,this.targetObject=t):void 0!==t.matrixWorldNeedsUpdate&&(e=this.Versioning.MatrixWorldNeedsUpdate,this.targetObject=t),n=this.BindingType.Direct,void 0!==r){if("morphTargetInfluences"===i){if(!t.geometry)return void console.error("THREE.PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.",this);if(t.geometry.isBufferGeometry){if(!t.geometry.morphAttributes)return void console.error("THREE.PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.morphAttributes.",this);for(n=0;n<this.node.geometry.morphAttributes.position.length;n++)if(t.geometry.morphAttributes.position[n].name===r){r=n;break}}else{if(!t.geometry.morphTargets)return void console.error("THREE.PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.morphTargets.",this);for(n=0;n<this.node.geometry.morphTargets.length;n++)if(t.geometry.morphTargets[n].name===r){r=n;break}}}n=this.BindingType.ArrayElement,this.resolvedProperty=o,this.propertyIndex=r}else void 0!==o.fromArray&&void 0!==o.toArray?(n=this.BindingType.HasFromToArray,this.resolvedProperty=o):Array.isArray(o)?(n=this.BindingType.EntireArray,this.resolvedProperty=o):this.propertyName=i;this.getValue=this.GetterByBindingType[n],this.setValue=this.SetterByBindingTypeAndVersioning[n][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}}),Object.assign(ki.prototype,{_getValue_unbound:ki.prototype.getValue,_setValue_unbound:ki.prototype.setValue}),Object.assign(Vi.prototype,{isAnimationObjectGroup:!0,add:function(){for(var t=this._objects,e=t.length,n=this.nCachedObjects_,i=this._indicesByUUID,r=this._paths,o=this._parsedPaths,a=this._bindings,s=a.length,c=void 0,h=0,l=arguments.length;h!==l;++h){var u=arguments[h],p=u.uuid,d=i[p];if(void 0===d){d=e++,i[p]=d,t.push(u),p=0;for(var f=s;p!==f;++p)a[p].push(new ki(u,r[p],o[p]))}else if(d<n){c=t[d];var m=--n;for(i[(f=t[m]).uuid]=d,t[d]=f,i[p]=m,t[m]=u,p=0,f=s;p!==f;++p){var g=a[p],v=g[d];g[d]=g[m],void 0===v&&(v=new ki(u,r[p],o[p])),g[m]=v}}else t[d]!==c&&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 t=this._objects,e=this.nCachedObjects_,n=this._indicesByUUID,i=this._bindings,r=i.length,o=0,a=arguments.length;o!==a;++o){var s=arguments[o],c=s.uuid,h=n[c];if(void 0!==h&&h>=e){var l=e++,u=t[l];for(n[u.uuid]=h,t[h]=u,n[c]=l,t[l]=s,s=0,c=r;s!==c;++s){var p=(u=i[s])[h];u[h]=u[l],u[l]=p}}}this.nCachedObjects_=e},uncache:function(){for(var t=this._objects,e=t.length,n=this.nCachedObjects_,i=this._indicesByUUID,r=this._bindings,o=r.length,a=0,s=arguments.length;a!==s;++a){var c=arguments[a].uuid,h=i[c];if(void 0!==h)if(delete i[c],h<n){var l=t[c=--n],u=--e,p=t[u];for(i[l.uuid]=h,t[h]=l,i[p.uuid]=c,t[c]=p,t.pop(),l=0,p=o;l!==p;++l){var d=r[l],f=d[u];d[h]=d[c],d[c]=f,d.pop()}}else for(i[(p=t[u=--e]).uuid]=h,t[h]=p,t.pop(),l=0,p=o;l!==p;++l)(d=r[l])[h]=d[u],d.pop()}this.nCachedObjects_=n},subscribe_:function(t,e){var n=this._bindingsIndicesByPath,i=n[t],r=this._bindings;if(void 0!==i)return r[i];var o=this._paths,a=this._parsedPaths,s=this._objects,c=this.nCachedObjects_,h=Array(s.length);for(i=r.length,n[t]=i,o.push(t),a.push(e),r.push(h),n=c,i=s.length;n!==i;++n)h[n]=new ki(s[n],t,e);return h},unsubscribe_:function(t){var e=this._bindingsIndicesByPath,n=e[t];if(void 0!==n){var i=this._paths,r=this._parsedPaths,o=this._bindings,a=o.length-1,s=o[a];e[t[a]]=n,o[n]=s,o.pop(),r[n]=r[a],r.pop(),i[n]=i[a],i.pop()}}}),Object.assign(ji.prototype,{play:function(){return this._mixer._activateAction(this),this},stop:function(){return this._mixer._deactivateAction(this),this.reset()},reset:function(){return this.paused=!1,this.enabled=!0,this.time=0,this._loopCount=-1,this._startTime=null,this.stopFading().stopWarping()},isRunning:function(){return this.enabled&&!this.paused&&0!==this.timeScale&&null===this._startTime&&this._mixer._isActiveAction(this)},isScheduled:function(){return this._mixer._isActiveAction(this)},startAt:function(t){return this._startTime=t,this},setLoop:function(t,e){return this.loop=t,this.repetitions=e,this},setEffectiveWeight:function(t){return this.weight=t,this._effectiveWeight=this.enabled?t:0,this.stopFading()},getEffectiveWeight:function(){return this._effectiveWeight},fadeIn:function(t){return this._scheduleFading(t,0,1)},fadeOut:function(t){return this._scheduleFading(t,1,0)},crossFadeFrom:function(t,e,n){if(t.fadeOut(e),this.fadeIn(e),n){n=this._clip.duration;var i=t._clip.duration,r=n/i;t.warp(1,i/n,e),this.warp(r,1,e)}return this},crossFadeTo:function(t,e,n){return t.crossFadeFrom(this,e,n)},stopFading:function(){var t=this._weightInterpolant;return null!==t&&(this._weightInterpolant=null,this._mixer._takeBackControlInterpolant(t)),this},setEffectiveTimeScale:function(t){return this.timeScale=t,this._effectiveTimeScale=this.paused?0:t,this.stopWarping()},getEffectiveTimeScale:function(){return this._effectiveTimeScale},setDuration:function(t){return this.timeScale=this._clip.duration/t,this.stopWarping()},syncWith:function(t){return this.time=t.time,this.timeScale=t.timeScale,this.stopWarping()},halt:function(t){return this.warp(this._effectiveTimeScale,0,t)},warp:function(t,e,n){var i=this._mixer,r=i.time,o=this._timeScaleInterpolant,a=this.timeScale;return null===o&&(this._timeScaleInterpolant=o=i._lendControlInterpolant()),i=o.parameterPositions,o=o.sampleValues,i[0]=r,i[1]=r+n,o[0]=t/a,o[1]=e/a,this},stopWarping:function(){var t=this._timeScaleInterpolant;return null!==t&&(this._timeScaleInterpolant=null,this._mixer._takeBackControlInterpolant(t)),this},getMixer:function(){return this._mixer},getClip:function(){return this._clip},getRoot:function(){return this._localRoot||this._mixer._root},_update:function(t,e,n,i){if(this.enabled){var r=this._startTime;if(null!==r){if(0>(e=(t-r)*n)||0===n)return;this._startTime=null,e*=n}if(e*=this._updateTimeScale(t),n=this._updateTime(e),0<(t=this._updateWeight(t))){e=this._interpolants,r=this._propertyBindings;for(var o=0,a=e.length;o!==a;++o)e[o].evaluate(n),r[o].accumulate(i,t)}}else this._updateWeight(t)},_updateWeight:function(t){var e=0;if(this.enabled){e=this.weight;var n=this._weightInterpolant;if(null!==n){var i=n.evaluate(t)[0];e*=i,t>n.parameterPositions[1]&&(this.stopFading(),0===i&&(this.enabled=!1))}}return this._effectiveWeight=e},_updateTimeScale:function(t){var e=0;if(!this.paused){e=this.timeScale;var n=this._timeScaleInterpolant;if(null!==n)e*=n.evaluate(t)[0],t>n.parameterPositions[1]&&(this.stopWarping(),0===e?this.paused=!0:this.timeScale=e)}return this._effectiveTimeScale=e},_updateTime:function(t){var e=this.time+t;if(0===t)return e;var n=this._clip.duration,i=this.loop,r=this._loopCount;if(2200===i)t:{if(-1===r&&(this._loopCount=0,this._setEndings(!0,!0,!1)),e>=n)e=n;else{if(!(0>e))break t;e=0}this.clampWhenFinished?this.paused=!0:this.enabled=!1,this._mixer.dispatchEvent({type:"finished",action:this,direction:0>t?-1:1})}else{if(i=2202===i,-1===r&&(0<=t?(r=0,this._setEndings(!0,0===this.repetitions,i)):this._setEndings(0===this.repetitions,!0,i)),e>=n||0>e){var o=Math.floor(e/n);e-=n*o,r+=Math.abs(o);var a=this.repetitions-r;0>=a?(this.clampWhenFinished?this.paused=!0:this.enabled=!1,e=0<t?n:0,this._mixer.dispatchEvent({type:"finished",action:this,direction:0<t?1:-1})):(1===a?(t=0>t,this._setEndings(t,!t,i)):this._setEndings(!1,!1,i),this._loopCount=r,this._mixer.dispatchEvent({type:"loop",action:this,loopDelta:o}))}if(i&&1==(1&r))return this.time=e,n-e}return this.time=e},_setEndings:function(t,e,n){var i=this._interpolantSettings;n?(i.endingStart=2401,i.endingEnd=2401):(i.endingStart=t?this.zeroSlopeAtStart?2401:2400:2402,i.endingEnd=e?this.zeroSlopeAtEnd?2401:2400:2402)},_scheduleFading:function(t,e,n){var i=this._mixer,r=i.time,o=this._weightInterpolant;return null===o&&(this._weightInterpolant=o=i._lendControlInterpolant()),i=o.parameterPositions,o=o.sampleValues,i[0]=r,o[0]=e,i[1]=r+t,o[1]=n,this}}),Wi.prototype=Object.assign(Object.create(e.prototype),{constructor:Wi,_bindAction:function(t,e){var n=t._localRoot||this._root,i=t._clip.tracks,r=i.length,o=t._propertyBindings;t=t._interpolants;var a=n.uuid,s=this._bindingsByRootAndName,c=s[a];for(void 0===c&&(c={},s[a]=c),s=0;s!==r;++s){var h=i[s],l=h.name,u=c[l];if(void 0===u){if(void 0!==(u=o[s])){null===u._cacheIndex&&(++u.referenceCount,this._addInactiveBinding(u,a,l));continue}++(u=new Hi(ki.create(n,l,e&&e._propertyBindings[s].binding.parsedPath),h.ValueTypeName,h.getValueSize())).referenceCount,this._addInactiveBinding(u,a,l)}o[s]=u,t[s].resultBuffer=u.buffer}},_activateAction:function(t){if(!this._isActiveAction(t)){if(null===t._cacheIndex){var e=(t._localRoot||this._root).uuid,n=t._clip.uuid,i=this._actionsByClip[n];this._bindAction(t,i&&i.knownActions[0]),this._addInactiveAction(t,n,e)}for(n=0,i=(e=t._propertyBindings).length;n!==i;++n){var r=e[n];0==r.useCount++&&(this._lendBinding(r),r.saveOriginalState())}this._lendAction(t)}},_deactivateAction:function(t){if(this._isActiveAction(t)){for(var e=t._propertyBindings,n=0,i=e.length;n!==i;++n){var r=e[n];0==--r.useCount&&(r.restoreOriginalState(),this._takeBackBinding(r))}this._takeBackAction(t)}},_initMemoryManager:function(){this._actions=[],this._nActiveActions=0,this._actionsByClip={},this._bindings=[],this._nActiveBindings=0,this._bindingsByRootAndName={},this._controlInterpolants=[],this._nActiveControlInterpolants=0;var t=this;this.stats={actions:{get total(){return t._actions.length},get inUse(){return t._nActiveActions}},bindings:{get total(){return t._bindings.length},get inUse(){return t._nActiveBindings}},controlInterpolants:{get total(){return t._controlInterpolants.length},get inUse(){return t._nActiveControlInterpolants}}}},_isActiveAction:function(t){return null!==(t=t._cacheIndex)&&t<this._nActiveActions},_addInactiveAction:function(t,e,n){var i=this._actions,r=this._actionsByClip,o=r[e];void 0===o?(o={knownActions:[t],actionByRoot:{}},t._byClipCacheIndex=0,r[e]=o):(e=o.knownActions,t._byClipCacheIndex=e.length,e.push(t)),t._cacheIndex=i.length,i.push(t),o.actionByRoot[n]=t},_removeInactiveAction:function(t){var e=this._actions,n=e[e.length-1],i=t._cacheIndex;n._cacheIndex=i,e[i]=n,e.pop(),t._cacheIndex=null,e=t._clip.uuid;var r=(i=(n=this._actionsByClip)[e]).knownActions,o=r[r.length-1],a=t._byClipCacheIndex;o._byClipCacheIndex=a,r[a]=o,r.pop(),t._byClipCacheIndex=null,delete i.actionByRoot[(t._localRoot||this._root).uuid],0===r.length&&delete n[e],this._removeInactiveBindingsForAction(t)},_removeInactiveBindingsForAction:function(t){for(var e=0,n=(t=t._propertyBindings).length;e!==n;++e){var i=t[e];0==--i.referenceCount&&this._removeInactiveBinding(i)}},_lendAction:function(t){var e=this._actions,n=t._cacheIndex,i=this._nActiveActions++,r=e[i];t._cacheIndex=i,e[i]=t,r._cacheIndex=n,e[n]=r},_takeBackAction:function(t){var e=this._actions,n=t._cacheIndex,i=--this._nActiveActions,r=e[i];t._cacheIndex=i,e[i]=t,r._cacheIndex=n,e[n]=r},_addInactiveBinding:function(t,e,n){var i=this._bindingsByRootAndName,r=i[e],o=this._bindings;void 0===r&&(r={},i[e]=r),r[n]=t,t._cacheIndex=o.length,o.push(t)},_removeInactiveBinding:function(t){var e=this._bindings,n=t.binding,i=n.rootNode.uuid;n=n.path;var r=this._bindingsByRootAndName,o=r[i],a=e[e.length-1];t=t._cacheIndex,a._cacheIndex=t,e[t]=a,e.pop(),delete o[n];t:{for(var s in o)break t;delete r[i]}},_lendBinding:function(t){var e=this._bindings,n=t._cacheIndex,i=this._nActiveBindings++,r=e[i];t._cacheIndex=i,e[i]=t,r._cacheIndex=n,e[n]=r},_takeBackBinding:function(t){var e=this._bindings,n=t._cacheIndex,i=--this._nActiveBindings,r=e[i];t._cacheIndex=i,e[i]=t,r._cacheIndex=n,e[n]=r},_lendControlInterpolant:function(){var t=this._controlInterpolants,e=this._nActiveControlInterpolants++,n=t[e];return void 0===n&&((n=new xi(new Float32Array(2),new Float32Array(2),1,this._controlInterpolantsResultBuffer)).__cacheIndex=e,t[e]=n),n},_takeBackControlInterpolant:function(t){var e=this._controlInterpolants,n=t.__cacheIndex,i=--this._nActiveControlInterpolants,r=e[i];t.__cacheIndex=i,e[i]=t,r.__cacheIndex=n,e[n]=r},_controlInterpolantsResultBuffer:new Float32Array(1),clipAction:function(t,e){var n=e||this._root,i=n.uuid;t=null!==(n="string"==typeof t?Mi.findByName(n,t):t)?n.uuid:t;var r=this._actionsByClip[t],o=null;if(void 0!==r){if(void 0!==(o=r.actionByRoot[i]))return o;o=r.knownActions[0],null===n&&(n=o._clip)}return null===n?null:(e=new ji(this,n,e),this._bindAction(e,o),this._addInactiveAction(e,t,i),e)},existingAction:function(t,e){var n=e||this._root;return e=n.uuid,n="string"==typeof t?Mi.findByName(n,t):t,void 0!==(t=this._actionsByClip[n?n.uuid:t])&&t.actionByRoot[e]||null},stopAllAction:function(){for(var t=this._actions,e=this._nActiveActions,n=this._bindings,i=this._nActiveBindings,r=this._nActiveBindings=this._nActiveActions=0;r!==e;++r)t[r].reset();for(r=0;r!==i;++r)n[r].useCount=0;return this},update:function(t){t*=this.timeScale;for(var e=this._actions,n=this._nActiveActions,i=this.time+=t,r=Math.sign(t),o=this._accuIndex^=1,a=0;a!==n;++a)e[a]._update(i,t,r,o);for(t=this._bindings,e=this._nActiveBindings,a=0;a!==e;++a)t[a].apply(o);return this},getRoot:function(){return this._root},uncacheClip:function(t){var e=this._actions;t=t.uuid;var n=this._actionsByClip,i=n[t];if(void 0!==i){for(var r=0,o=(i=i.knownActions).length;r!==o;++r){var a=i[r];this._deactivateAction(a);var s=a._cacheIndex,c=e[e.length-1];a._cacheIndex=null,a._byClipCacheIndex=null,c._cacheIndex=s,e[s]=c,e.pop(),this._removeInactiveBindingsForAction(a)}delete n[t]}},uncacheRoot:function(t){t=t.uuid;var e=this._actionsByClip;for(i in e){var n=e[i].actionByRoot[t];void 0!==n&&(this._deactivateAction(n),this._removeInactiveAction(n))}var i=this._bindingsByRootAndName[t];if(void 0!==i)for(var r in i)(t=i[r]).restoreOriginalState(),this._removeInactiveBinding(t)},uncacheAction:function(t,e){null!==(t=this.existingAction(t,e))&&(this._deactivateAction(t),this._removeInactiveAction(t))}}),Xi.prototype.clone=function(){return new Xi(void 0===this.value.clone?this.value:this.value.clone())},qi.prototype=Object.assign(Object.create(B.prototype),{constructor:qi,isInstancedBufferGeometry:!0,copy:function(t){return B.prototype.copy.call(this,t),this.maxInstancedCount=t.maxInstancedCount,this},clone:function(){return(new this.constructor).copy(this)}}),Object.defineProperties(Yi.prototype,{count:{get:function(){return this.data.count}},array:{get:function(){return this.data.array}}}),Object.assign(Yi.prototype,{isInterleavedBufferAttribute:!0,setX:function(t,e){return this.data.array[t*this.data.stride+this.offset]=e,this},setY:function(t,e){return this.data.array[t*this.data.stride+this.offset+1]=e,this},setZ:function(t,e){return this.data.array[t*this.data.stride+this.offset+2]=e,this},setW:function(t,e){return this.data.array[t*this.data.stride+this.offset+3]=e,this},getX:function(t){return this.data.array[t*this.data.stride+this.offset]},getY:function(t){return this.data.array[t*this.data.stride+this.offset+1]},getZ:function(t){return this.data.array[t*this.data.stride+this.offset+2]},getW:function(t){return this.data.array[t*this.data.stride+this.offset+3]},setXY:function(t,e,n){return t=t*this.data.stride+this.offset,this.data.array[t+0]=e,this.data.array[t+1]=n,this},setXYZ:function(t,e,n,i){return t=t*this.data.stride+this.offset,this.data.array[t+0]=e,this.data.array[t+1]=n,this.data.array[t+2]=i,this},setXYZW:function(t,e,n,i,r){return t=t*this.data.stride+this.offset,this.data.array[t+0]=e,this.data.array[t+1]=n,this.data.array[t+2]=i,this.data.array[t+3]=r,this}}),Object.defineProperty(Zi.prototype,"needsUpdate",{set:function(t){!0===t&&this.version++}}),Object.assign(Zi.prototype,{isInterleavedBuffer:!0,onUploadCallback:function(){},setArray:function(t){if(Array.isArray(t))throw new TypeError("THREE.BufferAttribute: array should be a Typed Array.");return this.count=void 0!==t?t.length/this.stride:0,this.array=t,this},setDynamic:function(t){return this.dynamic=t,this},copy:function(t){return this.array=new t.array.constructor(t.array),this.count=t.count,this.stride=t.stride,this.dynamic=t.dynamic,this},copyAt:function(t,e,n){t*=this.stride,n*=e.stride;for(var i=0,r=this.stride;i<r;i++)this.array[t+i]=e.array[n+i];return this},set:function(t,e){return void 0===e&&(e=0),this.array.set(t,e),this},clone:function(){return(new this.constructor).copy(this)},onUpload:function(t){return this.onUploadCallback=t,this}}),Ji.prototype=Object.assign(Object.create(Zi.prototype),{constructor:Ji,isInstancedInterleavedBuffer:!0,copy:function(t){return Zi.prototype.copy.call(this,t),this.meshPerAttribute=t.meshPerAttribute,this}}),Qi.prototype=Object.assign(Object.create(T.prototype),{constructor:Qi,isInstancedBufferAttribute:!0,copy:function(t){return T.prototype.copy.call(this,t),this.meshPerAttribute=t.meshPerAttribute,this}}),Object.assign(Ki.prototype,{linePrecision:1,set:function(t,e){this.ray.set(t,e)},setFromCamera:function(t,e){e&&e.isPerspectiveCamera?(this.ray.origin.setFromMatrixPosition(e.matrixWorld),this.ray.direction.set(t.x,t.y,.5).unproject(e).sub(this.ray.origin).normalize()):e&&e.isOrthographicCamera?(this.ray.origin.set(t.x,t.y,(e.near+e.far)/(e.near-e.far)).unproject(e),this.ray.direction.set(0,0,-1).transformDirection(e.matrixWorld)):console.error("THREE.Raycaster: Unsupported camera type.")},intersectObject:function(t,e,n){return tr(t,this,n=n||[],e),n.sort($i),n},intersectObjects:function(t,e,n){if(n=n||[],!1===Array.isArray(t))return console.warn("THREE.Raycaster.intersectObjects: objects is not an Array."),n;for(var i=0,r=t.length;i<r;i++)tr(t[i],this,n,e);return n.sort($i),n}}),Object.assign(er.prototype,{start:function(){this.oldTime=this.startTime=("undefined"==typeof performance?Date:performance).now(),this.elapsedTime=0,this.running=!0},stop:function(){this.getElapsedTime(),this.autoStart=this.running=!1},getElapsedTime:function(){return this.getDelta(),this.elapsedTime},getDelta:function(){var t=0;if(this.autoStart&&!this.running)return this.start(),0;if(this.running){var e=("undefined"==typeof performance?Date:performance).now();t=(e-this.oldTime)/1e3,this.oldTime=e,this.elapsedTime+=t}return t}}),Object.assign(nr.prototype,{set:function(t,e,n){return this.radius=t,this.phi=e,this.theta=n,this},clone:function(){return(new this.constructor).copy(this)},copy:function(t){return this.radius=t.radius,this.phi=t.phi,this.theta=t.theta,this},makeSafe:function(){return this.phi=Math.max(1e-6,Math.min(Math.PI-1e-6,this.phi)),this},setFromVector3:function(t){return this.radius=t.length(),0===this.radius?this.phi=this.theta=0:(this.theta=Math.atan2(t.x,t.z),this.phi=Math.acos(Ar.clamp(t.y/this.radius,-1,1))),this}}),Object.assign(ir.prototype,{set:function(t,e,n){return this.radius=t,this.theta=e,this.y=n,this},clone:function(){return(new this.constructor).copy(this)},copy:function(t){return this.radius=t.radius,this.theta=t.theta,this.y=t.y,this},setFromVector3:function(t){return this.radius=Math.sqrt(t.x*t.x+t.z*t.z),this.theta=Math.atan2(t.x,t.z),this.y=t.y,this}}),Object.assign(rr.prototype,{set:function(t,e){return this.min.copy(t),this.max.copy(e),this},setFromPoints:function(t){this.makeEmpty();for(var e=0,n=t.length;e<n;e++)this.expandByPoint(t[e]);return this},setFromCenterAndSize:function(){var t=new n;return function(e,n){return n=t.copy(n).multiplyScalar(.5),this.min.copy(e).sub(n),this.max.copy(e).add(n),this}}(),clone:function(){return(new this.constructor).copy(this)},copy:function(t){return this.min.copy(t.min),this.max.copy(t.max),this},makeEmpty:function(){return this.min.x=this.min.y=1/0,this.max.x=this.max.y=-1/0,this},isEmpty:function(){return this.max.x<this.min.x||this.max.y<this.min.y},getCenter:function(t){return void 0===t&&(console.warn("THREE.Box2: .getCenter() target is now required"),t=new n),this.isEmpty()?t.set(0,0):t.addVectors(this.min,this.max).multiplyScalar(.5)},getSize:function(t){return void 0===t&&(console.warn("THREE.Box2: .getSize() target is now required"),t=new n),this.isEmpty()?t.set(0,0):t.subVectors(this.max,this.min)},expandByPoint:function(t){return this.min.min(t),this.max.max(t),this},expandByVector:function(t){return this.min.sub(t),this.max.add(t),this},expandByScalar:function(t){return this.min.addScalar(-t),this.max.addScalar(t),this},containsPoint:function(t){return!(t.x<this.min.x||t.x>this.max.x||t.y<this.min.y||t.y>this.max.y)},containsBox:function(t){return this.min.x<=t.min.x&&t.max.x<=this.max.x&&this.min.y<=t.min.y&&t.max.y<=this.max.y},getParameter:function(t,e){return void 0===e&&(console.warn("THREE.Box2: .getParameter() target is now required"),e=new n),e.set((t.x-this.min.x)/(this.max.x-this.min.x),(t.y-this.min.y)/(this.max.y-this.min.y))},intersectsBox:function(t){return!(t.max.x<this.min.x||t.min.x>this.max.x||t.max.y<this.min.y||t.min.y>this.max.y)},clampPoint:function(t,e){return void 0===e&&(console.warn("THREE.Box2: .clampPoint() target is now required"),e=new n),e.copy(t).clamp(this.min,this.max)},distanceToPoint:function(){var t=new n;return function(e){return t.copy(e).clamp(this.min,this.max).sub(e).length()}}(),intersect:function(t){return this.min.max(t.min),this.max.min(t.max),this},union:function(t){return this.min.min(t.min),this.max.max(t.max),this},translate:function(t){return this.min.add(t),this.max.add(t),this},equals:function(t){return t.min.equals(this.min)&&t.max.equals(this.max)}}),or.prototype=Object.create(b.prototype),or.prototype.constructor=or,or.prototype.isImmediateRenderObject=!0,ar.prototype=Object.create(le.prototype),ar.prototype.constructor=ar,ar.prototype.update=function(){var t=new o,e=new o,n=new a;return function(){var i=["a","b","c"];this.object.updateMatrixWorld(!0),n.getNormalMatrix(this.object.matrixWorld);var r=this.object.matrixWorld,o=this.geometry.attributes.position,a=this.object.geometry;if(a&&a.isGeometry)for(var s=a.vertices,c=a.faces,h=a=0,l=c.length;h<l;h++)for(var u=c[h],p=0,d=u.vertexNormals.length;p<d;p++){var f=u.vertexNormals[p];t.copy(s[u[i[p]]]).applyMatrix4(r),e.copy(f).applyMatrix3(n).normalize().multiplyScalar(this.size).add(t),o.setXYZ(a,t.x,t.y,t.z),a+=1,o.setXYZ(a,e.x,e.y,e.z),a+=1}else if(a&&a.isBufferGeometry)for(i=a.attributes.position,s=a.attributes.normal,p=a=0,d=i.count;p<d;p++)t.set(i.getX(p),i.getY(p),i.getZ(p)).applyMatrix4(r),e.set(s.getX(p),s.getY(p),s.getZ(p)),e.applyMatrix3(n).normalize().multiplyScalar(this.size).add(t),o.setXYZ(a,t.x,t.y,t.z),a+=1,o.setXYZ(a,e.x,e.y,e.z),a+=1;o.needsUpdate=!0}}(),sr.prototype=Object.create(b.prototype),sr.prototype.constructor=sr,sr.prototype.dispose=function(){this.cone.geometry.dispose(),this.cone.material.dispose()},sr.prototype.update=function(){var t=new o,e=new o;return function(){this.light.updateMatrixWorld();var n=this.light.distance?this.light.distance:1e3,i=n*Math.tan(this.light.angle);this.cone.scale.set(i,i,n),t.setFromMatrixPosition(this.light.matrixWorld),e.setFromMatrixPosition(this.light.target.matrixWorld),this.cone.lookAt(e.sub(t)),void 0!==this.color?this.cone.material.color.set(this.color):this.cone.material.color.copy(this.light.color)}}(),cr.prototype=Object.create(le.prototype),cr.prototype.constructor=cr,cr.prototype.updateMatrixWorld=function(){var t=new o,e=new i,n=new i;return function(i){var r=this.bones,o=this.geometry,a=o.getAttribute("position");n.getInverse(this.root.matrixWorld);for(var s=0,c=0;s<r.length;s++){var h=r[s];h.parent&&h.parent.isBone&&(e.multiplyMatrices(n,h.matrixWorld),t.setFromMatrixPosition(e),a.setXYZ(c,t.x,t.y,t.z),e.multiplyMatrices(n,h.parent.matrixWorld),t.setFromMatrixPosition(e),a.setXYZ(c+1,t.x,t.y,t.z),c+=2)}o.getAttribute("position").needsUpdate=!0,b.prototype.updateMatrixWorld.call(this,i)}}(),hr.prototype=Object.create(Y.prototype),hr.prototype.constructor=hr,hr.prototype.dispose=function(){this.geometry.dispose(),this.material.dispose()},hr.prototype.update=function(){void 0!==this.color?this.material.color.set(this.color):this.material.color.copy(this.light.color)},lr.prototype=Object.create(b.prototype),lr.prototype.constructor=lr,lr.prototype.dispose=function(){this.children[0].geometry.dispose(),this.children[0].material.dispose()},lr.prototype.update=function(){var t=.5*this.light.width,e=.5*this.light.height,n=this.line.geometry.attributes.position,i=n.array;i[0]=t,i[1]=-e,i[2]=0,i[3]=t,i[4]=e,i[5]=0,i[6]=-t,i[7]=e,i[8]=0,i[9]=-t,i[10]=-e,i[11]=0,i[12]=t,i[13]=-e,i[14]=0,n.needsUpdate=!0,void 0!==this.color?this.line.material.color.set(this.color):this.line.material.color.copy(this.light.color)},ur.prototype=Object.create(b.prototype),ur.prototype.constructor=ur,ur.prototype.dispose=function(){this.children[0].geometry.dispose(),this.children[0].material.dispose()},ur.prototype.update=function(){var t=new o,e=new g,n=new g;return function(){var i=this.children[0];if(void 0!==this.color)this.material.color.set(this.color);else{var r=i.geometry.getAttribute("color");e.copy(this.light.color),n.copy(this.light.groundColor);for(var o=0,a=r.count;o<a;o++){var s=o<a/2?e:n;r.setXYZ(o,s.r,s.g,s.b)}r.needsUpdate=!0}i.lookAt(t.setFromMatrixPosition(this.light.matrixWorld).negate())}}(),pr.prototype=Object.create(le.prototype),pr.prototype.constructor=pr,dr.prototype=Object.create(le.prototype),dr.prototype.constructor=dr,fr.prototype=Object.create(le.prototype),fr.prototype.constructor=fr,fr.prototype.update=function(){var t=new o,e=new o,n=new a;return function(){this.object.updateMatrixWorld(!0),n.getNormalMatrix(this.object.matrixWorld);for(var i=this.object.matrixWorld,r=this.geometry.attributes.position,o=this.object.geometry,a=o.vertices,s=0,c=0,h=(o=o.faces).length;c<h;c++){var l=o[c],u=l.normal;t.copy(a[l.a]).add(a[l.b]).add(a[l.c]).divideScalar(3).applyMatrix4(i),e.copy(u).applyMatrix3(n).normalize().multiplyScalar(this.size).add(t),r.setXYZ(s,t.x,t.y,t.z),s+=1,r.setXYZ(s,e.x,e.y,e.z),s+=1}r.needsUpdate=!0}}(),mr.prototype=Object.create(b.prototype),mr.prototype.constructor=mr,mr.prototype.dispose=function(){this.lightPlane.geometry.dispose(),this.lightPlane.material.dispose(),this.targetLine.geometry.dispose(),this.targetLine.material.dispose()},mr.prototype.update=function(){var t=new o,e=new o,n=new o;return function(){t.setFromMatrixPosition(this.light.matrixWorld),e.setFromMatrixPosition(this.light.target.matrixWorld),n.subVectors(e,t),this.lightPlane.lookAt(n),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(n),this.targetLine.scale.z=n.length()}}(),gr.prototype=Object.create(le.prototype),gr.prototype.constructor=gr,gr.prototype.update=function(){function t(t,o,a,s){if(i.set(o,a,s).unproject(r),void 0!==(t=n[t]))for(o=e.getAttribute("position"),a=0,s=t.length;a<s;a++)o.setXYZ(t[a],i.x,i.y,i.z)}var e,n,i=new o,r=new w;return function(){e=this.geometry,n=this.pointMap,r.projectionMatrix.copy(this.camera.projectionMatrix),t("c",0,0,-1),t("t",0,0,1),t("n1",-1,-1,-1),t("n2",1,-1,-1),t("n3",-1,1,-1),t("n4",1,1,-1),t("f1",-1,-1,1),t("f2",1,-1,1),t("f3",-1,1,1),t("f4",1,1,1),t("u1",.7,1.1,-1),t("u2",-.7,1.1,-1),t("u3",0,2,-1),t("cf1",-1,0,1),t("cf2",1,0,1),t("cf3",0,-1,1),t("cf4",0,1,1),t("cn1",-1,0,-1),t("cn2",1,0,-1),t("cn3",0,-1,-1),t("cn4",0,1,-1),e.getAttribute("position").needsUpdate=!0}}(),vr.prototype=Object.create(le.prototype),vr.prototype.constructor=vr,vr.prototype.update=function(){var t=new p;return function(e){if(void 0!==e&&console.warn("THREE.BoxHelper: .update() has no longer arguments."),void 0!==this.object&&t.setFromObject(this.object),!t.isEmpty()){e=t.min;var n=t.max,i=this.geometry.attributes.position,r=i.array;r[0]=n.x,r[1]=n.y,r[2]=n.z,r[3]=e.x,r[4]=n.y,r[5]=n.z,r[6]=e.x,r[7]=e.y,r[8]=n.z,r[9]=n.x,r[10]=e.y,r[11]=n.z,r[12]=n.x,r[13]=n.y,r[14]=e.z,r[15]=e.x,r[16]=n.y,r[17]=e.z,r[18]=e.x,r[19]=e.y,r[20]=e.z,r[21]=n.x,r[22]=e.y,r[23]=e.z,i.needsUpdate=!0,this.geometry.computeBoundingSphere()}}}(),vr.prototype.setFromObject=function(t){return this.object=t,this.update(),this},yr.prototype=Object.create(le.prototype),yr.prototype.constructor=yr,yr.prototype.updateMatrixWorld=function(t){var e=this.box;e.isEmpty()||(e.getCenter(this.position),e.getSize(this.scale),this.scale.multiplyScalar(.5),b.prototype.updateMatrixWorld.call(this,t))},xr.prototype=Object.create(he.prototype),xr.prototype.constructor=xr,xr.prototype.updateMatrixWorld=function(t){var e=-this.plane.constant;1e-8>Math.abs(e)&&(e=1e-8),this.scale.set(.5*this.size,.5*this.size,e),this.lookAt(this.plane.normal),b.prototype.updateMatrixWorld.call(this,t)},br.prototype=Object.create(b.prototype),br.prototype.constructor=br,br.prototype.setDirection=function(){var t,e=new o;return function(n){.99999<n.y?this.quaternion.set(0,0,0,1):-.99999>n.y?this.quaternion.set(1,0,0,0):(e.set(n.z,0,-n.x).normalize(),t=Math.acos(n.y),this.quaternion.setFromAxisAngle(e,t))}}(),br.prototype.setLength=function(t,e,n){void 0===e&&(e=.2*t),void 0===n&&(n=.2*e),this.line.scale.set(1,Math.max(0,t-e),1),this.line.updateMatrix(),this.cone.scale.set(n,e,n),this.cone.position.y=t,this.cone.updateMatrix()},br.prototype.setColor=function(t){this.line.material.color.copy(t),this.cone.material.color.copy(t)},wr.prototype=Object.create(le.prototype),wr.prototype.constructor=wr,Bn.create=function(t,e){return console.log("THREE.Curve.create() has been deprecated"),t.prototype=Object.create(Bn.prototype),t.prototype.constructor=t,t.prototype.getPoint=e,t},Object.assign(Kn.prototype,{createPointsGeometry:function(t){return console.warn("THREE.CurvePath: .createPointsGeometry() has been removed. Use new THREE.Geometry().setFromPoints( points ) instead."),t=this.getPoints(t),this.createGeometry(t)},createSpacedPointsGeometry:function(t){return console.warn("THREE.CurvePath: .createSpacedPointsGeometry() has been removed. Use new THREE.Geometry().setFromPoints( points ) instead."),t=this.getSpacedPoints(t),this.createGeometry(t)},createGeometry:function(t){console.warn("THREE.CurvePath: .createGeometry() has been removed. Use new THREE.Geometry().setFromPoints( points ) instead.");for(var e=new E,n=0,i=t.length;n<i;n++){var r=t[n];e.vertices.push(new o(r.x,r.y,r.z||0))}return e}}),Object.assign($n.prototype,{fromPoints:function(t){console.warn("THREE.Path: .fromPoints() has been renamed to .setFromPoints()."),this.setFromPoints(t)}}),_r.prototype=Object.create(Gn.prototype),Mr.prototype=Object.create(Gn.prototype),Er.prototype=Object.create(Gn.prototype),Object.assign(Er.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.")}}),pr.prototype.setColors=function(){console.error("THREE.GridHelper: setColors() has been deprecated, pass them in the constructor instead.")},cr.prototype.update=function(){console.error("THREE.SkeletonHelper: update() no longer needs to be called.")},Object.assign(Si.prototype,{extractUrlBase:function(t){return console.warn("THREE.Loader: .extractUrlBase() has been deprecated. Use THREE.LoaderUtils.extractUrlBase() instead."),co.extractUrlBase(t)}}),Object.assign(rr.prototype,{center:function(t){return console.warn("THREE.Box2: .center() has been renamed to .getCenter()."),this.getCenter(t)},empty:function(){return console.warn("THREE.Box2: .empty() has been renamed to .isEmpty()."),this.isEmpty()},isIntersectionBox:function(t){return console.warn("THREE.Box2: .isIntersectionBox() has been renamed to .intersectsBox()."),this.intersectsBox(t)},size:function(t){return console.warn("THREE.Box2: .size() has been renamed to .getSize()."),this.getSize(t)}}),Object.assign(p.prototype,{center:function(t){return console.warn("THREE.Box3: .center() has been renamed to .getCenter()."),this.getCenter(t)},empty:function(){return console.warn("THREE.Box3: .empty() has been renamed to .isEmpty()."),this.isEmpty()},isIntersectionBox:function(t){return console.warn("THREE.Box3: .isIntersectionBox() has been renamed to .intersectsBox()."),this.intersectsBox(t)},isIntersectionSphere:function(t){return console.warn("THREE.Box3: .isIntersectionSphere() has been renamed to .intersectsSphere()."),this.intersectsSphere(t)},size:function(t){return console.warn("THREE.Box3: .size() has been renamed to .getSize()."),this.getSize(t)}}),X.prototype.center=function(t){return console.warn("THREE.Line3: .center() has been renamed to .getCenter()."),this.getCenter(t)},Object.assign(Ar,{random16:function(){return console.warn("THREE.Math: .random16() has been deprecated. Use Math.random() instead."),Math.random()},nearestPowerOfTwo:function(t){return console.warn("THREE.Math: .nearestPowerOfTwo() has been renamed to .floorPowerOfTwo()."),Ar.floorPowerOfTwo(t)},nextPowerOfTwo:function(t){return console.warn("THREE.Math: .nextPowerOfTwo() has been renamed to .ceilPowerOfTwo()."),Ar.ceilPowerOfTwo(t)}}),Object.assign(a.prototype,{flattenToArrayOffset:function(t,e){return console.warn("THREE.Matrix3: .flattenToArrayOffset() has been deprecated. Use .toArray() instead."),this.toArray(t,e)},multiplyVector3:function(t){return console.warn("THREE.Matrix3: .multiplyVector3() has been removed. Use vector.applyMatrix3( matrix ) instead."),t.applyMatrix3(this)},multiplyVector3Array:function(){console.error("THREE.Matrix3: .multiplyVector3Array() has been removed.")},applyToBuffer:function(t){return console.warn("THREE.Matrix3: .applyToBuffer() has been removed. Use matrix.applyToBufferAttribute( attribute ) instead."),this.applyToBufferAttribute(t)},applyToVector3Array:function(){console.error("THREE.Matrix3: .applyToVector3Array() has been removed.")}}),Object.assign(i.prototype,{extractPosition:function(t){return console.warn("THREE.Matrix4: .extractPosition() has been renamed to .copyPosition()."),this.copyPosition(t)},flattenToArrayOffset:function(t,e){return console.warn("THREE.Matrix4: .flattenToArrayOffset() has been deprecated. Use .toArray() instead."),this.toArray(t,e)},getPosition:function(){var t;return function(){return void 0===t&&(t=new o),console.warn("THREE.Matrix4: .getPosition() has been removed. Use Vector3.setFromMatrixPosition( matrix ) instead."),t.setFromMatrixColumn(this,3)}}(),setRotationFromQuaternion:function(t){return console.warn("THREE.Matrix4: .setRotationFromQuaternion() has been renamed to .makeRotationFromQuaternion()."),this.makeRotationFromQuaternion(t)},multiplyToArray:function(){console.warn("THREE.Matrix4: .multiplyToArray() has been removed.")},multiplyVector3:function(t){return console.warn("THREE.Matrix4: .multiplyVector3() has been removed. Use vector.applyMatrix4( matrix ) instead."),t.applyMatrix4(this)},multiplyVector4:function(t){return console.warn("THREE.Matrix4: .multiplyVector4() has been removed. Use vector.applyMatrix4( matrix ) instead."),t.applyMatrix4(this)},multiplyVector3Array:function(){console.error("THREE.Matrix4: .multiplyVector3Array() has been removed.")},rotateAxis:function(t){console.warn("THREE.Matrix4: .rotateAxis() has been removed. Use Vector3.transformDirection( matrix ) instead."),t.transformDirection(this)},crossVector:function(t){return console.warn("THREE.Matrix4: .crossVector() has been removed. Use vector.applyMatrix4( matrix ) instead."),t.applyMatrix4(this)},translate:function(){console.error("THREE.Matrix4: .translate() has been removed.")},rotateX:function(){console.error("THREE.Matrix4: .rotateX() has been removed.")},rotateY:function(){console.error("THREE.Matrix4: .rotateY() has been removed.")},rotateZ:function(){console.error("THREE.Matrix4: .rotateZ() has been removed.")},rotateByAxis:function(){console.error("THREE.Matrix4: .rotateByAxis() has been removed.")},applyToBuffer:function(t){return console.warn("THREE.Matrix4: .applyToBuffer() has been removed. Use matrix.applyToBufferAttribute( attribute ) instead."),this.applyToBufferAttribute(t)},applyToVector3Array:function(){console.error("THREE.Matrix4: .applyToVector3Array() has been removed.")},makeFrustum:function(t,e,n,i,r,o){return console.warn("THREE.Matrix4: .makeFrustum() has been removed. Use .makePerspective( left, right, top, bottom, near, far ) instead."),this.makePerspective(t,e,i,n,r,o)}}),f.prototype.isIntersectionLine=function(t){return console.warn("THREE.Plane: .isIntersectionLine() has been renamed to .intersectsLine()."),this.intersectsLine(t)},r.prototype.multiplyVector3=function(t){return console.warn("THREE.Quaternion: .multiplyVector3() has been removed. Use is now vector.applyQuaternion( quaternion ) instead."),t.applyQuaternion(this)},Object.assign(W.prototype,{isIntersectionBox:function(t){return console.warn("THREE.Ray: .isIntersectionBox() has been renamed to .intersectsBox()."),this.intersectsBox(t)},isIntersectionPlane:function(t){return console.warn("THREE.Ray: .isIntersectionPlane() has been renamed to .intersectsPlane()."),this.intersectsPlane(t)},isIntersectionSphere:function(t){return console.warn("THREE.Ray: .isIntersectionSphere() has been renamed to .intersectsSphere()."),this.intersectsSphere(t)}}),Object.assign(q.prototype,{area:function(){return console.warn("THREE.Triangle: .area() has been renamed to .getArea()."),this.getArea()},barycoordFromPoint:function(t,e){return console.warn("THREE.Triangle: .barycoordFromPoint() has been renamed to .getBarycoord()."),this.getBarycoord(t,e)},midpoint:function(t){return console.warn("THREE.Triangle: .midpoint() has been renamed to .getMidpoint()."),this.getMidpoint(t)},normal:function(t){return console.warn("THREE.Triangle: .normal() has been renamed to .getNormal()."),this.getNormal(t)},plane:function(t){return console.warn("THREE.Triangle: .plane() has been renamed to .getPlane()."),this.getPlane(t)}}),Object.assign(q,{barycoordFromPoint:function(t,e,n,i,r){return console.warn("THREE.Triangle: .barycoordFromPoint() has been renamed to .getBarycoord()."),q.getBarycoord(t,e,n,i,r)},normal:function(t,e,n,i){return console.warn("THREE.Triangle: .normal() has been renamed to .getNormal()."),q.getNormal(t,e,n,i)}}),Object.assign(ti.prototype,{extractAllPoints:function(t){return console.warn("THREE.Shape: .extractAllPoints() has been removed. Use .extractPoints() instead."),this.extractPoints(t)},extrude:function(t){return console.warn("THREE.Shape: .extrude() has been removed. Use ExtrudeGeometry() instead."),new tn(this,t)},makeGeometry:function(t){return console.warn("THREE.Shape: .makeGeometry() has been removed. Use ShapeGeometry() instead."),new un(this,t)}}),Object.assign(n.prototype,{fromAttribute:function(t,e,n){return console.warn("THREE.Vector2: .fromAttribute() has been renamed to .fromBufferAttribute()."),this.fromBufferAttribute(t,e,n)},distanceToManhattan:function(t){return console.warn("THREE.Vector2: .distanceToManhattan() has been renamed to .manhattanDistanceTo()."),this.manhattanDistanceTo(t)},lengthManhattan:function(){return console.warn("THREE.Vector2: .lengthManhattan() has been renamed to .manhattanLength()."),this.manhattanLength()}}),Object.assign(o.prototype,{setEulerFromRotationMatrix:function(){console.error("THREE.Vector3: .setEulerFromRotationMatrix() has been removed. Use Euler.setFromRotationMatrix() instead.")},setEulerFromQuaternion:function(){console.error("THREE.Vector3: .setEulerFromQuaternion() has been removed. Use Euler.setFromQuaternion() instead.")},getPositionFromMatrix:function(t){return console.warn("THREE.Vector3: .getPositionFromMatrix() has been renamed to .setFromMatrixPosition()."),this.setFromMatrixPosition(t)},getScaleFromMatrix:function(t){return console.warn("THREE.Vector3: .getScaleFromMatrix() has been renamed to .setFromMatrixScale()."),this.setFromMatrixScale(t)},getColumnFromMatrix:function(t,e){return console.warn("THREE.Vector3: .getColumnFromMatrix() has been renamed to .setFromMatrixColumn()."),this.setFromMatrixColumn(e,t)},applyProjection:function(t){return console.warn("THREE.Vector3: .applyProjection() has been removed. Use .applyMatrix4( m ) instead."),this.applyMatrix4(t)},fromAttribute:function(t,e,n){return console.warn("THREE.Vector3: .fromAttribute() has been renamed to .fromBufferAttribute()."),this.fromBufferAttribute(t,e,n)},distanceToManhattan:function(t){return console.warn("THREE.Vector3: .distanceToManhattan() has been renamed to .manhattanDistanceTo()."),this.manhattanDistanceTo(t)},lengthManhattan:function(){return console.warn("THREE.Vector3: .lengthManhattan() has been renamed to .manhattanLength()."),this.manhattanLength()}}),Object.assign(c.prototype,{fromAttribute:function(t,e,n){return console.warn("THREE.Vector4: .fromAttribute() has been renamed to .fromBufferAttribute()."),this.fromBufferAttribute(t,e,n)},lengthManhattan:function(){return console.warn("THREE.Vector4: .lengthManhattan() has been renamed to .manhattanLength()."),this.manhattanLength()}}),Object.assign(E.prototype,{computeTangents:function(){console.error("THREE.Geometry: .computeTangents() has been removed.")},computeLineDistances:function(){console.error("THREE.Geometry: .computeLineDistances() has been removed. Use THREE.Line.computeLineDistances() instead.")}}),Object.assign(b.prototype,{getChildByName:function(t){return console.warn("THREE.Object3D: .getChildByName() has been renamed to .getObjectByName()."),this.getObjectByName(t)},renderDepth:function(){console.warn("THREE.Object3D: .renderDepth has been removed. Use .renderOrder, instead.")},translate:function(t,e){return console.warn("THREE.Object3D: .translate() has been removed. Use .translateOnAxis( axis, distance ) instead."),this.translateOnAxis(e,t)},getWorldRotation:function(){console.error("THREE.Object3D: .getWorldRotation() has been removed. Use THREE.Object3D.getWorldQuaternion( target ) instead.")}}),Object.defineProperties(b.prototype,{eulerOrder:{get:function(){return console.warn("THREE.Object3D: .eulerOrder is now .rotation.order."),this.rotation.order},set:function(t){console.warn("THREE.Object3D: .eulerOrder is now .rotation.order."),this.rotation.order=t}},useQuaternion:{get:function(){console.warn("THREE.Object3D: .useQuaternion has been removed. The library now uses quaternions by default.")},set:function(){console.warn("THREE.Object3D: .useQuaternion has been removed. The library now uses quaternions by default.")}}}),Object.defineProperties(re.prototype,{objects:{get:function(){return console.warn("THREE.LOD: .objects has been renamed to .levels."),this.levels}}}),Object.defineProperty(oe.prototype,"useVertexTexture",{get:function(){console.warn("THREE.Skeleton: useVertexTexture has been removed.")},set:function(){console.warn("THREE.Skeleton: useVertexTexture has been removed.")}}),Object.defineProperty(Bn.prototype,"__arcLengthDivisions",{get:function(){return console.warn("THREE.Curve: .__arcLengthDivisions is now .arcLengthDivisions."),this.arcLengthDivisions},set:function(t){console.warn("THREE.Curve: .__arcLengthDivisions is now .arcLengthDivisions."),this.arcLengthDivisions=t}}),Zt.prototype.setLens=function(t,e){console.warn("THREE.PerspectiveCamera.setLens is deprecated. Use .setFocalLength and .filmGauge for a photographic setup."),void 0!==e&&(this.filmGauge=e),this.setFocalLength(t)},Object.defineProperties(ei.prototype,{onlyShadow:{set:function(){console.warn("THREE.Light: .onlyShadow has been removed.")}},shadowCameraFov:{set:function(t){console.warn("THREE.Light: .shadowCameraFov is now .shadow.camera.fov."),this.shadow.camera.fov=t}},shadowCameraLeft:{set:function(t){console.warn("THREE.Light: .shadowCameraLeft is now .shadow.camera.left."),this.shadow.camera.left=t}},shadowCameraRight:{set:function(t){console.warn("THREE.Light: .shadowCameraRight is now .shadow.camera.right."),this.shadow.camera.right=t}},shadowCameraTop:{set:function(t){console.warn("THREE.Light: .shadowCameraTop is now .shadow.camera.top."),this.shadow.camera.top=t}},shadowCameraBottom:{set:function(t){console.warn("THREE.Light: .shadowCameraBottom is now .shadow.camera.bottom."),this.shadow.camera.bottom=t}},shadowCameraNear:{set:function(t){console.warn("THREE.Light: .shadowCameraNear is now .shadow.camera.near."),this.shadow.camera.near=t}},shadowCameraFar:{set:function(t){console.warn("THREE.Light: .shadowCameraFar is now .shadow.camera.far."),this.shadow.camera.far=t}},shadowCameraVisible:{set:function(){console.warn("THREE.Light: .shadowCameraVisible has been removed. Use new THREE.CameraHelper( light.shadow.camera ) instead.")}},shadowBias:{set:function(t){console.warn("THREE.Light: .shadowBias is now .shadow.bias."),this.shadow.bias=t}},shadowDarkness:{set:function(){console.warn("THREE.Light: .shadowDarkness has been removed.")}},shadowMapWidth:{set:function(t){console.warn("THREE.Light: .shadowMapWidth is now .shadow.mapSize.width."),this.shadow.mapSize.width=t}},shadowMapHeight:{set:function(t){console.warn("THREE.Light: .shadowMapHeight is now .shadow.mapSize.height."),this.shadow.mapSize.height=t}}}),Object.defineProperties(T.prototype,{length:{get:function(){return console.warn("THREE.BufferAttribute: .length has been deprecated. Use .count instead."),this.array.length}},copyIndicesArray:function(){console.error("THREE.BufferAttribute: .copyIndicesArray() has been removed.")}}),Object.assign(B.prototype,{addIndex:function(t){console.warn("THREE.BufferGeometry: .addIndex() has been renamed to .setIndex()."),this.setIndex(t)},addDrawCall:function(t,e,n){void 0!==n&&console.warn("THREE.BufferGeometry: .addDrawCall() no longer supports indexOffset."),console.warn("THREE.BufferGeometry: .addDrawCall() is now .addGroup()."),this.addGroup(t,e)},clearDrawCalls:function(){console.warn("THREE.BufferGeometry: .clearDrawCalls() is now .clearGroups()."),this.clearGroups()},computeTangents:function(){console.warn("THREE.BufferGeometry: .computeTangents() has been removed.")},computeOffsets:function(){console.warn("THREE.BufferGeometry: .computeOffsets() has been removed.")}}),Object.defineProperties(B.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.assign(en.prototype,{getArrays:function(){console.error("THREE.ExtrudeBufferGeometry: .getArrays() has been removed.")},addShapeList:function(){console.error("THREE.ExtrudeBufferGeometry: .addShapeList() has been removed.")},addShape:function(){console.error("THREE.ExtrudeBufferGeometry: .addShape() has been removed.")}}),Object.defineProperties(Xi.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(k.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 g}},shading:{get:function(){console.error("THREE."+this.type+": .shading has been removed. Use the boolean .flatShading instead.")},set:function(t){console.warn("THREE."+this.type+": .shading has been removed. Use the boolean .flatShading instead."),this.flatShading=1===t}}}),Object.defineProperties(Tn.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(j.prototype,{derivatives:{get:function(){return console.warn("THREE.ShaderMaterial: .derivatives has been moved to .extensions.derivatives."),this.extensions.derivatives},set:function(t){console.warn("THREE. ShaderMaterial: .derivatives has been moved to .extensions.derivatives."),this.extensions.derivatives=t}}}),Object.assign(Kt.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(t){console.warn("THREE.WebGLRenderer: .enableScissorTest() is now .setScissorTest()."),this.setScissorTest(t)},initMaterial:function(){console.warn("THREE.WebGLRenderer: .initMaterial() has been removed.")},addPrePlugin:function(){console.warn("THREE.WebGLRenderer: .addPrePlugin() has been removed.")},addPostPlugin:function(){console.warn("THREE.WebGLRenderer: .addPostPlugin() has been removed.")},updateShadowMap:function(){console.warn("THREE.WebGLRenderer: .updateShadowMap() has been removed.")},setFaceCulling:function(){console.warn("THREE.WebGLRenderer: .setFaceCulling() has been removed.")}}),Object.defineProperties(Kt.prototype,{shadowMapEnabled:{get:function(){return this.shadowMap.enabled},set:function(t){console.warn("THREE.WebGLRenderer: .shadowMapEnabled is now .shadowMap.enabled."),this.shadowMap.enabled=t}},shadowMapType:{get:function(){return this.shadowMap.type},set:function(t){console.warn("THREE.WebGLRenderer: .shadowMapType is now .shadowMap.type."),this.shadowMap.type=t}},shadowMapCullFace:{get:function(){console.warn("THREE.WebGLRenderer: .shadowMapCullFace has been removed. Set Material.shadowSide instead.")},set:function(){console.warn("THREE.WebGLRenderer: .shadowMapCullFace has been removed. Set Material.shadowSide instead.")}}}),Object.defineProperties(Wt.prototype,{cullFace:{get:function(){console.warn("THREE.WebGLRenderer: .shadowMap.cullFace has been removed. Set Material.shadowSide instead.")},set:function(){console.warn("THREE.WebGLRenderer: .shadowMap.cullFace has been removed. Set Material.shadowSide instead.")}},renderReverseSided:{get:function(){console.warn("THREE.WebGLRenderer: .shadowMap.renderReverseSided has been removed. Set Material.shadowSide instead.")},set:function(){console.warn("THREE.WebGLRenderer: .shadowMap.renderReverseSided has been removed. Set Material.shadowSide instead.")}},renderSingleSided:{get:function(){console.warn("THREE.WebGLRenderer: .shadowMap.renderSingleSided has been removed. Set Material.shadowSide instead.")},set:function(){console.warn("THREE.WebGLRenderer: .shadowMap.renderSingleSided has been removed. Set Material.shadowSide instead.")}}}),Object.defineProperties(h.prototype,{wrapS:{get:function(){return console.warn("THREE.WebGLRenderTarget: .wrapS is now .texture.wrapS."),this.texture.wrapS},set:function(t){console.warn("THREE.WebGLRenderTarget: .wrapS is now .texture.wrapS."),this.texture.wrapS=t}},wrapT:{get:function(){return console.warn("THREE.WebGLRenderTarget: .wrapT is now .texture.wrapT."),this.texture.wrapT},set:function(t){console.warn("THREE.WebGLRenderTarget: .wrapT is now .texture.wrapT."),this.texture.wrapT=t}},magFilter:{get:function(){return console.warn("THREE.WebGLRenderTarget: .magFilter is now .texture.magFilter."),this.texture.magFilter},set:function(t){console.warn("THREE.WebGLRenderTarget: .magFilter is now .texture.magFilter."),this.texture.magFilter=t}},minFilter:{get:function(){return console.warn("THREE.WebGLRenderTarget: .minFilter is now .texture.minFilter."),this.texture.minFilter},set:function(t){console.warn("THREE.WebGLRenderTarget: .minFilter is now .texture.minFilter."),this.texture.minFilter=t}},anisotropy:{get:function(){return console.warn("THREE.WebGLRenderTarget: .anisotropy is now .texture.anisotropy."),this.texture.anisotropy},set:function(t){console.warn("THREE.WebGLRenderTarget: .anisotropy is now .texture.anisotropy."),this.texture.anisotropy=t}},offset:{get:function(){return console.warn("THREE.WebGLRenderTarget: .offset is now .texture.offset."),this.texture.offset},set:function(t){console.warn("THREE.WebGLRenderTarget: .offset is now .texture.offset."),this.texture.offset=t}},repeat:{get:function(){return console.warn("THREE.WebGLRenderTarget: .repeat is now .texture.repeat."),this.texture.repeat},set:function(t){console.warn("THREE.WebGLRenderTarget: .repeat is now .texture.repeat."),this.texture.repeat=t}},format:{get:function(){return console.warn("THREE.WebGLRenderTarget: .format is now .texture.format."),this.texture.format},set:function(t){console.warn("THREE.WebGLRenderTarget: .format is now .texture.format."),this.texture.format=t}},type:{get:function(){return console.warn("THREE.WebGLRenderTarget: .type is now .texture.type."),this.texture.type},set:function(t){console.warn("THREE.WebGLRenderTarget: .type is now .texture.type."),this.texture.type=t}},generateMipmaps:{get:function(){return console.warn("THREE.WebGLRenderTarget: .generateMipmaps is now .texture.generateMipmaps."),this.texture.generateMipmaps},set:function(t){console.warn("THREE.WebGLRenderTarget: .generateMipmaps is now .texture.generateMipmaps."),this.texture.generateMipmaps=t}}}),Object.defineProperties(Qt.prototype,{standing:{set:function(){console.warn("THREE.WebVRManager: .standing has been removed.")}}}),Bi.prototype.load=function(t){console.warn("THREE.Audio: .load has been deprecated. Use THREE.AudioLoader instead.");var e=this;return(new Ii).load(t,function(t){e.setBuffer(t)}),this},zi.prototype.getData=function(){return console.warn("THREE.AudioAnalyser: .getData() is now .getFrequencyData()."),this.getFrequencyData()},Ui.prototype.updateCubeMap=function(t,e){return console.warn("THREE.CubeCamera: .updateCubeMap() is now .update()."),this.update(t,e)},t.WebGLRenderTargetCube=l,t.WebGLRenderTarget=h,t.WebGLRenderer=Kt,t.ShaderLib=Ir,t.UniformsLib=Or,t.UniformsUtils=Pr,t.ShaderChunk=Lr,t.FogExp2=$t,t.Fog=te,t.Scene=ee,t.Sprite=ie,t.LOD=re,t.SkinnedMesh=se,t.Skeleton=oe,t.Bone=ae,t.Mesh=Y,t.LineSegments=le,t.LineLoop=ue,t.Line=he,t.Points=de,t.Group=fe,t.VideoTexture=me,t.DataTexture=u,t.CompressedTexture=ge,t.CubeTexture=$,t.CanvasTexture=Xt,t.DepthTexture=ve,t.Texture=s,t.CompressedTextureLoader=On,t.DataTextureLoader=In,t.CubeTextureLoader=Un,t.TextureLoader=Dn,t.ObjectLoader=Ri,t.MaterialLoader=Ei,t.BufferGeometryLoader=Ti,t.DefaultLoadingManager=$r,t.LoadingManager=Pn,t.JSONLoader=Ai,t.ImageLoader=Nn,t.ImageBitmapLoader=Li,t.FontLoader=Oi,t.FileLoader=Cn,t.Loader=Si,t.LoaderUtils=co,t.Cache=Kr,t.AudioLoader=Ii,t.SpotLightShadow=ri,t.SpotLight=oi,t.PointLight=ai,t.RectAreaLight=li,t.HemisphereLight=ni,t.DirectionalLightShadow=si,t.DirectionalLight=ci,t.AmbientLight=hi,t.LightShadow=ii,t.Light=ei,t.StereoCamera=Ni,t.PerspectiveCamera=Zt,t.OrthographicCamera=_,t.CubeCamera=Ui,t.ArrayCamera=Jt,t.Camera=w,t.AudioListener=Di,t.PositionalAudio=Fi,t.AudioContext=go,t.AudioAnalyser=zi,t.Audio=Bi,t.VectorKeyframeTrack=_i,t.StringKeyframeTrack=ui,t.QuaternionKeyframeTrack=mi,t.NumberKeyframeTrack=vi,t.ColorKeyframeTrack=gi,t.BooleanKeyframeTrack=pi,t.PropertyMixer=Hi,t.PropertyBinding=ki,t.KeyframeTrack=wi,t.AnimationUtils=ao,t.AnimationObjectGroup=Vi,t.AnimationMixer=Wi,t.AnimationClip=Mi,t.Uniform=Xi,t.InstancedBufferGeometry=qi,t.BufferGeometry=B,t.Geometry=E,t.InterleavedBufferAttribute=Yi,t.InstancedInterleavedBuffer=Ji,t.InterleavedBuffer=Zi,t.InstancedBufferAttribute=Qi,t.Face3=M,t.Object3D=b,t.Raycaster=Ki,t.Layers=x,t.EventDispatcher=e,t.Clock=er,t.QuaternionLinearInterpolant=fi,t.LinearInterpolant=xi,t.DiscreteInterpolant=bi,t.CubicInterpolant=yi,t.Interpolant=di,t.Triangle=q,t.Math=Ar,t.Spherical=nr,t.Cylindrical=ir,t.Plane=f,t.Frustum=m,t.Sphere=d,t.Ray=W,t.Matrix4=i,t.Matrix3=a,t.Box3=p,t.Box2=rr,t.Line3=X,t.Euler=y,t.Vector4=c,t.Vector3=o,t.Vector2=n,t.Quaternion=r,t.Color=g,t.ImmediateRenderObject=or,t.VertexNormalsHelper=ar,t.SpotLightHelper=sr,t.SkeletonHelper=cr,t.PointLightHelper=hr,t.RectAreaLightHelper=lr,t.HemisphereLightHelper=ur,t.GridHelper=pr,t.PolarGridHelper=dr,t.FaceNormalsHelper=fr,t.DirectionalLightHelper=mr,t.CameraHelper=gr,t.BoxHelper=vr,t.Box3Helper=yr,t.PlaneHelper=xr,t.ArrowHelper=br,t.AxesHelper=wr,t.Shape=ti,t.Path=$n,t.ShapePath=Pi,t.Font=Ci,t.CurvePath=Kn,t.Curve=Bn,t.ShapeUtils=Yr,t.WebGLUtils=Yt,t.WireframeGeometry=ye,t.ParametricGeometry=xe,t.ParametricBufferGeometry=be,t.TetrahedronGeometry=Me,t.TetrahedronBufferGeometry=Ee,t.OctahedronGeometry=Te,t.OctahedronBufferGeometry=Se,t.IcosahedronGeometry=Ae,t.IcosahedronBufferGeometry=Re,t.DodecahedronGeometry=Le,t.DodecahedronBufferGeometry=Pe,t.PolyhedronGeometry=we,t.PolyhedronBufferGeometry=_e,t.TubeGeometry=Ce,t.TubeBufferGeometry=Oe,t.TorusKnotGeometry=Ie,t.TorusKnotBufferGeometry=Ne,t.TorusGeometry=Ue,t.TorusBufferGeometry=De,t.TextGeometry=nn,t.TextBufferGeometry=rn,t.SphereGeometry=on,t.SphereBufferGeometry=an,t.RingGeometry=sn,t.RingBufferGeometry=cn,t.PlaneGeometry=H,t.PlaneBufferGeometry=G,t.LatheGeometry=hn,t.LatheBufferGeometry=ln,t.ShapeGeometry=un,t.ShapeBufferGeometry=pn,t.ExtrudeGeometry=tn,t.ExtrudeBufferGeometry=en,t.EdgesGeometry=fn,t.ConeGeometry=vn,t.ConeBufferGeometry=yn,t.CylinderGeometry=mn,t.CylinderBufferGeometry=gn,t.CircleGeometry=xn,t.CircleBufferGeometry=bn,t.BoxGeometry=F,t.BoxBufferGeometry=z,t.ShadowMaterial=wn,t.SpriteMaterial=ne,t.RawShaderMaterial=_n,t.ShaderMaterial=j,t.PointsMaterial=pe,t.MeshPhysicalMaterial=En,t.MeshStandardMaterial=Mn,t.MeshPhongMaterial=Tn,t.MeshToonMaterial=Sn,t.MeshNormalMaterial=An,t.MeshLambertMaterial=Rn,t.MeshDepthMaterial=Vt,t.MeshDistanceMaterial=jt,t.MeshBasicMaterial=V,t.LineDashedMaterial=Ln,t.LineBasicMaterial=ce,t.Material=k,t.Float64BufferAttribute=N,t.Float32BufferAttribute=I,t.Uint32BufferAttribute=O,t.Int32BufferAttribute=C,t.Uint16BufferAttribute=P,t.Int16BufferAttribute=L,t.Uint8ClampedBufferAttribute=R,t.Uint8BufferAttribute=A,t.Int8BufferAttribute=S,t.BufferAttribute=T,t.ArcCurve=zn,t.CatmullRomCurve3=Gn,t.CubicBezierCurve=Wn,t.CubicBezierCurve3=Xn,t.EllipseCurve=Fn,t.LineCurve=qn,t.LineCurve3=Yn,t.QuadraticBezierCurve=Zn,t.QuadraticBezierCurve3=Jn,t.SplineCurve=Qn,t.REVISION="92",t.MOUSE={LEFT:0,MIDDLE:1,RIGHT:2},t.CullFaceNone=0,t.CullFaceBack=1,t.CullFaceFront=2,t.CullFaceFrontBack=3,t.FrontFaceDirectionCW=0,t.FrontFaceDirectionCCW=1,t.BasicShadowMap=0,t.PCFShadowMap=1,t.PCFSoftShadowMap=2,t.FrontSide=0,t.BackSide=1,t.DoubleSide=2,t.FlatShading=1,t.SmoothShading=2,t.NoColors=0,t.FaceColors=1,t.VertexColors=2,t.NoBlending=0,t.NormalBlending=1,t.AdditiveBlending=2,t.SubtractiveBlending=3,t.MultiplyBlending=4,t.CustomBlending=5,t.AddEquation=100,t.SubtractEquation=101,t.ReverseSubtractEquation=102,t.MinEquation=103,t.MaxEquation=104,t.ZeroFactor=200,t.OneFactor=201,t.SrcColorFactor=202,t.OneMinusSrcColorFactor=203,t.SrcAlphaFactor=204,t.OneMinusSrcAlphaFactor=205,t.DstAlphaFactor=206,t.OneMinusDstAlphaFactor=207,t.DstColorFactor=208,t.OneMinusDstColorFactor=209,t.SrcAlphaSaturateFactor=210,t.NeverDepth=0,t.AlwaysDepth=1,t.LessDepth=2,t.LessEqualDepth=3,t.EqualDepth=4,t.GreaterEqualDepth=5,t.GreaterDepth=6,t.NotEqualDepth=7,t.MultiplyOperation=0,t.MixOperation=1,t.AddOperation=2,t.NoToneMapping=0,t.LinearToneMapping=1,t.ReinhardToneMapping=2,t.Uncharted2ToneMapping=3,t.CineonToneMapping=4,t.UVMapping=300,t.CubeReflectionMapping=301,t.CubeRefractionMapping=302,t.EquirectangularReflectionMapping=303,t.EquirectangularRefractionMapping=304,t.SphericalReflectionMapping=305,t.CubeUVReflectionMapping=306,t.CubeUVRefractionMapping=307,t.RepeatWrapping=1e3,t.ClampToEdgeWrapping=1001,t.MirroredRepeatWrapping=1002,t.NearestFilter=1003,t.NearestMipMapNearestFilter=1004,t.NearestMipMapLinearFilter=1005,t.LinearFilter=1006,t.LinearMipMapNearestFilter=1007,t.LinearMipMapLinearFilter=1008,t.UnsignedByteType=1009,t.ByteType=1010,t.ShortType=1011,t.UnsignedShortType=1012,t.IntType=1013,t.UnsignedIntType=1014,t.FloatType=1015,t.HalfFloatType=1016,t.UnsignedShort4444Type=1017,t.UnsignedShort5551Type=1018,t.UnsignedShort565Type=1019,t.UnsignedInt248Type=1020,t.AlphaFormat=1021,t.RGBFormat=1022,t.RGBAFormat=1023,t.LuminanceFormat=1024,t.LuminanceAlphaFormat=1025,t.RGBEFormat=1023,t.DepthFormat=1026,t.DepthStencilFormat=1027,t.RGB_S3TC_DXT1_Format=33776,t.RGBA_S3TC_DXT1_Format=33777,t.RGBA_S3TC_DXT3_Format=33778,t.RGBA_S3TC_DXT5_Format=33779,t.RGB_PVRTC_4BPPV1_Format=35840,t.RGB_PVRTC_2BPPV1_Format=35841,t.RGBA_PVRTC_4BPPV1_Format=35842,t.RGBA_PVRTC_2BPPV1_Format=35843,t.RGB_ETC1_Format=36196,t.RGBA_ASTC_4x4_Format=37808,t.RGBA_ASTC_5x4_Format=37809,t.RGBA_ASTC_5x5_Format=37810,t.RGBA_ASTC_6x5_Format=37811,t.RGBA_ASTC_6x6_Format=37812,t.RGBA_ASTC_8x5_Format=37813,t.RGBA_ASTC_8x6_Format=37814,t.RGBA_ASTC_8x8_Format=37815,t.RGBA_ASTC_10x5_Format=37816,t.RGBA_ASTC_10x6_Format=37817,t.RGBA_ASTC_10x8_Format=37818,t.RGBA_ASTC_10x10_Format=37819,t.RGBA_ASTC_12x10_Format=37820,t.RGBA_ASTC_12x12_Format=37821,t.LoopOnce=2200,t.LoopRepeat=2201,t.LoopPingPong=2202,t.InterpolateDiscrete=2300,t.InterpolateLinear=2301,t.InterpolateSmooth=2302,t.ZeroCurvatureEnding=2400,t.ZeroSlopeEnding=2401,t.WrapAroundEnding=2402,t.TrianglesDrawMode=0,t.TriangleStripDrawMode=1,t.TriangleFanDrawMode=2,t.LinearEncoding=3e3,t.sRGBEncoding=3001,t.GammaEncoding=3007,t.RGBEEncoding=3002,t.LogLuvEncoding=3003,t.RGBM7Encoding=3004,t.RGBM16Encoding=3005,t.RGBDEncoding=3006,t.BasicDepthPacking=3200,t.RGBADepthPacking=3201,t.CubeGeometry=F,t.Face4=function(t,e,n,i,r,o,a){return console.warn("THREE.Face4 has been removed. A THREE.Face3 will be created instead."),new M(t,e,n,r,o,a)},t.LineStrip=0,t.LinePieces=1,t.MeshFaceMaterial=function(t){return console.warn("THREE.MeshFaceMaterial has been removed. Use an Array instead."),t},t.MultiMaterial=function(t){return void 0===t&&(t=[]),console.warn("THREE.MultiMaterial has been removed. Use an Array instead."),t.isMultiMaterial=!0,t.materials=t,t.clone=function(){return t.slice()},t},t.PointCloud=function(t,e){return console.warn("THREE.PointCloud has been renamed to THREE.Points."),new de(t,e)},t.Particle=function(t){return console.warn("THREE.Particle has been renamed to THREE.Sprite."),new ie(t)},t.ParticleSystem=function(t,e){return console.warn("THREE.ParticleSystem has been renamed to THREE.Points."),new de(t,e)},t.PointCloudMaterial=function(t){return console.warn("THREE.PointCloudMaterial has been renamed to THREE.PointsMaterial."),new pe(t)},t.ParticleBasicMaterial=function(t){return console.warn("THREE.ParticleBasicMaterial has been renamed to THREE.PointsMaterial."),new pe(t)},t.ParticleSystemMaterial=function(t){return console.warn("THREE.ParticleSystemMaterial has been renamed to THREE.PointsMaterial."),new pe(t)},t.Vertex=function(t,e,n){return console.warn("THREE.Vertex has been removed. Use THREE.Vector3 instead."),new o(t,e,n)},t.DynamicBufferAttribute=function(t,e){return console.warn("THREE.DynamicBufferAttribute has been removed. Use new THREE.BufferAttribute().setDynamic( true ) instead."),new T(t,e).setDynamic(!0)},t.Int8Attribute=function(t,e){return console.warn("THREE.Int8Attribute has been removed. Use new THREE.Int8BufferAttribute() instead."),new S(t,e)},t.Uint8Attribute=function(t,e){return console.warn("THREE.Uint8Attribute has been removed. Use new THREE.Uint8BufferAttribute() instead."),new A(t,e)},t.Uint8ClampedAttribute=function(t,e){return console.warn("THREE.Uint8ClampedAttribute has been removed. Use new THREE.Uint8ClampedBufferAttribute() instead."),new R(t,e)},t.Int16Attribute=function(t,e){return console.warn("THREE.Int16Attribute has been removed. Use new THREE.Int16BufferAttribute() instead."),new L(t,e)},t.Uint16Attribute=function(t,e){return console.warn("THREE.Uint16Attribute has been removed. Use new THREE.Uint16BufferAttribute() instead."),new P(t,e)},t.Int32Attribute=function(t,e){return console.warn("THREE.Int32Attribute has been removed. Use new THREE.Int32BufferAttribute() instead."),new C(t,e)},t.Uint32Attribute=function(t,e){return console.warn("THREE.Uint32Attribute has been removed. Use new THREE.Uint32BufferAttribute() instead."),new O(t,e)},t.Float32Attribute=function(t,e){return console.warn("THREE.Float32Attribute has been removed. Use new THREE.Float32BufferAttribute() instead."),new I(t,e)},t.Float64Attribute=function(t,e){return console.warn("THREE.Float64Attribute has been removed. Use new THREE.Float64BufferAttribute() instead."),new N(t,e)},t.ClosedSplineCurve3=_r,t.SplineCurve3=Mr,t.Spline=Er,t.AxisHelper=function(t){return console.warn("THREE.AxisHelper has been renamed to THREE.AxesHelper."),new wr(t)},t.BoundingBoxHelper=function(t,e){return console.warn("THREE.BoundingBoxHelper has been deprecated. Creating a THREE.BoxHelper instead."),new vr(t,e)},t.EdgesHelper=function(t,e){return console.warn("THREE.EdgesHelper has been removed. Use THREE.EdgesGeometry instead."),new le(new fn(t.geometry),new ce({color:void 0!==e?e:16777215}))},t.WireframeHelper=function(t,e){return console.warn("THREE.WireframeHelper has been removed. Use THREE.WireframeGeometry instead."),new le(new ye(t.geometry),new ce({color:void 0!==e?e:16777215}))},t.XHRLoader=function(t){return console.warn("THREE.XHRLoader has been renamed to THREE.FileLoader."),new Cn(t)},t.BinaryTextureLoader=function(t){return console.warn("THREE.BinaryTextureLoader has been renamed to THREE.DataTextureLoader."),new In(t)},t.GeometryUtils={merge:function(t,e,n){if(console.warn("THREE.GeometryUtils: .merge() has been moved to Geometry. Use geometry.merge( geometry2, matrix, materialIndexOffset ) instead."),e.isMesh){e.matrixAutoUpdate&&e.updateMatrix();var i=e.matrix;e=e.geometry}t.merge(e,i,n)},center:function(t){return console.warn("THREE.GeometryUtils: .center() has been moved to Geometry. Use geometry.center() instead."),t.center()}},t.ImageUtils={crossOrigin:void 0,loadTexture:function(t,e,n,i){console.warn("THREE.ImageUtils.loadTexture has been deprecated. Use THREE.TextureLoader() instead.");var r=new Dn;return r.setCrossOrigin(this.crossOrigin),t=r.load(t,n,void 0,i),e&&(t.mapping=e),t},loadTextureCube:function(t,e,n,i){console.warn("THREE.ImageUtils.loadTextureCube has been deprecated. Use THREE.CubeTextureLoader() instead.");var r=new Un;return r.setCrossOrigin(this.crossOrigin),t=r.load(t,n,void 0,i),e&&(t.mapping=e),t},loadCompressedTexture:function(){console.error("THREE.ImageUtils.loadCompressedTexture has been removed. Use THREE.DDSLoader instead.")},loadCompressedTextureCube:function(){console.error("THREE.ImageUtils.loadCompressedTextureCube has been removed. Use THREE.DDSLoader instead.")}},t.Projector=function(){console.error("THREE.Projector has been moved to /examples/js/renderers/Projector.js."),this.projectVector=function(t,e){console.warn("THREE.Projector: .projectVector() is now vector.project()."),t.project(e)},this.unprojectVector=function(t,e){console.warn("THREE.Projector: .unprojectVector() is now vector.unproject()."),t.unproject(e)},this.pickingRay=function(){console.error("THREE.Projector: .pickingRay() is now raycaster.setFromCamera().")}},t.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(){}},t.SceneUtils={createMultiMaterialObject:function(){console.error("THREE.SceneUtils has been moved to /examples/js/utils/SceneUtils.js")},detach:function(){console.error("THREE.SceneUtils has been moved to /examples/js/utils/SceneUtils.js")},attach:function(){console.error("THREE.SceneUtils has been moved to /examples/js/utils/SceneUtils.js")}},t.LensFlare=function(){console.error("THREE.LensFlare has been moved to /examples/js/objects/Lensflare.js")},Object.defineProperty(t,"__esModule",{value:!0})}),function(t){var e={};function n(i){if(e[i])return e[i].exports;var r=e[i]={i:i,l:!1,exports:{}};return t[i].call(r.exports,r,r.exports,n),r.l=!0,r.exports}n.m=t,n.c=e,n.d=function(t,e,i){n.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:i})},n.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},n.t=function(t,e){if(1&e&&(t=n(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var i=Object.create(null);if(n.r(i),Object.defineProperty(i,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var r in t)n.d(i,r,function(e){return t[e]}.bind(null,r));return i},n.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return n.d(e,"a",e),e},n.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},n.p="",n(n.s=15)}({0:function(t,e,n){"use strict";function i(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n]);return t}function r(){return/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent)||window.innerWidth<600}n.d(e,"c",function(){return i}),n.d(e,"d",function(){return r}),n.d(e,"h",function(){return o}),n.d(e,"g",function(){return a}),n.d(e,"f",function(){return s}),n.d(e,"e",function(){return c}),n.d(e,"a",function(){return h}),n.d(e,"b",function(){return l}),Number.prototype.clamp=function(t,e){return Math.min(Math.max(this,t),e)};const o=t=>t[Math.floor(Math.random()*t.length)];function a(t,e){return null==t&&(t=0),null==e&&(e=1),t+Math.random()*(e-t)}function s(t,e){return null==t&&(t=0),null==e&&(e=1),Math.floor(t+Math.random()*(e-t+1))}var c=t=>document.querySelector(t);const h=t=>"number"==typeof t?"#"+("00000"+t.toString(16)).slice(-6):t,l=(t,e=1)=>{const n=h(t),i=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(n),r=i?{r:parseInt(i[1],16),g:parseInt(i[2],16),b:parseInt(i[3],16)}:null;return"rgba("+r.r+","+r.g+","+r.b+","+e+")"}},1:function(t,e,n){"use strict";n.d(e,"a",function(){return r});var i=n(0);window&&!window.VANTA&&(window.VANTA={version:"0.3.1"});const r=window.VANTA||{};r.register||(r.register=((t,e)=>{r[t]=(t=>new e(t))}));var o=function(){return Array.prototype.unshift.call(arguments,"[VANTA]"),console.error.apply(this,arguments)};r.VantaBase=class{constructor(t={}){var e,n,a,s;if(r.current=this,this.onMouseMoveWrapper=this.onMouseMoveWrapper.bind(this),this.resize=this.resize.bind(this),this.animationLoop=this.animationLoop.bind(this),this.restart=this.restart.bind(this),this.options=Object(i.c)({},this.defaultOptions),t instanceof HTMLElement||"string"==typeof t?Object(i.c)(this.options,{el:t}):Object(i.c)(this.options,t),this.el=this.options.el,null==this.el)o('Instance needs "el" param!');else if(!(this.options.el instanceof HTMLElement||(s=this.el,this.el=Object(i.e)(s),this.el)))return void o("Cannot find element",s);for(a=0;a<this.el.children.length;a++)e=this.el.children[a],"static"===getComputedStyle(e).position&&(e.style.position="relative"),"auto"===getComputedStyle(e).zIndex&&(e.style.zIndex=1);"static"===getComputedStyle(this.el).position&&(this.el.style.position="relative"),"object"==typeof THREE&&this.initThree(),this.setSize(),this.uniforms={u_time:{type:"f",value:1},u_resolution:{type:"v2",value:new THREE.Vector2(1,1)},u_mouse:{type:"v2",value:new THREE.Vector2(0,0)}};try{this.init()}catch(t){return n=t,o("Init error"),o(n),this.el.removeChild(this.renderer.domElement),void(this.options.backgroundColor&&(console.log("[VANTA] Falling back to backgroundColor"),this.el.style.background=this.color2Hex(this.options.backgroundColor)))}window.addEventListener("resize",this.resize),this.resize(),this.animationLoop(),this.el.addEventListener("mousemove",this.onMouseMoveWrapper,!1),window.addEventListener("scroll",this.onMouseMoveWrapper)}applyCanvasStyles(t,e={}){Object(i.c)(t.style,{position:"absolute",zIndex:0,top:0,left:0,background:""}),Object(i.c)(t.style,e),t.classList.add("vanta-canvas")}initThree(){this.renderer=new THREE.WebGLRenderer({alpha:!0,antialias:!0}),this.el.appendChild(this.renderer.domElement),this.applyCanvasStyles(this.renderer.domElement),isNaN(this.options.backgroundAlpha)&&(this.options.backgroundAlpha=1),this.scene=new THREE.Scene}onMouseMoveWrapper(t){var e,n,i;e=this.renderer.domElement.getBoundingClientRect(),n=this.mouseX=t.clientX-e.left,i=this.mouseY=t.clientY-e.top,n>=0&&i>=0&&!this.options.mouseEase&&this.triggerMouseMove(n,i)}triggerMouseMove(t,e){this.uniforms&&(this.uniforms.u_mouse.value.x=t/this.scale,this.uniforms.u_mouse.value.y=e/this.scale);const n=t/this.width,i=e/this.height;"function"==typeof this.onMouseMove&&this.onMouseMove(n,i)}setSize(){this.scale||(this.scale=1),Object(i.d)()&&this.options.scaleMobile?this.scale=this.options.scaleMobile:this.options.scale&&(this.scale=this.options.scale),this.width=this.el.offsetWidth||window.innerWidth,this.height=this.el.offsetHeight||window.innerHeight}resize(){var t,e;this.setSize(),null!=(t=this.camera)&&(t.aspect=this.width/this.height),null!=(e=this.camera)&&"function"==typeof e.updateProjectionMatrix&&e.updateProjectionMatrix(),this.renderer&&(this.renderer.setSize(this.width,this.height),this.renderer.setPixelRatio(window.devicePixelRatio/this.scale)),"function"==typeof this.onResize&&this.onResize()}animationLoop(){var t,e,n,i,r,o,a,s;return this.t||(this.t=0),this.t+=1,this.t2||(this.t2=0),this.t2+=null!=(o=this.options.speed)?o:1,this.uniforms&&(this.uniforms.u_time.value=.016667*this.t2),t=this.el.offsetHeight,e=this.el.getBoundingClientRect(),s=null!=(a=window.pageYOffset)?a:(document.documentElement||document.body.parentNode||document.body).scrollTop,i=(r=e.top+s)-window.innerHeight,n=r+t,this.options.mouseEase&&(this.mouseEaseX=this.mouseEaseX||this.mouseX||0,this.mouseEaseY=this.mouseEaseY||this.mouseY||0,Math.abs(this.mouseEaseX-this.mouseX)+Math.abs(this.mouseEaseY-this.mouseY)>.1&&(this.mouseEaseX=this.mouseEaseX+.05*(this.mouseX-this.mouseEaseX),this.mouseEaseY=this.mouseEaseY+.05*(this.mouseY-this.mouseEaseY),this.triggerMouseMove(this.mouseEaseX,this.mouseEaseY))),i<=s&&s<=n&&("function"==typeof this.onUpdate&&this.onUpdate(),this.scene&&this.camera&&(this.renderer.render(this.scene,this.camera),"transparent"==this.options.backgroundColor?this.renderer.setClearColor(this.options.backgroundColor,0):this.renderer.setClearColor(this.options.backgroundColor,this.options.backgroundAlpha)),this.fps&&this.fps.update&&this.fps.update()),this.req=window.requestAnimationFrame(this.animationLoop)}restart(){if(this.scene)for(;this.scene.children.length;)this.scene.remove(this.scene.children[0]);"function"==typeof this.onRestart&&this.onRestart(),this.init()}init(){"function"==typeof this.onInit&&this.onInit()}destroy(){"function"==typeof this.onDestroy&&this.onDestroy(),this.el.removeEventListener("mousemove",this.onMouseMoveWrapper),window.removeEventListener("scroll",this.onMouseMoveWrapper),window.removeEventListener("resize",this.resize),window.cancelAnimationFrame(this.req),this.renderer&&(this.el.removeChild(this.renderer.domElement),this.renderer=null,this.scene=null)}},e.b=r.VantaBase},15:function(t,e,n){"use strict";n.r(e);var i=n(2);class r extends i.b{}i.a.register("CELLS",r),r.prototype.defaultOptions={color1:35980,color2:15918901,backgroundColor:14155663,amplitudeFactor:1,ringFactor:1,rotationFactor:1,size:1.5,speed:1,scaleMobile:3},r.prototype.fragmentShader="uniform vec2 u_resolution;\nuniform vec2 u_mouse;\nuniform float u_time;\n\nuniform float blurFactor;\nuniform vec3 color1;\nuniform vec3 color2;\nuniform vec3 backgroundColor;\nuniform float size;\nuniform float amplitudeFactor;\nuniform float ringFactor;\nuniform float rotationFactor;\n\nfloat length2(vec2 p) { return dot(p, p); }\n\nfloat noise(vec2 p){\n    return fract(sin(fract(sin(p.x) * (43.13311)) + p.y) * 31.0011);\n}\n\nfloat worley(vec2 p) {\n    float d = 1e30;\n    for (int xo = -1; xo <= 1; ++xo) {\n        for (int yo = -1; yo <= 1; ++yo) {\n            vec2 tp = floor(p) + vec2(xo, yo);\n            d = min(d, length2(p - tp - vec2(noise(tp))));\n        }\n    }\n    vec2 uv = gl_FragCoord.xy / u_resolution.xy;\n    float timeOffset =  0.15 * sin(u_time * 2.0 + 10.0*(uv.x - uv.y));\n    return 3.0*exp(-4.0*abs(2.0*d - 1.0 + timeOffset));\n}\n\nfloat fworley(vec2 p) {\n    return sqrt(sqrt(sqrt(\n    1.1 * // light\n    worley(p*5. + .3 + u_time*.0525) *\n    sqrt(worley(p * 50. / size + 0.3 + u_time * -0.15)) *\n    sqrt(sqrt(worley(p * -10. + 9.3))))));\n}\n\nvoid main() {\n    vec2 uv = gl_FragCoord.xy / u_resolution.xy;\n    float t = fworley(uv * u_resolution.xy / 1500.0);\n    t *= exp(-length2(abs(0.7*uv - 1.0)));\n\n    float tExp = pow(t, 0.5 - t);\n    vec3 c1 = color1 * (1.0 - t);\n    vec3 c2 = color2 * tExp;\n\n    gl_FragColor = vec4(pow(t, 1.0 - t) * (c1 + c2), 1.0);\n}\n"},2:function(t,e,n){"use strict";n.d(e,"b",function(){return o});var i=n(1),r=n(0);n.d(e,"a",function(){return i.a}),"object"==typeof THREE&&(THREE.Color.prototype.toVector=function(){return new THREE.Vector3(this.r,this.g,this.b)});class o extends i.b{constructor(t){super(t),this.mode="shader",this.updateUniforms=this.updateUniforms.bind(this)}initBasicShader(t=this.fragmentShader,e=this.vertexShader){var n,i,r;return e||(e="uniform float u_time;\nuniform vec2 u_resolution;\nvoid main() {\n  gl_Position = vec4( position, 1.0 );\n}"),this.updateUniforms(),"function"==typeof this.valuesChanger&&this.valuesChanger(),n=new THREE.ShaderMaterial({uniforms:this.uniforms,vertexShader:e,fragmentShader:t}),(r=this.options.texturePath)&&(this.uniforms.u_tex={type:"t",value:(new THREE.TextureLoader).load(r)}),i=new THREE.Mesh(new THREE.PlaneGeometry(2,2),n),this.scene.add(i),this.camera=new THREE.Camera,this.camera.position.z=1}updateUniforms(){var t,e,n,i;for(t in e={},n=this.options)i=n[t],-1!==t.toLowerCase().indexOf("color")?e[t]={type:"v3",value:new THREE.Color(i).toVector()}:"number"==typeof i&&(e[t]={type:"f",value:i});return Object(r.c)(this.uniforms,e)}init(){super.init(),this.fragmentShader&&this.initBasicShader()}resize(){super.resize(),this.uniforms.u_resolution.value.x=this.width/this.scale,this.uniforms.u_resolution.value.y=this.height/this.scale}}}}),function(){const t=document.documentElement;if(t.classList.remove("no-js"),t.classList.add("js"),document.body.classList.contains("has-animations")){(window.sr=ScrollReveal()).reveal(".is-revealing",{duration:1e3,distance:"40px",easing:"cubic-bezier(0.5, -0.01, 0, 1.005)",origin:"bottom",interval:150})}addScrollListener(document.querySelectorAll(".scroll-link",0)),null!==document.getElementById("cells-bg")&&VANTA.CELLS({el:"#cells-bg",color1:39064,color2:16773939})}(),window.onscroll=function(){if(null!==document.getElementById("mouse")){var t=document.getElementById("mouse"),e=window.innerHeight,n=void 0!==window.pageYOffset?window.pageYOffset:(document.documentElement||document.body.parentNode||document.body).scrollTop;e/=2,t.style.opacity=(e-n)/e}};const imageContainer=document.querySelector(".image-container"),showAllButton=document.querySelector(".show-all-members"),allTeamMembers=document.querySelectorAll(".team-member");function addPosition(t,e){t.style.left=e[0]+"%",t.style.top=e[1]+"%",t.style.width=e[2]-e[0]+"%",t.style.height=e[3]-e[1]+"%"}function getPosition(t){var e=t.target.getBoundingClientRect(),n=t.target.width,i=t.target.height,r=(t.clientX-e.left)/n*100,o=(t.clientY-e.top)/i*100;console.log(r,o)}function addTag(t,e,n){const i=document.createElement("div");document.createElement("div");i.addEventListener("click",n),i.classList.add("image-tag"),addPosition(i,t),imageContainer.appendChild(i)}function filterImages(t){allTeamMembers.forEach(e=>{e.id===t?(e.classList.remove("hidden"),e.scrollIntoView({left:0,block:"start",behavior:"smooth"})):e.classList.add("hidden")}),showAllButton.classList.remove("hidden")}function resetFilter(t){t.preventDefault(),allTeamMembers.forEach(t=>{t.classList.remove("hidden")}),showAllButton.classList.add("hidden")}null!==document.getElementById("team")&&(showAllButton.addEventListener("click",resetFilter),addTag([45,57,53,71],"Paul",()=>{filterImages("paul")}),addTag([15,38,21,49],"Vincent",()=>{filterImages("vincent")}));
 
</script>
 
  
  

Revision as of 07:05, 9 May 2019