PageSourceSearch

https://marfi.ai/assets/three.module-BabJXfqt.js

js marfi.ai collected 2026-10-05 14:01:48 UTC 703,989 bytes, 3,832 lines download raw bytes

vendor: 4,217 bytes, line 1
1const iv="179",sv={LEFT:0,MIDDLE:1,RIGHT:2,ROTATE:0,DOLLY:1,PAN:2},rv={ROTATE:0,PAN:1,DOLLY_PAN:2,DOLLY_ROTATE:3},Fu=0,$l=1,Ou=2,av=3,ov=0,Nh=1,Bu=2,Tn=3,Xn=0,Ve=1,An=2,Gn=0,Qi=1,Kl=2,Ql=3,jl=4,zu=5,fi=100,ku=101,Vu=102,Hu=103,Gu=104,Wu=200,Xu=201,qu=202,Yu=203,po=204,mo=205,Zu=206,Ju=207,$u=208,Ku=209,Qu=210,ju=211,td=212,ed=213,nd=214,go=0,_o=1,xo=2,ns=3,vo=4,yo=5,Mo=6,So=7,ca=0,id=1,sd=2,Wn=0,rd=1,ad=2,od=3,ld=4,cd=5,hd=6,ud=7,tc="attached",dd="detached",sl=300,qn=301,xi=302,Zr=303,Jr=304,Gs=306,$r=1e3,ln=1001,Kr=1002,Re=1003,Fh=1004,lv=1004,Ts=1005,cv=1005,Ee=1006,Vr=1007,hv=1007,Cn=1008,uv=1008,mn=1009,Oh=1010,Bh=1011,Ds=1012,rl=1013,Yn=1014,Je=1015,Ws=1016,al=1017,ol=1018,Us=1020,zh=35902,kh=1021,Vh=1022,ke=1023,Ns=1026,Fs=1027,ll=1028,ha=1029,Hh=1030,cl=1031,dv=1032,hl=1033,Hr=33776,Gr=33777,Wr=33778,Xr=33779,bo=35840,Eo=35841,To=35842,Ao=35843,wo=36196,Co=37492,Ro=37496,Io=37808,Po=37809,Lo=37810,Do=37811,Uo=37812,No=37813,Fo=37814,Oo=37815,Bo=37816,zo=37817,ko=37818,Vo=37819,Ho=37820,Go=37821,qr=36492,Wo=36494,Xo=36495,Gh=36283,qo=36284,Yo=36285,Zo=36286,fd=2200,pd=2201,md=2202,Qr=2300,Jo=2301,Ma=2302,Zi=2400,Ji=2401,jr=2402,ul=2500,Wh=2501,fv=0,pv=1,mv=2,gd=3200,_d=3201,gv=3202,_v=3203,Mi=0,xd=1,Hn="",Ye="srgb",is="srgb-linear",ta="linear",ae="srgb",xv=0,Ai=7680,vv=7681,yv=7682,Mv=7683,Sv=34055,bv=34056,Ev=5386,Tv=512,Av=513,wv=514,Cv=515,Rv=516,Iv=517,Pv=518,ec=519,vd=512,yd=513,Md=514,Xh=515,Sd=516,bd=517,Ed=518,Td=519,ea=35044,Lv=35048,Dv=35040,Uv=35045,Nv=35049,Fv=35041,Ov=35046,Bv=35050,zv=35042,kv="100",nc="300 es",nn=2e3,Os=2001,Vv={COMPUTE:"compute",RENDER:"render"},Hv={PERSPECTIVE:"perspective",LINEAR:"linear",FLAT:"flat"},Gv={NORMAL:"normal",CENTROID:"centroid",SAMPLE:"sample",FIRST:"first",EITHER:"either"};class Dn{addEventListener(t,e){this._listeners===void 0&&(this._listeners={});const n=this._listeners;n[t]===void 0&&(n[t]=[]),n[t].indexOf(e)===-1&&n[t].push(e)}hasEventListener(t,e){const n=this._listeners;return n===void 0?!1:n[t]!==void 0&&n[t].indexOf(e)!==-1}removeEventListener(t,e){const n=this._listeners;if(n===void 0)return;const i=n[t];if(i!==void 0){const s=i.indexOf(e);s!==-1&&i.splice(s,1)}}dispatchEvent(t){const e=this._listeners;if(e===void 0)return;const n=e[t.type];if(n!==void 0){t.target=this;const i=n.slice(0);for(let s=0,a=i.length;s<a;s++)i[s].call(this,t);t.target=null}}}const Te=["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"];let ic=1234567;const _i=Math.PI/180,ss=180/Math.PI;function $e(){const r=Math.random()*4294967295|0,t=Math.random()*4294967295|0,e=Math.random()*4294967295|0,n=Math.random()*4294967295|0;return(Te[r&255]+Te[r>>8&255]+Te[r>>16&255]+Te[r>>24&255]+"-"+Te[t&255]+Te[t>>8&255]+"-"+Te[t>>16&15|64]+Te[t>>24&255]+"-"+Te[e&63|128]+Te[e>>8&255]+"-"+Te[e>>16&255]+Te[e>>24&255]+Te[n&255]+Te[n>>8&255]+Te[n>>16&255]+Te[n>>24&255]).toLowerCase()}function Nt(r,t,e){return Math.max(t,Math.min(e,r))}function dl(r,t){return(r%t+t)%t}function Ad(r,t,e,n,i){return n+(r-t)*(i-n)/(e-t)}
vendor: 4,302 bytes, line 1
1function wd(r,t,e){return r!==t?(e-r)/(t-r):0}function Is(r,t,e){return(1-e)*r+e*t}function Cd(r,t,e,n){return Is(r,t,1-Math.exp(-e*n))}function Rd(r,t=1){return t-Math.abs(dl(r,t*2)-t)}function Id(r,t,e){return r<=t?0:r>=e?1:(r=(r-t)/(e-t),r*r*(3-2*r))}function Pd(r,t,e){return r<=t?0:r>=e?1:(r=(r-t)/(e-t),r*r*r*(r*(r*6-15)+10))}function Ld(r,t){return r+Math.floor(Math.random()*(t-r+1))}function Dd(r,t){return r+Math.random()*(t-r)}function Ud(r){return r*(.5-Math.random())}function Nd(r){r!==void 0&&(ic=r);let t=ic+=1831565813;return t=Math.imul(t^t>>>15,t|1),t^=t+Math.imul(t^t>>>7,t|61),((t^t>>>14)>>>0)/4294967296}function Fd(r){return r*_i}function Od(r){return r*ss}function Bd(r){return(r&r-1)===0&&r!==0}function zd(r){return Math.pow(2,Math.ceil(Math.log(r)/Math.LN2))}function kd(r){return Math.pow(2,Math.floor(Math.log(r)/Math.LN2))}function Vd(r,t,e,n,i){const s=Math.cos,a=Math.sin,o=s(e/2),l=a(e/2),c=s((t+n)/2),h=a((t+n)/2),u=s((t-n)/2),d=a((t-n)/2),f=s((n-t)/2),m=a((n-t)/2);switch(i){case"XYX":r.set(o*h,l*u,l*d,o*c);break;case"YZY":r.set(l*d,o*h,l*u,o*c);break;case"ZXZ":r.set(l*u,l*d,o*h,o*c);break;case"XZX":r.set(o*h,l*m,l*f,o*c);break;case"YXY":r.set(l*f,o*h,l*m,o*c);break;case"ZYZ":r.set(l*m,l*f,o*h,o*c);break;default:console.warn("THREE.MathUtils: .setQuaternionFromProperEuler() encountered an unknown order: "+i)}}function Ue(r,t){switch(t.constructor){case Float32Array:return r;case Uint32Array:return r/4294967295;case Uint16Array:return r/65535;case Uint8Array:return r/255;case Int32Array:return Math.max(r/2147483647,-1);case Int16Array:return Math.max(r/32767,-1);case Int8Array:return Math.max(r/127,-1);default:throw new Error("Invalid component type.")}}function qt(r,t){switch(t.constructor){case Float32Array:return r;case Uint32Array:return Math.round(r*4294967295);case Uint16Array:return Math.round(r*65535);case Uint8Array:return Math.round(r*255);case Int32Array:return Math.round(r*2147483647);case Int16Array:return Math.round(r*32767);case Int8Array:return Math.round(r*127);default:throw new Error("Invalid component type.")}}const Wv={DEG2RAD:_i,RAD2DEG:ss,generateUUID:$e,clamp:Nt,euclideanModulo:dl,mapLinear:Ad,inverseLerp:wd,lerp:Is,damp:Cd,pingpong:Rd,smoothstep:Id,smootherstep:Pd,randInt:Ld,randFloat:Dd,randFloatSpread:Ud,seededRandom:Nd,degToRad:Fd,radToDeg:Od,isPowerOfTwo:Bd,ceilPowerOfTwo:zd,floorPowerOfTwo:kd,setQuaternionFromProperEuler:Vd,normalize:qt,denormalize:Ue};class K{constructor(t=0,e=0){K.prototype.isVector2=!0,this.x=t,this.y=e}get width(){return this.x}set width(t){this.x=t}get height(){return this.y}set height(t){this.y=t}set(t,e){return this.x=t,this.y=e,this}setScalar(t){return this.x=t,this.y=t,this}setX(t){return this.x=t,this}setY(t){return this.y=t,this}setComponent(t,e){switch(t){case 0:this.x=e;break;case 1:this.y=e;break;default:throw new Error("index is out of range: "+t)}return this}getComponent(t){switch(t){case 0:return this.x;case 1:return this.y;default:throw new Error("index is out of range: "+t)}}clone(){return new this.constructor(this.x,this.y)}copy(t){return this.x=t.x,this.y=t.y,this}add(t){return this.x+=t.x,this.y+=t.y,this}addScalar(t){return this.x+=t,this.y+=t,this}addVectors(t,e){return this.x=t.x+e.x,this.y=t.y+e.y,this}addScaledVector(t,e){return this.x+=t.x*e,this.y+=t.y*e,this}sub(t){return this.x-=t.x,this.y-=t.y,this}subScalar(t){return this.x-=t,this.y-=t,this}subVectors(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this}multiply(t){return this.x*=t.x,this.y*=t.y,this}multiplyScalar(t){return this.x*=t,this.y*=t,this}divide(t){return this.x/=t.x,this.y/=t.y,this}divideScalar(t){return this.multiplyScalar(1/t)}applyMatrix3(t){const e=this.x,n=this.y,i=t.elements;return this.x=i[0]*e+i[3]*n+i[6],this.y=i[1]*e+i[4]*n+i[7],this}min(t){return this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y),this}max(t){return this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y),this}clamp(t,e){return this.x=Nt(this.x,t.x,e.x),this.y=Nt(this.y,t.y,e.y),this}clampScalar(t,e){return this.x=Nt(this.x,t,e),this.y=Nt(this.y,t,e),this}clampLength(t,e){const n=this.length();return this.divideScalar(n||1).multiplyScalar(Nt(n,t,e))}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}
vendor: 5,025 bytes, line 1
1round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this}negate(){return this.x=-this.x,this.y=-this.y,this}dot(t){return this.x*t.x+this.y*t.y}cross(t){return this.x*t.y-this.y*t.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(){return Math.atan2(-this.y,-this.x)+Math.PI}angleTo(t){const e=Math.sqrt(this.lengthSq()*t.lengthSq());if(e===0)return Math.PI/2;const n=this.dot(t)/e;return Math.acos(Nt(n,-1,1))}distanceTo(t){return Math.sqrt(this.distanceToSquared(t))}distanceToSquared(t){const e=this.x-t.x,n=this.y-t.y;return e*e+n*n}manhattanDistanceTo(t){return Math.abs(this.x-t.x)+Math.abs(this.y-t.y)}setLength(t){return this.normalize().multiplyScalar(t)}lerp(t,e){return this.x+=(t.x-this.x)*e,this.y+=(t.y-this.y)*e,this}lerpVectors(t,e,n){return this.x=t.x+(e.x-t.x)*n,this.y=t.y+(e.y-t.y)*n,this}equals(t){return t.x===this.x&&t.y===this.y}fromArray(t,e=0){return this.x=t[e],this.y=t[e+1],this}toArray(t=[],e=0){return t[e]=this.x,t[e+1]=this.y,t}fromBufferAttribute(t,e){return this.x=t.getX(e),this.y=t.getY(e),this}rotateAround(t,e){const n=Math.cos(e),i=Math.sin(e),s=this.x-t.x,a=this.y-t.y;return this.x=s*n-a*i+t.x,this.y=s*i+a*n+t.y,this}random(){return this.x=Math.random(),this.y=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y}}class Ke{constructor(t=0,e=0,n=0,i=1){this.isQuaternion=!0,this._x=t,this._y=e,this._z=n,this._w=i}static slerpFlat(t,e,n,i,s,a,o){let l=n[i+0],c=n[i+1],h=n[i+2],u=n[i+3];const d=s[a+0],f=s[a+1],m=s[a+2],_=s[a+3];if(o===0){t[e+0]=l,t[e+1]=c,t[e+2]=h,t[e+3]=u;return}if(o===1){t[e+0]=d,t[e+1]=f,t[e+2]=m,t[e+3]=_;return}if(u!==_||l!==d||c!==f||h!==m){let g=1-o;const p=l*d+c*f+h*m+u*_,y=p>=0?1:-1,v=1-p*p;if(v>Number.EPSILON){const A=Math.sqrt(v),T=Math.atan2(A,p*y);g=Math.sin(g*T)/A,o=Math.sin(o*T)/A}const x=o*y;if(l=l*g+d*x,c=c*g+f*x,h=h*g+m*x,u=u*g+_*x,g===1-o){const A=1/Math.sqrt(l*l+c*c+h*h+u*u);l*=A,c*=A,h*=A,u*=A}}t[e]=l,t[e+1]=c,t[e+2]=h,t[e+3]=u}static multiplyQuaternionsFlat(t,e,n,i,s,a){const o=n[i],l=n[i+1],c=n[i+2],h=n[i+3],u=s[a],d=s[a+1],f=s[a+2],m=s[a+3];return t[e]=o*m+h*u+l*f-c*d,t[e+1]=l*m+h*d+c*u-o*f,t[e+2]=c*m+h*f+o*d-l*u,t[e+3]=h*m-o*u-l*d-c*f,t}get x(){return this._x}set x(t){this._x=t,this._onChangeCallback()}get y(){return this._y}set y(t){this._y=t,this._onChangeCallback()}get z(){return this._z}set z(t){this._z=t,this._onChangeCallback()}get w(){return this._w}set w(t){this._w=t,this._onChangeCallback()}set(t,e,n,i){return this._x=t,this._y=e,this._z=n,this._w=i,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._w)}copy(t){return this._x=t.x,this._y=t.y,this._z=t.z,this._w=t.w,this._onChangeCallback(),this}setFromEuler(t,e=!0){const n=t._x,i=t._y,s=t._z,a=t._order,o=Math.cos,l=Math.sin,c=o(n/2),h=o(i/2),u=o(s/2),d=l(n/2),f=l(i/2),m=l(s/2);switch(a){case"XYZ":this._x=d*h*u+c*f*m,this._y=c*f*u-d*h*m,this._z=c*h*m+d*f*u,this._w=c*h*u-d*f*m;break;case"YXZ":this._x=d*h*u+c*f*m,this._y=c*f*u-d*h*m,this._z=c*h*m-d*f*u,this._w=c*h*u+d*f*m;break;case"ZXY":this._x=d*h*u-c*f*m,this._y=c*f*u+d*h*m,this._z=c*h*m+d*f*u,this._w=c*h*u-d*f*m;break;case"ZYX":this._x=d*h*u-c*f*m,this._y=c*f*u+d*h*m,this._z=c*h*m-d*f*u,this._w=c*h*u+d*f*m;break;case"YZX":this._x=d*h*u+c*f*m,this._y=c*f*u+d*h*m,this._z=c*h*m-d*f*u,this._w=c*h*u-d*f*m;break;case"XZY":this._x=d*h*u-c*f*m,this._y=c*f*u-d*h*m,this._z=c*h*m+d*f*u,this._w=c*h*u+d*f*m;break;default:console.warn("THREE.Quaternion: .setFromEuler() encountered an unknown order: "+a)}return e===!0&&this._onChangeCallback(),this}setFromAxisAngle(t,e){const n=e/2,i=Math.sin(n);return this._x=t.x*i,this._y=t.y*i,this._z=t.z*i,this._w=Math.cos(n),this._onChangeCallback(),this}setFromRotationMatrix(t){const e=t.elements,n=e[0],i=e[4],s=e[8],a=e[1],o=e[5],l=e[9],c=e[2],h=e[6],u=e[10],d=n+o+u;if(d>0){const f=.5/Math.sqrt(d+1);this._w=.25/f,this._x=(h-l)*f,this._y=(s-c)*f,this._z=(a-i)*f}else if(n>o&&n>u){const f=2*Math.sqrt(1+n-o-u);this._w=(h-l)/f,this._x=.25*f,this._y=(i+a)/f,this._z=(s+c)/f}else if(o>u){const f=2*Math.sqrt(1+o-n-u);this._w=(s-c)/f,this._x=(i+a)/f,this._y=.25*f,this._z=(l+h)/f}else{const f=2*Math.sqrt(1+u-n-o);this._w=(a-i)/f,this._x=(s+c)/f,this._y=(l+h)/f,this._z=.25*f}return this._onChangeCallback(),this}setFromUnitVectors(t,e){let n=t.dot(e)+1;return n<1e-8?(n=0,Math.abs(t.x)>Math.abs(t.z)?(this._x=-t.y,this._y=t.x,this._z=0,this._w=n):(this._x=0,this._y=-t.z,this._z=t.y,this._w=n)):(this._x=t.y*e.z-t.z*e.y,this._y=t.z*e.x-t.x*e.z,this._z=t.x*e.y-t.y*e.x,this._w=n),this.normalize()}angleTo(t){return 2*Math.acos(Math.abs(Nt(this.dot(t),-1,1)))}rotateTowards(t,e){const n=this.angleTo(t);if(n===0)return this;const i=Math.min(1,e/n);return this.slerp(t,i),this}identity(){return this.set(0,0,0,1)}invert(){return this.conjugate()}
vendor: 12,704 bytes, line 1
1conjugate(){return this._x*=-1,this._y*=-1,this._z*=-1,this._onChangeCallback(),this}dot(t){return this._x*t._x+this._y*t._y+this._z*t._z+this._w*t._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 t=this.length();return t===0?(this._x=0,this._y=0,this._z=0,this._w=1):(t=1/t,this._x=this._x*t,this._y=this._y*t,this._z=this._z*t,this._w=this._w*t),this._onChangeCallback(),this}multiply(t){return this.multiplyQuaternions(this,t)}premultiply(t){return this.multiplyQuaternions(t,this)}multiplyQuaternions(t,e){const n=t._x,i=t._y,s=t._z,a=t._w,o=e._x,l=e._y,c=e._z,h=e._w;return this._x=n*h+a*o+i*c-s*l,this._y=i*h+a*l+s*o-n*c,this._z=s*h+a*c+n*l-i*o,this._w=a*h-n*o-i*l-s*c,this._onChangeCallback(),this}slerp(t,e){if(e===0)return this;if(e===1)return this.copy(t);const n=this._x,i=this._y,s=this._z,a=this._w;let o=a*t._w+n*t._x+i*t._y+s*t._z;if(o<0?(this._w=-t._w,this._x=-t._x,this._y=-t._y,this._z=-t._z,o=-o):this.copy(t),o>=1)return this._w=a,this._x=n,this._y=i,this._z=s,this;const l=1-o*o;if(l<=Number.EPSILON){const f=1-e;return this._w=f*a+e*this._w,this._x=f*n+e*this._x,this._y=f*i+e*this._y,this._z=f*s+e*this._z,this.normalize(),this}const c=Math.sqrt(l),h=Math.atan2(c,o),u=Math.sin((1-e)*h)/c,d=Math.sin(e*h)/c;return this._w=a*u+this._w*d,this._x=n*u+this._x*d,this._y=i*u+this._y*d,this._z=s*u+this._z*d,this._onChangeCallback(),this}slerpQuaternions(t,e,n){return this.copy(t).slerp(e,n)}random(){const t=2*Math.PI*Math.random(),e=2*Math.PI*Math.random(),n=Math.random(),i=Math.sqrt(1-n),s=Math.sqrt(n);return this.set(i*Math.sin(t),i*Math.cos(t),s*Math.sin(e),s*Math.cos(e))}equals(t){return t._x===this._x&&t._y===this._y&&t._z===this._z&&t._w===this._w}fromArray(t,e=0){return this._x=t[e],this._y=t[e+1],this._z=t[e+2],this._w=t[e+3],this._onChangeCallback(),this}toArray(t=[],e=0){return t[e]=this._x,t[e+1]=this._y,t[e+2]=this._z,t[e+3]=this._w,t}fromBufferAttribute(t,e){return this._x=t.getX(e),this._y=t.getY(e),this._z=t.getZ(e),this._w=t.getW(e),this._onChangeCallback(),this}toJSON(){return this.toArray()}_onChange(t){return this._onChangeCallback=t,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._w}}class C{constructor(t=0,e=0,n=0){C.prototype.isVector3=!0,this.x=t,this.y=e,this.z=n}set(t,e,n){return n===void 0&&(n=this.z),this.x=t,this.y=e,this.z=n,this}setScalar(t){return this.x=t,this.y=t,this.z=t,this}setX(t){return this.x=t,this}setY(t){return this.y=t,this}setZ(t){return this.z=t,this}setComponent(t,e){switch(t){case 0:this.x=e;break;case 1:this.y=e;break;case 2:this.z=e;break;default:throw new Error("index is out of range: "+t)}return this}getComponent(t){switch(t){case 0:return this.x;case 1:return this.y;case 2:return this.z;default:throw new Error("index is out of range: "+t)}}clone(){return new this.constructor(this.x,this.y,this.z)}copy(t){return this.x=t.x,this.y=t.y,this.z=t.z,this}add(t){return this.x+=t.x,this.y+=t.y,this.z+=t.z,this}addScalar(t){return this.x+=t,this.y+=t,this.z+=t,this}addVectors(t,e){return this.x=t.x+e.x,this.y=t.y+e.y,this.z=t.z+e.z,this}addScaledVector(t,e){return this.x+=t.x*e,this.y+=t.y*e,this.z+=t.z*e,this}sub(t){return this.x-=t.x,this.y-=t.y,this.z-=t.z,this}subScalar(t){return this.x-=t,this.y-=t,this.z-=t,this}subVectors(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this.z=t.z-e.z,this}multiply(t){return this.x*=t.x,this.y*=t.y,this.z*=t.z,this}multiplyScalar(t){return this.x*=t,this.y*=t,this.z*=t,this}multiplyVectors(t,e){return this.x=t.x*e.x,this.y=t.y*e.y,this.z=t.z*e.z,this}applyEuler(t){return this.applyQuaternion(sc.setFromEuler(t))}applyAxisAngle(t,e){return this.applyQuaternion(sc.setFromAxisAngle(t,e))}applyMatrix3(t){const e=this.x,n=this.y,i=this.z,s=t.elements;return this.x=s[0]*e+s[3]*n+s[6]*i,this.y=s[1]*e+s[4]*n+s[7]*i,this.z=s[2]*e+s[5]*n+s[8]*i,this}applyNormalMatrix(t){return this.applyMatrix3(t).normalize()}applyMatrix4(t){const e=this.x,n=this.y,i=this.z,s=t.elements,a=1/(s[3]*e+s[7]*n+s[11]*i+s[15]);return this.x=(s[0]*e+s[4]*n+s[8]*i+s[12])*a,this.y=(s[1]*e+s[5]*n+s[9]*i+s[13])*a,this.z=(s[2]*e+s[6]*n+s[10]*i+s[14])*a,this}applyQuaternion(t){const e=this.x,n=this.y,i=this.z,s=t.x,a=t.y,o=t.z,l=t.w,c=2*(a*i-o*n),h=2*(o*e-s*i),u=2*(s*n-a*e);return this.x=e+l*c+a*u-o*h,this.y=n+l*h+o*c-s*u,this.z=i+l*u+s*h-a*c,this}project(t){return this.applyMatrix4(t.matrixWorldInverse).applyMatrix4(t.projectionMatrix)}unproject(t){return this.applyMatrix4(t.projectionMatrixInverse).applyMatrix4(t.matrixWorld)}transformDirection(t){const e=this.x,n=this.y,i=this.z,s=t.elements;return this.x=s[0]*e+s[4]*n+s[8]*i,this.y=s[1]*e+s[5]*n+s[9]*i,this.z=s[2]*e+s[6]*n+s[10]*i,this.normalize()}divide(t){return this.x/=t.x,this.y/=t.y,this.z/=t.z,this}divideScalar(t){return this.multiplyScalar(1/t)}min(t){return this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y),this.z=Math.min(this.z,t.z),this}max(t){return this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y),this.z=Math.max(this.z,t.z),this}clamp(t,e){return this.x=Nt(this.x,t.x,e.x),this.y=Nt(this.y,t.y,e.y),this.z=Nt(this.z,t.z,e.z),this}clampScalar(t,e){return this.x=Nt(this.x,t,e),this.y=Nt(this.y,t,e),this.z=Nt(this.z,t,e),this}clampLength(t,e){const n=this.length();return this.divideScalar(n||1).multiplyScalar(Nt(n,t,e))}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=Math.trunc(this.x),this.y=Math.trunc(this.y),this.z=Math.trunc(this.z),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this}dot(t){return this.x*t.x+this.y*t.y+this.z*t.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(t){return this.normalize().multiplyScalar(t)}lerp(t,e){return this.x+=(t.x-this.x)*e,this.y+=(t.y-this.y)*e,this.z+=(t.z-this.z)*e,this}lerpVectors(t,e,n){return this.x=t.x+(e.x-t.x)*n,this.y=t.y+(e.y-t.y)*n,this.z=t.z+(e.z-t.z)*n,this}cross(t){return this.crossVectors(this,t)}crossVectors(t,e){const n=t.x,i=t.y,s=t.z,a=e.x,o=e.y,l=e.z;return this.x=i*l-s*o,this.y=s*a-n*l,this.z=n*o-i*a,this}projectOnVector(t){const e=t.lengthSq();if(e===0)return this.set(0,0,0);const n=t.dot(this)/e;return this.copy(t).multiplyScalar(n)}projectOnPlane(t){return Sa.copy(this).projectOnVector(t),this.sub(Sa)}reflect(t){return this.sub(Sa.copy(t).multiplyScalar(2*this.dot(t)))}angleTo(t){const e=Math.sqrt(this.lengthSq()*t.lengthSq());if(e===0)return Math.PI/2;const n=this.dot(t)/e;return Math.acos(Nt(n,-1,1))}distanceTo(t){return Math.sqrt(this.distanceToSquared(t))}distanceToSquared(t){const e=this.x-t.x,n=this.y-t.y,i=this.z-t.z;return e*e+n*n+i*i}manhattanDistanceTo(t){return Math.abs(this.x-t.x)+Math.abs(this.y-t.y)+Math.abs(this.z-t.z)}setFromSpherical(t){return this.setFromSphericalCoords(t.radius,t.phi,t.theta)}setFromSphericalCoords(t,e,n){const i=Math.sin(e)*t;return this.x=i*Math.sin(n),this.y=Math.cos(e)*t,this.z=i*Math.cos(n),this}setFromCylindrical(t){return this.setFromCylindricalCoords(t.radius,t.theta,t.y)}setFromCylindricalCoords(t,e,n){return this.x=t*Math.sin(e),this.y=n,this.z=t*Math.cos(e),this}setFromMatrixPosition(t){const e=t.elements;return this.x=e[12],this.y=e[13],this.z=e[14],this}setFromMatrixScale(t){const e=this.setFromMatrixColumn(t,0).length(),n=this.setFromMatrixColumn(t,1).length(),i=this.setFromMatrixColumn(t,2).length();return this.x=e,this.y=n,this.z=i,this}setFromMatrixColumn(t,e){return this.fromArray(t.elements,e*4)}setFromMatrix3Column(t,e){return this.fromArray(t.elements,e*3)}setFromEuler(t){return this.x=t._x,this.y=t._y,this.z=t._z,this}setFromColor(t){return this.x=t.r,this.y=t.g,this.z=t.b,this}equals(t){return t.x===this.x&&t.y===this.y&&t.z===this.z}fromArray(t,e=0){return this.x=t[e],this.y=t[e+1],this.z=t[e+2],this}toArray(t=[],e=0){return t[e]=this.x,t[e+1]=this.y,t[e+2]=this.z,t}fromBufferAttribute(t,e){return this.x=t.getX(e),this.y=t.getY(e),this.z=t.getZ(e),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this}randomDirection(){const t=Math.random()*Math.PI*2,e=Math.random()*2-1,n=Math.sqrt(1-e*e);return this.x=n*Math.cos(t),this.y=e,this.z=n*Math.sin(t),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z}}const Sa=new C,sc=new Ke;class Xt{constructor(t,e,n,i,s,a,o,l,c){Xt.prototype.isMatrix3=!0,this.elements=[1,0,0,0,1,0,0,0,1],t!==void 0&&this.set(t,e,n,i,s,a,o,l,c)}set(t,e,n,i,s,a,o,l,c){const h=this.elements;return h[0]=t,h[1]=i,h[2]=o,h[3]=e,h[4]=s,h[5]=l,h[6]=n,h[7]=a,h[8]=c,this}identity(){return this.set(1,0,0,0,1,0,0,0,1),this}copy(t){const e=this.elements,n=t.elements;return e[0]=n[0],e[1]=n[1],e[2]=n[2],e[3]=n[3],e[4]=n[4],e[5]=n[5],e[6]=n[6],e[7]=n[7],e[8]=n[8],this}extractBasis(t,e,n){return t.setFromMatrix3Column(this,0),e.setFromMatrix3Column(this,1),n.setFromMatrix3Column(this,2),this}setFromMatrix4(t){const e=t.elements;return this.set(e[0],e[4],e[8],e[1],e[5],e[9],e[2],e[6],e[10]),this}multiply(t){return this.multiplyMatrices(this,t)}premultiply(t){return this.multiplyMatrices(t,this)}multiplyMatrices(t,e){const n=t.elements,i=e.elements,s=this.elements,a=n[0],o=n[3],l=n[6],c=n[1],h=n[4],u=n[7],d=n[2],f=n[5],m=n[8],_=i[0],g=i[3],p=i[6],y=i[1],v=i[4],x=i[7],A=i[2],T=i[5],R=i[8];return s[0]=a*_+o*y+l*A,s[3]=a*g+o*v+l*T,s[6]=a*p+o*x+l*R,s[1]=c*_+h*y+u*A,s[4]=c*g+h*v+u*T,s[7]=c*p+h*x+u*R,s[2]=d*_+f*y+m*A,s[5]=d*g+f*v+m*T,s[8]=d*p+f*x+m*R,this}multiplyScalar(t){const e=this.elements;return e[0]*=t,e[3]*=t,e[6]*=t,e[1]*=t,e[4]*=t,e[7]*=t,e[2]*=t,e[5]*=t,e[8]*=t,this}determinant(){const t=this.elements,e=t[0],n=t[1],i=t[2],s=t[3],a=t[4],o=t[5],l=t[6],c=t[7],h=t[8];return e*a*h-e*o*c-n*s*h+n*o*l+i*s*c-i*a*l}invert(){const t=this.elements,e=t[0],n=t[1],i=t[2],s=t[3],a=t[4],o=t[5],l=t[6],c=t[7],h=t[8],u=h*a-o*c,d=o*l-h*s,f=c*s-a*l,m=e*u+n*d+i*f;if(m===0)return this.set(0,0,0,0,0,0,0,0,0);const _=1/m;return t[0]=u*_,t[1]=(i*c-h*n)*_,t[2]=(o*n-i*a)*_,t[3]=d*_,t[4]=(h*e-i*l)*_,t[5]=(i*s-o*e)*_,t[6]=f*_,t[7]=(n*l-c*e)*_,t[8]=(a*e-n*s)*_,this}transpose(){let t;const e=this.elements;return t=e[1],e[1]=e[3],e[3]=t,t=e[2],e[2]=e[6],e[6]=t,t=e[5],e[5]=e[7],e[7]=t,this}getNormalMatrix(t){return this.setFromMatrix4(t).invert().transpose()}transposeIntoArray(t){const e=this.elements;return t[0]=e[0],t[1]=e[3],t[2]=e[6],t[3]=e[1],t[4]=e[4],t[5]=e[7],t[6]=e[2],t[7]=e[5],t[8]=e[8],this}setUvTransform(t,e,n,i,s,a,o){const l=Math.cos(s),c=Math.sin(s);return this.set(n*l,n*c,-n*(l*a+c*o)+a+t,-i*c,i*l,-i*(-c*a+l*o)+o+e,0,0,1),this}scale(t,e){return this.premultiply(ba.makeScale(t,e)),this}rotate(t){return this.premultiply(ba.makeRotation(-t)),this}translate(t,e){return this.premultiply(ba.makeTranslation(t,e)),this}makeTranslation(t,e){return t.isVector2?this.set(1,0,t.x,0,1,t.y,0,0,1):this.set(1,0,t,0,1,e,0,0,1),this}makeRotation(t){const e=Math.cos(t),n=Math.sin(t);return this.set(e,-n,0,n,e,0,0,0,1),this}makeScale(t,e){return this.set(t,0,0,0,e,0,0,0,1),this}equals(t){const e=this.elements,n=t.elements;for(let i=0;i<9;i++)if(e[i]!==n[i])return!1;return!0}fromArray(t,e=0){for(let n=0;n<9;n++)this.elements[n]=t[n+e];return this}toArray(t=[],e=0){const n=this.elements;return t[e]=n[0],t[e+1]=n[1],t[e+2]=n[2],t[e+3]=n[3],t[e+4]=n[4],t[e+5]=n[5],t[e+6]=n[6],t[e+7]=n[7],t[e+8]=n[8],t}clone(){return new this.constructor().fromArray(this.elements)}}const ba=new Xt;function qh(r){for(let t=r.length-1;t>=0;--t)if(r[t]>=65535)return!0;return!1}const Hd={Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array};function $i(r,t){return new Hd[r](t)}function Bs(r){return document.createElementNS("http://www.w3.org/1999/xhtml",r)}function Gd(){const r=Bs("canvas");return r.style.display="block",r}const rc={};function ji(r){r in rc||(rc[r]=!0,console.warn(r))}function Wd(r,t,e){return new Promise(function(n,i){function s(){switch(r.clientWaitSync(t,r.SYNC_FLUSH_COMMANDS_BIT,0)){case r.WAIT_FAILED:i();break;case r.TIMEOUT_EXPIRED:setTimeout(s,e);break;default:n()}}setTimeout(s,e)})}const ac=new Xt().set(.4123908,.3575843,.1804808,.212639,.7151687,.0721923,.0193308,.1191948,.9505322),oc=new Xt().set(3.2409699,-1.5373832,-.4986108,-.9692436,1.8759675,.0415551,.0556301,-.20397
vendor: 26,883 bytes, line 1
17,1.0569715);function Xd(){const r={enabled:!0,workingColorSpace:is,spaces:{},convert:function(i,s,a){return this.enabled===!1||s===a||!s||!a||(this.spaces[s].transfer===ae&&(i.r=In(i.r),i.g=In(i.g),i.b=In(i.b)),this.spaces[s].primaries!==this.spaces[a].primaries&&(i.applyMatrix3(this.spaces[s].toXYZ),i.applyMatrix3(this.spaces[a].fromXYZ)),this.spaces[a].transfer===ae&&(i.r=ts(i.r),i.g=ts(i.g),i.b=ts(i.b))),i},workingToColorSpace:function(i,s){return this.convert(i,this.workingColorSpace,s)},colorSpaceToWorking:function(i,s){return this.convert(i,s,this.workingColorSpace)},getPrimaries:function(i){return this.spaces[i].primaries},getTransfer:function(i){return i===Hn?ta:this.spaces[i].transfer},getLuminanceCoefficients:function(i,s=this.workingColorSpace){return i.fromArray(this.spaces[s].luminanceCoefficients)},define:function(i){Object.assign(this.spaces,i)},_getMatrix:function(i,s,a){return i.copy(this.spaces[s].toXYZ).multiply(this.spaces[a].fromXYZ)},_getDrawingBufferColorSpace:function(i){return this.spaces[i].outputColorSpaceConfig.drawingBufferColorSpace},_getUnpackColorSpace:function(i=this.workingColorSpace){return this.spaces[i].workingColorSpaceConfig.unpackColorSpace},fromWorkingColorSpace:function(i,s){return ji("THREE.ColorManagement: .fromWorkingColorSpace() has been renamed to .workingToColorSpace()."),r.workingToColorSpace(i,s)},toWorkingColorSpace:function(i,s){return ji("THREE.ColorManagement: .toWorkingColorSpace() has been renamed to .colorSpaceToWorking()."),r.colorSpaceToWorking(i,s)}},t=[.64,.33,.3,.6,.15,.06],e=[.2126,.7152,.0722],n=[.3127,.329];return r.define({[is]:{primaries:t,whitePoint:n,transfer:ta,toXYZ:ac,fromXYZ:oc,luminanceCoefficients:e,workingColorSpaceConfig:{unpackColorSpace:Ye},outputColorSpaceConfig:{drawingBufferColorSpace:Ye}},[Ye]:{primaries:t,whitePoint:n,transfer:ae,toXYZ:ac,fromXYZ:oc,luminanceCoefficients:e,outputColorSpaceConfig:{drawingBufferColorSpace:Ye}}}),r}const Kt=Xd();function In(r){return r<.04045?r*.0773993808:Math.pow(r*.9478672986+.0521327014,2.4)}function ts(r){return r<.0031308?r*12.92:1.055*Math.pow(r,.41666)-.055}let wi;class qd{static getDataURL(t,e="image/png"){if(/^data:/i.test(t.src)||typeof HTMLCanvasElement>"u")return t.src;let n;if(t instanceof HTMLCanvasElement)n=t;else{wi===void 0&&(wi=Bs("canvas")),wi.width=t.width,wi.height=t.height;const i=wi.getContext("2d");t instanceof ImageData?i.putImageData(t,0,0):i.drawImage(t,0,0,t.width,t.height),n=wi}return n.toDataURL(e)}static sRGBToLinear(t){if(typeof HTMLImageElement<"u"&&t instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&t instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&t instanceof ImageBitmap){const e=Bs("canvas");e.width=t.width,e.height=t.height;const n=e.getContext("2d");n.drawImage(t,0,0,t.width,t.height);const i=n.getImageData(0,0,t.width,t.height),s=i.data;for(let a=0;a<s.length;a++)s[a]=In(s[a]/255)*255;return n.putImageData(i,0,0),e}else if(t.data){const e=t.data.slice(0);for(let n=0;n<e.length;n++)e instanceof Uint8Array||e instanceof Uint8ClampedArray?e[n]=Math.floor(In(e[n]/255)*255):e[n]=In(e[n]);return{data:e,width:t.width,height:t.height}}else return console.warn("THREE.ImageUtils.sRGBToLinear(): Unsupported image type. No color space conversion applied."),t}}let Yd=0;class mi{constructor(t=null){this.isSource=!0,Object.defineProperty(this,"id",{value:Yd++}),this.uuid=$e(),this.data=t,this.dataReady=!0,this.version=0}getSize(t){const e=this.data;return e instanceof HTMLVideoElement?t.set(e.videoWidth,e.videoHeight,0):e instanceof VideoFrame?t.set(e.displayHeight,e.displayWidth,0):e!==null?t.set(e.width,e.height,e.depth||0):t.set(0,0,0),t}set needsUpdate(t){t===!0&&this.version++}toJSON(t){const e=t===void 0||typeof t=="string";if(!e&&t.images[this.uuid]!==void 0)return t.images[this.uuid];const n={uuid:this.uuid,url:""},i=this.data;if(i!==null){let s;if(Array.isArray(i)){s=[];for(let a=0,o=i.length;a<o;a++)i[a].isDataTexture?s.push(Ea(i[a].image)):s.push(Ea(i[a]))}else s=Ea(i);n.url=s}return e||(t.images[this.uuid]=n),n}}function Ea(r){return typeof HTMLImageElement<"u"&&r instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&r instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&r instanceof ImageBitmap?qd.getDataURL(r):r.data?{data:Array.from(r.data),width:r.width,height:r.height,type:r.data.constructor.name}:(console.warn("THREE.Texture: Unable to serialize Texture."),{})}let Zd=0;const Ta=new C;class xe extends Dn{constructor(t=xe.DEFAULT_IMAGE,e=xe.DEFAULT_MAPPING,n=ln,i=ln,s=Ee,a=Cn,o=ke,l=mn,c=xe.DEFAULT_ANISOTROPY,h=Hn){super(),this.isTexture=!0,Object.defineProperty(this,"id",{value:Zd++}),this.uuid=$e(),this.name="",this.source=new mi(t),this.mipmaps=[],this.mapping=e,this.channel=0,this.wrapS=n,this.wrapT=i,this.magFilter=s,this.minFilter=a,this.anisotropy=c,this.format=o,this.internalFormat=null,this.type=l,this.offset=new K(0,0),this.repeat=new K(1,1),this.center=new K(0,0),this.rotation=0,this.matrixAutoUpdate=!0,this.matrix=new Xt,this.generateMipmaps=!0,this.premultiplyAlpha=!1,this.flipY=!0,this.unpackAlignment=4,this.colorSpace=h,this.userData={},this.updateRanges=[],this.version=0,this.onUpdate=null,this.renderTarget=null,this.isRenderTargetTexture=!1,this.isArrayTexture=!!(t&&t.depth&&t.depth>1),this.pmremVersion=0}get width(){return this.source.getSize(Ta).x}get height(){return this.source.getSize(Ta).y}get depth(){return this.source.getSize(Ta).z}get image(){return this.source.data}set image(t=null){this.source.data=t}updateMatrix(){this.matrix.setUvTransform(this.offset.x,this.offset.y,this.repeat.x,this.repeat.y,this.rotation,this.center.x,this.center.y)}addUpdateRange(t,e){this.updateRanges.push({start:t,count:e})}clearUpdateRanges(){this.updateRanges.length=0}clone(){return new this.constructor().copy(this)}copy(t){return this.name=t.name,this.source=t.source,this.mipmaps=t.mipmaps.slice(0),this.mapping=t.mapping,this.channel=t.channel,this.wrapS=t.wrapS,this.wrapT=t.wrapT,this.magFilter=t.magFilter,this.minFilter=t.minFilter,this.anisotropy=t.anisotropy,this.format=t.format,this.internalFormat=t.internalFormat,this.type=t.type,this.offset.copy(t.offset),this.repeat.copy(t.repeat),this.center.copy(t.center),this.rotation=t.rotation,this.matrixAutoUpdate=t.matrixAutoUpdate,this.matrix.copy(t.matrix),this.generateMipmaps=t.generateMipmaps,this.premultiplyAlpha=t.premultiplyAlpha,this.flipY=t.flipY,this.unpackAlignment=t.unpackAlignment,this.colorSpace=t.colorSpace,this.renderTarget=t.renderTarget,this.isRenderTargetTexture=t.isRenderTargetTexture,this.isArrayTexture=t.isArrayTexture,this.userData=JSON.parse(JSON.stringify(t.userData)),this.needsUpdate=!0,this}setValues(t){for(const e in t){const n=t[e];if(n===void 0){console.warn(`THREE.Texture.setValues(): parameter '${e}' has value of undefined.`);continue}const i=this[e];if(i===void 0){console.warn(`THREE.Texture.setValues(): property '${e}' does not exist.`);continue}i&&n&&i.isVector2&&n.isVector2||i&&n&&i.isVector3&&n.isVector3||i&&n&&i.isMatrix3&&n.isMatrix3?i.copy(n):this[e]=n}}toJSON(t){const e=t===void 0||typeof t=="string";if(!e&&t.textures[this.uuid]!==void 0)return t.textures[this.uuid];const n={metadata:{version:4.7,type:"Texture",generator:"Texture.toJSON"},uuid:this.uuid,name:this.name,image:this.source.toJSON(t).uuid,mapping:this.mapping,channel:this.channel,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,internalFormat:this.internalFormat,type:this.type,colorSpace:this.colorSpace,minFilter:this.minFilter,magFilter:this.magFilter,anisotropy:this.anisotropy,flipY:this.flipY,generateMipmaps:this.generateMipmaps,premultiplyAlpha:this.premultiplyAlpha,unpackAlignment:this.unpackAlignment};return Object.keys(this.userData).length>0&&(n.userData=this.userData),e||(t.textures[this.uuid]=n),n}dispose(){this.dispatchEvent({type:"dispose"})}transformUv(t){if(this.mapping!==sl)return t;if(t.applyMatrix3(this.matrix),t.x<0||t.x>1)switch(this.wrapS){case $r:t.x=t.x-Math.floor(t.x);break;case ln:t.x=t.x<0?0:1;break;case Kr:Math.abs(Math.floor(t.x)%2)===1?t.x=Math.ceil(t.x)-t.x:t.x=t.x-Math.floor(t.x);break}if(t.y<0||t.y>1)switch(this.wrapT){case $r:t.y=t.y-Math.floor(t.y);break;case ln:t.y=t.y<0?0:1;break;case Kr:Math.abs(Math.floor(t.y)%2)===1?t.y=Math.ceil(t.y)-t.y:t.y=t.y-Math.floor(t.y);break}return this.flipY&&(t.y=1-t.y),t}set needsUpdate(t){t===!0&&(this.version++,this.source.needsUpdate=!0)}set needsPMREMUpdate(t){t===!0&&this.pmremVersion++}}xe.DEFAULT_IMAGE=null;xe.DEFAULT_MAPPING=sl;xe.DEFAULT_ANISOTROPY=1;class ne{constructor(t=0,e=0,n=0,i=1){ne.prototype.isVector4=!0,this.x=t,this.y=e,this.z=n,this.w=i}get width(){return this.z}set width(t){this.z=t}get height(){return this.w}set height(t){this.w=t}set(t,e,n,i){return this.x=t,this.y=e,this.z=n,this.w=i,this}setScalar(t){return this.x=t,this.y=t,this.z=t,this.w=t,this}setX(t){return this.x=t,this}setY(t){return this.y=t,this}setZ(t){return this.z=t,this}setW(t){return this.w=t,this}setComponent(t,e){switch(t){case 0:this.x=e;break;case 1:this.y=e;break;case 2:this.z=e;break;case 3:this.w=e;break;default:throw new Error("index is out of range: "+t)}return this}getComponent(t){switch(t){case 0:return this.x;case 1:return this.y;case 2:return this.z;case 3:return this.w;default:throw new Error("index is out of range: "+t)}}clone(){return new this.constructor(this.x,this.y,this.z,this.w)}copy(t){return this.x=t.x,this.y=t.y,this.z=t.z,this.w=t.w!==void 0?t.w:1,this}add(t){return this.x+=t.x,this.y+=t.y,this.z+=t.z,this.w+=t.w,this}addScalar(t){return this.x+=t,this.y+=t,this.z+=t,this.w+=t,this}addVectors(t,e){return this.x=t.x+e.x,this.y=t.y+e.y,this.z=t.z+e.z,this.w=t.w+e.w,this}addScaledVector(t,e){return this.x+=t.x*e,this.y+=t.y*e,this.z+=t.z*e,this.w+=t.w*e,this}sub(t){return this.x-=t.x,this.y-=t.y,this.z-=t.z,this.w-=t.w,this}subScalar(t){return this.x-=t,this.y-=t,this.z-=t,this.w-=t,this}subVectors(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this.z=t.z-e.z,this.w=t.w-e.w,this}multiply(t){return this.x*=t.x,this.y*=t.y,this.z*=t.z,this.w*=t.w,this}multiplyScalar(t){return this.x*=t,this.y*=t,this.z*=t,this.w*=t,this}applyMatrix4(t){const e=this.x,n=this.y,i=this.z,s=this.w,a=t.elements;return this.x=a[0]*e+a[4]*n+a[8]*i+a[12]*s,this.y=a[1]*e+a[5]*n+a[9]*i+a[13]*s,this.z=a[2]*e+a[6]*n+a[10]*i+a[14]*s,this.w=a[3]*e+a[7]*n+a[11]*i+a[15]*s,this}divide(t){return this.x/=t.x,this.y/=t.y,this.z/=t.z,this.w/=t.w,this}divideScalar(t){return this.multiplyScalar(1/t)}setAxisAngleFromQuaternion(t){this.w=2*Math.acos(t.w);const e=Math.sqrt(1-t.w*t.w);return e<1e-4?(this.x=1,this.y=0,this.z=0):(this.x=t.x/e,this.y=t.y/e,this.z=t.z/e),this}setAxisAngleFromRotationMatrix(t){let e,n,i,s;const l=t.elements,c=l[0],h=l[4],u=l[8],d=l[1],f=l[5],m=l[9],_=l[2],g=l[6],p=l[10];if(Math.abs(h-d)<.01&&Math.abs(u-_)<.01&&Math.abs(m-g)<.01){if(Math.abs(h+d)<.1&&Math.abs(u+_)<.1&&Math.abs(m+g)<.1&&Math.abs(c+f+p-3)<.1)return this.set(1,0,0,0),this;e=Math.PI;const v=(c+1)/2,x=(f+1)/2,A=(p+1)/2,T=(h+d)/4,R=(u+_)/4,P=(m+g)/4;return v>x&&v>A?v<.01?(n=0,i=.707106781,s=.707106781):(n=Math.sqrt(v),i=T/n,s=R/n):x>A?x<.01?(n=.707106781,i=0,s=.707106781):(i=Math.sqrt(x),n=T/i,s=P/i):A<.01?(n=.707106781,i=.707106781,s=0):(s=Math.sqrt(A),n=R/s,i=P/s),this.set(n,i,s,e),this}let y=Math.sqrt((g-m)*(g-m)+(u-_)*(u-_)+(d-h)*(d-h));return Math.abs(y)<.001&&(y=1),this.x=(g-m)/y,this.y=(u-_)/y,this.z=(d-h)/y,this.w=Math.acos((c+f+p-1)/2),this}setFromMatrixPosition(t){const e=t.elements;return this.x=e[12],this.y=e[13],this.z=e[14],this.w=e[15],this}min(t){return this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y),this.z=Math.min(this.z,t.z),this.w=Math.min(this.w,t.w),this}max(t){return this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y),this.z=Math.max(this.z,t.z),this.w=Math.max(this.w,t.w),this}clamp(t,e){return this.x=Nt(this.x,t.x,e.x),this.y=Nt(this.y,t.y,e.y),this.z=Nt(this.z,t.z,e.z),this.w=Nt(this.w,t.w,e.w),this}clampScalar(t,e){return this.x=Nt(this.x,t,e),this.y=Nt(this.y,t,e),this.z=Nt(this.z,t,e),this.w=Nt(this.w,t,e),this}clampLength(t,e){const n=this.length();return this.divideScalar(n||1).multiplyScalar(Nt(n,t,e))}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}round(){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=Math.trunc(this.x),this.y=Math.trunc(this.y),this.z=Math.trunc(this.z),this.w=Math.trunc(this.w),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this.w=-this.w,this}dot(t){return this.x*t.x+this.y*t.y+this.z*t.z+this.w*t.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(t){return this.normalize().multiplyScalar(t)}lerp(t,e){return this.x+=(t.x-this.x)*e,this.y+=(t.y-this.y)*e,this.z+=(t.z-this.z)*e,this.w+=(t.w-this.w)*e,this}lerpVectors(t,e,n){return this.x=t.x+(e.x-t.x)*n,this.y=t.y+(e.y-t.y)*n,this.z=t.z+(e.z-t.z)*n,this.w=t.w+(e.w-t.w)*n,this}equals(t){return t.x===this.x&&t.y===this.y&&t.z===this.z&&t.w===this.w}fromArray(t,e=0){return this.x=t[e],this.y=t[e+1],this.z=t[e+2],this.w=t[e+3],this}toArray(t=[],e=0){return t[e]=this.x,t[e+1]=this.y,t[e+2]=this.z,t[e+3]=this.w,t}fromBufferAttribute(t,e){return this.x=t.getX(e),this.y=t.getY(e),this.z=t.getZ(e),this.w=t.getW(e),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 Yh extends Dn{constructor(t=1,e=1,n={}){super(),n=Object.assign({generateMipmaps:!1,internalFormat:null,minFilter:Ee,depthBuffer:!0,stencilBuffer:!1,resolveDepthBuffer:!0,resolveStencilBuffer:!0,depthTexture:null,samples:0,count:1,depth:1,multiview:!1},n),this.isRenderTarget=!0,this.width=t,this.height=e,this.depth=n.depth,this.scissor=new ne(0,0,t,e),this.scissorTest=!1,this.viewport=new ne(0,0,t,e);const i={width:t,height:e,depth:n.depth},s=new xe(i);this.textures=[];const a=n.count;for(let o=0;o<a;o++)this.textures[o]=s.clone(),this.textures[o].isRenderTargetTexture=!0,this.textures[o].renderTarget=this;this._setTextureOptions(n),this.depthBuffer=n.depthBuffer,this.stencilBuffer=n.stencilBuffer,this.resolveDepthBuffer=n.resolveDepthBuffer,this.resolveStencilBuffer=n.resolveStencilBuffer,this._depthTexture=null,this.depthTexture=n.depthTexture,this.samples=n.samples,this.multiview=n.multiview}_setTextureOptions(t={}){const e={minFilter:Ee,generateMipmaps:!1,flipY:!1,internalFormat:null};t.mapping!==void 0&&(e.mapping=t.mapping),t.wrapS!==void 0&&(e.wrapS=t.wrapS),t.wrapT!==void 0&&(e.wrapT=t.wrapT),t.wrapR!==void 0&&(e.wrapR=t.wrapR),t.magFilter!==void 0&&(e.magFilter=t.magFilter),t.minFilter!==void 0&&(e.minFilter=t.minFilter),t.format!==void 0&&(e.format=t.format),t.type!==void 0&&(e.type=t.type),t.anisotropy!==void 0&&(e.anisotropy=t.anisotropy),t.colorSpace!==void 0&&(e.colorSpace=t.colorSpace),t.flipY!==void 0&&(e.flipY=t.flipY),t.generateMipmaps!==void 0&&(e.generateMipmaps=t.generateMipmaps),t.internalFormat!==void 0&&(e.internalFormat=t.internalFormat);for(let n=0;n<this.textures.length;n++)this.textures[n].setValues(e)}get texture(){return this.textures[0]}set texture(t){this.textures[0]=t}set depthTexture(t){this._depthTexture!==null&&(this._depthTexture.renderTarget=null),t!==null&&(t.renderTarget=this),this._depthTexture=t}get depthTexture(){return this._depthTexture}setSize(t,e,n=1){if(this.width!==t||this.height!==e||this.depth!==n){this.width=t,this.height=e,this.depth=n;for(let i=0,s=this.textures.length;i<s;i++)this.textures[i].image.width=t,this.textures[i].image.height=e,this.textures[i].image.depth=n,this.textures[i].isArrayTexture=this.textures[i].image.depth>1;this.dispose()}this.viewport.set(0,0,t,e),this.scissor.set(0,0,t,e)}clone(){return new this.constructor().copy(this)}copy(t){this.width=t.width,this.height=t.height,this.depth=t.depth,this.scissor.copy(t.scissor),this.scissorTest=t.scissorTest,this.viewport.copy(t.viewport),this.textures.length=0;for(let e=0,n=t.textures.length;e<n;e++){this.textures[e]=t.textures[e].clone(),this.textures[e].isRenderTargetTexture=!0,this.textures[e].renderTarget=this;const i=Object.assign({},t.textures[e].image);this.textures[e].source=new mi(i)}return this.depthBuffer=t.depthBuffer,this.stencilBuffer=t.stencilBuffer,this.resolveDepthBuffer=t.resolveDepthBuffer,this.resolveStencilBuffer=t.resolveStencilBuffer,t.depthTexture!==null&&(this.depthTexture=t.depthTexture.clone()),this.samples=t.samples,this}dispose(){this.dispatchEvent({type:"dispose"})}}class Ln extends Yh{constructor(t=1,e=1,n={}){super(t,e,n),this.isWebGLRenderTarget=!0}}class fl extends xe{constructor(t=null,e=1,n=1,i=1){super(null),this.isDataArrayTexture=!0,this.image={data:t,width:e,height:n,depth:i},this.magFilter=Re,this.minFilter=Re,this.wrapR=ln,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1,this.layerUpdates=new Set}addLayerUpdate(t){this.layerUpdates.add(t)}clearLayerUpdates(){this.layerUpdates.clear()}}class Xv extends Ln{constructor(t=1,e=1,n=1,i={}){super(t,e,i),this.isWebGLArrayRenderTarget=!0,this.depth=n,this.texture=new fl(null,t,e,n),this._setTextureOptions(i),this.texture.isRenderTargetTexture=!0}}class pl extends xe{constructor(t=null,e=1,n=1,i=1){super(null),this.isData3DTexture=!0,this.image={data:t,width:e,height:n,depth:i},this.magFilter=Re,this.minFilter=Re,this.wrapR=ln,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}}class qv extends Ln{constructor(t=1,e=1,n=1,i={}){super(t,e,i),this.isWebGL3DRenderTarget=!0,this.depth=n,this.texture=new pl(null,t,e,n),this._setTextureOptions(i),this.texture.isRenderTargetTexture=!0}}class Ne{constructor(t=new C(1/0,1/0,1/0),e=new C(-1/0,-1/0,-1/0)){this.isBox3=!0,this.min=t,this.max=e}set(t,e){return this.min.copy(t),this.max.copy(e),this}setFromArray(t){this.makeEmpty();for(let e=0,n=t.length;e<n;e+=3)this.expandByPoint(rn.fromArray(t,e));return this}setFromBufferAttribute(t){this.makeEmpty();for(let e=0,n=t.count;e<n;e++)this.expandByPoint(rn.fromBufferAttribute(t,e));return this}setFromPoints(t){this.makeEmpty();for(let e=0,n=t.length;e<n;e++)this.expandByPoint(t[e]);return this}setFromCenterAndSize(t,e){const n=rn.copy(e).multiplyScalar(.5);return this.min.copy(t).sub(n),this.max.copy(t).add(n),this}setFromObject(t,e=!1){return this.makeEmpty(),this.expandByObject(t,e)}clone(){return new this.constructor().copy(this)}copy(t){return this.min.copy(t.min),this.max.copy(t.max),this}makeEmpty(){return this.min.x=this.min.y=this.min.z=1/0,this.max.x=this.max.y=this.max.z=-1/0,this}isEmpty(){return this.max.x<this.min.x||this.max.y<this.min.y||this.max.z<this.min.z}getCenter(t){return this.isEmpty()?t.set(0,0,0):t.addVectors(this.min,this.max).multiplyScalar(.5)}getSize(t){return this.isEmpty()?t.set(0,0,0):t.subVectors(this.max,this.min)}expandByPoint(t){return this.min.min(t),this.max.max(t),this}expandByVector(t){return this.min.sub(t),this.max.add(t),this}expandByScalar(t){return this.min.addScalar(-t),this.max.addScalar(t),this}expandByObject(t,e=!1){t.updateWorldMatrix(!1,!1);const n=t.geometry;if(n!==void 0){const s=n.getAttribute("position");if(e===!0&&s!==void 0&&t.isInstancedMesh!==!0)for(let a=0,o=s.count;a<o;a++)t.isMesh===!0?t.getVertexPosition(a,rn):rn.fromBufferAttribute(s,a),rn.applyMatrix4(t.matrixWorld),this.expandByPoint(rn);else t.boundingBox!==void 0?(t.boundingBox===null&&t.computeBoundingBox(),$s.copy(t.boundingBox)):(n.boundingBox===null&&n.computeBoundingBox(),$s.copy(n.boundingBox)),$s.applyMatrix4(t.matrixWorld),this.union($s)}const i=t.children;for(let s=0,a=i.length;s<a;s++)this.expandByObject(i[s],e);return this}containsPoint(t){return t.x>=this.min.x&&t.x<=this.max.x&&t.y>=this.min.y&&t.y<=this.max.y&&t.z>=this.min.z&&t.z<=this.max.z}containsBox(t){return this.min.x<=t.min.x&&t.max.x<=this.max.x&&this.min.y<=t.min.y&&t.max.y<=this.max.y&&this.min.z<=t.min.z&&t.max.z<=this.max.z}getParameter(t,e){return e.set((t.x-this.min.x)/(this.max.x-this.min.x),(t.y-this.min.y)/(this.max.y-this.min.y),(t.z-this.min.z)/(this.max.z-this.min.z))}intersectsBox(t){return t.max.x>=this.min.x&&t.min.x<=this.max.x&&t.max.y>=this.min.y&&t.min.y<=this.max.y&&t.max.z>=this.min.z&&t.min.z<=this.max.z}intersectsSphere(t){return this.clampPoint(t.center,rn),rn.distanceToSquared(t.center)<=t.radius*t.radius}intersectsPlane(t){let e,n;return t.normal.x>0?(e=t.normal.x*this.min.x,n=t.normal.x*this.max.x):(e=t.normal.x*this.max.x,n=t.normal.x*this.min.x),t.normal.y>0?(e+=t.normal.y*this.min.y,n+=t.normal.y*this.max.y):(e+=t.normal.y*this.max.y,n+=t.normal.y*this.min.y),t.normal.z>0?(e+=t.normal.z*this.min.z,n+=t.normal.z*this.max.z):(e+=t.normal.z*this.max.z,n+=t.normal.z*this.min.z),e<=-t.constant&&n>=-t.constant}intersectsTriangle(t){if(this.isEmpty())return!1;this.getCenter(fs),Ks.subVectors(this.max,fs),Ci.subVectors(t.a,fs),Ri.subVectors(t.b,fs),Ii.subVectors(t.c,fs),Nn.subVectors(Ri,Ci),Fn.subVectors(Ii,Ri),Kn.subVectors(Ci,Ii);let e=[0,-Nn.z,Nn.y,0,-Fn.z,Fn.y,0,-Kn.z,Kn.y,Nn.z,0,-Nn.x,Fn.z,0,-Fn.x,Kn.z,0,-Kn.x,-Nn.y,Nn.x,0,-Fn.y,Fn.x,0,-Kn.y,Kn.x,0];return!Aa(e,Ci,Ri,Ii,Ks)||(e=[1,0,0,0,1,0,0,0,1],!Aa(e,Ci,Ri,Ii,Ks))?!1:(Qs.crossVectors(Nn,Fn),e=[Qs.x,Qs.y,Qs.z],Aa(e,Ci,Ri,Ii,Ks))}clampPoint(t,e){return e.copy(t).clamp(this.min,this.max)}distanceToPoint(t){return this.clampPoint(t,rn).distanceTo(t)}getBoundingSphere(t){return this.isEmpty()?t.makeEmpty():(this.getCenter(t.center),t.radius=this.getSize(rn).length()*.5),t}intersect(t){return this.min.max(t.min),this.max.min(t.max),this.isEmpty()&&this.makeEmpty(),this}union(t){return this.min.min(t.min),this.max.max(t.max),this}applyMatrix4(t){return this.isEmpty()?this:(vn[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(t),vn[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(t),vn[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(t),vn[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(t),vn[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(t),vn[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(t),vn[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(t),vn[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(t),this.setFromPoints(vn),this)}translate(t){return this.min.add(t),this.max.add(t),this}equals(t){return t.min.equals(this.min)&&t.max.equals(this.max)}toJSON(){return{min:this.min.toArray(),max:this.max.toArray()}}fromJSON(t){return this.min.fromArray(t.min),this.max.fromArray(t.max),this}}const vn=[new C,new C,new C,new C,new C,new C,new C,new C],rn=new C,$s=new Ne,Ci=new C,Ri=new C,Ii=new C,Nn=new C,Fn=new C,Kn=new C,fs=new C,Ks=new C,Qs=new C,Qn=new C;function Aa(r,t,e,n,i){for(let s=0,a=r.length-3;s<=a;s+=3){Qn.fromArray(r,s);const o=i.x*Math.abs(Qn.x)+i.y*Math.abs(Qn.y)+i.z*Math.abs(Qn.z),l=t.dot(Qn),c=e.dot(Qn),h=n.dot(Qn);if(Math.max(-Math.max(l,c,h),Math.min(l,c,h))>o)return!1}return!0}const Jd=new Ne,ps=new C,wa=new C;class Ie{constructor(t=new C,e=-1){this.isSphere=!0,this.center=t,this.radius=e}set(t,e){return this.center.copy(t),this.radius=e,this}setFromPoints(t,e){const n=this.center;e!==void 0?n.copy(e):Jd.setFromPoints(t).getCenter(n);let i=0;for(let s=0,a=t.length;s<a;s++)i=Math.max(i,n.distanceToSquared(t[s]));return this.radius=Math.sqrt(i),this}copy(t){return this.center.copy(t.center),this.radius=t.radius,this}isEmpty(){return this.radius<0}makeEmpty(){return this.center.set(0,0,0),this.radius=-1,this}containsPoint(t){return t.distanceToSquared(this.center)<=this.radius*this.radius}distanceToPoint(t){return t.distanceTo(this.center)-this.radius}intersectsSphere(t){const e=this.radius+t.radius;return t.center.distanceToSquared(this.center)<=e*e}intersectsBox(t){return t.intersectsSphere(this)}intersectsPlane(t){return Math.abs(t.distanceToPoint(this.center))<=this.radius}clampPoint(t,e){const n=this.center.distanceToSquared(t);return e.copy(t),n>this.radius*this.radius&&(e.sub(this.center).normalize(),e.multiplyScalar(this.radius).add(this.center)),e}getBoundingBox(t){return this.isEmpty()?(t.makeEmpty(),t):(t.set(this.center,this.center),t.expandByScalar(this.radius),t)}applyMatrix4(t){return this.center.applyMatrix4(t),this.radius=this.radius*t.getMaxScaleOnAxis(),this}translate(t){return this.center.add(t),this}expandByPoint(t){if(this.isEmpty())return this.center.copy(t),this.radius=0,this;ps.subVectors(t,this.center);const e=ps.lengthSq();if(e>this.radius*this.radius){const n=Math.sqrt(e),i=(n-this.radius)*.5;this.center.addScaledVector(ps,i/n),this.radius+=i}return this}union(t){return t.isEmpty()?this:this.isEmpty()?(this.copy(t),this):(this.center.equals(t.center)===!0?this.radius=Math.max(this.radius,t.radius):(wa.subVectors(t.center,this.center).setLength(t.radius),this.expandByPoint(ps.copy(t.center).add(wa)),this.expandByPoint(ps.copy(t.center).sub(wa))),this)}equals(t){return t.center.equals(this.center)&&t.radius===this.radius}clone(){return new this.constructor().copy(this)}toJSON(){return{radius:this.radius,center:this.center.toArray()}}fromJSON(t){return this.radius=t.radius,this.center.fromArray(t.center),this}}const yn=new C,Ca=new C,js=new C,On=new C,Ra=new C,tr=new C,Ia=new C;class Xs{constructor(t=new C,e=new C(0,0,-1)){this.origin=t,this.direction=e}set(t,e){return this.origin.copy(t),this.direction.copy(e),this}copy(t){return this.origin.copy(t.origin),this.direction.copy(t.direction),this}at(t,e){return e.copy(this.origin).addScaledVector(this.direction,t)}lookAt(t){return this.direction.copy(t).sub(this.origin).normalize(),this}recast(t){return this.origin.copy(this.at(t,yn)),this}closestPointToPoint(t,e){e.subVectors(t,this.origin);const n=e.dot(this.direction);return n<0?e.copy(this.origin):e.copy(this.origin).addScaledVector(this.direction,n)}distanceToPoint(t){return Math.sqrt(this.distanceSqToPoint(t))}distanceSqToPoint(t){const e=yn.subVectors(t,this.origin).dot(this.direction);return e<0?this.origin.distanceToSquared(t):(yn.copy(this.origin).addScaledVector(this.direction,e),yn.distanceToSquared(t))}distanceSqToSegment(t,e,n,i){Ca.copy(t).add(e).multiplyScalar(.5),js.copy(e).sub(t).normalize(),On.copy(this.origin).sub(Ca);const s=t.distanceTo(e)*.5,a=-this.direction.dot(js),o=On.dot(this.direction),l=-On.dot(js),c=On.lengthSq(),h=Math.abs(1-a*a);let u,d,f,m;if(h>0)if(u=a*l-o,d=a*o-l,m=s*h,u>=0)if(d>=-m)if(d<=m){const _=1/h;u*=_,d*=_,f=u*(u+a*d+2*o)+d*(a*u+d+2*l)+c}
vendor: 7,095 bytes, line 1
1else d=s,u=Math.max(0,-(a*d+o)),f=-u*u+d*(d+2*l)+c;else d=-s,u=Math.max(0,-(a*d+o)),f=-u*u+d*(d+2*l)+c;else d<=-m?(u=Math.max(0,-(-a*s+o)),d=u>0?-s:Math.min(Math.max(-s,-l),s),f=-u*u+d*(d+2*l)+c):d<=m?(u=0,d=Math.min(Math.max(-s,-l),s),f=d*(d+2*l)+c):(u=Math.max(0,-(a*s+o)),d=u>0?s:Math.min(Math.max(-s,-l),s),f=-u*u+d*(d+2*l)+c);else d=a>0?-s:s,u=Math.max(0,-(a*d+o)),f=-u*u+d*(d+2*l)+c;return n&&n.copy(this.origin).addScaledVector(this.direction,u),i&&i.copy(Ca).addScaledVector(js,d),f}intersectSphere(t,e){yn.subVectors(t.center,this.origin);const n=yn.dot(this.direction),i=yn.dot(yn)-n*n,s=t.radius*t.radius;if(i>s)return null;const a=Math.sqrt(s-i),o=n-a,l=n+a;return l<0?null:o<0?this.at(l,e):this.at(o,e)}intersectsSphere(t){return t.radius<0?!1:this.distanceSqToPoint(t.center)<=t.radius*t.radius}distanceToPlane(t){const e=t.normal.dot(this.direction);if(e===0)return t.distanceToPoint(this.origin)===0?0:null;const n=-(this.origin.dot(t.normal)+t.constant)/e;return n>=0?n:null}intersectPlane(t,e){const n=this.distanceToPlane(t);return n===null?null:this.at(n,e)}intersectsPlane(t){const e=t.distanceToPoint(this.origin);return e===0||t.normal.dot(this.direction)*e<0}intersectBox(t,e){let n,i,s,a,o,l;const c=1/this.direction.x,h=1/this.direction.y,u=1/this.direction.z,d=this.origin;return c>=0?(n=(t.min.x-d.x)*c,i=(t.max.x-d.x)*c):(n=(t.max.x-d.x)*c,i=(t.min.x-d.x)*c),h>=0?(s=(t.min.y-d.y)*h,a=(t.max.y-d.y)*h):(s=(t.max.y-d.y)*h,a=(t.min.y-d.y)*h),n>a||s>i||((s>n||isNaN(n))&&(n=s),(a<i||isNaN(i))&&(i=a),u>=0?(o=(t.min.z-d.z)*u,l=(t.max.z-d.z)*u):(o=(t.max.z-d.z)*u,l=(t.min.z-d.z)*u),n>l||o>i)||((o>n||n!==n)&&(n=o),(l<i||i!==i)&&(i=l),i<0)?null:this.at(n>=0?n:i,e)}intersectsBox(t){return this.intersectBox(t,yn)!==null}intersectTriangle(t,e,n,i,s){Ra.subVectors(e,t),tr.subVectors(n,t),Ia.crossVectors(Ra,tr);let a=this.direction.dot(Ia),o;if(a>0){if(i)return null;o=1}else if(a<0)o=-1,a=-a;else return null;On.subVectors(this.origin,t);const l=o*this.direction.dot(tr.crossVectors(On,tr));if(l<0)return null;const c=o*this.direction.dot(Ra.cross(On));if(c<0||l+c>a)return null;const h=-o*On.dot(Ia);return h<0?null:this.at(h/a,s)}applyMatrix4(t){return this.origin.applyMatrix4(t),this.direction.transformDirection(t),this}equals(t){return t.origin.equals(this.origin)&&t.direction.equals(this.direction)}clone(){return new this.constructor().copy(this)}}class zt{constructor(t,e,n,i,s,a,o,l,c,h,u,d,f,m,_,g){zt.prototype.isMatrix4=!0,this.elements=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],t!==void 0&&this.set(t,e,n,i,s,a,o,l,c,h,u,d,f,m,_,g)}set(t,e,n,i,s,a,o,l,c,h,u,d,f,m,_,g){const p=this.elements;return p[0]=t,p[4]=e,p[8]=n,p[12]=i,p[1]=s,p[5]=a,p[9]=o,p[13]=l,p[2]=c,p[6]=h,p[10]=u,p[14]=d,p[3]=f,p[7]=m,p[11]=_,p[15]=g,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 zt().fromArray(this.elements)}copy(t){const e=this.elements,n=t.elements;return e[0]=n[0],e[1]=n[1],e[2]=n[2],e[3]=n[3],e[4]=n[4],e[5]=n[5],e[6]=n[6],e[7]=n[7],e[8]=n[8],e[9]=n[9],e[10]=n[10],e[11]=n[11],e[12]=n[12],e[13]=n[13],e[14]=n[14],e[15]=n[15],this}copyPosition(t){const e=this.elements,n=t.elements;return e[12]=n[12],e[13]=n[13],e[14]=n[14],this}setFromMatrix3(t){const e=t.elements;return this.set(e[0],e[3],e[6],0,e[1],e[4],e[7],0,e[2],e[5],e[8],0,0,0,0,1),this}extractBasis(t,e,n){return t.setFromMatrixColumn(this,0),e.setFromMatrixColumn(this,1),n.setFromMatrixColumn(this,2),this}makeBasis(t,e,n){return this.set(t.x,e.x,n.x,0,t.y,e.y,n.y,0,t.z,e.z,n.z,0,0,0,0,1),this}extractRotation(t){const e=this.elements,n=t.elements,i=1/Pi.setFromMatrixColumn(t,0).length(),s=1/Pi.setFromMatrixColumn(t,1).length(),a=1/Pi.setFromMatrixColumn(t,2).length();return e[0]=n[0]*i,e[1]=n[1]*i,e[2]=n[2]*i,e[3]=0,e[4]=n[4]*s,e[5]=n[5]*s,e[6]=n[6]*s,e[7]=0,e[8]=n[8]*a,e[9]=n[9]*a,e[10]=n[10]*a,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,this}makeRotationFromEuler(t){const e=this.elements,n=t.x,i=t.y,s=t.z,a=Math.cos(n),o=Math.sin(n),l=Math.cos(i),c=Math.sin(i),h=Math.cos(s),u=Math.sin(s);if(t.order==="XYZ"){const d=a*h,f=a*u,m=o*h,_=o*u;e[0]=l*h,e[4]=-l*u,e[8]=c,e[1]=f+m*c,e[5]=d-_*c,e[9]=-o*l,e[2]=_-d*c,e[6]=m+f*c,e[10]=a*l}else if(t.order==="YXZ"){const d=l*h,f=l*u,m=c*h,_=c*u;e[0]=d+_*o,e[4]=m*o-f,e[8]=a*c,e[1]=a*u,e[5]=a*h,e[9]=-o,e[2]=f*o-m,e[6]=_+d*o,e[10]=a*l}else if(t.order==="ZXY"){const d=l*h,f=l*u,m=c*h,_=c*u;e[0]=d-_*o,e[4]=-a*u,e[8]=m+f*o,e[1]=f+m*o,e[5]=a*h,e[9]=_-d*o,e[2]=-a*c,e[6]=o,e[10]=a*l}else if(t.order==="ZYX"){const d=a*h,f=a*u,m=o*h,_=o*u;e[0]=l*h,e[4]=m*c-f,e[8]=d*c+_,e[1]=l*u,e[5]=_*c+d,e[9]=f*c-m,e[2]=-c,e[6]=o*l,e[10]=a*l}else if(t.order==="YZX"){const d=a*l,f=a*c,m=o*l,_=o*c;e[0]=l*h,e[4]=_-d*u,e[8]=m*u+f,e[1]=u,e[5]=a*h,e[9]=-o*h,e[2]=-c*h,e[6]=f*u+m,e[10]=d-_*u}else if(t.order==="XZY"){const d=a*l,f=a*c,m=o*l,_=o*c;e[0]=l*h,e[4]=-u,e[8]=c*h,e[1]=d*u+_,e[5]=a*h,e[9]=f*u-m,e[2]=m*u-f,e[6]=o*h,e[10]=_*u+d}return e[3]=0,e[7]=0,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,this}makeRotationFromQuaternion(t){return this.compose($d,t,Kd)}lookAt(t,e,n){const i=this.elements;return Xe.subVectors(t,e),Xe.lengthSq()===0&&(Xe.z=1),Xe.normalize(),Bn.crossVectors(n,Xe),Bn.lengthSq()===0&&(Math.abs(n.z)===1?Xe.x+=1e-4:Xe.z+=1e-4,Xe.normalize(),Bn.crossVectors(n,Xe)),Bn.normalize(),er.crossVectors(Xe,Bn),i[0]=Bn.x,i[4]=er.x,i[8]=Xe.x,i[1]=Bn.y,i[5]=er.y,i[9]=Xe.y,i[2]=Bn.z,i[6]=er.z,i[10]=Xe.z,this}multiply(t){return this.multiplyMatrices(this,t)}premultiply(t){return this.multiplyMatrices(t,this)}multiplyMatrices(t,e){const n=t.elements,i=e.elements,s=this.elements,a=n[0],o=n[4],l=n[8],c=n[12],h=n[1],u=n[5],d=n[9],f=n[13],m=n[2],_=n[6],g=n[10],p=n[14],y=n[3],v=n[7],x=n[11],A=n[15],T=i[0],R=i[4],P=i[8],b=i[12],S=i[1],I=i[5],B=i[9],k=i[13],V=i[2],Z=i[6],W=i[10],nt=i[14],G=i[3],dt=i[7],_t=i[11],bt=i[15];return s[0]=a*T+o*S+l*V+c*G,s[4]=a*R+o*I+l*Z+c*dt,s[8]=a*P+o*B+l*W+c*_t,s[12]=a*b+o*k+l*nt+c*bt,s[1]=h*T+u*S+d*V+f*G,s[5]=h*R+u*I+d*Z+f*dt,s[9]=h*P+u*B+d*W+f*_t,s[13]=h*b+u*k+d*nt+f*bt,s[2]=m*T+_*S+g*V+p*G,s[6]=m*R+_*I+g*Z+p*dt,s[10]=m*P+_*B+g*W+p*_t,s[14]=m*b+_*k+g*nt+p*bt,s[3]=y*T+v*S+x*V+A*G,s[7]=y*R+v*I+x*Z+A*dt,s[11]=y*P+v*B+x*W+A*_t,s[15]=y*b+v*k+x*nt+A*bt,this}multiplyScalar(t){const e=this.elements;return e[0]*=t,e[4]*=t,e[8]*=t,e[12]*=t,e[1]*=t,e[5]*=t,e[9]*=t,e[13]*=t,e[2]*=t,e[6]*=t,e[10]*=t,e[14]*=t,e[3]*=t,e[7]*=t,e[11]*=t,e[15]*=t,this}determinant(){const t=this.elements,e=t[0],n=t[4],i=t[8],s=t[12],a=t[1],o=t[5],l=t[9],c=t[13],h=t[2],u=t[6],d=t[10],f=t[14],m=t[3],_=t[7],g=t[11],p=t[15];return m*(+s*l*u-i*c*u-s*o*d+n*c*d+i*o*f-n*l*f)+_*(+e*l*f-e*c*d+s*a*d-i*a*f+i*c*h-s*l*h)+g*(+e*c*u-e*o*f-s*a*u+n*a*f+s*o*h-n*c*h)+p*(-i*o*h-e*l*u+e*o*d+i*a*u-n*a*d+n*l*h)}transpose(){const t=this.elements;let e;return e=t[1],t[1]=t[4],t[4]=e,e=t[2],t[2]=t[8],t[8]=e,e=t[6],t[6]=t[9],t[9]=e,e=t[3],t[3]=t[12],t[12]=e,e=t[7],t[7]=t[13],t[13]=e,e=t[11],t[11]=t[14],t[14]=e,this}setPosition(t,e,n){const i=this.elements;return t.isVector3?(i[12]=t.x,i[13]=t.y,i[14]=t.z):(i[12]=t,i[13]=e,i[14]=n),this}invert(){const t=this.elements,e=t[0],n=t[1],i=t[2],s=t[3],a=t[4],o=t[5],l=t[6],c=t[7],h=t[8],u=t[9],d=t[10
vendor: 4,255 bytes, line 1
1],f=t[11],m=t[12],_=t[13],g=t[14],p=t[15],y=u*g*c-_*d*c+_*l*f-o*g*f-u*l*p+o*d*p,v=m*d*c-h*g*c-m*l*f+a*g*f+h*l*p-a*d*p,x=h*_*c-m*u*c+m*o*f-a*_*f-h*o*p+a*u*p,A=m*u*l-h*_*l-m*o*d+a*_*d+h*o*g-a*u*g,T=e*y+n*v+i*x+s*A;if(T===0)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);const R=1/T;return t[0]=y*R,t[1]=(_*d*s-u*g*s-_*i*f+n*g*f+u*i*p-n*d*p)*R,t[2]=(o*g*s-_*l*s+_*i*c-n*g*c-o*i*p+n*l*p)*R,t[3]=(u*l*s-o*d*s-u*i*c+n*d*c+o*i*f-n*l*f)*R,t[4]=v*R,t[5]=(h*g*s-m*d*s+m*i*f-e*g*f-h*i*p+e*d*p)*R,t[6]=(m*l*s-a*g*s-m*i*c+e*g*c+a*i*p-e*l*p)*R,t[7]=(a*d*s-h*l*s+h*i*c-e*d*c-a*i*f+e*l*f)*R,t[8]=x*R,t[9]=(m*u*s-h*_*s-m*n*f+e*_*f+h*n*p-e*u*p)*R,t[10]=(a*_*s-m*o*s+m*n*c-e*_*c-a*n*p+e*o*p)*R,t[11]=(h*o*s-a*u*s-h*n*c+e*u*c+a*n*f-e*o*f)*R,t[12]=A*R,t[13]=(h*_*i-m*u*i+m*n*d-e*_*d-h*n*g+e*u*g)*R,t[14]=(m*o*i-a*_*i-m*n*l+e*_*l+a*n*g-e*o*g)*R,t[15]=(a*u*i-h*o*i+h*n*l-e*u*l-a*n*d+e*o*d)*R,this}scale(t){const e=this.elements,n=t.x,i=t.y,s=t.z;return e[0]*=n,e[4]*=i,e[8]*=s,e[1]*=n,e[5]*=i,e[9]*=s,e[2]*=n,e[6]*=i,e[10]*=s,e[3]*=n,e[7]*=i,e[11]*=s,this}getMaxScaleOnAxis(){const t=this.elements,e=t[0]*t[0]+t[1]*t[1]+t[2]*t[2],n=t[4]*t[4]+t[5]*t[5]+t[6]*t[6],i=t[8]*t[8]+t[9]*t[9]+t[10]*t[10];return Math.sqrt(Math.max(e,n,i))}makeTranslation(t,e,n){return t.isVector3?this.set(1,0,0,t.x,0,1,0,t.y,0,0,1,t.z,0,0,0,1):this.set(1,0,0,t,0,1,0,e,0,0,1,n,0,0,0,1),this}makeRotationX(t){const e=Math.cos(t),n=Math.sin(t);return this.set(1,0,0,0,0,e,-n,0,0,n,e,0,0,0,0,1),this}makeRotationY(t){const e=Math.cos(t),n=Math.sin(t);return this.set(e,0,n,0,0,1,0,0,-n,0,e,0,0,0,0,1),this}makeRotationZ(t){const e=Math.cos(t),n=Math.sin(t);return this.set(e,-n,0,0,n,e,0,0,0,0,1,0,0,0,0,1),this}makeRotationAxis(t,e){const n=Math.cos(e),i=Math.sin(e),s=1-n,a=t.x,o=t.y,l=t.z,c=s*a,h=s*o;return this.set(c*a+n,c*o-i*l,c*l+i*o,0,c*o+i*l,h*o+n,h*l-i*a,0,c*l-i*o,h*l+i*a,s*l*l+n,0,0,0,0,1),this}makeScale(t,e,n){return this.set(t,0,0,0,0,e,0,0,0,0,n,0,0,0,0,1),this}makeShear(t,e,n,i,s,a){return this.set(1,n,s,0,t,1,a,0,e,i,1,0,0,0,0,1),this}compose(t,e,n){const i=this.elements,s=e._x,a=e._y,o=e._z,l=e._w,c=s+s,h=a+a,u=o+o,d=s*c,f=s*h,m=s*u,_=a*h,g=a*u,p=o*u,y=l*c,v=l*h,x=l*u,A=n.x,T=n.y,R=n.z;return i[0]=(1-(_+p))*A,i[1]=(f+x)*A,i[2]=(m-v)*A,i[3]=0,i[4]=(f-x)*T,i[5]=(1-(d+p))*T,i[6]=(g+y)*T,i[7]=0,i[8]=(m+v)*R,i[9]=(g-y)*R,i[10]=(1-(d+_))*R,i[11]=0,i[12]=t.x,i[13]=t.y,i[14]=t.z,i[15]=1,this}decompose(t,e,n){const i=this.elements;let s=Pi.set(i[0],i[1],i[2]).length();const a=Pi.set(i[4],i[5],i[6]).length(),o=Pi.set(i[8],i[9],i[10]).length();this.determinant()<0&&(s=-s),t.x=i[12],t.y=i[13],t.z=i[14],an.copy(this);const c=1/s,h=1/a,u=1/o;return an.elements[0]*=c,an.elements[1]*=c,an.elements[2]*=c,an.elements[4]*=h,an.elements[5]*=h,an.elements[6]*=h,an.elements[8]*=u,an.elements[9]*=u,an.elements[10]*=u,e.setFromRotationMatrix(an),n.x=s,n.y=a,n.z=o,this}makePerspective(t,e,n,i,s,a,o=nn,l=!1){const c=this.elements,h=2*s/(e-t),u=2*s/(n-i),d=(e+t)/(e-t),f=(n+i)/(n-i);let m,_;if(l)m=s/(a-s),_=a*s/(a-s);else if(o===nn)m=-(a+s)/(a-s),_=-2*a*s/(a-s);else if(o===Os)m=-a/(a-s),_=-a*s/(a-s);else throw new Error("THREE.Matrix4.makePerspective(): Invalid coordinate system: "+o);return c[0]=h,c[4]=0,c[8]=d,c[12]=0,c[1]=0,c[5]=u,c[9]=f,c[13]=0,c[2]=0,c[6]=0,c[10]=m,c[14]=_,c[3]=0,c[7]=0,c[11]=-1,c[15]=0,this}makeOrthographic(t,e,n,i,s,a,o=nn,l=!1){const c=this.elements,h=2/(e-t),u=2/(n-i),d=-(e+t)/(e-t),f=-(n+i)/(n-i);let m,_;if(l)m=1/(a-s),_=a/(a-s);else if(o===nn)m=-2/(a-s),_=-(a+s)/(a-s);else if(o===Os)m=-1/(a-s),_=-s/(a-s);else throw new Error("THREE.Matrix4.makeOrthographic(): Invalid coordinate system: "+o);return c[0]=h,c[4]=0,c[8]=0,c[12]=d,c[1]=0,c[5]=u,c[9]=0,c[13]=f,c[2]=0,c[6]=0,c[10]=m,c[14]=_,c[3]=0,c[7]=0,c[11]=0,c[15]=1,this}equals(t){const e=this.elements,n=t.elements;for(let i=0;i<16;i++)if(e[i]!==n[i])return!1;return!0}fromArray(t,e=0){for(let n=0;n<16;n++)this.elements[n]=t[n+e];return this}toArray(t=[],e=0){const n=this.elements;return t[e]=n[0],t[e+1]=n[1],t[e+2]=n[2],t[e+3]=n[3],t[e+4]=n[4],t[e+5]=n[5],t[e+6]=n[6],t[e+7]=n[7],t[e+8]=n[8],t[e+9]=n[9],t[e+10]=n[10],t[e+11]=n[11],t[e+12]=n[12],t[e+13]=n[13],t[e+14]=n[14],t[e+15]=n[15],t}}const Pi=new C,an=new zt,$d=new C(0,0,0),Kd=new C(1,1,1),Bn=new C,er=new C,Xe=new C,lc=new zt,cc=new Ke;
vendor: 4,613 bytes, line 1
1class sn{constructor(t=0,e=0,n=0,i=sn.DEFAULT_ORDER){this.isEuler=!0,this._x=t,this._y=e,this._z=n,this._order=i}get x(){return this._x}set x(t){this._x=t,this._onChangeCallback()}get y(){return this._y}set y(t){this._y=t,this._onChangeCallback()}get z(){return this._z}set z(t){this._z=t,this._onChangeCallback()}get order(){return this._order}set order(t){this._order=t,this._onChangeCallback()}set(t,e,n,i=this._order){return this._x=t,this._y=e,this._z=n,this._order=i,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._order)}copy(t){return this._x=t._x,this._y=t._y,this._z=t._z,this._order=t._order,this._onChangeCallback(),this}setFromRotationMatrix(t,e=this._order,n=!0){const i=t.elements,s=i[0],a=i[4],o=i[8],l=i[1],c=i[5],h=i[9],u=i[2],d=i[6],f=i[10];switch(e){case"XYZ":this._y=Math.asin(Nt(o,-1,1)),Math.abs(o)<.9999999?(this._x=Math.atan2(-h,f),this._z=Math.atan2(-a,s)):(this._x=Math.atan2(d,c),this._z=0);break;case"YXZ":this._x=Math.asin(-Nt(h,-1,1)),Math.abs(h)<.9999999?(this._y=Math.atan2(o,f),this._z=Math.atan2(l,c)):(this._y=Math.atan2(-u,s),this._z=0);break;case"ZXY":this._x=Math.asin(Nt(d,-1,1)),Math.abs(d)<.9999999?(this._y=Math.atan2(-u,f),this._z=Math.atan2(-a,c)):(this._y=0,this._z=Math.atan2(l,s));break;case"ZYX":this._y=Math.asin(-Nt(u,-1,1)),Math.abs(u)<.9999999?(this._x=Math.atan2(d,f),this._z=Math.atan2(l,s)):(this._x=0,this._z=Math.atan2(-a,c));break;case"YZX":this._z=Math.asin(Nt(l,-1,1)),Math.abs(l)<.9999999?(this._x=Math.atan2(-h,c),this._y=Math.atan2(-u,s)):(this._x=0,this._y=Math.atan2(o,f));break;case"XZY":this._z=Math.asin(-Nt(a,-1,1)),Math.abs(a)<.9999999?(this._x=Math.atan2(d,c),this._y=Math.atan2(o,s)):(this._x=Math.atan2(-h,f),this._y=0);break;default:console.warn("THREE.Euler: .setFromRotationMatrix() encountered an unknown order: "+e)}return this._order=e,n===!0&&this._onChangeCallback(),this}setFromQuaternion(t,e,n){return lc.makeRotationFromQuaternion(t),this.setFromRotationMatrix(lc,e,n)}setFromVector3(t,e=this._order){return this.set(t.x,t.y,t.z,e)}reorder(t){return cc.setFromEuler(this),this.setFromQuaternion(cc,t)}equals(t){return t._x===this._x&&t._y===this._y&&t._z===this._z&&t._order===this._order}fromArray(t){return this._x=t[0],this._y=t[1],this._z=t[2],t[3]!==void 0&&(this._order=t[3]),this._onChangeCallback(),this}toArray(t=[],e=0){return t[e]=this._x,t[e+1]=this._y,t[e+2]=this._z,t[e+3]=this._order,t}_onChange(t){return this._onChangeCallback=t,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._order}}sn.DEFAULT_ORDER="XYZ";class ml{constructor(){this.mask=1}set(t){this.mask=(1<<t|0)>>>0}enable(t){this.mask|=1<<t|0}enableAll(){this.mask=-1}toggle(t){this.mask^=1<<t|0}disable(t){this.mask&=~(1<<t|0)}disableAll(){this.mask=0}test(t){return(this.mask&t.mask)!==0}isEnabled(t){return(this.mask&(1<<t|0))!==0}}let Qd=0;const hc=new C,Li=new Ke,Mn=new zt,nr=new C,ms=new C,jd=new C,tf=new Ke,uc=new C(1,0,0),dc=new C(0,1,0),fc=new C(0,0,1),pc={type:"added"},ef={type:"removed"},Di={type:"childadded",child:null},Pa={type:"childremoved",child:null};class ie extends Dn{constructor(){super(),this.isObject3D=!0,Object.defineProperty(this,"id",{value:Qd++}),this.uuid=$e(),this.name="",this.type="Object3D",this.parent=null,this.children=[],this.up=ie.DEFAULT_UP.clone();const t=new C,e=new sn,n=new Ke,i=new C(1,1,1);function s(){n.setFromEuler(e,!1)}function a(){e.setFromQuaternion(n,void 0,!1)}e._onChange(s),n._onChange(a),Object.defineProperties(this,{position:{configurable:!0,enumerable:!0,value:t},rotation:{configurable:!0,enumerable:!0,value:e},quaternion:{configurable:!0,enumerable:!0,value:n},scale:{configurable:!0,enumerable:!0,value:i},modelViewMatrix:{value:new zt},normalMatrix:{value:new Xt}}),this.matrix=new zt,this.matrixWorld=new zt,this.matrixAutoUpdate=ie.DEFAULT_MATRIX_AUTO_UPDATE,this.matrixWorldAutoUpdate=ie.DEFAULT_MATRIX_WORLD_AUTO_UPDATE,this.matrixWorldNeedsUpdate=!1,this.layers=new ml,this.visible=!0,this.castShadow=!1,this.receiveShadow=!1,this.frustumCulled=!0,this.renderOrder=0,this.animations=[],this.customDepthMaterial=void 0,this.customDistanceMaterial=void 0,this.userData={}}onBeforeShadow(){}onAfterShadow(){}onBeforeRender(){}onAfterRender(){}applyMatrix4(t){this.matrixAutoUpdate&&this.updateMatrix(),this.matrix.premultiply(t),this.matrix.decompose(this.position,this.quaternion,this.scale)}applyQuaternion(t){return this.quaternion.premultiply(t),this}setRotationFromAxisAngle(t,e){this.quaternion.setFromAxisAngle(t,e)}setRotationFromEuler(t){this.quaternion.setFromEuler(t,!0)}
vendor: 4,289 bytes, line 1
1setRotationFromMatrix(t){this.quaternion.setFromRotationMatrix(t)}setRotationFromQuaternion(t){this.quaternion.copy(t)}rotateOnAxis(t,e){return Li.setFromAxisAngle(t,e),this.quaternion.multiply(Li),this}rotateOnWorldAxis(t,e){return Li.setFromAxisAngle(t,e),this.quaternion.premultiply(Li),this}rotateX(t){return this.rotateOnAxis(uc,t)}rotateY(t){return this.rotateOnAxis(dc,t)}rotateZ(t){return this.rotateOnAxis(fc,t)}translateOnAxis(t,e){return hc.copy(t).applyQuaternion(this.quaternion),this.position.add(hc.multiplyScalar(e)),this}translateX(t){return this.translateOnAxis(uc,t)}translateY(t){return this.translateOnAxis(dc,t)}translateZ(t){return this.translateOnAxis(fc,t)}localToWorld(t){return this.updateWorldMatrix(!0,!1),t.applyMatrix4(this.matrixWorld)}worldToLocal(t){return this.updateWorldMatrix(!0,!1),t.applyMatrix4(Mn.copy(this.matrixWorld).invert())}lookAt(t,e,n){t.isVector3?nr.copy(t):nr.set(t,e,n);const i=this.parent;this.updateWorldMatrix(!0,!1),ms.setFromMatrixPosition(this.matrixWorld),this.isCamera||this.isLight?Mn.lookAt(ms,nr,this.up):Mn.lookAt(nr,ms,this.up),this.quaternion.setFromRotationMatrix(Mn),i&&(Mn.extractRotation(i.matrixWorld),Li.setFromRotationMatrix(Mn),this.quaternion.premultiply(Li.invert()))}add(t){if(arguments.length>1){for(let e=0;e<arguments.length;e++)this.add(arguments[e]);return this}return t===this?(console.error("THREE.Object3D.add: object can't be added as a child of itself.",t),this):(t&&t.isObject3D?(t.removeFromParent(),t.parent=this,this.children.push(t),t.dispatchEvent(pc),Di.child=t,this.dispatchEvent(Di),Di.child=null):console.error("THREE.Object3D.add: object not an instance of THREE.Object3D.",t),this)}remove(t){if(arguments.length>1){for(let n=0;n<arguments.length;n++)this.remove(arguments[n]);return this}const e=this.children.indexOf(t);return e!==-1&&(t.parent=null,this.children.splice(e,1),t.dispatchEvent(ef),Pa.child=t,this.dispatchEvent(Pa),Pa.child=null),this}removeFromParent(){const t=this.parent;return t!==null&&t.remove(this),this}clear(){return this.remove(...this.children)}attach(t){return this.updateWorldMatrix(!0,!1),Mn.copy(this.matrixWorld).invert(),t.parent!==null&&(t.parent.updateWorldMatrix(!0,!1),Mn.multiply(t.parent.matrixWorld)),t.applyMatrix4(Mn),t.removeFromParent(),t.parent=this,this.children.push(t),t.updateWorldMatrix(!1,!0),t.dispatchEvent(pc),Di.child=t,this.dispatchEvent(Di),Di.child=null,this}getObjectById(t){return this.getObjectByProperty("id",t)}getObjectByName(t){return this.getObjectByProperty("name",t)}getObjectByProperty(t,e){if(this[t]===e)return this;for(let n=0,i=this.children.length;n<i;n++){const a=this.children[n].getObjectByProperty(t,e);if(a!==void 0)return a}}getObjectsByProperty(t,e,n=[]){this[t]===e&&n.push(this);const i=this.children;for(let s=0,a=i.length;s<a;s++)i[s].getObjectsByProperty(t,e,n);return n}getWorldPosition(t){return this.updateWorldMatrix(!0,!1),t.setFromMatrixPosition(this.matrixWorld)}getWorldQuaternion(t){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(ms,t,jd),t}getWorldScale(t){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(ms,tf,t),t}getWorldDirection(t){this.updateWorldMatrix(!0,!1);const e=this.matrixWorld.elements;return t.set(e[8],e[9],e[10]).normalize()}raycast(){}traverse(t){t(this);const e=this.children;for(let n=0,i=e.length;n<i;n++)e[n].traverse(t)}traverseVisible(t){if(this.visible===!1)return;t(this);const e=this.children;for(let n=0,i=e.length;n<i;n++)e[n].traverseVisible(t)}traverseAncestors(t){const e=this.parent;e!==null&&(t(e),e.traverseAncestors(t))}updateMatrix(){this.matrix.compose(this.position,this.quaternion,this.scale),this.matrixWorldNeedsUpdate=!0}updateMatrixWorld(t){this.matrixAutoUpdate&&this.updateMatrix(),(this.matrixWorldNeedsUpdate||t)&&(this.matrixWorldAutoUpdate===!0&&(this.parent===null?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix)),this.matrixWorldNeedsUpdate=!1,t=!0);const e=this.children;for(let n=0,i=e.length;n<i;n++)e[n].updateMatrixWorld(t)}updateWorldMatrix(t,e){const n=this.parent;if(t===!0&&n!==null&&n.updateWorldMatrix(!0,!1),this.matrixAutoUpdate&&this.updateMatrix(),this.matrixWorldAutoUpdate===!0&&(this.parent===null?this.matrixWorld.copy(this.matrix
vendor: 11,534 bytes, line 1
1):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix)),e===!0){const i=this.children;for(let s=0,a=i.length;s<a;s++)i[s].updateWorldMatrix(!1,!0)}}toJSON(t){const e=t===void 0||typeof t=="string",n={};e&&(t={geometries:{},materials:{},textures:{},images:{},shapes:{},skeletons:{},animations:{},nodes:{}},n.metadata={version:4.7,type:"Object",generator:"Object3D.toJSON"});const i={};i.uuid=this.uuid,i.type=this.type,this.name!==""&&(i.name=this.name),this.castShadow===!0&&(i.castShadow=!0),this.receiveShadow===!0&&(i.receiveShadow=!0),this.visible===!1&&(i.visible=!1),this.frustumCulled===!1&&(i.frustumCulled=!1),this.renderOrder!==0&&(i.renderOrder=this.renderOrder),Object.keys(this.userData).length>0&&(i.userData=this.userData),i.layers=this.layers.mask,i.matrix=this.matrix.toArray(),i.up=this.up.toArray(),this.matrixAutoUpdate===!1&&(i.matrixAutoUpdate=!1),this.isInstancedMesh&&(i.type="InstancedMesh",i.count=this.count,i.instanceMatrix=this.instanceMatrix.toJSON(),this.instanceColor!==null&&(i.instanceColor=this.instanceColor.toJSON())),this.isBatchedMesh&&(i.type="BatchedMesh",i.perObjectFrustumCulled=this.perObjectFrustumCulled,i.sortObjects=this.sortObjects,i.drawRanges=this._drawRanges,i.reservedRanges=this._reservedRanges,i.geometryInfo=this._geometryInfo.map(o=>({...o,boundingBox:o.boundingBox?o.boundingBox.toJSON():void 0,boundingSphere:o.boundingSphere?o.boundingSphere.toJSON():void 0})),i.instanceInfo=this._instanceInfo.map(o=>({...o})),i.availableInstanceIds=this._availableInstanceIds.slice(),i.availableGeometryIds=this._availableGeometryIds.slice(),i.nextIndexStart=this._nextIndexStart,i.nextVertexStart=this._nextVertexStart,i.geometryCount=this._geometryCount,i.maxInstanceCount=this._maxInstanceCount,i.maxVertexCount=this._maxVertexCount,i.maxIndexCount=this._maxIndexCount,i.geometryInitialized=this._geometryInitialized,i.matricesTexture=this._matricesTexture.toJSON(t),i.indirectTexture=this._indirectTexture.toJSON(t),this._colorsTexture!==null&&(i.colorsTexture=this._colorsTexture.toJSON(t)),this.boundingSphere!==null&&(i.boundingSphere=this.boundingSphere.toJSON()),this.boundingBox!==null&&(i.boundingBox=this.boundingBox.toJSON()));function s(o,l){return o[l.uuid]===void 0&&(o[l.uuid]=l.toJSON(t)),l.uuid}if(this.isScene)this.background&&(this.background.isColor?i.background=this.background.toJSON():this.background.isTexture&&(i.background=this.background.toJSON(t).uuid)),this.environment&&this.environment.isTexture&&this.environment.isRenderTargetTexture!==!0&&(i.environment=this.environment.toJSON(t).uuid);else if(this.isMesh||this.isLine||this.isPoints){i.geometry=s(t.geometries,this.geometry);const o=this.geometry.parameters;if(o!==void 0&&o.shapes!==void 0){const l=o.shapes;if(Array.isArray(l))for(let c=0,h=l.length;c<h;c++){const u=l[c];s(t.shapes,u)}else s(t.shapes,l)}}if(this.isSkinnedMesh&&(i.bindMode=this.bindMode,i.bindMatrix=this.bindMatrix.toArray(),this.skeleton!==void 0&&(s(t.skeletons,this.skeleton),i.skeleton=this.skeleton.uuid)),this.material!==void 0)if(Array.isArray(this.material)){const o=[];for(let l=0,c=this.material.length;l<c;l++)o.push(s(t.materials,this.material[l]));i.material=o}else i.material=s(t.materials,this.material);if(this.children.length>0){i.children=[];for(let o=0;o<this.children.length;o++)i.children.push(this.children[o].toJSON(t).object)}if(this.animations.length>0){i.animations=[];for(let o=0;o<this.animations.length;o++){const l=this.animations[o];i.animations.push(s(t.animations,l))}}if(e){const o=a(t.geometries),l=a(t.materials),c=a(t.textures),h=a(t.images),u=a(t.shapes),d=a(t.skeletons),f=a(t.animations),m=a(t.nodes);o.length>0&&(n.geometries=o),l.length>0&&(n.materials=l),c.length>0&&(n.textures=c),h.length>0&&(n.images=h),u.length>0&&(n.shapes=u),d.length>0&&(n.skeletons=d),f.length>0&&(n.animations=f),m.length>0&&(n.nodes=m)}return n.object=i,n;function a(o){const l=[];for(const c in o){const h=o[c];delete h.metadata,l.push(h)}return l}}clone(t){return new this.constructor().copy(this,t)}copy(t,e=!0){if(this.name=t.name,this.up.copy(t.up),this.position.copy(t.position),this.rotation.order=t.rotation.order,this.quaternion.copy(t.quaternion),this.scale.copy(t.scale),this.matrix.copy(t.matrix),this.matrixWorld.copy(t.matrixWorld),this.matrixAutoUpdate=t.matrixAutoUpdate,this.matrixWorldAutoUpdate=t.matrixWorldAutoUpdate,this.matrixWorldNeedsUpdate=t.matrixWorldNeedsUpdate,this.layers.mask=t.layers.mask,this.visible=t.visible,this.castShadow=t.castShadow,this.receiveShadow=t.receiveShadow,this.frustumCulled=t.frustumCulled,this.renderOrder=t.renderOrder,this.animations=t.animations.slice(),this.userData=JSON.parse(JSON.stringify(t.userData)),e===!0)for(let n=0;n<t.children.length;n++){const i=t.children[n];this.add(i.clone())}return this}}ie.DEFAULT_UP=new C(0,1,0);ie.DEFAULT_MATRIX_AUTO_UPDATE=!0;ie.DEFAULT_MATRIX_WORLD_AUTO_UPDATE=!0;const on=new C,Sn=new C,La=new C,bn=new C,Ui=new C,Ni=new C,mc=new C,Da=new C,Ua=new C,Na=new C,Fa=new ne,Oa=new ne,Ba=new ne;class Ze{constructor(t=new C,e=new C,n=new C){this.a=t,this.b=e,this.c=n}static getNormal(t,e,n,i){i.subVectors(n,e),on.subVectors(t,e),i.cross(on);const s=i.lengthSq();return s>0?i.multiplyScalar(1/Math.sqrt(s)):i.set(0,0,0)}static getBarycoord(t,e,n,i,s){on.subVectors(i,e),Sn.subVectors(n,e),La.subVectors(t,e);const a=on.dot(on),o=on.dot(Sn),l=on.dot(La),c=Sn.dot(Sn),h=Sn.dot(La),u=a*c-o*o;if(u===0)return s.set(0,0,0),null;const d=1/u,f=(c*l-o*h)*d,m=(a*h-o*l)*d;return s.set(1-f-m,m,f)}static containsPoint(t,e,n,i){return this.getBarycoord(t,e,n,i,bn)===null?!1:bn.x>=0&&bn.y>=0&&bn.x+bn.y<=1}static getInterpolation(t,e,n,i,s,a,o,l){return this.getBarycoord(t,e,n,i,bn)===null?(l.x=0,l.y=0,"z"in l&&(l.z=0),"w"in l&&(l.w=0),null):(l.setScalar(0),l.addScaledVector(s,bn.x),l.addScaledVector(a,bn.y),l.addScaledVector(o,bn.z),l)}static getInterpolatedAttribute(t,e,n,i,s,a){return Fa.setScalar(0),Oa.setScalar(0),Ba.setScalar(0),Fa.fromBufferAttribute(t,e),Oa.fromBufferAttribute(t,n),Ba.fromBufferAttribute(t,i),a.setScalar(0),a.addScaledVector(Fa,s.x),a.addScaledVector(Oa,s.y),a.addScaledVector(Ba,s.z),a}static isFrontFacing(t,e,n,i){return on.subVectors(n,e),Sn.subVectors(t,e),on.cross(Sn).dot(i)<0}set(t,e,n){return this.a.copy(t),this.b.copy(e),this.c.copy(n),this}setFromPointsAndIndices(t,e,n,i){return this.a.copy(t[e]),this.b.copy(t[n]),this.c.copy(t[i]),this}setFromAttributeAndIndices(t,e,n,i){return this.a.fromBufferAttribute(t,e),this.b.fromBufferAttribute(t,n),this.c.fromBufferAttribute(t,i),this}clone(){return new this.constructor().copy(this)}copy(t){return this.a.copy(t.a),this.b.copy(t.b),this.c.copy(t.c),this}getArea(){return on.subVectors(this.c,this.b),Sn.subVectors(this.a,this.b),on.cross(Sn).length()*.5}getMidpoint(t){return t.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)}getNormal(t){return Ze.getNormal(this.a,this.b,this.c,t)}getPlane(t){return t.setFromCoplanarPoints(this.a,this.b,this.c)}getBarycoord(t,e){return Ze.getBarycoord(t,this.a,this.b,this.c,e)}getInterpolation(t,e,n,i,s){return Ze.getInterpolation(t,this.a,this.b,this.c,e,n,i,s)}containsPoint(t){return Ze.containsPoint(t,this.a,this.b,this.c)}isFrontFacing(t){return Ze.isFrontFacing(this.a,this.b,this.c,t)}intersectsBox(t){return t.intersectsTriangle(this)}closestPointToPoint(t,e){const n=this.a,i=this.b,s=this.c;let a,o;Ui.subVectors(i,n),Ni.subVectors(s,n),Da.subVectors(t,n);const l=Ui.dot(Da),c=Ni.dot(Da);if(l<=0&&c<=0)return e.copy(n);Ua.subVectors(t,i);const h=Ui.dot(Ua),u=Ni.dot(Ua);if(h>=0&&u<=h)return e.copy(i);const d=l*u-h*c;if(d<=0&&l>=0&&h<=0)return a=l/(l-h),e.copy(n).addScaledVector(Ui,a);Na.subVectors(t,s);const f=Ui.dot(Na),m=Ni.dot(Na);if(m>=0&&f<=m)return e.copy(s);const _=f*c-l*m;if(_<=0&&c>=0&&m<=0)return o=c/(c-m),e.copy(n).addScaledVector(Ni,o);const g=h*m-f*u;if(g<=0&&u-h>=0&&f-m>=0)return mc.subVectors(s,i),o=(u-h)/(u-h+(f-m)),e.copy(i).addScaledVector(mc,o);const p=1/(g+_+d);return a=_*p,o=d*p,e.copy(n).addScaledVector(Ui,a).addScaledVector(Ni,o)}equals(t){return t.a.equals(this.a)&&t.b.equals(this.b)&&t.c.equals(this.c)}}const Zh={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},zn={h:0,s:0,l:0},ir={h:0,s:0,l:0};function za(r,t,e){return e<0&&(e+=1),e>1&&(e-=1),e<1/6?r+(t-r)*6*e:e<1/2?t:e<2/3?r+(t-r)*6*(2/3-e):r}class vt{constructor(t,e,n){return this.isColor=!0,this.r=1,this.g=1,this.b=1,this.set(t,e,n)}set(t,e,n){if(e===void 0&&n===void 0){const i=t;i&&i.isColor?this.copy(i):typeof i=="number"?this.setHex(i):typeof i=="string"&&this.setStyle(i)}else this.setRGB(t,e,n);return this}setScalar(t){return this.r=t,this.g=t,this.b=t,this}setHex(t,e=Ye){return t=Math.floor(t),this.r=(t>>16&255)/255,this.g=(t>>8&255)/255,this.b=(t&255)/255,Kt.colorSpaceToWorking(this,e),this}setRGB(t,e,n,i=Kt.workingColorSpace){return this.r=t,this.g=e,this.b=n,Kt.colorSpaceToWorking(this,i),this}
vendor: 6,208 bytes, line 1
1setHSL(t,e,n,i=Kt.workingColorSpace){if(t=dl(t,1),e=Nt(e,0,1),n=Nt(n,0,1),e===0)this.r=this.g=this.b=n;else{const s=n<=.5?n*(1+e):n+e-n*e,a=2*n-s;this.r=za(a,s,t+1/3),this.g=za(a,s,t),this.b=za(a,s,t-1/3)}return Kt.colorSpaceToWorking(this,i),this}setStyle(t,e=Ye){function n(s){s!==void 0&&parseFloat(s)<1&&console.warn("THREE.Color: Alpha component of "+t+" will be ignored.")}let i;if(i=/^(\w+)\(([^\)]*)\)/.exec(t)){let s;const a=i[1],o=i[2];switch(a){case"rgb":case"rgba":if(s=/^\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(o))return n(s[4]),this.setRGB(Math.min(255,parseInt(s[1],10))/255,Math.min(255,parseInt(s[2],10))/255,Math.min(255,parseInt(s[3],10))/255,e);if(s=/^\s*(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(o))return n(s[4]),this.setRGB(Math.min(100,parseInt(s[1],10))/100,Math.min(100,parseInt(s[2],10))/100,Math.min(100,parseInt(s[3],10))/100,e);break;case"hsl":case"hsla":if(s=/^\s*(\d*\.?\d+)\s*,\s*(\d*\.?\d+)\%\s*,\s*(\d*\.?\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(o))return n(s[4]),this.setHSL(parseFloat(s[1])/360,parseFloat(s[2])/100,parseFloat(s[3])/100,e);break;default:console.warn("THREE.Color: Unknown color model "+t)}}else if(i=/^\#([A-Fa-f\d]+)$/.exec(t)){const s=i[1],a=s.length;if(a===3)return this.setRGB(parseInt(s.charAt(0),16)/15,parseInt(s.charAt(1),16)/15,parseInt(s.charAt(2),16)/15,e);if(a===6)return this.setHex(parseInt(s,16),e);console.warn("THREE.Color: Invalid hex color "+t)}else if(t&&t.length>0)return this.setColorName(t,e);return this}setColorName(t,e=Ye){const n=Zh[t.toLowerCase()];return n!==void 0?this.setHex(n,e):console.warn("THREE.Color: Unknown color "+t),this}clone(){return new this.constructor(this.r,this.g,this.b)}copy(t){return this.r=t.r,this.g=t.g,this.b=t.b,this}copySRGBToLinear(t){return this.r=In(t.r),this.g=In(t.g),this.b=In(t.b),this}copyLinearToSRGB(t){return this.r=ts(t.r),this.g=ts(t.g),this.b=ts(t.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}getHex(t=Ye){return Kt.workingToColorSpace(Ae.copy(this),t),Math.round(Nt(Ae.r*255,0,255))*65536+Math.round(Nt(Ae.g*255,0,255))*256+Math.round(Nt(Ae.b*255,0,255))}getHexString(t=Ye){return("000000"+this.getHex(t).toString(16)).slice(-6)}getHSL(t,e=Kt.workingColorSpace){Kt.workingToColorSpace(Ae.copy(this),e);const n=Ae.r,i=Ae.g,s=Ae.b,a=Math.max(n,i,s),o=Math.min(n,i,s);let l,c;const h=(o+a)/2;if(o===a)l=0,c=0;else{const u=a-o;switch(c=h<=.5?u/(a+o):u/(2-a-o),a){case n:l=(i-s)/u+(i<s?6:0);break;case i:l=(s-n)/u+2;break;case s:l=(n-i)/u+4;break}l/=6}return t.h=l,t.s=c,t.l=h,t}getRGB(t,e=Kt.workingColorSpace){return Kt.workingToColorSpace(Ae.copy(this),e),t.r=Ae.r,t.g=Ae.g,t.b=Ae.b,t}getStyle(t=Ye){Kt.workingToColorSpace(Ae.copy(this),t);const e=Ae.r,n=Ae.g,i=Ae.b;return t!==Ye?`color(${t} ${e.toFixed(3)} ${n.toFixed(3)} ${i.toFixed(3)})`:`rgb(${Math.round(e*255)},${Math.round(n*255)},${Math.round(i*255)})`}offsetHSL(t,e,n){return this.getHSL(zn),this.setHSL(zn.h+t,zn.s+e,zn.l+n)}add(t){return this.r+=t.r,this.g+=t.g,this.b+=t.b,this}addColors(t,e){return this.r=t.r+e.r,this.g=t.g+e.g,this.b=t.b+e.b,this}addScalar(t){return this.r+=t,this.g+=t,this.b+=t,this}sub(t){return this.r=Math.max(0,this.r-t.r),this.g=Math.max(0,this.g-t.g),this.b=Math.max(0,this.b-t.b),this}multiply(t){return this.r*=t.r,this.g*=t.g,this.b*=t.b,this}multiplyScalar(t){return this.r*=t,this.g*=t,this.b*=t,this}lerp(t,e){return this.r+=(t.r-this.r)*e,this.g+=(t.g-this.g)*e,this.b+=(t.b-this.b)*e,this}lerpColors(t,e,n){return this.r=t.r+(e.r-t.r)*n,this.g=t.g+(e.g-t.g)*n,this.b=t.b+(e.b-t.b)*n,this}lerpHSL(t,e){this.getHSL(zn),t.getHSL(ir);const n=Is(zn.h,ir.h,e),i=Is(zn.s,ir.s,e),s=Is(zn.l,ir.l,e);return this.setHSL(n,i,s),this}setFromVector3(t){return this.r=t.x,this.g=t.y,this.b=t.z,this}applyMatrix3(t){const e=this.r,n=this.g,i=this.b,s=t.elements;return this.r=s[0]*e+s[3]*n+s[6]*i,this.g=s[1]*e+s[4]*n+s[7]*i,this.b=s[2]*e+s[5]*n+s[8]*i,this}equals(t){return t.r===this.r&&t.g===this.g&&t.b===this.b}fromArray(t,e=0){return this.r=t[e],this.g=t[e+1],this.b=t[e+2],this}toArray(t=[],e=0){return t[e]=this.r,t[e+1]=this.g,t[e+2]=this.b,t}fromBufferAttribute(t,e){return this.r=t.getX(e),this.g=t.getY(e),this.b=t.getZ(e),this}toJSON(){return this.getHex()}*[Symbol.iterator](){yield this.r,yield this.g,yield this.b}}const Ae=new vt;vt.NAMES=Zh;let nf=0;class Fe extends Dn{constructor(){super(),this.isMaterial=!0,Object.defineProperty(this,"id",{value:nf++}),this.uuid=$e(),this.name="",this.type="Material",this.blending=Qi,this.side=Xn,this.vertexColors=!1,this.opacity=1,this.transparent=!1,this.alphaHash=!1,this.blendSrc=po,this.blendDst=mo,this.blendEquation=fi,this.blendSrcAlpha=null,this.blendDstAlpha=null,this.blendEquationAlpha=null,this.blendColor=new vt(0,0,0),this.blendAlpha=0,this.depthFunc=ns,this.depthTest=!0,this.depthWrite=!0,this.stencilWriteMask=255,this.stencilFunc=ec,this.stencilRef=0,this.stencilFuncMask=255,this.stencilFail=Ai,this.stencilZFail=Ai,this.stencilZPass=Ai,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.forceSinglePass=!1,this.allowOverride=!0,this.visible=!0,this.toneMapped=!0,this.userData={},this.version=0,this._alphaTest=0}get alphaTest(){return this._alphaTest}set alphaTest(t){this._alphaTest>0!=t>0&&this.version++,this._alphaTest=t}onBeforeRender(){}onBeforeCompile(){}customProgramCacheKey(){return this.onBeforeCompile.toString()}setValues(t){if(t!==void 0)for(const e in t){const n=t[e];if(n===void 0){console.warn(`THREE.Material: parameter '${e}' has value of undefined.`);continue}const i=this[e];if(i===void 0){console.warn(`THREE.Material: '${e}' is not a property of THREE.${this.type}.`);continue}i&&i.isColor?i.set(n):i&&i.isVector3&&n&&n.isVector3?i.copy(n):this[e]=n}}toJSON(t){const e=t===void 0||typeof t=="string";e&&(t={textures:{},images:{}});const n={metadata:{version:4.7,type:"Material",generator:"Material.toJSON"}};
vendor: 12,829 bytes, line 1
1n.uuid=this.uuid,n.type=this.type,this.name!==""&&(n.name=this.name),this.color&&this.color.isColor&&(n.color=this.color.getHex()),this.roughness!==void 0&&(n.roughness=this.roughness),this.metalness!==void 0&&(n.metalness=this.metalness),this.sheen!==void 0&&(n.sheen=this.sheen),this.sheenColor&&this.sheenColor.isColor&&(n.sheenColor=this.sheenColor.getHex()),this.sheenRoughness!==void 0&&(n.sheenRoughness=this.sheenRoughness),this.emissive&&this.emissive.isColor&&(n.emissive=this.emissive.getHex()),this.emissiveIntensity!==void 0&&this.emissiveIntensity!==1&&(n.emissiveIntensity=this.emissiveIntensity),this.specular&&this.specular.isColor&&(n.specular=this.specular.getHex()),this.specularIntensity!==void 0&&(n.specularIntensity=this.specularIntensity),this.specularColor&&this.specularColor.isColor&&(n.specularColor=this.specularColor.getHex()),this.shininess!==void 0&&(n.shininess=this.shininess),this.clearcoat!==void 0&&(n.clearcoat=this.clearcoat),this.clearcoatRoughness!==void 0&&(n.clearcoatRoughness=this.clearcoatRoughness),this.clearcoatMap&&this.clearcoatMap.isTexture&&(n.clearcoatMap=this.clearcoatMap.toJSON(t).uuid),this.clearcoatRoughnessMap&&this.clearcoatRoughnessMap.isTexture&&(n.clearcoatRoughnessMap=this.clearcoatRoughnessMap.toJSON(t).uuid),this.clearcoatNormalMap&&this.clearcoatNormalMap.isTexture&&(n.clearcoatNormalMap=this.clearcoatNormalMap.toJSON(t).uuid,n.clearcoatNormalScale=this.clearcoatNormalScale.toArray()),this.dispersion!==void 0&&(n.dispersion=this.dispersion),this.iridescence!==void 0&&(n.iridescence=this.iridescence),this.iridescenceIOR!==void 0&&(n.iridescenceIOR=this.iridescenceIOR),this.iridescenceThicknessRange!==void 0&&(n.iridescenceThicknessRange=this.iridescenceThicknessRange),this.iridescenceMap&&this.iridescenceMap.isTexture&&(n.iridescenceMap=this.iridescenceMap.toJSON(t).uuid),this.iridescenceThicknessMap&&this.iridescenceThicknessMap.isTexture&&(n.iridescenceThicknessMap=this.iridescenceThicknessMap.toJSON(t).uuid),this.anisotropy!==void 0&&(n.anisotropy=this.anisotropy),this.anisotropyRotation!==void 0&&(n.anisotropyRotation=this.anisotropyRotation),this.anisotropyMap&&this.anisotropyMap.isTexture&&(n.anisotropyMap=this.anisotropyMap.toJSON(t).uuid),this.map&&this.map.isTexture&&(n.map=this.map.toJSON(t).uuid),this.matcap&&this.matcap.isTexture&&(n.matcap=this.matcap.toJSON(t).uuid),this.alphaMap&&this.alphaMap.isTexture&&(n.alphaMap=this.alphaMap.toJSON(t).uuid),this.lightMap&&this.lightMap.isTexture&&(n.lightMap=this.lightMap.toJSON(t).uuid,n.lightMapIntensity=this.lightMapIntensity),this.aoMap&&this.aoMap.isTexture&&(n.aoMap=this.aoMap.toJSON(t).uuid,n.aoMapIntensity=this.aoMapIntensity),this.bumpMap&&this.bumpMap.isTexture&&(n.bumpMap=this.bumpMap.toJSON(t).uuid,n.bumpScale=this.bumpScale),this.normalMap&&this.normalMap.isTexture&&(n.normalMap=this.normalMap.toJSON(t).uuid,n.normalMapType=this.normalMapType,n.normalScale=this.normalScale.toArray()),this.displacementMap&&this.displacementMap.isTexture&&(n.displacementMap=this.displacementMap.toJSON(t).uuid,n.displacementScale=this.displacementScale,n.displacementBias=this.displacementBias),this.roughnessMap&&this.roughnessMap.isTexture&&(n.roughnessMap=this.roughnessMap.toJSON(t).uuid),this.metalnessMap&&this.metalnessMap.isTexture&&(n.metalnessMap=this.metalnessMap.toJSON(t).uuid),this.emissiveMap&&this.emissiveMap.isTexture&&(n.emissiveMap=this.emissiveMap.toJSON(t).uuid),this.specularMap&&this.specularMap.isTexture&&(n.specularMap=this.specularMap.toJSON(t).uuid),this.specularIntensityMap&&this.specularIntensityMap.isTexture&&(n.specularIntensityMap=this.specularIntensityMap.toJSON(t).uuid),this.specularColorMap&&this.specularColorMap.isTexture&&(n.specularColorMap=this.specularColorMap.toJSON(t).uuid),this.envMap&&this.envMap.isTexture&&(n.envMap=this.envMap.toJSON(t).uuid,this.combine!==void 0&&(n.combine=this.combine)),this.envMapRotation!==void 0&&(n.envMapRotation=this.envMapRotation.toArray()),this.envMapIntensity!==void 0&&(n.envMapIntensity=this.envMapIntensity),this.reflectivity!==void 0&&(n.reflectivity=this.reflectivity),this.refractionRatio!==void 0&&(n.refractionRatio=this.refractionRatio),this.gradientMap&&this.gradientMap.isTexture&&(n.gradientMap=this.gradientMap.toJSON(t).uuid),this.transmission!==void 0&&(n.transmission=this.transmission),this.transmissionMap&&this.transmissionMap.isTexture&&(n.transmissionMap=this.transmissionMap.toJSON(t).uuid),this.thickness!==void 0&&(n.thickness=this.thickness),this.thicknessMap&&this.thicknessMap.isTexture&&(n.thicknessMap=this.thicknessMap.toJSON(t).uuid),this.attenuationDistance!==void 0&&this.attenuationDistance!==1/0&&(n.attenuationDistance=this.attenuationDistance),this.attenuationColor!==void 0&&(n.attenuationColor=this.attenuationColor.getHex()),this.size!==void 0&&(n.size=this.size),this.shadowSide!==null&&(n.shadowSide=this.shadowSide),this.sizeAttenuation!==void 0&&(n.sizeAttenuation=this.sizeAttenuation),this.blending!==Qi&&(n.blending=this.blending),this.side!==Xn&&(n.side=this.side),this.vertexColors===!0&&(n.vertexColors=!0),this.opacity<1&&(n.opacity=this.opacity),this.transparent===!0&&(n.transparent=!0),this.blendSrc!==po&&(n.blendSrc=this.blendSrc),this.blendDst!==mo&&(n.blendDst=this.blendDst),this.blendEquation!==fi&&(n.blendEquation=this.blendEquation),this.blendSrcAlpha!==null&&(n.blendSrcAlpha=this.blendSrcAlpha),this.blendDstAlpha!==null&&(n.blendDstAlpha=this.blendDstAlpha),this.blendEquationAlpha!==null&&(n.blendEquationAlpha=this.blendEquationAlpha),this.blendColor&&this.blendColor.isColor&&(n.blendColor=this.blendColor.getHex()),this.blendAlpha!==0&&(n.blendAlpha=this.blendAlpha),this.depthFunc!==ns&&(n.depthFunc=this.depthFunc),this.depthTest===!1&&(n.depthTest=this.depthTest),this.depthWrite===!1&&(n.depthWrite=this.depthWrite),this.colorWrite===!1&&(n.colorWrite=this.colorWrite),this.stencilWriteMask!==255&&(n.stencilWriteMask=this.stencilWriteMask),this.stencilFunc!==ec&&(n.stencilFunc=this.stencilFunc),this.stencilRef!==0&&(n.stencilRef=this.stencilRef),this.stencilFuncMask!==255&&(n.stencilFuncMask=this.stencilFuncMask),this.stencilFail!==Ai&&(n.stencilFail=this.stencilFail),this.stencilZFail!==Ai&&(n.stencilZFail=this.stencilZFail),this.stencilZPass!==Ai&&(n.stencilZPass=this.stencilZPass),this.stencilWrite===!0&&(n.stencilWrite=this.stencilWrite),this.rotation!==void 0&&this.rotation!==0&&(n.rotation=this.rotation),this.polygonOffset===!0&&(n.polygonOffset=!0),this.polygonOffsetFactor!==0&&(n.polygonOffsetFactor=this.polygonOffsetFactor),this.polygonOffsetUnits!==0&&(n.polygonOffsetUnits=this.polygonOffsetUnits),this.linewidth!==void 0&&this.linewidth!==1&&(n.linewidth=this.linewidth),this.dashSize!==void 0&&(n.dashSize=this.dashSize),this.gapSize!==void 0&&(n.gapSize=this.gapSize),this.scale!==void 0&&(n.scale=this.scale),this.dithering===!0&&(n.dithering=!0),this.alphaTest>0&&(n.alphaTest=this.alphaTest),this.alphaHash===!0&&(n.alphaHash=!0),this.alphaToCoverage===!0&&(n.alphaToCoverage=!0),this.premultipliedAlpha===!0&&(n.premultipliedAlpha=!0),this.forceSinglePass===!0&&(n.forceSinglePass=!0),this.wireframe===!0&&(n.wireframe=!0),this.wireframeLinewidth>1&&(n.wireframeLinewidth=this.wireframeLinewidth),this.wireframeLinecap!=="round"&&(n.wireframeLinecap=this.wireframeLinecap),this.wireframeLinejoin!=="round"&&(n.wireframeLinejoin=this.wireframeLinejoin),this.flatShading===!0&&(n.flatShading=!0),this.visible===!1&&(n.visible=!1),this.toneMapped===!1&&(n.toneMapped=!1),this.fog===!1&&(n.fog=!1),Object.keys(this.userData).length>0&&(n.userData=this.userData);function i(s){const a=[];for(const o in s){const l=s[o];delete l.metadata,a.push(l)}return a}if(e){const s=i(t.textures),a=i(t.images);s.length>0&&(n.textures=s),a.length>0&&(n.images=a)}return n}clone(){return new this.constructor().copy(this)}copy(t){this.name=t.name,this.blending=t.blending,this.side=t.side,this.vertexColors=t.vertexColors,this.opacity=t.opacity,this.transparent=t.transparent,this.blendSrc=t.blendSrc,this.blendDst=t.blendDst,this.blendEquation=t.blendEquation,this.blendSrcAlpha=t.blendSrcAlpha,this.blendDstAlpha=t.blendDstAlpha,this.blendEquationAlpha=t.blendEquationAlpha,this.blendColor.copy(t.blendColor),this.blendAlpha=t.blendAlpha,this.depthFunc=t.depthFunc,this.depthTest=t.depthTest,this.depthWrite=t.depthWrite,this.stencilWriteMask=t.stencilWriteMask,this.stencilFunc=t.stencilFunc,this.stencilRef=t.stencilRef,this.stencilFuncMask=t.stencilFuncMask,this.stencilFail=t.stencilFail,this.stencilZFail=t.stencilZFail,this.stencilZPass=t.stencilZPass,this.stencilWrite=t.stencilWrite;const e=t.clippingPlanes;let n=null;if(e!==null){const i=e.length;n=new Array(i);for(let s=0;s!==i;++s)n[s]=e[s].clone()}return this.clippingPlanes=n,this.clipIntersection=t.clipIntersection,this.clipShadows=t.clipShadows,this.shadowSide=t.shadowSide,this.colorWrite=t.colorWrite,this.precision=t.precision,this.polygonOffset=t.polygonOffset,this.polygonOffsetFactor=t.polygonOffsetFactor,this.polygonOffsetUnits=t.polygonOffsetUnits,this.dithering=t.dithering,this.alphaTest=t.alphaTest,this.alphaHash=t.alphaHash,this.alphaToCoverage=t.alphaToCoverage,this.premultipliedAlpha=t.premultipliedAlpha,this.forceSinglePass=t.forceSinglePass,this.visible=t.visible,this.toneMapped=t.toneMapped,this.userData=JSON.parse(JSON.stringify(t.userData)),this}dispose(){this.dispatchEvent({type:"dispose"})}set needsUpdate(t){t===!0&&this.version++}}class Si extends Fe{constructor(t){super(),this.isMeshBasicMaterial=!0,this.type="MeshBasicMaterial",this.color=new vt(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.envMapRotation=new sn,this.combine=ca,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.fog=!0,this.setValues(t)}copy(t){return super.copy(t),this.color.copy(t.color),this.map=t.map,this.lightMap=t.lightMap,this.lightMapIntensity=t.lightMapIntensity,this.aoMap=t.aoMap,this.aoMapIntensity=t.aoMapIntensity,this.specularMap=t.specularMap,this.alphaMap=t.alphaMap,this.envMap=t.envMap,this.envMapRotation.copy(t.envMapRotation),this.combine=t.combine,this.reflectivity=t.reflectivity,this.refractionRatio=t.refractionRatio,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.wireframeLinecap=t.wireframeLinecap,this.wireframeLinejoin=t.wireframeLinejoin,this.fog=t.fog,this}}const wn=sf();function sf(){const r=new ArrayBuffer(4),t=new Float32Array(r),e=new Uint32Array(r),n=new Uint32Array(512),i=new Uint32Array(512);for(let l=0;l<256;++l){const c=l-127;c<-27?(n[l]=0,n[l|256]=32768,i[l]=24,i[l|256]=24):c<-14?(n[l]=1024>>-c-14,n[l|256]=1024>>-c-14|32768,i[l]=-c-1,i[l|256]=-c-1):c<=15?(n[l]=c+15<<10,n[l|256]=c+15<<10|32768,i[l]=13,i[l|256]=13):c<128?(n[l]=31744,n[l|256]=64512,i[l]=24,i[l|256]=24):(n[l]=31744,n[l|256]=64512,i[l]=13,i[l|256]=13)}const s=new Uint32Array(2048),a=new Uint32Array(64),o=new Uint32Array(64);for(let l=1;l<1024;++l){let c=l<<13,h=0;for(;(c&8388608)===0;)c<<=1,h-=8388608;c&=-8388609,h+=947912704,s[l]=c|h}for(let l=1024;l<2048;++l)s[l]=939524096+(l-1024<<13);for(let l=1;l<31;++l)a[l]=l<<23;a[31]=1199570944,a[32]=2147483648;for(let l=33;l<63;++l)a[l]=2147483648+(l-32<<23);a[63]=3347054592;for(let l=1;l<64;++l)l!==32&&(o[l]=1024);return{floatView:t,uint32View:e,baseTable:n,shiftTable:i,mantissaTable:s,exponentTable:a,offsetTable:o}}function ze(r){Math.abs(r)>65504&&console.warn("THREE.DataUtils.toHalfFloat(): Value out of range."),r=Nt(r,-65504,65504),wn.floatView[0]=r;const t=wn.uint32View[0],e=t>>23&511;return wn.baseTable[e]+((t&8388607)>>wn.shiftTable[e])}function As(r){const t=r>>10;return wn.uint32View[0]=wn.mantissaTable[wn.offsetTable[t]+(r&1023)]+wn.exponentTable[t],wn.floatView[0]}class Yv{static toHalfFloat(t){return ze(t)}static fromHalfFloat(t){return As(t)}}const ve=new C,sr=new K;let rf=0;class le{constructor(t,e,n=!1){if(Array.isArray(t))throw new TypeError("THREE.BufferAttribute: array should be a Typed Array.");this.isBufferAttribute=!0,Object.defineProperty(this,"id",{value:rf++}),this.name="",this.array=t,this.itemSize=e,this.count=t!==void 0?t.length/e:0,this.normalized=n,this.usage=ea,this.updateRanges=[],this.gpuType=Je,this.version=0}onUploadCallback(){}set needsUpdate(t){t===!0&&this.version++}setUsage(t){return this.usage=t,this}addUpdateRange(t,e){this.updateRanges.push({start:t,count:e})}clearUpdateRanges(){this.updateRanges.length=0}copy(t){return this.name=t.name,this.array=new t.array.constructor(t.array),this.itemSize=t.itemSize,this.count=t.count,this.normalized=t.normalized,this.usage=t.usage,this.gpuType=t.gpuType,this}copyAt(t,e,n){t*=this.itemSize,n*=e.itemSize;
vendor: 4,689 bytes, line 1
1for(let i=0,s=this.itemSize;i<s;i++)this.array[t+i]=e.array[n+i];return this}copyArray(t){return this.array.set(t),this}applyMatrix3(t){if(this.itemSize===2)for(let e=0,n=this.count;e<n;e++)sr.fromBufferAttribute(this,e),sr.applyMatrix3(t),this.setXY(e,sr.x,sr.y);else if(this.itemSize===3)for(let e=0,n=this.count;e<n;e++)ve.fromBufferAttribute(this,e),ve.applyMatrix3(t),this.setXYZ(e,ve.x,ve.y,ve.z);return this}applyMatrix4(t){for(let e=0,n=this.count;e<n;e++)ve.fromBufferAttribute(this,e),ve.applyMatrix4(t),this.setXYZ(e,ve.x,ve.y,ve.z);return this}applyNormalMatrix(t){for(let e=0,n=this.count;e<n;e++)ve.fromBufferAttribute(this,e),ve.applyNormalMatrix(t),this.setXYZ(e,ve.x,ve.y,ve.z);return this}transformDirection(t){for(let e=0,n=this.count;e<n;e++)ve.fromBufferAttribute(this,e),ve.transformDirection(t),this.setXYZ(e,ve.x,ve.y,ve.z);return this}set(t,e=0){return this.array.set(t,e),this}getComponent(t,e){let n=this.array[t*this.itemSize+e];return this.normalized&&(n=Ue(n,this.array)),n}setComponent(t,e,n){return this.normalized&&(n=qt(n,this.array)),this.array[t*this.itemSize+e]=n,this}getX(t){let e=this.array[t*this.itemSize];return this.normalized&&(e=Ue(e,this.array)),e}setX(t,e){return this.normalized&&(e=qt(e,this.array)),this.array[t*this.itemSize]=e,this}getY(t){let e=this.array[t*this.itemSize+1];return this.normalized&&(e=Ue(e,this.array)),e}setY(t,e){return this.normalized&&(e=qt(e,this.array)),this.array[t*this.itemSize+1]=e,this}getZ(t){let e=this.array[t*this.itemSize+2];return this.normalized&&(e=Ue(e,this.array)),e}setZ(t,e){return this.normalized&&(e=qt(e,this.array)),this.array[t*this.itemSize+2]=e,this}getW(t){let e=this.array[t*this.itemSize+3];return this.normalized&&(e=Ue(e,this.array)),e}setW(t,e){return this.normalized&&(e=qt(e,this.array)),this.array[t*this.itemSize+3]=e,this}setXY(t,e,n){return t*=this.itemSize,this.normalized&&(e=qt(e,this.array),n=qt(n,this.array)),this.array[t+0]=e,this.array[t+1]=n,this}setXYZ(t,e,n,i){return t*=this.itemSize,this.normalized&&(e=qt(e,this.array),n=qt(n,this.array),i=qt(i,this.array)),this.array[t+0]=e,this.array[t+1]=n,this.array[t+2]=i,this}setXYZW(t,e,n,i,s){return t*=this.itemSize,this.normalized&&(e=qt(e,this.array),n=qt(n,this.array),i=qt(i,this.array),s=qt(s,this.array)),this.array[t+0]=e,this.array[t+1]=n,this.array[t+2]=i,this.array[t+3]=s,this}onUpload(t){return this.onUploadCallback=t,this}clone(){return new this.constructor(this.array,this.itemSize).copy(this)}toJSON(){const t={itemSize:this.itemSize,type:this.array.constructor.name,array:Array.from(this.array),normalized:this.normalized};return this.name!==""&&(t.name=this.name),this.usage!==ea&&(t.usage=this.usage),t}}class Zv extends le{constructor(t,e,n){super(new Int8Array(t),e,n)}}class Jv extends le{constructor(t,e,n){super(new Uint8Array(t),e,n)}}class $v extends le{constructor(t,e,n){super(new Uint8ClampedArray(t),e,n)}}class Kv extends le{constructor(t,e,n){super(new Int16Array(t),e,n)}}class Jh extends le{constructor(t,e,n){super(new Uint16Array(t),e,n)}}class Qv extends le{constructor(t,e,n){super(new Int32Array(t),e,n)}}class $h extends le{constructor(t,e,n){super(new Uint32Array(t),e,n)}}class jv extends le{constructor(t,e,n){super(new Uint16Array(t),e,n),this.isFloat16BufferAttribute=!0}getX(t){let e=As(this.array[t*this.itemSize]);return this.normalized&&(e=Ue(e,this.array)),e}setX(t,e){return this.normalized&&(e=qt(e,this.array)),this.array[t*this.itemSize]=ze(e),this}getY(t){let e=As(this.array[t*this.itemSize+1]);return this.normalized&&(e=Ue(e,this.array)),e}setY(t,e){return this.normalized&&(e=qt(e,this.array)),this.array[t*this.itemSize+1]=ze(e),this}getZ(t){let e=As(this.array[t*this.itemSize+2]);return this.normalized&&(e=Ue(e,this.array)),e}setZ(t,e){return this.normalized&&(e=qt(e,this.array)),this.array[t*this.itemSize+2]=ze(e),this}getW(t){let e=As(this.array[t*this.itemSize+3]);return this.normalized&&(e=Ue(e,this.array)),e}setW(t,e){return this.normalized&&(e=qt(e,this.array)),this.array[t*this.itemSize+3]=ze(e),this}setXY(t,e,n){return t*=this.itemSize,this.normalized&&(e=qt(e,this.array),n=qt(n,this.array)),this.array[t+0]=ze(e),this.array[t+1]=ze(n),this}setXYZ(t,e,n,i){return t*=this.itemSize,this.normalized&&(e=qt(e,this.array),n=qt(n,this.array),i=qt(i,this.array)),this.array[t+0]=ze(e),this.array[t+1]=ze(n),this.array[t+2]=ze(i),this}setXYZW(t,e,n,i,s){return t*=this.itemSize,this.normalized&&(e=qt(e,this.array),n=qt(n,this.array),i=qt(i,this.array),s=qt(s,this.array)),this.array[t+0]=ze(e),this.array[t+1]=ze(n),this.array[t+2]=ze(i),this.array[t+3]=ze(s),this}}class St extends le{constructor(t,e,n){super(new Float32Array(t),e,n)}}let af=0;
vendor: 6,588 bytes, line 1
1const en=new zt,ka=new ie,Fi=new C,qe=new Ne,gs=new Ne,be=new C;class Zt extends Dn{constructor(){super(),this.isBufferGeometry=!0,Object.defineProperty(this,"id",{value:af++}),this.uuid=$e(),this.name="",this.type="BufferGeometry",this.index=null,this.indirect=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(t){return Array.isArray(t)?this.index=new(qh(t)?$h:Jh)(t,1):this.index=t,this}setIndirect(t){return this.indirect=t,this}getIndirect(){return this.indirect}getAttribute(t){return this.attributes[t]}setAttribute(t,e){return this.attributes[t]=e,this}deleteAttribute(t){return delete this.attributes[t],this}hasAttribute(t){return this.attributes[t]!==void 0}addGroup(t,e,n=0){this.groups.push({start:t,count:e,materialIndex:n})}clearGroups(){this.groups=[]}setDrawRange(t,e){this.drawRange.start=t,this.drawRange.count=e}applyMatrix4(t){const e=this.attributes.position;e!==void 0&&(e.applyMatrix4(t),e.needsUpdate=!0);const n=this.attributes.normal;if(n!==void 0){const s=new Xt().getNormalMatrix(t);n.applyNormalMatrix(s),n.needsUpdate=!0}const i=this.attributes.tangent;return i!==void 0&&(i.transformDirection(t),i.needsUpdate=!0),this.boundingBox!==null&&this.computeBoundingBox(),this.boundingSphere!==null&&this.computeBoundingSphere(),this}applyQuaternion(t){return en.makeRotationFromQuaternion(t),this.applyMatrix4(en),this}rotateX(t){return en.makeRotationX(t),this.applyMatrix4(en),this}rotateY(t){return en.makeRotationY(t),this.applyMatrix4(en),this}rotateZ(t){return en.makeRotationZ(t),this.applyMatrix4(en),this}translate(t,e,n){return en.makeTranslation(t,e,n),this.applyMatrix4(en),this}scale(t,e,n){return en.makeScale(t,e,n),this.applyMatrix4(en),this}lookAt(t){return ka.lookAt(t),ka.updateMatrix(),this.applyMatrix4(ka.matrix),this}center(){return this.computeBoundingBox(),this.boundingBox.getCenter(Fi).negate(),this.translate(Fi.x,Fi.y,Fi.z),this}setFromPoints(t){const e=this.getAttribute("position");if(e===void 0){const n=[];for(let i=0,s=t.length;i<s;i++){const a=t[i];n.push(a.x,a.y,a.z||0)}this.setAttribute("position",new St(n,3))}else{const n=Math.min(t.length,e.count);for(let i=0;i<n;i++){const s=t[i];e.setXYZ(i,s.x,s.y,s.z||0)}t.length>e.count&&console.warn("THREE.BufferGeometry: Buffer size too small for points data. Use .dispose() and create a new geometry."),e.needsUpdate=!0}return this}computeBoundingBox(){this.boundingBox===null&&(this.boundingBox=new Ne);const t=this.attributes.position,e=this.morphAttributes.position;if(t&&t.isGLBufferAttribute){console.error("THREE.BufferGeometry.computeBoundingBox(): GLBufferAttribute requires a manual bounding box.",this),this.boundingBox.set(new C(-1/0,-1/0,-1/0),new C(1/0,1/0,1/0));return}if(t!==void 0){if(this.boundingBox.setFromBufferAttribute(t),e)for(let n=0,i=e.length;n<i;n++){const s=e[n];qe.setFromBufferAttribute(s),this.morphTargetsRelative?(be.addVectors(this.boundingBox.min,qe.min),this.boundingBox.expandByPoint(be),be.addVectors(this.boundingBox.max,qe.max),this.boundingBox.expandByPoint(be)):(this.boundingBox.expandByPoint(qe.min),this.boundingBox.expandByPoint(qe.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(){this.boundingSphere===null&&(this.boundingSphere=new Ie);const t=this.attributes.position,e=this.morphAttributes.position;if(t&&t.isGLBufferAttribute){console.error("THREE.BufferGeometry.computeBoundingSphere(): GLBufferAttribute requires a manual bounding sphere.",this),this.boundingSphere.set(new C,1/0);return}if(t){const n=this.boundingSphere.center;if(qe.setFromBufferAttribute(t),e)for(let s=0,a=e.length;s<a;s++){const o=e[s];gs.setFromBufferAttribute(o),this.morphTargetsRelative?(be.addVectors(qe.min,gs.min),qe.expandByPoint(be),be.addVectors(qe.max,gs.max),qe.expandByPoint(be)):(qe.expandByPoint(gs.min),qe.expandByPoint(gs.max))}qe.getCenter(n);let i=0;for(let s=0,a=t.count;s<a;s++)be.fromBufferAttribute(t,s),i=Math.max(i,n.distanceToSquared(be));if(e)for(let s=0,a=e.length;s<a;s++){const o=e[s],l=this.morphTargetsRelative;for(let c=0,h=o.count;c<h;c++)be.fromBufferAttribute(o,c),l&&(Fi.fromBufferAttribute(t,c),be.add(Fi)),i=Math.max(i,n.distanceToSquared(be))}this.boundingSphere.radius=Math.sqrt(i),isNaN(this.boundingSphere.radius)&&console.error('THREE.BufferGeometry.computeBoundingSphere(): Computed radius is NaN. The "position" attribute is likely to have NaN values.',this)}}computeTangents(){const t=this.index,e=this.attributes;if(t===null||e.position===void 0||e.normal===void 0||e.uv===void 0){console.error("THREE.BufferGeometry: .computeTangents() failed. Missing required attributes (index, position, normal or uv)");return}const n=e.position,i=e.normal,s=e.uv;this.hasAttribute("tangent")===!1&&this.setAttribute("tangent",new le(new Float32Array(4*n.count),4));const a=this.getAttribute("tangent"),o=[],l=[];for(let P=0;P<n.count;P++)o[P]=new C,l[P]=new C;const c=new C,h=new C,u=new C,d=new K,f=new K,m=new K,_=new C,g=new C;function p(P,b,S){c.fromBufferAttribute(n,P),h.fromBufferAttribute(n,b),u.fromBufferAttribute(n,S),d.fromBufferAttribute(s,P),f.fromBufferAttribute(s,b),m.fromBufferAttribute(s,S),h.sub(c),u.sub(c),f.sub(d),m.sub(d);const I=1/(f.x*m.y-m.x*f.y);isFinite(I)&&(_.copy(h).multiplyScalar(m.y).addScaledVector(u,-f.y).multiplyScalar(I),g.copy(u).multiplyScalar(f.x).addScaledVector(h,-m.x).multiplyScalar(I),o[P].add(_),o[b].add(_),o[S].add(_),l[P].add(g),l[b].add(g),l[S].add(g))}let y=this.groups;y.length===0&&(y=[{start:0,count:t.count}]);for(let P=0,b=y.length;P<b;++P){const S=y[P],I=S.start,B=S.count;for(let k=I,V=I+B;k<V;k+=3)p(t.getX(k+0),t.getX(k+1),t.getX(k+2))}const v=new C,x=new C,A=new C,T=new C;function R(P){A.fromBufferAttribute(i,P),T.copy(A);const b=o[P];v.copy(b),v.sub(A.multiplyScalar(A.dot(b))).normalize(),x.crossVectors(T,b);const I=x.dot(l[P])<0?-1:1;a.setXYZW(P,v.x,v.y,v.z,I)}for(let P=0,b=y.length;P<b;++P){const S=y[P],I=S.start,B=S.count;for(let k=I,V=I+B;k<V;k+=3)R(t.getX(k+0)),R(t.getX(k+1)),R(t.getX(k+2))}}computeVertexNormals(){const t=this.index,e=this.getAttribute("position");if(e!==void 0){let n=this.getAttribute("normal");if(n===void 0)n=new le(new Float32Array(e.count*3),3),this.setAttribute("normal",n
vendor: 4,485 bytes, line 1
1);else for(let d=0,f=n.count;d<f;d++)n.setXYZ(d,0,0,0);const i=new C,s=new C,a=new C,o=new C,l=new C,c=new C,h=new C,u=new C;if(t)for(let d=0,f=t.count;d<f;d+=3){const m=t.getX(d+0),_=t.getX(d+1),g=t.getX(d+2);i.fromBufferAttribute(e,m),s.fromBufferAttribute(e,_),a.fromBufferAttribute(e,g),h.subVectors(a,s),u.subVectors(i,s),h.cross(u),o.fromBufferAttribute(n,m),l.fromBufferAttribute(n,_),c.fromBufferAttribute(n,g),o.add(h),l.add(h),c.add(h),n.setXYZ(m,o.x,o.y,o.z),n.setXYZ(_,l.x,l.y,l.z),n.setXYZ(g,c.x,c.y,c.z)}else for(let d=0,f=e.count;d<f;d+=3)i.fromBufferAttribute(e,d+0),s.fromBufferAttribute(e,d+1),a.fromBufferAttribute(e,d+2),h.subVectors(a,s),u.subVectors(i,s),h.cross(u),n.setXYZ(d+0,h.x,h.y,h.z),n.setXYZ(d+1,h.x,h.y,h.z),n.setXYZ(d+2,h.x,h.y,h.z);this.normalizeNormals(),n.needsUpdate=!0}}normalizeNormals(){const t=this.attributes.normal;for(let e=0,n=t.count;e<n;e++)be.fromBufferAttribute(t,e),be.normalize(),t.setXYZ(e,be.x,be.y,be.z)}toNonIndexed(){function t(o,l){const c=o.array,h=o.itemSize,u=o.normalized,d=new c.constructor(l.length*h);let f=0,m=0;for(let _=0,g=l.length;_<g;_++){o.isInterleavedBufferAttribute?f=l[_]*o.data.stride+o.offset:f=l[_]*h;for(let p=0;p<h;p++)d[m++]=c[f++]}return new le(d,h,u)}if(this.index===null)return console.warn("THREE.BufferGeometry.toNonIndexed(): BufferGeometry is already non-indexed."),this;const e=new Zt,n=this.index.array,i=this.attributes;for(const o in i){const l=i[o],c=t(l,n);e.setAttribute(o,c)}const s=this.morphAttributes;for(const o in s){const l=[],c=s[o];for(let h=0,u=c.length;h<u;h++){const d=c[h],f=t(d,n);l.push(f)}e.morphAttributes[o]=l}e.morphTargetsRelative=this.morphTargetsRelative;const a=this.groups;for(let o=0,l=a.length;o<l;o++){const c=a[o];e.addGroup(c.start,c.count,c.materialIndex)}return e}toJSON(){const t={metadata:{version:4.7,type:"BufferGeometry",generator:"BufferGeometry.toJSON"}};if(t.uuid=this.uuid,t.type=this.type,this.name!==""&&(t.name=this.name),Object.keys(this.userData).length>0&&(t.userData=this.userData),this.parameters!==void 0){const l=this.parameters;for(const c in l)l[c]!==void 0&&(t[c]=l[c]);return t}t.data={attributes:{}};const e=this.index;e!==null&&(t.data.index={type:e.array.constructor.name,array:Array.prototype.slice.call(e.array)});const n=this.attributes;for(const l in n){const c=n[l];t.data.attributes[l]=c.toJSON(t.data)}const i={};let s=!1;for(const l in this.morphAttributes){const c=this.morphAttributes[l],h=[];for(let u=0,d=c.length;u<d;u++){const f=c[u];h.push(f.toJSON(t.data))}h.length>0&&(i[l]=h,s=!0)}s&&(t.data.morphAttributes=i,t.data.morphTargetsRelative=this.morphTargetsRelative);const a=this.groups;a.length>0&&(t.data.groups=JSON.parse(JSON.stringify(a)));const o=this.boundingSphere;return o!==null&&(t.data.boundingSphere=o.toJSON()),t}clone(){return new this.constructor().copy(this)}copy(t){this.index=null,this.attributes={},this.morphAttributes={},this.groups=[],this.boundingBox=null,this.boundingSphere=null;const e={};this.name=t.name;const n=t.index;n!==null&&this.setIndex(n.clone());const i=t.attributes;for(const c in i){const h=i[c];this.setAttribute(c,h.clone(e))}const s=t.morphAttributes;for(const c in s){const h=[],u=s[c];for(let d=0,f=u.length;d<f;d++)h.push(u[d].clone(e));this.morphAttributes[c]=h}this.morphTargetsRelative=t.morphTargetsRelative;const a=t.groups;for(let c=0,h=a.length;c<h;c++){const u=a[c];this.addGroup(u.start,u.count,u.materialIndex)}const o=t.boundingBox;o!==null&&(this.boundingBox=o.clone());const l=t.boundingSphere;return l!==null&&(this.boundingSphere=l.clone()),this.drawRange.start=t.drawRange.start,this.drawRange.count=t.drawRange.count,this.userData=t.userData,this}dispose(){this.dispatchEvent({type:"dispose"})}}const gc=new zt,jn=new Xs,rr=new Ie,_c=new C,ar=new C,or=new C,lr=new C,Va=new C,cr=new C,xc=new C,hr=new C;class ye extends ie{constructor(t=new Zt,e=new Si){super(),this.isMesh=!0,this.type="Mesh",this.geometry=t,this.material=e,this.morphTargetDictionary=void 0,this.morphTargetInfluences=void 0,this.count=1,this.updateMorphTargets()}copy(t,e){return super.copy(t,e),t.morphTargetInfluences!==void 0&&(this.morphTargetInfluences=t.morphTargetInfluences.slice()),t.morphTargetDictionary!==void 0&&(this.morphTargetDictionary=Object.assign({},t.morphTargetDictionary)),this.material=Array.isArray(t.material)?t.material.slice():t.material,this.geometry=t.geometry,this}updateMorphTargets(){const e=this.geometry.morphAttributes,n=Object.keys(e);if(n.length>
vendor: 8,950 bytes, lines 1-5
10){const i=e[n[0]];if(i!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let s=0,a=i.length;s<a;s++){const o=i[s].name||String(s);this.morphTargetInfluences.push(0),this.morphTargetDictionary[o]=s}}}}getVertexPosition(t,e){const n=this.geometry,i=n.attributes.position,s=n.morphAttributes.position,a=n.morphTargetsRelative;e.fromBufferAttribute(i,t);const o=this.morphTargetInfluences;if(s&&o){cr.set(0,0,0);for(let l=0,c=s.length;l<c;l++){const h=o[l],u=s[l];h!==0&&(Va.fromBufferAttribute(u,t),a?cr.addScaledVector(Va,h):cr.addScaledVector(Va.sub(e),h))}e.add(cr)}return e}raycast(t,e){const n=this.geometry,i=this.material,s=this.matrixWorld;i!==void 0&&(n.boundingSphere===null&&n.computeBoundingSphere(),rr.copy(n.boundingSphere),rr.applyMatrix4(s),jn.copy(t.ray).recast(t.near),!(rr.containsPoint(jn.origin)===!1&&(jn.intersectSphere(rr,_c)===null||jn.origin.distanceToSquared(_c)>(t.far-t.near)**2))&&(gc.copy(s).invert(),jn.copy(t.ray).applyMatrix4(gc),!(n.boundingBox!==null&&jn.intersectsBox(n.boundingBox)===!1)&&this._computeIntersections(t,e,jn)))}_computeIntersections(t,e,n){let i;const s=this.geometry,a=this.material,o=s.index,l=s.attributes.position,c=s.attributes.uv,h=s.attributes.uv1,u=s.attributes.normal,d=s.groups,f=s.drawRange;if(o!==null)if(Array.isArray(a))for(let m=0,_=d.length;m<_;m++){const g=d[m],p=a[g.materialIndex],y=Math.max(g.start,f.start),v=Math.min(o.count,Math.min(g.start+g.count,f.start+f.count));for(let x=y,A=v;x<A;x+=3){const T=o.getX(x),R=o.getX(x+1),P=o.getX(x+2);i=ur(this,p,t,n,c,h,u,T,R,P),i&&(i.faceIndex=Math.floor(x/3),i.face.materialIndex=g.materialIndex,e.push(i))}}else{const m=Math.max(0,f.start),_=Math.min(o.count,f.start+f.count);for(let g=m,p=_;g<p;g+=3){const y=o.getX(g),v=o.getX(g+1),x=o.getX(g+2);i=ur(this,a,t,n,c,h,u,y,v,x),i&&(i.faceIndex=Math.floor(g/3),e.push(i))}}else if(l!==void 0)if(Array.isArray(a))for(let m=0,_=d.length;m<_;m++){const g=d[m],p=a[g.materialIndex],y=Math.max(g.start,f.start),v=Math.min(l.count,Math.min(g.start+g.count,f.start+f.count));for(let x=y,A=v;x<A;x+=3){const T=x,R=x+1,P=x+2;i=ur(this,p,t,n,c,h,u,T,R,P),i&&(i.faceIndex=Math.floor(x/3),i.face.materialIndex=g.materialIndex,e.push(i))}}else{const m=Math.max(0,f.start),_=Math.min(l.count,f.start+f.count);for(let g=m,p=_;g<p;g+=3){const y=g,v=g+1,x=g+2;i=ur(this,a,t,n,c,h,u,y,v,x),i&&(i.faceIndex=Math.floor(g/3),e.push(i))}}}}function of(r,t,e,n,i,s,a,o){let l;if(t.side===Ve?l=n.intersectTriangle(a,s,i,!0,o):l=n.intersectTriangle(i,s,a,t.side===Xn,o),l===null)return null;hr.copy(o),hr.applyMatrix4(r.matrixWorld);const c=e.ray.origin.distanceTo(hr);return c<e.near||c>e.far?null:{distance:c,point:hr.clone(),object:r}}function ur(r,t,e,n,i,s,a,o,l,c){r.getVertexPosition(o,ar),r.getVertexPosition(l,or),r.getVertexPosition(c,lr);const h=of(r,t,e,n,ar,or,lr,xc);if(h){const u=new C;Ze.getBarycoord(xc,ar,or,lr,u),i&&(h.uv=Ze.getInterpolatedAttribute(i,o,l,c,u,new K)),s&&(h.uv1=Ze.getInterpolatedAttribute(s,o,l,c,u,new K)),a&&(h.normal=Ze.getInterpolatedAttribute(a,o,l,c,u,new C),h.normal.dot(n.direction)>0&&h.normal.multiplyScalar(-1));const d={a:o,b:l,c,normal:new C,materialIndex:0};Ze.getNormal(ar,or,lr,d.normal),h.face=d,h.barycoord=u}return h}class ls extends Zt{constructor(t=1,e=1,n=1,i=1,s=1,a=1){super(),this.type="BoxGeometry",this.parameters={width:t,height:e,depth:n,widthSegments:i,heightSegments:s,depthSegments:a};const o=this;i=Math.floor(i),s=Math.floor(s),a=Math.floor(a);const l=[],c=[],h=[],u=[];let d=0,f=0;m("z","y","x",-1,-1,n,e,t,a,s,0),m("z","y","x",1,-1,n,e,-t,a,s,1),m("x","z","y",1,1,t,n,e,i,a,2),m("x","z","y",1,-1,t,n,-e,i,a,3),m("x","y","z",1,-1,t,e,n,i,s,4),m("x","y","z",-1,-1,t,e,-n,i,s,5),this.setIndex(l),this.setAttribute("position",new St(c,3)),this.setAttribute("normal",new St(h,3)),this.setAttribute("uv",new St(u,2));function m(_,g,p,y,v,x,A,T,R,P,b){const S=x/R,I=A/P,B=x/2,k=A/2,V=T/2,Z=R+1,W=P+1;let nt=0,G=0;const dt=new C;for(let _t=0;_t<W;_t++){const bt=_t*I-k;for(let Vt=0;Vt<Z;Vt++){const Qt=Vt*S-B;dt[_]=Qt*y,dt[g]=bt*v,dt[p]=V,c.push(dt.x,dt.y,dt.z),dt[_]=0,dt[g]=0,dt[p]=T>0?1:-1,h.push(dt.x,dt.y,dt.z),u.push(Vt/R),u.push(1-_t/P),nt+=1}}for(let _t=0;_t<P;_t++)for(let bt=0;bt<R;bt++){const Vt=d+bt+Z*_t,Qt=d+bt+Z*(_t+1),jt=d+(bt+1)+Z*(_t+1),q=d+(bt+1)+Z*_t;l.push(Vt,Qt,q),l.push(Qt,jt,q),G+=6}o.addGroup(f,G,b),f+=G,d+=nt}}copy(t){return super.copy(t),this.parameters=Object.assign({},t.parameters),this}static fromJSON(t){return new ls(t.width,t.height,t.depth,t.widthSegments,t.heightSegments,t.depthSegments)}}function rs(r){const t={};for(const e in r){t[e]={};for(const n in r[e]){const i=r[e][n];i&&(i.isColor||i.isMatrix3||i.isMatrix4||i.isVector2||i.isVector3||i.isVector4||i.isTexture||i.isQuaternion)?i.isRenderTargetTexture?(console.warn("UniformsUtils: Textures of render targets cannot be cloned via cloneUniforms() or mergeUniforms()."),t[e][n]=null):t[e][n]=i.clone():Array.isArray(i)?t[e][n]=i.slice():t[e][n]=i}}return t}function De(r){const t={};for(let e=0;e<r.length;e++){const n=rs(r[e]);for(const i in n)t[i]=n[i]}return t}function lf(r){const t=[];for(let e=0;e<r.length;e++)t.push(r[e].clone());return t}function Kh(r){const t=r.getRenderTarget();return t===null?r.outputColorSpace:t.isXRRenderTarget===!0?t.texture.colorSpace:Kt.workingColorSpace}const cf={clone:rs,merge:De};var hf=`void main() {
2	gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );
3}`,uf=`void main() {
4	gl_FragColor = vec4( 1.0, 0.0, 0.0, 1.0 );
5}`;class gn extends Fe{constructor(t){super(),this.isShaderMaterial=!0,this.type="ShaderMaterial",this.defines={},this.uniforms={},this.uniformsGroups=[],this.vertexShader=hf,this.fragmentShader=uf,this.linewidth=1,this.wireframe=!1,this.wireframeLinewidth=1,this.fog=!1,this.lights=!1,this.clipping=!1,this.forceSinglePass=!0,this.extensions={clipCullDistance:!1,multiDraw:!1},this.defaultAttributeValues={color:[1,1,1],uv:[0,0],uv1:[0,0]},this.index0AttributeName=void 0,this.uniformsNeedUpdate=!1,this.glslVersion=null,t!==void 0&&this.setValues(t)}copy(t){return super.copy(t),this.fragmentShader=t.fragmentShader,this.vertexShader=t.vertexShader,this.uniforms=rs(t.uniforms),this.uniformsGroups=lf(t.uniformsGroups),this.defines=Object.assign({},t.defines),this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.fog=t.fog,this.lights=t.lights,this.clipping=t.clipping,this.extensions=Object.assign({},t.extensions),this.glslVersion=t.glslVersion,this}toJSON(t){const e=super.toJSON(t);e.glslVersion=this.glslVersion,e.uniforms={};for(const i in this.uniforms){const a=this.uniforms[i].value;a&&a.isTexture?e.uniforms[i]={type:"t",value:a.toJSON(t).uuid}:a&&a.isColor?e.uniforms[i]={type:"c",value:a.getHex()}:a&&a.isVector2?e.uniforms[i]={type:"v2",value:a.toArray()}:a&&a.isVector3?e.uniforms[i]={type:"v3",value:a.toArray()}:a&&a.isVector4?e.uniforms[i]={type:"v4",value:a.toArray()}:a&&a.isMatrix3?e.uniforms[i]={type:"m3",value:a.toArray()}:a&&a.isMatrix4?e.uniforms[i]={type:"m4",value:a.toArray()}:e.uniforms[i]={value:a}}Object.keys(this.defines).length>0&&(e.defines=this.defines),e.vertexShader=this.vertexShader,e.fragmentShader=this.fragmentShader,e.lights=this.lights,e.clipping=this.clipping;const n={};for(const i in this.extensions)this.extensions[i]===!0&&(n[i]=!0);return Object.keys(n).length>0&&(e.extensions=n),e}}class gl extends ie{constructor(){super(),this.isCamera=!0,this.type="Camera",this.matrixWorldInverse=new zt,this.projectionMatrix=new zt,this.projectionMatrixInverse=new zt,this.coordinateSystem=nn,this._reversedDepth=!1}get reversedDepth(){return this._reversedDepth}copy(t,e){return super.copy(t,e),this.matrixWorldInverse.copy(t.matrixWorldInverse),this.projectionMatrix.copy(t.projectionMatrix),this.projectionMatrixInverse.copy(t.projectionMatrixInverse),this.coordinateSystem=t.coordinateSystem,this}getWorldDirection(t){return super.getWorldDirection(t).negate()}updateMatrixWorld(t){super.updateMatrixWorld(t),this.matrixWorldInverse.copy(this.matrixWorld).invert()}updateWorldMatrix(t,e){super.updateWorldMatrix(t,e),this.matrixWorldInverse.copy(this.matrixWorld).invert()}clone(){return new this.constructor().copy(this)}}const kn=new C,vc=new K,yc=new K;class Ce extends gl{constructor(t=50,e=1,n=.1,i=2e3){super(),this.isPerspectiveCamera=!0,this.type="PerspectiveCamera",this.fov=t,this.zoom=1,this.near=n,this.far=i,this.focus=10,this.aspect=e,this.view=null,this.filmGauge=35,this.filmOffset=0,this.updateProjectionMatrix()}copy(t,e){return super.copy(t,e),this.fov=t.fov,this.zoom=t.zoom,this.near=t.near,this.far=t.far,this.focus=t.focus,this.aspect=t.aspect,this.view=t.view===null?null:Object.assign({},t.view),this.filmGauge=t.filmGauge,this.filmOffset=t.filmOffset,this}setFocalLength(t){const e=.5*this.getFilmHeight()/t;this.fov=ss*2*Math.atan(e),this.updateProjectionMatrix()}getFocalLength(){const t=Math.tan(_i*.5*this.fov);return .5*this.getFilmHeight()/t}
vendor: 4,175 bytes, line 5
5getEffectiveFOV(){return ss*2*Math.atan(Math.tan(_i*.5*this.fov)/this.zoom)}getFilmWidth(){return this.filmGauge*Math.min(this.aspect,1)}getFilmHeight(){return this.filmGauge/Math.max(this.aspect,1)}getViewBounds(t,e,n){kn.set(-1,-1,.5).applyMatrix4(this.projectionMatrixInverse),e.set(kn.x,kn.y).multiplyScalar(-t/kn.z),kn.set(1,1,.5).applyMatrix4(this.projectionMatrixInverse),n.set(kn.x,kn.y).multiplyScalar(-t/kn.z)}getViewSize(t,e){return this.getViewBounds(t,vc,yc),e.subVectors(yc,vc)}setViewOffset(t,e,n,i,s,a){this.aspect=t/e,this.view===null&&(this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1}),this.view.enabled=!0,this.view.fullWidth=t,this.view.fullHeight=e,this.view.offsetX=n,this.view.offsetY=i,this.view.width=s,this.view.height=a,this.updateProjectionMatrix()}clearViewOffset(){this.view!==null&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){const t=this.near;let e=t*Math.tan(_i*.5*this.fov)/this.zoom,n=2*e,i=this.aspect*n,s=-.5*i;const a=this.view;if(this.view!==null&&this.view.enabled){const l=a.fullWidth,c=a.fullHeight;s+=a.offsetX*i/l,e-=a.offsetY*n/c,i*=a.width/l,n*=a.height/c}const o=this.filmOffset;o!==0&&(s+=t*o/this.getFilmWidth()),this.projectionMatrix.makePerspective(s,s+i,e,e-n,t,this.far,this.coordinateSystem,this.reversedDepth),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(t){const e=super.toJSON(t);return e.object.fov=this.fov,e.object.zoom=this.zoom,e.object.near=this.near,e.object.far=this.far,e.object.focus=this.focus,e.object.aspect=this.aspect,this.view!==null&&(e.object.view=Object.assign({},this.view)),e.object.filmGauge=this.filmGauge,e.object.filmOffset=this.filmOffset,e}}const Oi=-90,Bi=1;class df extends ie{constructor(t,e,n){super(),this.type="CubeCamera",this.renderTarget=n,this.coordinateSystem=null,this.activeMipmapLevel=0;const i=new Ce(Oi,Bi,t,e);i.layers=this.layers,this.add(i);const s=new Ce(Oi,Bi,t,e);s.layers=this.layers,this.add(s);const a=new Ce(Oi,Bi,t,e);a.layers=this.layers,this.add(a);const o=new Ce(Oi,Bi,t,e);o.layers=this.layers,this.add(o);const l=new Ce(Oi,Bi,t,e);l.layers=this.layers,this.add(l);const c=new Ce(Oi,Bi,t,e);c.layers=this.layers,this.add(c)}updateCoordinateSystem(){const t=this.coordinateSystem,e=this.children.concat(),[n,i,s,a,o,l]=e;for(const c of e)this.remove(c);if(t===nn)n.up.set(0,1,0),n.lookAt(1,0,0),i.up.set(0,1,0),i.lookAt(-1,0,0),s.up.set(0,0,-1),s.lookAt(0,1,0),a.up.set(0,0,1),a.lookAt(0,-1,0),o.up.set(0,1,0),o.lookAt(0,0,1),l.up.set(0,1,0),l.lookAt(0,0,-1);else if(t===Os)n.up.set(0,-1,0),n.lookAt(-1,0,0),i.up.set(0,-1,0),i.lookAt(1,0,0),s.up.set(0,0,1),s.lookAt(0,1,0),a.up.set(0,0,-1),a.lookAt(0,-1,0),o.up.set(0,-1,0),o.lookAt(0,0,1),l.up.set(0,-1,0),l.lookAt(0,0,-1);else throw new Error("THREE.CubeCamera.updateCoordinateSystem(): Invalid coordinate system: "+t);for(const c of e)this.add(c),c.updateMatrixWorld()}update(t,e){this.parent===null&&this.updateMatrixWorld();const{renderTarget:n,activeMipmapLevel:i}=this;this.coordinateSystem!==t.coordinateSystem&&(this.coordinateSystem=t.coordinateSystem,this.updateCoordinateSystem());const[s,a,o,l,c,h]=this.children,u=t.getRenderTarget(),d=t.getActiveCubeFace(),f=t.getActiveMipmapLevel(),m=t.xr.enabled;t.xr.enabled=!1;const _=n.texture.generateMipmaps;n.texture.generateMipmaps=!1,t.setRenderTarget(n,0,i),t.render(e,s),t.setRenderTarget(n,1,i),t.render(e,a),t.setRenderTarget(n,2,i),t.render(e,o),t.setRenderTarget(n,3,i),t.render(e,l),t.setRenderTarget(n,4,i),t.render(e,c),n.texture.generateMipmaps=_,t.setRenderTarget(n,5,i),t.render(e,h),t.setRenderTarget(u,d,f),t.xr.enabled=m,n.texture.needsPMREMUpdate=!0}}class ua extends xe{constructor(t=[],e=qn,n,i,s,a,o,l,c,h){super(t,e,n,i,s,a,o,l,c,h),this.isCubeTexture=!0,this.flipY=!1}get images(){return this.image}set images(t){this.image=t}}class ff extends Ln{constructor(t=1,e={}){super(t,t,e),this.isWebGLCubeRenderTarget=!0;const n={width:t,height:t,depth:1},i=[n,n,n,n,n,n];this.texture=new ua(i),this._setTextureOptions(e),this.texture.isRenderTargetTexture=!0}fromEquirectangularTexture(t,e){this.texture.type=e.type,this.texture.colorSpace
vendor: 18,200 bytes, lines 5-40
5=e.colorSpace,this.texture.generateMipmaps=e.generateMipmaps,this.texture.minFilter=e.minFilter,this.texture.magFilter=e.magFilter;const n={uniforms:{tEquirect:{value:null}},vertexShader:`
6
7				varying vec3 vWorldDirection;
8
9				vec3 transformDirection( in vec3 dir, in mat4 matrix ) {
10
11					return normalize( ( matrix * vec4( dir, 0.0 ) ).xyz );
12
13				}
14
15				void main() {
16
17					vWorldDirection = transformDirection( position, modelMatrix );
18
19					#include <begin_vertex>
20					#include <project_vertex>
21
22				}
23			`,fragmentShader:`
24
25				uniform sampler2D tEquirect;
26
27				varying vec3 vWorldDirection;
28
29				#include <common>
30
31				void main() {
32
33					vec3 direction = normalize( vWorldDirection );
34
35					vec2 sampleUV = equirectUv( direction );
36
37					gl_FragColor = texture2D( tEquirect, sampleUV );
38
39				}
40			`},i=new ls(5,5,5),s=new gn({name:"CubemapFromEquirect",uniforms:rs(n.uniforms),vertexShader:n.vertexShader,fragmentShader:n.fragmentShader,side:Ve,blending:Gn});s.uniforms.tEquirect.value=e;const a=new ye(i,s),o=e.minFilter;return e.minFilter===Cn&&(e.minFilter=Ee),new df(1,10,this).update(t,a),e.minFilter=o,a.geometry.dispose(),a.material.dispose(),this}clear(t,e=!0,n=!0,i=!0){const s=t.getRenderTarget();for(let a=0;a<6;a++)t.setRenderTarget(this,a),t.clear(e,n,i);t.setRenderTarget(s)}}class ws extends ie{constructor(){super(),this.isGroup=!0,this.type="Group"}}const pf={type:"move"};class Ha{constructor(){this._targetRay=null,this._grip=null,this._hand=null}getHandSpace(){return this._hand===null&&(this._hand=new ws,this._hand.matrixAutoUpdate=!1,this._hand.visible=!1,this._hand.joints={},this._hand.inputState={pinching:!1}),this._hand}getTargetRaySpace(){return this._targetRay===null&&(this._targetRay=new ws,this._targetRay.matrixAutoUpdate=!1,this._targetRay.visible=!1,this._targetRay.hasLinearVelocity=!1,this._targetRay.linearVelocity=new C,this._targetRay.hasAngularVelocity=!1,this._targetRay.angularVelocity=new C),this._targetRay}getGripSpace(){return this._grip===null&&(this._grip=new ws,this._grip.matrixAutoUpdate=!1,this._grip.visible=!1,this._grip.hasLinearVelocity=!1,this._grip.linearVelocity=new C,this._grip.hasAngularVelocity=!1,this._grip.angularVelocity=new C),this._grip}dispatchEvent(t){return this._targetRay!==null&&this._targetRay.dispatchEvent(t),this._grip!==null&&this._grip.dispatchEvent(t),this._hand!==null&&this._hand.dispatchEvent(t),this}connect(t){if(t&&t.hand){const e=this._hand;if(e)for(const n of t.hand.values())this._getHandJoint(e,n)}return this.dispatchEvent({type:"connected",data:t}),this}disconnect(t){return this.dispatchEvent({type:"disconnected",data:t}),this._targetRay!==null&&(this._targetRay.visible=!1),this._grip!==null&&(this._grip.visible=!1),this._hand!==null&&(this._hand.visible=!1),this}update(t,e,n){let i=null,s=null,a=null;const o=this._targetRay,l=this._grip,c=this._hand;if(t&&e.session.visibilityState!=="visible-blurred"){if(c&&t.hand){a=!0;for(const _ of t.hand.values()){const g=e.getJointPose(_,n),p=this._getHandJoint(c,_);g!==null&&(p.matrix.fromArray(g.transform.matrix),p.matrix.decompose(p.position,p.rotation,p.scale),p.matrixWorldNeedsUpdate=!0,p.jointRadius=g.radius),p.visible=g!==null}const h=c.joints["index-finger-tip"],u=c.joints["thumb-tip"],d=h.position.distanceTo(u.position),f=.02,m=.005;c.inputState.pinching&&d>f+m?(c.inputState.pinching=!1,this.dispatchEvent({type:"pinchend",handedness:t.handedness,target:this})):!c.inputState.pinching&&d<=f-m&&(c.inputState.pinching=!0,this.dispatchEvent({type:"pinchstart",handedness:t.handedness,target:this}))}else l!==null&&t.gripSpace&&(s=e.getPose(t.gripSpace,n),s!==null&&(l.matrix.fromArray(s.transform.matrix),l.matrix.decompose(l.position,l.rotation,l.scale),l.matrixWorldNeedsUpdate=!0,s.linearVelocity?(l.hasLinearVelocity=!0,l.linearVelocity.copy(s.linearVelocity)):l.hasLinearVelocity=!1,s.angularVelocity?(l.hasAngularVelocity=!0,l.angularVelocity.copy(s.angularVelocity)):l.hasAngularVelocity=!1));o!==null&&(i=e.getPose(t.targetRaySpace,n),i===null&&s!==null&&(i=s),i!==null&&(o.matrix.fromArray(i.transform.matrix),o.matrix.decompose(o.position,o.rotation,o.scale),o.matrixWorldNeedsUpdate=!0,i.linearVelocity?(o.hasLinearVelocity=!0,o.linearVelocity.copy(i.linearVelocity)):o.hasLinearVelocity=!1,i.angularVelocity?(o.hasAngularVelocity=!0,o.angularVelocity.copy(i.angularVelocity)):o.hasAngularVelocity=!1,this.dispatchEvent(pf)))}return o!==null&&(o.visible=i!==null),l!==null&&(l.visible=s!==null),c!==null&&(c.visible=a!==null),this}_getHandJoint(t,e){if(t.joints[e.jointName]===void 0){const n=new ws;n.matrixAutoUpdate=!1,n.visible=!1,t.joints[e.jointName]=n,t.add(n)}return t.joints[e.jointName]}}class _l{constructor(t,e=25e-5){this.isFogExp2=!0,this.name="",this.color=new vt(t),this.density=e}clone(){return new _l(this.color,this.density)}toJSON(){return{type:"FogExp2",name:this.name,color:this.color.getHex(),density:this.density}}}class xl{constructor(t,e=1,n=1e3){this.isFog=!0,this.name="",this.color=new vt(t),this.near=e,this.far=n}clone(){return new xl(this.color,this.near,this.far)}toJSON(){return{type:"Fog",name:this.name,color:this.color.getHex(),near:this.near,far:this.far}}}class mf extends ie{constructor(){super(),this.isScene=!0,this.type="Scene",this.background=null,this.environment=null,this.fog=null,this.backgroundBlurriness=0,this.backgroundIntensity=1,this.backgroundRotation=new sn,this.environmentIntensity=1,this.environmentRotation=new sn,this.overrideMaterial=null,typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}copy(t,e){return super.copy(t,e),t.background!==null&&(this.background=t.background.clone()),t.environment!==null&&(this.environment=t.environment.clone()),t.fog!==null&&(this.fog=t.fog.clone()),this.backgroundBlurriness=t.backgroundBlurriness,this.backgroundIntensity=t.backgroundIntensity,this.backgroundRotation.copy(t.backgroundRotation),this.environmentIntensity=t.environmentIntensity,this.environmentRotation.copy(t.environmentRotation),t.overrideMaterial!==null&&(this.overrideMaterial=t.overrideMaterial.clone()),this.matrixAutoUpdate=t.matrixAutoUpdate,this}toJSON(t){const e=super.toJSON(t);return this.fog!==null&&(e.object.fog=this.fog.toJSON()),this.backgroundBlurriness>0&&(e.object.backgroundBlurriness=this.backgroundBlurriness),this.backgroundIntensity!==1&&(e.object.backgroundIntensity=this.backgroundIntensity),e.object.backgroundRotation=this.backgroundRotation.toArray(),this.environmentIntensity!==1&&(e.object.environmentIntensity=this.environmentIntensity),e.object.environmentRotation=this.environmentRotation.toArray(),e}}class vl{constructor(t,e){this.isInterleavedBuffer=!0,this.array=t,this.stride=e,this.count=t!==void 0?t.length/e:0,this.usage=ea,this.updateRanges=[],this.version=0,this.uuid=$e()}onUploadCallback(){}set needsUpdate(t){t===!0&&this.version++}setUsage(t){return this.usage=t,this}addUpdateRange(t,e){this.updateRanges.push({start:t,count:e})}clearUpdateRanges(){this.updateRanges.length=0}copy(t){return this.array=new t.array.constructor(t.array),this.count=t.count,this.stride=t.stride,this.usage=t.usage,this}copyAt(t,e,n){t*=this.stride,n*=e.stride;for(let i=0,s=this.stride;i<s;i++)this.array[t+i]=e.array[n+i];return this}set(t,e=0){return this.array.set(t,e),this}clone(t){t.arrayBuffers===void 0&&(t.arrayBuffers={}),this.array.buffer._uuid===void 0&&(this.array.buffer._uuid=$e()),t.arrayBuffers[this.array.buffer._uuid]===void 0&&(t.arrayBuffers[this.array.buffer._uuid]=this.array.slice(0).buffer);const e=new this.array.constructor(t.arrayBuffers[this.array.buffer._uuid]),n=new this.constructor(e,this.stride);return n.setUsage(this.usage),n}onUpload(t){return this.onUploadCallback=t,this}toJSON(t){return t.arrayBuffers===void 0&&(t.arrayBuffers={}),this.array.buffer._uuid===void 0&&(this.array.buffer._uuid=$e()),t.arrayBuffers[this.array.buffer._uuid]===void 0&&(t.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}}}const Le=new C;class as{constructor(t,e,n,i=!1){this.isInterleavedBufferAttribute=!0,this.name="",this.data=t,this.itemSize=e,this.offset=n,this.normalized=i}get count(){return this.data.count}get array(){return this.data.array}set needsUpdate(t){this.data.needsUpdate=t}applyMatrix4(t){for(let e=0,n=this.data.count;e<n;e++)Le.fromBufferAttribute(this,e),Le.applyMatrix4(t),this.setXYZ(e,Le.x,Le.y,Le.z);return this}applyNormalMatrix(t){for(let e=0,n=this.count;e<n;e++)Le.fromBufferAttribute(this,e),Le.applyNormalMatrix(t),this.setXYZ(e,Le.x,Le.y,Le.z);return this}transformDirection(t){for(let e=0,n=this.count;e<n;e++)Le.fromBufferAttribute(this,e),Le.transformDirection(t),this.setXYZ(e,Le.x,Le.y,Le.z);return this}getComponent(t,e){let n=this.array[t*this.data.stride+this.offset+e];return this.normalized&&(n=Ue(n,this.array)),n}setComponent(t,e,n){return this.normalized&&(n=qt(n,this.array)),this.data.array[t*this.data.stride+this.offset+e]=n,this}setX(t,e){return this.normalized&&(e=qt(e,this.array)),this.data.array[t*this.data.stride+this.offset]=e,this}setY(t,e){return this.normalized&&(e=qt(e,this.array)),this.data.array[t*this.data.stride+this.offset+1]=e,this}setZ(t,e){return this.normalized&&(e=qt(e,this.array)),this.data.array[t*this.data.stride+this.offset+2]=e,this}setW(t,e){return this.normalized&&(e=qt(e,this.array)),this.data.array[t*this.data.stride+this.offset+3]=e,this}getX(t){let e=this.data.array[t*this.data.stride+this.offset];return this.normalized&&(e=Ue(e,this.array)),e}getY(t){let e=this.data.array[t*this.data.stride+this.offset+1];return this.normalized&&(e=Ue(e,this.array)),e}getZ(t){let e=this.data.array[t*this.data.stride+this.offset+2];return this.normalized&&(e=Ue(e,this.array)),e}getW(t){let e=this.data.array[t*this.data.stride+this.offset+3];return this.normalized&&(e=Ue(e,this.array)),e}setXY(t,e,n){return t=t*this.data.stride+this.offset,this.normalized&&(e=qt(e,this.array),n=qt(n,this.array)),this.data.array[t+0]=e,this.data.array[t+1]=n,this}setXYZ(t,e,n,i){return t=t*this.data.stride+this.offset,this.normalized&&(e=qt(e,this.array),n=qt(n,this.array),i=qt(i,this.array)),this.data.array[t+0]=e,this.data.array[t+1]=n,this.data.array[t+2]=i,this}setXYZW(t,e,n,i,s){return t=t*this.data.stride+this.offset,this.normalized&&(e=qt(e,this.array),n=qt(n,this.array),i=qt(i,this.array),s=qt(s,this.array)),this.data.array[t+0]=e,this.data.array[t+1]=n,this.data.array[t+2]=i,this.data.array[t+3]=s,this}clone(t){if(t===void 0){console.log("THREE.InterleavedBufferAttribute.clone(): Cloning an interleaved buffer attribute will de-interleave buffer data.");const e=[];for(let n=0;n<this.count;n++){const i=n*this.data.stride+this.offset;for(let s=0;s<this.itemSize;s++)e.push(this.data.array[i+s])}return new le(new this.array.constructor(e),this.itemSize,this.normalized)}else return t.interleavedBuffers===void 0&&(t.interleavedBuffers={}),t.interleavedBuffers[this.data.uuid]===void 0&&(t.interleavedBuffers[this.data.uuid]=this.data.clone(t)),new as(t.interleavedBuffers[this.data.uuid],this.itemSize,this.offset,this.normalized)}toJSON(t){if(t===void 0){console.log("THREE.InterleavedBufferAttribute.toJSON(): Serializing an interleaved buffer attribute will de-interleave buffer data.");const e=[];for(let n=0;n<this.count;n++){const i=n*this.data.stride+this.offset;for(let s=0;s<this.itemSize;s++)e.push(this.data.array[i+s])}return{itemSize:this.itemSize,type:this.array.constructor.name,array:e,normalized:this.normalized}}else return t.interleavedBuffers===void 0&&(t.interleavedBuffers={}),t.interleavedBuffers[this.data.uuid]===void 0&&(t.interleavedBuffers[this.data.uuid]=this.data.toJSON(t)),{isInterleavedBufferAttribute:!0,itemSize:this.itemSize,data:this.data.uuid,offset:this.offset,normalized:this.normalized}}}class Qh extends Fe{constructor(t){super(),this.isSpriteMaterial=!0,this.type="SpriteMaterial",this.color=new vt(16777215),this.map=null,this.alphaMap=null,this.rotation=0,this.sizeAttenuation=!0,this.transparent=!0,this.fog=!0,this.setValues(t)}copy(t){return super.copy(t),this.color.copy(t.color),this.map=t.map,this.alphaMap=t.alphaMap,this.rotation=t.rotation,this.sizeAttenuation=t.sizeAttenuation,this.fog=t.fog,this}}let zi;const _s=new C,ki=new C,Vi=new C,Hi=new K,xs=new K,jh=new zt,dr=new C,vs=new C,fr=new C,Mc=new K,Ga=new K,Sc=new K;class gf extends ie{constructor(t=new Qh){if(super(),this.isSprite=!0,this.type="Sprite",zi===void 0){zi=new Zt;const e=new Float32Array([-.5,-.5,0,0,0,.5,-.5,0,1,0,.5,.5,0,1,1,-.5,.5,0,0,1]),n=new vl(e,5);zi.setIndex([0,1,2,0,2,3]),zi.setAttribute("position",new as(n,3,0,!1)),zi.setAttribute("uv",new as(n,2,3,!1))}this.geometry=zi,this.material=t,this.center=new K(.5,.5),this.count=1}raycast(t,e){t.camera===null&&console.error('THREE.Sprite: "Raycaster.camera" needs to be set in order to raycast against sprites.'),ki.setFromMatrixScale(this.matrixWorld),jh.copy(t.camera.matrixWorld),this.modelViewMatrix.multiplyMatrices(t.camera.matrixWorldInverse,this.matrixWorld),Vi.setFromMatrixPosition(this.modelViewMatrix),t.camera.isPerspectiveCamera&&this.material.sizeAttenuation===!1&&ki.multiplyScalar(-Vi.z);const n=this.material.rotation;let i,s;n!==0&&(s=Math.cos(n),i=Math.sin(n));const a=this.center;pr(dr.set(-.5,-.5,0),Vi,a,ki,i,s),pr(vs.set(.5,-.5,0),Vi,a,ki,i,s),pr(fr.set(.5,.5,0),Vi,a,ki,i,s),Mc.set(0,0),Ga.set(1,0),Sc.set(1,1);let o=t.ray.intersectTriangle(dr,vs,fr,!1,_s);if(o===null&&(pr(vs.set(-.5,.5,0),Vi,a,ki,i,s),Ga.set(0,1),o=t.ray.intersectTriangle(dr,fr,vs,!1,_s),o===null))return;const l=t.ray.origin.distanceTo(_s);l<t.near||l>t.far||e.push({distance:l,point:_s.clone(),uv:Ze.getInterpolation(_s,dr,vs,fr,Mc,Ga,Sc,new K),face:null,object:this})}copy(t,e){return super.copy(t,e),t.center!==void 0&&this.center.copy(t.center),this.material=t.material,this}}function pr(r,t,e,n,i,s){Hi.subVectors(r,e).addScalar(.5).multiply(n),i!==void 0?(xs.x=s*Hi.x-i*Hi.y,xs.y=i*Hi.x+s*Hi.y):xs.copy(Hi),r.copy(t),r.x+=xs.x,r.y+=xs.y,r.applyMatrix4(jh)}const mr=new C,bc=new C;class _f extends ie{constructor(){super(),this.isLOD=!0,this._currentLevel=0,this.type="LOD",Object.defineProperties(this,{levels:{enumerable:!0,value:[]}}),this.autoUpdate=!0}copy(t){super.copy(t,!1);const e=t.levels;for(let n=0,i=e.length;n<i;n++){const s=e[n];this.addLevel(s.object.clone(),s.distance,s.hysteresis)}return this.autoUpdate=t.autoUpdate,this}addLevel(t,e=0,n=0){e=Math.abs(e);const i=this.levels;let s;for(s=0;s<i.length&&!(e<i[s].distance);s++);return i.splice(s,0,{distance:e,hysteresis:n,object:t}),this.add(t),this}removeLevel(t){const e=this.levels;for(let n=0;n<e.length;n++)if(e[n].distance===t){const i=e.splice(n,1);return this.remove(i[0].object),!0}return!1}getCurrentLevel(){return this._currentLevel}getObjectForDistance(t){const e=this.levels;if(e.length>0){let n,i;for(n=1,i=e.length;n<i;n++){let s=e[n].distance;if(e[n].object.visible&&(s-=s*e[n].hysteresis),t<s)break}return e[n-1].object}return null}raycast(t,e){if(this.levels.length>0){mr.setFromMatrixPosition(this.matrixWorld);const i=t.ray.origin.distanceTo(mr);this.getObjectForDistance(i).raycast(t,e)}}update(t){const e=this.levels;if(e.length>1){mr.setFromMatrixPosition(t.matrixWorld),bc.setFromMatrixPosition(this.matrixWorld);const n=mr.distanceTo(bc)/t.zoom;e[0].object.visible=!0;let i,s;for(i=1,s=e.length;i<s;i++){let a=e[i].distance;if(e[i].object.visible&&(a-=a*e[i].hysteresis),n>=a)e[i-1].object.visible=!1,e[i].object.visible=!0;else break}for(this._currentLevel=i-1;i<s;i++)e[i].object.visible=!1}}toJSON(t){const e=super.toJSON(t);this.autoUpdate===!1&&(e.object.autoUpdate=!1),e.object.levels=[];const n=this.levels;for(let i=0,s=n.length;i<s;i++){const a=n[i];e.object.levels.push({object:a.object.uuid,distance:a.distance,hysteresis:a.hysteresis})}return e}}const Ec=new C,Tc=new ne,Ac=new ne,xf=new C,wc=new zt,gr=new C,Wa=new Ie,Cc=new zt,Xa=new Xs;class vf extends ye{constructor(t,e){super(t,e),this.isSkinnedMesh=!0,this.type="SkinnedMesh",this.bindMode=tc,this.bindMatrix=new zt,this.bindMatrixInverse=new zt,this.boundingBox=null,this.boundingSphere=null}computeBoundingBox(){const t=this.geometry;this.boundingBox===null&&(this.boundingBox=new Ne),this.boundingBox.makeEmpty();const e=t.getAttribute("position");for(let n=0;n<e.count;n++)this.getVertexPosition(n,gr),this.boundingBox.expandByPoint(gr)}computeBoundingSphere(){const t=this.geometry;this.boundingSphere===null&&(this.boundingSphere=new Ie),this.boundingSphere.makeEmpty();const e=t.getAttribute("position");for(let n=0;n<e.count;n++)this.getVertexPosition(n,gr),this.boundingSphere.expandByPoint(gr)}copy(t,e){return super.copy(t,e),this.bindMode=t.bindMode,this.bindMatrix.copy(t.bindMatrix),this.bindMatrixInverse.copy(t.bindMatrixInverse),this.skeleton=t.skeleton,t.boundingBox!==null&&(this.boundingBox=t.boundingBox.clone()),t.boundingSphere!==null&&(this.boundingSphere=t.boundingSphere.clone()),this}raycast(t,e){const n=this.material,i=this.matrixWorld;n!==void 0&&(this.boundingSphere===null&&this.computeBoundingSphere(),Wa.copy(this.boundingSphere),Wa.applyMatrix4(i),t.ray.intersectsSphere(Wa)!==!1&&(Cc.copy(i).invert(),Xa.copy(t.ray).applyMatrix4(Cc),!(this.boundingBox!==null&&Xa.intersectsBox(this.boundingBox)===!1)&&this._computeIntersections(t,e,Xa)))}getVertexPosition(t,e){return super.getVertexPosition(t,e),this.applyBoneTransform(t,e),e}bind(t,e){this.skeleton=t,e===void 0&&(this.updateMatrixWorld(!0),this.skeleton.calculateInverses(),e=this.matrixWorld),this.bindMatrix.copy(e),this.bindMatrixInverse.copy(e).invert()}pose(){this.skeleton.pose()}normalizeSkinWeights(){const t=new ne,e=this.geometry.attributes.skinWeight;for(let n=0,i=e.count;n<i;n++){t.fromBufferAttribute(e,n);const s=1/t.manhattanLength();s!==1/0?t.multiplyScalar(s):t.set(1,0,0,0),e.setXYZW(n,t.x,t.y,t.z,t.w)}}updateMatrixWorld(t){super.updateMatrixWorld(t),this.bindMode===tc?this.bindMatrixInverse.copy(this.matrixWorld).invert():this.bindMode===dd?this.bindMatrixInverse.copy(this.bindMatrix).invert():console.warn("THREE.SkinnedMesh: Unrecognized bindMode: "+this.bindMode)}
vendor: 7,288 bytes, line 40
40applyBoneTransform(t,e){const n=this.skeleton,i=this.geometry;Tc.fromBufferAttribute(i.attributes.skinIndex,t),Ac.fromBufferAttribute(i.attributes.skinWeight,t),Ec.copy(e).applyMatrix4(this.bindMatrix),e.set(0,0,0);for(let s=0;s<4;s++){const a=Ac.getComponent(s);if(a!==0){const o=Tc.getComponent(s);wc.multiplyMatrices(n.bones[o].matrixWorld,n.boneInverses[o]),e.addScaledVector(xf.copy(Ec).applyMatrix4(wc),a)}}return e.applyMatrix4(this.bindMatrixInverse)}}class tu extends ie{constructor(){super(),this.isBone=!0,this.type="Bone"}}class Pn extends xe{constructor(t=null,e=1,n=1,i,s,a,o,l,c=Re,h=Re,u,d){super(null,a,o,l,c,h,i,s,u,d),this.isDataTexture=!0,this.image={data:t,width:e,height:n},this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}}const Rc=new zt,yf=new zt;class yl{constructor(t=[],e=[]){this.uuid=$e(),this.bones=t.slice(0),this.boneInverses=e,this.boneMatrices=null,this.boneTexture=null,this.init()}init(){const t=this.bones,e=this.boneInverses;if(this.boneMatrices=new Float32Array(t.length*16),e.length===0)this.calculateInverses();else if(t.length!==e.length){console.warn("THREE.Skeleton: Number of inverse bone matrices does not match amount of bones."),this.boneInverses=[];for(let n=0,i=this.bones.length;n<i;n++)this.boneInverses.push(new zt)}}calculateInverses(){this.boneInverses.length=0;for(let t=0,e=this.bones.length;t<e;t++){const n=new zt;this.bones[t]&&n.copy(this.bones[t].matrixWorld).invert(),this.boneInverses.push(n)}}pose(){for(let t=0,e=this.bones.length;t<e;t++){const n=this.bones[t];n&&n.matrixWorld.copy(this.boneInverses[t]).invert()}for(let t=0,e=this.bones.length;t<e;t++){const n=this.bones[t];n&&(n.parent&&n.parent.isBone?(n.matrix.copy(n.parent.matrixWorld).invert(),n.matrix.multiply(n.matrixWorld)):n.matrix.copy(n.matrixWorld),n.matrix.decompose(n.position,n.quaternion,n.scale))}}update(){const t=this.bones,e=this.boneInverses,n=this.boneMatrices,i=this.boneTexture;for(let s=0,a=t.length;s<a;s++){const o=t[s]?t[s].matrixWorld:yf;Rc.multiplyMatrices(o,e[s]),Rc.toArray(n,s*16)}i!==null&&(i.needsUpdate=!0)}clone(){return new yl(this.bones,this.boneInverses)}computeBoneTexture(){let t=Math.sqrt(this.bones.length*4);t=Math.ceil(t/4)*4,t=Math.max(t,4);const e=new Float32Array(t*t*4);e.set(this.boneMatrices);const n=new Pn(e,t,t,ke,Je);return n.needsUpdate=!0,this.boneMatrices=e,this.boneTexture=n,this}getBoneByName(t){for(let e=0,n=this.bones.length;e<n;e++){const i=this.bones[e];if(i.name===t)return i}}dispose(){this.boneTexture!==null&&(this.boneTexture.dispose(),this.boneTexture=null)}fromJSON(t,e){this.uuid=t.uuid;for(let n=0,i=t.bones.length;n<i;n++){const s=t.bones[n];let a=e[s];a===void 0&&(console.warn("THREE.Skeleton: No bone found with UUID:",s),a=new tu),this.bones.push(a),this.boneInverses.push(new zt().fromArray(t.boneInverses[n]))}return this.init(),this}toJSON(){const t={metadata:{version:4.7,type:"Skeleton",generator:"Skeleton.toJSON"},bones:[],boneInverses:[]};t.uuid=this.uuid;const e=this.bones,n=this.boneInverses;for(let i=0,s=e.length;i<s;i++){const a=e[i];t.bones.push(a.uuid);const o=n[i];t.boneInverses.push(o.toArray())}return t}}class zs extends le{constructor(t,e,n,i=1){super(t,e,n),this.isInstancedBufferAttribute=!0,this.meshPerAttribute=i}copy(t){return super.copy(t),this.meshPerAttribute=t.meshPerAttribute,this}toJSON(){const t=super.toJSON();return t.meshPerAttribute=this.meshPerAttribute,t.isInstancedBufferAttribute=!0,t}}const Gi=new zt,Ic=new zt,_r=[],Pc=new Ne,Mf=new zt,ys=new ye,Ms=new Ie;class Sf extends ye{constructor(t,e,n){super(t,e),this.isInstancedMesh=!0,this.instanceMatrix=new zs(new Float32Array(n*16),16),this.instanceColor=null,this.morphTexture=null,this.count=n,this.boundingBox=null,this.boundingSphere=null;for(let i=0;i<n;i++)this.setMatrixAt(i,Mf)}computeBoundingBox(){const t=this.geometry,e=this.count;this.boundingBox===null&&(this.boundingBox=new Ne),t.boundingBox===null&&t.computeBoundingBox(),this.boundingBox.makeEmpty();for(let n=0;n<e;n++)this.getMatrixAt(n,Gi),Pc.copy(t.boundingBox).applyMatrix4(Gi),this.boundingBox.union(Pc)}computeBoundingSphere(){const t=this.geometry,e=this.count;this.boundingSphere===null&&(this.boundingSphere=new Ie),t.boundingSphere===null&&t.computeBoundingSphere(),this.boundingSphere.makeEmpty();for(let n=0;n<e;n++)this.getMatrixAt(n,Gi),Ms.copy(t.boundingSphere).applyMatrix4(Gi),this.boundingSphere.union(Ms)}copy(t,e){return super.copy(t,e),this.instanceMatrix.copy(t.instanceMatrix),t.morphTexture!==null&&(this.morphTexture=t.morphTexture.clone()),t.instanceColor!==null&&(this.instanceColor=t.instanceColor.clone()),this.count=t.count,t.boundingBox!==null&&(this.boundingBox=t.boundingBox.clone()),t.boundingSphere!==null&&(this.boundingSphere=t.boundingSphere.clone()),this}getColorAt(t,e){e.fromArray(this.instanceColor.array,t*3)}getMatrixAt(t,e){e.fromArray(this.instanceMatrix.array,t*16)}getMorphAt(t,e){const n=e.morphTargetInfluences,i=this.morphTexture.source.data.data,s=n.length+1,a=t*s+1;for(let o=0;o<n.length;o++)n[o]=i[a+o]}raycast(t,e){const n=this.matrixWorld,i=this.count;if(ys.geometry=this.geometry,ys.material=this.material,ys.material!==void 0&&(this.boundingSphere===null&&this.computeBoundingSphere(),Ms.copy(this.boundingSphere),Ms.applyMatrix4(n),t.ray.intersectsSphere(Ms)!==!1))for(let s=0;s<i;s++){this.getMatrixAt(s,Gi),Ic.multiplyMatrices(n,Gi),ys.matrixWorld=Ic,ys.raycast(t,_r);for(let a=0,o=_r.length;a<o;a++){const l=_r[a];l.instanceId=s,l.object=this,e.push(l)}_r.length=0}}setColorAt(t,e){this.instanceColor===null&&(this.instanceColor=new zs(new Float32Array(this.instanceMatrix.count*3).fill(1),3)),e.toArray(this.instanceColor.array,t*3)}setMatrixAt(t,e){e.toArray(this.instanceMatrix.array,t*16)}setMorphAt(t,e){const n=e.morphTargetInfluences,i=n.length+1;this.morphTexture===null&&(this.morphTexture=new Pn(new Float32Array(i*this.count),i,this.count,ll,Je));const s=this.morphTexture.source.data.data;let a=0;for(let c=0;c<n.length;c++)a+=n[c];const o=this.geometry.morphTargetsRelative?1:1-a,l=i*t;s[l]=o,s.set(n,l+1)}updateMorphTargets(){}dispose(){this.dispatchEvent({type:"dispose"}),this.morphTexture!==null&&(this.morphTexture.dispose(),this.morphTexture=null)}}const qa=new C,bf=new C,Ef=new Xt;class ui{constructor(t=new C(1,0,0),e=0){this.isPlane=!0,this.normal=t,this.constant=e}set(t,e){return this.normal.copy(t),this.constant=e,this}setComponents(t,e,n,i){return this.normal.set(t,e,n),this.constant=i,this}setFromNormalAndCoplanarPoint(t,e){return this.normal.copy(t),this.constant=-e.dot(this.normal),this}setFromCoplanarPoints(t,e,n){const i=qa.subVectors(n,e).cross(bf.subVectors(t,e)).normalize();return this.setFromNormalAndCoplanarPoint(i,t),this}copy(t){return this.normal.copy(t.normal),this.constant=t.constant,this}normalize(){const t=1/this.normal.length();return this.normal.multiplyScalar(t),this.constant*=t,this}negate(){return this.constant*=-1,this.normal.negate(),this}distanceToPoint(t){return this.normal.dot(t)+this.constant}distanceToSphere(t){return this.distanceToPoint(t.center)-t.radius}projectPoint(t,e){return e.copy(t).addScaledVector(this.normal,-this.distanceToPoint(t))}intersectLine(t,e){const n=t.delta(qa),i=this.normal.dot(n);if(i===0)return this.distanceToPoint(t.start)===0?e.copy(t.start):null;
vendor: 2,026 bytes, line 40
40const s=-(t.start.dot(this.normal)+this.constant)/i;return s<0||s>1?null:e.copy(t.start).addScaledVector(n,s)}intersectsLine(t){const e=this.distanceToPoint(t.start),n=this.distanceToPoint(t.end);return e<0&&n>0||n<0&&e>0}intersectsBox(t){return t.intersectsPlane(this)}intersectsSphere(t){return t.intersectsPlane(this)}coplanarPoint(t){return t.copy(this.normal).multiplyScalar(-this.constant)}applyMatrix4(t,e){const n=e||Ef.getNormalMatrix(t),i=this.coplanarPoint(qa).applyMatrix4(t),s=this.normal.applyMatrix3(n).normalize();return this.constant=-i.dot(s),this}translate(t){return this.constant-=t.dot(this.normal),this}equals(t){return t.normal.equals(this.normal)&&t.constant===this.constant}clone(){return new this.constructor().copy(this)}}const ti=new Ie,Tf=new K(.5,.5),xr=new C;class qs{constructor(t=new ui,e=new ui,n=new ui,i=new ui,s=new ui,a=new ui){this.planes=[t,e,n,i,s,a]}set(t,e,n,i,s,a){const o=this.planes;return o[0].copy(t),o[1].copy(e),o[2].copy(n),o[3].copy(i),o[4].copy(s),o[5].copy(a),this}copy(t){const e=this.planes;for(let n=0;n<6;n++)e[n].copy(t.planes[n]);return this}setFromProjectionMatrix(t,e=nn,n=!1){const i=this.planes,s=t.elements,a=s[0],o=s[1],l=s[2],c=s[3],h=s[4],u=s[5],d=s[6],f=s[7],m=s[8],_=s[9],g=s[10],p=s[11],y=s[12],v=s[13],x=s[14],A=s[15];if(i[0].setComponents(c-a,f-h,p-m,A-y).normalize(),i[1].setComponents(c+a,f+h,p+m,A+y).normalize(),i[2].setComponents(c+o,f+u,p+_,A+v).normalize(),i[3].setComponents(c-o,f-u,p-_,A-v).normalize(),n)i[4].setComponents(l,d,g,x).normalize(),i[5].setComponents(c-l,f-d,p-g,A-x).normalize();else if(i[4].setComponents(c-l,f-d,p-g,A-x).normalize(),e===nn)i[5].setComponents(c+l,f+d,p+g,A+x).normalize();else if(e===Os)i[5].setComponents(l,d,g,x).normalize();else throw new Error("THREE.Frustum.setFromProjectionMatrix(): Invalid coordinate system: "+e);return this}intersectsObject(t){if(t.boundingSphere!==void 0)t.boundingSphere===null&&t.computeBoundingSphere(),ti.copy(t.boundingSphere).applyMatrix4(t.matrixWorld);else{const e=t.geometry;
vendor: 4,883 bytes, line 40
40e.boundingSphere===null&&e.computeBoundingSphere(),ti.copy(e.boundingSphere).applyMatrix4(t.matrixWorld)}return this.intersectsSphere(ti)}intersectsSprite(t){ti.center.set(0,0,0);const e=Tf.distanceTo(t.center);return ti.radius=.7071067811865476+e,ti.applyMatrix4(t.matrixWorld),this.intersectsSphere(ti)}intersectsSphere(t){const e=this.planes,n=t.center,i=-t.radius;for(let s=0;s<6;s++)if(e[s].distanceToPoint(n)<i)return!1;return!0}intersectsBox(t){const e=this.planes;for(let n=0;n<6;n++){const i=e[n];if(xr.x=i.normal.x>0?t.max.x:t.min.x,xr.y=i.normal.y>0?t.max.y:t.min.y,xr.z=i.normal.z>0?t.max.z:t.min.z,i.distanceToPoint(xr)<0)return!1}return!0}containsPoint(t){const e=this.planes;for(let n=0;n<6;n++)if(e[n].distanceToPoint(t)<0)return!1;return!0}clone(){return new this.constructor().copy(this)}}const un=new zt,dn=new qs;class Ml{constructor(){this.coordinateSystem=nn}intersectsObject(t,e){if(!e.isArrayCamera||e.cameras.length===0)return!1;for(let n=0;n<e.cameras.length;n++){const i=e.cameras[n];if(un.multiplyMatrices(i.projectionMatrix,i.matrixWorldInverse),dn.setFromProjectionMatrix(un,i.coordinateSystem,i.reversedDepth),dn.intersectsObject(t))return!0}return!1}intersectsSprite(t,e){if(!e||!e.cameras||e.cameras.length===0)return!1;for(let n=0;n<e.cameras.length;n++){const i=e.cameras[n];if(un.multiplyMatrices(i.projectionMatrix,i.matrixWorldInverse),dn.setFromProjectionMatrix(un,i.coordinateSystem,i.reversedDepth),dn.intersectsSprite(t))return!0}return!1}intersectsSphere(t,e){if(!e||!e.cameras||e.cameras.length===0)return!1;for(let n=0;n<e.cameras.length;n++){const i=e.cameras[n];if(un.multiplyMatrices(i.projectionMatrix,i.matrixWorldInverse),dn.setFromProjectionMatrix(un,i.coordinateSystem,i.reversedDepth),dn.intersectsSphere(t))return!0}return!1}intersectsBox(t,e){if(!e||!e.cameras||e.cameras.length===0)return!1;for(let n=0;n<e.cameras.length;n++){const i=e.cameras[n];if(un.multiplyMatrices(i.projectionMatrix,i.matrixWorldInverse),dn.setFromProjectionMatrix(un,i.coordinateSystem,i.reversedDepth),dn.intersectsBox(t))return!0}return!1}containsPoint(t,e){if(!e||!e.cameras||e.cameras.length===0)return!1;for(let n=0;n<e.cameras.length;n++){const i=e.cameras[n];if(un.multiplyMatrices(i.projectionMatrix,i.matrixWorldInverse),dn.setFromProjectionMatrix(un,i.coordinateSystem,i.reversedDepth),dn.containsPoint(t))return!0}return!1}clone(){return new Ml}}function Ya(r,t){return r-t}function Af(r,t){return r.z-t.z}function wf(r,t){return t.z-r.z}class Cf{constructor(){this.index=0,this.pool=[],this.list=[]}push(t,e,n,i){const s=this.pool,a=this.list;this.index>=s.length&&s.push({start:-1,count:-1,z:-1,index:-1});const o=s[this.index];a.push(o),this.index++,o.start=t,o.count=e,o.z=n,o.index=i}reset(){this.list.length=0,this.index=0}}const Be=new zt,Rf=new vt(1,1,1),Lc=new qs,If=new Ml,vr=new Ne,ei=new Ie,Ss=new C,Dc=new C,Pf=new C,Za=new Cf,we=new ye,yr=[];function Lf(r,t,e=0){const n=t.itemSize;if(r.isInterleavedBufferAttribute||r.array.constructor!==t.array.constructor){const i=r.count;for(let s=0;s<i;s++)for(let a=0;a<n;a++)t.setComponent(s+e,a,r.getComponent(s,a))}else t.array.set(r.array,e*n);t.needsUpdate=!0}function ni(r,t){if(r.constructor!==t.constructor){const e=Math.min(r.length,t.length);for(let n=0;n<e;n++)t[n]=r[n]}else{const e=Math.min(r.length,t.length);t.set(new r.constructor(r.buffer,0,e))}}class Df extends ye{constructor(t,e,n=e*2,i){super(new Zt,i),this.isBatchedMesh=!0,this.perObjectFrustumCulled=!0,this.sortObjects=!0,this.boundingBox=null,this.boundingSphere=null,this.customSort=null,this._instanceInfo=[],this._geometryInfo=[],this._availableInstanceIds=[],this._availableGeometryIds=[],this._nextIndexStart=0,this._nextVertexStart=0,this._geometryCount=0,this._visibilityChanged=!0,this._geometryInitialized=!1,this._maxInstanceCount=t,this._maxVertexCount=e,this._maxIndexCount=n,this._multiDrawCounts=new Int32Array(t),this._multiDrawStarts=new Int32Array(t),this._multiDrawCount=0,this._multiDrawInstances=null,this._matricesTexture=null,this._indirectTexture=null,this._colorsTexture=null,this._initMatricesTexture(),this._initIndirectTexture()}get maxInstanceCount(){return this._maxInstanceCount}get instanceCount(){return this._instanceInfo.length-this._availableInstanceIds.length}get unusedVertexCount(){return this._maxVertexCount-this._nextVertexStart}get unusedIndexCount(){return this._maxIndexCount-this._nextIndexStart}_initMatricesTexture(){let t=Math.sqrt(this._maxInstanceCount*4);t=Math.ceil(t/4)*4,t=Math.max(t,4);const e=new Float32Array(t*t*4),n=new Pn(e,t,t,ke,Je);this._matricesTexture=n}_initIndirectTexture(){let t=Math.sqrt(this._maxInstanceCount);t=Math.ceil(t);const e=new Uint32Array(t*t),n=new Pn(e,t,t,ha,Yn);this._indirectTexture=n}_initColorsTexture(){let t=Math.sqrt(this._maxInstanceCount);t=Math.ceil(t);const e=new Float32Array(t*t*4).fill(1),n=new Pn(e,t,t,ke,Je);
40n.colorSpace=Kt.workingColorSpace,this._colorsTexture=n}_initializeGeometry(t){const e=this.geometry,n=this._maxVertexCount,i=this._maxIndexCount;if(this._geometryInitialized===!1){for(const s in t.attributes){const a=t.getAttribute(s),{array:o,itemSize:l,normalized:c}=a,h=new o.constructor(n*l),u=new le(h,l,c);e.setAttribute(s,u)}if(t.getIndex()!==null){const s=n>65535?new Uint32Array(i):new Uint16Array(i);e.setIndex(new le(s,1))}this._geometryInitialized=!0}}_validateGeometry(t){const e=this.geometry;if(!!t.getIndex()!=!!e.getIndex())throw new Error('THREE.BatchedMesh: All geometries must consistently have "index".');for(const n in e.attributes){if(!t.hasAttribute(n))throw new Error(`THREE.BatchedMesh: Added geometry missing "${n}". All geometries must have consistent attributes.`);const i=t.getAttribute(n),s=e.getAttribute(n);if(i.itemSize!==s.itemSize||i.normalized!==s.normalized)throw new Error("THREE.BatchedMesh: All attributes must have a consistent itemSize and normalized value.")}}validateInstanceId(t){const e=this._instanceInfo;if(t<0||t>=e.length||e[t].active===!1)throw new Error(`THREE.BatchedMesh: Invalid instanceId ${t}. Instance is either out of range or has been deleted.`)}validateGeometryId(t){const e=this._geometryInfo;if(t<0||t>=e.length||e[t].active===!1)throw new Error(`THREE.BatchedMesh: Invalid geometryId ${t}. Geometry is either out of range or has been deleted.`)}setCustomSort(t){return this.customSort=t,this}computeBoundingBox(){this.boundingBox===null&&(this.boundingBox=new Ne);const t=this.boundingBox,e=this._instanceInfo;t.makeEmpty();for(let n=0,i=e.length;n<i;n++){if(e[n].active===!1)continue;const s=e[n].geometryIndex;this.getMatrixAt(n,Be),this.getBoundingBoxAt(s,vr).applyMatrix4(Be),t.union(vr)}}computeBoundingSphere(){this.boundingSphere===null&&(this.boundingSphere=new Ie);const t=this.boundingSphere,e=this._instanceInfo;t.makeEmpty();for(let n=0,i=e.length;n<i;n++){if(e[n].active===!1)continue;const s=e[n].geometryIndex;this.getMatrixAt(n,Be),this.getBoundingSphereAt(s,ei).applyMatrix4(Be),t.union(ei)}}addInstance(t){if(this._instanceInfo.length>=this.maxInstanceCount&&this._availableInstanceIds.length===0)throw new Error("THREE.BatchedMesh: Maximum item count reached.");const n={visible:!0,active:!0,geometryIndex:t};let i=null;this._availableInstanceIds.length>0?(this._availableInstanceIds.sort(Ya),i=this._availableInstanceIds.shift(),this._instanceInfo[i]=n):(i=this._instanceInfo.length,this._instanceInfo.push(n));const s=this._matricesTexture;Be.identity().toArray(s.image.data,i*16),s.needsUpdate=!0;const a=this._colorsTexture;return a&&(Rf.toArray(a.image.data,i*4),a.needsUpdate=!0),this._visibilityChanged=!0,i}addGeometry(t,e=-1,n=-1){this._initializeGeometry(t),this._validateGeometry(t);const i={vertexStart:-1,vertexCount:-1,reservedVertexCount:-1,indexStart:-1,indexCount:-1,reservedIndexCount:-1,start:-1,count:-1,boundingBox:null,boundingSphere:null,active:!0},s=this._geometryInfo;i.vertexStart=this._nextVertexStart,i.reservedVertexCount=e===-1?t.getAttribute("position").count:e;const a=t.getIndex();if(a!==null&&(i.indexStart=this._nextIndexStart,i.reservedIndexCount=n===-1?a.count:n),i.indexStart!==-1&&i.indexStart+i.reservedIndexCount>this._maxIndexCount||i.vertexStart+i.reservedVertexCount>this._maxVertexCount)throw new Error("THREE.BatchedMesh: Reserved space request exceeds the maximum buffer size.");let l;return this._availableGeometryIds.length>0?(this._availableGeometryIds.sort(Ya),l=this._availableGeometryIds.shift(),s[l]=i):(l=this._geometryCount,this._geometryCount++,s.push(i)),this.setGeometryAt(l,t),this._nextIndexStart=i.indexStart+i.reservedIndexCount,this._nextVertexStart=i.vertexStart+i.reservedVertexCount,l}setGeometryAt(t,e){if(t>=this._geometryCount)throw new Error("THREE.BatchedMesh: Maximum geometry count reached.");this._validateGeometry(e);const n=this.geometry,i=n.getIndex()!==null,s=n.getIndex(),a=e.getIndex(),o=this._geometryInfo[t];if(i&&a.count>o.reservedIndexCount||e.attributes.position.count>o.reservedVertexCount)throw new Error("THREE.BatchedMesh: Reserved space not large enough for provided geometry.");const l=o.vertexStart,c=o.reservedVertexCount;o.vertexCount=e.getAttribute("position").count;for(const h in n.attributes){const u=e.getAttribute(h),d=n.getAttribute(h);Lf(u,d,l);const f=u.itemSize;
vendor: 4,779 bytes, line 40
40for(let m=u.count,_=c;m<_;m++){const g=l+m;for(let p=0;p<f;p++)d.setComponent(g,p,0)}d.needsUpdate=!0,d.addUpdateRange(l*f,c*f)}if(i){const h=o.indexStart,u=o.reservedIndexCount;o.indexCount=e.getIndex().count;for(let d=0;d<a.count;d++)s.setX(h+d,l+a.getX(d));for(let d=a.count,f=u;d<f;d++)s.setX(h+d,l);s.needsUpdate=!0,s.addUpdateRange(h,o.reservedIndexCount)}return o.start=i?o.indexStart:o.vertexStart,o.count=i?o.indexCount:o.vertexCount,o.boundingBox=null,e.boundingBox!==null&&(o.boundingBox=e.boundingBox.clone()),o.boundingSphere=null,e.boundingSphere!==null&&(o.boundingSphere=e.boundingSphere.clone()),this._visibilityChanged=!0,t}deleteGeometry(t){const e=this._geometryInfo;if(t>=e.length||e[t].active===!1)return this;const n=this._instanceInfo;for(let i=0,s=n.length;i<s;i++)n[i].active&&n[i].geometryIndex===t&&this.deleteInstance(i);return e[t].active=!1,this._availableGeometryIds.push(t),this._visibilityChanged=!0,this}deleteInstance(t){return this.validateInstanceId(t),this._instanceInfo[t].active=!1,this._availableInstanceIds.push(t),this._visibilityChanged=!0,this}optimize(){let t=0,e=0;const n=this._geometryInfo,i=n.map((a,o)=>o).sort((a,o)=>n[a].vertexStart-n[o].vertexStart),s=this.geometry;for(let a=0,o=n.length;a<o;a++){const l=i[a],c=n[l];if(c.active!==!1){if(s.index!==null){if(c.indexStart!==e){const{indexStart:h,vertexStart:u,reservedIndexCount:d}=c,f=s.index,m=f.array,_=t-u;for(let g=h;g<h+d;g++)m[g]=m[g]+_;f.array.copyWithin(e,h,h+d),f.addUpdateRange(e,d),c.indexStart=e}e+=c.reservedIndexCount}if(c.vertexStart!==t){const{vertexStart:h,reservedVertexCount:u}=c,d=s.attributes;for(const f in d){const m=d[f],{array:_,itemSize:g}=m;_.copyWithin(t*g,h*g,(h+u)*g),m.addUpdateRange(t*g,u*g)}c.vertexStart=t}t+=c.reservedVertexCount,c.start=s.index?c.indexStart:c.vertexStart,this._nextIndexStart=s.index?c.indexStart+c.reservedIndexCount:0,this._nextVertexStart=c.vertexStart+c.reservedVertexCount}}return this}getBoundingBoxAt(t,e){if(t>=this._geometryCount)return null;const n=this.geometry,i=this._geometryInfo[t];if(i.boundingBox===null){const s=new Ne,a=n.index,o=n.attributes.position;for(let l=i.start,c=i.start+i.count;l<c;l++){let h=l;a&&(h=a.getX(h)),s.expandByPoint(Ss.fromBufferAttribute(o,h))}i.boundingBox=s}return e.copy(i.boundingBox),e}getBoundingSphereAt(t,e){if(t>=this._geometryCount)return null;const n=this.geometry,i=this._geometryInfo[t];if(i.boundingSphere===null){const s=new Ie;this.getBoundingBoxAt(t,vr),vr.getCenter(s.center);const a=n.index,o=n.attributes.position;let l=0;for(let c=i.start,h=i.start+i.count;c<h;c++){let u=c;a&&(u=a.getX(u)),Ss.fromBufferAttribute(o,u),l=Math.max(l,s.center.distanceToSquared(Ss))}s.radius=Math.sqrt(l),i.boundingSphere=s}return e.copy(i.boundingSphere),e}setMatrixAt(t,e){this.validateInstanceId(t);const n=this._matricesTexture,i=this._matricesTexture.image.data;return e.toArray(i,t*16),n.needsUpdate=!0,this}getMatrixAt(t,e){return this.validateInstanceId(t),e.fromArray(this._matricesTexture.image.data,t*16)}setColorAt(t,e){return this.validateInstanceId(t),this._colorsTexture===null&&this._initColorsTexture(),e.toArray(this._colorsTexture.image.data,t*4),this._colorsTexture.needsUpdate=!0,this}getColorAt(t,e){return this.validateInstanceId(t),e.fromArray(this._colorsTexture.image.data,t*4)}setVisibleAt(t,e){return this.validateInstanceId(t),this._instanceInfo[t].visible===e?this:(this._instanceInfo[t].visible=e,this._visibilityChanged=!0,this)}getVisibleAt(t){return this.validateInstanceId(t),this._instanceInfo[t].visible}setGeometryIdAt(t,e){return this.validateInstanceId(t),this.validateGeometryId(e),this._instanceInfo[t].geometryIndex=e,this}getGeometryIdAt(t){return this.validateInstanceId(t),this._instanceInfo[t].geometryIndex}getGeometryRangeAt(t,e={}){this.validateGeometryId(t);const n=this._geometryInfo[t];return e.vertexStart=n.vertexStart,e.vertexCount=n.vertexCount,e.reservedVertexCount=n.reservedVertexCount,e.indexStart=n.indexStart,e.indexCount=n.indexCount,e.reservedIndexCount=n.reservedIndexCount,e.start=n.start,e.count=n.count,e}setInstanceCount(t){const e=this._availableInstanceIds,n=this._instanceInfo;for(e.sort(Ya);e[e.length-1]===n.length-1;)n.pop(),e.pop();if(t<n.length)throw new Error(`BatchedMesh: Instance ids outside the range ${t} are being used. Cannot shrink instance count.`);const i=new Int32Array(t),s=new Int32Array(t);ni(this._multiDrawCounts,i),ni(this._multiDrawStarts,s),this._multiDrawCounts=i,this._multiDrawStarts=s,this._maxInstanceCount=t;const a=this._indirectTexture,o=this._matricesTexture,l=this._colorsTexture;a.dispose(),this._initIndirectTexture(),ni(a.image.data,this._indirectTexture.image.data),o.dispose(),this._initMatricesTexture(),ni(o.image.data,this._matricesTexture.image.data),l&&(l.dis
vendor: 7,138 bytes, line 40
40pose(),this._initColorsTexture(),ni(l.image.data,this._colorsTexture.image.data))}setGeometrySize(t,e){const n=[...this._geometryInfo].filter(o=>o.active);if(Math.max(...n.map(o=>o.vertexStart+o.reservedVertexCount))>t)throw new Error(`BatchedMesh: Geometry vertex values are being used outside the range ${e}. Cannot shrink further.`);if(this.geometry.index&&Math.max(...n.map(l=>l.indexStart+l.reservedIndexCount))>e)throw new Error(`BatchedMesh: Geometry index values are being used outside the range ${e}. Cannot shrink further.`);const s=this.geometry;s.dispose(),this._maxVertexCount=t,this._maxIndexCount=e,this._geometryInitialized&&(this._geometryInitialized=!1,this.geometry=new Zt,this._initializeGeometry(s));const a=this.geometry;s.index&&ni(s.index.array,a.index.array);for(const o in s.attributes)ni(s.attributes[o].array,a.attributes[o].array)}raycast(t,e){const n=this._instanceInfo,i=this._geometryInfo,s=this.matrixWorld,a=this.geometry;we.material=this.material,we.geometry.index=a.index,we.geometry.attributes=a.attributes,we.geometry.boundingBox===null&&(we.geometry.boundingBox=new Ne),we.geometry.boundingSphere===null&&(we.geometry.boundingSphere=new Ie);for(let o=0,l=n.length;o<l;o++){if(!n[o].visible||!n[o].active)continue;const c=n[o].geometryIndex,h=i[c];we.geometry.setDrawRange(h.start,h.count),this.getMatrixAt(o,we.matrixWorld).premultiply(s),this.getBoundingBoxAt(c,we.geometry.boundingBox),this.getBoundingSphereAt(c,we.geometry.boundingSphere),we.raycast(t,yr);for(let u=0,d=yr.length;u<d;u++){const f=yr[u];f.object=this,f.batchId=o,e.push(f)}yr.length=0}we.material=null,we.geometry.index=null,we.geometry.attributes={},we.geometry.setDrawRange(0,1/0)}copy(t){return super.copy(t),this.geometry=t.geometry.clone(),this.perObjectFrustumCulled=t.perObjectFrustumCulled,this.sortObjects=t.sortObjects,this.boundingBox=t.boundingBox!==null?t.boundingBox.clone():null,this.boundingSphere=t.boundingSphere!==null?t.boundingSphere.clone():null,this._geometryInfo=t._geometryInfo.map(e=>({...e,boundingBox:e.boundingBox!==null?e.boundingBox.clone():null,boundingSphere:e.boundingSphere!==null?e.boundingSphere.clone():null})),this._instanceInfo=t._instanceInfo.map(e=>({...e})),this._availableInstanceIds=t._availableInstanceIds.slice(),this._availableGeometryIds=t._availableGeometryIds.slice(),this._nextIndexStart=t._nextIndexStart,this._nextVertexStart=t._nextVertexStart,this._geometryCount=t._geometryCount,this._maxInstanceCount=t._maxInstanceCount,this._maxVertexCount=t._maxVertexCount,this._maxIndexCount=t._maxIndexCount,this._geometryInitialized=t._geometryInitialized,this._multiDrawCounts=t._multiDrawCounts.slice(),this._multiDrawStarts=t._multiDrawStarts.slice(),this._indirectTexture=t._indirectTexture.clone(),this._indirectTexture.image.data=this._indirectTexture.image.data.slice(),this._matricesTexture=t._matricesTexture.clone(),this._matricesTexture.image.data=this._matricesTexture.image.data.slice(),this._colorsTexture!==null&&(this._colorsTexture=t._colorsTexture.clone(),this._colorsTexture.image.data=this._colorsTexture.image.data.slice()),this}dispose(){this.geometry.dispose(),this._matricesTexture.dispose(),this._matricesTexture=null,this._indirectTexture.dispose(),this._indirectTexture=null,this._colorsTexture!==null&&(this._colorsTexture.dispose(),this._colorsTexture=null)}onBeforeRender(t,e,n,i,s){if(!this._visibilityChanged&&!this.perObjectFrustumCulled&&!this.sortObjects)return;const a=i.getIndex(),o=a===null?1:a.array.BYTES_PER_ELEMENT,l=this._instanceInfo,c=this._multiDrawStarts,h=this._multiDrawCounts,u=this._geometryInfo,d=this.perObjectFrustumCulled,f=this._indirectTexture,m=f.image.data,_=n.isArrayCamera?If:Lc;d&&!n.isArrayCamera&&(Be.multiplyMatrices(n.projectionMatrix,n.matrixWorldInverse).multiply(this.matrixWorld),Lc.setFromProjectionMatrix(Be,n.coordinateSystem,n.reversedDepth));let g=0;if(this.sortObjects){Be.copy(this.matrixWorld).invert(),Ss.setFromMatrixPosition(n.matrixWorld).applyMatrix4(Be),Dc.set(0,0,-1).transformDirection(n.matrixWorld).transformDirection(Be);for(let v=0,x=l.length;v<x;v++)if(l[v].visible&&l[v].active){const A=l[v].geometryIndex;this.getMatrixAt(v,Be),this.getBoundingSphereAt(A,ei).applyMatrix4(Be);let T=!1;if(d&&(T=!_.intersectsSphere(ei,n)),!T){const R=u[A],P=Pf.subVectors(ei.center,Ss).dot(Dc);Za.push(R.start,R.count,P,v)}}const p=Za.list,y=this.customSort;y===null?p.sort(s.transparent?wf:Af):y.call(this,p,n);for(let v=0,x=p.length;v<x;v++){const A=p[v];c[g]=A.start*o,h[g]=A.count,m[g]=A.index,g++}Za.reset()}else for(let p=0,y=l.length;p<y;p++)if(l[p].visible&&l[p].active){const v=l[p].geometryIndex;let x=!1;if(d&&(this.getMatrixAt(p,Be),this.getBoundingSphereAt(v,ei).applyMatrix4(Be),x=!_.intersectsSphere(ei,n)),!x){const A=u[v];c[g]=A.start*o,h[g]=A.count,m[g]=p,g++}}f.needsUpdate=!0,this._multiDrawCount=g,this._visibilityChanged=!1}onBeforeShadow(t,e,n,i,s,a){this.onBeforeRender(t,null,i,s,a)}}class He extends Fe{constructor(t){super(),this.isLineBasicMaterial=!0,this.type="LineBasicMaterial",this.color=new vt(16777215),this.map=null,this.linewidth=1,this.linecap="round",this.linejoin="round",this.fog=!0,this.setValues(t)}copy(t){return super.copy(t),this.color.copy(t.color),this.map=t.map,this.linewidth=t.linewidth,this.linecap=t.linecap,this.linejoin=t.linejoin,this.fog=t.fog,this}}const na=new C,ia=new C,Uc=new zt,bs=new Xs,Mr=new Ie,Ja=new C,Nc=new C;class vi extends ie{constructor(t=new Zt,e=new He){super(),this.isLine=!0,this.type="Line",this.geometry=t,this.material=e,this.morphTargetDictionary=void 0,this.morphTargetInfluences=void 0,this.updateMorphTargets()}copy(t,e){return super.copy(t,e),this.material=Array.isArray(t.material)?t.material.slice():t.material,this.geometry=t.geometry,this}computeLineDistances(){const t=this.geometry;if(t.index===null){const e=t.attributes.position,n=[0];for(let i=1,s=e.count;i<s;i++)na.fromBufferAttribute(e,i-1),ia.fromBufferAttribute(e,i),n[i]=n[i-1],n[i]+=na.distanceTo(ia);t.setAttribute("lineDistance",new St(n,1))}else console.warn("THREE.Line.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");return this}raycast(t,e){const n=this.geometry,i=this.matrixWorld,s=t.params.Line.threshold,a=n.drawRange;if(n.boundingSphere===null&&n.computeBoundingSphere(),Mr.copy(n.boundingSphere),Mr.applyMatrix4(i),Mr.radius+=s,t.ray.intersectsSphere(Mr)===!1)return;Uc.copy(i).invert(),bs.copy(t.ray).applyMatrix4(Uc);const o=s/((this.scale.x+this.scale.y+this.scale.z)/3),l=o*o,c=this.isLineSegments?2:1,h=n.index,d=n.attributes.position;if(h!==null){const f=Math.max(0,a.start),m=Math.min(h.count,a.start+a.count);for(let _=f,g=m-1;_<g;_+=c){const p=h.getX(_),y=h.getX(_+1),v=Sr(this,t,bs,l,p,y,_);v&&e.push(v)}if(this.isLineLoop){const _=h.getX(m-1),g=h.getX(f),p=Sr(this,t,bs,l,_,g,m-1);p&&e.push(p)}}else{const f=Math.max(0,a.start),m=Math.min(d.count,a.start+a.count);for(let _=f,g=m-1;_<g;_+=c){const p=Sr(this,t,bs,l,_,_+1,_);p&&e.push(p)}if(this.isLineLoop){const _=Sr(this,t,bs,l,m-1,f,m-1);_&&e.push(_)}}}updateMorphTargets(){const e=this.geometry.morphAttributes,n=Object.keys(e);if(n.length>
vendor: 5,821 bytes, line 40
400){const i=e[n[0]];if(i!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let s=0,a=i.length;s<a;s++){const o=i[s].name||String(s);this.morphTargetInfluences.push(0),this.morphTargetDictionary[o]=s}}}}}function Sr(r,t,e,n,i,s,a){const o=r.geometry.attributes.position;if(na.fromBufferAttribute(o,i),ia.fromBufferAttribute(o,s),e.distanceSqToSegment(na,ia,Ja,Nc)>n)return;Ja.applyMatrix4(r.matrixWorld);const c=t.ray.origin.distanceTo(Ja);if(!(c<t.near||c>t.far))return{distance:c,point:Nc.clone().applyMatrix4(r.matrixWorld),index:a,face:null,faceIndex:null,barycoord:null,object:r}}const Fc=new C,Oc=new C;class Un extends vi{constructor(t,e){super(t,e),this.isLineSegments=!0,this.type="LineSegments"}computeLineDistances(){const t=this.geometry;if(t.index===null){const e=t.attributes.position,n=[];for(let i=0,s=e.count;i<s;i+=2)Fc.fromBufferAttribute(e,i),Oc.fromBufferAttribute(e,i+1),n[i]=i===0?0:n[i-1],n[i+1]=n[i]+Fc.distanceTo(Oc);t.setAttribute("lineDistance",new St(n,1))}else console.warn("THREE.LineSegments.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");return this}}class Uf extends vi{constructor(t,e){super(t,e),this.isLineLoop=!0,this.type="LineLoop"}}class eu extends Fe{constructor(t){super(),this.isPointsMaterial=!0,this.type="PointsMaterial",this.color=new vt(16777215),this.map=null,this.alphaMap=null,this.size=1,this.sizeAttenuation=!0,this.fog=!0,this.setValues(t)}copy(t){return super.copy(t),this.color.copy(t.color),this.map=t.map,this.alphaMap=t.alphaMap,this.size=t.size,this.sizeAttenuation=t.sizeAttenuation,this.fog=t.fog,this}}const Bc=new zt,$o=new Xs,br=new Ie,Er=new C;class Nf extends ie{constructor(t=new Zt,e=new eu){super(),this.isPoints=!0,this.type="Points",this.geometry=t,this.material=e,this.morphTargetDictionary=void 0,this.morphTargetInfluences=void 0,this.updateMorphTargets()}copy(t,e){return super.copy(t,e),this.material=Array.isArray(t.material)?t.material.slice():t.material,this.geometry=t.geometry,this}raycast(t,e){const n=this.geometry,i=this.matrixWorld,s=t.params.Points.threshold,a=n.drawRange;if(n.boundingSphere===null&&n.computeBoundingSphere(),br.copy(n.boundingSphere),br.applyMatrix4(i),br.radius+=s,t.ray.intersectsSphere(br)===!1)return;Bc.copy(i).invert(),$o.copy(t.ray).applyMatrix4(Bc);const o=s/((this.scale.x+this.scale.y+this.scale.z)/3),l=o*o,c=n.index,u=n.attributes.position;if(c!==null){const d=Math.max(0,a.start),f=Math.min(c.count,a.start+a.count);for(let m=d,_=f;m<_;m++){const g=c.getX(m);Er.fromBufferAttribute(u,g),zc(Er,g,l,i,t,e,this)}}else{const d=Math.max(0,a.start),f=Math.min(u.count,a.start+a.count);for(let m=d,_=f;m<_;m++)Er.fromBufferAttribute(u,m),zc(Er,m,l,i,t,e,this)}}updateMorphTargets(){const e=this.geometry.morphAttributes,n=Object.keys(e);if(n.length>0){const i=e[n[0]];if(i!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let s=0,a=i.length;s<a;s++){const o=i[s].name||String(s);this.morphTargetInfluences.push(0),this.morphTargetDictionary[o]=s}}}}}function zc(r,t,e,n,i,s,a){const o=$o.distanceSqToPoint(r);if(o<e){const l=new C;$o.closestPointToPoint(r,l),l.applyMatrix4(n);const c=i.ray.origin.distanceTo(l);if(c<i.near||c>i.far)return;s.push({distance:c,distanceToRay:Math.sqrt(o),point:l,index:t,face:null,faceIndex:null,barycoord:null,object:a})}}class Ff extends xe{constructor(t,e,n,i,s=Ee,a=Ee,o,l,c){super(t,e,n,i,s,a,o,l,c),this.isVideoTexture=!0,this.generateMipmaps=!1,this._requestVideoFrameCallbackId=0;const h=this;function u(){h.needsUpdate=!0,h._requestVideoFrameCallbackId=t.requestVideoFrameCallback(u)}"requestVideoFrameCallback"in t&&(this._requestVideoFrameCallbackId=t.requestVideoFrameCallback(u))}clone(){return new this.constructor(this.image).copy(this)}update(){const t=this.image;"requestVideoFrameCallback"in t===!1&&t.readyState>=t.HAVE_CURRENT_DATA&&(this.needsUpdate=!0)}dispose(){this._requestVideoFrameCallbackId!==0&&this.source.data.cancelVideoFrameCallback(this._requestVideoFrameCallbackId),super.dispose()}}class ty extends Ff{constructor(t,e,n,i,s,a,o,l){super({},t,e,n,i,s,a,o,l),this.isVideoFrameTexture=!0}update(){}clone(){return new this.constructor().copy(this)}setFrame(t){this.image=t,this.needsUpdate=!0}}class ey extends xe{constructor(t,e){super({width:t,height:e}),this.isFramebufferTexture=!0,this.magFilter=Re,this.minFilter=Re,this.generateMipmaps=!1,this.needsUpdate=!0}}class Sl extends xe{constructor(t,e,n,i,s,a,o,l,c,h,u,d){super(null,a,o,l,c,h,i,s,u,d),this.isCompressedTexture=!0,this.image={width:e,height:n},this.mipmaps=t,this.flipY=!1,this.generateMipmaps=!1}}class ny extends Sl{constructor(t,e,n,i,s,a){super(t,e,n,s,a),this.isCompressedArrayTexture=!0,this.image.depth=i,this.wrapR=ln,this.layerUpdates=new Set}addLayerUpdate(t){this.layerUpdates.add(t)}clearLayerUpdates(){this.layerUpdates.clear()}}class iy extends Sl{constructor(t,e,n){super(void 0,t[0].width,t[0].height,e,n,qn),this.isCompressedCubeTexture=!0,this.isCubeTexture=!0,this.image=t}}class sy extends xe{constructor(t,e,n,i,s,a,o,l,c){super(t,e,n,i,s,a,o,l,c),this.isCanvasTexture=!0,this.needsUpdate=!0}}class nu extends xe{constructor(t,e,n=Yn,i,s,a,o=Re,l=Re,c,h=Ns,u=1){if(h!==Ns&&h!==Fs)throw new Error("DepthTexture format must be either THREE.DepthFormat or THREE.DepthStencilFormat");const d={width:t,height:e,depth:u};super(d,i,s,a,o,l,h,n,c),this.isDepthTexture=!0,this.flipY=!1,this.generateMipmaps=!1,this.compareFunction=null}copy(t){return super.copy(t),this.source=new mi(Object.assign({},t.image)),this.compareFunction=t.compareFunction,this}toJSON(t){const e=super.toJSON(t);return this.compareFunction!==null&&(e.compareFunction=this.compareFunction),e}}class bl extends Zt{constructor(t=1,e=1,n=4,i=8,s=1){super(),this.type="CapsuleGeometry",this.parameters={radiu
vendor: 3,779 bytes, line 40
40s:t,height:e,capSegments:n,radialSegments:i,heightSegments:s},e=Math.max(0,e),n=Math.max(1,Math.floor(n)),i=Math.max(3,Math.floor(i)),s=Math.max(1,Math.floor(s));const a=[],o=[],l=[],c=[],h=e/2,u=Math.PI/2*t,d=e,f=2*u+d,m=n*2+s,_=i+1,g=new C,p=new C;for(let y=0;y<=m;y++){let v=0,x=0,A=0,T=0;if(y<=n){const b=y/n,S=b*Math.PI/2;x=-h-t*Math.cos(S),A=t*Math.sin(S),T=-t*Math.cos(S),v=b*u}else if(y<=n+s){const b=(y-n)/s;x=-h+b*e,A=t,T=0,v=u+b*d}else{const b=(y-n-s)/n,S=b*Math.PI/2;x=h+t*Math.sin(S),A=t*Math.cos(S),T=t*Math.sin(S),v=u+d+b*u}const R=Math.max(0,Math.min(1,v/f));let P=0;y===0?P=.5/i:y===m&&(P=-.5/i);for(let b=0;b<=i;b++){const S=b/i,I=S*Math.PI*2,B=Math.sin(I),k=Math.cos(I);p.x=-A*k,p.y=x,p.z=A*B,o.push(p.x,p.y,p.z),g.set(-A*k,T,A*B),g.normalize(),l.push(g.x,g.y,g.z),c.push(S+P,R)}if(y>0){const b=(y-1)*_;for(let S=0;S<i;S++){const I=b+S,B=b+S+1,k=y*_+S,V=y*_+S+1;a.push(I,B,k),a.push(B,V,k)}}}this.setIndex(a),this.setAttribute("position",new St(o,3)),this.setAttribute("normal",new St(l,3)),this.setAttribute("uv",new St(c,2))}copy(t){return super.copy(t),this.parameters=Object.assign({},t.parameters),this}static fromJSON(t){return new bl(t.radius,t.height,t.capSegments,t.radialSegments,t.heightSegments)}}class El extends Zt{constructor(t=1,e=32,n=0,i=Math.PI*2){super(),this.type="CircleGeometry",this.parameters={radius:t,segments:e,thetaStart:n,thetaLength:i},e=Math.max(3,e);const s=[],a=[],o=[],l=[],c=new C,h=new K;a.push(0,0,0),o.push(0,0,1),l.push(.5,.5);for(let u=0,d=3;u<=e;u++,d+=3){const f=n+u/e*i;c.x=t*Math.cos(f),c.y=t*Math.sin(f),a.push(c.x,c.y,c.z),o.push(0,0,1),h.x=(a[d]/t+1)/2,h.y=(a[d+1]/t+1)/2,l.push(h.x,h.y)}for(let u=1;u<=e;u++)s.push(u,u+1,0);this.setIndex(s),this.setAttribute("position",new St(a,3)),this.setAttribute("normal",new St(o,3)),this.setAttribute("uv",new St(l,2))}copy(t){return super.copy(t),this.parameters=Object.assign({},t.parameters),this}static fromJSON(t){return new El(t.radius,t.segments,t.thetaStart,t.thetaLength)}}class da extends Zt{constructor(t=1,e=1,n=1,i=32,s=1,a=!1,o=0,l=Math.PI*2){super(),this.type="CylinderGeometry",this.parameters={radiusTop:t,radiusBottom:e,height:n,radialSegments:i,heightSegments:s,openEnded:a,thetaStart:o,thetaLength:l};const c=this;i=Math.floor(i),s=Math.floor(s);const h=[],u=[],d=[],f=[];let m=0;const _=[],g=n/2;let p=0;y(),a===!1&&(t>0&&v(!0),e>0&&v(!1)),this.setIndex(h),this.setAttribute("position",new St(u,3)),this.setAttribute("normal",new St(d,3)),this.setAttribute("uv",new St(f,2));function y(){const x=new C,A=new C;let T=0;const R=(e-t)/n;for(let P=0;P<=s;P++){const b=[],S=P/s,I=S*(e-t)+t;for(let B=0;B<=i;B++){const k=B/i,V=k*l+o,Z=Math.sin(V),W=Math.cos(V);A.x=I*Z,A.y=-S*n+g,A.z=I*W,u.push(A.x,A.y,A.z),x.set(Z,R,W).normalize(),d.push(x.x,x.y,x.z),f.push(k,1-S),b.push(m++)}_.push(b)}for(let P=0;P<i;P++)for(let b=0;b<s;b++){const S=_[b][P],I=_[b+1][P],B=_[b+1][P+1],k=_[b][P+1];(t>0||b!==0)&&(h.push(S,I,k),T+=3),(e>0||b!==s-1)&&(h.push(I,B,k),T+=3)}c.addGroup(p,T,0),p+=T}function v(x){const A=m,T=new K,R=new C;let P=0;const b=x===!0?t:e,S=x===!0?1:-1;for(let B=1;B<=i;B++)u.push(0,g*S,0),d.push(0,S,0),f.push(.5,.5),m++;const I=m;for(let B=0;B<=i;B++){const V=B/i*l+o,Z=Math.cos(V),W=Math.sin(V);R.x=b*W,R.y=g*S,R.z=b*Z,u.push(R.x,R.y,R.z),d.push(0,S,0),T.x=Z*.5+.5,T.y=W*.5*S+.5,f.push(T.x,T.y),m++}for(let B=0;B<i;B++){const k=A+B,V=I+B;x===!0?h.push(V,V+1,k):h.push(V+1,V,k),P+=3}c.addGroup(p,P,x===!0?1:2),p+=P}}copy(t){return super.copy(t),this.parameters=Object.assign({},t.parameters),this}static fromJSON(t){return new da(t.radiusTop,t.radiusBottom,t.height,t.radialSegments,t.heightSegments,t.openEnded,t.thetaStart,t.thetaLength)}}class fa extends da{constructor(t=1,e=1,n=32,i=1,s=!1,a=0,o=Math.PI*2){super(0,t,e,n,i,s,a,o),this.type="C
40oneGeometry",this.parameters={radius:t,height:e,radialSegments:n,heightSegments:i,openEnded:s,thetaStart:a,thetaLength:o}}static fromJSON(t){return new fa(t.radius,t.height,t.radialSegments,t.heightSegments,t.openEnded,t.thetaStart,t.thetaLength)}}class bi extends Zt{constructor(t=[],e=[],n=1,i=0){super(),this.type="PolyhedronGeometry",this.parameters={vertices:t,indices:e,radius:n,detail:i};const s=[],a=[];o(i),c(n),h(),this.setAttribute("position",new St(s,3)),this.setAttribute("normal",new St(s.slice(),3)),this.setAttribute("uv",new St(a,2)),i===0?this.computeVertexNormals():this.normalizeNormals();function o(y){const v=new C,x=new C,A=new C;for(let T=0;T<e.length;T+=3)f(e[T+0],v),f(e[T+1],x),f(e[T+2],A),l(v,x,A,y)}function l(y,v,x,A){const T=A+1,R=[];for(let P=0;P<=T;P++){R[P]=[];const b=y.clone().lerp(x,P/T),S=v.clone().lerp(x,P/T),I=T-P;for(let B=0;B<=I;B++)B===0&&P===T?R[P][B]=b:R[P][B]=b.clone().lerp(S,B/I)}for(let P=0;P<T;P++)for(let b=0;b<2*(T-P)-1;b++){const S=Math.floor(b/2);b%2===0?(d(R[P][S+1]),d(R[P+1][S]),d(R[P][S])):(d(R[P][S+1]),d(R[P+1][S+1]),d(R[P+1][S]))}}function c(y){const v=new C;for(let x=0;x<s.length;x+=3)v.x=s[x+0],v.y=s[x+1],v.z=s[x+2],v.normalize().multiplyScalar(y),s[x+0]=v.x,s[x+1]=v.y,s[x+2]=v.z}function h(){const y=new C;for(let v=0;v<s.length;v+=3){y.x=s[v+0],y.y=s[v+1],y.z=s[v+2];const x=g(y)/2/Math.PI+.5,A=p(y)/Math.PI+.5;a.push(x,1-A)}m(),u()}function u(){for(let y=0;y<a.length;y+=6){const v=a[y+0],x=a[y+2],A=a[y+4],T=Math.max(v,x,A),R=Math.min(v,x,A);T>.9&&R<.1&&(v<.2&&(a[y+0]+=1),x<.2&&(a[y+2]+=1),A<.2&&(a[y+4]+=1))}}function d(y){s.push(y.x,y.y,y.z)}function f(y,v){const x=y*3;v.x=t[x+0],v.y=t[x+1],v.z=t[x+2]}function m(){const y=new C,v=new C,x=new C,A=new C,T=new K,R=new K,P=new K;for(let b=0,S=0;b<s.length;b+=9,S+=6){y.set(s[b+0],s[b+1],s[b+2]),v.set(s[b+3],s[b+4],s[b+5]),x.set(s[b+6],s[b+7],s[b+8]),T.set(a[S+0],a[S+1]),R.set(a[S+2],a[S+3]),P.set(a[S+4],a[S+5]),A.copy(y).add(v).add(x).divideScalar(3);const I=g(A);_(T,S+0,y,I),_(R,S+2,v,I),_(P,S+4,x,I)}}function _(y,v,x,A){A<0&&y.x===1&&(a[v]=y.x-1),x.x===0&&x.z===0&&(a[v]=A/2/Math.PI+.5)}function g(y){return Math.atan2(y.z,-y.x)}function p(y){return Math.atan2(-y.y,Math.sqrt(y.x*y.x+y.z*y.z))}}copy(t){return super.copy(t),this.parameters=Object.assign({},t.parameters),this}static fromJSON(t){return new bi(t.vertices,t.indices,t.radius,t.details)}}class Tl extends bi{constructor(t=1,e=0){const n=(1+Math.sqrt(5))/2,i=1/n,s=[-1,-1,-1,-1,-1,1,-1,1,-1,-1,1,1,1,-1,-1,1,-1,1,1,1,-1,1,1,1,0,-i,-n,0,-i,n,0,i,-n,0,i,n,-i,-n,0,-i,n,0,i,-n,0,i,n,0,-n,0,-i,n,0,-i,-n,0,i,n,0,i],a=[3,11,7,3,7,15,3,15,13,7,19,17,7,17,6,7,6,15,17,4,8,17,8,10,17,10,6,8,0,16,8,16,2,8,2,10,0,12,1,0,1,18,0,18,16,6,10,2,6,2,13,6,13,15,2,16,18,2,18,3,2,3,13,18,1,9,18,9,11,18,11,3,4,14,12,4,12,0,4,0,8,11,9,5,11,5,19,11,19,7,
vendor: 7,213 bytes, line 40
4019,5,14,19,14,4,19,4,17,1,12,14,1,14,5,1,5,9];super(s,a,t,e),this.type="DodecahedronGeometry",this.parameters={radius:t,detail:e}}static fromJSON(t){return new Tl(t.radius,t.detail)}}const Tr=new C,Ar=new C,$a=new C,wr=new Ze;class Of extends Zt{constructor(t=null,e=1){if(super(),this.type="EdgesGeometry",this.parameters={geometry:t,thresholdAngle:e},t!==null){const i=Math.pow(10,4),s=Math.cos(_i*e),a=t.getIndex(),o=t.getAttribute("position"),l=a?a.count:o.count,c=[0,0,0],h=["a","b","c"],u=new Array(3),d={},f=[];for(let m=0;m<l;m+=3){a?(c[0]=a.getX(m),c[1]=a.getX(m+1),c[2]=a.getX(m+2)):(c[0]=m,c[1]=m+1,c[2]=m+2);const{a:_,b:g,c:p}=wr;if(_.fromBufferAttribute(o,c[0]),g.fromBufferAttribute(o,c[1]),p.fromBufferAttribute(o,c[2]),wr.getNormal($a),u[0]=`${Math.round(_.x*i)},${Math.round(_.y*i)},${Math.round(_.z*i)}`,u[1]=`${Math.round(g.x*i)},${Math.round(g.y*i)},${Math.round(g.z*i)}`,u[2]=`${Math.round(p.x*i)},${Math.round(p.y*i)},${Math.round(p.z*i)}`,!(u[0]===u[1]||u[1]===u[2]||u[2]===u[0]))for(let y=0;y<3;y++){const v=(y+1)%3,x=u[y],A=u[v],T=wr[h[y]],R=wr[h[v]],P=`${x}_${A}`,b=`${A}_${x}`;b in d&&d[b]?($a.dot(d[b].normal)<=s&&(f.push(T.x,T.y,T.z),f.push(R.x,R.y,R.z)),d[b]=null):P in d||(d[P]={index0:c[y],index1:c[v],normal:$a.clone()})}}for(const m in d)if(d[m]){const{index0:_,index1:g}=d[m];Tr.fromBufferAttribute(o,_),Ar.fromBufferAttribute(o,g),f.push(Tr.x,Tr.y,Tr.z),f.push(Ar.x,Ar.y,Ar.z)}this.setAttribute("position",new St(f,3))}}copy(t){return super.copy(t),this.parameters=Object.assign({},t.parameters),this}}class _n{constructor(){this.type="Curve",this.arcLengthDivisions=200,this.needsUpdate=!1,this.cacheArcLengths=null}getPoint(){console.warn("THREE.Curve: .getPoint() not implemented.")}getPointAt(t,e){const n=this.getUtoTmapping(t);return this.getPoint(n,e)}getPoints(t=5){const e=[];for(let n=0;n<=t;n++)e.push(this.getPoint(n/t));return e}getSpacedPoints(t=5){const e=[];for(let n=0;n<=t;n++)e.push(this.getPointAt(n/t));return e}getLength(){const t=this.getLengths();return t[t.length-1]}getLengths(t=this.arcLengthDivisions){if(this.cacheArcLengths&&this.cacheArcLengths.length===t+1&&!this.needsUpdate)return this.cacheArcLengths;this.needsUpdate=!1;const e=[];let n,i=this.getPoint(0),s=0;e.push(0);for(let a=1;a<=t;a++)n=this.getPoint(a/t),s+=n.distanceTo(i),e.push(s),i=n;return this.cacheArcLengths=e,e}updateArcLengths(){this.needsUpdate=!0,this.getLengths()}getUtoTmapping(t,e=null){const n=this.getLengths();let i=0;const s=n.length;let a;e?a=e:a=t*n[s-1];let o=0,l=s-1,c;for(;o<=l;)if(i=Math.floor(o+(l-o)/2),c=n[i]-a,c<0)o=i+1;else if(c>0)l=i-1;else{l=i;break}if(i=l,n[i]===a)return i/(s-1);const h=n[i],d=n[i+1]-h,f=(a-h)/d;return(i+f)/(s-1)}getTangent(t,e){let i=t-1e-4,s=t+1e-4;i<0&&(i=0),s>1&&(s=1);const a=this.getPoint(i),o=this.getPoint(s),l=e||(a.isVector2?new K:new C);return l.copy(o).sub(a).normalize(),l}getTangentAt(t,e){const n=this.getUtoTmapping(t);return this.getTangent(n,e)}computeFrenetFrames(t,e=!1){const n=new C,i=[],s=[],a=[],o=new C,l=new zt;for(let f=0;f<=t;f++){const m=f/t;i[f]=this.getTangentAt(m,new C)}s[0]=new C,a[0]=new C;let c=Number.MAX_VALUE;const h=Math.abs(i[0].x),u=Math.abs(i[0].y),d=Math.abs(i[0].z);h<=c&&(c=h,n.set(1,0,0)),u<=c&&(c=u,n.set(0,1,0)),d<=c&&n.set(0,0,1),o.crossVectors(i[0],n).normalize(),s[0].crossVectors(i[0],o),a[0].crossVectors(i[0],s[0]);for(let f=1;f<=t;f++){if(s[f]=s[f-1].clone(),a[f]=a[f-1].clone(),o.crossVectors(i[f-1],i[f]),o.length()>Number.EPSILON){o.normalize();const m=Math.acos(Nt(i[f-1].dot(i[f]),-1,1));s[f].applyMatrix4(l.makeRotationAxis(o,m))}a[f].crossVectors(i[f],s[f])}if(e===!0){let f=Math.acos(Nt(s[0].dot(s[t]),-1,1));f/=t,i[0].dot(o.crossVectors(s[0],s[t]))>0&&(f=-f);for(let m=1;m<=t;m++)s[m].applyMatrix4(l.makeRotationAxis(i[m],f*m)),a[m].crossVectors(i[m],s[m])}return{tangents:i,normals:s,binormals:a}}clone(){return new this.constructor().copy(this)}copy(t){return this.arcLengthDivisions=t.arcLengthDivisions,this}toJSON(){const t={metadata:{version:4.7,type:"Curve",generator:"Curve.toJSON"}};return t.arcLengthDivisions=this.arcLengthDivisions,t.type=this.type,t}fromJSON(t){return this.arcLengthDivisions=t.arcLengthDivisions,this}}class Al extends _n{constructor(t=0,e=0,n=1,i=1,s=0,a=Math.PI*2,o=!1,l=0){super(),this.isEllipseCurve=!0,this.type="EllipseCurve",this.aX=t,this.aY=e,this.xRadius=n,this.yRadius=i,this.aStartAngle=s,this.aEndAngle=a,this.aClockwise=o,this.aRotation=l}getPoint(t,e=new K){const n=e,i=Math.PI*2;let s=this.aEndAngle-this.aStartAngle;const a=Math.abs(s)<Number.EPSILON;for(;s<0;)s+=i;for(;s>i;)s-=i;s<Number.EPSILON&&(a?s=0:s=i),this.aClockwise===!0&&!a&&(s===i?s=-i:s=s-i);const o=this.aStartAngle+t*s;let l=this.aX+this.xRadius*Math.cos(o),c=this.aY+this.yRadius*Math.sin(o);if(this.aRotation!==0){const h=Math.cos(this.aRotation),u=Math.sin(this.aRotation),d=l-this.aX,f=c-this.aY;l=d*h-f*u+this.aX,c=d*u+f*h+this.aY}return n.set(l,c)}copy(t){return super.copy(t),this.aX=t.aX,this.aY=t.aY,this.xRadius=t.xRadius,this.yRadius=t.yRadius,this.aStartAngle=t.aStartAngle,this.aEndAngle=t.aEndAngle,this.aClockwise=t.aClockwise,this.aRotation=t.aRotation,this}toJSON(){const t=super.toJSON();return t.aX=this.aX,t.aY=this.aY,t.xRadius=this.xRadius,t.yRadius=this.yRadius,t.aStartAngle=this.aStartAngle,t.aEndAngle=this.aEndAngle,t.aClockwise=this.aClockwise,t.aRotation=this.aRotation,t}fromJSON(t){return super.fromJSON(t),this.aX=t.aX,this.aY=t.aY,this.xRadius=t.xRadius,this.yRadius=t.yRadius,this.aStartAngle=t.aStartAngle,this.aEndAngle=t.aEndAngle,this.aClockwise=t.aClockwise,this.aRotation=t.aRotation,this}}class Bf extends Al{constructor(t,e,n,i,s,a){super(t,e,n,n,i,s,a),this.isArcCurve=!0,this.type="ArcCurve"}}function wl(){let r=0,t=0,e=0,n=0;function i(s,a,o,l){r=s,t=o,e=-3*s+3*a-2*o-l,n=2*s-2*a+o+l}return{initCatmullRom:function(s,a,o,l,c){i(a,o,c*(o-s),c*(l-a))},initNonuniformCatmullRom:function(s,a,o,l,c,h,u){let d=(a-s)/c-(o-s)/(c+h)+(o-a)/h,f=(o-a)/h-(l-a)/(h+u)+(l-o)/u;d*=h,f*=h,i(a,o,d,f)},calc:function(s){const a=s*s,o=a*s;return r+t*s+e*a+n*o}}}const Cr=new C,Ka=new wl,Qa=new wl,ja=new wl;class zf extends _n{constructor(t=[],e=!1,n="centripetal",i=.5){super(),this.isCatmullRomCurve3=!0,this.type="CatmullRomCurve3",this.points=t,this.closed=e,this.curveType=n,this.tension=i}getPoint(t,e=new C){const n=e,i=this.points,s=i.length,a=(s-(this.closed?0:1))*t;let o=Math.floor(a),l=a-o;this.closed?o+=o>0?0:(Math.floor(Math.abs(o)/s)+1)*s:l===0&&o===s-1&&(o=s-2,l=1);let c,h;this.closed||o>0?c=i[(o-1)%s]:(Cr.subVectors(i[0],i[1]).add(i[0]),c=Cr);const u=i[o%s],d=i[(o+1)%s];if(this.closed||o+2<s?h=i[(o+2)%s]:(Cr.subVectors(i[s-1],i[s-2]).add(i[s-1]),h=Cr),this.curveType==="centripetal"||this.curveType==="chordal"){const f=this.curveType==="chordal"?.5:.25;let m=Math.pow(c.distanceToSquared(u),f),_=Math.pow(u.distanceToSquared(d),f),g=Math.pow(d.distanceToSquared(h),f);_<1e-4&&(_=1),m<1e-4&&(m=_),g<1e-4&&(g=_),Ka.initNonuniformCatmullRom(c.x,u.x,d.x,h.x,m,_,g),Qa.initNonuniformCatmullRom(c.y,u.y,d.y,h.y,m,_,g),ja.initNonuniformCatmullRom(c.z,u.z,d.z,h.z,m,_,g)}else this.curveType==="catmullrom"&&(Ka.initCatmullRom(c.x,u.x,d.x,h.x,this.tension),Qa.initCatmullRom(c.y,u.y,d.y,h.y,this.tension),ja.init
vendor: 11,839 bytes, line 40
40CatmullRom(c.z,u.z,d.z,h.z,this.tension));return n.set(Ka.calc(l),Qa.calc(l),ja.calc(l)),n}copy(t){super.copy(t),this.points=[];for(let e=0,n=t.points.length;e<n;e++){const i=t.points[e];this.points.push(i.clone())}return this.closed=t.closed,this.curveType=t.curveType,this.tension=t.tension,this}toJSON(){const t=super.toJSON();t.points=[];for(let e=0,n=this.points.length;e<n;e++){const i=this.points[e];t.points.push(i.toArray())}return t.closed=this.closed,t.curveType=this.curveType,t.tension=this.tension,t}fromJSON(t){super.fromJSON(t),this.points=[];for(let e=0,n=t.points.length;e<n;e++){const i=t.points[e];this.points.push(new C().fromArray(i))}return this.closed=t.closed,this.curveType=t.curveType,this.tension=t.tension,this}}function kc(r,t,e,n,i){const s=(n-t)*.5,a=(i-e)*.5,o=r*r,l=r*o;return(2*e-2*n+s+a)*l+(-3*e+3*n-2*s-a)*o+s*r+e}function kf(r,t){const e=1-r;return e*e*t}function Vf(r,t){return 2*(1-r)*r*t}function Hf(r,t){return r*r*t}function Ps(r,t,e,n){return kf(r,t)+Vf(r,e)+Hf(r,n)}function Gf(r,t){const e=1-r;return e*e*e*t}function Wf(r,t){const e=1-r;return 3*e*e*r*t}function Xf(r,t){return 3*(1-r)*r*r*t}function qf(r,t){return r*r*r*t}function Ls(r,t,e,n,i){return Gf(r,t)+Wf(r,e)+Xf(r,n)+qf(r,i)}class iu extends _n{constructor(t=new K,e=new K,n=new K,i=new K){super(),this.isCubicBezierCurve=!0,this.type="CubicBezierCurve",this.v0=t,this.v1=e,this.v2=n,this.v3=i}getPoint(t,e=new K){const n=e,i=this.v0,s=this.v1,a=this.v2,o=this.v3;return n.set(Ls(t,i.x,s.x,a.x,o.x),Ls(t,i.y,s.y,a.y,o.y)),n}copy(t){return super.copy(t),this.v0.copy(t.v0),this.v1.copy(t.v1),this.v2.copy(t.v2),this.v3.copy(t.v3),this}toJSON(){const t=super.toJSON();return t.v0=this.v0.toArray(),t.v1=this.v1.toArray(),t.v2=this.v2.toArray(),t.v3=this.v3.toArray(),t}fromJSON(t){return super.fromJSON(t),this.v0.fromArray(t.v0),this.v1.fromArray(t.v1),this.v2.fromArray(t.v2),this.v3.fromArray(t.v3),this}}class Yf extends _n{constructor(t=new C,e=new C,n=new C,i=new C){super(),this.isCubicBezierCurve3=!0,this.type="CubicBezierCurve3",this.v0=t,this.v1=e,this.v2=n,this.v3=i}getPoint(t,e=new C){const n=e,i=this.v0,s=this.v1,a=this.v2,o=this.v3;return n.set(Ls(t,i.x,s.x,a.x,o.x),Ls(t,i.y,s.y,a.y,o.y),Ls(t,i.z,s.z,a.z,o.z)),n}copy(t){return super.copy(t),this.v0.copy(t.v0),this.v1.copy(t.v1),this.v2.copy(t.v2),this.v3.copy(t.v3),this}toJSON(){const t=super.toJSON();return t.v0=this.v0.toArray(),t.v1=this.v1.toArray(),t.v2=this.v2.toArray(),t.v3=this.v3.toArray(),t}fromJSON(t){return super.fromJSON(t),this.v0.fromArray(t.v0),this.v1.fromArray(t.v1),this.v2.fromArray(t.v2),this.v3.fromArray(t.v3),this}}class su extends _n{constructor(t=new K,e=new K){super(),this.isLineCurve=!0,this.type="LineCurve",this.v1=t,this.v2=e}getPoint(t,e=new K){const n=e;return t===1?n.copy(this.v2):(n.copy(this.v2).sub(this.v1),n.multiplyScalar(t).add(this.v1)),n}getPointAt(t,e){return this.getPoint(t,e)}getTangent(t,e=new K){return e.subVectors(this.v2,this.v1).normalize()}getTangentAt(t,e){return this.getTangent(t,e)}copy(t){return super.copy(t),this.v1.copy(t.v1),this.v2.copy(t.v2),this}toJSON(){const t=super.toJSON();return t.v1=this.v1.toArray(),t.v2=this.v2.toArray(),t}fromJSON(t){return super.fromJSON(t),this.v1.fromArray(t.v1),this.v2.fromArray(t.v2),this}}class Zf extends _n{constructor(t=new C,e=new C){super(),this.isLineCurve3=!0,this.type="LineCurve3",this.v1=t,this.v2=e}getPoint(t,e=new C){const n=e;return t===1?n.copy(this.v2):(n.copy(this.v2).sub(this.v1),n.multiplyScalar(t).add(this.v1)),n}getPointAt(t,e){return this.getPoint(t,e)}getTangent(t,e=new C){return e.subVectors(this.v2,this.v1).normalize()}getTangentAt(t,e){return this.getTangent(t,e)}copy(t){return super.copy(t),this.v1.copy(t.v1),this.v2.copy(t.v2),this}toJSON(){const t=super.toJSON();return t.v1=this.v1.toArray(),t.v2=this.v2.toArray(),t}fromJSON(t){return super.fromJSON(t),this.v1.fromArray(t.v1),this.v2.fromArray(t.v2),this}}class ru extends _n{constructor(t=new K,e=new K,n=new K){super(),this.isQuadraticBezierCurve=!0,this.type="QuadraticBezierCurve",this.v0=t,this.v1=e,this.v2=n}getPoint(t,e=new K){const n=e,i=this.v0,s=this.v1,a=this.v2;return n.set(Ps(t,i.x,s.x,a.x),Ps(t,i.y,s.y,a.y)),n}copy(t){return super.copy(t),this.v0.copy(t.v0),this.v1.copy(t.v1),this.v2.copy(t.v2),this}toJSON(){const t=super.toJSON();return t.v0=this.v0.toArray(),t.v1=this.v1.toArray(),t.v2=this.v2.toArray(),t}fromJSON(t){return super.fromJSON(t),this.v0.fromArray(t.v0),this.v1.fromArray(t.v1),this.v2.fromArray(t.v2),this}}class au extends _n{constructor(t=new C,e=new C,n=new C){super(),this.isQuadraticBezierCurve3=!0,this.type="QuadraticBezierCurve3",this.v0=t,this.v1=e,this.v2=n}getPoint(t,e=new C){const n=e,i=this.v0,s=this.v1,a=this.v2;return n.set(Ps(t,i.x,s.x,a.x),Ps(t,i.y,s.y,a.y),Ps(t,i.z,s.z,a.z)),n}copy(t){return super.copy(t),this.v0.copy(t.v0),this.v1.copy(t.v1),this.v2.copy(t.v2),this}toJSON(){const t=super.toJSON();return t.v0=this.v0.toArray(),t.v1=this.v1.toArray(),t.v2=this.v2.toArray(),t}fromJSON(t){return super.fromJSON(t),this.v0.fromArray(t.v0),this.v1.fromArray(t.v1),this.v2.fromArray(t.v2),this}}class ou extends _n{constructor(t=[]){super(),this.isSplineCurve=!0,this.type="SplineCurve",this.points=t}getPoint(t,e=new K){const n=e,i=this.points,s=(i.length-1)*t,a=Math.floor(s),o=s-a,l=i[a===0?a:a-1],c=i[a],h=i[a>i.length-2?i.length-1:a+1],u=i[a>i.length-3?i.length-1:a+2];return n.set(kc(o,l.x,c.x,h.x,u.x),kc(o,l.y,c.y,h.y,u.y)),n}copy(t){super.copy(t),this.points=[];for(let e=0,n=t.points.length;e<n;e++){const i=t.points[e];this.points.push(i.clone())}return this}toJSON(){const t=super.toJSON();t.points=[];for(let e=0,n=this.points.length;e<n;e++){const i=this.points[e];t.points.push(i.toArray())}return t}fromJSON(t){super.fromJSON(t),this.points=[];for(let e=0,n=t.points.length;e<n;e++){const i=t.points[e];this.points.push(new K().fromArray(i))}return this}}var sa=Object.freeze({__proto__:null,ArcCurve:Bf,CatmullRomCurve3:zf,CubicBezierCurve:iu,CubicBezierCurve3:Yf,EllipseCurve:Al,LineCurve:su,LineCurve3:Zf,QuadraticBezierCurve:ru,QuadraticBezierCurve3:au,SplineCurve:ou});class Jf extends _n{constructor(){super(),this.type="CurvePath",this.curves=[],this.autoClose=!1}add(t){this.curves.push(t)}closePath(){const t=this.curves[0].getPoint(0),e=this.curves[this.curves.length-1].getPoint(1);if(!t.equals(e)){const n=t.isVector2===!0?"LineCurve":"LineCurve3";this.curves.push(new sa[n](e,t))}return this}getPoint(t,e){const n=t*this.getLength(),i=this.getCurveLengths();let s=0;for(;s<i.length;){if(i[s]>=n){const a=i[s]-n,o=this.curves[s],l=o.getLength(),c=l===0?0:1-a/l;return o.getPointAt(c,e)}s++}return null}getLength(){const t=this.getCurveLengths();return t[t.length-1]}updateArcLengths(){this.needsUpdate=!0,this.cacheLengths=null,this.getCurveLengths()}getCurveLengths(){if(this.cacheLengths&&this.cacheLengths.length===this.curves.length)return this.cacheLengths;const t=[];let e=0;for(let n=0,i=this.curves.length;n<i;n++)e+=this.curves[n].getLength(),t.push(e);return this.cacheLengths=t,t}getSpacedPoints(t=40){const e=[];for(let n=0;n<=t;n++)e.push(this.getPoint(n/t));return this.autoClose&&e.push(e[0]),e}getPoints(t=12){const e=[];let n;for(let i=0,s=this.curves;i<s.length;i++){const a=s[i],o=a.isEllipseCurve?t*2:a.isLineCurve||a.isLineCurve3?1:a.isSplineCurve?t*a.points.length:t,l=a.getPoints(o);for(let c=0;c<l.length;c++){const h=l[c];n&&n.equals(h)||(e.push(h),n=h)}}return this.autoClose&&e.length>1&&!e[e.length-1].equals(e[0])&&e.push(e[0]),e}copy(t){super.copy(t),this.curves=[];for(let e=0,n=t.curves.length;e<n;e++){const i=t.curves[e];this.curves.push(i.clone())}return this.autoClose=t.autoClose,this}toJSON(){const t=super.toJSON();t.autoClose=this.autoClose,t.curves=[];for(let e=0,n=this.curves.length;e<n;e++){const i=this.curves[e];t.curves.push(i.toJSON())}return t}fromJSON(t){super.fromJSON(t),this.autoClose=t.autoClose,this.curves=[];for(let e=0,n=t.curves.length;e<n;e++){const i=t.curves[e];this.curves.push(new sa[i.type]().fromJSON(i))}return this}}class Ko extends Jf{constructor(t){super(),this.type="Path",this.currentPoint=new K,t&&this.setFromPoints(t)}setFromPoints(t){this.moveTo(t[0].x,t[0].y);for(let e=1,n=t.length;e<n;e++)this.lineTo(t[e].x,t[e].y);return this}moveTo(t,e){return this.currentPoint.set(t,e),this}lineTo(t,e){const n=new su(this.currentPoint.clone(),new K(t,e));return this.curves.push(n),this.currentPoint.set(t,e),this}quadraticCurveTo(t,e,n,i){const s=new ru(this.currentPoint.clone(),new K(t,e),new K(n,i));return this.curves.push(s),this.currentPoint.set(n,i),this}bezierCurveTo(t,e,n,i,s,a){const o=new iu(this.currentPoint.clone(),new K(t,e),new K(n,i),new K(s,a));return this.curves.push(o),this.currentPoint.set(s,a),this}splineThru(t){const e=[this.currentPoint.clone()].concat(t),n=new ou(e);return this.curves.push(n),this.currentPoint.copy(t[t.length-1]),this}arc(t,e,n,i,s,a){const o=this.currentPoint.x,l=this.currentPoint.y;return this.absarc(t+o,e+l,n,i,s,a),this}absarc(t,e,n,i,s,a){return this.absellipse(t,e,n,n,i,s,a),this}ellipse(t,e,n,i,s,a,o,l){const c=this.currentPoint.x,h=this.currentPoint.y;return this.absellipse(t+c,e+h,n,i,s,a,o,l),this}absellipse(t,e,n,i,s,a,o,l){const c=new Al(t,e,n,i,s,a,o,l);if(this.curves.length>0){const u=c.getPoint(0);u.equals(this.currentPoint)||this.lineTo(u.x,u.y)}this.curves.push(c);const h=c.getPoint(1);return this.currentPoint.copy(h),this}copy(t){return super.copy(t),this.currentPoint.copy(t.currentPoint),this}toJSON(){const t=super.toJSON();return t.currentPoint=this.currentPoint.toArray(),t}fromJSON(t){return super.fromJSON(t),this.currentPoint.fromArray(t.currentPoint),this}}class es extends Ko{constructor(t){super(t),this.uuid=$e(),this.type="Shape",this.holes=[]}getPointsHoles(t){const e=[];for(let n=0,i=this.holes.length;n<i;n++)e[n]=this.holes[n].getPoints(t);return e}extractPoints(t){return{shape:this.getPoints(t),holes:this.getPointsHoles(t)}}copy(t){super.copy(t),this.holes=[];for(let e=0,n=t.holes.length;e<n;e++){const i=t.holes[e];this.holes.push(i.clone())}return this}toJSON(){const t=super.toJSON();t.uuid=this.uuid,t.holes=[];for(let e=0,n=this.holes.length;e<n;e++){const i=this.holes[e];t.holes.push(i.toJSON())}return t}fromJSON(t){super.fromJSON(t),this.uuid=t.uuid,this.holes=[];for(let e=0,n=t.holes.length;e<n;e++){const i=t.holes[e];this.holes.push(new Ko().fromJSON(i))}return this}}function $f(r,t,e=2){const n=t&&t.length,i=n?t[0]*e:r.length;let s=lu(r,0,i,e,!0);const a=[];if(!s||s.next===s.prev)return a;let o,l,c;if(n&&(s=ep(r,t,s,e)),r.length>80*e){o=1/0,l=1/0;let h=-1/0,u=-1/0;for(let d=e;d<i;d+=e){const f=r[d],m=r[d+1];f<o&&(o=f),m<l&&(l=m),f>h&&(h=f),m>u&&(u=m)}c=Math.max(h-o,u-l),c=c!==0?32767/c:0}return ks(s,a,e,o,l,c,0),a}function lu(r,t,e,n,i){let s;if(i===dp(r,t,e,n)>0)for(let a=t;a<e;a+=n)s=Vc(a/n|0,r[a],r[a+1],s);else for(let a=e-n;a>=t;a-=n)s=Vc(a/n|0,r[a],r[a+1],s);return s&&os(s,s.next)&&(Hs(s),s=s.next),s}function yi(r,t){if(!r)return r;t||(t=r);let e=r,n;do if(n=!1,!e.steiner&&(os(e,e.next)||pe(e.prev,e,e.next)===0)){if(Hs(e),e=t=e.prev,e===e.next)break;n=!0}else e=e.next;while(n||e!==t);return t}function ks(r,t,e,n,i,s,a){if(!r)return;!a&&s&&ap(r,n,i,s);let o=r;for(;r.prev!==r.next;){const l=r.prev,c=r.next;if(s?Qf(r,n,i,s):Kf(r)){t.push(l.i,r.i,c.i),Hs(r),r=c.next,o=c.next;continue}if(r=c,r===o){a?a===1?(r=jf(yi(r),t),ks(r,t,e,n,i,s,2)):a===2&&tp(r,t,e,n,i,s):ks(yi(r),t,e,n,i,s,1);break}}}function Kf(r){const t=r.prev,e=r,n=r.next;if(pe(t,e,n)>=0)return!1;const i=t.x,s=e.x,a=n.x,o=t.y,l=e.y,c=n.y,h=Math.min(i,s,a),u=Math.min(o,l,c),d=Math.max(i,s,a),f=Math.max(o,l,c);let m=n.next;for(;m!==t;){if(m.x>=h&&m.x<=d&&m.y>=u&&m.y<=f&&Cs(i,o,s,l,a,c,m.x,m.y)&&pe(m.prev,m,m.next)>=0)return!1;m=m.next}return!0}function Qf(r,t,e,n){const i=r.prev,s=r,a=r.next;if(pe(i,s,a)>=0)return!1;
vendor: 1,346 bytes, line 40
40const o=i.x,l=s.x,c=a.x,h=i.y,u=s.y,d=a.y,f=Math.min(o,l,c),m=Math.min(h,u,d),_=Math.max(o,l,c),g=Math.max(h,u,d),p=Qo(f,m,t,e,n),y=Qo(_,g,t,e,n);let v=r.prevZ,x=r.nextZ;for(;v&&v.z>=p&&x&&x.z<=y;){if(v.x>=f&&v.x<=_&&v.y>=m&&v.y<=g&&v!==i&&v!==a&&Cs(o,h,l,u,c,d,v.x,v.y)&&pe(v.prev,v,v.next)>=0||(v=v.prevZ,x.x>=f&&x.x<=_&&x.y>=m&&x.y<=g&&x!==i&&x!==a&&Cs(o,h,l,u,c,d,x.x,x.y)&&pe(x.prev,x,x.next)>=0))return!1;x=x.nextZ}for(;v&&v.z>=p;){if(v.x>=f&&v.x<=_&&v.y>=m&&v.y<=g&&v!==i&&v!==a&&Cs(o,h,l,u,c,d,v.x,v.y)&&pe(v.prev,v,v.next)>=0)return!1;v=v.prevZ}for(;x&&x.z<=y;){if(x.x>=f&&x.x<=_&&x.y>=m&&x.y<=g&&x!==i&&x!==a&&Cs(o,h,l,u,c,d,x.x,x.y)&&pe(x.prev,x,x.next)>=0)return!1;x=x.nextZ}return!0}function jf(r,t){let e=r;do{const n=e.prev,i=e.next.next;!os(n,i)&&hu(n,e,e.next,i)&&Vs(n,i)&&Vs(i,n)&&(t.push(n.i,e.i,i.i),Hs(e),Hs(e.next),e=r=i),e=e.next}while(e!==r);return yi(e)}function tp(r,t,e,n,i,s){let a=r;do{let o=a.next.next;for(;o!==a.prev;){if(a.i!==o.i&&cp(a,o)){let l=uu(a,o);a=yi(a,a.next),l=yi(l,l.next),ks(a,t,e,n,i,s,0),ks(l,t,e,n,i,s,0);return}o=o.next}a=a.next}while(a!==r)}function ep(r,t,e,n){const i=[];for(let s=0,a=t.length;s<a;s++){const o=t[s]*n,l=s<a-1?t[s+1]*n:r.length,c=lu(r,o,l,n,!1);c===c.next&&(c.steiner=!0),i.push(lp(c))}i.sort(np);for(let s=0;s<i.length;s++)e=ip(i[s],e);return e}function np(r,t){let e=r.x-t.x;
vendor: 4,301 bytes, line 40
40if(e===0&&(e=r.y-t.y,e===0)){const n=(r.next.y-r.y)/(r.next.x-r.x),i=(t.next.y-t.y)/(t.next.x-t.x);e=n-i}return e}function ip(r,t){const e=sp(r,t);if(!e)return t;const n=uu(e,r);return yi(n,n.next),yi(e,e.next)}function sp(r,t){let e=t;const n=r.x,i=r.y;let s=-1/0,a;if(os(r,e))return e;do{if(os(r,e.next))return e.next;if(i<=e.y&&i>=e.next.y&&e.next.y!==e.y){const u=e.x+(i-e.y)*(e.next.x-e.x)/(e.next.y-e.y);if(u<=n&&u>s&&(s=u,a=e.x<e.next.x?e:e.next,u===n))return a}e=e.next}while(e!==t);if(!a)return null;const o=a,l=a.x,c=a.y;let h=1/0;e=a;do{if(n>=e.x&&e.x>=l&&n!==e.x&&cu(i<c?n:s,i,l,c,i<c?s:n,i,e.x,e.y)){const u=Math.abs(i-e.y)/(n-e.x);Vs(e,r)&&(u<h||u===h&&(e.x>a.x||e.x===a.x&&rp(a,e)))&&(a=e,h=u)}e=e.next}while(e!==o);return a}function rp(r,t){return pe(r.prev,r,t.prev)<0&&pe(t.next,r,r.next)<0}function ap(r,t,e,n){let i=r;do i.z===0&&(i.z=Qo(i.x,i.y,t,e,n)),i.prevZ=i.prev,i.nextZ=i.next,i=i.next;while(i!==r);i.prevZ.nextZ=null,i.prevZ=null,op(i)}function op(r){let t,e=1;do{let n=r,i;r=null;let s=null;for(t=0;n;){t++;let a=n,o=0;for(let c=0;c<e&&(o++,a=a.nextZ,!!a);c++);let l=e;for(;o>0||l>0&&a;)o!==0&&(l===0||!a||n.z<=a.z)?(i=n,n=n.nextZ,o--):(i=a,a=a.nextZ,l--),s?s.nextZ=i:r=i,i.prevZ=s,s=i;n=a}s.nextZ=null,e*=2}while(t>1);return r}function Qo(r,t,e,n,i){return r=(r-e)*i|0,t=(t-n)*i|0,r=(r|r<<8)&16711935,r=(r|r<<4)&252645135,r=(r|r<<2)&858993459,r=(r|r<<1)&1431655765,t=(t|t<<8)&16711935,t=(t|t<<4)&252645135,t=(t|t<<2)&858993459,t=(t|t<<1)&1431655765,r|t<<1}function lp(r){let t=r,e=r;do(t.x<e.x||t.x===e.x&&t.y<e.y)&&(e=t),t=t.next;while(t!==r);return e}function cu(r,t,e,n,i,s,a,o){return(i-a)*(t-o)>=(r-a)*(s-o)&&(r-a)*(n-o)>=(e-a)*(t-o)&&(e-a)*(s-o)>=(i-a)*(n-o)}function Cs(r,t,e,n,i,s,a,o){return!(r===a&&t===o)&&cu(r,t,e,n,i,s,a,o)}function cp(r,t){return r.next.i!==t.i&&r.prev.i!==t.i&&!hp(r,t)&&(Vs(r,t)&&Vs(t,r)&&up(r,t)&&(pe(r.prev,r,t.prev)||pe(r,t.prev,t))||os(r,t)&&pe(r.prev,r,r.next)>0&&pe(t.prev,t,t.next)>0)}function pe(r,t,e){return(t.y-r.y)*(e.x-t.x)-(t.x-r.x)*(e.y-t.y)}function os(r,t){return r.x===t.x&&r.y===t.y}function hu(r,t,e,n){const i=Ir(pe(r,t,e)),s=Ir(pe(r,t,n)),a=Ir(pe(e,n,r)),o=Ir(pe(e,n,t));return!!(i!==s&&a!==o||i===0&&Rr(r,e,t)||s===0&&Rr(r,n,t)||a===0&&Rr(e,r,n)||o===0&&Rr(e,t,n))}function Rr(r,t,e){return t.x<=Math.max(r.x,e.x)&&t.x>=Math.min(r.x,e.x)&&t.y<=Math.max(r.y,e.y)&&t.y>=Math.min(r.y,e.y)}function Ir(r){return r>0?1:r<0?-1:0}function hp(r,t){let e=r;do{if(e.i!==r.i&&e.next.i!==r.i&&e.i!==t.i&&e.next.i!==t.i&&hu(e,e.next,r,t))return!0;e=e.next}while(e!==r);return!1}function Vs(r,t){return pe(r.prev,r,r.next)<0?pe(r,t,r.next)>=0&&pe(r,r.prev,t)>=0:pe(r,t,r.prev)<0||pe(r,r.next,t)<0}function up(r,t){let e=r,n=!1;const i=(r.x+t.x)/2,s=(r.y+t.y)/2;do e.y>s!=e.next.y>s&&e.next.y!==e.y&&i<(e.next.x-e.x)*(s-e.y)/(e.next.y-e.y)+e.x&&(n=!n),e=e.next;while(e!==r);return n}function uu(r,t){const e=jo(r.i,r.x,r.y),n=jo(t.i,t.x,t.y),i=r.next,s=t.prev;return r.next=t,t.prev=r,e.next=i,i.prev=e,n.next=e,e.prev=n,s.next=n,n.prev=s,n}function Vc(r,t,e,n){const i=jo(r,t,e);return n?(i.next=n.next,i.prev=n,n.next.prev=i,n.next=i):(i.prev=i,i.next=i),i}function Hs(r){r.next.prev=r.prev,r.prev.next=r.next,r.prevZ&&(r.prevZ.nextZ=r.nextZ),r.nextZ&&(r.nextZ.prevZ=r.prevZ)}function jo(r,t,e){return{i:r,x:t,y:e,prev:null,next:null,z:0,prevZ:null,nextZ:null,steiner:!1}}function dp(r,t,e,n){let i=0;for(let s=t,a=e-n;s<e;s+=n)i+=(r[a]-r[s])*(r[s+1]+r[a+1]),a=s;return i}class fp{static triangulate(t,e,n=2){return $f(t,e,n)}}class pn{static area(t){const e=t.length;let n=0;for(let i=e-1,s=0;s<e;i=s++)n+=t[i].x*t[s].y-t[s].x*t[i].y;return n*.5}static isClockWise(t){return pn.area(t)<0}static triangulateShape(t,e){const n=[],i=[],s=[];Hc(t),Gc(n,t);let a=t.length;e.forEach(Hc);for(let l=0;l<e.length;l++)i.push(a),a+=e[l].length,Gc(n,e[l]);const o=fp.triangulate(n,i);for(let l=0;l<o.length;l+=3)s.push(o.slice(l,l+3));return s}}function Hc(r){const t=r.length;t>2&&r[t-1].equals(r[0])&&r.pop()}function Gc(r,t){for(let e=0;e<t.length;e++)r.push(t[e].x),r.push(t[e].y)}class Cl extends Zt{constructor(t=new es([new K(.5,.5),new K(-.5,.5),new K(-.5,-.5),new K(.5,-.5)]),e={}){super(),this.type="ExtrudeGeometry",this.parameters={shapes:t,options:e},t=Array.isArray(t)?t:[t];const n=this,i=[],s=[];for(let o=0,l=t.length;o<l;
vendor: 44,639 bytes, line 40
40o++){const c=t[o];a(c)}this.setAttribute("position",new St(i,3)),this.setAttribute("uv",new St(s,2)),this.computeVertexNormals();function a(o){const l=[],c=e.curveSegments!==void 0?e.curveSegments:12,h=e.steps!==void 0?e.steps:1,u=e.depth!==void 0?e.depth:1;let d=e.bevelEnabled!==void 0?e.bevelEnabled:!0,f=e.bevelThickness!==void 0?e.bevelThickness:.2,m=e.bevelSize!==void 0?e.bevelSize:f-.1,_=e.bevelOffset!==void 0?e.bevelOffset:0,g=e.bevelSegments!==void 0?e.bevelSegments:3;const p=e.extrudePath,y=e.UVGenerator!==void 0?e.UVGenerator:pp;let v,x=!1,A,T,R,P;p&&(v=p.getSpacedPoints(h),x=!0,d=!1,A=p.computeFrenetFrames(h,!1),T=new C,R=new C,P=new C),d||(g=0,f=0,m=0,_=0);const b=o.extractPoints(c);let S=b.shape;const I=b.holes;if(!pn.isClockWise(S)){S=S.reverse();for(let Q=0,Y=I.length;Q<Y;Q++){const tt=I[Q];pn.isClockWise(tt)&&(I[Q]=tt.reverse())}}function k(Q){const tt=10000000000000001e-36;let J=Q[0];for(let ct=1;ct<=Q.length;ct++){const et=ct%Q.length,ht=Q[et],Gt=ht.x-J.x,kt=ht.y-J.y,w=Gt*Gt+kt*kt,M=Math.max(Math.abs(ht.x),Math.abs(ht.y),Math.abs(J.x),Math.abs(J.y)),F=tt*M*M;if(w<=F){Q.splice(et,1),ct--;continue}J=ht}}k(S),I.forEach(k);const V=I.length,Z=S;for(let Q=0;Q<V;Q++){const Y=I[Q];S=S.concat(Y)}function W(Q,Y,tt){return Y||console.error("THREE.ExtrudeGeometry: vec does not exist"),Q.clone().addScaledVector(Y,tt)}const nt=S.length;function G(Q,Y,tt){let J,ct,et;const ht=Q.x-Y.x,Gt=Q.y-Y.y,kt=tt.x-Q.x,w=tt.y-Q.y,M=ht*ht+Gt*Gt,F=ht*w-Gt*kt;if(Math.abs(F)>Number.EPSILON){const H=Math.sqrt(M),j=Math.sqrt(kt*kt+w*w),X=Y.x-Gt/H,Rt=Y.y+ht/H,ot=tt.x-w/j,Tt=tt.y+kt/j,At=((ot-X)*w-(Tt-Rt)*kt)/(ht*w-Gt*kt);J=X+ht*At-Q.x,ct=Rt+Gt*At-Q.y;const it=J*J+ct*ct;if(it<=2)return new K(J,ct);et=Math.sqrt(it/2)}else{let H=!1;ht>Number.EPSILON?kt>Number.EPSILON&&(H=!0):ht<-Number.EPSILON?kt<-Number.EPSILON&&(H=!0):Math.sign(Gt)===Math.sign(w)&&(H=!0),H?(J=-Gt,ct=ht,et=Math.sqrt(M)):(J=ht,ct=Gt,et=Math.sqrt(M/2))}return new K(J/et,ct/et)}const dt=[];for(let Q=0,Y=Z.length,tt=Y-1,J=Q+1;Q<Y;Q++,tt++,J++)tt===Y&&(tt=0),J===Y&&(J=0),dt[Q]=G(Z[Q],Z[tt],Z[J]);const _t=[];let bt,Vt=dt.concat();for(let Q=0,Y=V;Q<Y;Q++){const tt=I[Q];bt=[];for(let J=0,ct=tt.length,et=ct-1,ht=J+1;J<ct;J++,et++,ht++)et===ct&&(et=0),ht===ct&&(ht=0),bt[J]=G(tt[J],tt[et],tt[ht]);_t.push(bt),Vt=Vt.concat(bt)}let Qt;if(g===0)Qt=pn.triangulateShape(Z,I);else{const Q=[],Y=[];for(let tt=0;tt<g;tt++){const J=tt/g,ct=f*Math.cos(J*Math.PI/2),et=m*Math.sin(J*Math.PI/2)+_;for(let ht=0,Gt=Z.length;ht<Gt;ht++){const kt=W(Z[ht],dt[ht],et);Ct(kt.x,kt.y,-ct),J===0&&Q.push(kt)}for(let ht=0,Gt=V;ht<Gt;ht++){const kt=I[ht];bt=_t[ht];const w=[];for(let M=0,F=kt.length;M<F;M++){const H=W(kt[M],bt[M],et);Ct(H.x,H.y,-ct),J===0&&w.push(H)}J===0&&Y.push(w)}}Qt=pn.triangulateShape(Q,Y)}const jt=Qt.length,q=m+_;for(let Q=0;Q<nt;Q++){const Y=d?W(S[Q],Vt[Q],q):S[Q];x?(R.copy(A.normals[0]).multiplyScalar(Y.x),T.copy(A.binormals[0]).multiplyScalar(Y.y),P.copy(v[0]).add(R).add(T),Ct(P.x,P.y,P.z)):Ct(Y.x,Y.y,0)}for(let Q=1;Q<=h;Q++)for(let Y=0;Y<nt;Y++){const tt=d?W(S[Y],Vt[Y],q):S[Y];x?(R.copy(A.normals[Q]).multiplyScalar(tt.x),T.copy(A.binormals[Q]).multiplyScalar(tt.y),P.copy(v[Q]).add(R).add(T),Ct(P.x,P.y,P.z)):Ct(tt.x,tt.y,u/h*Q)}for(let Q=g-1;Q>=0;Q--){const Y=Q/g,tt=f*Math.cos(Y*Math.PI/2),J=m*Math.sin(Y*Math.PI/2)+_;for(let ct=0,et=Z.length;ct<et;ct++){const ht=W(Z[ct],dt[ct],J);Ct(ht.x,ht.y,u+tt)}for(let ct=0,et=I.length;ct<et;ct++){const ht=I[ct];bt=_t[ct];for(let Gt=0,kt=ht.length;Gt<kt;Gt++){const w=W(ht[Gt],bt[Gt],J);x?Ct(w.x,w.y+v[h-1].y,v[h-1].x+tt):Ct(w.x,w.y,u+tt)}}}ft(),lt();function ft(){const Q=i.length/3;if(d){let Y=0,tt=nt*Y;for(let J=0;J<jt;J++){const ct=Qt[J];Ft(ct[2]+tt,ct[1]+tt,ct[0]+tt)}Y=h+g*2,tt=nt*Y;for(let J=0;J<jt;J++){const ct=Qt[J];Ft(ct[0]+tt,ct[1]+tt,ct[2]+tt)}}else{for(let Y=0;Y<jt;Y++){const tt=Qt[Y];Ft(tt[2],tt[1],tt[0])}for(let Y=0;Y<jt;Y++){const tt=Qt[Y];Ft(tt[0]+nt*h,tt[1]+nt*h,tt[2]+nt*h)}}n.addGroup(Q,i.length/3-Q,0)}function lt(){const Q=i.length/3;let Y=0;Lt(Z,Y),Y+=Z.length;for(let tt=0,J=I.length;tt<J;tt++){const ct=I[tt];Lt(ct,Y),Y+=ct.length}n.addGroup(Q,i.length/3-Q,1)}function Lt(Q,Y){let tt=Q.length;for(;--tt>=0;){const J=tt;let ct=tt-1;ct<0&&(ct=Q.length-1);for(let et=0,ht=h+g*2;et<ht;et++){const Gt=nt*et,kt=nt*(et+1),w=Y+J+Gt,M=Y+ct+Gt,F=Y+ct+kt,H=Y+J+kt;ue(w,M,F,H)}}}function Ct(Q,Y,tt){l.push(Q),l.push(Y),l.push(tt)}function Ft(Q,Y,tt){Ht(Q),Ht(Y),Ht(tt);const J=i.length/3,ct=y.generateTopUV(n,i,J-3,J-2,J-1);L(ct[0]),L(ct[1]),L(ct[2])}function ue(Q,Y,tt,J){Ht(Q),Ht(Y),Ht(J),Ht(Y),Ht(tt),Ht(J);const ct=i.length/3,et=y.generateSideWallUV(n,i,ct-6,ct-3,ct-2,ct-1);L(et[0]),L(et[1]),L(et[3]),L(et[1]),L(et[2]),L(et[3])}function Ht(Q){i.push(l[Q*3+0]),i.push(l[Q*3+1]),i.push(l[Q*3+2])}function L(Q){s.push(Q.x),s.push(Q.y)}}}copy(t){return super.copy(t),this.parameters=Object.assign({},t.parameters),this}toJSON(){const t=super.toJSON(),e=this.parameters.shapes,n=this.parameters.options;return mp(e,n,t)}static fromJSON(t,e){const n=[];for(let s=0,a=t.shapes.length;s<a;s++){const o=e[t.shapes[s]];n.push(o)}const i=t.options.extrudePath;return i!==void 0&&(t.options.extrudePath=new sa[i.type]().fromJSON(i)),new Cl(n,t.options)}}const pp={generateTopUV:function(r,t,e,n,i){const s=t[e*3],a=t[e*3+1],o=t[n*3],l=t[n*3+1],c=t[i*3],h=t[i*3+1];return[new K(s,a),new K(o,l),new K(c,h)]},generateSideWallUV:function(r,t,e,n,i,s){const a=t[e*3],o=t[e*3+1],l=t[e*3+2],c=t[n*3],h=t[n*3+1],u=t[n*3+2],d=t[i*3],f=t[i*3+1],m=t[i*3+2],_=t[s*3],g=t[s*3+1],p=t[s*3+2];return Math.abs(o-h)<Math.abs(a-c)?[new K(a,1-l),new K(c,1-u),new K(d,1-m),new K(_,1-p)]:[new K(o,1-l),new K(h,1-u),new K(f,1-m),new K(g,1-p)]}};function mp(r,t,e){if(e.shapes=[],Array.isArray(r))for(let n=0,i=r.length;n<i;n++){const s=r[n];e.shapes.push(s.uuid)}else e.shapes.push(r.uuid);return e.options=Object.assign({},t),t.extrudePath!==void 0&&(e.options.extrudePath=t.extrudePath.toJSON()),e}class Rl extends bi{constructor(t=1,e=0){const n=(1+Math.sqrt(5))/2,i=[-1,n,0,1,n,0,-1,-n,0,1,-n,0,0,-1,n,0,1,n,0,-1,-n,0,1,-n,n,0,-1,n,0,1,-n,0,-1,-n,0,1],s=[0,11,5,0,5,1,0,1,7,0,7,10,0,10,11,1,5,9,5,11,4,11,10,2,10,7,6,7,1,8,3,9,4,3,4,2,3,2,6,3,6,8,3,8,9,4,9,5,2,4,11,6,2,10,8,6,7,9,8,1];super(i,s,t,e),this.type="IcosahedronGeometry",this.parameters={radius:t,detail:e}}static fromJSON(t){return new Rl(t.radius,t.detail)}}class Il extends Zt{constructor(t=[new K(0,-.5),new K(.5,0),new K(0,.5)],e=12,n=0,i=Math.PI*2){super(),this.type="LatheGeometry",this.parameters={points:t,segments:e,phiStart:n,phiLength:i},e=Math.floor(e),i=Nt(i,0,Math.PI*2);const s=[],a=[],o=[],l=[],c=[],h=1/e,u=new C,d=new K,f=new C,m=new C,_=new C;let g=0,p=0;for(let y=0;y<=t.length-1;y++)switch(y){case 0:g=t[y+1].x-t[y].x,p=t[y+1].y-t[y].y,f.x=p*1,f.y=-g,f.z=p*0,_.copy(f),f.normalize(),l.push(f.x,f.y,f.z);break;case t.length-1:l.push(_.x,_.y,_.z);break;default:g=t[y+1].x-t[y].x,p=t[y+1].y-t[y].y,f.x=p*1,f.y=-g,f.z=p*0,m.copy(f),f.x+=_.x,f.y+=_.y,f.z+=_.z,f.normalize(),l.push(f.x,f.y,f.z),_.copy(m)}for(let y=0;y<=e;y++){const v=n+y*h*i,x=Math.sin(v),A=Math.cos(v);for(let T=0;T<=t.length-1;T++){u.x=t[T].x*x,u.y=t[T].y,u.z=t[T].x*A,a.push(u.x,u.y,u.z),d.x=y/e,d.y=T/(t.length-1),o.push(d.x,d.y);const R=l[3*T+0]*x,P=l[3*T+1],b=l[3*T+0]*A;c.push(R,P,b)}}for(let y=0;y<e;y++)for(let v=0;v<t.length-1;v++){const x=v+y*t.length,A=x,T=x+t.length,R=x+t.length+1,P=x+1;s.push(A,T,P),s.push(R,P,T)}this.setIndex(s),this.setAttribute("position",new St(a,3)),this.setAttribute("uv",new St(o,2)),this.setAttribute("normal",new St(c,3))}copy(t){return super.copy(t),this.parameters=Object.assign({},t.parameters),this}static fromJSON(t){return new Il(t.points,t.segments,t.phiStart,t.phiLength)}}class pa extends bi{constructor(t=1,e=0){const n=[1,0,0,-1,0,0,0,1,0,0,-1,0,0,0,1,0,0,-1],i=[0,2,4,0,4,3,0,3,5,0,5,2,1,2,5,1,5,3,1,3,4,1,4,2];super(n,i,t,e),this.type="OctahedronGeometry",this.parameters={radius:t,detail:e}}static fromJSON(t){return new pa(t.radius,t.detail)}}class Ys extends Zt{constructor(t=1,e=1,n=1,i=1){super(),this.type="PlaneGeometry",this.parameters={width:t,height:e,widthSegments:n,heightSegments:i};const s=t/2,a=e/2,o=Math.floor(n),l=Math.floor(i),c=o+1,h=l+1,u=t/o,d=e/l,f=[],m=[],_=[],g=[];for(let p=0;p<h;p++){const y=p*d-a;for(let v=0;v<c;v++){const x=v*u-s;m.push(x,-y,0),_.push(0,0,1),g.push(v/o),g.push(1-p/l)}}for(let p=0;p<l;p++)for(let y=0;y<o;y++){const v=y+c*p,x=y+c*(p+1),A=y+1+c*(p+1),T=y+1+c*p;f.push(v,x,T),f.push(x,A,T)}this.setIndex(f),this.setAttribute("position",new St(m,3)),this.setAttribute("normal",new St(_,3)),this.setAttribute("uv",new St(g,2))}copy(t){return super.copy(t),this.parameters=Object.assign({},t.parameters),this}static fromJSON(t){return new Ys(t.width,t.height,t.widthSegments,t.heightSegments)}}class Pl extends Zt{constructor(t=.5,e=1,n=32,i=1,s=0,a=Math.PI*2){super(),this.type="RingGeometry",this.parameters={innerRadius:t,outerRadius:e,thetaSegments:n,phiSegments:i,thetaStart:s,thetaLength:a},n=Math.max(3,n),i=Math.max(1,i);const o=[],l=[],c=[],h=[];let u=t;const d=(e-t)/i,f=new C,m=new K;for(let _=0;_<=i;_++){for(let g=0;g<=n;g++){const p=s+g/n*a;f.x=u*Math.cos(p),f.y=u*Math.sin(p),l.push(f.x,f.y,f.z),c.push(0,0,1),m.x=(f.x/e+1)/2,m.y=(f.y/e+1)/2,h.push(m.x,m.y)}u+=d}for(let _=0;_<i;_++){const g=_*(n+1);for(let p=0;p<n;p++){const y=p+g,v=y,x=y+n+1,A=y+n+2,T=y+1;o.push(v,x,T),o.push(x,A,T)}}this.setIndex(o),this.setAttribute("position",new St(l,3)),this.setAttribute("normal",new St(c,3)),this.setAttribute("uv",new St(h,2))}copy(t){return super.copy(t),this.parameters=Object.assign({},t.parameters),this}static fromJSON(t){return new Pl(t.innerRadius,t.outerRadius,t.thetaSegments,t.phiSegments,t.thetaStart,t.thetaLength)}}class Ll extends Zt{constructor(t=new es([new K(0,.5),new K(-.5,-.5),new K(.5,-.5)]),e=12){super(),this.type="ShapeGeometry",this.parameters={shapes:t,curveSegments:e};const n=[],i=[],s=[],a=[];let o=0,l=0;if(Array.isArray(t)===!1)c(t);else for(let h=0;h<t.length;h++)c(t[h]),this.addGroup(o,l,h),o+=l,l=0;this.setIndex(n),this.setAttribute("position",new St(i,3)),this.setAttribute("normal",new St(s,3)),this.setAttribute("uv",new St(a,2));function c(h){const u=i.length/3,d=h.extractPoints(e);let f=d.shape;const m=d.holes;pn.isClockWise(f)===!1&&(f=f.reverse());for(let g=0,p=m.length;g<p;g++){const y=m[g];pn.isClockWise(y)===!0&&(m[g]=y.reverse())}const _=pn.triangulateShape(f,m);for(let g=0,p=m.length;g<p;g++){const y=m[g];f=f.concat(y)}for(let g=0,p=f.length;g<p;g++){const y=f[g];i.push(y.x,y.y,0),s.push(0,0,1),a.push(y.x,y.y)}for(let g=0,p=_.length;g<p;g++){const y=_[g],v=y[0]+u,x=y[1]+u,A=y[2]+u;n.push(v,x,A),l+=3}}}copy(t){return super.copy(t),this.parameters=Object.assign({},t.parameters),this}toJSON(){const t=super.toJSON(),e=this.parameters.shapes;return gp(e,t)}static fromJSON(t,e){const n=[];for(let i=0,s=t.shapes.length;i<s;i++){const a=e[t.shapes[i]];n.push(a)}return new Ll(n,t.curveSegments)}}function gp(r,t){if(t.shapes=[],Array.isArray(r))for(let e=0,n=r.length;e<n;e++){const i=r[e];t.shapes.push(i.uuid)}else t.shapes.push(r.uuid);return t}class ma extends Zt{constructor(t=1,e=32,n=16,i=0,s=Math.PI*2,a=0,o=Math.PI){super(),this.type="SphereGeometry",this.parameters={radius:t,widthSegments:e,heightSegments:n,phiStart:i,phiLength:s,thetaStart:a,thetaLength:o},e=Math.max(3,Math.floor(e)),n=Math.max(2,Math.floor(n));const l=Math.min(a+o,Math.PI);let c=0;const h=[],u=new C,d=new C,f=[],m=[],_=[],g=[];for(let p=0;p<=n;p++){const y=[],v=p/n;let x=0;p===0&&a===0?x=.5/e:p===n&&l===Math.PI&&(x=-.5/e);for(let A=0;A<=e;A++){const T=A/e;u.x=-t*Math.cos(i+T*s)*Math.sin(a+v*o),u.y=t*Math.cos(a+v*o),u.z=t*Math.sin(i+T*s)*Math.sin(a+v*o),m.push(u.x,u.y,u.z),d.copy(u).normalize(),_.push(d.x,d.y,d.z),g.push(T+x,1-v),y.push(c++)}h.push(y)}for(let p=0;p<n;p++)for(let y=0;y<e;y++){const v=h[p][y+1],x=h[p][y],A=h[p+1][y],T=h[p+1][y+1];(p!==0||a>0)&&f.push(v,x,T),(p!==n-1||l<Math.PI)&&f.push(x,A,T)}this.setIndex(f),this.setAttribute("position",new St(m,3)),this.setAttribute("normal",new St(_,3)),this.setAttribute("uv",new St(g,2))}copy(t){return super.copy(t),this.parameters=Object.assign({},t.parameters),this}static fromJSON(t){return new ma(t.radius,t.widthSegments,t.heightSegments,t.phiStart,t.phiLength,t.thetaStart,t.thetaLength)}}class Dl extends bi{constructor(t=1,e=0){const n=[1,1,1,-1,-1,1,-1,1,-1,1,-1,-1],i=[2,1,0,0,3,2,1,3,0,2,3,1];super(n,i,t,e),this.type="TetrahedronGeometry",this.parameters={radius:t,detail:e}}static fromJSON(t){return new Dl(t.radius,t.detail)}}class Ul extends Zt{constructor(t=1,e=.4,n=12,i=48,s=Math.PI*2){super(),this.type="TorusGeometry",this.parameters={radius:t,tube:e,radialSegments:n,tubularSegments:i,arc:s},n=Math.floor(n),i=Math.floor(i);const a=[],o=[],l=[],c=[],h=new C,u=new C,d=new C;for(let f=0;f<=n;f++)for(let m=0;m<=i;m++){const _=m/i*s,g=f/n*Math.PI*2;u.x=(t+e*Math.cos(g))*Math.cos(_),u.y=(t+e*Math.cos(g))*Math.sin(_),u.z=e*Math.sin(g),o.push(u.x,u.y,u.z),h.x=t*Math.cos(_),h.y=t*Math.sin(_),d.subVectors(u,h).normalize(),l.push(d.x,d.y,d.z),c.push(m/i),c.push(f/n)}for(let f=1;f<=n;f++)for(let m=1;m<=i;m++){const _=(i+1)*f+m-1,g=(i+1)*(f-1)+m-1,p=(i+1)*(f-1)+m,y=(i+1)*f+m;a.push(_,g,y),a.push(g,p,y)}this.setIndex(a),this.setAttribute("position",new St(o,3)),this.setAttribute("normal",new St(l,3)),this.setAttribute("uv",new St(c,2))}copy(t){return super.copy(t),this.parameters=Object.assign({},t.parameters),this}static fromJSON(t){return new Ul(t.radius,t.tube,t.radialSegments,t.tubularSegments,t.arc)}}class Nl extends Zt{constructor(t=1,e=.4,n=64,i=8,s=2,a=3){super(),this.type="TorusKnotGeometry",this.parameters={radius:t,tube:e,tubularSegments:n,radialSegments:i,p:s,q:a},n=Math.floor(n),i=Math.floor(i);const o=[],l=[],c=[],h=[],u=new C,d=new C,f=new C,m=new C,_=new C,g=new C,p=new C;for(let v=0;v<=n;++v){const x=v/n*s*Math.PI*2;y(x,s,a,t,f),y(x+.01,s,a,t,m),g.subVectors(m,f),p.addVectors(m,f),_.crossVectors(g,p),p.crossVectors(_,g),_.normalize(),p.normalize();for(let A=0;A<=i;++A){const T=A/i*Math.PI*2,R=-e*Math.cos(T),P=e*Math.sin(T);u.x=f.x+(R*p.x+P*_.x),u.y=f.y+(R*p.y+P*_.y),u.z=f.z+(R*p.z+P*_.z),l.push(u.x,u.y,u.z),d.subVectors(u,f).normalize(),c.push(d.x,d.y,d.z),h.push(v/n),h.push(A/i)}}for(let v=1;v<=n;v++)for(let x=1;x<=i;x++){const A=(i+1)*(v-1)+(x-1),T=(i+1)*v+(x-1),R=(i+1)*v+x,P=(i+1)*(v-1)+x;o.push(A,T,P),o.push(T,R,P)}this.setIndex(o),this.setAttribute("position",new St(l,3)),this.setAttribute("normal",new St(c,3)),this.setAttribute("uv",new St(h,2));function y(v,x,A,T,R){const P=Math.cos(v),b=Math.sin(v),S=A/x*v,I=Math.cos(S);R.x=T*(2+I)*.5*P,R.y=T*(2+I)*b*.5,R.z=T*Math.sin(S)*.5}}copy(t){return super.copy(t),this.parameters=Object.assign({},t.parameters),this}static fromJSON(t){return new Nl(t.radius,t.tube,t.tubularSegments,t.radialSegments,t.p,t.q)}}class Fl extends Zt{constructor(t=new au(new C(-1,-1,0),new C(-1,1,0),new C(1,1,0)),e=64,n=1,i=8,s=!1){super(),this.type="TubeGeometry",this.parameters={path:t,tubularSegments:e,radius:n,radialSegments:i,closed:s};const a=t.computeFrenetFrames(e,s);this.tangents=a.tangents,this.normals=a.normals,this.binormals=a.binormals;const o=new C,l=new C,c=new K;let h=new C;const u=[],d=[],f=[],m=[];_(),this.setIndex(m),this.setAttribute("position",new St(u,3)),this.setAttribute("normal",new St(d,3)),this.setAttribute("uv",new St(f,2));function _(){for(let v=0;v<e;v++)g(v);g(s===!1?e:0),y(),p()}function g(v){h=t.getPointAt(v/e,h);const x=a.normals[v],A=a.binormals[v];for(let T=0;T<=i;T++){const R=T/i*Math.PI*2,P=Math.sin(R),b=-Math.cos(R);l.x=b*x.x+P*A.x,l.y=b*x.y+P*A.y,l.z=b*x.z+P*A.z,l.normalize(),d.push(l.x,l.y,l.z),o.x=h.x+n*l.x,o.y=h.y+n*l.y,o.z=h.z+n*l.z,u.push(o.x,o.y,o.z)}}function p(){for(let v=1;v<=e;v++)for(let x=1;x<=i;x++){const A=(i+1)*(v-1)+(x-1),T=(i+1)*v+(x-1),R=(i+1)*v+x,P=(i+1)*(v-1)+x;m.push(A,T,P),m.push(T,R,P)}}function y(){for(let v=0;v<=e;v++)for(let x=0;x<=i;x++)c.x=v/e,c.y=x/i,f.push(c.x,c.y)}}copy(t){return super.copy(t),this.parameters=Object.assign({},t.parameters),this}toJSON(){const t=super.toJSON();return t.path=this.parameters.path.toJSON(),t}static fromJSON(t){return new Fl(new sa[t.path.type]().fromJSON(t.path),t.tubularSegments,t.radius,t.radialSegments,t.closed)}}class _p extends Zt{constructor(t=null){if(super(),this.type="WireframeGeometry",this.parameters={geometry:t},t!==null){const e=[],n=new Set,i=new C,s=new C;if(t.index!==null){const a=t.attributes.position,o=t.index;let l=t.groups;l.length===0&&(l=[{start:0,count:o.count,materialIndex:0}]);for(let c=0,h=l.length;c<h;++c){const u=l[c],d=u.start,f=u.count;for(let m=d,_=d+f;m<_;m+=3)for(let g=0;g<3;g++){const p=o.getX(m+g),y=o.getX(m+(g+1)%3);i.fromBufferAttribute(a,p),s.fromBufferAttribute(a,y),Wc(i,s,n)===!0&&(e.push(i.x,i.y,i.z),e.push(s.x,s.y,s.z))}}}else{const a=t.attributes.position;for(let o=0,l=a.count/3;o<l;o++)for(let c=0;c<3;c++){const h=3*o+c,u=3*o+(c+1)%3;i.fromBufferAttribute(a,h),s.fromBufferAttribute(a,u),Wc(i,s,n)===!0&&(e.push(i.x,i.y,i.z),e.push(s.x,s.y,s.z))}}this.setAttribute("position",new St(e,3))}}copy(t){return super.copy(t),this.parameters=Object.assign({},t.parameters),this}}function Wc(r,t,e){const n=`${r.x},${r.y},${r.z}-${t.x},${t.y},${t.z}`,i=`${t.x},${t.y},${t.z}-${r.x},${r.y},${r.z}`;return e.has(n)===!0||e.has(i)===!0?!1:(e.add(n),e.add(i),!0)}var Xc=Object.freeze({__proto__:null,BoxGeometry:ls,CapsuleGeometry:bl,CircleGeometry:El,ConeGeometry:fa,CylinderGeometry:da,DodecahedronGeometry:Tl,EdgesGeometry:Of,ExtrudeGeometry:Cl,IcosahedronGeometry:Rl,LatheGeometry:Il,OctahedronGeometry:pa,PlaneGeometry:Ys,PolyhedronGeometry:bi,RingGeometry:Pl,ShapeGeometry:Ll,SphereGeometry:ma,TetrahedronGeometry:Dl,TorusGeometry:Ul,TorusKnotGeometry:Nl,TubeGeometry:Fl,WireframeGeometry:_p});class xp extends Fe{constructor(t){super(),this.isShadowMaterial=!0,this.type="ShadowMaterial",this.color=new vt(0),this.transparent=!0,this.fog=!0,this.setValues(t)}copy(t){return super.copy(t),this.color.copy(t.color),this.fog=t.fog,this}}class vp extends gn{constructor(t){super(t),this.isRawShaderMaterial=!0,this.type="RawShaderMaterial"}}class du extends Fe{constructor(t){super(),this.isMeshStandardMaterial=!0,this.type="MeshStandardMaterial",this.defines={STANDARD:""},this.color=new vt(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 vt(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=Mi,this.normalScale=new K(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.roughnessMap=null,this.metalnessMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new sn,this.envMapIntensity=1,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.flatShading=!1,this.fog=!0,this.setValues(t)}copy(t){return super.copy(t),this.defines={STANDARD:""},this.color.copy(t.color),this.roughness=t.roughness,this.metalness=t.metalness,this.map=t.map,this.lightMap=t.lightMap,this.lightMapIntensity=t.lightMapIntensity,this.aoMap=t.aoMap,this.aoMapIntensity=t.aoMapIntensity,this.emissive.copy(t.emissive),this.emissiveMap=t.emissiveMap,this.emissiveIntensity=t.emissiveIntensity,this.bumpMap=t.bumpMap,this.bumpScale=t.bumpScale,this.normalMap=t.normalMap,this.normalMapType=t.normalMapType,this.normalScale.copy(t.normalScale),this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this.roughnessMap=t.roughnessMap,this.metalnessMap=t.metalnessMap,this.alphaMap=t.alphaMap,this.envMap=t.envMap,this.envMapRotation.copy(t.envMapRotation),this.envMapIntensity=t.envMapIntensity,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.wireframeLinecap=t.wireframeLinecap,this.wireframeLinejoin=t.wireframeLinejoin,this.flatShading=t.flatShading,this.fog=t.fog,this}}class yp extends du{constructor(t){super(),this.isMeshPhysicalMaterial=!0,this.defines={STANDARD:"",PHYSICAL:""},this.type="MeshPhysicalMaterial",this.anisotropyRotation=0,this.anisotropyMap=null,this.clearcoatMap=null,this.clearcoatRoughness=0,this.clearcoatRoughnessMap=null,this.clearcoatNormalScale=new K(1,1),this.clearcoatNormalMap=null,this.ior=1.5,Object.defineProperty(this,"reflectivity",{get:function(){return Nt(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 vt(0),this.sheenColorMap=null,this.sheenRoughness=1,this.sheenRoughnessMap=null,this.transmissionMap=null,this.thickness=0,this.thicknessMap=null,this.attenuationDistance=1/0,this.attenuationColor=new vt(1,1,1),this.specularIntensity=1,this.specularIntensityMap=null,this.specularColor=new vt(1,1,1),this.specularColorMap=null,this._anisotropy=0,this._clearcoat=0,this._dispersion=0,this._iridescence=0,this._sheen=0,this._transmission=0,this.setValues(t)}get anisotropy(){return this._anisotropy}set anisotropy(t){this._anisotropy>0!=t>0&&this.version++,this._anisotropy=t}get clearcoat(){return this._clearcoat}set clearcoat(t){this._clearcoat>0!=t>0&&this.version++,this._clearcoat=t}get iridescence(){return this._iridescence}set iridescence(t){this._iridescence>0!=t>0&&this.version++,this._iridescence=t}get dispersion(){return this._dispersion}set dispersion(t){this._dispersion>0!=t>0&&this.version++,this._dispersion=t}get sheen(){return this._sheen}set sheen(t){this._sheen>0!=t>0&&this.version++,this._sheen=t}get transmission(){return this._transmission}set transmission(t){this._transmission>0!=t>0&&this.version++,this._transmission=t}copy(t){return super.copy(t),this.defines={STANDARD:"",PHYSICAL:""},this.anisotropy=t.anisotropy,this.anisotropyRotation=t.anisotropyRotation,this.anisotropyMap=t.anisotropyMap,this.clearcoat=t.clearcoat,this.clearcoatMap=t.clearcoatMap,this.clearcoatRoughness=t.clearcoatRoughness,this.clearcoatRoughnessMap=t.clearcoatRoughnessMap,this.clearcoatNormalMap=t.clearcoatNormalMap,this.clearcoatNormalScale.copy(t.clearcoatNormalScale),this.dispersion=t.dispersion,this.ior=t.ior,this.iridescence=t.iridescence,this.iridescenceMap=t.iridescenceMap,this.iridescenceIOR=t.iridescenceIOR,this.iridescenceThicknessRange=[...t.iridescenceThicknessRange],this.iridescenceThicknessMap=t.iridescenceThicknessMap,this.sheen=t.sheen,this.sheenColor.copy(t.sheenColor),this.sheenColorMap=t.sheenColorMap,this.sheenRoughness=t.sheenRoughness,this.sheenRoughnessMap=t.sheenRoughnessMap,this.transmission=t.transmission,this.transmissionMap=t.transmissionMap,this.thickness=t.thickness,this.thicknessMap=t.thicknessMap,this.attenuationDistance=t.attenuationDistance,this.attenuationColor.copy(t.attenuationColor),this.specularIntensity=t.specularIntensity,this.specularIntensityMap=t.specularIntensityMap,this.specularColor.copy(t.specularColor),this.specularColorMap=t.specularColorMap,this}}class Mp extends Fe{constructor(t){super(),this.isMeshPhongMaterial=!0,this.type="MeshPhongMaterial",this.color=new vt(16777215),this.specular=new vt(1118481),this.shininess=30,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new vt(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=Mi,this.normalScale=new K(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new sn,this.combine=ca,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.flatShading=!1,this.fog=!0,this.setValues(t)}copy(t){return super.copy(t),this.color.copy(t.color),this.specular.copy(t.specular),this.shininess=t.shininess,this.map=t.map,this.lightMap=t.lightMap,this.lightMapIntensity=t.lightMapIntensity,this.aoMap=t.aoMap,this.aoMapIntensity=t.aoMapIntensity,this.emissive.copy(t.emissive),this.emissiveMap=t.emissiveMap,this.emissiveIntensity=t.emissiveIntensity,this.bumpMap=t.bumpMap,this.bumpScale=t.bumpScale,this.normalMap=t.normalMap,this.normalMapType=t.normalMapType,this.normalScale.copy(t.normalScale),this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this.specularMap=t.specularMap,this.alphaMap=t.alphaMap,this.envMap=t.envMap,this.envMapRotation.copy(t.envMapRotation),this.combine=t.combine,this.reflectivity=t.reflectivity,this.refractionRatio=t.refractionRatio,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.wireframeLinecap=t.wireframeLinecap,this.wireframeLinejoin=t.wireframeLinejoin,this.flatShading=t.flatShading,this.fog=t.fog,this}}class Sp extends Fe{constructor(t){super(),this.isMeshToonMaterial=!0,this.defines={TOON:""},this.type="MeshToonMaterial",this.color=new vt(16777215),this.map=null,this.gradientMap=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new vt(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=Mi,this.normalScale=new K(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.alphaMap=null,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.fog=!0,this.setValues(t)}copy(t){return super.copy(t),this.color.copy(t.color),this.map=t.map,this.gradientMap=t.gradientMap,this.lightMap=t.lightMap,this.lightMapIntensity=t.lightMapIntensity,this.aoMap=t.aoMap,this.aoMapIntensity=t.aoMapIntensity,this.emissive.copy(t.emissive),this.emissiveMap=t.emissiveMap,this.emissiveIntensity=t.emissiveIntensity,this.bumpMap=t.bumpMap,this.bumpScale=t.bumpScale,this.normalMap=t.normalMap,this.normalMapType=t.normalMapType,this.normalScale.copy(t.normalScale),this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this.alphaMap=t.alphaMap,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.wireframeLinecap=t.wireframeLinecap,this.wireframeLinejoin=t.wireframeLinejoin,this.fog=t.fog,this}}class bp extends Fe{constructor(t){super(),this.isMeshNormalMaterial=!0,this.type="MeshNormalMaterial",this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=Mi,this.normalScale=new K(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.wireframe=!1,this.wireframeLinewidth=1,this.flatShading=!1,this.setValues(t)}copy(t){return super.copy(t),this.bumpMap=t.bumpMap,this.bumpScale=t.bumpScale,this.normalMap=t.normalMap,this.normalMapType=t.normalMapType,this.normalScale.copy(t.normalScale),this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.flatShading=t.flatShading,this}}class Ep extends Fe{constructor(t){super(),this.isMeshLambertMaterial=!0,this.type="MeshLambertMaterial",this.color=new vt(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new vt(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=Mi,this.normalScale=new K(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new sn,this.combine=ca,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.flatShading=!1,this.fog=!0,this.setValues(t)}copy(t){return super.copy(t),this.color.copy(t.color),this.map=t.map,this.lightMap=t.lightMap,this.lightMapIntensity=t.lightMapIntensity,this.aoMap=t.aoMap,this.aoMapIntensity=t.aoMapIntensity,this.emissive.copy(t.emissive),this.emissiveMap=t.emissiveMap,this.emissiveIntensity=t.emissiveIntensity,this.bumpMap=t.bumpMap,this.bumpScale=t.bumpScale,this.normalMap=t.normalMap,this.normalMapType=t.normalMapType,this.normalScale.copy(t.normalScale),this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this.specularMap=t.specularMap,this.alphaMap=t.alphaMap,this.envMap=t.envMap,this.envMapRotation.copy(t.envMapRotation),this.combine=t.combine,this.reflectivity=t.reflectivity,this.refractionRatio=t.refractionRatio,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.wireframeLinecap=t.wireframeLinecap,this.wireframeLinejoin=t.wireframeLinejoin,this.flatShading=t.flatShading,this.fog=t.fog,this}}class fu extends Fe{constructor(t){super(),this.isMeshDepthMaterial=!0,this.type="MeshDepthMaterial",this.depthPacking=gd,this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.wireframe=!1,this.wireframeLinewidth=1,this.setValues(t)}copy(t){return super.copy(t),this.depthPacking=t.depthPacking,this.map=t.map,this.alphaMap=t.alphaMap,this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this}}class pu extends Fe{constructor(t){super(),this.isMeshDistanceMaterial=!0,this.type="MeshDistanceMaterial",this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.setValues(t)}copy(t){return super.copy(t),this.map=t.map,this.alphaMap=t.alphaMap,this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this}}class Tp extends Fe{constructor(t){super(),this.isMeshMatcapMaterial=!0,this.defines={MATCAP:""},this.type="MeshMatcapMaterial",this.color=new vt(16777215),this.matcap=null,this.map=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=Mi,this.normalScale=new K(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.alphaMap=null,this.flatShading=!1,this.fog=!0,this.setValues(t)}copy(t){return super.copy(t),this.defines={MATCAP:""},this.color.copy(t.color),this.matcap=t.matcap,this.map=t.map,this.bumpMap=t.bumpMap,this.bumpScale=t.bumpScale,this.normalMap=t.normalMap,this.normalMapType=t.normalMapType,this.normalScale.copy(t.normalScale),this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this.alphaMap=t.alphaMap,this.flatShading=t.flatShading,this.fog=t.fog,this}}class Ap extends He{constructor(t){super(),this.isLineDashedMaterial=!0,this.type="LineDashedMaterial",this.scale=1,this.dashSize=3,this.gapSize=1,this.setValues(t)}copy(t){return super.copy(t),this.scale=t.scale,this.dashSize=t.dashSize,this.gapSize=t.gapSize,this}}function gi(r,t){return!r||r.constructor===t?r:typeof t.BYTES_PER_ELEMENT=="number"?new t(r):Array.prototype.slice.call(r)}function mu(r){return ArrayBuffer.isView(r)&&!(r instanceof DataView)}function gu(r){function t(i,s){return r[i]-r[s]}const e=r.length,n=new Array(e);for(let i=0;i!==e;++i)n[i]=i;return n.sort(t),n}function tl(r,t,e){const n=r.length,i=new r.constructor(n);for(let s=0,a=0;a!==n;++s){const o=e[s]*t;for(let l=0;l!==t;++l)i[a++]=r[o+l]}return i}function Ol(r,t,e,n){let i=1,s=r[0];for(;s!==void 0&&s[n]===void 0;)s=r[i++];if(s===void 0)return;let a=s[n];if(a!==void 0)if(Array.isArray(a))do a=s[n],a!==void 0&&(t.push(s.time),e.push(...a)),s=r[i++];while(s!==void 0);else if(a.toArray!==void 0)do a=s[n],a!==void 0&&(t.push(s.time),a.toArray(e,e.length)),s=r[i++];while(s!==void 0);else do a=s[n],a!==void 0&&(t.push(s.time),e.push(a)),s=r[i++];while(s!==void 0)}function wp(r,t,e,n,i=30){const s=r.clone();s.name=t;const a=[];for(let l=0;l<s.tracks.length;++l){const c=s.tracks[l],h=c.getValueSize(),u=[],d=[];for(let f=0;f<c.times.length;++f){const m=c.times[f]*i;if(!(m<e||m>=n)){u.push(c.times[f]);for(let _=0;_<h;++_)d.push(c.values[f*h+_])}}u.length!==0&&(c.times=gi(u,c.times.constructor),c.values=gi(d,c.values.constructor),a.push(c))}s.tracks=a;let o=1/0;for(let l=0;l<s.tracks.length;++l)o>s.tracks[l].times[0]&&(o=s.tracks[l].times[0]);for(let l=0;l<s.tracks.length;++l)s.tracks[l].shift(-1*o);return s.resetDuration(),s}function Cp(r,t=0,e=r,n=30){n<=0&&(n=30);const i=e.tracks.length,s=t/n;for(let a=0;a<i;++a){const o=e.tracks[a],l=o.ValueTypeName;if(l==="bool"||l==="string")continue;const c=r.tracks.find(function(p){return p.name===o.name&&p.ValueTypeName===l});if(c===void 0)continue;let h=0;const u=o.getValueSize();o.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline&&(h=u/3);let d=0;const f=c.getValueSize();c.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline&&(d=f/3);const m=o.times.length-1;let _;if(s<=o.times[0]){const p=h,y=u-h;_=o.values.slice(p,y)}else if(s>=o.times[m]){const p=m*u+h,y=p+u-h;_=o.values.slice(p,y)}else{const p=o.createInterpolant(),y=h,v=u-h;p.evaluate(s),_=p.resultBuffer.slice(y,v)}l==="quaternion"&&new Ke().fromArray(_).normalize().conjugate().toArray(_);const g=c.times.length;for(let p=0;p<g;++p){const y=p*f+d;if(l==="quaternion")Ke.multiplyQuaternionsFlat(c.values,y,_,0,c.values,y);else{const v=f-d*2;for(let x=0;x<v;++x)c.values[y+x]-=_[x]}}}return r.blendMode=Wh,r}class ry{static convertArray(t,e){return gi(t,e)}static isTypedArray(t){return mu(t)}static getKeyframeOrder(t){return gu(t)}static sortedArray(t,e,n){return tl(t,e,n)}static flattenJSON(t,e,n,i){Ol(t,e,n,i)}static subclip(t,e,n,i,s=30){return wp(t,e,n,i,s)}static makeClipAdditive(t,e=0,n=t,i=30){return Cp(t,e,n,i)}}class ga{constructor(t,e,n,i){this.parameterPositions=t,this._cachedIndex=0,this.resultBuffer=i!==void 0?i:new e.constructor(n),this.sampleValues=e,this.valueSize=n,this.settings=null,this.DefaultSettings_={}}evaluate(t){const e=this.parameterPositions;let n=this._cachedIndex,i=e[n],s=e[n-1];t:{e:{let a;n:{i:if(!(t<i)){for(let o=n+2;;){if(i===void 0){if(t<s)break i;return n=e.length,this._cachedIndex=n,this.copySampleValue_(n-1)}if(n===o)break;if(s=i,i=e[++n],t<i)break e}a=e.length;break n}if(!(t>=s)){const o=e[1];t<o&&(n=2,s=o);for(let l=n-2;;){if(s===void 0)return this._cachedIndex=0,this.copySampleValue_(0);if(n===l)break;if(i=s,s=e[--n-1],t>=s)break e}a=n,n=0;break n}break t}for(;n<a;){const o=n+a>>>1;t<e[o]?a=o:n=o+1}if(i=e[n],s=e[n-1],s===void 0)return this._cachedIndex=0,this.copySampleValue_(0);if(i===void 0)return n=e.length,this._cachedIndex=n,this.copySampleValue_(n-1)}this._cachedIndex=n,this.intervalChanged_(n,s,i)}return this.interpolate_(n,s,t,i)}getSettings_(){return this.settings||this.DefaultSettings_}copySampleValue_(t){const e=this.resultBuffer,n=this.sampleValues,i=this.valueSize,s=t*i;for(let a=0;a!==i;++a)e[a]=n[s+a];return e}interpolate_(){throw new Error("call to abstract method")}intervalChanged_(){}}class Rp extends ga{constructor(t,e,n,i){super(t,e,n,i),this._weightPrev=-0,this._offsetPrev=-0,this._weightNext=-0,this._offsetNext=-0,this.DefaultSettings_={endingStart:Zi,endingEnd:Zi}}intervalChanged_(t,e,n){const i=this.parameterPositions;let s=t-2,a=t+1,o=i[s],l=i[a];if(o===void 0)switch(this.getSettings_().endingStart){case Ji:s=t,o=2*e-n;break;case jr:s=i.length-2,o=e+i[s]-i[s+1];break;default:s=t,o=n}if(l===void 0)switch(this.getSettings_().endingEnd){case Ji:a=t,l=2*n-e;break;case jr:a=1,l=n+i[1]-i[0];break;default:a=t-1,l=e}const c=(n-e)*.5,h=this.valueSize;this._weightPrev=c/(e-o),this._weightNext=c/(l-n),this._offsetPrev=s*h,this._offsetNext=a*h}interpolate_(t,e,n,i){const s=this.resultBuffer,a=this.sampleValues,o=this.valueSize,l=t*o,c=l-o,h=this._offsetPrev,u=this._offsetNext,d=this._weightPrev,f=this._weightNext,m=(n-e)/(i-e),_=m*m,g=_*m,p=-d*g+2*d*_-d*m,y=(1+d)*g+(-1.5-2*d)*_+(-.5+d)*m+1,v=(-1-f)*g+(1.5+f)*_+.5*m,x=f*g-f*_;for(let A=0;A!==o;++A)s[A]=p*a[h+A]+y*a[c+A]+v*a[l+A]+x*a[u+A];return s}}class _u extends ga{constructor(t,e,n,i){super(t,e,n,i)}interpolate_(t,e,n,i){const s=this.resultBuffer,a=this.sampleValues,o=this.valueSize,l=t*o,c=l-o,h=(n-e)/(i-e),u=1-h;for(let d=0;d!==o;++d)s[d]=a[c+d]*u+a[l+d]*h;return s}}class Ip extends ga{constructor(t,e,n,i){super(t,e,n,i)}interpolate_(t){return this.copySampleValue_(t-1)}}class cn{constructor(t,e,n,i){if(t===void 0)throw new Error("THREE.KeyframeTrack: track name is undefined");if(e===void 0||e.length===0)throw new Error("THREE.KeyframeTrack: no keyframes in track named "+t);this.name=t,this.times=gi(e,this.TimeBufferType),this.values=gi(n,this.ValueBufferType),this.setInterpolation(i||this.DefaultInterpolation)}static toJSON(t){const e=t.constructor;let n;if(e.toJSON!==this.toJSON)n=e.toJSON(t);else{n={name:t.name,times:gi(t.times,Array),values:gi(t.values,Array)};const i=t.getInterpolation();i!==t.DefaultInterpolation&&(n.interpolation=i)}return n.type=t.ValueTypeName,n}InterpolantFactoryMethodDiscrete(t){return new Ip(this.times,this.values,this.getValueSize(),t)}InterpolantFactoryMethodLinear(t){return new _u(this.times,this.values,this.getValueSize(),t)}InterpolantFactoryMethodSmooth(t){return new Rp(this.times,this.values,this.getValueSize(),t)}setInterpolation(t){let e;switch(t){case Qr:e=this.InterpolantFactoryMethodDiscrete;break;case Jo:e=this.InterpolantFactoryMethodLinear;break;case Ma:e=this.InterpolantFactoryMethodSmooth;break}if(e===void 0){const n="unsupported interpolation for "+this.ValueTypeName+" keyframe track named "+this.name;if(this.createInterpolant===void 0)if(t!==this.DefaultInterpolation)this.setInterpolation(this.DefaultInterpolation);else throw new Error(n);return console.warn("THREE.KeyframeTrack:",n),this}return this.createInterpolant=e,this}getInterpolation(){switch(this.createInterpolant){case this.InterpolantFactoryMethodDiscrete:return Qr;case this.InterpolantFactoryMethodLinear:return Jo;case this.InterpolantFactoryMethodSmooth:return Ma}}getValueSize(){return this.values.length/this.times.length}shift(t){if(t!==0){const e=this.times;for(let n=0,i=e.length;n!==i;++n)e[n]+=t}return this}scale(t){if(t!==1){const e=this.times;for(let n=0,i=e.length;n!==i;++n)e[n]*=t}return this}trim(t,e){const n=this.times,i=n.length;let s=0,a=i-1;for(;s!==i&&n[s]<t;)++s;for(;a!==-1&&n[a]>e;)--a;if(++a,s!==0||a!==i){s>=a&&(a=Math.max(a,1),s=a-1);const o=this.getValueSize();this.times=n.slice(s,a),this.values=this.values.slice(s*o,a*o)}return this}validate(){let t=!0;const e=this.getValueSize();e-Math.floor(e)!==0&&(console.error("THREE.KeyframeTrack: Invalid value size in track.",this),t=!1);const n=this.times,i=this.values,s=n.length;s===0&&(console.error("THREE.KeyframeTrack: Track is empty.",this),t=!1);let a=null;for(let o=0;o!==s;o++){const l=n[o];if(typeof l=="number"&&isNaN(l)){console.error("THREE.KeyframeTrack: Time is not a valid number.",this,o,l),t=!1;break}if(a!==null&&a>l){console.error("THREE.KeyframeTrack: Out of order keys.",this,o,l,a),t=!1;break}a=l}if(i!==void 0&&mu(i))for(let o=0,l=i.length;o!==l;++o){const c=i[o];if(isNaN(c)){console.error("THREE.KeyframeTrack: Value is not a valid number.",this,o,c),t=!1;break}}return t}optimize(){const t=this.times.slice(),e=this.values.slice(),n=this.getValueSize(),i=this.getInterpolation()===Ma,s=t.length-1;let a=1;for(let o=1;o<s;++o){let l=!1;const c=t[o],h=t[o+1];if(c!==h&&(o!==1||c!==t[0]))if(i)l=!0;else{const u=o*n,d=u-n,f=u+n;for(let m=0;m!==n;++m){const _=e[u+m];if(_!==e[d+m]||_!==e[f+m]){l=!0;break}}}if(l){if(o!==a){t[a]=t[o];const u=o*n,d=a*n;for(let f=0;f!==n;++f)e[d+f]=e[u+f]}++a}}if(s>0){t[a]=t[s];for(let o=s*n,l=a*n,c=0;c!==n;++c)e[l+c]=e[o+c];++a}return a!==t.length?(this.times=t.slice(0,a),this.values=e.slice(0,a*n)):(this.times=t,this.values=e),this}clone(){const t=this.times.slice(),e=this.values.slice(),n=this.constructor,i=new n(this.name,t,e);return i.createInterpolant=this.createInterpolant,i}}cn.prototype.ValueTypeName="";cn.prototype.TimeBufferType=Float32Array;cn.prototype.ValueBufferType=Float32Array;cn.prototype.DefaultInterpolation=Jo;class cs extends cn{constructor(t,e,n){super(t,e,n)}}cs.prototype.ValueTypeName="bool";cs.prototype.ValueBufferType=Array;cs.prototype.DefaultInterpolation=Qr;cs.prototype.InterpolantFactoryMethodLinear=void 0;cs.prototype.InterpolantFactoryMethodSmooth=void 0;class xu extends cn{constructor(t,e,n,i){super(t,e,n,i)}}xu.prototype.ValueTypeName="color";class ra extends cn{constructor(t,e,n,i){super(t,e,n,i)}}ra.prototype.ValueTypeName="number";class Pp extends ga{constructor(t,e,n,i){super(t,e,n,i)}interpolate_(t,e,n,i){const s=this.resultBuffer,a=this.sampleValues,o=this.valueSize,l=(n-e)/(i-e);let c=t*o;for(let h=c+o;c!==h;c+=4)Ke.slerpFlat(s,0,a,c-o,a,c,l);return s}}class _a extends cn{constructor(t,e,n,i){super(t,e,n,i)}InterpolantFactoryMethodLinear(t){return new Pp(this.times,this.values,this.getValueSize(),t)}}_a.prototype.ValueTypeName="quaternion";_a.prototype.InterpolantFactoryMethodSmooth=void 0;class hs extends cn{constructor(t,e,n){super(t,e,n)}}hs.prototype.ValueTypeName="string";hs.prototype.ValueBufferType=Array;hs.prototype.DefaultInterpolation=Qr;hs.prototype.InterpolantFactoryMethodLinear=void 0;hs.prototype.InterpolantFactoryMethodSmooth=void 0;class aa extends cn{constructor(t,e,n,i){super(t,e,n,i)}}aa.prototype.ValueTypeName="vector";class oa{constructor(t="",e=-1,n=[],i=ul){this.name=t,this.tracks=n,this.duration=e,this.blendMode=i,this.uuid=$e(),this.duration<0&&this.resetDuration()}static parse(t){const e=[],n=t.tracks,i=1/(t.fps||1);for(let a=0,o=n.length;a!==o;++a)e.push(Dp(n[a]).scale(i));const s=new this(t.name,t.duration,e,t.blendMode);return s.uuid=t.uuid,s}static toJSON(t){const e=[],n=t.tracks,i={name:t.name,duration:t.duration,tracks:e,uuid:t.uuid,blendMode:t.blendMode};for(let s=0,a=n.length;s!==a;++s)e.push(cn.toJSON(n[s]));return i}static CreateFromMorphTargetSequence(t,e,n,i){const s=e.length,a=[];for(let o=0;o<s;o++){let l=[],c=[];l.push((o+s-1)%s,o,(o+1)%s),c.push(0,1,0);const h=gu(l);l=tl(l,1,h),c=tl(c,1,h),!i&&l[0]===0&&(l.push(s),c.push(c[0])),a.push(new ra(".morphTargetInfluences["+e[o].name+"]",l,c).scale(1/n))}return new this(t,-1,a)}static findByName(t,e){let n=t;if(!Array.isArray(t)){const i=t;n=i.geometry&&i.geometry.animations||i.animations}for(let i=0;i<n.length;i++)if(n[i].name===e)return n[i];return null}static CreateClipsFromMorphTargetSequences(t,e,n){const i={},s=/^([\w-]*?)([\d]+)$/;for(let o=0,l=t.length;o<l;o++){const c=t[o],h=c.name.match(s);if(h&&h.length>1){const u=h[1];let d=i[u];d||(i[u]=d=[]),d.push(c)}}const a=[];for(const o in i)a.push(this.CreateFromMorphTargetSequence(o,i[o],e,n));return a}static parseAnimation(t,e){if(console.warn("THREE.AnimationClip: parseAnimation() is deprecated and will be removed with r185"),!t)return console.error("THREE.AnimationClip: No animation in JSONLoader data."),null;const n=function(u,d,f,m,_){if(f.length!==0){const g=[],p=[];Ol(f,g,p,m),g.length!==0&&_.push(new u(d,g,p))}},i=[],s=t.name||"default",a=t.fps||30,o=t.blendMode;let l=t.length||-1;const c=t.hierarchy||[];for(let u=0;u<c.length;u++){const d=c[u].keys;if(!(!d||d.length===0))if(d[0].morphTargets){const f={};let m;for(m=0;m<d.length;m++)if(d[m].morphTargets)for(let _=0;_<d[m].morphTargets.length;_++)f[d[m].morphTargets[_]]=-1;for(const _ in f){const g=[],p=[];for(let y=0;y!==d[m].morphTargets.length;++y){const v=d[m];g.push(v.time),p.push(v.morphTarget===_?1:0)}i.push(new ra(".morphTargetInfluence["+_+"]",g,p))}l=f.length*a}else{const f=".bones["+e[u].name+"]";n(aa,f+".position",d,"pos",i),n(_a,f+".quaternion",d,"rot",i),n(aa,f+".scale",d,"scl",i)}}return i.length===0?null:new this(s,l,i,o)}resetDuration(){const t=this.tracks;let e=0;for(let n=0,i=t.length;n!==i;++n){const s=this.tracks[n];e=Math.max(e,s.times[s.times.length-1])}return this.duration=e,this}trim(){for(let t=0;t<this.tracks.length;t++)this.tracks[t].trim(0,this.duration);return this}validate(){let t=!0;for(let e=0;e<this.tracks.length;e++)t=t&&this.tracks[e].validate();return t}optimize(){for(let t=0;t<this.tracks.length;t++)this.tracks[t].optimize();return this}clone(){const t=[];for(let e=0;e<this.tracks.length;e++)t.push(this.tracks[e].clone());return new this.constructor(this.name,this.duration,t,this.blendMode)}toJSON(){return this.constructor.toJSON(this)}}function Lp(r){switch(r.toLowerCase()){case"scalar":case"double":case"float":case"number":case"integer":return ra;
vendor: 4,111 bytes, line 40
40case"vector":case"vector2":case"vector3":case"vector4":return aa;case"color":return xu;case"quaternion":return _a;case"bool":case"boolean":return cs;case"string":return hs}throw new Error("THREE.KeyframeTrack: Unsupported typeName: "+r)}function Dp(r){if(r.type===void 0)throw new Error("THREE.KeyframeTrack: track type undefined, can not parse");const t=Lp(r.type);if(r.times===void 0){const e=[],n=[];Ol(r.keys,e,n,"value"),r.times=e,r.values=n}return t.parse!==void 0?t.parse(r):new t(r.name,r.times,r.values,r.interpolation)}const Rn={enabled:!1,files:{},add:function(r,t){this.enabled!==!1&&(this.files[r]=t)},get:function(r){if(this.enabled!==!1)return this.files[r]},remove:function(r){delete this.files[r]},clear:function(){this.files={}}};class vu{constructor(t,e,n){const i=this;let s=!1,a=0,o=0,l;const c=[];this.onStart=void 0,this.onLoad=t,this.onProgress=e,this.onError=n,this.abortController=new AbortController,this.itemStart=function(h){o++,s===!1&&i.onStart!==void 0&&i.onStart(h,a,o),s=!0},this.itemEnd=function(h){a++,i.onProgress!==void 0&&i.onProgress(h,a,o),a===o&&(s=!1,i.onLoad!==void 0&&i.onLoad())},this.itemError=function(h){i.onError!==void 0&&i.onError(h)},this.resolveURL=function(h){return l?l(h):h},this.setURLModifier=function(h){return l=h,this},this.addHandler=function(h,u){return c.push(h,u),this},this.removeHandler=function(h){const u=c.indexOf(h);return u!==-1&&c.splice(u,2),this},this.getHandler=function(h){for(let u=0,d=c.length;u<d;u+=2){const f=c[u],m=c[u+1];if(f.global&&(f.lastIndex=0),f.test(h))return m}return null},this.abort=function(){return this.abortController.abort(),this.abortController=new AbortController,this}}}const Up=new vu;class Qe{constructor(t){this.manager=t!==void 0?t:Up,this.crossOrigin="anonymous",this.withCredentials=!1,this.path="",this.resourcePath="",this.requestHeader={}}load(){}loadAsync(t,e){const n=this;return new Promise(function(i,s){n.load(t,i,e,s)})}parse(){}setCrossOrigin(t){return this.crossOrigin=t,this}setWithCredentials(t){return this.withCredentials=t,this}setPath(t){return this.path=t,this}setResourcePath(t){return this.resourcePath=t,this}setRequestHeader(t){return this.requestHeader=t,this}abort(){return this}}Qe.DEFAULT_MATERIAL_NAME="__DEFAULT";const En={};class Np extends Error{constructor(t,e){super(t),this.response=e}}class Zn extends Qe{constructor(t){super(t),this.mimeType="",this.responseType="",this._abortController=new AbortController}load(t,e,n,i){t===void 0&&(t=""),this.path!==void 0&&(t=this.path+t),t=this.manager.resolveURL(t);const s=Rn.get(`file:${t}`);if(s!==void 0)return this.manager.itemStart(t),setTimeout(()=>{e&&e(s),this.manager.itemEnd(t)},0),s;if(En[t]!==void 0){En[t].push({onLoad:e,onProgress:n,onError:i});return}En[t]=[],En[t].push({onLoad:e,onProgress:n,onError:i});const a=new Request(t,{headers:new Headers(this.requestHeader),credentials:this.withCredentials?"include":"same-origin",signal:typeof AbortSignal.any=="function"?AbortSignal.any([this._abortController.signal,this.manager.abortController.signal]):this._abortController.signal}),o=this.mimeType,l=this.responseType;fetch(a).then(c=>{if(c.status===200||c.status===0){if(c.status===0&&console.warn("THREE.FileLoader: HTTP Status 0 received."),typeof ReadableStream>"u"||c.body===void 0||c.body.getReader===void 0)return c;const h=En[t],u=c.body.getReader(),d=c.headers.get("X-File-Size")||c.headers.get("Content-Length"),f=d?parseInt(d):0,m=f!==0;let _=0;const g=new ReadableStream({start(p){y();function y(){u.read().then(({done:v,value:x})=>{if(v)p.close();else{_+=x.byteLength;const A=new ProgressEvent("progress",{lengthComputable:m,loaded:_,total:f});for(let T=0,R=h.length;T<R;T++){const P=h[T];P.onProgress&&P.onProgress(A)}p.enqueue(x),y()}},v=>{p.error(v)})}}});return new Response(g)}else throw new Np(`fetch for "${c.url}" responded with ${c.status}: ${c.statusText}`,c)}).then(c=>{switch(l){case"arraybuffer":return c.arrayBuffer();case"blob":return c.blob();case"document":return c.text().then(h=>new DOMParser().parseFromString(h,o));case"json":return c.json();default:if(o==="")return c.text();
vendor: 3,242 bytes, line 40
40{const u=/charset="?([^;"\s]*)"?/i.exec(o),d=u&&u[1]?u[1].toLowerCase():void 0,f=new TextDecoder(d);return c.arrayBuffer().then(m=>f.decode(m))}}}).then(c=>{Rn.add(`file:${t}`,c);const h=En[t];delete En[t];for(let u=0,d=h.length;u<d;u++){const f=h[u];f.onLoad&&f.onLoad(c)}}).catch(c=>{const h=En[t];if(h===void 0)throw this.manager.itemError(t),c;delete En[t];for(let u=0,d=h.length;u<d;u++){const f=h[u];f.onError&&f.onError(c)}this.manager.itemError(t)}).finally(()=>{this.manager.itemEnd(t)}),this.manager.itemStart(t)}setResponseType(t){return this.responseType=t,this}setMimeType(t){return this.mimeType=t,this}abort(){return this._abortController.abort(),this._abortController=new AbortController,this}}class ay extends Qe{constructor(t){super(t)}load(t,e,n,i){const s=this,a=new Zn(this.manager);a.setPath(this.path),a.setRequestHeader(this.requestHeader),a.setWithCredentials(this.withCredentials),a.load(t,function(o){try{e(s.parse(JSON.parse(o)))}catch(l){i?i(l):console.error(l),s.manager.itemError(t)}},n,i)}parse(t){const e=[];for(let n=0;n<t.length;n++){const i=oa.parse(t[n]);e.push(i)}return e}}class oy extends Qe{constructor(t){super(t)}load(t,e,n,i){const s=this,a=[],o=new Sl,l=new Zn(this.manager);l.setPath(this.path),l.setResponseType("arraybuffer"),l.setRequestHeader(this.requestHeader),l.setWithCredentials(s.withCredentials);let c=0;function h(u){l.load(t[u],function(d){const f=s.parse(d,!0);a[u]={width:f.width,height:f.height,format:f.format,mipmaps:f.mipmaps},c+=1,c===6&&(f.mipmapCount===1&&(o.minFilter=Ee),o.image=a,o.format=f.format,o.needsUpdate=!0,e&&e(o))},n,i)}if(Array.isArray(t))for(let u=0,d=t.length;u<d;++u)h(u);else l.load(t,function(u){const d=s.parse(u,!0);if(d.isCubemap){const f=d.mipmaps.length/d.mipmapCount;for(let m=0;m<f;m++){a[m]={mipmaps:[]};for(let _=0;_<d.mipmapCount;_++)a[m].mipmaps.push(d.mipmaps[m*d.mipmapCount+_]),a[m].format=d.format,a[m].width=d.width,a[m].height=d.height}o.image=a}else o.image.width=d.width,o.image.height=d.height,o.mipmaps=d.mipmaps;d.mipmapCount===1&&(o.minFilter=Ee),o.format=d.format,o.needsUpdate=!0,e&&e(o)},n,i);return o}}const Wi=new WeakMap;class la extends Qe{constructor(t){super(t)}load(t,e,n,i){this.path!==void 0&&(t=this.path+t),t=this.manager.resolveURL(t);const s=this,a=Rn.get(`image:${t}`);if(a!==void 0){if(a.complete===!0)s.manager.itemStart(t),setTimeout(function(){e&&e(a),s.manager.itemEnd(t)},0);else{let u=Wi.get(a);u===void 0&&(u=[],Wi.set(a,u)),u.push({onLoad:e,onError:i})}return a}const o=Bs("img");function l(){h(),e&&e(this);const u=Wi.get(this)||[];for(let d=0;d<u.length;d++){const f=u[d];f.onLoad&&f.onLoad(this)}Wi.delete(this),s.manager.itemEnd(t)}function c(u){h(),i&&i(u),Rn.remove(`image:${t}`);const d=Wi.get(this)||[];for(let f=0;f<d.length;f++){const m=d[f];m.onError&&m.onError(u)}Wi.delete(this),s.manager.itemError(t),s.manager.itemEnd(t)}function h(){o.removeEventListener("load",l,!1),o.removeEventListener("error",c,!1)}return o.addEventListener("load",l,!1),o.addEventListener("error",c,!1),t.slice(0,5)!=="data:"&&this.crossOrigin!==void 0&&(o.crossOrigin=this.crossOrigin),Rn.add(`image:${t}`,o),s.manager.itemStart(t),o.src=t,o}}class ly extends Qe{constructor(t){super(t)}load(t,e,n,i){const s=new ua;
vendor: 4,690 bytes, line 40
40s.colorSpace=Ye;const a=new la(this.manager);a.setCrossOrigin(this.crossOrigin),a.setPath(this.path);let o=0;function l(c){a.load(t[c],function(h){s.images[c]=h,o++,o===6&&(s.needsUpdate=!0,e&&e(s))},void 0,i)}for(let c=0;c<t.length;++c)l(c);return s}}class cy extends Qe{constructor(t){super(t)}load(t,e,n,i){const s=this,a=new Pn,o=new Zn(this.manager);return o.setResponseType("arraybuffer"),o.setRequestHeader(this.requestHeader),o.setPath(this.path),o.setWithCredentials(s.withCredentials),o.load(t,function(l){let c;try{c=s.parse(l)}catch(h){if(i!==void 0)i(h);else{console.error(h);return}}c.image!==void 0?a.image=c.image:c.data!==void 0&&(a.image.width=c.width,a.image.height=c.height,a.image.data=c.data),a.wrapS=c.wrapS!==void 0?c.wrapS:ln,a.wrapT=c.wrapT!==void 0?c.wrapT:ln,a.magFilter=c.magFilter!==void 0?c.magFilter:Ee,a.minFilter=c.minFilter!==void 0?c.minFilter:Ee,a.anisotropy=c.anisotropy!==void 0?c.anisotropy:1,c.colorSpace!==void 0&&(a.colorSpace=c.colorSpace),c.flipY!==void 0&&(a.flipY=c.flipY),c.format!==void 0&&(a.format=c.format),c.type!==void 0&&(a.type=c.type),c.mipmaps!==void 0&&(a.mipmaps=c.mipmaps,a.minFilter=Cn),c.mipmapCount===1&&(a.minFilter=Ee),c.generateMipmaps!==void 0&&(a.generateMipmaps=c.generateMipmaps),a.needsUpdate=!0,e&&e(a,c)},n,i),a}}class hy extends Qe{constructor(t){super(t)}load(t,e,n,i){const s=new xe,a=new la(this.manager);return a.setCrossOrigin(this.crossOrigin),a.setPath(this.path),a.load(t,function(o){s.image=o,s.needsUpdate=!0,e!==void 0&&e(s)},n,i),s}}class Ei extends ie{constructor(t,e=1){super(),this.isLight=!0,this.type="Light",this.color=new vt(t),this.intensity=e}dispose(){}copy(t,e){return super.copy(t,e),this.color.copy(t.color),this.intensity=t.intensity,this}toJSON(t){const e=super.toJSON(t);return e.object.color=this.color.getHex(),e.object.intensity=this.intensity,this.groundColor!==void 0&&(e.object.groundColor=this.groundColor.getHex()),this.distance!==void 0&&(e.object.distance=this.distance),this.angle!==void 0&&(e.object.angle=this.angle),this.decay!==void 0&&(e.object.decay=this.decay),this.penumbra!==void 0&&(e.object.penumbra=this.penumbra),this.shadow!==void 0&&(e.object.shadow=this.shadow.toJSON()),this.target!==void 0&&(e.object.target=this.target.uuid),e}}class Fp extends Ei{constructor(t,e,n){super(t,n),this.isHemisphereLight=!0,this.type="HemisphereLight",this.position.copy(ie.DEFAULT_UP),this.updateMatrix(),this.groundColor=new vt(e)}copy(t,e){return super.copy(t,e),this.groundColor.copy(t.groundColor),this}}const to=new zt,qc=new C,Yc=new C;class Bl{constructor(t){this.camera=t,this.intensity=1,this.bias=0,this.normalBias=0,this.radius=1,this.blurSamples=8,this.mapSize=new K(512,512),this.mapType=mn,this.map=null,this.mapPass=null,this.matrix=new zt,this.autoUpdate=!0,this.needsUpdate=!1,this._frustum=new qs,this._frameExtents=new K(1,1),this._viewportCount=1,this._viewports=[new ne(0,0,1,1)]}getViewportCount(){return this._viewportCount}getFrustum(){return this._frustum}updateMatrices(t){const e=this.camera,n=this.matrix;qc.setFromMatrixPosition(t.matrixWorld),e.position.copy(qc),Yc.setFromMatrixPosition(t.target.matrixWorld),e.lookAt(Yc),e.updateMatrixWorld(),to.multiplyMatrices(e.projectionMatrix,e.matrixWorldInverse),this._frustum.setFromProjectionMatrix(to,e.coordinateSystem,e.reversedDepth),e.reversedDepth?n.set(.5,0,0,.5,0,.5,0,.5,0,0,1,0,0,0,0,1):n.set(.5,0,0,.5,0,.5,0,.5,0,0,.5,.5,0,0,0,1),n.multiply(to)}getViewport(t){return this._viewports[t]}getFrameExtents(){return this._frameExtents}dispose(){this.map&&this.map.dispose(),this.mapPass&&this.mapPass.dispose()}copy(t){return this.camera=t.camera.clone(),this.intensity=t.intensity,this.bias=t.bias,this.radius=t.radius,this.autoUpdate=t.autoUpdate,this.needsUpdate=t.needsUpdate,this.normalBias=t.normalBias,this.blurSamples=t.blurSamples,this.mapSize.copy(t.mapSize),this}clone(){return new this.constructor().copy(this)}toJSON(){const t={};return this.intensity!==1&&(t.intensity=this.intensity),this.bias!==0&&(t.bias=this.bias),this.normalBias!==0&&(t.normalBias=this.normalBias),this.radius!==1&&(t.radius=this.radius),(this.mapSize.x!==512||this.mapSize.y!==512)&&(t.mapSize=this.mapSize.toArray()),t.camera=this.camera.toJSON(!1).object,delete t.camera.matrix,t}}class Op extends Bl{constructor(){super(new Ce(50,1,.5,500)),this.isSpotLightShadow=!0,this.focus=1,this.aspect=1}updateMatrices(t){const e=this.camera,n=ss*2*t.angle*this.focus,i=this.mapSize.width/this.mapSize.height*this.aspect,s=t.distance||e.far;(n!==e.fov||i!==e.aspect||s!==e.far)&&(e.fov=n,e.aspect=i,e.far=s,e.updateProjectionMatrix()),super.updateMatrices(t)}copy(t){return super.copy(t),this.focus=t.focus,this}}
vendor: 4,092 bytes, line 40
40class Bp extends Ei{constructor(t,e,n=0,i=Math.PI/3,s=0,a=2){super(t,e),this.isSpotLight=!0,this.type="SpotLight",this.position.copy(ie.DEFAULT_UP),this.updateMatrix(),this.target=new ie,this.distance=n,this.angle=i,this.penumbra=s,this.decay=a,this.map=null,this.shadow=new Op}get power(){return this.intensity*Math.PI}set power(t){this.intensity=t/Math.PI}dispose(){this.shadow.dispose()}copy(t,e){return super.copy(t,e),this.distance=t.distance,this.angle=t.angle,this.penumbra=t.penumbra,this.decay=t.decay,this.target=t.target.clone(),this.shadow=t.shadow.clone(),this}}const Zc=new zt,Es=new C,eo=new C;class zp extends Bl{constructor(){super(new Ce(90,1,.5,500)),this.isPointLightShadow=!0,this._frameExtents=new K(4,2),this._viewportCount=6,this._viewports=[new ne(2,1,1,1),new ne(0,1,1,1),new ne(3,1,1,1),new ne(1,1,1,1),new ne(3,0,1,1),new ne(1,0,1,1)],this._cubeDirections=[new C(1,0,0),new C(-1,0,0),new C(0,0,1),new C(0,0,-1),new C(0,1,0),new C(0,-1,0)],this._cubeUps=[new C(0,1,0),new C(0,1,0),new C(0,1,0),new C(0,1,0),new C(0,0,1),new C(0,0,-1)]}updateMatrices(t,e=0){const n=this.camera,i=this.matrix,s=t.distance||n.far;s!==n.far&&(n.far=s,n.updateProjectionMatrix()),Es.setFromMatrixPosition(t.matrixWorld),n.position.copy(Es),eo.copy(n.position),eo.add(this._cubeDirections[e]),n.up.copy(this._cubeUps[e]),n.lookAt(eo),n.updateMatrixWorld(),i.makeTranslation(-Es.x,-Es.y,-Es.z),Zc.multiplyMatrices(n.projectionMatrix,n.matrixWorldInverse),this._frustum.setFromProjectionMatrix(Zc,n.coordinateSystem,n.reversedDepth)}}class kp extends Ei{constructor(t,e,n=0,i=2){super(t,e),this.isPointLight=!0,this.type="PointLight",this.distance=n,this.decay=i,this.shadow=new zp}get power(){return this.intensity*4*Math.PI}set power(t){this.intensity=t/(4*Math.PI)}dispose(){this.shadow.dispose()}copy(t,e){return super.copy(t,e),this.distance=t.distance,this.decay=t.decay,this.shadow=t.shadow.clone(),this}}class zl extends gl{constructor(t=-1,e=1,n=1,i=-1,s=.1,a=2e3){super(),this.isOrthographicCamera=!0,this.type="OrthographicCamera",this.zoom=1,this.view=null,this.left=t,this.right=e,this.top=n,this.bottom=i,this.near=s,this.far=a,this.updateProjectionMatrix()}copy(t,e){return super.copy(t,e),this.left=t.left,this.right=t.right,this.top=t.top,this.bottom=t.bottom,this.near=t.near,this.far=t.far,this.zoom=t.zoom,this.view=t.view===null?null:Object.assign({},t.view),this}setViewOffset(t,e,n,i,s,a){this.view===null&&(this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1}),this.view.enabled=!0,this.view.fullWidth=t,this.view.fullHeight=e,this.view.offsetX=n,this.view.offsetY=i,this.view.width=s,this.view.height=a,this.updateProjectionMatrix()}clearViewOffset(){this.view!==null&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){const t=(this.right-this.left)/(2*this.zoom),e=(this.top-this.bottom)/(2*this.zoom),n=(this.right+this.left)/2,i=(this.top+this.bottom)/2;let s=n-t,a=n+t,o=i+e,l=i-e;if(this.view!==null&&this.view.enabled){const c=(this.right-this.left)/this.view.fullWidth/this.zoom,h=(this.top-this.bottom)/this.view.fullHeight/this.zoom;s+=c*this.view.offsetX,a=s+c*this.view.width,o-=h*this.view.offsetY,l=o-h*this.view.height}this.projectionMatrix.makeOrthographic(s,a,o,l,this.near,this.far,this.coordinateSystem,this.reversedDepth),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(t){const e=super.toJSON(t);return e.object.zoom=this.zoom,e.object.left=this.left,e.object.right=this.right,e.object.top=this.top,e.object.bottom=this.bottom,e.object.near=this.near,e.object.far=this.far,this.view!==null&&(e.object.view=Object.assign({},this.view)),e}}class Vp extends Bl{constructor(){super(new zl(-5,5,5,-5,.5,500)),this.isDirectionalLightShadow=!0}}class Hp extends Ei{constructor(t,e){super(t,e),this.isDirectionalLight=!0,this.type="DirectionalLight",this.position.copy(ie.DEFAULT_UP),this.updateMatrix(),this.target=new ie,this.shadow=new Vp}dispose(){this.shadow.dispose()}copy(t){return super.copy(t),this.target=t.target.clone(),this.shadow=t.shadow.clone(),this}}
vendor: 23,577 bytes, line 40
40class Gp extends Ei{constructor(t,e){super(t,e),this.isAmbientLight=!0,this.type="AmbientLight"}}class Wp extends Ei{constructor(t,e,n=10,i=10){super(t,e),this.isRectAreaLight=!0,this.type="RectAreaLight",this.width=n,this.height=i}get power(){return this.intensity*this.width*this.height*Math.PI}set power(t){this.intensity=t/(this.width*this.height*Math.PI)}copy(t){return super.copy(t),this.width=t.width,this.height=t.height,this}toJSON(t){const e=super.toJSON(t);return e.object.width=this.width,e.object.height=this.height,e}}class Xp{constructor(){this.isSphericalHarmonics3=!0,this.coefficients=[];for(let t=0;t<9;t++)this.coefficients.push(new C)}set(t){for(let e=0;e<9;e++)this.coefficients[e].copy(t[e]);return this}zero(){for(let t=0;t<9;t++)this.coefficients[t].set(0,0,0);return this}getAt(t,e){const n=t.x,i=t.y,s=t.z,a=this.coefficients;return e.copy(a[0]).multiplyScalar(.282095),e.addScaledVector(a[1],.488603*i),e.addScaledVector(a[2],.488603*s),e.addScaledVector(a[3],.488603*n),e.addScaledVector(a[4],1.092548*(n*i)),e.addScaledVector(a[5],1.092548*(i*s)),e.addScaledVector(a[6],.315392*(3*s*s-1)),e.addScaledVector(a[7],1.092548*(n*s)),e.addScaledVector(a[8],.546274*(n*n-i*i)),e}getIrradianceAt(t,e){const n=t.x,i=t.y,s=t.z,a=this.coefficients;return e.copy(a[0]).multiplyScalar(.886227),e.addScaledVector(a[1],2*.511664*i),e.addScaledVector(a[2],2*.511664*s),e.addScaledVector(a[3],2*.511664*n),e.addScaledVector(a[4],2*.429043*n*i),e.addScaledVector(a[5],2*.429043*i*s),e.addScaledVector(a[6],.743125*s*s-.247708),e.addScaledVector(a[7],2*.429043*n*s),e.addScaledVector(a[8],.429043*(n*n-i*i)),e}add(t){for(let e=0;e<9;e++)this.coefficients[e].add(t.coefficients[e]);return this}addScaledSH(t,e){for(let n=0;n<9;n++)this.coefficients[n].addScaledVector(t.coefficients[n],e);return this}scale(t){for(let e=0;e<9;e++)this.coefficients[e].multiplyScalar(t);return this}lerp(t,e){for(let n=0;n<9;n++)this.coefficients[n].lerp(t.coefficients[n],e);return this}equals(t){for(let e=0;e<9;e++)if(!this.coefficients[e].equals(t.coefficients[e]))return!1;return!0}copy(t){return this.set(t.coefficients)}clone(){return new this.constructor().copy(this)}fromArray(t,e=0){const n=this.coefficients;for(let i=0;i<9;i++)n[i].fromArray(t,e+i*3);return this}toArray(t=[],e=0){const n=this.coefficients;for(let i=0;i<9;i++)n[i].toArray(t,e+i*3);return t}static getBasisAt(t,e){const n=t.x,i=t.y,s=t.z;e[0]=.282095,e[1]=.488603*i,e[2]=.488603*s,e[3]=.488603*n,e[4]=1.092548*n*i,e[5]=1.092548*i*s,e[6]=.315392*(3*s*s-1),e[7]=1.092548*n*s,e[8]=.546274*(n*n-i*i)}}class qp extends Ei{constructor(t=new Xp,e=1){super(void 0,e),this.isLightProbe=!0,this.sh=t}copy(t){return super.copy(t),this.sh.copy(t.sh),this}fromJSON(t){return this.intensity=t.intensity,this.sh.fromArray(t.sh),this}toJSON(t){const e=super.toJSON(t);return e.object.sh=this.sh.toArray(),e}}class kl extends Qe{constructor(t){super(t),this.textures={}}load(t,e,n,i){const s=this,a=new Zn(s.manager);a.setPath(s.path),a.setRequestHeader(s.requestHeader),a.setWithCredentials(s.withCredentials),a.load(t,function(o){try{e(s.parse(JSON.parse(o)))}catch(l){i?i(l):console.error(l),s.manager.itemError(t)}},n,i)}parse(t){const e=this.textures;function n(s){return e[s]===void 0&&console.warn("THREE.MaterialLoader: Undefined texture",s),e[s]}const i=this.createMaterialFromType(t.type);if(t.uuid!==void 0&&(i.uuid=t.uuid),t.name!==void 0&&(i.name=t.name),t.color!==void 0&&i.color!==void 0&&i.color.setHex(t.color),t.roughness!==void 0&&(i.roughness=t.roughness),t.metalness!==void 0&&(i.metalness=t.metalness),t.sheen!==void 0&&(i.sheen=t.sheen),t.sheenColor!==void 0&&(i.sheenColor=new vt().setHex(t.sheenColor)),t.sheenRoughness!==void 0&&(i.sheenRoughness=t.sheenRoughness),t.emissive!==void 0&&i.emissive!==void 0&&i.emissive.setHex(t.emissive),t.specular!==void 0&&i.specular!==void 0&&i.specular.setHex(t.specular),t.specularIntensity!==void 0&&(i.specularIntensity=t.specularIntensity),t.specularColor!==void 0&&i.specularColor!==void 0&&i.specularColor.setHex(t.specularColor),t.shininess!==void 0&&(i.shininess=t.shininess),t.clearcoat!==void 0&&(i.clearcoat=t.clearcoat),t.clearcoatRoughness!==void 0&&(i.clearcoatRoughness=t.clearcoatRoughness),t.dispersion!==void 0&&(i.dispersion=t.dispersion),t.iridescence!==void 0&&(i.iridescence=t.iridescence),t.iridescenceIOR!==void 0&&(i.iridescenceIOR=t.iridescenceIOR),t.iridescenceThicknessRange!==void 0&&(i.iridescenceThicknessRange=t.iridescenceThicknessRange),t.transmission!==void 0&&(i.transmission=t.transmission),t.thickness!==void 0&&(i.thickness=t.thickness),t.attenuationDistance!==void 0&&(i.attenuationDistance=t.attenuationDistance),t.attenuationColor!==void 0&&i.attenuationColor!==void 0&&i.attenuationColor.setHex(t.attenuationColor),t.anisotropy!==void 0&&(i.anisotropy=t.anisotropy),t.anisotropyRotation!==void 0&&(i.anisotropyRotation=t.anisotropyRotation),t.fog!==void 0&&(i.fog=t.fog),t.flatShading!==void 0&&(i.flatShading=t.flatShading),t.blending!==void 0&&(i.blending=t.blending),t.combine!==void 0&&(i.combine=t.combine),t.side!==void 0&&(i.side=t.side),t.shadowSide!==void 0&&(i.shadowSide=t.shadowSide),t.opacity!==void 0&&(i.opacity=t.opacity),t.transparent!==void 0&&(i.transparent=t.transparent),t.alphaTest!==void 0&&(i.alphaTest=t.alphaTest),t.alphaHash!==void 0&&(i.alphaHash=t.alphaHash),t.depthFunc!==void 0&&(i.depthFunc=t.depthFunc),t.depthTest!==void 0&&(i.depthTest=t.depthTest),t.depthWrite!==void 0&&(i.depthWrite=t.depthWrite),t.colorWrite!==void 0&&(i.colorWrite=t.colorWrite),t.blendSrc!==void 0&&(i.blendSrc=t.blendSrc),t.blendDst!==void 0&&(i.blendDst=t.blendDst),t.blendEquation!==void 0&&(i.blendEquation=t.blendEquation),t.blendSrcAlpha!==void 0&&(i.blendSrcAlpha=t.blendSrcAlpha),t.blendDstAlpha!==void 0&&(i.blendDstAlpha=t.blendDstAlpha),t.blendEquationAlpha!==void 0&&(i.blendEquationAlpha=t.blendEquationAlpha),t.blendColor!==void 0&&i.blendColor!==void 0&&i.blendColor.setHex(t.blendColor),t.blendAlpha!==void 0&&(i.blendAlpha=t.blendAlpha),t.stencilWriteMask!==void 0&&(i.stencilWriteMask=t.stencilWriteMask),t.stencilFunc!==void 0&&(i.stencilFunc=t.stencilFunc),t.stencilRef!==void 0&&(i.stencilRef=t.stencilRef),t.stencilFuncMask!==void 0&&(i.stencilFuncMask=t.stencilFuncMask),t.stencilFail!==void 0&&(i.stencilFail=t.stencilFail),t.stencilZFail!==void 0&&(i.stencilZFail=t.stencilZFail),t.stencilZPass!==void 0&&(i.stencilZPass=t.stencilZPass),t.stencilWrite!==void 0&&(i.stencilWrite=t.stencilWrite),t.wireframe!==void 0&&(i.wireframe=t.wireframe),t.wireframeLinewidth!==void 0&&(i.wireframeLinewidth=t.wireframeLinewidth),t.wireframeLinecap!==void 0&&(i.wireframeLinecap=t.wireframeLinecap),t.wireframeLinejoin!==void 0&&(i.wireframeLinejoin=t.wireframeLinejoin),t.rotation!==void 0&&(i.rotation=t.rotation),t.linewidth!==void 0&&(i.linewidth=t.linewidth),t.dashSize!==void 0&&(i.dashSize=t.dashSize),t.gapSize!==void 0&&(i.gapSize=t.gapSize),t.scale!==void 0&&(i.scale=t.scale),t.polygonOffset!==void 0&&(i.polygonOffset=t.polygonOffset),t.polygonOffsetFactor!==void 0&&(i.polygonOffsetFactor=t.polygonOffsetFactor),t.polygonOffsetUnits!==void 0&&(i.polygonOffsetUnits=t.polygonOffsetUnits),t.dithering!==void 0&&(i.dithering=t.dithering),t.alphaToCoverage!==void 0&&(i.alphaToCoverage=t.alphaToCoverage),t.premultipliedAlpha!==void 0&&(i.premultipliedAlpha=t.premultipliedAlpha),t.forceSinglePass!==void 0&&(i.forceSinglePass=t.forceSinglePass),t.visible!==void 0&&(i.visible=t.visible),t.toneMapped!==void 0&&(i.toneMapped=t.toneMapped),t.userData!==void 0&&(i.userData=t.userData),t.vertexColors!==void 0&&(typeof t.vertexColors=="number"?i.vertexColors=t.vertexColors>0:i.vertexColors=t.vertexColors),t.uniforms!==void 0)for(const s in t.uniforms){const a=t.uniforms[s];switch(i.uniforms[s]={},a.type){case"t":i.uniforms[s].value=n(a.value);break;case"c":i.uniforms[s].value=new vt().setHex(a.value);break;case"v2":i.uniforms[s].value=new K().fromArray(a.value);break;case"v3":i.uniforms[s].value=new C().fromArray(a.value);break;case"v4":i.uniforms[s].value=new ne().fromArray(a.value);break;case"m3":i.uniforms[s].value=new Xt().fromArray(a.value);break;case"m4":i.uniforms[s].value=new zt().fromArray(a.value);break;default:i.uniforms[s].value=a.value}}if(t.defines!==void 0&&(i.defines=t.defines),t.vertexShader!==void 0&&(i.vertexShader=t.vertexShader),t.fragmentShader!==void 0&&(i.fragmentShader=t.fragmentShader),t.glslVersion!==void 0&&(i.glslVersion=t.glslVersion),t.extensions!==void 0)for(const s in t.extensions)i.extensions[s]=t.extensions[s];if(t.lights!==void 0&&(i.lights=t.lights),t.clipping!==void 0&&(i.clipping=t.clipping),t.size!==void 0&&(i.size=t.size),t.sizeAttenuation!==void 0&&(i.sizeAttenuation=t.sizeAttenuation),t.map!==void 0&&(i.map=n(t.map)),t.matcap!==void 0&&(i.matcap=n(t.matcap)),t.alphaMap!==void 0&&(i.alphaMap=n(t.alphaMap)),t.bumpMap!==void 0&&(i.bumpMap=n(t.bumpMap)),t.bumpScale!==void 0&&(i.bumpScale=t.bumpScale),t.normalMap!==void 0&&(i.normalMap=n(t.normalMap)),t.normalMapType!==void 0&&(i.normalMapType=t.normalMapType),t.normalScale!==void 0){let s=t.normalScale;Array.isArray(s)===!1&&(s=[s,s]),i.normalScale=new K().fromArray(s)}return t.displacementMap!==void 0&&(i.displacementMap=n(t.displacementMap)),t.displacementScale!==void 0&&(i.displacementScale=t.displacementScale),t.displacementBias!==void 0&&(i.displacementBias=t.displacementBias),t.roughnessMap!==void 0&&(i.roughnessMap=n(t.roughnessMap)),t.metalnessMap!==void 0&&(i.metalnessMap=n(t.metalnessMap)),t.emissiveMap!==void 0&&(i.emissiveMap=n(t.emissiveMap)),t.emissiveIntensity!==void 0&&(i.emissiveIntensity=t.emissiveIntensity),t.specularMap!==void 0&&(i.specularMap=n(t.specularMap)),t.specularIntensityMap!==void 0&&(i.specularIntensityMap=n(t.specularIntensityMap)),t.specularColorMap!==void 0&&(i.specularColorMap=n(t.specularColorMap)),t.envMap!==void 0&&(i.envMap=n(t.envMap)),t.envMapRotation!==void 0&&i.envMapRotation.fromArray(t.envMapRotation),t.envMapIntensity!==void 0&&(i.envMapIntensity=t.envMapIntensity),t.reflectivity!==void 0&&(i.reflectivity=t.reflectivity),t.refractionRatio!==void 0&&(i.refractionRatio=t.refractionRatio),t.lightMap!==void 0&&(i.lightMap=n(t.lightMap)),t.lightMapIntensity!==void 0&&(i.lightMapIntensity=t.lightMapIntensity),t.aoMap!==void 0&&(i.aoMap=n(t.aoMap)),t.aoMapIntensity!==void 0&&(i.aoMapIntensity=t.aoMapIntensity),t.gradientMap!==void 0&&(i.gradientMap=n(t.gradientMap)),t.clearcoatMap!==void 0&&(i.clearcoatMap=n(t.clearcoatMap)),t.clearcoatRoughnessMap!==void 0&&(i.clearcoatRoughnessMap=n(t.clearcoatRoughnessMap)),t.clearcoatNormalMap!==void 0&&(i.clearcoatNormalMap=n(t.clearcoatNormalMap)),t.clearcoatNormalScale!==void 0&&(i.clearcoatNormalScale=new K().fromArray(t.clearcoatNormalScale)),t.iridescenceMap!==void 0&&(i.iridescenceMap=n(t.iridescenceMap)),t.iridescenceThicknessMap!==void 0&&(i.iridescenceThicknessMap=n(t.iridescenceThicknessMap)),t.transmissionMap!==void 0&&(i.transmissionMap=n(t.transmissionMap)),t.thicknessMap!==void 0&&(i.thicknessMap=n(t.thicknessMap)),t.anisotropyMap!==void 0&&(i.anisotropyMap=n(t.anisotropyMap)),t.sheenColorMap!==void 0&&(i.sheenColorMap=n(t.sheenColorMap)),t.sheenRoughnessMap!==void 0&&(i.sheenRoughnessMap=n(t.sheenRoughnessMap)),i}setTextures(t){return this.textures=t,this}createMaterialFromType(t){return kl.createMaterialFromType(t)}static createMaterialFromType(t){const e={ShadowMaterial:xp,SpriteMaterial:Qh,RawShaderMaterial:vp,ShaderMaterial:gn,PointsMaterial:eu,MeshPhysicalMaterial:yp,MeshStandardMaterial:du,MeshPhongMaterial:Mp,MeshToonMaterial:Sp,MeshNormalMaterial:bp,MeshLambertMaterial:Ep,MeshDepthMaterial:fu,MeshDistanceMaterial:pu,MeshBasicMaterial:Si,MeshMatcapMaterial:Tp,LineDashedMaterial:Ap,LineBasicMaterial:He,Material:Fe};return new e[t]}}class Jc{static extractUrlBase(t){const e=t.lastIndexOf("/");return e===-1?"./":t.slice(0,e+1)}static resolveURL(t,e){return typeof t!="string"||t===""?"":(/^https?:\/\//i.test(e)&&/^\//.test(t)&&(e=e.replace(/(^https?:\/\/[^\/]+).*/i,"$1")),/^(https?:)?\/\//i.test(t)||/^data:.*,.*$/i.test(t)||/^blob:.*$/i.test(t)?t:e+t)}}class Yp extends Zt{constructor(){super(),this.isInstancedBufferGeometry=!0,this.type="InstancedBufferGeometry",this.instanceCount=1/0}copy(t){return super.copy(t),this.instanceCount=t.instanceCount,this}toJSON(){const t=super.toJSON();return t.instanceCount=this.instanceCount,t.isInstancedBufferGeometry=!0,t}}class Zp extends Qe{constructor(t){super(t)}load(t,e,n,i){const s=this,a=new Zn(s.manager);a.setPath(s.path),a.setRequestHeader(s.requestHeader),a.setWithCredentials(s.withCredentials),a.load(t,function(o){try{e(s.parse(JSON.parse(o)))}catch(l){i?i(l):console.error(l),s.manager.itemError(t)}},n,i)}parse(t){const e={},n={};function i(f,m){if(e[m]!==void 0)return e[m];const g=f.interleavedBuffers[m],p=s(f,g.buffer),y=$i(g.type,p),v=new vl(y,g.stride);return v.uuid=g.uuid,e[m]=v,v}function s(f,m){if(n[m]!==void 0)return n[m];const g=f.arrayBuffers[m],p=new Uint32Array(g).buffer;return n[m]=p,p}const a=t.isInstancedBufferGeometry?new Yp:new Zt,o=t.data.index;if(o!==void 0){const f=$i(o.type,o.array);a.setIndex(new le(f,1))}const l=t.data.attributes;for(const f in l){const m=l[f];let _;if(m.isInterleavedBufferAttribute){const g=i(t.data,m.data);_=new as(g,m.itemSize,m.offset,m.normalized)}else{const g=$i(m.type,m.array),p=m.isInstancedBufferAttribute?zs:le;_=new p(g,m.itemSize,m.normalized)}m.name!==void 0&&(_.name=m.name),m.usage!==void 0&&_.setUsage(m.usage),a.setAttribute(f,_)}const c=t.data.morphAttributes;if(c)for(const f in c){const m=c[f],_=[];for(let g=0,p=m.length;g<p;g++){const y=m[g];let v;if(y.isInterleavedBufferAttribute){const x=i(t.data,y.data);v=new as(x,y.itemSize,y.offset,y.normalized)}else{const x=$i(y.type,y.array);v=new le(x,y.itemSize,y.normalized)}y.name!==void 0&&(v.name=y.name),_.push(v)}a.morphAttributes[f]=_}t.data.morphTargetsRelative&&(a.morphTargetsRelative=!0);const u=t.data.groups||t.data.drawcalls||t.data.offsets;if(u!==void 0)for(let f=0,m=u.length;f!==m;++f){const _=u[f];a.addGroup(_.start,_.count,_.materialIndex)}const d=t.data.boundingSphere;return d!==void 0&&(a.boundingSphere=new Ie().fromJSON(d)),t.name&&(a.name=t.name),t.userData&&(a.userData=t.userData),a}}class uy extends Qe{constructor(t){super(t)}load(t,e,n,i){const s=this,a=this.path===""?Jc.extractUrlBase(t):this.path;this.resourcePath=this.resourcePath||a;const o=new Zn(this.manager);o.setPath(this.path),o.setRequestHeader(this.requestHeader),o.setWithCredentials(this.withCredentials),o.load(t,function(l){let c=null;try{c=JSON.parse(l)}catch(u){i!==void 0&&i(u),console.error("THREE:ObjectLoader: Can't parse "+t+".",u.message);return}const h=c.metadata;if(h===void 0||h.type===void 0||h.type.toLowerCase()==="geometry"){i!==void 0&&i(new Error("THREE.ObjectLoader: Can't load "+t)),console.error("THREE.ObjectLoader: Can't load "+t);return}s.parse(c,e)},n,i)}async loadAsync(t,e){const n=this,i=this.path===""?Jc.extractUrlBase(t):this.path;this.resourcePath=this.resourcePath||i;const s=new Zn(this.manager);s.setPath(this.path),s.setRequestHeader(this.requestHeader),s.setWithCredentials(this.withCredentials);const a=await s.loadAsync(t,e),o=JSON.parse(a),l=o.metadata;if(l===void 0||l.type===void 0||l.type.toLowerCase()==="geometry")throw new Error("THREE.ObjectLoader: Can't load "+t);return await n.parseAsync(o)}parse(t,e){const n=this.parseAnimations(t.animations),i=this.parseShapes(t.shapes),s=this.parseGeometries(t.geometries,i),a=this.parseImages(t.images,function(){e!==void 0&&e(c)}),o=this.parseTextures(t.textures,a),l=this.parseMaterials(t.materials,o),c=this.parseObject(t.object,s,l,o,n),h=this.parseSkeletons(t.skeletons,c);if(this.bindSkeletons(c,h),this.bindLightTargets(c),e!==void 0){let u=!1;for(const d in a)if(a[d].data instanceof HTMLImageElement){u=!0;break}u===!1&&e(c)}return c}async parseAsync(t){const e=this.parseAnimations(t.animations),n=this.parseShapes(t.shapes),i=this.parseGeometries(t.geometries,n),s=await this.parseImagesAsync(t.images),a=this.parseTextures(t.textures,s),o=this.parseMaterials(t.materials,a),l=this.parseObject(t.object,i,o,a,e),c=this.parseSkeletons(t.skeletons,l);return this.bindSkeletons(l,c),this.bindLightTargets(l),l}parseShapes(t){const e={};if(t!==void 0)for(let n=0,i=t.length;n<i;n++){const s=new es().fromJSON(t[n]);e[s.uuid]=s}return e}parseSkeletons(t,e){const n={},i={};if(e.traverse(function(s){s.isBone&&(i[s.uuid]=s)}),t!==void 0)for(let s=0,a=t.length;s<a;s++){const o=new yl().fromJSON(t[s],i);n[o.uuid]=o}return n}parseGeometries(t,e){const n={};if(t!==void 0){const i=new Zp;for(let s=0,a=t.length;s<a;s++){let o;const l=t[s];switch(l.type){case"BufferGeometry":case"InstancedBufferGeometry":o=i.parse(l);break;default:l.type in Xc?o=Xc[l.type].fromJSON(l,e):console.warn(`THREE.ObjectLoader: Unsupported geometry type "${l.type}"`)}o.uuid=l.uuid,l.name!==void 0&&(o.name=l.name),l.userData!==void 0&&(o.userData=l.userData),n[l.uuid]=o}}return n}parseMaterials(t,e){const n={},i={};if(t!==void 0){const s=new kl;s.setTextures(e);for(let a=0,o=t.length;a<o;a++){const l=t[a];n[l.uuid]===void 0&&(n[l.uuid]=s.parse(l)),i[l.uuid]=n[l.uuid]}}return i}parseAnimations(t){const e={};if(t!==void 0)for(let n=0;n<t.length;n++){const i=t[n],s=oa.parse(i);e[s.uuid]=s}return e}parseImages(t,e){const n=this,i={};let s;function a(l){return n.manager.itemStart(l),s.load(l,function(){n.manager.itemEnd(l)},void 0,function(){n.manager.itemError(l),n.manager.itemEnd(l)})}function o(l){if(typeof l=="string"){const c=l,h=/^(\/\/)|([a-z]+:(\/\/)?)/i.test(c)?c:n.resourcePath+c;return a(h)}else return l.data?{data:$i(l.type,l.data),width:l.width,height:l.height}:null}if(t!==void 0&&t.length>0){const l=new vu(e);s=new la(l),s.setCrossOrigin(this.crossOrigin);for(let c=0,h=t.length;c<h;c++){const u=t[c],d=u.url;if(Array.isArray(d)){const f=[];for(let m=0,_=d.length;m<_;m++){const g=d[m],p=o(g);p!==null&&(p instanceof HTMLImageElement?f.push(p):f.push(new Pn(p.data,p.width,p.height)))}i[u.uuid]=new mi(f)}else{const f=o(u.url);i[u.uuid]=new mi(f)}}}return i}async parseImagesAsync(t){const e=this,n={};let i;async function s(a){if(typeof a=="string"){const o=a,l=/^(\/\/)|([a-z]+:(\/\/)?)/i.test(o)?o:e.resourcePath+o;return await i.loadAsync(l)}else return a.data?{data:$i(a.type,a.data),width:a.width,height:a.height}:null}if(t!==void 0&&t.length>0){i=new la(this.manager),i.setCrossOrigin(this.crossOrigin);for(let a=0,o=t.length;a<o;a++){const l=t[a],c=l.url;if(Array.isArray(c)){const h=[];for(let u=0,d=c.length;u<d;u++){const f=c[u],m=await s(f);m!==null&&(m instanceof HTMLImageElement?h.push(m):h.push(new Pn(m.data,m.width,m.height)))}n[l.uuid]=new mi(h)}else{const h=await s(l.url);n[l.uuid]=new mi(h)}}}return n}parseTextures(t,e){function n(s,a){return typeof s=="number"?s:(console.warn("THREE.ObjectLoader.parseTexture: Constant should be in numeric form.",s),a[s])}const i={};if(t!==void 0)for(let s=0,a=t.length;s<a;s++){const o=t[s];o.image===void 0&&console.warn('THREE.ObjectLoader: No "image" specified for',o.uuid),e[o.image]===void 0&&console.warn("THREE.ObjectLoader: Undefined image",o.image);const l=e[o.image],c=l.data;let h;Array.isArray(c)?(h=new ua,c.length===6&&(h.needsUpdate=!0)):(c&&c.data?h=new Pn:h=new xe,c&&(h.needsUpdate=!0)),h.source=l,h.uuid=o.uuid,o.name!==void 0&&(h.name=o.name),o.mapping!==void 0&&(h.mapping=n(o.mapping,Jp)),o.channel!==void 0&&(h.channel=o.channel),o.offset!==void 0&&h.offset.fromArray(o.offset),o.repeat!==void 0&&h.repeat.fromArray(o.repeat),o.center!==void 0&&h.center.fromArray(o.center),o.rotation!==void 0&&(h.rotation=o.rotation),o.wrap!==void 0&&(h.wrapS=n(o.wrap[0],$c),h.wrapT=n(o.wrap[1],$c)),o.format!==void 0&&(h.format=o.format),o.internalFormat!==void 0&&(h.internalFormat=o.internalFormat),o.type!==void 0&&(h.type=o.type),o.colorSpace!==void 0&&(h.colorSpace=o.colorSpace),o.minFilter!==void 0&&(h.minFilter=n(o.minFilter,Kc)),o.magFilter!==void 0&&(h.magFilter=n(o.magFilter,Kc)),o.anisotropy!==void 0&&(h.anisotropy=o.anisotropy),o.flipY!==void 0&&(h.flipY=o.flipY),o.generateMipmaps!==void 0&&(h.generateMipmaps=o.generateMipmaps),o.premultiplyAlpha!==void 0&&(h.premultiplyAlpha=o.premultiplyAlpha),o.unpackAlignment!==void 0&&(h.unpackAlignment=o.unpackAlignment),o.compareFunction!==void 0&&(h.compareFunction=o.compareFunction),o.userData!==void 0&&(h.userData=o.userData),i[o.uuid]=h}return i}parseObject(t,e,n,i,s){let a;function o(d){return e[d]===void 0&&console.warn("THREE.ObjectLoader: Undefined geometry",d),e[d]}function l(d){if(d!==void 0){if(Array.isArray(d)){const f=[];for(let m=0,_=d.length;m<_;m++){const g=d[m];n[g]===void 0&&console.warn("THREE.ObjectLoader: Undefined material",g),f.push(n[g])}return f}return n[d]===void 0&&console.warn("THREE.ObjectLoader: Undefined material",d),n[d]}}function c(d){return i[d]===void 0&&console.warn("THREE.ObjectLoader: Undefined texture",d),i[d]}let h,u;switch(t.type){case"Scene":a=new mf,t.background!==void 0&&(Number.isInteger(t.background)?a.background=new vt(t.background):a.background=c(t.background)),t.environment!==void 0&&(a.environment=c(t.environment)),t.fog!==void 0&&(t.fog.type==="Fog"?a.fog=new xl(t.fog.color,t.fog.near,t.fog.far):t.fog.type==="FogExp2"&&(a.fog=new _l(t.fog.color,t.fog.density)),t.fog.name!==""&&(a.fog.name=t.fog.name)),t.backgroundBlurriness!==void 0&&(a.backgroundBlurriness=t.backgroundBlurriness),t.backgroundIntensity!==void 0&&(a.backgroundIntensity=t.backgroundIntensity),t.backgroundRotation!==void 0&&a.backgroundRotation.fromArray(t.backgroundRotation),t.environmentIntensity!==void 0&&(a.environmentIntensity=t.environmentIntensity),t.environmentRotation!==void 0&&a.environmentRotation.fromArray(t.environmentRotation);break;case"PerspectiveCamera":a=new Ce(t.fov,t.aspect,t.near,t.far),t.focus!==void 0&&(a.focus=t.focus),t.zoom!==void 0&&(a.zoom=t.zoom),t.filmGauge!==void 0&&(a.filmGauge=t.filmGauge),t.filmOffset!==void 0&&(a.filmOffset=t.filmOffset),t.view!==void 0&&(a.view=Object.assign({},t.view));break;case"OrthographicCamera":a=new zl(t.left,t.right,t.top,t.bottom,t.near,t.far),t.zoom!==void 0&&(a.zoom=t.zoom),t.view!==void 0&&(a.view=Object.assign({},t.view));break;case"AmbientLight":a=new Gp(t.color,t.intensity);break;case"DirectionalLight":a=new Hp(t.color,t.intensity),a.target=t.target||"";break;case"PointLight":a=new kp(t.color,t.intensity,t.distance,t.decay);break;case"RectAreaLight":a=new Wp(t.color,t.intensity,t.width,t.height);break;case"SpotLight":a=new Bp(t.color,t.intensity,t.distance,t.angle,t.penumbra,t.decay),a.target=t.target||"";break;case"HemisphereLight":a=new Fp(t.color,t.groundColor,t.intensity);break;case"LightProbe":a=new qp().fromJSON(t);break;case"SkinnedMesh":h=o(t.geometry),u=l(t.material),a=new vf(h,u),t.bindMode!==void 0&&(a.bindMode=t.bindMode),t.bindMatrix!==void 0&&a.bindMatrix.fromArray(t.bindMatrix),t.skeleton!==void 0&&(a.skeleton=t.skeleton);break;case"Mesh":h=o(t.geometry),u=l(t.material),a=new ye(h,u);break;case"InstancedMesh":h=o(t.geometry),u=l(t.material);const d=t.count,f=t.instanceMatrix,m=t.instanceColor;a=new Sf(h,u,d),a.instanceMatrix=new zs(new Float32Array(f.array),16),m!==void 0&&(a.instanceColor=new zs(new Float32Array(m.array),m.itemSize));break;case"BatchedMesh":h=o(t.geometry),u=l(t.material),a=new Df(t.maxInstanceCount,t.maxVertexCount,t.maxIndexCount,u),a.geometry=h,a.perObjectFrustumCulled=t.perObjectFrustumCulled,a.sortObjects=t.sortObjects,a._drawRanges=t.drawRanges,a._reservedRanges=t.reservedRanges,a._geometryInfo=t.geometryInfo.map(_=>{let g=null,p=null;
vendor: 6,491 bytes, line 40
40return _.boundingBox!==void 0&&(g=new Ne().fromJSON(_.boundingBox)),_.boundingSphere!==void 0&&(p=new Ie().fromJSON(_.boundingSphere)),{..._,boundingBox:g,boundingSphere:p}}),a._instanceInfo=t.instanceInfo,a._availableInstanceIds=t._availableInstanceIds,a._availableGeometryIds=t._availableGeometryIds,a._nextIndexStart=t.nextIndexStart,a._nextVertexStart=t.nextVertexStart,a._geometryCount=t.geometryCount,a._maxInstanceCount=t.maxInstanceCount,a._maxVertexCount=t.maxVertexCount,a._maxIndexCount=t.maxIndexCount,a._geometryInitialized=t.geometryInitialized,a._matricesTexture=c(t.matricesTexture.uuid),a._indirectTexture=c(t.indirectTexture.uuid),t.colorsTexture!==void 0&&(a._colorsTexture=c(t.colorsTexture.uuid)),t.boundingSphere!==void 0&&(a.boundingSphere=new Ie().fromJSON(t.boundingSphere)),t.boundingBox!==void 0&&(a.boundingBox=new Ne().fromJSON(t.boundingBox));break;case"LOD":a=new _f;break;case"Line":a=new vi(o(t.geometry),l(t.material));break;case"LineLoop":a=new Uf(o(t.geometry),l(t.material));break;case"LineSegments":a=new Un(o(t.geometry),l(t.material));break;case"PointCloud":case"Points":a=new Nf(o(t.geometry),l(t.material));break;case"Sprite":a=new gf(l(t.material));break;case"Group":a=new ws;break;case"Bone":a=new tu;break;default:a=new ie}if(a.uuid=t.uuid,t.name!==void 0&&(a.name=t.name),t.matrix!==void 0?(a.matrix.fromArray(t.matrix),t.matrixAutoUpdate!==void 0&&(a.matrixAutoUpdate=t.matrixAutoUpdate),a.matrixAutoUpdate&&a.matrix.decompose(a.position,a.quaternion,a.scale)):(t.position!==void 0&&a.position.fromArray(t.position),t.rotation!==void 0&&a.rotation.fromArray(t.rotation),t.quaternion!==void 0&&a.quaternion.fromArray(t.quaternion),t.scale!==void 0&&a.scale.fromArray(t.scale)),t.up!==void 0&&a.up.fromArray(t.up),t.castShadow!==void 0&&(a.castShadow=t.castShadow),t.receiveShadow!==void 0&&(a.receiveShadow=t.receiveShadow),t.shadow&&(t.shadow.intensity!==void 0&&(a.shadow.intensity=t.shadow.intensity),t.shadow.bias!==void 0&&(a.shadow.bias=t.shadow.bias),t.shadow.normalBias!==void 0&&(a.shadow.normalBias=t.shadow.normalBias),t.shadow.radius!==void 0&&(a.shadow.radius=t.shadow.radius),t.shadow.mapSize!==void 0&&a.shadow.mapSize.fromArray(t.shadow.mapSize),t.shadow.camera!==void 0&&(a.shadow.camera=this.parseObject(t.shadow.camera))),t.visible!==void 0&&(a.visible=t.visible),t.frustumCulled!==void 0&&(a.frustumCulled=t.frustumCulled),t.renderOrder!==void 0&&(a.renderOrder=t.renderOrder),t.userData!==void 0&&(a.userData=t.userData),t.layers!==void 0&&(a.layers.mask=t.layers),t.children!==void 0){const d=t.children;for(let f=0;f<d.length;f++)a.add(this.parseObject(d[f],e,n,i,s))}if(t.animations!==void 0){const d=t.animations;for(let f=0;f<d.length;f++){const m=d[f];a.animations.push(s[m])}}if(t.type==="LOD"){t.autoUpdate!==void 0&&(a.autoUpdate=t.autoUpdate);const d=t.levels;for(let f=0;f<d.length;f++){const m=d[f],_=a.getObjectByProperty("uuid",m.object);_!==void 0&&a.addLevel(_,m.distance,m.hysteresis)}}return a}bindSkeletons(t,e){Object.keys(e).length!==0&&t.traverse(function(n){if(n.isSkinnedMesh===!0&&n.skeleton!==void 0){const i=e[n.skeleton];i===void 0?console.warn("THREE.ObjectLoader: No skeleton found with UUID:",n.skeleton):n.bind(i,n.bindMatrix)}})}bindLightTargets(t){t.traverse(function(e){if(e.isDirectionalLight||e.isSpotLight){const n=e.target,i=t.getObjectByProperty("uuid",n);i!==void 0?e.target=i:e.target=new ie}})}}const Jp={UVMapping:sl,CubeReflectionMapping:qn,CubeRefractionMapping:xi,EquirectangularReflectionMapping:Zr,EquirectangularRefractionMapping:Jr,CubeUVReflectionMapping:Gs},$c={RepeatWrapping:$r,ClampToEdgeWrapping:ln,MirroredRepeatWrapping:Kr},Kc={NearestFilter:Re,NearestMipmapNearestFilter:Fh,NearestMipmapLinearFilter:Ts,LinearFilter:Ee,LinearMipmapNearestFilter:Vr,LinearMipmapLinearFilter:Cn},no=new WeakMap;class dy extends Qe{constructor(t){super(t),this.isImageBitmapLoader=!0,typeof createImageBitmap>"u"&&console.warn("THREE.ImageBitmapLoader: createImageBitmap() not supported."),typeof fetch>"u"&&console.warn("THREE.ImageBitmapLoader: fetch() not supported."),this.options={premultiplyAlpha:"none"},this._abortController=new AbortController}setOptions(t){return this.options=t,this}load(t,e,n,i){t===void 0&&(t=""),this.path!==void 0&&(t=this.path+t),t=this.manager.resolveURL(t);const s=this,a=Rn.get(`image-bitmap:${t}`);if(a!==void 0){if(s.manager.itemStart(t),a.then){a.then(c=>{if(no.has(a)===!0)i&&i(no.get(a)),s.manager.itemError(t),s.manager.itemEnd(t);else return e&&e(c),s.manager.itemEnd(t),c});return}return setTimeout(function(){e&&e(a),s.manager.itemEnd(t)},0),a}const o={};o.credentials=this.crossOrigin==="anonymous"?"same-origin":"include",o.headers=this.requestHeader,o.signal=typeof AbortSignal.any=="function"?AbortSignal.any([this._abortController.signal,this.manager.abortController.signal]):this._abortController.signal;const l=fetch(t,o).then(function(c){return c.blob()}).then(function(c){return createImageBitmap(c,Object.assign(s.options,{colorSpaceConversion:"none"}))}).then(function(c){return Rn.add(`image-bitmap:${t}`,c),e&&e(c),s.manager.itemEnd(t),c}).catch(function(c){i&&i(c),no.set(l,c),Rn.remove(`image-bitmap:${t}`),s.manager.itemError(t),s.manager.itemEnd(t)});Rn.add(`image-bitmap:${t}`,l),s.manager.itemStart(t)}abort(){return this._abortController.abort(),this._abortController=new AbortController,this}}let Pr;class yu{static getContext(){return Pr===void 0&&(Pr=new(window.AudioContext||window.webkitAudioContext)),Pr}static setContext(t){Pr=t}}class fy extends Qe{constructor(t){super(t)}load(t,e,n,i){const s=this,a=new Zn(this.manager);a.setResponseType("arraybuffer"),a.setPath(this.path),a.setRequestHeader(this.requestHeader),a.setWithCredentials(this.withCredentials),a.load(t,function(l){try{const c=l.slice(0);yu.getContext().decodeAudioData(c,function(u){e(u)}).catch(o)}catch(c){o(c)}},n,i);function o(l){i?i(l):console.error(l),s.manager.itemError(t)}}}const Qc=new zt,jc=new zt,ii=new zt;class py{constructor(){this.type="StereoCamera",this.aspect=1,this.eyeSep=.064,this.cameraL=new Ce,this.cameraL.layers.enable(1),this.cameraL.matrixAutoUpdate=!1,this.cameraR=new Ce,this.cameraR.layers.enable(2),this.cameraR.matrixAutoUpdate=!1,this._cache={focus:null,fov:null,aspect:null,near:null,far:null,zoom:null,eyeSep:null}}update(t){const e=this._cache;if(e.focus!==t.focus||e.fov!==t.fov||e.aspect!==t.aspect*this.aspect||e.near!==t.near||e.far!==t.far||e.zoom!==t.zoom||e.eyeSep!==this.eyeSep){e.focus=t.focus,e.fov
vendor: 4,559 bytes, line 40
40=t.fov,e.aspect=t.aspect*this.aspect,e.near=t.near,e.far=t.far,e.zoom=t.zoom,e.eyeSep=this.eyeSep,ii.copy(t.projectionMatrix);const i=e.eyeSep/2,s=i*e.near/e.focus,a=e.near*Math.tan(_i*e.fov*.5)/e.zoom;let o,l;jc.elements[12]=-i,Qc.elements[12]=i,o=-a*e.aspect+s,l=a*e.aspect+s,ii.elements[0]=2*e.near/(l-o),ii.elements[8]=(l+o)/(l-o),this.cameraL.projectionMatrix.copy(ii),o=-a*e.aspect-s,l=a*e.aspect-s,ii.elements[0]=2*e.near/(l-o),ii.elements[8]=(l+o)/(l-o),this.cameraR.projectionMatrix.copy(ii)}this.cameraL.matrixWorld.copy(t.matrixWorld).multiply(jc),this.cameraR.matrixWorld.copy(t.matrixWorld).multiply(Qc)}}class $p extends Ce{constructor(t=[]){super(),this.isArrayCamera=!0,this.isMultiViewCamera=!1,this.cameras=t}}class Kp{constructor(t=!0){this.autoStart=t,this.startTime=0,this.oldTime=0,this.elapsedTime=0,this.running=!1}start(){this.startTime=performance.now(),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 t=0;if(this.autoStart&&!this.running)return this.start(),0;if(this.running){const e=performance.now();t=(e-this.oldTime)/1e3,this.oldTime=e,this.elapsedTime+=t}return t}}const si=new C,io=new Ke,Qp=new C,ri=new C,ai=new C;class my extends ie{constructor(){super(),this.type="AudioListener",this.context=yu.getContext(),this.gain=this.context.createGain(),this.gain.connect(this.context.destination),this.filter=null,this.timeDelta=0,this._clock=new Kp}getInput(){return this.gain}removeFilter(){return this.filter!==null&&(this.gain.disconnect(this.filter),this.filter.disconnect(this.context.destination),this.gain.connect(this.context.destination),this.filter=null),this}getFilter(){return this.filter}setFilter(t){return this.filter!==null?(this.gain.disconnect(this.filter),this.filter.disconnect(this.context.destination)):this.gain.disconnect(this.context.destination),this.filter=t,this.gain.connect(this.filter),this.filter.connect(this.context.destination),this}getMasterVolume(){return this.gain.gain.value}setMasterVolume(t){return this.gain.gain.setTargetAtTime(t,this.context.currentTime,.01),this}updateMatrixWorld(t){super.updateMatrixWorld(t);const e=this.context.listener;if(this.timeDelta=this._clock.getDelta(),this.matrixWorld.decompose(si,io,Qp),ri.set(0,0,-1).applyQuaternion(io),ai.set(0,1,0).applyQuaternion(io),e.positionX){const n=this.context.currentTime+this.timeDelta;e.positionX.linearRampToValueAtTime(si.x,n),e.positionY.linearRampToValueAtTime(si.y,n),e.positionZ.linearRampToValueAtTime(si.z,n),e.forwardX.linearRampToValueAtTime(ri.x,n),e.forwardY.linearRampToValueAtTime(ri.y,n),e.forwardZ.linearRampToValueAtTime(ri.z,n),e.upX.linearRampToValueAtTime(ai.x,n),e.upY.linearRampToValueAtTime(ai.y,n),e.upZ.linearRampToValueAtTime(ai.z,n)}else e.setPosition(si.x,si.y,si.z),e.setOrientation(ri.x,ri.y,ri.z,ai.x,ai.y,ai.z)}}class jp extends ie{constructor(t){super(),this.type="Audio",this.listener=t,this.context=t.context,this.gain=this.context.createGain(),this.gain.connect(t.getInput()),this.autoplay=!1,this.buffer=null,this.detune=0,this.loop=!1,this.loopStart=0,this.loopEnd=0,this.offset=0,this.duration=void 0,this.playbackRate=1,this.isPlaying=!1,this.hasPlaybackControl=!0,this.source=null,this.sourceType="empty",this._startedAt=0,this._progress=0,this._connected=!1,this.filters=[]}getOutput(){return this.gain}setNodeSource(t){return this.hasPlaybackControl=!1,this.sourceType="audioNode",this.source=t,this.connect(),this}setMediaElementSource(t){return this.hasPlaybackControl=!1,this.sourceType="mediaNode",this.source=this.context.createMediaElementSource(t),this.connect(),this}setMediaStreamSource(t){return this.hasPlaybackControl=!1,this.sourceType="mediaStreamNode",this.source=this.context.createMediaStreamSource(t),this.connect(),this}setBuffer(t){return this.buffer=t,this.sourceType="buffer",this.autoplay&&this.play(),this}play(t=0){if(this.isPlaying===!0){console.warn("THREE.Audio: Audio is already playing.");return}if(this.hasPlaybackControl===!1){console.warn("THREE.Audio: this Audio has no playback control.");return}this._startedAt=this.context.currentTime+t;const e=this.context.createBufferSource();return e.buffer=this.buffer,e.loop=this.loop,e.loopStart=this.loopStart,e.loopEnd=this.loopEnd,e.onended=this.onEnded.bind(this),e.start(this._startedAt,this._progress+this.offset,this.duration),this.isPlaying=!0,this.source=e,this.setDetune(this.detune),this.setPlaybackRate(this.playbackRate),this.connect()}
vendor: 4,122 bytes, line 40
40pause(){if(this.hasPlaybackControl===!1){console.warn("THREE.Audio: this Audio has no playback control.");return}return this.isPlaying===!0&&(this._progress+=Math.max(this.context.currentTime-this._startedAt,0)*this.playbackRate,this.loop===!0&&(this._progress=this._progress%(this.duration||this.buffer.duration)),this.source.stop(),this.source.onended=null,this.isPlaying=!1),this}stop(t=0){if(this.hasPlaybackControl===!1){console.warn("THREE.Audio: this Audio has no playback control.");return}return this._progress=0,this.source!==null&&(this.source.stop(this.context.currentTime+t),this.source.onended=null),this.isPlaying=!1,this}connect(){if(this.filters.length>0){this.source.connect(this.filters[0]);for(let t=1,e=this.filters.length;t<e;t++)this.filters[t-1].connect(this.filters[t]);this.filters[this.filters.length-1].connect(this.getOutput())}else this.source.connect(this.getOutput());return this._connected=!0,this}disconnect(){if(this._connected!==!1){if(this.filters.length>0){this.source.disconnect(this.filters[0]);for(let t=1,e=this.filters.length;t<e;t++)this.filters[t-1].disconnect(this.filters[t]);this.filters[this.filters.length-1].disconnect(this.getOutput())}else this.source.disconnect(this.getOutput());return this._connected=!1,this}}getFilters(){return this.filters}setFilters(t){return t||(t=[]),this._connected===!0?(this.disconnect(),this.filters=t.slice(),this.connect()):this.filters=t.slice(),this}setDetune(t){return this.detune=t,this.isPlaying===!0&&this.source.detune!==void 0&&this.source.detune.setTargetAtTime(this.detune,this.context.currentTime,.01),this}getDetune(){return this.detune}getFilter(){return this.getFilters()[0]}setFilter(t){return this.setFilters(t?[t]:[])}setPlaybackRate(t){if(this.hasPlaybackControl===!1){console.warn("THREE.Audio: this Audio has no playback control.");return}return this.playbackRate=t,this.isPlaying===!0&&this.source.playbackRate.setTargetAtTime(this.playbackRate,this.context.currentTime,.01),this}getPlaybackRate(){return this.playbackRate}onEnded(){this.isPlaying=!1,this._progress=0}getLoop(){return this.hasPlaybackControl===!1?(console.warn("THREE.Audio: this Audio has no playback control."),!1):this.loop}setLoop(t){if(this.hasPlaybackControl===!1){console.warn("THREE.Audio: this Audio has no playback control.");return}return this.loop=t,this.isPlaying===!0&&(this.source.loop=this.loop),this}setLoopStart(t){return this.loopStart=t,this}setLoopEnd(t){return this.loopEnd=t,this}getVolume(){return this.gain.gain.value}setVolume(t){return this.gain.gain.setTargetAtTime(t,this.context.currentTime,.01),this}copy(t,e){return super.copy(t,e),t.sourceType!=="buffer"?(console.warn("THREE.Audio: Audio source type cannot be copied."),this):(this.autoplay=t.autoplay,this.buffer=t.buffer,this.detune=t.detune,this.loop=t.loop,this.loopStart=t.loopStart,this.loopEnd=t.loopEnd,this.offset=t.offset,this.duration=t.duration,this.playbackRate=t.playbackRate,this.hasPlaybackControl=t.hasPlaybackControl,this.sourceType=t.sourceType,this.filters=t.filters.slice(),this)}clone(t){return new this.constructor(this.listener).copy(this,t)}}const oi=new C,th=new Ke,tm=new C,li=new C;class gy extends jp{constructor(t){super(t),this.panner=this.context.createPanner(),this.panner.panningModel="HRTF",this.panner.connect(this.gain)}connect(){return super.connect(),this.panner.connect(this.gain),this}disconnect(){return super.disconnect(),this.panner.disconnect(this.gain),this}getOutput(){return this.panner}getRefDistance(){return this.panner.refDistance}setRefDistance(t){return this.panner.refDistance=t,this}getRolloffFactor(){return this.panner.rolloffFactor}setRolloffFactor(t){return this.panner.rolloffFactor=t,this}getDistanceModel(){return this.panner.distanceModel}setDistanceModel(t){return this.panner.distanceModel=t,this}getMaxDistance(){return this.panner.maxDistance}setMaxDistance(t){return this.panner.maxDistance=t,this}setDirectionalCone(t,e,n){return this.panner.coneInnerAngle=t,this.panner.coneOuterAngle=e,this.panner.coneOuterGain=n,this}updateMatrixWorld(t){if(super.updateMatrixWorld(t),this.hasPlaybackControl
vendor: 27,677 bytes, line 40
40===!0&&this.isPlaying===!1)return;this.matrixWorld.decompose(oi,th,tm),li.set(0,0,1).applyQuaternion(th);const e=this.panner;if(e.positionX){const n=this.context.currentTime+this.listener.timeDelta;e.positionX.linearRampToValueAtTime(oi.x,n),e.positionY.linearRampToValueAtTime(oi.y,n),e.positionZ.linearRampToValueAtTime(oi.z,n),e.orientationX.linearRampToValueAtTime(li.x,n),e.orientationY.linearRampToValueAtTime(li.y,n),e.orientationZ.linearRampToValueAtTime(li.z,n)}else e.setPosition(oi.x,oi.y,oi.z),e.setOrientation(li.x,li.y,li.z)}}class _y{constructor(t,e=2048){this.analyser=t.context.createAnalyser(),this.analyser.fftSize=e,this.data=new Uint8Array(this.analyser.frequencyBinCount),t.getOutput().connect(this.analyser)}getFrequencyData(){return this.analyser.getByteFrequencyData(this.data),this.data}getAverageFrequency(){let t=0;const e=this.getFrequencyData();for(let n=0;n<e.length;n++)t+=e[n];return t/e.length}}class em{constructor(t,e,n){this.binding=t,this.valueSize=n;let i,s,a;switch(e){case"quaternion":i=this._slerp,s=this._slerpAdditive,a=this._setAdditiveIdentityQuaternion,this.buffer=new Float64Array(n*6),this._workIndex=5;break;case"string":case"bool":i=this._select,s=this._select,a=this._setAdditiveIdentityOther,this.buffer=new Array(n*5);break;default:i=this._lerp,s=this._lerpAdditive,a=this._setAdditiveIdentityNumeric,this.buffer=new Float64Array(n*5)}this._mixBufferRegion=i,this._mixBufferRegionAdditive=s,this._setIdentity=a,this._origIndex=3,this._addIndex=4,this.cumulativeWeight=0,this.cumulativeWeightAdditive=0,this.useCount=0,this.referenceCount=0}accumulate(t,e){const n=this.buffer,i=this.valueSize,s=t*i+i;let a=this.cumulativeWeight;if(a===0){for(let o=0;o!==i;++o)n[s+o]=n[o];a=e}else{a+=e;const o=e/a;this._mixBufferRegion(n,s,0,o,i)}this.cumulativeWeight=a}accumulateAdditive(t){const e=this.buffer,n=this.valueSize,i=n*this._addIndex;this.cumulativeWeightAdditive===0&&this._setIdentity(),this._mixBufferRegionAdditive(e,i,0,t,n),this.cumulativeWeightAdditive+=t}apply(t){const e=this.valueSize,n=this.buffer,i=t*e+e,s=this.cumulativeWeight,a=this.cumulativeWeightAdditive,o=this.binding;if(this.cumulativeWeight=0,this.cumulativeWeightAdditive=0,s<1){const l=e*this._origIndex;this._mixBufferRegion(n,i,l,1-s,e)}a>0&&this._mixBufferRegionAdditive(n,i,this._addIndex*e,1,e);for(let l=e,c=e+e;l!==c;++l)if(n[l]!==n[l+e]){o.setValue(n,i);break}}saveOriginalState(){const t=this.binding,e=this.buffer,n=this.valueSize,i=n*this._origIndex;t.getValue(e,i);for(let s=n,a=i;s!==a;++s)e[s]=e[i+s%n];this._setIdentity(),this.cumulativeWeight=0,this.cumulativeWeightAdditive=0}restoreOriginalState(){const t=this.valueSize*3;this.binding.setValue(this.buffer,t)}_setAdditiveIdentityNumeric(){const t=this._addIndex*this.valueSize,e=t+this.valueSize;for(let n=t;n<e;n++)this.buffer[n]=0}_setAdditiveIdentityQuaternion(){this._setAdditiveIdentityNumeric(),this.buffer[this._addIndex*this.valueSize+3]=1}_setAdditiveIdentityOther(){const t=this._origIndex*this.valueSize,e=this._addIndex*this.valueSize;for(let n=0;n<this.valueSize;n++)this.buffer[e+n]=this.buffer[t+n]}_select(t,e,n,i,s){if(i>=.5)for(let a=0;a!==s;++a)t[e+a]=t[n+a]}_slerp(t,e,n,i){Ke.slerpFlat(t,e,t,e,t,n,i)}_slerpAdditive(t,e,n,i,s){const a=this._workIndex*s;Ke.multiplyQuaternionsFlat(t,a,t,e,t,n),Ke.slerpFlat(t,e,t,e,t,a,i)}_lerp(t,e,n,i,s){const a=1-i;for(let o=0;o!==s;++o){const l=e+o;t[l]=t[l]*a+t[n+o]*i}}_lerpAdditive(t,e,n,i,s){for(let a=0;a!==s;++a){const o=e+a;t[o]=t[o]+t[n+a]*i}}}const Vl="\\[\\]\\.:\\/",nm=new RegExp("["+Vl+"]","g"),Hl="[^"+Vl+"]",im="[^"+Vl.replace("\\.","")+"]",sm=/((?:WC+[\/:])*)/.source.replace("WC",Hl),rm=/(WCOD+)?/.source.replace("WCOD",im),am=/(?:\.(WC+)(?:\[(.+)\])?)?/.source.replace("WC",Hl),om=/\.(WC+)(?:\[(.+)\])?/.source.replace("WC",Hl),lm=new RegExp("^"+sm+rm+am+om+"$"),cm=["material","materials","bones","map"];class hm{constructor(t,e,n){const i=n||ee.parseTrackName(e);this._targetGroup=t,this._bindings=t.subscribe_(e,i)}getValue(t,e){this.bind();const n=this._targetGroup.nCachedObjects_,i=this._bindings[n];i!==void 0&&i.getValue(t,e)}setValue(t,e){const n=this._bindings;for(let i=this._targetGroup.nCachedObjects_,s=n.length;i!==s;++i)n[i].setValue(t,e)}bind(){const t=this._bindings;for(let e=this._targetGroup.nCachedObjects_,n=t.length;e!==n;++e)t[e].bind()}unbind(){const t=this._bindings;for(let e=this._targetGroup.nCachedObjects_,n=t.length;e!==n;++e)t[e].unbind()}}class ee{constructor(t,e,n){this.path=e,this.parsedPath=n||ee.parseTrackName(e),this.node=ee.findNode(t,this.parsedPath.nodeName),this.rootNode=t,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}static create(t,e,n){return t&&t.isAnimationObjectGroup?new ee.Composite(t,e,n):new ee(t,e,n)}static sanitizeNodeName(t){return t.replace(/\s/g,"_").replace(nm,"")}static parseTrackName(t){const e=lm.exec(t);if(e===null)throw new Error("PropertyBinding: Cannot parse trackName: "+t);const n={nodeName:e[2],objectName:e[3],objectIndex:e[4],propertyName:e[5],propertyIndex:e[6]},i=n.nodeName&&n.nodeName.lastIndexOf(".");if(i!==void 0&&i!==-1){const s=n.nodeName.substring(i+1);cm.indexOf(s)!==-1&&(n.nodeName=n.nodeName.substring(0,i),n.objectName=s)}if(n.propertyName===null||n.propertyName.length===0)throw new Error("PropertyBinding: can not parse propertyName from trackName: "+t);return n}static findNode(t,e){if(e===void 0||e===""||e==="."||e===-1||e===t.name||e===t.uuid)return t;if(t.skeleton){const n=t.skeleton.getBoneByName(e);if(n!==void 0)return n}if(t.children){const n=function(s){for(let a=0;a<s.length;a++){const o=s[a];if(o.name===e||o.uuid===e)return o;const l=n(o.children);if(l)return l}return null},i=n(t.children);if(i)return i}return null}_getValue_unavailable(){}_setValue_unavailable(){}_getValue_direct(t,e){t[e]=this.targetObject[this.propertyName]}_getValue_array(t,e){const n=this.resolvedProperty;for(let i=0,s=n.length;i!==s;++i)t[e++]=n[i]}_getValue_arrayElement(t,e){t[e]=this.resolvedProperty[this.propertyIndex]}_getValue_toArray(t,e){this.resolvedProperty.toArray(t,e)}_setValue_direct(t,e){this.targetObject[this.propertyName]=t[e]}_setValue_direct_setNeedsUpdate(t,e){this.targetObject[this.propertyName]=t[e],this.targetObject.needsUpdate=!0}_setValue_direct_setMatrixWorldNeedsUpdate(t,e){this.targetObject[this.propertyName]=t[e],this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_array(t,e){const n=this.resolvedProperty;for(let i=0,s=n.length;i!==s;++i)n[i]=t[e++]}_setValue_array_setNeedsUpdate(t,e){const n=this.resolvedProperty;for(let i=0,s=n.length;i!==s;++i)n[i]=t[e++];this.targetObject.needsUpdate=!0}_setValue_array_setMatrixWorldNeedsUpdate(t,e){const n=this.resolvedProperty;for(let i=0,s=n.length;i!==s;++i)n[i]=t[e++];this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_arrayElement(t,e){this.resolvedProperty[this.propertyIndex]=t[e]}_setValue_arrayElement_setNeedsUpdate(t,e){this.resolvedProperty[this.propertyIndex]=t[e],this.targetObject.needsUpdate=!0}_setValue_arrayElement_setMatrixWorldNeedsUpdate(t,e){this.resolvedProperty[this.propertyIndex]=t[e],this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_fromArray(t,e){this.resolvedProperty.fromArray(t,e)}_setValue_fromArray_setNeedsUpdate(t,e){this.resolvedProperty.fromArray(t,e),this.targetObject.needsUpdate=!0}_setValue_fromArray_setMatrixWorldNeedsUpdate(t,e){this.resolvedProperty.fromArray(t,e),this.targetObject.matrixWorldNeedsUpdate=!0}_getValue_unbound(t,e){this.bind(),this.getValue(t,e)}_setValue_unbound(t,e){this.bind(),this.setValue(t,e)}bind(){let t=this.node;const e=this.parsedPath,n=e.objectName,i=e.propertyName;let s=e.propertyIndex;if(t||(t=ee.findNode(this.rootNode,e.nodeName),this.node=t),this.getValue=this._getValue_unavailable,this.setValue=this._setValue_unavailable,!t){console.warn("THREE.PropertyBinding: No target node found for track: "+this.path+".");return}if(n){let c=e.objectIndex;switch(n){case"materials":if(!t.material){console.error("THREE.PropertyBinding: Can not bind to material as node does not have a material.",this);return}if(!t.material.materials){console.error("THREE.PropertyBinding: Can not bind to material.materials as node.material does not have a materials array.",this);return}t=t.material.materials;break;case"bones":if(!t.skeleton){console.error("THREE.PropertyBinding: Can not bind to bones as node does not have a skeleton.",this);return}t=t.skeleton.bones;for(let h=0;h<t.length;h++)if(t[h].name===c){c=h;break}break;case"map":if("map"in t){t=t.map;break}if(!t.material){console.error("THREE.PropertyBinding: Can not bind to material as node does not have a material.",this);return}if(!t.material.map){console.error("THREE.PropertyBinding: Can not bind to material.map as node.material does not have a map.",this);return}t=t.material.map;break;default:if(t[n]===void 0){console.error("THREE.PropertyBinding: Can not bind to objectName of node undefined.",this);return}t=t[n]}if(c!==void 0){if(t[c]===void 0){console.error("THREE.PropertyBinding: Trying to bind to objectIndex of objectName, but is undefined.",this,t);return}t=t[c]}}const a=t[i];if(a===void 0){const c=e.nodeName;console.error("THREE.PropertyBinding: Trying to update property for track: "+c+"."+i+" but it wasn't found.",t);return}let o=this.Versioning.None;this.targetObject=t,t.isMaterial===!0?o=this.Versioning.NeedsUpdate:t.isObject3D===!0&&(o=this.Versioning.MatrixWorldNeedsUpdate);let l=this.BindingType.Direct;if(s!==void 0){if(i==="morphTargetInfluences"){if(!t.geometry){console.error("THREE.PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.",this);return}if(!t.geometry.morphAttributes){console.error("THREE.PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.morphAttributes.",this);return}t.morphTargetDictionary[s]!==void 0&&(s=t.morphTargetDictionary[s])}l=this.BindingType.ArrayElement,this.resolvedProperty=a,this.propertyIndex=s}else a.fromArray!==void 0&&a.toArray!==void 0?(l=this.BindingType.HasFromToArray,this.resolvedProperty=a):Array.isArray(a)?(l=this.BindingType.EntireArray,this.resolvedProperty=a):this.propertyName=i;this.getValue=this.GetterByBindingType[l],this.setValue=this.SetterByBindingTypeAndVersioning[l][o]}unbind(){this.node=null,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}}ee.Composite=hm;ee.prototype.BindingType={Direct:0,EntireArray:1,ArrayElement:2,HasFromToArray:3};ee.prototype.Versioning={None:0,NeedsUpdate:1,MatrixWorldNeedsUpdate:2};ee.prototype.GetterByBindingType=[ee.prototype._getValue_direct,ee.prototype._getValue_array,ee.prototype._getValue_arrayElement,ee.prototype._getValue_toArray];ee.prototype.SetterByBindingTypeAndVersioning=[[ee.prototype._setValue_direct,ee.prototype._setValue_direct_setNeedsUpdate,ee.prototype._setValue_direct_setMatrixWorldNeedsUpdate],[ee.prototype._setValue_array,ee.prototype._setValue_array_setNeedsUpdate,ee.prototype._setValue_array_setMatrixWorldNeedsUpdate],[ee.prototype._setValue_arrayElement,ee.prototype._setValue_arrayElement_setNeedsUpdate,ee.prototype._setValue_arrayElement_setMatrixWorldNeedsUpdate],[ee.prototype._setValue_fromArray,ee.prototype._setValue_fromArray_setNeedsUpdate,ee.prototype._setValue_fromArray_setMatrixWorldNeedsUpdate]];class xy{constructor(){this.isAnimationObjectGroup=!0,this.uuid=$e(),this._objects=Array.prototype.slice.call(arguments),this.nCachedObjects_=0;const t={};this._indicesByUUID=t;for(let n=0,i=arguments.length;n!==i;++n)t[arguments[n].uuid]=n;this._paths=[],this._parsedPaths=[],this._bindings=[],this._bindingsIndicesByPath={};const e=this;this.stats={objects:{get total(){return e._objects.length},get inUse(){return this.total-e.nCachedObjects_}},get bindingsPerObject(){return e._bindings.length}}}add(){const t=this._objects,e=this._indicesByUUID,n=this._paths,i=this._parsedPaths,s=this._bindings,a=s.length;let o,l=t.length,c=this.nCachedObjects_;for(let h=0,u=arguments.length;h!==u;++h){const d=arguments[h],f=d.uuid;let m=e[f];if(m===void 0){m=l++,e[f]=m,t.push(d);for(let _=0,g=a;_!==g;++_)s[_].push(new ee(d,n[_],i[_]))}else if(m<c){o=t[m];const _=--c,g=t[_];e[g.uuid]=m,t[m]=g,e[f]=_,t[_]=d;for(let p=0,y=a;p!==y;++p){const v=s[p],x=v[_];let A=v[m];v[m]=x,A===void 0&&(A=new ee(d,n[p],i[p])),v[_]=A}}else t[m]!==o&&console.error("THREE.AnimationObjectGroup: Different objects with the same UUID detected. Clean the caches or recreate your infrastructure when reloading scenes.")}this.nCachedObjects_=c}remove(){const t=this._objects,e=this._indicesByUUID,n=this._bindings,i=n.length;let s=this.nCachedObjects_;for(let a=0,o=arguments.length;a!==o;++a){const l=arguments[a],c=l.uuid,h=e[c];if(h!==void 0&&h>=s){const u=s++,d=t[u];e[d.uuid]=h,t[h]=d,e[c]=u,t[u]=l;for(let f=0,m=i;f!==m;++f){const _=n[f],g=_[u],p=_[h];_[h]=g,_[u]=p}}}this.nCachedObjects_=s}uncache(){const t=this._objects,e=this._indicesByUUID,n=this._bindings,i=n.length;let s=this.nCachedObjects_,a=t.length;for(let o=0,l=arguments.length;o!==l;++o){const c=arguments[o],h=c.uuid,u=e[h];if(u!==void 0)if(delete e[h],u<s){const d=--s,f=t[d],m=--a,_=t[m];e[f.uuid]=u,t[u]=f,e[_.uuid]=d,t[d]=_,t.pop();for(let g=0,p=i;g!==p;++g){const y=n[g],v=y[d],x=y[m];y[u]=v,y[d]=x,y.pop()}}else{const d=--a,f=t[d];d>0&&(e[f.uuid]=u),t[u]=f,t.pop();for(let m=0,_=i;m!==_;++m){const g=n[m];g[u]=g[d],g.pop()}}}this.nCachedObjects_=s}subscribe_(t,e){const n=this._bindingsIndicesByPath;let i=n[t];const s=this._bindings;if(i!==void 0)return s[i];const a=this._paths,o=this._parsedPaths,l=this._objects,c=l.length,h=this.nCachedObjects_,u=new Array(c);i=s.length,n[t]=i,a.push(t),o.push(e),s.push(u);for(let d=h,f=l.length;d!==f;++d){const m=l[d];u[d]=new ee(m,t,e)}return u}unsubscribe_(t){const e=this._bindingsIndicesByPath,n=e[t];if(n!==void 0){const i=this._paths,s=this._parsedPaths,a=this._bindings,o=a.length-1,l=a[o],c=t[o];e[c]=n,a[n]=l,a.pop(),s[n]=s[o],s.pop(),i[n]=i[o],i.pop()}}}class um{constructor(t,e,n=null,i=e.blendMode){this._mixer=t,this._clip=e,this._localRoot=n,this.blendMode=i;const s=e.tracks,a=s.length,o=new Array(a),l={endingStart:Zi,endingEnd:Zi};for(let c=0;c!==a;++c){const h=s[c].createInterpolant(null);o[c]=h,h.settings=l}this._interpolantSettings=l,this._interpolants=o,this._propertyBindings=new Array(a),this._cacheIndex=null,this._byClipCacheIndex=null,this._timeScaleInterpolant=null,this._weightInterpolant=null,this.loop=pd,this._loopCount=-1,this._startTime=null,this.time=0,this.timeScale=1,this._effectiveTimeScale=1,this.weight=1,this._effectiveWeight=1,this.repetitions=1/0,this.paused=!1,this.enabled=!0,this.clampWhenFinished=!1,this.zeroSlopeAtStart=!0,this.zeroSlopeAtEnd=!0}play(){return this._mixer._activateAction(this),this}stop(){return this._mixer._deactivateAction(this),this.reset()}reset(){return this.paused=!1,this.enabled=!0,this.time=0,this._loopCount=-1,this._startTime=null,this.stopFading().stopWarping()}isRunning(){return this.enabled&&!this.paused&&this.timeScale!==0&&this._startTime===null&&this._mixer._isActiveAction(this)}isScheduled(){return this._mixer._isActiveAction(this)}startAt(t){return this._startTime=t,this}setLoop(t,e){return this.loop=t,this.repetitions=e,this}setEffectiveWeight(t){return this.weight=t,this._effectiveWeight=this.enabled?t:0,this.stopFading()}getEffectiveWeight(){return this._effectiveWeight}fadeIn(t){return this._scheduleFading(t,0,1)}fadeOut(t){return this._scheduleFading(t,1,0)}crossFadeFrom(t,e,n=!1){if(t.fadeOut(e),this.fadeIn(e),n===!0){const i=this._clip.duration,s=t._clip.duration,a=s/i,o=i/s;t.warp(1,a,e),this.warp(o,1,e)}return this}crossFadeTo(t,e,n=!1){return t.crossFadeFrom(this,e,n)}stopFading(){const t=this._weightInterpolant;return t!==null&&(this._weightInterpolant=null,this._mixer._takeBackControlInterpolant(t)),this}setEffectiveTimeScale(t){return this.timeScale=t,this._effectiveTimeScale=this.paused?0:t,this.stopWarping()}getEffectiveTimeScale(){return this._effectiveTimeScale}setDuration(t){return this.timeScale=this._clip.duration/t,this.stopWarping()}syncWith(t){return this.time=t.time,this.timeScale=t.timeScale,this.stopWarping()}halt(t){return this.warp(this._effectiveTimeScale,0,t)}warp(t,e,n){const i=this._mixer,s=i.time,a=this.timeScale;let o=this._timeScaleInterpolant;o===null&&(o=i._lendControlInterpolant(),this._timeScaleInterpolant=o);const l=o.parameterPositions,c=o.sampleValues;return l[0]=s,l[1]=s+n,c[0]=t/a,c[1]=e/a,this}stopWarping(){const t=this._timeScaleInterpolant;return t!==null&&(this._timeScaleInterpolant=null,this._mixer._takeBackControlInterpolant(t)),this}getMixer(){return this._mixer}getClip(){return this._clip}getRoot(){return this._localRoot||this._mixer._root}_update(t,e,n,i){if(!this.enabled){this._updateWeight(t);return}const s=this._startTime;if(s!==null){const l=(t-s)*n;l<0||n===0?e=0:(this._startTime=null,e=n*l)}e*=this._updateTimeScale(t);const a=this._updateTime(e),o=this._updateWeight(t);if(o>0){const l=this._interpolants,c=this._propertyBindings;switch(this.blendMode){case Wh:for(let h=0,u=l.length;h!==u;++h)l[h].evaluate(a),c[h].accumulateAdditive(o);break;case ul:default:for(let h=0,u=l.length;h!==u;++h)l[h].evaluate(a),c[h].accumulate(i,o)}}}_updateWeight(t){let e=0;if(this.enabled){e=this.weight;const n=this._weightInterpolant;if(n!==null){const i=n.evaluate(t)[0];e*=i,t>n.parameterPositions[1]&&(this.stopFading(),i===0&&(this.enabled=!1))}}return this._effectiveWeight=e,e}_updateTimeScale(t){let e=0;if(!this.paused){e=this.timeScale;const n=this._timeScaleInterpolant;if(n!==null){const i=n.evaluate(t)[0];e*=i,t>n.parameterPositions[1]&&(this.stopWarping(),e===0?this.paused=!0:this.timeScale=e)}}return this._effectiveTimeScale=e,e}_updateTime(t){const e=this._clip.duration,n=this.loop;let i=this.time+t,s=this._loopCount;const a=n===md;if(t===0)return s===-1?i:a&&(s&1)===1?e-i:i;if(n===fd){s===-1&&(this._loopCount=0,this._setEndings(!0,!0,!1));t:{if(i>=e)i=e;else if(i<0)i=0;else{this.time=i;break t}this.clampWhenFinished?this.paused=!0:this.enabled=!1,this.time=i,this._mixer.dispatchEvent({type:"finished",action:this,direction:t<0?-1:1})}}else{if(s===-1&&(t>=0?(s=0,this._setEndings(!0,this.repetitions===0,a)):this._setEndings(this.repetitions===0,!0,a)),i>=e||i<0){const o=Math.floor(i/e);i-=e*o,s+=Math.abs(o);const l=this.repetitions-s;if(l<=0)this.clampWhenFinished?this.paused=!0:this.enabled=!1,i=t>0?e:0,this.time=i,this._mixer.dispatchEvent({type:"finished",action:this,direction:t>0?1:-1});else{if(l===1){const c=t<0;this._setEndings(c,!c,a)}else this._setEndings(!1,!1,a);this._loopCount=s,this.time=i,this._mixer.dispatchEvent({type:"loop",action:this,loopDelta:o})}}else this.time=i;if(a&&(s&1)===1)return e-i}return i}_setEndings(t,e,n){const i=this._interpolantSettings;n?(i.endingStart=Ji,i.endingEnd=Ji):(t?i.endingStart=this.zeroSlopeAtStart?Ji:Zi:i.endingStart=jr,e?i.endingEnd=this.zeroSlopeAtEnd?Ji:Zi:i.endingEnd=jr)}_scheduleFading(t,e,n){const i=this._mixer,s=i.time;let a=this._weightInterpolant;a===null&&(a=i._lendControlInterpolant(),this._weightInterpolant=a);const o=a.parameterPositions,l=a.sampleValues;return o[0]=s,l[0]=e,o[1]=s+t,l[1]=n,this}}const dm=new Float32Array(1);class vy extends Dn{constructor(t){super(),this._root=t,this._initMemoryManager(),this._accuIndex=0,this.time=0,this.timeScale=1}_bindAction(t,e){const n=t._localRoot||this._root,i=t._clip.tracks,s=i.length,a=t._propertyBindings,o=t._interpolants,l=n.uuid,c=this._bindingsByRootAndName;let h=c[l];h===void 0&&(h={},c[l]=h);for(let u=0;u!==s;++u){const d=i[u],f=d.name;let m=h[f];if(m!==void 0)++m.referenceCount,a[u]=m;else{if(m=a[u],m!==void 0){m._cacheIndex===null&&(++m.referenceCount,this._addInactiveBinding(m,l,f));continue}const _=e&&e._propertyBindings[u].binding.parsedPath;m=new em(ee.create(n,f,_),d.ValueTypeName,d.getValueSize()),++m.referenceCount,this._addInactiveBinding(m,l,f),a[u]=m}o[u].resultBuffer=m.buffer}}_activateAction(t){if(!this._isActiveAction(t)){if(t._cacheIndex===null){const n=(t._localRoot||this._root).uuid,i=t._clip.uuid,s=this._actionsByClip[i];this._bindAction(t,s&&s.knownActions[0]),this._addInactiveAction(t,i,n)}const e=t._propertyBindings;for(let n=0,i=e.length;n!==i;++n){const s=e[n];s.useCount++===0&&(this._lendBinding(s),s.saveOriginalState())}this._lendAction(t)}}_deactivateAction(t){if(this._isActiveAction(t)){const e=t._propertyBindings;for(let n=0,i=e.length;n!==i;++n){const s=e[n];--s.useCount===0&&(s.restoreOriginalState(),this._takeBackBinding(s))}this._takeBackAction(t)}}_initMemoryManager(){this._actions=[],this._nActiveActions=0,this._actionsByClip={},this._bindings=[],this._nActiveBindings=0,this._bindingsByRootAndName={},this._controlInterpolants=[],this._nActiveControlInterpolants=0;const t=this;this.stats={actions:{get total(){return t._actions.length},get inUse(){return t._nActiveActions}},bindings:{get total(){return t._bindings.length},get inUse(){return t._nActiveBindings}},controlInterpolants:{get total(){return t._controlInterpolants.length},get inUse(){return t._nActiveControlInterpolants}}}}_isActiveAction(t){const e=t._cacheIndex;return e!==null&&e<this._nActiveActions}_addInactiveAction(t,e,n){const i=this._actions,s=this._actionsByClip;let a=s[e];if(a===void 0)a={knownActions:[t],actionByRoot:{}},t._byClipCacheIndex=0,s[e]=a;else{const o=a.knownActions;t._byClipCacheIndex=o.length,o.push(t)}t._cacheIndex=i.length,i.push(t),a.actionByRoot[n]=t}_removeInactiveAction(t){const e=this._actions,n=e[e.length-1],i=t._cacheIndex;n._cacheIndex=i,e[i]=n,e.pop(),t._cacheIndex=null;const s=t._clip.uuid,a=this._actionsByClip,o=a[s],l=o.knownActions,c=l[l.length-1],h=t._byClipCacheIndex;c._byClipCacheIndex=h,l[h]=c,l.pop(),t._byClipCacheIndex=null;const u=o.actionByRoot,d=(t._localRoot||this._root).uuid;delete u[d],l.length===0&&delete a[s],this._removeInactiveBindingsForAction(t)}_removeInactiveBindingsForAction(t){const e=t._propertyBindings;for(let n=0,i=e.length;n!==i;++n){const s=e[n];--s.referenceCount===0&&this._removeInactiveBinding(s)}}_lendAction(t){const e=this._actions,n=t._cacheIndex,i=this._nActiveActions++,s=e[i];t._cacheIndex=i,e[i]=t,s._cacheIndex=n,e[n]=s}_takeBackAction(t){const e=this._actions,n=t._cacheIndex,i=--this._nActiveActions,s=e[i];t._cacheIndex=i,e[i]=t,s._cacheIndex=n,e[n]=s}_addInactiveBinding(t,e,n){const i=this._bindingsByRootAndName,s=this._bindings;let a=i[e];a===void 0&&(a={},i[e]=a),a[n]=t,t._cacheIndex=s.length,s.push(t)}_removeInactiveBinding(t){const e=this._bindings,n=t.binding,i=n.rootNode.uuid,s=n.path,a=this._bindingsByRootAndName,o=a[i],l=e[e.length-1],c=t._cacheIndex;l._cacheIndex=c,e[c]=l,e.pop(),delete o[s],Object.keys(o).length===0&&delete a[i]}_lendBinding(t){const e=this._bindings,n=t._cacheIndex,i=this._nActiveBindings++,s=e[i];t._cacheIndex=i,e[i]=t,s._cacheIndex=n,e[n]=s}_takeBackBinding(t){const e=this._bindings,n=t._cacheIndex,i=--this._nActiveBindings,s=e[i];t._cacheIndex=i,e[i]=t,s._cacheIndex=n,e[n]=s}_lendControlInterpolant(){const t=this._controlInterpolants,e=this._nActiveControlInterpolants++;let n=t[e];return n===void 0&&(n=new _u(new Float32Array(2),new Float32Array(2),1,dm),n.__cacheIndex=e,t[e]=n),n}_takeBackControlInterpolant(t){const e=this._controlInterpolants,n=t.__cacheIndex,i=--this._nActiveControlInterpolants,s=e[i];t.__cacheIndex=i,e[i]=t,s.__cacheIndex=n,e[n]=s}clipAction(t,e,n){const i=e||this._root,s=i.uuid;let a=typeof t=="string"?oa.findByName(i,t):t;const o=a!==null?a.uuid:t,l=this._actionsByClip[o];let c=null;if(n===void 0&&(a!==null?n=a.blendMode:n=ul),l!==void 0){const u=l.actionByRoot[s];if(u!==void 0&&u.blendMode===n)return u;c=l.knownActions[0],a===null&&(a=c._clip)}if(a===null)return null;const h=new um(this,a,e,n);return this._bindAction(h,c),this._addInactiveAction(h,o,s),h}existingAction(t,e){const n=e||this._root,i=n.uuid,s=typeof t=="string"?oa.findByName(n,t):t,a=s?s.uuid:t,o=this._actionsByClip[a];return o!==void 0&&o.actionByRoot[i]||null}stopAllAction(){const t=this._actions,e=this._nActiveActions;for(let n=e-1;n>=0;--n)t[n].stop();return this}update(t){t*=this.timeScale;const e=this._actions,n=this._nActiveActions,i=this.time+=t,s=Math.sign(t),a=this._accuIndex^=1;for(let c=0;c!==n;++c)e[c]._update(i,t,s,a);const o=this._bindings,l=this._nActiveBindings;for(let c=0;c!==l;++c)o[c].apply(a);return this}setTime(t){this.time=0;for(let e=0;e<this._actions.length;e++)this._actions[e].time=0;return this.update(t)}getRoot(){return this._root}uncacheClip(t){const e=this._actions,n=t.uuid,i=this._actionsByClip,s=i[n];if(s!==void 0){const a=s.knownActions;for(let o=0,l=a.length;o!==l;++o){const c=a[o];this._deactivateAction(c);const h=c._cacheIndex,u=e[e.length-1];c._cacheIndex=null,c._byClipCacheIndex=null,u._cacheIndex=h,e[h]=u,e.pop(),this._removeInactiveBindingsForAction(c)}delete i[n]}}uncacheRoot(t){const e=t.uuid,n=this._actionsByClip;for(const a in n){const o=n[a].actionByRoot,l=o[e];l!==void 0&&(this._deactivateAction(l),this._removeInactiveAction(l))}const i=this._bindingsByRootAndName,s=i[e];if(s!==void 0)for(const a in s){const o=s[a];o.restoreOriginalState(),this._removeInactiveBinding(o)}}uncacheAction(t,e){const n=this.existingAction(t,e);n!==null&&(this._deactivateAction(n),this._removeInactiveAction(n))}}class yy extends Yh{constructor(t=1,e=1,n=1,i={}){super(t,e,i),this.isRenderTarget3D=!0,this.depth=n,this.texture=new pl(null,t,e,n),this._setTextureOptions(i),this.texture.isRenderTargetTexture=!0}}class Mu{constructor(t){this.value=t}clone(){return new Mu(this.value.clone===void 0?this.value:this.value.clone())}}let fm=0;class My extends Dn{constructor(){super(),this.isUniformsGroup=!0,Object.defineProperty(this,"id",{value:fm++}),this.name="",this.usage=ea,this.uniforms=[]}add(t){return this.uniforms.push(t),this}remove(t){const e=this.uniforms.indexOf(t);return e!==-1&&this.uniforms.splice(e,1),this}setName(t){return this.name=t,this}setUsage(t){return this.usage=t,this}dispose(){this.dispatchEvent({type:"dispose"})}copy(t){this.name=t.name,this.usage=t.usage;const e=t.uniforms;this.uniforms.length=0;for(let n=0,i=e.length;n<i;n++){const s=Array.isArray(e[n])?e[n]:[e[n]];for(let a=0;a<s.length;a++)this.uniforms.push(s[a].clone())}return this}clone(){return new this.constructor().copy(this)}}class Sy extends vl{constructor(t,e,n=1){super(t,e),this.isInstancedInterleavedBuffer=!0,this.meshPerAttribute=n}copy(t){return super.copy(t),this.meshPerAttribute=t.meshPerAttribute,this}clone(t){const e=super.clone(t);return e.meshPerAttribute=this.meshPerAttribute,e}toJSON(t){const e=super.toJSON(t);return e.isInstancedInterleavedBuffer=!0,e.meshPerAttribute=this.meshPerAttribute,e}}class by{constructor(t,e,n,i,s,a=!1){this.isGLBufferAttribute=!0,this.name="",this.buffer=t,this.type=e,this.itemSize=n,this.elementSize=i,this.count=s,this.normalized=a,this.version=0}set needsUpdate(t){t===!0&&this.version++}setBuffer(t){return this.buffer=t,this}setType(t,e){return this.type=t,this.elementSize=e,this}setItemSize(t){return this.itemSize=t,this}setCount(t){return this.count=t,this}}const eh=new zt;class Ey{constructor(t,e,n=0,i=1/0){this.ray=new Xs(t,e),this.near=n,this.far=i,this.camera=null,this.layers=new ml,this.params={Mesh:{},Line:{threshold:1},LOD:{},Points:{threshold:1},Sprite:{}}}set(t,e){this.ray.set(t,e)}setFromCamera(t,e){e.isPerspectiveCamera?(this.ray.origin.setFromMatrixPosition(e.matrixWorld),this.ray.direction.set(t.x,t.y,.5).unproject(e).sub(this.ray.origin).normalize(),this.camera=e):e.isOrthographicCamera?(this.ray.origin.set(t.x,t.y,(e.near+e.far)/(e.near-e.far)).unproject(e),this.ray.direction.set(0,0,-1).transformDirection(e.matrixWorld),this.camera=e):console.error("THREE.Raycaster: 
40Unsupported camera type: "+e.type)}setFromXRController(t){return eh.identity().extractRotation(t.matrixWorld),this.ray.origin.setFromMatrixPosition(t.matrixWorld),this.ray.direction.set(0,0,-1).applyMatrix4(eh),this}intersectObject(t,e=!0,n=[]){return el(t,this,n,e),n.sort(nh),n}intersectObjects(t,e=!0,n=[]){for(let i=0,s=t.length;i<s;i++)el(t[i],this,n,e);return n.sort(nh),n}}function nh(r,t){return r.distance-t.distance}function el(r,t,e,n){let i=!0;if(r.layers.test(t.layers)&&r.raycast(t,e)===!1&&(i=!1),i===!0&&n===!0){const s=r.children;for(let a=0,o=s.length;a<o;a++)el(s[a],t,e,!0)}}class Ty{constructor(){this._previousTime=0,this._currentTime=0,this._startTime=performance.now(),this._delta=0,this._elapsed=0,this._timescale=1,this._document=null,this._pageVisibilityHandler=null}connect(t){this._document=t,t.hidden!==void 0&&(this._pageVisibilityHandler=pm.bind(this),t.addEventListener("visibilitychange",this._pageVisibilityHandler,!1))}disconnect(){this._pageVisibilityHandler!==null&&(this._document.removeEventListener("visibilitychange",this._pageVisibilityHandler),this._pageVisibilityHandler=null),this._document=null}getDelta(){return this._delta/1e3}getElapsed(){return this._elapsed/1e3}getTimescale(){return this._timescale}setTimescale(t){return this._timescale=t,this}reset(){return this._currentTime=performance.now()-this._startTime,this}dispose(){this.disconnect()}update(t){return this._pageVisibilityHandler!==null&&this._document.hidden===!0?this._delta=0:(this._previousTime=this._currentTime,this._currentTime=(t!==void 0?t:performance.now())-this._startTime,this._delta=(this._currentTime-this._previousTime)*this._timescale,this._elapsed+=this._delta),this}}function pm(){this._document.hidden===!1&&this.reset()}class Ay{constructor(t=1,e=0,n=0){this.radius=t,this.phi=e,this.theta=n}set(t,e,n){return this.radius=t,this.phi=e,this.theta=n,this}copy(t){return this.radius=t.radius,this.phi=t.phi,this.theta=t.theta,this}makeSafe(){return this.phi=Nt(this.phi,1e-6,Math.PI-1e-6),this}setFromVector3(t){return this.setFromCartesianCoords(t.x,t.y,t.z)}setFromCartesianCoords(t,e,n){return this.radius=Math.sqrt(t*t+e*e+n*n),this.radius===0?(this.theta=0,this.phi=0):(this.theta=Math.atan2(t,n),this.phi=Math.acos(Nt(e/this.radius,-1,1))),this}clone(){return new this.constructor().copy(this)}}class wy{constructor(t=1,e=0,n=0){this.radius=t,this.theta=e,this.y=n}set(t,e,n){return this.radius=t,this.theta=e,this.y=n,this}copy(t){return this.radius=t.radius,this.theta=t.theta,this.y=t.y,this}setFromVector3(t){return this.setFromCartesianCoords(t.x,t.y,t.z)}setFromCartesianCoords(t,e,n){return this.radius=Math.sqrt(t*t+n*n),this.theta=Math.atan2(t,n),this.y=e,this}clone(){return new this.constructor().copy(this)}}class Su{constructor(t,e,n,i){Su.prototype.isMatrix2=!0,this.elements=[1,0,0,1],t!==void 0&&this.set(t,e,n,i)}identity(){return this.set(1,0,0,1),this}fromArray(t,e=0){for(let n=0;n<4;n++)this.elements[n]=t[n+e];return this}set(t,e,n,i){const s=this.elements;return s[0]=t,s[2]=e,s[1]=n,s[3]=i,this}}const ih=new K;class Cy{constructor(t=new K(1/0,1/0),e=new K(-1/0,-1/0)){this.isBox2=!0,this.min=t,this.max=e}set(t,e){return this.min.copy(t),this.max.copy(e),this}setFromPoints(t){this.makeEmpty();for(let e=0,n=t.length;e<n;e++)this.expandByPoint(t[e]);return this}setFromCenterAndSize(t,e){const n=ih.copy(e).multiplyScalar(.5);return this.min.copy(t).sub(n),this.max.copy(t).add(n),this}clone(){return new this.constructor().copy(this)}copy(t){return this.min.copy(t.min),this.max.copy(t.max),this}makeEmpty(){return this.min.x=this.min.y=1/0,this.max.x=this.max.y=-1/0,this}isEmpty(){return this.max.x<this.min.x||this.max.y<this.min.y}getCenter(t){return this.isEmpty()?t.set(0,0):t.addVectors(this.min,this.max).multiplyScalar(.5)}getSize(t){return this.isEmpty()?t.set(0,0):t.subVectors(this.max,this.min)}expandByPoint(t){return this.min.min(t),this.max.max(t),this}expandByVector(t){return this.min.sub(t),this.max.add(t),this}expandByScalar(t){return this.min.addScalar(-t),this.max.addScalar(t),this}containsPoint(t){return t.x>=this.min.x&&t.x<=this.max.x&&t.y>=this.min.y&&t.y<=this.max.y}containsBox(t){return this.min.x<=t.min.x&&t.max.x<=this.max.x&&this.min.y<=t.min.y&&t.max.y<=this.max.y}getParameter(t,e){return e.set((t.x-this.min.x)/(this.max.x-this.min.x),(t.y-this.min.y)/(this.max.y-this.min.y))}intersectsBox(t){return t.max.x>=this.min.x&&t.min.x<=this.max.x&&t.max.y>=this.min.y&&t.min.y<=this.max.y}clampPoint(t,e){return e.copy(t).clamp(this.min,this.max)}distanceToPoint(t){return this.clampPoint(t,ih).distanceTo(t)}intersect(t){return this.min.max(t.min),this.max.min(t.max),this.isEmpty()&&this.makeEmpty(),this}union(t){return this.min.min(t.min),this.max.max(t.max),this}translate(t){return this.min.add(t),this.max.add(t),this}equals(t){return t.min.equals(this.min)&&t.max.equals(this.max)}}const sh=new C,Lr=new C,Xi=new C,qi=new C,so=new C,mm=new C,gm=new C;class Ry{constructor(t=new C,e=new C){this.start=t,this.end=e}set(t,e){return this.start.copy(t),this.end.copy(e),this}copy(t){return this.start.copy(t.start),this.end.copy(t.end),this}getCenter(t){return t.addVectors(this.start,this.end).multiplyScalar(.5)}delta(t){return t.subVectors(this.end,this.start)}distanceSq(){return this.start.distanceToSquared(this.end)}distance(){return this.start.distanceTo(this.end)}at(t,e){return this.delta(e).multiplyScalar(t).add(this.start)}closestPointToPointParameter(t,e){sh.subVectors(t,this.start),Lr.subVectors(this.end,this.start);const n=Lr.dot(Lr);
vendor: 5,586 bytes, line 40
40let s=Lr.dot(sh)/n;return e&&(s=Nt(s,0,1)),s}closestPointToPoint(t,e,n){const i=this.closestPointToPointParameter(t,e);return this.delta(n).multiplyScalar(i).add(this.start)}distanceSqToLine3(t,e=mm,n=gm){const i=10000000000000001e-32;let s,a;const o=this.start,l=t.start,c=this.end,h=t.end;Xi.subVectors(c,o),qi.subVectors(h,l),so.subVectors(o,l);const u=Xi.dot(Xi),d=qi.dot(qi),f=qi.dot(so);if(u<=i&&d<=i)return e.copy(o),n.copy(l),e.sub(n),e.dot(e);if(u<=i)s=0,a=f/d,a=Nt(a,0,1);else{const m=Xi.dot(so);if(d<=i)a=0,s=Nt(-m/u,0,1);else{const _=Xi.dot(qi),g=u*d-_*_;g!==0?s=Nt((_*f-m*d)/g,0,1):s=0,a=(_*s+f)/d,a<0?(a=0,s=Nt(-m/u,0,1)):a>1&&(a=1,s=Nt((_-m)/u,0,1))}}return e.copy(o).add(Xi.multiplyScalar(s)),n.copy(l).add(qi.multiplyScalar(a)),e.sub(n),e.dot(e)}applyMatrix4(t){return this.start.applyMatrix4(t),this.end.applyMatrix4(t),this}equals(t){return t.start.equals(this.start)&&t.end.equals(this.end)}clone(){return new this.constructor().copy(this)}}const rh=new C;class Iy extends ie{constructor(t,e){super(),this.light=t,this.matrixAutoUpdate=!1,this.color=e,this.type="SpotLightHelper";const n=new Zt,i=[0,0,0,0,0,1,0,0,0,1,0,1,0,0,0,-1,0,1,0,0,0,0,1,1,0,0,0,0,-1,1];for(let a=0,o=1,l=32;a<l;a++,o++){const c=a/l*Math.PI*2,h=o/l*Math.PI*2;i.push(Math.cos(c),Math.sin(c),1,Math.cos(h),Math.sin(h),1)}n.setAttribute("position",new St(i,3));const s=new He({fog:!1,toneMapped:!1});this.cone=new Un(n,s),this.add(this.cone),this.update()}dispose(){this.cone.geometry.dispose(),this.cone.material.dispose()}update(){this.light.updateWorldMatrix(!0,!1),this.light.target.updateWorldMatrix(!0,!1),this.parent?(this.parent.updateWorldMatrix(!0),this.matrix.copy(this.parent.matrixWorld).invert().multiply(this.light.matrixWorld)):this.matrix.copy(this.light.matrixWorld),this.matrixWorld.copy(this.light.matrixWorld);const t=this.light.distance?this.light.distance:1e3,e=t*Math.tan(this.light.angle);this.cone.scale.set(e,e,t),rh.setFromMatrixPosition(this.light.target.matrixWorld),this.cone.lookAt(rh),this.color!==void 0?this.cone.material.color.set(this.color):this.cone.material.color.copy(this.light.color)}}const Vn=new C,Dr=new zt,ro=new zt;class Py extends Un{constructor(t){const e=bu(t),n=new Zt,i=[],s=[];for(let c=0;c<e.length;c++){const h=e[c];h.parent&&h.parent.isBone&&(i.push(0,0,0),i.push(0,0,0),s.push(0,0,0),s.push(0,0,0))}n.setAttribute("position",new St(i,3)),n.setAttribute("color",new St(s,3));const a=new He({vertexColors:!0,depthTest:!1,depthWrite:!1,toneMapped:!1,transparent:!0});super(n,a),this.isSkeletonHelper=!0,this.type="SkeletonHelper",this.root=t,this.bones=e,this.matrix=t.matrixWorld,this.matrixAutoUpdate=!1;const o=new vt(255),l=new vt(65280);this.setColors(o,l)}updateMatrixWorld(t){const e=this.bones,n=this.geometry,i=n.getAttribute("position");ro.copy(this.root.matrixWorld).invert();for(let s=0,a=0;s<e.length;s++){const o=e[s];o.parent&&o.parent.isBone&&(Dr.multiplyMatrices(ro,o.matrixWorld),Vn.setFromMatrixPosition(Dr),i.setXYZ(a,Vn.x,Vn.y,Vn.z),Dr.multiplyMatrices(ro,o.parent.matrixWorld),Vn.setFromMatrixPosition(Dr),i.setXYZ(a+1,Vn.x,Vn.y,Vn.z),a+=2)}n.getAttribute("position").needsUpdate=!0,super.updateMatrixWorld(t)}setColors(t,e){const i=this.geometry.getAttribute("color");for(let s=0;s<i.count;s+=2)i.setXYZ(s,t.r,t.g,t.b),i.setXYZ(s+1,e.r,e.g,e.b);return i.needsUpdate=!0,this}dispose(){this.geometry.dispose(),this.material.dispose()}}function bu(r){const t=[];r.isBone===!0&&t.push(r);for(let e=0;e<r.children.length;e++)t.push(...bu(r.children[e]));return t}class Ly extends ye{constructor(t,e,n){const i=new ma(e,4,2),s=new Si({wireframe:!0,fog:!1,toneMapped:!1});super(i,s),this.light=t,this.color=n,this.type="PointLightHelper",this.matrix=this.light.matrixWorld,this.matrixAutoUpdate=!1,this.update()}dispose(){this.geometry.dispose(),this.material.dispose()}update(){this.light.updateWorldMatrix(!0,!1),this.color!==void 0?this.material.color.set(this.color):this.material.color.copy(this.light.color)}}const _m=new C,ah=new vt,oh=new vt;class Dy extends ie{constructor(t,e,n){super(),this.light=t,this.matrix=t.matrixWorld,this.matrixAutoUpdate=!1,this.color=n,this.type="HemisphereLightHelper";const i=new pa(e);i.rotateY(Math.PI*.5),this.material=new Si({wireframe:!0,fog:!1,toneMapped:!1}),this.color===void 0&&(this.material.vertexColors=!0);const s=i.getAttribute("position"),a=new Float32Array(s.count*3);i.setAttribute("color",new le(a,3)),this.add(new ye(i,this.material)),this.update()}dispose(){this.children[0].geometry.dispose(),this.children[0].material.dispose()}update(){const t=this.children[0];if(this.color!==void 0)this.material.color.set(this.color);else{const e=t.geometry.getAttribute("color");ah.copy(this.light.color),oh.copy(this.light.groundColor);for(let n=0,i=e.count;n<i;n++){const s=n<i/2?ah:oh;e.setXYZ(n,s.r,s.g,s.b)}e.needsUpdate=!0}this.light.updateWorldMatrix(!0,!1),t.lookAt(_m.setFromMatrixPosition(this.light.matrixWorld).negate())}}class Uy extends Un{constructor(t=10,e=10,n=4473924,i=8947848){n=new vt(n),i=new vt(i);const s=e/2,a=t/e,o=t/2,l=[],c=[];for(let d=0,f=0,m=-o;d<=e;d++,m+=a){l.push(-o,0,m,o,0,m),l.push(m,0,-o,m,0,o);const _=d===s?n:i;_.toArray(c,f),f+=3,_.toArray(c,f),f+=3,_.toArray(c,f),f+=3,_.toArray(c,f),f+=3}const h=new Zt;h.setAttribute("position",new St(l,3)),h.setAttribute("color",new St(c,3));const u=new He({vertexColors:!0,toneMapped:!1});super(h,u),this.type="GridHelper"}dispose(){this.geometry.dispose(),this.material.dispose()}}class Ny extends Un{constructor(t=10,e=16,n=8,i=64,s=4473924,a=8947848){s=new vt(s),a=new vt(a);const o=[],l=[];
vendor: 10,248 bytes, line 40
40if(e>1)for(let u=0;u<e;u++){const d=u/e*(Math.PI*2),f=Math.sin(d)*t,m=Math.cos(d)*t;o.push(0,0,0),o.push(f,0,m);const _=u&1?s:a;l.push(_.r,_.g,_.b),l.push(_.r,_.g,_.b)}for(let u=0;u<n;u++){const d=u&1?s:a,f=t-t/n*u;for(let m=0;m<i;m++){let _=m/i*(Math.PI*2),g=Math.sin(_)*f,p=Math.cos(_)*f;o.push(g,0,p),l.push(d.r,d.g,d.b),_=(m+1)/i*(Math.PI*2),g=Math.sin(_)*f,p=Math.cos(_)*f,o.push(g,0,p),l.push(d.r,d.g,d.b)}}const c=new Zt;c.setAttribute("position",new St(o,3)),c.setAttribute("color",new St(l,3));const h=new He({vertexColors:!0,toneMapped:!1});super(c,h),this.type="PolarGridHelper"}dispose(){this.geometry.dispose(),this.material.dispose()}}const lh=new C,Ur=new C,ch=new C;class Fy extends ie{constructor(t,e,n){super(),this.light=t,this.matrix=t.matrixWorld,this.matrixAutoUpdate=!1,this.color=n,this.type="DirectionalLightHelper",e===void 0&&(e=1);let i=new Zt;i.setAttribute("position",new St([-e,e,0,e,e,0,e,-e,0,-e,-e,0,-e,e,0],3));const s=new He({fog:!1,toneMapped:!1});this.lightPlane=new vi(i,s),this.add(this.lightPlane),i=new Zt,i.setAttribute("position",new St([0,0,0,0,0,1],3)),this.targetLine=new vi(i,s),this.add(this.targetLine),this.update()}dispose(){this.lightPlane.geometry.dispose(),this.lightPlane.material.dispose(),this.targetLine.geometry.dispose(),this.targetLine.material.dispose()}update(){this.light.updateWorldMatrix(!0,!1),this.light.target.updateWorldMatrix(!0,!1),lh.setFromMatrixPosition(this.light.matrixWorld),Ur.setFromMatrixPosition(this.light.target.matrixWorld),ch.subVectors(Ur,lh),this.lightPlane.lookAt(Ur),this.color!==void 0?(this.lightPlane.material.color.set(this.color),this.targetLine.material.color.set(this.color)):(this.lightPlane.material.color.copy(this.light.color),this.targetLine.material.color.copy(this.light.color)),this.targetLine.lookAt(Ur),this.targetLine.scale.z=ch.length()}}const Nr=new C,ge=new gl;class Oy extends Un{constructor(t){const e=new Zt,n=new He({color:16777215,vertexColors:!0,toneMapped:!1}),i=[],s=[],a={};o("n1","n2"),o("n2","n4"),o("n4","n3"),o("n3","n1"),o("f1","f2"),o("f2","f4"),o("f4","f3"),o("f3","f1"),o("n1","f1"),o("n2","f2"),o("n3","f3"),o("n4","f4"),o("p","n1"),o("p","n2"),o("p","n3"),o("p","n4"),o("u1","u2"),o("u2","u3"),o("u3","u1"),o("c","t"),o("p","c"),o("cn1","cn2"),o("cn3","cn4"),o("cf1","cf2"),o("cf3","cf4");function o(m,_){l(m),l(_)}function l(m){i.push(0,0,0),s.push(0,0,0),a[m]===void 0&&(a[m]=[]),a[m].push(i.length/3-1)}e.setAttribute("position",new St(i,3)),e.setAttribute("color",new St(s,3)),super(e,n),this.type="CameraHelper",this.camera=t,this.camera.updateProjectionMatrix&&this.camera.updateProjectionMatrix(),this.matrix=t.matrixWorld,this.matrixAutoUpdate=!1,this.pointMap=a,this.update();const c=new vt(16755200),h=new vt(16711680),u=new vt(43775),d=new vt(16777215),f=new vt(3355443);this.setColors(c,h,u,d,f)}setColors(t,e,n,i,s){const o=this.geometry.getAttribute("color");return o.setXYZ(0,t.r,t.g,t.b),o.setXYZ(1,t.r,t.g,t.b),o.setXYZ(2,t.r,t.g,t.b),o.setXYZ(3,t.r,t.g,t.b),o.setXYZ(4,t.r,t.g,t.b),o.setXYZ(5,t.r,t.g,t.b),o.setXYZ(6,t.r,t.g,t.b),o.setXYZ(7,t.r,t.g,t.b),o.setXYZ(8,t.r,t.g,t.b),o.setXYZ(9,t.r,t.g,t.b),o.setXYZ(10,t.r,t.g,t.b),o.setXYZ(11,t.r,t.g,t.b),o.setXYZ(12,t.r,t.g,t.b),o.setXYZ(13,t.r,t.g,t.b),o.setXYZ(14,t.r,t.g,t.b),o.setXYZ(15,t.r,t.g,t.b),o.setXYZ(16,t.r,t.g,t.b),o.setXYZ(17,t.r,t.g,t.b),o.setXYZ(18,t.r,t.g,t.b),o.setXYZ(19,t.r,t.g,t.b),o.setXYZ(20,t.r,t.g,t.b),o.setXYZ(21,t.r,t.g,t.b),o.setXYZ(22,t.r,t.g,t.b),o.setXYZ(23,t.r,t.g,t.b),o.setXYZ(24,e.r,e.g,e.b),o.setXYZ(25,e.r,e.g,e.b),o.setXYZ(26,e.r,e.g,e.b),o.setXYZ(27,e.r,e.g,e.b),o.setXYZ(28,e.r,e.g,e.b),o.setXYZ(29,e.r,e.g,e.b),o.setXYZ(30,e.r,e.g,e.b),o.setXYZ(31,e.r,e.g,e.b),o.setXYZ(32,n.r,n.g,n.b),o.setXYZ(33,n.r,n.g,n.b),o.setXYZ(34,n.r,n.g,n.b),o.setXYZ(35,n.r,n.g,n.b),o.setXYZ(36,n.r,n.g,n.b),o.setXYZ(37,n.r,n.g,n.b),o.setXYZ(38,i.r,i.g,i.b),o.setXYZ(39,i.r,i.g,i.b),o.setXYZ(40,s.r,s.g,s.b),o.setXYZ(41,s.r,s.g,s.b),o.setXYZ(42,s.r,s.g,s.b),o.setXYZ(43,s.r,s.g,s.b),o.setXYZ(44,s.r,s.g,s.b),o.setXYZ(45,s.r,s.g,s.b),o.setXYZ(46,s.r,s.g,s.b),o.setXYZ(47,s.r,s.g,s.b),o.setXYZ(48,s.r,s.g,s.b),o.setXYZ(49,s.r,s.g,s.b),o.needsUpdate=!0,this}update(){const t=this.geometry,e=this.pointMap,n=1,i=1;let s,a;if(ge.projectionMatrixInverse.copy(this.camera.projectionMatrixInverse),this.camera.reversedDepth===!0)s=1,a=0;else if(this.camera.coordinateSystem===nn)s=-1,a=1;else if(this.camera.coordinateSystem===Os)s=0,a=1;else throw new Error("THREE.CameraHelper.update(): Invalid coordinate system: "+this.camera.coordinateSystem);_e("c",e,t,ge,0,0,s),_e("t",e,t,ge,0,0,a),_e("n1",e,t,ge,-n,-i,s),_e("n2",e,t,ge,n,-i,s),_e("n3",e,t,ge,-n,i,s),_e("n4",e,t,ge,n,i,s),_e("f1",e,t,ge,-n,-i,a),_e("f2",e,t,ge,n,-i,a),_e("f3",e,t,ge,-n,i,a),_e("f4",e,t,ge,n,i,a),_e("u1",e,t,ge,n*.7,i*1.1,s),_e("u2",e,t,ge,-n*.7,i*1.1,s),_e("u3",e,t,ge,0,i*2,s),_e("cf1",e,t,ge,-n,0,a),_e("cf2",e,t,ge,n,0,a),_e("cf3",e,t,ge,0,-i,a),_e("cf4",e,t,ge,0,i,a),_e("cn1",e,t,ge,-n,0,s),_e("cn2",e,t,ge,n,0,s),_e("cn3",e,t,ge,0,-i,s),_e("cn4",e,t,ge,0,i,s),t.getAttribute("position").needsUpdate=!0}dispose(){this.geometry.dispose(),this.material.dispose()}}function _e(r,t,e,n,i,s,a){Nr.set(i,s,a).unproject(n);const o=t[r];if(o!==void 0){const l=e.getAttribute("position");for(let c=0,h=o.length;c<h;c++)l.setXYZ(o[c],Nr.x,Nr.y,Nr.z)}}const Fr=new Ne;class By extends Un{constructor(t,e=16776960){const n=new Uint16Array([0,1,1,2,2,3,3,0,4,5,5,6,6,7,7,4,0,4,1,5,2,6,3,7]),i=new Float32Array(24),s=new Zt;s.setIndex(new le(n,1)),s.setAttribute("position",new le(i,3)),super(s,new He({color:e,toneMapped:!1})),this.object=t,this.type="BoxHelper",this.matrixAutoUpdate=!1,this.update()}update(){if(this.object!==void 0&&Fr.setFromObject(this.object),Fr.isEmpty())return;const t=Fr.min,e=Fr.max,n=this.geometry.attributes.position,i=n.array;i[0]=e.x,i[1]=e.y,i[2]=e.z,i[3]=t.x,i[4]=e.y,i[5]=e.z,i[6]=t.x,i[7]=t.y,i[8]=e.z,i[9]=e.x,i[10]=t.y,i[11]=e.z,i[12]=e.x,i[13]=e.y,i[14]=t.z,i[15]=t.x,i[16]=e.y,i[17]=t.z,i[18]=t.x,i[19]=t.y,i[20]=t.z,i[21]=e.x,i[22]=t.y,i[23]=t.z,n.needsUpdate=!0,this.geometry.computeBoundingSphere()}setFromObject(t){return this.object=t,this.update(),this}copy(t,e){return super.copy(t,e),this.object=t.object,this}dispose(){this.geometry.dispose(),this.material.dispose()}}class zy extends Un{constructor(t,e=16776960){const n=new Uint16Array([0,1,1,2,2,3,3,0,4,5,5,6,6,7,7,4,0,4,1,5,2,6,3,7]),i=[1,1,1,-1,1,1,-1,-1,1,1,-1,1,1,1,-1,-1,1,-1,-1,-1,-1,1,-1,-1],s=new Zt;s.setIndex(new le(n,1)),s.setAttribute("position",new St(i,3)),super(s,new He({color:e,toneMapped:!1})),this.box=t,this.type="Box3Helper",this.geometry.computeBoundingSphere()}updateMatrixWorld(t){const e=this.box;e.isEmpty()||(e.getCenter(this.position),e.getSize(this.scale),this.scale.multiplyScalar(.5),super.updateMatrixWorld(t))}dispose(){this.geometry.dispose(),this.material.dispose()}}class ky extends vi{constructor(t,e=1,n=16776960){const i=n,s=[1,-1,0,-1,1,0,-1,-1,0,1,1,0,-1,1,0,-1,-1,0,1,-1,0,1,1,0],a=new Zt;a.setAttribute("position",new St(s,3)),a.computeBoundingSphere(),super(a,new He({color:i,toneMapped:!1})),this.type="PlaneHelper",this.plane=t,this.size=e;const o=[1,1,0,-1,1,0,-1,-1,0,1,1,0,-1,-1,0,1,-1,0],l=new Zt;l.setAttribute("position",new St(o,3)),l.computeBoundingSphere(),this.add(new ye(l,new Si({color:i,opacity:.2,transparent:!0,depthWrite:!1,toneMapped:!1})))}updateMatrixWorld(t){this.position.set(0,0,0),this.scale.set(.5*this.size,.5*this.size,1),this.lookAt(this.plane.normal),this.translateZ(-this.plane.constant),super.updateMatrixWorld(t)}dispose(){this.geometry.dispose(),this.material.dispose(),this.children[0].geometry.dispose(),this.children[0].material.dispose()}}const hh=new C;let Or,ao;class Vy extends ie{constructor(t=new C(0,0,1),e=new C(0,0,0),n=1,i=16776960,s=n*.2,a=s*.2){super(),this.type="ArrowHelper",Or===void 0&&(Or=new Zt,Or.setAttribute("position",new St([0,0,0,0,1,0],3)),ao=new fa(.5,1,5,1),ao.translate(0,-.5,0)),this.position.copy(e),this.line=new vi(Or,new He({color:i,toneMapped:!1})),this.line.matrixAutoUpdate=!1,this.add(this.line),this.cone=new ye(ao,new Si({color:i,toneMapped:!1})),this.cone.matrixAutoUpdate=!1,this.add(this.cone),this.setDirection(t),this.setLength(n,s,a)}setDirection(t){if(t.y>.99999)this.quaternion.set(0,0,0,1);else if(t.y<-.99999)this.quaternion.set(1,0,0,0);else{hh.set(t.z,0,-t.x).normalize();const e=Math.acos(t.y);this.quaternion.setFromAxisAngle(hh,e)}}setLength(t,e=t*.2,n=e*.2){this.line.scale.set(1,Math.max(1e-4,t-e),1),this.line.updateMatrix(),this.cone.scale.set(n,e,n),this.cone.position.y=t,this.cone.updateMatrix()}setColor(t){this.line.material.color.set(t),this.cone.material.color.set(t)}copy(t){return super.copy(t,!1),this.line.copy(t.line),this.cone.copy(t.cone),this}dispose(){this.line.geometry.dispose(),this.line.material.dispose(),this.cone.geometry.dispose(),this.cone.material.dispose()}}class Hy extends Un{constructor(t=1){const e=[0,0,0,t,0,0,0,0,0,0,t,0,0,0,0,0,0,t],n=[1,0,0,1,.6,0,0,1,0,.6,1,0,0,0,1,0,.6,1],i=new Zt;i.setAttribute("position",new St(e,3)),i.setAttribute("color",new St(n,3));const s=new He({vertexColors:!0,toneMapped:!1});super(i,s),this.type="AxesHelper"}setColors(t,e,n){const i=new vt,s=this.geometry.attributes.color.array;return i.set(t),i.toArray(s,0),i.toArray(s,3),i.set(e),i.toArray(s,6),i.toArray(s,9),i.set(n),i.toArray(s,12),i.toArray(s,15),this.geometry.attributes.color.needsUpdate=!0,this}dispose(){this.geometry.dispose(),this.material.dispose()}}class Gy{constructor(){this.type="ShapePath",this.color=new vt,this.subPaths=[],this.currentPath=null}moveTo(t,e){return this.currentPath=new Ko,this.subPaths.push(this.currentPath),this.currentPath.moveTo(t,e),this}lineTo(t,e){return this.currentPath.lineTo(t,e),this}quadraticCurveTo(t,e,n,i){return this.currentPath.quadraticCurveTo(t,e,n,i),this}bezierCurveTo(t,e,n,i,s,a){return this.currentPath.bezierCurveTo(t,e,n,i,s,a),this}splineThru(t){return this.currentPath.splineThru(t),this}toShapes(t){function e(p){const y=[];for(let v=0,x=p.length;v<x;v++){const A=p[v],T=new es;T.curves=A.curves,y.push(T)}return y}function n(p,y){const v=y.length;let x=!1;for(let A=v-1,T=0;T<v;A=T++){let R=y[A],P=y[T],b=P.x-R.x,S=P.y-R.y;if(Math.abs(S)>
vendor: 4,621 bytes, line 40
40Number.EPSILON){if(S<0&&(R=y[T],b=-b,P=y[A],S=-S),p.y<R.y||p.y>P.y)continue;if(p.y===R.y){if(p.x===R.x)return!0}else{const I=S*(p.x-R.x)-b*(p.y-R.y);if(I===0)return!0;if(I<0)continue;x=!x}}else{if(p.y!==R.y)continue;if(P.x<=p.x&&p.x<=R.x||R.x<=p.x&&p.x<=P.x)return!0}}return x}const i=pn.isClockWise,s=this.subPaths;if(s.length===0)return[];let a,o,l;const c=[];if(s.length===1)return o=s[0],l=new es,l.curves=o.curves,c.push(l),c;let h=!i(s[0].getPoints());h=t?!h:h;const u=[],d=[];let f=[],m=0,_;d[m]=void 0,f[m]=[];for(let p=0,y=s.length;p<y;p++)o=s[p],_=o.getPoints(),a=i(_),a=t?!a:a,a?(!h&&d[m]&&m++,d[m]={s:new es,p:_},d[m].s.curves=o.curves,h&&m++,f[m]=[]):f[m].push({h:o,p:_[0]});if(!d[0])return e(s);if(d.length>1){let p=!1,y=0;for(let v=0,x=d.length;v<x;v++)u[v]=[];for(let v=0,x=d.length;v<x;v++){const A=f[v];for(let T=0;T<A.length;T++){const R=A[T];let P=!0;for(let b=0;b<d.length;b++)n(R.p,d[b].p)&&(v!==b&&y++,P?(P=!1,u[b].push(R)):p=!0);P&&u[v].push(R)}}y>0&&p===!1&&(f=u)}let g;for(let p=0,y=d.length;p<y;p++){l=d[p].s,c.push(l),g=f[p];for(let v=0,x=g.length;v<x;v++)l.holes.push(g[v].h)}return c}}class Wy extends Dn{constructor(t,e=null){super(),this.object=t,this.domElement=e,this.enabled=!0,this.state=-1,this.keys={},this.mouseButtons={LEFT:null,MIDDLE:null,RIGHT:null},this.touches={ONE:null,TWO:null}}connect(t){if(t===void 0){console.warn("THREE.Controls: connect() now requires an element.");return}this.domElement!==null&&this.disconnect(),this.domElement=t}disconnect(){}dispose(){}update(){}}function xm(r,t){const e=r.image&&r.image.width?r.image.width/r.image.height:1;return e>t?(r.repeat.x=1,r.repeat.y=e/t,r.offset.x=0,r.offset.y=(1-r.repeat.y)/2):(r.repeat.x=t/e,r.repeat.y=1,r.offset.x=(1-r.repeat.x)/2,r.offset.y=0),r}function vm(r,t){const e=r.image&&r.image.width?r.image.width/r.image.height:1;return e>t?(r.repeat.x=t/e,r.repeat.y=1,r.offset.x=(1-r.repeat.x)/2,r.offset.y=0):(r.repeat.x=1,r.repeat.y=e/t,r.offset.x=0,r.offset.y=(1-r.repeat.y)/2),r}function ym(r){return r.repeat.x=1,r.repeat.y=1,r.offset.x=0,r.offset.y=0,r}function nl(r,t,e,n){const i=Mm(n);switch(e){case kh:return r*t;case ll:return r*t/i.components*i.byteLength;case ha:return r*t/i.components*i.byteLength;case Hh:return r*t*2/i.components*i.byteLength;case cl:return r*t*2/i.components*i.byteLength;case Vh:return r*t*3/i.components*i.byteLength;case ke:return r*t*4/i.components*i.byteLength;case hl:return r*t*4/i.components*i.byteLength;case Hr:case Gr:return Math.floor((r+3)/4)*Math.floor((t+3)/4)*8;case Wr:case Xr:return Math.floor((r+3)/4)*Math.floor((t+3)/4)*16;case Eo:case Ao:return Math.max(r,16)*Math.max(t,8)/4;case bo:case To:return Math.max(r,8)*Math.max(t,8)/2;case wo:case Co:return Math.floor((r+3)/4)*Math.floor((t+3)/4)*8;case Ro:return Math.floor((r+3)/4)*Math.floor((t+3)/4)*16;case Io:return Math.floor((r+3)/4)*Math.floor((t+3)/4)*16;case Po:return Math.floor((r+4)/5)*Math.floor((t+3)/4)*16;case Lo:return Math.floor((r+4)/5)*Math.floor((t+4)/5)*16;case Do:return Math.floor((r+5)/6)*Math.floor((t+4)/5)*16;case Uo:return Math.floor((r+5)/6)*Math.floor((t+5)/6)*16;case No:return Math.floor((r+7)/8)*Math.floor((t+4)/5)*16;case Fo:return Math.floor((r+7)/8)*Math.floor((t+5)/6)*16;case Oo:return Math.floor((r+7)/8)*Math.floor((t+7)/8)*16;case Bo:return Math.floor((r+9)/10)*Math.floor((t+4)/5)*16;case zo:return Math.floor((r+9)/10)*Math.floor((t+5)/6)*16;case ko:return Math.floor((r+9)/10)*Math.floor((t+7)/8)*16;case Vo:return Math.floor((r+9)/10)*Math.floor((t+9)/10)*16;case Ho:return Math.floor((r+11)/12)*Math.floor((t+9)/10)*16;case Go:return Math.floor((r+11)/12)*Math.floor((t+11)/12)*16;case qr:case Wo:case Xo:return Math.ceil(r/4)*Math.ceil(t/4)*16;case Gh:case qo:return Math.ceil(r/4)*Math.ceil(t/4)*8;case Yo:case Zo:return Math.ceil(r/4)*Math.ceil(t/4)*16}throw new Error(`Unable to determine texture byte length for ${e} format.`)}function Mm(r){switch(r){case mn:case Oh:return{byteLength:1,components:1};case Ds:case Bh:case Ws:return{byteLength:2,components:1};case al:case ol:return{byteLength:2,components:4};case Yn:case rl:case Je:return{byteLength:4,components:1};case zh:return{byteLength:4,components:3}}throw new Error(`Unknown texture type ${r}.`)}class Xy{static contain(t,e){return xm(t,e)}static cover(t,e){return vm(t,e)}static fill(t){return ym(t)}static getByteLength(t,e,n,i){return nl(t,e,n,i)}}typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("register",{detail:{revision:"179"}}));typeof window<"u"&&(window.__THREE__?console.warn("WARNING: Multiple instances of Three.js being imported."):window.__THREE__="
40179");function Eu(){let r=null,t=!1,e=null,n=null;function i(s,a){e(s,a),n=r.requestAnimationFrame(i)}return{start:function(){t!==!0&&e!==null&&(n=r.requestAnimationFrame(i),t=!0)},stop:function(){r.cancelAnimationFrame(n),t=!1},setAnimationLoop:function(s){e=s},setContext:function(s){r=s}}}function Sm(r){const t=new WeakMap;function e(o,l){const c=o.array,h=o.usage,u=c.byteLength,d=r.createBuffer();r.bindBuffer(l,d),r.bufferData(l,c,h),o.onUploadCallback();let f;if(c instanceof Float32Array)f=r.FLOAT;else if(typeof Float16Array<"u"&&c instanceof Float16Array)f=r.HALF_FLOAT;else if(c instanceof Uint16Array)o.isFloat16BufferAttribute?f=r.HALF_FLOAT:f=r.UNSIGNED_SHORT;else if(c instanceof Int16Array)f=r.SHORT;else if(c instanceof Uint32Array)f=r.UNSIGNED_INT;else if(c instanceof Int32Array)f=r.INT;else if(c instanceof Int8Array)f=r.BYTE;else if(c instanceof Uint8Array)f=r.UNSIGNED_BYTE;else if(c instanceof Uint8ClampedArray)f=r.UNSIGNED_BYTE;else throw new Error("THREE.WebGLAttributes: Unsupported buffer data format: "+c);return{buffer:d,type:f,bytesPerElement:c.BYTES_PER_ELEMENT,version:o.version,size:u}}function n(o,l,c){const h=l.array,u=l.updateRanges;if(r.bindBuffer(c,o),u.length===0)r.bufferSubData(c,0,h);else{u.sort((f,m)=>f.start-m.start);let d=0;for(let f=1;f<u.length;f++){const m=u[d],_=u[f];_.start<=m.start+m.count+1?m.count=Math.max(m.count,_.start+_.count-m.start):(++d,u[d]=_)}u.length=d+1;for(let f=0,m=u.length;f<m;f++){const _=u[f];r.bufferSubData(c,_.start*h.BYTES_PER_ELEMENT,h,_.start,_.count)}l.clearUpdateRanges()}l.onUploadCallback()}function i(o){return o.isInterleavedBufferAttribute&&(o=o.data),t.get(o)}function s(o){o.isInterleavedBufferAttribute&&(o=o.data);const l=t.get(o);l&&(r.deleteBuffer(l.buffer),t.delete(o))}function a(o,l){if(o.isInterleavedBufferAttribute&&(o=o.data),o.isGLBufferAttribute){const h=t.get(o);(!h||h.version<o.version)&&t.set(o,{buffer:o.buffer,type:o.type,bytesPerElement:o.elementSize,version:o.version});return}const c=t.get(o);if(c===void 0)t.set(o,e(o,l));else if(c.version<o.version){if(c.size!==o.array.byteLength)throw new Error("THREE.WebGLAttributes: The size of the buffer attribute's array buffer does not match the original size. Resizing buffer attributes is not supported.");n(c.buffer,o,l),c.version=o.version}}return{get:i,remove:s,update:a}}var bm=`#ifdef USE_ALPHAHASH
41	if ( diffuseColor.a < getAlphaHashThreshold( vPosition ) ) discard;
42#endif`,Em=`#ifdef USE_ALPHAHASH
43	const float ALPHA_HASH_SCALE = 0.05;
44	float hash2D( vec2 value ) {
45		return fract( 1.0e4 * sin( 17.0 * value.x + 0.1 * value.y ) * ( 0.1 + abs( sin( 13.0 * value.y + value.x ) ) ) );
46	}
47	float hash3D( vec3 value ) {
48		return hash2D( vec2( hash2D( value.xy ), value.z ) );
49	}
50	float getAlphaHashThreshold( vec3 position ) {
51		float maxDeriv = max(
52			length( dFdx( position.xyz ) ),
53			length( dFdy( position.xyz ) )
54		);
55		float pixScale = 1.0 / ( ALPHA_HASH_SCALE * maxDeriv );
56		vec2 pixScales = vec2(
57			exp2( floor( log2( pixScale ) ) ),
58			exp2( ceil( log2( pixScale ) ) )
59		);
60		vec2 alpha = vec2(
61			hash3D( floor( pixScales.x * position.xyz ) ),
62			hash3D( floor( pixScales.y * position.xyz ) )
63		);
64		float lerpFactor = fract( log2( pixScale ) );
65		float x = ( 1.0 - lerpFactor ) * alpha.x + lerpFactor * alpha.y;
66		float a = min( lerpFactor, 1.0 - lerpFactor );
67		vec3 cases = vec3(
68			x * x / ( 2.0 * a * ( 1.0 - a ) ),
69			( x - 0.5 * a ) / ( 1.0 - a ),
70			1.0 - ( ( 1.0 - x ) * ( 1.0 - x ) / ( 2.0 * a * ( 1.0 - a ) ) )
71		);
72		float threshold = ( x < ( 1.0 - a ) )
73			? ( ( x < a ) ? cases.x : cases.y )
74			: cases.z;
75		return clamp( threshold , 1.0e-6, 1.0 );
76	}
77#endif`,Tm=`#ifdef USE_ALPHAMAP
78	diffuseColor.a *= texture2D( alphaMap, vAlphaMapUv ).g;
79#endif`,Am=`#ifdef USE_ALPHAMAP
80	uniform sampler2D alphaMap;
81#endif`,wm=`#ifdef USE_ALPHATEST
82	#ifdef ALPHA_TO_COVERAGE
83	diffuseColor.a = smoothstep( alphaTest, alphaTest + fwidth( diffuseColor.a ), diffuseColor.a );
84	if ( diffuseColor.a == 0.0 ) discard;
85	#else
86	if ( diffuseColor.a < alphaTest ) discard;
87	#endif
88#endif`,Cm=`#ifdef USE_ALPHATEST
89	uniform float alphaTest;
90#endif`,Rm=`#ifdef USE_AOMAP
91	float ambientOcclusion = ( texture2D( aoMap, vAoMapUv ).r - 1.0 ) * aoMapIntensity + 1.0;
92	reflectedLight.indirectDiffuse *= ambientOcclusion;
93	#if defined( USE_CLEARCOAT ) 
94		clearcoatSpecularIndirect *= ambientOcclusion;
95	#endif
96	#if defined( USE_SHEEN ) 
97		sheenSpecularIndirect *= ambientOcclusion;
98	#endif
99	#if defined( USE_ENVMAP ) && defined( STANDARD )
100		float dotNV = saturate( dot( geometryNormal, geometryViewDir ) );
101		reflectedLight.indirectSpecular *= computeSpecularOcclusion( dotNV, ambientOcclusion, material.roughness );
102	#endif
103#endif`,Im=`#ifdef USE_AOMAP
104	uniform sampler2D aoMap;
105	uniform float aoMapIntensity;
106#endif`,Pm=`#ifdef USE_BATCHING
107	#if ! defined( GL_ANGLE_multi_draw )
108	#define gl_DrawID _gl_DrawID
109	uniform int _gl_DrawID;
110	#endif
111	uniform highp sampler2D batchingTexture;
112	uniform highp usampler2D batchingIdTexture;
113	mat4 getBatchingMatrix( const in float i ) {
114		int size = textureSize( batchingTexture, 0 ).x;
115		int j = int( i ) * 4;
116		int x = j % size;
117		int y = j / size;
118		vec4 v1 = texelFetch( batchingTexture, ivec2( x, y ), 0 );
119		vec4 v2 = texelFetch( batchingTexture, ivec2( x + 1, y ), 0 );
120		vec4 v3 = texelFetch( batchingTexture, ivec2( x + 2, y ), 0 );
121		vec4 v4 = texelFetch( batchingTexture, ivec2( x + 3, y ), 0 );
122		return mat4( v1, v2, v3, v4 );
123	}
124	float getIndirectIndex( const in int i ) {
125		int size = textureSize( batchingIdTexture, 0 ).x;
126		int x = i % size;
127		int y = i / size;
128		return float( texelFetch( batchingIdTexture, ivec2( x, y ), 0 ).r );
129	}
130#endif
131#ifdef USE_BATCHING_COLOR
132	uniform sampler2D batchingColorTexture;
133	vec3 getBatchingColor( const in float i ) {
134		int size = textureSize( batchingColorTexture, 0 ).x;
135		int j = int( i );
136		int x = j % size;
137		int y = j / size;
138		return texelFetch( batchingColorTexture, ivec2( x, y ), 0 ).rgb;
139	}
140#endif`,Lm=`#ifdef USE_BATCHING
141	mat4 batchingMatrix = getBatchingMatrix( getIndirectIndex( gl_DrawID ) );
142#endif`,Dm=`vec3 transformed = vec3( position );
143#ifdef USE_ALPHAHASH
144	vPosition = vec3( position );
145#endif`,Um=`vec3 objectNormal = vec3( normal );
146#ifdef USE_TANGENT
147	vec3 objectTangent = vec3( tangent.xyz );
148#endif`,Nm=`float G_BlinnPhong_Implicit( ) {
149	return 0.25;
150}
151float D_BlinnPhong( const in float shininess, const in float dotNH ) {
152	return RECIPROCAL_PI * ( shininess * 0.5 + 1.0 ) * pow( dotNH, shininess );
153}
154vec3 BRDF_BlinnPhong( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in vec3 specularColor, const in float shininess ) {
155	vec3 halfDir = normalize( lightDir + viewDir );
156	float dotNH = saturate( dot( normal, halfDir ) );
157	float dotVH = saturate( dot( viewDir, halfDir ) );
158	vec3 F = F_Schlick( specularColor, 1.0, dotVH );
159	float G = G_BlinnPhong_Implicit( );
160	float D = D_BlinnPhong( shininess, dotNH );
161	return F * ( G * D );
162} // validated`,Fm=`#ifdef USE_IRIDESCENCE
163	const mat3 XYZ_TO_REC709 = mat3(
164		 3.2404542, -0.9692660,  0.0556434,
165		-1.5371385,  1.8760108, -0.2040259,
166		-0.4985314,  0.0415560,  1.0572252
167	);
168	vec3 Fresnel0ToIor( vec3 fresnel0 ) {
169		vec3 sqrtF0 = sqrt( fresnel0 );
170		return ( vec3( 1.0 ) + sqrtF0 ) / ( vec3( 1.0 ) - sqrtF0 );
171	}
172	vec3 IorToFresnel0( vec3 transmittedIor, float incidentIor ) {
173		return pow2( ( transmittedIor - vec3( incidentIor ) ) / ( transmittedIor + vec3( incidentIor ) ) );
174	}
175	float IorToFresnel0( float transmittedIor, float incidentIor ) {
176		return pow2( ( transmittedIor - incidentIor ) / ( transmittedIor + incidentIor ));
177	}
178	vec3 evalSensitivity( float OPD, vec3 shift ) {
179		float phase = 2.0 * PI * OPD * 1.0e-9;
180		vec3 val = vec3( 5.4856e-13, 4.4201e-13, 5.2481e-13 );
181		vec3 pos = vec3( 1.6810e+06, 1.7953e+06, 2.2084e+06 );
182		vec3 var = vec3( 4.3278e+09, 9.3046e+09, 6.6121e+09 );
183		vec3 xyz = val * sqrt( 2.0 * PI * var ) * cos( pos * phase + shift ) * exp( - pow2( phase ) * var );
184		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 ) );
185		xyz /= 1.0685e-7;
186		vec3 rgb = XYZ_TO_REC709 * xyz;
187		return rgb;
188	}
189	vec3 evalIridescence( float outsideIOR, float eta2, float cosTheta1, float thinFilmThickness, vec3 baseF0 ) {
190		vec3 I;
191		float iridescenceIOR = mix( outsideIOR, eta2, smoothstep( 0.0, 0.03, thinFilmThickness ) );
192		float sinTheta2Sq = pow2( outsideIOR / iridescenceIOR ) * ( 1.0 - pow2( cosTheta1 ) );
193		float cosTheta2Sq = 1.0 - sinTheta2Sq;
194		if ( cosTheta2Sq < 0.0 ) {
195			return vec3( 1.0 );
196		}
197		float cosTheta2 = sqrt( cosTheta2Sq );
198		float R0 = IorToFresnel0( iridescenceIOR, outsideIOR );
199		float R12 = F_Schlick( R0, 1.0, cosTheta1 );
200		float T121 = 1.0 - R12;
201		float phi12 = 0.0;
202		if ( iridescenceIOR < outsideIOR ) phi12 = PI;
203		float phi21 = PI - phi12;
204		vec3 baseIOR = Fresnel0ToIor( clamp( baseF0, 0.0, 0.9999 ) );		vec3 R1 = IorToFresnel0( baseIOR, iridescenceIOR );
205		vec3 R23 = F_Schlick( R1, 1.0, cosTheta2 );
206		vec3 phi23 = vec3( 0.0 );
207		if ( baseIOR[ 0 ] < iridescenceIOR ) phi23[ 0 ] = PI;
208		if ( baseIOR[ 1 ] < iridescenceIOR ) phi23[ 1 ] = PI;
209		if ( baseIOR[ 2 ] < iridescenceIOR ) phi23[ 2 ] = PI;
210		float OPD = 2.0 * iridescenceIOR * thinFilmThickness * cosTheta2;
211		vec3 phi = vec3( phi21 ) + phi23;
212		vec3 R123 = clamp( R12 * R23, 1e-5, 0.9999 );
213		vec3 r123 = sqrt( R123 );
214		vec3 Rs = pow2( T121 ) * R23 / ( vec3( 1.0 ) - R123 );
215		vec3 C0 = R12 + Rs;
216		I = C0;
217		vec3 Cm = Rs - T121;
218		for ( int m = 1; m <= 2; ++ m ) {
219			Cm *= r123;
220			vec3 Sm = 2.0 * evalSensitivity( float( m ) * OPD, float( m ) * phi );
221			I += Cm * Sm;
222		}
223		return max( I, vec3( 0.0 ) );
224	}
225#endif`,Om=`#ifdef USE_BUMPMAP
226	uniform sampler2D bumpMap;
227	uniform float bumpScale;
228	vec2 dHdxy_fwd() {
229		vec2 dSTdx = dFdx( vBumpMapUv );
230		vec2 dSTdy = dFdy( vBumpMapUv );
231		float Hll = bumpScale * texture2D( bumpMap, vBumpMapUv ).x;
232		float dBx = bumpScale * texture2D( bumpMap, vBumpMapUv + dSTdx ).x - Hll;
233		float dBy = bumpScale * texture2D( bumpMap, vBumpMapUv + dSTdy ).x - Hll;
234		return vec2( dBx, dBy );
235	}
236	vec3 perturbNormalArb( vec3 surf_pos, vec3 surf_norm, vec2 dHdxy, float faceDirection ) {
237		vec3 vSigmaX = normalize( dFdx( surf_pos.xyz ) );
238		vec3 vSigmaY = normalize( dFdy( surf_pos.xyz ) );
239		vec3 vN = surf_norm;
240		vec3 R1 = cross( vSigmaY, vN );
241		vec3 R2 = cross( vN, vSigmaX );
242		float fDet = dot( vSigmaX, R1 ) * faceDirection;
243		vec3 vGrad = sign( fDet ) * ( dHdxy.x * R1 + dHdxy.y * R2 );
244		return normalize( abs( fDet ) * surf_norm - vGrad );
245	}
246#endif`,Bm=`#if NUM_CLIPPING_PLANES > 0
247	vec4 plane;
248	#ifdef ALPHA_TO_COVERAGE
249		float distanceToPlane, distanceGradient;
250		float clipOpacity = 1.0;
251		#pragma unroll_loop_start
252		for ( int i = 0; i < UNION_CLIPPING_PLANES; i ++ ) {
253			plane = clippingPlanes[ i ];
254			distanceToPlane = - dot( vClipPosition, plane.xyz ) + plane.w;
255			distanceGradient = fwidth( distanceToPlane ) / 2.0;
256			clipOpacity *= smoothstep( - distanceGradient, distanceGradient, distanceToPlane );
257			if ( clipOpacity == 0.0 ) discard;
258		}
259		#pragma unroll_loop_end
260		#if UNION_CLIPPING_PLANES < NUM_CLIPPING_PLANES
261			float unionClipOpacity = 1.0;
262			#pragma unroll_loop_start
263			for ( int i = UNION_CLIPPING_PLANES; i < NUM_CLIPPING_PLANES; i ++ ) {
264				plane = clippingPlanes[ i ];
265				distanceToPlane = - dot( vClipPosition, plane.xyz ) + plane.w;
266				distanceGradient = fwidth( distanceToPlane ) / 2.0;
267				unionClipOpacity *= 1.0 - smoothstep( - distanceGradient, distanceGradient, distanceToPlane );
268			}
269			#pragma unroll_loop_end
270			clipOpacity *= 1.0 - unionClipOpacity;
271		#endif
272		diffuseColor.a *= clipOpacity;
273		if ( diffuseColor.a == 0.0 ) discard;
274	#else
275		#pragma unroll_loop_start
276		for ( int i = 0; i < UNION_CLIPPING_PLANES; i ++ ) {
277			plane = clippingPlanes[ i ];
278			if ( dot( vClipPosition, plane.xyz ) > plane.w ) discard;
279		}
280		#pragma unroll_loop_end
281		#if UNION_CLIPPING_PLANES < NUM_CLIPPING_PLANES
282			bool clipped = true;
283			#pragma unroll_loop_start
284			for ( int i = UNION_CLIPPING_PLANES; i < NUM_CLIPPING_PLANES; i ++ ) {
285				plane = clippingPlanes[ i ];
286				clipped = ( dot( vClipPosition, plane.xyz ) > plane.w ) && clipped;
287			}
288			#pragma unroll_loop_end
289			if ( clipped ) discard;
290		#endif
291	#endif
292#endif`,zm=`#if NUM_CLIPPING_PLANES > 0
293	varying vec3 vClipPosition;
294	uniform vec4 clippingPlanes[ NUM_CLIPPING_PLANES ];
295#endif`,km=`#if NUM_CLIPPING_PLANES > 0
296	varying vec3 vClipPosition;
297#endif`,Vm=`#if NUM_CLIPPING_PLANES > 0
298	vClipPosition = - mvPosition.xyz;
299#endif`,Hm=`#if defined( USE_COLOR_ALPHA )
300	diffuseColor *= vColor;
301#elif defined( USE_COLOR )
302	diffuseColor.rgb *= vColor;
303#endif`,Gm=`#if defined( USE_COLOR_ALPHA )
304	varying vec4 vColor;
305#elif defined( USE_COLOR )
306	varying vec3 vColor;
307#endif`,Wm=`#if defined( USE_COLOR_ALPHA )
308	varying vec4 vColor;
309#elif defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR ) || defined( USE_BATCHING_COLOR )
310	varying vec3 vColor;
311#endif`,Xm=`#if defined( USE_COLOR_ALPHA )
312	vColor = vec4( 1.0 );
313#elif defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR ) || defined( USE_BATCHING_COLOR )
314	vColor = vec3( 1.0 );
315#endif
316#ifdef USE_COLOR
317	vColor *= color;
318#endif
319#ifdef USE_INSTANCING_COLOR
320	vColor.xyz *= instanceColor.xyz;
321#endif
322#ifdef USE_BATCHING_COLOR
323	vec3 batchingColor = getBatchingColor( getIndirectIndex( gl_DrawID ) );
324	vColor.xyz *= batchingColor.xyz;
325#endif`,qm=`#define PI 3.141592653589793
326#define PI2 6.283185307179586
327#define PI_HALF 1.5707963267948966
328#define RECIPROCAL_PI 0.3183098861837907
329#define RECIPROCAL_PI2 0.15915494309189535
330#define EPSILON 1e-6
331#ifndef saturate
332#define saturate( a ) clamp( a, 0.0, 1.0 )
333#endif
334#define whiteComplement( a ) ( 1.0 - saturate( a ) )
335float pow2( const in float x ) { return x*x; }
336vec3 pow2( const in vec3 x ) { return x*x; }
337float pow3( const in float x ) { return x*x*x; }
338float pow4( const in float x ) { float x2 = x*x; return x2*x2; }
339float max3( const in vec3 v ) { return max( max( v.x, v.y ), v.z ); }
340float average( const in vec3 v ) { return dot( v, vec3( 0.3333333 ) ); }
341highp float rand( const in vec2 uv ) {
342	const highp float a = 12.9898, b = 78.233, c = 43758.5453;
343	highp float dt = dot( uv.xy, vec2( a,b ) ), sn = mod( dt, PI );
344	return fract( sin( sn ) * c );
345}
346#ifdef HIGH_PRECISION
347	float precisionSafeLength( vec3 v ) { return length( v ); }
348#else
349	float precisionSafeLength( vec3 v ) {
350		float maxComponent = max3( abs( v ) );
351		return length( v / maxComponent ) * maxComponent;
352	}
353#endif
354struct IncidentLight {
355	vec3 color;
356	vec3 direction;
357	bool visible;
358};
359struct ReflectedLight {
360	vec3 directDiffuse;
361	vec3 directSpecular;
362	vec3 indirectDiffuse;
363	vec3 indirectSpecular;
364};
365#ifdef USE_ALPHAHASH
366	varying vec3 vPosition;
367#endif
368vec3 transformDirection( in vec3 dir, in mat4 matrix ) {
369	return normalize( ( matrix * vec4( dir, 0.0 ) ).xyz );
370}
371vec3 inverseTransformDirection( in vec3 dir, in mat4 matrix ) {
372	return normalize( ( vec4( dir, 0.0 ) * matrix ).xyz );
373}
374mat3 transposeMat3( const in mat3 m ) {
375	mat3 tmp;
376	tmp[ 0 ] = vec3( m[ 0 ].x, m[ 1 ].x, m[ 2 ].x );
377	tmp[ 1 ] = vec3( m[ 0 ].y, m[ 1 ].y, m[ 2 ].y );
378	tmp[ 2 ] = vec3( m[ 0 ].z, m[ 1 ].z, m[ 2 ].z );
379	return tmp;
380}
381bool isPerspectiveMatrix( mat4 m ) {
382	return m[ 2 ][ 3 ] == - 1.0;
383}
384vec2 equirectUv( in vec3 dir ) {
385	float u = atan( dir.z, dir.x ) * RECIPROCAL_PI2 + 0.5;
386	float v = asin( clamp( dir.y, - 1.0, 1.0 ) ) * RECIPROCAL_PI + 0.5;
387	return vec2( u, v );
388}
389vec3 BRDF_Lambert( const in vec3 diffuseColor ) {
390	return RECIPROCAL_PI * diffuseColor;
391}
392vec3 F_Schlick( const in vec3 f0, const in float f90, const in float dotVH ) {
393	float fresnel = exp2( ( - 5.55473 * dotVH - 6.98316 ) * dotVH );
394	return f0 * ( 1.0 - fresnel ) + ( f90 * fresnel );
395}
396float F_Schlick( const in float f0, const in float f90, const in float dotVH ) {
397	float fresnel = exp2( ( - 5.55473 * dotVH - 6.98316 ) * dotVH );
398	return f0 * ( 1.0 - fresnel ) + ( f90 * fresnel );
399} // validated`,Ym=`#ifdef ENVMAP_TYPE_CUBE_UV
400	#define cubeUV_minMipLevel 4.0
401	#define cubeUV_minTileSize 16.0
402	float getFace( vec3 direction ) {
403		vec3 absDirection = abs( direction );
404		float face = - 1.0;
405		if ( absDirection.x > absDirection.z ) {
406			if ( absDirection.x > absDirection.y )
407				face = direction.x > 0.0 ? 0.0 : 3.0;
408			else
409				face = direction.y > 0.0 ? 1.0 : 4.0;
410		} else {
411			if ( absDirection.z > absDirection.y )
412				face = direction.z > 0.0 ? 2.0 : 5.0;
413			else
414				face = direction.y > 0.0 ? 1.0 : 4.0;
415		}
416		return face;
417	}
418	vec2 getUV( vec3 direction, float face ) {
419		vec2 uv;
420		if ( face == 0.0 ) {
421			uv = vec2( direction.z, direction.y ) / abs( direction.x );
422		} else if ( face == 1.0 ) {
423			uv = vec2( - direction.x, - direction.z ) / abs( direction.y );
424		} else if ( face == 2.0 ) {
425			uv = vec2( - direction.x, direction.y ) / abs( direction.z );
426		} else if ( face == 3.0 ) {
427			uv = vec2( - direction.z, direction.y ) / abs( direction.x );
428		} else if ( face == 4.0 ) {
429			uv = vec2( - direction.x, direction.z ) / abs( direction.y );
430		} else {
431			uv = vec2( direction.x, direction.y ) / abs( direction.z );
432		}
433		return 0.5 * ( uv + 1.0 );
434	}
435	vec3 bilinearCubeUV( sampler2D envMap, vec3 direction, float mipInt ) {
436		float face = getFace( direction );
437		float filterInt = max( cubeUV_minMipLevel - mipInt, 0.0 );
438		mipInt = max( mipInt, cubeUV_minMipLevel );
439		float faceSize = exp2( mipInt );
440		highp vec2 uv = getUV( direction, face ) * ( faceSize - 2.0 ) + 1.0;
441		if ( face > 2.0 ) {
442			uv.y += faceSize;
443			face -= 3.0;
444		}
445		uv.x += face * faceSize;
446		uv.x += filterInt * 3.0 * cubeUV_minTileSize;
447		uv.y += 4.0 * ( exp2( CUBEUV_MAX_MIP ) - faceSize );
448		uv.x *= CUBEUV_TEXEL_WIDTH;
449		uv.y *= CUBEUV_TEXEL_HEIGHT;
450		#ifdef texture2DGradEXT
451			return texture2DGradEXT( envMap, uv, vec2( 0.0 ), vec2( 0.0 ) ).rgb;
452		#else
453			return texture2D( envMap, uv ).rgb;
454		#endif
455	}
456	#define cubeUV_r0 1.0
457	#define cubeUV_m0 - 2.0
458	#define cubeUV_r1 0.8
459	#define cubeUV_m1 - 1.0
460	#define cubeUV_r4 0.4
461	#define cubeUV_m4 2.0
462	#define cubeUV_r5 0.305
463	#define cubeUV_m5 3.0
464	#define cubeUV_r6 0.21
465	#define cubeUV_m6 4.0
466	float roughnessToMip( float roughness ) {
467		float mip = 0.0;
468		if ( roughness >= cubeUV_r1 ) {
469			mip = ( cubeUV_r0 - roughness ) * ( cubeUV_m1 - cubeUV_m0 ) / ( cubeUV_r0 - cubeUV_r1 ) + cubeUV_m0;
470		} else if ( roughness >= cubeUV_r4 ) {
471			mip = ( cubeUV_r1 - roughness ) * ( cubeUV_m4 - cubeUV_m1 ) / ( cubeUV_r1 - cubeUV_r4 ) + cubeUV_m1;
472		} else if ( roughness >= cubeUV_r5 ) {
473			mip = ( cubeUV_r4 - roughness ) * ( cubeUV_m5 - cubeUV_m4 ) / ( cubeUV_r4 - cubeUV_r5 ) + cubeUV_m4;
474		} else if ( roughness >= cubeUV_r6 ) {
475			mip = ( cubeUV_r5 - roughness ) * ( cubeUV_m6 - cubeUV_m5 ) / ( cubeUV_r5 - cubeUV_r6 ) + cubeUV_m5;
476		} else {
477			mip = - 2.0 * log2( 1.16 * roughness );		}
478		return mip;
479	}
480	vec4 textureCubeUV( sampler2D envMap, vec3 sampleDir, float roughness ) {
481		float mip = clamp( roughnessToMip( roughness ), cubeUV_m0, CUBEUV_MAX_MIP );
482		float mipF = fract( mip );
483		float mipInt = floor( mip );
484		vec3 color0 = bilinearCubeUV( envMap, sampleDir, mipInt );
485		if ( mipF == 0.0 ) {
486			return vec4( color0, 1.0 );
487		} else {
488			vec3 color1 = bilinearCubeUV( envMap, sampleDir, mipInt + 1.0 );
489			return vec4( mix( color0, color1, mipF ), 1.0 );
490		}
491	}
492#endif`,Zm=`vec3 transformedNormal = objectNormal;
493#ifdef USE_TANGENT
494	vec3 transformedTangent = objectTangent;
495#endif
496#ifdef USE_BATCHING
497	mat3 bm = mat3( batchingMatrix );
498	transformedNormal /= vec3( dot( bm[ 0 ], bm[ 0 ] ), dot( bm[ 1 ], bm[ 1 ] ), dot( bm[ 2 ], bm[ 2 ] ) );
499	transformedNormal = bm * transformedNormal;
500	#ifdef USE_TANGENT
501		transformedTangent = bm * transformedTangent;
502	#endif
503#endif
504#ifdef USE_INSTANCING
505	mat3 im = mat3( instanceMatrix );
506	transformedNormal /= vec3( dot( im[ 0 ], im[ 0 ] ), dot( im[ 1 ], im[ 1 ] ), dot( im[ 2 ], im[ 2 ] ) );
507	transformedNormal = im * transformedNormal;
508	#ifdef USE_TANGENT
509		transformedTangent = im * transformedTangent;
510	#endif
511#endif
512transformedNormal = normalMatrix * transformedNormal;
513#ifdef FLIP_SIDED
514	transformedNormal = - transformedNormal;
515#endif
516#ifdef USE_TANGENT
517	transformedTangent = ( modelViewMatrix * vec4( transformedTangent, 0.0 ) ).xyz;
518	#ifdef FLIP_SIDED
519		transformedTangent = - transformedTangent;
520	#endif
521#endif`,Jm=`#ifdef USE_DISPLACEMENTMAP
522	uniform sampler2D displacementMap;
523	uniform float displacementScale;
524	uniform float displacementBias;
525#endif`,$m=`#ifdef USE_DISPLACEMENTMAP
526	transformed += normalize( objectNormal ) * ( texture2D( displacementMap, vDisplacementMapUv ).x * displacementScale + dis
526placementBias );
527#endif`,Km=`#ifdef USE_EMISSIVEMAP
528	vec4 emissiveColor = texture2D( emissiveMap, vEmissiveMapUv );
529	#ifdef DECODE_VIDEO_TEXTURE_EMISSIVE
530		emissiveColor = sRGBTransferEOTF( emissiveColor );
531	#endif
532	totalEmissiveRadiance *= emissiveColor.rgb;
533#endif`,Qm=`#ifdef USE_EMISSIVEMAP
534	uniform sampler2D emissiveMap;
535#endif`,jm="gl_FragColor = linearToOutputTexel( gl_FragColor );",tg=`vec4 LinearTransferOETF( in vec4 value ) {
536	return value;
537}
538vec4 sRGBTransferEOTF( in vec4 value ) {
539	return vec4( mix( pow( value.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), value.rgb * 0.0773993808, vec3( lessThanEqual( value.rgb, vec3( 0.04045 ) ) ) ), value.a );
540}
541vec4 sRGBTransferOETF( in vec4 value ) {
542	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 );
543}`,eg=`#ifdef USE_ENVMAP
544	#ifdef ENV_WORLDPOS
545		vec3 cameraToFrag;
546		if ( isOrthographic ) {
547			cameraToFrag = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) );
548		} else {
549			cameraToFrag = normalize( vWorldPosition - cameraPosition );
550		}
551		vec3 worldNormal = inverseTransformDirection( normal, viewMatrix );
552		#ifdef ENVMAP_MODE_REFLECTION
553			vec3 reflectVec = reflect( cameraToFrag, worldNormal );
554		#else
555			vec3 reflectVec = refract( cameraToFrag, worldNormal, refractionRatio );
556		#endif
557	#else
558		vec3 reflectVec = vReflect;
559	#endif
560	#ifdef ENVMAP_TYPE_CUBE
561		vec4 envColor = textureCube( envMap, envMapRotation * vec3( flipEnvMap * reflectVec.x, reflectVec.yz ) );
562	#else
563		vec4 envColor = vec4( 0.0 );
564	#endif
565	#ifdef ENVMAP_BLENDING_MULTIPLY
566		outgoingLight = mix( outgoingLight, outgoingLight * envColor.xyz, specularStrength * reflectivity );
567	#elif defined( ENVMAP_BLENDING_MIX )
568		outgoingLight = mix( outgoingLight, envColor.xyz, specularStrength * reflectivity );
569	#elif defined( ENVMAP_BLENDING_ADD )
570		outgoingLight += envColor.xyz * specularStrength * reflectivity;
571	#endif
572#endif`,ng=`#ifdef USE_ENVMAP
573	uniform float envMapIntensity;
574	uniform float flipEnvMap;
575	uniform mat3 envMapRotation;
576	#ifdef ENVMAP_TYPE_CUBE
577		uniform samplerCube envMap;
578	#else
579		uniform sampler2D envMap;
580	#endif
581	
582#endif`,ig=`#ifdef USE_ENVMAP
583	uniform float reflectivity;
584	#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( LAMBERT )
585		#define ENV_WORLDPOS
586	#endif
587	#ifdef ENV_WORLDPOS
588		varying vec3 vWorldPosition;
589		uniform float refractionRatio;
590	#else
591		varying vec3 vReflect;
592	#endif
593#endif`,sg=`#ifdef USE_ENVMAP
594	#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( LAMBERT )
595		#define ENV_WORLDPOS
596	#endif
597	#ifdef ENV_WORLDPOS
598		
599		varying vec3 vWorldPosition;
600	#else
601		varying vec3 vReflect;
602		uniform float refractionRatio;
603	#endif
604#endif`,rg=`#ifdef USE_ENVMAP
605	#ifdef ENV_WORLDPOS
606		vWorldPosition = worldPosition.xyz;
607	#else
608		vec3 cameraToVertex;
609		if ( isOrthographic ) {
610			cameraToVertex = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) );
611		} else {
612			cameraToVertex = normalize( worldPosition.xyz - cameraPosition );
613		}
614		vec3 worldNormal = inverseTransformDirection( transformedNormal, viewMatrix );
615		#ifdef ENVMAP_MODE_REFLECTION
616			vReflect = reflect( cameraToVertex, worldNormal );
617		#else
618			vReflect = refract( cameraToVertex, worldNormal, refractionRatio );
619		#endif
620	#endif
621#endif`,ag=`#ifdef USE_FOG
622	vFogDepth = - mvPosition.z;
623#endif`,og=`#ifdef USE_FOG
624	varying float vFogDepth;
625#endif`,lg=`#ifdef USE_FOG
626	#ifdef FOG_EXP2
627		float fogFactor = 1.0 - exp( - fogDensity * fogDensity * vFogDepth * vFogDepth );
628	#else
629		float fogFactor = smoothstep( fogNear, fogFar, vFogDepth );
630	#endif
631	gl_FragColor.rgb = mix( gl_FragColor.rgb, fogColor, fogFactor );
632#endif`,cg=`#ifdef USE_FOG
633	uniform vec3 fogColor;
634	varying float vFogDepth;
635	#ifdef FOG_EXP2
636		uniform float fogDensity;
637	#else
638		uniform float fogNear;
639		uniform float fogFar;
640	#endif
641#endif`,hg=`#ifdef USE_GRADIENTMAP
642	uniform sampler2D gradientMap;
643#endif
644vec3 getGradientIrradiance( vec3 normal, vec3 lightDirection ) {
645	float dotNL = dot( normal, lightDirection );
646	vec2 coord = vec2( dotNL * 0.5 + 0.5, 0.0 );
647	#ifdef USE_GRADIENTMAP
648		return vec3( texture2D( gradientMap, coord ).r );
649	#else
650		vec2 fw = fwidth( coord ) * 0.5;
651		return mix( vec3( 0.7 ), vec3( 1.0 ), smoothstep( 0.7 - fw.x, 0.7 + fw.x, coord.x ) );
652	#endif
653}`,ug=`#ifdef USE_LIGHTMAP
654	uniform sampler2D lightMap;
655	uniform float lightMapIntensity;
656#endif`,dg=`LambertMaterial material;
657material.diffuseColor = diffuseColor.rgb;
658material.specularStrength = specularStrength;`,fg=`varying vec3 vViewPosition;
659struct LambertMaterial {
660	vec3 diffuseColor;
661	float specularStrength;
662};
663void RE_Direct_Lambert( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in LambertMaterial material, inout ReflectedLight reflectedLight ) {
664	float dotNL = saturate( dot( geometryNormal, directLight.direction ) );
665	vec3 irradiance = dotNL * directLight.color;
666	reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
667}
668void RE_IndirectDiffuse_Lambert( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in LambertMaterial material, inout ReflectedLight reflectedLight ) {
669	reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
670}
671#define RE_Direct				RE_Direct_Lambert
672#define RE_IndirectDiffuse		RE_IndirectDiffuse_Lambert`,pg=`uniform bool receiveShadow;
673uniform vec3 ambientLightColor;
674#if defined( USE_LIGHT_PROBES )
675	uniform vec3 lightProbe[ 9 ];
676#endif
677vec3 shGetIrradianceAt( in vec3 normal, in vec3 shCoefficients[ 9 ] ) {
678	float x = normal.x, y = normal.y, z = normal.z;
679	vec3 result = shCoefficients[ 0 ] * 0.886227;
680	result += shCoefficients[ 1 ] * 2.0 * 0.511664 * y;
681	result += shCoefficients[ 2 ] * 2.0 * 0.511664 * z;
682	result += shCoefficients[ 3 ] * 2.0 * 0.511664 * x;
683	result += shCoefficients[ 4 ] * 2.0 * 0.429043 * x * y;
684	result += shCoefficients[ 5 ] * 2.0 * 0.429043 * y * z;
685	result += shCoefficients[ 6 ] * ( 0.743125 * z * z - 0.247708 );
686	result += shCoefficients[ 7 ] * 2.0 * 0.429043 * x * z;
687	result += shCoefficients[ 8 ] * 0.429043 * ( x * x - y * y );
688	return result;
689}
690vec3 getLightProbeIrradiance( const in vec3 lightProbe[ 9 ], const in vec3 normal ) {
691	vec3 worldNormal = inverseTransformDirection( normal, viewMatrix );
692	vec3 irradiance = shGetIrradianceAt( worldNormal, lightProbe );
693	return irradiance;
694}
695vec3 getAmbientLightIrradiance( const in vec3 ambientLightColor ) {
696	vec3 irradiance = ambientLightColor;
697	return irradiance;
698}
699float getDistanceAttenuation( const in float lightDistance, const in float cutoffDistance, const in float decayExponent ) {
700	float distanceFalloff = 1.0 / max( pow( lightDistance, decayExponent ), 0.01 );
701	if ( cutoffDistance > 0.0 ) {
702		distanceFalloff *= pow2( saturate( 1.0 - pow4( lightDistance / cutoffDistance ) ) );
703	}
704	return distanceFalloff;
705}
706float getSpotAttenuation( const in float coneCosine, const in float penumbraCosine, const in float angleCosine ) {
707	return smoothstep( coneCosine, penumbraCosine, angleCosine );
708}
709#if NUM_DIR_LIGHTS > 0
710	struct DirectionalLight {
711		vec3 direction;
712		vec3 color;
713	};
714	uniform DirectionalLight directionalLights[ NUM_DIR_LIGHTS ];
715	void getDirectionalLightInfo( const in DirectionalLight directionalLight, out IncidentLight light ) {
716		light.color = directionalLight.color;
717		light.direction = directionalLight.direction;
718		light.visible = true;
719	}
720#endif
721#if NUM_POINT_LIGHTS > 0
722	struct PointLight {
723		vec3 position;
724		vec3 color;
725		float distance;
726		float decay;
727	};
728	uniform PointLight pointLights[ NUM_POINT_LIGHTS ];
729	void getPointLightInfo( const in PointLight pointLight, const in vec3 geometryPosition, out IncidentLight light ) {
730		vec3 lVector = pointLight.position - geometryPosition;
731		light.direction = normalize( lVector );
732		float lightDistance = length( lVector );
733		light.color = pointLight.color;
734		light.color *= getDistanceAttenuation( lightDistance, pointLight.distance, pointLight.decay );
735		light.visible = ( light.color != vec3( 0.0 ) );
736	}
737#endif
738#if NUM_SPOT_LIGHTS > 0
739	struct SpotLight {
740		vec3 position;
741		vec3 direction;
742		vec3 color;
743		float distance;
744		float decay;
745		float coneCos;
746		float penumbraCos;
747	};
748	uniform SpotLight spotLights[ NUM_SPOT_LIGHTS ];
749	void getSpotLightInfo( const in SpotLight spotLight, const in vec3 geometryPosition, out IncidentLight light ) {
750		vec3 lVector = spotLight.position - geometryPosition;
751		light.direction = normalize( lVector );
752		float angleCos = dot( light.direction, spotLight.direction );
753		float spotAttenuation = getSpotAttenuation( spotLight.coneCos, spotLight.penumbraCos, angleCos );
754		if ( spotAttenuation > 0.0 ) {
755			float lightDistance = length( lVector );
756			light.color = spotLight.color * spotAttenuation;
757			light.color *= getDistanceAttenuation( lightDistance, spotLight.distance, spotLight.decay );
758			light.visible = ( light.color != vec3( 0.0 ) );
759		} else {
760			light.color = vec3( 0.0 );
761			light.visible = false;
762		}
763	}
764#endif
765#if NUM_RECT_AREA_LIGHTS > 0
766	struct RectAreaLight {
767		vec3 color;
768		vec3 position;
769		vec3 halfWidth;
770		vec3 halfHeight;
771	};
772	uniform sampler2D ltc_1;	uniform sampler2D ltc_2;
773	uniform RectAreaLight rectAreaLights[ NUM_RECT_AREA_LIGHTS ];
774#endif
775#if NUM_HEMI_LIGHTS > 0
776	struct HemisphereLight {
777		vec3 direction;
778		vec3 skyColor;
779		vec3 groundColor;
780	};
781	uniform HemisphereLight hemisphereLights[ NUM_HEMI_LIGHTS ];
782	vec3 getHemisphereLightIrradiance( const in HemisphereLight hemiLight, const in vec3 normal ) {
783		float dotNL = dot( normal, hemiLight.direction );
784		float hemiDiffuseWeight = 0.5 * dotNL + 0.5;
785		vec3 irradiance = mix( hemiLight.groundColor, hemiLight.skyColor, hemiDiffuseWeight );
786		return irradiance;
787	}
788#endif`,mg=`#ifdef USE_ENVMAP
789	vec3 getIBLIrradiance( const in vec3 normal ) {
790		#ifdef ENVMAP_TYPE_CUBE_UV
791			vec3 worldNormal = inverseTransformDirection( normal, viewMatrix );
792			vec4 envMapColor = textureCubeUV( envMap, envMapRotation * worldNormal, 1.0 );
793			return PI * envMapColor.rgb * envMapIntensity;
794		#else
795			return vec3( 0.0 );
796		#endif
797	}
798	vec3 getIBLRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness ) {
799		#ifdef ENVMAP_TYPE_CUBE_UV
800			vec3 reflectVec = reflect( - viewDir, normal );
801			reflectVec = normalize( mix( reflectVec, normal, roughness * roughness) );
802			reflectVec = inverseTransformDirection( reflectVec, viewMatrix );
803			vec4 envMapColor = textureCubeUV( envMap, envMapRotation * reflectVec, roughness );
804			return envMapColor.rgb * envMapIntensity;
805		#else
806			return vec3( 0.0 );
807		#endif
808	}
809	#ifdef USE_ANISOTROPY
810		vec3 getIBLAnisotropyRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness, const in vec3 bitangent, const in float anisotropy ) {
811			#ifdef ENVMAP_TYPE_CUBE_UV
812				vec3 bentNormal = cross( bitangent, viewDir );
813				bentNormal = normalize( cross( bentNormal, bitangent ) );
814				bentNormal = normalize( mix( bentNormal, normal, pow2( pow2( 1.0 - anisotropy * ( 1.0 - roughness ) ) ) ) );
815				return getIBLRadiance( viewDir, bentNormal, roughness );
816			#else
817				return vec3( 0.0 );
818			#endif
819		}
820	#endif
821#endif`,gg=`ToonMaterial material;
822material.diffuseColor = diffuseColor.rgb;`,_g=`varying vec3 vViewPosition;
823struct ToonMaterial {
824	vec3 diffuseColor;
825};
826void RE_Direct_Toon( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in ToonMaterial material, inout ReflectedLight reflectedLight ) {
827	vec3 irradiance = getGradientIrradiance( geometryNormal, directLight.direction ) * directLight.color;
828	reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
829}
830void RE_IndirectDiffuse_Toon( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in ToonMaterial material, inout ReflectedLight reflectedLight ) {
831	reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
832}
833#define RE_Direct				RE_Direct_Toon
834#define RE_IndirectDiffuse		RE_IndirectDiffuse_Toon`,xg=`BlinnPhongMaterial material;
835material.diffuseColor = diffuseColor.rgb;
836material.specularColor = specular;
837material.specularShininess = shininess;
838material.specularStrength = specularStrength;`,vg=`varying vec3 vViewPosition;
839struct BlinnPhongMaterial {
840	vec3 diffuseColor;
841	vec3 specularColor;
842	float specularShininess;
843	float specularStrength;
844};
845void RE_Direct_BlinnPhong( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {
846	float dotNL = saturate( dot( geometryNormal, directLight.direction ) );
847	vec3 irradiance = dotNL * directLight.color;
848	reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
849	reflectedLight.directSpecular += irradiance * BRDF_BlinnPhong( directLight.direction, geometryViewDir, geometryNormal, material.specularColor, material.specularShininess ) * material.specularStrength;
850}
851void RE_IndirectDiffuse_BlinnPhong( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {
852	reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
853}
854#define RE_Direct				RE_Direct_BlinnPhong
855#define RE_IndirectDiffuse		RE_IndirectDiffuse_BlinnPhong`,yg=`PhysicalMaterial material;
856material.diffuseColor = diffuseColor.rgb * ( 1.0 - metalnessFactor );
857vec3 dxy = max( abs( dFdx( nonPerturbedNormal ) ), abs( dFdy( nonPerturbedNormal ) ) );
858float geometryRoughness = max( max( dxy.x, dxy.y ), dxy.z );
859material.roughness = max( roughnessFactor, 0.0525 );material.roughness += geometryRoughness;
860material.roughness = min( material.roughness, 1.0 );
861#ifdef IOR
862	material.ior = ior;
863	#ifdef USE_SPECULAR
864		float specularIntensityFactor = specularIntensity;
865		vec3 specularColorFactor = specularColor;
866		#ifdef USE_SPECULAR_COLORMAP
867			specularColorFactor *= texture2D( specularColorMap, vSpecularColorMapUv ).rgb;
868		#endif
869		#ifdef USE_SPECULAR_INTENSITYMAP
870			specularIntensityFactor *= texture2D( specularIntensityMap, vSpecularIntensityMapUv ).a;
871		#endif
872		material.specularF90 = mix( specularIntensityFactor, 1.0, metalnessFactor );
873	#else
874		float specularIntensityFactor = 1.0;
875		vec3 specularColorFactor = vec3( 1.0 );
876		material.specularF90 = 1.0;
877	#endif
878	material.specularColor = mix( min( pow2( ( material.ior - 1.0 ) / ( material.ior + 1.0 ) ) * specularColorFactor, vec3( 1.0 ) ) * specularIntensityFactor, diffuseColor.rgb, metalnessFactor );
879#else
880	material.specularColor = mix( vec3( 0.04 ), diffuseColor.rgb, metalnessFactor );
881	material.specularF90 = 1.0;
882#endif
883#ifdef USE_CLEARCOAT
884	material.clearcoat = clearcoat;
885	material.clearcoatRoughness = clearcoatRoughness;
886	material.clearcoatF0 = vec3( 0.04 );
887	material.clearcoatF90 = 1.0;
888	#ifdef USE_CLEARCOATMAP
889		material.clearcoat *= texture2D( clearcoatMap, vClearcoatMapUv ).x;
890	#endif
891	#ifdef USE_CLEARCOAT_ROUGHNESSMAP
892		material.clearcoatRoughness *= texture2D( clearcoatRoughnessMap, vClearcoatRoughnessMapUv ).y;
893	#endif
894	material.clearcoat = saturate( material.clearcoat );	material.clearcoatRoughness = max( material.clearcoatRoughness, 0.0525 );
895	material.clearcoatRoughness += geometryRoughness;
896	material.clearcoatRoughness = min( material.clearcoatRoughness, 1.0 );
897#endif
898#ifdef USE_DISPERSION
899	material.dispersion = dispersion;
900#endif
901#ifdef USE_IRIDESCENCE
902	material.iridescence = iridescence;
903	material.iridescenceIOR = iridescenceIOR;
904	#ifdef USE_IRIDESCENCEMAP
905		material.iridescence *= texture2D( iridescenceMap, vIridescenceMapUv ).r;
906	#endif
907	#ifdef USE_IRIDESCENCE_THICKNESSMAP
908		material.iridescenceThickness = (iridescenceThicknessMaximum - iridescenceThicknessMinimum) * texture2D( iridescenceThicknessMap, vIridescenceThicknessMapUv ).g + iridescenceThicknessMinimum;
909	#else
910		material.iridescenceThickness = iridescenceThicknessMaximum;
911	#endif
912#endif
913#ifdef USE_SHEEN
914	material.sheenColor = sheenColor;
915	#ifdef USE_SHEEN_COLORMAP
916		material.sheenColor *= texture2D( sheenColorMap, vSheenColorMapUv ).rgb;
917	#endif
918	material.sheenRoughness = clamp( sheenRoughness, 0.07, 1.0 );
919	#ifdef USE_SHEEN_ROUGHNESSMAP
920		material.sheenRoughness *= texture2D( sheenRoughnessMap, vSheenRoughnessMapUv ).a;
921	#endif
922#endif
923#ifdef USE_ANISOTROPY
924	#ifdef USE_ANISOTROPYMAP
925		mat2 anisotropyMat = mat2( anisotropyVector.x, anisotropyVector.y, - anisotropyVector.y, anisotropyVector.x );
926		vec3 anisotropyPolar = texture2D( anisotropyMap, vAnisotropyMapUv ).rgb;
927		vec2 anisotropyV = anisotropyMat * normalize( 2.0 * anisotropyPolar.rg - vec2( 1.0 ) ) * anisotropyPolar.b;
928	#else
929		vec2 anisotropyV = anisotropyVector;
930	#endif
931	material.anisotropy = length( anisotropyV );
932	if( material.anisotropy == 0.0 ) {
933		anisotropyV = vec2( 1.0, 0.0 );
934	} else {
935		anisotropyV /= material.anisotropy;
936		material.anisotropy = saturate( material.anisotropy );
937	}
938	material.alphaT = mix( pow2( material.roughness ), 1.0, pow2( material.anisotropy ) );
939	material.anisotropyT = tbn[ 0 ] * anisotropyV.x + tbn[ 1 ] * anisotropyV.y;
940	material.anisotropyB = tbn[ 1 ] * anisotropyV.x - tbn[ 0 ] * anisotropyV.y;
941#endif`,Mg
vendor: 14,687 bytes, lines 941-1242
941=`struct PhysicalMaterial {
942	vec3 diffuseColor;
943	float roughness;
944	vec3 specularColor;
945	float specularF90;
946	float dispersion;
947	#ifdef USE_CLEARCOAT
948		float clearcoat;
949		float clearcoatRoughness;
950		vec3 clearcoatF0;
951		float clearcoatF90;
952	#endif
953	#ifdef USE_IRIDESCENCE
954		float iridescence;
955		float iridescenceIOR;
956		float iridescenceThickness;
957		vec3 iridescenceFresnel;
958		vec3 iridescenceF0;
959	#endif
960	#ifdef USE_SHEEN
961		vec3 sheenColor;
962		float sheenRoughness;
963	#endif
964	#ifdef IOR
965		float ior;
966	#endif
967	#ifdef USE_TRANSMISSION
968		float transmission;
969		float transmissionAlpha;
970		float thickness;
971		float attenuationDistance;
972		vec3 attenuationColor;
973	#endif
974	#ifdef USE_ANISOTROPY
975		float anisotropy;
976		float alphaT;
977		vec3 anisotropyT;
978		vec3 anisotropyB;
979	#endif
980};
981vec3 clearcoatSpecularDirect = vec3( 0.0 );
982vec3 clearcoatSpecularIndirect = vec3( 0.0 );
983vec3 sheenSpecularDirect = vec3( 0.0 );
984vec3 sheenSpecularIndirect = vec3(0.0 );
985vec3 Schlick_to_F0( const in vec3 f, const in float f90, const in float dotVH ) {
986    float x = clamp( 1.0 - dotVH, 0.0, 1.0 );
987    float x2 = x * x;
988    float x5 = clamp( x * x2 * x2, 0.0, 0.9999 );
989    return ( f - vec3( f90 ) * x5 ) / ( 1.0 - x5 );
990}
991float V_GGX_SmithCorrelated( const in float alpha, const in float dotNL, const in float dotNV ) {
992	float a2 = pow2( alpha );
993	float gv = dotNL * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNV ) );
994	float gl = dotNV * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNL ) );
995	return 0.5 / max( gv + gl, EPSILON );
996}
997float D_GGX( const in float alpha, const in float dotNH ) {
998	float a2 = pow2( alpha );
999	float denom = pow2( dotNH ) * ( a2 - 1.0 ) + 1.0;
1000	return RECIPROCAL_PI * a2 / pow2( denom );
1001}
1002#ifdef USE_ANISOTROPY
1003	float V_GGX_SmithCorrelated_Anisotropic( const in float alphaT, const in float alphaB, const in float dotTV, const in float dotBV, const in float dotTL, const in float dotBL, const in float dotNV, const in float dotNL ) {
1004		float gv = dotNL * length( vec3( alphaT * dotTV, alphaB * dotBV, dotNV ) );
1005		float gl = dotNV * length( vec3( alphaT * dotTL, alphaB * dotBL, dotNL ) );
1006		float v = 0.5 / ( gv + gl );
1007		return saturate(v);
1008	}
1009	float D_GGX_Anisotropic( const in float alphaT, const in float alphaB, const in float dotNH, const in float dotTH, const in float dotBH ) {
1010		float a2 = alphaT * alphaB;
1011		highp vec3 v = vec3( alphaB * dotTH, alphaT * dotBH, a2 * dotNH );
1012		highp float v2 = dot( v, v );
1013		float w2 = a2 / v2;
1014		return RECIPROCAL_PI * a2 * pow2 ( w2 );
1015	}
1016#endif
1017#ifdef USE_CLEARCOAT
1018	vec3 BRDF_GGX_Clearcoat( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in PhysicalMaterial material) {
1019		vec3 f0 = material.clearcoatF0;
1020		float f90 = material.clearcoatF90;
1021		float roughness = material.clearcoatRoughness;
1022		float alpha = pow2( roughness );
1023		vec3 halfDir = normalize( lightDir + viewDir );
1024		float dotNL = saturate( dot( normal, lightDir ) );
1025		float dotNV = saturate( dot( normal, viewDir ) );
1026		float dotNH = saturate( dot( normal, halfDir ) );
1027		float dotVH = saturate( dot( viewDir, halfDir ) );
1028		vec3 F = F_Schlick( f0, f90, dotVH );
1029		float V = V_GGX_SmithCorrelated( alpha, dotNL, dotNV );
1030		float D = D_GGX( alpha, dotNH );
1031		return F * ( V * D );
1032	}
1033#endif
1034vec3 BRDF_GGX( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in PhysicalMaterial material ) {
1035	vec3 f0 = material.specularColor;
1036	float f90 = material.specularF90;
1037	float roughness = material.roughness;
1038	float alpha = pow2( roughness );
1039	vec3 halfDir = normalize( lightDir + viewDir );
1040	float dotNL = saturate( dot( normal, lightDir ) );
1041	float dotNV = saturate( dot( normal, viewDir ) );
1042	float dotNH = saturate( dot( normal, halfDir ) );
1043	float dotVH = saturate( dot( viewDir, halfDir ) );
1044	vec3 F = F_Schlick( f0, f90, dotVH );
1045	#ifdef USE_IRIDESCENCE
1046		F = mix( F, material.iridescenceFresnel, material.iridescence );
1047	#endif
1048	#ifdef USE_ANISOTROPY
1049		float dotTL = dot( material.anisotropyT, lightDir );
1050		float dotTV = dot( material.anisotropyT, viewDir );
1051		float dotTH = dot( material.anisotropyT, halfDir );
1052		float dotBL = dot( material.anisotropyB, lightDir );
1053		float dotBV = dot( material.anisotropyB, viewDir );
1054		float dotBH = dot( material.anisotropyB, halfDir );
1055		float V = V_GGX_SmithCorrelated_Anisotropic( material.alphaT, alpha, dotTV, dotBV, dotTL, dotBL, dotNV, dotNL );
1056		float D = D_GGX_Anisotropic( material.alphaT, alpha, dotNH, dotTH, dotBH );
1057	#else
1058		float V = V_GGX_SmithCorrelated( alpha, dotNL, dotNV );
1059		float D = D_GGX( alpha, dotNH );
1060	#endif
1061	return F * ( V * D );
1062}
1063vec2 LTC_Uv( const in vec3 N, const in vec3 V, const in float roughness ) {
1064	const float LUT_SIZE = 64.0;
1065	const float LUT_SCALE = ( LUT_SIZE - 1.0 ) / LUT_SIZE;
1066	const float LUT_BIAS = 0.5 / LUT_SIZE;
1067	float dotNV = saturate( dot( N, V ) );
1068	vec2 uv = vec2( roughness, sqrt( 1.0 - dotNV ) );
1069	uv = uv * LUT_SCALE + LUT_BIAS;
1070	return uv;
1071}
1072float LTC_ClippedSphereFormFactor( const in vec3 f ) {
1073	float l = length( f );
1074	return max( ( l * l + f.z ) / ( l + 1.0 ), 0.0 );
1075}
1076vec3 LTC_EdgeVectorFormFactor( const in vec3 v1, const in vec3 v2 ) {
1077	float x = dot( v1, v2 );
1078	float y = abs( x );
1079	float a = 0.8543985 + ( 0.4965155 + 0.0145206 * y ) * y;
1080	float b = 3.4175940 + ( 4.1616724 + y ) * y;
1081	float v = a / b;
1082	float theta_sintheta = ( x > 0.0 ) ? v : 0.5 * inversesqrt( max( 1.0 - x * x, 1e-7 ) ) - v;
1083	return cross( v1, v2 ) * theta_sintheta;
1084}
1085vec3 LTC_Evaluate( const in vec3 N, const in vec3 V, const in vec3 P, const in mat3 mInv, const in vec3 rectCoords[ 4 ] ) {
1086	vec3 v1 = rectCoords[ 1 ] - rectCoords[ 0 ];
1087	vec3 v2 = rectCoords[ 3 ] - rectCoords[ 0 ];
1088	vec3 lightNormal = cross( v1, v2 );
1089	if( dot( lightNormal, P - rectCoords[ 0 ] ) < 0.0 ) return vec3( 0.0 );
1090	vec3 T1, T2;
1091	T1 = normalize( V - N * dot( V, N ) );
1092	T2 = - cross( N, T1 );
1093	mat3 mat = mInv * transposeMat3( mat3( T1, T2, N ) );
1094	vec3 coords[ 4 ];
1095	coords[ 0 ] = mat * ( rectCoords[ 0 ] - P );
1096	coords[ 1 ] = mat * ( rectCoords[ 1 ] - P );
1097	coords[ 2 ] = mat * ( rectCoords[ 2 ] - P );
1098	coords[ 3 ] = mat * ( rectCoords[ 3 ] - P );
1099	coords[ 0 ] = normalize( coords[ 0 ] );
1100	coords[ 1 ] = normalize( coords[ 1 ] );
1101	coords[ 2 ] = normalize( coords[ 2 ] );
1102	coords[ 3 ] = normalize( coords[ 3 ] );
1103	vec3 vectorFormFactor = vec3( 0.0 );
1104	vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 0 ], coords[ 1 ] );
1105	vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 1 ], coords[ 2 ] );
1106	vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 2 ], coords[ 3 ] );
1107	vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 3 ], coords[ 0 ] );
1108	float result = LTC_ClippedSphereFormFactor( vectorFormFactor );
1109	return vec3( result );
1110}
1111#if defined( USE_SHEEN )
1112float D_Charlie( float roughness, float dotNH ) {
1113	float alpha = pow2( roughness );
1114	float invAlpha = 1.0 / alpha;
1115	float cos2h = dotNH * dotNH;
1116	float sin2h = max( 1.0 - cos2h, 0.0078125 );
1117	return ( 2.0 + invAlpha ) * pow( sin2h, invAlpha * 0.5 ) / ( 2.0 * PI );
1118}
1119float V_Neubelt( float dotNV, float dotNL ) {
1120	return saturate( 1.0 / ( 4.0 * ( dotNL + dotNV - dotNL * dotNV ) ) );
1121}
1122vec3 BRDF_Sheen( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, vec3 sheenColor, const in float sheenRoughness ) {
1123	vec3 halfDir = normalize( lightDir + viewDir );
1124	float dotNL = saturate( dot( normal, lightDir ) );
1125	float dotNV = saturate( dot( normal, viewDir ) );
1126	float dotNH = saturate( dot( normal, halfDir ) );
1127	float D = D_Charlie( sheenRoughness, dotNH );
1128	float V = V_Neubelt( dotNV, dotNL );
1129	return sheenColor * ( D * V );
1130}
1131#endif
1132float IBLSheenBRDF( const in vec3 normal, const in vec3 viewDir, const in float roughness ) {
1133	float dotNV = saturate( dot( normal, viewDir ) );
1134	float r2 = roughness * roughness;
1135	float a = roughness < 0.25 ? -339.2 * r2 + 161.4 * roughness - 25.9 : -8.48 * r2 + 14.3 * roughness - 9.95;
1136	float b = roughness < 0.25 ? 44.0 * r2 - 23.7 * roughness + 3.26 : 1.97 * r2 - 3.27 * roughness + 0.72;
1137	float DG = exp( a * dotNV + b ) + ( roughness < 0.25 ? 0.0 : 0.1 * ( roughness - 0.25 ) );
1138	return saturate( DG * RECIPROCAL_PI );
1139}
1140vec2 DFGApprox( const in vec3 normal, const in vec3 viewDir, const in float roughness ) {
1141	float dotNV = saturate( dot( normal, viewDir ) );
1142	const vec4 c0 = vec4( - 1, - 0.0275, - 0.572, 0.022 );
1143	const vec4 c1 = vec4( 1, 0.0425, 1.04, - 0.04 );
1144	vec4 r = roughness * c0 + c1;
1145	float a004 = min( r.x * r.x, exp2( - 9.28 * dotNV ) ) * r.x + r.y;
1146	vec2 fab = vec2( - 1.04, 1.04 ) * a004 + r.zw;
1147	return fab;
1148}
1149vec3 EnvironmentBRDF( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float roughness ) {
1150	vec2 fab = DFGApprox( normal, viewDir, roughness );
1151	return specularColor * fab.x + specularF90 * fab.y;
1152}
1153#ifdef USE_IRIDESCENCE
1154void 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 ) {
1155#else
1156void 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 ) {
1157#endif
1158	vec2 fab = DFGApprox( normal, viewDir, roughness );
1159	#ifdef USE_IRIDESCENCE
1160		vec3 Fr = mix( specularColor, iridescenceF0, iridescence );
1161	#else
1162		vec3 Fr = specularColor;
1163	#endif
1164	vec3 FssEss = Fr * fab.x + specularF90 * fab.y;
1165	float Ess = fab.x + fab.y;
1166	float Ems = 1.0 - Ess;
1167	vec3 Favg = Fr + ( 1.0 - Fr ) * 0.047619;	vec3 Fms = FssEss * Favg / ( 1.0 - Ems * Favg );
1168	singleScatter += FssEss;
1169	multiScatter += Fms * Ems;
1170}
1171#if NUM_RECT_AREA_LIGHTS > 0
1172	void RE_Direct_RectArea_Physical( const in RectAreaLight rectAreaLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {
1173		vec3 normal = geometryNormal;
1174		vec3 viewDir = geometryViewDir;
1175		vec3 position = geometryPosition;
1176		vec3 lightPos = rectAreaLight.position;
1177		vec3 halfWidth = rectAreaLight.halfWidth;
1178		vec3 halfHeight = rectAreaLight.halfHeight;
1179		vec3 lightColor = rectAreaLight.color;
1180		float roughness = material.roughness;
1181		vec3 rectCoords[ 4 ];
1182		rectCoords[ 0 ] = lightPos + halfWidth - halfHeight;		rectCoords[ 1 ] = lightPos - halfWidth - halfHeight;
1183		rectCoords[ 2 ] = lightPos - halfWidth + halfHeight;
1184		rectCoords[ 3 ] = lightPos + halfWidth + halfHeight;
1185		vec2 uv = LTC_Uv( normal, viewDir, roughness );
1186		vec4 t1 = texture2D( ltc_1, uv );
1187		vec4 t2 = texture2D( ltc_2, uv );
1188		mat3 mInv = mat3(
1189			vec3( t1.x, 0, t1.y ),
1190			vec3(    0, 1,    0 ),
1191			vec3( t1.z, 0, t1.w )
1192		);
1193		vec3 fresnel = ( material.specularColor * t2.x + ( vec3( 1.0 ) - material.specularColor ) * t2.y );
1194		reflectedLight.directSpecular += lightColor * fresnel * LTC_Evaluate( normal, viewDir, position, mInv, rectCoords );
1195		reflectedLight.directDiffuse += lightColor * material.diffuseColor * LTC_Evaluate( normal, viewDir, position, mat3( 1.0 ), rectCoords );
1196	}
1197#endif
1198void RE_Direct_Physical( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {
1199	float dotNL = saturate( dot( geometryNormal, directLight.direction ) );
1200	vec3 irradiance = dotNL * directLight.color;
1201	#ifdef USE_CLEARCOAT
1202		float dotNLcc = saturate( dot( geometryClearcoatNormal, directLight.direction ) );
1203		vec3 ccIrradiance = dotNLcc * directLight.color;
1204		clearcoatSpecularDirect += ccIrradiance * BRDF_GGX_Clearcoat( directLight.direction, geometryViewDir, geometryClearcoatNormal, material );
1205	#endif
1206	#ifdef USE_SHEEN
1207		sheenSpecularDirect += irradiance * BRDF_Sheen( directLight.direction, geometryViewDir, geometryNormal, material.sheenColor, material.sheenRoughness );
1208	#endif
1209	reflectedLight.directSpecular += irradiance * BRDF_GGX( directLight.direction, geometryViewDir, geometryNormal, material );
1210	reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
1211}
1212void RE_IndirectDiffuse_Physical( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {
1213	reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
1214}
1215void RE_IndirectSpecular_Physical( const in vec3 radiance, const in vec3 irradiance, const in vec3 clearcoatRadiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight) {
1216	#ifdef USE_CLEARCOAT
1217		clearcoatSpecularIndirect += clearcoatRadiance * EnvironmentBRDF( geometryClearcoatNormal, geometryViewDir, material.clearcoatF0, material.clearcoatF90, material.clearcoatRoughness );
1218	#endif
1219	#ifdef USE_SHEEN
1220		sheenSpecularIndirect += irradiance * material.sheenColor * IBLSheenBRDF( geometryNormal, geometryViewDir, material.sheenRoughness );
1221	#endif
1222	vec3 singleScattering = vec3( 0.0 );
1223	vec3 multiScattering = vec3( 0.0 );
1224	vec3 cosineWeightedIrradiance = irradiance * RECIPROCAL_PI;
1225	#ifdef USE_IRIDESCENCE
1226		computeMultiscatteringIridescence( geometryNormal, geometryViewDir, material.specularColor, material.specularF90, material.iridescence, material.iridescenceFresnel, material.roughness, singleScattering, multiScattering );
1227	#else
1228		computeMultiscattering( geometryNormal, geometryViewDir, material.specularColor, material.specularF90, material.roughness, singleScattering, multiScattering );
1229	#endif
1230	vec3 totalScattering = singleScattering + multiScattering;
1231	vec3 diffuse = material.diffuseColor * ( 1.0 - max( max( totalScattering.r, totalScattering.g ), totalScattering.b ) );
1232	reflectedLight.indirectSpecular += radiance * singleScattering;
1233	reflectedLight.indirectSpecular += multiScattering * cosineWeightedIrradiance;
1234	reflectedLight.indirectDiffuse += diffuse * cosineWeightedIrradiance;
1235}
1236#define RE_Direct				RE_Direct_Physical
1237#define RE_Direct_RectArea		RE_Direct_RectArea_Physical
1238#define RE_IndirectDiffuse		RE_IndirectDiffuse_Physical
1239#define RE_IndirectSpecular		RE_IndirectSpecular_Physical
1240float computeSpecularOcclusion( const in float dotNV, const in float ambientOcclusion, const in float roughness ) {
1241	return saturate( pow( dotNV + ambientOcclusion, exp2( - 16.0 * roughness - 1.0 ) ) - 1.0 + ambientOcclusion );
1242}`,
1242Sg=`
1243vec3 geometryPosition = - vViewPosition;
1244vec3 geometryNormal = normal;
1245vec3 geometryViewDir = ( isOrthographic ) ? vec3( 0, 0, 1 ) : normalize( vViewPosition );
1246vec3 geometryClearcoatNormal = vec3( 0.0 );
1247#ifdef USE_CLEARCOAT
1248	geometryClearcoatNormal = clearcoatNormal;
1249#endif
1250#ifdef USE_IRIDESCENCE
1251	float dotNVi = saturate( dot( normal, geometryViewDir ) );
1252	if ( material.iridescenceThickness == 0.0 ) {
1253		material.iridescence = 0.0;
1254	} else {
1255		material.iridescence = saturate( material.iridescence );
1256	}
1257	if ( material.iridescence > 0.0 ) {
1258		material.iridescenceFresnel = evalIridescence( 1.0, material.iridescenceIOR, dotNVi, material.iridescenceThickness, material.specularColor );
1259		material.iridescenceF0 = Schlick_to_F0( material.iridescenceFresnel, 1.0, dotNVi );
1260	}
1261#endif
1262IncidentLight directLight;
1263#if ( NUM_POINT_LIGHTS > 0 ) && defined( RE_Direct )
1264	PointLight pointLight;
1265	#if defined( USE_SHADOWMAP ) && NUM_POINT_LIGHT_SHADOWS > 0
1266	PointLightShadow pointLightShadow;
1267	#endif
1268	#pragma unroll_loop_start
1269	for ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {
1270		pointLight = pointLights[ i ];
1271		getPointLightInfo( pointLight, geometryPosition, directLight );
1272		#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_POINT_LIGHT_SHADOWS )
1273		pointLightShadow = pointLightShadows[ i ];
1274		directLight.color *= ( directLight.visible && receiveShadow ) ? getPointShadow( pointShadowMap[ i ], pointLightShadow.shadowMapSize, pointLightShadow.shadowIntensity, pointLightShadow.shadowBias, pointLightShadow.shadowRadius, vPointShadowCoord[ i ], pointLightShadow.shadowCameraNear, pointLightShadow.shadowCameraFar ) : 1.0;
1275		#endif
1276		RE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );
1277	}
1278	#pragma unroll_loop_end
1279#endif
1280#if ( NUM_SPOT_LIGHTS > 0 ) && defined( RE_Direct )
1281	SpotLight spotLight;
1282	vec4 spotColor;
1283	vec3 spotLightCoord;
1284	bool inSpotLightMap;
1285	#if defined( USE_SHADOWMAP ) && NUM_SPOT_LIGHT_SHADOWS > 0
1286	SpotLightShadow spotLightShadow;
1287	#endif
1288	#pragma unroll_loop_start
1289	for ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {
1290		spotLight = spotLights[ i ];
1291		getSpotLightInfo( spotLight, geometryPosition, directLight );
1292		#if ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS )
1293		#define SPOT_LIGHT_MAP_INDEX UNROLLED_LOOP_INDEX
1294		#elif ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )
1295		#define SPOT_LIGHT_MAP_INDEX NUM_SPOT_LIGHT_MAPS
1296		#else
1297		#define SPOT_LIGHT_MAP_INDEX ( UNROLLED_LOOP_INDEX - NUM_SPOT_LIGHT_SHADOWS + NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS )
1298		#endif
1299		#if ( SPOT_LIGHT_MAP_INDEX < NUM_SPOT_LIGHT_MAPS )
1300			spotLightCoord = vSpotLightCoord[ i ].xyz / vSpotLightCoord[ i ].w;
1301			inSpotLightMap = all( lessThan( abs( spotLightCoord * 2. - 1. ), vec3( 1.0 ) ) );
1302			spotColor = texture2D( spotLightMap[ SPOT_LIGHT_MAP_INDEX ], spotLightCoord.xy );
1303			directLight.color = inSpotLightMap ? directLight.color * spotColor.rgb : directLight.color;
1304		#endif
1305		#undef SPOT_LIGHT_MAP_INDEX
1306		#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )
1307		spotLightShadow = spotLightShadows[ i ];
1308		directLight.color *= ( directLight.visible && receiveShadow ) ? getShadow( spotShadowMap[ i ], spotLightShadow.shadowMapSize, spotLightShadow.shadowIntensity, spotLightShadow.shadowBias, spotLightShadow.shadowRadius, vSpotLightCoord[ i ] ) : 1.0;
1309		#endif
1310		RE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );
1311	}
1312	#pragma unroll_loop_end
1313#endif
1314#if ( NUM_DIR_LIGHTS > 0 ) && defined( RE_Direct )
1315	DirectionalLight directionalLight;
1316	#if defined( USE_SHADOWMAP ) && NUM_DIR_LIGHT_SHADOWS > 0
1317	DirectionalLightShadow directionalLightShadow;
1318	#endif
1319	#pragma unroll_loop_start
1320	for ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {
1321		directionalLight = directionalLights[ i ];
1322		getDirectionalLightInfo( directionalLight, directLight );
1323		#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_DIR_LIGHT_SHADOWS )
1324		directionalLightShadow = directionalLightShadows[ i ];
1325		directLight.color *= ( directLight.visible && receiveShadow ) ? getShadow( directionalShadowMap[ i ], directionalLightShadow.shadowMapSize, directionalLightShadow.shadowIntensity, directionalLightShadow.shadowBias, directionalLightShadow.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;
1326		#endif
1327		RE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );
1328	}
1329	#pragma unroll_loop_end
1330#endif
1331#if ( NUM_RECT_AREA_LIGHTS > 0 ) && defined( RE_Direct_RectArea )
1332	RectAreaLight rectAreaLight;
1333	#pragma unroll_loop_start
1334	for ( int i = 0; i < NUM_RECT_AREA_LIGHTS; i ++ ) {
1335		rectAreaLight = rectAreaLights[ i ];
1336		RE_Direct_RectArea( rectAreaLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );
1337	}
1338	#pragma unroll_loop_end
1339#endif
1340#if defined( RE_IndirectDiffuse )
1341	vec3 iblIrradiance = vec3( 0.0 );
1342	vec3 irradiance = getAmbientLightIrradiance( ambientLightColor );
1343	#if defined( USE_LIGHT_PROBES )
1344		irradiance += getLightProbeIrradiance( lightProbe, geometryNormal );
1345	#endif
1346	#if ( NUM_HEMI_LIGHTS > 0 )
1347		#pragma unroll_loop_start
1348		for ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) {
1349			irradiance += getHemisphereLightIrradiance( hemisphereLights[ i ], geometryNormal );
1350		}
1351		#pragma unroll_loop_end
1352	#endif
1353#endif
1354#if defined( RE_IndirectSpecular )
1355	vec3 radiance = vec3( 0.0 );
1356	vec3 clearcoatRadiance = vec3( 0.0 );
1357#endif`,bg=`#if defined( RE_IndirectDiffuse )
1358	#ifdef USE_LIGHTMAP
1359		vec4 lightMapTexel = texture2D( lightMap, vLightMapUv );
1360		vec3 lightMapIrradiance = lightMapTexel.rgb * lightMapIntensity;
1361		irradiance += lightMapIrradiance;
1362	#endif
1363	#if defined( USE_ENVMAP ) && defined( STANDARD ) && defined( ENVMAP_TYPE_CUBE_UV )
1364		iblIrradiance += getIBLIrradiance( geometryNormal );
1365	#endif
1366#endif
1367#if defined( USE_ENVMAP ) && defined( RE_IndirectSpecular )
1368	#ifdef USE_ANISOTROPY
1369		radiance += getIBLAnisotropyRadiance( geometryViewDir, geometryNormal, material.roughness, material.anisotropyB, material.anisotropy );
1370	#else
1371		radiance += getIBLRadiance( geometryViewDir, geometryNormal, material.roughness );
1372	#endif
1373	#ifdef USE_CLEARCOAT
1374		clearcoatRadiance += getIBLRadiance( geometryViewDir, geometryClearcoatNormal, material.clearcoatRoughness );
1375	#endif
1376#endif`,Eg=`#if defined( RE_IndirectDiffuse )
1377	RE_IndirectDiffuse( irradiance, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );
1378#endif
1379#if defined( RE_IndirectSpecular )
1380	RE_IndirectSpecular( radiance, iblIrradiance, clearcoatRadiance, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );
1381#endif`,Tg=`#if defined( USE_LOGDEPTHBUF )
1382	gl_FragDepth = vIsPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;
1383#endif`,Ag=`#if defined( USE_LOGDEPTHBUF )
1384	uniform float logDepthBufFC;
1385	varying float vFragDepth;
1386	varying float vIsPerspective;
1387#endif`,wg=`#ifdef USE_LOGDEPTHBUF
1388	varying float vFragDepth;
1389	varying float vIsPerspective;
1390#endif`,Cg=`#ifdef USE_LOGDEPTHBUF
1391	vFragDepth = 1.0 + gl_Position.w;
1392	vIsPerspective = float( isPerspectiveMatrix( projectionMatrix ) );
1393#endif`,Rg=`#ifdef USE_MAP
1394	vec4 sampledDiffuseColor = texture2D( map, vMapUv );
1395	#ifdef DECODE_VIDEO_TEXTURE
1396		sampledDiffuseColor = sRGBTransferEOTF( sampledDiffuseColor );
1397	#endif
1398	diffuseColor *= sampledDiffuseColor;
1399#endif`,Ig=`#ifdef USE_MAP
1400	uniform sampler2D map;
1401#endif`,Pg=`#if defined( USE_MAP ) || defined( USE_ALPHAMAP )
1402	#if defined( USE_POINTS_UV )
1403		vec2 uv = vUv;
1404	#else
1405		vec2 uv = ( uvTransform * vec3( gl_PointCoord.x, 1.0 - gl_PointCoord.y, 1 ) ).xy;
1406	#endif
1407#endif
1408#ifdef USE_MAP
1409	diffuseColor *= texture2D( map, uv );
1410#endif
1411#ifdef USE_ALPHAMAP
1412	diffuseColor.a *= texture2D( alphaMap, uv ).g;
1413#endif`,Lg=`#if defined( USE_POINTS_UV )
1414	varying vec2 vUv;
1415#else
1416	#if defined( USE_MAP ) || defined( USE_ALPHAMAP )
1417		uniform mat3 uvTransform;
1418	#endif
1419#endif
1420#ifdef USE_MAP
1421	uniform sampler2D map;
1422#endif
1423#ifdef USE_ALPHAMAP
1424	uniform sampler2D alphaMap;
1425#endif`,Dg=`float metalnessFactor = metalness;
1426#ifdef USE_METALNESSMAP
1427	vec4 texelMetalness = texture2D( metalnessMap, vMetalnessMapUv );
1428	metalnessFactor *= texelMetalness.b;
1429#endif`,Ug=`#ifdef USE_METALNESSMAP
1430	uniform sampler2D metalnessMap;
1431#endif`,Ng=`#ifdef USE_INSTANCING_MORPH
1432	float morphTargetInfluences[ MORPHTARGETS_COUNT ];
1433	float morphTargetBaseInfluence = texelFetch( morphTexture, ivec2( 0, gl_InstanceID ), 0 ).r;
1434	for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {
1435		morphTargetInfluences[i] =  texelFetch( morphTexture, ivec2( i + 1, gl_InstanceID ), 0 ).r;
1436	}
1437#endif`,Fg=`#if defined( USE_MORPHCOLORS )
1438	vColor *= morphTargetBaseInfluence;
1439	for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {
1440		#if defined( USE_COLOR_ALPHA )
1441			if ( morphTargetInfluences[ i ] != 0.0 ) vColor += getMorph( gl_VertexID, i, 2 ) * morphTargetInfluences[ i ];
1442		#elif defined( USE_COLOR )
1443			if ( morphTargetInfluences[ i ] != 0.0 ) vColor += getMorph( gl_VertexID, i, 2 ).rgb * morphTargetInfluences[ i ];
1444		#endif
1445	}
1446#endif`,Og=`#ifdef USE_MORPHNORMALS
1447	objectNormal *= morphTargetBaseInfluence;
1448	for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {
1449		if ( morphTargetInfluences[ i ] != 0.0 ) objectNormal += getMorph( gl_VertexID, i, 1 ).xyz * morphTargetInfluences[ i ];
1450	}
1451#endif`,Bg=`#ifdef USE_MORPHTARGETS
1452	#ifndef USE_INSTANCING_MORPH
1453		uniform float morphTargetBaseInfluence;
1454		uniform float morphTargetInfluences[ MORPHTARGETS_COUNT ];
1455	#endif
1456	uniform sampler2DArray morphTargetsTexture;
1457	uniform ivec2 morphTargetsTextureSize;
1458	vec4 getMorph( const in int vertexIndex, const in int morphTargetIndex, const in int offset ) {
1459		int texelIndex = vertexIndex * MORPHTARGETS_TEXTURE_STRIDE + offset;
1460		int y = texelIndex / morphTargetsTextureSize.x;
1461		int x = texelIndex - y * morphTargetsTextureSize.x;
1462		ivec3 morphUV = ivec3( x, y, morphTargetIndex );
1463		return texelFetch( morphTargetsTexture, morphUV, 0 );
1464	}
1465#endif`,zg=`#ifdef USE_MORPHTARGETS
1466	transformed *= morphTargetBaseInfluence;
1467	for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {
1468		if ( morphTargetInfluences[ i ] != 0.0 ) transformed += getMorph( gl_VertexID, i, 0 ).xyz * morphTargetInfluences[ i ];
1469	}
1470#endif`,kg=`float faceDirection = gl_FrontFacing ? 1.0 : - 1.0;
1471#ifdef FLAT_SHADED
1472	vec3 fdx = dFdx( vViewPosition );
1473	vec3 fdy = dFdy( vViewPosition );
1474	vec3 normal = normalize( cross( fdx, fdy ) );
1475#else
1476	vec3 normal = normalize( vNormal );
1477	#ifdef DOUBLE_SIDED
1478		normal *= faceDirection;
1479	#endif
1480#endif
1481#if defined( USE_NORMALMAP_TANGENTSPACE ) || defined( USE_CLEARCOAT_NORMALMAP ) || defined( USE_ANISOTROPY )
1482	#ifdef USE_TANGENT
1483		mat3 tbn = mat3( normalize( vTangent ), normalize( vBitangent ), normal );
1484	#else
1485		mat3 tbn = getTangentFrame( - vViewPosition, normal,
1486		#if defined( USE_NORMALMAP )
1487			vNormalMapUv
1488		#elif defined( USE_CLEARCOAT_NORMALMAP )
1489			vClearcoatNormalMapUv
1490		#else
1491			vUv
1492		#endif
1493		);
1494	#endif
1495	#if defined( DOUBLE_SIDED ) && ! defined( FLAT_SHADED )
1496		tbn[0] *= faceDirection;
1497		tbn[1] *= faceDirection;
1498	#endif
1499#endif
1500#ifdef USE_CLEARCOAT_NORMALMAP
1501	#ifdef USE_TANGENT
1502		mat3 tbn2 = mat3( normalize( vTangent ), normalize( vBitangent ), normal );
1503	#else
1504		mat3 tbn2 = getTangentFrame( - vViewPosition, normal, vClearcoatNormalMapUv );
1505	#endif
1506	#if defined( DOUBLE_SIDED ) && ! defined( FLAT_SHADED )
1507		tbn2[0] *= faceDirection;
1508		tbn2[1] *= faceDirection;
1509	#endif
1510#endif
1511vec3 nonPerturbedNormal = normal;`,Vg=`#ifdef USE_NORMALMAP_OBJECTSPACE
1512	normal = texture2D( normalMap, vNormalMapUv ).xyz * 2.0 - 1.0;
1513	#ifdef FLIP_SIDED
1514		normal = - normal;
1515	#endif
1516	#ifdef DOUBLE_SIDED
1517		normal = normal * faceDirection;
1518	#endif
1519	normal = normalize( normalMatrix * normal );
1520#elif defined( USE_NORMALMAP_TANGENTSPACE )
1521	vec3 mapN = texture2D( normalMap, vNormalMapUv ).xyz * 2.0 - 1.0;
1522	mapN.xy *= normalScale;
1523	normal = normalize( tbn * mapN );
1524#elif defined( USE_BUMPMAP )
1525	normal = perturbNormalArb( - vViewPosition, normal, dHdxy_fwd(), faceDirection );
1526#endif`,Hg=`#ifndef FLAT_SHADED
1527	varying vec3 vNormal;
1528	#ifdef USE_TANGENT
1529		varying vec3 vTangent;
1530		varying vec3 vBitangent;
1531	#endif
1532#endif`,Gg=`#ifndef FLAT_SHADED
1533	varying vec3 vNormal;
1534	#ifdef USE_TANGENT
1535		varying vec3 vTangent;
1536		varying vec3 vBitangent;
1537	#endif
1538#endif`,Wg=`#ifndef FLAT_SHADED
1539	vNormal = normalize( transformedNormal );
1540	#ifdef USE_TANGENT
1541		vTangent = normalize( transformedTangent );
1542		vBitangent = normalize( cross( vNormal, vTangent ) * tangent.w );
1543	#endif
1544#endif`,Xg=`#ifdef USE_NORMALMAP
1545	uniform sampler2D normalMap;
1546	uniform vec2 normalScale;
1547#endif
1548#ifdef USE_NORMALMAP_OBJECTSPACE
1549	uniform mat3 normalMatrix;
1550#endif
1551#if ! defined ( USE_TANGENT ) && ( defined ( USE_NORMALMAP_TANGENTSPACE ) || defined ( USE_CLEARCOAT_NORMALMAP ) || defined( USE_ANISOTROPY ) )
1552	mat3 getTangentFrame( vec3 eye_pos, vec3 surf_norm, vec2 uv ) {
1553		vec3 q0 = dFdx( eye_pos.xyz );
1554		vec3 q1 = dFdy( eye_pos.xyz );
1555		vec2 st0 = dFdx( uv.st );
1556		vec2 st1 = dFdy( uv.st );
1557		vec3 N = surf_norm;
1558		vec3 q1perp = cross( q1, N );
1559		vec3 q0perp = cross( N, q0 );
1560		vec3 T = q1perp * st0.x + q0perp * st1.x;
1561		vec3 B = q1perp * st0.y + q0perp * st1.y;
1562		float det = max( dot( T, T ), dot( B, B ) );
1563		float scale = ( det == 0.0 ) ? 0.0 : inversesqrt( det );
1564		return mat3( T * scale, B * scale, N );
1565	}
1566#endif`,qg=`#ifdef USE_CLEARCOAT
1567	vec3 clearcoatNormal = nonPerturbedNormal;
1568#endif`,Yg=`#ifdef USE_CLEARCOAT_NORMALMAP
1569	vec3 clearcoatMapN = texture2D( clearcoatNormalMap, vClearcoatNormalMapUv ).xyz * 2.0 - 1.0;
1570	clearcoatMapN.xy *= clearcoatNormalScale;
1571	clearcoatNormal = normalize( tbn2 * clearcoatMapN );
1572#endif`,Zg=`#ifdef USE_CLEARCOATMAP
1573	uniform sampler2D clearcoatMap;
1574#endif
1575#ifdef USE_CLEARCOAT_NORMALMAP
1576	uniform sampler2D clearcoatNormalMap;
1577	uniform vec2 clearcoatNormalScale;
1578#endif
1579#ifdef USE_CLEARCOAT_ROUGHNESSMAP
1580	uniform sampler2D clearcoatRoughnessMap;
1581#endif`,Jg=`#ifdef USE_IRIDESCENCEMAP
1582	uniform sampler2D iridescenceMap;
1583#endif
1584#ifdef USE_IRIDESCENCE_THICKNESSMAP
1585	uniform sampler2D iridescenceThicknessMap;
1586#endif`,$g=`#ifdef OPAQUE
1587diffuseColor.a = 1.0;
1588#endif
1589#ifdef USE_TRANSMISSION
1590diffuseColor.a *= material.transmissionAlpha;
1591#endif
1592gl_FragColor = vec4( outgoingLight, diffuseColor.a );`,Kg=`vec3 packNormalToRGB( const in vec3 normal ) {
1593	return normalize( normal ) * 0.5 + 0.5;
1594}
1595vec3 unpackRGBToNormal( const in vec3 rgb ) {
1596	return 2.0 * rgb.xyz - 1.0;
1597}
1598const float PackUpscale = 256. / 255.;const float UnpackDownscale = 255. / 256.;const float ShiftRight8 = 1. / 256.;
1599const float Inv255 = 1. / 255.;
1600const vec4 PackFactors = vec4( 1.0, 256.0, 256.0 * 256.0, 256.0 * 256.0 * 256.0 );
1601const vec2 UnpackFactors2 = vec2( UnpackDownscale, 1.0 / PackFactors.g );
1602const vec3 UnpackFactors3 = vec3( UnpackDownscale / PackFactors.rg, 1.0 / PackFactors.b );
1603const vec4 UnpackFactors4 = vec4( UnpackDownscale / PackFactors.rgb, 1.0 / PackFactors.a );
1604vec4 packDepthToRGBA( const in float v ) {
1605	if( v <= 0.0 )
1606		return vec4( 0., 0., 0., 0. );
1607	if( v >= 1.0 )
1608		return vec4( 1., 1., 1., 1. );
1609	float vuf;
1610	float af = modf( v * PackFactors.a, vuf );
1611	float bf = modf( vuf * ShiftRight8, vuf );
1612	float gf = modf( vuf * ShiftRight8, vuf );
1613	return vec4( vuf * Inv255, gf * PackUpscale, bf * PackUpscale, af );
1614}
1615vec3 packDepthToRGB( const in float v ) {
1616	if( v <= 0.0 )
1617		return vec3( 0., 0., 0. );
1618	if( v >= 1.0 )
1619		return vec3( 1., 1., 1. );
1620	float vuf;
1621	float bf = modf( v * PackFactors.b, vuf );
1622	float gf = modf( vuf * ShiftRight8, vuf );
1623	return vec3( vuf * Inv255, gf * PackUpscale, bf );
1624}
1625vec2 packDepthToRG( const in float v ) {
1626	if( v <= 0.0 )
1627		return vec2( 0., 0. );
1628	if( v >= 1.0 )
1629		return vec2( 1., 1. );
1630	float vuf;
1631	float gf = modf( v * 256., vuf );
1632	return vec2( vuf * Inv255, gf );
1633}
1634float unpackRGBAToDepth( const in vec4 v ) {
1635	return dot( v, UnpackFactors4 );
1636}
1637float unpackRGBToDepth( const in vec3 v ) {
1638	return dot( v, UnpackFactors3 );
1639}
1640float unpackRGToDepth( const in vec2 v ) {
1641	return v.r * UnpackFactors2.r + v.g * UnpackFactors2.g;
1642}
1643vec4 pack2HalfToRGBA( const in vec2 v ) {
1644	vec4 r = vec4( v.x, fract( v.x * 255.0 ), v.y, fract( v.y * 255.0 ) );
1645	return vec4( r.x - r.y / 255.0, r.y, r.z - r.w / 255.0, r.w );
1646}
1647vec2 unpackRGBATo2Half( const in vec4 v ) {
1648	return vec2( v.x + ( v.y / 255.0 ), v.z + ( v.w / 255.0 ) );
1649}
1650float viewZToOrthographicDepth( const in float viewZ, const in float near, const in float far ) {
1651	return ( viewZ + near ) / ( near - far );
1652}
1653float orthographicDepthToViewZ( const in float depth, const in float near, const in float far ) {
1654	return depth * ( near - far ) - near;
1655}
1656float viewZToPerspectiveDepth( const in float viewZ, const in float near, const in float far ) {
1657	return ( ( near + viewZ ) * far ) / ( ( far - near ) * viewZ );
1658}
1659float perspectiveDepthToViewZ( const in float depth, const in float near, const in float far ) {
1660	return ( near * far ) / ( ( far - near ) * depth - far );
1661}`,Qg=`#ifdef PREMULTIPLIED_ALPHA
1662	gl_FragColor.rgb *= gl_FragColor.a;
1663#endif`,jg=`vec4 mvPosition = vec4( transformed, 1.0 );
1664#ifdef USE_BATCHING
1665	mvPosition = batchingMatrix * mvPosition;
1666#endif
1667#ifdef USE_INSTANCING
1668	mvPosition = instanceMatrix * mvPosition;
1669#endif
1670mvPosition = modelViewMatrix * mvPosition;
1671gl_Position = projectionMatrix * mvPosition;`,t_=`#ifdef DITHERING
1672	gl_FragColor.rgb = dithering( gl_FragColor.rgb );
1673#endif`,e_=`#ifdef DITHERING
1674	vec3 dithering( vec3 color ) {
1675		float grid_position = rand( gl_FragCoord.xy );
1676		vec3 dither_shift_RGB = vec3( 0.25 / 255.0, -0.25 / 255.0, 0.25 / 255.0 );
1677		dither_shift_RGB = mix( 2.0 * dither_shift_RGB, -2.0 * dither_shift_RGB, grid_position );
1678		return color + dither_shift_RGB;
1679	}
1680#endif`,n_=`float roughnessFactor = roughness;
1681#ifdef USE_ROUGHNESSMAP
1682	vec4 texelRoughness = texture2D( roughnessMap, vRoughnessMapUv );
1683	roughnessFactor *= texelRoughness.g;
1684#endif`,i_=`#ifdef USE_ROUGHNESSMAP
1685	uniform sampler2D roughnessMap;
1686#endif`,s_=`#if NUM_SPOT_LIGHT_COORDS > 0
1687	varying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ];
1688#endif
1689#if NUM_SPOT_LIGHT_MAPS > 0
1690	uniform sampler2D spotLightMap[ NUM_SPOT_LIGHT_MAPS ];
1691#endif
1692#ifdef USE_SHADOWMAP
1693	#if NUM_DIR_LIGHT_SHADOWS > 0
1694		uniform sampler2D directionalShadowMap[ NUM_DIR_LIGHT_SHADOWS ];
1695		varying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ];
1696		struct DirectionalLightShadow {
1697			float shadowIntensity;
1698			float shadowBias;
1699			float shadowNormalBias;
1700			float shadowRadius;
1701			vec2 shadowMapSize;
1702		};
1703		uniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ];
1704	#endif
1705	#if NUM_SPOT_LIGHT_SHADOWS > 0
1706		uniform sampler2D spotShadowMap[ NUM_SPOT_LIGHT_SHADOWS ];
1707		struct SpotLightShadow {
1708			float shadowIntensity;
1709			float shadowBias;
1710			float shadowNormalBias;
1711			float shadowRadius;
1712			vec2 shadowMapSize;
1713		};
1714		uniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ];
1715	#endif
1716	#if NUM_POINT_LIGHT_SHADOWS > 0
1717		uniform sampler2D pointShadowMap[ NUM_POINT_LIGHT_SHADOWS ];
1718		varying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ];
1719		struct PointLightShadow {
1720			float shadowIntensity;
1721			float shadowBias;
1722			float shadowNormalBias;
1723			float shadowRadius;
1724			vec2 shadowMapSize;
1725			float shadowCameraNear;
1726			float shadowCameraFar;
1727		};
1728		uniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ];
1729	#endif
1730	float texture2DCompare( sampler2D depths, vec2 uv, float compare ) {
1731		float depth = unpackRGBAToDepth( texture2D( depths, uv ) );
1732		#ifdef USE_REVERSEDEPTHBUF
1733			return step( depth, compare );
1734		#else
1735			return step( compare, depth );
1736		#endif
1737	}
1738	vec2 texture2DDistribution( sampler2D shadow, vec2 uv ) {
1739		return unpackRGBATo2Half( texture2D( shadow, uv ) );
1740	}
1741	float VSMShadow (sampler2D shadow, vec2 uv, float compare ){
1742		float occlusion = 1.0;
1743		vec2 distribution = texture2DDistribution( shadow, uv );
1744		#ifdef USE_REVERSEDEPTHBUF
1745			float hard_shadow = step( distribution.x, compare );
1746		#else
1747			float hard_shadow = step( compare , distribution.x );
1748		#endif
vendor: 7,038 bytes, lines 1748-1881
1748
1749		if (hard_shadow != 1.0 ) {
1750			float distance = compare - distribution.x ;
1751			float variance = max( 0.00000, distribution.y * distribution.y );
1752			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 );
1753		}
1754		return occlusion;
1755	}
1756	float getShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord ) {
1757		float shadow = 1.0;
1758		shadowCoord.xyz /= shadowCoord.w;
1759		shadowCoord.z += shadowBias;
1760		bool inFrustum = shadowCoord.x >= 0.0 && shadowCoord.x <= 1.0 && shadowCoord.y >= 0.0 && shadowCoord.y <= 1.0;
1761		bool frustumTest = inFrustum && shadowCoord.z <= 1.0;
1762		if ( frustumTest ) {
1763		#if defined( SHADOWMAP_TYPE_PCF )
1764			vec2 texelSize = vec2( 1.0 ) / shadowMapSize;
1765			float dx0 = - texelSize.x * shadowRadius;
1766			float dy0 = - texelSize.y * shadowRadius;
1767			float dx1 = + texelSize.x * shadowRadius;
1768			float dy1 = + texelSize.y * shadowRadius;
1769			float dx2 = dx0 / 2.0;
1770			float dy2 = dy0 / 2.0;
1771			float dx3 = dx1 / 2.0;
1772			float dy3 = dy1 / 2.0;
1773			shadow = (
1774				texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy0 ), shadowCoord.z ) +
1775				texture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy0 ), shadowCoord.z ) +
1776				texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy0 ), shadowCoord.z ) +
1777				texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, dy2 ), shadowCoord.z ) +
1778				texture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy2 ), shadowCoord.z ) +
1779				texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, dy2 ), shadowCoord.z ) +
1780				texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, 0.0 ), shadowCoord.z ) +
1781				texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, 0.0 ), shadowCoord.z ) +
1782				texture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z ) +
1783				texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, 0.0 ), shadowCoord.z ) +
1784				texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, 0.0 ), shadowCoord.z ) +
1785				texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, dy3 ), shadowCoord.z ) +
1786				texture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy3 ), shadowCoord.z ) +
1787				texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, dy3 ), shadowCoord.z ) +
1788				texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy1 ), shadowCoord.z ) +
1789				texture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy1 ), shadowCoord.z ) +
1790				texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy1 ), shadowCoord.z )
1791			) * ( 1.0 / 17.0 );
1792		#elif defined( SHADOWMAP_TYPE_PCF_SOFT )
1793			vec2 texelSize = vec2( 1.0 ) / shadowMapSize;
1794			float dx = texelSize.x;
1795			float dy = texelSize.y;
1796			vec2 uv = shadowCoord.xy;
1797			vec2 f = fract( uv * shadowMapSize + 0.5 );
1798			uv -= f * texelSize;
1799			shadow = (
1800				texture2DCompare( shadowMap, uv, shadowCoord.z ) +
1801				texture2DCompare( shadowMap, uv + vec2( dx, 0.0 ), shadowCoord.z ) +
1802				texture2DCompare( shadowMap, uv + vec2( 0.0, dy ), shadowCoord.z ) +
1803				texture2DCompare( shadowMap, uv + texelSize, shadowCoord.z ) +
1804				mix( texture2DCompare( shadowMap, uv + vec2( -dx, 0.0 ), shadowCoord.z ),
1805					 texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, 0.0 ), shadowCoord.z ),
1806					 f.x ) +
1807				mix( texture2DCompare( shadowMap, uv + vec2( -dx, dy ), shadowCoord.z ),
1808					 texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, dy ), shadowCoord.z ),
1809					 f.x ) +
1810				mix( texture2DCompare( shadowMap, uv + vec2( 0.0, -dy ), shadowCoord.z ),
1811					 texture2DCompare( shadowMap, uv + vec2( 0.0, 2.0 * dy ), shadowCoord.z ),
1812					 f.y ) +
1813				mix( texture2DCompare( shadowMap, uv + vec2( dx, -dy ), shadowCoord.z ),
1814					 texture2DCompare( shadowMap, uv + vec2( dx, 2.0 * dy ), shadowCoord.z ),
1815					 f.y ) +
1816				mix( mix( texture2DCompare( shadowMap, uv + vec2( -dx, -dy ), shadowCoord.z ),
1817						  texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, -dy ), shadowCoord.z ),
1818						  f.x ),
1819					 mix( texture2DCompare( shadowMap, uv + vec2( -dx, 2.0 * dy ), shadowCoord.z ),
1820						  texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, 2.0 * dy ), shadowCoord.z ),
1821						  f.x ),
1822					 f.y )
1823			) * ( 1.0 / 9.0 );
1824		#elif defined( SHADOWMAP_TYPE_VSM )
1825			shadow = VSMShadow( shadowMap, shadowCoord.xy, shadowCoord.z );
1826		#else
1827			shadow = texture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z );
1828		#endif
1829		}
1830		return mix( 1.0, shadow, shadowIntensity );
1831	}
1832	vec2 cubeToUV( vec3 v, float texelSizeY ) {
1833		vec3 absV = abs( v );
1834		float scaleToCube = 1.0 / max( absV.x, max( absV.y, absV.z ) );
1835		absV *= scaleToCube;
1836		v *= scaleToCube * ( 1.0 - 2.0 * texelSizeY );
1837		vec2 planar = v.xy;
1838		float almostATexel = 1.5 * texelSizeY;
1839		float almostOne = 1.0 - almostATexel;
1840		if ( absV.z >= almostOne ) {
1841			if ( v.z > 0.0 )
1842				planar.x = 4.0 - v.x;
1843		} else if ( absV.x >= almostOne ) {
1844			float signX = sign( v.x );
1845			planar.x = v.z * signX + 2.0 * signX;
1846		} else if ( absV.y >= almostOne ) {
1847			float signY = sign( v.y );
1848			planar.x = v.x + 2.0 * signY + 2.0;
1849			planar.y = v.z * signY - 2.0;
1850		}
1851		return vec2( 0.125, 0.25 ) * planar + vec2( 0.375, 0.75 );
1852	}
1853	float getPointShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord, float shadowCameraNear, float shadowCameraFar ) {
1854		float shadow = 1.0;
1855		vec3 lightToPosition = shadowCoord.xyz;
1856		
1857		float lightToPositionLength = length( lightToPosition );
1858		if ( lightToPositionLength - shadowCameraFar <= 0.0 && lightToPositionLength - shadowCameraNear >= 0.0 ) {
1859			float dp = ( lightToPositionLength - shadowCameraNear ) / ( shadowCameraFar - shadowCameraNear );			dp += shadowBias;
1860			vec3 bd3D = normalize( lightToPosition );
1861			vec2 texelSize = vec2( 1.0 ) / ( shadowMapSize * vec2( 4.0, 2.0 ) );
1862			#if defined( SHADOWMAP_TYPE_PCF ) || defined( SHADOWMAP_TYPE_PCF_SOFT ) || defined( SHADOWMAP_TYPE_VSM )
1863				vec2 offset = vec2( - 1, 1 ) * shadowRadius * texelSize.y;
1864				shadow = (
1865					texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyy, texelSize.y ), dp ) +
1866					texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyy, texelSize.y ), dp ) +
1867					texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyx, texelSize.y ), dp ) +
1868					texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyx, texelSize.y ), dp ) +
1869					texture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp ) +
1870					texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxy, texelSize.y ), dp ) +
1871					texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxy, texelSize.y ), dp ) +
1872					texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxx, texelSize.y ), dp ) +
1873					texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxx, texelSize.y ), dp )
1874				) * ( 1.0 / 9.0 );
1875			#else
1876				shadow = texture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp );
1877			#endif
1878		}
1879		return mix( 1.0, shadow, shadowIntensity );
1880	}
1881#endif`,
1881r_=`#if NUM_SPOT_LIGHT_COORDS > 0
1882	uniform mat4 spotLightMatrix[ NUM_SPOT_LIGHT_COORDS ];
1883	varying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ];
1884#endif
1885#ifdef USE_SHADOWMAP
1886	#if NUM_DIR_LIGHT_SHADOWS > 0
1887		uniform mat4 directionalShadowMatrix[ NUM_DIR_LIGHT_SHADOWS ];
1888		varying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ];
1889		struct DirectionalLightShadow {
1890			float shadowIntensity;
1891			float shadowBias;
1892			float shadowNormalBias;
1893			float shadowRadius;
1894			vec2 shadowMapSize;
1895		};
1896		uniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ];
1897	#endif
1898	#if NUM_SPOT_LIGHT_SHADOWS > 0
1899		struct SpotLightShadow {
1900			float shadowIntensity;
1901			float shadowBias;
1902			float shadowNormalBias;
1903			float shadowRadius;
1904			vec2 shadowMapSize;
1905		};
1906		uniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ];
1907	#endif
1908	#if NUM_POINT_LIGHT_SHADOWS > 0
1909		uniform mat4 pointShadowMatrix[ NUM_POINT_LIGHT_SHADOWS ];
1910		varying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ];
1911		struct PointLightShadow {
1912			float shadowIntensity;
1913			float shadowBias;
1914			float shadowNormalBias;
1915			float shadowRadius;
1916			vec2 shadowMapSize;
1917			float shadowCameraNear;
1918			float shadowCameraFar;
1919		};
1920		uniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ];
1921	#endif
1922#endif`,a_=`#if ( defined( USE_SHADOWMAP ) && ( NUM_DIR_LIGHT_SHADOWS > 0 || NUM_POINT_LIGHT_SHADOWS > 0 ) ) || ( NUM_SPOT_LIGHT_COORDS > 0 )
1923	vec3 shadowWorldNormal = inverseTransformDirection( transformedNormal, viewMatrix );
1924	vec4 shadowWorldPosition;
1925#endif
1926#if defined( USE_SHADOWMAP )
1927	#if NUM_DIR_LIGHT_SHADOWS > 0
1928		#pragma unroll_loop_start
1929		for ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) {
1930			shadowWorldPosition = worldPosition + vec4( shadowWorldNormal * directionalLightShadows[ i ].shadowNormalBias, 0 );
1931			vDirectionalShadowCoord[ i ] = directionalShadowMatrix[ i ] * shadowWorldPosition;
1932		}
1933		#pragma unroll_loop_end
1934	#endif
1935	#if NUM_POINT_LIGHT_SHADOWS > 0
1936		#pragma unroll_loop_start
1937		for ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) {
1938			shadowWorldPosition = worldPosition + vec4( shadowWorldNormal * pointLightShadows[ i ].shadowNormalBias, 0 );
1939			vPointShadowCoord[ i ] = pointShadowMatrix[ i ] * shadowWorldPosition;
1940		}
1941		#pragma unroll_loop_end
1942	#endif
1943#endif
1944#if NUM_SPOT_LIGHT_COORDS > 0
1945	#pragma unroll_loop_start
1946	for ( int i = 0; i < NUM_SPOT_LIGHT_COORDS; i ++ ) {
1947		shadowWorldPosition = worldPosition;
1948		#if ( defined( USE_SHADOWMAP ) && UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )
1949			shadowWorldPosition.xyz += shadowWorldNormal * spotLightShadows[ i ].shadowNormalBias;
1950		#endif
1951		vSpotLightCoord[ i ] = spotLightMatrix[ i ] * shadowWorldPosition;
1952	}
1953	#pragma unroll_loop_end
1954#endif`,o_=`float getShadowMask() {
1955	float shadow = 1.0;
1956	#ifdef USE_SHADOWMAP
1957	#if NUM_DIR_LIGHT_SHADOWS > 0
1958	DirectionalLightShadow directionalLight;
1959	#pragma unroll_loop_start
1960	for ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) {
1961		directionalLight = directionalLightShadows[ i ];
1962		shadow *= receiveShadow ? getShadow( directionalShadowMap[ i ], directionalLight.shadowMapSize, directionalLight.shadowIntensity, directionalLight.shadowBias, directionalLight.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;
1963	}
1964	#pragma unroll_loop_end
1965	#endif
1966	#if NUM_SPOT_LIGHT_SHADOWS > 0
1967	SpotLightShadow spotLight;
1968	#pragma unroll_loop_start
1969	for ( int i = 0; i < NUM_SPOT_LIGHT_SHADOWS; i ++ ) {
1970		spotLight = spotLightShadows[ i ];
1971		shadow *= receiveShadow ? getShadow( spotShadowMap[ i ], spotLight.shadowMapSize, spotLight.shadowIntensity, spotLight.shadowBias, spotLight.shadowRadius, vSpotLightCoord[ i ] ) : 1.0;
1972	}
1973	#pragma unroll_loop_end
1974	#endif
1975	#if NUM_POINT_LIGHT_SHADOWS > 0
1976	PointLightShadow pointLight;
1977	#pragma unroll_loop_start
1978	for ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) {
1979		pointLight = pointLightShadows[ i ];
1980		shadow *= receiveShadow ? getPointShadow( pointShadowMap[ i ], pointLight.shadowMapSize, pointLight.shadowIntensity, pointLight.shadowBias, pointLight.shadowRadius, vPointShadowCoord[ i ], pointLight.shadowCameraNear, pointLight.shadowCameraFar ) : 1.0;
1981	}
1982	#pragma unroll_loop_end
1983	#endif
1984	#endif
1985	return shadow;
1986}`,l_=`#ifdef USE_SKINNING
1987	mat4 boneMatX = getBoneMatrix( skinIndex.x );
1988	mat4 boneMatY = getBoneMatrix( skinIndex.y );
1989	mat4 boneMatZ = getBoneMatrix( skinIndex.z );
1990	mat4 boneMatW = getBoneMatrix( skinIndex.w );
1991#endif`,c_=`#ifdef USE_SKINNING
1992	uniform mat4 bindMatrix;
1993	uniform mat4 bindMatrixInverse;
1994	uniform highp sampler2D boneTexture;
1995	mat4 getBoneMatrix( const in float i ) {
1996		int size = textureSize( boneTexture, 0 ).x;
1997		int j = int( i ) * 4;
1998		int x = j % size;
1999		int y = j / size;
2000		vec4 v1 = texelFetch( boneTexture, ivec2( x, y ), 0 );
2001		vec4 v2 = texelFetch( boneTexture, ivec2( x + 1, y ), 0 );
2002		vec4 v3 = texelFetch( boneTexture, ivec2( x + 2, y ), 0 );
2003		vec4 v4 = texelFetch( boneTexture, ivec2( x + 3, y ), 0 );
2004		return mat4( v1, v2, v3, v4 );
2005	}
2006#endif`,h_=`#ifdef USE_SKINNING
2007	vec4 skinVertex = bindMatrix * vec4( transformed, 1.0 );
2008	vec4 skinned = vec4( 0.0 );
2009	skinned += boneMatX * skinVertex * skinWeight.x;
2010	skinned += boneMatY * skinVertex * skinWeight.y;
2011	skinned += boneMatZ * skinVertex * skinWeight.z;
2012	skinned += boneMatW * skinVertex * skinWeight.w;
2013	transformed = ( bindMatrixInverse * skinned ).xyz;
2014#endif`,u_=`#ifdef USE_SKINNING
2015	mat4 skinMatrix = mat4( 0.0 );
2016	skinMatrix += skinWeight.x * boneMatX;
2017	skinMatrix += skinWeight.y * boneMatY;
2018	skinMatrix += skinWeight.z * boneMatZ;
2019	skinMatrix += skinWeight.w * boneMatW;
2020	skinMatrix = bindMatrixInverse * skinMatrix * bindMatrix;
2021	objectNormal = vec4( skinMatrix * vec4( objectNormal, 0.0 ) ).xyz;
2022	#ifdef USE_TANGENT
2023		objectTangent = vec4( skinMatrix * vec4( objectTangent, 0.0 ) ).xyz;
2024	#endif
2025#endif`,d_=`float specularStrength;
2026#ifdef USE_SPECULARMAP
2027	vec4 texelSpecular = texture2D( specularMap, vSpecularMapUv );
2028	specularStrength = texelSpecular.r;
2029#else
2030	specularStrength = 1.0;
2031#endif`,f_=`#ifdef USE_SPECULARMAP
2032	uniform sampler2D specularMap;
2033#endif`,p_=`#if defined( TONE_MAPPING )
2034	gl_FragColor.rgb = toneMapping( gl_FragColor.rgb );
2035#endif`,m_=`#ifndef saturate
2036#define saturate( a ) clamp( a, 0.0, 1.0 )
2037#endif
2038uniform float toneMappingExposure;
2039vec3 LinearToneMapping( vec3 color ) {
2040	return saturate( toneMappingExposure * color );
2041}
2042vec3 ReinhardToneMapping( vec3 color ) {
2043	color *= toneMappingExposure;
2044	return saturate( color / ( vec3( 1.0 ) + color ) );
2045}
2046vec3 CineonToneMapping( vec3 color ) {
2047	color *= toneMappingExposure;
2048	color = max( vec3( 0.0 ), color - 0.004 );
2049	return pow( ( color * ( 6.2 * color + 0.5 ) ) / ( color * ( 6.2 * color + 1.7 ) + 0.06 ), vec3( 2.2 ) );
2050}
2051vec3 RRTAndODTFit( vec3 v ) {
2052	vec3 a = v * ( v + 0.0245786 ) - 0.000090537;
2053	vec3 b = v * ( 0.983729 * v + 0.4329510 ) + 0.238081;
2054	return a / b;
2055}
2056vec3 ACESFilmicToneMapping( vec3 color ) {
2057	const mat3 ACESInputMat = mat3(
2058		vec3( 0.59719, 0.07600, 0.02840 ),		vec3( 0.35458, 0.90834, 0.13383 ),
2059		vec3( 0.04823, 0.01566, 0.83777 )
2060	);
2061	const mat3 ACESOutputMat = mat3(
2062		vec3(  1.60475, -0.10208, -0.00327 ),		vec3( -0.53108,  1.10813, -0.07276 ),
2063		vec3( -0.07367, -0.00605,  1.07602 )
2064	);
2065	color *= toneMappingExposure / 0.6;
2066	color = ACESInputMat * color;
2067	color = RRTAndODTFit( color );
2068	color = ACESOutputMat * color;
2069	return saturate( color );
2070}
2071const mat3 LINEAR_REC2020_TO_LINEAR_SRGB = mat3(
2072	vec3( 1.6605, - 0.1246, - 0.0182 ),
2073	vec3( - 0.5876, 1.1329, - 0.1006 ),
2074	vec3( - 0.0728, - 0.0083, 1.1187 )
2075);
2076const mat3 LINEAR_SRGB_TO_LINEAR_REC2020 = mat3(
2077	vec3( 0.6274, 0.0691, 0.0164 ),
2078	vec3( 0.3293, 0.9195, 0.0880 ),
2079	vec3( 0.0433, 0.0113, 0.8956 )
2080);
2081vec3 agxDefaultContrastApprox( vec3 x ) {
2082	vec3 x2 = x * x;
2083	vec3 x4 = x2 * x2;
2084	return + 15.5 * x4 * x2
2085		- 40.14 * x4 * x
2086		+ 31.96 * x4
2087		- 6.868 * x2 * x
2088		+ 0.4298 * x2
2089		+ 0.1191 * x
2090		- 0.00232;
2091}
2092vec3 AgXToneMapping( vec3 color ) {
2093	const mat3 AgXInsetMatrix = mat3(
2094		vec3( 0.856627153315983, 0.137318972929847, 0.11189821299995 ),
2095		vec3( 0.0951212405381588, 0.761241990602591, 0.0767994186031903 ),
2096		vec3( 0.0482516061458583, 0.101439036467562, 0.811302368396859 )
2097	);
2098	const mat3 AgXOutsetMatrix = mat3(
2099		vec3( 1.1271005818144368, - 0.1413297634984383, - 0.14132976349843826 ),
2100		vec3( - 0.11060664309660323, 1.157823702216272, - 0.11060664309660294 ),
2101		vec3( - 0.016493938717834573, - 0.016493938717834257, 1.2519364065950405 )
2102	);
2103	const float AgxMinEv = - 12.47393;	const float AgxMaxEv = 4.026069;
2104	color *= toneMappingExposure;
2105	color = LINEAR_SRGB_TO_LINEAR_REC2020 * color;
2106	color = AgXInsetMatrix * color;
2107	color = max( color, 1e-10 );	color = log2( color );
2108	color = ( color - AgxMinEv ) / ( AgxMaxEv - AgxMinEv );
2109	color = clamp( color, 0.0, 1.0 );
2110	color = agxDefaultContrastApprox( color );
2111	color = AgXOutsetMatrix * color;
2112	color = pow( max( vec3( 0.0 ), color ), vec3( 2.2 ) );
2113	color = LINEAR_REC2020_TO_LINEAR_SRGB * color;
2114	color = clamp( color, 0.0, 1.0 );
2115	return color;
2116}
2117vec3 NeutralToneMapping( vec3 color ) {
2118	const float StartCompression = 0.8 - 0.04;
2119	const float Desaturation = 0.15;
2120	color *= toneMappingExposure;
2121	float x = min( color.r, min( color.g, color.b ) );
2122	float offset = x < 0.08 ? x - 6.25 * x * x : 0.04;
2123	color -= offset;
2124	float peak = max( color.r, max( color.g, color.b ) );
2125	if ( peak < StartCompression ) return color;
2126	float d = 1. - StartCompression;
2127	float newPeak = 1. - d * d / ( peak + d - StartCompression );
2128	color *= newPeak / peak;
2129	float g = 1. - 1. / ( Desaturation * ( peak - newPeak ) + 1. );
2130	return mix( color, vec3( newPeak ), g );
2131}
2132vec3 CustomToneMapping( vec3 color ) { return color; }`,g_=`#ifdef USE_TRANSMISSION
2133	material.transmission = transmission;
2134	material.transmissionAlpha = 1.0;
2135	material.thickness = thickness;
2136	material.attenuationDistance = attenuationDistance;
2137	material.attenuationColor = attenuationColor;
2138	#ifdef USE_TRANSMISSIONMAP
2139		material.transmission *= texture2D( transmissionMap, vTransmissionMapUv ).r;
2140	#endif
2141	#ifdef USE_THICKNESSMAP
2142		material.thickness *= texture2D( thicknessMap, vThicknessMapUv ).g;
2143	#endif
2144	vec3 pos = vWorldPosition;
2145	vec3 v = normalize( cameraPosition - pos );
2146	vec3 n = inverseTransformDirection( normal, viewMatrix );
2147	vec4 transmitted = getIBLVolumeRefraction(
2148		n, v, material.roughness, material.diffuseColor, material.specularColor, material.specularF90,
2149		pos, modelMatrix, viewMatrix, projectionMatrix, material.dispersion, material.ior, material.thickness,
2150		material.attenuationColor, material.attenuationDistance );
2151	material.transmissionAlpha = mix( material.transmissionAlpha, transmitted.a, material.transmission );
2152	totalDiffuse = mix( totalDiffuse, transmitted.rgb, material.transmission );
2153#endif`,__=`#ifdef USE_TRANSMISSION
2154	uniform float transmission;
2155	uniform float thickness;
2156	uniform float attenuationDistance;
2157	uniform vec3 attenuationColor;
2158	#ifdef USE_TRANSMISSIONMAP
2159		uniform sampler2D transmissionMap;
2160	#endif
2161	#ifdef USE_THICKNESSMAP
2162		uniform sampler2D thicknessMap;
2163	#endif
2164	uniform vec2 transmissionSamplerSize;
2165	uniform sampler2D transmissionSamplerMap;
2166	uniform mat4 modelMatrix;
2167	uniform mat4 projectionMatrix;
2168	varying vec3 vWorldPosition;
2169	float w0( float a ) {
2170		return ( 1.0 / 6.0 ) * ( a * ( a * ( - a + 3.0 ) - 3.0 ) + 1.0 );
2171	}
2172	float w1( float a ) {
2173		return ( 1.0 / 6.0 ) * ( a *  a * ( 3.0 * a - 6.0 ) + 4.0 );
2174	}
2175	float w2( float a ){
2176		return ( 1.0 / 6.0 ) * ( a * ( a * ( - 3.0 * a + 3.0 ) + 3.0 ) + 1.0 );
2177	}
2178	float w3( float a ) {
2179		return ( 1.0 / 6.0 ) * ( a * a * a );
2180	}
2181	float g0( float a ) {
2182		return w0( a ) + w1( a );
2183	}
2184	float g1( float a ) {
2185		return w2( a ) + w3( a );
2186	}
2187	float h0( float a ) {
2188		return - 1.0 + w1( a ) / ( w0( a ) + w1( a ) );
2189	}
2190	float h1( float a ) {
2191		return 1.0 + w3( a ) / ( w2( a ) + w3( a ) );
2192	}
2193	vec4 bicubic( sampler2D tex, vec2 uv, vec4 texelSize, float lod ) {
2194		uv = uv * texelSize.zw + 0.5;
2195		vec2 iuv = floor( uv );
2196		vec2 fuv = fract( uv );
2197		float g0x = g0( fuv.x );
2198		float g1x = g1( fuv.x );
2199		float h0x = h0( fuv.x );
2200		float h1x = h1( fuv.x );
2201		float h0y = h0( fuv.y );
2202		float h1y = h1( fuv.y );
2203		vec2 p0 = ( vec2( iuv.x + h0x, iuv.y + h0y ) - 0.5 ) * texelSize.xy;
2204		vec2 p1 = ( vec2( iuv.x + h1x, iuv.y + h0y ) - 0.5 ) * texelSize.xy;
2205		vec2 p2 = ( vec2( iuv.x + h0x, iuv.y + h1y ) - 0.5 ) * texelSize.xy;
2206		vec2 p3 = ( vec2( iuv.x + h1x, iuv.y + h1y ) - 0.5 ) * texelSize.xy;
2207		return g0( fuv.y ) * ( g0x * textureLod( tex, p0, lod ) + g1x * textureLod( tex, p1, lod ) ) +
2208			g1( fuv.y ) * ( g0x * textureLod( tex, p2, lod ) + g1x * textureLod( tex, p3, lod ) );
2209	}
2210	vec4 textureBicubic( sampler2D sampler, vec2 uv, float lod ) {
2211		vec2 fLodSize = vec2( textureSize( sampler, int( lod ) ) );
2212		vec2 cLodSize = vec2( textureSize( sampler, int( lod + 1.0 ) ) );
2213		vec2 fLodSizeInv = 1.0 / fLodSize;
2214		vec2 cLodSizeInv = 1.0 / cLodSize;
2215		vec4 fSample = bicubic( sampler, uv, vec4( fLodSizeInv, fLodSize ), floor( lod ) );
2216		vec4 cSample = bicubic( sampler, uv, vec4( cLodSizeInv, cLodSize ), ceil( lod ) );
2217		return mix( fSample, cSample, fract( lod ) );
2218	}
2219	vec3 getVolumeTransmissionRay( const in vec3 n, const in vec3 v, const in float thickness, const in float ior, const in mat4 modelMatrix ) {
2220		vec3 refractionVector = refract( - v, normalize( n ), 1.0 / ior );
2221		vec3 modelScale;
2222		modelScale.x = length( vec3( modelMatrix[ 0 ].xyz ) );
2223		modelScale.y = length( vec3( modelMatrix[ 1 ].xyz ) );
2224		modelScale.z = length( vec3( modelMatrix[ 2 ].xyz ) );
2225		return normalize( refractionVector ) * thickness * modelScale;
2226	}
2227	float applyIorToRoughness( const in float roughness, const in float ior ) {
2228		return roughness * clamp( ior * 2.0 - 2.0, 0.0, 1.0 );
2229	}
2230	vec4 getTransmissionSample( const in vec2 fragCoord, const in float roughness, const in float ior ) {
2231		float lod = log2( transmissionSamplerSize.x ) * applyIorToRoughness( roughness, ior );
2232		return textureBicubic( transmissionSamplerMap, fragCoord.xy, lod );
2233	}
2234	vec3 volumeAttenuation( const in float transmissionDistance, const in vec3 attenuationColor, const in float attenuationDistance ) {
2235		if ( isinf( attenuationDistance ) ) {
2236			return vec3( 1.0 );
2237		} else {
2238			vec3 attenuationCoefficient = -log( attenuationColor ) / attenuationDistance;
2239			vec3 transmittance = exp( - attenuationCoefficient * transmissionDistance );			return transmittance;
2240		}
2241	}
2242	vec4 getIBLVolumeRefraction( const in vec3 n, const in vec3 v, const in float roughness, const in vec3 diffuseColor,
2243		const in vec3 specularColor, const in float specularF90, const in vec3 position, const in mat4 modelMatrix,
2244		const in mat4 viewMatrix, const in mat4 projMatrix, const in float dispersion, const in float ior, const in float thickness,
2245		const in vec3 attenuationColor, const in float attenuationDistance ) {
2246		vec4 transmittedLight;
2247		vec3 transmittance;
2248		#ifdef USE_DISPERSION
2249			float halfSpread = ( ior - 1.0 ) * 0.025 * dispersion;
2250			vec3 iors = vec3( ior - halfSpread, ior, ior + halfSpread );
2251			for ( int i = 0; i < 3; i ++ ) {
2252				vec3 transmissionRay = getVolumeTransmissionRay( n, v, thickness, iors[ i ], modelMatrix );
2253				vec3 refractedRayExit = position + transmissionRay;
2254				vec4 ndcPos = projMatrix * viewMatrix * vec4( refractedRayExit, 1.0 );
2255				vec2 refractionCoords = ndcPos.xy / ndcPos.w;
2256				refractionCoords += 1.0;
2257				refractionCoords /= 2.0;
2258				vec4 transmissionSample = getTransmissionSample( refractionCoords, roughness, iors[ i ] );
2259				transmittedLight[ i ] = transmissionSample[ i ];
2260				transmittedLight.a += transmissionSample.a;
2261				transmittance[ i ] = diffuseColor[ i ] * volumeAttenuation( length( transmissionRay ), attenuationColor, attenuationDistance )[ i ];
2262			}
2263			transmittedLight.a /= 3.0;
2264		#else
2265			vec3 transmissionRay = getVolumeTransmissionRay( n, v, thickness, ior, modelMatrix );
2266			vec3 refractedRayExit = position + transmissionRay;
2267			vec4 ndcPos = projMatrix * viewMatrix * vec4( refractedRayExit, 1.0 );
2268			vec2 refractionCoords = ndcPos.xy / ndcPos.w;
2269			refractionCoords += 1.0;
2270			refractionCoords /= 2.0;
2271			transmittedLight = getTransmissionSample( refractionCoords, roughness, ior );
2272			transmittance = diffuseColor * volumeAttenuation( length( transmissionRay ), attenuationColor, attenuationDistance );
2273		#endif
2274		vec3 attenuatedColor = transmittance * transmittedLight.rgb;
2275		vec3 F = EnvironmentBRDF( n, v, specularColor, specularF90, roughness );
2276		float transmittanceFactor = ( transmittance.r + transmittance.g + transmittance.b ) / 3.0;
2277		return vec4( ( 1.0 - F ) * attenuatedColor, 1.0 - ( 1.0 - transmittedLight.a ) * transmittanceFactor );
2278	}
2279#endif`,x_=`#if defined( USE_UV ) || defined( USE_ANISOTROPY )
2280	varying vec2 vUv;
2281#endif
2282#ifdef USE_MAP
2283	varying vec2 vMapUv;
2284#endif
2285#ifdef USE_ALPHAMAP
2286	varying vec2 vAlphaMapUv;
2287#endif
2288#ifdef USE_LIGHTMAP
2289	varying vec2 vLightMapUv;
2290#endif
2291#ifdef USE_AOMAP
2292	varying vec2 vAoMapUv;
2293#endif
2294#ifdef USE_BUMPMAP
2295	varying vec2 vBumpMapUv;
2296#endif
2297#ifdef USE_NORMALMAP
2298	varying vec2 vNormalMapUv;
2299#endif
2300#ifdef USE_EMISSIVEMAP
2301	varying vec2 vEmissiveMapUv;
2302#endif
2303#ifdef USE_METALNESSMAP
2304	varying vec2 vMetalnessMapUv;
2305#endif
2306#ifdef USE_ROUGHNESSMAP
2307	varying vec2 vRoughnessMapUv;
2308#endif
2309#ifdef USE_ANISOTROPYMAP
2310	varying vec2 vAnisotropyMapUv;
2311#endif
2312#ifdef USE_CLEARCOATMAP
2313	varying vec2 vClearcoatMapUv;
2314#endif
2315#ifdef USE_CLEARCOAT_NORMALMAP
2316	varying vec2 vClearcoatNormalMapUv;
2317#endif
2318#ifdef USE_CLEARCOAT_ROUGHNESSMAP
2319	varying vec2 vClearcoatRoughnessMapUv;
2320#endif
2321#ifdef USE_IRIDESCENCEMAP
2322	varying vec2 vIridescenceMapUv;
2323#endif
2324#ifdef USE_IRIDESCENCE_THICKNESSMAP
2325	varying vec2 vIridescenceThicknessMapUv;
2326#endif
2327#ifdef USE_SHEEN_COLORMAP
2328	varying vec2 vSheenColorMapUv;
2329#endif
2330#ifdef USE_SHEEN_ROUGHNESSMAP
2331	varying vec2 vSheenRoughnessMapUv;
2332#endif
2333#ifdef USE_SPECULARMAP
2334	varying vec2 vSpecularMapUv;
2335#endif
2336#ifdef USE_SPECULAR_COLORMAP
2337	varying vec2 vSpecularColorMapUv;
2338#endif
2339#ifdef USE_SPECULAR_INTENSITYMAP
2340	varying vec2 vSpecularIntensityMapUv;
2341#endif
2342#ifdef USE_TRANSMISSIONMAP
2343	uniform mat3 transmissionMapTransform;
2344	varying vec2 vTransmissionMapUv;
2345#endif
2346#ifdef USE_THICKNESSMAP
2347	uniform mat3 thicknessMapTransform;
2348	varying vec2 vThicknessMapUv;
2349#endif`,v_=`#if defined( USE_UV ) || defined( USE_ANISOTROPY )
2350	varying vec2 vUv;
2351#endif
2352#ifdef USE_MAP
2353	uniform mat3 mapTransform;
2354	varying vec2 vMapUv;
2355#endif
2356#ifdef USE_ALPHAMAP
2357	uniform mat3 alphaMapTransform;
2358	varying vec2 vAlphaMapUv;
2359#endif
2360#ifdef USE_LIGHTMAP
2361	uniform mat3 lightMapTransform;
2362	varying vec2 vLightMapUv;
2363#endif
2364#ifdef USE_AOMAP
2365	uniform mat3 aoMapTransform;
2366	varying vec2 vAoMapUv;
2367#endif
2368#ifdef USE_BUMPMAP
2369	uniform mat3 bumpMapTransform;
2370	varying vec2 vBumpMapUv;
2371#endif
2372#ifdef USE_NORMALMAP
2373	uniform mat3 normalMapTransform;
2374	varying vec2 vNormalMapUv;
2375#endif
2376#ifdef USE_DISPLACEMENTMAP
2377	uniform mat3 displacementMapTransform;
2378	varying vec2 vDisplacementMapUv;
2379#endif
2380#ifdef USE_EMISSIVEMAP
2381	uniform mat3 emissiveMapTransform;
2382	varying vec2 vEmissiveMapUv;
2383#endif
2384#ifdef USE_METALNESSMAP
2385	uniform mat3 metalnessMapTransform;
2386	varying vec2 vMetalnessMapUv;
2387#endif
2388#ifdef USE_ROUGHNESSMAP
2389	uniform mat3 roughnessMapTransform;
2390	varying vec2 vRoughnessMapUv;
2391#endif
2392#ifdef USE_ANISOTROPYMAP
2393	uniform mat3 anisotropyMapTransform;
2394	varying vec2 vAnisotropyMapUv;
2395#endif
2396#ifdef USE_CLEARCOATMAP
2397	uniform mat3 clearcoatMapTransform;
2398	varying vec2 vClearcoatMapUv;
2399#endif
2400#ifdef USE_CLEARCOAT_NORMALMAP
2401	uniform mat3 clearcoatNormalMapTransform;
2402	varying vec2 vClearcoatNormalMapUv;
2403#endif
2404#ifdef USE_CLEARCOAT_ROUGHNESSMAP
2405	uniform mat3 clearcoatRoughnessMapTransform;
2406	varying vec2 vClearcoatRoughnessMapUv;
2407#endif
2408#ifdef USE_SHEEN_COLORMAP
2409	uniform mat3 sheenColorMapTransform;
2410	varying vec2 vSheenColorMapUv;
2411#endif
2412#ifdef USE_SHEEN_ROUGHNESSMAP
2413	uniform mat3 sheenRoughnessMapTransform;
2414	varying vec2 vSheenRoughnessMapUv;
2415#endif
2416#ifdef USE_IRIDESCENCEMAP
2417	uniform mat3 iridescenceMapTransform;
2418	varying vec2 vIridescenceMapUv;
2419#endif
2420#ifdef USE_IRIDESCENCE_THICKNESSMAP
2421	uniform mat3 iridescenceThicknessMapTransform;
2422	varying vec2 vIridescenceThicknessMapUv;
2423#endif
2424#ifdef USE_SPECULARMAP
2425	uniform mat3 specularMapTransform;
2426	varying vec2 vSpecularMapUv;
2427#endif
2428#ifdef USE_SPECULAR_COLORMAP
2429	uniform mat3 specularColorMapTransform;
2430	varying vec2 vSpecularColorMapUv;
2431#endif
2432#ifdef USE_SPECULAR_INTENSITYMAP
2433	uniform mat3 specularIntensityMapTransform;
2434	varying vec2 vSpecularIntensityMapUv;
2435#endif
2436#ifdef USE_TRANSMISSIONMAP
2437	uniform mat3 transmissionMapTransform;
2438	varying vec2 vTransmissionMapUv;
2439#endif
2440#ifdef USE_THICKNESSMAP
2441	uniform mat3 thicknessMapTransform;
2442	varying vec2 vThicknessMapUv;
2443#endif`,y_=`#if defined( USE_UV ) || defined( USE_ANISOTROPY )
2444	vUv = vec3( uv, 1 ).xy;
2445#endif
2446#ifdef USE_MAP
2447	vMapUv = ( mapTransform * vec3( MAP_UV, 1 ) ).xy;
2448#endif
2449#ifdef USE_ALPHAMAP
2450	vAlphaMapUv = ( alphaMapTransform * vec3( ALPHAMAP_UV, 1 ) ).xy;
2451#endif
2452#ifdef USE_LIGHTMAP
2453	vLightMapUv = ( lightMapTransform * vec3( LIGHTMAP_UV, 1 ) ).xy;
2454#endif
2455#ifdef USE_AOMAP
2456	vAoMapUv = ( aoMapTransform * vec3( AOMAP_UV, 1 ) ).xy;
2457#endif
2458#ifdef USE_BUMPMAP
2459	vBumpMapUv = ( bumpMapTransform * vec3( BUMPMAP_UV, 1 ) ).xy;
2460#endif
2461#ifdef USE_NORMALMAP
2462	vNormalMapUv = ( normalMapTransform * vec3( NORMALMAP_UV, 1 ) ).xy;
2463#endif
2464#ifdef USE_DISPLACEMENTMAP
2465	vDisplacementMapUv = ( displacementMapTransform * vec3( DISPLACEMENTMAP_UV, 1 ) ).xy;
2466#endif
2467#ifdef USE_EMISSIVEMAP
2468	vEmissiveMapUv = ( emissiveMapTransform * vec3( EMISSIVEMAP_UV, 1 ) ).xy;
2469#endif
2470#ifdef USE_METALNESSMAP
2471	vMetalnessMapUv = ( metalnessMapTransform * vec3( METALNESSMAP_UV, 1 ) ).xy;
2472#endif
2473#ifdef USE_ROUGHNESSMAP
2474	vRoughnessMapUv = ( roughnessMapTransform * vec3( ROUGHNESSMAP_UV, 1 ) ).xy;
2475#endif
2476#ifdef USE_ANISOTROPYMAP
2477	vAnisotropyMapUv = ( anisotropyMapTransform * vec3( ANISOTROPYMAP_UV, 1 ) ).xy;
2478#endif
2479#ifdef USE_CLEARCOATMAP
2480	vClearcoatMapUv = ( clearcoatMapTransform * vec3( CLEARCOATMAP_UV, 1 ) ).xy;
2481#endif
2482#ifdef USE_CLEARCOAT_NORMALMAP
2483	vClearcoatNormalMapUv = ( clearcoatNormalMapTransform * vec3( CLEARCOAT_NORMALMAP_UV, 1 ) ).xy;
2484#endif
2485#ifdef USE_CLEARCOAT_ROUGHNESSMAP
2486	vClearcoatRoughnessMapUv = ( clearcoatRoughnessMapTransform * vec3( CLEARCOAT_ROUGHNESSMAP_UV, 1 ) ).xy;
2487#endif
2488#ifdef USE_IRIDESCENCEMAP
2489	vIridescenceMapUv = ( iridescenceMapTransform * vec3( IRIDESCENCEMAP_UV, 1 ) ).xy;
2490#endif
2491#ifdef USE_IRIDESCENCE_THICKNESSMAP
2492	vIridescenceThicknessMapUv = ( iridescenceThicknessMapTransform * vec3( IRIDESCENCE_THICKNESSMAP_UV, 1 ) ).xy;
2493#endif
2494#ifdef USE_SHEEN_COLORMAP
2495	vSheenColorMapUv = ( sheenColorMapTransform * vec3( SHEEN_COLORMAP_UV, 1 ) ).xy;
2496#endif
2497#ifdef USE_SHEEN_ROUGHNESSMAP
2498	vSheenRoughnessMapUv = ( sheenRoughnessMapTransform * vec3( SHEEN_ROUGHNESSMAP_UV, 1 ) ).xy;
2499#endif
2500#ifdef USE_SPECULARMAP
2501	vSpecularMapUv = ( specularMapTransform * vec3( SPECULARMAP_UV, 1 ) ).xy;
2502#endif
2503#ifdef USE_SPECULAR_COLORMAP
2504	vSpecularColorMapUv = ( specularColorMapTransform * vec3( SPECULAR_COLORMAP_UV, 1 ) ).xy;
2505#endif
2506#ifdef USE_SPECULAR_INTENSITYMAP
2507	vSpecularIntensityMapUv = ( specularIntensityMapTransform * vec3( SPECULAR_INTENSITYMAP_UV, 1 ) ).xy;
2508#endif
2509#ifdef USE_TRANSMISSIONMAP
2510	vTransmissionMapUv = ( transmissionMapTransform * vec3( TRANSMISSIONMAP_UV, 1 ) ).xy;
2511#endif
2512#ifdef USE_THICKNESSMAP
2513	vThicknessMapUv = ( thicknessMapTransform * vec3( THICKNESSMAP_UV, 1 ) ).xy;
2514#endif`,M_=`#if defined( USE_ENVMAP ) || defined( DISTANCE ) || defined ( USE_SHADOWMAP ) || defined ( USE_TRANSMISSION ) || NUM_SPOT_LIGHT_COORDS > 0
2515	vec4 worldPosition = vec4( transformed, 1.0 );
2516	#ifdef USE_BATCHING
2517		worldPosition = batchingMatrix * worldPosition;
2518	#endif
2519	#ifdef USE_INSTANCING
2520		worldPosition = instanceMatrix * worldPosition;
2521	#endif
2522	worldPosition = modelMatrix * worldPosition;
2523#endif`;const S_=`varying vec2 vUv;
2524uniform mat3 uvTransform;
2525void main() {
2526	vUv = ( uvTransform * vec3( uv, 1 ) ).xy;
2527	gl_Position = vec4( position.xy, 1.0, 1.0 );
2528}`,b_=`uniform sampler2D t2D;
2529uniform float backgroundIntensity;
2530varying vec2 vUv;
2531void main() {
2532	vec4 texColor = texture2D( t2D, vUv );
2533	#ifdef DECODE_VIDEO_TEXTURE
2534		texColor = vec4( mix( pow( texColor.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), texColor.rgb * 0.0773993808, vec3( lessThanEqual( texColor.rgb, vec3( 0.04045 ) ) ) ), texColor.w );
2535	#endif
2536	texColor.rgb *= backgroundIntensity;
2537	gl_FragColor = texColor;
2538	#include <tonemapping_fragment>
2539	#include <colorspace_fragment>
2540}`,E_=`varying vec3 vWorldDirection;
2541#include <common>
2542void main() {
2543	vWorldDirection = transformDirection( position, modelMatrix );
2544	#include <begin_vertex>
2545	#include <project_vertex>
2546	gl_Position.z = gl_Position.w;
2547}`,T_=`#ifdef ENVMAP_TYPE_CUBE
2548	uniform samplerCube envMap;
2549#elif defined( ENVMAP_TYPE_CUBE_UV )
2550	uniform sampler2D envMap;
2551#endif
2552uniform float flipEnvMap;
2553uniform float backgroundBlurriness;
2554uniform float backgroundIntensity;
2555uniform mat3 backgroundRotation;
2556varying vec3 vWorldDirection;
2557#include <cube_uv_reflection_fragment>
2558void main() {
2559	#ifdef ENVMAP_TYPE_CUBE
2560		vec4 texColor = textureCube( envMap, backgroundRotation * vec3( flipEnvMap * vWorldDirection.x, vWorldDirection.yz ) );
2561	#elif defined( ENVMAP_TYPE_CUBE_UV )
2562		vec4 texColor = textureCubeUV( envMap, backgroundRotation * vWorldDirection, backgroundBlurriness );
2563	#else
2564		vec4 texColor = vec4( 0.0, 0.0, 0.0, 1.0 );
2565	#endif
2566	texColor.rgb *= backgroundIntensity;
2567	gl_FragColor = texColor;
2568	#include <tonemapping_fragment>
2569	#include <colorspace_fragment>
2570}`,A_=`varying vec3 vWorldDirection;
2571#include <common>
2572void main() {
2573	vWorldDirection = transformDirection( position, modelMatrix );
2574	#include <begin_vertex>
2575	#include <project_vertex>
2576	gl_Position.z = gl_Position.w;
2577}`,w_=`uniform samplerCube tCube;
2578uniform float tFlip;
2579uniform float opacity;
2580varying vec3 vWorldDirection;
2581void main() {
2582	vec4 texColor = textureCube( tCube, vec3( tFlip * vWorldDirection.x, vWorldDirection.yz ) );
2583	gl_FragColor = texColor;
2584	gl_FragColor.a *= opacity;
2585	#include <tonemapping_fragment>
2586	#include <colorspace_fragment>
2587}`,C_=`#include <common>
2588#include <batching_pars_vertex>
2589#include <uv_pars_vertex>
2590#include <displacementmap_pars_vertex>
2591#include <morphtarget_pars_vertex>
2592#include <skinning_pars_vertex>
2593#include <logdepthbuf_pars_vertex>
2594#include <clipping_planes_pars_vertex>
2595varying vec2 vHighPrecisionZW;
2596void main() {
2597	#include <uv_vertex>
2598	#include <batching_vertex>
2599	#include <skinbase_vertex>
2600	#include <morphinstance_vertex>
2601	#ifdef USE_DISPLACEMENTMAP
2602		#include <beginnormal_vertex>
2603		#include <morphnormal_vertex>
2604		#include <skinnormal_vertex>
2605	#endif
2606	#include <begin_vertex>
2607	#include <morphtarget_vertex>
2608	#include <skinning_vertex>
2609	#include <displacementmap_vertex>
2610	#include <project_vertex>
2611	#include <logdepthbuf_vertex>
2612	#include <clipping_planes_vertex>
2613	vHighPrecisionZW = gl_Position.zw;
2614}`,R_=`#if DEPTH_PACKING == 3200
2615	uniform float opacity;
2616#endif
2617#include <common>
2618#include <packing>
2619#include <uv_pars_fragment>
2620#include <map_pars_fragment>
2621#include <alphamap_pars_fragment>
2622#include <alphatest_pars_fragment>
2623#include <alphahash_pars_fragment>
2624#include <logdepthbuf_pars_fragment>
2625#include <clipping_planes_pars_fragment>
2626varying vec2 vHighPrecisionZW;
2627void main() {
2628	vec4 diffuseColor = vec4( 1.0 );
2629	#include <clipping_planes_fragment>
2630	#if DEPTH_PACKING == 3200
2631		diffuseColor.a = opacity;
2632	#endif
2633	#include <map_fragment>
2634	#include <alphamap_fragment>
2635	#include <alphatest_fragment>
2636	#include <alphahash_fragment>
2637	#include <logdepthbuf_fragment>
2638	#ifdef USE_REVERSEDEPTHBUF
2639		float fragCoordZ = vHighPrecisionZW[ 0 ] / vHighPrecisionZW[ 1 ];
2640	#else
2641		float fragCoordZ = 0.5 * vHighPrecisionZW[ 0 ] / vHighPrecisionZW[ 1 ] + 0.5;
2642	#endif
2643	#if DEPTH_PACKING == 3200
2644		gl_FragColor = vec4( vec3( 1.0 - fragCoordZ ), opacity );
2645	#elif DEPTH_PACKING == 3201
2646		gl_FragColor = packDepthToRGBA( fragCoordZ );
2647	#elif DEPTH_PACKING == 3202
2648		gl_FragColor = vec4( packDepthToRGB( fragCoordZ ), 1.0 );
2649	#elif DEPTH_PACKING == 3203
2650		gl_FragColor = vec4( packDepthToRG( fragCoordZ ), 0.0, 1.0 );
2651	#endif
2652}`,I_=`#define DISTANCE
2653varying vec3 vWorldPosition;
2654#include <common>
2655#include <batching_pars_vertex>
2656#include <uv_pars_vertex>
2657#include <displacementmap_pars_vertex>
2658#include <morphtarget_pars_vertex>
2659#include <skinning_pars_vertex>
2660#include <clipping_planes_pars_vertex>
2661void main() {
2662	#include <uv_vertex>
2663	#include <batching_vertex>
2664	#include <skinbase_vertex>
2665	#include <morphinstance_vertex>
2666	#ifdef USE_DISPLACEMENTMAP
2667		#include <beginnormal_vertex>
2668		#include <morphnormal_vertex>
2669		#include <skinnormal_vertex>
2670	#endif
2671	#include <begin_vertex>
2672	#include <morphtarget_vertex>
2673	#include <skinning_vertex>
2674	#include <displacementmap_vertex>
2675	#include <project_vertex>
2676	#include <worldpos_vertex>
2677	#include <clipping_planes_vertex>
2678	vWorldPosition = worldPosition.xyz;
2679}`,P_=`#define DISTANCE
2680uniform vec3 referencePosition;
2681uniform float nearDistance;
2682uniform float farDistance;
2683varying vec3 vWorldPosition;
2684#include <common>
2685#include <packing>
2686#include <uv_pars_fragment>
2687#include <map_pars_fragment>
2688#include <alphamap_pars_fragment>
2689#include <alphatest_pars_fragment>
2690#include <alphahash_pars_fragment>
2691#include <clipping_planes_pars_fragment>
2692void main () {
2693	vec4 diffuseColor = vec4( 1.0 );
2694	#include <clipping_planes_fragment>
2695	#include <map_fragment>
2696	#include <alphamap_fragment>
2697	#include <alphatest_fragment>
2698	#include <alphahash_fragment>
2699	float dist = length( vWorldPosition - referencePosition );
2700	dist = ( dist - nearDistance ) / ( farDistance - nearDistance );
2701	dist = saturate( dist );
2702	gl_FragColor = packDepthToRGBA( dist );
2703}`,L_=`varying vec3 vWorldDirection;
2704#include <common>
2705void main() {
2706	vWorldDirection = transformDirection( position, modelMatrix );
2707	#include <begin_vertex>
2708	#include <project_vertex>
2709}`,D_=`uniform sampler2D tEquirect;
2710varying vec3 vWorldDirection;
2711#include <common>
2712void main() {
2713	vec3 direction = normalize( vWorldDirection );
2714	vec2 sampleUV = equirectUv( direction );
2715	gl_FragColor = texture2D( tEquirect, sampleUV );
2716	#include <tonemapping_fragment>
2717	#include <colorspace_fragment>
2718}`,U_=`uniform float scale;
2719attribute float lineDistance;
2720varying float vLineDistance;
2721#include <common>
2722#include <uv_pars_vertex>
2723#include <color_pars_vertex>
2724#include <fog_pars_vertex>
2725#include <morphtarget_pars_vertex>
2726#include <logdepthbuf_pars_vertex>
2727#include <clipping_planes_pars_vertex>
2728void main() {
2729	vLineDistance = scale * lineDistance;
2730	#include <uv_vertex>
2731	#include <color_vertex>
2732	#include <morphinstance_vertex>
2733	#include <morphcolor_vertex>
2734	#include <begin_vertex>
2735	#include <morphtarget_vertex>
2736	#include <project_vertex>
2737	#include <logdepthbuf_vertex>
2738	#include <clipping_planes_vertex>
2739	#include <fog_vertex>
2740}`,N_=`uniform vec3 diffuse;
2741uniform float opacity;
2742uniform float dashSize;
2743uniform float totalSize;
2744varying float vLineDistance;
2745#include <common>
2746#include <color_pars_fragment>
2747#include <uv_pars_fragment>
2748#include <map_pars_fragment>
2749#include <fog_pars_fragment>
2750#include <logdepthbuf_pars_fragment>
2751#include <clipping_planes_pars_fragment>
2752void main() {
2753	vec4 diffuseColor = vec4( diffuse, opacity );
2754	#include <clipping_planes_fragment>
2755	if ( mod( vLineDistance, totalSize ) > dashSize ) {
2756		discard;
2757	}
2758	vec3 outgoingLight = vec3( 0.0 );
2759	#include <logdepthbuf_fragment>
2760	#include <map_fragment>
2761	#include <color_fragment>
2762	outgoingLight = diffuseColor.rgb;
2763	#include <opaque_fragment>
2764	#include <tonemapping_fragment>
2765	#include <colorspace_fragment>
2766	#include <fog_fragment>
2767	#include <premultiplied_alpha_fragment>
2768}`,F_=`#include <common>
2769#include <batching_pars_vertex>
2770#include <uv_pars_vertex>
2771#include <envmap_pars_vertex>
2772#include <color_pars_vertex>
2773#include <fog_pars_vertex>
2774#include <morphtarget_pars_vertex>
2775#include <skinning_pars_vertex>
2776#include <logdepthbuf_pars_vertex>
2777#include <clipping_planes_pars_vertex>
2778void main() {
2779	#include <uv_vertex>
2780	#include <color_vertex>
2781	#include <morphinstance_vertex>
2782	#include <morphcolor_vertex>
2783	#include <batching_vertex>
2784	#if defined ( USE_ENVMAP ) || defined ( USE_SKINNING )
2785		#include <beginnormal_vertex>
2786		#include <morphnormal_vertex>
2787		#include <skinbase_vertex>
2788		#include <skinnormal_vertex>
2789		#include <defaultnormal_vertex>
2790	#endif
2791	#include <begin_vertex>
2792	#include <morphtarget_vertex>
2793	#include <skinning_vertex>
2794	#include <project_vertex>
2795	#include <logdepthbuf_vertex>
2796	#include <clipping_planes_vertex>
2797	#include <worldpos_vertex>
2798	#include <envmap_vertex>
2799	#include <fog_vertex>
2800}`,O_=`uniform vec3 diffuse;
2801uniform float opacity;
2802#ifndef FLAT_SHADED
2803	varying vec3 vNormal;
2804#endif
2805#include <common>
2806#include <dithering_pars_fragment>
2807#include <color_pars_fragment>
2808#include <uv_pars_fragment>
2809#include <map_pars_fragment>
2810#include <alphamap_pars_fragment>
2811#include <alphatest_pars_fragment>
2812#include <alphahash_pars_fragment>
2813#include <aomap_pars_fragment>
2814#include <lightmap_pars_fragment>
2815#include <envmap_common_pars_fragment>
2816#include <envmap_pars_fragment>
2817#include <fog_pars_fragment>
2818#include <specularmap_pars_fragment>
2819#include <logdepthbuf_pars_fragment>
2820#include <clipping_planes_pars_fragment>
2821void main() {
2822	vec4 diffuseColor = vec4( diffuse, opacity );
2823	#include <clipping_planes_fragment>
2824	#include <logdepthbuf_fragment>
2825	#include <map_fragment>
2826	#include <color_fragment>
2827	#include <alphamap_fragment>
2828	#include <alphatest_fragment>
2829	#include <alphahash_fragment>
2830	#include <specularmap_fragment>
2831	ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );
2832	#ifdef USE_LIGHTMAP
2833		vec4 lightMapTexel = texture2D( lightMap, vLightMapUv );
2834		reflectedLight.indirectDiffuse += lightMapTexel.rgb * lightMapIntensity * RECIPROCAL_PI;
2835	#else
2836		reflectedLight.indirectDiffuse += vec3( 1.0 );
2837	#endif
2838	#include <aomap_fragment>
2839	reflectedLight.indirectDiffuse *= diffuseColor.rgb;
2840	vec3 outgoingLight = reflectedLight.indirectDiffuse;
2841	#include <envmap_fragment>
2842	#include <opaque_fragment>
2843	#include <tonemapping_fragment>
2844	#include <colorspace_fragment>
2845	#include <fog_fragment>
2846	#include <premultiplied_alpha_fragment>
2847	#include <dithering_fragment>
2848}`,B_=`#define LAMBERT
2849varying vec3 vViewPosition;
2850#include <common>
2851#include <batching_pars_vertex>
2852#include <uv_pars_vertex>
2853#include <displacementmap_pars_vertex>
2854#include <envmap_pars_vertex>
2855#include <color_pars_vertex>
2856#include <fog_pars_vertex>
2857#include <normal_pars_vertex>
2858#include <morphtarget_pars_vertex>
2859#include <skinning_pars_vertex>
2860#include <shadowmap_pars_vertex>
2861#include <logdepthbuf_pars_vertex>
2862#include <clipping_planes_pars_vertex>
2863void main() {
2864	#include <uv_vertex>
2865	#include <color_vertex>
2866	#include <morphinstance_vertex>
2867	#include <morphcolor_vertex>
2868	#include <batching_vertex>
2869	#include <beginnormal_vertex>
2870	#include <morphnormal_vertex>
2871	#include <skinbase_vertex>
2872	#include <skinnormal_vertex>
2873	#include <defaultnormal_vertex>
2874	#include <normal_vertex>
2875	#include <begin_vertex>
2876	#include <morphtarget_vertex>
2877	#include <skinning_vertex>
2878	#include <displacementmap_vertex>
2879	#include <project_vertex>
2880	#include <logdepthbuf_vertex>
2881	#include <clipping_planes_vertex>
2882	vViewPosition = - mvPosition.xyz;
2883	#include <worldpos_vertex>
2884	#include <envmap_vertex>
2885	#include <shadowmap_vertex>
2886	#include <fog_vertex>
2887}`,z_=`#define LAMBERT
2888uniform vec3 diffuse;
2889uniform vec3 emissive;
2890uniform float opacity;
2891#include <common>
2892#include <packing>
2893#include <dithering_pars_fragment>
2894#include <color_pars_fragment>
2895#include <uv_pars_fragment>
2896#include <map_pars_fragment>
2897#include <alphamap_pars_fragment>
2898#include <alphatest_pars_fragment>
2899#include <alphahash_pars_fragment>
2900#include <aomap_pars_fragment>
2901#include <lightmap_pars_fragment>
2902#include <emissivemap_pars_fragment>
2903#include <envmap_common_pars_fragment>
2904#include <envmap_pars_fragment>
2905#include <fog_pars_fragment>
2906#include <bsdfs>
2907#include <lights_pars_begin>
2908#include <normal_pars_fragment>
2909#include <lights_lambert_pars_fragment>
2910#include <shadowmap_pars_fragment>
2911#include <bumpmap_pars_fragment>
2912#include <normalmap_pars_fragment>
2913#include <specularmap_pars_fragment>
2914#include <logdepthbuf_pars_fragment>
2915#include <clipping_planes_pars_fragment>
2916void main() {
2917	vec4 diffuseColor = vec4( diffuse, opacity );
2918	#include <clipping_planes_fragment>
2919	ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );
2920	vec3 totalEmissiveRadiance = emissive;
2921	#include <logdepthbuf_fragment>
2922	#include <map_fragment>
2923	#include <color_fragment>
2924	#include <alphamap_fragment>
2925	#include <alphatest_fragment>
2926	#include <alphahash_fragment>
2927	#include <specularmap_fragment>
2928	#include <normal_fragment_begin>
2929	#include <normal_fragment_maps>
2930	#include <emissivemap_fragment>
2931	#include <lights_lambert_fragment>
2932	#include <lights_fragment_begin>
2933	#include <lights_fragment_maps>
2934	#include <lights_fragment_end>
2935	#include <aomap_fragment>
2936	vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;
2937	#include <envmap_fragment>
2938	#include <opaque_fragment>
2939	#include <tonemapping_fragment>
2940	#include <colorspace_fragment>
2941	#include <fog_fragment>
2942	#include <premultiplied_alpha_fragment>
2943	#include <dithering_fragment>
2944}`,k_=`#define MATCAP
2945varying vec3 vViewPosition;
2946#include <common>
2947#include <batching_pars_vertex>
2948#include <uv_pars_vertex>
2949#include <color_pars_vertex>
2950#include <displacementmap_pars_vertex>
2951#include <fog_pars_vertex>
2952#include <normal_pars_vertex>
2953#include <morphtarget_pars_vertex>
2954#include <skinning_pars_vertex>
2955#include <logdepthbuf_pars_vertex>
2956#include <clipping_planes_pars_vertex>
2957void main() {
2958	#include <uv_vertex>
2959	#include <color_vertex>
2960	#include <morphinstance_vertex>
2961	#include <morphcolor_vertex>
2962	#include <batching_vertex>
2963	#include <beginnormal_vertex>
2964	#include <morphnormal_vertex>
2965	#include <skinbase_vertex>
2966	#include <skinnormal_vertex>
2967	#include <defaultnormal_vertex>
2968	#include <normal_vertex>
2969	#include <begin_vertex>
2970	#include <morphtarget_vertex>
2971	#include <skinning_vertex>
2972	#include <displacementmap_vertex>
2973	#include <project_vertex>
2974	#include <logdepthbuf_vertex>
2975	#include <clipping_planes_vertex>
2976	#include <fog_vertex>
2977	vViewPosition = - mvPosition.xyz;
2978}`,V_=`#define MATCAP
2979uniform vec3 diffuse;
2980uniform float opacity;
2981uniform sampler2D matcap;
2982varying vec3 vViewPosition;
2983#include <common>
2984#include <dithering_pars_fragment>
2985#include <color_pars_fragment>
2986#include <uv_pars_fragment>
2987#include <map_pars_fragment>
2988#include <alphamap_pars_fragment>
2989#include <alphatest_pars_fragment>
2990#include <alphahash_pars_fragment>
2991#include <fog_pars_fragment>
2992#include <normal_pars_fragment>
2993#include <bumpmap_pars_fragment>
2994#include <norm
2994almap_pars_fragment>
2995#include <logdepthbuf_pars_fragment>
2996#include <clipping_planes_pars_fragment>
2997void main() {
2998	vec4 diffuseColor = vec4( diffuse, opacity );
2999	#include <clipping_planes_fragment>
3000	#include <logdepthbuf_fragment>
3001	#include <map_fragment>
3002	#include <color_fragment>
3003	#include <alphamap_fragment>
3004	#include <alphatest_fragment>
3005	#include <alphahash_fragment>
3006	#include <normal_fragment_begin>
3007	#include <normal_fragment_maps>
3008	vec3 viewDir = normalize( vViewPosition );
3009	vec3 x = normalize( vec3( viewDir.z, 0.0, - viewDir.x ) );
3010	vec3 y = cross( viewDir, x );
3011	vec2 uv = vec2( dot( x, normal ), dot( y, normal ) ) * 0.495 + 0.5;
3012	#ifdef USE_MATCAP
3013		vec4 matcapColor = texture2D( matcap, uv );
3014	#else
3015		vec4 matcapColor = vec4( vec3( mix( 0.2, 0.8, uv.y ) ), 1.0 );
3016	#endif
3017	vec3 outgoingLight = diffuseColor.rgb * matcapColor.rgb;
3018	#include <opaque_fragment>
3019	#include <tonemapping_fragment>
3020	#include <colorspace_fragment>
3021	#include <fog_fragment>
3022	#include <premultiplied_alpha_fragment>
3023	#include <dithering_fragment>
3024}`,H_=`#define NORMAL
3025#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE )
3026	varying vec3 vViewPosition;
3027#endif
3028#include <common>
3029#include <batching_pars_vertex>
3030#include <uv_pars_vertex>
3031#include <displacementmap_pars_vertex>
3032#include <normal_pars_vertex>
3033#include <morphtarget_pars_vertex>
3034#include <skinning_pars_vertex>
3035#include <logdepthbuf_pars_vertex>
3036#include <clipping_planes_pars_vertex>
3037void main() {
3038	#include <uv_vertex>
3039	#include <batching_vertex>
3040	#include <beginnormal_vertex>
3041	#include <morphinstance_vertex>
3042	#include <morphnormal_vertex>
3043	#include <skinbase_vertex>
3044	#include <skinnormal_vertex>
3045	#include <defaultnormal_vertex>
3046	#include <normal_vertex>
3047	#include <begin_vertex>
3048	#include <morphtarget_vertex>
3049	#include <skinning_vertex>
3050	#include <displacementmap_vertex>
3051	#include <project_vertex>
3052	#include <logdepthbuf_vertex>
3053	#include <clipping_planes_vertex>
3054#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE )
3055	vViewPosition = - mvPosition.xyz;
3056#endif
3057}`,G_=`#define NORMAL
3058uniform float opacity;
3059#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE )
3060	varying vec3 vViewPosition;
3061#endif
3062#include <packing>
3063#include <uv_pars_fragment>
3064#include <normal_pars_fragment>
3065#include <bumpmap_pars_fragment>
3066#include <normalmap_pars_fragment>
3067#include <logdepthbuf_pars_fragment>
3068#include <clipping_planes_pars_fragment>
3069void main() {
3070	vec4 diffuseColor = vec4( 0.0, 0.0, 0.0, opacity );
3071	#include <clipping_planes_fragment>
3072	#include <logdepthbuf_fragment>
3073	#include <normal_fragment_begin>
3074	#include <normal_fragment_maps>
3075	gl_FragColor = vec4( packNormalToRGB( normal ), diffuseColor.a );
3076	#ifdef OPAQUE
3077		gl_FragColor.a = 1.0;
3078	#endif
3079}`,W_=`#define PHONG
3080varying vec3 vViewPosition;
3081#include <common>
3082#include <batching_pars_vertex>
3083#include <uv_pars_vertex>
3084#include <displacementmap_pars_vertex>
3085#include <envmap_pars_vertex>
3086#include <color_pars_vertex>
3087#include <fog_pars_vertex>
3088#include <normal_pars_vertex>
3089#include <morphtarget_pars_vertex>
3090#include <skinning_pars_vertex>
3091#include <shadowmap_pars_vertex>
3092#include <logdepthbuf_pars_vertex>
3093#include <clipping_planes_pars_vertex>
3094void main() {
3095	#include <uv_vertex>
3096	#include <color_vertex>
3097	#include <morphcolor_vertex>
3098	#include <batching_vertex>
3099	#include <beginnormal_vertex>
3100	#include <morphinstance_vertex>
3101	#include <morphnormal_vertex>
3102	#include <skinbase_vertex>
3103	#include <skinnormal_vertex>
3104	#include <defaultnormal_vertex>
3105	#include <normal_vertex>
3106	#include <begin_vertex>
3107	#include <morphtarget_vertex>
3108	#include <skinning_vertex>
3109	#include <displacementmap_vertex>
3110	#include <project_vertex>
3111	#include <logdepthbuf_vertex>
3112	#include <clipping_planes_vertex>
3113	vViewPosition = - mvPosition.xyz;
3114	#include <worldpos_vertex>
3115	#include <envmap_vertex>
3116	#include <shadowmap_vertex>
3117	#include <fog_vertex>
3118}`,X_=`#define PHONG
3119uniform vec3 diffuse;
3120uniform vec3 emissive;
3121uniform vec3 specular;
3122uniform float shininess;
3123uniform float opacity;
3124#include <common>
3125#include <packing>
3126#include <dithering_pars_fragment>
3127#include <color_pars_fragment>
3128#include <uv_pars_fragment>
3129#include <map_pars_fragment>
3130#include <alphamap_pars_fragment>
3131#include <alphatest_pars_fragment>
3132#include <alphahash_pars_fragment>
3133#include <aomap_pars_fragment>
3134#include <lightmap_pars_fragment>
3135#include <emissivemap_pars_fragment>
3136#include <envmap_common_pars_fragment>
3137#include <envmap_pars_fragment>
3138#include <fog_pars_fragment>
3139#include <bsdfs>
3140#include <lights_pars_begin>
3141#include <normal_pars_fragment>
3142#include <lights_phong_pars_fragment>
3143#include <shadowmap_pars_fragment>
3144#include <bumpmap_pars_fragment>
3145#include <normalmap_pars_fragment>
3146#include <specularmap_pars_fragment>
3147#include <logdepthbuf_pars_fragment>
3148#include <clipping_planes_pars_fragment>
3149void main() {
3150	vec4 diffuseColor = vec4( diffuse, opacity );
3151	#include <clipping_planes_fragment>
3152	ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );
3153	vec3 totalEmissiveRadiance = emissive;
3154	#include <logdepthbuf_fragment>
3155	#include <map_fragment>
3156	#include <color_fragment>
3157	#include <alphamap_fragment>
3158	#include <alphatest_fragment>
3159	#include <alphahash_fragment>
3160	#include <specularmap_fragment>
3161	#include <normal_fragment_begin>
3162	#include <normal_fragment_maps>
3163	#include <emissivemap_fragment>
3164	#include <lights_phong_fragment>
3165	#include <lights_fragment_begin>
3166	#include <lights_fragment_maps>
3167	#include <lights_fragment_end>
3168	#include <aomap_fragment>
3169	vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveRadiance;
3170	#include <envmap_fragment>
3171	#include <opaque_fragment>
3172	#include <tonemapping_fragment>
3173	#include <colorspace_fragment>
3174	#include <fog_fragment>
3175	#include <premultiplied_alpha_fragment>
3176	#include <dithering_fragment>
3177}`,q_=`#define STANDARD
3178varying vec3 vViewPosition;
3179#ifdef USE_TRANSMISSION
3180	varying vec3 vWorldPosition;
3181#endif
3182#include <common>
3183#include <batching_pars_vertex>
3184#include <uv_pars_vertex>
3185#include <displacementmap_pars_vertex>
3186#include <color_pars_vertex>
3187#include <fog_pars_vertex>
3188#include <normal_pars_vertex>
3189#include <morphtarget_pars_vertex>
3190#include <skinning_pars_vertex>
3191#include <shadowmap_pars_vertex>
3192#include <logdepthbuf_pars_vertex>
3193#include <clipping_planes_pars_vertex>
3194void main() {
3195	#include <uv_vertex>
3196	#include <color_vertex>
3197	#include <morphinstance_vertex>
3198	#include <morphcolor_vertex>
3199	#include <batching_vertex>
3200	#include <beginnormal_vertex>
3201	#include <morphnormal_vertex>
3202	#include <skinbase_vertex>
3203	#include <skinnormal_vertex>
3204	#include <defaultnormal_vertex>
3205	#include <normal_vertex>
3206	#include <begin_vertex>
3207	#include <morphtarget_vertex>
3208	#include <skinning_vertex>
3209	#include <displacementmap_vertex>
3210	#include <project_vertex>
3211	#include <logdepthbuf_vertex>
3212	#include <clipping_planes_vertex>
3213	vViewPosition = - mvPosition.xyz;
3214	#include <worldpos_vertex>
3215	#include <shadowmap_vertex>
3216	#include <fog_vertex>
3217#ifdef USE_TRANSMISSION
3218	vWorldPosition = worldPosition.xyz;
3219#endif
3220}`,Y_=`#define STANDARD
3221#ifdef PHYSICAL
3222	#define IOR
3223	#define USE_SPECULAR
3224#endif
3225uniform vec3 diffuse;
3226uniform vec3 emissive;
3227uniform float roughness;
3228uniform float metalness;
3229uniform float opacity;
3230#ifdef IOR
3231	uniform float ior;
3232#endif
3233#ifdef USE_SPECULAR
3234	uniform float specularIntensity;
3235	uniform vec3 specularColor;
3236	#ifdef USE_SPECULAR_COLORMAP
3237		uniform sampler2D specularColorMap;
3238	#endif
3239	#ifdef USE_SPECULAR_INTENSITYMAP
3240		uniform sampler2D specularIntensityMap;
3241	#endif
3242#endif
3243#ifdef USE_CLEARCOAT
3244	uniform float clearcoat;
3245	uniform float clearcoatRoughness;
3246#endif
3247#ifdef USE_DISPERSION
3248	uniform float dispersion;
3249#endif
3250#ifdef USE_IRIDESCENCE
3251	uniform float iridescence;
3252	uniform float iridescenceIOR;
3253	uniform float iridescenceThicknessMinimum;
3254	uniform float iridescenceThicknessMaximum;
3255#endif
3256#ifdef USE_SHEEN
3257	uniform vec3 sheenColor;
3258	uniform float sheenRoughness;
3259	#ifdef USE_SHEEN_COLORMAP
3260		uniform sampler2D sheenColorMap;
3261	#endif
3262	#ifdef USE_SHEEN_ROUGHNESSMAP
3263		uniform sampler2D sheenRoughnessMap;
3264	#endif
3265#endif
3266#ifdef USE_ANISOTROPY
3267	uniform vec2 anisotropyVector;
3268	#ifdef USE_ANISOTROPYMAP
3269		uniform sampler2D anisotropyMap;
3270	#endif
3271#endif
3272varying vec3 vViewPosition;
3273#include <common>
3274#include <packing>
3275#include <dithering_pars_fragment>
3276#include <color_pars_fragment>
3277#include <uv_pars_fragment>
3278#include <map_pars_fragment>
3279#include <alphamap_pars_fragment>
3280#include <alphatest_pars_fragment>
3281#include <alphahash_pars_fragment>
3282#include <aomap_pars_fragment>
3283#include <lightmap_pars_fragment>
3284#include <emissivemap_pars_fragment>
3285#include <iridescence_fragment>
3286#include <cube_uv_reflection_fragment>
3287#include <envmap_common_pars_fragment>
3288#include <envmap_physical_pars_fragment>
3289#include <fog_pars_fragment>
3290#include <lights_pars_begin>
3291#include <normal_pars_fragment>
3292#include <lights_physical_pars_fragment>
3293#include <transmission_pars_fragment>
3294#include <shadowmap_pars_fragment>
3295#include <bumpmap_pars_fragment>
3296#include <normalmap_pars_fragment>
3297#include <clearcoat_pars_fragment>
3298#include <iridescence_pars_fragment>
3299#include <roughnessmap_pars_fragment>
3300#include <metalnessmap_pars_fragment>
3301#include <logdepthbuf_pars_fragment>
3302#include <clipping_planes_pars_fragment>
3303void main() {
3304	vec4 diffuseColor = vec4( diffuse, opacity );
3305	#include <clipping_planes_fragment>
3306	ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );
3307	vec3 totalEmissiveRadiance = emissive;
3308	#include <logdepthbuf_fragment>
3309	#include <map_fragment>
3310	#include <color_fragment>
3311	#include <alphamap_fragment>
3312	#include <alphatest_fragment>
3313	#include <alphahash_fragment>
3314	#include <roughnessmap_fragment>
3315	#include <metalnessmap_fragment>
3316	#include <normal_fragment_begin>
3317	#include <normal_fragment_maps>
3318	#include <clearcoat_normal_fragment_begin>
3319	#include <clearcoat_normal_fragment_maps>
3320	#include <emissivemap_fragment>
3321	#include <lights_physical_fragment>
3322	#include <lights_fragment_begin>
3323	#include <lights_fragment_maps>
3324	#include <lights_fragment_end>
3325	#include <aomap_fragment>
3326	vec3 totalDiffuse = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse;
3327	vec3 totalSpecular = reflectedLight.directSpecular + reflectedLight.indirectSpecular;
3328	#include <transmission_fragment>
3329	vec3 outgoingLight = totalDiffuse + totalSpecular + totalEmissiveRadiance;
3330	#ifdef USE_SHEEN
3331		float sheenEnergyComp = 1.0 - 0.157 * max3( material.sheenColor );
3332		outgoingLight = outgoingLight * sheenEnergyComp + sheenSpecularDirect + sheenSpecularIndirect;
3333	#endif
3334	#ifdef USE_CLEARCOAT
3335		float dotNVcc = saturate( dot( geometryClearcoatNormal, geometryViewDir ) );
3336		vec3 Fcc = F_Schlick( material.clearcoatF0, material.clearcoatF90, dotNVcc );
3337		outgoingLight = outgoingLight * ( 1.0 - material.clearcoat * Fcc ) + ( clearcoatSpecularDirect + clearcoatSpecularIndirect ) * material.clearcoat;
3338	#endif
3339	#include <opaque_fragment>
3340	#include <tonemapping_fragment>
3341	#include <colorspace_fragment>
3342	#include <fog_fragment>
3343	#include <premultiplied_alpha_fragment>
3344	#include <dithering_fragment>
3345}`,Z_=`#define TOON
3346varying vec3 vViewPosition;
3347#include <common>
3348#include <batching_pars_vertex>
3349#include <uv_pars_vertex>
3350#include <displacementmap_pars_vertex>
3351#include <color_pars_vertex>
3352#include <fog_pars_vertex>
3353#include <normal_pars_vertex>
3354#include <morphtarget_pars_vertex>
3355#include <skinning_pars_vertex>
3356#include <shadowmap_pars_vertex>
3357#include <logdepthbuf_pars_vertex>
3358#include <clipping_planes_pars_vertex>
3359void main() {
3360	#include <uv_vertex>
3361	#include <color_vertex>
3362	#include <morphinstance_vertex>
3363	#include <morphcolor_vertex>
3364	#include <batching_vertex>
3365	#include <beginnormal_vertex>
3366	#include <morphnormal_vertex>
3367	#include <skinbase_vertex>
3368	#include <skinnormal_vertex>
3369	#include <defaultnormal_vertex>
3370	#include <normal_vertex>
3371	#include <begin_vertex>
3372	#include <morphtarget_vertex>
3373	#include <skinning_vertex>
3374	#include <displacementmap_vertex>
3375	#include <project_vertex>
3376	#include <logdepthbuf_vertex>
3377	#include <clipping_planes_vertex>
3378	vViewPosition = - mvPosition.xyz;
3379	#include <worldpos_vertex>
3380	#include <shadowmap_vertex>
3381	#include <fog_vertex>
3382}`,J_=`#define TOON
3383uniform vec3 diffuse;
3384uniform vec3 emissive;
3385uniform float opacity;
3386#include <common>
3387#include <packing>
3388#include <dithering_pars_fragment>
3389#include <color_pars_fragment>
3390#include <uv_pars_fragment>
3391#include <map_pars_fragment>
3392#include <alphamap_pars_fragment>
3393#include <alphatest_pars_fragment>
3394#include <alphahash_pars_fragment>
3395#include <aomap_pars_fragment>
3396#include <lightmap_pars_fragment>
3397#include <emissivemap_pars_fragment>
3398#include <gradientmap_pars_fragment>
3399#include <fog_pars_fragment>
3400#include <bsdfs>
3401#include <lights_pars_begin>
3402#include <normal_pars_fragment>
3403#include <lights_toon_pars_fragment>
3404#include <shadowmap_pars_fragment>
3405#include <bumpmap_pars_fragment>
3406#include <normalmap_pars_fragment>
3407#include <logdepthbuf_pars_fragment>
3408#include <clipping_planes_pars_fragment>
3409void main() {
3410	vec4 diffuseColor = vec4( diffuse, opacity );
3411	#include <clipping_planes_fragment>
3412	ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );
3413	vec3 totalEmissiveRadiance = emissive;
3414	#include <logdepthbuf_fragment>
3415	#include <map_fragment>
3416	#include <color_fragment>
3417	#include <alphamap_fragment>
3418	#include <alphatest_fragment>
3419	#include <alphahash_fragment>
3420	#include <normal_fragment_begin>
3421	#include <normal_fragment_maps>
3422	#include <emissivemap_fragment>
3423	#include <lights_toon_fragment>
3424	#include <lights_fragment_begin>
3425	#include <lights_fragment_maps>
3426	#include <lights_fragment_end>
3427	#include <aomap_fragment>
3428	vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;
3429	#include <opaque_fragment>
3430	#include <tonemapping_fragment>
3431	#include <colorspace_fragment>
3432	#include <fog_fragment>
3433	#include <premultiplied_alpha_fragment>
3434	#include <dithering_fragment>
3435}`,$_=`uniform float size;
3436uniform float scale;
3437#include <common>
3438#include <color_pars_vertex>
3439#include <fog_pars_vertex>
3440#include <morphtarget_pars_vertex>
3441#include <logdepthbuf_pars_vertex>
3442#include <clipping_planes_pars_vertex>
3443#ifdef USE_POINTS_UV
3444	varying vec2 vUv;
3445	uniform mat3 uvTransform;
3446#endif
3447void main() {
3448	#ifdef USE_POINTS_UV
3449		vUv = ( uvTransform * vec3( uv, 1 ) ).xy;
3450	#endif
3451	#include <color_vertex>
3452	#include <morphinstance_vertex>
3453	#include <morphcolor_vertex>
3454	#include <begin_vertex>
3455	#include <morphtarget_vertex>
3456	#include <project_vertex>
3457	gl_PointSize = size;
3458	#ifdef USE_SIZEATTENUATION
3459		bool isPerspective = isPerspectiveMatrix( projectionMatrix );
3460		if ( isPerspective ) gl_PointSize *= ( scale / - mvPosition.z );
3461	#endif
3462	#include <logdepthbuf_vertex>
3463	#include <clipping_planes_vertex>
3464	#include <worldpos_vertex>
3465	#include <fog_vertex>
3466}`,K_=`uniform vec3 diffuse;
3467uniform float opacity;
3468#include <common>
3469#include <color_pars_fragment>
3470#include <map_particle_pars_fragment>
3471#include <alphatest_pars_fragment>
3472#include <alphahash_pars_fragment>
3473#include <fog_pars_fragment>
3474#include <logdepthbuf_pars_fragment>
3475#include <clipping_planes_pars_fragment>
3476void main() {
3477	vec4 diffuseColor = vec4( diffuse, opacity );
3478	#include <clipping_planes_fragment>
3479	vec3 outgoingLight = vec3( 0.0 );
3480	#include <logdepthbuf_fragment>
3481	#include <map_particle_fragment>
3482	#include <color_fragment>
3483	#include <alphatest_fragment>
3484	#include <alphahash_fragment>
3485	outgoingLight = diffuseColor.rgb;
3486	#include <opaque_fragment>
3487	#include <tonemapping_fragment>
3488	#include <colorspace_fragment>
3489	#include <fog_fragment>
3490	#include <premultiplied_alpha_fragment>
3491}`,Q_=`#include <common>
3492#include <batching_pars_vertex>
3493#include <fog_pars_vertex>
3494#include <morphtarget_pars_vertex>
3495#include <skinning_pars_vertex>
3496#include <logdepthbuf_pars_vertex>
3497#include <shadowmap_pars_vertex>
3498void main() {
3499	#include <batching_vertex>
3500	#include <beginnormal_vertex>
3501	#include <morphinstance_vertex>
3502	#include <morphnormal_vertex>
3503	#include <skinbase_vertex>
3504	#include <skinnormal_vertex>
3505	#include <defaultnormal_vertex>
3506	#include <begin_vertex>
3507	#include <morphtarget_vertex>
3508	#include <skinning_vertex>
3509	#include <project_vertex>
3510	#include <logdepthbuf_vertex>
3511	#include <worldpos_vertex>
3512	#include <shadowmap_vertex>
3513	#include <fog_vertex>
3514}`,j_=`uniform vec3 color;
3515uniform float opacity;
3516#include <common>
3517#include <packing>
3518#include <fog_pars_fragment>
3519#include <bsdfs>
3520#include <lights_pars_begin>
3521#include <logdepthbuf_pars_fragment>
3522#include <shadowmap_pars_fragment>
3523#include <shadowmask_pars_fragment>
3524void main() {
3525	#include <logdepthbuf_fragment>
3526	gl_FragColor = vec4( color, opacity * ( 1.0 - getShadowMask() ) );
3527	#include <tonemapping_fragment>
3528	#include <colorspace_fragment>
3529	#include <fog_fragment>
3530}`,t0=`uniform float rotation;
3531uniform vec2 center;
3532#include <common>
3533#include <uv_pars_vertex>
3534#include <fog_pars_vertex>
3535#include <logdepthbuf_pars_vertex>
3536#include <clipping_planes_pars_vertex>
3537void main() {
3538	#include <uv_vertex>
3539	vec4 mvPosition = modelViewMatrix[ 3 ];
3540	vec2 scale = vec2( length( modelMatrix[ 0 ].xyz ), length( modelMatrix[ 1 ].xyz ) );
3541	#ifndef USE_SIZEATTENUATION
3542		bool isPerspective = isPerspectiveMatrix( projectionMatrix );
3543		if ( isPerspective ) scale *= - mvPosition.z;
3544	#endif
3545	vec2 alignedPosition = ( position.xy - ( center - vec2( 0.5 ) ) ) * scale;
3546	vec2 rotatedPosition;
3547	rotatedPosition.x = cos( rotation ) * alignedPosition.x - sin( rotation ) * alignedPosition.y;
3548	rotatedPosition.y = sin( rotation ) * alignedPosition.x + cos( rotation ) * alignedPosition.y;
3549	mvPosition.xy += rotatedPosition;
3550	gl_Position = projectionMatrix * mvPosition;
3551	#include <logdepthbuf_vertex>
3552	#include <clipping_planes_vertex>
3553	#include <fog_vertex>
3554}`,e0=`uniform vec3 diffuse;
3555uniform float opacity;
3556#include <common>
3557#include <uv_pars_fragment>
3558#include <map_pars_fragment>
3559#include <alphamap_pars_fragment>
3560#include <alphatest_pars_fragment>
3561#include <alphahash_pars_fragment>
3562#include <fog_pars_fragment>
3563#include <logdepthbuf_pars_fragment>
3564#include <clipping_planes_pars_fragment>
3565void main() {
3566	vec4 diffuseColor = vec4( diffuse, opacity );
3567	#include <clipping_planes_fragment>
3568	vec3 outgoingLight = vec3( 0.0 );
3569	#include <logdepthbuf_fragment>
3570	#include <map_fragment>
3571	#include <alphamap_fragment>
3572	#include <alphatest_fragment>
3573	#include <alphahash_fragment>
3574	outgoingLight = diffuseColor.rgb;
3575	#include <opaque_fragment>
3576	#include <tonemapping_fragment>
3577	#include <colorspace_fragment>
3578	#include <fog_fragment>
3579}`,Jt={alphahash_fragment:bm,alphahash_pars_fragment:Em,alphamap_fragment:Tm,alphamap_pars_fragment:Am,alphatest_fragment:wm,alphatest_pars_fragment:Cm,aomap_fragment:Rm,aomap_pars_fragment:Im,batching_pars_vertex:Pm,batching_vertex:Lm,begin_vertex:Dm,beginnormal_vertex:Um,bsdfs:Nm,iridescence_fragment:Fm,bumpmap_pars_fragment:Om,clipping_planes_fragment:Bm,clipping_planes_pars_fragment:zm,clipping_planes_pars_vertex:km,clipping_planes_vertex:Vm,color_fragment:Hm,color_pars_fragment:Gm,color_pars_vertex:Wm,color_vertex:Xm,common:qm,cube_uv_reflection_fragment:Ym,defaultnormal_vertex:Zm,displacementmap_pars_vertex:Jm,displacementmap_vertex:$m,emissivemap_fragment:Km,emissivemap_pars_fragment:Qm,colorspace_fragment:jm,colorspace_pars_fragment:tg,envmap_fragment:eg,envmap_common_pars_fragment:ng,envmap_pars_fragment:ig,envmap_pars_vertex:sg,envmap_physical_pars_fragment:mg,envmap_vertex:rg,fog_vertex:ag,fog_pars_vertex:og,fog_fragment:lg,fog_pars_fragment:cg,gradientmap_pars_fragment:hg,lightmap_pars_fragment:ug,lights_lambert_fragment:dg,lights_lambert_pars_fragment:fg,lights_pars_begin:pg,lights_toon_fragment:gg,lights_toon_pars_fragment:_g,lights_phong_fragment:xg,lights_phong_pars_fragment:vg,lights_physical_fragment:yg,lights_physical_pars_fragment:Mg,lights_fragment_begin:Sg,lights_fragment_maps:bg,lights_fragment_end:Eg,logdepthbuf_fragment:Tg,logdepthbuf_pars_fragment:Ag,logdepthbuf_pars_vertex:wg,logdepthbuf_vertex:Cg,map_fragment:Rg,map_pars_fragment:Ig,map_particle_fragment:Pg,map_particle_pars_fragment:Lg,metalnessmap_fragment:Dg,metalnessmap_pars_fragment:Ug,morphinstance_vertex:Ng,morphcolor_vertex:Fg,morphnormal_vertex:Og,morphtarget_pars_vertex:Bg,morphtarget_vertex:zg,normal_fragment_begin:kg,normal_fragment_maps:Vg,normal_pars_fragment:Hg,normal_pars_vertex:Gg,normal_vertex:Wg,normalmap_pars_fragment:Xg,clearcoat_normal_fragment_begin:qg,clearcoat_normal_fragment_maps:Yg,clearcoat_pars_fragment:Zg,iridescence_pars_fragment:Jg,opaque_fragment:$g,packing:Kg,premultiplied_alpha_fragment:Qg,project_vertex:jg,dithering_fragment:t_,dithering_pars_fragment:e_,roughnessmap_fragment:n_,roughnessmap_pars_fragment:i_,shadowmap_pars_fragment:s_,shadowmap_pars_vertex:r_,shadowmap_vertex:a_,shadowmask_pars_fragment:o_,skinbase_vertex:l_,skinning_pars_vertex:c_,skinning_vertex:h_,skinnormal_vertex:u_,specularmap_fragment:d_,specularmap_pars_fragment:f_,tonemapping_fragment:p_,tonemapping_pars_fragment:m_,transmission_fragment:g_,transmission_pars_fragment:__,uv_pars_fragment:x_,uv_pars_vertex:v_,uv_vertex:y_,worldpos_vertex:M_,background_vert:S_,background_frag:b_,backgroundCube_vert:E_,backgroundCube_frag:T_,cube_vert:A_,cube_frag:w_,depth_vert:C_,depth_frag:R_,distanceRGBA_vert:I_,distanceRGBA_frag:P_,equirect_vert:L_,equirect_frag:D_,linedashed_vert:U_,linedashed_frag:N_,meshbasic_vert:F_,meshbasic_frag:O_,meshlambert_vert:B_,meshlambert_frag:z_,meshmatcap_vert:k_,meshmatcap_frag:V_,meshnormal_vert:H_,meshnormal_frag:G_,meshphong_vert:W_,meshphong_frag:X_,meshphysical_vert:q_,meshphysical_frag:Y_,meshtoon_vert:Z_,meshtoon_frag:J_,points_vert:$_,points_frag:K_,shadow_vert:Q_,shadow_frag:j_,sprite_vert:t0,sprite_frag:e0},pt={common:{diffuse:{value:new vt(16777215)},opacity:{value:1},map:{value:null},mapTransform:{value:new Xt},alphaMap:{value:null},alphaMapTransform:{value:new Xt},alphaTest:{value:0}},specularmap:{specularMap:{value:null},specularMapTransform:{value:new Xt}},envmap:{envMap:{value:null},envMapRotation:{value:new Xt},flipEnvMap:{value:-1},reflectivity:{value:1},ior:{value:1.5},refractionRatio:{value:.98}},aomap:{aoMap:{value:null},aoMapIntensity:{value:1},aoMapTransform:{value:new Xt}},lightmap:{lightMap:{value:null},lightMapIntensity:{value:1},lightMapTransform:{value:new Xt}},bumpmap:{bumpMap:{value:null},bumpMapTransform:{value:new Xt},bumpScale:{value:1}},normalmap:{normalMap:{value:null},normalMapTransform:{value:new Xt},normalScale:{value:new K(1,1)}}
vendor: 7,098 bytes, line 3579
3579,displacementmap:{displacementMap:{value:null},displacementMapTransform:{value:new Xt},displacementScale:{value:1},displacementBias:{value:0}},emissivemap:{emissiveMap:{value:null},emissiveMapTransform:{value:new Xt}},metalnessmap:{metalnessMap:{value:null},metalnessMapTransform:{value:new Xt}},roughnessmap:{roughnessMap:{value:null},roughnessMapTransform:{value:new Xt}},gradientmap:{gradientMap:{value:null}},fog:{fogDensity:{value:25e-5},fogNear:{value:1},fogFar:{value:2e3},fogColor:{value:new vt(16777215)}},lights:{ambientLightColor:{value:[]},lightProbe:{value:[]},directionalLights:{value:[],properties:{direction:{},color:{}}},directionalLightShadows:{value:[],properties:{shadowIntensity:1,shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},directionalShadowMap:{value:[]},directionalShadowMatrix:{value:[]},spotLights:{value:[],properties:{color:{},position:{},direction:{},distance:{},coneCos:{},penumbraCos:{},decay:{}}},spotLightShadows:{value:[],properties:{shadowIntensity:1,shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},spotLightMap:{value:[]},spotShadowMap:{value:[]},spotLightMatrix:{value:[]},pointLights:{value:[],properties:{color:{},position:{},decay:{},distance:{}}},pointLightShadows:{value:[],properties:{shadowIntensity:1,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 vt(16777215)},opacity:{value:1},size:{value:1},scale:{value:1},map:{value:null},alphaMap:{value:null},alphaMapTransform:{value:new Xt},alphaTest:{value:0},uvTransform:{value:new Xt}},sprite:{diffuse:{value:new vt(16777215)},opacity:{value:1},center:{value:new K(.5,.5)},rotation:{value:0},map:{value:null},mapTransform:{value:new Xt},alphaMap:{value:null},alphaMapTransform:{value:new Xt},alphaTest:{value:0}}},fn={basic:{uniforms:De([pt.common,pt.specularmap,pt.envmap,pt.aomap,pt.lightmap,pt.fog]),vertexShader:Jt.meshbasic_vert,fragmentShader:Jt.meshbasic_frag},lambert:{uniforms:De([pt.common,pt.specularmap,pt.envmap,pt.aomap,pt.lightmap,pt.emissivemap,pt.bumpmap,pt.normalmap,pt.displacementmap,pt.fog,pt.lights,{emissive:{value:new vt(0)}}]),vertexShader:Jt.meshlambert_vert,fragmentShader:Jt.meshlambert_frag},phong:{uniforms:De([pt.common,pt.specularmap,pt.envmap,pt.aomap,pt.lightmap,pt.emissivemap,pt.bumpmap,pt.normalmap,pt.displacementmap,pt.fog,pt.lights,{emissive:{value:new vt(0)},specular:{value:new vt(1118481)},shininess:{value:30}}]),vertexShader:Jt.meshphong_vert,fragmentShader:Jt.meshphong_frag},standard:{uniforms:De([pt.common,pt.envmap,pt.aomap,pt.lightmap,pt.emissivemap,pt.bumpmap,pt.normalmap,pt.displacementmap,pt.roughnessmap,pt.metalnessmap,pt.fog,pt.lights,{emissive:{value:new vt(0)},roughness:{value:1},metalness:{value:0},envMapIntensity:{value:1}}]),vertexShader:Jt.meshphysical_vert,fragmentShader:Jt.meshphysical_frag},toon:{uniforms:De([pt.common,pt.aomap,pt.lightmap,pt.emissivemap,pt.bumpmap,pt.normalmap,pt.displacementmap,pt.gradientmap,pt.fog,pt.lights,{emissive:{value:new vt(0)}}]),vertexShader:Jt.meshtoon_vert,fragmentShader:Jt.meshtoon_frag},matcap:{uniforms:De([pt.common,pt.bumpmap,pt.normalmap,pt.displacementmap,pt.fog,{matcap:{value:null}}]),vertexShader:Jt.meshmatcap_vert,fragmentShader:Jt.meshmatcap_frag},points:{uniforms:De([pt.points,pt.fog]),vertexShader:Jt.points_vert,fragmentShader:Jt.points_frag},dashed:{uniforms:De([pt.common,pt.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:Jt.linedashed_vert,fragmentShader:Jt.linedashed_frag},depth:{uniforms:De([pt.common,pt.displacementmap]),vertexShader:Jt.depth_vert,fragmentShader:Jt.depth_frag},normal:{uniforms:De([pt.common,pt.bumpmap,pt.normalmap,pt.displacementmap,{opacity:{value:1}}]),vertexShader:Jt.meshnormal_vert,fragmentShader:Jt.meshnormal_frag},sprite:{uniforms:De([pt.sprite,pt.fog]),vertexShader:Jt.sprite_vert,fragmentShader:Jt.sprite_frag},background:{uniforms:{uvTransform:{value:new Xt},t2D:{value:null},backgroundIntensity:{value:1}},vertexShader:Jt.background_vert,fragmentShader:Jt.background_frag},backgroundCube:{uniforms:{envMap:{value:null},flipEnvMap:{value:-1},backgroundBlurriness:{value:0},backgroundIntensity:{value:1},backgroundRotation:{value:new Xt}},vertexShader:Jt.backgroundCube_vert,fragmentShader:Jt.backgroundCube_frag},cube:{uniforms:{tCube:{value:null},tFlip:{value:-1},opacity:{value:1}},vertexShader:Jt.cube_vert,fragmentShader:Jt.cube_frag},equirect:{uniforms:{tEquirect:{value:null}},vertexShader:Jt.equirect_vert,fragmentShader:Jt.equirect_frag},distanceRGBA:{uniforms:De([pt.common,pt.displacementmap,{referencePosition:{value:new C},nearDistance:{value:1},farDistance:{value:1e3}}]),vertexShader:Jt.distanceRGBA_vert,fragmentShader:Jt.distanceRGBA_frag},shadow:{uniforms:De([pt.lights,pt.fog,{color:{value:new vt(0)},opacity:{value:1}}]),vertexShader:Jt.shadow_vert,fragmentShader:Jt.shadow_frag}};fn.physical={uniforms:De([fn.standard.uniforms,{clearcoat:{value:0},clearcoatMap:{value:null},clearcoatMapTransform:{value:new Xt},clearcoatNormalMap:{value:null},clearcoatNormalMapTransform:{value:new Xt},clearcoatNormalScale:{value:new K(1,1)},clearcoatRoughness:{value:0},clearcoatRoughnessMap:{value:null},clearcoatRoughnessMapTransform:{value:new Xt},dispersion:{value:0},iridescence:{value:0},iridescenceMap:{value:null},iridescenceMapTransform:{value:new Xt},iridescenceIOR:{value:1.3},iridescenceThicknessMinimum:{value:100},iridescenceThicknessMaximum:{value:400},iridescenceThicknessMap:{value:null},iridescenceThicknessMapTransform:{value:new Xt},sheen:{value:0},sheenColor:{value:new vt(0)},sheenColorMap:{value:null},sheenColorMapTransform:{value:new Xt},sheenRoughness:{value:1},sheenRoughnessMap:{value:null},sheenRoughnessMapTransform:{value:new Xt},transmission:{value:0},transmissionMap:{value:null},transmissionMapTransform:{value:new Xt},transmissionSamplerSize:{value:new K},transmissionSamplerMap:{value:null},thickness:{value:0},thicknessMap:{value:null},thicknessMapTransform:{value:new Xt},attenuationDistance:{value:0},attenuationColor:{value:new vt(0)},specularColor:{value:new vt(1,1,1)},specularColorMap:{value:null},specularColorMapTransform:{value:new Xt},specularIntensity:{value:1},specularIntensityMap:{value:null},specularIntensityMapTransform:{value:new Xt},anisotropyVector:{value:new K},anisotropyMap:{value:null},anisotropyMapTransform:{value:new Xt}}]),vertexShader:Jt.meshphysical_vert,fragmentShader:Jt.meshphysical_frag};const Br={r:0,b:0,g:0},ci=new sn,n0=new zt;function i0(r,t,e,n,i,s,a){const o=new vt(0);let l=s===!0?0:1,c,h,u=null,d=0,f=null;function m(v){let x=v.isScene===!0?v.background:null;return x&&x.isTexture&&(x=(v.backgroundBlurriness>0?e:t).get(x)),x}function _(v){let x=!1;const A=m(v);A===null?p(o,l):A&&A.isColor&&(p(A,1),x=!0);const T=r.xr.getEnvironmentBlendMode();
vendor: 5,098 bytes, line 3579
3579T==="additive"?n.buffers.color.setClear(0,0,0,1,a):T==="alpha-blend"&&n.buffers.color.setClear(0,0,0,0,a),(r.autoClear||x)&&(n.buffers.depth.setTest(!0),n.buffers.depth.setMask(!0),n.buffers.color.setMask(!0),r.clear(r.autoClearColor,r.autoClearDepth,r.autoClearStencil))}function g(v,x){const A=m(x);A&&(A.isCubeTexture||A.mapping===Gs)?(h===void 0&&(h=new ye(new ls(1,1,1),new gn({name:"BackgroundCubeMaterial",uniforms:rs(fn.backgroundCube.uniforms),vertexShader:fn.backgroundCube.vertexShader,fragmentShader:fn.backgroundCube.fragmentShader,side:Ve,depthTest:!1,depthWrite:!1,fog:!1,allowOverride:!1})),h.geometry.deleteAttribute("normal"),h.geometry.deleteAttribute("uv"),h.onBeforeRender=function(T,R,P){this.matrixWorld.copyPosition(P.matrixWorld)},Object.defineProperty(h.material,"envMap",{get:function(){return this.uniforms.envMap.value}}),i.update(h)),ci.copy(x.backgroundRotation),ci.x*=-1,ci.y*=-1,ci.z*=-1,A.isCubeTexture&&A.isRenderTargetTexture===!1&&(ci.y*=-1,ci.z*=-1),h.material.uniforms.envMap.value=A,h.material.uniforms.flipEnvMap.value=A.isCubeTexture&&A.isRenderTargetTexture===!1?-1:1,h.material.uniforms.backgroundBlurriness.value=x.backgroundBlurriness,h.material.uniforms.backgroundIntensity.value=x.backgroundIntensity,h.material.uniforms.backgroundRotation.value.setFromMatrix4(n0.makeRotationFromEuler(ci)),h.material.toneMapped=Kt.getTransfer(A.colorSpace)!==ae,(u!==A||d!==A.version||f!==r.toneMapping)&&(h.material.needsUpdate=!0,u=A,d=A.version,f=r.toneMapping),h.layers.enableAll(),v.unshift(h,h.geometry,h.material,0,0,null)):A&&A.isTexture&&(c===void 0&&(c=new ye(new Ys(2,2),new gn({name:"BackgroundMaterial",uniforms:rs(fn.background.uniforms),vertexShader:fn.background.vertexShader,fragmentShader:fn.background.fragmentShader,side:Xn,depthTest:!1,depthWrite:!1,fog:!1,allowOverride:!1})),c.geometry.deleteAttribute("normal"),Object.defineProperty(c.material,"map",{get:function(){return this.uniforms.t2D.value}}),i.update(c)),c.material.uniforms.t2D.value=A,c.material.uniforms.backgroundIntensity.value=x.backgroundIntensity,c.material.toneMapped=Kt.getTransfer(A.colorSpace)!==ae,A.matrixAutoUpdate===!0&&A.updateMatrix(),c.material.uniforms.uvTransform.value.copy(A.matrix),(u!==A||d!==A.version||f!==r.toneMapping)&&(c.material.needsUpdate=!0,u=A,d=A.version,f=r.toneMapping),c.layers.enableAll(),v.unshift(c,c.geometry,c.material,0,0,null))}function p(v,x){v.getRGB(Br,Kh(r)),n.buffers.color.setClear(Br.r,Br.g,Br.b,x,a)}function y(){h!==void 0&&(h.geometry.dispose(),h.material.dispose(),h=void 0),c!==void 0&&(c.geometry.dispose(),c.material.dispose(),c=void 0)}return{getClearColor:function(){return o},setClearColor:function(v,x=1){o.set(v),l=x,p(o,l)},getClearAlpha:function(){return l},setClearAlpha:function(v){l=v,p(o,l)},render:_,addToRenderList:g,dispose:y}}function s0(r,t){const e=r.getParameter(r.MAX_VERTEX_ATTRIBS),n={},i=d(null);let s=i,a=!1;function o(S,I,B,k,V){let Z=!1;const W=u(k,B,I);s!==W&&(s=W,c(s.object)),Z=f(S,k,B,V),Z&&m(S,k,B,V),V!==null&&t.update(V,r.ELEMENT_ARRAY_BUFFER),(Z||a)&&(a=!1,x(S,I,B,k),V!==null&&r.bindBuffer(r.ELEMENT_ARRAY_BUFFER,t.get(V).buffer))}function l(){return r.createVertexArray()}function c(S){return r.bindVertexArray(S)}function h(S){return r.deleteVertexArray(S)}function u(S,I,B){const k=B.wireframe===!0;let V=n[S.id];V===void 0&&(V={},n[S.id]=V);let Z=V[I.id];Z===void 0&&(Z={},V[I.id]=Z);let W=Z[k];return W===void 0&&(W=d(l()),Z[k]=W),W}function d(S){const I=[],B=[],k=[];for(let V=0;V<e;V++)I[V]=0,B[V]=0,k[V]=0;return{geometry:null,program:null,wireframe:!1,newAttributes:I,enabledAttributes:B,attributeDivisors:k,object:S,attributes:{},index:null}}function f(S,I,B,k){const V=s.attributes,Z=I.attributes;let W=0;const nt=B.getAttributes();for(const G in nt)if(nt[G].location>=0){const _t=V[G];let bt=Z[G];if(bt===void 0&&(G==="instanceMatrix"&&S.instanceMatrix&&(bt=S.instanceMatrix),G==="instanceColor"&&S.instanceColor&&(bt=S.instanceColor)),_t===void 0||_t.attribute!==bt||bt&&_t.data!==bt.data)return!0;W++}return s.attributesNum!==W||s.index!==k}function m(S,I,B,k){const V={},Z=I.attributes;let W=0;const nt=B.getAttributes();for(const G in nt)if(nt[G].location>=0){let _t=Z[G];_t===void 0&&(G==="instanceMatrix"&&S.instanceMatrix&&(_t=S.instanceMatrix),G==="instanceColor"&&S.instanceColor&&(_t=S.instanceColor));const bt={};bt.attribute=_t,_t&&_t.data&&(bt.data=_t.data),V[G]=bt,W++}s.attributes=V,s.attributesNum=W,s.index=k}function _(){const S=s.newAttributes;for(let I=0,B=S.length;I<B;I++)S[I]=0}function g(S){p(S,0)}function p(S,I){const B=s.newAttributes,k=s.enabledAttributes,V=s.attributeDivisors;B[S]=1,k[S]===0&&(r.enableVertexAttribArray(S),k[S]=1),V[S]!==I&&(r.vertexAttribDivisor(S,I),V[S]=I)}function y(){const S=s.newAttributes,I=s.enabledAttributes;for(let B=0,k=I.length;B<k;B++)I[B]!==S[B]&&(r.disableVertexAttribArray(B),I[B]=0)}function v(S,I,B,k,V,Z,W){W===!0?r.vertexAttribIPointer(S,I,B,V,Z):r.vertexAttribPointer(S,I,B,k,V,Z)}function x(S,I,B,k){_();const V=k.attributes,Z=B.getAttributes(),W=I.defaultAttributeValues;for(const nt in Z){const G=Z[nt];
vendor: 2,700 bytes, line 3579
3579if(G.location>=0){let dt=V[nt];if(dt===void 0&&(nt==="instanceMatrix"&&S.instanceMatrix&&(dt=S.instanceMatrix),nt==="instanceColor"&&S.instanceColor&&(dt=S.instanceColor)),dt!==void 0){const _t=dt.normalized,bt=dt.itemSize,Vt=t.get(dt);if(Vt===void 0)continue;const Qt=Vt.buffer,jt=Vt.type,q=Vt.bytesPerElement,ft=jt===r.INT||jt===r.UNSIGNED_INT||dt.gpuType===rl;if(dt.isInterleavedBufferAttribute){const lt=dt.data,Lt=lt.stride,Ct=dt.offset;if(lt.isInstancedInterleavedBuffer){for(let Ft=0;Ft<G.locationSize;Ft++)p(G.location+Ft,lt.meshPerAttribute);S.isInstancedMesh!==!0&&k._maxInstanceCount===void 0&&(k._maxInstanceCount=lt.meshPerAttribute*lt.count)}else for(let Ft=0;Ft<G.locationSize;Ft++)g(G.location+Ft);r.bindBuffer(r.ARRAY_BUFFER,Qt);for(let Ft=0;Ft<G.locationSize;Ft++)v(G.location+Ft,bt/G.locationSize,jt,_t,Lt*q,(Ct+bt/G.locationSize*Ft)*q,ft)}else{if(dt.isInstancedBufferAttribute){for(let lt=0;lt<G.locationSize;lt++)p(G.location+lt,dt.meshPerAttribute);S.isInstancedMesh!==!0&&k._maxInstanceCount===void 0&&(k._maxInstanceCount=dt.meshPerAttribute*dt.count)}else for(let lt=0;lt<G.locationSize;lt++)g(G.location+lt);r.bindBuffer(r.ARRAY_BUFFER,Qt);for(let lt=0;lt<G.locationSize;lt++)v(G.location+lt,bt/G.locationSize,jt,_t,bt*q,bt/G.locationSize*lt*q,ft)}}else if(W!==void 0){const _t=W[nt];if(_t!==void 0)switch(_t.length){case 2:r.vertexAttrib2fv(G.location,_t);break;case 3:r.vertexAttrib3fv(G.location,_t);break;case 4:r.vertexAttrib4fv(G.location,_t);break;default:r.vertexAttrib1fv(G.location,_t)}}}}y()}function A(){P();for(const S in n){const I=n[S];for(const B in I){const k=I[B];for(const V in k)h(k[V].object),delete k[V];delete I[B]}delete n[S]}}function T(S){if(n[S.id]===void 0)return;const I=n[S.id];for(const B in I){const k=I[B];for(const V in k)h(k[V].object),delete k[V];delete I[B]}delete n[S.id]}function R(S){for(const I in n){const B=n[I];if(B[S.id]===void 0)continue;const k=B[S.id];for(const V in k)h(k[V].object),delete k[V];delete B[S.id]}}function P(){b(),a=!0,s!==i&&(s=i,c(s.object))}function b(){i.geometry=null,i.program=null,i.wireframe=!1}return{setup:o,reset:P,resetDefaultState:b,dispose:A,releaseStatesOfGeometry:T,releaseStatesOfProgram:R,initAttributes:_,enableAttribute:g,disableUnusedAttributes:y}}function r0(r,t,e){let n;function i(c){n=c}function s(c,h){r.drawArrays(n,c,h),e.update(h,n,1)}function a(c,h,u){u!==0&&(r.drawArraysInstanced(n,c,h,u),e.update(h,n,u))}function o(c,h,u){if(u===0)return;t.get("WEBGL_multi_draw").multiDrawArraysWEBGL(n,c,0,h,0,u);let f=0;for(let m=0;m<u;m++)f+=h[m];e.update(f,n,1)}function l(c,h,u,d){if(u===0)return;const f=t.get("WEBGL_multi_draw");if(f===null)for(let m=0;m<c.length;m++)a(c[m],h[m],d[m]);
vendor: 12,668 bytes, lines 3579-3654
3579else{f.multiDrawArraysInstancedWEBGL(n,c,0,h,0,d,0,u);let m=0;for(let _=0;_<u;_++)m+=h[_]*d[_];e.update(m,n,1)}}this.setMode=i,this.render=s,this.renderInstances=a,this.renderMultiDraw=o,this.renderMultiDrawInstances=l}function a0(r,t,e,n){let i;function s(){if(i!==void 0)return i;if(t.has("EXT_texture_filter_anisotropic")===!0){const R=t.get("EXT_texture_filter_anisotropic");i=r.getParameter(R.MAX_TEXTURE_MAX_ANISOTROPY_EXT)}else i=0;return i}function a(R){return!(R!==ke&&n.convert(R)!==r.getParameter(r.IMPLEMENTATION_COLOR_READ_FORMAT))}function o(R){const P=R===Ws&&(t.has("EXT_color_buffer_half_float")||t.has("EXT_color_buffer_float"));return!(R!==mn&&n.convert(R)!==r.getParameter(r.IMPLEMENTATION_COLOR_READ_TYPE)&&R!==Je&&!P)}function l(R){if(R==="highp"){if(r.getShaderPrecisionFormat(r.VERTEX_SHADER,r.HIGH_FLOAT).precision>0&&r.getShaderPrecisionFormat(r.FRAGMENT_SHADER,r.HIGH_FLOAT).precision>0)return"highp";R="mediump"}return R==="mediump"&&r.getShaderPrecisionFormat(r.VERTEX_SHADER,r.MEDIUM_FLOAT).precision>0&&r.getShaderPrecisionFormat(r.FRAGMENT_SHADER,r.MEDIUM_FLOAT).precision>0?"mediump":"lowp"}let c=e.precision!==void 0?e.precision:"highp";const h=l(c);h!==c&&(console.warn("THREE.WebGLRenderer:",c,"not supported, using",h,"instead."),c=h);const u=e.logarithmicDepthBuffer===!0,d=e.reversedDepthBuffer===!0&&t.has("EXT_clip_control"),f=r.getParameter(r.MAX_TEXTURE_IMAGE_UNITS),m=r.getParameter(r.MAX_VERTEX_TEXTURE_IMAGE_UNITS),_=r.getParameter(r.MAX_TEXTURE_SIZE),g=r.getParameter(r.MAX_CUBE_MAP_TEXTURE_SIZE),p=r.getParameter(r.MAX_VERTEX_ATTRIBS),y=r.getParameter(r.MAX_VERTEX_UNIFORM_VECTORS),v=r.getParameter(r.MAX_VARYING_VECTORS),x=r.getParameter(r.MAX_FRAGMENT_UNIFORM_VECTORS),A=m>0,T=r.getParameter(r.MAX_SAMPLES);return{isWebGL2:!0,getMaxAnisotropy:s,getMaxPrecision:l,textureFormatReadable:a,textureTypeReadable:o,precision:c,logarithmicDepthBuffer:u,reversedDepthBuffer:d,maxTextures:f,maxVertexTextures:m,maxTextureSize:_,maxCubemapSize:g,maxAttributes:p,maxVertexUniforms:y,maxVaryings:v,maxFragmentUniforms:x,vertexTextures:A,maxSamples:T}}function o0(r){const t=this;let e=null,n=0,i=!1,s=!1;const a=new ui,o=new Xt,l={value:null,needsUpdate:!1};this.uniform=l,this.numPlanes=0,this.numIntersection=0,this.init=function(u,d){const f=u.length!==0||d||n!==0||i;return i=d,n=u.length,f},this.beginShadows=function(){s=!0,h(null)},this.endShadows=function(){s=!1},this.setGlobalState=function(u,d){e=h(u,d,0)},this.setState=function(u,d,f){const m=u.clippingPlanes,_=u.clipIntersection,g=u.clipShadows,p=r.get(u);if(!i||m===null||m.length===0||s&&!g)s?h(null):c();else{const y=s?0:n,v=y*4;let x=p.clippingState||null;l.value=x,x=h(m,d,v,f);for(let A=0;A!==v;++A)x[A]=e[A];p.clippingState=x,this.numIntersection=_?this.numPlanes:0,this.numPlanes+=y}};function c(){l.value!==e&&(l.value=e,l.needsUpdate=n>0),t.numPlanes=n,t.numIntersection=0}function h(u,d,f,m){const _=u!==null?u.length:0;let g=null;if(_!==0){if(g=l.value,m!==!0||g===null){const p=f+_*4,y=d.matrixWorldInverse;o.getNormalMatrix(y),(g===null||g.length<p)&&(g=new Float32Array(p));for(let v=0,x=f;v!==_;++v,x+=4)a.copy(u[v]).applyMatrix4(y,o),a.normal.toArray(g,x),g[x+3]=a.constant}l.value=g,l.needsUpdate=!0}return t.numPlanes=_,t.numIntersection=0,g}}function l0(r){let t=new WeakMap;function e(a,o){return o===Zr?a.mapping=qn:o===Jr&&(a.mapping=xi),a}function n(a){if(a&&a.isTexture){const o=a.mapping;if(o===Zr||o===Jr)if(t.has(a)){const l=t.get(a).texture;return e(l,a.mapping)}else{const l=a.image;if(l&&l.height>0){const c=new ff(l.height);return c.fromEquirectangularTexture(r,a),t.set(a,c),a.addEventListener("dispose",i),e(c.texture,a.mapping)}else return null}}return a}function i(a){const o=a.target;o.removeEventListener("dispose",i);const l=t.get(o);l!==void 0&&(t.delete(o),l.dispose())}function s(){t=new WeakMap}return{get:n,dispose:s}}const Ki=4,uh=[.125,.215,.35,.446,.526,.582],pi=20,oo=new zl,dh=new vt;let lo=null,co=0,ho=0,uo=!1;const di=(1+Math.sqrt(5))/2,Yi=1/di,fh=[new C(-di,Yi,0),new C(di,Yi,0),new C(-Yi,0,di),new C(Yi,0,di),new C(0,di,-Yi),new C(0,di,Yi),new C(-1,1,-1),new C(1,1,-1),new C(-1,1,1),new C(1,1,1)],c0=new C;class ph{constructor(t){this._renderer=t,this._pingPongRenderTarget=null,this._lodMax=0,this._cubeSize=0,this._lodPlanes=[],this._sizeLods=[],this._sigmas=[],this._blurMaterial=null,this._cubemapMaterial=null,this._equirectMaterial=null,this._compileMaterial(this._blurMaterial)}fromScene(t,e=0,n=.1,i=100,s={}){const{size:a=256,position:o=c0}=s;lo=this._renderer.getRenderTarget(),co=this._renderer.getActiveCubeFace(),ho=this._renderer.getActiveMipmapLevel(),uo=this._renderer.xr.enabled,this._renderer.xr.enabled=!1,this._setSize(a);const l=this._allocateTargets();return l.depthBuffer=!0,this._sceneToCubeUV(t,n,i,l,o),e>0&&this._blur(l,0,0,e),this._applyPMREM(l),this._cleanup(l),l}fromEquirectangular(t,e=null){return this._fromTexture(t,e)}fromCubemap(t,e=null){return this._fromTexture(t,e)}compileCubemapShader(){this._cubemapMaterial===null&&(this._cubemapMaterial=_h(),this._compileMaterial(this._cubemapMaterial))}compileEquirectangularShader(){this._equirectMaterial===null&&(this._equirectMaterial=gh(),this._compileMaterial(this._equirectMaterial))}dispose(){this._dispose(),this._cubemapMaterial!==null&&this._cubemapMaterial.dispose(),this._equirectMaterial!==null&&this._equirectMaterial.dispose()}_setSize(t){this._lodMax=Math.floor(Math.log2(t)),this._cubeSize=Math.pow(2,this._lodMax)}_dispose(){this._blurMaterial!==null&&this._blurMaterial.dispose(),this._pingPongRenderTarget!==null&&this._pingPongRenderTarget.dispose();for(let t=0;t<this._lodPlanes.length;t++)this._lodPlanes[t].dispose()}_cleanup(t){this._renderer.setRenderTarget(lo,co,ho),this._renderer.xr.enabled=uo,t.scissorTest=!1,zr(t,0,0,t.width,t.height)}_fromTexture(t,e){t.mapping===qn||t.mapping===xi?this._setSize(t.image.length===0?16:t.image[0].width||t.image[0].image.width):this._setSize(t.image.width/4),lo=this._renderer.getRenderTarget(),co=this._renderer.getActiveCubeFace(),ho=this._renderer.getActiveMipmapLevel(),uo=this._renderer.xr.enabled,this._renderer.xr.enabled=!1;const n=e||this._allocateTargets();return this._textureToCubeUV(t,n),this._applyPMREM(n),this._cleanup(n),n}_allocateTargets(){const t=3*Math.max(this._cubeSize,112),e=4*this._cubeSize,n={magFilter:Ee,minFilter:Ee,generateMipmaps:!1,type:Ws,format:ke,colorSpace:is,depthBuffer:!1},i=mh(t,e,n);if(this._pingPongRenderTarget===null||this._pingPongRenderTarget.width!==t||this._pingPongRenderTarget.height!==e){this._pingPongRenderTarget!==null&&this._dispose(),this._pingPongRenderTarget=mh(t,e,n);const{_lodMax:s}=this;({sizeLods:this._sizeLods,lodPlanes:this._lodPlanes,sigmas:this._sigmas}=h0(s)),this._blurMaterial=u0(s,t,e)}return i}_compileMaterial(t){const e=new ye(this._lodPlanes[0],t);this._renderer.compile(e,oo)}_sceneToCubeUV(t,e,n,i,s){const l=new Ce(90,1,e,n),c=[1,-1,1,1,1,1],h=[1,1,1,-1,-1,-1],u=this._renderer,d=u.autoClear,f=u.toneMapping;u.getClearColor(dh),u.toneMapping=Wn,u.autoClear=!1,u.state.buffers.depth.getReversed()&&(u.setRenderTarget(i),u.clearDepth(),u.setRenderTarget(null));const _=new Si({name:"PMREM.Background",side:Ve,depthWrite:!1,depthTest:!1}),g=new ye(new ls,_);let p=!1;const y=t.background;y?y.isColor&&(_.color.copy(y),t.background=null,p=!0):(_.color.copy(dh),p=!0);for(let v=0;v<6;v++){const x=v%3;x===0?(l.up.set(0,c[v],0),l.position.set(s.x,s.y,s.z),l.lookAt(s.x+h[v],s.y,s.z)):x===1?(l.up.set(0,0,c[v]),l.position.set(s.x,s.y,s.z),l.lookAt(s.x,s.y+h[v],s.z)):(l.up.set(0,c[v],0),l.position.set(s.x,s.y,s.z),l.lookAt(s.x,s.y,s.z+h[v]));const A=this._cubeSize;zr(i,x*A,v>2?A:0,A,A),u.setRenderTarget(i),p&&u.render(g,l),u.render(t,l)}g.geometry.dispose(),g.material.dispose(),u.toneMapping=f,u.autoClear=d,t.background=y}_textureToCubeUV(t,e){const n=this._renderer,i=t.mapping===qn||t.mapping===xi;i?(this._cubemapMaterial===null&&(this._cubemapMaterial=_h()),this._cubemapMaterial.uniforms.flipEnvMap.value=t.isRenderTargetTexture===!1?-1:1):this._equirectMaterial===null&&(this._equirectMaterial=gh());const s=i?this._cubemapMaterial:this._equirectMaterial,a=new ye(this._lodPlanes[0],s),o=s.uniforms;o.envMap.value=t;const l=this._cubeSize;zr(e,0,0,3*l,2*l),n.setRenderTarget(e),n.render(a,oo)}_applyPMREM(t){const e=this._renderer,n=e.autoClear;e.autoClear=!1;const i=this._lodPlanes.length;for(let s=1;s<i;s++){const a=Math.sqrt(this._sigmas[s]*this._sigmas[s]-this._sigmas[s-1]*this._sigmas[s-1]),o=fh[(i-s-1)%fh.length];this._blur(t,s-1,s,a,o)}e.autoClear=n}_blur(t,e,n,i,s){const a=this._pingPongRenderTarget;this._halfBlur(t,a,e,n,i,"latitudinal",s),this._halfBlur(a,t,n,n,i,"longitudinal",s)}_halfBlur(t,e,n,i,s,a,o){const l=this._renderer,c=this._blurMaterial;a!=="latitudinal"&&a!=="longitudinal"&&console.error("blur direction must be either latitudinal or longitudinal!");const h=3,u=new ye(this._lodPlanes[i],c),d=c.uniforms,f=this._sizeLods[n]-1,m=isFinite(s)?Math.PI/(2*f):2*Math.PI/(2*pi-1),_=s/m,g=isFinite(s)?1+Math.floor(h*_):pi;g>pi&&console.warn(`sigmaRadians, ${s}, is too large and will clip, as it requested ${g} samples when the maximum is set to ${pi}`);const p=[];let y=0;for(let R=0;R<pi;++R){const P=R/_,b=Math.exp(-P*P/2);p.push(b),R===0?y+=b:R<g&&(y+=2*b)}for(let R=0;R<p.length;R++)p[R]=p[R]/y;d.envMap.value=t.texture,d.samples.value=g,d.weights.value=p,d.latitudinal.value=a==="latitudinal",o&&(d.poleAxis.value=o);const{_lodMax:v}=this;d.dTheta.value=m,d.mipInt.value=v-n;const x=this._sizeLods[i],A=3*x*(i>v-Ki?i-v+Ki:0),T=4*(this._cubeSize-x);zr(e,A,T,3*x,2*x),l.setRenderTarget(e),l.render(u,oo)}}function h0(r){const t=[],e=[],n=[];let i=r;const s=r-Ki+1+uh.length;for(let a=0;a<s;a++){const o=Math.pow(2,i);e.push(o);let l=1/o;a>r-Ki?l=uh[a-r+Ki-1]:a===0&&(l=0),n.push(l);const c=1/(o-2),h=-c,u=1+c,d=[h,h,u,h,u,u,h,h,u,u,h,u],f=6,m=6,_=3,g=2,p=1,y=new Float32Array(_*m*f),v=new Float32Array(g*m*f),x=new Float32Array(p*m*f);for(let T=0;T<f;T++){const R=T%3*2/3-1,P=T>2?0:-1,b=[R,P,0,R+2/3,P,0,R+2/3,P+1,0,R,P,0,R+2/3,P+1,0,R,P+1,0];y.set(b,_*m*T),v.set(d,g*m*T);const S=[T,T,T,T,T,T];x.set(S,p*m*T)}const A=new Zt;A.setAttribute("position",new le(y,_)),A.setAttribute("uv",new le(v,g)),A.setAttribute("faceIndex",new le(x,p)),t.push(A),i>Ki&&i--}return{lodPlanes:t,sizeLods:e,sigmas:n}}function mh(r,t,e){const n=new Ln(r,t,e);return n.texture.mapping=Gs,n.texture.name="PMREM.cubeUv",n.scissorTest=!0,n}function zr(r,t,e,n,i){r.viewport.set(t,e,n,i),r.scissor.set(t,e,n,i)}function u0(r,t,e){const n=new Float32Array(pi),i=new C(0,1,0);return new gn({name:"SphericalGaussianBlur",defines:{n:pi,CUBEUV_TEXEL_WIDTH:1/t,CUBEUV_TEXEL_HEIGHT:1/e,CUBEUV_MAX_MIP:`${r}.0`},uniforms:{envMap:{value:null},samples:{value:1},weights:{value:n},latitudinal:{value:!1},dTheta:{value:0},mipInt:{value:0},poleAxis:{value:i}},vertexShader:Gl(),fragmentShader:`
3580
3581			precision mediump float;
3582			precision mediump int;
3583
3584			varying vec3 vOutputDirection;
3585
3586			uniform sampler2D envMap;
3587			uniform int samples;
3588			uniform float weights[ n ];
3589			uniform bool latitudinal;
3590			uniform float dTheta;
3591			uniform float mipInt;
3592			uniform vec3 poleAxis;
3593
3594			#define ENVMAP_TYPE_CUBE_UV
3595			#include <cube_uv_reflection_fragment>
3596
3597			vec3 getSample( float theta, vec3 axis ) {
3598
3599				float cosTheta = cos( theta );
3600				// Rodrigues' axis-angle rotation
3601				vec3 sampleDirection = vOutputDirection * cosTheta
3602					+ cross( axis, vOutputDirection ) * sin( theta )
3603					+ axis * dot( axis, vOutputDirection ) * ( 1.0 - cosTheta );
3604
3605				return bilinearCubeUV( envMap, sampleDirection, mipInt );
3606
3607			}
3608
3609			void main() {
3610
3611				vec3 axis = latitudinal ? poleAxis : cross( poleAxis, vOutputDirection );
3612
3613				if ( all( equal( axis, vec3( 0.0 ) ) ) ) {
3614
3615					axis = vec3( vOutputDirection.z, 0.0, - vOutputDirection.x );
3616
3617				}
3618
3619				axis = normalize( axis );
3620
3621				gl_FragColor = vec4( 0.0, 0.0, 0.0, 1.0 );
3622				gl_FragColor.rgb += weights[ 0 ] * getSample( 0.0, axis );
3623
3624				for ( int i = 1; i < n; i++ ) {
3625
3626					if ( i >= samples ) {
3627
3628						break;
3629
3630					}
3631
3632					float theta = dTheta * float( i );
3633					gl_FragColor.rgb += weights[ i ] * getSample( -1.0 * theta, axis );
3634					gl_FragColor.rgb += weights[ i ] * getSample( theta, axis );
3635
3636				}
3637
3638			}
3639		`,blending:Gn,depthTest:!1,depthWrite:!1})}function gh(){return new gn({name:"EquirectangularToCubeUV",uniforms:{envMap:{value:null}},vertexShader:Gl(),fragmentShader:`
3640
3641			precision mediump float;
3642			precision mediump int;
3643
3644			varying vec3 vOutputDirection;
3645
3646			uniform sampler2D envMap;
3647
3648			#include <common>
3649
3650			void main() {
3651
3652				vec3 outputDirection = normalize( vOutputDirection );
3653				vec2 uv = equirectUv( outputDirection );
3654
3655				gl_FragColor = vec4( texture2D ( envMap, uv ).rgb, 1.0 );
3656
3657			}
3658		`,blending:Gn,depthTest:!1,depthWrite:!1})}function _h(){return new gn({name:"CubemapToCubeUV",uniforms:{envMap:{value:null},flipEnvMap:{value:-1}},vertexShader:Gl(),fragmentShader:`
3659
3660			precision mediump float;
3661			precision mediump int;
3662
3663			uniform float flipEnvMap;
3664
3665			varying vec3 vOutputDirection;
3666
3667			uniform samplerCube envMap;
3668
3669			void main() {
3670
3671				gl_FragColor = textureCube( envMap, vec3( flipEnvMap * vOutputDirection.x, vOutputDirection.yz ) );
3672
3673			}
3674		`,blending:Gn,depthTest:!1,depthWrite:!1})}function Gl(){return`
3675
3676		precision mediump float;
3677		precision mediump int;
3678
3679		attribute float faceIndex;
3680
3681		varying vec3 vOutputDirection;
3682
3683		// RH coordinate system; PMREM face-indexing convention
3684		vec3 getDirection( vec2 uv, float face ) {
3685
3686			uv = 2.0 * uv - 1.0;
3687
3688			vec3 direction = vec3( uv, 1.0 );
3689
3690			if ( face == 0.0 ) {
3691
3692				direction = direction.zyx; // ( 1, v, u ) pos x
3693
3694			} else if ( face == 1.0 ) {
3695
3696				direction = direction.xzy;
3697				direction.xz *= -1.0; // ( -u, 1, -v ) pos y
3698
3699			} else if ( face == 2.0 ) {
3700
3701				direction.x *= -1.0; // ( -u, v, 1 ) pos z
3702
3703			} else if ( face == 3.0 ) {
3704
3705				direction = direction.zyx;
3706				direction.xz *= -1.0; // ( -1, v, -u ) neg x
3707
3708			} else if ( face == 4.0 ) {
3709
3710				direction = direction.xzy;
3711				direction.xy *= -1.0; // ( -u, -1, v ) neg y
3712
3713			} else if ( face == 5.0 ) {
3714
3715				direction.z *= -1.0; // ( u, v, -1 ) neg z
3716
3717			}
3718
3719			return direction;
3720
3721		}
3722
3723		void main() {
3724
3725			vOutputDirection = getDirection( uv, faceIndex );
3726			gl_Position = vec4( position, 1.0 );
3727
3728		}
3729	`}function d0(r){let t=new WeakMap,e=null;function n(o){if(o&&o.isTexture){const l=o.mapping,c=l===Zr||l===Jr,h=l===qn||l===xi;if(c||h){let u=t.get(o);const d=u!==void 0?u.texture.pmremVersion:0;if(o.isRenderTargetTexture&&o.pmremVersion!==d)return e===null&&(e=new ph(r)),u=c?e.fromEquirectangular(o,u):e.fromCubemap(o,u),u.texture.pmremVersion=o.pmremVersion,t.set(o,u),u.texture;if(u!==void 0)return u.texture;{const f=o.image;return c&&f&&f.height>0||h&&f&&i(f)?(e===null&&(e=new ph(r)),u=c?e.fromEquirectangular(o):e.fromCubemap(o),u.texture.pmremVersion=o.pmremVersion,t.set(o,u),o.addEventListener("dispose",s),u.texture):null}}}return o}function i(o){let l=0;const c=6;for(let h=0;h<c;h++)o[h]!==void 0&&l++;return l===c}function s(o){const l=o.target;l.removeEventListener("dispose",s);const c=t.get(l);c!==void 0&&(t.delete(l),c.dispose())}function a(){t=new WeakMap,e!==null&&(e.dispose(),e=null)}return{get:n,dispose:a}}function f0(r){const t={};function e(n){if(t[n]!==void 0)return t[n];let i;switch(n){case"WEBGL_depth_texture":i=r.getExtension("WEBGL_depth_texture")||r.getExtension("MOZ_WEBGL_depth_texture")||r.getExtension("WEBKIT_WEBGL_depth_texture");break;case"EXT_texture_filter_anisotropic":i=r.getExtension("EXT_texture_filter_anisotropic")||r.getExtension("MOZ_EXT_texture_filter_anisotropic")||r.getExtension("WEBKIT_EXT_texture_filter_anisotropic");break;case"WEBGL_compressed_texture_s3tc":i=r.getExtension("WEBGL_compressed_texture_s3tc")||r.getExtension("MOZ_WEBGL_compressed_texture_s3tc")||r.getExtension("WEBKIT_WEBGL_compressed_texture_s3tc");break;case"WEBGL_compressed_texture_pvrtc":i=r.getExtension("WEBGL_compressed_texture_pvrtc")||r.getExtension("WEBKIT_WEBGL_compressed_texture_pvrtc");break;default:i=r.getExtension(n)}return t[n]=i,i}return{has:function(n){return e(n)!==null},init:function(){e("EXT_color_buffer_float"),e("WEBGL_clip_cull_distance"),e("OES_texture_float_linear"),e("EXT_color_buffer_half_float"),e("WEBGL_multisampled_render_to_texture"),e("WEBGL_render_shared_exponent")},get:function(n){const i=e(n);return i===null&&ji("THREE.WebGLRenderer: "+n+" extension not supported."),i}}}function p0(r,t,e,n){const i={},s=new WeakMap;function a(u){const d=u.target;d.index!==null&&t.remove(d.index);for(const m in d.attributes)t.remove(d.attributes[m]);d.removeEventListener("dispose",a),delete i[d.id];const f=s.get(d);f&&(t.remove(f),s.delete(d)),n.releaseStatesOfGeometry(d),d.isInstancedBufferGeometry===!0&&delete d._maxInstanceCount,e.memory.geometries--}function o(u,d){return i[d.id]===!0||(d.addEventListener("dispose",a),i[d.id]=!0,e.memory.geometries++),d}function l(u){const d=u.attributes;for(const f in d)t.update(d[f],r.ARRAY_BUFFER)}function c(u){const d=[],f=u.index,m=u.attributes.position;let _=0;if(f!==null){const y=f.array;_=f.version;for(let v=0,x=y.length;v<x;v+=3){const A=y[v+0],T=y[v+1],R=y[v+2];d.push(A,T,T,R,R,A)}}else if(m!==void 0){const y=m.array;_=m.version;for(let v=0,x=y.length/3-1;v<x;v+=3){const A=v+0,T=v+1,R=v+2;d.push(A,T,T,R,R,A)}}else return;const g=new(qh(d)?$h:Jh)(d,1);g.version=_;const p=s.get(u);p&&t.remove(p),s.set(u,g)}function h(u){const d=s.get(u);if(d){const f=u.index;f!==null&&d.version<f.version&&c(u)}else c(u);return s.get(u)}return{get:o,update:l,getWireframeAttribute:h}}function m0(r,t,e){let n;function i(d){n=d}let s,a;function o(d){s=d.type,a=d.bytesPerElement}function l(d,f){r.drawElements(n,f,s,d*a),e.update(f,n,1)}function c(d,f,m){m!==0&&(r.drawElementsInstanced(n,f,s,d*a,m),e.update(f,n,m))}function h(d,f,m){if(m===0)return;t.get("WEBGL_multi_draw").multiDrawElementsWEBGL(n,f,0,s,d,0,m);let g=0;for(let p=0;p<m;p++)g+=f[p];e.update(g,n,1)}function u(d,f,m,_){if(m===0)return;const g=t.get("WEBGL_multi_draw");if(g===null)for(let p=0;p<d.length;p++)c(d[p]/a,f[p],_[p]);
vendor: 17,403 bytes, lines 3729-3764
3729else{g.multiDrawElementsInstancedWEBGL(n,f,0,s,d,0,_,0,m);let p=0;for(let y=0;y<m;y++)p+=f[y]*_[y];e.update(p,n,1)}}this.setMode=i,this.setIndex=o,this.render=l,this.renderInstances=c,this.renderMultiDraw=h,this.renderMultiDrawInstances=u}function g0(r){const t={geometries:0,textures:0},e={frame:0,calls:0,triangles:0,points:0,lines:0};function n(s,a,o){switch(e.calls++,a){case r.TRIANGLES:e.triangles+=o*(s/3);break;case r.LINES:e.lines+=o*(s/2);break;case r.LINE_STRIP:e.lines+=o*(s-1);break;case r.LINE_LOOP:e.lines+=o*s;break;case r.POINTS:e.points+=o*s;break;default:console.error("THREE.WebGLInfo: Unknown draw mode:",a);break}}function i(){e.calls=0,e.triangles=0,e.points=0,e.lines=0}return{memory:t,render:e,programs:null,autoReset:!0,reset:i,update:n}}function _0(r,t,e){const n=new WeakMap,i=new ne;function s(a,o,l){const c=a.morphTargetInfluences,h=o.morphAttributes.position||o.morphAttributes.normal||o.morphAttributes.color,u=h!==void 0?h.length:0;let d=n.get(o);if(d===void 0||d.count!==u){let b=function(){R.dispose(),n.delete(o),o.removeEventListener("dispose",b)};d!==void 0&&d.texture.dispose();const f=o.morphAttributes.position!==void 0,m=o.morphAttributes.normal!==void 0,_=o.morphAttributes.color!==void 0,g=o.morphAttributes.position||[],p=o.morphAttributes.normal||[],y=o.morphAttributes.color||[];let v=0;f===!0&&(v=1),m===!0&&(v=2),_===!0&&(v=3);let x=o.attributes.position.count*v,A=1;x>t.maxTextureSize&&(A=Math.ceil(x/t.maxTextureSize),x=t.maxTextureSize);const T=new Float32Array(x*A*4*u),R=new fl(T,x,A,u);R.type=Je,R.needsUpdate=!0;const P=v*4;for(let S=0;S<u;S++){const I=g[S],B=p[S],k=y[S],V=x*A*4*S;for(let Z=0;Z<I.count;Z++){const W=Z*P;f===!0&&(i.fromBufferAttribute(I,Z),T[V+W+0]=i.x,T[V+W+1]=i.y,T[V+W+2]=i.z,T[V+W+3]=0),m===!0&&(i.fromBufferAttribute(B,Z),T[V+W+4]=i.x,T[V+W+5]=i.y,T[V+W+6]=i.z,T[V+W+7]=0),_===!0&&(i.fromBufferAttribute(k,Z),T[V+W+8]=i.x,T[V+W+9]=i.y,T[V+W+10]=i.z,T[V+W+11]=k.itemSize===4?i.w:1)}}d={count:u,texture:R,size:new K(x,A)},n.set(o,d),o.addEventListener("dispose",b)}if(a.isInstancedMesh===!0&&a.morphTexture!==null)l.getUniforms().setValue(r,"morphTexture",a.morphTexture,e);else{let f=0;for(let _=0;_<c.length;_++)f+=c[_];const m=o.morphTargetsRelative?1:1-f;l.getUniforms().setValue(r,"morphTargetBaseInfluence",m),l.getUniforms().setValue(r,"morphTargetInfluences",c)}l.getUniforms().setValue(r,"morphTargetsTexture",d.texture,e),l.getUniforms().setValue(r,"morphTargetsTextureSize",d.size)}return{update:s}}function x0(r,t,e,n){let i=new WeakMap;function s(l){const c=n.render.frame,h=l.geometry,u=t.get(l,h);if(i.get(u)!==c&&(t.update(u),i.set(u,c)),l.isInstancedMesh&&(l.hasEventListener("dispose",o)===!1&&l.addEventListener("dispose",o),i.get(l)!==c&&(e.update(l.instanceMatrix,r.ARRAY_BUFFER),l.instanceColor!==null&&e.update(l.instanceColor,r.ARRAY_BUFFER),i.set(l,c))),l.isSkinnedMesh){const d=l.skeleton;i.get(d)!==c&&(d.update(),i.set(d,c))}return u}function a(){i=new WeakMap}function o(l){const c=l.target;c.removeEventListener("dispose",o),e.remove(c.instanceMatrix),c.instanceColor!==null&&e.remove(c.instanceColor)}return{update:s,dispose:a}}const Tu=new xe,xh=new nu(1,1),Au=new fl,wu=new pl,Cu=new ua,vh=[],yh=[],Mh=new Float32Array(16),Sh=new Float32Array(9),bh=new Float32Array(4);function us(r,t,e){const n=r[0];if(n<=0||n>0)return r;const i=t*e;let s=vh[i];if(s===void 0&&(s=new Float32Array(i),vh[i]=s),t!==0){n.toArray(s,0);for(let a=1,o=0;a!==t;++a)o+=e,r[a].toArray(s,o)}return s}function Me(r,t){if(r.length!==t.length)return!1;for(let e=0,n=r.length;e<n;e++)if(r[e]!==t[e])return!1;return!0}function Se(r,t){for(let e=0,n=t.length;e<n;e++)r[e]=t[e]}function xa(r,t){let e=yh[t];e===void 0&&(e=new Int32Array(t),yh[t]=e);for(let n=0;n!==t;++n)e[n]=r.allocateTextureUnit();return e}function v0(r,t){const e=this.cache;e[0]!==t&&(r.uniform1f(this.addr,t),e[0]=t)}function y0(r,t){const e=this.cache;if(t.x!==void 0)(e[0]!==t.x||e[1]!==t.y)&&(r.uniform2f(this.addr,t.x,t.y),e[0]=t.x,e[1]=t.y);else{if(Me(e,t))return;r.uniform2fv(this.addr,t),Se(e,t)}}function M0(r,t){const e=this.cache;if(t.x!==void 0)(e[0]!==t.x||e[1]!==t.y||e[2]!==t.z)&&(r.uniform3f(this.addr,t.x,t.y,t.z),e[0]=t.x,e[1]=t.y,e[2]=t.z);else if(t.r!==void 0)(e[0]!==t.r||e[1]!==t.g||e[2]!==t.b)&&(r.uniform3f(this.addr,t.r,t.g,t.b),e[0]=t.r,e[1]=t.g,e[2]=t.b);else{if(Me(e,t))return;r.uniform3fv(this.addr,t),Se(e,t)}}function S0(r,t){const e=this.cache;if(t.x!==void 0)(e[0]!==t.x||e[1]!==t.y||e[2]!==t.z||e[3]!==t.w)&&(r.uniform4f(this.addr,t.x,t.y,t.z,t.w),e[0]=t.x,e[1]=t.y,e[2]=t.z,e[3]=t.w);else{if(Me(e,t))return;r.uniform4fv(this.addr,t),Se(e,t)}}function b0(r,t){const e=this.cache,n=t.elements;if(n===void 0){if(Me(e,t))return;r.uniformMatrix2fv(this.addr,!1,t),Se(e,t)}else{if(Me(e,n))return;bh.set(n),r.uniformMatrix2fv(this.addr,!1,bh),Se(e,n)}}function E0(r,t){const e=this.cache,n=t.elements;if(n===void 0){if(Me(e,t))return;r.uniformMatrix3fv(this.addr,!1,t),Se(e,t)}else{if(Me(e,n))return;Sh.set(n),r.uniformMatrix3fv(this.addr,!1,Sh),Se(e,n)}}function T0(r,t){const e=this.cache,n=t.elements;if(n===void 0){if(Me(e,t))return;r.uniformMatrix4fv(this.addr,!1,t),Se(e,t)}else{if(Me(e,n))return;Mh.set(n),r.uniformMatrix4fv(this.addr,!1,Mh),Se(e,n)}}function A0(r,t){const e=this.cache;e[0]!==t&&(r.uniform1i(this.addr,t),e[0]=t)}function w0(r,t){const e=this.cache;if(t.x!==void 0)(e[0]!==t.x||e[1]!==t.y)&&(r.uniform2i(this.addr,t.x,t.y),e[0]=t.x,e[1]=t.y);else{if(Me(e,t))return;r.uniform2iv(this.addr,t),Se(e,t)}}function C0(r,t){const e=this.cache;if(t.x!==void 0)(e[0]!==t.x||e[1]!==t.y||e[2]!==t.z)&&(r.uniform3i(this.addr,t.x,t.y,t.z),e[0]=t.x,e[1]=t.y,e[2]=t.z);else{if(Me(e,t))return;r.uniform3iv(this.addr,t),Se(e,t)}}function R0(r,t){const e=this.cache;if(t.x!==void 0)(e[0]!==t.x||e[1]!==t.y||e[2]!==t.z||e[3]!==t.w)&&(r.uniform4i(this.addr,t.x,t.y,t.z,t.w),e[0]=t.x,e[1]=t.y,e[2]=t.z,e[3]=t.w);else{if(Me(e,t))return;r.uniform4iv(this.addr,t),Se(e,t)}}function I0(r,t){const e=this.cache;e[0]!==t&&(r.uniform1ui(this.addr,t),e[0]=t)}function P0(r,t){const e=this.cache;if(t.x!==void 0)(e[0]!==t.x||e[1]!==t.y)&&(r.uniform2ui(this.addr,t.x,t.y),e[0]=t.x,e[1]=t.y);else{if(Me(e,t))return;r.uniform2uiv(this.addr,t),Se(e,t)}}function L0(r,t){const e=this.cache;if(t.x!==void 0)(e[0]!==t.x||e[1]!==t.y||e[2]!==t.z)&&(r.uniform3ui(this.addr,t.x,t.y,t.z),e[0]=t.x,e[1]=t.y,e[2]=t.z);else{if(Me(e,t))return;r.uniform3uiv(this.addr,t),Se(e,t)}}function D0(r,t){const e=this.cache;if(t.x!==void 0)(e[0]!==t.x||e[1]!==t.y||e[2]!==t.z||e[3]!==t.w)&&(r.uniform4ui(this.addr,t.x,t.y,t.z,t.w),e[0]=t.x,e[1]=t.y,e[2]=t.z,e[3]=t.w);else{if(Me(e,t))return;r.uniform4uiv(this.addr,t),Se(e,t)}}function U0(r,t,e){const n=this.cache,i=e.allocateTextureUnit();n[0]!==i&&(r.uniform1i(this.addr,i),n[0]=i);let s;this.type===r.SAMPLER_2D_SHADOW?(xh.compareFunction=Xh,s=xh):s=Tu,e.setTexture2D(t||s,i)}function N0(r,t,e){const n=this.cache,i=e.allocateTextureUnit();n[0]!==i&&(r.uniform1i(this.addr,i),n[0]=i),e.setTexture3D(t||wu,i)}function F0(r,t,e){const n=this.cache,i=e.allocateTextureUnit();n[0]!==i&&(r.uniform1i(this.addr,i),n[0]=i),e.setTextureCube(t||Cu,i)}function O0(r,t,e){const n=this.cache,i=e.allocateTextureUnit();n[0]!==i&&(r.uniform1i(this.addr,i),n[0]=i),e.setTexture2DArray(t||Au,i)}function B0(r){switch(r){case 5126:return v0;case 35664:return y0;case 35665:return M0;case 35666:return S0;case 35674:return b0;case 35675:return E0;case 35676:return T0;case 5124:case 35670:return A0;case 35667:case 35671:return w0;case 35668:case 35672:return C0;case 35669:case 35673:return R0;case 5125:return I0;case 36294:return P0;case 36295:return L0;case 36296:return D0;case 35678:case 36198:case 36298:case 36306:case 35682:return U0;case 35679:case 36299:case 36307:return N0;case 35680:case 36300:case 36308:case 36293:return F0;case 36289:case 36303:case 36311:case 36292:return O0}}function z0(r,t){r.uniform1fv(this.addr,t)}function k0(r,t){const e=us(t,this.size,2);r.uniform2fv(this.addr,e)}function V0(r,t){const e=us(t,this.size,3);r.uniform3fv(this.addr,e)}function H0(r,t){const e=us(t,this.size,4);r.uniform4fv(this.addr,e)}function G0(r,t){const e=us(t,this.size,4);r.uniformMatrix2fv(this.addr,!1,e)}function W0(r,t){const e=us(t,this.size,9);r.uniformMatrix3fv(this.addr,!1,e)}function X0(r,t){const e=us(t,this.size,16);r.uniformMatrix4fv(this.addr,!1,e)}function q0(r,t){r.uniform1iv(this.addr,t)}function Y0(r,t){r.uniform2iv(this.addr,t)}function Z0(r,t){r.uniform3iv(this.addr,t)}function J0(r,t){r.uniform4iv(this.addr,t)}function $0(r,t){r.uniform1uiv(this.addr,t)}function K0(r,t){r.uniform2uiv(this.addr,t)}function Q0(r,t){r.uniform3uiv(this.addr,t)}function j0(r,t){r.uniform4uiv(this.addr,t)}function tx(r,t,e){const n=this.cache,i=t.length,s=xa(e,i);Me(n,s)||(r.uniform1iv(this.addr,s),Se(n,s));for(let a=0;a!==i;++a)e.setTexture2D(t[a]||Tu,s[a])}function ex(r,t,e){const n=this.cache,i=t.length,s=xa(e,i);Me(n,s)||(r.uniform1iv(this.addr,s),Se(n,s));for(let a=0;a!==i;++a)e.setTexture3D(t[a]||wu,s[a])}function nx(r,t,e){const n=this.cache,i=t.length,s=xa(e,i);Me(n,s)||(r.uniform1iv(this.addr,s),Se(n,s));for(let a=0;a!==i;++a)e.setTextureCube(t[a]||Cu,s[a])}function ix(r,t,e){const n=this.cache,i=t.length,s=xa(e,i);Me(n,s)||(r.uniform1iv(this.addr,s),Se(n,s));for(let a=0;a!==i;++a)e.setTexture2DArray(t[a]||Au,s[a])}function sx(r){switch(r){case 5126:return z0;case 35664:return k0;case 35665:return V0;case 35666:return H0;case 35674:return G0;case 35675:return W0;case 35676:return X0;case 5124:case 35670:return q0;case 35667:case 35671:return Y0;case 35668:case 35672:return Z0;case 35669:case 35673:return J0;case 5125:return $0;case 36294:return K0;case 36295:return Q0;case 36296:return j0;case 35678:case 36198:case 36298:case 36306:case 35682:return tx;case 35679:case 36299:case 36307:return ex;case 35680:case 36300:case 36308:case 36293:return nx;case 36289:case 36303:case 36311:case 36292:return ix}}class rx{constructor(t,e,n){this.id=t,this.addr=n,this.cache=[],this.type=e.type,this.setValue=B0(e.type)}}class ax{constructor(t,e,n){this.id=t,this.addr=n,this.cache=[],this.type=e.type,this.size=e.size,this.setValue=sx(e.type)}}class ox{constructor(t){this.id=t,this.seq=[],this.map={}}setValue(t,e,n){const i=this.seq;for(let s=0,a=i.length;s!==a;++s){const o=i[s];o.setValue(t,e[o.id],n)}}}const fo=/(\w+)(\])?(\[|\.)?/g;function Eh(r,t){r.seq.push(t),r.map[t.id]=t}function lx(r,t,e){const n=r.name,i=n.length;for(fo.lastIndex=0;;){const s=fo.exec(n),a=fo.lastIndex;let o=s[1];const l=s[2]==="]",c=s[3];if(l&&(o=o|0),c===void 0||c==="["&&a+2===i){Eh(e,c===void 0?new rx(o,r,t):new ax(o,r,t));break}else{let u=e.map[o];u===void 0&&(u=new ox(o),Eh(e,u)),e=u}}}class Yr{constructor(t,e){this.seq=[],this.map={};const n=t.getProgramParameter(e,t.ACTIVE_UNIFORMS);for(let i=0;i<n;++i){const s=t.getActiveUniform(e,i),a=t.getUniformLocation(e,s.name);lx(s,a,this)}}setValue(t,e,n,i){const s=this.map[e];s!==void 0&&s.setValue(t,n,i)}setOptional(t,e,n){const i=e[n];i!==void 0&&this.setValue(t,n,i)}static upload(t,e,n,i){for(let s=0,a=e.length;s!==a;++s){const o=e[s],l=n[o.id];l.needsUpdate!==!1&&o.setValue(t,l.value,i)}}static seqWithValue(t,e){const n=[];for(let i=0,s=t.length;i!==s;++i){const a=t[i];a.id in e&&n.push(a)}return n}}function Th(r,t,e){const n=r.createShader(t);return r.shaderSource(n,e),r.compileShader(n),n}const cx=37297;let hx=0;function ux(r,t){const e=r.split(`
3730`),n=[],i=Math.max(t-6,0),s=Math.min(t+6,e.length);for(let a=i;a<s;a++){const o=a+1;n.push(`${o===t?">":" "} ${o}: ${e[a]}`)}return n.join(`
3731`)}const Ah=new Xt;function dx(r){Kt._getMatrix(Ah,Kt.workingColorSpace,r);const t=`mat3( ${Ah.elements.map(e=>e.toFixed(4))} )`;switch(Kt.getTransfer(r)){case ta:return[t,"LinearTransferOETF"];case ae:return[t,"sRGBTransferOETF"];default:return console.warn("THREE.WebGLProgram: Unsupported color space: ",r),[t,"LinearTransferOETF"]}}function wh(r,t,e){const n=r.getShaderParameter(t,r.COMPILE_STATUS),s=(r.getShaderInfoLog(t)||"").trim();if(n&&s==="")return"";const a=/ERROR: 0:(\d+)/.exec(s);if(a){const o=parseInt(a[1]);return e.toUpperCase()+`
3732
3733`+s+`
3734
3735`+ux(r.getShaderSource(t),o)}else return s}function fx(r,t){const e=dx(t);return[`vec4 ${r}( vec4 value ) {`,`	return ${e[1]}( vec4( value.rgb * ${e[0]}, value.a ) );`,"}"].join(`
3736`)}function px(r,t){let e;switch(t){case rd:e="Linear";break;case ad:e="Reinhard";break;case od:e="Cineon";break;case ld:e="ACESFilmic";break;case hd:e="AgX";break;case ud:e="Neutral";break;case cd:e="Custom";break;default:console.warn("THREE.WebGLProgram: Unsupported toneMapping:",t),e="Linear"}return"vec3 "+r+"( vec3 color ) { return "+e+"ToneMapping( color ); }"}const kr=new C;function mx(){Kt.getLuminanceCoefficients(kr);const r=kr.x.toFixed(4),t=kr.y.toFixed(4),e=kr.z.toFixed(4);return["float luminance( const in vec3 rgb ) {",`	const vec3 weights = vec3( ${r}, ${t}, ${e} );`,"	return dot( weights, rgb );","}"].join(`
3737`)}function gx(r){return[r.extensionClipCullDistance?"#extension GL_ANGLE_clip_cull_distance : require":"",r.extensionMultiDraw?"#extension GL_ANGLE_multi_draw : require":""].filter(Rs).join(`
3738`)}function _x(r){const t=[];for(const e in r){const n=r[e];n!==!1&&t.push("#define "+e+" "+n)}return t.join(`
3739`)}function xx(r,t){const e={},n=r.getProgramParameter(t,r.ACTIVE_ATTRIBUTES);for(let i=0;i<n;i++){const s=r.getActiveAttrib(t,i),a=s.name;let o=1;s.type===r.FLOAT_MAT2&&(o=2),s.type===r.FLOAT_MAT3&&(o=3),s.type===r.FLOAT_MAT4&&(o=4),e[a]={type:s.type,location:r.getAttribLocation(t,a),locationSize:o}}return e}function Rs(r){return r!==""}function Ch(r,t){const e=t.numSpotLightShadows+t.numSpotLightMaps-t.numSpotLightShadowsWithMaps;return r.replace(/NUM_DIR_LIGHTS/g,t.numDirLights).replace(/NUM_SPOT_LIGHTS/g,t.numSpotLights).replace(/NUM_SPOT_LIGHT_MAPS/g,t.numSpotLightMaps).replace(/NUM_SPOT_LIGHT_COORDS/g,e).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_WITH_MAPS/g,t.numSpotLightShadowsWithMaps).replace(/NUM_SPOT_LIGHT_SHADOWS/g,t.numSpotLightShadows).replace(/NUM_POINT_LIGHT_SHADOWS/g,t.numPointLightShadows)}function Rh(r,t){return r.replace(/NUM_CLIPPING_PLANES/g,t.numClippingPlanes).replace(/UNION_CLIPPING_PLANES/g,t.numClippingPlanes-t.numClipIntersection)}const vx=/^[ \t]*#include +<([\w\d./]+)>/gm;function il(r){return r.replace(vx,Mx)}const yx=new Map;function Mx(r,t){let e=Jt[t];if(e===void 0){const n=yx.get(t);if(n!==void 0)e=Jt[n],console.warn('THREE.WebGLRenderer: Shader chunk "%s" has been deprecated. Use "%s" instead.',t,n);else throw new Error("Can not resolve #include <"+t+">")}return il(e)}const Sx=/#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 Ih(r){return r.replace(Sx,bx)}function bx(r,t,e,n){let i="";for(let s=parseInt(t);s<parseInt(e);s++)i+=n.replace(/\[\s*i\s*\]/g,"[ "+s+" ]").replace(/UNROLLED_LOOP_INDEX/g,s);return i}function Ph(r){let t=`precision ${r.precision} float;
3740	precision ${r.precision} int;
3741	precision ${r.precision} sampler2D;
3742	precision ${r.precision} samplerCube;
3743	precision ${r.precision} sampler3D;
3744	precision ${r.precision} sampler2DArray;
3745	precision ${r.precision} sampler2DShadow;
3746	precision ${r.precision} samplerCubeShadow;
3747	precision ${r.precision} sampler2DArrayShadow;
3748	precision ${r.precision} isampler2D;
3749	precision ${r.precision} isampler3D;
3750	precision ${r.precision} isamplerCube;
3751	precision ${r.precision} isampler2DArray;
3752	precision ${r.precision} usampler2D;
3753	precision ${r.precision} usampler3D;
3754	precision ${r.precision} usamplerCube;
3755	precision ${r.precision} usampler2DArray;
3756	`;return r.precision==="highp"?t+=`
3757#define HIGH_PRECISION`:r.precision==="mediump"?t+=`
3758#define MEDIUM_PRECISION`:r.precision==="lowp"&&(t+=`
3759#define LOW_PRECISION`),t}function Ex(r){let t="SHADOWMAP_TYPE_BASIC";return r.shadowMapType===Nh?t="SHADOWMAP_TYPE_PCF":r.shadowMapType===Bu?t="SHADOWMAP_TYPE_PCF_SOFT":r.shadowMapType===Tn&&(t="SHADOWMAP_TYPE_VSM"),t}function Tx(r){let t="ENVMAP_TYPE_CUBE";if(r.envMap)switch(r.envMapMode){case qn:case xi:t="ENVMAP_TYPE_CUBE";break;case Gs:t="ENVMAP_TYPE_CUBE_UV";break}return t}function Ax(r){let t="ENVMAP_MODE_REFLECTION";return r.envMap&&r.envMapMode===xi&&(t="ENVMAP_MODE_REFRACTION"),t}function wx(r){let t="ENVMAP_BLENDING_NONE";if(r.envMap)switch(r.combine){case ca:t="ENVMAP_BLENDING_MULTIPLY";break;case id:t="ENVMAP_BLENDING_MIX";break;case sd:t="ENVMAP_BLENDING_ADD";break}return t}function Cx(r){const t=r.envMapCubeUVHeight;if(t===null)return null;const e=Math.log2(t)-2,n=1/t;return{texelWidth:1/(3*Math.max(Math.pow(2,e),112)),texelHeight:n,maxMip:e}}function Rx(r,t,e,n){const i=r.getContext(),s=e.defines;let a=e.vertexShader,o=e.fragmentShader;const l=Ex(e),c=Tx(e),h=Ax(e),u=wx(e),d=Cx(e),f=gx(e),m=_x(s),_=i.createProgram();let g,p,y=e.glslVersion?"#version "+e.glslVersion+`
3760`:"";e.isRawShaderMaterial?(g=["#define SHADER_TYPE "+e.shaderType,"#define SHADER_NAME "+e.shaderName,m].filter(Rs).join(`
3761`),g.length>0&&(g+=`
3762`),p=["#define SHADER_TYPE "+e.shaderType,"#define SHADER_NAME "+e.shaderName,m].filter(Rs).join(`
3763`),p.length>0&&(p+=`
3764`)):(g=[Ph(e),"#define SHADER_TYPE "+e.shaderType,"#define SHADER_NAME "+e.shaderName,m,e.extensionCl
vendor: 6,455 bytes, lines 3764-3766
3764ipCullDistance?"#define USE_CLIP_DISTANCE":"",e.batching?"#define USE_BATCHING":"",e.batchingColor?"#define USE_BATCHING_COLOR":"",e.instancing?"#define USE_INSTANCING":"",e.instancingColor?"#define USE_INSTANCING_COLOR":"",e.instancingMorph?"#define USE_INSTANCING_MORPH":"",e.useFog&&e.fog?"#define USE_FOG":"",e.useFog&&e.fogExp2?"#define FOG_EXP2":"",e.map?"#define USE_MAP":"",e.envMap?"#define USE_ENVMAP":"",e.envMap?"#define "+h:"",e.lightMap?"#define USE_LIGHTMAP":"",e.aoMap?"#define USE_AOMAP":"",e.bumpMap?"#define USE_BUMPMAP":"",e.normalMap?"#define USE_NORMALMAP":"",e.normalMapObjectSpace?"#define USE_NORMALMAP_OBJECTSPACE":"",e.normalMapTangentSpace?"#define USE_NORMALMAP_TANGENTSPACE":"",e.displacementMap?"#define USE_DISPLACEMENTMAP":"",e.emissiveMap?"#define USE_EMISSIVEMAP":"",e.anisotropy?"#define USE_ANISOTROPY":"",e.anisotropyMap?"#define USE_ANISOTROPYMAP":"",e.clearcoatMap?"#define USE_CLEARCOATMAP":"",e.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",e.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",e.iridescenceMap?"#define USE_IRIDESCENCEMAP":"",e.iridescenceThicknessMap?"#define USE_IRIDESCENCE_THICKNESSMAP":"",e.specularMap?"#define USE_SPECULARMAP":"",e.specularColorMap?"#define USE_SPECULAR_COLORMAP":"",e.specularIntensityMap?"#define USE_SPECULAR_INTENSITYMAP":"",e.roughnessMap?"#define USE_ROUGHNESSMAP":"",e.metalnessMap?"#define USE_METALNESSMAP":"",e.alphaMap?"#define USE_ALPHAMAP":"",e.alphaHash?"#define USE_ALPHAHASH":"",e.transmission?"#define USE_TRANSMISSION":"",e.transmissionMap?"#define USE_TRANSMISSIONMAP":"",e.thicknessMap?"#define USE_THICKNESSMAP":"",e.sheenColorMap?"#define USE_SHEEN_COLORMAP":"",e.sheenRoughnessMap?"#define USE_SHEEN_ROUGHNESSMAP":"",e.mapUv?"#define MAP_UV "+e.mapUv:"",e.alphaMapUv?"#define ALPHAMAP_UV "+e.alphaMapUv:"",e.lightMapUv?"#define LIGHTMAP_UV "+e.lightMapUv:"",e.aoMapUv?"#define AOMAP_UV "+e.aoMapUv:"",e.emissiveMapUv?"#define EMISSIVEMAP_UV "+e.emissiveMapUv:"",e.bumpMapUv?"#define BUMPMAP_UV "+e.bumpMapUv:"",e.normalMapUv?"#define NORMALMAP_UV "+e.normalMapUv:"",e.displacementMapUv?"#define DISPLACEMENTMAP_UV "+e.displacementMapUv:"",e.metalnessMapUv?"#define METALNESSMAP_UV "+e.metalnessMapUv:"",e.roughnessMapUv?"#define ROUGHNESSMAP_UV "+e.roughnessMapUv:"",e.anisotropyMapUv?"#define ANISOTROPYMAP_UV "+e.anisotropyMapUv:"",e.clearcoatMapUv?"#define CLEARCOATMAP_UV "+e.clearcoatMapUv:"",e.clearcoatNormalMapUv?"#define CLEARCOAT_NORMALMAP_UV "+e.clearcoatNormalMapUv:"",e.clearcoatRoughnessMapUv?"#define CLEARCOAT_ROUGHNESSMAP_UV "+e.clearcoatRoughnessMapUv:"",e.iridescenceMapUv?"#define IRIDESCENCEMAP_UV "+e.iridescenceMapUv:"",e.iridescenceThicknessMapUv?"#define IRIDESCENCE_THICKNESSMAP_UV "+e.iridescenceThicknessMapUv:"",e.sheenColorMapUv?"#define SHEEN_COLORMAP_UV "+e.sheenColorMapUv:"",e.sheenRoughnessMapUv?"#define SHEEN_ROUGHNESSMAP_UV "+e.sheenRoughnessMapUv:"",e.specularMapUv?"#define SPECULARMAP_UV "+e.specularMapUv:"",e.specularColorMapUv?"#define SPECULAR_COLORMAP_UV "+e.specularColorMapUv:"",e.specularIntensityMapUv?"#define SPECULAR_INTENSITYMAP_UV "+e.specularIntensityMapUv:"",e.transmissionMapUv?"#define TRANSMISSIONMAP_UV "+e.transmissionMapUv:"",e.thicknessMapUv?"#define THICKNESSMAP_UV "+e.thicknessMapUv:"",e.vertexTangents&&e.flatShading===!1?"#define USE_TANGENT":"",e.vertexColors?"#define USE_COLOR":"",e.vertexAlphas?"#define USE_COLOR_ALPHA":"",e.vertexUv1s?"#define USE_UV1":"",e.vertexUv2s?"#define USE_UV2":"",e.vertexUv3s?"#define USE_UV3":"",e.pointsUvs?"#define USE_POINTS_UV":"",e.flatShading?"#define FLAT_SHADED":"",e.skinning?"#define USE_SKINNING":"",e.morphTargets?"#define USE_MORPHTARGETS":"",e.morphNormals&&e.flatShading===!1?"#define USE_MORPHNORMALS":"",e.morphColors?"#define USE_MORPHCOLORS":"",e.morphTargetsCount>0?"#define MORPHTARGETS_TEXTURE_STRIDE "+e.morphTextureStride:"",e.morphTargetsCount>0?"#define MORPHTARGETS_COUNT "+e.morphTargetsCount:"",e.doubleSided?"#define DOUBLE_SIDED":"",e.flipSided?"#define FLIP_SIDED":"",e.shadowMapEnabled?"#define USE_SHADOWMAP":"",e.shadowMapEnabled?"#define "+l:"",e.sizeAttenuation?"#define USE_SIZEATTENUATION":"",e.numLightProbes>0?"#define USE_LIGHT_PROBES":"",e.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",e.reversedDepthBuffer?"#define USE_REVERSEDEPTHBUF":"","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","#ifdef USE_INSTANCING_MORPH","	uniform sampler2D morphTexture;","#endif","attribute vec3 position;","attribute vec3 normal;","attribute vec2 uv;","#ifdef USE_UV1","	attribute vec2 uv1;","#endif","#ifdef USE_UV2","	attribute vec2 uv2;","#endif","#ifdef USE_UV3","	attribute vec2 uv3;","#endif","#ifdef USE_TANGENT","	attribute vec4 tangent;","#endif","#if defined( USE_COLOR_ALPHA )","	attribute vec4 color;","#elif defined( USE_COLOR )","	attribute vec3 color;","#endif","#ifdef USE_SKINNING","	attribute vec4 skinIndex;","	attribute vec4 skinWeight;","#endif",`
3765`].filter(Rs).join(`
3766`),p=[Ph(e),"#define SHADER_TYPE "+e.shaderType,"#define SHADER_NAME "+e.shaderName,m,e.useFog&&e.fog?"#define USE_FOG":"",e.useFog&&e.fogExp2?"#define FOG_EXP2":"",e.alphaToCoverage?"#define ALPHA_TO_COVERAGE":"",e.map?"#define USE_MAP":"",e.matcap?"#define USE_MATCAP":"",e.envMap?"#define USE_ENVMAP":"",e.envMap?"#define "+c:"",e.envMap?"#define "+h:"",e.envMap?"#define "+u:"",d?"#define CUBEUV_TEXEL_WIDTH "+d.texelWidth:"",d?"#define CUBEUV_TEXEL_HEIGHT "+d.texelHeight:"",d?"#define CUBEUV_MAX_MIP "+d.maxMip+".0":"",e.lightMap?"#define USE_LIGHTMAP":"",e.aoMap?"#define USE_AOMAP":"",e.bumpMap?"#define USE_BUMPMAP":"",e.normalMap?"#define USE_NORMALMAP":"",e.normalMapObjectSpace?"#define USE_NORMALMAP_OBJECTSPACE":"",e.normalMapTangentSpace?"#define USE_NORMALMAP_TANGENTSPACE":"",e.emissiveMap?"#define USE_EMISSIVEMAP":"",e.anisotropy?"#define USE_ANISOTROPY":"",e.anisotropyMap?"#define USE_ANISOTROPYMAP":"",e.clearcoat?"#define USE_CLEARCOAT":"",e.clearcoatMap?"#define USE_CLEARCOATMAP":"",e.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",e.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",e.dispersion?"#define USE_DISPERSION":"",e.iridescence?"#define USE_IR
3766IDESCENCE":"",e.iridescenceMap?"#define USE_IRIDESCENCEMAP":"",e.iridescenceThicknessMap?"#define USE_IRIDESCENCE_THICKNESSMAP":"",e.specularMap?"#define USE_SPECULARMAP":"",e.specularColorMap?"#define USE_SPECULAR_COLORMAP":"",e.specularIntensityMap?"#define USE_SPECULAR_INTENSITYMAP":"",e.roughnessMap?"#define USE_ROUGHNESSMAP":"",e.metalnessMap?"#define USE_METALNESSMAP":"",e.alphaMap?"#define USE_ALPHAMAP":"",e.alphaTest?"#define USE_ALPHATEST":"",e.alphaHash?"#define USE_ALPHAHASH":"",e.sheen?"#define USE_SHEEN":"",e.sheenColorMap?"#define USE_SHEEN_COLORMAP":"",e.sheenRoughnessMap?"#define USE_SHEEN_ROUGHNESSMAP":"",e.transmission?"#define USE_TRANSMISSION":"",e.transmissionMap?"#define USE_TRANSMISSIONMAP":"",e.thicknessMap?"#define USE_THICKNESSMAP":"",e.vertexTangents&&e.flatShading===!1?"#define USE_TANGENT":"",e.vertexColors||e.instancingColor||e.batchingColor?"#define USE_COLOR":"",e.vertexAlphas?"#define USE_COLOR_ALPHA":"",e.vertexUv1s?"#define USE_UV1":"",e.vertexUv2s?"#define USE_UV2":"",e.vertexUv3s?"#define USE_UV3":"",e.pointsUvs?"#define USE_POINTS_UV":"",e.gradientMap?"#define USE_GRADIENTMAP":"",e.flatShading?"#define FLAT_SHADED":"",e.doubleSided?"#define DOUBLE_SIDED":"",e.flipSided?"#define FLIP_SIDED":"",e.shadowMapEnabled?"#define USE_SHADOWMAP":"",e.shadowMapEnabled?"#define "+l:"",e.premultipliedAlpha?"#define PREMULTIPLIED_ALPHA":"",e.numLightProbes>0?"#define USE_LIGHT_PROBES":"",e.decodeVideoTexture?"#define DECODE_VIDEO_TEXTURE":"",e.decodeVideoTextureEmissive?"#define DECODE_VIDEO_TEXTURE_EMISSIVE":"",e.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",e.reversedDepthBuffer?"#define USE_REVERSEDEPTHBUF":"","uniform mat4 viewMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;",e.toneMapping!==Wn?"#define TONE_MAPPING":"",e.toneMapping!==Wn?Jt.tonemapping_pars_fragment:"",e.toneMapping!==Wn?px("toneMapping",e.toneMapping):"",e.dithering?"#define DITHERING":"",e.opaque?"#define OPAQUE":"",Jt.colorspace_pars_fragment,fx("linearToOutputTexel",e.outputColorSpace),mx(),e.useDepthPacking?"#define DEPTH_PACKING "+e.depthPacking:"",`
3767`].filter(Rs).join(`
3768`)),a=il(a),a=Ch(a,e),a=Rh(a,e),o=il(o),o=Ch(o,e),o=Rh(o,e),a=Ih(a),o=Ih(o),e.isRawShaderMaterial!==!0&&(y=`#version 300 es
3769`,g=[f,"#define attribute in","#define varying out","#define texture2D texture"].join(`
3770`)+`
3771`+g,p=["#define varying in",e.glslVersion===nc?"":"layout(location = 0) out highp vec4 pc_fragColor;",e.glslVersion===nc?"":"#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(`
3772`)+`
3773`+p);const v=y+g+a,x=y+p+o,A=Th(i,i.VERTEX_SHADER,v),T=Th(i,i.FRAGMENT_SHADER,x);i.attachShader(_,A),i.attachShader(_,T),e.index0AttributeName!==void 0?i.bindAttribLocation(_,0,e.index0AttributeName):e.morphTargets===!0&&i.bindAttribLocation(_,0,"position"),i.linkProgram(_);function R(I){if(r.debug.checkShaderErrors){const B=i.getProgramInfoLog(_)||"",k=i.getShaderInfoLog(A)||"",V=i.getShaderInfoLog(T)||"",Z=B.trim(),W=k.trim(),nt=V.trim();let G=!0,dt=!0;if(i.getProgramParameter(_,i.LINK_STATUS)===!1)if(G=!1,typeof r.debug.onShaderError=="function")r.debug.onShaderError(i,_,A,T);else{const _t=wh(i,A,"vertex"),bt=wh(i,T,"fragment");console.error("THREE.WebGLProgram: Shader Error "+i.getError()+" - VALIDATE_STATUS "+i.getProgramParameter(_,i.VALIDATE_STATUS)+`
3774
3775Material Name: `+I.name+`
3776Material Type: `+I.type+`
3777
3778Program Info Log: `+Z+`
3779`+_t+`
3780`+bt)}else Z!==""?console.warn("THREE.WebGLProgram: Program Info Log:",Z):(W===""||nt==="")&&(dt=!1);dt&&(I.diagnostics={runnable:G,programLog:Z,vertexShader:{log:W,prefix:g},fragmentShader:{log:nt,prefix:p}})}i.deleteShader(A),i.deleteShader(T),P=new Yr(i,_),b=xx(i,_)}let P;this.getUniforms=function(){return P===void 0&&R(this),P};let b;this.getAttributes=function(){return b===void 0&&R(this),b};let S=e.rendererExtensionParallelShaderCompile===!1;return this.isReady=function(){return S===!1&&(S=i.getProgramParameter(_,cx)),S},this.destroy=function(){n.releaseStatesOfProgram(this),i.deleteProgram(_),this.program=void 0},this.type=e.shaderType,this.name=e.shaderName,this.id=hx++,this.cacheKey=t,this.usedTimes=1,this.program=_,this.vertexShader=A,this.fragmentShader=T,this}let Ix=0;class Px{constructor(){this.shaderCache=new Map,this.materialCache=new Map}update(t){const e=t.vertexShader,n=t.fragmentShader,i=this._getShaderStage(e),s=this._getShaderStage(n),a=this._getShaderCacheForMaterial(t);return a.has(i)===!1&&(a.add(i),i.usedTimes++),a.has(s)===!1&&(a.add(s),s.usedTimes++),this}remove(t){const e=this.materialCache.get(t);for(const n of e)n.usedTimes--,n.usedTimes===0&&this.shaderCache.delete(n.code);return this.materialCache.delete(t),this}getVertexShaderID(t){return this._getShaderStage(t.vertexShader).id}getFragmentShaderID(t){return this._getShaderStage(t.fragmentShader).id}dispose(){this.shaderCache.clear(),this.materialCache.clear()}_getShaderCacheForMaterial(t){const e=this.materialCache;let n=e.get(t);return n===void 0&&(n=new Set,e.set(t,n)),n}_getShaderStage(t){const e=this.shaderCache;let n=e.get(t);return n===void 0&&(n=new Lx(t),e.set(t,n)),n}}class Lx{constructor(t){this.id=Ix++,this.code=t,this.usedTimes=0}}function Dx(r,t,e,n,i,s,a){const o=new ml,l=new Px,c=new Set,h=[],u=i.logarithmicDepthBuffer,d=i.vertexTextures;let f=i.precision;const m={MeshDepthMaterial:"depth",MeshDistanceMaterial:"distanceRGBA",MeshNormalMaterial:"normal",MeshBasicMaterial:"basic",MeshLambertMaterial:"lambert",MeshPhongMaterial:"phong",MeshToonMaterial:"toon",MeshStandardMaterial:"physical",MeshPhysicalMaterial:"physical",MeshMatcapMaterial:"matcap",LineBasicMaterial:"basic",LineDashedMaterial:"dashed",PointsMaterial:"points",ShadowMaterial:"shadow",SpriteMaterial:"sprite"};function _(b){return c.add(b),b===0?"uv":`uv${b}`}function g(b,S,I,B,k){const V=B.fog,Z=k.geometry,W=b.isMeshStandardMaterial?B.environment:null,nt=(b.isMeshStandardMaterial?e:t).get(b.envMap||W),G=nt&&nt.mapping===Gs?nt.image.height:null,dt=m[b.type];b.precision!==null&&(f=i.getMaxPrecision(b.precision),f!==b.precision&&console.warn("THREE.WebGLProgram.getParameters:",b.precision,"not supported, using",f,"instead."));const _t=Z.morphAttributes.position||Z.morphAttributes.normal||Z.morphAttributes.color,bt=_t!==void 0?_t.length:0;let Vt=0;Z.morphAttributes.position!==void 0&&(Vt=1),Z.morphAttributes.normal!==void 0&&(Vt=2),Z.morphAttributes.color!==void 0&&(Vt=3);let Qt,jt,q,ft;if(dt){const se=fn[dt];Qt=se.vertexShader,jt=se.fragmentShader}else Qt=b.vertexShader,jt=b.fragmentShader,l.update(b),q=l.getVertexShaderID(b),ft=l.getFragmentShaderID(b);const lt=r.getRenderTarget(),Lt=r.state.buffers.depth.getReversed(),Ct=k.isInstancedMesh===!0,Ft=k.isBatchedMesh===!0,ue=!!b.map,Ht=!!b.matcap,L=!!nt,Q=!!b.aoMap,Y=!!b.lightMap,tt=!!b.bumpMap,J=!!b.normalMap,ct=!!b.displacementMap,et=!!b.emissiveMap,ht=!!b.metalnessMap,Gt=!!b.roughnessMap,kt=b.anisotropy>0,w=b.clearcoat>0,M=b.dispersion>0,F=b.iridescence>0,H=b.sheen>0,j=b.transmission>0,X=kt&&!!b.anisotropyMap,Rt=w&&!!b.clearcoatMap,ot=w&&!!b.clearcoatNormalMap,Tt=w&&!!b.clearcoatRoughnessMap,At=F&&!!b.iridescenceMap,it=F&&!!b.iridescenceThicknessMap,xt=H&&!!b.sheenColorMap,Ot=H&&!!b.sheenRoughnessMap,It=!!b.specularMap,mt=!!b.specularColorMap,Yt=!!b.specularIntensityMap,D=j&&!!b.transmissionMap,at=j&&!!b.thicknessMap,ut=!!b.gradientMap,Mt=!!b.alphaMap,st=b.alphaTest>0,$=!!b.alphaHash,wt=!!b.extensions;let Wt=Wn;b.toneMapped&&(lt===null||lt.isXRRenderTarget===!0)&&(Wt=r.toneMapping);const ce={shaderID:dt,shaderType:b.type,shaderName:b.name,vertexShader:Qt,fragmentShader:jt,defines:b.defines,customVertexShaderID:q,customFragmentShaderID:ft,isRawShaderMaterial:b.isRawShaderMaterial===!0,glslVersion:b.glslVersion,precision:f,batching:Ft,batchingColor:Ft&&k._colorsTexture!==null,instancing:Ct,instancingColor:Ct&&k.instanceColor!==null,instancingMorph:Ct&&k.morphTexture!==null,supportsVertexTextures:d,outputColorSpace:lt===null?r.outputColorSpace:lt.isXRRenderTarget===!0?lt.texture.colorSpace:is,alphaToCoverage:!!b.alphaToCoverage,map:ue,matcap:Ht,envMap:L,envMapMode:L&&nt.mapping,envMapCubeUVHeight:G,aoMap:Q,lightMap:Y,bumpMap:tt,normalMap:J,displacementMap:d&&ct,emissiveMap:et,normalMapObjectSpace:J&&b.normalMapType===xd,normalMapTangentSpace:J&&b.normalMapType===Mi,metalnessMap:ht,roughnessMap:Gt,anisotropy:kt,anisotropyMap:X,clearcoat:w,clearcoatMap:Rt,clearcoatNormalMap:ot,clearcoatRoughnessMap:Tt,dis
vendor: 4,972 bytes, line 3780
3780persion:M,iridescence:F,iridescenceMap:At,iridescenceThicknessMap:it,sheen:H,sheenColorMap:xt,sheenRoughnessMap:Ot,specularMap:It,specularColorMap:mt,specularIntensityMap:Yt,transmission:j,transmissionMap:D,thicknessMap:at,gradientMap:ut,opaque:b.transparent===!1&&b.blending===Qi&&b.alphaToCoverage===!1,alphaMap:Mt,alphaTest:st,alphaHash:$,combine:b.combine,mapUv:ue&&_(b.map.channel),aoMapUv:Q&&_(b.aoMap.channel),lightMapUv:Y&&_(b.lightMap.channel),bumpMapUv:tt&&_(b.bumpMap.channel),normalMapUv:J&&_(b.normalMap.channel),displacementMapUv:ct&&_(b.displacementMap.channel),emissiveMapUv:et&&_(b.emissiveMap.channel),metalnessMapUv:ht&&_(b.metalnessMap.channel),roughnessMapUv:Gt&&_(b.roughnessMap.channel),anisotropyMapUv:X&&_(b.anisotropyMap.channel),clearcoatMapUv:Rt&&_(b.clearcoatMap.channel),clearcoatNormalMapUv:ot&&_(b.clearcoatNormalMap.channel),clearcoatRoughnessMapUv:Tt&&_(b.clearcoatRoughnessMap.channel),iridescenceMapUv:At&&_(b.iridescenceMap.channel),iridescenceThicknessMapUv:it&&_(b.iridescenceThicknessMap.channel),sheenColorMapUv:xt&&_(b.sheenColorMap.channel),sheenRoughnessMapUv:Ot&&_(b.sheenRoughnessMap.channel),specularMapUv:It&&_(b.specularMap.channel),specularColorMapUv:mt&&_(b.specularColorMap.channel),specularIntensityMapUv:Yt&&_(b.specularIntensityMap.channel),transmissionMapUv:D&&_(b.transmissionMap.channel),thicknessMapUv:at&&_(b.thicknessMap.channel),alphaMapUv:Mt&&_(b.alphaMap.channel),vertexTangents:!!Z.attributes.tangent&&(J||kt),vertexColors:b.vertexColors,vertexAlphas:b.vertexColors===!0&&!!Z.attributes.color&&Z.attributes.color.itemSize===4,pointsUvs:k.isPoints===!0&&!!Z.attributes.uv&&(ue||Mt),fog:!!V,useFog:b.fog===!0,fogExp2:!!V&&V.isFogExp2,flatShading:b.flatShading===!0&&b.wireframe===!1,sizeAttenuation:b.sizeAttenuation===!0,logarithmicDepthBuffer:u,reversedDepthBuffer:Lt,skinning:k.isSkinnedMesh===!0,morphTargets:Z.morphAttributes.position!==void 0,morphNormals:Z.morphAttributes.normal!==void 0,morphColors:Z.morphAttributes.color!==void 0,morphTargetsCount:bt,morphTextureStride:Vt,numDirLights:S.directional.length,numPointLights:S.point.length,numSpotLights:S.spot.length,numSpotLightMaps:S.spotLightMap.length,numRectAreaLights:S.rectArea.length,numHemiLights:S.hemi.length,numDirLightShadows:S.directionalShadowMap.length,numPointLightShadows:S.pointShadowMap.length,numSpotLightShadows:S.spotShadowMap.length,numSpotLightShadowsWithMaps:S.numSpotLightShadowsWithMaps,numLightProbes:S.numLightProbes,numClippingPlanes:a.numPlanes,numClipIntersection:a.numIntersection,dithering:b.dithering,shadowMapEnabled:r.shadowMap.enabled&&I.length>0,shadowMapType:r.shadowMap.type,toneMapping:Wt,decodeVideoTexture:ue&&b.map.isVideoTexture===!0&&Kt.getTransfer(b.map.colorSpace)===ae,decodeVideoTextureEmissive:et&&b.emissiveMap.isVideoTexture===!0&&Kt.getTransfer(b.emissiveMap.colorSpace)===ae,premultipliedAlpha:b.premultipliedAlpha,doubleSided:b.side===An,flipSided:b.side===Ve,useDepthPacking:b.depthPacking>=0,depthPacking:b.depthPacking||0,index0AttributeName:b.index0AttributeName,extensionClipCullDistance:wt&&b.extensions.clipCullDistance===!0&&n.has("WEBGL_clip_cull_distance"),extensionMultiDraw:(wt&&b.extensions.multiDraw===!0||Ft)&&n.has("WEBGL_multi_draw"),rendererExtensionParallelShaderCompile:n.has("KHR_parallel_shader_compile"),customProgramCacheKey:b.customProgramCacheKey()};return ce.vertexUv1s=c.has(1),ce.vertexUv2s=c.has(2),ce.vertexUv3s=c.has(3),c.clear(),ce}function p(b){const S=[];if(b.shaderID?S.push(b.shaderID):(S.push(b.customVertexShaderID),S.push(b.customFragmentShaderID)),b.defines!==void 0)for(const I in b.defines)S.push(I),S.push(b.defines[I]);return b.isRawShaderMaterial===!1&&(y(S,b),v(S,b),S.push(r.outputColorSpace)),S.push(b.customProgramCacheKey),S.join()}function y(b,S){b.push(S.precision),b.push(S.outputColorSpace),b.push(S.envMapMode),b.push(S.envMapCubeUVHeight),b.push(S.mapUv),b.push(S.alphaMapUv),b.push(S.lightMapUv),b.push(S.aoMapUv),b.push(S.bumpMapUv),b.push(S.normalMapUv),b.push(S.displacementMapUv),b.push(S.emissiveMapUv),b.push(S.metalnessMapUv),b.push(S.roughnessMapUv),b.push(S.anisotropyMapUv),b.push(S.clearcoatMapUv),b.push(S.clearcoatNormalMapUv),b.push(S.clearcoatRoughnessMapUv),b.push(S.iridescenceMapUv),b.push(S.iridescenceThicknessMapUv),b.push(S.sheenColorMapUv),b.push(S.sheenRoughnessMapUv),b.push(S.specularMapUv),b.push(S.specularColorMapUv),b.push(S.specularIntensityMapUv),b.push(S.transmissionMapUv),b.push(S.thicknessMapUv),b.push(S.combine),b.push(S.fogExp2),b.push(S.sizeAttenuation),b.push(S.morphTargetsCount),b.push(S.morphAttributeCount),b.push(S.numDirLights),b.push(S.numPointLights),b.push(S.numSpotLights),b.push(S.numSpotLightMaps),b.push(S.numHemiLights),b.push(S.numRectAreaLights),b.push(S.numDirLightShadows),b.push(S.numPointLightShadows),b.push(S.numSpotLightShadows),b.push(S.numSpotLightShadowsWithMaps),b.push(S.numLightProbes),b.push(S.shadowMapType),b.push(S.toneMapping),b.push(S.numClippingPlanes),b.pu
vendor: 10,793 bytes, lines 3780-3786
3780sh(S.numClipIntersection),b.push(S.depthPacking)}function v(b,S){o.disableAll(),S.supportsVertexTextures&&o.enable(0),S.instancing&&o.enable(1),S.instancingColor&&o.enable(2),S.instancingMorph&&o.enable(3),S.matcap&&o.enable(4),S.envMap&&o.enable(5),S.normalMapObjectSpace&&o.enable(6),S.normalMapTangentSpace&&o.enable(7),S.clearcoat&&o.enable(8),S.iridescence&&o.enable(9),S.alphaTest&&o.enable(10),S.vertexColors&&o.enable(11),S.vertexAlphas&&o.enable(12),S.vertexUv1s&&o.enable(13),S.vertexUv2s&&o.enable(14),S.vertexUv3s&&o.enable(15),S.vertexTangents&&o.enable(16),S.anisotropy&&o.enable(17),S.alphaHash&&o.enable(18),S.batching&&o.enable(19),S.dispersion&&o.enable(20),S.batchingColor&&o.enable(21),S.gradientMap&&o.enable(22),b.push(o.mask),o.disableAll(),S.fog&&o.enable(0),S.useFog&&o.enable(1),S.flatShading&&o.enable(2),S.logarithmicDepthBuffer&&o.enable(3),S.reversedDepthBuffer&&o.enable(4),S.skinning&&o.enable(5),S.morphTargets&&o.enable(6),S.morphNormals&&o.enable(7),S.morphColors&&o.enable(8),S.premultipliedAlpha&&o.enable(9),S.shadowMapEnabled&&o.enable(10),S.doubleSided&&o.enable(11),S.flipSided&&o.enable(12),S.useDepthPacking&&o.enable(13),S.dithering&&o.enable(14),S.transmission&&o.enable(15),S.sheen&&o.enable(16),S.opaque&&o.enable(17),S.pointsUvs&&o.enable(18),S.decodeVideoTexture&&o.enable(19),S.decodeVideoTextureEmissive&&o.enable(20),S.alphaToCoverage&&o.enable(21),b.push(o.mask)}function x(b){const S=m[b.type];let I;if(S){const B=fn[S];I=cf.clone(B.uniforms)}else I=b.uniforms;return I}function A(b,S){let I;for(let B=0,k=h.length;B<k;B++){const V=h[B];if(V.cacheKey===S){I=V,++I.usedTimes;break}}return I===void 0&&(I=new Rx(r,S,b,s),h.push(I)),I}function T(b){if(--b.usedTimes===0){const S=h.indexOf(b);h[S]=h[h.length-1],h.pop(),b.destroy()}}function R(b){l.remove(b)}function P(){l.dispose()}return{getParameters:g,getProgramCacheKey:p,getUniforms:x,acquireProgram:A,releaseProgram:T,releaseShaderCache:R,programs:h,dispose:P}}function Ux(){let r=new WeakMap;function t(a){return r.has(a)}function e(a){let o=r.get(a);return o===void 0&&(o={},r.set(a,o)),o}function n(a){r.delete(a)}function i(a,o,l){r.get(a)[o]=l}function s(){r=new WeakMap}return{has:t,get:e,remove:n,update:i,dispose:s}}function Nx(r,t){return r.groupOrder!==t.groupOrder?r.groupOrder-t.groupOrder:r.renderOrder!==t.renderOrder?r.renderOrder-t.renderOrder:r.material.id!==t.material.id?r.material.id-t.material.id:r.z!==t.z?r.z-t.z:r.id-t.id}function Lh(r,t){return r.groupOrder!==t.groupOrder?r.groupOrder-t.groupOrder:r.renderOrder!==t.renderOrder?r.renderOrder-t.renderOrder:r.z!==t.z?t.z-r.z:r.id-t.id}function Dh(){const r=[];let t=0;const e=[],n=[],i=[];function s(){t=0,e.length=0,n.length=0,i.length=0}function a(u,d,f,m,_,g){let p=r[t];return p===void 0?(p={id:u.id,object:u,geometry:d,material:f,groupOrder:m,renderOrder:u.renderOrder,z:_,group:g},r[t]=p):(p.id=u.id,p.object=u,p.geometry=d,p.material=f,p.groupOrder=m,p.renderOrder=u.renderOrder,p.z=_,p.group=g),t++,p}function o(u,d,f,m,_,g){const p=a(u,d,f,m,_,g);f.transmission>0?n.push(p):f.transparent===!0?i.push(p):e.push(p)}function l(u,d,f,m,_,g){const p=a(u,d,f,m,_,g);f.transmission>0?n.unshift(p):f.transparent===!0?i.unshift(p):e.unshift(p)}function c(u,d){e.length>1&&e.sort(u||Nx),n.length>1&&n.sort(d||Lh),i.length>1&&i.sort(d||Lh)}function h(){for(let u=t,d=r.length;u<d;u++){const f=r[u];if(f.id===null)break;f.id=null,f.object=null,f.geometry=null,f.material=null,f.group=null}}return{opaque:e,transmissive:n,transparent:i,init:s,push:o,unshift:l,finish:h,sort:c}}function Fx(){let r=new WeakMap;function t(n,i){const s=r.get(n);let a;return s===void 0?(a=new Dh,r.set(n,[a])):i>=s.length?(a=new Dh,s.push(a)):a=s[i],a}function e(){r=new WeakMap}return{get:t,dispose:e}}function Ox(){const r={};return{get:function(t){if(r[t.id]!==void 0)return r[t.id];let e;switch(t.type){case"DirectionalLight":e={direction:new C,color:new vt};break;case"SpotLight":e={position:new C,direction:new C,color:new vt,distance:0,coneCos:0,penumbraCos:0,decay:0};break;case"PointLight":e={position:new C,color:new vt,distance:0,decay:0};break;case"HemisphereLight":e={direction:new C,skyColor:new vt,groundColor:new vt};break;case"RectAreaLight":e={color:new vt,position:new C,halfWidth:new C,halfHeight:new C};break}return r[t.id]=e,e}}}function Bx(){const r={};return{get:function(t){if(r[t.id]!==void 0)return r[t.id];let e;switch(t.type){case"DirectionalLight":e={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new K};break;case"SpotLight":e={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new K};break;case"PointLight":e={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new K,shadowCameraNear:1,shadowCameraFar:1e3};break}return r[t.id]=e,e}}}let zx=0;function kx(r,t){return(t.castShadow?2:0)-(r.castShadow?2:0)+(t.map?1:0)-(r.map?1:0)}function Vx(r){const t=new Ox,e=Bx(),n={version:0,hash:{directionalLength:-1,pointLength:-1,spotLength:-1,rectAreaLength:-1,hemiLength:-1,numDirectionalShadows:-1,numPointShadows:-1,numSpotShadows:-1,numSpotMaps:-1,numLightProbes:-1},ambient:[0,0,0],probe:[],directional:[],directionalShadow:[],directionalShadowMap:[],directionalShadowMatrix:[],spot:[],spotLightMap:[],spotShadow:[],spotShadowMap:[],spotLightMatrix:[],rectArea:[],rectAreaLTC1:null,rectAreaLTC2:null,point:[],pointShadow:[],pointShadowMap:[],pointShadowMatrix:[],hemi:[],numSpotLightShadowsWithMaps:0,numLightProbes:0};for(let c=0;c<9;c++)n.probe.push(new C);const i=new C,s=new zt,a=new zt;function o(c){let h=0,u=0,d=0;for(let b=0;b<9;b++)n.probe[b].set(0,0,0);let f=0,m=0,_=0,g=0,p=0,y=0,v=0,x=0,A=0,T=0,R=0;c.sort(kx);for(let b=0,S=c.length;b<S;b++){const I=c[b],B=I.color,k=I.intensity,V=I.distance,Z=I.shadow&&I.shadow.map?I.shadow.map.texture:null;if(I.isAmbientLight)h+=B.r*k,u+=B.g*k,d+=B.b*k;else if(I.isLightProbe){for(let W=0;W<9;W++)n.probe[W].addScaledVector(I.sh.coefficients[W],k);R++}else if(I.isDirectionalLight){const W=t.get(I);if(W.color.copy(I.color).multiplyScalar(I.intensity),I.castShadow){const nt=I.shadow,G=e.get(I);G.shadowIntensity=nt.intensity,G.shadowBias=nt.bias,G.shadowNormalBias=nt.normalBias,G.shadowRadius=nt.radius,G.shadowMapSize=nt.mapSize,n.directionalShadow[f]=G,n.directionalShadowMap[f]=Z,n.directionalShadowMatrix[f]=I.shadow.matrix,y++}n.directional[f]=W,f++}else if(I.isSpotLight){const W=t.get(I);W.position.setFromMatrixPosition(I.matrixWorld),W.color.copy(B).multiplyScalar(k),W.distance=V,W.coneCos=Math.cos(I.angle),W.penumbraCos=Math.cos(I.angle*(1-I.penumbra)),W.decay=I.decay,n.spot[_]=W;const nt=I.shadow;if(I.map&&(n.spotLightMap[A]=I.map,A++,nt.updateMatrices(I),I.castShadow&&T++),n.spotLightMatrix[_]=nt.matrix,I.castShadow){const G=e.get(I);G.shadowIntensity=nt.intensity,G.shadowBias=nt.bias,G.shadowNormalBias=nt.normalBias,G.shadowRadius=nt.radius,G.shadowMapSize=nt.mapSize,n.spotShadow[_]=G,n.spotShadowMap[_]=Z,x++}_++}else if(I.isRectAreaLight){const W=t.get(I);W.color.copy(B).multiplyScalar(k),W.halfWidth.set(I.width*.5,0,0),W.halfHeight.set(0,I.height*.5,0),n.rectArea[g]=W,g++}else if(I.isPointLight){const W=t.get(I);if(W.color.copy(I.color).multiplyScalar(I.intensity),W.distance=I.distance,W.decay=I.decay,I.castShadow){const nt=I.shadow,G=e.get(I);G.shadowIntensity=nt.intensity,G.shadowBias=nt.bias,G.shadowNormalBias=nt.normalBias,G.shadowRadius=nt.radius,G.shadowMapSize=nt.mapSize,G.shadowCameraNear=nt.camera.near,G.shadowCameraFar=nt.camera.far,n.pointShadow[m]=G,n.pointShadowMap[m]=Z,n.pointShadowMatrix[m]=I.shadow.matrix,v++}n.point[m]=W,m++}else if(I.isHemisphereLight){const W=t.get(I);W.skyColor.copy(I.color).multiplyScalar(k),W.groundColor.copy(I.groundColor).multiplyScalar(k),n.hemi[p]=W,p++}}g>0&&(r.has("OES_texture_float_linear")===!0?(n.rectAreaLTC1=pt.LTC_FLOAT_1,n.rectAreaLTC2=pt.LTC_FLOAT_2):(n.rectAreaLTC1=pt.LTC_HALF_1,n.rectAreaLTC2=pt.LTC_HALF_2)),n.ambient[0]=h,n.ambient[1]=u,n.ambient[2]=d;const P=n.hash;(P.directionalLength!==f||P.pointLength!==m||P.spotLength!==_||P.rectAreaLength!==g||P.hemiLength!==p||P.numDirectionalShadows!==y||P.numPointShadows!==v||P.numSpotShadows!==x||P.numSpotMaps!==A||P.numLightProbes!==R)&&(n.directional.length=f,n.spot.length=_,n.rectArea.length=g,n.point.length=m,n.hemi.length=p,n.directionalShadow.length=y,n.directionalShadowMap.length=y,n.pointShadow.length=v,n.pointShadowMap.length=v,n.spotShadow.length=x,n.spotShadowMap.length=x,n.directionalShadowMatrix.length=y,n.pointShadowMatrix.length=v,n.spotLightMatrix.length=x+A-T,n.spotLightMap.length=A,n.numSpotLightShadowsWithMaps=T,n.numLightProbes=R,P.directionalLength=f,P.pointLength=m,P.spotLength=_,P.rectAreaLength=g,P.hemiLength=p,P.numDirectionalShadows=y,P.numPointShadows=v,P.numSpotShadows=x,P.numSpotMaps=A,P.numLightProbes=R,n.version=zx++)}function l(c,h){let u=0,d=0,f=0,m=0,_=0;const g=h.matrixWorldInverse;for(let p=0,y=c.length;p<y;p++){const v=c[p];if(v.isDirectionalLight){const x=n.directional[u];x.direction.setFromMatrixPosition(v.matrixWorld),i.setFromMatrixPosition(v.target.matrixWorld),x.direction.sub(i),x.direction.transformDirection(g),u++}else if(v.isSpotLight){const x=n.spot[f];x.position.setFromMatrixPosition(v.matrixWorld),x.position.applyMatrix4(g),x.direction.setFromMatrixPosition(v.matrixWorld),i.setFromMatrixPosition(v.target.matrixWorld),x.direction.sub(i),x.direction.transformDirection(g),f++}else if(v.isRectAreaLight){const x=n.rectArea[m];x.position.setFromMatrixPosition(v.matrixWorld),x.position.applyMatrix4(g),a.identity(),s.copy(v.matrixWorld),s.premultiply(g),a.extractRotation(s),x.halfWidth.set(v.width*.5,0,0),x.halfHeight.set(0,v.height*.5,0),x.halfWidth.applyMatrix4(a),x.halfHeight.applyMatrix4(a),m++}else if(v.isPointLight){const x=n.point[d];x.position.setFromMatrixPosition(v.matrixWorld),x.position.applyMatrix4(g),d++}else if(v.isHemisphereLight){const x=n.hemi[_];x.direction.setFromMatrixPosition(v.matrixWorld),x.direction.transformDirection(g),_++}}}return{setup:o,setupView:l,state:n}}function Uh(r){const t=new Vx(r),e=[],n=[];function i(h){c.camera=h,e.length=0,n.length=0}function s(h){e.push(h)}function a(h){n.push(h)}function o(){t.setup(e)}function l(h){t.setupView(e,h)}const c={lightsArray:e,shadowsArray:n,camera:null,lights:t,transmissionRenderTarget:{}};return{init:i,state:c,setupLights:o,setupLightsView:l,pushLight:s,pushShadow:a}}function Hx(r){let t=new WeakMap;function e(i,s=0){const a=t.get(i);let o;return a===void 0?(o=new Uh(r),t.set(i,[o])):s>=a.length?(o=new Uh(r),a.push(o)):o=a[s],o}function n(){t=new WeakMap}return{get:e,dispose:n}}const Gx=`void main() {
3781	gl_Position = vec4( position, 1.0 );
3782}`,Wx=`uniform sampler2D shadow_pass;
3783uniform vec2 resolution;
3784uniform float radius;
3785#include <packing>
3786void main() {
3787	const float samples = float( VSM_SAMPLES );
3788	float mean = 0.0;
3789	float squared_mean = 0.0;
3790	float uvStride = samples <= 1.0 ? 0.0 : 2.0 / ( samples - 1.0 );
3791	float uvStart = samples <= 1.0 ? 0.0 : - 1.0;
3792	for ( float i = 0.0; i < samples; i ++ ) {
3793		float uvOffset = uvStart + i * uvStride;
3794		#ifdef HORIZONTAL_PASS
3795			vec2 distribution = unpackRGBATo2Half( texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( uvOffset, 0.0 ) * radius ) / resolution ) );
3796			mean += distribution.x;
3797			squared_mean += distribution.y * distribution.y + distribution.x * distribution.x;
3798		#else
3799			float depth = unpackRGBAToDepth( texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( 0.0, uvOffset ) * radius ) / resolution ) );
3800			mean += depth;
3801			squared_mean += depth * depth;
3802		#endif
3803	}
3804	mean = mean / samples;
3805	squared_mean = squared_mean / samples;
3806	float std_dev = sqrt( squared_mean - mean * mean );
3807	gl_FragColor = pack2HalfToRGBA( vec2( mean, std_dev ) );
3808}`;function Xx(r,t,e){let n=new qs;const i=new K,s=new K,a=new ne,o=new fu({depthPacking:_d}),l=new pu,c={},h=e.maxTextureSize,u={[Xn]:Ve,[Ve]:Xn,[An]:An},d=new gn({defines:{VSM_SAMPLES:8},uniforms:{shadow_pass:{value:null},resolution:{value:new K},radius:{value:4}},vertexShader:Gx,fragmentShader:Wx}),f=d.clone();f.defines.HORIZONTAL_PASS=1;const m=new Zt;m.setAttribute("position",new le(new Float32Array([-1,-1,.5,3,-1,.5,-1,3,.5]),3));const _=new ye(m,d),g=this;this.enabled=!1,this.autoUpdate=!0,this.needsUpdate=!1,this.type=Nh;let p=this.type;this.render=function(T,R,P){if(g.enabled===!1||g.autoUpdate===!1&&g.needsUpdate===!1||T.length===0)return;const b=r.getRenderTarget(),S=r.getActiveCubeFace(),I=r.getActiveMipmapLevel(),B=r.state;B.setBlending(Gn),B.buffers.depth.getReversed()?B.buffers.color.setClear(0,0,0,0):B.buffers.color.setClear(1,1,1,1),B.buffers.depth.setTest(!0),B.setScissorTest(!1);const k=p!==Tn&&this.type===Tn,V=p===Tn&&this.type!==Tn;for(let Z=0,W=T.length;Z<W;Z++){const nt=T[Z],G=nt.shadow;if(G===void 0){console.warn("THREE.WebGLShadowMap:",nt,"has no shadow.");continue}if(G.autoUpdate===!1&&G.needsUpdate===!1)continue;i.copy(G.mapSize);const dt=G.getFrameExtents();if(i.multiply(dt),s.copy(G.mapSize),(i.x>h||i.y>h)&&(i.x>h&&(s.x=Math.floor(h/dt.x),i.x=s.x*dt.x,G.mapSize.x=s.x),i.y>h&&(s.y=Math.floor(h/dt.y),i.y=s.y*dt.y,G.mapSize.y=s.y)),G.map===null||k===!0||V===!0){const bt=this.type!==Tn?{minFilter:Re,magFilter:Re}:{};G.map!==null&&G.map.dispose(),G.map=new Ln(i.x,i.y,bt),G.map.texture.name=nt.name+".shadowMap",G.camera.updateProjectionMatrix()}r.setRenderTarget(G.map),r.clear();const _t=G.getViewportCount();for(let bt=0;bt<_t;bt++){const Vt=G.getViewport(bt);a.set(s.x*Vt.x,s.y*Vt.y,s.x*Vt.z,s.y*Vt.w),B.viewport(a),G.updateMatrices(nt,bt),n=G.getFrustum(),x(R,P,G.camera,nt,this.type)}G.isPointLightShadow!==!0&&this.type===Tn&&y(G,P),G.needsUpdate=!1}p=this.type,g.needsUpdate=!1,r.setRenderTarget(b,S,I)};function y(T,R){const P=t.update(_);d.defines.VSM_SAMPLES!==T.blurSamples&&(d.defines.VSM_SAMPLES=T.blurSamples,f.defines.VSM_SAMPLES=T.blurSamples,d.needsUpdate=!0,f.needsUpdate=!0),T.mapPass===null&&(T.mapPass=new Ln(i.x,i.y)),d.uniforms.shadow_pass.value=T.map.texture,d.uniforms.resolution.value=T.mapSize,d.uniforms.radius.value=T.radius,r.setRenderTarget(T.mapPass),r.clear(),r.renderBufferDirect(R,null,P,d,_,null),f.uniforms.shadow_pass.value=T.mapPass.texture,f.uniforms.resolution.value=T.mapSize,f.uniforms.radius.value=T.radius,r.setRenderTarget(T.map),r.clear(),r.renderBufferDirect(R,null,P,f,_,null)}function v(T,R,P,b){let S=null;const I=P.isPointLight===!0?T.customDistanceMaterial:T.customDepthMaterial;if(I!==void 0)S=I;else if(S=P.isPointLight===!0?l:o,r.localClippingEnabled&&R.clipShadows===!0&&Array.isArray(R.clippingPlanes)&&R.clippingPlanes.length!==0||R.displacementMap&&R.displacementScale!==0||R.alphaMap&&R.alphaTest>0||R.map&&R.alphaTest>0||R.alphaToCoverage===!0){const B=S.uuid,k=R.uuid;let V=c[B];V===void 0&&(V={},c[B]=V);let Z=V[k];Z===void 0&&(Z=S.clone(),V[k]=Z,R.addEventListener("dispose",A)),S=Z}if(S.visible=R.visible,S.wireframe=R.wireframe,b===Tn?S.side=R.shadowSide!==null?R.shadowSide:R.side:S.side=R.shadowSide!==null?R.shadowSide:u[R.side],S.alphaMap=R.alphaMap,S.alphaTest=R.alph
vendor: 7,141 bytes, line 3808
3808aToCoverage===!0?.5:R.alphaTest,S.map=R.map,S.clipShadows=R.clipShadows,S.clippingPlanes=R.clippingPlanes,S.clipIntersection=R.clipIntersection,S.displacementMap=R.displacementMap,S.displacementScale=R.displacementScale,S.displacementBias=R.displacementBias,S.wireframeLinewidth=R.wireframeLinewidth,S.linewidth=R.linewidth,P.isPointLight===!0&&S.isMeshDistanceMaterial===!0){const B=r.properties.get(S);B.light=P}return S}function x(T,R,P,b,S){if(T.visible===!1)return;if(T.layers.test(R.layers)&&(T.isMesh||T.isLine||T.isPoints)&&(T.castShadow||T.receiveShadow&&S===Tn)&&(!T.frustumCulled||n.intersectsObject(T))){T.modelViewMatrix.multiplyMatrices(P.matrixWorldInverse,T.matrixWorld);const k=t.update(T),V=T.material;if(Array.isArray(V)){const Z=k.groups;for(let W=0,nt=Z.length;W<nt;W++){const G=Z[W],dt=V[G.materialIndex];if(dt&&dt.visible){const _t=v(T,dt,b,S);T.onBeforeShadow(r,T,R,P,k,_t,G),r.renderBufferDirect(P,null,k,_t,T,G),T.onAfterShadow(r,T,R,P,k,_t,G)}}}else if(V.visible){const Z=v(T,V,b,S);T.onBeforeShadow(r,T,R,P,k,Z,null),r.renderBufferDirect(P,null,k,Z,T,null),T.onAfterShadow(r,T,R,P,k,Z,null)}}const B=T.children;for(let k=0,V=B.length;k<V;k++)x(B[k],R,P,b,S)}function A(T){T.target.removeEventListener("dispose",A);for(const P in c){const b=c[P],S=T.target.uuid;S in b&&(b[S].dispose(),delete b[S])}}}const qx={[go]:_o,[xo]:Mo,[vo]:So,[ns]:yo,[_o]:go,[Mo]:xo,[So]:vo,[yo]:ns};function Yx(r,t){function e(){let D=!1;const at=new ne;let ut=null;const Mt=new ne(0,0,0,0);return{setMask:function(st){ut!==st&&!D&&(r.colorMask(st,st,st,st),ut=st)},setLocked:function(st){D=st},setClear:function(st,$,wt,Wt,ce){ce===!0&&(st*=Wt,$*=Wt,wt*=Wt),at.set(st,$,wt,Wt),Mt.equals(at)===!1&&(r.clearColor(st,$,wt,Wt),Mt.copy(at))},reset:function(){D=!1,ut=null,Mt.set(-1,0,0,0)}}}function n(){let D=!1,at=!1,ut=null,Mt=null,st=null;return{setReversed:function($){if(at!==$){const wt=t.get("EXT_clip_control");$?wt.clipControlEXT(wt.LOWER_LEFT_EXT,wt.ZERO_TO_ONE_EXT):wt.clipControlEXT(wt.LOWER_LEFT_EXT,wt.NEGATIVE_ONE_TO_ONE_EXT),at=$;const Wt=st;st=null,this.setClear(Wt)}},getReversed:function(){return at},setTest:function($){$?lt(r.DEPTH_TEST):Lt(r.DEPTH_TEST)},setMask:function($){ut!==$&&!D&&(r.depthMask($),ut=$)},setFunc:function($){if(at&&($=qx[$]),Mt!==$){switch($){case go:r.depthFunc(r.NEVER);break;case _o:r.depthFunc(r.ALWAYS);break;case xo:r.depthFunc(r.LESS);break;case ns:r.depthFunc(r.LEQUAL);break;case vo:r.depthFunc(r.EQUAL);break;case yo:r.depthFunc(r.GEQUAL);break;case Mo:r.depthFunc(r.GREATER);break;case So:r.depthFunc(r.NOTEQUAL);break;default:r.depthFunc(r.LEQUAL)}Mt=$}},setLocked:function($){D=$},setClear:function($){st!==$&&(at&&($=1-$),r.clearDepth($),st=$)},reset:function(){D=!1,ut=null,Mt=null,st=null,at=!1}}}function i(){let D=!1,at=null,ut=null,Mt=null,st=null,$=null,wt=null,Wt=null,ce=null;return{setTest:function(se){D||(se?lt(r.STENCIL_TEST):Lt(r.STENCIL_TEST))},setMask:function(se){at!==se&&!D&&(r.stencilMask(se),at=se)},setFunc:function(se,xn,hn){(ut!==se||Mt!==xn||st!==hn)&&(r.stencilFunc(se,xn,hn),ut=se,Mt=xn,st=hn)},setOp:function(se,xn,hn){($!==se||wt!==xn||Wt!==hn)&&(r.stencilOp(se,xn,hn),$=se,wt=xn,Wt=hn)},setLocked:function(se){D=se},setClear:function(se){ce!==se&&(r.clearStencil(se),ce=se)},reset:function(){D=!1,at=null,ut=null,Mt=null,st=null,$=null,wt=null,Wt=null,ce=null}}}const s=new e,a=new n,o=new i,l=new WeakMap,c=new WeakMap;let h={},u={},d=new WeakMap,f=[],m=null,_=!1,g=null,p=null,y=null,v=null,x=null,A=null,T=null,R=new vt(0,0,0),P=0,b=!1,S=null,I=null,B=null,k=null,V=null;const Z=r.getParameter(r.MAX_COMBINED_TEXTURE_IMAGE_UNITS);let W=!1,nt=0;const G=r.getParameter(r.VERSION);G.indexOf("WebGL")!==-1?(nt=parseFloat(/^WebGL (\d)/.exec(G)[1]),W=nt>=1):G.indexOf("OpenGL ES")!==-1&&(nt=parseFloat(/^OpenGL ES (\d)/.exec(G)[1]),W=nt>=2);let dt=null,_t={};const bt=r.getParameter(r.SCISSOR_BOX),Vt=r.getParameter(r.VIEWPORT),Qt=new ne().fromArray(bt),jt=new ne().fromArray(Vt);function q(D,at,ut,Mt){const st=new Uint8Array(4),$=r.createTexture();r.bindTexture(D,$),r.texParameteri(D,r.TEXTURE_MIN_FILTER,r.NEAREST),r.texParameteri(D,r.TEXTURE_MAG_FILTER,r.NEAREST);for(let wt=0;wt<ut;wt++)D===r.TEXTURE_3D||D===r.TEXTURE_2D_ARRAY?r.texImage3D(at,0,r.RGBA,1,1,Mt,0,r.RGBA,r.UNSIGNED_BYTE,st):r.texImage2D(at+wt,0,r.RGBA,1,1,0,r.RGBA,r.UNSIGNED_BYTE,st);return $}const ft={};ft[r.TEXTURE_2D]=q(r.TEXTURE_2D,r.TEXTURE_2D,1),ft[r.TEXTURE_CUBE_MAP]=q(r.TEXTURE_CUBE_MAP,r.TEXTURE_CUBE_MAP_POSITIVE_X,6),ft[r.TEXTURE_2D_ARRAY]=q(r.TEXTURE_2D_ARRAY,r.TEXTURE_2D_ARRAY,1,1),ft[r.TEXTURE_3D]=q(r.TEXTURE_3D,r.TEXTURE_3D,1,1),s.setClear(0,0,0,1),a.setClear(1),o.setClear(0),lt(r.DEPTH_TEST),a.setFunc(ns),tt(!1),J($l),lt(r.CULL_FACE),Q(Gn);function lt(D){h[D]!==!0&&(r.enable(D),h[D]=!0)}function Lt(D){h[D]!==!1&&(r.disable(D),h[D]=!1)}function Ct(D,at){return u[D]!==at?(r.bindFramebuffer(D,at),u[D]=at,D===r.DRAW_FRAMEBUFFER&&(u[r.FRAMEBUFFER]=at),D===r.FRAMEBUFFER&&(u[r.DRAW_FRAMEBUFFER]=at),!0):!1}function Ft(D,at){let ut=f,Mt=!1;if(D){ut=d.get(at),ut===void 0&&(ut=[],d.set(at,ut));const st=D.textures;if(ut.length!==st.length||ut[0]!==r.COLOR_ATTACHMENT0){for(let $=0,wt=st.length;$<wt;$++)ut[$]=r.COLOR_ATTACHMENT0+$;ut.length=st.length,Mt=!0}}else ut[0]!==r.BACK&&(ut[0]=r.BACK,Mt=!0);Mt&&r.drawBuffers(ut)}function ue(D){return m!==D?(r.useProgram(D),m=D,!0):!1}const Ht={[fi]:r.FUNC_ADD,[ku]:r.FUNC_SUBTRACT,[Vu]:r.FUNC_REVERSE_SUBTRACT};Ht[Hu]=r.MIN,Ht[Gu]=r.MAX;const L={[Wu]:r.ZERO,[Xu]:r.ONE,[qu]:r.SRC_COLOR,[po]:r.SRC_ALPHA,[Qu]:r.SRC_ALPHA_SATURATE,[$u]:r.DST_COLOR,[Zu]:r.DST_ALPHA,[Yu]:r.ONE_MINUS_SRC_COLOR,[mo]:r.ONE_MINUS_SRC_ALPHA,[Ku]:r.ONE_MINUS_DST_COLOR,[Ju]:r.ONE_MINUS_DST_ALPHA,[ju]:r.CONSTANT_COLOR,[td]:r.ONE_MINUS_CONSTANT_COLOR,[ed]:r.CONSTANT_ALPHA,[nd]:r.ONE_MINUS_CONSTANT_ALPHA};function Q(D,at,ut,Mt,st,$,wt,Wt,ce,se){if(D===Gn){_===!0&&(Lt(r.BLEND),_=!1);return}if(_===!1&&(lt(r.BLEND),_=!0),D!==zu){if(D!==g||se!==b){if((p!==fi||x!==fi)&&(r.blendEquation(r.FUNC_ADD),p=fi,x=fi),se)switch(D){case Qi:r.blendFuncSeparate(r.ONE,r.ONE_MINUS_SRC_ALPHA,r.ONE,r.ONE_MINUS_SRC_ALPHA);break;case Kl:r.blendFunc(r.ONE,r.ONE);break;case Ql:r.blendFuncSeparate(r.ZERO,r.ONE_MINUS_SRC_COLOR,r.ZERO,r.ONE);break;case jl:r.blendFuncSeparate(r.DST_COLOR,r.ONE_MINUS_SRC_ALPHA,r.ZERO,r.ONE);break;default:console.error("THREE.WebGLState: Invalid blending: ",D);break}else switch(D){case Qi:r.blendFuncSeparate(r.SRC_ALPHA,r.ONE_MINUS_SRC_ALPHA,r.ONE,r.ONE_MINUS_SRC_ALPHA);break;case Kl:r.blendFuncSeparate(r.SRC_ALPHA,r.ONE,r.ONE,r.ONE);break;case Ql:console.error("THREE.WebGLState: SubtractiveBlending requires material.premultipliedAlpha = true");break;case jl:console.error("THREE.WebGLState: MultiplyBlending requires material.premultipliedAlpha = true");break;default:console.error("THREE.WebGLState: Invalid blending: ",D);break}y=null,v=null,A=null,T=null,R.set(0,0,0),P=0,g=D,b=se}return}st=st||at,$=$||ut,wt=wt||Mt,(at!==p||st!==x)&&(r.blendEquationSeparate(Ht[at],Ht[st]),p=at,x=st),(ut!==y||Mt!==v||$!==A||wt!==T)&&(r.blendFuncSeparate(L[ut],L[Mt],L[$],L[wt]),y=ut,v=Mt,A=$,T=wt),(Wt.equals(R)===!1||ce!==P)&&(r.blendColor
vendor: 4,497 bytes, line 3808
3808(Wt.r,Wt.g,Wt.b,ce),R.copy(Wt),P=ce),g=D,b=!1}function Y(D,at){D.side===An?Lt(r.CULL_FACE):lt(r.CULL_FACE);let ut=D.side===Ve;at&&(ut=!ut),tt(ut),D.blending===Qi&&D.transparent===!1?Q(Gn):Q(D.blending,D.blendEquation,D.blendSrc,D.blendDst,D.blendEquationAlpha,D.blendSrcAlpha,D.blendDstAlpha,D.blendColor,D.blendAlpha,D.premultipliedAlpha),a.setFunc(D.depthFunc),a.setTest(D.depthTest),a.setMask(D.depthWrite),s.setMask(D.colorWrite);const Mt=D.stencilWrite;o.setTest(Mt),Mt&&(o.setMask(D.stencilWriteMask),o.setFunc(D.stencilFunc,D.stencilRef,D.stencilFuncMask),o.setOp(D.stencilFail,D.stencilZFail,D.stencilZPass)),et(D.polygonOffset,D.polygonOffsetFactor,D.polygonOffsetUnits),D.alphaToCoverage===!0?lt(r.SAMPLE_ALPHA_TO_COVERAGE):Lt(r.SAMPLE_ALPHA_TO_COVERAGE)}function tt(D){S!==D&&(D?r.frontFace(r.CW):r.frontFace(r.CCW),S=D)}function J(D){D!==Fu?(lt(r.CULL_FACE),D!==I&&(D===$l?r.cullFace(r.BACK):D===Ou?r.cullFace(r.FRONT):r.cullFace(r.FRONT_AND_BACK))):Lt(r.CULL_FACE),I=D}function ct(D){D!==B&&(W&&r.lineWidth(D),B=D)}function et(D,at,ut){D?(lt(r.POLYGON_OFFSET_FILL),(k!==at||V!==ut)&&(r.polygonOffset(at,ut),k=at,V=ut)):Lt(r.POLYGON_OFFSET_FILL)}function ht(D){D?lt(r.SCISSOR_TEST):Lt(r.SCISSOR_TEST)}function Gt(D){D===void 0&&(D=r.TEXTURE0+Z-1),dt!==D&&(r.activeTexture(D),dt=D)}function kt(D,at,ut){ut===void 0&&(dt===null?ut=r.TEXTURE0+Z-1:ut=dt);let Mt=_t[ut];Mt===void 0&&(Mt={type:void 0,texture:void 0},_t[ut]=Mt),(Mt.type!==D||Mt.texture!==at)&&(dt!==ut&&(r.activeTexture(ut),dt=ut),r.bindTexture(D,at||ft[D]),Mt.type=D,Mt.texture=at)}function w(){const D=_t[dt];D!==void 0&&D.type!==void 0&&(r.bindTexture(D.type,null),D.type=void 0,D.texture=void 0)}function M(){try{r.compressedTexImage2D(...arguments)}catch(D){console.error("THREE.WebGLState:",D)}}function F(){try{r.compressedTexImage3D(...arguments)}catch(D){console.error("THREE.WebGLState:",D)}}function H(){try{r.texSubImage2D(...arguments)}catch(D){console.error("THREE.WebGLState:",D)}}function j(){try{r.texSubImage3D(...arguments)}catch(D){console.error("THREE.WebGLState:",D)}}function X(){try{r.compressedTexSubImage2D(...arguments)}catch(D){console.error("THREE.WebGLState:",D)}}function Rt(){try{r.compressedTexSubImage3D(...arguments)}catch(D){console.error("THREE.WebGLState:",D)}}function ot(){try{r.texStorage2D(...arguments)}catch(D){console.error("THREE.WebGLState:",D)}}function Tt(){try{r.texStorage3D(...arguments)}catch(D){console.error("THREE.WebGLState:",D)}}function At(){try{r.texImage2D(...arguments)}catch(D){console.error("THREE.WebGLState:",D)}}function it(){try{r.texImage3D(...arguments)}catch(D){console.error("THREE.WebGLState:",D)}}function xt(D){Qt.equals(D)===!1&&(r.scissor(D.x,D.y,D.z,D.w),Qt.copy(D))}function Ot(D){jt.equals(D)===!1&&(r.viewport(D.x,D.y,D.z,D.w),jt.copy(D))}function It(D,at){let ut=c.get(at);ut===void 0&&(ut=new WeakMap,c.set(at,ut));let Mt=ut.get(D);Mt===void 0&&(Mt=r.getUniformBlockIndex(at,D.name),ut.set(D,Mt))}function mt(D,at){const Mt=c.get(at).get(D);l.get(at)!==Mt&&(r.uniformBlockBinding(at,Mt,D.__bindingPointIndex),l.set(at,Mt))}function Yt(){r.disable(r.BLEND),r.disable(r.CULL_FACE),r.disable(r.DEPTH_TEST),r.disable(r.POLYGON_OFFSET_FILL),r.disable(r.SCISSOR_TEST),r.disable(r.STENCIL_TEST),r.disable(r.SAMPLE_ALPHA_TO_COVERAGE),r.blendEquation(r.FUNC_ADD),r.blendFunc(r.ONE,r.ZERO),r.blendFuncSeparate(r.ONE,r.ZERO,r.ONE,r.ZERO),r.blendColor(0,0,0,0),r.colorMask(!0,!0,!0,!0),r.clearColor(0,0,0,0),r.depthMask(!0),r.depthFunc(r.LESS),a.setReversed(!1),r.clearDepth(1),r.stencilMask(4294967295),r.stencilFunc(r.ALWAYS,0,4294967295),r.stencilOp(r.KEEP,r.KEEP,r.KEEP),r.clearStencil(0),r.cullFace(r.BACK),r.frontFace(r.CCW),r.polygonOffset(0,0),r.activeTexture(r.TEXTURE0),r.bindFramebuffer(r.FRAMEBUFFER,null),r.bindFramebuffer(r.DRAW_FRAMEBUFFER,null),r.bindFramebuffer(r.READ_FRAMEBUFFER,null),r.useProgram(null),r.lineWidth(1),r.scissor(0,0,r.canvas.width,r.canvas.height),r.viewport(0,0,r.canvas.width,r.canvas.height),h={},dt=null,_t={},u={},d=new WeakMap,f=[],m=null,_=!1,g=null,p=null,y=null,v=null,x=null,A=null,T=null,R=new vt(0,0,0),P=0,b=!1,S=null,I=null,B=null,k=null,V=null,Qt.set(0,0,r.canvas.width,r.canvas.height),jt.set(0,0,r.canvas.width,r.canvas.height),s.reset(),a.reset(),o.reset()}return{buffers:{color:s,depth:a,stencil:o},enable:lt,disable:Lt,bindFramebuffer:Ct,drawBuffers:Ft,useProgram:ue,setBlending:Q,setMaterial:Y,setFlipSided:tt,setCullFace:J,setLineWidth:ct,setPolygonOffset:et,setScissorTest:ht,activeTexture:Gt,b
vendor: 4,542 bytes, line 3808
3808indTexture:kt,unbindTexture:w,compressedTexImage2D:M,compressedTexImage3D:F,texImage2D:At,texImage3D:it,updateUBOMapping:It,uniformBlockBinding:mt,texStorage2D:ot,texStorage3D:Tt,texSubImage2D:H,texSubImage3D:j,compressedTexSubImage2D:X,compressedTexSubImage3D:Rt,scissor:xt,viewport:Ot,reset:Yt}}function Zx(r,t,e,n,i,s,a){const o=t.has("WEBGL_multisampled_render_to_texture")?t.get("WEBGL_multisampled_render_to_texture"):null,l=typeof navigator>"u"?!1:/OculusBrowser/g.test(navigator.userAgent),c=new K,h=new WeakMap;let u;const d=new WeakMap;let f=!1;try{f=typeof OffscreenCanvas<"u"&&new OffscreenCanvas(1,1).getContext("2d")!==null}catch{}function m(w,M){return f?new OffscreenCanvas(w,M):Bs("canvas")}function _(w,M,F){let H=1;const j=kt(w);if((j.width>F||j.height>F)&&(H=F/Math.max(j.width,j.height)),H<1)if(typeof HTMLImageElement<"u"&&w instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&w instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&w instanceof ImageBitmap||typeof VideoFrame<"u"&&w instanceof VideoFrame){const X=Math.floor(H*j.width),Rt=Math.floor(H*j.height);u===void 0&&(u=m(X,Rt));const ot=M?m(X,Rt):u;return ot.width=X,ot.height=Rt,ot.getContext("2d").drawImage(w,0,0,X,Rt),console.warn("THREE.WebGLRenderer: Texture has been resized from ("+j.width+"x"+j.height+") to ("+X+"x"+Rt+")."),ot}else return"data"in w&&console.warn("THREE.WebGLRenderer: Image in DataTexture is too big ("+j.width+"x"+j.height+")."),w;return w}function g(w){return w.generateMipmaps}function p(w){r.generateMipmap(w)}function y(w){return w.isWebGLCubeRenderTarget?r.TEXTURE_CUBE_MAP:w.isWebGL3DRenderTarget?r.TEXTURE_3D:w.isWebGLArrayRenderTarget||w.isCompressedArrayTexture?r.TEXTURE_2D_ARRAY:r.TEXTURE_2D}function v(w,M,F,H,j=!1){if(w!==null){if(r[w]!==void 0)return r[w];console.warn("THREE.WebGLRenderer: Attempt to use non-existing WebGL internal format '"+w+"'")}let X=M;if(M===r.RED&&(F===r.FLOAT&&(X=r.R32F),F===r.HALF_FLOAT&&(X=r.R16F),F===r.UNSIGNED_BYTE&&(X=r.R8)),M===r.RED_INTEGER&&(F===r.UNSIGNED_BYTE&&(X=r.R8UI),F===r.UNSIGNED_SHORT&&(X=r.R16UI),F===r.UNSIGNED_INT&&(X=r.R32UI),F===r.BYTE&&(X=r.R8I),F===r.SHORT&&(X=r.R16I),F===r.INT&&(X=r.R32I)),M===r.RG&&(F===r.FLOAT&&(X=r.RG32F),F===r.HALF_FLOAT&&(X=r.RG16F),F===r.UNSIGNED_BYTE&&(X=r.RG8)),M===r.RG_INTEGER&&(F===r.UNSIGNED_BYTE&&(X=r.RG8UI),F===r.UNSIGNED_SHORT&&(X=r.RG16UI),F===r.UNSIGNED_INT&&(X=r.RG32UI),F===r.BYTE&&(X=r.RG8I),F===r.SHORT&&(X=r.RG16I),F===r.INT&&(X=r.RG32I)),M===r.RGB_INTEGER&&(F===r.UNSIGNED_BYTE&&(X=r.RGB8UI),F===r.UNSIGNED_SHORT&&(X=r.RGB16UI),F===r.UNSIGNED_INT&&(X=r.RGB32UI),F===r.BYTE&&(X=r.RGB8I),F===r.SHORT&&(X=r.RGB16I),F===r.INT&&(X=r.RGB32I)),M===r.RGBA_INTEGER&&(F===r.UNSIGNED_BYTE&&(X=r.RGBA8UI),F===r.UNSIGNED_SHORT&&(X=r.RGBA16UI),F===r.UNSIGNED_INT&&(X=r.RGBA32UI),F===r.BYTE&&(X=r.RGBA8I),F===r.SHORT&&(X=r.RGBA16I),F===r.INT&&(X=r.RGBA32I)),M===r.RGB&&F===r.UNSIGNED_INT_5_9_9_9_REV&&(X=r.RGB9_E5),M===r.RGBA){const Rt=j?ta:Kt.getTransfer(H);F===r.FLOAT&&(X=r.RGBA32F),F===r.HALF_FLOAT&&(X=r.RGBA16F),F===r.UNSIGNED_BYTE&&(X=Rt===ae?r.SRGB8_ALPHA8:r.RGBA8),F===r.UNSIGNED_SHORT_4_4_4_4&&(X=r.RGBA4),F===r.UNSIGNED_SHORT_5_5_5_1&&(X=r.RGB5_A1)}return(X===r.R16F||X===r.R32F||X===r.RG16F||X===r.RG32F||X===r.RGBA16F||X===r.RGBA32F)&&t.get("EXT_color_buffer_float"),X}function x(w,M){let F;return w?M===null||M===Yn||M===Us?F=r.DEPTH24_STENCIL8:M===Je?F=r.DEPTH32F_STENCIL8:M===Ds&&(F=r.DEPTH24_STENCIL8,console.warn("DepthTexture: 16 bit depth attachment is not supported with stencil. Using 24-bit attachment.")):M===null||M===Yn||M===Us?F=r.DEPTH_COMPONENT24:M===Je?F=r.DEPTH_COMPONENT32F:M===Ds&&(F=r.DEPTH_COMPONENT16),F}function A(w,M){return g(w)===!0||w.isFramebufferTexture&&w.minFilter!==Re&&w.minFilter!==Ee?Math.log2(Math.max(M.width,M.height))+1:w.mipmaps!==void 0&&w.mipmaps.length>0?w.mipmaps.length:w.isCompressedTexture&&Array.isArray(w.image)?M.mipmaps.length:1}function T(w){const M=w.target;M.removeEventListener("dispose",T),P(M),M.isVideoTexture&&h.delete(M)}function R(w){const M=w.target;M.removeEventListener("dispose",R),S(M)}function P(w){const M=n.get(w);if(M.__webglInit===void 0)return;const F=w.source,H=d.get(F);if(H){const j=H[M.__cacheKey];j.usedTimes--,j.usedTimes===0&&b(w),Object.keys(H).length===0&&d.delete(F)}n.remove(w)}function b(w){const M=n.get(w);r.deleteTexture(M.__webglTexture);const F=w.source,H=d.get(F);delete H[M.__cacheKey],a.memory.textures--}function S(w){const M=n.get(w);if(w.depthTexture&&(w.depthTexture.dispose(),n.remove(w.depthTexture)),w.isWebGLCubeRen
vendor: 4,326 bytes, line 3808
3808derTarget)for(let H=0;H<6;H++){if(Array.isArray(M.__webglFramebuffer[H]))for(let j=0;j<M.__webglFramebuffer[H].length;j++)r.deleteFramebuffer(M.__webglFramebuffer[H][j]);else r.deleteFramebuffer(M.__webglFramebuffer[H]);M.__webglDepthbuffer&&r.deleteRenderbuffer(M.__webglDepthbuffer[H])}else{if(Array.isArray(M.__webglFramebuffer))for(let H=0;H<M.__webglFramebuffer.length;H++)r.deleteFramebuffer(M.__webglFramebuffer[H]);else r.deleteFramebuffer(M.__webglFramebuffer);if(M.__webglDepthbuffer&&r.deleteRenderbuffer(M.__webglDepthbuffer),M.__webglMultisampledFramebuffer&&r.deleteFramebuffer(M.__webglMultisampledFramebuffer),M.__webglColorRenderbuffer)for(let H=0;H<M.__webglColorRenderbuffer.length;H++)M.__webglColorRenderbuffer[H]&&r.deleteRenderbuffer(M.__webglColorRenderbuffer[H]);M.__webglDepthRenderbuffer&&r.deleteRenderbuffer(M.__webglDepthRenderbuffer)}const F=w.textures;for(let H=0,j=F.length;H<j;H++){const X=n.get(F[H]);X.__webglTexture&&(r.deleteTexture(X.__webglTexture),a.memory.textures--),n.remove(F[H])}n.remove(w)}let I=0;function B(){I=0}function k(){const w=I;return w>=i.maxTextures&&console.warn("THREE.WebGLTextures: Trying to use "+w+" texture units while this GPU supports only "+i.maxTextures),I+=1,w}function V(w){const M=[];return M.push(w.wrapS),M.push(w.wrapT),M.push(w.wrapR||0),M.push(w.magFilter),M.push(w.minFilter),M.push(w.anisotropy),M.push(w.internalFormat),M.push(w.format),M.push(w.type),M.push(w.generateMipmaps),M.push(w.premultiplyAlpha),M.push(w.flipY),M.push(w.unpackAlignment),M.push(w.colorSpace),M.join()}function Z(w,M){const F=n.get(w);if(w.isVideoTexture&&ht(w),w.isRenderTargetTexture===!1&&w.isExternalTexture!==!0&&w.version>0&&F.__version!==w.version){const H=w.image;if(H===null)console.warn("THREE.WebGLRenderer: Texture marked for update but no image data found.");else if(H.complete===!1)console.warn("THREE.WebGLRenderer: Texture marked for update but image is incomplete");else{ft(F,w,M);return}}else w.isExternalTexture&&(F.__webglTexture=w.sourceTexture?w.sourceTexture:null);e.bindTexture(r.TEXTURE_2D,F.__webglTexture,r.TEXTURE0+M)}function W(w,M){const F=n.get(w);if(w.isRenderTargetTexture===!1&&w.version>0&&F.__version!==w.version){ft(F,w,M);return}e.bindTexture(r.TEXTURE_2D_ARRAY,F.__webglTexture,r.TEXTURE0+M)}function nt(w,M){const F=n.get(w);if(w.isRenderTargetTexture===!1&&w.version>0&&F.__version!==w.version){ft(F,w,M);return}e.bindTexture(r.TEXTURE_3D,F.__webglTexture,r.TEXTURE0+M)}function G(w,M){const F=n.get(w);if(w.version>0&&F.__version!==w.version){lt(F,w,M);return}e.bindTexture(r.TEXTURE_CUBE_MAP,F.__webglTexture,r.TEXTURE0+M)}const dt={[$r]:r.REPEAT,[ln]:r.CLAMP_TO_EDGE,[Kr]:r.MIRRORED_REPEAT},_t={[Re]:r.NEAREST,[Fh]:r.NEAREST_MIPMAP_NEAREST,[Ts]:r.NEAREST_MIPMAP_LINEAR,[Ee]:r.LINEAR,[Vr]:r.LINEAR_MIPMAP_NEAREST,[Cn]:r.LINEAR_MIPMAP_LINEAR},bt={[vd]:r.NEVER,[Td]:r.ALWAYS,[yd]:r.LESS,[Xh]:r.LEQUAL,[Md]:r.EQUAL,[Ed]:r.GEQUAL,[Sd]:r.GREATER,[bd]:r.NOTEQUAL};function Vt(w,M){if(M.type===Je&&t.has("OES_texture_float_linear")===!1&&(M.magFilter===Ee||M.magFilter===Vr||M.magFilter===Ts||M.magFilter===Cn||M.minFilter===Ee||M.minFilter===Vr||M.minFilter===Ts||M.minFilter===Cn)&&console.warn("THREE.WebGLRenderer: Unable to use linear filtering with floating point textures. OES_texture_float_linear not supported on this device."),r.texParameteri(w,r.TEXTURE_WRAP_S,dt[M.wrapS]),r.texParameteri(w,r.TEXTURE_WRAP_T,dt[M.wrapT]),(w===r.TEXTURE_3D||w===r.TEXTURE_2D_ARRAY)&&r.texParameteri(w,r.TEXTURE_WRAP_R,dt[M.wrapR]),r.texParameteri(w,r.TEXTURE_MAG_FILTER,_t[M.magFilter]),r.texParameteri(w,r.TEXTURE_MIN_FILTER,_t[M.minFilter]),M.compareFunction&&(r.texParameteri(w,r.TEXTURE_COMPARE_MODE,r.COMPARE_REF_TO_TEXTURE),r.texParameteri(w,r.TEXTURE_COMPARE_FUNC,bt[M.compareFunction])),t.has("EXT_texture_filter_anisotropic")===!0){if(M.magFilter===Re||M.minFilter!==Ts&&M.minFilter!==Cn||M.type===Je&&t.has("OES_texture_float_linear")===!1)return;if(M.anisotropy>1||n.get(M).__currentAnisotropy){const F=t.get("EXT_texture_filter_anisotropic");r.texParameterf(w,F.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(M.anisotropy,i.getMaxAnisotropy())),n.get(M).__currentAnisotropy=M.anisotropy}}}function Qt(w,M){let F=!1;w.__webglInit===void 0&&(w.__webglInit=!0,M.addEventListener("dispose",T));const H=M.source;let j=d.get(H);j===void 0&&(j={}
vendor: 3,737 bytes, line 3808
3808,d.set(H,j));const X=V(M);if(X!==w.__cacheKey){j[X]===void 0&&(j[X]={texture:r.createTexture(),usedTimes:0},a.memory.textures++,F=!0),j[X].usedTimes++;const Rt=j[w.__cacheKey];Rt!==void 0&&(j[w.__cacheKey].usedTimes--,Rt.usedTimes===0&&b(M)),w.__cacheKey=X,w.__webglTexture=j[X].texture}return F}function jt(w,M,F){return Math.floor(Math.floor(w/F)/M)}function q(w,M,F,H){const X=w.updateRanges;if(X.length===0)e.texSubImage2D(r.TEXTURE_2D,0,0,0,M.width,M.height,F,H,M.data);else{X.sort((it,xt)=>it.start-xt.start);let Rt=0;for(let it=1;it<X.length;it++){const xt=X[Rt],Ot=X[it],It=xt.start+xt.count,mt=jt(Ot.start,M.width,4),Yt=jt(xt.start,M.width,4);Ot.start<=It+1&&mt===Yt&&jt(Ot.start+Ot.count-1,M.width,4)===mt?xt.count=Math.max(xt.count,Ot.start+Ot.count-xt.start):(++Rt,X[Rt]=Ot)}X.length=Rt+1;const ot=r.getParameter(r.UNPACK_ROW_LENGTH),Tt=r.getParameter(r.UNPACK_SKIP_PIXELS),At=r.getParameter(r.UNPACK_SKIP_ROWS);r.pixelStorei(r.UNPACK_ROW_LENGTH,M.width);for(let it=0,xt=X.length;it<xt;it++){const Ot=X[it],It=Math.floor(Ot.start/4),mt=Math.ceil(Ot.count/4),Yt=It%M.width,D=Math.floor(It/M.width),at=mt,ut=1;r.pixelStorei(r.UNPACK_SKIP_PIXELS,Yt),r.pixelStorei(r.UNPACK_SKIP_ROWS,D),e.texSubImage2D(r.TEXTURE_2D,0,Yt,D,at,ut,F,H,M.data)}w.clearUpdateRanges(),r.pixelStorei(r.UNPACK_ROW_LENGTH,ot),r.pixelStorei(r.UNPACK_SKIP_PIXELS,Tt),r.pixelStorei(r.UNPACK_SKIP_ROWS,At)}}function ft(w,M,F){let H=r.TEXTURE_2D;(M.isDataArrayTexture||M.isCompressedArrayTexture)&&(H=r.TEXTURE_2D_ARRAY),M.isData3DTexture&&(H=r.TEXTURE_3D);const j=Qt(w,M),X=M.source;e.bindTexture(H,w.__webglTexture,r.TEXTURE0+F);const Rt=n.get(X);if(X.version!==Rt.__version||j===!0){e.activeTexture(r.TEXTURE0+F);const ot=Kt.getPrimaries(Kt.workingColorSpace),Tt=M.colorSpace===Hn?null:Kt.getPrimaries(M.colorSpace),At=M.colorSpace===Hn||ot===Tt?r.NONE:r.BROWSER_DEFAULT_WEBGL;r.pixelStorei(r.UNPACK_FLIP_Y_WEBGL,M.flipY),r.pixelStorei(r.UNPACK_PREMULTIPLY_ALPHA_WEBGL,M.premultiplyAlpha),r.pixelStorei(r.UNPACK_ALIGNMENT,M.unpackAlignment),r.pixelStorei(r.UNPACK_COLORSPACE_CONVERSION_WEBGL,At);let it=_(M.image,!1,i.maxTextureSize);it=Gt(M,it);const xt=s.convert(M.format,M.colorSpace),Ot=s.convert(M.type);let It=v(M.internalFormat,xt,Ot,M.colorSpace,M.isVideoTexture);Vt(H,M);let mt;const Yt=M.mipmaps,D=M.isVideoTexture!==!0,at=Rt.__version===void 0||j===!0,ut=X.dataReady,Mt=A(M,it);if(M.isDepthTexture)It=x(M.format===Fs,M.type),at&&(D?e.texStorage2D(r.TEXTURE_2D,1,It,it.width,it.height):e.texImage2D(r.TEXTURE_2D,0,It,it.width,it.height,0,xt,Ot,null));else if(M.isDataTexture)if(Yt.length>0){D&&at&&e.texStorage2D(r.TEXTURE_2D,Mt,It,Yt[0].width,Yt[0].height);for(let st=0,$=Yt.length;st<$;st++)mt=Yt[st],D?ut&&e.texSubImage2D(r.TEXTURE_2D,st,0,0,mt.width,mt.height,xt,Ot,mt.data):e.texImage2D(r.TEXTURE_2D,st,It,mt.width,mt.height,0,xt,Ot,mt.data);M.generateMipmaps=!1}else D?(at&&e.texStorage2D(r.TEXTURE_2D,Mt,It,it.width,it.height),ut&&q(M,it,xt,Ot)):e.texImage2D(r.TEXTURE_2D,0,It,it.width,it.height,0,xt,Ot,it.data);else if(M.isCompressedTexture)if(M.isCompressedArrayTexture){D&&at&&e.texStorage3D(r.TEXTURE_2D_ARRAY,Mt,It,Yt[0].width,Yt[0].height,it.depth);for(let st=0,$=Yt.length;st<$;st++)if(mt=Yt[st],M.format!==ke)if(xt!==null)if(D){if(ut)if(M.layerUpdates.size>0){const wt=nl(mt.width,mt.height,M.format,M.type);for(const Wt of M.layerUpdates){const ce=mt.data.subarray(Wt*wt/mt.data.BYTES_PER_ELEMENT,(Wt+1)*wt/mt.data.BYTES_PER_ELEMENT);e.compressedTexSubImage3D(r.TEXTURE_2D_ARRAY,st,0,0,Wt,mt.width,mt.height,1,xt,ce)}M.clearLayerUpdates()}else e.compressedTexSubImage3D(r.TEXTURE_2D_ARRAY,st,0,0,0,mt.width,mt.height,it.depth,xt,mt.data)}else e.compressedTexImage3D(r.TEXTURE_2D_ARRAY,st,It,mt.width,mt.height,it.depth,0,mt.data,
vendor: 11,138 bytes, line 3808
38080,0);else console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()");else D?ut&&e.texSubImage3D(r.TEXTURE_2D_ARRAY,st,0,0,0,mt.width,mt.height,it.depth,xt,Ot,mt.data):e.texImage3D(r.TEXTURE_2D_ARRAY,st,It,mt.width,mt.height,it.depth,0,xt,Ot,mt.data)}else{D&&at&&e.texStorage2D(r.TEXTURE_2D,Mt,It,Yt[0].width,Yt[0].height);for(let st=0,$=Yt.length;st<$;st++)mt=Yt[st],M.format!==ke?xt!==null?D?ut&&e.compressedTexSubImage2D(r.TEXTURE_2D,st,0,0,mt.width,mt.height,xt,mt.data):e.compressedTexImage2D(r.TEXTURE_2D,st,It,mt.width,mt.height,0,mt.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()"):D?ut&&e.texSubImage2D(r.TEXTURE_2D,st,0,0,mt.width,mt.height,xt,Ot,mt.data):e.texImage2D(r.TEXTURE_2D,st,It,mt.width,mt.height,0,xt,Ot,mt.data)}else if(M.isDataArrayTexture)if(D){if(at&&e.texStorage3D(r.TEXTURE_2D_ARRAY,Mt,It,it.width,it.height,it.depth),ut)if(M.layerUpdates.size>0){const st=nl(it.width,it.height,M.format,M.type);for(const $ of M.layerUpdates){const wt=it.data.subarray($*st/it.data.BYTES_PER_ELEMENT,($+1)*st/it.data.BYTES_PER_ELEMENT);e.texSubImage3D(r.TEXTURE_2D_ARRAY,0,0,0,$,it.width,it.height,1,xt,Ot,wt)}M.clearLayerUpdates()}else e.texSubImage3D(r.TEXTURE_2D_ARRAY,0,0,0,0,it.width,it.height,it.depth,xt,Ot,it.data)}else e.texImage3D(r.TEXTURE_2D_ARRAY,0,It,it.width,it.height,it.depth,0,xt,Ot,it.data);else if(M.isData3DTexture)D?(at&&e.texStorage3D(r.TEXTURE_3D,Mt,It,it.width,it.height,it.depth),ut&&e.texSubImage3D(r.TEXTURE_3D,0,0,0,0,it.width,it.height,it.depth,xt,Ot,it.data)):e.texImage3D(r.TEXTURE_3D,0,It,it.width,it.height,it.depth,0,xt,Ot,it.data);else if(M.isFramebufferTexture){if(at)if(D)e.texStorage2D(r.TEXTURE_2D,Mt,It,it.width,it.height);else{let st=it.width,$=it.height;for(let wt=0;wt<Mt;wt++)e.texImage2D(r.TEXTURE_2D,wt,It,st,$,0,xt,Ot,null),st>>=1,$>>=1}}else if(Yt.length>0){if(D&&at){const st=kt(Yt[0]);e.texStorage2D(r.TEXTURE_2D,Mt,It,st.width,st.height)}for(let st=0,$=Yt.length;st<$;st++)mt=Yt[st],D?ut&&e.texSubImage2D(r.TEXTURE_2D,st,0,0,xt,Ot,mt):e.texImage2D(r.TEXTURE_2D,st,It,xt,Ot,mt);M.generateMipmaps=!1}else if(D){if(at){const st=kt(it);e.texStorage2D(r.TEXTURE_2D,Mt,It,st.width,st.height)}ut&&e.texSubImage2D(r.TEXTURE_2D,0,0,0,xt,Ot,it)}else e.texImage2D(r.TEXTURE_2D,0,It,xt,Ot,it);g(M)&&p(H),Rt.__version=X.version,M.onUpdate&&M.onUpdate(M)}w.__version=M.version}function lt(w,M,F){if(M.image.length!==6)return;const H=Qt(w,M),j=M.source;e.bindTexture(r.TEXTURE_CUBE_MAP,w.__webglTexture,r.TEXTURE0+F);const X=n.get(j);if(j.version!==X.__version||H===!0){e.activeTexture(r.TEXTURE0+F);const Rt=Kt.getPrimaries(Kt.workingColorSpace),ot=M.colorSpace===Hn?null:Kt.getPrimaries(M.colorSpace),Tt=M.colorSpace===Hn||Rt===ot?r.NONE:r.BROWSER_DEFAULT_WEBGL;r.pixelStorei(r.UNPACK_FLIP_Y_WEBGL,M.flipY),r.pixelStorei(r.UNPACK_PREMULTIPLY_ALPHA_WEBGL,M.premultiplyAlpha),r.pixelStorei(r.UNPACK_ALIGNMENT,M.unpackAlignment),r.pixelStorei(r.UNPACK_COLORSPACE_CONVERSION_WEBGL,Tt);const At=M.isCompressedTexture||M.image[0].isCompressedTexture,it=M.image[0]&&M.image[0].isDataTexture,xt=[];for(let $=0;$<6;$++)!At&&!it?xt[$]=_(M.image[$],!0,i.maxCubemapSize):xt[$]=it?M.image[$].image:M.image[$],xt[$]=Gt(M,xt[$]);const Ot=xt[0],It=s.convert(M.format,M.colorSpace),mt=s.convert(M.type),Yt=v(M.internalFormat,It,mt,M.colorSpace),D=M.isVideoTexture!==!0,at=X.__version===void 0||H===!0,ut=j.dataReady;let Mt=A(M,Ot);Vt(r.TEXTURE_CUBE_MAP,M);let st;if(At){D&&at&&e.texStorage2D(r.TEXTURE_CUBE_MAP,Mt,Yt,Ot.width,Ot.height);for(let $=0;$<6;$++){st=xt[$].mipmaps;for(let wt=0;wt<st.length;wt++){const Wt=st[wt];M.format!==ke?It!==null?D?ut&&e.compressedTexSubImage2D(r.TEXTURE_CUBE_MAP_POSITIVE_X+$,wt,0,0,Wt.width,Wt.height,It,Wt.data):e.compressedTexImage2D(r.TEXTURE_CUBE_MAP_POSITIVE_X+$,wt,Yt,Wt.width,Wt.height,0,Wt.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .setTextureCube()"):D?ut&&e.texSubImage2D(r.TEXTURE_CUBE_MAP_POSITIVE_X+$,wt,0,0,Wt.width,Wt.height,It,mt,Wt.data):e.texImage2D(r.TEXTURE_CUBE_MAP_POSITIVE_X+$,wt,Yt,Wt.width,Wt.height,0,It,mt,Wt.data)}}}else{if(st=M.mipmaps,D&&at){st.length>0&&Mt++;const $=kt(xt[0]);e.texStorage2D(r.TEXTURE_CUBE_MAP,Mt,Yt,$.width,$.height)}for(let $=0;$<6;$++)if(it){D?ut&&e.texSubImage2D(r.TEXTURE_CUBE_MAP_POSITIVE_X+$,0,0,0,xt[$].width,xt[$].height,It,mt,xt[$].data):e.texImage2D(r.TEXTURE_CUBE_MAP_POSITIVE_X+$,0,Yt,xt[$].width,xt[$].height,0,It,mt,xt[$].data);for(let wt=0;wt<st.length;wt++){const ce=st[wt].image[$].image;D?ut&&e.texSubImage2D(r.TEXTURE_CUBE_MAP_POSITIVE_X+$,wt+1,0,0,ce.width,ce.height,It,mt,ce.data):e.texImage2D(r.TEXTURE_CUBE_MAP_POSITIVE_X+$,wt+1,Yt,ce.width,ce.height,0,It,mt,ce.data)}}else{D?ut&&e.texSubImage2D(r.TEXTURE_CUBE_MAP_POSITIVE_X+$,0,0,0,It,mt,xt[$]):e.texImage2D(r.TEXTURE_CUBE_MAP_POSITIVE_X+$,0,Yt,It,mt,xt[$]);for(let wt=0;wt<st.length;wt++){const Wt=st[wt];D?ut&&e.texSubImage2D(r.TEXTURE_CUBE_MAP_POSITIVE_X+$,wt+1,0,0,It,mt,Wt.image[$]):e.texImage2D(r.TEXTURE_CUBE_MAP_POSITIVE_X+$,wt+1,Yt,It,mt,Wt.image[$])}}}g(M)&&p(r.TEXTURE_CUBE_MAP),X.__version=j.version,M.onUpdate&&M.onUpdate(M)}w.__version=M.version}function Lt(w,M,F,H,j,X){const Rt=s.convert(F.format,F.colorSpace),ot=s.convert(F.type),Tt=v(F.internalFormat,Rt,ot,F.colorSpace),At=n.get(M),it=n.get(F);if(it.__renderTarget=M,!At.__hasExternalTextures){const xt=Math.max(1,M.width>>X),Ot=Math.max(1,M.height>>X);j===r.TEXTURE_3D||j===r.TEXTURE_2D_ARRAY?e.texImage3D(j,X,Tt,xt,Ot,M.depth,0,Rt,ot,null):e.texImage2D(j,X,Tt,xt,Ot,0,Rt,ot,null)}e.bindFramebuffer(r.FRAMEBUFFER,w),et(M)?o.framebufferTexture2DMultisampleEXT(r.FRAMEBUFFER,H,j,it.__webglTexture,0,ct(M)):(j===r.TEXTURE_2D||j>=r.TEXTURE_CUBE_MAP_POSITIVE_X&&j<=r.TEXTURE_CUBE_MAP_NEGATIVE_Z)&&r.framebufferTexture2D(r.FRAMEBUFFER,H,j,it.__webglTexture,X),e.bindFramebuffer(r.FRAMEBUFFER,null)}function Ct(w,M,F){if(r.bindRenderbuffer(r.RENDERBUFFER,w),M.depthBuffer){const H=M.depthTexture,j=H&&H.isDepthTexture?H.type:null,X=x(M.stencilBuffer,j),Rt=M.stencilBuffer?r.DEPTH_STENCIL_ATTACHMENT:r.DEPTH_ATTACHMENT,ot=ct(M);et(M)?o.renderbufferStorageMultisampleEXT(r.RENDERBUFFER,ot,X,M.width,M.height):F?r.renderbufferStorageMultisample(r.RENDERBUFFER,ot,X,M.width,M.height):r.renderbufferStorage(r.RENDERBUFFER,X,M.width,M.height),r.framebufferRenderbuffer(r.FRAMEBUFFER,Rt,r.RENDERBUFFER,w)}else{const H=M.textures;for(let j=0;j<H.length;j++){const X=H[j],Rt=s.convert(X.format,X.colorSpace),ot=s.convert(X.type),Tt=v(X.internalFormat,Rt,ot,X.colorSpace),At=ct(M);F&&et(M)===!1?r.renderbufferStorageMultisample(r.RENDERBUFFER,At,Tt,M.width,M.height):et(M)?o.renderbufferStorageMultisampleEXT(r.RENDERBUFFER,At,Tt,M.width,M.height):r.renderbufferStorage(r.RENDERBUFFER,Tt,M.width,M.height)}}r.bindRenderbuffer(r.RENDERBUFFER,null)}function Ft(w,M){if(M&&M.isWebGLCubeRenderTarget)throw new Error("Depth Texture with cube render targets is not supported");if(e.bindFramebuffer(r.FRAMEBUFFER,w),!(M.depthTexture&&M.depthTexture.isDepthTexture))throw new Error("renderTarget.depthTexture must be an instance of THREE.DepthTexture");const H=n.get(M.depthTexture);H.__renderTarget=M,(!H.__webglTexture||M.depthTexture.image.width!==M.width||M.depthTexture.image.height!==M.height)&&(M.depthTexture.image.width=M.width,M.depthTexture.image.height=M.height,M.depthTexture.needsUpdate=!0),Z(M.depthTexture,0);const j=H.__webglTexture,X=ct(M);if(M.depthTexture.format===Ns)et(M)?o.framebufferTexture2DMultisampleEXT(r.FRAMEBUFFER,r.DEPTH_ATTACHMENT,r.TEXTURE_2D,j,0,X):r.framebufferTexture2D(r.FRAMEBUFFER,r.DEPTH_ATTACHMENT,r.TEXTURE_2D,j,0);else if(M.depthTexture.format===Fs)et(M)?o.framebufferTexture2DMultisampleEXT(r.FRAMEBUFFER,r.DEPTH_STENCIL_ATTACHMENT,r.TEXTURE_2D,j,0,X):r.framebufferTexture2D(r.FRAMEBUFFER,r.DEPTH_STENCIL_ATTACHMENT,r.TEXTURE_2D,j,0);else throw new Error("Unknown depthTexture format")}function ue(w){const M=n.get(w),F=w.isWebGLCubeRenderTarget===!0;if(M.__boundDepthTexture!==w.depthTexture){const H=w.depthTexture;if(M.__depthDisposeCallback&&M.__depthDisposeCallback(),H){const j=()=>{delete M.__boundDepthTexture,delete M.__depthDisposeCallback,H.removeEventListener("dispose",j)};H.addEventListener("dispose",j),M.__depthDisposeCallback=j}M.__boundDepthTexture=H}if(w.depthTexture&&!M.__autoAllocateDepthBuffer){if(F)throw new Error("target.depthTexture not supported in Cube render targets");const H=w.texture.mipmaps;H&&H.length>0?Ft(M.__webglFramebuffer[0],w):Ft(M.__webglFramebuffer,w)}else if(F){M.__webglDepthbuffer=[];for(let H=0;H<6;H++)if(e.bindFramebuffer(r.FRAMEBUFFER,M.__webglFramebuffer[H]),M.__webglDepthbuffer[H]===void 0)M.__webglDepthbuffer[H]=r.createRenderbuffer(),Ct(M.__webglDepthbuffer[H],w,!1);else{const j=w.stencilBuffer?r.DEPTH_STENCIL_ATTACHMENT:r.DEPTH_ATTACHMENT,X=M.__webglDepthbuffer[H];r.bindRenderbuffer(r.RENDERBUFFER,X),r.framebufferRenderbuffer(r.FRAMEBUFFER,j,r.RENDERBUFFER,X)}}else{const H=w.texture.mipmaps;if(H&&H.length>0?e.bindFramebuffer(r.FRAMEBUFFER,M.__webglFramebuffer[0]):e.bindFramebuffer(r.FRAMEBUFFER,M.__webglFramebuffer),M.__webglDepthbuffer===void 0)M.__webglDepthbuffer=r.createRenderbuffer(),Ct(M.__webglDepthbuffer,w,!1);else{const j=w.stencilBuffer?r.DEPTH_STENCIL_ATTACHMENT:r.DEPTH_ATTACHMENT,X=M.__webglDepthbuffer;r.bindRenderbuffer(r.RENDERBUFFER,X),r.framebufferRenderbuffer(r.FRAMEBUFFER,j,r.RENDERBUFFER,X)}}e.bindFramebuffer(r.FRAMEBUFFER,null)}function Ht(w,M,F){const H=n.get(w);M!==void 0&&Lt(H.__webglFramebuffer,w,w.texture,r.COLOR_ATTACHMENT0,r.TEXTURE_2D,0),F!==void 0&&ue(w)}function L(w){const M=w.texture,F=n.get(w),H=n.get(M);w.addEventListener("dispose",R);const j=w.textures,X=w.isWebGLCubeRenderTarget===!0,Rt=j.length>1;if(Rt||(H.__webglTexture===void 0&&(H.__webglTexture=r.createTexture()),H.__version=M.version,a.memory.textures++),X){F.__webglFramebuffer=[];for(let ot=0;ot<6;ot++)if(M.mipmaps&&M.mipmaps.length>0){F.__webglFramebuffer[ot]=[];for(let Tt=0;Tt<M.mipmaps.length;Tt++)F.__webglFramebuffer[ot][Tt]=r.createFramebuffer()}else F.__webglFramebuffer[ot]=r.createFramebuffer()}else{if(M.mipmaps&&M.mipmaps.length>0){F.__webglFramebuffer=[];for(let ot=0;ot<M.mipmaps.length;ot++)F.__webglFramebuffer[ot]=r.createFramebuffer()}else F.__webglFramebuffer=r.createFramebuffer();if(Rt)for(let ot=0,Tt=j.length;ot<Tt;ot++){const At=n.get(j[ot]);At.__webglTexture===void 0&&(At.__webglTexture=r.createTexture(),a.memory.textures++)}if(w.samples>0&&et(w)===!1){F.__webglMultisampledFramebuffer=r.createFramebuffer(),F.__webglColorRenderbuffer=[],e.bindFramebuffer(r.FRAMEBUFFER,F.__webglMultisampledFramebuffer);for(let ot=0;ot<j.length;ot++){const Tt=j[ot];F.__webglColorRenderbuffer[ot]=r.createRenderbuffer(),r.bindRenderbuffer(r.RENDERBUFFER,F.__webglColorRenderbuffer[ot]);const At=s.convert(Tt.format,Tt.colorSpace),it=s.convert(Tt.type),xt=v(Tt.internalFormat,At,it,Tt.colorSpace,w.isXRRenderTarget===!0),Ot=ct(w);r.renderbufferStorageMultisample(r.RENDERBUFFER,Ot,xt,w.width,w.height),r.framebufferRenderbuffer(r.FRAMEBUFFER,r.COLOR_ATTACHMENT0+ot,r.RENDERBUFFER,F.__webglColorRen
vendor: 4,447 bytes, line 3808
3808derbuffer[ot])}r.bindRenderbuffer(r.RENDERBUFFER,null),w.depthBuffer&&(F.__webglDepthRenderbuffer=r.createRenderbuffer(),Ct(F.__webglDepthRenderbuffer,w,!0)),e.bindFramebuffer(r.FRAMEBUFFER,null)}}if(X){e.bindTexture(r.TEXTURE_CUBE_MAP,H.__webglTexture),Vt(r.TEXTURE_CUBE_MAP,M);for(let ot=0;ot<6;ot++)if(M.mipmaps&&M.mipmaps.length>0)for(let Tt=0;Tt<M.mipmaps.length;Tt++)Lt(F.__webglFramebuffer[ot][Tt],w,M,r.COLOR_ATTACHMENT0,r.TEXTURE_CUBE_MAP_POSITIVE_X+ot,Tt);else Lt(F.__webglFramebuffer[ot],w,M,r.COLOR_ATTACHMENT0,r.TEXTURE_CUBE_MAP_POSITIVE_X+ot,0);g(M)&&p(r.TEXTURE_CUBE_MAP),e.unbindTexture()}else if(Rt){for(let ot=0,Tt=j.length;ot<Tt;ot++){const At=j[ot],it=n.get(At);let xt=r.TEXTURE_2D;(w.isWebGL3DRenderTarget||w.isWebGLArrayRenderTarget)&&(xt=w.isWebGL3DRenderTarget?r.TEXTURE_3D:r.TEXTURE_2D_ARRAY),e.bindTexture(xt,it.__webglTexture),Vt(xt,At),Lt(F.__webglFramebuffer,w,At,r.COLOR_ATTACHMENT0+ot,xt,0),g(At)&&p(xt)}e.unbindTexture()}else{let ot=r.TEXTURE_2D;if((w.isWebGL3DRenderTarget||w.isWebGLArrayRenderTarget)&&(ot=w.isWebGL3DRenderTarget?r.TEXTURE_3D:r.TEXTURE_2D_ARRAY),e.bindTexture(ot,H.__webglTexture),Vt(ot,M),M.mipmaps&&M.mipmaps.length>0)for(let Tt=0;Tt<M.mipmaps.length;Tt++)Lt(F.__webglFramebuffer[Tt],w,M,r.COLOR_ATTACHMENT0,ot,Tt);else Lt(F.__webglFramebuffer,w,M,r.COLOR_ATTACHMENT0,ot,0);g(M)&&p(ot),e.unbindTexture()}w.depthBuffer&&ue(w)}function Q(w){const M=w.textures;for(let F=0,H=M.length;F<H;F++){const j=M[F];if(g(j)){const X=y(w),Rt=n.get(j).__webglTexture;e.bindTexture(X,Rt),p(X),e.unbindTexture()}}}const Y=[],tt=[];function J(w){if(w.samples>0){if(et(w)===!1){const M=w.textures,F=w.width,H=w.height;let j=r.COLOR_BUFFER_BIT;const X=w.stencilBuffer?r.DEPTH_STENCIL_ATTACHMENT:r.DEPTH_ATTACHMENT,Rt=n.get(w),ot=M.length>1;if(ot)for(let At=0;At<M.length;At++)e.bindFramebuffer(r.FRAMEBUFFER,Rt.__webglMultisampledFramebuffer),r.framebufferRenderbuffer(r.FRAMEBUFFER,r.COLOR_ATTACHMENT0+At,r.RENDERBUFFER,null),e.bindFramebuffer(r.FRAMEBUFFER,Rt.__webglFramebuffer),r.framebufferTexture2D(r.DRAW_FRAMEBUFFER,r.COLOR_ATTACHMENT0+At,r.TEXTURE_2D,null,0);e.bindFramebuffer(r.READ_FRAMEBUFFER,Rt.__webglMultisampledFramebuffer);const Tt=w.texture.mipmaps;Tt&&Tt.length>0?e.bindFramebuffer(r.DRAW_FRAMEBUFFER,Rt.__webglFramebuffer[0]):e.bindFramebuffer(r.DRAW_FRAMEBUFFER,Rt.__webglFramebuffer);for(let At=0;At<M.length;At++){if(w.resolveDepthBuffer&&(w.depthBuffer&&(j|=r.DEPTH_BUFFER_BIT),w.stencilBuffer&&w.resolveStencilBuffer&&(j|=r.STENCIL_BUFFER_BIT)),ot){r.framebufferRenderbuffer(r.READ_FRAMEBUFFER,r.COLOR_ATTACHMENT0,r.RENDERBUFFER,Rt.__webglColorRenderbuffer[At]);const it=n.get(M[At]).__webglTexture;r.framebufferTexture2D(r.DRAW_FRAMEBUFFER,r.COLOR_ATTACHMENT0,r.TEXTURE_2D,it,0)}r.blitFramebuffer(0,0,F,H,0,0,F,H,j,r.NEAREST),l===!0&&(Y.length=0,tt.length=0,Y.push(r.COLOR_ATTACHMENT0+At),w.depthBuffer&&w.resolveDepthBuffer===!1&&(Y.push(X),tt.push(X),r.invalidateFramebuffer(r.DRAW_FRAMEBUFFER,tt)),r.invalidateFramebuffer(r.READ_FRAMEBUFFER,Y))}if(e.bindFramebuffer(r.READ_FRAMEBUFFER,null),e.bindFramebuffer(r.DRAW_FRAMEBUFFER,null),ot)for(let At=0;At<M.length;At++){e.bindFramebuffer(r.FRAMEBUFFER,Rt.__webglMultisampledFramebuffer),r.framebufferRenderbuffer(r.FRAMEBUFFER,r.COLOR_ATTACHMENT0+At,r.RENDERBUFFER,Rt.__webglColorRenderbuffer[At]);const it=n.get(M[At]).__webglTexture;e.bindFramebuffer(r.FRAMEBUFFER,Rt.__webglFramebuffer),r.framebufferTexture2D(r.DRAW_FRAMEBUFFER,r.COLOR_ATTACHMENT0+At,r.TEXTURE_2D,it,0)}e.bindFramebuffer(r.DRAW_FRAMEBUFFER,Rt.__webglMultisampledFramebuffer)}else if(w.depthBuffer&&w.resolveDepthBuffer===!1&&l){const M=w.stencilBuffer?r.DEPTH_STENCIL_ATTACHMENT:r.DEPTH_ATTACHMENT;r.invalidateFramebuffer(r.DRAW_FRAMEBUFFER,[M])}}}function ct(w){return Math.min(i.maxSamples,w.samples)}function et(w){const M=n.get(w);return w.samples>0&&t.has("WEBGL_multisampled_render_to_texture")===!0&&M.__useRenderToTexture!==!1}function ht(w){const M=a.render.frame;h.get(w)!==M&&(h.set(w,M),w.update())}function Gt(w,M){const F=w.colorSpace,H=w.format,j=w.type;return w.isCompressedTexture===!0||w.isVideoTexture===!0||F!==is&&F!==Hn&&(Kt.getTransfer(F)===ae?(H!==ke||j!==mn)&&console.warn("THREE.WebGLTextures: sRGB encoded textures have to use RGBAFormat and UnsignedByteType."):console.error("THREE.WebGLTextures: Unsupported texture color space:",F)),M}function kt(w){return typeof HTMLImageElement<"u"&&w instanceof HTMLImageElement?(c.width=w.naturalWi
vendor: 4,359 bytes, line 3808
3808dth||w.width,c.height=w.naturalHeight||w.height):typeof VideoFrame<"u"&&w instanceof VideoFrame?(c.width=w.displayWidth,c.height=w.displayHeight):(c.width=w.width,c.height=w.height),c}this.allocateTextureUnit=k,this.resetTextureUnits=B,this.setTexture2D=Z,this.setTexture2DArray=W,this.setTexture3D=nt,this.setTextureCube=G,this.rebindTextures=Ht,this.setupRenderTarget=L,this.updateRenderTargetMipmap=Q,this.updateMultisampleRenderTarget=J,this.setupDepthRenderbuffer=ue,this.setupFrameBufferTexture=Lt,this.useMultisampledRTT=et}function Jx(r,t){function e(n,i=Hn){let s;const a=Kt.getTransfer(i);if(n===mn)return r.UNSIGNED_BYTE;if(n===al)return r.UNSIGNED_SHORT_4_4_4_4;if(n===ol)return r.UNSIGNED_SHORT_5_5_5_1;if(n===zh)return r.UNSIGNED_INT_5_9_9_9_REV;if(n===Oh)return r.BYTE;if(n===Bh)return r.SHORT;if(n===Ds)return r.UNSIGNED_SHORT;if(n===rl)return r.INT;if(n===Yn)return r.UNSIGNED_INT;if(n===Je)return r.FLOAT;if(n===Ws)return r.HALF_FLOAT;if(n===kh)return r.ALPHA;if(n===Vh)return r.RGB;if(n===ke)return r.RGBA;if(n===Ns)return r.DEPTH_COMPONENT;if(n===Fs)return r.DEPTH_STENCIL;if(n===ll)return r.RED;if(n===ha)return r.RED_INTEGER;if(n===Hh)return r.RG;if(n===cl)return r.RG_INTEGER;if(n===hl)return r.RGBA_INTEGER;if(n===Hr||n===Gr||n===Wr||n===Xr)if(a===ae)if(s=t.get("WEBGL_compressed_texture_s3tc_srgb"),s!==null){if(n===Hr)return s.COMPRESSED_SRGB_S3TC_DXT1_EXT;if(n===Gr)return s.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT;if(n===Wr)return s.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT;if(n===Xr)return s.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT}else return null;else if(s=t.get("WEBGL_compressed_texture_s3tc"),s!==null){if(n===Hr)return s.COMPRESSED_RGB_S3TC_DXT1_EXT;if(n===Gr)return s.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(n===Wr)return s.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(n===Xr)return s.COMPRESSED_RGBA_S3TC_DXT5_EXT}else return null;if(n===bo||n===Eo||n===To||n===Ao)if(s=t.get("WEBGL_compressed_texture_pvrtc"),s!==null){if(n===bo)return s.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(n===Eo)return s.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(n===To)return s.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(n===Ao)return s.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}else return null;if(n===wo||n===Co||n===Ro)if(s=t.get("WEBGL_compressed_texture_etc"),s!==null){if(n===wo||n===Co)return a===ae?s.COMPRESSED_SRGB8_ETC2:s.COMPRESSED_RGB8_ETC2;if(n===Ro)return a===ae?s.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC:s.COMPRESSED_RGBA8_ETC2_EAC}else return null;if(n===Io||n===Po||n===Lo||n===Do||n===Uo||n===No||n===Fo||n===Oo||n===Bo||n===zo||n===ko||n===Vo||n===Ho||n===Go)if(s=t.get("WEBGL_compressed_texture_astc"),s!==null){if(n===Io)return a===ae?s.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR:s.COMPRESSED_RGBA_ASTC_4x4_KHR;if(n===Po)return a===ae?s.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR:s.COMPRESSED_RGBA_ASTC_5x4_KHR;if(n===Lo)return a===ae?s.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR:s.COMPRESSED_RGBA_ASTC_5x5_KHR;if(n===Do)return a===ae?s.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR:s.COMPRESSED_RGBA_ASTC_6x5_KHR;if(n===Uo)return a===ae?s.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR:s.COMPRESSED_RGBA_ASTC_6x6_KHR;if(n===No)return a===ae?s.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR:s.COMPRESSED_RGBA_ASTC_8x5_KHR;if(n===Fo)return a===ae?s.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR:s.COMPRESSED_RGBA_ASTC_8x6_KHR;if(n===Oo)return a===ae?s.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR:s.COMPRESSED_RGBA_ASTC_8x8_KHR;if(n===Bo)return a===ae?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR:s.COMPRESSED_RGBA_ASTC_10x5_KHR;if(n===zo)return a===ae?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR:s.COMPRESSED_RGBA_ASTC_10x6_KHR;if(n===ko)return a===ae?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR:s.COMPRESSED_RGBA_ASTC_10x8_KHR;if(n===Vo)return a===ae?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR:s.COMPRESSED_RGBA_ASTC_10x10_KHR;if(n===Ho)return a===ae?s.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR:s.COMPRESSED_RGBA_ASTC_12x10_KHR;if(n===Go)return a===ae?s.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR:s.COMPRESSED_RGBA_ASTC_12x12_KHR}else return null;if(n===qr||n===Wo||n===Xo)if(s=t.get("EXT_texture_compression_bptc"),s!==null){if(n===qr)return a===ae?s.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT:s.COMPRESSED_RGBA_BPTC_UNORM_EXT;if(n===Wo)return s.COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT;if(n===Xo)return s.COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT}else return null;if(n===Gh||n===qo||n===Yo||n===Zo)if(s=t.get("EXT_texture_compression_rgtc"),s!==null){if(n===qr)return s.COMPRESSED_RED_RGT
vendor: 10,365 bytes, lines 3808-3832
3808C1_EXT;if(n===qo)return s.COMPRESSED_SIGNED_RED_RGTC1_EXT;if(n===Yo)return s.COMPRESSED_RED_GREEN_RGTC2_EXT;if(n===Zo)return s.COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT}else return null;return n===Us?r.UNSIGNED_INT_24_8:r[n]!==void 0?r[n]:null}return{convert:e}}class Ru extends xe{constructor(t=null){super(),this.sourceTexture=t,this.isExternalTexture=!0}}const $x=`
3809void main() {
3810
3811	gl_Position = vec4( position, 1.0 );
3812
3813}`,Kx=`
3814uniform sampler2DArray depthColor;
3815uniform float depthWidth;
3816uniform float depthHeight;
3817
3818void main() {
3819
3820	vec2 coord = vec2( gl_FragCoord.x / depthWidth, gl_FragCoord.y / depthHeight );
3821
3822	if ( coord.x >= 1.0 ) {
3823
3824		gl_FragDepth = texture( depthColor, vec3( coord.x - 1.0, coord.y, 1 ) ).r;
3825
3826	} else {
3827
3828		gl_FragDepth = texture( depthColor, vec3( coord.x, coord.y, 0 ) ).r;
3829
3830	}
3831
3832}`;class Qx{constructor(){this.texture=null,this.mesh=null,this.depthNear=0,this.depthFar=0}init(t,e){if(this.texture===null){const n=new Ru(t.texture);(t.depthNear!==e.depthNear||t.depthFar!==e.depthFar)&&(this.depthNear=t.depthNear,this.depthFar=t.depthFar),this.texture=n}}getMesh(t){if(this.texture!==null&&this.mesh===null){const e=t.cameras[0].viewport,n=new gn({vertexShader:$x,fragmentShader:Kx,uniforms:{depthColor:{value:this.texture},depthWidth:{value:e.z},depthHeight:{value:e.w}}});this.mesh=new ye(new Ys(20,20),n)}return this.mesh}reset(){this.texture=null,this.mesh=null}getDepthTexture(){return this.texture}}class jx extends Dn{constructor(t,e){super();const n=this;let i=null,s=1,a=null,o="local-floor",l=1,c=null,h=null,u=null,d=null,f=null,m=null;const _=new Qx,g={},p=e.getContextAttributes();let y=null,v=null;const x=[],A=[],T=new K;let R=null;const P=new Ce;P.viewport=new ne;const b=new Ce;b.viewport=new ne;const S=[P,b],I=new $p;let B=null,k=null;this.cameraAutoUpdate=!0,this.enabled=!1,this.isPresenting=!1,this.getController=function(q){let ft=x[q];return ft===void 0&&(ft=new Ha,x[q]=ft),ft.getTargetRaySpace()},this.getControllerGrip=function(q){let ft=x[q];return ft===void 0&&(ft=new Ha,x[q]=ft),ft.getGripSpace()},this.getHand=function(q){let ft=x[q];return ft===void 0&&(ft=new Ha,x[q]=ft),ft.getHandSpace()};function V(q){const ft=A.indexOf(q.inputSource);if(ft===-1)return;const lt=x[ft];lt!==void 0&&(lt.update(q.inputSource,q.frame,c||a),lt.dispatchEvent({type:q.type,data:q.inputSource}))}function Z(){i.removeEventListener("select",V),i.removeEventListener("selectstart",V),i.removeEventListener("selectend",V),i.removeEventListener("squeeze",V),i.removeEventListener("squeezestart",V),i.removeEventListener("squeezeend",V),i.removeEventListener("end",Z),i.removeEventListener("inputsourceschange",W);for(let q=0;q<x.length;q++){const ft=A[q];ft!==null&&(A[q]=null,x[q].disconnect(ft))}B=null,k=null,_.reset();for(const q in g)delete g[q];t.setRenderTarget(y),f=null,d=null,u=null,i=null,v=null,jt.stop(),n.isPresenting=!1,t.setPixelRatio(R),t.setSize(T.width,T.height,!1),n.dispatchEvent({type:"sessionend"})}this.setFramebufferScaleFactor=function(q){s=q,n.isPresenting===!0&&console.warn("THREE.WebXRManager: Cannot change framebuffer scale while presenting.")},this.setReferenceSpaceType=function(q){o=q,n.isPresenting===!0&&console.warn("THREE.WebXRManager: Cannot change reference space type while presenting.")},this.getReferenceSpace=function(){return c||a},this.setReferenceSpace=function(q){c=q},this.getBaseLayer=function(){return d!==null?d:f},this.getBinding=function(){return u},this.getFrame=function(){return m},this.getSession=function(){return i},this.setSession=async function(q){if(i=q,i!==null){if(y=t.getRenderTarget(),i.addEventListener("select",V),i.addEventListener("selectstart",V),i.addEventListener("selectend",V),i.addEventListener("squeeze",V),i.addEventListener("squeezestart",V),i.addEventListener("squeezeend",V),i.addEventListener("end",Z),i.addEventListener("inputsourceschange",W),p.xrCompatible!==!0&&await e.makeXRCompatible(),R=t.getPixelRatio(),t.getSize(T),typeof XRWebGLBinding<"u"&&(u=new XRWebGLBinding(i,e)),u!==null&&"createProjectionLayer"in XRWebGLBinding.prototype){let lt=null,Lt=null,Ct=null;p.depth&&(Ct=p.stencil?e.DEPTH24_STENCIL8:e.DEPTH_COMPONENT24,lt=p.stencil?Fs:Ns,Lt=p.stencil?Us:Yn);const Ft={colorFormat:e.RGBA8,depthFormat:Ct,scaleFactor:s};d=u.createProjectionLayer(Ft),i.updateRenderState({layers:[d]}),t.setPixelRatio(1),t.setSize(d.textureWidth,d.textureHeight,!1),v=new Ln(d.textureWidth,d.textureHeight,{format:ke,type:mn,depthTexture:new nu(d.textureWidth,d.textureHeight,Lt,void 0,void 0,void 0,void 0,void 0,void 0,lt),stencilBuffer:p.stencil,colorSpace:t.outputColorSpace,samples:p.antialias?4:0,resolveDepthBuffer:d.ignoreDepthValues===!1,resolveStencilBuffer:d.ignoreDepthValues===!1})}else{const lt={antialias:p.antialias,alpha:!0,depth:p.depth,stencil:p.stencil,framebufferScaleFactor:s};f=new XRWebGLLayer(i,e,lt),i.updateRenderState({baseLayer:f}),t.setPixelRatio(1),t.setSize(f.framebufferWidth,f.framebufferHeight,!1),v=new Ln(f.framebufferWidth,f.framebufferHeight,{format:ke,type:mn,colorSpace:t.outputColorSpace,stencilBuffer:p.stencil,resolveDepthBuffer:f.ignoreDepthValues===!1,resolveStencilBuffer:f.ignoreDepthValues===!1})}v.isXRRenderTarget=!0,this.setFoveation(l),c=null,a=await i.requestReferenceSpace(o),jt.setContext(i),jt.start(),n.isPresenting=!0,n.dispatchEvent({type:"sessionstart"})}},this.getEnvironmentBlendMode=function(){if(i!==null)return i.environmentBlendMode},this.getDepthTexture=function(){return _.getDepthTexture()};function W(q){for(let ft=0;ft<q.removed.length;ft++){const lt=q.removed[ft],Lt=A.indexOf(lt);Lt>=0&&(A[Lt]=null,x[Lt].disconnect(lt))}for(let ft=0;ft<q.added.length;ft++){const lt=q.added[ft];let Lt=A.indexOf(lt);if(Lt===-1){for(let Ft=0;Ft<x.length;Ft++)if(Ft>=A.length){A.push(lt),Lt=Ft;break}else if(A[Ft]===null){A[Ft]=lt,Lt=Ft;break}if(Lt===-1)break}const Ct=x[Lt];Ct&&Ct.connect(lt)}}const nt=new C,G=new C;function dt(q,ft,lt){nt.setFromMatrixPosition(ft.matrixWorld),G.setFromMatrixPosition(lt.matrixWorld);const Lt=nt.distanceTo(G),Ct=ft.projectionMatrix.elements,Ft=lt.projectionMatrix.elements,ue=Ct[14]/(Ct[10]-1),Ht=Ct[14]/(Ct[10]+1),L=(Ct[9]+1)/Ct[5],Q=(Ct[9]-1)/Ct[5],Y=(Ct[8]-1)/Ct[0],tt=(Ft[8]+1)/Ft[0],J=ue*Y,ct=ue*tt,et=Lt/(-Y+tt),ht=et*-Y;if(ft.matrixWorld.decompose(q.position,q.quaternion,q.scale),q.translateX(ht),q.translateZ(et),q.matrixWorld.compose(q.position,q.quaternion,q.scale),q.matrixWorldInverse.copy(q.matrixWorld).invert(),Ct[10]===-1)q.projectionMatrix.copy(ft.projectionMatrix),q.projectionMatrixInverse.copy(ft.projectionMatrixInverse);else{const Gt=ue+et,kt=Ht+et,w=J-ht,M=ct+(Lt-ht),F=L*Ht/kt*Gt,H=Q*Ht/kt*Gt;q.projectionMatrix.makePerspective(w,M,F,H,Gt,kt),q.projectionMatrixInverse.copy(q.projectionMatrix).invert()}}function _t(q,ft){ft===null?q.matrixWorld.copy(q.matrix):q.matrixWorld.multiplyMatrices(ft.matrixWorld,q.matrix),q.matrixWorldInverse.copy(q.matrixWorld).invert()}this.updateCamera=function(q){if(i===null)return;let ft=q.near,lt=q.far;_.texture!==null&&(_.depthNear>0&&(ft=_.depthNear),_.depthFar>0&&(lt=_.depthFar)),I.near=b.near=P.near=ft,I.far=b.far=P.far=lt,(B!==I.near||k!==I.far)&&(i.updateRenderState({depthNear:I.near,depthFar:I.far}),B=I.near,k=I.far),I.layers.mask=q.layers.mask|6,P.layers.mask=I.layers.mask&3,b.layers.mask=I.layers.mask&5;const Lt=q.parent,Ct=I.cameras;_t(I,Lt);for(let Ft=0;Ft<Ct.length;Ft++)_t(Ct[Ft],Lt);Ct.length===2?dt(I,P,b):I.projectionMatrix.copy(P.projectionMatrix),bt(q,I,Lt)};function bt(q,ft,lt){lt===null?q.matrix.copy(ft.matrixWorld):(q.matrix.copy(lt.matrixWorld),q.matrix.invert(),q.matrix.multiply(ft.matrixWorld)),q.matrix.decompose(q.position,q.quaternion,q.scale),q.updateMatrixWorld(!0),q.projectionMatrix.copy(ft.projectionMatrix),q.projectionMatrixInverse.copy(ft.projectionMatrixInverse),q.isPerspectiveCamera&&(q.fov=ss*2*Math.atan(1/q.projectionMatrix.elements[5]),q.zoom=1)}this.getCamera=function(){return I},this.getFoveation=function(){if(!(d===null&&f===null))return l},this.setFoveation=function(q){l=q,d!==null&&(d.fixedFoveation=q),f!==null&&f.fixedFoveation!==void 0&&(f.fixedFoveation=q)},this.hasDepthSensing=function(){return _.texture!==null},this.getDepthSensingMesh=function(){return _.getMesh(I)},this.getCameraTexture=function(q){return g[q]};let Vt=null;function Qt(q,ft){if(h=ft.getViewerPose(c||a),m=ft,h!==null){const lt=h.views;f!==null&&(t.setRenderTargetFramebuffer(v,f.framebuffer),t.setRenderTarget(v));let Lt=!1;lt.length!==I.cameras.length&&(I.cameras.length=0,Lt=!0);for(let Ht=0;Ht<lt.length;Ht++){const L=lt[Ht];let Q=null;if(f!==null)Q=f.getViewport(L);else{const tt=u.getViewSubImage(d,L);Q=tt.viewport,Ht===0&&(t.setRenderTargetTextures(v,tt.colorTexture,tt.depthStencilTexture),t.setRenderTarget(v))}let Y=S[Ht];Y===void 0&&(Y=new Ce,Y.layers.enable(Ht),Y.viewport=new ne,S[Ht]=Y),Y.matrix.fromArray(L.transform.matrix),Y.matrix.decompose(Y.position,Y.quaternion,Y.scale),Y.projectionMatrix.fromArray(L.projectionMatrix),Y.projectionMatrixInverse.copy(Y.projectionMatrix).invert(),Y.viewport.set(Q.x,Q.y,Q.width,Q.height),Ht===0&&(I.matrix.copy(Y.matrix),I.matrix.decompose(I.position,I.quaternion,I.scale)),Lt===!0&&I.cameras.push(Y)}const Ct=i.enabledFeatures;if(Ct&&Ct.includes("depth-sensing")&&i.depthUsage=="gpu-optimized"&&u){const Ht=u.getDepthInformation(lt[0]);Ht&&Ht.isValid&&Ht.texture&&_.init(Ht,i.renderState)}if(Ct&&Ct.includes("camera-access")&&(t.state.unbindTexture(),u))for(let Ht=0;Ht<lt.length;Ht++){const L=lt[Ht].camera;if(L){let Q=g[L];Q||(Q=new Ru,g[L]=Q);const Y=u.getCameraImage(L);Q.sourceTexture=Y}}}for(let lt=0;lt<x.length;lt++){const Lt=A[lt],Ct=x[lt];Lt!==null&&Ct!==void 0&&Ct.update(Lt,ft,c||a)}Vt&&Vt(q,ft),ft.detectedPlanes&&n.dispatchEvent({type:"planesdetected",data:ft}),m=null}const jt=new Eu;jt.setAnimationLoop(Qt),this.setAnimationLoop=function(q){Vt=q},this.dispose=function(){}}}const hi=new sn,tv=new zt;function ev(r,t){function e(g,p){g.matrixAutoUpdate===!0&&g.updateMatrix(),p.value.copy(g.matrix)}function n(g,p){p.color.getRGB(g.fogColor.value,Kh(r)),p.isFog?(g.fogNear.value=p.near,g.fogFar.value=p.far):p.isFogExp2&&(g.fogDensity.value=p.density)}function i(g,p,y,v,x){p.isMeshBasicMaterial||p.isMeshLambertMaterial?s(g,p):p.isMeshToonMaterial?(s(g,p),u(g,p)):p.isMeshPhongMaterial?(s(g,p),h(g,p)):p.isMeshStandardMaterial?(s(g,p),d(g,p),p.isMeshPhysicalMaterial&&f(g,p,x)):p.isMeshMat
vendor: 11,387 bytes, line 3832
3832capMaterial?(s(g,p),m(g,p)):p.isMeshDepthMaterial?s(g,p):p.isMeshDistanceMaterial?(s(g,p),_(g,p)):p.isMeshNormalMaterial?s(g,p):p.isLineBasicMaterial?(a(g,p),p.isLineDashedMaterial&&o(g,p)):p.isPointsMaterial?l(g,p,y,v):p.isSpriteMaterial?c(g,p):p.isShadowMaterial?(g.color.value.copy(p.color),g.opacity.value=p.opacity):p.isShaderMaterial&&(p.uniformsNeedUpdate=!1)}function s(g,p){g.opacity.value=p.opacity,p.color&&g.diffuse.value.copy(p.color),p.emissive&&g.emissive.value.copy(p.emissive).multiplyScalar(p.emissiveIntensity),p.map&&(g.map.value=p.map,e(p.map,g.mapTransform)),p.alphaMap&&(g.alphaMap.value=p.alphaMap,e(p.alphaMap,g.alphaMapTransform)),p.bumpMap&&(g.bumpMap.value=p.bumpMap,e(p.bumpMap,g.bumpMapTransform),g.bumpScale.value=p.bumpScale,p.side===Ve&&(g.bumpScale.value*=-1)),p.normalMap&&(g.normalMap.value=p.normalMap,e(p.normalMap,g.normalMapTransform),g.normalScale.value.copy(p.normalScale),p.side===Ve&&g.normalScale.value.negate()),p.displacementMap&&(g.displacementMap.value=p.displacementMap,e(p.displacementMap,g.displacementMapTransform),g.displacementScale.value=p.displacementScale,g.displacementBias.value=p.displacementBias),p.emissiveMap&&(g.emissiveMap.value=p.emissiveMap,e(p.emissiveMap,g.emissiveMapTransform)),p.specularMap&&(g.specularMap.value=p.specularMap,e(p.specularMap,g.specularMapTransform)),p.alphaTest>0&&(g.alphaTest.value=p.alphaTest);const y=t.get(p),v=y.envMap,x=y.envMapRotation;v&&(g.envMap.value=v,hi.copy(x),hi.x*=-1,hi.y*=-1,hi.z*=-1,v.isCubeTexture&&v.isRenderTargetTexture===!1&&(hi.y*=-1,hi.z*=-1),g.envMapRotation.value.setFromMatrix4(tv.makeRotationFromEuler(hi)),g.flipEnvMap.value=v.isCubeTexture&&v.isRenderTargetTexture===!1?-1:1,g.reflectivity.value=p.reflectivity,g.ior.value=p.ior,g.refractionRatio.value=p.refractionRatio),p.lightMap&&(g.lightMap.value=p.lightMap,g.lightMapIntensity.value=p.lightMapIntensity,e(p.lightMap,g.lightMapTransform)),p.aoMap&&(g.aoMap.value=p.aoMap,g.aoMapIntensity.value=p.aoMapIntensity,e(p.aoMap,g.aoMapTransform))}function a(g,p){g.diffuse.value.copy(p.color),g.opacity.value=p.opacity,p.map&&(g.map.value=p.map,e(p.map,g.mapTransform))}function o(g,p){g.dashSize.value=p.dashSize,g.totalSize.value=p.dashSize+p.gapSize,g.scale.value=p.scale}function l(g,p,y,v){g.diffuse.value.copy(p.color),g.opacity.value=p.opacity,g.size.value=p.size*y,g.scale.value=v*.5,p.map&&(g.map.value=p.map,e(p.map,g.uvTransform)),p.alphaMap&&(g.alphaMap.value=p.alphaMap,e(p.alphaMap,g.alphaMapTransform)),p.alphaTest>0&&(g.alphaTest.value=p.alphaTest)}function c(g,p){g.diffuse.value.copy(p.color),g.opacity.value=p.opacity,g.rotation.value=p.rotation,p.map&&(g.map.value=p.map,e(p.map,g.mapTransform)),p.alphaMap&&(g.alphaMap.value=p.alphaMap,e(p.alphaMap,g.alphaMapTransform)),p.alphaTest>0&&(g.alphaTest.value=p.alphaTest)}function h(g,p){g.specular.value.copy(p.specular),g.shininess.value=Math.max(p.shininess,1e-4)}function u(g,p){p.gradientMap&&(g.gradientMap.value=p.gradientMap)}function d(g,p){g.metalness.value=p.metalness,p.metalnessMap&&(g.metalnessMap.value=p.metalnessMap,e(p.metalnessMap,g.metalnessMapTransform)),g.roughness.value=p.roughness,p.roughnessMap&&(g.roughnessMap.value=p.roughnessMap,e(p.roughnessMap,g.roughnessMapTransform)),p.envMap&&(g.envMapIntensity.value=p.envMapIntensity)}function f(g,p,y){g.ior.value=p.ior,p.sheen>0&&(g.sheenColor.value.copy(p.sheenColor).multiplyScalar(p.sheen),g.sheenRoughness.value=p.sheenRoughness,p.sheenColorMap&&(g.sheenColorMap.value=p.sheenColorMap,e(p.sheenColorMap,g.sheenColorMapTransform)),p.sheenRoughnessMap&&(g.sheenRoughnessMap.value=p.sheenRoughnessMap,e(p.sheenRoughnessMap,g.sheenRoughnessMapTransform))),p.clearcoat>0&&(g.clearcoat.value=p.clearcoat,g.clearcoatRoughness.value=p.clearcoatRoughness,p.clearcoatMap&&(g.clearcoatMap.value=p.clearcoatMap,e(p.clearcoatMap,g.clearcoatMapTransform)),p.clearcoatRoughnessMap&&(g.clearcoatRoughnessMap.value=p.clearcoatRoughnessMap,e(p.clearcoatRoughnessMap,g.clearcoatRoughnessMapTransform)),p.clearcoatNormalMap&&(g.clearcoatNormalMap.value=p.clearcoatNormalMap,e(p.clearcoatNormalMap,g.clearcoatNormalMapTransform),g.clearcoatNormalScale.value.copy(p.clearcoatNormalScale),p.side===Ve&&g.clearcoatNormalScale.value.negate())),p.dispersion>0&&(g.dispersion.value=p.dispersion),p.iridescence>0&&(g.iridescence.value=p.iridescence,g.iridescenceIOR.value=p.iridescenceIOR,g.iridescenceThicknessMinimum.value=p.iridescenceThicknessRange[0],g.iridescenceThicknessMaximum.value=p.iridescenceThicknessRange[1],p.iridescenceMap&&(g.iridescenceMap.value=p.iridescenceMap,e(p.iridescenceMap,g.iridescenceMapTransform)),p.iridescenceThicknessMap&&(g.iridescenceThicknessMap.value=p.iridescenceThicknessMap,e(p.iridescenceThicknessMap,g.iridescenceThicknessMapTransform))),p.transmission>0&&(g.transmission.value=p.transmission,g.transmissionSamplerMap.value=y.texture,g.transmissionSamplerSize.value.set(y.width,y.height),p.transmissionMap&&(g.transmissionMap.value=p.transmissionMap,e(p.transmissionMap,g.transmissionMapTransform)),g.thickness.value=p.thickness,p.thicknessMap&&(g.thicknessMap.value=p.thicknessMap,e(p.thicknessMap,g.thicknessMapTransform)),g.attenuationDistance.value=p.attenuationDistance,g.attenuationColor.value.copy(p.attenuationColor)),p.anisotropy>0&&(g.anisotropyVector.value.set(p.anisotropy*Math.cos(p.anisotropyRotation),p.anisotropy*Math.sin(p.anisotropyRotation)),p.anisotropyMap&&(g.anisotropyMap.value=p.anisotropyMap,e(p.anisotropyMap,g.anisotropyMapTransform))),g.specularIntensity.value=p.specularIntensity,g.specularColor.value.copy(p.specularColor),p.specularColorMap&&(g.specularColorMap.value=p.specularColorMap,e(p.specularColorMap,g.specularColorMapTransform)),p.specularIntensityMap&&(g.specularIntensityMap.value=p.specularIntensityMap,e(p.specularIntensityMap,g.specularIntensityMapTransform))}function m(g,p){p.matcap&&(g.matcap.value=p.matcap)}function _(g,p){const y=t.get(p).light;g.referencePosition.value.setFromMatrixPosition(y.matrixWorld),g.nearDistance.value=y.shadow.camera.near,g.farDistance.value=y.shadow.camera.far}return{refreshFogUniforms:n,refreshMaterialUniforms:i}}function nv(r,t,e,n){let i={},s={},a=[];const o=r.getParameter(r.MAX_UNIFORM_BUFFER_BINDINGS);function l(y,v){const x=v.program;n.uniformBlockBinding(y,x)}function c(y,v){let x=i[y.id];x===void 0&&(m(y),x=h(y),i[y.id]=x,y.addEventListener("dispose",g));const A=v.program;n.updateUBOMapping(y,A);const T=t.render.frame;s[y.id]!==T&&(d(y),s[y.id]=T)}function h(y){const v=u();y.__bindingPointIndex=v;const x=r.createBuffer(),A=y.__size,T=y.usage;return r.bindBuffer(r.UNIFORM_BUFFER,x),r.bufferData(r.UNIFORM_BUFFER,A,T),r.bindBuffer(r.UNIFORM_BUFFER,null),r.bindBufferBase(r.UNIFORM_BUFFER,v,x),x}function u(){for(let y=0;y<o;y++)if(a.indexOf(y)===-1)return a.push(y),y;return console.error("THREE.WebGLRenderer: Maximum number of simultaneously usable uniforms groups reached."),0}function d(y){const v=i[y.id],x=y.uniforms,A=y.__cache;r.bindBuffer(r.UNIFORM_BUFFER,v);for(let T=0,R=x.length;T<R;T++){const P=Array.isArray(x[T])?x[T]:[x[T]];for(let b=0,S=P.length;b<S;b++){const I=P[b];if(f(I,T,b,A)===!0){const B=I.__offset,k=Array.isArray(I.value)?I.value:[I.value];let V=0;for(let Z=0;Z<k.length;Z++){const W=k[Z],nt=_(W);typeof W=="number"||typeof W=="boolean"?(I.__data[0]=W,r.bufferSubData(r.UNIFORM_BUFFER,B+V,I.__data)):W.isMatrix3?(I.__data[0]=W.elements[0],I.__data[1]=W.elements[1],I.__data[2]=W.elements[2],I.__data[3]=0,I.__data[4]=W.elements[3],I.__data[5]=W.elements[4],I.__data[6]=W.elements[5],I.__data[7]=0,I.__data[8]=W.elements[6],I.__data[9]=W.elements[7],I.__data[10]=W.elements[8],I.__data[11]=0):(W.toArray(I.__data,V),V+=nt.storage/Float32Array.BYTES_PER_ELEMENT)}r.bufferSubData(r.UNIFORM_BUFFER,B,I.__data)}}}r.bindBuffer(r.UNIFORM_BUFFER,null)}function f(y,v,x,A){const T=y.value,R=v+"_"+x;if(A[R]===void 0)return typeof T=="number"||typeof T=="boolean"?A[R]=T:A[R]=T.clone(),!0;{const P=A[R];if(typeof T=="number"||typeof T=="boolean"){if(P!==T)return A[R]=T,!0}else if(P.equals(T)===!1)return P.copy(T),!0}return!1}function m(y){const v=y.uniforms;let x=0;const A=16;for(let R=0,P=v.length;R<P;R++){const b=Array.isArray(v[R])?v[R]:[v[R]];for(let S=0,I=b.length;S<I;S++){const B=b[S],k=Array.isArray(B.value)?B.value:[B.value];for(let V=0,Z=k.length;V<Z;V++){const W=k[V],nt=_(W),G=x%A,dt=G%nt.boundary,_t=G+dt;x+=dt,_t!==0&&A-_t<nt.storage&&(x+=A-_t),B.__data=new Float32Array(nt.storage/Float32Array.BYTES_PER_ELEMENT),B.__offset=x,x+=nt.storage}}}const T=x%A;return T>0&&(x+=A-T),y.__size=x,y.__cache={},this}function _(y){const v={boundary:0,storage:0};return typeof y=="number"||typeof y=="boolean"?(v.boundary=4,v.storage=4):y.isVector2?(v.boundary=8,v.storage=8):y.isVector3||y.isColor?(v.boundary=16,v.storage=12):y.isVector4?(v.boundary=16,v.storage=16):y.isMatrix3?(v.boundary=48,v.storage=48):y.isMatrix4?(v.boundary=64,v.storage=64):y.isTexture?console.warn("THREE.WebGLRenderer: Texture samplers can not be part of an uniforms group."):console.warn("THREE.WebGLRenderer: Unsupported uniform value type.",y),v}function g(y){const v=y.target;v.removeEventListener("dispose",g);const x=a.indexOf(v.__bindingPointIndex);a.splice(x,1),r.deleteBuffer(i[v.id]),delete i[v.id],delete s[v.id]}function p(){for(const y in i)r.deleteBuffer(i[y]);a=[],i={},s={}}return{bind:l,update:c,dispose:p}}class qy{constructor(t={}){const{canvas:e=Gd(),context:n=null,depth:i=!0,stencil:s=!1,alpha:a=!1,antialias:o=!1,premultipliedAlpha:l=!0,preserveDrawingBuffer:c=!1,powerPreference:h="default",failIfMajorPerformanceCaveat:u=!1,reversedDepthBuffer:d=!1}=t;this.isWebGLRenderer=!0;let f;if(n!==null){if(typeof WebGLRenderingContext<"u"&&n instanceof WebGLRenderingContext)throw new Error("THREE.WebGLRenderer: WebGL 1 is not supported since r163.");f=n.getContextAttributes().alpha}else f=a;const m=new Uint32Array(4),_=new Int32Array(4);let g=null,p=null;const y=[],v=[];this.domElement=e,this.debug={checkShaderErrors:!0,onShaderError:null},this.autoClear=!0,this.autoClearColor=!0,this.autoClearDepth=!0,this.autoClearStencil=!0,this.sortObjects=!0,this.clippingPlanes=[],this.localClippingEnabled=!1,this.toneMapping=Wn,this.toneMappingExposure=1,this.transmissionResolutionScale=1;const x=this;let A=!1;this._outputColorSpace=Ye;let T=0,R=0,P=null,b=-1,S=null;const I=new ne,B=new ne;let k=null;const V=new vt(0);let Z=0,W=e.width,nt=e.height,G=1,dt=null,_t=null;const bt=new ne(0,0,W,nt),Vt=new ne(0,0,W,nt);let Qt=!1;const jt=new qs;let q=!1,ft=!1;const lt=new zt,Lt=new C,Ct=new ne,Ft={background:null,fog:null,environment:null,overrideMaterial:null,isScene:!0};let ue=!1;function Ht(){return P===null?G:1}let L=n;function Q(E,U){return e.getContext(E,U)}try{const E={alpha:!0,depth:i,stencil:s,antialias:o,premultipliedAlpha:l,preserveDrawingBuffer:c,powerPreference:h,failIfMajorPerformanceCaveat:u};if("setAttribute"in e&&e.setAttribute("data-engine","three.js r179"),e.addEventListener("webglcontextlost",ut,!1),e.addEventListener("webglcontextrestored",Mt,!1),e.addEventListener("webglcontextcreationerror",st,!1),L===null){const U="webgl2";if(L=Q(U,E),L===null)throw Q(U)?new Error("Error creating WebGL context with your selected attributes."):new Error("Error creating WebGL context.")}}catch(E){throw console.error("THREE.WebGLRenderer: "+E.message),E}let Y,tt,J,ct,et,ht,Gt,kt,w,M,F,H,j,X,Rt,ot,Tt,At,it,xt,Ot,It,mt,Yt;
vendor: 11,112 bytes, line 3832
3832function D(){Y=new f0(L),Y.init(),It=new Jx(L,Y),tt=new a0(L,Y,t,It),J=new Yx(L,Y),tt.reversedDepthBuffer&&d&&J.buffers.depth.setReversed(!0),ct=new g0(L),et=new Ux,ht=new Zx(L,Y,J,et,tt,It,ct),Gt=new l0(x),kt=new d0(x),w=new Sm(L),mt=new s0(L,w),M=new p0(L,w,ct,mt),F=new x0(L,M,w,ct),it=new _0(L,tt,ht),ot=new o0(et),H=new Dx(x,Gt,kt,Y,tt,mt,ot),j=new ev(x,et),X=new Fx,Rt=new Hx(Y),At=new i0(x,Gt,kt,J,F,f,l),Tt=new Xx(x,F,tt),Yt=new nv(L,ct,tt,J),xt=new r0(L,Y,ct),Ot=new m0(L,Y,ct),ct.programs=H.programs,x.capabilities=tt,x.extensions=Y,x.properties=et,x.renderLists=X,x.shadowMap=Tt,x.state=J,x.info=ct}D();const at=new jx(x,L);this.xr=at,this.getContext=function(){return L},this.getContextAttributes=function(){return L.getContextAttributes()},this.forceContextLoss=function(){const E=Y.get("WEBGL_lose_context");E&&E.loseContext()},this.forceContextRestore=function(){const E=Y.get("WEBGL_lose_context");E&&E.restoreContext()},this.getPixelRatio=function(){return G},this.setPixelRatio=function(E){E!==void 0&&(G=E,this.setSize(W,nt,!1))},this.getSize=function(E){return E.set(W,nt)},this.setSize=function(E,U,O=!0){if(at.isPresenting){console.warn("THREE.WebGLRenderer: Can't change size while VR device is presenting.");return}W=E,nt=U,e.width=Math.floor(E*G),e.height=Math.floor(U*G),O===!0&&(e.style.width=E+"px",e.style.height=U+"px"),this.setViewport(0,0,E,U)},this.getDrawingBufferSize=function(E){return E.set(W*G,nt*G).floor()},this.setDrawingBufferSize=function(E,U,O){W=E,nt=U,G=O,e.width=Math.floor(E*O),e.height=Math.floor(U*O),this.setViewport(0,0,E,U)},this.getCurrentViewport=function(E){return E.copy(I)},this.getViewport=function(E){return E.copy(bt)},this.setViewport=function(E,U,O,z){E.isVector4?bt.set(E.x,E.y,E.z,E.w):bt.set(E,U,O,z),J.viewport(I.copy(bt).multiplyScalar(G).round())},this.getScissor=function(E){return E.copy(Vt)},this.setScissor=function(E,U,O,z){E.isVector4?Vt.set(E.x,E.y,E.z,E.w):Vt.set(E,U,O,z),J.scissor(B.copy(Vt).multiplyScalar(G).round())},this.getScissorTest=function(){return Qt},this.setScissorTest=function(E){J.setScissorTest(Qt=E)},this.setOpaqueSort=function(E){dt=E},this.setTransparentSort=function(E){_t=E},this.getClearColor=function(E){return E.copy(At.getClearColor())},this.setClearColor=function(){At.setClearColor(...arguments)},this.getClearAlpha=function(){return At.getClearAlpha()},this.setClearAlpha=function(){At.setClearAlpha(...arguments)},this.clear=function(E=!0,U=!0,O=!0){let z=0;if(E){let N=!1;if(P!==null){const rt=P.texture.format;N=rt===hl||rt===cl||rt===ha}if(N){const rt=P.texture.type,gt=rt===mn||rt===Yn||rt===Ds||rt===Us||rt===al||rt===ol,Et=At.getClearColor(),yt=At.getClearAlpha(),Ut=Et.r,Bt=Et.g,Pt=Et.b;gt?(m[0]=Ut,m[1]=Bt,m[2]=Pt,m[3]=yt,L.clearBufferuiv(L.COLOR,0,m)):(_[0]=Ut,_[1]=Bt,_[2]=Pt,_[3]=yt,L.clearBufferiv(L.COLOR,0,_))}else z|=L.COLOR_BUFFER_BIT}U&&(z|=L.DEPTH_BUFFER_BIT),O&&(z|=L.STENCIL_BUFFER_BIT,this.state.buffers.stencil.setMask(4294967295)),L.clear(z)},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(){e.removeEventListener("webglcontextlost",ut,!1),e.removeEventListener("webglcontextrestored",Mt,!1),e.removeEventListener("webglcontextcreationerror",st,!1),At.dispose(),X.dispose(),Rt.dispose(),et.dispose(),Gt.dispose(),kt.dispose(),F.dispose(),mt.dispose(),Yt.dispose(),H.dispose(),at.dispose(),at.removeEventListener("sessionstart",hn),at.removeEventListener("sessionend",Wl),Jn.stop()};function ut(E){E.preventDefault(),console.log("THREE.WebGLRenderer: Context Lost."),A=!0}function Mt(){console.log("THREE.WebGLRenderer: Context Restored."),A=!1;const E=ct.autoReset,U=Tt.enabled,O=Tt.autoUpdate,z=Tt.needsUpdate,N=Tt.type;D(),ct.autoReset=E,Tt.enabled=U,Tt.autoUpdate=O,Tt.needsUpdate=z,Tt.type=N}function st(E){console.error("THREE.WebGLRenderer: A WebGL context could not be created. Reason: ",E.statusMessage)}function $(E){const U=E.target;U.removeEventListener("dispose",$),wt(U)}function wt(E){Wt(E),et.remove(E)}function Wt(E){const U=et.get(E).programs;U!==void 0&&(U.forEach(function(O){H.releaseProgram(O)}),E.isShaderMaterial&&H.releaseShaderCache(E))}this.renderBufferDirect=function(E,U,O,z,N,rt){U===null&&(U=Ft);const gt=N.isMesh&&N.matrixWorld.determinant()<0,Et=Iu(E,U,O,z,N);J.setMaterial(z,gt);let yt=O.index,Ut=1;if(z.wireframe===!0){if(yt=M.getWireframeAttribute(O),yt===void 0)return;Ut=2}const Bt=O.drawRange,Pt=O.attributes.position;let $t=Bt.start*Ut,re=(Bt.start+Bt.count)*Ut;rt!==null&&($t=Math.max($t,rt.start*Ut),re=Math.min(re,(rt.start+rt.count)*Ut)),yt!==null?($t=Math.max($t,0),re=Math.min(re,yt.count)):Pt!=null&&($t=Math.max($t,0),re=Math.min(re,Pt.count));const me=re-$t;if(me<0||me===1/0)return;mt.setup(N,z,Et,O,yt);let he,oe=xt;if(yt!==null&&(he=w.get(yt),oe=Ot,oe.setIndex(he)),N.isMesh)z.wireframe===!0?(J.setLineWidth(z.wireframeLinewidth*Ht()),oe.setMode(L.LINES)):oe.setMode(L.TRIANGLES);else if(N.isLine){let Dt=z.linewidth;Dt===void 0&&(Dt=1),J.setLineWidth(Dt*Ht()),N.isLineSegments?oe.setMode(L.LINES):N.isLineLoop?oe.setMode(L.LINE_LOOP):oe.setMode(L.LINE_STRIP)}else N.isPoints?oe.setMode(L.POINTS):N.isSprite&&oe.setMode(L.TRIANGLES);if(N.isBatchedMesh)if(N._multiDrawInstances!==null)ji("THREE.WebGLRenderer: renderMultiDrawInstances has been deprecated and will be removed in r184. Append to renderMultiDraw arguments and use indirection."),oe.renderMultiDrawInstances(N._multiDrawStarts,N._multiDrawCounts,N._multiDrawCount,N._multiDrawInstances);else if(Y.get("WEBGL_multi_draw"))oe.renderMultiDraw(N._multiDrawStarts,N._multiDrawCounts,N._multiDrawCount);else{const Dt=N._multiDrawStarts,de=N._multiDrawCounts,te=N._multiDrawCount,Ge=yt?w.get(yt).bytesPerElement:1,Ti=et.get(z).currentProgram.getUniforms();for(let We=0;We<te;We++)Ti.setValue(L,"_gl_DrawID",We),oe.render(Dt[We]/Ge,de[We])}else if(N.isInstancedMesh)oe.renderInstances($t,me,N.count);else if(O.isInstancedBufferGeometry){const Dt=O._maxInstanceCount!==void 0?O._maxInstanceCount:1/0,de=Math.min(O.instanceCount,Dt);oe.renderInstances($t,me,de)}else oe.render($t,me)};function ce(E,U,O){E.transparent===!0&&E.side===An&&E.forceSinglePass===!1?(E.side=Ve,E.needsUpdate=!0,Js(E,U,O),E.side=Xn,E.needsUpdate=!0,Js(E,U,O),E.side=An):Js(E,U,O)}this.compile=function(E,U,O=null){O===null&&(O=E),p=Rt.get(O),p.init(U),v.push(p),O.traverseVisible(function(N){N.isLight&&N.layers.test(U.layers)&&(p.pushLight(N),N.castShadow&&p.pushShadow(N))}),E!==O&&E.traverseVisible(function(N){N.isLight&&N.layers.test(U.layers)&&(p.pushLight(N),N.castShadow&&p.pushShadow(N))}),p.setupLights();const z=new Set;return E.traverse(function(N){if(!(N.isMesh||N.isPoints||N.isLine||N.isSprite))return;const rt=N.material;if(rt)if(Array.isArray(rt))for(let gt=0;gt<rt.length;gt++){const Et=rt[gt];ce(Et,O,N),z.add(Et)}else ce(rt,O,N),z.add(rt)}),p=v.pop(),z},this.compileAsync=function(E,U,O=null){const z=this.compile(E,U,O);return new Promise(N=>{function rt(){if(z.forEach(function(gt){et.get(gt).currentProgram.isReady()&&z.delete(gt)}),z.size===0){N(E);return}setTimeout(rt,10)}Y.get("KHR_parallel_shader_compile")!==null?rt():setTimeout(rt,10)})};let se=null;function xn(E){se&&se(E)}function hn(){Jn.stop()}function Wl(){Jn.start()}const Jn=new Eu;Jn.setAnimationLoop(xn),typeof self<"u"&&Jn.setContext(self),this.setAnimationLoop=function(E){se=E,at.setAnimationLoop(E),E===null?Jn.stop():Jn.start()},at.addEventListener("sessionstart",hn),at.addEventListener("sessionend",Wl),this.render=function(E,U){if(U!==void 0&&U.isCamera!==!0){console.error("THREE.WebGLRenderer.render: camera is not an instance of THREE.Camera.");return}if(A===!0)return;if(E.matrixWorldAutoUpdate===!0&&E.updateMatrixWorld(),U.parent===null&&U.matrixWorldAutoUpdate===!0&&U.updateMatrixWorld(),at.enabled===!0&&at.isPresenting===!0&&(at.cameraAutoUpdate===!0&&at.updateCamera(U),U=at.getCamera()),E.isScene===!0&&E.onBeforeRender(x,E,U,P),p=Rt.get(E,v.length),p.init(U),v.push(p),lt.multiplyMatrices(U.projectionMatrix,U.matrixWorldInverse),jt.setFromProjectionMatrix(lt,nn,U.reversedDepth),ft=this.localClippingEnabled,q=ot.init(this.clippingPlanes,ft),g=X.get(E,y.length),g.init(),y.push(g),at.enabled===!0&&at.isPresenting===!0){const rt=x.xr.getDepthSensingMesh();rt!==null&&va(rt,U,-1/0,x.sortObjects)}va(E,U,0,x.sortObjects),g.finish(),x.sortObjects===!0&&g.sort(dt,_t),ue=at.enabled===!1||at.isPresenting===!1||at.hasDepthSensing()===!1,ue&&At.addToRenderList(g,E),this.info.render.frame++,q===!0&&ot.beginShadows();const O=p.state.shadowsArray;Tt.render(O,E,U),q===!0&&ot.endShadows(),this.info.autoReset===!0&&this.info.reset();const z=g.opaque,N=g.transmissive;if(p.setupLights(),U.isArrayCamera){const rt=U.cameras;if(N.length>0)for(let gt=0,Et=rt.length;gt<Et;gt++){const yt=rt[gt];ql(z,N,E,yt)}ue&&At.render(E);for(let gt=0,Et=rt.length;gt<Et;gt++){const yt=rt[gt];Xl(g,E,yt,yt.viewport)}}else N.length>0&&ql(z,N,E,U),ue&&At.render(E),Xl(g,E,U);P!==null&&R===0&&(ht.updateMultisampleRenderTarget(P),ht.updateRenderTargetMipmap(P)),E.isScene===!0&&E.onAfterRender(x,E,U),mt.resetDefaultState(),b=-1,S=null,v.pop(),v.length>0?(p=v[v.length-1],q===!0&&ot.setGlobalState(x.clippingPlanes,p.state.camera)):p=null,y.pop(),y.length>0?g=y[y.length-1]:g=null};function va(E,U,O,z){if(E.visible===!1)return;if(E.layers.test(U.layers)){if(E.isGroup)O=E.renderOrder;else if(E.isLOD)E.autoUpdate===!0&&E.update(U);else if(E.isLight)p.pushLight(E),E.castShadow&&p.pushShadow(E);else if(E.isSprite){if(!E.frustumCulled||jt.intersectsSprite(E)){z&&Ct.setFromMatrixPosition(E.matrixWorld).applyMatrix4(lt);const gt=F.update(E),Et=E.material;Et.visible&&g.push(E,gt,Et,O,Ct.z,null)}}else if((E.isMesh||E.isLine||E.isPoints)&&(!E.frustumCulled||jt.intersectsObject(E))){const gt=F.update(E),Et=E.material;if(z&&(E.boundingSphere!==void 0?(E.boundingSphere===null&&E.computeBoundingSphere(),Ct.copy(E.boundingSphere.center)):(gt.boundingSphere===null&&gt.computeBoundingSphere(),Ct.copy(gt.boundingSphere.center)),Ct.applyMatrix4(E.matrixWorld).applyMatrix4(lt)),Array.isArray(Et)){const yt=gt.groups;for(let Ut=0,Bt=yt.length;Ut<Bt;Ut++){const Pt=yt[Ut],$t=Et[Pt.materialIndex];$t&&$t.visible&&g.push(E,gt,$t,O,Ct.z,Pt)}}else Et.visible&&g.push(E,gt,Et,O,Ct.z,null)}}const rt=E.children;for(let gt=0,Et=rt.length;gt<Et;gt++)va(rt[gt],U,O,z)}function Xl(E,U,O,z){const N=E.opaque,rt=E.transmissive,gt=E.transparent;p.setupLightsView(O),q===!0&&ot.setGlobalState(x.clippingPlanes,O),z&&J.viewport(I.copy(z)),N.length>0&&Zs(N,U,O),rt.length>0&&Zs(rt,U,O),gt.length>0&&Zs(gt,U,O),J.buffers.depth.setTest(!0),J.buffers.depth.setMask(!0),J.buffers.color.setMask(!0),J.setPolygonOffset(!1)}function ql(E,U,O,z){if((O.isScene===!0?O.overrideMaterial:null)!==null)return;p.state.transmissionRenderTarget[z.id]===void 0&&(p.state.transmissionRenderTarget[z.id]=new Ln(1,1,{generateMipmaps:!0,type:Y.has("EXT_color_buffer_half_float")||Y.has("EXT_color_buffer_float")?Ws:mn,minFilter:Cn,samples:4,stencilBuffer:s,resolveDepthBuffer:!1,resolveStencilBuffer:!1,colorSpace:Kt.workingColorSpace}));
vendor: 18,446 bytes, line 3832
3832const rt=p.state.transmissionRenderTarget[z.id],gt=z.viewport||I;rt.setSize(gt.z*x.transmissionResolutionScale,gt.w*x.transmissionResolutionScale);const Et=x.getRenderTarget(),yt=x.getActiveCubeFace(),Ut=x.getActiveMipmapLevel();x.setRenderTarget(rt),x.getClearColor(V),Z=x.getClearAlpha(),Z<1&&x.setClearColor(16777215,.5),x.clear(),ue&&At.render(O);const Bt=x.toneMapping;x.toneMapping=Wn;const Pt=z.viewport;if(z.viewport!==void 0&&(z.viewport=void 0),p.setupLightsView(z),q===!0&&ot.setGlobalState(x.clippingPlanes,z),Zs(E,O,z),ht.updateMultisampleRenderTarget(rt),ht.updateRenderTargetMipmap(rt),Y.has("WEBGL_multisampled_render_to_texture")===!1){let $t=!1;for(let re=0,me=U.length;re<me;re++){const he=U[re],oe=he.object,Dt=he.geometry,de=he.material,te=he.group;if(de.side===An&&oe.layers.test(z.layers)){const Ge=de.side;de.side=Ve,de.needsUpdate=!0,Yl(oe,O,z,Dt,de,te),de.side=Ge,de.needsUpdate=!0,$t=!0}}$t===!0&&(ht.updateMultisampleRenderTarget(rt),ht.updateRenderTargetMipmap(rt))}x.setRenderTarget(Et,yt,Ut),x.setClearColor(V,Z),Pt!==void 0&&(z.viewport=Pt),x.toneMapping=Bt}function Zs(E,U,O){const z=U.isScene===!0?U.overrideMaterial:null;for(let N=0,rt=E.length;N<rt;N++){const gt=E[N],Et=gt.object,yt=gt.geometry,Ut=gt.group;let Bt=gt.material;Bt.allowOverride===!0&&z!==null&&(Bt=z),Et.layers.test(O.layers)&&Yl(Et,U,O,yt,Bt,Ut)}}function Yl(E,U,O,z,N,rt){E.onBeforeRender(x,U,O,z,N,rt),E.modelViewMatrix.multiplyMatrices(O.matrixWorldInverse,E.matrixWorld),E.normalMatrix.getNormalMatrix(E.modelViewMatrix),N.onBeforeRender(x,U,O,z,E,rt),N.transparent===!0&&N.side===An&&N.forceSinglePass===!1?(N.side=Ve,N.needsUpdate=!0,x.renderBufferDirect(O,U,z,N,E,rt),N.side=Xn,N.needsUpdate=!0,x.renderBufferDirect(O,U,z,N,E,rt),N.side=An):x.renderBufferDirect(O,U,z,N,E,rt),E.onAfterRender(x,U,O,z,N,rt)}function Js(E,U,O){U.isScene!==!0&&(U=Ft);const z=et.get(E),N=p.state.lights,rt=p.state.shadowsArray,gt=N.state.version,Et=H.getParameters(E,N.state,rt,U,O),yt=H.getProgramCacheKey(Et);let Ut=z.programs;z.environment=E.isMeshStandardMaterial?U.environment:null,z.fog=U.fog,z.envMap=(E.isMeshStandardMaterial?kt:Gt).get(E.envMap||z.environment),z.envMapRotation=z.environment!==null&&E.envMap===null?U.environmentRotation:E.envMapRotation,Ut===void 0&&(E.addEventListener("dispose",$),Ut=new Map,z.programs=Ut);let Bt=Ut.get(yt);if(Bt!==void 0){if(z.currentProgram===Bt&&z.lightsStateVersion===gt)return Jl(E,Et),Bt}else Et.uniforms=H.getUniforms(E),E.onBeforeCompile(Et,x),Bt=H.acquireProgram(Et,yt),Ut.set(yt,Bt),z.uniforms=Et.uniforms;const Pt=z.uniforms;return(!E.isShaderMaterial&&!E.isRawShaderMaterial||E.clipping===!0)&&(Pt.clippingPlanes=ot.uniform),Jl(E,Et),z.needsLights=Lu(E),z.lightsStateVersion=gt,z.needsLights&&(Pt.ambientLightColor.value=N.state.ambient,Pt.lightProbe.value=N.state.probe,Pt.directionalLights.value=N.state.directional,Pt.directionalLightShadows.value=N.state.directionalShadow,Pt.spotLights.value=N.state.spot,Pt.spotLightShadows.value=N.state.spotShadow,Pt.rectAreaLights.value=N.state.rectArea,Pt.ltc_1.value=N.state.rectAreaLTC1,Pt.ltc_2.value=N.state.rectAreaLTC2,Pt.pointLights.value=N.state.point,Pt.pointLightShadows.value=N.state.pointShadow,Pt.hemisphereLights.value=N.state.hemi,Pt.directionalShadowMap.value=N.state.directionalShadowMap,Pt.directionalShadowMatrix.value=N.state.directionalShadowMatrix,Pt.spotShadowMap.value=N.state.spotShadowMap,Pt.spotLightMatrix.value=N.state.spotLightMatrix,Pt.spotLightMap.value=N.state.spotLightMap,Pt.pointShadowMap.value=N.state.pointShadowMap,Pt.pointShadowMatrix.value=N.state.pointShadowMatrix),z.currentProgram=Bt,z.uniformsList=null,Bt}function Zl(E){if(E.uniformsList===null){const U=E.currentProgram.getUniforms();E.uniformsList=Yr.seqWithValue(U.seq,E.uniforms)}return E.uniformsList}function Jl(E,U){const O=et.get(E);O.outputColorSpace=U.outputColorSpace,O.batching=U.batching,O.batchingColor=U.batchingColor,O.instancing=U.instancing,O.instancingColor=U.instancingColor,O.instancingMorph=U.instancingMorph,O.skinning=U.skinning,O.morphTargets=U.morphTargets,O.morphNormals=U.morphNormals,O.morphColors=U.morphColors,O.morphTargetsCount=U.morphTargetsCount,O.numClippingPlanes=U.numClippingPlanes,O.numIntersection=U.numClipIntersection,O.vertexAlphas=U.vertexAlphas,O.vertexTangents=U.vertexTangents,O.toneMapping=U.toneMapping}function Iu(E,U,O,z,N){U.isScene!==!0&&(U=Ft),ht.resetTextureUnits();const rt=U.fog,gt=z.isMeshStandardMaterial?U.environment:null,Et=P===null?x.outputColorSpace:P.isXRRenderTarget===!0?P.texture.colorSpace:is,yt=(z.isMeshStandardMaterial?kt:Gt).get(z.envMap||gt),Ut=z.vertexColors===!0&&!!O.attributes.color&&O.attributes.color.itemSize===4,Bt=!!O.attributes.tangent&&(!!z.normalMap||z.anisotropy>0),Pt=!!O.morphAttributes.position,$t=!!O.morphAttributes.normal,re=!!O.morphAttributes.color;let me=Wn;z.toneMapped&&(P===null||P.isXRRenderTarget===!0)&&(me=x.toneMapping);const he=O.morphAttributes.position||O.morphAttributes.normal||O.morphAttributes.color,oe=he!==void 0?he.length:0,Dt=et.get(z),de=p.state.lights;if(q===!0&&(ft===!0||E!==S)){const Pe=E===S&&z.id===b;ot.setState(z,E,Pe)}let te=!1;z.version===Dt.__version?(Dt.needsLights&&Dt.lightsStateVersion!==de.state.version||Dt.outputColorSpace!==Et||N.isBatchedMesh&&Dt.batching===!1||!N.isBatchedMesh&&Dt.batching===!0||N.isBatchedMesh&&Dt.batchingColor===!0&&N.colorTexture===null||N.isBatchedMesh&&Dt.batchingColor===!1&&N.colorTexture!==null||N.isInstancedMesh&&Dt.instancing===!1||!N.isInstancedMesh&&Dt.instancing===!0||N.isSkinnedMesh&&Dt.skinning===!1||!N.isSkinnedMesh&&Dt.skinning===!0||N.isInstancedMesh&&Dt.instancingColor===!0&&N.instanceColor===null||N.isInstancedMesh&&Dt.instancingColor===!1&&N.instanceColor!==null||N.isInstancedMesh&&Dt.instancingMorph===!0&&N.morphTexture===null||N.isInstancedMesh&&Dt.instancingMorph===!1&&N.morphTexture!==null||Dt.envMap!==yt||z.fog===!0&&Dt.fog!==rt||Dt.numClippingPlanes!==void 0&&(Dt.numClippingPlanes!==ot.numPlanes||Dt.numIntersection!==ot.numIntersection)||Dt.vertexAlphas!==Ut||Dt.vertexTangents!==Bt||Dt.morphTargets!==Pt||Dt.morphNormals!==$t||Dt.morphColors!==re||Dt.toneMapping!==me||Dt.morphTargetsCount!==oe)&&(te=!0):(te=!0,Dt.__version=z.version);let Ge=Dt.currentProgram;te===!0&&(Ge=Js(z,U,N));let Ti=!1,We=!1,ds=!1;const fe=Ge.getUniforms(),je=Dt.uniforms;if(J.useProgram(Ge.program)&&(Ti=!0,We=!0,ds=!0),z.id!==b&&(b=z.id,We=!0),Ti||S!==E){J.buffers.depth.getReversed()&&E.reversedDepth!==!0&&(E._reversedDepth=!0,E.updateProjectionMatrix()),fe.setValue(L,"projectionMatrix",E.projectionMatrix),fe.setValue(L,"viewMatrix",E.matrixWorldInverse);const Oe=fe.map.cameraPosition;Oe!==void 0&&Oe.setValue(L,Lt.setFromMatrixPosition(E.matrixWorld)),tt.logarithmicDepthBuffer&&fe.setValue(L,"logDepthBufFC",2/(Math.log(E.far+1)/Math.LN2)),(z.isMeshPhongMaterial||z.isMeshToonMaterial||z.isMeshLambertMaterial||z.isMeshBasicMaterial||z.isMeshStandardMaterial||z.isShaderMaterial)&&fe.setValue(L,"isOrthographic",E.isOrthographicCamera===!0),S!==E&&(S=E,We=!0,ds=!0)}if(N.isSkinnedMesh){fe.setOptional(L,N,"bindMatrix"),fe.setOptional(L,N,"bindMatrixInverse");const Pe=N.skeleton;Pe&&(Pe.boneTexture===null&&Pe.computeBoneTexture(),fe.setValue(L,"boneTexture",Pe.boneTexture,ht))}N.isBatchedMesh&&(fe.setOptional(L,N,"batchingTexture"),fe.setValue(L,"batchingTexture",N._matricesTexture,ht),fe.setOptional(L,N,"batchingIdTexture"),fe.setValue(L,"batchingIdTexture",N._indirectTexture,ht),fe.setOptional(L,N,"batchingColorTexture"),N._colorsTexture!==null&&fe.setValue(L,"batchingColorTexture",N._colorsTexture,ht));const tn=O.morphAttributes;if((tn.position!==void 0||tn.normal!==void 0||tn.color!==void 0)&&it.update(N,O,Ge),(We||Dt.receiveShadow!==N.receiveShadow)&&(Dt.receiveShadow=N.receiveShadow,fe.setValue(L,"receiveShadow",N.receiveShadow)),z.isMeshGouraudMaterial&&z.envMap!==null&&(je.envMap.value=yt,je.flipEnvMap.value=yt.isCubeTexture&&yt.isRenderTargetTexture===!1?-1:1),z.isMeshStandardMaterial&&z.envMap===null&&U.environment!==null&&(je.envMapIntensity.value=U.environmentIntensity),We&&(fe.setValue(L,"toneMappingExposure",x.toneMappingExposure),Dt.needsLights&&Pu(je,ds),rt&&z.fog===!0&&j.refreshFogUniforms(je,rt),j.refreshMaterialUniforms(je,z,G,nt,p.state.transmissionRenderTarget[E.id]),Yr.upload(L,Zl(Dt),je,ht)),z.isShaderMaterial&&z.uniformsNeedUpdate===!0&&(Yr.upload(L,Zl(Dt),je,ht),z.uniformsNeedUpdate=!1),z.isSpriteMaterial&&fe.setValue(L,"center",N.center),fe.setValue(L,"modelViewMatrix",N.modelViewMatrix),fe.setValue(L,"normalMatrix",N.normalMatrix),fe.setValue(L,"modelMatrix",N.matrixWorld),z.isShaderMaterial||z.isRawShaderMaterial){const Pe=z.uniformsGroups;for(let Oe=0,ya=Pe.length;Oe<ya;Oe++){const $n=Pe[Oe];Yt.update($n,Ge),Yt.bind($n,Ge)}}return Ge}function Pu(E,U){E.ambientLightColor.needsUpdate=U,E.lightProbe.needsUpdate=U,E.directionalLights.needsUpdate=U,E.directionalLightShadows.needsUpdate=U,E.pointLights.needsUpdate=U,E.pointLightShadows.needsUpdate=U,E.spotLights.needsUpdate=U,E.spotLightShadows.needsUpdate=U,E.rectAreaLights.needsUpdate=U,E.hemisphereLights.needsUpdate=U}function Lu(E){return E.isMeshLambertMaterial||E.isMeshToonMaterial||E.isMeshPhongMaterial||E.isMeshStandardMaterial||E.isShadowMaterial||E.isShaderMaterial&&E.lights===!0}this.getActiveCubeFace=function(){return T},this.getActiveMipmapLevel=function(){return R},this.getRenderTarget=function(){return P},this.setRenderTargetTextures=function(E,U,O){const z=et.get(E);z.__autoAllocateDepthBuffer=E.resolveDepthBuffer===!1,z.__autoAllocateDepthBuffer===!1&&(z.__useRenderToTexture=!1),et.get(E.texture).__webglTexture=U,et.get(E.depthTexture).__webglTexture=z.__autoAllocateDepthBuffer?void 0:O,z.__hasExternalTextures=!0},this.setRenderTargetFramebuffer=function(E,U){const O=et.get(E);O.__webglFramebuffer=U,O.__useDefaultFramebuffer=U===void 0};const Du=L.createFramebuffer();this.setRenderTarget=function(E,U=0,O=0){P=E,T=U,R=O;let z=!0,N=null,rt=!1,gt=!1;if(E){const yt=et.get(E);if(yt.__useDefaultFramebuffer!==void 0)J.bindFramebuffer(L.FRAMEBUFFER,null),z=!1;else if(yt.__webglFramebuffer===void 0)ht.setupRenderTarget(E);else if(yt.__hasExternalTextures)ht.rebindTextures(E,et.get(E.texture).__webglTexture,et.get(E.depthTexture).__webglTexture);else if(E.depthBuffer){const Pt=E.depthTexture;if(yt.__boundDepthTexture!==Pt){if(Pt!==null&&et.has(Pt)&&(E.width!==Pt.image.width||E.height!==Pt.image.height))throw new Error("WebGLRenderTarget: Attached DepthTexture is initialized to the incorrect size.");ht.setupDepthRenderbuffer(E)}}const Ut=E.texture;(Ut.isData3DTexture||Ut.isDataArrayTexture||Ut.isCompressedArrayTexture)&&(gt=!0);const Bt=et.get(E).__webglFramebuffer;E.isWebGLCubeRenderTarget?(Array.isArray(Bt[U])?N=Bt[U][O]:N=Bt[U],rt=!0):E.samples>0&&ht.useMultisampledRTT(E)===!1?N=et.get(E).__webglMultisampledFramebuffer:Array.isArray(Bt)?N=Bt[O]:N=Bt,I.copy(E.viewport),B.copy(E.scissor),k=E.scissorTest}else I.copy(bt).multiplyScalar(G).floor(),B.copy(Vt).multiplyScalar(G).floor(),k=Qt;if(O!==0&&(N=Du),J.bindFramebuffer(L.FRAMEBUFFER,N)&&z&&J.drawBuffers(E,N),J.viewport(I),J.scissor(B),J.setScissorTest(k),rt){const yt=et.get(E.texture);L.framebufferTexture2D(L.FRAMEBUFFER,L.COLOR_ATTACHMENT0,L.TEXTURE_CUBE_MAP_POSITIVE_X+U,yt.__webglTexture,O)}else if(gt){const yt=U;for(let Ut=0;Ut<E.textures.length;Ut++){const Bt=et.get(E.textures[Ut]);L.framebufferTextureLayer(L.FRAMEBUFFER,L.COLOR_ATTACHMENT0+Ut,Bt.__webglTexture,O,yt)}}else if(E!==null&&O!==0){const yt=et.get(E.texture);L.framebufferTexture2D(L.FRAMEBUFFER,L.COLOR_ATTACHMENT0,L.TEXTURE_2D,yt.__webglTexture,O)}b=-1},this.readRenderTargetPixels=function(E,U,O,z,N,rt,gt,Et=0){if(!(E&&E.isWebGLRenderTarget)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");return}let yt=et.get(E).__webglFramebuffer;if(E.isWebGLCubeRenderTarget&&gt!==void 0&&(yt=yt[gt]),yt){J.bindFramebuffer(L.FRAMEBUFFER,yt);try{const Ut=E.textures[Et],Bt=Ut.format,Pt=Ut.type;if(!tt.textureFormatReadable(Bt)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.");return}if(!tt.textureTypeReadable(Pt)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.");return}U>=0&&U<=E.width-z&&O>=0&&O<=E.height-N&&(E.textures.length>1&&L.readBuffer(L.COLOR_ATTACHMENT0+Et),L.readPixels(U,O,z,N,It.convert(Bt),It.convert(Pt),rt))}finally{const Ut=P!==null?et.get(P).__webglFramebuffer:null;J.bindFramebuffer(L.FRAMEBUFFER,Ut)}}},this.readRenderTargetPixelsAsync=async function(E,U,O,z,N,rt,gt,Et=0){if(!(E&&E.isWebGLRenderTarget))throw new Error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");let yt=et.get(E).__webglFramebuffer;if(E.isWebGLCubeRenderTarget&&gt!==void 0&&(yt=yt[gt]),yt)if(U>=0&&U<=E.width-z&&O>=0&&O<=E.height-N){J.bindFramebuffer(L.FRAMEBUFFER,yt);const Ut=E.textures[Et],Bt=Ut.format,Pt=Ut.type;if(!tt.textureFormatReadable(Bt))throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in RGBA or implementation defined format.");if(!tt.textureTypeReadable(Pt))throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in UnsignedByteType or implementation defined type.");const $t=L.createBuffer();L.bindBuffer(L.PIXEL_PACK_BUFFER,$t),L.bufferData(L.PIXEL_PACK_BUFFER,rt.byteLength,L.STREAM_READ),E.textures.length>1&&L.readBuffer(L.COLOR_ATTACHMENT0+Et),L.readPixels(U,O,z,N,It.convert(Bt),It.convert(Pt),0);const re=P!==null?et.get(P).__webglFramebuffer:null;J.bindFramebuffer(L.FRAMEBUFFER,re);const me=L.fenceSync(L.SYNC_GPU_COMMANDS_COMPLETE,0);return L.flush(),await Wd(L,me,4),L.bindBuffer(L.PIXEL_PACK_BUFFER,$t),L.getBufferSubData(L.PIXEL_PACK_BUFFER,0,rt),L.deleteBuffer($t),L.deleteSync(me),rt}else throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: requested read bounds are out of range.")},this.copyFramebufferToTexture=function(E,U=null,O=0){const z=Math.pow(2,-O),N=Math.floor(E.image.width*z),rt=Math.floor(E.image.height*z),gt=U!==null?U.x:0,Et=U!==null?U.y:0;ht.setTexture2D(E,0),L.copyTexSubImage2D(L.TEXTURE_2D,O,0,0,gt,Et,N,rt),J.unbindTexture()};const Uu=L.createFramebuffer(),Nu=L.createFramebuffer();this.copyTextureToTexture=function(E,U,O=null,z=null,N=0,rt=null){rt===null&&(N!==0?(ji("WebGLRenderer: copyTextureToTexture function signature has changed to support src and dst mipmap levels."),rt=N,N=0):rt=0);let gt,Et,yt,Ut,Bt,Pt,$t,re,me;const he=E.isCompressedTexture?E.mipmaps[rt]:E.image;if(O!==null)gt=O.max.x-O.min.x,Et=O.max.y-O.min.y,yt=O.isBox3?O.max.z-O.min.z:1,Ut=O.min.x,Bt=O.min.y,Pt=O.isBox3?O.min.z:0;else{const tn=Math.pow(2,-N);gt=Math.floor(he.width*tn),Et=Math.floor(he.height*tn),E.isDataArrayTexture?yt=he.depth:E.isData3DTexture?yt=Math.floor(he.depth*tn):yt=1,Ut=0,Bt=0,Pt=0}z!==null?($t=z.x,re=z.y,me=z.z):($t=0,re=0,me=0);const oe=It.convert(U.format),Dt=It.convert(U.type);let de;U.isData3DTexture?(ht.setTexture3D(U,0),de=L.TEXTURE_3D):U.isDataArrayTexture||U.isCompressedArrayTexture?(ht.setTexture2DArray(U,0),de=L.TEXTURE_2D_ARRAY):(ht.setTexture2D(U,0),de=L.TEXTURE_2D),L.pixelStorei(L.UNPACK_FLIP_Y_WEBGL,U.flipY),L.pixelStorei(L.UNPACK_PREMULTIPLY_ALPHA_WEBGL,U.premultiplyAlpha),L.pixelStorei(L.UNPACK_ALIGNMENT,U.unpackAlignment);const te=L.getParameter(L.UNPACK_ROW_LENGTH),Ge=L.getParameter(L.UNPACK_IMAGE_HEIGHT),Ti=L.getParameter(L.UNPACK_SKIP_PIXELS),We=L.getParameter(L.UNPACK_SKIP_ROWS),ds=L.getParameter(L.UNPACK_SKIP_IMAGES);L.pixelStorei(L.UNPACK_ROW_LENGTH,he.width),L.pixelStorei(L.UNPACK_IMAGE_HEIGHT,he.height),L.pixelStorei(L.UNPACK_SKIP_PIXELS,Ut),L.pixelStorei(L.UNPACK_SKIP_ROWS,Bt),L.pixelStorei(L.UNPACK_SKIP_IMAGES,Pt);const fe=E.isDataArrayTexture||E.isData3DTexture,je=U.isDataArrayTexture||U.isData3DTexture;if(E.isDepthTexture){const tn=et.get(E),Pe=et.get(U),Oe=et.get(tn.__renderTarget),ya=et.get(Pe.__renderTarget);J.bindFramebuffer(L.READ_FRAMEBUFFER,Oe.__webglFramebuffer),J.bindFramebuffer(L.DRAW_FRAMEBUFFER,ya.__webglFramebuffer);for(let $n=0;$n<yt;$n++)fe&&(L.framebufferTextureLayer(L.READ_FRAMEBUFFER,L.COLOR_ATTACHMENT0,et.get(E).__webglTexture,N,Pt+$n),L.framebufferTextureLayer(L.DRAW_FRAMEBUFFER,L.COLOR_ATTACHMENT0,et.get(U).__webglTexture,rt,me+$n)),L.blitFramebuffer(Ut,Bt,gt,Et,$t,re,gt,Et,L.DEPTH_BUFFER_BIT,L.NEAREST);J.bindFramebuffer(L.READ_FRAMEBUFFER,null),J.bindFramebuffer(L.DRAW_FRAMEBUFFER,null)}else if(N!==0||E.isRenderTargetTexture||et.has(E)){const tn=et.get(E),Pe=et.get(U);J.bindFramebuffer(L.READ_FRAMEBUFFER,Uu),J.bindFramebuffer(L.DRAW_FRAMEBUFFER,Nu);for(let Oe=0;Oe<yt;Oe++)fe?L.framebufferTextureLayer(L.READ_FRAMEBUFFER,L.COLOR_ATTACHMENT0,tn.__webglTexture,N,Pt+Oe):L.framebufferTexture2D(L.READ_FRAMEBUFFER,L.COLOR_ATTACHMENT0,L.TEXTURE_2D,tn.__webglTexture,N),je?L.framebufferTextureLayer(L.DRAW_FRAMEBUFFER,L.COLOR_ATTACHMENT0,Pe.__webglTexture,rt,me+Oe):L.framebufferTexture2D(L.DRAW_FRAMEBUFFER,L.COLOR_ATTACHMENT0,L.TEXTURE_2D,Pe.__webglTexture,rt),N!==0?L.blitFramebuffer(Ut,Bt,gt,Et,$t,re,gt,Et,L.COLOR_BUFFER_BIT,L.NEAREST):je?L.copyTexSubImage3D(de,rt,$t,re,me+Oe,Ut,Bt,gt,Et):L.copyTexSubImage2D(de,rt,$t,re,Ut,Bt,gt,Et);J.bindFramebuffer(L.READ_FRAMEBUFFER,null),J.bindFramebuffer(L.DRAW_FRAMEBUFFER,null)}else je?E.isDataTexture||E.isData3DTexture?L.texSubImage3D(de,rt,$t,re,me,gt,Et,yt,oe,Dt,he.data):U.isCompressedArrayTexture?L.compressedTexSubImage3D(de,rt,$t,re,me,gt,Et,yt,oe,he.data):L.texSubImage3D(de,rt,$t,re,me,gt,Et,yt,oe,Dt,he):E.isDataTexture?L.texSubImage2D(L.TEXTURE_2D,rt,$t,re,gt,Et,oe,Dt,he.data):E.isCompressedTexture?L.compressedTexSubImage2D(L.TEXTURE_2D,rt,$t,re,he.width,he.height,oe,he.data):L.texSubImage2D(L.TEXTURE_2D,rt,$t,re,gt,Et,oe,Dt,he);L.pixelStorei(L.UNPACK_ROW_LENGTH,te),L.pixelStorei(L.UNPACK_IMAGE_HEIGHT,Ge),L.pixelStorei(L.UNPACK_SKIP_PIXELS,Ti),L.pixelStorei(L.UNPACK_SKIP_ROWS,We),L.pixelStorei(L.UNPACK_SKIP_IMAGES,ds),rt===0&&U.generateMipmaps&&L.generateMipmap(de),J.unbindTexture()},this.copyTextureToTexture3D=function(E,U,O=null,z=null,N=0){return ji('WebGLRenderer: copyTextureToTexture3D function has been deprecated. Use "copyTextureToTexture" instead.'),this.copyTextureToTexture(E,U,O,z,N)},this.initRenderTarget=function(E){et.get(E).__webglFramebuffer===void 0&&ht.setupRenderTarget(E)},this.initTexture=function(E){E.isCubeTexture?ht.setTextureCube(E,
vendor: 4,725 bytes, line 3832
38320):E.isData3DTexture?ht.setTexture3D(E,0):E.isDataArrayTexture||E.isCompressedArrayTexture?ht.setTexture2DArray(E,0):ht.setTexture2D(E,0),J.unbindTexture()},this.resetState=function(){T=0,R=0,P=null,J.reset(),mt.reset()},typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}get coordinateSystem(){return nn}get outputColorSpace(){return this._outputColorSpace}set outputColorSpace(t){this._outputColorSpace=t;const e=this.getContext();e.drawingBufferColorSpace=Kt._getDrawingBufferColorSpace(t),e.unpackColorSpace=Kt._getUnpackColorSpace()}}export{ld as ACESFilmicToneMapping,fi as AddEquation,sd as AddOperation,Wh as AdditiveAnimationBlendMode,Kl as AdditiveBlending,hd as AgXToneMapping,kh as AlphaFormat,Td as AlwaysCompare,_o as AlwaysDepth,ec as AlwaysStencilFunc,Gp as AmbientLight,um as AnimationAction,oa as AnimationClip,ay as AnimationLoader,vy as AnimationMixer,xy as AnimationObjectGroup,ry as AnimationUtils,Bf as ArcCurve,$p as ArrayCamera,Vy as ArrowHelper,tc as AttachedBindMode,jp as Audio,_y as AudioAnalyser,yu as AudioContext,my as AudioListener,fy as AudioLoader,Hy as AxesHelper,Ve as BackSide,gd as BasicDepthPacking,ov as BasicShadowMap,Df as BatchedMesh,tu as Bone,cs as BooleanKeyframeTrack,Cy as Box2,Ne as Box3,zy as Box3Helper,ls as BoxGeometry,By as BoxHelper,le as BufferAttribute,Zt as BufferGeometry,Zp as BufferGeometryLoader,Oh as ByteType,Rn as Cache,gl as Camera,Oy as CameraHelper,sy as CanvasTexture,bl as CapsuleGeometry,zf as CatmullRomCurve3,od as CineonToneMapping,El as CircleGeometry,ln as ClampToEdgeWrapping,Kp as Clock,vt as Color,xu as ColorKeyframeTrack,Kt as ColorManagement,ny as CompressedArrayTexture,iy as CompressedCubeTexture,Sl as CompressedTexture,oy as CompressedTextureLoader,fa as ConeGeometry,ed as ConstantAlphaFactor,ju as ConstantColorFactor,Wy as Controls,df as CubeCamera,qn as CubeReflectionMapping,xi as CubeRefractionMapping,ua as CubeTexture,ly as CubeTextureLoader,Gs as CubeUVReflectionMapping,iu as CubicBezierCurve,Yf as CubicBezierCurve3,Rp as CubicInterpolant,$l as CullFaceBack,Ou as CullFaceFront,av as CullFaceFrontBack,Fu as CullFaceNone,_n as Curve,Jf as CurvePath,zu as CustomBlending,cd as CustomToneMapping,da as CylinderGeometry,wy as Cylindrical,pl as Data3DTexture,fl as DataArrayTexture,Pn as DataTexture,cy as DataTextureLoader,Yv as DataUtils,Mv as DecrementStencilOp,bv as DecrementWrapStencilOp,Up as DefaultLoadingManager,Ns as DepthFormat,Fs as DepthStencilFormat,nu as DepthTexture,dd as DetachedBindMode,Hp as DirectionalLight,Fy as DirectionalLightHelper,Ip as DiscreteInterpolant,Tl as DodecahedronGeometry,An as DoubleSide,Zu as DstAlphaFactor,$u as DstColorFactor,Bv as DynamicCopyUsage,Lv as DynamicDrawUsage,Nv as DynamicReadUsage,Of as EdgesGeometry,Al as EllipseCurve,Md as EqualCompare,vo as EqualDepth,wv as EqualStencilFunc,Zr as EquirectangularReflectionMapping,Jr as EquirectangularRefractionMapping,sn as Euler,Dn as EventDispatcher,Cl as ExtrudeGeometry,Zn as FileLoader,jv as Float16BufferAttribute,St as Float32BufferAttribute,Je as FloatType,xl as Fog,_l as FogExp2,ey as FramebufferTexture,Xn as FrontSide,qs as Frustum,Ml as FrustumArray,by as GLBufferAttribute,kv as GLSL1,nc as GLSL3,Sd as GreaterCompare,Mo as GreaterDepth,Ed as GreaterEqualCompare,yo as GreaterEqualDepth,Pv as GreaterEqualStencilFunc,Rv as GreaterStencilFunc,Uy as GridHelper,ws as Group,Ws as HalfFloatType,Fp as HemisphereLight,Dy as HemisphereLightHelper,Rl as IcosahedronGeometry,dy as ImageBitmapLoader,la as ImageLoader,qd as ImageUtils,yv as IncrementStencilOp,Sv as IncrementWrapStencilOp,zs as InstancedBufferAttribute,Yp as InstancedBufferGeometry,Sy as InstancedInterleavedBuffer,Sf as InstancedMesh,Kv as Int16BufferAttribute,Qv as Int32BufferAttribute,Zv as Int8BufferAttribute,rl as IntType,vl as InterleavedBuffer,as as InterleavedBufferAttribute,ga as Interpolant,Qr as InterpolateDiscrete,Jo as InterpolateLinear,Ma as InterpolateSmooth,Gv as InterpolationSamplingMode,Hv as InterpolationSamplingType,Ev as InvertStencilOp,Ai as KeepStencilOp,cn as KeyframeTrack,_f as LOD,Il as LatheGeometry,ml as Layers,yd as LessCompare,xo as LessDepth,Xh as LessEqualCompare,ns as LessEqualDepth,Cv as LessEqualStencilFunc,Av as LessStencilFunc,Ei as Light,qp as LightProbe,vi as Line,Ry as Line3,He as LineBasicMaterial,su as LineCurve,Zf as LineCurve3,Ap as LineDashedMaterial,Uf as LineLoop,Un as LineSegments,Ee as LinearFilter,_u as LinearInterpolant,uv as LinearMipMapLinearFilter,hv as LinearMipMapNearestFilter,Cn as LinearMipmapLinearFilter,Vr as LinearMipmapNearestFilter,is as LinearSRGBColorSpace,rd as LinearToneMapping,ta as LinearTransfer,Qe as Loader,Jc as Loa
3832derUtils,vu as LoadingManager,fd as LoopOnce,md as LoopPingPong,pd as LoopRepeat,sv as MOUSE,Fe as Material,kl as MaterialLoader,Wv as MathUtils,Su as Matrix2,Xt as Matrix3,zt as Matrix4,Gu as MaxEquation,ye as Mesh,Si as MeshBasicMaterial,fu as MeshDepthMaterial,pu as MeshDistanceMaterial,Ep as MeshLambertMaterial,Tp as MeshMatcapMaterial,bp as MeshNormalMaterial,Mp as MeshPhongMaterial,yp as MeshPhysicalMaterial,du as MeshStandardMaterial,Sp as MeshToonMaterial,Hu as MinEquation,Kr as MirroredRepeatWrapping,id as MixOperation,jl as MultiplyBlending,ca as MultiplyOperation,Re as NearestFilter,cv as NearestMipMapLinearFilter,lv as NearestMipMapNearestFilter,Ts as NearestMipmapLinearFilter,Fh as NearestMipmapNearestFilter,ud as NeutralToneMapping,vd as NeverCompare,go as NeverDepth,Tv as NeverStencilFunc,Gn as NoBlending,Hn as NoColorSpace,Wn as NoToneMapping,ul as NormalAnimationBlendMode,Qi as NormalBlending,bd as NotEqualCompare,So as NotEqualDepth,Iv as NotEqualStencilFunc,ra as NumberKeyframeTrack,ie as Object3D,uy as ObjectLoader,xd as ObjectSpaceNormalMap,pa as OctahedronGeometry,Xu as OneFactor,nd as OneMinusConstantAlphaFactor,td as OneMinusConstantColorFactor,Ju as OneMinusDstAlphaFactor,Ku as OneMinusDstColorFactor,mo as OneMinusSrcAlphaFactor,Yu as OneMinusSrcColorFactor,zl as OrthographicCamera,Nh as PCFShadowMap,Bu as PCFSoftShadowMap,ph as PMREMGenerator,Ko as Path,Ce as PerspectiveCamera,ui as Plane,Ys as PlaneGeometry,ky as PlaneHelper,kp as PointLight,Ly as PointLightHelper,Nf as Points,eu as PointsMaterial,Ny as PolarGridHelper,bi as PolyhedronGeometry,gy as PositionalAudio,ee as PropertyBinding,em as PropertyMixer,ru as QuadraticBezierCurve,au as QuadraticBezierCurve3,Ke as Quaternion,_a as QuaternionKeyframeTrack,Pp as QuaternionLinearInterpolant,Yo as RED_GREEN_RGTC2_Format,Gh as RED_RGTC1_Format,iv as REVISION,_d as RGBADepthPacking,ke as RGBAFormat,hl as RGBAIntegerFormat,Vo as RGBA_ASTC_10x10_Format,Bo as RGBA_ASTC_10x5_Format,zo as RGBA_ASTC_10x6_Format,ko as RGBA_ASTC_10x8_Format,Ho as RGBA_ASTC_12x10_Format,Go as RGBA_ASTC_12x12_Format,Io as RGBA_ASTC_4x4_Format,Po as RGBA_ASTC_5x4_Format,Lo as RGBA_ASTC_5x5_Format,Do as RGBA_ASTC_6x5_Format,Uo as RGBA_ASTC_6x6_Format,No as RGBA_ASTC_8x5_Format,Fo as RGBA_ASTC_8x6_Format,Oo as RGBA_ASTC_8x8_Format,qr as RGBA_BPTC_Format,Ro as RGBA_ETC2_EAC_Format,Ao as RGBA_PVRTC_2BPPV1_Format,To as RGBA_PVRTC_4BPPV1_Format,Gr as RGBA_S3TC_DXT1_Format,Wr as RGBA_S3TC_DXT3_Format,Xr as RGBA_S3TC_DXT5_Format,gv as RGBDepthPacking,Vh as RGBFormat,dv as RGBIntegerFormat,Wo as RGB_BPTC_SIGNED_Format,Xo as RGB_BPTC_UNSIGNED_Format,wo as RGB_ETC1_Format,Co as RGB_ETC2_Format,Eo as RGB_PVRTC_2BPPV1_Format,bo as RGB_PVRTC_4BPPV1_Format,Hr as RGB_S3TC_DXT1_Format,_v as RGDepthPacking,Hh as RGFormat,cl as RGIntegerFormat,vp as RawShaderMaterial,Xs as Ray,Ey as Raycaster,Wp as RectAreaLight,ll as RedFormat,ha as RedIntegerFormat,ad as ReinhardToneMapping,Yh as RenderTarget,yy as RenderTarget3D,$r as RepeatWrapping,vv as ReplaceStencilOp,Vu as ReverseSubtractEquation,Pl as RingGeometry,Zo as SIGNED_RED_GREEN_RGTC2_Format,qo as SIGNED_RED_RGTC1_Format,Ye as SRGBColorSpace,ae as SRGBTransfer,mf as Scene,Jt as ShaderChunk,fn as ShaderLib,gn as ShaderMaterial,xp as ShadowMaterial,es as Shape,Ll as ShapeGeometry,Gy as ShapePath,pn as ShapeUtils,Bh as ShortType,yl as Skeleton,Py as SkeletonHelper,vf as SkinnedMesh,mi as Source,Ie as Sphere,ma as SphereGeometry,Ay as Spherical,Xp as SphericalHarmonics3,ou as SplineCurve,Bp as SpotLight,Iy as SpotLightHelper,gf as Sprite,Qh as SpriteMaterial,po as SrcAlphaFactor,Qu as SrcAlphaSaturateFactor,qu as SrcColorFactor,Ov as StaticCopyUsage,ea as StaticDrawUsage,Uv as StaticReadUsage,py as StereoCamera,zv as StreamCopyUsage,Dv as StreamDrawUsage,Fv as StreamReadUsage,hs as StringKeyframeTrack,ku as SubtractEquation,Ql as SubtractiveBlending,rv as TOUCH,Mi as TangentSpaceNormalMap,Dl as TetrahedronGeometry,xe as Texture,hy as TextureLoader,Xy as TextureUtils,Ty as Timer,Vv as TimestampQuery,Ul as TorusGeometry,Nl as TorusKnotGeometry,Ze as Triangle,mv as TriangleFanDrawMode,pv as TriangleStripDrawMode,fv as TrianglesDrawMode,Fl as TubeGeometry,sl as UVMapping,Jh as Uint16BufferAttribute,$h as Uint32BufferAttribute,Jv as Uint8BufferAttribute,$v as Uint8ClampedBufferAttribute,Mu as Uniform,My as UniformsGroup,pt as UniformsLib,cf as UniformsUtils,mn as UnsignedByteType,Us as UnsignedInt248Type,zh as UnsignedInt5999Type,Yn as UnsignedIntType,al as UnsignedShort4444Type,ol as UnsignedShort5551Type,Ds as UnsignedShortType,Tn as VSMShadowMap,K as Vector2,C as Vector3,
3832ne as Vector4,aa as VectorKeyframeTrack,ty as VideoFrameTexture,Ff as VideoTexture,qv as WebGL3DRenderTarget,Xv as WebGLArrayRenderTarget,nn as WebGLCoordinateSystem,ff as WebGLCubeRenderTarget,Ln as WebGLRenderTarget,qy as WebGLRenderer,Jx as WebGLUtils,Os as WebGPUCoordinateSystem,Ha as WebXRController,_p as WireframeGeometry,jr as WrapAroundEnding,Zi as ZeroCurvatureEnding,Wu as ZeroFactor,Ji as ZeroSlopeEnding,xv as ZeroStencilOp,Gd as createCanvasElement};

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.