PageSourceSearch

https://bhutan.travel/_next/static/chunks/fb7d5399.9de3891252985852.js

js bhutan.travel collected 2026-09-24 19:08:48 UTC 477,689 bytes, 186 lines download raw bytes

1"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[3737],{9477:function(e,t,i){i.d(t,{$V:function(){return sk},CP7:function(){return rb},D1R:function(){return x},EJi:function(){return aV},F5T:function(){return tM},FM8:function(){return j},IOt:function(){return E},Ilk:function(){return ea},Kj0:function(){return t0},Ltg:function(){return ed},M8C:function(){return W},Mig:function(){return sM},N$j:function(){return rN},NMF:function(){return M},OdW:function(){return rF},OoA:function(){return p},Ox3:function(){return sy},PMe:function(){return sp},Pa4:function(){return eg},QRU:function(){return sS},QmN:function(){return r},RsA:function(){return n},SUY:function(){return sw},Syv:function(){return y},TUj:function(){return sG},TUv:function(){return rI},T_1:function(){return sH},TlE:function(){return tT},Tme:function(){return tl},TyD:function(){return f},UY4:function(){return rJ},UlW:function(){return b},Vkp:function(){return q},WMw:function(){return h},Wid:function(){return ak},Wl3:function(){return s},YGz:function(){return u},YLQ:function(){return m},ZAu:function(){return rm},Zp0:function(){return sb},ZzF:function(){return ex},_12:function(){return id},_C8:function(){return aY},_Li:function(){return o},_fP:function(){return em},a$l:function(){return tC},aH4:function(){return g},aLr:function(){return eF},aNw:function(){return se},blk:function(){return rZ},bnF:function(){return au},cPb:function(){return t8},cek:function(){return s_},dUE:function(){return a1},dd2:function(){return ep},dpR:function(){return sa},ehD:function(){return l},ejS:function(){return rY},hH6:function(){return sn},iDF:function(){return az},iKG:function(){return iS},iLg:function(){return a2},iMs:function(){return sU},iUV:function(){return sz},jyz:function(){return t6},kB5:function(){return rA},knz:function(){return w},lRF:function(){return rl},m7l:function(){return a6},mSO:function(){return T},nls:function(){return rB},ntZ:function(){return a},pBf:function(){return P},qyh:function(){return _},rDY:function(){return t5},rpg:function(){return c},u9r:function(){return tz},uWy:function(){return d},vBJ:function(){return tb},vmT:function(){return so},vpT:function(){return rT},wem:function(){return v},woe:function(){return r1},x12:function(){return rj},xEZ:function(){return ec},xo$:function(){return aB},xsS:function(){return rw},y$t:function(){return ah},yC1:function(){return a5},yGw:function(){return eX},ybr:function(){return rS},z$h:function(){return S}});let n={LEFT:0,MIDDLE:1,RIGHT:2,ROTATE:0,DOLLY:1,PAN:2},r={ROTATE:0,PAN:1,DOLLY_PAN:2,DOLLY_ROTATE:3},a=2,s=0,o=1,l=2,h=2,u=3,c=1e3,d=1001,p=1002,f=1003,m=1004,g=1005,v=1006,_=1007,x=1008,y=2300,M=2301,b=1,S=2,w=3001,T=3201,E=0,A="srgb",C="srgb-linear",L="300 es";class P{addEventListener(e,t){void 0===this._listeners&&(this._listeners={});let i=this._listeners;void 0===i[e]&&(i[e]=[]),-1===i[e].indexOf(t)&&i[e].push(t)}hasEventListener(e,t){if(void 0===this._listeners)return!1;let i=this._listeners;return void 0!==i[e]&&-1!==i[e].indexOf(t)}removeEventListener(e,t){if(void 0===this._listeners)return;let i=this._listeners,n=i[e];if(void 0!==n){let r=n.indexOf(t);-1!==r&&n.splice(r,1)}}dispatchEvent(e){if(void 0===this._listeners)return;let t=this._listeners,i=t[e.type];if(void 0!==i){e.target=this;let n=i.slice(0);for(let r=0,a=n.length;r<a;r++)n[r].call(this,e);e.target=null}}}let R=["00","01","02","03","04","05","06","07","08","09","0a","0b","0c","0d","0e","0f","10","11","12","13","14","15","16","17","18","19","1a","1b","1c","1d","1e","1f","20","21","22","23","24","25","26","27","28","29","2a","2b","2c","2d","2e","2f","30","31","32","33","34","35","36","37","38","39","3a","3b","3c","3d","3e","3f","40","41","42","43","44","45","46","47","48","49","4a","4b","4c","4d","4e","4f","50","51","52","53","54","55","56","57","58","59","5a","5b","5c","5d","5e","5f","60","61","62","63","64","65","66","67","68","69","6a","6b","6c","6d","6e","6f","70","71","72","73","74","75","76","77","78","79","7a","7b","7c","7d","7e","7f","80","81","82","83","84","85","86","87","88","89","8a","8b","8c","8d","8e","8f","90","91","92","93","94","95","96","97","98","99","9a","9b","9c","9d","9e","9f","a0","a1","a2","a3","a4","a5","a6","a7","a8","a9","aa","ab","ac","ad","ae","af","b0","b1","b2","b3","b4","b5","b6","b7","b8","b9","ba","bb","bc","bd","be","bf","c0","c1","c2","c3","c4","c5","c6","c7","c8","c9","ca","cb","cc","cd","ce","cf","d0","d1","d2","d3","d4","d5","d6","d7","d8","d9","da","db","dc","dd","de","df","e0","e1","e2","e3","e4","e5","e6","e7","e8","e9","ea","eb","ec","ed","ee","ef","f0","f1","f2","f3","f4","f5","f6","f7","f8","f9","fa","fb","fc","fd","fe","ff"],D=1234567,I=Math.PI/180,N=180/Math.PI;function O(){let e=4294967295*Math.random()|0,t=4294967295*Math.random()|0,i=4294967295*Math.random()|0,n=4294967295*Math.random()|0,r=R[255&e]+R[e>>8&255]+R[e>>16&255]+R[e>>24&255]+"-"+R[255&t]+R[t>>8&255]+"-"+R[t>>16&15|64]+R[t>>24&255]+"-"+R[63&i|128]+R[i>>8&255]+"-"+R[i>>16&255]+R[i>>24&255]+R[255&n]+R[n>>8&255]+R[n>>16&255]+R[n>>24&255];return r.toLowerCase()}function z(e,t,i){return Math.max(t,Math.min(i,e))}function U(e,t){return(e%t+t)%t}function F(e,t,i){return(1-i)*e+i*t}function B(e){return e*I}function k(e){return e*N}function V(e){return(e&e-1)==0&&0!==e}function G(e){return Math.pow(2,Math.ceil(Math.log(e)/Math.LN2))}function H(e){return Math.pow(2,Math.floor(Math.log(e)/Math.LN2))}var W=Object.freeze({__proto__:null,DEG2RAD:I,RAD2DEG:N,generateUUID:O,clamp:z,euclideanModulo:U,mapLinear:function(e,t,i,n,r){return n+(e-t)*(r-n)/(i-t)},inverseLerp:function(e,t,i){return e!==t?(i-e)/(t-e):0},lerp:F,damp:function(e,t,i,n){return F(e,t,1-Math.exp(-i*n))},pingpong:function(e,t=1){return t-Math.abs(U(e,2*t)-t)},smoothstep:function(e,t,i){return e<=t?0:e>=i?1:(e=(e-t)/(i-t))*e*(3-2*e)},smootherstep:function(e,t,i){return e<=t?0:e>=i?1:(e=(e-t)/(i-t))*e*e*(e*(6*e-15)+10)},randInt:function(e,t){return e+Math.floor(Math.random()*(t-e+1))},randFloat:function(e,t){return e+Math.random()*(t-e)},randFloatSpread:function(e){return e*(.5-Math.random())},seededRandom:function(e){void 0!==e&&(D=e);let t=D+=1831565813;return t=Math.imul(t^t>>>15,1|t),(((t^=t+Math.imul(t^t>>>7,61|t))^t>>>14)>>>0)/4294967296},degToRad:B,radToDeg:k,isPowerOfTwo:V,ceilPowerOfTwo:G,floorPowerOfTwo:H,setQuaternionFromProperEuler:function(e,t,i,n,r){let a=Math.cos,s=Math.sin,o=a(i/2),l=s(i/2),h=a((t+n)/2),u=s((t+n)/2),c=a((t-n)/2),d=s((t-n)/2),p=a((n-t)/2),f=s((n-t)/2);switch(r){case"XYX":e.set(o*u,l*c,l*d,o*h);break;case"YZY":e.set(l*d,o*u,l*c,o*h);break;case"ZXZ":e.set(l*c,l*d,o*u,o*h);break;case"XZX":e.set(o*u,l*f,l*p,o*h);break;case"YXY":e.set(l*p,o*u,l*f,o*h);break;case"ZYZ":e.set(l*f,l*p,o*u,o*h);break;default:console.warn("THREE.MathUtils: .setQuaternionFromProperEuler() encountered an unknown order: "+r)}},normalize:function(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 Error("Invalid component type.")}},denormalize:function(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 Error("Invalid component type.")}}});
vendor: 5,565 bytes, line 1
1class j{constructor(e=0,t=0){j.prototype.isVector2=!0,this.x=e,this.y=t}get width(){return this.x}set width(e){this.x=e}get height(){return this.y}set height(e){this.y=e}set(e,t){return this.x=e,this.y=t,this}setScalar(e){return this.x=e,this.y=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;default:throw Error("index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;default:throw Error("index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y)}copy(e){return this.x=e.x,this.y=e.y,this}add(e){return this.x+=e.x,this.y+=e.y,this}addScalar(e){return this.x+=e,this.y+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this}sub(e){return this.x-=e.x,this.y-=e.y,this}subScalar(e){return this.x-=e,this.y-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this}multiply(e){return this.x*=e.x,this.y*=e.y,this}multiplyScalar(e){return this.x*=e,this.y*=e,this}divide(e){return this.x/=e.x,this.y/=e.y,this}divideScalar(e){return this.multiplyScalar(1/e)}applyMatrix3(e){let t=this.x,i=this.y,n=e.elements;return this.x=n[0]*t+n[3]*i+n[6],this.y=n[1]*t+n[4]*i+n[7],this}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this}clamp(e,t){return this.x=Math.max(e.x,Math.min(t.x,this.x)),this.y=Math.max(e.y,Math.min(t.y,this.y)),this}clampScalar(e,t){return this.x=Math.max(e,Math.min(t,this.x)),this.y=Math.max(e,Math.min(t,this.y)),this}clampLength(e,t){let i=this.length();return this.divideScalar(i||1).multiplyScalar(Math.max(e,Math.min(t,i)))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}roundToZero(){return this.x=this.x<0?Math.ceil(this.x):Math.floor(this.x),this.y=this.y<0?Math.ceil(this.y):Math.floor(this.y),this}negate(){return this.x=-this.x,this.y=-this.y,this}dot(e){return this.x*e.x+this.y*e.y}cross(e){return this.x*e.y-this.y*e.x}lengthSq(){return this.x*this.x+this.y*this.y}length(){return Math.sqrt(this.x*this.x+this.y*this.y)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)}normalize(){return this.divideScalar(this.length()||1)}angle(){let e=Math.atan2(-this.y,-this.x)+Math.PI;return e}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){let t=this.x-e.x,i=this.y-e.y;return t*t+i*i}manhattanDistanceTo(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this}lerpVectors(e,t,i){return this.x=e.x+(t.x-e.x)*i,this.y=e.y+(t.y-e.y)*i,this}equals(e){return e.x===this.x&&e.y===this.y}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this}rotateAround(e,t){let i=Math.cos(t),n=Math.sin(t),r=this.x-e.x,a=this.y-e.y;return this.x=r*i-a*n+e.x,this.y=r*n+a*i+e.y,this}random(){return this.x=Math.random(),this.y=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y}}class q{constructor(){q.prototype.isMatrix3=!0,this.elements=[1,0,0,0,1,0,0,0,1]}set(e,t,i,n,r,a,s,o,l){let h=this.elements;return h[0]=e,h[1]=n,h[2]=s,h[3]=t,h[4]=r,h[5]=o,h[6]=i,h[7]=a,h[8]=l,this}identity(){return this.set(1,0,0,0,1,0,0,0,1),this}copy(e){let t=this.elements,i=e.elements;return t[0]=i[0],t[1]=i[1],t[2]=i[2],t[3]=i[3],t[4]=i[4],t[5]=i[5],t[6]=i[6],t[7]=i[7],t[8]=i[8],this}extractBasis(e,t,i){return e.setFromMatrix3Column(this,0),t.setFromMatrix3Column(this,1),i.setFromMatrix3Column(this,2),this}setFromMatrix4(e){let t=e.elements;return this.set(t[0],t[4],t[8],t[1],t[5],t[9],t[2],t[6],t[10]),this}multiply(e){return this.multiplyMatrices(this,e)}premultiply(e){return this.multiplyMatrices(e,this)}multiplyMatrices(e,t){let i=e.elements,n=t.elements,r=this.elements,a=i[0],s=i[3],o=i[6],l=i[1],h=i[4],u=i[7],c=i[2],d=i[5],p=i[8],f=n[0],m=n[3],g=n[6],v=n[1],_=n[4],x=n[7],y=n[2],M=n[5],b=n[8];return r[0]=a*f+s*v+o*y,r[3]=a*m+s*_+o*M,r[6]=a*g+s*x+o*b,r[1]=l*f+h*v+u*y,r[4]=l*m+h*_+u*M,r[7]=l*g+h*x+u*b,r[2]=c*f+d*v+p*y,r[5]=c*m+d*_+p*M,r[8]=c*g+d*x+p*b,this}multiplyScalar(e){let t=this.elements;return t[0]*=e,t[3]*=e,t[6]*=e,t[1]*=e,t[4]*=e,t[7]*=e,t[2]*=e,t[5]*=e,t[8]*=e,this}determinant(){let e=this.elements,t=e[0],i=e[1],n=e[2],r=e[3],a=e[4],s=e[5],o=e[6],l=e[7],h=e[8];return t*a*h-t*s*l-i*r*h+i*s*o+n*r*l-n*a*o}invert(){let e=this.elements,t=e[0],i=e[1],n=e[2],r=e[3],a=e[4],s=e[5],o=e[6],l=e[7],h=e[8],u=h*a-s*l,c=s*o-h*r,d=l*r-a*o,p=t*u+i*c+n*d;if(0===p)return this.set(0,0,0,0,0,0,0,0,0);let f=1/p;return e[0]=u*f,e[1]=(n*l-h*i)*f,e[2]=(s*i-n*a)*f,e[3]=c*f,e[4]=(h*t-n*o)*f,e[5]=(n*r-s*t)*f,e[6]=d*f,e[7]=(i*o-l*t)*f,e[8]=(a*t-i*r)*f,this}transpose(){let e,t=this.elements;return e=t[1],t[1]=t[3],t[3]=e,e=t[2],t[2]=t[6],t[6]=e,e=t[5],t[5]=t[7],t[7]=e,this}getNormalMatrix(e){return this.setFromMatrix4(e).invert().transpose()}transposeIntoArray(e){let t=this.elements;return e[0]=t[0],e[1]=t[3],e[2]=t[6],e[3]=t[1],e[4]=t[4],e[5]=t[7],e[6]=t[2],e[7]=t[5],e[8]=t[8],this}setUvTransform(e,t,i,n,r,a,s){let o=Math.cos(r),l=Math.sin(r);return this.set(i*o,i*l,-i*(o*a+l*s)+a+e,-n*l,n*o,-n*(-l*a+o*s)+s+t,0,0,1),this}scale(e,t){let i=this.elements;
1return i[0]*=e,i[3]*=e,i[6]*=e,i[1]*=t,i[4]*=t,i[7]*=t,this}rotate(e){let t=Math.cos(e),i=Math.sin(e),n=this.elements,r=n[0],a=n[3],s=n[6],o=n[1],l=n[4],h=n[7];return n[0]=t*r+i*o,n[3]=t*a+i*l,n[6]=t*s+i*h,n[1]=-i*r+t*o,n[4]=-i*a+t*l,n[7]=-i*s+t*h,this}translate(e,t){let i=this.elements;return i[0]+=e*i[2],i[3]+=e*i[5],i[6]+=e*i[8],i[1]+=t*i[2],i[4]+=t*i[5],i[7]+=t*i[8],this}equals(e){let t=this.elements,i=e.elements;for(let n=0;n<9;n++)if(t[n]!==i[n])return!1;return!0}fromArray(e,t=0){for(let i=0;i<9;i++)this.elements[i]=e[i+t];return this}toArray(e=[],t=0){let i=this.elements;return e[t]=i[0],e[t+1]=i[1],e[t+2]=i[2],e[t+3]=i[3],e[t+4]=i[4],e[t+5]=i[5],e[t+6]=i[6],e[t+7]=i[7],e[t+8]=i[8],e}clone(){return new this.constructor().fromArray(this.elements)}}function X(e){for(let t=e.length-1;t>=0;--t)if(e[t]>65535)return!0;return!1}function Y(e){return document.createElementNS("http://www.w3.org/1999/xhtml",e)}function Z(e){return e<.04045?.0773993808*e:Math.pow(.9478672986*e+.0521327014,2.4)}function J(e){return e<.0031308?12.92*e:1.055*Math.pow(e,.41666)-.055}Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array;let K={[A]:{[C]:Z},[C]:{[A]:J}},Q={legacyMode:!0,get workingColorSpace(){return C},set workingColorSpace(colorSpace){console.warn("THREE.ColorManagement: .workingColorSpace is readonly.")},convert:function(e,t,i){if(this.legacyMode||t===i||!t||!i)return e;if(K[t]&&void 0!==K[t][i]){let n=K[t][i];return e.r=n(e.r),e.g=n(e.g),e.b=n(e.b),e}throw 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)}},$={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},ee={r:0,g:0,b:0},et={h:0,s:0,l:0},ei={h:0,s:0,l:0};function en(e,t,i){return(i<0&&(i+=1),i>1&&(i-=1),i<1/6)?e+(t-e)*6*i:i<.5?t:i<2/3?e+(t-e)*6*(2/3-i):e}function er(e,t){return t.r=e.r,t.g=e.g,t.b=e.b,t}class ea{constructor(e,t,i){if(this.isColor=!0,this.r=1,this.g=1,this.b=1,void 0===t&&void 0===i)return this.set(e);return this.setRGB(e,t,i)}set(e){return e&&e.isColor?this.copy(e):"number"==typeof e?this.setHex(e):"string"==typeof e&&this.setStyle(e),this}setScalar(e){return this.r=e,this.g=e,this.b=e,this}setHex(e,t=A){return e=Math.floor(e),this.r=(e>>16&255)/255,this.g=(e>>8&255)/255,this.b=(255&e)/255,Q.toWorkingColorSpace(this,t),this}setRGB(e,t,i,n=C){return this.r=e,this.g=t,this.b=i,Q.toWorkingColorSpace(this,n),this}setHSL(e,t,i,n=C){if(e=U(e,1),t=z(t,0,1),i=z(i,0,1),0===t)this.r=this.g=this.b=i;else{let r=i<=.5?i*(1+t):i+t-i*t,a=2*i-r;this.r=en(a,r,e+1/3),this.g=en(a,r,e),this.b=en(a,r,e-1/3)}return Q.toWorkingColorSpace(this,n),this}setStyle(e,t=A){function i(t){void 0!==t&&1>parseFloat(t)&&console.warn("THREE.Color: Alpha component of "+e+" will be ignored.")}let n;if(n=/^((?:rgb|hsl)a?)\(([^\)]*)\)/.exec(e)){let r,a=n[1],s=n[2];switch(a){case"rgb":case"rgba":if(r=/^\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(s))return this.r=Math.min(255,parseInt(r[1],10))/255,this.g=Math.min(255,parseInt(r[2],10))/255,this.b=Math.min(255,parseInt(r[3],10))/255,Q.toWorkingColorSpace(this,t),i(r[4]),this;if(r=/^\s*(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(s))return this.r=Math.min(100,parseInt(r[1],10))/100,this.g=Math.min(100,parseInt(r[2],10))/100,this.b=Math.min(100,parseInt(r[3],10))/100,Q.toWorkingColorSpace(this,t),i(r[4]),this;break;case"hsl":case"hsla":if(r=/^\s*(\d*\.?\d+)\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(s)){let o=parseFloat(r[1])/360,l=parseInt(r[2],10)/100,h=parseInt(r[3],10)/100;return i(r[4]),this.setHSL(o,l,h,t)}}}else if(n=/^\#([A-Fa-f\d]+)$/.exec(e)){let u=n[1],c=u.length;if(3===c)return this.r=parseInt(u.charAt(0)+u.charAt(0),16)/255,this.g=parseInt(u.charAt(1)+u.charAt(1),16)/255,this.b=parseInt(u.charAt(2)+u.charAt(2),16)/255,Q.toWorkingColorSpace(this,t),this;if(6===c)return this.r=parseInt(u.charAt(0)+u.charAt(1),16)/255,this.g=parseInt(u.charAt(2)+u.charAt(3),16)/255,this.b=parseInt(u.charAt(4)+u.charAt(5),16)/255,Q.toWorkingColorSpace(this,t),this}return e&&e.length>0?this.setColorName(e,t):this}setColorName(e,t=A){let i=$[e.toLowerCase()];return void 0!==i?this.setHex(i,t):console.warn("THREE.Color: Unknown color "+e),this}clone(){return new this.constructor(this.r,this.g,this.b)}copy(e){return this.r=e.r,this.g=e.g,this.b=e.b,this}copySRGBToLinear(e){return this.r=Z(e.r),this.g=Z(e.g),this.b=Z(e.b),this}copyLinearToSRGB(e){return this.r=J(e.r),this.g=J(e.g),this.b=J(e.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}getHex(e=A){return Q.fromWorkingColorSpace(er(this,ee),e),z(255*ee.r,0,255)<<16^z(255*ee.g,0,255)<<8^z(255*ee.b,0,255)<<0}getHexString(e=A){return("000000"+this.getHex(e).toString(16)).slice(-6)}getHSL(e,t=C){Q.fromWorkingColorSpace(er(this,ee),t);let i=ee.r,n=ee.g,r=ee.b,a=Math.max(i,n,r),s=Math.min(i,n,r),o,l,h=(s+a)/2;if(s===a)o=0,l=0;else{let u=a-s;switch(l=h<=.5?u/(a+s):u/(2-a-s),a){case i:o=(n-r)/u+(n<r?6:0);break;case n:o=(r-i)/u+2;break;case r:o=(i-n)/u+4}o/=6}return e.h=o,e.s=l,e.l=h,e}getRGB(e,t=C){return Q.fromWorkingColorSpace(er(this,ee),t),e.r=ee.r,e.g=ee.g,e.b
1=ee.b,e}getStyle(e=A){return(Q.fromWorkingColorSpace(er(this,ee),e),e!==A)?`color(${e} ${ee.r} ${ee.g} ${ee.b})`:`rgb(${255*ee.r|0},${255*ee.g|0},${255*ee.b|0})`}offsetHSL(e,t,i){return this.getHSL(et),et.h+=e,et.s+=t,et.l+=i,this.setHSL(et.h,et.s,et.l),this}add(e){return this.r+=e.r,this.g+=e.g,this.b+=e.b,this}addColors(e,t){return this.r=e.r+t.r,this.g=e.g+t.g,this.b=e.b+t.b,this}addScalar(e){return this.r+=e,this.g+=e,this.b+=e,this}sub(e){return this.r=Math.max(0,this.r-e.r),this.g=Math.max(0,this.g-e.g),this.b=Math.max(0,this.b-e.b),this}multiply(e){return this.r*=e.r,this.g*=e.g,this.b*=e.b,this}multiplyScalar(e){return this.r*=e,this.g*=e,this.b*=e,this}lerp(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}lerpColors(e,t,i){return this.r=e.r+(t.r-e.r)*i,this.g=e.g+(t.g-e.g)*i,this.b=e.b+(t.b-e.b)*i,this}lerpHSL(e,t){this.getHSL(et),e.getHSL(ei);let i=F(et.h,ei.h,t),n=F(et.s,ei.s,t),r=F(et.l,ei.l,t);return this.setHSL(i,n,r),this}equals(e){return e.r===this.r&&e.g===this.g&&e.b===this.b}fromArray(e,t=0){return this.r=e[t],this.g=e[t+1],this.b=e[t+2],this}toArray(e=[],t=0){return e[t]=this.r,e[t+1]=this.g,e[t+2]=this.b,e}fromBufferAttribute(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}toJSON(){return this.getHex()}*[Symbol.iterator](){yield this.r,yield this.g,yield this.b}}ea.NAMES=$;let es;class eo{static getDataURL(e){if(/^data:/i.test(e.src)||"undefined"==typeof HTMLCanvasElement)return e.src;let t;if(e instanceof HTMLCanvasElement)t=e;else{void 0===es&&(es=Y("canvas")),es.width=e.width,es.height=e.height;let i=es.getContext("2d");e instanceof ImageData?i.putImageData(e,0,0):i.drawImage(e,0,0,e.width,e.height),t=es}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")}static sRGBToLinear(e){if("undefined"!=typeof HTMLImageElement&&e instanceof HTMLImageElement||"undefined"!=typeof HTMLCanvasElement&&e instanceof HTMLCanvasElement||"undefined"!=typeof ImageBitmap&&e instanceof ImageBitmap){let t=Y("canvas");t.width=e.width,t.height=e.height;let i=t.getContext("2d");i.drawImage(e,0,0,e.width,e.height);let n=i.getImageData(0,0,e.width,e.height),r=n.data;for(let a=0;a<r.length;a++)r[a]=255*Z(r[a]/255);return i.putImageData(n,0,0),t}if(!e.data)return console.warn("THREE.ImageUtils.sRGBToLinear(): Unsupported image type. No color space conversion applied."),e;{let s=e.data.slice(0);for(let o=0;o<s.length;o++)s instanceof Uint8Array||s instanceof Uint8ClampedArray?s[o]=Math.floor(255*Z(s[o]/255)):s[o]=Z(s[o]);return{data:s,width:e.width,height:e.height}}}}class el{constructor(e=null){this.isSource=!0,this.uuid=O(),this.data=e,this.version=0}set needsUpdate(e){!0===e&&this.version++}toJSON(e){let t=void 0===e||"string"==typeof e;if(!t&&void 0!==e.images[this.uuid])return e.images[this.uuid];let i={uuid:this.uuid,url:""},n=this.data;if(null!==n){let r;if(Array.isArray(n)){r=[];for(let a=0,s=n.length;a<s;a++)n[a].isDataTexture?r.push(eh(n[a].image)):r.push(eh(n[a]))}else r=eh(n);i.url=r}return t||(e.images[this.uuid]=i),i}}function eh(e){return"undefined"!=typeof HTMLImageElement&&e instanceof HTMLImageElement||"undefined"!=typeof HTMLCanvasElement&&e instanceof HTMLCanvasElement||"undefined"!=typeof ImageBitmap&&e instanceof ImageBitmap?eo.getDataURL(e):e.data?{data:Array.from(e.data),width:e.width,height:e.height,type:e.data.constructor.name}:(console.warn("THREE.Texture: Unable to serialize Texture."),{})}let eu=0;class ec extends P{constructor(e=ec.DEFAULT_IMAGE,t=ec.DEFAULT_MAPPING,i=d,n=d,r=v,a=x,s=1023,o=1009,l=1,h=3e3){super(),this.isTexture=!0,Object.defineProperty(this,"id",{value:eu++}),this.uuid=O(),this.name="",this.source=new el(e),this.mipmaps=[],this.mapping=t,this.wrapS=i,this.wrapT=n,this.magFilter=r,this.minFilter=a,this.anisotropy=l,this.format=s,this.internalFormat=null,this.type=o,this.offset=new j(0,0),this.repeat=new j(1,1),this.center=new j(0,0),this.rotation=0,this.matrixAutoUpdate=!0,this.matrix=new q,this.generateMipmaps=!0,this.premultiplyAlpha=!1,this.flipY=!0,this.unpackAlignment=4,this.encoding=h,this.userData={},this.version=0,this.onUpdate=null,this.isRenderTargetTexture=!1,this.needsPMREMUpdate=!1}get image(){return this.source.data}set image(e){this.source.data=e}updateMatrix(){this.matrix.setUvTransform(this.offset.x,this.offset.y,this.repeat.x,this.repeat.y,this.rotation,this.center.x,this.center.y)}clone(){return new this.constructor().copy(this)}copy(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}toJSON(e){let t=void 0===e||"string"==typeof e;if(!t&&void 0!==e.textures[this.uuid])return e.textures[this.uuid];let i={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.t
1ype,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)&&(i.userData=this.userData),t||(e.textures[this.uuid]=i),i}dispose(){this.dispatchEvent({type:"dispose"})}transformUv(e){if(300!==this.mapping)return e;if(e.applyMatrix3(this.matrix),e.x<0||e.x>1)switch(this.wrapS){case c:e.x=e.x-Math.floor(e.x);break;case d:e.x=e.x<0?0:1;break;case p: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 c:e.y=e.y-Math.floor(e.y);break;case d:e.y=e.y<0?0:1;break;case p: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}set needsUpdate(e){!0===e&&(this.version++,this.source.needsUpdate=!0)}}ec.DEFAULT_IMAGE=null,ec.DEFAULT_MAPPING=300;class ed{constructor(e=0,t=0,i=0,n=1){ed.prototype.isVector4=!0,this.x=e,this.y=t,this.z=i,this.w=n}get width(){return this.z}set width(e){this.z=e}get height(){return this.w}set height(e){this.w=e}set(e,t,i,n){return this.x=e,this.y=t,this.z=i,this.w=n,this}setScalar(e){return this.x=e,this.y=e,this.z=e,this.w=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setZ(e){return this.z=e,this}setW(e){return this.w=e,this}setComponent(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 Error("index is out of range: "+e)}return this}getComponent(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 Error("index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y,this.z,this.w)}copy(e){return this.x=e.x,this.y=e.y,this.z=e.z,this.w=void 0!==e.w?e.w:1,this}add(e){return this.x+=e.x,this.y+=e.y,this.z+=e.z,this.w+=e.w,this}addScalar(e){return this.x+=e,this.y+=e,this.z+=e,this.w+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this.z=e.z+t.z,this.w=e.w+t.w,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this.z+=e.z*t,this.w+=e.w*t,this}sub(e){return this.x-=e.x,this.y-=e.y,this.z-=e.z,this.w-=e.w,this}subScalar(e){return this.x-=e,this.y-=e,this.z-=e,this.w-=e,this}subVectors(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}multiply(e){return this.x*=e.x,this.y*=e.y,this.z*=e.z,this.w*=e.w,this}multiplyScalar(e){return this.x*=e,this.y*=e,this.z*=e,this.w*=e,this}applyMatrix4(e){let t=this.x,i=this.y,n=this.z,r=this.w,a=e.elements;return this.x=a[0]*t+a[4]*i+a[8]*n+a[12]*r,this.y=a[1]*t+a[5]*i+a[9]*n+a[13]*r,this.z=a[2]*t+a[6]*i+a[10]*n+a[14]*r,this.w=a[3]*t+a[7]*i+a[11]*n+a[15]*r,this}divideScalar(e){return this.multiplyScalar(1/e)}setAxisAngleFromQuaternion(e){this.w=2*Math.acos(e.w);let t=Math.sqrt(1-e.w*e.w);return t<1e-4?(this.x=1,this.y=0,this.z=0):(this.x=e.x/t,this.y=e.y/t,this.z=e.z/t),this}setAxisAngleFromRotationMatrix(e){let t,i,n,r,a=e.elements,s=a[0],o=a[4],l=a[8],h=a[1],u=a[5],c=a[9],d=a[2],p=a[6],f=a[10];if(.01>Math.abs(o-h)&&.01>Math.abs(l-d)&&.01>Math.abs(c-p)){if(.1>Math.abs(o+h)&&.1>Math.abs(l+d)&&.1>Math.abs(c+p)&&.1>Math.abs(s+u+f-3))return this.set(1,0,0,0),this;t=Math.PI;let m=(s+1)/2,g=(u+1)/2,v=(f+1)/2,_=(o+h)/4,x=(l+d)/4,y=(c+p)/4;return m>g&&m>v?m<.01?(i=0,n=.707106781,r=.707106781):(n=_/(i=Math.sqrt(m)),r=x/i):g>v?g<.01?(i=.707106781,n=0,r=.707106781):(i=_/(n=Math.sqrt(g)),r=y/n):v<.01?(i=.707106781,n=.707106781,r=0):(i=x/(r=Math.sqrt(v)),n=y/r),this.set(i,n,r,t),this}let M=Math.sqrt((p-c)*(p-c)+(l-d)*(l-d)+(h-o)*(h-o));return .001>Math.abs(M)&&(M=1),this.x=(p-c)/M,this.y=(l-d)/M,this.z=(h-o)/M,this.w=Math.acos((s+u+f-1)/2),this}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this.z=Math.min(this.z,e.z),this.w=Math.min(this.w,e.w),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this.z=Math.max(this.z,e.z),this.w=Math.max(this.w,e.w),this}clamp(e,t){return this.x=Math.max(e.x,Math.min(t.x,this.x)),this.y=Math.max(e.y,Math.min(t.y,this.y)),this.z=Math.max(e.z,Math.min(t.z,this.z)),this.w=Math.max(e.w,Math.min(t.w,this.w)),this}clampScalar(e,t){return this.x=Math.max(e,Math.min(t,this.x)),this.y=Math.max(e,Math.min(t,this.y)),this.z=Math.max(e,Math.min(t,this.z)),this.w=Math.max(e,Math.min(t,this.w)),this}clampLength(e,t){let i=this.length();return this.divideScalar(i||1).multiplyScalar(Math.max(e,Math.min(t,i)))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this.w=Math.floor(this.w),this}ceil(){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}
1round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this.w=Math.round(this.w),this}roundToZero(){return this.x=this.x<0?Math.ceil(this.x):Math.floor(this.x),this.y=this.y<0?Math.ceil(this.y):Math.floor(this.y),this.z=this.z<0?Math.ceil(this.z):Math.floor(this.z),this.w=this.w<0?Math.ceil(this.w):Math.floor(this.w),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this.w=-this.w,this}dot(e){return this.x*e.x+this.y*e.y+this.z*e.z+this.w*e.w}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)+Math.abs(this.w)}normalize(){return this.divideScalar(this.length()||1)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this.z+=(e.z-this.z)*t,this.w+=(e.w-this.w)*t,this}lerpVectors(e,t,i){return this.x=e.x+(t.x-e.x)*i,this.y=e.y+(t.y-e.y)*i,this.z=e.z+(t.z-e.z)*i,this.w=e.w+(t.w-e.w)*i,this}equals(e){return e.x===this.x&&e.y===this.y&&e.z===this.z&&e.w===this.w}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this.z=e[t+2],this.w=e[t+3],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e[t+2]=this.z,e[t+3]=this.w,e}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this.z=e.getZ(t),this.w=e.getW(t),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this.w=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z,yield this.w}}class ep extends P{constructor(e,t,i={}){super(),this.isWebGLRenderTarget=!0,this.width=e,this.height=t,this.depth=1,this.scissor=new ed(0,0,e,t),this.scissorTest=!1,this.viewport=new ed(0,0,e,t),this.texture=new ec({width:e,height:t,depth:1},i.mapping,i.wrapS,i.wrapT,i.magFilter,i.minFilter,i.format,i.type,i.anisotropy,i.encoding),this.texture.isRenderTargetTexture=!0,this.texture.flipY=!1,this.texture.generateMipmaps=void 0!==i.generateMipmaps&&i.generateMipmaps,this.texture.internalFormat=void 0!==i.internalFormat?i.internalFormat:null,this.texture.minFilter=void 0!==i.minFilter?i.minFilter:v,this.depthBuffer=void 0===i.depthBuffer||i.depthBuffer,this.stencilBuffer=void 0!==i.stencilBuffer&&i.stencilBuffer,this.depthTexture=void 0!==i.depthTexture?i.depthTexture:null,this.samples=void 0!==i.samples?i.samples:0}setSize(e,t,i=1){(this.width!==e||this.height!==t||this.depth!==i)&&(this.width=e,this.height=t,this.depth=i,this.texture.image.width=e,this.texture.image.height=t,this.texture.image.depth=i,this.dispose()),this.viewport.set(0,0,e,t),this.scissor.set(0,0,e,t)}clone(){return new this.constructor().copy(this)}copy(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;let t=Object.assign({},e.texture.image);return this.texture.source=new el(t),this.depthBuffer=e.depthBuffer,this.stencilBuffer=e.stencilBuffer,null!==e.depthTexture&&(this.depthTexture=e.depthTexture.clone()),this.samples=e.samples,this}dispose(){this.dispatchEvent({type:"dispose"})}}class ef extends ec{constructor(e=null,t=1,i=1,n=1){super(null),this.isDataArrayTexture=!0,this.image={data:e,width:t,height:i,depth:n},this.magFilter=f,this.minFilter=f,this.wrapR=d,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}}class em{constructor(e=0,t=0,i=0,n=1){this.isQuaternion=!0,this._x=e,this._y=t,this._z=i,this._w=n}static slerpFlat(e,t,i,n,r,a,s){let o=i[n+0],l=i[n+1],h=i[n+2],u=i[n+3],c=r[a+0],d=r[a+1],p=r[a+2],f=r[a+3];if(0===s){e[t+0]=o,e[t+1]=l,e[t+2]=h,e[t+3]=u;return}if(1===s){e[t+0]=c,e[t+1]=d,e[t+2]=p,e[t+3]=f;return}if(u!==f||o!==c||l!==d||h!==p){let m=1-s,g=o*c+l*d+h*p+u*f,v=g>=0?1:-1,_=1-g*g;if(_>Number.EPSILON){let x=Math.sqrt(_),y=Math.atan2(x,g*v);m=Math.sin(m*y)/x,s=Math.sin(s*y)/x}let M=s*v;if(o=o*m+c*M,l=l*m+d*M,h=h*m+p*M,u=u*m+f*M,m===1-s){let b=1/Math.sqrt(o*o+l*l+h*h+u*u);o*=b,l*=b,h*=b,u*=b}}e[t]=o,e[t+1]=l,e[t+2]=h,e[t+3]=u}static multiplyQuaternionsFlat(e,t,i,n,r,a){let s=i[n],o=i[n+1],l=i[n+2],h=i[n+3],u=r[a],c=r[a+1],d=r[a+2],p=r[a+3];return e[t]=s*p+h*u+o*d-l*c,e[t+1]=o*p+h*c+l*u-s*d,e[t+2]=l*p+h*d+s*c-o*u,e[t+3]=h*p-s*u-o*c-l*d,e}get x(){return this._x}set x(e){this._x=e,this._onChangeCallback()}get y(){return this._y}set y(e){this._y=e,this._onChangeCallback()}get z(){return this._z}set z(e){this._z=e,this._onChangeCallback()}get w(){return this._w}set w(e){this._w=e,this._onChangeCallback()}set(e,t,i,n){return this._x=e,this._y=t,this._z=i,this._w=n,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._w)}copy(e){return this._x=e.x,this._y=e.y,this._z=e.z,this._w=e.w,this._onChangeCallback(),this}setFromEuler(e,t){if(!(e&&e.isEuler))throw Error("THREE.Quaternion: .setFromEuler() now expects an Euler rotation rather than a Vector3 and order.");let i=e._x,n=e._y,r=e._z,a=e._order,s=Math.cos,o=Math.sin,l=s(i/2),h=s(n/2),u=s(r/2),c=o(i/2),d=o(n/2),p=o(r/2);switch(a){case"XYZ":this._x=c*h*u+l*d*p,this._y=l*d*u-c*h*p,this._z=l*h*p+c*d*u,this._w=l*h*u-c*d*p;break;case"YXZ":this._x=c*h*u+l*d*p,this._y=l*d*u-c*h*p,this._z=l*h*p-c*d*u,this._w=l*h*u+c*d*p;break;case"ZXY":this._x=c*h*u-l*d*p,this._y=l*d*u+c*h*p,this._z=l*h*p+c*d*u,this._w=l*h*u-c*d*p;break;case"ZYX":this._x=c*h*u-l*d*p,this._y=l*d*u+c*h*p,this._z=l*h*p-c*d*u,this._w=l*h*u+c*d*p;break;case"YZX":this._x=c*h*u+l*d*p,this._y=l*d*u+c*h*p,this._z=l*h*p-c*d*u,this._w=l*h*u-c*d*p;break;case"XZY":this._x=c*h*u-l*d*p,this._y=l*d*u-c*h*p,this._z=l*h*p+c*d*u,this._w=l*h*u+c*d*p;break;default:console.warn("THREE.Quaternion: .setFromEuler() encountered an unknown order: "+a)}return!1!==t&&this._onChangeCallback(),this}setFromAxisAngle(e,t){let i=t/2,n=Math.sin(i);return this._x=e.x*n,this._y=e.y*n,this._z=e.z*n,this._w=Math.cos(i),this._onChangeCallback(),this}setFromRotationMatrix(e){let t=e.elements,i=t[0],n=t[4],r=t[8],a=t[1],s=t[5],o=t[9],l=t[2],h=t[6],u=t[10],c=i+s+u;if(c>0){let d=.5/Math.sqrt(c+1);this._w=.25/d,this._x=(h-o)*d,this._y=(r-l)*d,this._z=(a-n)*d}else if(i>s&&i>u){let p=2*Math.sqrt(1+i-s-u);this._w=(h-o)/p,this._x=.25*p,this._y=(n+a)/p,this._z=(r+l)/p}else if(s>u){let f=2*Math.sqrt(1+s-i-u);this._w=(r-l)/f,this._x=(n+a)/f,this._y=.25*f,this._z=(o+h)/f}else{let m=2*Math.sqrt(1+u-i-s);this._w=(a-n)/m,this._x=(r+l)/m,this._y=(o+h)/m,this._z=.25*m}return this._onChangeCallback(),this}setFromUnitVectors(e,t){let i=e.dot(t)+1;return i<Number.EPSILON?(i=0,Math.abs(e.x)>
vendor: 4,632 bytes, line 1
1Math.abs(e.z)?(this._x=-e.y,this._y=e.x,this._z=0,this._w=i):(this._x=0,this._y=-e.z,this._z=e.y,this._w=i)):(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=i),this.normalize()}angleTo(e){return 2*Math.acos(Math.abs(z(this.dot(e),-1,1)))}rotateTowards(e,t){let i=this.angleTo(e);return 0===i||this.slerp(e,Math.min(1,t/i)),this}identity(){return this.set(0,0,0,1)}invert(){return this.conjugate()}conjugate(){return this._x*=-1,this._y*=-1,this._z*=-1,this._onChangeCallback(),this}dot(e){return this._x*e._x+this._y*e._y+this._z*e._z+this._w*e._w}lengthSq(){return this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w}length(){return Math.sqrt(this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w)}normalize(){let e=this.length();return 0===e?(this._x=0,this._y=0,this._z=0,this._w=1):(e=1/e,this._x=this._x*e,this._y=this._y*e,this._z=this._z*e,this._w=this._w*e),this._onChangeCallback(),this}multiply(e){return this.multiplyQuaternions(this,e)}premultiply(e){return this.multiplyQuaternions(e,this)}multiplyQuaternions(e,t){let i=e._x,n=e._y,r=e._z,a=e._w,s=t._x,o=t._y,l=t._z,h=t._w;return this._x=i*h+a*s+n*l-r*o,this._y=n*h+a*o+r*s-i*l,this._z=r*h+a*l+i*o-n*s,this._w=a*h-i*s-n*o-r*l,this._onChangeCallback(),this}slerp(e,t){if(0===t)return this;if(1===t)return this.copy(e);let i=this._x,n=this._y,r=this._z,a=this._w,s=a*e._w+i*e._x+n*e._y+r*e._z;if(s<0?(this._w=-e._w,this._x=-e._x,this._y=-e._y,this._z=-e._z,s=-s):this.copy(e),s>=1)return this._w=a,this._x=i,this._y=n,this._z=r,this;let o=1-s*s;if(o<=Number.EPSILON){let l=1-t;return this._w=l*a+t*this._w,this._x=l*i+t*this._x,this._y=l*n+t*this._y,this._z=l*r+t*this._z,this.normalize(),this._onChangeCallback(),this}let h=Math.sqrt(o),u=Math.atan2(h,s),c=Math.sin((1-t)*u)/h,d=Math.sin(t*u)/h;return this._w=a*c+this._w*d,this._x=i*c+this._x*d,this._y=n*c+this._y*d,this._z=r*c+this._z*d,this._onChangeCallback(),this}slerpQuaternions(e,t,i){return this.copy(e).slerp(t,i)}random(){let e=Math.random(),t=Math.sqrt(1-e),i=Math.sqrt(e),n=2*Math.PI*Math.random(),r=2*Math.PI*Math.random();return this.set(t*Math.cos(n),i*Math.sin(r),i*Math.cos(r),t*Math.sin(n))}equals(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._w===this._w}fromArray(e,t=0){return this._x=e[t],this._y=e[t+1],this._z=e[t+2],this._w=e[t+3],this._onChangeCallback(),this}toArray(e=[],t=0){return e[t]=this._x,e[t+1]=this._y,e[t+2]=this._z,e[t+3]=this._w,e}fromBufferAttribute(e,t){return this._x=e.getX(t),this._y=e.getY(t),this._z=e.getZ(t),this._w=e.getW(t),this}_onChange(e){return this._onChangeCallback=e,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._w}}class eg{constructor(e=0,t=0,i=0){eg.prototype.isVector3=!0,this.x=e,this.y=t,this.z=i}set(e,t,i){return void 0===i&&(i=this.z),this.x=e,this.y=t,this.z=i,this}setScalar(e){return this.x=e,this.y=e,this.z=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setZ(e){return this.z=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;case 2:this.z=t;break;default:throw Error("index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;case 2:return this.z;default:throw Error("index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y,this.z)}copy(e){return this.x=e.x,this.y=e.y,this.z=e.z,this}add(e){return this.x+=e.x,this.y+=e.y,this.z+=e.z,this}addScalar(e){return this.x+=e,this.y+=e,this.z+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this.z=e.z+t.z,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this.z+=e.z*t,this}sub(e){return this.x-=e.x,this.y-=e.y,this.z-=e.z,this}subScalar(e){return this.x-=e,this.y-=e,this.z-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this.z=e.z-t.z,this}multiply(e){return this.x*=e.x,this.y*=e.y,this.z*=e.z,this}multiplyScalar(e){return this.x*=e,this.y*=e,this.z*=e,this}multiplyVectors(e,t){return this.x=e.x*t.x,this.y=e.y*t.y,this.z=e.z*t.z,this}applyEuler(e){return this.applyQuaternion(e_.setFromEuler(e))}applyAxisAngle(e,t){return this.applyQuaternion(e_.setFromAxisAngle(e,t))}applyMatrix3(e){let t=this.x,i=this.y,n=this.z,r=e.elements;return this.x=r[0]*t+r[3]*i+r[6]*n,this.y=r[1]*t+r[4]*i+r[7]*n,this.z=r[2]*t+r[5]*i+r[8]*n,this}applyNormalMatrix(e){return this.applyMatrix3(e).normalize()}applyMatrix4(e){let t=this.x,i=this.y,n=this.z,r=e.elements,a=1/(r[3]*t+r[7]*i+r[11]*n+r[15]);return this.x=(r[0]*t+r[4]*i+r[8]*n+r[12])*a,this.y=(r[1]*t+r[5]*i+r[9]*n+r[13])*a,this.z=(r[2]*t+r[6]*i+r[10]*n+r[14])*a,this}
1applyQuaternion(e){let t=this.x,i=this.y,n=this.z,r=e.x,a=e.y,s=e.z,o=e.w,l=o*t+a*n-s*i,h=o*i+s*t-r*n,u=o*n+r*i-a*t,c=-r*t-a*i-s*n;return this.x=l*o+-(c*r)+-(h*s)- -(u*a),this.y=h*o+-(c*a)+-(u*r)- -(l*s),this.z=u*o+-(c*s)+-(l*a)- -(h*r),this}project(e){return this.applyMatrix4(e.matrixWorldInverse).applyMatrix4(e.projectionMatrix)}unproject(e){return this.applyMatrix4(e.projectionMatrixInverse).applyMatrix4(e.matrixWorld)}transformDirection(e){let t=this.x,i=this.y,n=this.z,r=e.elements;return this.x=r[0]*t+r[4]*i+r[8]*n,this.y=r[1]*t+r[5]*i+r[9]*n,this.z=r[2]*t+r[6]*i+r[10]*n,this.normalize()}divide(e){return this.x/=e.x,this.y/=e.y,this.z/=e.z,this}divideScalar(e){return this.multiplyScalar(1/e)}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this.z=Math.min(this.z,e.z),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this.z=Math.max(this.z,e.z),this}clamp(e,t){return this.x=Math.max(e.x,Math.min(t.x,this.x)),this.y=Math.max(e.y,Math.min(t.y,this.y)),this.z=Math.max(e.z,Math.min(t.z,this.z)),this}clampScalar(e,t){return this.x=Math.max(e,Math.min(t,this.x)),this.y=Math.max(e,Math.min(t,this.y)),this.z=Math.max(e,Math.min(t,this.z)),this}clampLength(e,t){let i=this.length();return this.divideScalar(i||1).multiplyScalar(Math.max(e,Math.min(t,i)))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this}roundToZero(){return this.x=this.x<0?Math.ceil(this.x):Math.floor(this.x),this.y=this.y<0?Math.ceil(this.y):Math.floor(this.y),this.z=this.z<0?Math.ceil(this.z):Math.floor(this.z),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this}dot(e){return this.x*e.x+this.y*e.y+this.z*e.z}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)}normalize(){return this.divideScalar(this.length()||1)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this.z+=(e.z-this.z)*t,this}lerpVectors(e,t,i){return this.x=e.x+(t.x-e.x)*i,this.y=e.y+(t.y-e.y)*i,this.z=e.z+(t.z-e.z)*i,this}cross(e){return this.crossVectors(this,e)}crossVectors(e,t){let i=e.x,n=e.y,r=e.z,a=t.x,s=t.y,o=t.z;return this.x=n*o-r*s,this.y=r*a-i*o,this.z=i*s-n*a,this}projectOnVector(e){let t=e.lengthSq();if(0===t)return this.set(0,0,0);let i=e.dot(this)/t;return this.copy(e).multiplyScalar(i)}projectOnPlane(e){return ev.copy(this).projectOnVector(e),this.sub(ev)}reflect(e){return this.sub(ev.copy(e).multiplyScalar(2*this.dot(e)))}angleTo(e){let t=Math.sqrt(this.lengthSq()*e.lengthSq());if(0===t)return Math.PI/2;let i=this.dot(e)/t;return Math.acos(z(i,-1,1))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){let t=this.x-e.x,i=this.y-e.y,n=this.z-e.z;return t*t+i*i+n*n}manhattanDistanceTo(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)+Math.abs(this.z-e.z)}setFromSpherical(e){return this.setFromSphericalCoords(e.radius,e.phi,e.theta)}setFromSphericalCoords(e,t,i){let n=Math.sin(t)*e;return this.x=n*Math.sin(i),this.y=Math.cos(t)*e,this.z=n*Math.cos(i),this}setFromCylindrical(e){return this.setFromCylindricalCoords(e.radius,e.theta,e.y)}setFromCylindricalCoords(e,t,i){return this.x=e*Math.sin(t),this.y=i,this.z=e*Math.cos(t),this}setFromMatrixPosition(e){let t=e.elements;return this.x=t[12],this.y=t[13],this.z=t[14],this}setFromMatrixScale(e){let t=this.setFromMatrixColumn(e,0).length(),i=this.setFromMatrixColumn(e,1).length(),n=this.setFromMatrixColumn(e,2).length();return this.x=t,this.y=i,this.z=n,this}setFromMatrixColumn(e,t){return this.fromArray(e.elements,4*t)}setFromMatrix3Column(e,t){return this.fromArray(e.elements,3*t)}setFromEuler(e){return this.x=e._x,this.y=e._y,this.z=e._z,this}equals(e){return e.x===this.x&&e.y===this.y&&e.z===this.z}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this.z=e[t+2],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e[t+2]=this.z,e}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this.z=e.getZ(t),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this}randomDirection(){let e=(Math.random()-.5)*2,t=Math.random()*Math.PI*2,i=Math.sqrt(1-e**2);return this.x=i*Math.cos(t),this.y=i*Math.sin(t),this.z=e,this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z}}let ev=new eg,e_=new em;class ex{constructor(e=new eg(Infinity,Infinity,Infinity),t=new eg(-1/0,-1/0,-1/0)){this.isBox3=!0,this.min=e,this.max=t}set(e,t){return this.min.copy(e),this.max.copy(t),this}setFromArray(e){let t=Infinity,i=Infinity,n=Infinity,r=-1/0,a=-1/0,s=-1/0;for(let o=0,l=e.length;o<l;o+=3){let h=e[o],u=e[o+1],c=e[o+2];h<t&&(t=h),u<i&&(i=u),c<n&&(n=c),h>r&&(r=h),u>a&&(a=u),c>s&&(s=c)}return this.min.set(t,i,n),this.max.set(r,a,s),this}setFromBufferAttribute(e){let t=Infinity,i=Infinity,n=Infinity,r=-1/0,a=-1/0,s=-1/0;for(let o=0,l=e.count;o<l;o++){let h=e.getX(o),u=e.getY(o),c=e.getZ(o);h<t&&(t=h),u<i&&(i=u),c<n&&(n=c),h>r&&(r=h),u>a&&(a=u),c>s&&(s=c)}return this.min.set(t,i,n),this.max.set(r,a,s),this}setFromPoints(e){this.makeEmpty();for(let t=0,i=e.length;t<i;t++)this.expandByPoint(e[t]);return this}setFromCenterAndSize(e,t){let i=eM.copy(t).multiplyScalar(.5);return this.min.copy(e).sub(i),this.max.copy(e).add(i),this}setFromObject(e,t=!1){return this.makeEmpty(),this.expandByObject(e,t)}clone(){return new this.constructor().copy(this)}copy(e){return this.min.copy(e.min),this.max.copy(e.max),this}makeEmpty(){return this.min.x=this.min.y=this.min.z=Infinity,this.max.x=this.max.y=this.max.z=-1/0,this}isEmpty(){return this.max.x<this.min.x||this.max.y<this.min.y||this.max.z<this.min.z}getCenter(e){return this.isEmpty()?e.set(0,0,0):e.addVectors(this.min,this.max).multiplyScalar(.5)}getSize(e){return this.isEmpty()?e.set(0,0,0):e.subVectors(this.max,this.min)}expandByPoint(e){return this.min.min(e),this.max.max(e),this}expandByVector(e){return this.min.sub(e),this.max.add(e),this}expandByScalar(e){return this.min.addScalar(-e),this.max.addScalar(e),this}expandByObject(e,t=!1){e.updateWorldMatrix(!1,!1);let i=e.geometry;if(void 0!==i){if(t&&void 0!=i.attributes&&void 0!==i.attributes.position){let n=i.attributes.position;for(let r=0,a=n.count;r<a;r++)eM.fromBufferAttribute(n,r).applyMatrix4(e.matrixWorld),this.expandByPoint(eM)}else null===i.boundingBox&&i.computeBoundingBox(),eb.copy(i.boundingBox),eb.applyM
1atrix4(e.matrixWorld),this.union(eb)}let s=e.children;for(let o=0,l=s.length;o<l;o++)this.expandByObject(s[o],t);return this}containsPoint(e){return!(e.x<this.min.x)&&!(e.x>this.max.x)&&!(e.y<this.min.y)&&!(e.y>this.max.y)&&!(e.z<this.min.z)&&!(e.z>this.max.z)}containsBox(e){return this.min.x<=e.min.x&&e.max.x<=this.max.x&&this.min.y<=e.min.y&&e.max.y<=this.max.y&&this.min.z<=e.min.z&&e.max.z<=this.max.z}getParameter(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))}intersectsBox(e){return!(e.max.x<this.min.x)&&!(e.min.x>this.max.x)&&!(e.max.y<this.min.y)&&!(e.min.y>this.max.y)&&!(e.max.z<this.min.z)&&!(e.min.z>this.max.z)}intersectsSphere(e){return this.clampPoint(e.center,eM),eM.distanceToSquared(e.center)<=e.radius*e.radius}intersectsPlane(e){let t,i;return e.normal.x>0?(t=e.normal.x*this.min.x,i=e.normal.x*this.max.x):(t=e.normal.x*this.max.x,i=e.normal.x*this.min.x),e.normal.y>0?(t+=e.normal.y*this.min.y,i+=e.normal.y*this.max.y):(t+=e.normal.y*this.max.y,i+=e.normal.y*this.min.y),e.normal.z>0?(t+=e.normal.z*this.min.z,i+=e.normal.z*this.max.z):(t+=e.normal.z*this.max.z,i+=e.normal.z*this.min.z),t<=-e.constant&&i>=-e.constant}intersectsTriangle(e){if(this.isEmpty())return!1;this.getCenter(eL),eP.subVectors(this.max,eL),eS.subVectors(e.a,eL),ew.subVectors(e.b,eL),eT.subVectors(e.c,eL),eE.subVectors(ew,eS),eA.subVectors(eT,ew),eC.subVectors(eS,eT);let t=[0,-eE.z,eE.y,0,-eA.z,eA.y,0,-eC.z,eC.y,eE.z,0,-eE.x,eA.z,0,-eA.x,eC.z,0,-eC.x,-eE.y,eE.x,0,-eA.y,eA.x,0,-eC.y,eC.x,0];return!!(eI(t,eS,ew,eT,eP)&&eI(t=[1,0,0,0,1,0,0,0,1],eS,ew,eT,eP))&&(eR.crossVectors(eE,eA),eI(t=[eR.x,eR.y,eR.z],eS,ew,eT,eP))}clampPoint(e,t){return t.copy(e).clamp(this.min,this.max)}distanceToPoint(e){let t=eM.copy(e).clamp(this.min,this.max);return t.sub(e).length()}getBoundingSphere(e){return this.getCenter(e.center),e.radius=.5*this.getSize(eM).length(),e}intersect(e){return this.min.max(e.min),this.max.min(e.max),this.isEmpty()&&this.makeEmpty(),this}union(e){return this.min.min(e.min),this.max.max(e.max),this}applyMatrix4(e){return this.isEmpty()||(ey[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(e),ey[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(e),ey[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(e),ey[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(e),ey[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(e),ey[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(e),ey[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(e),ey[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(e),this.setFromPoints(ey)),this}translate(e){return this.min.add(e),this.max.add(e),this}equals(e){return e.min.equals(this.min)&&e.max.equals(this.max)}}let ey=[new eg,new eg,new eg,new eg,new eg,new eg,new eg,new eg],eM=new eg,eb=new ex,eS=new eg,ew=new eg,eT=new eg,eE=new eg,eA=new eg,eC=new eg,eL=new eg,eP=new eg,eR=new eg,eD=new eg;function eI(e,t,i,n,r){for(let a=0,s=e.length-3;a<=s;a+=3){eD.fromArray(e,a);let o=r.x*Math.abs(eD.x)+r.y*Math.abs(eD.y)+r.z*Math.abs(eD.z),l=t.dot(eD),h=i.dot(eD),u=n.dot(eD);if(Math.max(-Math.max(l,h,u),Math.min(l,h,u))>o)return!1}return!0}let eN=new ex,eO=new eg,ez=new eg,eU=new eg;class eF{constructor(e=new eg,t=-1){this.center=e,this.radius=t}set(e,t){return this.center.copy(e),this.radius=t,this}setFromPoints(e,t){let i=this.center;void 0!==t?i.copy(t):eN.setFromPoints(e).getCenter(i);let n=0;for(let r=0,a=e.length;r<a;r++)n=Math.max(n,i.distanceToSquared(e[r]));return this.radius=Math.sqrt(n),this}copy(e){return this.center.copy(e.center),this.radius=e.radius,this}isEmpty(){return this.radius<0}makeEmpty(){return this.center.set(0,0,0),this.radius=-1,this}containsPoint(e){return e.distanceToSquared(this.center)<=this.radius*this.radius}distanceToPoint(e){return e.distanceTo(this.center)-this.radius}intersectsSphere(e){let t=this.radius+e.radius;return e.center.distanceToSquared(this.center)<=t*t}intersectsBox(e){return e.intersectsSphere(this)}intersectsPlane(e){return Math.abs(e.distanceToPoint(this.center))<=this.radius}clampPoint(e,t){let i=this.center.distanceToSquared(e);return t.copy(e),i>this.radius*this.radius&&(t.sub(this.center).normalize(),t.multiplyScalar(this.radius).add(this.center)),t}getBoundingBox(e){return this.isEmpty()?(e.makeEmpty(),e):(e.set(this.center,this.center),e.expandByScalar(this.radius),e)}
1applyMatrix4(e){return this.center.applyMatrix4(e),this.radius=this.radius*e.getMaxScaleOnAxis(),this}translate(e){return this.center.add(e),this}expandByPoint(e){eU.subVectors(e,this.center);let t=eU.lengthSq();if(t>this.radius*this.radius){let i=Math.sqrt(t),n=(i-this.radius)*.5;this.center.add(eU.multiplyScalar(n/i)),this.radius+=n}return this}union(e){return!0===this.center.equals(e.center)?ez.set(0,0,1).multiplyScalar(e.radius):ez.subVectors(e.center,this.center).normalize().multiplyScalar(e.radius),this.expandByPoint(eO.copy(e.center).add(ez)),this.expandByPoint(eO.copy(e.center).sub(ez)),this}equals(e){return e.center.equals(this.center)&&e.radius===this.radius}clone(){return new this.constructor().copy(this)}}let eB=new eg,ek=new eg,eV=new eg,eG=new eg,eH=new eg,eW=new eg,ej=new eg;class eq{constructor(e=new eg,t=new eg(0,0,-1)){this.origin=e,this.direction=t}set(e,t){return this.origin.copy(e),this.direction.copy(t),this}copy(e){return this.origin.copy(e.origin),this.direction.copy(e.direction),this}at(e,t){return t.copy(this.direction).multiplyScalar(e).add(this.origin)}lookAt(e){return this.direction.copy(e).sub(this.origin).normalize(),this}recast(e){return this.origin.copy(this.at(e,eB)),this}closestPointToPoint(e,t){t.subVectors(e,this.origin);let i=t.dot(this.direction);return i<0?t.copy(this.origin):t.copy(this.direction).multiplyScalar(i).add(this.origin)}distanceToPoint(e){return Math.sqrt(this.distanceSqToPoint(e))}distanceSqToPoint(e){let t=eB.subVectors(e,this.origin).dot(this.direction);return t<0?this.origin.distanceToSquared(e):(eB.copy(this.direction).multiplyScalar(t).add(this.origin),eB.distanceToSquared(e))}distanceSqToSegment(e,t,i,n){ek.copy(e).add(t).multiplyScalar(.5),eV.copy(t).sub(e).normalize(),eG.copy(this.origin).sub(ek);let r=.5*e.distanceTo(t),a=-this.direction.dot(eV),s=eG.dot(this.direction),o=-eG.dot(eV),l=eG.lengthSq(),h=Math.abs(1-a*a),u,c,d,p;if(h>0){if(u=a*o-s,c=a*s-o,p=r*h,u>=0){if(c>=-p){if(c<=p){let f=1/h;u*=f,c*=f,d=u*(u+a*c+2*s)+c*(a*u+c+2*o)+l}else d=-(u=Math.max(0,-(a*(c=r)+s)))*u+c*(c+2*o)+l}else d=-(u=Math.max(0,-(a*(c=-r)+s)))*u+c*(c+2*o)+l}else c<=-p?(c=(u=Math.max(0,-(-a*r+s)))>0?-r:Math.min(Math.max(-r,-o),r),d=-u*u+c*(c+2*o)+l):c<=p?(u=0,d=(c=Math.min(Math.max(-r,-o),r))*(c+2*o)+l):(c=(u=Math.max(0,-(a*r+s)))>0?r:Math.min(Math.max(-r,-o),r),d=-u*u+c*(c+2*o)+l)}else c=a>0?-r:r,d=-(u=Math.max(0,-(a*c+s)))*u+c*(c+2*o)+l;return i&&i.copy(this.direction).multiplyScalar(u).add(this.origin),n&&n.copy(eV).multiplyScalar(c).add(ek),d}intersectSphere(e,t){eB.subVectors(e.center,this.origin);let i=eB.dot(this.direction),n=eB.dot(eB)-i*i,r=e.radius*e.radius;if(n>r)return null;let a=Math.sqrt(r-n),s=i-a,o=i+a;return s<0&&o<0?null:s<0?this.at(o,t):this.at(s,t)}intersectsSphere(e){return this.distanceSqToPoint(e.center)<=e.radius*e.radius}distanceToPlane(e){let t=e.normal.dot(this.direction);if(0===t)return 0===e.distanceToPoint(this.origin)?0:null;let i=-(this.origin.dot(e.normal)+e.constant)/t;return i>=0?i:null}intersectPlane(e,t){let i=this.distanceToPlane(e);return null===i?null:this.at(i,t)}intersectsPlane(e){let t=e.distanceToPoint(this.origin);if(0===t)return!0;let i=e.normal.dot(this.direction);return i*t<0}intersectBox(e,t){let i,n,r,a,s,o,l=1/this.direction.x,h=1/this.direction.y,u=1/this.direction.z,c=this.origin;return(l>=0?(i=(e.min.x-c.x)*l,n=(e.max.x-c.x)*l):(i=(e.max.x-c.x)*l,n=(e.min.x-c.x)*l),h>=0?(r=(e.min.y-c.y)*h,a=(e.max.y-c.y)*h):(r=(e.max.y-c.y)*h,a=(e.min.y-c.y)*h),i>a||r>n)?null:((r>i||i!=i)&&(i=r),(a<n||n!=n)&&(n=a),u>=0?(s=(e.min.z-c.z)*u,o=(e.max.z-c.z)*u):(s=(e.max.z-c.z)*u,o=(e.min.z-c.z)*u),i>o||s>n)?null:((s>i||i!=i)&&(i=s),(o<n||n!=n)&&(n=o),n<0)?null:this.at(i>=0?i:n,t)}intersectsBox(e){return null!==this.intersectBox(e,eB)}intersectTriangle(e,t,i,n,r){eH.subVectors(t,e),eW.subVectors(i,e),ej.crossVectors(eH,eW);let a=this.direction.dot(ej),s;if(a>0){if(n)return null;s=1}else{if(!(a<0))return null;s=-1,a=-a}eG.subVectors(this.origin,e);let o=s*this.direction.dot(eW.crossVectors(eG,eW));if(o<0)return null;let l=s*this.direction.dot(eH.cross(eG));if(l<0||o+l>a)return null;let h=-s*eG.dot(ej);return h<0?null:this.at(h/a,r)}applyMatrix4(e){return this.origin.applyMatrix4(e),this.direction.transformDirection(e),this}equals(e){return e.origin.equals(this.origin)&&e.direction.equals(this.direction)}clone(){return new this.constructor().copy(this)}}class eX{constructor(){eX.prototype.isMatrix4=!0,this.elements=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1]}set(e,t,i,n,r,a,s,o,l,h,u,c,d,p,f,m){let g=this.elements;return g[0]=e,g[4]=t,g[8]=i,g[12]=n,g[1]=r,g[5]=a,g[9]=s,g[13]=o,g[2]=l,g[6]=h,g[10]=u,g[14]=c,g[3]=d,g[7]=p,g[11]=f,g[15]=m,this}identity(){return this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1),this}clone(){return new eX().fromArray(this.elements)}copy(e){let t=this.elements,i=e.elements;return t[0]=i[0],t[1]=i[1],t[2]=i[2],t[3]=i[3],t[4]=i[4],t[5]=i[5],t[6]=i[6],t[7]=i[7],t[8]=i[8],t[9]=i[9],t[10]=i[10],t[11]=i[11],t[12]=i[12],t[13]=i[13],t[14]=i[14],t[15]=i[15],this}copyPosition(e){let t=this.elements,i=e.elements;return t[12]=i[12],t[13]=i[13],t[14]=i[14],this}setFromMatrix3(e){let 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}extractBasis(e,t,i){return e.setFromMatrixColumn(this,0),t.setFromMatrixColumn(this,1),i.setFromMatrixColumn(this,2),this}makeBasis(e,t,i){return this.set(e.x,t.x,i.x,0,e.y,t.y,i.y,0,e.z,t.z,i.z,0,0,0,0,1),this}extractRotation(e){let t=this.elements,i=e.elements,n=1/eY.setFromMatrixColumn(e,0).length(),r=1/eY.setFromMatrixColumn(e,1).length(),a=1/eY.setFromMatrixColumn(e,2).length();return t[0]=i[0]*n,t[1]=i[1]*n,t[2]=i[2]*n,t[3]=0,t[4]=i[4]*r,t[5]=i[5]*r,t[6]=i[6]*r,t[7]=0,t[8]=i[8]*a,t[9]=i[9]*a,t[10]=i[10]*a,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this}makeRotationFromEuler(e){let t=this.elements,i=e.x,n=e.y,r=e.z,a=Math.cos(i),s=Math.sin(i),o=Math.cos(n),l=Math.sin(n),h=Math.cos(r),u=Math.sin(r);if("XYZ"===e.order){let c=a*h,d=a*u,p=s*h,f=s*u;t[0]=o*h,t[4]=-o*u,t[8]=l,t[1]=d+p*l,t[5]=c-f*l,t[9]=-s*o,t[2]=f-c*l,t[6]=p+d*l,t[10]=a*o}else if("YXZ"===e.order){let m=o*h,g=o*u,v=l*h,_=l*u;t[0]=m+_*s,t[4]=v*s-g,t[8]=a*l,t[1]=a*u,t[5]=a*h,t[9]=-s,t[2]=g*s-v,t[6]=_+m*s,t[10]=a*o}else if("ZXY"===e.order){let x=o*h,y=o*u,M=l*h,b=l*u;t[0]=x-b*s,t[4]=-a*u,t[8]=M+y*s,t[1]=y+M*s,t[5]=a*h,t[9]=b-x*s,t[2]=-a*l,t[6]=s,t[10]=a*o}else if("ZYX"===e.order){let S=a*h,w=a*u,T=s*h,E=s*u;t[0]=o*h,t[4]=T*l-w,t[8]=S*l+E,t[1]=o*u,t[5]=E*l+S,t[9]=w*l-T,t[2]=-l,t[6]=s*o,t[10]=a*o}else if("YZX"===e.order){let A=a*o,C=a*l,L=s*o,P=s*l;t[0]=o*h,t[4]=P-A*u,t[8]=L*u+C,t[1]=u,t[5]=a*h,t[9]=-s*h,t[2]=-l*h,t[6]=C*u+L,t[10]=A-P*u}
vendor: 5,256 bytes, line 1
1else if("XZY"===e.order){let R=a*o,D=a*l,I=s*o,N=s*l;t[0]=o*h,t[4]=-u,t[8]=l*h,t[1]=R*u+N,t[5]=a*h,t[9]=D*u-I,t[2]=I*u-D,t[6]=s*h,t[10]=N*u+R}return t[3]=0,t[7]=0,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this}makeRotationFromQuaternion(e){return this.compose(eJ,e,eK)}lookAt(e,t,i){let n=this.elements;return e0.subVectors(e,t),0===e0.lengthSq()&&(e0.z=1),e0.normalize(),eQ.crossVectors(i,e0),0===eQ.lengthSq()&&(1===Math.abs(i.z)?e0.x+=1e-4:e0.z+=1e-4,e0.normalize(),eQ.crossVectors(i,e0)),eQ.normalize(),e$.crossVectors(e0,eQ),n[0]=eQ.x,n[4]=e$.x,n[8]=e0.x,n[1]=eQ.y,n[5]=e$.y,n[9]=e0.y,n[2]=eQ.z,n[6]=e$.z,n[10]=e0.z,this}multiply(e){return this.multiplyMatrices(this,e)}premultiply(e){return this.multiplyMatrices(e,this)}multiplyMatrices(e,t){let i=e.elements,n=t.elements,r=this.elements,a=i[0],s=i[4],o=i[8],l=i[12],h=i[1],u=i[5],c=i[9],d=i[13],p=i[2],f=i[6],m=i[10],g=i[14],v=i[3],_=i[7],x=i[11],y=i[15],M=n[0],b=n[4],S=n[8],w=n[12],T=n[1],E=n[5],A=n[9],C=n[13],L=n[2],P=n[6],R=n[10],D=n[14],I=n[3],N=n[7],O=n[11],z=n[15];return r[0]=a*M+s*T+o*L+l*I,r[4]=a*b+s*E+o*P+l*N,r[8]=a*S+s*A+o*R+l*O,r[12]=a*w+s*C+o*D+l*z,r[1]=h*M+u*T+c*L+d*I,r[5]=h*b+u*E+c*P+d*N,r[9]=h*S+u*A+c*R+d*O,r[13]=h*w+u*C+c*D+d*z,r[2]=p*M+f*T+m*L+g*I,r[6]=p*b+f*E+m*P+g*N,r[10]=p*S+f*A+m*R+g*O,r[14]=p*w+f*C+m*D+g*z,r[3]=v*M+_*T+x*L+y*I,r[7]=v*b+_*E+x*P+y*N,r[11]=v*S+_*A+x*R+y*O,r[15]=v*w+_*C+x*D+y*z,this}multiplyScalar(e){let t=this.elements;return t[0]*=e,t[4]*=e,t[8]*=e,t[12]*=e,t[1]*=e,t[5]*=e,t[9]*=e,t[13]*=e,t[2]*=e,t[6]*=e,t[10]*=e,t[14]*=e,t[3]*=e,t[7]*=e,t[11]*=e,t[15]*=e,this}determinant(){let e=this.elements,t=e[0],i=e[4],n=e[8],r=e[12],a=e[1],s=e[5],o=e[9],l=e[13],h=e[2],u=e[6],c=e[10],d=e[14],p=e[3],f=e[7],m=e[11],g=e[15];return p*(+r*o*u-n*l*u-r*s*c+i*l*c+n*s*d-i*o*d)+f*(+t*o*d-t*l*c+r*a*c-n*a*d+n*l*h-r*o*h)+m*(+t*l*u-t*s*d-r*a*u+i*a*d+r*s*h-i*l*h)+g*(-n*s*h-t*o*u+t*s*c+n*a*u-i*a*c+i*o*h)}transpose(){let e=this.elements,t;return t=e[1],e[1]=e[4],e[4]=t,t=e[2],e[2]=e[8],e[8]=t,t=e[6],e[6]=e[9],e[9]=t,t=e[3],e[3]=e[12],e[12]=t,t=e[7],e[7]=e[13],e[13]=t,t=e[11],e[11]=e[14],e[14]=t,this}setPosition(e,t,i){let n=this.elements;return e.isVector3?(n[12]=e.x,n[13]=e.y,n[14]=e.z):(n[12]=e,n[13]=t,n[14]=i),this}invert(){let e=this.elements,t=e[0],i=e[1],n=e[2],r=e[3],a=e[4],s=e[5],o=e[6],l=e[7],h=e[8],u=e[9],c=e[10],d=e[11],p=e[12],f=e[13],m=e[14],g=e[15],v=u*m*l-f*c*l+f*o*d-s*m*d-u*o*g+s*c*g,_=p*c*l-h*m*l-p*o*d+a*m*d+h*o*g-a*c*g,x=h*f*l-p*u*l+p*s*d-a*f*d-h*s*g+a*u*g,y=p*u*o-h*f*o-p*s*c+a*f*c+h*s*m-a*u*m,M=t*v+i*_+n*x+r*y;if(0===M)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);let b=1/M;return e[0]=v*b,e[1]=(f*c*r-u*m*r-f*n*d+i*m*d+u*n*g-i*c*g)*b,e[2]=(s*m*r-f*o*r+f*n*l-i*m*l-s*n*g+i*o*g)*b,e[3]=(u*o*r-s*c*r-u*n*l+i*c*l+s*n*d-i*o*d)*b,e[4]=_*b,e[5]=(h*m*r-p*c*r+p*n*d-t*m*d-h*n*g+t*c*g)*b,e[6]=(p*o*r-a*m*r-p*n*l+t*m*l+a*n*g-t*o*g)*b,e[7]=(a*c*r-h*o*r+h*n*l-t*c*l-a*n*d+t*o*d)*b,e[8]=x*b,e[9]=(p*u*r-h*f*r-p*i*d+t*f*d+h*i*g-t*u*g)*b,e[10]=(a*f*r-p*s*r+p*i*l-t*f*l-a*i*g+t*s*g)*b,e[11]=(h*s*r-a*u*r-h*i*l+t*u*l+a*i*d-t*s*d)*b,e[12]=y*b,e[13]=(h*f*n-p*u*n+p*i*c-t*f*c-h*i*m+t*u*m)*b,e[14]=(p*s*n-a*f*n-p*i*o+t*f*o+a*i*m-t*s*m)*b,e[15]=(a*u*n-h*s*n+h*i*o-t*u*o-a*i*c+t*s*c)*b,this}scale(e){let t=this.elements,i=e.x,n=e.y,r=e.z;return t[0]*=i,t[4]*=n,t[8]*=r,t[1]*=i,t[5]*=n,t[9]*=r,t[2]*=i,t[6]*=n,t[10]*=r,t[3]*=i,t[7]*=n,t[11]*=r,this}getMaxScaleOnAxis(){let e=this.elements,t=e[0]*e[0]+e[1]*e[1]+e[2]*e[2],i=e[4]*e[4]+e[5]*e[5]+e[6]*e[6],n=e[8]*e[8]+e[9]*e[9]+e[10]*e[10];return Math.sqrt(Math.max(t,i,n))}makeTranslation(e,t,i){return this.set(1,0,0,e,0,1,0,t,0,0,1,i,0,0,0,1),this}makeRotationX(e){let t=Math.cos(e),i=Math.sin(e);return this.set(1,0,0,0,0,t,-i,0,0,i,t,0,0,0,0,1),this}makeRotationY(e){let t=Math.cos(e),i=Math.sin(e);return this.set(t,0,i,0,0,1,0,0,-i,0,t,0,0,0,0,1),this}makeRotationZ(e){let t=Math.cos(e),i=Math.sin(e);return this.set(t,-i,0,0,i,t,0,0,0,0,1,0,0,0,0,1),this}makeRotationAxis(e,t){let i=Math.cos(t),n=Math.sin(t),r=1-i,a=e.x,s=e.y,o=e.z,l=r*a,h=r*s;return this.set(l*a+i,l*s-n*o,l*o+n*s,0,l*s+n*o,h*s+i,h*o-n*a,0,l*o-n*s,h*o+n*a,r*o*o+i,0,0,0,0,1),this}makeScale(e,t,i){return this.set(e,0,0,0,0,t,0,0,0,0,i,0,0,0,0,1),this}makeShear(e,t,i,n,r,a){return this.set(1,i,r,0,e,1,a,0,t,n,1,0,0,0,0,1),this}compose(e,t,i){let n=this.elements,r=t._x,a=t._y,s=t._z,o=t._w,l=r+r,h=a+a,u=s+s,c=r*l,d=r*h,p=r*u,f=a*h,m=a*u,g=s*u,v=o*l,_=o*h,x=o*u,y=i.x,M=i.y,b=i.z;return n[0]=(1-(f+g))*y,n[1]=(d+x)*y,n[2]=(p-_)*y,n[3]=0,n[4]=(d-x)*M,n[5]=(1-(c+g))*M,n[6]=(m+v)*M,n[7]=0,n[8]=(p+_)*b,n[9]=(m-v)*b,n[10]=(1-(c+f))*b,n[11]=0,n[12]=e.x,n[13]=e.y,n[14]=e.z,n[15]=1,this}decompose(e,t,i){let n=this.elements,r=eY.set(n[0],n[1],n[2]).length(),a=eY.set(n[4],n[5],n[6]).length(),s=eY.set(n[8],n[9],n[10]).length(),o=this.determinant();o<0&&(r=-r),e.x=n[12],e.y=n[13],e.z=n[14],eZ.copy(this);let l=1/r,h=1/a,u=1/s;return eZ.elements[0]*=l,eZ.elements[1]*=l,eZ.elements[2]*=l,eZ.elements[4]*=h,eZ.elements[5]*=h,eZ.elements[6]*=h,eZ.elements[8]*=u,eZ.elements[9]*=u,eZ.elements[10]*=u,t.setFromRotationMatrix(eZ),i.x=r,i.y=a,i.z=s,this}makePerspective(e,t,i,n,r,a){let s=this.elements;return s[0]=2*r/(t-e),s[4]=0,s[8]=(t+e)/(t-e),s[12]=0,s[1]=0,s[5]=2*r/(i-n),s[9]=(i+n)/(i-n),s[13]=0,s[2]=0,s[6]=0,s[10]=-(a+r)/(a-r),s[14]=-2*a
1*r/(a-r),s[3]=0,s[7]=0,s[11]=-1,s[15]=0,this}makeOrthographic(e,t,i,n,r,a){let s=this.elements,o=1/(t-e),l=1/(i-n),h=1/(a-r);return s[0]=2*o,s[4]=0,s[8]=0,s[12]=-((t+e)*o),s[1]=0,s[5]=2*l,s[9]=0,s[13]=-((i+n)*l),s[2]=0,s[6]=0,s[10]=-2*h,s[14]=-((a+r)*h),s[3]=0,s[7]=0,s[11]=0,s[15]=1,this}equals(e){let t=this.elements,i=e.elements;for(let n=0;n<16;n++)if(t[n]!==i[n])return!1;return!0}fromArray(e,t=0){for(let i=0;i<16;i++)this.elements[i]=e[i+t];return this}toArray(e=[],t=0){let i=this.elements;return e[t]=i[0],e[t+1]=i[1],e[t+2]=i[2],e[t+3]=i[3],e[t+4]=i[4],e[t+5]=i[5],e[t+6]=i[6],e[t+7]=i[7],e[t+8]=i[8],e[t+9]=i[9],e[t+10]=i[10],e[t+11]=i[11],e[t+12]=i[12],e[t+13]=i[13],e[t+14]=i[14],e[t+15]=i[15],e}}let eY=new eg,eZ=new eX,eJ=new eg(0,0,0),eK=new eg(1,1,1),eQ=new eg,e$=new eg,e0=new eg,e1=new eX,e3=new em;class e2{constructor(e=0,t=0,i=0,n=e2.DefaultOrder){this.isEuler=!0,this._x=e,this._y=t,this._z=i,this._order=n}get x(){return this._x}set x(e){this._x=e,this._onChangeCallback()}get y(){return this._y}set y(e){this._y=e,this._onChangeCallback()}get z(){return this._z}set z(e){this._z=e,this._onChangeCallback()}get order(){return this._order}set order(e){this._order=e,this._onChangeCallback()}set(e,t,i,n=this._order){return this._x=e,this._y=t,this._z=i,this._order=n,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._order)}copy(e){return this._x=e._x,this._y=e._y,this._z=e._z,this._order=e._order,this._onChangeCallback(),this}setFromRotationMatrix(e,t=this._order,i=!0){let n=e.elements,r=n[0],a=n[4],s=n[8],o=n[1],l=n[5],h=n[9],u=n[2],c=n[6],d=n[10];switch(t){case"XYZ":this._y=Math.asin(z(s,-1,1)),.9999999>Math.abs(s)?(this._x=Math.atan2(-h,d),this._z=Math.atan2(-a,r)):(this._x=Math.atan2(c,l),this._z=0);break;case"YXZ":this._x=Math.asin(-z(h,-1,1)),.9999999>Math.abs(h)?(this._y=Math.atan2(s,d),this._z=Math.atan2(o,l)):(this._y=Math.atan2(-u,r),this._z=0);break;case"ZXY":this._x=Math.asin(z(c,-1,1)),.9999999>Math.abs(c)?(this._y=Math.atan2(-u,d),this._z=Math.atan2(-a,l)):(this._y=0,this._z=Math.atan2(o,r));break;case"ZYX":this._y=Math.asin(-z(u,-1,1)),.9999999>Math.abs(u)?(this._x=Math.atan2(c,d),this._z=Math.atan2(o,r)):(this._x=0,this._z=Math.atan2(-a,l));break;case"YZX":this._z=Math.asin(z(o,-1,1)),.9999999>Math.abs(o)?(this._x=Math.atan2(-h,l),this._y=Math.atan2(-u,r)):(this._x=0,this._y=Math.atan2(s,d));break;case"XZY":this._z=Math.asin(-z(a,-1,1)),.9999999>Math.abs(a)?(this._x=Math.atan2(c,l),this._y=Math.atan2(s,r)):(this._x=Math.atan2(-h,d),this._y=0);break;default:console.warn("THREE.Euler: .setFromRotationMatrix() encountered an unknown order: "+t)}return this._order=t,!0===i&&this._onChangeCallback(),this}setFromQuaternion(e,t,i){return e1.makeRotationFromQuaternion(e),this.setFromRotationMatrix(e1,t,i)}setFromVector3(e,t=this._order){return this.set(e.x,e.y,e.z,t)}reorder(e){return e3.setFromEuler(this),this.setFromQuaternion(e3,e)}equals(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._order===this._order}fromArray(e){return this._x=e[0],this._y=e[1],this._z=e[2],void 0!==e[3]&&(this._order=e[3]),this._onChangeCallback(),this}toArray(e=[],t=0){return e[t]=this._x,e[t+1]=this._y,e[t+2]=this._z,e[t+3]=this._order,e}_onChange(e){return this._onChangeCallback=e,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._order}toVector3(){console.error("THREE.Euler: .toVector3() has been removed. Use Vector3.setFromEuler() instead")}}e2.DefaultOrder="XYZ",e2.RotationOrders=["XYZ","YZX","ZXY","XZY","YXZ","ZYX"];class e4{constructor(){this.mask=1}set(e){this.mask=(1<<e|0)>>>0}enable(e){this.mask|=1<<e|0}enableAll(){this.mask=-1}toggle(e){this.mask^=1<<e|0}disable(e){this.mask&=~(1<<e|0)}disableAll(){this.mask=0}test(e){return(this.mask&e.mask)!=0}isEnabled(e){return(this.mask&(1<<e|0))!=0}}let e5=0,e6=new eg,e7=new em,e8=new eX,e9=new eg,te=new eg,tt=new eg,ti=new em,tn=new eg(1,0,0),tr=new eg(0,1,0),ta=new eg(0,0,1),ts={type:"added"},to={type:"removed"};class tl extends P{constructor(){super(),this.isObject3D=!0,Object.defineProperty(this,"id",{value:e5++}),this.uuid=O(),this.name="",this.type="Object3D",this.parent=null,this.children=[],this.up=tl.DefaultUp.clone();let e=new eg,t=new e2,i=new em,n=new eg(1,1,1);t._onChange(function(){i.setFromEuler(t,!1)}),i._onChange(function(){t.setFromQuaternion(i,void 0,!1)}),Object.defineProperties(this,{position:{configurable:!0,enumerable:!0,value:e},rotation:{configurable:!0,enumerable:!0,value:t},quaternion:{configurable:!0,enumerable:!0,value:i},scale:{configurable:!0,enumerable:!0,value:n},modelViewMatrix:{value:new eX},normalMatrix:{value:new q}}),this.matrix=new eX,this.matrixWorld=new eX,this.matrixAutoUpdate=tl.DefaultMatrixAutoUpdate,this.matrixWorldNeedsUpdate=!1,this.layers=new e4,this.visible=!0,this.castShadow=!1,this.receiveShadow=!1,this.frustumCulled=!0,this.renderOrder=0,this.animations=[],this.userData={}}onBeforeRender(){}onAfterRender(){}applyMatrix4(e){this.matrixAutoUpdate&&this.updateMatrix(),this.matrix.premultiply(e),this.matrix.decompose(this.position,this.quaternion,this.scale)}applyQuaternion(e){return this.quaternion.premultiply(e),this}setRotationFromAxisAngle(e,t){this.quaternion.setFromAxisAngle(e,t)}setRotationFromEuler(e){this.quaternion.setFromEuler(e,!0)}
1setRotationFromMatrix(e){this.quaternion.setFromRotationMatrix(e)}setRotationFromQuaternion(e){this.quaternion.copy(e)}rotateOnAxis(e,t){return e7.setFromAxisAngle(e,t),this.quaternion.multiply(e7),this}rotateOnWorldAxis(e,t){return e7.setFromAxisAngle(e,t),this.quaternion.premultiply(e7),this}rotateX(e){return this.rotateOnAxis(tn,e)}rotateY(e){return this.rotateOnAxis(tr,e)}rotateZ(e){return this.rotateOnAxis(ta,e)}translateOnAxis(e,t){return e6.copy(e).applyQuaternion(this.quaternion),this.position.add(e6.multiplyScalar(t)),this}translateX(e){return this.translateOnAxis(tn,e)}translateY(e){return this.translateOnAxis(tr,e)}translateZ(e){return this.translateOnAxis(ta,e)}localToWorld(e){return e.applyMatrix4(this.matrixWorld)}worldToLocal(e){return e.applyMatrix4(e8.copy(this.matrixWorld).invert())}lookAt(e,t,i){e.isVector3?e9.copy(e):e9.set(e,t,i);let n=this.parent;this.updateWorldMatrix(!0,!1),te.setFromMatrixPosition(this.matrixWorld),this.isCamera||this.isLight?e8.lookAt(te,e9,this.up):e8.lookAt(e9,te,this.up),this.quaternion.setFromRotationMatrix(e8),n&&(e8.extractRotation(n.matrixWorld),e7.setFromRotationMatrix(e8),this.quaternion.premultiply(e7.invert()))}add(e){if(arguments.length>1){for(let t=0;t<arguments.length;t++)this.add(arguments[t]);return this}return e===this?(console.error("THREE.Object3D.add: object can't be added as a child of itself.",e),this):(e&&e.isObject3D?(null!==e.parent&&e.parent.remove(e),e.parent=this,this.children.push(e),e.dispatchEvent(ts)):console.error("THREE.Object3D.add: object not an instance of THREE.Object3D.",e),this)}remove(e){if(arguments.length>1){for(let t=0;t<arguments.length;t++)this.remove(arguments[t]);return this}let i=this.children.indexOf(e);return -1!==i&&(e.parent=null,this.children.splice(i,1),e.dispatchEvent(to)),this}removeFromParent(){let e=this.parent;return null!==e&&e.remove(this),this}clear(){for(let e=0;e<this.children.length;e++){let t=this.children[e];t.parent=null,t.dispatchEvent(to)}return this.children.length=0,this}attach(e){return this.updateWorldMatrix(!0,!1),e8.copy(this.matrixWorld).invert(),null!==e.parent&&(e.parent.updateWorldMatrix(!0,!1),e8.multiply(e.parent.matrixWorld)),e.applyMatrix4(e8),this.add(e),e.updateWorldMatrix(!1,!0),this}getObjectById(e){return this.getObjectByProperty("id",e)}getObjectByName(e){return this.getObjectByProperty("name",e)}getObjectByProperty(e,t){if(this[e]===t)return this;for(let i=0,n=this.children.length;i<n;i++){let r=this.children[i],a=r.getObjectByProperty(e,t);if(void 0!==a)return a}}getWorldPosition(e){return this.updateWorldMatrix(!0,!1),e.setFromMatrixPosition(this.matrixWorld)}getWorldQuaternion(e){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(te,e,tt),e}getWorldScale(e){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(te,ti,e),e}getWorldDirection(e){this.updateWorldMatrix(!0,!1);let t=this.matrixWorld.elements;return e.set(t[8],t[9],t[10]).normalize()}raycast(){}traverse(e){e(this);let t=this.children;for(let i=0,n=t.length;i<n;i++)t[i].traverse(e)}traverseVisible(e){if(!1===this.visible)return;e(this);let t=this.children;for(let i=0,n=t.length;i<n;i++)t[i].traverseVisible(e)}traverseAncestors(e){let t=this.parent;null!==t&&(e(t),t.traverseAncestors(e))}updateMatrix(){this.matrix.compose(this.position,this.quaternion,this.scale),this.matrixWorldNeedsUpdate=!0}updateMatrixWorld(e){this.matrixAutoUpdate&&this.updateMatrix(),(this.matrixWorldNeedsUpdate||e)&&(null===this.parent?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix),this.matrixWorldNeedsUpdate=!1,e=!0);let t=this.children;for(let i=0,n=t.length;i<n;i++)t[i].updateMatrixWorld(e)}updateWorldMatrix(e,t){let i=this.parent;if(!0===e&&null!==i&&i.updateWorldMatrix(!0,!1),this.matrixAutoUpdate&&this.updateMatrix(),null===this.parent?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix),!0===t){let n=this.children;for(let r=0,a=n.length;r<a;r++)n[r].updateWorldMatrix(!1,!0)}}toJSON(e){let t=void 0===e||"string"==typeof e,i={};t&&(e={geometries:{},materials:{},textures:{},images:{},shapes:{},skeletons:{},animations:{},nodes:{}},i.metadata={version:4.5,type:"Object",generator:"Object3D.toJSON"});let n={};function r(t,i){return void 0===t[i.uuid]&&(t[i.uuid]=i.toJSON(e)),i.uuid}
1if(n.uuid=this.uuid,n.type=this.type,""!==this.name&&(n.name=this.name),!0===this.castShadow&&(n.castShadow=!0),!0===this.receiveShadow&&(n.receiveShadow=!0),!1===this.visible&&(n.visible=!1),!1===this.frustumCulled&&(n.frustumCulled=!1),0!==this.renderOrder&&(n.renderOrder=this.renderOrder),"{}"!==JSON.stringify(this.userData)&&(n.userData=this.userData),n.layers=this.layers.mask,n.matrix=this.matrix.toArray(),!1===this.matrixAutoUpdate&&(n.matrixAutoUpdate=!1),this.isInstancedMesh&&(n.type="InstancedMesh",n.count=this.count,n.instanceMatrix=this.instanceMatrix.toJSON(),null!==this.instanceColor&&(n.instanceColor=this.instanceColor.toJSON())),this.isScene)this.background&&(this.background.isColor?n.background=this.background.toJSON():this.background.isTexture&&(n.background=this.background.toJSON(e).uuid)),this.environment&&this.environment.isTexture&&!0!==this.environment.isRenderTargetTexture&&(n.environment=this.environment.toJSON(e).uuid);else if(this.isMesh||this.isLine||this.isPoints){n.geometry=r(e.geometries,this.geometry);let a=this.geometry.parameters;if(void 0!==a&&void 0!==a.shapes){let s=a.shapes;if(Array.isArray(s))for(let o=0,l=s.length;o<l;o++){let h=s[o];r(e.shapes,h)}else r(e.shapes,s)}}if(this.isSkinnedMesh&&(n.bindMode=this.bindMode,n.bindMatrix=this.bindMatrix.toArray(),void 0!==this.skeleton&&(r(e.skeletons,this.skeleton),n.skeleton=this.skeleton.uuid)),void 0!==this.material){if(Array.isArray(this.material)){let u=[];for(let c=0,d=this.material.length;c<d;c++)u.push(r(e.materials,this.material[c]));n.material=u}else n.material=r(e.materials,this.material)}if(this.children.length>0){n.children=[];for(let p=0;p<this.children.length;p++)n.children.push(this.children[p].toJSON(e).object)}if(this.animations.length>0){n.animations=[];for(let f=0;f<this.animations.length;f++){let m=this.animations[f];n.animations.push(r(e.animations,m))}}if(t){let g=w(e.geometries),v=w(e.materials),_=w(e.textures),x=w(e.images),y=w(e.shapes),M=w(e.skeletons),b=w(e.animations),S=w(e.nodes);g.length>0&&(i.geometries=g),v.length>0&&(i.materials=v),_.length>0&&(i.textures=_),x.length>0&&(i.images=x),y.length>0&&(i.shapes=y),M.length>0&&(i.skeletons=M),b.length>0&&(i.animations=b),S.length>0&&(i.nodes=S)}return i.object=n,i;function w(e){let t=[];for(let i in e){let n=e[i];delete n.metadata,t.push(n)}return t}}clone(e){return new this.constructor().copy(this,e)}copy(e,t=!0){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(let i=0;i<e.children.length;i++){let n=e.children[i];this.add(n.clone())}return this}}tl.DefaultUp=new eg(0,1,0),tl.DefaultMatrixAutoUpdate=!0;let th=new eg,tu=new eg,tc=new eg,td=new eg,tp=new eg,tf=new eg,tm=new eg,tg=new eg,tv=new eg,t_=new eg;class tx{constructor(e=new eg,t=new eg,i=new eg){this.a=e,this.b=t,this.c=i}static getNormal(e,t,i,n){n.subVectors(i,t),th.subVectors(e,t),n.cross(th);let r=n.lengthSq();return r>0?n.multiplyScalar(1/Math.sqrt(r)):n.set(0,0,0)}static getBarycoord(e,t,i,n,r){th.subVectors(n,t),tu.subVectors(i,t),tc.subVectors(e,t);let a=th.dot(th),s=th.dot(tu),o=th.dot(tc),l=tu.dot(tu),h=tu.dot(tc),u=a*l-s*s;if(0===u)return r.set(-2,-1,-1);let c=1/u,d=(l*o-s*h)*c,p=(a*h-s*o)*c;return r.set(1-d-p,p,d)}static containsPoint(e,t,i,n){return this.getBarycoord(e,t,i,n,td),td.x>=0&&td.y>=0&&td.x+td.y<=1}static getUV(e,t,i,n,r,a,s,o){return this.getBarycoord(e,t,i,n,td),o.set(0,0),o.addScaledVector(r,td.x),o.addScaledVector(a,td.y),o.addScaledVector(s,td.z),o}static isFrontFacing(e,t,i,n){return th.subVectors(i,t),tu.subVectors(e,t),0>th.cross(tu).dot(n)}set(e,t,i){return this.a.copy(e),this.b.copy(t),this.c.copy(i),this}setFromPointsAndIndices(e,t,i,n){return this.a.copy(e[t]),this.b.copy(e[i]),this.c.copy(e[n]),this}setFromAttributeAndIndices(e,t,i,n){return this.a.fromBufferAttribute(e,t),this.b.fromBufferAttribute(e,i),this.c.fromBufferAttribute(e,n),this}clone(){return new this.constructor().copy(this)}copy(e){return this.a.copy(e.a),this.b.copy(e.b),this.c.copy(e.c),this}getArea(){return th.subVectors(this.c,this.b),tu.subVectors(this.a,this.b),.5*th.
1cross(tu).length()}getMidpoint(e){return e.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)}getNormal(e){return tx.getNormal(this.a,this.b,this.c,e)}getPlane(e){return e.setFromCoplanarPoints(this.a,this.b,this.c)}getBarycoord(e,t){return tx.getBarycoord(e,this.a,this.b,this.c,t)}getUV(e,t,i,n,r){return tx.getUV(e,this.a,this.b,this.c,t,i,n,r)}containsPoint(e){return tx.containsPoint(e,this.a,this.b,this.c)}isFrontFacing(e){return tx.isFrontFacing(this.a,this.b,this.c,e)}intersectsBox(e){return e.intersectsTriangle(this)}closestPointToPoint(e,t){let i=this.a,n=this.b,r=this.c,a,s;tp.subVectors(n,i),tf.subVectors(r,i),tg.subVectors(e,i);let o=tp.dot(tg),l=tf.dot(tg);if(o<=0&&l<=0)return t.copy(i);tv.subVectors(e,n);let h=tp.dot(tv),u=tf.dot(tv);if(h>=0&&u<=h)return t.copy(n);let c=o*u-h*l;if(c<=0&&o>=0&&h<=0)return a=o/(o-h),t.copy(i).addScaledVector(tp,a);t_.subVectors(e,r);let d=tp.dot(t_),p=tf.dot(t_);if(p>=0&&d<=p)return t.copy(r);let f=d*l-o*p;if(f<=0&&l>=0&&p<=0)return s=l/(l-p),t.copy(i).addScaledVector(tf,s);let m=h*p-d*u;if(m<=0&&u-h>=0&&d-p>=0)return tm.subVectors(r,n),s=(u-h)/(u-h+(d-p)),t.copy(n).addScaledVector(tm,s);let g=1/(m+f+c);return a=f*g,s=c*g,t.copy(i).addScaledVector(tp,a).addScaledVector(tf,s)}equals(e){return e.a.equals(this.a)&&e.b.equals(this.b)&&e.c.equals(this.c)}}let ty=0;class tM extends P{constructor(){super(),this.isMaterial=!0,Object.defineProperty(this,"id",{value:ty++}),this.uuid=O(),this.name="",this.type="Material",this.blending=1,this.side=s,this.vertexColors=!1,this.opacity=1,this.transparent=!1,this.blendSrc=204,this.blendDst=205,this.blendEquation=100,this.blendSrcAlpha=null,this.blendDstAlpha=null,this.blendEquationAlpha=null,this.depthFunc=3,this.depthTest=!0,this.depthWrite=!0,this.stencilWriteMask=255,this.stencilFunc=519,this.stencilRef=0,this.stencilFuncMask=255,this.stencilFail=7680,this.stencilZFail=7680,this.stencilZPass=7680,this.stencilWrite=!1,this.clippingPlanes=null,this.clipIntersection=!1,this.clipShadows=!1,this.shadowSide=null,this.colorWrite=!0,this.precision=null,this.polygonOffset=!1,this.polygonOffsetFactor=0,this.polygonOffsetUnits=0,this.dithering=!1,this.alphaToCoverage=!1,this.premultipliedAlpha=!1,this.visible=!0,this.toneMapped=!0,this.userData={},this.version=0,this._alphaTest=0}get alphaTest(){return this._alphaTest}set alphaTest(e){this._alphaTest>0!=e>0&&this.version++,this._alphaTest=e}onBuild(){}onBeforeRender(){}onBeforeCompile(){}customProgramCacheKey(){return this.onBeforeCompile.toString()}setValues(e){if(void 0!==e)for(let t in e){let i=e[t];if(void 0===i){console.warn("THREE.Material: '"+t+"' parameter is undefined.");continue}if("shading"===t){console.warn("THREE."+this.type+": .shading has been removed. Use the boolean .flatShading instead."),this.flatShading=1===i;continue}let n=this[t];if(void 0===n){console.warn("THREE."+this.type+": '"+t+"' is not a property of this material.");continue}n&&n.isColor?n.set(i):n&&n.isVector3&&i&&i.isVector3?n.copy(i):this[t]=i}}toJSON(e){let t=void 0===e||"string"==typeof e;t&&(e={textures:{},images:{}});let i={metadata:{version:4.5,type:"Material",generator:"Material.toJSON"}};function n(e){let t=[];for(let i in e){let n=e[i];delete n.metadata,t.push(n)}return t}
1if(i.uuid=this.uuid,i.type=this.type,""!==this.name&&(i.name=this.name),this.color&&this.color.isColor&&(i.color=this.color.getHex()),void 0!==this.roughness&&(i.roughness=this.roughness),void 0!==this.metalness&&(i.metalness=this.metalness),void 0!==this.sheen&&(i.sheen=this.sheen),this.sheenColor&&this.sheenColor.isColor&&(i.sheenColor=this.sheenColor.getHex()),void 0!==this.sheenRoughness&&(i.sheenRoughness=this.sheenRoughness),this.emissive&&this.emissive.isColor&&(i.emissive=this.emissive.getHex()),this.emissiveIntensity&&1!==this.emissiveIntensity&&(i.emissiveIntensity=this.emissiveIntensity),this.specular&&this.specular.isColor&&(i.specular=this.specular.getHex()),void 0!==this.specularIntensity&&(i.specularIntensity=this.specularIntensity),this.specularColor&&this.specularColor.isColor&&(i.specularColor=this.specularColor.getHex()),void 0!==this.shininess&&(i.shininess=this.shininess),void 0!==this.clearcoat&&(i.clearcoat=this.clearcoat),void 0!==this.clearcoatRoughness&&(i.clearcoatRoughness=this.clearcoatRoughness),this.clearcoatMap&&this.clearcoatMap.isTexture&&(i.clearcoatMap=this.clearcoatMap.toJSON(e).uuid),this.clearcoatRoughnessMap&&this.clearcoatRoughnessMap.isTexture&&(i.clearcoatRoughnessMap=this.clearcoatRoughnessMap.toJSON(e).uuid),this.clearcoatNormalMap&&this.clearcoatNormalMap.isTexture&&(i.clearcoatNormalMap=this.clearcoatNormalMap.toJSON(e).uuid,i.clearcoatNormalScale=this.clearcoatNormalScale.toArray()),void 0!==this.iridescence&&(i.iridescence=this.iridescence),void 0!==this.iridescenceIOR&&(i.iridescenceIOR=this.iridescenceIOR),void 0!==this.iridescenceThicknessRange&&(i.iridescenceThicknessRange=this.iridescenceThicknessRange),this.iridescenceMap&&this.iridescenceMap.isTexture&&(i.iridescenceMap=this.iridescenceMap.toJSON(e).uuid),this.iridescenceThicknessMap&&this.iridescenceThicknessMap.isTexture&&(i.iridescenceThicknessMap=this.iridescenceThicknessMap.toJSON(e).uuid),this.map&&this.map.isTexture&&(i.map=this.map.toJSON(e).uuid),this.matcap&&this.matcap.isTexture&&(i.matcap=this.matcap.toJSON(e).uuid),this.alphaMap&&this.alphaMap.isTexture&&(i.alphaMap=this.alphaMap.toJSON(e).uuid),this.lightMap&&this.lightMap.isTexture&&(i.lightMap=this.lightMap.toJSON(e).uuid,i.lightMapIntensity=this.lightMapIntensity),this.aoMap&&this.aoMap.isTexture&&(i.aoMap=this.aoMap.toJSON(e).uuid,i.aoMapIntensity=this.aoMapIntensity),this.bumpMap&&this.bumpMap.isTexture&&(i.bumpMap=this.bumpMap.toJSON(e).uuid,i.bumpScale=this.bumpScale),this.normalMap&&this.normalMap.isTexture&&(i.normalMap=this.normalMap.toJSON(e).uuid,i.normalMapType=this.normalMapType,i.normalScale=this.normalScale.toArray()),this.displacementMap&&this.displacementMap.isTexture&&(i.displacementMap=this.displacementMap.toJSON(e).uuid,i.displacementScale=this.displacementScale,i.displacementBias=this.displacementBias),this.roughnessMap&&this.roughnessMap.isTexture&&(i.roughnessMap=this.roughnessMap.toJSON(e).uuid),this.metalnessMap&&this.metalnessMap.isTexture&&(i.metalnessMap=this.metalnessMap.toJSON(e).uuid),this.emissiveMap&&this.emissiveMap.isTexture&&(i.emissiveMap=this.emissiveMap.toJSON(e).uuid),this.specularMap&&this.specularMap.isTexture&&(i.specularMap=this.specularMap.toJSON(e).uuid),this.specularIntensityMap&&this.specularIntensityMap.isTexture&&(i.specularIntensityMap=this.specularIntensityMap.toJSON(e).uuid),this.specularColorMap&&this.specularColorMap.isTexture&&(i.specularColorMap=this.specularColorMap.toJSON(e).uuid),this.envMap&&this.envMap.isTexture&&(i.envMap=this.envMap.toJSON(e).uuid,void 0!==this.combine&&(i.combine=this.combine)),void 0!==this.envMapIntensity&&(i.envMapIntensity=this.envMapIntensity),void 0!==this.reflectivity&&(i.reflectivity=this.reflectivity),void 0!==this.refractionRatio&&(i.refractionRatio=this.refractionRatio),this.gradientMap&&this.gradientMap.isTexture&&(i.gradientMap=this.gradientMap.toJSON(e).uuid),void 0!==this.transmission&&(i.transmission=this.transmission),this.transmissionMap&&this.transmissionMap.isTexture&&(i.transmissionMap=this.transmissionMap.toJSON(e).uuid),void 0!==this.thickness&&(i.thickness=this.thickness),this.thicknessMap&&this.thicknessMap.isTexture&&(i.thicknessMap=this.thicknessMap.toJSON(e).uuid),void 0!==this.attenuationDistance&&(i.attenuationDistance=this.attenuationDistance),void 0!==this.attenuationColor&&(i.attenuationColor=this.attenuationColor.getHex()),void 0!==this.size&&(i.size=this.size),null!==this.shadowSide&&(i.shadowSide=this.shadowSide),void 0!==this.sizeAttenuation&&(i.sizeAttenuation=this.sizeAttenuation),1!==this.blending&&(i.blending=this.blending),this.side!==s&&(i.side=this.side),this.vertexColors&&(i.vertexColors=!0),this.opacity<1&&(i.opacity=this.opacity),!0===this.transparent&&(i.transparent=this.transparent),i.depthFunc=this.depthFunc,i.depthTest=this.depthTest,i.depthWrite=this.depthWrite,i.colorWrite=this.colorWrite,i.stencilWrite=this.stencilWrite,i.stencilWriteMask=this.stencilWriteMask,i.stencilFunc=this.stencilFunc,i.stencilRef=this.stencilRef,i.stencilFuncMask=this.stencilFuncMask,i.stencilFail=this.stencilFail,i.stencilZFail=this.stencilZFail,i.stencilZPass=this.stencilZPass,void 0!==this.rotation&&0!==this.rotation&&(i.rotation=this.rotation),!0===this.polygonOffset&&(i.polygonOffset=!0),0!==this.polygonOffsetFactor&&(i.polygonOffsetFactor=this.polygonOffsetFactor),0!==this.polygonOffsetUnits&&(i.polygonOffsetUnits=this.polygonOffsetUnits),void 0!==this.linewidth&&1!==this.linewidth&&(i.linewidth=this.linewidth),void 0!==this.dashSize&&(i.dashSize=this.dashSize),void 0!==this.gapSize&&(i.gapSize=this.gapSize),void 0!==this.scale&&(i.scale=this.scale),!0===this.dithering&&(i.dithering=!0),this.alphaTest>0&&(i.alphaTest=this.alphaTest),!0===this.alphaToCoverage&&(i.alphaToCoverage=this.alphaToCoverage),!0===this.premultipliedAlpha&&(i.premultipliedAlpha=this.premultipliedAlpha),!0===this.wireframe&&(i.wireframe=this.wireframe),this.wireframeLinewidth>1&&(i.wireframeLinewidth=this.wireframeLinewidth),"round"!==this.wireframeLinecap&&(i.wireframeLinecap=this.wireframeLinecap),"round"!==this.wireframeLinejoin&&(i.wireframeLinejoin=this.wireframeLinejoin),!0===this.flatShading&&(i.flatShading=this.flatShading),!1===this.visible&&(i.visible=!1),!1===this.toneMapped&&(i.toneMapped=!1),!1===this.fog&&(i.fog=!1),"{}"!==JSON.stringify(this.userData)&&(i.userData=this.userData),t){let r=n(e.textures),a=n(e.images);r.length>0&&(i.textures=r),a.length>0&&(i.images=a)}return i}clone(){return new this.constructor().copy(this)}copy(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;let t=e.clippingPlanes,i=null;if(null!==t){let n=t.length;i=Array(n);for(let r=0;r!==n;++r)i[r]=t[r].clone()}return this.clippingPlanes=i,this.clipIntersection=e.clipIntersection,this.clipShadows=e.clipSh
1adows,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}dispose(){this.dispatchEvent({type:"dispose"})}set needsUpdate(e){!0===e&&this.version++}}class tb extends tM{constructor(e){super(),this.isMeshBasicMaterial=!0,this.type="MeshBasicMaterial",this.color=new ea(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.combine=0,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.fog=!0,this.setValues(e)}copy(e){return super.copy(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}}let tS=new eg,tw=new j;class tT{constructor(e,t,i){if(Array.isArray(e))throw TypeError("THREE.BufferAttribute: array should be a Typed Array.");this.isBufferAttribute=!0,this.name="",this.array=e,this.itemSize=t,this.count=void 0!==e?e.length/t:0,this.normalized=!0===i,this.usage=35044,this.updateRange={offset:0,count:-1},this.version=0}onUploadCallback(){}set needsUpdate(e){!0===e&&this.version++}setUsage(e){return this.usage=e,this}copy(e){return this.name=e.name,this.array=new e.array.constructor(e.array),this.itemSize=e.itemSize,this.count=e.count,this.normalized=e.normalized,this.usage=e.usage,this}copyAt(e,t,i){e*=this.itemSize,i*=t.itemSize;for(let n=0,r=this.itemSize;n<r;n++)this.array[e+n]=t.array[i+n];return this}copyArray(e){return this.array.set(e),this}copyColorsArray(e){let t=this.array,i=0;for(let n=0,r=e.length;n<r;n++){let a=e[n];void 0===a&&(console.warn("THREE.BufferAttribute.copyColorsArray(): color is undefined",n),a=new ea),t[i++]=a.r,t[i++]=a.g,t[i++]=a.b}return this}copyVector2sArray(e){let t=this.array,i=0;for(let n=0,r=e.length;n<r;n++){let a=e[n];void 0===a&&(console.warn("THREE.BufferAttribute.copyVector2sArray(): vector is undefined",n),a=new j),t[i++]=a.x,t[i++]=a.y}return this}copyVector3sArray(e){let t=this.array,i=0;for(let n=0,r=e.length;n<r;n++){let a=e[n];void 0===a&&(console.warn("THREE.BufferAttribute.copyVector3sArray(): vector is undefined",n),a=new eg),t[i++]=a.x,t[i++]=a.y,t[i++]=a.z}return this}copyVector4sArray(e){let t=this.array,i=0;for(let n=0,r=e.length;n<r;n++){let a=e[n];void 0===a&&(console.warn("THREE.BufferAttribute.copyVector4sArray(): vector is undefined",n),a=new ed),t[i++]=a.x,t[i++]=a.y,t[i++]=a.z,t[i++]=a.w}return this}applyMatrix3(e){if(2===this.itemSize)for(let t=0,i=this.count;t<i;t++)tw.fromBufferAttribute(this,t),tw.applyMatrix3(e),this.setXY(t,tw.x,tw.y);else if(3===this.itemSize)for(let n=0,r=this.count;n<r;n++)tS.fromBufferAttribute(this,n),tS.applyMatrix3(e),this.setXYZ(n,tS.x,tS.y,tS.z);return this}applyMatrix4(e){for(let t=0,i=this.count;t<i;t++)tS.fromBufferAttribute(this,t),tS.applyMatrix4(e),this.setXYZ(t,tS.x,tS.y,tS.z);return this}applyNormalMatrix(e){for(let t=0,i=this.count;t<i;t++)tS.fromBufferAttribute(this,t),tS.applyNormalMatrix(e),this.setXYZ(t,tS.x,tS.y,tS.z);return this}transformDirection(e){for(let t=0,i=this.count;t<i;t++)tS.fromBufferAttribute(this,t),tS.transformDirection(e),this.setXYZ(t,tS.x,tS.y,tS.z);return this}set(e,t=0){return this.array.set(e,t),this}getX(e){return this.array[e*this.itemSize]}setX(e,t){return this.array[e*this.itemSize]=t,this}getY(e){return this.array[e*this.itemSize+1]}setY(e,t){return this.array[e*this.itemSize+1]=t,this}getZ(e){return this.array[e*this.itemSize+2]}setZ(e,t){return this.array[e*this.itemSize+2]=t,this}getW(e){return this.array[e*this.itemSize+3]}setW(e,t){return this.array[e*this.itemSize+3]=t,this}setXY(e,t,i){return e*=this.itemSize,this.array[e+0]=t,this.array[e+1]=i,this}setXYZ(e,t,i,n){return e*=this.itemSize,this.array[e+0]=t,this.array[e+1]=i,this.array[e+2]=n,this}setXYZW(e,t,i,n,r){return e*=this.itemSize,this.array[e+0]=t,this.array[e+1]=i,this.array[e+2]=n,this.array[e+3]=r,this}
1onUpload(e){return this.onUploadCallback=e,this}clone(){return new this.constructor(this.array,this.itemSize).copy(this)}toJSON(){let e={itemSize:this.itemSize,type:this.array.constructor.name,array:Array.from(this.array),normalized:this.normalized};return""!==this.name&&(e.name=this.name),35044!==this.usage&&(e.usage=this.usage),(0!==this.updateRange.offset||-1!==this.updateRange.count)&&(e.updateRange=this.updateRange),e}}class tE extends tT{constructor(e,t,i){super(new Uint16Array(e),t,i)}}class tA extends tT{constructor(e,t,i){super(new Uint32Array(e),t,i)}}class tC extends tT{constructor(e,t,i){super(new Float32Array(e),t,i)}}let tL=0,tP=new eX,tR=new tl,tD=new eg,tI=new ex,tN=new ex,tO=new eg;class tz extends P{constructor(){super(),this.isBufferGeometry=!0,Object.defineProperty(this,"id",{value:tL++}),this.uuid=O(),this.name="",this.type="BufferGeometry",this.index=null,this.attributes={},this.morphAttributes={},this.morphTargetsRelative=!1,this.groups=[],this.boundingBox=null,this.boundingSphere=null,this.drawRange={start:0,count:1/0},this.userData={}}getIndex(){return this.index}setIndex(e){return Array.isArray(e)?this.index=new(X(e)?tA:tE)(e,1):this.index=e,this}getAttribute(e){return this.attributes[e]}setAttribute(e,t){return this.attributes[e]=t,this}deleteAttribute(e){return delete this.attributes[e],this}hasAttribute(e){return void 0!==this.attributes[e]}addGroup(e,t,i=0){this.groups.push({start:e,count:t,materialIndex:i})}clearGroups(){this.groups=[]}setDrawRange(e,t){this.drawRange.start=e,this.drawRange.count=t}applyMatrix4(e){let t=this.attributes.position;void 0!==t&&(t.applyMatrix4(e),t.needsUpdate=!0);let i=this.attributes.normal;if(void 0!==i){let n=new q().getNormalMatrix(e);i.applyNormalMatrix(n),i.needsUpdate=!0}let r=this.attributes.tangent;return void 0!==r&&(r.transformDirection(e),r.needsUpdate=!0),null!==this.boundingBox&&this.computeBoundingBox(),null!==this.boundingSphere&&this.computeBoundingSphere(),this}applyQuaternion(e){return tP.makeRotationFromQuaternion(e),this.applyMatrix4(tP),this}rotateX(e){return tP.makeRotationX(e),this.applyMatrix4(tP),this}rotateY(e){return tP.makeRotationY(e),this.applyMatrix4(tP),this}rotateZ(e){return tP.makeRotationZ(e),this.applyMatrix4(tP),this}translate(e,t,i){return tP.makeTranslation(e,t,i),this.applyMatrix4(tP),this}scale(e,t,i){return tP.makeScale(e,t,i),this.applyMatrix4(tP),this}lookAt(e){return tR.lookAt(e),tR.updateMatrix(),this.applyMatrix4(tR.matrix),this}center(){return this.computeBoundingBox(),this.boundingBox.getCenter(tD).negate(),this.translate(tD.x,tD.y,tD.z),this}setFromPoints(e){let t=[];for(let i=0,n=e.length;i<n;i++){let r=e[i];t.push(r.x,r.y,r.z||0)}return this.setAttribute("position",new tC(t,3)),this}computeBoundingBox(){null===this.boundingBox&&(this.boundingBox=new ex);let e=this.attributes.position,t=this.morphAttributes.position;if(e&&e.isGLBufferAttribute){console.error('THREE.BufferGeometry.computeBoundingBox(): GLBufferAttribute requires a manual bounding box. Alternatively set "mesh.frustumCulled" to "fal
1se".',this),this.boundingBox.set(new eg(-1/0,-1/0,-1/0),new eg(Infinity,Infinity,Infinity));return}if(void 0!==e){if(this.boundingBox.setFromBufferAttribute(e),t)for(let i=0,n=t.length;i<n;i++){let r=t[i];tI.setFromBufferAttribute(r),this.morphTargetsRelative?(tO.addVectors(this.boundingBox.min,tI.min),this.boundingBox.expandByPoint(tO),tO.addVectors(this.boundingBox.max,tI.max),this.boundingBox.expandByPoint(tO)):(this.boundingBox.expandByPoint(tI.min),this.boundingBox.expandByPoint(tI.max))}}else this.boundingBox.makeEmpty();(isNaN(this.boundingBox.min.x)||isNaN(this.boundingBox.min.y)||isNaN(this.boundingBox.min.z))&&console.error('THREE.BufferGeometry.computeBoundingBox(): Computed min/max have NaN values. The "position" attribute is likely to have NaN values.',this)}computeBoundingSphere(){null===this.boundingSphere&&(this.boundingSphere=new eF);let e=this.attributes.position,t=this.morphAttributes.position;if(e&&e.isGLBufferAttribute){console.error('THREE.BufferGeometry.computeBoundingSphere(): GLBufferAttribute requires a manual bounding sphere. Alternatively set "mesh.frustumCulled" to "fal
1se".',this),this.boundingSphere.set(new eg,1/0);return}if(e){let i=this.boundingSphere.center;if(tI.setFromBufferAttribute(e),t)for(let n=0,r=t.length;n<r;n++){let a=t[n];tN.setFromBufferAttribute(a),this.morphTargetsRelative?(tO.addVectors(tI.min,tN.min),tI.expandByPoint(tO),tO.addVectors(tI.max,tN.max),tI.expandByPoint(tO)):(tI.expandByPoint(tN.min),tI.expandByPoint(tN.max))}tI.getCenter(i);let s=0;for(let o=0,l=e.count;o<l;o++)tO.fromBufferAttribute(e,o),s=Math.max(s,i.distanceToSquared(tO));if(t)for(let h=0,u=t.length;h<u;h++){let c=t[h],d=this.morphTargetsRelative;for(let p=0,f=c.count;p<f;p++)tO.fromBufferAttribute(c,p),d&&(tD.fromBufferAttribute(e,p),tO.add(tD)),s=Math.max(s,i.distanceToSquared(tO))}this.boundingSphere.radius=Math.sqrt(s),isNaN(this.boundingSphere.radius)&&console.error('THREE.BufferGeometry.computeBoundingSphere(): Computed radius is NaN. The "position" attribute is likely to have NaN values.',this)}}computeTangents(){let e=this.index,t=this.attributes;if(null===e||void 0===t.position||void 0===t.normal||void 0===t.uv){console.error("THREE.BufferGeometry: .computeTangents() failed. Missing required attributes (index, position, normal or uv)");return}let i=e.array,n=t.position.array,r=t.normal.array,a=t.uv.array,s=n.length/3;!1===this.hasAttribute("tangent")&&this.setAttribute("tangent",new tT(new Float32Array(4*s),4));let o=this.getAttribute("tangent").array,l=[],h=[];for(let u=0;u<s;u++)l[u]=new eg,h[u]=new eg;let c=new eg,d=new eg,p=new eg,f=new j,m=new j,g=new j,v=new eg,_=new eg;function x(e,t,i){c.fromArray(n,3*e),d.fromArray(n,3*t),p.fromArray(n,3*i),f.fromArray(a,2*e),m.fromArray(a,2*t),g.fromArray(a,2*i),d.sub(c),p.sub(c),m.sub(f),g.sub(f);let r=1/(m.x*g.y-g.x*m.y);isFinite(r)&&(v.copy(d).multiplyScalar(g.y).addScaledVector(p,-m.y).multiplyScalar(r),_.copy(p).multiplyScalar(m.x).addScaledVector(d,-g.x).multiplyScalar(r),l[e].add(v),l[t].add(v),l[i].add(v),h[e].add(_),h[t].add(_),h[i].add(_))}let y=this.groups;0===y.length&&(y=[{start:0,count:i.length}]);for(let M=0,b=y.length;M<b;++M){let S=y[M],w=S.start,T=S.count;for(let E=w,A=w+T;E<A;E+=3)x(i[E+0],i[E+1],i[E+2])}let C=new eg,L=new eg,P=new eg,R=new eg;function D(e){P.fromArray(r,3*e),R.copy(P);let t=l[e];C.copy(t),C.sub(P.multiplyScalar(P.dot(t))).normalize(),L.crossVectors(R,t);let i=L.dot(h[e]);o[4*e]=C.x,o[4*e+1]=C.y,o[4*e+2]=C.z,o[4*e+3]=i<0?-1:1}for(let I=0,N=y.length;I<N;++I){let O=y[I],z=O.start,U=O.count;for(let F=z,B=z+U;F<B;F+=3)D(i[F+0]),D(i[F+1]),D(i[F+2])}}computeVertexNormals(){let e=this.index,t=this.getAttribute("position");if(void 0!==t){let i=this.getAttribute("normal");if(void 0===i)i=new tT(new Float32Array(3*t.count),3),this.setAttribute("normal",i);else for(let n=0,r=i.count;n<r;n++)i.setXYZ(n,0,0,0);let a=new eg,s=new eg,o=new eg,l=new eg,h=new eg,u=new eg,c=new eg,d=new eg;if(e)for(let p=0,f=e.count;p<f;p+=3){let m=e.getX(p+0),g=e.getX(p+1),v=e.getX(p+2);a.fromBufferAttribute(t,m),s.fromBufferAttribute(t,g),o.fromBufferAttribute(t,v),c.subVectors(o,s),d.subVectors(a,s),c.cross(d),l.fromBufferAttribute(i,m),h.fromBufferAttribute(i,g),u.fromBufferAttribute(i,v),l.add(c),h.add(c),u.add(c),i.setXYZ(m,l.x,l.y,l.z),i.setXYZ(g,h.x,h.y,h.z),i.setXYZ(v,u.x,u.y,u.z)}else for(let _=0,x=t.count;_<x;_+=3)a.fromBufferAttribute(t,_+0),s.fromBufferAttribute(t,_+1),o.fromBufferAttribute(t,_+2),c.subVectors(o,s),d.subVectors(a,s),c.cross(d),i.setXYZ(_+0,c.x,c.y,c.z),i.setXYZ(_+1,c.x,c.y,c.z),i.setXYZ(_+2,c.x,c.y,c.z);this.normalizeNormals(),i.needsUpdate=!0}}merge(e,t){if(!(e&&e.isBufferGeometry)){console.error("THREE.BufferGeometry.merge(): geometry not an instance of THREE.BufferGeometry.",e);return}void 0===t&&(t=0,console.warn("THREE.BufferGeometry.merge(): Overwriting original geometry, starting at offset=0. Use BufferGeometryUtils.mergeBufferGeometries() for lossless merge."));let i=this.attributes;for(let n in i){if(void 0===e.attributes[n])continue;let r=i[n],a=r.array,s=e.attributes[n],o=s.array,l=s.itemSize*t,h=Math.min(o.length,a.length-l);for(let u=0,c=l;u<h;u++,c++)a[c]=o[u]}return this}normalizeNormals(){let e=this.attributes.normal;for(let t=0,i=e.count;t<i;t++)tO.fromBufferAttribute(e,t),tO.normalize(),e.setXYZ(t,tO.x,tO.y,tO.z)}toNonIndexed(){function e(e,t){let i=e.array,n=e.itemSize,r=e.normalized,a=new i.constructor(t.length*n),s=0,o=0;for(let l=0,h=t.length;l<h;l++){s=e.isInterleavedBufferAttribute?t[l]*e.data.stride+e.offset:t[l]*n;for(let u=0;u<n;u++)a[o++]=i[s++]}return new tT(a,n,r)}if(null===this.index)return console.warn("THREE.BufferGeometry.toNonIndexed(): BufferGeometry is already non-indexed."),this;let t=new tz,i=this.index.array,n=this.attributes;for(let r in n){let a=n[r],s=e(a,i);t.setAttribute(r,s)}let o=this.morphAttributes;for(let l in o){let h=[],u=o[l];for(let c=0,d=u.length;c<d;c++){let p=u[c],f=e(p,i);h.push(f)}t.morphAttributes[l]=h}t.morphTargetsRelative=this.morphTargetsRelative;let m=this.groups;for(let g=0,v=m.length;g<v;g++){let _=m[g];t.addGroup(_.start,_.count,_.materialIndex)}return t}toJSON(){let e={metadata:{version:4.5,type:"BufferGeometry",generator:"BufferGeometry.toJSON"}};
1if(e.uuid=this.uuid,e.type=this.type,""!==this.name&&(e.name=this.name),Object.keys(this.userData).length>0&&(e.userData=this.userData),void 0!==this.parameters){let t=this.parameters;for(let i in t)void 0!==t[i]&&(e[i]=t[i]);return e}e.data={attributes:{}};let n=this.index;null!==n&&(e.data.index={type:n.array.constructor.name,array:Array.prototype.slice.call(n.array)});let r=this.attributes;for(let a in r){let s=r[a];e.data.attributes[a]=s.toJSON(e.data)}let o={},l=!1;for(let h in this.morphAttributes){let u=this.morphAttributes[h],c=[];for(let d=0,p=u.length;d<p;d++){let f=u[d];c.push(f.toJSON(e.data))}c.length>0&&(o[h]=c,l=!0)}l&&(e.data.morphAttributes=o,e.data.morphTargetsRelative=this.morphTargetsRelative);let m=this.groups;m.length>0&&(e.data.groups=JSON.parse(JSON.stringify(m)));let g=this.boundingSphere;return null!==g&&(e.data.boundingSphere={center:g.center.toArray(),radius:g.radius}),e}clone(){return new this.constructor().copy(this)}copy(e){this.index=null,this.attributes={},this.morphAttributes={},this.groups=[],this.boundingBox=null,this.boundingSphere=null;let t={};this.name=e.name;let i=e.index;null!==i&&this.setIndex(i.clone(t));let n=e.attributes;for(let r in n){let a=n[r];this.setAttribute(r,a.clone(t))}let s=e.morphAttributes;for(let o in s){let l=[],h=s[o];for(let u=0,c=h.length;u<c;u++)l.push(h[u].clone(t));this.morphAttributes[o]=l}this.morphTargetsRelative=e.morphTargetsRelative;let d=e.groups;for(let p=0,f=d.length;p<f;p++){let m=d[p];this.addGroup(m.start,m.count,m.materialIndex)}let g=e.boundingBox;null!==g&&(this.boundingBox=g.clone());let v=e.boundingSphere;return null!==v&&(this.boundingSphere=v.clone()),this.drawRange.start=e.drawRange.start,this.drawRange.count=e.drawRange.count,this.userData=e.userData,void 0!==e.parameters&&(this.parameters=Object.assign({},e.parameters)),this}dispose(){this.dispatchEvent({type:"dispose"})}}let tU=new eX,tF=new eq,tB=new eF,tk=new eg,tV=new eg,tG=new eg,tH=new eg,tW=new eg,tj=new eg,tq=new eg,tX=new eg,tY=new eg,tZ=new j,tJ=new j,tK=new j,tQ=new eg,t$=new eg;class t0 extends tl{constructor(e=new tz,t=new tb){super(),this.isMesh=!0,this.type="Mesh",this.geometry=e,this.material=t,this.updateMorphTargets()}copy(e,t){return super.copy(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}updateMorphTargets(){let e=this.geometry,t=e.morphAttributes,i=Object.keys(t);if(i.length>0){let n=t[i[0]];if(void 0!==n){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let r=0,a=n.length;r<a;r++){let s=n[r].name||String(r);this.morphTargetInfluences.push(0),this.morphTargetDictionary[s]=r}}}}raycast(e,t){let i=this.geometry,n=this.material,r=this.matrixWorld;if(void 0===n||(null===i.boundingSphere&&i.computeBoundingSphere(),tB.copy(i.boundingSphere),tB.applyMatrix4(r),!1===e.ray.intersectsSphere(tB))||(tU.copy(r).invert(),tF.copy(e.ray).applyMatrix4(tU),null!==i.boundingBox&&!1===tF.intersectsBox(i.boundingBox)))return;let a,s=i.index,o=i.attributes.position,l=i.morphAttributes.position,h=i.morphTargetsRelative,u=i.attributes.uv,c=i.attributes.uv2,d=i.groups,p=i.drawRange;if(null!==s){if(Array.isArray(n))for(let f=0,m=d.length;f<m;f++){let g=d[f],v=n[g.materialIndex],_=Math.max(g.start,p.start),x=Math.min(s.count,Math.min(g.start+g.count,p.start+p.count));for(let y=_;y<x;y+=3){let M=s.getX(y),b=s.getX(y+1),S=s.getX(y+2);(a=t1(this,v,e,tF,o,l,h,u,c,M,b,S))&&(a.faceIndex=Math.floor(y/3),a.face.materialIndex=g.materialIndex,t.push(a))}}else{let w=Math.max(0,p.start),T=Math.min(s.count,p.start+p.count);for(let E=w;E<T;E+=3){let A=s.getX(E),C=s.getX(E+1),L=s.getX(E+2);(a=t1(this,n,e,tF,o,l,h,u,c,A,C,L))&&(a.faceIndex=Math.floor(E/3),t.push(a))}}}else if(void 0!==o){if(Array.isArray(n))for(let P=0,R=d.length;P<R;P++){let D=d[P],I=n[D.materialIndex],N=Math.max(D.start,p.start),O=Math.min(o.count,Math.min(D.start+D.count,p.start+p.count));for(let z=N;z<O;z+=3){let U=z+1,F=z+2;(a=t1(this,I,e,tF,o,l,h,u,c,z,U,F))&&(a.faceIndex=Math.floor(z/3),a.face.materialIndex=D.materialIndex,t.push(a))}}else{let B=Math.max(0,p.start),k=Math.min(o.count,p.start+p.count);for(let V=B;V<k;V+=3){let G=V+1,H=V+2;(a=t1(this,n,e,tF,o,l,h,u,c,V,G,H))&&(a.faceIndex=Math.floor(V/3),t.pu
1sh(a))}}}}}function t1(e,t,i,n,r,a,s,h,u,c,d,p){tk.fromBufferAttribute(r,c),tV.fromBufferAttribute(r,d),tG.fromBufferAttribute(r,p);let f=e.morphTargetInfluences;if(a&&f){tq.set(0,0,0),tX.set(0,0,0),tY.set(0,0,0);for(let m=0,g=a.length;m<g;m++){let v=f[m],_=a[m];0!==v&&(tH.fromBufferAttribute(_,c),tW.fromBufferAttribute(_,d),tj.fromBufferAttribute(_,p),s?(tq.addScaledVector(tH,v),tX.addScaledVector(tW,v),tY.addScaledVector(tj,v)):(tq.addScaledVector(tH.sub(tk),v),tX.addScaledVector(tW.sub(tV),v),tY.addScaledVector(tj.sub(tG),v)))}tk.add(tq),tV.add(tX),tG.add(tY)}e.isSkinnedMesh&&(e.boneTransform(c,tk),e.boneTransform(d,tV),e.boneTransform(p,tG));let x=function(e,t,i,n,r,a,s,h){let u;if(null===(t.side===o?n.intersectTriangle(s,a,r,!0,h):n.intersectTriangle(r,a,s,t.side!==l,h)))return null;t$.copy(h),t$.applyMatrix4(e.matrixWorld);let c=i.ray.origin.distanceTo(t$);return c<i.near||c>i.far?null:{distance:c,point:t$.clone(),object:e}}(e,t,i,n,tk,tV,tG,tQ);if(x){h&&(tZ.fromBufferAttribute(h,c),tJ.fromBufferAttribute(h,d),tK.fromBufferAttribute(h,p),x.uv=tx.getUV(tQ,tk,tV,tG,tZ,tJ,tK,new j)),u&&(tZ.fromBufferAttribute(u,c),tJ.fromBufferAttribute(u,d),tK.fromBufferAttribute(u,p),x.uv2=tx.getUV(tQ,tk,tV,tG,tZ,tJ,tK,new j));let y={a:c,b:d,c:p,normal:new eg,materialIndex:0};tx.getNormal(tk,tV,tG,y.normal),x.face=y}return x}class t3 extends tz{constructor(e=1,t=1,i=1,n=1,r=1,a=1){super(),this.type="BoxGeometry",this.parameters={width:e,height:t,depth:i,widthSegments:n,heightSegments:r,depthSegments:a};let s=this;n=Math.floor(n),r=Math.floor(r),a=Math.floor(a);let o=[],l=[],h=[],u=[],c=0,d=0;function p(e,t,i,n,r,a,p,f,m,g,v){let _=a/m,x=p/g,y=a/2,M=p/2,b=f/2,S=m+1,w=g+1,T=0,E=0,A=new eg;for(let C=0;C<w;C++){let L=C*x-M;for(let P=0;P<S;P++){let R=P*_-y;A[e]=R*n,A[t]=L*r,A[i]=b,l.push(A.x,A.y,A.z),A[e]=0,A[t]=0,A[i]=f>0?1:-1,h.push(A.x,A.y,A.z),u.push(P/m),u.push(1-C/g),T+=1}}for(let D=0;D<g;D++)for(let I=0;I<m;I++){let N=c+I+S*D,O=c+I+S*(D+1),z=c+(I+1)+S*(D+1),U=c+(I+1)+S*D;o.push(N,O,U),o.push(O,z,U),E+=6}s.addGroup(d,E,v),d+=E,c+=T}p("z","y","x",-1,-1,i,t,e,a,r,0),p("z","y","x",1,-1,i,t,-e,a,r,1),p("x","z","y",1,1,e,i,t,n,a,2),p("x","z","y",1,-1,e,i,-t,n,a,3),p("x","y","z",1,-1,e,t,i,n,r,4),p("x","y","z",-1,-1,e,t,-i,n,r,5),this.setIndex(o),this.setAttribute("position",new tC(l,3)),this.setAttribute("normal",new tC(h,3)),this.setAttribute("uv",new tC(u,2))}static fromJSON(e){return new t3(e.width,e.height,e.depth,e.widthSegments,e.heightSegments,e.depthSegments)}}function t2(e){let t={};for(let i in e)for(let n in t[i]={},e[i]){let r=e[i][n];r&&(r.isColor||r.isMatrix3||r.isMatrix4||r.isVector2||r.isVector3||r.isVector4||r.isTexture||r.isQuaternion)?t[i][n]=r.clone():Array.isArray(r)?t[i][n]=r.slice():t[i][n]=r}return t}function t4(e){let t={};for(let i=0;i<e.length;i++){let n=t2(e[i]);for(let r in n)t[r]=n[r]}return t}let t5={clone:t2,merge:t4};class t6 extends tM{constructor(e){super(),this.isShaderMaterial=!0,this.type="ShaderMaterial",this.defines={},this.uniforms={},this.uniformsGroups=[],this.vertexShader="void main() {\n	gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",this.fragmentShader="void main() {\n	gl_FragColor = vec4( 1.0, 0.0, 0.0, 1.0 );\n}",this.linewidth=1,this.wireframe=!1,this.wireframeLinewidth=1,this.fog=!1,this.lights=!1,this.clipping=!1,this.extensions={derivatives:!1,fragDepth:!1,drawBuffers:!1,shaderTextureLOD:!1},this.defaultAttributeValues={color:[1,1,1],uv:[0,0],uv2:[0,0]},this.index0AttributeName=void 0,this.uniformsNeedUpdate=!1,this.glslVersion=null,void 0!==e&&(void 0!==e.attributes&&console.error("THREE.ShaderMaterial: attributes should now be defined in THREE.BufferGeometry instead."),this.setValues(e))}copy(e){return super.copy(e),this.fragmentShader=e.fragmentShader,this.vertexShader=e.vertexShader,this.uniforms=t2(e.uniforms),this.uniformsGroups=function(e){let t=[];for(let i=0;i<e.length;i++)t.push(e[i].clone());return t}(e.uniformsGroups),this.defines=Object.assign({},e.defines),this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.fog=e.fog,this.lights=e.lights,this.clipping=e.clipping,this.extensions=Object.assign({},e.extensions),this.glslVersion=e.glslVersion,this}toJSON(e){let t=super.toJSON(e);for(let i in t.glslVersion=this.glslVersion,t.uniforms={},this.uniforms){let n=this.uniforms[i],r=n.value;r&&r.isTexture?t.uniforms[i]={type:"t",value:r.toJSON(e).uuid}:r&&r.isColor?t.uniforms[i]={type:"c",value:r.getHex()}:r&&r.isVector2?t.uniforms[i]={type:"v2",value:r.toArray()}:r&&r.isVector3?t.uniforms[i]={type:"v3",value:r.toArray()}:r&&r.isVector4?t.uniforms[i]={type:"v4",value:r.toArray()}:r&&r.isMatrix3?t.uniforms[i]={type:"m3",value:r.toArray()}:r&&r.isMatrix4?t.uniforms[i]={type:"m4",value:r.toArray()}:t.uniforms[i]={value:r}}Object.keys(this.defines).length>0&&(t.defines=this.defines),t.vertexShader=this.vertexShader,t.fragmentShader=this.fragmentShader;let a={};for(let s in this.extensions)!0===this.extensions[s]&&(a[s]=!0);return Object.keys(a).length>0&&(t.extensions=a),t}}class t7 extends tl{constructor(){super(),this.isCamera=!0,this.type="Camera",this.matrixWorldInverse=new eX,this.projectionMatrix=new eX,this.projectionMatrixInverse=new eX}copy(e,t){return super.copy(e,t),this.matrixWorldInverse.copy(e.matrixWorldInverse),this.projectionMatrix.copy(e.projectionMatrix),this.projectionMatrixInverse.copy(e.projectionMatrixInverse),this}getWorldDirection(e){this.updateWorldMatrix(!0,!1);let t=this.matrixWorld.elements;return e.set(-t[8],-t[9],-t[10]).normalize()}updateMatrixWorld(e){super.updateMatrixWorld(e),this.matrixWorldInverse.copy(this.matrixWorld).invert()}updateWorldMatrix(e,t){super.updateWorldMatrix(e,t),this.matrixWorldInverse.copy(this.matrixWorld).invert()}clone(){return new this.constructor().copy(this)}}class t8 extends t7{constructor(e=50,t=1,i=.1,n=2e3){super(),this.isPerspectiveCamera=!0,this.type="PerspectiveCamera",this.fov=e,this.zoom=1,this.near=i,this.far=n,this.focus=10,this.aspect=t,this.view=null,this.filmGauge=35,this.filmOffset=0,this.updateProjectionMatrix()}copy(e,t){return super.copy(e,t),this.fov=e.fov,this.zoom=e.zoom,this.near=e.near,this.far=e.far,this.focus=e.focus,this.aspect=e.aspect,this.view=null===e.view?null:Object.assign({},e.view),this.filmGauge=e.filmGauge,this.filmOffset=e.filmOffset,this}setFocalLength(e){let t=.5*this.getFilmHeight()/e;this.fov=2*N*Math.atan(t),this.updateProjectionMatrix()}getFocalLength(){let e=Math.tan(.5*I*this.fov);return .5*this.getFilmHeight()/e}
1getEffectiveFOV(){return 2*N*Math.atan(Math.tan(.5*I*this.fov)/this.zoom)}getFilmWidth(){return this.filmGauge*Math.min(this.aspect,1)}getFilmHeight(){return this.filmGauge/Math.max(this.aspect,1)}setViewOffset(e,t,i,n,r,a){this.aspect=e/t,null===this.view&&(this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1}),this.view.enabled=!0,this.view.fullWidth=e,this.view.fullHeight=t,this.view.offsetX=i,this.view.offsetY=n,this.view.width=r,this.view.height=a,this.updateProjectionMatrix()}clearViewOffset(){null!==this.view&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){let e=this.near,t=e*Math.tan(.5*I*this.fov)/this.zoom,i=2*t,n=this.aspect*i,r=-.5*n,a=this.view;if(null!==this.view&&this.view.enabled){let s=a.fullWidth,o=a.fullHeight;r+=a.offsetX*n/s,t-=a.offsetY*i/o,n*=a.width/s,i*=a.height/o}let l=this.filmOffset;0!==l&&(r+=e*l/this.getFilmWidth()),this.projectionMatrix.makePerspective(r,r+n,t,t-i,e,this.far),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(e){let t=super.toJSON(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}}class t9 extends tl{constructor(e,t,i){if(super(),this.type="CubeCamera",!0!==i.isWebGLCubeRenderTarget){console.error("THREE.CubeCamera: The constructor now expects an instance of WebGLCubeRenderTarget as third parameter.");return}this.renderTarget=i;let n=new t8(90,1,e,t);n.layers=this.layers,n.up.set(0,-1,0),n.lookAt(new eg(1,0,0)),this.add(n);let r=new t8(90,1,e,t);r.layers=this.layers,r.up.set(0,-1,0),r.lookAt(new eg(-1,0,0)),this.add(r);let a=new t8(90,1,e,t);a.layers=this.layers,a.up.set(0,0,1),a.lookAt(new eg(0,1,0)),this.add(a);let s=new t8(90,1,e,t);s.layers=this.layers,s.up.set(0,0,-1),s.lookAt(new eg(0,-1,0)),this.add(s);let o=new t8(90,1,e,t);o.layers=this.layers,o.up.set(0,-1,0),o.lookAt(new eg(0,0,1)),this.add(o);let l=new t8(90,1,e,t);l.layers=this.layers,l.up.set(0,-1,0),l.lookAt(new eg(0,0,-1)),this.add(l)}update(e,t){null===this.parent&&this.updateMatrixWorld();let i=this.renderTarget,[n,r,a,s,o,l]=this.children,h=e.getRenderTarget(),u=e.toneMapping,c=e.xr.enabled;e.toneMapping=0,e.xr.enabled=!1;let d=i.texture.generateMipmaps;i.texture.generateMipmaps=!1,e.setRenderTarget(i,0),e.render(t,n),e.setRenderTarget(i,1),e.render(t,r),e.setRenderTarget(i,2),e.render(t,a),e.setRenderTarget(i,3),e.render(t,s),e.setRenderTarget(i,4),e.render(t,o),i.texture.generateMipmaps=d,e.setRenderTarget(i,5),e.render(t,l),e.setRenderTarget(h),e.toneMapping=u,e.xr.enabled=c,i.texture.needsPMREMUpdate=!0}}class ie extends ec{constructor(e,t,i,n,r,a,s,o,l,h){super(e=void 0!==e?e:[],t=void 0!==t?t:301,i,n,r,a,s,o,l,h),this.isCubeTexture=!0,this.flipY=!1}get images(){return this.image}set images(e){this.image=e}}class it extends ep{constructor(e,t={}){super(e,e,t),this.isWebGLCubeRenderTarget=!0;let i={width:e,height:e,depth:1};this.texture=new ie([i,i,i,i,i,i],t.mapping,t.wrapS,t.wrapT,t.magFilter,t.minFilter,t.format,t.type,t.anisotropy,t.encoding),this.texture.isRenderTargetTexture=!0,this.texture.generateMipmaps=void 0!==t.generateMipmaps&&t.generateMipmaps,this.texture.minFilter=void 0!==t.minFilter?t.minFilter:v}fromEquirectangularTexture(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;let i={uniforms:{tEquirect:{value:null}},vertexShader:`
2
3				varying vec3 vWorldDirection;
4
5				vec3 transformDirection( in vec3 dir, in mat4 matrix ) {
6
7					return normalize( ( matrix * vec4( dir, 0.0 ) ).xyz );
8
9				}
10
11				void main() {
12
13					vWorldDirection = transformDirection( position, modelMatrix );
14
15					#include <begin_vertex>
16					#include <project_vertex>
17
18				}
19			`,fragmentShader:`
20
21				uniform sampler2D tEquirect;
22
23				varying vec3 vWorldDirection;
24
25				#include <common>
26
27				void main() {
28
29					vec3 direction = normalize( vWorldDirection );
30
31					vec2 sampleUV = equirectUv( direction );
32
33					gl_FragColor = texture2D( tEquirect, sampleUV );
34
35				}
36			`},n=new t3(5,5,5),r=new t6({name:"CubemapFromEquirect",uniforms:t2(i.uniforms),vertexShader:i.vertexShader,fragmentShader:i.fragmentShader,side:o,blending:0});r.uniforms.tEquirect.value=t;let a=new t0(n,r),s=t.minFilter;t.minFilter===x&&(t.minFilter=v);let l=new t9(1,10,this);return l.update(e,a),t.minFilter=s,a.geometry.dispose(),a.material.dispose(),this}clear(e,t,i,n){let r=e.getRenderTarget();for(let a=0;a<6;a++)e.setRenderTarget(this,a),e.clear(t,i,n);e.setRenderTarget(r)}}let ii=new eg,ir=new eg,ia=new q;class is{constructor(e=new eg(1,0,0),t=0){this.isPlane=!0,this.normal=e,this.constant=t}set(e,t){return this.normal.copy(e),this.constant=t,this}setComponents(e,t,i,n){return this.normal.set(e,t,i),this.constant=n,this}setFromNormalAndCoplanarPoint(e,t){return this.normal.copy(e),this.constant=-t.dot(this.normal),this}
36setFromCoplanarPoints(e,t,i){let n=ii.subVectors(i,t).cross(ir.subVectors(e,t)).normalize();return this.setFromNormalAndCoplanarPoint(n,e),this}copy(e){return this.normal.copy(e.normal),this.constant=e.constant,this}normalize(){let e=1/this.normal.length();return this.normal.multiplyScalar(e),this.constant*=e,this}negate(){return this.constant*=-1,this.normal.negate(),this}distanceToPoint(e){return this.normal.dot(e)+this.constant}distanceToSphere(e){return this.distanceToPoint(e.center)-e.radius}projectPoint(e,t){return t.copy(this.normal).multiplyScalar(-this.distanceToPoint(e)).add(e)}intersectLine(e,t){let i=e.delta(ii),n=this.normal.dot(i);if(0===n)return 0===this.distanceToPoint(e.start)?t.copy(e.start):null;let r=-(e.start.dot(this.normal)+this.constant)/n;return r<0||r>1?null:t.copy(i).multiplyScalar(r).add(e.start)}intersectsLine(e){let t=this.distanceToPoint(e.start),i=this.distanceToPoint(e.end);return t<0&&i>0||i<0&&t>0}intersectsBox(e){return e.intersectsPlane(this)}intersectsSphere(e){return e.intersectsPlane(this)}coplanarPoint(e){return e.copy(this.normal).multiplyScalar(-this.constant)}applyMatrix4(e,t){let i=t||ia.getNormalMatrix(e),n=this.coplanarPoint(ii).applyMatrix4(e),r=this.normal.applyMatrix3(i).normalize();return this.constant=-n.dot(r),this}translate(e){return this.constant-=e.dot(this.normal),this}equals(e){return e.normal.equals(this.normal)&&e.constant===this.constant}clone(){return new this.constructor().copy(this)}}let io=new eF,il=new eg;class ih{constructor(e=new is,t=new is,i=new is,n=new is,r=new is,a=new is){this.planes=[e,t,i,n,r,a]}set(e,t,i,n,r,a){let s=this.planes;return s[0].copy(e),s[1].copy(t),s[2].copy(i),s[3].copy(n),s[4].copy(r),s[5].copy(a),this}copy(e){let t=this.planes;for(let i=0;i<6;i++)t[i].copy(e.planes[i]);return this}setFromProjectionMatrix(e){let t=this.planes,i=e.elements,n=i[0],r=i[1],a=i[2],s=i[3],o=i[4],l=i[5],h=i[6],u=i[7],c=i[8],d=i[9],p=i[10],f=i[11],m=i[12],g=i[13],v=i[14],_=i[15];return t[0].setComponents(s-n,u-o,f-c,_-m).normalize(),t[1].setComponents(s+n,u+o,f+c,_+m).normalize(),t[2].setComponents(s+r,u+l,f+d,_+g).normalize(),t[3].setComponents(s-r,u-l,f-d,_-g).normalize(),t[4].setComponents(s-a,u-h,f-p,_-v).normalize(),t[5].setComponents(s+a,u+h,f+p,_+v).normalize(),this}intersectsObject(e){let t=e.geometry;return null===t.boundingSphere&&t.computeBoundingSphere(),io.copy(t.boundingSphere).applyMatrix4(e.matrixWorld),this.intersectsSphere(io)}intersectsSprite(e){return io.center.set(0,0,0),io.radius=.7071067811865476,io.applyMatrix4(e.matrixWorld),this.intersectsSphere(io)}intersectsSphere(e){let t=this.planes,i=e.center,n=-e.radius;for(let r=0;r<6;r++){let a=t[r].distanceToPoint(i);if(a<n)return!1}return!0}intersectsBox(e){let t=this.planes;for(let i=0;i<6;i++){let n=t[i];if(il.x=n.normal.x>0?e.max.x:e.min.x,il.y=n.normal.y>0?e.max.y:e.min.y,il.z=n.normal.z>0?e.max.z:e.min.z,0>n.distanceToPoint(il))return!1}return!0}containsPoint(e){let t=this.planes;for(let i=0;i<6;i++)if(0>t[i].distanceToPoint(e))return!1;return!0}clone(){return new this.constructor().copy(this)}}function iu(){let e=null,t=!1,i=null,n=null;function r(t,a){i(t,a),n=e.requestAnimationFrame(r)}return{start:function(){!0!==t&&null!==i&&(n=e.requestAnimationFrame(r),t=!0)},stop:function(){e.cancelAnimationFrame(n),t=!1},setAnimationLoop:function(e){i=e},setContext:function(t){e=t}}}function ic(e,t){let i=t.isWebGL2,n=new WeakMap;return{get:function(e){return e.isInterleavedBufferAttribute&&(e=e.data),n.get(e)},remove:function(t){t.isInterleavedBufferAttribute&&(t=t.data);let i=n.get(t);i&&(e.deleteBuffer(i.buffer),n.delete(t))},update:function(t,r){if(t.isGLBufferAttribute){let a=n.get(t);(!a||a.version<t.version)&&n.set(t,{buffer:t.buffer,type:t.type,bytesPerElement:t.elementSize,version:t.version});return}t.isInterleavedBufferAttribute&&(t=t.data);let s=n.get(t);void 0===s?n.set(t,function(t,n){let r=t.array,a=t.usage,s=e.createBuffer();e.bindBuffer(n,s),e.bufferData(n,r,a),t.onUploadCallback();let o;if(r instanceof Float32Array)o=5126;else if(r instanceof Uint16Array){if(t.isFloat16BufferAttribute){if(i)o=5131;else throw Error("THREE.WebGLAttributes: Usage of Float16BufferAttribute requires WebGL2.")}else o=5123}else if(r instanceof Int16Array)o=5122;else if(r instanceof Uint32Array)o=5125;else if(r instanceof Int32Array)o=5124;else if(r instanceof Int8Array)o=5120;else if(r instanceof Uint8Array)o=5121;else if(r instanceof Uint8ClampedArray)o=5121;else throw Error("THREE.WebGLAttributes: Unsupported buffer data format: "+r);return{buffer:s,type:o,bytesPerElement:r.BYTES_PER_ELEMENT,version:t.version}}(t,r)):s.version<t.version&&(!function(t,n,r){let a=n.array,s=n.updateRange;e.bindBuffer(r,t),-1===s.count?e.bufferSubData(r,0,a):(i?e.bufferSubData(r,s.offset*a.BYTES_PER_ELEMENT,a,s.offset,s.count):e.bufferSubData(r,s.offset*a.BYTES_PER_ELEMENT,a.subarray(s.offset,s.offset+s.count)),s.count=-1)}(s.buffer,t,r),s.version=t.version)}}}
vendor: 4,086 bytes, line 36
36class id extends tz{constructor(e=1,t=1,i=1,n=1){super(),this.type="PlaneGeometry",this.parameters={width:e,height:t,widthSegments:i,heightSegments:n};let r=e/2,a=t/2,s=Math.floor(i),o=Math.floor(n),l=s+1,h=o+1,u=e/s,c=t/o,d=[],p=[],f=[],m=[];for(let g=0;g<h;g++){let v=g*c-a;for(let _=0;_<l;_++){let x=_*u-r;p.push(x,-v,0),f.push(0,0,1),m.push(_/s),m.push(1-g/o)}}for(let y=0;y<o;y++)for(let M=0;M<s;M++){let b=M+l*y,S=M+l*(y+1),w=M+1+l*(y+1),T=M+1+l*y;d.push(b,S,T),d.push(S,w,T)}this.setIndex(d),this.setAttribute("position",new tC(p,3)),this.setAttribute("normal",new tC(f,3)),this.setAttribute("uv",new tC(m,2))}static fromJSON(e){return new id(e.width,e.height,e.widthSegments,e.heightSegments)}}let ip={alphamap_fragment:"#ifdef USE_ALPHAMAP\n	diffuseColor.a *= texture2D( alphaMap, vUv ).g;\n#endif",alphamap_pars_fragment:"#ifdef USE_ALPHAMAP\n	uniform sampler2D alphaMap;\n#endif",alphatest_fragment:"#ifdef USE_ALPHATEST\n	if ( diffuseColor.a < alphaTest ) discard;\n#endif",alphatest_pars_fragment:"#ifdef USE_ALPHATEST\n	uniform float alphaTest;\n#endif",aomap_fragment:"#ifdef USE_AOMAP\n	float ambientOcclusion = ( texture2D( aoMap, vUv2 ).r - 1.0 ) * aoMapIntensity + 1.0;\n	reflectedLight.indirectDiffuse *= ambientOcclusion;\n	#if defined( USE_ENVMAP ) && defined( STANDARD )\n		float dotNV = saturate( dot( geometry.normal, geometry.viewDir ) );\n		reflectedLight.indirectSpecular *= computeSpecularOcclusion( dotNV, ambientOcclusion, material.roughness );\n	#endif\n#endif",aomap_pars_fragment:"#ifdef USE_AOMAP\n	uniform sampler2D aoMap;\n	uniform float aoMapIntensity;\n#endif",begin_vertex:"vec3 transformed = vec3( position );",beginnormal_vertex:"vec3 objectNormal = vec3( normal );\n#ifdef USE_TANGENT\n	vec3 objectTangent = vec3( tangent.xyz );\n#endif",bsdfs:"vec3 BRDF_Lambert( const in vec3 diffuseColor ) {\n	return RECIPROCAL_PI * diffuseColor;\n}\nvec3 F_Schlick( const in vec3 f0, const in float f90, const in float dotVH ) {\n	float fresnel = exp2( ( - 5.55473 * dotVH - 6.98316 ) * dotVH );\n	return f0 * ( 1.0 - fresnel ) + ( f90 * fresnel );\n}\nfloat F_Schlick( const in float f0, const in float f90, const in float dotVH ) {\n	float fresnel = exp2( ( - 5.55473 * dotVH - 6.98316 ) * dotVH );\n	return f0 * ( 1.0 - fresnel ) + ( f90 * fresnel );\n}\nvec3 Schlick_to_F0( const in vec3 f, const in float f90, const in float dotVH ) {\n    float x = clamp( 1.0 - dotVH, 0.0, 1.0 );\n    float x2 = x * x;\n    float x5 = clamp( x * x2 * x2, 0.0, 0.9999 );\n    return ( f - vec3( f90 ) * x5 ) / ( 1.0 - x5 );\n}\nfloat V_GGX_SmithCorrelated( const in float alpha, const in float dotNL, const in float dotNV ) {\n	float a2 = pow2( alpha );\n	float gv = dotNL * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNV ) );\n	float gl = dotNV * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNL ) );\n	return 0.5 / max( gv + gl, EPSILON );\n}\nfloat D_GGX( const in float alpha, const in float dotNH ) {\n	float a2 = pow2( alpha );\n	float denom = pow2( dotNH ) * ( a2 - 1.0 ) + 1.0;\n	return RECIPROCAL_PI * a2 / pow2( denom );\n}\nvec3 BRDF_GGX( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in vec3 f0, const in float f90, const in float roughness ) {\n	float alpha = pow2( roughness );\n	vec3 halfDir = normalize( lightDir + viewDir );\n	float dotNL = saturate( dot( normal, lightDir ) );\n	float dotNV = saturate( dot( normal, viewDir ) );\n	float dotNH = saturate( dot( normal, halfDir ) );\n	float dotVH = saturate( dot( viewDir, halfDir ) );\n	vec3 F = F_Schlick( f0, f90, dotVH );\n	float V = V_GGX_SmithCorrelated( alpha, dotNL, dotNV );\n	float D = D_GGX( alpha, dotNH );\n	return F * ( V * D );\n}\n#ifdef USE_IRIDESCENCE\n	vec3 BRDF_GGX_Iridescence( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in vec3 f0, const in float f90, const in float iridescence, const in vec3 iridescenceFresnel, const in float roughness ) {\n		float alpha = pow2( roughness );\n		vec3 halfDir = normalize( lightDir + viewDir );\n		float dotNL = saturate( dot( normal, lightDir ) );\n		float dotNV = saturate( dot( normal, viewDir ) );
36\n		float dotNH = saturate( dot( normal, halfDir ) );\n		float dotVH = saturate( dot( viewDir, halfDir ) );\n		vec3 F = mix( F_Schlick( f0, f90, dotVH ), iridescenceFresnel, iridescence );\n		float V = V_GGX_SmithCorrelated( alpha, dotNL, dotNV );\n		float D = D_GGX( alpha, dotNH );\n		return F * ( V * D );\n	}\n#endif\nvec2 LTC_Uv( const in vec3 N, const in vec3 V, const in float roughness ) {\n	const float LUT_SIZE = 64.0;\n	const float LUT_SCALE = ( LUT_SIZE - 1.0 ) / LUT_SIZE;\n	const float LUT_BIAS = 0.5 / LUT_SIZE;\n	float dotNV = saturate( dot( N, V ) );\n	vec2 uv = vec2( roughness, sqrt( 1.0 - dotNV ) );\n	uv = uv * LUT_SCALE + LUT_BIAS;\n	return uv;\n}\nfloat LTC_ClippedSphereFormFactor( const in vec3 f ) {\n	float l = length( f );\n	return max( ( l * l + f.z ) / ( l + 1.0 ), 0.0 );\n}\nvec3 LTC_EdgeVectorFormFactor( const in vec3 v1, const in vec3 v2 ) {\n	float x = dot( v1, v2 );\n	float y = abs( x );\n	float a = 0.8543985 + ( 0.4965155 + 0.0145206 * y ) * y;\n	float b = 3.4175940 + ( 4.1616724 + y ) * y;\n	float v = a / b;\n	float theta_sintheta = ( x >
36 0.0 ) ? v : 0.5 * inversesqrt( max( 1.0 - x * x, 1e-7 ) ) - v;\n	return cross( v1, v2 ) * theta_sintheta;\n}\nvec3 LTC_Evaluate( const in vec3 N, const in vec3 V, const in vec3 P, const in mat3 mInv, const in vec3 rectCoords[ 4 ] ) {\n	vec3 v1 = rectCoords[ 1 ] - rectCoords[ 0 ];\n	vec3 v2 = rectCoords[ 3 ] - rectCoords[ 0 ];\n	vec3 lightNormal = cross( v1, v2 );\n	if( dot( lightNormal, P - rectCoords[ 0 ] ) < 0.0 ) return vec3( 0.0 );\n	vec3 T1, T2;\n	T1 = normalize( V - N * dot( V, N ) );\n	T2 = - cross( N, T1 );\n	mat3 mat = mInv * transposeMat3( mat3( T1, T2, N ) );\n	vec3 coords[ 4 ];\n	coords[ 0 ] = mat * ( rectCoords[ 0 ] - P );\n	coords[ 1 ] = mat * ( rectCoords[ 1 ] - P );\n	coords[ 2 ] = mat * ( rectCoords[ 2 ] - P );\n	coords[ 3 ] = mat * ( rectCoords[ 3 ] - P );\n	coords[ 0 ] = normalize( coords[ 0 ] );\n	coords[ 1 ] = normalize( coords[ 1 ] );\n	coords[ 2 ] = normalize( coords[ 2 ] );\n	coords[ 3 ] = normalize( coords[ 3 ] );\n	vec3 vectorFormFactor = vec3( 0.0 );\n	vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 0 ], coords[ 1 ] );\n	vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 1 ], coords[ 2 ] );\n	vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 2 ], coords[ 3 ] );\n	vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 3 ], coords[ 0 ] );\n	float result = LTC_ClippedSphereFormFactor( vectorFormFactor );\n	return vec3( result );\n}\nfloat G_BlinnPhong_Implicit( ) {\n	return 0.25;\n}\nfloat D_BlinnPhong( const in float shininess, const in float dotNH ) {\n	return RECIPROCAL_PI * ( shininess * 0.5 + 1.0 ) * pow( dotNH, shininess );\n}\nvec3 BRDF_BlinnPhong( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in vec3 specularColor, const in float shininess ) {\n	vec3 halfDir = normalize( lightDir + viewDir );\n	float dotNH = saturate( dot( normal, halfDir ) );\n	float dotVH = saturate( dot( viewDir, halfDir ) );\n	vec3 F = F_Schlick( specularColor, 1.0, dotVH );\n	float G = G_BlinnPhong_Implicit( );\n	float D = D_BlinnPhong( shininess, dotNH );\n	return F * ( G * D );\n}\n#if defined( USE_SHEEN )\nfloat D_Charlie( float roughness, float dotNH ) {\n	float alpha = pow2( roughness );\n	float invAlpha = 1.0 / alpha;\n	float cos2h = dotNH * dotNH;\n	float sin2h = max( 1.0 - cos2h, 0.0078125 );\n	return ( 2.0 + invAlpha ) * pow( sin2h, invAlpha * 0.5 ) / ( 2.0 * PI );\n}\nfloat V_Neubelt( float dotNV, float dotNL ) {\n	return saturate( 1.0 / ( 4.0 * ( dotNL + dotNV - dotNL * dotNV ) ) );\n}\nvec3 BRDF_Sheen( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, vec3 sheenColor, const in float sheenRoughness ) {\n	vec3 halfDir = normalize( lightDir + viewDir );\n	float dotNL = saturate( dot( normal, lightDir ) );\n	float dotNV = saturate( dot( normal, viewDir ) );\n	float dotNH = saturate( dot( normal, halfDir ) );\n	float D = D_Charlie( sheenRoughness, dotNH );\n	float V = V_Neubelt( dotNV, dotNL );\n	return sheenColor * ( D * V );\n}\n#endif",iridescence_fragment:"#ifdef USE_IRIDESCENCE\n	const mat3 XYZ_TO_REC709 = mat3(\n		 3.2404542, -0.9692660,  0.0556434,\n		-1.5371385,  1.8760108, -0.2040259,\n		-0.4985314,  0.0415560,  1.0572252\n	);\n	vec3 Fresnel0ToIor( vec3 fresnel0 ) {\n		vec3 sqrtF0 = sqrt( fresnel0 );\n		return ( vec3( 1.0 ) + sqrtF0 ) / ( vec3( 1.0 ) - sqrtF0 );\n	}\n	vec3 IorToFresnel0( vec3 transmittedIor, float incidentIor ) {\n		return pow2( ( transmittedIor - vec3( incidentIor ) ) / ( transmittedIor + vec3( incidentIor ) ) );\n	}\n	float IorToFresnel0( float transmittedIor, float incidentIor ) {\n		return pow2( ( transmittedIor - incidentIor ) / ( transmittedIor + incidentIor ));\n	}\n	vec3 evalSensitivity( float OPD, vec3 shift ) {\n		float phase = 2.0 * PI * OPD * 1.0e-9;\n		vec3 val = vec3( 5.4856e-13, 4.4201e-13, 5.2481e-13 );\n		vec3 pos = vec3( 1.6810e+06, 1.7953e+06, 2.2084e+06 );\n		vec3 var = vec3( 4.3278e+09, 9.3046e+09, 6.6121e+09 );\n		vec3 xyz = val * sqrt( 2.0 * PI * var ) * cos( pos * phase + shift ) * exp( - pow2( phase ) * var );\n		xyz.x += 9.7470e-14 * sqrt( 2.0 * PI * 4.5282e+09 ) * cos( 2.2399e+06 * phase + shift[ 0 ] ) * exp( - 4.5282e+09 * pow2( phase ) );\n		xyz /= 1.0685e-7;\n		vec3 rgb = XYZ_TO_REC709 * xyz;\n		return rgb;\n	}\n	vec3 evalIridescence( float outsideIOR, float eta2, float cosTheta1, float thinFilmThickness, vec3 baseF0 ) {\n		vec3 I;\n		float iridescenceIOR = mix( outsideIOR, eta2, smoothstep( 0.0, 0.03, thinFilmThickness ) );\n		float sinTheta2Sq = pow2( outsideIOR / iridescenceIOR ) * ( 1.0 - pow2( cosTheta1 ) );\n		float cosTheta2Sq = 1.0 - sinTheta2Sq;\n		if ( cosTheta2Sq < 0.0 ) {\n			 return vec3( 1.0 );\n		}\n		float cosTheta2 = sqrt( cosTheta2Sq );\n		float R0 = IorToFresnel0( iridescenceIOR, outsideIOR );
36\n		float R12 = F_Schlick( R0, 1.0, cosTheta1 );\n		float R21 = R12;\n		float T121 = 1.0 - R12;\n		float phi12 = 0.0;\n		if ( iridescenceIOR < outsideIOR ) phi12 = PI;\n		float phi21 = PI - phi12;\n		vec3 baseIOR = Fresnel0ToIor( clamp( baseF0, 0.0, 0.9999 ) );		vec3 R1 = IorToFresnel0( baseIOR, iridescenceIOR );\n		vec3 R23 = F_Schlick( R1, 1.0, cosTheta2 );\n		vec3 phi23 = vec3( 0.0 );\n		if ( baseIOR[ 0 ] < iridescenceIOR ) phi23[ 0 ] = PI;\n		if ( baseIOR[ 1 ] < iridescenceIOR ) phi23[ 1 ] = PI;\n		if ( baseIOR[ 2 ] < iridescenceIOR ) phi23[ 2 ] = PI;\n		float OPD = 2.0 * iridescenceIOR * thinFilmThickness * cosTheta2;\n		vec3 phi = vec3( phi21 ) + phi23;\n		vec3 R123 = clamp( R12 * R23, 1e-5, 0.9999 );\n		vec3 r123 = sqrt( R123 );\n		vec3 Rs = pow2( T121 ) * R23 / ( vec3( 1.0 ) - R123 );\n		vec3 C0 = R12 + Rs;\n		I = C0;\n		vec3 Cm = Rs - T121;\n		for ( int m = 1; m <= 2; ++ m ) {\n			Cm *= r123;\n			vec3 Sm = 2.0 * evalSensitivity( float( m ) * OPD, float( m ) * phi );\n			I += Cm * Sm;\n		}\n		return max( I, vec3( 0.0 ) );\n	}\n#endif",bumpmap_pars_fragment:"#ifdef USE_BUMPMAP\n	uniform sampler2D bumpMap;\n	uniform float bumpScale;\n	vec2 dHdxy_fwd() {\n		vec2 dSTdx = dFdx( vUv );\n		vec2 dSTdy = dFdy( vUv );\n		float Hll = bumpScale * texture2D( bumpMap, vUv ).x;\n		float dBx = bumpScale * texture2D( bumpMap, vUv + dSTdx ).x - Hll;\n		float dBy = bumpScale * texture2D( bumpMap, vUv + dSTdy ).x - Hll;\n		return vec2( dBx, dBy );\n	}\n	vec3 perturbNormalArb( vec3 surf_pos, vec3 surf_norm, vec2 dHdxy, float faceDirection ) {\n		vec3 vSigmaX = dFdx( surf_pos.xyz );\n		vec3 vSigmaY = dFdy( surf_pos.xyz );\n		vec3 vN = surf_norm;\n		vec3 R1 = cross( vSigmaY, vN );\n		vec3 R2 = cross( vN, vSigmaX );\n		float fDet = dot( vSigmaX, R1 ) * faceDirection;\n		vec3 vGrad = sign( fDet ) * ( dHdxy.x * R1 + dHdxy.y * R2 );\n		return normalize( abs( fDet ) * surf_norm - vGrad );\n	}\n#endif",clipping_planes_fragment:"#if NUM_CLIPPING_PLANES > 0\n	vec4 plane;\n	#pragma unroll_loop_start\n	for ( int i = 0; i < UNION_CLIPPING_PLANES; i ++ ) {\n		plane = clippingPlanes[ i ];\n		if ( dot( vClipPosition, plane.xyz ) > plane.w ) discard;\n	}\n	#pragma unroll_loop_end\n	#if UNION_CLIPPING_PLANES < NUM_CLIPPING_PLANES\n		bool clipped = true;\n		#pragma unroll_loop_start\n		for ( int i = UNION_CLIPPING_PLANES; i < NUM_CLIPPING_PLANES; i ++ ) {\n			plane = clippingPlanes[ i ];\n			clipped = ( dot( vClipPosition, plane.xyz ) > plane.w ) && clipped;\n		}\n		#pragma unroll_loop_end\n		if ( clipped ) discard;\n	#endif\n#endif",clipping_planes_pars_fragment:"#if NUM_CLIPPING_PLANES > 0\n	varying vec3 vClipPosition;\n	uniform vec4 clippingPlanes[ NUM_CLIPPING_PLANES ];\n#endif",clipping_planes_pars_vertex:"#if NUM_CLIPPING_PLANES > 0\n	varying vec3 vClipPosition;\n#endif",clipping_planes_vertex:"#if NUM_CLIPPING_PLANES > 0\n	vClipPosition = - mvPosition.xyz;\n#endif",color_fragment:"#if defined( USE_COLOR_ALPHA )\n	diffuseColor *= vColor;\n#elif defined( USE_COLOR )\n	diffuseColor.rgb *= vColor;\n#endif",color_pars_fragment:"#if defined( USE_COLOR_ALPHA )\n	varying vec4 vColor;\n#elif defined( USE_COLOR )\n	varying vec3 vColor;\n#endif",color_pars_vertex:"#if defined( USE_COLOR_ALPHA )\n	varying vec4 vColor;\n#elif defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR )\n	varying vec3 vColor;\n#endif",color_vertex:"#if defined( USE_COLOR_ALPHA )\n	vColor = vec4( 1.0 );\n#elif defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR )\n	vColor = vec3( 1.0 );\n#endif\n#ifdef USE_COLOR\n	vColor *= color;\n#endif\n#ifdef USE_INSTANCING_COLOR\n	vColor.xyz *= instanceColor.xyz;\n#endif",common:"#define PI 3.141592653589793\n#define PI2 6.283185307179586\n#define PI_HALF 1.5707963267948966\n#define RECIPROCAL_PI 0.3183098861837907\n#define RECIPROCAL_PI2 0.15915494309189535\n#define EPSILON 1e-6\n#ifndef saturate\n#define saturate( a ) clamp( a, 0.0, 1.0 )\n#endif\n#define whiteComplement( a ) ( 1.0 - saturate( a ) )\nfloat pow2( const in float x ) { return x*x; }\nvec3 pow2( const in vec3 x ) { return x*x; }\nfloat pow3( const in float x ) { return x*x*x; }\nfloat pow4( const in float x ) { float x2 = x*x; return x2*x2; }\nfloat max3( const in vec3 v ) { return max( max( v.x, v.y ), v.z ); }\nfloat average( const in vec3 v ) { return dot( v, vec3( 0.3333333 ) ); }\nhighp float rand( const in vec2 uv ) {\n	const highp float a = 12.9898, b = 78.233, c = 43758.5453;\n	highp float dt = dot( uv.xy, vec2( a,b ) ), sn = mod( dt, PI );\n	return fract( sin( sn ) * c );\n}\n#ifdef HIGH_PRECISION\n	float precisionSafeLength( vec3 v ) { return length( v ); }\n#else\n	float precisionSafeLength( vec3 v ) {\n		float maxComponent = max3( abs( v ) );\n		return length( v / maxComponent ) * maxComponent;\n	}\n#endif\nstruct IncidentLight {\n	vec3 color;\n	vec3 direction;\n	bool visible;\n};\nstruct ReflectedLight {\n	vec3 directDiffuse;\n	vec3 directSpecular;\n	vec3 indirectDiffuse;\n	vec3 indirectSpecular;\n};\nstruct GeometricContext {\n	vec3 position;\n	vec3 normal;\n	vec3 viewDir;\n#ifdef USE_CLEARCOAT\n	vec3 clearcoatNormal;\n#endif\n};\nvec3 transformDirection( in vec3 dir, in mat4 matrix ) {\n	return normalize( ( matrix * vec4( dir, 0.0 ) ).xyz );\n}\nvec3 inverseTransformDirection( in vec3 dir, in mat4 matrix ) {\n	return normalize( ( vec4( dir, 0.0 ) * matrix ).xyz );\n}\nmat3 transposeMat3( const in mat3 m ) {\n	mat3 tmp;\n	tmp[ 0 ] = vec3( m[ 0 ].x, m[ 1 ].x, m[ 2 ].x );\n	tmp[ 1 ] = vec3( m[ 0 ].y, m[ 1 ].y, m[ 2 ].y );\n	tmp[ 2 ] = vec3( m[ 0 ].z, m[ 1 ].z, m[ 2 ].z );\n	return tmp;\n}\nfloat luminance( const in vec3 rgb ) {\n	const vec3 weights = vec3( 0.2126729, 0.7151522, 0.0721750 );\n	return dot( weights, rgb );\n}\nbool isPerspectiveMatrix( mat4 m ) {\n	return m[ 2 ][ 3 ] == - 1.0;\n}\nvec2 equirectUv( in vec3 dir ) {\n	float u = atan( dir.z, dir.x ) * RECIPROCAL_PI2 + 0.5;\n	float v = asin( clamp( dir.y, - 1.0, 1.0 ) ) * RECIPROCAL_PI + 0.5;\n	return vec2( u, v );\n}",cube_uv_reflection_fragment:"#ifdef ENVMAP_TYPE_CUBE_UV\n	#define cubeUV_minMipLevel 4.0\n	#define cubeUV_minTileSize 16.0\n	float getFace( vec3 direction ) {\n		vec3 absDirection = abs( direction );\n		float face = - 1.0;\n		if ( absDirection.x > absDirection.z ) {\n			if ( absDirection.x > absDirection.y )\n				face = direction.x > 0.0 ? 0.0 : 3.0;\n			else\n				face = direction.y > 0.0 ? 1.0 : 4.0;\n		} else {\n			if ( absDirection.z > absDirection.y )\n				face = direction.z > 0.0 ? 2.0 : 5.0;\n			else\n				face = direction.y > 0.0 ? 1.0 : 4.0;\n		}\n		return face;\n	}\n	vec2 getUV( vec3 direction, float face ) {\n		vec2 uv;\n		if ( face == 0.0 ) {\n			uv = vec2( direction.z, direction.y ) / abs( direction.x );\n		} else if ( face == 1.0 ) {\n			uv = vec2( - direction.x, - direction.z ) / abs( direction.y );\n		} else if ( face == 2.0 ) {\n			uv = vec2( - direction.x, direction.y ) / abs( direction.z );\n		} else if ( face == 3.0 ) {\n			uv = vec2( - direction.z, direction.y ) / abs( direction.x );\n		} else if ( face == 4.0 ) {\n			uv = vec2( - direction.x, direction.z ) / abs( direction.y );\n		} else {\n			uv = vec2( direction.x, direction.y ) / abs( direction.z );\n		}\n		return 0.5 * ( uv + 1.0 );\n	}\n	vec3 bilinearCubeUV( sampler2D envMap, vec3 direction, float mipInt ) {\n		float face = getFace( direction );\n		float filterInt = max( cubeUV_minMipLevel - mipInt, 0.0 );\n		mipInt = max( mipInt, cubeUV_minMipLevel );\n		float faceSize = exp2( mipInt );\n		vec2 uv = getUV( direction, face ) * ( faceSize - 2.0 ) + 1.0;\n		if ( face > 2.0 ) {\n			uv.y += faceSize;\n			face -= 3.0;\n		}\n		uv.x += face * faceSize;\n		uv.x += filterInt * 3.0 * cubeUV_minTileSize;\n		uv.y += 4.0 * ( exp2( CUBEUV_MAX_MIP ) - faceSize );\n		uv.x *= CUBEUV_TEXEL_WIDTH;\n		uv.y *= CUBEUV_TEXEL_HEIGHT;\n		#ifdef texture2DGradEXT\n			return texture2DGradEXT( envMap, uv, vec2( 0.0 ), vec2( 0.0 ) ).rgb;\n		#else\n			return texture2D( envMap, uv ).rgb;\n		#endif\n	}\n	#define r0 1.0\n	#define v0 0.339\n	#define m0 - 2.0\n	#define r1 0.8\n	#define v1 0.276\n	#define m1 - 1.0\n	#define r4 0.4\n	#define v4 0.046\n	#define m4 2.0\n	#define r5 0.305\n	#define v5 0.016\n	#define m5 3.0\n	#define r6 0.21\n	#define v6 0.0038\n	#define m6 4.0\n	float roughnessToMip( float roughness ) {\n		float mip = 0.0;\n		if ( roughness >= r1 ) {\n			mip = ( r0 - roughness ) * ( m1 - m0 ) / ( r0 - r1 ) + m0;\n		} else if ( roughness >= r4 ) {\n			mip = ( r1 - roughness ) * ( m4 - m1 ) / ( r1 - r4 ) + m1;\n		} else if ( roughness >= r5 ) {\n			mip = ( r4 - roughness ) * ( m5 - m4 ) / ( r4 - r5 ) + m4;\n		} else if ( roughness >= r6 ) {\n			mip = ( r5 - roughness ) * ( m6 - m5 ) / ( r5 - r6 ) + m5;\n		} else {\n			mip = - 2.0 * log2( 1.16 * roughness );		}\n		return mip;\n	}\n	vec4 textureCubeUV( sampler2D envMap, vec3 sampleDir, float roughness ) {\n		float mip = clamp( roughnessToMip( roughness ), m0, CUBEUV_MAX_MIP );\n		float mipF = fract( mip );\n		float mipInt = floor( mip );\n		vec3 color0 = bilinearCubeUV( envMap, sampleDir, mipInt );\n		if ( mipF == 0.0 ) {\n			return vec4( color0, 1.0 );\n		} else {\n			vec3 color1 = bilinearCubeUV( envMap, sampleDir, mipInt + 1.0 );\n			return vec4( mix( color0, color1, mipF ), 1.0 );\n		}\n	}\n#endif",defaultnormal_vertex:"vec3 transformedNormal = objectNormal;\n#ifdef USE_INSTANCING\n	mat3 m = mat3( instanceMatrix );\n	transformedNormal /= vec3( dot( m[ 0 ], m[ 0 ] ), dot( m[ 1 ], m[ 1 ] ), dot( m[ 2 ], m[ 2 ] ) );\n	transformedNormal = m * transformedNormal;\n#endif\ntransformedNormal = normalMatrix * transformedNormal;\n#ifdef FLIP_SIDED\n	transformedNormal = - transformedNormal;\n#endif\n#ifdef USE_TANGENT\n	vec3 transformedTangent = ( modelViewMatrix * vec4( objectTangent, 0.0 ) ).xyz;\n	#ifdef FLIP_SIDED\n		transformedTangent = - transformedTangent;\n	#endif\n#endif",displacementmap_pars_vertex:"#ifdef USE_DISPLACEMENTMAP\n	uniform sampler2D displacementMap;\n	uniform float displacementScale;\n	uniform float displacementBias;\n#endif",displacementmap_vertex:"#ifdef USE_DISPLACEMENTMAP\n	transformed += normalize( objectNormal ) * ( texture2D( displacementMap, vUv ).x * displacementScale + dis
36placementBias );\n#endif",emissivemap_fragment:"#ifdef USE_EMISSIVEMAP\n	vec4 emissiveColor = texture2D( emissiveMap, vUv );\n	totalEmissiveRadiance *= emissiveColor.rgb;\n#endif",emissivemap_pars_fragment:"#ifdef USE_EMISSIVEMAP\n	uniform sampler2D emissiveMap;\n#endif",encodings_fragment:"gl_FragColor = linearToOutputTexel( gl_FragColor );",encodings_pars_fragment:"vec4 LinearToLinear( in vec4 value ) {\n	return value;\n}\nvec4 LinearTosRGB( in vec4 value ) {\n	return vec4( mix( pow( value.rgb, vec3( 0.41666 ) ) * 1.055 - vec3( 0.055 ), value.rgb * 12.92, vec3( lessThanEqual( value.rgb, vec3( 0.0031308 ) ) ) ), value.a );\n}",envmap_fragment:"#ifdef USE_ENVMAP\n	#ifdef ENV_WORLDPOS\n		vec3 cameraToFrag;\n		if ( isOrthographic ) {\n			cameraToFrag = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) );\n		} else {\n			cameraToFrag = normalize( vWorldPosition - cameraPosition );\n		}\n		vec3 worldNormal = inverseTransformDirection( normal, viewMatrix );\n		#ifdef ENVMAP_MODE_REFLECTION\n			vec3 reflectVec = reflect( cameraToFrag, worldNormal );\n		#else\n			vec3 reflectVec = refract( cameraToFrag, worldNormal, refractionRatio );\n		#endif\n	#else\n		vec3 reflectVec = vReflect;\n	#endif\n	#ifdef ENVMAP_TYPE_CUBE\n		vec4 envColor = textureCube( envMap, vec3( flipEnvMap * reflectVec.x, reflectVec.yz ) );\n	#elif defined( ENVMAP_TYPE_CUBE_UV )\n		vec4 envColor = textureCubeUV( envMap, reflectVec, 0.0 );\n	#else\n		vec4 envColor = vec4( 0.0 );\n	#endif\n	#ifdef ENVMAP_BLENDING_MULTIPLY\n		outgoingLight = mix( outgoingLight, outgoingLight * envColor.xyz, specularStrength * reflectivity );\n	#elif defined( ENVMAP_BLENDING_MIX )\n		outgoingLight = mix( outgoingLight, envColor.xyz, specularStrength * reflectivity );\n	#elif defined( ENVMAP_BLENDING_ADD )\n		outgoingLight += envColor.xyz * specularStrength * reflectivity;\n	#endif\n#endif",envmap_common_pars_fragment:"#ifdef USE_ENVMAP\n	uniform float envMapIntensity;\n	uniform float flipEnvMap;\n	#ifdef ENVMAP_TYPE_CUBE\n		uniform samplerCube envMap;\n	#else\n		uniform sampler2D envMap;\n	#endif\n	\n#endif",envmap_pars_fragment:"#ifdef USE_ENVMAP\n	uniform float reflectivity;\n	#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG )\n		#define ENV_WORLDPOS\n	#endif\n	#ifdef ENV_WORLDPOS\n		varying vec3 vWorldPosition;\n		uniform float refractionRatio;\n	#else\n		varying vec3 vReflect;\n	#endif\n#endif",envmap_pars_vertex:"#ifdef USE_ENVMAP\n	#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) ||defined( PHONG )\n		#define ENV_WORLDPOS\n	#endif\n	#ifdef ENV_WORLDPOS\n		\n		varying vec3 vWorldPosition;\n	#else\n		varying vec3 vReflect;\n		uniform float refractionRatio;\n	#endif\n#endif",envmap_physical_pars_fragment:"#if defined( USE_ENVMAP )\n	vec3 getIBLIrradiance( const in vec3 normal ) {\n		#if defined( ENVMAP_TYPE_CUBE_UV )\n			vec3 worldNormal = inverseTransformDirection( normal, viewMatrix );\n			vec4 envMapColor = textureCubeUV( envMap, worldNormal, 1.0 );\n			return PI * envMapColor.rgb * envMapIntensity;\n		#else\n			return vec3( 0.0 );\n		#endif\n	}\n	vec3 getIBLRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness ) {\n		#if defined( ENVMAP_TYPE_CUBE_UV )\n			vec3 reflectVec = reflect( - viewDir, normal );\n			reflectVec = normalize( mix( reflectVec, normal, roughness * roughness) );\n			reflectVec = inverseTransformDirection( reflectVec, viewMatrix );\n			vec4 envMapColor = textureCubeUV( envMap, reflectVec, roughness );\n			return envMapColor.rgb * envMapIntensity;\n		#else\n			return vec3( 0.0 );\n		#endif\n	}\n#endif",envmap_vertex:"#ifdef USE_ENVMAP\n	#ifdef ENV_WORLDPOS\n		vWorldPosition = worldPosition.xyz;\n	#else\n		vec3 cameraToVertex;\n		if ( isOrthographic ) {\n			cameraToVertex = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) );\n		}
36 else {\n			cameraToVertex = normalize( worldPosition.xyz - cameraPosition );\n		}\n		vec3 worldNormal = inverseTransformDirection( transformedNormal, viewMatrix );\n		#ifdef ENVMAP_MODE_REFLECTION\n			vReflect = reflect( cameraToVertex, worldNormal );\n		#else\n			vReflect = refract( cameraToVertex, worldNormal, refractionRatio );\n		#endif\n	#endif\n#endif",fog_vertex:"#ifdef USE_FOG\n	vFogDepth = - mvPosition.z;\n#endif",fog_pars_vertex:"#ifdef USE_FOG\n	varying float vFogDepth;\n#endif",fog_fragment:"#ifdef USE_FOG\n	#ifdef FOG_EXP2\n		float fogFactor = 1.0 - exp( - fogDensity * fogDensity * vFogDepth * vFogDepth );\n	#else\n		float fogFactor = smoothstep( fogNear, fogFar, vFogDepth );\n	#endif\n	gl_FragColor.rgb = mix( gl_FragColor.rgb, fogColor, fogFactor );\n#endif",fog_pars_fragment:"#ifdef USE_FOG\n	uniform vec3 fogColor;\n	varying float vFogDepth;\n	#ifdef FOG_EXP2\n		uniform float fogDensity;\n	#else\n		uniform float fogNear;\n		uniform float fogFar;\n	#endif\n#endif",gradientmap_pars_fragment:"#ifdef USE_GRADIENTMAP\n	uniform sampler2D gradientMap;\n#endif\nvec3 getGradientIrradiance( vec3 normal, vec3 lightDirection ) {\n	float dotNL = dot( normal, lightDirection );\n	vec2 coord = vec2( dotNL * 0.5 + 0.5, 0.0 );\n	#ifdef USE_GRADIENTMAP\n		return vec3( texture2D( gradientMap, coord ).r );\n	#else\n		return ( coord.x < 0.7 ) ? vec3( 0.7 ) : vec3( 1.0 );\n	#endif\n}",lightmap_fragment:"#ifdef USE_LIGHTMAP\n	vec4 lightMapTexel = texture2D( lightMap, vUv2 );\n	vec3 lightMapIrradiance = lightMapTexel.rgb * lightMapIntensity;\n	reflectedLight.indirectDiffuse += lightMapIrradiance;\n#endif",lightmap_pars_fragment:"#ifdef USE_LIGHTMAP\n	uniform sampler2D lightMap;\n	uniform float lightMapIntensity;\n#endif",lights_lambert_vertex:"vec3 diffuse = vec3( 1.0 );\nGeometricContext geometry;\ngeometry.position = mvPosition.xyz;\ngeometry.normal = normalize( transformedNormal );\ngeometry.viewDir = ( isOrthographic ) ? vec3( 0, 0, 1 ) : normalize( -mvPosition.xyz );\nGeometricContext backGeometry;\nbackGeometry.position = geometry.position;\nbackGeometry.normal = -geometry.normal;\nbackGeometry.viewDir = geometry.viewDir;\nvLightFront = vec3( 0.0 );\nvIndirectFront = vec3( 0.0 );\n#ifdef DOUBLE_SIDED\n	vLightBack = vec3( 0.0 );\n	vIndirectBack = vec3( 0.0 );\n#endif\nIncidentLight directLight;\nfloat dotNL;\nvec3 directLightColor_Diffuse;\nvIndirectFront += getAmbientLightIrradiance( ambientLightColor );\nvIndirectFront += getLightProbeIrradiance( lightProbe, geometry.normal );\n#ifdef DOUBLE_SIDED\n	vIndirectBack += getAmbientLightIrradiance( ambientLightColor );\n	vIndirectBack += getLightProbeIrradiance( lightProbe, backGeometry.normal );\n#endif\n#if NUM_POINT_LIGHTS > 0\n	#pragma unroll_loop_start\n	for ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {\n		getPointLightInfo( pointLights[ i ], geometry, directLight );\n		dotNL = dot( geometry.normal, directLight.direction );\n		directLightColor_Diffuse = directLight.color;\n		vLightFront += saturate( dotNL ) * directLightColor_Diffuse;\n		#ifdef DOUBLE_SIDED\n			vLightBack += saturate( - dotNL ) * directLightColor_Diffuse;\n		#endif\n	}\n	#pragma unroll_loop_end\n#endif\n#if NUM_SPOT_LIGHTS > 0\n	#pragma unroll_loop_start\n	for ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {\n		getSpotLightInfo( spotLights[ i ], geometry, directLight );\n		dotNL = dot( geometry.normal, directLight.direction );\n		directLightColor_Diffuse = directLight.color;\n		vLightFront += saturate( dotNL ) * directLightColor_Diffuse;\n		#ifdef DOUBLE_SIDED\n			vLightBack += saturate( - dotNL ) * directLightColor_Diffuse;\n		#endif\n	}\n	#pragma unroll_loop_end\n#endif\n#if NUM_DIR_LIGHTS > 0\n	#pragma unroll_loop_start\n	for ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {\n		getDirectionalLightInfo( directionalLights[ i ], geometry, directLight );\n		dotNL = dot( geometry.normal, directLight.direction );\n		directLightColor_Diffuse = directLight.color;\n		vLightFront += saturate( dotNL ) * directLightColor_Diffuse;\n		#ifdef DOUBLE_SIDED\n			vLightBack += saturate( - dotNL ) * directLightColor_Diffuse;\n		#endif\n	}\n	#pragma unroll_loop_end\n#endif\n#if NUM_HEMI_LIGHTS > 0\n	#pragma unroll_loop_start\n	for ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) {\n		vIndirectFront += getHemisphereLightIrradiance( hemisphereLights[ i ], geometry.normal );\n		#ifdef DOUBLE_SIDED\n			vIndirectBack += getHemisphereLightIrradiance( hemisphereLights[ i ], backGeometry.normal );\n		#endif\n	}\n	#pragma unroll_loop_end\n#endif",lights_pars_begin:"uniform bool receiveShadow;\nuniform vec3 ambientLightColor;\nuniform vec3 lightProbe[ 9 ];\nvec3 shGetIrradianceAt( in vec3 normal, in vec3 shCoefficients[ 9 ] ) {\n	float x = normal.x, y = normal.y, z = normal.z;\n	vec3 result = shCoefficients[ 0 ] * 0.886227;\n	result += shCoefficients[ 1 ] * 2.0 * 0.511664 * y;\n	result += shCoefficients[ 2 ] * 2.0 * 0.511664 * z;\n	result += shCoefficients[ 3 ] * 2.0 * 0.511664 * x;\n	result += shCoefficients[ 4 ] * 2.0 * 0.429043 * x * y;\n	result += shCoefficients[ 5 ] * 2.0 * 0.429043 * y * z;\n	result += shCoefficients[ 6 ] * ( 0.743125 * z * z - 0.247708 );\n	result += shCoefficients[ 7 ] * 2.0 * 0.429043 * x * z;\n	result += shCoefficients[ 8 ] * 0.429043 * ( x * x - y * y );\n	return result;\n}\nvec3 getLightProbeIrradiance( const in vec3 lightProbe[ 9 ], const in vec3 normal ) {\n	vec3 worldNormal = inverseTransformDirection( normal, viewMatrix );\n	vec3 irradiance = shGetIrradianceAt( worldNormal, lightProbe );\n	return irradiance;\n}\nvec3 getAmbientLightIrradiance( const in vec3 ambientLightColor ) {\n	vec3 irradiance = ambientLightColor;\n	return irradiance;\n}\nfloat getDistanceAttenuation( const in float lightDistance, const in float cutoffDistance, const in float decayExponent ) {\n	#if defined ( PHYSICALLY_CORRECT_LIGHTS )\n		float distanceFalloff = 1.0 / max( pow( lightDistance, decayExponent ), 0.01 );\n		if ( cutoffDistance > 0.0 ) {\n			distanceFalloff *= pow2( saturate( 1.0 - pow4( lightDistance / cutoffDistance ) ) );\n		}\n		return distanceFalloff;\n	#else\n		if ( cutoffDistance > 0.0 && decayExponent > 0.0 ) {\n			return pow( saturate( - lightDistance / cutoffDistance + 1.0 ), decayExponent );\n		}\n		return 1.0;\n	#endif\n}\nfloat getSpotAttenuation( const in float coneCosine, const in float penumbraCosine, const in float angleCosine ) {\n	return smoothstep( coneCosine, penumbraCosine, angleCosine );\n}\n#if NUM_DIR_LIGHTS > 0\n	struct DirectionalLight {\n		vec3 direction;\n		vec3 color;\n	};\n	uniform DirectionalLight directionalLights[ NUM_DIR_LIGHTS ];\n	void getDirectionalLightInfo( const in DirectionalLight directionalLight, const in GeometricContext geometry, out IncidentLight light ) {\n		light.color = directionalLight.color;\n		light.direction = directionalLight.direction;\n		light.visible = true;\n	}\n#endif\n#if NUM_POINT_LIGHTS > 0\n	struct PointLight {\n		vec3 position;\n		vec3 color;\n		float distance;\n		float decay;\n	};\n	uniform PointLight pointLights[ NUM_POINT_LIGHTS ];\n	void getPointLightInfo( const in PointLight pointLight, const in GeometricContext geometry, out IncidentLight light ) {\n		vec3 lVector = pointLight.position - geometry.position;\n		light.direction = normalize( lVector );\n		float lightDistance = length( lVector );\n		light.color = pointLight.color;\n		light.color *= getDistanceAttenuation( lightDistance, pointLight.distance, pointLight.decay );\n		light.visible = ( light.color != vec3( 0.0 ) );\n	}
36\n#endif\n#if NUM_SPOT_LIGHTS > 0\n	struct SpotLight {\n		vec3 position;\n		vec3 direction;\n		vec3 color;\n		float distance;\n		float decay;\n		float coneCos;\n		float penumbraCos;\n	};\n	uniform SpotLight spotLights[ NUM_SPOT_LIGHTS ];\n	void getSpotLightInfo( const in SpotLight spotLight, const in GeometricContext geometry, out IncidentLight light ) {\n		vec3 lVector = spotLight.position - geometry.position;\n		light.direction = normalize( lVector );\n		float angleCos = dot( light.direction, spotLight.direction );\n		float spotAttenuation = getSpotAttenuation( spotLight.coneCos, spotLight.penumbraCos, angleCos );\n		if ( spotAttenuation > 0.0 ) {\n			float lightDistance = length( lVector );\n			light.color = spotLight.color * spotAttenuation;\n			light.color *= getDistanceAttenuation( lightDistance, spotLight.distance, spotLight.decay );\n			light.visible = ( light.color != vec3( 0.0 ) );\n		} else {\n			light.color = vec3( 0.0 );\n			light.visible = false;\n		}\n	}\n#endif\n#if NUM_RECT_AREA_LIGHTS > 0\n	struct RectAreaLight {\n		vec3 color;\n		vec3 position;\n		vec3 halfWidth;\n		vec3 halfHeight;\n	};\n	uniform sampler2D ltc_1;	uniform sampler2D ltc_2;\n	uniform RectAreaLight rectAreaLights[ NUM_RECT_AREA_LIGHTS ];\n#endif\n#if NUM_HEMI_LIGHTS > 0\n	struct HemisphereLight {\n		vec3 direction;\n		vec3 skyColor;\n		vec3 groundColor;\n	};\n	uniform HemisphereLight hemisphereLights[ NUM_HEMI_LIGHTS ];\n	vec3 getHemisphereLightIrradiance( const in HemisphereLight hemiLight, const in vec3 normal ) {\n		float dotNL = dot( normal, hemiLight.direction );\n		float hemiDiffuseWeight = 0.5 * dotNL + 0.5;\n		vec3 irradiance = mix( hemiLight.groundColor, hemiLight.skyColor, hemiDiffuseWeight );\n		return irradiance;\n	}\n#endif",lights_toon_fragment:"ToonMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb;",lights_toon_pars_fragment:"varying vec3 vViewPosition;\nstruct ToonMaterial {\n	vec3 diffuseColor;\n};\nvoid RE_Direct_Toon( const in IncidentLight directLight, const in GeometricContext geometry, const in ToonMaterial material, inout ReflectedLight reflectedLight ) {\n	vec3 irradiance = getGradientIrradiance( geometry.normal, directLight.direction ) * directLight.color;\n	reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\nvoid RE_IndirectDiffuse_Toon( const in vec3 irradiance, const in GeometricContext geometry, const in ToonMaterial material, inout ReflectedLight reflectedLight ) {\n	reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\n#define RE_Direct				RE_Direct_Toon\n#define RE_IndirectDiffuse		RE_IndirectDiffuse_Toon\n#define Material_LightProbeLOD( material )	(0)",lights_phong_fragment:"BlinnPhongMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb;\nmaterial.specularColor = specular;\nmaterial.specularShininess = shininess;\nmaterial.specularStrength = specularStrength;",lights_phong_pars_fragment:"varying vec3 vViewPosition;\nstruct BlinnPhongMaterial {\n	vec3 diffuseColor;\n	vec3 specularColor;\n	float specularShininess;\n	float specularStrength;\n};\nvoid RE_Direct_BlinnPhong( const in IncidentLight directLight, const in GeometricContext geometry, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {\n	float dotNL = saturate( dot( geometry.normal, directLight.direction ) );\n	vec3 irradiance = dotNL * directLight.color;\n	reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n	reflectedLight.directSpecular += irradiance * BRDF_BlinnPhong( directLight.direction, geometry.viewDir, geometry.normal, material.specularColor, material.specularShininess ) * material.specularStrength;\n}\nvoid RE_IndirectDiffuse_BlinnPhong( const in vec3 irradiance, const in GeometricContext geometry, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {\n	reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\n#define RE_Direct				RE_Direct_BlinnPhong\n#define RE_IndirectDiffuse		RE_IndirectDiffuse_BlinnPhong\n#define Material_LightProbeLOD( material )	(0)",lights_physical_fragment:"PhysicalMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb * ( 1.0 - metalnessFactor );\nvec3 dxy = max( abs( dFdx( geometryNormal ) ), abs( dFdy( geometryNormal ) ) );\nfloat geometryRoughness = max( max( dxy.x, dxy.y ), dxy.z );\nmaterial.roughness = max( roughnessFactor, 0.0525 );material.roughness += geometryRoughness;\nmaterial.roughness = min( material.roughness, 1.0 );\n#ifdef IOR\n	#ifdef SPECULAR\n		float specularIntensityFactor = specularIntensity;\n		vec3 specularColorFactor = specularColor;\n		#ifdef USE_SPECULARINTENSITYMAP\n			specularIntensityFactor *= texture2D( specularIntensityMap, vUv ).a;\n		#endif\n		#ifdef USE_SPECULARCOLORMAP\n			specularColorFactor *= texture2D( specularColorMap, vUv ).rgb;\n		#endif\n		material.specularF90 = mix( specularIntensityFactor, 1.0, metalnessFactor );\n	#else\n		float specularIntensityFactor = 1.0;\n		vec3 specularColorFactor = vec3( 1.0 );\n		material.specularF90 = 1.0;\n	#endif\n	material.specularColor = mix( min( pow2( ( ior - 1.0 ) / ( ior + 1.0 ) ) * specularColorFactor, vec3( 1.0 ) ) * specularIntensityFactor, diffuseColor.rgb, metalnessFactor );\n#else\n	material.specularColor = mix( vec3( 0.04 ), diffuseColor.rgb, metalnessFactor );\n	material.specularF90 = 1.0;\n#endif\n#ifdef USE_CLEARCOAT\n	material.clearcoat = clearcoat;
36\n	material.clearcoatRoughness = clearcoatRoughness;\n	material.clearcoatF0 = vec3( 0.04 );\n	material.clearcoatF90 = 1.0;\n	#ifdef USE_CLEARCOATMAP\n		material.clearcoat *= texture2D( clearcoatMap, vUv ).x;\n	#endif\n	#ifdef USE_CLEARCOAT_ROUGHNESSMAP\n		material.clearcoatRoughness *= texture2D( clearcoatRoughnessMap, vUv ).y;\n	#endif\n	material.clearcoat = saturate( material.clearcoat );	material.clearcoatRoughness = max( material.clearcoatRoughness, 0.0525 );\n	material.clearcoatRoughness += geometryRoughness;\n	material.clearcoatRoughness = min( material.clearcoatRoughness, 1.0 );\n#endif\n#ifdef USE_IRIDESCENCE\n	material.iridescence = iridescence;\n	material.iridescenceIOR = iridescenceIOR;\n	#ifdef USE_IRIDESCENCEMAP\n		material.iridescence *= texture2D( iridescenceMap, vUv ).r;\n	#endif\n	#ifdef USE_IRIDESCENCE_THICKNESSMAP\n		material.iridescenceThickness = (iridescenceThicknessMaximum - iridescenceThicknessMinimum) * texture2D( iridescenceThicknessMap, vUv ).g + iridescenceThicknessMinimum;\n	#else\n		material.iridescenceThickness = iridescenceThicknessMaximum;\n	#endif\n#endif\n#ifdef USE_SHEEN\n	material.sheenColor = sheenColor;\n	#ifdef USE_SHEENCOLORMAP\n		material.sheenColor *= texture2D( sheenColorMap, vUv ).rgb;\n	#endif\n	material.sheenRoughness = clamp( sheenRoughness, 0.07, 1.0 );\n	#ifdef USE_SHEENROUGHNESSMAP\n		material.sheenRoughness *= texture2D( sheenRoughnessMap, vUv ).a;\n	#endif\n#endif",lights_physical_pars_fragment:"struct PhysicalMaterial {\n	vec3 diffuseColor;\n	float roughness;\n	vec3 specularColor;\n	float specularF90;\n	#ifdef USE_CLEARCOAT\n		float clearcoat;\n		float clearcoatRoughness;\n		vec3 clearcoatF0;\n		float clearcoatF90;\n	#endif\n	#ifdef USE_IRIDESCENCE\n		float iridescence;\n		float iridescenceIOR;\n		float iridescenceThickness;\n		vec3 iridescenceFresnel;\n		vec3 iridescenceF0;\n	#endif\n	#ifdef USE_SHEEN\n		vec3 sheenColor;\n		float sheenRoughness;\n	#endif\n};\nvec3 clearcoatSpecular = vec3( 0.0 );\nvec3 sheenSpecular = vec3( 0.0 );\nfloat IBLSheenBRDF( const in vec3 normal, const in vec3 viewDir, const in float roughness) {\
36n	float dotNV = saturate( dot( normal, viewDir ) );\n	float r2 = roughness * roughness;\n	float a = roughness < 0.25 ? -339.2 * r2 + 161.4 * roughness - 25.9 : -8.48 * r2 + 14.3 * roughness - 9.95;\n	float b = roughness < 0.25 ? 44.0 * r2 - 23.7 * roughness + 3.26 : 1.97 * r2 - 3.27 * roughness + 0.72;\n	float DG = exp( a * dotNV + b ) + ( roughness < 0.25 ? 0.0 : 0.1 * ( roughness - 0.25 ) );\n	return saturate( DG * RECIPROCAL_PI );\n}\nvec2 DFGApprox( const in vec3 normal, const in vec3 viewDir, const in float roughness ) {\n	float dotNV = saturate( dot( normal, viewDir ) );\n	const vec4 c0 = vec4( - 1, - 0.0275, - 0.572, 0.022 );\n	const vec4 c1 = vec4( 1, 0.0425, 1.04, - 0.04 );\n	vec4 r = roughness * c0 + c1;\n	float a004 = min( r.x * r.x, exp2( - 9.28 * dotNV ) ) * r.x + r.y;\n	vec2 fab = vec2( - 1.04, 1.04 ) * a004 + r.zw;\n	return fab;\n}\nvec3 EnvironmentBRDF( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float roughness ) {\n	vec2 fab = DFGApprox( normal, viewDir, roughness );\n	return specularColor * fab.x + specularF90 * fab.y;\n}\n#ifdef USE_IRIDESCENCE\nvoid computeMultiscatteringIridescence( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float iridescence, const in vec3 iridescenceF0, const in float roughness, inout vec3 singleScatter, inout vec3 multiScatter ) {\n#else\nvoid computeMultiscattering( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float roughness, inout vec3 singleScatter, inout vec3 multiScatter ) {\n#endif\n	vec2 fab = DFGApprox( normal, viewDir, roughness );\n	#ifdef USE_IRIDESCENCE\n		vec3 Fr = mix( specularColor, iridescenceF0, iridescence );\n	#else\n		vec3 Fr = specularColor;\n	#endif\n	vec3 FssEss = Fr * fab.x + specularF90 * fab.y;\n	float Ess = fab.x + fab.y;\n	float Ems = 1.0 - Ess;\n	vec3 Favg = Fr + ( 1.0 - Fr ) * 0.047619;	vec3 Fms = FssEss * Favg / ( 1.0 - Ems * Favg );\n	singleScatter += FssEss;\n	multiScatter += Fms * Ems;\n}\n#if NUM_RECT_AREA_LIGHTS > 0\n	void RE_Direct_RectArea_Physical( const in RectAreaLight rectAreaLight, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n		vec3 normal = geometry.normal;\n		vec3 viewDir = geometry.viewDir;\n		vec3 position = geometry.position;\n		vec3 lightPos = rectAreaLight.position;\n		vec3 halfWidth = rectAreaLight.halfWidth;\n		vec3 halfHeight = rectAreaLight.halfHeight;\n		vec3 lightColor = rectAreaLight.color;\n		float roughness = material.roughness;\n		vec3 rectCoords[ 4 ];\n		rectCoords[ 0 ] = lightPos + halfWidth - halfHeight;		rectCoords[ 1 ] = lightPos - halfWidth - halfHeight;\n		rectCoords[ 2 ] = lightPos - halfWidth + halfHeight;\n		rectCoords[ 3 ] = lightPos + halfWidth + halfHeight;\n		vec2 uv = LTC_Uv( normal, viewDir, roughness );\n		vec4 t1 = texture2D( ltc_1, uv );\n		vec4 t2 = texture2D( ltc_2, uv );\n		mat3 mInv = mat3(\n			vec3( t1.x, 0, t1.y ),\n			vec3(    0, 1,    0 ),\n			vec3( t1.z, 0, t1.w )\n		);\n		vec3 fresnel = ( material.specularColor * t2.x + ( vec3( 1.0 ) - material.specularColor ) * t2.y );\n		reflectedLight.directSpecular += lightColor * fresnel * LTC_Evaluate( normal, viewDir, position, mInv, rectCoords );\n		reflectedLight.directDiffuse += lightColor * material.diffuseColor * LTC_Evaluate( normal, viewDir, position, mat3( 1.0 ), rectCoords );\n	}\n#endif\nvoid RE_Direct_Physical( const in IncidentLight directLight, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n	float dotNL = saturate( dot( geometry.normal, directLight.direction ) );\n	vec3 irradiance = dotNL * directLight.color;\n	#ifdef USE_CLEARCOAT\n		float dotNLcc = saturate( dot( geometry.clearcoatNormal, directLight.direction ) );\n		vec3 ccIrradiance = dotNLcc * directLight.color;\n		clearcoatSpecular += ccIrradiance * BRDF_GGX( directLight.direction, geometry.viewDir, geometry.clearcoatNormal, material.clearcoatF0, material.clearcoatF90, material.clearcoatRoughness );\n	#endif\n	#ifdef USE_SHEEN\n		sheenSpecular += irradiance * BRDF_Sheen( directLight.direction, geometry.viewDir, geometry.normal, material.sheenColor, material.sheenRoughness );
36\n	#endif\n	#ifdef USE_IRIDESCENCE\n		reflectedLight.directSpecular += irradiance * BRDF_GGX_Iridescence( directLight.direction, geometry.viewDir, geometry.normal, material.specularColor, material.specularF90, material.iridescence, material.iridescenceFresnel, material.roughness );\n	#else\n		reflectedLight.directSpecular += irradiance * BRDF_GGX( directLight.direction, geometry.viewDir, geometry.normal, material.specularColor, material.specularF90, material.roughness );\n	#endif\n	reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\nvoid RE_IndirectDiffuse_Physical( const in vec3 irradiance, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n	reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\nvoid RE_IndirectSpecular_Physical( const in vec3 radiance, const in vec3 irradiance, const in vec3 clearcoatRadiance, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight) {\n	#ifdef USE_CLEARCOAT\n		clearcoatSpecular += clearcoatRadiance * EnvironmentBRDF( geometry.clearcoatNormal, geometry.viewDir, material.clearcoatF0, material.clearcoatF90, material.clearcoatRoughness );\n	#endif\n	#ifdef USE_SHEEN\n		sheenSpecular += irradiance * material.sheenColor * IBLSheenBRDF( geometry.normal, geometry.viewDir, material.sheenRoughness );\n	#endif\n	vec3 singleScattering = vec3( 0.0 );\n	vec3 multiScattering = vec3( 0.0 );\n	vec3 cosineWeightedIrradiance = irradiance * RECIPROCAL_PI;\n	#ifdef USE_IRIDESCENCE\n		computeMultiscatteringIridescence( geometry.normal, geometry.viewDir, material.specularColor, material.specularF90, material.iridescence, material.iridescenceFresnel, material.roughness, singleScattering, multiScattering );\n	#else\n		computeMultiscattering( geometry.normal, geometry.viewDir, material.specularColor, material.specularF90, material.roughness, singleScattering, multiScattering );\n	#endif\n	vec3 totalScattering = singleScattering + multiScattering;\n	vec3 diffuse = material.diffuseColor * ( 1.0 - max( max( totalScattering.r, totalScattering.g ), totalScattering.b ) );\n	reflectedLight.indirectSpecular += radiance * singleScattering;\n	reflectedLight.indirectSpecular += multiScattering * cosineWeightedIrradiance;\n	reflectedLight.indirectDiffuse += diffuse * cosineWeightedIrradiance;\n}\n#define RE_Direct				RE_Direct_Physical\n#define RE_Direct_RectArea		RE_Direct_RectArea_Physical\n#define RE_IndirectDiffuse		RE_IndirectDiffuse_Physical\n#define RE_IndirectSpecular		RE_IndirectSpecular_Physical\nfloat computeSpecularOcclusion( const in float dotNV, const in float ambientOcclusion, const in float roughness ) {\n	return saturate( pow( dotNV + ambientOcclusion, exp2( - 16.0 * roughness - 1.0 ) ) - 1.0 + ambientOcclusion );\n}",lights_fragment_begin:"\nGeometricContext geometry;\ngeometry.position = - vViewPosition;\ngeometry.normal = normal;\ngeometry.viewDir = ( isOrthographic ) ? vec3( 0, 0, 1 ) : normalize( vViewPosition );\n#ifdef USE_CLEARCOAT\n	geometry.clearcoatNormal = clearcoatNormal;\n#endif\n#ifdef USE_IRIDESCENCE\n	float dotNVi = saturate( dot( normal, geometry.viewDir ) );\n	if ( material.iridescenceThickness == 0.0 ) {\n		material.iridescence = 0.0;\n	} else {\n		material.iridescence = saturate( material.iridescence );\n	}\n	if ( material.iridescence > 0.0 ) {\n		material.iridescenceFresnel = evalIridescence( 1.0, material.iridescenceIOR, dotNVi, material.iridescenceThickness, material.specularColor );\n		material.iridescenceF0 = Schlick_to_F0( material.iridescenceFresnel, 1.0, dotNVi );\n	}\n#endif\nIncidentLight directLight;\n#if ( NUM_POINT_LIGHTS > 0 ) && defined( RE_Direct )\n	PointLight pointLight;\n	#if defined( USE_SHADOWMAP ) && NUM_POINT_LIGHT_SHADOWS > 0\n	PointLightShadow pointLightShadow;\n	#endif\n	#pragma unroll_loop_start\n	for ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {\n		pointLight = pointLights[ i ];\n		getPointLightInfo( pointLight, geometry, directLight );\n		#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_POINT_LIGHT_SHADOWS )\n		pointLightShadow = pointLightShadows[ i ];\n		directLight.color *= all( bvec2( directLight.visible, receiveShadow ) ) ? getPointShadow( pointShadowMap[ i ], pointLightShadow.shadowMapSize, pointLightShadow.shadowBias, pointLightShadow.shadowRadius, vPointShadowCoord[ i ], pointLightShadow.shadowCameraNear, pointLightShadow.shadowCameraFar ) : 1.0;\n		#endif\n		RE_Direct( directLight, geometry, material, reflectedLight );\n	}
36\n	#pragma unroll_loop_end\n#endif\n#if ( NUM_SPOT_LIGHTS > 0 ) && defined( RE_Direct )\n	SpotLight spotLight;\n	#if defined( USE_SHADOWMAP ) && NUM_SPOT_LIGHT_SHADOWS > 0\n	SpotLightShadow spotLightShadow;\n	#endif\n	#pragma unroll_loop_start\n	for ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {\n		spotLight = spotLights[ i ];\n		getSpotLightInfo( spotLight, geometry, directLight );\n		#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )\n		spotLightShadow = spotLightShadows[ i ];\n		directLight.color *= all( bvec2( directLight.visible, receiveShadow ) ) ? getShadow( spotShadowMap[ i ], spotLightShadow.shadowMapSize, spotLightShadow.shadowBias, spotLightShadow.shadowRadius, vSpotShadowCoord[ i ] ) : 1.0;\n		#endif\n		RE_Direct( directLight, geometry, material, reflectedLight );\n	}\n	#pragma unroll_loop_end\n#endif\n#if ( NUM_DIR_LIGHTS > 0 ) && defined( RE_Direct )\n	DirectionalLight directionalLight;\n	#if defined( USE_SHADOWMAP ) && NUM_DIR_LIGHT_SHADOWS > 0\n	DirectionalLightShadow directionalLightShadow;\n	#endif\n	#pragma unroll_loop_start\n	for ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {\n		directionalLight = directionalLights[ i ];\n		getDirectionalLightInfo( directionalLight, geometry, directLight );\n		#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_DIR_LIGHT_SHADOWS )\n		directionalLightShadow = directionalLightShadows[ i ];\n		directLight.color *= all( bvec2( directLight.visible, receiveShadow ) ) ? getShadow( directionalShadowMap[ i ], directionalLightShadow.shadowMapSize, directionalLightShadow.shadowBias, directionalLightShadow.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;\n		#endif\n		RE_Direct( directLight, geometry, material, reflectedLight );\n	}\n	#pragma unroll_loop_end\n#endif\n#if ( NUM_RECT_AREA_LIGHTS > 0 ) && defined( RE_Direct_RectArea )\n	RectAreaLight rectAreaLight;\n	#pragma unroll_loop_start\n	for ( int i = 0; i < NUM_RECT_AREA_LIGHTS; i ++ ) {\n		rectAreaLight = rectAreaLights[ i ];\n		RE_Direct_RectArea( rectAreaLight, geometry, material, reflectedLight );\n	}\n	#pragma unroll_loop_end\n#endif\n#if defined( RE_IndirectDiffuse )\n	vec3 iblIrradiance = vec3( 0.0 );\n	vec3 irradiance = getAmbientLightIrradiance( ambientLightColor );\n	irradiance += getLightProbeIrradiance( lightProbe, geometry.normal );\n	#if ( NUM_HEMI_LIGHTS > 0 )\n		#pragma unroll_loop_start\n		for ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) {\n			irradiance += getHemisphereLightIrradiance( hemisphereLights[ i ], geometry.normal );\n		}\n		#pragma unroll_loop_end\n	#endif\n#endif\n#if defined( RE_IndirectSpecular )\n	vec3 radiance = vec3( 0.0 );\n	vec3 clearcoatRadiance = vec3( 0.0 );\n#endif",lights_fragment_maps:"#if defined( RE_IndirectDiffuse )\n	#ifdef USE_LIGHTMAP\n		vec4 lightMapTexel = texture2D( lightMap, vUv2 );\n		vec3 lightMapIrradiance = lightMapTexel.rgb * lightMapIntensity;\n		irradiance += lightMapIrradiance;\n	#endif\n	#if defined( USE_ENVMAP ) && defined( STANDARD ) && defined( ENVMAP_TYPE_CUBE_UV )\n		iblIrradiance += getIBLIrradiance( geometry.normal );\n	#endif\n#endif\n#if defined( USE_ENVMAP ) && defined( RE_IndirectSpecular )\n	radiance += getIBLRadiance( geometry.viewDir, geometry.normal, material.roughness );\n	#ifdef USE_CLEARCOAT\n		clearcoatRadiance += getIBLRadiance( geometry.viewDir, geometry.clearcoatNormal, material.clearcoatRoughness );\n	#endif\n#endif",lights_fragment_end:"#if defined( RE_IndirectDiffuse )\n	RE_IndirectDiffuse( irradiance, geometry, material, reflectedLight );\n#endif\n#if defined( RE_IndirectSpecular )\n	RE_IndirectSpecular( radiance, iblIrradiance, clearcoatRadiance, geometry, material, reflectedLight );\n#endif",logdepthbuf_fragment:"#if defined( USE_LOGDEPTHBUF ) && defined( USE_LOGDEPTHBUF_EXT )\n	gl_FragDepthEXT = vIsPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;\n#endif",logdepthbuf_pars_fragment:"#if defined( USE_LOGDEPTHBUF ) && defined( USE_LOGDEPTHBUF_EXT )\n	uniform float logDepthBufFC;\n	varying float vFragDepth;\n	varying float vIsPerspective;\n#endif",logdepthbuf_pars_vertex:"#ifdef USE_LOGDEPTHBUF\n	#ifdef USE_LOGDEPTHBUF_EXT\n		varying float vFragDepth;\n		varying float vIsPerspective;\n	#else\n		uniform float logDepthBufFC;\n	#endif\n#endif",logdepthbuf_vertex:"#ifdef USE_LOGDEPTHBUF\n	#ifdef USE_LOGDEPTHBUF_EXT\n		vFragDepth = 1.0 + gl_Position.w;\n		vIsPerspective = float( isPerspectiveMatrix( projectionMatrix ) );\n	#else\n		if ( isPerspectiveMatrix( projectionMatrix ) ) {\n			gl_Position.z = log2( max( EPSILON, gl_Position.w + 1.0 ) ) * logDepthBufFC - 1.0;\n			gl_Position.z *= gl_Position.w;\n		}\n	#endif\n#endif",map_fragment:"#ifdef USE_MAP\n	vec4 sampledDiffuseColor = texture2D( map, vUv );\n	#ifdef DECODE_VIDEO_TEXTURE\n		sampledDiffuseColor = vec4( mix( pow( sampledDiffuseColor.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), sampledDiffuseColor.rgb * 0.0773993808, vec3( lessThanEqual( sampledDiffuseColor.rgb, vec3( 0.04045 ) ) ) ), sampledDiffuseColor.w );\n	#endif\n	diffuseColor *= sampledDiffuseColor;\n#endif",map_pars_fragment:"#ifdef USE_MAP\n	uniform sampler2D map;\n#endif",map_particle_fragment:"#if defined( USE_MAP ) || defined( USE_ALPHAMAP )\n	vec2 uv = ( uvTransform * vec3( gl_PointCoord.x, 1.0 - gl_PointCoord.y, 1 ) ).xy;\n#endif\n#ifdef USE_MAP\n	diffuseColor *= texture2D( map, uv );\n#endif\n#ifdef USE_ALPHAMAP\n	diffuseColor.a *= texture2D( alphaMap, uv ).g;\n#endif",map_particle_pars_fragment:"#if defined( USE_MAP ) || defined( USE_ALPHAMAP )\n	uniform mat3 uvTransform;\n#endif\n#ifdef USE_MAP\n	uniform sampler2D map;\n#endif\n#ifdef USE_ALPHAMAP\n	uniform sampler2D alphaMap;\n#endif",metalnessmap_fragment:"float metalnessFactor = metalness;\n#ifdef USE_METALNESSMAP\n	vec4 texelMetalness = texture2D( metalnessMap, vUv );\n	metalnessFactor *= texelMetalness.b;\n#endif",metalnessmap_pars_fragment:"#ifdef USE_METALNESSMAP\n	uniform sampler2D metalnessMap;\n#endif",morphcolor_vertex:"#if defined( USE_MORPHCOLORS ) && defined( MORPHTARGETS_TEXTURE )\n	vColor *= morphTargetBaseInfluence;\n	for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {\n		#if defined( USE_COLOR_ALPHA )\n			if ( morphTargetInfluences[ i ] != 0.0 ) vColor += getMorph( gl_VertexID, i, 2 ) * morphTargetInfluences[ i ];\n		#elif defined( USE_COLOR )\n			if ( morphTargetInfluences[ i ] != 0.0 ) vColor += getMorph( gl_VertexID, i, 2 ).rgb * morphTargetInfluences[ i ];\n		#endif\n	}\n#endif",morphnormal_vertex:"#ifdef USE_MORPHNORMALS\n	objectNormal *= morphTargetBaseInfluence;\n	#ifdef MORPHTARGETS_TEXTURE\n		for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {\n			if ( morphTargetInfluences[ i ] != 0.0 ) objectNormal += getMorph( gl_VertexID, i, 1 ).xyz * morphTargetInfluences[ i ];\n		}\n	#else\n		objectNormal += morphNormal0 * morphTargetInfluences[ 0 ];\n		objectNormal += morphNormal1 * morphTargetInfluences[ 1 ];\n		objectNormal += morphNormal2 * morphTargetInfluences[ 2 ];\n		objectNormal += morphNormal3 * morphTargetInfluences[ 3 ];\n	#endif\n#endif",morphtarget_pars_vertex:"#ifdef USE_MORPHTARGETS\n	uniform float morphTargetBaseInfluence;\n	#ifdef MORPHTARGETS_TEXTURE\n		uniform float morphTargetInfluences[ MORPHTARGETS_COUNT ];\n		uniform sampler2DArray morphTargetsTexture;\n		uniform ivec2 morphTargetsTextureSize;\n		vec4 getMorph( const in int vertexIndex, const in int morphTargetIndex, const in int offset ) {\n			int texelIndex = vertexIndex * MORPHTARGETS_TEXTURE_STRIDE + offset;\n			int y = texelIndex / morphTargetsTextureSize.x;\n			int x = texelIndex - y * morphTargetsTextureSize.x;\n			ivec3 morphUV = ivec3( x, y, morphTargetIndex );\n			return texelFetch( morphTargetsTexture, morphUV, 0 );\n		}\n	#else\n		#ifndef USE_MORPHNORMALS\n			uniform float morphTargetInfluences[ 8 ];\n		#else\n			uniform float morphTargetInfluences[ 4 ];\n		#endif\n	#endif\n#endif",morphtarget_vertex:"#ifdef USE_MORPHTARGETS\n	transformed *= morphTargetBaseInfluence;\n	#ifdef MORPHTARGETS_TEXTURE\n		for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {\n			if ( morphTargetInfluences[ i ] != 0.0 ) transformed += getMorph( gl_VertexID, i, 0 ).xyz * morphTargetInfluences[ i ];\n		}\n	#else\n		transformed += morphTarget0 * morphTargetInfluences[ 0 ];\n		transformed += morphTarget1 * morphTargetInfluences[ 1 ];\n		transformed += morphTarget2 * morphTargetInfluences[ 2 ];\n		transformed += morphTarget3 * morphTargetInfluences[ 3 ];\n		#ifndef USE_MORPHNORMALS\n			transformed += morphTarget4 * morphTargetInfluences[ 4 ];\n			transformed += morphTarget5 * morphTargetInfluences[ 5 ];\n			transformed += morphTarget6 * morphTargetInfluences[ 6 ];\n			transformed += morphTarget7 * morphTargetInfluences[ 7 ];\n		#endif\n	#endif\n#endif",normal_fragment_begin:"float faceDirection = gl_FrontFacing ? 1.0 : - 1.0;\n#ifdef FLAT_SHADED\n	vec3 fdx = vec3( dFdx( vViewPosition.x ), dFdx( vViewPosition.y ), dFdx( vViewPosition.z ) );\n	vec3 fdy = vec3( dFdy( vViewPosition.x ), dFdy( vViewPosition.y ), dFdy( vViewPosition.z ) );\n	vec3 normal = normalize( cross( fdx, fdy ) );\n#else\n	vec3 normal = normalize( vNormal );\n	#ifdef DOUBLE_SIDED\n		normal = normal * faceDirection;\n	#endif\n	#ifdef USE_TANGENT\n		vec3 tangent = normalize( vTangent );\n		vec3 bitangent = normalize( vBitangent );\n		#ifdef DOUBLE_SIDED\n			tangent = tangent * faceDirection;\n			bitangent = bitangent * faceDirection;\n		#endif\n		#if defined( TANGENTSPACE_NORMALMAP ) || defined( USE_CLEARCOAT_NORMALMAP )\n			mat3 vTBN = mat3( tangent, bitangent, normal );\n		#endif\n	#endif\n#endif\nvec3 geometryNormal = normal;",normal_fragment_maps:"#ifdef OBJECTSPACE_NORMALMAP\n	normal = texture2D( normalMap, vUv ).xyz * 2.0 - 1.0;\n	#ifdef FLIP_SIDED\n		normal = - normal;\n	#endif\n	#ifdef DOUBLE_SIDED\n		normal = normal * faceDirection;\n	#endif\n	normal = normalize( normalMatrix * normal );\n#elif defined( TANGENTSPACE_NORMALMAP )\n	vec3 mapN = texture2D( normalMap, vUv ).xyz * 2.0 - 1.0;\n	mapN.xy *= normalScale;\n	#ifdef USE_TANGENT\n		normal = normalize( vTBN * mapN );
36\n	#else\n		normal = perturbNormal2Arb( - vViewPosition, normal, mapN, faceDirection );\n	#endif\n#elif defined( USE_BUMPMAP )\n	normal = perturbNormalArb( - vViewPosition, normal, dHdxy_fwd(), faceDirection );\n#endif",normal_pars_fragment:"#ifndef FLAT_SHADED\n	varying vec3 vNormal;\n	#ifdef USE_TANGENT\n		varying vec3 vTangent;\n		varying vec3 vBitangent;\n	#endif\n#endif",normal_pars_vertex:"#ifndef FLAT_SHADED\n	varying vec3 vNormal;\n	#ifdef USE_TANGENT\n		varying vec3 vTangent;\n		varying vec3 vBitangent;\n	#endif\n#endif",normal_vertex:"#ifndef FLAT_SHADED\n	vNormal = normalize( transformedNormal );\n	#ifdef USE_TANGENT\n		vTangent = normalize( transformedTangent );\n		vBitangent = normalize( cross( vNormal, vTangent ) * tangent.w );\n	#endif\n#endif",normalmap_pars_fragment:"#ifdef USE_NORMALMAP\n	uniform sampler2D normalMap;\n	uniform vec2 normalScale;\n#endif\n#ifdef OBJECTSPACE_NORMALMAP\n	uniform mat3 normalMatrix;\n#endif\n#if ! defined ( USE_TANGENT ) && ( defined ( TANGENTSPACE_NORMALMAP ) || defined ( USE_CLEARCOAT_NORMALMAP ) )\n	vec3 perturbNormal2Arb( vec3 eye_pos, vec3 surf_norm, vec3 mapN, float faceDirection ) {\n		vec3 q0 = dFdx( eye_pos.xyz );\n		vec3 q1 = dFdy( eye_pos.xyz );\n		vec2 st0 = dFdx( vUv.st );\n		vec2 st1 = dFdy( vUv.st );\n		vec3 N = surf_norm;\n		vec3 q1perp = cross( q1, N );\n		vec3 q0perp = cross( N, q0 );\n		vec3 T = q1perp * st0.x + q0perp * st1.x;\n		vec3 B = q1perp * st0.y + q0perp * st1.y;\n		float det = max( dot( T, T ), dot( B, B ) );\n		float scale = ( det == 0.0 ) ? 0.0 : faceDirection * inversesqrt( det );\n		return normalize( T * ( mapN.x * scale ) + B * ( mapN.y * scale ) + N * mapN.z );\n	}\n#endif",clearcoat_normal_fragment_begin:"#ifdef USE_CLEARCOAT\n	vec3 clearcoatNormal = geometryNormal;\n#endif",clearcoat_normal_fragment_maps:"#ifdef USE_CLEARCOAT_NORMALMAP\n	vec3 clearcoatMapN = texture2D( clearcoatNormalMap, vUv ).xyz * 2.0 - 1.0;\n	clearcoatMapN.xy *= clearcoatNormalScale;\n	#ifdef USE_TANGENT\n		clearcoatNormal = normalize( vTBN * clearcoatMapN );\n	#else\n		clearcoatNormal = perturbNormal2Arb( - vViewPosition, clearcoatNormal, clearcoatMapN, faceDirection );\n	#endif\n#endif",clearcoat_pars_fragment:"#ifdef USE_CLEARCOATMAP\n	uniform sampler2D clearcoatMap;\n#endif\n#ifdef USE_CLEARCOAT_ROUGHNESSMAP\n	uniform sampler2D clearcoatRoughnessMap;\n#endif\n#ifdef USE_CLEARCOAT_NORMALMAP\n	uniform sampler2D clearcoatNormalMap;\n	uniform vec2 clearcoatNormalScale;\n#endif",iridescence_pars_fragment:"#ifdef USE_IRIDESCENCEMAP\n	uniform sampler2D iridescenceMap;\n#endif\n#ifdef USE_IRIDESCENCE_THICKNESSMAP\n	uniform sampler2D iridescenceThicknessMap;\n#endif",output_fragment:"#ifdef OPAQUE\ndiffuseColor.a = 1.0;\n#endif\n#ifdef USE_TRANSMISSION\ndiffuseColor.a *= transmissionAlpha + 0.1;\n#endif\ngl_FragColor = vec4( outgoingLight, diffuseColor.a );",packing:"vec3 packNormalToRGB( const in vec3 normal ) {\n	return normalize( normal ) * 0.5 + 0.5;\n}\nvec3 unpackRGBToNormal( const in vec3 rgb ) {\n	return 2.0 * rgb.xyz - 1.0;\n}\nconst float PackUpscale = 256. / 255.;const float UnpackDownscale = 255. / 256.;\nconst vec3 PackFactors = vec3( 256. * 256. * 256., 256. * 256., 256. );\nconst vec4 UnpackFactors = UnpackDownscale / vec4( PackFactors, 1. );\nconst float ShiftRight8 = 1. / 256.;\nvec4 packDepthToRGBA( const in float v ) {\n	vec4 r = vec4( fract( v * PackFactors ), v );\n	r.yzw -= r.xyz * ShiftRight8;	return r * PackUpscale;\n}\nfloat unpackRGBAToDepth( const in vec4 v ) {\n	return dot( v, UnpackFactors );\n}\nvec4 pack2HalfToRGBA( vec2 v ) {\n	vec4 r = vec4( v.x, fract( v.x * 255.0 ), v.y, fract( v.y * 255.0 ) );\n	return vec4( r.x - r.y / 255.0, r.y, r.z - r.w / 255.0, r.w );\n}\nvec2 unpackRGBATo2Half( vec4 v ) {\n	return vec2( v.x + ( v.y / 255.0 ), v.z + ( v.w / 255.0 ) );\n}\nfloat viewZToOrthographicDepth( const in float viewZ, const in float near, const in float far ) {\n	return ( viewZ + near ) / ( near - far );\n}\nfloat orthographicDepthToViewZ( const in float linearClipZ, const in float near, const in float far ) {\n	return linearClipZ * ( near - far ) - near;\n}\nfloat viewZToPerspectiveDepth( const in float viewZ, const in float near, const in float far ) {\n	return ( ( near + viewZ ) * far ) / ( ( far - near ) * viewZ );\n}\nfloat perspectiveDepthToViewZ( const in float invClipZ, const in float near, const in float far ) {\n	return ( near * far ) / ( ( far - near ) * invClipZ - far );\n}",premultiplied_alpha_fragment:"#ifdef PREMULTIPLIED_ALPHA\n	gl_FragColor.rgb *= gl_FragColor.a;\n#endif",project_vertex:"vec4 mvPosition = vec4( transformed, 1.0 );\n#ifdef USE_INSTANCING\n	mvPosition = instanceMatrix * mvPosition;\n#endif\nmvPosition = modelViewMatrix * mvPosition;\ngl_Position = projectionMatrix * mvPosition;",dithering_fragment:"#ifdef DITHERING\n	gl_FragColor.rgb = dithering( gl_FragColor.rgb );\n#endif",dithering_pars_fragment:"#ifdef DITHERING\n	vec3 dithering( vec3 color ) {\n		float grid_position = rand( gl_FragCoord.xy );\n		vec3 dither_shift_RGB = vec3( 0.25 / 255.0, -0.25 / 255.0, 0.25 / 255.0 );\n		dither_shift_RGB = mix( 2.0 * dither_shift_RGB, -2.0 * dither_shift_RGB, grid_position );\n		return color + dither_shift_RGB;\n	}\n#endif",roughnessmap_fragment:"float roughnessFactor = roughness;\n#ifdef USE_ROUGHNESSMAP\n	vec4 texelRoughness = texture2D( roughnessMap, vUv );\n	roughnessFactor *= texelRoughness.g;\n#endif",roughnessmap_pars_fragment:"#ifdef USE_ROUGHNESSMAP\n	uniform sampler2D roughnessMap;\n#endif",shadowmap_pars_fragment:"#ifdef USE_SHADOWMAP\n	#if NUM_DIR_LIGHT_SHADOWS > 0\n		uniform sampler2D directionalShadowMap[ NUM_DIR_LIGHT_SHADOWS ];\n		varying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ];\n		struct DirectionalLightShadow {\n			float shadowBias;\n			float shadowNormalBias;\n			float shadowRadius;\n			vec2 shadowMapSize;\n		};\n		uniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ];
36\n	#endif\n	#if NUM_SPOT_LIGHT_SHADOWS > 0\n		uniform sampler2D spotShadowMap[ NUM_SPOT_LIGHT_SHADOWS ];\n		varying vec4 vSpotShadowCoord[ NUM_SPOT_LIGHT_SHADOWS ];\n		struct SpotLightShadow {\n			float shadowBias;\n			float shadowNormalBias;\n			float shadowRadius;\n			vec2 shadowMapSize;\n		};\n		uniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ];\n	#endif\n	#if NUM_POINT_LIGHT_SHADOWS > 0\n		uniform sampler2D pointShadowMap[ NUM_POINT_LIGHT_SHADOWS ];\n		varying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ];\n		struct PointLightShadow {\n			float shadowBias;\n			float shadowNormalBias;\n			float shadowRadius;\n			vec2 shadowMapSize;\n			float shadowCameraNear;\n			float shadowCameraFar;\n		};\n		uniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ];\n	#endif\n	float texture2DCompare( sampler2D depths, vec2 uv, float compare ) {\n		return step( compare, unpackRGBAToDepth( texture2D( depths, uv ) ) );\n	}\n	vec2 texture2DDistribution( sampler2D shadow, vec2 uv ) {\n		return unpackRGBATo2Half( texture2D( shadow, uv ) );\n	}\n	float VSMShadow (sampler2D shadow, vec2 uv, float compare ){\n		float occlusion = 1.0;\n		vec2 distribution = texture2DDistribution( shadow, uv );\n		float hard_shadow = step( compare , distribution.x );\n		if (hard_shadow != 1.0 ) {\n			float distance = compare - distribution.x ;\n			float variance = max( 0.00000, distribution.y * distribution.y );\n			float softness_probability = variance / (variance + distance * distance );			softness_probability = clamp( ( softness_probability - 0.3 ) / ( 0.95 - 0.3 ), 0.0, 1.0 );			occlusion = clamp( max( hard_shadow, softness_probability ), 0.0, 1.0 );\n		}\n		return occlusion;\n	}\n	float getShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowBias, float shadowRadius, vec4 shadowCoord ) {\n		float shadow = 1.0;\n		shadowCoord.xyz /= shadowCoord.w;\n		shadowCoord.z += shadowBias;\n		bvec4 inFrustumVec = bvec4 ( shadowCoord.x >= 0.0, shadowCoord.x <= 1.0, shadowCoord.y >= 0.0, shadowCoord.y <= 1.0 );\n		bool inFrustum = all( inFrustumVec );\n		bvec2 frustumTestVec = bvec2( inFrustum, shadowCoord.z <= 1.0 );\n		bool frustumTest = all( frustumTestVec );\n		if ( frustumTest ) {\n		#if defined( SHADOWMAP_TYPE_PCF )\n			vec2 texelSize = vec2( 1.0 ) / shadowMapSize;\n			float dx0 = - texelSize.x * shadowRadius;\n			float dy0 = - texelSize.y * shadowRadius;\n			float dx1 = + texelSize.x * shadowRadius;\n			float dy1 = + texelSize.y * shadowRadius;\n			float dx2 = dx0 / 2.0;\n			float dy2 = dy0 / 2.0;\n			float dx3 = dx1 / 2.0;\n			float dy3 = dy1 / 2.0;\n			shadow = (\n				texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy0 ), shadowCoord.z ) +\n				texture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy0 ), shadowCoord.z ) +\n				texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy0 ), shadowCoord.z ) +\n				texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, dy2 ), shadowCoord.z ) +\n				texture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy2 ), shadowCoord.z ) +\n				texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, dy2 ), shadowCoord.z ) +\n				texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, 0.0 ), shadowCoord.z ) +\n				texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, 0.0 ), shadowCoord.z ) +\n				texture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z ) +\n				texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, 0.0 ), shadowCoord.z ) +\n				texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, 0.0 ), shadowCoord.z ) +\n				texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, dy3 ), shadowCoord.z ) +\n				texture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy3 ), shadowCoord.z ) +\n				texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, dy3 ), shadowCoord.z ) +\n				texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy1 ), shadowCoord.z ) +\n				texture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy1 ), shadowCoord.z ) +\n				texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy1 ), shadowCoord.z )\n			) * ( 1.0 / 17.0 );\n		#elif defined( SHADOWMAP_TYPE_PCF_SOFT )\n			vec2 texelSize = vec2( 1.0 ) / shadowMapSize;\n			float dx = texelSize.x;\n			float dy = texelSize.y;\n			vec2 uv = shadowCoord.xy;
36\n			vec2 f = fract( uv * shadowMapSize + 0.5 );\n			uv -= f * texelSize;\n			shadow = (\n				texture2DCompare( shadowMap, uv, shadowCoord.z ) +\n				texture2DCompare( shadowMap, uv + vec2( dx, 0.0 ), shadowCoord.z ) +\n				texture2DCompare( shadowMap, uv + vec2( 0.0, dy ), shadowCoord.z ) +\n				texture2DCompare( shadowMap, uv + texelSize, shadowCoord.z ) +\n				mix( texture2DCompare( shadowMap, uv + vec2( -dx, 0.0 ), shadowCoord.z ), \n					 texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, 0.0 ), shadowCoord.z ),\n					 f.x ) +\n				mix( texture2DCompare( shadowMap, uv + vec2( -dx, dy ), shadowCoord.z ), \n					 texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, dy ), shadowCoord.z ),\n					 f.x ) +\n				mix( texture2DCompare( shadowMap, uv + vec2( 0.0, -dy ), shadowCoord.z ), \n					 texture2DCompare( shadowMap, uv + vec2( 0.0, 2.0 * dy ), shadowCoord.z ),\n					 f.y ) +\n				mix( texture2DCompare( shadowMap, uv + vec2( dx, -dy ), shadowCoord.z ), \n					 texture2DCompare( shadowMap, uv + vec2( dx, 2.0 * dy ), shadowCoord.z ),\n					 f.y ) +\n				mix( mix( texture2DCompare( shadowMap, uv + vec2( -dx, -dy ), shadowCoord.z ), \n						  texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, -dy ), shadowCoord.z ),\n						  f.x ),\n					 mix( texture2DCompare( shadowMap, uv + vec2( -dx, 2.0 * dy ), shadowCoord.z ), \n						  texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, 2.0 * dy ), shadowCoord.z ),\n						  f.x ),\n					 f.y )\n			) * ( 1.0 / 9.0 );\n		#elif defined( SHADOWMAP_TYPE_VSM )\n			shadow = VSMShadow( shadowMap, shadowCoord.xy, shadowCoord.z );\n		#else\n			shadow = texture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z );\n		#endif\n		}\n		return shadow;\n	}\n	vec2 cubeToUV( vec3 v, float texelSizeY ) {\n		vec3 absV = abs( v );\n		float scaleToCube = 1.0 / max( absV.x, max( absV.y, absV.z ) );\n		absV *= scaleToCube;\n		v *= scaleToCube * ( 1.0 - 2.0 * texelSizeY );\n		vec2 planar = v.xy;\n		float almostATexel = 1.5 * texelSizeY;\n		float almostOne = 1.0 - almostATexel;\n		if ( absV.z >= almostOne ) {\n			if ( v.z > 0.0 )\n				planar.x = 4.0 - v.x;\n		} else if ( absV.x >= almostOne ) {\n			float signX = sign( v.x );\n			planar.x = v.z * signX + 2.0 * signX;\n		} else if ( absV.y >= almostOne ) {\n			float signY = sign( v.y );\n			planar.x = v.x + 2.0 * signY + 2.0;\n			planar.y = v.z * signY - 2.0;\n		}\n		return vec2( 0.125, 0.25 ) * planar + vec2( 0.375, 0.75 );\n	}\n	float getPointShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowBias, float shadowRadius, vec4 shadowCoord, float shadowCameraNear, float shadowCameraFar ) {\n		vec2 texelSize = vec2( 1.0 ) / ( shadowMapSize * vec2( 4.0, 2.0 ) );\n		vec3 lightToPosition = shadowCoord.xyz;\n		float dp = ( length( lightToPosition ) - shadowCameraNear ) / ( shadowCameraFar - shadowCameraNear );		dp += shadowBias;\n		vec3 bd3D = normalize( lightToPosition );\n		#if defined( SHADOWMAP_TYPE_PCF ) || defined( SHADOWMAP_TYPE_PCF_SOFT ) || defined( SHADOWMAP_TYPE_VSM )\n			vec2 offset = vec2( - 1, 1 ) * shadowRadius * texelSize.y;\n			return (\n				texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyy, texelSize.y ), dp ) +\n				texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyy, texelSize.y ), dp ) +\n				texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyx, texelSize.y ), dp ) +\n				texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyx, texelSize.y ), dp ) +\n				texture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp ) +\n				texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxy, texelSize.y ), dp ) +\n				texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxy, texelSize.y ), dp ) +\n				texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxx, texelSize.y ), dp ) +\n				texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxx, texelSize.y ), dp )\n			) * ( 1.0 / 9.0 );\n		#else\n			return texture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp );\n		#endif\n	}\n#endif",shadowmap_pars_vertex:"#ifdef USE_SHADOWMAP\n	#if NUM_DIR_LIGHT_SHADOWS > 0\n		uniform mat4 directionalShadowMatrix[ NUM_DIR_LIGHT_SHADOWS ];\n		varying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ];\n		struct DirectionalLightShadow {\n			float shadowBias;\n			float shadowNormalBias;\n			float shadowRadius;\n			vec2 shadowMapSize;\n		};\n		uniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ];
36\n	#endif\n	#if NUM_SPOT_LIGHT_SHADOWS > 0\n		uniform mat4 spotShadowMatrix[ NUM_SPOT_LIGHT_SHADOWS ];\n		varying vec4 vSpotShadowCoord[ NUM_SPOT_LIGHT_SHADOWS ];\n		struct SpotLightShadow {\n			float shadowBias;\n			float shadowNormalBias;\n			float shadowRadius;\n			vec2 shadowMapSize;\n		};\n		uniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ];\n	#endif\n	#if NUM_POINT_LIGHT_SHADOWS > 0\n		uniform mat4 pointShadowMatrix[ NUM_POINT_LIGHT_SHADOWS ];\n		varying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ];\n		struct PointLightShadow {\n			float shadowBias;\n			float shadowNormalBias;\n			float shadowRadius;\n			vec2 shadowMapSize;\n			float shadowCameraNear;\n			float shadowCameraFar;\n		};\n		uniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ];\n	#endif\n#endif",shadowmap_vertex:"#ifdef USE_SHADOWMAP\n	#if NUM_DIR_LIGHT_SHADOWS > 0 || NUM_SPOT_LIGHT_SHADOWS > 0 || NUM_POINT_LIGHT_SHADOWS > 0\n		vec3 shadowWorldNormal = inverseTransformDirection( transformedNormal, viewMatrix );\n		vec4 shadowWorldPosition;\n	#endif\n	#if NUM_DIR_LIGHT_SHADOWS > 0\n	#pragma unroll_loop_start\n	for ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) {\n		shadowWorldPosition = worldPosition + vec4( shadowWorldNormal * directionalLightShadows[ i ].shadowNormalBias, 0 );\n		vDirectionalShadowCoord[ i ] = directionalShadowMatrix[ i ] * shadowWorldPosition;\n	}\n	#pragma unroll_loop_end\n	#endif\n	#if NUM_SPOT_LIGHT_SHADOWS > 0\n	#pragma unroll_loop_start\n	for ( int i = 0; i < NUM_SPOT_LIGHT_SHADOWS; i ++ ) {\n		shadowWorldPosition = worldPosition + vec4( shadowWorldNormal * spotLightShadows[ i ].shadowNormalBias, 0 );\n		vSpotShadowCoord[ i ] = spotShadowMatrix[ i ] * shadowWorldPosition;\n	}\n	#pragma unroll_loop_end\n	#endif\n	#if NUM_POINT_LIGHT_SHADOWS > 0\n	#pragma unroll_loop_start\n	for ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) {\n		shadowWorldPosition = worldPosition + vec4( shadowWorldNormal * pointLightShadows[ i ].shadowNormalBias, 0 );\n		vPointShadowCoord[ i ] = pointShadowMatrix[ i ] * shadowWorldPosition;\n	}\n	#pragma unroll_loop_end\n	#endif\n#endif",shadowmask_pars_fragment:"float getShadowMask() {\n	float shadow = 1.0;\n	#ifdef USE_SHADOWMAP\n	#if NUM_DIR_LIGHT_SHADOWS > 0\n	DirectionalLightShadow directionalLight;\n	#pragma unroll_loop_start\n	for ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) {\n		directionalLight = directionalLightShadows[ i ];\n		shadow *= receiveShadow ? getShadow( directionalShadowMap[ i ], directionalLight.shadowMapSize, directionalLight.shadowBias, directionalLight.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;\n	}\n	#pragma unroll_loop_end\n	#endif\n	#if NUM_SPOT_LIGHT_SHADOWS > 0\n	SpotLightShadow spotLight;\n	#pragma unroll_loop_start\n	for ( int i = 0; i < NUM_SPOT_LIGHT_SHADOWS; i ++ ) {\n		spotLight = spotLightShadows[ i ];\n		shadow *= receiveShadow ? getShadow( spotShadowMap[ i ], spotLight.shadowMapSize, spotLight.shadowBias, spotLight.shadowRadius, vSpotShadowCoord[ i ] ) : 1.0;\n	}\n	#pragma unroll_loop_end\n	#endif\n	#if NUM_POINT_LIGHT_SHADOWS > 0\n	PointLightShadow pointLight;\n	#pragma unroll_loop_start\n	for ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) {\n		pointLight = pointLightShadows[ i ];\n		shadow *= receiveShadow ? getPointShadow( pointShadowMap[ i ], pointLight.shadowMapSize, pointLight.shadowBias, pointLight.shadowRadius, vPointShadowCoord[ i ], pointLight.shadowCameraNear, pointLight.shadowCameraFar ) : 1.0;\n	}\n	#pragma unroll_loop_end\n	#endif\n	#endif\n	return shadow;\n}",skinbase_vertex:"#ifdef USE_SKINNING\n	mat4 boneMatX = getBoneMatrix( skinIndex.x );\n	mat4 boneMatY = getBoneMatrix( skinIndex.y );\n	mat4 boneMatZ = getBoneMatrix( skinIndex.z );\n	mat4 boneMatW = getBoneMatrix( skinIndex.w );\n#endif",skinning_pars_vertex:"#ifdef USE_SKINNING\n	uniform mat4 bindMatrix;\n	uniform mat4 bindMatrixInverse;\n	uniform highp sampler2D boneTexture;\n	uniform int boneTextureSize;\n	mat4 getBoneMatrix( const in float i ) {\n		float j = i * 4.0;\n		float x = mod( j, float( boneTextureSize ) );\n		float y = floor( j / float( boneTextureSize ) );\n		float dx = 1.0 / float( boneTextureSize );\n		float dy = 1.0 / float( boneTextureSize );\n		y = dy * ( y + 0.5 );\n		vec4 v1 = texture2D( boneTexture, vec2( dx * ( x + 0.5 ), y ) );\n		vec4 v2 = texture2D( boneTexture, vec2( dx * ( x + 1.5 ), y ) );\n		vec4 v3 = texture2D( boneTexture, vec2( dx * ( x + 2.5 ), y ) );\n		vec4 v4 = texture2D( boneTexture, vec2( dx * ( x + 3.5 ), y ) );\n		mat4 bone = mat4( v1, v2, v3, v4 );\n		return bone;\n	}\n#endif",skinning_vertex:"#ifdef USE_SKINNING\n	vec4 skinVertex = bindMatrix * vec4( transformed, 1.0 );\n	vec4 skinned = vec4( 0.0 );\n	skinned += boneMatX * skinVertex * skinWeight.x;\n	skinned += boneMatY * skinVertex * skinWeight.y;\n	skinned += boneMatZ * skinVertex * skinWeight.z;\n	skinned += boneMatW * skinVertex * skinWeight.w;\n	transformed = ( bindMatrixInverse * skinned ).xyz;\n#endif",skinnormal_vertex:"#ifdef USE_SKINNING\n	mat4 skinMatrix = mat4( 0.0 );\n	skinMatrix += skinWeight.x * boneMatX;\n	skinMatrix += skinWeight.y * boneMatY;\n	skinMatrix += skinWeight.z * boneMatZ;\n	skinMatrix += skinWeight.w * boneMatW;\n	skinMatrix = bindMatrixInverse * skinMatrix * bindMatrix;\n	objectNormal = vec4( skinMatrix * vec4( objectNormal, 0.0 ) ).xyz;\n	#ifdef USE_TANGENT\n		objectTangent = vec4( skinMatrix * vec4( objectTangent, 0.0 ) ).xyz;\n	#endif\n#endif",specularmap_fragment:"float specularStrength;\n#ifdef USE_SPECULARMAP\n	vec4 texelSpecular = texture2D( specularMap, vUv );\n	specularStrength = texelSpecular.r;\n#else\n	specularStrength = 1.0;\n#endif",specularmap_pars_fragment:"#ifdef USE_SPECULARMAP\n	uniform sampler2D specularMap;\n#endif",tonemapping_fragment:"#if defined( TONE_MAPPING )\n	gl_FragColor.rgb = toneMapping( gl_FragColor.rgb );\n#endif",tonemapping_pars_fragment:"#ifndef saturate\n#define saturate( a ) clamp( a, 0.0, 1.0 )\n#endif\nuniform float toneMappingExposure;
36\nvec3 LinearToneMapping( vec3 color ) {\n	return toneMappingExposure * color;\n}\nvec3 ReinhardToneMapping( vec3 color ) {\n	color *= toneMappingExposure;\n	return saturate( color / ( vec3( 1.0 ) + color ) );\n}\nvec3 OptimizedCineonToneMapping( vec3 color ) {\n	color *= toneMappingExposure;\n	color = max( vec3( 0.0 ), color - 0.004 );\n	return pow( ( color * ( 6.2 * color + 0.5 ) ) / ( color * ( 6.2 * color + 1.7 ) + 0.06 ), vec3( 2.2 ) );\n}\nvec3 RRTAndODTFit( vec3 v ) {\n	vec3 a = v * ( v + 0.0245786 ) - 0.000090537;\n	vec3 b = v * ( 0.983729 * v + 0.4329510 ) + 0.238081;\n	return a / b;\n}\nvec3 ACESFilmicToneMapping( vec3 color ) {\n	const mat3 ACESInputMat = mat3(\n		vec3( 0.59719, 0.07600, 0.02840 ),		vec3( 0.35458, 0.90834, 0.13383 ),\n		vec3( 0.04823, 0.01566, 0.83777 )\n	);\n	const mat3 ACESOutputMat = mat3(\n		vec3(  1.60475, -0.10208, -0.00327 ),		vec3( -0.53108,  1.10813, -0.07276 ),\n		vec3( -0.07367, -0.00605,  1.07602 )\n	);\n	color *= toneMappingExposure / 0.6;\n	color = ACESInputMat * color;\n	color = RRTAndODTFit( color );\n	color = ACESOutputMat * color;\n	return saturate( color );\n}\nvec3 CustomToneMapping( vec3 color ) { return color; }",transmission_fragment:"#ifdef USE_TRANSMISSION\n	float transmissionAlpha = 1.0;\n	float transmissionFactor = transmission;\n	float thicknessFactor = thickness;\n	#ifdef USE_TRANSMISSIONMAP\n		transmissionFactor *= texture2D( transmissionMap, vUv ).r;\n	#endif\n	#ifdef USE_THICKNESSMAP\n		thicknessFactor *= texture2D( thicknessMap, vUv ).g;\n	#endif\n	vec3 pos = vWorldPosition;\n	vec3 v = normalize( cameraPosition - pos );\n	vec3 n = inverseTransformDirection( normal, viewMatrix );\n	vec4 transmission = getIBLVolumeRefraction(\n		n, v, roughnessFactor, material.diffuseColor, material.specularColor, material.specularF90,\n		pos, modelMatrix, viewMatrix, projectionMatrix, ior, thicknessFactor,\n		attenuationColor, attenuationDistance );\n	totalDiffuse = mix( totalDiffuse, transmission.rgb, transmissionFactor );\n	transmissionAlpha = mix( transmissionAlpha, transmission.a, transmissionFactor );\n#endif",transmission_pars_fragment:"#ifdef USE_TRANSMISSION\n	uniform float transmission;\n	uniform float thickness;\n	uniform float attenuationDistance;\n	uniform vec3 attenuationColor;\n	#ifdef USE_TRANSMISSIONMAP\n		uniform sampler2D transmissionMap;\n	#endif\n	#ifdef USE_THICKNESSMAP\n		uniform sampler2D thicknessMap;\n	#endif\n	uniform vec2 transmissionSamplerSize;\n	uniform sampler2D transmissionSamplerMap;\n	uniform mat4 modelMatrix;\n	uniform mat4 projectionMatrix;\n	varying vec3 vWorldPosition;\n	vec3 getVolumeTransmissionRay( const in vec3 n, const in vec3 v, const in float thickness, const in float ior, const in mat4 modelMatrix ) {\n		vec3 refractionVector = refract( - v, normalize( n ), 1.0 / ior );\n		vec3 modelScale;\n		modelScale.x = length( vec3( modelMatrix[ 0 ].xyz ) );\n		modelScale.y = length( vec3( modelMatrix[ 1 ].xyz ) );\n		modelScale.z = length( vec3( modelMatrix[ 2 ].xyz ) );\n		return normalize( refractionVector ) * thickness * modelScale;\n	}\n	float applyIorToRoughness( const in float roughness, const in float ior ) {\n		return roughness * clamp( ior * 2.0 - 2.0, 0.0, 1.0 );\n	}\n	vec4 getTransmissionSample( const in vec2 fragCoord, const in float roughness, const in float ior ) {\n		float framebufferLod = log2( transmissionSamplerSize.x ) * applyIorToRoughness( roughness, ior );\n		#ifdef texture2DLodEXT\n			return texture2DLodEXT( transmissionSamplerMap, fragCoord.xy, framebufferLod );\n		#else\n			return texture2D( transmissionSamplerMap, fragCoord.xy, framebufferLod );\n		#endif\n	}\n	vec3 applyVolumeAttenuation( const in vec3 radiance, const in float transmissionDistance, const in vec3 attenuationColor, const in float attenuationDistance ) {\n		if ( attenuationDistance == 0.0 ) {\n			return radiance;\n		} else {\n			vec3 attenuationCoefficient = -log( attenuationColor ) / attenuationDistance;\n			vec3 transmittance = exp( - attenuationCoefficient * transmissionDistance );			return transmittance * radiance;\n		}\n	}\n	vec4 getIBLVolumeRefraction( const in vec3 n, const in vec3 v, const in float roughness, const in vec3 diffuseColor,\n		const in vec3 specularColor, const in float specularF90, const in vec3 position, const in mat4 modelMatrix,\n		const in mat4 viewMatrix, const in mat4 projMatrix, const in float ior, const in float thickness,\n		const in vec3 attenuationColor, const in float attenuationDistance ) {\n		vec3 transmissionRay = getVolumeTransmissionRay( n, v, thickness, ior, modelMatrix );\n		vec3 refractedRayExit = position + transmissionRay;\n		vec4 ndcPos = projMatrix * viewMatrix * vec4( refractedRayExit, 1.0 );\n		vec2 refractionCoords = ndcPos.xy / ndcPos.w;\n		refractionCoords += 1.0;\n		refractionCoords /= 2.0;\n		vec4 transmittedLight = getTransmissionSample( refractionCoords, roughness, ior );\n		vec3 attenuatedColor = applyVolumeAttenuation( transmittedLight.rgb, length( transmissionRay ), attenuationColor, attenuationDistance );\n		vec3 F = EnvironmentBRDF( n, v, specularColor, specularF90, roughness );\n		return vec4( ( 1.0 - F ) * attenuatedColor * diffuseColor, transmittedLight.a );\n	}\n#endif",uv_pars_fragment:"#if ( defined( USE_UV ) && ! defined( UVS_VERTEX_ONLY ) )\n	varying vec2 vUv;\n#endif",uv_pars_vertex:"#ifdef USE_UV\n	#ifdef UVS_VERTEX_ONLY\n		vec2 vUv;\n	#else\n		varying vec2 vUv;\n	#endif\n	uniform mat3 uvTransform;\n#endif",uv_vertex:"#ifdef USE_UV\n	vUv = ( uvTransform * vec3( uv, 1 ) ).xy;\n#endif",uv2_pars_fragment:"#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP )\n	varying vec2 vUv2;\n#endif",uv2_pars_vertex:"#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP )\n	attribute vec2 uv2;\n	varying vec2 vUv2;\n	uniform mat3 uv2Transform;\n#endif",uv2_vertex:"#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP )\n	vUv2 = ( uv2Transform * vec3( uv2, 1 ) ).xy;\n#endif",worldpos_vertex:"#if defined( USE_ENVMAP ) || defined( DISTANCE ) || defined ( USE_SHADOWMAP ) || defined ( USE_TRANSMISSION )\n	vec4 worldPosition = vec4( transformed, 1.0 );\n	#ifdef USE_INSTANCING\n		worldPosition = instanceMatrix * worldPosition;\n	#endif\n	worldPosition = modelMatrix * worldPosition;\n#endif",background_vert:"varying vec2 vUv;\nuniform mat3 uvTransform;\nvoid main() {\n	vUv = ( uvTransform * vec3( uv, 1 ) ).xy;\n	gl_Position = vec4( position.xy, 1.0, 1.0 );\n}",background_frag:"uniform sampler2D t2D;\nvarying vec2 vUv;\nvoid main() {\n	gl_FragColor = texture2D( t2D, vUv );\n	#ifdef DECODE_VIDEO_TEXTURE\n		gl_FragColor = vec4( mix( pow( gl_FragColor.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), gl_FragColor.rgb * 0.0773993808, vec3( lessThanEqual( gl_FragColor.rgb, vec3( 0.04045 ) ) ) ), gl_FragColor.w );\n	#endif\n	#include <tonemapping_fragment>\n	#include <encodings_fragment>\n}",cube_vert:"varying vec3 vWorldDirection;\n#include <common>\nvoid main() {\n	vWorldDirection = transformDirection( position, modelMatrix );\n	#include <begin_vertex>\n	#include <project_vertex>\n	gl_Position.z = gl_Position.w;\n}",cube_frag:"#include <envmap_common_pars_fragment>\nuniform float opacity;\nvarying vec3 vWorldDirection;\n#include <cube_uv_reflection_fragment>\nvoid main() {\n	vec3 vReflect = vWorldDirection;\n	#include <envmap_fragment>\n	gl_FragColor = envColor;\n	gl_FragColor.a *= opacity;\n	#include <tonemapping_fragment>\n	#include <encodings_fragment>\n}",depth_vert:"#include <common>\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvarying vec2 vHighPrecisionZW;\nvoid main() {\n	#include <uv_vertex>\n	#include <skinbase_vertex>\n	#ifdef USE_DISPLACEMENTMAP\n		#include <beginnormal_vertex>\n		#include <morphnormal_vertex>\n		#include <skinnormal_vertex>\n	#endif\n	#include <begin_vertex>\n	#include <morphtarget_vertex>\n	#include <skinning_vertex>\n	#include <displacementmap_vertex>\n	#include <project_vertex>\n	#include <logdepthbuf_vertex>\n	#include <clipping_planes_vertex>\n	vHighPrecisionZW = gl_Position.zw;\n}",depth_frag:"#if DEPTH_PACKING == 3200\n	uniform float opacity;\n#endif\n#include <common>\n#include <packing>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvarying vec2 vHighPrecisionZW;\nvoid main() {\n	#include <clipping_planes_fragment>\n	vec4 diffuseColor = vec4( 1.0 );\n	#if DEPTH_PACKING == 3200\n		diffuseColor.a = opacity;\n	#endif\n	#include <map_fragment>\n	#include <alphamap_fragment>\n	#include <alphatest_fragment>\n	#include <logdepthbuf_fragment>\n	float fragCoordZ = 0.5 * vHighPrecisionZW[0] / vHighPrecisionZW[1] + 0.5;\n	#if DEPTH_PACKING == 3200\n		gl_FragColor = vec4( vec3( 1.0 - fragCoordZ ), opacity );\n	#elif DEPTH_PACKING == 3201\n		gl_FragColor = packDepthToRGBA( fragCoordZ );\n	#endif\n}",distanceRGBA_vert:"#define DISTANCE\nvarying vec3 vWorldPosition;\n#include <common>\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n	#include <uv_vertex>\n	#include <skinbase_vertex>\n	#ifdef USE_DISPLACEMENTMAP\n		#include <beginnormal_vertex>\n		#include <morphnormal_vertex>\n		#include <skinnormal_vertex>\n	#endif\n	#include <begin_vertex>\n	#include <morphtarget_vertex>\n	#include <skinning_vertex>\n	#include <displacementmap_vertex>\n	#include <project_vertex>\n	#include <worldpos_vertex>\n	#include <clipping_planes_vertex>\n	vWorldPosition = worldPosition.xyz;\n}",distanceRGBA_frag:"#define DISTANCE\nuniform vec3 referencePosition;\nuniform float nearDistance;\nuniform float farDistance;\nvarying vec3 vWorldPosition;\n#include <common>\n#include <packing>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main () {\n	#include <clipping_planes_fragment>\n	vec4 diffuseColor = vec4( 1.0 );\n	#include <map_fragment>\n	#include <alphamap_fragment>\n	#include <alphatest_fragment>\n	float dist = length( vWorldPosition - referencePosition );\n	dist = ( dist - nearDistance ) / ( farDistance - nearDistance );\n	dist = saturate( dist );\n	gl_FragColor = packDepthToRGBA( dist );\n}",equirect_vert:"varying vec3 vWorldDirection;\n#include <common>\nvoid main() {\n	vWorldDirection = transformDirection( position, modelMatrix );\n	#include <begin_vertex>\n	#include <project_vertex>\n}",equirect_frag:"uniform sampler2D tEquirect;\nvarying vec3 vWorldDirection;\n#include <common>\nvoid main() {\n	vec3 direction = normalize( vWorldDirection );\n	vec2 sampleUV = equirectUv( direction );\n	gl_FragColor = texture2D( tEquirect, sampleUV );\n	#include <tonemapping_fragment>\n	#include <encodings_fragment>\n}",linedashed_vert:"uniform float scale;\nattribute float lineDistance;\nvarying float vLineDistance;\n#include <common>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n	vLineDistance = scale * lineDistance;\n	#include <color_vertex>\n	#include <morphcolor_vertex>\n	#include <begin_vertex>\n	#include <morphtarget_vertex>\n	#include <project_vertex>\n	#include <logdepthbuf_vertex>\n	#include <clipping_planes_vertex>\n	#include <fog_vertex>\n}",linedashed_frag:"uniform vec3 diffuse;\nuniform float opacity;\nuniform float dashSize;\nuniform float totalSize;\nvarying float vLineDistance;\n#include <common>\n#include <color_pars_fragment>\n#include <fog_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n	#include <clipping_planes_fragment>\n	if ( mod( vLineDistance, totalSize ) > dashSize ) {\n		discard;\n	}\n	vec3 outgoingLight = vec3( 0.0 );\n	vec4 diffuseColor = vec4( diffuse, opacity );\n	#include <logdepthbuf_fragment>\n	#include <color_fragment>\n	outgoingLight = diffuseColor.rgb;\n	#include <output_fragment>\n	#include <tonemapping_fragment>\n	#include <encodings_fragment>\n	#include <fog_fragment>\n	#include <premultiplied_alpha_fragment>\n}",meshbasic_vert:"#include <common>\n#include <uv_pars_vertex>\n#include <uv2_pars_vertex>\n#include <envmap_pars_vertex>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n	#include <uv_vertex>\n	#include <uv2_vertex>\n	#include <color_vertex>\n	#include <morphcolor_vertex>\n	#if defined ( USE_ENVMAP ) || defined ( USE_SKINNING )\n		#include <beginnormal_vertex>\n		#include <morphnormal_vertex>\n		#include <skinbase_vertex>\n		#include <skinnormal_vertex>\n		#include <defaultnormal_vertex>\n	#endif\n	#include <begin_vertex>\n	#include <morphtarget_vertex>\n	#include <skinning_vertex>\n	#include <project_vertex>\n	#include <logdepthbuf_vertex>\n	#include <clipping_planes_vertex>\n	#include <worldpos_vertex>\n	#include <envmap_vertex>\n	#include <fog_vertex>\n}",meshbasic_frag:"uniform vec3 diffuse;\nuniform float opacity;\n#ifndef FLAT_SHADED\n	varying vec3 vNormal;\n#endif\n#include <common>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <uv2_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <envmap_common_pars_fragment>\n#include <envmap_pars_fragment>\n#include <cube_uv_reflection_fragment>\n#include <fog_pars_fragment>\n#include <specularmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n	#include <clipping_planes_fragment>\n	vec4 diffuseColor = vec4( diffuse, opacity );\n	#include <logdepthbuf_fragment>\n	#include <map_fragment>\n	#include <color_fragment>\n	#include <alphamap_fragment>\n	#include <alphatest_fragment>\n	#include <specularmap_fragment>\n	ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n	#ifdef USE_LIGHTMAP\n		vec4 lightMapTexel = texture2D( lightMap, vUv2 );\n		reflectedLight.indirectDiffuse += lightMapTexel.rgb * lightMapIntensity * RECIPROCAL_PI;\n	#else\n		reflectedLight.indirectDiffuse += vec3( 1.0 );\n	#endif\n	#include <aomap_fragment>\n	reflectedLight.indirectDiffuse *= diffuseColor.rgb;\n	vec3 outgoingLight = reflectedLight.indirectDiffuse;\n	#include <envmap_fragment>\n	#include <output_fragment>\n	#include <tonemapping_fragment>\n	#include <encodings_fragment>\n	#include <fog_fragment>\n	#include <premultiplied_alpha_fragment>\n	#include <dithering_fragment>\n}",meshlambert_vert:"#define LAMBERT\nvarying vec3 vLightFront;\nvarying vec3 vIndirectFront;\n#ifdef DOUBLE_SIDED\n	varying vec3 vLightBack;\n	varying vec3 vIndirectBack;\n#endif\n#include <common>\n#include <uv_pars_vertex>\n#include <uv2_pars_vertex>\n#include <envmap_pars_vertex>\n#include <bsdfs>\n#include <lights_pars_begin>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <shadowmap_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n	#include <uv_vertex>\n	#include <uv2_vertex>\n	#include <color_vertex>\n	#include <morphcolor_vertex>\n	#include <beginnormal_vertex>\n	#include <morphnormal_vertex>\n	#include <skinbase_vertex>\n	#include <skinnormal_vertex>\n	#include <defaultnormal_vertex>\n	#include <begin_vertex>\n	#include <morphtarget_vertex>\n	#include <skinning_vertex>\n	#include <project_vertex>\n	#include <logdepthbuf_vertex>\n	#include <clipping_planes_vertex>\n	#include <worldpos_vertex>\n	#include <envmap_vertex>\n	#include <lights_lambert_vertex>\n	#include <shadowmap_vertex>\n	#include <fog_vertex>\n}",meshlambert_frag:"uniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float opacity;\nvarying vec3 vLightFront;\nvarying vec3 vIndirectFront;\n#ifdef DOUBLE_SIDED\n	varying vec3 vLightBack;\n	varying vec3 vIndi
36rectBack;\n#endif\n#include <common>\n#include <packing>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <uv2_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <emissivemap_pars_fragment>\n#include <envmap_common_pars_fragment>\n#include <envmap_pars_fragment>\n#include <cube_uv_reflection_fragment>\n#include <bsdfs>\n#include <lights_pars_begin>\n#include <fog_pars_fragment>\n#include <shadowmap_pars_fragment>\n#include <shadowmask_pars_fragment>\n#include <specularmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n	#include <clipping_planes_fragment>\n	vec4 diffuseColor = vec4( diffuse, opacity );\n	ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n	vec3 totalEmissiveRadiance = emissive;\n	#include <logdepthbuf_fragment>\n	#include <map_fragment>\n	#include <color_fragment>\n	#include <alphamap_fragment>\n	#include <alphatest_fragment>\n	#include <specularmap_fragment>\n	#include <emissivemap_fragment>\n	#ifdef DOUBLE_SIDED\n		reflectedLight.indirectDiffuse += ( gl_FrontFacing ) ? vIndirectFront : vIndirectBack;\n	#else\n		reflectedLight.indirectDiffuse += vIndirectFront;\n	#endif\n	#include <lightmap_fragment>\n	reflectedLight.indirectDiffuse *= BRDF_Lambert( diffuseColor.rgb );\n	#ifdef DOUBLE_SIDED\n		reflectedLight.directDiffuse = ( gl_FrontFacing ) ? vLightFront : vLightBack;\n	#else\n		reflectedLight.directDiffuse = vLightFront;\n	#endif\n	reflectedLight.directDiffuse *= BRDF_Lambert( diffuseColor.rgb ) * getShadowMask();\n	#include <aomap_fragment>\n	vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;\n	#include <envmap_fragment>\n	#include <output_fragment>\n	#include <tonemapping_fragment>\n	#include <encodings_fragment>\n	#include <fog_fragment>\n	#include <premultiplied_alpha_fragment>\n	#include <dithering_fragment>\n}",meshmatcap_vert:"#define MATCAP\nvarying vec3 vViewPosition;\n#include <common>\n#include <uv_pars_vertex>\n#include <color_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <fog_pars_vertex>\n#include <normal_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n	#include <uv_vertex>\n	#include <color_vertex>\n	#include <morphcolor_vertex>\n	#include <beginnormal_vertex>\n	#include <morphnormal_vertex>\n	#include <skinbase_vertex>\n	#include <skinnormal_vertex>\n	#include <defaultnormal_vertex>\n	#include <normal_vertex>\n	#include <begin_vertex>\n	#include <morphtarget_vertex>\n	#include <skinning_vertex>\n	#include <displacementmap_vertex>\n	#include <project_vertex>\n	#include <logdepthbuf_vertex>\n	#include <clipping_planes_vertex>\n	#include <fog_vertex>\n	vViewPosition = - mvPosition.xyz;\n}",meshmatcap_frag:"#define MATCAP\nuniform vec3 diffuse;\nuniform float opacity;\nuniform sampler2D matcap;\nvarying vec3 vViewPosition;\n#include <common>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <fog_pars_fragment>\n#include <normal_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n	#include <clipping_planes_fragment>\n	vec4 diffuseColor = vec4( diffuse, opacity );\n	#include <logdepthbuf_fragment>\n	#include <map_fragment>\n	#include <color_fragment>\n	#include <alphamap_fragment>\n	#include <alphatest_fragment>\n	#include <normal_fragment_begin>\n	#include <normal_fragment_maps>\n	vec3 viewDir = normalize( vViewPosition );\n	vec3 x = normalize( vec3( viewDir.z, 0.0, - viewDir.x ) );\n	vec3 y = cross( viewDir, x );\n	vec2 uv = vec2( dot( x, normal ), dot( y, normal ) ) * 0.495 + 0.5;
36\n	#ifdef USE_MATCAP\n		vec4 matcapColor = texture2D( matcap, uv );\n	#else\n		vec4 matcapColor = vec4( vec3( mix( 0.2, 0.8, uv.y ) ), 1.0 );\n	#endif\n	vec3 outgoingLight = diffuseColor.rgb * matcapColor.rgb;\n	#include <output_fragment>\n	#include <tonemapping_fragment>\n	#include <encodings_fragment>\n	#include <fog_fragment>\n	#include <premultiplied_alpha_fragment>\n	#include <dithering_fragment>\n}",meshnormal_vert:"#define NORMAL\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( TANGENTSPACE_NORMALMAP )\n	varying vec3 vViewPosition;\n#endif\n#include <common>\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <normal_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n	#include <uv_vertex>\n	#include <beginnormal_vertex>\n	#include <morphnormal_vertex>\n	#include <skinbase_vertex>\n	#include <skinnormal_vertex>\n	#include <defaultnormal_vertex>\n	#include <normal_vertex>\n	#include <begin_vertex>\n	#include <morphtarget_vertex>\n	#include <skinning_vertex>\n	#include <displacementmap_vertex>\n	#include <project_vertex>\n	#include <logdepthbuf_vertex>\n	#include <clipping_planes_vertex>\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( TANGENTSPACE_NORMALMAP )\n	vViewPosition = - mvPosition.xyz;\n#endif\n}",meshnormal_frag:"#define NORMAL\nuniform float opacity;\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( TANGENTSPACE_NORMALMAP )\n	varying vec3 vViewPosition;\n#endif\n#include <packing>\n#include <uv_pars_fragment>\n#include <normal_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n	#include <clipping_planes_fragment>\n	#include <logdepthbuf_fragment>\n	#include <normal_fragment_begin>\n	#include <normal_fragment_maps>\n	gl_FragColor = vec4( packNormalToRGB( normal ), opacity );\n	#ifdef OPAQUE\n		gl_FragColor.a = 1.0;\n	#endif\n}",meshphong_vert:"#define PHONG\nvarying vec3 vViewPosition;\n#include <common>\n#include <uv_pars_vertex>\n#include <uv2_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <envmap_pars_vertex>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <normal_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <shadowmap_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n	#include <uv_vertex>\n	#include <uv2_vertex>\n	#include <color_vertex>\n	#include <morphcolor_vertex>\n	#include <beginnormal_vertex>\n	#include <morphnormal_vertex>\n	#include <skinbase_vertex>\n	#include <skinnormal_vertex>\n	#include <defaultnormal_vertex>\n	#include <normal_vertex>\n	#include <begin_vertex>\n	#include <morphtarget_vertex>\n	#include <skinning_vertex>\n	#include <displacementmap_vertex>\n	#include <project_vertex>\n	#include <logdepthbuf_vertex>\n	#include <clipping_planes_vertex>\n	vViewPosition = - mvPosition.xyz;\n	#include <worldpos_vertex>\n	#include <envmap_vertex>\n	#include <shadowmap_vertex>\n	#include <fog_vertex>\n}",meshphong_frag:"#define PHONG\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform vec3 specular;\nuniform float shininess;\nuniform float opacity;\n#include <common>\n#include <packing>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <uv2_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <emissivemap_pars_fragment>\n#include <envmap_common_pars_fragment>\n#include <envmap_pars_fragment>\n#include <cube_uv_reflection_fragment>\n#include <fog_pars_fragment>\n#include <bsdfs>\n#include <lights_pars_begin>\n#include <normal_pars_fragment>\n#include <lights_phong_pars_fragment>\n#include <shadowmap_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <specularmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n	#include <clipping_planes_fragment>\n	vec4 diffuseColor = vec4( diffuse, opacity );\n	ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n	vec3 totalEmissiveRadiance = emissive;\n	#include <logdepthbuf_fragment>\n	#include <map_fragment>\n	#include <color_fragment>\n	#include <alphamap_fragment>\n	#include <alphatest_fragment>\n	#include <specularmap_fragment>\n	#include <normal_fragment_begin>\n	#include <normal_fragment_maps>\n	#include <emissivemap_fragment>\n	#include <lights_phong_fragment>\n	#include <lights_fragment_begin>\n	#include <lights_fragment_maps>\n	#include <lights_fragment_end>\n	#include <aomap_fragment>\n	vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveRadiance;\n	#include <envmap_fragment>\n	#include <output_fragment>\n	#include <tonemapping_fragment>\n	#include <encodings_fragment>\n	#include <fog_fragment>\n	#include <premultiplied_alpha_fragment>\n	#include <dithering_fragment>\n}",meshphysical_vert:"#define STANDARD\nvarying vec3 vViewPosition;\n#ifdef USE_TRANSMISSION\n	varying vec3 vWorldPosition;\n#endif\n#include <common>\n#include <uv_pars_vertex>\n#include <uv2_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <normal_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <shadowmap_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n	#include <uv_vertex>\n	#include <uv2_vertex>\n	#include <color_vertex>\n	#include <morphcolor_vertex>\n	#include <beginnormal_vertex>\n	#include <morphnormal_vertex>\n	#include <skinbase_vertex>\n	#include <skinnormal_vertex>\n	#include <defaultnormal_vertex>\n	#include <normal_vertex>\n	#include <begin_vertex>\n	#include <morphtarget_vertex>\n	#include <skinning_vertex>\n	#include <displacementmap_vertex>\n	#include <project_vertex>\n	#include <logdepthbuf_vertex>\n	#include <clipping_planes_vertex>\n	vViewPosition = - mvPosition.xyz;\n	#include <worldpos_vertex>\n	#include <shadowmap_vertex>\n	#include <fog_vertex>\n#ifdef USE_TRANSMISSION\n	vWorldPosition = worldPosition.xyz;\n#endif\n}",meshphysical_frag:"#define STANDARD\n#ifdef PHYSICAL\n	#define IOR\n	#define SPECULAR\n#endif\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float roughness;\nuniform float metalness;\nuniform float opacity;\n#ifdef IOR\n	uniform float ior;\n#endif\n#ifdef SPECULAR\n	uniform float specularIntensity;\n	uniform vec3 specularColor;\n	#ifdef USE_SPECULARINTENSITYMAP\n		uniform sampler2D specularIntensityMap;\n	#endif\n	#ifdef USE_SPECULARCOLORMAP\n		uniform sampler2D specularColorMap;\n	#endif\n#endif\n#ifdef USE_CLEARCOAT\n	uniform float clearcoat;
36\n	uniform float clearcoatRoughness;\n#endif\n#ifdef USE_IRIDESCENCE\n	uniform float iridescence;\n	uniform float iridescenceIOR;\n	uniform float iridescenceThicknessMinimum;\n	uniform float iridescenceThicknessMaximum;\n#endif\n#ifdef USE_SHEEN\n	uniform vec3 sheenColor;\n	uniform float sheenRoughness;\n	#ifdef USE_SHEENCOLORMAP\n		uniform sampler2D sheenColorMap;\n	#endif\n	#ifdef USE_SHEENROUGHNESSMAP\n		uniform sampler2D sheenRoughnessMap;\n	#endif\n#endif\nvarying vec3 vViewPosition;\n#include <common>\n#include <packing>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <uv2_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <emissivemap_pars_fragment>\n#include <bsdfs>\n#include <iridescence_fragment>\n#include <cube_uv_reflection_fragment>\n#include <envmap_common_pars_fragment>\n#include <envmap_physical_pars_fragment>\n#include <fog_pars_fragment>\n#include <lights_pars_begin>\n#include <normal_pars_fragment>\n#include <lights_physical_pars_fragment>\n#include <transmission_pars_fragment>\n#include <shadowmap_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <clearcoat_pars_fragment>\n#include <iridescence_pars_fragment>\n#include <roughnessmap_pars_fragment>\n#include <metalnessmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n	#include <clipping_planes_fragment>\n	vec4 diffuseColor = vec4( diffuse, opacity );\n	ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n	vec3 totalEmissiveRadiance = emissive;\n	#include <logdepthbuf_fragment>\n	#include <map_fragment>\n	#include <color_fragment>\n	#include <alphamap_fragment>\n	#include <alphatest_fragment>\n	#include <roughnessmap_fragment>\n	#include <metalnessmap_fragment>\n	#include <normal_fragment_begin>\n	#include <normal_fragment_maps>\n	#include <clearcoat_normal_fragment_begin>\n	#include <clearcoat_normal_fragment_maps>\n	#include <emissivemap_fragment>\n	#include <lights_physical_fragment>\n	#include <lights_fragment_begin>\n	#include <lights_fragment_maps>\n	#include <lights_fragment_end>\n	#include <aomap_fragment>\n	vec3 totalDiffuse = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse;\n	vec3 totalSpecular = reflectedLight.directSpecular + reflectedLight.indirectSpecular;\n	#include <transmission_fragment>\n	vec3 outgoingLight = totalDiffuse + totalSpecular + totalEmissiveRadiance;\n	#ifdef USE_SHEEN\n		float sheenEnergyComp = 1.0 - 0.157 * max3( material.sheenColor );\n		outgoingLight = outgoingLight * sheenEnergyComp + sheenSpecular;\n	#endif\n	#ifdef USE_CLEARCOAT\n		float dotNVcc = saturate( dot( geometry.clearcoatNormal, geometry.viewDir ) );\n		vec3 Fcc = F_Schlick( material.clearcoatF0, material.clearcoatF90, dotNVcc );\n		outgoingLight = outgoingLight * ( 1.0 - material.clearcoat * Fcc ) + clearcoatSpecular * material.clearcoat;
36\n	#endif\n	#include <output_fragment>\n	#include <tonemapping_fragment>\n	#include <encodings_fragment>\n	#include <fog_fragment>\n	#include <premultiplied_alpha_fragment>\n	#include <dithering_fragment>\n}",meshtoon_vert:"#define TOON\nvarying vec3 vViewPosition;\n#include <common>\n#include <uv_pars_vertex>\n#include <uv2_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <normal_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <shadowmap_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n	#include <uv_vertex>\n	#include <uv2_vertex>\n	#include <color_vertex>\n	#include <morphcolor_vertex>\n	#include <beginnormal_vertex>\n	#include <morphnormal_vertex>\n	#include <skinbase_vertex>\n	#include <skinnormal_vertex>\n	#include <defaultnormal_vertex>\n	#include <normal_vertex>\n	#include <begin_vertex>\n	#include <morphtarget_vertex>\n	#include <skinning_vertex>\n	#include <displacementmap_vertex>\n	#include <project_vertex>\n	#include <logdepthbuf_vertex>\n	#include <clipping_planes_vertex>\n	vViewPosition = - mvPosition.xyz;\n	#include <worldpos_vertex>\n	#include <shadowmap_vertex>\n	#include <fog_vertex>\n}",meshtoon_frag:"#define TOON\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float opacity;\n#include <common>\n#include <packing>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <uv2_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <emissivemap_pars_fragment>\n#include <gradientmap_pars_fragment>\n#include <fog_pars_fragment>\n#include <bsdfs>\n#include <lights_pars_begin>\n#include <normal_pars_fragment>\n#include <lights_toon_pars_fragment>\n#include <shadowmap_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n	#include <clipping_planes_fragment>\n	vec4 diffuseColor = vec4( diffuse, opacity );\n	ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n	vec3 totalEmissiveRadiance = emissive;\n	#include <logdepthbuf_fragment>\n	#include <map_fragment>\n	#include <color_fragment>\n	#include <alphamap_fragment>\n	#include <alphatest_fragment>\n	#include <normal_fragment_begin>\n	#include <normal_fragment_maps>\n	#include <emissivemap_fragment>\n	#include <lights_toon_fragment>\n	#include <lights_fragment_begin>\n	#include <lights_fragment_maps>\n	#include <lights_fragment_end>\n	#include <aomap_fragment>\n	vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;\n	#include <output_fragment>\n	#include <tonemapping_fragment>\n	#include <encodings_fragment>\n	#include <fog_fragment>\n	#include <premultiplied_alpha_fragment>\n	#include <dithering_fragment>\n}",points_vert:"uniform float size;\nuniform float scale;\n#include <common>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n	#include <color_vertex>\n	#include <morphcolor_vertex>\n	#include <begin_vertex>\n	#include <morphtarget_vertex>\n	#include <project_vertex>\n	gl_PointSize = size;\n	#ifdef USE_SIZEATTENUATION\n		bool isPerspective = isPerspectiveMatrix( projectionMatrix );\n		if ( isPerspective ) gl_PointSize *= ( scale / - mvPosition.z );\n	#endif\n	#include <logdepthbuf_vertex>\n	#include <clipping_planes_vertex>\n	#include <worldpos_vertex>\n	#include <fog_vertex>\n}",points_frag:"uniform vec3 diffuse;\nuniform float opacity;\n#include <common>\n#include <color_pars_fragment>\n#include <map_particle_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <fog_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n	#include <clipping_planes_fragment>\n	vec3 outgoingLight = vec3( 0.0 );\n	vec4 diffuseColor = vec4( diffuse, opacity );\n	#include <logdepthbuf_fragment>\n	#include <map_particle_fragment>\n	#include <color_fragment>\n	#include <alphatest_fragment>\n	outgoingLight = diffuseColor.rgb;\n	#include <output_fragment>\n	#include <tonemapping_fragment>\n	#include <encodings_fragment>\n	#include <fog_fragment>\n	#include <premultiplied_alpha_fragment>\n}",shadow_vert:"#include <common>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <shadowmap_pars_vertex>\nvoid main() {\n	#include <beginnormal_vertex>\n	#include <morphnormal_vertex>\n	#include <skinbase_vertex>\n	#include <skinnormal_vertex>\n	#include <defaultnormal_vertex>\n	#include <begin_vertex>\n	#include <morphtarget_vertex>\n	#include <skinning_vertex>\n	#include <project_vertex>\n	#include <worldpos_vertex>\n	#include <shadowmap_vertex>\n	#include <fog_vertex>\n}",shadow_frag:"uniform vec3 color;\nuniform float opacity;\n#include <common>\n#include <packing>\n#include <fog_pars_fragment>\n#include <bsdfs>\n#include <lights_pars_begin>\n#include <shadowmap_pars_fragment>\n#include <shadowmask_pars_fragment>\nvoid main() {\n	gl_FragColor = vec4( color, opacity * ( 1.0 - getShadowMask() ) );\n	#include <tonemapping_fragment>\n	#include <encodings_fragment>\n	#include <fog_fragment>\n}",sprite_vert:"uniform float rotation;\nuniform vec2 center;\n#include <common>\n#include <uv_pars_vertex>\n#include <fog_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n	#include <uv_vertex>\n	vec4 mvPosition = modelViewMatrix * vec4( 0.0, 0.0, 0.0, 1.0 );\n	vec2 scale;\n	scale.x = length( vec3( modelMatrix[ 0 ].x, modelMatrix[ 0 ].y, modelMatrix[ 0 ].z ) );\n	scale.y = length( vec3( modelMatrix[ 1 ].x, modelMatrix[ 1 ].y, modelMatrix[ 1 ].z ) );\n	#ifndef USE_SIZEATTENUATION\n		bool isPerspective = isPerspectiveMatrix( projectionMatrix );\n		if ( isPerspective ) scale *= - mvPosition.z;\n	#endif\n	vec2 alignedPosition = ( position.xy - ( center - vec2( 0.5 ) ) ) * scale;\n	vec2 rotatedPosition;\n	rotatedPosition.x = cos( rotation ) * alignedPosition.x - sin( rotation ) * alignedPosition.y;\n	rotatedPosition.y = sin( rotation ) * alignedPosition.x + cos( rotation ) * alignedPosition.y;\n	mvPosition.xy += rotatedPosition;\n	gl_Position = projectionMatrix * mvPosition;\n	#include <logdepthbuf_vertex>\n	#include <clipping_planes_vertex>\n	#include <fog_vertex>\n}",sprite_frag:"uniform vec3 diffuse;\nuniform float opacity;\n#include <common>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <fog_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n	#include <clipping_planes_fragment>\n	vec3 outgoingLight = vec3( 0.0 );\n	vec4 diffuseColor = vec4( diffuse, opacity );\n	#include <logdepthbuf_fragment>\n	#include <map_fragment>\n	#include <alphamap_fragment>\n	#include <alphatest_fragment>\n	outgoingLight = diffuseColor.rgb;\n	#include <output_fragment>\n	#include <tonemapping_fragment>\n	#include <encodings_fragment>\n	#include <fog_fragment>\n}"},im={common:{diffuse:{value:new ea(16777215)},opacity:{value:1},map:{value:null},uvTransform:{value:new q},uv2Transform:{value:new q},alphaMap:{value:null},alphaTest:{value:0}},specularmap:{specularMap:{value:null}},envmap:{envMap:{value:null},flipEnvMap:{value:-1},reflectivity:{value:1},ior:{value:1.5},refractionRatio:{value:.98}},aomap:{aoMap:{value:null},aoMapIntensity:{value:1}},lightmap:{lightMap:{value:null},lightMapIntensity:{value:1}},emissivemap:{emissiveMap:{value:null}},bumpmap:{bumpMap:{value:null},bumpScale:{value:1}},normalmap:{normalMap:{value:null}
36,normalScale:{value:new j(1,1)}},displacementmap:{displacementMap:{value:null},displacementScale:{value:1},displacementBias:{value:0}},roughnessmap:{roughnessMap:{value:null}},metalnessmap:{metalnessMap:{value:null}},gradientmap:{gradientMap:{value:null}},fog:{fogDensity:{value:25e-5},fogNear:{value:1},fogFar:{value:2e3},fogColor:{value:new ea(16777215)}},lights:{ambientLightColor:{value:[]},lightProbe:{value:[]},directionalLights:{value:[],properties:{direction:{},color:{}}},directionalLightShadows:{value:[],properties:{shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},directionalShadowMap:{value:[]},directionalShadowMatrix:{value:[]},spotLights:{value:[],properties:{color:{},position:{},direction:{},distance:{},coneCos:{},penumbraCos:{},decay:{}}},spotLightShadows:{value:[],properties:{shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},spotShadowMap:{value:[]},spotShadowMatrix:{value:[]},pointLights:{value:[],properties:{color:{},position:{},decay:{},distance:{}}},pointLightShadows:{value:[],properties:{shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{},shadowCameraNear:{},shadowCameraFar:{}}},pointShadowMap:{value:[]},pointShadowMatrix:{value:[]},hemisphereLights:{value:[],properties:{direction:{},skyColor:{},groundColor:{}}},rectAreaLights:{value:[],properties:{color:{},position:{},width:{},height:{}}},ltc_1:{value:null},ltc_2:{value:null}},points:{diffuse:{value:new ea(16777215)},opacity:{value:1},size:{value:1},scale:{value:1},map:{value:null},alphaMap:{value:null},alphaTest:{value:0},uvTransform:{value:new q}},sprite:{diffuse:{value:new ea(16777215)},opacity:{value:1},center:{value:new j(.5,.5)},rotation:{value:0},map:{value:null},alphaMap:{value:null},alphaTest:{value:0},uvTransform:{value:new q}}},ig={basic:{uniforms:t4([im.common,im.specularmap,im.envmap,im.aomap,im.lightmap,im.fog]),vertexShader:ip.meshbasic_vert,fragmentShader:ip.meshbasic_frag},lambert:{uniforms:t4([im.common,im.specularmap,im.envmap,im.aomap,im.lightmap,im.emissivemap,im.fog,im.lights,{emissive:{value:new ea(0)}}]),vertexShader:ip.meshlambert_vert,fragmentShader:ip.meshlambert_frag},phong:{uniforms:t4([im.common,im.specularmap,im.envmap,im.aomap,im.lightmap,im.emissivemap,im.bumpmap,im.normalmap,im.displacementmap,im.fog,im.lights,{emissive:{value:new ea(0)},specular:{value:new ea(1118481)},shininess:{value:30}}]),vertexShader:ip.meshphong_vert,fragmentShader:ip.meshphong_frag},standard:{uniforms:t4([im.common,im.envmap,im.aomap,im.lightmap,im.emissivemap,im.bumpmap,im.normalmap,im.displacementmap,im.roughnessmap,im.metalnessmap,im.fog,im.lights,{emissive:{value:new ea(0)},roughness:{value:1},metalness:{value:0},envMapIntensity:{value:1}}]),vertexShader:ip.meshphysical_vert,fragmentShader:ip.meshphysical_frag},toon:{uniforms:t4([im.common,im.aomap,im.lightmap,im.emissivemap,im.bumpmap,im.normalmap,im.displacementmap,im.gradientmap,im.fog,im.lights,{emissive:{value:new ea(0)}}]),vertexShader:ip.meshtoon_vert,fragmentShader:ip.meshtoon_frag},matcap:{uniforms:t4([im.common,im.bumpmap,im.normalmap,im.displacementmap,im.fog,{matcap:{value:null}}]),vertexShader:ip.meshmatcap_vert,fragmentShader:ip.meshmatcap_frag},points:{uniforms:t4([im.points,im.fog]),vertexShader:ip.points_vert,fragmentShader:ip.points_frag},dashed:{uniforms:t4([im.common,im.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:ip.linedashed_vert,fragmentShader:ip.linedashed_frag},depth:{uniforms:t4([im.common,im.displacementmap]),vertexShader:ip.depth_vert,fragmentShader:ip.depth_frag},normal:{uniforms:t4([im.common,im.bumpmap,im.normalmap,im.displacementmap,{opacity:{value:1}}]),vertexShader:ip.meshnormal_vert,fragmentShader:ip.meshnormal_frag},sprite:{uniforms:t4([im.sprite,im.fog]),vertexShader:ip.sprite_vert,fragmentShader:ip.sprite_frag},background:{uniforms:{uvTransform:{value:new q},t2D:{value:null}},vertexShader:ip.background_vert,fragmentShader:ip.background_frag},cube:{uniforms:t4([im.envmap,{opacity:{value:1}}]),vertexShader:ip.cube_vert,fragmentShader:ip.cube_frag},equirect:{uniforms:{tEquirect:{value:null}},vertexShader:ip.equirect_vert,fragmentShader:ip.equirect_frag},distanceRGBA:{uniforms:t4([im.common,im.displacementmap,{referencePosition:{value:new eg},nearDistance:{value:1},farDistance:{value:1e3}}]),vertexShader:ip.distanceRGBA_vert,fragmentShader:ip.distanceRGBA_frag},shadow:{uniforms:t4([im.lights,im.fog,{color:{value:new ea(0)},opacity:{value:1}},]),vertexShader:ip.shadow_vert,fragmentShader:ip.shadow_frag}};function iv(e,t,i,n,r,a){let l=new ea(0),h=!0===r?0:1,u,c,d=null,p=0,f=null;function m(e,t){i.buffers.color.setClear(e.r,e.g,e.b,t,a)}return{getClearColor:function(){return l},setClearColor:function(e,t=1){l.set(e),m(l,h=t)},getClearAlpha:function(){return h},setClearAlpha:function(e){m(l,h=e)},render:function(i,r){let a=!1,g=!0===r.isScene?r.background:null;g&&g.isTexture&&(g=t.get(g));let v=e.xr,_=v.getSession&&v.getSession();_&&"additive"===_.environmentBlendMode&&(g=null),null===g?m(l,h):g&&g.isColor&&(m(g,1),a=!0),(e.autoClear||a)&&e.clear(e.autoClearColor,e.autoClearDepth,e.autoClearStencil),g&&(g.isCubeTexture||306===g.mapping)?(void 0===c&&((c=new t0(new t3(1,1,1),new t6({name:"Backgroun
36dCubeMaterial",uniforms:t2(ig.cube.uniforms),vertexShader:ig.cube.vertexShader,fragmentShader:ig.cube.fragmentShader,side:o,depthTest:!1,depthWrite:!1,fog:!1}))).geometry.deleteAttribute("normal"),c.geometry.deleteAttribute("uv"),c.onBeforeRender=function(e,t,i){this.matrixWorld.copyPosition(i.matrixWorld)},Object.defineProperty(c.material,"envMap",{get:function(){return this.uniforms.envMap.value}}),n.update(c)),c.material.uniforms.envMap.value=g,c.material.uniforms.flipEnvMap.value=g.isCubeTexture&&!1===g.isRenderTargetTexture?-1:1,(d!==g||p!==g.version||f!==e.toneMapping)&&(c.material.needsUpdate=!0,d=g,p=g.version,f=e.toneMapping),c.layers.enableAll(),i.unshift(c,c.geometry,c.material,0,0,null)):g&&g.isTexture&&(void 0===u&&((u=new t0(new id(2,2),new t6({name:"BackgroundMaterial",uniforms:t2(ig.background.uniforms),vertexShader:ig.background.vertexShader,fragmentShader:ig.background.fragmentShader,side:s,depthTest:!1,depthWrite:!1,fog:!1}))).geometry.deleteAttribute("normal"),Object.defineProperty(u.material,"map",{get:function(){return this.uniforms.t2D.value}}),n.update(u)),u.material.uniforms.t2D.value=g,!0===g.matrixAutoUpdate&&g.updateMatrix(),u.material.uniforms.uvTransform.value.copy(g.matrix),(d!==g||p!==g.version||f!==e.toneMapping)&&(u.material.needsUpdate=!0,d=g,p=g.version,f=e.toneMapping),u.layers.enableAll(),i.unshift(u,u.geometry,u.material,0,0,null))}}}function i_(e,t,i,n){let r=e.getParameter(34921),a=n.isWebGL2?null:t.get("OES_vertex_array_object"),s=n.isWebGL2||null!==a,o={},l=p(null),h=l,u=!1;function c(t){return n.isWebGL2?e.bindVertexArray(t):a.bindVertexArrayOES(t)}function d(t){return n.isWebGL2?e.deleteVertexArray(t):a.deleteVertexArrayOES(t)}function p(e){let t=[],i=[],n=[];for(let a=0;a<r;a++)t[a]=0,i[a]=0,n[a]=0;return{geometry:null,program:null,wireframe:!1,newAttributes:t,enabledAttributes:i,attributeDivisors:n,object:e,attributes:{},index:null}}function f(){let e=h.newAttributes;for(let t=0,i=e.length;t<i;t++)e[t]=0}function m(e){g(e,0)}function g(i,r){let a=h.newAttributes,s=h.enabledAttributes,o=h.attributeDivisors;if(a[i]=1,0===s[i]&&(e.enableVertexAttribArray(i),s[i]=1),o[i]!==r){let l=n.isWebGL2?e:t.get("ANGLE_instanced_arrays");l[n.isWebGL2?"vertexAttribDivisor":"vertexAttribDivisorANGLE"](i,r),o[i]=r}}function v(){let t=h.newAttributes,i=h.enabledAttributes;for(let n=0,r=i.length;n<r;n++)i[n]!==t[n]&&(e.disableVertexAttribArray(n),i[n]=0)}function _(t,i,r,a,s,o){!0===n.isWebGL2&&(5124===r||5125===r)?e.vertexAttribIPointer(t,i,r,s,o):e.vertexAttribPointer(t,i,r,a,s,o)}function x(){y(),u=!0,h!==l&&c((h=l).object)}function y(){l.geometry=null,l.program=null,l.wireframe=!1}return{setup:function(r,l,d,x,y){let M=!1;if(s){let b=function(t,i,r){let s=!0===r.wireframe,l=o[t.id];void 0===l&&(l={},o[t.id]=l);let h=l[i.id];void 0===h&&(h={},l[i.id]=h);let u=h[s];return void 0===u&&(u=p(n.isWebGL2?e.createVertexArray():a.createVertexArrayOES()),h[s]=u),u}(x,d,l);h!==b&&c((h=b).object),(M=function(e,t,i,n){let r=h.attributes,a=t.attributes,s=0,o=i.getAttributes();for(let l in o){let u=o[l];if(u.location>=0){let c=r[l],d=a[l];if(void 0===d&&("instanceMatrix"===l&&e.instanceMatrix&&(d=e.instanceMatrix),"instanceColor"===l&&e.instanceColor&&(d=e.instanceColor)),void 0===c||c.attribute!==d||d&&c.data!==d.data)return!0;s++}}return h.attributesNum!==s||h.index!==n}(r,x,d,y))&&function(e,t,i,n){let r={},a=t.attributes,s=0,o=i.getAttributes();for(let l in o){let u=o[l];if(u.location>=0){let c=a[l];void 0===c&&("instanceMatrix"===l&&e.instanceMatrix&&(c=e.instanceMatrix),"instanceColor"===l&&e.instanceColor&&(c=e.instanceColor));let d={};d.attribute=c,c&&c.data&&(d.data=c.data),r[l]=d,s++}}h.attributes=r,h.attributesNum=s,h.index=n}(r,x,d,y)}else{let S=!0===l.wireframe;(h.geometry!==x.id||h.program!==d.id||h.wireframe!==S)&&(h.geometry=x.id,h.program=d.id,h.wireframe=S,M=!0)}null!==y&&i.update(y,34963),(M||u)&&(u=!1,function(r,a,s,o){if(!1===n.isWebGL2&&(r.isInstancedMesh||o.isInstancedBufferGeometry)&&null===t.get("ANGLE_instanced_arrays"))return;f();let l=o.attributes,h=s.getAttributes(),u=a.defaultAttributeValues;for(let c in h){let d=h[c];if(d.location>=0){let p=l[c];if(void 0===p&&("instanceMatrix"===c&&r.instanceMatrix&&(p=r.instanceMatrix),"instanceColor"===c&&r.instanceColor&&(p=r.instanceColor)),void 0!==p){let x=p.normalized,y=p.itemSize,M=i.get(p);if(void 0===M)continue;let b=M.buffer,S=M.type,w=M.bytesPerElement;if(p.isInterleavedBufferAttribute){let T=p.data,E=T.stride,A=p.offset;if(T.isInstancedInterleavedBuffer){for(let C=0;C<d.locationSize;C++)g(d.location+C,T.meshPerAttribute);!0!==r.isInstancedMesh&&void 0===o._maxInstanceCount&&(o._maxInstanceCount=T.meshPerAttribute*T.count)}else for(let L=0;L<d.locationSize;L++)m(d.location+L);e.bindBuffer(34962,b);for(let P=0;P<d.locationSize;
36P++)_(d.location+P,y/d.locationSize,S,x,E*w,(A+y/d.locationSize*P)*w)}else{if(p.isInstancedBufferAttribute){for(let R=0;R<d.locationSize;R++)g(d.location+R,p.meshPerAttribute);!0!==r.isInstancedMesh&&void 0===o._maxInstanceCount&&(o._maxInstanceCount=p.meshPerAttribute*p.count)}else for(let D=0;D<d.locationSize;D++)m(d.location+D);e.bindBuffer(34962,b);for(let I=0;I<d.locationSize;I++)_(d.location+I,y/d.locationSize,S,x,y*w,y/d.locationSize*I*w)}}else if(void 0!==u){let N=u[c];if(void 0!==N)switch(N.length){case 2:e.vertexAttrib2fv(d.location,N);break;case 3:e.vertexAttrib3fv(d.location,N);break;case 4:e.vertexAttrib4fv(d.location,N);break;default:e.vertexAttrib1fv(d.location,N)}}}}v()}(r,l,d,x),null!==y&&e.bindBuffer(34963,i.get(y).buffer))},reset:x,resetDefaultState:y,dispose:function(){for(let e in x(),o){let t=o[e];for(let i in t){let n=t[i];for(let r in n)d(n[r].object),delete n[r];delete t[i]}delete o[e]}},releaseStatesOfGeometry:function(e){if(void 0===o[e.id])return;let t=o[e.id];for(let i in t){let n=t[i];for(let r in n)d(n[r].object),delete n[r];delete t[i]}delete o[e.id]},releaseStatesOfProgram:function(e){for(let t in o){let i=o[t];if(void 0===i[e.id])continue;let n=i[e.id];for(let r in n)d(n[r].object),delete n[r];delete i[e.id]}},initAttributes:f,enableAttribute:m,disableUnusedAttributes:v}}function ix(e,t,i,n){let r=n.isWebGL2,a;function s(e){a=e}this.setMode=s,this.render=function(t,n){e.drawArrays(a,t,n),i.update(n,a,1)},this.renderInstances=function(n,s,o){if(0===o)return;let l,h;if(r)l=e,h="drawArraysInstanced";else if(l=t.get("ANGLE_instanced_arrays"),h="drawArraysInstancedANGLE",null===l){console.error("THREE.WebGLBufferRenderer: using THREE.InstancedBufferGeometry but hardware does not support extension ANGLE_instanced_arrays.");return}l[h](a,n,s,o),i.update(s,a,o)}}function iy(e,t,i){let n;function r(t){if("highp"===t){if(e.getShaderPrecisionFormat(35633,36338).precision>0&&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"}let a="undefined"!=typeof WebGL2RenderingContext&&e instanceof WebGL2RenderingContext||"undefined"!=typeof WebGL2ComputeRenderingContext&&e instanceof WebGL2ComputeRenderingContext,s=void 0!==i.precision?i.precision:"highp",o=r(s);o!==s&&(console.warn("THREE.WebGLRenderer:",s,"not supported, using",o,"instead."),s=o);let l=a||t.has("WEBGL_draw_buffers"),h=!0===i.logarithmicDepthBuffer,u=e.getParameter(34930),c=e.getParameter(35660),d=e.getParameter(3379),p=e.getParameter(34076),f=e.getParameter(34921),m=e.getParameter(36347),g=e.getParameter(36348),v=e.getParameter(36349),_=c>0,x=a||t.has("OES_texture_float"),y=a?e.getParameter(36183):0;return{isWebGL2:a,drawBuffers:l,getMaxAnisotropy:function(){if(void 0!==n)return n;if(!0===t.has("EXT_texture_filter_anisotropic")){let i=t.get("EXT_texture_filter_anisotropic");n=e.getParameter(i.MAX_TEXTURE_MAX_ANISOTROPY_EXT)}else n=0;return n},getMaxPrecision:r,precision:s,logarithmicDepthBuffer:h,maxTextures:u,maxVertexTextures:c,maxTextureSize:d,maxCubemapSize:p,maxAttributes:f,maxVertexUniforms:m,maxVaryings:g,maxFragmentUniforms:v,vertexTextures:_,floatFragmentTextures:x,floatVertexTextures:_&&x,maxSamples:y}}function iM(e){let t=this,i=null,n=0,r=!1,a=!1,s=new is,o=new q,l={value:null,needsUpdate:!1};function h(){l.value!==i&&(l.value=i,l.needsUpdate=n>0),t.numPlanes=n,t.numIntersection=0}function u(e,i,n,r){let a=null!==e?e.length:0,h=null;if(0!==a){if(h=l.value,!0!==r||null===h){let u=n+4*a,c=i.matrixWorldInverse;o.getNormalMatrix(c),(null===h||h.length<u)&&(h=new Float32Array(u));for(let d=0,p=n;d!==a;++d,p+=4)s.copy(e[d]).applyMatrix4(c,o),s.normal.toArray(h,p),h[p+3]=s.constant}l.value=h,l.needsUpdate=!0}return t.numPlanes=a,t.numIntersection=0,h}this.uniform=l,this.numPlanes=0,this.numIntersection=0,this.init=function(e,t,a){let s=0!==e.length||t||0!==n||r;return r=t,i=u(e,a,0),n=e.length,s},this.beginShadows=function(){a=!0,u(null)},this.endShadows=function(){a=!1,h()},this.setState=function(t,s,o){let c=t.clippingPlanes,d=t.clipIntersection,p=t.clipShadows,f=e.get(t);if(r&&null!==c&&0!==c.length&&(!a||p)){let m=a?0:n,g=4*m,v=f.clippingState||null;l.value=v,v=u(c,s,g,o);for(let _=0;_!==g;++_)v[_]=i[_];f.clippingState=v,this.numIntersection=d?this.numPlanes:0,this.numPlanes+=m}else a?u(null):h()}}function ib(e){let t=new WeakMap;function i(e,t){return 303===t?e.mapping=301:304===t&&(e.mapping=302),e}function n(e){let i=e.target;i.removeEventListener("dispose",n);let r=t.get(i);void 0!==r&&(t.delete(i),r.dispose())}return{get:function(r){if(r&&r.isTexture&&!1===r.isRenderTargetTexture){let a=r.mapping;if(303===a||304===a){if(t.has(r)){let s=t.get(r).texture;return i(s,r.mapping)}{let o=r.image;if(!o||!(o.height>0))return null;{let l=new it(o.height/2);return l.fromEquirectangularTexture(e,r),t.set(r,l),r.addEventListener("dispose",n),i(l.texture,r.mapping)}}}}return r},dispose:function(){t=new WeakMap}}}ig.physical={uniforms:t4([ig.standard.uniforms,{clearcoat:{value:0},clearcoatMap:{value:null},clearcoatRoughness:{value:0},clearcoatRoughnessMap:{value:null}
36,clearcoatNormalScale:{value:new j(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 ea(0)},sheenColorMap:{value:null},sheenRoughness:{value:1},sheenRoughnessMap:{value:null},transmission:{value:0},transmissionMap:{value:null},transmissionSamplerSize:{value:new j},transmissionSamplerMap:{value:null},thickness:{value:0},thicknessMap:{value:null},attenuationDistance:{value:0},attenuationColor:{value:new ea(0)},specularIntensity:{value:1},specularIntensityMap:{value:null},specularColor:{value:new ea(1,1,1)},specularColorMap:{value:null}}]),vertexShader:ip.meshphysical_vert,fragmentShader:ip.meshphysical_frag};class iS extends t7{constructor(e=-1,t=1,i=1,n=-1,r=.1,a=2e3){super(),this.isOrthographicCamera=!0,this.type="OrthographicCamera",this.zoom=1,this.view=null,this.left=e,this.right=t,this.top=i,this.bottom=n,this.near=r,this.far=a,this.updateProjectionMatrix()}copy(e,t){return super.copy(e,t),this.left=e.left,this.right=e.right,this.top=e.top,this.bottom=e.bottom,this.near=e.near,this.far=e.far,this.zoom=e.zoom,this.view=null===e.view?null:Object.assign({},e.view),this}setViewOffset(e,t,i,n,r,a){null===this.view&&(this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1}),this.view.enabled=!0,this.view.fullWidth=e,this.view.fullHeight=t,this.view.offsetX=i,this.view.offsetY=n,this.view.width=r,this.view.height=a,this.updateProjectionMatrix()}clearViewOffset(){null!==this.view&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){let e=(this.right-this.left)/(2*this.zoom),t=(this.top-this.bottom)/(2*this.zoom),i=(this.right+this.left)/2,n=(this.top+this.bottom)/2,r=i-e,a=i+e,s=n+t,o=n-t;if(null!==this.view&&this.view.enabled){let l=(this.right-this.left)/this.view.fullWidth/this.zoom,h=(this.top-this.bottom)/this.view.fullHeight/this.zoom;r+=l*this.view.offsetX,a=r+l*this.view.width,s-=h*this.view.offsetY,o=s-h*this.view.height}this.projectionMatrix.makeOrthographic(r,a,s,o,this.near,this.far),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(e){let t=super.toJSON(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}}let iw=[.125,.215,.35,.446,.526,.582],iT=new iS,iE=new ea,iA=null,iC=(1+Math.sqrt(5))/2,iL=1/iC,iP=[new eg(1,1,1),new eg(-1,1,1),new eg(1,1,-1),new eg(-1,1,-1),new eg(0,iC,iL),new eg(0,iC,-iL),new eg(iL,0,iC),new eg(-iL,0,iC),new eg(iC,iL,0),new eg(-iC,iL,0)];class iR{constructor(e){this._renderer=e,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)}fromScene(e,t=0,i=.1,n=100){iA=this._renderer.getRenderTarget(),this._setSize(256);let r=this._allocateTargets();return r.depthBuffer=!0,this._sceneToCubeUV(e,i,n,r),t>0&&this._blur(r,0,0,t),this._applyPMREM(r),this._cleanup(r),r}fromEquirectangular(e,t=null){return this._fromTexture(e,t)}fromCubemap(e,t=null){return this._fromTexture(e,t)}compileCubemapShader(){null===this._cubemapMaterial&&(this._cubemapMaterial=iO(),this._compileMaterial(this._cubemapMaterial))}compileEquirectangularShader(){null===this._equirectMaterial&&(this._equirectMaterial=iN(),this._compileMaterial(this._equirectMaterial))}dispose(){this._dispose(),null!==this._cubemapMaterial&&this._cubemapMaterial.dispose(),null!==this._equirectMaterial&&this._equirectMaterial.dispose()}_setSize(e){this._lodMax=Math.floor(Math.log2(e)),this._cubeSize=Math.pow(2,this._lodMax)}_dispose(){null!==this._blurMaterial&&this._blurMaterial.dispose(),null!==this._pingPongRenderTarget&&this._pingPongRenderTarget.dispose();for(let e=0;e<this._lodPlanes.length;e++)this._lodPlanes[e].dispose()}_cleanup(e){this._renderer.setRenderTarget(iA),e.scissorTest=!1,iI(e,0,0,e.width,e.height)}_fromTexture(e,t){301===e.mapping||302===e.mapping?this._setSize(0===e.image.length?16:e.image[0].width||e.image[0].image.width):this._setSize(e.image.width/4),iA=this._renderer.getRenderTarget();let i=t||this._allocateTargets();return this._textureToCubeUV(e,i),this._applyPMREM(i),this._cleanup(i),i}_allocateTargets(){let e=3*Math.max(this._cubeSize,112),t=4*this._cubeSize,i={magFilter:v,minFilter:v,generateMipmaps:!1,type:1016,format:1023,encoding:3e3,depthBuffer:!1},n=iD(e,t,i);if(null===this._pingPongRenderTarget||this._pingPongRenderTarget.width!==e){null!==this._pingPongRenderTarget&&this._dispose(),this._pingPongRenderTarget=iD(e,t,i);let{_lodMax:r}=this;({sizeLods:this._sizeLods,lodPlanes:this._lodPlanes,sigmas:this._sigmas}=function(e){let t=[],i=[],n=[],r=e,a=e-4+1+iw.length;for(let s=0;s<a;s++){let o=Math.pow(2,r);i.push(o);let l=1/o;s>e-4?l=iw[s-e+4-1]:0===s&&(l=0),n.push(l);let h=1/(o-2),u=-h,c=1+h,d=[u,u,c,u,c,c,u,u,c,c,u,c],p=new Float32Array(108),f=new Float32Array(72),m=new Float32Array(36);for(let g=0;g<6;g++){let v=g%3*2/3-1,_=g>2?0:-1,x=[v,_,0,v+2/3,_,0,v+2/3,_+1,0,v,_,0,v+2/3,_+1,0,v,_+1,0];p.set(x,18*g),f.set(d,12*g);let y=[g,g,g,g,g,g];m.set(y,6*g)}let M=new tz;M.setAttribute("position",new tT(p,3)),M.setAttribute("uv",new tT(f,2)),M.setAttribute("faceIndex",new tT(m,1)),t.push(M),r>4&&r--}return{lodPlanes:t,sizeLods:i,sigmas:n}}(r)),this._blurMaterial=function(e,t,i){let n=new Float32Array(20),r=new eg(0,1,0),a=new t6({name:"SphericalGaussianBlur",defines:{n:20,CUBEUV_TEXEL_WIDTH:1/t,CUBEUV_TEXEL_HEIGHT:1/i,CUBEUV_MAX_MIP:`${e}.0`},uniforms:{envMap:{value:null},samples:{value:1},weights:{value:n},latitudinal:{value:!1},dTheta:{value:0},mipInt:{value:0},poleAxis:{value:r}},vertexShader:iz(),fragmentShader:`
37
38			precision mediump float;
39			precision mediump int;
40
41			varying vec3 vOutputDirection;
42
43			uniform sampler2D envMap;
44			uniform int samples;
45			uniform float weights[ n ];
46			uniform bool latitudinal;
47			uniform float dTheta;
48			uniform float mipInt;
49			uniform vec3 poleAxis;
50
51			#define ENVMAP_TYPE_CUBE_UV
52			#include <cube_uv_reflection_fragment>
53
54			vec3 getSample( float theta, vec3 axis ) {
55
56				float cosTheta = cos( theta );
57				// Rodrigues' axis-angle rotation
58				vec3 sampleDirection = vOutputDirection * cosTheta
59					+ cross( axis, vOutputDirection ) * sin( theta )
60					+ axis * dot( axis, vOutputDirection ) * ( 1.0 - cosTheta );
61
62				return bilinearCubeUV( envMap, sampleDirection, mipInt );
63
64			}
65
66			void main() {
67
68				vec3 axis = latitudinal ? poleAxis : cross( poleAxis, vOutputDirection );
69
70				if ( all( equal( axis, vec3( 0.0 ) ) ) ) {
71
72					axis = vec3( vOutputDirection.z, 0.0, - vOutputDirection.x );
73
74				}
75
76				axis = normalize( axis );
77
78				gl_FragColor = vec4( 0.0, 0.0, 0.0, 1.0 );
79				gl_FragColor.rgb += weights[ 0 ] * getSample( 0.0, axis );
80
81				for ( int i = 1; i < n; i++ ) {
82
83					if ( i >= samples ) {
84
85						break;
86
87					}
88
89					float theta = dTheta * float( i );
90					gl_FragColor.rgb += weights[ i ] * getSample( -1.0 * theta, axis );
91					gl_FragColor.rgb += weights[ i ] * getSample( theta, axis );
92
93				}
94
95			}
96		`,blending:0,depthTest:!1,depthWrite:!1});return a}(r,e,t)}return n}_compileMaterial(e){let t=new t0(this._lodPlanes[0],e);this._renderer.compile(t,iT)}_sceneToCubeUV(e,t,i,n){let r=new t8(90,1,t,i),a=[1,-1,1,1,1,1],s=[1,1,1,-1,-1,-1],l=this._renderer,h=l.autoClear,u=l.toneMapping;l.getClearColor(iE),l.toneMapping=0,l.autoClear=!1;
96let c=new tb({name:"PMREM.Background",side:o,depthWrite:!1,depthTest:!1}),d=new t0(new t3,c),p=!1,f=e.background;f?f.isColor&&(c.color.copy(f),e.background=null,p=!0):(c.color.copy(iE),p=!0);for(let m=0;m<6;m++){let g=m%3;0===g?(r.up.set(0,a[m],0),r.lookAt(s[m],0,0)):1===g?(r.up.set(0,0,a[m]),r.lookAt(0,s[m],0)):(r.up.set(0,a[m],0),r.lookAt(0,0,s[m]));let v=this._cubeSize;iI(n,g*v,m>2?v:0,v,v),l.setRenderTarget(n),p&&l.render(d,r),l.render(e,r)}d.geometry.dispose(),d.material.dispose(),l.toneMapping=u,l.autoClear=h,e.background=f}_textureToCubeUV(e,t){let i=this._renderer,n=301===e.mapping||302===e.mapping;n?(null===this._cubemapMaterial&&(this._cubemapMaterial=iO()),this._cubemapMaterial.uniforms.flipEnvMap.value=!1===e.isRenderTargetTexture?-1:1):null===this._equirectMaterial&&(this._equirectMaterial=iN());let r=n?this._cubemapMaterial:this._equirectMaterial,a=new t0(this._lodPlanes[0],r),s=r.uniforms;s.envMap.value=e;let o=this._cubeSize;iI(t,0,0,3*o,2*o),i.setRenderTarget(t),i.render(a,iT)}_applyPMREM(e){let t=this._renderer,i=t.autoClear;t.autoClear=!1;for(let n=1;n<this._lodPlanes.length;n++){let r=Math.sqrt(this._sigmas[n]*this._sigmas[n]-this._sigmas[n-1]*this._sigmas[n-1]),a=iP[(n-1)%iP.length];this._blur(e,n-1,n,r,a)}t.autoClear=i}_blur(e,t,i,n,r){let a=this._pingPongRenderTarget;this._halfBlur(e,a,t,i,n,"latitudinal",r),this._halfBlur(a,e,i,i,n,"longitudinal",r)}_halfBlur(e,t,i,n,r,a,s){let o=this._renderer,l=this._blurMaterial;"latitudinal"!==a&&"longitudinal"!==a&&console.error("blur direction must be either latitudinal or longitudinal!");let h=new t0(this._lodPlanes[n],l),u=l.uniforms,c=this._sizeLods[i]-1,d=isFinite(r)?Math.PI/(2*c):2*Math.PI/39,p=r/d,f=isFinite(r)?1+Math.floor(3*p):20;f>20&&console.warn(`sigmaRadians, ${r}, is too large and will clip, as it requested ${f} samples when the maximum is set to 20`);let m=[],g=0;for(let v=0;v<20;++v){let _=v/p,x=Math.exp(-_*_/2);m.push(x),0===v?g+=x:v<f&&(g+=2*x)}for(let y=0;y<m.length;y++)m[y]=m[y]/g;u.envMap.value=e.texture,u.samples.value=f,u.weights.value=m,u.latitudinal.value="latitudinal"===a,s&&(u.poleAxis.value=s);let{_lodMax:M}=this;u.dTheta.value=d,u.mipInt.value=M-i;let b=this._sizeLods[n],S=4*(this._cubeSize-b);iI(t,3*b*(n>M-4?n-M+4:0),S,3*b,2*b),o.setRenderTarget(t),o.render(h,iT)}}function iD(e,t,i){let n=new ep(e,t,i);return n.texture.mapping=306,n.texture.name="PMREM.cubeUv",n.scissorTest=!0,n}function iI(e,t,i,n,r){e.viewport.set(t,i,n,r),e.scissor.set(t,i,n,r)}function iN(){return new t6({name:"EquirectangularToCubeUV",uniforms:{envMap:{value:null}},vertexShader:iz(),fragmentShader:`
97
98			precision mediump float;
99			precision mediump int;
100
101			varying vec3 vOutputDirection;
102
103			uniform sampler2D envMap;
104
105			#include <common>
106
107			void main() {
108
109				vec3 outputDirection = normalize( vOutputDirection );
110				vec2 uv = equirectUv( outputDirection );
111
112				gl_FragColor = vec4( texture2D ( envMap, uv ).rgb, 1.0 );
113
114			}
115		`,blending:0,depthTest:!1,depthWrite:!1})}function iO(){return new t6({name:"CubemapToCubeUV",uniforms:{envMap:{value:null},flipEnvMap:{value:-1}},vertexShader:iz(),fragmentShader:`
116
117			precision mediump float;
118			precision mediump int;
119
120			uniform float flipEnvMap;
121
122			varying vec3 vOutputDirection;
123
124			uniform samplerCube envMap;
125
126			void main() {
127
128				gl_FragColor = textureCube( envMap, vec3( flipEnvMap * vOutputDirection.x, vOutputDirection.yz ) );
129
130			}
131		`,blending:0,depthTest:!1,depthWrite:!1})}function iz(){return`
132
133		precision mediump float;
134		precision mediump int;
135
136		attribute float faceIndex;
137
138		varying vec3 vOutputDirection;
139
140		// RH coordinate system; PMREM face-indexing convention
141		vec3 getDirection( vec2 uv, float face ) {
142
143			uv = 2.0 * uv - 1.0;
144
145			vec3 direction = vec3( uv, 1.0 );
146
147			if ( face == 0.0 ) {
148
149				direction = direction.zyx; // ( 1, v, u ) pos x
150
151			} else if ( face == 1.0 ) {
152
153				direction = direction.xzy;
154				direction.xz *= -1.0; // ( -u, 1, -v ) pos y
155
156			} else if ( face == 2.0 ) {
157
158				direction.x *= -1.0; // ( -u, v, 1 ) pos z
159
160			} else if ( face == 3.0 ) {
161
162				direction = direction.zyx;
163				direction.xz *= -1.0; // ( -1, v, -u ) neg x
164
165			} else if ( face == 4.0 ) {
166
167				direction = direction.xzy;
168				direction.xy *= -1.0; // ( -u, -1, v ) neg y
169
170			} else if ( face == 5.0 ) {
171
172				direction.z *= -1.0; // ( u, v, -1 ) neg z
173
174			}
175
176			return direction;
177
178		}
179
180		void main() {
181
182			vOutputDirection = getDirection( uv, faceIndex );
183			gl_Position = vec4( position, 1.0 );
184
185		}
186	`}function iU(e){let t=new WeakMap,i=null;function n(e){let i=e.target;i.removeEventListener("dispose",n);let r=t.get(i);void 0!==r&&(t.delete(i),r.dispose())}return{get:function(r){if(r&&r.isTexture){let a=r.mapping,s=303===a||304===a,o=301===a||302===a;if(s||o){if(r.isRenderTargetTexture&&!0===r.needsPMREMUpdate){r.needsPMREMUpdate=!1;let l=t.get(r);return null===i&&(i=new iR(e)),l=s?i.fromEquirectangular(r,l):i.fromCubemap(r,l),t.set(r,l),l.texture}if(t.has(r))return t.get(r).texture;{let h=r.image;if(!(s&&h&&h.height>0||o&&h&&function(e){let t=0;for(let i=0;i<6;i++)void 0!==e[i]&&t++;return 6===t}(h)))return null;{null===i&&(i=new iR(e));let u=s?i.fromEquirectangular(r):i.fromCubemap(r);return t.set(r,u),r.addEventListener("dispose",n),u.texture}}}}return r},dispose:function(){t=new WeakMap,null!==i&&(i.dispose(),i=null)}}}function iF(e){let t={};function i(i){if(void 0!==t[i])return t[i];let n;switch(i){case"WEBGL_depth_texture":n=e.getExtension("WEBGL_depth_texture")||e.getExtension("MOZ_WEBGL_depth_texture")||e.getExtension("WEBKIT_WEBGL_depth_texture");break;case"EXT_texture_filter_anisotropic":n=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":n=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":n=e.getExtension("WEBGL_compressed_texture_pvrtc")||e.getExtension("WEBKIT_WEBGL_compressed_texture_pvrtc");break;default:n=e.getExtension(i)}return t[i]=n,n}return{has:function(e){return null!==i(e)},init:function(e){e.isWebGL2?i("EXT_color_buffer_float"):(i("WEBGL_depth_texture"),i("OES_texture_float"),i("OES_texture_half_float"),i("OES_texture_half_float_linear"),i("OES_standard_derivatives"),i("OES_element_index_uint"),i("OES_vertex_array_object"),i("ANGLE_instanced_arrays")),i("OES_texture_float_linear"),i("EXT_color_buffer_half_float"),i("WEBGL_multisampled_render_to_texture")},get:function(e){let t=i(e);return null===t&&console.warn("THREE.WebGLRenderer: "+e+" extension not supported."),t}}}function iB(e,t,i,n){let r={},a=new WeakMap;function s(e){let o=e.target;for(let l in null!==o.index&&t.remove(o.index),o.attributes)t.remove(o.attributes[l]);o.removeEventListener("dispose",s),delete r[o.id];let h=a.get(o);h&&(t.remove(h),a.delete(o)),n.releaseStatesOfGeometry(o),!0===o.isInstancedBufferGeometry&&delete o._maxInstanceCount,i.memory.geometries--}function o(e){let i=[],n=e.index,r=e.attributes.position,s=0;if(null!==n){let o=n.array;s=n.version;for(let l=0,h=o.length;l<h;l+=3){let u=o[l+0],c=o[l+1],d=o[l+2];i.push(u,c,c,d,d,u)}}else{let p=r.array;s=r.version;for(let f=0,m=p.length/3-1;f<m;f+=3){let g=f+0,v=f+1,_=f+2;i.push(g,v,v,_,_,g)}}let x=new(X(i)?tA:tE)(i,1);x.version=s;let y=a.get(e);y&&t.remove(y),a.set(e,x)}return{get:function(e,t){return!0===r[t.id]||(t.addEventListener("dispose",s),r[t.id]=!0,i.memory.geometries++),t},update:function(e){let i=e.attributes;for(let n in i)t.update(i[n],34962);let r=e.morphAttributes;for(let a in r){let s=r[a];for(let o=0,l=s.length;o<l;o++)t.update(s[o],34962)}},getWireframeAttribute:function(e){let t=a.get(e);if(t){let i=e.index;null!==i&&t.version<i.version&&o(e)}else o(e);return a.get(e)}}}
186function ik(e,t,i,n){let r=n.isWebGL2,a;function s(e){a=e}let o,l;this.setMode=s,this.setIndex=function(e){o=e.type,l=e.bytesPerElement},this.render=function(t,n){e.drawElements(a,n,o,t*l),i.update(n,a,1)},this.renderInstances=function(n,s,h){if(0===h)return;let u,c;if(r)u=e,c="drawElementsInstanced";else if(u=t.get("ANGLE_instanced_arrays"),c="drawElementsInstancedANGLE",null===u){console.error("THREE.WebGLIndexedBufferRenderer: using THREE.InstancedBufferGeometry but hardware does not support extension ANGLE_instanced_arrays.");return}u[c](a,s,o,n*l,h),i.update(s,a,h)}}function iV(e){let t={frame:0,calls:0,triangles:0,points:0,lines:0};return{memory:{geometries:0,textures:0},render:t,programs:null,autoReset:!0,reset:function(){t.frame++,t.calls=0,t.triangles=0,t.points=0,t.lines=0},update:function(e,i,n){switch(t.calls++,i){case 4:t.triangles+=n*(e/3);break;case 1:t.lines+=n*(e/2);break;case 3:t.lines+=n*(e-1);break;case 2:t.lines+=n*e;break;case 0:t.points+=n*e;break;default:console.error("THREE.WebGLInfo: Unknown draw mode:",i)}}}}function iG(e,t){return e[0]-t[0]}function iH(e,t){return Math.abs(t[1])-Math.abs(e[1])}function iW(e,t){let i=1,n=t.isInterleavedBufferAttribute?t.data.array:t.array;n instanceof Int8Array?i=127:n instanceof Uint8Array?i=255:n instanceof Uint16Array?i=65535:n instanceof Int16Array?i=32767:n instanceof Int32Array?i=2147483647:console.error("THREE.WebGLMorphtargets: Unsupported morph attribute data type: ",n),e.divideScalar(i)}function ij(e,t,i){let n={},r=new Float32Array(8),a=new WeakMap,s=new ed,o=[];for(let l=0;l<8;l++)o[l]=[l,0];return{update:function(l,h,u,c){let d=l.morphTargetInfluences;if(!0===t.isWebGL2){let p=h.morphAttributes.position||h.morphAttributes.normal||h.morphAttributes.color,f=void 0!==p?p.length:0,m=a.get(h);if(void 0===m||m.count!==f){void 0!==m&&m.texture.dispose();let g=void 0!==h.morphAttributes.position,v=void 0!==h.morphAttributes.normal,_=void 0!==h.morphAttributes.color,x=h.morphAttributes.position||[],y=h.morphAttributes.normal||[],M=h.morphAttributes.color||[],b=0;!0===g&&(b=1),!0===v&&(b=2),!0===_&&(b=3);let S=h.attributes.position.count*b,w=1;S>t.maxTextureSize&&(w=Math.ceil(S/t.maxTextureSize),S=t.maxTextureSize);let T=new Float32Array(S*w*4*f),E=new ef(T,S,w,f);E.type=1015,E.needsUpdate=!0;let A=4*b;for(let C=0;C<f;C++){let L=x[C],P=y[C],R=M[C],D=S*w*4*C;for(let I=0;I<L.count;I++){let N=I*A;!0===g&&(s.fromBufferAttribute(L,I),!0===L.normalized&&iW(s,L),T[D+N+0]=s.x,T[D+N+1]=s.y,T[D+N+2]=s.z,T[D+N+3]=0),!0===v&&(s.fromBufferAttribute(P,I),!0===P.normalized&&iW(s,P),T[D+N+4]=s.x,T[D+N+5]=s.y,T[D+N+6]=s.z,T[D+N+7]=0),!0===_&&(s.fromBufferAttribute(R,I),!0===R.normalized&&iW(s,R),T[D+N+8]=s.x,T[D+N+9]=s.y,T[D+N+10]=s.z,T[D+N+11]=4===R.itemSize?s.w:1)}}function O(){E.dispose(),a.delete(h),h.removeEventListener("dispose",O)}m={count:f,texture:E,size:new j(S,w)},a.set(h,m),h.addEventListener("dispose",O)}let z=0;for(let U=0;U<d.length;U++)z+=d[U];let F=h.morphTargetsRelative?1:1-z;c.getUniforms().setValue(e,"morphTargetBaseInfluence",F),c.getUniforms().setValue(e,"morphTargetInfluences",d),c.getUniforms().setValue(e,"morphTargetsTexture",m.texture,i),c.getUniforms().setValue(e,"morphTargetsTextureSize",m.size)}else{let B=void 0===d?0:d.length,k=n[h.id];if(void 0===k||k.length!==B){k=[];for(let V=0;V<B;V++)k[V]=[V,0];n[h.id]=k}for(let G=0;G<B;G++){let H=k[G];H[0]=G,H[1]=d[G]}k.sort(iH);for(let W=0;W<8;W++)W<B&&k[W][1]?(o[W][0]=k[W][0],o[W][1]=k[W][1]):(o[W][0]=Number.MAX_SAFE_INTEGER,o[W][1]=0);o.sort(iG);let q=h.morphAttributes.position,X=h.morphAttributes.normal,Y=0;for(let Z=0;Z<8;Z++){let J=o[Z],K=J[0],Q=J[1];K!==Number.MAX_SAFE_INTEGER&&Q?(q&&h.getAttribute("morphTarget"+Z)!==q[K]&&h.setAttribute("morphTarget"+Z,q[K]),X&&h.getAttribute("morphNormal"+Z)!==X[K]&&h.setAttribute("morphNormal"+Z,X[K]),r[Z]=Q,Y+=Q):(q&&!0===h.hasAttribute("morphTarget"+Z)&&h.deleteAttribute("morphTarget"+Z),X&&!0===h.hasAttribute("morphNormal"+Z)&&h.deleteAttribute("morphNormal"+Z),r[Z]=0)}let $=h.morphTargetsRelative?1:1-Y;c.getUniforms().setValue(e,"morphTargetBaseInfluence",$),c.getUniforms().setValue(e,"morphTargetInfluences",r)}}}}function iq(e,t,i,n){let r=new WeakMap;function a(e){let t=e.target;t.removeEventListener("dispose",a),i.remove(t.instanceMatrix),null!==t.instanceColor&&i.remove(t.instanceColor)}return{update:function(e){let s=n.render.frame,o=e.geometry,l=t.get(e,o);return r.get(l)!==s&&(t.update(l),r.set(l,s)),e.isInstancedMesh&&(!1===e.hasEventListener("dispose",a)&&e.addEventListener("dispose",a),i.update(e.instanceMatrix,34962),null!==e.instanceColor&&i.update(e.instanceColor,34962)),l},dispose:function(){r=new WeakMap}}}let iX=new ec,iY=new ef,iZ=new class extends ec{constructor(e=null,t=1,i=1,n=1){super(null),this.isData3DTexture=!0,this.image={data:e,width:t,height:i,depth:n},this.magFilter=f,this.minFilter=f,this.wrapR=d,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}}
186,iJ=new ie,iK=[],iQ=[],i$=new Float32Array(16),i0=new Float32Array(9),i1=new Float32Array(4);function i3(e,t,i){let n=e[0];if(n<=0||n>0)return e;let r=t*i,a=iK[r];if(void 0===a&&(a=new Float32Array(r),iK[r]=a),0!==t){n.toArray(a,0);for(let s=1,o=0;s!==t;++s)o+=i,e[s].toArray(a,o)}return a}function i2(e,t){if(e.length!==t.length)return!1;for(let i=0,n=e.length;i<n;i++)if(e[i]!==t[i])return!1;return!0}function i4(e,t){for(let i=0,n=t.length;i<n;i++)e[i]=t[i]}function i5(e,t){let i=iQ[t];void 0===i&&(i=new Int32Array(t),iQ[t]=i);for(let n=0;n!==t;++n)i[n]=e.allocateTextureUnit();return i}function i6(e,t){let i=this.cache;i[0]!==t&&(e.uniform1f(this.addr,t),i[0]=t)}function i7(e,t){let i=this.cache;if(void 0!==t.x)(i[0]!==t.x||i[1]!==t.y)&&(e.uniform2f(this.addr,t.x,t.y),i[0]=t.x,i[1]=t.y);else{if(i2(i,t))return;e.uniform2fv(this.addr,t),i4(i,t)}}function i8(e,t){let i=this.cache;if(void 0!==t.x)(i[0]!==t.x||i[1]!==t.y||i[2]!==t.z)&&(e.uniform3f(this.addr,t.x,t.y,t.z),i[0]=t.x,i[1]=t.y,i[2]=t.z);else if(void 0!==t.r)(i[0]!==t.r||i[1]!==t.g||i[2]!==t.b)&&(e.uniform3f(this.addr,t.r,t.g,t.b),i[0]=t.r,i[1]=t.g,i[2]=t.b);else{if(i2(i,t))return;e.uniform3fv(this.addr,t),i4(i,t)}}function i9(e,t){let i=this.cache;if(void 0!==t.x)(i[0]!==t.x||i[1]!==t.y||i[2]!==t.z||i[3]!==t.w)&&(e.uniform4f(this.addr,t.x,t.y,t.z,t.w),i[0]=t.x,i[1]=t.y,i[2]=t.z,i[3]=t.w);else{if(i2(i,t))return;e.uniform4fv(this.addr,t),i4(i,t)}}function ne(e,t){let i=this.cache,n=t.elements;if(void 0===n){if(i2(i,t))return;e.uniformMatrix2fv(this.addr,!1,t),i4(i,t)}else{if(i2(i,n))return;i1.set(n),e.uniformMatrix2fv(this.addr,!1,i1),i4(i,n)}}function nt(e,t){let i=this.cache,n=t.elements;if(void 0===n){if(i2(i,t))return;e.uniformMatrix3fv(this.addr,!1,t),i4(i,t)}else{if(i2(i,n))return;i0.set(n),e.uniformMatrix3fv(this.addr,!1,i0),i4(i,n)}}function ni(e,t){let i=this.cache,n=t.elements;if(void 0===n){if(i2(i,t))return;e.uniformMatrix4fv(this.addr,!1,t),i4(i,t)}else{if(i2(i,n))return;i$.set(n),e.uniformMatrix4fv(this.addr,!1,i$),i4(i,n)}}function nn(e,t){let i=this.cache;i[0]!==t&&(e.uniform1i(this.addr,t),i[0]=t)}function nr(e,t){let i=this.cache;i2(i,t)||(e.uniform2iv(this.addr,t),i4(i,t))}function na(e,t){let i=this.cache;i2(i,t)||(e.uniform3iv(this.addr,t),i4(i,t))}function ns(e,t){let i=this.cache;i2(i,t)||(e.uniform4iv(this.addr,t),i4(i,t))}function no(e,t){let i=this.cache;i[0]!==t&&(e.uniform1ui(this.addr,t),i[0]=t)}function nl(e,t){let i=this.cache;i2(i,t)||(e.uniform2uiv(this.addr,t),i4(i,t))}function nh(e,t){let i=this.cache;i2(i,t)||(e.uniform3uiv(this.addr,t),i4(i,t))}function nu(e,t){let i=this.cache;i2(i,t)||(e.uniform4uiv(this.addr,t),i4(i,t))}function nc(e,t,i){let n=this.cache,r=i.allocateTextureUnit();n[0]!==r&&(e.uniform1i(this.addr,r),n[0]=r),i.setTexture2D(t||iX,r)}function nd(e,t,i){let n=this.cache,r=i.allocateTextureUnit();n[0]!==r&&(e.uniform1i(this.addr,r),n[0]=r),i.setTexture3D(t||iZ,r)}function np(e,t,i){let n=this.cache,r=i.allocateTextureUnit();n[0]!==r&&(e.uniform1i(this.addr,r),n[0]=r),i.setTextureCube(t||iJ,r)}function nf(e,t,i){let n=this.cache,r=i.allocateTextureUnit();n[0]!==r&&(e.uniform1i(this.addr,r),n[0]=r),i.setTexture2DArray(t||iY,r)}function nm(e,t){e.uniform1fv(this.addr,t)}function ng(e,t){let i=i3(t,this.size,2);e.uniform2fv(this.addr,i)}function nv(e,t){let i=i3(t,this.size,3);e.uniform3fv(this.addr,i)}function n_(e,t){let i=i3(t,this.size,4);e.uniform4fv(this.addr,i)}function nx(e,t){let i=i3(t,this.size,4);e.uniformMatrix2fv(this.addr,!1,i)}function ny(e,t){let i=i3(t,this.size,9);e.uniformMatrix3fv(this.addr,!1,i)}function nM(e,t){let i=i3(t,this.size,16);e.uniformMatrix4fv(this.addr,!1,i)}function nb(e,t){e.uniform1iv(this.addr,t)}function nS(e,t){e.uniform2iv(this.addr,t)}function nw(e,t){e.uniform3iv(this.addr,t)}function nT(e,t){e.uniform4iv(this.addr,t)}function nE(e,t){e.uniform1uiv(this.addr,t)}function nA(e,t){e.uniform2uiv(this.addr,t)}function nC(e,t){e.uniform3uiv(this.addr,t)}function nL(e,t){e.uniform4uiv(this.addr,t)}function nP(e,t,i){let n=t.length,r=i5(i,n);e.uniform1iv(this.addr,r);for(let a=0;a!==n;++a)i.setTexture2D(t[a]||iX,r[a])}function nR(e,t,i){let n=t.length,r=i5(i,n);e.uniform1iv(this.addr,r);for(let a=0;a!==n;++a)i.setTexture3D(t[a]||iZ,r[a])}function nD(e,t,i){let n=t.length,r=i5(i,n);e.uniform1iv(this.addr,r);for(let a=0;a!==n;++a)i.setTextureCube(t[a]||iJ,r[a])}function nI(e,t,i){let n=t.length,r=i5(i,n);e.uniform1iv(this.addr,r);for(let a=0;a!==n;++a)i.setTexture2DArray(t[a]||iY,r[a])}class nN{constructor(e,t,i){this.id=e,this.addr=i,this.cache=[],this.setValue=function(e){switch(e){case 5126:return i6;case 35664:return i7;case 35665:return i8;case 35666:return i9;case 35674:return ne;case 35675:return nt;case 35676:return ni;case 5124:case 35670:return nn;case 35667:case 35671:return nr;case 35668:case 35672:return na;case 35669:case 35673:return ns;case 5125:return no;case 36294:return nl;case 36295:return nh;case 36296:return nu;case 35678:case 36198:case 36298:case 36306:case 35682:return nc;case 35679:case 36299:case 36307:return nd;case 35680:case 36300:case 36308:case 36293:return np;case 36289:case 36303:case 36311:case 36292:return nf}}(t.type)}}class nO{constructor(e,t,i){this.id=e,this.addr=i,this.cache=[],this.size=t.size,this.setValue=function(e){switch(e){case 5126:return nm;case 35664:return ng;case 35665:return nv;case 35666:return n_;case 35674:return nx;case 35675:return ny;case 35676:return nM;case 5124:case 35670:return nb;case 35667:case 35671:return nS;case 35668:case 35672:return nw;case 35669:case 35673:return nT;case 5125:return nE;case 36294:return nA;case 36295:return nC;case 36296:return nL;case 35678:case 36198:case 36298:case 36306:case 35682:return nP;case 35679:case 36299:case 36307:return nR;case 35680:case 36300:case 36308:case 36293:return nD;case 36289:case 36303:case 36311:case 36292:return nI}}(t.type)}}class nz{constructor(e){this.id=e,this.seq=[],this.map={}}setValue(e,t,i){let n=this.seq;for(let r=0,a=n.length;r!==a;++r){let s=n[r];s.setValue(e,t[s.id],i)}}}let nU=/(\w+)(\])?(\[|\.)?/g;function nF(e,t){e.seq.push(t),e.map[t.id]=t}function nB(e,t,i){let n=e.name,r=n.length;for(nU.lastIndex=0;;){let a=nU.exec(n),s=nU.lastIndex,o=a[1],l="]"===a[2],h=a[3];if(l&&(o|=0),void 0===h||"["===h&&s+2===r){nF(i,void 0===h?new nN(o,e,t):new nO(o,e,t));break}{let u=i.map,c=u[o];void 0===c&&nF(i,c=new nz(o)),i=c}}}class nk{constructor(e,t){this.seq=[],this.map={};let i=e.getProgramParameter(t,35718);for(let n=0;n<i;++n){let r=e.getActiveUniform(t,n),a=e.getUniformLocation(t,r.name);nB(r,a,this)}}setValue(e,t,i,n){let r=this.map[t];void 0!==r&&r.setValue(e,i,n)}setOptional(e,t,i){let n=t[i];void 0!==n&&this.setValue(e,i,n)}static upload(e,t,i,n){for(let r=0,a=t.length;r!==a;++r){let s=t[r],o=i[s.id];
186!1!==o.needsUpdate&&s.setValue(e,o.value,n)}}static seqWithValue(e,t){let i=[];for(let n=0,r=e.length;n!==r;++n){let a=e[n];a.id in t&&i.push(a)}return i}}function nV(e,t,i){let n=e.createShader(t);return e.shaderSource(n,i),e.compileShader(n),n}let nG=0;function nH(e,t,i){let n=e.getShaderParameter(t,35713),r=e.getShaderInfoLog(t).trim();if(n&&""===r)return"";let a=/ERROR: 0:(\d+)/.exec(r);if(!a)return r;{let s=parseInt(a[1]);return i.toUpperCase()+"\n\n"+r+"\n\n"+function(e,t){let i=e.split("\n"),n=[],r=Math.max(t-6,0),a=Math.min(t+6,i.length);for(let s=r;s<a;s++){let o=s+1;n.push(`${o===t?">":" "} ${o}: ${i[s]}`)}return n.join("\n")}(e.getShaderSource(t),s)}}function nW(e){return""!==e}function nj(e,t){return e.replace(/NUM_DIR_LIGHTS/g,t.numDirLights).replace(/NUM_SPOT_LIGHTS/g,t.numSpotLights).replace(/NUM_RECT_AREA_LIGHTS/g,t.numRectAreaLights).replace(/NUM_POINT_LIGHTS/g,t.numPointLights).replace(/NUM_HEMI_LIGHTS/g,t.numHemiLights).replace(/NUM_DIR_LIGHT_SHADOWS/g,t.numDirLightShadows).replace(/NUM_SPOT_LIGHT_SHADOWS/g,t.numSpotLightShadows).replace(/NUM_POINT_LIGHT_SHADOWS/g,t.numPointLightShadows)}function nq(e,t){return e.replace(/NUM_CLIPPING_PLANES/g,t.numClippingPlanes).replace(/UNION_CLIPPING_PLANES/g,t.numClippingPlanes-t.numClipIntersection)}let nX=/^[ \t]*#include +<([\w\d./]+)>/gm;function nY(e){return e.replace(nX,nZ)}function nZ(e,t){let i=ip[t];if(void 0===i)throw Error("Can not resolve #include <"+t+">");return nY(i)}let nJ=/#pragma unroll_loop[\s]+?for \( int i \= (\d+)\; i < (\d+)\; i \+\+ \) \{([\s\S]+?)(?=\})\}/g,nK=/#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 nQ(e){return e.replace(nK,n0).replace(nJ,n$)}function n$(e,t,i,n){return console.warn("WebGLProgram: #pragma unroll_loop shader syntax is deprecated. Please use #pragma unroll_loop_start syntax instead."),n0(e,t,i,n)}function n0(e,t,i,n){let r="";for(let a=parseInt(t);a<parseInt(i);a++)r+=n.replace(/\[\s*i\s*\]/g,"[ "+a+" ]").replace(/UNROLLED_LOOP_INDEX/g,a);return r}function n1(e){let t="precision "+e.precision+" float;\nprecision "+e.precision+" int;";return"highp"===e.precision?t+="\n#define HIGH_PRECISION":"mediump"===e.precision?t+="\n#define MEDIUM_PRECISION":"lowp"===e.precision&&(t+="\n#define LOW_PRECISION"),t}function n3(e,t,i,n){var r,s;let o=e.getContext(),l=i.defines,h=i.vertexShader,c=i.fragmentShader,d,p=(d="SHADOWMAP_TYPE_BASIC",1===i.shadowMapType?d="SHADOWMAP_TYPE_PCF":i.shadowMapType===a?d="SHADOWMAP_TYPE_PCF_SOFT":3===i.shadowMapType&&(d="SHADOWMAP_TYPE_VSM"),d),f=function(e){let t="ENVMAP_TYPE_CUBE";if(e.envMap)switch(e.envMapMode){case 301:case 302:t="ENVMAP_TYPE_CUBE";break;case 306:t="ENVMAP_TYPE_CUBE_UV"}return t}(i),m,g=(m="ENVMAP_MODE_REFLECTION",i.envMap&&302===i.envMapMode&&(m="ENVMAP_MODE_REFRACTION"),m),v=function(e){let t="ENVMAP_BLENDING_NONE";if(e.envMap)switch(e.combine){case 0:t="ENVMAP_BLENDING_MULTIPLY";break;case 1:t="ENVMAP_BLENDING_MIX";break;case 2:t="ENVMAP_BLENDING_ADD"}return t}(i),_=function(e){let t=e.envMapCubeUVHeight;if(null===t)return null;let i=Math.log2(t)-2;return{texelWidth:1/(3*Math.max(Math.pow(2,i),112)),texelHeight:1/t,maxMip:i}}(i),x=i.isWebGL2?"":function(e){let t=[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":""];return t.filter(nW).join("\n")}(i),y=function(e){let t=[];for(let i in e){let n=e[i];!1!==n&&t.push("#define "+i+" "+n)}return t.join("\n")}(l),M=o.createProgram(),b,S,T=i.glslVersion?"#version "+i.glslVersion+"\n":"";i.isRawShaderMaterial?((b=[y].filter(nW).join("\n")).length>0&&(b+="\n"),(S=[x,y].filter(nW).join("\n")).length>0&&(S+="\n")):(b=[n1(i),"#define SHADER_NAME "+i.shaderName,y,i.instancing?"#define USE_INSTANCING":"",i.instancingColor?"#define USE_INSTANCING_COLOR":"",i.supportsVertexTextures?"#define VERTEX_TEXTURES":"",i.useFog&&i.fog?"#define USE_FOG":"",i.useFog&&i.fogExp2?"#define FOG_EXP2":"",i.map?"#define USE_MAP":"",i.envMap?"#define USE_ENVMAP":"",i.envMap?"#define "+g:"",i.lightMap?"#define USE_LIGHTMAP":"",i.aoMap?"#define USE_AOMAP":"",i.emissiveMap?"#define USE_EMISSIVEMAP":"",i.bumpMap?"#define USE_BUMPMAP":"",i.normalMap?"#define USE_NORMALMAP":"",i.normalMap&&i.objectSpaceNormalMap?"#define OBJECTSPACE_NORMALMAP":"",i.normalMap&&i.tangentSpaceNormalMap?"#define TANGENTSPACE_NORMALMAP":"",i.clearcoatMap?"#define USE_CLEARCOATMAP":"",i.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",i.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",i.iridescenceMap?"#define USE_IR
186IDESCENCEMAP":"",i.iridescenceThicknessMap?"#define USE_IRIDESCENCE_THICKNESSMAP":"",i.displacementMap&&i.supportsVertexTextures?"#define USE_DISPLACEMENTMAP":"",i.specularMap?"#define USE_SPECULARMAP":"",i.specularIntensityMap?"#define USE_SPECULARINTENSITYMAP":"",i.specularColorMap?"#define USE_SPECULARCOLORMAP":"",i.roughnessMap?"#define USE_ROUGHNESSMAP":"",i.metalnessMap?"#define USE_METALNESSMAP":"",i.alphaMap?"#define USE_ALPHAMAP":"",i.transmission?"#define USE_TRANSMISSION":"",i.transmissionMap?"#define USE_TRANSMISSIONMAP":"",i.thicknessMap?"#define USE_THICKNESSMAP":"",i.sheenColorMap?"#define USE_SHEENCOLORMAP":"",i.sheenRoughnessMap?"#define USE_SHEENROUGHNESSMAP":"",i.vertexTangents?"#define USE_TANGENT":"",i.vertexColors?"#define USE_COLOR":"",i.vertexAlphas?"#define USE_COLOR_ALPHA":"",i.vertexUvs?"#define USE_UV":"",i.uvsVertexOnly?"#define UVS_VERTEX_ONLY":"",i.flatShading?"#define FLAT_SHADED":"",i.skinning?"#define USE_SKINNING":"",i.morphTargets?"#define USE_MORPHTARGETS":"",i.morphNormals&&!1===i.flatShading?"#define USE_MORPHNORMALS":"",i.morphColors&&i.isWebGL2?"#define USE_MORPHCOLORS":"",i.morphTargetsCount>0&&i.isWebGL2?"#define MORPHTARGETS_TEXTURE":"",i.morphTargetsCount>0&&i.isWebGL2?"#define MORPHTARGETS_TEXTURE_STRIDE "+i.morphTextureStride:"",i.morphTargetsCount>0&&i.isWebGL2?"#define MORPHTARGETS_COUNT "+i.morphTargetsCount:"",i.doubleSided?"#define DOUBLE_SIDED":"",i.flipSided?"#define FLIP_SIDED":"",i.shadowMapEnabled?"#define USE_SHADOWMAP":"",i.shadowMapEnabled?"#define "+p:"",i.sizeAttenuation?"#define USE_SIZEATTENUATION":"",i.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",i.logarithmicDepthBuffer&&i.rendererExtensionFragDepth?"#define USE_LOGDEPTHBUF_EXT":"","uniform mat4 modelMatrix;","uniform mat4 modelViewMatrix;","uniform mat4 projectionMatrix;","uniform mat4 viewMatrix;","uniform mat3 normalMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;","#ifdef USE_INSTANCING","	attribute mat4 instanceMatrix;","#endif","#ifdef USE_INSTANCING_COLOR","	attribute vec3 instanceColor;","#endif","attribute vec3 position;","attribute vec3 normal;","attribute vec2 uv;","#ifdef USE_TANGENT","	attribute vec4 tangent;","#endif","#if defined( USE_COLOR_ALPHA )","	attribute vec4 color;","#elif defined( USE_COLOR )","	attribute vec3 color;","#endif","#if ( defined( USE_MORPHTARGETS ) && ! defined( MORPHTARGETS_TEXTURE ) )","	attribute vec3 morphTarget0;","	attribute vec3 morphTarget1;","	attribute vec3 morphTarget2;","	attribute vec3 morphTarget3;","	#ifdef USE_MORPHNORMALS","		attribute vec3 morphNormal0;","		attribute vec3 morphNormal1;","		attribute vec3 morphNormal2;","		attribute vec3 morphNormal3;","	#else","		attribute vec3 morphTarget4;","		attribute vec3 morphTarget5;","		attribute vec3 morphTarget6;","		attribute vec3 morphTarget7;","	#endif","#endif","#ifdef USE_SKINNING","	attribute vec4 skinIndex;","	attribute vec4 skinWeight;","#endif","\n"].filter(nW).join("\n"),S=[x,n1(i),"#define SHADER_NAME "+i.shaderName,y,i.useFog&&i.fog?"#define USE_FOG":"",i.useFog&&i.fogExp2?"#define FOG_EXP2":"",i.map?"#define USE_MAP":"",i.matcap?"#define USE_MATCAP":"",i.envMap?"#define USE_ENVMAP":"",i.envMap?"#define "+f:"",i.envMap?"#define "+g:"",i.envMap?"#define "+v:"",_?"#define CUBEUV_TEXEL_WIDTH "+_.texelWidth:"",_?"#define CUBEUV_TEXEL_HEIGHT "+_.texelHeight:"",_?"#define CUBEUV_MAX_MIP "+_.maxMip+".0":"",i.lightMap?"#define USE_LIGHTMAP":"",i.aoMap?"#define USE_AOMAP":"",i.emissiveMap?"#define USE_EMISSIVEMAP":"",i.bumpMap?"#define USE_BUMPMAP":"",i.normalMap?"#define USE_NORMALMAP":"",i.normalMap&&i.objectSpaceNormalMap?"#define OBJECTSPACE_NORMALMAP":"",i.normalMap&&i.tangentSpaceNormalMap?"#define TANGENTSPACE_NORMALMAP":"",i.clearcoat?"#define USE_CLEARCOAT":"",i.clearcoatMap?"#define USE_CLEARCOATMAP":"",i.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",i.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",i.iridescence?"#define USE_IRIDESCENCE":"",i.iridescenceMap?"#define USE_IRIDESCENCEMAP":"",i.iridescenceThicknessMap?"#define USE_IRIDESCENCE_THICKNESSMAP":"",i.specularMap?"#define USE_SPECULARMAP":"",i.specularIntensityMap?"#define USE_SPECULARINTENSITYMAP":"",i.specularColorMap?"#define USE_SPECULARCOLORMAP":"",i.roughnessMap?"#define USE_ROUGHNESSMAP":"",i.metalnessMap?"#define USE_METALNESSMAP":"",i.alph
186aMap?"#define USE_ALPHAMAP":"",i.alphaTest?"#define USE_ALPHATEST":"",i.sheen?"#define USE_SHEEN":"",i.sheenColorMap?"#define USE_SHEENCOLORMAP":"",i.sheenRoughnessMap?"#define USE_SHEENROUGHNESSMAP":"",i.transmission?"#define USE_TRANSMISSION":"",i.transmissionMap?"#define USE_TRANSMISSIONMAP":"",i.thicknessMap?"#define USE_THICKNESSMAP":"",i.decodeVideoTexture?"#define DECODE_VIDEO_TEXTURE":"",i.vertexTangents?"#define USE_TANGENT":"",i.vertexColors||i.instancingColor?"#define USE_COLOR":"",i.vertexAlphas?"#define USE_COLOR_ALPHA":"",i.vertexUvs?"#define USE_UV":"",i.uvsVertexOnly?"#define UVS_VERTEX_ONLY":"",i.gradientMap?"#define USE_GRADIENTMAP":"",i.flatShading?"#define FLAT_SHADED":"",i.doubleSided?"#define DOUBLE_SIDED":"",i.flipSided?"#define FLIP_SIDED":"",i.shadowMapEnabled?"#define USE_SHADOWMAP":"",i.shadowMapEnabled?"#define "+p:"",i.premultipliedAlpha?"#define PREMULTIPLIED_ALPHA":"",i.physicallyCorrectLights?"#define PHYSICALLY_CORRECT_LIGHTS":"",i.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",i.logarithmicDepthBuffer&&i.rendererExtensionFragDepth?"#define USE_LOGDEPTHBUF_EXT":"","uniform mat4 viewMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;",0!==i.toneMapping?"#define TONE_MAPPING":"",0!==i.toneMapping?ip.tonemapping_pars_fragment:"",0!==i.toneMapping?function(e,t){let i;switch(t){case 1:i="Linear";break;case 2:i="Reinhard";break;case u:i="OptimizedCineon";break;case 4:i="ACESFilmic";break;case 5:i="Custom";break;default:console.warn("THREE.WebGLProgram: Unsupported toneMapping:",t),i="Linear"}return"vec3 "+e+"( vec3 color ) { return "+i+"ToneMapping( color ); }"}("toneMapping",i.toneMapping):"",i.dithering?"#define DITHERING":"",i.opaque?"#define OPAQUE":"",ip.encodings_pars_fragment,function(e,t){let i=function(e){switch(e){case 3e3:return["Linear","( value )"];case w:return["sRGB","( value )"];default:return console.warn("THREE.WebGLProgram: Unsupported encoding:",e),["Linear","( value )"]}}(t);return"vec4 "+e+"( vec4 value ) { return LinearTo"+i[0]+i[1]+"; }"}("linearToOutputTexel",i.outputEncoding),i.useDepthPacking?"#define DEPTH_PACKING "+i.depthPacking:"","\n"].filter(nW).join("\n")),h=nq(h=nj(h=nY(h),i),i),c=nq(c=nj(c=nY(c),i),i),h=nQ(h),c=nQ(c),i.isWebGL2&&!0!==i.isRawShaderMaterial&&(T="#version 300 es\n",b="precision mediump sampler2DArray;\n#define attribute in\n#define varying out\n#define texture2D texture\n"+b,S=["#define varying in",i.glslVersion===L?"":"layout(location = 0) out highp vec4 pc_fragColor;",i.glslVersion===L?"":"#define gl_FragColor pc_fragColor","#define gl_FragDepthEXT gl_FragDepth","#define texture2D texture","#define textureCube texture","#define texture2DProj textureProj","#define texture2DLodEXT textureLod","#define texture2DProjLodEXT textureProjLod","#define textureCubeLodEXT textureLod","#define texture2DGradEXT textureGrad","#define texture2DProjGradEXT textureProjGrad","#define textureCubeGradEXT textureGrad"].join("\n")+"\n"+S);let E=T+b+h,A=T+S+c,C=nV(o,35633,E),P=nV(o,35632,A);if(o.attachShader(M,C),o.attachShader(M,P),void 0!==i.index0AttributeName?o.bindAttribLocation(M,0,i.index0AttributeName):!0===i.morphTargets&&o.bindAttribLocation(M,0,"position"),o.linkProgram(M),e.debug.checkShaderErrors){let R=o.getProgramInfoLog(M).trim(),D=o.getShaderInfoLog(C).trim(),I=o.getShaderInfoLog(P).trim(),N=!0,O=!0;if(!1===o.getProgramParameter(M,35714)){N=!1;let z=nH(o,C,"vertex"),U=nH(o,P,"fragment");console.error("THREE.WebGLProgram: Shader Error "+o.getError()+" - VALIDATE_STATUS "+o.getProgramParameter(M,35715)+"\n\nProgram Info Log: "+R+"\n"+z+"\n"+U)}else""!==R?console.warn("THREE.WebGLProgram: Program Info Log:",R):(""===D||""===I)&&(O=!1);O&&(this.diagnostics={runnable:N,programLog:R,vertexShader:{log:D,prefix:b},fragmentShader:{log:I,prefix:S}})}o.deleteShader(C),o.deleteShader(P);let F;this.getUniforms=function(){return void 0===F&&(F=new nk(o,M)),F};let B;return this.getAttributes=function(){return void 0===B&&(B=function(e,t){let i={},n=e.getProgramParameter(t,35721);for(let r=0;r<n;r++){let a=e.getActiveAttrib(t,r),s=a.name,o=1;35674===a.type&&(o=2),35675===a.type&&(o=3),35676===a.type&&(o=4),i[s]={type:a.type,location:e.getAttribLocation(t,s),locationSize:o}}return i}(o,M)),B},this.destroy=function(){n.releaseStatesOfProgram(this),o.deleteProgram(M),this.program=void 0},this.name=i.shaderName,this.id=nG++,this.cacheKey=t,this.usedTimes=1,this.program=M,this.vertexShader=C,this.fragmentShader=P,this}let n2=0;class n4{constructor(){this.shaderCache=new Map,this.materialCache=new Map}update(e){let t=e.vertexShader,i=e.fragmentShader,n=this._getShaderStage(t),r=this._getShaderStage(i),a=this._getShaderCacheForMaterial(e);return!1===a.has(n)&&(a.add(n),n.usedTimes++),!1===a.has(r)&&(a.add(r),r.usedTimes++),this}remove(e){let t=this.materialCache.get(e);for(let i of t)i.usedTimes--,0===i.usedTimes&&this.shaderCache.delete(i.code);return this.materialCache.delete(e),this}getVertexShaderID(e){return this._getShaderStage(e.vertexShader).id}getFragmentShaderID(e){return this._getShaderStage(e.fragmentShader).id}dispose(){this.shaderCache.clear(),this.materialCache.clear()}_getShaderCacheForMaterial(e){let t=this.materialCache;return!1===t.has(e)&&t.set(e,new Set),t.get(e)}_getShaderStage(e){let t=this.shaderCache;if(!1===t.has(e)){let i=new n5(e);t.set(e,i)}return t.get(e)}}class n5{constructor(e){this.id=n2++,this.code=e,this.usedTimes=0}}function n6(e,t,i,n,r,a,s){let h=new e4,u=new n4,c=[],d=r.isWebGL2,p=r.logarithmicDepthBuffer,f=r.vertexTextures,m=r.precision,g={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,h,c,v,_){let x=v.fog,y=_.geometry,M=a.isMeshStandardMaterial?v.environment:null,b=(a.isMeshStandardMaterial?i:t).get(a.envMap||M),S=b&&306===b.mapping?b.image.height:null,T=g[a.type];null!==a.precision&&(m=r.getMaxPrecision(a.precision))!==a.precision&&console.warn("THREE.WebGLProgram.getParameters:",a.precision,"not supported, using",m,"instead.");let A=y.morphAttributes.position||y.morphAttributes.normal||y.morphAttributes.color,C=void 0!==A?A.length:0,L=0;void 0!==y.morphAttributes.position&&(L=1),void 0!==y.morphAttributes.normal&&(L=2),void 0!==y.morphAttributes.color&&(L=3);let P,R,D,I;if(T){let N=ig[T];P=N.vertexShader,R=N.fragmentShader}else P=a.vertexShader,R=a.fragmentShader,u.update(a),D=u.getVertexShaderID(a),I=u.getFragmentShaderID(a);let O=e.getRenderTarget(),z=a.alphaTest>0,U=a.clearcoat>0,F=a.iridescence>0,B={isWebGL2:d,shaderID:T,shaderName:a.type,vertexShader:P,fragmentShader:R,defines:a.defines,customVertexShaderID:D,customFragmentShaderID:I,isRawShaderMaterial:!0===a.isRawShaderMaterial,glslVersion:a.glslVersion,precision:m,instancing:!0===_.isInstancedMesh,instancingColor:!0===_.isInstancedMesh&&null!==_.instanceColor,supportsVertexTextures:f,outputEncoding:null===O?e.outputEncoding:!0===O.isXRRenderTarget?O.texture.encoding:3e3,map:!!a.map,matcap:!!a.matcap,envMap:!!b,envMapMode:b&&b.mapping,envMapCubeUVHeight:S,lightMap:!!a.lightMap,aoMap:!!a.aoMap,emissiveMap:!!a.emissiveMap,bumpMap:!!a.bumpMap,normalMap:!!a.normalMap,objectSpaceNormalMap:1===a.normalMapType,tangentSpaceNormalMap:a.normalMapType===E,decodeVideoTexture:!!a.map&&!0===a.map.isVideoTexture&&a.map.encoding===w,clearcoat:U,clearcoatMap:U&&!!a.clearcoatMap,clearcoatRoughnessMap:U&&!!a.clearcoatRoughnessMap,clearcoatNormalMap:U&&!!a.clearcoatNormalMap,iridescence:F,iridescenceMap:F&&!!a.iridescenceMap,iridescenceThicknessMap:F&&!!a.iridescenceThicknessMap,displacementMap:!!a.displacementMap,roughnessMap:!!a.roughnessMap,metalnessMap:!!a.metalnessMap,specularMap:!!a.specularMap,specularIntensityMap:!!a.specularIntensityMap,specularColorMap:!!a.specularColorMap,opaque:!1===a.transparent&&1===a.blending,alphaMap:!!a.alphaMap,alphaTest:z,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:!!x,useFog:!0===a.fog,fogExp2:x&&x.isFogExp2,flatShading:!!a.flatShading,sizeAttenuation:a.sizeAttenuation,logarithmicDepthBuffer:p,skinning:!0===_.isSkinnedMesh,morphTargets:void 0!==y.morphAttributes.position,morphNormals:void 0!==y.morphAttributes.normal,morphColors:void 0!==y.morphAttributes.color,morphTargetsCount:C,morphTextureStride:L,numDirLights:h.directional.length,numPointLights:h.point.length,numSpotLights:h.spot.length,numRectAreaLights:h.rectArea.length,numHemiLights:h.hemi.length,numDirLightShadows:h.directionalShadowMap.length,numPointLightShadows:h.pointShadowMap.length,numSpotLightShadows:h.spotShadowMap.length,numClippingPlanes:s.numPlanes,numClipIntersection:s.numIntersection,dithering:a.dithering,shadowMapEnabled:e.shadowMap.enabled&&c.length>0,shadowMapType:e.shadowMap.type,toneMapping:a.toneMapped?e.toneMapping:0,physicallyCorrectLights:e.physicallyCorrectLights,premultipliedAlpha:a.premultipliedAlpha,doubleSided:a.side===l,flipSided:a.side===o,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:d||n.has("EXT_frag_depth"),rendererExtensionDrawBuffers:d||n.has("WEBGL_draw_buffers"),rendererExtensionShaderTextureLod:d||n.has("EXT_shader_texture_lod"),customProgramCacheKey:a.customProgramCacheKey()};return B},getProgramCacheKey:function(t){var i,n,r,a;let s=[];if(t.shaderID?s.push(t.shaderID):(s.push(t.customVertexShaderID),s.push(t.customFragmentShaderID)),void 0!==t.defines)for(let o in t.defines)s.push(o),s.push(t.defines[o]);return!1===t.isRawShaderMaterial&&(i=s,n=t,i.push(n.precision),i.push(n.outputEncoding),i.push(n.envMapMode),i.push(n.envMapCubeUVHeight),i.push(n.combine),i.push(n.vertexUvs),i.push(n.fogExp2),i.push(n.sizeAttenuation),i.push(n.morphTargetsCount),i.push(n.morphAttributeCount),i.push(n.numDirLights),i.push(n.numPointLights),i.push(n.numSpotLights),i.push(n.numHemiLights),i.push(n.numRectAreaLights),i.push(n.numDirLightShadows),i.push(n.numPointLightShadows),i.push(n.numSpotLightShadows),i.push(n.shadowMapType),i.push(n.toneMapping),i.push(n.numClippingPlanes),i.push(n.numClipIntersection),i.push(n.depthPacking),r=s,a=t,h.disableAll(),a.isWebG
186L2&&h.enable(0),a.supportsVertexTextures&&h.enable(1),a.instancing&&h.enable(2),a.instancingColor&&h.enable(3),a.map&&h.enable(4),a.matcap&&h.enable(5),a.envMap&&h.enable(6),a.lightMap&&h.enable(7),a.aoMap&&h.enable(8),a.emissiveMap&&h.enable(9),a.bumpMap&&h.enable(10),a.normalMap&&h.enable(11),a.objectSpaceNormalMap&&h.enable(12),a.tangentSpaceNormalMap&&h.enable(13),a.clearcoat&&h.enable(14),a.clearcoatMap&&h.enable(15),a.clearcoatRoughnessMap&&h.enable(16),a.clearcoatNormalMap&&h.enable(17),a.iridescence&&h.enable(18),a.iridescenceMap&&h.enable(19),a.iridescenceThicknessMap&&h.enable(20),a.displacementMap&&h.enable(21),a.specularMap&&h.enable(22),a.roughnessMap&&h.enable(23),a.metalnessMap&&h.enable(24),a.gradientMap&&h.enable(25),a.alphaMap&&h.enable(26),a.alphaTest&&h.enable(27),a.vertexColors&&h.enable(28),a.vertexAlphas&&h.enable(29),a.vertexUvs&&h.enable(30),a.vertexTangents&&h.enable(31),a.uvsVertexOnly&&h.enable(32),a.fog&&h.enable(33),r.push(h.mask),h.disableAll(),a.useFog&&h.enable(0),a.flatShading&&h.enable(1),a.logarithmicDepthBuffer&&h.enable(2),a.skinning&&h.enable(3),a.morphTargets&&h.enable(4),a.morphNormals&&h.enable(5),a.morphColors&&h.enable(6),a.premultipliedAlpha&&h.enable(7),a.shadowMapEnabled&&h.enable(8),a.physicallyCorrectLights&&h.enable(9),a.doubleSided&&h.enable(10),a.flipSided&&h.enable(11),a.useDepthPacking&&h.enable(12),a.dithering&&h.enable(13),a.specularIntensityMap&&h.enable(14),a.specularColorMap&&h.enable(15),a.transmission&&h.enable(16),a.transmissionMap&&h.enable(17),a.thicknessMap&&h.enable(18),a.sheen&&h.enable(19),a.sheenColorMap&&h.enable(20),a.sheenRoughnessMap&&h.enable(21),a.decodeVideoTexture&&h.enable(22),a.opaque&&h.enable(23),r.push(h.mask),s.push(e.outputEncoding)),s.push(t.customProgramCacheKey),s.join()},getUniforms:function(e){let t=g[e.type],i;if(t){let n=ig[t];i=t5.clone(n.uniforms)}else i=e.uniforms;return i},acquireProgram:function(t,i){let n;for(let r=0,s=c.length;r<s;r++){let o=c[r];
186if(o.cacheKey===i){n=o,++n.usedTimes;break}}return void 0===n&&(n=new n3(e,i,t,a),c.push(n)),n},releaseProgram:function(e){if(0==--e.usedTimes){let t=c.indexOf(e);c[t]=c[c.length-1],c.pop(),e.destroy()}},releaseShaderCache:function(e){u.remove(e)},programs:c,dispose:function(){u.dispose()}}}function n7(){let e=new WeakMap;return{get:function(t){let i=e.get(t);return void 0===i&&(i={},e.set(t,i)),i},remove:function(t){e.delete(t)},update:function(t,i,n){e.get(t)[i]=n},dispose:function(){e=new WeakMap}}}function n8(e,t){return e.groupOrder!==t.groupOrder?e.groupOrder-t.groupOrder:e.renderOrder!==t.renderOrder?e.renderOrder-t.renderOrder:e.material.id!==t.material.id?e.material.id-t.material.id:e.z!==t.z?e.z-t.z:e.id-t.id}function n9(e,t){return e.groupOrder!==t.groupOrder?e.groupOrder-t.groupOrder:e.renderOrder!==t.renderOrder?e.renderOrder-t.renderOrder:e.z!==t.z?t.z-e.z:e.id-t.id}function re(){let e=[],t=0,i=[],n=[],r=[];function a(i,n,r,a,s,o){let l=e[t];return void 0===l?(l={id:i.id,object:i,geometry:n,material:r,groupOrder:a,renderOrder:i.renderOrder,z:s,group:o},e[t]=l):(l.id=i.id,l.object=i,l.geometry=n,l.material=r,l.groupOrder=a,l.renderOrder=i.renderOrder,l.z=s,l.group=o),t++,l}return{opaque:i,transmissive:n,transparent:r,init:function(){t=0,i.length=0,n.length=0,r.length=0},push:function(e,t,s,o,l,h){let u=a(e,t,s,o,l,h);s.transmission>0?n.push(u):!0===s.transparent?r.push(u):i.push(u)},unshift:function(e,t,s,o,l,h){let u=a(e,t,s,o,l,h);s.transmission>0?n.unshift(u):!0===s.transparent?r.unshift(u):i.unshift(u)},finish:function(){for(let i=t,n=e.length;i<n;i++){let r=e[i];if(null===r.id)break;r.id=null,r.object=null,r.geometry=null,r.material=null,r.group=null}},sort:function(e,t){i.length>1&&i.sort(e||n8),n.length>1&&n.sort(t||n9),r.length>1&&r.sort(t||n9)}}}function rt(){let e=new WeakMap;return{get:function(t,i){let n;return!1===e.has(t)?(n=new re,e.set(t,[n])):i>=e.get(t).length?(n=new re,e.get(t).push(n)):n=e.get(t)[i],n},dispose:function(){e=new WeakMap}}}function ri(){let e={};return{get:function(t){if(void 0!==e[t.id])return e[t.id];let i;switch(t.type){case"DirectionalLight":i={direction:new eg,color:new ea};break;case"SpotLight":i={position:new eg,direction:new eg,color:new ea,distance:0,coneCos:0,penumbraCos:0,decay:0};break;case"PointLight":i={position:new eg,color:new ea,distance:0,decay:0};break;case"HemisphereLight":i={direction:new eg,skyColor:new ea,groundColor:new ea};break;case"RectAreaLight":i={color:new ea,position:new eg,halfWidth:new eg,halfHeight:new eg}}return e[t.id]=i,i}}}let rn=0;function rr(e,t){return(t.castShadow?1:0)-(e.castShadow?1:0)}function ra(e,t){let i=new ri,n=function(){let e={};return{get:function(t){if(void 0!==e[t.id])return e[t.id];let i;switch(t.type){case"DirectionalLight":case"SpotLight":i={shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new j};break;case"PointLight":i={shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new j,shadowCameraNear:1,shadowCameraFar:1e3}}return e[t.id]=i,i}}}(),r={version:0,hash:{directionalLength:-1,pointLength:-1,spotLength:-1,rectAreaLength:-1,hemiLength:-1,numDirectionalShadows:-1,numPointShadows:-1,numSpotShadows:-1},ambient:[0,0,0],probe:[],directional:[],directionalShadow:[],directionalShadowMap:[],directionalShadowMatrix:[],spot:[],spotShadow:[],spotShadowMap:[],spotShadowMatrix:[],rectArea:[],rectAreaLTC1:null,rectAreaLTC2:null,point:[],pointShadow:[],pointShadowMap:[],pointShadowMatrix:[],hemi:[]};for(let a=0;a<9;a++)r.probe.push(new eg);let s=new eg,o=new eX,l=new eX;return{setup:function(a,s){let o=0,l=0,h=0;for(let u=0;u<9;u++)r.probe[u].set(0,0,0);let c=0,d=0,p=0,f=0,m=0,g=0,v=0,_=0;a.sort(rr);let x=!0!==s?Math.PI:1;for(let y=0,M=a.length;y<M;y++){let b=a[y],S=b.color,w=b.intensity,T=b.distance,E=b.shadow&&b.shadow.map?b.shadow.map.texture:null;if(b.isAmbientLight)o+=S.r*w*x,l+=S.g*w*x,h+=S.b*w*x;else if(b.isLightProbe)for(let A=0;A<9;A++)r.probe[A].addScaledVector(b.sh.coefficients[A],w);else if(b.isDirectionalLight){let C=i.get(b);if(C.color.copy(b.color).multiplyScalar(b.intensity*x),b.castShadow){let L=b.shadow,P=n.get(b);P.shadowBias=L.bias,P.shadowNormalBias=L.normalBias,P.shadowRadius=L.radius,P.shadowMapSize=L.mapSize,r.directionalShadow[c]=P,r.directionalShadowMap[c]=E,r.directionalShadowMatrix[c]=b.shadow.matrix,g++}r.directional[c]=C,c++}else if(b.isSpotLight){let R=i.get(b);if(R.position.setFromMatrixPosition(b.matrixWorld),R.color.copy(S).multiplyScalar(w*x),R.distance=T,R.coneCos=Math.cos(b.angle),R.penumbraCos=Math.cos(b.angle*(1-b.penumbra)),R.decay=b.decay,b.castShadow){let D=b.shadow,I=n.get(b);I.shadowBias=D.bias,I.shadowNormalBias=D.normalBias,I.shadowRadius=D.radius,I.shadowMapSize=D.mapSize,r.spotShadow[p]=I,r.spotShadowMap[p]=E,r.spotShadowMatrix[p]=b.shadow.matrix,_++}r.spot[p]=R,p++}else if(b.isRectAreaLight){let N=i.get(b);N.color.copy(S).multiplyScalar(w),N.halfWidth.set(.5*b.width,0,0),N.halfHeight.set(0,.5*b.height,0),r.rectArea[f]=N,f++}else if(b.isPointLight){let O=i.get(b);if(O.color.copy(b.color).multiplyScalar(b.intensity*x),O.distance=b.distance,O.decay=b.decay,b.castShadow){let z=b.shadow,U=n.get(b);U.shadowBias=z.bias,U.shadowNormalBias=z.normalBias,U.shadowRadius=z.radius,U.shadowMapSize=z.mapSize,U.shadowCameraNear=z.camera.near,U.shadowCameraFar=z.camera.far,r.pointShadow[d]=U,r.pointShadowMap[d]=E,r.pointShadowMatrix[d]=b.shadow.matrix,v++}r.point[d]=O,d++}else if(b.isHemisphereLight){let F=i.get(b);F.skyColor.copy(b.color).multiplyScalar(w*x),F.groundColor.copy(b.groundColor).multiplyScalar(w*x),r.hemi[m]=F,m++}}f>0&&(t.isWebGL2?(r.rectAreaLTC1=im.LTC_FLOAT_1,r.rectAreaLTC2=im.LTC_FLOAT_2):!0===e.has("OES_texture_float_linear")?(r.rectAreaLTC1=im.LTC_FLOAT_1,r.rectAreaLTC2=im.LTC_FLOAT_2):!0===e.has("OES_texture_half_float_linear")?(r.rectAreaLTC1=im.LTC_HA
186LF_1,r.rectAreaLTC2=im.LTC_HALF_2):console.error("THREE.WebGLRenderer: Unable to use RectAreaLight. Missing WebGL extensions.")),r.ambient[0]=o,r.ambient[1]=l,r.ambient[2]=h;let B=r.hash;(B.directionalLength!==c||B.pointLength!==d||B.spotLength!==p||B.rectAreaLength!==f||B.hemiLength!==m||B.numDirectionalShadows!==g||B.numPointShadows!==v||B.numSpotShadows!==_)&&(r.directional.length=c,r.spot.length=p,r.rectArea.length=f,r.point.length=d,r.hemi.length=m,r.directionalShadow.length=g,r.directionalShadowMap.length=g,r.pointShadow.length=v,r.pointShadowMap.length=v,r.spotShadow.length=_,r.spotShadowMap.length=_,r.directionalShadowMatrix.length=g,r.pointShadowMatrix.length=v,r.spotShadowMatrix.length=_,B.directionalLength=c,B.pointLength=d,B.spotLength=p,B.rectAreaLength=f,B.hemiLength=m,B.numDirectionalShadows=g,B.numPointShadows=v,B.numSpotShadows=_,r.version=rn++)},setupView:function(e,t){let i=0,n=0,a=0,h=0,u=0,c=t.matrixWorldInverse;for(let d=0,p=e.length;d<p;d++){let f=e[d];if(f.isDirectionalLight){let m=r.directional[i];m.direction.setFromMatrixPosition(f.matrixWorld),s.setFromMatrixPosition(f.target.matrixWorld),m.direction.sub(s),m.direction.transformDirection(c),i++}else if(f.isSpotLight){let g=r.spot[a];g.position.setFromMatrixPosition(f.matrixWorld),g.position.applyMatrix4(c),g.direction.setFromMatrixPosition(f.matrixWorld),s.setFromMatrixPosition(f.target.matrixWorld),g.direction.sub(s),g.direction.transformDirection(c),a++}else if(f.isRectAreaLight){let v=r.rectArea[h];v.position.setFromMatrixPosition(f.matrixWorld),v.position.applyMatrix4(c),l.identity(),o.copy(f.matrixWorld),o.premultiply(c),l.extractRotation(o),v.halfWidth.set(.5*f.width,0,0),v.halfHeight.set(0,.5*f.height,0),v.halfWidth.applyMatrix4(l),v.halfHeight.applyMatrix4(l),h++}else if(f.isPointLight){let _=r.point[n];_.position.setFromMatrixPosition(f.matrixWorld),_.position.applyMatrix4(c),n++}else if(f.isHemisphereLight){let x=r.hemi[u];x.direction.setFromMatrixPosition(f.matrixWorld),x.direction.transformDirection(c),u++}}},state:r}}function rs(e,t){let i=new ra(e,t),n=[],r=[];return{init:function(){n.length=0,r.length=0},state:{lightsArray:n,shadowsArray:r,lights:i},setupLights:function(e){i.setup(n,e)},setupLightsView:function(e){i.setupView(n,e)},pushLight:function(e){n.push(e)},pushShadow:function(e){r.push(e)}}}function ro(e,t){let i=new WeakMap;return{get:function(n,r=0){let a;return!1===i.has(n)?(a=new rs(e,t),i.set(n,[a])):r>=i.get(n).length?(a=new rs(e,t),i.get(n).push(a)):a=i.get(n)[r],a},dispose:function(){i=new WeakMap}}}class rl extends tM{constructor(e){super(),this.isMeshDepthMaterial=!0,this.type="MeshDepthMaterial",this.depthPacking=3200,this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.wireframe=!1,this.wireframeLinewidth=1,this.setValues(e)}copy(e){return super.copy(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}}class rh extends tM{constructor(e){super(),this.isMeshDistanceMaterial=!0,this.type="MeshDistanceMaterial",this.referencePosition=new eg,this.nearDistance=1,this.farDistance=1e3,this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.setValues(e)}copy(e){return super.copy(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}}function ru(e,t,i){let n=new ih,r=new j,a=new j,h=new ed,u=new rl({depthPacking:T}),c=new rh,d={},p=i.maxTextureSize,m={0:o,1:s,2:l},g=new t6({defines:{VSM_SAMPLES:8},uniforms:{shadow_pass:{value:null},resolution:{value:new j},radius:{value:4}},vertexShader:"void main() {\n	gl_Position = vec4( position, 1.0 );\n}",fragmentShader:"uniform sampler2D shadow_pass;\nuniform vec2 resolution;\nuniform float radius;\n#include <packing>
186\nvoid main() {\n	const float samples = float( VSM_SAMPLES );\n	float mean = 0.0;\n	float squared_mean = 0.0;\n	float uvStride = samples <= 1.0 ? 0.0 : 2.0 / ( samples - 1.0 );\n	float uvStart = samples <= 1.0 ? 0.0 : - 1.0;\n	for ( float i = 0.0; i < samples; i ++ ) {\n		float uvOffset = uvStart + i * uvStride;\n		#ifdef HORIZONTAL_PASS\n			vec2 distribution = unpackRGBATo2Half( texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( uvOffset, 0.0 ) * radius ) / resolution ) );\n			mean += distribution.x;\n			squared_mean += distribution.y * distribution.y + distribution.x * distribution.x;\n		#else\n			float depth = unpackRGBAToDepth( texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( 0.0, uvOffset ) * radius ) / resolution ) );\n			mean += depth;\n			squared_mean += depth * depth;\n		#endif\n	}\n	mean = mean / samples;\n	squared_mean = squared_mean / samples;\n	float std_dev = sqrt( squared_mean - mean * mean );\n	gl_FragColor = pack2HalfToRGBA( vec2( mean, std_dev ) );\n}"}),v=g.clone();v.defines.HORIZONTAL_PASS=1;let _=new tz;_.setAttribute("position",new tT(new Float32Array([-1,-1,.5,3,-1,.5,-1,3,.5]),3));let x=new t0(_,g),y=this;function M(i,n){let a=t.update(x);g.defines.VSM_SAMPLES!==i.blurSamples&&(g.defines.VSM_SAMPLES=i.blurSamples,v.defines.VSM_SAMPLES=i.blurSamples,g.needsUpdate=!0,v.needsUpdate=!0),null===i.mapPass&&(i.mapPass=new ep(r.x,r.y)),g.uniforms.shadow_pass.value=i.map.texture,g.uniforms.resolution.value=i.mapSize,g.uniforms.radius.value=i.radius,e.setRenderTarget(i.mapPass),e.clear(),e.renderBufferDirect(n,null,a,g,x,null),v.uniforms.shadow_pass.value=i.mapPass.texture,v.uniforms.resolution.value=i.mapSize,v.uniforms.radius.value=i.radius,e.setRenderTarget(i.map),e.clear(),e.renderBufferDirect(n,null,a,v,x,null)}function b(t,i,n,r,a,s){let o=null,l=!0===n.isPointLight?t.customDistanceMaterial:t.customDepthMaterial;if(o=void 0!==l?l:!0===n.isPointLight?c:u,e.localClippingEnabled&&!0===i.clipShadows&&Array.isArray(i.clippingPlanes)&&0!==i.clippingPlanes.length||i.displacementMap&&0!==i.displacementScale||i.alphaMap&&i.alphaTest>0){let h=o.uuid,p=i.uuid,f=d[h];void 0===f&&(f={},d[h]=f);let g=f[p];void 0===g&&(g=o.clone(),f[p]=g),o=g}return o.visible=i.visible,o.wireframe=i.wireframe,3===s?o.side=null!==i.shadowSide?i.shadowSide:i.side:o.side=null!==i.shadowSide?i.shadowSide:m[i.side],o.alphaMap=i.alphaMap,o.alphaTest=i.alphaTest,o.clipShadows=i.clipShadows,o.clippingPlanes=i.clippingPlanes,o.clipIntersection=i.clipIntersection,o.displacementMap=i.displacementMap,o.displacementScale=i.displacementScale,o.displacementBias=i.displacementBias,o.wireframeLinewidth=i.wireframeLinewidth,o.linewidth=i.linewidth,!0===n.isPointLight&&!0===o.isMeshDistanceMaterial&&(o.referencePosition.setFromMatrixPosition(n.matrixWorld),o.nearDistance=r,o.farDistance=a),o}function S(i,r,a,s,o){if(!1===i.visible)return;let l=i.layers.test(r.layers);if(l&&(i.isMesh||i.isLine||i.isPoints)&&(i.castShadow||i.receiveShadow&&3===o)&&(!i.frustumCulled||n.intersectsObject(i))){i.modelViewMatrix.multiplyMatrices(a.matrixWorldInverse,i.matrixWorld);let h=t.update(i),u=i.material;if(Array.isArray(u)){let c=h.groups;for(let d=0,p=c.length;d<p;d++){let f=c[d],m=u[f.materialIndex];if(m&&m.visible){let g=b(i,m,s,a.near,a.far,o);e.renderBufferDirect(a,null,h,g,i,f)}}}else if(u.visible){let v=b(i,u,s,a.near,a.far,o);e.renderBufferDirect(a,null,h,v,i,null)}}let _=i.children;for(let x=0,y=_.length;x<y;x++)S(_[x],r,a,s,o)}this.enabled=!1,this.autoUpdate=!0,this.needsUpdate=!1,this.type=1,this.render=function(t,i,s){if(!1===y.enabled||!1===y.autoUpdate&&!1===y.needsUpdate||0===t.length)return;let o=e.getRenderTarget(),l=e.getActiveCubeFace(),u=e.getActiveMipmapLevel(),c=e.state;c.setBlending(0),c.buffers.color.setClear(1,1,1,1),c.buffers.depth.setTest(!0),c.setScissorTest(!1);for(let d=0,m=t.length;d<m;d++){let g=t[d],v=g.shadow;if(void 0===v){console.warn("THREE.WebGLShadowMap:",g,"has no shadow.");continue}if(!1===v.autoUpdate&&!1===v.needsUpdate)continue;r.copy(v.mapSize);let _=v.getFrameExtents();if(r.multiply(_),a.copy(v.mapSize),(r.x>p||r.y>p)&&(r.x>p&&(a.x=Math.floor(p/_.x),r.x=a.x*_.x,v.mapSize.x=a.x),r.y>p&&(a.y=Math.floor(p/_.y),r.y=a.y*_.y,v.mapSize.y=a.y)),null===v.map){let x=3!==this.type?{minFilter:f,magFilter:f}:{};v.map=new ep(r.x,r.y,x),v.map.texture.name=g.name+".shadowMap",v.camera.updateProjectionMatrix()}
186e.setRenderTarget(v.map),e.clear();let b=v.getViewportCount();for(let w=0;w<b;w++){let T=v.getViewport(w);h.set(a.x*T.x,a.y*T.y,a.x*T.z,a.y*T.w),c.viewport(h),v.updateMatrices(g,w),n=v.getFrustum(),S(i,s,v.camera,g,this.type)}!0!==v.isPointLightShadow&&3===this.type&&M(v,s),v.needsUpdate=!1}y.needsUpdate=!1,e.setRenderTarget(o,l,u)}}function rc(e,t,i){let n=i.isWebGL2,r=new function(){let t=!1,i=new ed,n=null,r=new ed(0,0,0,0);return{setMask:function(i){n===i||t||(e.colorMask(i,i,i,i),n=i)},setLocked:function(e){t=e},setClear:function(t,n,a,s,o){!0===o&&(t*=s,n*=s,a*=s),i.set(t,n,a,s),!1===r.equals(i)&&(e.clearColor(t,n,a,s),r.copy(i))},reset:function(){t=!1,n=null,r.set(-1,0,0,0)}}},a=new function(){let t=!1,i=null,n=null,r=null;return{setTest:function(e){e?H(2929):W(2929)},setMask:function(n){i===n||t||(e.depthMask(n),i=n)},setFunc:function(t){if(n!==t){if(t)switch(t){case 0:e.depthFunc(512);break;case 1:e.depthFunc(519);break;case 2:e.depthFunc(513);break;case 3:default:e.depthFunc(515);break;case 4:e.depthFunc(514);break;case 5:e.depthFunc(518);break;case 6:e.depthFunc(516);break;case 7:e.depthFunc(517)}else e.depthFunc(515);n=t}},setLocked:function(e){t=e},setClear:function(t){r!==t&&(e.clearDepth(t),r=t)},reset:function(){t=!1,i=null,n=null,r=null}}},s=new function(){let t=!1,i=null,n=null,r=null,a=null,s=null,o=null,l=null,h=null;return{setTest:function(e){t||(e?H(2960):W(2960))},setMask:function(n){i===n||t||(e.stencilMask(n),i=n)},setFunc:function(t,i,s){(n!==t||r!==i||a!==s)&&(e.stencilFunc(t,i,s),n=t,r=i,a=s)},setOp:function(t,i,n){(s!==t||o!==i||l!==n)&&(e.stencilOp(t,i,n),s=t,o=i,l=n)},setLocked:function(e){t=e},setClear:function(t){h!==t&&(e.clearStencil(t),h=t)},reset:function(){t=!1,i=null,n=null,r=null,a=null,s=null,o=null,l=null,h=null}}},u=new WeakMap,c=new WeakMap,d={},p={},f=new WeakMap,m=[],g=null,v=!1,_=null,x=null,y=null,M=null,b=null,S=null,w=null,T=!1,E=null,A=null,C=null,L=null,P=null,R=e.getParameter(35661),D=!1,I=0,N=e.getParameter(7938);-1!==N.indexOf("WebGL")?D=parseFloat(/^WebGL (\d)/.exec(N)[1])>=1:-1!==N.indexOf("OpenGL ES")&&(D=parseFloat(/^OpenGL ES (\d)/.exec(N)[1])>=2);let O=null,z={},U=e.getParameter(3088),F=e.getParameter(2978),B=new ed().fromArray(U),k=new ed().fromArray(F);function V(t,i,n){let r=new Uint8Array(4),a=e.createTexture();e.bindTexture(t,a),e.texParameteri(t,10241,9728),e.texParameteri(t,10240,9728);for(let s=0;s<n;s++)e.texImage2D(i+s,0,6408,1,1,0,6408,5121,r);return a}let G={};function H(t){!0!==d[t]&&(e.enable(t),d[t]=!0)}function W(t){!1!==d[t]&&(e.disable(t),d[t]=!1)}G[3553]=V(3553,3553,1),G[34067]=V(34067,34069,6),r.setClear(0,0,0,1),a.setClear(1),s.setClear(0),H(2929),a.setFunc(3),Z(!1),J(1),H(2884),Y(0);let j={100:32774,101:32778,102:32779};if(n)j[103]=32775,j[104]=32776;else{let q=t.get("EXT_blend_minmax");null!==q&&(j[103]=q.MIN_EXT,j[104]=q.MAX_EXT)}let X={200:0,201:1,202:768,204:770,210:776,208:774,206:772,203:769,205:771,209:775,207:773};function Y(t,i,n,r,a,s,o,l){if(0===t){!0===v&&(W(3042),v=!1);return}if(!1===v&&(H(3042),v=!0),5!==t){if(t!==_||l!==T){if((100!==x||100!==b)&&(e.blendEquation(32774),x=100,b=100),l)switch(t){case 1:e.blendFuncSeparate(1,771,1,771);break;case h:e.blendFunc(1,1);break;case 3:e.blendFuncSeparate(0,769,0,1);break;case 4:e.blendFuncSeparate(0,768,0,770);break;default:console.error("THREE.WebGLState: Invalid blending: ",t)}else switch(t){case 1:e.blendFuncSeparate(770,771,1,771);break;case h:e.blendFunc(770,1);break;case 3:e.blendFuncSeparate(0,769,0,1);break;case 4:e.blendFunc(0,768);break;default:console.error("THREE.WebGLState: Invalid blending: ",t)}y=null,M=null,S=null,w=null,_=t,T=l}return}a=a||i,s=s||n,o=o||r,(i!==x||a!==b)&&(e.blendEquationSeparate(j[i],j[a]),x=i,b=a),(n!==y||r!==M||s!==S||o!==w)&&(e.blendFuncSeparate(X[n],X[r],X[s],X[o]),y=n,M=r,S=s,w=o),_=t,T=null}function Z(t){E!==t&&(t?e.frontFace(2304):e.frontFace(2305),E=t)}function J(t){0!==t?(H(2884),t!==A&&(1===t?e.cullFace(1029):2===t?e.cullFace(1028):e.cullFace(1032))):W(2884),A=t}function K(t,i,n){t?(H(32823),(L!==i||P!==n)&&(e.polygonOffset(i,n),L=i,P=n)):W(32823)}function Q(t){void 0===t&&(t=33984+R-1),O!==t&&(e.activeTexture(t),O=t)}return{buffers:{color:r,depth:a,stencil:s},enable:H,disable:W,bindFramebuffer:function(t,i){return p[t]!==i&&(e.bindFramebuffer(t,i),p[t]=i,n&&(36009===t&&(p[36160]=i),36160===t&&(p[36009]=i)),!0)},drawBuffers:function(n,r){let a=m,s=!1;if(n){if(void 0===(a=f.get(r))&&(a=[],f.set(r,a)),n.isWebGLMultipleRenderTargets){let o=n.texture;if(a.length!==o.length||36064!==a[0]){for(let l=0,h=o.length;l<h;l++)a[l]=36064+l;a.length=o.length,s=!0}}else 36064!==a[0]&&(a[0]=36064,s=!0)}else 1029!==a[0]&&(a[0]=1029,s=!0);
186s&&(i.isWebGL2?e.drawBuffers(a):t.get("WEBGL_draw_buffers").drawBuffersWEBGL(a))},useProgram:function(t){return g!==t&&(e.useProgram(t),g=t,!0)},setBlending:Y,setMaterial:function(e,t){e.side===l?W(2884):H(2884);let i=e.side===o;t&&(i=!i),Z(i),1===e.blending&&!1===e.transparent?Y(0):Y(e.blending,e.blendEquation,e.blendSrc,e.blendDst,e.blendEquationAlpha,e.blendSrcAlpha,e.blendDstAlpha,e.premultipliedAlpha),a.setFunc(e.depthFunc),a.setTest(e.depthTest),a.setMask(e.depthWrite),r.setMask(e.colorWrite);let n=e.stencilWrite;s.setTest(n),n&&(s.setMask(e.stencilWriteMask),s.setFunc(e.stencilFunc,e.stencilRef,e.stencilFuncMask),s.setOp(e.stencilFail,e.stencilZFail,e.stencilZPass)),K(e.polygonOffset,e.polygonOffsetFactor,e.polygonOffsetUnits),!0===e.alphaToCoverage?H(32926):W(32926)},setFlipSided:Z,setCullFace:J,setLineWidth:function(t){t!==C&&(D&&e.lineWidth(t),C=t)},setPolygonOffset:K,setScissorTest:function(e){e?H(3089):W(3089)},activeTexture:Q,bindTexture:function(t,i){null===O&&Q();let n=z[O];void 0===n&&(n={type:void 0,texture:void 0},z[O]=n),(n.type!==t||n.texture!==i)&&(e.bindTexture(t,i||G[t]),n.type=t,n.texture=i)},unbindTexture:function(){let t=z[O];void 0!==t&&void 0!==t.type&&(e.bindTexture(t.type,null),t.type=void 0,t.texture=void 0)},compressedTexImage2D:function(){try{e.compressedTexImage2D.apply(e,arguments)}catch(t){console.error("THREE.WebGLState:",t)}},texImage2D:function(){try{e.texImage2D.apply(e,arguments)}catch(t){console.error("THREE.WebGLState:",t)}},texImage3D:function(){try{e.texImage3D.apply(e,arguments)}catch(t){console.error("THREE.WebGLState:",t)}},updateUBOMapping:function(t,i){let n=c.get(i);void 0===n&&(n=new WeakMap,c.set(i,n));let r=n.get(t);void 0===r&&(r=e.getUniformBlockIndex(i,t.name),n.set(t,r))},uniformBlockBinding:function(t,i){let n=c.get(i),r=n.get(t);u.get(t)!==r&&(e.uniformBlockBinding(i,r,t.__bindingPointIndex),u.set(t,r))},texStorage2D:function(){try{e.texStorage2D.apply(e,arguments)}catch(t){console.error("THREE.WebGLState:",t)}},texStorage3D:function(){try{e.texStorage3D.apply(e,arguments)}catch(t){console.error("THREE.WebGLState:",t)}},texSubImage2D:function(){try{e.texSubImage2D.apply(e,arguments)}catch(t){console.error("THREE.WebGLState:",t)}},texSubImage3D:function(){try{e.texSubImage3D.apply(e,arguments)}catch(t){console.error("THREE.WebGLState:",t)}},compressedTexSubImage2D:function(){try{e.compressedTexSubImage2D.apply(e,arguments)}catch(t){console.error("THREE.WebGLState:",t)}},scissor:function(t){!1===B.equals(t)&&(e.scissor(t.x,t.y,t.z,t.w),B.copy(t))},viewport:function(t){!1===k.equals(t)&&(e.viewport(t.x,t.y,t.z,t.w),k.copy(t))},reset:function(){e.disable(3042),e.disable(2884),e.disable(2929),e.disable(32823),e.disable(3089),e.disable(2960),e.disable(32926),e.blendEquation(32774),e.blendFunc(1,0),e.blendFuncSeparate(1,0,1,0),e.colorMask(!0,!0,!0,!0),e.clearColor(0,0,0,0),e.depthMask(!0),e.depthFunc(513),e.clearDepth(1),e.stencilMask(4294967295),e.stencilFunc(519,0,4294967295),e.stencilOp(7680,7680,7680),e.clearStencil(0),e.cullFace(1029),e.frontFace(2305),e.polygonOffset(0,0),e.activeTexture(33984),e.bindFramebuffer(36160,null),!0===n&&(e.bindFramebuffer(36009,null),e.bindFramebuffer(36008,null)),e.useProgram(null),e.lineWidth(1),e.scissor(0,0,e.canvas.width,e.canvas.height),e.viewport(0,0,e.canvas.width,e.canvas.height),d={},O=null,z={},p={},f=new WeakMap,m=[],g=null,v=!1,_=null,x=null,y=null,M=null,b=null,S=null,w=null,T=!1,E=null,A=null,C=null,L=null,P=null,B.set(0,0,e.canvas.width,e.canvas.height),k.set(0,0,e.canvas.width,e.canvas.height),r.reset(),a.reset(),s.reset()}}}function rd(e,t,i,n,r,a,s){let o=r.isWebGL2,l=r.maxTextures,h=r.maxCubemapSize,u=r.maxTextureSize,y=r.maxSamples,M=t.has("WEBGL_multisampled_render_to_texture")?t.get("WEBGL_multisampled_render_to_texture"):null,b=/OculusBrowser/g.test(navigator.userAgent),S=new WeakMap,T,E=new WeakMap,A=!1;try{A="undefined"!=typeof OffscreenCanvas&&null!==new OffscreenCanvas(1,1).getContext("2d")}catch(C){}function L(e,t){return A?new OffscreenCanvas(e,t):Y("canvas")}function P(e,t,i,n){let r=1;if((e.width>n||e.height>n)&&(r=n/Math.max(e.width,e.height)),r<1||!0===t){if("undefined"!=typeof HTMLImageElement&&e instanceof HTMLImageElement||"undefined"!=typeof HTMLCanvasElement&&e instanceof HTMLCanvasElement||"undefined"!=typeof ImageBitmap&&e instanceof ImageBitmap){let a=t?H:Math.floor,s=a(r*e.width),o=a(r*e.height);void 0===T&&(T=L(s,o));let l=i?L(s,o):T;l.width=s,l.height=o;let h=l.getContext("2d");return h.drawImage(e,0,0,s,o),console.warn("THREE.WebGLRenderer: Texture has been resized from ("+e.width+"x"+e.height+") to ("+s+"x"+o+")."),l}
186"data"in e&&console.warn("THREE.WebGLRenderer: Image in DataTexture is too big ("+e.width+"x"+e.height+").")}return e}function R(e){return V(e.width)&&V(e.height)}function D(e,t){return e.generateMipmaps&&t&&e.minFilter!==f&&e.minFilter!==v}function I(t){e.generateMipmap(t)}function N(i,n,r,a,s=!1){if(!1===o)return n;if(null!==i){if(void 0!==e[i])return e[i];console.warn("THREE.WebGLRenderer: Attempt to use non-existing WebGL internal format '"+i+"'")}let l=n;return 6403===n&&(5126===r&&(l=33326),5131===r&&(l=33325),5121===r&&(l=33321)),33319===n&&(5126===r&&(l=33328),5131===r&&(l=33327),5121===r&&(l=33323)),6408===n&&(5126===r&&(l=34836),5131===r&&(l=34842),5121===r&&(l=a===w&&!1===s?35907:32856),32819===r&&(l=32854),32820===r&&(l=32855)),(33325===l||33326===l||33327===l||33328===l||34842===l||34836===l)&&t.get("EXT_color_buffer_float"),l}function O(e,t,i){return!0===D(e,i)||e.isFramebufferTexture&&e.minFilter!==f&&e.minFilter!==v?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 z(e){return e===f||e===m||e===g?9728:9729}function U(e){let t=e.target;t.removeEventListener("dispose",U),function(e){let t=n.get(e);if(void 0===t.__webglInit)return;let i=e.source,r=E.get(i);if(r){let a=r[t.__cacheKey];a.usedTimes--,0===a.usedTimes&&B(e),0===Object.keys(r).length&&E.delete(i)}n.remove(e)}(t),t.isVideoTexture&&S.delete(t)}function F(t){let i=t.target;i.removeEventListener("dispose",F),function(t){let i=t.texture,r=n.get(t),a=n.get(i);if(void 0!==a.__webglTexture&&(e.deleteTexture(a.__webglTexture),s.memory.textures--),t.depthTexture&&t.depthTexture.dispose(),t.isWebGLCubeRenderTarget)for(let o=0;o<6;o++)e.deleteFramebuffer(r.__webglFramebuffer[o]),r.__webglDepthbuffer&&e.deleteRenderbuffer(r.__webglDepthbuffer[o]);else{if(e.deleteFramebuffer(r.__webglFramebuffer),r.__webglDepthbuffer&&e.deleteRenderbuffer(r.__webglDepthbuffer),r.__webglMultisampledFramebuffer&&e.deleteFramebuffer(r.__webglMultisampledFramebuffer),r.__webglColorRenderbuffer)for(let l=0;l<r.__webglColorRenderbuffer.length;l++)r.__webglColorRenderbuffer[l]&&e.deleteRenderbuffer(r.__webglColorRenderbuffer[l]);r.__webglDepthRenderbuffer&&e.deleteRenderbuffer(r.__webglDepthRenderbuffer)}if(t.isWebGLMultipleRenderTargets)for(let h=0,u=i.length;h<u;h++){let c=n.get(i[h]);c.__webglTexture&&(e.deleteTexture(c.__webglTexture),s.memory.textures--),n.remove(i[h])}n.remove(i),n.remove(t)}(i)}function B(t){let i=n.get(t);e.deleteTexture(i.__webglTexture);let r=t.source,a=E.get(r);delete a[i.__cacheKey],s.memory.textures--}let k=0;function G(e,t){let r=n.get(e);if(e.isVideoTexture&&function(e){let t=s.render.frame;S.get(e)!==t&&(S.set(e,t),e.update())}(e),!1===e.isRenderTargetTexture&&e.version>0&&r.__version!==e.version){let a=e.image;if(null===a)console.warn("THREE.WebGLRenderer: Texture marked for update but no image data found.");else if(!1===a.complete)console.warn("THREE.WebGLRenderer: Texture marked for update but image is incomplete");else{Z(r,e,t);return}}i.activeTexture(33984+t),i.bindTexture(3553,r.__webglTexture)}let W={[c]:10497,[d]:33071,[p]:33648},j={[f]:9728,[m]:9984,[g]:9986,[v]:9729,[_]:9985,[x]:9987};function q(i,a,s){if(s?(e.texParameteri(i,10242,W[a.wrapS]),e.texParameteri(i,10243,W[a.wrapT]),(32879===i||35866===i)&&e.texParameteri(i,32882,W[a.wrapR]),e.texParameteri(i,10240,j[a.magFilter]),e.texParameteri(i,10241,j[a.minFilter])):(e.texParameteri(i,10242,33071),e.texParameteri(i,10243,33071),(32879===i||35866===i)&&e.texParameteri(i,32882,33071),(a.wrapS!==d||a.wrapT!==d)&&console.warn("THREE.WebGLRenderer: Texture is not power of two. Texture.wrapS and Texture.wrapT should be set to THREE.ClampToEdgeWrapping."),e.texParameteri(i,10240,z(a.magFilter)),e.texParameteri(i,10241,z(a.minFilter)),a.minFilter!==f&&a.minFilter!==v&&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")){let l=t.get("EXT_texture_filter_anisotropic");(1015!==a.type||!1!==t.has("OES_texture_float_linear"))&&(!1!==o||1016!==a.type||!1!==t.has("OES_texture_half_float_linear"))&&(a.anisotropy>1||n.get(a).__currentAnisotropy)&&(e.texParameterf(i,l.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(a.anisotropy,r.getMaxAnisotropy())),n.get(a).__currentAnisotropy=a.anisotropy)}}function X(t,i){let n=!1;void 0===t.__webglInit&&(t.__webglInit=!0,i.addEventListener("dispose",U));let r=i.source,a=E.get(r);void 0===a&&(a={},E.set(r,a));let o=function(e){let t=[];
186return 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()}(i);if(o!==t.__cacheKey){void 0===a[o]&&(a[o]={texture:e.createTexture(),usedTimes:0},s.memory.textures++,n=!0),a[o].usedTimes++;let l=a[t.__cacheKey];void 0!==l&&(a[t.__cacheKey].usedTimes--,0===l.usedTimes&&B(i)),t.__cacheKey=o,t.__webglTexture=a[o].texture}return n}function Z(t,n,r){let s=3553;n.isDataArrayTexture&&(s=35866),n.isData3DTexture&&(s=32879);let l=X(t,n),h=n.source;if(i.activeTexture(33984+r),i.bindTexture(s,t.__webglTexture),h.version!==h.__currentVersion||!0===l){var c;e.pixelStorei(37440,n.flipY),e.pixelStorei(37441,n.premultiplyAlpha),e.pixelStorei(3317,n.unpackAlignment),e.pixelStorei(37443,0);let p=!o&&(n.wrapS!==d||n.wrapT!==d||n.minFilter!==f&&n.minFilter!==v)&&!1===R(n.image),m=P(n.image,p,!1,u);m=et(n,m);let g=R(m)||o,_=a.convert(n.format,n.encoding),x=a.convert(n.type),y=N(n.internalFormat,_,x,n.encoding,n.isVideoTexture);q(s,n,g);let M,b=n.mipmaps,S=o&&!0!==n.isVideoTexture,w=void 0===h.__currentVersion||!0===l,T=O(n,m,g);if(n.isDepthTexture)y=6402,o?y=1015===n.type?36012:1014===n.type?33190:1020===n.type?35056:33189:1015===n.type&&console.error("WebGLRenderer: Floating point depth texture requires WebGL2."),1026===n.format&&6402===y&&1012!==n.type&&1014!==n.type&&(console.warn("THREE.WebGLRenderer: Use UnsignedShortType or UnsignedIntType for DepthFormat DepthTexture."),n.type=1014,x=a.convert(n.type)),1027===n.format&&6402===y&&(y=34041,1020!==n.type&&(console.warn("THREE.WebGLRenderer: Use UnsignedInt248Type for DepthStencilFormat DepthTexture."),n.type=1020,x=a.convert(n.type))),w&&(S?i.texStorage2D(3553,1,y,m.width,m.height):i.texImage2D(3553,0,y,m.width,m.height,0,_,x,null));else if(n.isDataTexture){if(b.length>0&&g){S&&w&&i.texStorage2D(3553,T,y,b[0].width,b[0].height);for(let E=0,A=b.length;E<A;E++)M=b[E],S?i.texSubImage2D(3553,E,0,0,M.width,M.height,_,x,M.data):i.texImage2D(3553,E,y,M.width,M.height,0,_,x,M.data);n.generateMipmaps=!1}else S?(w&&i.texStorage2D(3553,T,y,m.width,m.height),i.texSubImage2D(3553,0,0,0,m.width,m.height,_,x,m.data)):i.texImage2D(3553,0,y,m.width,m.height,0,_,x,m.data)}else if(n.isCompressedTexture){S&&w&&i.texStorage2D(3553,T,y,b[0].width,b[0].height);for(let C=0,L=b.length;C<L;C++)M=b[C],1023!==n.format?null!==_?S?i.compressedTexSubImage2D(3553,C,0,0,M.width,M.height,_,M.data):i.compressedTexImage2D(3553,C,y,M.width,M.height,0,M.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()"):S?i.texSubImage2D(3553,C,0,0,M.width,M.height,_,x,M.data):i.texImage2D(3553,C,y,M.width,M.height,0,_,x,M.data)}else if(n.isDataArrayTexture)S?(w&&i.texStorage3D(35866,T,y,m.width,m.height,m.depth),i.texSubImage3D(35866,0,0,0,0,m.width,m.height,m.depth,_,x,m.data)):i.texImage3D(35866,0,y,m.width,m.height,m.depth,0,_,x,m.data);else if(n.isData3DTexture)S?(w&&i.texStorage3D(32879,T,y,m.width,m.height,m.depth),i.texSubImage3D(32879,0,0,0,0,m.width,m.height,m.depth,_,x,m.data)):i.texImage3D(32879,0,y,m.width,m.height,m.depth,0,_,x,m.data);else if(n.isFramebufferTexture){if(w){if(S)i.texStorage2D(3553,T,y,m.width,m.height);else{let z=m.width,U=m.height;for(let F=0;F<T;F++)i.texImage2D(3553,F,y,z,U,0,_,x,null),z>>=1,U>>=1}}}else if(b.length>0&&g){S&&w&&i.texStorage2D(3553,T,y,b[0].width,b[0].height);for(let B=0,k=b.length;B<k;B++)M=b[B],S?i.texSubImage2D(3553,B,0,0,_,x,M):i.texImage2D(3553,B,y,_,x,M);n.generateMipmaps=!1}else S?(w&&i.texStorage2D(3553,T,y,m.width,m.height),i.texSubImage2D(3553,0,0,0,_,x,m)):i.texImage2D(3553,0,y,_,x,m);D(n,g)&&I(s),h.__currentVersion=h.version,n.onUpdate&&n.onUpdate(n)}t.__version=n.version}function J(t,r,s,o,l){let h=a.convert(s.format,s.encoding),u=a.convert(s.type),c=N(s.internalFormat,h,u,s.encoding),d=n.get(r);d.__hasExternalTextures||(32879===l||35866===l?i.texImage3D(l,0,c,r.width,r.height,r.depth,0,h,u,null):i.texImage2D(l,0,c,r.width,r.height,0,h,u,null)),i.bindFramebuffer(36160,t),ee(r)?M.framebufferTexture2DMultisampleEXT(36160,o,l,n.get(s).__webglTexture,0,$(r)):e.framebufferTexture2D(36160,o,l,n.get(s).__webglTexture,0),i.bindFramebuffer(36160,null)}function K(t,i,n){if(e.bindRenderbuffer(36161,t),i.depthBuffer&&!i.stencilBuffer){let r=33189;if(n||ee(i)){let s=i.depthTexture;s&&s.isDepthTexture&&(1015===s.type?r=36012:1014===s.type&&(r=33190));let o=$(i);ee(i)?M.renderbufferStorageMultisampleEXT(36161,o,r,i.width,i.height):e.renderbufferStorageMultisample(36161,o,r,i.width,i.height)}else e.renderbufferStorage(36161,r,i.width,i.height);e.framebufferRenderbuffer(36160,36096,36161,t)}else if(i.depthBuffer&&i.stencilBuffer){let l=$(i);n&&!1===ee(i)?e.renderbufferStorageMultisample(36161,l,35056,i.width,i.height):ee(i)?M.renderbufferStorageMultisampleEXT(36161,l,35056,i.width,i.height):e.renderbufferStorage(36161,34041,i.width,i.height),e.framebufferRenderbuffer(36160,33306,36161,t)}
186else{let h=!0===i.isWebGLMultipleRenderTargets?i.texture:[i.texture];for(let u=0;u<h.length;u++){let c=h[u],d=a.convert(c.format,c.encoding),p=a.convert(c.type),f=N(c.internalFormat,d,p,c.encoding),m=$(i);n&&!1===ee(i)?e.renderbufferStorageMultisample(36161,m,f,i.width,i.height):ee(i)?M.renderbufferStorageMultisampleEXT(36161,m,f,i.width,i.height):e.renderbufferStorage(36161,f,i.width,i.height)}}e.bindRenderbuffer(36161,null)}function Q(t){let r=n.get(t),a=!0===t.isWebGLCubeRenderTarget;if(t.depthTexture&&!r.__autoAllocateDepthBuffer){if(a)throw Error("target.depthTexture not supported in Cube render targets");!function(t,r){let a=r&&r.isWebGLCubeRenderTarget;if(a)throw Error("Depth Texture with cube render targets is not supported");if(i.bindFramebuffer(36160,t),!(r.depthTexture&&r.depthTexture.isDepthTexture))throw Error("renderTarget.depthTexture must be an instance of THREE.DepthTexture");n.get(r.depthTexture).__webglTexture&&r.depthTexture.image.width===r.width&&r.depthTexture.image.height===r.height||(r.depthTexture.image.width=r.width,r.depthTexture.image.height=r.height,r.depthTexture.needsUpdate=!0),G(r.depthTexture,0);let s=n.get(r.depthTexture).__webglTexture,o=$(r);if(1026===r.depthTexture.format)ee(r)?M.framebufferTexture2DMultisampleEXT(36160,36096,3553,s,0,o):e.framebufferTexture2D(36160,36096,3553,s,0);else if(1027===r.depthTexture.format)ee(r)?M.framebufferTexture2DMultisampleEXT(36160,33306,3553,s,0,o):e.framebufferTexture2D(36160,33306,3553,s,0);else throw Error("Unknown depthTexture format")}(r.__webglFramebuffer,t)}else if(a){r.__webglDepthbuffer=[];for(let s=0;s<6;s++)i.bindFramebuffer(36160,r.__webglFramebuffer[s]),r.__webglDepthbuffer[s]=e.createRenderbuffer(),K(r.__webglDepthbuffer[s],t,!1)}else i.bindFramebuffer(36160,r.__webglFramebuffer),r.__webglDepthbuffer=e.createRenderbuffer(),K(r.__webglDepthbuffer,t,!1);i.bindFramebuffer(36160,null)}function $(e){return Math.min(y,e.samples)}function ee(e){let i=n.get(e);return o&&e.samples>0&&!0===t.has("WEBGL_multisampled_render_to_texture")&&!1!==i.__useRenderToTexture}function et(e,i){let n=e.encoding,r=e.format,a=e.type;return!0===e.isCompressedTexture||!0===e.isVideoTexture||1035===e.format||3e3!==n&&(n===w?!1===o?!0===t.has("EXT_sRGB")&&1023===r?(e.format=1035,e.minFilter=v,e.generateMipmaps=!1):i=eo.sRGBToLinear(i):(1023!==r||1009!==a)&&console.warn("THREE.WebGLTextures: sRGB encoded textures have to use RGBAFormat and UnsignedByteType."):console.error("THREE.WebGLTextures: Unsupported texture encoding:",n)),i}this.allocateTextureUnit=function(){let e=k;return e>=l&&console.warn("THREE.WebGLTextures: Trying to use "+e+" texture units while this GPU supports only "+l),k+=1,e},this.resetTextureUnits=function(){k=0},this.setTexture2D=G,this.setTexture2DArray=function(e,t){let r=n.get(e);if(e.version>0&&r.__version!==e.version){Z(r,e,t);return}i.activeTexture(33984+t),i.bindTexture(35866,r.__webglTexture)},this.setTexture3D=function(e,t){let r=n.get(e);if(e.version>0&&r.__version!==e.version){Z(r,e,t);return}i.activeTexture(33984+t),i.bindTexture(32879,r.__webglTexture)},this.setTextureCube=function(t,r){let s=n.get(t);if(t.version>0&&s.__version!==t.version){(function(t,n,r){if(6!==n.image.length)return;let s=X(t,n),l=n.source;if(i.activeTexture(33984+r),i.bindTexture(34067,t.__webglTexture),l.version!==l.__currentVersion||!0===s){e.pixelStorei(37440,n.flipY),e.pixelStorei(37441,n.premultiplyAlpha),e.pixelStorei(3317,n.unpackAlignment),e.pixelStorei(37443,0);let u=n.isCompressedTexture||n.image[0].isCompressedTexture,c=n.image[0]&&n.image[0].isDataTexture,d=[];for(let p=0;p<6;p++)u||c?d[p]=c?n.image[p].image:n.image[p]:d[p]=P(n.image[p],!1,!0,h),d[p]=et(n,d[p]);let f=d[0],m=R(f)||o,g=a.convert(n.format,n.encoding),v=a.convert(n.type),_=N(n.internalFormat,g,v,n.encoding),x=o&&!0!==n.isVideoTexture,y=void 0===l.__currentVersion||!0===s,M=O(n,f,m);q(34067,n,m);let b;if(u){x&&y&&i.texStorage2D(34067,M,_,f.width,f.height);for(let S=0;S<6;S++){b=d[S].mipmaps;for(let w=0;w<b.length;w++){let T=b[w];1023!==n.format?null!==g?x?i.compressedTexSubImage2D(34069+S,w,0,0,T.width,T.height,g,T.data):i.compressedTexImage2D(34069+S,w,_,T.width,T.height,0,T.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .setTextureCube()"):x?i.texSubImage2D(34069+S,w,0,0,T.width,T.height,g,v,T.data):i.texImage2D(34069+S,w,_,T.width,T.height,0,g,v,T.data)}}}else{b=n.mipmaps,x&&y&&(b.length>0&&M++,i.texStorage2D(34067,M,_,d[0].width,d[0].height));for(let E=0;E<6;E++)if(c){x?i.texSubImage2D(34069+E,0,0,0,d[E].width,d[E].height,g,v,d[E].data):i.texImage2D(34069+E,0,_,d[E].width,d[E].height,0,g,v,d[E].data);for(let A=0;A<b.length;A++){let C=b[A],L=C.image[E].image;x?i.texSubImage2D(34069+E,A+1,0,0,L.width,L.height,g,v,L.data):i.texImage2D(34069+E,A+1,_,L.width,L.height,0,g,v,L.data)}}else{x?i.texSubImage2D(34069+E,0,0,0,g,v,d[E]):i.texImage2D(34069+E,0,_,g,v,d[E]);for(let z=0;z<b.length;z++){let U=b[z];x?i.texSubImage2D(34069+E,z+1,0,0,g,v,U.image[E]):i.texImage2D(34069+E,z+1,_,g,v,U.image[E])}}}
186D(n,m)&&I(34067),l.__currentVersion=l.version,n.onUpdate&&n.onUpdate(n)}t.__version=n.version})(s,t,r);return}i.activeTexture(33984+r),i.bindTexture(34067,s.__webglTexture)},this.rebindTextures=function(e,t,i){let r=n.get(e);void 0!==t&&J(r.__webglFramebuffer,e,e.texture,36064,3553),void 0!==i&&Q(e)},this.setupRenderTarget=function(t){let l=t.texture,h=n.get(t),u=n.get(l);t.addEventListener("dispose",F),!0!==t.isWebGLMultipleRenderTargets&&(void 0===u.__webglTexture&&(u.__webglTexture=e.createTexture()),u.__version=l.version,s.memory.textures++);let c=!0===t.isWebGLCubeRenderTarget,d=!0===t.isWebGLMultipleRenderTargets,p=R(t)||o;if(c){h.__webglFramebuffer=[];for(let f=0;f<6;f++)h.__webglFramebuffer[f]=e.createFramebuffer()}else{if(h.__webglFramebuffer=e.createFramebuffer(),d){if(r.drawBuffers){let m=t.texture;for(let g=0,v=m.length;g<v;g++){let _=n.get(m[g]);void 0===_.__webglTexture&&(_.__webglTexture=e.createTexture(),s.memory.textures++)}}else console.warn("THREE.WebGLRenderer: WebGLMultipleRenderTargets can only be used with WebGL2 or WEBGL_draw_buffers extension.")}if(o&&t.samples>0&&!1===ee(t)){let x=d?l:[l];h.__webglMultisampledFramebuffer=e.createFramebuffer(),h.__webglColorRenderbuffer=[],i.bindFramebuffer(36160,h.__webglMultisampledFramebuffer);for(let y=0;y<x.length;y++){let M=x[y];h.__webglColorRenderbuffer[y]=e.createRenderbuffer(),e.bindRenderbuffer(36161,h.__webglColorRenderbuffer[y]);let b=a.convert(M.format,M.encoding),S=a.convert(M.type),w=N(M.internalFormat,b,S,M.encoding),T=$(t);e.renderbufferStorageMultisample(36161,T,w,t.width,t.height),e.framebufferRenderbuffer(36160,36064+y,36161,h.__webglColorRenderbuffer[y])}e.bindRenderbuffer(36161,null),t.depthBuffer&&(h.__webglDepthRenderbuffer=e.createRenderbuffer(),K(h.__webglDepthRenderbuffer,t,!0)),i.bindFramebuffer(36160,null)}}if(c){i.bindTexture(34067,u.__webglTexture),q(34067,l,p);for(let E=0;E<6;E++)J(h.__webglFramebuffer[E],t,l,36064,34069+E);D(l,p)&&I(34067),i.unbindTexture()}else if(d){let A=t.texture;for(let C=0,L=A.length;C<L;C++){let P=A[C],O=n.get(P);i.bindTexture(3553,O.__webglTexture),q(3553,P,p),J(h.__webglFramebuffer,t,P,36064+C,3553),D(P,p)&&I(3553)}i.unbindTexture()}else{let z=3553;(t.isWebGL3DRenderTarget||t.isWebGLArrayRenderTarget)&&(o?z=t.isWebGL3DRenderTarget?32879:35866:console.error("THREE.WebGLTextures: THREE.Data3DTexture and THREE.DataArrayTexture only supported with WebGL2.")),i.bindTexture(z,u.__webglTexture),q(z,l,p),J(h.__webglFramebuffer,t,l,36064,z),D(l,p)&&I(z),i.unbindTexture()}t.depthBuffer&&Q(t)},this.updateRenderTargetMipmap=function(e){let t=R(e)||o,r=!0===e.isWebGLMultipleRenderTargets?e.texture:[e.texture];for(let a=0,s=r.length;a<s;a++){let l=r[a];if(D(l,t)){let h=e.isWebGLCubeRenderTarget?34067:3553,u=n.get(l).__webglTexture;i.bindTexture(h,u),I(h),i.unbindTexture()}}},this.updateMultisampleRenderTarget=function(t){if(o&&t.samples>0&&!1===ee(t)){let r=t.isWebGLMultipleRenderTargets?t.texture:[t.texture],a=t.width,s=t.height,l=16384,h=[],u=t.stencilBuffer?33306:36096,c=n.get(t),d=!0===t.isWebGLMultipleRenderTargets;if(d)for(let p=0;p<r.length;p++)i.bindFramebuffer(36160,c.__webglMultisampledFramebuffer),e.framebufferRenderbuffer(36160,36064+p,36161,null),i.bindFramebuffer(36160,c.__webglFramebuffer),e.framebufferTexture2D(36009,36064+p,3553,null,0);i.bindFramebuffer(36008,c.__webglMultisampledFramebuffer),i.bindFramebuffer(36009,c.__webglFramebuffer);for(let f=0;f<r.length;f++){h.push(36064+f),t.depthBuffer&&h.push(u);let m=void 0!==c.__ignoreDepthValues&&c.__ignoreDepthValues;if(!1===m&&(t.depthBuffer&&(l|=256),t.stencilBuffer&&(l|=1024)),d&&e.framebufferRenderbuffer(36008,36064,36161,c.__webglColorRenderbuffer[f]),!0===m&&(e.invalidateFramebuffer(36008,[u]),e.invalidateFramebuffer(36009,[u])),d){let g=n.get(r[f]).__webglTexture;e.framebufferTexture2D(36009,36064,3553,g,0)}e.blitFramebuffer(0,0,a,s,0,0,a,s,l,9728),b&&e.invalidateFramebuffer(36008,h)}if(i.bindFramebuffer(36008,null),i.bindFramebuffer(36009,null),d)for(let v=0;v<r.length;v++){i.bindFramebuffer(36160,c.__webglMultisampledFramebuffer),e.framebufferRenderbuffer(36160,36064+v,36161,c.__webglColorRen
186derbuffer[v]);let _=n.get(r[v]).__webglTexture;i.bindFramebuffer(36160,c.__webglFramebuffer),e.framebufferTexture2D(36009,36064+v,3553,_,0)}i.bindFramebuffer(36009,c.__webglMultisampledFramebuffer)}},this.setupDepthRenderbuffer=Q,this.setupFrameBufferTexture=J,this.useMultisampledRTT=ee}function rp(e,t,i){let n=i.isWebGL2;return{convert:function(i,r=null){let a;if(1009===i)return 5121;if(1017===i)return 32819;if(1018===i)return 32820;if(1010===i)return 5120;if(1011===i)return 5122;if(1012===i)return 5123;if(1013===i)return 5124;if(1014===i)return 5125;if(1015===i)return 5126;if(1016===i)return n?5131:null!==(a=t.get("OES_texture_half_float"))?a.HALF_FLOAT_OES:null;if(1021===i)return 6406;if(1023===i)return 6408;if(1024===i)return 6409;if(1025===i)return 6410;if(1026===i)return 6402;if(1027===i)return 34041;if(1028===i)return 6403;if(1022===i)return console.warn("THREE.WebGLRenderer: THREE.RGBFormat has been removed. Use THREE.RGBAFormat instead. https://github.com/mrdoob/three.js/pull/23228"),6408;if(1035===i)return null!==(a=t.get("EXT_sRGB"))?a.SRGB_ALPHA_EXT:null;if(1029===i)return 36244;if(1030===i)return 33319;if(1031===i)return 33320;if(1033===i)return 36249;if(33776===i||33777===i||33778===i||33779===i){if(r===w){if(null===(a=t.get("WEBGL_compressed_texture_s3tc_srgb")))return null;if(33776===i)return a.COMPRESSED_SRGB_S3TC_DXT1_EXT;if(33777===i)return a.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT;if(33778===i)return a.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT;if(33779===i)return a.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT}else{if(null===(a=t.get("WEBGL_compressed_texture_s3tc")))return null;if(33776===i)return a.COMPRESSED_RGB_S3TC_DXT1_EXT;if(33777===i)return a.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(33778===i)return a.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(33779===i)return a.COMPRESSED_RGBA_S3TC_DXT5_EXT}}if(35840===i||35841===i||35842===i||35843===i){if(null===(a=t.get("WEBGL_compressed_texture_pvrtc")))return null;if(35840===i)return a.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(35841===i)return a.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(35842===i)return a.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(35843===i)return a.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}if(36196===i)return null!==(a=t.get("WEBGL_compressed_texture_etc1"))?a.COMPRESSED_RGB_ETC1_WEBGL:null;if(37492===i||37496===i){if(null===(a=t.get("WEBGL_compressed_texture_etc")))return null;if(37492===i)return r===w?a.COMPRESSED_SRGB8_ETC2:a.COMPRESSED_RGB8_ETC2;if(37496===i)return r===w?a.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC:a.COMPRESSED_RGBA8_ETC2_EAC}if(37808===i||37809===i||37810===i||37811===i||37812===i||37813===i||37814===i||37815===i||37816===i||37817===i||37818===i||37819===i||37820===i||37821===i){if(null===(a=t.get("WEBGL_compressed_texture_astc")))return null;if(37808===i)return r===w?a.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR:a.COMPRESSED_RGBA_ASTC_4x4_KHR;if(37809===i)return r===w?a.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR:a.COMPRESSED_RGBA_ASTC_5x4_KHR;if(37810===i)return r===w?a.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR:a.COMPRESSED_RGBA_ASTC_5x5_KHR;if(37811===i)return r===w?a.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR:a.COMPRESSED_RGBA_ASTC_6x5_KHR;if(37812===i)return r===w?a.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR:a.COMPRESSED_RGBA_ASTC_6x6_KHR;if(37813===i)return r===w?a.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR:a.COMPRESSED_RGBA_ASTC_8x5_KHR;if(37814===i)return r===w?a.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR:a.COMPRESSED_RGBA_ASTC_8x6_KHR;if(37815===i)return r===w?a.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR:a.COMPRESSED_RGBA_ASTC_8x8_KHR;if(37816===i)return r===w?a.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR:a.COMPRESSED_RGBA_ASTC_10x5_KHR;if(37817===i)return r===w?a.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR:a.COMPRESSED_RGBA_ASTC_10x6_KHR;if(37818===i)return r===w?a.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR:a.COMPRESSED_RGBA_ASTC_10x8_KHR;if(37819===i)return r===w?a.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR:a.COMPRESSED_RGBA_ASTC_10x10_KHR;if(37820===i)return r===w?a.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR:a.COMPRESSED_RGBA_ASTC_12x10_KHR;if(37821===i)return r===w?a.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR:a.COMPRESSED_RGBA_ASTC_12x12_KHR}if(36492===i){if(null===(a=t.get("EXT_texture_compression_bptc")))return null;if(36492===i)return r===w?a.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT:a.COMPRESSED_RGBA_BPTC_UNORM_EXT}return 1020===i?n?34042:null!==(a=t.get("WEBGL_depth_texture"))?a.UNSIGNED_INT_24_8_WEBGL:null:void 0!==e[i]?e[i]:null}}}class rf extends t8{constructor(e=[]){super(),this.isArrayCamera=!0,this.cameras=e}}class rm extends tl{constructor(){super(),this.isGroup=!0,this.type="Group"}}let rg={type:"move"};class rv{constructor(){this._targetRay=null,this._grip=null,this._hand=null}getHandSpace(){return null===this._hand&&(this._hand=new rm,this._hand.matrixAutoUpdate=!1,this._hand.visible=!1,this._hand.joints={},this._hand.inputState={pinching:!1}),this._hand}getTargetRaySpace(){return null===this._targetRay&&(this._targetRay=new rm,this._targetRay.matrixAutoUpdate=!1,this._targetRay.visible=!1,this._targetRay.hasLinearVelocity=!1,this._targetRay.linearVelocity=new eg,this._targetRay.hasAngularVelocity=!1,this._targetRay.angularVelocity=new eg),this._targetRay}getGripSpace(){return null===this._grip&&(this._grip=new rm,this._grip.matrixAutoUpdate=!1,this._grip.visible=!1,this._grip.hasLinearVelocity=!1,this._grip.linearVelocity=new eg,this._grip.hasAngularVelocity=!1,this._grip.angularVelocity=new eg),this._grip}dispatchEvent(e){return null!==this._targetRay&&this._targetRay.dispatchEvent(e),null!==this._grip&&this._grip.dispatchEvent(e),null!==this._hand&&this._hand.dispatchEvent(e),this}disconnect(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}update(e,t,i){let n=null,r=null,a=null,s=this._targetRay,o=this._grip,l=this._hand;if(e&&"visible-blurred"!==t.session.visibilityState){if(l&&e.hand){for(let h of(a=!0,e.hand.values())
186){let u=t.getJointPose(h,i);if(void 0===l.joints[h.jointName]){let c=new rm;c.matrixAutoUpdate=!1,c.visible=!1,l.joints[h.jointName]=c,l.add(c)}let d=l.joints[h.jointName];null!==u&&(d.matrix.fromArray(u.transform.matrix),d.matrix.decompose(d.position,d.rotation,d.scale),d.jointRadius=u.radius),d.visible=null!==u}let p=l.joints["index-finger-tip"],f=l.joints["thumb-tip"],m=p.position.distanceTo(f.position);l.inputState.pinching&&m>.025?(l.inputState.pinching=!1,this.dispatchEvent({type:"pinchend",handedness:e.handedness,target:this})):!l.inputState.pinching&&m<=.015&&(l.inputState.pinching=!0,this.dispatchEvent({type:"pinchstart",handedness:e.handedness,target:this}))}else null!==o&&e.gripSpace&&null!==(r=t.getPose(e.gripSpace,i))&&(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);null!==s&&(null===(n=t.getPose(e.targetRaySpace,i))&&null!==r&&(n=r),null!==n&&(s.matrix.fromArray(n.transform.matrix),s.matrix.decompose(s.position,s.rotation,s.scale),n.linearVelocity?(s.hasLinearVelocity=!0,s.linearVelocity.copy(n.linearVelocity)):s.hasLinearVelocity=!1,n.angularVelocity?(s.hasAngularVelocity=!0,s.angularVelocity.copy(n.angularVelocity)):s.hasAngularVelocity=!1,this.dispatchEvent(rg)))}return null!==s&&(s.visible=null!==n),null!==o&&(o.visible=null!==r),null!==l&&(l.visible=null!==a),this}}class r_ extends ec{constructor(e,t,i,n,r,a,s,o,l,h){if(1026!==(h=void 0!==h?h:1026)&&1027!==h)throw Error("DepthTexture format must be either THREE.DepthFormat or THREE.DepthStencilFormat");void 0===i&&1026===h&&(i=1014),void 0===i&&1027===h&&(i=1020),super(null,n,r,a,s,o,h,i,l),this.isDepthTexture=!0,this.image={width:e,height:t},this.magFilter=void 0!==s?s:f,this.minFilter=void 0!==o?o:f,this.flipY=!1,this.generateMipmaps=!1}}class rx extends P{constructor(e,t){super();let i=this,n=null,r=1,a=null,s="local-floor",o=null,l=null,h=null,u=null,c=null,d=null,p=t.getContextAttributes(),f=null,m=null,g=[],v=[],_=new t8;_.layers.enable(1),_.viewport=new ed;let x=new t8;x.layers.enable(2),x.viewport=new ed;let y=[_,x],M=new rf;M.layers.enable(1),M.layers.enable(2);let b=null,S=null;function w(e){let t=v.indexOf(e.inputSource);if(-1===t)return;let i=g[t];void 0!==i&&i.dispatchEvent({type:e.type,data:e.inputSource})}function T(){n.removeEventListener("select",w),n.removeEventListener("selectstart",w),n.removeEventListener("selectend",w),n.removeEventListener("squeeze",w),n.removeEventListener("squeezestart",w),n.removeEventListener("squeezeend",w),n.removeEventListener("end",T),n.removeEventListener("inputsourceschange",E);for(let t=0;t<g.length;t++){let r=v[t];null!==r&&(v[t]=null,g[t].disconnect(r))}b=null,S=null,e.setRenderTarget(f),c=null,u=null,h=null,n=null,m=null,R.stop(),i.isPresenting=!1,i.dispatchEvent({type:"sessionend"})}function E(e){for(let t=0;t<e.removed.length;t++){let i=e.removed[t],n=v.indexOf(i);n>=0&&(v[n]=null,g[n].dispatchEvent({type:"disconnected",data:i}))}for(let r=0;r<e.added.length;r++){let a=e.added[r],s=v.indexOf(a);if(-1===s){for(let o=0;o<g.length;o++){if(o>=v.length){v.push(a),s=o;break}if(null===v[o]){v[o]=a,s=o;break}}if(-1===s)break}let l=g[s];l&&l.dispatchEvent({type:"connected",data:a})}}this.cameraAutoUpdate=!0,this.enabled=!1,this.isPresenting=!1,this.getController=function(e){let t=g[e];return void 0===t&&(t=new rv,g[e]=t),t.getTargetRaySpace()},this.getControllerGrip=function(e){let t=g[e];return void 0===t&&(t=new rv,g[e]=t),t.getGripSpace()},this.getHand=function(e){let t=g[e];return void 0===t&&(t=new rv,g[e]=t),t.getHandSpace()},this.setFramebufferScaleFactor=function(e){r=e,!0===i.isPresenting&&console.warn("THREE.WebXRManager: Cannot change framebuffer scale while presenting.")},this.setReferenceSpaceType=function(e){s=e,!0===i.isPresenting&&console.warn("THREE.WebXRManager: Cannot change reference space type while presenting.")},this.getReferenceSpace=function(){return o||a},this.setReferenceSpace=function(e){o=e},this.getBaseLayer=function(){return null!==u?u:c},this.getBinding=function(){return h},this.getFrame=function(){return d}
186,this.getSession=function(){return n},this.setSession=async function(l){if(null!==(n=l)){if(f=e.getRenderTarget(),n.addEventListener("select",w),n.addEventListener("selectstart",w),n.addEventListener("selectend",w),n.addEventListener("squeeze",w),n.addEventListener("squeezestart",w),n.addEventListener("squeezeend",w),n.addEventListener("end",T),n.addEventListener("inputsourceschange",E),!0!==p.xrCompatible&&await t.makeXRCompatible(),void 0===n.renderState.layers||!1===e.capabilities.isWebGL2){let d={antialias:void 0!==n.renderState.layers||p.antialias,alpha:p.alpha,depth:p.depth,stencil:p.stencil,framebufferScaleFactor:r};c=new XRWebGLLayer(n,t,d),n.updateRenderState({baseLayer:c}),m=new ep(c.framebufferWidth,c.framebufferHeight,{format:1023,type:1009,encoding:e.outputEncoding})}else{let g=null,v=null,_=null;p.depth&&(_=p.stencil?35056:33190,g=p.stencil?1027:1026,v=p.stencil?1020:1014);let x={colorFormat:32856,depthFormat:_,scaleFactor:r};u=(h=new XRWebGLBinding(n,t)).createProjectionLayer(x),n.updateRenderState({layers:[u]}),m=new ep(u.textureWidth,u.textureHeight,{format:1023,type:1009,depthTexture:new r_(u.textureWidth,u.textureHeight,v,void 0,void 0,void 0,void 0,void 0,void 0,g),stencilBuffer:p.stencil,encoding:e.outputEncoding,samples:p.antialias?4:0});let y=e.properties.get(m);y.__ignoreDepthValues=u.ignoreDepthValues}m.isXRRenderTarget=!0,this.setFoveation(1),o=null,a=await n.requestReferenceSpace(s),R.setContext(n),R.start(),i.isPresenting=!0,i.dispatchEvent({type:"sessionstart"})}};let A=new eg,C=new eg;function L(e,t){null===t?e.matrixWorld.copy(e.matrix):e.matrixWorld.multiplyMatrices(t.matrixWorld,e.matrix),e.matrixWorldInverse.copy(e.matrixWorld).invert()}this.updateCamera=function(e){if(null===n)return;M.near=x.near=_.near=e.near,M.far=x.far=_.far=e.far,(b!==M.near||S!==M.far)&&(n.updateRenderState({depthNear:M.near,depthFar:M.far}),b=M.near,S=M.far);let t=e.parent,i=M.cameras;L(M,t);for(let r=0;r<i.length;r++)L(i[r],t);M.matrixWorld.decompose(M.position,M.quaternion,M.scale),e.position.copy(M.position),e.quaternion.copy(M.quaternion),e.scale.copy(M.scale),e.matrix.copy(M.matrix),e.matrixWorld.copy(M.matrixWorld);let a=e.children;for(let s=0,o=a.length;s<o;s++)a[s].updateMatrixWorld(!0);2===i.length?function(e,t,i){A.setFromMatrixPosition(t.matrixWorld),C.setFromMatrixPosition(i.matrixWorld);let n=A.distanceTo(C),r=t.projectionMatrix.elements,a=i.projectionMatrix.elements,s=r[14]/(r[10]-1),o=r[14]/(r[10]+1),l=(r[9]+1)/r[5],h=(r[9]-1)/r[5],u=(r[8]-1)/r[0],c=(a[8]+1)/a[0],d=n/(-u+c),p=-(d*u);t.matrixWorld.decompose(e.position,e.quaternion,e.scale),e.translateX(p),e.translateZ(d),e.matrixWorld.compose(e.position,e.quaternion,e.scale),e.matrixWorldInverse.copy(e.matrixWorld).invert();let f=s+d,m=o+d;e.projectionMatrix.makePerspective(s*u-p,s*c+(n-p),l*o/m*f,h*o/m*f,f,m)}(M,_,x):M.projectionMatrix.copy(_.projectionMatrix)},this.getCamera=function(){return M},this.getFoveation=function(){return null!==u?u.fixedFoveation:null!==c?c.fixedFoveation:void 0},this.setFoveation=function(e){null!==u&&(u.fixedFoveation=e),null!==c&&void 0!==c.fixedFoveation&&(c.fixedFoveation=e)};let P=null,R=new iu;R.setAnimationLoop(function(t,i){if(l=i.getViewerPose(o||a),d=i,null!==l){let n=l.views;null!==c&&(e.setRenderTargetFramebuffer(m,c.framebuffer),e.setRenderTarget(m));let r=!1;n.length!==M.cameras.length&&(M.cameras.length=0,r=!0);for(let s=0;s<n.length;s++){let p=n[s],f=null;if(null!==c)f=c.getViewport(p);else{let _=h.getViewSubImage(u,p);f=_.viewport,0===s&&(e.setRenderTargetTextures(m,_.colorTexture,u.ignoreDepthValues?void 0:_.depthStencilTexture),e.setRenderTarget(m))}let x=y[s];void 0===x&&((x=new t8).layers.enable(s),x.viewport=new ed,y[s]=x),x.matrix.fromArray(p.transform.matrix),x.projectionMatrix.fromArray(p.projectionMatrix),x.viewport.set(f.x,f.y,f.width,f.height),0===s&&M.matrix.copy(x.matrix),!0===r&&M.cameras.push(x)}}for(let b=0;b<g.length;b++){let S=v[b],w=g[b];null!==S&&void 0!==w&&w.update(S,i,o||a)}P&&P(t,i),d=null}),this.setAnimationLoop=function(e){P=e},this.dispose=function(){}}}function ry(e,t){function i(i,n){i.opacity.value=n.opacity,n.color&&i.diffuse.value.copy(n.
186color),n.emissive&&i.emissive.value.copy(n.emissive).multiplyScalar(n.emissiveIntensity),n.map&&(i.map.value=n.map),n.alphaMap&&(i.alphaMap.value=n.alphaMap),n.bumpMap&&(i.bumpMap.value=n.bumpMap,i.bumpScale.value=n.bumpScale,n.side===o&&(i.bumpScale.value*=-1)),n.displacementMap&&(i.displacementMap.value=n.displacementMap,i.displacementScale.value=n.displacementScale,i.displacementBias.value=n.displacementBias),n.emissiveMap&&(i.emissiveMap.value=n.emissiveMap),n.normalMap&&(i.normalMap.value=n.normalMap,i.normalScale.value.copy(n.normalScale),n.side===o&&i.normalScale.value.negate()),n.specularMap&&(i.specularMap.value=n.specularMap),n.alphaTest>0&&(i.alphaTest.value=n.alphaTest);let r=t.get(n).envMap;if(r&&(i.envMap.value=r,i.flipEnvMap.value=r.isCubeTexture&&!1===r.isRenderTargetTexture?-1:1,i.reflectivity.value=n.reflectivity,i.ior.value=n.ior,i.refractionRatio.value=n.refractionRatio),n.lightMap){i.lightMap.value=n.lightMap;let a=!0!==e.physicallyCorrectLights?Math.PI:1;i.lightMapIntensity.value=n.lightMapIntensity*a}n.aoMap&&(i.aoMap.value=n.aoMap,i.aoMapIntensity.value=n.aoMapIntensity);let s;n.map?s=n.map:n.specularMap?s=n.specularMap:n.displacementMap?s=n.displacementMap:n.normalMap?s=n.normalMap:n.bumpMap?s=n.bumpMap:n.roughnessMap?s=n.roughnessMap:n.metalnessMap?s=n.metalnessMap:n.alphaMap?s=n.alphaMap:n.emissiveMap?s=n.emissiveMap:n.clearcoatMap?s=n.clearcoatMap:n.clearcoatNormalMap?s=n.clearcoatNormalMap:n.clearcoatRoughnessMap?s=n.clearcoatRoughnessMap:n.iridescenceMap?s=n.iridescenceMap:n.iridescenceThicknessMap?s=n.iridescenceThicknessMap:n.specularIntensityMap?s=n.specularIntensityMap:n.specularColorMap?s=n.specularColorMap:n.transmissionMap?s=n.transmissionMap:n.thicknessMap?s=n.thicknessMap:n.sheenColorMap?s=n.sheenColorMap:n.sheenRoughnessMap&&(s=n.sheenRoughnessMap),void 0!==s&&(s.isWebGLRenderTarget&&(s=s.texture),!0===s.matrixAutoUpdate&&s.updateMatrix(),i.uvTransform.value.copy(s.matrix));let l;n.aoMap?l=n.aoMap:n.lightMap&&(l=n.lightMap),void 0!==l&&(l.isWebGLRenderTarget&&(l=l.texture),!0===l.matrixAutoUpdate&&l.updateMatrix(),i.uv2Transform.value.copy(l.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,n,r,a,s){var l,h,u,c,d,p,f,m,g,v,_,x,y,M,b,S,w,T,E,A,C;let L,P;n.isMeshBasicMaterial?i(e,n):n.isMeshLambertMaterial?i(e,n):n.isMeshToonMaterial?(i(e,n),l=e,(h=n).gradientMap&&(l.gradientMap.value=h.gradientMap)):n.isMeshPhongMaterial?(i(e,n),u=e,c=n,u.specular.value.copy(c.specular),u.shininess.value=Math.max(c.shininess,1e-4)):n.isMeshStandardMaterial?(i(e,n),function(e,i){e.roughness.value=i.roughness,e.metalness.value=i.metalness,i.roughnessMap&&(e.roughnessMap.value=i.roughnessMap),i.metalnessMap&&(e.metalnessMap.value=i.metalnessMap);let n=t.get(i).envMap;n&&(e.envMapIntensity.value=i.envMapIntensity)}(e,n),n.isMeshPhysicalMaterial&&(d=e,p=n,f=s,d.ior.value=p.ior,p.sheen>0&&(d.sheenColor.value.copy(p.sheenColor).multiplyScalar(p.sheen),d.sheenRoughness.value=p.sheenRoughness,p.sheenColorMap&&(d.sheenColorMap.value=p.sheenColorMap),p.sheenRoughnessMap&&(d.sheenRoughnessMap.value=p.sheenRoughnessMap)),p.clearcoat>0&&(d.clearcoat.value=p.clearcoat,d.clearcoatRoughness.value=p.clearcoatRoughness,p.clearcoatMap&&(d.clearcoatMap.value=p.clearcoatMap),p.clearcoatRoughnessMap&&(d.clearcoatRoughnessMap.value=p.clearcoatRoughnessMap),p.clearcoatNormalMap&&(d.clearcoatNormalScale.value.copy(p.clearcoatNormalScale),d.clearcoatNormalMap.value=p.clearcoatNormalMap,p.side===o&&d.clearcoatNormalScale.value.negate())),p.iridescence>0&&(d.iridescence.value=p.iridescence,d.iridescenceIOR.value=p.iridescenceIOR,d.iridescenceThicknessMinimum.value=p.iridescenceThicknessRange[0],d.iridescenceThicknessMaximum.value=p.iridescenceThicknessRange[1],p.iridescenceMap&&(d.iridescenceMap.value=p.iridescenceMap),p.iridescenceThicknessMap&&(d.iridescenceThicknessMap.value=p.iridescenceThicknessMap)),p.transmission>0&&(d.transmission.value=p.transmission,d.transmissionSamplerMap.value=f.texture,d.transmissionSamplerSize.value.set(f.width,f.height),p.transmissionMap&&(d.transmissionMap.value=p.transmissionMap),d.thickness.value=p.thickness,p.thicknessMap&&(d.thicknessMap.value=p.thicknessMap),d.attenuationDistance.value=p.attenuationDistance,d.attenuationColor.value.copy(p.attenuationColor)),d.specularIntensity.value=p.specularIntensity,d.specularColor.value.copy(p.specularColor),p.specularIntensityMap&&(d.specularIntensityMap.value=p.specularIntensityMap),p.specularColorMap&&(d.specularColorMap.value=p.specularColorMap))):n.isMeshMat
186capMaterial?(i(e,n),m=e,(g=n).matcap&&(m.matcap.value=g.matcap)):n.isMeshDepthMaterial?i(e,n):n.isMeshDistanceMaterial?(i(e,n),v=e,_=n,v.referencePosition.value.copy(_.referencePosition),v.nearDistance.value=_.nearDistance,v.farDistance.value=_.farDistance):n.isMeshNormalMaterial?i(e,n):n.isLineBasicMaterial?(x=e,y=n,x.diffuse.value.copy(y.color),x.opacity.value=y.opacity,n.isLineDashedMaterial&&(M=e,b=n,M.dashSize.value=b.dashSize,M.totalSize.value=b.dashSize+b.gapSize,M.scale.value=b.scale)):n.isPointsMaterial?(S=e,w=n,T=r,E=a,S.diffuse.value.copy(w.color),S.opacity.value=w.opacity,S.size.value=w.size*T,S.scale.value=.5*E,w.map&&(S.map.value=w.map),w.alphaMap&&(S.alphaMap.value=w.alphaMap),w.alphaTest>0&&(S.alphaTest.value=w.alphaTest),w.map?L=w.map:w.alphaMap&&(L=w.alphaMap),void 0!==L&&(!0===L.matrixAutoUpdate&&L.updateMatrix(),S.uvTransform.value.copy(L.matrix))):n.isSpriteMaterial?(A=e,C=n,A.diffuse.value.copy(C.color),A.opacity.value=C.opacity,A.rotation.value=C.rotation,C.map&&(A.map.value=C.map),C.alphaMap&&(A.alphaMap.value=C.alphaMap),C.alphaTest>0&&(A.alphaTest.value=C.alphaTest),C.map?P=C.map:C.alphaMap&&(P=C.alphaMap),void 0!==P&&(!0===P.matrixAutoUpdate&&P.updateMatrix(),A.uvTransform.value.copy(P.matrix))):n.isS
186hadowMaterial?(e.color.value.copy(n.color),e.opacity.value=n.opacity):n.isShaderMaterial&&(n.uniformsNeedUpdate=!1)}}}function rM(e,t,i,n){let r={},a={},s=[],o=i.isWebGL2?e.getParameter(35375):0;function l(e,t,i){let n=e.value;if(void 0===i[t])return"number"==typeof n?i[t]=n:i[t]=n.clone(),!0;if("number"==typeof n){if(i[t]!==n)return i[t]=n,!0}else{let r=i[t];if(!1===r.equals(n))return r.copy(n),!0}return!1}function h(e){let t=e.value,i={boundary:0,storage:0};return"number"==typeof t?(i.boundary=4,i.storage=4):t.isVector2?(i.boundary=8,i.storage=8):t.isVector3||t.isColor?(i.boundary=16,i.storage=12):t.isVector4?(i.boundary=16,i.storage=16):t.isMatrix3?(i.boundary=48,i.storage=48):t.isMatrix4?(i.boundary=64,i.storage=64):t.isTexture?console.warn("THREE.WebGLRenderer: Texture samplers can not be part of an uniforms group."):console.warn("THREE.WebGLRenderer: Unsupported uniform value type.",t),i}function u(t){let i=t.target;i.removeEventListener("dispose",u);let n=s.indexOf(i.__bindingPointIndex);s.splice(n,1),e.deleteBuffer(r[i.id]),delete r[i.id],delete a[i.id]}return{bind:function(e,t){let i=t.program;n.uniformBlockBinding(e,i)},update:function(i,c){let d=r[i.id];void 0===d&&(function(e){let t=e.uniforms,i=0,n=0;for(let r=0,a=t.length;r<a;r++){let s=t[r],o=h(s);if(s.__data=new Float32Array(o.storage/Float32Array.BYTES_PER_ELEMENT),s.__offset=i,r>0){n=i%16;let l=16-n;0!==n&&l-o.boundary<0&&(i+=16-n,s.__offset=i)}i+=o.storage}(n=i%16)>0&&(i+=16-n),e.__size=i,e.__cache={},this}(i),d=function(t){let i=function(){for(let e=0;e<o;e++)if(-1===s.indexOf(e))return s.push(e),e;return console.error("THREE.WebGLRenderer: Maximum number of simultaneously usable uniforms groups reached."),0}();t.__bindingPointIndex=i;let n=e.createBuffer(),r=t.__size,a=t.usage;return e.bindBuffer(35345,n),e.bufferData(35345,r,a),e.bindBuffer(35345,null),e.bindBufferBase(35345,i,n),n}(i),r[i.id]=d,i.addEventListener("dispose",u));let p=c.program;n.updateUBOMapping(i,p);let f=t.render.frame;a[i.id]!==f&&(function(t){let i=r[t.id],n=t.uniforms,a=t.__cache;e.bindBuffer(35345,i);for(let s=0,o=n.length;s<o;s++){let h=n[s];if(!0===l(h,s,a)){let u=h.value,c=h.__offset;"number"==typeof u?(h.__data[0]=u,e.bufferSubData(35345,c,h.__data)):(h.value.isMatrix3?(h.__data[0]=h.value.elements[0],h.__data[1]=h.value.elements[1],h.__data[2]=h.value.elements[2],h.__data[3]=h.value.elements[0],h.__data[4]=h.value.elements[3],h.__data[5]=h.value.elements[4],h.__data[6]=h.value.elements[5],h.__data[7]=h.value.elements[0],h.__data[8]=h.value.elements[6],h.__data[9]=h.value.elements[7],h.__data[10]=h.value.elements[8],h.__data[11]=h.value.elements[0]):u.toArray(h.__data),e.bufferSubData(35345,c,h.__data))}}e.bindBuffer(35345,null)}(i),a[i.id]=f)},dispose:function(){for(let t in r)e.deleteBuffer(r[t]);s=[],r={},a={}}}}function rb(e={}){this.isWebGLRenderer=!0;let t=void 0!==e.canvas?e.canvas:function(){let e=Y("canvas");return e.style.display="block",e}(),i=void 0!==e.context?e.context:null,n=void 0===e.depth||e.depth,r=void 0===e.stencil||e.stencil,a=void 0!==e.antialias&&e.antialias,h=void 0===e.premultipliedAlpha||e.premultipliedAlpha,u=void 0!==e.preserveDrawingBuffer&&e.preserveDrawingBuffer,c=void 0!==e.powerPreference?e.powerPreference:"default",d=void 0!==e.failIfMajorPerformanceCaveat&&e.failIfMajorPerformanceCaveat,p;p=null!==i?i.getContextAttributes().alpha:void 0!==e.alpha&&e.alpha;let f=null,m=null,g=[],v=[];this.domElement=t,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=3e3,this.physicallyCorrectLights=!1,this.toneMapping=0,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.")}}});let _=this,y=!1,M=0,b=0,S=null,w=-1,T=null,E=new ed,A=new ed,C=null,L=t.width,P=t.height,R=1,D=null,I=null,N=new ed(0,0,L,P),O=new ed(0,0,L,P),z=!1,U=new ih,F=!1,B=!1,k=null,V=new eX,G=new j,W=new eg,q={background:null,fog:null,environment:null,overrideMaterial:null,isScene:!0};function X(){return null===S?R:1}let Z=i;function J(e,i){for(let n=0;n<e.length;n++){let r=e[n],a=t.getContext(r,i);if(null!==a)return a}return null}try{if("setAttribute"in t&&t.setAttribute("data-engine","three.js r143"),t.addEventListener("webglcontextlost",eC,!1),t.addEventListener("webglcontextrestored",eL,!1),t.addEventListener("webglcontextcreationerror",eP,!1),null===Z){let K=["webgl2","webgl","experimental-webgl"];if(!0===_.isWebGL1Renderer&&K.shift(),Z=J(K,{alpha:!0,depth:n,stencil:r,antialias:a,premultipliedAlpha:h,preserveDrawingBuffer:u,powerPreference:c,failIfMajorPerformanceCaveat:d}),null===Z){if(J(K))throw Error("Error creating WebGL context with your selected attributes.");throw Error("Error creating WebGL context.")}}void 0===Z.getShaderPrecisionFormat&&(Z.getShaderPrecisionFormat=function(){return{rangeMin:1,rangeMax:1,precision:1}})}catch(Q){throw console.error("THREE.WebGLRenderer: "+Q.message),Q}let $,ee,et,ei,en,er,ea,es,eo,el,eh,eu,ec,ef,em,ev,e_,ex,ey,eM,eb,eS,ew,eT;function eE(){$=new iF(Z),ee=new iy(Z,$,e),$.init(ee),eS=new rp(Z,$,ee),et=new rc(Z,$,ee),ei=new iV,en=new n7,er=new rd(Z,$,et,en,ee,eS,ei),ea=new ib(_),es=new iU(_),eo=new ic(Z,ee),ew=new i_(Z,$,eo,ee),el=new iB(Z,eo,ei,ew),eh=new iq(Z,el,eo,ei),ey=new ij(Z,ee,er),ev=new iM(en),eu=new n6(_,ea,es,$,ee,ew,ev),ec=new ry(_,en),ef=new rt,em=new ro($,ee),ex=new iv(_,ea,et,eh,p,h),e_=new ru(_,eh,ee),eT=new rM(Z,ei,ee,et),eM=new ix(Z,$,ei,ee),eb=new ik(Z,$,ei,ee),ei.programs=eu.programs,_.capabilities=ee,_.extensions=$,_.properties=en,_.renderLists=ef,_.shadowMap=e_,_.state=et,_.info=ei}eE();let eA=new rx(_,Z);function eC(e){e.preventDefault(),console.log("THREE.WebGLRenderer: Context Lost."),y=!0}function eL(){console.log("THREE.WebGLRenderer: Context Restored."),y=!1;let e=ei.autoReset,t=e_.enabled,i=e_.autoUpdate,n=e_.needsUpdate,r=e_.type;eE(),ei.autoReset=e,e_.enabled=t,e_.autoUpdate=i,e_.needsUpdate=n,e_.type=r}function eP(e){console.error("THREE.WebGLRenderer: A WebGL context could not be created. Reason: ",e.statusMessage)}function eR(e){var t;let i=e.target;i.removeEventListener("dispose",eR),function(e){let t=en.get(e).programs;void 0!==t&&(t.forEach(function(e){eu.releaseProgram(e)}),e.isShaderMaterial&&eu.releaseShaderCache(e))}(t=i),en.remove(t)}this.xr=eA,this.getContext=function(){return Z},this.getContextAttributes=function(){return Z.getContextAttributes()},this.forceContextLoss=function(){let e=$.get("WEBGL_lose_context");e&&e.loseContext()},this.forceContextRestore=function(){let e=$.get("WEBGL_lose_context");e&&e.restoreContext()},this.getPixelRatio=function(){return R},this.setPixelRatio=function(e){void 0!==e&&(R=e,this.setSize(L,P,!1))}
186,this.getSize=function(e){return e.set(L,P)},this.setSize=function(e,i,n){if(eA.isPresenting){console.warn("THREE.WebGLRenderer: Can't change size while VR device is presenting.");return}L=e,P=i,t.width=Math.floor(e*R),t.height=Math.floor(i*R),!1!==n&&(t.style.width=e+"px",t.style.height=i+"px"),this.setViewport(0,0,e,i)},this.getDrawingBufferSize=function(e){return e.set(L*R,P*R).floor()},this.setDrawingBufferSize=function(e,i,n){L=e,P=i,R=n,t.width=Math.floor(e*n),t.height=Math.floor(i*n),this.setViewport(0,0,e,i)},this.getCurrentViewport=function(e){return e.copy(E)},this.getViewport=function(e){return e.copy(N)},this.setViewport=function(e,t,i,n){e.isVector4?N.set(e.x,e.y,e.z,e.w):N.set(e,t,i,n),et.viewport(E.copy(N).multiplyScalar(R).floor())},this.getScissor=function(e){return e.copy(O)},this.setScissor=function(e,t,i,n){e.isVector4?O.set(e.x,e.y,e.z,e.w):O.set(e,t,i,n),et.scissor(A.copy(O).multiplyScalar(R).floor())},this.getScissorTest=function(){return z},this.setScissorTest=function(e){et.setScissorTest(z=e)},this.setOpaqueSort=function(e){D=e},this.setTransparentSort=function(e){I=e},this.getClearColor=function(e){return e.copy(ex.getClearColor())},this.setClearColor=function(){ex.setClearColor.apply(ex,arguments)},this.getClearAlpha=function(){return ex.getClearAlpha()},this.setClearAlpha=function(){ex.setClearAlpha.apply(ex,arguments)},this.clear=function(e=!0,t=!0,i=!0){let n=0;e&&(n|=16384),t&&(n|=256),i&&(n|=1024),Z.clear(n)},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(){t.removeEventListener("webglcontextlost",eC,!1),t.removeEventListener("webglcontextrestored",eL,!1),t.removeEventListener("webglcontextcreationerror",eP,!1),ef.dispose(),em.dispose(),en.dispose(),ea.dispose(),es.dispose(),eh.dispose(),ew.dispose(),eT.dispose(),eu.dispose(),eA.dispose(),eA.removeEventListener("sessionstart",eI),eA.removeEventListener("sessionend",eN),k&&(k.dispose(),k=null),eO.stop()},this.renderBufferDirect=function(e,t,i,n,r,a){null===t&&(t=q);let s=r.isMesh&&0>r.matrixWorld.determinant(),o=function(e,t,i,n,r){var a,s;!0!==t.isScene&&(t=q),er.resetTextureUnits();let o=t.fog,l=n.isMeshStandardMaterial?t.environment:null,h=null===S?_.outputEncoding:!0===S.isXRRenderTarget?S.texture.encoding:3e3,u=(n.isMeshStandardMaterial?es:ea).get(n.envMap||l),c=!0===n.vertexColors&&!!i.attributes.color&&4===i.attributes.color.itemSize,d=!!n.normalMap&&!!i.attributes.tangent,p=!!i.morphAttributes.position,f=!!i.morphAttributes.normal,g=!!i.morphAttributes.color,v=n.toneMapped?_.toneMapping:0,x=i.morphAttributes.position||i.morphAttributes.normal||i.morphAttributes.color,y=void 0!==x?x.length:0,M=en.get(n),b=m.state.lights;if(!0===F&&(!0===B||e!==T)){let E=e===T&&n.id===w;ev.setState(n,e,E)}let A=!1;n.version===M.__version?M.needsLights&&M.lightsStateVersion!==b.state.version?A=!0:M.outputEncoding!==h?A=!0:r.isInstancedMesh&&!1===M.instancing?A=!0:r.isInstancedMesh||!0!==M.instancing?r.isSkinnedMesh&&
186!1===M.skinning?A=!0:r.isSkinnedMesh||!0!==M.skinning?M.envMap!==u?A=!0:!0===n.fog&&M.fog!==o?A=!0:void 0!==M.numClippingPlanes&&(M.numClippingPlanes!==ev.numPlanes||M.numIntersection!==ev.numIntersection)?A=!0:M.vertexAlphas!==c?A=!0:M.vertexTangents!==d?A=!0:M.morphTargets!==p?A=!0:M.morphNormals!==f?A=!0:M.morphColors!==g?A=!0:M.toneMapping!==v?A=!0:!0===ee.isWebGL2&&M.morphTargetsCount!==y&&(A=!0):A=!0:A=!0:(A=!0,M.__version=n.version);let C=M.currentProgram;!0===A&&(C=eB(n,t,r));let L=!1,D=!1,I=!1,N=C.getUniforms(),O=M.uniforms;if(et.useProgram(C.program)&&(L=!0,D=!0,I=!0),n.id!==w&&(w=n.id,D=!0),L||T!==e){if(N.setValue(Z,"projectionMatrix",e.projectionMatrix),ee.logarithmicDepthBuffer&&N.setValue(Z,"logDepthBufFC",2/(Math.log(e.far+1)/Math.LN2)),T!==e&&(T=e,D=!0,I=!0),n.isShaderMaterial||n.isMeshPhongMaterial||n.isMeshToonMaterial||n.isMeshStandardMaterial||n.envMap){let z=N.map.cameraPosition;void 0!==z&&z.setValue(Z,W.setFromMatrixPosition(e.matrixWorld))}(n.isMeshPhongMaterial||n.isMeshToonMaterial||n.isMeshLambertMaterial||n.isMeshBasicMaterial||n.isMeshStandardMaterial||n.isShaderMaterial)&&N.setValue(Z,"isOrthographic",!0===e.isOrthographicCamera),(n.isMeshPhongMaterial||n.isMeshToonMaterial||n.isMeshLambertMaterial||n.isMeshBasicMaterial||n.isMeshStandardMaterial||n.isShaderMaterial||n.isShadowMaterial||r.isSkinnedMesh)&&N.setValue(Z,"viewMatrix",e.matrixWorldInverse)}if(r.isSkinnedMesh){N.setOptional(Z,r,"bindMatrix"),N.setOptional(Z,r,"bindMatrixInverse");let U=r.skeleton;U&&(ee.floatVertexTextures?(null===U.boneTexture&&U.computeBoneTexture(),N.setValue(Z,"boneTexture",U.boneTexture,er),N.setValue(Z,"boneTextureSize",U.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."))}let V=i.morphAttributes;if((void 0!==V.position||void 0!==V.normal||void 0!==V.color&&!0===ee.isWebGL2)&&ey.update(r,i,n,C),(D||M.receiveShadow!==r.receiveShadow)&&(M.receiveShadow=r.receiveShadow,N.setValue(Z,"receiveShadow",r.receiveShadow)),D&&(N.setValue(Z,"toneMappingExposure",_.toneMappingExposure),M.needsLights&&(a=O,s=I,a.ambientLightColor.needsUpdate=s,a.lightProbe.needsUpdate=s,a.directionalLights.needsUpdate=s,a.directionalLightShadows.needsUpdate=s,a.pointLights.needsUpdate=s,a.pointLightShadows.needsUpdate=s,a.spotLights.needsUpdate=s,a.spotLightShadows.needsUpdate=s,a.rectAreaLights.needsUpdate=s,a.hemisphereLights.needsUpdate=s),o&&!0===n.fog&&ec.refreshFogUniforms(O,o),ec.refreshMaterialUniforms(O,n,R,P,k),nk.upload(Z,M.uniformsList,O,er)),n.isShaderMaterial&&!0===n.uniformsNeedUpdate&&(nk.upload(Z,M.uniformsList,O,er),n.uniformsNeedUpdate=!1),n.isSpriteMaterial&&N.setValue(Z,"center",r.center),N.setValue(Z,"modelViewMatrix",r.modelViewMatrix),N.setValue(Z,"normalMatrix",r.normalMatrix),N.setValue(Z,"modelMatrix",r.matrixWorld),n.isShaderMaterial||n.isRawShaderMaterial){let G=n.uniformsGroups;for(let H=0,j=G.length;H<j;H++)if(ee.isWebGL2){let X=G[H];eT.update(X,C),eT.bind(X,C)}else console.warn("THREE.WebGLRenderer: Uniform Buffer Objects can only be used with WebGL 2.")}return C}(e,t,i,n,r);et.setMaterial(n,s);let l=i.index,h=i.attributes.position;if(null===l){if(void 0===h||0===h.count)return}else if(0===l.count)return;let u=1;!0===n.wireframe&&(l=el.getWireframeAttribute(i),u=2),ew.setup(r,n,o,i,l);let c,d=eM;null!==l&&(c=eo.get(l),(d=eb).setIndex(c));let p=null!==l?l.count:h.count,f=i.drawRange.start*u,g=i.drawRange.count*u,v=null!==a?a.start*u:0,x=null!==a?a.count*u:1/0,y=Math.max(f,v),M=Math.max(0,Math.min(p,f+g,v+x)-1-y+1);if(0!==M){if(r.isMesh)!0===n.wireframe?(et.setLineWidth(n.wireframeLinewidth*X()),d.setMode(1)):d.setMode(4);else if(r.isLine){let b=n.linewidth;void 0===b&&(b=1),et.setLineWidth(b*X()),r.isLineSegments?d.setMode(1):r.isLineLoop?d.setMode(2):d.setMode(3)}else r.isPoints?d.setMode(0):r.isSprite&&d.setMode(4);if(r.isInstancedMesh)d.renderInstances(y,M,r.count);else if(i.isInstancedBufferGeometry){let E=Math.min(i.instanceCount,i._maxInstanceCount);d.renderInstances(y,M,E)}else d.render(y,M)}},this.compile=function(e,t){(m=em.get(e)).init(),v.push(m),e.traverseVisible(function(e){e.isLight&&e.layers.test(t.layers)&&(m.pushLight(e),e.castShadow&&m.pushShadow(e))}),m.setupLights(_.physicallyCorrectLights),e.traverse(function(t){let i=t.material;if(i){if(Array.isArray(i))for(let n=0;n<i.length;n++){let r=i[n];eB(r,e,t)}else eB(i,e,t)}}),v.pop(),m=null};let eD=null;function eI(){eO.stop()}function eN(){eO.start()}let eO=new iu;function ez(e,t,i,n){let r=e.opaque,s=e.transmissive,o=e.transparent;m.setupLightsView(i),s.length>0&&function(e,t,i){let n=ee.isWebGL2;null===k&&(k=new ep(1,1,{generateMipmaps:!0,type:$.has("EXT_color_buffer_half_float")?1016:1009,minFilter:x,samples:n&&!0===a?4:0})),_.getDrawingBufferSize(G),n?k.setSize(G.x,G.y):k.setSize(H(G.x),H(G.y));let r=_.getRenderTarget();_.setRenderTarget(k),_.clear();let s=_.toneMapping;_.toneMapping=0,eU(e,t,i),_.toneMapping=s,er.updateMultisampleRenderTarget(k),er.updateRenderTargetMipmap(k),_.setRenderTarget(r)}(r,t,i),n&&et.viewport(E.copy(n)),r.length>0&&eU(r,t,i),s.length>0&&eU(s,t,i),o.length>0&&eU(o,t,i),et.buffers.depth.setTest(!0),et.buffers.depth.setMask(!0),et.buffers.color.setMask(!0),et.setPolygonOffset(!1)}function eU(e,t,i){let n=!0===t.isScene?t.overrideMaterial:null;for(let r=0,a=e.length;r<a;r++){let s=e[r],o=s.object,l=s.geometry,h=null===n?s.material:n,u=s.group;o.layers.test(i.layers)&&eF(o,t,i,l,h,u)}}function eF(e,t,i,n,r,a){e.onBeforeRender(_,t,i,n,r,a),e.modelViewMatrix.multiplyMatrices(i.matrixWorldInverse,e.matrixWorld),e.normalMatrix.getNormalMatrix(e.modelViewMatrix),r.onBeforeRender(_,t,i,n,e,a),!0===r.transparent&&r.side===l?(r.side=o,r.needsUpdate=!0,_.renderBufferDirect(i,t,n,r,e,a),r.side=s,r.needsUpdate=!0,_.renderBufferDirect(i,t,n,r,e,a),r.side=l):_.renderBufferDirect(i,t,n,r,e,a),e.onAfterRender(_,t,i,n,r,a)}function eB(e,t,i){var n;!0!==t.isScene&&(t=q);let r=en.get(e),a=m.state.lights,s=m.state.shadowsArray,o=a.state.ver
186sion,l=eu.getParameters(e,a.state,s,t,i),h=eu.getProgramCacheKey(l),u=r.programs;r.environment=e.isMeshStandardMaterial?t.environment:null,r.fog=t.fog,r.envMap=(e.isMeshStandardMaterial?es:ea).get(e.envMap||r.environment),void 0===u&&(e.addEventListener("dispose",eR),u=new Map,r.programs=u);let c=u.get(h);if(void 0!==c){if(r.currentProgram===c&&r.lightsStateVersion===o)return ek(e,l),c}else l.uniforms=eu.getUniforms(e),e.onBuild(i,l,_),e.onBeforeCompile(l,_),c=eu.acquireProgram(l,h),u.set(h,c),r.uniforms=l.uniforms;let d=r.uniforms;(e.isShaderMaterial||e.isRawShaderMaterial)&&!0!==e.clipping||(d.clippingPlanes=ev.uniform),ek(e,l),r.needsLights=(n=e,n.isMeshLambertMaterial||n.isMeshToonMaterial||n.isMeshPhongMaterial||n.isMeshStandardMaterial||n.isShadowMaterial||n.isShaderMaterial&&!0===n.lights),r.lightsStateVersion=o,r.needsLights&&(d.ambientLightColor.value=a.state.ambient,d.lightProbe.value=a.state.probe,d.directionalLights.value=a.state.directional,d.directionalLightShadows.value=a.state.directionalShadow,d.spotLights.value=a.state.spot,d.spotLightShadows.value=a.state.spotShadow,d.rectAreaLights.value=a.state.rectArea,d.ltc_1.value=a.state.rectAreaLTC1,d.ltc_2.value=a.state.rectAreaLTC2,d.pointLights.value=a.state.point,d.pointLightShadows.value=a.state.pointShadow,d.hemisphereLights.value=a.state.hemi,d.directionalShadowMap.value=a.state.directionalShadowMap,d.directionalShadowMatrix.value=a.state.directionalShadowMatrix,d.spotShadowMap.value=a.state.spotShadowMap,d.spotShadowMatrix.value=a.state.spotShadowMatrix,d.pointShadowMap.value=a.state.pointShadowMap,d.pointShadowMatrix.value=a.state.pointShadowMatrix);let p=c.getUniforms(),f=nk.seqWithValue(p.seq,d);return r.currentProgram=c,r.uniformsList=f,c}function ek(e,t){let i=en.get(e);i.outputEncoding=t.outputEncoding,i.instancing=t.instancing,i.skinning=t.skinning,i.morphTargets=t.morphTargets,i.morphNormals=t.morphNormals,i.morphColors=t.morphColors,i.morphTargetsCount=t.morphTargetsCount,i.numClippingPlanes=t.numClippingPlanes,i.numIntersection=t.numClipIntersection,i.vertexAlphas=t.vertexAlphas,i.vertexTangents=t.vertexTangents,i.toneMapping=t.toneMapping}eO.setAnimationLoop(function(e){eD&&eD(e)}),"undefined"!=typeof self&&eO.setContext(self),this.setAnimationLoop=function(e){eD=e,eA.setAnimationLoop(e),null===e?eO.stop():eO.start()},eA.addEventListener("sessionstart",eI),eA.addEventListener("sessionend",eN),this.render=function(e,t){if(void 0!==t&&!0!==t.isCamera){console.error("THREE.WebGLRenderer.render: camera is not an instance of THREE.Camera.");return}if(!0===y)return;!0===e.autoUpdate&&e.updateMatrixWorld(),null===t.parent&&t.updateMatrixWorld(),!0===eA.enabled&&!0===eA.isPresenting&&(!0===eA.cameraAutoUpdate&&eA.updateCamera(t),t=eA.getCamera()),!0===e.isScene&&e.onBeforeRender(_,e,t,S),(m=em.get(e,v.length)).init(),v.push(m),V.multiplyMatrices(t.projectionMatrix,t.matrixWorldInverse),U.setFromProjectionMatrix(V),B=this.localClippingEnabled,F=ev.init(this.clippingPlanes,B,t),(f=ef.get(e,g.length)).init(),g.push(f),function e(t,i,n,r){if(!1===t.visible)return;let a=t.layers.test(i.layers);if(a){if(t.isGroup)n=t.renderOrder;else if(t.isLOD)!0===t.autoUpdate&&t.update(i);else if(t.isLight)m.pushLight(t),t.castShadow&&m.pushShadow(t);else if(t.isSprite){if(!t.frustumCulled||U.intersectsSprite(t)){r&&W.setFromMatrixPosition(t.matrixWorld).applyMatrix4(V);let s=eh.update(t),o=t.material;o.visible&&f.push(t,s,o,n,W.z,null)}}else if((t.isMesh||t.isLine||t.isPoints)&&(t.isSkinnedMesh&&t.skeleton.frame!==ei.render.frame&&(t.skeleton.update(),t.skeleton.frame=ei.render.frame),!t.frustumCulled||U.intersectsObject(t))){r&&W.setFromMatrixPosition(t.matrixWorld).applyMatrix4(V);let l=eh.update(t),h=t.material;if(Array.isArray(h)){let u=l.groups;for(let c=0,d=u.length;c<d;c++){let p=u[c],g=h[p.materialIndex];g&&g.visible&&f.push(t,l,g,n,W.z,p)}}else h.visible&&f.push(t,l,h,n,W.z,null)}}let v=t.children;for(let _=0,x=v.length;_<x;_++)e(v[_],i,n,r)}(e,t,0,_.sortObjects),f.finish(),!0===_.sortObjects&&f.sort(D,I),!0===F&&ev.beginShadows();let i=m.state.shadowsArray;if(e_.render(i,e,t),!0===F&&ev.endShadows(),!0===this.info.autoReset&&this.info.reset(),ex.render(f,e),m.setupLights(_.physicallyCorrectLights),t.isArrayCamera){let n=t.cameras;for(let r=0,a=n.length;r<a;r++){let s=n[r];ez(f,e,s,s.viewport)}}else ez(f,e,t);null!==S&&(er.updateMultisampleRenderTarget(S),er.updateRenderTargetMipmap(S)),!0===e.isScene&&e.onAfterRender(_,e,t),ew.resetDefaultState(),w=-1,T=null,v.pop(),m=v.length>0?v[v.length-1]:null,g.pop(),f=g.length>0?g[g.length-1]:null},this.getActiveCubeFace=function(){return M},this.getActiveMipmapLevel=function(){return b},this.getRenderTarget=function(){return S},this.setRenderTargetTextures=function(e,t,i){en.get(e.texture).__webglTexture=t,en.get(e.depthTexture).__webglTexture=i;let n=en.get(e);n.__hasExternalTextures=!0,n.__hasExternalTextures&&(n.__autoAllocateDepthBuffer=void 0===i,n.__autoAllocateDepthBuffer||!0!==$.has("WEBGL_multisampled_render_to_texture")||(console.warn("THREE.WebGLRenderer: Render-to-texture extension was disabled because an external texture was provided"),n.__useRenderToTexture=!1))},this.setRenderTargetFramebuffer=function(e,t){let i=en.get(e);i.__webglFramebuffer=t,i.__useDefaultFramebuffer=void 0===t},this.setRenderTarget=function(e,t=0,i=0){S=e,M=t,b=i;let n=!0;if(e){let r=en.get(e);void 0!==r.__useDefaultFramebuffer?(et.bindFramebuffer(36160,null),n=!1):void 0===r.__webglFramebuffer?er.setupRenderTarget(e):r.__hasExternalTextures&&er.rebindTextures(e,en.get(e.texture).__webglTexture,en.get(e.depthTexture).__webglTexture)}let a=null,s=!1,o=!1;if(e){let l=e.texture;(l.isData3DTexture||l.isDataArrayTexture)&&(o=!0);let h=en.get(e).__webglFramebuffer;
186e.isWebGLCubeRenderTarget?(a=h[t],s=!0):a=ee.isWebGL2&&e.samples>0&&!1===er.useMultisampledRTT(e)?en.get(e).__webglMultisampledFramebuffer:h,E.copy(e.viewport),A.copy(e.scissor),C=e.scissorTest}else E.copy(N).multiplyScalar(R).floor(),A.copy(O).multiplyScalar(R).floor(),C=z;let u=et.bindFramebuffer(36160,a);if(u&&ee.drawBuffers&&n&&et.drawBuffers(e,a),et.viewport(E),et.scissor(A),et.setScissorTest(C),s){let c=en.get(e.texture);Z.framebufferTexture2D(36160,36064,34069+t,c.__webglTexture,i)}else if(o){let d=en.get(e.texture);Z.framebufferTextureLayer(36160,36064,d.__webglTexture,i||0,t||0)}w=-1},this.readRenderTargetPixels=function(e,t,i,n,r,a,s){if(!(e&&e.isWebGLRenderTarget)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");return}let o=en.get(e).__webglFramebuffer;if(e.isWebGLCubeRenderTarget&&void 0!==s&&(o=o[s]),o){et.bindFramebuffer(36160,o);try{let l=e.texture,h=l.format,u=l.type;if(1023!==h&&eS.convert(h)!==Z.getParameter(35739)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.");return}let c=1016===u&&($.has("EXT_color_buffer_half_float")||ee.isWebGL2&&$.has("EXT_color_buffer_float"));if(1009!==u&&eS.convert(u)!==Z.getParameter(35738)&&!(1015===u&&(ee.isWebGL2||$.has("OES_texture_float")||$.has("WEBGL_color_buffer_float")))&&!c){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.");return}t>=0&&t<=e.width-n&&i>=0&&i<=e.height-r&&Z.readPixels(t,i,n,r,eS.convert(h),eS.convert(u),a)}finally{let d=null!==S?en.get(S).__webglFramebuffer:null;et.bindFramebuffer(36160,d)}}},this.copyFramebufferToTexture=function(e,t,i=0){let n=Math.pow(2,-i),r=Math.floor(t.image.width*n),a=Math.floor(t.image.height*n);er.setTexture2D(t,0),Z.copyTexSubImage2D(3553,i,0,0,e.x,e.y,r,a),et.unbindTexture()},this.copyTextureToTexture=function(e,t,i,n=0){let r=t.image.width,a=t.image.height,s=eS.convert(i.format),o=eS.convert(i.type);er.setTexture2D(i,0),Z.pixelStorei(37440,i.flipY),Z.pixelStorei(37441,i.premultiplyAlpha),Z.pixelStorei(3317,i.unpackAlignment),t.isDataTexture?Z.texSubImage2D(3553,n,e.x,e.y,r,a,s,o,t.image.data):t.isCompressedTexture?Z.compressedTexSubImage2D(3553,n,e.x,e.y,t.mipmaps[0].width,t.mipmaps[0].height,s,t.mipmaps[0].data):Z.texSubImage2D(3553,n,e.x,e.y,s,o,t.image),0===n&&i.generateMipmaps&&Z.generateMipmap(3553),et.unbindTexture()},this.copyTextureToTexture3D=function(e,t,i,n,r=0){if(_.isWebGL1Renderer){console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: can only be used with WebGL2.");return}let a=e.max.x-e.min.x+1,s=e.max.y-e.min.y+1,o=e.max.z-e.min.z+1,l=eS.convert(n.format),h=eS.convert(n.type),u;if(n.isData3DTexture)er.setTexture3D(n,0),u=32879;else if(n.isDataArrayTexture)er.setTexture2DArray(n,0),u=35866;else{console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: only supports THREE.DataTexture3D and THREE.DataTexture2DArray.");return}Z.pixelStorei(37440,n.flipY),Z.pixelStorei(37441,n.premultiplyAlpha),Z.pixelStorei(3317,n.unpackAlignment);let c=Z.getParameter(3314),d=Z.getParameter(32878),p=Z.getParameter(3316),f=Z.getParameter(3315),m=Z.getParameter(32877),g=i.isCompressedTexture?i.mipmaps[0]:i.image;Z.pixelStorei(3314,g.width),Z.pixelStorei(32878,g.height),Z.pixelStorei(3316,e.min.x),Z.pixelStorei(3315,e.min.y),Z.pixelStorei(32877,e.min.z),i.isDataTexture||i.isData3DTexture?Z.texSubImage3D(u,r,t.x,t.y,t.z,a,s,o,l,h,g.data):i.isCompressedTexture?(console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: untested support for compressed srcTexture."),Z.compressedTexSubImage3D(u,r,t.x,t.y,t.z,a,s,o,l,g.data)):Z.texSubImage3D(u,r,t.x,t.y,t.z,a,s,o,l,h,g),Z.pixelStorei(3314,c),Z.pixelStorei(32878,d),Z.pixelStorei(3316,p),Z.pixelStorei(3315,f),Z.pixelStorei(32877,m),0===r&&n.generateMipmaps&&Z.generateMipmap(u),et.unbindTexture()},this.initTexture=function(e){e.isCubeTexture?er.setTextureCube(e,0):e.isData3DTexture?er.setTexture3D(e,0):e.isDataArrayTexture?er.setTexture2DArray(e,0):er.setTexture2D(e,0),et.unbindTexture()},this.resetState=function(){M=0,b=0,S=null,et.reset(),ew.reset()},"undefined"!=typeof __THREE_DEVTOOLS__&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}(class extends rb{}).prototype.isWebGL1Renderer=!0;class rS{constructor(e,t=1,i=1e3){this.isFog=!0,this.name="",this.color=new ea(e),this.near=t,this.far=i}clone(){return new rS(this.color,this.near,this.far)}toJSON(){return{type:"Fog",color:this.color.getHex(),near:this.near,far:this.far}}}class rw extends tl{constructor(){super(),this.isScene=!0,this.type="Scene",this.background=null,this.environment=null,this.fog=null,this.overrideMaterial=null,this.autoUpdate=!0,"undefined"!=typeof __THREE_DEVTOOLS__&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}copy(e,t){return super.copy(e,t),null!==e.background&&(this.background=e.background.clone()),null!==e.environment&&(this.environment=e.environment.clone()),null!==e.fog&&(this.fog=e.fog.clone()),null!==e.overrideMaterial&&(this.overrideMaterial=e.overrideMaterial.clone()),this.autoUpdate=e.autoUpdate,this.matrixAutoUpdate=e.matrixAutoUpdate,this}toJSON(e){let t=super.toJSON(e);return null!==this.fog&&(t.object.fog=this.fog.toJSON()),t}}class rT{constructor(e,t){this.isInterleavedBuffer=!0,this.array=e,this.stride=t,this.count=void 0!==e?e.length/t:0,this.usage=35044,this.updateRange={offset:0,count:-1},this.version=0,this.uuid=O()}onUploadCallback(){}set needsUpdate(e){!0===e&&this.version++}setUsage(e){return this.usage=e,this}copy(e){return this.array=new e.array.constructor(e.array),this.count=e.count,this.stride=e.stride,this.usage=e.usage,this}copyAt(e,t,i){e*=this.stride,i*=t.stride;for(let n=0,r=this.stride;n<r;n++)this.array[e+n]=t.array[i+n];return this}set(e,t=0){return this.array.set(e,t),this}clone(e){void 0===e.arrayBuffers&&(e.arrayBuffers={}),void 0===this.array.buffer._uuid&&(this.array.buffer._uuid=O()),void 0===e.arrayBuffers[this.array.buffer._uuid]&&(e.arrayBuffers[this.array.buffer._uuid]=this.array.slice(0).buffer);let t=new this.array.constructor(e.arrayBuffers[this.array.buffer._uuid]),i=new this.constructor(t,this.stride);return i.setUsage(this.usage),i}onUpload(e){return this.onUploadCallback=e,this}toJSON(e){return void 0===e.arrayBuffers&&(e.arrayBuffers={}),void 0===this.array.buffer._uuid&&(this.array.buffer._uuid=O()),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}}}let rE=new eg;class rA{constructor(e,t,i,n=!1){this.isInterleavedBufferAttribute=!0,this.name="",this.data=e,this.itemSize=t,this.offset=i,this.normalized=!0===n}get count(){return this.data.count}get array(){return this.data.array}set needsUpdate(e){this.data.needsUpdate=e}applyMatrix4(e){for(let t=0,i=this.data.count;t<i;t++)rE.fromBufferAttribute(this,t),rE.applyMatrix4(e),this.setXYZ(t,rE.x,rE.y,rE.z);return this}applyNormalMatrix(e){for(let t=0,i=this.count;t<i;t++)rE.fromBufferAttribute(this,t),rE.applyNormalMatrix(e),this.setXYZ(t,rE.x,rE.y,rE.z);return this}transformDirection(e){for(let t=0,i=this.count;t<i;t++)rE.fromBufferAttribute(this,t),rE.transformDirection(e),this.setXYZ(t,rE.x,rE.y,rE.z);return this}setX(e,t){return this.data.array[e*this.data.stride+this.offset]=t,this}setY(e,t){return this.data.array[e*this.data.stride+this.offset+1]=t,this}setZ(e,t){return this.data.array[e*this.data.stride+this.offset+2]=t,this}setW(e,t){return this.data.array[e*this.data.stride+this.offset+3]=t,this}getX(e){return this.data.array[e*this.data.stride+this.offset]}getY(e){return this.data.array[e*this.data.stride+this.offset+1]}getZ(e){return this.data.array[e*this.data.stride+this.offset+2]}getW(e){return this.data.array[e*this.data.stride+this.offset+3]}setXY(e,t,i){return e=e*this.data.stride+this.offset,this.data.array[e+0]=t,this.data.array[e+1]=i,this}setXYZ(e,t,i,n){return e=e*this.data.stride+this.offset,this.data.array[e+0]=t,this.data.array[e+1]=i,this.data.array[e+2]=n,this}setXYZW(e,t,i,n,r){return e=e*this.data.stride+this.offset,this.data.array[e+0]=t,this.data.array[e+1]=i,this.data.array[e+2]=n,this.data.array[e+3]=r,this}clone(e){if(void 0!==e)return void 0===e.interleavedBuffers&&(e.interleavedBuffers={}),void 0===e.interleavedBuffers[this.data.uuid]&&(e.interleavedBuffers[this.data.uuid]=this.data.clone(e)),new rA(e.interleavedBuffers[this.data.uuid],this.itemSize,this.offset,this.normalized);{console.log("THREE.InterleavedBufferAttribute.clone(): Cloning an interleaved buffer attribute will deinterleave buffer data.");let t=[];for(let i=0;i<this.count;i++){let n=i*this.data.stride+this.offset;for(let r=0;r<this.itemSize;r++)t.push(this.data.array[n+r])}return new tT(new this.array.constructor(t),this.itemSize,this.normalized)}}toJSON(e){if(void 0!==e)return void 0===e.interleavedBuffers&&(e.interleavedBuffers={}),void 0===e.interleavedBuffers[this.data.uuid]&&(e.interleavedBuffers[this.data.uuid]=this.data.toJSON(e)),{isInterleavedBufferAttribute:!0,itemSize:this.itemSize,data:this.data.uuid,offset:this.offset,normalized:this.normalized};{console.log("THREE.InterleavedBufferAttribute.toJSON(): Serializing an interleaved buffer attribute will deinterleave buffer data.");let t=[];for(let i=0;i<this.count;i++){let n=i*this.data.stride+this.offset;for(let r=0;r<this.itemSize;r++)t.push(this.data.array[n+r])}return{itemSize:this.itemSize,type:this.array.constructor.name,array:t,normalized:this.normalized}}}}let rC=new eg,rL=new ed,rP=new ed,rR=new eg,rD=new eX;class rI extends t0{constructor(e,t){super(e,t),this.isSkinnedMesh=!0,this.type="SkinnedMesh",this.bindMode="attached",this.bindMatrix=new eX,this.bindMatrixInverse=new eX}copy(e,t){return super.copy(e,t),this.bindMode=e.bindMode,this.bindMatrix.copy(e.bindMatrix),this.bindMatrixInverse.copy(e.bindMatrixInverse),this.skeleton=e.skeleton,this}bind(e,t){this.skeleton=e,void 0===t&&(this.updateMatrixWorld(!0),this.skeleton.calculateInverses(),t=this.matrixWorld),this.bindMatrix.copy(t),this.bindMatrixInverse.copy(t).invert()}pose(){this.skeleton.pose()}normalizeSkinWeights(){let e=new ed,t=this.geometry.attributes.skinWeight;for(let i=0,n=t.count;i<n;i++){e.fromBufferAttribute(t,i);let r=1/e.manhattanLength();r!==1/0?e.multiplyScalar(r):e.set(1,0,0,0),t.setXYZW(i,e.x,e.y,e.z,e.w)}}updateMatrixWorld(e){super.updateMatrixWorld(e),"attached"===this.bindMode?this.bindMatrixInverse.copy(this.matrixWorld).invert():"detached"===this.bindMode?this.bindMatrixInverse.copy(this.bindMatrix).invert():console.warn("THREE.SkinnedMesh: Unrecognized bindMode: "+this.bindMode)}boneTransform(e,t){let i=this.skeleton,n=this.geometry;rL.fromBufferAttribute(n.attributes.skinIndex,e),rP.fromBufferAttribute(n.attributes.skinWeight,e),rC.copy(t).applyMatrix4(this.bindMatrix),t.set(0,0,0);for(let r=0;r<4;r++){let a=rP.getComponent(r);if(0!==a){let s=rL.getComponent(r);rD.multiplyMatrices(i.bones[s].matrixWorld,i.boneInverses[s]),t.addScaledVector(rR.copy(rC).applyMatrix4(rD),a)}}
186return t.applyMatrix4(this.bindMatrixInverse)}}class rN extends tl{constructor(){super(),this.isBone=!0,this.type="Bone"}}class rO extends ec{constructor(e=null,t=1,i=1,n,r,a,s,o,l=f,h=f,u,c){super(null,a,s,o,l,h,n,r,u,c),this.isDataTexture=!0,this.image={data:e,width:t,height:i},this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}}let rz=new eX,rU=new eX;class rF{constructor(e=[],t=[]){this.uuid=O(),this.bones=e.slice(0),this.boneInverses=t,this.boneMatrices=null,this.boneTexture=null,this.boneTextureSize=0,this.frame=-1,this.init()}init(){let 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(let i=0,n=this.bones.length;i<n;i++)this.boneInverses.push(new eX)}}calculateInverses(){this.boneInverses.length=0;for(let e=0,t=this.bones.length;e<t;e++){let i=new eX;this.bones[e]&&i.copy(this.bones[e].matrixWorld).invert(),this.boneInverses.push(i)}}pose(){for(let e=0,t=this.bones.length;e<t;e++){let i=this.bones[e];i&&i.matrixWorld.copy(this.boneInverses[e]).invert()}for(let n=0,r=this.bones.length;n<r;n++){let a=this.bones[n];a&&(a.parent&&a.parent.isBone?(a.matrix.copy(a.parent.matrixWorld).invert(),a.matrix.multiply(a.matrixWorld)):a.matrix.copy(a.matrixWorld),a.matrix.decompose(a.position,a.quaternion,a.scale))}}update(){let e=this.bones,t=this.boneInverses,i=this.boneMatrices,n=this.boneTexture;for(let r=0,a=e.length;r<a;r++){let s=e[r]?e[r].matrixWorld:rU;rz.multiplyMatrices(s,t[r]),rz.toArray(i,16*r)}null!==n&&(n.needsUpdate=!0)}clone(){return new rF(this.bones,this.boneInverses)}computeBoneTexture(){let e=Math.sqrt(4*this.bones.length);e=Math.max(e=G(e),4);let t=new Float32Array(e*e*4);t.set(this.boneMatrices);let i=new rO(t,e,e,1023,1015);return i.needsUpdate=!0,this.boneMatrices=t,this.boneTexture=i,this.boneTextureSize=e,this}getBoneByName(e){for(let t=0,i=this.bones.length;t<i;t++){let n=this.bones[t];if(n.name===e)return n}}dispose(){null!==this.boneTexture&&(this.boneTexture.dispose(),this.boneTexture=null)}fromJSON(e,t){this.uuid=e.uuid;for(let i=0,n=e.bones.length;i<n;i++){let r=e.bones[i],a=t[r];void 0===a&&(console.warn("THREE.Skeleton: No bone found with UUID:",r),a=new rN),this.bones.push(a),this.boneInverses.push(new eX().fromArray(e.boneInverses[i]))}return this.init(),this}toJSON(){let e={metadata:{version:4.5,type:"Skeleton",generator:"Skeleton.toJSON"},bones:[],boneInverses:[]};e.uuid=this.uuid;let t=this.bones,i=this.boneInverses;for(let n=0,r=t.length;n<r;n++){let a=t[n];e.bones.push(a.uuid);let s=i[n];e.boneInverses.push(s.toArray())}return e}}class rB extends tM{constructor(e){super(),this.isLineBasicMaterial=!0,this.type="LineBasicMaterial",this.color=new ea(16777215),this.linewidth=1,this.linecap="round",this.linejoin="round",this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.linewidth=e.linewidth,this.linecap=e.linecap,this.linejoin=e.linejoin,this.fog=e.fog,this}}let rk=new eg,rV=new eg,rG=new eX,rH=new eq,rW=new eF;class rj extends tl{constructor(e=new tz,t=new rB){super(),this.isLine=!0,this.type="Line",this.geometry=e,this.material=t,this.updateMorphTargets()}copy(e,t){return super.copy(e,t),this.material=e.material,this.geometry=e.geometry,this}computeLineDistances(){let e=this.geometry;if(null===e.index){let t=e.attributes.position,i=[0];for(let n=1,r=t.count;n<r;n++)rk.fromBufferAttribute(t,n-1),rV.fromBufferAttribute(t,n),i[n]=i[n-1],i[n]+=rk.distanceTo(rV);e.setAttribute("lineDistance",new tC(i,1))}else console.warn("THREE.Line.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");return this}raycast(e,t){let i=this.geometry,n=this.matrixWorld,r=e.params.Line.threshold,a=i.drawRange;if(null===i.boundingSphere&&i.computeBoundingSphere(),rW.copy(i.boundingSphere),rW.applyMatrix4(n),rW.radius+=r,!1===e.ray.intersectsSphere(rW))return;rG.copy(n).invert(),rH.copy(e.ray).applyMatrix4(rG);let s=r/((this.scale.x+this.scale.y+this.scale.z)/3),o=s*s,l=new eg,h=new eg,u=new eg,c=new eg,d=this.isLineSegments?2:1,p=i.index,f=i.attributes,m=f.position;if(null!==p){let g=Math.max(0,a.start),v=Math.min(p.count,a.start+a.count);for(let _=g,x=v-1;_<x;_+=d){let y=p.getX(_),M=p.getX(_+1);l.fromBufferAttribute(m,y),h.fromBufferAttribute(m,M);let b=rH.distanceSqToSegment(l,h,c,u);if(b>o)continue;c.applyMatrix4(this.matrixWorld);let S=e.ray.origin.distanceTo(c);S<e.near||S>e.far||t.push({distance:S,point:u.clone().applyMatrix4(this.matrixWorld),index:_,face:null,faceIndex:null,object:this})}}else{let w=Math.max(0,a.start),T=Math.min(m.count,a.start+a.count);for(let E=w,A=T-1;E<A;E+=d){l.fromBufferAttribute(m,E),h.fromBufferAttribute(m,E+1);let C=rH.distanceSqToSegment(l,h,c,u);if(C>o)continue;c.applyMatrix4(this.matrixWorld);let L=e.ray.origin.distanceTo(c);L<e.near||L>e.far||t.push({distance:L,point:u.clone().applyMatrix4(this.matrixWorld),index:E,face:null,faceIndex:null,object:this})}}}updateMorphTargets(){let e=this.geometry,t=e.morphAttributes,i=Object.keys(t);if(i.length>0){let n=t[i[0]];if(void 0!==n){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let r=0,a=n.length;r<a;r++){let s=n[r].name||String(r);this.morphTargetInfluences.push(0),this.morphTargetDictionary[s]=r}}}}}let rq=new eg,rX=new eg;class rY extends rj{constructor(e,t){super(e,t),this.isLineSegments=!0,this.type="LineSegments"}computeLineDistances(){let e=this.geometry;if(null===e.index){let t=e.attributes.position,i=[];for(let n=0,r=t.count;n<r;n+=2)rq.fromBufferAttribute(t,n),rX.fromBufferAttribute(t,n+1),i[n]=0===n?0:i[n-1],i[n+1]=i[n]+rq.distanceTo(rX);e.setAttribute("lineDistance",new tC(i,1))}else console.warn("THREE.LineSegments.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");return this}}class rZ extends rj{constructor(e,t){super(e,t),this.isLineLoop=!0,this.type="LineLoop"}}class rJ extends tM{constructor(e){super(),this.isPointsMaterial=!0,this.type="PointsMaterial",this.color=new ea(16777215),this.map=null,this.alphaMap=null,this.size=1,this.sizeAttenuation=!0,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.alphaMap=e.alphaMap,this.size=e.size,this.sizeAttenuation=e.sizeAttenuation,this.fog=e.fog,this}}let rK=new eX,rQ=new eq,r$=new eF,r0=new eg;class r1 extends tl{constructor(e=new tz,t=new rJ){super(),this.isPoints=!0,this.type="Points",this.geometry=e,this.material=t,this.updateMorphTargets()}copy(e,t){return super.copy(e,t),this.material=e.material,this.geometry=e.geometry,this}raycast(e,t){let i=this.geometry,n=this.matrixWorld,r=e.params.Points.threshold,a=i.drawRange;if(null===i.boundingSphere&&i.computeBoundingSphere(),r$.copy(i.boundingSphere),r$.applyM
186atrix4(n),r$.radius+=r,!1===e.ray.intersectsSphere(r$))return;rK.copy(n).invert(),rQ.copy(e.ray).applyMatrix4(rK);let s=r/((this.scale.x+this.scale.y+this.scale.z)/3),o=s*s,l=i.index,h=i.attributes,u=h.position;if(null!==l){let c=Math.max(0,a.start),d=Math.min(l.count,a.start+a.count);for(let p=c;p<d;p++){let f=l.getX(p);r0.fromBufferAttribute(u,f),r3(r0,f,o,n,e,t,this)}}else{let m=Math.max(0,a.start),g=Math.min(u.count,a.start+a.count);for(let v=m;v<g;v++)r0.fromBufferAttribute(u,v),r3(r0,v,o,n,e,t,this)}}updateMorphTargets(){let e=this.geometry,t=e.morphAttributes,i=Object.keys(t);if(i.length>0){let n=t[i[0]];if(void 0!==n){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let r=0,a=n.length;r<a;r++){let s=n[r].name||String(r);this.morphTargetInfluences.push(0),this.morphTargetDictionary[s]=r}}}}}function r3(e,t,i,n,r,a,s){let o=rQ.distanceSqToPoint(e);if(o<i){let l=new eg;rQ.closestPointToPoint(e,l),l.applyMatrix4(n);let h=r.ray.origin.distanceTo(l);if(h<r.near||h>r.far)return;a.push({distance:h,distanceToRay:Math.sqrt(o),point:l,index:t,face:null,object:s})}}class r2{constructor(){this.type="Curve",this.arcLengthDivisions=200}getPoint(){return console.warn("THREE.Curve: .getPoint() not implemented."),null}getPointAt(e,t){let i=this.getUtoTmapping(e);return this.getPoint(i,t)}getPoints(e=5){let t=[];for(let i=0;i<=e;i++)t.push(this.getPoint(i/e));return t}getSpacedPoints(e=5){let t=[];for(let i=0;i<=e;i++)t.push(this.getPointAt(i/e));return t}getLength(){let e=this.getLengths();return e[e.length-1]}getLengths(e=this.arcLengthDivisions){if(this.cacheArcLengths&&this.cacheArcLengths.length===e+1&&!this.needsUpdate)return this.cacheArcLengths;this.needsUpdate=!1;let t=[],i,n=this.getPoint(0),r=0;t.push(0);for(let a=1;a<=e;a++)t.push(r+=(i=this.getPoint(a/e)).distanceTo(n)),n=i;return this.cacheArcLengths=t,t}updateArcLengths(){this.needsUpdate=!0,this.getLengths()}getUtoTmapping(e,t){let i=this.getLengths(),n=0,r=i.length,a;a=t||e*i[r-1];let s=0,o=r-1,l;for(;s<=o;)if((l=i[n=Math.floor(s+(o-s)/2)]-a)<0)s=n+1;else if(l>0)o=n-1;else{o=n;break}if(i[n=o]===a)return n/(r-1);let h=i[n],u=i[n+1],c=(n+(a-h)/(u-h))/(r-1);return c}getTangent(e,t){let i=e-1e-4,n=e+1e-4;i<0&&(i=0),n>1&&(n=1);let r=this.getPoint(i),a=this.getPoint(n),s=t||(r.isVector2?new j:new eg);return s.copy(a).sub(r).normalize(),s}getTangentAt(e,t){let i=this.getUtoTmapping(e);return this.getTangent(i,t)}computeFrenetFrames(e,t){let i=new eg,n=[],r=[],a=[],s=new eg,o=new eX;for(let l=0;l<=e;l++){let h=l/e;n[l]=this.getTangentAt(h,new eg)}r[0]=new eg,a[0]=new eg;let u=Number.MAX_VALUE,c=Math.abs(n[0].x),d=Math.abs(n[0].y),p=Math.abs(n[0].z);c<=u&&(u=c,i.set(1,0,0)),d<=u&&(u=d,i.set(0,1,0)),p<=u&&i.set(0,0,1),s.crossVectors(n[0],i).normalize(),r[0].crossVectors(n[0],s),a[0].crossVectors(n[0],r[0]);for(let f=1;f<=e;f++){if(r[f]=r[f-1].clone(),a[f]=a[f-1].clone(),s.crossVectors(n[f-1],n[f]),s.length()>Number.EPSILON){s.normalize();let m=Math.acos(z(n[f-1].dot(n[f]),-1,1));r[f].applyMatrix4(o.makeRotationAxis(s,m))}a[f].crossVectors(n[f],r[f])}if(!0===t){let g=Math.acos(z(r[0].dot(r[e]),-1,1));g/=e,n[0].dot(s.crossVectors(r[0],r[e]))>0&&(g=-g);for(let v=1;v<=e;v++)r[v].applyMatrix4(o.makeRotationAxis(n[v],g*v)),a[v].crossVectors(n[v],r[v])}return{tangents:n,normals:r,binormals:a}}clone(){return new this.constructor().copy(this)}copy(e){return this.arcLengthDivisions=e.arcLengthDivisions,this}toJSON(){let e={metadata:{version:4.5,type:"Curve",generator:"Curve.toJSON"}};return e.arcLengthDivisions=this.arcLengthDivisions,e.type=this.type,e}fromJSON(e){return this.arcLengthDivisions=e.arcLengthDivisions,this}}class r4 extends r2{constructor(e=0,t=0,i=1,n=1,r=0,a=2*Math.PI,s=!1,o=0){super(),this.isEllipseCurve=!0,this.type="EllipseCurve",this.aX=e,this.aY=t,this.xRadius=i,this.yRadius=n,this.aStartAngle=r,this.aEndAngle=a,this.aClockwise=s,this.aRotation=o}getPoint(e,t){let i=t||new j,n=2*Math.PI,r=this.aEndAngle-this.aStartAngle,a=Math.abs(r)<Number.EPSILON;for(;r<0;)r+=n;for(;r>n;)r-=n;r<Number.EPSILON&&(r=a?0:n),!0!==this.aClockwise||a||(r===n?r=-n:r-=n);let s=this.aStartAngle+e*r,o=this.aX+this.xRadius*Math.cos(s),l=this.aY+this.yRadius*Math.sin(s);if(0!==this.aRotation){let h=Math.cos(this.aRotation),u=Math.sin(this.aRotation),c=o-this.aX,d=l-this.aY;o=c*h-d*u+this.aX,l=c*u+d*h+this.aY}return i.set(o,l)}copy(e){return super.copy(e),this.aX=e.aX,this.aY=e.aY,this.xRadius=e.xRadius,this.yRadius=e.yRadius,this.aStartAngle=e.aStartAngle,this.aEndAngle=e.aEndAngle,this.aClockwise=e.aClockwise,this.aRotation=e.aRotation,this}toJSON(){let e=super.toJSON();return e.aX=this.aX,e.aY=this.aY,e.xRadius=this.xRadius,e.yRadius=this.yRadius,e.aStartAngle=this.aStartAngle,e.aEndAngle=this.aEndAngle,e.aClockwise=this.aClockwise,e.aRotation=this.aRotation,e}fromJSON(e){return super.fromJSON(e),this.aX=e.aX,this.aY=e.aY,this.xRadius=e.xRadius,this.yRadius=e.yRadius,this.aStartAngle=e.aStartAngle,this.aEndAngle=e.aEndAngle,this.aClockwise=e.aClockwise,this.aRotation=e.aRotation,this}}function r5(){let e=0,t=0,i=0,n=0;function r(r,a,s,o){e=r,t=s,i=-3*r+3*a-2*s-o,n=2*r-2*a+s+o}return{initCatmullRom:function(e,t,i,n,a){r(t,i,a*(i-e),a*(n-t))},initNonuniformCatmullRom:function(e,t,i,n,a,s,o){let l=(t-e)/a-(i-e)/(a+s)+(i-t)/s,h=(i-t)/s-(n-t)/(s+o)+(n-i)/o;r(t,i,l*=s,h*=s)},calc:function(r){let a=r*r;return e+t*r+i*a+n*(a*r)}}}let r6=new eg,r7=new r5,r8=new r5,r9=new r5;function ae(e,t,i,n,r){let a=(n-t)*.5,s=(r-i)*.5,o=e*e;return(2*i-2*n+a+s)*(e*o)+(-3*i+3*n-2*a-s)*o+a*e+i}function at(e,t,i,n){var r,a,s,o;return function(e,t){let i=1-e;return i*i*t}(e,t)+2*(1-e)*e*i+e*e*n}function ai(e,t,i,n,r){var a,s,o,l;return function(e,t){let i=1-e;return i*i*i*t}(e,t)+function(e,t){let i=1-e;return 3*i*i*e*t}(e,i)+3*(1-e)*e*e*n+e*e*e*r}class an extends r2{constructor(e=new j,t=new j,i=new j,n=new j){super(),this.isCubicBezierCurve=!0,this.type="CubicBezierCurve",this.v0=e,this.v1=t,this.v2=i,this.v3=n}getPoint(e,t=new j){let i=this.v0,n=this.v1,r=this.v2,a=this.v3;return t.set(ai(e,i.x,n.x,r.x,a.x),ai(e,i.y,n.y,r.y,a.y)),t}copy(e){return super.copy(e),this.v0.copy(e.v0),this.v1.copy(e.v1),this.v2.copy(e.v2),this.v3.copy(e.v3),this}toJSON(){let e=super.toJSON();return e.v0=this.v0.toArray(),e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e.v3=this.v3.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v0.fromArray(e.v0),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this.v3.fromArray(e.v3),this}}class ar extends r2{constructor(e=new j,t=new j){super(),this.isLineCurve=!0,this.type="LineCurve",this.v1=e,this.v2=t}getPoint(e,t=new j){return 1===e?t.copy(this.v2):(t.copy(this.v2).sub(this.v1),t.multiplyScalar(e).add(this.v1)),t}getPointAt(e,t){return this.getPoint(e,t)}getTangent(e,t){let i=t||new j;return i.copy(this.v2).sub(this.v1).normalize(),i}copy(e){return super.copy(e),this.v1.copy(e.v1),this.v2.copy(e.v2),this}toJSON(){let e=super.toJSON();return e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this}}class aa extends r2{constructor(e=new j,t=new j,i=new j){super(),this.isQuadraticBezierCurve=!0,this.type="QuadraticBezierCurve",this.v0=e,this.v1=t,this.v2=i}
186getPoint(e,t=new j){let i=this.v0,n=this.v1,r=this.v2;return t.set(at(e,i.x,n.x,r.x),at(e,i.y,n.y,r.y)),t}copy(e){return super.copy(e),this.v0.copy(e.v0),this.v1.copy(e.v1),this.v2.copy(e.v2),this}toJSON(){let e=super.toJSON();return e.v0=this.v0.toArray(),e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v0.fromArray(e.v0),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this}}class as extends r2{constructor(e=[]){super(),this.isSplineCurve=!0,this.type="SplineCurve",this.points=e}getPoint(e,t=new j){let i=this.points,n=(i.length-1)*e,r=Math.floor(n),a=n-r,s=i[0===r?r:r-1],o=i[r],l=i[r>i.length-2?i.length-1:r+1],h=i[r>i.length-3?i.length-1:r+2];return t.set(ae(a,s.x,o.x,l.x,h.x),ae(a,s.y,o.y,l.y,h.y)),t}copy(e){super.copy(e),this.points=[];for(let t=0,i=e.points.length;t<i;t++){let n=e.points[t];this.points.push(n.clone())}return this}toJSON(){let e=super.toJSON();e.points=[];for(let t=0,i=this.points.length;t<i;t++){let n=this.points[t];e.points.push(n.toArray())}return e}fromJSON(e){super.fromJSON(e),this.points=[];for(let t=0,i=e.points.length;t<i;t++){let n=e.points[t];this.points.push(new j().fromArray(n))}return this}}var ao=Object.freeze({__proto__:null,ArcCurve:class extends r4{constructor(e,t,i,n,r,a){super(e,t,i,i,n,r,a),this.isArcCurve=!0,this.type="ArcCurve"}},CatmullRomCurve3:class extends r2{constructor(e=[],t=!1,i="centripetal",n=.5){super(),this.isCatmullRomCurve3=!0,this.type="CatmullRomCurve3",this.points=e,this.closed=t,this.curveType=i,this.tension=n}getPoint(e,t=new eg){let i=this.points,n=i.length,r=(n-(this.closed?0:1))*e,a=Math.floor(r),s=r-a;this.closed?a+=a>0?0:(Math.floor(Math.abs(a)/n)+1)*n:0===s&&a===n-1&&(a=n-2,s=1);let o,l;this.closed||a>0?o=i[(a-1)%n]:(r6.subVectors(i[0],i[1]).add(i[0]),o=r6);let h=i[a%n],u=i[(a+1)%n];if(this.closed||a+2<n?l=i[(a+2)%n]:(r6.subVectors(i[n-1],i[n-2]).add(i[n-1]),l=r6),"centripetal"===this.curveType||"chordal"===this.curveType){let c="chordal"===this.curveType?.5:.25,d=Math.pow(o.distanceToSquared(h),c),p=Math.pow(h.distanceToSquared(u),c),f=Math.pow(u.distanceToSquared(l),c);p<1e-4&&(p=1),d<1e-4&&(d=p),f<1e-4&&(f=p),r7.initNonuniformCatmullRom(o.x,h.x,u.x,l.x,d,p,f),r8.initNonuniformCatmullRom(o.y,h.y,u.y,l.y,d,p,f),r9.initNonuniformCatmullRom(o.z,h.z,u.z,l.z,d,p,f)}else"catmullrom"===this.curveType&&(r7.initCatmullRom(o.x,h.x,u.x,l.x,this.tension),r8.initCatmullRom(o.y,h.y,u.y,l.y,this.tension),r9.initCatmullRom(o.z,h.z,u.z,l.z,this.tension));return t.set(r7.calc(s),r8.calc(s),r9.calc(s)),t}copy(e){super.copy(e),this.points=[];for(let t=0,i=e.points.length;t<i;t++){let n=e.points[t];this.points.push(n.clone())}return this.closed=e.closed,this.curveType=e.curveType,this.tension=e.tension,this}toJSON(){let e=super.toJSON();e.points=[];for(let t=0,i=this.points.length;t<i;t++){let n=this.points[t];e.points.push(n.toArray())}return e.closed=this.closed,e.curveType=this.curveType,e.tension=this.tension,e}fromJSON(e){super.fromJSON(e),this.points=[];for(let t=0,i=e.points.length;t<i;t++){let n=e.points[t];this.points.push(new eg().fromArray(n))}return this.closed=e.closed,this.curveType=e.curveType,this.tension=e.tension,this}},CubicBezierCurve:an,CubicBezierCurve3:class extends r2{constructor(e=new eg,t=new eg,i=new eg,n=new eg){super(),this.isCubicBezierCurve3=!0,this.type="CubicBezierCurve3",this.v0=e,this.v1=t,this.v2=i,this.v3=n}getPoint(e,t=new eg){let i=this.v0,n=this.v1,r=this.v2,a=this.v3;return t.set(ai(e,i.x,n.x,r.x,a.x),ai(e,i.y,n.y,r.y,a.y),ai(e,i.z,n.z,r.z,a.z)),t}copy(e){return super.copy(e),this.v0.copy(e.v0),this.v1.copy(e.v1),this.v2.copy(e.v2),this.v3.copy(e.v3),this}toJSON(){let e=super.toJSON();return e.v0=this.v0.toArray(),e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e.v3=this.v3.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v0.fromArray(e.v0),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this.v3.fromArray(e.v3),this}},EllipseCurve:r4,LineCurve:ar,LineCurve3:class extends r2{constructor(e=new eg,t=new eg){super(),this.isLineCurve3=!0,this.type="LineCurve3",this.v1=e,this.v2=t}getPoint(e,t=new eg){return 1===e?t.copy(this.v2):(t.copy(this.v2).sub(this.v1),t.multiplyScalar(e).add(this.v1)),t}getPointAt(e,t){return this.getPoint(e,t)}copy(e){return super.copy(e),this.v1.copy(e.v1),this.v2.copy(e.v2),this}toJSON(){let e=super.toJSON();return e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this}},QuadraticBezierCurve:aa,QuadraticBezierCurve3:class e extends r2{constructor(e=new eg,t=new eg,i=new eg){super(),this.isQuadraticBezierCurve3=!0,this.type="QuadraticBezierCurve3",this.v0=e,this.v1=t,this.v2=i}
186getPoint(e,t=new eg){let i=this.v0,n=this.v1,r=this.v2;return t.set(at(e,i.x,n.x,r.x),at(e,i.y,n.y,r.y),at(e,i.z,n.z,r.z)),t}copy(e){return super.copy(e),this.v0.copy(e.v0),this.v1.copy(e.v1),this.v2.copy(e.v2),this}toJSON(){let e=super.toJSON();return e.v0=this.v0.toArray(),e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v0.fromArray(e.v0),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this}},SplineCurve:as});class al extends r2{constructor(){super(),this.type="CurvePath",this.curves=[],this.autoClose=!1}add(e){this.curves.push(e)}closePath(){let e=this.curves[0].getPoint(0),t=this.curves[this.curves.length-1].getPoint(1);e.equals(t)||this.curves.push(new ar(t,e))}getPoint(e,t){let i=e*this.getLength(),n=this.getCurveLengths(),r=0;for(;r<n.length;){if(n[r]>=i){let a=n[r]-i,s=this.curves[r],o=s.getLength(),l=0===o?0:1-a/o;return s.getPointAt(l,t)}r++}return null}getLength(){let e=this.getCurveLengths();return e[e.length-1]}updateArcLengths(){this.needsUpdate=!0,this.cacheLengths=null,this.getCurveLengths()}getCurveLengths(){if(this.cacheLengths&&this.cacheLengths.length===this.curves.length)return this.cacheLengths;let e=[],t=0;for(let i=0,n=this.curves.length;i<n;i++)e.push(t+=this.curves[i].getLength());return this.cacheLengths=e,e}getSpacedPoints(e=40){let t=[];for(let i=0;i<=e;i++)t.push(this.getPoint(i/e));return this.autoClose&&t.push(t[0]),t}getPoints(e=12){let t=[],i;for(let n=0,r=this.curves;n<r.length;n++){let a=r[n],s=a.isEllipseCurve?2*e:a.isLineCurve||a.isLineCurve3?1:a.isS
186plineCurve?e*a.points.length:e,o=a.getPoints(s);for(let l=0;l<o.length;l++){let h=o[l];i&&i.equals(h)||(t.push(h),i=h)}}return this.autoClose&&t.length>1&&!t[t.length-1].equals(t[0])&&t.push(t[0]),t}copy(e){super.copy(e),this.curves=[];for(let t=0,i=e.curves.length;t<i;t++){let n=e.curves[t];this.curves.push(n.clone())}return this.autoClose=e.autoClose,this}toJSON(){let e=super.toJSON();e.autoClose=this.autoClose,e.curves=[];for(let t=0,i=this.curves.length;t<i;t++){let n=this.curves[t];e.curves.push(n.toJSON())}return e}fromJSON(e){super.fromJSON(e),this.autoClose=e.autoClose,this.curves=[];for(let t=0,i=e.curves.length;t<i;t++){let n=e.curves[t];this.curves.push(new ao[n.type]().fromJSON(n))}return this}}class ah extends al{constructor(e){super(),this.type="Path",this.currentPoint=new j,e&&this.setFromPoints(e)}setFromPoints(e){this.moveTo(e[0].x,e[0].y);for(let t=1,i=e.length;t<i;t++)this.lineTo(e[t].x,e[t].y);return this}moveTo(e,t){return this.currentPoint.set(e,t),this}lineTo(e,t){let i=new ar(this.currentPoint.clone(),new j(e,t));return this.curves.push(i),this.currentPoint.set(e,t),this}quadraticCurveTo(e,t,i,n){let r=new aa(this.currentPoint.clone(),new j(e,t),new j(i,n));return this.curves.push(r),this.currentPoint.set(i,n),this}bezierCurveTo(e,t,i,n,r,a){let s=new an(this.currentPoint.clone(),new j(e,t),new j(i,n),new j(r,a));return this.curves.push(s),this.currentPoint.set(r,a),this}splineThru(e){let t=[this.currentPoint.clone()].concat(e),i=new as(t);return this.curves.push(i),this.currentPoint.copy(e[e.length-1]),this}arc(e,t,i,n,r,a){let s=this.currentPoint.x,o=this.currentPoint.y;return this.absarc(e+s,t+o,i,n,r,a),this}absarc(e,t,i,n,r,a){return this.absellipse(e,t,i,i,n,r,a),this}ellipse(e,t,i,n,r,a,s,o){let l=this.currentPoint.x,h=this.currentPoint.y;return this.absellipse(e+l,t+h,i,n,r,a,s,o),this}absellipse(e,t,i,n,r,a,s,o){let l=new r4(e,t,i,n,r,a,s,o);if(this.curves.length>0){let h=l.getPoint(0);h.equals(this.currentPoint)||this.lineTo(h.x,h.y)}this.curves.push(l);let u=l.getPoint(1);return this.currentPoint.copy(u),this}copy(e){return super.copy(e),this.currentPoint.copy(e.currentPoint),this}toJSON(){let e=super.toJSON();return e.currentPoint=this.currentPoint.toArray(),e}fromJSON(e){return super.fromJSON(e),this.currentPoint.fromArray(e.currentPoint),this}}class au extends ah{constructor(e){super(e),this.uuid=O(),this.type="Shape",this.holes=[]}getPointsHoles(e){let t=[];for(let i=0,n=this.holes.length;i<n;i++)t[i]=this.holes[i].getPoints(e);return t}extractPoints(e){return{shape:this.getPoints(e),holes:this.getPointsHoles(e)}}copy(e){super.copy(e),this.holes=[];for(let t=0,i=e.holes.length;t<i;t++){let n=e.holes[t];this.holes.push(n.clone())}return this}toJSON(){let e=super.toJSON();e.uuid=this.uuid,e.holes=[];for(let t=0,i=this.holes.length;t<i;t++){let n=this.holes[t];e.holes.push(n.toJSON())}return e}fromJSON(e){super.fromJSON(e),this.uuid=e.uuid,this.holes=[];for(let t=0,i=e.holes.length;t<i;t++){let n=e.holes[t];this.holes.push(new ah().fromJSON(n))}return this}}let ac={triangulate:function(e,t,i=2){let n=t&&t.length,r=n?t[0]*i:e.length,a=ad(e,0,r,i,!0),s=[];if(!a||a.next===a.prev)return s;let o,l,h,u,c,d,p;if(n&&(a=function(e,t,i,n){let r=[],a,s,o,l,h;for(a=0,s=t.length;a<s;a++)o=t[a]*n,l=a<s-1?t[a+1]*n:e.length,(h=ad(e,o,l,n,!1))===h.next&&(h.steiner=!0),r.push(aS(h));for(r.sort(ax),a=0;a<r.length;a++)ay(r[a],i),i=ap(i,i.next);return i}(e,t,a,i)),e.length>80*i){o=h=e[0],l=u=e[1];for(let f=i;f<r;f+=i)c=e[f],d=e[f+1],c<o&&(o=c),d<l&&(l=d),c>h&&(h=c),d>u&&(u=d);p=0!==(p=Math.max(h-o,u-l))?1/p:0}return af(a,s,i,o,l,p),s}};function ad(e,t,i,n,r){let a,s;if(r===function(e,t,i,n){let r=0;for(let a=t,s=i-n;a<i;a+=n)r+=(e[s]-e[a])*(e[a+1]+e[s+1]),s=a;return r}(e,t,i,n)>0)for(a=t;a<i;a+=n)s=aI(a,e[a],e[a+1],s);else for(a=i-n;a>=t;a-=n)s=aI(a,e[a],e[a+1],s);return s&&aA(s,s.next)&&(aN(s),s=s.next),s}function ap(e,t){if(!e)return e;t||(t=e);let i=e,n;do if(n=!1,!i.steiner&&(aA(i,i.next)||0===aE(i.prev,i,i.next))){if(aN(i),(i=t=i.prev)===i.next)break;n=!0}else i=i.next;while(n||i!==t);return t}function af(e,t,i,n,r,a,s){if(!e)return;!s&&a&&function(e,t,i,n){let r=e;do null===r.z&&(r.z=ab(r.x,r.y,t,i,n)),r.prevZ=r.prev,r.nextZ=r.next,r=r.next;while(r!==e);r.prevZ.nextZ=null,r.prevZ=null,function(e){let t,i,n,r,a,s,o,l,h=1;do{for(i=e,e=null,a=null,s=0;i;){for(s++,n=i,o=0,t=0;t<h&&(o++,n=n.nextZ);t++);for(l=h;o>0||l>0&&n;)0!==o&&(0===l||!n||i.z<=n.z)?(r=i,i=i.nextZ,o--):(r=n,n=n.nextZ,l--),a?a.nextZ=r:e=r,r.prevZ=a,a=r;i=n}
186a.nextZ=null,h*=2}while(s>1)}(r)}(e,n,r,a);let o=e,l,h;for(;e.prev!==e.next;){if(l=e.prev,h=e.next,a?ag(e,n,r,a):am(e)){t.push(l.i/i),t.push(e.i/i),t.push(h.i/i),aN(e),e=h.next,o=h.next;continue}if((e=h)===o){s?1===s?af(e=av(ap(e),t,i),t,i,n,r,a,2):2===s&&a_(e,t,i,n,r,a):af(ap(e),t,i,n,r,a,1);break}}}function am(e){let t=e.prev,i=e.next;if(aE(t,e,i)>=0)return!1;let n=e.next.next;for(;n!==e.prev;){if(aw(t.x,t.y,e.x,e.y,i.x,i.y,n.x,n.y)&&aE(n.prev,n,n.next)>=0)return!1;n=n.next}return!0}function ag(e,t,i,n){let r=e.prev,a=e.next;if(aE(r,e,a)>=0)return!1;let s=r.x<e.x?r.x<a.x?r.x:a.x:e.x<a.x?e.x:a.x,o=r.y<e.y?r.y<a.y?r.y:a.y:e.y<a.y?e.y:a.y,l=r.x>e.x?r.x>a.x?r.x:a.x:e.x>a.x?e.x:a.x,h=r.y>e.y?r.y>a.y?r.y:a.y:e.y>a.y?e.y:a.y,u=ab(s,o,t,i,n),c=ab(l,h,t,i,n),d=e.prevZ,p=e.nextZ;for(;d&&d.z>=u&&p&&p.z<=c;){if(d!==e.prev&&d!==e.next&&aw(r.x,r.y,e.x,e.y,a.x,a.y,d.x,d.y)&&aE(d.prev,d,d.next)>=0||(d=d.prevZ,p!==e.prev&&p!==e.next&&aw(r.x,r.y,e.x,e.y,a.x,a.y,p.x,p.y)&&aE(p.prev,p,p.next)>=0))return!1;p=p.nextZ}for(;d&&d.z>=u;){if(d!==e.prev&&d!==e.next&&aw(r.x,r.y,e.x,e.y,a.x,a.y,d.x,d.y)&&aE(d.prev,d,d.next)>=0)return!1;d=d.prevZ}for(;p&&p.z<=c;){if(p!==e.prev&&p!==e.next&&aw(r.x,r.y,e.x,e.y,a.x,a.y,p.x,p.y)&&aE(p.prev,p,p.next)>=0)return!1;p=p.nextZ}return!0}function av(e,t,i){let n=e;do{let r=n.prev,a=n.next.next;!aA(r,a)&&aC(r,n,n.next,a)&&aR(r,a)&&aR(a,r)&&(t.push(r.i/i),t.push(n.i/i),t.push(a.i/i),aN(n),aN(n.next),n=e=a),n=n.next}while(n!==e);return ap(n)}function a_(e,t,i,n,r,a){let s=e;do{let o=s.next.next;for(;o!==s.prev;){if(s.i!==o.i&&aT(s,o)){let l=aD(s,o);s=ap(s,s.next),l=ap(l,l.next),af(s,t,i,n,r,a),af(l,t,i,n,r,a);return}o=o.next}s=s.next}while(s!==e)}function ax(e,t){return e.x-t.x}function ay(e,t){if(t=function(e,t){let i=t,n=e.x,r=e.y,a=-1/0,s;do{if(r<=i.y&&r>=i.next.y&&i.next.y!==i.y){let o=i.x+(r-i.y)*(i.next.x-i.x)/(i.next.y-i.y);if(o<=n&&o>a){if(a=o,o===n){if(r===i.y)return i;if(r===i.next.y)return i.next}s=i.x<i.next.x?i:i.next}}i=i.next}while(i!==t);if(!s)return null;if(n===a)return s;let l=s,h=s.x,u=s.y,c=1/0,d;i=s;do n>=i.x&&i.x>=h&&n!==i.x&&aw(r<u?n:a,r,h,u,r<u?a:n,r,i.x,i.y)&&(d=Math.abs(r-i.y)/(n-i.x),aR(i,e)&&(d<c||d===c&&(i.x>s.x||i.x===s.x&&aM(s,i)))&&(s=i,c=d)),i=i.next;while(i!==l);return s}(e,t)){let i=aD(t,e);ap(t,t.next),ap(i,i.next)}}function aM(e,t){return 0>aE(e.prev,e,t.prev)&&0>aE(t.next,e,e.next)}function ab(e,t,i,n,r){return(e=((e=((e=((e=((e=32767*(e-i)*r)|e<<8)&16711935)|e<<4)&252645135)|e<<2)&858993459)|e<<1)&1431655765)|(t=((t=((t=((t=((t=32767*(t-n)*r)|t<<8)&16711935)|t<<4)&252645135)|t<<2)&858993459)|t<<1)&1431655765)<<1}function aS(e){let t=e,i=e;do(t.x<i.x||t.x===i.x&&t.y<i.y)&&(i=t),t=t.next;while(t!==e);return i}function aw(e,t,i,n,r,a,s,o){return(r-s)*(t-o)-(e-s)*(a-o)>=0&&(e-s)*(n-o)-(i-s)*(t-o)>=0&&(i-s)*(a-o)-(r-s)*(n-o)>=0}function aT(e,t){return e.next.i!==t.i&&e.prev.i!==t.i&&!function(e,t){let i=e;do{if(i.i!==e.i&&i.next.i!==e.i&&i.i!==t.i&&i.next.i!==t.i&&aC(i,i.next,e,t))return!0;i=i.next}while(i!==e);return!1}(e,t)&&(aR(e,t)&&aR(t,e)&&function(e,t){let i=e,n=!1,r=(e.x+t.x)/2,a=(e.y+t.y)/2;do i.y>a!=i.next.y>a&&i.next.y!==i.y&&r<(i.next.x-i.x)*(a-i.y)/(i.next.y-i.y)+i.x&&(n=!n),i=i.next;while(i!==e);return n}(e,t)&&(aE(e.prev,e,t.prev)||aE(e,t.prev,t))||aA(e,t)&&aE(e.prev,e,e.next)>0&&aE(t.prev,t,t.next)>0)}function aE(e,t,i){return(t.y-e.y)*(i.x-t.x)-(t.x-e.x)*(i.y-t.y)}function aA(e,t){return e.x===t.x&&e.y===t.y}function aC(e,t,i,n){let r=aP(aE(e,t,i)),a=aP(aE(e,t,n)),s=aP(aE(i,n,e)),o=aP(aE(i,n,t));return!!(r!==a&&s!==o||0===r&&aL(e,i,t)||0===a&&aL(e,n,t)||0===s&&aL(i,e,n)||0===o&&aL(i,t,n))}function aL(e,t,i){return t.x<=Math.max(e.x,i.x)&&t.x>=Math.min(e.x,i.x)&&t.y<=Math.max(e.y,i.y)&&t.y>=Math.min(e.y,i.y)}function aP(e){return e>0?1:e<0?-1:0}function aR(e,t){return 0>aE(e.prev,e,e.next)?aE(e,t,e.next)>=0&&aE(e,e.prev,t)>=0:0>aE(e,t,e.prev)||0>aE(e,e.next,t)}function aD(e,t){let i=new aO(e.i,e.x,e.y),n=new aO(t.i,t.x,t.y),r=e.next,a=t.prev;return e.next=t,t.prev=e,i.next=r,r.prev=i,n.next=i,i.prev=n,a.next=n,n.prev=a,n}function aI(e,t,i,n){let r=new aO(e,t,i);return n?(r.next=n.next,r.prev=n,n.next.prev=r,n.next=r):(r.prev=r,r.next=r),r}function aN(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 aO(e,t,i){this.i=e,this.x=t,this.y=i,this.prev=null,this.next=null,this.z=null,this.prevZ=null,this.nextZ=null,this.steiner=!1}class az{static area(e){let t=e.length,i=0;for(let n=t-1,r=0;r<t;n=r++)i+=e[n].x*e[r].y-e[r].x*e[n].y;return .5*i}static isClockWise(e){return 0>az.area(e)}static triangulateShape(e,t){let i=[],n=[],r=[];aU(e),aF(i,e);let a=e.length;t.forEach(aU);for(let s=0;s<t.length;s++)n.push(a),a+=t[s].length,aF(i,t[s]);let o=ac.triangulate(i,n);for(let l=0;l<o.length;l+=3)r.push(o.slice(l,l+3));return r}}function aU(e){let t=e.length;t>2&&e[t-1].equals(e[0])&&e.pop()}function aF(e,t){for(let i=0;i<t.length;i++)e.push(t[i].x),e.push(t[i].y)}class aB extends tz{constructor(e=1,t=32,i=16,n=0,r=2*Math.PI,a=0,s=Math.PI){super(),this.type="SphereGeometry",this.parameters={radiu
186s:e,widthSegments:t,heightSegments:i,phiStart:n,phiLength:r,thetaStart:a,thetaLength:s},t=Math.max(3,Math.floor(t)),i=Math.max(2,Math.floor(i));let o=Math.min(a+s,Math.PI),l=0,h=[],u=new eg,c=new eg,d=[],p=[],f=[],m=[];for(let g=0;g<=i;g++){let v=[],_=g/i,x=0;0==g&&0==a?x=.5/t:g==i&&o==Math.PI&&(x=-.5/t);for(let y=0;y<=t;y++){let M=y/t;u.x=-e*Math.cos(n+M*r)*Math.sin(a+_*s),u.y=e*Math.cos(a+_*s),u.z=e*Math.sin(n+M*r)*Math.sin(a+_*s),p.push(u.x,u.y,u.z),c.copy(u).normalize(),f.push(c.x,c.y,c.z),m.push(M+x,1-_),v.push(l++)}h.push(v)}for(let b=0;b<i;b++)for(let S=0;S<t;S++){let w=h[b][S+1],T=h[b][S],E=h[b+1][S],A=h[b+1][S+1];(0!==b||a>0)&&d.push(w,T,A),(b!==i-1||o<Math.PI)&&d.push(T,E,A)}this.setIndex(d),this.setAttribute("position",new tC(p,3)),this.setAttribute("normal",new tC(f,3)),this.setAttribute("uv",new tC(m,2))}static fromJSON(e){return new aB(e.radius,e.widthSegments,e.heightSegments,e.phiStart,e.phiLength,e.thetaStart,e.thetaLength)}}class ak extends tM{constructor(e){super(),this.isMeshStandardMaterial=!0,this.defines={STANDARD:""},this.type="MeshStandardMaterial",this.color=new ea(16777215),this.roughness=1,this.metalness=0,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new ea(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=E,this.normalScale=new j(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.roughnessMap=null,this.metalnessMap=null,this.alphaMap=null,this.envMap=null,this.envMapIntensity=1,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.flatShading=!1,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.defines={STANDARD:""},this.color.copy(e.color),this.roughness=e.roughness,this.metalness=e.metalness,this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.roughnessMap=e.roughnessMap,this.metalnessMap=e.metalnessMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.envMapIntensity=e.envMapIntensity,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.flatShading=e.flatShading,this.fog=e.fog,this}}class aV extends ak{constructor(e){super(),this.isMeshPhysicalMaterial=!0,this.defines={STANDARD:"",PHYSICAL:""},this.type="MeshPhysicalMaterial",this.clearcoatMap=null,this.clearcoatRoughness=0,this.clearcoatRoughnessMap=null,this.clearcoatNormalScale=new j(1,1),this.clearcoatNormalMap=null,this.ior=1.5,Object.defineProperty(this,"reflectivity",{get:function(){return z(2.5*(this.ior-1)/(this.ior+1),0,1)},set:function(e){this.ior=(1+.4*e)/(1-.4*e)}}),this.iridescenceMap=null,this.iridescenceIOR=1.3,this.iridescenceThicknessRange=[100,400],this.iridescenceThicknessMap=null,this.sheenColor=new ea(0),this.sheenColorMap=null,this.sheenRoughness=1,this.sheenRoughnessMap=null,this.transmissionMap=null,this.thickness=0,this.thicknessMap=null,this.attenuationDistance=0,this.attenuationColor=new ea(1,1,1),this.specularIntensity=1,this.specularIntensityMap=null,this.specularColor=new ea(1,1,1),this.specularColorMap=null,this._sheen=0,this._clearcoat=0,this._iridescence=0,this._transmission=0,this.setValues(e)}get sheen(){return this._sheen}set sheen(e){this._sheen>0!=e>0&&this.version++,this._sheen=e}get clearcoat(){return this._clearcoat}set clearcoat(e){this._clearcoat>0!=e>0&&this.version++,this._clearcoat=e}get iridescence(){return this._iridescence}set iridescence(e){this._iridescence>0!=e>0&&this.version++,this._iridescence=e}get transmission(){return this._transmission}set transmission(e){this._transmission>0!=e>0&&this.version++,this._transmission=e}copy(e){return super.copy(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=[...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}}function aG(e,t,i){return aW(e)?new e.constructor(e.subarray(t,void 0!==i?i:e.length)):e.slice(t,i)}function aH(e,t,i){return e&&(i||e.constructor!==t)?"number"==typeof t.BYTES_PER_ELEMENT?new t(e):Array.prototype.slice.call(e):e}function aW(e){return ArrayBuffer.isView(e)&&!(e instanceof DataView)}function aj(e){let t=e.length,i=Array(t);for(let n=0;n!==t;++n)i[n]=n;
186return i.sort(function(t,i){return e[t]-e[i]}),i}function aq(e,t,i){let n=e.length,r=new e.constructor(n);for(let a=0,s=0;s!==n;++a){let o=i[a]*t;for(let l=0;l!==t;++l)r[s++]=e[o+l]}return r}function aX(e,t,i,n){let r=1,a=e[0];for(;void 0!==a&&void 0===a[n];)a=e[r++];if(void 0===a)return;let s=a[n];if(void 0!==s){if(Array.isArray(s))do void 0!==(s=a[n])&&(t.push(a.time),i.push.apply(i,s)),a=e[r++];while(void 0!==a);else if(void 0!==s.toArray)do void 0!==(s=a[n])&&(t.push(a.time),s.toArray(i,i.length)),a=e[r++];while(void 0!==a);else do void 0!==(s=a[n])&&(t.push(a.time),i.push(s)),a=e[r++];while(void 0!==a)}}class aY{constructor(e,t,i,n){this.parameterPositions=e,this._cachedIndex=0,this.resultBuffer=void 0!==n?n:new t.constructor(i),this.sampleValues=t,this.valueSize=i,this.settings=null,this.DefaultSettings_={}}evaluate(e){let t=this.parameterPositions,i=this._cachedIndex,n=t[i],r=t[i-1];validate_interval:{seek:{let a;linear_scan:{forward_scan:if(!(e<n)){for(let s=i+2;;){if(void 0===n){if(e<r)break forward_scan;return i=t.length,this._cachedIndex=i,this.copySampleValue_(i-1)}if(i===s)break;if(r=n,e<(n=t[++i]))break seek}a=t.length;break linear_scan}if(!(e>=r)){let o=t[1];e<o&&(i=2,r=o);for(let l=i-2;;){if(void 0===r)return this._cachedIndex=0,this.copySampleValue_(0);if(i===l)break;if(n=r,e>=(r=t[--i-1]))break seek}a=i,i=0;break linear_scan}break validate_interval}for(;i<a;){let h=i+a>>>1;e<t[h]?a=h:i=h+1}if(n=t[i],void 0===(r=t[i-1]))return this._cachedIndex=0,this.copySampleValue_(0);if(void 0===n)return i=t.length,this._cachedIndex=i,this.copySampleValue_(i-1)}this._cachedIndex=i,this.intervalChanged_(i,r,n)}return this.interpolate_(i,r,e,n)}getSettings_(){return this.settings||this.DefaultSettings_}copySampleValue_(e){let t=this.resultBuffer,i=this.sampleValues,n=this.valueSize,r=e*n;for(let a=0;a!==n;++a)t[a]=i[r+a];return t}interpolate_(){throw Error("call to abstract method")}intervalChanged_(){}}class aZ extends aY{constructor(e,t,i,n){super(e,t,i,n),this._weightPrev=-0,this._offsetPrev=-0,this._weightNext=-0,this._offsetNext=-0,this.DefaultSettings_={endingStart:2400,endingEnd:2400}}intervalChanged_(e,t,i){let n=this.parameterPositions,r=e-2,a=e+1,s=n[r],o=n[a];if(void 0===s)switch(this.getSettings_().endingStart){case 2401:r=e,s=2*t-i;break;case 2402:s=t+n[r=n.length-2]-n[r+1];break;default:r=e,s=i}if(void 0===o)switch(this.getSettings_().endingEnd){case 2401:a=e,o=2*i-t;break;case 2402:a=1,o=i+n[1]-n[0];break;default:a=e-1,o=t}let l=(i-t)*.5,h=this.valueSize;this._weightPrev=l/(t-s),this._weightNext=l/(o-i),this._offsetPrev=r*h,this._offsetNext=a*h}interpolate_(e,t,i,n){let r=this.resultBuffer,a=this.sampleValues,s=this.valueSize,o=e*s,l=o-s,h=this._offsetPrev,u=this._offsetNext,c=this._weightPrev,d=this._weightNext,p=(i-t)/(n-t),f=p*p,m=f*p,g=-c*m+2*c*f-c*p,v=(1+c)*m+(-1.5-2*c)*f+(-.5+c)*p+1,_=(-1-d)*m+(1.5+d)*f+.5*p,x=d*m-d*f;for(let y=0;y!==s;++y)r[y]=g*a[h+y]+v*a[l+y]+_*a[o+y]+x*a[u+y];return r}}class aJ extends aY{constructor(e,t,i,n){super(e,t,i,n)}interpolate_(e,t,i,n){let r=this.resultBuffer,a=this.sampleValues,s=this.valueSize,o=e*s,l=o-s,h=(i-t)/(n-t),u=1-h;for(let c=0;c!==s;++c)r[c]=a[l+c]*u+a[o+c]*h;return r}}class aK extends aY{constructor(e,t,i,n){super(e,t,i,n)}interpolate_(e){return this.copySampleValue_(e-1)}}class aQ{constructor(e,t,i,n){if(void 0===e)throw Error("THREE.KeyframeTrack: track name is undefined");if(void 0===t||0===t.length)throw Error("THREE.KeyframeTrack: no keyframes in track named "+e);this.name=e,this.times=aH(t,this.TimeBufferType),this.values=aH(i,this.ValueBufferType),this.setInterpolation(n||this.DefaultInterpolation)}static toJSON(e){let t=e.constructor,i;if(t.toJSON!==this.toJSON)i=t.toJSON(e);else{i={name:e.name,times:aH(e.times,Array),values:aH(e.values,Array)};let n=e.getInterpolation();n!==e.DefaultInterpolation&&(i.interpolation=n)}return i.type=e.ValueTypeName,i}InterpolantFactoryMethodDiscrete(e){return new aK(this.times,this.values,this.getValueSize(),e)}InterpolantFactoryMethodLinear(e){return new aJ(this.times,this.values,this.getValueSize(),e)}InterpolantFactoryMethodSmooth(e){return new aZ(this.times,this.values,this.getValueSize(),e)}setInterpolation(e){let t;switch(e){case y:t=this.InterpolantFactoryMethodDiscrete;break;case M:t=this.InterpolantFactoryMethodLinear;break;case 2302:t=this.InterpolantFactoryMethodSmooth}if(void 0===t){let i="unsupported interpolation for "+this.ValueTypeName+" keyframe track named "+this.name;if(void 0===this.createInterpolant){if(e!==this.DefaultInterpolation)this.setInterpolation(this.DefaultInterpolation);else throw Error(i)}return console.warn("THREE.KeyframeTrack:",i),this}return this.createInterpolant=t,this}getInterpolation(){switch(this.createInterpolant){case this.InterpolantFactoryMethodDiscrete:return y;case this.InterpolantFactoryMethodLinear:return M;case this.InterpolantFactoryMethodSmooth:return 2302}}getValueSize(){return this.values.length/this.times.length}shift(e){if(0!==e){let t=this.times;for(let i=0,n=t.length;i!==n;++i)t[i]+=e}return this}scale(e){if(1!==e){let t=this.times;for(let i=0,n=t.length;i!==n;++i)t[i]*=e}return this}trim(e,t){let i=this.times,n=i.length,r=0,a=n-1;for(;r!==n&&i[r]<e;)++r;for(;-1!==a&&i[a]>t;)--a;if(++a,0!==r||a!==n){r>=a&&(r=(a=Math.max(a,1))-1);let s=this.getValueSize();this.times=aG(i,r,a),this.values=aG(this.values,r*s,a*s)}return this}validate(){let e=!0,t=this.getValueSize();t-Math.floor(t)!=0&&(console.error("THREE.KeyframeTrack: Invalid value size in track.",this),e=!1);let i=this.times,n=this.values,r=i.length;0===r&&(console.error("THREE.KeyframeTrack: Track is empty.",this),e=!1);let a=null;for(let s=0;s!==r;s++){let o=i[s];if("number"==typeof o&&isNaN(o)){console.error("THREE.KeyframeTrack: Time is not a valid number.",this,s,o),e=!1;break}if(null!==a&&a>o){console.error("THREE.KeyframeTrack: Out of order keys.",this,s,o,a),e=!1;break}a=o}if(void 0!==n&&aW(n))for(let l=0,h=n.length;l!==h;++l){let u=n[l];if(isNaN(u)){console.error("THREE.KeyframeTrack: Value is not a valid number.",this,l,u),e=!1;break}}return e}optimize(){let e=aG(this.times),t=aG(this.values),i=this.getValueSize(),n=2302===this.getInterpolation(),r=e.length-1,a=1;for(let s=1;s<r;++s){let o=!1,l=e[s],h=e[s+1];if(l!==h&&(1!==s||l!==e[0])){if(n)o=!0;else{let u=s*i,c=u-i,d=u+i;for(let p=0;p!==i;++p){let f=t[u+p];if(f!==t[c+p]||f!==t[d+p]){o=!0;break}}}}if(o){if(s!==a){e[a]=e[s];let m=s*i,g=a*i;for(let v=0;v!==i;++v)t[g+v]=t[m+v]}++a}}if(r>0){e[a]=e[r];for(let _=r*i,x=a*i,y=0;y!==i;++y)t[x+y]=t[_+y];++a}return a!==e.length?(this.times=aG(e,0,a),this.values=aG(t,0,a*i)):(this.times=e,this.values=t),this}clone(){let e=aG(this.times,0),t=aG(this.values,0),i=this.constructor,n=new i(this.name,e,t);return n.createInterpolant=this.createInterpolant,n}}aQ.prototype.TimeBufferType=Float32Array,aQ.prototype.ValueBufferType=Float32Array,aQ.prototype.DefaultInterpolation=M;class a$ extends aQ{}a$.prototype.ValueTypeName="bool",a$.prototype.ValueBufferType=Array,a$.prototype.DefaultInterpolation=y,a$.prototype.InterpolantFactoryMethodLinear=void 0,a$.prototype.InterpolantFactoryMethodSmooth=void 0;class a0 extends aQ{}a0.prototype.ValueTypeName="color";class a1 extends aQ{}a1.prototype.ValueTypeName="number";class a3 extends aY{constructor(e,t,i,n){super(e,t,i,n)}interpolate_(e,t,i,n){let r=this.resultBuffer,a=this.sampleValues,s=this.valueSize,o=(i-t)/(n-t),l=e*s;for(let h=l+s;l!==h;l+=4)em.slerpFlat(r,0,a,l-s,a,l,o);return r}}class a2 extends aQ{InterpolantFactoryMethodLinear(e){return new a3(this.times,this.values,this.getValueSize(),e)}}a2.prototype.ValueTypeName="quaternion",a2.prototype.DefaultInterpolation=M,a2.prototype.InterpolantFactoryMethodSmooth=void 0;class a4 extends aQ{}a4.prototype.ValueTypeName="string",a4.prototype.ValueBufferType=Array,a4.prototype.DefaultInterpolation=y,a4.prototype.InterpolantFactoryMethodLinear=void 0,a4.prototype.InterpolantFactoryMethodSmooth=void 0;class a5 extends aQ{}a5.prototype.ValueTypeName="vector";class a6{constructor(e,t=-1,i,n=2500){this.name=e,this.tracks=i,this.duration=t,this.blendMode=n,this.uuid=O(),this.duration<0&&this.resetDuration()}static parse(e){let t=[],i=e.tracks,n=1/(e.fps||1);for(let r=0,a=i.length;r!==a;++r)t.push(a7(i[r]).scale(n));let s=new this(e.name,e.duration,t,e.blendMode);return s.uuid=e.uuid,s}static toJSON(e){let t=[],i=e.tracks,n={name:e.name,duration:e.duration,tracks:t,uuid:e.uuid,blendMode:e.blendMode};for(let r=0,a=i.length;r!==a;++r)t.push(aQ.toJSON(i[r]));return n}static CreateFromMorphTargetSequence(e,t,i,n){let r=t.length,a=[];for(let s=0;s<r;s++){let o=[],l=[];o.push((s+r-1)%r,s,(s+1)%r),l.push(0,1,0);let h=aj(o);o=aq(o,1,h),l=aq(l,1,h),n||0!==o[0]||(o.push(r),l.push(l[0])),a.push(new a1(".morphTargetInfluences["+t[s].name+"]",o,l).scale(1/i))}return new this(e,-1,a)}static findByName(e,t){let i=e;Array.isArray(e)||(i=e.geometry&&e.geometry.animations||e.animations);for(let n=0;n<i.length;n++)if(i[n].name===t)return i[n];return null}static CreateClipsFromMorphTargetSequences(e,t,i){let n={},r=/^([\w-]*?)([\d]+)$/;for(let a=0,s=e.length;a<s;a++){let o=e[a],l=o.name.match(r);if(l&&l.length>1){let h=l[1],u=n[h];u||(n[h]=u=[]),u.push(o)}}let c=[];for(let d in n)c.push(this.CreateFromMorphTargetSequence(d,n[d],t,i));return c}static parseAnimation(e,t){if(!e)return console.error("THREE.AnimationClip: No animation in JSONLoader data."),null;let i=function(e,t,i,n,r){if(0!==i.length){let a=[],s=[];aX(i,a,s,n),0!==a.length&&r.push(new e(t,a,s))}},n=[],r=e.name||"default",a=e.fps||30,s=e.blendMode,o=e.length||-1,l=e.hierarchy||[];for(let h=0;h<l.length;h++){let u=l[h].keys;if(u&&0!==u.length){if(u[0].morphTargets){let c={},d;for(d=0;d<u.length;d++)if(u[d].morphTargets)for(let p=0;p<u[d].morphTargets.length;p++)c[u[d].morphTargets[p]]=-1;for(let f in c){let m=[],g=[];for(let v=0;v!==u[d].morphTargets.length;++v){let _=u[d];m.push(_.time),g.push(_.morphTarget===f?1:0)}n.push(new a1(".morphTargetInfluence["+f+"]",m,g))}o=c.length*a}else{let x=".bones["+t[h].name+"]";i(a5,x+".position",u,"pos",n),i(a2,x+".quaternion",u,"rot",n),i(a5,x+".scale",u,"scl",n)}}}if(0===n.length)return null;let y=new this(r,o,n,s);return y}resetDuration(){let e=this.tracks,t=0;for(let i=0,n=e.length;i!==n;++i){let r=this.tracks[i];t=Math.max(t,r.times[r.times.length-1])}return this.duration=t,this}trim(){for(let e=0;e<this.tracks.length;e++)this.tracks[e].trim(0,this.duration);return this}validate(){let e=!0;for(let t=0;t<this.tracks.length;t++)e=e&&this.tracks[t].validate();return e}optimize(){for(let e=0;e<this.tracks.length;e++)this.tracks[e].optimize();return this}clone(){let e=[];for(let t=0;t<this.tracks.length;t++)e.push(this.tracks[t].clone());return new this.constructor(this.name,this.duration,e,this.blendMode)}toJSON(){return this.constructor.toJSON(this)}}function a7(e){if(void 0===e.type)throw Error("THREE.KeyframeTrack: track type undefined, can not parse");let t=function(e){switch(e.toLowerCase()){case"scalar":case"double":case"float":case"number":case"integer":return a1;
186case"vector":case"vector2":case"vector3":case"vector4":return a5;case"color":return a0;case"quaternion":return a2;case"bool":case"boolean":return a$;case"string":return a4}throw Error("THREE.KeyframeTrack: Unsupported typeName: "+e)}(e.type);if(void 0===e.times){let i=[],n=[];aX(e.keys,i,n,"value"),e.times=i,e.values=n}return void 0!==t.parse?t.parse(e):new t(e.name,e.times,e.values,e.interpolation)}let a8={enabled:!1,files:{},add:function(e,t){!1!==this.enabled&&(this.files[e]=t)},get:function(e){if(!1!==this.enabled)return this.files[e]},remove:function(e){delete this.files[e]},clear:function(){this.files={}}},a9=new class{constructor(e,t,i){let n=this,r=!1,a=0,s=0,o,l=[];this.onStart=void 0,this.onLoad=e,this.onProgress=t,this.onError=i,this.itemStart=function(e){s++,!1===r&&void 0!==n.onStart&&n.onStart(e,a,s),r=!0},this.itemEnd=function(e){a++,void 0!==n.onProgress&&n.onProgress(e,a,s),a===s&&(r=!1,void 0!==n.onLoad&&n.onLoad())},this.itemError=function(e){void 0!==n.onError&&n.onError(e)},this.resolveURL=function(e){return o?o(e):e},this.setURLModifier=function(e){return o=e,this},this.addHandler=function(e,t){return l.push(e,t),this},this.removeHandler=function(e){let t=l.indexOf(e);return -1!==t&&l.splice(t,2),this},this.getHandler=function(e){for(let t=0,i=l.length;t<i;t+=2){let n=l[t],r=l[t+1];if(n.global&&(n.lastIndex=0),n.test(e))return r}return null}}};class se{constructor(e){this.manager=void 0!==e?e:a9,this.crossOrigin="anonymous",this.withCredentials=!1,this.path="",this.resourcePath="",this.requestHeader={}}load(){}loadAsync(e,t){let i=this;return new Promise(function(n,r){i.load(e,n,t,r)})}parse(){}setCrossOrigin(e){return this.crossOrigin=e,this}setWithCredentials(e){return this.withCredentials=e,this}setPath(e){return this.path=e,this}setResourcePath(e){return this.resourcePath=e,this}setRequestHeader(e){return this.requestHeader=e,this}}let st={};
186class si extends Error{constructor(e,t){super(e),this.response=t}}class sn extends se{constructor(e){super(e)}load(e,t,i,n){void 0===e&&(e=""),void 0!==this.path&&(e=this.path+e),e=this.manager.resolveURL(e);let r=a8.get(e);if(void 0!==r)return this.manager.itemStart(e),setTimeout(()=>{t&&t(r),this.manager.itemEnd(e)},0),r;if(void 0!==st[e]){st[e].push({onLoad:t,onProgress:i,onError:n});return}st[e]=[],st[e].push({onLoad:t,onProgress:i,onError:n});let a=new Request(e,{headers:new Headers(this.requestHeader),credentials:this.withCredentials?"include":"same-origin"}),s=this.mimeType,o=this.responseType;fetch(a).then(t=>{if(200===t.status||0===t.status){if(0===t.status&&console.warn("THREE.FileLoader: HTTP Status 0 received."),"undefined"==typeof ReadableStream||void 0===t.body||void 0===t.body.getReader)return t;let i=st[e],n=t.body.getReader(),r=t.headers.get("Content-Length"),a=r?parseInt(r):0,s=0!==a,o=0,l=new ReadableStream({start(e){(function t(){n.read().then(({done:n,value:r})=>{if(n)e.close();else{o+=r.byteLength;let l=new ProgressEvent("progress",{lengthComputable:s,loaded:o,total:a});for(let h=0,u=i.length;h<u;h++){let c=i[h];c.onProgress&&c.onProgress(l)}e.enqueue(r),t()}})})()}});return new Response(l)}throw new si(`fetch for "${t.url}" responded with ${t.status}: ${t.statusText}`,t)}).then(e=>{switch(o){case"arraybuffer":return e.arrayBuffer();case"blob":return e.blob();case"document":return e.text().then(e=>{let t=new DOMParser;return t.parseFromString(e,s)});case"json":return e.json();default:if(void 0===s)return e.text();{let t=/charset="?([^;"\s]*)"?/i.exec(s),i=t&&t[1]?t[1].toLowerCase():void 0,n=new TextDecoder(i);return e.arrayBuffer().then(e=>n.decode(e))}}}).then(t=>{a8.add(e,t);let i=st[e];delete st[e];for(let n=0,r=i.length;n<r;n++){let a=i[n];a.onLoad&&a.onLoad(t)}}).catch(t=>{let i=st[e];if(void 0===i)throw this.manager.itemError(e),t;delete st[e];for(let n=0,r=i.length;n<r;n++){let a=i[n];a.onError&&a.onError(t)}this.manager.itemError(e)}).finally(()=>{this.manager.itemEnd(e)}),this.manager.itemStart(e)}setResponseType(e){return this.responseType=e,this}setMimeType(e){return this.mimeType=e,this}}class sr extends se{constructor(e){super(e)}load(e,t,i,n){void 0!==this.path&&(e=this.path+e),e=this.manager.resolveURL(e);let r=this,a=a8.get(e);if(void 0!==a)return r.manager.itemStart(e),setTimeout(function(){t&&t(a),r.manager.itemEnd(e)},0),a;let s=Y("img");function o(){h(),a8.add(e,this),t&&t(this),r.manager.itemEnd(e)}function l(t){h(),n&&n(t),r.manager.itemError(e),r.manager.itemEnd(e)}function h(){s.removeEventListener("load",o,!1),s.removeEventListener("error",l,!1)}return s.addEventListener("load",o,!1),s.addEventListener("error",l,!1),"data:"!==e.slice(0,5)&&void 0!==this.crossOrigin&&(s.crossOrigin=this.crossOrigin),r.manager.itemStart(e),s.src=e,s}}class sa extends se{constructor(e){super(e)}load(e,t,i,n){let r=new ec,a=new sr(this.manager);return a.setCrossOrigin(this.crossOrigin),a.setPath(this.path),a.load(e,function(e){r.image=e,r.needsUpdate=!0,void 0!==t&&t(r)},i,n),r}}class ss extends tl{constructor(e,t=1){super(),this.isLight=!0,this.type="Light",this.color=new ea(e),this.intensity=t}dispose(){}copy(e,t){return super.copy(e,t),this.color.copy(e.color),this.intensity=e.intensity,this}toJSON(e){let t=super.toJSON(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}}class so extends ss{constructor(e,t,i){super(e,i),this.isHemisphereLight=!0,this.type="HemisphereLight",this.position.copy(tl.DefaultUp),this.updateMatrix(),this.groundColor=new ea(t)}copy(e,t){return super.copy(e,t),this.groundColor.copy(e.groundColor),this}}let sl=new eX,sh=new eg,su=new eg;class sc{constructor(e){this.camera=e,this.bias=0,this.normalBias=0,this.radius=1,this.blurSamples=8,this.mapSize=new j(512,512),this.map=null,this.mapPass=null,this.matrix=new eX,this.autoUpdate=!0,this.needsUpdate=!1,this._frustum=new ih,this._frameExtents=new j(1,
1861),this._viewportCount=1,this._viewports=[new ed(0,0,1,1)]}getViewportCount(){return this._viewportCount}getFrustum(){return this._frustum}updateMatrices(e){let t=this.camera,i=this.matrix;sh.setFromMatrixPosition(e.matrixWorld),t.position.copy(sh),su.setFromMatrixPosition(e.target.matrixWorld),t.lookAt(su),t.updateMatrixWorld(),sl.multiplyMatrices(t.projectionMatrix,t.matrixWorldInverse),this._frustum.setFromProjectionMatrix(sl),i.set(.5,0,0,.5,0,.5,0,.5,0,0,.5,.5,0,0,0,1),i.multiply(t.projectionMatrix),i.multiply(t.matrixWorldInverse)}getViewport(e){return this._viewports[e]}getFrameExtents(){return this._frameExtents}dispose(){this.map&&this.map.dispose(),this.mapPass&&this.mapPass.dispose()}copy(e){return this.camera=e.camera.clone(),this.bias=e.bias,this.radius=e.radius,this.mapSize.copy(e.mapSize),this}clone(){return new this.constructor().copy(this)}toJSON(){let 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}}class sd extends sc{constructor(){super(new t8(50,1,.5,500)),this.isSpotLightShadow=!0,this.focus=1}updateMatrices(e){let t=this.camera,i=2*N*e.angle*this.focus,n=this.mapSize.width/this.mapSize.height,r=e.distance||t.far;(i!==t.fov||n!==t.aspect||r!==t.far)&&(t.fov=i,t.aspect=n,t.far=r,t.updateProjectionMatrix()),super.updateMatrices(e)}copy(e){return super.copy(e),this.focus=e.focus,this}}class sp extends ss{constructor(e,t,i=0,n=Math.PI/3,r=0,a=1){super(e,t),this.isSpotLight=!0,this.type="SpotLight",this.position.copy(tl.DefaultUp),this.updateMatrix(),this.target=new tl,this.distance=i,this.angle=n,this.penumbra=r,this.decay=a,this.shadow=new sd}get power(){return this.intensity*Math.PI}set power(e){this.intensity=e/Math.PI}dispose(){this.shadow.dispose()}copy(e,t){return super.copy(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}}let sf=new eX,sm=new eg,sg=new eg;class sv extends sc{constructor(){super(new t8(90,1,.5,500)),this.isPointLightShadow=!0,this._frameExtents=new j(4,2),this._viewportCount=6,this._viewports=[new ed(2,1,1,1),new ed(0,1,1,1),new ed(3,1,1,1),new ed(1,1,1,1),new ed(3,0,1,1),new ed(1,0,1,1)],this._cubeDirections=[new eg(1,0,0),new eg(-1,0,0),new eg(0,0,1),new eg(0,0,-1),new eg(0,1,0),new eg(0,-1,0)],this._cubeUps=[new eg(0,1,0),new eg(0,1,0),new eg(0,1,0),new eg(0,1,0),new eg(0,0,1),new eg(0,0,-1)]}updateMatrices(e,t=0){let i=this.camera,n=this.matrix,r=e.distance||i.far;r!==i.far&&(i.far=r,i.updateProjectionMatrix()),sm.setFromMatrixPosition(e.matrixWorld),i.position.copy(sm),sg.copy(i.position),sg.add(this._cubeDirections[t]),i.up.copy(this._cubeUps[t]),i.lookAt(sg),i.updateMatrixWorld(),n.makeTranslation(-sm.x,-sm.y,-sm.z),sf.multiplyMatrices(i.projectionMatrix,i.matrixWorldInverse),this._frustum.setFromProjectionMatrix(sf)}}class s_ extends ss{constructor(e,t,i=0,n=1){super(e,t),this.isPointLight=!0,this.type="PointLight",this.distance=i,this.decay=n,this.shadow=new sv}get power(){return 4*this.intensity*Math.PI}set power(e){this.intensity=e/(4*Math.PI)}dispose(){this.shadow.dispose()}copy(e,t){return super.copy(e,t),this.distance=e.distance,this.decay=e.decay,this.shadow=e.shadow.clone(),this}}class sx extends sc{constructor(){super(new iS(-5,5,5,-5,.5,500)),this.isDirectionalLightShadow=!0}}class sy extends ss{constructor(e,t){super(e,t),this.isDirectionalLight=!0,this.type="DirectionalLight",this.position.copy(tl.DefaultUp),this.updateMatrix(),this.target=new tl,this.shadow=new sx}dispose(){this.shadow.dispose()}copy(e){return super.copy(e),this.target=e.target.clone(),this.shadow=e.shadow.clone(),this}}class sM extends ss{constructor(e,t){super(e,t),this.isAmbientLight=!0,this.type="AmbientLight"}}class sb{static decodeText(e){if("undefined"!=typeof TextDecoder)return new TextDecoder().decode(e);let t="";for(let i=0,n=e.length;i<n;i++)t+=String.fromCharCode(e[i]);try{return decodeURIComponent(escape(t))}catch(r){return t}}static extractUrlBase(e){let t=e.lastIndexOf("/");return -1===t?"./":e.slice(0,t+1)}static resolveURL(e,t){return"string"!=typeof e||""===e?"":(/^https?:\/\//i.test(t)&&/^\//.test(e)&&(t=t.replace(/(^https?:\/\/[^\/]+).*/i,"$1")),/^(https?:)?\/\//i.test(e)||/^data:.*,.*$/i.test(e)||/^blob:.*$/i.test(e))?e:t+e}}class sS extends se{constructor(e){super(e),this.isImageBitmapLoader=!0,"undefined"==typeof createImageBitmap&&console.warn("THREE.ImageBitmapLoader: createImageBitmap() not supported."),"undefined"==typeof fetch&&console.warn("THREE.ImageBitmapLoader: fetch() not supported."),this.options={premultiplyAlpha:"none"}}setOptions(e){return this.options=e,this}load(e,t,i,n){void 0===e&&(e=""),void 0!==this.path&&(e=this.path+e),e=this.manager.resolveURL(e);let r=this,a=a8.get(e);if(void 0!==a)return r.manager.itemStart(e),setTimeout(function(){t&&t(a),r.manager.itemEnd(e)},0),a;let s={};s.credentials="anonymous"===this.crossOrigin?"same-origin":"include",s.headers=this.requestHeader,fetch(e,s).then(function(e){return e.blob()}).then(function(e){return createImageBitmap(e,Object.assign(r.options,{colorSpaceConversion:"none"}))}).then(function(i){a8.add(e,i),t&&t(i),r.manager.itemEnd(e)}).catch(function(t){n&&n(t),r.manager.itemError(e),r.manager.itemEnd(e)}),r.manager.itemStart(e)}}class sw{constructor(e=!0){this.autoStart=e,this.startTime=0,this.oldTime=0,this.elapsedTime=0,this.running=!1}start(){this.startTime=sT(),this.oldTime=this.startTime,this.elapsedTime=0,this.running=!0}stop(){this.getElapsedTime(),this.running=!1,this.autoStart=!1}getElapsedTime(){return this.getDelta(),this.elapsedTime}getDelta(){let e=0;if(this.autoStart&&!this.running)return this.start(),0;if(this.running){let t=sT();e=(t-this.oldTime)/1e3,this.oldTime=t,this.elapsedTime+=e}return e}}function sT(){return("undefined"==typeof performance?Date:performance).now()}let sE="\\[\\]\\.:\\/",sA=RegExp("["+sE+"]","g"),sC="[^"+sE+"]",sL="[^"+sE.replace("\\.","")+"]",sP=/((?:WC+[\/:])*)/.source.replace("WC",sC),sR=/(WCOD+)?/.source.replace("WCOD",sL),sD=/(?:\.(WC+)(?:\[(.+)\])?)?/.source.replace("WC",sC),sI=/\.(WC+)(?:\[(.+)\])?/.source.replace("WC",sC),sN=RegExp("^"+sP+sR+sD+sI+"$"),sO=["material","materials","bones"];class sz{constructor(e,t,i){this.path=t,this.parsedPath=i||sz.parseTrackName(t),this.node=sz.findNode(e,this.parsedPath.nodeName)||e,this.rootNode=e,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}static create(e,t,i){return e&&e.isAnimationObjectGroup?new sz.Composite(e,t,i):new sz(e,t,i)}static sanitizeNodeName(e){return e.replace(/\s/g,"_").replace(sA,"")}static parseTrackName(e){let t=sN.exec(e);if(null===t)throw Error("PropertyBinding: Cannot parse trackName: "+e);let i={nodeName:t[2],objectName:t[3],objectIndex:t[4],propertyName:t[5],propertyIndex:t[6]},n=i.nodeName&&i.nodeName.lastIndexOf(".");if(void 0!==n&&-1!==n){let r=i.nodeName.substring(n+1);-1!==sO.indexOf(r)&&(i.nodeName=i.nodeName.substring(0,n),i.objectName=r)}if(null===i.propertyName||0===i.propertyName.length)throw Error("PropertyBinding: can not parse propertyName from trackName: "+e);return i}static findNode(e,t){if(void 0===t||""===t||"."===t||-1===t||t===e.name||t===e.uuid)return e;if(e.skeleton){let i=e.skeleton.getBoneByName(t);if(void 0!==i)return i}if(e.children){let n=function(e){for(let i=0;i<e.length;i++){let r=e[i];if(r.name===t||r.uuid===t)return r;let a=n(r.children);if(a)return a}return null},r=n(e.children);if(r)return r}return null}_getValue_unavailable(){}_setValue_unavailable(){}_getValue_direct(e,t){e[t]=this.targetObject[this.propertyName]}_getValue_array(e,t){let i=this.resolvedProperty;for(let n=0,r=i.length;n!==r;++n)e[t++]=i[n]}_getValue_arrayElement(e,t){e[t]=this.resolvedProperty[this.propertyIndex]}_getValue_toArray(e,t){this.resolvedProperty.toArray(e,t)}_setValue_direct(e,t){this.targetObject[this.propertyName]=e[t]}_setValue_direct_setNeedsUpdate(e,t){this.targetObject[this.propertyName]=e[t],this.targetObject.needsUpdate=!0}_setValue_direct_setMatrixWorldNeedsUpdate(e,t){this.targetObject[this.propertyName]=e[t],this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_array(e,t){let i=this.resolvedProperty;for(let n=0,r=i.length;n!==r;++n)i[n]=e[t++]}_setValue_array_setNeedsUpdate(e,t){let i=this.resolvedProperty;for(let n=0,r=i.length;n!==r;++n)i[n]=e[t++];this.targetObject.needsUpdate=!0}
186_setValue_array_setMatrixWorldNeedsUpdate(e,t){let i=this.resolvedProperty;for(let n=0,r=i.length;n!==r;++n)i[n]=e[t++];this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_arrayElement(e,t){this.resolvedProperty[this.propertyIndex]=e[t]}_setValue_arrayElement_setNeedsUpdate(e,t){this.resolvedProperty[this.propertyIndex]=e[t],this.targetObject.needsUpdate=!0}_setValue_arrayElement_setMatrixWorldNeedsUpdate(e,t){this.resolvedProperty[this.propertyIndex]=e[t],this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_fromArray(e,t){this.resolvedProperty.fromArray(e,t)}_setValue_fromArray_setNeedsUpdate(e,t){this.resolvedProperty.fromArray(e,t),this.targetObject.needsUpdate=!0}_setValue_fromArray_setMatrixWorldNeedsUpdate(e,t){this.resolvedProperty.fromArray(e,t),this.targetObject.matrixWorldNeedsUpdate=!0}_getValue_unbound(e,t){this.bind(),this.getValue(e,t)}_setValue_unbound(e,t){this.bind(),this.setValue(e,t)}bind(){let e=this.node,t=this.parsedPath,i=t.objectName,n=t.propertyName,r=t.propertyIndex;if(e||(e=sz.findNode(this.rootNode,t.nodeName)||this.rootNode,this.node=e),this.getValue=this._getValue_unavailable,this.setValue=this._setValue_unavailable,!e){console.error("THREE.PropertyBinding: Trying to update node for track: "+this.path+" but it wasn't found.");return}if(i){let a=t.objectIndex;switch(i){case"materials":if(!e.material){console.error("THREE.PropertyBinding: Can not bind to material as node does not have a material.",this);return}if(!e.material.materials){console.error("THREE.PropertyBinding: Can not bind to material.materials as node.material does not have a materials array.",this);return}e=e.material.materials;break;case"bones":if(!e.skeleton){console.error("THREE.PropertyBinding: Can not bind to bones as node does not have a skeleton.",this);return}e=e.skeleton.bones;for(let s=0;s<e.length;s++)if(e[s].name===a){a=s;break}break;default:if(void 0===e[i]){console.error("THREE.PropertyBinding: Can not bind to objectName of node undefined.",this);return}e=e[i]}if(void 0!==a){if(void 0===e[a]){console.error("THREE.PropertyBinding: Trying to bind to objectIndex of objectName, but is undefined.",this,e);return}e=e[a]}}let o=e[n];if(void 0===o){let l=t.nodeName;console.error("THREE.PropertyBinding: Trying to update property for track: "+l+"."+n+" but it wasn't found.",e);return}let h=this.Versioning.None;this.targetObject=e,void 0!==e.needsUpdate?h=this.Versioning.NeedsUpdate:void 0!==e.matrixWorldNeedsUpdate&&(h=this.Versioning.MatrixWorldNeedsUpdate);let u=this.BindingType.Direct;if(void 0!==r){if("morphTargetInfluences"===n){if(!e.geometry){console.error("THREE.PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.",this);return}if(!e.geometry.morphAttributes){console.error("THREE.PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.morphAttributes.",this);return}void 0!==e.morphTargetDictionary[r]&&(r=e.morphTargetDictionary[r])}u=this.BindingType.ArrayElement,this.resolvedProperty=o,this.propertyIndex=r}else void 0!==o.fromArray&&void 0!==o.toArray?(u=this.BindingType.HasFromToArray,this.resolvedProperty=o):Array.isArray(o)?(u=this.BindingType.EntireArray,this.resolvedProperty=o):this.propertyName=n;this.getValue=this.GetterByBindingType[u],this.setValue=this.SetterByBindingTypeAndVersioning[u][h]}unbind(){this.node=null,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}}sz.Composite=class{constructor(e,t,i){let n=i||sz.parseTrackName(t);this._targetGroup=e,this._bindings=e.subscribe_(t,n)}getValue(e,t){this.bind();let i=this._targetGroup.nCachedObjects_,n=this._bindings[i];void 0!==n&&n.getValue(e,t)}setValue(e,t){let i=this._bindings;for(let n=this._targetGroup.nCachedObjects_,r=i.length;n!==r;++n)i[n].setValue(e,t)}bind(){let e=this._bindings;for(let t=this._targetGroup.nCachedObjects_,i=e.length;t!==i;++t)e[t].bind()}unbind(){let e=this._bindings;for(let t=this._targetGroup.nCachedObjects_,i=e.length;t!==i;++t)e[t].unbind()}},sz.prototype.BindingType={Direct:0,EntireArray:1,ArrayElement:2,HasFromToArray:3},sz.prototype.Versioning={None:0,NeedsUpdate:1,MatrixWorldNeedsUpdate:2},sz.prototype.GetterByBindingType=[sz.prototype._getValue_direct,sz.prototype._getValue_array,sz.prototype._getValue_arrayElement,sz.prototype._getValue_toArray,],sz.prototype.SetterByBindingTypeAndVersioning=[[sz.prototype._setValue_direct,sz.prototype._setValue_direct_setNeedsUpdate,sz.prototype._setValue_direct_setMatrixWorldNeedsUpdate,],[sz.prototype._setValue_array,sz.prototype._setValue_array_setNeedsUpdate,sz.prototype._setValue_array_setMatr
186ixWorldNeedsUpdate,],[sz.prototype._setValue_arrayElement,sz.prototype._setValue_arrayElement_setNeedsUpdate,sz.prototype._setValue_arrayElement_setMatrixWorldNeedsUpdate,],[sz.prototype._setValue_fromArray,sz.prototype._setValue_fromArray_setNeedsUpdate,sz.prototype._setValue_fromArray_setMatrixWorldNeedsUpdate,]],new Float32Array(1);class sU{constructor(e,t,i=0,n=1/0){this.ray=new eq(e,t),this.near=i,this.far=n,this.camera=null,this.layers=new e4,this.params={Mesh:{},Line:{threshold:1},LOD:{},Points:{threshold:1},Sprite:{}}}set(e,t){this.ray.set(e,t)}setFromCamera(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)}intersectObject(e,t=!0,i=[]){return sB(e,this,i,t),i.sort(sF),i}intersectObjects(e,t=!0,i=[]){for(let n=0,r=e.length;n<r;n++)sB(e[n],this,i,t);return i.sort(sF),i}}function sF(e,t){return e.distance-t.distance}function sB(e,t,i,n){if(e.layers.test(t.layers)&&e.raycast(t,i),!0===n){let r=e.children;for(let a=0,s=r.length;a<s;a++)sB(r[a],t,i,!0)}}class sk{constructor(e=1,t=0,i=0){return this.radius=e,this.phi=t,this.theta=i,this}set(e,t,i){return this.radius=e,this.phi=t,this.theta=i,this}copy(e){return this.radius=e.radius,this.phi=e.phi,this.theta=e.theta,this}makeSafe(){return this.phi=Math.max(1e-6,Math.min(Math.PI-1e-6,this.phi)),this}setFromVector3(e){return this.setFromCartesianCoords(e.x,e.y,e.z)}setFromCartesianCoords(e,t,i){return this.radius=Math.sqrt(e*e+t*t+i*i),0===this.radius?(this.theta=0,this.phi=0):(this.theta=Math.atan2(e,i),this.phi=Math.acos(z(t/this.radius,-1,1))),this}clone(){return new this.constructor().copy(this)}}let sV=new j;class sG{constructor(e=new j(Infinity,Infinity),t=new j(-1/0,-1/0)){this.isBox2=!0,this.min=e,this.max=t}set(e,t){return this.min.copy(e),this.max.copy(t),this}setFromPoints(e){this.makeEmpty();for(let t=0,i=e.length;t<i;t++)this.expandByPoint(e[t]);return this}setFromCenterAndSize(e,t){let i=sV.copy(t).multiplyScalar(.5);return this.min.copy(e).sub(i),this.max.copy(e).add(i),this}clone(){return new this.constructor().copy(this)}copy(e){return this.min.copy(e.min),this.max.copy(e.max),this}makeEmpty(){return this.min.x=this.min.y=Infinity,this.max.x=this.max.y=-1/0,this}isEmpty(){return this.max.x<this.min.x||this.max.y<this.min.y}getCenter(e){return this.isEmpty()?e.set(0,0):e.addVectors(this.min,this.max).multiplyScalar(.5)}getSize(e){return this.isEmpty()?e.set(0,0):e.subVectors(this.max,this.min)}expandByPoint(e){return this.min.min(e),this.max.max(e),this}expandByVector(e){return this.min.sub(e),this.max.add(e),this}expandByScalar(e){return this.min.addScalar(-e),this.max.addScalar(e),this}containsPoint(e){return!(e.x<this.min.x)&&!(e.x>this.max.x)&&!(e.y<this.min.y)&&!(e.y>this.max.y)}containsBox(e){return this.min.x<=e.min.x&&e.max.x<=this.max.x&&this.min.y<=e.min.y&&e.max.y<=this.max.y}getParameter(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))}intersectsBox(e){return!(e.max.x<this.min.x)&&!(e.min.x>this.max.x)&&!(e.max.y<this.min.y)&&!(e.min.y>this.max.y)}clampPoint(e,t){return t.copy(e).clamp(this.min,this.max)}distanceToPoint(e){let t=sV.copy(e).clamp(this.min,this.max);return t.sub(e).length()}intersect(e){return this.min.max(e.min),this.max.min(e.max),this}union(e){return this.min.min(e.min),this.max.max(e.max),this}translate(e){return this.min.add(e),this.max.add(e),this}equals(e){return e.min.equals(this.min)&&e.max.equals(this.max)}}class sH{constructor(){this.type="ShapePath",this.color=new ea,this.subPaths=[],this.currentPath=null}moveTo(e,t){return this.currentPath=new ah,this.subPaths.push(this.currentPath),this.currentPath.moveTo(e,t),this}lineTo(e,t){return this.currentPath.lineTo(e,t),this}quadraticCurveTo(e,t,i,n){return this.currentPath.quadraticCurveTo(e,t,i,n),this}bezierCurveTo(e,t,i,n,r,a){return this.currentPath.bezierCurveTo(e,t,i,n,r,a),this}splineThru(e){return this.currentPath.splineThru(e),this}toShapes(e,t){function i(e){let t=[];for(let i=0,n=e.length;i<n;i++){let r=e[i],a=new au;a.curves=r.curves,t.push(a)}return t}function n(e,t){let i=t.length,n=!1;for(let r=i-1,a=0;a<i;r=a++){let s=t[r],o=t[a],l=o.x-s.x,h=o.y-s.y;
186if(Math.abs(h)>Number.EPSILON){if(h<0&&(s=t[a],l=-l,o=t[r],h=-h),e.y<s.y||e.y>o.y)continue;if(e.y===s.y){if(e.x===s.x)return!0}else{let u=h*(e.x-s.x)-l*(e.y-s.y);if(0===u)return!0;if(u<0)continue;n=!n}}else{if(e.y!==s.y)continue;if(o.x<=e.x&&e.x<=s.x||s.x<=e.x&&e.x<=o.x)return!0}}return n}let r=az.isClockWise,a=this.subPaths;if(0===a.length)return[];if(!0===t)return i(a);let s,o,l,h=[];if(1===a.length)return o=a[0],(l=new au).curves=o.curves,h.push(l),h;let u=!r(a[0].getPoints());u=e?!u:u;let c=[],d=[],p=[],f=0,m;d[f]=void 0,p[f]=[];for(let g=0,v=a.length;g<v;g++)s=r(m=(o=a[g]).getPoints()),(s=e?!s:s)?(!u&&d[f]&&f++,d[f]={s:new au,p:m},d[f].s.curves=o.curves,u&&f++,p[f]=[]):p[f].push({h:o,p:m[0]});if(!d[0])return i(a);if(d.length>1){let _=!1,x=0;for(let y=0,M=d.length;y<M;y++)c[y]=[];for(let b=0,S=d.length;b<S;b++){let w=p[b];for(let T=0;T<w.length;T++){let E=w[T],A=!0;for(let C=0;C<d.length;C++)n(E.p,d[C].p)&&(b!==C&&x++,A?(A=!1,c[C].push(E)):_=!0);A&&c[b].push(E)}}x>0&&!1===_&&(p=c)}let L;for(let P=0,R=d.length;P<R;P++){l=d[P].s,h.push(l),L=p[P];for(let D=0,I=L.length;D<I;D++)l.holes.push(L[D].h)}return h}}!function(){let e=new ArrayBuffer(4),t=new Float32Array(e),i=new Uint32Array(e),n=new Uint32Array(512),r=new Uint32Array(512);for(let a=0;a<256;++a){let s=a-127;s<-27?(n[a]=0,n[256|a]=32768,r[a]=24,r[256|a]=24):s<-14?(n[a]=1024>>-s-14,n[256|a]=1024>>-s-14|32768,r[a]=-s-1,r[256|a]=-s-1):s<=15?(n[a]=s+15<<10,n[256|a]=s+15<<10|32768,r[a]=13,r[256|a]=13):s<128?(n[a]=31744,n[256|a]=64512,r[a]=24,r[256|a]=24):(n[a]=31744,n[256|a]=64512,r[a]=13,r[256|a]=13)}let o=new Uint32Array(2048),l=new Uint32Array(64),h=new Uint32Array(64);for(let u=1;u<1024;++u){let c=u<<13,d=0;for(;(8388608&c)==0;)c<<=1,d-=8388608;c&=-8388609,d+=947912704,o[u]=c|d}for(let p=1024;p<2048;++p)o[p]=939524096+(p-1024<<13);for(let f=1;f<31;++f)l[f]=f<<23;l[31]=1199570944,l[32]=2147483648;for(let m=33;m<63;++m)l[m]=2147483648+(m-32<<23);l[63]=3347054592;for(let g=1;g<64;++g)32!==g&&(h[g]=1024);return{floatView:t,uint32View:i,baseTable:n,shiftTable:r,mantissaTable:o,exponentTable:l,offsetTable:h}}(),"undefined"!=typeof __THREE_DEVTOOLS__&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("register",{detail:{revision:"143"}})),"undefined"!=typeof window&&(window.__THREE__?console.warn("WARNING: Multiple instances of Three.js being imported."):window.__THREE__="143")}}]);

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.