9 | !function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):(e=e||self).View3D=t()}(this,function(){"use strict";var i=function(e,t){return(i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(e,t)};function a(e,t){function n(){this.constructor=e}i(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}var p=function(){return(p=Object.assign||function(e){for(var t,n=1,i=arguments.length;n<i;n++)for(var r in t=arguments[n])Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e}).apply(this,arguments)};function n(e,o,s,c){return new(s=s||Promise)(function(n,t){function i(e){try{a(c.next(e))}catch(e){t(e)}}function r(e){try{a(c.throw(e))}catch(e){t(e)}}function a(e){var t;e.done?n(e.value):((t=e.value)instanceof s?t:new s(function(e){e(t)})).then(i,r)}a((c=c.apply(e,o||[])).next())})}function s(n,i){var r,a,o,e,s={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return e={next:t(0),throw:t(1),return:t(2)},"function"==typeof Symbol&&(e[Symbol.iterator]=function(){return this}),e;function t(t){return function(e){return function(t){if(r)throw new TypeError("Generator is already executing.");for(;s;)try{if(r=1,a&&(o=2&t[0]?a.return:t[0]?a.throw||((o=a.return)&&o.call(a),0):a.next)&&!(o=o.call(a,t[1])).done)return o;switch(a=0,o&&(t=[2&t[0],o.value]),t[0]){case 0:case 1:o=t;break;case 4:return s.label++,{value:t[1],done:!1};case 5:s.label++,a=t[1],t=[0];continue;case 7:t=s.ops.pop(),s.trys.pop();continue;default:if(!(o=0<(o=s.trys).length&&o[o.length-1])&&(6===t[0]||2===t[0])){s=0;continue}if(3===t[0]&&(!o||t[1]>o[0]&&t[1]<o[3])){s.label=t[1];break}if(6===t[0]&&s.label<o[1]){s.label=o[1],o=t;break}if(o&&s.label<o[2]){s.label=o[2],s.ops.push(t);break}o[2]&&s.ops.pop(),s.trys.pop();continue}t=i.call(n,s)}catch(e){t=[6,e],a=0}finally{r=o=0}if(5&t[0])throw t[1];return{value:t[0]?t[1]:void 0,done:!0}}([t,e])}}}function r(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var i,r,a=n.call(e),o=[];try{for(;(void 0===t||0<t--)&&!(i=a.next()).done;)o.push(i.value)}catch(e){r={error:e}}finally{try{i&&!i.done&&(n=a.return)&&n.call(a)}finally{if(r)throw r.error}}return o}function v(){for(var e=[],t=0;t<arguments.length;t++)e=e.concat(r(arguments[t]));return e}var e,t=function(){function e(){this._listenerMap={}}var t=e.prototype;return t.on=function(e,t){var n=this._listenerMap,i=n[e];return i&&i.indexOf(t)<0?i.push(t):n[e]=[t],this},t.once=function(e,t){var n=this._listenerMap,i=n[e];return i&&i.indexOf(t)<0?i.push(t):n[e]=[t],this},t.off=function(e,t){var n=this._listenerMap;if(!e)return this._listenerMap={},this;if(!t)return delete n[e],this;var i=n[e];if(i){var r=i.indexOf(t);0<=r&&i.splice(r,1)}return this},t.emit=function(e){for(var t=[],n=1;n<arguments.length;n++)t[n-1]=arguments[n];var i=this._listenerMap[e];return i&&i.forEach(function(e){e.apply(void 0,v(t))}),this},e}();function J(){return(J=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(e[i]=n[i])}return e}).apply(this,arguments)}function o(e,t){e.prototype=Object.create(t.prototype),(e.prototype.constructor=e).__proto__=t}void 0===Number.EPSILON&&(Number.EPSILON=Math.pow(2,-52)),void 0===Number.isInteger&&(Number.isInteger=function(e){return"number"==typeof e&&isFinite(e)&&Math.floor(e)===e}),void 0===Math.sign&&(Math.sign=function(e){return e<0?-1:0<e?1:+e}),"name"in Function.prototype==!1&&Object.defineProperty(Function.prototype,"name",{get:function(){return this.toString().match(/^\s*function\s*([^\(\s]*)/)[1]}}),void 0===Object.assign&&(Object.assign=function(e){if(null==e)throw new TypeError("Cannot convert undefined or null to object");for(var t=Object(e),n=1;n<arguments.length;n++){var i=arguments[n];if(null!=i)for(var r in i)Object.prototype.hasOwnProperty.call(i,r)&&(t[r]=i[r])}return t});var K=0,Q=1,$=2,z=1,U=2,B=3,ee=0,Me=1,te=2,ne=0,ie=1,re=2,ae=3,oe=4,se=5,ce=100,le=101,ue=102,he=103,de=104,pe=200,fe=201,me=202,ve=203,ge=204,ye=205,_e=206,xe=207,be=208,we=209,Se=210,Te=0,Ee=1,Ae=2,Le=3,Re=4,Pe=5,Ce=6,Ie=7,G=0,H=1,k=2,Oe=0,V=1,j=2,W=3,q=4,X=5,Y=301,Z=302,De=303,Ne=304,Fe=305,ze=306,Ue=307,Be=1e3,Ge=1001,He=1002,ke=1003,Ve=1004,je=1005,We=1006,qe=1007,Xe=1008,Ye=1009,c=1010,l=1011,Ze=1012,u=1013,Je=1014,Ke=1015,Qe=1016,h=1017,d=1018,f=1019,$e=1020,m=1021,et=1022,tt=1023,g=1024,y=1025,T=tt,nt=1026,it=1027,_=1028,x=1029,b=1030,w=1031,M=1032,S=1033,E=33776,A=33777,L=33778,R=33779,P=35840,C=35841,I=35842,O=35843,D=36196,N=37492,F=37496,rt=37808,at=37809,ot=37810,st=37811,ct=37812,lt=37813,ut=37814,ht=37815,dt=37816,pt=37817,ft=37818,mt=37819,vt=37820,gt=37821,yt=36492,_t=37840,xt=37841,bt=37842,wt=37843,Mt=37844,St=37845,Tt=37846,Et=37847,At=37848,Lt=37849,Rt=37850,Pt=37851,Ct=37852,It=37853,Ot=2300,Dt=2301,Nt=2400,Ft=2401,zt=2402,Ut=3e3,Bt=3001,Gt=3007,Ht=3002,kt=3003,Vt=3004,jt=3005,Wt=3006,qt=3200,Xt=3201,Yt=0,Zt=1,Jt=7680,Kt=519,Qt=35044,$t=35048;function en(){}J(en.prototype,{addEventListener:function(e,t){void 0===this._listeners&&(this._listeners={});var n=this._listeners;void 0===n[e]&&(n[e]=[]),-1===n[e].indexOf(t)&&n[e].push(t)},hasEventListener:function(e,t){if(void 0===this._listeners)return!1;var n=this._listeners;return void 0!==n[e]&&-1!==n[e].indexOf(t)},removeEventListener:function(e,t){if(void 0!==this._listeners){var n=this._listeners[e];if(void 0!==n){var i=n.indexOf(t);-1!==i&&n.splice(i,1)}}},dispatchEvent:function(e){if(void 0!==this._listeners){var t=this._listeners[e.type];if(void 0!==t){e.target=this;for(var n=t.slice(0),i=0,r=n.length;i<r;i++)n[i].call(this,e)}}}});for(var tn=[],nn=0;nn<256;nn++)tn[nn]=(nn<16?"0":"")+nn.toString(16);var rn,an={DEG2RAD:Math.PI/180,RAD2DEG:180/Math.PI,generateUUID:function(){var e=4294967295*Math.random()|0,t=4294967295*Math.random()|0,n=4294967295*Math.random()|0,i=4294967295*Math.random()|0;return(tn[255&e]+tn[e>>8&255]+tn[e>>16&255]+tn[e>>24&255]+"-"+tn[255&t]+tn[t>>8&255]+"-"+tn[t>>16&15|64]+tn[t>>24&255]+"-"+tn[63&n|128]+tn[n>>8&255]+"-"+tn[n>>16&255]+tn[n>>24&255]+tn[255&i]+tn[i>>8&255]+tn[i>>16&255]+tn[i>>24&255]).toUpperCase()},clamp:function(e,t,n){return Math.max(t,Math.min(n,e))},euclideanModulo:function(e,t){return(e%t+t)%t},mapLinear:function(e,t,n,i,r){return i+(e-t)*(r-i)/(n-t)},lerp:function(e,t,n){return(1-n)*e+n*t},smoothstep:function(e,t,n){return e<=t?0:n<=e?1:(e=(e-t)/(n-t))*e*(3-2*e)},smootherstep:function(e,t,n){return e<=t?0:n<=e?1:(e=(e-t)/(n-t))*e*e*(e*(6*e-15)+10)},randInt:function(e,t){return e+Math.floor(Math.random()*(t-e+1))},randFloat:function(e,t){return e+Math.random()*(t-e)},randFloatSpread:function(e){return e*(.5-Math.random())},degToRad:function(e){return e*an.DEG2RAD},radToDeg:function(e){return e*an.RAD2DEG},isPowerOfTwo:function(e){return 0==(e&e-1)&&0!==e},ceilPowerOfTwo:function(e){return Math.pow(2,Math.ceil(Math.log(e)/Math.LN2))},floorPowerOfTwo:function(e){return Math.pow(2,Math.floor(Math.log(e)/Math.LN2))},setQuaternionFromProperEuler:function(e,t,n,i,r){var a=Math.cos,o=Math.sin,s=a(n/2),c=o(n/2),l=a((t+i)/2),u=o((t+i)/2),h=a((t-i)/2),d=o((t-i)/2),p=a((i-t)/2),f=o((i-t)/2);switch(r){case"XYX":e.set(s*u,c*h,c*d,s*l);break;case"YZY":e.set(c*d,s*u,c*h,s*l);break;case"ZXZ":e.set(c*h,c*d,s*u,s*l);break;case"XZX":e.set(s*u,c*f,c*p,s*l);break;case"YXY":e.set(c*p,s*u,c*f,s*l);break;case"ZYZ":e.set(c*f,c*p,s*u,s*l);break;default:console.warn("THREE.MathUtils: .setQuaternionFromProperEuler() encountered an unknown order: "+r)}}};function on(e,t){this.x=e||0,this.y=t||0}function sn(){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.")}Object.defineProperties(on.prototype,{width:{get:function(){return this.x},set:function(e){this.x=e}},height:{get:function(){return this.y},set:function(e){this.y=e}}}),J(on.prototype,{isVector2:!0,set:function(e,t){return this.x=e,this.y=t,this},setScalar:function(e){return this.x=e,this.y=e,this},setX:function(e){return this.x=e,this},setY:function(e){return this.y=e,this},setComponent:function(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;default:throw new Error("index is out of range: "+e)}return this},getComponent:function(e){switch(e){case 0:return this.x;case 1:return this.y;default:throw new Error("index is out of range: "+e)}},clone:function(){return new this.constructor(this.x,this.y)},copy:function(e){return this.x=e.x,this.y=e.y,this},add:function(e,t){return void 0!==t?(console.warn("THREE.Vector2: .add() now only accepts one argument. Use .addVectors( a, b ) instead."),this.addVectors(e,t)):(this.x+=e.x,this.y+=e.y,this)},addScalar:function(e){return this.x+=e,this.y+=e,this},addVectors:function(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this},addScaledVector:function(e,t){return this.x+=e.x*t,this.y+=e.y*t,this},sub:function(e,t){return void 0!==t?(console.warn("THREE.Vector2: .sub() now only accepts one argument. Use .subVectors( a, b ) instead."),this.subVectors(e,t)):(this.x-=e.x,this.y-=e.y,this)},subScalar:function(e){return this.x-=e,this.y-=e,this},subVectors:function(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this},multiply:function(e){return this.x*=e.x,this.y*=e.y,this},multiplyScalar:function(e){return this.x*=e,this.y*=e,this},divide:function(e){return this.x/=e.x,this.y/=e.y,this},divideScalar:function(e){return this.multiplyScalar(1/e)},applyMatrix3:function(e){var t=this.x,n=this.y,i=e.elements;return this.x=i[0]*t+i[3]*n+i[6],this.y=i[1]*t+i[4]*n+i[7],this},min:function(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this},max:function(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this},clamp:function(e,t){return this.x=Math.max(e.x,Math.min(t.x,this.x)),this.y=Math.max(e.y,Math.min(t.y,this.y)),this},clampScalar:function(e,t){return this.x=Math.max(e,Math.min(t,this.x)),this.y=Math.max(e,Math.min(t,this.y)),this},clampLength:function(e,t){var n=this.length();return this.divideScalar(n||1).multiplyScalar(Math.max(e,Math.min(t,n)))},floor:function(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this},ceil:function(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this},round:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this},roundToZero:function(){return this.x=this.x<0?Math.ceil(this.x):Math.floor(this.x),this.y=this.y<0?Math.ceil(this.y):Math.floor(this.y),this},negate:function(){return this.x=-this.x,this.y=-this.y,this},dot:function(e){return this.x*e.x+this.y*e.y},cross:function(e){return this.x*e.y-this.y*e.x},lengthSq:function(){return this.x*this.x+this.y*this.y},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y)},manhattanLength:function(){return Math.abs(this.x)+Math.abs(this.y)},normalize:function(){return this.divideScalar(this.length()||1)},angle:function(){var e=Math.atan2(-this.y,-this.x)+Math.PI;return e},distanceTo:function(e){return Math.sqrt(this.distanceToSquared(e))},distanceToSquared:function(e){var t=this.x-e.x,n=this.y-e.y;return t*t+n*n},manhattanDistanceTo:function(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)},setLength:function(e){return this.normalize().multiplyScalar(e)},lerp:function(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this},lerpVectors:function(e,t,n){return this.subVectors(t,e).multiplyScalar(n).add(e)},equals:function(e){return e.x===this.x&&e.y===this.y},fromArray:function(e,t){return void 0===t&&(t=0),this.x=e[t],this.y=e[t+1],this},toArray:function(e,t){return void 0===e&&(e=[]),void 0===t&&(t=0),e[t]=this.x,e[t+1]=this.y,e},fromBufferAttribute:function(e,t,n){return void 0!==n&&console.warn("THREE.Vector2: offset has been removed from .fromBufferAttribute()."),this.x=e.getX(t),this.y=e.getY(t),this},rotateAround:function(e,t){var n=Math.cos(t),i=Math.sin(t),r=this.x-e.x,a=this.y-e.y;return this.x=r*n-a*i+e.x,this.y=r*i+a*n+e.y,this},random:function(){return this.x=Math.random(),this.y=Math.random(),this}}),J(sn.prototype,{isMatrix3:!0,set:function(e,t,n,i,r,a,o,s,c){var l=this.elements;return l[0]=e,l[1]=i,l[2]=o,l[3]=t,l[4]=r,l[5]=s,l[6]=n,l[7]=a,l[8]=c,this},identity:function(){return this.set(1,0,0,0,1,0,0,0,1),this},clone:function(){return(new this.constructor).fromArray(this.elements)},copy:function(e){var t=this.elements,n=e.elements;return t[0]=n[0],t[1]=n[1],t[2]=n[2],t[3]=n[3],t[4]=n[4],t[5]=n[5],t[6]=n[6],t[7]=n[7],t[8]=n[8],this},extractBasis:function(e,t,n){return e.setFromMatrix3Column(this,0),t.setFromMatrix3Column(this,1),n.setFromMatrix3Column(this,2),this},setFromMatrix4:function(e){var t=e.elements;return this.set(t[0],t[4],t[8],t[1],t[5],t[9],t[2],t[6],t[10]),this},multiply:function(e){return this.multiplyMatrices(this,e)},premultiply:function(e){return this.multiplyMatrices(e,this)},multiplyMatrices:function(e,t){var n=e.elements,i=t.elements,r=this.elements,a=n[0],o=n[3],s=n[6],c=n[1],l=n[4],u=n[7],h=n[2],d=n[5],p=n[8],f=i[0],m=i[3],v=i[6],g=i[1],y=i[4],_=i[7],x=i[2],b=i[5],w=i[8];return r[0]=a*f+o*g+s*x,r[3]=a*m+o*y+s*b,r[6]=a*v+o*_+s*w,r[1]=c*f+l*g+u*x,r[4]=c*m+l*y+u*b,r[7]=c*v+l*_+u*w,r[2]=h*f+d*g+p*x,r[5]=h*m+d*y+p*b,r[8]=h*v+d*_+p*w,this},multiplyScalar:function(e){var t=this.elements;return t[0]*=e,t[3]*=e,t[6]*=e,t[1]*=e,t[4]*=e,t[7]*=e,t[2]*=e,t[5]*=e,t[8]*=e,this},determinant:function(){var e=this.elements,t=e[0],n=e[1],i=e[2],r=e[3],a=e[4],o=e[5],s=e[6],c=e[7],l=e[8];return t*a*l-t*o*c-n*r*l+n*o*s+i*r*c-i*a*s},getInverse:function(e,t){void 0!==t&&console.warn("THREE.Matrix3: .getInverse() can no longer be configured to throw on degenerate.");var n=e.elements,i=this.elements,r=n[0],a=n[1],o=n[2],s=n[3],c=n[4],l=n[5],u=n[6],h=n[7],d=n[8],p=d*c-l*h,f=l*u-d*s,m=h*s-c*u,v=r*p+a*f+o*m;if(0==v)return this.set(0,0,0,0,0,0,0,0,0);var g=1/v;return i[0]=p*g,i[1]=(o*h-d*a)*g,i[2]=(l*a-o*c)*g,i[3]=f*g,i[4]=(d*r-o*u)*g,i[5]=(o*s-l*r)*g,i[6]=m*g,i[7]=(a*u-h*r)*g,i[8]=(c*r-a*s)*g,this},transpose:function(){var e,t=this.elements;return e=t[1],t[1]=t[3],t[3]=e,e=t[2],t[2]=t[6],t[6]=e,e=t[5],t[5]=t[7],t[7]=e,this},getNormalMatrix:function(e){return this.setFromMatrix4(e).getInverse(this).transpose()},transposeIntoArray:function(e){var t=this.elements;return e[0]=t[0],e[1]=t[3],e[2]=t[6],e[3]=t[1],e[4]=t[4],e[5]=t[7],e[6]=t[2],e[7]=t[5],e[8]=t[8],this},setUvTransform:function(e,t,n,i,r,a,o){var s=Math.cos(r),c=Math.sin(r);this.set(n*s,n*c,-n*(s*a+c*o)+a+e,-i*c,i*s,-i*(-c*a+s*o)+o+t,0,0,1)},scale:function(e,t){var n=this.elements;return n[0]*=e,n[3]*=e,n[6]*=e,n[1]*=t,n[4]*=t,n[7]*=t,this},rotate:function(e){var t=Math.cos(e),n=Math.sin(e),i=this.elements,r=i[0],a=i[3],o=i[6],s=i[1],c=i[4],l=i[7];return i[0]=t*r+n*s,i[3]=t*a+n*c,i[6]=t*o+n*l,i[1]=-n*r+t*s,i[4]=-n*a+t*c,i[7]=-n*o+t*l,this},translate:function(e,t){var n=this.elements;return n[0]+=e*n[2],n[3]+=e*n[5],n[6]+=e*n[8],n[1]+=t*n[2],n[4]+=t*n[5],n[7]+=t*n[8],this},equals:function(e){for(var t=this.elements,n=e.elements,i=0;i<9;i++)if(t[i]!==n[i])return!1;return!0},fromArray:function(e,t){void 0===t&&(t=0);for(var n=0;n<9;n++)this.elements[n]=e[n+t];return this},toArray:function(e,t){void 0===e&&(e=[]),void 0===t&&(t=0);var n=this.elements;return e[t]=n[0],e[t+1]=n[1],e[t+2]=n[2],e[t+3]=n[3],e[t+4]=n[4],e[t+5]=n[5],e[t+6]=n[6],e[t+7]=n[7],e[t+8]=n[8],e}});var cn={getDataURL:function(e){var t;if("undefined"==typeof HTMLCanvasElement)return e.src;if(e instanceof HTMLCanvasElement)t=e;else{void 0===rn&&(rn=document.createElementNS("http://www.w3.org/1999/xhtml","canvas")),rn.width=e.width,rn.height=e.height;var n=rn.getContext("2d");e instanceof ImageData?n.putImageData(e,0,0):n.drawImage(e,0,0,e.width,e.height),t=rn}return 2048<t.width||2048<t.height?t.toDataURL("image/jpeg",.6):t.toDataURL("image/png")}},ln=0;function un(e,t,n,i,r,a,o,s,c,l){Object.defineProperty(this,"id",{value:ln++}),this.uuid=an.generateUUID(),this.name="",this.image=void 0!==e?e:un.DEFAULT_IMAGE,this.mipmaps=[],this.mapping=void 0!==t?t:un.DEFAULT_MAPPING,this.wrapS=void 0!==n?n:Ge,this.wrapT=void 0!==i?i:Ge,this.magFilter=void 0!==r?r:We,this.minFilter=void 0!==a?a:Xe,this.anisotropy=void 0!==c?c:1,this.format=void 0!==o?o:tt,this.internalFormat=null,this.type=void 0!==s?s:Ye,this.offset=new on(0,0),this.repeat=new on(1,1),this.center=new on(0,0),this.rotation=0,this.matrixAutoUpdate=!0,this.matrix=new sn,this.generateMipmaps=!0,this.premultiplyAlpha=!1,this.flipY=!0,this.unpackAlignment=4,this.encoding=void 0!==l?l:Ut,this.version=0,this.onUpdate=null}function hn(e,t,n,i){this.x=e||0,this.y=t||0,this.z=n||0,this.w=void 0!==i?i:1}function dn(e,t,n){this.width=e,this.height=t,this.scissor=new hn(0,0,e,t),this.scissorTest=!1,this.viewport=new hn(0,0,e,t),n=n||{},this.texture=new un(void 0,n.mapping,n.wrapS,n.wrapT,n.magFilter,n.minFilter,n.format,n.type,n.anisotropy,n.encoding),this.texture.image={},this.texture.image.width=e,this.texture.image.height=t,this.texture.generateMipmaps=void 0!==n.generateMipmaps&&n.generateMipmaps,this.texture.minFilter=void 0!==n.minFilter?n.minFilter:We,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 pn(e,t,n){dn.call(this,e,t,n),this.samples=4}function fn(e,t,n,i){this._x=e||0,this._y=t||0,this._z=n||0,this._w=void 0!==i?i:1}un.DEFAULT_IMAGE=void 0,un.DEFAULT_MAPPING=300,un.prototype=J(Object.create(en.prototype),{constructor:un,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(e){return this.name=e.name,this.image=e.image,this.mipmaps=e.mipmaps.slice(0),this.mapping=e.mapping,this.wrapS=e.wrapS,this.wrapT=e.wrapT,this.magFilter=e.magFilter,this.minFilter=e.minFilter,this.anisotropy=e.anisotropy,this.format=e.format,this.internalFormat=e.internalFormat,this.type=e.type,this.offset.copy(e.offset),this.repeat.copy(e.repeat),this.center.copy(e.center),this.rotation=e.rotation,this.matrixAutoUpdate=e.matrixAutoUpdate,this.matrix.copy(e.matrix),this.generateMipmaps=e.generateMipmaps,this.premultiplyAlpha=e.premultiplyAlpha,this.flipY=e.flipY,this.unpackAlignment=e.unpackAlignment,this.encoding=e.encoding,this},toJSON:function(e){var t=void 0===e||"string"==typeof e;if(!t&&void 0!==e.textures[this.uuid])return e.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,type:this.type,encoding:this.encoding,minFilter:this.minFilter,magFilter:this.magFilter,anisotropy:this.anisotropy,flipY:this.flipY,premultiplyAlpha:this.premultiplyAlpha,unpackAlignment:this.unpackAlignment};if(void 0!==this.image){var i=this.image;if(void 0===i.uuid&&(i.uuid=an.generateUUID()),!t&&void 0===e.images[i.uuid]){var r;if(Array.isArray(i)){r=[];for(var a=0,o=i.length;a<o;a++)r.push(cn.getDataURL(i[a]))}else r=cn.getDataURL(i);e.images[i.uuid]={uuid:i.uuid,url:r}}n.image=i.uuid}return t||(e.textures[this.uuid]=n),n},dispose:function(){this.dispatchEvent({type:"dispose"})},transformUv:function(e){if(300!==this.mapping)return e;if(e.applyMatrix3(this.matrix),e.x<0||1<e.x)switch(this.wrapS){case Be:e.x=e.x-Math.floor(e.x);break;case Ge:e.x=e.x<0?0:1;break;case He:1===Math.abs(Math.floor(e.x)%2)?e.x=Math.ceil(e.x)-e.x:e.x=e.x-Math.floor(e.x)}if(e.y<0||1<e.y)switch(this.wrapT){case Be:e.y=e.y-Math.floor(e.y);break;case Ge:e.y=e.y<0?0:1;break;case He:1===Math.abs(Math.floor(e.y)%2)?e.y=Math.ceil(e.y)-e.y:e.y=e.y-Math.floor(e.y)}return this.flipY&&(e.y=1-e.y),e}}),Object.defineProperty(un.prototype,"needsUpdate",{set:function(e){!0===e&&this.version++}}),Object.defineProperties(hn.prototype,{width:{get:function(){return this.z},set:function(e){this.z=e}},height:{get:function(){return this.w},set:function(e){this.w=e}}}),J(hn.prototype,{isVector4:!0,set:function(e,t,n,i){return this.x=e,this.y=t,this.z=n,this.w=i,this},setScalar:function(e){return this.x=e,this.y=e,this.z=e,this.w=e,this},setX:function(e){return this.x=e,this},setY:function(e){return this.y=e,this},setZ:function(e){return this.z=e,this},setW:function(e){return this.w=e,this},setComponent:function(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;case 2:this.z=t;break;case 3:this.w=t;break;default:throw new Error("index is out of range: "+e)}return this},getComponent:function(e){switch(e){case 0:return this.x;case 1:return this.y;case 2:return this.z;case 3:return this.w;default:throw new Error("index is out of range: "+e)}},clone:function(){return new this.constructor(this.x,this.y,this.z,this.w)},copy:function(e){return this.x=e.x,this.y=e.y,this.z=e.z,this.w=void 0!==e.w?e.w:1,this},add:function(e,t){return void 0!==t?(console.warn("THREE.Vector4: .add() now only accepts one argument. Use .addVectors( a, b ) instead."),this.addVectors(e,t)):(this.x+=e.x,this.y+=e.y,this.z+=e.z,this.w+=e.w,this)},addScalar:function(e){return this.x+=e,this.y+=e,this.z+=e,this.w+=e,this},addVectors:function(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this.z=e.z+t.z,this.w=e.w+t.w,this},addScaledVector:function(e,t){return this.x+=e.x*t,this.y+=e.y*t,this.z+=e.z*t,this.w+=e.w*t,this},sub:function(e,t){return void 0!==t?(console.warn("THREE.Vector4: .sub() now only accepts one argument. Use .subVectors( a, b ) instead."),this.subVectors(e,t)):(this.x-=e.x,this.y-=e.y,this.z-=e.z,this.w-=e.w,this)},subScalar:function(e){return this.x-=e,this.y-=e,this.z-=e,this.w-=e,this},subVectors:function(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this.z=e.z-t.z,this.w=e.w-t.w,this},multiplyScalar:function(e){return this.x*=e,this.y*=e,this.z*=e,this.w*=e,this},applyMatrix4:function(e){var t=this.x,n=this.y,i=this.z,r=this.w,a=e.elements;return this.x=a[0]*t+a[4]*n+a[8]*i+a[12]*r,this.y=a[1]*t+a[5]*n+a[9]*i+a[13]*r,this.z=a[2]*t+a[6]*n+a[10]*i+a[14]*r,this.w=a[3]*t+a[7]*n+a[11]*i+a[15]*r,this},divideScalar:function(e){return this.multiplyScalar(1/e)},setAxisAngleFromQuaternion:function(e){this.w=2*Math.acos(e.w);var t=Math.sqrt(1-e.w*e.w);return t<1e-4?(this.x=1,this.y=0,this.z=0):(this.x=e.x/t,this.y=e.y/t,this.z=e.z/t),this},setAxisAngleFromRotationMatrix:function(e){var t,n,i,r,a=e.elements,o=a[0],s=a[4],c=a[8],l=a[1],u=a[5],h=a[9],d=a[2],p=a[6],f=a[10];if(Math.abs(s-l)<.01&&Math.abs(c-d)<.01&&Math.abs(h-p)<.01){if(Math.abs(s+l)<.1&&Math.abs(c+d)<.1&&Math.abs(h+p)<.1&&Math.abs(o+u+f-3)<.1)return this.set(1,0,0,0),this;t=Math.PI;var m=(o+1)/2,v=(u+1)/2,g=(f+1)/2,y=(s+l)/4,_=(c+d)/4,x=(h+p)/4;return v<m&&g<m?r=m<.01?(n=0,i=.707106781):(i=y/(n=Math.sqrt(m)),_/n):g<v?r=v<.01?(i=0,n=.707106781):(n=y/(i=Math.sqrt(v)),x/i):g<.01?(i=n=.707106781,r=0):(n=_/(r=Math.sqrt(g)),i=x/r),this.set(n,i,r,t),this}var b=Math.sqrt((p-h)*(p-h)+(c-d)*(c-d)+(l-s)*(l-s));return Math.abs(b)<.001&&(b=1),this.x=(p-h)/b,this.y=(c-d)/b,this.z=(l-s)/b,this.w=Math.acos((o+u+f-1)/2),this},min:function(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this.z=Math.min(this.z,e.z),this.w=Math.min(this.w,e.w),this},max:function(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this.z=Math.max(this.z,e.z),this.w=Math.max(this.w,e.w),this},clamp:function(e,t){return this.x=Math.max(e.x,Math.min(t.x,this.x)),this.y=Math.max(e.y,Math.min(t.y,this.y)),this.z=Math.max(e.z,Math.min(t.z,this.z)),this.w=Math.max(e.w,Math.min(t.w,this.w)),this},clampScalar:function(e,t){return this.x=Math.max(e,Math.min(t,this.x)),this.y=Math.max(e,Math.min(t,this.y)),this.z=Math.max(e,Math.min(t,this.z)),this.w=Math.max(e,Math.min(t,this.w)),this},clampLength:function(e,t){var n=this.length();return this.divideScalar(n||1).multiplyScalar(Math.max(e,Math.min(t,n)))},floor:function(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this.w=Math.floor(this.w),this},ceil:function(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this.w=Math.ceil(this.w),this},round:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this.w=Math.round(this.w),this},roundToZero:function(){return this.x=this.x<0?Math.ceil(this.x):Math.floor(this.x),this.y=this.y<0?Math.ceil(this.y):Math.floor(this.y),this.z=this.z<0?Math.ceil(this.z):Math.floor(this.z),this.w=this.w<0?Math.ceil(this.w):Math.floor(this.w),this},negate:function(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this.w=-this.w,this},dot:function(e){return this.x*e.x+this.y*e.y+this.z*e.z+this.w*e.w},lengthSq:function(){return this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)},manhattanLength:function(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)+Math.abs(this.w)},normalize:function(){return this.divideScalar(this.length()||1)},setLength:function(e){return this.normalize().multiplyScalar(e)},lerp:function(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this.z+=(e.z-this.z)*t,this.w+=(e.w-this.w)*t,this},lerpVectors:function(e,t,n){return this.subVectors(t,e).multiplyScalar(n).add(e)},equals:function(e){return e.x===this.x&&e.y===this.y&&e.z===this.z&&e.w===this.w},fromArray:function(e,t){return void 0===t&&(t=0),this.x=e[t],this.y=e[t+1],this.z=e[t+2],this.w=e[t+3],this},toArray:function(e,t){return void 0===e&&(e=[]),void 0===t&&(t=0),e[t]=this.x,e[t+1]=this.y,e[t+2]=this.z,e[t+3]=this.w,e},fromBufferAttribute:function(e,t,n){return void 0!==n&&console.warn("THREE.Vector4: offset has been removed from .fromBufferAttribute()."),this.x=e.getX(t),this.y=e.getY(t),this.z=e.getZ(t),this.w=e.getW(t),this},random:function(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this.w=Math.random(),this}}),dn.prototype=J(Object.create(en.prototype),{constructor:dn,isWebGLRenderTarget:!0,setSize:function(e,t){this.width===e&&this.height===t||(this.width=e,this.height=t,this.texture.image.width=e,this.texture.image.height=t,this.dispose()),this.viewport.set(0,0,e,t),this.scissor.set(0,0,e,t)},clone:function(){return(new this.constructor).copy(this)},copy:function(e){return this.width=e.width,this.height=e.height,this.viewport.copy(e.viewport),this.texture=e.texture.clone(),this.depthBuffer=e.depthBuffer,this.stencilBuffer=e.stencilBuffer,this.depthTexture=e.depthTexture,this},dispose:function(){this.dispatchEvent({type:"dispose"})}}),pn.prototype=J(Object.create(dn.prototype),{constructor:pn,isWebGLMultisampleRenderTarget:!0,copy:function(e){return dn.prototype.copy.call(this,e),this.samples=e.samples,this}}),J(fn,{slerp:function(e,t,n,i){return n.copy(e).slerp(t,i)},slerpFlat:function(e,t,n,i,r,a,o){var s=n[i+0],c=n[i+1],l=n[i+2],u=n[i+3],h=r[a+0],d=r[a+1],p=r[a+2],f=r[a+3];if(u!==f||s!==h||c!==d||l!==p){var m=1-o,v=s*h+c*d+l*p+u*f,g=0<=v?1:-1,y=1-v*v;if(y>Number.EPSILON){var _=Math.sqrt(y),x=Math.atan2(_,v*g);m=Math.sin(m*x)/_,o=Math.sin(o*x)/_}var b=o*g;if(s=s*m+h*b,c=c*m+d*b,l=l*m+p*b,u=u*m+f*b,m===1-o){var w=1/Math.sqrt(s*s+c*c+l*l+u*u);s*=w,c*=w,l*=w,u*=w}}e[t]=s,e[t+1]=c,e[t+2]=l,e[t+3]=u},multiplyQuaternionsFlat:function(e,t,n,i,r,a){var o=n[i],s=n[i+1],c=n[i+2],l=n[i+3],u=r[a],h=r[a+1],d=r[a+2],p=r[a+3];return e[t]=o*p+l*u+s*d-c*h,e[t+1]=s*p+l*h+c*u-o*d,e[t+2]=c*p+l*d+o*h-s*u,e[t+3]=l*p-o*u-s*h-c*d,e}}),Object.defineProperties(fn.prototype,{x:{get:function(){return this._x},set:function(e){this._x=e,this._onChangeCallback()}},y:{get:function(){return this._y},set:function(e){this._y=e,this._onChangeCallback()}},z:{get:function(){return this._z},set:function(e){this._z=e,this._onChangeCallback()}},w:{get:function(){return this._w},set:function(e){this._w=e,this._onChangeCallback()}}}),J(fn.prototype,{isQuaternion:!0,set:function(e,t,n,i){return this._x=e,this._y=t,this._z=n,this._w=i,this._onChangeCallback(),this},clone:function(){return new this.constructor(this._x,this._y,this._z,this._w)},copy:function(e){return this._x=e.x,this._y=e.y,this._z=e.z,this._w=e.w,this._onChangeCallback(),this},setFromEuler:function(e,t){if(!e||!e.isEuler)throw new Error("THREE.Quaternion: .setFromEuler() now expects an Euler rotation rather than a Vector3 and order.");var n=e._x,i=e._y,r=e._z,a=e.order,o=Math.cos,s=Math.sin,c=o(n/2),l=o(i/2),u=o(r/2),h=s(n/2),d=s(i/2),p=s(r/2);switch(a){case"XYZ":this._x=h*l*u+c*d*p,this._y=c*d*u-h*l*p,this._z=c*l*p+h*d*u,this._w=c*l*u-h*d*p;break;case"YXZ":this._x=h*l*u+c*d*p,this._y=c*d*u-h*l*p,this._z=c*l*p-h*d*u,this._w=c*l*u+h*d*p;break;case"ZXY":this._x=h*l*u-c*d*p,this._y=c*d*u+h*l*p,this._z=c*l*p+h*d*u,this._w=c*l*u-h*d*p;break;case"ZYX":this._x=h*l*u-c*d*p,this._y=c*d*u+h*l*p,this._z=c*l*p-h*d*u,this._w=c*l*u+h*d*p;break;case"YZX":this._x=h*l*u+c*d*p,this._y=c*d*u+h*l*p,this._z=c*l*p-h*d*u,this._w=c*l*u-h*d*p;break;case"XZY":this._x=h*l*u-c*d*p,this._y=c*d*u-h*l*p,this._z=c*l*p+h*d*u,this._w=c*l*u+h*d*p;break;default:console.warn("THREE.Quaternion: .setFromEuler() encountered an unknown order: "+a)}return!1!==t&&this._onChangeCallback(),this},setFromAxisAngle:function(e,t){var n=t/2,i=Math.sin(n);return this._x=e.x*i,this._y=e.y*i,this._z=e.z*i,this._w=Math.cos(n),this._onChangeCallback(),this},setFromRotationMatrix:function(e){var t,n=e.elements,i=n[0],r=n[4],a=n[8],o=n[1],s=n[5],c=n[9],l=n[2],u=n[6],h=n[10],d=i+s+h;return 0<d?(t=.5/Math.sqrt(d+1),this._w=.25/t,this._x=(u-c)*t,this._y=(a-l)*t,this._z=(o-r)*t):s<i&&h<i?(t=2*Math.sqrt(1+i-s-h),this._w=(u-c)/t,this._x=.25*t,this._y=(r+o)/t,this._z=(a+l)/t):h<s?(t=2*Math.sqrt(1+s-i-h),this._w=(a-l)/t,this._x=(r+o)/t,this._y=.25*t,this._z=(c+u)/t):(t=2*Math.sqrt(1+h-i-s),this._w=(o-r)/t,this._x=(a+l)/t,this._y=(c+u)/t,this._z=.25*t),this._onChangeCallback(),this},setFromUnitVectors:function(e,t){var n=e.dot(t)+1;return n<1e-6?(n=0,Math.abs(e.x)>Math.abs(e.z)?(this._x=-e.y,this._y=e.x,this._z=0):(this._x=0,this._y=-e.z,this._z=e.y)):(this._x=e.y*t.z-e.z*t.y,this._y=e.z*t.x-e.x*t.z,this._z=e.x*t.y-e.y*t.x),this._w=n,this.normalize()},angleTo:function(e){return 2*Math.acos(Math.abs(an.clamp(this.dot(e),-1,1)))},rotateTowards:function(e,t){var n=this.angleTo(e);if(0===n)return this;var i=Math.min(1,t/n);return this.slerp(e,i),this},inverse:function(){return this.conjugate()},conjugate:function(){return this._x*=-1,this._y*=-1,this._z*=-1,this._onChangeCallback(),this},dot:function(e){return this._x*e._x+this._y*e._y+this._z*e._z+this._w*e._w},lengthSq:function(){return this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w},length:function(){return Math.sqrt(this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w)},normalize:function(){var e=this.length();return 0===e?(this._x=0,this._y=0,this._z=0,this._w=1):(e=1/e,this._x=this._x*e,this._y=this._y*e,this._z=this._z*e,this._w=this._w*e),this._onChangeCallback(),this},multiply:function(e,t){return void 0!==t?(console.warn("THREE.Quaternion: .multiply() now only accepts one argument. Use .multiplyQuaternions( a, b ) instead."),this.multiplyQuaternions(e,t)):this.multiplyQuaternions(this,e)},premultiply:function(e){return this.multiplyQuaternions(e,this)},multiplyQuaternions:function(e,t){var n=e._x,i=e._y,r=e._z,a=e._w,o=t._x,s=t._y,c=t._z,l=t._w;return this._x=n*l+a*o+i*c-r*s,this._y=i*l+a*s+r*o-n*c,this._z=r*l+a*c+n*s-i*o,this._w=a*l-n*o-i*s-r*c,this._onChangeCallback(),this},slerp:function(e,t){if(0===t)return this;if(1===t)return this.copy(e);var n=this._x,i=this._y,r=this._z,a=this._w,o=a*e._w+n*e._x+i*e._y+r*e._z;if(o<0?(this._w=-e._w,this._x=-e._x,this._y=-e._y,this._z=-e._z,o=-o):this.copy(e),1<=o)return this._w=a,this._x=n,this._y=i,this._z=r,this;var s=1-o*o;if(s<=Number.EPSILON){var c=1-t;return this._w=c*a+t*this._w,this._x=c*n+t*this._x,this._y=c*i+t*this._y,this._z=c*r+t*this._z,this.normalize(),this._onChangeCallback(),this}var l=Math.sqrt(s),u=Math.atan2(l,o),h=Math.sin((1-t)*u)/l,d=Math.sin(t*u)/l;return this._w=a*h+this._w*d,this._x=n*h+this._x*d,this._y=i*h+this._y*d,this._z=r*h+this._z*d,this._onChangeCallback(),this},equals:function(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._w===this._w},fromArray:function(e,t){return void 0===t&&(t=0),this._x=e[t],this._y=e[t+1],this._z=e[t+2],this._w=e[t+3],this._onChangeCallback(),this},toArray:function(e,t){return void 0===e&&(e=[]),void 0===t&&(t=0),e[t]=this._x,e[t+1]=this._y,e[t+2]=this._z,e[t+3]=this._w,e},fromBufferAttribute:function(e,t){return this._x=e.getX(t),this._y=e.getY(t),this._z=e.getZ(t),this._w=e.getW(t),this},_onChange:function(e){return this._onChangeCallback=e,this},_onChangeCallback:function(){}});var mn=new gn,vn=new fn;function gn(e,t,n){this.x=e||0,this.y=t||0,this.z=n||0}J(gn.prototype,{isVector3:!0,set:function(e,t,n){return this.x=e,this.y=t,this.z=n,this},setScalar:function(e){return this.x=e,this.y=e,this.z=e,this},setX:function(e){return this.x=e,this},setY:function(e){return this.y=e,this},setZ:function(e){return this.z=e,this},setComponent:function(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;case 2:this.z=t;break;default:throw new Error("index is out of range: "+e)}return this},getComponent:function(e){switch(e){case 0:return this.x;case 1:return this.y;case 2:return this.z;default:throw new Error("index is out of range: "+e)}},clone:function(){return new this.constructor(this.x,this.y,this.z)},copy:function(e){return this.x=e.x,this.y=e.y,this.z=e.z,this},add:function(e,t){return void 0!==t?(console.warn("THREE.Vector3: .add() now only accepts one argument. Use .addVectors( a, b ) instead."),this.addVectors(e,t)):(this.x+=e.x,this.y+=e.y,this.z+=e.z,this)},addScalar:function(e){return this.x+=e,this.y+=e,this.z+=e,this},addVectors:function(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this.z=e.z+t.z,this},addScaledVector:function(e,t){return this.x+=e.x*t,this.y+=e.y*t,this.z+=e.z*t,this},sub:function(e,t){return void 0!==t?(console.warn("THREE.Vector3: .sub() now only accepts one argument. Use .subVectors( a, b ) instead."),this.subVectors(e,t)):(this.x-=e.x,this.y-=e.y,this.z-=e.z,this)},subScalar:function(e){return this.x-=e,this.y-=e,this.z-=e,this},subVectors:function(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this.z=e.z-t.z,this},multiply:function(e,t){return void 0!==t?(console.warn("THREE.Vector3: .multiply() now only accepts one argument. Use .multiplyVectors( a, b ) instead."),this.multiplyVectors(e,t)):(this.x*=e.x,this.y*=e.y,this.z*=e.z,this)},multiplyScalar:function(e){return this.x*=e,this.y*=e,this.z*=e,this},multiplyVectors:function(e,t){return this.x=e.x*t.x,this.y=e.y*t.y,this.z=e.z*t.z,this},applyEuler:function(e){return e&&e.isEuler||console.error("THREE.Vector3: .applyEuler() now expects an Euler rotation rather than a Vector3 and order."),this.applyQuaternion(vn.setFromEuler(e))},applyAxisAngle:function(e,t){return this.applyQuaternion(vn.setFromAxisAngle(e,t))},applyMatrix3:function(e){var t=this.x,n=this.y,i=this.z,r=e.elements;return this.x=r[0]*t+r[3]*n+r[6]*i,this.y=r[1]*t+r[4]*n+r[7]*i,this.z=r[2]*t+r[5]*n+r[8]*i,this},applyNormalMatrix:function(e){return this.applyMatrix3(e).normalize()},applyMatrix4:function(e){var t=this.x,n=this.y,i=this.z,r=e.elements,a=1/(r[3]*t+r[7]*n+r[11]*i+r[15]);return this.x=(r[0]*t+r[4]*n+r[8]*i+r[12])*a,this.y=(r[1]*t+r[5]*n+r[9]*i+r[13])*a,this.z=(r[2]*t+r[6]*n+r[10]*i+r[14])*a,this},applyQuaternion:function(e){var t=this.x,n=this.y,i=this.z,r=e.x,a=e.y,o=e.z,s=e.w,c=s*t+a*i-o*n,l=s*n+o*t-r*i,u=s*i+r*n-a*t,h=-r*t-a*n-o*i;return this.x=c*s+h*-r+l*-o-u*-a,this.y=l*s+h*-a+u*-r-c*-o,this.z=u*s+h*-o+c*-a-l*-r,this},project:function(e){return this.applyMatrix4(e.matrixWorldInverse).applyMatrix4(e.projectionMatrix)},unproject:function(e){return this.applyMatrix4(e.projectionMatrixInverse).applyMatrix4(e.matrixWorld)},transformDirection:function(e){var t=this.x,n=this.y,i=this.z,r=e.elements;return this.x=r[0]*t+r[4]*n+r[8]*i,this.y=r[1]*t+r[5]*n+r[9]*i,this.z=r[2]*t+r[6]*n+r[10]*i,this.normalize()},divide:function(e){return this.x/=e.x,this.y/=e.y,this.z/=e.z,this},divideScalar:function(e){return this.multiplyScalar(1/e)},min:function(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this.z=Math.min(this.z,e.z),this},max:function(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this.z=Math.max(this.z,e.z),this},clamp:function(e,t){return this.x=Math.max(e.x,Math.min(t.x,this.x)),this.y=Math.max(e.y,Math.min(t.y,this.y)),this.z=Math.max(e.z,Math.min(t.z,this.z)),this},clampScalar:function(e,t){return this.x=Math.max(e,Math.min(t,this.x)),this.y=Math.max(e,Math.min(t,this.y)),this.z=Math.max(e,Math.min(t,this.z)),this},clampLength:function(e,t){var n=this.length();return this.divideScalar(n||1).multiplyScalar(Math.max(e,Math.min(t,n)))},floor:function(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this},ceil:function(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this},round:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this},roundToZero:function(){return this.x=this.x<0?Math.ceil(this.x):Math.floor(this.x),this.y=this.y<0?Math.ceil(this.y):Math.floor(this.y),this.z=this.z<0?Math.ceil(this.z):Math.floor(this.z),this},negate:function(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this},dot:function(e){return this.x*e.x+this.y*e.y+this.z*e.z},lengthSq:function(){return this.x*this.x+this.y*this.y+this.z*this.z},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)},manhattanLength:function(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)},normalize:function(){return this.divideScalar(this.length()||1)},setLength:function(e){return this.normalize().multiplyScalar(e)},lerp:function(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this.z+=(e.z-this.z)*t,this},lerpVectors:function(e,t,n){return this.subVectors(t,e).multiplyScalar(n).add(e)},cross:function(e,t){return void 0!==t?(console.warn("THREE.Vector3: .cross() now only accepts one argument. Use .crossVectors( a, b ) instead."),this.crossVectors(e,t)):this.crossVectors(this,e)},crossVectors:function(e,t){var n=e.x,i=e.y,r=e.z,a=t.x,o=t.y,s=t.z;return this.x=i*s-r*o,this.y=r*a-n*s,this.z=n*o-i*a,this},projectOnVector:function(e){var t=e.lengthSq();if(0===t)return this.set(0,0,0);var n=e.dot(this)/t;return this.copy(e).multiplyScalar(n)},projectOnPlane:function(e){return mn.copy(this).projectOnVector(e),this.sub(mn)},reflect:function(e){return this.sub(mn.copy(e).multiplyScalar(2*this.dot(e)))},angleTo:function(e){var t=Math.sqrt(this.lengthSq()*e.lengthSq());if(0===t)return Math.PI/2;var n=this.dot(e)/t;return Math.acos(an.clamp(n,-1,1))},distanceTo:function(e){return Math.sqrt(this.distanceToSquared(e))},distanceToSquared:function(e){var t=this.x-e.x,n=this.y-e.y,i=this.z-e.z;return t*t+n*n+i*i},manhattanDistanceTo:function(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)+Math.abs(this.z-e.z)},setFromSpherical:function(e){return this.setFromSphericalCoords(e.radius,e.phi,e.theta)},setFromSphericalCoords:function(e,t,n){var i=Math.sin(t)*e;return this.x=i*Math.sin(n),this.y=Math.cos(t)*e,this.z=i*Math.cos(n),this},setFromCylindrical:function(e){return this.setFromCylindricalCoords(e.radius,e.theta,e.y)},setFromCylindricalCoords:function(e,t,n){return this.x=e*Math.sin(t),this.y=n,this.z=e*Math.cos(t),this},setFromMatrixPosition:function(e){var t=e.elements;return this.x=t[12],this.y=t[13],this.z=t[14],this},setFromMatrixScale:function(e){var t=this.setFromMatrixColumn(e,0).length(),n=this.setFromMatrixColumn(e,1).length(),i=this.setFromMatrixColumn(e,2).length();return this.x=t,this.y=n,this.z=i,this},setFromMatrixColumn:function(e,t){return this.fromArray(e.elements,4*t)},setFromMatrix3Column:function(e,t){return this.fromArray(e.elements,3*t)},equals:function(e){return e.x===this.x&&e.y===this.y&&e.z===this.z},fromArray:function(e,t){return void 0===t&&(t=0),this.x=e[t],this.y=e[t+1],this.z=e[t+2],this},toArray:function(e,t){return void 0===e&&(e=[]),void 0===t&&(t=0),e[t]=this.x,e[t+1]=this.y,e[t+2]=this.z,e},fromBufferAttribute:function(e,t,n){return void 0!==n&&console.warn("THREE.Vector3: offset has been removed from .fromBufferAttribute()."),this.x=e.getX(t),this.y=e.getY(t),this.z=e.getZ(t),this},random:function(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this}});var yn=new gn,_n=new Tn,xn=new gn(0,0,0),bn=new gn(1,1,1),wn=new gn,Mn=new gn,Sn=new gn;function Tn(){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.")}J(Tn.prototype,{isMatrix4:!0,set:function(e,t,n,i,r,a,o,s,c,l,u,h,d,p,f,m){var v=this.elements;return v[0]=e,v[4]=t,v[8]=n,v[12]=i,v[1]=r,v[5]=a,v[9]=o,v[13]=s,v[2]=c,v[6]=l,v[10]=u,v[14]=h,v[3]=d,v[7]=p,v[11]=f,v[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 Tn).fromArray(this.elements)},copy:function(e){var t=this.elements,n=e.elements;return t[0]=n[0],t[1]=n[1],t[2]=n[2],t[3]=n[3],t[4]=n[4],t[5]=n[5],t[6]=n[6],t[7]=n[7],t[8]=n[8],t[9]=n[9],t[10]=n[10],t[11]=n[11],t[12]=n[12],t[13]=n[13],t[14]=n[14],t[15]=n[15],this},copyPosition:function(e){var t=this.elements,n=e.elements;return t[12]=n[12],t[13]=n[13],t[14]=n[14],this},extractBasis:function(e,t,n){return e.setFromMatrixColumn(this,0),t.setFromMatrixColumn(this,1),n.setFromMatrixColumn(this,2),this},makeBasis:function(e,t,n){return this.set(e.x,t.x,n.x,0,e.y,t.y,n.y,0,e.z,t.z,n.z,0,0,0,0,1),this},extractRotation:function(e){var t=this.elements,n=e.elements,i=1/yn.setFromMatrixColumn(e,0).length(),r=1/yn.setFromMatrixColumn(e,1).length(),a=1/yn.setFromMatrixColumn(e,2).length();return t[0]=n[0]*i,t[1]=n[1]*i,t[2]=n[2]*i,t[3]=0,t[4]=n[4]*r,t[5]=n[5]*r,t[6]=n[6]*r,t[7]=0,t[8]=n[8]*a,t[9]=n[9]*a,t[10]=n[10]*a,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this},makeRotationFromEuler:function(e){e&&e.isEuler||console.error("THREE.Matrix4: .makeRotationFromEuler() now expects a Euler rotation rather than a Vector3 and order.");var t=this.elements,n=e.x,i=e.y,r=e.z,a=Math.cos(n),o=Math.sin(n),s=Math.cos(i),c=Math.sin(i),l=Math.cos(r),u=Math.sin(r);if("XYZ"===e.order){var h=a*l,d=a*u,p=o*l,f=o*u;t[0]=s*l,t[4]=-s*u,t[8]=c,t[1]=d+p*c,t[5]=h-f*c,t[9]=-o*s,t[2]=f-h*c,t[6]=p+d*c,t[10]=a*s}else if("YXZ"===e.order){var m=s*l,v=s*u,g=c*l,y=c*u;t[0]=m+y*o,t[4]=g*o-v,t[8]=a*c,t[1]=a*u,t[5]=a*l,t[9]=-o,t[2]=v*o-g,t[6]=y+m*o,t[10]=a*s}else if("ZXY"===e.order){m=s*l,v=s*u,g=c*l,y=c*u;t[0]=m-y*o,t[4]=-a*u,t[8]=g+v*o,t[1]=v+g*o,t[5]=a*l,t[9]=y-m*o,t[2]=-a*c,t[6]=o,t[10]=a*s}else if("ZYX"===e.order){h=a*l,d=a*u,p=o*l,f=o*u;t[0]=s*l,t[4]=p*c-d,t[8]=h*c+f,t[1]=s*u,t[5]=f*c+h,t[9]=d*c-p,t[2]=-c,t[6]=o*s,t[10]=a*s}else if("YZX"===e.order){var _=a*s,x=a*c,b=o*s,w=o*c;t[0]=s*l,t[4]=w-_*u,t[8]=b*u+x,t[1]=u,t[5]=a*l,t[9]=-o*l,t[2]=-c*l,t[6]=x*u+b,t[10]=_-w*u}else if("XZY"===e.order){_=a*s,x=a*c,b=o*s,w=o*c;t[0]=s*l,t[4]=-u,t[8]=c*l,t[1]=_*u+w,t[5]=a*l,t[9]=x*u-b,t[2]=b*u-x,t[6]=o*l,t[10]=w*u+_}return t[3]=0,t[7]=0,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this},makeRotationFromQuaternion:function(e){return this.compose(xn,e,bn)},lookAt:function(e,t,n){var i=this.elements;return Sn.subVectors(e,t),0===Sn.lengthSq()&&(Sn.z=1),Sn.normalize(),wn.crossVectors(n,Sn),0===wn.lengthSq()&&(1===Math.abs(n.z)?Sn.x+=1e-4:Sn.z+=1e-4,Sn.normalize(),wn.crossVectors(n,Sn)),wn.normalize(),Mn.crossVectors(Sn,wn),i[0]=wn.x,i[4]=Mn.x,i[8]=Sn.x,i[1]=wn.y,i[5]=Mn.y,i[9]=Sn.y,i[2]=wn.z,i[6]=Mn.z,i[10]=Sn.z,this},multiply:function(e,t){return void 0!==t?(console.warn("THREE.Matrix4: .multiply() now only accepts one argument. Use .multiplyMatrices( a, b ) instead."),this.multiplyMatrices(e,t)):this.multiplyMatrices(this,e)},premultiply:function(e){return this.multiplyMatrices(e,this)},multiplyMatrices:function(e,t){var n=e.elements,i=t.elements,r=this.elements,a=n[0],o=n[4],s=n[8],c=n[12],l=n[1],u=n[5],h=n[9],d=n[13],p=n[2],f=n[6],m=n[10],v=n[14],g=n[3],y=n[7],_=n[11],x=n[15],b=i[0],w=i[4],M=i[8],S=i[12],T=i[1],E=i[5],A=i[9],L=i[13],R=i[2],P=i[6],C=i[10],I=i[14],O=i[3],D=i[7],N=i[11],F=i[15];return r[0]=a*b+o*T+s*R+c*O,r[4]=a*w+o*E+s*P+c*D,r[8]=a*M+o*A+s*C+c*N,r[12]=a*S+o*L+s*I+c*F,r[1]=l*b+u*T+h*R+d*O,r[5]=l*w+u*E+h*P+d*D,r[9]=l*M+u*A+h*C+d*N,r[13]=l*S+u*L+h*I+d*F,r[2]=p*b+f*T+m*R+v*O,r[6]=p*w+f*E+m*P+v*D,r[10]=p*M+f*A+m*C+v*N,r[14]=p*S+f*L+m*I+v*F,r[3]=g*b+y*T+_*R+x*O,r[7]=g*w+y*E+_*P+x*D,r[11]=g*M+y*A+_*C+x*N,r[15]=g*S+y*L+_*I+x*F,this},multiplyScalar:function(e){var t=this.elements;return t[0]*=e,t[4]*=e,t[8]*=e,t[12]*=e,t[1]*=e,t[5]*=e,t[9]*=e,t[13]*=e,t[2]*=e,t[6]*=e,t[10]*=e,t[14]*=e,t[3]*=e,t[7]*=e,t[11]*=e,t[15]*=e,this},determinant:function(){var e=this.elements,t=e[0],n=e[4],i=e[8],r=e[12],a=e[1],o=e[5],s=e[9],c=e[13],l=e[2],u=e[6],h=e[10],d=e[14];return e[3]*(r*s*u-i*c*u-r*o*h+n*c*h+i*o*d-n*s*d)+e[7]*(t*s*d-t*c*h+r*a*h-i*a*d+i*c*l-r*s*l)+e[11]*(t*c*u-t*o*d-r*a*u+n*a*d+r*o*l-n*c*l)+e[15]*(-i*o*l-t*s*u+t*o*h+i*a*u-n*a*h+n*s*l)},transpose:function(){var e,t=this.elements;return e=t[1],t[1]=t[4],t[4]=e,e=t[2],t[2]=t[8],t[8]=e,e=t[6],t[6]=t[9],t[9]=e,e=t[3],t[3]=t[12],t[12]=e,e=t[7],t[7]=t[13],t[13]=e,e=t[11],t[11]=t[14],t[14]=e,this},setPosition:function(e,t,n){var i=this.elements;return e.isVector3?(i[12]=e.x,i[13]=e.y,i[14]=e.z):(i[12]=e,i[13]=t,i[14]=n),this},getInverse:function(e,t){void 0!==t&&console.warn("THREE.Matrix4: .getInverse() can no longer be configured to throw on degenerate.");var n=this.elements,i=e.elements,r=i[0],a=i[1],o=i[2],s=i[3],c=i[4],l=i[5],u=i[6],h=i[7],d=i[8],p=i[9],f=i[10],m=i[11],v=i[12],g=i[13],y=i[14],_=i[15],x=p*y*h-g*f*h+g*u*m-l*y*m-p*u*_+l*f*_,b=v*f*h-d*y*h-v*u*m+c*y*m+d*u*_-c*f*_,w=d*g*h-v*p*h+v*l*m-c*g*m-d*l*_+c*p*_,M=v*p*u-d*g*u-v*l*f+c*g*f+d*l*y-c*p*y,S=r*x+a*b+o*w+s*M;if(0==S)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);var T=1/S;return n[0]=x*T,n[1]=(g*f*s-p*y*s-g*o*m+a*y*m+p*o*_-a*f*_)*T,n[2]=(l*y*s-g*u*s+g*o*h-a*y*h-l*o*_+a*u*_)*T,n[3]=(p*u*s-l*f*s-p*o*h+a*f*h+l*o*m-a*u*m)*T,n[4]=b*T,n[5]=(d*y*s-v*f*s+v*o*m-r*y*m-d*o*_+r*f*_)*T,n[6]=(v*u*s-c*y*s-v*o*h+r*y*h+c*o*_-r*u*_)*T,n[7]=(c*f*s-d*u*s+d*o*h-r*f*h-c*o*m+r*u*m)*T,n[8]=w*T,n[9]=(v*p*s-d*g*s-v*a*m+r*g*m+d*a*_-r*p*_)*T,n[10]=(c*g*s-v*l*s+v*a*h-r*g*h-c*a*_+r*l*_)*T,n[11]=(d*l*s-c*p*s-d*a*h+r*p*h+c*a*m-r*l*m)*T,n[12]=M*T,n[13]=(d*g*o-v*p*o+v*a*f-r*g*f-d*a*y+r*p*y)*T,n[14]=(v*l*o-c*g*o-v*a*u+r*g*u+c*a*y-r*l*y)*T,n[15]=(c*p*o-d*l*o+d*a*u-r*p*u-c*a*f+r*l*f)*T,this},scale:function(e){var t=this.elements,n=e.x,i=e.y,r=e.z;return t[0]*=n,t[4]*=i,t[8]*=r,t[1]*=n,t[5]*=i,t[9]*=r,t[2]*=n,t[6]*=i,t[10]*=r,t[3]*=n,t[7]*=i,t[11]*=r,this},getMaxScaleOnAxis:function(){var e=this.elements,t=e[0]*e[0]+e[1]*e[1]+e[2]*e[2],n=e[4]*e[4]+e[5]*e[5]+e[6]*e[6],i=e[8]*e[8]+e[9]*e[9]+e[10]*e[10];return Math.sqrt(Math.max(t,n,i))},makeTranslation:function(e,t,n){return this.set(1,0,0,e,0,1,0,t,0,0,1,n,0,0,0,1),this},makeRotationX:function(e){var t=Math.cos(e),n=Math.sin(e);return this.set(1,0,0,0,0,t,-n,0,0,n,t,0,0,0,0,1),this},makeRotationY:function(e){var t=Math.cos(e),n=Math.sin(e);return this.set(t,0,n,0,0,1,0,0,-n,0,t,0,0,0,0,1),this},makeRotationZ:function(e){var t=Math.cos(e),n=Math.sin(e);return this.set(t,-n,0,0,n,t,0,0,0,0,1,0,0,0,0,1),this},makeRotationAxis:function(e,t){var n=Math.cos(t),i=Math.sin(t),r=1-n,a=e.x,o=e.y,s=e.z,c=r*a,l=r*o;return this.set(c*a+n,c*o-i*s,c*s+i*o,0,c*o+i*s,l*o+n,l*s-i*a,0,c*s-i*o,l*s+i*a,r*s*s+n,0,0,0,0,1),this},makeScale:function(e,t,n){return this.set(e,0,0,0,0,t,0,0,0,0,n,0,0,0,0,1),this},makeShear:function(e,t,n){return this.set(1,t,n,0,e,1,n,0,e,t,1,0,0,0,0,1),this},compose:function(e,t,n){var i=this.elements,r=t._x,a=t._y,o=t._z,s=t._w,c=r+r,l=a+a,u=o+o,h=r*c,d=r*l,p=r*u,f=a*l,m=a*u,v=o*u,g=s*c,y=s*l,_=s*u,x=n.x,b=n.y,w=n.z;return i[0]=(1-(f+v))*x,i[1]=(d+_)*x,i[2]=(p-y)*x,i[3]=0,i[4]=(d-_)*b,i[5]=(1-(h+v))*b,i[6]=(m+g)*b,i[7]=0,i[8]=(p+y)*w,i[9]=(m-g)*w,i[10]=(1-(h+f))*w,i[11]=0,i[12]=e.x,i[13]=e.y,i[14]=e.z,i[15]=1,this},decompose:function(e,t,n){var i=this.elements,r=yn.set(i[0],i[1],i[2]).length(),a=yn.set(i[4],i[5],i[6]).length(),o=yn.set(i[8],i[9],i[10]).length();this.determinant()<0&&(r=-r),e.x=i[12],e.y=i[13],e.z=i[14],_n.copy(this);var s=1/r,c=1/a,l=1/o;return _n.elements[0]*=s,_n.elements[1]*=s,_n.elements[2]*=s,_n.elements[4]*=c,_n.elements[5]*=c,_n.elements[6]*=c,_n.elements[8]*=l,_n.elements[9]*=l,_n.elements[10]*=l,t.setFromRotationMatrix(_n),n.x=r,n.y=a,n.z=o,this},makePerspective:function(e,t,n,i,r,a){void 0===a&&console.warn("THREE.Matrix4: .makePerspective() has been redefined and has a new signature. Please check the docs.");var o=this.elements,s=2*r/(t-e),c=2*r/(n-i),l=(t+e)/(t-e),u=(n+i)/(n-i),h=-(a+r)/(a-r),d=-2*a*r/(a-r);return o[0]=s,o[4]=0,o[8]=l,o[12]=0,o[1]=0,o[5]=c,o[9]=u,o[13]=0,o[2]=0,o[6]=0,o[10]=h,o[14]=d,o[3]=0,o[7]=0,o[11]=-1,o[15]=0,this},makeOrthographic:function(e,t,n,i,r,a){var o=this.elements,s=1/(t-e),c=1/(n-i),l=1/(a-r),u=(t+e)*s,h=(n+i)*c,d=(a+r)*l;return o[0]=2*s,o[4]=0,o[8]=0,o[12]=-u,o[1]=0,o[5]=2*c,o[9]=0,o[13]=-h,o[2]=0,o[6]=0,o[10]=-2*l,o[14]=-d,o[3]=0,o[7]=0,o[11]=0,o[15]=1,this},equals:function(e){for(var t=this.elements,n=e.elements,i=0;i<16;i++)if(t[i]!==n[i])return!1;return!0},fromArray:function(e,t){void 0===t&&(t=0);for(var n=0;n<16;n++)this.elements[n]=e[n+t];return this},toArray:function(e,t){void 0===e&&(e=[]),void 0===t&&(t=0);var n=this.elements;return e[t]=n[0],e[t+1]=n[1],e[t+2]=n[2],e[t+3]=n[3],e[t+4]=n[4],e[t+5]=n[5],e[t+6]=n[6],e[t+7]=n[7],e[t+8]=n[8],e[t+9]=n[9],e[t+10]=n[10],e[t+11]=n[11],e[t+12]=n[12],e[t+13]=n[13],e[t+14]=n[14],e[t+15]=n[15],e}});var En=new Tn,An=new fn;function Ln(e,t,n,i){this._x=e||0,this._y=t||0,this._z=n||0,this._order=i||Ln.DefaultOrder}function Rn(){this.mask=1}Ln.RotationOrders=["XYZ","YZX","ZXY","XZY","YXZ","ZYX"],Ln.DefaultOrder="XYZ",Object.defineProperties(Ln.prototype,{x:{get:function(){return this._x},set:function(e){this._x=e,this._onChangeCallback()}},y:{get:function(){return this._y},set:function(e){this._y=e,this._onChangeCallback()}},z:{get:function(){return this._z},set:function(e){this._z=e,this._onChangeCallback()}},order:{get:function(){return this._order},set:function(e){this._order=e,this._onChangeCallback()}}}),J(Ln.prototype,{isEuler:!0,set:function(e,t,n,i){return this._x=e,this._y=t,this._z=n,this._order=i||this._order,this._onChangeCallback(),this},clone:function(){return new this.constructor(this._x,this._y,this._z,this._order)},copy:function(e){return this._x=e._x,this._y=e._y,this._z=e._z,this._order=e._order,this._onChangeCallback(),this},setFromRotationMatrix:function(e,t,n){var i=an.clamp,r=e.elements,a=r[0],o=r[4],s=r[8],c=r[1],l=r[5],u=r[9],h=r[2],d=r[6],p=r[10];switch(t=t||this._order){case"XYZ":this._y=Math.asin(i(s,-1,1)),Math.abs(s)<.9999999?(this._x=Math.atan2(-u,p),this._z=Math.atan2(-o,a)):(this._x=Math.atan2(d,l),this._z=0);break;case"YXZ":this._x=Math.asin(-i(u,-1,1)),Math.abs(u)<.9999999?(this._y=Math.atan2(s,p),this._z=Math.atan2(c,l)):(this._y=Math.atan2(-h,a),this._z=0);break;case"ZXY":this._x=Math.asin(i(d,-1,1)),Math.abs(d)<.9999999?(this._y=Math.atan2(-h,p),this._z=Math.atan2(-o,l)):(this._y=0,this._z=Math.atan2(c,a));break;case"ZYX":this._y=Math.asin(-i(h,-1,1)),Math.abs(h)<.9999999?(this._x=Math.atan2(d,p),this._z=Math.atan2(c,a)):(this._x=0,this._z=Math.atan2(-o,l));break;case"YZX":this._z=Math.asin(i(c,-1,1)),Math.abs(c)<.9999999?(this._x=Math.atan2(-u,l),this._y=Math.atan2(-h,a)):(this._x=0,this._y=Math.atan2(s,p));break;case"XZY":this._z=Math.asin(-i(o,-1,1)),Math.abs(o)<.9999999?(this._x=Math.atan2(d,l),this._y=Math.atan2(s,a)):(this._x=Math.atan2(-u,p),this._y=0);break;default:console.warn("THREE.Euler: .setFromRotationMatrix() encountered an unknown order: "+t)}return this._order=t,!1!==n&&this._onChangeCallback(),this},setFromQuaternion:function(e,t,n){return En.makeRotationFromQuaternion(e),this.setFromRotationMatrix(En,t,n)},setFromVector3:function(e,t){return this.set(e.x,e.y,e.z,t||this._order)},reorder:function(e){return An.setFromEuler(this),this.setFromQuaternion(An,e)},equals:function(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._order===this._order},fromArray:function(e){return this._x=e[0],this._y=e[1],this._z=e[2],void 0!==e[3]&&(this._order=e[3]),this._onChangeCallback(),this},toArray:function(e,t){return void 0===e&&(e=[]),void 0===t&&(t=0),e[t]=this._x,e[t+1]=this._y,e[t+2]=this._z,e[t+3]=this._order,e},toVector3:function(e){return e?e.set(this._x,this._y,this._z):new gn(this._x,this._y,this._z)},_onChange:function(e){return this._onChangeCallback=e,this},_onChangeCallback:function(){}}),J(Rn.prototype,{set:function(e){this.mask=1<<e|0},enable:function(e){this.mask|=1<<e|0},enableAll:function(){this.mask=-1},toggle:function(e){this.mask^=1<<e|0},disable:function(e){this.mask&=~(1<<e|0)},disableAll:function(){this.mask=0},test:function(e){return 0!=(this.mask&e.mask)}});var Pn=0,Cn=new gn,In=new fn,On=new Tn,Dn=new gn,Nn=new gn,Fn=new gn,zn=new fn,Un=new gn(1,0,0),Bn=new gn(0,1,0),Gn=new gn(0,0,1),Hn={type:"added"},kn={type:"removed"};function Vn(){Object.defineProperty(this,"id",{value:Pn++}),this.uuid=an.generateUUID(),this.name="",this.type="Object3D",this.parent=null,this.children=[],this.up=Vn.DefaultUp.clone();var e=new gn,t=new Ln,n=new fn,i=new gn(1,1,1);t._onChange(function(){n.setFromEuler(t,!1)}),n._onChange(function(){t.setFromQuaternion(n,void 0,!1)}),Object.defineProperties(this,{position:{configurable:!0,enumerable:!0,value:e},rotation:{configurable:!0,enumerable:!0,value:t},quaternion:{configurable:!0,enumerable:!0,value:n},scale:{configurable:!0,enumerable:!0,value:i},modelViewMatrix:{value:new Tn},normalMatrix:{value:new sn}}),this.matrix=new Tn,this.matrixWorld=new Tn,this.matrixAutoUpdate=Vn.DefaultMatrixAutoUpdate,this.matrixWorldNeedsUpdate=!1,this.layers=new Rn,this.visible=!0,this.castShadow=!1,this.receiveShadow=!1,this.frustumCulled=!0,this.renderOrder=0,this.userData={}}function jn(){Vn.call(this),this.type="Scene",this.background=null,this.environment=null,this.fog=null,this.overrideMaterial=null,this.autoUpdate=!0,"undefined"!=typeof __THREE_DEVTOOLS__&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}Vn.DefaultUp=new gn(0,1,0),Vn.DefaultMatrixAutoUpdate=!0,Vn.prototype=J(Object.create(en.prototype),{constructor:Vn,isObject3D:!0,onBeforeRender:function(){},onAfterRender:function(){},applyMatrix4:function(e){this.matrixAutoUpdate&&this.updateMatrix(),this.matrix.premultiply(e),this.matrix.decompose(this.position,this.quaternion,this.scale)},applyQuaternion:function(e){return this.quaternion.premultiply(e),this},setRotationFromAxisAngle:function(e,t){this.quaternion.setFromAxisAngle(e,t)},setRotationFromEuler:function(e){this.quaternion.setFromEuler(e,!0)},setRotationFromMatrix:function(e){this.quaternion.setFromRotationMatrix(e)},setRotationFromQuaternion:function(e){this.quaternion.copy(e)},rotateOnAxis:function(e,t){return In.setFromAxisAngle(e,t),this.quaternion.multiply(In),this},rotateOnWorldAxis:function(e,t){return In.setFromAxisAngle(e,t),this.quaternion.premultiply(In),this},rotateX:function(e){return this.rotateOnAxis(Un,e)},rotateY:function(e){return this.rotateOnAxis(Bn,e)},rotateZ:function(e){return this.rotateOnAxis(Gn,e)},translateOnAxis:function(e,t){return Cn.copy(e).applyQuaternion(this.quaternion),this.position.add(Cn.multiplyScalar(t)),this},translateX:function(e){return this.translateOnAxis(Un,e)},translateY:function(e){return this.translateOnAxis(Bn,e)},translateZ:function(e){return this.translateOnAxis(Gn,e)},localToWorld:function(e){return e.applyMatrix4(this.matrixWorld)},worldToLocal:function(e){return e.applyMatrix4(On.getInverse(this.matrixWorld))},lookAt:function(e,t,n){e.isVector3?Dn.copy(e):Dn.set(e,t,n);var i=this.parent;this.updateWorldMatrix(!0,!1),Nn.setFromMatrixPosition(this.matrixWorld),this.isCamera||this.isLight?On.lookAt(Nn,Dn,this.up):On.lookAt(Dn,Nn,this.up),this.quaternion.setFromRotationMatrix(On),i&&(On.extractRotation(i.matrixWorld),In.setFromRotationMatrix(On),this.quaternion.premultiply(In.inverse()))},add:function(e){if(1<arguments.length){for(var t=0;t<arguments.length;t++)this.add(arguments[t]);return this}return e===this?console.error("THREE.Object3D.add: object can't be added as a child of itself.",e):e&&e.isObject3D?(null!==e.parent&&e.parent.remove(e),(e.parent=this).children.push(e),e.dispatchEvent(Hn)):console.error("THREE.Object3D.add: object not an instance of THREE.Object3D.",e),this},remove:function(e){if(1<arguments.length){for(var t=0;t<arguments.length;t++)this.remove(arguments[t]);return this}var n=this.children.indexOf(e);return-1!==n&&(e.parent=null,this.children.splice(n,1),e.dispatchEvent(kn)),this},attach:function(e){return this.updateWorldMatrix(!0,!1),On.getInverse(this.matrixWorld),null!==e.parent&&(e.parent.updateWorldMatrix(!0,!1),On.multiply(e.parent.matrixWorld)),e.applyMatrix4(On),e.updateWorldMatrix(!1,!1),this.add(e),this},getObjectById:function(e){return this.getObjectByProperty("id",e)},getObjectByName:function(e){return this.getObjectByProperty("name",e)},getObjectByProperty:function(e,t){if(this[e]===t)return this;for(var n=0,i=this.children.length;n<i;n++){var r=this.children[n].getObjectByProperty(e,t);if(void 0!==r)return r}},getWorldPosition:function(e){return void 0===e&&(console.warn("THREE.Object3D: .getWorldPosition() target is now required"),e=new gn),this.updateMatrixWorld(!0),e.setFromMatrixPosition(this.matrixWorld)},getWorldQuaternion:function(e){return void 0===e&&(console.warn("THREE.Object3D: .getWorldQuaternion() target is now required"),e=new fn),this.updateMatrixWorld(!0),this.matrixWorld.decompose(Nn,e,Fn),e},getWorldScale:function(e){return void 0===e&&(console.warn("THREE.Object3D: .getWorldScale() target is now required"),e=new gn),this.updateMatrixWorld(!0),this.matrixWorld.decompose(Nn,zn,e),e},getWorldDirection:function(e){void 0===e&&(console.warn("THREE.Object3D: .getWorldDirection() target is now required"),e=new gn),this.updateMatrixWorld(!0);var t=this.matrixWorld.elements;return e.set(t[8],t[9],t[10]).normalize()},raycast:function(){},traverse:function(e){e(this);for(var t=this.children,n=0,i=t.length;n<i;n++)t[n].traverse(e)},traverseVisible:function(e){if(!1!==this.visible){e(this);for(var t=this.children,n=0,i=t.length;n<i;n++)t[n].traverseVisible(e)}},traverseAncestors:function(e){var t=this.parent;null!==t&&(e(t),t.traverseAncestors(e))},updateMatrix:function(){this.matrix.compose(this.position,this.quaternion,this.scale),this.matrixWorldNeedsUpdate=!0},updateMatrixWorld:function(e){this.matrixAutoUpdate&&this.updateMatrix(),(this.matrixWorldNeedsUpdate||e)&&(null===this.parent?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix),e=!(this.matrixWorldNeedsUpdate=!1));for(var t=this.children,n=0,i=t.length;n<i;n++)t[n].updateMatrixWorld(e)},updateWorldMatrix:function(e,t){var n=this.parent;if(!0===e&&null!==n&&n.updateWorldMatrix(!0,!1),this.matrixAutoUpdate&&this.updateMatrix(),null===this.parent?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix),!0===t)for(var i=this.children,r=0,a=i.length;r<a;r++)i[r].updateWorldMatrix(!1,!0)},toJSON:function(n){var e=void 0===n||"string"==typeof n,t={};e&&(n={geometries:{},materials:{},textures:{},images:{},shapes:{}},t.metadata={version:4.5,type:"Object",generator:"Object3D.toJSON"});var i={};function r(e,t){return void 0===e[t.uuid]&&(e[t.uuid]=t.toJSON(n)),t.uuid}if(i.uuid=this.uuid,i.type=this.type,""!==this.name&&(i.name=this.name),!0===this.castShadow&&(i.castShadow=!0),!0===this.receiveShadow&&(i.receiveShadow=!0),!1===this.visible&&(i.visible=!1),!1===this.frustumCulled&&(i.frustumCulled=!1),0!==this.renderOrder&&(i.renderOrder=this.renderOrder),"{}"!==JSON.stringify(this.userData)&&(i.userData=this.userData),i.layers=this.layers.mask,i.matrix=this.matrix.toArray(),!1===this.matrixAutoUpdate&&(i.matrixAutoUpdate=!1),this.isInstancedMesh&&(i.type="InstancedMesh",i.count=this.count,i.instanceMatrix=this.instanceMatrix.toJSON()),this.isMesh||this.isLine||this.isPoints){i.geometry=r(n.geometries,this.geometry);var a=this.geometry.parameters;if(void 0!==a&&void 0!==a.shapes){var o=a.shapes;if(Array.isArray(o))for(var s=0,c=o.length;s<c;s++){var l=o[s];r(n.shapes,l)}else r(n.shapes,o)}}if(void 0!==this.material)if(Array.isArray(this.material)){var u=[];for(s=0,c=this.material.length;s<c;s++)u.push(r(n.materials,this.material[s]));i.material=u}else i.material=r(n.materials,this.material);if(0<this.children.length){i.children=[];for(s=0;s<this.children.length;s++)i.children.push(this.children[s].toJSON(n).object)}if(e){var h=m(n.geometries),d=m(n.materials),p=m(n.textures),f=m(n.images);o=m(n.shapes);0<h.length&&(t.geometries=h),0<d.length&&(t.materials=d),0<p.length&&(t.textures=p),0<f.length&&(t.images=f),0<o.length&&(t.shapes=o)}return t.object=i,t;function m(e){var t=[];for(var n in e){var i=e[n];delete i.metadata,t.push(i)}return t}},clone:function(e){return(new this.constructor).copy(this,e)},copy:function(e,t){if(void 0===t&&(t=!0),this.name=e.name,this.up.copy(e.up),this.position.copy(e.position),this.quaternion.copy(e.quaternion),this.scale.copy(e.scale),this.matrix.copy(e.matrix),this.matrixWorld.copy(e.matrixWorld),this.matrixAutoUpdate=e.matrixAutoUpdate,this.matrixWorldNeedsUpdate=e.matrixWorldNeedsUpdate,this.layers.mask=e.layers.mask,this.visible=e.visible,this.castShadow=e.castShadow,this.receiveShadow=e.receiveShadow,this.frustumCulled=e.frustumCulled,this.renderOrder=e.renderOrder,this.userData=JSON.parse(JSON.stringify(e.userData)),!0===t)for(var n=0;n<e.children.length;n++){var i=e.children[n];this.add(i.clone())}return this}}),jn.prototype=J(Object.create(Vn.prototype),{constructor:jn,isScene:!0,copy:function(e,t){return Vn.prototype.copy.call(this,e,t),null!==e.background&&(this.background=e.background.clone()),null!==e.environment&&(this.environment=e.environment.clone()),null!==e.fog&&(this.fog=e.fog.clone()),null!==e.overrideMaterial&&(this.overrideMaterial=e.overrideMaterial.clone()),this.autoUpdate=e.autoUpdate,this.matrixAutoUpdate=e.matrixAutoUpdate,this},toJSON:function(e){var t=Vn.prototype.toJSON.call(this,e);return null!==this.background&&(t.object.background=this.background.toJSON(e)),null!==this.environment&&(t.object.environment=this.environment.toJSON(e)),null!==this.fog&&(t.object.fog=this.fog.toJSON()),t},dispose:function(){this.dispatchEvent({type:"dispose"})}});var Wn=[new gn,new gn,new gn,new gn,new gn,new gn,new gn,new gn],qn=new gn,Xn=new ri,Yn=new gn,Zn=new gn,Jn=new gn,Kn=new gn,Qn=new gn,$n=new gn,ei=new gn,ti=new gn,ni=new gn,ii=new gn;function ri(e,t){this.min=void 0!==e?e:new gn(1/0,1/0,1/0),this.max=void 0!==t?t:new gn(-1/0,-1/0,-1/0)}function ai(e,t,n,i,r){var a,o;for(a=0,o=e.length-3;a<=o;a+=3){ii.fromArray(e,a);var s=r.x*Math.abs(ii.x)+r.y*Math.abs(ii.y)+r.z*Math.abs(ii.z),c=t.dot(ii),l=n.dot(ii),u=i.dot(ii);if(Math.max(-Math.max(c,l,u),Math.min(c,l,u))>s)return!1}return!0}J(ri.prototype,{isBox3:!0,set:function(e,t){return this.min.copy(e),this.max.copy(t),this},setFromArray:function(e){for(var t=1/0,n=1/0,i=1/0,r=-1/0,a=-1/0,o=-1/0,s=0,c=e.length;s<c;s+=3){var l=e[s],u=e[s+1],h=e[s+2];l<t&&(t=l),u<n&&(n=u),h<i&&(i=h),r<l&&(r=l),a<u&&(a=u),o<h&&(o=h)}return this.min.set(t,n,i),this.max.set(r,a,o),this},setFromBufferAttribute:function(e){for(var t=1/0,n=1/0,i=1/0,r=-1/0,a=-1/0,o=-1/0,s=0,c=e.count;s<c;s++){var l=e.getX(s),u=e.getY(s),h=e.getZ(s);l<t&&(t=l),u<n&&(n=u),h<i&&(i=h),r<l&&(r=l),a<u&&(a=u),o<h&&(o=h)}return this.min.set(t,n,i),this.max.set(r,a,o),this},setFromPoints:function(e){this.makeEmpty();for(var t=0,n=e.length;t<n;t++)this.expandByPoint(e[t]);return this},setFromCenterAndSize:function(e,t){var n=qn.copy(t).multiplyScalar(.5);return this.min.copy(e).sub(n),this.max.copy(e).add(n),this},setFromObject:function(e){return this.makeEmpty(),this.expandByObject(e)},clone:function(){return(new this.constructor).copy(this)},copy:function(e){return this.min.copy(e.min),this.max.copy(e.max),this},makeEmpty:function(){return this.min.x=this.min.y=this.min.z=1/0,this.max.x=this.max.y=this.max.z=-1/0,this},isEmpty:function(){return this.max.x<this.min.x||this.max.y<this.min.y||this.max.z<this.min.z},getCenter:function(e){return void 0===e&&(console.warn("THREE.Box3: .getCenter() target is now required"),e=new gn),this.isEmpty()?e.set(0,0,0):e.addVectors(this.min,this.max).multiplyScalar(.5)},getSize:function(e){return void 0===e&&(console.warn("THREE.Box3: .getSize() target is now required"),e=new gn),this.isEmpty()?e.set(0,0,0):e.subVectors(this.max,this.min)},expandByPoint:function(e){return this.min.min(e),this.max.max(e),this},expandByVector:function(e){return this.min.sub(e),this.max.add(e),this},expandByScalar:function(e){return this.min.addScalar(-e),this.max.addScalar(e),this},expandByObject:function(e){e.updateWorldMatrix(!1,!1);var t=e.geometry;void 0!==t&&(null===t.boundingBox&&t.computeBoundingBox(),Xn.copy(t.boundingBox),Xn.applyMatrix4(e.matrixWorld),this.union(Xn));for(var n=e.children,i=0,r=n.length;i<r;i++)this.expandByObject(n[i]);return this},containsPoint:function(e){return!(e.x<this.min.x||e.x>this.max.x||e.y<this.min.y||e.y>this.max.y||e.z<this.min.z||e.z>this.max.z)},containsBox:function(e){return this.min.x<=e.min.x&&e.max.x<=this.max.x&&this.min.y<=e.min.y&&e.max.y<=this.max.y&&this.min.z<=e.min.z&&e.max.z<=this.max.z},getParameter:function(e,t){return void 0===t&&(console.warn("THREE.Box3: .getParameter() target is now required"),t=new gn),t.set((e.x-this.min.x)/(this.max.x-this.min.x),(e.y-this.min.y)/(this.max.y-this.min.y),(e.z-this.min.z)/(this.max.z-this.min.z))},intersectsBox:function(e){return!(e.max.x<this.min.x||e.min.x>this.max.x||e.max.y<this.min.y||e.min.y>this.max.y||e.max.z<this.min.z||e.min.z>this.max.z)},intersectsSphere:function(e){return this.clampPoint(e.center,qn),qn.distanceToSquared(e.center)<=e.radius*e.radius},intersectsPlane:function(e){var t,n;return n=0<e.normal.x?(t=e.normal.x*this.min.x,e.normal.x*this.max.x):(t=e.normal.x*this.max.x,e.normal.x*this.min.x),0<e.normal.y?(t+=e.normal.y*this.min.y,n+=e.normal.y*this.max.y):(t+=e.normal.y*this.max.y,n+=e.normal.y*this.min.y),0<e.normal.z?(t+=e.normal.z*this.min.z,n+=e.normal.z*this.max.z):(t+=e.normal.z*this.max.z,n+=e.normal.z*this.min.z),t<=-e.constant&&n>=-e.constant},intersectsTriangle:function(e){if(this.isEmpty())return!1;this.getCenter(ei),ti.subVectors(this.max,ei),Yn.subVectors(e.a,ei),Zn.subVectors(e.b,ei),Jn.subVectors(e.c,ei),Kn.subVectors(Zn,Yn),Qn.subVectors(Jn,Zn),$n.subVectors(Yn,Jn);var t=[0,-Kn.z,Kn.y,0,-Qn.z,Qn.y,0,-$n.z,$n.y,Kn.z,0,-Kn.x,Qn.z,0,-Qn.x,$n.z,0,-$n.x,-Kn.y,Kn.x,0,-Qn.y,Qn.x,0,-$n.y,$n.x,0];return!!ai(t,Yn,Zn,Jn,ti)&&(!!ai(t=[1,0,0,0,1,0,0,0,1],Yn,Zn,Jn,ti)&&(ni.crossVectors(Kn,Qn),ai(t=[ni.x,ni.y,ni.z],Yn,Zn,Jn,ti)))},clampPoint:function(e,t){return void 0===t&&(console.warn("THREE.Box3: .clampPoint() target is now required"),t=new gn),t.copy(e).clamp(this.min,this.max)},distanceToPoint:function(e){return qn.copy(e).clamp(this.min,this.max).sub(e).length()},getBoundingSphere:function(e){return void 0===e&&console.error("THREE.Box3: .getBoundingSphere() target is now required"),this.getCenter(e.center),e.radius=.5*this.getSize(qn).length(),e},intersect:function(e){return this.min.max(e.min),this.max.min(e.max),this.isEmpty()&&this.makeEmpty(),this},union:function(e){return this.min.min(e.min),this.max.max(e.max),this},applyMatrix4:function(e){return this.isEmpty()||(Wn[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(e),Wn[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(e),Wn[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(e),Wn[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(e),Wn[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(e),Wn[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(e),Wn[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(e),Wn[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(e),this.setFromPoints(Wn)),this},translate:function(e){return this.min.add(e),this.max.add(e),this},equals:function(e){return e.min.equals(this.min)&&e.max.equals(this.max)}});var oi=new ri;function si(e,t){this.center=void 0!==e?e:new gn,this.radius=void 0!==t?t:-1}J(si.prototype,{set:function(e,t){return this.center.copy(e),this.radius=t,this},setFromPoints:function(e,t){var n=this.center;void 0!==t?n.copy(t):oi.setFromPoints(e).getCenter(n);for(var i=0,r=0,a=e.length;r<a;r++)i=Math.max(i,n.distanceToSquared(e[r]));return this.radius=Math.sqrt(i),this},clone:function(){return(new this.constructor).copy(this)},copy:function(e){return this.center.copy(e.center),this.radius=e.radius,this},isEmpty:function(){return this.radius<0},makeEmpty:function(){return this.center.set(0,0,0),this.radius=-1,this},containsPoint:function(e){return e.distanceToSquared(this.center)<=this.radius*this.radius},distanceToPoint:function(e){return e.distanceTo(this.center)-this.radius},intersectsSphere:function(e){var t=this.radius+e.radius;return e.center.distanceToSquared(this.center)<=t*t},intersectsBox:function(e){return e.intersectsSphere(this)},intersectsPlane:function(e){return Math.abs(e.distanceToPoint(this.center))<=this.radius},clampPoint:function(e,t){var n=this.center.distanceToSquared(e);return void 0===t&&(console.warn("THREE.Sphere: .clampPoint() target is now required"),t=new gn),t.copy(e),n>this.radius*this.radius&&(t.sub(this.center).normalize(),t.multiplyScalar(this.radius).add(this.center)),t},getBoundingBox:function(e){return void 0===e&&(console.warn("THREE.Sphere: .getBoundingBox() target is now required"),e=new ri),this.isEmpty()?e.makeEmpty():(e.set(this.center,this.center),e.expandByScalar(this.radius)),e},applyMatrix4:function(e){return this.center.applyMatrix4(e),this.radius=this.radius*e.getMaxScaleOnAxis(),this},translate:function(e){return this.center.add(e),this},equals:function(e){return e.center.equals(this.center)&&e.radius===this.radius}});var ci=new gn,li=new gn,ui=new gn,hi=new gn,di=new gn,pi=new gn,fi=new gn;function mi(e,t){this.origin=void 0!==e?e:new gn,this.direction=void 0!==t?t:new gn(0,0,-1)}J(mi.prototype,{set:function(e,t){return this.origin.copy(e),this.direction.copy(t),this},clone:function(){return(new this.constructor).copy(this)},copy:function(e){return this.origin.copy(e.origin),this.direction.copy(e.direction),this},at:function(e,t){return void 0===t&&(console.warn("THREE.Ray: .at() target is now required"),t=new gn),t.copy(this.direction).multiplyScalar(e).add(this.origin)},lookAt:function(e){return this.direction.copy(e).sub(this.origin).normalize(),this},recast:function(e){return this.origin.copy(this.at(e,ci)),this},closestPointToPoint:function(e,t){void 0===t&&(console.warn("THREE.Ray: .closestPointToPoint() target is now required"),t=new gn),t.subVectors(e,this.origin);var n=t.dot(this.direction);return n<0?t.copy(this.origin):t.copy(this.direction).multiplyScalar(n).add(this.origin)},distanceToPoint:function(e){return Math.sqrt(this.distanceSqToPoint(e))},distanceSqToPoint:function(e){var t=ci.subVectors(e,this.origin).dot(this.direction);return t<0?this.origin.distanceToSquared(e):(ci.copy(this.direction).multiplyScalar(t).add(this.origin),ci.distanceToSquared(e))},distanceSqToSegment:function(e,t,n,i){li.copy(e).add(t).multiplyScalar(.5),ui.copy(t).sub(e).normalize(),hi.copy(this.origin).sub(li);var r,a,o,s,c=.5*e.distanceTo(t),l=-this.direction.dot(ui),u=hi.dot(this.direction),h=-hi.dot(ui),d=hi.lengthSq(),p=Math.abs(1-l*l);if(0<p)if(a=l*u-h,s=c*p,0<=(r=l*h-u))if(-s<=a)if(a<=s){var f=1/p;o=(r*=f)*(r+l*(a*=f)+2*u)+a*(l*r+a+2*h)+d}else a=c,o=-(r=Math.max(0,-(l*a+u)))*r+a*(a+2*h)+d;else a=-c,o=-(r=Math.max(0,-(l*a+u)))*r+a*(a+2*h)+d;else o=a<=-s?-(r=Math.max(0,-(-l*c+u)))*r+(a=0<r?-c:Math.min(Math.max(-c,-h),c))*(a+2*h)+d:a<=s?(r=0,(a=Math.min(Math.max(-c,-h),c))*(a+2*h)+d):-(r=Math.max(0,-(l*c+u)))*r+(a=0<r?c:Math.min(Math.max(-c,-h),c))*(a+2*h)+d;else a=0<l?-c:c,o=-(r=Math.max(0,-(l*a+u)))*r+a*(a+2*h)+d;return n&&n.copy(this.direction).multiplyScalar(r).add(this.origin),i&&i.copy(ui).multiplyScalar(a).add(li),o},intersectSphere:function(e,t){ci.subVectors(e.center,this.origin);var n=ci.dot(this.direction),i=ci.dot(ci)-n*n,r=e.radius*e.radius;if(r<i)return null;var a=Math.sqrt(r-i),o=n-a,s=n+a;return o<0&&s<0?null:o<0?this.at(s,t):this.at(o,t)},intersectsSphere:function(e){return this.distanceSqToPoint(e.center)<=e.radius*e.radius},distanceToPlane:function(e){var t=e.normal.dot(this.direction);if(0===t)return 0===e.distanceToPoint(this.origin)?0:null;var n=-(this.origin.dot(e.normal)+e.constant)/t;return 0<=n?n:null},intersectPlane:function(e,t){var n=this.distanceToPlane(e);return null===n?null:this.at(n,t)},intersectsPlane:function(e){var t=e.distanceToPoint(this.origin);return 0===t||e.normal.dot(this.direction)*t<0},intersectBox:function(e,t){var n,i,r,a,o,s,c=1/this.direction.x,l=1/this.direction.y,u=1/this.direction.z,h=this.origin;return i=0<=c?(n=(e.min.x-h.x)*c,(e.max.x-h.x)*c):(n=(e.max.x-h.x)*c,(e.min.x-h.x)*c),(a=0<=l?(r=(e.min.y-h.y)*l,(e.max.y-h.y)*l):(r=(e.max.y-h.y)*l,(e.min.y-h.y)*l))<n||i<r?null:((n<r||n!=n)&&(n=r),(a<i||i!=i)&&(i=a),(s=0<=u?(o=(e.min.z-h.z)*u,(e.max.z-h.z)*u):(o=(e.max.z-h.z)*u,(e.min.z-h.z)*u))<n||i<o?null:((n<o||n!=n)&&(n=o),(s<i||i!=i)&&(i=s),i<0?null:this.at(0<=n?n:i,t)))},intersectsBox:function(e){return null!==this.intersectBox(e,ci)},intersectTriangle:function(e,t,n,i,r){di.subVectors(t,e),pi.subVectors(n,e),fi.crossVectors(di,pi);var a,o=this.direction.dot(fi);if(0<o){if(i)return null;a=1}else{if(!(o<0))return null;a=-1,o=-o}hi.subVectors(this.origin,e);var s=a*this.direction.dot(pi.crossVectors(hi,pi));if(s<0)return null;var c=a*this.direction.dot(di.cross(hi));if(c<0)return null;if(o<s+c)return null;var l=-a*hi.dot(fi);return l<0?null:this.at(l/o,r)},applyMatrix4:function(e){return this.origin.applyMatrix4(e),this.direction.transformDirection(e),this},equals:function(e){return e.origin.equals(this.origin)&&e.direction.equals(this.direction)}});var vi=new gn,gi=new gn,yi=new sn;function _i(e,t){this.normal=void 0!==e?e:new gn(1,0,0),this.constant=void 0!==t?t:0}J(_i.prototype,{isPlane:!0,set:function(e,t){return this.normal.copy(e),this.constant=t,this},setComponents:function(e,t,n,i){return this.normal.set(e,t,n),this.constant=i,this},setFromNormalAndCoplanarPoint:function(e,t){return this.normal.copy(e),this.constant=-t.dot(this.normal),this},setFromCoplanarPoints:function(e,t,n){var i=vi.subVectors(n,t).cross(gi.subVectors(e,t)).normalize();return this.setFromNormalAndCoplanarPoint(i,e),this},clone:function(){return(new this.constructor).copy(this)},copy:function(e){return this.normal.copy(e.normal),this.constant=e.constant,this},normalize:function(){var e=1/this.normal.length();return this.normal.multiplyScalar(e),this.constant*=e,this},negate:function(){return this.constant*=-1,this.normal.negate(),this},distanceToPoint:function(e){return this.normal.dot(e)+this.constant},distanceToSphere:function(e){return this.distanceToPoint(e.center)-e.radius},projectPoint:function(e,t){return void 0===t&&(console.warn("THREE.Plane: .projectPoint() target is now required"),t=new gn),t.copy(this.normal).multiplyScalar(-this.distanceToPoint(e)).add(e)},intersectLine:function(e,t){void 0===t&&(console.warn("THREE.Plane: .intersectLine() target is now required"),t=new gn);var n=e.delta(vi),i=this.normal.dot(n);if(0===i)return 0===this.distanceToPoint(e.start)?t.copy(e.start):void 0;var r=-(e.start.dot(this.normal)+this.constant)/i;return r<0||1<r?void 0:t.copy(n).multiplyScalar(r).add(e.start)},intersectsLine:function(e){var t=this.distanceToPoint(e.start),n=this.distanceToPoint(e.end);return t<0&&0<n||n<0&&0<t},intersectsBox:function(e){return e.intersectsPlane(this)},intersectsSphere:function(e){return e.intersectsPlane(this)},coplanarPoint:function(e){return void 0===e&&(console.warn("THREE.Plane: .coplanarPoint() target is now required"),e=new gn),e.copy(this.normal).multiplyScalar(-this.constant)},applyMatrix4:function(e,t){var n=t||yi.getNormalMatrix(e),i=this.coplanarPoint(vi).applyMatrix4(e),r=this.normal.applyMatrix3(n).normalize();return this.constant=-i.dot(r),this},translate:function(e){return this.constant-=e.dot(this.normal),this},equals:function(e){return e.normal.equals(this.normal)&&e.constant===this.constant}});var xi=new gn,bi=new gn,wi=new gn,Mi=new gn,Si=new gn,Ti=new gn,Ei=new gn,Ai=new gn,Li=new gn,Ri=new gn;function Pi(e,t,n){this.a=void 0!==e?e:new gn,this.b=void 0!==t?t:new gn,this.c=void 0!==n?n:new gn}J(Pi,{getNormal:function(e,t,n,i){void 0===i&&(console.warn("THREE.Triangle: .getNormal() target is now required"),i=new gn),i.subVectors(n,t),xi.subVectors(e,t),i.cross(xi);var r=i.lengthSq();return 0<r?i.multiplyScalar(1/Math.sqrt(r)):i.set(0,0,0)},getBarycoord:function(e,t,n,i,r){xi.subVectors(i,t),bi.subVectors(n,t),wi.subVectors(e,t);var a=xi.dot(xi),o=xi.dot(bi),s=xi.dot(wi),c=bi.dot(bi),l=bi.dot(wi),u=a*c-o*o;if(void 0===r&&(console.warn("THREE.Triangle: .getBarycoord() target is now required"),r=new gn),0==u)return r.set(-2,-1,-1);var h=1/u,d=(c*s-o*l)*h,p=(a*l-o*s)*h;return r.set(1-d-p,p,d)},containsPoint:function(e,t,n,i){return Pi.getBarycoord(e,t,n,i,Mi),0<=Mi.x&&0<=Mi.y&&Mi.x+Mi.y<=1},getUV:function(e,t,n,i,r,a,o,s){return this.getBarycoord(e,t,n,i,Mi),s.set(0,0),s.addScaledVector(r,Mi.x),s.addScaledVector(a,Mi.y),s.addScaledVector(o,Mi.z),s},isFrontFacing:function(e,t,n,i){return xi.subVectors(n,t),bi.subVectors(e,t),xi.cross(bi).dot(i)<0}}),J(Pi.prototype,{set:function(e,t,n){return this.a.copy(e),this.b.copy(t),this.c.copy(n),this},setFromPointsAndIndices:function(e,t,n,i){return this.a.copy(e[t]),this.b.copy(e[n]),this.c.copy(e[i]),this},clone:function(){return(new this.constructor).copy(this)},copy:function(e){return this.a.copy(e.a),this.b.copy(e.b),this.c.copy(e.c),this},getArea:function(){return xi.subVectors(this.c,this.b),bi.subVectors(this.a,this.b),.5*xi.cross(bi).length()},getMidpoint:function(e){return void 0===e&&(console.warn("THREE.Triangle: .getMidpoint() target is now required"),e=new gn),e.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)},getNormal:function(e){return Pi.getNormal(this.a,this.b,this.c,e)},getPlane:function(e){return void 0===e&&(console.warn("THREE.Triangle: .getPlane() target is now required"),e=new _i),e.setFromCoplanarPoints(this.a,this.b,this.c)},getBarycoord:function(e,t){return Pi.getBarycoord(e,this.a,this.b,this.c,t)},getUV:function(e,t,n,i,r){return Pi.getUV(e,this.a,this.b,this.c,t,n,i,r)},containsPoint:function(e){return Pi.containsPoint(e,this.a,this.b,this.c)},isFrontFacing:function(e){return Pi.isFrontFacing(this.a,this.b,this.c,e)},intersectsBox:function(e){return e.intersectsTriangle(this)},closestPointToPoint:function(e,t){void 0===t&&(console.warn("THREE.Triangle: .closestPointToPoint() target is now required"),t=new gn);var n,i,r=this.a,a=this.b,o=this.c;Si.subVectors(a,r),Ti.subVectors(o,r),Ai.subVectors(e,r);var s=Si.dot(Ai),c=Ti.dot(Ai);if(s<=0&&c<=0)return t.copy(r);Li.subVectors(e,a);var l=Si.dot(Li),u=Ti.dot(Li);if(0<=l&&u<=l)return t.copy(a);var h=s*u-l*c;if(h<=0&&0<=s&&l<=0)return n=s/(s-l),t.copy(r).addScaledVector(Si,n);Ri.subVectors(e,o);var d=Si.dot(Ri),p=Ti.dot(Ri);if(0<=p&&d<=p)return t.copy(o);var f=d*c-s*p;if(f<=0&&0<=c&&p<=0)return i=c/(c-p),t.copy(r).addScaledVector(Ti,i);var m=l*p-d*u;if(m<=0&&0<=u-l&&0<=d-p)return Ei.subVectors(o,a),i=(u-l)/(u-l+(d-p)),t.copy(a).addScaledVector(Ei,i);var v=1/(m+f+h);return n=f*v,i=h*v,t.copy(r).addScaledVector(Si,n).addScaledVector(Ti,i)},equals:function(e){return e.a.equals(this.a)&&e.b.equals(this.b)&&e.c.equals(this.c)}});var Ci={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},Ii={h:0,s:0,l:0},Oi={h:0,s:0,l:0};function Di(e,t,n){return void 0===t&&void 0===n?this.set(e):this.setRGB(e,t,n)}function Ni(e,t,n){return n<0&&(n+=1),1<n&&--n,n<1/6?e+6*(t-e)*n:n<.5?t:n<2/3?e+6*(t-e)*(2/3-n):e}function Fi(e){return e<.04045?.0773993808*e:Math.pow(.9478672986*e+.0521327014,2.4)}function zi(e){return e<.0031308?12.92*e:1.055*Math.pow(e,.41666)-.055}function Ui(e,t,n,i,r,a){this.a=e,this.b=t,this.c=n,this.normal=i&&i.isVector3?i:new gn,this.vertexNormals=Array.isArray(i)?i:[],this.color=r&&r.isColor?r:new Di,this.vertexColors=Array.isArray(r)?r:[],this.materialIndex=void 0!==a?a:0}J(Di.prototype,{isColor:!0,r:1,g:1,b:1,set:function(e){return e&&e.isColor?this.copy(e):"number"==typeof e?this.setHex(e):"string"==typeof e&&this.setStyle(e),this},setScalar:function(e){return this.r=e,this.g=e,this.b=e,this},setHex:function(e){return e=Math.floor(e),this.r=(e>>16&255)/255,this.g=(e>>8&255)/255,this.b=(255&e)/255,this},setRGB:function(e,t,n){return this.r=e,this.g=t,this.b=n,this},setHSL:function(e,t,n){if(e=an.euclideanModulo(e,1),t=an.clamp(t,0,1),n=an.clamp(n,0,1),0===t)this.r=this.g=this.b=n;else{var i=n<=.5?n*(1+t):n+t-n*t,r=2*n-i;this.r=Ni(r,i,e+1/3),this.g=Ni(r,i,e),this.b=Ni(r,i,e-1/3)}return this},setStyle:function(t){function e(e){void 0!==e&&parseFloat(e)<1&&console.warn("THREE.Color: Alpha component of "+t+" will be ignored.")}var n;if(n=/^((?:rgb|hsl)a?)\(\s*([^\)]*)\)/.exec(t)){var i,r=n[1],a=n[2];switch(r){case"rgb":case"rgba":if(i=/^(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(,\s*([0-9]*\.?[0-9]+)\s*)?$/.exec(a))return this.r=Math.min(255,parseInt(i[1],10))/255,this.g=Math.min(255,parseInt(i[2],10))/255,this.b=Math.min(255,parseInt(i[3],10))/255,e(i[5]),this;if(i=/^(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(,\s*([0-9]*\.?[0-9]+)\s*)?$/.exec(a))return this.r=Math.min(100,parseInt(i[1],10))/100,this.g=Math.min(100,parseInt(i[2],10))/100,this.b=Math.min(100,parseInt(i[3],10))/100,e(i[5]),this;break;case"hsl":case"hsla":if(i=/^([0-9]*\.?[0-9]+)\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(,\s*([0-9]*\.?[0-9]+)\s*)?$/.exec(a)){var o=parseFloat(i[1])/360,s=parseInt(i[2],10)/100,c=parseInt(i[3],10)/100;return e(i[5]),this.setHSL(o,s,c)}}}else if(n=/^\#([A-Fa-f0-9]+)$/.exec(t)){var l=n[1],u=l.length;if(3===u)return this.r=parseInt(l.charAt(0)+l.charAt(0),16)/255,this.g=parseInt(l.charAt(1)+l.charAt(1),16)/255,this.b=parseInt(l.charAt(2)+l.charAt(2),16)/255,this;if(6===u)return this.r=parseInt(l.charAt(0)+l.charAt(1),16)/255,this.g=parseInt(l.charAt(2)+l.charAt(3),16)/255,this.b=parseInt(l.charAt(4)+l.charAt(5),16)/255,this}return t&&0<t.length?this.setColorName(t):this},setColorName:function(e){var t=Ci[e];return void 0!==t?this.setHex(t):console.warn("THREE.Color: Unknown color "+e),this},clone:function(){return new this.constructor(this.r,this.g,this.b)},copy:function(e){return this.r=e.r,this.g=e.g,this.b=e.b,this},copyGammaToLinear:function(e,t){return void 0===t&&(t=2),this.r=Math.pow(e.r,t),this.g=Math.pow(e.g,t),this.b=Math.pow(e.b,t),this},copyLinearToGamma:function(e,t){void 0===t&&(t=2);var n=0<t?1/t:1;return this.r=Math.pow(e.r,n),this.g=Math.pow(e.g,n),this.b=Math.pow(e.b,n),this},convertGammaToLinear:function(e){return this.copyGammaToLinear(this,e),this},convertLinearToGamma:function(e){return this.copyLinearToGamma(this,e),this},copySRGBToLinear:function(e){return this.r=Fi(e.r),this.g=Fi(e.g),this.b=Fi(e.b),this},copyLinearToSRGB:function(e){return this.r=zi(e.r),this.g=zi(e.g),this.b=zi(e.b),this},convertSRGBToLinear:function(){return this.copySRGBToLinear(this),this},convertLinearToSRGB:function(){return this.copyLinearToSRGB(this),this},getHex:function(){return 255*this.r<<16^255*this.g<<8^255*this.b<<0},getHexString:function(){return("000000"+this.getHex().toString(16)).slice(-6)},getHSL:function(e){void 0===e&&(console.warn("THREE.Color: .getHSL() target is now required"),e={h:0,s:0,l:0});var t,n,i=this.r,r=this.g,a=this.b,o=Math.max(i,r,a),s=Math.min(i,r,a),c=(s+o)/2;if(s===o)n=t=0;else{var l=o-s;switch(n=c<=.5?l/(o+s):l/(2-o-s),o){case i:t=(r-a)/l+(r<a?6:0);break;case r:t=(a-i)/l+2;break;case a:t=(i-r)/l+4}t/=6}return e.h=t,e.s=n,e.l=c,e},getStyle:function(){return"rgb("+(255*this.r|0)+","+(255*this.g|0)+","+(255*this.b|0)+")"},offsetHSL:function(e,t,n){return this.getHSL(Ii),Ii.h+=e,Ii.s+=t,Ii.l+=n,this.setHSL(Ii.h,Ii.s,Ii.l),this},add:function(e){return this.r+=e.r,this.g+=e.g,this.b+=e.b,this},addColors:function(e,t){return this.r=e.r+t.r,this.g=e.g+t.g,this.b=e.b+t.b,this},addScalar:function(e){return this.r+=e,this.g+=e,this.b+=e,this},sub:function(e){return this.r=Math.max(0,this.r-e.r),this.g=Math.max(0,this.g-e.g),this.b=Math.max(0,this.b-e.b),this},multiply:function(e){return this.r*=e.r,this.g*=e.g,this.b*=e.b,this},multiplyScalar:function(e){return this.r*=e,this.g*=e,this.b*=e,this},lerp:function(e,t){return this.r+=(e.r-this.r)*t,this.g+=(e.g-this.g)*t,this.b+=(e.b-this.b)*t,this},lerpHSL:function(e,t){this.getHSL(Ii),e.getHSL(Oi);var n=an.lerp(Ii.h,Oi.h,t),i=an.lerp(Ii.s,Oi.s,t),r=an.lerp(Ii.l,Oi.l,t);return this.setHSL(n,i,r),this},equals:function(e){return e.r===this.r&&e.g===this.g&&e.b===this.b},fromArray:function(e,t){return void 0===t&&(t=0),this.r=e[t],this.g=e[t+1],this.b=e[t+2],this},toArray:function(e,t){return void 0===e&&(e=[]),void 0===t&&(t=0),e[t]=this.r,e[t+1]=this.g,e[t+2]=this.b,e},toJSON:function(){return this.getHex()}}),Di.NAMES=Ci,J(Ui.prototype,{clone:function(){return(new this.constructor).copy(this)},copy:function(e){this.a=e.a,this.b=e.b,this.c=e.c,this.normal.copy(e.normal),this.color.copy(e.color),this.materialIndex=e.materialIndex;for(var t=0,n=e.vertexNormals.length;t<n;t++)this.vertexNormals[t]=e.vertexNormals[t].clone();for(t=0,n=e.vertexColors.length;t<n;t++)this.vertexColors[t]=e.vertexColors[t].clone();return this}});var Bi=0;function Gi(){Object.defineProperty(this,"id",{value:Bi++}),this.uuid=an.generateUUID(),this.name="",this.type="Material",this.fog=!0,this.blending=ie,this.side=ee,this.flatShading=!1,this.vertexColors=!1,this.opacity=1,this.transparent=!1,this.blendSrc=ge,this.blendDst=ye,this.blendEquation=ce,this.blendSrcAlpha=null,this.blendDstAlpha=null,this.blendEquationAlpha=null,this.depthFunc=Le,this.depthTest=!0,this.depthWrite=!0,this.stencilWriteMask=255,this.stencilFunc=Kt,this.stencilRef=0,this.stencilFuncMask=255,this.stencilFail=Jt,this.stencilZFail=Jt,this.stencilZPass=Jt,this.stencilWrite=!1,this.clippingPlanes=null,this.clipIntersection=!1,this.clipShadows=!1,this.shadowSide=null,this.colorWrite=!0,this.precision=null,this.polygonOffset=!1,this.polygonOffsetFactor=0,this.polygonOffsetUnits=0,this.dithering=!1,this.alphaTest=0,this.premultipliedAlpha=!1,this.visible=!0,this.toneMapped=!0,this.userData={},this.version=0}function Hi(e){Gi.call(this),this.type="MeshBasicMaterial",this.color=new Di(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.combine=G,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.skinning=!1,this.morphTargets=!1,this.setValues(e)}Gi.prototype=J(Object.create(en.prototype),{constructor:Gi,isMaterial:!0,onBeforeCompile:function(){},setValues:function(e){if(void 0!==e)for(var t in e){var n=e[t];if(void 0!==n)if("shading"!==t){var i=this[t];void 0!==i?i&&i.isColor?i.set(n):i&&i.isVector3&&n&&n.isVector3?i.copy(n):this[t]=n:console.warn("THREE."+this.type+": '"+t+"' is not a property of this material.")}else console.warn("THREE."+this.type+": .shading has been removed. Use the boolean .flatShading instead."),this.flatShading=1===n;else console.warn("THREE.Material: '"+t+"' parameter is undefined.")}},toJSON:function(e){var t=void 0===e||"string"==typeof e;t&&(e={textures:{},images:{}});var n={metadata:{version:4.5,type:"Material",generator:"Material.toJSON"}};function i(e){var t=[];for(var n in e){var i=e[n];delete i.metadata,t.push(i)}return t}if(n.uuid=this.uuid,n.type=this.type,""!==this.name&&(n.name=this.name),this.color&&this.color.isColor&&(n.color=this.color.getHex()),void 0!==this.roughness&&(n.roughness=this.roughness),void 0!==this.metalness&&(n.metalness=this.metalness),this.sheen&&this.sheen.isColor&&(n.sheen=this.sheen.getHex()),this.emissive&&this.emissive.isColor&&(n.emissive=this.emissive.getHex()),this.emissiveIntensity&&1!==this.emissiveIntensity&&(n.emissiveIntensity=this.emissiveIntensity),this.specular&&this.specular.isColor&&(n.specular=this.specular.getHex()),void 0!==this.shininess&&(n.shininess=this.shininess),void 0!==this.clearcoat&&(n.clearcoat=this.clearcoat),void 0!==this.clearcoatRoughness&&(n.clearcoatRoughness=this.clearcoatRoughness),this.clearcoatMap&&this.clearcoatMap.isTexture&&(n.clearcoatMap=this.clearcoatMap.toJSON(e).uuid),this.clearcoatRoughnessMap&&this.clearcoatRoughnessMap.isTexture&&(n.clearcoatRoughnessMap=this.clearcoatRoughnessMap.toJSON(e).uuid),this.clearcoatNormalMap&&this.clearcoatNormalMap.isTexture&&(n.clearcoatNormalMap=this.clearcoatNormalMap.toJSON(e).uuid,n.clearcoatNormalScale=this.clearcoatNormalScale.toArray()),this.map&&this.map.isTexture&&(n.map=this.map.toJSON(e).uuid),this.matcap&&this.matcap.isTexture&&(n.matcap=this.matcap.toJSON(e).uuid),this.alphaMap&&this.alphaMap.isTexture&&(n.alphaMap=this.alphaMap.toJSON(e).uuid),this.lightMap&&this.lightMap.isTexture&&(n.lightMap=this.lightMap.toJSON(e).uuid),this.aoMap&&this.aoMap.isTexture&&(n.aoMap=this.aoMap.toJSON(e).uuid,n.aoMapIntensity=this.aoMapIntensity),this.bumpMap&&this.bumpMap.isTexture&&(n.bumpMap=this.bumpMap.toJSON(e).uuid,n.bumpScale=this.bumpScale),this.normalMap&&this.normalMap.isTexture&&(n.normalMap=this.normalMap.toJSON(e).uuid,n.normalMapType=this.normalMapType,n.normalScale=this.normalScale.toArray()),this.displacementMap&&this.displacementMap.isTexture&&(n.displacementMap=this.displacementMap.toJSON(e).uuid,n.displacementScale=this.displacementScale,n.displacementBias=this.displacementBias),this.roughnessMap&&this.roughnessMap.isTexture&&(n.roughnessMap=this.roughnessMap.toJSON(e).uuid),this.metalnessMap&&this.metalnessMap.isTexture&&(n.metalnessMap=this.metalnessMap.toJSON(e).uuid),this.emissiveMap&&this.emissiveMap.isTexture&&(n.emissiveMap=this.emissiveMap.toJSON(e).uuid),this.specularMap&&this.specularMap.isTexture&&(n.specularMap=this.specularMap.toJSON(e).uuid),this.envMap&&this.envMap.isTexture&&(n.envMap=this.envMap.toJSON(e).uuid,n.reflectivity=this.reflectivity,n.refractionRatio=this.refractionRatio,void 0!==this.combine&&(n.combine=this.combine),void 0!==this.envMapIntensity&&(n.envMapIntensity=this.envMapIntensity)),this.gradientMap&&this.gradientMap.isTexture&&(n.gradientMap=this.gradientMap.toJSON(e).uuid),void 0!==this.size&&(n.size=this.size),void 0!==this.sizeAttenuation&&(n.sizeAttenuation=this.sizeAttenuation),this.blending!==ie&&(n.blending=this.blending),!0===this.flatShading&&(n.flatShading=this.flatShading),this.side!==ee&&(n.side=this.side),this.vertexColors&&(n.vertexColors=!0),this.opacity<1&&(n.opacity=this.opacity),!0===this.transparent&&(n.transparent=this.transparent),n.depthFunc=this.depthFunc,n.depthTest=this.depthTest,n.depthWrite=this.depthWrite,n.stencilWrite=this.stencilWrite,n.stencilWriteMask=this.stencilWriteMask,n.stencilFunc=this.stencilFunc,n.stencilRef=this.stencilRef,n.stencilFuncMask=this.stencilFuncMask,n.stencilFail=this.stencilFail,n.stencilZFail=this.stencilZFail,n.stencilZPass=this.stencilZPass,this.rotation&&0!==this.rotation&&(n.rotation=this.rotation),!0===this.polygonOffset&&(n.polygonOffset=!0),0!==this.polygonOffsetFactor&&(n.polygonOffsetFactor=this.polygonOffsetFactor),0!==this.polygonOffsetUnits&&(n.polygonOffsetUnits=this.polygonOffsetUnits),this.linewidth&&1!==this.linewidth&&(n.linewidth=this.linewidth),void 0!==this.dashSize&&(n.dashSize=this.dashSize),void 0!==this.gapSize&&(n.gapSize=this.gapSize),void 0!==this.scale&&(n.scale=this.scale),!0===this.dithering&&(n.dithering=!0),0<this.alphaTest&&(n.alphaTest=this.alphaTest),!0===this.premultipliedAlpha&&(n.premultipliedAlpha=this.premultipliedAlpha),!0===this.wireframe&&(n.wireframe=this.wireframe),1<this.wireframeLinewidth&&(n.wireframeLinewidth=this.wireframeLinewidth),"round"!==this.wireframeLinecap&&(n.wireframeLinecap=this.wireframeLinecap),"round"!==this.wireframeLinejoin&&(n.wireframeLinejoin=this.wireframeLinejoin),!0===this.morphTargets&&(n.morphTargets=!0),!0===this.morphNormals&&(n.morphNormals=!0),!0===this.skinning&&(n.skinning=!0),!1===this.visible&&(n.visible=!1),!1===this.toneMapped&&(n.toneMapped=!1),"{}"!==JSON.stringify(this.userData)&&(n.userData=this.userData),t){var r=i(e.textures),a=i(e.images);0<r.length&&(n.textures=r),0<a.length&&(n.images=a)}return n},clone:function(){return(new this.constructor).copy(this)},copy:function(e){this.name=e.name,this.fog=e.fog,this.blending=e.blending,this.side=e.side,this.flatShading=e.flatShading,this.vertexColors=e.vertexColors,this.opacity=e.opacity,this.transparent=e.transparent,this.blendSrc=e.blendSrc,this.blendDst=e.blendDst,this.blendEquation=e.blendEquation,this.blendSrcAlpha=e.blendSrcAlpha,this.blendDstAlpha=e.blendDstAlpha,this.blendEquationAlpha=e.blendEquationAlpha,this.depthFunc=e.depthFunc,this.depthTest=e.depthTest,this.depthWrite=e.depthWrite,this.stencilWriteMask=e.stencilWriteMask,this.stencilFunc=e.stencilFunc,this.stencilRef=e.stencilRef,this.stencilFuncMask=e.stencilFuncMask,this.stencilFail=e.stencilFail,this.stencilZFail=e.stencilZFail,this.stencilZPass=e.stencilZPass,this.stencilWrite=e.stencilWrite;var t=e.clippingPlanes,n=null;if(null!==t){var i=t.length;n=new Array(i);for(var r=0;r!==i;++r)n[r]=t[r].clone()}return this.clippingPlanes=n,this.clipIntersection=e.clipIntersection,this.clipShadows=e.clipShadows,this.shadowSide=e.shadowSide,this.colorWrite=e.colorWrite,this.precision=e.precision,this.polygonOffset=e.polygonOffset,this.polygonOffsetFactor=e.polygonOffsetFactor,this.polygonOffsetUnits=e.polygonOffsetUnits,this.dithering=e.dithering,this.alphaTest=e.alphaTest,this.premultipliedAlpha=e.premultipliedAlpha,this.visible=e.visible,this.toneMapped=e.toneMapped,this.userData=JSON.parse(JSON.stringify(e.userData)),this},dispose:function(){this.dispatchEvent({type:"dispose"})}}),Object.defineProperty(Gi.prototype,"needsUpdate",{set:function(e){!0===e&&this.version++}}),((Hi.prototype=Object.create(Gi.prototype)).constructor=Hi).prototype.isMeshBasicMaterial=!0,Hi.prototype.copy=function(e){return Gi.prototype.copy.call(this,e),this.color.copy(e.color),this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.combine=e.combine,this.reflectivity=e.reflectivity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.skinning=e.skinning,this.morphTargets=e.morphTargets,this};var ki=new gn;function Vi(e,t,n){if(Array.isArray(e))throw new TypeError("THREE.BufferAttribute: array should be a Typed Array.");this.name="",this.array=e,this.itemSize=t,this.count=void 0!==e?e.length/t:0,this.normalized=!0===n,this.usage=Qt,this.updateRange={offset:0,count:-1},this.version=0}function ji(e,t,n){Vi.call(this,new Int8Array(e),t,n)}function Wi(e,t,n){Vi.call(this,new Uint8Array(e),t,n)}function qi(e,t,n){Vi.call(this,new Uint8ClampedArray(e),t,n)}function Xi(e,t,n){Vi.call(this,new Int16Array(e),t,n)}function Yi(e,t,n){Vi.call(this,new Uint16Array(e),t,n)}function Zi(e,t,n){Vi.call(this,new Int32Array(e),t,n)}function Ji(e,t,n){Vi.call(this,new Uint32Array(e),t,n)}function Ki(e,t,n){Vi.call(this,new Float32Array(e),t,n)}function Qi(e,t,n){Vi.call(this,new Float64Array(e),t,n)}function $i(){this.vertices=[],this.normals=[],this.colors=[],this.uvs=[],this.uvs2=[],this.groups=[],this.morphTargets={},this.skinWeights=[],this.skinIndices=[],this.boundingBox=null,this.boundingSphere=null,this.verticesNeedUpdate=!1,this.normalsNeedUpdate=!1,this.colorsNeedUpdate=!1,this.uvsNeedUpdate=!1,this.groupsNeedUpdate=!1}function er(e){if(0===e.length)return-1/0;for(var t=e[0],n=1,i=e.length;n<i;++n)e[n]>t&&(t=e[n]);return t}Object.defineProperty(Vi.prototype,"needsUpdate",{set:function(e){!0===e&&this.version++}}),J(Vi.prototype,{isBufferAttribute:!0,onUploadCallback:function(){},setUsage:function(e){return this.usage=e,this},copy:function(e){return this.name=e.name,this.array=new e.array.constructor(e.array),this.itemSize=e.itemSize,this.count=e.count,this.normalized=e.normalized,this.usage=e.usage,this},copyAt:function(e,t,n){e*=this.itemSize,n*=t.itemSize;for(var i=0,r=this.itemSize;i<r;i++)this.array[e+i]=t.array[n+i];return this},copyArray:function(e){return this.array.set(e),this},copyColorsArray:function(e){for(var t=this.array,n=0,i=0,r=e.length;i<r;i++){var a=e[i];void 0===a&&(console.warn("THREE.BufferAttribute.copyColorsArray(): color is undefined",i),a=new Di),t[n++]=a.r,t[n++]=a.g,t[n++]=a.b}return this},copyVector2sArray:function(e){for(var t=this.array,n=0,i=0,r=e.length;i<r;i++){var a=e[i];void 0===a&&(console.warn("THREE.BufferAttribute.copyVector2sArray(): vector is undefined",i),a=new on),t[n++]=a.x,t[n++]=a.y}return this},copyVector3sArray:function(e){for(var t=this.array,n=0,i=0,r=e.length;i<r;i++){var a=e[i];void 0===a&&(console.warn("THREE.BufferAttribute.copyVector3sArray(): vector is undefined",i),a=new gn),t[n++]=a.x,t[n++]=a.y,t[n++]=a.z}return this},copyVector4sArray:function(e){for(var t=this.array,n=0,i=0,r=e.length;i<r;i++){var a=e[i];void 0===a&&(console.warn("THREE.BufferAttribute.copyVector4sArray(): vector is undefined",i),a=new hn),t[n++]=a.x,t[n++]=a.y,t[n++]=a.z,t[n++]=a.w}return this},applyMatrix3:function(e){for(var t=0,n=this.count;t<n;t++)ki.x=this.getX(t),ki.y=this.getY(t),ki.z=this.getZ(t),ki.applyMatrix3(e),this.setXYZ(t,ki.x,ki.y,ki.z);return this},applyMatrix4:function(e){for(var t=0,n=this.count;t<n;t++)ki.x=this.getX(t),ki.y=this.getY(t),ki.z=this.getZ(t),ki.applyMatrix4(e),this.setXYZ(t,ki.x,ki.y,ki.z);return this},applyNormalMatrix:function(e){for(var t=0,n=this.count;t<n;t++)ki.x=this.getX(t),ki.y=this.getY(t),ki.z=this.getZ(t),ki.applyNormalMatrix(e),this.setXYZ(t,ki.x,ki.y,ki.z);return this},transformDirection:function(e){for(var t=0,n=this.count;t<n;t++)ki.x=this.getX(t),ki.y=this.getY(t),ki.z=this.getZ(t),ki.transformDirection(e),this.setXYZ(t,ki.x,ki.y,ki.z);return this},set:function(e,t){return void 0===t&&(t=0),this.array.set(e,t),this},getX:function(e){return this.array[e*this.itemSize]},setX:function(e,t){return this.array[e*this.itemSize]=t,this},getY:function(e){return this.array[e*this.itemSize+1]},setY:function(e,t){return this.array[e*this.itemSize+1]=t,this},getZ:function(e){return this.array[e*this.itemSize+2]},setZ:function(e,t){return this.array[e*this.itemSize+2]=t,this},getW:function(e){return this.array[e*this.itemSize+3]},setW:function(e,t){return this.array[e*this.itemSize+3]=t,this},setXY:function(e,t,n){return e*=this.itemSize,this.array[e+0]=t,this.array[e+1]=n,this},setXYZ:function(e,t,n,i){return e*=this.itemSize,this.array[e+0]=t,this.array[e+1]=n,this.array[e+2]=i,this},setXYZW:function(e,t,n,i,r){return e*=this.itemSize,this.array[e+0]=t,this.array[e+1]=n,this.array[e+2]=i,this.array[e+3]=r,this},onUpload:function(e){return this.onUploadCallback=e,this},clone:function(){return new this.constructor(this.array,this.itemSize).copy(this)},toJSON:function(){return{itemSize:this.itemSize,type:this.array.constructor.name,array:Array.prototype.slice.call(this.array),normalized:this.normalized}}}),(ji.prototype=Object.create(Vi.prototype)).constructor=ji,(Wi.prototype=Object.create(Vi.prototype)).constructor=Wi,(qi.prototype=Object.create(Vi.prototype)).constructor=qi,(Xi.prototype=Object.create(Vi.prototype)).constructor=Xi,(Yi.prototype=Object.create(Vi.prototype)).constructor=Yi,(Zi.prototype=Object.create(Vi.prototype)).constructor=Zi,(Ji.prototype=Object.create(Vi.prototype)).constructor=Ji,(Ki.prototype=Object.create(Vi.prototype)).constructor=Ki,(Qi.prototype=Object.create(Vi.prototype)).constructor=Qi,J($i.prototype,{computeGroups:function(e){for(var t,n=[],i=void 0,r=e.faces,a=0;a<r.length;a++){var o=r[a];o.materialIndex!==i&&(i=o.materialIndex,void 0!==t&&(t.count=3*a-t.start,n.push(t)),t={start:3*a,materialIndex:i})}void 0!==t&&(t.count=3*a-t.start,n.push(t)),this.groups=n},fromGeometry:function(e){var t,n=e.faces,i=e.vertices,r=e.faceVertexUvs,a=r[0]&&0<r[0].length,o=r[1]&&0<r[1].length,s=e.morphTargets,c=s.length;if(0<c){t=[];for(var l=0;l<c;l++)t[l]={name:s[l].name,data:[]};this.morphTargets.position=t}var u,h=e.morphNormals,d=h.length;if(0<d){u=[];for(l=0;l<d;l++)u[l]={name:h[l].name,data:[]};this.morphTargets.normal=u}var p=e.skinIndices,f=e.skinWeights,m=p.length===i.length,v=f.length===i.length;0<i.length&&0===n.length&&console.error("THREE.DirectGeometry: Faceless geometries are not supported.");for(l=0;l<n.length;l++){var g=n[l];this.vertices.push(i[g.a],i[g.b],i[g.c]);var y=g.vertexNormals;if(3===y.length)this.normals.push(y[0],y[1],y[2]);else{var _=g.normal;this.normals.push(_,_,_)}var x,b=g.vertexColors;if(3===b.length)this.colors.push(b[0],b[1],b[2]);else{var w=g.color;this.colors.push(w,w,w)}if(!0===a)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 on,new on,new on));if(!0===o)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 on,new on,new on));for(var M=0;M<c;M++){var S=s[M].vertices;t[M].data.push(S[g.a],S[g.b],S[g.c])}for(M=0;M<d;M++){var T=h[M].vertexNormals[l];u[M].data.push(T.a,T.b,T.c)}m&&this.skinIndices.push(p[g.a],p[g.b],p[g.c]),v&&this.skinWeights.push(f[g.a],f[g.b],f[g.c])}return this.computeGroups(e),this.verticesNeedUpdate=e.verticesNeedUpdate,this.normalsNeedUpdate=e.normalsNeedUpdate,this.colorsNeedUpdate=e.colorsNeedUpdate,this.uvsNeedUpdate=e.uvsNeedUpdate,this.groupsNeedUpdate=e.groupsNeedUpdate,null!==e.boundingSphere&&(this.boundingSphere=e.boundingSphere.clone()),null!==e.boundingBox&&(this.boundingBox=e.boundingBox.clone()),this}});var tr=1,nr=new Tn,ir=new Vn,rr=new gn,ar=new ri,or=new ri,sr=new gn;function cr(){Object.defineProperty(this,"id",{value:tr+=2}),this.uuid=an.generateUUID(),this.name="",this.type="BufferGeometry",this.index=null,this.attributes={},this.morphAttributes={},this.morphTargetsRelative=!1,this.groups=[],this.boundingBox=null,this.boundingSphere=null,this.drawRange={start:0,count:1/0},this.userData={}}cr.prototype=J(Object.create(en.prototype),{constructor:cr,isBufferGeometry:!0,getIndex:function(){return this.index},setIndex:function(e){Array.isArray(e)?this.index=new(65535<er(e)?Ji:Yi)(e,1):this.index=e},getAttribute:function(e){return this.attributes[e]},setAttribute:function(e,t){return this.attributes[e]=t,this},deleteAttribute:function(e){return delete this.attributes[e],this},addGroup:function(e,t,n){this.groups.push({start:e,count:t,materialIndex:void 0!==n?n:0})},clearGroups:function(){this.groups=[]},setDrawRange:function(e,t){this.drawRange.start=e,this.drawRange.count=t},applyMatrix4:function(e){var t=this.attributes.position;void 0!==t&&(t.applyMatrix4(e),t.needsUpdate=!0);var n=this.attributes.normal;if(void 0!==n){var i=(new sn).getNormalMatrix(e);n.applyNormalMatrix(i),n.needsUpdate=!0}var r=this.attributes.tangent;return void 0!==r&&(r.transformDirection(e),r.needsUpdate=!0),null!==this.boundingBox&&this.computeBoundingBox(),null!==this.boundingSphere&&this.computeBoundingSphere(),this},rotateX:function(e){return nr.makeRotationX(e),this.applyMatrix4(nr),this},rotateY:function(e){return nr.makeRotationY(e),this.applyMatrix4(nr),this},rotateZ:function(e){return nr.makeRotationZ(e),this.applyMatrix4(nr),this},translate:function(e,t,n){return nr.makeTranslation(e,t,n),this.applyMatrix4(nr),this},scale:function(e,t,n){return nr.makeScale(e,t,n),this.applyMatrix4(nr),this},lookAt:function(e){return ir.lookAt(e),ir.updateMatrix(),this.applyMatrix4(ir.matrix),this},center:function(){return this.computeBoundingBox(),this.boundingBox.getCenter(rr).negate(),this.translate(rr.x,rr.y,rr.z),this},setFromObject:function(e){var t=e.geometry;if(e.isPoints||e.isLine){var n=new Ki(3*t.vertices.length,3),i=new Ki(3*t.colors.length,3);if(this.setAttribute("position",n.copyVector3sArray(t.vertices)),this.setAttribute("color",i.copyColorsArray(t.colors)),t.lineDistances&&t.lineDistances.length===t.vertices.length){var r=new Ki(t.lineDistances.length,1);this.setAttribute("lineDistance",r.copyArray(t.lineDistances))}null!==t.boundingSphere&&(this.boundingSphere=t.boundingSphere.clone()),null!==t.boundingBox&&(this.boundingBox=t.boundingBox.clone())}else e.isMesh&&t&&t.isGeometry&&this.fromGeometry(t);return this},setFromPoints:function(e){for(var t=[],n=0,i=e.length;n<i;n++){var r=e[n];t.push(r.x,r.y,r.z||0)}return this.setAttribute("position",new Ki(t,3)),this},updateFromObject:function(e){var t,n=e.geometry;if(e.isMesh){var i=n.__directGeometry;if(!0===n.elementsNeedUpdate&&(i=void 0,n.elementsNeedUpdate=!1),void 0===i)return this.fromGeometry(n);i.verticesNeedUpdate=n.verticesNeedUpdate,i.normalsNeedUpdate=n.normalsNeedUpdate,i.colorsNeedUpdate=n.colorsNeedUpdate,i.uvsNeedUpdate=n.uvsNeedUpdate,i.groupsNeedUpdate=n.groupsNeedUpdate,n.verticesNeedUpdate=!1,n.normalsNeedUpdate=!1,n.colorsNeedUpdate=!1,n.uvsNeedUpdate=!1,n.groupsNeedUpdate=!1,n=i}return!0===n.verticesNeedUpdate&&(void 0!==(t=this.attributes.position)&&(t.copyVector3sArray(n.vertices),t.needsUpdate=!0),n.verticesNeedUpdate=!1),!0===n.normalsNeedUpdate&&(void 0!==(t=this.attributes.normal)&&(t.copyVector3sArray(n.normals),t.needsUpdate=!0),n.normalsNeedUpdate=!1),!0===n.colorsNeedUpdate&&(void 0!==(t=this.attributes.color)&&(t.copyColorsArray(n.colors),t.needsUpdate=!0),n.colorsNeedUpdate=!1),n.uvsNeedUpdate&&(void 0!==(t=this.attributes.uv)&&(t.copyVector2sArray(n.uvs),t.needsUpdate=!0),n.uvsNeedUpdate=!1),n.lineDistancesNeedUpdate&&(void 0!==(t=this.attributes.lineDistance)&&(t.copyArray(n.lineDistances),t.needsUpdate=!0),n.lineDistancesNeedUpdate=!1),n.groupsNeedUpdate&&(n.computeGroups(e.geometry),this.groups=n.groups,n.groupsNeedUpdate=!1),this},fromGeometry:function(e){return e.__directGeometry=(new $i).fromGeometry(e),this.fromDirectGeometry(e.__directGeometry)},fromDirectGeometry:function(e){var t=new Float32Array(3*e.vertices.length);if(this.setAttribute("position",new Vi(t,3).copyVector3sArray(e.vertices)),0<e.normals.length){var n=new Float32Array(3*e.normals.length);this.setAttribute("normal",new Vi(n,3).copyVector3sArray(e.normals))}if(0<e.colors.length){var i=new Float32Array(3*e.colors.length);this.setAttribute("color",new Vi(i,3).copyColorsArray(e.colors))}if(0<e.uvs.length){var r=new Float32Array(2*e.uvs.length);this.setAttribute("uv",new Vi(r,2).copyVector2sArray(e.uvs))}if(0<e.uvs2.length){var a=new Float32Array(2*e.uvs2.length);this.setAttribute("uv2",new Vi(a,2).copyVector2sArray(e.uvs2))}for(var o in this.groups=e.groups,e.morphTargets){for(var s=[],c=e.morphTargets[o],l=0,u=c.length;l<u;l++){var h=c[l],d=new Ki(3*h.data.length,3);d.name=h.name,s.push(d.copyVector3sArray(h.data))}this.morphAttributes[o]=s}if(0<e.skinIndices.length){var p=new Ki(4*e.skinIndices.length,4);this.setAttribute("skinIndex",p.copyVector4sArray(e.skinIndices))}if(0<e.skinWeights.length){var f=new Ki(4*e.skinWeights.length,4);this.setAttribute("skinWeight",f.copyVector4sArray(e.skinWeights))}return null!==e.boundingSphere&&(this.boundingSphere=e.boundingSphere.clone()),null!==e.boundingBox&&(this.boundingBox=e.boundingBox.clone()),this},computeBoundingBox:function(){null===this.boundingBox&&(this.boundingBox=new ri);var e=this.attributes.position,t=this.morphAttributes.position;if(void 0!==e){if(this.boundingBox.setFromBufferAttribute(e),t)for(var n=0,i=t.length;n<i;n++){var r=t[n];ar.setFromBufferAttribute(r),this.morphTargetsRelative?(sr.addVectors(this.boundingBox.min,ar.min),this.boundingBox.expandByPoint(sr),sr.addVectors(this.boundingBox.max,ar.max),this.boundingBox.expandByPoint(sr)):(this.boundingBox.expandByPoint(ar.min),this.boundingBox.expandByPoint(ar.max))}}else 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(){null===this.boundingSphere&&(this.boundingSphere=new si);var e=this.attributes.position,t=this.morphAttributes.position;if(e){var n=this.boundingSphere.center;if(ar.setFromBufferAttribute(e),t)for(var i=0,r=t.length;i<r;i++){var a=t[i];or.setFromBufferAttribute(a),this.morphTargetsRelative?(sr.addVectors(ar.min,or.min),ar.expandByPoint(sr),sr.addVectors(ar.max,or.max),ar.expandByPoint(sr)):(ar.expandByPoint(or.min),ar.expandByPoint(or.max))}ar.getCenter(n);var o=0;for(i=0,r=e.count;i<r;i++)sr.fromBufferAttribute(e,i),o=Math.max(o,n.distanceToSquared(sr));if(t)for(i=0,r=t.length;i<r;i++){a=t[i];for(var s=this.morphTargetsRelative,c=0,l=a.count;c<l;c++)sr.fromBufferAttribute(a,c),s&&(rr.fromBufferAttribute(e,c),sr.add(rr)),o=Math.max(o,n.distanceToSquared(sr))}this.boundingSphere.radius=Math.sqrt(o),isNaN(this.boundingSphere.radius)&&console.error('THREE.BufferGeometry.computeBoundingSphere(): Computed radius is NaN. The "position" attribute is likely to have NaN values.',this)}},computeFaceNormals:function(){},computeVertexNormals:function(){var e=this.index,t=this.attributes;if(t.position){var n=t.position.array;if(void 0===t.normal)this.setAttribute("normal",new Vi(new Float32Array(n.length),3));else for(var i=t.normal.array,r=0,a=i.length;r<a;r++)i[r]=0;var o,s,c,l=t.normal.array,u=new gn,h=new gn,d=new gn,p=new gn,f=new gn;if(e){var m=e.array;for(r=0,a=e.count;r<a;r+=3)o=3*m[r+0],s=3*m[r+1],c=3*m[r+2],u.fromArray(n,o),h.fromArray(n,s),d.fromArray(n,c),p.subVectors(d,h),f.subVectors(u,h),p.cross(f),l[o]+=p.x,l[1+o]+=p.y,l[2+o]+=p.z,l[s]+=p.x,l[1+s]+=p.y,l[2+s]+=p.z,l[c]+=p.x,l[1+c]+=p.y,l[2+c]+=p.z}else for(r=0,a=n.length;r<a;r+=9)u.fromArray(n,r),h.fromArray(n,r+3),d.fromArray(n,r+6),p.subVectors(d,h),f.subVectors(u,h),p.cross(f),l[r]=p.x,l[r+1]=p.y,l[r+2]=p.z,l[r+3]=p.x,l[r+4]=p.y,l[r+5]=p.z,l[r+6]=p.x,l[r+7]=p.y,l[r+8]=p.z;this.normalizeNormals(),t.normal.needsUpdate=!0}},merge:function(e,t){if(e&&e.isBufferGeometry){void 0===t&&(t=0,console.warn("THREE.BufferGeometry.merge(): Overwriting original geometry, starting at offset=0. Use BufferGeometryUtils.mergeBufferGeometries() for lossless merge."));var n=this.attributes;for(var i in n)if(void 0!==e.attributes[i])for(var r=n[i].array,a=e.attributes[i],o=a.array,s=a.itemSize*t,c=Math.min(o.length,r.length-s),l=0,u=s;l<c;l++,u++)r[u]=o[l];return this}console.error("THREE.BufferGeometry.merge(): geometry not an instance of THREE.BufferGeometry.",e)},normalizeNormals:function(){for(var e=this.attributes.normal,t=0,n=e.count;t<n;t++)sr.x=e.getX(t),sr.y=e.getY(t),sr.z=e.getZ(t),sr.normalize(),e.setXYZ(t,sr.x,sr.y,sr.z)},toNonIndexed:function(){function e(e,t){for(var n=e.array,i=e.itemSize,r=new n.constructor(t.length*i),a=0,o=0,s=0,c=t.length;s<c;s++){a=t[s]*i;for(var l=0;l<i;l++)r[o++]=n[a++]}return new Vi(r,i)}if(null===this.index)return console.warn("THREE.BufferGeometry.toNonIndexed(): Geometry is already non-indexed."),this;var t=new cr,n=this.index.array,i=this.attributes;for(var r in i){var a=e(i[r],n);t.setAttribute(r,a)}var o=this.morphAttributes;for(r in o){for(var s=[],c=o[r],l=0,u=c.length;l<u;l++){a=e(c[l],n);s.push(a)}t.morphAttributes[r]=s}t.morphTargetsRelative=this.morphTargetsRelative;for(var h=this.groups,d=(l=0,h.length);l<d;l++){var p=h[l];t.addGroup(p.start,p.count,p.materialIndex)}return t},toJSON:function(){var e={metadata:{version:4.5,type:"BufferGeometry",generator:"BufferGeometry.toJSON"}};if(e.uuid=this.uuid,e.type=this.type,""!==this.name&&(e.name=this.name),0<Object.keys(this.userData).length&&(e.userData=this.userData),void 0!==this.parameters){var t=this.parameters;for(var n in t)void 0!==t[n]&&(e[n]=t[n]);return e}e.data={attributes:{}};var i=this.index;null!==i&&(e.data.index={type:i.array.constructor.name,array:Array.prototype.slice.call(i.array)});var r=this.attributes;for(var n in r){var a=(d=r[n]).toJSON();""!==d.name&&(a.name=d.name),e.data.attributes[n]=a}var o={},s=!1;for(var n in this.morphAttributes){for(var c=this.morphAttributes[n],l=[],u=0,h=c.length;u<h;u++){var d;a=(d=c[u]).toJSON();""!==d.name&&(a.name=d.name),l.push(a)}0<l.length&&(o[n]=l,s=!0)}s&&(e.data.morphAttributes=o,e.data.morphTargetsRelative=this.morphTargetsRelative);var p=this.groups;0<p.length&&(e.data.groups=JSON.parse(JSON.stringify(p)));var f=this.boundingSphere;return null!==f&&(e.data.boundingSphere={center:f.center.toArray(),radius:f.radius}),e},clone:function(){return(new cr).copy(this)},copy:function(e){var t,n,i;this.index=null,this.attributes={},this.morphAttributes={},this.groups=[],this.boundingBox=null,this.boundingSphere=null,this.name=e.name;var r=e.index;null!==r&&this.setIndex(r.clone());var a=e.attributes;for(t in a){var o=a[t];this.setAttribute(t,o.clone())}var s=e.morphAttributes;for(t in s){var c=[],l=s[t];for(n=0,i=l.length;n<i;n++)c.push(l[n].clone());this.morphAttributes[t]=c}this.morphTargetsRelative=e.morphTargetsRelative;var u=e.groups;for(n=0,i=u.length;n<i;n++){var h=u[n];this.addGroup(h.start,h.count,h.materialIndex)}var d=e.boundingBox;null!==d&&(this.boundingBox=d.clone());var p=e.boundingSphere;return null!==p&&(this.boundingSphere=p.clone()),this.drawRange.start=e.drawRange.start,this.drawRange.count=e.drawRange.count,this.userData=e.userData,this},dispose:function(){this.dispatchEvent({type:"dispose"})}});var lr=new Tn,ur=new mi,hr=new si,dr=new gn,pr=new gn,fr=new gn,mr=new gn,vr=new gn,gr=new gn,yr=new gn,_r=new gn,xr=new gn,br=new on,wr=new on,Mr=new on,Sr=new gn,Tr=new gn;function Er(e,t){Vn.call(this),this.type="Mesh",this.geometry=void 0!==e?e:new cr,this.material=void 0!==t?t:new Hi,this.updateMorphTargets()}function Ar(e,t,n,i,r,a,o,s){if(null===(t.side===Me?i.intersectTriangle(o,a,r,!0,s):i.intersectTriangle(r,a,o,t.side!==te,s)))return null;Tr.copy(s),Tr.applyMatrix4(e.matrixWorld);var c=n.ray.origin.distanceTo(Tr);return c<n.near||c>n.far?null:{distance:c,point:Tr.clone(),object:e}}function Lr(e,t,n,i,r,a,o,s,c,l,u,h){dr.fromBufferAttribute(r,l),pr.fromBufferAttribute(r,u),fr.fromBufferAttribute(r,h);var d=e.morphTargetInfluences;if(t.morphTargets&&a&&d){yr.set(0,0,0),_r.set(0,0,0),xr.set(0,0,0);for(var p=0,f=a.length;p<f;p++){var m=d[p],v=a[p];0!==m&&(mr.fromBufferAttribute(v,l),vr.fromBufferAttribute(v,u),gr.fromBufferAttribute(v,h),o?(yr.addScaledVector(mr,m),_r.addScaledVector(vr,m),xr.addScaledVector(gr,m)):(yr.addScaledVector(mr.sub(dr),m),_r.addScaledVector(vr.sub(pr),m),xr.addScaledVector(gr.sub(fr),m)))}dr.add(yr),pr.add(_r),fr.add(xr)}e.isSkinnedMesh&&(e.boneTransform(l,dr),e.boneTransform(u,pr),e.boneTransform(h,fr));var g=Ar(e,t,n,i,dr,pr,fr,Sr);if(g){s&&(br.fromBufferAttribute(s,l),wr.fromBufferAttribute(s,u),Mr.fromBufferAttribute(s,h),g.uv=Pi.getUV(Sr,dr,pr,fr,br,wr,Mr,new on)),c&&(br.fromBufferAttribute(c,l),wr.fromBufferAttribute(c,u),Mr.fromBufferAttribute(c,h),g.uv2=Pi.getUV(Sr,dr,pr,fr,br,wr,Mr,new on));var y=new Ui(l,u,h);Pi.getNormal(dr,pr,fr,y.normal),g.face=y}return g}Er.prototype=J(Object.create(Vn.prototype),{constructor:Er,isMesh:!0,copy:function(e){return Vn.prototype.copy.call(this,e),void 0!==e.morphTargetInfluences&&(this.morphTargetInfluences=e.morphTargetInfluences.slice()),void 0!==e.morphTargetDictionary&&(this.morphTargetDictionary=J({},e.morphTargetDictionary)),this},updateMorphTargets:function(){var e,t,n,i=this.geometry;if(i.isBufferGeometry){var r=i.morphAttributes,a=Object.keys(r);if(0<a.length){var o=r[a[0]];if(void 0!==o)for(this.morphTargetInfluences=[],this.morphTargetDictionary={},e=0,t=o.length;e<t;e++)n=o[e].name||String(e),this.morphTargetInfluences.push(0),this.morphTargetDictionary[n]=e}}else{var s=i.morphTargets;void 0!==s&&0<s.length&&console.error("THREE.Mesh.updateMorphTargets() no longer supports THREE.Geometry. Use THREE.BufferGeometry instead.")}},raycast:function(e,t){var n,i=this.geometry,r=this.material,a=this.matrixWorld;if(void 0!==r&&(null===i.boundingSphere&&i.computeBoundingSphere(),hr.copy(i.boundingSphere),hr.applyMatrix4(a),!1!==e.ray.intersectsSphere(hr)&&(lr.getInverse(a),ur.copy(e.ray).applyMatrix4(lr),null===i.boundingBox||!1!==ur.intersectsBox(i.boundingBox))))if(i.isBufferGeometry){var o,s,c,l,u,h,d,p,f,m=i.index,v=i.attributes.position,g=i.morphAttributes.position,y=i.morphTargetsRelative,_=i.attributes.uv,x=i.attributes.uv2,b=i.groups,w=i.drawRange;if(null!==m)if(Array.isArray(r))for(l=0,h=b.length;l<h;l++)for(f=r[(p=b[l]).materialIndex],u=Math.max(p.start,w.start),d=Math.min(p.start+p.count,w.start+w.count);u<d;u+=3)o=m.getX(u),s=m.getX(u+1),c=m.getX(u+2),(n=Lr(this,f,e,ur,v,g,y,_,x,o,s,c))&&(n.faceIndex=Math.floor(u/3),n.face.materialIndex=p.materialIndex,t.push(n));else for(l=Math.max(0,w.start),h=Math.min(m.count,w.start+w.count);l<h;l+=3)o=m.getX(l),s=m.getX(l+1),c=m.getX(l+2),(n=Lr(this,r,e,ur,v,g,y,_,x,o,s,c))&&(n.faceIndex=Math.floor(l/3),t.push(n));else if(void 0!==v)if(Array.isArray(r))for(l=0,h=b.length;l<h;l++)for(f=r[(p=b[l]).materialIndex],u=Math.max(p.start,w.start),d=Math.min(p.start+p.count,w.start+w.count);u<d;u+=3)(n=Lr(this,f,e,ur,v,g,y,_,x,o=u,s=u+1,c=u+2))&&(n.faceIndex=Math.floor(u/3),n.face.materialIndex=p.materialIndex,t.push(n));else for(l=Math.max(0,w.start),h=Math.min(v.count,w.start+w.count);l<h;l+=3)(n=Lr(this,r,e,ur,v,g,y,_,x,o=l,s=l+1,c=l+2))&&(n.faceIndex=Math.floor(l/3),t.push(n))}else if(i.isGeometry){var M,S,T,E,A=Array.isArray(r),L=i.vertices,R=i.faces,P=i.faceVertexUvs[0];0<P.length&&(E=P);for(var C=0,I=R.length;C<I;C++){var O=R[C],D=A?r[O.materialIndex]:r;if(void 0!==D&&(M=L[O.a],S=L[O.b],T=L[O.c],n=Ar(this,D,e,ur,M,S,T,Sr))){if(E&&E[C]){var N=E[C];br.copy(N[0]),wr.copy(N[1]),Mr.copy(N[2]),n.uv=Pi.getUV(Sr,M,S,T,br,wr,Mr,new on)}n.face=O,n.faceIndex=C,t.push(n)}}}},clone:function(){return new this.constructor(this.geometry,this.material).copy(this)}});var Rr=0,Pr=new Tn,Cr=new Vn,Ir=new gn;function Or(){Object.defineProperty(this,"id",{value:Rr+=2}),this.uuid=an.generateUUID(),this.name="",this.type="Geometry",this.vertices=[],this.colors=[],this.faces=[],this.faceVertexUvs=[[]],this.morphTargets=[],this.morphNormals=[],this.skinWeights=[],this.skinIndices=[],this.lineDistances=[],this.boundingBox=null,this.boundingSphere=null,this.elementsNeedUpdate=!1,this.verticesNeedUpdate=!1,this.uvsNeedUpdate=!1,this.normalsNeedUpdate=!1,this.colorsNeedUpdate=!1,this.lineDistancesNeedUpdate=!1,this.groupsNeedUpdate=!1}Or.prototype=J(Object.create(en.prototype),{constructor:Or,isGeometry:!0,applyMatrix4:function(e){for(var t=(new sn).getNormalMatrix(e),n=0,i=this.vertices.length;n<i;n++){this.vertices[n].applyMatrix4(e)}for(n=0,i=this.faces.length;n<i;n++){var r=this.faces[n];r.normal.applyMatrix3(t).normalize();for(var a=0,o=r.vertexNormals.length;a<o;a++)r.vertexNormals[a].applyMatrix3(t).normalize()}return null!==this.boundingBox&&this.computeBoundingBox(),null!==this.boundingSphere&&this.computeBoundingSphere(),this.verticesNeedUpdate=!0,this.normalsNeedUpdate=!0,this},rotateX:function(e){return Pr.makeRotationX(e),this.applyMatrix4(Pr),this},rotateY:function(e){return Pr.makeRotationY(e),this.applyMatrix4(Pr),this},rotateZ:function(e){return Pr.makeRotationZ(e),this.applyMatrix4(Pr),this},translate:function(e,t,n){return Pr.makeTranslation(e,t,n),this.applyMatrix4(Pr),this},scale:function(e,t,n){return Pr.makeScale(e,t,n),this.applyMatrix4(Pr),this},lookAt:function(e){return Cr.lookAt(e),Cr.updateMatrix(),this.applyMatrix4(Cr.matrix),this},fromBufferGeometry:function(e){var o=this,t=null!==e.index?e.index.array:void 0,n=e.attributes;if(void 0===n.position)return console.error("THREE.Geometry.fromBufferGeometry(): Position attribute required for conversion."),this;var i=n.position.array,s=void 0!==n.normal?n.normal.array:void 0,c=void 0!==n.color?n.color.array:void 0,l=void 0!==n.uv?n.uv.array:void 0,u=void 0!==n.uv2?n.uv2.array:void 0;void 0!==u&&(this.faceVertexUvs[1]=[]);for(var r=0;r<i.length;r+=3)o.vertices.push((new gn).fromArray(i,r)),void 0!==c&&o.colors.push((new Di).fromArray(c,r));function a(e,t,n,i){var r=void 0===c?[]:[o.colors[e].clone(),o.colors[t].clone(),o.colors[n].clone()],a=new Ui(e,t,n,void 0===s?[]:[(new gn).fromArray(s,3*e),(new gn).fromArray(s,3*t),(new gn).fromArray(s,3*n)],r,i);o.faces.push(a),void 0!==l&&o.faceVertexUvs[0].push([(new on).fromArray(l,2*e),(new on).fromArray(l,2*t),(new on).fromArray(l,2*n)]),void 0!==u&&o.faceVertexUvs[1].push([(new on).fromArray(u,2*e),(new on).fromArray(u,2*t),(new on).fromArray(u,2*n)])}var h=e.groups;if(0<h.length)for(r=0;r<h.length;r++)for(var d=h[r],p=d.start,f=p,m=p+d.count;f<m;f+=3)void 0!==t?a(t[f],t[f+1],t[f+2],d.materialIndex):a(f,f+1,f+2,d.materialIndex);else if(void 0!==t)for(r=0;r<t.length;r+=3)a(t[r],t[r+1],t[r+2]);else for(r=0;r<i.length/3;r+=3)a(r,r+1,r+2);return this.computeFaceNormals(),null!==e.boundingBox&&(this.boundingBox=e.boundingBox.clone()),null!==e.boundingSphere&&(this.boundingSphere=e.boundingSphere.clone()),this},center:function(){return this.computeBoundingBox(),this.boundingBox.getCenter(Ir).negate(),this.translate(Ir.x,Ir.y,Ir.z),this},normalize:function(){this.computeBoundingSphere();var e=this.boundingSphere.center,t=this.boundingSphere.radius,n=0===t?1:1/t,i=new Tn;return i.set(n,0,0,-n*e.x,0,n,0,-n*e.y,0,0,n,-n*e.z,0,0,0,1),this.applyMatrix4(i),this},computeFaceNormals:function(){for(var e=new gn,t=new gn,n=0,i=this.faces.length;n<i;n++){var r=this.faces[n],a=this.vertices[r.a],o=this.vertices[r.b],s=this.vertices[r.c];e.subVectors(s,o),t.subVectors(a,o),e.cross(t),e.normalize(),r.normal.copy(e)}},computeVertexNormals:function(e){var t,n,i,r,a,o;for(void 0===e&&(e=!0),o=new Array(this.vertices.length),t=0,n=this.vertices.length;t<n;t++)o[t]=new gn;if(e){var s,c,l,u=new gn,h=new gn;for(i=0,r=this.faces.length;i<r;i++)a=this.faces[i],s=this.vertices[a.a],c=this.vertices[a.b],l=this.vertices[a.c],u.subVectors(l,c),h.subVectors(s,c),u.cross(h),o[a.a].add(u),o[a.b].add(u),o[a.c].add(u)}else for(this.computeFaceNormals(),i=0,r=this.faces.length;i<r;i++)o[(a=this.faces[i]).a].add(a.normal),o[a.b].add(a.normal),o[a.c].add(a.normal);for(t=0,n=this.vertices.length;t<n;t++)o[t].normalize();for(i=0,r=this.faces.length;i<r;i++){var d=(a=this.faces[i]).vertexNormals;3===d.length?(d[0].copy(o[a.a]),d[1].copy(o[a.b]),d[2].copy(o[a.c])):(d[0]=o[a.a].clone(),d[1]=o[a.b].clone(),d[2]=o[a.c].clone())}0<this.faces.length&&(this.normalsNeedUpdate=!0)},computeFlatVertexNormals:function(){var e,t,n;for(this.computeFaceNormals(),e=0,t=this.faces.length;e<t;e++){var i=(n=this.faces[e]).vertexNormals;3===i.length?(i[0].copy(n.normal),i[1].copy(n.normal),i[2].copy(n.normal)):(i[0]=n.normal.clone(),i[1]=n.normal.clone(),i[2]=n.normal.clone())}0<this.faces.length&&(this.normalsNeedUpdate=!0)},computeMorphNormals:function(){var e,t,n,i,r;for(n=0,i=this.faces.length;n<i;n++)for((r=this.faces[n]).__originalFaceNormal?r.__originalFaceNormal.copy(r.normal):r.__originalFaceNormal=r.normal.clone(),r.__originalVertexNormals||(r.__originalVertexNormals=[]),e=0,t=r.vertexNormals.length;e<t;e++)r.__originalVertexNormals[e]?r.__originalVertexNormals[e].copy(r.vertexNormals[e]):r.__originalVertexNormals[e]=r.vertexNormals[e].clone();var a=new Or;for(a.faces=this.faces,e=0,t=this.morphTargets.length;e<t;e++){if(!this.morphNormals[e]){this.morphNormals[e]={},this.morphNormals[e].faceNormals=[],this.morphNormals[e].vertexNormals=[];var o=this.morphNormals[e].faceNormals,s=this.morphNormals[e].vertexNormals;for(n=0,i=this.faces.length;n<i;n++)c=new gn,l={a:new gn,b:new gn,c:new gn},o.push(c),s.push(l)}var c,l,u=this.morphNormals[e];for(a.vertices=this.morphTargets[e].vertices,a.computeFaceNormals(),a.computeVertexNormals(),n=0,i=this.faces.length;n<i;n++)r=this.faces[n],c=u.faceNormals[n],l=u.vertexNormals[n],c.copy(r.normal),l.a.copy(r.vertexNormals[0]),l.b.copy(r.vertexNormals[1]),l.c.copy(r.vertexNormals[2])}for(n=0,i=this.faces.length;n<i;n++)(r=this.faces[n]).normal=r.__originalFaceNormal,r.vertexNormals=r.__originalVertexNormals},computeBoundingBox:function(){null===this.boundingBox&&(this.boundingBox=new ri),this.boundingBox.setFromPoints(this.vertices)},computeBoundingSphere:function(){null===this.boundingSphere&&(this.boundingSphere=new si),this.boundingSphere.setFromPoints(this.vertices)},merge:function(e,t,n){if(e&&e.isGeometry){var i,r=this.vertices.length,a=this.vertices,o=e.vertices,s=this.faces,c=e.faces,l=this.colors,u=e.colors;void 0===n&&(n=0),void 0!==t&&(i=(new sn).getNormalMatrix(t));for(var h=0,d=o.length;h<d;h++){var p=o[h].clone();void 0!==t&&p.applyMatrix4(t),a.push(p)}for(h=0,d=u.length;h<d;h++)l.push(u[h].clone());for(h=0,d=c.length;h<d;h++){var f,m,v,g=c[h],y=g.vertexNormals,_=g.vertexColors;(f=new Ui(g.a+r,g.b+r,g.c+r)).normal.copy(g.normal),void 0!==i&&f.normal.applyMatrix3(i).normalize();for(var x=0,b=y.length;x<b;x++)m=y[x].clone(),void 0!==i&&m.applyMatrix3(i).normalize(),f.vertexNormals.push(m);f.color.copy(g.color);for(x=0,b=_.length;x<b;x++)v=_[x],f.vertexColors.push(v.clone());f.materialIndex=g.materialIndex+n,s.push(f)}for(h=0,d=e.faceVertexUvs.length;h<d;h++){var w=e.faceVertexUvs[h];void 0===this.faceVertexUvs[h]&&(this.faceVertexUvs[h]=[]);for(x=0,b=w.length;x<b;x++){for(var M=w[x],S=[],T=0,E=M.length;T<E;T++)S.push(M[T].clone());this.faceVertexUvs[h].push(S)}}}else console.error("THREE.Geometry.merge(): geometry not an instance of THREE.Geometry.",e)},mergeMesh:function(e){e&&e.isMesh?(e.matrixAutoUpdate&&e.updateMatrix(),this.merge(e.geometry,e.matrix)):console.error("THREE.Geometry.mergeMesh(): mesh not an instance of THREE.Mesh.",e)},mergeVertices:function(){var e,t,n,i,r,a,o,s,c={},l=[],u=[],h=Math.pow(10,4);for(n=0,i=this.vertices.length;n<i;n++)e=this.vertices[n],void 0===c[t=Math.round(e.x*h)+"_"+Math.round(e.y*h)+"_"+Math.round(e.z*h)]?(c[t]=n,l.push(this.vertices[n]),u[n]=l.length-1):u[n]=u[c[t]];var d=[];for(n=0,i=this.faces.length;n<i;n++){(r=this.faces[n]).a=u[r.a],r.b=u[r.b],r.c=u[r.c],a=[r.a,r.b,r.c];for(var p=0;p<3;p++)if(a[p]===a[(p+1)%3]){d.push(n);break}}for(n=d.length-1;0<=n;n--){var f=d[n];for(this.faces.splice(f,1),o=0,s=this.faceVertexUvs.length;o<s;o++)this.faceVertexUvs[o].splice(f,1)}var m=this.vertices.length-l.length;return this.vertices=l,m},setFromPoints:function(e){this.vertices=[];for(var t=0,n=e.length;t<n;t++){var i=e[t];this.vertices.push(new gn(i.x,i.y,i.z||0))}return this},sortFacesByMaterialIndex:function(){for(var e=this.faces,t=e.length,n=0;n<t;n++)e[n]._id=n;e.sort(function(e,t){return e.materialIndex-t.materialIndex});var i,r,a=this.faceVertexUvs[0],o=this.faceVertexUvs[1];a&&a.length===t&&(i=[]),o&&o.length===t&&(r=[]);for(n=0;n<t;n++){var s=e[n]._id;i&&i.push(a[s]),r&&r.push(o[s])}i&&(this.faceVertexUvs[0]=i),r&&(this.faceVertexUvs[1]=r)},toJSON:function(){var e={metadata:{version:4.5,type:"Geometry",generator:"Geometry.toJSON"}};if(e.uuid=this.uuid,e.type=this.type,""!==this.name&&(e.name=this.name),void 0!==this.parameters){var t=this.parameters;for(var n in t)void 0!==t[n]&&(e[n]=t[n]);return e}for(var i=[],r=0;r<this.vertices.length;r++){var a=this.vertices[r];i.push(a.x,a.y,a.z)}var o=[],s=[],c={},l=[],u={},h=[],d={};for(r=0;r<this.faces.length;r++){var p=this.faces[r],f=void 0!==this.faceVertexUvs[0][r],m=0<p.normal.length(),v=0<p.vertexNormals.length,g=1!==p.color.r||1!==p.color.g||1!==p.color.b,y=0<p.vertexColors.length,_=0;if(_=M(_,0,0),_=M(_,1,!0),_=M(_,2,!1),_=M(_,3,f),_=M(_,4,m),_=M(_,5,v),_=M(_,6,g),_=M(_,7,y),o.push(_),o.push(p.a,p.b,p.c),o.push(p.materialIndex),f){var x=this.faceVertexUvs[0][r];o.push(E(x[0]),E(x[1]),E(x[2]))}if(m&&o.push(S(p.normal)),v){var b=p.vertexNormals;o.push(S(b[0]),S(b[1]),S(b[2]))}if(g&&o.push(T(p.color)),y){var w=p.vertexColors;o.push(T(w[0]),T(w[1]),T(w[2]))}}function M(e,t,n){return n?e|1<<t:e&~(1<<t)}function S(e){var t=e.x.toString()+e.y.toString()+e.z.toString();return void 0!==c[t]||(c[t]=s.length/3,s.push(e.x,e.y,e.z)),c[t]}function T(e){var t=e.r.toString()+e.g.toString()+e.b.toString();return void 0!==u[t]||(u[t]=l.length,l.push(e.getHex())),u[t]}function E(e){var t=e.x.toString()+e.y.toString();return void 0!==d[t]||(d[t]=h.length/2,h.push(e.x,e.y)),d[t]}return e.data={},e.data.vertices=i,e.data.normals=s,0<l.length&&(e.data.colors=l),0<h.length&&(e.data.uvs=[h]),e.data.faces=o,e},clone:function(){return(new Or).copy(this)},copy:function(e){var t,n,i,r,a,o;this.vertices=[],this.colors=[],this.faces=[],this.faceVertexUvs=[[]],this.morphTargets=[],this.morphNormals=[],this.skinWeights=[],this.skinIndices=[],this.lineDistances=[],this.boundingBox=null,this.boundingSphere=null,this.name=e.name;var s=e.vertices;for(t=0,n=s.length;t<n;t++)this.vertices.push(s[t].clone());var c=e.colors;for(t=0,n=c.length;t<n;t++)this.colors.push(c[t].clone());var l=e.faces;for(t=0,n=l.length;t<n;t++)this.faces.push(l[t].clone());for(t=0,n=e.faceVertexUvs.length;t<n;t++){var u=e.faceVertexUvs[t];for(void 0===this.faceVertexUvs[t]&&(this.faceVertexUvs[t]=[]),i=0,r=u.length;i<r;i++){var h=u[i],d=[];for(a=0,o=h.length;a<o;a++){var p=h[a];d.push(p.clone())}this.faceVertexUvs[t].push(d)}}var f=e.morphTargets;for(t=0,n=f.length;t<n;t++){var m={};if(m.name=f[t].name,void 0!==f[t].vertices)for(m.vertices=[],i=0,r=f[t].vertices.length;i<r;i++)m.vertices.push(f[t].vertices[i].clone());if(void 0!==f[t].normals)for(m.normals=[],i=0,r=f[t].normals.length;i<r;i++)m.normals.push(f[t].normals[i].clone());this.morphTargets.push(m)}var v=e.morphNormals;for(t=0,n=v.length;t<n;t++){var g={};if(void 0!==v[t].vertexNormals)for(g.vertexNormals=[],i=0,r=v[t].vertexNormals.length;i<r;i++){var y=v[t].vertexNormals[i],_={};_.a=y.a.clone(),_.b=y.b.clone(),_.c=y.c.clone(),g.vertexNormals.push(_)}if(void 0!==v[t].faceNormals)for(g.faceNormals=[],i=0,r=v[t].faceNormals.length;i<r;i++)g.faceNormals.push(v[t].faceNormals[i].clone());this.morphNormals.push(g)}var x=e.skinWeights;for(t=0,n=x.length;t<n;t++)this.skinWeights.push(x[t].clone());var b=e.skinIndices;for(t=0,n=b.length;t<n;t++)this.skinIndices.push(b[t].clone());var w=e.lineDistances;for(t=0,n=w.length;t<n;t++)this.lineDistances.push(w[t]);var M=e.boundingBox;null!==M&&(this.boundingBox=M.clone());var S=e.boundingSphere;return null!==S&&(this.boundingSphere=S.clone()),this.elementsNeedUpdate=e.elementsNeedUpdate,this.verticesNeedUpdate=e.verticesNeedUpdate,this.uvsNeedUpdate=e.uvsNeedUpdate,this.normalsNeedUpdate=e.normalsNeedUpdate,this.colorsNeedUpdate=e.colorsNeedUpdate,this.lineDistancesNeedUpdate=e.lineDistancesNeedUpdate,this.groupsNeedUpdate=e.groupsNeedUpdate,this},dispose:function(){this.dispatchEvent({type:"dispose"})}});var Dr=function(s){function e(e,t,n,i,r,a){var o;return(o=s.call(this)||this).type="BoxGeometry",o.parameters={width:e,height:t,depth:n,widthSegments:i,heightSegments:r,depthSegments:a},o.fromBufferGeometry(new Nr(e,t,n,i,r,a)),o.mergeVertices(),o}return o(e,s),e}(Or),Nr=function(c){function e(e,t,n,i,r,a){var o;(o=c.call(this)||this).type="BoxBufferGeometry",o.parameters={width:e,height:t,depth:n,widthSegments:i,heightSegments:r,depthSegments:a};var R=function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(o);e=e||1,t=t||1,n=n||1,i=Math.floor(i)||1,r=Math.floor(r)||1,a=Math.floor(a)||1;var P=[],C=[],I=[],O=[],D=0,N=0;function s(e,t,n,i,r,a,o,s,c,l,u){var h,d,p=a/c,f=o/l,m=a/2,v=o/2,g=s/2,y=c+1,_=l+1,x=0,b=0,w=new gn;for(d=0;d<_;d++){var M=d*f-v;for(h=0;h<y;h++){var S=h*p-m;w[e]=S*i,w[t]=M*r,w[n]=g,C.push(w.x,w.y,w.z),w[e]=0,w[t]=0,w[n]=0<s?1:-1,I.push(w.x,w.y,w.z),O.push(h/c),O.push(1-d/l),x+=1}}for(d=0;d<l;d++)for(h=0;h<c;h++){var T=D+h+y*d,E=D+h+y*(d+1),A=D+(h+1)+y*(d+1),L=D+(h+1)+y*d;P.push(T,E,L),P.push(E,A,L),b+=6}R.addGroup(N,b,u),N+=b,D+=x}return s("z","y","x",-1,-1,n,t,e,a,r,0),s("z","y","x",1,-1,n,t,-e,a,r,1),s("x","z","y",1,1,e,n,t,i,a,2),s("x","z","y",1,-1,e,n,-t,i,a,3),s("x","y","z",1,-1,e,t,n,i,r,4),s("x","y","z",-1,-1,e,t,-n,i,r,5),o.setIndex(P),o.setAttribute("position",new Ki(C,3)),o.setAttribute("normal",new Ki(I,3)),o.setAttribute("uv",new Ki(O,2)),o}return o(e,c),e}(cr);function Fr(e){var t={};for(var n in e)for(var i in t[n]={},e[n]){var r=e[n][i];r&&(r.isColor||r.isMatrix3||r.isMatrix4||r.isVector2||r.isVector3||r.isVector4||r.isTexture)?t[n][i]=r.clone():Array.isArray(r)?t[n][i]=r.slice():t[n][i]=r}return t}function zr(e){for(var t={},n=0;n<e.length;n++){var i=Fr(e[n]);for(var r in i)t[r]=i[r]}return t}var Ur={clone:Fr,merge:zr},Br="void main() {\n\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",Gr="void main() {\n\tgl_FragColor = vec4( 1.0, 0.0, 0.0, 1.0 );\n}";function Hr(e){Gi.call(this),this.type="ShaderMaterial",this.defines={},this.uniforms={},this.vertexShader=Br,this.fragmentShader=Gr,this.linewidth=1,this.wireframe=!1,this.wireframeLinewidth=1,this.fog=!1,this.lights=!1,this.clipping=!1,this.skinning=!1,this.morphTargets=!1,this.morphNormals=!1,this.extensions={derivatives:!1,fragDepth:!1,drawBuffers:!1,shaderTextureLOD:!1},this.defaultAttributeValues={color:[1,1,1],uv:[0,0],uv2:[0,0]},this.index0AttributeName=void 0,this.uniformsNeedUpdate=!1,void 0!==e&&(void 0!==e.attributes&&console.error("THREE.ShaderMaterial: attributes should now be defined in THREE.BufferGeometry instead."),this.setValues(e))}function kr(){Vn.call(this),this.type="Camera",this.matrixWorldInverse=new Tn,this.projectionMatrix=new Tn,this.projectionMatrixInverse=new Tn}function Vr(e,t,n,i){kr.call(this),this.type="PerspectiveCamera",this.fov=void 0!==e?e:50,this.zoom=1,this.near=void 0!==n?n:.1,this.far=void 0!==i?i:2e3,this.focus=10,this.aspect=void 0!==t?t:1,this.view=null,this.filmGauge=35,this.filmOffset=0,this.updateProjectionMatrix()}((Hr.prototype=Object.create(Gi.prototype)).constructor=Hr).prototype.isShaderMaterial=!0,Hr.prototype.copy=function(e){return Gi.prototype.copy.call(this,e),this.fragmentShader=e.fragmentShader,this.vertexShader=e.vertexShader,this.uniforms=Fr(e.uniforms),this.defines=J({},e.defines),this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.lights=e.lights,this.clipping=e.clipping,this.skinning=e.skinning,this.morphTargets=e.morphTargets,this.morphNormals=e.morphNormals,this.extensions=e.extensions,this},Hr.prototype.toJSON=function(e){var t=Gi.prototype.toJSON.call(this,e);for(var n in t.uniforms={},this.uniforms){var i=this.uniforms[n].value;i&&i.isTexture?t.uniforms[n]={type:"t",value:i.toJSON(e).uuid}:i&&i.isColor?t.uniforms[n]={type:"c",value:i.getHex()}:i&&i.isVector2?t.uniforms[n]={type:"v2",value:i.toArray()}:i&&i.isVector3?t.uniforms[n]={type:"v3",value:i.toArray()}:i&&i.isVector4?t.uniforms[n]={type:"v4",value:i.toArray()}:i&&i.isMatrix3?t.uniforms[n]={type:"m3",value:i.toArray()}:i&&i.isMatrix4?t.uniforms[n]={type:"m4",value:i.toArray()}:t.uniforms[n]={value:i}}0<Object.keys(this.defines).length&&(t.defines=this.defines),t.vertexShader=this.vertexShader,t.fragmentShader=this.fragmentShader;var r={};for(var a in this.extensions)!0===this.extensions[a]&&(r[a]=!0);return 0<Object.keys(r).length&&(t.extensions=r),t},kr.prototype=J(Object.create(Vn.prototype),{constructor:kr,isCamera:!0,copy:function(e,t){return Vn.prototype.copy.call(this,e,t),this.matrixWorldInverse.copy(e.matrixWorldInverse),this.projectionMatrix.copy(e.projectionMatrix),this.projectionMatrixInverse.copy(e.projectionMatrixInverse),this},getWorldDirection:function(e){void 0===e&&(console.warn("THREE.Camera: .getWorldDirection() target is now required"),e=new gn),this.updateMatrixWorld(!0);var t=this.matrixWorld.elements;return e.set(-t[8],-t[9],-t[10]).normalize()},updateMatrixWorld:function(e){Vn.prototype.updateMatrixWorld.call(this,e),this.matrixWorldInverse.getInverse(this.matrixWorld)},updateWorldMatrix:function(e,t){Vn.prototype.updateWorldMatrix.call(this,e,t),this.matrixWorldInverse.getInverse(this.matrixWorld)},clone:function(){return(new this.constructor).copy(this)}}),Vr.prototype=J(Object.create(kr.prototype),{constructor:Vr,isPerspectiveCamera:!0,copy:function(e,t){return kr.prototype.copy.call(this,e,t),this.fov=e.fov,this.zoom=e.zoom,this.near=e.near,this.far=e.far,this.focus=e.focus,this.aspect=e.aspect,this.view=null===e.view?null:J({},e.view),this.filmGauge=e.filmGauge,this.filmOffset=e.filmOffset,this},setFocalLength:function(e){var t=.5*this.getFilmHeight()/e;this.fov=2*an.RAD2DEG*Math.atan(t),this.updateProjectionMatrix()},getFocalLength:function(){var e=Math.tan(.5*an.DEG2RAD*this.fov);return.5*this.getFilmHeight()/e},getEffectiveFOV:function(){return 2*an.RAD2DEG*Math.atan(Math.tan(.5*an.DEG2RAD*this.fov)/this.zoom)},getFilmWidth:function(){return this.filmGauge*Math.min(this.aspect,1)},getFilmHeight:function(){return this.filmGauge/Math.max(this.aspect,1)},setViewOffset:function(e,t,n,i,r,a){this.aspect=e/t,null===this.view&&(this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1}),this.view.enabled=!0,this.view.fullWidth=e,this.view.fullHeight=t,this.view.offsetX=n,this.view.offsetY=i,this.view.width=r,this.view.height=a,this.updateProjectionMatrix()},clearViewOffset:function(){null!==this.view&&(this.view.enabled=!1),this.updateProjectionMatrix()},updateProjectionMatrix:function(){var e=this.near,t=e*Math.tan(.5*an.DEG2RAD*this.fov)/this.zoom,n=2*t,i=this.aspect*n,r=-.5*i,a=this.view;if(null!==this.view&&this.view.enabled){var o=a.fullWidth,s=a.fullHeight;r+=a.offsetX*i/o,t-=a.offsetY*n/s,i*=a.width/o,n*=a.height/s}var c=this.filmOffset;0!==c&&(r+=e*c/this.getFilmWidth()),this.projectionMatrix.makePerspective(r,r+i,t,t-n,e,this.far),this.projectionMatrixInverse.getInverse(this.projectionMatrix)},toJSON:function(e){var t=Vn.prototype.toJSON.call(this,e);return t.object.fov=this.fov,t.object.zoom=this.zoom,t.object.near=this.near,t.object.far=this.far,t.object.focus=this.focus,t.object.aspect=this.aspect,null!==this.view&&(t.object.view=J({},this.view)),t.object.filmGauge=this.filmGauge,t.object.filmOffset=this.filmOffset,t}});function jr(e,t,n,i){Vn.call(this),this.type="CubeCamera";var a=new Vr(90,1,e,t);a.up.set(0,-1,0),a.lookAt(new gn(1,0,0)),this.add(a);var o=new Vr(90,1,e,t);o.up.set(0,-1,0),o.lookAt(new gn(-1,0,0)),this.add(o);var s=new Vr(90,1,e,t);s.up.set(0,0,1),s.lookAt(new gn(0,1,0)),this.add(s);var c=new Vr(90,1,e,t);c.up.set(0,0,-1),c.lookAt(new gn(0,-1,0)),this.add(c);var l=new Vr(90,1,e,t);l.up.set(0,-1,0),l.lookAt(new gn(0,0,1)),this.add(l);var u=new Vr(90,1,e,t);u.up.set(0,-1,0),u.lookAt(new gn(0,0,-1)),this.add(u),i=i||{format:et,magFilter:We,minFilter:We},this.renderTarget=new Wr(n,i),this.renderTarget.texture.name="CubeCamera",this.update=function(e,t){null===this.parent&&this.updateMatrixWorld();var n=e.getRenderTarget(),i=this.renderTarget,r=i.texture.generateMipmaps;i.texture.generateMipmaps=!1,e.setRenderTarget(i,0),e.render(t,a),e.setRenderTarget(i,1),e.render(t,o),e.setRenderTarget(i,2),e.render(t,s),e.setRenderTarget(i,3),e.render(t,c),e.setRenderTarget(i,4),e.render(t,l),i.texture.generateMipmaps=r,e.setRenderTarget(i,5),e.render(t,u),e.setRenderTarget(n)},this.clear=function(e,t,n,i){for(var r=e.getRenderTarget(),a=this.renderTarget,o=0;o<6;o++)e.setRenderTarget(a,o),e.clear(t,n,i);e.setRenderTarget(r)}}function Wr(e,t,n){Number.isInteger(t)&&(console.warn("THREE.WebGLCubeRenderTarget: constructor signature is now WebGLCubeRenderTarget( size, options )"),t=n),dn.call(this,e,e,t)}function qr(e,t,n,i,r,a,o,s,c,l,u,h){un.call(this,null,a,o,s,c,l,i,r,u,h),this.image={data:e||null,width:t||1,height:n||1},this.magFilter=void 0!==c?c:ke,this.minFilter=void 0!==l?l:ke,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1,this.needsUpdate=!0}(jr.prototype=Object.create(Vn.prototype)).constructor=jr,((Wr.prototype=Object.create(dn.prototype)).constructor=Wr).prototype.isWebGLCubeRenderTarget=!0,Wr.prototype.fromEquirectangularTexture=function(e,t){this.texture.type=t.type,this.texture.format=t.format,this.texture.encoding=t.encoding;var n=new jn,i={uniforms:{tEquirect:{value:null}},vertexShader:["varying vec3 vWorldDirection;","vec3 transformDirection( in vec3 dir, in mat4 matrix ) {","\treturn normalize( ( matrix * vec4( dir, 0.0 ) ).xyz );","}","void main() {","\tvWorldDirection = transformDirection( position, modelMatrix );","\t#include <begin_vertex>","\t#include <project_vertex>","}"].join("\n"),fragmentShader:["uniform sampler2D tEquirect;","varying vec3 vWorldDirection;","#define RECIPROCAL_PI 0.31830988618","#define RECIPROCAL_PI2 0.15915494","void main() {","\tvec3 direction = normalize( vWorldDirection );","\tvec2 sampleUV;","\tsampleUV.y = asin( clamp( direction.y, - 1.0, 1.0 ) ) * RECIPROCAL_PI + 0.5;","\tsampleUV.x = atan( direction.z, direction.x ) * RECIPROCAL_PI2 + 0.5;","\tgl_FragColor = texture2D( tEquirect, sampleUV );","}"].join("\n")},r=new Hr({type:"CubemapFromEquirect",uniforms:Fr(i.uniforms),vertexShader:i.vertexShader,fragmentShader:i.fragmentShader,side:Me,blending:ne});r.uniforms.tEquirect.value=t;var a=new Er(new Nr(5,5,5),r);n.add(a);var o=new jr(1,10,1);return o.renderTarget=this,o.renderTarget.texture.name="CubeCameraTexture",o.update(e,n),a.geometry.dispose(),a.material.dispose(),this},((qr.prototype=Object.create(un.prototype)).constructor=qr).prototype.isDataTexture=!0;var Xr=new si,Yr=new gn;function Zr(e,t,n,i,r,a){this.planes=[void 0!==e?e:new _i,void 0!==t?t:new _i,void 0!==n?n:new _i,void 0!==i?i:new _i,void 0!==r?r:new _i,void 0!==a?a:new _i]}J(Zr.prototype,{set:function(e,t,n,i,r,a){var o=this.planes;return o[0].copy(e),o[1].copy(t),o[2].copy(n),o[3].copy(i),o[4].copy(r),o[5].copy(a),this},clone:function(){return(new this.constructor).copy(this)},copy:function(e){for(var t=this.planes,n=0;n<6;n++)t[n].copy(e.planes[n]);return this},setFromProjectionMatrix:function(e){var t=this.planes,n=e.elements,i=n[0],r=n[1],a=n[2],o=n[3],s=n[4],c=n[5],l=n[6],u=n[7],h=n[8],d=n[9],p=n[10],f=n[11],m=n[12],v=n[13],g=n[14],y=n[15];return t[0].setComponents(o-i,u-s,f-h,y-m).normalize(),t[1].setComponents(o+i,u+s,f+h,y+m).normalize(),t[2].setComponents(o+r,u+c,f+d,y+v).normalize(),t[3].setComponents(o-r,u-c,f-d,y-v).normalize(),t[4].setComponents(o-a,u-l,f-p,y-g).normalize(),t[5].setComponents(o+a,u+l,f+p,y+g).normalize(),this},intersectsObject:function(e){var t=e.geometry;return null===t.boundingSphere&&t.computeBoundingSphere(),Xr.copy(t.boundingSphere).applyMatrix4(e.matrixWorld),this.intersectsSphere(Xr)},intersectsSprite:function(e){return Xr.center.set(0,0,0),Xr.radius=.7071067811865476,Xr.applyMatrix4(e.matrixWorld),this.intersectsSphere(Xr)},intersectsSphere:function(e){for(var t=this.planes,n=e.center,i=-e.radius,r=0;r<6;r++){if(t[r].distanceToPoint(n)<i)return!1}return!0},intersectsBox:function(e){for(var t=this.planes,n=0;n<6;n++){var i=t[n];if(Yr.x=0<i.normal.x?e.max.x:e.min.x,Yr.y=0<i.normal.y?e.max.y:e.min.y,Yr.z=0<i.normal.z?e.max.z:e.min.z,i.distanceToPoint(Yr)<0)return!1}return!0},containsPoint:function(e){for(var t=this.planes,n=0;n<6;n++)if(t[n].distanceToPoint(e)<0)return!1;return!0}});var Jr={common:{diffuse:{value:new Di(15658734)},opacity:{value:1},map:{value:null},uvTransform:{value:new sn},uv2Transform:{value:new sn},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 on(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 Di(16777215)}},lights:{ambientLightColor:{value:[]},lightProbe:{value:[]},directionalLights:{value:[],properties:{direction:{},color:{}}},directionalLightShadows:{value:[],properties:{shadowBias:{},shadowRadius:{},shadowMapSize:{}}},directionalShadowMap:{value:[]},directionalShadowMatrix:{value:[]},spotLights:{value:[],properties:{color:{},position:{},direction:{},distance:{},coneCos:{},penumbraCos:{},decay:{}}},spotLightShadows:{value:[],properties:{shadowBias:{},shadowRadius:{},shadowMapSize:{}}},spotShadowMap:{value:[]},spotShadowMatrix:{value:[]},pointLights:{value:[],properties:{color:{},position:{},decay:{},distance:{}}},pointLightShadows:{value:[],properties:{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 Di(15658734)},opacity:{value:1},size:{value:1},scale:{value:1},map:{value:null},alphaMap:{value:null},uvTransform:{value:new sn}},sprite:{diffuse:{value:new Di(15658734)},opacity:{value:1},center:{value:new on(.5,.5)},rotation:{value:0},map:{value:null},alphaMap:{value:null},uvTransform:{value:new sn}}};function Kr(){var n=null,i=!1,r=null;function a(e,t){!1!==i&&(r(e,t),n.requestAnimationFrame(a))}return{start:function(){!0!==i&&null!==r&&(n.requestAnimationFrame(a),i=!0)},stop:function(){i=!1},setAnimationLoop:function(e){r=e},setContext:function(e){n=e}}}function Qr(c,e){var l=e.isWebGL2,u=new WeakMap;return{get:function(e){return e.isInterleavedBufferAttribute&&(e=e.data),u.get(e)},remove:function(e){e.isInterleavedBufferAttribute&&(e=e.data);var t=u.get(e);t&&(c.deleteBuffer(t.buffer),u.delete(e))},update:function(e,t){e.isInterleavedBufferAttribute&&(e=e.data);var n,i,r,a,o,s=u.get(e);void 0===s?u.set(e,function(e,t){var n=e.array,i=e.usage,r=c.createBuffer();c.bindBuffer(t,r),c.bufferData(t,n,i),e.onUploadCallback();var a=5126;return n instanceof Float32Array?a=5126:n instanceof Float64Array?console.warn("THREE.WebGLAttributes: Unsupported data buffer format: Float64Array."):n instanceof Uint16Array?a=5123:n instanceof Int16Array?a=5122:n instanceof Uint32Array?a=5125:n instanceof Int32Array?a=5124:n instanceof Int8Array?a=5120:n instanceof Uint8Array&&(a=5121),{buffer:r,type:a,bytesPerElement:n.BYTES_PER_ELEMENT,version:e.version}}(e,t)):s.version<e.version&&(n=s.buffer,r=t,a=(i=e).array,o=i.updateRange,c.bindBuffer(r,n),-1===o.count?c.bufferSubData(r,0,a):(l?c.bufferSubData(r,o.offset*a.BYTES_PER_ELEMENT,a,o.offset,o.count):c.bufferSubData(r,o.offset*a.BYTES_PER_ELEMENT,a.subarray(o.offset,o.offset+o.count)),o.count=-1),s.version=e.version)}}}function $r(e,t,n,i){Or.call(this),this.type="PlaneGeometry",this.parameters={width:e,height:t,widthSegments:n,heightSegments:i},this.fromBufferGeometry(new ea(e,t,n,i)),this.mergeVertices()}function ea(e,t,n,i){cr.call(this),this.type="PlaneBufferGeometry",this.parameters={width:e,height:t,widthSegments:n,heightSegments:i};var r,a,o=(e=e||1)/2,s=(t=t||1)/2,c=Math.floor(n)||1,l=Math.floor(i)||1,u=c+1,h=l+1,d=e/c,p=t/l,f=[],m=[],v=[],g=[];for(a=0;a<h;a++){var y=a*p-s;for(r=0;r<u;r++){var _=r*d-o;m.push(_,-y,0),v.push(0,0,1),g.push(r/c),g.push(1-a/l)}}for(a=0;a<l;a++)for(r=0;r<c;r++){var x=r+u*a,b=r+u*(a+1),w=r+1+u*(a+1),M=r+1+u*a;f.push(x,b,M),f.push(b,w,M)}this.setIndex(f),this.setAttribute("position",new Ki(m,3)),this.setAttribute("normal",new Ki(v,3)),this.setAttribute("uv",new Ki(g,2))}($r.prototype=Object.create(Or.prototype)).constructor=$r,(ea.prototype=Object.create(cr.prototype)).constructor=ea;var ta={alphamap_fragment:"#ifdef USE_ALPHAMAP\n\tdiffuseColor.a *= texture2D( alphaMap, vUv ).g;\n#endif",alphamap_pars_fragment:"#ifdef USE_ALPHAMAP\n\tuniform sampler2D alphaMap;\n#endif",alphatest_fragment:"#ifdef ALPHATEST\n\tif ( diffuseColor.a < ALPHATEST ) discard;\n#endif",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( STANDARD )\n\t\tfloat dotNV = saturate( dot( geometry.normal, geometry.viewDir ) );\n\t\treflectedLight.indirectSpecular *= computeSpecularOcclusion( dotNV, ambientOcclusion, material.specularRoughness );\n\t#endif\n#endif",aomap_pars_fragment:"#ifdef USE_AOMAP\n\tuniform sampler2D aoMap;\n\tuniform float aoMapIntensity;\n#endif",begin_vertex:"vec3 transformed = vec3( position );",beginnormal_vertex:"vec3 objectNormal = vec3( normal );\n#ifdef USE_TANGENT\n\tvec3 objectTangent = vec3( tangent.xyz );\n#endif",bsdfs:"vec2 integrateSpecularBRDF( const in float dotNV, const in float roughness ) {\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\treturn vec2( -1.04, 1.04 ) * a004 + r.zw;\n}\nfloat punctualLightIntensityToIrradianceFactor( const in float lightDistance, const in float cutoffDistance, const in float decayExponent ) {\n#if defined ( PHYSICALLY_CORRECT_LIGHTS )\n\tfloat distanceFalloff = 1.0 / max( pow( lightDistance, decayExponent ), 0.01 );\n\tif( cutoffDistance > 0.0 ) {\n\t\tdistanceFalloff *= pow2( saturate( 1.0 - pow4( lightDistance / cutoffDistance ) ) );\n\t}\n\treturn distanceFalloff;\n#else\n\tif( cutoffDistance > 0.0 && decayExponent > 0.0 ) {\n\t\treturn pow( saturate( -lightDistance / cutoffDistance + 1.0 ), decayExponent );\n\t}\n\treturn 1.0;\n#endif\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}\nvec3 F_Schlick_RoughnessDependent( const in vec3 F0, const in float dotNV, const in float roughness ) {\n\tfloat fresnel = exp2( ( -5.55473 * dotNV - 6.98316 ) * dotNV );\n\tvec3 Fr = max( vec3( 1.0 - roughness ), F0 ) - F0;\n\treturn Fr * fresnel + F0;\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 vec3 viewDir, const in vec3 normal, const in vec3 specularColor, const in float roughness ) {\n\tfloat alpha = pow2( roughness );\n\tvec3 halfDir = normalize( incidentLight.direction + viewDir );\n\tfloat dotNL = saturate( dot( normal, incidentLight.direction ) );\n\tfloat dotNV = saturate( dot( normal, viewDir ) );\n\tfloat dotNH = saturate( dot( 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 vec3 viewDir, const in vec3 normal, const in vec3 specularColor, const in float roughness ) {\n\tfloat dotNV = saturate( dot( normal, viewDir ) );\n\tvec2 brdf = integrateSpecularBRDF( dotNV, roughness );\n\treturn specularColor * brdf.x + brdf.y;\n}\nvoid BRDF_Specular_Multiscattering_Environment( const in GeometricContext geometry, const in vec3 specularColor, const in float roughness, inout vec3 singleScatter, inout vec3 multiScatter ) {\n\tfloat dotNV = saturate( dot( geometry.normal, geometry.viewDir ) );\n\tvec3 F = F_Schlick_RoughnessDependent( specularColor, dotNV, roughness );\n\tvec2 brdf = integrateSpecularBRDF( dotNV, roughness );\n\tvec3 FssEss = F * brdf.x + brdf.y;\n\tfloat Ess = brdf.x + brdf.y;\n\tfloat Ems = 1.0 - Ess;\n\tvec3 Favg = specularColor + ( 1.0 - specularColor ) * 0.047619;\tvec3 Fms = FssEss * Favg / ( 1.0 - Ems * Favg );\n\tsingleScatter += FssEss;\n\tmultiScatter += Fms * Ems;\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#if defined( USE_SHEEN )\nfloat D_Charlie(float roughness, float NoH) {\n\tfloat invAlpha = 1.0 / roughness;\n\tfloat cos2h = NoH * NoH;\n\tfloat sin2h = max(1.0 - cos2h, 0.0078125);\treturn (2.0 + invAlpha) * pow(sin2h, invAlpha * 0.5) / (2.0 * PI);\n}\nfloat V_Neubelt(float NoV, float NoL) {\n\treturn saturate(1.0 / (4.0 * (NoL + NoV - NoL * NoV)));\n}\nvec3 BRDF_Specular_Sheen( const in float roughness, const in vec3 L, const in GeometricContext geometry, vec3 specularColor ) {\n\tvec3 N = geometry.normal;\n\tvec3 V = geometry.viewDir;\n\tvec3 H = normalize( V + L );\n\tfloat dotNH = saturate( dot( N, H ) );\n\treturn specularColor * D_Charlie( roughness, dotNH ) * V_Neubelt( dot(N, V), dot(N, L) );\n}\n#endif",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\tfDet *= ( float( gl_FrontFacing ) * 2.0 - 1.0 );\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",clipping_planes_fragment:"#if NUM_CLIPPING_PLANES > 0\n\tvec4 plane;\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < UNION_CLIPPING_PLANES; i ++ ) {\n\t\tplane = clippingPlanes[ i ];\n\t\tif ( dot( vClipPosition, plane.xyz ) > plane.w ) discard;\n\t}\n\t#pragma unroll_loop_end\n\t#if UNION_CLIPPING_PLANES < NUM_CLIPPING_PLANES\n\t\tbool clipped = true;\n\t\t#pragma unroll_loop_start\n\t\tfor ( int i = UNION_CLIPPING_PLANES; i < NUM_CLIPPING_PLANES; i ++ ) {\n\t\t\tplane = clippingPlanes[ i ];\n\t\t\tclipped = ( dot( vClipPosition, plane.xyz ) > plane.w ) && clipped;\n\t\t}\n\t\t#pragma unroll_loop_end\n\t\tif ( clipped ) discard;\n\t#endif\n#endif",clipping_planes_pars_fragment:"#if NUM_CLIPPING_PLANES > 0\n\tvarying vec3 vClipPosition;\n\tuniform vec4 clippingPlanes[ NUM_CLIPPING_PLANES ];\n#endif",clipping_planes_pars_vertex:"#if NUM_CLIPPING_PLANES > 0\n\tvarying vec3 vClipPosition;\n#endif",clipping_planes_vertex:"#if NUM_CLIPPING_PLANES > 0\n\tvClipPosition = - mvPosition.xyz;\n#endif",color_fragment:"#ifdef USE_COLOR\n\tdiffuseColor.rgb *= vColor;\n#endif",color_pars_fragment:"#ifdef USE_COLOR\n\tvarying vec3 vColor;\n#endif",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#ifndef saturate\n#define saturate(a) clamp( a, 0.0, 1.0 )\n#endif\n#define whiteComplement(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}\n#ifdef HIGH_PRECISION\n\tfloat precisionSafeLength( vec3 v ) { return length( v ); }\n#else\n\tfloat max3( vec3 v ) { return max( max( v.x, v.y ), v.z ); }\n\tfloat precisionSafeLength( vec3 v ) {\n\t\tfloat maxComponent = max3( abs( v ) );\n\t\treturn length( v / maxComponent ) * maxComponent;\n\t}\n#endif\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#ifdef CLEARCOAT\n\tvec3 clearcoatNormal;\n#endif\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}\nbool isPerspectiveMatrix( mat4 m ) {\n return m[ 2 ][ 3 ] == - 1.0;\n}",cube_uv_reflection_fragment:"#ifdef ENVMAP_TYPE_CUBE_UV\n#define cubeUV_maxMipLevel 8.0\n#define cubeUV_minMipLevel 4.0\n#define cubeUV_maxTileSize 256.0\n#define cubeUV_minTileSize 16.0\nfloat getFace(vec3 direction) {\n vec3 absDirection = abs(direction);\n float face = -1.0;\n if (absDirection.x > absDirection.z) {\n if (absDirection.x > absDirection.y)\n face = direction.x > 0.0 ? 0.0 : 3.0;\n else\n face = direction.y > 0.0 ? 1.0 : 4.0;\n } else {\n if (absDirection.z > absDirection.y)\n face = direction.z > 0.0 ? 2.0 : 5.0;\n else\n face = direction.y > 0.0 ? 1.0 : 4.0;\n }\n return face;\n}\nvec2 getUV(vec3 direction, float face) {\n vec2 uv;\n if (face == 0.0) {\n uv = vec2(-direction.z, direction.y) / abs(direction.x);\n } else if (face == 1.0) {\n uv = vec2(direction.x, -direction.z) / abs(direction.y);\n } else if (face == 2.0) {\n uv = direction.xy / abs(direction.z);\n } else if (face == 3.0) {\n uv = vec2(direction.z, direction.y) / abs(direction.x);\n } else if (face == 4.0) {\n uv = direction.xz / abs(direction.y);\n } else {\n uv = vec2(-direction.x, direction.y) / abs(direction.z);\n }\n return 0.5 * (uv + 1.0);\n}\nvec3 bilinearCubeUV(sampler2D envMap, vec3 direction, float mipInt) {\n float face = getFace(direction);\n float filterInt = max(cubeUV_minMipLevel - mipInt, 0.0);\n mipInt = max(mipInt, cubeUV_minMipLevel);\n float faceSize = exp2(mipInt);\n float texelSize = 1.0 / (3.0 * cubeUV_maxTileSize);\n vec2 uv = getUV(direction, face) * (faceSize - 1.0);\n vec2 f = fract(uv);\n uv += 0.5 - f;\n if (face > 2.0) {\n uv.y += faceSize;\n face -= 3.0;\n }\n uv.x += face * faceSize;\n if(mipInt < cubeUV_maxMipLevel){\n uv.y += 2.0 * cubeUV_maxTileSize;\n }\n uv.y += filterInt * 2.0 * cubeUV_minTileSize;\n uv.x += 3.0 * max(0.0, cubeUV_maxTileSize - 2.0 * faceSize);\n uv *= texelSize;\n vec3 tl = envMapTexelToLinear(texture2D(envMap, uv)).rgb;\n uv.x += texelSize;\n vec3 tr = envMapTexelToLinear(texture2D(envMap, uv)).rgb;\n uv.y += texelSize;\n vec3 br = envMapTexelToLinear(texture2D(envMap, uv)).rgb;\n uv.x -= texelSize;\n vec3 bl = envMapTexelToLinear(texture2D(envMap, uv)).rgb;\n vec3 tm = mix(tl, tr, f.x);\n vec3 bm = mix(bl, br, f.x);\n return mix(tm, bm, f.y);\n}\n#define r0 1.0\n#define v0 0.339\n#define m0 -2.0\n#define r1 0.8\n#define v1 0.276\n#define m1 -1.0\n#define r4 0.4\n#define v4 0.046\n#define m4 2.0\n#define r5 0.305\n#define v5 0.016\n#define m5 3.0\n#define r6 0.21\n#define v6 0.0038\n#define m6 4.0\nfloat roughnessToMip(float roughness) {\n float mip = 0.0;\n if (roughness >= r1) {\n mip = (r0 - roughness) * (m1 - m0) / (r0 - r1) + m0;\n } else if (roughness >= r4) {\n mip = (r1 - roughness) * (m4 - m1) / (r1 - r4) + m1;\n } else if (roughness >= r5) {\n mip = (r4 - roughness) * (m5 - m4) / (r4 - r5) + m4;\n } else if (roughness >= r6) {\n mip = (r5 - roughness) * (m6 - m5) / (r5 - r6) + m5;\n } else {\n mip = -2.0 * log2(1.16 * roughness); }\n return mip;\n}\nvec4 textureCubeUV(sampler2D envMap, vec3 sampleDir, float roughness) {\n float mip = clamp(roughnessToMip(roughness), m0, cubeUV_maxMipLevel);\n float mipF = fract(mip);\n float mipInt = floor(mip);\n vec3 color0 = bilinearCubeUV(envMap, sampleDir, mipInt);\n if (mipF == 0.0) {\n return vec4(color0, 1.0);\n } else {\n vec3 color1 = bilinearCubeUV(envMap, sampleDir, mipInt + 1.0);\n return vec4(mix(color0, color1, mipF), 1.0);\n }\n}\n#endif",defaultnormal_vertex:"vec3 transformedNormal = objectNormal;\n#ifdef USE_INSTANCING\n\tmat3 m = mat3( instanceMatrix );\n\ttransformedNormal /= vec3( dot( m[ 0 ], m[ 0 ] ), dot( m[ 1 ], m[ 1 ] ), dot( m[ 2 ], m[ 2 ] ) );\n\ttransformedNormal = m * transformedNormal;\n#endif\ntransformedNormal = normalMatrix * transformedNormal;\n#ifdef FLIP_SIDED\n\ttransformedNormal = - transformedNormal;\n#endif\n#ifdef USE_TANGENT\n\tvec3 transformedTangent = ( modelViewMatrix * vec4( objectTangent, 0.0 ) ).xyz;\n\t#ifdef FLIP_SIDED\n\t\ttransformedTangent = - transformedTangent;\n\t#endif\n#endif",displacementmap_pars_vertex:"#ifdef USE_DISPLACEMENTMAP\n\tuniform sampler2D displacementMap;\n\tuniform float displacementScale;\n\tuniform float displacementBias;\n#endif",displacementmap_vertex:"#ifdef USE_DISPLACEMENTMAP\n\ttransformed += normalize( objectNormal ) * ( texture2D( displacementMap, vUv ).x * displacementScale + displacementBias );\n#endif",emissivemap_fragment:"#ifdef USE_EMISSIVEMAP\n\tvec4 emissiveColor = texture2D( emissiveMap, vUv );\n\temissiveColor.rgb = emissiveMapTexelToLinear( emissiveColor ).rgb;\n\ttotalEmissiveRadiance *= emissiveColor.rgb;\n#endif",emissivemap_pars_fragment:"#ifdef USE_EMISSIVEMAP\n\tuniform sampler2D emissiveMap;\n#endif",encodings_fragment:"gl_FragColor = linearToOutputTexel( gl_FragColor );",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.rgb, vec3( gammaFactor ) ), value.a );\n}\nvec4 LinearToGamma( in vec4 value, in float gammaFactor ) {\n\treturn vec4( pow( value.rgb, vec3( 1.0 / gammaFactor ) ), value.a );\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.a );\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.a );\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.rgb * value.a * maxRange, 1.0 );\n}\nvec4 LinearToRGBM( in vec4 value, in float maxRange ) {\n\tfloat maxRGB = max( value.r, 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.r, max( value.g, value.b ) );\n\tfloat D = max( maxRange / maxRGB, 1.0 );\n\tD = clamp( floor( D ) / 255.0, 0.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 = cLogLuvM * value.rgb;\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 = cLogLuvInverseM * Xp_Y_XYZp.rgb;\n\treturn vec4( max( vRGB, 0.0 ), 1.0 );\n}",envmap_fragment:"#ifdef USE_ENVMAP\n\t#ifdef ENV_WORLDPOS\n\t\tvec3 cameraToFrag;\n\t\t\n\t\tif ( isOrthographic ) {\n\t\t\tcameraToFrag = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) );\n\t\t} else {\n\t\t\tcameraToFrag = normalize( vWorldPosition - cameraPosition );\n\t\t}\n\t\tvec3 worldNormal = inverseTransformDirection( normal, viewMatrix );\n\t\t#ifdef ENVMAP_MODE_REFLECTION\n\t\t\tvec3 reflectVec = reflect( cameraToFrag, worldNormal );\n\t\t#else\n\t\t\tvec3 reflectVec = refract( cameraToFrag, 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_CUBE_UV )\n\t\tvec4 envColor = textureCubeUV( envMap, reflectVec, 0.0 );\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\t#ifndef ENVMAP_TYPE_CUBE_UV\n\t\tenvColor = envMapTexelToLinear( envColor );\n\t#endif\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",envmap_common_pars_fragment:"#ifdef USE_ENVMAP\n\tuniform float envMapIntensity;\n\tuniform float flipEnvMap;\n\tuniform int maxMipLevel;\n\t#ifdef ENVMAP_TYPE_CUBE\n\t\tuniform samplerCube envMap;\n\t#else\n\t\tuniform sampler2D envMap;\n\t#endif\n\t\n#endif",envmap_pars_fragment:"#ifdef USE_ENVMAP\n\tuniform float reflectivity;\n\t#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG )\n\t\t#define ENV_WORLDPOS\n\t#endif\n\t#ifdef ENV_WORLDPOS\n\t\tvarying vec3 vWorldPosition;\n\t\tuniform float refractionRatio;\n\t#else\n\t\tvarying vec3 vReflect;\n\t#endif\n#endif",envmap_pars_vertex:"#ifdef USE_ENVMAP\n\t#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) ||defined( PHONG )\n\t\t#define ENV_WORLDPOS\n\t#endif\n\t#ifdef ENV_WORLDPOS\n\t\t\n\t\tvarying vec3 vWorldPosition;\n\t#else\n\t\tvarying vec3 vReflect;\n\t\tuniform float refractionRatio;\n\t#endif\n#endif",envmap_physical_pars_fragment:"#if defined( USE_ENVMAP )\n\t#ifdef ENVMAP_MODE_REFRACTION\n\t\tuniform float refractionRatio;\n\t#endif\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\tvec4 envMapColor = textureCubeUV( envMap, worldNormal, 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 roughness, const in int maxMIPLevel ) {\n\t\tfloat maxMIPLevelScalar = float( maxMIPLevel );\n\t\tfloat sigma = PI * roughness * roughness / ( 1.0 + roughness );\n\t\tfloat desiredMIPLevel = maxMIPLevelScalar + log2( sigma );\n\t\treturn clamp( desiredMIPLevel, 0.0, maxMIPLevelScalar );\n\t}\n\tvec3 getLightProbeIndirectRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness, const in int maxMIPLevel ) {\n\t\t#ifdef ENVMAP_MODE_REFLECTION\n\t\t vec3 reflectVec = reflect( -viewDir, normal );\n\t\t reflectVec = normalize( mix( reflectVec, normal, roughness * roughness) );\n\t\t#else\n\t\t vec3 reflectVec = refract( -viewDir, normal, refractionRatio );\n\t\t#endif\n\t\treflectVec = inverseTransformDirection( reflectVec, viewMatrix );\n\t\tfloat specularMIPLevel = getSpecularMIPLevel( roughness, 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\tvec4 envMapColor = textureCubeUV( envMap, reflectVec, roughness );\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",envmap_vertex:"#ifdef USE_ENVMAP\n\t#ifdef ENV_WORLDPOS\n\t\tvWorldPosition = worldPosition.xyz;\n\t#else\n\t\tvec3 cameraToVertex;\n\t\tif ( isOrthographic ) { \n\t\t\tcameraToVertex = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) );\n\t\t} else {\n\t\t\tcameraToVertex = normalize( worldPosition.xyz - cameraPosition );\n\t\t}\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",fog_vertex:"#ifdef USE_FOG\n\tfogDepth = -mvPosition.z;\n#endif",fog_pars_vertex:"#ifdef USE_FOG\n\tvarying float fogDepth;\n#endif",fog_fragment:"#ifdef USE_FOG\n\t#ifdef FOG_EXP2\n\t\tfloat fogFactor = 1.0 - exp( - fogDensity * fogDensity * fogDepth * fogDepth );\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",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",gradientmap_pars_fragment:"#ifdef USE_GRADIENTMAP\n\tuniform sampler2D gradientMap;\n#endif\nvec3 getGradientIrradiance( vec3 normal, vec3 lightDirection ) {\n\tfloat dotNL = dot( normal, lightDirection );\n\tvec2 coord = vec2( dotNL * 0.5 + 0.5, 0.0 );\n\t#ifdef USE_GRADIENTMAP\n\t\treturn texture2D( gradientMap, coord ).rgb;\n\t#else\n\t\treturn ( coord.x < 0.7 ) ? vec3( 0.7 ) : vec3( 1.0 );\n\t#endif\n}",lightmap_fragment:"#ifdef USE_LIGHTMAP\n\tvec4 lightMapTexel= texture2D( lightMap, vUv2 );\n\treflectedLight.indirectDiffuse += PI * lightMapTexelToLinear( lightMapTexel ).rgb * lightMapIntensity;\n#endif",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 = ( isOrthographic ) ? vec3( 0, 0, 1 ) : normalize( -mvPosition.xyz );\nGeometricContext backGeometry;\nbackGeometry.position = geometry.position;\nbackGeometry.normal = -geometry.normal;\nbackGeometry.viewDir = geometry.viewDir;\nvLightFront = vec3( 0.0 );\nvIndirectFront = vec3( 0.0 );\n#ifdef DOUBLE_SIDED\n\tvLightBack = vec3( 0.0 );\n\tvIndirectBack = vec3( 0.0 );\n#endif\nIncidentLight directLight;\nfloat dotNL;\nvec3 directLightColor_Diffuse;\nvIndirectFront += getAmbientLightIrradiance( ambientLightColor );\nvIndirectFront += getLightProbeIrradiance( lightProbe, geometry );\n#ifdef DOUBLE_SIDED\n\tvIndirectBack += getAmbientLightIrradiance( ambientLightColor );\n\tvIndirectBack += getLightProbeIrradiance( lightProbe, backGeometry );\n#endif\n#if NUM_POINT_LIGHTS > 0\n\t#pragma unroll_loop_start\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\t#pragma unroll_loop_end\n#endif\n#if NUM_SPOT_LIGHTS > 0\n\t#pragma unroll_loop_start\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\t#pragma unroll_loop_end\n#endif\n#if NUM_DIR_LIGHTS > 0\n\t#pragma unroll_loop_start\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\t#pragma unroll_loop_end\n#endif\n#if NUM_HEMI_LIGHTS > 0\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) {\n\t\tvIndirectFront += getHemisphereLightIrradiance( hemisphereLights[ i ], geometry );\n\t\t#ifdef DOUBLE_SIDED\n\t\t\tvIndirectBack += getHemisphereLightIrradiance( hemisphereLights[ i ], backGeometry );\n\t\t#endif\n\t}\n\t#pragma unroll_loop_end\n#endif",lights_pars_begin:"uniform bool receiveShadow;\nuniform vec3 ambientLightColor;\nuniform vec3 lightProbe[ 9 ];\nvec3 shGetIrradianceAt( in vec3 normal, in vec3 shCoefficients[ 9 ] ) {\n\tfloat x = normal.x, y = normal.y, z = normal.z;\n\tvec3 result = shCoefficients[ 0 ] * 0.886227;\n\tresult += shCoefficients[ 1 ] * 2.0 * 0.511664 * y;\n\tresult += shCoefficients[ 2 ] * 2.0 * 0.511664 * z;\n\tresult += shCoefficients[ 3 ] * 2.0 * 0.511664 * x;\n\tresult += shCoefficients[ 4 ] * 2.0 * 0.429043 * x * y;\n\tresult += shCoefficients[ 5 ] * 2.0 * 0.429043 * y * z;\n\tresult += shCoefficients[ 6 ] * ( 0.743125 * z * z - 0.247708 );\n\tresult += shCoefficients[ 7 ] * 2.0 * 0.429043 * x * z;\n\tresult += shCoefficients[ 8 ] * 0.429043 * ( x * x - y * y );\n\treturn result;\n}\nvec3 getLightProbeIrradiance( const in vec3 lightProbe[ 9 ], const in GeometricContext geometry ) {\n\tvec3 worldNormal = inverseTransformDirection( geometry.normal, viewMatrix );\n\tvec3 irradiance = shGetIrradianceAt( worldNormal, lightProbe );\n\treturn irradiance;\n}\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};\n\tuniform DirectionalLight directionalLights[ NUM_DIR_LIGHTS ];\n\t#if defined( USE_SHADOWMAP ) && NUM_DIR_LIGHT_SHADOWS > 0\n\t\tstruct DirectionalLightShadow {\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t};\n\t\tuniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ];\n\t#endif\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};\n\tuniform PointLight pointLights[ NUM_POINT_LIGHTS ];\n\t#if defined( USE_SHADOWMAP ) && NUM_POINT_LIGHT_SHADOWS > 0\n\t\tstruct PointLightShadow {\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t\tfloat shadowCameraNear;\n\t\t\tfloat shadowCameraFar;\n\t\t};\n\t\tuniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ];\n\t#endif\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};\n\tuniform SpotLight spotLights[ NUM_SPOT_LIGHTS ];\n\t#if defined( USE_SHADOWMAP ) && NUM_SPOT_LIGHT_SHADOWS > 0\n\t\tstruct SpotLightShadow {\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t};\n\t\tuniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ];\n\t#endif\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",lights_toon_fragment:"ToonMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb;\nmaterial.specularColor = specular;\nmaterial.specularShininess = shininess;\nmaterial.specularStrength = specularStrength;",lights_toon_pars_fragment:"varying vec3 vViewPosition;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\nstruct ToonMaterial {\n\tvec3\tdiffuseColor;\n\tvec3\tspecularColor;\n\tfloat\tspecularShininess;\n\tfloat\tspecularStrength;\n};\nvoid RE_Direct_Toon( const in IncidentLight directLight, const in GeometricContext geometry, const in ToonMaterial material, inout ReflectedLight reflectedLight ) {\n\tvec3 irradiance = getGradientIrradiance( geometry.normal, directLight.direction ) * directLight.color;\n\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\t\tirradiance *= PI;\n\t#endif\n\treflectedLight.directDiffuse += irradiance * BRDF_Diffuse_Lambert( material.diffuseColor );\n\treflectedLight.directSpecular += irradiance * BRDF_Specular_BlinnPhong( directLight, geometry, material.specularColor, material.specularShininess ) * material.specularStrength;\n}\nvoid RE_IndirectDiffuse_Toon( const in vec3 irradiance, const in GeometricContext geometry, const in ToonMaterial material, inout ReflectedLight reflectedLight ) {\n\treflectedLight.indirectDiffuse += irradiance * BRDF_Diffuse_Lambert( material.diffuseColor );\n}\n#define RE_Direct\t\t\t\tRE_Direct_Toon\n#define RE_IndirectDiffuse\t\tRE_IndirectDiffuse_Toon\n#define Material_LightProbeLOD( material )\t(0)",lights_phong_fragment:"BlinnPhongMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb;\nmaterial.specularColor = specular;\nmaterial.specularShininess = shininess;\nmaterial.specularStrength = specularStrength;",lights_phong_pars_fragment:"varying vec3 vViewPosition;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\nstruct BlinnPhongMaterial {\n\tvec3\tdiffuseColor;\n\tvec3\tspecularColor;\n\tfloat\tspecularShininess;\n\tfloat\tspecularStrength;\n};\nvoid RE_Direct_BlinnPhong( const in IncidentLight directLight, const in GeometricContext geometry, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {\n\tfloat dotNL = saturate( dot( geometry.normal, directLight.direction ) );\n\tvec3 irradiance = dotNL * directLight.color;\n\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\t\tirradiance *= PI;\n\t#endif\n\treflectedLight.directDiffuse += irradiance * BRDF_Diffuse_Lambert( material.diffuseColor );\n\treflectedLight.directSpecular += irradiance * BRDF_Specular_BlinnPhong( directLight, geometry, material.specularColor, material.specularShininess ) * material.specularStrength;\n}\nvoid RE_IndirectDiffuse_BlinnPhong( const in vec3 irradiance, const in GeometricContext geometry, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {\n\treflectedLight.indirectDiffuse += irradiance * BRDF_Diffuse_Lambert( material.diffuseColor );\n}\n#define RE_Direct\t\t\t\tRE_Direct_BlinnPhong\n#define RE_IndirectDiffuse\t\tRE_IndirectDiffuse_BlinnPhong\n#define Material_LightProbeLOD( material )\t(0)",lights_physical_fragment:"PhysicalMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb * ( 1.0 - metalnessFactor );\nvec3 dxy = max( abs( dFdx( geometryNormal ) ), abs( dFdy( geometryNormal ) ) );\nfloat geometryRoughness = max( max( dxy.x, dxy.y ), dxy.z );\nmaterial.specularRoughness = max( roughnessFactor, 0.0525 );material.specularRoughness += geometryRoughness;\nmaterial.specularRoughness = min( material.specularRoughness, 1.0 );\n#ifdef REFLECTIVITY\n\tmaterial.specularColor = mix( vec3( MAXIMUM_SPECULAR_COEFFICIENT * pow2( reflectivity ) ), diffuseColor.rgb, metalnessFactor );\n#else\n\tmaterial.specularColor = mix( vec3( DEFAULT_SPECULAR_COEFFICIENT ), diffuseColor.rgb, metalnessFactor );\n#endif\n#ifdef CLEARCOAT\n\tmaterial.clearcoat = clearcoat;\n\tmaterial.clearcoatRoughness = clearcoatRoughness;\n\t#ifdef USE_CLEARCOATMAP\n\t\tmaterial.clearcoat *= texture2D( clearcoatMap, vUv ).x;\n\t#endif\n\t#ifdef USE_CLEARCOAT_ROUGHNESSMAP\n\t\tmaterial.clearcoatRoughness *= texture2D( clearcoatRoughnessMap, vUv ).y;\n\t#endif\n\tmaterial.clearcoat = saturate( material.clearcoat );\tmaterial.clearcoatRoughness = max( material.clearcoatRoughness, 0.0525 );\n\tmaterial.clearcoatRoughness += geometryRoughness;\n\tmaterial.clearcoatRoughness = min( material.clearcoatRoughness, 1.0 );\n#endif\n#ifdef USE_SHEEN\n\tmaterial.sheenColor = sheen;\n#endif",lights_physical_pars_fragment:"struct PhysicalMaterial {\n\tvec3\tdiffuseColor;\n\tfloat\tspecularRoughness;\n\tvec3\tspecularColor;\n#ifdef CLEARCOAT\n\tfloat clearcoat;\n\tfloat clearcoatRoughness;\n#endif\n#ifdef USE_SHEEN\n\tvec3 sheenColor;\n#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#ifdef CLEARCOAT\n\t\tfloat ccDotNL = saturate( dot( geometry.clearcoatNormal, directLight.direction ) );\n\t\tvec3 ccIrradiance = ccDotNL * directLight.color;\n\t\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\t\t\tccIrradiance *= PI;\n\t\t#endif\n\t\tfloat clearcoatDHR = material.clearcoat * clearcoatDHRApprox( material.clearcoatRoughness, ccDotNL );\n\t\treflectedLight.directSpecular += ccIrradiance * material.clearcoat * BRDF_Specular_GGX( directLight, geometry.viewDir, geometry.clearcoatNormal, vec3( DEFAULT_SPECULAR_COEFFICIENT ), material.clearcoatRoughness );\n\t#else\n\t\tfloat clearcoatDHR = 0.0;\n\t#endif\n\t#ifdef USE_SHEEN\n\t\treflectedLight.directSpecular += ( 1.0 - clearcoatDHR ) * irradiance * BRDF_Specular_Sheen(\n\t\t\tmaterial.specularRoughness,\n\t\t\tdirectLight.direction,\n\t\t\tgeometry,\n\t\t\tmaterial.sheenColor\n\t\t);\n\t#else\n\t\treflectedLight.directSpecular += ( 1.0 - clearcoatDHR ) * irradiance * BRDF_Specular_GGX( directLight, geometry.viewDir, geometry.normal, material.specularColor, material.specularRoughness);\n\t#endif\n\treflectedLight.directDiffuse += ( 1.0 - clearcoatDHR ) * irradiance * BRDF_Diffuse_Lambert( material.diffuseColor );\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 irradiance, const in vec3 clearcoatRadiance, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight) {\n\t#ifdef CLEARCOAT\n\t\tfloat ccDotNV = saturate( dot( geometry.clearcoatNormal, geometry.viewDir ) );\n\t\treflectedLight.indirectSpecular += clearcoatRadiance * material.clearcoat * BRDF_Specular_GGX_Environment( geometry.viewDir, geometry.clearcoatNormal, vec3( DEFAULT_SPECULAR_COEFFICIENT ), material.clearcoatRoughness );\n\t\tfloat ccDotNL = ccDotNV;\n\t\tfloat clearcoatDHR = material.clearcoat * clearcoatDHRApprox( material.clearcoatRoughness, ccDotNL );\n\t#else\n\t\tfloat clearcoatDHR = 0.0;\n\t#endif\n\tfloat clearcoatInv = 1.0 - clearcoatDHR;\n\tvec3 singleScattering = vec3( 0.0 );\n\tvec3 multiScattering = vec3( 0.0 );\n\tvec3 cosineWeightedIrradiance = irradiance * RECIPROCAL_PI;\n\tBRDF_Specular_Multiscattering_Environment( geometry, material.specularColor, material.specularRoughness, singleScattering, multiScattering );\n\tvec3 diffuse = material.diffuseColor * ( 1.0 - ( singleScattering + multiScattering ) );\n\treflectedLight.indirectSpecular += clearcoatInv * radiance * singleScattering;\n\treflectedLight.indirectSpecular += multiScattering * cosineWeightedIrradiance;\n\treflectedLight.indirectDiffuse += diffuse * cosineWeightedIrradiance;\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\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}",lights_fragment_begin:"\nGeometricContext geometry;\ngeometry.position = - vViewPosition;\ngeometry.normal = normal;\ngeometry.viewDir = ( isOrthographic ) ? vec3( 0, 0, 1 ) : normalize( vViewPosition );\n#ifdef CLEARCOAT\n\tgeometry.clearcoatNormal = clearcoatNormal;\n#endif\nIncidentLight directLight;\n#if ( NUM_POINT_LIGHTS > 0 ) && defined( RE_Direct )\n\tPointLight pointLight;\n\t#if defined( USE_SHADOWMAP ) && NUM_POINT_LIGHT_SHADOWS > 0\n\tPointLightShadow pointLightShadow;\n\t#endif\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {\n\t\tpointLight = pointLights[ i ];\n\t\tgetPointDirectLightIrradiance( pointLight, geometry, directLight );\n\t\t#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_POINT_LIGHT_SHADOWS )\n\t\tpointLightShadow = pointLightShadows[ i ];\n\t\tdirectLight.color *= all( bvec2( directLight.visible, receiveShadow ) ) ? getPointShadow( pointShadowMap[ i ], pointLightShadow.shadowMapSize, pointLightShadow.shadowBias, pointLightShadow.shadowRadius, vPointShadowCoord[ i ], pointLightShadow.shadowCameraNear, pointLightShadow.shadowCameraFar ) : 1.0;\n\t\t#endif\n\t\tRE_Direct( directLight, geometry, material, reflectedLight );\n\t}\n\t#pragma unroll_loop_end\n#endif\n#if ( NUM_SPOT_LIGHTS > 0 ) && defined( RE_Direct )\n\tSpotLight spotLight;\n\t#if defined( USE_SHADOWMAP ) && NUM_SPOT_LIGHT_SHADOWS > 0\n\tSpotLightShadow spotLightShadow;\n\t#endif\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {\n\t\tspotLight = spotLights[ i ];\n\t\tgetSpotDirectLightIrradiance( spotLight, geometry, directLight );\n\t\t#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )\n\t\tspotLightShadow = spotLightShadows[ i ];\n\t\tdirectLight.color *= all( bvec2( directLight.visible, receiveShadow ) ) ? getShadow( spotShadowMap[ i ], spotLightShadow.shadowMapSize, spotLightShadow.shadowBias, spotLightShadow.shadowRadius, vSpotShadowCoord[ i ] ) : 1.0;\n\t\t#endif\n\t\tRE_Direct( directLight, geometry, material, reflectedLight );\n\t}\n\t#pragma unroll_loop_end\n#endif\n#if ( NUM_DIR_LIGHTS > 0 ) && defined( RE_Direct )\n\tDirectionalLight directionalLight;\n\t#if defined( USE_SHADOWMAP ) && NUM_DIR_LIGHT_SHADOWS > 0\n\tDirectionalLightShadow directionalLightShadow;\n\t#endif\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {\n\t\tdirectionalLight = directionalLights[ i ];\n\t\tgetDirectionalDirectLightIrradiance( directionalLight, geometry, directLight );\n\t\t#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_DIR_LIGHT_SHADOWS )\n\t\tdirectionalLightShadow = directionalLightShadows[ i ];\n\t\tdirectLight.color *= all( bvec2( directLight.visible, receiveShadow ) ) ? getShadow( directionalShadowMap[ i ], directionalLightShadow.shadowMapSize, directionalLightShadow.shadowBias, directionalLightShadow.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;\n\t\t#endif\n\t\tRE_Direct( directLight, geometry, material, reflectedLight );\n\t}\n\t#pragma unroll_loop_end\n#endif\n#if ( NUM_RECT_AREA_LIGHTS > 0 ) && defined( RE_Direct_RectArea )\n\tRectAreaLight rectAreaLight;\n\t#pragma unroll_loop_start\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\t#pragma unroll_loop_end\n#endif\n#if defined( RE_IndirectDiffuse )\n\tvec3 iblIrradiance = vec3( 0.0 );\n\tvec3 irradiance = getAmbientLightIrradiance( ambientLightColor );\n\tirradiance += getLightProbeIrradiance( lightProbe, geometry );\n\t#if ( NUM_HEMI_LIGHTS > 0 )\n\t\t#pragma unroll_loop_start\n\t\tfor ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) {\n\t\t\tirradiance += getHemisphereLightIrradiance( hemisphereLights[ i ], geometry );\n\t\t}\n\t\t#pragma unroll_loop_end\n\t#endif\n#endif\n#if defined( RE_IndirectSpecular )\n\tvec3 radiance = vec3( 0.0 );\n\tvec3 clearcoatRadiance = vec3( 0.0 );\n#endif",lights_fragment_maps:"#if defined( RE_IndirectDiffuse )\n\t#ifdef USE_LIGHTMAP\n\t\tvec4 lightMapTexel= texture2D( lightMap, vUv2 );\n\t\tvec3 lightMapIrradiance = lightMapTexelToLinear( lightMapTexel ).rgb * 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( STANDARD ) && defined( ENVMAP_TYPE_CUBE_UV )\n\t\tiblIrradiance += getLightProbeIndirectIrradiance( geometry, maxMipLevel );\n\t#endif\n#endif\n#if defined( USE_ENVMAP ) && defined( RE_IndirectSpecular )\n\tradiance += getLightProbeIndirectRadiance( geometry.viewDir, geometry.normal, material.specularRoughness, maxMipLevel );\n\t#ifdef CLEARCOAT\n\t\tclearcoatRadiance += getLightProbeIndirectRadiance( geometry.viewDir, geometry.clearcoatNormal, material.clearcoatRoughness, maxMipLevel );\n\t#endif\n#endif",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, iblIrradiance, clearcoatRadiance, geometry, material, reflectedLight );\n#endif",logdepthbuf_fragment:"#if defined( USE_LOGDEPTHBUF ) && defined( USE_LOGDEPTHBUF_EXT )\n\tgl_FragDepthEXT = vIsPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;\n#endif",logdepthbuf_pars_fragment:"#if defined( USE_LOGDEPTHBUF ) && defined( USE_LOGDEPTHBUF_EXT )\n\tuniform float logDepthBufFC;\n\tvarying float vFragDepth;\n\tvarying float vIsPerspective;\n#endif",logdepthbuf_pars_vertex:"#ifdef USE_LOGDEPTHBUF\n\t#ifdef USE_LOGDEPTHBUF_EXT\n\t\tvarying float vFragDepth;\n\t\tvarying float vIsPerspective;\n\t#else\n\t\tuniform float logDepthBufFC;\n\t#endif\n#endif",logdepthbuf_vertex:"#ifdef USE_LOGDEPTHBUF\n\t#ifdef USE_LOGDEPTHBUF_EXT\n\t\tvFragDepth = 1.0 + gl_Position.w;\n\t\tvIsPerspective = float( isPerspectiveMatrix( projectionMatrix ) );\n\t#else\n\t\tif ( isPerspectiveMatrix( projectionMatrix ) ) {\n\t\t\tgl_Position.z = log2( max( EPSILON, gl_Position.w + 1.0 ) ) * logDepthBufFC - 1.0;\n\t\t\tgl_Position.z *= gl_Position.w;\n\t\t}\n\t#endif\n#endif",map_fragment:"#ifdef USE_MAP\n\tvec4 texelColor = texture2D( map, vUv );\n\ttexelColor = mapTexelToLinear( texelColor );\n\tdiffuseColor *= texelColor;\n#endif",map_pars_fragment:"#ifdef USE_MAP\n\tuniform sampler2D map;\n#endif",map_particle_fragment:"#if defined( USE_MAP ) || defined( USE_ALPHAMAP )\n\tvec2 uv = ( uvTransform * vec3( gl_PointCoord.x, 1.0 - gl_PointCoord.y, 1 ) ).xy;\n#endif\n#ifdef USE_MAP\n\tvec4 mapTexel = texture2D( map, uv );\n\tdiffuseColor *= mapTexelToLinear( mapTexel );\n#endif\n#ifdef USE_ALPHAMAP\n\tdiffuseColor.a *= texture2D( alphaMap, uv ).g;\n#endif",map_particle_pars_fragment:"#if defined( USE_MAP ) || defined( USE_ALPHAMAP )\n\tuniform mat3 uvTransform;\n#endif\n#ifdef USE_MAP\n\tuniform sampler2D map;\n#endif\n#ifdef USE_ALPHAMAP\n\tuniform sampler2D alphaMap;\n#endif",metalnessmap_fragment:"float metalnessFactor = metalness;\n#ifdef USE_METALNESSMAP\n\tvec4 texelMetalness = texture2D( metalnessMap, vUv );\n\tmetalnessFactor *= texelMetalness.b;\n#endif",metalnessmap_pars_fragment:"#ifdef USE_METALNESSMAP\n\tuniform sampler2D metalnessMap;\n#endif",morphnormal_vertex:"#ifdef USE_MORPHNORMALS\n\tobjectNormal *= morphTargetBaseInfluence;\n\tobjectNormal += morphNormal0 * morphTargetInfluences[ 0 ];\n\tobjectNormal += morphNormal1 * morphTargetInfluences[ 1 ];\n\tobjectNormal += morphNormal2 * morphTargetInfluences[ 2 ];\n\tobjectNormal += morphNormal3 * morphTargetInfluences[ 3 ];\n#endif",morphtarget_pars_vertex:"#ifdef USE_MORPHTARGETS\n\tuniform float morphTargetBaseInfluence;\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 *= morphTargetBaseInfluence;\n\ttransformed += morphTarget0 * morphTargetInfluences[ 0 ];\n\ttransformed += morphTarget1 * morphTargetInfluences[ 1 ];\n\ttransformed += morphTarget2 * morphTargetInfluences[ 2 ];\n\ttransformed += morphTarget3 * morphTargetInfluences[ 3 ];\n\t#ifndef USE_MORPHNORMALS\n\ttransformed += morphTarget4 * morphTargetInfluences[ 4 ];\n\ttransformed += morphTarget5 * morphTargetInfluences[ 5 ];\n\ttransformed += morphTarget6 * morphTargetInfluences[ 6 ];\n\ttransformed += morphTarget7 * morphTargetInfluences[ 7 ];\n\t#endif\n#endif",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\t#ifdef USE_TANGENT\n\t\tvec3 tangent = normalize( vTangent );\n\t\tvec3 bitangent = normalize( vBitangent );\n\t\t#ifdef DOUBLE_SIDED\n\t\t\ttangent = tangent * ( float( gl_FrontFacing ) * 2.0 - 1.0 );\n\t\t\tbitangent = bitangent * ( float( gl_FrontFacing ) * 2.0 - 1.0 );\n\t\t#endif\n\t\t#if defined( TANGENTSPACE_NORMALMAP ) || defined( USE_CLEARCOAT_NORMALMAP )\n\t\t\tmat3 vTBN = mat3( tangent, bitangent, normal );\n\t\t#endif\n\t#endif\n#endif\nvec3 geometryNormal = normal;",normal_fragment_maps:"#ifdef OBJECTSPACE_NORMALMAP\n\tnormal = texture2D( normalMap, vUv ).xyz * 2.0 - 1.0;\n\t#ifdef FLIP_SIDED\n\t\tnormal = - normal;\n\t#endif\n\t#ifdef DOUBLE_SIDED\n\t\tnormal = normal * ( float( gl_FrontFacing ) * 2.0 - 1.0 );\n\t#endif\n\tnormal = normalize( normalMatrix * normal );\n#elif defined( TANGENTSPACE_NORMALMAP )\n\tvec3 mapN = texture2D( normalMap, vUv ).xyz * 2.0 - 1.0;\n\tmapN.xy *= normalScale;\n\t#ifdef USE_TANGENT\n\t\tnormal = normalize( vTBN * mapN );\n\t#else\n\t\tnormal = perturbNormal2Arb( -vViewPosition, normal, mapN );\n\t#endif\n#elif defined( USE_BUMPMAP )\n\tnormal = perturbNormalArb( -vViewPosition, normal, dHdxy_fwd() );\n#endif",normalmap_pars_fragment:"#ifdef USE_NORMALMAP\n\tuniform sampler2D normalMap;\n\tuniform vec2 normalScale;\n#endif\n#ifdef OBJECTSPACE_NORMALMAP\n\tuniform mat3 normalMatrix;\n#endif\n#if ! defined ( USE_TANGENT ) && ( defined ( TANGENTSPACE_NORMALMAP ) || defined ( USE_CLEARCOAT_NORMALMAP ) )\n\tvec3 perturbNormal2Arb( vec3 eye_pos, vec3 surf_norm, vec3 mapN ) {\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 );\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\tmat3 tsn = mat3( S, T, N );\n\t\tmapN.xy *= ( float( gl_FrontFacing ) * 2.0 - 1.0 );\n\t\treturn normalize( tsn * mapN );\n\t}\n#endif",clearcoat_normal_fragment_begin:"#ifdef CLEARCOAT\n\tvec3 clearcoatNormal = geometryNormal;\n#endif",clearcoat_normal_fragment_maps:"#ifdef USE_CLEARCOAT_NORMALMAP\n\tvec3 clearcoatMapN = texture2D( clearcoatNormalMap, vUv ).xyz * 2.0 - 1.0;\n\tclearcoatMapN.xy *= clearcoatNormalScale;\n\t#ifdef USE_TANGENT\n\t\tclearcoatNormal = normalize( vTBN * clearcoatMapN );\n\t#else\n\t\tclearcoatNormal = perturbNormal2Arb( - vViewPosition, clearcoatNormal, clearcoatMapN );\n\t#endif\n#endif",clearcoat_pars_fragment:"#ifdef USE_CLEARCOATMAP\n\tuniform sampler2D clearcoatMap;\n#endif\n#ifdef USE_CLEARCOAT_ROUGHNESSMAP\n\tuniform sampler2D clearcoatRoughnessMap;\n#endif\n#ifdef USE_CLEARCOAT_NORMALMAP\n\tuniform sampler2D clearcoatNormalMap;\n\tuniform vec2 clearcoatNormalScale;\n#endif",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}\nvec4 pack2HalfToRGBA( vec2 v ) {\n\tvec4 r = vec4( v.x, fract( v.x * 255.0 ), v.y, fract( v.y * 255.0 ));\n\treturn vec4( r.x - r.y / 255.0, r.y, r.z - r.w / 255.0, r.w);\n}\nvec2 unpackRGBATo2Half( vec4 v ) {\n\treturn vec2( v.x + ( v.y / 255.0 ), v.z + ( v.w / 255.0 ) );\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}",premultiplied_alpha_fragment:"#ifdef PREMULTIPLIED_ALPHA\n\tgl_FragColor.rgb *= gl_FragColor.a;\n#endif",project_vertex:"vec4 mvPosition = vec4( transformed, 1.0 );\n#ifdef USE_INSTANCING\n\tmvPosition = instanceMatrix * mvPosition;\n#endif\nmvPosition = modelViewMatrix * mvPosition;\ngl_Position = projectionMatrix * mvPosition;",dithering_fragment:"#ifdef DITHERING\n\tgl_FragColor.rgb = dithering( gl_FragColor.rgb );\n#endif",dithering_pars_fragment:"#ifdef 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",roughnessmap_fragment:"float roughnessFactor = roughness;\n#ifdef USE_ROUGHNESSMAP\n\tvec4 texelRoughness = texture2D( roughnessMap, vUv );\n\troughnessFactor *= texelRoughness.g;\n#endif",roughnessmap_pars_fragment:"#ifdef USE_ROUGHNESSMAP\n\tuniform sampler2D roughnessMap;\n#endif",shadowmap_pars_fragment:"#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHT_SHADOWS > 0\n\t\tuniform sampler2D directionalShadowMap[ NUM_DIR_LIGHT_SHADOWS ];\n\t\tvarying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ];\n\t#endif\n\t#if NUM_SPOT_LIGHT_SHADOWS > 0\n\t\tuniform sampler2D spotShadowMap[ NUM_SPOT_LIGHT_SHADOWS ];\n\t\tvarying vec4 vSpotShadowCoord[ NUM_SPOT_LIGHT_SHADOWS ];\n\t#endif\n\t#if NUM_POINT_LIGHT_SHADOWS > 0\n\t\tuniform sampler2D pointShadowMap[ NUM_POINT_LIGHT_SHADOWS ];\n\t\tvarying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ];\n\t#endif\n\tfloat texture2DCompare( sampler2D depths, vec2 uv, float compare ) {\n\t\treturn step( compare, unpackRGBAToDepth( texture2D( depths, uv ) ) );\n\t}\n\tvec2 texture2DDistribution( sampler2D shadow, vec2 uv ) {\n\t\treturn unpackRGBATo2Half( texture2D( shadow, uv ) );\n\t}\n\tfloat VSMShadow (sampler2D shadow, vec2 uv, float compare ){\n\t\tfloat occlusion = 1.0;\n\t\tvec2 distribution = texture2DDistribution( shadow, uv );\n\t\tfloat hard_shadow = step( compare , distribution.x );\n\t\tif (hard_shadow != 1.0 ) {\n\t\t\tfloat distance = compare - distribution.x ;\n\t\t\tfloat variance = max( 0.00000, distribution.y * distribution.y );\n\t\t\tfloat softness_probability = variance / (variance + distance * distance );\t\t\tsoftness_probability = clamp( ( softness_probability - 0.3 ) / ( 0.95 - 0.3 ), 0.0, 1.0 );\t\t\tocclusion = clamp( max( hard_shadow, softness_probability ), 0.0, 1.0 );\n\t\t}\n\t\treturn occlusion;\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\tfloat dx2 = dx0 / 2.0;\n\t\t\tfloat dy2 = dy0 / 2.0;\n\t\t\tfloat dx3 = dx1 / 2.0;\n\t\t\tfloat dy3 = dy1 / 2.0;\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( dx2, dy2 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy2 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, dy2 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, 0.0 ), 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( dx2, dy3 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy3 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, dy3 ), 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 / 17.0 );\n\t\t#elif defined( SHADOWMAP_TYPE_PCF_SOFT )\n\t\t\tvec2 texelSize = vec2( 1.0 ) / shadowMapSize;\n\t\t\tfloat dx = texelSize.x;\n\t\t\tfloat dy = texelSize.y;\n\t\t\tvec2 uv = shadowCoord.xy;\n\t\t\tvec2 f = fract( uv * shadowMapSize + 0.5 );\n\t\t\tuv -= f * texelSize;\n\t\t\tshadow = (\n\t\t\t\ttexture2DCompare( shadowMap, uv, shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, uv + vec2( dx, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, uv + vec2( 0.0, dy ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, uv + texelSize, shadowCoord.z ) +\n\t\t\t\tmix( texture2DCompare( shadowMap, uv + vec2( -dx, 0.0 ), shadowCoord.z ), \n\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, 0.0 ), shadowCoord.z ),\n\t\t\t\t\t f.x ) +\n\t\t\t\tmix( texture2DCompare( shadowMap, uv + vec2( -dx, dy ), shadowCoord.z ), \n\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, dy ), shadowCoord.z ),\n\t\t\t\t\t f.x ) +\n\t\t\t\tmix( texture2DCompare( shadowMap, uv + vec2( 0.0, -dy ), shadowCoord.z ), \n\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( 0.0, 2.0 * dy ), shadowCoord.z ),\n\t\t\t\t\t f.y ) +\n\t\t\t\tmix( texture2DCompare( shadowMap, uv + vec2( dx, -dy ), shadowCoord.z ), \n\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( dx, 2.0 * dy ), shadowCoord.z ),\n\t\t\t\t\t f.y ) +\n\t\t\t\tmix( mix( texture2DCompare( shadowMap, uv + vec2( -dx, -dy ), shadowCoord.z ), \n\t\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, -dy ), shadowCoord.z ),\n\t\t\t\t\t\t f.x ),\n\t\t\t\t\t mix( texture2DCompare( shadowMap, uv + vec2( -dx, 2.0 * dy ), shadowCoord.z ), \n\t\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, 2.0 * dy ), shadowCoord.z ),\n\t\t\t\t\t\t f.x ),\n\t\t\t\t\t f.y )\n\t\t\t) * ( 1.0 / 9.0 );\n\t\t#elif defined( SHADOWMAP_TYPE_VSM )\n\t\t\tshadow = VSMShadow( shadowMap, shadowCoord.xy, shadowCoord.z );\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 ) || defined( SHADOWMAP_TYPE_VSM )\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",shadowmap_pars_vertex:"#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHT_SHADOWS > 0\n\t\tuniform mat4 directionalShadowMatrix[ NUM_DIR_LIGHT_SHADOWS ];\n\t\tvarying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ];\n\t#endif\n\t#if NUM_SPOT_LIGHT_SHADOWS > 0\n\t\tuniform mat4 spotShadowMatrix[ NUM_SPOT_LIGHT_SHADOWS ];\n\t\tvarying vec4 vSpotShadowCoord[ NUM_SPOT_LIGHT_SHADOWS ];\n\t#endif\n\t#if NUM_POINT_LIGHT_SHADOWS > 0\n\t\tuniform mat4 pointShadowMatrix[ NUM_POINT_LIGHT_SHADOWS ];\n\t\tvarying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ];\n\t#endif\n#endif",shadowmap_vertex:"#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHT_SHADOWS > 0\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) {\n\t\tvDirectionalShadowCoord[ i ] = directionalShadowMatrix[ i ] * worldPosition;\n\t}\n\t#pragma unroll_loop_end\n\t#endif\n\t#if NUM_SPOT_LIGHT_SHADOWS > 0\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_SPOT_LIGHT_SHADOWS; i ++ ) {\n\t\tvSpotShadowCoord[ i ] = spotShadowMatrix[ i ] * worldPosition;\n\t}\n\t#pragma unroll_loop_end\n\t#endif\n\t#if NUM_POINT_LIGHT_SHADOWS > 0\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) {\n\t\tvPointShadowCoord[ i ] = pointShadowMatrix[ i ] * worldPosition;\n\t}\n\t#pragma unroll_loop_end\n\t#endif\n#endif",shadowmask_pars_fragment:"float getShadowMask() {\n\tfloat shadow = 1.0;\n\t#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHT_SHADOWS > 0\n\tDirectionalLightShadow directionalLight;\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) {\n\t\tdirectionalLight = directionalLightShadows[ i ];\n\t\tshadow *= receiveShadow ? getShadow( directionalShadowMap[ i ], directionalLight.shadowMapSize, directionalLight.shadowBias, directionalLight.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;\n\t}\n\t#pragma unroll_loop_end\n\t#endif\n\t#if NUM_SPOT_LIGHT_SHADOWS > 0\n\tSpotLightShadow spotLight;\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_SPOT_LIGHT_SHADOWS; i ++ ) {\n\t\tspotLight = spotLightShadows[ i ];\n\t\tshadow *= receiveShadow ? getShadow( spotShadowMap[ i ], spotLight.shadowMapSize, spotLight.shadowBias, spotLight.shadowRadius, vSpotShadowCoord[ i ] ) : 1.0;\n\t}\n\t#pragma unroll_loop_end\n\t#endif\n\t#if NUM_POINT_LIGHT_SHADOWS > 0\n\tPointLightShadow pointLight;\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) {\n\t\tpointLight = pointLightShadows[ i ];\n\t\tshadow *= receiveShadow ? getPointShadow( pointShadowMap[ i ], pointLight.shadowMapSize, pointLight.shadowBias, pointLight.shadowRadius, vPointShadowCoord[ i ], pointLight.shadowCameraNear, pointLight.shadowCameraFar ) : 1.0;\n\t}\n\t#pragma unroll_loop_end\n\t#endif\n\t#endif\n\treturn shadow;\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 highp 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",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",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\t#ifdef USE_TANGENT\n\t\tobjectTangent = vec4( skinMatrix * vec4( objectTangent, 0.0 ) ).xyz;\n\t#endif\n#endif",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\tgl_FragColor.rgb = toneMapping( gl_FragColor.rgb );\n#endif",tonemapping_pars_fragment:"#ifndef saturate\n#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}\nvec3 ACESFilmicToneMapping( vec3 color ) {\n\tcolor *= toneMappingExposure;\n\treturn saturate( ( color * ( 2.51 * color + 0.03 ) ) / ( color * ( 2.43 * color + 0.59 ) + 0.14 ) );\n}",uv_pars_fragment:"#if ( defined( USE_UV ) && ! defined( UVS_VERTEX_ONLY ) )\n\tvarying vec2 vUv;\n#endif",uv_pars_vertex:"#ifdef USE_UV\n\t#ifdef UVS_VERTEX_ONLY\n\t\tvec2 vUv;\n\t#else\n\t\tvarying vec2 vUv;\n\t#endif\n\tuniform mat3 uvTransform;\n#endif",uv_vertex:"#ifdef USE_UV\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\tuniform mat3 uv2Transform;\n#endif",uv2_vertex:"#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP )\n\tvUv2 = ( uv2Transform * vec3( uv2, 1 ) ).xy;\n#endif",worldpos_vertex:"#if defined( USE_ENVMAP ) || defined( DISTANCE ) || defined ( USE_SHADOWMAP )\n\tvec4 worldPosition = vec4( transformed, 1.0 );\n\t#ifdef USE_INSTANCING\n\t\tworldPosition = instanceMatrix * worldPosition;\n\t#endif\n\tworldPosition = modelMatrix * worldPosition;\n#endif",background_frag:"uniform sampler2D t2D;\nvarying vec2 vUv;\nvoid main() {\n\tvec4 texColor = texture2D( t2D, vUv );\n\tgl_FragColor = mapTexelToLinear( texColor );\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n}",background_vert:"varying vec2 vUv;\nuniform mat3 uvTransform;\nvoid main() {\n\tvUv = ( uvTransform * vec3( uv, 1 ) ).xy;\n\tgl_Position = vec4( position.xy, 1.0, 1.0 );\n}",cube_frag:"#include <envmap_common_pars_fragment>\nuniform float opacity;\nvarying vec3 vWorldDirection;\n#include <cube_uv_reflection_fragment>\nvoid main() {\n\tvec3 vReflect = vWorldDirection;\n\t#include <envmap_fragment>\n\tgl_FragColor = envColor;\n\tgl_FragColor.a *= opacity;\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n}",cube_vert:"varying vec3 vWorldDirection;\n#include <common>\nvoid main() {\n\tvWorldDirection = transformDirection( position, modelMatrix );\n\t#include <begin_vertex>\n\t#include <project_vertex>\n\tgl_Position.z = gl_Position.w;\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>\nvarying vec2 vHighPrecisionZW;\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\tfloat fragCoordZ = 0.5 * vHighPrecisionZW[0] / vHighPrecisionZW[1] + 0.5;\n\t#if DEPTH_PACKING == 3200\n\t\tgl_FragColor = vec4( vec3( 1.0 - fragCoordZ ), opacity );\n\t#elif DEPTH_PACKING == 3201\n\t\tgl_FragColor = packDepthToRGBA( fragCoordZ );\n\t#endif\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>\nvarying vec2 vHighPrecisionZW;\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\tvHighPrecisionZW = gl_Position.zw;\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}",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}",equirect_frag:"uniform sampler2D tEquirect;\nvarying vec3 vWorldDirection;\n#include <common>\nvoid main() {\n\tvec3 direction = normalize( vWorldDirection );\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\tvec4 texColor = texture2D( tEquirect, sampleUV );\n\tgl_FragColor = mapTexelToLinear( texColor );\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n}",equirect_vert:"varying vec3 vWorldDirection;\n#include <common>\nvoid main() {\n\tvWorldDirection = transformDirection( position, modelMatrix );\n\t#include <begin_vertex>\n\t#include <project_vertex>\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 <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\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\tvLineDistance = scale * lineDistance;\n\t#include <color_vertex>\n\t#include <begin_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\t#include <fog_vertex>\n}",meshbasic_frag:"uniform vec3 diffuse;\nuniform float opacity;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\n#include <common>\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 <envmap_common_pars_fragment>\n#include <envmap_pars_fragment>\n#include <cube_uv_reflection_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\n\t\tvec4 lightMapTexel= texture2D( lightMap, vUv2 );\n\t\treflectedLight.indirectDiffuse += lightMapTexelToLinear( lightMapTexel ).rgb * 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 <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n\t#include <dithering_fragment>\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}",meshlambert_frag:"uniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float opacity;\nvarying vec3 vLightFront;\nvarying vec3 vIndirectFront;\n#ifdef DOUBLE_SIDED\n\tvarying vec3 vLightBack;\n\tvarying vec3 vIndirectBack;\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_common_pars_fragment>\n#include <envmap_pars_fragment>\n#include <cube_uv_reflection_fragment>\n#include <bsdfs>\n#include <lights_pars_begin>\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\t#ifdef DOUBLE_SIDED\n\t\treflectedLight.indirectDiffuse += ( gl_FrontFacing ) ? vIndirectFront : vIndirectBack;\n\t#else\n\t\treflectedLight.indirectDiffuse += vIndirectFront;\n\t#endif\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}",meshlambert_vert:"#define LAMBERT\nvarying vec3 vLightFront;\nvarying vec3 vIndirectFront;\n#ifdef DOUBLE_SIDED\n\tvarying vec3 vLightBack;\n\tvarying vec3 vIndirectBack;\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 <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}",meshmatcap_frag:"#define MATCAP\nuniform vec3 diffuse;\nuniform float opacity;\nuniform sampler2D matcap;\nvarying vec3 vViewPosition;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\n#include <common>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <fog_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_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 <normal_fragment_begin>\n\t#include <normal_fragment_maps>\n\tvec3 viewDir = normalize( vViewPosition );\n\tvec3 x = normalize( vec3( viewDir.z, 0.0, - viewDir.x ) );\n\tvec3 y = cross( viewDir, x );\n\tvec2 uv = vec2( dot( x, normal ), dot( y, normal ) ) * 0.495 + 0.5;\n\t#ifdef USE_MATCAP\n\t\tvec4 matcapColor = texture2D( matcap, uv );\n\t\tmatcapColor = matcapTexelToLinear( matcapColor );\n\t#else\n\t\tvec4 matcapColor = vec4( 1.0 );\n\t#endif\n\tvec3 outgoingLight = diffuseColor.rgb * matcapColor.rgb;\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}",meshmatcap_vert:"#define MATCAP\nvarying vec3 vViewPosition;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\n#include <common>\n#include <uv_pars_vertex>\n#include <color_pars_vertex>\n#include <displacementmap_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 <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#ifndef FLAT_SHADED\n\t\tvNormal = normalize( transformedNormal );\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\t#include <fog_vertex>\n\tvViewPosition = - mvPosition.xyz;\n}",meshtoon_frag:"#define TOON\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 <gradientmap_pars_fragment>\n#include <fog_pars_fragment>\n#include <bsdfs>\n#include <lights_pars_begin>\n#include <lights_toon_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_toon_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}",meshtoon_vert:"#define TOON\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}",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_common_pars_fragment>\n#include <envmap_pars_fragment>\n#include <cube_uv_reflection_fragment>\n#include <fog_pars_fragment>\n#include <bsdfs>\n#include <lights_pars_begin>\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}",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}",meshphysical_frag:"#define STANDARD\n#ifdef PHYSICAL\n\t#define REFLECTIVITY\n\t#define CLEARCOAT\n\t#define TRANSPARENCY\n#endif\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float roughness;\nuniform float metalness;\nuniform float opacity;\n#ifdef TRANSPARENCY\n\tuniform float transparency;\n#endif\n#ifdef REFLECTIVITY\n\tuniform float reflectivity;\n#endif\n#ifdef CLEARCOAT\n\tuniform float clearcoat;\n\tuniform float clearcoatRoughness;\n#endif\n#ifdef USE_SHEEN\n\tuniform vec3 sheen;\n#endif\nvarying vec3 vViewPosition;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n\t#ifdef USE_TANGENT\n\t\tvarying vec3 vTangent;\n\t\tvarying vec3 vBitangent;\n\t#endif\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 <bsdfs>\n#include <cube_uv_reflection_fragment>\n#include <envmap_common_pars_fragment>\n#include <envmap_physical_pars_fragment>\n#include <fog_pars_fragment>\n#include <lights_pars_begin>\n#include <lights_physical_pars_fragment>\n#include <shadowmap_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <clearcoat_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 <clearcoat_normal_fragment_begin>\n\t#include <clearcoat_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\t#ifdef TRANSPARENCY\n\t\tdiffuseColor.a *= saturate( 1. - transparency + linearToRelativeLuminance( reflectedLight.directSpecular + reflectedLight.indirectSpecular ) );\n\t#endif\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}",meshphysical_vert:"#define STANDARD\nvarying vec3 vViewPosition;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n\t#ifdef USE_TANGENT\n\t\tvarying vec3 vTangent;\n\t\tvarying vec3 vBitangent;\n\t#endif\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\t#ifdef USE_TANGENT\n\t\tvTangent = normalize( transformedTangent );\n\t\tvBitangent = normalize( cross( vNormal, vTangent ) * tangent.w );\n\t#endif\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}",normal_frag:"#define NORMAL\nuniform float opacity;\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( TANGENTSPACE_NORMALMAP )\n\tvarying vec3 vViewPosition;\n#endif\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n\t#ifdef USE_TANGENT\n\t\tvarying vec3 vTangent;\n\t\tvarying vec3 vBitangent;\n\t#endif\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>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\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}",normal_vert:"#define NORMAL\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( TANGENTSPACE_NORMALMAP )\n\tvarying vec3 vViewPosition;\n#endif\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n\t#ifdef USE_TANGENT\n\t\tvarying vec3 vTangent;\n\t\tvarying vec3 vBitangent;\n\t#endif\n#endif\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 <logdepthbuf_pars_vertex>\n#include <clipping_planes_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\t#ifdef USE_TANGENT\n\t\tvTangent = normalize( transformedTangent );\n\t\tvBitangent = normalize( cross( vNormal, vTangent ) * tangent.w );\n\t#endif\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#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( TANGENTSPACE_NORMALMAP )\n\tvViewPosition = - mvPosition.xyz;\n#endif\n}",points_frag:"uniform vec3 diffuse;\nuniform float opacity;\n#include <common>\n#include <color_pars_fragment>\n#include <map_particle_pars_fragment>\n#include <fog_pars_fragment>\n#include <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 <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n}",points_vert:"uniform float size;\nuniform float scale;\n#include <common>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <morphtarget_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 <morphtarget_vertex>\n\t#include <project_vertex>\n\tgl_PointSize = size;\n\t#ifdef USE_SIZEATTENUATION\n\t\tbool isPerspective = isPerspectiveMatrix( projectionMatrix );\n\t\tif ( isPerspective ) gl_PointSize *= ( scale / - mvPosition.z );\n\t#endif\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\t#include <worldpos_vertex>\n\t#include <fog_vertex>\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 <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\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}",sprite_frag:"uniform vec3 diffuse;\nuniform float opacity;\n#include <common>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_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\tvec3 outgoingLight = vec3( 0.0 );\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\toutgoingLight = diffuseColor.rgb;\n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n}",sprite_vert:"uniform float rotation;\nuniform vec2 center;\n#include <common>\n#include <uv_pars_vertex>\n#include <fog_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\tvec4 mvPosition = modelViewMatrix * vec4( 0.0, 0.0, 0.0, 1.0 );\n\tvec2 scale;\n\tscale.x = length( vec3( modelMatrix[ 0 ].x, modelMatrix[ 0 ].y, modelMatrix[ 0 ].z ) );\n\tscale.y = length( vec3( modelMatrix[ 1 ].x, modelMatrix[ 1 ].y, modelMatrix[ 1 ].z ) );\n\t#ifndef USE_SIZEATTENUATION\n\t\tbool isPerspective = isPerspectiveMatrix( projectionMatrix );\n\t\tif ( isPerspective ) scale *= - mvPosition.z;\n\t#endif\n\tvec2 alignedPosition = ( position.xy - ( center - vec2( 0.5 ) ) ) * 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\tmvPosition.xy += rotatedPosition;\n\tgl_Position = projectionMatrix * mvPosition;\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\t#include <fog_vertex>\n}"},na={basic:{uniforms:zr([Jr.common,Jr.specularmap,Jr.envmap,Jr.aomap,Jr.lightmap,Jr.fog]),vertexShader:ta.meshbasic_vert,fragmentShader:ta.meshbasic_frag},lambert:{uniforms:zr([Jr.common,Jr.specularmap,Jr.envmap,Jr.aomap,Jr.lightmap,Jr.emissivemap,Jr.fog,Jr.lights,{emissive:{value:new Di(0)}}]),vertexShader:ta.meshlambert_vert,fragmentShader:ta.meshlambert_frag},phong:{uniforms:zr([Jr.common,Jr.specularmap,Jr.envmap,Jr.aomap,Jr.lightmap,Jr.emissivemap,Jr.bumpmap,Jr.normalmap,Jr.displacementmap,Jr.fog,Jr.lights,{emissive:{value:new Di(0)},specular:{value:new Di(1118481)},shininess:{value:30}}]),vertexShader:ta.meshphong_vert,fragmentShader:ta.meshphong_frag},standard:{uniforms:zr([Jr.common,Jr.envmap,Jr.aomap,Jr.lightmap,Jr.emissivemap,Jr.bumpmap,Jr.normalmap,Jr.displacementmap,Jr.roughnessmap,Jr.metalnessmap,Jr.fog,Jr.lights,{emissive:{value:new Di(0)},roughness:{value:1},metalness:{value:0},envMapIntensity:{value:1}}]),vertexShader:ta.meshphysical_vert,fragmentShader:ta.meshphysical_frag},toon:{uniforms:zr([Jr.common,Jr.specularmap,Jr.aomap,Jr.lightmap,Jr.emissivemap,Jr.bumpmap,Jr.normalmap,Jr.displacementmap,Jr.gradientmap,Jr.fog,Jr.lights,{emissive:{value:new Di(0)},specular:{value:new Di(1118481)},shininess:{value:30}}]),vertexShader:ta.meshtoon_vert,fragmentShader:ta.meshtoon_frag},matcap:{uniforms:zr([Jr.common,Jr.bumpmap,Jr.normalmap,Jr.displacementmap,Jr.fog,{matcap:{value:null}}]),vertexShader:ta.meshmatcap_vert,fragmentShader:ta.meshmatcap_frag},points:{uniforms:zr([Jr.points,Jr.fog]),vertexShader:ta.points_vert,fragmentShader:ta.points_frag},dashed:{uniforms:zr([Jr.common,Jr.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:ta.linedashed_vert,fragmentShader:ta.linedashed_frag},depth:{uniforms:zr([Jr.common,Jr.displacementmap]),vertexShader:ta.depth_vert,fragmentShader:ta.depth_frag},normal:{uniforms:zr([Jr.common,Jr.bumpmap,Jr.normalmap,Jr.displacementmap,{opacity:{value:1}}]),vertexShader:ta.normal_vert,fragmentShader:ta.normal_frag},sprite:{uniforms:zr([Jr.sprite,Jr.fog]),vertexShader:ta.sprite_vert,fragmentShader:ta.sprite_frag},background:{uniforms:{uvTransform:{value:new sn},t2D:{value:null}},vertexShader:ta.background_vert,fragmentShader:ta.background_frag},cube:{uniforms:zr([Jr.envmap,{opacity:{value:1}}]),vertexShader:ta.cube_vert,fragmentShader:ta.cube_frag},equirect:{uniforms:{tEquirect:{value:null}},vertexShader:ta.equirect_vert,fragmentShader:ta.equirect_frag},distanceRGBA:{uniforms:zr([Jr.common,Jr.displacementmap,{referencePosition:{value:new gn},nearDistance:{value:1},farDistance:{value:1e3}}]),vertexShader:ta.distanceRGBA_vert,fragmentShader:ta.distanceRGBA_frag},shadow:{uniforms:zr([Jr.lights,Jr.fog,{color:{value:new Di(0)},opacity:{value:1}}]),vertexShader:ta.shadow_vert,fragmentShader:ta.shadow_frag}};function ia(c,n,l,i){var u,h,d=new Di(0),p=0,f=null,m=0,v=null;function g(e,t){n.buffers.color.setClear(e.r,e.g,e.b,t,i)}return{getClearColor:function(){return d},setClearColor:function(e,t){d.set(e),g(d,p=void 0!==t?t:1)},getClearAlpha:function(){return p},setClearAlpha:function(e){g(d,p=e)},render:function(e,t,n,i){var r=t.background,a=c.xr,o=a.getSession&&a.getSession();if(o&&"additive"===o.environmentBlendMode&&(r=null),null===r?g(d,p):r&&r.isColor&&(g(r,1),i=!0),(c.autoClear||i)&&c.clear(c.autoClearColor,c.autoClearDepth,c.autoClearStencil),r&&(r.isCubeTexture||r.isWebGLCubeRenderTarget||r.mapping===ze)){void 0===h&&((h=new Er(new Nr(1,1,1),new Hr({type:"BackgroundCubeMaterial",uniforms:Fr(na.cube.uniforms),vertexShader:na.cube.vertexShader,fragmentShader:na.cube.fragmentShader,side:Me,depthTest:!1,depthWrite:!1,fog:!1}))).geometry.deleteAttribute("normal"),h.geometry.deleteAttribute("uv"),h.onBeforeRender=function(e,t,n){this.matrixWorld.copyPosition(n.matrixWorld)},Object.defineProperty(h.material,"envMap",{get:function(){return this.uniforms.envMap.value}}),l.update(h));var s=r.isWebGLCubeRenderTarget?r.texture:r;h.material.uniforms.envMap.value=s,h.material.uniforms.flipEnvMap.value=s.isCubeTexture?-1:1,f===r&&m===s.version&&v===c.toneMapping||(h.material.needsUpdate=!0,f=r,m=s.version,v=c.toneMapping),e.unshift(h,h.geometry,h.material,0,0,null)}else r&&r.isTexture&&(void 0===u&&((u=new Er(new ea(2,2),new Hr({type:"BackgroundMaterial",uniforms:Fr(na.background.uniforms),vertexShader:na.background.vertexShader,fragmentShader:na.background.fragmentShader,side:ee,depthTest:!1,depthWrite:!1,fog:!1}))).geometry.deleteAttribute("normal"),Object.defineProperty(u.material,"map",{get:function(){return this.uniforms.t2D.value}}),l.update(u)),!0===(u.material.uniforms.t2D.value=r).matrixAutoUpdate&&r.updateMatrix(),u.material.uniforms.uvTransform.value.copy(r.matrix),f===r&&m===r.version&&v===c.toneMapping||(u.material.needsUpdate=!0,m=(f=r).version,v=c.toneMapping),e.unshift(u,u.geometry,u.material,0,0,null))}}}function ra(o,s,c,e){var l,u=e.isWebGL2;this.setMode=function(e){l=e},this.render=function(e,t){o.drawArrays(l,e,t),c.update(t,l)},this.renderInstances=function(e,t,n,i){if(0!==i){var r,a;if(u)r=o,a="drawArraysInstanced";else if(a="drawArraysInstancedANGLE",null===(r=s.get("ANGLE_instanced_arrays")))return void console.error("THREE.WebGLBufferRenderer: using THREE.InstancedBufferGeometry but hardware does not support extension ANGLE_instanced_arrays.");r[a](l,t,n,i),c.update(n,l,i)}}}function aa(t,n,e){var i;function r(e){if("highp"===e){if(0<t.getShaderPrecisionFormat(35633,36338).precision&&0<t.getShaderPrecisionFormat(35632,36338).precision)return"highp";e="mediump"}return"mediump"===e&&0<t.getShaderPrecisionFormat(35633,36337).precision&&0<t.getShaderPrecisionFormat(35632,36337).precision?"mediump":"lowp"}var a="undefined"!=typeof WebGL2RenderingContext&&t instanceof WebGL2RenderingContext||"undefined"!=typeof WebGL2ComputeRenderingContext&&t instanceof WebGL2ComputeRenderingContext,o=void 0!==e.precision?e.precision:"highp",s=r(o);s!==o&&(console.warn("THREE.WebGLRenderer:",o,"not supported, using",s,"instead."),o=s);var c=!0===e.logarithmicDepthBuffer,l=t.getParameter(34930),u=t.getParameter(35660),h=t.getParameter(3379),d=t.getParameter(34076),p=t.getParameter(34921),f=t.getParameter(36347),m=t.getParameter(36348),v=t.getParameter(36349),g=0<u,y=a||!!n.get("OES_texture_float");return{isWebGL2:a,getMaxAnisotropy:function(){if(void 0!==i)return i;var e=n.get("EXT_texture_filter_anisotropic");return i=null!==e?t.getParameter(e.MAX_TEXTURE_MAX_ANISOTROPY_EXT):0},getMaxPrecision:r,precision:o,logarithmicDepthBuffer:c,maxTextures:l,maxVertexTextures:u,maxTextureSize:h,maxCubemapSize:d,maxAttributes:p,maxVertexUniforms:f,maxVaryings:m,maxFragmentUniforms:v,vertexTextures:g,floatFragmentTextures:y,floatVertexTextures:g&&y,maxSamples:a?t.getParameter(36183):0}}function oa(){var u=this,h=null,d=0,p=!1,f=!1,m=new _i,v=new sn,g={value:null,needsUpdate:!1};function y(){g.value!==h&&(g.value=h,g.needsUpdate=0<d),u.numPlanes=d,u.numIntersection=0}function _(e,t,n,i){var r=null!==e?e.length:0,a=null;if(0!==r){if(a=g.value,!0!==i||null===a){var o=n+4*r,s=t.matrixWorldInverse;v.getNormalMatrix(s),(null===a||a.length<o)&&(a=new Float32Array(o));for(var c=0,l=n;c!==r;++c,l+=4)m.copy(e[c]).applyMatrix4(s,v),m.normal.toArray(a,l),a[l+3]=m.constant}g.value=a,g.needsUpdate=!0}return u.numPlanes=r,u.numIntersection=0,a}this.uniform=g,this.numPlanes=0,this.numIntersection=0,this.init=function(e,t,n){var i=0!==e.length||t||0!==d||p;return p=t,h=_(e,n,0),d=e.length,i},this.beginShadows=function(){f=!0,_(null)},this.endShadows=function(){f=!1,y()},this.setState=function(e,t,n,i,r,a){if(!p||null===e||0===e.length||f&&!n)f?_(null):y();else{var o=f?0:d,s=4*o,c=r.clippingState||null;g.value=c,c=_(e,i,s,a);for(var l=0;l!==s;++l)c[l]=h[l];r.clippingState=c,this.numIntersection=t?this.numPlanes:0,this.numPlanes+=o}}}function sa(n){var i={};return{get:function(e){if(void 0!==i[e])return i[e];var t;switch(e){case"WEBGL_depth_texture":t=n.getExtension("WEBGL_depth_texture")||n.getExtension("MOZ_WEBGL_depth_texture")||n.getExtension("WEBKIT_WEBGL_depth_texture");break;case"EXT_texture_filter_anisotropic":t=n.getExtension("EXT_texture_filter_anisotropic")||n.getExtension("MOZ_EXT_texture_filter_anisotropic")||n.getExtension("WEBKIT_EXT_texture_filter_anisotropic");break;case"WEBGL_compressed_texture_s3tc":t=n.getExtension("WEBGL_compressed_texture_s3tc")||n.getExtension("MOZ_WEBGL_compressed_texture_s3tc")||n.getExtension("WEBKIT_WEBGL_compressed_texture_s3tc");break;case"WEBGL_compressed_texture_pvrtc":t=n.getExtension("WEBGL_compressed_texture_pvrtc")||n.getExtension("WEBKIT_WEBGL_compressed_texture_pvrtc");break;default:t=n.getExtension(e)}return null===t&&console.warn("THREE.WebGLRenderer: "+e+" extension not supported."),i[e]=t}}}function ca(e,p,a){var o=new WeakMap,f=new WeakMap;function s(e){var t=e.target,n=o.get(t);for(var i in null!==n.index&&p.remove(n.index),n.attributes)p.remove(n.attributes[i]);t.removeEventListener("dispose",s),o.delete(t);var r=f.get(n);r&&(p.remove(r),f.delete(n)),a.memory.geometries--}function i(e){var t=[],n=e.index,i=e.attributes.position,r=0;if(null!==n){var a=n.array;r=n.version;for(var o=0,s=a.length;o<s;o+=3){var c=a[o+0],l=a[o+1],u=a[o+2];t.push(c,l,l,u,u,c)}}else{a=i.array;r=i.version;for(o=0,s=a.length/3-1;o<s;o+=3){c=o+0,l=o+1,u=o+2;t.push(c,l,l,u,u,c)}}var h=new(65535<er(t)?Ji:Yi)(t,1);h.version=r,p.update(h,34963);var d=f.get(e);d&&p.remove(d),f.set(e,h)}return{get:function(e,t){var n=o.get(t);return n||(t.addEventListener("dispose",s),t.isBufferGeometry?n=t:t.isGeometry&&(void 0===t._bufferGeometry&&(t._bufferGeometry=(new cr).setFromObject(e)),n=t._bufferGeometry),o.set(t,n),a.memory.geometries++,n)},update:function(e){var t=e.index,n=e.attributes;for(var i in null!==t&&p.update(t,34963),n)p.update(n[i],34962);var r=e.morphAttributes;for(var i in r)for(var a=r[i],o=0,s=a.length;o<s;o++)p.update(a[o],34962)},getWireframeAttribute:function(e){var t=f.get(e);if(t){var n=e.index;null!==n&&t.version<n.version&&i(e)}else i(e);return f.get(e)}}}function la(o,s,c,e){var l,u,h,d=e.isWebGL2;this.setMode=function(e){l=e},this.setIndex=function(e){u=e.type,h=e.bytesPerElement},this.render=function(e,t){o.drawElements(l,t,u,e*h),c.update(t,l)},this.renderInstances=function(e,t,n,i){if(0!==i){var r,a;if(d)r=o,a="drawElementsInstanced";else if(a="drawElementsInstancedANGLE",null===(r=s.get("ANGLE_instanced_arrays")))return void console.error("THREE.WebGLIndexedBufferRenderer: using THREE.InstancedBufferGeometry but hardware does not support extension ANGLE_instanced_arrays.");r[a](l,n,u,t*h,i),c.update(n,l,i)}}}function ua(e){var i={frame:0,calls:0,triangles:0,points:0,lines:0};return{memory:{geometries:0,textures:0},render:i,programs:null,autoReset:!0,reset:function(){i.frame++,i.calls=0,i.triangles=0,i.points=0,i.lines=0},update:function(e,t,n){switch(n=n||1,i.calls++,t){case 4:i.triangles+=n*(e/3);break;case 1:i.lines+=n*(e/2);break;case 3:i.lines+=n*(e-1);break;case 2:i.lines+=n*e;break;case 0:i.points+=n*e;break;default:console.error("THREE.WebGLInfo: Unknown draw mode:",t)}}}}function ha(e,t){return Math.abs(t[1])-Math.abs(e[1])}function da(m){var v={},g=new Float32Array(8);return{update:function(e,t,n,i){var r=e.morphTargetInfluences,a=void 0===r?0:r.length,o=v[t.id];if(void 0===o){o=[];for(var s=0;s<a;s++)o[s]=[s,0];v[t.id]=o}var c=n.morphTargets&&t.morphAttributes.position,l=n.morphNormals&&t.morphAttributes.normal;for(s=0;s<a;s++){0!==(h=o[s])[1]&&(c&&t.deleteAttribute("morphTarget"+s),l&&t.deleteAttribute("morphNormal"+s))}for(s=0;s<a;s++){(h=o[s])[0]=s,h[1]=r[s]}o.sort(ha);var u=0;for(s=0;s<8;s++){var h;if(h=o[s]){var d=h[0],p=h[1];if(p){c&&t.setAttribute("morphTarget"+s,c[d]),l&&t.setAttribute("morphNormal"+s,l[d]),u+=g[s]=p;continue}}g[s]=0}var f=t.morphTargetsRelative?1:1-u;i.getUniforms().setValue(m,"morphTargetBaseInfluence",f),i.getUniforms().setValue(m,"morphTargetInfluences",g)}}}function pa(e,r,a,o){var s=new WeakMap;return{update:function(e){var t=o.render.frame,n=e.geometry,i=r.get(e,n);return s.get(i)!==t&&(n.isGeometry&&i.updateFromObject(e),r.update(i),s.set(i,t)),e.isInstancedMesh&&a.update(e.instanceMatrix,34962),i},dispose:function(){s=new WeakMap}}}function fa(e,t,n,i,r,a,o,s,c,l){un.call(this,e=void 0!==e?e:[],t=void 0!==t?t:Y,n,i,r,a,o=void 0!==o?o:et,s,c,l),this.flipY=!1}function ma(e,t,n,i){un.call(this,null),this.image={data:e||null,width:t||1,height:n||1,depth:i||1},this.magFilter=ke,this.minFilter=ke,this.wrapR=Ge,this.generateMipmaps=!1,this.flipY=!1,this.needsUpdate=!0}function va(e,t,n,i){un.call(this,null),this.image={data:e||null,width:t||1,height:n||1,depth:i||1},this.magFilter=ke,this.minFilter=ke,this.wrapR=Ge,this.generateMipmaps=!1,this.flipY=!1,this.needsUpdate=!0}na.physical={uniforms:zr([na.standard.uniforms,{clearcoat:{value:0},clearcoatMap:{value:null},clearcoatRoughness:{value:0},clearcoatRoughnessMap:{value:null},clearcoatNormalScale:{value:new on(1,1)},clearcoatNormalMap:{value:null},sheen:{value:new Di(0)},transparency:{value:0}}]),vertexShader:ta.meshphysical_vert,fragmentShader:ta.meshphysical_frag},((fa.prototype=Object.create(un.prototype)).constructor=fa).prototype.isCubeTexture=!0,Object.defineProperty(fa.prototype,"images",{get:function(){return this.image},set:function(e){this.image=e}}),((ma.prototype=Object.create(un.prototype)).constructor=ma).prototype.isDataTexture2DArray=!0,((va.prototype=Object.create(un.prototype)).constructor=va).prototype.isDataTexture3D=!0;var ga=new un,ya=new ma,_a=new va,xa=new fa,ba=[],wa=[],Ma=new Float32Array(16),Sa=new Float32Array(9),Ta=new Float32Array(4);function Ea(e,t,n){var i=e[0];if(i<=0||0<i)return e;var r=t*n,a=ba[r];if(void 0===a&&(a=new Float32Array(r),ba[r]=a),0!==t){i.toArray(a,0);for(var o=1,s=0;o!==t;++o)s+=n,e[o].toArray(a,s)}return a}function Aa(e,t){if(e.length===t.length){for(var n=0,i=e.length;n<i;n++)if(e[n]!==t[n])return;return 1}}function La(e,t){for(var n=0,i=t.length;n<i;n++)e[n]=t[n]}function Ra(e,t){var n=wa[t];void 0===n&&(n=new Int32Array(t),wa[t]=n);for(var i=0;i!==t;++i)n[i]=e.allocateTextureUnit();return n}function Pa(e,t){var n=this.cache;n[0]!==t&&(e.uniform1f(this.addr,t),n[0]=t)}function Ca(e,t){var n=this.cache;if(void 0!==t.x)n[0]===t.x&&n[1]===t.y||(e.uniform2f(this.addr,t.x,t.y),n[0]=t.x,n[1]=t.y);else{if(Aa(n,t))return;e.uniform2fv(this.addr,t),La(n,t)}}function Ia(e,t){var n=this.cache;if(void 0!==t.x)n[0]===t.x&&n[1]===t.y&&n[2]===t.z||(e.uniform3f(this.addr,t.x,t.y,t.z),n[0]=t.x,n[1]=t.y,n[2]=t.z);else if(void 0!==t.r)n[0]===t.r&&n[1]===t.g&&n[2]===t.b||(e.uniform3f(this.addr,t.r,t.g,t.b),n[0]=t.r,n[1]=t.g,n[2]=t.b);else{if(Aa(n,t))return;e.uniform3fv(this.addr,t),La(n,t)}}function Oa(e,t){var n=this.cache;if(void 0!==t.x)n[0]===t.x&&n[1]===t.y&&n[2]===t.z&&n[3]===t.w||(e.uniform4f(this.addr,t.x,t.y,t.z,t.w),n[0]=t.x,n[1]=t.y,n[2]=t.z,n[3]=t.w);else{if(Aa(n,t))return;e.uniform4fv(this.addr,t),La(n,t)}}function Da(e,t){var n=this.cache,i=t.elements;if(void 0===i){if(Aa(n,t))return;e.uniformMatrix2fv(this.addr,!1,t),La(n,t)}else{if(Aa(n,i))return;Ta.set(i),e.uniformMatrix2fv(this.addr,!1,Ta),La(n,i)}}function Na(e,t){var n=this.cache,i=t.elements;if(void 0===i){if(Aa(n,t))return;e.uniformMatrix3fv(this.addr,!1,t),La(n,t)}else{if(Aa(n,i))return;Sa.set(i),e.uniformMatrix3fv(this.addr,!1,Sa),La(n,i)}}function Fa(e,t){var n=this.cache,i=t.elements;if(void 0===i){if(Aa(n,t))return;e.uniformMatrix4fv(this.addr,!1,t),La(n,t)}else{if(Aa(n,i))return;Ma.set(i),e.uniformMatrix4fv(this.addr,!1,Ma),La(n,i)}}function za(e,t,n){var i=this.cache,r=n.allocateTextureUnit();i[0]!==r&&(e.uniform1i(this.addr,r),i[0]=r),n.safeSetTexture2D(t||ga,r)}function Ua(e,t,n){var i=this.cache,r=n.allocateTextureUnit();i[0]!==r&&(e.uniform1i(this.addr,r),i[0]=r),n.setTexture2DArray(t||ya,r)}function Ba(e,t,n){var i=this.cache,r=n.allocateTextureUnit();i[0]!==r&&(e.uniform1i(this.addr,r),i[0]=r),n.setTexture3D(t||_a,r)}function Ga(e,t,n){var i=this.cache,r=n.allocateTextureUnit();i[0]!==r&&(e.uniform1i(this.addr,r),i[0]=r),n.safeSetTextureCube(t||xa,r)}function Ha(e,t){var n=this.cache;n[0]!==t&&(e.uniform1i(this.addr,t),n[0]=t)}function ka(e,t){var n=this.cache;Aa(n,t)||(e.uniform2iv(this.addr,t),La(n,t))}function Va(e,t){var n=this.cache;Aa(n,t)||(e.uniform3iv(this.addr,t),La(n,t))}function ja(e,t){var n=this.cache;Aa(n,t)||(e.uniform4iv(this.addr,t),La(n,t))}function Wa(e,t){var n=this.cache;n[0]!==t&&(e.uniform1ui(this.addr,t),n[0]=t)}function qa(e,t){e.uniform1fv(this.addr,t)}function Xa(e,t){e.uniform1iv(this.addr,t)}function Ya(e,t){e.uniform2iv(this.addr,t)}function Za(e,t){e.uniform3iv(this.addr,t)}function Ja(e,t){e.uniform4iv(this.addr,t)}function Ka(e,t){var n=Ea(t,this.size,2);e.uniform2fv(this.addr,n)}function Qa(e,t){var n=Ea(t,this.size,3);e.uniform3fv(this.addr,n)}function $a(e,t){var n=Ea(t,this.size,4);e.uniform4fv(this.addr,n)}function eo(e,t){var n=Ea(t,this.size,4);e.uniformMatrix2fv(this.addr,!1,n)}function to(e,t){var n=Ea(t,this.size,9);e.uniformMatrix3fv(this.addr,!1,n)}function no(e,t){var n=Ea(t,this.size,16);e.uniformMatrix4fv(this.addr,!1,n)}function io(e,t,n){var i=t.length,r=Ra(n,i);e.uniform1iv(this.addr,r);for(var a=0;a!==i;++a)n.safeSetTexture2D(t[a]||ga,r[a])}function ro(e,t,n){var i=t.length,r=Ra(n,i);e.uniform1iv(this.addr,r);for(var a=0;a!==i;++a)n.safeSetTextureCube(t[a]||xa,r[a])}function ao(e,t,n){this.id=e,this.addr=n,this.cache=[],this.setValue=function(e){switch(e){case 5126:return Pa;case 35664:return Ca;case 35665:return Ia;case 35666:return Oa;case 35674:return Da;case 35675:return Na;case 35676:return Fa;case 5124:case 35670:return Ha;case 35667:case 35671:return ka;case 35668:case 35672:return Va;case 35669:case 35673:return ja;case 5125:return Wa;case 35678:case 36198:case 36298:case 36306:case 35682:return za;case 35679:case 36299:case 36307:return Ba;case 35680:case 36300:case 36308:case 36293:return Ga;case 36289:case 36303:case 36311:case 36292:return Ua}}(t.type)}function oo(e,t,n){this.id=e,this.addr=n,this.cache=[],this.size=t.size,this.setValue=function(e){switch(e){case 5126:return qa;case 35664:return Ka;case 35665:return Qa;case 35666:return $a;case 35674:return eo;case 35675:return to;case 35676:return no;case 5124:case 35670:return Xa;case 35667:case 35671:return Ya;case 35668:case 35672:return Za;case 35669:case 35673:return Ja;case 35678:case 36198:case 36298:case 36306:case 35682:return io;case 35680:case 36300:case 36308:case 36293:return ro}}(t.type)}function so(e){this.id=e,this.seq=[],this.map={}}oo.prototype.updateCache=function(e){var t=this.cache;e instanceof Float32Array&&t.length!==e.length&&(this.cache=new Float32Array(e.length)),La(t,e)},so.prototype.setValue=function(e,t,n){for(var i=this.seq,r=0,a=i.length;r!==a;++r){var o=i[r];o.setValue(e,t[o.id],n)}};var co=/([\w\d_]+)(\])?(\[|\.)?/g;function lo(e,t){e.seq.push(t),e.map[t.id]=t}function uo(e,t,n){var i=e.name,r=i.length;for(co.lastIndex=0;;){var a=co.exec(i),o=co.lastIndex,s=a[1],c="]"===a[2],l=a[3];if(c&&(s|=0),void 0===l||"["===l&&o+2===r){lo(n,new(void 0===l?ao:oo)(s,e,t));break}var u=n.map[s];void 0===u&&lo(n,u=new so(s)),n=u}}function ho(e,t){this.seq=[],this.map={};for(var n=e.getProgramParameter(t,35718),i=0;i<n;++i){var r=e.getActiveUniform(t,i);uo(r,e.getUniformLocation(t,r.name),this)}}function po(e,t,n){var i=e.createShader(t);return e.shaderSource(i,n),e.compileShader(i),i}ho.prototype.setValue=function(e,t,n,i){var r=this.map[t];void 0!==r&&r.setValue(e,n,i)},ho.prototype.setOptional=function(e,t,n){var i=t[n];void 0!==i&&this.setValue(e,n,i)},ho.upload=function(e,t,n,i){for(var r=0,a=t.length;r!==a;++r){var o=t[r],s=n[o.id];!1!==s.needsUpdate&&o.setValue(e,s.value,i)}},ho.seqWithValue=function(e,t){for(var n=[],i=0,r=e.length;i!==r;++i){var a=e[i];a.id in t&&n.push(a)}return n};var fo=0;function mo(e){switch(e){case Ut:return["Linear","( value )"];case Bt:return["sRGB","( value )"];case Ht:return["RGBE","( value )"];case Vt:return["RGBM","( value, 7.0 )"];case jt:return["RGBM","( value, 16.0 )"];case Wt:return["RGBD","( value, 256.0 )"];case Gt:return["Gamma","( value, float( GAMMA_FACTOR ) )"];case kt:return["LogLuv","( value )"];default:throw new Error("unsupported encoding: "+e)}}function vo(e,t,n){var i=e.getShaderParameter(t,35713),r=e.getShaderInfoLog(t).trim();return i&&""===r?"":"THREE.WebGLShader: gl.getShaderInfoLog() "+n+"\n"+r+function(e){for(var t=e.split("\n"),n=0;n<t.length;n++)t[n]=n+1+": "+t[n];return t.join("\n")}(e.getShaderSource(t))}function go(e,t){var n=mo(t);return"vec4 "+e+"( vec4 value ) { return "+n[0]+"ToLinear"+n[1]+"; }"}function yo(e){return""!==e}function _o(e,t){return e.replace(/NUM_DIR_LIGHTS/g,t.numDirLights).replace(/NUM_SPOT_LIGHTS/g,t.numSpotLights).replace(/NUM_RECT_AREA_LIGHTS/g,t.numRectAreaLights).replace(/NUM_POINT_LIGHTS/g,t.numPointLights).replace(/NUM_HEMI_LIGHTS/g,t.numHemiLights).replace(/NUM_DIR_LIGHT_SHADOWS/g,t.numDirLightShadows).replace(/NUM_SPOT_LIGHT_SHADOWS/g,t.numSpotLightShadows).replace(/NUM_POINT_LIGHT_SHADOWS/g,t.numPointLightShadows)}function xo(e,t){return e.replace(/NUM_CLIPPING_PLANES/g,t.numClippingPlanes).replace(/UNION_CLIPPING_PLANES/g,t.numClippingPlanes-t.numClipIntersection)}var bo=/^[ \t]*#include +<([\w\d./]+)>/gm;function wo(e){return e.replace(bo,Mo)}function Mo(e,t){var n=ta[t];if(void 0===n)throw new Error("Can not resolve #include <"+t+">");return wo(n)}var So=/#pragma unroll_loop[\s]+?for \( int i \= (\d+)\; i < (\d+)\; i \+\+ \) \{([\s\S]+?)(?=\})\}/g,To=/#pragma unroll_loop_start[\s]+?for \( int i \= (\d+)\; i < (\d+)\; i \+\+ \) \{([\s\S]+?)(?=\})\}[\s]+?#pragma unroll_loop_end/g;function Eo(e){return e.replace(To,Lo).replace(So,Ao)}function Ao(e,t,n,i){return console.warn("WebGLProgram: #pragma unroll_loop shader syntax is deprecated. Please use #pragma unroll_loop_start syntax instead."),Lo(0,t,n,i)}function Lo(e,t,n,i){for(var r="",a=parseInt(t);a<parseInt(n);a++)r+=i.replace(/\[ i \]/g,"[ "+a+" ]").replace(/UNROLLED_LOOP_INDEX/g,a);return r}function Ro(e){var t="precision "+e.precision+" float;\nprecision "+e.precision+" int;";return"highp"===e.precision?t+="\n#define HIGH_PRECISION":"mediump"===e.precision?t+="\n#define MEDIUM_PRECISION":"lowp"===e.precision&&(t+="\n#define LOW_PRECISION"),t}function Po(e,t,n){var i,r,a,o,s,c,l,u,h=e.getContext(),d=n.defines,p=n.vertexShader,f=n.fragmentShader,m=(r="SHADOWMAP_TYPE_BASIC",(i=n).shadowMapType===z?r="SHADOWMAP_TYPE_PCF":i.shadowMapType===U?r="SHADOWMAP_TYPE_PCF_SOFT":i.shadowMapType===B&&(r="SHADOWMAP_TYPE_VSM"),r),v=function(e){var t="ENVMAP_TYPE_CUBE";if(e.envMap)switch(e.envMapMode){case Y:case Z:t="ENVMAP_TYPE_CUBE";break;case ze:case Ue:t="ENVMAP_TYPE_CUBE_UV";break;case De:case Ne:t="ENVMAP_TYPE_EQUIREC";break;case Fe:t="ENVMAP_TYPE_SPHERE"}return t}(n),g=function(e){var t="ENVMAP_MODE_REFLECTION";if(e.envMap)switch(e.envMapMode){case Z:case Ne:t="ENVMAP_MODE_REFRACTION"}return t}(n),y=function(e){var t="ENVMAP_BLENDING_NONE";if(e.envMap)switch(e.combine){case G:t="ENVMAP_BLENDING_MULTIPLY";break;case H:t="ENVMAP_BLENDING_MIX";break;case k:t="ENVMAP_BLENDING_ADD"}return t}(n),_=0<e.gammaFactor?e.gammaFactor:1,x=n.isWebGL2?"":[(a=n).extensionDerivatives||a.envMapCubeUV||a.bumpMap||a.tangentSpaceNormalMap||a.clearcoatNormalMap||a.flatShading||"physical"===a.shaderID?"#extension GL_OES_standard_derivatives : enable":"",(a.extensionFragDepth||a.logarithmicDepthBuffer)&&a.rendererExtensionFragDepth?"#extension GL_EXT_frag_depth : enable":"",a.extensionDrawBuffers&&a.rendererExtensionDrawBuffers?"#extension GL_EXT_draw_buffers : require":"",(a.extensionShaderTextureLOD||a.envMap)&&a.rendererExtensionShaderTextureLod?"#extension GL_EXT_shader_texture_lod : enable":""].filter(yo).join("\n"),b=function(e){var t=[];for(var n in e){var i=e[n];!1!==i&&t.push("#define "+n+" "+i)}return t.join("\n")}(d),w=h.createProgram();if(n.isRawShaderMaterial?(0<(o=[b].filter(yo).join("\n")).length&&(o+="\n"),0<(s=[x,b].filter(yo).join("\n")).length&&(s+="\n")):(o=[Ro(n),"#define SHADER_NAME "+n.shaderName,b,n.instancing?"#define USE_INSTANCING":"",n.supportsVertexTextures?"#define VERTEX_TEXTURES":"","#define GAMMA_FACTOR "+_,"#define MAX_BONES "+n.maxBones,n.useFog&&n.fog?"#define USE_FOG":"",n.useFog&&n.fogExp2?"#define FOG_EXP2":"",n.map?"#define USE_MAP":"",n.envMap?"#define USE_ENVMAP":"",n.envMap?"#define "+g:"",n.lightMap?"#define USE_LIGHTMAP":"",n.aoMap?"#define USE_AOMAP":"",n.emissiveMap?"#define USE_EMISSIVEMAP":"",n.bumpMap?"#define USE_BUMPMAP":"",n.normalMap?"#define USE_NORMALMAP":"",n.normalMap&&n.objectSpaceNormalMap?"#define OBJECTSPACE_NORMALMAP":"",n.normalMap&&n.tangentSpaceNormalMap?"#define TANGENTSPACE_NORMALMAP":"",n.clearcoatMap?"#define USE_CLEARCOATMAP":"",n.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",n.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",n.displacementMap&&n.supportsVertexTextures?"#define USE_DISPLACEMENTMAP":"",n.specularMap?"#define USE_SPECULARMAP":"",n.roughnessMap?"#define USE_ROUGHNESSMAP":"",n.metalnessMap?"#define USE_METALNESSMAP":"",n.alphaMap?"#define USE_ALPHAMAP":"",n.vertexTangents?"#define USE_TANGENT":"",n.vertexColors?"#define USE_COLOR":"",n.vertexUvs?"#define USE_UV":"",n.uvsVertexOnly?"#define UVS_VERTEX_ONLY":"",n.flatShading?"#define FLAT_SHADED":"",n.skinning?"#define USE_SKINNING":"",n.useVertexTexture?"#define BONE_TEXTURE":"",n.morphTargets?"#define USE_MORPHTARGETS":"",n.morphNormals&&!1===n.flatShading?"#define USE_MORPHNORMALS":"",n.doubleSided?"#define DOUBLE_SIDED":"",n.flipSided?"#define FLIP_SIDED":"",n.shadowMapEnabled?"#define USE_SHADOWMAP":"",n.shadowMapEnabled?"#define "+m:"",n.sizeAttenuation?"#define USE_SIZEATTENUATION":"",n.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",n.logarithmicDepthBuffer&&n.rendererExtensionFragDepth?"#define USE_LOGDEPTHBUF_EXT":"","uniform mat4 modelMatrix;","uniform mat4 modelViewMatrix;","uniform mat4 projectionMatrix;","uniform mat4 viewMatrix;","uniform mat3 normalMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;","#ifdef USE_INSTANCING"," attribute mat4 instanceMatrix;","#endif","attribute vec3 position;","attribute vec3 normal;","attribute vec2 uv;","#ifdef USE_TANGENT","\tattribute vec4 tangent;","#endif","#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(yo).join("\n"),s=[x,Ro(n),"#define SHADER_NAME "+n.shaderName,b,n.alphaTest?"#define ALPHATEST "+n.alphaTest+(n.alphaTest%1?"":".0"):"","#define GAMMA_FACTOR "+_,n.useFog&&n.fog?"#define USE_FOG":"",n.useFog&&n.fogExp2?"#define FOG_EXP2":"",n.map?"#define USE_MAP":"",n.matcap?"#define USE_MATCAP":"",n.envMap?"#define USE_ENVMAP":"",n.envMap?"#define "+v:"",n.envMap?"#define "+g:"",n.envMap?"#define "+y:"",n.lightMap?"#define USE_LIGHTMAP":"",n.aoMap?"#define USE_AOMAP":"",n.emissiveMap?"#define USE_EMISSIVEMAP":"",n.bumpMap?"#define USE_BUMPMAP":"",n.normalMap?"#define USE_NORMALMAP":"",n.normalMap&&n.objectSpaceNormalMap?"#define OBJECTSPACE_NORMALMAP":"",n.normalMap&&n.tangentSpaceNormalMap?"#define TANGENTSPACE_NORMALMAP":"",n.clearcoatMap?"#define USE_CLEARCOATMAP":"",n.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",n.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",n.specularMap?"#define USE_SPECULARMAP":"",n.roughnessMap?"#define USE_ROUGHNESSMAP":"",n.metalnessMap?"#define USE_METALNESSMAP":"",n.alphaMap?"#define USE_ALPHAMAP":"",n.sheen?"#define USE_SHEEN":"",n.vertexTangents?"#define USE_TANGENT":"",n.vertexColors?"#define USE_COLOR":"",n.vertexUvs?"#define USE_UV":"",n.uvsVertexOnly?"#define UVS_VERTEX_ONLY":"",n.gradientMap?"#define USE_GRADIENTMAP":"",n.flatShading?"#define FLAT_SHADED":"",n.doubleSided?"#define DOUBLE_SIDED":"",n.flipSided?"#define FLIP_SIDED":"",n.shadowMapEnabled?"#define USE_SHADOWMAP":"",n.shadowMapEnabled?"#define "+m:"",n.premultipliedAlpha?"#define PREMULTIPLIED_ALPHA":"",n.physicallyCorrectLights?"#define PHYSICALLY_CORRECT_LIGHTS":"",n.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",n.logarithmicDepthBuffer&&n.rendererExtensionFragDepth?"#define USE_LOGDEPTHBUF_EXT":"",(n.extensionShaderTextureLOD||n.envMap)&&n.rendererExtensionShaderTextureLod?"#define TEXTURE_LOD_EXT":"","uniform mat4 viewMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;",n.toneMapping!==Oe?"#define TONE_MAPPING":"",n.toneMapping!==Oe?ta.tonemapping_pars_fragment:"",n.toneMapping!==Oe?function(e,t){var n;switch(t){case V:n="Linear";break;case j:n="Reinhard";break;case W:n="Uncharted2";break;case q:n="OptimizedCineon";break;case X:n="ACESFilmic";break;default:throw new Error("unsupported toneMapping: "+t)}return"vec3 "+e+"( vec3 color ) { return "+n+"ToneMapping( color ); }"}("toneMapping",n.toneMapping):"",n.dithering?"#define DITHERING":"",n.outputEncoding||n.mapEncoding||n.matcapEncoding||n.envMapEncoding||n.emissiveMapEncoding||n.lightMapEncoding?ta.encodings_pars_fragment:"",n.mapEncoding?go("mapTexelToLinear",n.mapEncoding):"",n.matcapEncoding?go("matcapTexelToLinear",n.matcapEncoding):"",n.envMapEncoding?go("envMapTexelToLinear",n.envMapEncoding):"",n.emissiveMapEncoding?go("emissiveMapTexelToLinear",n.emissiveMapEncoding):"",n.lightMapEncoding?go("lightMapTexelToLinear",n.lightMapEncoding):"",n.outputEncoding?(c="linearToOutputTexel",l=n.outputEncoding,u=mo(l),"vec4 "+c+"( vec4 value ) { return LinearTo"+u[0]+u[1]+"; }"):"",n.depthPacking?"#define DEPTH_PACKING "+n.depthPacking:"","\n"].filter(yo).join("\n")),p=xo(p=_o(p=wo(p),n),n),f=xo(f=_o(f=wo(f),n),n),p=Eo(p),f=Eo(f),n.isWebGL2&&!n.isRawShaderMaterial){var M=!1,S=/^\s*#version\s+300\s+es\s*\n/;n.isShaderMaterial&&null!==p.match(S)&&null!==f.match(S)&&(M=!0,p=p.replace(S,""),f=f.replace(S,"")),o=["#version 300 es\n","#define attribute in","#define varying out","#define texture2D texture"].join("\n")+"\n"+o,s=["#version 300 es\n","#define varying in",M?"":"out highp vec4 pc_fragColor;",M?"":"#define gl_FragColor pc_fragColor","#define gl_FragDepthEXT gl_FragDepth","#define texture2D texture","#define textureCube texture","#define texture2DProj textureProj","#define texture2DLodEXT textureLod","#define texture2DProjLodEXT textureProjLod","#define textureCubeLodEXT textureLod","#define texture2DGradEXT textureGrad","#define texture2DProjGradEXT textureProjGrad","#define textureCubeGradEXT textureGrad"].join("\n")+"\n"+s}var T,E,A=s+f,L=po(h,35633,o+p),R=po(h,35632,A);if(h.attachShader(w,L),h.attachShader(w,R),void 0!==n.index0AttributeName?h.bindAttribLocation(w,0,n.index0AttributeName):!0===n.morphTargets&&h.bindAttribLocation(w,0,"position"),h.linkProgram(w),e.debug.checkShaderErrors){var P=h.getProgramInfoLog(w).trim(),C=h.getShaderInfoLog(L).trim(),I=h.getShaderInfoLog(R).trim(),O=!0,D=!0;if(!1===h.getProgramParameter(w,35714)){O=!1;var N=vo(h,L,"vertex"),F=vo(h,R,"fragment");console.error("THREE.WebGLProgram: shader error: ",h.getError(),"35715",h.getProgramParameter(w,35715),"gl.getProgramInfoLog",P,N,F)}else""!==P?console.warn("THREE.WebGLProgram: gl.getProgramInfoLog()",P):""!==C&&""!==I||(D=!1);D&&(this.diagnostics={runnable:O,programLog:P,vertexShader:{log:C,prefix:o},fragmentShader:{log:I,prefix:s}})}return h.deleteShader(L),h.deleteShader(R),this.getUniforms=function(){return void 0===T&&(T=new ho(h,w)),T},this.getAttributes=function(){return void 0===E&&(E=function(e,t){for(var n={},i=e.getProgramParameter(t,35721),r=0;r<i;r++){var a=e.getActiveAttrib(t,r).name;n[a]=e.getAttribLocation(t,a)}return n}(h,w)),E},this.destroy=function(){h.deleteProgram(w),this.program=void 0},this.name=n.shaderName,this.id=fo++,this.cacheKey=t,this.usedTimes=1,this.program=w,this.vertexShader=L,this.fragmentShader=R,this}function Co(f,m,v){var o=[],g=v.isWebGL2,y=v.logarithmicDepthBuffer,_=v.floatVertexTextures,x=v.precision,b=v.maxVertexUniforms,w=v.vertexTextures,M={MeshDepthMaterial:"depth",MeshDistanceMaterial:"distanceRGBA",MeshNormalMaterial:"normal",MeshBasicMaterial:"basic",MeshLambertMaterial:"lambert",MeshPhongMaterial:"phong",MeshToonMaterial:"toon",MeshStandardMaterial:"physical",MeshPhysicalMaterial:"physical",MeshMatcapMaterial:"matcap",LineBasicMaterial:"basic",LineDashedMaterial:"dashed",PointsMaterial:"points",ShadowMaterial:"shadow",SpriteMaterial:"sprite"},r=["precision","isWebGL2","supportsVertexTextures","outputEncoding","instancing","map","mapEncoding","matcap","matcapEncoding","envMap","envMapMode","envMapEncoding","envMapCubeUV","lightMap","lightMapEncoding","aoMap","emissiveMap","emissiveMapEncoding","bumpMap","normalMap","objectSpaceNormalMap","tangentSpaceNormalMap","clearcoatMap","clearcoatRoughnessMap","clearcoatNormalMap","displacementMap","specularMap","roughnessMap","metalnessMap","gradientMap","alphaMap","combine","vertexColors","vertexTangents","vertexUvs","uvsVertexOnly","fog","useFog","fogExp2","flatShading","sizeAttenuation","logarithmicDepthBuffer","skinning","maxBones","useVertexTexture","morphTargets","morphNormals","maxMorphTargets","maxMorphNormals","premultipliedAlpha","numDirLights","numPointLights","numSpotLights","numHemiLights","numRectAreaLights","numDirLightShadows","numPointLightShadows","numSpotLightShadows","shadowMapEnabled","shadowMapType","toneMapping","physicallyCorrectLights","alphaTest","doubleSided","flipSided","numClippingPlanes","numClipIntersection","depthPacking","dithering","sheen"];function S(e){var t;return e?e.isTexture?t=e.encoding:e.isWebGLRenderTarget&&(console.warn("THREE.WebGLPrograms.getTextureEncodingFromMap: don't use render targets as textures. Use their .texture property instead."),t=e.texture.encoding):t=Ut,t}this.getParameters=function(e,t,n,i,r,a,o){var s=i.fog,c=e.isMeshStandardMaterial?i.environment:null,l=e.envMap||c,u=M[e.type],h=o.isSkinnedMesh?function(e){var t=e.skeleton.bones;if(_)return 1024;var n=b,i=Math.floor((n-20)/4),r=Math.min(i,t.length);return r<t.length?(console.warn("THREE.WebGLRenderer: Skeleton has "+t.length+" bones. This GPU supports "+r+"."),0):r}(o):0;null!==e.precision&&(x=v.getMaxPrecision(e.precision))!==e.precision&&console.warn("THREE.WebGLProgram.getParameters:",e.precision,"not supported, using",x,"instead.");var d=function(e,t){var n;if(t){var i=na[t];n={name:e.type,uniforms:Ur.clone(i.uniforms),vertexShader:i.vertexShader,fragmentShader:i.fragmentShader}}else n={name:e.type,uniforms:e.uniforms,vertexShader:e.vertexShader,fragmentShader:e.fragmentShader};return n}(e,u);e.onBeforeCompile(d,f);var p=f.getRenderTarget();return{isWebGL2:g,shaderID:u,shaderName:d.name,uniforms:d.uniforms,vertexShader:d.vertexShader,fragmentShader:d.fragmentShader,defines:e.defines,isRawShaderMaterial:e.isRawShaderMaterial,isShaderMaterial:e.isShaderMaterial,precision:x,instancing:!0===o.isInstancedMesh,supportsVertexTextures:w,outputEncoding:null!==p?S(p.texture):f.outputEncoding,map:!!e.map,mapEncoding:S(e.map),matcap:!!e.matcap,matcapEncoding:S(e.matcap),envMap:!!l,envMapMode:l&&l.mapping,envMapEncoding:S(l),envMapCubeUV:!!l&&(l.mapping===ze||l.mapping===Ue),lightMap:!!e.lightMap,lightMapEncoding:S(e.lightMap),aoMap:!!e.aoMap,emissiveMap:!!e.emissiveMap,emissiveMapEncoding:S(e.emissiveMap),bumpMap:!!e.bumpMap,normalMap:!!e.normalMap,objectSpaceNormalMap:e.normalMapType===Zt,tangentSpaceNormalMap:e.normalMapType===Yt,clearcoatMap:!!e.clearcoatMap,clearcoatRoughnessMap:!!e.clearcoatRoughnessMap,clearcoatNormalMap:!!e.clearcoatNormalMap,displacementMap:!!e.displacementMap,roughnessMap:!!e.roughnessMap,metalnessMap:!!e.metalnessMap,specularMap:!!e.specularMap,alphaMap:!!e.alphaMap,gradientMap:!!e.gradientMap,sheen:!!e.sheen,combine:e.combine,vertexTangents:e.normalMap&&e.vertexTangents,vertexColors:e.vertexColors,vertexUvs:!!(e.map||e.bumpMap||e.normalMap||e.specularMap||e.alphaMap||e.emissiveMap||e.roughnessMap||e.metalnessMap||e.clearcoatMap||e.clearcoatRoughnessMap||e.clearcoatNormalMap||e.displacementMap),uvsVertexOnly:!(e.map||e.bumpMap||e.normalMap||e.specularMap||e.alphaMap||e.emissiveMap||e.roughnessMap||e.metalnessMap||e.clearcoatNormalMap||!e.displacementMap),fog:!!s,useFog:e.fog,fogExp2:s&&s.isFogExp2,flatShading:e.flatShading,sizeAttenuation:e.sizeAttenuation,logarithmicDepthBuffer:y,skinning:e.skinning&&0<h,maxBones:h,useVertexTexture:_,morphTargets:e.morphTargets,morphNormals:e.morphNormals,maxMorphTargets:f.maxMorphTargets,maxMorphNormals:f.maxMorphNormals,numDirLights:t.directional.length,numPointLights:t.point.length,numSpotLights:t.spot.length,numRectAreaLights:t.rectArea.length,numHemiLights:t.hemi.length,numDirLightShadows:t.directionalShadowMap.length,numPointLightShadows:t.pointShadowMap.length,numSpotLightShadows:t.spotShadowMap.length,numClippingPlanes:r,numClipIntersection:a,dithering:e.dithering,shadowMapEnabled:f.shadowMap.enabled&&0<n.length,shadowMapType:f.shadowMap.type,toneMapping:e.toneMapped?f.toneMapping:Oe,physicallyCorrectLights:f.physicallyCorrectLights,premultipliedAlpha:e.premultipliedAlpha,alphaTest:e.alphaTest,doubleSided:e.side===te,flipSided:e.side===Me,depthPacking:void 0!==e.depthPacking&&e.depthPacking,index0AttributeName:e.index0AttributeName,extensionDerivatives:e.extensions&&e.extensions.derivatives,extensionFragDepth:e.extensions&&e.extensions.fragDepth,extensionDrawBuffers:e.extensions&&e.extensions.drawBuffers,extensionShaderTextureLOD:e.extensions&&e.extensions.shaderTextureLOD,rendererExtensionFragDepth:g||null!==m.get("EXT_frag_depth"),rendererExtensionDrawBuffers:g||null!==m.get("WEBGL_draw_buffers"),rendererExtensionShaderTextureLod:g||null!==m.get("EXT_shader_texture_lod"),onBeforeCompile:e.onBeforeCompile}},this.getProgramCacheKey=function(e){var t=[];if(e.shaderID?t.push(e.shaderID):(t.push(e.fragmentShader),t.push(e.vertexShader)),void 0!==e.defines)for(var n in e.defines)t.push(n),t.push(e.defines[n]);if(void 0===e.isRawShaderMaterial){for(var i=0;i<r.length;i++)t.push(e[r[i]]);t.push(f.outputEncoding),t.push(f.gammaFactor)}return t.push(e.onBeforeCompile.toString()),t.join()},this.acquireProgram=function(e,t){for(var n,i=0,r=o.length;i<r;i++){var a=o[i];if(a.cacheKey===t){++(n=a).usedTimes;break}}return void 0===n&&(n=new Po(f,t,e),o.push(n)),n},this.releaseProgram=function(e){if(0==--e.usedTimes){var t=o.indexOf(e);o[t]=o[o.length-1],o.pop(),e.destroy()}},this.programs=o}function Io(){var i=new WeakMap;return{get:function(e){var t=i.get(e);return void 0===t&&(t={},i.set(e,t)),t},remove:function(e){i.delete(e)},update:function(e,t,n){i.get(e)[t]=n},dispose:function(){i=new WeakMap}}}function Oo(e,t){return e.groupOrder!==t.groupOrder?e.groupOrder-t.groupOrder:e.renderOrder!==t.renderOrder?e.renderOrder-t.renderOrder:e.program!==t.program?e.program.id-t.program.id:e.material.id!==t.material.id?e.material.id-t.material.id:e.z!==t.z?e.z-t.z:e.id-t.id}function Do(e,t){return e.groupOrder!==t.groupOrder?e.groupOrder-t.groupOrder:e.renderOrder!==t.renderOrder?e.renderOrder-t.renderOrder:e.z!==t.z?t.z-e.z:e.id-t.id}function No(){var s=[],c=0,l=[],u=[],h={id:-1};function d(e,t,n,i,r,a){var o=s[c];return void 0===o?(o={id:e.id,object:e,geometry:t,material:n,program:n.program||h,groupOrder:i,renderOrder:e.renderOrder,z:r,group:a},s[c]=o):(o.id=e.id,o.object=e,o.geometry=t,o.material=n,o.program=n.program||h,o.groupOrder=i,o.renderOrder=e.renderOrder,o.z=r,o.group=a),c++,o}return{opaque:l,transparent:u,init:function(){c=0,l.length=0,u.length=0},push:function(e,t,n,i,r,a){var o=d(e,t,n,i,r,a);(!0===n.transparent?u:l).push(o)},unshift:function(e,t,n,i,r,a){var o=d(e,t,n,i,r,a);(!0===n.transparent?u:l).unshift(o)},finish:function(){for(var e=c,t=s.length;e<t;e++){var n=s[e];if(null===n.id)break;n.id=null,n.object=null,n.geometry=null,n.material=null,n.program=null,n.group=null}},sort:function(e,t){1<l.length&&l.sort(e||Oo),1<u.length&&u.sort(t||Do)}}}function Fo(){var r=new WeakMap;function a(e){var t=e.target;t.removeEventListener("dispose",a),r.delete(t)}return{get:function(e,t){var n,i=r.get(e);return void 0===i?(n=new No,r.set(e,new WeakMap),r.get(e).set(t,n),e.addEventListener("dispose",a)):void 0===(n=i.get(t))&&(n=new No,i.set(t,n)),n},dispose:function(){r=new WeakMap}}}function zo(){var n={};return{get:function(e){if(void 0!==n[e.id])return n[e.id];var t;switch(e.type){case"DirectionalLight":t={direction:new gn,color:new Di};break;case"SpotLight":t={position:new gn,direction:new gn,color:new Di,distance:0,coneCos:0,penumbraCos:0,decay:0};break;case"PointLight":t={position:new gn,color:new Di,distance:0,decay:0};break;case"HemisphereLight":t={direction:new gn,skyColor:new Di,groundColor:new Di};break;case"RectAreaLight":t={color:new Di,position:new gn,halfWidth:new gn,halfHeight:new gn}}return n[e.id]=t}}}var Uo=0;function Bo(e,t){return(t.castShadow?1:0)-(e.castShadow?1:0)}function Go(){for(var n,A=new zo,L=(n={},{get:function(e){if(void 0!==n[e.id])return n[e.id];var t;switch(e.type){case"DirectionalLight":case"SpotLight":t={shadowBias:0,shadowRadius:1,shadowMapSize:new on};break;case"PointLight":t={shadowBias:0,shadowRadius:1,shadowMapSize:new on,shadowCameraNear:1,shadowCameraFar:1e3}}return n[e.id]=t}}),R={version:0,hash:{directionalLength:-1,pointLength:-1,spotLength:-1,rectAreaLength:-1,hemiLength:-1,numDirectionalShadows:-1,numPointShadows:-1,numSpotShadows:-1},ambient:[0,0,0],probe:[],directional:[],directionalShadow:[],directionalShadowMap:[],directionalShadowMatrix:[],spot:[],spotShadow:[],spotShadowMap:[],spotShadowMatrix:[],rectArea:[],point:[],pointShadow:[],pointShadowMap:[],pointShadowMatrix:[],hemi:[]},e=0;e<9;e++)R.probe.push(new gn);var P=new gn,C=new Tn,I=new Tn;return{setup:function(e,t,n){for(var i=0,r=0,a=0,o=0;o<9;o++)R.probe[o].set(0,0,0);var s=0,c=0,l=0,u=0,h=0,d=0,p=0,f=0,m=n.matrixWorldInverse;e.sort(Bo),o=0;for(var v=e.length;o<v;o++){var g=e[o],y=g.color,_=g.intensity,x=g.distance,b=g.shadow&&g.shadow.map?g.shadow.map.texture:null;if(g.isAmbientLight)i+=y.r*_,r+=y.g*_,a+=y.b*_;else if(g.isLightProbe)for(var w=0;w<9;w++)R.probe[w].addScaledVector(g.sh.coefficients[w],_);else if(g.isDirectionalLight){if((T=A.get(g)).color.copy(g.color).multiplyScalar(g.intensity),T.direction.setFromMatrixPosition(g.matrixWorld),P.setFromMatrixPosition(g.target.matrixWorld),T.direction.sub(P),T.direction.transformDirection(m),g.castShadow){var M=g.shadow;(S=L.get(g)).shadowBias=M.bias,S.shadowRadius=M.radius,S.shadowMapSize=M.mapSize,R.directionalShadow[s]=S,R.directionalShadowMap[s]=b,R.directionalShadowMatrix[s]=g.shadow.matrix,d++}R.directional[s]=T,s++}else if(g.isSpotLight){if((T=A.get(g)).position.setFromMatrixPosition(g.matrixWorld),T.position.applyMatrix4(m),T.color.copy(y).multiplyScalar(_),T.distance=x,T.direction.setFromMatrixPosition(g.matrixWorld),P.setFromMatrixPosition(g.target.matrixWorld),T.direction.sub(P),T.direction.transformDirection(m),T.coneCos=Math.cos(g.angle),T.penumbraCos=Math.cos(g.angle*(1-g.penumbra)),T.decay=g.decay,g.castShadow){M=g.shadow;(S=L.get(g)).shadowBias=M.bias,S.shadowRadius=M.radius,S.shadowMapSize=M.mapSize,R.spotShadow[l]=S,R.spotShadowMap[l]=b,R.spotShadowMatrix[l]=g.shadow.matrix,f++}R.spot[l]=T,l++}else if(g.isRectAreaLight){(T=A.get(g)).color.copy(y).multiplyScalar(_),T.position.setFromMatrixPosition(g.matrixWorld),T.position.applyMatrix4(m),I.identity(),C.copy(g.matrixWorld),C.premultiply(m),I.extractRotation(C),T.halfWidth.set(.5*g.width,0,0),T.halfHeight.set(0,.5*g.height,0),T.halfWidth.applyMatrix4(I),T.halfHeight.applyMatrix4(I),R.rectArea[u]=T,u++}else if(g.isPointLight){if((T=A.get(g)).position.setFromMatrixPosition(g.matrixWorld),T.position.applyMatrix4(m),T.color.copy(g.color).multiplyScalar(g.intensity),T.distance=g.distance,T.decay=g.decay,g.castShadow){var S;M=g.shadow;(S=L.get(g)).shadowBias=M.bias,S.shadowRadius=M.radius,S.shadowMapSize=M.mapSize,S.shadowCameraNear=M.camera.near,S.shadowCameraFar=M.camera.far,R.pointShadow[c]=S,R.pointShadowMap[c]=b,R.pointShadowMatrix[c]=g.shadow.matrix,p++}R.point[c]=T,c++}else if(g.isHemisphereLight){var T;(T=A.get(g)).direction.setFromMatrixPosition(g.matrixWorld),T.direction.transformDirection(m),T.direction.normalize(),T.skyColor.copy(g.color).multiplyScalar(_),T.groundColor.copy(g.groundColor).multiplyScalar(_),R.hemi[h]=T,h++}}R.ambient[0]=i,R.ambient[1]=r,R.ambient[2]=a;var E=R.hash;E.directionalLength===s&&E.pointLength===c&&E.spotLength===l&&E.rectAreaLength===u&&E.hemiLength===h&&E.numDirectionalShadows===d&&E.numPointShadows===p&&E.numSpotShadows===f||(R.directional.length=s,R.spot.length=l,R.rectArea.length=u,R.point.length=c,R.hemi.length=h,R.directionalShadow.length=d,R.directionalShadowMap.length=d,R.pointShadow.length=p,R.pointShadowMap.length=p,R.spotShadow.length=f,R.spotShadowMap.length=f,R.directionalShadowMatrix.length=d,R.pointShadowMatrix.length=p,R.spotShadowMatrix.length=f,E.directionalLength=s,E.pointLength=c,E.spotLength=l,E.rectAreaLength=u,E.hemiLength=h,E.numDirectionalShadows=d,E.numPointShadows=p,E.numSpotShadows=f,R.version=Uo++)},state:R}}function Ho(){var t=new Go,n=[],i=[];return{init:function(){n.length=0,i.length=0},state:{lightsArray:n,shadowsArray:i,lights:t},setupLights:function(e){t.setup(n,i,e)},pushLight:function(e){n.push(e)},pushShadow:function(e){i.push(e)}}}function ko(){var i=new WeakMap;function r(e){var t=e.target;t.removeEventListener("dispose",r),i.delete(t)}return{get:function(e,t){var n;return!1===i.has(e)?(n=new Ho,i.set(e,new WeakMap),i.get(e).set(t,n),e.addEventListener("dispose",r)):!1===i.get(e).has(t)?(n=new Ho,i.get(e).set(t,n)):n=i.get(e).get(t),n},dispose:function(){i=new WeakMap}}}function Vo(e){Gi.call(this),this.type="MeshDepthMaterial",this.depthPacking=qt,this.skinning=!1,this.morphTargets=!1,this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.wireframe=!1,this.wireframeLinewidth=1,this.fog=!1,this.setValues(e)}function jo(e){Gi.call(this),this.type="MeshDistanceMaterial",this.referencePosition=new gn,this.nearDistance=1,this.farDistance=1e3,this.skinning=!1,this.morphTargets=!1,this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.fog=!1,this.setValues(e)}((Vo.prototype=Object.create(Gi.prototype)).constructor=Vo).prototype.isMeshDepthMaterial=!0,Vo.prototype.copy=function(e){return Gi.prototype.copy.call(this,e),this.depthPacking=e.depthPacking,this.skinning=e.skinning,this.morphTargets=e.morphTargets,this.map=e.map,this.alphaMap=e.alphaMap,this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this},((jo.prototype=Object.create(Gi.prototype)).constructor=jo).prototype.isMeshDistanceMaterial=!0,jo.prototype.copy=function(e){return Gi.prototype.copy.call(this,e),this.referencePosition.copy(e.referencePosition),this.nearDistance=e.nearDistance,this.farDistance=e.farDistance,this.skinning=e.skinning,this.morphTargets=e.morphTargets,this.map=e.map,this.alphaMap=e.alphaMap,this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this};var Wo="uniform sampler2D shadow_pass;\nuniform vec2 resolution;\nuniform float radius;\n#include <packing>\nvoid main() {\n float mean = 0.0;\n float squared_mean = 0.0;\n\tfloat depth = unpackRGBAToDepth( texture2D( shadow_pass, ( gl_FragCoord.xy ) / resolution ) );\n for ( float i = -1.0; i < 1.0 ; i += SAMPLE_RATE) {\n #ifdef HORIZONAL_PASS\n vec2 distribution = unpackRGBATo2Half( texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( i, 0.0 ) * radius ) / resolution ) );\n mean += distribution.x;\n squared_mean += distribution.y * distribution.y + distribution.x * distribution.x;\n #else\n float depth = unpackRGBAToDepth( texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( 0.0, i ) * radius ) / resolution ) );\n mean += depth;\n squared_mean += depth * depth;\n #endif\n }\n mean = mean * HALF_SAMPLE_RATE;\n squared_mean = squared_mean * HALF_SAMPLE_RATE;\n float std_dev = sqrt( squared_mean - mean * mean );\n gl_FragColor = pack2HalfToRGBA( vec2( mean, std_dev ) );\n}",qo="void main() {\n\tgl_Position = vec4( position, 1.0 );\n}";function Xo(v,g,y){var _=new Zr,x=new on,b=new on,w=new hn,a=[],o=[],M={},S={0:Me,1:ee,2:te},i=new Hr({defines:{SAMPLE_RATE:.25,HALF_SAMPLE_RATE:1/8},uniforms:{shadow_pass:{value:null},resolution:{value:new on},radius:{value:4}},vertexShader:qo,fragmentShader:Wo}),r=i.clone();r.defines.HORIZONAL_PASS=1;var e=new cr;e.setAttribute("position",new Vi(new Float32Array([-1,-1,.5,3,-1,.5,-1,3,.5]),3));var s=new Er(e,i),T=this;function E(e,t){var n=g.update(s);i.uniforms.shadow_pass.value=e.map.texture,i.uniforms.resolution.value=e.mapSize,i.uniforms.radius.value=e.radius,v.setRenderTarget(e.mapPass),v.clear(),v.renderBufferDirect(t,null,n,i,s,null),r.uniforms.shadow_pass.value=e.mapPass.texture,r.uniforms.resolution.value=e.mapSize,r.uniforms.radius.value=e.radius,v.setRenderTarget(e.map),v.clear(),v.renderBufferDirect(t,null,n,r,s,null)}function A(e,t,n){var i=e<<0|t<<1|n<<2,r=a[i];return void 0===r&&(r=new Vo({depthPacking:Xt,morphTargets:e,skinning:t}),a[i]=r),r}function L(e,t,n){var i=e<<0|t<<1|n<<2,r=o[i];return void 0===r&&(r=new jo({morphTargets:e,skinning:t}),o[i]=r),r}function R(e,t,n,i,r,a,o){var s=null,c=A,l=e.customDepthMaterial;if(!0===i.isPointLight&&(c=L,l=e.customDistanceMaterial),void 0===l){var u=!1;!0===n.morphTargets&&(u=t.morphAttributes&&t.morphAttributes.position&&0<t.morphAttributes.position.length);var h=!1;!0===e.isSkinnedMesh&&(!0===n.skinning?h=!0:console.warn("THREE.WebGLShadowMap: THREE.SkinnedMesh with material.skinning set to false:",e)),s=c(u,h,!0===e.isInstancedMesh)}else s=l;if(v.localClippingEnabled&&!0===n.clipShadows&&0!==n.clippingPlanes.length){var d=s.uuid,p=n.uuid,f=M[d];void 0===f&&(f={},M[d]=f);var m=f[p];void 0===m&&(m=s.clone(),f[p]=m),s=m}return s.visible=n.visible,s.wireframe=n.wireframe,s.side=o===B?null!==n.shadowSide?n.shadowSide:n.side:null!==n.shadowSide?n.shadowSide:S[n.side],s.clipShadows=n.clipShadows,s.clippingPlanes=n.clippingPlanes,s.clipIntersection=n.clipIntersection,s.wireframeLinewidth=n.wireframeLinewidth,s.linewidth=n.linewidth,!0===i.isPointLight&&!0===s.isMeshDistanceMaterial&&(s.referencePosition.setFromMatrixPosition(i.matrixWorld),s.nearDistance=r,s.farDistance=a),s}function P(e,t,n,i,r){if(!1!==e.visible){if(e.layers.test(t.layers)&&(e.isMesh||e.isLine||e.isPoints)&&(e.castShadow||e.receiveShadow&&r===B)&&(!e.frustumCulled||_.intersectsObject(e))){e.modelViewMatrix.multiplyMatrices(n.matrixWorldInverse,e.matrixWorld);var a=g.update(e),o=e.material;if(Array.isArray(o))for(var s=a.groups,c=0,l=s.length;c<l;c++){var u=s[c],h=o[u.materialIndex];if(h&&h.visible){var d=R(e,a,h,i,n.near,n.far,r);v.renderBufferDirect(n,null,a,d,e,u)}}else if(o.visible){d=R(e,a,o,i,n.near,n.far,r);v.renderBufferDirect(n,null,a,d,e,null)}}for(var p=e.children,f=0,m=p.length;f<m;f++)P(p[f],t,n,i,r)}}this.enabled=!1,this.autoUpdate=!0,this.needsUpdate=!1,this.type=z,this.render=function(e,t,n){if(!1!==T.enabled&&(!1!==T.autoUpdate||!1!==T.needsUpdate)&&0!==e.length){var i=v.getRenderTarget(),r=v.getActiveCubeFace(),a=v.getActiveMipmapLevel(),o=v.state;o.setBlending(ne),o.buffers.color.setClear(1,1,1,1),o.buffers.depth.setTest(!0),o.setScissorTest(!1);for(var s=0,c=e.length;s<c;s++){var l=e[s],u=l.shadow;if(void 0!==u){x.copy(u.mapSize);var h=u.getFrameExtents();if(x.multiply(h),b.copy(u.mapSize),(x.x>y||x.y>y)&&(x.x>y&&(b.x=Math.floor(y/h.x),x.x=b.x*h.x,u.mapSize.x=b.x),x.y>y&&(b.y=Math.floor(y/h.y),x.y=b.y*h.y,u.mapSize.y=b.y)),null===u.map&&!u.isPointLightShadow&&this.type===B){var d={minFilter:We,magFilter:We,format:tt};u.map=new dn(x.x,x.y,d),u.map.texture.name=l.name+".shadowMap",u.mapPass=new dn(x.x,x.y,d),u.camera.updateProjectionMatrix()}if(null===u.map){d={minFilter:ke,magFilter:ke,format:tt};u.map=new dn(x.x,x.y,d),u.map.texture.name=l.name+".shadowMap",u.camera.updateProjectionMatrix()}v.setRenderTarget(u.map),v.clear();for(var p=u.getViewportCount(),f=0;f<p;f++){var m=u.getViewport(f);w.set(b.x*m.x,b.y*m.y,b.x*m.z,b.y*m.w),o.viewport(w),u.updateMatrices(l,f),_=u.getFrustum(),P(t,n,u.camera,l,this.type)}u.isPointLightShadow||this.type!==B||E(u,n)}else console.warn("THREE.WebGLShadowMap:",l,"has no shadow.")}T.needsUpdate=!1,v.setRenderTarget(i,r,a)}}}function Yo(u,n,e){var t,i,o=e.isWebGL2;var r=new function(){var t=!1,a=new hn,n=null,o=new hn(0,0,0,0);return{setMask:function(e){n===e||t||(u.colorMask(e,e,e,e),n=e)},setLocked:function(e){t=e},setClear:function(e,t,n,i,r){!0===r&&(e*=i,t*=i,n*=i),a.set(e,t,n,i),!1===o.equals(a)&&(u.clearColor(e,t,n,i),o.copy(a))},reset:function(){t=!1,n=null,o.set(-1,0,0,0)}}},a=new function(){var t=!1,n=null,i=null,r=null;return{setTest:function(e){(e?G:H)(2929)},setMask:function(e){n===e||t||(u.depthMask(e),n=e)},setFunc:function(e){if(i!==e){if(e)switch(e){case Te:u.depthFunc(512);break;case Ee:u.depthFunc(519);break;case Ae:u.depthFunc(513);break;case Le:u.depthFunc(515);break;case Re:u.depthFunc(514);break;case Pe:u.depthFunc(518);break;case Ce:u.depthFunc(516);break;case Ie:u.depthFunc(517);break;default:u.depthFunc(515)}else u.depthFunc(515);i=e}},setLocked:function(e){t=e},setClear:function(e){r!==e&&(u.clearDepth(e),r=e)},reset:function(){t=!1,r=i=n=null}}},s=new function(){var t=!1,n=null,i=null,r=null,a=null,o=null,s=null,c=null,l=null;return{setTest:function(e){t||(e?G:H)(2960)},setMask:function(e){n===e||t||(u.stencilMask(e),n=e)},setFunc:function(e,t,n){i===e&&r===t&&a===n||(u.stencilFunc(e,t,n),i=e,r=t,a=n)},setOp:function(e,t,n){o===e&&s===t&&c===n||(u.stencilOp(e,t,n),o=e,s=t,c=n)},setLocked:function(e){t=e},setClear:function(e){l!==e&&(u.clearStencil(e),l=e)},reset:function(){t=!1,l=c=s=o=a=r=i=n=null}}},c=u.getParameter(34921),l=new Uint8Array(c),h=new Uint8Array(c),d=new Uint8Array(c),p={},f=null,m=null,v=null,g=null,y=null,_=null,x=null,b=null,w=null,M=!1,S=null,T=null,E=null,A=null,L=null,R=u.getParameter(35661),P=!1,C=0,I=u.getParameter(7938);-1!==I.indexOf("WebGL")?(C=parseFloat(/^WebGL\ ([0-9])/.exec(I)[1]),P=1<=C):-1!==I.indexOf("OpenGL ES")&&(C=parseFloat(/^OpenGL\ ES\ ([0-9])/.exec(I)[1]),P=2<=C);var O=null,D={},N=new hn,F=new hn;function z(e,t,n){var i=new Uint8Array(4),r=u.createTexture();u.bindTexture(e,r),u.texParameteri(e,10241,9728),u.texParameteri(e,10240,9728);for(var a=0;a<n;a++)u.texImage2D(t+a,0,6408,1,1,0,6408,5121,i);return r}var U={};function B(e,t){l[e]=1,0===h[e]&&(u.enableVertexAttribArray(e),h[e]=1),d[e]!==t&&((o?u:n.get("ANGLE_instanced_arrays"))[o?"vertexAttribDivisor":"vertexAttribDivisorANGLE"](e,t),d[e]=t)}function G(e){!0!==p[e]&&(u.enable(e),p[e]=!0)}function H(e){!1!==p[e]&&(u.disable(e),p[e]=!1)}U[3553]=z(3553,3553,1),U[34067]=z(34067,34069,6),r.setClear(0,0,0,1),a.setClear(1),s.setClear(0),G(2929),a.setFunc(Le),q(!1),X(Q),G(2884),W(ne);var k=((t={})[ce]=32774,t[le]=32778,t[ue]=32779,t);if(o)k[he]=32775,k[de]=32776;else{var V=n.get("EXT_blend_minmax");null!==V&&(k[he]=V.MIN_EXT,k[de]=V.MAX_EXT)}var j=((i={})[pe]=0,i[fe]=1,i[me]=768,i[ge]=770,i[Se]=776,i[be]=774,i[_e]=772,i[ve]=769,i[ye]=771,i[we]=775,i[xe]=773,i);function W(e,t,n,i,r,a,o,s){if(e!==ne){if(m||(G(3042),m=!0),e===se)r=r||t,a=a||n,o=o||i,t===g&&r===x||(u.blendEquationSeparate(k[t],k[r]),g=t,x=r),n===y&&i===_&&a===b&&o===w||(u.blendFuncSeparate(j[n],j[i],j[a],j[o]),y=n,_=i,b=a,w=o),v=e,M=null;else if(e!==v||s!==M){if(g===ce&&x===ce||(u.blendEquation(32774),x=g=ce),s)switch(e){case ie:u.blendFuncSeparate(1,771,1,771);break;case re:u.blendFunc(1,1);break;case ae:u.blendFuncSeparate(0,0,769,771);break;case oe:u.blendFuncSeparate(0,768,0,770);break;default:console.error("THREE.WebGLState: Invalid blending: ",e)}else switch(e){case ie:u.blendFuncSeparate(770,771,1,771);break;case re:u.blendFunc(770,1);break;case ae:u.blendFunc(0,769);break;case oe:u.blendFunc(0,768);break;default:console.error("THREE.WebGLState: Invalid blending: ",e)}w=b=_=y=null,v=e,M=s}}else m&&(H(3042),m=!1)}function q(e){S!==e&&(e?u.frontFace(2304):u.frontFace(2305),S=e)}function X(e){e!==K?(G(2884),e!==T&&(e===Q?u.cullFace(1029):e===$?u.cullFace(1028):u.cullFace(1032))):H(2884),T=e}function Y(e,t,n){e?(G(32823),A===t&&L===n||(u.polygonOffset(t,n),A=t,L=n)):H(32823)}function Z(e){void 0===e&&(e=33984+R-1),O!==e&&(u.activeTexture(e),O=e)}return{buffers:{color:r,depth:a,stencil:s},initAttributes:function(){for(var e=0,t=l.length;e<t;e++)l[e]=0},enableAttribute:function(e){B(e,0)},enableAttributeAndDivisor:B,disableUnusedAttributes:function(){for(var e=0,t=h.length;e!==t;++e)h[e]!==l[e]&&(u.disableVertexAttribArray(e),h[e]=0)},vertexAttribPointer:function(e,t,n,i,r,a){!0!==o||5124!==n&&5125!==n?u.vertexAttribPointer(e,t,n,i,r,a):u.vertexAttribIPointer(e,t,n,i,r,a)},enable:G,disable:H,useProgram:function(e){return f!==e&&(u.useProgram(e),f=e,!0)},setBlending:W,setMaterial:function(e,t){(e.side===te?H:G)(2884);var n=e.side===Me;t&&(n=!n),q(n),e.blending===ie&&!1===e.transparent?W(ne):W(e.blending,e.blendEquation,e.blendSrc,e.blendDst,e.blendEquationAlpha,e.blendSrcAlpha,e.blendDstAlpha,e.premultipliedAlpha),a.setFunc(e.depthFunc),a.setTest(e.depthTest),a.setMask(e.depthWrite),r.setMask(e.colorWrite);var i=e.stencilWrite;s.setTest(i),i&&(s.setMask(e.stencilWriteMask),s.setFunc(e.stencilFunc,e.stencilRef,e.stencilFuncMask),s.setOp(e.stencilFail,e.stencilZFail,e.stencilZPass)),Y(e.polygonOffset,e.polygonOffsetFactor,e.polygonOffsetUnits)},setFlipSided:q,setCullFace:X,setLineWidth:function(e){e!==E&&(P&&u.lineWidth(e),E=e)},setPolygonOffset:Y,setScissorTest:function(e){(e?G:H)(3089)},activeTexture:Z,bindTexture:function(e,t){null===O&&Z();var n=D[O];void 0===n&&(n={type:void 0,texture:void 0},D[O]=n),n.type===e&&n.texture===t||(u.bindTexture(e,t||U[e]),n.type=e,n.texture=t)},unbindTexture:function(){var e=D[O];void 0!==e&&void 0!==e.type&&(u.bindTexture(e.type,null),e.type=void 0,e.texture=void 0)},compressedTexImage2D:function(){try{u.compressedTexImage2D.apply(u,arguments)}catch(e){console.error("THREE.WebGLState:",e)}},texImage2D:function(){try{u.texImage2D.apply(u,arguments)}catch(e){console.error("THREE.WebGLState:",e)}},texImage3D:function(){try{u.texImage3D.apply(u,arguments)}catch(e){console.error("THREE.WebGLState:",e)}},scissor:function(e){!1===N.equals(e)&&(u.scissor(e.x,e.y,e.z,e.w),N.copy(e))},viewport:function(e){!1===F.equals(e)&&(u.viewport(e.x,e.y,e.z,e.w),F.copy(e))},reset:function(){for(var e=0;e<h.length;e++)1===h[e]&&(u.disableVertexAttribArray(e),h[e]=0);p={},D={},T=S=v=f=O=null,r.reset(),a.reset(),s.reset()}}}function Zo(v,r,g,y,a,_,h){var e,t,l,x=a.isWebGL2,n=a.maxTextures,b=a.maxCubemapSize,m=a.maxTextureSize,i=a.maxSamples,o=new WeakMap,s=!1;try{s="undefined"!=typeof OffscreenCanvas&&null!==new OffscreenCanvas(1,1).getContext("2d")}catch(e){}function u(e,t){return s?new OffscreenCanvas(e,t):document.createElementNS("http://www.w3.org/1999/xhtml","canvas")}function w(e,t,n,i){var r=1;if((e.width>i||e.height>i)&&(r=i/Math.max(e.width,e.height)),r<1||!0===t){if("undefined"!=typeof HTMLImageElement&&e instanceof HTMLImageElement||"undefined"!=typeof HTMLCanvasElement&&e instanceof HTMLCanvasElement||"undefined"!=typeof ImageBitmap&&e instanceof ImageBitmap){var a=t?an.floorPowerOfTwo:Math.floor,o=a(r*e.width),s=a(r*e.height);void 0===l&&(l=u(o,s));var c=n?u(o,s):l;return c.width=o,c.height=s,c.getContext("2d").drawImage(e,0,0,o,s),console.warn("THREE.WebGLRenderer: Texture has been resized from ("+e.width+"x"+e.height+") to ("+o+"x"+s+")."),c}return"data"in e&&console.warn("THREE.WebGLRenderer: Image in DataTexture is too big ("+e.width+"x"+e.height+")."),e}return e}function M(e){return an.isPowerOfTwo(e.width)&&an.isPowerOfTwo(e.height)}function S(e,t){return e.generateMipmaps&&t&&e.minFilter!==ke&&e.minFilter!==We}function T(e,t,n,i){v.generateMipmap(e),y.get(t).__maxMipLevel=Math.log(Math.max(n,i))*Math.LOG2E}function E(e,t,n){if(!1===x)return t;if(null!==e){if(void 0!==v[e])return v[e];console.warn("THREE.WebGLRenderer: Attempt to use non-existing WebGL internal format '"+e+"'")}var i=t;return 6403===t&&(5126===n&&(i=33326),5131===n&&(i=33325),5121===n&&(i=33321)),6407===t&&(5126===n&&(i=34837),5131===n&&(i=34843),5121===n&&(i=32849)),6408===t&&(5126===n&&(i=34836),5131===n&&(i=34842),5121===n&&(i=32856)),33325!==i&&33326!==i&&34842!==i&&34836!==i||r.get("EXT_color_buffer_float"),i}function c(e){return e===ke||e===Ve||e===je?9728:9729}function d(e){var t=e.target;t.removeEventListener("dispose",d),function(e){var t=y.get(e);if(void 0===t.__webglInit)return;v.deleteTexture(t.__webglTexture),y.remove(e)}(t),t.isVideoTexture&&o.delete(t),h.memory.textures--}function p(e){var t=e.target;t.removeEventListener("dispose",p),function(e){var t=y.get(e),n=y.get(e.texture);if(!e)return;void 0!==n.__webglTexture&&v.deleteTexture(n.__webglTexture);e.depthTexture&&e.depthTexture.dispose();if(e.isWebGLCubeRenderTarget)for(var i=0;i<6;i++)v.deleteFramebuffer(t.__webglFramebuffer[i]),t.__webglDepthbuffer&&v.deleteRenderbuffer(t.__webglDepthbuffer[i]);else v.deleteFramebuffer(t.__webglFramebuffer),t.__webglDepthbuffer&&v.deleteRenderbuffer(t.__webglDepthbuffer),t.__webglMultisampledFramebuffer&&v.deleteFramebuffer(t.__webglMultisampledFramebuffer),t.__webglColorRenderbuffer&&v.deleteRenderbuffer(t.__webglColorRenderbuffer),t.__webglDepthRenderbuffer&&v.deleteRenderbuffer(t.__webglDepthRenderbuffer);y.remove(e.texture),y.remove(e)}(t),h.memory.textures--}var f=0;function A(e,t){var n,i,r=y.get(e);if(e.isVideoTexture&&(n=e,i=h.render.frame,o.get(n)!==i&&(o.set(n,i),n.update())),0<e.version&&r.__version!==e.version){var a=e.image;if(void 0===a)console.warn("THREE.WebGLRenderer: Texture marked for update but image is undefined");else{if(!1!==a.complete)return void D(r,e,t);console.warn("THREE.WebGLRenderer: Texture marked for update but image is incomplete")}}g.activeTexture(33984+t),g.bindTexture(3553,r.__webglTexture)}function L(e,t){if(6===e.image.length){var n=y.get(e);if(0<e.version&&n.__version!==e.version){O(n,e),g.activeTexture(33984+t),g.bindTexture(34067,n.__webglTexture),v.pixelStorei(37440,e.flipY);for(var i=e&&(e.isCompressedTexture||e.image[0].isCompressedTexture),r=e.image[0]&&e.image[0].isDataTexture,a=[],o=0;o<6;o++)a[o]=i||r?r?e.image[o].image:e.image[o]:w(e.image[o],!1,!0,b);var s,c=a[0],l=M(c)||x,u=_.convert(e.format),h=_.convert(e.type),d=E(e.internalFormat,u,h);if(I(34067,e,l),i){for(o=0;o<6;o++){s=a[o].mipmaps;for(var p=0;p<s.length;p++){var f=s[p];e.format!==tt&&e.format!==et?null!==u?g.compressedTexImage2D(34069+o,p,d,f.width,f.height,0,f.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .setTextureCube()"):g.texImage2D(34069+o,p,d,f.width,f.height,0,u,h,f.data)}}n.__maxMipLevel=s.length-1}else{s=e.mipmaps;for(o=0;o<6;o++)if(r){g.texImage2D(34069+o,0,d,a[o].width,a[o].height,0,u,h,a[o].data);for(p=0;p<s.length;p++){var m=(f=s[p]).image[o].image;g.texImage2D(34069+o,p+1,d,m.width,m.height,0,u,h,m.data)}}else{g.texImage2D(34069+o,0,d,u,h,a[o]);for(p=0;p<s.length;p++){f=s[p];g.texImage2D(34069+o,p+1,d,u,h,f.image[o])}}n.__maxMipLevel=s.length}S(e,l)&&T(34067,e,c.width,c.height),n.__version=e.version,e.onUpdate&&e.onUpdate(e)}else g.activeTexture(33984+t),g.bindTexture(34067,n.__webglTexture)}}function R(e,t){g.activeTexture(33984+t),g.bindTexture(34067,y.get(e).__webglTexture)}var P=((e={})[Be]=10497,e[Ge]=33071,e[He]=33648,e),C=((t={})[ke]=9728,t[Ve]=9984,t[je]=9986,t[We]=9729,t[qe]=9985,t[Xe]=9987,t);function I(e,t,n){n?(v.texParameteri(e,10242,P[t.wrapS]),v.texParameteri(e,10243,P[t.wrapT]),32879!==e&&35866!==e||v.texParameteri(e,32882,P[t.wrapR]),v.texParameteri(e,10240,C[t.magFilter]),v.texParameteri(e,10241,C[t.minFilter])):(v.texParameteri(e,10242,33071),v.texParameteri(e,10243,33071),32879!==e&&35866!==e||v.texParameteri(e,32882,33071),t.wrapS===Ge&&t.wrapT===Ge||console.warn("THREE.WebGLRenderer: Texture is not power of two. Texture.wrapS and Texture.wrapT should be set to THREE.ClampToEdgeWrapping."),v.texParameteri(e,10240,c(t.magFilter)),v.texParameteri(e,10241,c(t.minFilter)),t.minFilter!==ke&&t.minFilter!==We&&console.warn("THREE.WebGLRenderer: Texture is not power of two. Texture.minFilter should be set to THREE.NearestFilter or THREE.LinearFilter."));var i=r.get("EXT_texture_filter_anisotropic");if(i){if(t.type===Ke&&null===r.get("OES_texture_float_linear"))return;if(t.type===Qe&&null===(x||r.get("OES_texture_half_float_linear")))return;(1<t.anisotropy||y.get(t).__currentAnisotropy)&&(v.texParameterf(e,i.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(t.anisotropy,a.getMaxAnisotropy())),y.get(t).__currentAnisotropy=t.anisotropy)}}function O(e,t){void 0===e.__webglInit&&(e.__webglInit=!0,t.addEventListener("dispose",d),e.__webglTexture=v.createTexture(),h.memory.textures++)}function D(e,t,n){var i=3553;t.isDataTexture2DArray&&(i=35866),t.isDataTexture3D&&(i=32879),O(e,t),g.activeTexture(33984+n),g.bindTexture(i,e.__webglTexture),v.pixelStorei(37440,t.flipY),v.pixelStorei(37441,t.premultiplyAlpha),v.pixelStorei(3317,t.unpackAlignment);var r,a=(r=t,!x&&(r.wrapS!==Ge||r.wrapT!==Ge||r.minFilter!==ke&&r.minFilter!==We)&&!1===M(t.image)),o=w(t.image,a,!1,m),s=M(o)||x,c=_.convert(t.format),l=_.convert(t.type),u=E(t.internalFormat,c,l);I(i,t,s);var h,d=t.mipmaps;if(t.isDepthTexture)u=6402,x?u=t.type===Ke?36012:t.type===Je?33190:t.type===$e?35056:33189:t.type===Ke&&console.error("WebGLRenderer: Floating point depth texture requires WebGL2."),t.format===nt&&6402===u&&t.type!==Ze&&t.type!==Je&&(console.warn("THREE.WebGLRenderer: Use UnsignedShortType or UnsignedIntType for DepthFormat DepthTexture."),t.type=Ze,l=_.convert(t.type)),t.format===it&&6402===u&&(u=34041,t.type!==$e&&(console.warn("THREE.WebGLRenderer: Use UnsignedInt248Type for DepthStencilFormat DepthTexture."),t.type=$e,l=_.convert(t.type))),g.texImage2D(3553,0,u,o.width,o.height,0,c,l,null);else if(t.isDataTexture)if(0<d.length&&s){for(var p=0,f=d.length;p<f;p++)h=d[p],g.texImage2D(3553,p,u,h.width,h.height,0,c,l,h.data);t.generateMipmaps=!1,e.__maxMipLevel=d.length-1}else g.texImage2D(3553,0,u,o.width,o.height,0,c,l,o.data),e.__maxMipLevel=0;else if(t.isCompressedTexture){for(p=0,f=d.length;p<f;p++)h=d[p],t.format!==tt&&t.format!==et?null!==c?g.compressedTexImage2D(3553,p,u,h.width,h.height,0,h.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()"):g.texImage2D(3553,p,u,h.width,h.height,0,c,l,h.data);e.__maxMipLevel=d.length-1}else if(t.isDataTexture2DArray)g.texImage3D(35866,0,u,o.width,o.height,o.depth,0,c,l,o.data),e.__maxMipLevel=0;else if(t.isDataTexture3D)g.texImage3D(32879,0,u,o.width,o.height,o.depth,0,c,l,o.data),e.__maxMipLevel=0;else if(0<d.length&&s){for(p=0,f=d.length;p<f;p++)h=d[p],g.texImage2D(3553,p,u,c,l,h);t.generateMipmaps=!1,e.__maxMipLevel=d.length-1}else g.texImage2D(3553,0,u,c,l,o),e.__maxMipLevel=0;S(t,s)&&T(i,t,o.width,o.height),e.__version=t.version,t.onUpdate&&t.onUpdate(t)}function N(e,t,n,i){var r=_.convert(t.texture.format),a=_.convert(t.texture.type),o=E(t.texture.internalFormat,r,a);g.texImage2D(i,0,o,t.width,t.height,0,r,a,null),v.bindFramebuffer(36160,e),v.framebufferTexture2D(36160,n,i,y.get(t.texture).__webglTexture,0),v.bindFramebuffer(36160,null)}function F(e,t,n){if(v.bindRenderbuffer(36161,e),t.depthBuffer&&!t.stencilBuffer){var i=33189;if(n){var r=t.depthTexture;r&&r.isDepthTexture&&(r.type===Ke?i=36012:r.type===Je&&(i=33190));var a=U(t);v.renderbufferStorageMultisample(36161,a,i,t.width,t.height)}else v.renderbufferStorage(36161,i,t.width,t.height);v.framebufferRenderbuffer(36160,36096,36161,e)}else if(t.depthBuffer&&t.stencilBuffer){if(n){a=U(t);v.renderbufferStorageMultisample(36161,a,35056,t.width,t.height)}else v.renderbufferStorage(36161,34041,t.width,t.height);v.framebufferRenderbuffer(36160,33306,36161,e)}else{var o=_.convert(t.texture.format),s=_.convert(t.texture.type);i=E(t.texture.internalFormat,o,s);if(n){a=U(t);v.renderbufferStorageMultisample(36161,a,i,t.width,t.height)}else v.renderbufferStorage(36161,i,t.width,t.height)}v.bindRenderbuffer(36161,null)}function z(e){var t=y.get(e),n=!0===e.isWebGLCubeRenderTarget;if(e.depthTexture){if(n)throw new Error("target.depthTexture not supported in Cube render targets");!function(e,t){if(t&&t.isWebGLCubeRenderTarget)throw new Error("Depth Texture with cube render targets is not supported");if(v.bindFramebuffer(36160,e),!t.depthTexture||!t.depthTexture.isDepthTexture)throw new Error("renderTarget.depthTexture must be an instance of THREE.DepthTexture");y.get(t.depthTexture).__webglTexture&&t.depthTexture.image.width===t.width&&t.depthTexture.image.height===t.height||(t.depthTexture.image.width=t.width,t.depthTexture.image.height=t.height,t.depthTexture.needsUpdate=!0),A(t.depthTexture,0);var n=y.get(t.depthTexture).__webglTexture;if(t.depthTexture.format===nt)v.framebufferTexture2D(36160,36096,3553,n,0);else{if(t.depthTexture.format!==it)throw new Error("Unknown depthTexture format");v.framebufferTexture2D(36160,33306,3553,n,0)}}(t.__webglFramebuffer,e)}else if(n){t.__webglDepthbuffer=[];for(var i=0;i<6;i++)v.bindFramebuffer(36160,t.__webglFramebuffer[i]),t.__webglDepthbuffer[i]=v.createRenderbuffer(),F(t.__webglDepthbuffer[i],e,!1)}else v.bindFramebuffer(36160,t.__webglFramebuffer),t.__webglDepthbuffer=v.createRenderbuffer(),F(t.__webglDepthbuffer,e,!1);v.bindFramebuffer(36160,null)}function U(e){return x&&e.isWebGLMultisampleRenderTarget?Math.min(i,e.samples):0}var B=!1,G=!1;this.allocateTextureUnit=function(){var e=f;return n<=e&&console.warn("THREE.WebGLTextures: Trying to use "+e+" texture units while this GPU supports only "+n),f+=1,e},this.resetTextureUnits=function(){f=0},this.setTexture2D=A,this.setTexture2DArray=function(e,t){var n=y.get(e);0<e.version&&n.__version!==e.version?D(n,e,t):(g.activeTexture(33984+t),g.bindTexture(35866,n.__webglTexture))},this.setTexture3D=function(e,t){var n=y.get(e);0<e.version&&n.__version!==e.version?D(n,e,t):(g.activeTexture(33984+t),g.bindTexture(32879,n.__webglTexture))},this.setTextureCube=L,this.setTextureCubeDynamic=R,this.setupRenderTarget=function(e){var t=y.get(e),n=y.get(e.texture);e.addEventListener("dispose",p),n.__webglTexture=v.createTexture(),h.memory.textures++;var i=!0===e.isWebGLCubeRenderTarget,r=!0===e.isWebGLMultisampleRenderTarget,a=M(e)||x;if(!x||e.texture.format!==et||e.texture.type!==Ke&&e.texture.type!==Qe||(e.texture.format=tt,console.warn("THREE.WebGLRenderer: Rendering to textures with RGB format is not supported. Using RGBA format instead.")),i){t.__webglFramebuffer=[];for(var o=0;o<6;o++)t.__webglFramebuffer[o]=v.createFramebuffer()}else if(t.__webglFramebuffer=v.createFramebuffer(),r)if(x){t.__webglMultisampledFramebuffer=v.createFramebuffer(),t.__webglColorRenderbuffer=v.createRenderbuffer(),v.bindRenderbuffer(36161,t.__webglColorRenderbuffer);var s=_.convert(e.texture.format),c=_.convert(e.texture.type),l=E(e.texture.internalFormat,s,c),u=U(e);v.renderbufferStorageMultisample(36161,u,l,e.width,e.height),v.bindFramebuffer(36160,t.__webglMultisampledFramebuffer),v.framebufferRenderbuffer(36160,36064,36161,t.__webglColorRenderbuffer),v.bindRenderbuffer(36161,null),e.depthBuffer&&(t.__webglDepthRenderbuffer=v.createRenderbuffer(),F(t.__webglDepthRenderbuffer,e,!0)),v.bindFramebuffer(36160,null)}else console.warn("THREE.WebGLRenderer: WebGLMultisampleRenderTarget can only be used with WebGL2.");if(i){g.bindTexture(34067,n.__webglTexture),I(34067,e.texture,a);for(o=0;o<6;o++)N(t.__webglFramebuffer[o],e,36064,34069+o);S(e.texture,a)&&T(34067,e.texture,e.width,e.height),g.bindTexture(34067,null)}else g.bindTexture(3553,n.__webglTexture),I(3553,e.texture,a),N(t.__webglFramebuffer,e,36064,3553),S(e.texture,a)&&T(3553,e.texture,e.width,e.height),g.bindTexture(3553,null);e.depthBuffer&&z(e)},this.updateRenderTargetMipmap=function(e){var t=e.texture;if(S(t,M(e)||x)){var n=e.isWebGLCubeRenderTarget?34067:3553,i=y.get(t).__webglTexture;g.bindTexture(n,i),T(n,t,e.width,e.height),g.bindTexture(n,null)}},this.updateMultisampleRenderTarget=function(e){if(e.isWebGLMultisampleRenderTarget)if(x){var t=y.get(e);v.bindFramebuffer(36008,t.__webglMultisampledFramebuffer),v.bindFramebuffer(36009,t.__webglFramebuffer);var n=e.width,i=e.height,r=16384;e.depthBuffer&&(r|=256),e.stencilBuffer&&(r|=1024),v.blitFramebuffer(0,0,n,i,0,0,n,i,r,9728),v.bindFramebuffer(36160,t.__webglMultisampledFramebuffer)}else console.warn("THREE.WebGLRenderer: WebGLMultisampleRenderTarget can only be used with WebGL2.")},this.safeSetTexture2D=function(e,t){e&&e.isWebGLRenderTarget&&(!1===B&&(console.warn("THREE.WebGLTextures.safeSetTexture2D: don't use render targets as textures. Use their .texture property instead."),B=!0),e=e.texture),A(e,t)},this.safeSetTextureCube=function(e,t){e&&e.isWebGLCubeRenderTarget&&(!1===G&&(console.warn("THREE.WebGLTextures.safeSetTextureCube: don't use cube render targets as textures. Use their .texture property instead."),G=!0),e=e.texture),(e&&e.isCubeTexture||Array.isArray(e.image)&&6===e.image.length?L:R)(e,t)}}function Jo(e,n,t){var i=t.isWebGL2;return{convert:function(e){var t;if(e===Ye)return 5121;if(e===h)return 32819;if(e===d)return 32820;if(e===f)return 33635;if(e===c)return 5120;if(e===l)return 5122;if(e===Ze)return 5123;if(e===u)return 5124;if(e===Je)return 5125;if(e===Ke)return 5126;if(e===Qe)return i?5131:null!==(t=n.get("OES_texture_half_float"))?t.HALF_FLOAT_OES:null;if(e===m)return 6406;if(e===et)return 6407;if(e===tt)return 6408;if(e===g)return 6409;if(e===y)return 6410;if(e===nt)return 6402;if(e===it)return 34041;if(e===_)return 6403;if(e===x)return 36244;if(e===b)return 33319;if(e===w)return 33320;if(e===M)return 36248;if(e===S)return 36249;if(e===E||e===A||e===L||e===R){if(null===(t=n.get("WEBGL_compressed_texture_s3tc")))return null;if(e===E)return t.COMPRESSED_RGB_S3TC_DXT1_EXT;if(e===A)return t.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(e===L)return t.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(e===R)return t.COMPRESSED_RGBA_S3TC_DXT5_EXT}if(e===P||e===C||e===I||e===O){if(null===(t=n.get("WEBGL_compressed_texture_pvrtc")))return null;if(e===P)return t.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(e===C)return t.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(e===I)return t.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(e===O)return t.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}if(e===D)return null!==(t=n.get("WEBGL_compressed_texture_etc1"))?t.COMPRESSED_RGB_ETC1_WEBGL:null;if((e===N||e===F)&&null!==(t=n.get("WEBGL_compressed_texture_etc"))){if(e===N)return t.COMPRESSED_RGB8_ETC2;if(e===F)return t.COMPRESSED_RGBA8_ETC2_EAC}return e===rt||e===at||e===ot||e===st||e===ct||e===lt||e===ut||e===ht||e===dt||e===pt||e===ft||e===mt||e===vt||e===gt||e===_t||e===xt||e===bt||e===wt||e===Mt||e===St||e===Tt||e===Et||e===At||e===Lt||e===Rt||e===Pt||e===Ct||e===It?null!==(t=n.get("WEBGL_compressed_texture_astc"))?e:null:e===yt?null!==(t=n.get("EXT_texture_compression_bptc"))?e:null:e===$e?i?34042:null!==(t=n.get("WEBGL_depth_texture"))?t.UNSIGNED_INT_24_8_WEBGL:null:void 0}}}function Ko(e){Vr.call(this),this.cameras=e||[]}function Qo(){Vn.call(this),this.type="Group"}function $o(){this._targetRay=null,this._grip=null}function es(d,r){var t=this,p=null,a=1,f=null,o="local-floor",m=null,v=[],s=new Map,c=new Vr;c.layers.enable(1),c.viewport=new hn;var l=new Vr;l.layers.enable(2),l.viewport=new hn;var g=[c,l],y=new Ko;y.layers.enable(1),y.layers.enable(2);var u=null,h=null;function _(e){var t=s.get(e.inputSource);t&&t.dispatchEvent({type:e.type})}function x(){s.forEach(function(e,t){e.disconnect(t)}),s.clear(),d.setFramebuffer(null),d.setRenderTarget(d.getRenderTarget()),n.stop(),t.isPresenting=!1,t.dispatchEvent({type:"sessionend"})}function b(e){f=e,n.setContext(p),n.start(),t.isPresenting=!0,t.dispatchEvent({type:"sessionstart"})}function w(e){for(var t=p.inputSources,n=0;n<v.length;n++)s.set(t[n],v[n]);for(n=0;n<e.removed.length;n++){var i=e.removed[n];(r=s.get(i))&&(r.dispatchEvent({type:"disconnected",data:i}),s.delete(i))}for(n=0;n<e.added.length;n++){var r;i=e.added[n];(r=s.get(i))&&r.dispatchEvent({type:"connected",data:i})}}this.enabled=!1,this.isPresenting=!1,this.getController=function(e){var t=v[e];return void 0===t&&(t=new $o,v[e]=t),t.getTargetRaySpace()},this.getControllerGrip=function(e){var t=v[e];return void 0===t&&(t=new $o,v[e]=t),t.getGripSpace()},this.setFramebufferScaleFactor=function(e){a=e,!0===t.isPresenting&&console.warn("THREE.WebXRManager: Cannot change framebuffer scale while presenting.")},this.setReferenceSpaceType=function(e){o=e,!0===t.isPresenting&&console.warn("THREE.WebXRManager: Cannot change reference space type while presenting.")},this.getReferenceSpace=function(){return f},this.getSession=function(){return p},this.setSession=function(e){if(null!==(p=e)){p.addEventListener("select",_),p.addEventListener("selectstart",_),p.addEventListener("selectend",_),p.addEventListener("squeeze",_),p.addEventListener("squeezestart",_),p.addEventListener("squeezeend",_),p.addEventListener("end",x);var t=r.getContextAttributes(),n={antialias:t.antialias,alpha:t.alpha,depth:t.depth,stencil:t.stencil,framebufferScaleFactor:a},i=new XRWebGLLayer(p,r,n);p.updateRenderState({baseLayer:i}),p.requestReferenceSpace(o).then(b),p.addEventListener("inputsourceschange",w)}};var M=new gn,S=new gn;function T(e,t){null===t?e.matrixWorld.copy(e.matrix):e.matrixWorld.multiplyMatrices(t.matrixWorld,e.matrix),e.matrixWorldInverse.getInverse(e.matrixWorld)}this.getCamera=function(e){y.near=l.near=c.near=e.near,y.far=l.far=c.far=e.far,u===y.near&&h===y.far||(p.updateRenderState({depthNear:y.near,depthFar:y.far}),u=y.near,h=y.far);var t=e.parent,n=y.cameras;T(y,t);for(var i=0;i<n.length;i++)T(n[i],t);e.matrixWorld.copy(y.matrixWorld);for(var r=e.children,a=(i=0,r.length);i<a;i++)r[i].updateMatrixWorld(!0);return 2===n.length?function(e,t,n){M.setFromMatrixPosition(t.matrixWorld),S.setFromMatrixPosition(n.matrixWorld);var i=M.distanceTo(S),r=t.projectionMatrix.elements,a=n.projectionMatrix.elements,o=r[14]/(r[10]-1),s=r[14]/(r[10]+1),c=(r[9]+1)/r[5],l=(r[9]-1)/r[5],u=(r[8]-1)/r[0],h=(a[8]+1)/a[0],d=o*u,p=o*h,f=i/(h-u),m=f*-u;t.matrixWorld.decompose(e.position,e.quaternion,e.scale),e.translateX(m),e.translateZ(f),e.matrixWorld.compose(e.position,e.quaternion,e.scale),e.matrixWorldInverse.getInverse(e.matrixWorld);var v=o+f,g=s+f,y=d-m,_=i-m+p,x=c*s/g*v,b=l*s/g*v;e.projectionMatrix.makePerspective(y,_,x,b,v,g)}(y,c,l):y.projectionMatrix.copy(c.projectionMatrix),y};var E=null;var n=new Kr;n.setAnimationLoop(function(e,t){if(null!==(m=t.getViewerPose(f))){var n=m.views,i=p.renderState.baseLayer;d.setFramebuffer(i.framebuffer);var r=!1;n.length!==y.cameras.length&&(r=!(y.cameras.length=0));for(var a=0;a<n.length;a++){var o=n[a],s=i.getViewport(o),c=g[a];c.matrix.fromArray(o.transform.matrix),c.projectionMatrix.fromArray(o.projectionMatrix),c.viewport.set(s.x,s.y,s.width,s.height),0===a&&y.matrix.copy(c.matrix),!0===r&&y.cameras.push(c)}}var l=p.inputSources;for(a=0;a<v.length;a++){var u=v[a],h=l[a];u.update(h,t,f)}E&&E(e,t)}),this.setAnimationLoop=function(e){E=e},this.dispose=function(){}}function ts(e){var i=void 0!==(e=e||{}).canvas?e.canvas:document.createElementNS("http://www.w3.org/1999/xhtml","canvas"),t=void 0!==e.context?e.context:null,n=void 0!==e.alpha&&e.alpha,r=void 0===e.depth||e.depth,a=void 0===e.stencil||e.stencil,o=void 0!==e.antialias&&e.antialias,s=void 0===e.premultipliedAlpha||e.premultipliedAlpha,c=void 0!==e.preserveDrawingBuffer&&e.preserveDrawingBuffer,l=void 0!==e.powerPreference?e.powerPreference:"default",u=void 0!==e.failIfMajorPerformanceCaveat&&e.failIfMajorPerformanceCaveat,f=null,D=null;this.domElement=i,this.debug={checkShaderErrors:!0},this.autoClear=!0,this.autoClearColor=!0,this.autoClearDepth=!0,this.autoClearStencil=!0,this.sortObjects=!0,this.clippingPlanes=[],this.localClippingEnabled=!1,this.gammaFactor=2,this.outputEncoding=Ut,this.physicallyCorrectLights=!1,this.toneMapping=Oe,this.toneMappingExposure=1,this.toneMappingWhitePoint=1,this.maxMorphTargets=8,this.maxMorphNormals=4;var N,M,F,z,m,U,B,S,T,v,g,h,d,p,E,A,L,y,G=this,_=!1,x=null,b=0,w=0,H=null,R=null,k=-1,P={geometry:null,program:null,wireframe:!1},V=null,C=null,I=new hn,O=new hn,j=null,W=i.width,q=i.height,X=1,Y=null,Z=null,J=new hn(0,0,W,q),K=new hn(0,0,W,q),Q=!1,$=new Zr,ee=new oa,te=!1,ne=!1,ie=new Tn,re=new gn;function ae(){return null===H?X:1}try{var oe={alpha:n,depth:r,stencil:a,antialias:o,premultipliedAlpha:s,preserveDrawingBuffer:c,powerPreference:l,failIfMajorPerformanceCaveat:u,xrCompatible:!0};if(i.addEventListener("webglcontextlost",ue,!1),i.addEventListener("webglcontextrestored",he,!1),null===(N=t||i.getContext("webgl",oe)||i.getContext("experimental-webgl",oe)))throw null!==i.getContext("webgl")?new Error("Error creating WebGL context with your selected attributes."):new Error("Error creating WebGL context.");void 0===N.getShaderPrecisionFormat&&(N.getShaderPrecisionFormat=function(){return{rangeMin:1,rangeMax:1,precision:1}})}catch(e){throw console.error("THREE.WebGLRenderer: "+e.message),e}function se(){M=new sa(N),!1===(F=new aa(N,M,e)).isWebGL2&&(M.get("WEBGL_depth_texture"),M.get("OES_texture_float"),M.get("OES_texture_half_float"),M.get("OES_texture_half_float_linear"),M.get("OES_standard_derivatives"),M.get("OES_element_index_uint"),M.get("ANGLE_instanced_arrays")),M.get("OES_texture_float_linear"),y=new Jo(0,M,F),(z=new Yo(N,M,F)).scissor(O.copy(K).multiplyScalar(X).floor()),z.viewport(I.copy(J).multiplyScalar(X).floor()),m=new ua,U=new Io,B=new Zo(N,M,z,U,F,y,m),S=new Qr(N,F),T=new ca(0,S,m),v=new pa(0,T,S,m),E=new da(N),g=new Co(G,M,F),h=new Fo,d=new ko,p=new ia(G,z,v,s),A=new ra(N,M,m,F),L=new la(N,M,m,F),m.programs=g.programs,G.capabilities=F,G.extensions=M,G.properties=U,G.renderLists=h,G.state=z,G.info=m}se();var ce=new es(G,N);this.xr=ce;var le=new Xo(G,v,F.maxTextureSize);function ue(e){e.preventDefault(),console.log("THREE.WebGLRenderer: Context Lost."),_=!0}function he(){console.log("THREE.WebGLRenderer: Context Restored."),_=!1,se()}function de(e){var t,n=e.target;n.removeEventListener("dispose",de),pe(t=n),U.remove(t)}function pe(e){var t=U.get(e).program;(e.program=void 0)!==t&&g.releaseProgram(t)}this.shadowMap=le,this.getContext=function(){return N},this.getContextAttributes=function(){return N.getContextAttributes()},this.forceContextLoss=function(){var e=M.get("WEBGL_lose_context");e&&e.loseContext()},this.forceContextRestore=function(){var e=M.get("WEBGL_lose_context");e&&e.restoreContext()},this.getPixelRatio=function(){return X},this.setPixelRatio=function(e){void 0!==e&&(X=e,this.setSize(W,q,!1))},this.getSize=function(e){return void 0===e&&(console.warn("WebGLRenderer: .getsize() now requires a Vector2 as an argument"),e=new on),e.set(W,q)},this.setSize=function(e,t,n){ce.isPresenting?console.warn("THREE.WebGLRenderer: Can't change size while VR device is presenting."):(W=e,q=t,i.width=Math.floor(e*X),i.height=Math.floor(t*X),!1!==n&&(i.style.width=e+"px",i.style.height=t+"px"),this.setViewport(0,0,e,t))},this.getDrawingBufferSize=function(e){return void 0===e&&(console.warn("WebGLRenderer: .getdrawingBufferSize() now requires a Vector2 as an argument"),e=new on),e.set(W*X,q*X).floor()},this.setDrawingBufferSize=function(e,t,n){W=e,q=t,X=n,i.width=Math.floor(e*n),i.height=Math.floor(t*n),this.setViewport(0,0,e,t)},this.getCurrentViewport=function(e){return void 0===e&&(console.warn("WebGLRenderer: .getCurrentViewport() now requires a Vector4 as an argument"),e=new hn),e.copy(I)},this.getViewport=function(e){return e.copy(J)},this.setViewport=function(e,t,n,i){e.isVector4?J.set(e.x,e.y,e.z,e.w):J.set(e,t,n,i),z.viewport(I.copy(J).multiplyScalar(X).floor())},this.getScissor=function(e){return e.copy(K)},this.setScissor=function(e,t,n,i){e.isVector4?K.set(e.x,e.y,e.z,e.w):K.set(e,t,n,i),z.scissor(O.copy(K).multiplyScalar(X).floor())},this.getScissorTest=function(){return Q},this.setScissorTest=function(e){z.setScissorTest(Q=e)},this.setOpaqueSort=function(e){Y=e},this.setTransparentSort=function(e){Z=e},this.getClearColor=function(){return p.getClearColor()},this.setClearColor=function(){p.setClearColor.apply(p,arguments)},this.getClearAlpha=function(){return p.getClearAlpha()},this.setClearAlpha=function(){p.setClearAlpha.apply(p,arguments)},this.clear=function(e,t,n){var i=0;void 0!==e&&!e||(i|=16384),void 0!==t&&!t||(i|=256),void 0!==n&&!n||(i|=1024),N.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.dispose=function(){i.removeEventListener("webglcontextlost",ue,!1),i.removeEventListener("webglcontextrestored",he,!1),h.dispose(),d.dispose(),U.dispose(),v.dispose(),ce.dispose(),ve.stop()},this.renderBufferImmediate=function(e,t){z.initAttributes();var n=U.get(e);e.hasPositions&&!n.position&&(n.position=N.createBuffer()),e.hasNormals&&!n.normal&&(n.normal=N.createBuffer()),e.hasUvs&&!n.uv&&(n.uv=N.createBuffer()),e.hasColors&&!n.color&&(n.color=N.createBuffer());var i=t.getAttributes();e.hasPositions&&(N.bindBuffer(34962,n.position),N.bufferData(34962,e.positionArray,35048),z.enableAttribute(i.position),N.vertexAttribPointer(i.position,3,5126,!1,0,0)),e.hasNormals&&(N.bindBuffer(34962,n.normal),N.bufferData(34962,e.normalArray,35048),z.enableAttribute(i.normal),N.vertexAttribPointer(i.normal,3,5126,!1,0,0)),e.hasUvs&&(N.bindBuffer(34962,n.uv),N.bufferData(34962,e.uvArray,35048),z.enableAttribute(i.uv),N.vertexAttribPointer(i.uv,2,5126,!1,0,0)),e.hasColors&&(N.bindBuffer(34962,n.color),N.bufferData(34962,e.colorArray,35048),z.enableAttribute(i.color),N.vertexAttribPointer(i.color,3,5126,!1,0,0)),z.disableUnusedAttributes(),N.drawArrays(4,0,e.count),e.count=0};var fe=new jn;this.renderBufferDirect=function(e,t,n,i,r,a){null===t&&(t=fe);var o=r.isMesh&&r.matrixWorld.determinant()<0,s=xe(e,t,i,r);z.setMaterial(i,o);var c=!1;P.geometry===n.id&&P.program===s.id&&P.wireframe===(!0===i.wireframe)||(P.geometry=n.id,P.program=s.id,P.wireframe=!0===i.wireframe,c=!0),(i.morphTargets||i.morphNormals)&&(E.update(r,n,i,s),c=!0),!0===r.isInstancedMesh&&(c=!0);var l=n.index,u=n.attributes.position;if(null===l){if(void 0===u||0===u.count)return}else if(0===l.count)return;var h,d=1;!0===i.wireframe&&(l=T.getWireframeAttribute(n),d=2);var p=A;null!==l&&(h=S.get(l),(p=L).setIndex(h)),c&&(function(e,t,n,i){if(!1===F.isWebGL2&&(e.isInstancedMesh||t.isInstancedBufferGeometry)&&null===M.get("ANGLE_instanced_arrays"))return;z.initAttributes();var r=t.attributes,a=i.getAttributes(),o=n.defaultAttributeValues;for(var s in a){var c=a[s];if(0<=c){var l=r[s];if(void 0!==l){var u=l.normalized,h=l.itemSize;if(void 0===(y=S.get(l)))continue;var d=y.buffer,p=y.type,f=y.bytesPerElement;if(l.isInterleavedBufferAttribute){var m=l.data,v=m.stride,g=l.offset;m&&m.isInstancedInterleavedBuffer?(z.enableAttributeAndDivisor(c,m.meshPerAttribute),void 0===t.maxInstancedCount&&(t.maxInstancedCount=m.meshPerAttribute*m.count)):z.enableAttribute(c),N.bindBuffer(34962,d),z.vertexAttribPointer(c,h,p,u,v*f,g*f)}else l.isInstancedBufferAttribute?(z.enableAttributeAndDivisor(c,l.meshPerAttribute),void 0===t.maxInstancedCount&&(t.maxInstancedCount=l.meshPerAttribute*l.count)):z.enableAttribute(c),N.bindBuffer(34962,d),z.vertexAttribPointer(c,h,p,u,0,0)}else if("instanceMatrix"===s){var y;if(void 0===(y=S.get(e.instanceMatrix)))continue;d=y.buffer,p=y.type;z.enableAttributeAndDivisor(c+0,1),z.enableAttributeAndDivisor(c+1,1),z.enableAttributeAndDivisor(c+2,1),z.enableAttributeAndDivisor(c+3,1),N.bindBuffer(34962,d),N.vertexAttribPointer(c+0,4,p,!1,64,0),N.vertexAttribPointer(c+1,4,p,!1,64,16),N.vertexAttribPointer(c+2,4,p,!1,64,32),N.vertexAttribPointer(c+3,4,p,!1,64,48)}else if(void 0!==o){var _=o[s];if(void 0!==_)switch(_.length){case 2:N.vertexAttrib2fv(c,_);break;case 3:N.vertexAttrib3fv(c,_);break;case 4:N.vertexAttrib4fv(c,_);break;default:N.vertexAttrib1fv(c,_)}}}}z.disableUnusedAttributes()}(r,n,i,s),null!==l&&N.bindBuffer(34963,h.buffer));var f=null!==l?l.count:u.count,m=n.drawRange.start*d,v=n.drawRange.count*d,g=null!==a?a.start*d:0,y=null!==a?a.count*d:1/0,_=Math.max(m,g),x=Math.min(f,m+v,g+y)-1,b=Math.max(0,x-_+1);if(0!==b){if(r.isMesh)!0===i.wireframe?(z.setLineWidth(i.wireframeLinewidth*ae()),p.setMode(1)):p.setMode(4);else if(r.isLine){var w=i.linewidth;void 0===w&&(w=1),z.setLineWidth(w*ae()),r.isLineSegments?p.setMode(1):r.isLineLoop?p.setMode(2):p.setMode(3)}else r.isPoints?p.setMode(0):r.isSprite&&p.setMode(4);r.isInstancedMesh?p.renderInstances(n,_,b,r.count):n.isInstancedBufferGeometry?p.renderInstances(n,_,b,n.maxInstancedCount):p.render(_,b)}},this.compile=function(n,e){(D=d.get(n,e)).init(),n.traverse(function(e){e.isLight&&(D.pushLight(e),e.castShadow&&D.pushShadow(e))}),D.setupLights(e);var i={};n.traverse(function(e){if(e.material)if(Array.isArray(e.material))for(var t=0;t<e.material.length;t++)e.material[t].uuid in i==!1&&(_e(e.material[t],n,e),i[e.material[t].uuid]=!0);else e.material.uuid in i==!1&&(_e(e.material,n,e),i[e.material.uuid]=!0)})};var me=null;var ve=new Kr;function ge(e,t,n,i){for(var r=0,a=e.length;r<a;r++){var o=e[r],s=o.object,c=o.geometry,l=void 0===i?o.material:i,u=o.group;if(n.isArrayCamera)for(var h=(C=n).cameras,d=0,p=h.length;d<p;d++){var f=h[d];s.layers.test(f.layers)&&(z.viewport(I.copy(f.viewport)),D.setupLights(f),ye(s,t,f,c,l,u))}else C=null,ye(s,t,n,c,l,u)}}function ye(e,t,n,i,r,a){if(e.onBeforeRender(G,t,n,i,r,a),D=d.get(t,C||n),e.modelViewMatrix.multiplyMatrices(n.matrixWorldInverse,e.matrixWorld),e.normalMatrix.getNormalMatrix(e.modelViewMatrix),e.isImmediateRenderObject){var o=xe(n,t,r,e);z.setMaterial(r),P.geometry=null,P.program=null,P.wireframe=!1,s=o,e.render(function(e){G.renderBufferImmediate(e,s)})}else G.renderBufferDirect(n,t,i,r,e,a);var s;e.onAfterRender(G,t,n,i,r,a),D=d.get(t,C||n)}function _e(e,t,n){var i=U.get(e),r=D.state.lights,a=D.state.shadowsArray,o=r.state.version,s=g.getParameters(e,r.state,a,t,ee.numPlanes,ee.numIntersection,n),c=g.getProgramCacheKey(s),l=i.program,u=!0;if(void 0===l)e.addEventListener("dispose",de);else if(l.cacheKey!==c)pe(e);else if(i.lightsStateVersion!==o)i.lightsStateVersion=o,u=!1;else{if(void 0!==s.shaderID)return;u=!1}u&&(l=g.acquireProgram(s,c),i.program=l,i.uniforms=s.uniforms,i.outputEncoding=s.outputEncoding,e.program=l);var h=l.getAttributes();if(e.morphTargets)for(var d=e.numSupportedMorphTargets=0;d<G.maxMorphTargets;d++)0<=h["morphTarget"+d]&&e.numSupportedMorphTargets++;if(e.morphNormals)for(d=e.numSupportedMorphNormals=0;d<G.maxMorphNormals;d++)0<=h["morphNormal"+d]&&e.numSupportedMorphNormals++;var p,f=i.uniforms;(e.isShaderMaterial||e.isRawShaderMaterial)&&!0!==e.clipping||(i.numClippingPlanes=ee.numPlanes,i.numIntersection=ee.numIntersection,f.clippingPlanes=ee.uniform),i.environment=e.isMeshStandardMaterial?t.environment:null,i.fog=t.fog,i.needsLights=(p=e).isMeshLambertMaterial||p.isMeshToonMaterial||p.isMeshPhongMaterial||p.isMeshStandardMaterial||p.isShadowMaterial||p.isShaderMaterial&&!0===p.lights,i.lightsStateVersion=o,i.needsLights&&(f.ambientLightColor.value=r.state.ambient,f.lightProbe.value=r.state.probe,f.directionalLights.value=r.state.directional,f.directionalLightShadows.value=r.state.directionalShadow,f.spotLights.value=r.state.spot,f.spotLightShadows.value=r.state.spotShadow,f.rectAreaLights.value=r.state.rectArea,f.pointLights.value=r.state.point,f.pointLightShadows.value=r.state.pointShadow,f.hemisphereLights.value=r.state.hemi,f.directionalShadowMap.value=r.state.directionalShadowMap,f.directionalShadowMatrix.value=r.state.directionalShadowMatrix,f.spotShadowMap.value=r.state.spotShadowMap,f.spotShadowMatrix.value=r.state.spotShadowMatrix,f.pointShadowMap.value=r.state.pointShadowMap,f.pointShadowMatrix.value=r.state.pointShadowMatrix);var m=i.program.getUniforms(),v=ho.seqWithValue(m.seq,f);i.uniformsList=v}function xe(e,t,n,i){B.resetTextureUnits();var r=t.fog,a=n.isMeshStandardMaterial?t.environment:null,o=null===H?G.outputEncoding:H.texture.encoding,s=U.get(n),c=D.state.lights;if(te&&(ne||e!==V)){var l=e===V&&n.id===k;ee.setState(n.clippingPlanes,n.clipIntersection,n.clipShadows,e,s,l)}n.version===s.__version?(void 0===s.program||n.fog&&s.fog!==r||s.environment!==a||s.needsLights&&s.lightsStateVersion!==c.state.version||void 0!==s.numClippingPlanes&&(s.numClippingPlanes!==ee.numPlanes||s.numIntersection!==ee.numIntersection)||s.outputEncoding!==o)&&_e(n,t,i):(_e(n,t,i),s.__version=n.version);var u,h,d,p,f,m,v,g,y,_,x,b,w=!1,M=!1,S=!1,T=s.program,E=T.getUniforms(),A=s.uniforms;if(z.useProgram(T.program)&&(S=M=w=!0),n.id!==k&&(k=n.id,M=!0),w||V!==e){if(E.setValue(N,"projectionMatrix",e.projectionMatrix),F.logarithmicDepthBuffer&&E.setValue(N,"logDepthBufFC",2/(Math.log(e.far+1)/Math.LN2)),V!==e&&(V=e,S=M=!0),n.isShaderMaterial||n.isMeshPhongMaterial||n.isMeshToonMaterial||n.isMeshStandardMaterial||n.envMap){var L=E.map.cameraPosition;void 0!==L&&L.setValue(N,re.setFromMatrixPosition(e.matrixWorld))}(n.isMeshPhongMaterial||n.isMeshToonMaterial||n.isMeshLambertMaterial||n.isMeshBasicMaterial||n.isMeshStandardMaterial||n.isShaderMaterial)&&E.setValue(N,"isOrthographic",!0===e.isOrthographicCamera),(n.isMeshPhongMaterial||n.isMeshToonMaterial||n.isMeshLambertMaterial||n.isMeshBasicMaterial||n.isMeshStandardMaterial||n.isShaderMaterial||n.skinning)&&E.setValue(N,"viewMatrix",e.matrixWorldInverse)}if(n.skinning){E.setOptional(N,i,"bindMatrix"),E.setOptional(N,i,"bindMatrixInverse");var R=i.skeleton;if(R){var P=R.bones;if(F.floatVertexTextures){if(void 0===R.boneTexture){var C=Math.sqrt(4*P.length);C=an.ceilPowerOfTwo(C),C=Math.max(C,4);var I=new Float32Array(C*C*4);I.set(R.boneMatrices);var O=new qr(I,C,C,tt,Ke);R.boneMatrices=I,R.boneTexture=O,R.boneTextureSize=C}E.setValue(N,"boneTexture",R.boneTexture,B),E.setValue(N,"boneTextureSize",R.boneTextureSize)}else E.setOptional(N,R,"boneMatrices")}}return!M&&s.receiveShadow===i.receiveShadow||(s.receiveShadow=i.receiveShadow,E.setValue(N,"receiveShadow",i.receiveShadow)),M&&(E.setValue(N,"toneMappingExposure",G.toneMappingExposure),E.setValue(N,"toneMappingWhitePoint",G.toneMappingWhitePoint),s.needsLights&&(b=S,(x=A).ambientLightColor.needsUpdate=b,x.lightProbe.needsUpdate=b,x.directionalLights.needsUpdate=b,x.directionalLightShadows.needsUpdate=b,x.pointLights.needsUpdate=b,x.pointLightShadows.needsUpdate=b,x.spotLights.needsUpdate=b,x.spotLightShadows.needsUpdate=b,x.rectAreaLights.needsUpdate=b,x.hemisphereLights.needsUpdate=b),r&&n.fog&&(_=r,(y=A).fogColor.value.copy(_.color),_.isFog?(y.fogNear.value=_.near,y.fogFar.value=_.far):_.isFogExp2&&(y.fogDensity.value=_.density)),n.isMeshBasicMaterial?be(A,n):n.isMeshLambertMaterial?(be(A,n),v=A,(g=n).emissiveMap&&(v.emissiveMap.value=g.emissiveMap)):n.isMeshToonMaterial?(be(A,n),function(e,t){e.specular.value.copy(t.specular),e.shininess.value=Math.max(t.shininess,1e-4),t.gradientMap&&(e.gradientMap.value=t.gradientMap);t.emissiveMap&&(e.emissiveMap.value=t.emissiveMap);t.bumpMap&&(e.bumpMap.value=t.bumpMap,e.bumpScale.value=t.bumpScale,t.side===Me&&(e.bumpScale.value*=-1));t.normalMap&&(e.normalMap.value=t.normalMap,e.normalScale.value.copy(t.normalScale),t.side===Me&&e.normalScale.value.negate());t.displacementMap&&(e.displacementMap.value=t.displacementMap,e.displacementScale.value=t.displacementScale,e.displacementBias.value=t.displacementBias)}(A,n)):n.isMeshPhongMaterial?(be(A,n),function(e,t){e.specular.value.copy(t.specular),e.shininess.value=Math.max(t.shininess,1e-4),t.emissiveMap&&(e.emissiveMap.value=t.emissiveMap);t.bumpMap&&(e.bumpMap.value=t.bumpMap,e.bumpScale.value=t.bumpScale,t.side===Me&&(e.bumpScale.value*=-1));t.normalMap&&(e.normalMap.value=t.normalMap,e.normalScale.value.copy(t.normalScale),t.side===Me&&e.normalScale.value.negate());t.displacementMap&&(e.displacementMap.value=t.displacementMap,e.displacementScale.value=t.displacementScale,e.displacementBias.value=t.displacementBias)}(A,n)):n.isMeshStandardMaterial?(be(A,n,a),(n.isMeshPhysicalMaterial?function(e,t,n){we(e,t,n),e.reflectivity.value=t.reflectivity,e.clearcoat.value=t.clearcoat,e.clearcoatRoughness.value=t.clearcoatRoughness,t.sheen&&e.sheen.value.copy(t.sheen);t.clearcoatMap&&(e.clearcoatMap.value=t.clearcoatMap);t.clearcoatRoughnessMap&&(e.clearcoatRoughnessMap.value=t.clearcoatRoughnessMap);t.clearcoatNormalMap&&(e.clearcoatNormalScale.value.copy(t.clearcoatNormalScale),e.clearcoatNormalMap.value=t.clearcoatNormalMap,t.side===Me&&e.clearcoatNormalScale.value.negate());e.transparency.value=t.transparency}:we)(A,n,a)):n.isMeshMatcapMaterial?(be(A,n),function(e,t){t.matcap&&(e.matcap.value=t.matcap);t.bumpMap&&(e.bumpMap.value=t.bumpMap,e.bumpScale.value=t.bumpScale,t.side===Me&&(e.bumpScale.value*=-1));t.normalMap&&(e.normalMap.value=t.normalMap,e.normalScale.value.copy(t.normalScale),t.side===Me&&e.normalScale.value.negate());t.displacementMap&&(e.displacementMap.value=t.displacementMap,e.displacementScale.value=t.displacementScale,e.displacementBias.value=t.displacementBias)}(A,n)):n.isMeshDepthMaterial?(be(A,n),f=A,(m=n).displacementMap&&(f.displacementMap.value=m.displacementMap,f.displacementScale.value=m.displacementScale,f.displacementBias.value=m.displacementBias)):n.isMeshDistanceMaterial?(be(A,n),function(e,t){t.displacementMap&&(e.displacementMap.value=t.displacementMap,e.displacementScale.value=t.displacementScale,e.displacementBias.value=t.displacementBias);e.referencePosition.value.copy(t.referencePosition),e.nearDistance.value=t.nearDistance,e.farDistance.value=t.farDistance}(A,n)):n.isMeshNormalMaterial?(be(A,n),function(e,t){t.bumpMap&&(e.bumpMap.value=t.bumpMap,e.bumpScale.value=t.bumpScale,t.side===Me&&(e.bumpScale.value*=-1));t.normalMap&&(e.normalMap.value=t.normalMap,e.normalScale.value.copy(t.normalScale),t.side===Me&&e.normalScale.value.negate());t.displacementMap&&(e.displacementMap.value=t.displacementMap,e.displacementScale.value=t.displacementScale,e.displacementBias.value=t.displacementBias)}(A,n)):n.isLineBasicMaterial?(p=n,(d=A).diffuse.value.copy(p.color),d.opacity.value=p.opacity,n.isLineDashedMaterial&&(h=n,(u=A).dashSize.value=h.dashSize,u.totalSize.value=h.dashSize+h.gapSize,u.scale.value=h.scale)):n.isPointsMaterial?function(e,t){e.diffuse.value.copy(t.color),e.opacity.value=t.opacity,e.size.value=t.size*X,e.scale.value=.5*q,t.map&&(e.map.value=t.map);t.alphaMap&&(e.alphaMap.value=t.alphaMap);var n;t.map?n=t.map:t.alphaMap&&(n=t.alphaMap);void 0!==n&&(!0===n.matrixAutoUpdate&&n.updateMatrix(),e.uvTransform.value.copy(n.matrix))}(A,n):n.isSpriteMaterial?function(e,t){e.diffuse.value.copy(t.color),e.opacity.value=t.opacity,e.rotation.value=t.rotation,t.map&&(e.map.value=t.map);t.alphaMap&&(e.alphaMap.value=t.alphaMap);var n;t.map?n=t.map:t.alphaMap&&(n=t.alphaMap);void 0!==n&&(!0===n.matrixAutoUpdate&&n.updateMatrix(),e.uvTransform.value.copy(n.matrix))}(A,n):n.isShadowMaterial&&(A.color.value.copy(n.color),A.opacity.value=n.opacity),void 0!==A.ltc_1&&(A.ltc_1.value=Jr.LTC_1),void 0!==A.ltc_2&&(A.ltc_2.value=Jr.LTC_2),ho.upload(N,s.uniformsList,A,B),n.isShaderMaterial&&(n.uniformsNeedUpdate=!1)),n.isShaderMaterial&&!0===n.uniformsNeedUpdate&&(ho.upload(N,s.uniformsList,A,B),n.uniformsNeedUpdate=!1),n.isSpriteMaterial&&E.setValue(N,"center",i.center),E.setValue(N,"modelViewMatrix",i.modelViewMatrix),E.setValue(N,"normalMatrix",i.normalMatrix),E.setValue(N,"modelMatrix",i.matrixWorld),T}function be(e,t,n){e.opacity.value=t.opacity,t.color&&e.diffuse.value.copy(t.color),t.emissive&&e.emissive.value.copy(t.emissive).multiplyScalar(t.emissiveIntensity),t.map&&(e.map.value=t.map),t.alphaMap&&(e.alphaMap.value=t.alphaMap),t.specularMap&&(e.specularMap.value=t.specularMap);var i,r,a=t.envMap||n;a&&(e.envMap.value=a,e.flipEnvMap.value=a.isCubeTexture?-1:1,e.reflectivity.value=t.reflectivity,e.refractionRatio.value=t.refractionRatio,e.maxMipLevel.value=U.get(a).__maxMipLevel),t.lightMap&&(e.lightMap.value=t.lightMap,e.lightMapIntensity.value=t.lightMapIntensity),t.aoMap&&(e.aoMap.value=t.aoMap,e.aoMapIntensity.value=t.aoMapIntensity),t.map?i=t.map:t.specularMap?i=t.specularMap:t.displacementMap?i=t.displacementMap:t.normalMap?i=t.normalMap:t.bumpMap?i=t.bumpMap:t.roughnessMap?i=t.roughnessMap:t.metalnessMap?i=t.metalnessMap:t.alphaMap?i=t.alphaMap:t.emissiveMap&&(i=t.emissiveMap),void 0!==i&&(i.isWebGLRenderTarget&&(i=i.texture),!0===i.matrixAutoUpdate&&i.updateMatrix(),e.uvTransform.value.copy(i.matrix)),t.aoMap?r=t.aoMap:t.lightMap&&(r=t.lightMap),void 0!==r&&(r.isWebGLRenderTarget&&(r=r.texture),!0===r.matrixAutoUpdate&&r.updateMatrix(),e.uv2Transform.value.copy(r.matrix))}function we(e,t,n){e.roughness.value=t.roughness,e.metalness.value=t.metalness,t.roughnessMap&&(e.roughnessMap.value=t.roughnessMap),t.metalnessMap&&(e.metalnessMap.value=t.metalnessMap),t.emissiveMap&&(e.emissiveMap.value=t.emissiveMap),t.bumpMap&&(e.bumpMap.value=t.bumpMap,e.bumpScale.value=t.bumpScale,t.side===Me&&(e.bumpScale.value*=-1)),t.normalMap&&(e.normalMap.value=t.normalMap,e.normalScale.value.copy(t.normalScale),t.side===Me&&e.normalScale.value.negate()),t.displacementMap&&(e.displacementMap.value=t.displacementMap,e.displacementScale.value=t.displacementScale,e.displacementBias.value=t.displacementBias),(t.envMap||n)&&(e.envMapIntensity.value=t.envMapIntensity)}ve.setAnimationLoop(function(e){ce.isPresenting||me&&me(e)}),"undefined"!=typeof window&&ve.setContext(window),this.setAnimationLoop=function(e){me=e,ce.setAnimationLoop(e),ve.start()},this.render=function(e,t){var n,i;if(void 0!==arguments[2]&&(console.warn("THREE.WebGLRenderer.render(): the renderTarget argument has been removed. Use .setRenderTarget() instead."),n=arguments[2]),void 0!==arguments[3]&&(console.warn("THREE.WebGLRenderer.render(): the forceClear argument has been removed. Use .clear() instead."),i=arguments[3]),t&&t.isCamera){if(!_){P.geometry=null,P.program=null,P.wireframe=!1,k=-1,!(V=null)===e.autoUpdate&&e.updateMatrixWorld(),null===t.parent&&t.updateMatrixWorld(),ce.enabled&&ce.isPresenting&&(t=ce.getCamera(t)),e.onBeforeRender(G,e,t,n||H),(D=d.get(e,t)).init(),ie.multiplyMatrices(t.projectionMatrix,t.matrixWorldInverse),$.setFromProjectionMatrix(ie),ne=this.localClippingEnabled,te=ee.init(this.clippingPlanes,ne,t),(f=h.get(e,t)).init(),function e(t,n,i,r){if(!1===t.visible)return;var a=t.layers.test(n.layers);if(a)if(t.isGroup)i=t.renderOrder;else if(t.isLOD)!0===t.autoUpdate&&t.update(n);else if(t.isLight)D.pushLight(t),t.castShadow&&D.pushShadow(t);else if(t.isSprite){if(!t.frustumCulled||$.intersectsSprite(t)){r&&re.setFromMatrixPosition(t.matrixWorld).applyMatrix4(ie);var o=v.update(t),s=t.material;s.visible&&f.push(t,o,s,i,re.z,null)}}else if(t.isImmediateRenderObject)r&&re.setFromMatrixPosition(t.matrixWorld).applyMatrix4(ie),f.push(t,null,t.material,i,re.z,null);else if((t.isMesh||t.isLine||t.isPoints)&&(t.isSkinnedMesh&&t.skeleton.frame!==m.render.frame&&(t.skeleton.update(),t.skeleton.frame=m.render.frame),!t.frustumCulled||$.intersectsObject(t))){r&&re.setFromMatrixPosition(t.matrixWorld).applyMatrix4(ie);var o=v.update(t),s=t.material;if(Array.isArray(s))for(var c=o.groups,l=0,u=c.length;l<u;l++){var h=c[l],d=s[h.materialIndex];d&&d.visible&&f.push(t,o,d,i,re.z,h)}else s.visible&&f.push(t,o,s,i,re.z,null)}var p=t.children;for(var l=0,u=p.length;l<u;l++)e(p[l],n,i,r)}(e,t,0,G.sortObjects),f.finish(),!0===G.sortObjects&&f.sort(Y,Z),te&&ee.beginShadows();var r=D.state.shadowsArray;le.render(r,e,t),D.setupLights(t),te&&ee.endShadows(),this.info.autoReset&&this.info.reset(),void 0!==n&&this.setRenderTarget(n),p.render(f,e,t,i);var a=f.opaque,o=f.transparent;if(e.overrideMaterial){var s=e.overrideMaterial;a.length&&ge(a,e,t,s),o.length&&ge(o,e,t,s)}else a.length&&ge(a,e,t),o.length&&ge(o,e,t);e.onAfterRender(G,e,t),null!==H&&(B.updateRenderTargetMipmap(H),B.updateMultisampleRenderTarget(H)),z.buffers.depth.setTest(!0),z.buffers.depth.setMask(!0),z.buffers.color.setMask(!0),z.setPolygonOffset(!1),D=f=null}}else console.error("THREE.WebGLRenderer.render: camera is not an instance of THREE.Camera.")},this.setFramebuffer=function(e){x!==e&&null===H&&N.bindFramebuffer(36160,e),x=e},this.getActiveCubeFace=function(){return b},this.getActiveMipmapLevel=function(){return w},this.getRenderTarget=function(){return H},this.setRenderTarget=function(e,t,n){b=t,w=n,(H=e)&&void 0===U.get(e).__webglFramebuffer&&B.setupRenderTarget(e);var i=x,r=!1;if(e){var a=U.get(e).__webglFramebuffer;e.isWebGLCubeRenderTarget?(i=a[t||0],r=!0):i=e.isWebGLMultisampleRenderTarget?U.get(e).__webglMultisampledFramebuffer:a,I.copy(e.viewport),O.copy(e.scissor),j=e.scissorTest}else I.copy(J).multiplyScalar(X).floor(),O.copy(K).multiplyScalar(X).floor(),j=Q;if(R!==i&&(N.bindFramebuffer(36160,i),R=i),z.viewport(I),z.scissor(O),z.setScissorTest(j),r){var o=U.get(e.texture);N.framebufferTexture2D(36160,36064,34069+(t||0),o.__webglTexture,n||0)}},this.readRenderTargetPixels=function(e,t,n,i,r,a,o){if(e&&e.isWebGLRenderTarget){var s=U.get(e).__webglFramebuffer;if(e.isWebGLCubeRenderTarget&&void 0!==o&&(s=s[o]),s){var c=!1;s!==R&&(N.bindFramebuffer(36160,s),c=!0);try{var l=e.texture,u=l.format,h=l.type;if(u!==tt&&y.convert(u)!==N.getParameter(35739))return void console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.");if(!(h===Ye||y.convert(h)===N.getParameter(35738)||h===Ke&&(F.isWebGL2||M.get("OES_texture_float")||M.get("WEBGL_color_buffer_float"))||h===Qe&&(F.isWebGL2?M.get("EXT_color_buffer_float"):M.get("EXT_color_buffer_half_float"))))return void console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.");36053===N.checkFramebufferStatus(36160)?0<=t&&t<=e.width-i&&0<=n&&n<=e.height-r&&N.readPixels(t,n,i,r,y.convert(u),y.convert(h),a):console.error("THREE.WebGLRenderer.readRenderTargetPixels: readPixels from renderTarget failed. Framebuffer not complete.")}finally{c&&N.bindFramebuffer(36160,R)}}}else console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.")},this.copyFramebufferToTexture=function(e,t,n){void 0===n&&(n=0);var i=Math.pow(2,-n),r=Math.floor(t.image.width*i),a=Math.floor(t.image.height*i),o=y.convert(t.format);B.setTexture2D(t,0),N.copyTexImage2D(3553,n,o,e.x,e.y,r,a,0),z.unbindTexture()},this.copyTextureToTexture=function(e,t,n,i){void 0===i&&(i=0);var r=t.image.width,a=t.image.height,o=y.convert(n.format),s=y.convert(n.type);B.setTexture2D(n,0),t.isDataTexture?N.texSubImage2D(3553,i,e.x,e.y,r,a,o,s,t.image.data):t.isCompressedTexture?N.compressedTexSubImage2D(3553,i,e.x,e.y,t.mipmaps[0].width,t.mipmaps[0].height,o,t.mipmaps[0].data):N.texSubImage2D(3553,i,e.x,e.y,o,s,t.image),0===i&&n.generateMipmaps&&N.generateMipmap(3553),z.unbindTexture()},this.initTexture=function(e){B.setTexture2D(e,0),z.unbindTexture()},"undefined"!=typeof __THREE_DEVTOOLS__&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}function ns(e,t){this.name="",this.color=new Di(e),this.density=void 0!==t?t:25e-5}function is(e,t,n){this.name="",this.color=new Di(e),this.near=void 0!==t?t:1,this.far=void 0!==n?n:1e3}function rs(e,t){this.array=e,this.stride=t,this.count=void 0!==e?e.length/t:0,this.usage=Qt,this.updateRange={offset:0,count:-1},this.version=0}Ko.prototype=J(Object.create(Vr.prototype),{constructor:Ko,isArrayCamera:!0}),Qo.prototype=J(Object.create(Vn.prototype),{constructor:Qo,isGroup:!0}),J($o.prototype,{constructor:$o,getTargetRaySpace:function(){return null===this._targetRay&&(this._targetRay=new Qo,this._targetRay.matrixAutoUpdate=!1,this._targetRay.visible=!1),this._targetRay},getGripSpace:function(){return null===this._grip&&(this._grip=new Qo,this._grip.matrixAutoUpdate=!1,this._grip.visible=!1),this._grip},dispatchEvent:function(e){return null!==this._targetRay&&this._targetRay.dispatchEvent(e),null!==this._grip&&this._grip.dispatchEvent(e),this},disconnect:function(e){return this.dispatchEvent({type:"disconnected",data:e}),null!==this._targetRay&&(this._targetRay.visible=!1),null!==this._grip&&(this._grip.visible=!1),this},update:function(e,t,n){var i=null,r=null,a=this._targetRay,o=this._grip;return e&&(null!==a&&null!==(i=t.getPose(e.targetRaySpace,n))&&(a.matrix.fromArray(i.transform.matrix),a.matrix.decompose(a.position,a.rotation,a.scale)),null!==o&&e.gripSpace&&null!==(r=t.getPose(e.gripSpace,n))&&(o.matrix.fromArray(r.transform.matrix),o.matrix.decompose(o.position,o.rotation,o.scale))),null!==a&&(a.visible=null!==i),null!==o&&(o.visible=null!==r),this}}),J(es.prototype,en.prototype),J(ns.prototype,{isFogExp2:!0,clone:function(){return new ns(this.color,this.density)},toJSON:function(){return{type:"FogExp2",color:this.color.getHex(),density:this.density}}}),J(is.prototype,{isFog:!0,clone:function(){return new is(this.color,this.near,this.far)},toJSON:function(){return{type:"Fog",color:this.color.getHex(),near:this.near,far:this.far}}}),Object.defineProperty(rs.prototype,"needsUpdate",{set:function(e){!0===e&&this.version++}}),J(rs.prototype,{isInterleavedBuffer:!0,onUploadCallback:function(){},setUsage:function(e){return this.usage=e,this},copy:function(e){return this.array=new e.array.constructor(e.array),this.count=e.count,this.stride=e.stride,this.usage=e.usage,this},copyAt:function(e,t,n){e*=this.stride,n*=t.stride;for(var i=0,r=this.stride;i<r;i++)this.array[e+i]=t.array[n+i];return this},set:function(e,t){return void 0===t&&(t=0),this.array.set(e,t),this},clone:function(){return(new this.constructor).copy(this)},onUpload:function(e){return this.onUploadCallback=e,this}});var as,os=new gn;function ss(e,t,n,i){this.data=e,this.itemSize=t,this.offset=n,this.normalized=!0===i}function cs(e){Gi.call(this),this.type="SpriteMaterial",this.color=new Di(16777215),this.map=null,this.alphaMap=null,this.rotation=0,this.sizeAttenuation=!0,this.transparent=!0,this.setValues(e)}Object.defineProperties(ss.prototype,{count:{get:function(){return this.data.count}},array:{get:function(){return this.data.array}}}),J(ss.prototype,{isInterleavedBufferAttribute:!0,applyMatrix4:function(e){for(var t=0,n=this.data.count;t<n;t++)os.x=this.getX(t),os.y=this.getY(t),os.z=this.getZ(t),os.applyMatrix4(e),this.setXYZ(t,os.x,os.y,os.z);return this},setX:function(e,t){return this.data.array[e*this.data.stride+this.offset]=t,this},setY:function(e,t){return this.data.array[e*this.data.stride+this.offset+1]=t,this},setZ:function(e,t){return this.data.array[e*this.data.stride+this.offset+2]=t,this},setW:function(e,t){return this.data.array[e*this.data.stride+this.offset+3]=t,this},getX:function(e){return this.data.array[e*this.data.stride+this.offset]},getY:function(e){return this.data.array[e*this.data.stride+this.offset+1]},getZ:function(e){return this.data.array[e*this.data.stride+this.offset+2]},getW:function(e){return this.data.array[e*this.data.stride+this.offset+3]},setXY:function(e,t,n){return e=e*this.data.stride+this.offset,this.data.array[e+0]=t,this.data.array[e+1]=n,this},setXYZ:function(e,t,n,i){return e=e*this.data.stride+this.offset,this.data.array[e+0]=t,this.data.array[e+1]=n,this.data.array[e+2]=i,this},setXYZW:function(e,t,n,i,r){return e=e*this.data.stride+this.offset,this.data.array[e+0]=t,this.data.array[e+1]=n,this.data.array[e+2]=i,this.data.array[e+3]=r,this}}),((cs.prototype=Object.create(Gi.prototype)).constructor=cs).prototype.isSpriteMaterial=!0,cs.prototype.copy=function(e){return Gi.prototype.copy.call(this,e),this.color.copy(e.color),this.map=e.map,this.alphaMap=e.alphaMap,this.rotation=e.rotation,this.sizeAttenuation=e.sizeAttenuation,this};var ls=new gn,us=new gn,hs=new gn,ds=new on,ps=new on,fs=new Tn,ms=new gn,vs=new gn,gs=new gn,ys=new on,_s=new on,xs=new on;function bs(e){if(Vn.call(this),this.type="Sprite",void 0===as){as=new cr;var t=new rs(new Float32Array([-.5,-.5,0,0,0,.5,-.5,0,1,0,.5,.5,0,1,1,-.5,.5,0,0,1]),5);as.setIndex([0,1,2,0,2,3]),as.setAttribute("position",new ss(t,3,0,!1)),as.setAttribute("uv",new ss(t,2,3,!1))}this.geometry=as,this.material=void 0!==e?e:new cs,this.center=new on(.5,.5)}function ws(e,t,n,i,r,a){ds.subVectors(e,n).addScalar(.5).multiply(i),void 0!==r?(ps.x=a*ds.x-r*ds.y,ps.y=r*ds.x+a*ds.y):ps.copy(ds),e.copy(t),e.x+=ps.x,e.y+=ps.y,e.applyMatrix4(fs)}bs.prototype=J(Object.create(Vn.prototype),{constructor:bs,isSprite:!0,raycast:function(e,t){null===e.camera&&console.error('THREE.Sprite: "Raycaster.camera" needs to be set in order to raycast against sprites.'),us.setFromMatrixScale(this.matrixWorld),fs.copy(e.camera.matrixWorld),this.modelViewMatrix.multiplyMatrices(e.camera.matrixWorldInverse,this.matrixWorld),hs.setFromMatrixPosition(this.modelViewMatrix),e.camera.isPerspectiveCamera&&!1===this.material.sizeAttenuation&&us.multiplyScalar(-hs.z);var n,i,r=this.material.rotation;0!==r&&(i=Math.cos(r),n=Math.sin(r));var a=this.center;ws(ms.set(-.5,-.5,0),hs,a,us,n,i),ws(vs.set(.5,-.5,0),hs,a,us,n,i),ws(gs.set(.5,.5,0),hs,a,us,n,i),ys.set(0,0),_s.set(1,0),xs.set(1,1);var o=e.ray.intersectTriangle(ms,vs,gs,!1,ls);if(null!==o||(ws(vs.set(-.5,.5,0),hs,a,us,n,i),_s.set(0,1),null!==(o=e.ray.intersectTriangle(ms,gs,vs,!1,ls)))){var s=e.ray.origin.distanceTo(ls);s<e.near||s>e.far||t.push({distance:s,point:ls.clone(),uv:Pi.getUV(ls,ms,vs,gs,ys,_s,xs,new on),face:null,object:this})}},clone:function(){return new this.constructor(this.material).copy(this)},copy:function(e){return Vn.prototype.copy.call(this,e),void 0!==e.center&&this.center.copy(e.center),this}});var Ms,Ss,Ts,Es,As,Ls=new gn,Rs=new gn;function Ps(){Vn.call(this),this._currentLevel=0,this.type="LOD",Object.defineProperties(this,{levels:{enumerable:!0,value:[]}}),this.autoUpdate=!0}function Cs(e,t){e&&e.isGeometry&&console.error("THREE.SkinnedMesh no longer supports THREE.Geometry. Use THREE.BufferGeometry instead."),Er.call(this,e,t),this.type="SkinnedMesh",this.bindMode="attached",this.bindMatrix=new Tn,this.bindMatrixInverse=new Tn}Ps.prototype=J(Object.create(Vn.prototype),{constructor:Ps,isLOD:!0,copy:function(e){Vn.prototype.copy.call(this,e,!1);for(var t=e.levels,n=0,i=t.length;n<i;n++){var r=t[n];this.addLevel(r.object.clone(),r.distance)}return this.autoUpdate=e.autoUpdate,this},addLevel:function(e,t){void 0===t&&(t=0),t=Math.abs(t);for(var n=this.levels,i=0;i<n.length&&!(t<n[i].distance);i++);return n.splice(i,0,{distance:t,object:e}),this.add(e),this},getCurrentLevel:function(){return this._currentLevel},getObjectForDistance:function(e){var t=this.levels;if(0<t.length){for(var n=1,i=t.length;n<i&&!(e<t[n].distance);n++);return t[n-1].object}return null},raycast:function(e,t){if(0<this.levels.length){Ls.setFromMatrixPosition(this.matrixWorld);var n=e.ray.origin.distanceTo(Ls);this.getObjectForDistance(n).raycast(e,t)}},update:function(e){var t=this.levels;if(1<t.length){Ls.setFromMatrixPosition(e.matrixWorld),Rs.setFromMatrixPosition(this.matrixWorld);var n=Ls.distanceTo(Rs)/e.zoom;t[0].object.visible=!0;for(var i=1,r=t.length;i<r&&n>=t[i].distance;i++)t[i-1].object.visible=!1,t[i].object.visible=!0;for(this._currentLevel=i-1;i<r;i++)t[i].object.visible=!1}},toJSON:function(e){var t=Vn.prototype.toJSON.call(this,e);!1===this.autoUpdate&&(t.object.autoUpdate=!1),t.object.levels=[];for(var n=this.levels,i=0,r=n.length;i<r;i++){var a=n[i];t.object.levels.push({object:a.object.uuid,distance:a.distance})}return t}}),Cs.prototype=J(Object.create(Er.prototype),{constructor:Cs,isSkinnedMesh:!0,bind:function(e,t){this.skeleton=e,void 0===t&&(this.updateMatrixWorld(!0),this.skeleton.calculateInverses(),t=this.matrixWorld),this.bindMatrix.copy(t),this.bindMatrixInverse.getInverse(t)},pose:function(){this.skeleton.pose()},normalizeSkinWeights:function(){for(var e=new hn,t=this.geometry.attributes.skinWeight,n=0,i=t.count;n<i;n++){e.x=t.getX(n),e.y=t.getY(n),e.z=t.getZ(n),e.w=t.getW(n);var r=1/e.manhattanLength();r!=1/0?e.multiplyScalar(r):e.set(1,0,0,0),t.setXYZW(n,e.x,e.y,e.z,e.w)}},updateMatrixWorld:function(e){Er.prototype.updateMatrixWorld.call(this,e),"attached"===this.bindMode?this.bindMatrixInverse.getInverse(this.matrixWorld):"detached"===this.bindMode?this.bindMatrixInverse.getInverse(this.bindMatrix):console.warn("THREE.SkinnedMesh: Unrecognized bindMode: "+this.bindMode)},clone:function(){return new this.constructor(this.geometry,this.material).copy(this)},boneTransform:(Ms=new gn,Ss=new hn,Ts=new hn,Es=new gn,As=new Tn,function(e,t){var n=this.skeleton,i=this.geometry;Ss.fromBufferAttribute(i.attributes.skinIndex,e),Ts.fromBufferAttribute(i.attributes.skinWeight,e),Ms.fromBufferAttribute(i.attributes.position,e).applyMatrix4(this.bindMatrix),t.set(0,0,0);for(var r=0;r<4;r++){var a=Ts.getComponent(r);if(0!==a){var o=Ss.getComponent(r);As.multiplyMatrices(n.bones[o].matrixWorld,n.boneInverses[o]),t.addScaledVector(Es.copy(Ms).applyMatrix4(As),a)}}return t.applyMatrix4(this.bindMatrixInverse)})});var Is=new Tn,Os=new Tn;function Ds(e,t){if(e=e||[],this.bones=e.slice(0),this.boneMatrices=new Float32Array(16*this.bones.length),this.frame=-1,void 0===t)this.calculateInverses();else if(this.bones.length===t.length)this.boneInverses=t.slice(0);else{console.warn("THREE.Skeleton boneInverses is the wrong length."),this.boneInverses=[];for(var n=0,i=this.bones.length;n<i;n++)this.boneInverses.push(new Tn)}}function Ns(){Vn.call(this),this.type="Bone"}J(Ds.prototype,{calculateInverses:function(){this.boneInverses=[];for(var e=0,t=this.bones.length;e<t;e++){var n=new Tn;this.bones[e]&&n.getInverse(this.bones[e].matrixWorld),this.boneInverses.push(n)}},pose:function(){var e,t,n;for(t=0,n=this.bones.length;t<n;t++)(e=this.bones[t])&&e.matrixWorld.getInverse(this.boneInverses[t]);for(t=0,n=this.bones.length;t<n;t++)(e=this.bones[t])&&(e.parent&&e.parent.isBone?(e.matrix.getInverse(e.parent.matrixWorld),e.matrix.multiply(e.matrixWorld)):e.matrix.copy(e.matrixWorld),e.matrix.decompose(e.position,e.quaternion,e.scale))},update:function(){for(var e=this.bones,t=this.boneInverses,n=this.boneMatrices,i=this.boneTexture,r=0,a=e.length;r<a;r++){var o=e[r]?e[r].matrixWorld:Os;Is.multiplyMatrices(o,t[r]),Is.toArray(n,16*r)}void 0!==i&&(i.needsUpdate=!0)},clone:function(){return new Ds(this.bones,this.boneInverses)},getBoneByName:function(e){for(var t=0,n=this.bones.length;t<n;t++){var i=this.bones[t];if(i.name===e)return i}},dispose:function(){this.boneTexture&&(this.boneTexture.dispose(),this.boneTexture=void 0)}}),Ns.prototype=J(Object.create(Vn.prototype),{constructor:Ns,isBone:!0});var Fs=new Tn,zs=new Tn,Us=[],Bs=new Er;function Gs(e,t,n){Er.call(this,e,t),this.instanceMatrix=new Vi(new Float32Array(16*n),16),this.count=n,this.frustumCulled=!1}function Hs(e){Gi.call(this),this.type="LineBasicMaterial",this.color=new Di(16777215),this.linewidth=1,this.linecap="round",this.linejoin="round",this.setValues(e)}Gs.prototype=J(Object.create(Er.prototype),{constructor:Gs,isInstancedMesh:!0,getMatrixAt:function(e,t){t.fromArray(this.instanceMatrix.array,16*e)},raycast:function(e,t){var n=this.matrixWorld,i=this.count;if(Bs.geometry=this.geometry,Bs.material=this.material,void 0!==Bs.material)for(var r=0;r<i;r++){this.getMatrixAt(r,Fs),zs.multiplyMatrices(n,Fs),Bs.matrixWorld=zs,Bs.raycast(e,Us);for(var a=0,o=Us.length;a<o;a++){var s=Us[a];s.instanceId=r,s.object=this,t.push(s)}Us.length=0}},setMatrixAt:function(e,t){t.toArray(this.instanceMatrix.array,16*e)},updateMorphTargets:function(){}}),((Hs.prototype=Object.create(Gi.prototype)).constructor=Hs).prototype.isLineBasicMaterial=!0,Hs.prototype.copy=function(e){return Gi.prototype.copy.call(this,e),this.color.copy(e.color),this.linewidth=e.linewidth,this.linecap=e.linecap,this.linejoin=e.linejoin,this};var ks=new gn,Vs=new gn,js=new Tn,Ws=new mi,qs=new si;function Xs(e,t,n){1===n&&console.error("THREE.Line: parameter THREE.LinePieces no longer supported. Use THREE.LineSegments instead."),Vn.call(this),this.type="Line",this.geometry=void 0!==e?e:new cr,this.material=void 0!==t?t:new Hs}Xs.prototype=J(Object.create(Vn.prototype),{constructor:Xs,isLine:!0,computeLineDistances:function(){var e=this.geometry;if(e.isBufferGeometry)if(null===e.index){for(var t=e.attributes.position,n=[0],i=1,r=t.count;i<r;i++)ks.fromBufferAttribute(t,i-1),Vs.fromBufferAttribute(t,i),n[i]=n[i-1],n[i]+=ks.distanceTo(Vs);e.setAttribute("lineDistance",new Ki(n,1))}else console.warn("THREE.Line.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");else if(e.isGeometry){var a=e.vertices;(n=e.lineDistances)[0]=0;for(i=1,r=a.length;i<r;i++)n[i]=n[i-1],n[i]+=a[i-1].distanceTo(a[i])}return this},raycast:function(e,t){var n=this.geometry,i=this.matrixWorld,r=e.params.Line.threshold;if(null===n.boundingSphere&&n.computeBoundingSphere(),qs.copy(n.boundingSphere),qs.applyMatrix4(i),qs.radius+=r,!1!==e.ray.intersectsSphere(qs)){js.getInverse(i),Ws.copy(e.ray).applyMatrix4(js);var a=r/((this.scale.x+this.scale.y+this.scale.z)/3),o=a*a,s=new gn,c=new gn,l=new gn,u=new gn,h=this&&this.isLineSegments?2:1;if(n.isBufferGeometry){var d=n.index,p=n.attributes.position.array;if(null!==d)for(var f=d.array,m=0,v=f.length-1;m<v;m+=h){var g=f[m],y=f[m+1];if(s.fromArray(p,3*g),c.fromArray(p,3*y),!(o<Ws.distanceSqToSegment(s,c,u,l)))u.applyMatrix4(this.matrixWorld),(b=e.ray.origin.distanceTo(u))<e.near||b>e.far||t.push({distance:b,point:l.clone().applyMatrix4(this.matrixWorld),index:m,face:null,faceIndex:null,object:this})}else for(m=0,v=p.length/3-1;m<v;m+=h){if(s.fromArray(p,3*m),c.fromArray(p,3*m+3),!(o<Ws.distanceSqToSegment(s,c,u,l)))u.applyMatrix4(this.matrixWorld),(b=e.ray.origin.distanceTo(u))<e.near||b>e.far||t.push({distance:b,point:l.clone().applyMatrix4(this.matrixWorld),index:m,face:null,faceIndex:null,object:this})}}else if(n.isGeometry){var _=n.vertices,x=_.length;for(m=0;m<x-1;m+=h){var b;if(!(o<Ws.distanceSqToSegment(_[m],_[m+1],u,l)))u.applyMatrix4(this.matrixWorld),(b=e.ray.origin.distanceTo(u))<e.near||b>e.far||t.push({distance:b,point:l.clone().applyMatrix4(this.matrixWorld),index:m,face:null,faceIndex:null,object:this})}}}},clone:function(){return new this.constructor(this.geometry,this.material).copy(this)}});var Ys=new gn,Zs=new gn;function Js(e,t){Xs.call(this,e,t),this.type="LineSegments"}function Ks(e,t){Xs.call(this,e,t),this.type="LineLoop"}function Qs(e){Gi.call(this),this.type="PointsMaterial",this.color=new Di(16777215),this.map=null,this.alphaMap=null,this.size=1,this.sizeAttenuation=!0,this.morphTargets=!1,this.setValues(e)}Js.prototype=J(Object.create(Xs.prototype),{constructor:Js,isLineSegments:!0,computeLineDistances:function(){var e=this.geometry;if(e.isBufferGeometry)if(null===e.index){for(var t=e.attributes.position,n=[],i=0,r=t.count;i<r;i+=2)Ys.fromBufferAttribute(t,i),Zs.fromBufferAttribute(t,i+1),n[i]=0===i?0:n[i-1],n[i+1]=n[i]+Ys.distanceTo(Zs);e.setAttribute("lineDistance",new Ki(n,1))}else console.warn("THREE.LineSegments.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");else if(e.isGeometry){var a=e.vertices;for(n=e.lineDistances,i=0,r=a.length;i<r;i+=2)Ys.copy(a[i]),Zs.copy(a[i+1]),n[i]=0===i?0:n[i-1],n[i+1]=n[i]+Ys.distanceTo(Zs)}return this}}),Ks.prototype=J(Object.create(Xs.prototype),{constructor:Ks,isLineLoop:!0}),((Qs.prototype=Object.create(Gi.prototype)).constructor=Qs).prototype.isPointsMaterial=!0,Qs.prototype.copy=function(e){return Gi.prototype.copy.call(this,e),this.color.copy(e.color),this.map=e.map,this.alphaMap=e.alphaMap,this.size=e.size,this.sizeAttenuation=e.sizeAttenuation,this.morphTargets=e.morphTargets,this};var $s=new Tn,ec=new mi,tc=new si,nc=new gn;function ic(e,t){Vn.call(this),this.type="Points",this.geometry=void 0!==e?e:new cr,this.material=void 0!==t?t:new Qs,this.updateMorphTargets()}function rc(e,t,n,i,r,a,o){var s=ec.distanceSqToPoint(e);if(s<n){var c=new gn;ec.closestPointToPoint(e,c),c.applyMatrix4(i);var l=r.ray.origin.distanceTo(c);if(l<r.near||l>r.far)return;a.push({distance:l,distanceToRay:Math.sqrt(s),point:c,index:t,face:null,object:o})}}function ac(e,t,n,i,r,a,o,s,c){un.call(this,e,t,n,i,r,a,o,s,c),this.format=void 0!==o?o:et,this.minFilter=void 0!==a?a:We,this.magFilter=void 0!==r?r:We,this.generateMipmaps=!1}function oc(e,t,n,i,r,a,o,s,c,l,u,h){un.call(this,null,a,o,s,c,l,i,r,u,h),this.image={width:t,height:n},this.mipmaps=e,this.flipY=!1,this.generateMipmaps=!1}function sc(e,t,n,i,r,a,o,s,c){un.call(this,e,t,n,i,r,a,o,s,c),this.needsUpdate=!0}function cc(e,t,n,i,r,a,o,s,c,l){if((l=void 0!==l?l:nt)!==nt&&l!==it)throw new Error("DepthTexture format must be either THREE.DepthFormat or THREE.DepthStencilFormat");void 0===n&&l===nt&&(n=Ze),void 0===n&&l===it&&(n=$e),un.call(this,null,i,r,a,o,s,l,n,c),this.image={width:e,height:t},this.magFilter=void 0!==o?o:ke,this.minFilter=void 0!==s?s:ke,this.flipY=!1,this.generateMipmaps=!1}function lc(e){cr.call(this),this.type="WireframeGeometry";var t,n,i,r,a,o,s,c,l,u,h=[],d=[0,0],p={},f=["a","b","c"];if(e&&e.isGeometry){var m=e.faces;for(t=0,i=m.length;t<i;t++){var v=m[t];for(n=0;n<3;n++)s=v[f[n]],c=v[f[(n+1)%3]],d[0]=Math.min(s,c),d[1]=Math.max(s,c),void 0===p[l=d[0]+","+d[1]]&&(p[l]={index1:d[0],index2:d[1]})}for(l in p)o=p[l],u=e.vertices[o.index1],h.push(u.x,u.y,u.z),u=e.vertices[o.index2],h.push(u.x,u.y,u.z)}else if(e&&e.isBufferGeometry){var g,y,_,x,b,w;if(u=new gn,null!==e.index){for(g=e.attributes.position,y=e.index,0===(_=e.groups).length&&(_=[{start:0,count:y.count,materialIndex:0}]),r=0,a=_.length;r<a;++r)for(i=(t=(x=_[r]).start)+x.count;t<i;t+=3)for(n=0;n<3;n++)s=y.getX(t+n),c=y.getX(t+(n+1)%3),d[0]=Math.min(s,c),d[1]=Math.max(s,c),void 0===p[l=d[0]+","+d[1]]&&(p[l]={index1:d[0],index2:d[1]});for(l in p)o=p[l],u.fromBufferAttribute(g,o.index1),h.push(u.x,u.y,u.z),u.fromBufferAttribute(g,o.index2),h.push(u.x,u.y,u.z)}else for(t=0,i=(g=e.attributes.position).count/3;t<i;t++)for(n=0;n<3;n++)b=3*t+n,u.fromBufferAttribute(g,b),h.push(u.x,u.y,u.z),w=3*t+(n+1)%3,u.fromBufferAttribute(g,w),h.push(u.x,u.y,u.z)}this.setAttribute("position",new Ki(h,3))}function uc(e,t,n){Or.call(this),this.type="ParametricGeometry",this.parameters={func:e,slices:t,stacks:n},this.fromBufferGeometry(new hc(e,t,n)),this.mergeVertices()}function hc(e,t,n){cr.call(this),this.type="ParametricBufferGeometry",this.parameters={func:e,slices:t,stacks:n};var i,r,a=[],o=[],s=[],c=[],l=new gn,u=new gn,h=new gn,d=new gn,p=new gn;e.length<3&&console.error("THREE.ParametricGeometry: Function must now modify a Vector3 as third parameter.");var f=t+1;for(i=0;i<=n;i++){var m=i/n;for(r=0;r<=t;r++){var v=r/t;e(v,m,u),o.push(u.x,u.y,u.z),0<=v-1e-5?(e(v-1e-5,m,h),d.subVectors(u,h)):(e(1e-5+v,m,h),d.subVectors(h,u)),0<=m-1e-5?(e(v,m-1e-5,h),p.subVectors(u,h)):(e(v,1e-5+m,h),p.subVectors(h,u)),l.crossVectors(d,p).normalize(),s.push(l.x,l.y,l.z),c.push(v,m)}}for(i=0;i<n;i++)for(r=0;r<t;r++){var g=i*f+r,y=i*f+r+1,_=(i+1)*f+r+1,x=(i+1)*f+r;a.push(g,y,x),a.push(y,_,x)}this.setIndex(a),this.setAttribute("position",new Ki(o,3)),this.setAttribute("normal",new Ki(s,3)),this.setAttribute("uv",new Ki(c,2))}function dc(e,t,n,i){Or.call(this),this.type="PolyhedronGeometry",this.parameters={vertices:e,indices:t,radius:n,detail:i},this.fromBufferGeometry(new pc(e,t,n,i)),this.mergeVertices()}function pc(i,a,e,t){cr.call(this),this.type="PolyhedronBufferGeometry",this.parameters={vertices:i,indices:a,radius:e,detail:t},e=e||1;var u=[],h=[];function o(e,t,n,i){var r,a,o=Math.pow(2,i),s=[];for(r=0;r<=o;r++){s[r]=[];var c=e.clone().lerp(n,r/o),l=t.clone().lerp(n,r/o),u=o-r;for(a=0;a<=u;a++)s[r][a]=0===a&&r===o?c:c.clone().lerp(l,a/u)}for(r=0;r<o;r++)for(a=0;a<2*(o-r)-1;a++){var h=Math.floor(a/2);a%2==0?(d(s[r][h+1]),d(s[r+1][h]),d(s[r][h])):(d(s[r][h+1]),d(s[r+1][h+1]),d(s[r+1][h]))}}function d(e){u.push(e.x,e.y,e.z)}function s(e,t){var n=3*e;t.x=i[0+n],t.y=i[1+n],t.z=i[2+n]}function p(e,t,n,i){i<0&&1===e.x&&(h[t]=e.x-1),0===n.x&&0===n.z&&(h[t]=i/2/Math.PI+.5)}function f(e){return Math.atan2(e.z,-e.x)}!function(e){for(var t=new gn,n=new gn,i=new gn,r=0;r<a.length;r+=3)s(a[r+0],t),s(a[r+1],n),s(a[r+2],i),o(t,n,i,e)}(t=t||0),function(e){for(var t=new gn,n=0;n<u.length;n+=3)t.x=u[n+0],t.y=u[n+1],t.z=u[n+2],t.normalize().multiplyScalar(e),u[n+0]=t.x,u[n+1]=t.y,u[n+2]=t.z}(e),function(){for(var e=new gn,t=0;t<u.length;t+=3){e.x=u[t+0],e.y=u[t+1],e.z=u[t+2];var n=f(e)/2/Math.PI+.5,i=(r=e,Math.atan2(-r.y,Math.sqrt(r.x*r.x+r.z*r.z))/Math.PI+.5);h.push(n,1-i)}var r;(function(){for(var e=new gn,t=new gn,n=new gn,i=new gn,r=new on,a=new on,o=new on,s=0,c=0;s<u.length;s+=9,c+=6){e.set(u[s+0],u[s+1],u[s+2]),t.set(u[s+3],u[s+4],u[s+5]),n.set(u[s+6],u[s+7],u[s+8]),r.set(h[c+0],h[c+1]),a.set(h[c+2],h[c+3]),o.set(h[c+4],h[c+5]),i.copy(e).add(t).add(n).divideScalar(3);var l=f(i);p(r,c+0,e,l),p(a,c+2,t,l),p(o,c+4,n,l)}})(),function(){for(var e=0;e<h.length;e+=6){var t=h[e+0],n=h[e+2],i=h[e+4],r=Math.max(t,n,i),a=Math.min(t,n,i);.9<r&&a<.1&&(t<.2&&(h[e+0]+=1),n<.2&&(h[e+2]+=1),i<.2&&(h[e+4]+=1))}}()}(),this.setAttribute("position",new Ki(u,3)),this.setAttribute("normal",new Ki(u.slice(),3)),this.setAttribute("uv",new Ki(h,2)),0===t?this.computeVertexNormals():this.normalizeNormals()}function fc(e,t){Or.call(this),this.type="TetrahedronGeometry",this.parameters={radius:e,detail:t},this.fromBufferGeometry(new mc(e,t)),this.mergeVertices()}function mc(e,t){pc.call(this,[1,1,1,-1,-1,1,-1,1,-1,1,-1,-1],[2,1,0,0,3,2,1,3,0,2,3,1],e,t),this.type="TetrahedronBufferGeometry",this.parameters={radius:e,detail:t}}function vc(e,t){Or.call(this),this.type="OctahedronGeometry",this.parameters={radius:e,detail:t},this.fromBufferGeometry(new gc(e,t)),this.mergeVertices()}function gc(e,t){pc.call(this,[1,0,0,-1,0,0,0,1,0,0,-1,0,0,0,1,0,0,-1],[0,2,4,0,4,3,0,3,5,0,5,2,1,2,5,1,5,3,1,3,4,1,4,2],e,t),this.type="OctahedronBufferGeometry",this.parameters={radius:e,detail:t}}function yc(e,t){Or.call(this),this.type="IcosahedronGeometry",this.parameters={radius:e,detail:t},this.fromBufferGeometry(new _c(e,t)),this.mergeVertices()}function _c(e,t){var n=(1+Math.sqrt(5))/2;pc.call(this,[-1,n,0,1,n,0,-1,-n,0,1,-n,0,0,-1,n,0,1,n,0,-1,-n,0,1,-n,n,0,-1,n,0,1,-n,0,-1,-n,0,1],[0,11,5,0,5,1,0,1,7,0,7,10,0,10,11,1,5,9,5,11,4,11,10,2,10,7,6,7,1,8,3,9,4,3,4,2,3,2,6,3,6,8,3,8,9,4,9,5,2,4,11,6,2,10,8,6,7,9,8,1],e,t),this.type="IcosahedronBufferGeometry",this.parameters={radius:e,detail:t}}function xc(e,t){Or.call(this),this.type="DodecahedronGeometry",this.parameters={radius:e,detail:t},this.fromBufferGeometry(new bc(e,t)),this.mergeVertices()}function bc(e,t){var n=(1+Math.sqrt(5))/2,i=1/n;pc.call(this,[-1,-1,-1,-1,-1,1,-1,1,-1,-1,1,1,1,-1,-1,1,-1,1,1,1,-1,1,1,1,0,-i,-n,0,-i,n,0,i,-n,0,i,n,-i,-n,0,-i,n,0,i,-n,0,i,n,0,-n,0,-i,n,0,-i,-n,0,i,n,0,i],[3,11,7,3,7,15,3,15,13,7,19,17,7,17,6,7,6,15,17,4,8,17,8,10,17,10,6,8,0,16,8,16,2,8,2,10,0,12,1,0,1,18,0,18,16,6,10,2,6,2,13,6,13,15,2,16,18,2,18,3,2,3,13,18,1,9,18,9,11,18,11,3,4,14,12,4,12,0,4,0,8,11,9,5,11,5,19,11,19,7,19,5,14,19,14,4,19,4,17,1,12,14,1,14,5,1,5,9],e,t),this.type="DodecahedronBufferGeometry",this.parameters={radius:e,detail:t}}function wc(e,t,n,i,r,a){Or.call(this),this.type="TubeGeometry",this.parameters={path:e,tubularSegments:t,radius:n,radialSegments:i,closed:r},void 0!==a&&console.warn("THREE.TubeGeometry: taper has been removed.");var o=new Mc(e,t,n,i,r);this.tangents=o.tangents,this.normals=o.normals,this.binormals=o.binormals,this.fromBufferGeometry(o),this.mergeVertices()}function Mc(o,s,c,l,e){cr.call(this),this.type="TubeBufferGeometry",this.parameters={path:o,tubularSegments:s,radius:c,radialSegments:l,closed:e},s=s||64,c=c||1,l=l||8,e=e||!1;var u=o.computeFrenetFrames(s,e);this.tangents=u.tangents,this.normals=u.normals,this.binormals=u.binormals;var r,h,d=new gn,p=new gn,t=new on,f=new gn,m=[],v=[],n=[],a=[];function i(e){f=o.getPointAt(e/s,f);var t=u.normals[e],n=u.binormals[e];for(h=0;h<=l;h++){var i=h/l*Math.PI*2,r=Math.sin(i),a=-Math.cos(i);p.x=a*t.x+r*n.x,p.y=a*t.y+r*n.y,p.z=a*t.z+r*n.z,p.normalize(),v.push(p.x,p.y,p.z),d.x=f.x+c*p.x,d.y=f.y+c*p.y,d.z=f.z+c*p.z,m.push(d.x,d.y,d.z)}}!function(){for(r=0;r<s;r++)i(r);i(!1===e?s:0),function(){for(r=0;r<=s;r++)for(h=0;h<=l;h++)t.x=r/s,t.y=h/l,n.push(t.x,t.y)}(),function(){for(h=1;h<=s;h++)for(r=1;r<=l;r++){var e=(l+1)*(h-1)+(r-1),t=(l+1)*h+(r-1),n=(l+1)*h+r,i=(l+1)*(h-1)+r;a.push(e,t,i),a.push(t,n,i)}}()}(),this.setIndex(a),this.setAttribute("position",new Ki(m,3)),this.setAttribute("normal",new Ki(v,3)),this.setAttribute("uv",new Ki(n,2))}function Sc(e,t,n,i,r,a,o){Or.call(this),this.type="TorusKnotGeometry",this.parameters={radius:e,tube:t,tubularSegments:n,radialSegments:i,p:r,q:a},void 0!==o&&console.warn("THREE.TorusKnotGeometry: heightScale has been deprecated. Use .scale( x, y, z ) instead."),this.fromBufferGeometry(new Tc(e,t,n,i,r,a)),this.mergeVertices()}function Tc(e,t,n,i,r,a){cr.call(this),this.type="TorusKnotBufferGeometry",this.parameters={radius:e,tube:t,tubularSegments:n,radialSegments:i,p:r,q:a},e=e||1,t=t||.4,n=Math.floor(n)||64,i=Math.floor(i)||8,r=r||2,a=a||3;var o,s,c=[],l=[],u=[],h=[],d=new gn,p=new gn,f=new gn,m=new gn,v=new gn,g=new gn,y=new gn;for(o=0;o<=n;++o){var _=o/n*r*Math.PI*2;for(A(_,r,a,e,f),A(.01+_,r,a,e,m),g.subVectors(m,f),y.addVectors(m,f),v.crossVectors(g,y),y.crossVectors(v,g),v.normalize(),y.normalize(),s=0;s<=i;++s){var x=s/i*Math.PI*2,b=-t*Math.cos(x),w=t*Math.sin(x);d.x=f.x+(b*y.x+w*v.x),d.y=f.y+(b*y.y+w*v.y),d.z=f.z+(b*y.z+w*v.z),l.push(d.x,d.y,d.z),p.subVectors(d,f).normalize(),u.push(p.x,p.y,p.z),h.push(o/n),h.push(s/i)}}for(s=1;s<=n;s++)for(o=1;o<=i;o++){var M=(i+1)*(s-1)+(o-1),S=(i+1)*s+(o-1),T=(i+1)*s+o,E=(i+1)*(s-1)+o;c.push(M,S,E),c.push(S,T,E)}function A(e,t,n,i,r){var a=Math.cos(e),o=Math.sin(e),s=n/t*e,c=Math.cos(s);r.x=i*(2+c)*.5*a,r.y=i*(2+c)*o*.5,r.z=i*Math.sin(s)*.5}this.setIndex(c),this.setAttribute("position",new Ki(l,3)),this.setAttribute("normal",new Ki(u,3)),this.setAttribute("uv",new Ki(h,2))}function Ec(e,t,n,i,r){Or.call(this),this.type="TorusGeometry",this.parameters={radius:e,tube:t,radialSegments:n,tubularSegments:i,arc:r},this.fromBufferGeometry(new Ac(e,t,n,i,r)),this.mergeVertices()}function Ac(e,t,n,i,r){cr.call(this),this.type="TorusBufferGeometry",this.parameters={radius:e,tube:t,radialSegments:n,tubularSegments:i,arc:r},e=e||1,t=t||.4,n=Math.floor(n)||8,i=Math.floor(i)||6,r=r||2*Math.PI;var a,o,s=[],c=[],l=[],u=[],h=new gn,d=new gn,p=new gn;for(a=0;a<=n;a++)for(o=0;o<=i;o++){var f=o/i*r,m=a/n*Math.PI*2;d.x=(e+t*Math.cos(m))*Math.cos(f),d.y=(e+t*Math.cos(m))*Math.sin(f),d.z=t*Math.sin(m),c.push(d.x,d.y,d.z),h.x=e*Math.cos(f),h.y=e*Math.sin(f),p.subVectors(d,h).normalize(),l.push(p.x,p.y,p.z),u.push(o/i),u.push(a/n)}for(a=1;a<=n;a++)for(o=1;o<=i;o++){var v=(i+1)*a+o-1,g=(i+1)*(a-1)+o-1,y=(i+1)*(a-1)+o,_=(i+1)*a+o;s.push(v,g,_),s.push(g,y,_)}this.setIndex(s),this.setAttribute("position",new Ki(c,3)),this.setAttribute("normal",new Ki(l,3)),this.setAttribute("uv",new Ki(u,2))}ic.prototype=J(Object.create(Vn.prototype),{constructor:ic,isPoints:!0,raycast:function(e,t){var n=this.geometry,i=this.matrixWorld,r=e.params.Points.threshold;if(null===n.boundingSphere&&n.computeBoundingSphere(),tc.copy(n.boundingSphere),tc.applyMatrix4(i),tc.radius+=r,!1!==e.ray.intersectsSphere(tc)){$s.getInverse(i),ec.copy(e.ray).applyMatrix4($s);var a=r/((this.scale.x+this.scale.y+this.scale.z)/3),o=a*a;if(n.isBufferGeometry){var s=n.index,c=n.attributes.position.array;if(null!==s)for(var l=s.array,u=0,h=l.length;u<h;u++){var d=l[u];nc.fromArray(c,3*d),rc(nc,d,o,i,e,t,this)}else{u=0;for(var p=c.length/3;u<p;u++)nc.fromArray(c,3*u),rc(nc,u,o,i,e,t,this)}}else{var f=n.vertices;for(u=0,p=f.length;u<p;u++)rc(f[u],u,o,i,e,t,this)}}},updateMorphTargets:function(){var e,t,n,i=this.geometry;if(i.isBufferGeometry){var r=i.morphAttributes,a=Object.keys(r);if(0<a.length){var o=r[a[0]];if(void 0!==o)for(this.morphTargetInfluences=[],this.morphTargetDictionary={},e=0,t=o.length;e<t;e++)n=o[e].name||String(e),this.morphTargetInfluences.push(0),this.morphTargetDictionary[n]=e}}else{var s=i.morphTargets;void 0!==s&&0<s.length&&console.error("THREE.Points.updateMorphTargets() does not support THREE.Geometry. Use THREE.BufferGeometry instead.")}},clone:function(){return new this.constructor(this.geometry,this.material).copy(this)}}),ac.prototype=J(Object.create(un.prototype),{constructor:ac,isVideoTexture:!0,update:function(){var e=this.image;e.readyState>=e.HAVE_CURRENT_DATA&&(this.needsUpdate=!0)}}),((oc.prototype=Object.create(un.prototype)).constructor=oc).prototype.isCompressedTexture=!0,((sc.prototype=Object.create(un.prototype)).constructor=sc).prototype.isCanvasTexture=!0,((cc.prototype=Object.create(un.prototype)).constructor=cc).prototype.isDepthTexture=!0,(lc.prototype=Object.create(cr.prototype)).constructor=lc,(uc.prototype=Object.create(Or.prototype)).constructor=uc,(hc.prototype=Object.create(cr.prototype)).constructor=hc,(dc.prototype=Object.create(Or.prototype)).constructor=dc,(pc.prototype=Object.create(cr.prototype)).constructor=pc,(fc.prototype=Object.create(Or.prototype)).constructor=fc,(mc.prototype=Object.create(pc.prototype)).constructor=mc,(vc.prototype=Object.create(Or.prototype)).constructor=vc,(gc.prototype=Object.create(pc.prototype)).constructor=gc,(yc.prototype=Object.create(Or.prototype)).constructor=yc,(_c.prototype=Object.create(pc.prototype)).constructor=_c,(xc.prototype=Object.create(Or.prototype)).constructor=xc,(bc.prototype=Object.create(pc.prototype)).constructor=bc,(wc.prototype=Object.create(Or.prototype)).constructor=wc,((Mc.prototype=Object.create(cr.prototype)).constructor=Mc).prototype.toJSON=function(){var e=cr.prototype.toJSON.call(this);return e.path=this.parameters.path.toJSON(),e},(Sc.prototype=Object.create(Or.prototype)).constructor=Sc,(Tc.prototype=Object.create(cr.prototype)).constructor=Tc,(Ec.prototype=Object.create(Or.prototype)).constructor=Ec,(Ac.prototype=Object.create(cr.prototype)).constructor=Ac;var Lc=function(e,t,n){n=n||2;var i,r,a,o,s,c,l,u=t&&t.length,h=u?t[0]*n:e.length,d=Rc(e,0,h,n,!0),p=[];if(!d||d.next===d.prev)return p;if(u&&(d=function(e,t,n,i){var r,a,o,s,c,l=[];for(r=0,a=t.length;r<a;r++)o=t[r]*i,s=r<a-1?t[r+1]*i:e.length,(c=Rc(e,o,s,i,!1))===c.next&&(c.steiner=!0),l.push(Bc(c));for(l.sort(Fc),r=0;r<l.length;r++)zc(l[r],n),n=Pc(n,n.next);return n}(e,t,d,n)),e.length>80*n){i=a=e[0],r=o=e[1];for(var f=n;f<h;f+=n)(s=e[f])<i&&(i=s),(c=e[f+1])<r&&(r=c),a<s&&(a=s),o<c&&(o=c);l=0!==(l=Math.max(a-i,o-r))?1/l:0}return Cc(d,p,n,i,r,l),p};function Rc(e,t,n,i,r){var a,o;if(r===0<function(e,t,n,i){for(var r=0,a=t,o=n-i;a<n;a+=i)r+=(e[o]-e[a])*(e[a+1]+e[o+1]),o=a;return r}(e,t,n,i))for(a=t;a<n;a+=i)o=Yc(a,e[a],e[a+1],o);else for(a=n-i;t<=a;a-=i)o=Yc(a,e[a],e[a+1],o);return o&&kc(o,o.next)&&(Zc(o),o=o.next),o}function Pc(e,t){if(!e)return e;t=t||e;var n,i=e;do{if(n=!1,i.steiner||!kc(i,i.next)&&0!==Hc(i.prev,i,i.next))i=i.next;else{if(Zc(i),(i=t=i.prev)===i.next)break;n=!0}}while(n||i!==t);return t}function Cc(e,t,n,i,r,a,o){if(e){!o&&a&&function(e,t,n,i){var r=e;for(;null===r.z&&(r.z=Uc(r.x,r.y,t,n,i)),r.prevZ=r.prev,r.nextZ=r.next,r=r.next,r!==e;);r.prevZ.nextZ=null,r.prevZ=null,function(e){var t,n,i,r,a,o,s,c,l=1;do{for(n=e,a=e=null,o=0;n;){for(o++,i=n,t=s=0;t<l&&(s++,i=i.nextZ);t++);for(c=l;0<s||0<c&&i;)0!==s&&(0===c||!i||n.z<=i.z)?(n=(r=n).nextZ,s--):(i=(r=i).nextZ,c--),a?a.nextZ=r:e=r,r.prevZ=a,a=r;n=i}a.nextZ=null,l*=2}while(1<o)}(r)}(e,i,r,a);for(var s,c,l=e;e.prev!==e.next;)if(s=e.prev,c=e.next,a?Oc(e,i,r,a):Ic(e))t.push(s.i/n),t.push(e.i/n),t.push(c.i/n),Zc(e),e=c.next,l=c.next;else if((e=c)===l){o?1===o?Cc(e=Dc(Pc(e),t,n),t,n,i,r,a,2):2===o&&Nc(e,t,n,i,r,a):Cc(Pc(e),t,n,i,r,a,1);break}}}function Ic(e){var t=e.prev,n=e,i=e.next;if(!(0<=Hc(t,n,i))){for(var r=e.next.next;r!==e.prev;){if(Gc(t.x,t.y,n.x,n.y,i.x,i.y,r.x,r.y)&&0<=Hc(r.prev,r,r.next))return;r=r.next}return 1}}function Oc(e,t,n,i){var r=e.prev,a=e,o=e.next;if(!(0<=Hc(r,a,o))){for(var s=r.x<a.x?r.x<o.x?r.x:o.x:a.x<o.x?a.x:o.x,c=r.y<a.y?r.y<o.y?r.y:o.y:a.y<o.y?a.y:o.y,l=r.x>a.x?r.x>o.x?r.x:o.x:a.x>o.x?a.x:o.x,u=r.y>a.y?r.y>o.y?r.y:o.y:a.y>o.y?a.y:o.y,h=Uc(s,c,t,n,i),d=Uc(l,u,t,n,i),p=e.prevZ,f=e.nextZ;p&&p.z>=h&&f&&f.z<=d;){if(p!==e.prev&&p!==e.next&&Gc(r.x,r.y,a.x,a.y,o.x,o.y,p.x,p.y)&&0<=Hc(p.prev,p,p.next))return;if(p=p.prevZ,f!==e.prev&&f!==e.next&&Gc(r.x,r.y,a.x,a.y,o.x,o.y,f.x,f.y)&&0<=Hc(f.prev,f,f.next))return;f=f.nextZ}for(;p&&p.z>=h;){if(p!==e.prev&&p!==e.next&&Gc(r.x,r.y,a.x,a.y,o.x,o.y,p.x,p.y)&&0<=Hc(p.prev,p,p.next))return;p=p.prevZ}for(;f&&f.z<=d;){if(f!==e.prev&&f!==e.next&&Gc(r.x,r.y,a.x,a.y,o.x,o.y,f.x,f.y)&&0<=Hc(f.prev,f,f.next))return;f=f.nextZ}return 1}}function Dc(e,t,n){var i=e;do{var r=i.prev,a=i.next.next;!kc(r,a)&&Vc(r,i,i.next,a)&&qc(r,a)&&qc(a,r)&&(t.push(r.i/n),t.push(i.i/n),t.push(a.i/n),Zc(i),Zc(i.next),i=e=a),i=i.next}while(i!==e);return Pc(i)}function Nc(e,t,n,i,r,a){var o,s,c=e;do{for(var l=c.next.next;l!==c.prev;){if(c.i!==l.i&&(s=l,(o=c).next.i!==s.i&&o.prev.i!==s.i&&!function(e,t){var n=e;do{if(n.i!==e.i&&n.next.i!==e.i&&n.i!==t.i&&n.next.i!==t.i&&Vc(n,n.next,e,t))return 1;n=n.next}while(n!==e);return}(o,s)&&(qc(o,s)&&qc(s,o)&&function(e,t){var n=e,i=!1,r=(e.x+t.x)/2,a=(e.y+t.y)/2;for(;n.y>a!=n.next.y>a&&n.next.y!==n.y&&r<(n.next.x-n.x)*(a-n.y)/(n.next.y-n.y)+n.x&&(i=!i),n=n.next,n!==e;);return i}(o,s)&&(Hc(o.prev,o,s.prev)||Hc(o,s.prev,s))||kc(o,s)&&0<Hc(o.prev,o,o.next)&&0<Hc(s.prev,s,s.next)))){var u=Xc(c,l);return c=Pc(c,c.next),u=Pc(u,u.next),Cc(c,t,n,i,r,a),void Cc(u,t,n,i,r,a)}l=l.next}c=c.next}while(c!==e)}function Fc(e,t){return e.x-t.x}function zc(e,t){if(t=function(e,t){var n,i=t,r=e.x,a=e.y,o=-1/0;do{if(a<=i.y&&a>=i.next.y&&i.next.y!==i.y){var s=i.x+(a-i.y)*(i.next.x-i.x)/(i.next.y-i.y);if(s<=r&&o<s){if((o=s)===r){if(a===i.y)return i;if(a===i.next.y)return i.next}n=i.x<i.next.x?i:i.next}}i=i.next}while(i!==t);if(!n)return null;if(r===o)return n;var c,l=n,u=n.x,h=n.y,d=1/0;i=n;for(;r>=i.x&&i.x>=u&&r!==i.x&&Gc(a<h?r:o,a,u,h,a<h?o:r,a,i.x,i.y)&&(c=Math.abs(a-i.y)/(r-i.x),qc(i,e)&&(c<d||c===d&&(i.x>n.x||i.x===n.x&&(f=i,Hc((p=n).prev,p,f.prev)<0&&Hc(f.next,p,p.next)<0)))&&(n=i,d=c)),i=i.next,i!==l;);var p,f;return n}(e,t)){var n=Xc(t,e);Pc(t,t.next),Pc(n,n.next)}}function Uc(e,t,n,i,r){return(e=1431655765&((e=858993459&((e=252645135&((e=16711935&((e=32767*(e-n)*r)|e<<8))|e<<4))|e<<2))|e<<1))|(t=1431655765&((t=858993459&((t=252645135&((t=16711935&((t=32767*(t-i)*r)|t<<8))|t<<4))|t<<2))|t<<1))<<1}function Bc(e){for(var t=e,n=e;(t.x<n.x||t.x===n.x&&t.y<n.y)&&(n=t),(t=t.next)!==e;);return n}function Gc(e,t,n,i,r,a,o,s){return 0<=(r-o)*(t-s)-(e-o)*(a-s)&&0<=(e-o)*(i-s)-(n-o)*(t-s)&&0<=(n-o)*(a-s)-(r-o)*(i-s)}function Hc(e,t,n){return(t.y-e.y)*(n.x-t.x)-(t.x-e.x)*(n.y-t.y)}function kc(e,t){return e.x===t.x&&e.y===t.y}function Vc(e,t,n,i){var r=Wc(Hc(e,t,n)),a=Wc(Hc(e,t,i)),o=Wc(Hc(n,i,e)),s=Wc(Hc(n,i,t));return r!==a&&o!==s||(0===r&&jc(e,n,t)||(0===a&&jc(e,i,t)||(0===o&&jc(n,e,i)||!(0!==s||!jc(n,t,i)))))}function jc(e,t,n){return t.x<=Math.max(e.x,n.x)&&t.x>=Math.min(e.x,n.x)&&t.y<=Math.max(e.y,n.y)&&t.y>=Math.min(e.y,n.y)}function Wc(e){return 0<e?1:e<0?-1:0}function qc(e,t){return Hc(e.prev,e,e.next)<0?0<=Hc(e,t,e.next)&&0<=Hc(e,e.prev,t):Hc(e,t,e.prev)<0||Hc(e,e.next,t)<0}function Xc(e,t){var n=new Jc(e.i,e.x,e.y),i=new Jc(t.i,t.x,t.y),r=e.next,a=t.prev;return(e.next=t).prev=e,(n.next=r).prev=n,(i.next=n).prev=i,(a.next=i).prev=a,i}function Yc(e,t,n,i){var r=new Jc(e,t,n);return i?(r.next=i.next,(r.prev=i).next.prev=r,i.next=r):(r.prev=r).next=r,r}function Zc(e){e.next.prev=e.prev,e.prev.next=e.next,e.prevZ&&(e.prevZ.nextZ=e.nextZ),e.nextZ&&(e.nextZ.prevZ=e.prevZ)}function Jc(e,t,n){this.i=e,this.x=t,this.y=n,this.prev=null,this.next=null,this.z=null,this.prevZ=null,this.nextZ=null,this.steiner=!1}var Kc={area:function(e){for(var t=e.length,n=0,i=t-1,r=0;r<t;i=r++)n+=e[i].x*e[r].y-e[r].x*e[i].y;return.5*n},isClockWise:function(e){return Kc.area(e)<0},triangulateShape:function(e,t){var n=[],i=[],r=[];Qc(e),$c(n,e);var a=e.length;t.forEach(Qc);for(var o=0;o<t.length;o++)i.push(a),a+=t[o].length,$c(n,t[o]);var s=Lc(n,i);for(o=0;o<s.length;o+=3)r.push(s.slice(o,o+3));return r}};function Qc(e){var t=e.length;2<t&&e[t-1].equals(e[0])&&e.pop()}function $c(e,t){for(var n=0;n<t.length;n++)e.push(t[n].x),e.push(t[n].y)}function el(e,t){Or.call(this),this.type="ExtrudeGeometry",this.parameters={shapes:e,options:t},this.fromBufferGeometry(new tl(e,t)),this.mergeVertices()}function tl(e,K){cr.call(this),this.type="ExtrudeBufferGeometry",this.parameters={shapes:e,options:K},e=Array.isArray(e)?e:[e];for(var Q=this,$=[],ee=[],t=0,n=e.length;t<n;t++){i(e[t])}function i(e){var i=[],t=void 0!==K.curveSegments?K.curveSegments:12,c=void 0!==K.steps?K.steps:1,n=void 0!==K.depth?K.depth:100,r=void 0===K.bevelEnabled||K.bevelEnabled,a=void 0!==K.bevelThickness?K.bevelThickness:6,o=void 0!==K.bevelSize?K.bevelSize:a-2,s=void 0!==K.bevelOffset?K.bevelOffset:0,l=void 0!==K.bevelSegments?K.bevelSegments:3,u=K.extrudePath,h=void 0!==K.UVGenerator?K.UVGenerator:nl;void 0!==K.amount&&(console.warn("THREE.ExtrudeBufferGeometry: amount has been renamed to depth."),n=K.amount);var d,p,f,m,v,g,y,_,x=!1;u&&(d=u.getSpacedPoints(c),r=!(x=!0),p=u.computeFrenetFrames(c,!1),f=new gn,m=new gn,v=new gn),r||(s=o=a=l=0);var b=e.extractPoints(t),w=b.shape,M=b.holes;if(!Kc.isClockWise(w))for(w=w.reverse(),y=0,_=M.length;y<_;y++)g=M[y],Kc.isClockWise(g)&&(M[y]=g.reverse());var S=Kc.triangulateShape(w,M),T=w;for(y=0,_=M.length;y<_;y++)g=M[y],w=w.concat(g);function E(e,t,n){return t||console.error("THREE.ExtrudeGeometry: vec does not exist"),t.clone().multiplyScalar(n).add(e)}var A,L,R,P,C,I,O=w.length,D=S.length;function N(e,t,n){var i,r,a,o=e.x-t.x,s=e.y-t.y,c=n.x-e.x,l=n.y-e.y,u=o*o+s*s,h=o*l-s*c;if(Math.abs(h)>Number.EPSILON){var d=Math.sqrt(u),p=Math.sqrt(c*c+l*l),f=t.x-s/d,m=t.y+o/d,v=((n.x-l/p-f)*l-(n.y+c/p-m)*c)/(o*l-s*c),g=(i=f+o*v-e.x)*i+(r=m+s*v-e.y)*r;if(g<=2)return new on(i,r);a=Math.sqrt(g/2)}else{var y=!1;o>Number.EPSILON?c>Number.EPSILON&&(y=!0):o<-Number.EPSILON?c<-Number.EPSILON&&(y=!0):Math.sign(s)===Math.sign(l)&&(y=!0),a=y?(i=-s,r=o,Math.sqrt(u)):(i=o,r=s,Math.sqrt(u/2))}return new on(i/a,r/a)}for(var F=[],z=0,U=T.length,B=U-1,G=z+1;z<U;z++,B++,G++)B===U&&(B=0),G===U&&(G=0),F[z]=N(T[z],T[B],T[G]);var H,k,V=[],j=F.concat();for(y=0,_=M.length;y<_;y++){for(g=M[y],H=[],z=0,B=(U=g.length)-1,G=z+1;z<U;z++,B++,G++)B===U&&(B=0),G===U&&(G=0),H[z]=N(g[z],g[B],g[G]);V.push(H),j=j.concat(H)}for(A=0;A<l;A++){for(R=A/l,P=a*Math.cos(R*Math.PI/2),L=o*Math.sin(R*Math.PI/2)+s,z=0,U=T.length;z<U;z++)q((C=E(T[z],F[z],L)).x,C.y,-P);for(y=0,_=M.length;y<_;y++)for(g=M[y],H=V[y],z=0,U=g.length;z<U;z++)q((C=E(g[z],H[z],L)).x,C.y,-P)}for(L=o+s,z=0;z<O;z++)C=r?E(w[z],j[z],L):w[z],x?(m.copy(p.normals[0]).multiplyScalar(C.x),f.copy(p.binormals[0]).multiplyScalar(C.y),v.copy(d[0]).add(m).add(f),q(v.x,v.y,v.z)):q(C.x,C.y,0);for(k=1;k<=c;k++)for(z=0;z<O;z++)C=r?E(w[z],j[z],L):w[z],x?(m.copy(p.normals[k]).multiplyScalar(C.x),f.copy(p.binormals[k]).multiplyScalar(C.y),v.copy(d[k]).add(m).add(f),q(v.x,v.y,v.z)):q(C.x,C.y,n/c*k);for(A=l-1;0<=A;A--){for(R=A/l,P=a*Math.cos(R*Math.PI/2),L=o*Math.sin(R*Math.PI/2)+s,z=0,U=T.length;z<U;z++)q((C=E(T[z],F[z],L)).x,C.y,n+P);for(y=0,_=M.length;y<_;y++)for(g=M[y],H=V[y],z=0,U=g.length;z<U;z++)C=E(g[z],H[z],L),x?q(C.x,C.y+d[c-1].y,d[c-1].x+P):q(C.x,C.y,n+P)}function W(e,t){var n,i;for(z=e.length;0<=--z;){(i=(n=z)-1)<0&&(i=e.length-1);var r=0,a=c+2*l;for(r=0;r<a;r++){var o=O*r,s=O*(r+1);Y(t+n+o,t+i+o,t+i+s,t+n+s)}}}function q(e,t,n){i.push(e),i.push(t),i.push(n)}function X(e,t,n){Z(e),Z(t),Z(n);var i=$.length/3,r=h.generateTopUV(Q,$,i-3,i-2,i-1);J(r[0]),J(r[1]),J(r[2])}function Y(e,t,n,i){Z(e),Z(t),Z(i),Z(t),Z(n),Z(i);var r=$.length/3,a=h.generateSideWallUV(Q,$,r-6,r-3,r-2,r-1);J(a[0]),J(a[1]),J(a[3]),J(a[1]),J(a[2]),J(a[3])}function Z(e){$.push(i[3*e+0]),$.push(i[3*e+1]),$.push(i[3*e+2])}function J(e){ee.push(e.x),ee.push(e.y)}!function(){var e=$.length/3;if(r){var t=0,n=O*t;for(z=0;z<D;z++)X((I=S[z])[2]+n,I[1]+n,I[0]+n);for(n=O*(t=c+2*l),z=0;z<D;z++)X((I=S[z])[0]+n,I[1]+n,I[2]+n)}else{for(z=0;z<D;z++)X((I=S[z])[2],I[1],I[0]);for(z=0;z<D;z++)X((I=S[z])[0]+O*c,I[1]+O*c,I[2]+O*c)}Q.addGroup(e,$.length/3-e,0)}(),function(){var e=$.length/3,t=0;for(W(T,t),t+=T.length,y=0,_=M.length;y<_;y++)W(g=M[y],t),t+=g.length;Q.addGroup(e,$.length/3-e,1)}()}this.setAttribute("position",new Ki($,3)),this.setAttribute("uv",new Ki(ee,2)),this.computeVertexNormals()}((el.prototype=Object.create(Or.prototype)).constructor=el).prototype.toJSON=function(){var e=Or.prototype.toJSON.call(this);return il(this.parameters.shapes,this.parameters.options,e)},((tl.prototype=Object.create(cr.prototype)).constructor=tl).prototype.toJSON=function(){var e=cr.prototype.toJSON.call(this);return il(this.parameters.shapes,this.parameters.options,e)};var nl={generateTopUV:function(e,t,n,i,r){var a=t[3*n],o=t[3*n+1],s=t[3*i],c=t[3*i+1],l=t[3*r],u=t[3*r+1];return[new on(a,o),new on(s,c),new on(l,u)]},generateSideWallUV:function(e,t,n,i,r,a){var o=t[3*n],s=t[3*n+1],c=t[3*n+2],l=t[3*i],u=t[3*i+1],h=t[3*i+2],d=t[3*r],p=t[3*r+1],f=t[3*r+2],m=t[3*a],v=t[3*a+1],g=t[3*a+2];return Math.abs(s-u)<.01?[new on(o,1-c),new on(l,1-h),new on(d,1-f),new on(m,1-g)]:[new on(s,1-c),new on(u,1-h),new on(p,1-f),new on(v,1-g)]}};function il(e,t,n){if(n.shapes=[],Array.isArray(e))for(var i=0,r=e.length;i<r;i++){var a=e[i];n.shapes.push(a.uuid)}else n.shapes.push(e.uuid);return void 0!==t.extrudePath&&(n.options.extrudePath=t.extrudePath.toJSON()),n}function rl(e,t){Or.call(this),this.type="TextGeometry",this.parameters={text:e,parameters:t},this.fromBufferGeometry(new al(e,t)),this.mergeVertices()}function al(e,t){var n=(t=t||{}).font;if(!n||!n.isFont)return console.error("THREE.TextGeometry: font parameter is not an instance of THREE.Font."),new Or;var i=n.generateShapes(e,t.size);t.depth=void 0!==t.height?t.height:50,void 0===t.bevelThickness&&(t.bevelThickness=10),void 0===t.bevelSize&&(t.bevelSize=8),void 0===t.bevelEnabled&&(t.bevelEnabled=!1),tl.call(this,i,t),this.type="TextBufferGeometry"}function ol(e,t,n,i,r,a,o){Or.call(this),this.type="SphereGeometry",this.parameters={radius:e,widthSegments:t,heightSegments:n,phiStart:i,phiLength:r,thetaStart:a,thetaLength:o},this.fromBufferGeometry(new sl(e,t,n,i,r,a,o)),this.mergeVertices()}function sl(e,t,n,i,r,a,o){cr.call(this),this.type="SphereBufferGeometry",this.parameters={radius:e,widthSegments:t,heightSegments:n,phiStart:i,phiLength:r,thetaStart:a,thetaLength:o},e=e||1,t=Math.max(3,Math.floor(t)||8),n=Math.max(2,Math.floor(n)||6),i=void 0!==i?i:0,r=void 0!==r?r:2*Math.PI,a=void 0!==a?a:0,o=void 0!==o?o:Math.PI;var s,c,l=Math.min(a+o,Math.PI),u=0,h=[],d=new gn,p=new gn,f=[],m=[],v=[],g=[];for(c=0;c<=n;c++){var y=[],_=c/n,x=0;for(0==c&&0==a?x=.5/t:c==n&&l==Math.PI&&(x=-.5/t),s=0;s<=t;s++){var b=s/t;d.x=-e*Math.cos(i+b*r)*Math.sin(a+_*o),d.y=e*Math.cos(a+_*o),d.z=e*Math.sin(i+b*r)*Math.sin(a+_*o),m.push(d.x,d.y,d.z),p.copy(d).normalize(),v.push(p.x,p.y,p.z),g.push(b+x,1-_),y.push(u++)}h.push(y)}for(c=0;c<n;c++)for(s=0;s<t;s++){var w=h[c][s+1],M=h[c][s],S=h[c+1][s],T=h[c+1][s+1];(0!==c||0<a)&&f.push(w,M,T),(c!==n-1||l<Math.PI)&&f.push(M,S,T)}this.setIndex(f),this.setAttribute("position",new Ki(m,3)),this.setAttribute("normal",new Ki(v,3)),this.setAttribute("uv",new Ki(g,2))}function cl(e,t,n,i,r,a){Or.call(this),this.type="RingGeometry",this.parameters={innerRadius:e,outerRadius:t,thetaSegments:n,phiSegments:i,thetaStart:r,thetaLength:a},this.fromBufferGeometry(new ll(e,t,n,i,r,a)),this.mergeVertices()}function ll(e,t,n,i,r,a){cr.call(this),this.type="RingBufferGeometry",this.parameters={innerRadius:e,outerRadius:t,thetaSegments:n,phiSegments:i,thetaStart:r,thetaLength:a},e=e||.5,t=t||1,r=void 0!==r?r:0,a=void 0!==a?a:2*Math.PI,n=void 0!==n?Math.max(3,n):8;var o,s,c,l=[],u=[],h=[],d=[],p=e,f=(t-e)/(i=void 0!==i?Math.max(1,i):1),m=new gn,v=new on;for(s=0;s<=i;s++){for(c=0;c<=n;c++)o=r+c/n*a,m.x=p*Math.cos(o),m.y=p*Math.sin(o),u.push(m.x,m.y,m.z),h.push(0,0,1),v.x=(m.x/t+1)/2,v.y=(m.y/t+1)/2,d.push(v.x,v.y);p+=f}for(s=0;s<i;s++){var g=s*(n+1);for(c=0;c<n;c++){var y=o=c+g,_=o+n+1,x=o+n+2,b=o+1;l.push(y,_,b),l.push(_,x,b)}}this.setIndex(l),this.setAttribute("position",new Ki(u,3)),this.setAttribute("normal",new Ki(h,3)),this.setAttribute("uv",new Ki(d,2))}function ul(e,t,n,i){Or.call(this),this.type="LatheGeometry",this.parameters={points:e,segments:t,phiStart:n,phiLength:i},this.fromBufferGeometry(new hl(e,t,n,i)),this.mergeVertices()}function hl(e,t,n,i){cr.call(this),this.type="LatheBufferGeometry",this.parameters={points:e,segments:t,phiStart:n,phiLength:i},t=Math.floor(t)||12,n=n||0,i=i||2*Math.PI,i=an.clamp(i,0,2*Math.PI);var r,a,o,s=[],c=[],l=[],u=1/t,h=new gn,d=new on;for(a=0;a<=t;a++){var p=n+a*u*i,f=Math.sin(p),m=Math.cos(p);for(o=0;o<=e.length-1;o++)h.x=e[o].x*f,h.y=e[o].y,h.z=e[o].x*m,c.push(h.x,h.y,h.z),d.x=a/t,d.y=o/(e.length-1),l.push(d.x,d.y)}for(a=0;a<t;a++)for(o=0;o<e.length-1;o++){var v=r=o+a*e.length,g=r+e.length,y=r+e.length+1,_=r+1;s.push(v,g,_),s.push(g,y,_)}if(this.setIndex(s),this.setAttribute("position",new Ki(c,3)),this.setAttribute("uv",new Ki(l,2)),this.computeVertexNormals(),i===2*Math.PI){var x=this.attributes.normal.array,b=new gn,w=new gn,M=new gn;for(r=t*e.length*3,o=a=0;a<e.length;a++,o+=3)b.x=x[o+0],b.y=x[o+1],b.z=x[o+2],w.x=x[r+o+0],w.y=x[r+o+1],w.z=x[r+o+2],M.addVectors(b,w).normalize(),x[o+0]=x[r+o+0]=M.x,x[o+1]=x[r+o+1]=M.y,x[o+2]=x[r+o+2]=M.z}}function dl(e,t){Or.call(this),this.type="ShapeGeometry","object"==typeof t&&(console.warn("THREE.ShapeGeometry: Options parameter has been removed."),t=t.curveSegments),this.parameters={shapes:e,curveSegments:t},this.fromBufferGeometry(new pl(e,t)),this.mergeVertices()}function pl(e,f){cr.call(this),this.type="ShapeBufferGeometry",this.parameters={shapes:e,curveSegments:f},f=f||12;var m=[],v=[],g=[],y=[],t=0,_=0;if(!1===Array.isArray(e))i(e);else for(var n=0;n<e.length;n++)i(e[n]),this.addGroup(t,_,n),t+=_,_=0;function i(e){var t,n,i,r=v.length/3,a=e.extractPoints(f),o=a.shape,s=a.holes;for(!1===Kc.isClockWise(o)&&(o=o.reverse()),t=0,n=s.length;t<n;t++)i=s[t],!0===Kc.isClockWise(i)&&(s[t]=i.reverse());var c=Kc.triangulateShape(o,s);for(t=0,n=s.length;t<n;t++)i=s[t],o=o.concat(i);for(t=0,n=o.length;t<n;t++){var l=o[t];v.push(l.x,l.y,0),g.push(0,0,1),y.push(l.x,l.y)}for(t=0,n=c.length;t<n;t++){var u=c[t],h=u[0]+r,d=u[1]+r,p=u[2]+r;m.push(h,d,p),_+=3}}this.setIndex(m),this.setAttribute("position",new Ki(v,3)),this.setAttribute("normal",new Ki(g,3)),this.setAttribute("uv",new Ki(y,2))}function fl(e,t){if(t.shapes=[],Array.isArray(e))for(var n=0,i=e.length;n<i;n++){var r=e[n];t.shapes.push(r.uuid)}else t.shapes.push(e.uuid);return t}function ml(e,t){cr.call(this),this.type="EdgesGeometry",this.parameters={thresholdAngle:t},t=void 0!==t?t:1;var n,i,r,a,o=[],s=Math.cos(an.DEG2RAD*t),c=[0,0],l={},u=["a","b","c"];e.isBufferGeometry?(a=new Or).fromBufferGeometry(e):a=e.clone(),a.mergeVertices(),a.computeFaceNormals();for(var h=a.vertices,d=a.faces,p=0,f=d.length;p<f;p++)for(var m=d[p],v=0;v<3;v++)n=m[u[v]],i=m[u[(v+1)%3]],c[0]=Math.min(n,i),c[1]=Math.max(n,i),void 0===l[r=c[0]+","+c[1]]?l[r]={index1:c[0],index2:c[1],face1:p,face2:void 0}:l[r].face2=p;for(r in l){var g=l[r];if(void 0===g.face2||d[g.face1].normal.dot(d[g.face2].normal)<=s){var y=h[g.index1];o.push(y.x,y.y,y.z),y=h[g.index2],o.push(y.x,y.y,y.z)}}this.setAttribute("position",new Ki(o,3))}function vl(e,t,n,i,r,a,o,s){Or.call(this),this.type="CylinderGeometry",this.parameters={radiusTop:e,radiusBottom:t,height:n,radialSegments:i,heightSegments:r,openEnded:a,thetaStart:o,thetaLength:s},this.fromBufferGeometry(new gl(e,t,n,i,r,a,o,s)),this.mergeVertices()}function gl(g,y,_,x,b,e,w,M){cr.call(this),this.type="CylinderBufferGeometry",this.parameters={radiusTop:g,radiusBottom:y,height:_,radialSegments:x,heightSegments:b,openEnded:e,thetaStart:w,thetaLength:M};var S=this;g=void 0!==g?g:1,y=void 0!==y?y:1,_=_||1,x=Math.floor(x)||8,b=Math.floor(b)||1,e=void 0!==e&&e,w=void 0!==w?w:0,M=void 0!==M?M:2*Math.PI;var T=[],E=[],A=[],L=[],R=0,P=[],C=_/2,I=0;function t(e){var t,n,i,r=new on,a=new gn,o=0,s=!0===e?g:y,c=!0===e?1:-1;for(n=R,t=1;t<=x;t++)E.push(0,C*c,0),A.push(0,c,0),L.push(.5,.5),R++;for(i=R,t=0;t<=x;t++){var l=t/x*M+w,u=Math.cos(l),h=Math.sin(l);a.x=s*h,a.y=C*c,a.z=s*u,E.push(a.x,a.y,a.z),A.push(0,c,0),r.x=.5*u+.5,r.y=.5*h*c+.5,L.push(r.x,r.y),R++}for(t=0;t<x;t++){var d=n+t,p=i+t;!0===e?T.push(p,p+1,d):T.push(p+1,p,d),o+=3}S.addGroup(I,o,!0===e?1:2),I+=o}!function(){var e,t,n=new gn,i=new gn,r=0,a=(y-g)/_;for(t=0;t<=b;t++){var o=[],s=t/b,c=s*(y-g)+g;for(e=0;e<=x;e++){var l=e/x,u=l*M+w,h=Math.sin(u),d=Math.cos(u);i.x=c*h,i.y=-s*_+C,i.z=c*d,E.push(i.x,i.y,i.z),n.set(h,a,d).normalize(),A.push(n.x,n.y,n.z),L.push(l,1-s),o.push(R++)}P.push(o)}for(e=0;e<x;e++)for(t=0;t<b;t++){var p=P[t][e],f=P[t+1][e],m=P[t+1][e+1],v=P[t][e+1];T.push(p,f,v),T.push(f,m,v),r+=6}S.addGroup(I,r,0),I+=r}(),!1===e&&(0<g&&t(!0),0<y&&t(!1)),this.setIndex(T),this.setAttribute("position",new Ki(E,3)),this.setAttribute("normal",new Ki(A,3)),this.setAttribute("uv",new Ki(L,2))}function yl(e,t,n,i,r,a,o){vl.call(this,0,e,t,n,i,r,a,o),this.type="ConeGeometry",this.parameters={radius:e,height:t,radialSegments:n,heightSegments:i,openEnded:r,thetaStart:a,thetaLength:o}}function _l(e,t,n,i,r,a,o){gl.call(this,0,e,t,n,i,r,a,o),this.type="ConeBufferGeometry",this.parameters={radius:e,height:t,radialSegments:n,heightSegments:i,openEnded:r,thetaStart:a,thetaLength:o}}function xl(e,t,n,i){Or.call(this),this.type="CircleGeometry",this.parameters={radius:e,segments:t,thetaStart:n,thetaLength:i},this.fromBufferGeometry(new bl(e,t,n,i)),this.mergeVertices()}function bl(e,t,n,i){cr.call(this),this.type="CircleBufferGeometry",this.parameters={radius:e,segments:t,thetaStart:n,thetaLength:i},e=e||1,t=void 0!==t?Math.max(3,t):8,n=void 0!==n?n:0,i=void 0!==i?i:2*Math.PI;var r,a,o=[],s=[],c=[],l=[],u=new gn,h=new on;for(s.push(0,0,0),c.push(0,0,1),l.push(.5,.5),a=0,r=3;a<=t;a++,r+=3){var d=n+a/t*i;u.x=e*Math.cos(d),u.y=e*Math.sin(d),s.push(u.x,u.y,u.z),c.push(0,0,1),h.x=(s[r]/e+1)/2,h.y=(s[r+1]/e+1)/2,l.push(h.x,h.y)}for(r=1;r<=t;r++)o.push(r,r+1,0);this.setIndex(o),this.setAttribute("position",new Ki(s,3)),this.setAttribute("normal",new Ki(c,3)),this.setAttribute("uv",new Ki(l,2))}(rl.prototype=Object.create(Or.prototype)).constructor=rl,(al.prototype=Object.create(tl.prototype)).constructor=al,(ol.prototype=Object.create(Or.prototype)).constructor=ol,(sl.prototype=Object.create(cr.prototype)).constructor=sl,(cl.prototype=Object.create(Or.prototype)).constructor=cl,(ll.prototype=Object.create(cr.prototype)).constructor=ll,(ul.prototype=Object.create(Or.prototype)).constructor=ul,(hl.prototype=Object.create(cr.prototype)).constructor=hl,((dl.prototype=Object.create(Or.prototype)).constructor=dl).prototype.toJSON=function(){var e=Or.prototype.toJSON.call(this);return fl(this.parameters.shapes,e)},((pl.prototype=Object.create(cr.prototype)).constructor=pl).prototype.toJSON=function(){var e=cr.prototype.toJSON.call(this);return fl(this.parameters.shapes,e)},(ml.prototype=Object.create(cr.prototype)).constructor=ml,(vl.prototype=Object.create(Or.prototype)).constructor=vl,(gl.prototype=Object.create(cr.prototype)).constructor=gl,(yl.prototype=Object.create(vl.prototype)).constructor=yl,(_l.prototype=Object.create(gl.prototype)).constructor=_l,(xl.prototype=Object.create(Or.prototype)).constructor=xl,(bl.prototype=Object.create(cr.prototype)).constructor=bl;var wl=Object.freeze({__proto__:null,WireframeGeometry:lc,ParametricGeometry:uc,ParametricBufferGeometry:hc,TetrahedronGeometry:fc,TetrahedronBufferGeometry:mc,OctahedronGeometry:vc,OctahedronBufferGeometry:gc,IcosahedronGeometry:yc,IcosahedronBufferGeometry:_c,DodecahedronGeometry:xc,DodecahedronBufferGeometry:bc,PolyhedronGeometry:dc,PolyhedronBufferGeometry:pc,TubeGeometry:wc,TubeBufferGeometry:Mc,TorusKnotGeometry:Sc,TorusKnotBufferGeometry:Tc,TorusGeometry:Ec,TorusBufferGeometry:Ac,TextGeometry:rl,TextBufferGeometry:al,SphereGeometry:ol,SphereBufferGeometry:sl,RingGeometry:cl,RingBufferGeometry:ll,PlaneGeometry:$r,PlaneBufferGeometry:ea,LatheGeometry:ul,LatheBufferGeometry:hl,ShapeGeometry:dl,ShapeBufferGeometry:pl,ExtrudeGeometry:el,ExtrudeBufferGeometry:tl,EdgesGeometry:ml,ConeGeometry:yl,ConeBufferGeometry:_l,CylinderGeometry:vl,CylinderBufferGeometry:gl,CircleGeometry:xl,CircleBufferGeometry:bl,BoxGeometry:Dr,BoxBufferGeometry:Nr});function Ml(e){Gi.call(this),this.type="ShadowMaterial",this.color=new Di(0),this.transparent=!0,this.setValues(e)}function Sl(e){Hr.call(this,e),this.type="RawShaderMaterial"}function Tl(e){Gi.call(this),this.defines={STANDARD:""},this.type="MeshStandardMaterial",this.color=new Di(16777215),this.roughness=1,this.metalness=0,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new Di(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=Yt,this.normalScale=new on(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.roughnessMap=null,this.metalnessMap=null,this.alphaMap=null,this.envMap=null,this.envMapIntensity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.skinning=!1,this.morphTargets=!1,this.morphNormals=!1,this.vertexTangents=!1,this.setValues(e)}function El(e){Tl.call(this),this.defines={STANDARD:"",PHYSICAL:""},this.type="MeshPhysicalMaterial",this.clearcoat=0,this.clearcoatMap=null,this.clearcoatRoughness=0,this.clearcoatRoughnessMap=null,this.clearcoatNormalScale=new on(1,1),this.clearcoatNormalMap=null,this.reflectivity=.5,this.sheen=null,this.transparency=0,this.setValues(e)}function Al(e){Gi.call(this),this.type="MeshPhongMaterial",this.color=new Di(16777215),this.specular=new Di(1118481),this.shininess=30,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new Di(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=Yt,this.normalScale=new on(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.combine=G,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.skinning=!1,this.morphTargets=!1,this.morphNormals=!1,this.setValues(e)}function Ll(e){Gi.call(this),this.defines={TOON:""},this.type="MeshToonMaterial",this.color=new Di(16777215),this.specular=new Di(1118481),this.shininess=30,this.map=null,this.gradientMap=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new Di(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=Yt,this.normalScale=new on(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.skinning=!1,this.morphTargets=!1,this.morphNormals=!1,this.setValues(e)}function Rl(e){Gi.call(this),this.type="MeshNormalMaterial",this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=Yt,this.normalScale=new on(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.wireframe=!1,this.wireframeLinewidth=1,this.fog=!1,this.skinning=!1,this.morphTargets=!1,this.morphNormals=!1,this.setValues(e)}function Pl(e){Gi.call(this),this.type="MeshLambertMaterial",this.color=new Di(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new Di(0),this.emissiveIntensity=1,this.emissiveMap=null,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.combine=G,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.skinning=!1,this.morphTargets=!1,this.morphNormals=!1,this.setValues(e)}function Cl(e){Gi.call(this),this.defines={MATCAP:""},this.type="MeshMatcapMaterial",this.color=new Di(16777215),this.matcap=null,this.map=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=Yt,this.normalScale=new on(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.alphaMap=null,this.skinning=!1,this.morphTargets=!1,this.morphNormals=!1,this.setValues(e)}function Il(e){Hs.call(this),this.type="LineDashedMaterial",this.scale=1,this.dashSize=3,this.gapSize=1,this.setValues(e)}((Ml.prototype=Object.create(Gi.prototype)).constructor=Ml).prototype.isShadowMaterial=!0,Ml.prototype.copy=function(e){return Gi.prototype.copy.call(this,e),this.color.copy(e.color),this},((Sl.prototype=Object.create(Hr.prototype)).constructor=Sl).prototype.isRawShaderMaterial=!0,((Tl.prototype=Object.create(Gi.prototype)).constructor=Tl).prototype.isMeshStandardMaterial=!0,Tl.prototype.copy=function(e){return Gi.prototype.copy.call(this,e),this.defines={STANDARD:""},this.color.copy(e.color),this.roughness=e.roughness,this.metalness=e.metalness,this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.roughnessMap=e.roughnessMap,this.metalnessMap=e.metalnessMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.envMapIntensity=e.envMapIntensity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.skinning=e.skinning,this.morphTargets=e.morphTargets,this.morphNormals=e.morphNormals,this.vertexTangents=e.vertexTangents,this},((El.prototype=Object.create(Tl.prototype)).constructor=El).prototype.isMeshPhysicalMaterial=!0,El.prototype.copy=function(e){return Tl.prototype.copy.call(this,e),this.defines={STANDARD:"",PHYSICAL:""},this.clearcoat=e.clearcoat,this.clearcoatMap=e.clearcoatMap,this.clearcoatRoughness=e.clearcoatRoughness,this.clearcoatRoughnessMap=e.clearcoatRoughnessMap,this.clearcoatNormalMap=e.clearcoatNormalMap,this.clearcoatNormalScale.copy(e.clearcoatNormalScale),this.reflectivity=e.reflectivity,e.sheen?this.sheen=(this.sheen||new Di).copy(e.sheen):this.sheen=null,this.transparency=e.transparency,this},((Al.prototype=Object.create(Gi.prototype)).constructor=Al).prototype.isMeshPhongMaterial=!0,Al.prototype.copy=function(e){return Gi.prototype.copy.call(this,e),this.color.copy(e.color),this.specular.copy(e.specular),this.shininess=e.shininess,this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.combine=e.combine,this.reflectivity=e.reflectivity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.skinning=e.skinning,this.morphTargets=e.morphTargets,this.morphNormals=e.morphNormals,this},((Ll.prototype=Object.create(Gi.prototype)).constructor=Ll).prototype.isMeshToonMaterial=!0,Ll.prototype.copy=function(e){return Gi.prototype.copy.call(this,e),this.color.copy(e.color),this.specular.copy(e.specular),this.shininess=e.shininess,this.map=e.map,this.gradientMap=e.gradientMap,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.skinning=e.skinning,this.morphTargets=e.morphTargets,this.morphNormals=e.morphNormals,this},((Rl.prototype=Object.create(Gi.prototype)).constructor=Rl).prototype.isMeshNormalMaterial=!0,Rl.prototype.copy=function(e){return Gi.prototype.copy.call(this,e),this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.skinning=e.skinning,this.morphTargets=e.morphTargets,this.morphNormals=e.morphNormals,this},((Pl.prototype=Object.create(Gi.prototype)).constructor=Pl).prototype.isMeshLambertMaterial=!0,Pl.prototype.copy=function(e){return Gi.prototype.copy.call(this,e),this.color.copy(e.color),this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.combine=e.combine,this.reflectivity=e.reflectivity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.skinning=e.skinning,this.morphTargets=e.morphTargets,this.morphNormals=e.morphNormals,this},((Cl.prototype=Object.create(Gi.prototype)).constructor=Cl).prototype.isMeshMatcapMaterial=!0,Cl.prototype.copy=function(e){return Gi.prototype.copy.call(this,e),this.defines={MATCAP:""},this.color.copy(e.color),this.matcap=e.matcap,this.map=e.map,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.alphaMap=e.alphaMap,this.skinning=e.skinning,this.morphTargets=e.morphTargets,this.morphNormals=e.morphNormals,this},((Il.prototype=Object.create(Hs.prototype)).constructor=Il).prototype.isLineDashedMaterial=!0,Il.prototype.copy=function(e){return Hs.prototype.copy.call(this,e),this.scale=e.scale,this.dashSize=e.dashSize,this.gapSize=e.gapSize,this};var Ol=Object.freeze({__proto__:null,ShadowMaterial:Ml,SpriteMaterial:cs,RawShaderMaterial:Sl,ShaderMaterial:Hr,PointsMaterial:Qs,MeshPhysicalMaterial:El,MeshStandardMaterial:Tl,MeshPhongMaterial:Al,MeshToonMaterial:Ll,MeshNormalMaterial:Rl,MeshLambertMaterial:Pl,MeshDepthMaterial:Vo,MeshDistanceMaterial:jo,MeshBasicMaterial:Hi,MeshMatcapMaterial:Cl,LineDashedMaterial:Il,LineBasicMaterial:Hs,Material:Gi}),Dl={arraySlice:function(e,t,n){return Dl.isTypedArray(e)?new e.constructor(e.subarray(t,void 0!==n?n:e.length)):e.slice(t,n)},convertArray:function(e,t,n){return!e||!n&&e.constructor===t?e:"number"==typeof t.BYTES_PER_ELEMENT?new t(e):Array.prototype.slice.call(e)},isTypedArray:function(e){return ArrayBuffer.isView(e)&&!(e instanceof DataView)},getKeyframeOrder:function(n){for(var e=n.length,t=new Array(e),i=0;i!==e;++i)t[i]=i;return t.sort(function(e,t){return n[e]-n[t]}),t},sortedArray:function(e,t,n){for(var i=e.length,r=new e.constructor(i),a=0,o=0;o!==i;++a)for(var s=n[a]*t,c=0;c!==t;++c)r[o++]=e[s+c];return r},flattenJSON:function(e,t,n,i){for(var r=1,a=e[0];void 0!==a&&void 0===a[i];)a=e[r++];if(void 0!==a){var o=a[i];if(void 0!==o)if(Array.isArray(o))for(;void 0!==(o=a[i])&&(t.push(a.time),n.push.apply(n,o)),void 0!==(a=e[r++]););else if(void 0!==o.toArray)for(;void 0!==(o=a[i])&&(t.push(a.time),o.toArray(n,n.length)),void 0!==(a=e[r++]););else for(;void 0!==(o=a[i])&&(t.push(a.time),n.push(o)),void 0!==(a=e[r++]););}},subclip:function(e,t,n,i,r){r=r||30;var a=e.clone();a.name=t;for(var o=[],s=0;s<a.tracks.length;++s){for(var c=a.tracks[s],l=c.getValueSize(),u=[],h=[],d=0;d<c.times.length;++d){var p=c.times[d]*r;if(!(p<n||i<=p)){u.push(c.times[d]);for(var f=0;f<l;++f)h.push(c.values[d*l+f])}}0!==u.length&&(c.times=Dl.convertArray(u,c.times.constructor),c.values=Dl.convertArray(h,c.values.constructor),o.push(c))}a.tracks=o;var m=1/0;for(s=0;s<a.tracks.length;++s)m>a.tracks[s].times[0]&&(m=a.tracks[s].times[0]);for(s=0;s<a.tracks.length;++s)a.tracks[s].shift(-1*m);return a.resetDuration(),a},makeClipAdditive:function(e,t,n,i){void 0===t&&(t=0),void 0===n&&(n=e),(void 0===i||i<=0)&&(i=30);for(var r=e.tracks.length,a=t/i,o=0;o<r;++o){var s=n.tracks[o],c=s.ValueTypeName;if("bool"!==c&&"string"!==c){var l=e.tracks.find(function(e){return e.name===s.name&&e.ValueTypeName===c});if(void 0!==l){var u,h=s.getValueSize(),d=s.times.length-1;if(a<=s.times[0])u=Dl.arraySlice(s.values,0,s.valueSize);else if(a>=s.times[d]){var p=d*h;u=Dl.arraySlice(s.values,p)}else{var f=s.createInterpolant();f.evaluate(a),u=f.resultBuffer}if("quaternion"===c)new fn(u[0],u[1],u[2],u[3]).normalize().conjugate().toArray(u);for(var m=l.times.length,v=0;v<m;++v){var g=v*h;if("quaternion"===c)fn.multiplyQuaternionsFlat(l.values,g,u,0,l.values,g);else for(var y=0;y<h;++y)l.values[g+y]-=u[y]}}}}return e.blendMode=2501,e}};function Nl(e,t,n,i){this.parameterPositions=e,this._cachedIndex=0,this.resultBuffer=void 0!==i?i:new t.constructor(n),this.sampleValues=t,this.valueSize=n}function Fl(e,t,n,i){Nl.call(this,e,t,n,i),this._weightPrev=-0,this._offsetPrev=-0,this._weightNext=-0,this._offsetNext=-0}function zl(e,t,n,i){Nl.call(this,e,t,n,i)}function Ul(e,t,n,i){Nl.call(this,e,t,n,i)}function Bl(e,t,n,i){if(void 0===e)throw new Error("THREE.KeyframeTrack: track name is undefined");if(void 0===t||0===t.length)throw new Error("THREE.KeyframeTrack: no keyframes in track named "+e);this.name=e,this.times=Dl.convertArray(t,this.TimeBufferType),this.values=Dl.convertArray(n,this.ValueBufferType),this.setInterpolation(i||this.DefaultInterpolation)}function Gl(e,t,n){Bl.call(this,e,t,n)}function Hl(e,t,n,i){Bl.call(this,e,t,n,i)}function kl(e,t,n,i){Bl.call(this,e,t,n,i)}function Vl(e,t,n,i){Nl.call(this,e,t,n,i)}function jl(e,t,n,i){Bl.call(this,e,t,n,i)}function Wl(e,t,n,i){Bl.call(this,e,t,n,i)}function ql(e,t,n,i){Bl.call(this,e,t,n,i)}function Xl(e,t,n,i){this.name=e,this.tracks=n,this.duration=void 0!==t?t:-1,this.blendMode=void 0!==i?i:2500,this.uuid=an.generateUUID(),this.duration<0&&this.resetDuration()}function Yl(e){if(void 0===e.type)throw new Error("THREE.KeyframeTrack: track type undefined, can not parse");var t=function(e){switch(e.toLowerCase()){case"scalar":case"double":case"float":case"number":case"integer":return kl;case"vector":case"vector2":case"vector3":case"vector4":return ql;case"color":return Hl;case"quaternion":return jl;case"bool":case"boolean":return Gl;case"string":return Wl}throw new Error("THREE.KeyframeTrack: Unsupported typeName: "+e)}(e.type);if(void 0===e.times){var n=[],i=[];Dl.flattenJSON(e.keys,n,i,"value"),e.times=n,e.values=i}return void 0!==t.parse?t.parse(e):new t(e.name,e.times,e.values,e.interpolation)}J(Nl.prototype,{evaluate:function(e){var t=this.parameterPositions,n=this._cachedIndex,i=t[n],r=t[n-1];e:{t:{var a;n:{i:if(!(e<i)){for(var o=n+2;;){if(void 0===i){if(e<r)break i;return n=t.length,this._cachedIndex=n,this.afterEnd_(n-1,e,r)}if(n===o)break;if(r=i,e<(i=t[++n]))break t}a=t.length;break n}if(r<=e)break e;var s=t[1];e<s&&(n=2,r=s);for(o=n-2;;){if(void 0===r)return this._cachedIndex=0,this.beforeStart_(0,e,i);if(n===o)break;if(i=r,(r=t[--n-1])<=e)break t}a=n,n=0}for(;n<a;){var c=n+a>>>1;e<t[c]?a=c:n=1+c}if(i=t[n],void 0===(r=t[n-1]))return this._cachedIndex=0,this.beforeStart_(0,e,i);if(void 0===i)return n=t.length,this._cachedIndex=n,this.afterEnd_(n-1,r,e)}this._cachedIndex=n,this.intervalChanged_(n,r,i)}return this.interpolate_(n,r,e,i)},settings:null,DefaultSettings_:{},getSettings_:function(){return this.settings||this.DefaultSettings_},copySampleValue_:function(e){for(var t=this.resultBuffer,n=this.sampleValues,i=this.valueSize,r=e*i,a=0;a!==i;++a)t[a]=n[r+a];return t},interpolate_:function(){throw new Error("call to abstract method")},intervalChanged_:function(){}}),J(Nl.prototype,{beforeStart_:Nl.prototype.copySampleValue_,afterEnd_:Nl.prototype.copySampleValue_}),Fl.prototype=J(Object.create(Nl.prototype),{constructor:Fl,DefaultSettings_:{endingStart:Nt,endingEnd:Nt},intervalChanged_:function(e,t,n){var i=this.parameterPositions,r=e-2,a=e+1,o=i[r],s=i[a];if(void 0===o)switch(this.getSettings_().endingStart){case Ft:r=e,o=2*t-n;break;case zt:o=t+i[r=i.length-2]-i[r+1];break;default:r=e,o=n}if(void 0===s)switch(this.getSettings_().endingEnd){case Ft:a=e,s=2*n-t;break;case zt:s=n+i[a=1]-i[0];break;default:a=e-1,s=t}var c=.5*(n-t),l=this.valueSize;this._weightPrev=c/(t-o),this._weightNext=c/(s-n),this._offsetPrev=r*l,this._offsetNext=a*l},interpolate_:function(e,t,n,i){for(var r=this.resultBuffer,a=this.sampleValues,o=this.valueSize,s=e*o,c=s-o,l=this._offsetPrev,u=this._offsetNext,h=this._weightPrev,d=this._weightNext,p=(n-t)/(i-t),f=p*p,m=f*p,v=-h*m+2*h*f-h*p,g=(1+h)*m+(-1.5-2*h)*f+(-.5+h)*p+1,y=(-1-d)*m+(1.5+d)*f+.5*p,_=d*m-d*f,x=0;x!==o;++x)r[x]=v*a[l+x]+g*a[c+x]+y*a[s+x]+_*a[u+x];return r}}),zl.prototype=J(Object.create(Nl.prototype),{constructor:zl,interpolate_:function(e,t,n,i){for(var r=this.resultBuffer,a=this.sampleValues,o=this.valueSize,s=e*o,c=s-o,l=(n-t)/(i-t),u=1-l,h=0;h!==o;++h)r[h]=a[c+h]*u+a[s+h]*l;return r}}),Ul.prototype=J(Object.create(Nl.prototype),{constructor:Ul,interpolate_:function(e){return this.copySampleValue_(e-1)}}),J(Bl,{toJSON:function(e){var t,n=e.constructor;if(void 0!==n.toJSON)t=n.toJSON(e);else{t={name:e.name,times:Dl.convertArray(e.times,Array),values:Dl.convertArray(e.values,Array)};var i=e.getInterpolation();i!==e.DefaultInterpolation&&(t.interpolation=i)}return t.type=e.ValueTypeName,t}}),J(Bl.prototype,{constructor:Bl,TimeBufferType:Float32Array,ValueBufferType:Float32Array,DefaultInterpolation:Dt,InterpolantFactoryMethodDiscrete:function(e){return new Ul(this.times,this.values,this.getValueSize(),e)},InterpolantFactoryMethodLinear:function(e){return new zl(this.times,this.values,this.getValueSize(),e)},InterpolantFactoryMethodSmooth:function(e){return new Fl(this.times,this.values,this.getValueSize(),e)},setInterpolation:function(e){var t;switch(e){case Ot:t=this.InterpolantFactoryMethodDiscrete;break;case Dt:t=this.InterpolantFactoryMethodLinear;break;case 2302:t=this.InterpolantFactoryMethodSmooth}if(void 0!==t)return this.createInterpolant=t,this;var n="unsupported interpolation for "+this.ValueTypeName+" keyframe track named "+this.name;if(void 0===this.createInterpolant){if(e===this.DefaultInterpolation)throw new Error(n);this.setInterpolation(this.DefaultInterpolation)}return console.warn("THREE.KeyframeTrack:",n),this},getInterpolation:function(){switch(this.createInterpolant){case this.InterpolantFactoryMethodDiscrete:return Ot;case this.InterpolantFactoryMethodLinear:return Dt;case this.InterpolantFactoryMethodSmooth:return 2302}},getValueSize:function(){return this.values.length/this.times.length},shift:function(e){if(0!==e)for(var t=this.times,n=0,i=t.length;n!==i;++n)t[n]+=e;return this},scale:function(e){if(1!==e)for(var t=this.times,n=0,i=t.length;n!==i;++n)t[n]*=e;return this},trim:function(e,t){for(var n=this.times,i=n.length,r=0,a=i-1;r!==i&&n[r]<e;)++r;for(;-1!==a&&n[a]>t;)--a;if(++a,0!==r||a!==i){a<=r&&(r=(a=Math.max(a,1))-1);var o=this.getValueSize();this.times=Dl.arraySlice(n,r,a),this.values=Dl.arraySlice(this.values,r*o,a*o)}return this},validate:function(){var e=!0,t=this.getValueSize();t-Math.floor(t)!=0&&(console.error("THREE.KeyframeTrack: Invalid value size in track.",this),e=!1);var n=this.times,i=this.values,r=n.length;0===r&&(console.error("THREE.KeyframeTrack: Track is empty.",this),e=!1);for(var a=null,o=0;o!==r;o++){var s=n[o];if("number"==typeof s&&isNaN(s)){console.error("THREE.KeyframeTrack: Time is not a valid number.",this,o,s),e=!1;break}if(null!==a&&s<a){console.error("THREE.KeyframeTrack: Out of order keys.",this,o,s,a),e=!1;break}a=s}if(void 0!==i&&Dl.isTypedArray(i)){o=0;for(var c=i.length;o!==c;++o){var l=i[o];if(isNaN(l)){console.error("THREE.KeyframeTrack: Value is not a valid number.",this,o,l),e=!1;break}}}return e},optimize:function(){for(var e=Dl.arraySlice(this.times),t=Dl.arraySlice(this.values),n=this.getValueSize(),i=2302===this.getInterpolation(),r=1,a=e.length-1,o=1;o<a;++o){var s=!1,c=e[o];if(c!==e[o+1]&&(1!==o||c!==c[0]))if(i)s=!0;else for(var l=o*n,u=l-n,h=l+n,d=0;d!==n;++d){var p=t[l+d];if(p!==t[u+d]||p!==t[h+d]){s=!0;break}}if(s){if(o!==r){e[r]=e[o];var f=o*n,m=r*n;for(d=0;d!==n;++d)t[m+d]=t[f+d]}++r}}if(0<a){e[r]=e[a];for(f=a*n,m=r*n,d=0;d!==n;++d)t[m+d]=t[f+d];++r}return r!==e.length?(this.times=Dl.arraySlice(e,0,r),this.values=Dl.arraySlice(t,0,r*n)):(this.times=e,this.values=t),this},clone:function(){var e=Dl.arraySlice(this.times,0),t=Dl.arraySlice(this.values,0),n=new this.constructor(this.name,e,t);return n.createInterpolant=this.createInterpolant,n}}),Gl.prototype=J(Object.create(Bl.prototype),{constructor:Gl,ValueTypeName:"bool",ValueBufferType:Array,DefaultInterpolation:Ot,InterpolantFactoryMethodLinear:void 0,InterpolantFactoryMethodSmooth:void 0}),Hl.prototype=J(Object.create(Bl.prototype),{constructor:Hl,ValueTypeName:"color"}),kl.prototype=J(Object.create(Bl.prototype),{constructor:kl,ValueTypeName:"number"}),Vl.prototype=J(Object.create(Nl.prototype),{constructor:Vl,interpolate_:function(e,t,n,i){for(var r=this.resultBuffer,a=this.sampleValues,o=this.valueSize,s=e*o,c=(n-t)/(i-t),l=s+o;s!==l;s+=4)fn.slerpFlat(r,0,a,s-o,a,s,c);return r}}),jl.prototype=J(Object.create(Bl.prototype),{constructor:jl,ValueTypeName:"quaternion",DefaultInterpolation:Dt,InterpolantFactoryMethodLinear:function(e){return new Vl(this.times,this.values,this.getValueSize(),e)},InterpolantFactoryMethodSmooth:void 0}),Wl.prototype=J(Object.create(Bl.prototype),{constructor:Wl,ValueTypeName:"string",ValueBufferType:Array,DefaultInterpolation:Ot,InterpolantFactoryMethodLinear:void 0,InterpolantFactoryMethodSmooth:void 0}),ql.prototype=J(Object.create(Bl.prototype),{constructor:ql,ValueTypeName:"vector"}),J(Xl,{parse:function(e){for(var t=[],n=e.tracks,i=1/(e.fps||1),r=0,a=n.length;r!==a;++r)t.push(Yl(n[r]).scale(i));return new Xl(e.name,e.duration,t,e.blendMode)},toJSON:function(e){for(var t=[],n=e.tracks,i={name:e.name,duration:e.duration,tracks:t,uuid:e.uuid,blendMode:e.blendMode},r=0,a=n.length;r!==a;++r)t.push(Bl.toJSON(n[r]));return i},CreateFromMorphTargetSequence:function(e,t,n,i){for(var r=t.length,a=[],o=0;o<r;o++){var s=[],c=[];s.push((o+r-1)%r,o,(o+1)%r),c.push(0,1,0);var l=Dl.getKeyframeOrder(s);s=Dl.sortedArray(s,1,l),c=Dl.sortedArray(c,1,l),i||0!==s[0]||(s.push(r),c.push(c[0])),a.push(new kl(".morphTargetInfluences["+t[o].name+"]",s,c).scale(1/n))}return new Xl(e,-1,a)},findByName:function(e,t){var n=e;if(!Array.isArray(e)){n=e.geometry&&e.geometry.animations||e.animations}for(var i=0;i<n.length;i++)if(n[i].name===t)return n[i];return null},CreateClipsFromMorphTargetSequences:function(e,t,n){for(var i={},r=/^([\w-]*?)([\d]+)$/,a=0,o=e.length;a<o;a++){var s=e[a],c=s.name.match(r);if(c&&1<c.length){var l=i[h=c[1]];l||(i[h]=l=[]),l.push(s)}}var u=[];for(var h in i)u.push(Xl.CreateFromMorphTargetSequence(h,i[h],t,n));return u},parseAnimation:function(e,t){if(!e)return console.error("THREE.AnimationClip: No animation in JSONLoader data."),null;for(var n=function(e,t,n,i,r){if(0!==n.length){var a=[],o=[];Dl.flattenJSON(n,a,o,i),0!==a.length&&r.push(new e(t,a,o))}},i=[],r=e.name||"default",a=e.length||-1,o=e.fps||30,s=e.blendMode,c=e.hierarchy||[],l=0;l<c.length;l++){var u=c[l].keys;if(u&&0!==u.length)if(u[0].morphTargets){for(var h={},d=0;d<u.length;d++)if(u[d].morphTargets)for(var p=0;p<u[d].morphTargets.length;p++)h[u[d].morphTargets[p]]=-1;for(var f in h){var m=[],v=[];for(p=0;p!==u[d].morphTargets.length;++p){var g=u[d];m.push(g.time),v.push(g.morphTarget===f?1:0)}i.push(new kl(".morphTargetInfluence["+f+"]",m,v))}a=h.length*(o||1)}else{var y=".bones["+t[l].name+"]";n(ql,y+".position",u,"pos",i),n(jl,y+".quaternion",u,"rot",i),n(ql,y+".scale",u,"scl",i)}}return 0===i.length?null:new Xl(r,a,i,s)}}),J(Xl.prototype,{resetDuration:function(){for(var e=0,t=0,n=this.tracks.length;t!==n;++t){var i=this.tracks[t];e=Math.max(e,i.times[i.times.length-1])}return this.duration=e,this},trim:function(){for(var e=0;e<this.tracks.length;e++)this.tracks[e].trim(0,this.duration);return this},validate:function(){for(var e=!0,t=0;t<this.tracks.length;t++)e=e&&this.tracks[t].validate();return e},optimize:function(){for(var e=0;e<this.tracks.length;e++)this.tracks[e].optimize();return this},clone:function(){for(var e=[],t=0;t<this.tracks.length;t++)e.push(this.tracks[t].clone());return new Xl(this.name,this.duration,e,this.blendMode)}});var Zl={enabled:!1,files:{},add:function(e,t){!1!==this.enabled&&(this.files[e]=t)},get:function(e){if(!1!==this.enabled)return this.files[e]},remove:function(e){delete this.files[e]},clear:function(){this.files={}}};function Jl(e,t,n){var i=this,r=!1,a=0,o=0,s=void 0,c=[];this.onStart=void 0,this.onLoad=e,this.onProgress=t,this.onError=n,this.itemStart=function(e){o++,!1===r&&void 0!==i.onStart&&i.onStart(e,a,o),r=!0},this.itemEnd=function(e){a++,void 0!==i.onProgress&&i.onProgress(e,a,o),a===o&&(r=!1,void 0!==i.onLoad&&i.onLoad())},this.itemError=function(e){void 0!==i.onError&&i.onError(e)},this.resolveURL=function(e){return s?s(e):e},this.setURLModifier=function(e){return s=e,this},this.addHandler=function(e,t){return c.push(e,t),this},this.removeHandler=function(e){var t=c.indexOf(e);return-1!==t&&c.splice(t,2),this},this.getHandler=function(e){for(var t=0,n=c.length;t<n;t+=2){var i=c[t],r=c[t+1];if(i.global&&(i.lastIndex=0),i.test(e))return r}return null}}var Kl=new Jl;function Ql(e){this.manager=void 0!==e?e:Kl,this.crossOrigin="anonymous",this.path="",this.resourcePath=""}J(Ql.prototype,{load:function(){},loadAsync:function(n,i){var r=this;return new Promise(function(e,t){r.load(n,e,i,t)})},parse:function(){},setCrossOrigin:function(e){return this.crossOrigin=e,this},setPath:function(e){return this.path=e,this},setResourcePath:function(e){return this.resourcePath=e,this}});var $l={};function eu(e){Ql.call(this,e)}function tu(e){Ql.call(this,e)}function nu(e){Ql.call(this,e)}function iu(e){Ql.call(this,e)}function ru(e){Ql.call(this,e)}function au(e){Ql.call(this,e)}function ou(e){Ql.call(this,e)}function su(){this.type="Curve",this.arcLengthDivisions=200}function cu(e,t,n,i,r,a,o,s){su.call(this),this.type="EllipseCurve",this.aX=e||0,this.aY=t||0,this.xRadius=n||1,this.yRadius=i||1,this.aStartAngle=r||0,this.aEndAngle=a||2*Math.PI,this.aClockwise=o||!1,this.aRotation=s||0}function lu(e,t,n,i,r,a){cu.call(this,e,t,n,n,i,r,a),this.type="ArcCurve"}function uu(){var r=0,a=0,o=0,s=0;function l(e,t,n,i){o=-3*(r=e)+3*t-2*(a=n)-i,s=2*e-2*t+n+i}return{initCatmullRom:function(e,t,n,i,r){l(t,n,r*(n-e),r*(i-t))},initNonuniformCatmullRom:function(e,t,n,i,r,a,o){var s=(t-e)/r-(n-e)/(r+a)+(n-t)/a,c=(n-t)/a-(i-t)/(a+o)+(i-n)/o;l(t,n,s*=a,c*=a)},calc:function(e){var t=e*e;return r+a*e+o*t+s*(t*e)}}}eu.prototype=J(Object.create(Ql.prototype),{constructor:eu,load:function(o,e,t,n){void 0===o&&(o=""),void 0!==this.path&&(o=this.path+o),o=this.manager.resolveURL(o);var s=this,i=Zl.get(o);if(void 0!==i)return s.manager.itemStart(o),setTimeout(function(){e&&e(i),s.manager.itemEnd(o)},0),i;if(void 0===$l[o]){var r=o.match(/^data:(.*?)(;base64)?,(.*)$/);if(r){var a=r[1],c=!!r[2],l=r[3];l=decodeURIComponent(l),c&&(l=atob(l));try{var u,h=(this.responseType||"").toLowerCase();switch(h){case"arraybuffer":case"blob":for(var d=new Uint8Array(l.length),p=0;p<l.length;p++)d[p]=l.charCodeAt(p);u="blob"===h?new Blob([d.buffer],{type:a}):d.buffer;break;case"document":var f=new DOMParser;u=f.parseFromString(l,a);break;case"json":u=JSON.parse(l);break;default:u=l}setTimeout(function(){e&&e(u),s.manager.itemEnd(o)},0)}catch(e){setTimeout(function(){n&&n(e),s.manager.itemError(o),s.manager.itemEnd(o)},0)}}else{$l[o]=[],$l[o].push({onLoad:e,onProgress:t,onError:n});var m=new XMLHttpRequest;for(var v in m.open("GET",o,!0),m.addEventListener("load",function(e){var t=this.response,n=$l[o];if(delete $l[o],200===this.status||0===this.status){0===this.status&&console.warn("THREE.FileLoader: HTTP Status 0 received."),Zl.add(o,t);for(var i=0,r=n.length;i<r;i++){(a=n[i]).onLoad&&a.onLoad(t)}s.manager.itemEnd(o)}else{for(i=0,r=n.length;i<r;i++){var a;(a=n[i]).onError&&a.onError(e)}s.manager.itemError(o),s.manager.itemEnd(o)}},!1),m.addEventListener("progress",function(e){for(var t=$l[o],n=0,i=t.length;n<i;n++){var r=t[n];r.onProgress&&r.onProgress(e)}},!1),m.addEventListener("error",function(e){var t=$l[o];delete $l[o];for(var n=0,i=t.length;n<i;n++){var r=t[n];r.onError&&r.onError(e)}s.manager.itemError(o),s.manager.itemEnd(o)},!1),m.addEventListener("abort",function(e){var t=$l[o];delete $l[o];for(var n=0,i=t.length;n<i;n++){var r=t[n];r.onError&&r.onError(e)}s.manager.itemError(o),s.manager.itemEnd(o)},!1),void 0!==this.responseType&&(m.responseType=this.responseType),void 0!==this.withCredentials&&(m.withCredentials=this.withCredentials),m.overrideMimeType&&m.overrideMimeType(void 0!==this.mimeType?this.mimeType:"text/plain"),this.requestHeader)m.setRequestHeader(v,this.requestHeader[v]);m.send(null)}return s.manager.itemStart(o),m}$l[o].push({onLoad:e,onProgress:t,onError:n})},setResponseType:function(e){return this.responseType=e,this},setWithCredentials:function(e){return this.withCredentials=e,this},setMimeType:function(e){return this.mimeType=e,this},setRequestHeader:function(e){return this.requestHeader=e,this}}),tu.prototype=J(Object.create(Ql.prototype),{constructor:tu,load:function(e,t,n,i){var r=this,a=new eu(r.manager);a.setPath(r.path),a.load(e,function(e){t(r.parse(JSON.parse(e)))},n,i)},parse:function(e){for(var t=[],n=0;n<e.length;n++){var i=Xl.parse(e[n]);t.push(i)}return t}}),nu.prototype=J(Object.create(Ql.prototype),{constructor:nu,load:function(e,a,t,i){var o=this,s=[],c=new oc;c.image=s;var r=new eu(this.manager);function n(n){r.load(e[n],function(e){var t=o.parse(e,!0);s[n]={width:t.width,height:t.height,format:t.format,mipmaps:t.mipmaps},6===(l+=1)&&(1===t.mipmapCount&&(c.minFilter=We),c.format=t.format,c.needsUpdate=!0,a&&a(c))},t,i)}if(r.setPath(this.path),r.setResponseType("arraybuffer"),Array.isArray(e))for(var l=0,u=0,h=e.length;u<h;++u)n(u);else r.load(e,function(e){var t=o.parse(e,!0);if(t.isCubemap)for(var n=t.mipmaps.length/t.mipmapCount,i=0;i<n;i++){s[i]={mipmaps:[]};for(var r=0;r<t.mipmapCount;r++)s[i].mipmaps.push(t.mipmaps[i*t.mipmapCount+r]),s[i].format=t.format,s[i].width=t.width,s[i].height=t.height}else c.image.width=t.width,c.image.height=t.height,c.mipmaps=t.mipmaps;1===t.mipmapCount&&(c.minFilter=We),c.format=t.format,c.needsUpdate=!0,a&&a(c)},t,i);return c}}),iu.prototype=J(Object.create(Ql.prototype),{constructor:iu,load:function(e,n,t,i){var r=this,a=new qr,o=new eu(this.manager);return o.setResponseType("arraybuffer"),o.setPath(this.path),o.load(e,function(e){var t=r.parse(e);t&&(void 0!==t.image?a.image=t.image:void 0!==t.data&&(a.image.width=t.width,a.image.height=t.height,a.image.data=t.data),a.wrapS=void 0!==t.wrapS?t.wrapS:Ge,a.wrapT=void 0!==t.wrapT?t.wrapT:Ge,a.magFilter=void 0!==t.magFilter?t.magFilter:We,a.minFilter=void 0!==t.minFilter?t.minFilter:We,a.anisotropy=void 0!==t.anisotropy?t.anisotropy:1,void 0!==t.format&&(a.format=t.format),void 0!==t.type&&(a.type=t.type),void 0!==t.mipmaps&&(a.mipmaps=t.mipmaps,a.minFilter=Xe),1===t.mipmapCount&&(a.minFilter=We),a.needsUpdate=!0,n&&n(a,t))},t,i),a}}),ru.prototype=J(Object.create(Ql.prototype),{constructor:ru,load:function(t,e,n,i){void 0!==this.path&&(t=this.path+t),t=this.manager.resolveURL(t);var r=this,a=Zl.get(t);if(void 0!==a)return r.manager.itemStart(t),setTimeout(function(){e&&e(a),r.manager.itemEnd(t)},0),a;var o=document.createElementNS("http://www.w3.org/1999/xhtml","img");function s(){o.removeEventListener("load",s,!1),o.removeEventListener("error",c,!1),Zl.add(t,this),e&&e(this),r.manager.itemEnd(t)}function c(e){o.removeEventListener("load",s,!1),o.removeEventListener("error",c,!1),i&&i(e),r.manager.itemError(t),r.manager.itemEnd(t)}return o.addEventListener("load",s,!1),o.addEventListener("error",c,!1),"data:"!==t.substr(0,5)&&void 0!==this.crossOrigin&&(o.crossOrigin=this.crossOrigin),r.manager.itemStart(t),o.src=t,o}}),au.prototype=J(Object.create(Ql.prototype),{constructor:au,load:function(e,n,t,i){var r=new fa,a=new ru(this.manager);a.setCrossOrigin(this.crossOrigin),a.setPath(this.path);var o=0;function s(t){a.load(e[t],function(e){r.images[t]=e,6===++o&&(r.needsUpdate=!0,n&&n(r))},void 0,i)}for(var c=0;c<e.length;++c)s(c);return r}}),ou.prototype=J(Object.create(Ql.prototype),{constructor:ou,load:function(n,i,e,t){var r=new un,a=new ru(this.manager);return a.setCrossOrigin(this.crossOrigin),a.setPath(this.path),a.load(n,function(e){r.image=e;var t=0<n.search(/\.jpe?g($|\?)/i)||0===n.search(/^data\:image\/jpeg/);r.format=t?et:tt,r.needsUpdate=!0,void 0!==i&&i(r)},e,t),r}}),J(su.prototype,{getPoint:function(){return console.warn("THREE.Curve: .getPoint() not implemented."),null},getPointAt:function(e,t){var n=this.getUtoTmapping(e);return this.getPoint(n,t)},getPoints:function(e){void 0===e&&(e=5);for(var t=[],n=0;n<=e;n++)t.push(this.getPoint(n/e));return t},getSpacedPoints:function(e){void 0===e&&(e=5);for(var t=[],n=0;n<=e;n++)t.push(this.getPointAt(n/e));return t},getLength:function(){var e=this.getLengths();return e[e.length-1]},getLengths:function(e){if(void 0===e&&(e=this.arcLengthDivisions),this.cacheArcLengths&&this.cacheArcLengths.length===e+1&&!this.needsUpdate)return this.cacheArcLengths;this.needsUpdate=!1;var t,n,i=[],r=this.getPoint(0),a=0;for(i.push(0),n=1;n<=e;n++)a+=(t=this.getPoint(n/e)).distanceTo(r),i.push(a),r=t;return this.cacheArcLengths=i},updateArcLengths:function(){this.needsUpdate=!0,this.getLengths()},getUtoTmapping:function(e,t){var n,i=this.getLengths(),r=0,a=i.length;n=t||e*i[a-1];for(var o,s=0,c=a-1;s<=c;)if((o=i[r=Math.floor(s+(c-s)/2)]-n)<0)s=r+1;else{if(!(0<o)){c=r;break}c=r-1}if(i[r=c]===n)return r/(a-1);var l=i[r];return(r+(n-l)/(i[r+1]-l))/(a-1)},getTangent:function(e,t){var n=e-1e-4,i=e+1e-4;n<0&&(n=0),1<i&&(i=1);var r=this.getPoint(n),a=this.getPoint(i),o=t||new(r.isVector2?on:gn);return o.copy(a).sub(r).normalize(),o},getTangentAt:function(e,t){var n=this.getUtoTmapping(e);return this.getTangent(n,t)},computeFrenetFrames:function(e,t){var n,i,r,a=new gn,o=[],s=[],c=[],l=new gn,u=new Tn;for(n=0;n<=e;n++)i=n/e,o[n]=this.getTangentAt(i,new gn),o[n].normalize();s[0]=new gn,c[0]=new gn;var h=Number.MAX_VALUE,d=Math.abs(o[0].x),p=Math.abs(o[0].y),f=Math.abs(o[0].z);for(d<=h&&(h=d,a.set(1,0,0)),p<=h&&(h=p,a.set(0,1,0)),f<=h&&a.set(0,0,1),l.crossVectors(o[0],a).normalize(),s[0].crossVectors(o[0],l),c[0].crossVectors(o[0],s[0]),n=1;n<=e;n++)s[n]=s[n-1].clone(),c[n]=c[n-1].clone(),l.crossVectors(o[n-1],o[n]),l.length()>Number.EPSILON&&(l.normalize(),r=Math.acos(an.clamp(o[n-1].dot(o[n]),-1,1)),s[n].applyMatrix4(u.makeRotationAxis(l,r))),c[n].crossVectors(o[n],s[n]);if(!0===t)for(r=Math.acos(an.clamp(s[0].dot(s[e]),-1,1)),r/=e,0<o[0].dot(l.crossVectors(s[0],s[e]))&&(r=-r),n=1;n<=e;n++)s[n].applyMatrix4(u.makeRotationAxis(o[n],r*n)),c[n].crossVectors(o[n],s[n]);return{tangents:o,normals:s,binormals:c}},clone:function(){return(new this.constructor).copy(this)},copy:function(e){return this.arcLengthDivisions=e.arcLengthDivisions,this},toJSON:function(){var e={metadata:{version:4.5,type:"Curve",generator:"Curve.toJSON"}};return e.arcLengthDivisions=this.arcLengthDivisions,e.type=this.type,e},fromJSON:function(e){return this.arcLengthDivisions=e.arcLengthDivisions,this}}),((cu.prototype=Object.create(su.prototype)).constructor=cu).prototype.isEllipseCurve=!0,cu.prototype.getPoint=function(e,t){for(var n=t||new on,i=2*Math.PI,r=this.aEndAngle-this.aStartAngle,a=Math.abs(r)<Number.EPSILON;r<0;)r+=i;for(;i<r;)r-=i;r<Number.EPSILON&&(r=a?0:i),!0!==this.aClockwise||a||(r===i?r=-i:r-=i);var o=this.aStartAngle+e*r,s=this.aX+this.xRadius*Math.cos(o),c=this.aY+this.yRadius*Math.sin(o);if(0!==this.aRotation){var l=Math.cos(this.aRotation),u=Math.sin(this.aRotation),h=s-this.aX,d=c-this.aY;s=h*l-d*u+this.aX,c=h*u+d*l+this.aY}return n.set(s,c)},cu.prototype.copy=function(e){return su.prototype.copy.call(this,e),this.aX=e.aX,this.aY=e.aY,this.xRadius=e.xRadius,this.yRadius=e.yRadius,this.aStartAngle=e.aStartAngle,this.aEndAngle=e.aEndAngle,this.aClockwise=e.aClockwise,this.aRotation=e.aRotation,this},cu.prototype.toJSON=function(){var e=su.prototype.toJSON.call(this);return e.aX=this.aX,e.aY=this.aY,e.xRadius=this.xRadius,e.yRadius=this.yRadius,e.aStartAngle=this.aStartAngle,e.aEndAngle=this.aEndAngle,e.aClockwise=this.aClockwise,e.aRotation=this.aRotation,e},cu.prototype.fromJSON=function(e){return su.prototype.fromJSON.call(this,e),this.aX=e.aX,this.aY=e.aY,this.xRadius=e.xRadius,this.yRadius=e.yRadius,this.aStartAngle=e.aStartAngle,this.aEndAngle=e.aEndAngle,this.aClockwise=e.aClockwise,this.aRotation=e.aRotation,this},((lu.prototype=Object.create(cu.prototype)).constructor=lu).prototype.isArcCurve=!0;var hu=new gn,du=new uu,pu=new uu,fu=new uu;function mu(e,t,n,i){su.call(this),this.type="CatmullRomCurve3",this.points=e||[],this.closed=t||!1,this.curveType=n||"centripetal",this.tension=i||.5}function vu(e,t,n,i,r){var a=.5*(i-t),o=.5*(r-n),s=e*e;return(2*n-2*i+a+o)*(e*s)+(-3*n+3*i-2*a-o)*s+a*e+n}function gu(e,t,n,i){return(o=1-e)*o*t+2*(1-(a=e))*a*n+(r=e)*r*i;var r,a,o}function yu(e,t,n,i,r){return(l=1-e)*l*l*t+3*(c=1-(s=e))*c*s*n+3*(1-(o=e))*o*o*i+(a=e)*a*a*r;var a,o,s,c,l}function _u(e,t,n,i){su.call(this),this.type="CubicBezierCurve",this.v0=e||new on,this.v1=t||new on,this.v2=n||new on,this.v3=i||new on}function xu(e,t,n,i){su.call(this),this.type="CubicBezierCurve3",this.v0=e||new gn,this.v1=t||new gn,this.v2=n||new gn,this.v3=i||new gn}function bu(e,t){su.call(this),this.type="LineCurve",this.v1=e||new on,this.v2=t||new on}function wu(e,t){su.call(this),this.type="LineCurve3",this.v1=e||new gn,this.v2=t||new gn}function Mu(e,t,n){su.call(this),this.type="QuadraticBezierCurve",this.v0=e||new on,this.v1=t||new on,this.v2=n||new on}function Su(e,t,n){su.call(this),this.type="QuadraticBezierCurve3",this.v0=e||new gn,this.v1=t||new gn,this.v2=n||new gn}function Tu(e){su.call(this),this.type="SplineCurve",this.points=e||[]}((mu.prototype=Object.create(su.prototype)).constructor=mu).prototype.isCatmullRomCurve3=!0,mu.prototype.getPoint=function(e,t){var n,i,r,a,o=t||new gn,s=this.points,c=s.length,l=(c-(this.closed?0:1))*e,u=Math.floor(l),h=l-u;if(this.closed?u+=0<u?0:(Math.floor(Math.abs(u)/c)+1)*c:0===h&&u===c-1&&(u=c-2,h=1),n=this.closed||0<u?s[(u-1)%c]:(hu.subVectors(s[0],s[1]).add(s[0]),hu),i=s[u%c],r=s[(u+1)%c],a=this.closed||u+2<c?s[(u+2)%c]:(hu.subVectors(s[c-1],s[c-2]).add(s[c-1]),hu),"centripetal"===this.curveType||"chordal"===this.curveType){var d="chordal"===this.curveType?.5:.25,p=Math.pow(n.distanceToSquared(i),d),f=Math.pow(i.distanceToSquared(r),d),m=Math.pow(r.distanceToSquared(a),d);f<1e-4&&(f=1),p<1e-4&&(p=f),m<1e-4&&(m=f),du.initNonuniformCatmullRom(n.x,i.x,r.x,a.x,p,f,m),pu.initNonuniformCatmullRom(n.y,i.y,r.y,a.y,p,f,m),fu.initNonuniformCatmullRom(n.z,i.z,r.z,a.z,p,f,m)}else"catmullrom"===this.curveType&&(du.initCatmullRom(n.x,i.x,r.x,a.x,this.tension),pu.initCatmullRom(n.y,i.y,r.y,a.y,this.tension),fu.initCatmullRom(n.z,i.z,r.z,a.z,this.tension));return o.set(du.calc(h),pu.calc(h),fu.calc(h)),o},mu.prototype.copy=function(e){su.prototype.copy.call(this,e),this.points=[];for(var t=0,n=e.points.length;t<n;t++){var i=e.points[t];this.points.push(i.clone())}return this.closed=e.closed,this.curveType=e.curveType,this.tension=e.tension,this},mu.prototype.toJSON=function(){var e=su.prototype.toJSON.call(this);e.points=[];for(var t=0,n=this.points.length;t<n;t++){var i=this.points[t];e.points.push(i.toArray())}return e.closed=this.closed,e.curveType=this.curveType,e.tension=this.tension,e},mu.prototype.fromJSON=function(e){su.prototype.fromJSON.call(this,e),this.points=[];for(var t=0,n=e.points.length;t<n;t++){var i=e.points[t];this.points.push((new gn).fromArray(i))}return this.closed=e.closed,this.curveType=e.curveType,this.tension=e.tension,this},((_u.prototype=Object.create(su.prototype)).constructor=_u).prototype.isCubicBezierCurve=!0,_u.prototype.getPoint=function(e,t){var n=t||new on,i=this.v0,r=this.v1,a=this.v2,o=this.v3;return n.set(yu(e,i.x,r.x,a.x,o.x),yu(e,i.y,r.y,a.y,o.y)),n},_u.prototype.copy=function(e){return su.prototype.copy.call(this,e),this.v0.copy(e.v0),this.v1.copy(e.v1),this.v2.copy(e.v2),this.v3.copy(e.v3),this},_u.prototype.toJSON=function(){var e=su.prototype.toJSON.call(this);return e.v0=this.v0.toArray(),e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e.v3=this.v3.toArray(),e},_u.prototype.fromJSON=function(e){return su.prototype.fromJSON.call(this,e),this.v0.fromArray(e.v0),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this.v3.fromArray(e.v3),this},((xu.prototype=Object.create(su.prototype)).constructor=xu).prototype.isCubicBezierCurve3=!0,xu.prototype.getPoint=function(e,t){var n=t||new gn,i=this.v0,r=this.v1,a=this.v2,o=this.v3;return n.set(yu(e,i.x,r.x,a.x,o.x),yu(e,i.y,r.y,a.y,o.y),yu(e,i.z,r.z,a.z,o.z)),n},xu.prototype.copy=function(e){return su.prototype.copy.call(this,e),this.v0.copy(e.v0),this.v1.copy(e.v1),this.v2.copy(e.v2),this.v3.copy(e.v3),this},xu.prototype.toJSON=function(){var e=su.prototype.toJSON.call(this);return e.v0=this.v0.toArray(),e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e.v3=this.v3.toArray(),e},xu.prototype.fromJSON=function(e){return su.prototype.fromJSON.call(this,e),this.v0.fromArray(e.v0),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this.v3.fromArray(e.v3),this},((bu.prototype=Object.create(su.prototype)).constructor=bu).prototype.isLineCurve=!0,bu.prototype.getPoint=function(e,t){var n=t||new on;return 1===e?n.copy(this.v2):(n.copy(this.v2).sub(this.v1),n.multiplyScalar(e).add(this.v1)),n},bu.prototype.getPointAt=function(e,t){return this.getPoint(e,t)},bu.prototype.getTangent=function(e,t){return(t||new on).copy(this.v2).sub(this.v1).normalize()},bu.prototype.copy=function(e){return su.prototype.copy.call(this,e),this.v1.copy(e.v1),this.v2.copy(e.v2),this},bu.prototype.toJSON=function(){var e=su.prototype.toJSON.call(this);return e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e},bu.prototype.fromJSON=function(e){return su.prototype.fromJSON.call(this,e),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this},((wu.prototype=Object.create(su.prototype)).constructor=wu).prototype.isLineCurve3=!0,wu.prototype.getPoint=function(e,t){var n=t||new gn;return 1===e?n.copy(this.v2):(n.copy(this.v2).sub(this.v1),n.multiplyScalar(e).add(this.v1)),n},wu.prototype.getPointAt=function(e,t){return this.getPoint(e,t)},wu.prototype.copy=function(e){return su.prototype.copy.call(this,e),this.v1.copy(e.v1),this.v2.copy(e.v2),this},wu.prototype.toJSON=function(){var e=su.prototype.toJSON.call(this);return e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e},wu.prototype.fromJSON=function(e){return su.prototype.fromJSON.call(this,e),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this},((Mu.prototype=Object.create(su.prototype)).constructor=Mu).prototype.isQuadraticBezierCurve=!0,Mu.prototype.getPoint=function(e,t){var n=t||new on,i=this.v0,r=this.v1,a=this.v2;return n.set(gu(e,i.x,r.x,a.x),gu(e,i.y,r.y,a.y)),n},Mu.prototype.copy=function(e){return su.prototype.copy.call(this,e),this.v0.copy(e.v0),this.v1.copy(e.v1),this.v2.copy(e.v2),this},Mu.prototype.toJSON=function(){var e=su.prototype.toJSON.call(this);return e.v0=this.v0.toArray(),e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e},Mu.prototype.fromJSON=function(e){return su.prototype.fromJSON.call(this,e),this.v0.fromArray(e.v0),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this},((Su.prototype=Object.create(su.prototype)).constructor=Su).prototype.isQuadraticBezierCurve3=!0,Su.prototype.getPoint=function(e,t){var n=t||new gn,i=this.v0,r=this.v1,a=this.v2;return n.set(gu(e,i.x,r.x,a.x),gu(e,i.y,r.y,a.y),gu(e,i.z,r.z,a.z)),n},Su.prototype.copy=function(e){return su.prototype.copy.call(this,e),this.v0.copy(e.v0),this.v1.copy(e.v1),this.v2.copy(e.v2),this},Su.prototype.toJSON=function(){var e=su.prototype.toJSON.call(this);return e.v0=this.v0.toArray(),e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e},Su.prototype.fromJSON=function(e){return su.prototype.fromJSON.call(this,e),this.v0.fromArray(e.v0),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this},((Tu.prototype=Object.create(su.prototype)).constructor=Tu).prototype.isSplineCurve=!0,Tu.prototype.getPoint=function(e,t){var n=t||new on,i=this.points,r=(i.length-1)*e,a=Math.floor(r),o=r-a,s=i[0===a?a:a-1],c=i[a],l=i[a>i.length-2?i.length-1:a+1],u=i[a>i.length-3?i.length-1:a+2];return n.set(vu(o,s.x,c.x,l.x,u.x),vu(o,s.y,c.y,l.y,u.y)),n},Tu.prototype.copy=function(e){su.prototype.copy.call(this,e),this.points=[];for(var t=0,n=e.points.length;t<n;t++){var i=e.points[t];this.points.push(i.clone())}return this},Tu.prototype.toJSON=function(){var e=su.prototype.toJSON.call(this);e.points=[];for(var t=0,n=this.points.length;t<n;t++){var i=this.points[t];e.points.push(i.toArray())}return e},Tu.prototype.fromJSON=function(e){su.prototype.fromJSON.call(this,e),this.points=[];for(var t=0,n=e.points.length;t<n;t++){var i=e.points[t];this.points.push((new on).fromArray(i))}return this};var Eu=Object.freeze({__proto__:null,ArcCurve:lu,CatmullRomCurve3:mu,CubicBezierCurve:_u,CubicBezierCurve3:xu,EllipseCurve:cu,LineCurve:bu,LineCurve3:wu,QuadraticBezierCurve:Mu,QuadraticBezierCurve3:Su,SplineCurve:Tu});function Au(){su.call(this),this.type="CurvePath",this.curves=[],this.autoClose=!1}function Lu(e){Au.call(this),this.type="Path",this.currentPoint=new on,e&&this.setFromPoints(e)}function Ru(e){Lu.call(this,e),this.uuid=an.generateUUID(),this.type="Shape",this.holes=[]}function Pu(e,t){Vn.call(this),this.type="Light",this.color=new Di(e),this.intensity=void 0!==t?t:1,this.receiveShadow=void 0}function Cu(e,t,n){Pu.call(this,e,n),this.type="HemisphereLight",this.castShadow=void 0,this.position.copy(Vn.DefaultUp),this.updateMatrix(),this.groundColor=new Di(t)}function Iu(e){this.camera=e,this.bias=0,this.radius=1,this.mapSize=new on(512,512),this.map=null,this.mapPass=null,this.matrix=new Tn,this._frustum=new Zr,this._frameExtents=new on(1,1),this._viewportCount=1,this._viewports=[new hn(0,0,1,1)]}function Ou(){Iu.call(this,new Vr(50,1,.5,500))}function Du(e,t,n,i,r,a){Pu.call(this,e,t),this.type="SpotLight",this.position.copy(Vn.DefaultUp),this.updateMatrix(),this.target=new Vn,Object.defineProperty(this,"power",{get:function(){return this.intensity*Math.PI},set:function(e){this.intensity=e/Math.PI}}),this.distance=void 0!==n?n:0,this.angle=void 0!==i?i:Math.PI/3,this.penumbra=void 0!==r?r:0,this.decay=void 0!==a?a:1,this.shadow=new Ou}function Nu(){Iu.call(this,new Vr(90,1,.5,500)),this._frameExtents=new on(4,2),this._viewportCount=6,this._viewports=[new hn(2,1,1,1),new hn(0,1,1,1),new hn(3,1,1,1),new hn(1,1,1,1),new hn(3,0,1,1),new hn(1,0,1,1)],this._cubeDirections=[new gn(1,0,0),new gn(-1,0,0),new gn(0,0,1),new gn(0,0,-1),new gn(0,1,0),new gn(0,-1,0)],this._cubeUps=[new gn(0,1,0),new gn(0,1,0),new gn(0,1,0),new gn(0,1,0),new gn(0,0,1),new gn(0,0,-1)]}function Fu(e,t,n,i){Pu.call(this,e,t),this.type="PointLight",Object.defineProperty(this,"power",{get:function(){return 4*this.intensity*Math.PI},set:function(e){this.intensity=e/(4*Math.PI)}}),this.distance=void 0!==n?n:0,this.decay=void 0!==i?i:1,this.shadow=new Nu}function zu(e,t,n,i,r,a){kr.call(this),this.type="OrthographicCamera",this.zoom=1,this.view=null,this.left=void 0!==e?e:-1,this.right=void 0!==t?t:1,this.top=void 0!==n?n:1,this.bottom=void 0!==i?i:-1,this.near=void 0!==r?r:.1,this.far=void 0!==a?a:2e3,this.updateProjectionMatrix()}function Uu(){Iu.call(this,new zu(-5,5,5,-5,.5,500))}function Bu(e,t){Pu.call(this,e,t),this.type="DirectionalLight",this.position.copy(Vn.DefaultUp),this.updateMatrix(),this.target=new Vn,this.shadow=new Uu}function Gu(e,t){Pu.call(this,e,t),this.type="AmbientLight",this.castShadow=void 0}function Hu(e,t,n,i){Pu.call(this,e,t),this.type="RectAreaLight",this.width=void 0!==n?n:10,this.height=void 0!==i?i:10}function ku(){this.coefficients=[];for(var e=0;e<9;e++)this.coefficients.push(new gn)}function Vu(e,t){Pu.call(this,void 0,t),this.type="LightProbe",this.sh=void 0!==e?e:new ku}function ju(e){Ql.call(this,e),this.textures={}}Au.prototype=J(Object.create(su.prototype),{constructor:Au,add:function(e){this.curves.push(e)},closePath:function(){var e=this.curves[0].getPoint(0),t=this.curves[this.curves.length-1].getPoint(1);e.equals(t)||this.curves.push(new bu(t,e))},getPoint:function(e){for(var t=e*this.getLength(),n=this.getCurveLengths(),i=0;i<n.length;){if(n[i]>=t){var r=n[i]-t,a=this.curves[i],o=a.getLength(),s=0===o?0:1-r/o;return a.getPointAt(s)}i++}return null},getLength:function(){var e=this.getCurveLengths();return e[e.length-1]},updateArcLengths:function(){this.needsUpdate=!0,this.cacheLengths=null,this.getCurveLengths()},getCurveLengths:function(){if(this.cacheLengths&&this.cacheLengths.length===this.curves.length)return this.cacheLengths;for(var e=[],t=0,n=0,i=this.curves.length;n<i;n++)t+=this.curves[n].getLength(),e.push(t);return this.cacheLengths=e},getSpacedPoints:function(e){void 0===e&&(e=40);for(var t=[],n=0;n<=e;n++)t.push(this.getPoint(n/e));return this.autoClose&&t.push(t[0]),t},getPoints:function(e){e=e||12;for(var t,n=[],i=0,r=this.curves;i<r.length;i++)for(var a=r[i],o=a&&a.isEllipseCurve?2*e:a&&(a.isLineCurve||a.isLineCurve3)?1:a&&a.isSplineCurve?e*a.points.length:e,s=a.getPoints(o),c=0;c<s.length;c++){var l=s[c];t&&t.equals(l)||(n.push(l),t=l)}return this.autoClose&&1<n.length&&!n[n.length-1].equals(n[0])&&n.push(n[0]),n},copy:function(e){su.prototype.copy.call(this,e),this.curves=[];for(var t=0,n=e.curves.length;t<n;t++){var i=e.curves[t];this.curves.push(i.clone())}return this.autoClose=e.autoClose,this},toJSON:function(){var e=su.prototype.toJSON.call(this);e.autoClose=this.autoClose,e.curves=[];for(var t=0,n=this.curves.length;t<n;t++){var i=this.curves[t];e.curves.push(i.toJSON())}return e},fromJSON:function(e){su.prototype.fromJSON.call(this,e),this.autoClose=e.autoClose,this.curves=[];for(var t=0,n=e.curves.length;t<n;t++){var i=e.curves[t];this.curves.push((new Eu[i.type]).fromJSON(i))}return this}}),Lu.prototype=J(Object.create(Au.prototype),{constructor:Lu,setFromPoints:function(e){this.moveTo(e[0].x,e[0].y);for(var t=1,n=e.length;t<n;t++)this.lineTo(e[t].x,e[t].y);return this},moveTo:function(e,t){return this.currentPoint.set(e,t),this},lineTo:function(e,t){var n=new bu(this.currentPoint.clone(),new on(e,t));return this.curves.push(n),this.currentPoint.set(e,t),this},quadraticCurveTo:function(e,t,n,i){var r=new Mu(this.currentPoint.clone(),new on(e,t),new on(n,i));return this.curves.push(r),this.currentPoint.set(n,i),this},bezierCurveTo:function(e,t,n,i,r,a){var o=new _u(this.currentPoint.clone(),new on(e,t),new on(n,i),new on(r,a));return this.curves.push(o),this.currentPoint.set(r,a),this},splineThru:function(e){var t=new Tu([this.currentPoint.clone()].concat(e));return this.curves.push(t),this.currentPoint.copy(e[e.length-1]),this},arc:function(e,t,n,i,r,a){var o=this.currentPoint.x,s=this.currentPoint.y;return this.absarc(e+o,t+s,n,i,r,a),this},absarc:function(e,t,n,i,r,a){return this.absellipse(e,t,n,n,i,r,a),this},ellipse:function(e,t,n,i,r,a,o,s){var c=this.currentPoint.x,l=this.currentPoint.y;return this.absellipse(e+c,t+l,n,i,r,a,o,s),this},absellipse:function(e,t,n,i,r,a,o,s){var c=new cu(e,t,n,i,r,a,o,s);if(0<this.curves.length){var l=c.getPoint(0);l.equals(this.currentPoint)||this.lineTo(l.x,l.y)}this.curves.push(c);var u=c.getPoint(1);return this.currentPoint.copy(u),this},copy:function(e){return Au.prototype.copy.call(this,e),this.currentPoint.copy(e.currentPoint),this},toJSON:function(){var e=Au.prototype.toJSON.call(this);return e.currentPoint=this.currentPoint.toArray(),e},fromJSON:function(e){return Au.prototype.fromJSON.call(this,e),this.currentPoint.fromArray(e.currentPoint),this}}),Ru.prototype=J(Object.create(Lu.prototype),{constructor:Ru,getPointsHoles:function(e){for(var t=[],n=0,i=this.holes.length;n<i;n++)t[n]=this.holes[n].getPoints(e);return t},extractPoints:function(e){return{shape:this.getPoints(e),holes:this.getPointsHoles(e)}},copy:function(e){Lu.prototype.copy.call(this,e),this.holes=[];for(var t=0,n=e.holes.length;t<n;t++){var i=e.holes[t];this.holes.push(i.clone())}return this},toJSON:function(){var e=Lu.prototype.toJSON.call(this);e.uuid=this.uuid,e.holes=[];for(var t=0,n=this.holes.length;t<n;t++){var i=this.holes[t];e.holes.push(i.toJSON())}return e},fromJSON:function(e){Lu.prototype.fromJSON.call(this,e),this.uuid=e.uuid,this.holes=[];for(var t=0,n=e.holes.length;t<n;t++){var i=e.holes[t];this.holes.push((new Lu).fromJSON(i))}return this}}),Pu.prototype=J(Object.create(Vn.prototype),{constructor:Pu,isLight:!0,copy:function(e){return Vn.prototype.copy.call(this,e),this.color.copy(e.color),this.intensity=e.intensity,this},toJSON:function(e){var t=Vn.prototype.toJSON.call(this,e);return t.object.color=this.color.getHex(),t.object.intensity=this.intensity,void 0!==this.groundColor&&(t.object.groundColor=this.groundColor.getHex()),void 0!==this.distance&&(t.object.distance=this.distance),void 0!==this.angle&&(t.object.angle=this.angle),void 0!==this.decay&&(t.object.decay=this.decay),void 0!==this.penumbra&&(t.object.penumbra=this.penumbra),void 0!==this.shadow&&(t.object.shadow=this.shadow.toJSON()),t}}),Cu.prototype=J(Object.create(Pu.prototype),{constructor:Cu,isHemisphereLight:!0,copy:function(e){return Pu.prototype.copy.call(this,e),this.groundColor.copy(e.groundColor),this}}),J(Iu.prototype,{_projScreenMatrix:new Tn,_lightPositionWorld:new gn,_lookTarget:new gn,getViewportCount:function(){return this._viewportCount},getFrustum:function(){return this._frustum},updateMatrices:function(e){var t=this.camera,n=this.matrix,i=this._projScreenMatrix,r=this._lookTarget,a=this._lightPositionWorld;a.setFromMatrixPosition(e.matrixWorld),t.position.copy(a),r.setFromMatrixPosition(e.target.matrixWorld),t.lookAt(r),t.updateMatrixWorld(),i.multiplyMatrices(t.projectionMatrix,t.matrixWorldInverse),this._frustum.setFromProjectionMatrix(i),n.set(.5,0,0,.5,0,.5,0,.5,0,0,.5,.5,0,0,0,1),n.multiply(t.projectionMatrix),n.multiply(t.matrixWorldInverse)},getViewport:function(e){return this._viewports[e]},getFrameExtents:function(){return this._frameExtents},copy:function(e){return this.camera=e.camera.clone(),this.bias=e.bias,this.radius=e.radius,this.mapSize.copy(e.mapSize),this},clone:function(){return(new this.constructor).copy(this)},toJSON:function(){var e={};return 0!==this.bias&&(e.bias=this.bias),1!==this.radius&&(e.radius=this.radius),512===this.mapSize.x&&512===this.mapSize.y||(e.mapSize=this.mapSize.toArray()),e.camera=this.camera.toJSON(!1).object,delete e.camera.matrix,e}}),Ou.prototype=J(Object.create(Iu.prototype),{constructor:Ou,isSpotLightShadow:!0,updateMatrices:function(e){var t=this.camera,n=2*an.RAD2DEG*e.angle,i=this.mapSize.width/this.mapSize.height,r=e.distance||t.far;n===t.fov&&i===t.aspect&&r===t.far||(t.fov=n,t.aspect=i,t.far=r,t.updateProjectionMatrix()),Iu.prototype.updateMatrices.call(this,e)}}),Du.prototype=J(Object.create(Pu.prototype),{constructor:Du,isSpotLight:!0,copy:function(e){return Pu.prototype.copy.call(this,e),this.distance=e.distance,this.angle=e.angle,this.penumbra=e.penumbra,this.decay=e.decay,this.target=e.target.clone(),this.shadow=e.shadow.clone(),this}}),Nu.prototype=J(Object.create(Iu.prototype),{constructor:Nu,isPointLightShadow:!0,updateMatrices:function(e,t){void 0===t&&(t=0);var n=this.camera,i=this.matrix,r=this._lightPositionWorld,a=this._lookTarget,o=this._projScreenMatrix;r.setFromMatrixPosition(e.matrixWorld),n.position.copy(r),a.copy(n.position),a.add(this._cubeDirections[t]),n.up.copy(this._cubeUps[t]),n.lookAt(a),n.updateMatrixWorld(),i.makeTranslation(-r.x,-r.y,-r.z),o.multiplyMatrices(n.projectionMatrix,n.matrixWorldInverse),this._frustum.setFromProjectionMatrix(o)}}),Fu.prototype=J(Object.create(Pu.prototype),{constructor:Fu,isPointLight:!0,copy:function(e){return Pu.prototype.copy.call(this,e),this.distance=e.distance,this.decay=e.decay,this.shadow=e.shadow.clone(),this}}),zu.prototype=J(Object.create(kr.prototype),{constructor:zu,isOrthographicCamera:!0,copy:function(e,t){return kr.prototype.copy.call(this,e,t),this.left=e.left,this.right=e.right,this.top=e.top,this.bottom=e.bottom,this.near=e.near,this.far=e.far,this.zoom=e.zoom,this.view=null===e.view?null:J({},e.view),this},setViewOffset:function(e,t,n,i,r,a){null===this.view&&(this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1}),this.view.enabled=!0,this.view.fullWidth=e,this.view.fullHeight=t,this.view.offsetX=n,this.view.offsetY=i,this.view.width=r,this.view.height=a,this.updateProjectionMatrix()},clearViewOffset:function(){null!==this.view&&(this.view.enabled=!1),this.updateProjectionMatrix()},updateProjectionMatrix:function(){var e=(this.right-this.left)/(2*this.zoom),t=(this.top-this.bottom)/(2*this.zoom),n=(this.right+this.left)/2,i=(this.top+this.bottom)/2,r=n-e,a=n+e,o=i+t,s=i-t;if(null!==this.view&&this.view.enabled){var c=(this.right-this.left)/this.view.fullWidth/this.zoom,l=(this.top-this.bottom)/this.view.fullHeight/this.zoom;a=(r+=c*this.view.offsetX)+c*this.view.width,s=(o-=l*this.view.offsetY)-l*this.view.height}this.projectionMatrix.makeOrthographic(r,a,o,s,this.near,this.far),this.projectionMatrixInverse.getInverse(this.projectionMatrix)},toJSON:function(e){var t=Vn.prototype.toJSON.call(this,e);return t.object.zoom=this.zoom,t.object.left=this.left,t.object.right=this.right,t.object.top=this.top,t.object.bottom=this.bottom,t.object.near=this.near,t.object.far=this.far,null!==this.view&&(t.object.view=J({},this.view)),t}}),Uu.prototype=J(Object.create(Iu.prototype),{constructor:Uu,isDirectionalLightShadow:!0,updateMatrices:function(e){Iu.prototype.updateMatrices.call(this,e)}}),Bu.prototype=J(Object.create(Pu.prototype),{constructor:Bu,isDirectionalLight:!0,copy:function(e){return Pu.prototype.copy.call(this,e),this.target=e.target.clone(),this.shadow=e.shadow.clone(),this}}),Gu.prototype=J(Object.create(Pu.prototype),{constructor:Gu,isAmbientLight:!0}),Hu.prototype=J(Object.create(Pu.prototype),{constructor:Hu,isRectAreaLight:!0,copy:function(e){return Pu.prototype.copy.call(this,e),this.width=e.width,this.height=e.height,this},toJSON:function(e){var t=Pu.prototype.toJSON.call(this,e);return t.object.width=this.width,t.object.height=this.height,t}}),J(ku.prototype,{isSphericalHarmonics3:!0,set:function(e){for(var t=0;t<9;t++)this.coefficients[t].copy(e[t]);return this},zero:function(){for(var e=0;e<9;e++)this.coefficients[e].set(0,0,0);return this},getAt:function(e,t){var n=e.x,i=e.y,r=e.z,a=this.coefficients;return t.copy(a[0]).multiplyScalar(.282095),t.addScaledVector(a[1],.488603*i),t.addScaledVector(a[2],.488603*r),t.addScaledVector(a[3],.488603*n),t.addScaledVector(a[4],n*i*1.092548),t.addScaledVector(a[5],i*r*1.092548),t.addScaledVector(a[6],.315392*(3*r*r-1)),t.addScaledVector(a[7],n*r*1.092548),t.addScaledVector(a[8],.546274*(n*n-i*i)),t},getIrradianceAt:function(e,t){var n=e.x,i=e.y,r=e.z,a=this.coefficients;return t.copy(a[0]).multiplyScalar(.886227),t.addScaledVector(a[1],1.023328*i),t.addScaledVector(a[2],1.023328*r),t.addScaledVector(a[3],1.023328*n),t.addScaledVector(a[4],.858086*n*i),t.addScaledVector(a[5],.858086*i*r),t.addScaledVector(a[6],.743125*r*r-.247708),t.addScaledVector(a[7],.858086*n*r),t.addScaledVector(a[8],.429043*(n*n-i*i)),t},add:function(e){for(var t=0;t<9;t++)this.coefficients[t].add(e.coefficients[t]);return this},addScaledSH:function(e,t){for(var n=0;n<9;n++)this.coefficients[n].addScaledVector(e.coefficients[n],t);return this},scale:function(e){for(var t=0;t<9;t++)this.coefficients[t].multiplyScalar(e);return this},lerp:function(e,t){for(var n=0;n<9;n++)this.coefficients[n].lerp(e.coefficients[n],t);return this},equals:function(e){for(var t=0;t<9;t++)if(!this.coefficients[t].equals(e.coefficients[t]))return!1;return!0},copy:function(e){return this.set(e.coefficients)},clone:function(){return(new this.constructor).copy(this)},fromArray:function(e,t){void 0===t&&(t=0);for(var n=this.coefficients,i=0;i<9;i++)n[i].fromArray(e,t+3*i);return this},toArray:function(e,t){void 0===e&&(e=[]),void 0===t&&(t=0);for(var n=this.coefficients,i=0;i<9;i++)n[i].toArray(e,t+3*i);return e}}),J(ku,{getBasisAt:function(e,t){var n=e.x,i=e.y,r=e.z;t[0]=.282095,t[1]=.488603*i,t[2]=.488603*r,t[3]=.488603*n,t[4]=1.092548*n*i,t[5]=1.092548*i*r,t[6]=.315392*(3*r*r-1),t[7]=1.092548*n*r,t[8]=.546274*(n*n-i*i)}}),Vu.prototype=J(Object.create(Pu.prototype),{constructor:Vu,isLightProbe:!0,copy:function(e){return Pu.prototype.copy.call(this,e),this.sh.copy(e.sh),this},fromJSON:function(e){return this.intensity=e.intensity,this.sh.fromArray(e.sh),this},toJSON:function(e){var t=Pu.prototype.toJSON.call(this,e);return t.object.sh=this.sh.toArray(),t}}),ju.prototype=J(Object.create(Ql.prototype),{constructor:ju,load:function(e,t,n,i){var r=this,a=new eu(r.manager);a.setPath(r.path),a.load(e,function(e){t(r.parse(JSON.parse(e)))},n,i)},parse:function(e){var t=this.textures;function n(e){return void 0===t[e]&&console.warn("THREE.MaterialLoader: Undefined texture",e),t[e]}var i=new Ol[e.type];if(void 0!==e.uuid&&(i.uuid=e.uuid),void 0!==e.name&&(i.name=e.name),void 0!==e.color&&i.color.setHex(e.color),void 0!==e.roughness&&(i.roughness=e.roughness),void 0!==e.metalness&&(i.metalness=e.metalness),void 0!==e.sheen&&(i.sheen=(new Di).setHex(e.sheen)),void 0!==e.emissive&&i.emissive.setHex(e.emissive),void 0!==e.specular&&i.specular.setHex(e.specular),void 0!==e.shininess&&(i.shininess=e.shininess),void 0!==e.clearcoat&&(i.clearcoat=e.clearcoat),void 0!==e.clearcoatRoughness&&(i.clearcoatRoughness=e.clearcoatRoughness),void 0!==e.fog&&(i.fog=e.fog),void 0!==e.flatShading&&(i.flatShading=e.flatShading),void 0!==e.blending&&(i.blending=e.blending),void 0!==e.combine&&(i.combine=e.combine),void 0!==e.side&&(i.side=e.side),void 0!==e.opacity&&(i.opacity=e.opacity),void 0!==e.transparent&&(i.transparent=e.transparent),void 0!==e.alphaTest&&(i.alphaTest=e.alphaTest),void 0!==e.depthTest&&(i.depthTest=e.depthTest),void 0!==e.depthWrite&&(i.depthWrite=e.depthWrite),void 0!==e.colorWrite&&(i.colorWrite=e.colorWrite),void 0!==e.stencilWrite&&(i.stencilWrite=e.stencilWrite),void 0!==e.stencilWriteMask&&(i.stencilWriteMask=e.stencilWriteMask),void 0!==e.stencilFunc&&(i.stencilFunc=e.stencilFunc),void 0!==e.stencilRef&&(i.stencilRef=e.stencilRef),void 0!==e.stencilFuncMask&&(i.stencilFuncMask=e.stencilFuncMask),void 0!==e.stencilFail&&(i.stencilFail=e.stencilFail),void 0!==e.stencilZFail&&(i.stencilZFail=e.stencilZFail),void 0!==e.stencilZPass&&(i.stencilZPass=e.stencilZPass),void 0!==e.wireframe&&(i.wireframe=e.wireframe),void 0!==e.wireframeLinewidth&&(i.wireframeLinewidth=e.wireframeLinewidth),void 0!==e.wireframeLinecap&&(i.wireframeLinecap=e.wireframeLinecap),void 0!==e.wireframeLinejoin&&(i.wireframeLinejoin=e.wireframeLinejoin),void 0!==e.rotation&&(i.rotation=e.rotation),1!==e.linewidth&&(i.linewidth=e.linewidth),void 0!==e.dashSize&&(i.dashSize=e.dashSize),void 0!==e.gapSize&&(i.gapSize=e.gapSize),void 0!==e.scale&&(i.scale=e.scale),void 0!==e.polygonOffset&&(i.polygonOffset=e.polygonOffset),void 0!==e.polygonOffsetFactor&&(i.polygonOffsetFactor=e.polygonOffsetFactor),void 0!==e.polygonOffsetUnits&&(i.polygonOffsetUnits=e.polygonOffsetUnits),void 0!==e.skinning&&(i.skinning=e.skinning),void 0!==e.morphTargets&&(i.morphTargets=e.morphTargets),void 0!==e.morphNormals&&(i.morphNormals=e.morphNormals),void 0!==e.dithering&&(i.dithering=e.dithering),void 0!==e.vertexTangents&&(i.vertexTangents=e.vertexTangents),void 0!==e.visible&&(i.visible=e.visible),void 0!==e.toneMapped&&(i.toneMapped=e.toneMapped),void 0!==e.userData&&(i.userData=e.userData),void 0!==e.vertexColors&&("number"==typeof e.vertexColors?i.vertexColors=0<e.vertexColors:i.vertexColors=e.vertexColors),void 0!==e.uniforms)for(var r in e.uniforms){var a=e.uniforms[r];switch(i.uniforms[r]={},a.type){case"t":i.uniforms[r].value=n(a.value);break;case"c":i.uniforms[r].value=(new Di).setHex(a.value);break;case"v2":i.uniforms[r].value=(new on).fromArray(a.value);break;case"v3":i.uniforms[r].value=(new gn).fromArray(a.value);break;case"v4":i.uniforms[r].value=(new hn).fromArray(a.value);break;case"m3":i.uniforms[r].value=(new sn).fromArray(a.value);case"m4":i.uniforms[r].value=(new Tn).fromArray(a.value);break;default:i.uniforms[r].value=a.value}}if(void 0!==e.defines&&(i.defines=e.defines),void 0!==e.vertexShader&&(i.vertexShader=e.vertexShader),void 0!==e.fragmentShader&&(i.fragmentShader=e.fragmentShader),void 0!==e.extensions)for(var o in e.extensions)i.extensions[o]=e.extensions[o];if(void 0!==e.shading&&(i.flatShading=1===e.shading),void 0!==e.size&&(i.size=e.size),void 0!==e.sizeAttenuation&&(i.sizeAttenuation=e.sizeAttenuation),void 0!==e.map&&(i.map=n(e.map)),void 0!==e.matcap&&(i.matcap=n(e.matcap)),void 0!==e.alphaMap&&(i.alphaMap=n(e.alphaMap)),void 0!==e.bumpMap&&(i.bumpMap=n(e.bumpMap)),void 0!==e.bumpScale&&(i.bumpScale=e.bumpScale),void 0!==e.normalMap&&(i.normalMap=n(e.normalMap)),void 0!==e.normalMapType&&(i.normalMapType=e.normalMapType),void 0!==e.normalScale){var s=e.normalScale;!1===Array.isArray(s)&&(s=[s,s]),i.normalScale=(new on).fromArray(s)}return void 0!==e.displacementMap&&(i.displacementMap=n(e.displacementMap)),void 0!==e.displacementScale&&(i.displacementScale=e.displacementScale),void 0!==e.displacementBias&&(i.displacementBias=e.displacementBias),void 0!==e.roughnessMap&&(i.roughnessMap=n(e.roughnessMap)),void 0!==e.metalnessMap&&(i.metalnessMap=n(e.metalnessMap)),void 0!==e.emissiveMap&&(i.emissiveMap=n(e.emissiveMap)),void 0!==e.emissiveIntensity&&(i.emissiveIntensity=e.emissiveIntensity),void 0!==e.specularMap&&(i.specularMap=n(e.specularMap)),void 0!==e.envMap&&(i.envMap=n(e.envMap)),void 0!==e.envMapIntensity&&(i.envMapIntensity=e.envMapIntensity),void 0!==e.reflectivity&&(i.reflectivity=e.reflectivity),void 0!==e.refractionRatio&&(i.refractionRatio=e.refractionRatio),void 0!==e.lightMap&&(i.lightMap=n(e.lightMap)),void 0!==e.lightMapIntensity&&(i.lightMapIntensity=e.lightMapIntensity),void 0!==e.aoMap&&(i.aoMap=n(e.aoMap)),void 0!==e.aoMapIntensity&&(i.aoMapIntensity=e.aoMapIntensity),void 0!==e.gradientMap&&(i.gradientMap=n(e.gradientMap)),void 0!==e.clearcoatMap&&(i.clearcoatMap=n(e.clearcoatMap)),void 0!==e.clearcoatRoughnessMap&&(i.clearcoatRoughnessMap=n(e.clearcoatRoughnessMap)),void 0!==e.clearcoatNormalMap&&(i.clearcoatNormalMap=n(e.clearcoatNormalMap)),void 0!==e.clearcoatNormalScale&&(i.clearcoatNormalScale=(new on).fromArray(e.clearcoatNormalScale)),i},setTextures:function(e){return this.textures=e,this}});var Wu={decodeText:function(e){if("undefined"!=typeof TextDecoder)return(new TextDecoder).decode(e);for(var t="",n=0,i=e.length;n<i;n++)t+=String.fromCharCode(e[n]);try{return decodeURIComponent(escape(t))}catch(e){return t}},extractUrlBase:function(e){var t=e.lastIndexOf("/");return-1===t?"./":e.substr(0,t+1)}};function qu(){cr.call(this),this.type="InstancedBufferGeometry",this.maxInstancedCount=void 0}function Xu(e,t,n,i){"number"==typeof n&&(i=n,n=!1,console.error("THREE.InstancedBufferAttribute: The constructor now expects normalized as the third argument.")),Vi.call(this,e,t,n),this.meshPerAttribute=i||1}function Yu(e){Ql.call(this,e)}qu.prototype=J(Object.create(cr.prototype),{constructor:qu,isInstancedBufferGeometry:!0,copy:function(e){return cr.prototype.copy.call(this,e),this.maxInstancedCount=e.maxInstancedCount,this},clone:function(){return(new this.constructor).copy(this)},toJSON:function(){var e=cr.prototype.toJSON.call(this);return e.maxInstancedCount=this.maxInstancedCount,e.isInstancedBufferGeometry=!0,e}}),Xu.prototype=J(Object.create(Vi.prototype),{constructor:Xu,isInstancedBufferAttribute:!0,copy:function(e){return Vi.prototype.copy.call(this,e),this.meshPerAttribute=e.meshPerAttribute,this},toJSON:function(){var e=Vi.prototype.toJSON.call(this);return e.meshPerAttribute=this.meshPerAttribute,e.isInstancedBufferAttribute=!0,e}}),Yu.prototype=J(Object.create(Ql.prototype),{constructor:Yu,load:function(e,t,n,i){var r=this,a=new eu(r.manager);a.setPath(r.path),a.load(e,function(e){t(r.parse(JSON.parse(e)))},n,i)},parse:function(e){var t=new(e.isInstancedBufferGeometry?qu:cr),n=e.data.index;if(void 0!==n){var i=new Zu[n.type](n.array);t.setIndex(new Vi(i,1))}var r=e.data.attributes;for(var a in r){var o=r[a],s=(i=new Zu[o.type](o.array),new(o.isInstancedBufferAttribute?Xu:Vi)(i,o.itemSize,o.normalized));void 0!==o.name&&(s.name=o.name),t.setAttribute(a,s)}var c=e.data.morphAttributes;if(c)for(var a in c){for(var l=c[a],u=[],h=0,d=l.length;h<d;h++){o=l[h],s=new Vi(i=new Zu[o.type](o.array),o.itemSize,o.normalized);void 0!==o.name&&(s.name=o.name),u.push(s)}t.morphAttributes[a]=u}e.data.morphTargetsRelative&&(t.morphTargetsRelative=!0);var p=e.data.groups||e.data.drawcalls||e.data.offsets;if(void 0!==p){h=0;for(var f=p.length;h!==f;++h){var m=p[h];t.addGroup(m.start,m.count,m.materialIndex)}}var v=e.data.boundingSphere;if(void 0!==v){var g=new gn;void 0!==v.center&&g.fromArray(v.center),t.boundingSphere=new si(g,v.radius)}return e.name&&(t.name=e.name),e.userData&&(t.userData=e.userData),t}});var Zu={Int8Array:Int8Array,Uint8Array:Uint8Array,Uint8ClampedArray:"undefined"!=typeof Uint8ClampedArray?Uint8ClampedArray:Uint8Array,Int16Array:Int16Array,Uint16Array:Uint16Array,Int32Array:Int32Array,Uint32Array:Uint32Array,Float32Array:Float32Array,Float64Array:Float64Array};function Ju(e){Ql.call(this,e)}Ju.prototype=J(Object.create(Ql.prototype),{constructor:Ju,load:function(i,r,e,a){var o=this,t=""===this.path?Wu.extractUrlBase(i):this.path;this.resourcePath=this.resourcePath||t;var n=new eu(o.manager);n.setPath(this.path),n.load(i,function(e){var t=null;try{t=JSON.parse(e)}catch(e){return void 0!==a&&a(e),void console.error("THREE:ObjectLoader: Can't parse "+i+".",e.message)}var n=t.metadata;void 0!==n&&void 0!==n.type&&"geometry"!==n.type.toLowerCase()?o.parse(t,r):console.error("THREE.ObjectLoader: Can't load "+i)},e,a)},parse:function(e,t){var n=this.parseShape(e.shapes),i=this.parseGeometries(e.geometries,n),r=this.parseImages(e.images,function(){void 0!==t&&t(s)}),a=this.parseTextures(e.textures,r),o=this.parseMaterials(e.materials,a),s=this.parseObject(e.object,i,o);return e.animations&&(s.animations=this.parseAnimations(e.animations)),void 0!==e.images&&0!==e.images.length||void 0!==t&&t(s),s},parseShape:function(e){var t={};if(void 0!==e)for(var n=0,i=e.length;n<i;n++){var r=(new Ru).fromJSON(e[n]);t[r.uuid]=r}return t},parseGeometries:function(e,t){var n={};if(void 0!==e)for(var i=new Yu,r=0,a=e.length;r<a;r++){var o,s=e[r];switch(s.type){case"PlaneGeometry":case"PlaneBufferGeometry":o=new wl[s.type](s.width,s.height,s.widthSegments,s.heightSegments);break;case"BoxGeometry":case"BoxBufferGeometry":case"CubeGeometry":o=new wl[s.type](s.width,s.height,s.depth,s.widthSegments,s.heightSegments,s.depthSegments);break;case"CircleGeometry":case"CircleBufferGeometry":o=new wl[s.type](s.radius,s.segments,s.thetaStart,s.thetaLength);break;case"CylinderGeometry":case"CylinderBufferGeometry":o=new wl[s.type](s.radiusTop,s.radiusBottom,s.height,s.radialSegments,s.heightSegments,s.openEnded,s.thetaStart,s.thetaLength);break;case"ConeGeometry":case"ConeBufferGeometry":o=new wl[s.type](s.radius,s.height,s.radialSegments,s.heightSegments,s.openEnded,s.thetaStart,s.thetaLength);break;case"SphereGeometry":case"SphereBufferGeometry":o=new wl[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":o=new wl[s.type](s.radius,s.detail);break;case"RingGeometry":case"RingBufferGeometry":o=new wl[s.type](s.innerRadius,s.outerRadius,s.thetaSegments,s.phiSegments,s.thetaStart,s.thetaLength);break;case"TorusGeometry":case"TorusBufferGeometry":o=new wl[s.type](s.radius,s.tube,s.radialSegments,s.tubularSegments,s.arc);break;case"TorusKnotGeometry":case"TorusKnotBufferGeometry":o=new wl[s.type](s.radius,s.tube,s.tubularSegments,s.radialSegments,s.p,s.q);break;case"TubeGeometry":case"TubeBufferGeometry":o=new wl[s.type]((new Eu[s.path.type]).fromJSON(s.path),s.tubularSegments,s.radius,s.radialSegments,s.closed);break;case"LatheGeometry":case"LatheBufferGeometry":o=new wl[s.type](s.points,s.segments,s.phiStart,s.phiLength);break;case"PolyhedronGeometry":case"PolyhedronBufferGeometry":o=new wl[s.type](s.vertices,s.indices,s.radius,s.details);break;case"ShapeGeometry":case"ShapeBufferGeometry":for(var c=[],l=0,u=s.shapes.length;l<u;l++){var h=t[s.shapes[l]];c.push(h)}o=new wl[s.type](c,s.curveSegments);break;case"ExtrudeGeometry":case"ExtrudeBufferGeometry":for(c=[],l=0,u=s.shapes.length;l<u;l++){h=t[s.shapes[l]];c.push(h)}var d=s.options.extrudePath;void 0!==d&&(s.options.extrudePath=(new Eu[d.type]).fromJSON(d)),o=new wl[s.type](c,s.options);break;case"BufferGeometry":case"InstancedBufferGeometry":o=i.parse(s);break;case"Geometry":console.error('THREE.ObjectLoader: Loading "Geometry" is not supported anymore.');break;default:console.warn('THREE.ObjectLoader: Unsupported geometry type "'+s.type+'"');continue}o.uuid=s.uuid,void 0!==s.name&&(o.name=s.name),!0===o.isBufferGeometry&&void 0!==s.userData&&(o.userData=s.userData),n[s.uuid]=o}return n},parseMaterials:function(e,t){var n={},i={};if(void 0!==e){var r=new ju;r.setTextures(t);for(var a=0,o=e.length;a<o;a++){var s=e[a];if("MultiMaterial"===s.type){for(var c=[],l=0;l<s.materials.length;l++){var u=s.materials[l];void 0===n[u.uuid]&&(n[u.uuid]=r.parse(u)),c.push(n[u.uuid])}i[s.uuid]=c}else void 0===n[s.uuid]&&(n[s.uuid]=r.parse(s)),i[s.uuid]=n[s.uuid]}}return i},parseAnimations:function(e){for(var t=[],n=0;n<e.length;n++){var i=e[n],r=Xl.parse(i);void 0!==i.uuid&&(r.uuid=i.uuid),t.push(r)}return t},parseImages:function(e,t){var n=this,i={};function r(e){return n.manager.itemStart(e),a.load(e,function(){n.manager.itemEnd(e)},void 0,function(){n.manager.itemError(e),n.manager.itemEnd(e)})}if(void 0!==e&&0<e.length){var a=new ru(new Jl(t));a.setCrossOrigin(this.crossOrigin);for(var o=0,s=e.length;o<s;o++){var c=e[o],l=c.url;if(Array.isArray(l)){i[c.uuid]=[];for(var u=0,h=l.length;u<h;u++){var d=l[u],p=/^(\/\/)|([a-z]+:(\/\/)?)/i.test(d)?d:n.resourcePath+d;i[c.uuid].push(r(p))}}else{p=/^(\/\/)|([a-z]+:(\/\/)?)/i.test(c.url)?c.url:n.resourcePath+c.url;i[c.uuid]=r(p)}}}return i},parseTextures:function(e,t){function n(e,t){return"number"==typeof e?e:(console.warn("THREE.ObjectLoader.parseTexture: Constant should be in numeric form.",e),t[e])}var i={};if(void 0!==e)for(var r=0,a=e.length;r<a;r++){var o,s=e[r];void 0===s.image&&console.warn('THREE.ObjectLoader: No "image" specified for',s.uuid),void 0===t[s.image]&&console.warn("THREE.ObjectLoader: Undefined image",s.image),(o=new(Array.isArray(t[s.image])?fa:un)(t[s.image])).needsUpdate=!0,o.uuid=s.uuid,void 0!==s.name&&(o.name=s.name),void 0!==s.mapping&&(o.mapping=n(s.mapping,Qu)),void 0!==s.offset&&o.offset.fromArray(s.offset),void 0!==s.repeat&&o.repeat.fromArray(s.repeat),void 0!==s.center&&o.center.fromArray(s.center),void 0!==s.rotation&&(o.rotation=s.rotation),void 0!==s.wrap&&(o.wrapS=n(s.wrap[0],$u),o.wrapT=n(s.wrap[1],$u)),void 0!==s.format&&(o.format=s.format),void 0!==s.type&&(o.type=s.type),void 0!==s.encoding&&(o.encoding=s.encoding),void 0!==s.minFilter&&(o.minFilter=n(s.minFilter,eh)),void 0!==s.magFilter&&(o.magFilter=n(s.magFilter,eh)),void 0!==s.anisotropy&&(o.anisotropy=s.anisotropy),void 0!==s.flipY&&(o.flipY=s.flipY),void 0!==s.premultiplyAlpha&&(o.premultiplyAlpha=s.premultiplyAlpha),void 0!==s.unpackAlignment&&(o.unpackAlignment=s.unpackAlignment),i[s.uuid]=o}return i},parseObject:function(e,t,a){var n;function i(e){return void 0===t[e]&&console.warn("THREE.ObjectLoader: Undefined geometry",e),t[e]}function r(e){if(void 0!==e){if(Array.isArray(e)){for(var t=[],n=0,i=e.length;n<i;n++){var r=e[n];void 0===a[r]&&console.warn("THREE.ObjectLoader: Undefined material",r),t.push(a[r])}return t}return void 0===a[e]&&console.warn("THREE.ObjectLoader: Undefined material",e),a[e]}}switch(e.type){case"Scene":n=new jn,void 0!==e.background&&Number.isInteger(e.background)&&(n.background=new Di(e.background)),void 0!==e.fog&&("Fog"===e.fog.type?n.fog=new is(e.fog.color,e.fog.near,e.fog.far):"FogExp2"===e.fog.type&&(n.fog=new ns(e.fog.color,e.fog.density)));break;case"PerspectiveCamera":n=new Vr(e.fov,e.aspect,e.near,e.far),void 0!==e.focus&&(n.focus=e.focus),void 0!==e.zoom&&(n.zoom=e.zoom),void 0!==e.filmGauge&&(n.filmGauge=e.filmGauge),void 0!==e.filmOffset&&(n.filmOffset=e.filmOffset),void 0!==e.view&&(n.view=J({},e.view));break;case"OrthographicCamera":n=new zu(e.left,e.right,e.top,e.bottom,e.near,e.far),void 0!==e.zoom&&(n.zoom=e.zoom),void 0!==e.view&&(n.view=J({},e.view));break;case"AmbientLight":n=new Gu(e.color,e.intensity);break;case"DirectionalLight":n=new Bu(e.color,e.intensity);break;case"PointLight":n=new Fu(e.color,e.intensity,e.distance,e.decay);break;case"RectAreaLight":n=new Hu(e.color,e.intensity,e.width,e.height);break;case"SpotLight":n=new Du(e.color,e.intensity,e.distance,e.angle,e.penumbra,e.decay);break;case"HemisphereLight":n=new Cu(e.color,e.groundColor,e.intensity);break;case"LightProbe":n=(new Vu).fromJSON(e);break;case"SkinnedMesh":console.warn("THREE.ObjectLoader.parseObject() does not support SkinnedMesh yet.");case"Mesh":n=new Er(o=i(e.geometry),s=r(e.material));break;case"InstancedMesh":var o=i(e.geometry),s=r(e.material),c=e.count,l=e.instanceMatrix;(n=new Gs(o,s,c)).instanceMatrix=new Vi(new Float32Array(l.array),16);break;case"LOD":n=new Ps;break;case"Line":n=new Xs(i(e.geometry),r(e.material),e.mode);break;case"LineLoop":n=new Ks(i(e.geometry),r(e.material));break;case"LineSegments":n=new Js(i(e.geometry),r(e.material));break;case"PointCloud":case"Points":n=new ic(i(e.geometry),r(e.material));break;case"Sprite":n=new bs(r(e.material));break;case"Group":n=new Qo;break;default:n=new Vn}if(n.uuid=e.uuid,void 0!==e.name&&(n.name=e.name),void 0!==e.matrix?(n.matrix.fromArray(e.matrix),void 0!==e.matrixAutoUpdate&&(n.matrixAutoUpdate=e.matrixAutoUpdate),n.matrixAutoUpdate&&n.matrix.decompose(n.position,n.quaternion,n.scale)):(void 0!==e.position&&n.position.fromArray(e.position),void 0!==e.rotation&&n.rotation.fromArray(e.rotation),void 0!==e.quaternion&&n.quaternion.fromArray(e.quaternion),void 0!==e.scale&&n.scale.fromArray(e.scale)),void 0!==e.castShadow&&(n.castShadow=e.castShadow),void 0!==e.receiveShadow&&(n.receiveShadow=e.receiveShadow),e.shadow&&(void 0!==e.shadow.bias&&(n.shadow.bias=e.shadow.bias),void 0!==e.shadow.radius&&(n.shadow.radius=e.shadow.radius),void 0!==e.shadow.mapSize&&n.shadow.mapSize.fromArray(e.shadow.mapSize),void 0!==e.shadow.camera&&(n.shadow.camera=this.parseObject(e.shadow.camera))),void 0!==e.visible&&(n.visible=e.visible),void 0!==e.frustumCulled&&(n.frustumCulled=e.frustumCulled),void 0!==e.renderOrder&&(n.renderOrder=e.renderOrder),void 0!==e.userData&&(n.userData=e.userData),void 0!==e.layers&&(n.layers.mask=e.layers),void 0!==e.children)for(var u=e.children,h=0;h<u.length;h++)n.add(this.parseObject(u[h],t,a));if("LOD"===e.type){void 0!==e.autoUpdate&&(n.autoUpdate=e.autoUpdate);for(var d=e.levels,p=0;p<d.length;p++){var f=d[p],m=n.getObjectByProperty("uuid",f.object);void 0!==m&&n.addLevel(m,f.distance)}}return n}});var Ku,Qu={UVMapping:300,CubeReflectionMapping:Y,CubeRefractionMapping:Z,EquirectangularReflectionMapping:De,EquirectangularRefractionMapping:Ne,SphericalReflectionMapping:Fe,CubeUVReflectionMapping:ze,CubeUVRefractionMapping:Ue},$u={RepeatWrapping:Be,ClampToEdgeWrapping:Ge,MirroredRepeatWrapping:He},eh={NearestFilter:ke,NearestMipmapNearestFilter:Ve,NearestMipmapLinearFilter:je,LinearFilter:We,LinearMipmapNearestFilter:qe,LinearMipmapLinearFilter:Xe};function th(e){"undefined"==typeof createImageBitmap&&console.warn("THREE.ImageBitmapLoader: createImageBitmap() not supported."),"undefined"==typeof fetch&&console.warn("THREE.ImageBitmapLoader: fetch() not supported."),Ql.call(this,e),this.options=void 0}function nh(){this.type="ShapePath",this.color=new Di,this.subPaths=[],this.currentPath=null}function ih(e){this.type="Font",this.data=e}function rh(e,t,n,i,r){var a=r.glyphs[e]||r.glyphs["?"];if(a){var o,s,c,l,u,h,d,p,f=new nh;if(a.o)for(var m=a._cachedOutline||(a._cachedOutline=a.o.split(" ")),v=0,g=m.length;v<g;){switch(m[v++]){case"m":o=m[v++]*t+n,s=m[v++]*t+i,f.moveTo(o,s);break;case"l":o=m[v++]*t+n,s=m[v++]*t+i,f.lineTo(o,s);break;case"q":c=m[v++]*t+n,l=m[v++]*t+i,u=m[v++]*t+n,h=m[v++]*t+i,f.quadraticCurveTo(u,h,c,l);break;case"b":c=m[v++]*t+n,l=m[v++]*t+i,u=m[v++]*t+n,h=m[v++]*t+i,d=m[v++]*t+n,p=m[v++]*t+i,f.bezierCurveTo(u,h,d,p,c,l)}}return{offsetX:a.ha*t,path:f}}console.error('THREE.Font: character "'+e+'" does not exists in font family '+r.familyName+".")}function ah(e){Ql.call(this,e)}th.prototype=J(Object.create(Ql.prototype),{constructor:th,setOptions:function(e){return this.options=e,this},load:function(t,n,e,i){void 0===t&&(t=""),void 0!==this.path&&(t=this.path+t),t=this.manager.resolveURL(t);var r=this,a=Zl.get(t);if(void 0!==a)return r.manager.itemStart(t),setTimeout(function(){n&&n(a),r.manager.itemEnd(t)},0),a;fetch(t).then(function(e){return e.blob()}).then(function(e){return void 0===r.options?createImageBitmap(e):createImageBitmap(e,r.options)}).then(function(e){Zl.add(t,e),n&&n(e),r.manager.itemEnd(t)}).catch(function(e){i&&i(e),r.manager.itemError(t),r.manager.itemEnd(t)}),r.manager.itemStart(t)}}),J(nh.prototype,{moveTo:function(e,t){return this.currentPath=new Lu,this.subPaths.push(this.currentPath),this.currentPath.moveTo(e,t),this},lineTo:function(e,t){return this.currentPath.lineTo(e,t),this},quadraticCurveTo:function(e,t,n,i){return this.currentPath.quadraticCurveTo(e,t,n,i),this},bezierCurveTo:function(e,t,n,i,r,a){return this.currentPath.bezierCurveTo(e,t,n,i,r,a),this},splineThru:function(e){return this.currentPath.splineThru(e),this},toShapes:function(e,t){function n(e){for(var t=[],n=0,i=e.length;n<i;n++){var r=e[n],a=new Ru;a.curves=r.curves,t.push(a)}return t}function i(e,t){for(var n=t.length,i=!1,r=n-1,a=0;a<n;r=a++){var o=t[r],s=t[a],c=s.x-o.x,l=s.y-o.y;if(Math.abs(l)>Number.EPSILON){if(l<0&&(o=t[a],c=-c,s=t[r],l=-l),e.y<o.y||e.y>s.y)continue;if(e.y===o.y){if(e.x===o.x)return 1}else{var u=l*(e.x-o.x)-c*(e.y-o.y);if(0==u)return 1;if(u<0)continue;i=!i}}else{if(e.y!==o.y)continue;if(s.x<=e.x&&e.x<=o.x||o.x<=e.x&&e.x<=s.x)return 1}}return i}var r=Kc.isClockWise,a=this.subPaths;if(0===a.length)return[];if(!0===t)return n(a);var o,s,c,l=[];if(1===a.length)return s=a[0],(c=new Ru).curves=s.curves,l.push(c),l;var u=!r(a[0].getPoints());u=e?!u:u;var h,d,p=[],f=[],m=[],v=0;f[v]=void 0,m[v]=[];for(var g=0,y=a.length;g<y;g++)o=r(h=(s=a[g]).getPoints()),(o=e?!o:o)?(!u&&f[v]&&v++,f[v]={s:new Ru,p:h},f[v].s.curves=s.curves,u&&v++,m[v]=[]):m[v].push({h:s,p:h[0]});if(!f[0])return n(a);if(1<f.length){for(var _=!1,x=[],b=0,w=f.length;b<w;b++)p[b]=[];for(b=0,w=f.length;b<w;b++)for(var M=m[b],S=0;S<M.length;S++){for(var T=M[S],E=!0,A=0;A<f.length;A++)i(T.p,f[A].p)&&(b!==A&&x.push({froms:b,tos:A,hole:S}),E?(E=!1,p[A].push(T)):_=!0);E&&p[b].push(T)}0<x.length&&(_||(m=p))}g=0;for(var L=f.length;g<L;g++){c=f[g].s,l.push(c);for(var R=0,P=(d=m[g]).length;R<P;R++)c.holes.push(d[R].h)}return l}}),J(ih.prototype,{isFont:!0,generateShapes:function(e,t){void 0===t&&(t=100);for(var n=[],i=function(e,t,n){for(var i=Array.from?Array.from(e):String(e).split(""),r=t/n.resolution,a=(n.boundingBox.yMax-n.boundingBox.yMin+n.underlineThickness)*r,o=[],s=0,c=0,l=0;l<i.length;l++){var u=i[l];if("\n"===u)s=0,c-=a;else{var h=rh(u,r,s,c,n);s+=h.offsetX,o.push(h.path)}}return o}(e,t,this.data),r=0,a=i.length;r<a;r++)Array.prototype.push.apply(n,i[r].toShapes());return n}}),ah.prototype=J(Object.create(Ql.prototype),{constructor:ah,load:function(e,i,t,n){var r=this,a=new eu(this.manager);a.setPath(this.path),a.load(e,function(t){var n;try{n=JSON.parse(t)}catch(e){console.warn("THREE.FontLoader: typeface.js support is being deprecated. Use typeface.json instead."),n=JSON.parse(t.substring(65,t.length-2))}var e=r.parse(n);i&&i(e)},t,n)},parse:function(e){return new ih(e)}});var oh={getContext:function(){return void 0===Ku&&(Ku=new(window.AudioContext||window.webkitAudioContext)),Ku},setContext:function(e){Ku=e}};function sh(e){Ql.call(this,e)}function ch(e,t,n){Vu.call(this,void 0,n);var i=(new Di).set(e),r=(new Di).set(t),a=new gn(i.r,i.g,i.b),o=new gn(r.r,r.g,r.b),s=Math.sqrt(Math.PI),c=s*Math.sqrt(.75);this.sh.coefficients[0].copy(a).add(o).multiplyScalar(s),this.sh.coefficients[1].copy(a).sub(o).multiplyScalar(c)}function lh(e,t){Vu.call(this,void 0,t);var n=(new Di).set(e);this.sh.coefficients[0].set(n.r,n.g,n.b).multiplyScalar(2*Math.sqrt(Math.PI))}sh.prototype=J(Object.create(Ql.prototype),{constructor:sh,load:function(e,n,t,i){var r=new eu(this.manager);r.setResponseType("arraybuffer"),r.setPath(this.path),r.load(e,function(e){var t=e.slice(0);oh.getContext().decodeAudioData(t,function(e){n(e)})},t,i)}}),ch.prototype=J(Object.create(Vu.prototype),{constructor:ch,isHemisphereLightProbe:!0,copy:function(e){return Vu.prototype.copy.call(this,e),this},toJSON:function(e){return Vu.prototype.toJSON.call(this,e)}}),lh.prototype=J(Object.create(Vu.prototype),{constructor:lh,isAmbientLightProbe:!0,copy:function(e){return Vu.prototype.copy.call(this,e),this},toJSON:function(e){return Vu.prototype.toJSON.call(this,e)}});var uh=new Tn,hh=new Tn;function dh(){this.type="StereoCamera",this.aspect=1,this.eyeSep=.064,this.cameraL=new Vr,this.cameraL.layers.enable(1),this.cameraL.matrixAutoUpdate=!1,this.cameraR=new Vr,this.cameraR.layers.enable(2),this.cameraR.matrixAutoUpdate=!1,this._cache={focus:null,fov:null,aspect:null,near:null,far:null,zoom:null,eyeSep:null}}function ph(e){this.autoStart=void 0===e||e,this.startTime=0,this.oldTime=0,this.elapsedTime=0,this.running=!1}J(dh.prototype,{update:function(e){var t=this._cache;if(t.focus!==e.focus||t.fov!==e.fov||t.aspect!==e.aspect*this.aspect||t.near!==e.near||t.far!==e.far||t.zoom!==e.zoom||t.eyeSep!==this.eyeSep){t.focus=e.focus,t.fov=e.fov,t.aspect=e.aspect*this.aspect,t.near=e.near,t.far=e.far,t.zoom=e.zoom,t.eyeSep=this.eyeSep;var n,i,r=e.projectionMatrix.clone(),a=t.eyeSep/2,o=a*t.near/t.focus,s=t.near*Math.tan(an.DEG2RAD*t.fov*.5)/t.zoom;hh.elements[12]=-a,uh.elements[12]=a,n=-s*t.aspect+o,i=s*t.aspect+o,r.elements[0]=2*t.near/(i-n),r.elements[8]=(i+n)/(i-n),this.cameraL.projectionMatrix.copy(r),n=-s*t.aspect-o,i=s*t.aspect-o,r.elements[0]=2*t.near/(i-n),r.elements[8]=(i+n)/(i-n),this.cameraR.projectionMatrix.copy(r)}this.cameraL.matrixWorld.copy(e.matrixWorld).multiply(hh),this.cameraR.matrixWorld.copy(e.matrixWorld).multiply(uh)}}),J(ph.prototype,{start:function(){this.startTime=("undefined"==typeof performance?Date:performance).now(),this.oldTime=this.startTime,this.elapsedTime=0,this.running=!0},stop:function(){this.getElapsedTime(),this.running=!1,this.autoStart=!1},getElapsedTime:function(){return this.getDelta(),this.elapsedTime},getDelta:function(){var e=0;if(this.autoStart&&!this.running)return this.start(),0;if(this.running){var t=("undefined"==typeof performance?Date:performance).now();e=(t-this.oldTime)/1e3,this.oldTime=t,this.elapsedTime+=e}return e}});var fh=new gn,mh=new fn,vh=new gn,gh=new gn;function yh(){Vn.call(this),this.type="AudioListener",this.context=oh.getContext(),this.gain=this.context.createGain(),this.gain.connect(this.context.destination),this.filter=null,this.timeDelta=0,this._clock=new ph}function _h(e){Vn.call(this),this.type="Audio",this.listener=e,this.context=e.context,this.gain=this.context.createGain(),this.gain.connect(e.getInput()),this.autoplay=!1,this.buffer=null,this.detune=0,this.loop=!1,this.loopStart=0,this.loopEnd=0,this.offset=0,this.duration=void 0,this.playbackRate=1,this.isPlaying=!1,this.hasPlaybackControl=!0,this.sourceType="empty",this._startedAt=0,this._progress=0,this.filters=[]}yh.prototype=J(Object.create(Vn.prototype),{constructor:yh,getInput:function(){return this.gain},removeFilter:function(){return null!==this.filter&&(this.gain.disconnect(this.filter),this.filter.disconnect(this.context.destination),this.gain.connect(this.context.destination),this.filter=null),this},getFilter:function(){return this.filter},setFilter:function(e){return null!==this.filter?(this.gain.disconnect(this.filter),this.filter.disconnect(this.context.destination)):this.gain.disconnect(this.context.destination),this.filter=e,this.gain.connect(this.filter),this.filter.connect(this.context.destination),this},getMasterVolume:function(){return this.gain.gain.value},setMasterVolume:function(e){return this.gain.gain.setTargetAtTime(e,this.context.currentTime,.01),this},updateMatrixWorld:function(e){Vn.prototype.updateMatrixWorld.call(this,e);var t=this.context.listener,n=this.up;if(this.timeDelta=this._clock.getDelta(),this.matrixWorld.decompose(fh,mh,vh),gh.set(0,0,-1).applyQuaternion(mh),t.positionX){var i=this.context.currentTime+this.timeDelta;t.positionX.linearRampToValueAtTime(fh.x,i),t.positionY.linearRampToValueAtTime(fh.y,i),t.positionZ.linearRampToValueAtTime(fh.z,i),t.forwardX.linearRampToValueAtTime(gh.x,i),t.forwardY.linearRampToValueAtTime(gh.y,i),t.forwardZ.linearRampToValueAtTime(gh.z,i),t.upX.linearRampToValueAtTime(n.x,i),t.upY.linearRampToValueAtTime(n.y,i),t.upZ.linearRampToValueAtTime(n.z,i)}else t.setPosition(fh.x,fh.y,fh.z),t.setOrientation(gh.x,gh.y,gh.z,n.x,n.y,n.z)}}),_h.prototype=J(Object.create(Vn.prototype),{constructor:_h,getOutput:function(){return this.gain},setNodeSource:function(e){return this.hasPlaybackControl=!1,this.sourceType="audioNode",this.source=e,this.connect(),this},setMediaElementSource:function(e){return this.hasPlaybackControl=!1,this.sourceType="mediaNode",this.source=this.context.createMediaElementSource(e),this.connect(),this},setMediaStreamSource:function(e){return this.hasPlaybackControl=!1,this.sourceType="mediaStreamNode",this.source=this.context.createMediaStreamSource(e),this.connect(),this},setBuffer:function(e){return this.buffer=e,this.sourceType="buffer",this.autoplay&&this.play(),this},play:function(e){if(void 0===e&&(e=0),!0!==this.isPlaying){if(!1!==this.hasPlaybackControl){this._startedAt=this.context.currentTime+e;var t=this.context.createBufferSource();return t.buffer=this.buffer,t.loop=this.loop,t.loopStart=this.loopStart,t.loopEnd=this.loopEnd,t.onended=this.onEnded.bind(this),t.start(this._startedAt,this._progress+this.offset,this.duration),this.isPlaying=!0,this.source=t,this.setDetune(this.detune),this.setPlaybackRate(this.playbackRate),this.connect()}console.warn("THREE.Audio: this Audio has no playback control.")}else console.warn("THREE.Audio: Audio is already playing.")},pause:function(){if(!1!==this.hasPlaybackControl)return!0===this.isPlaying&&(this._progress+=Math.max(this.context.currentTime-this._startedAt,0)*this.playbackRate,!0===this.loop&&(this._progress=this._progress%(this.duration||this.buffer.duration)),this.source.stop(),this.source.onended=null,this.isPlaying=!1),this;console.warn("THREE.Audio: this Audio has no playback control.")},stop:function(){if(!1!==this.hasPlaybackControl)return this._progress=0,this.source.stop(),this.source.onended=null,this.isPlaying=!1,this;console.warn("THREE.Audio: this Audio has no playback control.")},connect:function(){if(0<this.filters.length){this.source.connect(this.filters[0]);for(var e=1,t=this.filters.length;e<t;e++)this.filters[e-1].connect(this.filters[e]);this.filters[this.filters.length-1].connect(this.getOutput())}else this.source.connect(this.getOutput());return this},disconnect:function(){if(0<this.filters.length){this.source.disconnect(this.filters[0]);for(var e=1,t=this.filters.length;e<t;e++)this.filters[e-1].disconnect(this.filters[e]);this.filters[this.filters.length-1].disconnect(this.getOutput())}else this.source.disconnect(this.getOutput());return this},getFilters:function(){return this.filters},setFilters:function(e){return e=e||[],!0===this.isPlaying?(this.disconnect(),this.filters=e,this.connect()):this.filters=e,this},setDetune:function(e){if(this.detune=e,void 0!==this.source.detune)return!0===this.isPlaying&&this.source.detune.setTargetAtTime(this.detune,this.context.currentTime,.01),this},getDetune:function(){return this.detune},getFilter:function(){return this.getFilters()[0]},setFilter:function(e){return this.setFilters(e?[e]:[])},setPlaybackRate:function(e){if(!1!==this.hasPlaybackControl)return this.playbackRate=e,!0===this.isPlaying&&this.source.playbackRate.setTargetAtTime(this.playbackRate,this.context.currentTime,.01),this;console.warn("THREE.Audio: this Audio has no playback control.")},getPlaybackRate:function(){return this.playbackRate},onEnded:function(){this.isPlaying=!1},getLoop:function(){return!1===this.hasPlaybackControl?(console.warn("THREE.Audio: this Audio has no playback control."),!1):this.loop},setLoop:function(e){if(!1!==this.hasPlaybackControl)return this.loop=e,!0===this.isPlaying&&(this.source.loop=this.loop),this;console.warn("THREE.Audio: this Audio has no playback control.")},setLoopStart:function(e){return this.loopStart=e,this},setLoopEnd:function(e){return this.loopEnd=e,this},getVolume:function(){return this.gain.gain.value},setVolume:function(e){return this.gain.gain.setTargetAtTime(e,this.context.currentTime,.01),this}});var xh=new gn,bh=new fn,wh=new gn,Mh=new gn;function Sh(e){_h.call(this,e),this.panner=this.context.createPanner(),this.panner.panningModel="HRTF",this.panner.connect(this.gain)}function Th(e,t){this.analyser=e.context.createAnalyser(),this.analyser.fftSize=void 0!==t?t:2048,this.data=new Uint8Array(this.analyser.frequencyBinCount),e.getOutput().connect(this.analyser)}function Eh(e,t,n){var i,r,a;switch(this.binding=e,this.valueSize=n,t){case"quaternion":i=this._slerp,r=this._slerpAdditive,a=this._setAdditiveIdentityQuaternion,this.buffer=new Float64Array(6*n),this._workIndex=5;break;case"string":case"bool":i=this._select,r=this._select,a=this._setAdditiveIdentityOther,this.buffer=new Array(5*n);break;default:i=this._lerp,r=this._lerpAdditive,a=this._setAdditiveIdentityNumeric,this.buffer=new Float64Array(5*n)}this._mixBufferRegion=i,this._mixBufferRegionAdditive=r,this._setIdentity=a,this._origIndex=3,this._addIndex=4,this.cumulativeWeight=0,this.cumulativeWeightAdditive=0,this.useCount=0,this.referenceCount=0}Sh.prototype=J(Object.create(_h.prototype),{constructor:Sh,getOutput:function(){return this.panner},getRefDistance:function(){return this.panner.refDistance},setRefDistance:function(e){return this.panner.refDistance=e,this},getRolloffFactor:function(){return this.panner.rolloffFactor},setRolloffFactor:function(e){return this.panner.rolloffFactor=e,this},getDistanceModel:function(){return this.panner.distanceModel},setDistanceModel:function(e){return this.panner.distanceModel=e,this},getMaxDistance:function(){return this.panner.maxDistance},setMaxDistance:function(e){return this.panner.maxDistance=e,this},setDirectionalCone:function(e,t,n){return this.panner.coneInnerAngle=e,this.panner.coneOuterAngle=t,this.panner.coneOuterGain=n,this},updateMatrixWorld:function(e){if(Vn.prototype.updateMatrixWorld.call(this,e),!0!==this.hasPlaybackControl||!1!==this.isPlaying){this.matrixWorld.decompose(xh,bh,wh),Mh.set(0,0,1).applyQuaternion(bh);var t=this.panner;if(t.positionX){var n=this.context.currentTime+this.listener.timeDelta;t.positionX.linearRampToValueAtTime(xh.x,n),t.positionY.linearRampToValueAtTime(xh.y,n),t.positionZ.linearRampToValueAtTime(xh.z,n),t.orientationX.linearRampToValueAtTime(Mh.x,n),t.orientationY.linearRampToValueAtTime(Mh.y,n),t.orientationZ.linearRampToValueAtTime(Mh.z,n)}else t.setPosition(xh.x,xh.y,xh.z),t.setOrientation(Mh.x,Mh.y,Mh.z)}}}),J(Th.prototype,{getFrequencyData:function(){return this.analyser.getByteFrequencyData(this.data),this.data},getAverageFrequency:function(){for(var e=0,t=this.getFrequencyData(),n=0;n<t.length;n++)e+=t[n];return e/t.length}}),J(Eh.prototype,{accumulate:function(e,t){var n=this.buffer,i=this.valueSize,r=e*i+i,a=this.cumulativeWeight;if(0===a){for(var o=0;o!==i;++o)n[r+o]=n[o];a=t}else{var s=t/(a+=t);this._mixBufferRegion(n,r,0,s,i)}this.cumulativeWeight=a},accumulateAdditive:function(e){var t=this.buffer,n=this.valueSize,i=n*this._addIndex;0===this.cumulativeWeightAdditive&&this._setIdentity(),this._mixBufferRegionAdditive(t,i,0,e,n),this.cumulativeWeightAdditive+=e},apply:function(e){var t=this.valueSize,n=this.buffer,i=e*t+t,r=this.cumulativeWeight,a=this.cumulativeWeightAdditive,o=this.binding;if(this.cumulativeWeight=0,this.cumulativeWeightAdditive=0,r<1){var s=t*this._origIndex;this._mixBufferRegion(n,i,s,1-r,t)}0<a&&this._mixBufferRegionAdditive(n,i,this._addIndex*t,1,t);for(var c=t,l=t+t;c!==l;++c)if(n[c]!==n[c+t]){o.setValue(n,i);break}},saveOriginalState:function(){var e=this.binding,t=this.buffer,n=this.valueSize,i=n*this._origIndex;e.getValue(t,i);for(var r=n,a=i;r!==a;++r)t[r]=t[i+r%n];this._setIdentity(),this.cumulativeWeight=0,this.cumulativeWeightAdditive=0},restoreOriginalState:function(){var e=3*this.valueSize;this.binding.setValue(this.buffer,e)},_setAdditiveIdentityNumeric:function(){var e=this._addIndex*this.valueSize;this.buffer.fill(0,e,e+this.valueSize)},_setAdditiveIdentityQuaternion:function(){this._setAdditiveIdentityNumeric(),this.buffer[4*this._addIndex+3]=1},_setAdditiveIdentityOther:function(){var e=this._origIndex*this.valueSize,t=this._addIndex*this.valueSize;this.buffer.copyWithin(t,e,this.valueSize)},_select:function(e,t,n,i,r){if(.5<=i)for(var a=0;a!==r;++a)e[t+a]=e[n+a]},_slerp:function(e,t,n,i){fn.slerpFlat(e,t,e,t,e,n,i)},_slerpAdditive:function(e,t,n,i,r){var a=this._workIndex*r;fn.multiplyQuaternionsFlat(e,a,e,t,e,n),fn.slerpFlat(e,t,e,t,e,a,i)},_lerp:function(e,t,n,i,r){for(var a=1-i,o=0;o!==r;++o){var s=t+o;e[s]=e[s]*a+e[n+o]*i}},_lerpAdditive:function(e,t,n,i,r){for(var a=0;a!==r;++a){var o=t+a;e[o]=e[o]+e[n+a]*i}}});var Ah="\\[\\]\\.:\\/",Lh=new RegExp("["+Ah+"]","g"),Rh="[^"+Ah+"]",Ph="[^"+Ah.replace("\\.","")+"]",Ch=/((?:WC+[\/:])*)/.source.replace("WC",Rh),Ih=/(WCOD+)?/.source.replace("WCOD",Ph),Oh=/(?:\.(WC+)(?:\[(.+)\])?)?/.source.replace("WC",Rh),Dh=/\.(WC+)(?:\[(.+)\])?/.source.replace("WC",Rh),Nh=new RegExp("^"+Ch+Ih+Oh+Dh+"$"),Fh=["material","materials","bones"];function zh(e,t,n){var i=n||Uh.parseTrackName(t);this._targetGroup=e,this._bindings=e.subscribe_(t,i)}function Uh(e,t,n){this.path=t,this.parsedPath=n||Uh.parseTrackName(t),this.node=Uh.findNode(e,this.parsedPath.nodeName)||e,this.rootNode=e}function Bh(){this.uuid=an.generateUUID(),this._objects=Array.prototype.slice.call(arguments),this.nCachedObjects_=0;var e={};this._indicesByUUID=e;for(var t=0,n=arguments.length;t!==n;++t)e[arguments[t].uuid]=t;this._paths=[],this._parsedPaths=[],this._bindings=[],this._bindingsIndicesByPath={};var i=this;this.stats={objects:{get total(){return i._objects.length},get inUse(){return this.total-i.nCachedObjects_}},get bindingsPerObject(){return i._bindings.length}}}function Gh(e,t,n,i){this._mixer=e,this._clip=t,this._localRoot=n||null,this.blendMode=i||t.blendMode;for(var r=t.tracks,a=r.length,o=new Array(a),s={endingStart:Nt,endingEnd:Nt},c=0;c!==a;++c){var l=r[c].createInterpolant(null);(o[c]=l).settings=s}this._interpolantSettings=s,this._interpolants=o,this._propertyBindings=new Array(a),this._cacheIndex=null,this._byClipCacheIndex=null,this._timeScaleInterpolant=null,this._weightInterpolant=null,this.loop=2201,this._loopCount=-1,this._startTime=null,this.time=0,this.timeScale=1,this._effectiveTimeScale=1,this.weight=1,this._effectiveWeight=1,this.repetitions=1/0,this.paused=!1,this.enabled=!0,this.clampWhenFinished=!1,this.zeroSlopeAtStart=!0,this.zeroSlopeAtEnd=!0}function Hh(e){this._root=e,this._initMemoryManager(),this._accuIndex=0,this.time=0,this.timeScale=1}function kh(e){"string"==typeof e&&(console.warn("THREE.Uniform: Type parameter is no longer needed."),e=arguments[1]),this.value=e}function Vh(e,t,n){rs.call(this,e,t),this.meshPerAttribute=n||1}function jh(e,t,n,i){this.ray=new mi(e,t),this.near=n||0,this.far=i||1/0,this.camera=null,this.layers=new Rn,this.params={Mesh:{},Line:{threshold:1},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 Wh(e,t){return e.distance-t.distance}function qh(e,t,n,i){if(e.layers.test(t.layers)&&e.raycast(t,n),!0===i)for(var r=e.children,a=0,o=r.length;a<o;a++)qh(r[a],t,n,!0)}function Xh(e,t,n){return this.radius=void 0!==e?e:1,this.phi=void 0!==t?t:0,this.theta=void 0!==n?n:0,this}function Yh(e,t,n){return this.radius=void 0!==e?e:1,this.theta=void 0!==t?t:0,this.y=void 0!==n?n:0,this}J(zh.prototype,{getValue:function(e,t){this.bind();var n=this._targetGroup.nCachedObjects_,i=this._bindings[n];void 0!==i&&i.getValue(e,t)},setValue:function(e,t){for(var n=this._bindings,i=this._targetGroup.nCachedObjects_,r=n.length;i!==r;++i)n[i].setValue(e,t)},bind:function(){for(var e=this._bindings,t=this._targetGroup.nCachedObjects_,n=e.length;t!==n;++t)e[t].bind()},unbind:function(){for(var e=this._bindings,t=this._targetGroup.nCachedObjects_,n=e.length;t!==n;++t)e[t].unbind()}}),J(Uh,{Composite:zh,create:function(e,t,n){return e&&e.isAnimationObjectGroup?new Uh.Composite(e,t,n):new Uh(e,t,n)},sanitizeNodeName:function(e){return e.replace(/\s/g,"_").replace(Lh,"")},parseTrackName:function(e){var t=Nh.exec(e);if(!t)throw new Error("PropertyBinding: Cannot parse trackName: "+e);var n={nodeName:t[2],objectName:t[3],objectIndex:t[4],propertyName:t[5],propertyIndex:t[6]},i=n.nodeName&&n.nodeName.lastIndexOf(".");if(void 0!==i&&-1!==i){var r=n.nodeName.substring(i+1);-1!==Fh.indexOf(r)&&(n.nodeName=n.nodeName.substring(0,i),n.objectName=r)}if(null===n.propertyName||0===n.propertyName.length)throw new Error("PropertyBinding: can not parse propertyName from trackName: "+e);return n},findNode:function(e,a){if(!a||""===a||"."===a||-1===a||a===e.name||a===e.uuid)return e;if(e.skeleton){var t=e.skeleton.getBoneByName(a);if(void 0!==t)return t}if(e.children){var n=function e(t){for(var n=0;n<t.length;n++){var i=t[n];if(i.name===a||i.uuid===a)return i;var r=e(i.children);if(r)return r}return null}(e.children);if(n)return n}return null}}),J(Uh.prototype,{_getValue_unavailable:function(){},_setValue_unavailable:function(){},BindingType:{Direct:0,EntireArray:1,ArrayElement:2,HasFromToArray:3},Versioning:{None:0,NeedsUpdate:1,MatrixWorldNeedsUpdate:2},GetterByBindingType:[function(e,t){e[t]=this.node[this.propertyName]},function(e,t){for(var n=this.resolvedProperty,i=0,r=n.length;i!==r;++i)e[t++]=n[i]},function(e,t){e[t]=this.resolvedProperty[this.propertyIndex]},function(e,t){this.resolvedProperty.toArray(e,t)}],SetterByBindingTypeAndVersioning:[[function(e,t){this.targetObject[this.propertyName]=e[t]},function(e,t){this.targetObject[this.propertyName]=e[t],this.targetObject.needsUpdate=!0},function(e,t){this.targetObject[this.propertyName]=e[t],this.targetObject.matrixWorldNeedsUpdate=!0}],[function(e,t){for(var n=this.resolvedProperty,i=0,r=n.length;i!==r;++i)n[i]=e[t++]},function(e,t){for(var n=this.resolvedProperty,i=0,r=n.length;i!==r;++i)n[i]=e[t++];this.targetObject.needsUpdate=!0},function(e,t){for(var n=this.resolvedProperty,i=0,r=n.length;i!==r;++i)n[i]=e[t++];this.targetObject.matrixWorldNeedsUpdate=!0}],[function(e,t){this.resolvedProperty[this.propertyIndex]=e[t]},function(e,t){this.resolvedProperty[this.propertyIndex]=e[t],this.targetObject.needsUpdate=!0},function(e,t){this.resolvedProperty[this.propertyIndex]=e[t],this.targetObject.matrixWorldNeedsUpdate=!0}],[function(e,t){this.resolvedProperty.fromArray(e,t)},function(e,t){this.resolvedProperty.fromArray(e,t),this.targetObject.needsUpdate=!0},function(e,t){this.resolvedProperty.fromArray(e,t),this.targetObject.matrixWorldNeedsUpdate=!0}]],getValue:function(e,t){this.bind(),this.getValue(e,t)},setValue:function(e,t){this.bind(),this.setValue(e,t)},bind:function(){var e=this.node,t=this.parsedPath,n=t.objectName,i=t.propertyName,r=t.propertyIndex;if(e||(e=Uh.findNode(this.rootNode,t.nodeName)||this.rootNode,this.node=e),this.getValue=this._getValue_unavailable,this.setValue=this._setValue_unavailable,e){if(n){var a=t.objectIndex;switch(n){case"materials":if(!e.material)return void console.error("THREE.PropertyBinding: Can not bind to material as node does not have a material.",this);if(!e.material.materials)return void console.error("THREE.PropertyBinding: Can not bind to material.materials as node.material does not have a materials array.",this);e=e.material.materials;break;case"bones":if(!e.skeleton)return void console.error("THREE.PropertyBinding: Can not bind to bones as node does not have a skeleton.",this);e=e.skeleton.bones;for(var o=0;o<e.length;o++)if(e[o].name===a){a=o;break}break;default:if(void 0===e[n])return void console.error("THREE.PropertyBinding: Can not bind to objectName of node undefined.",this);e=e[n]}if(void 0!==a){if(void 0===e[a])return void console.error("THREE.PropertyBinding: Trying to bind to objectIndex of objectName, but is undefined.",this,e);e=e[a]}}var s=e[i];if(void 0!==s){var c=this.Versioning.None;void 0!==(this.targetObject=e).needsUpdate?c=this.Versioning.NeedsUpdate:void 0!==e.matrixWorldNeedsUpdate&&(c=this.Versioning.MatrixWorldNeedsUpdate);var l=this.BindingType.Direct;if(void 0!==r){if("morphTargetInfluences"===i){if(!e.geometry)return void console.error("THREE.PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.",this);if(e.geometry.isBufferGeometry){if(!e.geometry.morphAttributes)return void console.error("THREE.PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.morphAttributes.",this);for(o=0;o<this.node.geometry.morphAttributes.position.length;o++)if(e.geometry.morphAttributes.position[o].name===r){r=o;break}}else{if(!e.geometry.morphTargets)return void console.error("THREE.PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.morphTargets.",this);for(o=0;o<this.node.geometry.morphTargets.length;o++)if(e.geometry.morphTargets[o].name===r){r=o;break}}}l=this.BindingType.ArrayElement,this.resolvedProperty=s,this.propertyIndex=r}else void 0!==s.fromArray&&void 0!==s.toArray?(l=this.BindingType.HasFromToArray,this.resolvedProperty=s):Array.isArray(s)?(l=this.BindingType.EntireArray,this.resolvedProperty=s):this.propertyName=i;this.getValue=this.GetterByBindingType[l],this.setValue=this.SetterByBindingTypeAndVersioning[l][c]}else{var u=t.nodeName;console.error("THREE.PropertyBinding: Trying to update property for track: "+u+"."+i+" but it wasn't found.",e)}}else console.error("THREE.PropertyBinding: Trying to update node for track: "+this.path+" but it wasn't found.")},unbind:function(){this.node=null,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}}),J(Uh.prototype,{_getValue_unbound:Uh.prototype.getValue,_setValue_unbound:Uh.prototype.setValue}),J(Bh.prototype,{isAnimationObjectGroup:!0,add:function(){for(var e=this._objects,t=e.length,n=this.nCachedObjects_,i=this._indicesByUUID,r=this._paths,a=this._parsedPaths,o=this._bindings,s=o.length,c=void 0,l=0,u=arguments.length;l!==u;++l){var h=arguments[l],d=h.uuid,p=i[d];if(void 0===p){p=t++,i[d]=p,e.push(h);for(var f=0,m=s;f!==m;++f)o[f].push(new Uh(h,r[f],a[f]))}else if(p<n){c=e[p];var v=--n,g=e[v];e[i[g.uuid]=p]=g,e[i[d]=v]=h;for(f=0,m=s;f!==m;++f){var y=o[f],_=y[v],x=y[p];y[p]=_,void 0===x&&(x=new Uh(h,r[f],a[f])),y[v]=x}}else e[p]!==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 e=this._objects,t=this.nCachedObjects_,n=this._indicesByUUID,i=this._bindings,r=i.length,a=0,o=arguments.length;a!==o;++a){var s=arguments[a],c=s.uuid,l=n[c];if(void 0!==l&&t<=l){var u=t++,h=e[u];e[n[h.uuid]=l]=h,e[n[c]=u]=s;for(var d=0,p=r;d!==p;++d){var f=i[d],m=f[u],v=f[l];f[l]=m,f[u]=v}}}this.nCachedObjects_=t},uncache:function(){for(var e=this._objects,t=e.length,n=this.nCachedObjects_,i=this._indicesByUUID,r=this._bindings,a=r.length,o=0,s=arguments.length;o!==s;++o){var c=arguments[o].uuid,l=i[c];if(void 0!==l)if(delete i[c],l<n){var u=--n,h=e[u],d=e[g=--t];e[i[h.uuid]=l]=h,e[i[d.uuid]=u]=d,e.pop();for(var p=0,f=a;p!==f;++p){var m=(y=r[p])[u],v=y[g];y[l]=m,y[u]=v,y.pop()}}else{var g;e[i[(d=e[g=--t]).uuid]=l]=d,e.pop();for(p=0,f=a;p!==f;++p){var y;(y=r[p])[l]=y[g],y.pop()}}}this.nCachedObjects_=n},subscribe_:function(e,t){var n=this._bindingsIndicesByPath,i=n[e],r=this._bindings;if(void 0!==i)return r[i];var a=this._paths,o=this._parsedPaths,s=this._objects,c=s.length,l=this.nCachedObjects_,u=new Array(c);i=r.length,n[e]=i,a.push(e),o.push(t),r.push(u);for(var h=l,d=s.length;h!==d;++h){var p=s[h];u[h]=new Uh(p,e,t)}return u},unsubscribe_:function(e){var t=this._bindingsIndicesByPath,n=t[e];if(void 0!==n){var i=this._paths,r=this._parsedPaths,a=this._bindings,o=a.length-1,s=a[o];a[t[e[o]]=n]=s,a.pop(),r[n]=r[o],r.pop(),i[n]=i[o],i.pop()}}}),J(Gh.prototype,{play:function(){return this._mixer._activateAction(this),this},stop:function(){return this._mixer._deactivateAction(this),this.reset()},reset:function(){return this.paused=!1,this.enabled=!0,this.time=0,this._loopCount=-1,this._startTime=null,this.stopFading().stopWarping()},isRunning:function(){return this.enabled&&!this.paused&&0!==this.timeScale&&null===this._startTime&&this._mixer._isActiveAction(this)},isScheduled:function(){return this._mixer._isActiveAction(this)},startAt:function(e){return this._startTime=e,this},setLoop:function(e,t){return this.loop=e,this.repetitions=t,this},setEffectiveWeight:function(e){return this.weight=e,this._effectiveWeight=this.enabled?e:0,this.stopFading()},getEffectiveWeight:function(){return this._effectiveWeight},fadeIn:function(e){return this._scheduleFading(e,0,1)},fadeOut:function(e){return this._scheduleFading(e,1,0)},crossFadeFrom:function(e,t,n){if(e.fadeOut(t),this.fadeIn(t),n){var i=this._clip.duration,r=e._clip.duration,a=r/i,o=i/r;e.warp(1,a,t),this.warp(o,1,t)}return this},crossFadeTo:function(e,t,n){return e.crossFadeFrom(this,t,n)},stopFading:function(){var e=this._weightInterpolant;return null!==e&&(this._weightInterpolant=null,this._mixer._takeBackControlInterpolant(e)),this},setEffectiveTimeScale:function(e){return this.timeScale=e,this._effectiveTimeScale=this.paused?0:e,this.stopWarping()},getEffectiveTimeScale:function(){return this._effectiveTimeScale},setDuration:function(e){return this.timeScale=this._clip.duration/e,this.stopWarping()},syncWith:function(e){return this.time=e.time,this.timeScale=e.timeScale,this.stopWarping()},halt:function(e){return this.warp(this._effectiveTimeScale,0,e)},warp:function(e,t,n){var i=this._mixer,r=i.time,a=this._timeScaleInterpolant,o=this.timeScale;null===a&&(a=i._lendControlInterpolant(),this._timeScaleInterpolant=a);var s=a.parameterPositions,c=a.sampleValues;return s[0]=r,s[1]=r+n,c[0]=e/o,c[1]=t/o,this},stopWarping:function(){var e=this._timeScaleInterpolant;return null!==e&&(this._timeScaleInterpolant=null,this._mixer._takeBackControlInterpolant(e)),this},getMixer:function(){return this._mixer},getClip:function(){return this._clip},getRoot:function(){return this._localRoot||this._mixer._root},_update:function(e,t,n,i){if(this.enabled){var r=this._startTime;if(null!==r){var a=(e-r)*n;if(a<0||0===n)return;this._startTime=null,t=n*a}t*=this._updateTimeScale(e);var o=this._updateTime(t),s=this._updateWeight(e);if(0<s){var c=this._interpolants,l=this._propertyBindings;switch(this.blendMode){case 2501:for(var u=0,h=c.length;u!==h;++u)c[u].evaluate(o),l[u].accumulateAdditive(s);break;case 2500:default:for(u=0,h=c.length;u!==h;++u)c[u].evaluate(o),l[u].accumulate(i,s)}}}else this._updateWeight(e)},_updateWeight:function(e){var t=0;if(this.enabled){t=this.weight;var n=this._weightInterpolant;if(null!==n){var i=n.evaluate(e)[0];t*=i,e>n.parameterPositions[1]&&(this.stopFading(),0===i&&(this.enabled=!1))}}return this._effectiveWeight=t},_updateTimeScale:function(e){var t=0;if(!this.paused){t=this.timeScale;var n=this._timeScaleInterpolant;if(null!==n)t*=n.evaluate(e)[0],e>n.parameterPositions[1]&&(this.stopWarping(),0===t?this.paused=!0:this.timeScale=t)}return this._effectiveTimeScale=t},_updateTime:function(e){var t=this.time+e,n=this._clip.duration,i=this.loop,r=this._loopCount,a=2202===i;if(0===e)return-1!==r&&a&&1==(1&r)?n-t:t;if(2200===i){-1===r&&(this._loopCount=0,this._setEndings(!0,!0,!1));e:{if(n<=t)t=n;else{if(!(t<0)){this.time=t;break e}t=0}this.clampWhenFinished?this.paused=!0:this.enabled=!1,this.time=t,this._mixer.dispatchEvent({type:"finished",action:this,direction:e<0?-1:1})}}else{if(-1===r&&(0<=e?(r=0,this._setEndings(!0,0===this.repetitions,a)):this._setEndings(0===this.repetitions,!0,a)),n<=t||t<0){var o=Math.floor(t/n);t-=n*o,r+=Math.abs(o);var s=this.repetitions-r;if(s<=0)this.clampWhenFinished?this.paused=!0:this.enabled=!1,t=0<e?n:0,this.time=t,this._mixer.dispatchEvent({type:"finished",action:this,direction:0<e?1:-1});else{if(1==s){var c=e<0;this._setEndings(c,!c,a)}else this._setEndings(!1,!1,a);this._loopCount=r,this.time=t,this._mixer.dispatchEvent({type:"loop",action:this,loopDelta:o})}}else this.time=t;if(a&&1==(1&r))return n-t}return t},_setEndings:function(e,t,n){var i=this._interpolantSettings;n?(i.endingStart=Ft,i.endingEnd=Ft):(i.endingStart=e?this.zeroSlopeAtStart?Ft:Nt:zt,i.endingEnd=t?this.zeroSlopeAtEnd?Ft:Nt:zt)},_scheduleFading:function(e,t,n){var i=this._mixer,r=i.time,a=this._weightInterpolant;null===a&&(a=i._lendControlInterpolant(),this._weightInterpolant=a);var o=a.parameterPositions,s=a.sampleValues;return o[0]=r,s[0]=t,o[1]=r+e,s[1]=n,this}}),Hh.prototype=J(Object.create(en.prototype),{constructor:Hh,_bindAction:function(e,t){var n=e._localRoot||this._root,i=e._clip.tracks,r=i.length,a=e._propertyBindings,o=e._interpolants,s=n.uuid,c=this._bindingsByRootAndName,l=c[s];void 0===l&&(l={},c[s]=l);for(var u=0;u!==r;++u){var h=i[u],d=h.name,p=l[d];if(void 0!==p)a[u]=p;else{if(void 0!==(p=a[u])){null===p._cacheIndex&&(++p.referenceCount,this._addInactiveBinding(p,s,d));continue}var f=t&&t._propertyBindings[u].binding.parsedPath;++(p=new Eh(Uh.create(n,d,f),h.ValueTypeName,h.getValueSize())).referenceCount,this._addInactiveBinding(p,s,d),a[u]=p}o[u].resultBuffer=p.buffer}},_activateAction:function(e){if(!this._isActiveAction(e)){if(null===e._cacheIndex){var t=(e._localRoot||this._root).uuid,n=e._clip.uuid,i=this._actionsByClip[n];this._bindAction(e,i&&i.knownActions[0]),this._addInactiveAction(e,n,t)}for(var r=e._propertyBindings,a=0,o=r.length;a!==o;++a){var s=r[a];0==s.useCount++&&(this._lendBinding(s),s.saveOriginalState())}this._lendAction(e)}},_deactivateAction:function(e){if(this._isActiveAction(e)){for(var t=e._propertyBindings,n=0,i=t.length;n!==i;++n){var r=t[n];0==--r.useCount&&(r.restoreOriginalState(),this._takeBackBinding(r))}this._takeBackAction(e)}},_initMemoryManager:function(){this._actions=[],this._nActiveActions=0,this._actionsByClip={},this._bindings=[],this._nActiveBindings=0,this._bindingsByRootAndName={},this._controlInterpolants=[],this._nActiveControlInterpolants=0;var e=this;this.stats={actions:{get total(){return e._actions.length},get inUse(){return e._nActiveActions}},bindings:{get total(){return e._bindings.length},get inUse(){return e._nActiveBindings}},controlInterpolants:{get total(){return e._controlInterpolants.length},get inUse(){return e._nActiveControlInterpolants}}}},_isActiveAction:function(e){var t=e._cacheIndex;return null!==t&&t<this._nActiveActions},_addInactiveAction:function(e,t,n){var i=this._actions,r=this._actionsByClip,a=r[t];if(void 0===a)a={knownActions:[e],actionByRoot:{}},e._byClipCacheIndex=0,r[t]=a;else{var o=a.knownActions;e._byClipCacheIndex=o.length,o.push(e)}e._cacheIndex=i.length,i.push(e),a.actionByRoot[n]=e},_removeInactiveAction:function(e){var t=this._actions,n=t[t.length-1],i=e._cacheIndex;t[n._cacheIndex=i]=n,t.pop(),e._cacheIndex=null;var r=e._clip.uuid,a=this._actionsByClip,o=a[r],s=o.knownActions,c=s[s.length-1],l=e._byClipCacheIndex;s[c._byClipCacheIndex=l]=c,s.pop(),e._byClipCacheIndex=null,delete o.actionByRoot[(e._localRoot||this._root).uuid],0===s.length&&delete a[r],this._removeInactiveBindingsForAction(e)},_removeInactiveBindingsForAction:function(e){for(var t=e._propertyBindings,n=0,i=t.length;n!==i;++n){var r=t[n];0==--r.referenceCount&&this._removeInactiveBinding(r)}},_lendAction:function(e){var t=this._actions,n=e._cacheIndex,i=this._nActiveActions++,r=t[i];t[e._cacheIndex=i]=e,t[r._cacheIndex=n]=r},_takeBackAction:function(e){var t=this._actions,n=e._cacheIndex,i=--this._nActiveActions,r=t[i];t[e._cacheIndex=i]=e,t[r._cacheIndex=n]=r},_addInactiveBinding:function(e,t,n){var i=this._bindingsByRootAndName,r=i[t],a=this._bindings;void 0===r&&(r={},i[t]=r),(r[n]=e)._cacheIndex=a.length,a.push(e)},_removeInactiveBinding:function(e){var t=this._bindings,n=e.binding,i=n.rootNode.uuid,r=n.path,a=this._bindingsByRootAndName,o=a[i],s=t[t.length-1],c=e._cacheIndex;t[s._cacheIndex=c]=s,t.pop(),delete o[r],0===Object.keys(o).length&&delete a[i]},_lendBinding:function(e){var t=this._bindings,n=e._cacheIndex,i=this._nActiveBindings++,r=t[i];t[e._cacheIndex=i]=e,t[r._cacheIndex=n]=r},_takeBackBinding:function(e){var t=this._bindings,n=e._cacheIndex,i=--this._nActiveBindings,r=t[i];t[e._cacheIndex=i]=e,t[r._cacheIndex=n]=r},_lendControlInterpolant:function(){var e=this._controlInterpolants,t=this._nActiveControlInterpolants++,n=e[t];return void 0===n&&(e[(n=new zl(new Float32Array(2),new Float32Array(2),1,this._controlInterpolantsResultBuffer)).__cacheIndex=t]=n),n},_takeBackControlInterpolant:function(e){var t=this._controlInterpolants,n=e.__cacheIndex,i=--this._nActiveControlInterpolants,r=t[i];t[e.__cacheIndex=i]=e,t[r.__cacheIndex=n]=r},_controlInterpolantsResultBuffer:new Float32Array(1),clipAction:function(e,t,n){var i=t||this._root,r=i.uuid,a="string"==typeof e?Xl.findByName(i,e):e,o=null!==a?a.uuid:e,s=this._actionsByClip[o],c=null;if(void 0===n&&(n=null!==a?a.blendMode:2500),void 0!==s){var l=s.actionByRoot[r];if(void 0!==l&&l.blendMode===n)return l;c=s.knownActions[0],null===a&&(a=c._clip)}if(null===a)return null;var u=new Gh(this,a,t,n);return this._bindAction(u,c),this._addInactiveAction(u,o,r),u},existingAction:function(e,t){var n=t||this._root,i=n.uuid,r="string"==typeof e?Xl.findByName(n,e):e,a=r?r.uuid:e,o=this._actionsByClip[a];return void 0!==o&&o.actionByRoot[i]||null},stopAllAction:function(){var e=this._actions,t=this._nActiveActions,n=this._bindings,i=this._nActiveBindings;this._nActiveActions=0;for(var r=this._nActiveBindings=0;r!==t;++r)e[r].reset();for(r=0;r!==i;++r)n[r].useCount=0;return this},update:function(e){e*=this.timeScale;for(var t=this._actions,n=this._nActiveActions,i=this.time+=e,r=Math.sign(e),a=this._accuIndex^=1,o=0;o!==n;++o){t[o]._update(i,e,r,a)}var s=this._bindings,c=this._nActiveBindings;for(o=0;o!==c;++o)s[o].apply(a);return this},setTime:function(e){for(var t=this.time=0;t<this._actions.length;t++)this._actions[t].time=0;return this.update(e)},getRoot:function(){return this._root},uncacheClip:function(e){var t=this._actions,n=e.uuid,i=this._actionsByClip,r=i[n];if(void 0!==r){for(var a=r.knownActions,o=0,s=a.length;o!==s;++o){var c=a[o];this._deactivateAction(c);var l=c._cacheIndex,u=t[t.length-1];c._cacheIndex=null,c._byClipCacheIndex=null,t[u._cacheIndex=l]=u,t.pop(),this._removeInactiveBindingsForAction(c)}delete i[n]}},uncacheRoot:function(e){var t=e.uuid,n=this._actionsByClip;for(var i in n){var r=n[i].actionByRoot[t];void 0!==r&&(this._deactivateAction(r),this._removeInactiveAction(r))}var a=this._bindingsByRootAndName[t];if(void 0!==a)for(var o in a){var s=a[o];s.restoreOriginalState(),this._removeInactiveBinding(s)}},uncacheAction:function(e,t){var n=this.existingAction(e,t);null!==n&&(this._deactivateAction(n),this._removeInactiveAction(n))}}),kh.prototype.clone=function(){return new kh(void 0===this.value.clone?this.value:this.value.clone())},Vh.prototype=J(Object.create(rs.prototype),{constructor:Vh,isInstancedInterleavedBuffer:!0,copy:function(e){return rs.prototype.copy.call(this,e),this.meshPerAttribute=e.meshPerAttribute,this}}),J(jh.prototype,{set:function(e,t){this.ray.set(e,t)},setFromCamera:function(e,t){t&&t.isPerspectiveCamera?(this.ray.origin.setFromMatrixPosition(t.matrixWorld),this.ray.direction.set(e.x,e.y,.5).unproject(t).sub(this.ray.origin).normalize(),this.camera=t):t&&t.isOrthographicCamera?(this.ray.origin.set(e.x,e.y,(t.near+t.far)/(t.near-t.far)).unproject(t),this.ray.direction.set(0,0,-1).transformDirection(t.matrixWorld),this.camera=t):console.error("THREE.Raycaster: Unsupported camera type.")},intersectObject:function(e,t,n){var i=n||[];return qh(e,this,i,t),i.sort(Wh),i},intersectObjects:function(e,t,n){var i=n||[];if(!1===Array.isArray(e))return console.warn("THREE.Raycaster.intersectObjects: objects is not an Array."),i;for(var r=0,a=e.length;r<a;r++)qh(e[r],this,i,t);return i.sort(Wh),i}}),J(Xh.prototype,{set:function(e,t,n){return this.radius=e,this.phi=t,this.theta=n,this},clone:function(){return(new this.constructor).copy(this)},copy:function(e){return this.radius=e.radius,this.phi=e.phi,this.theta=e.theta,this},makeSafe:function(){return this.phi=Math.max(1e-6,Math.min(Math.PI-1e-6,this.phi)),this},setFromVector3:function(e){return this.setFromCartesianCoords(e.x,e.y,e.z)},setFromCartesianCoords:function(e,t,n){return this.radius=Math.sqrt(e*e+t*t+n*n),0===this.radius?(this.theta=0,this.phi=0):(this.theta=Math.atan2(e,n),this.phi=Math.acos(an.clamp(t/this.radius,-1,1))),this}}),J(Yh.prototype,{set:function(e,t,n){return this.radius=e,this.theta=t,this.y=n,this},clone:function(){return(new this.constructor).copy(this)},copy:function(e){return this.radius=e.radius,this.theta=e.theta,this.y=e.y,this},setFromVector3:function(e){return this.setFromCartesianCoords(e.x,e.y,e.z)},setFromCartesianCoords:function(e,t,n){return this.radius=Math.sqrt(e*e+n*n),this.theta=Math.atan2(e,n),this.y=t,this}});var Zh=new on;function Jh(e,t){this.min=void 0!==e?e:new on(1/0,1/0),this.max=void 0!==t?t:new on(-1/0,-1/0)}J(Jh.prototype,{set:function(e,t){return this.min.copy(e),this.max.copy(t),this},setFromPoints:function(e){this.makeEmpty();for(var t=0,n=e.length;t<n;t++)this.expandByPoint(e[t]);return this},setFromCenterAndSize:function(e,t){var n=Zh.copy(t).multiplyScalar(.5);return this.min.copy(e).sub(n),this.max.copy(e).add(n),this},clone:function(){return(new this.constructor).copy(this)},copy:function(e){return this.min.copy(e.min),this.max.copy(e.max),this},makeEmpty:function(){return this.min.x=this.min.y=1/0,this.max.x=this.max.y=-1/0,this},isEmpty:function(){return this.max.x<this.min.x||this.max.y<this.min.y},getCenter:function(e){return void 0===e&&(console.warn("THREE.Box2: .getCenter() target is now required"),e=new on),this.isEmpty()?e.set(0,0):e.addVectors(this.min,this.max).multiplyScalar(.5)},getSize:function(e){return void 0===e&&(console.warn("THREE.Box2: .getSize() target is now required"),e=new on),this.isEmpty()?e.set(0,0):e.subVectors(this.max,this.min)},expandByPoint:function(e){return this.min.min(e),this.max.max(e),this},expandByVector:function(e){return this.min.sub(e),this.max.add(e),this},expandByScalar:function(e){return this.min.addScalar(-e),this.max.addScalar(e),this},containsPoint:function(e){return!(e.x<this.min.x||e.x>this.max.x||e.y<this.min.y||e.y>this.max.y)},containsBox:function(e){return this.min.x<=e.min.x&&e.max.x<=this.max.x&&this.min.y<=e.min.y&&e.max.y<=this.max.y},getParameter:function(e,t){return void 0===t&&(console.warn("THREE.Box2: .getParameter() target is now required"),t=new on),t.set((e.x-this.min.x)/(this.max.x-this.min.x),(e.y-this.min.y)/(this.max.y-this.min.y))},intersectsBox:function(e){return!(e.max.x<this.min.x||e.min.x>this.max.x||e.max.y<this.min.y||e.min.y>this.max.y)},clampPoint:function(e,t){return void 0===t&&(console.warn("THREE.Box2: .clampPoint() target is now required"),t=new on),t.copy(e).clamp(this.min,this.max)},distanceToPoint:function(e){return Zh.copy(e).clamp(this.min,this.max).sub(e).length()},intersect:function(e){return this.min.max(e.min),this.max.min(e.max),this},union:function(e){return this.min.min(e.min),this.max.max(e.max),this},translate:function(e){return this.min.add(e),this.max.add(e),this},equals:function(e){return e.min.equals(this.min)&&e.max.equals(this.max)}});var Kh=new gn,Qh=new gn;function $h(e,t){this.start=void 0!==e?e:new gn,this.end=void 0!==t?t:new gn}function ed(e){Vn.call(this),this.material=e,this.render=function(){}}J($h.prototype,{set:function(e,t){return this.start.copy(e),this.end.copy(t),this},clone:function(){return(new this.constructor).copy(this)},copy:function(e){return this.start.copy(e.start),this.end.copy(e.end),this},getCenter:function(e){return void 0===e&&(console.warn("THREE.Line3: .getCenter() target is now required"),e=new gn),e.addVectors(this.start,this.end).multiplyScalar(.5)},delta:function(e){return void 0===e&&(console.warn("THREE.Line3: .delta() target is now required"),e=new gn),e.subVectors(this.end,this.start)},distanceSq:function(){return this.start.distanceToSquared(this.end)},distance:function(){return this.start.distanceTo(this.end)},at:function(e,t){return void 0===t&&(console.warn("THREE.Line3: .at() target is now required"),t=new gn),this.delta(t).multiplyScalar(e).add(this.start)},closestPointToPointParameter:function(e,t){Kh.subVectors(e,this.start),Qh.subVectors(this.end,this.start);var n=Qh.dot(Qh),i=Qh.dot(Kh)/n;return t&&(i=an.clamp(i,0,1)),i},closestPointToPoint:function(e,t,n){var i=this.closestPointToPointParameter(e,t);return void 0===n&&(console.warn("THREE.Line3: .closestPointToPoint() target is now required"),n=new gn),this.delta(n).multiplyScalar(i).add(this.start)},applyMatrix4:function(e){return this.start.applyMatrix4(e),this.end.applyMatrix4(e),this},equals:function(e){return e.start.equals(this.start)&&e.end.equals(this.end)}}),((ed.prototype=Object.create(Vn.prototype)).constructor=ed).prototype.isImmediateRenderObject=!0;var td=new gn;function nd(e,t){Vn.call(this),this.light=e,this.light.updateMatrixWorld(),this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1,this.color=t;for(var n=new cr,i=[0,0,0,0,0,1,0,0,0,1,0,1,0,0,0,-1,0,1,0,0,0,0,1,1,0,0,0,0,-1,1],r=0,a=1;r<32;r++,a++){var o=r/32*Math.PI*2,s=a/32*Math.PI*2;i.push(Math.cos(o),Math.sin(o),1,Math.cos(s),Math.sin(s),1)}n.setAttribute("position",new Ki(i,3));var c=new Hs({fog:!1,toneMapped:!1});this.cone=new Js(n,c),this.add(this.cone),this.update()}((nd.prototype=Object.create(Vn.prototype)).constructor=nd).prototype.dispose=function(){this.cone.geometry.dispose(),this.cone.material.dispose()},nd.prototype.update=function(){this.light.updateMatrixWorld();var e=this.light.distance?this.light.distance:1e3,t=e*Math.tan(this.light.angle);this.cone.scale.set(t,t,e),td.setFromMatrixPosition(this.light.target.matrixWorld),this.cone.lookAt(td),void 0!==this.color?this.cone.material.color.set(this.color):this.cone.material.color.copy(this.light.color)};var id=new gn,rd=new Tn,ad=new Tn;function od(e){for(var t=function e(t){var n=[];t&&t.isBone&&n.push(t);for(var i=0;i<t.children.length;i++)n.push.apply(n,e(t.children[i]));return n}(e),n=new cr,i=[],r=[],a=new Di(0,0,1),o=new Di(0,1,0),s=0;s<t.length;s++){var c=t[s];c.parent&&c.parent.isBone&&(i.push(0,0,0),i.push(0,0,0),r.push(a.r,a.g,a.b),r.push(o.r,o.g,o.b))}n.setAttribute("position",new Ki(i,3)),n.setAttribute("color",new Ki(r,3));var l=new Hs({vertexColors:!0,depthTest:!1,depthWrite:!1,toneMapped:!1,transparent:!0});Js.call(this,n,l),this.type="SkeletonHelper",this.root=e,this.bones=t,this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1}function sd(e,t,n){this.light=e,this.light.updateMatrixWorld(),this.color=n;var i=new sl(t,4,2),r=new Hi({wireframe:!0,fog:!1,toneMapped:!1});Er.call(this,i,r),this.type="PointLightHelper",this.matrix=this.light.matrixWorld,this.matrixAutoUpdate=!1,this.update()}((od.prototype=Object.create(Js.prototype)).constructor=od).prototype.isSkeletonHelper=!0,od.prototype.updateMatrixWorld=function(e){var t=this.bones,n=this.geometry,i=n.getAttribute("position");ad.getInverse(this.root.matrixWorld);for(var r=0,a=0;r<t.length;r++){var o=t[r];o.parent&&o.parent.isBone&&(rd.multiplyMatrices(ad,o.matrixWorld),id.setFromMatrixPosition(rd),i.setXYZ(a,id.x,id.y,id.z),rd.multiplyMatrices(ad,o.parent.matrixWorld),id.setFromMatrixPosition(rd),i.setXYZ(a+1,id.x,id.y,id.z),a+=2)}n.getAttribute("position").needsUpdate=!0,Vn.prototype.updateMatrixWorld.call(this,e)},((sd.prototype=Object.create(Er.prototype)).constructor=sd).prototype.dispose=function(){this.geometry.dispose(),this.material.dispose()},sd.prototype.update=function(){void 0!==this.color?this.material.color.set(this.color):this.material.color.copy(this.light.color)};var cd=new gn,ld=new Di,ud=new Di;function hd(e,t,n){Vn.call(this),this.light=e,this.light.updateMatrixWorld(),this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1,this.color=n;var i=new gc(t);i.rotateY(.5*Math.PI),this.material=new Hi({wireframe:!0,fog:!1,toneMapped:!1}),void 0===this.color&&(this.material.vertexColors=!0);var r=i.getAttribute("position"),a=new Float32Array(3*r.count);i.setAttribute("color",new Vi(a,3)),this.add(new Er(i,this.material)),this.update()}function dd(e,t,n,i){e=e||10,t=t||10,n=new Di(void 0!==n?n:4473924),i=new Di(void 0!==i?i:8947848);for(var r=t/2,a=e/t,o=e/2,s=[],c=[],l=0,u=0,h=-o;l<=t;l++,h+=a){s.push(-o,0,h,o,0,h),s.push(h,0,-o,h,0,o);var d=l===r?n:i;d.toArray(c,u),u+=3,d.toArray(c,u),u+=3,d.toArray(c,u),u+=3,d.toArray(c,u),u+=3}var p=new cr;p.setAttribute("position",new Ki(s,3)),p.setAttribute("color",new Ki(c,3));var f=new Hs({vertexColors:!0,toneMapped:!1});Js.call(this,p,f),this.type="GridHelper"}function pd(e,t,n,i,r,a){e=e||10,t=t||16,n=n||8,i=i||64,r=new Di(void 0!==r?r:4473924),a=new Di(void 0!==a?a:8947848);var o,s,c,l,u,h,d,p=[],f=[];for(l=0;l<=t;l++)c=l/t*(2*Math.PI),o=Math.sin(c)*e,s=Math.cos(c)*e,p.push(0,0,0),p.push(o,0,s),d=1&l?r:a,f.push(d.r,d.g,d.b),f.push(d.r,d.g,d.b);for(l=0;l<=n;l++)for(d=1&l?r:a,h=e-e/n*l,u=0;u<i;u++)c=u/i*(2*Math.PI),o=Math.sin(c)*h,s=Math.cos(c)*h,p.push(o,0,s),f.push(d.r,d.g,d.b),c=(u+1)/i*(2*Math.PI),o=Math.sin(c)*h,s=Math.cos(c)*h,p.push(o,0,s),f.push(d.r,d.g,d.b);var m=new cr;m.setAttribute("position",new Ki(p,3)),m.setAttribute("color",new Ki(f,3));var v=new Hs({vertexColors:!0,toneMapped:!1});Js.call(this,m,v),this.type="PolarGridHelper"}((hd.prototype=Object.create(Vn.prototype)).constructor=hd).prototype.dispose=function(){this.children[0].geometry.dispose(),this.children[0].material.dispose()},hd.prototype.update=function(){var e=this.children[0];if(void 0!==this.color)this.material.color.set(this.color);else{var t=e.geometry.getAttribute("color");ld.copy(this.light.color),ud.copy(this.light.groundColor);for(var n=0,i=t.count;n<i;n++){var r=n<i/2?ld:ud;t.setXYZ(n,r.r,r.g,r.b)}t.needsUpdate=!0}e.lookAt(cd.setFromMatrixPosition(this.light.matrixWorld).negate())},dd.prototype=J(Object.create(Js.prototype),{constructor:dd,copy:function(e){return Js.prototype.copy.call(this,e),this.geometry.copy(e.geometry),this.material.copy(e.material),this},clone:function(){return(new this.constructor).copy(this)}}),(pd.prototype=Object.create(Js.prototype)).constructor=pd;var fd=new gn,md=new gn,vd=new gn;function gd(e,t,n){Vn.call(this),this.light=e,this.light.updateMatrixWorld(),this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1,this.color=n,void 0===t&&(t=1);var i=new cr;i.setAttribute("position",new Ki([-t,t,0,t,t,0,t,-t,0,-t,-t,0,-t,t,0],3));var r=new Hs({fog:!1,toneMapped:!1});this.lightPlane=new Xs(i,r),this.add(this.lightPlane),(i=new cr).setAttribute("position",new Ki([0,0,0,0,0,1],3)),this.targetLine=new Xs(i,r),this.add(this.targetLine),this.update()}((gd.prototype=Object.create(Vn.prototype)).constructor=gd).prototype.dispose=function(){this.lightPlane.geometry.dispose(),this.lightPlane.material.dispose(),this.targetLine.geometry.dispose(),this.targetLine.material.dispose()},gd.prototype.update=function(){fd.setFromMatrixPosition(this.light.matrixWorld),md.setFromMatrixPosition(this.light.target.matrixWorld),vd.subVectors(md,fd),this.lightPlane.lookAt(md),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(md),this.targetLine.scale.z=vd.length()};var yd=new gn,_d=new kr;function xd(e){var t=new cr,n=new Hs({color:16777215,vertexColors:!0,toneMapped:!1}),i=[],r=[],a={},o=new Di(16755200),s=new Di(16711680),c=new Di(43775),l=new Di(16777215),u=new Di(3355443);function h(e,t,n){d(e,n),d(t,n)}function d(e,t){i.push(0,0,0),r.push(t.r,t.g,t.b),void 0===a[e]&&(a[e]=[]),a[e].push(i.length/3-1)}h("n1","n2",o),h("n2","n4",o),h("n4","n3",o),h("n3","n1",o),h("f1","f2",o),h("f2","f4",o),h("f4","f3",o),h("f3","f1",o),h("n1","f1",o),h("n2","f2",o),h("n3","f3",o),h("n4","f4",o),h("p","n1",s),h("p","n2",s),h("p","n3",s),h("p","n4",s),h("u1","u2",c),h("u2","u3",c),h("u3","u1",c),h("c","t",l),h("p","c",u),h("cn1","cn2",u),h("cn3","cn4",u),h("cf1","cf2",u),h("cf3","cf4",u),t.setAttribute("position",new Ki(i,3)),t.setAttribute("color",new Ki(r,3)),Js.call(this,t,n),this.type="CameraHelper",this.camera=e,this.camera.updateProjectionMatrix&&this.camera.updateProjectionMatrix(),this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1,this.pointMap=a,this.update()}function bd(e,t,n,i,r,a,o){yd.set(r,a,o).unproject(i);var s=t[e];if(void 0!==s)for(var c=n.getAttribute("position"),l=0,u=s.length;l<u;l++)c.setXYZ(s[l],yd.x,yd.y,yd.z)}((xd.prototype=Object.create(Js.prototype)).constructor=xd).prototype.update=function(){var e=this.geometry,t=this.pointMap;_d.projectionMatrixInverse.copy(this.camera.projectionMatrixInverse),bd("c",t,e,_d,0,0,-1),bd("t",t,e,_d,0,0,1),bd("n1",t,e,_d,-1,-1,-1),bd("n2",t,e,_d,1,-1,-1),bd("n3",t,e,_d,-1,1,-1),bd("n4",t,e,_d,1,1,-1),bd("f1",t,e,_d,-1,-1,1),bd("f2",t,e,_d,1,-1,1),bd("f3",t,e,_d,-1,1,1),bd("f4",t,e,_d,1,1,1),bd("u1",t,e,_d,.7,1.1,-1),bd("u2",t,e,_d,-.7,1.1,-1),bd("u3",t,e,_d,0,2,-1),bd("cf1",t,e,_d,-1,0,1),bd("cf2",t,e,_d,1,0,1),bd("cf3",t,e,_d,0,-1,1),bd("cf4",t,e,_d,0,1,1),bd("cn1",t,e,_d,-1,0,-1),bd("cn2",t,e,_d,1,0,-1),bd("cn3",t,e,_d,0,-1,-1),bd("cn4",t,e,_d,0,1,-1),e.getAttribute("position").needsUpdate=!0};var wd=new ri;function Md(e,t){this.object=e,void 0===t&&(t=16776960);var n=new Uint16Array([0,1,1,2,2,3,3,0,4,5,5,6,6,7,7,4,0,4,1,5,2,6,3,7]),i=new Float32Array(24),r=new cr;r.setIndex(new Vi(n,1)),r.setAttribute("position",new Vi(i,3)),Js.call(this,r,new Hs({color:t,toneMapped:!1})),this.type="BoxHelper",this.matrixAutoUpdate=!1,this.update()}function Sd(e,t){this.type="Box3Helper",this.box=e,t=t||16776960;var n=new Uint16Array([0,1,1,2,2,3,3,0,4,5,5,6,6,7,7,4,0,4,1,5,2,6,3,7]),i=new cr;i.setIndex(new Vi(n,1)),i.setAttribute("position",new Ki([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)),Js.call(this,i,new Hs({color:t,toneMapped:!1})),this.type="Box3Helper",this.geometry.computeBoundingSphere()}function Td(e,t,n){this.plane=e,this.size=void 0===t?1:t;var i=void 0!==n?n:16776960,r=new cr;r.setAttribute("position",new Ki([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)),r.computeBoundingSphere(),Xs.call(this,r,new Hs({color:i,toneMapped:!1})),this.type="PlaneHelper";var a=new cr;a.setAttribute("position",new Ki([1,1,1,-1,1,1,-1,-1,1,1,1,1,-1,-1,1,1,-1,1],3)),a.computeBoundingSphere(),this.add(new Er(a,new Hi({color:i,opacity:.2,transparent:!0,depthWrite:!1,toneMapped:!1})))}((Md.prototype=Object.create(Js.prototype)).constructor=Md).prototype.update=function(e){if(void 0!==e&&console.warn("THREE.BoxHelper: .update() has no longer arguments."),void 0!==this.object&&wd.setFromObject(this.object),!wd.isEmpty()){var t=wd.min,n=wd.max,i=this.geometry.attributes.position,r=i.array;r[0]=n.x,r[1]=n.y,r[2]=n.z,r[3]=t.x,r[4]=n.y,r[5]=n.z,r[6]=t.x,r[7]=t.y,r[8]=n.z,r[9]=n.x,r[10]=t.y,r[11]=n.z,r[12]=n.x,r[13]=n.y,r[14]=t.z,r[15]=t.x,r[16]=n.y,r[17]=t.z,r[18]=t.x,r[19]=t.y,r[20]=t.z,r[21]=n.x,r[22]=t.y,r[23]=t.z,i.needsUpdate=!0,this.geometry.computeBoundingSphere()}},Md.prototype.setFromObject=function(e){return this.object=e,this.update(),this},Md.prototype.copy=function(e){return Js.prototype.copy.call(this,e),this.object=e.object,this},Md.prototype.clone=function(){return(new this.constructor).copy(this)},((Sd.prototype=Object.create(Js.prototype)).constructor=Sd).prototype.updateMatrixWorld=function(e){var t=this.box;t.isEmpty()||(t.getCenter(this.position),t.getSize(this.scale),this.scale.multiplyScalar(.5),Vn.prototype.updateMatrixWorld.call(this,e))},((Td.prototype=Object.create(Xs.prototype)).constructor=Td).prototype.updateMatrixWorld=function(e){var t=-this.plane.constant;Math.abs(t)<1e-8&&(t=1e-8),this.scale.set(.5*this.size,.5*this.size,t),this.children[0].material.side=t<0?Me:ee,this.lookAt(this.plane.normal),Vn.prototype.updateMatrixWorld.call(this,e)};var Ed,Ad,Ld=new gn;function Rd(e,t,n,i,r,a){Vn.call(this),this.type="ArrowHelper",void 0===e&&(e=new gn(0,0,1)),void 0===t&&(t=new gn(0,0,0)),void 0===n&&(n=1),void 0===i&&(i=16776960),void 0===r&&(r=.2*n),void 0===a&&(a=.2*r),void 0===Ed&&((Ed=new cr).setAttribute("position",new Ki([0,0,0,0,1,0],3)),(Ad=new gl(0,.5,1,5,1)).translate(0,-.5,0)),this.position.copy(t),this.line=new Xs(Ed,new Hs({color:i,toneMapped:!1})),this.line.matrixAutoUpdate=!1,this.add(this.line),this.cone=new Er(Ad,new Hi({color:i,toneMapped:!1})),this.cone.matrixAutoUpdate=!1,this.add(this.cone),this.setDirection(e),this.setLength(n,r,a)}function Pd(e){var t=[0,0,0,e=e||1,0,0,0,0,0,0,e,0,0,0,0,0,0,e],n=new cr;n.setAttribute("position",new Ki(t,3)),n.setAttribute("color",new Ki([1,0,0,1,.6,0,0,1,0,.6,1,0,0,0,1,0,.6,1],3));var i=new Hs({vertexColors:!0,toneMapped:!1});Js.call(this,n,i),this.type="AxesHelper"}((Rd.prototype=Object.create(Vn.prototype)).constructor=Rd).prototype.setDirection=function(e){if(.99999<e.y)this.quaternion.set(0,0,0,1);else if(e.y<-.99999)this.quaternion.set(1,0,0,0);else{Ld.set(e.z,0,-e.x).normalize();var t=Math.acos(e.y);this.quaternion.setFromAxisAngle(Ld,t)}},Rd.prototype.setLength=function(e,t,n){void 0===t&&(t=.2*e),void 0===n&&(n=.2*t),this.line.scale.set(1,Math.max(1e-4,e-t),1),this.line.updateMatrix(),this.cone.scale.set(n,t,n),this.cone.position.y=e,this.cone.updateMatrix()},Rd.prototype.setColor=function(e){this.line.material.color.set(e),this.cone.material.color.set(e)},Rd.prototype.copy=function(e){return Vn.prototype.copy.call(this,e,!1),this.line.copy(e.line),this.cone.copy(e.cone),this},Rd.prototype.clone=function(){return(new this.constructor).copy(this)},(Pd.prototype=Object.create(Js.prototype)).constructor=Pd;var Cd=Math.pow(2,8),Id=[.125,.215,.35,.446,.526,.582],Od=5+Id.length,Dd=((e={})[Ut]=0,e[Bt]=1,e[Ht]=2,e[Vt]=3,e[jt]=4,e[Wt]=5,e[Gt]=6,e),Nd=new zu,Fd=function(){for(var e=[],t=[],n=[],i=8,r=0;r<Od;r++){var a=Math.pow(2,i);t.push(a);var o=1/a;4<r?o=Id[r-8+4-1]:0==r&&(o=0),n.push(o);for(var s=1/(a-1),c=-s/2,l=1+s/2,u=[c,c,l,c,l,l,c,c,l,l,c,l],h=new Float32Array(108),d=new Float32Array(72),p=new Float32Array(36),f=0;f<6;f++){var m=f%3*2/3-1,v=2<f?0:-1,g=[m,v,0,m+2/3,v,0,m+2/3,1+v,0,m,v,0,m+2/3,1+v,0,m,1+v,0];h.set(g,18*f),d.set(u,12*f);var y=[f,f,f,f,f,f];p.set(y,6*f)}var _=new cr;_.setAttribute("position",new Vi(h,3)),_.setAttribute("uv",new Vi(d,2)),_.setAttribute("faceIndex",new Vi(p,1)),e.push(_),4<i&&i--}return{_lodPlanes:e,_sizeLods:t,_sigmas:n}}(),zd=Fd._lodPlanes,Ud=Fd._sizeLods,Bd=Fd._sigmas,Gd=null,Hd=(1+Math.sqrt(5))/2,kd=1/Hd,Vd=[new gn(1,1,1),new gn(-1,1,1),new gn(1,1,-1),new gn(-1,1,-1),new gn(0,Hd,kd),new gn(0,Hd,-kd),new gn(kd,0,Hd),new gn(-kd,0,Hd),new gn(Hd,kd,0),new gn(-Hd,kd,0)];function jd(e){var t,n,i,r;this._renderer=e,this._pingPongRenderTarget=null,this._blurMaterial=(t=20,n=new Float32Array(t),i=new gn(0,1,0),(r=new Sl({defines:{n:t},uniforms:{envMap:{value:null},samples:{value:1},weights:{value:n},latitudinal:{value:!1},dTheta:{value:0},mipInt:{value:0},poleAxis:{value:i},inputEncoding:{value:Dd[Ut]},outputEncoding:{value:Dd[Ut]}},vertexShader:Zd(),fragmentShader:"\nprecision mediump float;\nprecision mediump int;\nvarying vec3 vOutputDirection;\nuniform sampler2D envMap;\nuniform int samples;\nuniform float weights[n];\nuniform bool latitudinal;\nuniform float dTheta;\nuniform float mipInt;\nuniform vec3 poleAxis;\n\n"+Jd()+"\n\n#define ENVMAP_TYPE_CUBE_UV\n#include <cube_uv_reflection_fragment>\n\nvec3 getSample(float theta, vec3 axis) {\n\tfloat cosTheta = cos(theta);\n\t// Rodrigues' axis-angle rotation\n\tvec3 sampleDirection = vOutputDirection * cosTheta\n\t\t+ cross(axis, vOutputDirection) * sin(theta)\n\t\t+ axis * dot(axis, vOutputDirection) * (1.0 - cosTheta);\n\treturn bilinearCubeUV(envMap, sampleDirection, mipInt);\n}\n\nvoid main() {\n\tvec3 axis = latitudinal ? poleAxis : cross(poleAxis, vOutputDirection);\n\tif (all(equal(axis, vec3(0.0))))\n\t\taxis = vec3(vOutputDirection.z, 0.0, - vOutputDirection.x);\n\taxis = normalize(axis);\n\tgl_FragColor = vec4(0.0);\n\tgl_FragColor.rgb += weights[0] * getSample(0.0, axis);\n\tfor (int i = 1; i < n; i++) {\n\t\tif (i >= samples)\n\t\t\tbreak;\n\t\tfloat theta = dTheta * float(i);\n\t\tgl_FragColor.rgb += weights[i] * getSample(-1.0 * theta, axis);\n\t\tgl_FragColor.rgb += weights[i] * getSample(theta, axis);\n\t}\n\tgl_FragColor = linearToOutputTexel(gl_FragColor);\n}\n\t\t",blending:ne,depthTest:!1,depthWrite:!1})).type="SphericalGaussianBlur",r),this._equirectShader=null,this._cubemapShader=null,this._compileMaterial(this._blurMaterial)}function Wd(e){var t=new dn(3*Cd,3*Cd,e);return t.texture.mapping=ze,t.texture.name="PMREM.cubeUv",t.scissorTest=!0,t}function qd(e,t,n,i,r){e.viewport.set(t,n,i,r),e.scissor.set(t,n,i,r)}function Xd(){var e=new Sl({uniforms:{envMap:{value:null},texelSize:{value:new on(1,1)},inputEncoding:{value:Dd[Ut]},outputEncoding:{value:Dd[Ut]}},vertexShader:Zd(),fragmentShader:"\nprecision mediump float;\nprecision mediump int;\nvarying vec3 vOutputDirection;\nuniform sampler2D envMap;\nuniform vec2 texelSize;\n\n"+Jd()+"\n\n#define RECIPROCAL_PI 0.31830988618\n#define RECIPROCAL_PI2 0.15915494\n\nvoid main() {\n\tgl_FragColor = vec4(0.0);\n\tvec3 outputDirection = normalize(vOutputDirection);\n\tvec2 uv;\n\tuv.y = asin(clamp(outputDirection.y, -1.0, 1.0)) * RECIPROCAL_PI + 0.5;\n\tuv.x = atan(outputDirection.z, outputDirection.x) * RECIPROCAL_PI2 + 0.5;\n\tvec2 f = fract(uv / texelSize - 0.5);\n\tuv -= f * texelSize;\n\tvec3 tl = envMapTexelToLinear(texture2D(envMap, uv)).rgb;\n\tuv.x += texelSize.x;\n\tvec3 tr = envMapTexelToLinear(texture2D(envMap, uv)).rgb;\n\tuv.y += texelSize.y;\n\tvec3 br = envMapTexelToLinear(texture2D(envMap, uv)).rgb;\n\tuv.x -= texelSize.x;\n\tvec3 bl = envMapTexelToLinear(texture2D(envMap, uv)).rgb;\n\tvec3 tm = mix(tl, tr, f.x);\n\tvec3 bm = mix(bl, br, f.x);\n\tgl_FragColor.rgb = mix(tm, bm, f.y);\n\tgl_FragColor = linearToOutputTexel(gl_FragColor);\n}\n\t\t",blending:ne,depthTest:!1,depthWrite:!1});return e.type="EquirectangularToCubeUV",e}function Yd(){var e=new Sl({uniforms:{envMap:{value:null},inputEncoding:{value:Dd[Ut]},outputEncoding:{value:Dd[Ut]}},vertexShader:Zd(),fragmentShader:"\nprecision mediump float;\nprecision mediump int;\nvarying vec3 vOutputDirection;\nuniform samplerCube envMap;\n\n"+Jd()+"\n\nvoid main() {\n\tgl_FragColor = vec4(0.0);\n\tgl_FragColor.rgb = envMapTexelToLinear(textureCube(envMap, vec3( - vOutputDirection.x, vOutputDirection.yz ))).rgb;\n\tgl_FragColor = linearToOutputTexel(gl_FragColor);\n}\n\t\t",blending:ne,depthTest:!1,depthWrite:!1});return e.type="CubemapToCubeUV",e}function Zd(){return"\nprecision mediump float;\nprecision mediump int;\nattribute vec3 position;\nattribute vec2 uv;\nattribute float faceIndex;\nvarying vec3 vOutputDirection;\nvec3 getDirection(vec2 uv, float face) {\n\tuv = 2.0 * uv - 1.0;\n\tvec3 direction = vec3(uv, 1.0);\n\tif (face == 0.0) {\n\t\tdirection = direction.zyx;\n\t\tdirection.z *= -1.0;\n\t} else if (face == 1.0) {\n\t\tdirection = direction.xzy;\n\t\tdirection.z *= -1.0;\n\t} else if (face == 3.0) {\n\t\tdirection = direction.zyx;\n\t\tdirection.x *= -1.0;\n\t} else if (face == 4.0) {\n\t\tdirection = direction.xzy;\n\t\tdirection.y *= -1.0;\n\t} else if (face == 5.0) {\n\t\tdirection.xz *= -1.0;\n\t}\n\treturn direction;\n}\nvoid main() {\n\tvOutputDirection = getDirection(uv, faceIndex);\n\tgl_Position = vec4( position, 1.0 );\n}\n\t"}function Jd(){return"\nuniform int inputEncoding;\nuniform int outputEncoding;\n\n#include <encodings_pars_fragment>\n\nvec4 inputTexelToLinear(vec4 value){\n\tif(inputEncoding == 0){\n\t\treturn value;\n\t}else if(inputEncoding == 1){\n\t\treturn sRGBToLinear(value);\n\t}else if(inputEncoding == 2){\n\t\treturn RGBEToLinear(value);\n\t}else if(inputEncoding == 3){\n\t\treturn RGBMToLinear(value, 7.0);\n\t}else if(inputEncoding == 4){\n\t\treturn RGBMToLinear(value, 16.0);\n\t}else if(inputEncoding == 5){\n\t\treturn RGBDToLinear(value, 256.0);\n\t}else{\n\t\treturn GammaToLinear(value, 2.2);\n\t}\n}\n\nvec4 linearToOutputTexel(vec4 value){\n\tif(outputEncoding == 0){\n\t\treturn value;\n\t}else if(outputEncoding == 1){\n\t\treturn LinearTosRGB(value);\n\t}else if(outputEncoding == 2){\n\t\treturn LinearToRGBE(value);\n\t}else if(outputEncoding == 3){\n\t\treturn LinearToRGBM(value, 7.0);\n\t}else if(outputEncoding == 4){\n\t\treturn LinearToRGBM(value, 16.0);\n\t}else if(outputEncoding == 5){\n\t\treturn LinearToRGBD(value, 256.0);\n\t}else{\n\t\treturn LinearToGamma(value, 2.2);\n\t}\n}\n\nvec4 envMapTexelToLinear(vec4 color) {\n\treturn inputTexelToLinear(color);\n}\n\t"}jd.prototype={constructor:jd,fromScene:function(e,t,n,i){void 0===t&&(t=0),void 0===n&&(n=.1),void 0===i&&(i=100),Gd=this._renderer.getRenderTarget();var r=this._allocateTargets();return this._sceneToCubeUV(e,n,i,r),0<t&&this._blur(r,0,0,t),this._applyPMREM(r),this._cleanup(r),r},fromEquirectangular:function(e){return e.magFilter=ke,e.minFilter=ke,e.generateMipmaps=!1,this.fromCubemap(e)},fromCubemap:function(e){Gd=this._renderer.getRenderTarget();var t=this._allocateTargets(e);return this._textureToCubeUV(e,t),this._applyPMREM(t),this._cleanup(t),t},compileCubemapShader:function(){null===this._cubemapShader&&(this._cubemapShader=Yd(),this._compileMaterial(this._cubemapShader))},compileEquirectangularShader:function(){null===this._equirectShader&&(this._equirectShader=Xd(),this._compileMaterial(this._equirectShader))},dispose:function(){this._blurMaterial.dispose(),null!==this._cubemapShader&&this._cubemapShader.dispose(),null!==this._equirectShader&&this._equirectShader.dispose();for(var e=0;e<zd.length;e++)zd[e].dispose()},_cleanup:function(e){this._pingPongRenderTarget.dispose(),this._renderer.setRenderTarget(Gd),e.scissorTest=!1,e.setSize(e.width,e.height)},_allocateTargets:function(e){var t,n={magFilter:ke,minFilter:ke,generateMipmaps:!1,type:Ye,format:T,encoding:void 0===(t=e)||t.type!==Ye||t.encoding!==Ut&&t.encoding!==Bt&&t.encoding!==Gt?Ht:e.encoding,depthBuffer:!1,stencilBuffer:!1},i=Wd(n);return i.depthBuffer=!e,this._pingPongRenderTarget=Wd(n),i},_compileMaterial:function(e){var t=new jn;t.add(new Er(zd[0],e)),this._renderer.compile(t,Nd)},_sceneToCubeUV:function(e,t,n,i){var r=new Vr(90,1,t,n),a=[1,1,1,1,-1,1],o=[1,1,-1,-1,-1,1],s=this._renderer,c=s.outputEncoding,l=s.toneMapping,u=s.toneMappingExposure,h=s.getClearColor(),d=s.getClearAlpha();s.toneMapping=V,s.toneMappingExposure=1,s.outputEncoding=Ut,e.scale.z*=-1;var p=e.background;if(p&&p.isColor){p.convertSRGBToLinear();var f=Math.max(p.r,p.g,p.b),m=Math.min(Math.max(Math.ceil(Math.log2(f)),-128),127);p=p.multiplyScalar(Math.pow(2,-m));var v=(m+128)/255;s.setClearColor(p,v),e.background=null}for(var g=0;g<6;g++){var y=g%3;0==y?(r.up.set(0,a[g],0),r.lookAt(o[g],0,0)):1==y?(r.up.set(0,0,a[g]),r.lookAt(0,o[g],0)):(r.up.set(0,a[g],0),r.lookAt(0,0,o[g])),qd(i,y*Cd,2<g?Cd:0,Cd,Cd),s.setRenderTarget(i),s.render(e,r)}s.toneMapping=l,s.toneMappingExposure=u,s.outputEncoding=c,s.setClearColor(h,d),e.scale.z*=-1},_textureToCubeUV:function(e,t){var n=new jn,i=this._renderer;e.isCubeTexture?null==this._cubemapShader&&(this._cubemapShader=Yd()):null==this._equirectShader&&(this._equirectShader=Xd());var r=e.isCubeTexture?this._cubemapShader:this._equirectShader;n.add(new Er(zd[0],r));var a=r.uniforms;(a.envMap.value=e).isCubeTexture||a.texelSize.value.set(1/e.image.width,1/e.image.height),a.inputEncoding.value=Dd[e.encoding],a.outputEncoding.value=Dd[t.texture.encoding],qd(t,0,0,3*Cd,2*Cd),i.setRenderTarget(t),i.render(n,Nd)},_applyPMREM:function(e){var t=this._renderer,n=t.autoClear;t.autoClear=!1;for(var i=1;i<Od;i++){var r=Math.sqrt(Bd[i]*Bd[i]-Bd[i-1]*Bd[i-1]),a=Vd[(i-1)%Vd.length];this._blur(e,i-1,i,r,a)}t.autoClear=n},_blur:function(e,t,n,i,r){var a=this._pingPongRenderTarget;this._halfBlur(e,a,t,n,i,"latitudinal",r),this._halfBlur(a,e,n,n,i,"longitudinal",r)},_halfBlur:function(e,t,n,i,r,a,o){var s=this._renderer,c=this._blurMaterial;"latitudinal"!==a&&"longitudinal"!==a&&console.error("blur direction must be either latitudinal or longitudinal!");var l=new jn;l.add(new Er(zd[i],c));var u=c.uniforms,h=Ud[n]-1,d=isFinite(r)?Math.PI/(2*h):2*Math.PI/39,p=r/d,f=isFinite(r)?1+Math.floor(3*p):20;20<f&&console.warn("sigmaRadians, "+r+", is too large and will clip, as it requested "+f+" samples when the maximum is set to 20");for(var m=[],v=0,g=0;g<20;++g){var y=g/p,_=Math.exp(-y*y/2);m.push(_),0==g?v+=_:g<f&&(v+=2*_)}for(g=0;g<m.length;g++)m[g]=m[g]/v;u.envMap.value=e.texture,u.samples.value=f,u.weights.value=m,u.latitudinal.value="latitudinal"===a,o&&(u.poleAxis.value=o),u.dTheta.value=d,u.mipInt.value=8-n,u.inputEncoding.value=Dd[e.texture.encoding],u.outputEncoding.value=Dd[e.texture.encoding];var x=Ud[i];qd(t,y=3*Math.max(0,Cd-2*x),(0===i?0:2*Cd)+2*x*(4<i?i-8+4:0),3*x,2*x),s.setRenderTarget(t),s.render(l,Nd)}};function Kd(e){console.warn("THREE.ClosedSplineCurve3 has been deprecated. Use THREE.CatmullRomCurve3 instead."),mu.call(this,e),this.type="catmullrom",this.closed=!0}function Qd(e){console.warn("THREE.SplineCurve3 has been deprecated. Use THREE.CatmullRomCurve3 instead."),mu.call(this,e),this.type="catmullrom"}function $d(e){console.warn("THREE.Spline has been removed. Use THREE.CatmullRomCurve3 instead."),mu.call(this,e),this.type="catmullrom"}su.create=function(e,t){return console.log("THREE.Curve.create() has been deprecated"),e.prototype=Object.create(su.prototype),(e.prototype.constructor=e).prototype.getPoint=t,e},J(Au.prototype,{createPointsGeometry:function(e){console.warn("THREE.CurvePath: .createPointsGeometry() has been removed. Use new THREE.Geometry().setFromPoints( points ) instead.");var t=this.getPoints(e);return this.createGeometry(t)},createSpacedPointsGeometry:function(e){console.warn("THREE.CurvePath: .createSpacedPointsGeometry() has been removed. Use new THREE.Geometry().setFromPoints( points ) instead.");var t=this.getSpacedPoints(e);return this.createGeometry(t)},createGeometry:function(e){console.warn("THREE.CurvePath: .createGeometry() has been removed. Use new THREE.Geometry().setFromPoints( points ) instead.");for(var t=new Or,n=0,i=e.length;n<i;n++){var r=e[n];t.vertices.push(new gn(r.x,r.y,r.z||0))}return t}}),J(Lu.prototype,{fromPoints:function(e){return console.warn("THREE.Path: .fromPoints() has been renamed to .setFromPoints()."),this.setFromPoints(e)}}),Kd.prototype=Object.create(mu.prototype),Qd.prototype=Object.create(mu.prototype),J($d.prototype=Object.create(mu.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.")}}),dd.prototype.setColors=function(){console.error("THREE.GridHelper: setColors() has been deprecated, pass them in the constructor instead.")},od.prototype.update=function(){console.error("THREE.SkeletonHelper: update() no longer needs to be called.")},J(Ql.prototype,{extractUrlBase:function(e){return console.warn("THREE.Loader: .extractUrlBase() has been deprecated. Use THREE.LoaderUtils.extractUrlBase() instead."),Wu.extractUrlBase(e)}}),Ql.Handlers={add:function(){console.error("THREE.Loader: Handlers.add() has been removed. Use LoadingManager.addHandler() instead.")},get:function(){console.error("THREE.Loader: Handlers.get() has been removed. Use LoadingManager.getHandler() instead.")}},J(Ju.prototype,{setTexturePath:function(e){return console.warn("THREE.ObjectLoader: .setTexturePath() has been renamed to .setResourcePath()."),this.setResourcePath(e)}}),J(Jh.prototype,{center:function(e){return console.warn("THREE.Box2: .center() has been renamed to .getCenter()."),this.getCenter(e)},empty:function(){return console.warn("THREE.Box2: .empty() has been renamed to .isEmpty()."),this.isEmpty()},isIntersectionBox:function(e){return console.warn("THREE.Box2: .isIntersectionBox() has been renamed to .intersectsBox()."),this.intersectsBox(e)},size:function(e){return console.warn("THREE.Box2: .size() has been renamed to .getSize()."),this.getSize(e)}}),J(ri.prototype,{center:function(e){return console.warn("THREE.Box3: .center() has been renamed to .getCenter()."),this.getCenter(e)},empty:function(){return console.warn("THREE.Box3: .empty() has been renamed to .isEmpty()."),this.isEmpty()},isIntersectionBox:function(e){return console.warn("THREE.Box3: .isIntersectionBox() has been renamed to .intersectsBox()."),this.intersectsBox(e)},isIntersectionSphere:function(e){return console.warn("THREE.Box3: .isIntersectionSphere() has been renamed to .intersectsSphere()."),this.intersectsSphere(e)},size:function(e){return console.warn("THREE.Box3: .size() has been renamed to .getSize()."),this.getSize(e)}}),J(si.prototype,{empty:function(){return console.warn("THREE.Sphere: .empty() has been renamed to .isEmpty()."),this.isEmpty()}}),Zr.prototype.setFromMatrix=function(e){return console.warn("THREE.Frustum: .setFromMatrix() has been renamed to .setFromProjectionMatrix()."),this.setFromProjectionMatrix(e)},$h.prototype.center=function(e){return console.warn("THREE.Line3: .center() has been renamed to .getCenter()."),this.getCenter(e)},J(an,{random16:function(){return console.warn("THREE.Math: .random16() has been deprecated. Use Math.random() instead."),Math.random()},nearestPowerOfTwo:function(e){return console.warn("THREE.Math: .nearestPowerOfTwo() has been renamed to .floorPowerOfTwo()."),an.floorPowerOfTwo(e)},nextPowerOfTwo:function(e){return console.warn("THREE.Math: .nextPowerOfTwo() has been renamed to .ceilPowerOfTwo()."),an.ceilPowerOfTwo(e)}}),J(sn.prototype,{flattenToArrayOffset:function(e,t){return console.warn("THREE.Matrix3: .flattenToArrayOffset() has been deprecated. Use .toArray() instead."),this.toArray(e,t)},multiplyVector3:function(e){return console.warn("THREE.Matrix3: .multiplyVector3() has been removed. Use vector.applyMatrix3( matrix ) instead."),e.applyMatrix3(this)},multiplyVector3Array:function(){console.error("THREE.Matrix3: .multiplyVector3Array() has been removed.")},applyToBufferAttribute:function(e){return console.warn("THREE.Matrix3: .applyToBufferAttribute() has been removed. Use attribute.applyMatrix3( matrix ) instead."),e.applyMatrix3(this)},applyToVector3Array:function(){console.error("THREE.Matrix3: .applyToVector3Array() has been removed.")}}),J(Tn.prototype,{extractPosition:function(e){return console.warn("THREE.Matrix4: .extractPosition() has been renamed to .copyPosition()."),this.copyPosition(e)},flattenToArrayOffset:function(e,t){return console.warn("THREE.Matrix4: .flattenToArrayOffset() has been deprecated. Use .toArray() instead."),this.toArray(e,t)},getPosition:function(){return console.warn("THREE.Matrix4: .getPosition() has been removed. Use Vector3.setFromMatrixPosition( matrix ) instead."),(new gn).setFromMatrixColumn(this,3)},setRotationFromQuaternion:function(e){return console.warn("THREE.Matrix4: .setRotationFromQuaternion() has been renamed to .makeRotationFromQuaternion()."),this.makeRotationFromQuaternion(e)},multiplyToArray:function(){console.warn("THREE.Matrix4: .multiplyToArray() has been removed.")},multiplyVector3:function(e){return console.warn("THREE.Matrix4: .multiplyVector3() has been removed. Use vector.applyMatrix4( matrix ) instead."),e.applyMatrix4(this)},multiplyVector4:function(e){return console.warn("THREE.Matrix4: .multiplyVector4() has been removed. Use vector.applyMatrix4( matrix ) instead."),e.applyMatrix4(this)},multiplyVector3Array:function(){console.error("THREE.Matrix4: .multiplyVector3Array() has been removed.")},rotateAxis:function(e){console.warn("THREE.Matrix4: .rotateAxis() has been removed. Use Vector3.transformDirection( matrix ) instead."),e.transformDirection(this)},crossVector:function(e){return console.warn("THREE.Matrix4: .crossVector() has been removed. Use vector.applyMatrix4( matrix ) instead."),e.applyMatrix4(this)},translate:function(){console.error("THREE.Matrix4: .translate() has been removed.")},rotateX:function(){console.error("THREE.Matrix4: .rotateX() has been removed.")},rotateY:function(){console.error("THREE.Matrix4: .rotateY() has been removed.")},rotateZ:function(){console.error("THREE.Matrix4: .rotateZ() has been removed.")},rotateByAxis:function(){console.error("THREE.Matrix4: .rotateByAxis() has been removed.")},applyToBufferAttribute:function(e){return console.warn("THREE.Matrix4: .applyToBufferAttribute() has been removed. Use attribute.applyMatrix4( matrix ) instead."),e.applyMatrix4(this)},applyToVector3Array:function(){console.error("THREE.Matrix4: .applyToVector3Array() has been removed.")},makeFrustum:function(e,t,n,i,r,a){return console.warn("THREE.Matrix4: .makeFrustum() has been removed. Use .makePerspective( left, right, top, bottom, near, far ) instead."),this.makePerspective(e,t,i,n,r,a)}}),_i.prototype.isIntersectionLine=function(e){return console.warn("THREE.Plane: .isIntersectionLine() has been renamed to .intersectsLine()."),this.intersectsLine(e)},fn.prototype.multiplyVector3=function(e){return console.warn("THREE.Quaternion: .multiplyVector3() has been removed. Use is now vector.applyQuaternion( quaternion ) instead."),e.applyQuaternion(this)},J(mi.prototype,{isIntersectionBox:function(e){return console.warn("THREE.Ray: .isIntersectionBox() has been renamed to .intersectsBox()."),this.intersectsBox(e)},isIntersectionPlane:function(e){return console.warn("THREE.Ray: .isIntersectionPlane() has been renamed to .intersectsPlane()."),this.intersectsPlane(e)},isIntersectionSphere:function(e){return console.warn("THREE.Ray: .isIntersectionSphere() has been renamed to .intersectsSphere()."),this.intersectsSphere(e)}}),J(Pi.prototype,{area:function(){return console.warn("THREE.Triangle: .area() has been renamed to .getArea()."),this.getArea()},barycoordFromPoint:function(e,t){return console.warn("THREE.Triangle: .barycoordFromPoint() has been renamed to .getBarycoord()."),this.getBarycoord(e,t)},midpoint:function(e){return console.warn("THREE.Triangle: .midpoint() has been renamed to .getMidpoint()."),this.getMidpoint(e)},normal:function(e){return console.warn("THREE.Triangle: .normal() has been renamed to .getNormal()."),this.getNormal(e)},plane:function(e){return console.warn("THREE.Triangle: .plane() has been renamed to .getPlane()."),this.getPlane(e)}}),J(Pi,{barycoordFromPoint:function(e,t,n,i,r){return console.warn("THREE.Triangle: .barycoordFromPoint() has been renamed to .getBarycoord()."),Pi.getBarycoord(e,t,n,i,r)},normal:function(e,t,n,i){return console.warn("THREE.Triangle: .normal() has been renamed to .getNormal()."),Pi.getNormal(e,t,n,i)}}),J(Ru.prototype,{extractAllPoints:function(e){return console.warn("THREE.Shape: .extractAllPoints() has been removed. Use .extractPoints() instead."),this.extractPoints(e)},extrude:function(e){return console.warn("THREE.Shape: .extrude() has been removed. Use ExtrudeGeometry() instead."),new el(this,e)},makeGeometry:function(e){return console.warn("THREE.Shape: .makeGeometry() has been removed. Use ShapeGeometry() instead."),new dl(this,e)}}),J(on.prototype,{fromAttribute:function(e,t,n){return console.warn("THREE.Vector2: .fromAttribute() has been renamed to .fromBufferAttribute()."),this.fromBufferAttribute(e,t,n)},distanceToManhattan:function(e){return console.warn("THREE.Vector2: .distanceToManhattan() has been renamed to .manhattanDistanceTo()."),this.manhattanDistanceTo(e)},lengthManhattan:function(){return console.warn("THREE.Vector2: .lengthManhattan() has been renamed to .manhattanLength()."),this.manhattanLength()}}),J(gn.prototype,{setEulerFromRotationMatrix:function(){console.error("THREE.Vector3: .setEulerFromRotationMatrix() has been removed. Use Euler.setFromRotationMatrix() instead.")},setEulerFromQuaternion:function(){console.error("THREE.Vector3: .setEulerFromQuaternion() has been removed. Use Euler.setFromQuaternion() instead.")},getPositionFromMatrix:function(e){return console.warn("THREE.Vector3: .getPositionFromMatrix() has been renamed to .setFromMatrixPosition()."),this.setFromMatrixPosition(e)},getScaleFromMatrix:function(e){return console.warn("THREE.Vector3: .getScaleFromMatrix() has been renamed to .setFromMatrixScale()."),this.setFromMatrixScale(e)},getColumnFromMatrix:function(e,t){return console.warn("THREE.Vector3: .getColumnFromMatrix() has been renamed to .setFromMatrixColumn()."),this.setFromMatrixColumn(t,e)},applyProjection:function(e){return console.warn("THREE.Vector3: .applyProjection() has been removed. Use .applyMatrix4( m ) instead."),this.applyMatrix4(e)},fromAttribute:function(e,t,n){return console.warn("THREE.Vector3: .fromAttribute() has been renamed to .fromBufferAttribute()."),this.fromBufferAttribute(e,t,n)},distanceToManhattan:function(e){return console.warn("THREE.Vector3: .distanceToManhattan() has been renamed to .manhattanDistanceTo()."),this.manhattanDistanceTo(e)},lengthManhattan:function(){return console.warn("THREE.Vector3: .lengthManhattan() has been renamed to .manhattanLength()."),this.manhattanLength()}}),J(hn.prototype,{fromAttribute:function(e,t,n){return console.warn("THREE.Vector4: .fromAttribute() has been renamed to .fromBufferAttribute()."),this.fromBufferAttribute(e,t,n)},lengthManhattan:function(){return console.warn("THREE.Vector4: .lengthManhattan() has been renamed to .manhattanLength()."),this.manhattanLength()}}),J(Or.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.")},applyMatrix:function(e){return console.warn("THREE.Geometry: .applyMatrix() has been renamed to .applyMatrix4()."),this.applyMatrix4(e)}}),J(Vn.prototype,{getChildByName:function(e){return console.warn("THREE.Object3D: .getChildByName() has been renamed to .getObjectByName()."),this.getObjectByName(e)},renderDepth:function(){console.warn("THREE.Object3D: .renderDepth has been removed. Use .renderOrder, instead.")},translate:function(e,t){return console.warn("THREE.Object3D: .translate() has been removed. Use .translateOnAxis( axis, distance ) instead."),this.translateOnAxis(t,e)},getWorldRotation:function(){console.error("THREE.Object3D: .getWorldRotation() has been removed. Use THREE.Object3D.getWorldQuaternion( target ) instead.")},applyMatrix:function(e){return console.warn("THREE.Object3D: .applyMatrix() has been renamed to .applyMatrix4()."),this.applyMatrix4(e)}}),Object.defineProperties(Vn.prototype,{eulerOrder:{get:function(){return console.warn("THREE.Object3D: .eulerOrder is now .rotation.order."),this.rotation.order},set:function(e){console.warn("THREE.Object3D: .eulerOrder is now .rotation.order."),this.rotation.order=e}},useQuaternion:{get:function(){console.warn("THREE.Object3D: .useQuaternion has been removed. The library now uses quaternions by default.")},set:function(){console.warn("THREE.Object3D: .useQuaternion has been removed. The library now uses quaternions by default.")}}}),J(Er.prototype,{setDrawMode:function(){console.error("THREE.Mesh: .setDrawMode() has been removed. The renderer now always assumes THREE.TrianglesDrawMode. Transform your geometry via BufferGeometryUtils.toTrianglesDrawMode() if necessary.")}}),Object.defineProperties(Er.prototype,{drawMode:{get:function(){return console.error("THREE.Mesh: .drawMode has been removed. The renderer now always assumes THREE.TrianglesDrawMode."),0},set:function(){console.error("THREE.Mesh: .drawMode has been removed. The renderer now always assumes THREE.TrianglesDrawMode. Transform your geometry via BufferGeometryUtils.toTrianglesDrawMode() if necessary.")}}}),Object.defineProperties(Ps.prototype,{objects:{get:function(){return console.warn("THREE.LOD: .objects has been renamed to .levels."),this.levels}}}),Object.defineProperty(Ds.prototype,"useVertexTexture",{get:function(){console.warn("THREE.Skeleton: useVertexTexture has been removed.")},set:function(){console.warn("THREE.Skeleton: useVertexTexture has been removed.")}}),Cs.prototype.initBones=function(){console.error("THREE.SkinnedMesh: initBones() has been removed.")},Object.defineProperty(su.prototype,"__arcLengthDivisions",{get:function(){return console.warn("THREE.Curve: .__arcLengthDivisions is now .arcLengthDivisions."),this.arcLengthDivisions},set:function(e){console.warn("THREE.Curve: .__arcLengthDivisions is now .arcLengthDivisions."),this.arcLengthDivisions=e}}),Vr.prototype.setLens=function(e,t){console.warn("THREE.PerspectiveCamera.setLens is deprecated. Use .setFocalLength and .filmGauge for a photographic setup."),void 0!==t&&(this.filmGauge=t),this.setFocalLength(e)},Object.defineProperties(Pu.prototype,{onlyShadow:{set:function(){console.warn("THREE.Light: .onlyShadow has been removed.")}},shadowCameraFov:{set:function(e){console.warn("THREE.Light: .shadowCameraFov is now .shadow.camera.fov."),this.shadow.camera.fov=e}},shadowCameraLeft:{set:function(e){console.warn("THREE.Light: .shadowCameraLeft is now .shadow.camera.left."),this.shadow.camera.left=e}},shadowCameraRight:{set:function(e){console.warn("THREE.Light: .shadowCameraRight is now .shadow.camera.right."),this.shadow.camera.right=e}},shadowCameraTop:{set:function(e){console.warn("THREE.Light: .shadowCameraTop is now .shadow.camera.top."),this.shadow.camera.top=e}},shadowCameraBottom:{set:function(e){console.warn("THREE.Light: .shadowCameraBottom is now .shadow.camera.bottom."),this.shadow.camera.bottom=e}},shadowCameraNear:{set:function(e){console.warn("THREE.Light: .shadowCameraNear is now .shadow.camera.near."),this.shadow.camera.near=e}},shadowCameraFar:{set:function(e){console.warn("THREE.Light: .shadowCameraFar is now .shadow.camera.far."),this.shadow.camera.far=e}},shadowCameraVisible:{set:function(){console.warn("THREE.Light: .shadowCameraVisible has been removed. Use new THREE.CameraHelper( light.shadow.camera ) instead.")}},shadowBias:{set:function(e){console.warn("THREE.Light: .shadowBias is now .shadow.bias."),this.shadow.bias=e}},shadowDarkness:{set:function(){console.warn("THREE.Light: .shadowDarkness has been removed.")}},shadowMapWidth:{set:function(e){console.warn("THREE.Light: .shadowMapWidth is now .shadow.mapSize.width."),this.shadow.mapSize.width=e}},shadowMapHeight:{set:function(e){console.warn("THREE.Light: .shadowMapHeight is now .shadow.mapSize.height."),this.shadow.mapSize.height=e}}}),Object.defineProperties(Vi.prototype,{length:{get:function(){return console.warn("THREE.BufferAttribute: .length has been deprecated. Use .count instead."),this.array.length}},dynamic:{get:function(){return console.warn("THREE.BufferAttribute: .dynamic has been deprecated. Use .usage instead."),this.usage===$t},set:function(){console.warn("THREE.BufferAttribute: .dynamic has been deprecated. Use .usage instead."),this.setUsage($t)}}}),J(Vi.prototype,{setDynamic:function(e){return console.warn("THREE.BufferAttribute: .setDynamic() has been deprecated. Use .setUsage() instead."),this.setUsage(!0===e?$t:Qt),this},copyIndicesArray:function(){console.error("THREE.BufferAttribute: .copyIndicesArray() has been removed.")},setArray:function(){console.error("THREE.BufferAttribute: .setArray has been removed. Use BufferGeometry .setAttribute to replace/resize attribute buffers")}}),J(cr.prototype,{addIndex:function(e){console.warn("THREE.BufferGeometry: .addIndex() has been renamed to .setIndex()."),this.setIndex(e)},addAttribute:function(e,t,n){return console.warn("THREE.BufferGeometry: .addAttribute() has been renamed to .setAttribute()."),t&&t.isBufferAttribute||t&&t.isInterleavedBufferAttribute?"index"===e?(console.warn("THREE.BufferGeometry.addAttribute: Use .setIndex() for index attribute."),this.setIndex(t),this):this.setAttribute(e,t):(console.warn("THREE.BufferGeometry: .addAttribute() now expects ( name, attribute )."),this.setAttribute(e,new Vi(t,n)))},addDrawCall:function(e,t,n){void 0!==n&&console.warn("THREE.BufferGeometry: .addDrawCall() no longer supports indexOffset."),console.warn("THREE.BufferGeometry: .addDrawCall() is now .addGroup()."),this.addGroup(e,t)},clearDrawCalls:function(){console.warn("THREE.BufferGeometry: .clearDrawCalls() is now .clearGroups()."),this.clearGroups()},computeTangents:function(){console.warn("THREE.BufferGeometry: .computeTangents() has been removed.")},computeOffsets:function(){console.warn("THREE.BufferGeometry: .computeOffsets() has been removed.")},removeAttribute:function(e){return console.warn("THREE.BufferGeometry: .removeAttribute() has been renamed to .deleteAttribute()."),this.deleteAttribute(e)},applyMatrix:function(e){return console.warn("THREE.BufferGeometry: .applyMatrix() has been renamed to .applyMatrix4()."),this.applyMatrix4(e)}}),Object.defineProperties(cr.prototype,{drawcalls:{get:function(){return console.error("THREE.BufferGeometry: .drawcalls has been renamed to .groups."),this.groups}},offsets:{get:function(){return console.warn("THREE.BufferGeometry: .offsets has been renamed to .groups."),this.groups}}}),Object.defineProperties(jh.prototype,{linePrecision:{get:function(){return console.warn("THREE.Raycaster: .linePrecision has been deprecated. Use .params.Line.threshold instead."),this.params.Line.threshold},set:function(e){console.warn("THREE.Raycaster: .linePrecision has been deprecated. Use .params.Line.threshold instead."),this.params.Line.threshold=e}}}),Object.defineProperties(rs.prototype,{dynamic:{get:function(){return console.warn("THREE.InterleavedBuffer: .length has been deprecated. Use .usage instead."),this.usage===$t},set:function(e){console.warn("THREE.InterleavedBuffer: .length has been deprecated. Use .usage instead."),this.setUsage(e)}}}),J(rs.prototype,{setDynamic:function(e){return console.warn("THREE.InterleavedBuffer: .setDynamic() has been deprecated. Use .setUsage() instead."),this.setUsage(!0===e?$t:Qt),this},setArray:function(){console.error("THREE.InterleavedBuffer: .setArray has been removed. Use BufferGeometry .setAttribute to replace/resize attribute buffers")}}),J(tl.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(kh.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(Gi.prototype,{wrapAround:{get:function(){console.warn("THREE.Material: .wrapAround has been removed.")},set:function(){console.warn("THREE.Material: .wrapAround has been removed.")}},overdraw:{get:function(){console.warn("THREE.Material: .overdraw has been removed.")},set:function(){console.warn("THREE.Material: .overdraw has been removed.")}},wrapRGB:{get:function(){return console.warn("THREE.Material: .wrapRGB has been removed."),new Di}},shading:{get:function(){console.error("THREE."+this.type+": .shading has been removed. Use the boolean .flatShading instead.")},set:function(e){console.warn("THREE."+this.type+": .shading has been removed. Use the boolean .flatShading instead."),this.flatShading=1===e}},stencilMask:{get:function(){return console.warn("THREE."+this.type+": .stencilMask has been removed. Use .stencilFuncMask instead."),this.stencilFuncMask},set:function(e){console.warn("THREE."+this.type+": .stencilMask has been removed. Use .stencilFuncMask instead."),this.stencilFuncMask=e}}}),Object.defineProperties(Al.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(Hr.prototype,{derivatives:{get:function(){return console.warn("THREE.ShaderMaterial: .derivatives has been moved to .extensions.derivatives."),this.extensions.derivatives},set:function(e){console.warn("THREE. ShaderMaterial: .derivatives has been moved to .extensions.derivatives."),this.extensions.derivatives=e}}}),J(ts.prototype,{clearTarget:function(e,t,n,i){console.warn("THREE.WebGLRenderer: .clearTarget() has been deprecated. Use .setRenderTarget() and .clear() instead."),this.setRenderTarget(e),this.clear(t,n,i)},animate:function(e){console.warn("THREE.WebGLRenderer: .animate() is now .setAnimationLoop()."),this.setAnimationLoop(e)},getCurrentRenderTarget:function(){return console.warn("THREE.WebGLRenderer: .getCurrentRenderTarget() is now .getRenderTarget()."),this.getRenderTarget()},getMaxAnisotropy:function(){return console.warn("THREE.WebGLRenderer: .getMaxAnisotropy() is now .capabilities.getMaxAnisotropy()."),this.capabilities.getMaxAnisotropy()},getPrecision:function(){return console.warn("THREE.WebGLRenderer: .getPrecision() is now .capabilities.precision."),this.capabilities.precision},resetGLState:function(){return console.warn("THREE.WebGLRenderer: .resetGLState() is now .state.reset()."),this.state.reset()},supportsFloatTextures:function(){return console.warn("THREE.WebGLRenderer: .supportsFloatTextures() is now .extensions.get( 'OES_texture_float' )."),this.extensions.get("OES_texture_float")},supportsHalfFloatTextures:function(){return console.warn("THREE.WebGLRenderer: .supportsHalfFloatTextures() is now .extensions.get( 'OES_texture_half_float' )."),this.extensions.get("OES_texture_half_float")},supportsStandardDerivatives:function(){return console.warn("THREE.WebGLRenderer: .supportsStandardDerivatives() is now .extensions.get( 'OES_standard_derivatives' )."),this.extensions.get("OES_standard_derivatives")},supportsCompressedTextureS3TC:function(){return console.warn("THREE.WebGLRenderer: .supportsCompressedTextureS3TC() is now .extensions.get( 'WEBGL_compressed_texture_s3tc' )."),this.extensions.get("WEBGL_compressed_texture_s3tc")},supportsCompressedTexturePVRTC:function(){return console.warn("THREE.WebGLRenderer: .supportsCompressedTexturePVRTC() is now .extensions.get( 'WEBGL_compressed_texture_pvrtc' )."),this.extensions.get("WEBGL_compressed_texture_pvrtc")},supportsBlendMinMax:function(){return console.warn("THREE.WebGLRenderer: .supportsBlendMinMax() is now .extensions.get( 'EXT_blend_minmax' )."),this.extensions.get("EXT_blend_minmax")},supportsVertexTextures:function(){return console.warn("THREE.WebGLRenderer: .supportsVertexTextures() is now .capabilities.vertexTextures."),this.capabilities.vertexTextures},supportsInstancedArrays:function(){return console.warn("THREE.WebGLRenderer: .supportsInstancedArrays() is now .extensions.get( 'ANGLE_instanced_arrays' )."),this.extensions.get("ANGLE_instanced_arrays")},enableScissorTest:function(e){console.warn("THREE.WebGLRenderer: .enableScissorTest() is now .setScissorTest()."),this.setScissorTest(e)},initMaterial:function(){console.warn("THREE.WebGLRenderer: .initMaterial() has been removed.")},addPrePlugin:function(){console.warn("THREE.WebGLRenderer: .addPrePlugin() has been removed.")},addPostPlugin:function(){console.warn("THREE.WebGLRenderer: .addPostPlugin() has been removed.")},updateShadowMap:function(){console.warn("THREE.WebGLRenderer: .updateShadowMap() has been removed.")},setFaceCulling:function(){console.warn("THREE.WebGLRenderer: .setFaceCulling() has been removed.")},allocTextureUnit:function(){console.warn("THREE.WebGLRenderer: .allocTextureUnit() has been removed.")},setTexture:function(){console.warn("THREE.WebGLRenderer: .setTexture() has been removed.")},setTexture2D:function(){console.warn("THREE.WebGLRenderer: .setTexture2D() has been removed.")},setTextureCube:function(){console.warn("THREE.WebGLRenderer: .setTextureCube() has been removed.")},getActiveMipMapLevel:function(){return console.warn("THREE.WebGLRenderer: .getActiveMipMapLevel() is now .getActiveMipmapLevel()."),this.getActiveMipmapLevel()}}),Object.defineProperties(ts.prototype,{shadowMapEnabled:{get:function(){return this.shadowMap.enabled},set:function(e){console.warn("THREE.WebGLRenderer: .shadowMapEnabled is now .shadowMap.enabled."),this.shadowMap.enabled=e}},shadowMapType:{get:function(){return this.shadowMap.type},set:function(e){console.warn("THREE.WebGLRenderer: .shadowMapType is now .shadowMap.type."),this.shadowMap.type=e}},shadowMapCullFace:{get:function(){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.")}},context:{get:function(){return console.warn("THREE.WebGLRenderer: .context has been removed. Use .getContext() instead."),this.getContext()}},vr:{get:function(){return console.warn("THREE.WebGLRenderer: .vr has been renamed to .xr"),this.xr}},gammaInput:{get:function(){return console.warn("THREE.WebGLRenderer: .gammaInput has been removed. Set the encoding for textures via Texture.encoding instead."),!1},set:function(){console.warn("THREE.WebGLRenderer: .gammaInput has been removed. Set the encoding for textures via Texture.encoding instead.")}},gammaOutput:{get:function(){return console.warn("THREE.WebGLRenderer: .gammaOutput has been removed. Set WebGLRenderer.outputEncoding instead."),!1},set:function(e){console.warn("THREE.WebGLRenderer: .gammaOutput has been removed. Set WebGLRenderer.outputEncoding instead."),this.outputEncoding=!0===e?Bt:Ut}}}),Object.defineProperties(Xo.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(dn.prototype,{wrapS:{get:function(){return console.warn("THREE.WebGLRenderTarget: .wrapS is now .texture.wrapS."),this.texture.wrapS},set:function(e){console.warn("THREE.WebGLRenderTarget: .wrapS is now .texture.wrapS."),this.texture.wrapS=e}},wrapT:{get:function(){return console.warn("THREE.WebGLRenderTarget: .wrapT is now .texture.wrapT."),this.texture.wrapT},set:function(e){console.warn("THREE.WebGLRenderTarget: .wrapT is now .texture.wrapT."),this.texture.wrapT=e}},magFilter:{get:function(){return console.warn("THREE.WebGLRenderTarget: .magFilter is now .texture.magFilter."),this.texture.magFilter},set:function(e){console.warn("THREE.WebGLRenderTarget: .magFilter is now .texture.magFilter."),this.texture.magFilter=e}},minFilter:{get:function(){return console.warn("THREE.WebGLRenderTarget: .minFilter is now .texture.minFilter."),this.texture.minFilter},set:function(e){console.warn("THREE.WebGLRenderTarget: .minFilter is now .texture.minFilter."),this.texture.minFilter=e}},anisotropy:{get:function(){return console.warn("THREE.WebGLRenderTarget: .anisotropy is now .texture.anisotropy."),this.texture.anisotropy},set:function(e){console.warn("THREE.WebGLRenderTarget: .anisotropy is now .texture.anisotropy."),this.texture.anisotropy=e}},offset:{get:function(){return console.warn("THREE.WebGLRenderTarget: .offset is now .texture.offset."),this.texture.offset},set:function(e){console.warn("THREE.WebGLRenderTarget: .offset is now .texture.offset."),this.texture.offset=e}},repeat:{get:function(){return console.warn("THREE.WebGLRenderTarget: .repeat is now .texture.repeat."),this.texture.repeat},set:function(e){console.warn("THREE.WebGLRenderTarget: .repeat is now .texture.repeat."),this.texture.repeat=e}},format:{get:function(){return console.warn("THREE.WebGLRenderTarget: .format is now .texture.format."),this.texture.format},set:function(e){console.warn("THREE.WebGLRenderTarget: .format is now .texture.format."),this.texture.format=e}},type:{get:function(){return console.warn("THREE.WebGLRenderTarget: .type is now .texture.type."),this.texture.type},set:function(e){console.warn("THREE.WebGLRenderTarget: .type is now .texture.type."),this.texture.type=e}},generateMipmaps:{get:function(){return console.warn("THREE.WebGLRenderTarget: .generateMipmaps is now .texture.generateMipmaps."),this.texture.generateMipmaps},set:function(e){console.warn("THREE.WebGLRenderTarget: .generateMipmaps is now .texture.generateMipmaps."),this.texture.generateMipmaps=e}}}),Object.defineProperties(_h.prototype,{load:{value:function(e){console.warn("THREE.Audio: .load has been deprecated. Use THREE.AudioLoader instead.");var t=this;return(new sh).load(e,function(e){t.setBuffer(e)}),this}},startTime:{set:function(){console.warn("THREE.Audio: .startTime is now .play( delay ).")}}}),Th.prototype.getData=function(){return console.warn("THREE.AudioAnalyser: .getData() is now .getFrequencyData()."),this.getFrequencyData()},jr.prototype.updateCubeMap=function(e,t){return console.warn("THREE.CubeCamera: .updateCubeMap() is now .update()."),this.update(e,t)};var ep={merge:function(e,t,n){var i;console.warn("THREE.GeometryUtils: .merge() has been moved to Geometry. Use geometry.merge( geometry2, matrix, materialIndexOffset ) instead."),t.isMesh&&(t.matrixAutoUpdate&&t.updateMatrix(),i=t.matrix,t=t.geometry),e.merge(t,i,n)},center:function(e){return console.warn("THREE.GeometryUtils: .center() has been moved to Geometry. Use geometry.center() instead."),e.center()}};cn.crossOrigin=void 0,cn.loadTexture=function(e,t,n,i){console.warn("THREE.ImageUtils.loadTexture has been deprecated. Use THREE.TextureLoader() instead.");var r=new ou;r.setCrossOrigin(this.crossOrigin);var a=r.load(e,n,void 0,i);return t&&(a.mapping=t),a},cn.loadTextureCube=function(e,t,n,i){console.warn("THREE.ImageUtils.loadTextureCube has been deprecated. Use THREE.CubeTextureLoader() instead.");var r=new au;r.setCrossOrigin(this.crossOrigin);var a=r.load(e,n,void 0,i);return t&&(a.mapping=t),a},cn.loadCompressedTexture=function(){console.error("THREE.ImageUtils.loadCompressedTexture has been removed. Use THREE.DDSLoader instead.")},cn.loadCompressedTextureCube=function(){console.error("THREE.ImageUtils.loadCompressedTextureCube has been removed. Use THREE.DDSLoader instead.")};var tp={createMultiMaterialObject:function(){console.error("THREE.SceneUtils has been moved to /examples/jsm/utils/SceneUtils.js")},detach:function(){console.error("THREE.SceneUtils has been moved to /examples/jsm/utils/SceneUtils.js")},attach:function(){console.error("THREE.SceneUtils has been moved to /examples/jsm/utils/SceneUtils.js")}};"undefined"!=typeof __THREE_DEVTOOLS__&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("register",{detail:{revision:"116"}}));var np={__proto__:null,ACESFilmicToneMapping:X,AddEquation:ce,AddOperation:k,AdditiveAnimationBlendMode:2501,AdditiveBlending:re,AlphaFormat:m,AlwaysDepth:Ee,AlwaysStencilFunc:Kt,AmbientLight:Gu,AmbientLightProbe:lh,AnimationClip:Xl,AnimationLoader:tu,AnimationMixer:Hh,AnimationObjectGroup:Bh,AnimationUtils:Dl,ArcCurve:lu,ArrayCamera:Ko,ArrowHelper:Rd,Audio:_h,AudioAnalyser:Th,AudioContext:oh,AudioListener:yh,AudioLoader:sh,AxesHelper:Pd,AxisHelper:function(e){return console.warn("THREE.AxisHelper has been renamed to THREE.AxesHelper."),new Pd(e)},BackSide:Me,BasicDepthPacking:qt,BasicShadowMap:0,BinaryTextureLoader:function(e){return console.warn("THREE.BinaryTextureLoader has been renamed to THREE.DataTextureLoader."),new iu(e)},Bone:Ns,BooleanKeyframeTrack:Gl,BoundingBoxHelper:function(e,t){return console.warn("THREE.BoundingBoxHelper has been deprecated. Creating a THREE.BoxHelper instead."),new Md(e,t)},Box2:Jh,Box3:ri,Box3Helper:Sd,BoxBufferGeometry:Nr,BoxGeometry:Dr,BoxHelper:Md,BufferAttribute:Vi,BufferGeometry:cr,BufferGeometryLoader:Yu,ByteType:c,Cache:Zl,Camera:kr,CameraHelper:xd,CanvasRenderer:function(){console.error("THREE.CanvasRenderer has been removed")},CanvasTexture:sc,CatmullRomCurve3:mu,CineonToneMapping:q,CircleBufferGeometry:bl,CircleGeometry:xl,ClampToEdgeWrapping:Ge,Clock:ph,ClosedSplineCurve3:Kd,Color:Di,ColorKeyframeTrack:Hl,CompressedTexture:oc,CompressedTextureLoader:nu,ConeBufferGeometry:_l,ConeGeometry:yl,CubeCamera:jr,CubeGeometry:Dr,CubeReflectionMapping:Y,CubeRefractionMapping:Z,CubeTexture:fa,CubeTextureLoader:au,CubeUVReflectionMapping:ze,CubeUVRefractionMapping:Ue,CubicBezierCurve:_u,CubicBezierCurve3:xu,CubicInterpolant:Fl,CullFaceBack:Q,CullFaceFront:$,CullFaceFrontBack:3,CullFaceNone:K,Curve:su,CurvePath:Au,CustomBlending:se,CylinderBufferGeometry:gl,CylinderGeometry:vl,Cylindrical:Yh,DataTexture:qr,DataTexture2DArray:ma,DataTexture3D:va,DataTextureLoader:iu,DecrementStencilOp:7683,DecrementWrapStencilOp:34056,DefaultLoadingManager:Kl,DepthFormat:nt,DepthStencilFormat:it,DepthTexture:cc,DirectionalLight:Bu,DirectionalLightHelper:gd,DirectionalLightShadow:Uu,DiscreteInterpolant:Ul,DodecahedronBufferGeometry:bc,DodecahedronGeometry:xc,DoubleSide:te,DstAlphaFactor:_e,DstColorFactor:be,DynamicBufferAttribute:function(e,t){return console.warn("THREE.DynamicBufferAttribute has been removed. Use new THREE.BufferAttribute().setUsage( THREE.DynamicDrawUsage ) instead."),new Vi(e,t).setUsage($t)},DynamicCopyUsage:35050,DynamicDrawUsage:$t,DynamicReadUsage:35049,EdgesGeometry:ml,EdgesHelper:function(e,t){return console.warn("THREE.EdgesHelper has been removed. Use THREE.EdgesGeometry instead."),new Js(new ml(e.geometry),new Hs({color:void 0!==t?t:16777215}))},EllipseCurve:cu,EqualDepth:Re,EqualStencilFunc:514,EquirectangularReflectionMapping:De,EquirectangularRefractionMapping:Ne,Euler:Ln,EventDispatcher:en,ExtrudeBufferGeometry:tl,ExtrudeGeometry:el,Face3:Ui,Face4:function(e,t,n,i,r,a,o){return console.warn("THREE.Face4 has been removed. A THREE.Face3 will be created instead."),new Ui(e,t,n,r,a,o)},FaceColors:1,FileLoader:eu,FlatShading:1,Float32Attribute:function(e,t){return console.warn("THREE.Float32Attribute has been removed. Use new THREE.Float32BufferAttribute() instead."),new Ki(e,t)},Float32BufferAttribute:Ki,Float64Attribute:function(e,t){return console.warn("THREE.Float64Attribute has been removed. Use new THREE.Float64BufferAttribute() instead."),new Qi(e,t)},Float64BufferAttribute:Qi,FloatType:Ke,Fog:is,FogExp2:ns,Font:ih,FontLoader:ah,FrontFaceDirectionCCW:1,FrontFaceDirectionCW:0,FrontSide:ee,Frustum:Zr,GammaEncoding:Gt,Geometry:Or,GeometryUtils:ep,GreaterDepth:Ce,GreaterEqualDepth:Pe,GreaterEqualStencilFunc:518,GreaterStencilFunc:516,GridHelper:dd,Group:Qo,HalfFloatType:Qe,HemisphereLight:Cu,HemisphereLightHelper:hd,HemisphereLightProbe:ch,IcosahedronBufferGeometry:_c,IcosahedronGeometry:yc,ImageBitmapLoader:th,ImageLoader:ru,ImageUtils:cn,ImmediateRenderObject:ed,IncrementStencilOp:7682,IncrementWrapStencilOp:34055,InstancedBufferAttribute:Xu,InstancedBufferGeometry:qu,InstancedInterleavedBuffer:Vh,InstancedMesh:Gs,Int16Attribute:function(e,t){return console.warn("THREE.Int16Attribute has been removed. Use new THREE.Int16BufferAttribute() instead."),new Xi(e,t)},Int16BufferAttribute:Xi,Int32Attribute:function(e,t){return console.warn("THREE.Int32Attribute has been removed. Use new THREE.Int32BufferAttribute() instead."),new Zi(e,t)},Int32BufferAttribute:Zi,Int8Attribute:function(e,t){return console.warn("THREE.Int8Attribute has been removed. Use new THREE.Int8BufferAttribute() instead."),new ji(e,t)},Int8BufferAttribute:ji,IntType:u,InterleavedBuffer:rs,InterleavedBufferAttribute:ss,Interpolant:Nl,InterpolateDiscrete:Ot,InterpolateLinear:Dt,InterpolateSmooth:2302,InvertStencilOp:5386,JSONLoader:function(){console.error("THREE.JSONLoader has been removed.")},KeepStencilOp:Jt,KeyframeTrack:Bl,LOD:Ps,LatheBufferGeometry:hl,LatheGeometry:ul,Layers:Rn,LensFlare:function(){console.error("THREE.LensFlare has been moved to /examples/jsm/objects/Lensflare.js")},LessDepth:Ae,LessEqualDepth:Le,LessEqualStencilFunc:515,LessStencilFunc:513,Light:Pu,LightProbe:Vu,LightShadow:Iu,Line:Xs,Line3:$h,LineBasicMaterial:Hs,LineCurve:bu,LineCurve3:wu,LineDashedMaterial:Il,LineLoop:Ks,LinePieces:1,LineSegments:Js,LineStrip:0,LinearEncoding:Ut,LinearFilter:We,LinearInterpolant:zl,LinearMipMapLinearFilter:1008,LinearMipMapNearestFilter:1007,LinearMipmapLinearFilter:Xe,LinearMipmapNearestFilter:qe,LinearToneMapping:V,Loader:Ql,LoaderUtils:Wu,LoadingManager:Jl,LogLuvEncoding:kt,LoopOnce:2200,LoopPingPong:2202,LoopRepeat:2201,LuminanceAlphaFormat:y,LuminanceFormat:g,MOUSE:{LEFT:0,MIDDLE:1,RIGHT:2,ROTATE:0,DOLLY:1,PAN:2},Material:Gi,MaterialLoader:ju,Math:an,MathUtils:an,Matrix3:sn,Matrix4:Tn,MaxEquation:de,Mesh:Er,MeshBasicMaterial:Hi,MeshDepthMaterial:Vo,MeshDistanceMaterial:jo,MeshFaceMaterial:function(e){return console.warn("THREE.MeshFaceMaterial has been removed. Use an Array instead."),e},MeshLambertMaterial:Pl,MeshMatcapMaterial:Cl,MeshNormalMaterial:Rl,MeshPhongMaterial:Al,MeshPhysicalMaterial:El,MeshStandardMaterial:Tl,MeshToonMaterial:Ll,MinEquation:he,MirroredRepeatWrapping:He,MixOperation:H,MultiMaterial:function(e){return void 0===e&&(e=[]),console.warn("THREE.MultiMaterial has been removed. Use an Array instead."),e.isMultiMaterial=!0,(e.materials=e).clone=function(){return e.slice()},e},MultiplyBlending:oe,MultiplyOperation:G,NearestFilter:ke,NearestMipMapLinearFilter:1005,NearestMipMapNearestFilter:1004,NearestMipmapLinearFilter:je,NearestMipmapNearestFilter:Ve,NeverDepth:Te,NeverStencilFunc:512,NoBlending:ne,NoColors:0,NoToneMapping:Oe,NormalAnimationBlendMode:2500,NormalBlending:ie,NotEqualDepth:Ie,NotEqualStencilFunc:517,NumberKeyframeTrack:kl,Object3D:Vn,ObjectLoader:Ju,ObjectSpaceNormalMap:Zt,OctahedronBufferGeometry:gc,OctahedronGeometry:vc,OneFactor:fe,OneMinusDstAlphaFactor:xe,OneMinusDstColorFactor:we,OneMinusSrcAlphaFactor:ye,OneMinusSrcColorFactor:ve,OrthographicCamera:zu,PCFShadowMap:z,PCFSoftShadowMap:U,PMREMGenerator:jd,ParametricBufferGeometry:hc,ParametricGeometry:uc,Particle:function(e){return console.warn("THREE.Particle has been renamed to THREE.Sprite."),new bs(e)},ParticleBasicMaterial:function(e){return console.warn("THREE.ParticleBasicMaterial has been renamed to THREE.PointsMaterial."),new Qs(e)},ParticleSystem:function(e,t){return console.warn("THREE.ParticleSystem has been renamed to THREE.Points."),new ic(e,t)},ParticleSystemMaterial:function(e){return console.warn("THREE.ParticleSystemMaterial has been renamed to THREE.PointsMaterial."),new Qs(e)},Path:Lu,PerspectiveCamera:Vr,Plane:_i,PlaneBufferGeometry:ea,PlaneGeometry:$r,PlaneHelper:Td,PointCloud:function(e,t){return console.warn("THREE.PointCloud has been renamed to THREE.Points."),new ic(e,t)},PointCloudMaterial:function(e){return console.warn("THREE.PointCloudMaterial has been renamed to THREE.PointsMaterial."),new Qs(e)},PointLight:Fu,PointLightHelper:sd,Points:ic,PointsMaterial:Qs,PolarGridHelper:pd,PolyhedronBufferGeometry:pc,PolyhedronGeometry:dc,PositionalAudio:Sh,PropertyBinding:Uh,PropertyMixer:Eh,QuadraticBezierCurve:Mu,QuadraticBezierCurve3:Su,Quaternion:fn,QuaternionKeyframeTrack:jl,QuaternionLinearInterpolant:Vl,REVISION:"116",RGBADepthPacking:Xt,RGBAFormat:tt,RGBAIntegerFormat:S,RGBA_ASTC_10x10_Format:mt,RGBA_ASTC_10x5_Format:dt,RGBA_ASTC_10x6_Format:pt,RGBA_ASTC_10x8_Format:ft,RGBA_ASTC_12x10_Format:vt,RGBA_ASTC_12x12_Format:gt,RGBA_ASTC_4x4_Format:rt,RGBA_ASTC_5x4_Format:at,RGBA_ASTC_5x5_Format:ot,RGBA_ASTC_6x5_Format:st,RGBA_ASTC_6x6_Format:ct,RGBA_ASTC_8x5_Format:lt,RGBA_ASTC_8x6_Format:ut,RGBA_ASTC_8x8_Format:ht,RGBA_BPTC_Format:yt,RGBA_ETC2_EAC_Format:F,RGBA_PVRTC_2BPPV1_Format:O,RGBA_PVRTC_4BPPV1_Format:I,RGBA_S3TC_DXT1_Format:A,RGBA_S3TC_DXT3_Format:L,RGBA_S3TC_DXT5_Format:R,RGBDEncoding:Wt,RGBEEncoding:Ht,RGBEFormat:T,RGBFormat:et,RGBIntegerFormat:M,RGBM16Encoding:jt,RGBM7Encoding:Vt,RGB_ETC1_Format:D,RGB_ETC2_Format:N,RGB_PVRTC_2BPPV1_Format:C,RGB_PVRTC_4BPPV1_Format:P,RGB_S3TC_DXT1_Format:E,RGFormat:b,RGIntegerFormat:w,RawShaderMaterial:Sl,Ray:mi,Raycaster:jh,RectAreaLight:Hu,RedFormat:_,RedIntegerFormat:x,ReinhardToneMapping:j,RepeatWrapping:Be,ReplaceStencilOp:7681,ReverseSubtractEquation:ue,RingBufferGeometry:ll,RingGeometry:cl,SRGB8_ALPHA8_ASTC_10x10_Format:Pt,SRGB8_ALPHA8_ASTC_10x5_Format:At,SRGB8_ALPHA8_ASTC_10x6_Format:Lt,SRGB8_ALPHA8_ASTC_10x8_Format:Rt,SRGB8_ALPHA8_ASTC_12x10_Format:Ct,SRGB8_ALPHA8_ASTC_12x12_Format:It,SRGB8_ALPHA8_ASTC_4x4_Format:_t,SRGB8_ALPHA8_ASTC_5x4_Format:xt,SRGB8_ALPHA8_ASTC_5x5_Format:bt,SRGB8_ALPHA8_ASTC_6x5_Format:wt,SRGB8_ALPHA8_ASTC_6x6_Format:Mt,SRGB8_ALPHA8_ASTC_8x5_Format:St,SRGB8_ALPHA8_ASTC_8x6_Format:Tt,SRGB8_ALPHA8_ASTC_8x8_Format:Et,Scene:jn,SceneUtils:tp,ShaderChunk:ta,ShaderLib:na,ShaderMaterial:Hr,ShadowMaterial:Ml,Shape:Ru,ShapeBufferGeometry:pl,ShapeGeometry:dl,ShapePath:nh,ShapeUtils:Kc,ShortType:l,Skeleton:Ds,SkeletonHelper:od,SkinnedMesh:Cs,SmoothShading:2,Sphere:si,SphereBufferGeometry:sl,SphereGeometry:ol,Spherical:Xh,SphericalHarmonics3:ku,SphericalReflectionMapping:Fe,Spline:$d,SplineCurve:Tu,SplineCurve3:Qd,SpotLight:Du,SpotLightHelper:nd,SpotLightShadow:Ou,Sprite:bs,SpriteMaterial:cs,SrcAlphaFactor:ge,SrcAlphaSaturateFactor:Se,SrcColorFactor:me,StaticCopyUsage:35046,StaticDrawUsage:Qt,StaticReadUsage:35045,StereoCamera:dh,StreamCopyUsage:35042,StreamDrawUsage:35040,StreamReadUsage:35041,StringKeyframeTrack:Wl,SubtractEquation:le,SubtractiveBlending:ae,TOUCH:{ROTATE:0,PAN:1,DOLLY_PAN:2,DOLLY_ROTATE:3},TangentSpaceNormalMap:Yt,TetrahedronBufferGeometry:mc,TetrahedronGeometry:fc,TextBufferGeometry:al,TextGeometry:rl,Texture:un,TextureLoader:ou,TorusBufferGeometry:Ac,TorusGeometry:Ec,TorusKnotBufferGeometry:Tc,TorusKnotGeometry:Sc,Triangle:Pi,TriangleFanDrawMode:2,TriangleStripDrawMode:1,TrianglesDrawMode:0,TubeBufferGeometry:Mc,TubeGeometry:wc,UVMapping:300,Uint16Attribute:function(e,t){return console.warn("THREE.Uint16Attribute has been removed. Use new THREE.Uint16BufferAttribute() instead."),new Yi(e,t)},Uint16BufferAttribute:Yi,Uint32Attribute:function(e,t){return console.warn("THREE.Uint32Attribute has been removed. Use new THREE.Uint32BufferAttribute() instead."),new Ji(e,t)},Uint32BufferAttribute:Ji,Uint8Attribute:function(e,t){return console.warn("THREE.Uint8Attribute has been removed. Use new THREE.Uint8BufferAttribute() instead."),new Wi(e,t)},Uint8BufferAttribute:Wi,Uint8ClampedAttribute:function(e,t){return console.warn("THREE.Uint8ClampedAttribute has been removed. Use new THREE.Uint8ClampedBufferAttribute() instead."),new qi(e,t)},Uint8ClampedBufferAttribute:qi,Uncharted2ToneMapping:W,Uniform:kh,UniformsLib:Jr,UniformsUtils:Ur,UnsignedByteType:Ye,UnsignedInt248Type:$e,UnsignedIntType:Je,UnsignedShort4444Type:h,UnsignedShort5551Type:d,UnsignedShort565Type:f,UnsignedShortType:Ze,VSMShadowMap:B,Vector2:on,Vector3:gn,Vector4:hn,VectorKeyframeTrack:ql,Vertex:function(e,t,n){return console.warn("THREE.Vertex has been removed. Use THREE.Vector3 instead."),new gn(e,t,n)},VertexColors:2,VideoTexture:ac,WebGLCubeRenderTarget:Wr,WebGLMultisampleRenderTarget:pn,WebGLRenderTarget:dn,WebGLRenderTargetCube:function(e,t,n){return console.warn("THREE.WebGLRenderTargetCube( width, height, options ) is now WebGLCubeRenderTarget( size, options )."),new Wr(e,n)},WebGLRenderer:ts,WebGLUtils:Jo,WireframeGeometry:lc,WireframeHelper:function(e,t){return console.warn("THREE.WireframeHelper has been removed. Use THREE.WireframeGeometry instead."),new Js(new lc(e.geometry),new Hs({color:void 0!==t?t:16777215}))},WrapAroundEnding:zt,XHRLoader:function(e){return console.warn("THREE.XHRLoader has been renamed to THREE.FileLoader."),new eu(e)},ZeroCurvatureEnding:Nt,ZeroFactor:pe,ZeroSlopeEnding:Ft,ZeroStencilOp:0,sRGBEncoding:Bt},ip=function(){function e(e){this._canvas=e,this._renderer=new ts({canvas:this._canvas,alpha:!0,antialias:!0,preserveDrawingBuffer:!0}),this._renderer.xr.enabled=!0,this._renderer.outputEncoding=Bt,this._clock=new ph(!1),this.enableShadow()}var t=e.prototype;return Object.defineProperty(t,"canvas",{get:function(){return this._canvas},enumerable:!1,configurable:!0}),Object.defineProperty(t,"context",{get:function(){return this._renderer.context},enumerable:!1,configurable:!0}),Object.defineProperty(t,"size",{get:function(){return this._renderer.getSize(new on)},set:function(e){this._renderer.setSize(e.x,e.y,!1)},enumerable:!1,configurable:!0}),Object.defineProperty(t,"threeRenderer",{get:function(){return this._renderer},enumerable:!1,configurable:!0}),t.resize=function(){var e=this._renderer,t=this._canvas;e.xr.isPresenting||(e.setPixelRatio(window.devicePixelRatio),e.setSize(t.offsetWidth,t.offsetHeight,!1))},t.render=function(e,t){this._renderer.render(e.root,t.threeCamera)},t.setAnimationLoop=function(i){var r=this;this._clock.start(),this._renderer.setAnimationLoop(function(e,t){var n=r._clock.getDelta();i(n,t)})},t.stopAnimationLoop=function(){this._clock.stop(),this._renderer.setAnimationLoop(null)},t.enableShadow=function(){var e=this._renderer;e.shadowMap.enabled=!0,e.shadowMap.type=U},t.disableShadow=function(){this._renderer.shadowMap.enabled=!1},e}(),rp=["alphaMap","aoMap","bumpMap","displacementMap","emissiveMap","envMap","lightMap","map","metalnessMap","normalMap","roughnessMap"],ap=function(i){function r(e,t){var n=i.call(this,e)||this;return n.message=e,n.code=t,Object.setPrototypeOf(n,r.prototype),n.name="View3DError",n}return a(r,i),r}(Error),op={WRONG_TYPE:0,ELEMENT_NOT_FOUND:1,ELEMENT_NOT_CANVAS:2,WEBGL_NOT_SUPPORTED:3,ADD_CONTROL_FIRST:4,PROVIDE_WIDTH_OR_HEIGHT:5},sp={WRONG_TYPE:function(e,t){return typeof e+" is not a "+t.map(function(e){return'"'+e+'"'}).join(" or ")+"."},ELEMENT_NOT_FOUND:function(e){return'Element with selector "'+e+'" not found.'},ELEMENT_NOT_CANVAS:function(e){return"Given element <"+e.tagName+"> is not a canvas."},WEBGL_NOT_SUPPORTED:"WebGL is not supported on this browser.",ADD_CONTROL_FIRST:"Control is enabled before setting a target element.",PROVIDE_WIDTH_OR_HEIGHT:"Either width or height should be given."};function cp(e,t){var n=null;if("string"==typeof e){var i=(t||document).querySelector(e);if(!i)throw new ap(sp.ELEMENT_NOT_FOUND(e),op.ELEMENT_NOT_FOUND);n=i}else e&&e.nodeType===Node.ELEMENT_NODE&&(n=e);return n}function lp(e){return!e||e<=0?[]:Array.apply(0,Array(e)).map(function(e,t){return t})}function up(e){return e*Math.PI/180}function hp(e,t,n){return Math.max(Math.min(e,n),t)}function dp(e,t){var n,i,r=-1;try{for(var a=function(e){var t="function"==typeof Symbol&&Symbol.iterator,n=t&&e[t],i=0;if(n)return n.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&i>=e.length&&(e=void 0),{value:e&&e[i++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}(lp(t.length)),o=a.next();!o.done;o=a.next()){var s=o.value;if(t[s]===e){r=s;break}}}catch(e){n={error:e}}finally{try{o&&!o.done&&(i=a.return)&&i.call(a)}finally{if(n)throw n.error}}return r}function pp(e,t,n){return e*(1-n)+t*n}function fp(e,t,n){var i=Math.abs(n-t);if(e<t)e=n-(t-e)%i;else if(n<e){e=t+(e-n)%i}return e}function mp(i){for(var e=[],t=1;t<arguments.length;t++)e[t-1]=arguments[t];return e.forEach(function(n){Object.keys(n).forEach(function(e){var t=n[e];Array.isArray(i[e])&&Array.isArray(t)?i[e]=v(i[e],t):i[e]=t})}),i}function vp(e){return Math.sin(e*Math.PI*2)}function gp(e){return 1-Math.pow(1-e,3)}function yp(e){var t=7.5625;return e<1/2.75?t*e*e:e<2/2.75?t*(e-=1.5/2.75)*e+.75:e<2.5/2.75?t*(e-=2.25/2.75)*e+.9375:t*(e-=2.625/2.75)*e+.984375}var _p,xp,bp=function(){function e(){this._root=new jn,this._userObjects=new Qo,this._envObjects=new Qo,this._envs=[];var e=this._root,t=this._userObjects,n=this._envObjects;t.name="userObjects",n.name="envObjects",e.add(t),e.add(n)}var t=e.prototype;return Object.defineProperty(t,"root",{get:function(){return this._root},enumerable:!1,configurable:!0}),Object.defineProperty(t,"environments",{get:function(){return this._envs},enumerable:!1,configurable:!0}),Object.defineProperty(t,"visible",{get:function(){return this._root.visible},enumerable:!1,configurable:!0}),t.update=function(t,n){this._envs.forEach(function(e){return e.fit(t,n)})},t.reset=function(){this.resetModel(),this.resetEnv()},t.resetModel=function(){this._removeChildsOf(this._userObjects)},t.resetEnv=function(){this._removeChildsOf(this._envObjects),this._envs=[],this._root.background=null,this._root.environment=null},t.add=function(){for(var e,t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];(e=this._userObjects).add.apply(e,v(t))},t.addEnv=function(){for(var n=this,e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];e.forEach(function(e){var t;e.isObject3D?n._envObjects.add(e):(n._envs.push(e),(t=n._envObjects).add.apply(t,v(e.objects)))})},t.remove=function(){for(var e,t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];(e=this._userObjects).remove.apply(e,v(t))},t.removeEnv=function(){for(var i=this,e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];e.forEach(function(e){var t;if(e.isObject3D)i._envObjects.remove(e);else{var n=dp(e,i._envs);-1<n&&i._envs.splice(n,1),(t=i._envObjects).remove.apply(t,v(e.objects))}})},t.setBackground=function(e){this._root.background=e},t.setEnvMap=function(e){var t=e.texture?e.texture:e;this._root.environment=t},t.show=function(){this._root.visible=!0},t.hide=function(){this._root.visible=!1},t._removeChildsOf=function(e){for(e.traverse(function(e){if(e.isMesh){var t=e;t.geometry.dispose(),(Array.isArray(t.material)?t.material:[t.material]).forEach(function(t){rp.forEach(function(e){t[e]&&t[e].dispose()})})}});0<e.children.length;)e.remove(e.children[0])},e}(),wp=function(){function e(e,t){this._controls=[],this._canvas=e,this._camera=t}var t=e.prototype;return Object.defineProperty(t,"controls",{get:function(){return this._controls},enumerable:!1,configurable:!0}),t.clear=function(){this._controls.forEach(function(e){return e.destroy()}),this._controls=[]},t.add=function(e){var t=this._canvas;e.element||e.setElement(t),e.sync(this._camera),e.enable(),this._controls.push(e)},t.remove=function(e){var t=this._controls,n=dp(e,t);if(n<0)return null;var i=t.splice(n,1)[0];return i.disable(),i},t.enableAll=function(){this._controls.forEach(function(e){return e.enable()}),this.syncToCamera()},t.disableAll=function(){this._controls.forEach(function(e){return e.disable()})},t.resize=function(t){this._controls.forEach(function(e){return e.resize(t)})},t.syncToCamera=function(){var t=this;this._controls.forEach(function(e){return e.sync(t._camera)})},t.update=function(e){var t=1e3*e,n=this._camera;this._controls.forEach(function(e){e.update(n,t)}),n.updatePosition()},e}(),Mp=function(){function e(e,t,n,i){void 0===i&&(i=new gn(0,0,0)),this.yaw=e,this.pitch=t,this.distance=n,this.pivot=i}return e.prototype.clone=function(){return new e(this.yaw,this.pitch,this.distance,this.pivot.clone())},e}(),Sp={__proto__:null,SINE_WAVE:vp,EASE_OUT_CUBIC:gp,EASE_OUT_BOUNCE:yp},Tp=gp,Ep={min:0,max:1},Ap=new Mp(0,0,100,new gn(0,0,0)),Lp={min:-1/0,max:1/0},Rp={min:-89.9,max:89.9},Pp={min:0,max:500},Cp=null,Ip="https://www.gstatic.com/draco/v1/decoders/",Op=function(){function e(e){var t=void 0===e?{}:e,n=t.duration,i=void 0===n?500:n,r=t.loop,a=void 0!==r&&r,o=t.range,s=void 0===o?Ep:o,c=t.easing,l=void 0===c?Tp:c;this._duration=i,this._loop=a,this._range=s,this._easing=l,this._activated=!1,this.reset(0)}var t=e.prototype;return Object.defineProperty(t,"val",{get:function(){return this._val},enumerable:!1,configurable:!0}),Object.defineProperty(t,"start",{get:function(){return this._start},enumerable:!1,configurable:!0}),Object.defineProperty(t,"end",{get:function(){return this._end},enumerable:!1,configurable:!0}),Object.defineProperty(t,"progress",{get:function(){return this._progress},enumerable:!1,configurable:!0}),Object.defineProperty(t,"duration",{get:function(){return this._duration},set:function(e){this._duration=e},enumerable:!1,configurable:!0}),Object.defineProperty(t,"loop",{get:function(){return this._loop},set:function(e){this._loop=e},enumerable:!1,configurable:!0}),Object.defineProperty(t,"range",{get:function(){return this._range},set:function(e){this._range=e},enumerable:!1,configurable:!0}),Object.defineProperty(t,"easing",{get:function(){return this._easing},set:function(e){this._easing=e},enumerable:!1,configurable:!0}),t.update=function(e){if(!this._activated)return 0;var t=this._start,n=this._end,i=this._duration,r=this._val,a=this._loop,o=this._progress+e/i;this._progress=(a?fp:hp)(o,0,1);var s=this._easing(this._progress);return this._val=pp(t,n,s),!a&&1<=this._progress&&(this._activated=!1),this._val-r},t.reset=function(e){var t=this._range,n=hp(e,t.min,t.max);this._start=n,this._end=n,this._val=n,this._progress=0,this._activated=!1},t.setEndDelta=function(e){var t=this._range;this._start=this._val,this._end=hp(this._end+e,t.min,t.max),this._progress=0,this._activated=!0},e}(),Dp=function(){function e(e,t,n){var i=void 0===n?{}:n,r=i.duration,a=void 0===r?500:r,o=i.easing,s=void 0===o?Tp:o;this._enabled=!1,this._finishCallbacks=[],e=e.clone(),t=t.clone(),e.yaw=fp(e.yaw,0,360),t.yaw=fp(t.yaw,0,360),180<Math.abs(t.yaw-e.yaw)&&(t.yaw=t.yaw<e.yaw?t.yaw+360:t.yaw-360),this._motion=new Op({duration:a,range:Ep,easing:s}),this._from=e,this._to=t}var t=e.prototype;return Object.defineProperty(t,"element",{get:function(){return null},enumerable:!1,configurable:!0}),Object.defineProperty(t,"enabled",{get:function(){return this._enabled},enumerable:!1,configurable:!0}),Object.defineProperty(t,"duration",{get:function(){return this._motion.duration},set:function(e){this._motion.duration=e},enumerable:!1,configurable:!0}),Object.defineProperty(t,"easing",{get:function(){return this._motion.easing},set:function(e){this._motion.easing=e},enumerable:!1,configurable:!0}),t.destroy=function(){this.disable()},t.update=function(e,t){if(this._enabled){var n=this._from,i=this._to,r=this._motion;r.update(t);var a=r.val;e.yaw=pp(n.yaw,i.yaw,a),e.pitch=pp(n.pitch,i.pitch,a),e.distance=pp(n.distance,i.distance,a),e.pivot=n.pivot.clone().lerp(i.pivot,a),1<=r.progress&&(this.disable(),this._finishCallbacks.forEach(function(e){return e()}))}},t.enable=function(){this._enabled||(this._enabled=!0,this._motion.reset(0),this._motion.setEndDelta(1))},t.disable=function(){this._enabled&&(this._enabled=!1)},t.onFinished=function(e){this._finishCallbacks.push(e)},t.clearFinished=function(){this._finishCallbacks=[]},t.resize=function(e){},t.setElement=function(e){},t.sync=function(e){},e}(),Np=function(){function e(e){this._minDistance=1,this._maxDistance=500,this._defaultPose=Ap,this._currentPose=this._defaultPose.clone(),this._threeCamera=new Vr,this._controller=new wp(e,this)}var t=e.prototype;return Object.defineProperty(t,"threeCamera",{get:function(){return this._threeCamera},enumerable:!1,configurable:!0}),Object.defineProperty(t,"controller",{get:function(){return this._controller},enumerable:!1,configurable:!0}),Object.defineProperty(t,"defaultPose",{get:function(){return this._defaultPose},enumerable:!1,configurable:!0}),Object.defineProperty(t,"currentPose",{get:function(){return this._currentPose.clone()},enumerable:!1,configurable:!0}),Object.defineProperty(t,"yaw",{get:function(){return this._currentPose.yaw},set:function(e){this._currentPose.yaw=e},enumerable:!1,configurable:!0}),Object.defineProperty(t,"pitch",{get:function(){return this._currentPose.pitch},set:function(e){this._currentPose.pitch=e},enumerable:!1,configurable:!0}),Object.defineProperty(t,"distance",{get:function(){return this._currentPose.distance},set:function(e){this._currentPose.distance=e},enumerable:!1,configurable:!0}),Object.defineProperty(t,"pivot",{get:function(){return this._currentPose.pivot},set:function(e){this._currentPose.pivot=e},enumerable:!1,configurable:!0}),Object.defineProperty(t,"minDistance",{get:function(){return this._minDistance},set:function(e){this._minDistance=e},enumerable:!1,configurable:!0}),Object.defineProperty(t,"maxDistance",{get:function(){return this._maxDistance},set:function(e){this._maxDistance=e},enumerable:!1,configurable:!0}),Object.defineProperty(t,"fov",{get:function(){return this._threeCamera.fov},set:function(e){this._threeCamera.fov=e,this._threeCamera.updateProjectionMatrix()},enumerable:!1,configurable:!0}),Object.defineProperty(t,"renderWidth",{get:function(){return this.renderHeight*this._threeCamera.aspect},enumerable:!1,configurable:!0}),Object.defineProperty(t,"renderHeight",{get:function(){return 2*this.distance*Math.tan(up(this.fov/2))},enumerable:!1,configurable:!0}),Object.defineProperty(t,"pose",{set:function(e){this._currentPose=e,this._controller.syncToCamera()},enumerable:!1,configurable:!0}),t.reset=function(e,t){void 0===e&&(e=0),void 0===t&&(t=Tp);var n=this._controller,i=this._currentPose,r=this._defaultPose;if(e<=0)return this._currentPose=r.clone(),n.syncToCamera(),Promise.resolve();var a=new Dp(i,r);return a.duration=e,a.easing=t,new Promise(function(e){a.onFinished(function(){n.remove(a),n.syncToCamera(),e()}),n.add(a)})},t.resize=function(e){var t=this._threeCamera,n=e.x/e.y;t.aspect=n,t.updateProjectionMatrix(),this._controller.resize(e)},t.setDefaultPose=function(e){var t=this._defaultPose,n=e.yaw,i=e.pitch,r=e.distance,a=e.pivot;null!=n&&(t.yaw=n),null!=i&&(t.pitch=i),null!=r&&(t.distance=r),null!=a&&(t.pivot=a)},t.updatePosition=function(){this._clampCurrentPose();var e=this._threeCamera,t=this._currentPose,n=up(t.yaw),i=up(t.pitch),r=Math.max(t.distance+this._minDistance,1),a=new gn(0,0,0);a.y=r*Math.sin(i),a.z=r*Math.cos(i),a.x=a.z*Math.sin(-n),a.z=a.z*Math.cos(-n),a.add(t.pivot),e.position.copy(a),e.lookAt(t.pivot),e.updateProjectionMatrix()},t._clampCurrentPose=function(){var e=this._currentPose;e.yaw=fp(e.yaw,0,360),e.pitch=hp(e.pitch,Rp.min,Rp.max),e.distance=hp(e.distance,this._minDistance,this._maxDistance)},e}(),Fp=function(){function e(e){this._mixer=new Hh(e),this._clips=[],this._actions=[]}var t=e.prototype;return Object.defineProperty(t,"clips",{get:function(){return this._clips},enumerable:!1,configurable:!0}),Object.defineProperty(t,"mixer",{get:function(){return this._mixer},enumerable:!1,configurable:!0}),t.setClips=function(e){var t=this._mixer;this._clips=e,this._actions=e.map(function(e){return t.clipAction(e)})},t.play=function(e){var t=this._actions[e];t&&t.play()},t.pause=function(e){var t=this._actions[e];t&&(t.timeScale=0)},t.resume=function(e){var t=this._actions[e];t&&(t.timeScale=1)},t.stop=function(e){var t=this._actions[e];t&&t.stop()},t.update=function(e){this._mixer.update(e)},t.reset=function(){var e=this._mixer;e.uncacheRoot(e.getRoot()),this._clips=[],this._actions=[]},e}(),zp=function(){function e(e){this._view3d=e,this._sessions=[],this._currentSession=null}var t=e.prototype;return Object.defineProperty(t,"sessions",{get:function(){return this._sessions},enumerable:!1,configurable:!0}),Object.defineProperty(t,"currentSession",{get:function(){return this._currentSession},enumerable:!1,configurable:!0}),t.isAvailable=function(){return n(this,void 0,void 0,function(){return s(this,function(e){switch(e.label){case 0:return[4,Promise.all(this._sessions.map(function(e){return e.isAvailable()}))];case 1:return[2,e.sent().some(function(e){return!0===e})]}})})},t.addSession=function(){for(var e,t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];(e=this._sessions).push.apply(e,v(t))},t.enter=function(){return n(this,void 0,void 0,function(){return s(this,function(e){return[2,this._enterSession(0,[])]})})},t.exit=function(){this._currentSession&&(this._currentSession.exit(this._view3d),this._currentSession=null)},t._enterSession=function(a,o){return n(this,void 0,void 0,function(){var t,n,i,r=this;return s(this,function(e){switch(e.label){case 0:return(t=this._view3d,n=this._sessions,a>=n.length)?(o.length<1&&o.push(new Error("No sessions available")),[2,Promise.reject(o)]):[4,(i=n[a]).isAvailable()];case 1:return e.sent()?[4,i.enter(t).then(function(){return i.isWebXRSession&&(r._currentSession=i).session.addEventListener("end",function(){r._currentSession=null}),o}).catch(function(e){return o.push(e),r._enterSession(a+1,o)})]:[2,this._enterSession(a+1,o)];case 2:return[2,e.sent()]}})})},e}(),Up="mousedown",Bp="mousemove",Gp="mouseup",Hp="touchstart",kp="touchmove",Vp="touchend",jp="wheel",Wp="resize",qp="contextmenu",Xp="mouseenter",Yp="mouseleave";(xp=_p=_p||{})[xp.LEFT=0]="LEFT",xp[xp.MIDDLE=1]="MIDDLE",xp[xp.RIGHT=2]="RIGHT";function Zp(e){Ql.call(this,e),this.decoderPath="",this.decoderConfig={},this.decoderBinary=null,this.decoderPending=null,this.workerLimit=4,this.workerPool=[],this.workerNextTaskID=1,this.workerSourceURL="",this.defaultAttributeIDs={position:"POSITION",normal:"NORMAL",color:"COLOR",uv:"TEX_COORD"},this.defaultAttributeTypes={position:"Float32Array",normal:"Float32Array",color:"Float32Array",uv:"Float32Array"}}var Jp=function(n){function e(e){var a=n.call(this)||this;a.resize=function(){a._renderer.resize();var e=a._renderer.size;a._camera.resize(e),a.emit("resize",p(p({},e),{target:a}))},a.renderLoop=function(e){var t=a._renderer,n=a._scene,i=a._camera,r=a.controller;a._animator.update(e),r.update(e),a.emit("beforeRender",a),t.render(n,i),a.emit("afterRender",a)};var t=function(e){var t=cp(e);if(!t)throw new ap(sp.WRONG_TYPE(e,["HTMLElement","string"]),op.WRONG_TYPE);if(!/^canvas$/i.test(t.tagName))throw new ap(sp.ELEMENT_NOT_CANVAS(t),op.ELEMENT_NOT_CANVAS);return t}(e);return a._renderer=new ip(t),a._camera=new Np(t),a._scene=new bp,a._animator=new Fp(a._scene.root),a._xr=new zp(a),a._model=null,a.resize(),window.addEventListener(Wp,a.resize),a}a(e,n);var t=e.prototype;return Object.defineProperty(t,"renderer",{get:function(){return this._renderer},enumerable:!1,configurable:!0}),Object.defineProperty(t,"scene",{get:function(){return this._scene},enumerable:!1,configurable:!0}),Object.defineProperty(t,"camera",{get:function(){return this._camera},enumerable:!1,configurable:!0}),Object.defineProperty(t,"controller",{get:function(){return this._camera.controller},enumerable:!1,configurable:!0}),Object.defineProperty(t,"animator",{get:function(){return this._animator},enumerable:!1,configurable:!0}),Object.defineProperty(t,"xr",{get:function(){return this._xr},enumerable:!1,configurable:!0}),Object.defineProperty(t,"model",{get:function(){return this._model},enumerable:!1,configurable:!0}),t.destroy=function(){this._scene.reset(),this.controller.clear(),this._model=null,window.removeEventListener(Wp,this.resize)},t.display=function(e,t){var n=void 0===t?{}:t,i=n.applySize,r=void 0===i||i,a=n.size,o=void 0===a?80:a,s=n.resetView,c=void 0===s||s,l=this._renderer,u=this._scene,h=this._camera,d=this._animator;r&&(e.size=o),u.resetModel(),c&&h.reset(),d.reset(),this._model=e,u.add(e.scene),d.setClips(e.animations),u.update(e),l.stopAnimationLoop(),l.setAnimationLoop(this.renderLoop)},e.VERSION="1.1.0",e}(t),Kp=function(){function e(e){var t=e.scenes,n=e.animations,i=void 0===n?[]:n,r=e.fixSkinnedBbox,a=void 0!==r&&r,o=e.castShadow,s=void 0===o||o,c=e.receiveShadow,l=void 0!==c&&c;this._scene=new Qo;var u=new Vn;u.name="Pivot",u.add.apply(u,v(t)),this._scene.add(u),this._animations=i,this._fixSkinnedBbox=a,this._cachedLights=null,this._cachedMeshes=null,this._setInitialBbox();var h=this._initialBbox.getCenter(new gn);u.position.copy(h.negate()),this._moveInitialBboxToCenter(),this._originalSize=this.size,this.castShadow=s,this.receiveShadow=l}var t=e.prototype;return Object.defineProperty(t,"scene",{get:function(){return this._scene},enumerable:!1,configurable:!0}),Object.defineProperty(t,"animations",{get:function(){return this._animations},enumerable:!1,configurable:!0}),Object.defineProperty(t,"lights",{get:function(){return this._cachedLights?this._cachedLights:this._getAllLights()},enumerable:!1,configurable:!0}),Object.defineProperty(t,"meshes",{get:function(){return this._cachedMeshes?this._cachedMeshes:this._getAllMeshes()},enumerable:!1,configurable:!0}),Object.defineProperty(t,"bbox",{get:function(){return this._getTransformedBbox()},enumerable:!1,configurable:!0}),Object.defineProperty(t,"initialBbox",{get:function(){return this._initialBbox.clone()},enumerable:!1,configurable:!0}),Object.defineProperty(t,"size",{get:function(){return this._getTransformedBbox().getSize(new gn).length()},set:function(e){var t=this._scene,n=e/this._initialBbox.getSize(new gn).length();t.scale.setScalar(n),t.updateMatrix()},enumerable:!1,configurable:!0}),Object.defineProperty(t,"fixSkinnedBbox",{get:function(){return this._fixSkinnedBbox},set:function(e){this._fixSkinnedBbox=e},enumerable:!1,configurable:!0}),Object.defineProperty(t,"originalSize",{get:function(){return this._originalSize},enumerable:!1,configurable:!0}),Object.defineProperty(t,"castShadow",{set:function(t){this.meshes.forEach(function(e){return e.castShadow=t})},enumerable:!1,configurable:!0}),Object.defineProperty(t,"receiveShadow",{set:function(t){this.meshes.forEach(function(e){return e.receiveShadow=t})},enumerable:!1,configurable:!0}),t.moveToOrigin=function(){var e=this._scene,t=this._initialBbox.clone();t.min.multiply(e.scale),t.max.multiply(e.scale);var n=t.getCenter(new gn);e.position.copy(n.negate()),e.updateMatrix()},t._setInitialBbox=function(){this._scene.updateMatrixWorld(),this._fixSkinnedBbox&&this._hasSkinnedMesh()?this._initialBbox=this._getSkeletonBbox():this._initialBbox=(new ri).setFromObject(this._scene)},t._getSkeletonBbox=function(){var d=new ri;return this.meshes.forEach(function(o){if(o.isSkinnedMesh){var e=o.geometry,s=e.attributes.position,c=e.attributes.skinIndex,l=e.attributes.skinWeight,t=o.skeleton;t.update();for(var u=t.boneMatrices,h=new Tn,n=function(e){h.identity();var i=new hn;i.set(0,0,0,0);var r=new hn;r.set(s.getX(e),s.getY(e),s.getZ(e),1).applyMatrix4(o.bindMatrix);var t=[l.getX(e),l.getY(e),l.getZ(e),l.getW(e)],a=[c.getX(e),c.getY(e),c.getZ(e),c.getW(e)];t.forEach(function(e,t){var n=(new Tn).fromArray(u,16*a[t]);i.add(r.clone().applyMatrix4(n).multiplyScalar(e))});var n=(new gn).fromArray(i.applyMatrix4(o.bindMatrixInverse).toArray());n.applyMatrix4(o.matrixWorld),d.expandByPoint(n)},i=0;i<s.count;i++)n(i)}else d.expandByObject(o)}),d},t._moveInitialBboxToCenter=function(){var e=this._initialBbox.getCenter(new gn);this._initialBbox.translate(e.negate())},t._getAllLights=function(){var t=[];return this._scene.traverse(function(e){e.isLight&&t.push(e)}),this._cachedLights=t},t._getAllMeshes=function(){var t=[];return this._scene.traverse(function(e){e.isMesh&&t.push(e)}),this._cachedMeshes=t},t._hasSkinnedMesh=function(){return this.meshes.some(function(e){return e.isSkinnedMesh})},t._getTransformedBbox=function(){return this._initialBbox.clone().applyMatrix4(this._scene.matrix)},e}(),Qp={__proto__:null,ModelAnimator:Fp,Model:Kp,Renderer:ip,Scene:bp,XRManager:zp,Camera:Np,Controller:wp,Pose:Mp},$p=function(){function e(e){var t=this,n=void 0===e?{}:e,i=n.element,r=void 0===i?Cp:i,a=n.delay,o=void 0===a?2e3:a,s=n.delayOnMouseLeave,c=void 0===s?0:s,l=n.speed,u=void 0===l?1:l,h=n.pauseOnHover,d=void 0!==h&&h,p=n.canInterrupt,f=void 0===p||p,m=n.disableOnInterrupt,v=void 0!==m&&m;this._targetEl=null,this._enabled=!1,this._interrupted=!1,this._interruptionTimer=-1,this._hovering=!1,this._onMouseDown=function(e){t._canInterrupt&&(e.button!==_p.LEFT&&e.button!==_p.RIGHT||(t._interrupted=!0,t._clearTimeout(),window.addEventListener(Gp,t._onMouseUp,!1)))},this._onMouseUp=function(){window.removeEventListener(Gp,t._onMouseUp,!1),t._setUninterruptedAfterDelay(t._delay)},this._onTouchStart=function(){t._canInterrupt&&(t._interrupted=!0,t._clearTimeout())},this._onTouchEnd=function(){t._setUninterruptedAfterDelay(t._delay)},this._onMouseEnter=function(){t._pauseOnHover&&(t._interrupted=!0,t._hovering=!0)},this._onMouseLeave=function(){t._pauseOnHover&&(t._hovering=!1,t._setUninterruptedAfterDelay(t._delayOnMouseLeave))},this._onWheel=function(){t._canInterrupt&&(t._interrupted=!0,t._setUninterruptedAfterDelay(t._delay))};var g=cp(r);g&&this.setElement(g),this._delay=o,this._delayOnMouseLeave=c,this._speed=u,this._pauseOnHover=d,this._canInterrupt=f,this._disableOnInterrupt=v}var t=e.prototype;return Object.defineProperty(t,"element",{get:function(){return this._targetEl},enumerable:!1,configurable:!0}),Object.defineProperty(t,"enabled",{get:function(){return this._enabled},enumerable:!1,configurable:!0}),Object.defineProperty(t,"delay",{get:function(){return this._delay},set:function(e){this._delay=e},enumerable:!1,configurable:!0}),Object.defineProperty(t,"delayOnMouseLeave",{get:function(){return this._delayOnMouseLeave},set:function(e){this._delayOnMouseLeave=e},enumerable:!1,configurable:!0}),Object.defineProperty(t,"speed",{get:function(){return this._speed},set:function(e){this._speed=e},enumerable:!1,configurable:!0}),Object.defineProperty(t,"pauseOnHover",{get:function(){return this._pauseOnHover},set:function(e){this._pauseOnHover=e},enumerable:!1,configurable:!0}),Object.defineProperty(t,"canInterrupt",{get:function(){return this._canInterrupt},set:function(e){this._canInterrupt=e},enumerable:!1,configurable:!0}),Object.defineProperty(t,"disableOnInterrupt",{get:function(){return this._disableOnInterrupt},set:function(e){this._disableOnInterrupt=e},enumerable:!1,configurable:!0}),t.destroy=function(){this.disable()},t.update=function(e,t){this._enabled&&(this._interrupted?this._disableOnInterrupt&&this.disable():e.yaw+=this._speed*t/100)},t.resize=function(e){},t.enable=function(){if(!this._enabled){if(!this._targetEl)throw new ap(sp.ADD_CONTROL_FIRST,op.ADD_CONTROL_FIRST);var e=this._targetEl;e.addEventListener(Up,this._onMouseDown,!1),e.addEventListener(Hp,this._onTouchStart,!1),e.addEventListener(Vp,this._onTouchEnd,!1),e.addEventListener(Xp,this._onMouseEnter,!1),e.addEventListener(Yp,this._onMouseLeave,!1),e.addEventListener(jp,this._onWheel,!1),this._enabled=!0}},t.disable=function(){if(this._enabled&&this._targetEl){var e=this._targetEl;e.removeEventListener(Up,this._onMouseDown,!1),window.removeEventListener(Gp,this._onMouseUp,!1),e.removeEventListener(Hp,this._onTouchStart,!1),e.removeEventListener(Vp,this._onTouchEnd,!1),e.removeEventListener(Xp,this._onMouseEnter,!1),e.removeEventListener(Yp,this._onMouseLeave,!1),e.removeEventListener(jp,this._onWheel,!1),this._enabled=!1,this._interrupted=!1,this._hovering=!1,this._clearTimeout()}},t.sync=function(e){},t.setElement=function(e){this._targetEl=e},t._setUninterruptedAfterDelay=function(e){var t=this;this._hovering||(this._clearTimeout(),0<e?this._interruptionTimer=window.setTimeout(function(){t._interrupted=!1,t._interruptionTimer=-1},e):(this._interrupted=!1,this._interruptionTimer=-1))},t._clearTimeout=function(){0<=this._interruptionTimer&&(window.clearTimeout(this._interruptionTimer),this._interruptionTimer=-1)},e}(),ef="grab",tf="grabbing",nf=function(){function e(e){var r=this,t=void 0===e?{}:e,n=t.element,i=void 0===n?Cp:n,a=t.duration,o=void 0===a?500:a,s=t.easing,c=void 0===s?Tp:s,l=t.scale,u=void 0===l?new on(1,1):l,h=t.useGrabCursor,d=void 0===h||h,p=t.scaleToElement,f=void 0===p||p;this._targetEl=null,this._screenScale=new on(0,0),this._prevPos=new on(0,0),this._enabled=!1,this._onMouseDown=function(e){if(e.button===_p.LEFT){var t=r._targetEl;e.preventDefault(),t.focus?t.focus():window.focus(),r._prevPos.set(e.clientX,e.clientY),window.addEventListener(Bp,r._onMouseMove,!1),window.addEventListener(Gp,r._onMouseUp,!1),r._setCursor(tf)}},this._onMouseMove=function(e){e.preventDefault();var t=r._prevPos,n=new on(e.clientX,e.clientY).sub(t).multiply(r._userScale);r._scaleToElement&&n.multiply(r._screenScale),r._xMotion.setEndDelta(n.x),r._yMotion.setEndDelta(n.y),t.set(e.clientX,e.clientY)},this._onMouseUp=function(){r._prevPos.set(0,0),window.removeEventListener(Bp,r._onMouseMove,!1),window.removeEventListener(Gp,r._onMouseUp,!1),r._setCursor(ef)},this._onTouchStart=function(e){e.preventDefault();var t=e.touches[0];r._prevPos.set(t.clientX,t.clientY)},this._onTouchMove=function(e){if(!(1<e.touches.length)){!1!==e.cancelable&&e.preventDefault(),e.stopPropagation();var t=e.touches[0],n=r._prevPos,i=new on(t.clientX,t.clientY).sub(n).multiply(r._userScale);r._scaleToElement&&i.multiply(r._screenScale),r._xMotion.setEndDelta(i.x),r._yMotion.setEndDelta(i.y),n.set(t.clientX,t.clientY)}},this._onTouchEnd=function(e){var t=e.touches[0];t?r._prevPos.set(t.clientX,t.clientY):r._prevPos.set(0,0)};var m=cp(i);m&&this.setElement(m),this._userScale=u,this._useGrabCursor=d,this._scaleToElement=f,this._xMotion=new Op({duration:o,range:Lp,easing:c}),this._yMotion=new Op({duration:o,range:Rp,easing:c})}var t=e.prototype;return Object.defineProperty(t,"element",{get:function(){return this._targetEl},enumerable:!1,configurable:!0}),Object.defineProperty(t,"scale",{get:function(){return this._userScale},set:function(e){this._userScale.copy(e)},enumerable:!1,configurable:!0}),Object.defineProperty(t,"useGrabCursor",{get:function(){return this._useGrabCursor},set:function(e){e?(this._useGrabCursor=!0,this._setCursor(ef)):(this._setCursor(""),this._useGrabCursor=!1)},enumerable:!1,configurable:!0}),Object.defineProperty(t,"scaleToElement",{get:function(){return this._scaleToElement},set:function(e){this._scaleToElement=e},enumerable:!1,configurable:!0}),Object.defineProperty(t,"enabled",{get:function(){return this._enabled},enumerable:!1,configurable:!0}),t.destroy=function(){this.disable()},t.update=function(e,t){var n=this._xMotion,i=this._yMotion,r=new on(n.update(t),i.update(t));e.yaw+=r.x,e.pitch+=r.y},t.resize=function(e){this._screenScale.set(360/e.x,180/e.y)},t.enable=function(){if(!this._enabled){if(!this._targetEl)throw new ap(sp.ADD_CONTROL_FIRST,op.ADD_CONTROL_FIRST);var e=this._targetEl;e.addEventListener(Up,this._onMouseDown,!1),e.addEventListener(Hp,this._onTouchStart,!1),e.addEventListener(kp,this._onTouchMove,!1),e.addEventListener(Vp,this._onTouchEnd,!1),this._enabled=!0,this._setCursor(ef)}},t.disable=function(){if(this._enabled&&this._targetEl){var e=this._targetEl;e.removeEventListener(Up,this._onMouseDown,!1),window.removeEventListener(Bp,this._onMouseMove,!1),window.removeEventListener(Gp,this._onMouseUp,!1),e.removeEventListener(Hp,this._onTouchStart,!1),e.removeEventListener(kp,this._onTouchMove,!1),e.removeEventListener(Vp,this._onTouchEnd,!1),this._setCursor(""),this._enabled=!1}},t.sync=function(e){this._xMotion.reset(e.yaw),this._yMotion.reset(e.pitch)},t.setElement=function(e){this._targetEl=e,this.resize(new on(e.offsetWidth,e.offsetHeight))},t._setCursor=function(e){var t=this._targetEl;this._useGrabCursor&&t&&this._enabled&&(t.style.cursor=e)},e}(),rf=function(){function e(e){var r=this,t=void 0===e?{}:e,n=t.element,i=void 0===n?Cp:n,a=t.easing,o=void 0===a?Tp:a,s=t.scale,c=void 0===s?new on(1,1):s,l=t.useGrabCursor,u=void 0===l||l,h=t.scaleToElement,d=void 0===h||h;this._targetEl=null,this._enabled=!1,this._touchInitialized=!1,this._prevPos=new on(0,0),this._screenSize=new on(0,0),this._onMouseDown=function(e){if(e.button===_p.RIGHT){var t=r._targetEl;e.preventDefault(),t.focus?t.focus():window.focus(),r._prevPos.set(e.clientX,e.clientY),window.addEventListener(Bp,r._onMouseMove,!1),window.addEventListener(Gp,r._onMouseUp,!1),r._setCursor(tf)}},this._onMouseMove=function(e){e.preventDefault();var t=r._prevPos,n=new on(e.clientX,e.clientY).sub(t).multiply(r._userScale);r._xMotion.setEndDelta(-n.x),r._yMotion.setEndDelta(n.y),t.set(e.clientX,e.clientY)},this._onMouseUp=function(){r._prevPos.set(0,0),window.removeEventListener(Bp,r._onMouseMove,!1),window.removeEventListener(Gp,r._onMouseUp,!1),r._setCursor(ef)},this._onTouchStart=function(e){2===e.touches.length&&(e.preventDefault(),r._prevPos.copy(r._getTouchesMiddle(e.touches)),r._touchInitialized=!0)},this._onTouchMove=function(e){if(2===e.touches.length){!1!==e.cancelable&&e.preventDefault(),e.stopPropagation();var t=r._prevPos,n=r._getTouchesMiddle(e.touches);if(!r._touchInitialized)return t.copy(n),void(r._touchInitialized=!0);var i=(new on).subVectors(n,t).multiply(r._userScale);r._xMotion.setEndDelta(-i.x),r._yMotion.setEndDelta(i.y),t.copy(n)}},this._onTouchEnd=function(e){2===e.touches.length?(r._prevPos.copy(r._getTouchesMiddle(e.touches)),r._touchInitialized=!0):r._touchInitialized=!1},this._onContextMenu=function(e){e.preventDefault()};var p=cp(i);p&&this.setElement(p),this._xMotion=new Op({duration:0,range:Lp,easing:o}),this._yMotion=new Op({duration:0,range:Lp,easing:o}),this._userScale=c,this._useGrabCursor=u,this._scaleToElement=d}var t=e.prototype;return Object.defineProperty(t,"element",{get:function(){return this._targetEl},enumerable:!1,configurable:!0}),Object.defineProperty(t,"scale",{get:function(){return this._userScale},set:function(e){this._userScale.copy(e)},enumerable:!1,configurable:!0}),Object.defineProperty(t,"useGrabCursor",{get:function(){return this._useGrabCursor},set:function(e){e?(this._useGrabCursor=!0,this._setCursor(ef)):(this._setCursor(""),this._useGrabCursor=!1)},enumerable:!1,configurable:!0}),Object.defineProperty(t,"scaleToElement",{get:function(){return this._scaleToElement},set:function(e){this._scaleToElement=e},enumerable:!1,configurable:!0}),Object.defineProperty(t,"enabled",{get:function(){return this._enabled},enumerable:!1,configurable:!0}),t.destroy=function(){this.disable()},t.update=function(e,t){var n=this._screenSize,i=new on(this._xMotion.update(t),this._yMotion.update(t)),r=new gn(1,0,0).applyQuaternion(e.threeCamera.quaternion),a=new gn(0,1,0).applyQuaternion(e.threeCamera.quaternion);if(this._scaleToElement){var o=new on(e.renderWidth,e.renderHeight).divide(n);i.multiply(o)}e.pivot.add(r.multiplyScalar(i.x)),e.pivot.add(a.multiplyScalar(i.y))},t.resize=function(e){this._screenSize.copy(e)},t.enable=function(){if(!this._enabled){if(!this._targetEl)throw new ap(sp.ADD_CONTROL_FIRST,op.ADD_CONTROL_FIRST);var e=this._targetEl;e.addEventListener(Up,this._onMouseDown,!1),e.addEventListener(Hp,this._onTouchStart,!1),e.addEventListener(kp,this._onTouchMove,!1),e.addEventListener(Vp,this._onTouchEnd,!1),e.addEventListener(qp,this._onContextMenu,!1),this._enabled=!0,this._setCursor(ef)}},t.disable=function(){if(this._enabled&&this._targetEl){var e=this._targetEl;e.removeEventListener(Up,this._onMouseDown,!1),window.removeEventListener(Bp,this._onMouseMove,!1),window.removeEventListener(Gp,this._onMouseUp,!1),e.removeEventListener(Hp,this._onTouchStart,!1),e.removeEventListener(kp,this._onTouchMove,!1),e.removeEventListener(Vp,this._onTouchEnd,!1),e.removeEventListener(qp,this._onContextMenu,!1),this._setCursor(""),this._enabled=!1}},t.sync=function(e){this._xMotion.reset(0),this._yMotion.reset(0)},t.setElement=function(e){this._targetEl=e,this.resize(new on(e.offsetWidth,e.offsetHeight))},t._setCursor=function(e){var t=this._targetEl;this._useGrabCursor&&t&&this._enabled&&(t.style.cursor=e)},t._getTouchesMiddle=function(e){return new on(e[0].clientX+e[1].clientX,e[0].clientY+e[1].clientY).multiplyScalar(.5)},e}(),af=function(){function e(e){var c=this,t=void 0===e?{}:e,n=t.element,i=void 0===n?Cp:n,r=t.duration,a=void 0===r?500:r,o=t.range,s=void 0===o?Pp:o,l=t.easing,u=void 0===l?Tp:l;this._scale=1,this._targetEl=null,this._scaleModifier=.25,this._prevTouchDistance=-1,this._enabled=!1,this._onWheel=function(e){if(0!==e.deltaY){e.preventDefault(),e.stopPropagation();var t=c._motion,n=c._scale*c._scaleModifier*e.deltaY;t.setEndDelta(n)}},this._onTouchMove=function(e){var t=e.touches;if(2===t.length){!1!==e.cancelable&&e.preventDefault(),e.stopPropagation();var n=c._motion,i=c._prevTouchDistance,r=new on(t[0].pageX,t[0].pageY),a=new on(t[1].pageX,t[1].pageY),o=r.sub(a).length()*c._scale*c._scaleModifier,s=-(o-i);c._prevTouchDistance=o,i<0||n.setEndDelta(s)}},this._onTouchEnd=function(){c._prevTouchDistance=-1};var h=cp(i);h&&this.setElement(h),this._motion=new Op({duration:a,range:s,easing:u})}var t=e.prototype;return Object.defineProperty(t,"element",{get:function(){return this._targetEl},enumerable:!1,configurable:!0}),Object.defineProperty(t,"scale",{get:function(){return this._scale},set:function(e){this._scale=e},enumerable:!1,configurable:!0}),Object.defineProperty(t,"enabled",{get:function(){return this._enabled},enumerable:!1,configurable:!0}),t.destroy=function(){this.disable()},t.update=function(e,t){var n=this._motion;e.distance+=n.update(t)},t.resize=function(e){},t.enable=function(){if(!this._enabled){if(!this._targetEl)throw new ap(sp.ADD_CONTROL_FIRST,op.ADD_CONTROL_FIRST);var e=this._targetEl;e.addEventListener(jp,this._onWheel,!1),e.addEventListener(kp,this._onTouchMove,!1),e.addEventListener(Vp,this._onTouchEnd,!1),this._enabled=!0}},t.disable=function(){if(this._enabled&&this._targetEl){var e=this._targetEl;e.removeEventListener(jp,this._onWheel,!1),e.removeEventListener(kp,this._onTouchMove,!1),e.removeEventListener(Vp,this._onTouchEnd,!1),this._enabled=!1}},t.sync=function(e){this._motion.range.min=e.minDistance,this._motion.range.max=e.maxDistance,this._motion.reset(e.distance)},t.setElement=function(e){this._targetEl=e},e}(),of={__proto__:null,AnimationControl:Dp,AutoControl:$p,Motion:Op,OrbitControl:function(){function e(e){var t=void 0===e?{}:e,n=t.element,i=void 0===n?Cp:n,r=t.rotate,a=void 0===r?{}:r,o=t.translate,s=void 0===o?{}:o,c=t.distance,l=void 0===c?{}:c;this._enabled=!1,this._targetEl=cp(i),this._rotateControl=new nf(p(p({},a),{element:a.element||this._targetEl})),this._translateControl=new rf(p(p({},s),{element:s.element||this._targetEl})),this._distanceControl=new af(p(p({},l),{element:l.element||this._targetEl}))}var t=e.prototype;return Object.defineProperty(t,"element",{get:function(){return this._targetEl},enumerable:!1,configurable:!0}),Object.defineProperty(t,"enabled",{get:function(){return this._enabled},enumerable:!1,configurable:!0}),Object.defineProperty(t,"rotate",{get:function(){return this._rotateControl},enumerable:!1,configurable:!0}),Object.defineProperty(t,"translate",{get:function(){return this._translateControl},enumerable:!1,configurable:!0}),Object.defineProperty(t,"distance",{get:function(){return this._distanceControl},enumerable:!1,configurable:!0}),t.destroy=function(){this._rotateControl.destroy(),this._translateControl.destroy(),this._distanceControl.destroy()},t.update=function(e,t){this._rotateControl.update(e,t),this._translateControl.update(e,t),this._distanceControl.update(e,t)},t.resize=function(e){this._rotateControl.resize(e),this._translateControl.resize(e),this._distanceControl.resize(e)},t.enable=function(){if(!this._enabled){if(!this._targetEl)throw new ap(sp.ADD_CONTROL_FIRST,op.ADD_CONTROL_FIRST);this._rotateControl.enable(),this._translateControl.enable(),this._distanceControl.enable(),this._enabled=!0}},t.disable=function(){this._enabled&&this._targetEl&&(this._rotateControl.disable(),this._translateControl.disable(),this._distanceControl.disable(),this._enabled=!1)},t.sync=function(e){this._rotateControl.sync(e),this._translateControl.sync(e),this._distanceControl.sync(e)},t.setElement=function(e){this._targetEl=e,this._rotateControl.setElement(e),this._translateControl.setElement(e),this._distanceControl.setElement(e)},e}(),RotateControl:nf,TranslateControl:rf,DistanceControl:af};Zp.prototype=J(Object.create(Ql.prototype),{constructor:Zp,setDecoderPath:function(e){return this.decoderPath=e,this},setDecoderConfig:function(e){return this.decoderConfig=e,this},setWorkerLimit:function(e){return this.workerLimit=e,this},setVerbosity:function(){console.warn("THREE.DRACOLoader: The .setVerbosity() method has been removed.")},setDrawMode:function(){console.warn("THREE.DRACOLoader: The .setDrawMode() method has been removed.")},setSkipDequantization:function(){console.warn("THREE.DRACOLoader: The .setSkipDequantization() method has been removed.")},load:function(e,n,t,i){var r=this,a=new eu(this.manager);a.setPath(this.path),a.setResponseType("arraybuffer"),"use-credentials"===this.crossOrigin&&a.setWithCredentials(!0),a.load(e,function(e){var t={attributeIDs:r.defaultAttributeIDs,attributeTypes:r.defaultAttributeTypes,useUniqueIDs:!1};r.decodeGeometry(e,t).then(n).catch(i)},t,i)},decodeDracoFile:function(e,t,n,i){var r={attributeIDs:n||this.defaultAttributeIDs,attributeTypes:i||this.defaultAttributeTypes,useUniqueIDs:!!n};this.decodeGeometry(e,r).then(t)},decodeGeometry:function(n,i){var t=this;for(var e in i.attributeTypes){var r=i.attributeTypes[e];void 0!==r.BYTES_PER_ELEMENT&&(i.attributeTypes[e]=r.name)}var a,o=JSON.stringify(i);if(Zp.taskCache.has(n)){var s=Zp.taskCache.get(n);if(s.key===o)return s.promise;if(0===n.byteLength)throw new Error("THREE.DRACOLoader: Unable to re-decode a buffer with different settings. Buffer has already been transferred.")}var c=this.workerNextTaskID++,l=n.byteLength,u=this._getWorker(c,l).then(function(e){return a=e,new Promise(function(e,t){a._callbacks[c]={resolve:e,reject:t},a.postMessage({type:"decode",id:c,taskConfig:i,buffer:n},[n])})}).then(function(e){return t._createGeometry(e.geometry)});return u.finally(function(){a&&c&&t._releaseTask(a,c)}),Zp.taskCache.set(n,{key:o,promise:u}),u},_createGeometry:function(e){var t=new cr;e.index&&t.setIndex(new Vi(e.index.array,1));for(var n=0;n<e.attributes.length;n++){var i=e.attributes[n],r=i.name,a=i.array,o=i.itemSize;t.setAttribute(r,new Vi(a,o))}return t},_loadLibrary:function(n,e){var i=new eu(this.manager);return i.setPath(this.decoderPath),i.setResponseType(e),new Promise(function(e,t){i.load(n,e,void 0,t)})},preload:function(){return this._initDecoder(),this},_initDecoder:function(){var r=this;if(this.decoderPending)return this.decoderPending;var a="object"!=typeof WebAssembly||"js"===this.decoderConfig.type,e=[];return a?e.push(this._loadLibrary("draco_decoder.js","text")):(e.push(this._loadLibrary("draco_wasm_wrapper.js","text")),e.push(this._loadLibrary("draco_decoder.wasm","arraybuffer"))),this.decoderPending=Promise.all(e).then(function(e){var t=e[0];a||(r.decoderConfig.wasmBinary=e[1]);var n=Zp.DRACOWorker.toString(),i=["/* draco decoder */",t,"","/* worker */",n.substring(n.indexOf("{")+1,n.lastIndexOf("}"))].join("\n");r.workerSourceURL=URL.createObjectURL(new Blob([i]))}),this.decoderPending},_getWorker:function(e,t){var i=this;return this._initDecoder().then(function(){var n;i.workerPool.length<i.workerLimit?((n=new Worker(i.workerSourceURL))._callbacks={},n._taskCosts={},n._taskLoad=0,n.postMessage({type:"init",decoderConfig:i.decoderConfig}),n.onmessage=function(e){var t=e.data;switch(t.type){case"decode":n._callbacks[t.id].resolve(t);break;case"error":n._callbacks[t.id].reject(t);break;default:console.error('THREE.DRACOLoader: Unexpected message, "'+t.type+'"')}},i.workerPool.push(n)):i.workerPool.sort(function(e,t){return e._taskLoad>t._taskLoad?-1:1});return(n=i.workerPool[i.workerPool.length-1])._taskCosts[e]=t,n._taskLoad+=t,n})},_releaseTask:function(e,t){e._taskLoad-=e._taskCosts[t],delete e._callbacks[t],delete e._taskCosts[t]},debug:function(){console.log("Task load: ",this.workerPool.map(function(e){return e._taskLoad}))},dispose:function(){for(var e=0;e<this.workerPool.length;++e)this.workerPool[e].terminate();return this.workerPool.length=0,this}}),Zp.DRACOWorker=function(){var n,t;function _(e,t,n,i,r,a){var o,s,c=a.num_components(),l=n.num_points()*c;switch(r){case Float32Array:o=new e.DracoFloat32Array,t.GetAttributeFloatForAllPoints(n,a,o),s=new Float32Array(l);break;case Int8Array:o=new e.DracoInt8Array,t.GetAttributeInt8ForAllPoints(n,a,o),s=new Int8Array(l);break;case Int16Array:o=new e.DracoInt16Array,t.GetAttributeInt16ForAllPoints(n,a,o),s=new Int16Array(l);break;case Int32Array:o=new e.DracoInt32Array,t.GetAttributeInt32ForAllPoints(n,a,o),s=new Int32Array(l);break;case Uint8Array:o=new e.DracoUInt8Array,t.GetAttributeUInt8ForAllPoints(n,a,o),s=new Uint8Array(l);break;case Uint16Array:o=new e.DracoUInt16Array,t.GetAttributeUInt16ForAllPoints(n,a,o),s=new Uint16Array(l);break;case Uint32Array:o=new e.DracoUInt32Array,t.GetAttributeUInt32ForAllPoints(n,a,o),s=new Uint32Array(l);break;default:throw new Error("THREE.DRACOLoader: Unexpected attribute type.")}for(var u=0;u<l;u++)s[u]=o.GetValue(u);return e.destroy(o),{name:i,array:s,itemSize:c}}onmessage=function(e){var o=e.data;switch(o.type){case"init":n=o.decoderConfig,t=new Promise(function(t){n.onModuleLoaded=function(e){t({draco:e})},DracoDecoderModule(n)});break;case"decode":var s=o.buffer,c=o.taskConfig;t.then(function(e){var t=e.draco,n=new t.Decoder,i=new t.DecoderBuffer;i.Init(new Int8Array(s),s.byteLength);try{var r=function(e,t,n,i){var r,a,o=i.attributeIDs,s=i.attributeTypes,c=t.GetEncodedGeometryType(n);if(c===e.TRIANGULAR_MESH)r=new e.Mesh,a=t.DecodeBufferToMesh(n,r);else{if(c!==e.POINT_CLOUD)throw new Error("THREE.DRACOLoader: Unexpected geometry type.");r=new e.PointCloud,a=t.DecodeBufferToPointCloud(n,r)}if(!a.ok()||0===r.ptr)throw new Error("THREE.DRACOLoader: Decoding failed: "+a.error_msg());var l={index:null,attributes:[]};for(var u in o){var h,d,p=self[s[u]];if(i.useUniqueIDs)d=o[u],h=t.GetAttributeByUniqueId(r,d);else{if(-1===(d=t.GetAttributeId(r,e[o[u]])))continue;h=t.GetAttribute(r,d)}l.attributes.push(_(e,t,r,u,p,h))}if(c===e.TRIANGULAR_MESH){for(var f=r.num_faces(),m=new Uint32Array(3*f),v=new e.DracoInt32Array,g=0;g<f;++g){t.GetFaceFromMesh(r,g,v);for(var y=0;y<3;++y)m[3*g+y]=v.GetValue(y)}l.index={array:m,itemSize:1},e.destroy(v)}return e.destroy(r),l}(t,n,i,c),a=r.attributes.map(function(e){return e.array.buffer});r.index&&a.push(r.index.array.buffer),self.postMessage({type:"decode",id:o.id,geometry:r},a)}catch(e){console.error(e),self.postMessage({type:"error",id:o.id,error:e.message})}finally{t.destroy(i),t.destroy(n)}})}}},Zp.taskCache=new WeakMap,Zp.setDecoderPath=function(){console.warn("THREE.DRACOLoader: The .setDecoderPath() method has been removed. Use instance methods.")},Zp.setDecoderConfig=function(){console.warn("THREE.DRACOLoader: The .setDecoderConfig() method has been removed. Use instance methods.")},Zp.releaseDecoderModule=function(){console.warn("THREE.DRACOLoader: The .releaseDecoderModule() method has been removed. Use instance methods.")},Zp.getDecoderModule=function(){console.warn("THREE.DRACOLoader: The .getDecoderModule() method has been removed. Use instance methods.")};function sf(e){iu.call(this,e),this.type=Ye}var cf=function(){function e(){}var t=e.prototype;return t.load=function(e,i){var r=this;void 0===i&&(i={});var a=new Zp;return a.setCrossOrigin("anonymous"),a.setDecoderPath(Ip),a.manager=new Jl,new Promise(function(n,t){a.load(e,function(e){var t=r._parseToModel(e,i);a.dispose(),n(t)},void 0,function(e){a.dispose(),t(e)})})},t._parseToModel=function(e,t){var n=void 0===t?{}:t,i=n.fixSkinnedBbox,r=void 0!==i&&i,a=n.color,o=void 0===a?16777215:a,s=n.point,c=void 0!==s&&s,l=n.pointOptions,u=void 0===l?{}:l;e.computeVertexNormals();var h=c?new Qs(p({color:o},u)):new Tl({color:o}),d=new(c?ic:Er)(e,h);return new Kp({scenes:[d],fixSkinnedBbox:r})},e}(),lf=function(){function e(e){Ql.call(this,e),this.dracoLoader=null,this.ddsLoader=null}function i(){var n={};return{get:function(e){return n[e]},add:function(e,t){n[e]=t},remove:function(e){delete n[e]},removeAll:function(){n={}}}}e.prototype=J(Object.create(Ql.prototype),{constructor:e,load:function(t,n,e,i){var r,a=this;r=""!==this.resourcePath?this.resourcePath:""!==this.path?this.path:Wu.extractUrlBase(t),a.manager.itemStart(t);function o(e){i?i(e):console.error(e),a.manager.itemError(t),a.manager.itemEnd(t)}var s=new eu(a.manager);s.setPath(this.path),s.setResponseType("arraybuffer"),"use-credentials"===a.crossOrigin&&s.setWithCredentials(!0),s.load(t,function(e){try{a.parse(e,r,function(e){n(e),a.manager.itemEnd(t)},o)}catch(e){o(e)}},e,o)},setDRACOLoader:function(e){return this.dracoLoader=e,this},setDDSLoader:function(e){return this.ddsLoader=e,this},parse:function(e,t,n,i){var r,a={};if("string"==typeof e)r=e;else if(Wu.decodeText(new Uint8Array(e,0,4))===m){try{a[f.KHR_BINARY_GLTF]=new v(e)}catch(e){return void(i&&i(e))}r=a[f.KHR_BINARY_GLTF].content}else r=Wu.decodeText(new Uint8Array(e));var o=JSON.parse(r);if(void 0===o.asset||o.asset.version[0]<2)i&&i(new Error("THREE.GLTFLoader: Unsupported asset. glTF versions >=2.0 are supported."));else{if(o.extensionsUsed)for(var s=0;s<o.extensionsUsed.length;++s){var c=o.extensionsUsed[s],l=o.extensionsRequired||[];switch(c){case f.KHR_LIGHTS_PUNCTUAL:a[c]=new h(o);break;case f.KHR_MATERIALS_CLEARCOAT:a[c]=new p;break;case f.KHR_MATERIALS_UNLIT:a[c]=new d;break;case f.KHR_MATERIALS_PBR_SPECULAR_GLOSSINESS:a[c]=new x;break;case f.KHR_DRACO_MESH_COMPRESSION:a[c]=new g(o,this.dracoLoader);break;case f.MSFT_TEXTURE_DDS:a[c]=new u(this.ddsLoader);break;case f.KHR_TEXTURE_TRANSFORM:a[c]=new y;break;case f.KHR_MESH_QUANTIZATION:a[c]=new b;break;default:0<=l.indexOf(c)&&console.warn('THREE.GLTFLoader: Unknown extension "'+c+'".')}}new q(o,a,{path:t||this.resourcePath||"",crossOrigin:this.crossOrigin,manager:this.manager}).parse(n,i)}}});var f={KHR_BINARY_GLTF:"KHR_binary_glTF",KHR_DRACO_MESH_COMPRESSION:"KHR_draco_mesh_compression",KHR_LIGHTS_PUNCTUAL:"KHR_lights_punctual",KHR_MATERIALS_CLEARCOAT:"KHR_materials_clearcoat",KHR_MATERIALS_PBR_SPECULAR_GLOSSINESS:"KHR_materials_pbrSpecularGlossiness",KHR_MATERIALS_UNLIT:"KHR_materials_unlit",KHR_TEXTURE_TRANSFORM:"KHR_texture_transform",KHR_MESH_QUANTIZATION:"KHR_mesh_quantization",MSFT_TEXTURE_DDS:"MSFT_texture_dds"};function u(e){if(!e)throw new Error("THREE.GLTFLoader: Attempting to load .dds texture without importing DDSLoader");this.name=f.MSFT_TEXTURE_DDS,this.ddsLoader=e}function h(e){this.name=f.KHR_LIGHTS_PUNCTUAL;var t=e.extensions&&e.extensions[f.KHR_LIGHTS_PUNCTUAL]||{};this.lightDefs=t.lights||[]}function d(){this.name=f.KHR_MATERIALS_UNLIT}function p(){this.name=f.KHR_MATERIALS_CLEARCOAT}h.prototype.loadLight=function(e){var t,n=this.lightDefs[e],i=new Di(16777215);void 0!==n.color&&i.fromArray(n.color);var r=void 0!==n.range?n.range:0;switch(n.type){case"directional":(t=new Bu(i)).target.position.set(0,0,-1),t.add(t.target);break;case"point":(t=new Fu(i)).distance=r;break;case"spot":(t=new Du(i)).distance=r,n.spot=n.spot||{},n.spot.innerConeAngle=void 0!==n.spot.innerConeAngle?n.spot.innerConeAngle:0,n.spot.outerConeAngle=void 0!==n.spot.outerConeAngle?n.spot.outerConeAngle:Math.PI/4,t.angle=n.spot.outerConeAngle,t.penumbra=1-n.spot.innerConeAngle/n.spot.outerConeAngle,t.target.position.set(0,0,-1),t.add(t.target);break;default:throw new Error('THREE.GLTFLoader: Unexpected light type, "'+n.type+'".')}return t.position.set(0,0,0),t.decay=2,void 0!==n.intensity&&(t.intensity=n.intensity),t.name=n.name||"light_"+e,Promise.resolve(t)},d.prototype.getMaterialType=function(){return Hi},d.prototype.extendParams=function(e,t,n){var i=[];e.color=new Di(1,1,1),e.opacity=1;var r=t.pbrMetallicRoughness;if(r){if(Array.isArray(r.baseColorFactor)){var a=r.baseColorFactor;e.color.fromArray(a),e.opacity=a[3]}void 0!==r.baseColorTexture&&i.push(n.assignTexture(e,"map",r.baseColorTexture))}return Promise.all(i)},p.prototype.getMaterialType=function(){return El},p.prototype.extendParams=function(e,t,n){var i=[],r=t.extensions[this.name];if(void 0!==r.clearcoatFactor&&(e.clearcoat=r.clearcoatFactor),void 0!==r.clearcoatTexture&&i.push(n.assignTexture(e,"clearcoatMap",r.clearcoatTexture)),void 0!==r.clearcoatRoughnessFactor&&(e.clearcoatRoughness=r.clearcoatRoughnessFactor),void 0!==r.clearcoatRoughnessTexture&&i.push(n.assignTexture(e,"clearcoatRoughnessMap",r.clearcoatRoughnessTexture)),void 0!==r.clearcoatNormalTexture&&(i.push(n.assignTexture(e,"clearcoatNormalMap",r.clearcoatNormalTexture)),void 0!==r.clearcoatNormalTexture.scale)){var a=r.clearcoatNormalTexture.scale;e.clearcoatNormalScale=new on(a,a)}return Promise.all(i)};var m="glTF",c=12,l={JSON:1313821514,BIN:5130562};function v(e){this.name=f.KHR_BINARY_GLTF,this.content=null,this.body=null;var t=new DataView(e,0,c);if(this.header={magic:Wu.decodeText(new Uint8Array(e.slice(0,4))),version:t.getUint32(4,!0),length:t.getUint32(8,!0)},this.header.magic!==m)throw new Error("THREE.GLTFLoader: Unsupported glTF-Binary header.");if(this.header.version<2)throw new Error("THREE.GLTFLoader: Legacy binary file detected.");for(var n=new DataView(e,c),i=0;i<n.byteLength;){var r=n.getUint32(i,!0);i+=4;var a=n.getUint32(i,!0);if(i+=4,a===l.JSON){var o=new Uint8Array(e,c+i,r);this.content=Wu.decodeText(o)}else if(a===l.BIN){var s=c+i;this.body=e.slice(s,s+r)}i+=r}if(null===this.content)throw new Error("THREE.GLTFLoader: JSON content not found.")}function g(e,t){if(!t)throw new Error("THREE.GLTFLoader: No DRACOLoader instance provided.");this.name=f.KHR_DRACO_MESH_COMPRESSION,this.json=e,this.dracoLoader=t,this.dracoLoader.preload()}function y(){this.name=f.KHR_TEXTURE_TRANSFORM}function _(e){Tl.call(this),this.isGLTFSpecularGlossinessMaterial=!0;var n=["#ifdef USE_SPECULARMAP","\tuniform sampler2D specularMap;","#endif"].join("\n"),i=["#ifdef USE_GLOSSINESSMAP","\tuniform sampler2D glossinessMap;","#endif"].join("\n"),r=["vec3 specularFactor = specular;","#ifdef USE_SPECULARMAP","\tvec4 texelSpecular = texture2D( specularMap, vUv );","\ttexelSpecular = sRGBToLinear( texelSpecular );","\t// reads channel RGB, compatible with a glTF Specular-Glossiness (RGBA) texture","\tspecularFactor *= texelSpecular.rgb;","#endif"].join("\n"),a=["float glossinessFactor = glossiness;","#ifdef USE_GLOSSINESSMAP","\tvec4 texelGlossiness = texture2D( glossinessMap, vUv );","\t// reads channel A, compatible with a glTF Specular-Glossiness (RGBA) texture","\tglossinessFactor *= texelGlossiness.a;","#endif"].join("\n"),o=["PhysicalMaterial material;","material.diffuseColor = diffuseColor.rgb;","vec3 dxy = max( abs( dFdx( geometryNormal ) ), abs( dFdy( geometryNormal ) ) );","float geometryRoughness = max( max( dxy.x, dxy.y ), dxy.z );","material.specularRoughness = max( 1.0 - glossinessFactor, 0.0525 );// 0.0525 corresponds to the base mip of a 256 cubemap.","material.specularRoughness += geometryRoughness;","material.specularRoughness = min( material.specularRoughness, 1.0 );","material.specularColor = specularFactor.rgb;"].join("\n"),s={specular:{value:(new Di).setHex(16777215)},glossiness:{value:1},specularMap:{value:null},glossinessMap:{value:null}};this._extraUniforms=s,this.onBeforeCompile=function(e){for(var t in s)e.uniforms[t]=s[t];e.fragmentShader=e.fragmentShader.replace("uniform float roughness;","uniform vec3 specular;"),e.fragmentShader=e.fragmentShader.replace("uniform float metalness;","uniform float glossiness;"),e.fragmentShader=e.fragmentShader.replace("#include <roughnessmap_pars_fragment>",n),e.fragmentShader=e.fragmentShader.replace("#include <metalnessmap_pars_fragment>",i),e.fragmentShader=e.fragmentShader.replace("#include <roughnessmap_fragment>",r),e.fragmentShader=e.fragmentShader.replace("#include <metalnessmap_fragment>",a),e.fragmentShader=e.fragmentShader.replace("#include <lights_physical_fragment>",o)},Object.defineProperties(this,{specular:{get:function(){return s.specular.value},set:function(e){s.specular.value=e}},specularMap:{get:function(){return s.specularMap.value},set:function(e){s.specularMap.value=e}},glossiness:{get:function(){return s.glossiness.value},set:function(e){s.glossiness.value=e}},glossinessMap:{get:function(){return s.glossinessMap.value},set:function(e){(s.glossinessMap.value=e)?(this.defines.USE_GLOSSINESSMAP="",this.defines.USE_ROUGHNESSMAP=""):(delete this.defines.USE_ROUGHNESSMAP,delete this.defines.USE_GLOSSINESSMAP)}}}),delete this.metalness,delete this.roughness,delete this.metalnessMap,delete this.roughnessMap,this.setValues(e)}function x(){return{name:f.KHR_MATERIALS_PBR_SPECULAR_GLOSSINESS,specularGlossinessParams:["color","map","lightMap","lightMapIntensity","aoMap","aoMapIntensity","emissive","emissiveIntensity","emissiveMap","bumpMap","bumpScale","normalMap","normalMapType","displacementMap","displacementScale","displacementBias","specularMap","specular","glossinessMap","glossiness","alphaMap","envMap","envMapIntensity","refractionRatio"],getMaterialType:function(){return _},extendParams:function(e,t,n){var i=t.extensions[this.name];e.color=new Di(1,1,1),e.opacity=1;var r=[];if(Array.isArray(i.diffuseFactor)){var a=i.diffuseFactor;e.color.fromArray(a),e.opacity=a[3]}if(void 0!==i.diffuseTexture&&r.push(n.assignTexture(e,"map",i.diffuseTexture)),e.emissive=new Di(0,0,0),e.glossiness=void 0!==i.glossinessFactor?i.glossinessFactor:1,e.specular=new Di(1,1,1),Array.isArray(i.specularFactor)&&e.specular.fromArray(i.specularFactor),void 0!==i.specularGlossinessTexture){var o=i.specularGlossinessTexture;r.push(n.assignTexture(e,"glossinessMap",o)),r.push(n.assignTexture(e,"specularMap",o))}return Promise.all(r)},createMaterial:function(e){var t=new _(e);return t.fog=!0,t.color=e.color,t.map=void 0===e.map?null:e.map,t.lightMap=null,t.lightMapIntensity=1,t.aoMap=void 0===e.aoMap?null:e.aoMap,t.aoMapIntensity=1,t.emissive=e.emissive,t.emissiveIntensity=1,t.emissiveMap=void 0===e.emissiveMap?null:e.emissiveMap,t.bumpMap=void 0===e.bumpMap?null:e.bumpMap,t.bumpScale=1,t.normalMap=void 0===e.normalMap?null:e.normalMap,t.normalMapType=Yt,e.normalScale&&(t.normalScale=e.normalScale),t.displacementMap=null,t.displacementScale=1,t.displacementBias=0,t.specularMap=void 0===e.specularMap?null:e.specularMap,t.specular=e.specular,t.glossinessMap=void 0===e.glossinessMap?null:e.glossinessMap,t.glossiness=e.glossiness,t.alphaMap=null,t.envMap=void 0===e.envMap?null:e.envMap,t.envMapIntensity=1,t.refractionRatio=.98,t}}}function b(){this.name=f.KHR_MESH_QUANTIZATION}function E(e,t,n,i){Nl.call(this,e,t,n,i)}g.prototype.decodePrimitive=function(e,t){var n=this.json,i=this.dracoLoader,r=e.extensions[this.name].bufferView,a=e.extensions[this.name].attributes,o={},s={},c={};for(var l in a){var u=D[l]||l.toLowerCase();o[u]=a[l]}for(l in e.attributes){u=D[l]||l.toLowerCase();if(void 0!==a[l]){var h=n.accessors[e.attributes[l]],d=P[h.componentType];c[u]=d,s[u]=!0===h.normalized}}return t.getDependency("bufferView",r).then(function(e){return new Promise(function(r){i.decodeDracoFile(e,function(e){for(var t in e.attributes){var n=e.attributes[t],i=s[t];void 0!==i&&(n.normalized=i)}r(e)},o,c)})})},y.prototype.extendTexture=function(e,t){return e=e.clone(),void 0!==t.offset&&e.offset.fromArray(t.offset),void 0!==t.rotation&&(e.rotation=t.rotation),void 0!==t.scale&&e.repeat.fromArray(t.scale),void 0!==t.texCoord&&console.warn('THREE.GLTFLoader: Custom UV sets in "'+this.name+'" extension not yet supported.'),e.needsUpdate=!0,e},((_.prototype=Object.create(Tl.prototype)).constructor=_).prototype.copy=function(e){return Tl.prototype.copy.call(this,e),this.specularMap=e.specularMap,this.specular.copy(e.specular),this.glossinessMap=e.glossinessMap,this.glossiness=e.glossiness,delete this.metalness,delete this.roughness,delete this.metalnessMap,delete this.roughnessMap,this},((E.prototype=Object.create(Nl.prototype)).constructor=E).prototype.beforeStart_=E.prototype.copySampleValue_=function(e){for(var t=this.resultBuffer,n=this.sampleValues,i=this.valueSize,r=e*i*3+i,a=0;a!==i;a++)t[a]=n[r+a];return t},E.prototype.afterEnd_=E.prototype.copySampleValue_,E.prototype.interpolate_=function(e,t,n,i){for(var r=this.resultBuffer,a=this.sampleValues,o=this.valueSize,s=2*o,c=3*o,l=i-t,u=(n-t)/l,h=u*u,d=h*u,p=e*c,f=p-c,m=-2*d+3*h,v=d-h,g=1-m,y=v-h+u,_=0;_!==o;_++){var x=a[f+_+o],b=a[f+_+s]*l,w=a[p+_+o],M=a[p+_]*l;r[_]=g*x+y*b+m*w+v*M}return r};var w=0,M=1,S=2,T=3,A=4,L=5,R=6,P={5120:Int8Array,5121:Uint8Array,5122:Int16Array,5123:Uint16Array,5125:Uint32Array,5126:Float32Array},C={9728:ke,9729:We,9984:Ve,9985:qe,9986:je,9987:Xe},I={33071:Ge,33648:He,10497:Be},O={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16},D={POSITION:"position",NORMAL:"normal",TANGENT:"tangent",TEXCOORD_0:"uv",TEXCOORD_1:"uv2",COLOR_0:"color",WEIGHTS_0:"skinWeight",JOINTS_0:"skinIndex"},N={scale:"scale",translation:"position",rotation:"quaternion",weights:"morphTargetInfluences"},F={CUBICSPLINE:void 0,LINEAR:Dt,STEP:Ot},z="OPAQUE",U="MASK",B="BLEND",G={"image/png":tt,"image/jpeg":et};function H(e,t){return"string"!=typeof e||""===e?"":(/^https?:\/\//i.test(t)&&/^\//.test(e)&&(t=t.replace(/(^https?:\/\/[^\/]+).*/i,"$1")),/^(https?:)?\/\
|