parcelRequire=function(e,r,t,n){var i,o="function"==typeof parcelRequire&&parcelRequire,u="function"==typeof require&&require;function f(t,n){if(!r[t]){if(!e[t]){var i="function"==typeof parcelRequire&&parcelRequire;if(!n&&i)return i(t,!0);if(o)return o(t,!0);if(u&&"string"==typeof t)return u(t);var c=new Error("Cannot find module '"+t+"'");throw c.code="MODULE_NOT_FOUND",c}p.resolve=function(r){return e[t][1][r]||r},p.cache={};var l=r[t]=new f.Module(t);e[t][0].call(l.exports,p,l,l.exports,this)}return r[t].exports;function p(e){return f(p.resolve(e))}}f.isParcelRequire=!0,f.Module=function(e){this.id=e,this.bundle=f,this.exports={}},f.modules=e,f.cache=r,f.parent=o,f.register=function(r,t){e[r]=[function(e,r){r.exports=t},{}]};for(var c=0;c=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function(e){throw e},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var a,o=!0,s=!1;return{s:function(){n=n.call(e)},n:function(){var e=n.next();return o=e.done,e},e:function(e){s=!0,a=e},f:function(){try{o||null==n.return||n.return()}finally{if(s)throw a}}}}function l(e,t){return p(e)||d(e,t)||c(e,t)||u()}function u(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function c(e,t){if(e){if("string"==typeof e)return h(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?h(e,t):void 0}}function h(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n=0;--a){var o=this.tryEntries[a],s=o.completion;if("root"===o.tryLoc)return i("end");if(o.tryLoc<=this.prev){var l=r.call(o,"catchLoc"),u=r.call(o,"finallyLoc");if(l&&u){if(this.prev=0;--n){var i=this.tryEntries[n];if(i.tryLoc<=this.prev&&r.call(i,"finallyLoc")&&this.prev=0;--t){var n=this.tryEntries[t];if(n.finallyLoc===e)return this.complete(n.completion,n.afterLoc),R(n),m}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.tryLoc===e){var r=n.completion;if("throw"===r.type){var i=r.arg;R(n)}return i}}throw new Error("illegal catch attempt")},delegateYield:function(t,n,r){return this.delegate={iterator:I(t),resultName:n,nextLoc:r},"next"===this.method&&(this.arg=e),m}},t}function T(e){return(T="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function A(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function k(e,t){for(var n=0;n>8&255]+jn[e>>16&255]+jn[e>>24&255]+"-"+jn[255&t]+jn[t>>8&255]+"-"+jn[t>>16&15|64]+jn[t>>24&255]+"-"+jn[63&n|128]+jn[n>>8&255]+"-"+jn[n>>16&255]+jn[n>>24&255]+jn[255&r]+jn[r>>8&255]+jn[r>>16&255]+jn[r>>24&255]).toLowerCase()}function Jn(e,t,n){return Math.max(t,Math.min(n,e))}function Kn(e,t){return(e%t+t)%t}function Qn(e,t,n,r,i){return r+(e-t)*(i-r)/(n-t)}function $n(e,t,n){return e!==t?(n-e)/(t-e):0}function er(e,t,n){return(1-n)*e+n*t}function tr(e,t,n,r){return er(e,t,1-Math.exp(-n*r))}function nr(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;return t-Math.abs(Kn(e,2*t)-t)}function rr(e,t,n){return e<=t?0:e>=n?1:(e=(e-t)/(n-t))*e*(3-2*e)}function ir(e,t,n){return e<=t?0:e>=n?1:(e=(e-t)/(n-t))*e*e*(e*(6*e-15)+10)}function ar(e,t){return e+Math.floor(Math.random()*(t-e+1))}function or(e,t){return e+Math.random()*(t-e)}function sr(e){return e*(.5-Math.random())}function lr(e){void 0!==e&&(qn=e);var t=qn+=1831565813;return t=Math.imul(t^t>>>15,1|t),(((t^=t+Math.imul(t^t>>>7,61|t))^t>>>14)>>>0)/4294967296}function ur(e){return e*Xn}function cr(e){return e*Yn}function hr(e){return 0==(e&e-1)&&0!==e}function dr(e){return Math.pow(2,Math.ceil(Math.log(e)/Math.LN2))}function pr(e){return Math.pow(2,Math.floor(Math.log(e)/Math.LN2))}function fr(e,t,n,r,i){var a=Math.cos,o=Math.sin,s=a(n/2),l=o(n/2),u=a((t+r)/2),c=o((t+r)/2),h=a((t-r)/2),d=o((t-r)/2),p=a((r-t)/2),f=o((r-t)/2);switch(i){case"XYX":e.set(s*c,l*h,l*d,s*u);break;case"YZY":e.set(l*d,s*c,l*h,s*u);break;case"ZXZ":e.set(l*h,l*d,s*c,s*u);break;case"XZX":e.set(s*c,l*f,l*p,s*u);break;case"YXY":e.set(l*p,s*c,l*f,s*u);break;case"ZYZ":e.set(l*f,l*p,s*c,s*u);break;default:console.warn("THREE.MathUtils: .setQuaternionFromProperEuler() encountered an unknown order: "+i)}}function vr(e,t){switch(t.constructor){case Float32Array:return e;case Uint16Array:return e/65535;case Uint8Array:return e/255;case Int16Array:return Math.max(e/32767,-1);case Int8Array:return Math.max(e/127,-1);default:throw new Error("Invalid component type.")}}function mr(e,t){switch(t.constructor){case Float32Array:return e;case Uint16Array:return Math.round(65535*e);case Uint8Array:return Math.round(255*e);case Int16Array:return Math.round(32767*e);case Int8Array:return Math.round(127*e);default:throw new Error("Invalid component type.")}}var gr=exports.MathUtils=Object.freeze({__proto__:null,DEG2RAD:Xn,RAD2DEG:Yn,generateUUID:Zn,clamp:Jn,euclideanModulo:Kn,mapLinear:Qn,inverseLerp:$n,lerp:er,damp:tr,pingpong:nr,smoothstep:rr,smootherstep:ir,randInt:ar,randFloat:or,randFloatSpread:sr,seededRandom:lr,degToRad:ur,radToDeg:cr,isPowerOfTwo:hr,ceilPowerOfTwo:dr,floorPowerOfTwo:pr,setQuaternionFromProperEuler:fr,normalize:mr,denormalize:vr}),yr=exports.Vector2=function(e){function t(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;A(this,t),t.prototype.isVector2=!0,this.x=e,this.y=n}return E(t,[{key:"width",get:function(){return this.x},set:function(e){this.x=e}},{key:"height",get:function(){return this.y},set:function(e){this.y=e}},{key:"set",value:function(e,t){return this.x=e,this.y=t,this}},{key:"setScalar",value:function(e){return this.x=e,this.y=e,this}},{key:"setX",value:function(e){return this.x=e,this}},{key:"setY",value:function(e){return this.y=e,this}},{key:"setComponent",value: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}},{key:"getComponent",value:function(e){switch(e){case 0:return this.x;case 1:return this.y;default:throw new Error("index is out of range: "+e)}}},{key:"clone",value:function(){return new this.constructor(this.x,this.y)}},{key:"copy",value:function(e){return this.x=e.x,this.y=e.y,this}},{key:"add",value: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)}},{key:"addScalar",value:function(e){return this.x+=e,this.y+=e,this}},{key:"addVectors",value:function(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this}},{key:"addScaledVector",value:function(e,t){return this.x+=e.x*t,this.y+=e.y*t,this}},{key:"sub",value: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)}},{key:"subScalar",value:function(e){return this.x-=e,this.y-=e,this}},{key:"subVectors",value:function(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this}},{key:"multiply",value:function(e){return this.x*=e.x,this.y*=e.y,this}},{key:"multiplyScalar",value:function(e){return this.x*=e,this.y*=e,this}},{key:"divide",value:function(e){return this.x/=e.x,this.y/=e.y,this}},{key:"divideScalar",value:function(e){return this.multiplyScalar(1/e)}},{key:"applyMatrix3",value:function(e){var t=this.x,n=this.y,r=e.elements;return this.x=r[0]*t+r[3]*n+r[6],this.y=r[1]*t+r[4]*n+r[7],this}},{key:"min",value:function(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this}},{key:"max",value:function(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this}},{key:"clamp",value: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}},{key:"clampScalar",value: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}},{key:"clampLength",value:function(e,t){var n=this.length();return this.divideScalar(n||1).multiplyScalar(Math.max(e,Math.min(t,n)))}},{key:"floor",value:function(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this}},{key:"ceil",value:function(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this}},{key:"round",value:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}},{key:"roundToZero",value: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}},{key:"negate",value:function(){return this.x=-this.x,this.y=-this.y,this}},{key:"dot",value:function(e){return this.x*e.x+this.y*e.y}},{key:"cross",value:function(e){return this.x*e.y-this.y*e.x}},{key:"lengthSq",value:function(){return this.x*this.x+this.y*this.y}},{key:"length",value:function(){return Math.sqrt(this.x*this.x+this.y*this.y)}},{key:"manhattanLength",value:function(){return Math.abs(this.x)+Math.abs(this.y)}},{key:"normalize",value:function(){return this.divideScalar(this.length()||1)}},{key:"angle",value:function(){var e=Math.atan2(-this.y,-this.x)+Math.PI;return e}},{key:"distanceTo",value:function(e){return Math.sqrt(this.distanceToSquared(e))}},{key:"distanceToSquared",value:function(e){var t=this.x-e.x,n=this.y-e.y;return t*t+n*n}},{key:"manhattanDistanceTo",value:function(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)}},{key:"setLength",value:function(e){return this.normalize().multiplyScalar(e)}},{key:"lerp",value:function(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this}},{key:"lerpVectors",value:function(e,t,n){return this.x=e.x+(t.x-e.x)*n,this.y=e.y+(t.y-e.y)*n,this}},{key:"equals",value:function(e){return e.x===this.x&&e.y===this.y}},{key:"fromArray",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return this.x=e[t],this.y=e[t+1],this}},{key:"toArray",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return e[t]=this.x,e[t+1]=this.y,e}},{key:"fromBufferAttribute",value: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}},{key:"rotateAround",value:function(e,t){var n=Math.cos(t),r=Math.sin(t),i=this.x-e.x,a=this.y-e.y;return this.x=i*n-a*r+e.x,this.y=i*r+a*n+e.y,this}},{key:"random",value:function(){return this.x=Math.random(),this.y=Math.random(),this}},{key:Symbol.iterator,value:w().mark(function e(){return w().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.x;case 2:return e.next=4,this.y;case 4:case"end":return e.stop()}},e,this)})}]),t}(),xr=exports.Matrix3=function(){function e(){A(this,e),e.prototype.isMatrix3=!0,this.elements=[1,0,0,0,1,0,0,0,1],arguments.length>0&&console.error("THREE.Matrix3: the constructor no longer reads arguments. use .set() instead.")}return E(e,[{key:"set",value:function(e,t,n,r,i,a,o,s,l){var u=this.elements;return u[0]=e,u[1]=r,u[2]=o,u[3]=t,u[4]=i,u[5]=s,u[6]=n,u[7]=a,u[8]=l,this}},{key:"identity",value:function(){return this.set(1,0,0,0,1,0,0,0,1),this}},{key:"copy",value: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}},{key:"extractBasis",value:function(e,t,n){return e.setFromMatrix3Column(this,0),t.setFromMatrix3Column(this,1),n.setFromMatrix3Column(this,2),this}},{key:"setFromMatrix4",value: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}},{key:"multiply",value:function(e){return this.multiplyMatrices(this,e)}},{key:"premultiply",value:function(e){return this.multiplyMatrices(e,this)}},{key:"multiplyMatrices",value:function(e,t){var n=e.elements,r=t.elements,i=this.elements,a=n[0],o=n[3],s=n[6],l=n[1],u=n[4],c=n[7],h=n[2],d=n[5],p=n[8],f=r[0],v=r[3],m=r[6],g=r[1],y=r[4],x=r[7],_=r[2],M=r[5],b=r[8];return i[0]=a*f+o*g+s*_,i[3]=a*v+o*y+s*M,i[6]=a*m+o*x+s*b,i[1]=l*f+u*g+c*_,i[4]=l*v+u*y+c*M,i[7]=l*m+u*x+c*b,i[2]=h*f+d*g+p*_,i[5]=h*v+d*y+p*M,i[8]=h*m+d*x+p*b,this}},{key:"multiplyScalar",value: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}},{key:"determinant",value:function(){var e=this.elements,t=e[0],n=e[1],r=e[2],i=e[3],a=e[4],o=e[5],s=e[6],l=e[7],u=e[8];return t*a*u-t*o*l-n*i*u+n*o*s+r*i*l-r*a*s}},{key:"invert",value:function(){var e=this.elements,t=e[0],n=e[1],r=e[2],i=e[3],a=e[4],o=e[5],s=e[6],l=e[7],u=e[8],c=u*a-o*l,h=o*s-u*i,d=l*i-a*s,p=t*c+n*h+r*d;if(0===p)return this.set(0,0,0,0,0,0,0,0,0);var f=1/p;return e[0]=c*f,e[1]=(r*l-u*n)*f,e[2]=(o*n-r*a)*f,e[3]=h*f,e[4]=(u*t-r*s)*f,e[5]=(r*i-o*t)*f,e[6]=d*f,e[7]=(n*s-l*t)*f,e[8]=(a*t-n*i)*f,this}},{key:"transpose",value: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}},{key:"getNormalMatrix",value:function(e){return this.setFromMatrix4(e).invert().transpose()}},{key:"transposeIntoArray",value: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}},{key:"setUvTransform",value:function(e,t,n,r,i,a,o){var s=Math.cos(i),l=Math.sin(i);return this.set(n*s,n*l,-n*(s*a+l*o)+a+e,-r*l,r*s,-r*(-l*a+s*o)+o+t,0,0,1),this}},{key:"scale",value: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}},{key:"rotate",value:function(e){var t=Math.cos(e),n=Math.sin(e),r=this.elements,i=r[0],a=r[3],o=r[6],s=r[1],l=r[4],u=r[7];return r[0]=t*i+n*s,r[3]=t*a+n*l,r[6]=t*o+n*u,r[1]=-n*i+t*s,r[4]=-n*a+t*l,r[7]=-n*o+t*u,this}},{key:"translate",value: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}},{key:"equals",value:function(e){for(var t=this.elements,n=e.elements,r=0;r<9;r++)if(t[r]!==n[r])return!1;return!0}},{key:"fromArray",value:function(e){for(var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=0;n<9;n++)this.elements[n]=e[n+t];return this}},{key:"toArray",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,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}},{key:"clone",value:function(){return(new this.constructor).fromArray(this.elements)}}]),e}();function _r(e){for(var t=e.length-1;t>=0;--t)if(e[t]>65535)return!0;return!1}var Mr={Int8Array:Int8Array,Uint8Array:Uint8Array,Uint8ClampedArray:Uint8ClampedArray,Int16Array:Int16Array,Uint16Array:Uint16Array,Int32Array:Int32Array,Uint32Array:Uint32Array,Float32Array:Float32Array,Float64Array:Float64Array};function br(e,t){return new Mr[e](t)}function Sr(e){return document.createElementNS("http://www.w3.org/1999/xhtml",e)}function wr(e){return e<.04045?.0773993808*e:Math.pow(.9478672986*e+.0521327014,2.4)}function Tr(e){return e<.0031308?12.92*e:1.055*Math.pow(e,.41666)-.055}var Ar=S(S({},fn,S({},vn,wr)),vn,S({},fn,Tr)),kr=exports.ColorManagement={legacyMode:!0,get workingColorSpace(){return vn},set workingColorSpace(e){console.warn("THREE.ColorManagement: .workingColorSpace is readonly.")},convert:function(e,t,n){if(this.legacyMode||t===n||!t||!n)return e;if(Ar[t]&&void 0!==Ar[t][n]){var r=Ar[t][n];return e.r=r(e.r),e.g=r(e.g),e.b=r(e.b),e}throw new Error("Unsupported color space conversion.")},fromWorkingColorSpace:function(e,t){return this.convert(e,this.workingColorSpace,t)},toWorkingColorSpace:function(e,t){return this.convert(e,t,this.workingColorSpace)}},Er={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},Cr={r:0,g:0,b:0},Lr={h:0,s:0,l:0},Rr={h:0,s:0,l:0};function Pr(e,t,n){return n<0&&(n+=1),n>1&&(n-=1),n<1/6?e+6*(t-e)*n:n<.5?t:n<2/3?e+6*(t-e)*(2/3-n):e}function Ir(e,t){return t.r=e.r,t.g=e.g,t.b=e.b,t}var Dr,Nr=exports.Color=function(e){function t(e,n,r){return A(this,t),this.isColor=!0,this.r=1,this.g=1,this.b=1,void 0===n&&void 0===r?this.set(e):this.setRGB(e,n,r)}return E(t,[{key:"set",value:function(e){return e&&e.isColor?this.copy(e):"number"==typeof e?this.setHex(e):"string"==typeof e&&this.setStyle(e),this}},{key:"setScalar",value:function(e){return this.r=e,this.g=e,this.b=e,this}},{key:"setHex",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:fn;return e=Math.floor(e),this.r=(e>>16&255)/255,this.g=(e>>8&255)/255,this.b=(255&e)/255,kr.toWorkingColorSpace(this,t),this}},{key:"setRGB",value:function(e,t,n){var r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:vn;return this.r=e,this.g=t,this.b=n,kr.toWorkingColorSpace(this,r),this}},{key:"setHSL",value:function(e,t,n){var r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:vn;if(e=Kn(e,1),t=Jn(t,0,1),n=Jn(n,0,1),0===t)this.r=this.g=this.b=n;else{var i=n<=.5?n*(1+t):n+t-n*t,a=2*n-i;this.r=Pr(a,i,e+1/3),this.g=Pr(a,i,e),this.b=Pr(a,i,e-1/3)}return kr.toWorkingColorSpace(this,r),this}},{key:"setStyle",value:function(e){var t,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:fn;function r(t){void 0!==t&&parseFloat(t)<1&&console.warn("THREE.Color: Alpha component of "+e+" will be ignored.")}if(t=/^((?:rgb|hsl)a?)\(([^\)]*)\)/.exec(e)){var i,a=t[1],o=t[2];switch(a){case"rgb":case"rgba":if(i=/^\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(o))return this.r=Math.min(255,parseInt(i[1],10))/255,this.g=Math.min(255,parseInt(i[2],10))/255,this.b=Math.min(255,parseInt(i[3],10))/255,kr.toWorkingColorSpace(this,n),r(i[4]),this;if(i=/^\s*(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(o))return this.r=Math.min(100,parseInt(i[1],10))/100,this.g=Math.min(100,parseInt(i[2],10))/100,this.b=Math.min(100,parseInt(i[3],10))/100,kr.toWorkingColorSpace(this,n),r(i[4]),this;break;case"hsl":case"hsla":if(i=/^\s*(\d*\.?\d+)\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(o)){var s=parseFloat(i[1])/360,l=parseInt(i[2],10)/100,u=parseInt(i[3],10)/100;return r(i[4]),this.setHSL(s,l,u,n)}}}else if(t=/^\#([A-Fa-f\d]+)$/.exec(e)){var c=t[1],h=c.length;if(3===h)return this.r=parseInt(c.charAt(0)+c.charAt(0),16)/255,this.g=parseInt(c.charAt(1)+c.charAt(1),16)/255,this.b=parseInt(c.charAt(2)+c.charAt(2),16)/255,kr.toWorkingColorSpace(this,n),this;if(6===h)return this.r=parseInt(c.charAt(0)+c.charAt(1),16)/255,this.g=parseInt(c.charAt(2)+c.charAt(3),16)/255,this.b=parseInt(c.charAt(4)+c.charAt(5),16)/255,kr.toWorkingColorSpace(this,n),this}return e&&e.length>0?this.setColorName(e,n):this}},{key:"setColorName",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:fn,n=Er[e.toLowerCase()];return void 0!==n?this.setHex(n,t):console.warn("THREE.Color: Unknown color "+e),this}},{key:"clone",value:function(){return new this.constructor(this.r,this.g,this.b)}},{key:"copy",value:function(e){return this.r=e.r,this.g=e.g,this.b=e.b,this}},{key:"copySRGBToLinear",value:function(e){return this.r=wr(e.r),this.g=wr(e.g),this.b=wr(e.b),this}},{key:"copyLinearToSRGB",value:function(e){return this.r=Tr(e.r),this.g=Tr(e.g),this.b=Tr(e.b),this}},{key:"convertSRGBToLinear",value:function(){return this.copySRGBToLinear(this),this}},{key:"convertLinearToSRGB",value:function(){return this.copyLinearToSRGB(this),this}},{key:"getHex",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:fn;return kr.fromWorkingColorSpace(Ir(this,Cr),e),Jn(255*Cr.r,0,255)<<16^Jn(255*Cr.g,0,255)<<8^Jn(255*Cr.b,0,255)<<0}},{key:"getHexString",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:fn;return("000000"+this.getHex(e).toString(16)).slice(-6)}},{key:"getHSL",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:vn;kr.fromWorkingColorSpace(Ir(this,Cr),t);var n,r,i=Cr.r,a=Cr.g,o=Cr.b,s=Math.max(i,a,o),l=Math.min(i,a,o),u=(l+s)/2;if(l===s)n=0,r=0;else{var c=s-l;switch(r=u<=.5?c/(s+l):c/(2-s-l),s){case i:n=(a-o)/c+(a1&&void 0!==arguments[1]?arguments[1]:vn;return kr.fromWorkingColorSpace(Ir(this,Cr),t),e.r=Cr.r,e.g=Cr.g,e.b=Cr.b,e}},{key:"getStyle",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:fn;return kr.fromWorkingColorSpace(Ir(this,Cr),e),e!==fn?"color(".concat(e," ").concat(Cr.r," ").concat(Cr.g," ").concat(Cr.b,")"):"rgb(".concat(255*Cr.r|0,",").concat(255*Cr.g|0,",").concat(255*Cr.b|0,")")}},{key:"offsetHSL",value:function(e,t,n){return this.getHSL(Lr),Lr.h+=e,Lr.s+=t,Lr.l+=n,this.setHSL(Lr.h,Lr.s,Lr.l),this}},{key:"add",value:function(e){return this.r+=e.r,this.g+=e.g,this.b+=e.b,this}},{key:"addColors",value:function(e,t){return this.r=e.r+t.r,this.g=e.g+t.g,this.b=e.b+t.b,this}},{key:"addScalar",value:function(e){return this.r+=e,this.g+=e,this.b+=e,this}},{key:"sub",value: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}},{key:"multiply",value:function(e){return this.r*=e.r,this.g*=e.g,this.b*=e.b,this}},{key:"multiplyScalar",value:function(e){return this.r*=e,this.g*=e,this.b*=e,this}},{key:"lerp",value: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}},{key:"lerpColors",value:function(e,t,n){return this.r=e.r+(t.r-e.r)*n,this.g=e.g+(t.g-e.g)*n,this.b=e.b+(t.b-e.b)*n,this}},{key:"lerpHSL",value:function(e,t){this.getHSL(Lr),e.getHSL(Rr);var n=er(Lr.h,Rr.h,t),r=er(Lr.s,Rr.s,t),i=er(Lr.l,Rr.l,t);return this.setHSL(n,r,i),this}},{key:"equals",value:function(e){return e.r===this.r&&e.g===this.g&&e.b===this.b}},{key:"fromArray",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return this.r=e[t],this.g=e[t+1],this.b=e[t+2],this}},{key:"toArray",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return e[t]=this.r,e[t+1]=this.g,e[t+2]=this.b,e}},{key:"fromBufferAttribute",value:function(e,t){return this.r=e.getX(t),this.g=e.getY(t),this.b=e.getZ(t),!0===e.normalized&&(this.r/=255,this.g/=255,this.b/=255),this}},{key:"toJSON",value:function(){return this.getHex()}},{key:Symbol.iterator,value:w().mark(function e(){return w().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.r;case 2:return e.next=4,this.g;case 4:return e.next=6,this.b;case 6:case"end":return e.stop()}},e,this)})}]),t}();Nr.NAMES=Er;var Or=exports.ImageUtils=function(){function e(){A(this,e)}return E(e,null,[{key:"getDataURL",value:function(e){if(/^data:/i.test(e.src))return e.src;if("undefined"==typeof HTMLCanvasElement)return e.src;var t;if(e instanceof HTMLCanvasElement)t=e;else{void 0===Dr&&(Dr=Sr("canvas")),Dr.width=e.width,Dr.height=e.height;var n=Dr.getContext("2d");e instanceof ImageData?n.putImageData(e,0,0):n.drawImage(e,0,0,e.width,e.height),t=Dr}return t.width>2048||t.height>2048?(console.warn("THREE.ImageUtils.getDataURL: Image converted to jpg for performance reasons",e),t.toDataURL("image/jpeg",.6)):t.toDataURL("image/png")}},{key:"sRGBToLinear",value:function(e){if("undefined"!=typeof HTMLImageElement&&e instanceof HTMLImageElement||"undefined"!=typeof HTMLCanvasElement&&e instanceof HTMLCanvasElement||"undefined"!=typeof ImageBitmap&&e instanceof ImageBitmap){var t=Sr("canvas");t.width=e.width,t.height=e.height;var n=t.getContext("2d");n.drawImage(e,0,0,e.width,e.height);for(var r=n.getImageData(0,0,e.width,e.height),i=r.data,a=0;a0&&void 0!==arguments[0]?arguments[0]:null;A(this,e),this.isSource=!0,this.uuid=Zn(),this.data=t,this.version=0}return E(e,[{key:"needsUpdate",set:function(e){!0===e&&this.version++}},{key:"toJSON",value:function(e){var t=void 0===e||"string"==typeof e;if(!t&&void 0!==e.images[this.uuid])return e.images[this.uuid];var n={uuid:this.uuid,url:""},r=this.data;if(null!==r){var i;if(Array.isArray(r)){i=[];for(var a=0,o=r.length;a0&&void 0!==arguments[0]?arguments[0]:n.DEFAULT_IMAGE,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:n.DEFAULT_MAPPING,a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:Be,o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:Be,s=arguments.length>4&&void 0!==arguments[4]?arguments[4]:qe,l=arguments.length>5&&void 0!==arguments[5]?arguments[5]:Ze,u=arguments.length>6&&void 0!==arguments[6]?arguments[6]:ct,c=arguments.length>7&&void 0!==arguments[7]?arguments[7]:Ke,h=arguments.length>8&&void 0!==arguments[8]?arguments[8]:1,d=arguments.length>9&&void 0!==arguments[9]?arguments[9]:sn;return A(this,n),(e=t.call(this)).isTexture=!0,Object.defineProperty(_(e),"id",{value:Br++}),e.uuid=Zn(),e.name="",e.source=new Fr(r),e.mipmaps=[],e.mapping=i,e.wrapS=a,e.wrapT=o,e.magFilter=s,e.minFilter=l,e.anisotropy=h,e.format=u,e.internalFormat=null,e.type=c,e.offset=new yr(0,0),e.repeat=new yr(1,1),e.center=new yr(0,0),e.rotation=0,e.matrixAutoUpdate=!0,e.matrix=new xr,e.generateMipmaps=!0,e.premultiplyAlpha=!1,e.flipY=!0,e.unpackAlignment=4,e.encoding=d,e.userData={},e.version=0,e.onUpdate=null,e.isRenderTargetTexture=!1,e.needsPMREMUpdate=!1,e}return E(n,[{key:"image",get:function(){return this.source.data},set:function(e){this.source.data=e}},{key:"updateMatrix",value:function(){this.matrix.setUvTransform(this.offset.x,this.offset.y,this.repeat.x,this.repeat.y,this.rotation,this.center.x,this.center.y)}},{key:"clone",value:function(){return(new this.constructor).copy(this)}},{key:"copy",value:function(e){return this.name=e.name,this.source=e.source,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.userData=JSON.parse(JSON.stringify(e.userData)),this.needsUpdate=!0,this}},{key:"toJSON",value: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,image:this.source.toJSON(e).uuid,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};return"{}"!==JSON.stringify(this.userData)&&(n.userData=this.userData),t||(e.textures[this.uuid]=n),n}},{key:"dispose",value:function(){this.dispatchEvent({type:"dispose"})}},{key:"transformUv",value:function(e){if(this.mapping!==Pe)return e;if(e.applyMatrix3(this.matrix),e.x<0||e.x>1)switch(this.wrapS){case ze:e.x=e.x-Math.floor(e.x);break;case Be:e.x=e.x<0?0:1;break;case Ue:1===Math.abs(Math.floor(e.x)%2)?e.x=Math.ceil(e.x)-e.x:e.x=e.x-Math.floor(e.x)}if(e.y<0||e.y>1)switch(this.wrapT){case ze:e.y=e.y-Math.floor(e.y);break;case Be:e.y=e.y<0?0:1;break;case Ue: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}},{key:"needsUpdate",set:function(e){!0===e&&(this.version++,this.source.needsUpdate=!0)}}]),n}();Ur.DEFAULT_IMAGE=null,Ur.DEFAULT_MAPPING=Pe;var Gr=exports.Vector4=function(e){function t(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:1;A(this,t),t.prototype.isVector4=!0,this.x=e,this.y=n,this.z=r,this.w=i}return E(t,[{key:"width",get:function(){return this.z},set:function(e){this.z=e}},{key:"height",get:function(){return this.w},set:function(e){this.w=e}},{key:"set",value:function(e,t,n,r){return this.x=e,this.y=t,this.z=n,this.w=r,this}},{key:"setScalar",value:function(e){return this.x=e,this.y=e,this.z=e,this.w=e,this}},{key:"setX",value:function(e){return this.x=e,this}},{key:"setY",value:function(e){return this.y=e,this}},{key:"setZ",value:function(e){return this.z=e,this}},{key:"setW",value:function(e){return this.w=e,this}},{key:"setComponent",value: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}},{key:"getComponent",value: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)}}},{key:"clone",value:function(){return new this.constructor(this.x,this.y,this.z,this.w)}},{key:"copy",value: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}},{key:"add",value: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)}},{key:"addScalar",value:function(e){return this.x+=e,this.y+=e,this.z+=e,this.w+=e,this}},{key:"addVectors",value: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}},{key:"addScaledVector",value: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}},{key:"sub",value: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)}},{key:"subScalar",value:function(e){return this.x-=e,this.y-=e,this.z-=e,this.w-=e,this}},{key:"subVectors",value: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}},{key:"multiply",value:function(e){return this.x*=e.x,this.y*=e.y,this.z*=e.z,this.w*=e.w,this}},{key:"multiplyScalar",value:function(e){return this.x*=e,this.y*=e,this.z*=e,this.w*=e,this}},{key:"applyMatrix4",value:function(e){var t=this.x,n=this.y,r=this.z,i=this.w,a=e.elements;return this.x=a[0]*t+a[4]*n+a[8]*r+a[12]*i,this.y=a[1]*t+a[5]*n+a[9]*r+a[13]*i,this.z=a[2]*t+a[6]*n+a[10]*r+a[14]*i,this.w=a[3]*t+a[7]*n+a[11]*r+a[15]*i,this}},{key:"divideScalar",value:function(e){return this.multiplyScalar(1/e)}},{key:"setAxisAngleFromQuaternion",value: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}},{key:"setAxisAngleFromRotationMatrix",value:function(e){var t,n,r,i,a=e.elements,o=a[0],s=a[4],l=a[8],u=a[1],c=a[5],h=a[9],d=a[2],p=a[6],f=a[10];if(Math.abs(s-u)<.01&&Math.abs(l-d)<.01&&Math.abs(h-p)<.01){if(Math.abs(s+u)<.1&&Math.abs(l+d)<.1&&Math.abs(h+p)<.1&&Math.abs(o+c+f-3)<.1)return this.set(1,0,0,0),this;t=Math.PI;var v=(o+1)/2,m=(c+1)/2,g=(f+1)/2,y=(s+u)/4,x=(l+d)/4,_=(h+p)/4;return v>m&&v>g?v<.01?(n=0,r=.707106781,i=.707106781):(r=y/(n=Math.sqrt(v)),i=x/n):m>g?m<.01?(n=.707106781,r=0,i=.707106781):(n=y/(r=Math.sqrt(m)),i=_/r):g<.01?(n=.707106781,r=.707106781,i=0):(n=x/(i=Math.sqrt(g)),r=_/i),this.set(n,r,i,t),this}var M=Math.sqrt((p-h)*(p-h)+(l-d)*(l-d)+(u-s)*(u-s));return Math.abs(M)<.001&&(M=1),this.x=(p-h)/M,this.y=(l-d)/M,this.z=(u-s)/M,this.w=Math.acos((o+c+f-1)/2),this}},{key:"min",value: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}},{key:"max",value: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}},{key:"clamp",value: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}},{key:"clampScalar",value: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}},{key:"clampLength",value:function(e,t){var n=this.length();return this.divideScalar(n||1).multiplyScalar(Math.max(e,Math.min(t,n)))}},{key:"floor",value: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}},{key:"ceil",value: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}},{key:"round",value: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}},{key:"roundToZero",value: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}},{key:"negate",value:function(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this.w=-this.w,this}},{key:"dot",value:function(e){return this.x*e.x+this.y*e.y+this.z*e.z+this.w*e.w}},{key:"lengthSq",value:function(){return this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w}},{key:"length",value:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)}},{key:"manhattanLength",value:function(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)+Math.abs(this.w)}},{key:"normalize",value:function(){return this.divideScalar(this.length()||1)}},{key:"setLength",value:function(e){return this.normalize().multiplyScalar(e)}},{key:"lerp",value: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}},{key:"lerpVectors",value:function(e,t,n){return this.x=e.x+(t.x-e.x)*n,this.y=e.y+(t.y-e.y)*n,this.z=e.z+(t.z-e.z)*n,this.w=e.w+(t.w-e.w)*n,this}},{key:"equals",value:function(e){return e.x===this.x&&e.y===this.y&&e.z===this.z&&e.w===this.w}},{key:"fromArray",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return this.x=e[t],this.y=e[t+1],this.z=e[t+2],this.w=e[t+3],this}},{key:"toArray",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return e[t]=this.x,e[t+1]=this.y,e[t+2]=this.z,e[t+3]=this.w,e}},{key:"fromBufferAttribute",value: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}},{key:"random",value:function(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this.w=Math.random(),this}},{key:Symbol.iterator,value:w().mark(function e(){return w().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.x;case 2:return e.next=4,this.y;case 4:return e.next=6,this.z;case 6:return e.next=8,this.w;case 8:case"end":return e.stop()}},e,this)})}]),t}(),Vr=exports.WebGLRenderTarget=function(e){m(n,Wn);var t=y(n);function n(e,r){var i,a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};A(this,n),(i=t.call(this)).isWebGLRenderTarget=!0,i.width=e,i.height=r,i.depth=1,i.scissor=new Gr(0,0,e,r),i.scissorTest=!1,i.viewport=new Gr(0,0,e,r);var o={width:e,height:r,depth:1};return i.texture=new Ur(o,a.mapping,a.wrapS,a.wrapT,a.magFilter,a.minFilter,a.format,a.type,a.anisotropy,a.encoding),i.texture.isRenderTargetTexture=!0,i.texture.flipY=!1,i.texture.generateMipmaps=void 0!==a.generateMipmaps&&a.generateMipmaps,i.texture.internalFormat=void 0!==a.internalFormat?a.internalFormat:null,i.texture.minFilter=void 0!==a.minFilter?a.minFilter:qe,i.depthBuffer=void 0===a.depthBuffer||a.depthBuffer,i.stencilBuffer=void 0!==a.stencilBuffer&&a.stencilBuffer,i.depthTexture=void 0!==a.depthTexture?a.depthTexture:null,i.samples=void 0!==a.samples?a.samples:0,i}return E(n,[{key:"setSize",value:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1;this.width===e&&this.height===t&&this.depth===n||(this.width=e,this.height=t,this.depth=n,this.texture.image.width=e,this.texture.image.height=t,this.texture.image.depth=n,this.dispose()),this.viewport.set(0,0,e,t),this.scissor.set(0,0,e,t)}},{key:"clone",value:function(){return(new this.constructor).copy(this)}},{key:"copy",value:function(e){this.width=e.width,this.height=e.height,this.depth=e.depth,this.viewport.copy(e.viewport),this.texture=e.texture.clone(),this.texture.isRenderTargetTexture=!0;var t=Object.assign({},e.texture.image);return this.texture.source=new Fr(t),this.depthBuffer=e.depthBuffer,this.stencilBuffer=e.stencilBuffer,null!==e.depthTexture&&(this.depthTexture=e.depthTexture.clone()),this.samples=e.samples,this}},{key:"dispose",value:function(){this.dispatchEvent({type:"dispose"})}}]),n}(),Hr=exports.DataArrayTexture=function(e){m(n,Ur);var t=y(n);function n(){var e,r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1,o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:1;return A(this,n),(e=t.call(this,null)).isDataArrayTexture=!0,e.image={data:r,width:i,height:a,depth:o},e.magFilter=Ge,e.minFilter=Ge,e.wrapR=Be,e.generateMipmaps=!1,e.flipY=!1,e.unpackAlignment=1,e}return E(n)}(),Wr=exports.WebGLArrayRenderTarget=function(e){m(n,Vr);var t=y(n);function n(e,r,i){var a;return A(this,n),(a=t.call(this,e,r)).isWebGLArrayRenderTarget=!0,a.depth=i,a.texture=new Hr(null,e,r,i),a.texture.isRenderTargetTexture=!0,a}return E(n)}(),jr=exports.Data3DTexture=function(e){m(n,Ur);var t=y(n);function n(){var e,r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1,o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:1;return A(this,n),(e=t.call(this,null)).isData3DTexture=!0,e.image={data:r,width:i,height:a,depth:o},e.magFilter=Ge,e.minFilter=Ge,e.wrapR=Be,e.generateMipmaps=!1,e.flipY=!1,e.unpackAlignment=1,e}return E(n)}(),qr=exports.WebGL3DRenderTarget=function(e){m(n,Vr);var t=y(n);function n(e,r,i){var a;return A(this,n),(a=t.call(this,e,r)).isWebGL3DRenderTarget=!0,a.depth=i,a.texture=new jr(null,e,r,i),a.texture.isRenderTargetTexture=!0,a}return E(n)}(),Xr=exports.WebGLMultipleRenderTargets=function(e){m(n,Vr);var t=y(n);function n(e,r,i){var a,o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};A(this,n),(a=t.call(this,e,r,o)).isWebGLMultipleRenderTargets=!0;var s=a.texture;a.texture=[];for(var l=0;l2&&void 0!==arguments[2]?arguments[2]:1;if(this.width!==e||this.height!==t||this.depth!==n){this.width=e,this.height=t,this.depth=n;for(var r=0,i=this.texture.length;r0&&void 0!==arguments[0]?arguments[0]:0,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:1;A(this,t),this.isQuaternion=!0,this._x=e,this._y=n,this._z=r,this._w=i}return E(t,[{key:"x",get:function(){return this._x},set:function(e){this._x=e,this._onChangeCallback()}},{key:"y",get:function(){return this._y},set:function(e){this._y=e,this._onChangeCallback()}},{key:"z",get:function(){return this._z},set:function(e){this._z=e,this._onChangeCallback()}},{key:"w",get:function(){return this._w},set:function(e){this._w=e,this._onChangeCallback()}},{key:"set",value:function(e,t,n,r){return this._x=e,this._y=t,this._z=n,this._w=r,this._onChangeCallback(),this}},{key:"clone",value:function(){return new this.constructor(this._x,this._y,this._z,this._w)}},{key:"copy",value:function(e){return this._x=e.x,this._y=e.y,this._z=e.z,this._w=e.w,this._onChangeCallback(),this}},{key:"setFromEuler",value: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,r=e._y,i=e._z,a=e._order,o=Math.cos,s=Math.sin,l=o(n/2),u=o(r/2),c=o(i/2),h=s(n/2),d=s(r/2),p=s(i/2);switch(a){case"XYZ":this._x=h*u*c+l*d*p,this._y=l*d*c-h*u*p,this._z=l*u*p+h*d*c,this._w=l*u*c-h*d*p;break;case"YXZ":this._x=h*u*c+l*d*p,this._y=l*d*c-h*u*p,this._z=l*u*p-h*d*c,this._w=l*u*c+h*d*p;break;case"ZXY":this._x=h*u*c-l*d*p,this._y=l*d*c+h*u*p,this._z=l*u*p+h*d*c,this._w=l*u*c-h*d*p;break;case"ZYX":this._x=h*u*c-l*d*p,this._y=l*d*c+h*u*p,this._z=l*u*p-h*d*c,this._w=l*u*c+h*d*p;break;case"YZX":this._x=h*u*c+l*d*p,this._y=l*d*c+h*u*p,this._z=l*u*p-h*d*c,this._w=l*u*c-h*d*p;break;case"XZY":this._x=h*u*c-l*d*p,this._y=l*d*c-h*u*p,this._z=l*u*p+h*d*c,this._w=l*u*c+h*d*p;break;default:console.warn("THREE.Quaternion: .setFromEuler() encountered an unknown order: "+a)}return!1!==t&&this._onChangeCallback(),this}},{key:"setFromAxisAngle",value:function(e,t){var n=t/2,r=Math.sin(n);return this._x=e.x*r,this._y=e.y*r,this._z=e.z*r,this._w=Math.cos(n),this._onChangeCallback(),this}},{key:"setFromRotationMatrix",value:function(e){var t=e.elements,n=t[0],r=t[4],i=t[8],a=t[1],o=t[5],s=t[9],l=t[2],u=t[6],c=t[10],h=n+o+c;if(h>0){var d=.5/Math.sqrt(h+1);this._w=.25/d,this._x=(u-s)*d,this._y=(i-l)*d,this._z=(a-r)*d}else if(n>o&&n>c){var p=2*Math.sqrt(1+n-o-c);this._w=(u-s)/p,this._x=.25*p,this._y=(r+a)/p,this._z=(i+l)/p}else if(o>c){var f=2*Math.sqrt(1+o-n-c);this._w=(i-l)/f,this._x=(r+a)/f,this._y=.25*f,this._z=(s+u)/f}else{var v=2*Math.sqrt(1+c-n-o);this._w=(a-r)/v,this._x=(i+l)/v,this._y=(s+u)/v,this._z=.25*v}return this._onChangeCallback(),this}},{key:"setFromUnitVectors",value:function(e,t){var n=e.dot(t)+1;return nMath.abs(e.z)?(this._x=-e.y,this._y=e.x,this._z=0,this._w=n):(this._x=0,this._y=-e.z,this._z=e.y,this._w=n)):(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()}},{key:"angleTo",value:function(e){return 2*Math.acos(Math.abs(Jn(this.dot(e),-1,1)))}},{key:"rotateTowards",value:function(e,t){var n=this.angleTo(e);if(0===n)return this;var r=Math.min(1,t/n);return this.slerp(e,r),this}},{key:"identity",value:function(){return this.set(0,0,0,1)}},{key:"invert",value:function(){return this.conjugate()}},{key:"conjugate",value:function(){return this._x*=-1,this._y*=-1,this._z*=-1,this._onChangeCallback(),this}},{key:"dot",value:function(e){return this._x*e._x+this._y*e._y+this._z*e._z+this._w*e._w}},{key:"lengthSq",value:function(){return this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w}},{key:"length",value:function(){return Math.sqrt(this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w)}},{key:"normalize",value: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}},{key:"multiply",value: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)}},{key:"premultiply",value:function(e){return this.multiplyQuaternions(e,this)}},{key:"multiplyQuaternions",value:function(e,t){var n=e._x,r=e._y,i=e._z,a=e._w,o=t._x,s=t._y,l=t._z,u=t._w;return this._x=n*u+a*o+r*l-i*s,this._y=r*u+a*s+i*o-n*l,this._z=i*u+a*l+n*s-r*o,this._w=a*u-n*o-r*s-i*l,this._onChangeCallback(),this}},{key:"slerp",value:function(e,t){if(0===t)return this;if(1===t)return this.copy(e);var n=this._x,r=this._y,i=this._z,a=this._w,o=a*e._w+n*e._x+r*e._y+i*e._z;if(o<0?(this._w=-e._w,this._x=-e._x,this._y=-e._y,this._z=-e._z,o=-o):this.copy(e),o>=1)return this._w=a,this._x=n,this._y=r,this._z=i,this;var s=1-o*o;if(s<=Number.EPSILON){var l=1-t;return this._w=l*a+t*this._w,this._x=l*n+t*this._x,this._y=l*r+t*this._y,this._z=l*i+t*this._z,this.normalize(),this._onChangeCallback(),this}var u=Math.sqrt(s),c=Math.atan2(u,o),h=Math.sin((1-t)*c)/u,d=Math.sin(t*c)/u;return this._w=a*h+this._w*d,this._x=n*h+this._x*d,this._y=r*h+this._y*d,this._z=i*h+this._z*d,this._onChangeCallback(),this}},{key:"slerpQuaternions",value:function(e,t,n){return this.copy(e).slerp(t,n)}},{key:"random",value:function(){var e=Math.random(),t=Math.sqrt(1-e),n=Math.sqrt(e),r=2*Math.PI*Math.random(),i=2*Math.PI*Math.random();return this.set(t*Math.cos(r),n*Math.sin(i),n*Math.cos(i),t*Math.sin(r))}},{key:"equals",value:function(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._w===this._w}},{key:"fromArray",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return this._x=e[t],this._y=e[t+1],this._z=e[t+2],this._w=e[t+3],this._onChangeCallback(),this}},{key:"toArray",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return e[t]=this._x,e[t+1]=this._y,e[t+2]=this._z,e[t+3]=this._w,e}},{key:"fromBufferAttribute",value: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}},{key:"_onChange",value:function(e){return this._onChangeCallback=e,this}},{key:"_onChangeCallback",value:function(){}},{key:Symbol.iterator,value:w().mark(function e(){return w().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this._x;case 2:return e.next=4,this._y;case 4:return e.next=6,this._z;case 6:return e.next=8,this._w;case 8:case"end":return e.stop()}},e,this)})}],[{key:"slerp",value:function(e,t,n,r){return console.warn("THREE.Quaternion: Static .slerp() has been deprecated. Use qm.slerpQuaternions( qa, qb, t ) instead."),n.slerpQuaternions(e,t,r)}},{key:"slerpFlat",value:function(e,t,n,r,i,a,o){var s=n[r+0],l=n[r+1],u=n[r+2],c=n[r+3],h=i[a+0],d=i[a+1],p=i[a+2],f=i[a+3];if(0===o)return e[t+0]=s,e[t+1]=l,e[t+2]=u,void(e[t+3]=c);if(1===o)return e[t+0]=h,e[t+1]=d,e[t+2]=p,void(e[t+3]=f);if(c!==f||s!==h||l!==d||u!==p){var v=1-o,m=s*h+l*d+u*p+c*f,g=m>=0?1:-1,y=1-m*m;if(y>Number.EPSILON){var x=Math.sqrt(y),_=Math.atan2(x,m*g);v=Math.sin(v*_)/x,o=Math.sin(o*_)/x}var M=o*g;if(s=s*v+h*M,l=l*v+d*M,u=u*v+p*M,c=c*v+f*M,v===1-o){var b=1/Math.sqrt(s*s+l*l+u*u+c*c);s*=b,l*=b,u*=b,c*=b}}e[t]=s,e[t+1]=l,e[t+2]=u,e[t+3]=c}},{key:"multiplyQuaternionsFlat",value:function(e,t,n,r,i,a){var o=n[r],s=n[r+1],l=n[r+2],u=n[r+3],c=i[a],h=i[a+1],d=i[a+2],p=i[a+3];return e[t]=o*p+u*c+s*d-l*h,e[t+1]=s*p+u*h+l*c-o*d,e[t+2]=l*p+u*d+o*h-s*c,e[t+3]=u*p-o*c-s*h-l*d,e}}]),t}(),Zr=exports.Vector3=function(e){function t(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;A(this,t),t.prototype.isVector3=!0,this.x=e,this.y=n,this.z=r}return E(t,[{key:"set",value:function(e,t,n){return void 0===n&&(n=this.z),this.x=e,this.y=t,this.z=n,this}},{key:"setScalar",value:function(e){return this.x=e,this.y=e,this.z=e,this}},{key:"setX",value:function(e){return this.x=e,this}},{key:"setY",value:function(e){return this.y=e,this}},{key:"setZ",value:function(e){return this.z=e,this}},{key:"setComponent",value: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}},{key:"getComponent",value: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)}}},{key:"clone",value:function(){return new this.constructor(this.x,this.y,this.z)}},{key:"copy",value:function(e){return this.x=e.x,this.y=e.y,this.z=e.z,this}},{key:"add",value: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)}},{key:"addScalar",value:function(e){return this.x+=e,this.y+=e,this.z+=e,this}},{key:"addVectors",value:function(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this.z=e.z+t.z,this}},{key:"addScaledVector",value:function(e,t){return this.x+=e.x*t,this.y+=e.y*t,this.z+=e.z*t,this}},{key:"sub",value: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)}},{key:"subScalar",value:function(e){return this.x-=e,this.y-=e,this.z-=e,this}},{key:"subVectors",value:function(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this.z=e.z-t.z,this}},{key:"multiply",value: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)}},{key:"multiplyScalar",value:function(e){return this.x*=e,this.y*=e,this.z*=e,this}},{key:"multiplyVectors",value:function(e,t){return this.x=e.x*t.x,this.y=e.y*t.y,this.z=e.z*t.z,this}},{key:"applyEuler",value:function(e){return e&&e.isEuler||console.error("THREE.Vector3: .applyEuler() now expects an Euler rotation rather than a Vector3 and order."),this.applyQuaternion(Kr.setFromEuler(e))}},{key:"applyAxisAngle",value:function(e,t){return this.applyQuaternion(Kr.setFromAxisAngle(e,t))}},{key:"applyMatrix3",value:function(e){var t=this.x,n=this.y,r=this.z,i=e.elements;return this.x=i[0]*t+i[3]*n+i[6]*r,this.y=i[1]*t+i[4]*n+i[7]*r,this.z=i[2]*t+i[5]*n+i[8]*r,this}},{key:"applyNormalMatrix",value:function(e){return this.applyMatrix3(e).normalize()}},{key:"applyMatrix4",value:function(e){var t=this.x,n=this.y,r=this.z,i=e.elements,a=1/(i[3]*t+i[7]*n+i[11]*r+i[15]);return this.x=(i[0]*t+i[4]*n+i[8]*r+i[12])*a,this.y=(i[1]*t+i[5]*n+i[9]*r+i[13])*a,this.z=(i[2]*t+i[6]*n+i[10]*r+i[14])*a,this}},{key:"applyQuaternion",value:function(e){var t=this.x,n=this.y,r=this.z,i=e.x,a=e.y,o=e.z,s=e.w,l=s*t+a*r-o*n,u=s*n+o*t-i*r,c=s*r+i*n-a*t,h=-i*t-a*n-o*r;return this.x=l*s+h*-i+u*-o-c*-a,this.y=u*s+h*-a+c*-i-l*-o,this.z=c*s+h*-o+l*-a-u*-i,this}},{key:"project",value:function(e){return this.applyMatrix4(e.matrixWorldInverse).applyMatrix4(e.projectionMatrix)}},{key:"unproject",value:function(e){return this.applyMatrix4(e.projectionMatrixInverse).applyMatrix4(e.matrixWorld)}},{key:"transformDirection",value:function(e){var t=this.x,n=this.y,r=this.z,i=e.elements;return this.x=i[0]*t+i[4]*n+i[8]*r,this.y=i[1]*t+i[5]*n+i[9]*r,this.z=i[2]*t+i[6]*n+i[10]*r,this.normalize()}},{key:"divide",value:function(e){return this.x/=e.x,this.y/=e.y,this.z/=e.z,this}},{key:"divideScalar",value:function(e){return this.multiplyScalar(1/e)}},{key:"min",value: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}},{key:"max",value: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}},{key:"clamp",value: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}},{key:"clampScalar",value: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}},{key:"clampLength",value:function(e,t){var n=this.length();return this.divideScalar(n||1).multiplyScalar(Math.max(e,Math.min(t,n)))}},{key:"floor",value:function(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this}},{key:"ceil",value:function(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this}},{key:"round",value:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this}},{key:"roundToZero",value: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}},{key:"negate",value:function(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this}},{key:"dot",value:function(e){return this.x*e.x+this.y*e.y+this.z*e.z}},{key:"lengthSq",value:function(){return this.x*this.x+this.y*this.y+this.z*this.z}},{key:"length",value:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)}},{key:"manhattanLength",value:function(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)}},{key:"normalize",value:function(){return this.divideScalar(this.length()||1)}},{key:"setLength",value:function(e){return this.normalize().multiplyScalar(e)}},{key:"lerp",value: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}},{key:"lerpVectors",value:function(e,t,n){return this.x=e.x+(t.x-e.x)*n,this.y=e.y+(t.y-e.y)*n,this.z=e.z+(t.z-e.z)*n,this}},{key:"cross",value: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)}},{key:"crossVectors",value:function(e,t){var n=e.x,r=e.y,i=e.z,a=t.x,o=t.y,s=t.z;return this.x=r*s-i*o,this.y=i*a-n*s,this.z=n*o-r*a,this}},{key:"projectOnVector",value: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)}},{key:"projectOnPlane",value:function(e){return Jr.copy(this).projectOnVector(e),this.sub(Jr)}},{key:"reflect",value:function(e){return this.sub(Jr.copy(e).multiplyScalar(2*this.dot(e)))}},{key:"angleTo",value: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(Jn(n,-1,1))}},{key:"distanceTo",value:function(e){return Math.sqrt(this.distanceToSquared(e))}},{key:"distanceToSquared",value:function(e){var t=this.x-e.x,n=this.y-e.y,r=this.z-e.z;return t*t+n*n+r*r}},{key:"manhattanDistanceTo",value:function(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)+Math.abs(this.z-e.z)}},{key:"setFromSpherical",value:function(e){return this.setFromSphericalCoords(e.radius,e.phi,e.theta)}},{key:"setFromSphericalCoords",value:function(e,t,n){var r=Math.sin(t)*e;return this.x=r*Math.sin(n),this.y=Math.cos(t)*e,this.z=r*Math.cos(n),this}},{key:"setFromCylindrical",value:function(e){return this.setFromCylindricalCoords(e.radius,e.theta,e.y)}},{key:"setFromCylindricalCoords",value:function(e,t,n){return this.x=e*Math.sin(t),this.y=n,this.z=e*Math.cos(t),this}},{key:"setFromMatrixPosition",value:function(e){var t=e.elements;return this.x=t[12],this.y=t[13],this.z=t[14],this}},{key:"setFromMatrixScale",value:function(e){var t=this.setFromMatrixColumn(e,0).length(),n=this.setFromMatrixColumn(e,1).length(),r=this.setFromMatrixColumn(e,2).length();return this.x=t,this.y=n,this.z=r,this}},{key:"setFromMatrixColumn",value:function(e,t){return this.fromArray(e.elements,4*t)}},{key:"setFromMatrix3Column",value:function(e,t){return this.fromArray(e.elements,3*t)}},{key:"setFromEuler",value:function(e){return this.x=e._x,this.y=e._y,this.z=e._z,this}},{key:"equals",value:function(e){return e.x===this.x&&e.y===this.y&&e.z===this.z}},{key:"fromArray",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return this.x=e[t],this.y=e[t+1],this.z=e[t+2],this}},{key:"toArray",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return e[t]=this.x,e[t+1]=this.y,e[t+2]=this.z,e}},{key:"fromBufferAttribute",value: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}},{key:"random",value:function(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this}},{key:"randomDirection",value:function(){var e=2*(Math.random()-.5),t=Math.random()*Math.PI*2,n=Math.sqrt(1-Math.pow(e,2));return this.x=n*Math.cos(t),this.y=n*Math.sin(t),this.z=e,this}},{key:Symbol.iterator,value:w().mark(function e(){return w().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.x;case 2:return e.next=4,this.y;case 4:return e.next=6,this.z;case 6:case"end":return e.stop()}},e,this)})}]),t}(),Jr=new Zr,Kr=new Yr,Qr=exports.Box3=function(){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:new Zr(1/0,1/0,1/0),n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new Zr(-1/0,-1/0,-1/0);A(this,e),this.isBox3=!0,this.min=t,this.max=n}return E(e,[{key:"set",value:function(e,t){return this.min.copy(e),this.max.copy(t),this}},{key:"setFromArray",value:function(e){for(var t=1/0,n=1/0,r=1/0,i=-1/0,a=-1/0,o=-1/0,s=0,l=e.length;si&&(i=u),c>a&&(a=c),h>o&&(o=h)}return this.min.set(t,n,r),this.max.set(i,a,o),this}},{key:"setFromBufferAttribute",value:function(e){for(var t=1/0,n=1/0,r=1/0,i=-1/0,a=-1/0,o=-1/0,s=0,l=e.count;si&&(i=u),c>a&&(a=c),h>o&&(o=h)}return this.min.set(t,n,r),this.max.set(i,a,o),this}},{key:"setFromPoints",value:function(e){this.makeEmpty();for(var t=0,n=e.length;t1&&void 0!==arguments[1]&&arguments[1];return this.makeEmpty(),this.expandByObject(e,t)}},{key:"clone",value:function(){return(new this.constructor).copy(this)}},{key:"copy",value:function(e){return this.min.copy(e.min),this.max.copy(e.max),this}},{key:"makeEmpty",value: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}},{key:"isEmpty",value:function(){return this.max.x1&&void 0!==arguments[1]&&arguments[1];e.updateWorldMatrix(!1,!1);var n=e.geometry;if(void 0!==n)if(t&&null!=n.attributes&&void 0!==n.attributes.position)for(var r=n.attributes.position,i=0,a=r.count;ithis.max.x||e.ythis.max.y||e.zthis.max.z)}},{key:"containsBox",value: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}},{key:"getParameter",value:function(e,t){return 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))}},{key:"intersectsBox",value:function(e){return!(e.max.xthis.max.x||e.max.ythis.max.y||e.max.zthis.max.z)}},{key:"intersectsSphere",value:function(e){return this.clampPoint(e.center,ei),ei.distanceToSquared(e.center)<=e.radius*e.radius}},{key:"intersectsPlane",value:function(e){var t,n;return e.normal.x>0?(t=e.normal.x*this.min.x,n=e.normal.x*this.max.x):(t=e.normal.x*this.max.x,n=e.normal.x*this.min.x),e.normal.y>0?(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),e.normal.z>0?(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}},{key:"intersectsTriangle",value:function(e){if(this.isEmpty())return!1;this.getCenter(li),ui.subVectors(this.max,li),ni.subVectors(e.a,li),ri.subVectors(e.b,li),ii.subVectors(e.c,li),ai.subVectors(ri,ni),oi.subVectors(ii,ri),si.subVectors(ni,ii);var t=[0,-ai.z,ai.y,0,-oi.z,oi.y,0,-si.z,si.y,ai.z,0,-ai.x,oi.z,0,-oi.x,si.z,0,-si.x,-ai.y,ai.x,0,-oi.y,oi.x,0,-si.y,si.x,0];return!!di(t,ni,ri,ii,ui)&&(!!di(t=[1,0,0,0,1,0,0,0,1],ni,ri,ii,ui)&&(ci.crossVectors(ai,oi),di(t=[ci.x,ci.y,ci.z],ni,ri,ii,ui)))}},{key:"clampPoint",value:function(e,t){return t.copy(e).clamp(this.min,this.max)}},{key:"distanceToPoint",value:function(e){return ei.copy(e).clamp(this.min,this.max).sub(e).length()}},{key:"getBoundingSphere",value:function(e){return this.getCenter(e.center),e.radius=.5*this.getSize(ei).length(),e}},{key:"intersect",value:function(e){return this.min.max(e.min),this.max.min(e.max),this.isEmpty()&&this.makeEmpty(),this}},{key:"union",value:function(e){return this.min.min(e.min),this.max.max(e.max),this}},{key:"applyMatrix4",value:function(e){return this.isEmpty()?this:($r[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(e),$r[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(e),$r[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(e),$r[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(e),$r[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(e),$r[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(e),$r[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(e),$r[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(e),this.setFromPoints($r),this)}},{key:"translate",value:function(e){return this.min.add(e),this.max.add(e),this}},{key:"equals",value:function(e){return e.min.equals(this.min)&&e.max.equals(this.max)}}]),e}(),$r=[new Zr,new Zr,new Zr,new Zr,new Zr,new Zr,new Zr,new Zr],ei=new Zr,ti=new Qr,ni=new Zr,ri=new Zr,ii=new Zr,ai=new Zr,oi=new Zr,si=new Zr,li=new Zr,ui=new Zr,ci=new Zr,hi=new Zr;function di(e,t,n,r,i){for(var a=0,o=e.length-3;a<=o;a+=3){hi.fromArray(e,a);var s=i.x*Math.abs(hi.x)+i.y*Math.abs(hi.y)+i.z*Math.abs(hi.z),l=t.dot(hi),u=n.dot(hi),c=r.dot(hi);if(Math.max(-Math.max(l,u,c),Math.min(l,u,c))>s)return!1}return!0}var pi=new Qr,fi=new Zr,vi=new Zr,mi=new Zr,gi=exports.Sphere=function(){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:new Zr,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:-1;A(this,e),this.center=t,this.radius=n}return E(e,[{key:"set",value:function(e,t){return this.center.copy(e),this.radius=t,this}},{key:"setFromPoints",value:function(e,t){var n=this.center;void 0!==t?n.copy(t):pi.setFromPoints(e).getCenter(n);for(var r=0,i=0,a=e.length;ithis.radius*this.radius&&(t.sub(this.center).normalize(),t.multiplyScalar(this.radius).add(this.center)),t}},{key:"getBoundingBox",value:function(e){return this.isEmpty()?(e.makeEmpty(),e):(e.set(this.center,this.center),e.expandByScalar(this.radius),e)}},{key:"applyMatrix4",value:function(e){return this.center.applyMatrix4(e),this.radius=this.radius*e.getMaxScaleOnAxis(),this}},{key:"translate",value:function(e){return this.center.add(e),this}},{key:"expandByPoint",value:function(e){mi.subVectors(e,this.center);var t=mi.lengthSq();if(t>this.radius*this.radius){var n=Math.sqrt(t),r=.5*(n-this.radius);this.center.add(mi.multiplyScalar(r/n)),this.radius+=r}return this}},{key:"union",value:function(e){return!0===this.center.equals(e.center)?vi.set(0,0,1).multiplyScalar(e.radius):vi.subVectors(e.center,this.center).normalize().multiplyScalar(e.radius),this.expandByPoint(fi.copy(e.center).add(vi)),this.expandByPoint(fi.copy(e.center).sub(vi)),this}},{key:"equals",value:function(e){return e.center.equals(this.center)&&e.radius===this.radius}},{key:"clone",value:function(){return(new this.constructor).copy(this)}}]),e}(),yi=new Zr,xi=new Zr,_i=new Zr,Mi=new Zr,bi=new Zr,Si=new Zr,wi=new Zr,Ti=exports.Ray=function(){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:new Zr,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new Zr(0,0,-1);A(this,e),this.origin=t,this.direction=n}return E(e,[{key:"set",value:function(e,t){return this.origin.copy(e),this.direction.copy(t),this}},{key:"copy",value:function(e){return this.origin.copy(e.origin),this.direction.copy(e.direction),this}},{key:"at",value:function(e,t){return t.copy(this.direction).multiplyScalar(e).add(this.origin)}},{key:"lookAt",value:function(e){return this.direction.copy(e).sub(this.origin).normalize(),this}},{key:"recast",value:function(e){return this.origin.copy(this.at(e,yi)),this}},{key:"closestPointToPoint",value:function(e,t){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)}},{key:"distanceToPoint",value:function(e){return Math.sqrt(this.distanceSqToPoint(e))}},{key:"distanceSqToPoint",value:function(e){var t=yi.subVectors(e,this.origin).dot(this.direction);return t<0?this.origin.distanceToSquared(e):(yi.copy(this.direction).multiplyScalar(t).add(this.origin),yi.distanceToSquared(e))}},{key:"distanceSqToSegment",value:function(e,t,n,r){xi.copy(e).add(t).multiplyScalar(.5),_i.copy(t).sub(e).normalize(),Mi.copy(this.origin).sub(xi);var i,a,o,s,l=.5*e.distanceTo(t),u=-this.direction.dot(_i),c=Mi.dot(this.direction),h=-Mi.dot(_i),d=Mi.lengthSq(),p=Math.abs(1-u*u);if(p>0)if(a=u*c-h,s=l*p,(i=u*h-c)>=0)if(a>=-s)if(a<=s){var f=1/p;o=(i*=f)*(i+u*(a*=f)+2*c)+a*(u*i+a+2*h)+d}else a=l,o=-(i=Math.max(0,-(u*a+c)))*i+a*(a+2*h)+d;else a=-l,o=-(i=Math.max(0,-(u*a+c)))*i+a*(a+2*h)+d;else a<=-s?o=-(i=Math.max(0,-(-u*l+c)))*i+(a=i>0?-l:Math.min(Math.max(-l,-h),l))*(a+2*h)+d:a<=s?(i=0,o=(a=Math.min(Math.max(-l,-h),l))*(a+2*h)+d):o=-(i=Math.max(0,-(u*l+c)))*i+(a=i>0?l:Math.min(Math.max(-l,-h),l))*(a+2*h)+d;else a=u>0?-l:l,o=-(i=Math.max(0,-(u*a+c)))*i+a*(a+2*h)+d;return n&&n.copy(this.direction).multiplyScalar(i).add(this.origin),r&&r.copy(_i).multiplyScalar(a).add(xi),o}},{key:"intersectSphere",value:function(e,t){yi.subVectors(e.center,this.origin);var n=yi.dot(this.direction),r=yi.dot(yi)-n*n,i=e.radius*e.radius;if(r>i)return null;var a=Math.sqrt(i-r),o=n-a,s=n+a;return o<0&&s<0?null:o<0?this.at(s,t):this.at(o,t)}},{key:"intersectsSphere",value:function(e){return this.distanceSqToPoint(e.center)<=e.radius*e.radius}},{key:"distanceToPlane",value: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 n>=0?n:null}},{key:"intersectPlane",value:function(e,t){var n=this.distanceToPlane(e);return null===n?null:this.at(n,t)}},{key:"intersectsPlane",value:function(e){var t=e.distanceToPoint(this.origin);return 0===t||e.normal.dot(this.direction)*t<0}},{key:"intersectBox",value:function(e,t){var n,r,i,a,o,s,l=1/this.direction.x,u=1/this.direction.y,c=1/this.direction.z,h=this.origin;return l>=0?(n=(e.min.x-h.x)*l,r=(e.max.x-h.x)*l):(n=(e.max.x-h.x)*l,r=(e.min.x-h.x)*l),u>=0?(i=(e.min.y-h.y)*u,a=(e.max.y-h.y)*u):(i=(e.max.y-h.y)*u,a=(e.min.y-h.y)*u),n>a||i>r?null:((i>n||n!=n)&&(n=i),(a=0?(o=(e.min.z-h.z)*c,s=(e.max.z-h.z)*c):(o=(e.max.z-h.z)*c,s=(e.min.z-h.z)*c),n>s||o>r?null:((o>n||n!=n)&&(n=o),(s=0?n:r,t)))}},{key:"intersectsBox",value:function(e){return null!==this.intersectBox(e,yi)}},{key:"intersectTriangle",value:function(e,t,n,r,i){bi.subVectors(t,e),Si.subVectors(n,e),wi.crossVectors(bi,Si);var a,o=this.direction.dot(wi);if(o>0){if(r)return null;a=1}else{if(!(o<0))return null;a=-1,o=-o}Mi.subVectors(this.origin,e);var s=a*this.direction.dot(Si.crossVectors(Mi,Si));if(s<0)return null;var l=a*this.direction.dot(bi.cross(Mi));if(l<0)return null;if(s+l>o)return null;var u=-a*Mi.dot(wi);return u<0?null:this.at(u/o,i)}},{key:"applyMatrix4",value:function(e){return this.origin.applyMatrix4(e),this.direction.transformDirection(e),this}},{key:"equals",value:function(e){return e.origin.equals(this.origin)&&e.direction.equals(this.direction)}},{key:"clone",value:function(){return(new this.constructor).copy(this)}}]),e}(),Ai=exports.Matrix4=function(){function e(){A(this,e),e.prototype.isMatrix4=!0,this.elements=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],arguments.length>0&&console.error("THREE.Matrix4: the constructor no longer reads arguments. use .set() instead.")}return E(e,[{key:"set",value:function(e,t,n,r,i,a,o,s,l,u,c,h,d,p,f,v){var m=this.elements;return m[0]=e,m[4]=t,m[8]=n,m[12]=r,m[1]=i,m[5]=a,m[9]=o,m[13]=s,m[2]=l,m[6]=u,m[10]=c,m[14]=h,m[3]=d,m[7]=p,m[11]=f,m[15]=v,this}},{key:"identity",value:function(){return this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1),this}},{key:"clone",value:function(){return(new e).fromArray(this.elements)}},{key:"copy",value: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}},{key:"copyPosition",value:function(e){var t=this.elements,n=e.elements;return t[12]=n[12],t[13]=n[13],t[14]=n[14],this}},{key:"setFromMatrix3",value:function(e){var t=e.elements;return this.set(t[0],t[3],t[6],0,t[1],t[4],t[7],0,t[2],t[5],t[8],0,0,0,0,1),this}},{key:"extractBasis",value:function(e,t,n){return e.setFromMatrixColumn(this,0),t.setFromMatrixColumn(this,1),n.setFromMatrixColumn(this,2),this}},{key:"makeBasis",value: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}},{key:"extractRotation",value:function(e){var t=this.elements,n=e.elements,r=1/ki.setFromMatrixColumn(e,0).length(),i=1/ki.setFromMatrixColumn(e,1).length(),a=1/ki.setFromMatrixColumn(e,2).length();return t[0]=n[0]*r,t[1]=n[1]*r,t[2]=n[2]*r,t[3]=0,t[4]=n[4]*i,t[5]=n[5]*i,t[6]=n[6]*i,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}},{key:"makeRotationFromEuler",value: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,r=e.y,i=e.z,a=Math.cos(n),o=Math.sin(n),s=Math.cos(r),l=Math.sin(r),u=Math.cos(i),c=Math.sin(i);if("XYZ"===e.order){var h=a*u,d=a*c,p=o*u,f=o*c;t[0]=s*u,t[4]=-s*c,t[8]=l,t[1]=d+p*l,t[5]=h-f*l,t[9]=-o*s,t[2]=f-h*l,t[6]=p+d*l,t[10]=a*s}else if("YXZ"===e.order){var v=s*u,m=s*c,g=l*u,y=l*c;t[0]=v+y*o,t[4]=g*o-m,t[8]=a*l,t[1]=a*c,t[5]=a*u,t[9]=-o,t[2]=m*o-g,t[6]=y+v*o,t[10]=a*s}else if("ZXY"===e.order){var x=s*u,_=s*c,M=l*u,b=l*c;t[0]=x-b*o,t[4]=-a*c,t[8]=M+_*o,t[1]=_+M*o,t[5]=a*u,t[9]=b-x*o,t[2]=-a*l,t[6]=o,t[10]=a*s}else if("ZYX"===e.order){var S=a*u,w=a*c,T=o*u,A=o*c;t[0]=s*u,t[4]=T*l-w,t[8]=S*l+A,t[1]=s*c,t[5]=A*l+S,t[9]=w*l-T,t[2]=-l,t[6]=o*s,t[10]=a*s}else if("YZX"===e.order){var k=a*s,E=a*l,C=o*s,L=o*l;t[0]=s*u,t[4]=L-k*c,t[8]=C*c+E,t[1]=c,t[5]=a*u,t[9]=-o*u,t[2]=-l*u,t[6]=E*c+C,t[10]=k-L*c}else if("XZY"===e.order){var R=a*s,P=a*l,I=o*s,D=o*l;t[0]=s*u,t[4]=-c,t[8]=l*u,t[1]=R*c+D,t[5]=a*u,t[9]=P*c-I,t[2]=I*c-P,t[6]=o*u,t[10]=D*c+R}return t[3]=0,t[7]=0,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this}},{key:"makeRotationFromQuaternion",value:function(e){return this.compose(Ci,e,Li)}},{key:"lookAt",value:function(e,t,n){var r=this.elements;return Ii.subVectors(e,t),0===Ii.lengthSq()&&(Ii.z=1),Ii.normalize(),Ri.crossVectors(n,Ii),0===Ri.lengthSq()&&(1===Math.abs(n.z)?Ii.x+=1e-4:Ii.z+=1e-4,Ii.normalize(),Ri.crossVectors(n,Ii)),Ri.normalize(),Pi.crossVectors(Ii,Ri),r[0]=Ri.x,r[4]=Pi.x,r[8]=Ii.x,r[1]=Ri.y,r[5]=Pi.y,r[9]=Ii.y,r[2]=Ri.z,r[6]=Pi.z,r[10]=Ii.z,this}},{key:"multiply",value: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)}},{key:"premultiply",value:function(e){return this.multiplyMatrices(e,this)}},{key:"multiplyMatrices",value:function(e,t){var n=e.elements,r=t.elements,i=this.elements,a=n[0],o=n[4],s=n[8],l=n[12],u=n[1],c=n[5],h=n[9],d=n[13],p=n[2],f=n[6],v=n[10],m=n[14],g=n[3],y=n[7],x=n[11],_=n[15],M=r[0],b=r[4],S=r[8],w=r[12],T=r[1],A=r[5],k=r[9],E=r[13],C=r[2],L=r[6],R=r[10],P=r[14],I=r[3],D=r[7],N=r[11],O=r[15];return i[0]=a*M+o*T+s*C+l*I,i[4]=a*b+o*A+s*L+l*D,i[8]=a*S+o*k+s*R+l*N,i[12]=a*w+o*E+s*P+l*O,i[1]=u*M+c*T+h*C+d*I,i[5]=u*b+c*A+h*L+d*D,i[9]=u*S+c*k+h*R+d*N,i[13]=u*w+c*E+h*P+d*O,i[2]=p*M+f*T+v*C+m*I,i[6]=p*b+f*A+v*L+m*D,i[10]=p*S+f*k+v*R+m*N,i[14]=p*w+f*E+v*P+m*O,i[3]=g*M+y*T+x*C+_*I,i[7]=g*b+y*A+x*L+_*D,i[11]=g*S+y*k+x*R+_*N,i[15]=g*w+y*E+x*P+_*O,this}},{key:"multiplyScalar",value: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}},{key:"determinant",value:function(){var e=this.elements,t=e[0],n=e[4],r=e[8],i=e[12],a=e[1],o=e[5],s=e[9],l=e[13],u=e[2],c=e[6],h=e[10],d=e[14];return e[3]*(+i*s*c-r*l*c-i*o*h+n*l*h+r*o*d-n*s*d)+e[7]*(+t*s*d-t*l*h+i*a*h-r*a*d+r*l*u-i*s*u)+e[11]*(+t*l*c-t*o*d-i*a*c+n*a*d+i*o*u-n*l*u)+e[15]*(-r*o*u-t*s*c+t*o*h+r*a*c-n*a*h+n*s*u)}},{key:"transpose",value: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}},{key:"setPosition",value:function(e,t,n){var r=this.elements;return e.isVector3?(r[12]=e.x,r[13]=e.y,r[14]=e.z):(r[12]=e,r[13]=t,r[14]=n),this}},{key:"invert",value:function(){var e=this.elements,t=e[0],n=e[1],r=e[2],i=e[3],a=e[4],o=e[5],s=e[6],l=e[7],u=e[8],c=e[9],h=e[10],d=e[11],p=e[12],f=e[13],v=e[14],m=e[15],g=c*v*l-f*h*l+f*s*d-o*v*d-c*s*m+o*h*m,y=p*h*l-u*v*l-p*s*d+a*v*d+u*s*m-a*h*m,x=u*f*l-p*c*l+p*o*d-a*f*d-u*o*m+a*c*m,_=p*c*s-u*f*s-p*o*h+a*f*h+u*o*v-a*c*v,M=t*g+n*y+r*x+i*_;if(0===M)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);var b=1/M;return e[0]=g*b,e[1]=(f*h*i-c*v*i-f*r*d+n*v*d+c*r*m-n*h*m)*b,e[2]=(o*v*i-f*s*i+f*r*l-n*v*l-o*r*m+n*s*m)*b,e[3]=(c*s*i-o*h*i-c*r*l+n*h*l+o*r*d-n*s*d)*b,e[4]=y*b,e[5]=(u*v*i-p*h*i+p*r*d-t*v*d-u*r*m+t*h*m)*b,e[6]=(p*s*i-a*v*i-p*r*l+t*v*l+a*r*m-t*s*m)*b,e[7]=(a*h*i-u*s*i+u*r*l-t*h*l-a*r*d+t*s*d)*b,e[8]=x*b,e[9]=(p*c*i-u*f*i-p*n*d+t*f*d+u*n*m-t*c*m)*b,e[10]=(a*f*i-p*o*i+p*n*l-t*f*l-a*n*m+t*o*m)*b,e[11]=(u*o*i-a*c*i-u*n*l+t*c*l+a*n*d-t*o*d)*b,e[12]=_*b,e[13]=(u*f*r-p*c*r+p*n*h-t*f*h-u*n*v+t*c*v)*b,e[14]=(p*o*r-a*f*r-p*n*s+t*f*s+a*n*v-t*o*v)*b,e[15]=(a*c*r-u*o*r+u*n*s-t*c*s-a*n*h+t*o*h)*b,this}},{key:"scale",value:function(e){var t=this.elements,n=e.x,r=e.y,i=e.z;return t[0]*=n,t[4]*=r,t[8]*=i,t[1]*=n,t[5]*=r,t[9]*=i,t[2]*=n,t[6]*=r,t[10]*=i,t[3]*=n,t[7]*=r,t[11]*=i,this}},{key:"getMaxScaleOnAxis",value: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],r=e[8]*e[8]+e[9]*e[9]+e[10]*e[10];return Math.sqrt(Math.max(t,n,r))}},{key:"makeTranslation",value:function(e,t,n){return this.set(1,0,0,e,0,1,0,t,0,0,1,n,0,0,0,1),this}},{key:"makeRotationX",value: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}},{key:"makeRotationY",value: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}},{key:"makeRotationZ",value: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}},{key:"makeRotationAxis",value:function(e,t){var n=Math.cos(t),r=Math.sin(t),i=1-n,a=e.x,o=e.y,s=e.z,l=i*a,u=i*o;return this.set(l*a+n,l*o-r*s,l*s+r*o,0,l*o+r*s,u*o+n,u*s-r*a,0,l*s-r*o,u*s+r*a,i*s*s+n,0,0,0,0,1),this}},{key:"makeScale",value:function(e,t,n){return this.set(e,0,0,0,0,t,0,0,0,0,n,0,0,0,0,1),this}},{key:"makeShear",value:function(e,t,n,r,i,a){return this.set(1,n,i,0,e,1,a,0,t,r,1,0,0,0,0,1),this}},{key:"compose",value:function(e,t,n){var r=this.elements,i=t._x,a=t._y,o=t._z,s=t._w,l=i+i,u=a+a,c=o+o,h=i*l,d=i*u,p=i*c,f=a*u,v=a*c,m=o*c,g=s*l,y=s*u,x=s*c,_=n.x,M=n.y,b=n.z;return r[0]=(1-(f+m))*_,r[1]=(d+x)*_,r[2]=(p-y)*_,r[3]=0,r[4]=(d-x)*M,r[5]=(1-(h+m))*M,r[6]=(v+g)*M,r[7]=0,r[8]=(p+y)*b,r[9]=(v-g)*b,r[10]=(1-(h+f))*b,r[11]=0,r[12]=e.x,r[13]=e.y,r[14]=e.z,r[15]=1,this}},{key:"decompose",value:function(e,t,n){var r=this.elements,i=ki.set(r[0],r[1],r[2]).length(),a=ki.set(r[4],r[5],r[6]).length(),o=ki.set(r[8],r[9],r[10]).length();this.determinant()<0&&(i=-i),e.x=r[12],e.y=r[13],e.z=r[14],Ei.copy(this);var s=1/i,l=1/a,u=1/o;return Ei.elements[0]*=s,Ei.elements[1]*=s,Ei.elements[2]*=s,Ei.elements[4]*=l,Ei.elements[5]*=l,Ei.elements[6]*=l,Ei.elements[8]*=u,Ei.elements[9]*=u,Ei.elements[10]*=u,t.setFromRotationMatrix(Ei),n.x=i,n.y=a,n.z=o,this}},{key:"makePerspective",value:function(e,t,n,r,i,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*i/(t-e),l=2*i/(n-r),u=(t+e)/(t-e),c=(n+r)/(n-r),h=-(a+i)/(a-i),d=-2*a*i/(a-i);return o[0]=s,o[4]=0,o[8]=u,o[12]=0,o[1]=0,o[5]=l,o[9]=c,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}},{key:"makeOrthographic",value:function(e,t,n,r,i,a){var o=this.elements,s=1/(t-e),l=1/(n-r),u=1/(a-i),c=(t+e)*s,h=(n+r)*l,d=(a+i)*u;return o[0]=2*s,o[4]=0,o[8]=0,o[12]=-c,o[1]=0,o[5]=2*l,o[9]=0,o[13]=-h,o[2]=0,o[6]=0,o[10]=-2*u,o[14]=-d,o[3]=0,o[7]=0,o[11]=0,o[15]=1,this}},{key:"equals",value:function(e){for(var t=this.elements,n=e.elements,r=0;r<16;r++)if(t[r]!==n[r])return!1;return!0}},{key:"fromArray",value:function(e){for(var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=0;n<16;n++)this.elements[n]=e[n+t];return this}},{key:"toArray",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,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}}]),e}(),ki=new Zr,Ei=new Ai,Ci=new Zr(0,0,0),Li=new Zr(1,1,1),Ri=new Zr,Pi=new Zr,Ii=new Zr,Di=new Ai,Ni=new Yr,Oi=exports.Euler=function(e){function t(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:t.DefaultOrder;A(this,t),this.isEuler=!0,this._x=e,this._y=n,this._z=r,this._order=i}return E(t,[{key:"x",get:function(){return this._x},set:function(e){this._x=e,this._onChangeCallback()}},{key:"y",get:function(){return this._y},set:function(e){this._y=e,this._onChangeCallback()}},{key:"z",get:function(){return this._z},set:function(e){this._z=e,this._onChangeCallback()}},{key:"order",get:function(){return this._order},set:function(e){this._order=e,this._onChangeCallback()}},{key:"set",value:function(e,t,n){var r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:this._order;return this._x=e,this._y=t,this._z=n,this._order=r,this._onChangeCallback(),this}},{key:"clone",value:function(){return new this.constructor(this._x,this._y,this._z,this._order)}},{key:"copy",value:function(e){return this._x=e._x,this._y=e._y,this._z=e._z,this._order=e._order,this._onChangeCallback(),this}},{key:"setFromRotationMatrix",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this._order,n=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],r=e.elements,i=r[0],a=r[4],o=r[8],s=r[1],l=r[5],u=r[9],c=r[2],h=r[6],d=r[10];switch(t){case"XYZ":this._y=Math.asin(Jn(o,-1,1)),Math.abs(o)<.9999999?(this._x=Math.atan2(-u,d),this._z=Math.atan2(-a,i)):(this._x=Math.atan2(h,l),this._z=0);break;case"YXZ":this._x=Math.asin(-Jn(u,-1,1)),Math.abs(u)<.9999999?(this._y=Math.atan2(o,d),this._z=Math.atan2(s,l)):(this._y=Math.atan2(-c,i),this._z=0);break;case"ZXY":this._x=Math.asin(Jn(h,-1,1)),Math.abs(h)<.9999999?(this._y=Math.atan2(-c,d),this._z=Math.atan2(-a,l)):(this._y=0,this._z=Math.atan2(s,i));break;case"ZYX":this._y=Math.asin(-Jn(c,-1,1)),Math.abs(c)<.9999999?(this._x=Math.atan2(h,d),this._z=Math.atan2(s,i)):(this._x=0,this._z=Math.atan2(-a,l));break;case"YZX":this._z=Math.asin(Jn(s,-1,1)),Math.abs(s)<.9999999?(this._x=Math.atan2(-u,l),this._y=Math.atan2(-c,i)):(this._x=0,this._y=Math.atan2(o,d));break;case"XZY":this._z=Math.asin(-Jn(a,-1,1)),Math.abs(a)<.9999999?(this._x=Math.atan2(h,l),this._y=Math.atan2(o,i)):(this._x=Math.atan2(-u,d),this._y=0);break;default:console.warn("THREE.Euler: .setFromRotationMatrix() encountered an unknown order: "+t)}return this._order=t,!0===n&&this._onChangeCallback(),this}},{key:"setFromQuaternion",value:function(e,t,n){return Di.makeRotationFromQuaternion(e),this.setFromRotationMatrix(Di,t,n)}},{key:"setFromVector3",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this._order;return this.set(e.x,e.y,e.z,t)}},{key:"reorder",value:function(e){return Ni.setFromEuler(this),this.setFromQuaternion(Ni,e)}},{key:"equals",value:function(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._order===this._order}},{key:"fromArray",value: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}},{key:"toArray",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return e[t]=this._x,e[t+1]=this._y,e[t+2]=this._z,e[t+3]=this._order,e}},{key:"_onChange",value:function(e){return this._onChangeCallback=e,this}},{key:"_onChangeCallback",value:function(){}},{key:Symbol.iterator,value:w().mark(function e(){return w().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this._x;case 2:return e.next=4,this._y;case 4:return e.next=6,this._z;case 6:return e.next=8,this._order;case 8:case"end":return e.stop()}},e,this)})},{key:"toVector3",value:function(){console.error("THREE.Euler: .toVector3() has been removed. Use Vector3.setFromEuler() instead")}}]),t}();Oi.DefaultOrder="XYZ",Oi.RotationOrders=["XYZ","YZX","ZXY","XZY","YXZ","ZYX"];var Fi=exports.Layers=function(){function e(){A(this,e),this.mask=1}return E(e,[{key:"set",value:function(e){this.mask=(1<>>0}},{key:"enable",value:function(e){this.mask|=1<1){for(var t=0;t1){for(var t=0;t0){r.children=[];for(var p=0;p0){r.animations=[];for(var f=0;f0&&(n.geometries=m),g.length>0&&(n.materials=g),y.length>0&&(n.textures=y),x.length>0&&(n.images=x),_.length>0&&(n.shapes=_),M.length>0&&(n.skeletons=M),b.length>0&&(n.animations=b),S.length>0&&(n.nodes=S)}return n.object=r,n;function w(e){var t=[];for(var n in e){var r=e[n];delete r.metadata,t.push(r)}return t}}},{key:"clone",value:function(e){return(new this.constructor).copy(this,e)}},{key:"copy",value:function(e){var t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];if(this.name=e.name,this.up.copy(e.up),this.position.copy(e.position),this.rotation.order=e.rotation.order,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;n0&&void 0!==arguments[0]?arguments[0]:new Zr,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new Zr,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:new Zr;A(this,e),this.a=t,this.b=n,this.c=r}return E(e,[{key:"set",value:function(e,t,n){return this.a.copy(e),this.b.copy(t),this.c.copy(n),this}},{key:"setFromPointsAndIndices",value:function(e,t,n,r){return this.a.copy(e[t]),this.b.copy(e[n]),this.c.copy(e[r]),this}},{key:"setFromAttributeAndIndices",value:function(e,t,n,r){return this.a.fromBufferAttribute(e,t),this.b.fromBufferAttribute(e,n),this.c.fromBufferAttribute(e,r),this}},{key:"clone",value:function(){return(new this.constructor).copy(this)}},{key:"copy",value:function(e){return this.a.copy(e.a),this.b.copy(e.b),this.c.copy(e.c),this}},{key:"getArea",value:function(){return Qi.subVectors(this.c,this.b),$i.subVectors(this.a,this.b),.5*Qi.cross($i).length()}},{key:"getMidpoint",value:function(e){return e.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)}},{key:"getNormal",value:function(t){return e.getNormal(this.a,this.b,this.c,t)}},{key:"getPlane",value:function(e){return e.setFromCoplanarPoints(this.a,this.b,this.c)}},{key:"getBarycoord",value:function(t,n){return e.getBarycoord(t,this.a,this.b,this.c,n)}},{key:"getUV",value:function(t,n,r,i,a){return e.getUV(t,this.a,this.b,this.c,n,r,i,a)}},{key:"containsPoint",value:function(t){return e.containsPoint(t,this.a,this.b,this.c)}},{key:"isFrontFacing",value:function(t){return e.isFrontFacing(this.a,this.b,this.c,t)}},{key:"intersectsBox",value:function(e){return e.intersectsTriangle(this)}},{key:"closestPointToPoint",value:function(e,t){var n,r,i=this.a,a=this.b,o=this.c;na.subVectors(a,i),ra.subVectors(o,i),aa.subVectors(e,i);var s=na.dot(aa),l=ra.dot(aa);if(s<=0&&l<=0)return t.copy(i);oa.subVectors(e,a);var u=na.dot(oa),c=ra.dot(oa);if(u>=0&&c<=u)return t.copy(a);var h=s*c-u*l;if(h<=0&&s>=0&&u<=0)return n=s/(s-u),t.copy(i).addScaledVector(na,n);sa.subVectors(e,o);var d=na.dot(sa),p=ra.dot(sa);if(p>=0&&d<=p)return t.copy(o);var f=d*l-s*p;if(f<=0&&l>=0&&p<=0)return r=l/(l-p),t.copy(i).addScaledVector(ra,r);var v=u*p-d*c;if(v<=0&&c-u>=0&&d-p>=0)return ia.subVectors(o,a),r=(c-u)/(c-u+(d-p)),t.copy(a).addScaledVector(ia,r);var m=1/(v+f+h);return n=f*m,r=h*m,t.copy(i).addScaledVector(na,n).addScaledVector(ra,r)}},{key:"equals",value:function(e){return e.a.equals(this.a)&&e.b.equals(this.b)&&e.c.equals(this.c)}}],[{key:"getNormal",value:function(e,t,n,r){r.subVectors(n,t),Qi.subVectors(e,t),r.cross(Qi);var i=r.lengthSq();return i>0?r.multiplyScalar(1/Math.sqrt(i)):r.set(0,0,0)}},{key:"getBarycoord",value:function(e,t,n,r,i){Qi.subVectors(r,t),$i.subVectors(n,t),ea.subVectors(e,t);var a=Qi.dot(Qi),o=Qi.dot($i),s=Qi.dot(ea),l=$i.dot($i),u=$i.dot(ea),c=a*l-o*o;if(0===c)return i.set(-2,-1,-1);var h=1/c,d=(l*s-o*u)*h,p=(a*u-o*s)*h;return i.set(1-d-p,p,d)}},{key:"containsPoint",value:function(e,t,n,r){return this.getBarycoord(e,t,n,r,ta),ta.x>=0&&ta.y>=0&&ta.x+ta.y<=1}},{key:"getUV",value:function(e,t,n,r,i,a,o,s){return this.getBarycoord(e,t,n,r,ta),s.set(0,0),s.addScaledVector(i,ta.x),s.addScaledVector(a,ta.y),s.addScaledVector(o,ta.z),s}},{key:"isFrontFacing",value:function(e,t,n,r){return Qi.subVectors(n,t),$i.subVectors(e,t),Qi.cross($i).dot(r)<0}}]),e}(),ua=0,ca=exports.Material=function(e){m(n,Wn);var t=y(n);function n(){var e;return A(this,n),(e=t.call(this)).isMaterial=!0,Object.defineProperty(_(e),"id",{value:ua++}),e.uuid=Zn(),e.name="",e.type="Material",e.blending=Y,e.side=V,e.vertexColors=!1,e.opacity=1,e.transparent=!1,e.blendSrc=le,e.blendDst=ue,e.blendEquation=$,e.blendSrcAlpha=null,e.blendDstAlpha=null,e.blendEquationAlpha=null,e.depthFunc=ye,e.depthTest=!0,e.depthWrite=!0,e.stencilWriteMask=255,e.stencilFunc=Rn,e.stencilRef=0,e.stencilFuncMask=255,e.stencilFail=gn,e.stencilZFail=gn,e.stencilZPass=gn,e.stencilWrite=!1,e.clippingPlanes=null,e.clipIntersection=!1,e.clipShadows=!1,e.shadowSide=null,e.colorWrite=!0,e.precision=null,e.polygonOffset=!1,e.polygonOffsetFactor=0,e.polygonOffsetUnits=0,e.dithering=!1,e.alphaToCoverage=!1,e.premultipliedAlpha=!1,e.visible=!0,e.toneMapped=!0,e.userData={},e.version=0,e._alphaTest=0,e}return E(n,[{key:"alphaTest",get:function(){return this._alphaTest},set:function(e){this._alphaTest>0!=e>0&&this.version++,this._alphaTest=e}},{key:"onBuild",value:function(){}},{key:"onBeforeRender",value:function(){}},{key:"onBeforeCompile",value:function(){}},{key:"customProgramCacheKey",value:function(){return this.onBeforeCompile.toString()}},{key:"setValues",value:function(e){if(void 0!==e)for(var t in e){var n=e[t];if(void 0!==n)if("shading"!==t){var r=this[t];void 0!==r?r&&r.isColor?r.set(n):r&&r.isVector3&&n&&n.isVector3?r.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=n===j;else console.warn("THREE.Material: '"+t+"' parameter is undefined.")}}},{key:"toJSON",value: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 r(e){var t=[];for(var n in e){var r=e[n];delete r.metadata,t.push(r)}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),void 0!==this.sheen&&(n.sheen=this.sheen),this.sheenColor&&this.sheenColor.isColor&&(n.sheenColor=this.sheenColor.getHex()),void 0!==this.sheenRoughness&&(n.sheenRoughness=this.sheenRoughness),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.specularIntensity&&(n.specularIntensity=this.specularIntensity),this.specularColor&&this.specularColor.isColor&&(n.specularColor=this.specularColor.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()),void 0!==this.iridescence&&(n.iridescence=this.iridescence),void 0!==this.iridescenceIOR&&(n.iridescenceIOR=this.iridescenceIOR),void 0!==this.iridescenceThicknessRange&&(n.iridescenceThicknessRange=this.iridescenceThicknessRange),this.iridescenceMap&&this.iridescenceMap.isTexture&&(n.iridescenceMap=this.iridescenceMap.toJSON(e).uuid),this.iridescenceThicknessMap&&this.iridescenceThicknessMap.isTexture&&(n.iridescenceThicknessMap=this.iridescenceThicknessMap.toJSON(e).uuid),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,n.lightMapIntensity=this.lightMapIntensity),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.specularIntensityMap&&this.specularIntensityMap.isTexture&&(n.specularIntensityMap=this.specularIntensityMap.toJSON(e).uuid),this.specularColorMap&&this.specularColorMap.isTexture&&(n.specularColorMap=this.specularColorMap.toJSON(e).uuid),this.envMap&&this.envMap.isTexture&&(n.envMap=this.envMap.toJSON(e).uuid,void 0!==this.combine&&(n.combine=this.combine)),void 0!==this.envMapIntensity&&(n.envMapIntensity=this.envMapIntensity),void 0!==this.reflectivity&&(n.reflectivity=this.reflectivity),void 0!==this.refractionRatio&&(n.refractionRatio=this.refractionRatio),this.gradientMap&&this.gradientMap.isTexture&&(n.gradientMap=this.gradientMap.toJSON(e).uuid),void 0!==this.transmission&&(n.transmission=this.transmission),this.transmissionMap&&this.transmissionMap.isTexture&&(n.transmissionMap=this.transmissionMap.toJSON(e).uuid),void 0!==this.thickness&&(n.thickness=this.thickness),this.thicknessMap&&this.thicknessMap.isTexture&&(n.thicknessMap=this.thicknessMap.toJSON(e).uuid),void 0!==this.attenuationDistance&&(n.attenuationDistance=this.attenuationDistance),void 0!==this.attenuationColor&&(n.attenuationColor=this.attenuationColor.getHex()),void 0!==this.size&&(n.size=this.size),null!==this.shadowSide&&(n.shadowSide=this.shadowSide),void 0!==this.sizeAttenuation&&(n.sizeAttenuation=this.sizeAttenuation),this.blending!==Y&&(n.blending=this.blending),this.side!==V&&(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.colorWrite=this.colorWrite,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,void 0!==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),void 0!==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),this.alphaTest>0&&(n.alphaTest=this.alphaTest),!0===this.alphaToCoverage&&(n.alphaToCoverage=this.alphaToCoverage),!0===this.premultipliedAlpha&&(n.premultipliedAlpha=this.premultipliedAlpha),!0===this.wireframe&&(n.wireframe=this.wireframe),this.wireframeLinewidth>1&&(n.wireframeLinewidth=this.wireframeLinewidth),"round"!==this.wireframeLinecap&&(n.wireframeLinecap=this.wireframeLinecap),"round"!==this.wireframeLinejoin&&(n.wireframeLinejoin=this.wireframeLinejoin),!0===this.flatShading&&(n.flatShading=this.flatShading),!1===this.visible&&(n.visible=!1),!1===this.toneMapped&&(n.toneMapped=!1),!1===this.fog&&(n.fog=!1),"{}"!==JSON.stringify(this.userData)&&(n.userData=this.userData),t){var i=r(e.textures),a=r(e.images);i.length>0&&(n.textures=i),a.length>0&&(n.images=a)}return n}},{key:"clone",value:function(){return(new this.constructor).copy(this)}},{key:"copy",value:function(e){this.name=e.name,this.blending=e.blending,this.side=e.side,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 r=t.length;n=new Array(r);for(var i=0;i!==r;++i)n[i]=t[i].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.alphaToCoverage=e.alphaToCoverage,this.premultipliedAlpha=e.premultipliedAlpha,this.visible=e.visible,this.toneMapped=e.toneMapped,this.userData=JSON.parse(JSON.stringify(e.userData)),this}},{key:"dispose",value:function(){this.dispatchEvent({type:"dispose"})}},{key:"needsUpdate",set:function(e){!0===e&&this.version++}}]),n}(),ha=exports.MeshBasicMaterial=function(e){m(n,ca);var t=y(n);function n(e){var r;return A(this,n),(r=t.call(this)).isMeshBasicMaterial=!0,r.type="MeshBasicMaterial",r.color=new Nr(16777215),r.map=null,r.lightMap=null,r.lightMapIntensity=1,r.aoMap=null,r.aoMapIntensity=1,r.specularMap=null,r.alphaMap=null,r.envMap=null,r.combine=Se,r.reflectivity=1,r.refractionRatio=.98,r.wireframe=!1,r.wireframeLinewidth=1,r.wireframeLinecap="round",r.wireframeLinejoin="round",r.fog=!0,r.setValues(e),r}return E(n,[{key:"copy",value:function(e){return f(b(n.prototype),"copy",this).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.fog=e.fog,this}}]),n}(),da=new Zr,pa=new yr,fa=exports.BufferAttribute=function(){function e(t,n,r){if(A(this,e),Array.isArray(t))throw new TypeError("THREE.BufferAttribute: array should be a Typed Array.");this.isBufferAttribute=!0,this.name="",this.array=t,this.itemSize=n,this.count=void 0!==t?t.length/n:0,this.normalized=!0===r,this.usage=Pn,this.updateRange={offset:0,count:-1},this.version=0}return E(e,[{key:"onUploadCallback",value:function(){}},{key:"needsUpdate",set:function(e){!0===e&&this.version++}},{key:"setUsage",value:function(e){return this.usage=e,this}},{key:"copy",value: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}},{key:"copyAt",value:function(e,t,n){e*=this.itemSize,n*=t.itemSize;for(var r=0,i=this.itemSize;r1&&void 0!==arguments[1]?arguments[1]:0;return this.array.set(e,t),this}},{key:"getX",value:function(e){return this.array[e*this.itemSize]}},{key:"setX",value:function(e,t){return this.array[e*this.itemSize]=t,this}},{key:"getY",value:function(e){return this.array[e*this.itemSize+1]}},{key:"setY",value:function(e,t){return this.array[e*this.itemSize+1]=t,this}},{key:"getZ",value:function(e){return this.array[e*this.itemSize+2]}},{key:"setZ",value:function(e,t){return this.array[e*this.itemSize+2]=t,this}},{key:"getW",value:function(e){return this.array[e*this.itemSize+3]}},{key:"setW",value:function(e,t){return this.array[e*this.itemSize+3]=t,this}},{key:"setXY",value:function(e,t,n){return e*=this.itemSize,this.array[e+0]=t,this.array[e+1]=n,this}},{key:"setXYZ",value:function(e,t,n,r){return e*=this.itemSize,this.array[e+0]=t,this.array[e+1]=n,this.array[e+2]=r,this}},{key:"setXYZW",value:function(e,t,n,r,i){return e*=this.itemSize,this.array[e+0]=t,this.array[e+1]=n,this.array[e+2]=r,this.array[e+3]=i,this}},{key:"onUpload",value:function(e){return this.onUploadCallback=e,this}},{key:"clone",value:function(){return new this.constructor(this.array,this.itemSize).copy(this)}},{key:"toJSON",value:function(){var e={itemSize:this.itemSize,type:this.array.constructor.name,array:Array.from(this.array),normalized:this.normalized};return""!==this.name&&(e.name=this.name),this.usage!==Pn&&(e.usage=this.usage),0===this.updateRange.offset&&-1===this.updateRange.count||(e.updateRange=this.updateRange),e}}]),e}(),va=exports.Int8BufferAttribute=function(e){m(n,fa);var t=y(n);function n(e,r,i){return A(this,n),t.call(this,new Int8Array(e),r,i)}return E(n)}(),ma=exports.Uint8BufferAttribute=function(e){m(n,fa);var t=y(n);function n(e,r,i){return A(this,n),t.call(this,new Uint8Array(e),r,i)}return E(n)}(),ga=exports.Uint8ClampedBufferAttribute=function(e){m(n,fa);var t=y(n);function n(e,r,i){return A(this,n),t.call(this,new Uint8ClampedArray(e),r,i)}return E(n)}(),ya=exports.Int16BufferAttribute=function(e){m(n,fa);var t=y(n);function n(e,r,i){return A(this,n),t.call(this,new Int16Array(e),r,i)}return E(n)}(),xa=exports.Uint16BufferAttribute=function(e){m(n,fa);var t=y(n);function n(e,r,i){return A(this,n),t.call(this,new Uint16Array(e),r,i)}return E(n)}(),_a=exports.Int32BufferAttribute=function(e){m(n,fa);var t=y(n);function n(e,r,i){return A(this,n),t.call(this,new Int32Array(e),r,i)}return E(n)}(),Ma=exports.Uint32BufferAttribute=function(e){m(n,fa);var t=y(n);function n(e,r,i){return A(this,n),t.call(this,new Uint32Array(e),r,i)}return E(n)}(),ba=exports.Float16BufferAttribute=function(e){m(n,fa);var t=y(n);function n(e,r,i){var a;return A(this,n),(a=t.call(this,new Uint16Array(e),r,i)).isFloat16BufferAttribute=!0,a}return E(n)}(),Sa=exports.Float32BufferAttribute=function(e){m(n,fa);var t=y(n);function n(e,r,i){return A(this,n),t.call(this,new Float32Array(e),r,i)}return E(n)}(),wa=exports.Float64BufferAttribute=function(e){m(n,fa);var t=y(n);function n(e,r,i){return A(this,n),t.call(this,new Float64Array(e),r,i)}return E(n)}(),Ta=0,Aa=new Ai,ka=new Ki,Ea=new Zr,Ca=new Qr,La=new Qr,Ra=new Zr,Pa=exports.BufferGeometry=function(e){m(n,Wn);var t=y(n);function n(){var e;return A(this,n),(e=t.call(this)).isBufferGeometry=!0,Object.defineProperty(_(e),"id",{value:Ta++}),e.uuid=Zn(),e.name="",e.type="BufferGeometry",e.index=null,e.attributes={},e.morphAttributes={},e.morphTargetsRelative=!1,e.groups=[],e.boundingBox=null,e.boundingSphere=null,e.drawRange={start:0,count:1/0},e.userData={},e}return E(n,[{key:"getIndex",value:function(){return this.index}},{key:"setIndex",value:function(e){return Array.isArray(e)?this.index=new(_r(e)?Ma:xa)(e,1):this.index=e,this}},{key:"getAttribute",value:function(e){return this.attributes[e]}},{key:"setAttribute",value:function(e,t){return this.attributes[e]=t,this}},{key:"deleteAttribute",value:function(e){return delete this.attributes[e],this}},{key:"hasAttribute",value:function(e){return void 0!==this.attributes[e]}},{key:"addGroup",value:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;this.groups.push({start:e,count:t,materialIndex:n})}},{key:"clearGroups",value:function(){this.groups=[]}},{key:"setDrawRange",value:function(e,t){this.drawRange.start=e,this.drawRange.count=t}},{key:"applyMatrix4",value: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 r=(new xr).getNormalMatrix(e);n.applyNormalMatrix(r),n.needsUpdate=!0}var i=this.attributes.tangent;return void 0!==i&&(i.transformDirection(e),i.needsUpdate=!0),null!==this.boundingBox&&this.computeBoundingBox(),null!==this.boundingSphere&&this.computeBoundingSphere(),this}},{key:"applyQuaternion",value:function(e){return Aa.makeRotationFromQuaternion(e),this.applyMatrix4(Aa),this}},{key:"rotateX",value:function(e){return Aa.makeRotationX(e),this.applyMatrix4(Aa),this}},{key:"rotateY",value:function(e){return Aa.makeRotationY(e),this.applyMatrix4(Aa),this}},{key:"rotateZ",value:function(e){return Aa.makeRotationZ(e),this.applyMatrix4(Aa),this}},{key:"translate",value:function(e,t,n){return Aa.makeTranslation(e,t,n),this.applyMatrix4(Aa),this}},{key:"scale",value:function(e,t,n){return Aa.makeScale(e,t,n),this.applyMatrix4(Aa),this}},{key:"lookAt",value:function(e){return ka.lookAt(e),ka.updateMatrix(),this.applyMatrix4(ka.matrix),this}},{key:"center",value:function(){return this.computeBoundingBox(),this.boundingBox.getCenter(Ea).negate(),this.translate(Ea.x,Ea.y,Ea.z),this}},{key:"setFromPoints",value:function(e){for(var t=[],n=0,r=e.length;n0&&(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 r=this.index;null!==r&&(e.data.index={type:r.array.constructor.name,array:Array.prototype.slice.call(r.array)});var i=this.attributes;for(var a in i){var o=i[a];e.data.attributes[a]=o.toJSON(e.data)}var s={},l=!1;for(var u in this.morphAttributes){for(var c=this.morphAttributes[u],h=[],d=0,p=c.length;d0&&(s[u]=h,l=!0)}l&&(e.data.morphAttributes=s,e.data.morphTargetsRelative=this.morphTargetsRelative);var v=this.groups;v.length>0&&(e.data.groups=JSON.parse(JSON.stringify(v)));var m=this.boundingSphere;return null!==m&&(e.data.boundingSphere={center:m.center.toArray(),radius:m.radius}),e}},{key:"clone",value:function(){return(new this.constructor).copy(this)}},{key:"copy",value:function(e){this.index=null,this.attributes={},this.morphAttributes={},this.groups=[],this.boundingBox=null,this.boundingSphere=null;var t={};this.name=e.name;var n=e.index;null!==n&&this.setIndex(n.clone(t));var r=e.attributes;for(var i in r){var a=r[i];this.setAttribute(i,a.clone(t))}var o=e.morphAttributes;for(var s in o){for(var l=[],u=o[s],c=0,h=u.length;c0&&void 0!==arguments[0]?arguments[0]:new Pa,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new ha;return A(this,n),(e=t.call(this)).isMesh=!0,e.type="Mesh",e.geometry=r,e.material=i,e.updateMorphTargets(),e}return E(n,[{key:"copy",value:function(e,t){return f(b(n.prototype),"copy",this).call(this,e,t),void 0!==e.morphTargetInfluences&&(this.morphTargetInfluences=e.morphTargetInfluences.slice()),void 0!==e.morphTargetDictionary&&(this.morphTargetDictionary=Object.assign({},e.morphTargetDictionary)),this.material=e.material,this.geometry=e.geometry,this}},{key:"updateMorphTargets",value:function(){var e=this.geometry.morphAttributes,t=Object.keys(e);if(t.length>0){var n=e[t[0]];if(void 0!==n){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(var r=0,i=n.length;rn.far?null:{distance:l,point:Za.clone(),object:e}}function Qa(e,t,n,r,i,a,o,s,l,u,c,h){Oa.fromBufferAttribute(i,u),Fa.fromBufferAttribute(i,c),za.fromBufferAttribute(i,h);var d=e.morphTargetInfluences;if(a&&d){Va.set(0,0,0),Ha.set(0,0,0),Wa.set(0,0,0);for(var p=0,f=a.length;p0&&void 0!==arguments[0]?arguments[0]:1,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1,o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:1,s=arguments.length>4&&void 0!==arguments[4]?arguments[4]:1,l=arguments.length>5&&void 0!==arguments[5]?arguments[5]:1;A(this,n),(e=t.call(this)).type="BoxGeometry",e.parameters={width:r,height:i,depth:a,widthSegments:o,heightSegments:s,depthSegments:l};var u=_(e);o=Math.floor(o),s=Math.floor(s),l=Math.floor(l);var c=[],h=[],d=[],p=[],f=0,v=0;function m(e,t,n,r,i,a,o,s,l,m,g){for(var y=a/l,x=o/m,_=a/2,M=o/2,b=s/2,S=l+1,w=m+1,T=0,A=0,k=new Zr,E=0;E0?1:-1,d.push(k.x,k.y,k.z),p.push(L/l),p.push(1-E/m),T+=1}for(var P=0;P0&&(t.defines=this.defines),t.vertexShader=this.vertexShader,t.fragmentShader=this.fragmentShader;var a={};for(var o in this.extensions)!0===this.extensions[o]&&(a[o]=!0);return Object.keys(a).length>0&&(t.extensions=a),t}}]),n}(),oo=exports.Camera=function(e){m(n,Ki);var t=y(n);function n(){var e;return A(this,n),(e=t.call(this)).isCamera=!0,e.type="Camera",e.matrixWorldInverse=new Ai,e.projectionMatrix=new Ai,e.projectionMatrixInverse=new Ai,e}return E(n,[{key:"copy",value:function(e,t){return f(b(n.prototype),"copy",this).call(this,e,t),this.matrixWorldInverse.copy(e.matrixWorldInverse),this.projectionMatrix.copy(e.projectionMatrix),this.projectionMatrixInverse.copy(e.projectionMatrixInverse),this}},{key:"getWorldDirection",value:function(e){this.updateWorldMatrix(!0,!1);var t=this.matrixWorld.elements;return e.set(-t[8],-t[9],-t[10]).normalize()}},{key:"updateMatrixWorld",value:function(e){f(b(n.prototype),"updateMatrixWorld",this).call(this,e),this.matrixWorldInverse.copy(this.matrixWorld).invert()}},{key:"updateWorldMatrix",value:function(e,t){f(b(n.prototype),"updateWorldMatrix",this).call(this,e,t),this.matrixWorldInverse.copy(this.matrixWorld).invert()}},{key:"clone",value:function(){return(new this.constructor).copy(this)}}]),n}(),so=exports.PerspectiveCamera=function(e){m(n,oo);var t=y(n);function n(){var e,r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:50,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:.1,o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:2e3;return A(this,n),(e=t.call(this)).isPerspectiveCamera=!0,e.type="PerspectiveCamera",e.fov=r,e.zoom=1,e.near=a,e.far=o,e.focus=10,e.aspect=i,e.view=null,e.filmGauge=35,e.filmOffset=0,e.updateProjectionMatrix(),e}return E(n,[{key:"copy",value:function(e,t){return f(b(n.prototype),"copy",this).call(this,e,t),this.fov=e.fov,this.zoom=e.zoom,this.near=e.near,this.far=e.far,this.focus=e.focus,this.aspect=e.aspect,this.view=null===e.view?null:Object.assign({},e.view),this.filmGauge=e.filmGauge,this.filmOffset=e.filmOffset,this}},{key:"setFocalLength",value:function(e){var t=.5*this.getFilmHeight()/e;this.fov=2*Yn*Math.atan(t),this.updateProjectionMatrix()}},{key:"getFocalLength",value:function(){var e=Math.tan(.5*Xn*this.fov);return.5*this.getFilmHeight()/e}},{key:"getEffectiveFOV",value:function(){return 2*Yn*Math.atan(Math.tan(.5*Xn*this.fov)/this.zoom)}},{key:"getFilmWidth",value:function(){return this.filmGauge*Math.min(this.aspect,1)}},{key:"getFilmHeight",value:function(){return this.filmGauge/Math.max(this.aspect,1)}},{key:"setViewOffset",value:function(e,t,n,r,i,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=r,this.view.width=i,this.view.height=a,this.updateProjectionMatrix()}},{key:"clearViewOffset",value:function(){null!==this.view&&(this.view.enabled=!1),this.updateProjectionMatrix()}},{key:"updateProjectionMatrix",value:function(){var e=this.near,t=e*Math.tan(.5*Xn*this.fov)/this.zoom,n=2*t,r=this.aspect*n,i=-.5*r,a=this.view;if(null!==this.view&&this.view.enabled){var o=a.fullWidth,s=a.fullHeight;i+=a.offsetX*r/o,t-=a.offsetY*n/s,r*=a.width/o,n*=a.height/s}var l=this.filmOffset;0!==l&&(i+=e*l/this.getFilmWidth()),this.projectionMatrix.makePerspective(i,i+r,t,t-n,e,this.far),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}},{key:"toJSON",value:function(e){var t=f(b(n.prototype),"toJSON",this).call(this,e);return t.object.fov=this.fov,t.object.zoom=this.zoom,t.object.near=this.near,t.object.far=this.far,t.object.focus=this.focus,t.object.aspect=this.aspect,null!==this.view&&(t.object.view=Object.assign({},this.view)),t.object.filmGauge=this.filmGauge,t.object.filmOffset=this.filmOffset,t}}]),n}(),lo=90,uo=1,co=exports.CubeCamera=function(e){m(n,Ki);var t=y(n);function n(e,r,i){var a;if(A(this,n),(a=t.call(this)).type="CubeCamera",!0!==i.isWebGLCubeRenderTarget)return console.error("THREE.CubeCamera: The constructor now expects an instance of WebGLCubeRenderTarget as third parameter."),x(a);a.renderTarget=i;var o=new so(lo,uo,e,r);o.layers=a.layers,o.up.set(0,-1,0),o.lookAt(new Zr(1,0,0)),a.add(o);var s=new so(lo,uo,e,r);s.layers=a.layers,s.up.set(0,-1,0),s.lookAt(new Zr(-1,0,0)),a.add(s);var l=new so(lo,uo,e,r);l.layers=a.layers,l.up.set(0,0,1),l.lookAt(new Zr(0,1,0)),a.add(l);var u=new so(lo,uo,e,r);u.layers=a.layers,u.up.set(0,0,-1),u.lookAt(new Zr(0,-1,0)),a.add(u);var c=new so(lo,uo,e,r);c.layers=a.layers,c.up.set(0,-1,0),c.lookAt(new Zr(0,0,1)),a.add(c);var h=new so(lo,uo,e,r);return h.layers=a.layers,h.up.set(0,-1,0),h.lookAt(new Zr(0,0,-1)),a.add(h),a}return E(n,[{key:"update",value:function(e,t){null===this.parent&&this.updateMatrixWorld();var n=this.renderTarget,r=l(this.children,6),i=r[0],a=r[1],o=r[2],s=r[3],u=r[4],c=r[5],h=e.getRenderTarget(),d=e.toneMapping,p=e.xr.enabled;e.toneMapping=Ae,e.xr.enabled=!1;var f=n.texture.generateMipmaps;n.texture.generateMipmaps=!1,e.setRenderTarget(n,0),e.render(t,i),e.setRenderTarget(n,1),e.render(t,a),e.setRenderTarget(n,2),e.render(t,o),e.setRenderTarget(n,3),e.render(t,s),e.setRenderTarget(n,4),e.render(t,u),n.texture.generateMipmaps=f,e.setRenderTarget(n,5),e.render(t,c),e.setRenderTarget(h),e.toneMapping=d,e.xr.enabled=p,n.texture.needsPMREMUpdate=!0}}]),n}(),ho=exports.CubeTexture=function(e){m(n,Ur);var t=y(n);function n(e,r,i,a,o,s,l,u,c,h){var d;return A(this,n),e=void 0!==e?e:[],r=void 0!==r?r:Ie,(d=t.call(this,e,r,i,a,o,s,l,u,c,h)).isCubeTexture=!0,d.flipY=!1,d}return E(n,[{key:"images",get:function(){return this.image},set:function(e){this.image=e}}]),n}(),po=exports.WebGLCubeRenderTarget=function(e){m(n,Vr);var t=y(n);function n(e){var r,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};A(this,n),(r=t.call(this,e,e,i)).isWebGLCubeRenderTarget=!0;var a={width:e,height:e,depth:1},o=[a,a,a,a,a,a];return r.texture=new ho(o,i.mapping,i.wrapS,i.wrapT,i.magFilter,i.minFilter,i.format,i.type,i.anisotropy,i.encoding),r.texture.isRenderTargetTexture=!0,r.texture.generateMipmaps=void 0!==i.generateMipmaps&&i.generateMipmaps,r.texture.minFilter=void 0!==i.minFilter?i.minFilter:qe,r}return E(n,[{key:"fromEquirectangularTexture",value:function(e,t){this.texture.type=t.type,this.texture.encoding=t.encoding,this.texture.generateMipmaps=t.generateMipmaps,this.texture.minFilter=t.minFilter,this.texture.magFilter=t.magFilter;var n={tEquirect:{value:null}},r="\n\n\t\t\t\tvarying vec3 vWorldDirection;\n\n\t\t\t\tvec3 transformDirection( in vec3 dir, in mat4 matrix ) {\n\n\t\t\t\t\treturn normalize( ( matrix * vec4( dir, 0.0 ) ).xyz );\n\n\t\t\t\t}\n\n\t\t\t\tvoid main() {\n\n\t\t\t\t\tvWorldDirection = transformDirection( position, modelMatrix );\n\n\t\t\t\t\t#include \n\t\t\t\t\t#include \n\n\t\t\t\t}\n\t\t\t",i="\n\n\t\t\t\tuniform sampler2D tEquirect;\n\n\t\t\t\tvarying vec3 vWorldDirection;\n\n\t\t\t\t#include \n\n\t\t\t\tvoid main() {\n\n\t\t\t\t\tvec3 direction = normalize( vWorldDirection );\n\n\t\t\t\t\tvec2 sampleUV = equirectUv( direction );\n\n\t\t\t\t\tgl_FragColor = texture2D( tEquirect, sampleUV );\n\n\t\t\t\t}\n\t\t\t",a=new $a(5,5,5),o=new ao({name:"CubemapFromEquirect",uniforms:eo(n),vertexShader:r,fragmentShader:i,side:H,blending:X});o.uniforms.tEquirect.value=t;var s=new Ja(a,o),l=t.minFilter;return t.minFilter===Ze&&(t.minFilter=qe),new co(1,10,this).update(e,s),t.minFilter=l,s.geometry.dispose(),s.material.dispose(),this}},{key:"clear",value:function(e,t,n,r){for(var i=e.getRenderTarget(),a=0;a<6;a++)e.setRenderTarget(this,a),e.clear(t,n,r);e.setRenderTarget(i)}}]),n}(),fo=new Zr,vo=new Zr,mo=new xr,go=exports.Plane=function(){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:new Zr(1,0,0),n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;A(this,e),this.isPlane=!0,this.normal=t,this.constant=n}return E(e,[{key:"set",value:function(e,t){return this.normal.copy(e),this.constant=t,this}},{key:"setComponents",value:function(e,t,n,r){return this.normal.set(e,t,n),this.constant=r,this}},{key:"setFromNormalAndCoplanarPoint",value:function(e,t){return this.normal.copy(e),this.constant=-t.dot(this.normal),this}},{key:"setFromCoplanarPoints",value:function(e,t,n){var r=fo.subVectors(n,t).cross(vo.subVectors(e,t)).normalize();return this.setFromNormalAndCoplanarPoint(r,e),this}},{key:"copy",value:function(e){return this.normal.copy(e.normal),this.constant=e.constant,this}},{key:"normalize",value:function(){var e=1/this.normal.length();return this.normal.multiplyScalar(e),this.constant*=e,this}},{key:"negate",value:function(){return this.constant*=-1,this.normal.negate(),this}},{key:"distanceToPoint",value:function(e){return this.normal.dot(e)+this.constant}},{key:"distanceToSphere",value:function(e){return this.distanceToPoint(e.center)-e.radius}},{key:"projectPoint",value:function(e,t){return t.copy(this.normal).multiplyScalar(-this.distanceToPoint(e)).add(e)}},{key:"intersectLine",value:function(e,t){var n=e.delta(fo),r=this.normal.dot(n);if(0===r)return 0===this.distanceToPoint(e.start)?t.copy(e.start):null;var i=-(e.start.dot(this.normal)+this.constant)/r;return i<0||i>1?null:t.copy(n).multiplyScalar(i).add(e.start)}},{key:"intersectsLine",value:function(e){var t=this.distanceToPoint(e.start),n=this.distanceToPoint(e.end);return t<0&&n>0||n<0&&t>0}},{key:"intersectsBox",value:function(e){return e.intersectsPlane(this)}},{key:"intersectsSphere",value:function(e){return e.intersectsPlane(this)}},{key:"coplanarPoint",value:function(e){return e.copy(this.normal).multiplyScalar(-this.constant)}},{key:"applyMatrix4",value:function(e,t){var n=t||mo.getNormalMatrix(e),r=this.coplanarPoint(fo).applyMatrix4(e),i=this.normal.applyMatrix3(n).normalize();return this.constant=-r.dot(i),this}},{key:"translate",value:function(e){return this.constant-=e.dot(this.normal),this}},{key:"equals",value:function(e){return e.normal.equals(this.normal)&&e.constant===this.constant}},{key:"clone",value:function(){return(new this.constructor).copy(this)}}]),e}(),yo=new gi,xo=new Zr,_o=exports.Frustum=function(){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:new go,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new go,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:new go,i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:new go,a=arguments.length>4&&void 0!==arguments[4]?arguments[4]:new go,o=arguments.length>5&&void 0!==arguments[5]?arguments[5]:new go;A(this,e),this.planes=[t,n,r,i,a,o]}return E(e,[{key:"set",value:function(e,t,n,r,i,a){var o=this.planes;return o[0].copy(e),o[1].copy(t),o[2].copy(n),o[3].copy(r),o[4].copy(i),o[5].copy(a),this}},{key:"copy",value:function(e){for(var t=this.planes,n=0;n<6;n++)t[n].copy(e.planes[n]);return this}},{key:"setFromProjectionMatrix",value:function(e){var t=this.planes,n=e.elements,r=n[0],i=n[1],a=n[2],o=n[3],s=n[4],l=n[5],u=n[6],c=n[7],h=n[8],d=n[9],p=n[10],f=n[11],v=n[12],m=n[13],g=n[14],y=n[15];return t[0].setComponents(o-r,c-s,f-h,y-v).normalize(),t[1].setComponents(o+r,c+s,f+h,y+v).normalize(),t[2].setComponents(o+i,c+l,f+d,y+m).normalize(),t[3].setComponents(o-i,c-l,f-d,y-m).normalize(),t[4].setComponents(o-a,c-u,f-p,y-g).normalize(),t[5].setComponents(o+a,c+u,f+p,y+g).normalize(),this}},{key:"intersectsObject",value:function(e){var t=e.geometry;return null===t.boundingSphere&&t.computeBoundingSphere(),yo.copy(t.boundingSphere).applyMatrix4(e.matrixWorld),this.intersectsSphere(yo)}},{key:"intersectsSprite",value:function(e){return yo.center.set(0,0,0),yo.radius=.7071067811865476,yo.applyMatrix4(e.matrixWorld),this.intersectsSphere(yo)}},{key:"intersectsSphere",value:function(e){for(var t=this.planes,n=e.center,r=-e.radius,i=0;i<6;i++){if(t[i].distanceToPoint(n)0?e.max.x:e.min.x,xo.y=r.normal.y>0?e.max.y:e.min.y,xo.z=r.normal.z>0?e.max.z:e.min.z,r.distanceToPoint(xo)<0)return!1}return!0}},{key:"containsPoint",value:function(e){for(var t=this.planes,n=0;n<6;n++)if(t[n].distanceToPoint(e)<0)return!1;return!0}},{key:"clone",value:function(){return(new this.constructor).copy(this)}}]),e}();function Mo(){var e=null,t=!1,n=null,r=null;function i(t,a){n(t,a),r=e.requestAnimationFrame(i)}return{start:function(){!0!==t&&null!==n&&(r=e.requestAnimationFrame(i),t=!0)},stop:function(){e.cancelAnimationFrame(r),t=!1},setAnimationLoop:function(e){n=e},setContext:function(t){e=t}}}function bo(e,t){var n=t.isWebGL2,r=new WeakMap;return{get:function(e){return e.isInterleavedBufferAttribute&&(e=e.data),r.get(e)},remove:function(t){t.isInterleavedBufferAttribute&&(t=t.data);var n=r.get(t);n&&(e.deleteBuffer(n.buffer),r.delete(t))},update:function(t,i){if(t.isGLBufferAttribute){var a=r.get(t);(!a||a.version0&&void 0!==arguments[0]?arguments[0]:1,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1,o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:1;A(this,n),(e=t.call(this)).type="PlaneGeometry",e.parameters={width:r,height:i,widthSegments:a,heightSegments:o};for(var s=r/2,l=i/2,u=Math.floor(a),c=Math.floor(o),h=u+1,d=c+1,p=r/u,f=i/c,v=[],m=[],g=[],y=[],x=0;x1&&void 0!==arguments[1]?arguments[1]:1;l.set(e),p(l,u=t)},getClearAlpha:function(){return u},setClearAlpha:function(e){p(l,u=e)},render:function(n,i){var a=!1,f=!0===i.isScene?i.background:null;f&&f.isTexture&&(f=t.get(f));var v=e.xr,m=v.getSession&&v.getSession();m&&"additive"===m.environmentBlendMode&&(f=null),null===f?p(l,u):f&&f.isColor&&(p(f,1),a=!0),(e.autoClear||a)&&e.clear(e.autoClearColor,e.autoClearDepth,e.autoClearStencil),f&&(f.isCubeTexture||f.mapping===Fe)?(void 0===s&&((s=new Ja(new $a(1,1,1),new ao({name:"BackgroundCubeMaterial",uniforms:eo(tu.cube.uniforms),vertexShader:tu.cube.vertexShader,fragmentShader:tu.cube.fragmentShader,side:H,depthTest:!1,depthWrite:!1,fog:!1}))).geometry.deleteAttribute("normal"),s.geometry.deleteAttribute("uv"),s.onBeforeRender=function(e,t,n){this.matrixWorld.copyPosition(n.matrixWorld)},Object.defineProperty(s.material,"envMap",{get:function(){return this.uniforms.envMap.value}}),r.update(s)),s.material.uniforms.envMap.value=f,s.material.uniforms.flipEnvMap.value=f.isCubeTexture&&!1===f.isRenderTargetTexture?-1:1,c===f&&h===f.version&&d===e.toneMapping||(s.material.needsUpdate=!0,c=f,h=f.version,d=e.toneMapping),s.layers.enableAll(),n.unshift(s,s.geometry,s.material,0,0,null)):f&&f.isTexture&&(void 0===o&&((o=new Ja(new So(2,2),new ao({name:"BackgroundMaterial",uniforms:eo(tu.background.uniforms),vertexShader:tu.background.vertexShader,fragmentShader:tu.background.fragmentShader,side:V,depthTest:!1,depthWrite:!1,fog:!1}))).geometry.deleteAttribute("normal"),Object.defineProperty(o.material,"map",{get:function(){return this.uniforms.t2D.value}}),r.update(o)),o.material.uniforms.t2D.value=f,!0===f.matrixAutoUpdate&&f.updateMatrix(),o.material.uniforms.uvTransform.value.copy(f.matrix),c===f&&h===f.version&&d===e.toneMapping||(o.material.needsUpdate=!0,c=f,h=f.version,d=e.toneMapping),o.layers.enableAll(),n.unshift(o,o.geometry,o.material,0,0,null))}}}function ru(e,t,n,r){var i=e.getParameter(34921),a=r.isWebGL2?null:t.get("OES_vertex_array_object"),o=r.isWebGL2||null!==a,s={},l=p(null),u=l,c=!1;function h(t){return r.isWebGL2?e.bindVertexArray(t):a.bindVertexArrayOES(t)}function d(t){return r.isWebGL2?e.deleteVertexArray(t):a.deleteVertexArrayOES(t)}function p(e){for(var t=[],n=[],r=[],a=0;a=0){var h=i[l],d=a[l];if(void 0===d&&("instanceMatrix"===l&&e.instanceMatrix&&(d=e.instanceMatrix),"instanceColor"===l&&e.instanceColor&&(d=e.instanceColor)),void 0===h)return!0;if(h.attribute!==d)return!0;if(d&&h.data!==d.data)return!0;o++}}return u.attributesNum!==o||u.index!==r}(i,x,d,_))&&function(e,t,n,r){var i={},a=t.attributes,o=0,s=n.getAttributes();for(var l in s){var c=s[l];if(c.location>=0){var h=a[l];void 0===h&&("instanceMatrix"===l&&e.instanceMatrix&&(h=e.instanceMatrix),"instanceColor"===l&&e.instanceColor&&(h=e.instanceColor));var d={};d.attribute=h,h&&h.data&&(d.data=h.data),i[l]=d,o++}}u.attributes=i,u.attributesNum=o,u.index=r}(i,x,d,_)}else{var S=!0===l.wireframe;u.geometry===x.id&&u.program===d.id&&u.wireframe===S||(u.geometry=x.id,u.program=d.id,u.wireframe=S,M=!0)}null!==_&&n.update(_,34963),(M||c)&&(c=!1,function(i,a,o,s){if(!1!==r.isWebGL2||!i.isInstancedMesh&&!s.isInstancedBufferGeometry||null!==t.get("ANGLE_instanced_arrays")){f();var l=s.attributes,u=o.getAttributes(),c=a.defaultAttributeValues;for(var h in u){var d=u[h];if(d.location>=0){var p=l[h];if(void 0===p&&("instanceMatrix"===h&&i.instanceMatrix&&(p=i.instanceMatrix),"instanceColor"===h&&i.instanceColor&&(p=i.instanceColor)),void 0!==p){var x=p.normalized,_=p.itemSize,M=n.get(p);if(void 0===M)continue;var b=M.buffer,S=M.type,w=M.bytesPerElement;if(p.isInterleavedBufferAttribute){var T=p.data,A=T.stride,k=p.offset;if(T.isInstancedInterleavedBuffer){for(var E=0;E0&&e.getShaderPrecisionFormat(35632,36338).precision>0)return"highp";t="mediump"}return"mediump"===t&&e.getShaderPrecisionFormat(35633,36337).precision>0&&e.getShaderPrecisionFormat(35632,36337).precision>0?"mediump":"lowp"}var a="undefined"!=typeof WebGL2RenderingContext&&e instanceof WebGL2RenderingContext||"undefined"!=typeof WebGL2ComputeRenderingContext&&e instanceof WebGL2ComputeRenderingContext,o=void 0!==n.precision?n.precision:"highp",s=i(o);s!==o&&(console.warn("THREE.WebGLRenderer:",o,"not supported, using",s,"instead."),o=s);var l=a||t.has("WEBGL_draw_buffers"),u=!0===n.logarithmicDepthBuffer,c=e.getParameter(34930),h=e.getParameter(35660),d=e.getParameter(3379),p=e.getParameter(34076),f=e.getParameter(34921),v=e.getParameter(36347),m=e.getParameter(36348),g=e.getParameter(36349),y=h>0,x=a||t.has("OES_texture_float");return{isWebGL2:a,drawBuffers:l,getMaxAnisotropy:function(){if(void 0!==r)return r;if(!0===t.has("EXT_texture_filter_anisotropic")){var n=t.get("EXT_texture_filter_anisotropic");r=e.getParameter(n.MAX_TEXTURE_MAX_ANISOTROPY_EXT)}else r=0;return r},getMaxPrecision:i,precision:o,logarithmicDepthBuffer:u,maxTextures:c,maxVertexTextures:h,maxTextureSize:d,maxCubemapSize:p,maxAttributes:f,maxVertexUniforms:v,maxVaryings:m,maxFragmentUniforms:g,vertexTextures:y,floatFragmentTextures:x,floatVertexTextures:y&&x,maxSamples:a?e.getParameter(36183):0}}function ou(e){var t=this,n=null,r=0,i=!1,a=!1,o=new go,s=new xr,l={value:null,needsUpdate:!1};function u(){l.value!==n&&(l.value=n,l.needsUpdate=r>0),t.numPlanes=r,t.numIntersection=0}function c(e,n,r,i){var a=null!==e?e.length:0,u=null;if(0!==a){if(u=l.value,!0!==i||null===u){var c=r+4*a,h=n.matrixWorldInverse;s.getNormalMatrix(h),(null===u||u.length0){var s=new po(o.height/2);return s.fromEquirectangularTexture(e,i),t.set(i,s),i.addEventListener("dispose",r),n(s.texture,i.mapping)}return null}}return i},dispose:function(){t=new WeakMap}}}tu.physical={uniforms:to([tu.standard.uniforms,{clearcoat:{value:0},clearcoatMap:{value:null},clearcoatRoughness:{value:0},clearcoatRoughnessMap:{value:null},clearcoatNormalScale:{value:new yr(1,1)},clearcoatNormalMap:{value:null},iridescence:{value:0},iridescenceMap:{value:null},iridescenceIOR:{value:1.3},iridescenceThicknessMinimum:{value:100},iridescenceThicknessMaximum:{value:400},iridescenceThicknessMap:{value:null},sheen:{value:0},sheenColor:{value:new Nr(0)},sheenColorMap:{value:null},sheenRoughness:{value:1},sheenRoughnessMap:{value:null},transmission:{value:0},transmissionMap:{value:null},transmissionSamplerSize:{value:new yr},transmissionSamplerMap:{value:null},thickness:{value:0},thicknessMap:{value:null},attenuationDistance:{value:0},attenuationColor:{value:new Nr(0)},specularIntensity:{value:1},specularIntensityMap:{value:null},specularColor:{value:new Nr(1,1,1)},specularColorMap:{value:null}}]),vertexShader:$l.meshphysical_vert,fragmentShader:$l.meshphysical_frag};var lu=exports.OrthographicCamera=function(e){m(n,oo);var t=y(n);function n(){var e,r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:-1,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1,o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:-1,s=arguments.length>4&&void 0!==arguments[4]?arguments[4]:.1,l=arguments.length>5&&void 0!==arguments[5]?arguments[5]:2e3;return A(this,n),(e=t.call(this)).isOrthographicCamera=!0,e.type="OrthographicCamera",e.zoom=1,e.view=null,e.left=r,e.right=i,e.top=a,e.bottom=o,e.near=s,e.far=l,e.updateProjectionMatrix(),e}return E(n,[{key:"copy",value:function(e,t){return f(b(n.prototype),"copy",this).call(this,e,t),this.left=e.left,this.right=e.right,this.top=e.top,this.bottom=e.bottom,this.near=e.near,this.far=e.far,this.zoom=e.zoom,this.view=null===e.view?null:Object.assign({},e.view),this}},{key:"setViewOffset",value:function(e,t,n,r,i,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=r,this.view.width=i,this.view.height=a,this.updateProjectionMatrix()}},{key:"clearViewOffset",value:function(){null!==this.view&&(this.view.enabled=!1),this.updateProjectionMatrix()}},{key:"updateProjectionMatrix",value:function(){var e=(this.right-this.left)/(2*this.zoom),t=(this.top-this.bottom)/(2*this.zoom),n=(this.right+this.left)/2,r=(this.top+this.bottom)/2,i=n-e,a=n+e,o=r+t,s=r-t;if(null!==this.view&&this.view.enabled){var l=(this.right-this.left)/this.view.fullWidth/this.zoom,u=(this.top-this.bottom)/this.view.fullHeight/this.zoom;a=(i+=l*this.view.offsetX)+l*this.view.width,s=(o-=u*this.view.offsetY)-u*this.view.height}this.projectionMatrix.makeOrthographic(i,a,o,s,this.near,this.far),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}},{key:"toJSON",value:function(e){var t=f(b(n.prototype),"toJSON",this).call(this,e);return t.object.zoom=this.zoom,t.object.left=this.left,t.object.right=this.right,t.object.top=this.top,t.object.bottom=this.bottom,t.object.near=this.near,t.object.far=this.far,null!==this.view&&(t.object.view=Object.assign({},this.view)),t}}]),n}(),uu=4,cu=[.125,.215,.35,.446,.526,.582],hu=20,du=new lu,pu=new Nr,fu=null,vu=(1+Math.sqrt(5))/2,mu=1/vu,gu=[new Zr(1,1,1),new Zr(-1,1,1),new Zr(1,1,-1),new Zr(-1,1,-1),new Zr(0,vu,mu),new Zr(0,vu,-mu),new Zr(mu,0,vu),new Zr(-mu,0,vu),new Zr(vu,mu,0),new Zr(-vu,mu,0)],yu=exports.PMREMGenerator=function(){function e(t){A(this,e),this._renderer=t,this._pingPongRenderTarget=null,this._lodMax=0,this._cubeSize=0,this._lodPlanes=[],this._sizeLods=[],this._sigmas=[],this._blurMaterial=null,this._cubemapMaterial=null,this._equirectMaterial=null,this._compileMaterial(this._blurMaterial)}return E(e,[{key:"fromScene",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:.1,r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:100;fu=this._renderer.getRenderTarget(),this._setSize(256);var i=this._allocateTargets();return i.depthBuffer=!0,this._sceneToCubeUV(e,n,r,i),t>0&&this._blur(i,0,0,t),this._applyPMREM(i),this._cleanup(i),i}},{key:"fromEquirectangular",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;return this._fromTexture(e,t)}},{key:"fromCubemap",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;return this._fromTexture(e,t)}},{key:"compileCubemapShader",value:function(){null===this._cubemapMaterial&&(this._cubemapMaterial=wu(),this._compileMaterial(this._cubemapMaterial))}},{key:"compileEquirectangularShader",value:function(){null===this._equirectMaterial&&(this._equirectMaterial=Su(),this._compileMaterial(this._equirectMaterial))}},{key:"dispose",value:function(){this._dispose(),null!==this._cubemapMaterial&&this._cubemapMaterial.dispose(),null!==this._equirectMaterial&&this._equirectMaterial.dispose()}},{key:"_setSize",value:function(e){this._lodMax=Math.floor(Math.log2(e)),this._cubeSize=Math.pow(2,this._lodMax)}},{key:"_dispose",value:function(){null!==this._blurMaterial&&this._blurMaterial.dispose(),null!==this._pingPongRenderTarget&&this._pingPongRenderTarget.dispose();for(var e=0;e2?m:0,m,m),s.setRenderTarget(r),d&&s.render(h,i),s.render(e,i)}h.geometry.dispose(),h.material.dispose(),s.toneMapping=u,s.autoClear=l,e.background=p}},{key:"_textureToCubeUV",value:function(e,t){var n=this._renderer,r=e.mapping===Ie||e.mapping===De;r?(null===this._cubemapMaterial&&(this._cubemapMaterial=wu()),this._cubemapMaterial.uniforms.flipEnvMap.value=!1===e.isRenderTargetTexture?-1:1):null===this._equirectMaterial&&(this._equirectMaterial=Su());var i=r?this._cubemapMaterial:this._equirectMaterial,a=new Ja(this._lodPlanes[0],i);i.uniforms.envMap.value=e;var o=this._cubeSize;Mu(t,0,0,3*o,2*o),n.setRenderTarget(t),n.render(a,du)}},{key:"_applyPMREM",value:function(e){var t=this._renderer,n=t.autoClear;t.autoClear=!1;for(var r=1;rhu&&console.warn("sigmaRadians, ".concat(i,", is too large and will clip, as it requested ").concat(f," samples when the maximum is set to ").concat(hu));for(var v=[],m=0,g=0;gM-uu?r-M+uu:0),4*(this._cubeSize-b),3*b,2*b),s.setRenderTarget(t),s.render(u,du)}}]),e}();function xu(e){for(var t=[],n=[],r=[],i=e,a=e-uu+1+cu.length,o=0;oe-uu?l=cu[o-e+uu-1]:0===o&&(l=0),r.push(l);for(var u=1/(s-2),c=-u,h=1+u,d=[c,c,h,c,h,h,c,c,h,h,c,h],p=new Float32Array(108),f=new Float32Array(72),v=new Float32Array(36),m=0;m<6;m++){var g=m%3*2/3-1,y=m>2?0:-1,x=[g,y,0,g+2/3,y,0,g+2/3,y+1,0,g,y,0,g+2/3,y+1,0,g,y+1,0];p.set(x,18*m),f.set(d,12*m);var _=[m,m,m,m,m,m];v.set(_,6*m)}var M=new Pa;M.setAttribute("position",new fa(p,3)),M.setAttribute("uv",new fa(f,2)),M.setAttribute("faceIndex",new fa(v,1)),t.push(M),i>uu&&i--}return{lodPlanes:t,sizeLods:n,sigmas:r}}function _u(e,t,n){var r=new Vr(e,t,n);return r.texture.mapping=Fe,r.texture.name="PMREM.cubeUv",r.scissorTest=!0,r}function Mu(e,t,n,r,i){e.viewport.set(t,n,r,i),e.scissor.set(t,n,r,i)}function bu(e,t,n){var r=new Float32Array(hu),i=new Zr(0,1,0);return new ao({name:"SphericalGaussianBlur",defines:{n:hu,CUBEUV_TEXEL_WIDTH:1/t,CUBEUV_TEXEL_HEIGHT:1/n,CUBEUV_MAX_MIP:"".concat(e,".0")},uniforms:{envMap:{value:null},samples:{value:1},weights:{value:r},latitudinal:{value:!1},dTheta:{value:0},mipInt:{value:0},poleAxis:{value:i}},vertexShader:Tu(),fragmentShader:"\n\n\t\t\tprecision mediump float;\n\t\t\tprecision mediump int;\n\n\t\t\tvarying vec3 vOutputDirection;\n\n\t\t\tuniform sampler2D envMap;\n\t\t\tuniform int samples;\n\t\t\tuniform float weights[ n ];\n\t\t\tuniform bool latitudinal;\n\t\t\tuniform float dTheta;\n\t\t\tuniform float mipInt;\n\t\t\tuniform vec3 poleAxis;\n\n\t\t\t#define ENVMAP_TYPE_CUBE_UV\n\t\t\t#include \n\n\t\t\tvec3 getSample( float theta, vec3 axis ) {\n\n\t\t\t\tfloat cosTheta = cos( theta );\n\t\t\t\t// Rodrigues' axis-angle rotation\n\t\t\t\tvec3 sampleDirection = vOutputDirection * cosTheta\n\t\t\t\t\t+ cross( axis, vOutputDirection ) * sin( theta )\n\t\t\t\t\t+ axis * dot( axis, vOutputDirection ) * ( 1.0 - cosTheta );\n\n\t\t\t\treturn bilinearCubeUV( envMap, sampleDirection, mipInt );\n\n\t\t\t}\n\n\t\t\tvoid main() {\n\n\t\t\t\tvec3 axis = latitudinal ? poleAxis : cross( poleAxis, vOutputDirection );\n\n\t\t\t\tif ( all( equal( axis, vec3( 0.0 ) ) ) ) {\n\n\t\t\t\t\taxis = vec3( vOutputDirection.z, 0.0, - vOutputDirection.x );\n\n\t\t\t\t}\n\n\t\t\t\taxis = normalize( axis );\n\n\t\t\t\tgl_FragColor = vec4( 0.0, 0.0, 0.0, 1.0 );\n\t\t\t\tgl_FragColor.rgb += weights[ 0 ] * getSample( 0.0, axis );\n\n\t\t\t\tfor ( int i = 1; i < n; i++ ) {\n\n\t\t\t\t\tif ( i >= samples ) {\n\n\t\t\t\t\t\tbreak;\n\n\t\t\t\t\t}\n\n\t\t\t\t\tfloat theta = dTheta * float( i );\n\t\t\t\t\tgl_FragColor.rgb += weights[ i ] * getSample( -1.0 * theta, axis );\n\t\t\t\t\tgl_FragColor.rgb += weights[ i ] * getSample( theta, axis );\n\n\t\t\t\t}\n\n\t\t\t}\n\t\t",blending:X,depthTest:!1,depthWrite:!1})}function Su(){return new ao({name:"EquirectangularToCubeUV",uniforms:{envMap:{value:null}},vertexShader:Tu(),fragmentShader:"\n\n\t\t\tprecision mediump float;\n\t\t\tprecision mediump int;\n\n\t\t\tvarying vec3 vOutputDirection;\n\n\t\t\tuniform sampler2D envMap;\n\n\t\t\t#include \n\n\t\t\tvoid main() {\n\n\t\t\t\tvec3 outputDirection = normalize( vOutputDirection );\n\t\t\t\tvec2 uv = equirectUv( outputDirection );\n\n\t\t\t\tgl_FragColor = vec4( texture2D ( envMap, uv ).rgb, 1.0 );\n\n\t\t\t}\n\t\t",blending:X,depthTest:!1,depthWrite:!1})}function wu(){return new ao({name:"CubemapToCubeUV",uniforms:{envMap:{value:null},flipEnvMap:{value:-1}},vertexShader:Tu(),fragmentShader:"\n\n\t\t\tprecision mediump float;\n\t\t\tprecision mediump int;\n\n\t\t\tuniform float flipEnvMap;\n\n\t\t\tvarying vec3 vOutputDirection;\n\n\t\t\tuniform samplerCube envMap;\n\n\t\t\tvoid main() {\n\n\t\t\t\tgl_FragColor = textureCube( envMap, vec3( flipEnvMap * vOutputDirection.x, vOutputDirection.yz ) );\n\n\t\t\t}\n\t\t",blending:X,depthTest:!1,depthWrite:!1})}function Tu(){return"\n\n\t\tprecision mediump float;\n\t\tprecision mediump int;\n\n\t\tattribute float faceIndex;\n\n\t\tvarying vec3 vOutputDirection;\n\n\t\t// RH coordinate system; PMREM face-indexing convention\n\t\tvec3 getDirection( vec2 uv, float face ) {\n\n\t\t\tuv = 2.0 * uv - 1.0;\n\n\t\t\tvec3 direction = vec3( uv, 1.0 );\n\n\t\t\tif ( face == 0.0 ) {\n\n\t\t\t\tdirection = direction.zyx; // ( 1, v, u ) pos x\n\n\t\t\t} else if ( face == 1.0 ) {\n\n\t\t\t\tdirection = direction.xzy;\n\t\t\t\tdirection.xz *= -1.0; // ( -u, 1, -v ) pos y\n\n\t\t\t} else if ( face == 2.0 ) {\n\n\t\t\t\tdirection.x *= -1.0; // ( -u, v, 1 ) pos z\n\n\t\t\t} else if ( face == 3.0 ) {\n\n\t\t\t\tdirection = direction.zyx;\n\t\t\t\tdirection.xz *= -1.0; // ( -1, v, -u ) neg x\n\n\t\t\t} else if ( face == 4.0 ) {\n\n\t\t\t\tdirection = direction.xzy;\n\t\t\t\tdirection.xy *= -1.0; // ( -u, -1, v ) neg y\n\n\t\t\t} else if ( face == 5.0 ) {\n\n\t\t\t\tdirection.z *= -1.0; // ( u, v, -1 ) neg z\n\n\t\t\t}\n\n\t\t\treturn direction;\n\n\t\t}\n\n\t\tvoid main() {\n\n\t\t\tvOutputDirection = getDirection( uv, faceIndex );\n\t\t\tgl_Position = vec4( position, 1.0 );\n\n\t\t}\n\t"}function Au(e){var t=new WeakMap,n=null;function r(e){var n=e.target;n.removeEventListener("dispose",r);var i=t.get(n);void 0!==i&&(t.delete(n),i.dispose())}return{get:function(i){if(i&&i.isTexture){var a=i.mapping,o=a===Ne||a===Oe,s=a===Ie||a===De;if(o||s){if(i.isRenderTargetTexture&&!0===i.needsPMREMUpdate){i.needsPMREMUpdate=!1;var l=t.get(i);return null===n&&(n=new yu(e)),l=o?n.fromEquirectangular(i,l):n.fromCubemap(i,l),t.set(i,l),l.texture}if(t.has(i))return t.get(i).texture;var u=i.image;if(o&&u&&u.height>0||s&&u&&function(e){for(var t=0,n=0;n<6;n++)void 0!==e[n]&&t++;return 6===t}(u)){null===n&&(n=new yu(e));var c=o?n.fromEquirectangular(i):n.fromCubemap(i);return t.set(i,c),i.addEventListener("dispose",r),c.texture}return null}}return i},dispose:function(){t=new WeakMap,null!==n&&(n.dispose(),n=null)}}}function ku(e){var t={};function n(n){if(void 0!==t[n])return t[n];var r;switch(n){case"WEBGL_depth_texture":r=e.getExtension("WEBGL_depth_texture")||e.getExtension("MOZ_WEBGL_depth_texture")||e.getExtension("WEBKIT_WEBGL_depth_texture");break;case"EXT_texture_filter_anisotropic":r=e.getExtension("EXT_texture_filter_anisotropic")||e.getExtension("MOZ_EXT_texture_filter_anisotropic")||e.getExtension("WEBKIT_EXT_texture_filter_anisotropic");break;case"WEBGL_compressed_texture_s3tc":r=e.getExtension("WEBGL_compressed_texture_s3tc")||e.getExtension("MOZ_WEBGL_compressed_texture_s3tc")||e.getExtension("WEBKIT_WEBGL_compressed_texture_s3tc");break;case"WEBGL_compressed_texture_pvrtc":r=e.getExtension("WEBGL_compressed_texture_pvrtc")||e.getExtension("WEBKIT_WEBGL_compressed_texture_pvrtc");break;default:r=e.getExtension(n)}return t[n]=r,r}return{has:function(e){return null!==n(e)},init:function(e){e.isWebGL2?n("EXT_color_buffer_float"):(n("WEBGL_depth_texture"),n("OES_texture_float"),n("OES_texture_half_float"),n("OES_texture_half_float_linear"),n("OES_standard_derivatives"),n("OES_element_index_uint"),n("OES_vertex_array_object"),n("ANGLE_instanced_arrays")),n("OES_texture_float_linear"),n("EXT_color_buffer_half_float"),n("WEBGL_multisampled_render_to_texture")},get:function(e){var t=n(e);return null===t&&console.warn("THREE.WebGLRenderer: "+e+" extension not supported."),t}}}function Eu(e,t,n,r){var i={},a=new WeakMap;function o(e){var s=e.target;for(var l in null!==s.index&&t.remove(s.index),s.attributes)t.remove(s.attributes[l]);s.removeEventListener("dispose",o),delete i[s.id];var u=a.get(s);u&&(t.remove(u),a.delete(s)),r.releaseStatesOfGeometry(s),!0===s.isInstancedBufferGeometry&&delete s._maxInstanceCount,n.memory.geometries--}function s(e){var n=[],r=e.index,i=e.attributes.position,o=0;if(null!==r){var s=r.array;o=r.version;for(var l=0,u=s.length;lt.maxTextureSize&&(w=Math.ceil(S/t.maxTextureSize),S=t.maxTextureSize);var T=new Float32Array(S*w*4*f),A=new Hr(T,S,w,f);A.type=rt,A.needsUpdate=!0;for(var k=4*b,E=0;E0)return e;var i=t*n,a=Uu[i];if(void 0===a&&(a=new Float32Array(i),Uu[i]=a),0!==t){r.toArray(a,0);for(var o=1,s=0;o!==t;++o)s+=n,e[o].toArray(a,s)}return a}function qu(e,t){if(e.length!==t.length)return!1;for(var n=0,r=e.length;n":" "," ").concat(s,": ").concat(n[o]))}return r.join("\n")}function jc(e){switch(e){case sn:return["Linear","( value )"];case ln:return["sRGB","( value )"];default:return console.warn("THREE.WebGLProgram: Unsupported encoding:",e),["Linear","( value )"]}}function qc(e,t,n){var r=e.getShaderParameter(t,35713),i=e.getShaderInfoLog(t).trim();if(r&&""===i)return"";var a=/ERROR: 0:(\d+)/.exec(i);if(a){var o=parseInt(a[1]);return n.toUpperCase()+"\n\n"+i+"\n\n"+Wc(e.getShaderSource(t),o)}return i}function Xc(e,t){var n=jc(t);return"vec4 "+e+"( vec4 value ) { return LinearTo"+n[0]+n[1]+"; }"}function Yc(e,t){var n;switch(t){case ke:n="Linear";break;case Ee:n="Reinhard";break;case Ce:n="OptimizedCineon";break;case Le:n="ACESFilmic";break;case Re:n="Custom";break;default:console.warn("THREE.WebGLProgram: Unsupported toneMapping:",t),n="Linear"}return"vec3 "+e+"( vec3 color ) { return "+n+"ToneMapping( color ); }"}function Zc(e){return[e.extensionDerivatives||e.envMapCubeUVHeight||e.bumpMap||e.tangentSpaceNormalMap||e.clearcoatNormalMap||e.flatShading||"physical"===e.shaderID?"#extension GL_OES_standard_derivatives : enable":"",(e.extensionFragDepth||e.logarithmicDepthBuffer)&&e.rendererExtensionFragDepth?"#extension GL_EXT_frag_depth : enable":"",e.extensionDrawBuffers&&e.rendererExtensionDrawBuffers?"#extension GL_EXT_draw_buffers : require":"",(e.extensionShaderTextureLOD||e.envMap||e.transmission)&&e.rendererExtensionShaderTextureLod?"#extension GL_EXT_shader_texture_lod : enable":""].filter(Qc).join("\n")}function Jc(e){var t=[];for(var n in e){var r=e[n];!1!==r&&t.push("#define "+n+" "+r)}return t.join("\n")}function Kc(e,t){for(var n={},r=e.getProgramParameter(t,35721),i=0;i/gm;function nh(e){return e.replace(th,rh)}function rh(e,t){var n=$l[t];if(void 0===n)throw new Error("Can not resolve #include <"+t+">");return nh(n)}var ih=/#pragma unroll_loop[\s]+?for \( int i \= (\d+)\; i < (\d+)\; i \+\+ \) \{([\s\S]+?)(?=\})\}/g,ah=/#pragma unroll_loop_start\s+for\s*\(\s*int\s+i\s*=\s*(\d+)\s*;\s*i\s*<\s*(\d+)\s*;\s*i\s*\+\+\s*\)\s*{([\s\S]+?)}\s+#pragma unroll_loop_end/g;function oh(e){return e.replace(ah,lh).replace(ih,sh)}function sh(e,t,n,r){return console.warn("WebGLProgram: #pragma unroll_loop shader syntax is deprecated. Please use #pragma unroll_loop_start syntax instead."),lh(e,t,n,r)}function lh(e,t,n,r){for(var i="",a=parseInt(t);a0&&(i+="\n"),(a=[v,m].filter(Qc).join("\n")).length>0&&(a+="\n")):(i=[uh(n),"#define SHADER_NAME "+n.shaderName,m,n.instancing?"#define USE_INSTANCING":"",n.instancingColor?"#define USE_INSTANCING_COLOR":"",n.supportsVertexTextures?"#define VERTEX_TEXTURES":"",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 "+d:"",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.iridescenceMap?"#define USE_IRIDESCENCEMAP":"",n.iridescenceThicknessMap?"#define USE_IRIDESCENCE_THICKNESSMAP":"",n.displacementMap&&n.supportsVertexTextures?"#define USE_DISPLACEMENTMAP":"",n.specularMap?"#define USE_SPECULARMAP":"",n.specularIntensityMap?"#define USE_SPECULARINTENSITYMAP":"",n.specularColorMap?"#define USE_SPECULARCOLORMAP":"",n.roughnessMap?"#define USE_ROUGHNESSMAP":"",n.metalnessMap?"#define USE_METALNESSMAP":"",n.alphaMap?"#define USE_ALPHAMAP":"",n.transmission?"#define USE_TRANSMISSION":"",n.transmissionMap?"#define USE_TRANSMISSIONMAP":"",n.thicknessMap?"#define USE_THICKNESSMAP":"",n.sheenColorMap?"#define USE_SHEENCOLORMAP":"",n.sheenRoughnessMap?"#define USE_SHEENROUGHNESSMAP":"",n.vertexTangents?"#define USE_TANGENT":"",n.vertexColors?"#define USE_COLOR":"",n.vertexAlphas?"#define USE_COLOR_ALPHA":"",n.vertexUvs?"#define USE_UV":"",n.uvsVertexOnly?"#define UVS_VERTEX_ONLY":"",n.flatShading?"#define FLAT_SHADED":"",n.skinning?"#define USE_SKINNING":"",n.morphTargets?"#define USE_MORPHTARGETS":"",n.morphNormals&&!1===n.flatShading?"#define USE_MORPHNORMALS":"",n.morphColors&&n.isWebGL2?"#define USE_MORPHCOLORS":"",n.morphTargetsCount>0&&n.isWebGL2?"#define MORPHTARGETS_TEXTURE":"",n.morphTargetsCount>0&&n.isWebGL2?"#define MORPHTARGETS_TEXTURE_STRIDE "+n.morphTextureStride:"",n.morphTargetsCount>0&&n.isWebGL2?"#define MORPHTARGETS_COUNT "+n.morphTargetsCount:"",n.doubleSided?"#define DOUBLE_SIDED":"",n.flipSided?"#define FLIP_SIDED":"",n.shadowMapEnabled?"#define USE_SHADOWMAP":"",n.shadowMapEnabled?"#define "+c:"",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","\tattribute mat4 instanceMatrix;","#endif","#ifdef USE_INSTANCING_COLOR","\tattribute vec3 instanceColor;","#endif","attribute vec3 position;","attribute vec3 normal;","attribute vec2 uv;","#ifdef USE_TANGENT","\tattribute vec4 tangent;","#endif","#if defined( USE_COLOR_ALPHA )","\tattribute vec4 color;","#elif defined( USE_COLOR )","\tattribute vec3 color;","#endif","#if ( defined( USE_MORPHTARGETS ) && ! defined( MORPHTARGETS_TEXTURE ) )","\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(Qc).join("\n"),a=[v,uh(n),"#define SHADER_NAME "+n.shaderName,m,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 "+h:"",n.envMap?"#define "+d:"",n.envMap?"#define "+p:"",f?"#define CUBEUV_TEXEL_WIDTH "+f.texelWidth:"",f?"#define CUBEUV_TEXEL_HEIGHT "+f.texelHeight:"",f?"#define CUBEUV_MAX_MIP "+f.maxMip+".0":"",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.clearcoat?"#define USE_CLEARCOAT":"",n.clearcoatMap?"#define USE_CLEARCOATMAP":"",n.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",n.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",n.iridescence?"#define USE_IRIDESCENCE":"",n.iridescenceMap?"#define USE_IRIDESCENCEMAP":"",n.iridescenceThicknessMap?"#define USE_IRIDESCENCE_THICKNESSMAP":"",n.specularMap?"#define USE_SPECULARMAP":"",n.specularIntensityMap?"#define USE_SPECULARINTENSITYMAP":"",n.specularColorMap?"#define USE_SPECULARCOLORMAP":"",n.roughnessMap?"#define USE_ROUGHNESSMAP":"",n.metalnessMap?"#define USE_METALNESSMAP":"",n.alphaMap?"#define USE_ALPHAMAP":"",n.alphaTest?"#define USE_ALPHATEST":"",n.sheen?"#define USE_SHEEN":"",n.sheenColorMap?"#define USE_SHEENCOLORMAP":"",n.sheenRoughnessMap?"#define USE_SHEENROUGHNESSMAP":"",n.transmission?"#define USE_TRANSMISSION":"",n.transmissionMap?"#define USE_TRANSMISSIONMAP":"",n.thicknessMap?"#define USE_THICKNESSMAP":"",n.decodeVideoTexture?"#define DECODE_VIDEO_TEXTURE":"",n.vertexTangents?"#define USE_TANGENT":"",n.vertexColors||n.instancingColor?"#define USE_COLOR":"",n.vertexAlphas?"#define USE_COLOR_ALPHA":"",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 "+c:"",n.premultipliedAlpha?"#define PREMULTIPLIED_ALPHA":"",n.physicallyCorrectLights?"#define PHYSICALLY_CORRECT_LIGHTS":"",n.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",n.logarithmicDepthBuffer&&n.rendererExtensionFragDepth?"#define USE_LOGDEPTHBUF_EXT":"","uniform mat4 viewMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;",n.toneMapping!==Ae?"#define TONE_MAPPING":"",n.toneMapping!==Ae?$l.tonemapping_pars_fragment:"",n.toneMapping!==Ae?Yc("toneMapping",n.toneMapping):"",n.dithering?"#define DITHERING":"",n.opaque?"#define OPAQUE":"",$l.encodings_pars_fragment,Xc("linearToOutputTexel",n.outputEncoding),n.useDepthPacking?"#define DEPTH_PACKING "+n.depthPacking:"","\n"].filter(Qc).join("\n")),l=eh(l=$c(l=nh(l),n),n),u=eh(u=$c(u=nh(u),n),n),l=oh(l),u=oh(u),n.isWebGL2&&!0!==n.isRawShaderMaterial&&(y="#version 300 es\n",i=["precision mediump sampler2DArray;","#define attribute in","#define varying out","#define texture2D texture"].join("\n")+"\n"+i,a=["#define varying in",n.glslVersion===Vn?"":"layout(location = 0) out highp vec4 pc_fragColor;",n.glslVersion===Vn?"":"#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"+a);var x,_,M=y+a+u,b=Vc(o,35633,y+i+l),S=Vc(o,35632,M);if(o.attachShader(g,b),o.attachShader(g,S),void 0!==n.index0AttributeName?o.bindAttribLocation(g,0,n.index0AttributeName):!0===n.morphTargets&&o.bindAttribLocation(g,0,"position"),o.linkProgram(g),e.debug.checkShaderErrors){var w=o.getProgramInfoLog(g).trim(),T=o.getShaderInfoLog(b).trim(),A=o.getShaderInfoLog(S).trim(),k=!0,E=!0;if(!1===o.getProgramParameter(g,35714)){k=!1;var C=qc(o,b,"vertex"),L=qc(o,S,"fragment");console.error("THREE.WebGLProgram: Shader Error "+o.getError()+" - VALIDATE_STATUS "+o.getProgramParameter(g,35715)+"\n\nProgram Info Log: "+w+"\n"+C+"\n"+L)}else""!==w?console.warn("THREE.WebGLProgram: Program Info Log:",w):""!==T&&""!==A||(E=!1);E&&(this.diagnostics={runnable:k,programLog:w,vertexShader:{log:T,prefix:i},fragmentShader:{log:A,prefix:a}})}return o.deleteShader(b),o.deleteShader(S),this.getUniforms=function(){return void 0===x&&(x=new Gc(o,g)),x},this.getAttributes=function(){return void 0===_&&(_=Kc(o,g)),_},this.destroy=function(){r.releaseStatesOfProgram(this),o.deleteProgram(g),this.program=void 0},this.name=n.shaderName,this.id=Hc++,this.cacheKey=t,this.usedTimes=1,this.program=g,this.vertexShader=b,this.fragmentShader=S,this}var mh=0,gh=function(){function e(){A(this,e),this.shaderCache=new Map,this.materialCache=new Map}return E(e,[{key:"update",value:function(e){var t=e.vertexShader,n=e.fragmentShader,r=this._getShaderStage(t),i=this._getShaderStage(n),a=this._getShaderCacheForMaterial(e);return!1===a.has(r)&&(a.add(r),r.usedTimes++),!1===a.has(i)&&(a.add(i),i.usedTimes++),this}},{key:"remove",value:function(e){var t,n=s(this.materialCache.get(e));try{for(n.s();!(t=n.n()).done;){var r=t.value;r.usedTimes--,0===r.usedTimes&&this.shaderCache.delete(r.code)}}catch(i){n.e(i)}finally{n.f()}return this.materialCache.delete(e),this}},{key:"getVertexShaderID",value:function(e){return this._getShaderStage(e.vertexShader).id}},{key:"getFragmentShaderID",value:function(e){return this._getShaderStage(e.fragmentShader).id}},{key:"dispose",value:function(){this.shaderCache.clear(),this.materialCache.clear()}},{key:"_getShaderCacheForMaterial",value:function(e){var t=this.materialCache;return!1===t.has(e)&&t.set(e,new Set),t.get(e)}},{key:"_getShaderStage",value:function(e){var t=this.shaderCache;if(!1===t.has(e)){var n=new yh(e);t.set(e,n)}return t.get(e)}}]),e}(),yh=E(function e(t){A(this,e),this.id=mh++,this.code=t,this.usedTimes=0});function xh(e,t,n,r,i,a,o){var s=new Fi,l=new gh,u=[],c=i.isWebGL2,h=i.logarithmicDepthBuffer,d=i.vertexTextures,p=i.precision,f={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"};return{getParameters:function(a,s,u,v,m){var g=v.fog,y=m.geometry,x=a.isMeshStandardMaterial?v.environment:null,_=(a.isMeshStandardMaterial?n:t).get(a.envMap||x),M=_&&_.mapping===Fe?_.image.height:null,b=f[a.type];null!==a.precision&&(p=i.getMaxPrecision(a.precision))!==a.precision&&console.warn("THREE.WebGLProgram.getParameters:",a.precision,"not supported, using",p,"instead.");var S,w,T,A,k=y.morphAttributes.position||y.morphAttributes.normal||y.morphAttributes.color,E=void 0!==k?k.length:0,C=0;if(void 0!==y.morphAttributes.position&&(C=1),void 0!==y.morphAttributes.normal&&(C=2),void 0!==y.morphAttributes.color&&(C=3),b){var L=tu[b];S=L.vertexShader,w=L.fragmentShader}else S=a.vertexShader,w=a.fragmentShader,l.update(a),T=l.getVertexShaderID(a),A=l.getFragmentShaderID(a);var R=e.getRenderTarget(),P=a.alphaTest>0,I=a.clearcoat>0,D=a.iridescence>0;return{isWebGL2:c,shaderID:b,shaderName:a.type,vertexShader:S,fragmentShader:w,defines:a.defines,customVertexShaderID:T,customFragmentShaderID:A,isRawShaderMaterial:!0===a.isRawShaderMaterial,glslVersion:a.glslVersion,precision:p,instancing:!0===m.isInstancedMesh,instancingColor:!0===m.isInstancedMesh&&null!==m.instanceColor,supportsVertexTextures:d,outputEncoding:null===R?e.outputEncoding:!0===R.isXRRenderTarget?R.texture.encoding:sn,map:!!a.map,matcap:!!a.matcap,envMap:!!_,envMapMode:_&&_.mapping,envMapCubeUVHeight:M,lightMap:!!a.lightMap,aoMap:!!a.aoMap,emissiveMap:!!a.emissiveMap,bumpMap:!!a.bumpMap,normalMap:!!a.normalMap,objectSpaceNormalMap:a.normalMapType===dn,tangentSpaceNormalMap:a.normalMapType===hn,decodeVideoTexture:!!a.map&&!0===a.map.isVideoTexture&&a.map.encoding===ln,clearcoat:I,clearcoatMap:I&&!!a.clearcoatMap,clearcoatRoughnessMap:I&&!!a.clearcoatRoughnessMap,clearcoatNormalMap:I&&!!a.clearcoatNormalMap,iridescence:D,iridescenceMap:D&&!!a.iridescenceMap,iridescenceThicknessMap:D&&!!a.iridescenceThicknessMap,displacementMap:!!a.displacementMap,roughnessMap:!!a.roughnessMap,metalnessMap:!!a.metalnessMap,specularMap:!!a.specularMap,specularIntensityMap:!!a.specularIntensityMap,specularColorMap:!!a.specularColorMap,opaque:!1===a.transparent&&a.blending===Y,alphaMap:!!a.alphaMap,alphaTest:P,gradientMap:!!a.gradientMap,sheen:a.sheen>0,sheenColorMap:!!a.sheenColorMap,sheenRoughnessMap:!!a.sheenRoughnessMap,transmission:a.transmission>0,transmissionMap:!!a.transmissionMap,thicknessMap:!!a.thicknessMap,combine:a.combine,vertexTangents:!!a.normalMap&&!!y.attributes.tangent,vertexColors:a.vertexColors,vertexAlphas:!0===a.vertexColors&&!!y.attributes.color&&4===y.attributes.color.itemSize,vertexUvs:!!(a.map||a.bumpMap||a.normalMap||a.specularMap||a.alphaMap||a.emissiveMap||a.roughnessMap||a.metalnessMap||a.clearcoatMap||a.clearcoatRoughnessMap||a.clearcoatNormalMap||a.iridescenceMap||a.iridescenceThicknessMap||a.displacementMap||a.transmissionMap||a.thicknessMap||a.specularIntensityMap||a.specularColorMap||a.sheenColorMap||a.sheenRoughnessMap),uvsVertexOnly:!(a.map||a.bumpMap||a.normalMap||a.specularMap||a.alphaMap||a.emissiveMap||a.roughnessMap||a.metalnessMap||a.clearcoatNormalMap||a.iridescenceMap||a.iridescenceThicknessMap||a.transmission>0||a.transmissionMap||a.thicknessMap||a.specularIntensityMap||a.specularColorMap||a.sheen>0||a.sheenColorMap||a.sheenRoughnessMap||!a.displacementMap),fog:!!g,useFog:!0===a.fog,fogExp2:g&&g.isFogExp2,flatShading:!!a.flatShading,sizeAttenuation:a.sizeAttenuation,logarithmicDepthBuffer:h,skinning:!0===m.isSkinnedMesh,morphTargets:void 0!==y.morphAttributes.position,morphNormals:void 0!==y.morphAttributes.normal,morphColors:void 0!==y.morphAttributes.color,morphTargetsCount:E,morphTextureStride:C,numDirLights:s.directional.length,numPointLights:s.point.length,numSpotLights:s.spot.length,numRectAreaLights:s.rectArea.length,numHemiLights:s.hemi.length,numDirLightShadows:s.directionalShadowMap.length,numPointLightShadows:s.pointShadowMap.length,numSpotLightShadows:s.spotShadowMap.length,numClippingPlanes:o.numPlanes,numClipIntersection:o.numIntersection,dithering:a.dithering,shadowMapEnabled:e.shadowMap.enabled&&u.length>0,shadowMapType:e.shadowMap.type,toneMapping:a.toneMapped?e.toneMapping:Ae,physicallyCorrectLights:e.physicallyCorrectLights,premultipliedAlpha:a.premultipliedAlpha,doubleSided:a.side===W,flipSided:a.side===H,useDepthPacking:!!a.depthPacking,depthPacking:a.depthPacking||0,index0AttributeName:a.index0AttributeName,extensionDerivatives:a.extensions&&a.extensions.derivatives,extensionFragDepth:a.extensions&&a.extensions.fragDepth,extensionDrawBuffers:a.extensions&&a.extensions.drawBuffers,extensionShaderTextureLOD:a.extensions&&a.extensions.shaderTextureLOD,rendererExtensionFragDepth:c||r.has("EXT_frag_depth"),rendererExtensionDrawBuffers:c||r.has("WEBGL_draw_buffers"),rendererExtensionShaderTextureLod:c||r.has("EXT_shader_texture_lod"),customProgramCacheKey:a.customProgramCacheKey()}},getProgramCacheKey:function(t){var n=[];if(t.shaderID?n.push(t.shaderID):(n.push(t.customVertexShaderID),n.push(t.customFragmentShaderID)),void 0!==t.defines)for(var r in t.defines)n.push(r),n.push(t.defines[r]);return!1===t.isRawShaderMaterial&&(function(e,t){e.push(t.precision),e.push(t.outputEncoding),e.push(t.envMapMode),e.push(t.envMapCubeUVHeight),e.push(t.combine),e.push(t.vertexUvs),e.push(t.fogExp2),e.push(t.sizeAttenuation),e.push(t.morphTargetsCount),e.push(t.morphAttributeCount),e.push(t.numDirLights),e.push(t.numPointLights),e.push(t.numSpotLights),e.push(t.numHemiLights),e.push(t.numRectAreaLights),e.push(t.numDirLightShadows),e.push(t.numPointLightShadows),e.push(t.numSpotLightShadows),e.push(t.shadowMapType),e.push(t.toneMapping),e.push(t.numClippingPlanes),e.push(t.numClipIntersection),e.push(t.depthPacking)}(n,t),function(e,t){s.disableAll(),t.isWebGL2&&s.enable(0),t.supportsVertexTextures&&s.enable(1),t.instancing&&s.enable(2),t.instancingColor&&s.enable(3),t.map&&s.enable(4),t.matcap&&s.enable(5),t.envMap&&s.enable(6),t.lightMap&&s.enable(7),t.aoMap&&s.enable(8),t.emissiveMap&&s.enable(9),t.bumpMap&&s.enable(10),t.normalMap&&s.enable(11),t.objectSpaceNormalMap&&s.enable(12),t.tangentSpaceNormalMap&&s.enable(13),t.clearcoat&&s.enable(14),t.clearcoatMap&&s.enable(15),t.clearcoatRoughnessMap&&s.enable(16),t.clearcoatNormalMap&&s.enable(17),t.iridescence&&s.enable(18),t.iridescenceMap&&s.enable(19),t.iridescenceThicknessMap&&s.enable(20),t.displacementMap&&s.enable(21),t.specularMap&&s.enable(22),t.roughnessMap&&s.enable(23),t.metalnessMap&&s.enable(24),t.gradientMap&&s.enable(25),t.alphaMap&&s.enable(26),t.alphaTest&&s.enable(27),t.vertexColors&&s.enable(28),t.vertexAlphas&&s.enable(29),t.vertexUvs&&s.enable(30),t.vertexTangents&&s.enable(31),t.uvsVertexOnly&&s.enable(32),t.fog&&s.enable(33),e.push(s.mask),s.disableAll(),t.useFog&&s.enable(0),t.flatShading&&s.enable(1),t.logarithmicDepthBuffer&&s.enable(2),t.skinning&&s.enable(3),t.morphTargets&&s.enable(4),t.morphNormals&&s.enable(5),t.morphColors&&s.enable(6),t.premultipliedAlpha&&s.enable(7),t.shadowMapEnabled&&s.enable(8),t.physicallyCorrectLights&&s.enable(9),t.doubleSided&&s.enable(10),t.flipSided&&s.enable(11),t.useDepthPacking&&s.enable(12),t.dithering&&s.enable(13),t.specularIntensityMap&&s.enable(14),t.specularColorMap&&s.enable(15),t.transmission&&s.enable(16),t.transmissionMap&&s.enable(17),t.thicknessMap&&s.enable(18),t.sheen&&s.enable(19),t.sheenColorMap&&s.enable(20),t.sheenRoughnessMap&&s.enable(21),t.decodeVideoTexture&&s.enable(22),t.opaque&&s.enable(23),e.push(s.mask)}(n,t),n.push(e.outputEncoding)),n.push(t.customProgramCacheKey),n.join()},getUniforms:function(e){var t,n=f[e.type];if(n){var r=tu[n];t=no.clone(r.uniforms)}else t=e.uniforms;return t},acquireProgram:function(t,n){for(var r,i=0,o=u.length;i0?r.push(c):!0===o.transparent?i.push(c):n.push(c)},unshift:function(e,t,o,s,l,u){var c=a(e,t,o,s,l,u);o.transmission>0?r.unshift(c):!0===o.transparent?i.unshift(c):n.unshift(c)},finish:function(){for(var n=t,r=e.length;n1&&n.sort(e||Mh),r.length>1&&r.sort(t||bh),i.length>1&&i.sort(t||bh)}}}function wh(){var e=new WeakMap;return{get:function(t,n){var r;return!1===e.has(t)?(r=new Sh,e.set(t,[r])):n>=e.get(t).length?(r=new Sh,e.get(t).push(r)):r=e.get(t)[n],r},dispose:function(){e=new WeakMap}}}function Th(){var e={};return{get:function(t){if(void 0!==e[t.id])return e[t.id];var n;switch(t.type){case"DirectionalLight":n={direction:new Zr,color:new Nr};break;case"SpotLight":n={position:new Zr,direction:new Zr,color:new Nr,distance:0,coneCos:0,penumbraCos:0,decay:0};break;case"PointLight":n={position:new Zr,color:new Nr,distance:0,decay:0};break;case"HemisphereLight":n={direction:new Zr,skyColor:new Nr,groundColor:new Nr};break;case"RectAreaLight":n={color:new Nr,position:new Zr,halfWidth:new Zr,halfHeight:new Zr}}return e[t.id]=n,n}}}function Ah(){var e={};return{get:function(t){if(void 0!==e[t.id])return e[t.id];var n;switch(t.type){case"DirectionalLight":case"SpotLight":n={shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new yr};break;case"PointLight":n={shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new yr,shadowCameraNear:1,shadowCameraFar:1e3}}return e[t.id]=n,n}}}var kh=0;function Eh(e,t){return(t.castShadow?1:0)-(e.castShadow?1:0)}function Ch(e,t){for(var n=new Th,r=Ah(),i={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:[],rectAreaLTC1:null,rectAreaLTC2:null,point:[],pointShadow:[],pointShadowMap:[],pointShadowMatrix:[],hemi:[]},a=0;a<9;a++)i.probe.push(new Zr);var o=new Zr,s=new Ai,l=new Ai;return{setup:function(a,o){for(var s=0,l=0,u=0,c=0;c<9;c++)i.probe[c].set(0,0,0);var h=0,d=0,p=0,f=0,v=0,m=0,g=0,y=0;a.sort(Eh);for(var x=!0!==o?Math.PI:1,_=0,M=a.length;_0&&(t.isWebGL2?(i.rectAreaLTC1=eu.LTC_FLOAT_1,i.rectAreaLTC2=eu.LTC_FLOAT_2):!0===e.has("OES_texture_float_linear")?(i.rectAreaLTC1=eu.LTC_FLOAT_1,i.rectAreaLTC2=eu.LTC_FLOAT_2):!0===e.has("OES_texture_half_float_linear")?(i.rectAreaLTC1=eu.LTC_HALF_1,i.rectAreaLTC2=eu.LTC_HALF_2):console.error("THREE.WebGLRenderer: Unable to use RectAreaLight. Missing WebGL extensions.")),i.ambient[0]=s,i.ambient[1]=l,i.ambient[2]=u;var B=i.hash;B.directionalLength===h&&B.pointLength===d&&B.spotLength===p&&B.rectAreaLength===f&&B.hemiLength===v&&B.numDirectionalShadows===m&&B.numPointShadows===g&&B.numSpotShadows===y||(i.directional.length=h,i.spot.length=p,i.rectArea.length=f,i.point.length=d,i.hemi.length=v,i.directionalShadow.length=m,i.directionalShadowMap.length=m,i.pointShadow.length=g,i.pointShadowMap.length=g,i.spotShadow.length=y,i.spotShadowMap.length=y,i.directionalShadowMatrix.length=m,i.pointShadowMatrix.length=g,i.spotShadowMatrix.length=y,B.directionalLength=h,B.pointLength=d,B.spotLength=p,B.rectAreaLength=f,B.hemiLength=v,B.numDirectionalShadows=m,B.numPointShadows=g,B.numSpotShadows=y,i.version=kh++)},setupView:function(e,t){for(var n=0,r=0,a=0,u=0,c=0,h=t.matrixWorldInverse,d=0,p=e.length;d1&&void 0!==arguments[1]?arguments[1]:0;return!1===n.has(r)?(i=new Lh(e,t),n.set(r,[i])):a>=n.get(r).length?(i=new Lh(e,t),n.get(r).push(i)):i=n.get(r)[a],i},dispose:function(){n=new WeakMap}}}var Ph=exports.MeshDepthMaterial=function(e){m(n,ca);var t=y(n);function n(e){var r;return A(this,n),(r=t.call(this)).isMeshDepthMaterial=!0,r.type="MeshDepthMaterial",r.depthPacking=un,r.map=null,r.alphaMap=null,r.displacementMap=null,r.displacementScale=1,r.displacementBias=0,r.wireframe=!1,r.wireframeLinewidth=1,r.setValues(e),r}return E(n,[{key:"copy",value:function(e){return f(b(n.prototype),"copy",this).call(this,e),this.depthPacking=e.depthPacking,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}}]),n}(),Ih=exports.MeshDistanceMaterial=function(e){m(n,ca);var t=y(n);function n(e){var r;return A(this,n),(r=t.call(this)).isMeshDistanceMaterial=!0,r.type="MeshDistanceMaterial",r.referencePosition=new Zr,r.nearDistance=1,r.farDistance=1e3,r.map=null,r.alphaMap=null,r.displacementMap=null,r.displacementScale=1,r.displacementBias=0,r.setValues(e),r}return E(n,[{key:"copy",value:function(e){return f(b(n.prototype),"copy",this).call(this,e),this.referencePosition.copy(e.referencePosition),this.nearDistance=e.nearDistance,this.farDistance=e.farDistance,this.map=e.map,this.alphaMap=e.alphaMap,this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this}}]),n}(),Dh="void main() {\n\tgl_Position = vec4( position, 1.0 );\n}",Nh="uniform sampler2D shadow_pass;\nuniform vec2 resolution;\nuniform float radius;\n#include \nvoid main() {\n\tconst float samples = float( VSM_SAMPLES );\n\tfloat mean = 0.0;\n\tfloat squared_mean = 0.0;\n\tfloat uvStride = samples <= 1.0 ? 0.0 : 2.0 / ( samples - 1.0 );\n\tfloat uvStart = samples <= 1.0 ? 0.0 : - 1.0;\n\tfor ( float i = 0.0; i < samples; i ++ ) {\n\t\tfloat uvOffset = uvStart + i * uvStride;\n\t\t#ifdef HORIZONTAL_PASS\n\t\t\tvec2 distribution = unpackRGBATo2Half( texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( uvOffset, 0.0 ) * radius ) / resolution ) );\n\t\t\tmean += distribution.x;\n\t\t\tsquared_mean += distribution.y * distribution.y + distribution.x * distribution.x;\n\t\t#else\n\t\t\tfloat depth = unpackRGBAToDepth( texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( 0.0, uvOffset ) * radius ) / resolution ) );\n\t\t\tmean += depth;\n\t\t\tsquared_mean += depth * depth;\n\t\t#endif\n\t}\n\tmean = mean / samples;\n\tsquared_mean = squared_mean / samples;\n\tfloat std_dev = sqrt( squared_mean - mean * mean );\n\tgl_FragColor = pack2HalfToRGBA( vec2( mean, std_dev ) );\n}";function Oh(e,t,n){var r=new _o,i=new yr,a=new yr,o=new Gr,s=new Ph({depthPacking:cn}),l=new Ih,u={},c=n.maxTextureSize,h={0:H,1:V,2:W},d=new ao({defines:{VSM_SAMPLES:8},uniforms:{shadow_pass:{value:null},resolution:{value:new yr},radius:{value:4}},vertexShader:Dh,fragmentShader:Nh}),p=d.clone();p.defines.HORIZONTAL_PASS=1;var f=new Pa;f.setAttribute("position",new fa(new Float32Array([-1,-1,.5,3,-1,.5,-1,3,.5]),3));var v=new Ja(f,d),m=this;function g(n,r){var a=t.update(v);d.defines.VSM_SAMPLES!==n.blurSamples&&(d.defines.VSM_SAMPLES=n.blurSamples,p.defines.VSM_SAMPLES=n.blurSamples,d.needsUpdate=!0,p.needsUpdate=!0),null===n.mapPass&&(n.mapPass=new Vr(i.x,i.y)),d.uniforms.shadow_pass.value=n.map.texture,d.uniforms.resolution.value=n.mapSize,d.uniforms.radius.value=n.radius,e.setRenderTarget(n.mapPass),e.clear(),e.renderBufferDirect(r,null,a,d,v,null),p.uniforms.shadow_pass.value=n.mapPass.texture,p.uniforms.resolution.value=n.mapSize,p.uniforms.radius.value=n.radius,e.setRenderTarget(n.map),e.clear(),e.renderBufferDirect(r,null,a,p,v,null)}function y(t,n,r,i,a,o){var c=null,d=!0===r.isPointLight?t.customDistanceMaterial:t.customDepthMaterial;if(c=void 0!==d?d:!0===r.isPointLight?l:s,e.localClippingEnabled&&!0===n.clipShadows&&Array.isArray(n.clippingPlanes)&&0!==n.clippingPlanes.length||n.displacementMap&&0!==n.displacementScale||n.alphaMap&&n.alphaTest>0){var p=c.uuid,f=n.uuid,v=u[p];void 0===v&&(v={},u[p]=v);var m=v[f];void 0===m&&(m=c.clone(),v[f]=m),c=m}return c.visible=n.visible,c.wireframe=n.wireframe,c.side=o===G?null!==n.shadowSide?n.shadowSide:n.side:null!==n.shadowSide?n.shadowSide:h[n.side],c.alphaMap=n.alphaMap,c.alphaTest=n.alphaTest,c.clipShadows=n.clipShadows,c.clippingPlanes=n.clippingPlanes,c.clipIntersection=n.clipIntersection,c.displacementMap=n.displacementMap,c.displacementScale=n.displacementScale,c.displacementBias=n.displacementBias,c.wireframeLinewidth=n.wireframeLinewidth,c.linewidth=n.linewidth,!0===r.isPointLight&&!0===c.isMeshDistanceMaterial&&(c.referencePosition.setFromMatrixPosition(r.matrixWorld),c.nearDistance=i,c.farDistance=a),c}function x(n,i,a,o,s){if(!1!==n.visible){if(n.layers.test(i.layers)&&(n.isMesh||n.isLine||n.isPoints)&&(n.castShadow||n.receiveShadow&&s===G)&&(!n.frustumCulled||r.intersectsObject(n))){n.modelViewMatrix.multiplyMatrices(a.matrixWorldInverse,n.matrixWorld);var l=t.update(n),u=n.material;if(Array.isArray(u))for(var c=l.groups,h=0,d=c.length;hc||i.y>c)&&(i.x>c&&(a.x=Math.floor(c/_.x),i.x=a.x*_.x,y.mapSize.x=a.x),i.y>c&&(a.y=Math.floor(c/_.y),i.y=a.y*_.y,y.mapSize.y=a.y)),null===y.map){var M=this.type!==G?{minFilter:Ge,magFilter:Ge}:{};y.map=new Vr(i.x,i.y,M),y.map.texture.name=v.name+".shadowMap",y.camera.updateProjectionMatrix()}e.setRenderTarget(y.map),e.clear();for(var b=y.getViewportCount(),S=0;S=1):-1!==R.indexOf("OpenGL ES")&&(L=parseFloat(/^OpenGL ES (\d)/.exec(R)[1]),C=L>=2);var P=null,I={},F=e.getParameter(3088),z=e.getParameter(2978),B=(new Gr).fromArray(F),U=(new Gr).fromArray(z);function G(t,n,r){var i=new Uint8Array(4),a=e.createTexture();e.bindTexture(t,a),e.texParameteri(t,10241,9728),e.texParameteri(t,10240,9728);for(var o=0;or||e.height>r)&&(i=r/Math.max(e.width,e.height)),i<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?pr:Math.floor,o=a(i*e.width),l=a(i*e.height);void 0===s&&(s=y(o,l));var u=n?y(o,l):s;return u.width=o,u.height=l,u.getContext("2d").drawImage(e,0,0,o,l),console.warn("THREE.WebGLRenderer: Texture has been resized from ("+e.width+"x"+e.height+") to ("+o+"x"+l+")."),u}return"data"in e&&console.warn("THREE.WebGLRenderer: Image in DataTexture is too big ("+e.width+"x"+e.height+")."),e}return e}function _(e){return hr(e.width)&&hr(e.height)}function M(e,t){return e.generateMipmaps&&t&&e.minFilter!==Ge&&e.minFilter!==qe}function b(t){e.generateMipmap(t)}function w(n,r,i,a){var o=arguments.length>4&&void 0!==arguments[4]&&arguments[4];if(!1===l)return r;if(null!==n){if(void 0!==e[n])return e[n];console.warn("THREE.WebGLRenderer: Attempt to use non-existing WebGL internal format '"+n+"'")}var s=r;return 6403===r&&(5126===i&&(s=33326),5131===i&&(s=33325),5121===i&&(s=33321)),33319===r&&(5126===i&&(s=33328),5131===i&&(s=33327),5121===i&&(s=33323)),6408===r&&(5126===i&&(s=34836),5131===i&&(s=34842),5121===i&&(s=a===ln&&!1===o?35907:32856),32819===i&&(s=32854),32820===i&&(s=32855)),33325!==s&&33326!==s&&33327!==s&&33328!==s&&34842!==s&&34836!==s||t.get("EXT_color_buffer_float"),s}function T(e,t,n){return!0===M(e,n)||e.isFramebufferTexture&&e.minFilter!==Ge&&e.minFilter!==qe?Math.log2(Math.max(t.width,t.height))+1:void 0!==e.mipmaps&&e.mipmaps.length>0?e.mipmaps.length:e.isCompressedTexture&&Array.isArray(e.image)?t.mipmaps.length:1}function A(e){return e===Ge||e===Ve||e===We?9728:9729}function k(e){var t=e.target;t.removeEventListener("dispose",k),function(e){var t=r.get(e);if(void 0===t.__webglInit)return;var n=e.source,i=m.get(n);if(i){var a=i[t.__cacheKey];a.usedTimes--,0===a.usedTimes&&C(e),0===Object.keys(i).length&&m.delete(n)}r.remove(e)}(t),t.isVideoTexture&&v.delete(t)}function E(t){var n=t.target;n.removeEventListener("dispose",E),function(t){var n=t.texture,i=r.get(t),a=r.get(n);void 0!==a.__webglTexture&&(e.deleteTexture(a.__webglTexture),o.memory.textures--);t.depthTexture&&t.depthTexture.dispose();if(t.isWebGLCubeRenderTarget)for(var s=0;s<6;s++)e.deleteFramebuffer(i.__webglFramebuffer[s]),i.__webglDepthbuffer&&e.deleteRenderbuffer(i.__webglDepthbuffer[s]);else{if(e.deleteFramebuffer(i.__webglFramebuffer),i.__webglDepthbuffer&&e.deleteRenderbuffer(i.__webglDepthbuffer),i.__webglMultisampledFramebuffer&&e.deleteFramebuffer(i.__webglMultisampledFramebuffer),i.__webglColorRenderbuffer)for(var l=0;l0&&i.__version!==e.version){var a=e.image;if(null===a)console.warn("THREE.WebGLRenderer: Texture marked for update but no image data found.");else{if(!1!==a.complete)return void O(i,e,t);console.warn("THREE.WebGLRenderer: Texture marked for update but image is incomplete")}}n.activeTexture(33984+t),n.bindTexture(3553,i.__webglTexture)}var P=S(S(S({},ze,10497),Be,33071),Ue,33648),I=S(S(S(S(S(S({},Ge,9728),Ve,9984),We,9986),qe,9729),Xe,9985),Ze,9987);function D(n,a,o){if(o?(e.texParameteri(n,10242,P[a.wrapS]),e.texParameteri(n,10243,P[a.wrapT]),32879!==n&&35866!==n||e.texParameteri(n,32882,P[a.wrapR]),e.texParameteri(n,10240,I[a.magFilter]),e.texParameteri(n,10241,I[a.minFilter])):(e.texParameteri(n,10242,33071),e.texParameteri(n,10243,33071),32879!==n&&35866!==n||e.texParameteri(n,32882,33071),a.wrapS===Be&&a.wrapT===Be||console.warn("THREE.WebGLRenderer: Texture is not power of two. Texture.wrapS and Texture.wrapT should be set to THREE.ClampToEdgeWrapping."),e.texParameteri(n,10240,A(a.magFilter)),e.texParameteri(n,10241,A(a.minFilter)),a.minFilter!==Ge&&a.minFilter!==qe&&console.warn("THREE.WebGLRenderer: Texture is not power of two. Texture.minFilter should be set to THREE.NearestFilter or THREE.LinearFilter.")),!0===t.has("EXT_texture_filter_anisotropic")){var s=t.get("EXT_texture_filter_anisotropic");if(a.type===rt&&!1===t.has("OES_texture_float_linear"))return;if(!1===l&&a.type===it&&!1===t.has("OES_texture_half_float_linear"))return;(a.anisotropy>1||r.get(a).__currentAnisotropy)&&(e.texParameterf(n,s.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(a.anisotropy,i.getMaxAnisotropy())),r.get(a).__currentAnisotropy=a.anisotropy)}}function N(t,n){var r=!1;void 0===t.__webglInit&&(t.__webglInit=!0,n.addEventListener("dispose",k));var i=n.source,a=m.get(i);void 0===a&&(a={},m.set(i,a));var s=function(e){var t=[];return t.push(e.wrapS),t.push(e.wrapT),t.push(e.magFilter),t.push(e.minFilter),t.push(e.anisotropy),t.push(e.internalFormat),t.push(e.format),t.push(e.type),t.push(e.generateMipmaps),t.push(e.premultiplyAlpha),t.push(e.flipY),t.push(e.unpackAlignment),t.push(e.encoding),t.join()}(n);if(s!==t.__cacheKey){void 0===a[s]&&(a[s]={texture:e.createTexture(),usedTimes:0},o.memory.textures++,r=!0),a[s].usedTimes++;var l=a[t.__cacheKey];void 0!==l&&(a[t.__cacheKey].usedTimes--,0===l.usedTimes&&C(n)),t.__cacheKey=s,t.__webglTexture=a[s].texture}return r}function O(t,r,i){var o=3553;r.isDataArrayTexture&&(o=35866),r.isData3DTexture&&(o=32879);var s=N(t,r),u=r.source;if(n.activeTexture(33984+i),n.bindTexture(o,t.__webglTexture),u.version!==u.__currentVersion||!0===s){e.pixelStorei(37440,r.flipY),e.pixelStorei(37441,r.premultiplyAlpha),e.pixelStorei(3317,r.unpackAlignment),e.pixelStorei(37443,0);var c,d=function(e){return!l&&(e.wrapS!==Be||e.wrapT!==Be||e.minFilter!==Ge&&e.minFilter!==qe)}(r)&&!1===_(r.image),p=x(r.image,d,!1,h),f=_(p=V(r,p))||l,v=a.convert(r.format,r.encoding),m=a.convert(r.type),g=w(r.internalFormat,v,m,r.encoding,r.isVideoTexture);D(o,r,f);var y=r.mipmaps,S=l&&!0!==r.isVideoTexture,A=void 0===u.__currentVersion||!0===s,k=T(r,p,f);if(r.isDepthTexture)g=6402,l?g=r.type===rt?36012:r.type===nt?33190:r.type===st?35056:33189:r.type===rt&&console.error("WebGLRenderer: Floating point depth texture requires WebGL2."),r.format===pt&&6402===g&&r.type!==et&&r.type!==nt&&(console.warn("THREE.WebGLRenderer: Use UnsignedShortType or UnsignedIntType for DepthFormat DepthTexture."),r.type=nt,m=a.convert(r.type)),r.format===ft&&6402===g&&(g=34041,r.type!==st&&(console.warn("THREE.WebGLRenderer: Use UnsignedInt248Type for DepthStencilFormat DepthTexture."),r.type=st,m=a.convert(r.type))),A&&(S?n.texStorage2D(3553,1,g,p.width,p.height):n.texImage2D(3553,0,g,p.width,p.height,0,v,m,null));else if(r.isDataTexture)if(y.length>0&&f){S&&A&&n.texStorage2D(3553,k,g,y[0].width,y[0].height);for(var E=0,C=y.length;E>=1,I>>=1}else if(y.length>0&&f){S&&A&&n.texStorage2D(3553,k,g,y[0].width,y[0].height);for(var F=0,z=y.length;F0&&!0===t.has("WEBGL_multisampled_render_to_texture")&&!1!==n.__useRenderToTexture}function V(e,n){var r=e.encoding,i=e.format,a=e.type;return!0===e.isCompressedTexture||!0===e.isVideoTexture||e.format===Hn?n:(r!==sn&&(r===ln?!1===l?!0===t.has("EXT_sRGB")&&i===ct?(e.format=Hn,e.minFilter=qe,e.generateMipmaps=!1):n=Or.sRGBToLinear(n):i===ct&&a===Ke||console.warn("THREE.WebGLTextures: sRGB encoded textures have to use RGBAFormat and UnsignedByteType."):console.error("THREE.WebGLTextures: Unsupported texture encoding:",r)),n)}this.allocateTextureUnit=function(){var e=L;return e>=u&&console.warn("THREE.WebGLTextures: Trying to use "+e+" texture units while this GPU supports only "+u),L+=1,e},this.resetTextureUnits=function(){L=0},this.setTexture2D=R,this.setTexture2DArray=function(e,t){var i=r.get(e);e.version>0&&i.__version!==e.version?O(i,e,t):(n.activeTexture(33984+t),n.bindTexture(35866,i.__webglTexture))},this.setTexture3D=function(e,t){var i=r.get(e);e.version>0&&i.__version!==e.version?O(i,e,t):(n.activeTexture(33984+t),n.bindTexture(32879,i.__webglTexture))},this.setTextureCube=function(t,i){var o=r.get(t);t.version>0&&o.__version!==t.version?function(t,r,i){if(6===r.image.length){var o=N(t,r),s=r.source;if(n.activeTexture(33984+i),n.bindTexture(34067,t.__webglTexture),s.version!==s.__currentVersion||!0===o){e.pixelStorei(37440,r.flipY),e.pixelStorei(37441,r.premultiplyAlpha),e.pixelStorei(3317,r.unpackAlignment),e.pixelStorei(37443,0);for(var u=r.isCompressedTexture||r.image[0].isCompressedTexture,h=r.image[0]&&r.image[0].isDataTexture,d=[],p=0;p<6;p++)d[p]=u||h?h?r.image[p].image:r.image[p]:x(r.image[p],!1,!0,c),d[p]=V(r,d[p]);var f,v=d[0],m=_(v)||l,g=a.convert(r.format,r.encoding),y=a.convert(r.type),S=w(r.internalFormat,g,y,r.encoding),A=l&&!0!==r.isVideoTexture,k=void 0===s.__currentVersion||!0===o,E=T(r,v,m);if(D(34067,r,m),u){A&&k&&n.texStorage2D(34067,E,S,v.width,v.height);for(var C=0;C<6;C++){f=d[C].mipmaps;for(var L=0;L0&&E++,n.texStorage2D(34067,E,S,d[0].width,d[0].height));for(var P=0;P<6;P++)if(h){A?n.texSubImage2D(34069+P,0,0,0,d[P].width,d[P].height,g,y,d[P].data):n.texImage2D(34069+P,0,S,d[P].width,d[P].height,0,g,y,d[P].data);for(var I=0;I0&&!1===G(t)){var x=d?s:[s];u.__webglMultisampledFramebuffer=e.createFramebuffer(),u.__webglColorRenderbuffer=[],n.bindFramebuffer(36160,u.__webglMultisampledFramebuffer);for(var S=0;S0&&!1===G(t)){var i=t.isWebGLMultipleRenderTargets?t.texture:[t.texture],a=t.width,o=t.height,s=16384,u=[],c=t.stencilBuffer?33306:36096,h=r.get(t),d=!0===t.isWebGLMultipleRenderTargets;if(d)for(var p=0;p1&&void 0!==arguments[1]?arguments[1]:null;if(n===Ke)return 5121;if(n===at)return 32819;if(n===ot)return 32820;if(n===Qe)return 5120;if(n===$e)return 5122;if(n===et)return 5123;if(n===tt)return 5124;if(n===nt)return 5125;if(n===rt)return 5126;if(n===it)return r?5131:null!==(i=t.get("OES_texture_half_float"))?i.HALF_FLOAT_OES:null;if(n===lt)return 6406;if(n===ct)return 6408;if(n===ht)return 6409;if(n===dt)return 6410;if(n===pt)return 6402;if(n===ft)return 34041;if(n===vt)return 6403;if(n===ut)return console.warn("THREE.WebGLRenderer: THREE.RGBFormat has been removed. Use THREE.RGBAFormat instead. https://github.com/mrdoob/three.js/pull/23228"),6408;if(n===Hn)return null!==(i=t.get("EXT_sRGB"))?i.SRGB_ALPHA_EXT:null;if(n===mt)return 36244;if(n===gt)return 33319;if(n===yt)return 33320;if(n===xt)return 36249;if(n===_t||n===Mt||n===bt||n===St)if(a===ln){if(null===(i=t.get("WEBGL_compressed_texture_s3tc_srgb")))return null;if(n===_t)return i.COMPRESSED_SRGB_S3TC_DXT1_EXT;if(n===Mt)return i.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT;if(n===bt)return i.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT;if(n===St)return i.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT}else{if(null===(i=t.get("WEBGL_compressed_texture_s3tc")))return null;if(n===_t)return i.COMPRESSED_RGB_S3TC_DXT1_EXT;if(n===Mt)return i.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(n===bt)return i.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(n===St)return i.COMPRESSED_RGBA_S3TC_DXT5_EXT}if(n===wt||n===Tt||n===At||n===kt){if(null===(i=t.get("WEBGL_compressed_texture_pvrtc")))return null;if(n===wt)return i.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(n===Tt)return i.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(n===At)return i.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(n===kt)return i.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}if(n===Et)return null!==(i=t.get("WEBGL_compressed_texture_etc1"))?i.COMPRESSED_RGB_ETC1_WEBGL:null;if(n===Ct||n===Lt){if(null===(i=t.get("WEBGL_compressed_texture_etc")))return null;if(n===Ct)return a===ln?i.COMPRESSED_SRGB8_ETC2:i.COMPRESSED_RGB8_ETC2;if(n===Lt)return a===ln?i.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC:i.COMPRESSED_RGBA8_ETC2_EAC}if(n===Rt||n===Pt||n===It||n===Dt||n===Nt||n===Ot||n===Ft||n===zt||n===Bt||n===Ut||n===Gt||n===Vt||n===Ht||n===Wt){if(null===(i=t.get("WEBGL_compressed_texture_astc")))return null;if(n===Rt)return a===ln?i.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR:i.COMPRESSED_RGBA_ASTC_4x4_KHR;if(n===Pt)return a===ln?i.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR:i.COMPRESSED_RGBA_ASTC_5x4_KHR;if(n===It)return a===ln?i.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR:i.COMPRESSED_RGBA_ASTC_5x5_KHR;if(n===Dt)return a===ln?i.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR:i.COMPRESSED_RGBA_ASTC_6x5_KHR;if(n===Nt)return a===ln?i.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR:i.COMPRESSED_RGBA_ASTC_6x6_KHR;if(n===Ot)return a===ln?i.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR:i.COMPRESSED_RGBA_ASTC_8x5_KHR;if(n===Ft)return a===ln?i.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR:i.COMPRESSED_RGBA_ASTC_8x6_KHR;if(n===zt)return a===ln?i.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR:i.COMPRESSED_RGBA_ASTC_8x8_KHR;if(n===Bt)return a===ln?i.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR:i.COMPRESSED_RGBA_ASTC_10x5_KHR;if(n===Ut)return a===ln?i.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR:i.COMPRESSED_RGBA_ASTC_10x6_KHR;if(n===Gt)return a===ln?i.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR:i.COMPRESSED_RGBA_ASTC_10x8_KHR;if(n===Vt)return a===ln?i.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR:i.COMPRESSED_RGBA_ASTC_10x10_KHR;if(n===Ht)return a===ln?i.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR:i.COMPRESSED_RGBA_ASTC_12x10_KHR;if(n===Wt)return a===ln?i.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR:i.COMPRESSED_RGBA_ASTC_12x12_KHR}if(n===jt){if(null===(i=t.get("EXT_texture_compression_bptc")))return null;if(n===jt)return a===ln?i.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT:i.COMPRESSED_RGBA_BPTC_UNORM_EXT}return n===st?r?34042:null!==(i=t.get("WEBGL_depth_texture"))?i.UNSIGNED_INT_24_8_WEBGL:null:void 0!==e[n]?e[n]:null}}}var Uh=exports.ArrayCamera=function(e){m(n,so);var t=y(n);function n(){var e,r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];return A(this,n),(e=t.call(this)).isArrayCamera=!0,e.cameras=r,e}return E(n)}(),Gh=exports.Group=function(e){m(n,Ki);var t=y(n);function n(){var e;return A(this,n),(e=t.call(this)).isGroup=!0,e.type="Group",e}return E(n)}(),Vh={type:"move"},Hh=function(){function e(){A(this,e),this._targetRay=null,this._grip=null,this._hand=null}return E(e,[{key:"getHandSpace",value:function(){return null===this._hand&&(this._hand=new Gh,this._hand.matrixAutoUpdate=!1,this._hand.visible=!1,this._hand.joints={},this._hand.inputState={pinching:!1}),this._hand}},{key:"getTargetRaySpace",value:function(){return null===this._targetRay&&(this._targetRay=new Gh,this._targetRay.matrixAutoUpdate=!1,this._targetRay.visible=!1,this._targetRay.hasLinearVelocity=!1,this._targetRay.linearVelocity=new Zr,this._targetRay.hasAngularVelocity=!1,this._targetRay.angularVelocity=new Zr),this._targetRay}},{key:"getGripSpace",value:function(){return null===this._grip&&(this._grip=new Gh,this._grip.matrixAutoUpdate=!1,this._grip.visible=!1,this._grip.hasLinearVelocity=!1,this._grip.linearVelocity=new Zr,this._grip.hasAngularVelocity=!1,this._grip.angularVelocity=new Zr),this._grip}},{key:"dispatchEvent",value:function(e){return null!==this._targetRay&&this._targetRay.dispatchEvent(e),null!==this._grip&&this._grip.dispatchEvent(e),null!==this._hand&&this._hand.dispatchEvent(e),this}},{key:"disconnect",value:function(e){return this.dispatchEvent({type:"disconnected",data:e}),null!==this._targetRay&&(this._targetRay.visible=!1),null!==this._grip&&(this._grip.visible=!1),null!==this._hand&&(this._hand.visible=!1),this}},{key:"update",value:function(e,t,n){var r=null,i=null,a=null,o=this._targetRay,l=this._grip,u=this._hand;if(e&&"visible-blurred"!==t.session.visibilityState){if(u&&e.hand){a=!0;var c,h=s(e.hand.values());try{for(h.s();!(c=h.n()).done;){var d=c.value,p=t.getJointPose(d,n);if(void 0===u.joints[d.jointName]){var f=new Gh;f.matrixAutoUpdate=!1,f.visible=!1,u.joints[d.jointName]=f,u.add(f)}var v=u.joints[d.jointName];null!==p&&(v.matrix.fromArray(p.transform.matrix),v.matrix.decompose(v.position,v.rotation,v.scale),v.jointRadius=p.radius),v.visible=null!==p}}catch(x){h.e(x)}finally{h.f()}var m=u.joints["index-finger-tip"],g=u.joints["thumb-tip"],y=m.position.distanceTo(g.position);u.inputState.pinching&&y>.025?(u.inputState.pinching=!1,this.dispatchEvent({type:"pinchend",handedness:e.handedness,target:this})):!u.inputState.pinching&&y<=.015&&(u.inputState.pinching=!0,this.dispatchEvent({type:"pinchstart",handedness:e.handedness,target:this}))}else null!==l&&e.gripSpace&&null!==(i=t.getPose(e.gripSpace,n))&&(l.matrix.fromArray(i.transform.matrix),l.matrix.decompose(l.position,l.rotation,l.scale),i.linearVelocity?(l.hasLinearVelocity=!0,l.linearVelocity.copy(i.linearVelocity)):l.hasLinearVelocity=!1,i.angularVelocity?(l.hasAngularVelocity=!0,l.angularVelocity.copy(i.angularVelocity)):l.hasAngularVelocity=!1);null!==o&&(null===(r=t.getPose(e.targetRaySpace,n))&&null!==i&&(r=i),null!==r&&(o.matrix.fromArray(r.transform.matrix),o.matrix.decompose(o.position,o.rotation,o.scale),r.linearVelocity?(o.hasLinearVelocity=!0,o.linearVelocity.copy(r.linearVelocity)):o.hasLinearVelocity=!1,r.angularVelocity?(o.hasAngularVelocity=!0,o.angularVelocity.copy(r.angularVelocity)):o.hasAngularVelocity=!1,this.dispatchEvent(Vh)))}return null!==o&&(o.visible=null!==r),null!==l&&(l.visible=null!==i),null!==u&&(u.visible=null!==a),this}}]),e}(),Wh=exports.DepthTexture=function(e){m(n,Ur);var t=y(n);function n(e,r,i,a,o,s,l,u,c,h){var d;if(A(this,n),(h=void 0!==h?h:pt)!==pt&&h!==ft)throw new Error("DepthTexture format must be either THREE.DepthFormat or THREE.DepthStencilFormat");return void 0===i&&h===pt&&(i=nt),void 0===i&&h===ft&&(i=st),(d=t.call(this,null,a,o,s,l,u,h,i,c)).isDepthTexture=!0,d.image={width:e,height:r},d.magFilter=void 0!==l?l:Ge,d.minFilter=void 0!==u?u:Ge,d.flipY=!1,d.generateMipmaps=!1,d}return E(n)}(),jh=function(e){m(n,Wn);var t=y(n);function n(e,r){var i;A(this,n);var a=_(i=t.call(this)),s=null,l=1,u=null,c="local-floor",h=null,d=null,p=null,f=null,v=null,m=null,g=r.getContextAttributes(),y=null,x=null,M=[],b=[],S=new so;S.layers.enable(1),S.viewport=new Gr;var T=new so;T.layers.enable(2),T.viewport=new Gr;var k=[S,T],E=new Uh;E.layers.enable(1),E.layers.enable(2);var C=null,L=null;function R(e){var t=b.indexOf(e.inputSource);if(-1!==t){var n=M[t];void 0!==n&&n.dispatchEvent({type:e.type,data:e.inputSource})}}function P(){s.removeEventListener("select",R),s.removeEventListener("selectstart",R),s.removeEventListener("selectend",R),s.removeEventListener("squeeze",R),s.removeEventListener("squeezestart",R),s.removeEventListener("squeezeend",R),s.removeEventListener("end",P),s.removeEventListener("inputsourceschange",I);for(var t=0;t=0&&(b[r]=null,M[r].dispatchEvent({type:"disconnected",data:n}))}for(var i=0;i=b.length){b.push(a),o=s;break}if(null===b[s]){b[s]=a,o=s;break}}if(-1===o)break}var l=M[o];l&&l.dispatchEvent({type:"connected",data:a})}}i.cameraAutoUpdate=!0,i.enabled=!1,i.isPresenting=!1,i.getController=function(e){var t=M[e];return void 0===t&&(t=new Hh,M[e]=t),t.getTargetRaySpace()},i.getControllerGrip=function(e){var t=M[e];return void 0===t&&(t=new Hh,M[e]=t),t.getGripSpace()},i.getHand=function(e){var t=M[e];return void 0===t&&(t=new Hh,M[e]=t),t.getHandSpace()},i.setFramebufferScaleFactor=function(e){l=e,!0===a.isPresenting&&console.warn("THREE.WebXRManager: Cannot change framebuffer scale while presenting.")},i.setReferenceSpaceType=function(e){c=e,!0===a.isPresenting&&console.warn("THREE.WebXRManager: Cannot change reference space type while presenting.")},i.getReferenceSpace=function(){return h||u},i.setReferenceSpace=function(e){h=e},i.getBaseLayer=function(){return null!==f?f:v},i.getBinding=function(){return p},i.getFrame=function(){return m},i.getSession=function(){return s},i.setSession=function(){var t=o(w().mark(function t(n){var i,o,d,m,_;return w().wrap(function(t){for(;;)switch(t.prev=t.next){case 0:if(null===(s=n)){t.next=25;break}if(y=e.getRenderTarget(),s.addEventListener("select",R),s.addEventListener("selectstart",R),s.addEventListener("selectend",R),s.addEventListener("squeeze",R),s.addEventListener("squeezestart",R),s.addEventListener("squeezeend",R),s.addEventListener("end",P),s.addEventListener("inputsourceschange",I),!0===g.xrCompatible){t.next=14;break}return t.next=14,r.makeXRCompatible();case 14:return void 0===s.renderState.layers||!1===e.capabilities.isWebGL2?(i={antialias:void 0!==s.renderState.layers||g.antialias,alpha:g.alpha,depth:g.depth,stencil:g.stencil,framebufferScaleFactor:l},v=new XRWebGLLayer(s,r,i),s.updateRenderState({baseLayer:v}),x=new Vr(v.framebufferWidth,v.framebufferHeight,{format:ct,type:Ke,encoding:e.outputEncoding})):(o=null,d=null,m=null,g.depth&&(m=g.stencil?35056:33190,o=g.stencil?ft:pt,d=g.stencil?st:nt),_={colorFormat:32856,depthFormat:m,scaleFactor:l},p=new XRWebGLBinding(s,r),f=p.createProjectionLayer(_),s.updateRenderState({layers:[f]}),x=new Vr(f.textureWidth,f.textureHeight,{format:ct,type:Ke,depthTexture:new Wh(f.textureWidth,f.textureHeight,d,void 0,void 0,void 0,void 0,void 0,void 0,o),stencilBuffer:g.stencil,encoding:e.outputEncoding,samples:g.antialias?4:0}),e.properties.get(x).__ignoreDepthValues=f.ignoreDepthValues),x.isXRRenderTarget=!0,this.setFoveation(1),h=null,t.next=20,s.requestReferenceSpace(c);case 20:u=t.sent,z.setContext(s),z.start(),a.isPresenting=!0,a.dispatchEvent({type:"sessionstart"});case 25:case"end":return t.stop()}},t,this)}));return function(e){return t.apply(this,arguments)}}();var D=new Zr,N=new Zr;function O(e,t){null===t?e.matrixWorld.copy(e.matrix):e.matrixWorld.multiplyMatrices(t.matrixWorld,e.matrix),e.matrixWorldInverse.copy(e.matrixWorld).invert()}i.updateCamera=function(e){if(null!==s){E.near=T.near=S.near=e.near,E.far=T.far=S.far=e.far,C===E.near&&L===E.far||(s.updateRenderState({depthNear:E.near,depthFar:E.far}),C=E.near,L=E.far);var t=e.parent,n=E.cameras;O(E,t);for(var r=0;r0&&(n.alphaTest.value=r.alphaTest);var i,a,o=t.get(r).envMap;if(o&&(n.envMap.value=o,n.flipEnvMap.value=o.isCubeTexture&&!1===o.isRenderTargetTexture?-1:1,n.reflectivity.value=r.reflectivity,n.ior.value=r.ior,n.refractionRatio.value=r.refractionRatio),r.lightMap){n.lightMap.value=r.lightMap;var s=!0!==e.physicallyCorrectLights?Math.PI:1;n.lightMapIntensity.value=r.lightMapIntensity*s}r.aoMap&&(n.aoMap.value=r.aoMap,n.aoMapIntensity.value=r.aoMapIntensity),r.map?i=r.map:r.specularMap?i=r.specularMap:r.displacementMap?i=r.displacementMap:r.normalMap?i=r.normalMap:r.bumpMap?i=r.bumpMap:r.roughnessMap?i=r.roughnessMap:r.metalnessMap?i=r.metalnessMap:r.alphaMap?i=r.alphaMap:r.emissiveMap?i=r.emissiveMap:r.clearcoatMap?i=r.clearcoatMap:r.clearcoatNormalMap?i=r.clearcoatNormalMap:r.clearcoatRoughnessMap?i=r.clearcoatRoughnessMap:r.iridescenceMap?i=r.iridescenceMap:r.iridescenceThicknessMap?i=r.iridescenceThicknessMap:r.specularIntensityMap?i=r.specularIntensityMap:r.specularColorMap?i=r.specularColorMap:r.transmissionMap?i=r.transmissionMap:r.thicknessMap?i=r.thicknessMap:r.sheenColorMap?i=r.sheenColorMap:r.sheenRoughnessMap&&(i=r.sheenRoughnessMap),void 0!==i&&(i.isWebGLRenderTarget&&(i=i.texture),!0===i.matrixAutoUpdate&&i.updateMatrix(),n.uvTransform.value.copy(i.matrix)),r.aoMap?a=r.aoMap:r.lightMap&&(a=r.lightMap),void 0!==a&&(a.isWebGLRenderTarget&&(a=a.texture),!0===a.matrixAutoUpdate&&a.updateMatrix(),n.uv2Transform.value.copy(a.matrix))}return{refreshFogUniforms:function(e,t){e.fogColor.value.copy(t.color),t.isFog?(e.fogNear.value=t.near,e.fogFar.value=t.far):t.isFogExp2&&(e.fogDensity.value=t.density)},refreshMaterialUniforms:function(e,r,i,a,o){r.isMeshBasicMaterial?n(e,r):r.isMeshLambertMaterial?n(e,r):r.isMeshToonMaterial?(n(e,r),function(e,t){t.gradientMap&&(e.gradientMap.value=t.gradientMap)}(e,r)):r.isMeshPhongMaterial?(n(e,r),function(e,t){e.specular.value.copy(t.specular),e.shininess.value=Math.max(t.shininess,1e-4)}(e,r)):r.isMeshStandardMaterial?(n(e,r),function(e,n){e.roughness.value=n.roughness,e.metalness.value=n.metalness,n.roughnessMap&&(e.roughnessMap.value=n.roughnessMap),n.metalnessMap&&(e.metalnessMap.value=n.metalnessMap),t.get(n).envMap&&(e.envMapIntensity.value=n.envMapIntensity)}(e,r),r.isMeshPhysicalMaterial&&function(e,t,n){e.ior.value=t.ior,t.sheen>0&&(e.sheenColor.value.copy(t.sheenColor).multiplyScalar(t.sheen),e.sheenRoughness.value=t.sheenRoughness,t.sheenColorMap&&(e.sheenColorMap.value=t.sheenColorMap),t.sheenRoughnessMap&&(e.sheenRoughnessMap.value=t.sheenRoughnessMap)),t.clearcoat>0&&(e.clearcoat.value=t.clearcoat,e.clearcoatRoughness.value=t.clearcoatRoughness,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===H&&e.clearcoatNormalScale.value.negate())),t.iridescence>0&&(e.iridescence.value=t.iridescence,e.iridescenceIOR.value=t.iridescenceIOR,e.iridescenceThicknessMinimum.value=t.iridescenceThicknessRange[0],e.iridescenceThicknessMaximum.value=t.iridescenceThicknessRange[1],t.iridescenceMap&&(e.iridescenceMap.value=t.iridescenceMap),t.iridescenceThicknessMap&&(e.iridescenceThicknessMap.value=t.iridescenceThicknessMap)),t.transmission>0&&(e.transmission.value=t.transmission,e.transmissionSamplerMap.value=n.texture,e.transmissionSamplerSize.value.set(n.width,n.height),t.transmissionMap&&(e.transmissionMap.value=t.transmissionMap),e.thickness.value=t.thickness,t.thicknessMap&&(e.thicknessMap.value=t.thicknessMap),e.attenuationDistance.value=t.attenuationDistance,e.attenuationColor.value.copy(t.attenuationColor)),e.specularIntensity.value=t.specularIntensity,e.specularColor.value.copy(t.specularColor),t.specularIntensityMap&&(e.specularIntensityMap.value=t.specularIntensityMap),t.specularColorMap&&(e.specularColorMap.value=t.specularColorMap)}(e,r,o)):r.isMeshMatcapMaterial?(n(e,r),function(e,t){t.matcap&&(e.matcap.value=t.matcap)}(e,r)):r.isMeshDepthMaterial?n(e,r):r.isMeshDistanceMaterial?(n(e,r),function(e,t){e.referencePosition.value.copy(t.referencePosition),e.nearDistance.value=t.nearDistance,e.farDistance.value=t.farDistance}(e,r)):r.isMeshNormalMaterial?n(e,r):r.isLineBasicMaterial?(function(e,t){e.diffuse.value.copy(t.color),e.opacity.value=t.opacity}(e,r),r.isLineDashedMaterial&&function(e,t){e.dashSize.value=t.dashSize,e.totalSize.value=t.dashSize+t.gapSize,e.scale.value=t.scale}(e,r)):r.isPointsMaterial?function(e,t,n,r){var i;e.diffuse.value.copy(t.color),e.opacity.value=t.opacity,e.size.value=t.size*n,e.scale.value=.5*r,t.map&&(e.map.value=t.map),t.alphaMap&&(e.alphaMap.value=t.alphaMap),t.alphaTest>0&&(e.alphaTest.value=t.alphaTest),t.map?i=t.map:t.alphaMap&&(i=t.alphaMap),void 0!==i&&(!0===i.matrixAutoUpdate&&i.updateMatrix(),e.uvTransform.value.copy(i.matrix))}(e,r,i,a):r.isSpriteMaterial?function(e,t){var n;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),t.alphaTest>0&&(e.alphaTest.value=t.alphaTest),t.map?n=t.map:t.alphaMap&&(n=t.alphaMap),void 0!==n&&(!0===n.matrixAutoUpdate&&n.updateMatrix(),e.uvTransform.value.copy(n.matrix))}(e,r):r.isShadowMaterial?(e.color.value.copy(r.color),e.opacity.value=r.opacity):r.isShaderMaterial&&(r.uniformsNeedUpdate=!1)}}}function Xh(){var e=Sr("canvas");return e.style.display="block",e}function Yh(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this.isWebGLRenderer=!0;var t,n=void 0!==e.canvas?e.canvas:Xh(),r=void 0!==e.context?e.context:null,i=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,l=void 0!==e.preserveDrawingBuffer&&e.preserveDrawingBuffer,u=void 0!==e.powerPreference?e.powerPreference:"default",c=void 0!==e.failIfMajorPerformanceCaveat&&e.failIfMajorPerformanceCaveat;t=null!==r?r.getContextAttributes().alpha:void 0!==e.alpha&&e.alpha;var h=null,d=null,p=[],f=[];this.domElement=n,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.outputEncoding=sn,this.physicallyCorrectLights=!1,this.toneMapping=Ae,this.toneMappingExposure=1,Object.defineProperties(this,{gammaFactor:{get:function(){return console.warn("THREE.WebGLRenderer: .gammaFactor has been removed."),2},set:function(){console.warn("THREE.WebGLRenderer: .gammaFactor has been removed.")}}});var v=this,m=!1,g=0,y=0,x=null,_=-1,M=null,b=new Gr,S=new Gr,w=null,T=n.width,A=n.height,k=1,E=null,C=null,L=new Gr(0,0,T,A),P=new Gr(0,0,T,A),I=!1,D=new _o,N=!1,O=!1,F=null,z=new Ai,B=new yr,U=new Zr,G={background:null,fog:null,environment:null,overrideMaterial:null,isScene:!0};function j(){return null===x?k:1}var q,X,Y,Z,J,K,Q,$,ee,te,ne,re,ie,ae,oe,se,le,ue,ce,he,de,pe,fe,ve=r;function me(e,t){for(var r=0;r0&&void 0!==arguments[0])||arguments[0])&&(e|=16384),(!(arguments.length>1&&void 0!==arguments[1])||arguments[1])&&(e|=256),(!(arguments.length>2&&void 0!==arguments[2])||arguments[2])&&(e|=1024),ve.clear(e)},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(){n.removeEventListener("webglcontextlost",Me,!1),n.removeEventListener("webglcontextrestored",be,!1),n.removeEventListener("webglcontextcreationerror",Se,!1),ae.dispose(),oe.dispose(),J.dispose(),Q.dispose(),$.dispose(),ne.dispose(),fe.dispose(),re.dispose(),_e.dispose(),_e.removeEventListener("sessionstart",ke),_e.removeEventListener("sessionend",Ee),F&&(F.dispose(),F=null),Ce.stop()},this.renderBufferDirect=function(e,t,n,r,i,a){null===t&&(t=G);var o=i.isMesh&&i.matrixWorld.determinant()<0,s=function(e,t,n,r,i){!0!==t.isScene&&(t=G);K.resetTextureUnits();var a=t.fog,o=r.isMeshStandardMaterial?t.environment:null,s=null===x?v.outputEncoding:!0===x.isXRRenderTarget?x.texture.encoding:sn,l=(r.isMeshStandardMaterial?$:Q).get(r.envMap||o),u=!0===r.vertexColors&&!!n.attributes.color&&4===n.attributes.color.itemSize,c=!!r.normalMap&&!!n.attributes.tangent,h=!!n.morphAttributes.position,p=!!n.morphAttributes.normal,f=!!n.morphAttributes.color,m=r.toneMapped?v.toneMapping:Ae,g=n.morphAttributes.position||n.morphAttributes.normal||n.morphAttributes.color,y=void 0!==g?g.length:0,b=J.get(r),S=d.state.lights;if(!0===N&&(!0===O||e!==M)){var w=e===M&&r.id===_;se.setState(r,e,w)}var T=!1;r.version===b.__version?b.needsLights&&b.lightsStateVersion!==S.state.version?T=!0:b.outputEncoding!==s?T=!0:i.isInstancedMesh&&!1===b.instancing?T=!0:i.isInstancedMesh||!0!==b.instancing?i.isSkinnedMesh&&!1===b.skinning?T=!0:i.isSkinnedMesh||!0!==b.skinning?b.envMap!==l?T=!0:!0===r.fog&&b.fog!==a?T=!0:void 0===b.numClippingPlanes||b.numClippingPlanes===se.numPlanes&&b.numIntersection===se.numIntersection?b.vertexAlphas!==u?T=!0:b.vertexTangents!==c?T=!0:b.morphTargets!==h?T=!0:b.morphNormals!==p?T=!0:b.morphColors!==f?T=!0:b.toneMapping!==m?T=!0:!0===X.isWebGL2&&b.morphTargetsCount!==y&&(T=!0):T=!0:T=!0:T=!0:(T=!0,b.__version=r.version);var E=b.currentProgram;!0===T&&(E=Ie(r,t,i));var C=!1,L=!1,R=!1,P=E.getUniforms(),I=b.uniforms;Y.useProgram(E.program)&&(C=!0,L=!0,R=!0);r.id!==_&&(_=r.id,L=!0);if(C||M!==e){if(P.setValue(ve,"projectionMatrix",e.projectionMatrix),X.logarithmicDepthBuffer&&P.setValue(ve,"logDepthBufFC",2/(Math.log(e.far+1)/Math.LN2)),M!==e&&(M=e,L=!0,R=!0),r.isShaderMaterial||r.isMeshPhongMaterial||r.isMeshToonMaterial||r.isMeshStandardMaterial||r.envMap){var D=P.map.cameraPosition;void 0!==D&&D.setValue(ve,U.setFromMatrixPosition(e.matrixWorld))}(r.isMeshPhongMaterial||r.isMeshToonMaterial||r.isMeshLambertMaterial||r.isMeshBasicMaterial||r.isMeshStandardMaterial||r.isShaderMaterial)&&P.setValue(ve,"isOrthographic",!0===e.isOrthographicCamera),(r.isMeshPhongMaterial||r.isMeshToonMaterial||r.isMeshLambertMaterial||r.isMeshBasicMaterial||r.isMeshStandardMaterial||r.isShaderMaterial||r.isShadowMaterial||i.isSkinnedMesh)&&P.setValue(ve,"viewMatrix",e.matrixWorldInverse)}if(i.isSkinnedMesh){P.setOptional(ve,i,"bindMatrix"),P.setOptional(ve,i,"bindMatrixInverse");var z=i.skeleton;z&&(X.floatVertexTextures?(null===z.boneTexture&&z.computeBoneTexture(),P.setValue(ve,"boneTexture",z.boneTexture,K),P.setValue(ve,"boneTextureSize",z.boneTextureSize)):console.warn("THREE.WebGLRenderer: SkinnedMesh can only be used with WebGL 2. With WebGL 1 OES_texture_float and vertex textures support is required."))}var B=n.morphAttributes;(void 0!==B.position||void 0!==B.normal||void 0!==B.color&&!0===X.isWebGL2)&&ce.update(i,n,r,E);(L||b.receiveShadow!==i.receiveShadow)&&(b.receiveShadow=i.receiveShadow,P.setValue(ve,"receiveShadow",i.receiveShadow));L&&(P.setValue(ve,"toneMappingExposure",v.toneMappingExposure),b.needsLights&&(H=R,(V=I).ambientLightColor.needsUpdate=H,V.lightProbe.needsUpdate=H,V.directionalLights.needsUpdate=H,V.directionalLightShadows.needsUpdate=H,V.pointLights.needsUpdate=H,V.pointLightShadows.needsUpdate=H,V.spotLights.needsUpdate=H,V.spotLightShadows.needsUpdate=H,V.rectAreaLights.needsUpdate=H,V.hemisphereLights.needsUpdate=H),a&&!0===r.fog&&ie.refreshFogUniforms(I,a),ie.refreshMaterialUniforms(I,r,k,A,F),Gc.upload(ve,b.uniformsList,I,K));var V,H;r.isShaderMaterial&&!0===r.uniformsNeedUpdate&&(Gc.upload(ve,b.uniformsList,I,K),r.uniformsNeedUpdate=!1);r.isSpriteMaterial&&P.setValue(ve,"center",i.center);return P.setValue(ve,"modelViewMatrix",i.modelViewMatrix),P.setValue(ve,"normalMatrix",i.normalMatrix),P.setValue(ve,"modelMatrix",i.matrixWorld),E}(e,t,n,r,i);Y.setMaterial(r,o);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 c,h=1;!0===r.wireframe&&(l=te.getWireframeAttribute(n),h=2),fe.setup(i,r,s,n,l);var p=he;null!==l&&(c=ee.get(l),(p=de).setIndex(c));var f=null!==l?l.count:u.count,m=n.drawRange.start*h,g=n.drawRange.count*h,y=null!==a?a.start*h:0,b=null!==a?a.count*h:1/0,S=Math.max(m,y),w=Math.min(f,m+g,y+b)-1,T=Math.max(0,w-S+1);if(0!==T){if(i.isMesh)!0===r.wireframe?(Y.setLineWidth(r.wireframeLinewidth*j()),p.setMode(1)):p.setMode(4);else if(i.isLine){var E=r.linewidth;void 0===E&&(E=1),Y.setLineWidth(E*j()),i.isLineSegments?p.setMode(1):i.isLineLoop?p.setMode(2):p.setMode(3)}else i.isPoints?p.setMode(0):i.isSprite&&p.setMode(4);if(i.isInstancedMesh)p.renderInstances(S,T,i.count);else if(n.isInstancedBufferGeometry){var C=Math.min(n.instanceCount,n._maxInstanceCount);p.renderInstances(S,T,C)}else p.render(S,T)}},this.compile=function(e,t){(d=oe.get(e)).init(),f.push(d),e.traverseVisible(function(e){e.isLight&&e.layers.test(t.layers)&&(d.pushLight(e),e.castShadow&&d.pushShadow(e))}),d.setupLights(v.physicallyCorrectLights),e.traverse(function(t){var n=t.material;if(n)if(Array.isArray(n))for(var r=0;r0&&function(e,t,n){var r=X.isWebGL2;null===F&&(F=new Vr(1,1,{generateMipmaps:!0,type:q.has("EXT_color_buffer_half_float")?it:Ke,minFilter:Ze,samples:r&&!0===o?4:0}));v.getDrawingBufferSize(B),r?F.setSize(B.x,B.y):F.setSize(pr(B.x),pr(B.y));var i=v.getRenderTarget();v.setRenderTarget(F),v.clear();var a=v.toneMapping;v.toneMapping=Ae,Re(e,t,n),v.toneMapping=a,K.updateMultisampleRenderTarget(F),K.updateRenderTargetMipmap(F),v.setRenderTarget(i)}(i,t,n),r&&Y.viewport(b.copy(r)),i.length>0&&Re(i,t,n),a.length>0&&Re(a,t,n),s.length>0&&Re(s,t,n),Y.buffers.depth.setTest(!0),Y.buffers.depth.setMask(!0),Y.buffers.color.setMask(!0),Y.setPolygonOffset(!1)}function Re(e,t,n){for(var r=!0===t.isScene?t.overrideMaterial:null,i=0,a=e.length;i0?f[f.length-1]:null,p.pop(),h=p.length>0?p[p.length-1]:null}}else console.error("THREE.WebGLRenderer.render: camera is not an instance of THREE.Camera.")},this.getActiveCubeFace=function(){return g},this.getActiveMipmapLevel=function(){return y},this.getRenderTarget=function(){return x},this.setRenderTargetTextures=function(e,t,n){J.get(e.texture).__webglTexture=t,J.get(e.depthTexture).__webglTexture=n;var r=J.get(e);r.__hasExternalTextures=!0,r.__hasExternalTextures&&(r.__autoAllocateDepthBuffer=void 0===n,r.__autoAllocateDepthBuffer||!0===q.has("WEBGL_multisampled_render_to_texture")&&(console.warn("THREE.WebGLRenderer: Render-to-texture extension was disabled because an external texture was provided"),r.__useRenderToTexture=!1))},this.setRenderTargetFramebuffer=function(e,t){var n=J.get(e);n.__webglFramebuffer=t,n.__useDefaultFramebuffer=void 0===t},this.setRenderTarget=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;x=e,g=t,y=n;var r=!0;if(e){var i=J.get(e);void 0!==i.__useDefaultFramebuffer?(Y.bindFramebuffer(36160,null),r=!1):void 0===i.__webglFramebuffer?K.setupRenderTarget(e):i.__hasExternalTextures&&K.rebindTextures(e,J.get(e.texture).__webglTexture,J.get(e.depthTexture).__webglTexture)}var a=null,o=!1,s=!1;if(e){var l=e.texture;(l.isData3DTexture||l.isDataArrayTexture)&&(s=!0);var u=J.get(e).__webglFramebuffer;e.isWebGLCubeRenderTarget?(a=u[t],o=!0):a=X.isWebGL2&&e.samples>0&&!1===K.useMultisampledRTT(e)?J.get(e).__webglMultisampledFramebuffer:u,b.copy(e.viewport),S.copy(e.scissor),w=e.scissorTest}else b.copy(L).multiplyScalar(k).floor(),S.copy(P).multiplyScalar(k).floor(),w=I;if(Y.bindFramebuffer(36160,a)&&X.drawBuffers&&r&&Y.drawBuffers(e,a),Y.viewport(b),Y.scissor(S),Y.setScissorTest(w),o){var c=J.get(e.texture);ve.framebufferTexture2D(36160,36064,34069+t,c.__webglTexture,n)}else if(s){var h=J.get(e.texture),d=t||0;ve.framebufferTextureLayer(36160,36064,h.__webglTexture,n||0,d)}_=-1},this.readRenderTargetPixels=function(e,t,n,r,i,a,o){if(e&&e.isWebGLRenderTarget){var s=J.get(e).__webglFramebuffer;if(e.isWebGLCubeRenderTarget&&void 0!==o&&(s=s[o]),s){Y.bindFramebuffer(36160,s);try{var l=e.texture,u=l.format,c=l.type;if(u!==ct&&pe.convert(u)!==ve.getParameter(35739))return void console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.");var h=c===it&&(q.has("EXT_color_buffer_half_float")||X.isWebGL2&&q.has("EXT_color_buffer_float"));if(!(c===Ke||pe.convert(c)===ve.getParameter(35738)||c===rt&&(X.isWebGL2||q.has("OES_texture_float")||q.has("WEBGL_color_buffer_float"))||h))return void console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.");t>=0&&t<=e.width-r&&n>=0&&n<=e.height-i&&ve.readPixels(t,n,r,i,pe.convert(u),pe.convert(c),a)}finally{var d=null!==x?J.get(x).__webglFramebuffer:null;Y.bindFramebuffer(36160,d)}}}else console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.")},this.copyFramebufferToTexture=function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,r=Math.pow(2,-n),i=Math.floor(t.image.width*r),a=Math.floor(t.image.height*r);K.setTexture2D(t,0),ve.copyTexSubImage2D(3553,n,0,0,e.x,e.y,i,a),Y.unbindTexture()},this.copyTextureToTexture=function(e,t,n){var r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0,i=t.image.width,a=t.image.height,o=pe.convert(n.format),s=pe.convert(n.type);K.setTexture2D(n,0),ve.pixelStorei(37440,n.flipY),ve.pixelStorei(37441,n.premultiplyAlpha),ve.pixelStorei(3317,n.unpackAlignment),t.isDataTexture?ve.texSubImage2D(3553,r,e.x,e.y,i,a,o,s,t.image.data):t.isCompressedTexture?ve.compressedTexSubImage2D(3553,r,e.x,e.y,t.mipmaps[0].width,t.mipmaps[0].height,o,t.mipmaps[0].data):ve.texSubImage2D(3553,r,e.x,e.y,o,s,t.image),0===r&&n.generateMipmaps&&ve.generateMipmap(3553),Y.unbindTexture()},this.copyTextureToTexture3D=function(e,t,n,r){var i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0;if(v.isWebGL1Renderer)console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: can only be used with WebGL2.");else{var a,o=e.max.x-e.min.x+1,s=e.max.y-e.min.y+1,l=e.max.z-e.min.z+1,u=pe.convert(r.format),c=pe.convert(r.type);if(r.isData3DTexture)K.setTexture3D(r,0),a=32879;else{if(!r.isDataArrayTexture)return void console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: only supports THREE.DataTexture3D and THREE.DataTexture2DArray.");K.setTexture2DArray(r,0),a=35866}ve.pixelStorei(37440,r.flipY),ve.pixelStorei(37441,r.premultiplyAlpha),ve.pixelStorei(3317,r.unpackAlignment);var h=ve.getParameter(3314),d=ve.getParameter(32878),p=ve.getParameter(3316),f=ve.getParameter(3315),m=ve.getParameter(32877),g=n.isCompressedTexture?n.mipmaps[0]:n.image;ve.pixelStorei(3314,g.width),ve.pixelStorei(32878,g.height),ve.pixelStorei(3316,e.min.x),ve.pixelStorei(3315,e.min.y),ve.pixelStorei(32877,e.min.z),n.isDataTexture||n.isData3DTexture?ve.texSubImage3D(a,i,t.x,t.y,t.z,o,s,l,u,c,g.data):n.isCompressedTexture?(console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: untested support for compressed srcTexture."),ve.compressedTexSubImage3D(a,i,t.x,t.y,t.z,o,s,l,u,g.data)):ve.texSubImage3D(a,i,t.x,t.y,t.z,o,s,l,u,c,g),ve.pixelStorei(3314,h),ve.pixelStorei(32878,d),ve.pixelStorei(3316,p),ve.pixelStorei(3315,f),ve.pixelStorei(32877,m),0===i&&r.generateMipmaps&&ve.generateMipmap(a),Y.unbindTexture()}},this.initTexture=function(e){e.isCubeTexture?K.setTextureCube(e,0):e.isData3DTexture?K.setTexture3D(e,0):e.isDataArrayTexture?K.setTexture2DArray(e,0):K.setTexture2D(e,0),Y.unbindTexture()},this.resetState=function(){g=0,y=0,x=null,Y.reset(),fe.reset()},"undefined"!=typeof __THREE_DEVTOOLS__&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}var Zh=exports.WebGL1Renderer=function(e){m(n,Yh);var t=y(n);function n(){return A(this,n),t.apply(this,arguments)}return E(n)}();Zh.prototype.isWebGL1Renderer=!0;var Jh,Kh=exports.FogExp2=function(){function e(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:25e-5;A(this,e),this.isFogExp2=!0,this.name="",this.color=new Nr(t),this.density=n}return E(e,[{key:"clone",value:function(){return new e(this.color,this.density)}},{key:"toJSON",value:function(){return{type:"FogExp2",color:this.color.getHex(),density:this.density}}}]),e}(),Qh=exports.Fog=function(){function e(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1e3;A(this,e),this.isFog=!0,this.name="",this.color=new Nr(t),this.near=n,this.far=r}return E(e,[{key:"clone",value:function(){return new e(this.color,this.near,this.far)}},{key:"toJSON",value:function(){return{type:"Fog",color:this.color.getHex(),near:this.near,far:this.far}}}]),e}(),$h=exports.Scene=function(e){m(n,Ki);var t=y(n);function n(){var e;return A(this,n),(e=t.call(this)).isScene=!0,e.type="Scene",e.background=null,e.environment=null,e.fog=null,e.overrideMaterial=null,e.autoUpdate=!0,"undefined"!=typeof __THREE_DEVTOOLS__&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:_(e)})),e}return E(n,[{key:"copy",value:function(e,t){return f(b(n.prototype),"copy",this).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}},{key:"toJSON",value:function(e){var t=f(b(n.prototype),"toJSON",this).call(this,e);return null!==this.fog&&(t.object.fog=this.fog.toJSON()),t}}]),n}(),ed=exports.InterleavedBuffer=function(){function e(t,n){A(this,e),this.isInterleavedBuffer=!0,this.array=t,this.stride=n,this.count=void 0!==t?t.length/n:0,this.usage=Pn,this.updateRange={offset:0,count:-1},this.version=0,this.uuid=Zn()}return E(e,[{key:"onUploadCallback",value:function(){}},{key:"needsUpdate",set:function(e){!0===e&&this.version++}},{key:"setUsage",value:function(e){return this.usage=e,this}},{key:"copy",value:function(e){return this.array=new e.array.constructor(e.array),this.count=e.count,this.stride=e.stride,this.usage=e.usage,this}},{key:"copyAt",value:function(e,t,n){e*=this.stride,n*=t.stride;for(var r=0,i=this.stride;r1&&void 0!==arguments[1]?arguments[1]:0;return this.array.set(e,t),this}},{key:"clone",value:function(e){void 0===e.arrayBuffers&&(e.arrayBuffers={}),void 0===this.array.buffer._uuid&&(this.array.buffer._uuid=Zn()),void 0===e.arrayBuffers[this.array.buffer._uuid]&&(e.arrayBuffers[this.array.buffer._uuid]=this.array.slice(0).buffer);var t=new this.array.constructor(e.arrayBuffers[this.array.buffer._uuid]),n=new this.constructor(t,this.stride);return n.setUsage(this.usage),n}},{key:"onUpload",value:function(e){return this.onUploadCallback=e,this}},{key:"toJSON",value:function(e){return void 0===e.arrayBuffers&&(e.arrayBuffers={}),void 0===this.array.buffer._uuid&&(this.array.buffer._uuid=Zn()),void 0===e.arrayBuffers[this.array.buffer._uuid]&&(e.arrayBuffers[this.array.buffer._uuid]=Array.from(new Uint32Array(this.array.buffer))),{uuid:this.uuid,buffer:this.array.buffer._uuid,type:this.array.constructor.name,stride:this.stride}}}]),e}(),td=new Zr,nd=exports.InterleavedBufferAttribute=function(){function e(t,n,r){var i=arguments.length>3&&void 0!==arguments[3]&&arguments[3];A(this,e),this.isInterleavedBufferAttribute=!0,this.name="",this.data=t,this.itemSize=n,this.offset=r,this.normalized=!0===i}return E(e,[{key:"count",get:function(){return this.data.count}},{key:"array",get:function(){return this.data.array}},{key:"needsUpdate",set:function(e){this.data.needsUpdate=e}},{key:"applyMatrix4",value:function(e){for(var t=0,n=this.data.count;te.far||t.push({distance:s,point:id.clone(),uv:la.getUV(id,cd,hd,dd,pd,fd,vd,new yr),face:null,object:this})}}},{key:"copy",value:function(e,t){return f(b(n.prototype),"copy",this).call(this,e,t),void 0!==e.center&&this.center.copy(e.center),this.material=e.material,this}}]),n}();function gd(e,t,n,r,i,a){sd.subVectors(e,n).addScalar(.5).multiply(r),void 0!==i?(ld.x=a*sd.x-i*sd.y,ld.y=i*sd.x+a*sd.y):ld.copy(sd),e.copy(t),e.x+=ld.x,e.y+=ld.y,e.applyMatrix4(ud)}var yd=new Zr,xd=new Zr,_d=exports.LOD=function(e){m(n,Ki);var t=y(n);function n(){var e;return A(this,n),(e=t.call(this))._currentLevel=0,e.type="LOD",Object.defineProperties(_(e),{levels:{enumerable:!0,value:[]},isLOD:{value:!0}}),e.autoUpdate=!0,e}return E(n,[{key:"copy",value:function(e){f(b(n.prototype),"copy",this).call(this,e,!1);for(var t=e.levels,r=0,i=t.length;r1&&void 0!==arguments[1]?arguments[1]:0;t=Math.abs(t);var n,r=this.levels;for(n=0;n0){var n,r;for(n=1,r=t.length;n0){yd.setFromMatrixPosition(this.matrixWorld);var n=e.ray.origin.distanceTo(yd);this.getObjectForDistance(n).raycast(e,t)}}},{key:"update",value:function(e){var t=this.levels;if(t.length>1){yd.setFromMatrixPosition(e.matrixWorld),xd.setFromMatrixPosition(this.matrixWorld);var n,r,i=yd.distanceTo(xd)/e.zoom;for(t[0].object.visible=!0,n=1,r=t.length;n=t[n].distance;n++)t[n-1].object.visible=!1,t[n].object.visible=!0;for(this._currentLevel=n-1;n0&&void 0!==arguments[0]?arguments[0]:null,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1,o=arguments.length>3?arguments[3]:void 0,s=arguments.length>4?arguments[4]:void 0,l=arguments.length>5?arguments[5]:void 0,u=arguments.length>6?arguments[6]:void 0,c=arguments.length>7?arguments[7]:void 0,h=arguments.length>8&&void 0!==arguments[8]?arguments[8]:Ge,d=arguments.length>9&&void 0!==arguments[9]?arguments[9]:Ge,p=arguments.length>10?arguments[10]:void 0,f=arguments.length>11?arguments[11]:void 0;return A(this,n),(e=t.call(this,null,l,u,c,h,d,o,s,p,f)).isDataTexture=!0,e.image={data:r,width:i,height:a},e.generateMipmaps=!1,e.flipY=!1,e.unpackAlignment=1,e}return E(n)}(),Cd=new Ai,Ld=new Ai,Rd=exports.Skeleton=function(){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];A(this,e),this.uuid=Zn(),this.bones=t.slice(0),this.boneInverses=n,this.boneMatrices=null,this.boneTexture=null,this.boneTextureSize=0,this.frame=-1,this.init()}return E(e,[{key:"init",value:function(){var e=this.bones,t=this.boneInverses;if(this.boneMatrices=new Float32Array(16*e.length),0===t.length)this.calculateInverses();else if(e.length!==t.length){console.warn("THREE.Skeleton: Number of inverse bone matrices does not match amount of bones."),this.boneInverses=[];for(var n=0,r=this.bones.length;n3&&void 0!==arguments[3]?arguments[3]:1;return A(this,n),"number"==typeof i&&(o=i,i=!1,console.error("THREE.InstancedBufferAttribute: The constructor now expects normalized as the third argument.")),(a=t.call(this,e,r,i)).isInstancedBufferAttribute=!0,a.meshPerAttribute=o,a}return E(n,[{key:"copy",value:function(e){return f(b(n.prototype),"copy",this).call(this,e),this.meshPerAttribute=e.meshPerAttribute,this}},{key:"toJSON",value:function(){var e=f(b(n.prototype),"toJSON",this).call(this);return e.meshPerAttribute=this.meshPerAttribute,e.isInstancedBufferAttribute=!0,e}}]),n}(),Id=new Ai,Dd=new Ai,Nd=[],Od=new Ja,Fd=exports.InstancedMesh=function(e){m(n,Ja);var t=y(n);function n(e,r,i){var a;return A(this,n),(a=t.call(this,e,r)).isInstancedMesh=!0,a.instanceMatrix=new Pd(new Float32Array(16*i),16),a.instanceColor=null,a.count=i,a.frustumCulled=!1,a}return E(n,[{key:"copy",value:function(e,t){return f(b(n.prototype),"copy",this).call(this,e,t),this.instanceMatrix.copy(e.instanceMatrix),null!==e.instanceColor&&(this.instanceColor=e.instanceColor.clone()),this.count=e.count,this}},{key:"getColorAt",value:function(e,t){t.fromArray(this.instanceColor.array,3*e)}},{key:"getMatrixAt",value:function(e,t){t.fromArray(this.instanceMatrix.array,16*e)}},{key:"raycast",value:function(e,t){var n=this.matrixWorld,r=this.count;if(Od.geometry=this.geometry,Od.material=this.material,void 0!==Od.material)for(var i=0;i0&&void 0!==arguments[0]?arguments[0]:new Pa,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new zd;return A(this,n),(e=t.call(this)).isLine=!0,e.type="Line",e.geometry=r,e.material=i,e.updateMorphTargets(),e}return E(n,[{key:"copy",value:function(e,t){return f(b(n.prototype),"copy",this).call(this,e,t),this.material=e.material,this.geometry=e.geometry,this}},{key:"computeLineDistances",value:function(){var e=this.geometry;if(null===e.index){for(var t=e.attributes.position,n=[0],r=1,i=t.count;rs)){h.applyMatrix4(this.matrixWorld);var x=e.ray.origin.distanceTo(h);xe.far||t.push({distance:x,point:c.clone().applyMatrix4(this.matrixWorld),index:v,face:null,faceIndex:null,object:this})}}else for(var _=Math.max(0,a.start),M=Math.min(f.count,a.start+a.count)-1;_s)){h.applyMatrix4(this.matrixWorld);var b=e.ray.origin.distanceTo(h);be.far||t.push({distance:b,point:c.clone().applyMatrix4(this.matrixWorld),index:_,face:null,faceIndex:null,object:this})}}}}},{key:"updateMorphTargets",value:function(){var e=this.geometry.morphAttributes,t=Object.keys(e);if(t.length>0){var n=e[t[0]];if(void 0!==n){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(var r=0,i=n.length;r0&&void 0!==arguments[0]?arguments[0]:new Pa,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new Zd;return A(this,n),(e=t.call(this)).isPoints=!0,e.type="Points",e.geometry=r,e.material=i,e.updateMorphTargets(),e}return E(n,[{key:"copy",value:function(e,t){return f(b(n.prototype),"copy",this).call(this,e,t),this.material=e.material,this.geometry=e.geometry,this}},{key:"raycast",value:function(e,t){var n=this.geometry,r=this.matrixWorld,i=e.params.Points.threshold,a=n.drawRange;if(null===n.boundingSphere&&n.computeBoundingSphere(),Qd.copy(n.boundingSphere),Qd.applyMatrix4(r),Qd.radius+=i,!1!==e.ray.intersectsSphere(Qd)){Jd.copy(r).invert(),Kd.copy(e.ray).applyMatrix4(Jd);var o=i/((this.scale.x+this.scale.y+this.scale.z)/3),s=o*o,l=n.index,u=n.attributes.position;if(null!==l)for(var c=Math.max(0,a.start),h=Math.min(l.count,a.start+a.count);c0){var n=e[t[0]];if(void 0!==n){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(var r=0,i=n.length;ri.far)return;a.push({distance:u,distanceToRay:Math.sqrt(s),point:l,index:t,face:null,object:o})}}var np=exports.VideoTexture=function(e){m(n,Ur);var t=y(n);function n(e,r,i,a,o,s,l,u,c){var h;A(this,n),(h=t.call(this,e,r,i,a,o,s,l,u,c)).isVideoTexture=!0,h.minFilter=void 0!==s?s:qe,h.magFilter=void 0!==o?o:qe,h.generateMipmaps=!1;var d=_(h);return"requestVideoFrameCallback"in e&&e.requestVideoFrameCallback(function t(){d.needsUpdate=!0,e.requestVideoFrameCallback(t)}),h}return E(n,[{key:"clone",value:function(){return new this.constructor(this.image).copy(this)}},{key:"update",value:function(){var e=this.image;!1==="requestVideoFrameCallback"in e&&e.readyState>=e.HAVE_CURRENT_DATA&&(this.needsUpdate=!0)}}]),n}(),rp=exports.FramebufferTexture=function(e){m(n,Ur);var t=y(n);function n(e,r,i){var a;return A(this,n),(a=t.call(this,{width:e,height:r})).isFramebufferTexture=!0,a.format=i,a.magFilter=Ge,a.minFilter=Ge,a.generateMipmaps=!1,a.needsUpdate=!0,a}return E(n)}(),ip=exports.CompressedTexture=function(e){m(n,Ur);var t=y(n);function n(e,r,i,a,o,s,l,u,c,h,d,p){var f;return A(this,n),(f=t.call(this,null,s,l,u,c,h,a,o,d,p)).isCompressedTexture=!0,f.image={width:r,height:i},f.mipmaps=e,f.flipY=!1,f.generateMipmaps=!1,f}return E(n)}(),ap=exports.CanvasTexture=function(e){m(n,Ur);var t=y(n);function n(e,r,i,a,o,s,l,u,c){var h;return A(this,n),(h=t.call(this,e,r,i,a,o,s,l,u,c)).isCanvasTexture=!0,h.needsUpdate=!0,h}return E(n)}(),op=exports.Curve=function(){function e(){A(this,e),this.type="Curve",this.arcLengthDivisions=200}return E(e,[{key:"getPoint",value:function(){return console.warn("THREE.Curve: .getPoint() not implemented."),null}},{key:"getPointAt",value:function(e,t){var n=this.getUtoTmapping(e);return this.getPoint(n,t)}},{key:"getPoints",value:function(){for(var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:5,t=[],n=0;n<=e;n++)t.push(this.getPoint(n/e));return t}},{key:"getSpacedPoints",value:function(){for(var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:5,t=[],n=0;n<=e;n++)t.push(this.getPointAt(n/e));return t}},{key:"getLength",value:function(){var e=this.getLengths();return e[e.length-1]}},{key:"getLengths",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.arcLengthDivisions;if(this.cacheArcLengths&&this.cacheArcLengths.length===e+1&&!this.needsUpdate)return this.cacheArcLengths;this.needsUpdate=!1;var t,n=[],r=this.getPoint(0),i=0;n.push(0);for(var a=1;a<=e;a++)i+=(t=this.getPoint(a/e)).distanceTo(r),n.push(i),r=t;return this.cacheArcLengths=n,n}},{key:"updateArcLengths",value:function(){this.needsUpdate=!0,this.getLengths()}},{key:"getUtoTmapping",value:function(e,t){var n,r=this.getLengths(),i=0,a=r.length;n=t||e*r[a-1];for(var o,s=0,l=a-1;s<=l;)if((o=r[i=Math.floor(s+(l-s)/2)]-n)<0)s=i+1;else{if(!(o>0)){l=i;break}l=i-1}if(r[i=l]===n)return i/(a-1);var u=r[i];return(i+(n-u)/(r[i+1]-u))/(a-1)}},{key:"getTangent",value:function(e,t){var n=e-1e-4,r=e+1e-4;n<0&&(n=0),r>1&&(r=1);var i=this.getPoint(n),a=this.getPoint(r),o=t||(i.isVector2?new yr:new Zr);return o.copy(a).sub(i).normalize(),o}},{key:"getTangentAt",value:function(e,t){var n=this.getUtoTmapping(e);return this.getTangent(n,t)}},{key:"computeFrenetFrames",value:function(e,t){for(var n=new Zr,r=[],i=[],a=[],o=new Zr,s=new Ai,l=0;l<=e;l++){var u=l/e;r[l]=this.getTangentAt(u,new Zr)}i[0]=new Zr,a[0]=new Zr;var c=Number.MAX_VALUE,h=Math.abs(r[0].x),d=Math.abs(r[0].y),p=Math.abs(r[0].z);h<=c&&(c=h,n.set(1,0,0)),d<=c&&(c=d,n.set(0,1,0)),p<=c&&n.set(0,0,1),o.crossVectors(r[0],n).normalize(),i[0].crossVectors(r[0],o),a[0].crossVectors(r[0],i[0]);for(var f=1;f<=e;f++){if(i[f]=i[f-1].clone(),a[f]=a[f-1].clone(),o.crossVectors(r[f-1],r[f]),o.length()>Number.EPSILON){o.normalize();var v=Math.acos(Jn(r[f-1].dot(r[f]),-1,1));i[f].applyMatrix4(s.makeRotationAxis(o,v))}a[f].crossVectors(r[f],i[f])}if(!0===t){var m=Math.acos(Jn(i[0].dot(i[e]),-1,1));m/=e,r[0].dot(o.crossVectors(i[0],i[e]))>0&&(m=-m);for(var g=1;g<=e;g++)i[g].applyMatrix4(s.makeRotationAxis(r[g],m*g)),a[g].crossVectors(r[g],i[g])}return{tangents:r,normals:i,binormals:a}}},{key:"clone",value:function(){return(new this.constructor).copy(this)}},{key:"copy",value:function(e){return this.arcLengthDivisions=e.arcLengthDivisions,this}},{key:"toJSON",value:function(){var e={metadata:{version:4.5,type:"Curve",generator:"Curve.toJSON"}};return e.arcLengthDivisions=this.arcLengthDivisions,e.type=this.type,e}},{key:"fromJSON",value:function(e){return this.arcLengthDivisions=e.arcLengthDivisions,this}}]),e}(),sp=exports.EllipseCurve=function(e){m(n,op);var t=y(n);function n(){var e,r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1,o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:1,s=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0,l=arguments.length>5&&void 0!==arguments[5]?arguments[5]:2*Math.PI,u=arguments.length>6&&void 0!==arguments[6]&&arguments[6],c=arguments.length>7&&void 0!==arguments[7]?arguments[7]:0;return A(this,n),(e=t.call(this)).isEllipseCurve=!0,e.type="EllipseCurve",e.aX=r,e.aY=i,e.xRadius=a,e.yRadius=o,e.aStartAngle=s,e.aEndAngle=l,e.aClockwise=u,e.aRotation=c,e}return E(n,[{key:"getPoint",value:function(e,t){for(var n=t||new yr,r=2*Math.PI,i=this.aEndAngle-this.aStartAngle,a=Math.abs(i)r;)i-=r;i0&&void 0!==arguments[0]?arguments[0]:[],i=arguments.length>1&&void 0!==arguments[1]&&arguments[1],a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"centripetal",o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:.5;return A(this,n),(e=t.call(this)).isCatmullRomCurve3=!0,e.type="CatmullRomCurve3",e.points=r,e.closed=i,e.curveType=a,e.tension=o,e}return E(n,[{key:"getPoint",value:function(e){var t,n,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new Zr,i=this.points,a=i.length,o=(a-(this.closed?0:1))*e,s=Math.floor(o),l=o-s;this.closed?s+=s>0?0:(Math.floor(Math.abs(s)/a)+1)*a:0===l&&s===a-1&&(s=a-2,l=1),this.closed||s>0?t=i[(s-1)%a]:(cp.subVectors(i[0],i[1]).add(i[0]),t=cp);var u=i[s%a],c=i[(s+1)%a];if(this.closed||s+20&&void 0!==arguments[0]?arguments[0]:new yr,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new yr,a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:new yr,o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:new yr;return A(this,n),(e=t.call(this)).isCubicBezierCurve=!0,e.type="CubicBezierCurve",e.v0=r,e.v1=i,e.v2=a,e.v3=o,e}return E(n,[{key:"getPoint",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new yr,n=this.v0,r=this.v1,i=this.v2,a=this.v3;return t.set(wp(e,n.x,r.x,i.x,a.x),wp(e,n.y,r.y,i.y,a.y)),t}},{key:"copy",value:function(e){return f(b(n.prototype),"copy",this).call(this,e),this.v0.copy(e.v0),this.v1.copy(e.v1),this.v2.copy(e.v2),this.v3.copy(e.v3),this}},{key:"toJSON",value:function(){var e=f(b(n.prototype),"toJSON",this).call(this);return e.v0=this.v0.toArray(),e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e.v3=this.v3.toArray(),e}},{key:"fromJSON",value:function(e){return f(b(n.prototype),"fromJSON",this).call(this,e),this.v0.fromArray(e.v0),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this.v3.fromArray(e.v3),this}}]),n}(),Ap=exports.CubicBezierCurve3=function(e){m(n,op);var t=y(n);function n(){var e,r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:new Zr,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new Zr,a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:new Zr,o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:new Zr;return A(this,n),(e=t.call(this)).isCubicBezierCurve3=!0,e.type="CubicBezierCurve3",e.v0=r,e.v1=i,e.v2=a,e.v3=o,e}return E(n,[{key:"getPoint",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new Zr,n=this.v0,r=this.v1,i=this.v2,a=this.v3;return t.set(wp(e,n.x,r.x,i.x,a.x),wp(e,n.y,r.y,i.y,a.y),wp(e,n.z,r.z,i.z,a.z)),t}},{key:"copy",value:function(e){return f(b(n.prototype),"copy",this).call(this,e),this.v0.copy(e.v0),this.v1.copy(e.v1),this.v2.copy(e.v2),this.v3.copy(e.v3),this}},{key:"toJSON",value:function(){var e=f(b(n.prototype),"toJSON",this).call(this);return e.v0=this.v0.toArray(),e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e.v3=this.v3.toArray(),e}},{key:"fromJSON",value:function(e){return f(b(n.prototype),"fromJSON",this).call(this,e),this.v0.fromArray(e.v0),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this.v3.fromArray(e.v3),this}}]),n}(),kp=exports.LineCurve=function(e){m(n,op);var t=y(n);function n(){var e,r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:new yr,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new yr;return A(this,n),(e=t.call(this)).isLineCurve=!0,e.type="LineCurve",e.v1=r,e.v2=i,e}return E(n,[{key:"getPoint",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new yr;return 1===e?t.copy(this.v2):(t.copy(this.v2).sub(this.v1),t.multiplyScalar(e).add(this.v1)),t}},{key:"getPointAt",value:function(e,t){return this.getPoint(e,t)}},{key:"getTangent",value:function(e,t){var n=t||new yr;return n.copy(this.v2).sub(this.v1).normalize(),n}},{key:"copy",value:function(e){return f(b(n.prototype),"copy",this).call(this,e),this.v1.copy(e.v1),this.v2.copy(e.v2),this}},{key:"toJSON",value:function(){var e=f(b(n.prototype),"toJSON",this).call(this);return e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e}},{key:"fromJSON",value:function(e){return f(b(n.prototype),"fromJSON",this).call(this,e),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this}}]),n}(),Ep=exports.LineCurve3=function(e){m(n,op);var t=y(n);function n(){var e,r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:new Zr,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new Zr;return A(this,n),(e=t.call(this)).isLineCurve3=!0,e.type="LineCurve3",e.v1=r,e.v2=i,e}return E(n,[{key:"getPoint",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new Zr;return 1===e?t.copy(this.v2):(t.copy(this.v2).sub(this.v1),t.multiplyScalar(e).add(this.v1)),t}},{key:"getPointAt",value:function(e,t){return this.getPoint(e,t)}},{key:"copy",value:function(e){return f(b(n.prototype),"copy",this).call(this,e),this.v1.copy(e.v1),this.v2.copy(e.v2),this}},{key:"toJSON",value:function(){var e=f(b(n.prototype),"toJSON",this).call(this);return e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e}},{key:"fromJSON",value:function(e){return f(b(n.prototype),"fromJSON",this).call(this,e),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this}}]),n}(),Cp=exports.QuadraticBezierCurve=function(e){m(n,op);var t=y(n);function n(){var e,r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:new yr,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new yr,a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:new yr;return A(this,n),(e=t.call(this)).isQuadraticBezierCurve=!0,e.type="QuadraticBezierCurve",e.v0=r,e.v1=i,e.v2=a,e}return E(n,[{key:"getPoint",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new yr,n=this.v0,r=this.v1,i=this.v2;return t.set(xp(e,n.x,r.x,i.x),xp(e,n.y,r.y,i.y)),t}},{key:"copy",value:function(e){return f(b(n.prototype),"copy",this).call(this,e),this.v0.copy(e.v0),this.v1.copy(e.v1),this.v2.copy(e.v2),this}},{key:"toJSON",value:function(){var e=f(b(n.prototype),"toJSON",this).call(this);return e.v0=this.v0.toArray(),e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e}},{key:"fromJSON",value:function(e){return f(b(n.prototype),"fromJSON",this).call(this,e),this.v0.fromArray(e.v0),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this}}]),n}(),Lp=exports.QuadraticBezierCurve3=function(e){m(n,op);var t=y(n);function n(){var e,r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:new Zr,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new Zr,a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:new Zr;return A(this,n),(e=t.call(this)).isQuadraticBezierCurve3=!0,e.type="QuadraticBezierCurve3",e.v0=r,e.v1=i,e.v2=a,e}return E(n,[{key:"getPoint",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new Zr,n=this.v0,r=this.v1,i=this.v2;return t.set(xp(e,n.x,r.x,i.x),xp(e,n.y,r.y,i.y),xp(e,n.z,r.z,i.z)),t}},{key:"copy",value:function(e){return f(b(n.prototype),"copy",this).call(this,e),this.v0.copy(e.v0),this.v1.copy(e.v1),this.v2.copy(e.v2),this}},{key:"toJSON",value:function(){var e=f(b(n.prototype),"toJSON",this).call(this);return e.v0=this.v0.toArray(),e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e}},{key:"fromJSON",value:function(e){return f(b(n.prototype),"fromJSON",this).call(this,e),this.v0.fromArray(e.v0),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this}}]),n}(),Rp=exports.SplineCurve=function(e){m(n,op);var t=y(n);function n(){var e,r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];return A(this,n),(e=t.call(this)).isSplineCurve=!0,e.type="SplineCurve",e.points=r,e}return E(n,[{key:"getPoint",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new yr,n=this.points,r=(n.length-1)*e,i=Math.floor(r),a=r-i,o=n[0===i?i:i-1],s=n[i],l=n[i>n.length-2?n.length-1:i+1],u=n[i>n.length-3?n.length-1:i+2];return t.set(vp(a,o.x,s.x,l.x,u.x),vp(a,o.y,s.y,l.y,u.y)),t}},{key:"copy",value:function(e){f(b(n.prototype),"copy",this).call(this,e),this.points=[];for(var t=0,r=e.points.length;t=n){var a=r[i]-n,o=this.curves[i],s=o.getLength(),l=0===s?0:1-a/s;return o.getPointAt(l,t)}i++}return null}},{key:"getLength",value:function(){var e=this.getCurveLengths();return e[e.length-1]}},{key:"updateArcLengths",value:function(){this.needsUpdate=!0,this.cacheLengths=null,this.getCurveLengths()}},{key:"getCurveLengths",value:function(){if(this.cacheLengths&&this.cacheLengths.length===this.curves.length)return this.cacheLengths;for(var e=[],t=0,n=0,r=this.curves.length;n0&&void 0!==arguments[0]?arguments[0]:40,t=[],n=0;n<=e;n++)t.push(this.getPoint(n/e));return this.autoClose&&t.push(t[0]),t}},{key:"getPoints",value:function(){for(var e,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:12,n=[],r=0,i=this.curves;r1&&!n[n.length-1].equals(n[0])&&n.push(n[0]),n}},{key:"copy",value:function(e){f(b(n.prototype),"copy",this).call(this,e),this.curves=[];for(var t=0,r=e.curves.length;t0){var u=l.getPoint(0);u.equals(this.currentPoint)||this.lineTo(u.x,u.y)}this.curves.push(l);var c=l.getPoint(1);return this.currentPoint.copy(c),this}},{key:"copy",value:function(e){return f(b(n.prototype),"copy",this).call(this,e),this.currentPoint.copy(e.currentPoint),this}},{key:"toJSON",value:function(){var e=f(b(n.prototype),"toJSON",this).call(this);return e.currentPoint=this.currentPoint.toArray(),e}},{key:"fromJSON",value:function(e){return f(b(n.prototype),"fromJSON",this).call(this,e),this.currentPoint.fromArray(e.currentPoint),this}}]),n}(),Np=exports.LatheGeometry=exports.LatheBufferGeometry=function(e){m(n,Pa);var t=y(n);function n(){var e,r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[new yr(0,.5),new yr(.5,0),new yr(0,-.5)],i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:12,a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:2*Math.PI;A(this,n),(e=t.call(this)).type="LatheGeometry",e.parameters={points:r,segments:i,phiStart:a,phiLength:o},i=Math.floor(i),o=Jn(o,0,2*Math.PI);for(var s=[],l=[],u=[],c=[],h=[],d=1/i,p=new Zr,f=new yr,v=new Zr,m=new Zr,g=new Zr,y=0,x=0,_=0;_<=r.length-1;_++)switch(_){case 0:y=r[_+1].x-r[_].x,x=r[_+1].y-r[_].y,v.x=1*x,v.y=-y,v.z=0*x,g.copy(v),v.normalize(),c.push(v.x,v.y,v.z);break;case r.length-1:c.push(g.x,g.y,g.z);break;default:y=r[_+1].x-r[_].x,x=r[_+1].y-r[_].y,v.x=1*x,v.y=-y,v.z=0*x,m.copy(v),v.x+=g.x,v.y+=g.y,v.z+=g.z,v.normalize(),c.push(v.x,v.y,v.z),g.copy(m)}for(var M=0;M<=i;M++)for(var b=a+M*d*o,S=Math.sin(b),w=Math.cos(b),T=0;T<=r.length-1;T++){p.x=r[T].x*S,p.y=r[T].y,p.z=r[T].x*w,l.push(p.x,p.y,p.z),f.x=M/i,f.y=T/(r.length-1),u.push(f.x,f.y);var k=c[3*T+0]*S,E=c[3*T+1],C=c[3*T+0]*w;h.push(k,E,C)}for(var L=0;L0&&void 0!==arguments[0]?arguments[0]:1,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:4,o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:8;A(this,n);var s=new Dp;return s.absarc(0,-i/2,r,1.5*Math.PI,0),s.absarc(0,i/2,r,0,.5*Math.PI),(e=t.call(this,s.getPoints(a),o)).type="CapsuleGeometry",e.parameters={radius:r,height:i,capSegments:a,radialSegments:o},e}return E(n,null,[{key:"fromJSON",value:function(e){return new n(e.radius,e.length,e.capSegments,e.radialSegments)}}]),n}(),Fp=exports.CircleGeometry=exports.CircleBufferGeometry=function(e){m(n,Pa);var t=y(n);function n(){var e,r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:8,a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:2*Math.PI;A(this,n),(e=t.call(this)).type="CircleGeometry",e.parameters={radius:r,segments:i,thetaStart:a,thetaLength:o},i=Math.max(3,i);var s=[],l=[],u=[],c=[],h=new Zr,d=new yr;l.push(0,0,0),u.push(0,0,1),c.push(.5,.5);for(var p=0,f=3;p<=i;p++,f+=3){var v=a+p/i*o;h.x=r*Math.cos(v),h.y=r*Math.sin(v),l.push(h.x,h.y,h.z),u.push(0,0,1),d.x=(l[f]/r+1)/2,d.y=(l[f+1]/r+1)/2,c.push(d.x,d.y)}for(var m=1;m<=i;m++)s.push(m,m+1,0);return e.setIndex(s),e.setAttribute("position",new Sa(l,3)),e.setAttribute("normal",new Sa(u,3)),e.setAttribute("uv",new Sa(c,2)),e}return E(n,null,[{key:"fromJSON",value:function(e){return new n(e.radius,e.segments,e.thetaStart,e.thetaLength)}}]),n}(),zp=exports.CylinderGeometry=exports.CylinderBufferGeometry=function(e){m(n,Pa);var t=y(n);function n(){var e,r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1,o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:8,s=arguments.length>4&&void 0!==arguments[4]?arguments[4]:1,l=arguments.length>5&&void 0!==arguments[5]&&arguments[5],u=arguments.length>6&&void 0!==arguments[6]?arguments[6]:0,c=arguments.length>7&&void 0!==arguments[7]?arguments[7]:2*Math.PI;A(this,n),(e=t.call(this)).type="CylinderGeometry",e.parameters={radiusTop:r,radiusBottom:i,height:a,radialSegments:o,heightSegments:s,openEnded:l,thetaStart:u,thetaLength:c};var h=_(e);o=Math.floor(o),s=Math.floor(s);var d=[],p=[],f=[],v=[],m=0,g=[],y=a/2,x=0;function M(e){for(var t=m,n=new yr,a=new Zr,s=0,l=!0===e?r:i,g=!0===e?1:-1,_=1;_<=o;_++)p.push(0,y*g,0),f.push(0,g,0),v.push(.5,.5),m++;for(var M=m,b=0;b<=o;b++){var S=b/o*c+u,w=Math.cos(S),T=Math.sin(S);a.x=l*T,a.y=y*g,a.z=l*w,p.push(a.x,a.y,a.z),f.push(0,g,0),n.x=.5*w+.5,n.y=.5*T*g+.5,v.push(n.x,n.y),m++}for(var A=0;A0&&M(!0),i>0&&M(!1)),e.setIndex(d),e.setAttribute("position",new Sa(p,3)),e.setAttribute("normal",new Sa(f,3)),e.setAttribute("uv",new Sa(v,2)),e}return E(n,null,[{key:"fromJSON",value:function(e){return new n(e.radiusTop,e.radiusBottom,e.height,e.radialSegments,e.heightSegments,e.openEnded,e.thetaStart,e.thetaLength)}}]),n}(),Bp=exports.ConeGeometry=exports.ConeBufferGeometry=function(e){m(n,zp);var t=y(n);function n(){var e,r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:8,o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:1,s=arguments.length>4&&void 0!==arguments[4]&&arguments[4],l=arguments.length>5&&void 0!==arguments[5]?arguments[5]:0,u=arguments.length>6&&void 0!==arguments[6]?arguments[6]:2*Math.PI;return A(this,n),(e=t.call(this,0,r,i,a,o,s,l,u)).type="ConeGeometry",e.parameters={radius:r,height:i,radialSegments:a,heightSegments:o,openEnded:s,thetaStart:l,thetaLength:u},e}return E(n,null,[{key:"fromJSON",value:function(e){return new n(e.radius,e.height,e.radialSegments,e.heightSegments,e.openEnded,e.thetaStart,e.thetaLength)}}]),n}(),Up=exports.PolyhedronGeometry=exports.PolyhedronBufferGeometry=function(e){m(n,Pa);var t=y(n);function n(){var e,r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1,o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0;A(this,n),(e=t.call(this)).type="PolyhedronGeometry",e.parameters={vertices:r,indices:i,radius:a,detail:o};var s=[],l=[];function u(e,t,n,r){for(var i=r+1,a=[],o=0;o<=i;o++){a[o]=[];for(var s=e.clone().lerp(n,o/i),l=t.clone().lerp(n,o/i),u=i-o,h=0;h<=u;h++)a[o][h]=0===h&&o===i?s:s.clone().lerp(l,h/u)}for(var d=0;d.9&&a<.1&&(t<.2&&(l[e+0]+=1),n<.2&&(l[e+2]+=1),r<.2&&(l[e+4]+=1))}}()}(),e.setAttribute("position",new Sa(s,3)),e.setAttribute("normal",new Sa(s.slice(),3)),e.setAttribute("uv",new Sa(l,2)),0===o?e.computeVertexNormals():e.normalizeNormals(),e}return E(n,null,[{key:"fromJSON",value:function(e){return new n(e.vertices,e.indices,e.radius,e.details)}}]),n}(),Gp=exports.DodecahedronGeometry=exports.DodecahedronBufferGeometry=function(e){m(n,Up);var t=y(n);function n(){var e,r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;A(this,n);var a=(1+Math.sqrt(5))/2,o=1/a,s=[-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,-o,-a,0,-o,a,0,o,-a,0,o,a,-o,-a,0,-o,a,0,o,-a,0,o,a,0,-a,0,-o,a,0,-o,-a,0,o,a,0,o];return(e=t.call(this,s,[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],r,i)).type="DodecahedronGeometry",e.parameters={radius:r,detail:i},e}return E(n,null,[{key:"fromJSON",value:function(e){return new n(e.radius,e.detail)}}]),n}(),Vp=new Zr,Hp=new Zr,Wp=new Zr,jp=new la,qp=exports.EdgesGeometry=function(e){m(n,Pa);var t=y(n);function n(){var e,r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;if(A(this,n),(e=t.call(this)).type="EdgesGeometry",e.parameters={geometry:r,thresholdAngle:i},null!==r){for(var a=Math.pow(10,4),o=Math.cos(Xn*i),s=r.getIndex(),l=r.getAttribute("position"),u=s?s.count:l.count,c=[0,0,0],h=["a","b","c"],d=new Array(3),p={},f=[],v=0;v2&&void 0!==arguments[2]?arguments[2]:2,c=t&&t.length,h=c?t[0]*u:e.length,d=Zp(e,0,h,u,!0),p=[];if(!d||d.next===d.prev)return p;if(c&&(d=nf(e,t,d,u)),e.length>80*u){n=i=e[0],r=a=e[1];for(var f=u;fi&&(i=o),s>a&&(a=s);l=0!==(l=Math.max(i-n,a-r))?1/l:0}return Kp(d,p,u,n,r,l),p}};function Zp(e,t,n,r,i){var a,o;if(i===Af(e,t,n,r)>0)for(a=t;a=t;a-=r)o=Sf(a,e[a],e[a+1],o);return o&&vf(o,o.next)&&(wf(o),o=o.next),o}function Jp(e,t){if(!e)return e;t||(t=e);var n,r=e;do{if(n=!1,r.steiner||!vf(r,r.next)&&0!==ff(r.prev,r,r.next))r=r.next;else{if(wf(r),(r=t=r.prev)===r.next)break;n=!0}}while(n||r!==t);return t}function Kp(e,t,n,r,i,a,o){if(e){!o&&a&&lf(e,r,i,a);for(var s,l,u=e;e.prev!==e.next;)if(s=e.prev,l=e.next,a?$p(e,r,i,a):Qp(e))t.push(s.i/n),t.push(e.i/n),t.push(l.i/n),wf(e),e=l.next,u=l.next;else if((e=l)===u){o?1===o?Kp(e=ef(Jp(e),t,n),t,n,r,i,a,2):2===o&&tf(e,t,n,r,i,a):Kp(Jp(e),t,n,r,i,a,1);break}}}function Qp(e){var t=e.prev,n=e,r=e.next;if(ff(t,n,r)>=0)return!1;for(var i=e.next.next;i!==e.prev;){if(df(t.x,t.y,n.x,n.y,r.x,r.y,i.x,i.y)&&ff(i.prev,i,i.next)>=0)return!1;i=i.next}return!0}function $p(e,t,n,r){var i=e.prev,a=e,o=e.next;if(ff(i,a,o)>=0)return!1;for(var s=i.xa.x?i.x>o.x?i.x:o.x:a.x>o.x?a.x:o.x,c=i.y>a.y?i.y>o.y?i.y:o.y:a.y>o.y?a.y:o.y,h=cf(s,l,t,n,r),d=cf(u,c,t,n,r),p=e.prevZ,f=e.nextZ;p&&p.z>=h&&f&&f.z<=d;){if(p!==e.prev&&p!==e.next&&df(i.x,i.y,a.x,a.y,o.x,o.y,p.x,p.y)&&ff(p.prev,p,p.next)>=0)return!1;if(p=p.prevZ,f!==e.prev&&f!==e.next&&df(i.x,i.y,a.x,a.y,o.x,o.y,f.x,f.y)&&ff(f.prev,f,f.next)>=0)return!1;f=f.nextZ}for(;p&&p.z>=h;){if(p!==e.prev&&p!==e.next&&df(i.x,i.y,a.x,a.y,o.x,o.y,p.x,p.y)&&ff(p.prev,p,p.next)>=0)return!1;p=p.prevZ}for(;f&&f.z<=d;){if(f!==e.prev&&f!==e.next&&df(i.x,i.y,a.x,a.y,o.x,o.y,f.x,f.y)&&ff(f.prev,f,f.next)>=0)return!1;f=f.nextZ}return!0}function ef(e,t,n){var r=e;do{var i=r.prev,a=r.next.next;!vf(i,a)&&mf(i,r,r.next,a)&&_f(i,a)&&_f(a,i)&&(t.push(i.i/n),t.push(r.i/n),t.push(a.i/n),wf(r),wf(r.next),r=e=a),r=r.next}while(r!==e);return Jp(r)}function tf(e,t,n,r,i,a){var o=e;do{for(var s=o.next.next;s!==o.prev;){if(o.i!==s.i&&pf(o,s)){var l=bf(o,s);return o=Jp(o,o.next),l=Jp(l,l.next),Kp(o,t,n,r,i,a),void Kp(l,t,n,r,i,a)}s=s.next}o=o.next}while(o!==e)}function nf(e,t,n,r){var i,a,o,s=[];for(i=0,a=t.length;i=r.next.y&&r.next.y!==r.y){var s=r.x+(a-r.y)*(r.next.x-r.x)/(r.next.y-r.y);if(s<=i&&s>o){if(o=s,s===i){if(a===r.y)return r;if(a===r.next.y)return r.next}n=r.x=r.x&&r.x>=c&&i!==r.x&&df(an.x||r.x===n.x&&sf(n,r)))&&(n=r,d=l)),r=r.next}while(r!==u);return n}function sf(e,t){return ff(e.prev,e,t.prev)<0&&ff(t.next,e,e.next)<0}function lf(e,t,n,r){var i=e;do{null===i.z&&(i.z=cf(i.x,i.y,t,n,r)),i.prevZ=i.prev,i.nextZ=i.next,i=i.next}while(i!==e);i.prevZ.nextZ=null,i.prevZ=null,uf(i)}function uf(e){var t,n,r,i,a,o,s,l,u=1;do{for(n=e,e=null,a=null,o=0;n;){for(o++,r=n,s=0,t=0;t0||l>0&&r;)0!==s&&(0===l||!r||n.z<=r.z)?(i=n,n=n.nextZ,s--):(i=r,r=r.nextZ,l--),a?a.nextZ=i:e=i,i.prevZ=a,a=i;n=r}a.nextZ=null,u*=2}while(o>1);return e}function cf(e,t,n,r,i){return(e=1431655765&((e=858993459&((e=252645135&((e=16711935&((e=32767*(e-n)*i)|e<<8))|e<<4))|e<<2))|e<<1))|(t=1431655765&((t=858993459&((t=252645135&((t=16711935&((t=32767*(t-r)*i)|t<<8))|t<<4))|t<<2))|t<<1))<<1}function hf(e){var t=e,n=e;do{(t.x=0&&(e-o)*(r-s)-(n-o)*(t-s)>=0&&(n-o)*(a-s)-(i-o)*(r-s)>=0}function pf(e,t){return e.next.i!==t.i&&e.prev.i!==t.i&&!xf(e,t)&&(_f(e,t)&&_f(t,e)&&Mf(e,t)&&(ff(e.prev,e,t.prev)||ff(e,t.prev,t))||vf(e,t)&&ff(e.prev,e,e.next)>0&&ff(t.prev,t,t.next)>0)}function ff(e,t,n){return(t.y-e.y)*(n.x-t.x)-(t.x-e.x)*(n.y-t.y)}function vf(e,t){return e.x===t.x&&e.y===t.y}function mf(e,t,n,r){var i=yf(ff(e,t,n)),a=yf(ff(e,t,r)),o=yf(ff(n,r,e)),s=yf(ff(n,r,t));return i!==a&&o!==s||(!(0!==i||!gf(e,n,t))||(!(0!==a||!gf(e,r,t))||(!(0!==o||!gf(n,e,r))||!(0!==s||!gf(n,t,r)))))}function gf(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 yf(e){return e>0?1:e<0?-1:0}function xf(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&&mf(n,n.next,e,t))return!0;n=n.next}while(n!==e);return!1}function _f(e,t){return ff(e.prev,e,e.next)<0?ff(e,t,e.next)>=0&&ff(e,e.prev,t)>=0:ff(e,t,e.prev)<0||ff(e,e.next,t)<0}function Mf(e,t){var n=e,r=!1,i=(e.x+t.x)/2,a=(e.y+t.y)/2;do{n.y>a!=n.next.y>a&&n.next.y!==n.y&&i<(n.next.x-n.x)*(a-n.y)/(n.next.y-n.y)+n.x&&(r=!r),n=n.next}while(n!==e);return r}function bf(e,t){var n=new Tf(e.i,e.x,e.y),r=new Tf(t.i,t.x,t.y),i=e.next,a=t.prev;return e.next=t,t.prev=e,n.next=i,i.prev=n,r.next=n,n.prev=r,a.next=r,r.prev=a,r}function Sf(e,t,n,r){var i=new Tf(e,t,n);return r?(i.next=r.next,i.prev=r,r.next.prev=i,r.next=i):(i.prev=i,i.next=i),i}function wf(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 Tf(e,t,n){this.i=e,this.x=t,this.y=n,this.prev=null,this.next=null,this.z=null,this.prevZ=null,this.nextZ=null,this.steiner=!1}function Af(e,t,n,r){for(var i=0,a=t,o=n-r;a2&&e[t-1].equals(e[0])&&e.pop()}function Cf(e,t){for(var n=0;n0&&void 0!==arguments[0]?arguments[0]:new Xp([new yr(.5,.5),new yr(-.5,.5),new yr(-.5,-.5),new yr(.5,-.5)]),i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};A(this,n),(e=t.call(this)).type="ExtrudeGeometry",e.parameters={shapes:r,options:i},r=Array.isArray(r)?r:[r];for(var a=_(e),o=[],s=[],l=0,u=r.length;lNumber.EPSILON){var d=Math.sqrt(c),p=Math.sqrt(l*l+u*u),f=t.x-s/d,v=t.y+o/d,m=((n.x-u/p-f)*u-(n.y+l/p-v)*l)/(o*u-s*l),g=(r=f+o*m-e.x)*r+(i=v+s*m-e.y)*i;if(g<=2)return new yr(r,i);a=Math.sqrt(g/2)}else{var y=!1;o>Number.EPSILON?l>Number.EPSILON&&(y=!0):o<-Number.EPSILON?l<-Number.EPSILON&&(y=!0):Math.sign(s)===Math.sign(u)&&(y=!0),y?(r=-s,i=o,a=Math.sqrt(c)):(r=o,i=s,a=Math.sqrt(c/2))}return new yr(r/a,i/a)}for(var F=[],z=0,B=C.length,U=B-1,G=z+1;z=0;ge--){for(var ye=ge/p,xe=c*Math.cos(ye*Math.PI/2),_e=h*Math.sin(ye*Math.PI/2)+d,Me=0,be=C.length;Me=0;){var i=n,a=n-1;a<0&&(a=e.length-1);for(var o=0,s=r+2*p;o0&&void 0!==arguments[0]?arguments[0]:1,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;A(this,n);var a=(1+Math.sqrt(5))/2,o=[-1,a,0,1,a,0,-1,-a,0,1,-a,0,0,-1,a,0,1,a,0,-1,-a,0,1,-a,a,0,-1,a,0,1,-a,0,-1,-a,0,1];return(e=t.call(this,o,[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],r,i)).type="IcosahedronGeometry",e.parameters={radius:r,detail:i},e}return E(n,null,[{key:"fromJSON",value:function(e){return new n(e.radius,e.detail)}}]),n}(),Df=exports.OctahedronGeometry=exports.OctahedronBufferGeometry=function(e){m(n,Up);var t=y(n);function n(){var e,r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;A(this,n);return(e=t.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],r,i)).type="OctahedronGeometry",e.parameters={radius:r,detail:i},e}return E(n,null,[{key:"fromJSON",value:function(e){return new n(e.radius,e.detail)}}]),n}(),Nf=exports.RingGeometry=exports.RingBufferGeometry=function(e){m(n,Pa);var t=y(n);function n(){var e,r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:.5,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:8,o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:1,s=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0,l=arguments.length>5&&void 0!==arguments[5]?arguments[5]:2*Math.PI;A(this,n),(e=t.call(this)).type="RingGeometry",e.parameters={innerRadius:r,outerRadius:i,thetaSegments:a,phiSegments:o,thetaStart:s,thetaLength:l},a=Math.max(3,a);for(var u=[],c=[],h=[],d=[],p=r,f=(i-r)/(o=Math.max(1,o)),v=new Zr,m=new yr,g=0;g<=o;g++){for(var y=0;y<=a;y++){var x=s+y/a*l;v.x=p*Math.cos(x),v.y=p*Math.sin(x),c.push(v.x,v.y,v.z),h.push(0,0,1),m.x=(v.x/i+1)/2,m.y=(v.y/i+1)/2,d.push(m.x,m.y)}p+=f}for(var _=0;_0&&void 0!==arguments[0]?arguments[0]:new Xp([new yr(0,.5),new yr(-.5,-.5),new yr(.5,-.5)]),i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:12;A(this,n),(e=t.call(this)).type="ShapeGeometry",e.parameters={shapes:r,curveSegments:i};var a=[],o=[],s=[],l=[],u=0,c=0;if(!1===Array.isArray(r))d(r);else for(var h=0;h0&&void 0!==arguments[0]?arguments[0]:1,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:32,a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:16,o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0,s=arguments.length>4&&void 0!==arguments[4]?arguments[4]:2*Math.PI,l=arguments.length>5&&void 0!==arguments[5]?arguments[5]:0,u=arguments.length>6&&void 0!==arguments[6]?arguments[6]:Math.PI;A(this,n),(e=t.call(this)).type="SphereGeometry",e.parameters={radius:r,widthSegments:i,heightSegments:a,phiStart:o,phiLength:s,thetaStart:l,thetaLength:u},i=Math.max(3,Math.floor(i)),a=Math.max(2,Math.floor(a));for(var c=Math.min(l+u,Math.PI),h=0,d=[],p=new Zr,f=new Zr,v=[],m=[],g=[],y=[],x=0;x<=a;x++){var _=[],M=x/a,b=0;0==x&&0==l?b=.5/i:x==a&&c==Math.PI&&(b=-.5/i);for(var S=0;S<=i;S++){var w=S/i;p.x=-r*Math.cos(o+w*s)*Math.sin(l+M*u),p.y=r*Math.cos(l+M*u),p.z=r*Math.sin(o+w*s)*Math.sin(l+M*u),m.push(p.x,p.y,p.z),f.copy(p).normalize(),g.push(f.x,f.y,f.z),y.push(w+b,1-M),_.push(h++)}d.push(_)}for(var T=0;T0)&&v.push(E,C,R),(T!==a-1||c0&&void 0!==arguments[0]?arguments[0]:1,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;A(this,n);return(e=t.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],r,i)).type="TetrahedronGeometry",e.parameters={radius:r,detail:i},e}return E(n,null,[{key:"fromJSON",value:function(e){return new n(e.radius,e.detail)}}]),n}(),Uf=exports.TorusGeometry=exports.TorusBufferGeometry=function(e){m(n,Pa);var t=y(n);function n(){var e,r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:.4,a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:8,o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:6,s=arguments.length>4&&void 0!==arguments[4]?arguments[4]:2*Math.PI;A(this,n),(e=t.call(this)).type="TorusGeometry",e.parameters={radius:r,tube:i,radialSegments:a,tubularSegments:o,arc:s},a=Math.floor(a),o=Math.floor(o);for(var l=[],u=[],c=[],h=[],d=new Zr,p=new Zr,f=new Zr,v=0;v<=a;v++)for(var m=0;m<=o;m++){var g=m/o*s,y=v/a*Math.PI*2;p.x=(r+i*Math.cos(y))*Math.cos(g),p.y=(r+i*Math.cos(y))*Math.sin(g),p.z=i*Math.sin(y),u.push(p.x,p.y,p.z),d.x=r*Math.cos(g),d.y=r*Math.sin(g),f.subVectors(p,d).normalize(),c.push(f.x,f.y,f.z),h.push(m/o),h.push(v/a)}for(var x=1;x<=a;x++)for(var _=1;_<=o;_++){var M=(o+1)*x+_-1,b=(o+1)*(x-1)+_-1,S=(o+1)*(x-1)+_,w=(o+1)*x+_;l.push(M,b,w),l.push(b,S,w)}return e.setIndex(l),e.setAttribute("position",new Sa(u,3)),e.setAttribute("normal",new Sa(c,3)),e.setAttribute("uv",new Sa(h,2)),e}return E(n,null,[{key:"fromJSON",value:function(e){return new n(e.radius,e.tube,e.radialSegments,e.tubularSegments,e.arc)}}]),n}(),Gf=exports.TorusKnotGeometry=exports.TorusKnotBufferGeometry=function(e){m(n,Pa);var t=y(n);function n(){var e,r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:.4,a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:64,o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:8,s=arguments.length>4&&void 0!==arguments[4]?arguments[4]:2,l=arguments.length>5&&void 0!==arguments[5]?arguments[5]:3;A(this,n),(e=t.call(this)).type="TorusKnotGeometry",e.parameters={radius:r,tube:i,tubularSegments:a,radialSegments:o,p:s,q:l},a=Math.floor(a),o=Math.floor(o);for(var u=[],c=[],h=[],d=[],p=new Zr,f=new Zr,v=new Zr,m=new Zr,g=new Zr,y=new Zr,x=new Zr,_=0;_<=a;++_){var M=_/a*s*Math.PI*2;I(M,s,l,r,v),I(M+.01,s,l,r,m),y.subVectors(m,v),x.addVectors(m,v),g.crossVectors(y,x),x.crossVectors(g,y),g.normalize(),x.normalize();for(var b=0;b<=o;++b){var S=b/o*Math.PI*2,w=-i*Math.cos(S),T=i*Math.sin(S);p.x=v.x+(w*x.x+T*g.x),p.y=v.y+(w*x.y+T*g.y),p.z=v.z+(w*x.z+T*g.z),c.push(p.x,p.y,p.z),f.subVectors(p,v).normalize(),h.push(f.x,f.y,f.z),d.push(_/a),d.push(b/o)}}for(var k=1;k<=a;k++)for(var E=1;E<=o;E++){var C=(o+1)*(k-1)+(E-1),L=(o+1)*k+(E-1),R=(o+1)*k+E,P=(o+1)*(k-1)+E;u.push(C,L,P),u.push(L,R,P)}function I(e,t,n,r,i){var a=Math.cos(e),o=Math.sin(e),s=n/t*e,l=Math.cos(s);i.x=r*(2+l)*.5*a,i.y=r*(2+l)*o*.5,i.z=r*Math.sin(s)*.5}return e.setIndex(u),e.setAttribute("position",new Sa(c,3)),e.setAttribute("normal",new Sa(h,3)),e.setAttribute("uv",new Sa(d,2)),e}return E(n,null,[{key:"fromJSON",value:function(e){return new n(e.radius,e.tube,e.tubularSegments,e.radialSegments,e.p,e.q)}}]),n}(),Vf=exports.TubeGeometry=exports.TubeBufferGeometry=function(e){m(n,Pa);var t=y(n);function n(){var e,r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:new Lp(new Zr(-1,-1,0),new Zr(-1,1,0),new Zr(1,1,0)),i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:64,a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1,o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:8,s=arguments.length>4&&void 0!==arguments[4]&&arguments[4];A(this,n),(e=t.call(this)).type="TubeGeometry",e.parameters={path:r,tubularSegments:i,radius:a,radialSegments:o,closed:s};var l=r.computeFrenetFrames(i,s);e.tangents=l.tangents,e.normals=l.normals,e.binormals=l.binormals;var u=new Zr,c=new Zr,h=new yr,d=new Zr,p=[],f=[],v=[],m=[];function g(e){d=r.getPointAt(e/i,d);for(var t=l.normals[e],n=l.binormals[e],s=0;s<=o;s++){var h=s/o*Math.PI*2,v=Math.sin(h),m=-Math.cos(h);c.x=m*t.x+v*n.x,c.y=m*t.y+v*n.y,c.z=m*t.z+v*n.z,c.normalize(),f.push(c.x,c.y,c.z),u.x=d.x+a*c.x,u.y=d.y+a*c.y,u.z=d.z+a*c.z,p.push(u.x,u.y,u.z)}}return function(){for(var e=0;e0&&void 0!==arguments[0]?arguments[0]:null;if(A(this,n),(e=t.call(this)).type="WireframeGeometry",e.parameters={geometry:r},null!==r){var i=[],a=new Set,o=new Zr,s=new Zr;if(null!==r.index){var l=r.attributes.position,u=r.index,c=r.groups;0===c.length&&(c=[{start:0,count:u.count,materialIndex:0}]);for(var h=0,d=c.length;h0!=e>0&&this.version++,this._sheen=e}},{key:"clearcoat",get:function(){return this._clearcoat},set:function(e){this._clearcoat>0!=e>0&&this.version++,this._clearcoat=e}},{key:"iridescence",get:function(){return this._iridescence},set:function(e){this._iridescence>0!=e>0&&this.version++,this._iridescence=e}},{key:"transmission",get:function(){return this._transmission},set:function(e){this._transmission>0!=e>0&&this.version++,this._transmission=e}},{key:"copy",value:function(e){return f(b(r.prototype),"copy",this).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.ior=e.ior,this.iridescence=e.iridescence,this.iridescenceMap=e.iridescenceMap,this.iridescenceIOR=e.iridescenceIOR,this.iridescenceThicknessRange=t(e.iridescenceThicknessRange),this.iridescenceThicknessMap=e.iridescenceThicknessMap,this.sheen=e.sheen,this.sheenColor.copy(e.sheenColor),this.sheenColorMap=e.sheenColorMap,this.sheenRoughness=e.sheenRoughness,this.sheenRoughnessMap=e.sheenRoughnessMap,this.transmission=e.transmission,this.transmissionMap=e.transmissionMap,this.thickness=e.thickness,this.thicknessMap=e.thicknessMap,this.attenuationDistance=e.attenuationDistance,this.attenuationColor.copy(e.attenuationColor),this.specularIntensity=e.specularIntensity,this.specularIntensityMap=e.specularIntensityMap,this.specularColor.copy(e.specularColor),this.specularColorMap=e.specularColorMap,this}}]),r}(),Jf=exports.MeshPhongMaterial=function(e){m(n,ca);var t=y(n);function n(e){var r;return A(this,n),(r=t.call(this)).isMeshPhongMaterial=!0,r.type="MeshPhongMaterial",r.color=new Nr(16777215),r.specular=new Nr(1118481),r.shininess=30,r.map=null,r.lightMap=null,r.lightMapIntensity=1,r.aoMap=null,r.aoMapIntensity=1,r.emissive=new Nr(0),r.emissiveIntensity=1,r.emissiveMap=null,r.bumpMap=null,r.bumpScale=1,r.normalMap=null,r.normalMapType=hn,r.normalScale=new yr(1,1),r.displacementMap=null,r.displacementScale=1,r.displacementBias=0,r.specularMap=null,r.alphaMap=null,r.envMap=null,r.combine=Se,r.reflectivity=1,r.refractionRatio=.98,r.wireframe=!1,r.wireframeLinewidth=1,r.wireframeLinecap="round",r.wireframeLinejoin="round",r.flatShading=!1,r.fog=!0,r.setValues(e),r}return E(n,[{key:"copy",value:function(e){return f(b(n.prototype),"copy",this).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.flatShading=e.flatShading,this.fog=e.fog,this}}]),n}(),Kf=exports.MeshToonMaterial=function(e){m(n,ca);var t=y(n);function n(e){var r;return A(this,n),(r=t.call(this)).isMeshToonMaterial=!0,r.defines={TOON:""},r.type="MeshToonMaterial",r.color=new Nr(16777215),r.map=null,r.gradientMap=null,r.lightMap=null,r.lightMapIntensity=1,r.aoMap=null,r.aoMapIntensity=1,r.emissive=new Nr(0),r.emissiveIntensity=1,r.emissiveMap=null,r.bumpMap=null,r.bumpScale=1,r.normalMap=null,r.normalMapType=hn,r.normalScale=new yr(1,1),r.displacementMap=null,r.displacementScale=1,r.displacementBias=0,r.alphaMap=null,r.wireframe=!1,r.wireframeLinewidth=1,r.wireframeLinecap="round",r.wireframeLinejoin="round",r.fog=!0,r.setValues(e),r}return E(n,[{key:"copy",value:function(e){return f(b(n.prototype),"copy",this).call(this,e),this.color.copy(e.color),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.alphaMap=e.alphaMap,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.fog=e.fog,this}}]),n}(),Qf=exports.MeshNormalMaterial=function(e){m(n,ca);var t=y(n);function n(e){var r;return A(this,n),(r=t.call(this)).isMeshNormalMaterial=!0,r.type="MeshNormalMaterial",r.bumpMap=null,r.bumpScale=1,r.normalMap=null,r.normalMapType=hn,r.normalScale=new yr(1,1),r.displacementMap=null,r.displacementScale=1,r.displacementBias=0,r.wireframe=!1,r.wireframeLinewidth=1,r.flatShading=!1,r.setValues(e),r}return E(n,[{key:"copy",value:function(e){return f(b(n.prototype),"copy",this).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.flatShading=e.flatShading,this}}]),n}(),$f=exports.MeshLambertMaterial=function(e){m(n,ca);var t=y(n);function n(e){var r;return A(this,n),(r=t.call(this)).isMeshLambertMaterial=!0,r.type="MeshLambertMaterial",r.color=new Nr(16777215),r.map=null,r.lightMap=null,r.lightMapIntensity=1,r.aoMap=null,r.aoMapIntensity=1,r.emissive=new Nr(0),r.emissiveIntensity=1,r.emissiveMap=null,r.specularMap=null,r.alphaMap=null,r.envMap=null,r.combine=Se,r.reflectivity=1,r.refractionRatio=.98,r.wireframe=!1,r.wireframeLinewidth=1,r.wireframeLinecap="round",r.wireframeLinejoin="round",r.fog=!0,r.setValues(e),r}return E(n,[{key:"copy",value:function(e){return f(b(n.prototype),"copy",this).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.fog=e.fog,this}}]),n}(),ev=exports.MeshMatcapMaterial=function(e){m(n,ca);var t=y(n);function n(e){var r;return A(this,n),(r=t.call(this)).isMeshMatcapMaterial=!0,r.defines={MATCAP:""},r.type="MeshMatcapMaterial",r.color=new Nr(16777215),r.matcap=null,r.map=null,r.bumpMap=null,r.bumpScale=1,r.normalMap=null,r.normalMapType=hn,r.normalScale=new yr(1,1),r.displacementMap=null,r.displacementScale=1,r.displacementBias=0,r.alphaMap=null,r.flatShading=!1,r.fog=!0,r.setValues(e),r}return E(n,[{key:"copy",value:function(e){return f(b(n.prototype),"copy",this).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.flatShading=e.flatShading,this.fog=e.fog,this}}]),n}(),tv=exports.LineDashedMaterial=function(e){m(n,zd);var t=y(n);function n(e){var r;return A(this,n),(r=t.call(this)).isLineDashedMaterial=!0,r.type="LineDashedMaterial",r.scale=1,r.dashSize=3,r.gapSize=1,r.setValues(e),r}return E(n,[{key:"copy",value:function(e){return f(b(n.prototype),"copy",this).call(this,e),this.scale=e.scale,this.dashSize=e.dashSize,this.gapSize=e.gapSize,this}}]),n}(),nv=exports.AnimationUtils={arraySlice:function(e,t,n){return nv.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(e){for(var t=e.length,n=new Array(t),r=0;r!==t;++r)n[r]=r;return n.sort(function(t,n){return e[t]-e[n]}),n},sortedArray:function(e,t,n){for(var r=e.length,i=new e.constructor(r),a=0,o=0;o!==r;++a)for(var s=n[a]*t,l=0;l!==t;++l)i[o++]=e[s+l];return i},flattenJSON:function(e,t,n,r){for(var i=1,a=e[0];void 0!==a&&void 0===a[r];)a=e[i++];if(void 0!==a){var o=a[r];if(void 0!==o)if(Array.isArray(o))do{void 0!==(o=a[r])&&(t.push(a.time),n.push.apply(n,o)),a=e[i++]}while(void 0!==a);else if(void 0!==o.toArray)do{void 0!==(o=a[r])&&(t.push(a.time),o.toArray(n,n.length)),a=e[i++]}while(void 0!==a);else do{void 0!==(o=a[r])&&(t.push(a.time),n.push(o)),a=e[i++]}while(void 0!==a)}},subclip:function(e,t,n,r){var i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:30,a=e.clone();a.name=t;for(var o=[],s=0;s=r)){c.push(l.times[d]);for(var f=0;fa.tracks[m].times[0]&&(v=a.tracks[m].times[0]);for(var g=0;g1&&void 0!==arguments[1]?arguments[1]:0,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:e,r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:30;r<=0&&(r=30);for(var i=n.tracks.length,a=t/r,o=function(){var t=n.tracks[s],r=t.ValueTypeName;if("bool"===r||"string"===r)return 0;var i=e.tracks.find(function(e){return e.name===t.name&&e.ValueTypeName===r});if(void 0===i)return 0;var o=0,l=t.getValueSize();t.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline&&(o=l/3);var u=0,c=i.getValueSize();i.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline&&(u=c/3);var h,d=t.times.length-1;if(a<=t.times[0]){var p=o,f=l-o;h=nv.arraySlice(t.values,p,f)}else if(a>=t.times[d]){var v=d*l+o,m=v+l-o;h=nv.arraySlice(t.values,v,m)}else{var g=t.createInterpolant(),y=o,x=l-o;g.evaluate(a),h=nv.arraySlice(g.resultBuffer,y,x)}"quaternion"===r&&(new Yr).fromArray(h).normalize().conjugate().toArray(h);for(var _=i.times.length,M=0;M<_;++M){var b=M*c+u;if("quaternion"===r)Yr.multiplyQuaternionsFlat(i.values,b,h,0,i.values,b);else for(var S=c-2*u,w=0;w=i)break e;var s=t[1];e=(i=t[--n-1]))break t}a=n,n=0}for(;n>>1;et;)--a;if(++a,0!==i||a!==r){i>=a&&(i=(a=Math.max(a,1))-1);var o=this.getValueSize();this.times=nv.arraySlice(n,i,a),this.values=nv.arraySlice(this.values,i*o,a*o)}return this}},{key:"validate",value: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,r=this.values,i=n.length;0===i&&(console.error("THREE.KeyframeTrack: Track is empty.",this),e=!1);for(var a=null,o=0;o!==i;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&&a>s){console.error("THREE.KeyframeTrack: Out of order keys.",this,o,s,a),e=!1;break}a=s}if(void 0!==r&&nv.isTypedArray(r))for(var l=0,u=r.length;l!==u;++l){var c=r[l];if(isNaN(c)){console.error("THREE.KeyframeTrack: Value is not a valid number.",this,l,c),e=!1;break}}return e}},{key:"optimize",value:function(){for(var e=nv.arraySlice(this.times),t=nv.arraySlice(this.values),n=this.getValueSize(),r=this.getInterpolation()===Kt,i=e.length-1,a=1,o=1;o0){e[a]=e[i];for(var g=i*n,y=a*n,x=0;x!==n;++x)t[y+x]=t[g+x];++a}return a!==e.length?(this.times=nv.arraySlice(e,0,a),this.values=nv.arraySlice(t,0,a*n)):(this.times=e,this.values=t),this}},{key:"clone",value:function(){var e=nv.arraySlice(this.times,0),t=nv.arraySlice(this.values,0),n=new(0,this.constructor)(this.name,e,t);return n.createInterpolant=this.createInterpolant,n}}],[{key:"toJSON",value:function(e){var t,n=e.constructor;if(n.toJSON!==this.toJSON)t=n.toJSON(e);else{t={name:e.name,times:nv.convertArray(e.times,Array),values:nv.convertArray(e.values,Array)};var r=e.getInterpolation();r!==e.DefaultInterpolation&&(t.interpolation=r)}return t.type=e.ValueTypeName,t}}]),e}();sv.prototype.TimeBufferType=Float32Array,sv.prototype.ValueBufferType=Float32Array,sv.prototype.DefaultInterpolation=Jt;var lv=exports.BooleanKeyframeTrack=function(e){m(n,sv);var t=y(n);function n(){return A(this,n),t.apply(this,arguments)}return E(n)}();lv.prototype.ValueTypeName="bool",lv.prototype.ValueBufferType=Array,lv.prototype.DefaultInterpolation=Zt,lv.prototype.InterpolantFactoryMethodLinear=void 0,lv.prototype.InterpolantFactoryMethodSmooth=void 0;var uv=exports.ColorKeyframeTrack=function(e){m(n,sv);var t=y(n);function n(){return A(this,n),t.apply(this,arguments)}return E(n)}();uv.prototype.ValueTypeName="color";var cv=exports.NumberKeyframeTrack=function(e){m(n,sv);var t=y(n);function n(){return A(this,n),t.apply(this,arguments)}return E(n)}();cv.prototype.ValueTypeName="number";var hv=exports.QuaternionLinearInterpolant=function(e){m(n,rv);var t=y(n);function n(e,r,i,a){return A(this,n),t.call(this,e,r,i,a)}return E(n,[{key:"interpolate_",value:function(e,t,n,r){for(var i=this.resultBuffer,a=this.sampleValues,o=this.valueSize,s=(n-t)/(r-t),l=e*o,u=l+o;l!==u;l+=4)Yr.slerpFlat(i,0,a,l-o,a,l,s);return i}}]),n}(),dv=exports.QuaternionKeyframeTrack=function(e){m(n,sv);var t=y(n);function n(){return A(this,n),t.apply(this,arguments)}return E(n,[{key:"InterpolantFactoryMethodLinear",value:function(e){return new hv(this.times,this.values,this.getValueSize(),e)}}]),n}();dv.prototype.ValueTypeName="quaternion",dv.prototype.DefaultInterpolation=Jt,dv.prototype.InterpolantFactoryMethodSmooth=void 0;var pv=exports.StringKeyframeTrack=function(e){m(n,sv);var t=y(n);function n(){return A(this,n),t.apply(this,arguments)}return E(n)}();pv.prototype.ValueTypeName="string",pv.prototype.ValueBufferType=Array,pv.prototype.DefaultInterpolation=Zt,pv.prototype.InterpolantFactoryMethodLinear=void 0,pv.prototype.InterpolantFactoryMethodSmooth=void 0;var fv=exports.VectorKeyframeTrack=function(e){m(n,sv);var t=y(n);function n(){return A(this,n),t.apply(this,arguments)}return E(n)}();fv.prototype.ValueTypeName="vector";var vv=exports.AnimationClip=function(){function e(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:-1,r=arguments.length>2?arguments[2]:void 0,i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:tn;A(this,e),this.name=t,this.tracks=r,this.duration=n,this.blendMode=i,this.uuid=Zn(),this.duration<0&&this.resetDuration()}return E(e,[{key:"resetDuration",value:function(){for(var e=0,t=0,n=this.tracks.length;t!==n;++t){var r=this.tracks[t];e=Math.max(e,r.times[r.times.length-1])}return this.duration=e,this}},{key:"trim",value:function(){for(var e=0;e1){var u=l[1],c=r[u];c||(r[u]=c=[]),c.push(s)}}var h=[];for(var d in r)h.push(this.CreateFromMorphTargetSequence(d,r[d],t,n));return h}},{key:"parseAnimation",value:function(e,t){if(!e)return console.error("THREE.AnimationClip: No animation in JSONLoader data."),null;for(var n=function(e,t,n,r,i){if(0!==n.length){var a=[],o=[];nv.flattenJSON(n,a,o,r),0!==a.length&&i.push(new e(t,a,o))}},r=[],i=e.name||"default",a=e.fps||30,o=e.blendMode,s=e.length||-1,l=e.hierarchy||[],u=0;u1&&void 0!==arguments[1]?arguments[1]:1;return A(this,n),(r=t.call(this)).isLight=!0,r.type="Light",r.color=new Nr(e),r.intensity=i,r}return E(n,[{key:"dispose",value:function(){}},{key:"copy",value:function(e,t){return f(b(n.prototype),"copy",this).call(this,e,t),this.color.copy(e.color),this.intensity=e.intensity,this}},{key:"toJSON",value:function(e){var t=f(b(n.prototype),"toJSON",this).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}}]),n}(),Pv=exports.HemisphereLight=function(e){m(n,Rv);var t=y(n);function n(e,r,i){var a;return A(this,n),(a=t.call(this,e,i)).isHemisphereLight=!0,a.type="HemisphereLight",a.position.copy(Ki.DefaultUp),a.updateMatrix(),a.groundColor=new Nr(r),a}return E(n,[{key:"copy",value:function(e,t){return f(b(n.prototype),"copy",this).call(this,e,t),this.groundColor.copy(e.groundColor),this}}]),n}(),Iv=new Ai,Dv=new Zr,Nv=new Zr,Ov=function(){function e(t){A(this,e),this.camera=t,this.bias=0,this.normalBias=0,this.radius=1,this.blurSamples=8,this.mapSize=new yr(512,512),this.map=null,this.mapPass=null,this.matrix=new Ai,this.autoUpdate=!0,this.needsUpdate=!1,this._frustum=new _o,this._frameExtents=new yr(1,1),this._viewportCount=1,this._viewports=[new Gr(0,0,1,1)]}return E(e,[{key:"getViewportCount",value:function(){return this._viewportCount}},{key:"getFrustum",value:function(){return this._frustum}},{key:"updateMatrices",value:function(e){var t=this.camera,n=this.matrix;Dv.setFromMatrixPosition(e.matrixWorld),t.position.copy(Dv),Nv.setFromMatrixPosition(e.target.matrixWorld),t.lookAt(Nv),t.updateMatrixWorld(),Iv.multiplyMatrices(t.projectionMatrix,t.matrixWorldInverse),this._frustum.setFromProjectionMatrix(Iv),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)}},{key:"getViewport",value:function(e){return this._viewports[e]}},{key:"getFrameExtents",value:function(){return this._frameExtents}},{key:"dispose",value:function(){this.map&&this.map.dispose(),this.mapPass&&this.mapPass.dispose()}},{key:"copy",value:function(e){return this.camera=e.camera.clone(),this.bias=e.bias,this.radius=e.radius,this.mapSize.copy(e.mapSize),this}},{key:"clone",value:function(){return(new this.constructor).copy(this)}},{key:"toJSON",value:function(){var e={};return 0!==this.bias&&(e.bias=this.bias),0!==this.normalBias&&(e.normalBias=this.normalBias),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}}]),e}(),Fv=function(e){m(n,Ov);var t=y(n);function n(){var e;return A(this,n),(e=t.call(this,new so(50,1,.5,500))).isSpotLightShadow=!0,e.focus=1,e}return E(n,[{key:"updateMatrices",value:function(e){var t=this.camera,r=2*Yn*e.angle*this.focus,i=this.mapSize.width/this.mapSize.height,a=e.distance||t.far;r===t.fov&&i===t.aspect&&a===t.far||(t.fov=r,t.aspect=i,t.far=a,t.updateProjectionMatrix()),f(b(n.prototype),"updateMatrices",this).call(this,e)}},{key:"copy",value:function(e){return f(b(n.prototype),"copy",this).call(this,e),this.focus=e.focus,this}}]),n}(),zv=exports.SpotLight=function(e){m(n,Rv);var t=y(n);function n(e,r){var i,a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:Math.PI/3,s=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0,l=arguments.length>5&&void 0!==arguments[5]?arguments[5]:1;return A(this,n),(i=t.call(this,e,r)).isSpotLight=!0,i.type="SpotLight",i.position.copy(Ki.DefaultUp),i.updateMatrix(),i.target=new Ki,i.distance=a,i.angle=o,i.penumbra=s,i.decay=l,i.shadow=new Fv,i}return E(n,[{key:"power",get:function(){return this.intensity*Math.PI},set:function(e){this.intensity=e/Math.PI}},{key:"dispose",value:function(){this.shadow.dispose()}},{key:"copy",value:function(e,t){return f(b(n.prototype),"copy",this).call(this,e,t),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}}]),n}(),Bv=new Ai,Uv=new Zr,Gv=new Zr,Vv=function(e){m(n,Ov);var t=y(n);function n(){var e;return A(this,n),(e=t.call(this,new so(90,1,.5,500))).isPointLightShadow=!0,e._frameExtents=new yr(4,2),e._viewportCount=6,e._viewports=[new Gr(2,1,1,1),new Gr(0,1,1,1),new Gr(3,1,1,1),new Gr(1,1,1,1),new Gr(3,0,1,1),new Gr(1,0,1,1)],e._cubeDirections=[new Zr(1,0,0),new Zr(-1,0,0),new Zr(0,0,1),new Zr(0,0,-1),new Zr(0,1,0),new Zr(0,-1,0)],e._cubeUps=[new Zr(0,1,0),new Zr(0,1,0),new Zr(0,1,0),new Zr(0,1,0),new Zr(0,0,1),new Zr(0,0,-1)],e}return E(n,[{key:"updateMatrices",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=this.camera,r=this.matrix,i=e.distance||n.far;i!==n.far&&(n.far=i,n.updateProjectionMatrix()),Uv.setFromMatrixPosition(e.matrixWorld),n.position.copy(Uv),Gv.copy(n.position),Gv.add(this._cubeDirections[t]),n.up.copy(this._cubeUps[t]),n.lookAt(Gv),n.updateMatrixWorld(),r.makeTranslation(-Uv.x,-Uv.y,-Uv.z),Bv.multiplyMatrices(n.projectionMatrix,n.matrixWorldInverse),this._frustum.setFromProjectionMatrix(Bv)}}]),n}(),Hv=exports.PointLight=function(e){m(n,Rv);var t=y(n);function n(e,r){var i,a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:1;return A(this,n),(i=t.call(this,e,r)).isPointLight=!0,i.type="PointLight",i.distance=a,i.decay=o,i.shadow=new Vv,i}return E(n,[{key:"power",get:function(){return 4*this.intensity*Math.PI},set:function(e){this.intensity=e/(4*Math.PI)}},{key:"dispose",value:function(){this.shadow.dispose()}},{key:"copy",value:function(e,t){return f(b(n.prototype),"copy",this).call(this,e,t),this.distance=e.distance,this.decay=e.decay,this.shadow=e.shadow.clone(),this}}]),n}(),Wv=function(e){m(n,Ov);var t=y(n);function n(){var e;return A(this,n),(e=t.call(this,new lu(-5,5,5,-5,.5,500))).isDirectionalLightShadow=!0,e}return E(n)}(),jv=exports.DirectionalLight=function(e){m(n,Rv);var t=y(n);function n(e,r){var i;return A(this,n),(i=t.call(this,e,r)).isDirectionalLight=!0,i.type="DirectionalLight",i.position.copy(Ki.DefaultUp),i.updateMatrix(),i.target=new Ki,i.shadow=new Wv,i}return E(n,[{key:"dispose",value:function(){this.shadow.dispose()}},{key:"copy",value:function(e){return f(b(n.prototype),"copy",this).call(this,e),this.target=e.target.clone(),this.shadow=e.shadow.clone(),this}}]),n}(),qv=exports.AmbientLight=function(e){m(n,Rv);var t=y(n);function n(e,r){var i;return A(this,n),(i=t.call(this,e,r)).isAmbientLight=!0,i.type="AmbientLight",i}return E(n)}(),Xv=exports.RectAreaLight=function(e){m(n,Rv);var t=y(n);function n(e,r){var i,a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:10,o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:10;return A(this,n),(i=t.call(this,e,r)).isRectAreaLight=!0,i.type="RectAreaLight",i.width=a,i.height=o,i}return E(n,[{key:"power",get:function(){return this.intensity*this.width*this.height*Math.PI},set:function(e){this.intensity=e/(this.width*this.height*Math.PI)}},{key:"copy",value:function(e){return f(b(n.prototype),"copy",this).call(this,e),this.width=e.width,this.height=e.height,this}},{key:"toJSON",value:function(e){var t=f(b(n.prototype),"toJSON",this).call(this,e);return t.object.width=this.width,t.object.height=this.height,t}}]),n}(),Yv=exports.SphericalHarmonics3=function(){function e(){A(this,e),this.isSphericalHarmonics3=!0,this.coefficients=[];for(var t=0;t<9;t++)this.coefficients.push(new Zr)}return E(e,[{key:"set",value:function(e){for(var t=0;t<9;t++)this.coefficients[t].copy(e[t]);return this}},{key:"zero",value:function(){for(var e=0;e<9;e++)this.coefficients[e].set(0,0,0);return this}},{key:"getAt",value:function(e,t){var n=e.x,r=e.y,i=e.z,a=this.coefficients;return t.copy(a[0]).multiplyScalar(.282095),t.addScaledVector(a[1],.488603*r),t.addScaledVector(a[2],.488603*i),t.addScaledVector(a[3],.488603*n),t.addScaledVector(a[4],n*r*1.092548),t.addScaledVector(a[5],r*i*1.092548),t.addScaledVector(a[6],.315392*(3*i*i-1)),t.addScaledVector(a[7],n*i*1.092548),t.addScaledVector(a[8],.546274*(n*n-r*r)),t}},{key:"getIrradianceAt",value:function(e,t){var n=e.x,r=e.y,i=e.z,a=this.coefficients;return t.copy(a[0]).multiplyScalar(.886227),t.addScaledVector(a[1],1.023328*r),t.addScaledVector(a[2],1.023328*i),t.addScaledVector(a[3],1.023328*n),t.addScaledVector(a[4],.858086*n*r),t.addScaledVector(a[5],.858086*r*i),t.addScaledVector(a[6],.743125*i*i-.247708),t.addScaledVector(a[7],.858086*n*i),t.addScaledVector(a[8],.429043*(n*n-r*r)),t}},{key:"add",value:function(e){for(var t=0;t<9;t++)this.coefficients[t].add(e.coefficients[t]);return this}},{key:"addScaledSH",value:function(e,t){for(var n=0;n<9;n++)this.coefficients[n].addScaledVector(e.coefficients[n],t);return this}},{key:"scale",value:function(e){for(var t=0;t<9;t++)this.coefficients[t].multiplyScalar(e);return this}},{key:"lerp",value:function(e,t){for(var n=0;n<9;n++)this.coefficients[n].lerp(e.coefficients[n],t);return this}},{key:"equals",value:function(e){for(var t=0;t<9;t++)if(!this.coefficients[t].equals(e.coefficients[t]))return!1;return!0}},{key:"copy",value:function(e){return this.set(e.coefficients)}},{key:"clone",value:function(){return(new this.constructor).copy(this)}},{key:"fromArray",value:function(e){for(var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=this.coefficients,r=0;r<9;r++)n[r].fromArray(e,t+3*r);return this}},{key:"toArray",value:function(){for(var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=this.coefficients,r=0;r<9;r++)n[r].toArray(e,t+3*r);return e}}],[{key:"getBasisAt",value:function(e,t){var n=e.x,r=e.y,i=e.z;t[0]=.282095,t[1]=.488603*r,t[2]=.488603*i,t[3]=.488603*n,t[4]=1.092548*n*r,t[5]=1.092548*r*i,t[6]=.315392*(3*i*i-1),t[7]=1.092548*n*i,t[8]=.546274*(n*n-r*r)}}]),e}(),Zv=exports.LightProbe=function(e){m(n,Rv);var t=y(n);function n(){var e,r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:new Yv,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;return A(this,n),(e=t.call(this,void 0,i)).isLightProbe=!0,e.sh=r,e}return E(n,[{key:"copy",value:function(e){return f(b(n.prototype),"copy",this).call(this,e),this.sh.copy(e.sh),this}},{key:"fromJSON",value:function(e){return this.intensity=e.intensity,this.sh.fromArray(e.sh),this}},{key:"toJSON",value:function(e){var t=f(b(n.prototype),"toJSON",this).call(this,e);return t.object.sh=this.sh.toArray(),t}}]),n}(),Jv=exports.MaterialLoader=function(e){m(n,bv);var t=y(n);function n(e){var r;return A(this,n),(r=t.call(this,e)).textures={},r}return E(n,[{key:"load",value:function(e,t,n,r){var i=this,a=new wv(i.manager);a.setPath(i.path),a.setRequestHeader(i.requestHeader),a.setWithCredentials(i.withCredentials),a.load(e,function(n){try{t(i.parse(JSON.parse(n)))}catch(a){r?r(a):console.error(a),i.manager.itemError(e)}},n,r)}},{key:"parse",value:function(e){var t=this.textures;function r(e){return void 0===t[e]&&console.warn("THREE.MaterialLoader: Undefined texture",e),t[e]}var i=n.createMaterialFromType(e.type);if(void 0!==e.uuid&&(i.uuid=e.uuid),void 0!==e.name&&(i.name=e.name),void 0!==e.color&&void 0!==i.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=e.sheen),void 0!==e.sheenColor&&(i.sheenColor=(new Nr).setHex(e.sheenColor)),void 0!==e.sheenRoughness&&(i.sheenRoughness=e.sheenRoughness),void 0!==e.emissive&&void 0!==i.emissive&&i.emissive.setHex(e.emissive),void 0!==e.specular&&void 0!==i.specular&&i.specular.setHex(e.specular),void 0!==e.specularIntensity&&(i.specularIntensity=e.specularIntensity),void 0!==e.specularColor&&void 0!==i.specularColor&&i.specularColor.setHex(e.specularColor),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.iridescence&&(i.iridescence=e.iridescence),void 0!==e.iridescenceIOR&&(i.iridescenceIOR=e.iridescenceIOR),void 0!==e.iridescenceThicknessRange&&(i.iridescenceThicknessRange=e.iridescenceThicknessRange),void 0!==e.transmission&&(i.transmission=e.transmission),void 0!==e.thickness&&(i.thickness=e.thickness),void 0!==e.attenuationDistance&&(i.attenuationDistance=e.attenuationDistance),void 0!==e.attenuationColor&&void 0!==i.attenuationColor&&i.attenuationColor.setHex(e.attenuationColor),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.shadowSide&&(i.shadowSide=e.shadowSide),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.dithering&&(i.dithering=e.dithering),void 0!==e.alphaToCoverage&&(i.alphaToCoverage=e.alphaToCoverage),void 0!==e.premultipliedAlpha&&(i.premultipliedAlpha=e.premultipliedAlpha),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=e.vertexColors>0:i.vertexColors=e.vertexColors),void 0!==e.uniforms)for(var a in e.uniforms){var o=e.uniforms[a];switch(i.uniforms[a]={},o.type){case"t":i.uniforms[a].value=r(o.value);break;case"c":i.uniforms[a].value=(new Nr).setHex(o.value);break;case"v2":i.uniforms[a].value=(new yr).fromArray(o.value);break;case"v3":i.uniforms[a].value=(new Zr).fromArray(o.value);break;case"v4":i.uniforms[a].value=(new Gr).fromArray(o.value);break;case"m3":i.uniforms[a].value=(new xr).fromArray(o.value);break;case"m4":i.uniforms[a].value=(new Ai).fromArray(o.value);break;default:i.uniforms[a].value=o.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 s in e.extensions)i.extensions[s]=e.extensions[s];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=r(e.map)),void 0!==e.matcap&&(i.matcap=r(e.matcap)),void 0!==e.alphaMap&&(i.alphaMap=r(e.alphaMap)),void 0!==e.bumpMap&&(i.bumpMap=r(e.bumpMap)),void 0!==e.bumpScale&&(i.bumpScale=e.bumpScale),void 0!==e.normalMap&&(i.normalMap=r(e.normalMap)),void 0!==e.normalMapType&&(i.normalMapType=e.normalMapType),void 0!==e.normalScale){var l=e.normalScale;!1===Array.isArray(l)&&(l=[l,l]),i.normalScale=(new yr).fromArray(l)}return void 0!==e.displacementMap&&(i.displacementMap=r(e.displacementMap)),void 0!==e.displacementScale&&(i.displacementScale=e.displacementScale),void 0!==e.displacementBias&&(i.displacementBias=e.displacementBias),void 0!==e.roughnessMap&&(i.roughnessMap=r(e.roughnessMap)),void 0!==e.metalnessMap&&(i.metalnessMap=r(e.metalnessMap)),void 0!==e.emissiveMap&&(i.emissiveMap=r(e.emissiveMap)),void 0!==e.emissiveIntensity&&(i.emissiveIntensity=e.emissiveIntensity),void 0!==e.specularMap&&(i.specularMap=r(e.specularMap)),void 0!==e.specularIntensityMap&&(i.specularIntensityMap=r(e.specularIntensityMap)),void 0!==e.specularColorMap&&(i.specularColorMap=r(e.specularColorMap)),void 0!==e.envMap&&(i.envMap=r(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=r(e.lightMap)),void 0!==e.lightMapIntensity&&(i.lightMapIntensity=e.lightMapIntensity),void 0!==e.aoMap&&(i.aoMap=r(e.aoMap)),void 0!==e.aoMapIntensity&&(i.aoMapIntensity=e.aoMapIntensity),void 0!==e.gradientMap&&(i.gradientMap=r(e.gradientMap)),void 0!==e.clearcoatMap&&(i.clearcoatMap=r(e.clearcoatMap)),void 0!==e.clearcoatRoughnessMap&&(i.clearcoatRoughnessMap=r(e.clearcoatRoughnessMap)),void 0!==e.clearcoatNormalMap&&(i.clearcoatNormalMap=r(e.clearcoatNormalMap)),void 0!==e.clearcoatNormalScale&&(i.clearcoatNormalScale=(new yr).fromArray(e.clearcoatNormalScale)),void 0!==e.iridescenceMap&&(i.iridescenceMap=r(e.iridescenceMap)),void 0!==e.iridescenceThicknessMap&&(i.iridescenceThicknessMap=r(e.iridescenceThicknessMap)),void 0!==e.transmissionMap&&(i.transmissionMap=r(e.transmissionMap)),void 0!==e.thicknessMap&&(i.thicknessMap=r(e.thicknessMap)),void 0!==e.sheenColorMap&&(i.sheenColorMap=r(e.sheenColorMap)),void 0!==e.sheenRoughnessMap&&(i.sheenRoughnessMap=r(e.sheenRoughnessMap)),i}},{key:"setTextures",value:function(e){return this.textures=e,this}}],[{key:"createMaterialFromType",value:function(e){return new{ShadowMaterial:qf,SpriteMaterial:rd,RawShaderMaterial:Xf,ShaderMaterial:ao,PointsMaterial:Zd,MeshPhysicalMaterial:Zf,MeshStandardMaterial:Yf,MeshPhongMaterial:Jf,MeshToonMaterial:Kf,MeshNormalMaterial:Qf,MeshLambertMaterial:$f,MeshDepthMaterial:Ph,MeshDistanceMaterial:Ih,MeshBasicMaterial:ha,MeshMatcapMaterial:ev,LineDashedMaterial:tv,LineBasicMaterial:zd,Material:ca}[e]}}]),n}(),Kv=exports.LoaderUtils=function(){function e(){A(this,e)}return E(e,null,[{key:"decodeText",value:function(e){if("undefined"!=typeof TextDecoder)return(new TextDecoder).decode(e);for(var t="",n=0,r=e.length;n0){var o=new _v(t);(n=new kv(o)).setCrossOrigin(this.crossOrigin);for(var s=0,l=e.length;s0)){e.next=33;break}(i=new kv(this.manager)).setCrossOrigin(this.crossOrigin),l=0,u=t.length;case 8:if(!(l2&&void 0!==arguments[2]?arguments[2]:1;A(this,n),(i=t.call(this,void 0,a)).isHemisphereLightProbe=!0;var o=(new Nr).set(e),s=(new Nr).set(r),l=new Zr(o.r,o.g,o.b),u=new Zr(s.r,s.g,s.b),c=Math.sqrt(Math.PI),h=c*Math.sqrt(.75);return i.sh.coefficients[0].copy(l).add(u).multiplyScalar(c),i.sh.coefficients[1].copy(l).sub(u).multiplyScalar(h),i}return E(n)}(),lm=exports.AmbientLightProbe=function(e){m(n,Zv);var t=y(n);function n(e){var r,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;A(this,n),(r=t.call(this,void 0,i)).isAmbientLightProbe=!0;var a=(new Nr).set(e);return r.sh.coefficients[0].set(a.r,a.g,a.b).multiplyScalar(2*Math.sqrt(Math.PI)),r}return E(n)}(),um=new Ai,cm=new Ai,hm=new Ai,dm=exports.StereoCamera=function(){function e(){A(this,e),this.type="StereoCamera",this.aspect=1,this.eyeSep=.064,this.cameraL=new so,this.cameraL.layers.enable(1),this.cameraL.matrixAutoUpdate=!1,this.cameraR=new so,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}}return E(e,[{key:"update",value: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,hm.copy(e.projectionMatrix);var n,r,i=t.eyeSep/2,a=i*t.near/t.focus,o=t.near*Math.tan(Xn*t.fov*.5)/t.zoom;cm.elements[12]=-i,um.elements[12]=i,n=-o*t.aspect+a,r=o*t.aspect+a,hm.elements[0]=2*t.near/(r-n),hm.elements[8]=(r+n)/(r-n),this.cameraL.projectionMatrix.copy(hm),n=-o*t.aspect-a,r=o*t.aspect-a,hm.elements[0]=2*t.near/(r-n),hm.elements[8]=(r+n)/(r-n),this.cameraR.projectionMatrix.copy(hm)}this.cameraL.matrixWorld.copy(e.matrixWorld).multiply(cm),this.cameraR.matrixWorld.copy(e.matrixWorld).multiply(um)}}]),e}(),pm=exports.Clock=function(){function e(){var t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];A(this,e),this.autoStart=t,this.startTime=0,this.oldTime=0,this.elapsedTime=0,this.running=!1}return E(e,[{key:"start",value:function(){this.startTime=fm(),this.oldTime=this.startTime,this.elapsedTime=0,this.running=!0}},{key:"stop",value:function(){this.getElapsedTime(),this.running=!1,this.autoStart=!1}},{key:"getElapsedTime",value:function(){return this.getDelta(),this.elapsedTime}},{key:"getDelta",value:function(){var e=0;if(this.autoStart&&!this.running)return this.start(),0;if(this.running){var t=fm();e=(t-this.oldTime)/1e3,this.oldTime=t,this.elapsedTime+=e}return e}}]),e}();function fm(){return("undefined"==typeof performance?Date:performance).now()}var vm=new Zr,mm=new Yr,gm=new Zr,ym=new Zr,xm=exports.AudioListener=function(e){m(n,Ki);var t=y(n);function n(){var e;return A(this,n),(e=t.call(this)).type="AudioListener",e.context=am.getContext(),e.gain=e.context.createGain(),e.gain.connect(e.context.destination),e.filter=null,e.timeDelta=0,e._clock=new pm,e}return E(n,[{key:"getInput",value:function(){return this.gain}},{key:"removeFilter",value: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}},{key:"getFilter",value:function(){return this.filter}},{key:"setFilter",value: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}},{key:"getMasterVolume",value:function(){return this.gain.gain.value}},{key:"setMasterVolume",value:function(e){return this.gain.gain.setTargetAtTime(e,this.context.currentTime,.01),this}},{key:"updateMatrixWorld",value:function(e){f(b(n.prototype),"updateMatrixWorld",this).call(this,e);var t=this.context.listener,r=this.up;if(this.timeDelta=this._clock.getDelta(),this.matrixWorld.decompose(vm,mm,gm),ym.set(0,0,-1).applyQuaternion(mm),t.positionX){var i=this.context.currentTime+this.timeDelta;t.positionX.linearRampToValueAtTime(vm.x,i),t.positionY.linearRampToValueAtTime(vm.y,i),t.positionZ.linearRampToValueAtTime(vm.z,i),t.forwardX.linearRampToValueAtTime(ym.x,i),t.forwardY.linearRampToValueAtTime(ym.y,i),t.forwardZ.linearRampToValueAtTime(ym.z,i),t.upX.linearRampToValueAtTime(r.x,i),t.upY.linearRampToValueAtTime(r.y,i),t.upZ.linearRampToValueAtTime(r.z,i)}else t.setPosition(vm.x,vm.y,vm.z),t.setOrientation(ym.x,ym.y,ym.z,r.x,r.y,r.z)}}]),n}(),_m=exports.Audio=function(e){m(n,Ki);var t=y(n);function n(e){var r;return A(this,n),(r=t.call(this)).type="Audio",r.listener=e,r.context=e.context,r.gain=r.context.createGain(),r.gain.connect(e.getInput()),r.autoplay=!1,r.buffer=null,r.detune=0,r.loop=!1,r.loopStart=0,r.loopEnd=0,r.offset=0,r.duration=void 0,r.playbackRate=1,r.isPlaying=!1,r.hasPlaybackControl=!0,r.source=null,r.sourceType="empty",r._startedAt=0,r._progress=0,r._connected=!1,r.filters=[],r}return E(n,[{key:"getOutput",value:function(){return this.gain}},{key:"setNodeSource",value:function(e){return this.hasPlaybackControl=!1,this.sourceType="audioNode",this.source=e,this.connect(),this}},{key:"setMediaElementSource",value:function(e){return this.hasPlaybackControl=!1,this.sourceType="mediaNode",this.source=this.context.createMediaElementSource(e),this.connect(),this}},{key:"setMediaStreamSource",value:function(e){return this.hasPlaybackControl=!1,this.sourceType="mediaStreamNode",this.source=this.context.createMediaStreamSource(e),this.connect(),this}},{key:"setBuffer",value:function(e){return this.buffer=e,this.sourceType="buffer",this.autoplay&&this.play(),this}},{key:"play",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;if(!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.")}},{key:"pause",value: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.")}},{key:"stop",value: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.")}},{key:"connect",value:function(){if(this.filters.length>0){this.source.connect(this.filters[0]);for(var e=1,t=this.filters.length;e0){this.source.disconnect(this.filters[0]);for(var e=1,t=this.filters.length;e1&&void 0!==arguments[1]?arguments[1]:2048;A(this,e),this.analyser=t.context.createAnalyser(),this.analyser.fftSize=n,this.data=new Uint8Array(this.analyser.frequencyBinCount),t.getOutput().connect(this.analyser)}return E(e,[{key:"getFrequencyData",value:function(){return this.analyser.getByteFrequencyData(this.data),this.data}},{key:"getAverageFrequency",value:function(){for(var e=0,t=this.getFrequencyData(),n=0;n0&&this._mixBufferRegionAdditive(n,r,this._addIndex*t,1,t);for(var l=t,u=t+t;l!==u;++l)if(n[l]!==n[l+t]){o.setValue(n,r);break}}},{key:"saveOriginalState",value:function(){var e=this.binding,t=this.buffer,n=this.valueSize,r=n*this._origIndex;e.getValue(t,r);for(var i=n,a=r;i!==a;++i)t[i]=t[r+i%n];this._setIdentity(),this.cumulativeWeight=0,this.cumulativeWeightAdditive=0}},{key:"restoreOriginalState",value:function(){var e=3*this.valueSize;this.binding.setValue(this.buffer,e)}},{key:"_setAdditiveIdentityNumeric",value:function(){for(var e=this._addIndex*this.valueSize,t=e+this.valueSize,n=e;n=.5)for(var a=0;a!==i;++a)e[t+a]=e[n+a]}},{key:"_slerp",value:function(e,t,n,r){Yr.slerpFlat(e,t,e,t,e,n,r)}},{key:"_slerpAdditive",value:function(e,t,n,r,i){var a=this._workIndex*i;Yr.multiplyQuaternionsFlat(e,a,e,t,e,n),Yr.slerpFlat(e,t,e,t,e,a,r)}},{key:"_lerp",value:function(e,t,n,r,i){for(var a=1-r,o=0;o!==i;++o){var s=t+o;e[s]=e[s]*a+e[n+o]*r}}},{key:"_lerpAdditive",value:function(e,t,n,r,i){for(var a=0;a!==i;++a){var o=t+a;e[o]=e[o]+e[n+a]*r}}}]),e}(),Em="\\[\\]\\.:\\/",Cm=new RegExp("["+Em+"]","g"),Lm="[^"+Em+"]",Rm="[^"+Em.replace("\\.","")+"]",Pm=/((?:WC+[\/:])*)/.source.replace("WC",Lm),Im=/(WCOD+)?/.source.replace("WCOD",Rm),Dm=/(?:\.(WC+)(?:\[(.+)\])?)?/.source.replace("WC",Lm),Nm=/\.(WC+)(?:\[(.+)\])?/.source.replace("WC",Lm),Om=new RegExp("^"+Pm+Im+Dm+Nm+"$"),Fm=["material","materials","bones"],zm=function(){function e(t,n,r){A(this,e);var i=r||Bm.parseTrackName(n);this._targetGroup=t,this._bindings=t.subscribe_(n,i)}return E(e,[{key:"getValue",value:function(e,t){this.bind();var n=this._targetGroup.nCachedObjects_,r=this._bindings[n];void 0!==r&&r.getValue(e,t)}},{key:"setValue",value:function(e,t){for(var n=this._bindings,r=this._targetGroup.nCachedObjects_,i=n.length;r!==i;++r)n[r].setValue(e,t)}},{key:"bind",value:function(){for(var e=this._bindings,t=this._targetGroup.nCachedObjects_,n=e.length;t!==n;++t)e[t].bind()}},{key:"unbind",value:function(){for(var e=this._bindings,t=this._targetGroup.nCachedObjects_,n=e.length;t!==n;++t)e[t].unbind()}}]),e}(),Bm=exports.PropertyBinding=function(){function e(t,n,r){A(this,e),this.path=n,this.parsedPath=r||e.parseTrackName(n),this.node=e.findNode(t,this.parsedPath.nodeName)||t,this.rootNode=t,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}return E(e,[{key:"_getValue_unavailable",value:function(){}},{key:"_setValue_unavailable",value:function(){}},{key:"_getValue_direct",value:function(e,t){e[t]=this.targetObject[this.propertyName]}},{key:"_getValue_array",value:function(e,t){for(var n=this.resolvedProperty,r=0,i=n.length;r!==i;++r)e[t++]=n[r]}},{key:"_getValue_arrayElement",value:function(e,t){e[t]=this.resolvedProperty[this.propertyIndex]}},{key:"_getValue_toArray",value:function(e,t){this.resolvedProperty.toArray(e,t)}},{key:"_setValue_direct",value:function(e,t){this.targetObject[this.propertyName]=e[t]}},{key:"_setValue_direct_setNeedsUpdate",value:function(e,t){this.targetObject[this.propertyName]=e[t],this.targetObject.needsUpdate=!0}},{key:"_setValue_direct_setMatrixWorldNeedsUpdate",value:function(e,t){this.targetObject[this.propertyName]=e[t],this.targetObject.matrixWorldNeedsUpdate=!0}},{key:"_setValue_array",value:function(e,t){for(var n=this.resolvedProperty,r=0,i=n.length;r!==i;++r)n[r]=e[t++]}},{key:"_setValue_array_setNeedsUpdate",value:function(e,t){for(var n=this.resolvedProperty,r=0,i=n.length;r!==i;++r)n[r]=e[t++];this.targetObject.needsUpdate=!0}},{key:"_setValue_array_setMatrixWorldNeedsUpdate",value:function(e,t){for(var n=this.resolvedProperty,r=0,i=n.length;r!==i;++r)n[r]=e[t++];this.targetObject.matrixWorldNeedsUpdate=!0}},{key:"_setValue_arrayElement",value:function(e,t){this.resolvedProperty[this.propertyIndex]=e[t]}},{key:"_setValue_arrayElement_setNeedsUpdate",value:function(e,t){this.resolvedProperty[this.propertyIndex]=e[t],this.targetObject.needsUpdate=!0}},{key:"_setValue_arrayElement_setMatrixWorldNeedsUpdate",value:function(e,t){this.resolvedProperty[this.propertyIndex]=e[t],this.targetObject.matrixWorldNeedsUpdate=!0}},{key:"_setValue_fromArray",value:function(e,t){this.resolvedProperty.fromArray(e,t)}},{key:"_setValue_fromArray_setNeedsUpdate",value:function(e,t){this.resolvedProperty.fromArray(e,t),this.targetObject.needsUpdate=!0}},{key:"_setValue_fromArray_setMatrixWorldNeedsUpdate",value:function(e,t){this.resolvedProperty.fromArray(e,t),this.targetObject.matrixWorldNeedsUpdate=!0}},{key:"_getValue_unbound",value:function(e,t){this.bind(),this.getValue(e,t)}},{key:"_setValue_unbound",value:function(e,t){this.bind(),this.setValue(e,t)}},{key:"bind",value:function(){var t=this.node,n=this.parsedPath,r=n.objectName,i=n.propertyName,a=n.propertyIndex;if(t||(t=e.findNode(this.rootNode,n.nodeName)||this.rootNode,this.node=t),this.getValue=this._getValue_unavailable,this.setValue=this._setValue_unavailable,t){if(r){var o=n.objectIndex;switch(r){case"materials":if(!t.material)return void console.error("THREE.PropertyBinding: Can not bind to material as node does not have a material.",this);if(!t.material.materials)return void console.error("THREE.PropertyBinding: Can not bind to material.materials as node.material does not have a materials array.",this);t=t.material.materials;break;case"bones":if(!t.skeleton)return void console.error("THREE.PropertyBinding: Can not bind to bones as node does not have a skeleton.",this);t=t.skeleton.bones;for(var s=0;s=i){var c=i++,h=e[c];t[h.uuid]=u,e[u]=h,t[l]=c,e[c]=s;for(var d=0,p=r;d!==p;++d){var f=n[d],v=f[c],m=f[u];f[u]=v,f[c]=m}}}this.nCachedObjects_=i}},{key:"uncache",value:function(){for(var e=this._objects,t=this._indicesByUUID,n=this._bindings,r=n.length,i=this.nCachedObjects_,a=e.length,o=0,s=arguments.length;o!==s;++o){var l=arguments[o].uuid,u=t[l];if(void 0!==u)if(delete t[l],u0&&(t[_.uuid]=u),e[u]=_,e.pop();for(var M=0,b=r;M!==b;++M){var S=n[M];S[u]=S[x],S.pop()}}}this.nCachedObjects_=i}},{key:"subscribe_",value:function(e,t){var n=this._bindingsIndicesByPath,r=n[e],i=this._bindings;if(void 0!==r)return i[r];var a=this._paths,o=this._parsedPaths,s=this._objects,l=s.length,u=this.nCachedObjects_,c=new Array(l);r=i.length,n[e]=r,a.push(e),o.push(t),i.push(c);for(var h=u,d=s.length;h!==d;++h){var p=s[h];c[h]=new Bm(p,e,t)}return c}},{key:"unsubscribe_",value:function(e){var t=this._bindingsIndicesByPath,n=t[e];if(void 0!==n){var r=this._paths,i=this._parsedPaths,a=this._bindings,o=a.length-1,s=a[o];t[e[o]]=n,a[n]=s,a.pop(),i[n]=i[o],i.pop(),r[n]=r[o],r.pop()}}}]),e}(),Gm=function(){function e(t,n){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:n.blendMode;A(this,e),this._mixer=t,this._clip=n,this._localRoot=r,this.blendMode=i;for(var a=n.tracks,o=a.length,s=new Array(o),l={endingStart:Qt,endingEnd:Qt},u=0;u!==o;++u){var c=a[u].createInterpolant(null);s[u]=c,c.settings=l}this._interpolantSettings=l,this._interpolants=s,this._propertyBindings=new Array(o),this._cacheIndex=null,this._byClipCacheIndex=null,this._timeScaleInterpolant=null,this._weightInterpolant=null,this.loop=Xt,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}return E(e,[{key:"play",value:function(){return this._mixer._activateAction(this),this}},{key:"stop",value:function(){return this._mixer._deactivateAction(this),this.reset()}},{key:"reset",value:function(){return this.paused=!1,this.enabled=!0,this.time=0,this._loopCount=-1,this._startTime=null,this.stopFading().stopWarping()}},{key:"isRunning",value:function(){return this.enabled&&!this.paused&&0!==this.timeScale&&null===this._startTime&&this._mixer._isActiveAction(this)}},{key:"isScheduled",value:function(){return this._mixer._isActiveAction(this)}},{key:"startAt",value:function(e){return this._startTime=e,this}},{key:"setLoop",value:function(e,t){return this.loop=e,this.repetitions=t,this}},{key:"setEffectiveWeight",value:function(e){return this.weight=e,this._effectiveWeight=this.enabled?e:0,this.stopFading()}},{key:"getEffectiveWeight",value:function(){return this._effectiveWeight}},{key:"fadeIn",value:function(e){return this._scheduleFading(e,0,1)}},{key:"fadeOut",value:function(e){return this._scheduleFading(e,1,0)}},{key:"crossFadeFrom",value:function(e,t,n){if(e.fadeOut(t),this.fadeIn(t),n){var r=this._clip.duration,i=e._clip.duration,a=i/r,o=r/i;e.warp(1,a,t),this.warp(o,1,t)}return this}},{key:"crossFadeTo",value:function(e,t,n){return e.crossFadeFrom(this,t,n)}},{key:"stopFading",value:function(){var e=this._weightInterpolant;return null!==e&&(this._weightInterpolant=null,this._mixer._takeBackControlInterpolant(e)),this}},{key:"setEffectiveTimeScale",value:function(e){return this.timeScale=e,this._effectiveTimeScale=this.paused?0:e,this.stopWarping()}},{key:"getEffectiveTimeScale",value:function(){return this._effectiveTimeScale}},{key:"setDuration",value:function(e){return this.timeScale=this._clip.duration/e,this.stopWarping()}},{key:"syncWith",value:function(e){return this.time=e.time,this.timeScale=e.timeScale,this.stopWarping()}},{key:"halt",value:function(e){return this.warp(this._effectiveTimeScale,0,e)}},{key:"warp",value:function(e,t,n){var r=this._mixer,i=r.time,a=this.timeScale,o=this._timeScaleInterpolant;null===o&&(o=r._lendControlInterpolant(),this._timeScaleInterpolant=o);var s=o.parameterPositions,l=o.sampleValues;return s[0]=i,s[1]=i+n,l[0]=e/a,l[1]=t/a,this}},{key:"stopWarping",value:function(){var e=this._timeScaleInterpolant;return null!==e&&(this._timeScaleInterpolant=null,this._mixer._takeBackControlInterpolant(e)),this}},{key:"getMixer",value:function(){return this._mixer}},{key:"getClip",value:function(){return this._clip}},{key:"getRoot",value:function(){return this._localRoot||this._mixer._root}},{key:"_update",value:function(e,t,n,r){if(this.enabled){var i=this._startTime;if(null!==i){var a=(e-i)*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(s>0){var l=this._interpolants,u=this._propertyBindings;switch(this.blendMode){case nn:for(var c=0,h=l.length;c!==h;++c)l[c].evaluate(o),u[c].accumulateAdditive(s);break;case tn:default:for(var d=0,p=l.length;d!==p;++d)l[d].evaluate(o),u[d].accumulate(r,s)}}}else this._updateWeight(e)}},{key:"_updateWeight",value:function(e){var t=0;if(this.enabled){t=this.weight;var n=this._weightInterpolant;if(null!==n){var r=n.evaluate(e)[0];t*=r,e>n.parameterPositions[1]&&(this.stopFading(),0===r&&(this.enabled=!1))}}return this._effectiveWeight=t,t}},{key:"_updateTimeScale",value: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,t}},{key:"_updateTime",value:function(e){var t=this._clip.duration,n=this.loop,r=this.time+e,i=this._loopCount,a=n===Yt;if(0===e)return-1===i?r:a&&1==(1&i)?t-r:r;if(n===qt){-1===i&&(this._loopCount=0,this._setEndings(!0,!0,!1));e:{if(r>=t)r=t;else{if(!(r<0)){this.time=r;break e}r=0}this.clampWhenFinished?this.paused=!0:this.enabled=!1,this.time=r,this._mixer.dispatchEvent({type:"finished",action:this,direction:e<0?-1:1})}}else{if(-1===i&&(e>=0?(i=0,this._setEndings(!0,0===this.repetitions,a)):this._setEndings(0===this.repetitions,!0,a)),r>=t||r<0){var o=Math.floor(r/t);r-=t*o,i+=Math.abs(o);var s=this.repetitions-i;if(s<=0)this.clampWhenFinished?this.paused=!0:this.enabled=!1,r=e>0?t:0,this.time=r,this._mixer.dispatchEvent({type:"finished",action:this,direction:e>0?1:-1});else{if(1===s){var l=e<0;this._setEndings(l,!l,a)}else this._setEndings(!1,!1,a);this._loopCount=i,this.time=r,this._mixer.dispatchEvent({type:"loop",action:this,loopDelta:o})}}else this.time=r;if(a&&1==(1&i))return t-r}return r}},{key:"_setEndings",value:function(e,t,n){var r=this._interpolantSettings;n?(r.endingStart=$t,r.endingEnd=$t):(r.endingStart=e?this.zeroSlopeAtStart?$t:Qt:en,r.endingEnd=t?this.zeroSlopeAtEnd?$t:Qt:en)}},{key:"_scheduleFading",value:function(e,t,n){var r=this._mixer,i=r.time,a=this._weightInterpolant;null===a&&(a=r._lendControlInterpolant(),this._weightInterpolant=a);var o=a.parameterPositions,s=a.sampleValues;return o[0]=i,s[0]=t,o[1]=i+e,s[1]=n,this}}]),e}(),Vm=new Float32Array(1),Hm=exports.AnimationMixer=function(e){m(n,Wn);var t=y(n);function n(e){var r;return A(this,n),(r=t.call(this))._root=e,r._initMemoryManager(),r._accuIndex=0,r.time=0,r.timeScale=1,r}return E(n,[{key:"_bindAction",value:function(e,t){var n=e._localRoot||this._root,r=e._clip.tracks,i=r.length,a=e._propertyBindings,o=e._interpolants,s=n.uuid,l=this._bindingsByRootAndName,u=l[s];void 0===u&&(u={},l[s]=u);for(var c=0;c!==i;++c){var h=r[c],d=h.name,p=u[d];if(void 0!==p)++p.referenceCount,a[c]=p;else{if(void 0!==(p=a[c])){null===p._cacheIndex&&(++p.referenceCount,this._addInactiveBinding(p,s,d));continue}var f=t&&t._propertyBindings[c].binding.parsedPath;++(p=new km(Bm.create(n,d,f),h.ValueTypeName,h.getValueSize())).referenceCount,this._addInactiveBinding(p,s,d),a[c]=p}o[c].resultBuffer=p.buffer}}},{key:"_activateAction",value:function(e){if(!this._isActiveAction(e)){if(null===e._cacheIndex){var t=(e._localRoot||this._root).uuid,n=e._clip.uuid,r=this._actionsByClip[n];this._bindAction(e,r&&r.knownActions[0]),this._addInactiveAction(e,n,t)}for(var i=e._propertyBindings,a=0,o=i.length;a!==o;++a){var s=i[a];0==s.useCount++&&(this._lendBinding(s),s.saveOriginalState())}this._lendAction(e)}}},{key:"_deactivateAction",value:function(e){if(this._isActiveAction(e)){for(var t=e._propertyBindings,n=0,r=t.length;n!==r;++n){var i=t[n];0==--i.useCount&&(i.restoreOriginalState(),this._takeBackBinding(i))}this._takeBackAction(e)}}},{key:"_initMemoryManager",value: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}}}}},{key:"_isActiveAction",value:function(e){var t=e._cacheIndex;return null!==t&&t=0;--t)e[t].stop();return this}},{key:"update",value:function(e){e*=this.timeScale;for(var t=this._actions,n=this._nActiveActions,r=this.time+=e,i=Math.sign(e),a=this._accuIndex^=1,o=0;o!==n;++o){t[o]._update(r,e,i,a)}for(var s=this._bindings,l=this._nActiveBindings,u=0;u!==l;++u)s[u].apply(a);return this}},{key:"setTime",value:function(e){this.time=0;for(var t=0;t2&&void 0!==arguments[2]?arguments[2]:1;return A(this,n),(i=t.call(this,e,r)).isInstancedInterleavedBuffer=!0,i.meshPerAttribute=a,i}return E(n,[{key:"copy",value:function(e){return f(b(n.prototype),"copy",this).call(this,e),this.meshPerAttribute=e.meshPerAttribute,this}},{key:"clone",value:function(e){var t=f(b(n.prototype),"clone",this).call(this,e);return t.meshPerAttribute=this.meshPerAttribute,t}},{key:"toJSON",value:function(e){var t=f(b(n.prototype),"toJSON",this).call(this,e);return t.isInstancedInterleavedBuffer=!0,t.meshPerAttribute=this.meshPerAttribute,t}}]),n}(),qm=exports.GLBufferAttribute=function(){function e(t,n,r,i,a){A(this,e),this.isGLBufferAttribute=!0,this.buffer=t,this.type=n,this.itemSize=r,this.elementSize=i,this.count=a,this.version=0}return E(e,[{key:"needsUpdate",set:function(e){!0===e&&this.version++}},{key:"setBuffer",value:function(e){return this.buffer=e,this}},{key:"setType",value:function(e,t){return this.type=e,this.elementSize=t,this}},{key:"setItemSize",value:function(e){return this.itemSize=e,this}},{key:"setCount",value:function(e){return this.count=e,this}}]),e}(),Xm=exports.Raycaster=function(){function e(t,n){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:1/0;A(this,e),this.ray=new Ti(t,n),this.near=r,this.far=i,this.camera=null,this.layers=new Fi,this.params={Mesh:{},Line:{threshold:1},LOD:{},Points:{threshold:1},Sprite:{}}}return E(e,[{key:"set",value:function(e,t){this.ray.set(e,t)}},{key:"setFromCamera",value:function(e,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.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: "+t.type)}},{key:"intersectObject",value:function(e){var t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[];return Zm(e,this,n,t),n.sort(Ym),n}},{key:"intersectObjects",value:function(e){for(var t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[],r=0,i=e.length;r0&&void 0!==arguments[0]?arguments[0]:1,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;return A(this,e),this.radius=t,this.phi=n,this.theta=r,this}return E(e,[{key:"set",value:function(e,t,n){return this.radius=e,this.phi=t,this.theta=n,this}},{key:"copy",value:function(e){return this.radius=e.radius,this.phi=e.phi,this.theta=e.theta,this}},{key:"makeSafe",value:function(){return this.phi=Math.max(1e-6,Math.min(Math.PI-1e-6,this.phi)),this}},{key:"setFromVector3",value:function(e){return this.setFromCartesianCoords(e.x,e.y,e.z)}},{key:"setFromCartesianCoords",value: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(Jn(t/this.radius,-1,1))),this}},{key:"clone",value:function(){return(new this.constructor).copy(this)}}]),e}(),Km=exports.Cylindrical=function(){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;return A(this,e),this.radius=t,this.theta=n,this.y=r,this}return E(e,[{key:"set",value:function(e,t,n){return this.radius=e,this.theta=t,this.y=n,this}},{key:"copy",value:function(e){return this.radius=e.radius,this.theta=e.theta,this.y=e.y,this}},{key:"setFromVector3",value:function(e){return this.setFromCartesianCoords(e.x,e.y,e.z)}},{key:"setFromCartesianCoords",value:function(e,t,n){return this.radius=Math.sqrt(e*e+n*n),this.theta=Math.atan2(e,n),this.y=t,this}},{key:"clone",value:function(){return(new this.constructor).copy(this)}}]),e}(),Qm=new yr,$m=exports.Box2=function(){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:new yr(1/0,1/0),n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new yr(-1/0,-1/0);A(this,e),this.isBox2=!0,this.min=t,this.max=n}return E(e,[{key:"set",value:function(e,t){return this.min.copy(e),this.max.copy(t),this}},{key:"setFromPoints",value:function(e){this.makeEmpty();for(var t=0,n=e.length;tthis.max.x||e.ythis.max.y)}},{key:"containsBox",value: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}},{key:"getParameter",value:function(e,t){return t.set((e.x-this.min.x)/(this.max.x-this.min.x),(e.y-this.min.y)/(this.max.y-this.min.y))}},{key:"intersectsBox",value:function(e){return!(e.max.xthis.max.x||e.max.ythis.max.y)}},{key:"clampPoint",value:function(e,t){return t.copy(e).clamp(this.min,this.max)}},{key:"distanceToPoint",value:function(e){return Qm.copy(e).clamp(this.min,this.max).sub(e).length()}},{key:"intersect",value:function(e){return this.min.max(e.min),this.max.min(e.max),this}},{key:"union",value:function(e){return this.min.min(e.min),this.max.max(e.max),this}},{key:"translate",value:function(e){return this.min.add(e),this.max.add(e),this}},{key:"equals",value:function(e){return e.min.equals(this.min)&&e.max.equals(this.max)}}]),e}(),eg=new Zr,tg=new Zr,ng=exports.Line3=function(){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:new Zr,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new Zr;A(this,e),this.start=t,this.end=n}return E(e,[{key:"set",value:function(e,t){return this.start.copy(e),this.end.copy(t),this}},{key:"copy",value:function(e){return this.start.copy(e.start),this.end.copy(e.end),this}},{key:"getCenter",value:function(e){return e.addVectors(this.start,this.end).multiplyScalar(.5)}},{key:"delta",value:function(e){return e.subVectors(this.end,this.start)}},{key:"distanceSq",value:function(){return this.start.distanceToSquared(this.end)}},{key:"distance",value:function(){return this.start.distanceTo(this.end)}},{key:"at",value:function(e,t){return this.delta(t).multiplyScalar(e).add(this.start)}},{key:"closestPointToPointParameter",value:function(e,t){eg.subVectors(e,this.start),tg.subVectors(this.end,this.start);var n=tg.dot(tg),r=tg.dot(eg)/n;return t&&(r=Jn(r,0,1)),r}},{key:"closestPointToPoint",value:function(e,t,n){var r=this.closestPointToPointParameter(e,t);return this.delta(n).multiplyScalar(r).add(this.start)}},{key:"applyMatrix4",value:function(e){return this.start.applyMatrix4(e),this.end.applyMatrix4(e),this}},{key:"equals",value:function(e){return e.start.equals(this.start)&&e.end.equals(this.end)}},{key:"clone",value:function(){return(new this.constructor).copy(this)}}]),e}(),rg=new Zr,ig=exports.SpotLightHelper=function(e){m(n,Ki);var t=y(n);function n(e,r){var i;A(this,n),(i=t.call(this)).light=e,i.light.updateMatrixWorld(),i.matrix=e.matrixWorld,i.matrixAutoUpdate=!1,i.color=r;for(var a=new Pa,o=[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],s=0,l=1;s<32;s++,l++){var u=s/32*Math.PI*2,c=l/32*Math.PI*2;o.push(Math.cos(u),Math.sin(u),1,Math.cos(c),Math.sin(c),1)}a.setAttribute("position",new Sa(o,3));var h=new zd({fog:!1,toneMapped:!1});return i.cone=new Xd(a,h),i.add(i.cone),i.update(),i}return E(n,[{key:"dispose",value:function(){this.cone.geometry.dispose(),this.cone.material.dispose()}},{key:"update",value: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),rg.setFromMatrixPosition(this.light.target.matrixWorld),this.cone.lookAt(rg),void 0!==this.color?this.cone.material.color.set(this.color):this.cone.material.color.copy(this.light.color)}}]),n}(),ag=new Zr,og=new Ai,sg=new Ai,lg=exports.SkeletonHelper=function(e){m(n,Xd);var t=y(n);function n(e){var r;A(this,n);for(var i=ug(e),a=new Pa,o=[],s=[],l=new Nr(0,0,1),u=new Nr(0,1,0),c=0;c0&&void 0!==arguments[0]?arguments[0]:10,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:10,a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:4473924,o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:8947848;A(this,n),a=new Nr(a),o=new Nr(o);for(var s=i/2,l=r/i,u=r/2,c=[],h=[],d=0,p=0,f=-u;d<=i;d++,f+=l){c.push(-u,0,f,u,0,f),c.push(f,0,-u,f,0,u);var v=d===s?a:o;v.toArray(h,p),p+=3,v.toArray(h,p),p+=3,v.toArray(h,p),p+=3,v.toArray(h,p),p+=3}var m=new Pa;m.setAttribute("position",new Sa(c,3)),m.setAttribute("color",new Sa(h,3));var g=new zd({vertexColors:!0,toneMapped:!1});return(e=t.call(this,m,g)).type="GridHelper",e}return E(n)}(),mg=exports.PolarGridHelper=function(e){m(n,Xd);var t=y(n);function n(){var e,r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:16,a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:8,o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:64,s=arguments.length>4&&void 0!==arguments[4]?arguments[4]:4473924,l=arguments.length>5&&void 0!==arguments[5]?arguments[5]:8947848;A(this,n),s=new Nr(s),l=new Nr(l);for(var u=[],c=[],h=0;h<=i;h++){var d=h/i*(2*Math.PI),p=Math.sin(d)*r,f=Math.cos(d)*r;u.push(0,0,0),u.push(p,0,f);var v=1&h?s:l;c.push(v.r,v.g,v.b),c.push(v.r,v.g,v.b)}for(var m=0;m<=a;m++)for(var g=1&m?s:l,y=r-r/a*m,x=0;x1&&void 0!==arguments[1]?arguments[1]:16776960;A(this,n);var a=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]),o=new Float32Array(24),s=new Pa;return s.setIndex(new fa(a,1)),s.setAttribute("position",new fa(o,3)),(r=t.call(this,s,new zd({color:i,toneMapped:!1}))).object=e,r.type="BoxHelper",r.matrixAutoUpdate=!1,r.update(),r}return E(n,[{key:"update",value:function(e){if(void 0!==e&&console.warn("THREE.BoxHelper: .update() has no longer arguments."),void 0!==this.object&&kg.setFromObject(this.object),!kg.isEmpty()){var t=kg.min,n=kg.max,r=this.geometry.attributes.position,i=r.array;i[0]=n.x,i[1]=n.y,i[2]=n.z,i[3]=t.x,i[4]=n.y,i[5]=n.z,i[6]=t.x,i[7]=t.y,i[8]=n.z,i[9]=n.x,i[10]=t.y,i[11]=n.z,i[12]=n.x,i[13]=n.y,i[14]=t.z,i[15]=t.x,i[16]=n.y,i[17]=t.z,i[18]=t.x,i[19]=t.y,i[20]=t.z,i[21]=n.x,i[22]=t.y,i[23]=t.z,r.needsUpdate=!0,this.geometry.computeBoundingSphere()}}},{key:"setFromObject",value:function(e){return this.object=e,this.update(),this}},{key:"copy",value:function(e,t){return f(b(n.prototype),"copy",this).call(this,e,t),this.object=e.object,this}}]),n}(),Cg=exports.Box3Helper=function(e){m(n,Xd);var t=y(n);function n(e){var r,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:16776960;A(this,n);var a=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]),o=new Pa;return o.setIndex(new fa(a,1)),o.setAttribute("position",new Sa([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)),(r=t.call(this,o,new zd({color:i,toneMapped:!1}))).box=e,r.type="Box3Helper",r.geometry.computeBoundingSphere(),r}return E(n,[{key:"updateMatrixWorld",value:function(e){var t=this.box;t.isEmpty()||(t.getCenter(this.position),t.getSize(this.scale),this.scale.multiplyScalar(.5),f(b(n.prototype),"updateMatrixWorld",this).call(this,e))}}]),n}(),Lg=exports.PlaneHelper=function(e){m(n,Wd);var t=y(n);function n(e){var r,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:16776960;A(this,n);var o=a,s=new Pa;s.setAttribute("position",new Sa([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)),s.computeBoundingSphere(),(r=t.call(this,s,new zd({color:o,toneMapped:!1}))).type="PlaneHelper",r.plane=e,r.size=i;var l=new Pa;return l.setAttribute("position",new Sa([1,1,1,-1,1,1,-1,-1,1,1,1,1,-1,-1,1,1,-1,1],3)),l.computeBoundingSphere(),r.add(new Ja(l,new ha({color:o,opacity:.2,transparent:!0,depthWrite:!1,toneMapped:!1}))),r}return E(n,[{key:"updateMatrixWorld",value: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?H:V,this.lookAt(this.plane.normal),f(b(n.prototype),"updateMatrixWorld",this).call(this,e)}}]),n}(),Rg=new Zr,Pg=exports.ArrowHelper=function(e){m(n,Ki);var t=y(n);function n(){var e,r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:new Zr(0,0,1),i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new Zr(0,0,0),a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1,o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:16776960,s=arguments.length>4&&void 0!==arguments[4]?arguments[4]:.2*a,l=arguments.length>5&&void 0!==arguments[5]?arguments[5]:.2*s;return A(this,n),(e=t.call(this)).type="ArrowHelper",void 0===Tg&&((Tg=new Pa).setAttribute("position",new Sa([0,0,0,0,1,0],3)),(Ag=new zp(0,.5,1,5,1)).translate(0,-.5,0)),e.position.copy(i),e.line=new Wd(Tg,new zd({color:o,toneMapped:!1})),e.line.matrixAutoUpdate=!1,e.add(e.line),e.cone=new Ja(Ag,new ha({color:o,toneMapped:!1})),e.cone.matrixAutoUpdate=!1,e.add(e.cone),e.setDirection(r),e.setLength(a,s,l),e}return E(n,[{key:"setDirection",value:function(e){if(e.y>.99999)this.quaternion.set(0,0,0,1);else if(e.y<-.99999)this.quaternion.set(1,0,0,0);else{Rg.set(e.z,0,-e.x).normalize();var t=Math.acos(e.y);this.quaternion.setFromAxisAngle(Rg,t)}}},{key:"setLength",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:.2*e,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:.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()}},{key:"setColor",value:function(e){this.line.material.color.set(e),this.cone.material.color.set(e)}},{key:"copy",value:function(e){return f(b(n.prototype),"copy",this).call(this,e,!1),this.line.copy(e.line),this.cone.copy(e.cone),this}}]),n}(),Ig=exports.AxesHelper=function(e){m(n,Xd);var t=y(n);function n(){var e,r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1;A(this,n);var i=[0,0,0,r,0,0,0,0,0,0,r,0,0,0,0,0,0,r],a=new Pa;a.setAttribute("position",new Sa(i,3)),a.setAttribute("color",new Sa([1,0,0,1,.6,0,0,1,0,.6,1,0,0,0,1,0,.6,1],3));var o=new zd({vertexColors:!0,toneMapped:!1});return(e=t.call(this,a,o)).type="AxesHelper",e}return E(n,[{key:"setColors",value:function(e,t,n){var r=new Nr,i=this.geometry.attributes.color.array;return r.set(e),r.toArray(i,0),r.toArray(i,3),r.set(t),r.toArray(i,6),r.toArray(i,9),r.set(n),r.toArray(i,12),r.toArray(i,15),this.geometry.attributes.color.needsUpdate=!0,this}},{key:"dispose",value:function(){this.geometry.dispose(),this.material.dispose()}}]),n}(),Dg=exports.ShapePath=function(){function e(){A(this,e),this.type="ShapePath",this.color=new Nr,this.subPaths=[],this.currentPath=null}return E(e,[{key:"moveTo",value:function(e,t){return this.currentPath=new Dp,this.subPaths.push(this.currentPath),this.currentPath.moveTo(e,t),this}},{key:"lineTo",value:function(e,t){return this.currentPath.lineTo(e,t),this}},{key:"quadraticCurveTo",value:function(e,t,n,r){return this.currentPath.quadraticCurveTo(e,t,n,r),this}},{key:"bezierCurveTo",value:function(e,t,n,r,i,a){return this.currentPath.bezierCurveTo(e,t,n,r,i,a),this}},{key:"splineThru",value:function(e){return this.currentPath.splineThru(e),this}},{key:"toShapes",value:function(e,t){function n(e){for(var t=[],n=0,r=e.length;nNumber.EPSILON){if(u<0&&(o=t[a],l=-l,s=t[i],u=-u),e.ys.y)continue;if(e.y===o.y){if(e.x===o.x)return!0}else{var c=u*(e.x-o.x)-l*(e.y-o.y);if(0===c)return!0;if(c<0)continue;r=!r}}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!0}}return r}var i,a,o,s=kf.isClockWise,l=this.subPaths;if(0===l.length)return[];if(!0===t)return n(l);var u=[];if(1===l.length)return a=l[0],(o=new Xp).curves=a.curves,u.push(o),u;var c=!s(l[0].getPoints());c=e?!c:c;var h,d,p=[],f=[],v=[],m=0;f[m]=void 0,v[m]=[];for(var g=0,y=l.length;g1){for(var x=!1,_=0,M=0,b=f.length;M0&&!1===x&&(v=p)}for(var L=0,R=f.length;L>-o-14,r[256|a]=1024>>-o-14|32768,i[a]=-o-1,i[256|a]=-o-1):o<=15?(r[a]=o+15<<10,r[256|a]=o+15<<10|32768,i[a]=13,i[256|a]=13):o<128?(r[a]=31744,r[256|a]=64512,i[a]=24,i[256|a]=24):(r[a]=31744,r[256|a]=64512,i[a]=13,i[256|a]=13)}for(var s=new Uint32Array(2048),l=new Uint32Array(64),u=new Uint32Array(64),c=1;c<1024;++c){for(var h=c<<13,d=0;0==(8388608&h);)h<<=1,d-=8388608;h&=-8388609,d+=947912704,s[c]=h|d}for(var p=1024;p<2048;++p)s[p]=939524096+(p-1024<<13);for(var f=1;f<31;++f)l[f]=f<<23;l[31]=1199570944,l[32]=2147483648;for(var v=33;v<63;++v)l[v]=2147483648+(v-32<<23);l[63]=3347054592;for(var m=1;m<64;++m)32!==m&&(u[m]=1024);return{floatView:t,uint32View:n,baseTable:r,shiftTable:i,mantissaTable:s,exponentTable:l,offsetTable:u}}function Wg(e){Math.abs(e)>65504&&console.warn("THREE.DataUtils.toHalfFloat(): Value out of range."),e=Jn(e,-65504,65504),Og[0]=e;var t=Fg[0],n=t>>23&511;return zg[n]+((8388607&t)>>Bg[n])}function jg(e){var t=e>>10;return Fg[0]=Ug[Vg[t]+(1023&e)]+Gg[t],Og[0]}var qg=exports.DataUtils=Object.freeze({__proto__:null,toHalfFloat:Wg,fromHalfFloat:jg}),Xg=exports.ParametricGeometry=function(e){m(n,Pa);var t=y(n);function n(){return A(this,n),console.error("THREE.ParametricGeometry has been moved to /examples/jsm/geometries/ParametricGeometry.js"),t.call(this)}return E(n)}(),Yg=exports.TextGeometry=function(e){m(n,Pa);var t=y(n);function n(){return A(this,n),console.error("THREE.TextGeometry has been moved to /examples/jsm/geometries/TextGeometry.js"),t.call(this)}return E(n)}();function Zg(){console.error("THREE.FontLoader has been moved to /examples/jsm/loaders/FontLoader.js")}function Jg(){console.error("THREE.Font has been moved to /examples/jsm/loaders/FontLoader.js")}function Kg(){console.error("THREE.ImmediateRenderObject has been removed.")}var Qg=exports.WebGLMultisampleRenderTarget=function(e){m(n,Vr);var t=y(n);function n(e,r,i){var a;return A(this,n),console.error('THREE.WebGLMultisampleRenderTarget has been removed. Use a normal render target and set the "samples" property to greater 0 to enable multisampling.'),(a=t.call(this,e,r,i)).samples=4,a}return E(n)}(),$g=exports.DataTexture2DArray=function(e){m(n,Hr);var t=y(n);function n(e,r,i,a){return A(this,n),console.warn("THREE.DataTexture2DArray has been renamed to DataArrayTexture."),t.call(this,e,r,i,a)}return E(n)}(),ey=exports.DataTexture3D=function(e){m(n,jr);var t=y(n);function n(e,r,i,a){return A(this,n),console.warn("THREE.DataTexture3D has been renamed to Data3DTexture."),t.call(this,e,r,i,a)}return E(n)}();"undefined"!=typeof __THREE_DEVTOOLS__&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("register",{detail:{revision:R}})),"undefined"!=typeof window&&(window.__THREE__?console.warn("WARNING: Multiple instances of Three.js being imported."):window.__THREE__=R); },{}],"AJno":[function(require,module,exports) { module.exports="#define GLSLIFY 1\nvarying vec2 vUv;\nuniform float time;\n\nvoid main() {\nvUv = uv;\n\ngl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);\n}"; },{}],"maiY":[function(require,module,exports) { module.exports="#define GLSLIFY 1\nvarying vec2 vUv;\nuniform float time;\nuniform sampler2D u_texture;\n\n// https://www.shadertoy.com/view/4djSRW\nfloat hash12(vec2 p){\n vec3 p3 = fract(vec3(p.xyx) * .1031);\n p3 += dot(p3, p3.yzx + 33.33);\n return fract((p3.x + p3.y) * p3.z);\n}\n\nvoid main() {\n vec2 uv = vUv;\n\n uv.x *= 3.142596;\n\n const float numbers = 9.0;\n\n vec2 repeat = vec2(6.0, 12.0);\n\n vec2 cell = (uv * repeat);\n\n cell.x *= numbers;\n cell = floor(cell);\n\n float rand = 100.0 * hash12(cell);\n\n float offset = mod(floor(time + rand), numbers) / numbers;\n uv = fract(uv * repeat);\n uv.x = fract(uv.x + offset);\n\n vec4 color = texture2D(u_texture, uv);\n\n color -= 0.05 * vec4(vec3(rand), 1.0);\n gl_FragColor = color;\n}"; },{}],"EU5I":[function(require,module,exports) { module.exports="/123.dc54f579.png"; },{}],"H99C":[function(require,module,exports) { "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=void 0,require("./styles.css");var e=a(require("three")),t=i(require("./shaders/vertex.glsl")),r=i(require("./shaders/fragment.glsl")),n=i(require("./123.png"));function i(e){return e&&e.__esModule?e:{default:e}}function o(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,r=new WeakMap;return(o=function(e){return e?r:t})(e)}function a(e,t){if(!t&&e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var r=o(t);if(r&&r.has(e))return r.get(e);var n={__proto__:null},i=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var a in e)if("default"!==a&&Object.prototype.hasOwnProperty.call(e,a)){var s=i?Object.getOwnPropertyDescriptor(e,a):null;s&&(s.get||s.set)?Object.defineProperty(n,a,s):n[a]=e[a]}return n.default=e,r&&r.set(e,n),n}function s(e){return(s="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function u(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&c(e,t)}function c(e,t){return(c=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e})(e,t)}function l(e){var t=d();return function(){var r,n=m(e);if(t){var i=m(this).constructor;r=Reflect.construct(n,arguments,i)}else r=n.apply(this,arguments);return h(this,r)}}function h(e,t){if(t&&("object"===s(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return f(e)}function f(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function d(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch(e){return!1}}function m(e){return(m=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function p(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function y(e,t){for(var r=0;r0&&void 0!==arguments[0]?arguments[0]:1;return p(this,n),(e=r.call(this)).scale=t,e}return v(n,[{key:"getPoint",value:function(t){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new e.Vector3,n=Math.cos(2*Math.PI*t),i=Math.sin(2*Math.PI*t),o=.1*Math.sin(8*Math.PI*t);return r.set(n,i,o).multiplyScalar(this.scale)}}]),n}())(10);this.geometry=new e.TubeGeometry(o,200,.5,20,!1),this.mesh=new e.Mesh(this.geometry,this.material),this.scene.add(this.mesh)}},{key:"render",value:function(){this.time=g;var e=this.time%1e4/1e4,t=this.geometry.parameters.path.getPointAt(e),r=this.geometry.tangents.length,n=e*r,i=Math.floor(n),o=(i+1)%r;this.binormal.subVectors(this.geometry.binormals[o],this.geometry.binormals[i]),this.binormal.multiplyScalar(n-i).add(this.geometry.binormals[i]);var a=this.geometry.parameters.path.getTangentAt(e);this.normal.copy(this.binormal).cross(a),t.add(this.normal.clone().multiplyScalar(0)),this.camera.position.copy(t);var s=this.geometry.parameters.path.getPointAt((e+1/this.geometry.parameters.path.getLength())%1);this.camera.matrix.lookAt(this.camera.position,s,this.normal),this.camera.rotation.setFromRotationMatrix(this.camera.matrix,this.camera.rotation.order),this.material.uniforms.time.value=this.clock.getElapsedTime(),requestAnimationFrame(this.render.bind(this)),this.renderer.render(this.scene,this.camera)}},{key:"resize",value:function(){this.width=this.container.offsetWidth,this.height=this.container.offsetHeight,this.renderer.setSize(this.width,this.height),this.camera.aspect=this.width/this.height,this.camera.updateProjectionMatrix()}},{key:"setUpResize",value:function(){window.addEventListener("resize",this.resize.bind(this))}}]),i}();new O({domElement:document.getElementById("container")}),window.addEventListener("mousedown",function(e){P=!0}),window.addEventListener("mouseup",function(e){P=!1}),window.addEventListener("mousemove",function(e){P&&(g+=10*(e.clientY/window.innerHeight*2-1)),g<=0&&(g=0)}),setInterval(function(){g+=1},10); },{"./styles.css":"D9Nj","three":"gBK8","./shaders/vertex.glsl":"AJno","./shaders/fragment.glsl":"maiY","./123.png":"EU5I"}]},{},["H99C"], null) //# sourceMappingURL=/src.5600be97.js.map