PageSourceSearch

https://renaissancecharitable.org/wp-content/themes/ren-rcf-wp-theme/dist/three.module.3ld.js

js renaissancecharitable.org collected 2026-10-07 10:49:56 UTC 720,083 bytes, 4,019 lines download raw bytes

1/**
2 * @license
3 * Copyright 2010-2025 Three.js Authors
4 * SPDX-License-Identifier: MIT
5 */const vl="182",Rv={LEFT:0,MIDDLE:1,RIGHT:2,ROTATE:0,DOLLY:1,PAN:2},Iv={ROTATE:0,PAN:1,DOLLY_PAN:2,DOLLY_ROTATE:3},ad=0,pc=1,od=2,Pv=3,Lv=0,qr=1,ld=2,Ps=3,Qn=0,Xt=1,Ln=2,Fn=0,is=1,mc=2,gc=3,_c=4,cd=5,xi=100,hd=101,ud=102,dd=103,fd=104,pd=200,md=201,gd=202,_d=203,So=204,bo=205,xd=206,vd=207,yd=208,Md=209,Sd=210,bd=211,Ad=212,Td=213,Ed=214,Ao=0,To=1,Eo=2,as=3,wo=4,Co=5,Ro=6,Io=7,ma=0,wd=1,Cd=2,Sn=0,Kh=1,Qh=2,jh=3,eu=4,tu=5,nu=6,iu=7,xc="attached",Rd="detached",yl=300,Bn=301,Ai=302,jr=303,ea=304,$s=306,ta=1e3,en=1001,na=1002,bt=1003,su=1004,Dv=1004,Ls=1005,Uv=1005,mt=1006,Yr=1007,Nv=1007,Un=1008,Fv=1008,Qt=1009,ru=1010,au=1011,Vs=1012,Ml=1013,fn=1014,Ht=1015,zn=1016,Sl=1017,bl=1018,ks=1020,ou=35902,lu=35899,cu=1021,hu=1022,Wt=1023,Vn=1026,yi=1027,Al=1028,ga=1029,os=1030,Tl=1031,Ov=1032,El=1033,Zr=33776,Jr=33777,$r=33778,Kr=33779,Po=35840,Lo=35841,Do=35842,Uo=35843,No=36196,Fo=37492,Oo=37496,Bo=37488,zo=37489,Vo=37490,ko=37491,Go=37808,Ho=37809,Wo=37810,Xo=37811,qo=37812,Yo=37813,Zo=37814,Jo=37815,$o=37816,Ko=37817,Qo=37818,jo=37819,el=37820,tl=37821,nl=36492,il=36494,sl=36495,rl=36283,al=36284,ol=36285,ll=36286,Id=2200,Pd=2201,Ld=2202,ia=2300,cl=2301,Ia=2302,es=2400,ts=2401,sa=2402,wl=2500,uu=2501,Bv=0,zv=1,
vendor: 15,440 bytes, line 5
5Vv=2,Dd=3200,kv=3201,Gv=3202,Hv=3203,wi=0,Ud=1,$n="",Kt="srgb",ls="srgb-linear",ra="linear",rt="srgb",Wv="",Xv="rg",qv="ga",Yv=0,Li=7680,Zv=7681,Jv=7682,$v=7683,Kv=34055,Qv=34056,jv=5386,ey=512,ty=513,ny=514,iy=515,sy=516,ry=517,ay=518,vc=519,Nd=512,Fd=513,Od=514,Cl=515,Bd=516,zd=517,Rl=518,Vd=519,aa=35044,oy=35048,ly=35040,cy=35045,hy=35049,uy=35041,dy=35046,fy=35050,py=35042,my="100",yc="300 es",on=2e3,Gs=2001,gy={COMPUTE:"compute",RENDER:"render"},_y={PERSPECTIVE:"perspective",LINEAR:"linear",FLAT:"flat"},xy={NORMAL:"normal",CENTROID:"centroid",SAMPLE:"sample",FIRST:"first",EITHER:"either"};function du(r){for(let e=r.length-1;e>=0;--e)if(r[e]>=65535)return!0;return!1}const kd={Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array};function ns(r,e){return new kd[r](e)}function fu(r){return ArrayBuffer.isView(r)&&!(r instanceof DataView)}function Hs(r){return document.createElementNS("http://www.w3.org/1999/xhtml",r)}function Gd(){const r=Hs("canvas");return r.style.display="block",r}const Mc={};let jn=null;function vy(r){jn=r}function yy(){return jn}function oa(...r){const e="THREE."+r.shift();jn?jn("log",e,...r):console.log(e,...r)}function de(...r){const e="THREE."+r.shift();jn?jn("warn",e,...r):console.warn(e,...r)}function Le(...r){const e="THREE."+r.shift();jn?jn("error",e,...r):console.error(e,...r)}function Ws(...r){const e=r.join(" ");e in Mc||(Mc[e]=!0,de(...r))}function Hd(r,e,t){return new Promise(function(n,i){function s(){switch(r.clientWaitSync(e,r.SYNC_FLUSH_COMMANDS_BIT,0)){case r.WAIT_FAILED:i();break;case r.TIMEOUT_EXPIRED:setTimeout(s,t);break;default:n()}}setTimeout(s,t)})}class kn{addEventListener(e,t){this._listeners===void 0&&(this._listeners={});const n=this._listeners;n[e]===void 0&&(n[e]=[]),n[e].indexOf(t)===-1&&n[e].push(t)}hasEventListener(e,t){const n=this._listeners;return n===void 0?!1:n[e]!==void 0&&n[e].indexOf(t)!==-1}removeEventListener(e,t){const n=this._listeners;if(n===void 0)return;const i=n[e];if(i!==void 0){const s=i.indexOf(t);s!==-1&&i.splice(s,1)}}dispatchEvent(e){const t=this._listeners;if(t===void 0)return;const n=t[e.type];if(n!==void 0){e.target=this;const i=n.slice(0);for(let s=0,a=i.length;s<a;s++)i[s].call(this,e);e.target=null}}}const Ct=["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 Sc=1234567;const bi=Math.PI/180,cs=180/Math.PI;function tn(){const r=Math.random()*4294967295|0,e=Math.random()*4294967295|0,t=Math.random()*4294967295|0,n=Math.random()*4294967295|0;return(Ct[r&255]+Ct[r>>8&255]+Ct[r>>16&255]+Ct[r>>24&255]+"-"+Ct[e&255]+Ct[e>>8&255]+"-"+Ct[e>>16&15|64]+Ct[e>>24&255]+"-"+Ct[t&63|128]+Ct[t>>8&255]+"-"+Ct[t>>16&255]+Ct[t>>24&255]+Ct[n&255]+Ct[n>>8&255]+Ct[n>>16&255]+Ct[n>>24&255]).toLowerCase()}function ze(r,e,t){return Math.max(e,Math.min(t,r))}function Il(r,e){return(r%e+e)%e}function Wd(r,e,t,n,i){return n+(r-e)*(i-n)/(t-e)}function Xd(r,e,t){return r!==e?(t-r)/(e-r):0}function Os(r,e,t){return(1-t)*r+t*e}function qd(r,e,t,n){return Os(r,e,1-Math.exp(-t*n))}function Yd(r,e=1){return e-Math.abs(Il(r,e*2)-e)}function Zd(r,e,t){return r<=e?0:r>=t?1:(r=(r-e)/(t-e),r*r*(3-2*r))}function Jd(r,e,t){return r<=e?0:r>=t?1:(r=(r-e)/(t-e),r*r*r*(r*(r*6-15)+10))}function $d(r,e){return r+Math.floor(Math.random()*(e-r+1))}function Kd(r,e){return r+Math.random()*(e-r)}function Qd(r){return r*(.5-Math.random())}function jd(r){r!==void 0&&(Sc=r);let e=Sc+=1831565813;return e=Math.imul(e^e>>>15,e|1),e^=e+Math.imul(e^e>>>7,e|61),((e^e>>>14)>>>0)/4294967296}function ef(r){return r*bi}function tf(r){return r*cs}function nf(r){return(r&r-1)===0&&r!==0}function sf(r){return Math.pow(2,Math.ceil(Math.log(r)/Math.LN2))}function rf(r){return Math.pow(2,Math.floor(Math.log(r)/Math.LN2))}function af(r,e,t,n,i){const s=Math.cos,a=Math.sin,o=s(t/2),l=a(t/2),c=s((e+n)/2),h=a((e+n)/2),u=s((e-n)/2),d=a((e-n)/2),f=s((n-e)/2),m=a((n-e)/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:de("MathUtils: .setQuaternionFromProperEuler() encountered an unknown order: "+i)}}function Ft(r,e){switch(e.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 Ze(r,e){switch(e.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 My={DEG2RAD:bi,RAD2DEG:cs,generateUUID:tn,clamp:ze,euclideanModulo:Il,mapLinear:Wd,inverseLerp:Xd,lerp:Os,damp:qd,pingpong:Yd,smoothstep:Zd,smootherstep:Jd,randInt:$d,randFloat:Kd,randFloatSpread:Qd,seededRandom:jd,degToRad:ef,radToDeg:tf,isPowerOfTwo:nf,ceilPowerOfTwo:sf,floorPowerOfTwo:rf,setQuaternionFromProperEuler:af,normalize:Ze,denormalize:Ft};class K{constructor(e=0,t=0){K.prototype.isVector2=!0,this.x=e,this.y=t}get width(){return this.x}set width(e){this.x=e}get height(){return this.y}set height(e){this.y=e}set(e,t){return this.x=e,this.y=t,this}setScalar(e){return this.x=e,this.y=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;default:throw new Error("index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;default:throw new Error("index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y)}copy(e){return this.x=e.x,this.y=e.y,this}add(e){return this.x+=e.x,this.y+=e.y,this}addScalar(e){return this.x+=e,this.y+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this}sub(e){return this.x-=e.x,this.y-=e.y,this}subScalar(e){return this.x-=e,this.y-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this}multiply(e){return this.x*=e.x,this.y*=e.y,this}multiplyScalar(e){return this.x*=e,this.y*=e,this}divide(e){return this.x/=e.x,this.y/=e.y,this}divideScalar(e){return this.multiplyScalar(1/e)}applyMatrix3(e){const t=this.x,n=this.y,i=e.elements;return this.x=i[0]*t+i[3]*n+i[6],this.y=i[1]*t+i[4]*n+i[7],this}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this}clamp(e,t){return this.x=ze(this.x,e.x,t.x),this.y=ze(this.y,e.y,t.y),this}clampScalar(e,t){return this.x=ze(this.x,e,t),this.y=ze(this.y,e,t),this}clampLength(e,t){const n=this.length();return this.divideScalar(n||1).multiplyScalar(ze(n,e,t))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this}negate(){return this.x=-this.x,this.y=-this.y,this}dot(e){return this.x*e.x+this.y*e.y}cross(e){return this.x*e.y-this.y*e.x}lengthSq(){return this.x*this.x+this.y*this.y}length(){return Math.sqrt(this.x*this.x+this.y*this.y)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)}normalize(){return this.divideScalar(this.length()||1)}angle(){return Math.atan2(-this.y,-this.x)+Math.PI}angleTo(e){const t=Math.sqrt(this.lengthSq()*e.lengthSq());if(t===0)return Math.PI/2;const n=this.dot(e)/t;return Math.acos(ze(n,-1,1))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){const t=this.x-e.x,n=this.y-e.y;return t*t+n*n}manhattanDistanceTo(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this}lerpVectors(e,t,n){return this.x=e.x+(t.x-e.x)*n,this.y=e.y+(t.y-e.y)*n,this}equals(e){return e.x===this.x&&e.y===this.y}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this}rotateAround(e,t){const n=Math.cos(t),i=Math.sin(t),s=this.x-e.x,a=this.y-e.y;return this.x=s*n-a*i+e.x,this.y=s*i+a*n+e.y,this}random(){return this.x=Math.random(),this.y=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y}}class nn{constructor(e=0,t=0,n=0,i=1){this.isQuaternion=!0,this._x=e,this._y=t,this._z=n,this._w=i}static slerpFlat(e,t,n,i,s,a,o){let l=n[i+0],c=n[i+1],h=n[i+2],u=n[i+3],d=s[a+0],f=s[a+1],m=s[a+2],_=s[a+3];if(o<=0){e[t+0]=l,e[t+1]=c,e[t+2]=h,e[t+3]=u;return}if(o>=1){e[t+0]=d,e[t+1]=f,e[t+2]=m,e[t+3]=_;return}if(u!==_||l!==d||c!==f||h!==m){let g=l*d+c*f+h*m+u*_;g<0&&(d=-d,f=-f,m=-m,_=-_,g=-g);let p=1-o;if(g<.9995){const v=Math.acos(g),x=Math.sin(v);p=Math.sin(p*v)/x,o=Math.sin(o*v)/x,l=l*p+d*o,c=c*p+f*o,h=h*p+m*o,u=u*p+_*o}else{l=l*p+d*o,c=c*p+f*o,h=h*p+m*o,u=u*p+_*o;const v=1/Math.sqrt(l*l+c*c+h*h+u*u);l*=v,c*=v,h*=v,u*=v}}e[t]=l,e[t+1]=c,e[t+2]=h,e[t+3]=u}static multiplyQuaternionsFlat(e,t,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 e[t]=o*m+h*u+l*f-c*d,e[t+1]=l*m+h*d+c*u-o*f,e[t+2]=c*m+h*f+o*d-l*u,e[t+3]=h*m-o*u-l*d-c*f,e}get x(){return this._x}set x(e){this._x=e,this._onChangeCallback()}get y(){return this._y}set y(e){this._y=e,this._onChangeCallback()}get z(){return this._z}set z(e){this._z=e,this._onChangeCallback()}get w(){return this._w}set w(e){this._w=e,this._onChangeCallback()}set(e,t,n,i){return this._x=e,this._y=t,this._z=n,this._w=i,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._w)}copy(e){return this._x=e.x,this._y=e.y,this._z=e.z,this._w=e.w,this._onChangeCallback(),this}setFromEuler(e,t=!0){const n=e._x,i=e._y,s=e._z,a=e._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:de("Quaternion: .setFromEuler() encountered an unknown order: "+a)}return t===!0&&this._onChangeCallback(),this}setFromAxisAngle(e,t){const n=t/2,i=Math.sin(n);return this._x=e.x*i,this._y=e.y*i,this._z=e.z*i,this._w=Math.cos(n),this._onChangeCallback(),this}setFromRotationMatrix(e){const t=e.elements,n=t[0],i=t[4],s=t[8],a=t[1],o=t[5],l=t[9],c=t[2],h=t[6],u=t[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(e,t){let n=e.dot(t)+1;return n<1e-8?(n=0,Math.abs(e.x)>Math.abs(e.z)?(this._x=-e.y,this._y=e.x,this._z=0,this._w=n):(this._x=0,this._y=-e.z,this._z=e.y,this._w=n)):(this._x=e.y*t.z-e.z*t.y,this._y=e.z*t.x-e.x*t.z,this._z=e.x*t.y-e.y*t.x,this._w=n),this.normalize()}angleTo(e){return 2*Math.acos(Math.abs(ze(this.dot(e),-1,1)))}rotateTowards(e,t){const n=this.angleTo(e);if(n===0)return this;const i=Math.min(1,t/n);return this.slerp(e,i),this}identity(){return this.set(0,0,0,1)}invert(){return this.conjugate()}conjugate(){return this._x*=-1,this._y*=-1,this._z*=-1,this._onChangeCallback(),this}dot(e){return this._x*e._x+this._y*e._y+this._z*e._z+this._w*e._w}lengthSq(){return this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w}length(){return Math.sqrt(this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w)}normalize(){let e=this.length();return e===0?(this._x=0,this._y=0,this._z=0,this._w=1):(e=1/e,this._x=this._x*e,this._y=this._y*e,this._z=this._z*e,this._w=this._w*e),this._onChangeCallback(),this}multiply(e){return this.multiplyQuaternions(this,e)}premultiply(e){return this.multiplyQuaternions(e,this)}multiplyQuaternions(e,t){const n=e._x,i=e._y,s=e._z,a=e._w,o=t._x,l=t._y,c=t._z,h=t._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(e,t){if(t<=0)return this;if(t>=1)return this.copy(e);let n=e._x,i=e._y,s=e._z,a=e._w,o=this.dot(e);o<0&&(n=-n,i=-i,s=-s,a=-a,o=-o);let l=1-t;if(o<.9995){const c=Math.acos(o),h=Math.sin(c);l=Math.sin(l*c)/h,t=Math.sin(t*c)/h,this._x=this._x*l+n*t,this._y=this._y*l+i*t,this._z=this._z*l+s*t,this._w=this._w*l+a*t,this._onChangeCallback()}else this._x=this._x*l+n*t,this._y=this._y*l+i*t,this._z=this._z*l+s*t,this._w=this._w*l+a*t,this.normalize();return this}slerpQuaternions(e,t,n){return this.copy(e).slerp(t,n)}random(){const e=2*Math.PI*Math.random(),t=2*Math.PI*Math.random(),n=Math.random(),i=Math.sqrt(1-n),s=Math.sqrt(n);return this.set(i*Math.sin(e),i*Math.cos(e),s*Math.sin(t),s*Math.cos(t))}equals(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._w===this._w}fromArray(e,t=0){return this._x=e[t],this._y=e[t+1],this._z=e[t+2],this._w=e[t+3],this._onChangeCallback(),this}toArray(e=[],t=0){return e[t]=this._x,e[t+1]=this._y,e[t+2]=this._z,e[t+3]=this._w,e}fromBufferAttribute(e,t){return this._x=e.getX(t),this._y=e.getY(t),this._z=e.getZ(t),this._w=e.getW(t),this._onChangeCallback(),this}toJSON(){return this.toArray()}
vendor: 4,147 bytes, line 5
5_onChange(e){return this._onChangeCallback=e,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._w}}class R{constructor(e=0,t=0,n=0){R.prototype.isVector3=!0,this.x=e,this.y=t,this.z=n}set(e,t,n){return n===void 0&&(n=this.z),this.x=e,this.y=t,this.z=n,this}setScalar(e){return this.x=e,this.y=e,this.z=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setZ(e){return this.z=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;case 2:this.z=t;break;default:throw new Error("index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;case 2:return this.z;default:throw new Error("index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y,this.z)}copy(e){return this.x=e.x,this.y=e.y,this.z=e.z,this}add(e){return this.x+=e.x,this.y+=e.y,this.z+=e.z,this}addScalar(e){return this.x+=e,this.y+=e,this.z+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this.z=e.z+t.z,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this.z+=e.z*t,this}sub(e){return this.x-=e.x,this.y-=e.y,this.z-=e.z,this}subScalar(e){return this.x-=e,this.y-=e,this.z-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this.z=e.z-t.z,this}multiply(e){return this.x*=e.x,this.y*=e.y,this.z*=e.z,this}multiplyScalar(e){return this.x*=e,this.y*=e,this.z*=e,this}multiplyVectors(e,t){return this.x=e.x*t.x,this.y=e.y*t.y,this.z=e.z*t.z,this}applyEuler(e){return this.applyQuaternion(bc.setFromEuler(e))}applyAxisAngle(e,t){return this.applyQuaternion(bc.setFromAxisAngle(e,t))}applyMatrix3(e){const t=this.x,n=this.y,i=this.z,s=e.elements;return this.x=s[0]*t+s[3]*n+s[6]*i,this.y=s[1]*t+s[4]*n+s[7]*i,this.z=s[2]*t+s[5]*n+s[8]*i,this}applyNormalMatrix(e){return this.applyMatrix3(e).normalize()}applyMatrix4(e){const t=this.x,n=this.y,i=this.z,s=e.elements,a=1/(s[3]*t+s[7]*n+s[11]*i+s[15]);return this.x=(s[0]*t+s[4]*n+s[8]*i+s[12])*a,this.y=(s[1]*t+s[5]*n+s[9]*i+s[13])*a,this.z=(s[2]*t+s[6]*n+s[10]*i+s[14])*a,this}applyQuaternion(e){const t=this.x,n=this.y,i=this.z,s=e.x,a=e.y,o=e.z,l=e.w,c=2*(a*i-o*n),h=2*(o*t-s*i),u=2*(s*n-a*t);return this.x=t+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(e){return this.applyMatrix4(e.matrixWorldInverse).applyMatrix4(e.projectionMatrix)}unproject(e){return this.applyMatrix4(e.projectionMatrixInverse).applyMatrix4(e.matrixWorld)}transformDirection(e){const t=this.x,n=this.y,i=this.z,s=e.elements;return this.x=s[0]*t+s[4]*n+s[8]*i,this.y=s[1]*t+s[5]*n+s[9]*i,this.z=s[2]*t+s[6]*n+s[10]*i,this.normalize()}divide(e){return this.x/=e.x,this.y/=e.y,this.z/=e.z,this}divideScalar(e){return this.multiplyScalar(1/e)}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this.z=Math.min(this.z,e.z),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this.z=Math.max(this.z,e.z),this}clamp(e,t){return this.x=ze(this.x,e.x,t.x),this.y=ze(this.y,e.y,t.y),this.z=ze(this.z,e.z,t.z),this}clampScalar(e,t){return this.x=ze(this.x,e,t),this.y=ze(this.y,e,t),this.z=ze(this.z,e,t),this}clampLength(e,t){const n=this.length();return this.divideScalar(n||1).multiplyScalar(ze(n,e,t))}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(e){return this.x*e.x+this.y*e.y+this.z*e.z}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)}normalize(){return this.divideScalar(this.length()||1)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this.z+=(e.z-this.z)*t,this}
vendor: 70,763 bytes, line 5
5lerpVectors(e,t,n){return this.x=e.x+(t.x-e.x)*n,this.y=e.y+(t.y-e.y)*n,this.z=e.z+(t.z-e.z)*n,this}cross(e){return this.crossVectors(this,e)}crossVectors(e,t){const n=e.x,i=e.y,s=e.z,a=t.x,o=t.y,l=t.z;return this.x=i*l-s*o,this.y=s*a-n*l,this.z=n*o-i*a,this}projectOnVector(e){const t=e.lengthSq();if(t===0)return this.set(0,0,0);const n=e.dot(this)/t;return this.copy(e).multiplyScalar(n)}projectOnPlane(e){return Pa.copy(this).projectOnVector(e),this.sub(Pa)}reflect(e){return this.sub(Pa.copy(e).multiplyScalar(2*this.dot(e)))}angleTo(e){const t=Math.sqrt(this.lengthSq()*e.lengthSq());if(t===0)return Math.PI/2;const n=this.dot(e)/t;return Math.acos(ze(n,-1,1))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){const t=this.x-e.x,n=this.y-e.y,i=this.z-e.z;return t*t+n*n+i*i}manhattanDistanceTo(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)+Math.abs(this.z-e.z)}setFromSpherical(e){return this.setFromSphericalCoords(e.radius,e.phi,e.theta)}setFromSphericalCoords(e,t,n){const i=Math.sin(t)*e;return this.x=i*Math.sin(n),this.y=Math.cos(t)*e,this.z=i*Math.cos(n),this}setFromCylindrical(e){return this.setFromCylindricalCoords(e.radius,e.theta,e.y)}setFromCylindricalCoords(e,t,n){return this.x=e*Math.sin(t),this.y=n,this.z=e*Math.cos(t),this}setFromMatrixPosition(e){const t=e.elements;return this.x=t[12],this.y=t[13],this.z=t[14],this}setFromMatrixScale(e){const t=this.setFromMatrixColumn(e,0).length(),n=this.setFromMatrixColumn(e,1).length(),i=this.setFromMatrixColumn(e,2).length();return this.x=t,this.y=n,this.z=i,this}setFromMatrixColumn(e,t){return this.fromArray(e.elements,t*4)}setFromMatrix3Column(e,t){return this.fromArray(e.elements,t*3)}setFromEuler(e){return this.x=e._x,this.y=e._y,this.z=e._z,this}setFromColor(e){return this.x=e.r,this.y=e.g,this.z=e.b,this}equals(e){return e.x===this.x&&e.y===this.y&&e.z===this.z}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this.z=e[t+2],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e[t+2]=this.z,e}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this.z=e.getZ(t),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this}randomDirection(){const e=Math.random()*Math.PI*2,t=Math.random()*2-1,n=Math.sqrt(1-t*t);return this.x=n*Math.cos(e),this.y=t,this.z=n*Math.sin(e),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z}}const Pa=new R,bc=new nn;class Ye{constructor(e,t,n,i,s,a,o,l,c){Ye.prototype.isMatrix3=!0,this.elements=[1,0,0,0,1,0,0,0,1],e!==void 0&&this.set(e,t,n,i,s,a,o,l,c)}set(e,t,n,i,s,a,o,l,c){const h=this.elements;return h[0]=e,h[1]=i,h[2]=o,h[3]=t,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(e){const t=this.elements,n=e.elements;return t[0]=n[0],t[1]=n[1],t[2]=n[2],t[3]=n[3],t[4]=n[4],t[5]=n[5],t[6]=n[6],t[7]=n[7],t[8]=n[8],this}extractBasis(e,t,n){return e.setFromMatrix3Column(this,0),t.setFromMatrix3Column(this,1),n.setFromMatrix3Column(this,2),this}setFromMatrix4(e){const t=e.elements;return this.set(t[0],t[4],t[8],t[1],t[5],t[9],t[2],t[6],t[10]),this}multiply(e){return this.multiplyMatrices(this,e)}premultiply(e){return this.multiplyMatrices(e,this)}multiplyMatrices(e,t){const n=e.elements,i=t.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],v=i[1],x=i[4],M=i[7],T=i[2],E=i[5],C=i[8];return s[0]=a*_+o*v+l*T,s[3]=a*g+o*x+l*E,s[6]=a*p+o*M+l*C,s[1]=c*_+h*v+u*T,s[4]=c*g+h*x+u*E,s[7]=c*p+h*M+u*C,s[2]=d*_+f*v+m*T,s[5]=d*g+f*x+m*E,s[8]=d*p+f*M+m*C,this}multiplyScalar(e){const t=this.elements;return t[0]*=e,t[3]*=e,t[6]*=e,t[1]*=e,t[4]*=e,t[7]*=e,t[2]*=e,t[5]*=e,t[8]*=e,this}determinant(){const e=this.elements,t=e[0],n=e[1],i=e[2],s=e[3],a=e[4],o=e[5],l=e[6],c=e[7],h=e[8];return t*a*h-t*o*c-n*s*h+n*o*l+i*s*c-i*a*l}invert(){const e=this.elements,t=e[0],n=e[1],i=e[2],s=e[3],a=e[4],o=e[5],l=e[6],c=e[7],h=e[8],u=h*a-o*c,d=o*l-h*s,f=c*s-a*l,m=t*u+n*d+i*f;if(m===0)return this.set(0,0,0,0,0,0,0,0,0);const _=1/m;return e[0]=u*_,e[1]=(i*c-h*n)*_,e[2]=(o*n-i*a)*_,e[3]=d*_,e[4]=(h*t-i*l)*_,e[5]=(i*s-o*t)*_,e[6]=f*_,e[7]=(n*l-c*t)*_,e[8]=(a*t-n*s)*_,this}transpose(){let e;const t=this.elements;return e=t[1],t[1]=t[3],t[3]=e,e=t[2],t[2]=t[6],t[6]=e,e=t[5],t[5]=t[7],t[7]=e,this}getNormalMatrix(e){return this.setFromMatrix4(e).invert().transpose()}transposeIntoArray(e){const t=this.elements;return e[0]=t[0],e[1]=t[3],e[2]=t[6],e[3]=t[1],e[4]=t[4],e[5]=t[7],e[6]=t[2],e[7]=t[5],e[8]=t[8],this}setUvTransform(e,t,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+e,-i*c,i*l,-i*(-c*a+l*o)+o+t,0,0,1),this}scale(e,t){return this.premultiply(La.makeScale(e,t)),this}rotate(e){return this.premultiply(La.makeRotation(-e)),this}translate(e,t){return this.premultiply(La.makeTranslation(e,t)),this}makeTranslation(e,t){return e.isVector2?this.set(1,0,e.x,0,1,e.y,0,0,1):this.set(1,0,e,0,1,t,0,0,1),this}makeRotation(e){const t=Math.cos(e),n=Math.sin(e);return this.set(t,-n,0,n,t,0,0,0,1),this}makeScale(e,t){return this.set(e,0,0,0,t,0,0,0,1),this}equals(e){const t=this.elements,n=e.elements;for(let i=0;i<9;i++)if(t[i]!==n[i])return!1;return!0}fromArray(e,t=0){for(let n=0;n<9;n++)this.elements[n]=e[n+t];return this}toArray(e=[],t=0){const n=this.elements;return e[t]=n[0],e[t+1]=n[1],e[t+2]=n[2],e[t+3]=n[3],e[t+4]=n[4],e[t+5]=n[5],e[t+6]=n[6],e[t+7]=n[7],e[t+8]=n[8],e}clone(){return new this.constructor().fromArray(this.elements)}}const La=new Ye,Ac=new Ye().set(.4123908,.3575843,.1804808,.212639,.7151687,.0721923,.0193308,.1191948,.9505322),Tc=new Ye().set(3.2409699,-1.5373832,-.4986108,-.9692436,1.8759675,.0415551,.0556301,-.203977,1.0569715);function of(){const r={enabled:!0,workingColorSpace:ls,spaces:{},convert:function(i,s,a){return this.enabled===!1||s===a||!s||!a||(this.spaces[s].transfer===rt&&(i.r=On(i.r),i.g=On(i.g),i.b=On(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===rt&&(i.r=ss(i.r),i.g=ss(i.g),i.b=ss(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===$n?ra:this.spaces[i].transfer},getToneMappingMode:function(i){return this.spaces[i].outputColorSpaceConfig.toneMappingMode||"standard"},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 Ws("ColorManagement: .fromWorkingColorSpace() has been renamed to .workingToColorSpace()."),r.workingToColorSpace(i,s)},toWorkingColorSpace:function(i,s){return Ws("ColorManagement: .toWorkingColorSpace() has been renamed to .colorSpaceToWorking()."),r.colorSpaceToWorking(i,s)}},e=[.64,.33,.3,.6,.15,.06],t=[.2126,.7152,.0722],n=[.3127,.329];return r.define({[ls]:{primaries:e,whitePoint:n,transfer:ra,toXYZ:Ac,fromXYZ:Tc,luminanceCoefficients:t,workingColorSpaceConfig:{unpackColorSpace:Kt},outputColorSpaceConfig:{drawingBufferColorSpace:Kt}},[Kt]:{primaries:e,whitePoint:n,transfer:rt,toXYZ:Ac,fromXYZ:Tc,luminanceCoefficients:t,outputColorSpaceConfig:{drawingBufferColorSpace:Kt}}}),r}const je=of();function On(r){return r<.04045?r*.0773993808:Math.pow(r*.9478672986+.0521327014,2.4)}function ss(r){return r<.0031308?r*12.92:1.055*Math.pow(r,.41666)-.055}let Di;class lf{static getDataURL(e,t="image/png"){if(/^data:/i.test(e.src)||typeof HTMLCanvasElement=="undefined")return e.src;let n;if(e instanceof HTMLCanvasElement)n=e;else{Di===void 0&&(Di=Hs("canvas")),Di.width=e.width,Di.height=e.height;const i=Di.getContext("2d");e instanceof ImageData?i.putImageData(e,0,0):i.drawImage(e,0,0,e.width,e.height),n=Di}return n.toDataURL(t)}static sRGBToLinear(e){if(typeof HTMLImageElement!="undefined"&&e instanceof HTMLImageElement||typeof HTMLCanvasElement!="undefined"&&e instanceof HTMLCanvasElement||typeof ImageBitmap!="undefined"&&e instanceof ImageBitmap){const t=Hs("canvas");t.width=e.width,t.height=e.height;const n=t.getContext("2d");n.drawImage(e,0,0,e.width,e.height);const i=n.getImageData(0,0,e.width,e.height),s=i.data;for(let a=0;a<s.length;a++)s[a]=On(s[a]/255)*255;return n.putImageData(i,0,0),t}else if(e.data){const t=e.data.slice(0);for(let n=0;n<t.length;n++)t instanceof Uint8Array||t instanceof Uint8ClampedArray?t[n]=Math.floor(On(t[n]/255)*255):t[n]=On(t[n]);return{data:t,width:e.width,height:e.height}}else return de("ImageUtils.sRGBToLinear(): Unsupported image type. No color space conversion applied."),e}}let cf=0;class Mi{constructor(e=null){this.isSource=!0,Object.defineProperty(this,"id",{value:cf++}),this.uuid=tn(),this.data=e,this.dataReady=!0,this.version=0}getSize(e){const t=this.data;return typeof HTMLVideoElement!="undefined"&&t instanceof HTMLVideoElement?e.set(t.videoWidth,t.videoHeight,0):typeof VideoFrame!="undefined"&&t instanceof VideoFrame?e.set(t.displayHeight,t.displayWidth,0):t!==null?e.set(t.width,t.height,t.depth||0):e.set(0,0,0),e}set needsUpdate(e){e===!0&&this.version++}toJSON(e){const t=e===void 0||typeof e=="string";if(!t&&e.images[this.uuid]!==void 0)return e.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(Da(i[a].image)):s.push(Da(i[a]))}else s=Da(i);n.url=s}return t||(e.images[this.uuid]=n),n}}function Da(r){return typeof HTMLImageElement!="undefined"&&r instanceof HTMLImageElement||typeof HTMLCanvasElement!="undefined"&&r instanceof HTMLCanvasElement||typeof ImageBitmap!="undefined"&&r instanceof ImageBitmap?lf.getDataURL(r):r.data?{data:Array.from(r.data),width:r.width,height:r.height,type:r.data.constructor.name}:(de("Texture: Unable to serialize Texture."),{})}let hf=0;const Ua=new R;class Mt extends kn{constructor(e=Mt.DEFAULT_IMAGE,t=Mt.DEFAULT_MAPPING,n=en,i=en,s=mt,a=Un,o=Wt,l=Qt,c=Mt.DEFAULT_ANISOTROPY,h=$n){super(),this.isTexture=!0,Object.defineProperty(this,"id",{value:hf++}),this.uuid=tn(),this.name="",this.source=new Mi(e),this.mipmaps=[],this.mapping=t,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 Ye,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=!!(e&&e.depth&&e.depth>1),this.pmremVersion=0}get width(){return this.source.getSize(Ua).x}get height(){return this.source.getSize(Ua).y}get depth(){return this.source.getSize(Ua).z}get image(){return this.source.data}set image(e=null){this.source.data=e}updateMatrix(){this.matrix.setUvTransform(this.offset.x,this.offset.y,this.repeat.x,this.repeat.y,this.rotation,this.center.x,this.center.y)}addUpdateRange(e,t){this.updateRanges.push({start:e,count:t})}clearUpdateRanges(){this.updateRanges.length=0}clone(){return new this.constructor().copy(this)}copy(e){return this.name=e.name,this.source=e.source,this.mipmaps=e.mipmaps.slice(0),this.mapping=e.mapping,this.channel=e.channel,this.wrapS=e.wrapS,this.wrapT=e.wrapT,this.magFilter=e.magFilter,this.minFilter=e.minFilter,this.anisotropy=e.anisotropy,this.format=e.format,this.internalFormat=e.internalFormat,this.type=e.type,this.offset.copy(e.offset),this.repeat.copy(e.repeat),this.center.copy(e.center),this.rotation=e.rotation,this.matrixAutoUpdate=e.matrixAutoUpdate,this.matrix.copy(e.matrix),this.generateMipmaps=e.generateMipmaps,this.premultiplyAlpha=e.premultiplyAlpha,this.flipY=e.flipY,this.unpackAlignment=e.unpackAlignment,this.colorSpace=e.colorSpace,this.renderTarget=e.renderTarget,this.isRenderTargetTexture=e.isRenderTargetTexture,this.isArrayTexture=e.isArrayTexture,this.userData=JSON.parse(JSON.stringify(e.userData)),this.needsUpdate=!0,this}setValues(e){for(const t in e){const n=e[t];if(n===void 0){de(`Texture.setValues(): parameter '${t}' has value of undefined.`);continue}const i=this[t];if(i===void 0){de(`Texture.setValues(): property '${t}' 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[t]=n}}toJSON(e){const t=e===void 0||typeof e=="string";if(!t&&e.textures[this.uuid]!==void 0)return e.textures[this.uuid];const n={metadata:{version:4.7,type:"Texture",generator:"Texture.toJSON"},uuid:this.uuid,name:this.name,image:this.source.toJSON(e).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),t||(e.textures[this.uuid]=n),n}dispose(){this.dispatchEvent({type:"dispose"})}transformUv(e){if(this.mapping!==yl)return e;if(e.applyMatrix3(this.matrix),e.x<0||e.x>1)switch(this.wrapS){case ta:e.x=e.x-Math.floor(e.x);break;case en:e.x=e.x<0?0:1;break;case na:Math.abs(Math.floor(e.x)%2)===1?e.x=Math.ceil(e.x)-e.x:e.x=e.x-Math.floor(e.x);break}if(e.y<0||e.y>1)switch(this.wrapT){case ta:e.y=e.y-Math.floor(e.y);break;case en:e.y=e.y<0?0:1;break;case na:Math.abs(Math.floor(e.y)%2)===1?e.y=Math.ceil(e.y)-e.y:e.y=e.y-Math.floor(e.y);break}return this.flipY&&(e.y=1-e.y),e}set needsUpdate(e){e===!0&&(this.version++,this.source.needsUpdate=!0)}set needsPMREMUpdate(e){e===!0&&this.pmremVersion++}}Mt.DEFAULT_IMAGE=null;Mt.DEFAULT_MAPPING=yl;Mt.DEFAULT_ANISOTROPY=1;class pt{constructor(e=0,t=0,n=0,i=1){pt.prototype.isVector4=!0,this.x=e,this.y=t,this.z=n,this.w=i}get width(){return this.z}set width(e){this.z=e}get height(){return this.w}set height(e){this.w=e}set(e,t,n,i){return this.x=e,this.y=t,this.z=n,this.w=i,this}setScalar(e){return this.x=e,this.y=e,this.z=e,this.w=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setZ(e){return this.z=e,this}setW(e){return this.w=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;case 2:this.z=t;break;case 3:this.w=t;break;default:throw new Error("index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;case 2:return this.z;case 3:return this.w;default:throw new Error("index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y,this.z,this.w)}copy(e){return this.x=e.x,this.y=e.y,this.z=e.z,this.w=e.w!==void 0?e.w:1,this}add(e){return this.x+=e.x,this.y+=e.y,this.z+=e.z,this.w+=e.w,this}addScalar(e){return this.x+=e,this.y+=e,this.z+=e,this.w+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this.z=e.z+t.z,this.w=e.w+t.w,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this.z+=e.z*t,this.w+=e.w*t,this}sub(e){return this.x-=e.x,this.y-=e.y,this.z-=e.z,this.w-=e.w,this}subScalar(e){return this.x-=e,this.y-=e,this.z-=e,this.w-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this.z=e.z-t.z,this.w=e.w-t.w,this}multiply(e){return this.x*=e.x,this.y*=e.y,this.z*=e.z,this.w*=e.w,this}multiplyScalar(e){return this.x*=e,this.y*=e,this.z*=e,this.w*=e,this}applyMatrix4(e){const t=this.x,n=this.y,i=this.z,s=this.w,a=e.elements;return this.x=a[0]*t+a[4]*n+a[8]*i+a[12]*s,this.y=a[1]*t+a[5]*n+a[9]*i+a[13]*s,this.z=a[2]*t+a[6]*n+a[10]*i+a[14]*s,this.w=a[3]*t+a[7]*n+a[11]*i+a[15]*s,this}divide(e){return this.x/=e.x,this.y/=e.y,this.z/=e.z,this.w/=e.w,this}divideScalar(e){return this.multiplyScalar(1/e)}setAxisAngleFromQuaternion(e){this.w=2*Math.acos(e.w);const t=Math.sqrt(1-e.w*e.w);return t<1e-4?(this.x=1,this.y=0,this.z=0):(this.x=e.x/t,this.y=e.y/t,this.z=e.z/t),this}setAxisAngleFromRotationMatrix(e){let t,n,i,s;const l=e.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;t=Math.PI;const x=(c+1)/2,M=(f+1)/2,T=(p+1)/2,E=(h+d)/4,C=(u+_)/4,P=(m+g)/4;return x>M&&x>T?x<.01?(n=0,i=.707106781,s=.707106781):(n=Math.sqrt(x),i=E/n,s=C/n):M>T?M<.01?(n=.707106781,i=0,s=.707106781):(i=Math.sqrt(M),n=E/i,s=P/i):T<.01?(n=.707106781,i=.707106781,s=0):(s=Math.sqrt(T),n=C/s,i=P/s),this.set(n,i,s,t),this}let v=Math.sqrt((g-m)*(g-m)+(u-_)*(u-_)+(d-h)*(d-h));return Math.abs(v)<.001&&(v=1),this.x=(g-m)/v,this.y=(u-_)/v,this.z=(d-h)/v,this.w=Math.acos((c+f+p-1)/2),this}setFromMatrixPosition(e){const t=e.elements;return this.x=t[12],this.y=t[13],this.z=t[14],this.w=t[15],this}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this.z=Math.min(this.z,e.z),this.w=Math.min(this.w,e.w),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this.z=Math.max(this.z,e.z),this.w=Math.max(this.w,e.w),this}clamp(e,t){return this.x=ze(this.x,e.x,t.x),this.y=ze(this.y,e.y,t.y),this.z=ze(this.z,e.z,t.z),this.w=ze(this.w,e.w,t.w),this}clampScalar(e,t){return this.x=ze(this.x,e,t),this.y=ze(this.y,e,t),this.z=ze(this.z,e,t),this.w=ze(this.w,e,t),this}clampLength(e,t){const n=this.length();return this.divideScalar(n||1).multiplyScalar(ze(n,e,t))}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(e){return this.x*e.x+this.y*e.y+this.z*e.z+this.w*e.w}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)+Math.abs(this.w)}normalize(){return this.divideScalar(this.length()||1)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this.z+=(e.z-this.z)*t,this.w+=(e.w-this.w)*t,this}lerpVectors(e,t,n){return this.x=e.x+(t.x-e.x)*n,this.y=e.y+(t.y-e.y)*n,this.z=e.z+(t.z-e.z)*n,this.w=e.w+(t.w-e.w)*n,this}equals(e){return e.x===this.x&&e.y===this.y&&e.z===this.z&&e.w===this.w}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this.z=e[t+2],this.w=e[t+3],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e[t+2]=this.z,e[t+3]=this.w,e}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this.z=e.getZ(t),this.w=e.getW(t),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this.w=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z,yield this.w}}class pu extends kn{constructor(e=1,t=1,n={}){super(),n=Object.assign({generateMipmaps:!1,internalFormat:null,minFilter:mt,depthBuffer:!0,stencilBuffer:!1,resolveDepthBuffer:!0,resolveStencilBuffer:!0,depthTexture:null,samples:0,count:1,depth:1,multiview:!1},n),this.isRenderTarget=!0,this.width=e,this.height=t,this.depth=n.depth,this.scissor=new pt(0,0,e,t),this.scissorTest=!1,this.viewport=new pt(0,0,e,t);const i={width:e,height:t,depth:n.depth},s=new Mt(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(e={}){const t={minFilter:mt,generateMipmaps:!1,flipY:!1,internalFormat:null};e.mapping!==void 0&&(t.mapping=e.mapping),e.wrapS!==void 0&&(t.wrapS=e.wrapS),e.wrapT!==void 0&&(t.wrapT=e.wrapT),e.wrapR!==void 0&&(t.wrapR=e.wrapR),e.magFilter!==void 0&&(t.magFilter=e.magFilter),e.minFilter!==void 0&&(t.minFilter=e.minFilter),e.format!==void 0&&(t.format=e.format),e.type!==void 0&&(t.type=e.type),e.anisotropy!==void 0&&(t.anisotropy=e.anisotropy),e.colorSpace!==void 0&&(t.colorSpace=e.colorSpace),e.flipY!==void 0&&(t.flipY=e.flipY),e.generateMipmaps!==void 0&&(t.generateMipmaps=e.generateMipmaps),e.internalFormat!==void 0&&(t.internalFormat=e.internalFormat);for(let n=0;n<this.textures.length;n++)this.textures[n].setValues(t)}get texture(){return this.textures[0]}set texture(e){this.textures[0]=e}set depthTexture(e){this._depthTexture!==null&&(this._depthTexture.renderTarget=null),e!==null&&(e.renderTarget=this),this._depthTexture=e}get depthTexture(){return this._depthTexture}setSize(e,t,n=1){if(this.width!==e||this.height!==t||this.depth!==n){this.width=e,this.height=t,this.depth=n;for(let i=0,s=this.textures.length;i<s;i++)this.textures[i].image.width=e,this.textures[i].image.height=t,this.textures[i].image.depth=n,this.textures[i].isData3DTexture!==!0&&(this.textures[i].isArrayTexture=this.textures[i].image.depth>1);this.dispose()}this.viewport.set(0,0,e,t),this.scissor.set(0,0,e,t)}clone(){return new this.constructor().copy(this)}copy(e){this.width=e.width,this.height=e.height,this.depth=e.depth,this.scissor.copy(e.scissor),this.scissorTest=e.scissorTest,this.viewport.copy(e.viewport),this.textures.length=0;for(let t=0,n=e.textures.length;t<n;t++){this.textures[t]=e.textures[t].clone(),this.textures[t].isRenderTargetTexture=!0,this.textures[t].renderTarget=this;const i=Object.assign({},e.textures[t].image);this.textures[t].source=new Mi(i)}return this.depthBuffer=e.depthBuffer,this.stencilBuffer=e.stencilBuffer,this.resolveDepthBuffer=e.resolveDepthBuffer,this.resolveStencilBuffer=e.resolveStencilBuffer,e.depthTexture!==null&&(this.depthTexture=e.depthTexture.clone()),this.samples=e.samples,this}dispose(){this.dispatchEvent({type:"dispose"})}}class ln extends pu{constructor(e=1,t=1,n={}){super(e,t,n),this.isWebGLRenderTarget=!0}}class Pl extends Mt{constructor(e=null,t=1,n=1,i=1){super(null),this.isDataArrayTexture=!0,this.image={data:e,width:t,height:n,depth:i},this.magFilter=bt,this.minFilter=bt,this.wrapR=en,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1,this.layerUpdates=new Set}addLayerUpdate(e){this.layerUpdates.add(e)}clearLayerUpdates(){this.layerUpdates.clear()}}class Sy extends ln{constructor(e=1,t=1,n=1,i={}){super(e,t,i),this.isWebGLArrayRenderTarget=!0,this.depth=n,this.texture=new Pl(null,e,t,n),this._setTextureOptions(i),this.texture.isRenderTargetTexture=!0}}class Ll extends Mt{constructor(e=null,t=1,n=1,i=1){super(null),this.isData3DTexture=!0,this.image={data:e,width:t,height:n,depth:i},this.magFilter=bt,this.minFilter=bt,this.wrapR=en,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}}class by extends ln{constructor(e=1,t=1,n=1,i={}){super(e,t,i),this.isWebGL3DRenderTarget=!0,this.depth=n,this.texture=new Ll(null,e,t,n),this._setTextureOptions(i),this.texture.isRenderTargetTexture=!0}}class Ot{constructor(e=new R(1/0,1/0,1/0),t=new R(-1/0,-1/0,-1/0)){this.isBox3=!0,this.min=e,this.max=t}set(e,t){return this.min.copy(e),this.max.copy(t),this}setFromArray(e){this.makeEmpty();for(let t=0,n=e.length;t<n;t+=3)this.expandByPoint(hn.fromArray(e,t));return this}setFromBufferAttribute(e){this.makeEmpty();for(let t=0,n=e.count;t<n;t++)this.expandByPoint(hn.fromBufferAttribute(e,t));return this}setFromPoints(e){this.makeEmpty();for(let t=0,n=e.length;t<n;t++)this.expandByPoint(e[t]);return this}setFromCenterAndSize(e,t){const n=hn.copy(t).multiplyScalar(.5);return this.min.copy(e).sub(n),this.max.copy(e).add(n),this}setFromObject(e,t=!1){return this.makeEmpty(),this.expandByObject(e,t)}clone(){return new this.constructor().copy(this)}copy(e){return this.min.copy(e.min),this.max.copy(e.max),this}makeEmpty(){return this.min.x=this.min.y=this.min.z=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(e){return this.isEmpty()?e.set(0,0,0):e.addVectors(this.min,this.max).multiplyScalar(.5)}getSize(e){return this.isEmpty()?e.set(0,0,0):e.subVectors(this.max,this.min)}expandByPoint(e){return this.min.min(e),this.max.max(e),this}expandByVector(e){return this.min.sub(e),this.max.add(e),this}expandByScalar(e){return this.min.addScalar(-e),this.max.addScalar(e),this}expandByObject(e,t=!1){e.updateWorldMatrix(!1,!1);const n=e.geometry;if(n!==void 0){const s=n.getAttribute("position");if(t===!0&&s!==void 0&&e.isInstancedMesh!==!0)for(let a=0,o=s.count;a<o;a++)e.isMesh===!0?e.getVertexPosition(a,hn):hn.fromBufferAttribute(s,a),hn.applyMatrix4(e.matrixWorld),this.expandByPoint(hn);else e.boundingBox!==void 0?(e.boundingBox===null&&e.computeBoundingBox(),nr.copy(e.boundingBox)):(n.boundingBox===null&&n.computeBoundingBox(),nr.copy(n.boundingBox)),nr.applyMatrix4(e.matrixWorld),this.union(nr)}const i=e.children;for(let s=0,a=i.length;s<a;s++)this.expandByObject(i[s],t);return this}containsPoint(e){return e.x>=this.min.x&&e.x<=this.max.x&&e.y>=this.min.y&&e.y<=this.max.y&&e.z>=this.min.z&&e.z<=this.max.z}containsBox(e){return this.min.x<=e.min.x&&e.max.x<=this.max.x&&this.min.y<=e.min.y&&e.max.y<=this.max.y&&this.min.z<=e.min.z&&e.max.z<=this.max.z}getParameter(e,t){return t.set((e.x-this.min.x)/(this.max.x-this.min.x),(e.y-this.min.y)/(this.max.y-this.min.y),(e.z-this.min.z)/(this.max.z-this.min.z))}intersectsBox(e){return e.max.x>=this.min.x&&e.min.x<=this.max.x&&e.max.y>=this.min.y&&e.min.y<=this.max.y&&e.max.z>=this.min.z&&e.min.z<=this.max.z}intersectsSphere(e){return this.clampPoint(e.center,hn),hn.distanceToSquared(e.center)<=e.radius*e.radius}intersectsPlane(e){let t,n;return e.normal.x>0?(t=e.normal.x*this.min.x,n=e.normal.x*this.max.x):(t=e.normal.x*this.max.x,n=e.normal.x*this.min.x),e.normal.y>0?(t+=e.normal.y*this.min.y,n+=e.normal.y*this.max.y):(t+=e.normal.y*this.max.y,n+=e.normal.y*this.min.y),e.normal.z>0?(t+=e.normal.z*this.min.z,n+=e.normal.z*this.max.z):(t+=e.normal.z*this.max.z,n+=e.normal.z*this.min.z),t<=-e.constant&&n>=-e.constant}intersectsTriangle(e){if(this.isEmpty())return!1;this.getCenter(xs),ir.subVectors(this.max,xs),Ui.subVectors(e.a,xs),Ni.subVectors(e.b,xs),Fi.subVectors(e.c,xs),Hn.subVectors(Ni,Ui),Wn.subVectors(Fi,Ni),ii.subVectors(Ui,Fi);let t=[0,-Hn.z,Hn.y,0,-Wn.z,Wn.y,0,-ii.z,ii.y,Hn.z,0,-Hn.x,Wn.z,0,-Wn.x,ii.z,0,-ii.x,-Hn.y,Hn.x,0,-Wn.y,Wn.x,0,-ii.y,ii.x,0];return!Na(t,Ui,Ni,Fi,ir)||(t=[1,0,0,0,1,0,0,0,1],!Na(t,Ui,Ni,Fi,ir))?!1:(sr.crossVectors(Hn,Wn),t=[sr.x,sr.y,sr.z],Na(t,Ui,Ni,Fi,ir))}clampPoint(e,t){return t.copy(e).clamp(this.min,this.max)}distanceToPoint(e){return this.clampPoint(e,hn).distanceTo(e)}getBoundingSphere(e){return this.isEmpty()?e.makeEmpty():(this.getCenter(e.center),e.radius=this.getSize(hn).length()*.5),e}intersect(e){return this.min.max(e.min),this.max.min(e.max),this.isEmpty()&&this.makeEmpty(),this}union(e){return this.min.min(e.min),this.max.max(e.max),this}applyMatrix4(e){return this.isEmpty()?this:(En[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(e),En[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(e),En[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(e),En[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(e),En[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(e),En[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(e),En[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(e),En[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(e),this.setFromPoints(En),this)}translate(e){return this.min.add(e),this.max.add(e),this}equals(e){return e.min.equals(this.min)&&e.max.equals(this.max)}toJSON(){return{min:this.min.toArray(),max:this.max.toArray()}}fromJSON(e){return this.min.fromArray(e.min),this.max.fromArray(e.max),this}}const En=[new R,new R,new R,new R,new R,new R,new R,new R],hn=new R,nr=new Ot,Ui=new R,Ni=new R,Fi=new R,Hn=new R,Wn=new R,ii=new R,xs=new R,ir=new R,sr=new R,si=new R;function Na(r,e,t,n,i){for(let s=0,a=r.length-3;s<=a;s+=3){si.fromArray(r,s);const o=i.x*Math.abs(si.x)+i.y*Math.abs(si.y)+i.z*Math.abs(si.z),l=e.dot(si),c=t.dot(si),h=n.dot(si);if(Math.max(-Math.max(l,c,h),Math.min(l,c,h))>o)return!1}return!0}const uf=new Ot,vs=new R,Fa=new R;class Lt{constructor(e=new R,t=-1){this.isSphere=!0,this.center=e,this.radius=t}set(e,t){return this.center.copy(e),this.radius=t,this}setFromPoints(e,t){const n=this.center;t!==void 0?n.copy(t):uf.setFromPoints(e).getCenter(n);let i=0;for(let s=0,a=e.length;s<a;s++)i=Math.max(i,n.distanceToSquared(e[s]));return this.radius=Math.sqrt(i),this}copy(e){return this.center.copy(e.center),this.radius=e.radius,this}isEmpty(){return this.radius<0}makeEmpty(){return this.center.set(0,0,0),this.radius=-1,this}containsPoint(e){return e.distanceToSquared(this.center)<=this.radius*this.radius}distanceToPoint(e){return e.distanceTo(this.center)-this.radius}intersectsSphere(e){const t=this.radius+e.radius;return e.center.distanceToSquared(this.center)<=t*t}intersectsBox(e){return e.intersectsSphere(this)}intersectsPlane(e){return Math.abs(e.distanceToPoint(this.center))<=this.radius}clampPoint(e,t){const n=this.center.distanceToSquared(e);return t.copy(e),n>this.radius*this.radius&&(t.sub(this.center).normalize(),t.multiplyScalar(this.radius).add(this.center)),t}getBoundingBox(e){return this.isEmpty()?(e.makeEmpty(),e):(e.set(this.center,this.center),e.expandByScalar(this.radius),e)}applyMatrix4(e){return this.center.applyMatrix4(e),this.radius=this.radius*e.getMaxScaleOnAxis(),this}translate(e){return this.center.add(e),this}expandByPoint(e){if(this.isEmpty())return this.center.copy(e),this.radius=0,this;vs.subVectors(e,this.center);const t=vs.lengthSq();if(t>this.radius*this.radius){const n=Math.sqrt(t),i=(n-this.radius)*.5;this.center.addScaledVector(vs,i/n),this.radius+=i}return this}union(e){return e.isEmpty()?this:this.isEmpty()?(this.copy(e),this):(this.center.equals(e.center)===!0?this.radius=Math.max(this.radius,e.radius):(Fa.subVectors(e.center,this.center).setLength(e.radius),this.expandByPoint(vs.copy(e.center).add(Fa)),this.expandByPoint(vs.copy(e.center).sub(Fa))),this)}equals(e){return e.center.equals(this.center)&&e.radius===this.radius}clone(){return new this.constructor().copy(this)}toJSON(){return{radius:this.radius,center:this.center.toArray()}}fromJSON(e){return this.radius=e.radius,this.center.fromArray(e.center),this}}const wn=new R,Oa=new R,rr=new R,Xn=new R,Ba=new R,ar=new R,za=new R;class Ks{constructor(e=new R,t=new R(0,0,-1)){this.origin=e,this.direction=t}set(e,t){return this.origin.copy(e),this.direction.copy(t),this}copy(e){return this.origin.copy(e.origin),this.direction.copy(e.direction),this}at(e,t){return t.copy(this.origin).addScaledVector(this.direction,e)}lookAt(e){return this.direction.copy(e).sub(this.origin).normalize(),this}recast(e){return this.origin.copy(this.at(e,wn)),this}closestPointToPoint(e,t){t.subVectors(e,this.origin);const n=t.dot(this.direction);return n<0?t.copy(this.origin):t.copy(this.origin).addScaledVector(this.direction,n)}distanceToPoint(e){return Math.sqrt(this.distanceSqToPoint(e))}distanceSqToPoint(e){const t=wn.subVectors(e,this.origin).dot(this.direction);return t<0?this.origin.distanceToSquared(e):(wn.copy(this.origin).addScaledVector(this.direction,t),wn.distanceToSquared(e))}distanceSqToSegment(e,t,n,i){Oa.copy(e).add(t).multiplyScalar(.5),rr.copy(t).sub(e).normalize(),Xn.copy(this.origin).sub(Oa);const s=e.distanceTo(t)*.5,a=-this.direction.dot(rr),o=Xn.dot(this.direction),l=-Xn.dot(rr),c=Xn.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}else 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(Oa).addScaledVector(rr,d),f}intersectSphere(e,t){wn.subVectors(e.center,this.origin);const n=wn.dot(this.direction),i=wn.dot(wn)-n*n,s=e.radius*e.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,t):this.at(o,t)}intersectsSphere(e){return e.radius<0?!1:this.distanceSqToPoint(e.center)<=e.radius*e.radius}distanceToPlane(e){const t=e.normal.dot(this.direction);if(t===0)return e.distanceToPoint(this.origin)===0?0:null;const n=-(this.origin.dot(e.normal)+e.constant)/t;return n>=0?n:null}intersectPlane(e,t){const n=this.distanceToPlane(e);return n===null?null:this.at(n,t)}intersectsPlane(e){const t=e.distanceToPoint(this.origin);return t===0||e.normal.dot(this.direction)*t<0}intersectBox(e,t){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=(e.min.x-d.x)*c,i=(e.max.x-d.x)*c):(n=(e.max.x-d.x)*c,i=(e.min.x-d.x)*c),h>=0?(s=(e.min.y-d.y)*h,a=(e.max.y-d.y)*h):(s=(e.max.y-d.y)*h,a=(e.min.y-d.y)*h),n>a||s>i||((s>n||isNaN(n))&&(n=s),(a<i||isNaN(i))&&(i=a),u>=0?(o=(e.min.z-d.z)*u,l=(e.max.z-d.z)*u):(o=(e.max.z-d.z)*u,l=(e.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,t)}intersectsBox(e){return this.intersectBox(e,wn)!==null}intersectTriangle(e,t,n,i,s){Ba.subVectors(t,e),ar.subVectors(n,e),za.crossVectors(Ba,ar);let a=this.direction.dot(za),o;if(a>0){if(i)return null;o=1}else if(a<0)o=-1,a=-a;else return null;Xn.subVectors(this.origin,e);const l=o*this.direction.dot(ar.crossVectors(Xn,ar));if(l<0)return null;const c=o*this.direction.dot(Ba.cross(Xn));if(c<0||l+c>a)return null;const h=-o*Xn.dot(za);return h<0?null:this.at(h/a,s)}applyMatrix4(e){return this.origin.applyMatrix4(e),this.direction.transformDirection(e),this}equals(e){return e.origin.equals(this.origin)&&e.direction.equals(this.direction)}clone(){return new this.constructor().copy(this)}}class Ge{constructor(e,t,n,i,s,a,o,l,c,h,u,d,f,m,_,g){Ge.prototype.isMatrix4=!0,this.elements=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],e!==void 0&&this.set(e,t,n,i,s,a,o,l,c,h,u,d,f,m,_,g)}set(e,t,n,i,s,a,o,l,c,h,u,d,f,m,_,g){const p=this.elements;return p[0]=e,p[4]=t,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 Ge().fromArray(this.elements)}copy(e){const t=this.elements,n=e.elements;return t[0]=n[0],t[1]=n[1],t[2]=n[2],t[3]=n[3],t[4]=n[4],t[5]=n[5],t[6]=n[6],t[7]=n[7],t[8]=n[8],t[9]=n[9],t[10]=n[10],t[11]=n[11],t[12]=n[12],t[13]=n[13],t[14]=n[14],t[15]=n[15],this}copyPosition(e){const t=this.elements,n=e.elements;return t[12]=n[12],t[13]=n[13],t[14]=n[14],this}setFromMatrix3(e){const t=e.elements;return this.set(t[0],t[3],t[6],0,t[1],t[4],t[7],0,t[2],t[5],t[8],0,0,0,0,1),this}extractBasis(e,t,n){return this.determinant()===0?(e.set(1,0,0),t.set(0,1,0),n.set(0,0,1),this):(e.setFromMatrixColumn(this,0),t.setFromMatrixColumn(this,1),n.setFromMatrixColumn(this,2),this)}makeBasis(e,t,n){return this.set(e.x,t.x,n.x,0,e.y,t.y,n.y,0,e.z,t.z,n.z,0,0,0,0,1),this}extractRotation(e){if(e.determinant()===0)return this.identity();const t=this.elements,n=e.elements,i=1/Oi.setFromMatrixColumn(e,0).length(),s=1/Oi.setFromMatrixColumn(e,1).length(),a=1/Oi.setFromMatrixColumn(e,2).length();return t[0]=n[0]*i,t[1]=n[1]*i,t[2]=n[2]*i,t[3]=0,t[4]=n[4]*s,t[5]=n[5]*s,t[6]=n[6]*s,t[7]=0,t[8]=n[8]*a,t[9]=n[9]*a,t[10]=n[10]*a,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this}makeRotationFromEuler(e){const t=this.elements,n=e.x,i=e.y,s=e.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(e.order==="XYZ"){const d=a*h,f=a*u,m=o*h,_=o*u;t[0]=l*h,t[4]=-l*u,t[8]=c,t[1]=f+m*c,t[5]=d-_*c,t[9]=-o*l,t[2]=_-d*c,t[6]=m+f*c,t[10]=a*l}else if(e.order==="YXZ"){const d=l*h,f=l*u,m=c*h,_=c*u;t[0]=d+_*o,t[4]=m*o-f,t[8]=a*c,t[1]=a*u,t[5]=a*h,t[9]=-o,t[2]=f*o-m,t[6]=_+d*o,t[10]=a*l}else if(e.order==="ZXY"){const d=l*h,f=l*u,m=c*h,_=c*u;t[0]=d-_*o,t[4]=-a*u,t[8]=m+f*o,t[1]=f+m*o,t[5]=a*h,t[9]=_-d*o,t[2]=-a*c,t[6]=o,t[10]=a*l}else if(e.order==="ZYX"){const d=a*h,f=a*u,m=o*h,_=o*u;t[0]=l*h,t[4]=m*c-f,t[8]=d*c+_,t[1]=l*u,t[5]=_*c+d,t[9]=f*c-m,t[2]=-c,t[6]=o*l,t[10]=a*l}else if(e.order==="YZX"){const d=a*l,f=a*c,m=o*l,_=o*c;t[0]=l*h,t[4]=_-d*u,t[8]=m*u+f,t[1]=u,t[5]=a*h,t[9]=-o*h,t[2]=-c*h,t[6]=f*u+m,t[10]=d-_*u}else if(e.order==="XZY"){const d=a*l,f=a*c,m=o*l,_=o*c;t[0]=l*h,t[4]=-u,t[8]=c*h,t[1]=d*u+_,t[5]=a*h,t[9]=f*u-m,t[2]=m*u-f,t[6]=o*h,t[10]=_*u+d}return t[3]=0,t[7]=0,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this}makeRotationFromQuaternion(e){return this.compose(df,e,ff)}lookAt(e,t,n){const i=this.elements;return Jt.subVectors(e,t),Jt.lengthSq()===0&&(Jt.z=1),Jt.normalize(),qn.crossVectors(n,Jt),qn.lengthSq()===0&&(Math.abs(n.z)===1?Jt.x+=1e-4:Jt.z+=1e-4,Jt.normalize(),qn.crossVectors(n,Jt)),qn.normalize(),or.crossVectors(Jt,qn),i[0]=qn.x,i[4]=or.x,i[8]=Jt.x,i[1]=qn.y,i[5]=or.y,i[9]=Jt.y,i[2]=qn.z,i[6]=or.z,i[10]=Jt.z,this}multiply(e){return this.multiplyMatrices(this,e)}premultiply(e){return this.multiplyMatrices(e,this)}multiplyMatrices(e,t){const n=e.elements,i=t.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],v=n[3],x=n[7],M=n[11],T=n[15],E=i[0],C=i[4],P=i[8],S=i[12],b=i[1],L=i[5],F=i[9],B=i[13],G=i[2],q=i[6],V=i[10],H=i[14],j=i[3],pe=i[7],oe=i[11],he=i[15];return s[0]=a*E+o*b+l*G+c*j,s[4]=a*C+o*L+l*q+c*pe,s[8]=a*P+o*F+l*V+c*oe,s[12]=a*S+o*B+l*H+c*he,s[1]=h*E+u*b+d*G+f*j,s[5]=h*C+u*L+d*q+f*pe,s[9]=h*P+u*F+d*V+f*oe,s[13]=h*S+u*B+d*H+f*he,s[2]=m*E+_*b+g*G+p*j,s[6]=m*C+_*L+g*q+p*pe,s[10]=m*P+_*F+g*V+p*oe,s[14]=m*S+_*B+g*H+p*he,s[3]=v*E+x*b+M*G+T*j,s[7]=v*C+x*L+M*q+T*pe,s[11]=v*P+x*F+M*V+T*oe,s[15]=v*S+x*B+M*H+T*he,this}multiplyScalar(e){const t=this.elements;return t[0]*=e,t[4]*=e,t[8]*=e,t[12]*=e,t[1]*=e,t[5]*=e,t[9]*=e,t[13]*=e,t[2]*=e,t[6]*=e,t[10]*=e,t[14]*=e,t[3]*=e,t[7]*=e,t[11]*=e,t[15]*=e,this}determinant(){const e=this.elements,t=e[0],n=e[4],i=e[8],s=e[12],a=e[1],o=e[5],l=e[9],c=e[13],h=e[2],u=e[6],d=e[10],f=e[14],m=e[3],_=e[7],g=e[11],p=e[15],v=l*f-c*d,x=o*f-c*u,M=o*d-l*u,T=a*f-c*h,E=a*d-l*h,C=a*u-o*h;return t*(_*v-g*x+p*M)-n*(m*v-g*T+p*E)+i*(m*x-_*T+p*C)-s*(m*M-_*E+g*C)}transpose(){const e=this.elements;let t;return t=e[1],e[1]=e[4],e[4]=t,t=e[2],e[2]=e[8],e[8]=t,t=e[6],e[6]=e[9],e[9]=t,t=e[3],e[3]=e[12],e[12]=t,t=e[7],e[7]=e[13],e[13]=t,t=e[11],e[11]=e[14],e[14]=t,this}setPosition(e,t,n){const i=this.elements;return e.isVector3?(i[12]=e.x,i[13]=e.y,i[14]=e.z):(i[12]=e,i[13]=t,i[14]=n),this}invert(){const e=this.elements,t=e[0],n=e[1],i=e[2],s=e[3],a=e[4],o=e[5],l=e[6],c=e[7],h=e[8],u=e[9],d=e[10],f=e[11],m=e[12],_=e[13],g=e[14],p=e[15],v=u*g*c-_*d*c+_*l*f-o*g*f-u*l*p+o*d*p,x=m*d*c-h*g*c-m*l*f+a*g*f+h*l*p-a*d*p,M=h*_*c-m*u*c+m*o*f-a*_*f-h*o*p+a*u*p,T=m*u*l-h*_*l-m*o*d+a*_*d+h*o*g-a*u*g,E=t*v+n*x+i*M+s*T;if(E===0)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);const C=1/E;return e[0]=v*C,e[1]=(_*d*s-u*g*s-_*i*f+n*g*f+u*i*p-n*d*p)*C,e[2]=(o*g*s-_*l*s+_*i*c-n*g*c-o*i*p+n*l*p)*C,e[3]=(u*l*s-o*d*s-u*i*c+n*d*c+o*i*f-n*l*f)*C,e[4]=x*C,e[5]=(h*g*s-m*d*s+m*i*f-t*g*f-h*i*p+t*d*p)*C,e[6]=(m*l*s-a*g*s-m*i*c+t*g*c+a*i*p-t*l*p)*C,e[7]=(a*d*s-h*l*s+h*i*c-t*d*c-a*i*f+t*l*f)*C,e[8]=M*C,e[9]=(m*u*s-h*_*s-m*n*f+t*_*f+h*n*p-t*u*p)*C,e[10]=(a*_*s-m*o*s+m*n*c-t*_*c-a*n*p+t*o*p)*C,e[11]=(h*o*s-a*u*s-h*n*c+t*u*c+a*n*f-t*o*f)*C,e[12]=T*C,e[13]=(h*_*i-m*u*i+m*n*d-t*_*d-h*n*g+t*u*g)*C,e[14]=(m*o*i-a*_*i-m*n*l+t*_*l+a*n*g-t*o*g)*C,e[15]=(a*u*i-h*o*i+h*n*l-t*u*l-a*n*d+t*o*d)*C,this}scale(e){const t=this.elements,n=e.x,i=e.y,s=e.z;return t[0]*=n,t[4]*=i,t[8]*=s,t[1]*=n,t[5]*=i,t[9]*=s,t[2]*=n,t[6]*=i,t[10]*=s,t[3]*=n,t[7]*=i,t[11]*=s,this}getMaxScaleOnAxis(){const e=this.elements,t=e[0]*e[0]+e[1]*e[1]+e[2]*e[2],n=e[4]*e[4]+e[5]*e[5]+e[6]*e[6],i=e[8]*e[8]+e[9]*e[9]+e[10]*e[10];return Math.sqrt(Math.max(t,n,i))}makeTranslation(e,t,n){return e.isVector3?this.set(1,0,0,e.x,0,1,0,e.y,0,0,1,e.z,0,0,0,1):this.set(1,0,0,e,0,1,0,t,0,0,1,n,0,0,0,1),this}makeRotationX(e){const t=Math.cos(e),n=Math.sin(e);return this.set(1,0,0,0,0,t,-n,0,0,n,t,0,0,0,0,1),this}makeRotationY(e){const t=Math.cos(e),n=Math.sin(e);return this.set(t,0,n,0,0,1,0,0,-n,0,t,0,0,0,0,1),this}makeRotationZ(e){const t=Math.cos(e),n=Math.sin(e);return this.set(t,-n,0,0,n,t,0,0,0,0,1,0,0,0,0,1),this}makeRotationAxis(e,t){const n=Math.cos(t),i=Math.sin(t),s=1-n,a=e.x,o=e.y,l=e.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(e,t,n){return this.set(e,0,0,0,0,t,0,0,0,0,n,0,0,0,0,1),this}makeShear(e,t,n,i,s,a){return this.set(1,n,s,0,e,1,a,0,t,i,1,0,0,0,0,1),this}compose(e,t,n){const i=this.elements,s=t._x,a=t._y,o=t._z,l=t._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,v=l*c,x=l*h,M=l*u,T=n.x,E=n.y,C=n.z;return i[0]=(1-(_+p))*T,i[1]=(f+M)*T,i[2]=(m-x)*T,i[3]=0,i[4]=(f-M)*E,i[5]=(1-(d+p))*E,i[6]=(g+v)*E,i[7]=0,i[8]=(m+x)*C,i[9]=(g-v)*C,i[10]=(1-(d+_))*C,i[11]=0,i[12]=e.x,i[13]=e.y,i[14]=e.z,i[15]=1,this}decompose(e,t,n){const i=this.elements;if(e.x=i[12],e.y=i[13],e.z=i[14],this.determinant()===0)return n.set(1,1,1),t.identity(),this;let s=Oi.set(i[0],i[1],i[2]).length();const a=Oi.set(i[4],i[5],i[6]).length(),o=Oi.set(i[8],i[9],i[10]).length();this.determinant()<0&&(s=-s),un.copy(this);const c=1/s,h=1/a,u=1/o;return un.elements[0]*=c,un.elements[1]*=c,un.elements[2]*=c,un.elements[4]*=h,un.elements[5]*=h,un.elements[6]*=h,un.elements[8]*=u,un.elements[9]*=u,un.elements[10]*=u,t.setFromRotationMatrix(un),n.x=s,n.y=a,n.z=o,this}makePerspective(e,t,n,i,s,a,o=on,l=!1){const c=this.elements,h=2*s/(t-e),u=2*s/(n-i),d=(t+e)/(t-e),f=(n+i)/(n-i);let m,_;if(l)m=s/(a-s),_=a*s/(a-s);else if(o===on)m=-(a+s)/(a-s),_=-2*a*s/(a-s);else if(o===Gs)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(e,t,n,i,s,a,o=on,l=!1){const c=this.elements,h=2/(t-e),u=2/(n-i),d=-(t+e)/(t-e),f=-(n+i)/(n-i);let m,_;if(l)m=1/(a-s),_=a/(a-s);else if(o===on)m=-2/(a-s),_=-(a+s)/(a-s);else if(o===Gs)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(e){const t=this.elements,n=e.elements;for(let i=0;i<16;i++)if(t[i]!==n[i])return!1;return!0}fromArray(e,t=0){for(let n=0;n<16;n++)this.elements[n]=e[n+t];return this}toArray(e=[],t=0){const n=this.elements;return e[t]=n[0],e[t+1]=n[1],e[t+2]=n[2],e[t+3]=n[3],e[t+4]=n[4],e[t+5]=n[5],e[t+6]=n[6],e[t+7]=n[7],e[t+8]=n[8],e[t+9]=n[9],e[t+10]=n[10],e[t+11]=n[11],e[t+12]=n[12],e[t+13]=n[13],e[t+14]=n[14],e[t+15]=n[15],e}}const Oi=new R,un=new Ge,df=new R(0,0,0),ff=new R(1,1,1),qn=new R,or=new R,Jt=new R,Ec=new Ge,wc=new nn;class cn{constructor(e=0,t=0,n=0,i=cn.DEFAULT_ORDER){this.isEuler=!0,this._x=e,this._y=t,this._z=n,this._order=i}get x(){return this._x}set x(e){this._x=e,this._onChangeCallback()}get y(){return this._y}set y(e){this._y=e,this._onChangeCallback()}get z(){return this._z}set z(e){this._z=e,this._onChangeCallback()}get order(){return this._order}set order(e){this._order=e,this._onChangeCallback()}set(e,t,n,i=this._order){return this._x=e,this._y=t,this._z=n,this._order=i,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._order)}copy(e){return this._x=e._x,this._y=e._y,this._z=e._z,this._order=e._order,this._onChangeCallback(),this}setFromRotationMatrix(e,t=this._order,n=!0){const i=e.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(t){case"XYZ":this._y=Math.asin(ze(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(-ze(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(ze(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(-ze(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(ze(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(-ze(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:de("Euler: .setFromRotationMatrix() encountered an unknown order: "+t)}return this._order=t,n===!0&&this._onChangeCallback(),this}setFromQuaternion(e,t,n){return Ec.makeRotationFromQuaternion(e),this.setFromRotationMatrix(Ec,t,n)}setFromVector3(e,t=this._order){return this.set(e.x,e.y,e.z,t)}reorder(e){return wc.setFromEuler(this),this.setFromQuaternion(wc,e)}equals(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._order===this._order}fromArray(e){return this._x=e[0],this._y=e[1],this._z=e[2],e[3]!==void 0&&(this._order=e[3]),this._onChangeCallback(),this}toArray(e=[],t=0){return e[t]=this._x,e[t+1]=this._y,e[t+2]=this._z,e[t+3]=this._order,e}_onChange(e){return this._onChangeCallback=e,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._order}}cn.DEFAULT_ORDER="XYZ";class Dl{constructor(){this.mask=1}set(e){this.mask=(1<<e|0)>>>0}enable(e){this.mask|=1<<e|0}enableAll(){this.mask=-1}toggle(e){this.mask^=1<<e|0}disable(e){this.mask&=~(1<<e|0)}disableAll(){this.mask=0}test(e){return(this.mask&e.mask)!==0}isEnabled(e){return(this.mask&(1<<e|0))!==0}}let pf=0;const Cc=new R,Bi=new nn,Cn=new Ge,lr=new R,ys=new R,mf=new R,gf=new nn,Rc=new R(1,0,0),Ic=new R(0,1,0),Pc=new R(0,0,1),Lc={type:"added"},_f={type:"removed"},zi={type:"childadded",child:null},Va={type:"childremoved",child:null};class nt extends kn{constructor(){super(),this.isObject3D=!0,Object.defineProperty(this,"id",{value:pf++}),this.uuid=tn(),this.name="",this.type="Object3D",this.parent=null,this.children=[],this.up=nt.DEFAULT_UP.clone();const e=new R,t=new cn,n=new nn,i=new R(1,1,1);function s(){n.setFromEuler(t,!1)}function a(){t.setFromQuaternion(n,void 0,!1)}t._onChange(s),n._onChange(a),Object.defineProperties(this,{position:{configurable:!0,enumerable:!0,value:e},rotation:{configurable:!0,enumerable:!0,value:t},quaternion:{configurable:!0,enumerable:!0,value:n},scale:{configurable:!0,enumerable:!0,value:i},modelViewMatrix:{value:new Ge},normalMatrix:{value:new Ye}}),this.matrix=new Ge,this.matrixWorld=new Ge,this.matrixAutoUpdate=nt.DEFAULT_MATRIX_AUTO_UPDATE,this.matrixWorldAutoUpdate=nt.DEFAULT_MATRIX_WORLD_AUTO_UPDATE,this.matrixWorldNeedsUpdate=!1,this.layers=new Dl,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(e){this.matrixAutoUpdate&&this.updateMatrix(),this.matrix.premultiply(e),this.matrix.decompose(this.position,this.quaternion,this.scale)}applyQuaternion(e){return this.quaternion.premultiply(e),this}setRotationFromAxisAngle(e,t){this.quaternion.setFromAxisAngle(e,t)}setRotationFromEuler(e){this.quaternion.setFromEuler(e,!0)}setRotationFromMatrix(e){this.quaternion.setFromRotationMatrix(e)}setRotationFromQuaternion(e){this.quaternion.copy(e)}rotateOnAxis(e,t){return Bi.setFromAxisAngle(e,t),this.quaternion.multiply(Bi),this}rotateOnWorldAxis(e,t){return Bi.setFromAxisAngle(e,t),this.quaternion.premultiply(Bi),this}rotateX(e){return this.rotateOnAxis(Rc,e)}rotateY(e){return this.rotateOnAxis(Ic,e)}rotateZ(e){return this.rotateOnAxis(Pc,e)}translateOnAxis(e,t){return Cc.copy(e).applyQuaternion(this.quaternion),this.position.add(Cc.multiplyScalar(t)),this}translateX(e){return this.translateOnAxis(Rc,e)}translateY(e){return this.translateOnAxis(Ic,e)}translateZ(e){return this.translateOnAxis(Pc,e)}localToWorld(e){return this.updateWorldMatrix(!0,!1),e.applyMatrix4(this.matrixWorld)}worldToLocal(e){return this.updateWorldMatrix(!0,!1),e.applyMatrix4(Cn.copy(this.matrixWorld).invert())}lookAt(e,t,n){e.isVector3?lr.copy(e):lr.set(e,t,n);const i=this.parent;this.updateWorldMatrix(!0,!1),ys.setFromMatrixPosition(this.matrixWorld),this.isCamera||this.isLight?Cn.lookAt(ys,lr,this.up):Cn.lookAt(lr,ys,this.up),this.quaternion.setFromRotationMatrix(Cn),i&&(Cn.extractRotation(i.matrixWorld),Bi.setFromRotationMatrix(Cn),this.quaternion.premultiply(Bi.invert()))}add(e){if(arguments.length>1){for(let t=0;t<arguments.length;t++)this.add(arguments[t]);return this}return e===this?(Le("Object3D.add: object can't be added as a child of itself.",e),this):(e&&e.isObject3D?(e.removeFromParent(),e.parent=this,this.children.push(e),e.dispatchEvent(Lc),zi.child=e,this.dispatchEvent(zi),zi.child=null):Le("Object3D.add: object not an instance of THREE.Object3D.",e),this)}remove(e){if(arguments.length>1){for(let n=0;n<arguments.length;n++)this.remove(arguments[n]);return this}const t=this.children.indexOf(e);return t!==-1&&(e.parent=null,this.children.splice(t,1),e.dispatchEvent(_f),Va.child=e,this.dispatchEvent(Va),Va.child=null),this}removeFromParent(){const e=this.parent;return e!==null&&e.remove(this),this}clear(){return this.remove(...this.children)}attach(e){return this.updateWorldMatrix(!0,!1),Cn.copy(this.matrixWorld).invert(),e.parent!==null&&(e.parent.updateWorldMatrix(!0,!1),Cn.multiply(e.parent.matrixWorld)),e.applyMatrix4(Cn),e.removeFromParent(),e.parent=this,this.children.push(e),e.updateWorldMatrix(!1,!0),e.dispatchEvent(Lc),zi.child=e,this.dispatchEvent(zi),zi.child=null,this}getObjectById(e){return this.getObjectByProperty("id",e)}getObjectByName(e){return this.getObjectByProperty("name",e)}getObjectByProperty(e,t){if(this[e]===t)return this;for(let n=0,i=this.children.length;n<i;n++){const a=this.children[n].getObjectByProperty(e,t);if(a!==void 0)return a}}getObjectsByProperty(e,t,n=[]){this[e]===t&&n.push(this);const i=this.children;for(let s=0,a=i.length;s<a;s++)i[s].getObjectsByProperty(e,t,n);return n}getWorldPosition(e){return this.updateWorldMatrix(!0,!1),e.setFromMatrixPosition(this.matrixWorld)}getWorldQuaternion(e){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(ys,e,mf),e}getWorldScale(e){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(ys,gf,e),e}getWorldDirection(e){this.updateWorldMatrix(!0,!1);const t=this.matrixWorld.elements;return e.set(t[8],t[9],t[10]).normalize()}raycast(){}traverse(e){e(this);const t=this.children;for(let n=0,i=t.length;n<i;n++)t[n].traverse(e)}traverseVisible(e){if(this.visible===!1)return;e(this);const t=this.children;for(let n=0,i=t.length;n<i;n++)t[n].traverseVisible(e)}traverseAncestors(e){const t=this.parent;t!==null&&(e(t),t.traverseAncestors(e))}updateMatrix(){this.matrix.compose(this.position,this.quaternion,this.scale),this.matrixWorldNeedsUpdate=!0}updateMatrixWorld(e){this.matrixAutoUpdate&&this.updateMatrix(),(this.matrixWorldNeedsUpdate||e)&&(this.matrixWorldAutoUpdate===!0&&(this.parent===null?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix)),this.matrixWorldNeedsUpdate=!1,e=!0);const t=this.children;for(let n=0,i=t.length;n<i;n++)t[n].updateMatrixWorld(e)}updateWorldMatrix(e,t){const n=this.parent;if(e===!0&&n!==null&&n.updateWorldMatrix(!0,!1),this.matrixAutoUpdate&&this.updateMatrix(),this.matrixWorldAutoUpdate===!0&&(this.parent===null?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix)),t===!0){const i=this.children;for(let s=0,a=i.length;s<a;s++)i[s].updateWorldMatrix(!1,!0)}}toJSON(e){const t=e===void 0||typeof e=="string",n={};t&&(e={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(e),i.indirectTexture=this._indirectTexture.toJSON(e),this._colorsTexture!==null&&(i.colorsTexture=this._colorsTexture.toJSON(e)),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(e)),l.uuid}if(this.isScene)this.background&&(this.background.isColor?i.background=this.background.toJSON():this.background.isTexture&&(i.background=this.background.toJSON(e).uuid)),this.environment&&this.environment.isTexture&&this.environment.isRenderTargetTexture!==!0&&(i.environment=this.environment.toJSON(e).uuid);else if(this.isMesh||this.isLine||this.isPoints){i.geometry=s(e.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(e.shapes,u)}else s(e.shapes,l)}}if(this.isSkinnedMesh&&(i.bindMode=this.bindMode,i.bindMatrix=this.bindMatrix.toArray(),this.skeleton!==void 0&&(s(e.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(e.materials,this.material[l]));i.material=o}else i.material=s(e.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(e).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(e.animations,l))}}if(t){const o=a(e.geometries),l=a(e.materials),c=a(e.textures),h=a(e.images),u=a(e.shapes),d=a(e.skeletons),f=a(e.animations),m=a(e.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(e){return new this.constructor().copy(this,e)}copy(e,t=!0){if(this.name=e.name,this.up.copy(e.up),this.position.copy(e.position),this.rotation.order=e.rotation.order,this.quaternion.copy(e.quaternion),this.scale.copy(e.scale),this.matrix.copy(e.matrix),this.matrixWorld.copy(e.matrixWorld),this.matrixAutoUpdate=e.matrixAutoUpdate,this.matrixWorldAutoUpdate=e.matrixWorldAutoUpdate,this.matrixWorldNeedsUpdate=e.matrixWorldNeedsUpdate,this.layers.mask=e.layers.mask,this.visible=e.visible,this.castShadow=e.castShadow,this.receiveShadow=e.receiveShadow,this.frustumCulled=e.frustumCulled,this.renderOrder=e.renderOrder,this.animations=e.animations.slice(),this.userData=JSON.parse(JSON.stringify(e.userData)),t===!0)for(let n=0;n<e.children.length;n++){const i=e.children[n];this.add(i.clone())}return this}}nt.DEFAULT_UP=new R(0,1,0);nt.DEFAULT_MATRIX_AUTO_UPDATE=!0;nt.DEFAULT_MATRIX_WORLD_AUTO_UPDATE=!0;const dn=new R,Rn=new R,ka=new R,In=new R,Vi=new R,ki=new R,Dc=new R,Ga=new R,Ha=new R,Wa=new R,Xa=new pt,qa=new pt,Ya=new pt;class jt{constructor(e=new R,t=new R,n=new R){this.a=e,this.b=t,this.c=n}static getNormal(e,t,n,i){i.subVectors(n,t),dn.subVectors(e,t),i.cross(dn);const s=i.lengthSq();return s>0?i.multiplyScalar(1/Math.sqrt(s)):i.set(0,0,0)}static getBarycoord(e,t,n,i,s){dn.subVectors(i,t),Rn.subVectors(n,t),ka.subVectors(e,t);const a=dn.dot(dn),o=dn.dot(Rn),l=dn.dot(ka),c=Rn.dot(Rn),h=Rn.dot(ka),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(e,t,n,i){return this.getBarycoord(e,t,n,i,In)===null?!1:In.x>=0&&In.y>=0&&In.x+In.y<=1}static getInterpolation(e,t,n,i,s,a,o,l){return this.getBarycoord(e,t,n,i,In)===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,In.x),l.addScaledVector(a,In.y),l.addScaledVector(o,In.z),l)}static getInterpolatedAttribute(e,t,n,i,s,a){return Xa.setScalar(0),qa.setScalar(0),Ya.setScalar(0),Xa.fromBufferAttribute(e,t),qa.fromBufferAttribute(e,n),Ya.fromBufferAttribute(e,i),a.setScalar(0),a.addScaledVector(Xa,s.x),a.addScaledVector(qa,s.y),a.addScaledVector(Ya,s.z),a}static isFrontFacing(e,t,n,i){return dn.subVectors(n,t),Rn.subVectors(e,t),dn.cross(Rn).dot(i)<0}set(e,t,n){return this.a.copy(e),this.b.copy(t),this.c.copy(n),this}setFromPointsAndIndices(e,t,n,i){return this.a.copy(e[t]),this.b.copy(e[n]),this.c.copy(e[i]),this}setFromAttributeAndIndices(e,t,n,i){return this.a.fromBufferAttribute(e,t),this.b.fromBufferAttribute(e,n),this.c.fromBufferAttribute(e,i),this}clone(){return new this.constructor().copy(this)}copy(e){return this.a.copy(e.a),this.b.copy(e.b),this.c.copy(e.c),this}getArea(){return dn.subVectors(this.c,this.b),Rn.subVectors(this.a,this.b),dn.cross(Rn).length()*.5}getMidpoint(e){return e.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)}getNormal(e){return jt.getNormal(this.a,this.b,this.c,e)}getPlane(e){return e.setFromCoplanarPoints(this.a,this.b,this.c)}getBarycoord(e,t){return jt.getBarycoord(e,this.a,this.b,this.c,t)}getInterpolation(e,t,n,i,s){return jt.getInterpolation(e,this.a,this.b,this.c,t,n,i,s)}containsPoint(e){return jt.containsPoint(e,this.a,this.b,this.c)}isFrontFacing(e){return jt.isFrontFacing(this.a,this.b,this.c,e)}intersectsBox(e){return e.intersectsTriangle(this)}closestPointToPoint(e,t){const n=this.a,i=this.b,s=this.c;let a,o;Vi.subVectors(i,n),ki.subVectors(s,n),Ga.subVectors(e,n);const l=Vi.dot(Ga),c=ki.dot(Ga);if(l<=0&&c<=0)return t.copy(n);Ha.subVectors(e,i);const h=Vi.dot(Ha),u=ki.dot(Ha);if(h>=0&&u<=h)return t.copy(i);const d=l*u-h*c;if(d<=0&&l>=0&&h<=0)return a=l/(l-h),t.copy(n).addScaledVector(Vi,a);Wa.subVectors(e,s);const f=Vi.dot(Wa),m=ki.dot(Wa);if(m>=0&&f<=m)return t.copy(s);const _=f*c-l*m;if(_<=0&&c>=0&&m<=0)return o=c/(c-m),t.copy(n).addScaledVector(ki,o);const g=h*m-f*u;if(g<=0&&u-h>=0&&f-m>=0)return Dc.subVectors(s,i),o=(u-h)/(u-h+(f-m)),t.copy(i).addScaledVector(Dc,o);const p=1/(g+_+d);return a=_*p,o=d*p,t.copy(n).addScaledVector(Vi,a).addScaledVector(ki,o)}equals(e){return e.a.equals(this.a)&&e.b.equals(this.b)&&e.c.equals(this.c)}}const mu={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},Yn={h:0,s:0,l:0},cr={h:0,s:0,l:0};function Za(r,e,t){return t<0&&(t+=1),t>1&&(t-=1),t<1/6?r+(e-r)*6*t:t<1/2?e:t<2/3?r+(e-r)*6*(2/3-t):r}class Me{constructor(e,t,n){return this.isColor=!0,this.r=1,this.g=1,this.b=1,this.set(e,t,n)}set(e,t,n){if(t===void 0&&n===void 0){const i=e;i&&i.isColor?this.copy(i):typeof i=="number"?this.setHex(i):typeof i=="string"&&this.setStyle(i)}else this.setRGB(e,t,n);return this}setScalar(e){return this.r=e,this.g=e,this.b=e,this}setHex(e,t=Kt){return e=Math.floor(e),this.r=(e>>16&255)/255,this.g=(e>>8&255)/255,this.b=(e&255)/255,je.colorSpaceToWorking(this,t),this}setRGB(e,t,n,i=je.workingColorSpace){return this.r=e,this.g=t,this.b=n,je.colorSpaceToWorking(this,i),this}setHSL(e,t,n,i=je.workingColorSpace){if(e=Il(e,1),t=ze(t,0,1),n=ze(n,0,1),t===0)this.r=this.g=this.b=n;else{const s=n<=.5?n*(1+t):n+t-n*t,a=2*n-s;this.r=Za(a,s,e+1/3),this.g=Za(a,s,e),this.b=Za(a,s,e-1/3)}return je.colorSpaceToWorking(this,i),this}setStyle(e,t=Kt){function n(s){s!==void 0&&parseFloat(s)<1&&de("Color: Alpha component of "+e+" will be ignored.")}let i;if(i=/^(\w+)\(([^\)]*)\)/.exec(e)){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,t);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,t);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,t);break;default:de("Color: Unknown color model "+e)}}else if(i=/^\#([A-Fa-f\d]+)$/.exec(e)){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,t);if(a===6)return this.setHex(parseInt(s,16),t);de("Color: Invalid hex color "+e)}else if(e&&e.length>0)return this.setColorName(e,t);return this}setColorName(e,t=Kt){const n=mu[e.toLowerCase()];return n!==void 0?this.setHex(n,t):de("Color: Unknown color "+e),this}clone(){return new this.constructor(this.r,this.g,this.b)}copy(e){return this.r=e.r,this.g=e.g,this.b=e.b,this}copySRGBToLinear(e){return this.r=On(e.r),this.g=On(e.g),this.b=On(e.b),this}copyLinearToSRGB(e){return this.r=ss(e.r),this.g=ss(e.g),this.b=ss(e.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}getHex(e=Kt){return je.workingToColorSpace(Rt.copy(this),e),Math.round(ze(Rt.r*255,0,255))*65536+Math.round(ze(Rt.g*255,0,255))*256+Math.round(ze(Rt.b*255,0,255))}getHexString(e=Kt){return("000000"+this.getHex(e).toString(16)).slice(-6)}getHSL(e,t=je.workingColorSpace){je.workingToColorSpace(Rt.copy(this),t);const n=Rt.r,i=Rt.g,s=Rt.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 e.h=l,e.s=c,e.l=h,e}getRGB(e,t=je.workingColorSpace){return je.workingToColorSpace(Rt.copy(this),t),e.r=Rt.r,e.g=Rt.g,e.b=Rt.b,e}getStyle(e=Kt){je.workingToColorSpace(Rt.copy(this),e);const t=Rt.r,n=Rt.g,i=Rt.b;return e!==Kt?`color(${e} ${t.toFixed(3)} ${n.toFixed(3)} ${i.toFixed(3)})`:`rgb(${Math.round(t*255)},${Math.round(n*255)},${Math.round(i*255)})`}offsetHSL(e,t,n){return this.getHSL(Yn),this.setHSL(Yn.h+e,Yn.s+t,Yn.l+n)}add(e){return this.r+=e.r,this.g+=e.g,this.b+=e.b,this}addColors(e,t){return this.r=e.r+t.r,this.g=e.g+t.g,this.b=e.b+t.b,this}addScalar(e){return this.r+=e,this.g+=e,this.b+=e,this}sub(e){return this.r=Math.max(0,this.r-e.r),this.g=Math.max(0,this.g-e.g),this.b=Math.max(0,this.b-e.b),this}multiply(e){return this.r*=e.r,this.g*=e.g,this.b*=e.b,this}multiplyScalar(e){return this.r*=e,this.g*=e,this.b*=e,this}lerp(e,t){return this.r+=(e.r-this.r)*t,this.g+=(e.g-this.g)*t,this.b+=(e.b-this.b)*t,this}lerpColors(e,t,n){return this.r=e.r+(t.r-e.r)*n,this.g=e.g+(t.g-e.g)*n,this.b=e.b+(t.b-e.b)*n,this}lerpHSL(e,t){this.getHSL(Yn),e.getHSL(cr);const n=Os(Yn.h,cr.h,t),i=Os(Yn.s,cr.s,t),s=Os(Yn.l,cr.l,t);return this.setHSL(n,i,s),this}setFromVector3(e){return this.r=e.x,this.g=e.y,this.b=e.z,this}applyMatrix3(e){const t=this.r,n=this.g,i=this.b,s=e.elements;return this.r=s[0]*t+s[3]*n+s[6]*i,this.g=s[1]*t+s[4]*n+s[7]*i,this.b=s[2]*t+s[5]*n+s[8]*i,this}equals(e){return e.r===this.r&&e.g===this.g&&e.b===this.b}fromArray(e,t=0){return this.r=e[t],this.g=e[t+1],this.b=e[t+2],this}toArray(e=[],t=0){return e[t]=this.r,e[t+1]=this.g,e[t+2]=this.b,e}fromBufferAttribute(e,t){return this.r=e.getX(t),this.g=e.getY(t),this.b=e.getZ(t),this}toJSON(){return this.getHex()}*[Symbol.iterator](){yield this.r,yield this.g,yield this.b}}const Rt=new Me;Me.NAMES=mu;let xf=0;class Bt extends kn{constructor(){super(),this.isMaterial=!0,Object.defineProperty(this,"id",{value:xf++}),this.uuid=tn(),this.name="",this.type="Material",this.blending=is,this.side=Qn,this.vertexColors=!1,this.opacity=1,this.transparent=!1,this.alphaHash=!1,this.blendSrc=So,this.blendDst=bo,this.blendEquation=xi,this.blendSrcAlpha=null,this.blendDstAlpha=null,this.blendEquationAlpha=null,this.blendColor=new Me(0,0,0),this.blendAlpha=0,this.depthFunc=as,this.depthTest=!0,this.depthWrite=!0,this.stencilWriteMask=255,this.stencilFunc=vc,this.stencilRef=0,this.stencilFuncMask=255,this.stencilFail=Li,this.stencilZFail=Li,this.stencilZPass=Li,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(e){this._alphaTest>0!=e>0&&this.version++,this._alphaTest=e}onBeforeRender(){}onBeforeCompile(){}customProgramCacheKey(){return this.onBeforeCompile.toString()}setValues(e){if(e!==void 0)for(const t in e){const n=e[t];if(n===void 0){de(`Material: parameter '${t}' has value of undefined.`);continue}const i=this[t];if(i===void 0){de(`Material: '${t}' 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[t]=n}}toJSON(e){const t=e===void 0||typeof e=="string";t&&(e={textures:{},images:{}});const n={metadata:{version:4.7,type:"Material",generator:"Material.toJSON"}};
vendor: 9,098 bytes, line 5
5n.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(e).uuid),this.clearcoatRoughnessMap&&this.clearcoatRoughnessMap.isTexture&&(n.clearcoatRoughnessMap=this.clearcoatRoughnessMap.toJSON(e).uuid),this.clearcoatNormalMap&&this.clearcoatNormalMap.isTexture&&(n.clearcoatNormalMap=this.clearcoatNormalMap.toJSON(e).uuid,n.clearcoatNormalScale=this.clearcoatNormalScale.toArray()),this.sheenColorMap&&this.sheenColorMap.isTexture&&(n.sheenColorMap=this.sheenColorMap.toJSON(e).uuid),this.sheenRoughnessMap&&this.sheenRoughnessMap.isTexture&&(n.sheenRoughnessMap=this.sheenRoughnessMap.toJSON(e).uuid),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(e).uuid),this.iridescenceThicknessMap&&this.iridescenceThicknessMap.isTexture&&(n.iridescenceThicknessMap=this.iridescenceThicknessMap.toJSON(e).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(e).uuid),this.map&&this.map.isTexture&&(n.map=this.map.toJSON(e).uuid),this.matcap&&this.matcap.isTexture&&(n.matcap=this.matcap.toJSON(e).uuid),this.alphaMap&&this.alphaMap.isTexture&&(n.alphaMap=this.alphaMap.toJSON(e).uuid),this.lightMap&&this.lightMap.isTexture&&(n.lightMap=this.lightMap.toJSON(e).uuid,n.lightMapIntensity=this.lightMapIntensity),this.aoMap&&this.aoMap.isTexture&&(n.aoMap=this.aoMap.toJSON(e).uuid,n.aoMapIntensity=this.aoMapIntensity),this.bumpMap&&this.bumpMap.isTexture&&(n.bumpMap=this.bumpMap.toJSON(e).uuid,n.bumpScale=this.bumpScale),this.normalMap&&this.normalMap.isTexture&&(n.normalMap=this.normalMap.toJSON(e).uuid,n.normalMapType=this.normalMapType,n.normalScale=this.normalScale.toArray()),this.displacementMap&&this.displacementMap.isTexture&&(n.displacementMap=this.displacementMap.toJSON(e).uuid,n.displacementScale=this.displacementScale,n.displacementBias=this.displacementBias),this.roughnessMap&&this.roughnessMap.isTexture&&(n.roughnessMap=this.roughnessMap.toJSON(e).uuid),this.metalnessMap&&this.metalnessMap.isTexture&&(n.metalnessMap=this.metalnessMap.toJSON(e).uuid),this.emissiveMap&&this.emissiveMap.isTexture&&(n.emissiveMap=this.emissiveMap.toJSON(e).uuid),this.specularMap&&this.specularMap.isTexture&&(n.specularMap=this.specularMap.toJSON(e).uuid),this.specularIntensityMap&&this.specularIntensityMap.isTexture&&(n.specularIntensityMap=this.specularIntensityMap.toJSON(e).uuid),this.specularColorMap&&this.specularColorMap.isTexture&&(n.specularColorMap=this.specularColorMap.toJSON(e).uuid),this.envMap&&this.envMap.isTexture&&(n.envMap=this.envMap.toJSON(e).uuid,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(e).uuid),this.transmission!==void 0&&(n.transmission=this.transmission),this.transmissionMap&&this.transmissionMap.isTexture&&(n.transmissionMap=this.transmissionMap.toJSON(e).uuid),this.thickness!==void 0&&(n.thickness=this.thickness),this.thicknessMap&&this.thicknessMap.isTexture&&(n.thicknessMap=this.thicknessMap.toJSON(e).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!==is&&(n.blending=this.blending),this.side!==Qn&&(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!==So&&(n.blendSrc=this.blendSrc),this.blendDst!==bo&&(n.blendDst=this.blendDst),this.blendEquation!==xi&&(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!==as&&(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!==vc&&(n.stencilFunc=this.stencilFunc),this.stencilRef!==0&&(n.stencilRef=this.stencilRef),this.stencilFuncMask!==255&&(n.stencilFuncMask=this.stencilFuncMask),this.stencilFail!==Li&&(n.stencilFail=this.stencilFail),this.stencilZFail!==Li&&(n.stencilZFail=this.stencilZFail),this.stencilZPass!==Li&&(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.allowOverride===!1&&(n.allowOverride=!1),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(t){const s=i(e.textures),a=i(e.images);s.length>0&&(n.textures=s),a.length>0&&(n.images=a)}return n}clone(){return new this.constructor().copy(this)}copy(e){this.name=e.name,this.blending=e.blending,this.side=e.side,this.vertexColors=e.vertexColors,this.opacity=e.opacity,this.transparent=e.transparent,this.blendSrc=e.blendSrc,this.blendDst=e.blendDst,this.blendEquation=e.blendEquation,this.blendSrcAlpha=e.blendSrcAlpha,this.blendDstAlpha=e.blendDstAlpha,this.blendEquationAlpha=e.blendEquationAlpha,this.blendColor.copy(e.blendColor),this.blendAlpha=e.blendAlpha,this.depthFunc=e.depthFunc,this.depthTest=e.depthTest,this.depthWrite=e.depthWrite,this.stencilWriteMask=e.stencilWriteMask,this.stencilFunc=e.stencilFunc,this.stencilRef=e.stencilRef,this.stencilFuncMask=e.stencilFuncMask,this.stencilFail=e.stencilFail,this.stencilZFail=e.stencilZFail,this.stencilZPass=e.stencilZPass,this.stencilWrite=e.stencilWrite;const t=e.clippingPlanes;let n=null;if(t!==null){const i=t.length;n=new Array(i);for(let s=0;s!==i;++s)n[s]=t[s].clone()}return this.clippingPlanes=n,this.clipIntersection=e.clipIntersection,this.clipShadows=e.clipSh
vendor: 6,375 bytes, line 5
5adows,this.shadowSide=e.shadowSide,this.colorWrite=e.colorWrite,this.precision=e.precision,this.polygonOffset=e.polygonOffset,this.polygonOffsetFactor=e.polygonOffsetFactor,this.polygonOffsetUnits=e.polygonOffsetUnits,this.dithering=e.dithering,this.alphaTest=e.alphaTest,this.alphaHash=e.alphaHash,this.alphaToCoverage=e.alphaToCoverage,this.premultipliedAlpha=e.premultipliedAlpha,this.forceSinglePass=e.forceSinglePass,this.allowOverride=e.allowOverride,this.visible=e.visible,this.toneMapped=e.toneMapped,this.userData=JSON.parse(JSON.stringify(e.userData)),this}dispose(){this.dispatchEvent({type:"dispose"})}set needsUpdate(e){e===!0&&this.version++}}class Ci extends Bt{constructor(e){super(),this.isMeshBasicMaterial=!0,this.type="MeshBasicMaterial",this.color=new Me(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 cn,this.combine=ma,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.envMapRotation.copy(e.envMapRotation),this.combine=e.combine,this.reflectivity=e.reflectivity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.fog=e.fog,this}}const Dn=vf();function vf(){const r=new ArrayBuffer(4),e=new Float32Array(r),t=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:e,uint32View:t,baseTable:n,shiftTable:i,mantissaTable:s,exponentTable:a,offsetTable:o}}function Gt(r){Math.abs(r)>65504&&de("DataUtils.toHalfFloat(): Value out of range."),r=ze(r,-65504,65504),Dn.floatView[0]=r;const e=Dn.uint32View[0],t=e>>23&511;return Dn.baseTable[t]+((e&8388607)>>Dn.shiftTable[t])}function Ds(r){const e=r>>10;return Dn.uint32View[0]=Dn.mantissaTable[Dn.offsetTable[e]+(r&1023)]+Dn.exponentTable[e],Dn.floatView[0]}class Ay{static toHalfFloat(e){return Gt(e)}static fromHalfFloat(e){return Ds(e)}}const St=new R,hr=new K;let yf=0;class ut{constructor(e,t,n=!1){if(Array.isArray(e))throw new TypeError("THREE.BufferAttribute: array should be a Typed Array.");this.isBufferAttribute=!0,Object.defineProperty(this,"id",{value:yf++}),this.name="",this.array=e,this.itemSize=t,this.count=e!==void 0?e.length/t:0,this.normalized=n,this.usage=aa,this.updateRanges=[],this.gpuType=Ht,this.version=0}onUploadCallback(){}set needsUpdate(e){e===!0&&this.version++}setUsage(e){return this.usage=e,this}addUpdateRange(e,t){this.updateRanges.push({start:e,count:t})}clearUpdateRanges(){this.updateRanges.length=0}copy(e){return this.name=e.name,this.array=new e.array.constructor(e.array),this.itemSize=e.itemSize,this.count=e.count,this.normalized=e.normalized,this.usage=e.usage,this.gpuType=e.gpuType,this}copyAt(e,t,n){e*=this.itemSize,n*=t.itemSize;for(let i=0,s=this.itemSize;i<s;i++)this.array[e+i]=t.array[n+i];return this}copyArray(e){return this.array.set(e),this}applyMatrix3(e){if(this.itemSize===2)for(let t=0,n=this.count;t<n;t++)hr.fromBufferAttribute(this,t),hr.applyMatrix3(e),this.setXY(t,hr.x,hr.y);else if(this.itemSize===3)for(let t=0,n=this.count;t<n;t++)St.fromBufferAttribute(this,t),St.applyMatrix3(e),this.setXYZ(t,St.x,St.y,St.z);return this}applyMatrix4(e){for(let t=0,n=this.count;t<n;t++)St.fromBufferAttribute(this,t),St.applyMatrix4(e),this.setXYZ(t,St.x,St.y,St.z);return this}applyNormalMatrix(e){for(let t=0,n=this.count;t<n;t++)St.fromBufferAttribute(this,t),St.applyNormalMatrix(e),this.setXYZ(t,St.x,St.y,St.z);return this}transformDirection(e){for(let t=0,n=this.count;t<n;t++)St.fromBufferAttribute(this,t),St.transformDirection(e),this.setXYZ(t,St.x,St.y,St.z);return this}set(e,t=0){return this.array.set(e,t),this}getComponent(e,t){let n=this.array[e*this.itemSize+t];return this.normalized&&(n=Ft(n,this.array)),n}setComponent(e,t,n){return this.normalized&&(n=Ze(n,this.array)),this.array[e*this.itemSize+t]=n,this}getX(e){let t=this.array[e*this.itemSize];return this.normalized&&(t=Ft(t,this.array)),t}setX(e,t){return this.normalized&&(t=Ze(t,this.array)),this.array[e*this.itemSize]=t,this}getY(e){let t=this.array[e*this.itemSize+1];return this.normalized&&(t=Ft(t,this.array)),t}setY(e,t){return this.normalized&&(t=Ze(t,this.array)),this.array[e*this.itemSize+1]=t,this}getZ(e){let t=this.array[e*this.itemSize+2];return this.normalized&&(t=Ft(t,this.array)),t}setZ(e,t){return this.normalized&&(t=Ze(t,this.array)),this.array[e*this.itemSize+2]=t,this}getW(e){let t=this.array[e*this.itemSize+3];return this.normalized&&(t=Ft(t,this.array)),t}setW(e,t){return this.normalized&&(t=Ze(t,this.array)),this.array[e*this.itemSize+3]=t,this}setXY(e,t,n){return e*=this.itemSize,this.normalized&&(t=Ze(t,this.array),n=Ze(n,this.array)),this.array[e+0]=t,this.array[e+1]=n,this}setXYZ(e,t,n,i){return e*=this.itemSize,this.normalized&&(t=Ze(t,this.array),n=Ze(n,this.array),i=Ze(i,this.array)),this.array[e+0]=t,this.array[e+1]=n,this.array[e+2]=i,this}setXYZW(e,t,n,i,s){return e*=this.itemSize,this.normalized&&(t=Ze(t,this.array),n=Ze(n,this.array),i=Ze(i,this.array),s=Ze(s,this.array)),this.array[e+0]=t,this.array[e+1]=n,this.array[e+2]=i,this.array[e+3]=s,this}
vendor: 4,316 bytes, line 5
5onUpload(e){return this.onUploadCallback=e,this}clone(){return new this.constructor(this.array,this.itemSize).copy(this)}toJSON(){const e={itemSize:this.itemSize,type:this.array.constructor.name,array:Array.from(this.array),normalized:this.normalized};return this.name!==""&&(e.name=this.name),this.usage!==aa&&(e.usage=this.usage),e}}class Ty extends ut{constructor(e,t,n){super(new Int8Array(e),t,n)}}class Ey extends ut{constructor(e,t,n){super(new Uint8Array(e),t,n)}}class wy extends ut{constructor(e,t,n){super(new Uint8ClampedArray(e),t,n)}}class Cy extends ut{constructor(e,t,n){super(new Int16Array(e),t,n)}}class gu extends ut{constructor(e,t,n){super(new Uint16Array(e),t,n)}}class Ry extends ut{constructor(e,t,n){super(new Int32Array(e),t,n)}}class _u extends ut{constructor(e,t,n){super(new Uint32Array(e),t,n)}}class Iy extends ut{constructor(e,t,n){super(new Uint16Array(e),t,n),this.isFloat16BufferAttribute=!0}getX(e){let t=Ds(this.array[e*this.itemSize]);return this.normalized&&(t=Ft(t,this.array)),t}setX(e,t){return this.normalized&&(t=Ze(t,this.array)),this.array[e*this.itemSize]=Gt(t),this}getY(e){let t=Ds(this.array[e*this.itemSize+1]);return this.normalized&&(t=Ft(t,this.array)),t}setY(e,t){return this.normalized&&(t=Ze(t,this.array)),this.array[e*this.itemSize+1]=Gt(t),this}getZ(e){let t=Ds(this.array[e*this.itemSize+2]);return this.normalized&&(t=Ft(t,this.array)),t}setZ(e,t){return this.normalized&&(t=Ze(t,this.array)),this.array[e*this.itemSize+2]=Gt(t),this}getW(e){let t=Ds(this.array[e*this.itemSize+3]);return this.normalized&&(t=Ft(t,this.array)),t}setW(e,t){return this.normalized&&(t=Ze(t,this.array)),this.array[e*this.itemSize+3]=Gt(t),this}setXY(e,t,n){return e*=this.itemSize,this.normalized&&(t=Ze(t,this.array),n=Ze(n,this.array)),this.array[e+0]=Gt(t),this.array[e+1]=Gt(n),this}setXYZ(e,t,n,i){return e*=this.itemSize,this.normalized&&(t=Ze(t,this.array),n=Ze(n,this.array),i=Ze(i,this.array)),this.array[e+0]=Gt(t),this.array[e+1]=Gt(n),this.array[e+2]=Gt(i),this}setXYZW(e,t,n,i,s){return e*=this.itemSize,this.normalized&&(t=Ze(t,this.array),n=Ze(n,this.array),i=Ze(i,this.array),s=Ze(s,this.array)),this.array[e+0]=Gt(t),this.array[e+1]=Gt(n),this.array[e+2]=Gt(i),this.array[e+3]=Gt(s),this}}class Te extends ut{constructor(e,t,n){super(new Float32Array(e),t,n)}}let Mf=0;const an=new Ge,Ja=new nt,Gi=new R,$t=new Ot,Ms=new Ot,wt=new R;class qe extends kn{constructor(){super(),this.isBufferGeometry=!0,Object.defineProperty(this,"id",{value:Mf++}),this.uuid=tn(),this.name="",this.type="BufferGeometry",this.index=null,this.indirect=null,this.indirectOffset=0,this.attributes={},this.morphAttributes={},this.morphTargetsRelative=!1,this.groups=[],this.boundingBox=null,this.boundingSphere=null,this.drawRange={start:0,count:1/0},this.userData={}}getIndex(){return this.index}setIndex(e){return Array.isArray(e)?this.index=new(du(e)?_u:gu)(e,1):this.index=e,this}setIndirect(e,t=0){return this.indirect=e,this.indirectOffset=t,this}getIndirect(){return this.indirect}getAttribute(e){return this.attributes[e]}setAttribute(e,t){return this.attributes[e]=t,this}deleteAttribute(e){return delete this.attributes[e],this}hasAttribute(e){return this.attributes[e]!==void 0}addGroup(e,t,n=0){this.groups.push({start:e,count:t,materialIndex:n})}clearGroups(){this.groups=[]}setDrawRange(e,t){this.drawRange.start=e,this.drawRange.count=t}applyMatrix4(e){const t=this.attributes.position;t!==void 0&&(t.applyMatrix4(e),t.needsUpdate=!0);const n=this.attributes.normal;if(n!==void 0){const s=new Ye().getNormalMatrix(e);n.applyNormalMatrix(s),n.needsUpdate=!0}const i=this.attributes.tangent;return i!==void 0&&(i.transformDirection(e),i.needsUpdate=!0),this.boundingBox!==null&&this.computeBoundingBox(),this.boundingSphere!==null&&this.computeBoundingSphere(),this}applyQuaternion(e){return an.makeRotationFromQuaternion(e),this.applyMatrix4(an),this}rotateX(e){return an.makeRotationX(e),this.applyMatrix4(an),this}rotateY(e){return an.makeRotationY(e),this.applyMatrix4(an),this}rotateZ(e){return an.makeRotationZ(e),this.applyMatrix4(an),this}translate(e,t,n){return an.makeTranslation(e,t,n),this.applyMatrix4(an),this}scale(e,t,n){return an.makeScale(e,t,n),this.applyMatrix4(an),this}lookAt(e){return Ja.lookAt(e),Ja.updateMatrix(),this.applyMatrix4(Ja.matrix
vendor: 9,787 bytes, line 5
5),this}center(){return this.computeBoundingBox(),this.boundingBox.getCenter(Gi).negate(),this.translate(Gi.x,Gi.y,Gi.z),this}setFromPoints(e){const t=this.getAttribute("position");if(t===void 0){const n=[];for(let i=0,s=e.length;i<s;i++){const a=e[i];n.push(a.x,a.y,a.z||0)}this.setAttribute("position",new Te(n,3))}else{const n=Math.min(e.length,t.count);for(let i=0;i<n;i++){const s=e[i];t.setXYZ(i,s.x,s.y,s.z||0)}e.length>t.count&&de("BufferGeometry: Buffer size too small for points data. Use .dispose() and create a new geometry."),t.needsUpdate=!0}return this}computeBoundingBox(){this.boundingBox===null&&(this.boundingBox=new Ot);const e=this.attributes.position,t=this.morphAttributes.position;if(e&&e.isGLBufferAttribute){Le("BufferGeometry.computeBoundingBox(): GLBufferAttribute requires a manual bounding box.",this),this.boundingBox.set(new R(-1/0,-1/0,-1/0),new R(1/0,1/0,1/0));return}if(e!==void 0){if(this.boundingBox.setFromBufferAttribute(e),t)for(let n=0,i=t.length;n<i;n++){const s=t[n];$t.setFromBufferAttribute(s),this.morphTargetsRelative?(wt.addVectors(this.boundingBox.min,$t.min),this.boundingBox.expandByPoint(wt),wt.addVectors(this.boundingBox.max,$t.max),this.boundingBox.expandByPoint(wt)):(this.boundingBox.expandByPoint($t.min),this.boundingBox.expandByPoint($t.max))}}else this.boundingBox.makeEmpty();(isNaN(this.boundingBox.min.x)||isNaN(this.boundingBox.min.y)||isNaN(this.boundingBox.min.z))&&Le('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 Lt);const e=this.attributes.position,t=this.morphAttributes.position;if(e&&e.isGLBufferAttribute){Le("BufferGeometry.computeBoundingSphere(): GLBufferAttribute requires a manual bounding sphere.",this),this.boundingSphere.set(new R,1/0);return}if(e){const n=this.boundingSphere.center;if($t.setFromBufferAttribute(e),t)for(let s=0,a=t.length;s<a;s++){const o=t[s];Ms.setFromBufferAttribute(o),this.morphTargetsRelative?(wt.addVectors($t.min,Ms.min),$t.expandByPoint(wt),wt.addVectors($t.max,Ms.max),$t.expandByPoint(wt)):($t.expandByPoint(Ms.min),$t.expandByPoint(Ms.max))}$t.getCenter(n);let i=0;for(let s=0,a=e.count;s<a;s++)wt.fromBufferAttribute(e,s),i=Math.max(i,n.distanceToSquared(wt));if(t)for(let s=0,a=t.length;s<a;s++){const o=t[s],l=this.morphTargetsRelative;for(let c=0,h=o.count;c<h;c++)wt.fromBufferAttribute(o,c),l&&(Gi.fromBufferAttribute(e,c),wt.add(Gi)),i=Math.max(i,n.distanceToSquared(wt))}this.boundingSphere.radius=Math.sqrt(i),isNaN(this.boundingSphere.radius)&&Le('BufferGeometry.computeBoundingSphere(): Computed radius is NaN. The "position" attribute is likely to have NaN values.',this)}}computeTangents(){const e=this.index,t=this.attributes;if(e===null||t.position===void 0||t.normal===void 0||t.uv===void 0){Le("BufferGeometry: .computeTangents() failed. Missing required attributes (index, position, normal or uv)");return}const n=t.position,i=t.normal,s=t.uv;this.hasAttribute("tangent")===!1&&this.setAttribute("tangent",new ut(new Float32Array(4*n.count),4));const a=this.getAttribute("tangent"),o=[],l=[];for(let P=0;P<n.count;P++)o[P]=new R,l[P]=new R;const c=new R,h=new R,u=new R,d=new K,f=new K,m=new K,_=new R,g=new R;function p(P,S,b){c.fromBufferAttribute(n,P),h.fromBufferAttribute(n,S),u.fromBufferAttribute(n,b),d.fromBufferAttribute(s,P),f.fromBufferAttribute(s,S),m.fromBufferAttribute(s,b),h.sub(c),u.sub(c),f.sub(d),m.sub(d);const L=1/(f.x*m.y-m.x*f.y);isFinite(L)&&(_.copy(h).multiplyScalar(m.y).addScaledVector(u,-f.y).multiplyScalar(L),g.copy(u).multiplyScalar(f.x).addScaledVector(h,-m.x).multiplyScalar(L),o[P].add(_),o[S].add(_),o[b].add(_),l[P].add(g),l[S].add(g),l[b].add(g))}let v=this.groups;v.length===0&&(v=[{start:0,count:e.count}]);for(let P=0,S=v.length;P<S;++P){const b=v[P],L=b.start,F=b.count;for(let B=L,G=L+F;B<G;B+=3)p(e.getX(B+0),e.getX(B+1),e.getX(B+2))}const x=new R,M=new R,T=new R,E=new R;function C(P){T.fromBufferAttribute(i,P),E.copy(T);const S=o[P];x.copy(S),x.sub(T.multiplyScalar(T.dot(S))).normalize(),M.crossVectors(E,S);const L=M.dot(l[P])<0?-1:1;a.setXYZW(P,x.x,x.y,x.z,L)}for(let P=0,S=v.length;P<S;++P){const b=v[P],L=b.start,F=b.count;for(let B=L,G=L+F;B<G;B+=3)C(e.getX(B+0)),C(e.getX(B+1)),C(e.getX(B+2))}}computeVertexNormals(){const e=this.index,t=this.getAttribute("position");if(t!==void 0){let n=this.getAttribute("normal");if(n===void 0)n=new ut(new Float32Array(t.count*3),3),this.setAttribute("normal",n);else for(let d=0,f=n.count;d<f;d++)n.setXYZ(d,0,0,0);const i=new R,s=new R,a=new R,o=new R,l=new R,c=new R,h=new R,u=new R;if(e)for(let d=0,f=e.count;d<f;d+=3){const m=e.getX(d+0),_=e.getX(d+1),g=e.getX(d+2);i.fromBufferAttribute(t,m),s.fromBufferAttribute(t,_),a.fromBufferAttribute(t,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=t.count;d<f;d+=3)i.fromBufferAttribute(t,d+0),s.fromBufferAttribute(t,d+1),a.fromBufferAttribute(t,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 e=this.attributes.normal;for(let t=0,n=e.count;t<n;t++)wt.fromBufferAttribute(e,t),wt.normalize(),e.setXYZ(t,wt.x,wt.y,wt.z)}toNonIndexed(){function e(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 ut(d,h,u)}if(this.index===null)return de("BufferGeometry.toNonIndexed(): BufferGeometry is already non-indexed."),this;const t=new qe,n=this.index.array,i=this.attributes;for(const o in i){const l=i[o],c=e(l,n);t.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=e(d,n);l.push(f)}t.morphAttributes[o]=l}t.morphTargetsRelative=this.morphTargetsRelative;const a=this.groups;for(let o=0,l=a.length;o<l;o++){const c=a[o];t.addGroup(c.start,c.count,c.materialIndex)}return t}toJSON(){const e={metadata:{version:4.7,type:"BufferGeometry",generator:"BufferGeometry.toJSON"}};if(e.uuid=this.uuid,e.type=this.type,this.name!==""&&(e.name=this.name),Object.keys(this.userData).length>0&&(e.userData=this.userData),this.parameters!==void 0){const l=this.parameters;for(const c in l)l[c]!==void 0&&(e[c]=l[c]);return e}e.data={attributes:{}};const t=this.index;t!==null&&(e.data.index={type:t.array.constructor.name,array:Array.prototype.slice.call(t.array)});const n=this.attributes;for(const l in n){const c=n[l];e.data.attributes[l]=c.toJSON(e.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(e.data))}h.length>0&&(i[l]=h,s=!0)}s&&(e.data.morphAttributes=i,e.data.morphTargetsRelative=this.morphTargetsRelative);const a=this.groups;a.length>0&&(e.data.groups=JSON.parse(JSON.stringify(a)));const o=this.boundingSphere;return o!==null&&(e.data.boundingSphere=o.toJSON()),e}clone(){return new this.constructor().copy(this)}copy(e){this.index=null,this.attributes={},this.morphAttributes={},this.groups=[],this.boundingBox=null,this.boundingSphere=null;const t={};this.name=e.name;const n=e.index;n!==null&&this.setIndex(n.clone());const i=e.attributes;for(const c in i){const h=i[c];this.setAttribute(c,h.clone(t))}const s=e.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(t));this.morphAttributes[c]=h}this.morphTargetsRelative=e.morphTargetsRelative;const a=e.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=e.boundingBox;o!==null&&(this.boundingBox=o.clone());const l=e.boundingSphere;return l!==null&&(this.boundingSphere=l.clone()),this.drawRange.start=e.drawRange.start,this.drawRange.count=e.drawRange.count,this.userData=e.userData,this}dispose(){this.dispatchEvent({type:"dispose"})}}const Uc=new Ge,ri=new Ks,ur=new Lt,Nc=new R,dr=new R,fr=new R,pr=new R,$a=new R,mr=new R,Fc=new R,gr=new R;class At extends nt{constructor(e=new qe,t=new Ci){super(),this.isMesh=!0,this.type="Mesh",this.geometry=e,this.material=t,this.morphTargetDictionary=void 0,this.morphTargetInfluences=void 0,this.count=1,this.updateMorphTargets()}copy(e,t){return super.copy(e,t),e.morphTargetInfluences!==void 0&&(this.morphTargetInfluences=e.morphTargetInfluences.slice()),e.morphTargetDictionary!==void 0&&(this.morphTargetDictionary=Object.assign({},e.morphTargetDictionary)),this.material=Array.isArray(e.material)?e.material.slice():e.material,this.geometry=e.geometry,this}updateMorphTargets(){const t=this.geometry.morphAttributes,n=Object.keys(t);if(n.length>0){const i=t[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(e,t){const n=this.geometry,i=n.attributes.position,s=n.morphAttributes.position,a=n.morphTargetsRelative;t.fromBufferAttribute(i,e);const o=this.morphTargetInfluences;if(s&&o){mr.set(0,0,0);for(let l=0,c=s.length;l<c;l++){const h=o[l],u=s[l];h!==0&&($a.fromBufferAttribute(u,e),a?mr.addScaledVector($a,h):mr.addScaledVector($a.sub(t),h))}t.add(mr)}return t}raycast(e,t){const n=this.geometry,i=this.material,s=this.matrixWorld;i!==void 0&&(n.boundingSphere===null&&n.computeBoundingSphere(),ur.copy(n.boundingSphere),ur.applyM
vendor: 8,334 bytes, lines 5-9
5atrix4(s),ri.copy(e.ray).recast(e.near),!(ur.containsPoint(ri.origin)===!1&&(ri.intersectSphere(ur,Nc)===null||ri.origin.distanceToSquared(Nc)>(e.far-e.near)**2))&&(Uc.copy(s).invert(),ri.copy(e.ray).applyMatrix4(Uc),!(n.boundingBox!==null&&ri.intersectsBox(n.boundingBox)===!1)&&this._computeIntersections(e,t,ri)))}_computeIntersections(e,t,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],v=Math.max(g.start,f.start),x=Math.min(o.count,Math.min(g.start+g.count,f.start+f.count));for(let M=v,T=x;M<T;M+=3){const E=o.getX(M),C=o.getX(M+1),P=o.getX(M+2);i=_r(this,p,e,n,c,h,u,E,C,P),i&&(i.faceIndex=Math.floor(M/3),i.face.materialIndex=g.materialIndex,t.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 v=o.getX(g),x=o.getX(g+1),M=o.getX(g+2);i=_r(this,a,e,n,c,h,u,v,x,M),i&&(i.faceIndex=Math.floor(g/3),t.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],v=Math.max(g.start,f.start),x=Math.min(l.count,Math.min(g.start+g.count,f.start+f.count));for(let M=v,T=x;M<T;M+=3){const E=M,C=M+1,P=M+2;i=_r(this,p,e,n,c,h,u,E,C,P),i&&(i.faceIndex=Math.floor(M/3),i.face.materialIndex=g.materialIndex,t.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 v=g,x=g+1,M=g+2;i=_r(this,a,e,n,c,h,u,v,x,M),i&&(i.faceIndex=Math.floor(g/3),t.push(i))}}}}function Sf(r,e,t,n,i,s,a,o){let l;if(e.side===Xt?l=n.intersectTriangle(a,s,i,!0,o):l=n.intersectTriangle(i,s,a,e.side===Qn,o),l===null)return null;gr.copy(o),gr.applyMatrix4(r.matrixWorld);const c=t.ray.origin.distanceTo(gr);return c<t.near||c>t.far?null:{distance:c,point:gr.clone(),object:r}}function _r(r,e,t,n,i,s,a,o,l,c){r.getVertexPosition(o,dr),r.getVertexPosition(l,fr),r.getVertexPosition(c,pr);const h=Sf(r,e,t,n,dr,fr,pr,Fc);if(h){const u=new R;jt.getBarycoord(Fc,dr,fr,pr,u),i&&(h.uv=jt.getInterpolatedAttribute(i,o,l,c,u,new K)),s&&(h.uv1=jt.getInterpolatedAttribute(s,o,l,c,u,new K)),a&&(h.normal=jt.getInterpolatedAttribute(a,o,l,c,u,new R),h.normal.dot(n.direction)>0&&h.normal.multiplyScalar(-1));const d={a:o,b:l,c,normal:new R,materialIndex:0};jt.getNormal(dr,fr,pr,d.normal),h.face=d,h.barycoord=u}return h}class fs extends qe{constructor(e=1,t=1,n=1,i=1,s=1,a=1){super(),this.type="BoxGeometry",this.parameters={width:e,height:t,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,t,e,a,s,0),m("z","y","x",1,-1,n,t,-e,a,s,1),m("x","z","y",1,1,e,n,t,i,a,2),m("x","z","y",1,-1,e,n,-t,i,a,3),m("x","y","z",1,-1,e,t,n,i,s,4),m("x","y","z",-1,-1,e,t,-n,i,s,5),this.setIndex(l),this.setAttribute("position",new Te(c,3)),this.setAttribute("normal",new Te(h,3)),this.setAttribute("uv",new Te(u,2));function m(_,g,p,v,x,M,T,E,C,P,S){const b=M/C,L=T/P,F=M/2,B=T/2,G=E/2,q=C+1,V=P+1;let H=0,j=0;const pe=new R;for(let oe=0;oe<V;oe++){const he=oe*L-B;for(let We=0;We<q;We++){const ke=We*b-F;pe[_]=ke*v,pe[g]=he*x,pe[p]=G,c.push(pe.x,pe.y,pe.z),pe[_]=0,pe[g]=0,pe[p]=E>0?1:-1,h.push(pe.x,pe.y,pe.z),u.push(We/C),u.push(1-oe/P),H+=1}}for(let oe=0;oe<P;oe++)for(let he=0;he<C;he++){const We=d+he+q*oe,ke=d+he+q*(oe+1),at=d+(he+1)+q*(oe+1),ot=d+(he+1)+q*oe;l.push(We,ke,ot),l.push(ke,at,ot),j+=6}o.addGroup(f,j,S),f+=j,d+=H}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new fs(e.width,e.height,e.depth,e.widthSegments,e.heightSegments,e.depthSegments)}}function hs(r){const e={};for(const t in r){e[t]={};for(const n in r[t]){const i=r[t][n];i&&(i.isColor||i.isMatrix3||i.isMatrix4||i.isVector2||i.isVector3||i.isVector4||i.isTexture||i.isQuaternion)?i.isRenderTargetTexture?(de("UniformsUtils: Textures of render targets cannot be cloned via cloneUniforms() or mergeUniforms()."),e[t][n]=null):e[t][n]=i.clone():Array.isArray(i)?e[t][n]=i.slice():e[t][n]=i}}return e}function Nt(r){const e={};for(let t=0;t<r.length;t++){const n=hs(r[t]);for(const i in n)e[i]=n[i]}return e}function bf(r){const e=[];for(let t=0;t<r.length;t++)e.push(r[t].clone());return e}function xu(r){const e=r.getRenderTarget();return e===null?r.outputColorSpace:e.isXRRenderTarget===!0?e.texture.colorSpace:je.workingColorSpace}const Af={clone:hs,merge:Nt};var Tf=`void main() {
6	gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );
7}`,Ef=`void main() {
8	gl_FragColor = vec4( 1.0, 0.0, 0.0, 1.0 );
9}`;class pn extends Bt{constructor(e){super(),this.isShaderMaterial=!0,this.type="ShaderMaterial",this.defines={},this.uniforms={},this.uniformsGroups=[],this.vertexShader=Tf,this.fragmentShader=Ef,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,e!==void 0&&this.setValues(e)}copy(e){return super.copy(e),this.fragmentShader=e.fragmentShader,this.vertexShader=e.vertexShader,this.uniforms=hs(e.uniforms),this.uniformsGroups=bf(e.uniformsGroups),this.defines=Object.assign({},e.defines),this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.fog=e.fog,this.lights=e.lights,this.clipping=e.clipping,this.extensions=Object.assign({},e.extensions),this.glslVersion=e.glslVersion,this.defaultAttributeValues=Object.assign({},e.defaultAttributeValues),this.index0AttributeName=e.index0AttributeName,this.uniformsNeedUpdate=e.uniformsNeedUpdate,this}toJSON(e){const t=super.toJSON(e);t.glslVersion=this.glslVersion,t.uniforms={};for(const i in this.uniforms){const a=this.uniforms[i].value;a&&a.isTexture?t.uniforms[i]={type:"t",value:a.toJSON(e).uuid}:a&&a.isColor?t.uniforms[i]={type:"c",value:a.getHex()}:a&&a.isVector2?t.uniforms[i]={type:"v2",value:a.toArray()}:a&&a.isVector3?t.uniforms[i]={type:"v3",value:a.toArray()}:a&&a.isVector4?t.uniforms[i]={type:"v4",value:a.toArray()}:a&&a.isMatrix3?t.uniforms[i]={type:"m3",value:a.toArray()}:a&&a.isMatrix4?t.uniforms[i]={type:"m4",value:a.toArray()}:t.uniforms[i]={value:a}}Object.keys(this.defines).length>0&&(t.defines=this.defines),t.vertexShader=this.vertexShader,t.fragmentShader=this.fragmentShader,t.lights=this.lights,t.clipping=this.clipping;const n={};for(const i in this.extensions)this.extensions[i]===!0&&(n[i]=!0);return Object.keys(n).length>0&&(t.extensions=n),t}}class Ul extends nt{constructor(){super(),this.isCamera=!0,this.type="Camera",this.matrixWorldInverse=new Ge,this.projectionMatrix=new Ge,this.projectionMatrixInverse=new Ge,this.coordinateSystem=on,this._reversedDepth=!1}get reversedDepth(){return this._reversedDepth}copy(e,t){return super.copy(e,t),this.matrixWorldInverse.copy(e.matrixWorldInverse),this.projectionMatrix.copy(e.projectionMatrix),this.projectionMatrixInverse.copy(e.projectionMatrixInverse),this.coordinateSystem=e.coordinateSystem,this}getWorldDirection(e){return super.getWorldDirection(e).negate()}updateMatrixWorld(e){super.updateMatrixWorld(e),this.matrixWorldInverse.copy(this.matrixWorld).invert()}updateWorldMatrix(e,t){super.updateWorldMatrix(e,t),this.matrixWorldInverse.copy(this.matrixWorld).invert()}clone(){return new this.constructor().copy(this)}}const Zn=new R,Oc=new K,Bc=new K;class Pt extends Ul{constructor(e=50,t=1,n=.1,i=2e3){super(),this.isPerspectiveCamera=!0,this.type="PerspectiveCamera",this.fov=e,this.zoom=1,this.near=n,this.far=i,this.focus=10,this.aspect=t,this.view=null,this.filmGauge=35,this.filmOffset=0,this.updateProjectionMatrix()}copy(e,t){return super.copy(e,t),this.fov=e.fov,this.zoom=e.zoom,this.near=e.near,this.far=e.far,this.focus=e.focus,this.aspect=e.aspect,this.view=e.view===null?null:Object.assign({},e.view),this.filmGauge=e.filmGauge,this.filmOffset=e.filmOffset,this}setFocalLength(e){const t=.5*this.getFilmHeight()/e;this.fov=cs*2*Math.atan(t),this.updateProjectionMatrix()}getFocalLength(){const e=Math.tan(bi*.5*this.fov);return .5*this.getFilmHeight()/e}
vendor: 4,175 bytes, line 9
9getEffectiveFOV(){return cs*2*Math.atan(Math.tan(bi*.5*this.fov)/this.zoom)}getFilmWidth(){return this.filmGauge*Math.min(this.aspect,1)}getFilmHeight(){return this.filmGauge/Math.max(this.aspect,1)}getViewBounds(e,t,n){Zn.set(-1,-1,.5).applyMatrix4(this.projectionMatrixInverse),t.set(Zn.x,Zn.y).multiplyScalar(-e/Zn.z),Zn.set(1,1,.5).applyMatrix4(this.projectionMatrixInverse),n.set(Zn.x,Zn.y).multiplyScalar(-e/Zn.z)}getViewSize(e,t){return this.getViewBounds(e,Oc,Bc),t.subVectors(Bc,Oc)}setViewOffset(e,t,n,i,s,a){this.aspect=e/t,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=e,this.view.fullHeight=t,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 e=this.near;let t=e*Math.tan(bi*.5*this.fov)/this.zoom,n=2*t,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,t-=a.offsetY*n/c,i*=a.width/l,n*=a.height/c}const o=this.filmOffset;o!==0&&(s+=e*o/this.getFilmWidth()),this.projectionMatrix.makePerspective(s,s+i,t,t-n,e,this.far,this.coordinateSystem,this.reversedDepth),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(e){const t=super.toJSON(e);return t.object.fov=this.fov,t.object.zoom=this.zoom,t.object.near=this.near,t.object.far=this.far,t.object.focus=this.focus,t.object.aspect=this.aspect,this.view!==null&&(t.object.view=Object.assign({},this.view)),t.object.filmGauge=this.filmGauge,t.object.filmOffset=this.filmOffset,t}}const Hi=-90,Wi=1;class wf extends nt{constructor(e,t,n){super(),this.type="CubeCamera",this.renderTarget=n,this.coordinateSystem=null,this.activeMipmapLevel=0;const i=new Pt(Hi,Wi,e,t);i.layers=this.layers,this.add(i);const s=new Pt(Hi,Wi,e,t);s.layers=this.layers,this.add(s);const a=new Pt(Hi,Wi,e,t);a.layers=this.layers,this.add(a);const o=new Pt(Hi,Wi,e,t);o.layers=this.layers,this.add(o);const l=new Pt(Hi,Wi,e,t);l.layers=this.layers,this.add(l);const c=new Pt(Hi,Wi,e,t);c.layers=this.layers,this.add(c)}updateCoordinateSystem(){const e=this.coordinateSystem,t=this.children.concat(),[n,i,s,a,o,l]=t;for(const c of t)this.remove(c);if(e===on)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(e===Gs)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: "+e);for(const c of t)this.add(c),c.updateMatrixWorld()}update(e,t){this.parent===null&&this.updateMatrixWorld();const{renderTarget:n,activeMipmapLevel:i}=this;this.coordinateSystem!==e.coordinateSystem&&(this.coordinateSystem=e.coordinateSystem,this.updateCoordinateSystem());const[s,a,o,l,c,h]=this.children,u=e.getRenderTarget(),d=e.getActiveCubeFace(),f=e.getActiveMipmapLevel(),m=e.xr.enabled;e.xr.enabled=!1;const _=n.texture.generateMipmaps;n.texture.generateMipmaps=!1,e.setRenderTarget(n,0,i),e.render(t,s),e.setRenderTarget(n,1,i),e.render(t,a),e.setRenderTarget(n,2,i),e.render(t,o),e.setRenderTarget(n,3,i),e.render(t,l),e.setRenderTarget(n,4,i),e.render(t,c),n.texture.generateMipmaps=_,e.setRenderTarget(n,5,i),e.render(t,h),e.setRenderTarget(u,d,f),e.xr.enabled=m,n.texture.needsPMREMUpdate=!0}}class _a extends Mt{constructor(e=[],t=Bn,n,i,s,a,o,l,c,h){super(e,t,n,i,s,a,o,l,c,h),this.isCubeTexture=!0,this.flipY=!1}get images(){return this.image}set images(e){this.image=e}}class vu extends ln{constructor(e=1,t={}){super(e,e,t),this.isWebGLCubeRenderTarget=!0;const n={width:e,height:e,depth:1},i=[n,n,n,n,n,n];this.texture=new _a(i),this._setTextureOptions(t),this.texture.isRenderTargetTexture=!0}fromEquirectangularTexture(e,t){this.texture.type=t.type,this.texture.colorSpace
vendor: 18,146 bytes, lines 9-44
9=t.colorSpace,this.texture.generateMipmaps=t.generateMipmaps,this.texture.minFilter=t.minFilter,this.texture.magFilter=t.magFilter;const n={uniforms:{tEquirect:{value:null}},vertexShader:`
10
11				varying vec3 vWorldDirection;
12
13				vec3 transformDirection( in vec3 dir, in mat4 matrix ) {
14
15					return normalize( ( matrix * vec4( dir, 0.0 ) ).xyz );
16
17				}
18
19				void main() {
20
21					vWorldDirection = transformDirection( position, modelMatrix );
22
23					#include <begin_vertex>
24					#include <project_vertex>
25
26				}
27			`,fragmentShader:`
28
29				uniform sampler2D tEquirect;
30
31				varying vec3 vWorldDirection;
32
33				#include <common>
34
35				void main() {
36
37					vec3 direction = normalize( vWorldDirection );
38
39					vec2 sampleUV = equirectUv( direction );
40
41					gl_FragColor = texture2D( tEquirect, sampleUV );
42
43				}
44			`},i=new fs(5,5,5),s=new pn({name:"CubemapFromEquirect",uniforms:hs(n.uniforms),vertexShader:n.vertexShader,fragmentShader:n.fragmentShader,side:Xt,blending:Fn});s.uniforms.tEquirect.value=t;const a=new At(i,s),o=t.minFilter;return t.minFilter===Un&&(t.minFilter=mt),new wf(1,10,this).update(e,a),t.minFilter=o,a.geometry.dispose(),a.material.dispose(),this}clear(e,t=!0,n=!0,i=!0){const s=e.getRenderTarget();for(let a=0;a<6;a++)e.setRenderTarget(this,a),e.clear(t,n,i);e.setRenderTarget(s)}}class Us extends nt{constructor(){super(),this.isGroup=!0,this.type="Group"}}const Cf={type:"move"};class Ka{constructor(){this._targetRay=null,this._grip=null,this._hand=null}getHandSpace(){return this._hand===null&&(this._hand=new Us,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 Us,this._targetRay.matrixAutoUpdate=!1,this._targetRay.visible=!1,this._targetRay.hasLinearVelocity=!1,this._targetRay.linearVelocity=new R,this._targetRay.hasAngularVelocity=!1,this._targetRay.angularVelocity=new R),this._targetRay}getGripSpace(){return this._grip===null&&(this._grip=new Us,this._grip.matrixAutoUpdate=!1,this._grip.visible=!1,this._grip.hasLinearVelocity=!1,this._grip.linearVelocity=new R,this._grip.hasAngularVelocity=!1,this._grip.angularVelocity=new R),this._grip}dispatchEvent(e){return this._targetRay!==null&&this._targetRay.dispatchEvent(e),this._grip!==null&&this._grip.dispatchEvent(e),this._hand!==null&&this._hand.dispatchEvent(e),this}connect(e){if(e&&e.hand){const t=this._hand;if(t)for(const n of e.hand.values())this._getHandJoint(t,n)}return this.dispatchEvent({type:"connected",data:e}),this}disconnect(e){return this.dispatchEvent({type:"disconnected",data:e}),this._targetRay!==null&&(this._targetRay.visible=!1),this._grip!==null&&(this._grip.visible=!1),this._hand!==null&&(this._hand.visible=!1),this}update(e,t,n){let i=null,s=null,a=null;const o=this._targetRay,l=this._grip,c=this._hand;if(e&&t.session.visibilityState!=="visible-blurred"){if(c&&e.hand){a=!0;for(const _ of e.hand.values()){const g=t.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:e.handedness,target:this})):!c.inputState.pinching&&d<=f-m&&(c.inputState.pinching=!0,this.dispatchEvent({type:"pinchstart",handedness:e.handedness,target:this}))}else l!==null&&e.gripSpace&&(s=t.getPose(e.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=t.getPose(e.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(Cf)))}return o!==null&&(o.visible=i!==null),l!==null&&(l.visible=s!==null),c!==null&&(c.visible=a!==null),this}_getHandJoint(e,t){if(e.joints[t.jointName]===void 0){const n=new Us;n.matrixAutoUpdate=!1,n.visible=!1,e.joints[t.jointName]=n,e.add(n)}return e.joints[t.jointName]}}class Nl{constructor(e,t=25e-5){this.isFogExp2=!0,this.name="",this.color=new Me(e),this.density=t}clone(){return new Nl(this.color,this.density)}toJSON(){return{type:"FogExp2",name:this.name,color:this.color.getHex(),density:this.density}}}class Fl{constructor(e,t=1,n=1e3){this.isFog=!0,this.name="",this.color=new Me(e),this.near=t,this.far=n}clone(){return new Fl(this.color,this.near,this.far)}toJSON(){return{type:"Fog",name:this.name,color:this.color.getHex(),near:this.near,far:this.far}}}class Rf extends nt{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 cn,this.environmentIntensity=1,this.environmentRotation=new cn,this.overrideMaterial=null,typeof __THREE_DEVTOOLS__!="undefined"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}copy(e,t){return super.copy(e,t),e.background!==null&&(this.background=e.background.clone()),e.environment!==null&&(this.environment=e.environment.clone()),e.fog!==null&&(this.fog=e.fog.clone()),this.backgroundBlurriness=e.backgroundBlurriness,this.backgroundIntensity=e.backgroundIntensity,this.backgroundRotation.copy(e.backgroundRotation),this.environmentIntensity=e.environmentIntensity,this.environmentRotation.copy(e.environmentRotation),e.overrideMaterial!==null&&(this.overrideMaterial=e.overrideMaterial.clone()),this.matrixAutoUpdate=e.matrixAutoUpdate,this}toJSON(e){const t=super.toJSON(e);return this.fog!==null&&(t.object.fog=this.fog.toJSON()),this.backgroundBlurriness>0&&(t.object.backgroundBlurriness=this.backgroundBlurriness),this.backgroundIntensity!==1&&(t.object.backgroundIntensity=this.backgroundIntensity),t.object.backgroundRotation=this.backgroundRotation.toArray(),this.environmentIntensity!==1&&(t.object.environmentIntensity=this.environmentIntensity),t.object.environmentRotation=this.environmentRotation.toArray(),t}}class Ol{constructor(e,t){this.isInterleavedBuffer=!0,this.array=e,this.stride=t,this.count=e!==void 0?e.length/t:0,this.usage=aa,this.updateRanges=[],this.version=0,this.uuid=tn()}onUploadCallback(){}set needsUpdate(e){e===!0&&this.version++}setUsage(e){return this.usage=e,this}addUpdateRange(e,t){this.updateRanges.push({start:e,count:t})}clearUpdateRanges(){this.updateRanges.length=0}copy(e){return this.array=new e.array.constructor(e.array),this.count=e.count,this.stride=e.stride,this.usage=e.usage,this}copyAt(e,t,n){e*=this.stride,n*=t.stride;for(let i=0,s=this.stride;i<s;i++)this.array[e+i]=t.array[n+i];return this}set(e,t=0){return this.array.set(e,t),this}clone(e){e.arrayBuffers===void 0&&(e.arrayBuffers={}),this.array.buffer._uuid===void 0&&(this.array.buffer._uuid=tn()),e.arrayBuffers[this.array.buffer._uuid]===void 0&&(e.arrayBuffers[this.array.buffer._uuid]=this.array.slice(0).buffer);const t=new this.array.constructor(e.arrayBuffers[this.array.buffer._uuid]),n=new this.constructor(t,this.stride);return n.setUsage(this.usage),n}onUpload(e){return this.onUploadCallback=e,this}toJSON(e){return e.arrayBuffers===void 0&&(e.arrayBuffers={}),this.array.buffer._uuid===void 0&&(this.array.buffer._uuid=tn()),e.arrayBuffers[this.array.buffer._uuid]===void 0&&(e.arrayBuffers[this.array.buffer._uuid]=Array.from(new Uint32Array(this.array.buffer))),{uuid:this.uuid,buffer:this.array.buffer._uuid,type:this.array.constructor.name,stride:this.stride}}}const Ut=new R;class us{constructor(e,t,n,i=!1){this.isInterleavedBufferAttribute=!0,this.name="",this.data=e,this.itemSize=t,this.offset=n,this.normalized=i}get count(){return this.data.count}get array(){return this.data.array}set needsUpdate(e){this.data.needsUpdate=e}applyMatrix4(e){for(let t=0,n=this.data.count;t<n;t++)Ut.fromBufferAttribute(this,t),Ut.applyMatrix4(e),this.setXYZ(t,Ut.x,Ut.y,Ut.z);return this}applyNormalMatrix(e){for(let t=0,n=this.count;t<n;t++)Ut.fromBufferAttribute(this,t),Ut.applyNormalMatrix(e),this.setXYZ(t,Ut.x,Ut.y,Ut.z);return this}transformDirection(e){for(let t=0,n=this.count;t<n;t++)Ut.fromBufferAttribute(this,t),Ut.transformDirection(e),this.setXYZ(t,Ut.x,Ut.y,Ut.z);return this}getComponent(e,t){let n=this.array[e*this.data.stride+this.offset+t];return this.normalized&&(n=Ft(n,this.array)),n}setComponent(e,t,n){return this.normalized&&(n=Ze(n,this.array)),this.data.array[e*this.data.stride+this.offset+t]=n,this}setX(e,t){return this.normalized&&(t=Ze(t,this.array)),this.data.array[e*this.data.stride+this.offset]=t,this}setY(e,t){return this.normalized&&(t=Ze(t,this.array)),this.data.array[e*this.data.stride+this.offset+1]=t,this}setZ(e,t){return this.normalized&&(t=Ze(t,this.array)),this.data.array[e*this.data.stride+this.offset+2]=t,this}setW(e,t){return this.normalized&&(t=Ze(t,this.array)),this.data.array[e*this.data.stride+this.offset+3]=t,this}getX(e){let t=this.data.array[e*this.data.stride+this.offset];return this.normalized&&(t=Ft(t,this.array)),t}getY(e){let t=this.data.array[e*this.data.stride+this.offset+1];return this.normalized&&(t=Ft(t,this.array)),t}getZ(e){let t=this.data.array[e*this.data.stride+this.offset+2];return this.normalized&&(t=Ft(t,this.array)),t}getW(e){let t=this.data.array[e*this.data.stride+this.offset+3];return this.normalized&&(t=Ft(t,this.array)),t}setXY(e,t,n){return e=e*this.data.stride+this.offset,this.normalized&&(t=Ze(t,this.array),n=Ze(n,this.array)),this.data.array[e+0]=t,this.data.array[e+1]=n,this}setXYZ(e,t,n,i){return e=e*this.data.stride+this.offset,this.normalized&&(t=Ze(t,this.array),n=Ze(n,this.array),i=Ze(i,this.array)),this.data.array[e+0]=t,this.data.array[e+1]=n,this.data.array[e+2]=i,this}setXYZW(e,t,n,i,s){return e=e*this.data.stride+this.offset,this.normalized&&(t=Ze(t,this.array),n=Ze(n,this.array),i=Ze(i,this.array),s=Ze(s,this.array)),this.data.array[e+0]=t,this.data.array[e+1]=n,this.data.array[e+2]=i,this.data.array[e+3]=s,this}clone(e){if(e===void 0){oa("InterleavedBufferAttribute.clone(): Cloning an interleaved buffer attribute will de-interleave buffer data.");const t=[];for(let n=0;n<this.count;n++){const i=n*this.data.stride+this.offset;for(let s=0;s<this.itemSize;s++)t.push(this.data.array[i+s])}return new ut(new this.array.constructor(t),this.itemSize,this.normalized)}else return e.interleavedBuffers===void 0&&(e.interleavedBuffers={}),e.interleavedBuffers[this.data.uuid]===void 0&&(e.interleavedBuffers[this.data.uuid]=this.data.clone(e)),new us(e.interleavedBuffers[this.data.uuid],this.itemSize,this.offset,this.normalized)}toJSON(e){if(e===void 0){oa("InterleavedBufferAttribute.toJSON(): Serializing an interleaved buffer attribute will de-interleave buffer data.");const t=[];for(let n=0;n<this.count;n++){const i=n*this.data.stride+this.offset;for(let s=0;s<this.itemSize;s++)t.push(this.data.array[i+s])}return{itemSize:this.itemSize,type:this.array.constructor.name,array:t,normalized:this.normalized}}else return e.interleavedBuffers===void 0&&(e.interleavedBuffers={}),e.interleavedBuffers[this.data.uuid]===void 0&&(e.interleavedBuffers[this.data.uuid]=this.data.toJSON(e)),{isInterleavedBufferAttribute:!0,itemSize:this.itemSize,data:this.data.uuid,offset:this.offset,normalized:this.normalized}}}class yu extends Bt{constructor(e){super(),this.isSpriteMaterial=!0,this.type="SpriteMaterial",this.color=new Me(16777215),this.map=null,this.alphaMap=null,this.rotation=0,this.sizeAttenuation=!0,this.transparent=!0,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.alphaMap=e.alphaMap,this.rotation=e.rotation,this.sizeAttenuation=e.sizeAttenuation,this.fog=e.fog,this}}let Xi;const Ss=new R,qi=new R,Yi=new R,Zi=new K,bs=new K,Mu=new Ge,xr=new R,As=new R,vr=new R,zc=new K,Qa=new K,Vc=new K;class If extends nt{constructor(e=new yu){if(super(),this.isSprite=!0,this.type="Sprite",Xi===void 0){Xi=new qe;const t=new Float32Array([-.5,-.5,0,0,0,.5,-.5,0,1,0,.5,.5,0,1,1,-.5,.5,0,0,1]),n=new Ol(t,5);Xi.setIndex([0,1,2,0,2,3]),Xi.setAttribute("position",new us(n,3,0,!1)),Xi.setAttribute("uv",new us(n,2,3,!1))}this.geometry=Xi,this.material=e,this.center=new K(.5,.5),this.count=1}raycast(e,t){e.camera===null&&Le('Sprite: "Raycaster.camera" needs to be set in order to raycast against sprites.'),qi.setFromMatrixScale(this.matrixWorld),Mu.copy(e.camera.matrixWorld),this.modelViewMatrix.multiplyMatrices(e.camera.matrixWorldInverse,this.matrixWorld),Yi.setFromMatrixPosition(this.modelViewMatrix),e.camera.isPerspectiveCamera&&this.material.sizeAttenuation===!1&&qi.multiplyScalar(-Yi.z);const n=this.material.rotation;let i,s;n!==0&&(s=Math.cos(n),i=Math.sin(n));const a=this.center;yr(xr.set(-.5,-.5,0),Yi,a,qi,i,s),yr(As.set(.5,-.5,0),Yi,a,qi,i,s),yr(vr.set(.5,.5,0),Yi,a,qi,i,s),zc.set(0,0),Qa.set(1,0),Vc.set(1,1);let o=e.ray.intersectTriangle(xr,As,vr,!1,Ss);if(o===null&&(yr(As.set(-.5,.5,0),Yi,a,qi,i,s),Qa.set(0,1),o=e.ray.intersectTriangle(xr,vr,As,!1,Ss),o===null))return;const l=e.ray.origin.distanceTo(Ss);l<e.near||l>e.far||t.push({distance:l,point:Ss.clone(),uv:jt.getInterpolation(Ss,xr,As,vr,zc,Qa,Vc,new K),face:null,object:this})}copy(e,t){return super.copy(e,t),e.center!==void 0&&this.center.copy(e.center),this.material=e.material,this}}function yr(r,e,t,n,i,s){Zi.subVectors(r,t).addScalar(.5).multiply(n),i!==void 0?(bs.x=s*Zi.x-i*Zi.y,bs.y=i*Zi.x+s*Zi.y):bs.copy(Zi),r.copy(e),r.x+=bs.x,r.y+=bs.y,r.applyMatrix4(Mu)}const Mr=new R,kc=new R;class Pf extends nt{constructor(){super(),this.isLOD=!0,this._currentLevel=0,this.type="LOD",Object.defineProperties(this,{levels:{enumerable:!0,value:[]}}),this.autoUpdate=!0}copy(e){super.copy(e,!1);const t=e.levels;for(let n=0,i=t.length;n<i;n++){const s=t[n];this.addLevel(s.object.clone(),s.distance,s.hysteresis)}return this.autoUpdate=e.autoUpdate,this}addLevel(e,t=0,n=0){t=Math.abs(t);const i=this.levels;let s;for(s=0;s<i.length&&!(t<i[s].distance);s++);return i.splice(s,0,{distance:t,hysteresis:n,object:e}),this.add(e),this}removeLevel(e){const t=this.levels;for(let n=0;n<t.length;n++)if(t[n].distance===e){const i=t.splice(n,1);return this.remove(i[0].object),!0}return!1}getCurrentLevel(){return this._currentLevel}getObjectForDistance(e){const t=this.levels;if(t.length>0){let n,i;for(n=1,i=t.length;n<i;n++){let s=t[n].distance;if(t[n].object.visible&&(s-=s*t[n].hysteresis),e<s)break}return t[n-1].object}return null}raycast(e,t){if(this.levels.length>0){Mr.setFromMatrixPosition(this.matrixWorld);const i=e.ray.origin.distanceTo(Mr);this.getObjectForDistance(i).raycast(e,t)}}update(e){const t=this.levels;if(t.length>1){Mr.setFromMatrixPosition(e.matrixWorld),kc.setFromMatrixPosition(this.matrixWorld);const n=Mr.distanceTo(kc)/e.zoom;t[0].object.visible=!0;let i,s;for(i=1,s=t.length;i<s;i++){let a=t[i].distance;if(t[i].object.visible&&(a-=a*t[i].hysteresis),n>=a)t[i-1].object.visible=!1,t[i].object.visible=!0;else break}for(this._currentLevel=i-1;i<s;i++)t[i].object.visible=!1}}toJSON(e){const t=super.toJSON(e);this.autoUpdate===!1&&(t.object.autoUpdate=!1),t.object.levels=[];const n=this.levels;for(let i=0,s=n.length;i<s;i++){const a=n[i];t.object.levels.push({object:a.object.uuid,distance:a.distance,hysteresis:a.hysteresis})}return t}}const Gc=new R,Hc=new pt,Wc=new pt,Lf=new R,Xc=new Ge,Sr=new R,ja=new Lt,qc=new Ge,eo=new Ks;class Df extends At{constructor(e,t){super(e,t),this.isSkinnedMesh=!0,this.type="SkinnedMesh",this.bindMode=xc,this.bindMatrix=new Ge,this.bindMatrixInverse=new Ge,this.boundingBox=null,this.boundingSphere=null}computeBoundingBox(){const e=this.geometry;this.boundingBox===null&&(this.boundingBox=new Ot),this.boundingBox.makeEmpty();const t=e.getAttribute("position");for(let n=0;n<t.count;n++)this.getVertexPosition(n,Sr),this.boundingBox.expandByPoint(Sr)}computeBoundingSphere(){const e=this.geometry;this.boundingSphere===null&&(this.boundingSphere=new Lt),this.boundingSphere.makeEmpty();const t=e.getAttribute("position");for(let n=0;n<t.count;n++)this.getVertexPosition(n,Sr),this.boundingSphere.expandByPoint(Sr)}copy(e,t){return super.copy(e,t),this.bindMode=e.bindMode,this.bindMatrix.copy(e.bindMatrix),this.bindMatrixInverse.copy(e.bindMatrixInverse),this.skeleton=e.skeleton,e.boundingBox!==null&&(this.boundingBox=e.boundingBox.clone()),e.boundingSphere!==null&&(this.boundingSphere=e.boundingSphere.clone()),this}raycast(e,t){const n=this.material,i=this.matrixWorld;n!==void 0&&(this.boundingSphere===null&&this.computeBoundingSphere(),ja.copy(this.boundingSphere),ja.applyMatrix4(i),e.ray.intersectsSphere(ja)!==!1&&(qc.copy(i).invert(),eo.copy(e.ray).applyMatrix4(qc),!(this.boundingBox!==null&&eo.intersectsBox(this.boundingBox)===!1)&&this._computeIntersections(e,t,eo)))}getVertexPosition(e,t){return super.getVertexPosition(e,t),this.applyBoneTransform(e,t),t}bind(e,t){this.skeleton=e,t===void 0&&(this.updateMatrixWorld(!0),this.skeleton.calculateInverses(),t=this.matrixWorld),this.bindMatrix.copy(t),this.bindMatrixInverse.copy(t).invert()}pose(){this.skeleton.pose()}normalizeSkinWeights(){const e=new pt,t=this.geometry.attributes.skinWeight;for(let n=0,i=t.count;n<i;n++){e.fromBufferAttribute(t,n);const s=1/e.manhattanLength();s!==1/0?e.multiplyScalar(s):e.set(1,0,0,0),t.setXYZW(n,e.x,e.y,e.z,e.w)}}updateMatrixWorld(e){super.updateMatrixWorld(e),this.bindMode===xc?this.bindMatrixInverse.copy(this.matrixWorld).invert():this.bindMode===Rd?this.bindMatrixInverse.copy(this.bindMatrix).invert():de("SkinnedMesh: Unrecognized bindMode: "+this.bindMode)}
vendor: 10,715 bytes, line 44
44applyBoneTransform(e,t){const n=this.skeleton,i=this.geometry;Hc.fromBufferAttribute(i.attributes.skinIndex,e),Wc.fromBufferAttribute(i.attributes.skinWeight,e),Gc.copy(t).applyMatrix4(this.bindMatrix),t.set(0,0,0);for(let s=0;s<4;s++){const a=Wc.getComponent(s);if(a!==0){const o=Hc.getComponent(s);Xc.multiplyMatrices(n.bones[o].matrixWorld,n.boneInverses[o]),t.addScaledVector(Lf.copy(Gc).applyMatrix4(Xc),a)}}return t.applyMatrix4(this.bindMatrixInverse)}}class Su extends nt{constructor(){super(),this.isBone=!0,this.type="Bone"}}class bn extends Mt{constructor(e=null,t=1,n=1,i,s,a,o,l,c=bt,h=bt,u,d){super(null,a,o,l,c,h,i,s,u,d),this.isDataTexture=!0,this.image={data:e,width:t,height:n},this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}}const Yc=new Ge,Uf=new Ge;class Bl{constructor(e=[],t=[]){this.uuid=tn(),this.bones=e.slice(0),this.boneInverses=t,this.boneMatrices=null,this.previousBoneMatrices=null,this.boneTexture=null,this.init()}init(){const e=this.bones,t=this.boneInverses;if(this.boneMatrices=new Float32Array(e.length*16),t.length===0)this.calculateInverses();else if(e.length!==t.length){de("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 Ge)}}calculateInverses(){this.boneInverses.length=0;for(let e=0,t=this.bones.length;e<t;e++){const n=new Ge;this.bones[e]&&n.copy(this.bones[e].matrixWorld).invert(),this.boneInverses.push(n)}}pose(){for(let e=0,t=this.bones.length;e<t;e++){const n=this.bones[e];n&&n.matrixWorld.copy(this.boneInverses[e]).invert()}for(let e=0,t=this.bones.length;e<t;e++){const n=this.bones[e];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 e=this.bones,t=this.boneInverses,n=this.boneMatrices,i=this.boneTexture;for(let s=0,a=e.length;s<a;s++){const o=e[s]?e[s].matrixWorld:Uf;Yc.multiplyMatrices(o,t[s]),Yc.toArray(n,s*16)}i!==null&&(i.needsUpdate=!0)}clone(){return new Bl(this.bones,this.boneInverses)}computeBoneTexture(){let e=Math.sqrt(this.bones.length*4);e=Math.ceil(e/4)*4,e=Math.max(e,4);const t=new Float32Array(e*e*4);t.set(this.boneMatrices);const n=new bn(t,e,e,Wt,Ht);return n.needsUpdate=!0,this.boneMatrices=t,this.boneTexture=n,this}getBoneByName(e){for(let t=0,n=this.bones.length;t<n;t++){const i=this.bones[t];if(i.name===e)return i}}dispose(){this.boneTexture!==null&&(this.boneTexture.dispose(),this.boneTexture=null)}fromJSON(e,t){this.uuid=e.uuid;for(let n=0,i=e.bones.length;n<i;n++){const s=e.bones[n];let a=t[s];a===void 0&&(de("Skeleton: No bone found with UUID:",s),a=new Su),this.bones.push(a),this.boneInverses.push(new Ge().fromArray(e.boneInverses[n]))}return this.init(),this}toJSON(){const e={metadata:{version:4.7,type:"Skeleton",generator:"Skeleton.toJSON"},bones:[],boneInverses:[]};e.uuid=this.uuid;const t=this.bones,n=this.boneInverses;for(let i=0,s=t.length;i<s;i++){const a=t[i];e.bones.push(a.uuid);const o=n[i];e.boneInverses.push(o.toArray())}return e}}class Xs extends ut{constructor(e,t,n,i=1){super(e,t,n),this.isInstancedBufferAttribute=!0,this.meshPerAttribute=i}copy(e){return super.copy(e),this.meshPerAttribute=e.meshPerAttribute,this}toJSON(){const e=super.toJSON();return e.meshPerAttribute=this.meshPerAttribute,e.isInstancedBufferAttribute=!0,e}}const Ji=new Ge,Zc=new Ge,br=[],Jc=new Ot,Nf=new Ge,Ts=new At,Es=new Lt;class Ff extends At{constructor(e,t,n){super(e,t),this.isInstancedMesh=!0,this.instanceMatrix=new Xs(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,Nf)}computeBoundingBox(){const e=this.geometry,t=this.count;this.boundingBox===null&&(this.boundingBox=new Ot),e.boundingBox===null&&e.computeBoundingBox(),this.boundingBox.makeEmpty();for(let n=0;n<t;n++)this.getMatrixAt(n,Ji),Jc.copy(e.boundingBox).applyMatrix4(Ji),this.boundingBox.union(Jc)}computeBoundingSphere(){const e=this.geometry,t=this.count;this.boundingSphere===null&&(this.boundingSphere=new Lt),e.boundingSphere===null&&e.computeBoundingSphere(),this.boundingSphere.makeEmpty();for(let n=0;n<t;n++)this.getMatrixAt(n,Ji),Es.copy(e.boundingSphere).applyMatrix4(Ji),this.boundingSphere.union(Es)}copy(e,t){return super.copy(e,t),this.instanceMatrix.copy(e.instanceMatrix),e.morphTexture!==null&&(this.morphTexture=e.morphTexture.clone()),e.instanceColor!==null&&(this.instanceColor=e.instanceColor.clone()),this.count=e.count,e.boundingBox!==null&&(this.boundingBox=e.boundingBox.clone()),e.boundingSphere!==null&&(this.boundingSphere=e.boundingSphere.clone()),this}getColorAt(e,t){t.fromArray(this.instanceColor.array,e*3)}getMatrixAt(e,t){t.fromArray(this.instanceMatrix.array,e*16)}getMorphAt(e,t){const n=t.morphTargetInfluences,i=this.morphTexture.source.data.data,s=n.length+1,a=e*s+1;for(let o=0;o<n.length;o++)n[o]=i[a+o]}raycast(e,t){const n=this.matrixWorld,i=this.count;if(Ts.geometry=this.geometry,Ts.material=this.material,Ts.material!==void 0&&(this.boundingSphere===null&&this.computeBoundingSphere(),Es.copy(this.boundingSphere),Es.applyMatrix4(n),e.ray.intersectsSphere(Es)!==!1))for(let s=0;s<i;s++){this.getMatrixAt(s,Ji),Zc.multiplyMatrices(n,Ji),Ts.matrixWorld=Zc,Ts.raycast(e,br);for(let a=0,o=br.length;a<o;a++){const l=br[a];l.instanceId=s,l.object=this,t.push(l)}br.length=0}}setColorAt(e,t){this.instanceColor===null&&(this.instanceColor=new Xs(new Float32Array(this.instanceMatrix.count*3).fill(1),3)),t.toArray(this.instanceColor.array,e*3)}setMatrixAt(e,t){t.toArray(this.instanceMatrix.array,e*16)}setMorphAt(e,t){const n=t.morphTargetInfluences,i=n.length+1;this.morphTexture===null&&(this.morphTexture=new bn(new Float32Array(i*this.count),i,this.count,Al,Ht));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*e;s[l]=o,s.set(n,l+1)}updateMorphTargets(){}dispose(){this.dispatchEvent({type:"dispose"}),this.morphTexture!==null&&(this.morphTexture.dispose(),this.morphTexture=null)}}const to=new R,Of=new R,Bf=new Ye;class _i{constructor(e=new R(1,0,0),t=0){this.isPlane=!0,this.normal=e,this.constant=t}set(e,t){return this.normal.copy(e),this.constant=t,this}setComponents(e,t,n,i){return this.normal.set(e,t,n),this.constant=i,this}setFromNormalAndCoplanarPoint(e,t){return this.normal.copy(e),this.constant=-t.dot(this.normal),this}setFromCoplanarPoints(e,t,n){const i=to.subVectors(n,t).cross(Of.subVectors(e,t)).normalize();return this.setFromNormalAndCoplanarPoint(i,e),this}copy(e){return this.normal.copy(e.normal),this.constant=e.constant,this}normalize(){const e=1/this.normal.length();return this.normal.multiplyScalar(e),this.constant*=e,this}negate(){return this.constant*=-1,this.normal.negate(),this}distanceToPoint(e){return this.normal.dot(e)+this.constant}distanceToSphere(e){return this.distanceToPoint(e.center)-e.radius}projectPoint(e,t){return t.copy(e).addScaledVector(this.normal,-this.distanceToPoint(e))}intersectLine(e,t){const n=e.delta(to),i=this.normal.dot(n);if(i===0)return this.distanceToPoint(e.start)===0?t.copy(e.start):null;const s=-(e.start.dot(this.normal)+this.constant)/i;return s<0||s>1?null:t.copy(e.start).addScaledVector(n,s)}intersectsLine(e){const t=this.distanceToPoint(e.start),n=this.distanceToPoint(e.end);return t<0&&n>0||n<0&&t>0}intersectsBox(e){return e.intersectsPlane(this)}intersectsSphere(e){return e.intersectsPlane(this)}coplanarPoint(e){return e.copy(this.normal).multiplyScalar(-this.constant)}applyMatrix4(e,t){const n=t||Bf.getNormalMatrix(e),i=this.coplanarPoint(to).applyMatrix4(e),s=this.normal.applyMatrix3(n).normalize();return this.constant=-i.dot(s),this}translate(e){return this.constant-=e.dot(this.normal),this}equals(e){return e.normal.equals(this.normal)&&e.constant===this.constant}clone(){return new this.constructor().copy(this)}}const ai=new Lt,zf=new K(.5,.5),Ar=new R;class Qs{constructor(e=new _i,t=new _i,n=new _i,i=new _i,s=new _i,a=new _i){this.planes=[e,t,n,i,s,a]}set(e,t,n,i,s,a){const o=this.planes;return o[0].copy(e),o[1].copy(t),o[2].copy(n),o[3].copy(i),o[4].copy(s),o[5].copy(a),this}copy(e){const t=this.planes;for(let n=0;n<6;n++)t[n].copy(e.planes[n]);return this}setFromProjectionMatrix(e,t=on,n=!1){const i=this.planes,s=e.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],v=s[12],x=s[13],M=s[14],T=s[15];if(i[0].setComponents(c-a,f-h,p-m,T-v).normalize(),i[1].setComponents(c+a,f+h,p+m,T+v).normalize(),i[2].setComponents(c+o,f+u,p+_,T+x).normalize(),i[3].setComponents(c-o,f-u,p-_,T-x).normalize(),n)i[4].setComponents(l,d,g,M).normalize(),i[5].setComponents(c-l,f-d,p-g,T-M).normalize();else if(i[4].setComponents(c-l,f-d,p-g,T-M).normalize(),t===on)i[5].setComponents(c+l,f+d,p+g,T+M).normalize();else if(t===Gs)i[5].setComponents(l,d,g,M).normalize();else throw new Error("THREE.Frustum.setFromProjectionMatrix(): Invalid coordinate system: "+t);return this}intersectsObject(e){if(e.boundingSphere!==void 0)e.boundingSphere===null&&e.computeBoundingSphere(),ai.copy(e.boundingSphere).applyMatrix4(e.matrixWorld);else{const t=e.geometry;t.boundingSphere===null&&t.computeBoundingSphere(),ai.copy(t.boundingSphere).applyMatrix4(e.matrixWorld)}return this.intersectsSphere(ai)}intersectsSprite(e){ai.center.set(0,0,0);const t=zf.distanceTo(e.center);return ai.radius=.7071067811865476+t,ai.applyMatrix4(e.matrixWorld),this.intersectsSphere(ai)}intersectsSphere(e){const t=this.planes,n=e.center,i=-e.radius;for(let s=0;s<6;s++)if(t[s].distanceToPoint(n)<i)return!1;return!0}intersectsBox(e){const t=this.planes;for(let n=0;n<6;n++){const i=t[n];if(Ar.x=i.normal.x>0?e.max.x:e.min.x,Ar.y=i.normal.y>0?e.max.y:e.min.y,Ar.z=i.normal.z>0?e.max.z:e.min.z,i.distanceToPoint(Ar)<0)return!1}return!0}containsPoint(e){const t=this.planes;for(let n=0;n<6;n++)if(t[n].distanceToPoint(e)<0)return!1;return!0}clone(){return new this.constructor().copy(this)}}const _n=new Ge,xn=new Qs;class zl{constructor(){this.coordinateSystem=on}intersectsObject(e,t){if(!t.isArrayCamera||t.cameras.length===0)return!1;for(let n=0;n<t.cameras.length;n++){const i=t.cameras[n];if(_n.multiplyMatrices(i.projectionMatrix,i.matrixWorldInverse),xn.setFromProjectionMatrix(_n,i.coordinateSystem,i.reversedDepth),xn.intersectsObject(e))return!0}return!1}intersectsSprite(e,t){if(!t||!t.cameras||t.cameras.length===0)return!1;for(let n=0;n<t.cameras.length;n++){const i=t.cameras[n];if(_n.multiplyMatrices(i.projectionMatrix,i.matrixWorldInverse),xn.setFromProjectionMatrix(_
vendor: 3,481 bytes, line 44
44n,i.coordinateSystem,i.reversedDepth),xn.intersectsSprite(e))return!0}return!1}intersectsSphere(e,t){if(!t||!t.cameras||t.cameras.length===0)return!1;for(let n=0;n<t.cameras.length;n++){const i=t.cameras[n];if(_n.multiplyMatrices(i.projectionMatrix,i.matrixWorldInverse),xn.setFromProjectionMatrix(_n,i.coordinateSystem,i.reversedDepth),xn.intersectsSphere(e))return!0}return!1}intersectsBox(e,t){if(!t||!t.cameras||t.cameras.length===0)return!1;for(let n=0;n<t.cameras.length;n++){const i=t.cameras[n];if(_n.multiplyMatrices(i.projectionMatrix,i.matrixWorldInverse),xn.setFromProjectionMatrix(_n,i.coordinateSystem,i.reversedDepth),xn.intersectsBox(e))return!0}return!1}containsPoint(e,t){if(!t||!t.cameras||t.cameras.length===0)return!1;for(let n=0;n<t.cameras.length;n++){const i=t.cameras[n];if(_n.multiplyMatrices(i.projectionMatrix,i.matrixWorldInverse),xn.setFromProjectionMatrix(_n,i.coordinateSystem,i.reversedDepth),xn.containsPoint(e))return!0}return!1}clone(){return new zl}}function no(r,e){return r-e}function Vf(r,e){return r.z-e.z}function kf(r,e){return e.z-r.z}class Gf{constructor(){this.index=0,this.pool=[],this.list=[]}push(e,t,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=e,o.count=t,o.z=n,o.index=i}reset(){this.list.length=0,this.index=0}}const kt=new Ge,Hf=new Me(1,1,1),$c=new Qs,Wf=new zl,Tr=new Ot,oi=new Lt,ws=new R,Kc=new R,Xf=new R,io=new Gf,It=new At,Er=[];function qf(r,e,t=0){const n=e.itemSize;if(r.isInterleavedBufferAttribute||r.array.constructor!==e.array.constructor){const i=r.count;for(let s=0;s<i;s++)for(let a=0;a<n;a++)e.setComponent(s+t,a,r.getComponent(s,a))}else e.array.set(r.array,t*n);e.needsUpdate=!0}function li(r,e){if(r.constructor!==e.constructor){const t=Math.min(r.length,e.length);for(let n=0;n<t;n++)e[n]=r[n]}else{const t=Math.min(r.length,e.length);e.set(new r.constructor(r.buffer,0,t))}}class Yf extends At{constructor(e,t,n=t*2,i){super(new qe,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=e,this._maxVertexCount=t,this._maxIndexCount=n,this._multiDrawCounts=new Int32Array(e),this._multiDrawStarts=new Int32Array(e),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 e=Math.sqrt(this._maxInstanceCount*4);e=Math.ceil(e/4)*4,e=Math.max(e,4);const t=new Float32Array(e*e*4),n=new bn(t,e,e,Wt,Ht);this._matricesTexture=n}_initIndirectTexture(){let e=Math.sqrt(this._maxInstanceCount);e=Math.ceil(e);const t=new Uint32Array(e*e),n=new bn(t,e,e,ga,fn);this._indirectTexture=n}_initColorsTexture(){let e=Math.sqrt(this._maxInstanceCount);e=Math.ceil(e);const t=new Float32Array(e*e*4).fill(1),n=new bn(t,e,e,Wt,Ht);
44n.colorSpace=je.workingColorSpace,this._colorsTexture=n}_initializeGeometry(e){const t=this.geometry,n=this._maxVertexCount,i=this._maxIndexCount;if(this._geometryInitialized===!1){for(const s in e.attributes){const a=e.getAttribute(s),{array:o,itemSize:l,normalized:c}=a,h=new o.constructor(n*l),u=new ut(h,l,c);t.setAttribute(s,u)}if(e.getIndex()!==null){const s=n>65535?new Uint32Array(i):new Uint16Array(i);t.setIndex(new ut(s,1))}this._geometryInitialized=!0}}_validateGeometry(e){const t=this.geometry;if(!!e.getIndex()!=!!t.getIndex())throw new Error('THREE.BatchedMesh: All geometries must consistently have "index".');for(const n in t.attributes){if(!e.hasAttribute(n))throw new Error(`THREE.BatchedMesh: Added geometry missing "${n}". All geometries must have consistent attributes.`);const i=e.getAttribute(n),s=t.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(e){const t=this._instanceInfo;if(e<0||e>=t.length||t[e].active===!1)throw new Error(`THREE.BatchedMesh: Invalid instanceId ${e}. Instance is either out of range or has been deleted.`)}validateGeometryId(e){const t=this._geometryInfo;if(e<0||e>=t.length||t[e].active===!1)throw new Error(`THREE.BatchedMesh: Invalid geometryId ${e}. Geometry is either out of range or has been deleted.`)}setCustomSort(e){return this.customSort=e,this}computeBoundingBox(){this.boundingBox===null&&(this.boundingBox=new Ot);const e=this.boundingBox,t=this._instanceInfo;e.makeEmpty();for(let n=0,i=t.length;n<i;n++){if(t[n].active===!1)continue;const s=t[n].geometryIndex;this.getMatrixAt(n,kt),this.getBoundingBoxAt(s,Tr).applyMatrix4(kt),e.union(Tr)}}computeBoundingSphere(){this.boundingSphere===null&&(this.boundingSphere=new Lt);const e=this.boundingSphere,t=this._instanceInfo;e.makeEmpty();for(let n=0,i=t.length;n<i;n++){if(t[n].active===!1)continue;const s=t[n].geometryIndex;this.getMatrixAt(n,kt),this.getBoundingSphereAt(s,oi).applyMatrix4(kt),e.union(oi)}}addInstance(e){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:e};let i=null;this._availableInstanceIds.length>0?(this._availableInstanceIds.sort(no),i=this._availableInstanceIds.shift(),this._instanceInfo[i]=n):(i=this._instanceInfo.length,this._instanceInfo.push(n));const s=this._matricesTexture;kt.identity().toArray(s.image.data,i*16),s.needsUpdate=!0;const a=this._colorsTexture;return a&&(Hf.toArray(a.image.data,i*4),a.needsUpdate=!0),this._visibilityChanged=!0,i}addGeometry(e,t=-1,n=-1){this._initializeGeometry(e),this._validateGeometry(e);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=t===-1?e.getAttribute("position").count:t;const a=e.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(no),l=this._availableGeometryIds.shift(),s[l]=i):(l=this._geometryCount,this._geometryCount++,s.push(i)),this.setGeometryAt(l,e),this._nextIndexStart=i.indexStart+i.reservedIndexCount,this._nextVertexStart=i.vertexStart+i.reservedVertexCount,l}setGeometryAt(e,t){if(e>=this._geometryCount)throw new Error("THREE.BatchedMesh: Maximum geometry count reached.");this._validateGeometry(t);const n=this.geometry,i=n.getIndex()!==null,s=n.getIndex(),a=t.getIndex(),o=this._geometryInfo[e];if(i&&a.count>o.reservedIndexCount||t.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=t.getAttribute("position").count;for(const h in n.attributes){const u=t.getAttribute(h),d=n.getAttribute(h);qf(u,d,l);const f=u.itemSize;
vendor: 8,995 bytes, line 44
44for(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=t.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,t.boundingBox!==null&&(o.boundingBox=t.boundingBox.clone()),o.boundingSphere=null,t.boundingSphere!==null&&(o.boundingSphere=t.boundingSphere.clone()),this._visibilityChanged=!0,e}deleteGeometry(e){const t=this._geometryInfo;if(e>=t.length||t[e].active===!1)return this;const n=this._instanceInfo;for(let i=0,s=n.length;i<s;i++)n[i].active&&n[i].geometryIndex===e&&this.deleteInstance(i);return t[e].active=!1,this._availableGeometryIds.push(e),this._visibilityChanged=!0,this}deleteInstance(e){return this.validateInstanceId(e),this._instanceInfo[e].active=!1,this._availableInstanceIds.push(e),this._visibilityChanged=!0,this}optimize(){let e=0,t=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!==t){const{indexStart:h,vertexStart:u,reservedIndexCount:d}=c,f=s.index,m=f.array,_=e-u;for(let g=h;g<h+d;g++)m[g]=m[g]+_;f.array.copyWithin(t,h,h+d),f.addUpdateRange(t,d),f.needsUpdate=!0,c.indexStart=t}t+=c.reservedIndexCount}if(c.vertexStart!==e){const{vertexStart:h,reservedVertexCount:u}=c,d=s.attributes;for(const f in d){const m=d[f],{array:_,itemSize:g}=m;_.copyWithin(e*g,h*g,(h+u)*g),m.addUpdateRange(e*g,u*g),m.needsUpdate=!0}c.vertexStart=e}e+=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._visibilityChanged=!0,this}getBoundingBoxAt(e,t){if(e>=this._geometryCount)return null;const n=this.geometry,i=this._geometryInfo[e];if(i.boundingBox===null){const s=new Ot,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(ws.fromBufferAttribute(o,h))}i.boundingBox=s}return t.copy(i.boundingBox),t}getBoundingSphereAt(e,t){if(e>=this._geometryCount)return null;const n=this.geometry,i=this._geometryInfo[e];if(i.boundingSphere===null){const s=new Lt;this.getBoundingBoxAt(e,Tr),Tr.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)),ws.fromBufferAttribute(o,u),l=Math.max(l,s.center.distanceToSquared(ws))}s.radius=Math.sqrt(l),i.boundingSphere=s}return t.copy(i.boundingSphere),t}setMatrixAt(e,t){this.validateInstanceId(e);const n=this._matricesTexture,i=this._matricesTexture.image.data;return t.toArray(i,e*16),n.needsUpdate=!0,this}getMatrixAt(e,t){return this.validateInstanceId(e),t.fromArray(this._matricesTexture.image.data,e*16)}setColorAt(e,t){return this.validateInstanceId(e),this._colorsTexture===null&&this._initColorsTexture(),t.toArray(this._colorsTexture.image.data,e*4),this._colorsTexture.needsUpdate=!0,this}getColorAt(e,t){return this.validateInstanceId(e),t.fromArray(this._colorsTexture.image.data,e*4)}setVisibleAt(e,t){return this.validateInstanceId(e),this._instanceInfo[e].visible===t?this:(this._instanceInfo[e].visible=t,this._visibilityChanged=!0,this)}getVisibleAt(e){return this.validateInstanceId(e),this._instanceInfo[e].visible}setGeometryIdAt(e,t){return this.validateInstanceId(e),this.validateGeometryId(t),this._instanceInfo[e].geometryIndex=t,this}getGeometryIdAt(e){return this.validateInstanceId(e),this._instanceInfo[e].geometryIndex}getGeometryRangeAt(e,t={}){this.validateGeometryId(e);const n=this._geometryInfo[e];return t.vertexStart=n.vertexStart,t.vertexCount=n.vertexCount,t.reservedVertexCount=n.reservedVertexCount,t.indexStart=n.indexStart,t.indexCount=n.indexCount,t.reservedIndexCount=n.reservedIndexCount,t.start=n.start,t.count=n.count,t}setInstanceCount(e){const t=this._availableInstanceIds,n=this._instanceInfo;for(t.sort(no);t[t.length-1]===n.length-1;)n.pop(),t.pop();if(e<n.length)throw new Error(`BatchedMesh: Instance ids outside the range ${e} are being used. Cannot shrink instance count.`);const i=new Int32Array(e),s=new Int32Array(e);li(this._multiDrawCounts,i),li(this._multiDrawStarts,s),this._multiDrawCounts=i,this._multiDrawStarts=s,this._maxInstanceCount=e;const a=this._indirectTexture,o=this._matricesTexture,l=this._colorsTexture;a.dispose(),this._initIndirectTexture(),li(a.image.data,this._indirectTexture.image.data),o.dispose(),this._initMatricesTexture(),li(o.image.data,this._matricesTexture.image.data),l&&(l.dispose(),this._initColorsTexture(),li(l.image.data,this._colorsTexture.image.data))}setGeometrySize(e,t){const n=[...this._geometryInfo].filter(o=>o.active);if(Math.max(...n.map(o=>o.vertexStart+o.reservedVertexCount))>e)throw new Error(`BatchedMesh: Geometry vertex values are being used outside the range ${t}. Cannot shrink further.`);if(this.geometry.index&&Math.max(...n.map(l=>l.indexStart+l.reservedIndexCount))>t)throw new Error(`BatchedMesh: Geometry index values are being used outside the range ${t}. Cannot shrink further.`);const s=this.geometry;s.dispose(),this._maxVertexCount=e,this._maxIndexCount=t,this._geometryInitialized&&(this._geometryInitialized=!1,this.geometry=new qe,this._initializeGeometry(s));const a=this.geometry;s.index&&li(s.index.array,a.index.array);for(const o in s.attributes)li(s.attributes[o].array,a.attributes[o].array)}raycast(e,t){const n=this._instanceInfo,i=this._geometryInfo,s=this.matrixWorld,a=this.geometry;It.material=this.material,It.geometry.index=a.index,It.geometry.attributes=a.attributes,It.geometry.boundingBox===null&&(It.geometry.boundingBox=new Ot),It.geometry.boundingSphere===null&&(It.geometry.boundingSphere=new Lt);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];It.geometry.setDrawRange(h.start,h.count),this.getMatrixAt(o,It.matrixWorld).premultiply(s),this.getBoundingBoxAt(c,It.geometry.boundingBox),this.getBoundingSphereAt(c,It.geometry.boundingSphere),It.raycast(e,Er);for(let u=0,d=Er.length;u<d;u++){const f=Er[u];f.object=this,f.batchId=o,t.push(f)}Er.length=0}It.material=null,It.geometry.index=null,It.geometry.attributes={},It.geometry.setDrawRange(0,1/0)}copy(e){return super.copy(e),this.geometry=e.geometry.clone(),this.perObjectFrustumCulled=e.perObjectFrustumCulled,this.sortObjects=e.sortObjects,this.boundingBox=e.boundingBox!==null?e.boundingBox.clone():null,this.boundingSphere=e.boundingSphere!==null?e.boundingSphere.clone():null,this._geometryInfo=e._geometryInfo.map(t=>({...t,boundingBox:t.boundingBox!==null?t.boundingBox.clone():null,boundingSphere:t.boundingSphere!==null?t.boundingSphere.clone():null})),this._instanceInfo=e._instanceInfo.map(t=>({...t})),this._availableInstanceIds=e._availableInstanceIds.slice(),this._availableGeometryIds=e._availableGeometryIds.slice(),this._nextIndexStart=e._nextIndexStart,this._nextVertexStart=e._nextVertexStart,this._geometryCount=e._geometryCount,this._maxInstanceCount=e._maxInstanceCount,this._maxVertexCount=e._maxVertexCount,this._maxIndexCount=e._maxIndexCount,this._geometryInitialized=e._geometryInitialized,this._multiDrawCounts=e._multiDrawCounts.slice(),this._multiDrawStarts=e._multiDrawStarts.slice(),this._indirectTexture=e._indirectTexture.clone(),this._indirectTexture.image.data=this._indirectTexture.image.data.slice(),this._matricesTexture=e._matricesTexture.clone(),this._matricesTexture.image.data=this._matricesTexture.image.data.slice(),this._colorsTexture!==null&&(this._colorsTexture=e._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(e,t,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?Wf:$c;d&&!n.isArrayCamera&&(kt.multiplyMatrices(n.projectionMatrix,n.matrixWorldInverse).multiply(this.matrixWorld),$c.setFromProjectionMatrix(kt,n.coordinateSystem,n.reversedDepth));let g=0;if(this.sortObjects){kt.copy(this.matrixWorld).invert(),ws.setFromMatrixPosition(n.matrixWorld).applyMatrix4(kt),Kc.set(0,0,-1).transformDirection(n.matrixWorld).transformDirection(kt);for(let x=0,M=l.length;x<M;x++)if(l[x].visible&&l[x].active){const T=l[x].geometryIndex;
vendor: 5,223 bytes, line 44
44this.getMatrixAt(x,kt),this.getBoundingSphereAt(T,oi).applyMatrix4(kt);let E=!1;if(d&&(E=!_.intersectsSphere(oi,n)),!E){const C=u[T],P=Xf.subVectors(oi.center,ws).dot(Kc);io.push(C.start,C.count,P,x)}}const p=io.list,v=this.customSort;v===null?p.sort(s.transparent?kf:Vf):v.call(this,p,n);for(let x=0,M=p.length;x<M;x++){const T=p[x];c[g]=T.start*o,h[g]=T.count,m[g]=T.index,g++}io.reset()}else for(let p=0,v=l.length;p<v;p++)if(l[p].visible&&l[p].active){const x=l[p].geometryIndex;let M=!1;if(d&&(this.getMatrixAt(p,kt),this.getBoundingSphereAt(x,oi).applyMatrix4(kt),M=!_.intersectsSphere(oi,n)),!M){const T=u[x];c[g]=T.start*o,h[g]=T.count,m[g]=p,g++}}f.needsUpdate=!0,this._multiDrawCount=g,this._visibilityChanged=!1}onBeforeShadow(e,t,n,i,s,a){this.onBeforeRender(e,null,i,s,a)}}class qt extends Bt{constructor(e){super(),this.isLineBasicMaterial=!0,this.type="LineBasicMaterial",this.color=new Me(16777215),this.map=null,this.linewidth=1,this.linecap="round",this.linejoin="round",this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.linewidth=e.linewidth,this.linecap=e.linecap,this.linejoin=e.linejoin,this.fog=e.fog,this}}const la=new R,ca=new R,Qc=new Ge,Cs=new Ks,wr=new Lt,so=new R,jc=new R;class Ti extends nt{constructor(e=new qe,t=new qt){super(),this.isLine=!0,this.type="Line",this.geometry=e,this.material=t,this.morphTargetDictionary=void 0,this.morphTargetInfluences=void 0,this.updateMorphTargets()}copy(e,t){return super.copy(e,t),this.material=Array.isArray(e.material)?e.material.slice():e.material,this.geometry=e.geometry,this}computeLineDistances(){const e=this.geometry;if(e.index===null){const t=e.attributes.position,n=[0];for(let i=1,s=t.count;i<s;i++)la.fromBufferAttribute(t,i-1),ca.fromBufferAttribute(t,i),n[i]=n[i-1],n[i]+=la.distanceTo(ca);e.setAttribute("lineDistance",new Te(n,1))}else de("Line.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");return this}raycast(e,t){const n=this.geometry,i=this.matrixWorld,s=e.params.Line.threshold,a=n.drawRange;if(n.boundingSphere===null&&n.computeBoundingSphere(),wr.copy(n.boundingSphere),wr.applyMatrix4(i),wr.radius+=s,e.ray.intersectsSphere(wr)===!1)return;Qc.copy(i).invert(),Cs.copy(e.ray).applyMatrix4(Qc);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(_),v=h.getX(_+1),x=Cr(this,e,Cs,l,p,v,_);x&&t.push(x)}if(this.isLineLoop){const _=h.getX(m-1),g=h.getX(f),p=Cr(this,e,Cs,l,_,g,m-1);p&&t.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=Cr(this,e,Cs,l,_,_+1,_);p&&t.push(p)}if(this.isLineLoop){const _=Cr(this,e,Cs,l,m-1,f,m-1);_&&t.push(_)}}}updateMorphTargets(){const t=this.geometry.morphAttributes,n=Object.keys(t);if(n.length>0){const i=t[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 Cr(r,e,t,n,i,s,a){const o=r.geometry.attributes.position;if(la.fromBufferAttribute(o,i),ca.fromBufferAttribute(o,s),t.distanceSqToSegment(la,ca,so,jc)>n)return;so.applyMatrix4(r.matrixWorld);const c=e.ray.origin.distanceTo(so);if(!(c<e.near||c>e.far))return{distance:c,point:jc.clone().applyMatrix4(r.matrixWorld),index:a,face:null,faceIndex:null,barycoord:null,object:r}}const eh=new R,th=new R;class Gn extends Ti{constructor(e,t){super(e,t),this.isLineSegments=!0,this.type="LineSegments"}computeLineDistances(){const e=this.geometry;if(e.index===null){const t=e.attributes.position,n=[];for(let i=0,s=t.count;i<s;i+=2)eh.fromBufferAttribute(t,i),th.fromBufferAttribute(t,i+1),n[i]=i===0?0:n[i-1],n[i+1]=n[i]+eh.distanceTo(th);e.setAttribute("lineDistance",new Te(n,1))}else de("LineSegments.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");return this}}class Zf extends Ti{constructor(e,t){super(e,t),this.isLineLoop=!0,this.type="LineLoop"}}class bu extends Bt{constructor(e){super(),this.isPointsMaterial=!0,this.type="PointsMaterial",this.color=new Me(16777215),this.map=null,this.alphaMap=null,this.size=1,this.sizeAttenuation=!0,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.alphaMap=e.alphaMap,this.size=e.size,this.sizeAttenuation=e.sizeAttenuation,this.fog=e.fog,this}}const nh=new Ge,hl=new Ks,Rr=new Lt,Ir=new R;class Jf extends nt{constructor(e=new qe,t=new bu){super(),this.isPoints=!0,this.type="Points",this.geometry=e,this.material=t,this.morphTargetDictionary=void 0,this.morphTargetInfluences=void 0,this.updateMorphTargets()}copy(e,t){return super.copy(e,t),this.material=Array.isArray(e.material)?e.material.slice():e.material,this.geometry=e.geometry,this}raycast(e,t){const n=this.geometry,i=this.matrixWorld,s=e.params.Points.threshold,a=n.drawRange;if(n.boundingSphere===null&&n.computeBoundingSphere(),Rr.copy(n.boundingSphere),Rr.applyMatrix4(i),Rr.radius+=s,e.ray.intersectsSphere(Rr)===!1)return;
vendor: 4,459 bytes, line 44
44nh.copy(i).invert(),hl.copy(e.ray).applyMatrix4(nh);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);Ir.fromBufferAttribute(u,g),ih(Ir,g,l,i,e,t,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++)Ir.fromBufferAttribute(u,m),ih(Ir,m,l,i,e,t,this)}}updateMorphTargets(){const t=this.geometry.morphAttributes,n=Object.keys(t);if(n.length>0){const i=t[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 ih(r,e,t,n,i,s,a){const o=hl.distanceSqToPoint(r);if(o<t){const l=new R;hl.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:e,face:null,faceIndex:null,barycoord:null,object:a})}}class $f extends Mt{constructor(e,t,n,i,s=mt,a=mt,o,l,c){super(e,t,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=e.requestVideoFrameCallback(u)}"requestVideoFrameCallback"in e&&(this._requestVideoFrameCallbackId=e.requestVideoFrameCallback(u))}clone(){return new this.constructor(this.image).copy(this)}update(){const e=this.image;"requestVideoFrameCallback"in e===!1&&e.readyState>=e.HAVE_CURRENT_DATA&&(this.needsUpdate=!0)}dispose(){this._requestVideoFrameCallbackId!==0&&(this.source.data.cancelVideoFrameCallback(this._requestVideoFrameCallbackId),this._requestVideoFrameCallbackId=0),super.dispose()}}class Py extends $f{constructor(e,t,n,i,s,a,o,l){super({},e,t,n,i,s,a,o,l),this.isVideoFrameTexture=!0}update(){}clone(){return new this.constructor().copy(this)}setFrame(e){this.image=e,this.needsUpdate=!0}}class Ly extends Mt{constructor(e,t){super({width:e,height:t}),this.isFramebufferTexture=!0,this.magFilter=bt,this.minFilter=bt,this.generateMipmaps=!1,this.needsUpdate=!0}}class Vl extends Mt{constructor(e,t,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:t,height:n},this.mipmaps=e,this.flipY=!1,this.generateMipmaps=!1}}class Dy extends Vl{constructor(e,t,n,i,s,a){super(e,t,n,s,a),this.isCompressedArrayTexture=!0,this.image.depth=i,this.wrapR=en,this.layerUpdates=new Set}addLayerUpdate(e){this.layerUpdates.add(e)}clearLayerUpdates(){this.layerUpdates.clear()}}class Uy extends Vl{constructor(e,t,n){super(void 0,e[0].width,e[0].height,t,n,Bn),this.isCompressedCubeTexture=!0,this.isCubeTexture=!0,this.image=e}}class Ny extends Mt{constructor(e,t,n,i,s,a,o,l,c){super(e,t,n,i,s,a,o,l,c),this.isCanvasTexture=!0,this.needsUpdate=!0}}class qs extends Mt{constructor(e,t,n=fn,i,s,a,o=bt,l=bt,c,h=Vn,u=1){if(h!==Vn&&h!==yi)throw new Error("DepthTexture format must be either THREE.DepthFormat or THREE.DepthStencilFormat");const d={width:e,height:t,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(e){return super.copy(e),this.source=new Mi(Object.assign({},e.image)),this.compareFunction=e.compareFunction,this}toJSON(e){const t=super.toJSON(e);return this.compareFunction!==null&&(t.compareFunction=this.compareFunction),t}}class Kf extends qs{constructor(e,t=fn,n=Bn,i,s,a=bt,o=bt,l,c=Vn){const h={width:e,height:e,depth:1},u=[h,h,h,h,h,h];super(e,e,t,n,i,s,a,o,l,c),this.image=u,this.isCubeDepthTexture=!0,this.isCubeTexture=!0}get images(){return this.image}set images(e){this.image=e}}class Au extends Mt{constructor(e=null){super(),this.sourceTexture=e,this.isExternalTexture=!0}copy(e){return super.copy(e),this.sourceTexture=e.sourceTexture,this}}class kl extends qe{constructor(e=1,t=1,n=4,i=8,s=1){super(),this.type="CapsuleGeometry",this.parameters={radius:e,height:t,capSegments:n,radialSegments:i,heightSegments:s},t=Math.max(0,t),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=t/2,u=Math.PI/2*e,d=t,f=2*u+d,m=n*2+s,_=i+1,g=new R,p=new R;for(let v=0;v<=m;v++){let x=0,M=0,T=0,E=0;if(v<=n){const S=v/n,b=S*Math.PI/2;M=-h-e*Math.cos(b),T=e*Math.sin(b),E=-e*Math.cos(b),x=S*u}else if(v<=n+s){const S=(v-n)/s;M=-h+S*t,T=e,E=0,x=u+S*d}
vendor: 3,337 bytes, line 44
44else{const S=(v-n-s)/n,b=S*Math.PI/2;M=h+e*Math.sin(b),T=e*Math.cos(b),E=e*Math.sin(b),x=u+d+S*u}const C=Math.max(0,Math.min(1,x/f));let P=0;v===0?P=.5/i:v===m&&(P=-.5/i);for(let S=0;S<=i;S++){const b=S/i,L=b*Math.PI*2,F=Math.sin(L),B=Math.cos(L);p.x=-T*B,p.y=M,p.z=T*F,o.push(p.x,p.y,p.z),g.set(-T*B,E,T*F),g.normalize(),l.push(g.x,g.y,g.z),c.push(b+P,C)}if(v>0){const S=(v-1)*_;for(let b=0;b<i;b++){const L=S+b,F=S+b+1,B=v*_+b,G=v*_+b+1;a.push(L,F,B),a.push(F,G,B)}}}this.setIndex(a),this.setAttribute("position",new Te(o,3)),this.setAttribute("normal",new Te(l,3)),this.setAttribute("uv",new Te(c,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new kl(e.radius,e.height,e.capSegments,e.radialSegments,e.heightSegments)}}class Gl extends qe{constructor(e=1,t=32,n=0,i=Math.PI*2){super(),this.type="CircleGeometry",this.parameters={radius:e,segments:t,thetaStart:n,thetaLength:i},t=Math.max(3,t);const s=[],a=[],o=[],l=[],c=new R,h=new K;a.push(0,0,0),o.push(0,0,1),l.push(.5,.5);for(let u=0,d=3;u<=t;u++,d+=3){const f=n+u/t*i;c.x=e*Math.cos(f),c.y=e*Math.sin(f),a.push(c.x,c.y,c.z),o.push(0,0,1),h.x=(a[d]/e+1)/2,h.y=(a[d+1]/e+1)/2,l.push(h.x,h.y)}for(let u=1;u<=t;u++)s.push(u,u+1,0);this.setIndex(s),this.setAttribute("position",new Te(a,3)),this.setAttribute("normal",new Te(o,3)),this.setAttribute("uv",new Te(l,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new Gl(e.radius,e.segments,e.thetaStart,e.thetaLength)}}class xa extends qe{constructor(e=1,t=1,n=1,i=32,s=1,a=!1,o=0,l=Math.PI*2){super(),this.type="CylinderGeometry",this.parameters={radiusTop:e,radiusBottom:t,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;v(),a===!1&&(e>0&&x(!0),t>0&&x(!1)),this.setIndex(h),this.setAttribute("position",new Te(u,3)),this.setAttribute("normal",new Te(d,3)),this.setAttribute("uv",new Te(f,2));function v(){const M=new R,T=new R;let E=0;const C=(t-e)/n;for(let P=0;P<=s;P++){const S=[],b=P/s,L=b*(t-e)+e;for(let F=0;F<=i;F++){const B=F/i,G=B*l+o,q=Math.sin(G),V=Math.cos(G);T.x=L*q,T.y=-b*n+g,T.z=L*V,u.push(T.x,T.y,T.z),M.set(q,C,V).normalize(),d.push(M.x,M.y,M.z),f.push(B,1-b),S.push(m++)}_.push(S)}for(let P=0;P<i;P++)for(let S=0;S<s;S++){const b=_[S][P],L=_[S+1][P],F=_[S+1][P+1],B=_[S][P+1];(e>0||S!==0)&&(h.push(b,L,B),E+=3),(t>0||S!==s-1)&&(h.push(L,F,B),E+=3)}c.addGroup(p,E,0),p+=E}function x(M){const T=m,E=new K,C=new R;let P=0;const S=M===!0?e:t,b=M===!0?1:-1;for(let F=1;F<=i;F++)u.push(0,g*b,0),d.push(0,b,0),f.push(.5,.5),m++;const L=m;for(let F=0;F<=i;F++){const G=F/i*l+o,q=Math.cos(G),V=Math.sin(G);C.x=S*V,C.y=g*b,C.z=S*q,u.push(C.x,C.y,C.z),d.push(0,b,0),E.x=q*.5+.5,E.y=V*.5*b+.5,f.push(E.x,E.y),m++}for(let F=0;F<i;F++){const B=T+F,G=L+F;M===!0?h.push(G,G+1,B):h.push(G+1,G,B),P+=3}c.addGroup(p,P,M===!0?1:2),p+=P}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new xa(e.radiusTop,e.radiusBottom,e.height,e.radialSegments,e.heightSegments,e.openEnded,e.thetaStart,e.thetaLength)}}class va extends xa{constructor(e=1,t=1,n=32,i=1,s=!1,a=0,o=Math.PI*2){super(0,e,t,n,i,s,a,o),this.type="C
44oneGeometry",this.parameters={radius:e,height:t,radialSegments:n,heightSegments:i,openEnded:s,thetaStart:a,thetaLength:o}}static fromJSON(e){return new va(e.radius,e.height,e.radialSegments,e.heightSegments,e.openEnded,e.thetaStart,e.thetaLength)}}class Ri extends qe{constructor(e=[],t=[],n=1,i=0){super(),this.type="PolyhedronGeometry",this.parameters={vertices:e,indices:t,radius:n,detail:i};const s=[],a=[];o(i),c(n),h(),this.setAttribute("position",new Te(s,3)),this.setAttribute("normal",new Te(s.slice(),3)),this.setAttribute("uv",new Te(a,2)),i===0?this.computeVertexNormals():this.normalizeNormals();function o(v){const x=new R,M=new R,T=new R;for(let E=0;E<t.length;E+=3)f(t[E+0],x),f(t[E+1],M),f(t[E+2],T),l(x,M,T,v)}function l(v,x,M,T){const E=T+1,C=[];for(let P=0;P<=E;P++){C[P]=[];const S=v.clone().lerp(M,P/E),b=x.clone().lerp(M,P/E),L=E-P;for(let F=0;F<=L;F++)F===0&&P===E?C[P][F]=S:C[P][F]=S.clone().lerp(b,F/L)}for(let P=0;P<E;P++)for(let S=0;S<2*(E-P)-1;S++){const b=Math.floor(S/2);S%2===0?(d(C[P][b+1]),d(C[P+1][b]),d(C[P][b])):(d(C[P][b+1]),d(C[P+1][b+1]),d(C[P+1][b]))}}function c(v){const x=new R;for(let M=0;M<s.length;M+=3)x.x=s[M+0],x.y=s[M+1],x.z=s[M+2],x.normalize().multiplyScalar(v),s[M+0]=x.x,s[M+1]=x.y,s[M+2]=x.z}function h(){const v=new R;for(let x=0;x<s.length;x+=3){v.x=s[x+0],v.y=s[x+1],v.z=s[x+2];const M=g(v)/2/Math.PI+.5,T=p(v)/Math.PI+.5;a.push(M,1-T)}m(),u()}function u(){for(let v=0;v<a.length;v+=6){const x=a[v+0],M=a[v+2],T=a[v+4],E=Math.max(x,M,T),C=Math.min(x,M,T);E>.9&&C<.1&&(x<.2&&(a[v+0]+=1),M<.2&&(a[v+2]+=1),T<.2&&(a[v+4]+=1))}}function d(v){s.push(v.x,v.y,v.z)}function f(v,x){const M=v*3;x.x=e[M+0],x.y=e[M+1],x.z=e[M+2]}function m(){const v=new R,x=new R,M=new R,T=new R,E=new K,C=new K,P=new K;for(let S=0,b=0;S<s.length;S+=9,b+=6){v.set(s[S+0],s[S+1],s[S+2]),x.set(s[S+3],s[S+4],s[S+5]),M.set(s[S+6],s[S+7],s[S+8]),E.set(a[b+0],a[b+1]),C.set(a[b+2],a[b+3]),P.set(a[b+4],a[b+5]),T.copy(v).add(x).add(M).divideScalar(3);const L=g(T);_(E,b+0,v,L),_(C,b+2,x,L),_(P,b+4,M,L)}}function _(v,x,M,T){T<0&&v.x===1&&(a[x]=v.x-1),M.x===0&&M.z===0&&(a[x]=T/2/Math.PI+.5)}function g(v){return Math.atan2(v.z,-v.x)}function p(v){return Math.atan2(-v.y,Math.sqrt(v.x*v.x+v.z*v.z))}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new Ri(e.vertices,e.indices,e.radius,e.detail)}}class Hl extends Ri{constructor(e=1,t=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: 10,102 bytes, line 44
4419,5,14,19,14,4,19,4,17,1,12,14,1,14,5,1,5,9];super(s,a,e,t),this.type="DodecahedronGeometry",this.parameters={radius:e,detail:t}}static fromJSON(e){return new Hl(e.radius,e.detail)}}const Pr=new R,Lr=new R,ro=new R,Dr=new jt;class Qf extends qe{constructor(e=null,t=1){if(super(),this.type="EdgesGeometry",this.parameters={geometry:e,thresholdAngle:t},e!==null){const i=Math.pow(10,4),s=Math.cos(bi*t),a=e.getIndex(),o=e.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}=Dr;if(_.fromBufferAttribute(o,c[0]),g.fromBufferAttribute(o,c[1]),p.fromBufferAttribute(o,c[2]),Dr.getNormal(ro),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 v=0;v<3;v++){const x=(v+1)%3,M=u[v],T=u[x],E=Dr[h[v]],C=Dr[h[x]],P=`${M}_${T}`,S=`${T}_${M}`;S in d&&d[S]?(ro.dot(d[S].normal)<=s&&(f.push(E.x,E.y,E.z),f.push(C.x,C.y,C.z)),d[S]=null):P in d||(d[P]={index0:c[v],index1:c[x],normal:ro.clone()})}}for(const m in d)if(d[m]){const{index0:_,index1:g}=d[m];Pr.fromBufferAttribute(o,_),Lr.fromBufferAttribute(o,g),f.push(Pr.x,Pr.y,Pr.z),f.push(Lr.x,Lr.y,Lr.z)}this.setAttribute("position",new Te(f,3))}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}}class An{constructor(){this.type="Curve",this.arcLengthDivisions=200,this.needsUpdate=!1,this.cacheArcLengths=null}getPoint(){de("Curve: .getPoint() not implemented.")}getPointAt(e,t){const n=this.getUtoTmapping(e);return this.getPoint(n,t)}getPoints(e=5){const t=[];for(let n=0;n<=e;n++)t.push(this.getPoint(n/e));return t}getSpacedPoints(e=5){const t=[];for(let n=0;n<=e;n++)t.push(this.getPointAt(n/e));return t}getLength(){const e=this.getLengths();return e[e.length-1]}getLengths(e=this.arcLengthDivisions){if(this.cacheArcLengths&&this.cacheArcLengths.length===e+1&&!this.needsUpdate)return this.cacheArcLengths;this.needsUpdate=!1;const t=[];let n,i=this.getPoint(0),s=0;t.push(0);for(let a=1;a<=e;a++)n=this.getPoint(a/e),s+=n.distanceTo(i),t.push(s),i=n;return this.cacheArcLengths=t,t}updateArcLengths(){this.needsUpdate=!0,this.getLengths()}getUtoTmapping(e,t=null){const n=this.getLengths();let i=0;const s=n.length;let a;t?a=t:a=e*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(e,t){let i=e-1e-4,s=e+1e-4;i<0&&(i=0),s>1&&(s=1);const a=this.getPoint(i),o=this.getPoint(s),l=t||(a.isVector2?new K:new R);return l.copy(o).sub(a).normalize(),l}getTangentAt(e,t){const n=this.getUtoTmapping(e);return this.getTangent(n,t)}computeFrenetFrames(e,t=!1){const n=new R,i=[],s=[],a=[],o=new R,l=new Ge;for(let f=0;f<=e;f++){const m=f/e;i[f]=this.getTangentAt(m,new R)}s[0]=new R,a[0]=new R;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<=e;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(ze(i[f-1].dot(i[f]),-1,1));s[f].applyMatrix4(l.makeRotationAxis(o,m))}a[f].crossVectors(i[f],s[f])}if(t===!0){let f=Math.acos(ze(s[0].dot(s[e]),-1,1));f/=e,i[0].dot(o.crossVectors(s[0],s[e]))>0&&(f=-f);for(let m=1;m<=e;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(e){return this.arcLengthDivisions=e.arcLengthDivisions,this}toJSON(){const e={metadata:{version:4.7,type:"Curve",generator:"Curve.toJSON"}};return e.arcLengthDivisions=this.arcLengthDivisions,e.type=this.type,e}fromJSON(e){return this.arcLengthDivisions=e.arcLengthDivisions,this}}class Wl extends An{constructor(e=0,t=0,n=1,i=1,s=0,a=Math.PI*2,o=!1,l=0){super(),this.isEllipseCurve=!0,this.type="EllipseCurve",this.aX=e,this.aY=t,this.xRadius=n,this.yRadius=i,this.aStartAngle=s,this.aEndAngle=a,this.aClockwise=o,this.aRotation=l}getPoint(e,t=new K){const n=t,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+e*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(e){return super.copy(e),this.aX=e.aX,this.aY=e.aY,this.xRadius=e.xRadius,this.yRadius=e.yRadius,this.aStartAngle=e.aStartAngle,this.aEndAngle=e.aEndAngle,this.aClockwise=e.aClockwise,this.aRotation=e.aRotation,this}toJSON(){const e=super.toJSON();return e.aX=this.aX,e.aY=this.aY,e.xRadius=this.xRadius,e.yRadius=this.yRadius,e.aStartAngle=this.aStartAngle,e.aEndAngle=this.aEndAngle,e.aClockwise=this.aClockwise,e.aRotation=this.aRotation,e}fromJSON(e){return super.fromJSON(e),this.aX=e.aX,this.aY=e.aY,this.xRadius=e.xRadius,this.yRadius=e.yRadius,this.aStartAngle=e.aStartAngle,this.aEndAngle=e.aEndAngle,this.aClockwise=e.aClockwise,this.aRotation=e.aRotation,this}}class jf extends Wl{constructor(e,t,n,i,s,a){super(e,t,n,n,i,s,a),this.isArcCurve=!0,this.type="ArcCurve"}}function Xl(){let r=0,e=0,t=0,n=0;function i(s,a,o,l){r=s,e=o,t=-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+e*s+t*a+n*o}}}const Ur=new R,ao=new Xl,oo=new Xl,lo=new Xl;class ep extends An{constructor(e=[],t=!1,n="centripetal",i=.5){super(),this.isCatmullRomCurve3=!0,this.type="CatmullRomCurve3",this.points=e,this.closed=t,this.curveType=n,this.tension=i}getPoint(e,t=new R){const n=t,i=this.points,s=i.length,a=(s-(this.closed?0:1))*e;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]:(Ur.subVectors(i[0],i[1]).add(i[0]),c=Ur);const u=i[o%s],d=i[(o+1)%s];if(this.closed||o+2<s?h=i[(o+2)%s]:(Ur.subVectors(i[s-1],i[s-2]).add(i[s-1]),h=Ur),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=_),ao.initNonuniformCatmullRom(c.x,u.x,d.x,h.x,m,_,g),oo.initNonuniformCatmullRom(c.y,u.y,d.y,h.y,m,_,g),lo.initNonuniformCatmullRom(c.z,u.z,d.z,h.z,m,_,g)}else this.curveType==="catmullrom"&&(ao.initCatmullRom(c.x,u.x,d.x,h.x,this.tension),oo.initCatmullRom(c.y,u.y,d.y,h.y,this.tension),lo.initCatmullRom(c.z,u.z,d.z,h.z,this.tension));return n.set(ao.calc(l),oo.calc(l),lo.calc(l)),n}copy(e){super.copy(e),this.points=[];for(let t=0,n=e.points.length;t<n;t++){const i=e.points[t];this.points.push(i.clone())}return this.closed=e.closed,this.curveType=e.curveType,this.tension=e.tension,this}toJSON(){const e=super.toJSON();e.points=[];for(let t=0,n=this.points.length;t<n;t++){const i=this.points[t];e.points.push(i.toArray())}return e.closed=this.closed,e.curveType=this.curveType,e.tension=this.tension,e}fromJSON(e){super.fromJSON(e),this.points=[];for(let t=0,n=e.points.length;t<n;t++){const i=e.points[t];this.points.push(new R().fromArray(i))}return this.closed=e.closed,this.curveType=e.curveType,this.tension=e.tension,this}}function sh(r,e,t,n,i){const s=(n-e)*.5,a=(i-t)*.5,o=r*r,l=r*o;return(2*t-2*n+s+a)*l+(-3*t+3*n-2*s-a)*o+s*r+t}function tp(r,e){const t=1-r;return t*t*e}function np(r,e){return 2*(1-r)*r*e}function ip(r,e){return r*r*e}function Bs(r,e,t,n){return tp(r,e)+np(r,t)+ip(r,n)}function sp(r,e){const t=1-r;return t*t*t*e}function rp(r,e){const t=1-r;return 3*t*t*r*e}function ap(r,e){return 3*(1-r)*r*r*e}function op(r,e){return r*r*r*e}function zs(r,e,t,n,i){return sp(r,e)+rp(r,t)+ap(r,n)+op(r,i)}class Tu extends An{constructor(e=new K,t=new K,n=new K,i=new K){super(),this.isCubicBezierCurve=!0,this.type="CubicBezierCurve",this.v0=e,this.v1=t,this.v2=n,this.v3=i}getPoint(e,t=new K){const n=t,i=this.v0,s=this.v1,a=this.v2,o=this.v3;return n.set(zs(e,i.x,s.x,a.x,o.x),zs(e,i.y,s.y,a.y,o.y)),n}copy(e){return super.copy(e),this.v0.copy(e.v0),this.v1.copy(e.v1),this.v2.copy(e.v2),this.v3.copy(e.v3),this}toJSON(){const e=super.toJSON();return e.v0=this.v0.toArray(),e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e.v3=this.v3.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v0.fromArray(e.v0),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this.v3.fromArray(e.v3),this}}class lp extends An{constructor(e=new R,t=new R,n=new R,i=new R){super(),this.isCubicBezierCurve3=!0,this.type="CubicBezierCurve3",this.v0=e,this.v1=t,this.v2=n,this.v3=i}getPoint(e,t=new R){const n=t,i=this.v0,s=this.v1,a=this.v2,o=this.v3;return n.set(zs(e,i.x,s.x,a.x,o.x),zs(e,i.y,s.y,a.y,o.y),zs(e,i.z,s.z,a.z,o.z)),n}copy(e){return super.copy(e),this.v0.copy(e.v0),this.v1.copy(e.v1),this.v2.copy(e.v2),this.v3.copy(e.v3),this}toJSON(){const e=super.toJSON();return e.v0=this.v0.toArray(),e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e.v3=this.v3.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v0.fromArray(e.v0),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this.v3.fromArray(e.v3),this}}class Eu extends An{constructor(e=new K,t=new K){super(),this.isLineCurve=!0,this.type="LineCurve",this.v1=e,this.v2=t}getPoint(e,t=new K){const n=t;return e===1?n.copy(this.v2):(n.copy(this.v2).sub(this.v1),n.multiplyScalar(e).add(this.v1)),n}getPointAt(e,t){return this.getPoint(e,t)}
vendor: 8,930 bytes, line 44
44getTangent(e,t=new K){return t.subVectors(this.v2,this.v1).normalize()}getTangentAt(e,t){return this.getTangent(e,t)}copy(e){return super.copy(e),this.v1.copy(e.v1),this.v2.copy(e.v2),this}toJSON(){const e=super.toJSON();return e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this}}class cp extends An{constructor(e=new R,t=new R){super(),this.isLineCurve3=!0,this.type="LineCurve3",this.v1=e,this.v2=t}getPoint(e,t=new R){const n=t;return e===1?n.copy(this.v2):(n.copy(this.v2).sub(this.v1),n.multiplyScalar(e).add(this.v1)),n}getPointAt(e,t){return this.getPoint(e,t)}getTangent(e,t=new R){return t.subVectors(this.v2,this.v1).normalize()}getTangentAt(e,t){return this.getTangent(e,t)}copy(e){return super.copy(e),this.v1.copy(e.v1),this.v2.copy(e.v2),this}toJSON(){const e=super.toJSON();return e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this}}class wu extends An{constructor(e=new K,t=new K,n=new K){super(),this.isQuadraticBezierCurve=!0,this.type="QuadraticBezierCurve",this.v0=e,this.v1=t,this.v2=n}getPoint(e,t=new K){const n=t,i=this.v0,s=this.v1,a=this.v2;return n.set(Bs(e,i.x,s.x,a.x),Bs(e,i.y,s.y,a.y)),n}copy(e){return super.copy(e),this.v0.copy(e.v0),this.v1.copy(e.v1),this.v2.copy(e.v2),this}toJSON(){const e=super.toJSON();return e.v0=this.v0.toArray(),e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v0.fromArray(e.v0),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this}}class Cu extends An{constructor(e=new R,t=new R,n=new R){super(),this.isQuadraticBezierCurve3=!0,this.type="QuadraticBezierCurve3",this.v0=e,this.v1=t,this.v2=n}getPoint(e,t=new R){const n=t,i=this.v0,s=this.v1,a=this.v2;return n.set(Bs(e,i.x,s.x,a.x),Bs(e,i.y,s.y,a.y),Bs(e,i.z,s.z,a.z)),n}copy(e){return super.copy(e),this.v0.copy(e.v0),this.v1.copy(e.v1),this.v2.copy(e.v2),this}toJSON(){const e=super.toJSON();return e.v0=this.v0.toArray(),e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v0.fromArray(e.v0),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this}}class Ru extends An{constructor(e=[]){super(),this.isSplineCurve=!0,this.type="SplineCurve",this.points=e}getPoint(e,t=new K){const n=t,i=this.points,s=(i.length-1)*e,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(sh(o,l.x,c.x,h.x,u.x),sh(o,l.y,c.y,h.y,u.y)),n}copy(e){super.copy(e),this.points=[];for(let t=0,n=e.points.length;t<n;t++){const i=e.points[t];this.points.push(i.clone())}return this}toJSON(){const e=super.toJSON();e.points=[];for(let t=0,n=this.points.length;t<n;t++){const i=this.points[t];e.points.push(i.toArray())}return e}fromJSON(e){super.fromJSON(e),this.points=[];for(let t=0,n=e.points.length;t<n;t++){const i=e.points[t];this.points.push(new K().fromArray(i))}return this}}var ha=Object.freeze({__proto__:null,ArcCurve:jf,CatmullRomCurve3:ep,CubicBezierCurve:Tu,CubicBezierCurve3:lp,EllipseCurve:Wl,LineCurve:Eu,LineCurve3:cp,QuadraticBezierCurve:wu,QuadraticBezierCurve3:Cu,SplineCurve:Ru});class hp extends An{constructor(){super(),this.type="CurvePath",this.curves=[],this.autoClose=!1}add(e){this.curves.push(e)}closePath(){const e=this.curves[0].getPoint(0),t=this.curves[this.curves.length-1].getPoint(1);if(!e.equals(t)){const n=e.isVector2===!0?"LineCurve":"LineCurve3";this.curves.push(new ha[n](t,e))}return this}getPoint(e,t){const n=e*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,t)}s++}return null}getLength(){const e=this.getCurveLengths();return e[e.length-1]}updateArcLengths(){this.needsUpdate=!0,this.cacheLengths=null,this.getCurveLengths()}getCurveLengths(){if(this.cacheLengths&&this.cacheLengths.length===this.curves.length)return this.cacheLengths;const e=[];let t=0;for(let n=0,i=this.curves.length;n<i;n++)t+=this.curves[n].getLength(),e.push(t);return this.cacheLengths=e,e}getSpacedPoints(e=40){const t=[];for(let n=0;n<=e;n++)t.push(this.getPoint(n/e));return this.autoClose&&t.push(t[0]),t}getPoints(e=12){const t=[];let n;for(let i=0,s=this.curves;i<s.length;i++){const a=s[i],o=a.isEllipseCurve?e*2:a.isLineCurve||a.isLineCurve3?1:a.isSplineCurve?e*a.points.length:e,l=a.getPoints(o);for(let c=0;c<l.length;c++){const h=l[c];n&&n.equals(h)||(t.push(h),n=h)}}return this.autoClose&&t.length>1&&!t[t.length-1].equals(t[0])&&t.push(t[0]),t}copy(e){super.copy(e),this.curves=[];for(let t=0,n=e.curves.length;t<n;t++){const i=e.curves[t];this.curves.push(i.clone())}return this.autoClose=e.autoClose,this}toJSON(){const e=super.toJSON();e.autoClose=this.autoClose,e.curves=[];for(let t=0,n=this.curves.length;t<n;t++){const i=this.curves[t];e.curves.push(i.toJSON())}return e}fromJSON(e){super.fromJSON(e),this.autoClose=e.autoClose,this.curves=[];for(let t=0,n=e.curves.length;t<n;t++){const i=e.curves[t];this.curves.push(new ha[i.type]().fromJSON(i))}return this}}class ul extends hp{constructor(e){super(),this.type="Path",this.currentPoint=new K,e&&this.setFromPoints(e)}setFromPoints(e){this.moveTo(e[0].x,e[0].y);for(let t=1,n=e.length;t<n;t++)this.lineTo(e[t].x,e[t].y);return this}moveTo(e,t){return this.currentPoint.set(e,t),this}lineTo(e,t){const n=new Eu(this.currentPoint.clone(),new K(e,t));return this.curves.push(n),this.currentPoint.set(e,t),this}quadraticCurveTo(e,t,n,i){const s=new wu(this.currentPoint.clone(),new K(e,t),new K(n,i));return this.curves.push(s),this.currentPoint.set(n,i),this}bezierCurveTo(e,t,n,i,s,a){const o=new Tu(this.currentPoint.clone(),new K(e,t),new K(n,i),new K(s,a));return this.curves.push(o),this.currentPoint.set(s,a),this}splineThru(e){const t=[this.currentPoint.clone()].concat(e),n=new Ru(t);return this.curves.push(n),this.currentPoint.copy(e[e.length-1]),this}arc(e,t,n,i,s,a){const o=this.currentPoint.x,l=this.currentPoint.y;return this.absarc(e+o,t+l,n,i,s,a),this}absarc(e,t,n,i,s,a){return this.absellipse(e,t,n,n,i,s,a),this}ellipse(e,t,n,i,s,a,o,l){const c=this.currentPoint.x,h=this.currentPoint.y;return this.absellipse(e+c,t+h,n,i,s,a,o,l),this}absellipse(e,t,n,i,s,a,o,l){const c=new Wl(e,t,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(e){return super.copy(e),this.currentPoint.copy(e.currentPoint),this}toJSON(){const e=super.toJSON();return e.currentPoint=this.currentPoint.toArray(),e}fromJSON(e){return super.fromJSON(e),this.currentPoint.fromArray(e.currentPoint),this}}class rs extends ul{constructor(e){super(e),this.uuid=tn(),this.type="Shape",this.holes=[]}getPointsHoles(e){const t=[];for(let n=0,i=this.holes.length;n<i;n++)t[n]=this.holes[n].getPoints(e);return t}extractPoints(e){return{shape:this.getPoints(e),holes:this.getPointsHoles(e)}}copy(e){super.copy(e),this.holes=[];for(let t=0,n=e.holes.length;t<n;t++){const i=e.holes[t];this.holes.push(i.clone())}return this}toJSON(){const e=super.toJSON();e.uuid=this.uuid,e.holes=[];for(let t=0,n=this.holes.length;t<n;t++){const i=this.holes[t];e.holes.push(i.toJSON())}return e}fromJSON(e){super.fromJSON(e),this.uuid=e.uuid,this.holes=[];for(let t=0,n=e.holes.length;t<n;t++){const i=e.holes[t];this.holes.push(new ul().fromJSON(i))}return this}}function up(r,e,t=2){const n=e&&e.length,i=n?e[0]*t:r.length;let s=Iu(r,0,i,t,!0);const a=[];if(!s||s.next===s.prev)return a;let o,l,c;if(n&&(s=gp(r,e,s,t)),r.length>80*t){o=r[0],l=r[1];let h=o,u=l;for(let d=t;d<i;d+=t){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 Ys(s,a,t,o,l,c,0),a}function Iu(r,e,t,n,i){let s;if(i===wp(r,e,t,n)>0)for(let a=e;a<t;a+=n)s=rh(a/n|0,r[a],r[a+1],s);else for(let a=t-n;a>=e;a-=n)s=rh(a/n|0,r[a],r[a+1],s);return s&&ds(s,s.next)&&(Js(s),s=s.next),s}function Ei(r,e){if(!r)return r;e||(e=r);let t=r,n;do if(n=!1,!t.steiner&&(ds(t,t.next)||gt(t.prev,t,t.next)===0)){if(Js(t),t=e=t.prev,t===t.next)break;n=!0}else t=t.next;while(n||t!==e);return e}function Ys(r,e,t,n,i,s,a){if(!r)return;!a&&s&&Mp(r,n,i,s);let o=r;for(;r.prev!==r.next;){const l=r.prev,c=r.next;if(s?fp(r,n,i,s):dp(r)){e.push(l.i,r.i,c.i),Js(r),r=c.next,o=c.next;continue}if(r=c,r===o){a?a===1?(r=pp(Ei(r),e),Ys(r,e,t,n,i,s,2)):a===2&&mp(r,e,t,n,i,s):Ys(Ei(r),e,t,n,i,s,1);break}}}function dp(r){const e=r.prev,t=r,n=r.next;if(gt(e,t,n)>=0)return!1;const i=e.x,s=t.x,a=n.x,o=e.y,l=t.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!==e;){if(m.x>=h&&m.x<=d&&m.y>=u&&m.y<=f&&Ns(i,o,s,l,a,c,m.x,m.y)&&gt(m.prev,m,m.next)>=0)return!1;m=m.next}return!0}function fp(r,e,t,n){const i=r.prev,s=r,a=r.next;if(gt(i,s,a)>=0)return!1;
vendor: 1,346 bytes, line 44
44const 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=dl(f,m,e,t,n),v=dl(_,g,e,t,n);let x=r.prevZ,M=r.nextZ;for(;x&&x.z>=p&&M&&M.z<=v;){if(x.x>=f&&x.x<=_&&x.y>=m&&x.y<=g&&x!==i&&x!==a&&Ns(o,h,l,u,c,d,x.x,x.y)&&gt(x.prev,x,x.next)>=0||(x=x.prevZ,M.x>=f&&M.x<=_&&M.y>=m&&M.y<=g&&M!==i&&M!==a&&Ns(o,h,l,u,c,d,M.x,M.y)&&gt(M.prev,M,M.next)>=0))return!1;M=M.nextZ}for(;x&&x.z>=p;){if(x.x>=f&&x.x<=_&&x.y>=m&&x.y<=g&&x!==i&&x!==a&&Ns(o,h,l,u,c,d,x.x,x.y)&&gt(x.prev,x,x.next)>=0)return!1;x=x.prevZ}for(;M&&M.z<=v;){if(M.x>=f&&M.x<=_&&M.y>=m&&M.y<=g&&M!==i&&M!==a&&Ns(o,h,l,u,c,d,M.x,M.y)&&gt(M.prev,M,M.next)>=0)return!1;M=M.nextZ}return!0}function pp(r,e){let t=r;do{const n=t.prev,i=t.next.next;!ds(n,i)&&Lu(n,t,t.next,i)&&Zs(n,i)&&Zs(i,n)&&(e.push(n.i,t.i,i.i),Js(t),Js(t.next),t=r=i),t=t.next}while(t!==r);return Ei(t)}function mp(r,e,t,n,i,s){let a=r;do{let o=a.next.next;for(;o!==a.prev;){if(a.i!==o.i&&Ap(a,o)){let l=Du(a,o);a=Ei(a,a.next),l=Ei(l,l.next),Ys(a,e,t,n,i,s,0),Ys(l,e,t,n,i,s,0);return}o=o.next}a=a.next}while(a!==r)}function gp(r,e,t,n){const i=[];for(let s=0,a=e.length;s<a;s++){const o=e[s]*n,l=s<a-1?e[s+1]*n:r.length,c=Iu(r,o,l,n,!1);c===c.next&&(c.steiner=!0),i.push(bp(c))}i.sort(_p);for(let s=0;s<i.length;s++)t=xp(i[s],t);return t}function _p(r,e){let t=r.x-e.x;
vendor: 5,476 bytes, line 44
44if(t===0&&(t=r.y-e.y,t===0)){const n=(r.next.y-r.y)/(r.next.x-r.x),i=(e.next.y-e.y)/(e.next.x-e.x);t=n-i}return t}function xp(r,e){const t=vp(r,e);if(!t)return e;const n=Du(t,r);return Ei(n,n.next),Ei(t,t.next)}function vp(r,e){let t=e;const n=r.x,i=r.y;let s=-1/0,a;if(ds(r,t))return t;do{if(ds(r,t.next))return t.next;if(i<=t.y&&i>=t.next.y&&t.next.y!==t.y){const u=t.x+(i-t.y)*(t.next.x-t.x)/(t.next.y-t.y);if(u<=n&&u>s&&(s=u,a=t.x<t.next.x?t:t.next,u===n))return a}t=t.next}while(t!==e);if(!a)return null;const o=a,l=a.x,c=a.y;let h=1/0;t=a;do{if(n>=t.x&&t.x>=l&&n!==t.x&&Pu(i<c?n:s,i,l,c,i<c?s:n,i,t.x,t.y)){const u=Math.abs(i-t.y)/(n-t.x);Zs(t,r)&&(u<h||u===h&&(t.x>a.x||t.x===a.x&&yp(a,t)))&&(a=t,h=u)}t=t.next}while(t!==o);return a}function yp(r,e){return gt(r.prev,r,e.prev)<0&&gt(e.next,r,r.next)<0}function Mp(r,e,t,n){let i=r;do i.z===0&&(i.z=dl(i.x,i.y,e,t,n)),i.prevZ=i.prev,i.nextZ=i.next,i=i.next;while(i!==r);i.prevZ.nextZ=null,i.prevZ=null,Sp(i)}function Sp(r){let e,t=1;do{let n=r,i;r=null;let s=null;for(e=0;n;){e++;let a=n,o=0;for(let c=0;c<t&&(o++,a=a.nextZ,!!a);c++);let l=t;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,t*=2}while(e>1);return r}function dl(r,e,t,n,i){return r=(r-t)*i|0,e=(e-n)*i|0,r=(r|r<<8)&16711935,r=(r|r<<4)&252645135,r=(r|r<<2)&858993459,r=(r|r<<1)&1431655765,e=(e|e<<8)&16711935,e=(e|e<<4)&252645135,e=(e|e<<2)&858993459,e=(e|e<<1)&1431655765,r|e<<1}function bp(r){let e=r,t=r;do(e.x<t.x||e.x===t.x&&e.y<t.y)&&(t=e),e=e.next;while(e!==r);return t}function Pu(r,e,t,n,i,s,a,o){return(i-a)*(e-o)>=(r-a)*(s-o)&&(r-a)*(n-o)>=(t-a)*(e-o)&&(t-a)*(s-o)>=(i-a)*(n-o)}function Ns(r,e,t,n,i,s,a,o){return!(r===a&&e===o)&&Pu(r,e,t,n,i,s,a,o)}function Ap(r,e){return r.next.i!==e.i&&r.prev.i!==e.i&&!Tp(r,e)&&(Zs(r,e)&&Zs(e,r)&&Ep(r,e)&&(gt(r.prev,r,e.prev)||gt(r,e.prev,e))||ds(r,e)&&gt(r.prev,r,r.next)>0&&gt(e.prev,e,e.next)>0)}function gt(r,e,t){return(e.y-r.y)*(t.x-e.x)-(e.x-r.x)*(t.y-e.y)}function ds(r,e){return r.x===e.x&&r.y===e.y}function Lu(r,e,t,n){const i=Fr(gt(r,e,t)),s=Fr(gt(r,e,n)),a=Fr(gt(t,n,r)),o=Fr(gt(t,n,e));return!!(i!==s&&a!==o||i===0&&Nr(r,t,e)||s===0&&Nr(r,n,e)||a===0&&Nr(t,r,n)||o===0&&Nr(t,e,n))}function Nr(r,e,t){return e.x<=Math.max(r.x,t.x)&&e.x>=Math.min(r.x,t.x)&&e.y<=Math.max(r.y,t.y)&&e.y>=Math.min(r.y,t.y)}function Fr(r){return r>0?1:r<0?-1:0}function Tp(r,e){let t=r;do{if(t.i!==r.i&&t.next.i!==r.i&&t.i!==e.i&&t.next.i!==e.i&&Lu(t,t.next,r,e))return!0;t=t.next}while(t!==r);return!1}function Zs(r,e){return gt(r.prev,r,r.next)<0?gt(r,e,r.next)>=0&&gt(r,r.prev,e)>=0:gt(r,e,r.prev)<0||gt(r,r.next,e)<0}function Ep(r,e){let t=r,n=!1;const i=(r.x+e.x)/2,s=(r.y+e.y)/2;do t.y>s!=t.next.y>s&&t.next.y!==t.y&&i<(t.next.x-t.x)*(s-t.y)/(t.next.y-t.y)+t.x&&(n=!n),t=t.next;while(t!==r);return n}function Du(r,e){const t=fl(r.i,r.x,r.y),n=fl(e.i,e.x,e.y),i=r.next,s=e.prev;return r.next=e,e.prev=r,t.next=i,i.prev=t,n.next=t,t.prev=n,s.next=n,n.prev=s,n}function rh(r,e,t,n){const i=fl(r,e,t);return n?(i.next=n.next,i.prev=n,n.next.prev=i,n.next=i):(i.prev=i,i.next=i),i}function Js(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 fl(r,e,t){return{i:r,x:e,y:t,prev:null,next:null,z:0,prevZ:null,nextZ:null,steiner:!1}}function wp(r,e,t,n){let i=0;for(let s=e,a=t-n;s<t;s+=n)i+=(r[a]-r[s])*(r[s+1]+r[a+1]),a=s;return i}class Cp{static triangulate(e,t,n=2){return up(e,t,n)}}class Mn{static area(e){const t=e.length;let n=0;for(let i=t-1,s=0;s<t;i=s++)n+=e[i].x*e[s].y-e[s].x*e[i].y;return n*.5}static isClockWise(e){return Mn.area(e)<0}static triangulateShape(e,t){const n=[],i=[],s=[];ah(e),oh(n,e);let a=e.length;t.forEach(ah);for(let l=0;l<t.length;l++)i.push(a),a+=t[l].length,oh(n,t[l]);const o=Cp.triangulate(n,i);for(let l=0;l<o.length;l+=3)s.push(o.slice(l,l+3));return s}}function ah(r){const e=r.length;e>2&&r[e-1].equals(r[0])&&r.pop()}function oh(r,e){for(let t=0;t<e.length;t++)r.push(e[t].x),r.push(e[t].y)}class ql extends qe{constructor(e=new rs([new K(.5,.5),new K(-.5,.5),new K(-.5,-.5),new K(.5,-.5)]),t={}){super(),this.type="ExtrudeGeometry",this.parameters={shapes:e,options:t},e=Array.isArray(e)?e:[e];const n=this,i=[],s=[];for(let o=0,l=e.length;o<l;o++){const c=e[o];a(c)}this.setAttribute("position",new Te(i,3)),this.setAttribute("uv",new Te(s,2)),this.computeVertexNormals();function a(o){const l=[],c=t.curveSegments!==void 0?t.curveSegments:12,h=t.steps!==void 0?t.steps:1,u=t.depth!==void 0?t.depth:1;let d=t.bevelEnabled!==void 0?t.bevelEnabled:!0,f=t.bevelThickness!==void 0?t.bevelThickness:.2,m=t.bevelSize!==void 0?t.bevelSize:f-.1,_=t.bevelOffset!==void 0?t.bevelOffset:0,g=t.bevelSegments!==void 0?t.bevelSegments:3;const p=t.extrudePath,v=t.UVGenerator!==void 0?t.UVGenerator:Rp;let x,M=!1,T,E,C,P;if(p){x=p.getSpacedPoints(h),M=!0,d=!1;const $=p.isCatmullRomCurve3?p.closed:!1;T=p.computeFrenetFrames(h,$),E=new R,C=new R,P=new R}d||(g=0,f=0,m=0,_=0);const S=o.extractPoints(c);let b=S.shape;const L=S.holes;if(!Mn.isClockWise(b)){b=b.reverse();for(let $=0,ne=L.length;$<ne;$++){const Q=L[$];Mn.isClockWise(Q)&&(L[$]=Q.reverse())}}function B($){const Q=10000000000000001e-36;let ge=$[0];for(let I=1;I<=$.length;I++){const De=I%$.length,ve=$[De],Oe=ve.x-ge.x,re=ve.y-ge.y,w=Oe*Oe+re*re,y=Math.max(Math.abs(ve.x),Math.abs(ve.y),Math.abs(ge.x),Math.abs(ge.y)),U=Q*y*y;if(w<=U){$.splice(De,1),I--;continue}ge=ve}}
vendor: 39,686 bytes, line 44
44B(b),L.forEach(B);const G=L.length,q=b;for(let $=0;$<G;$++){const ne=L[$];b=b.concat(ne)}function V($,ne,Q){return ne||Le("ExtrudeGeometry: vec does not exist"),$.clone().addScaledVector(ne,Q)}const H=b.length;function j($,ne,Q){let ge,I,De;const ve=$.x-ne.x,Oe=$.y-ne.y,re=Q.x-$.x,w=Q.y-$.y,y=ve*ve+Oe*Oe,U=ve*w-Oe*re;if(Math.abs(U)>Number.EPSILON){const W=Math.sqrt(y),Z=Math.sqrt(re*re+w*w),X=ne.x-Oe/W,Re=ne.y+ve/W,ae=Q.x-w/Z,we=Q.y+re/Z,Be=((ae-X)*w-(we-Re)*re)/(ve*w-Oe*re);ge=X+ve*Be-$.x,I=Re+Oe*Be-$.y;const te=ge*ge+I*I;if(te<=2)return new K(ge,I);De=Math.sqrt(te/2)}else{let W=!1;ve>Number.EPSILON?re>Number.EPSILON&&(W=!0):ve<-Number.EPSILON?re<-Number.EPSILON&&(W=!0):Math.sign(Oe)===Math.sign(w)&&(W=!0),W?(ge=-Oe,I=ve,De=Math.sqrt(y)):(ge=ve,I=Oe,De=Math.sqrt(y/2))}return new K(ge/De,I/De)}const pe=[];for(let $=0,ne=q.length,Q=ne-1,ge=$+1;$<ne;$++,Q++,ge++)Q===ne&&(Q=0),ge===ne&&(ge=0),pe[$]=j(q[$],q[Q],q[ge]);const oe=[];let he,We=pe.concat();for(let $=0,ne=G;$<ne;$++){const Q=L[$];he=[];for(let ge=0,I=Q.length,De=I-1,ve=ge+1;ge<I;ge++,De++,ve++)De===I&&(De=0),ve===I&&(ve=0),he[ge]=j(Q[ge],Q[De],Q[ve]);oe.push(he),We=We.concat(he)}let ke;if(g===0)ke=Mn.triangulateShape(q,L);else{const $=[],ne=[];for(let Q=0;Q<g;Q++){const ge=Q/g,I=f*Math.cos(ge*Math.PI/2),De=m*Math.sin(ge*Math.PI/2)+_;for(let ve=0,Oe=q.length;ve<Oe;ve++){const re=V(q[ve],pe[ve],De);Fe(re.x,re.y,-I),ge===0&&$.push(re)}for(let ve=0,Oe=G;ve<Oe;ve++){const re=L[ve];he=oe[ve];const w=[];for(let y=0,U=re.length;y<U;y++){const W=V(re[y],he[y],De);Fe(W.x,W.y,-I),ge===0&&w.push(W)}ge===0&&ne.push(w)}}ke=Mn.triangulateShape($,ne)}const at=ke.length,ot=m+_;for(let $=0;$<H;$++){const ne=d?V(b[$],We[$],ot):b[$];M?(C.copy(T.normals[0]).multiplyScalar(ne.x),E.copy(T.binormals[0]).multiplyScalar(ne.y),P.copy(x[0]).add(C).add(E),Fe(P.x,P.y,P.z)):Fe(ne.x,ne.y,0)}for(let $=1;$<=h;$++)for(let ne=0;ne<H;ne++){const Q=d?V(b[ne],We[ne],ot):b[ne];M?(C.copy(T.normals[$]).multiplyScalar(Q.x),E.copy(T.binormals[$]).multiplyScalar(Q.y),P.copy(x[$]).add(C).add(E),Fe(P.x,P.y,P.z)):Fe(Q.x,Q.y,u/h*$)}for(let $=g-1;$>=0;$--){const ne=$/g,Q=f*Math.cos(ne*Math.PI/2),ge=m*Math.sin(ne*Math.PI/2)+_;for(let I=0,De=q.length;I<De;I++){const ve=V(q[I],pe[I],ge);Fe(ve.x,ve.y,u+Q)}for(let I=0,De=L.length;I<De;I++){const ve=L[I];he=oe[I];for(let Oe=0,re=ve.length;Oe<re;Oe++){const w=V(ve[Oe],he[Oe],ge);M?Fe(w.x,w.y+x[h-1].y,x[h-1].x+Q):Fe(w.x,w.y,u+Q)}}}Y(),ee();function Y(){const $=i.length/3;if(d){let ne=0,Q=H*ne;for(let ge=0;ge<at;ge++){const I=ke[ge];Ae(I[2]+Q,I[1]+Q,I[0]+Q)}ne=h+g*2,Q=H*ne;for(let ge=0;ge<at;ge++){const I=ke[ge];Ae(I[0]+Q,I[1]+Q,I[2]+Q)}}else{for(let ne=0;ne<at;ne++){const Q=ke[ne];Ae(Q[2],Q[1],Q[0])}for(let ne=0;ne<at;ne++){const Q=ke[ne];Ae(Q[0]+H*h,Q[1]+H*h,Q[2]+H*h)}}n.addGroup($,i.length/3-$,0)}function ee(){const $=i.length/3;let ne=0;Se(q,ne),ne+=q.length;for(let Q=0,ge=L.length;Q<ge;Q++){const I=L[Q];Se(I,ne),ne+=I.length}n.addGroup($,i.length/3-$,1)}function Se($,ne){let Q=$.length;for(;--Q>=0;){const ge=Q;let I=Q-1;I<0&&(I=$.length-1);for(let De=0,ve=h+g*2;De<ve;De++){const Oe=H*De,re=H*(De+1),w=ne+ge+Oe,y=ne+I+Oe,U=ne+I+re,W=ne+ge+re;Qe(w,y,U,W)}}}function Fe($,ne,Q){l.push($),l.push(ne),l.push(Q)}function Ae($,ne,Q){lt($),lt(ne),lt(Q);const ge=i.length/3,I=v.generateTopUV(n,i,ge-3,ge-2,ge-1);Xe(I[0]),Xe(I[1]),Xe(I[2])}function Qe($,ne,Q,ge){lt($),lt(ne),lt(ge),lt(ne),lt(Q),lt(ge);const I=i.length/3,De=v.generateSideWallUV(n,i,I-6,I-3,I-2,I-1);Xe(De[0]),Xe(De[1]),Xe(De[3]),Xe(De[1]),Xe(De[2]),Xe(De[3])}function lt($){i.push(l[$*3+0]),i.push(l[$*3+1]),i.push(l[$*3+2])}function Xe($){s.push($.x),s.push($.y)}}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}toJSON(){const e=super.toJSON(),t=this.parameters.shapes,n=this.parameters.options;return Ip(t,n,e)}static fromJSON(e,t){const n=[];for(let s=0,a=e.shapes.length;s<a;s++){const o=t[e.shapes[s]];n.push(o)}const i=e.options.extrudePath;return i!==void 0&&(e.options.extrudePath=new ha[i.type]().fromJSON(i)),new ql(n,e.options)}}const Rp={generateTopUV:function(r,e,t,n,i){const s=e[t*3],a=e[t*3+1],o=e[n*3],l=e[n*3+1],c=e[i*3],h=e[i*3+1];return[new K(s,a),new K(o,l),new K(c,h)]},generateSideWallUV:function(r,e,t,n,i,s){const a=e[t*3],o=e[t*3+1],l=e[t*3+2],c=e[n*3],h=e[n*3+1],u=e[n*3+2],d=e[i*3],f=e[i*3+1],m=e[i*3+2],_=e[s*3],g=e[s*3+1],p=e[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 Ip(r,e,t){if(t.shapes=[],Array.isArray(r))for(let n=0,i=r.length;n<i;n++){const s=r[n];t.shapes.push(s.uuid)}else t.shapes.push(r.uuid);return t.options=Object.assign({},e),e.extrudePath!==void 0&&(t.options.extrudePath=e.extrudePath.toJSON()),t}class Yl extends Ri{constructor(e=1,t=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,e,t),this.type="IcosahedronGeometry",this.parameters={radius:e,detail:t}}static fromJSON(e){return new Yl(e.radius,e.detail)}}class Zl extends qe{constructor(e=[new K(0,-.5),new K(.5,0),new K(0,.5)],t=12,n=0,i=Math.PI*2){super(),this.type="LatheGeometry",this.parameters={points:e,segments:t,phiStart:n,phiLength:i},t=Math.floor(t),i=ze(i,0,Math.PI*2);const s=[],a=[],o=[],l=[],c=[],h=1/t,u=new R,d=new K,f=new R,m=new R,_=new R;let g=0,p=0;for(let v=0;v<=e.length-1;v++)switch(v){case 0:g=e[v+1].x-e[v].x,p=e[v+1].y-e[v].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 e.length-1:l.push(_.x,_.y,_.z);break;default:g=e[v+1].x-e[v].x,p=e[v+1].y-e[v].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 v=0;v<=t;v++){const x=n+v*h*i,M=Math.sin(x),T=Math.cos(x);for(let E=0;E<=e.length-1;E++){u.x=e[E].x*M,u.y=e[E].y,u.z=e[E].x*T,a.push(u.x,u.y,u.z),d.x=v/t,d.y=E/(e.length-1),o.push(d.x,d.y);const C=l[3*E+0]*M,P=l[3*E+1],S=l[3*E+0]*T;c.push(C,P,S)}}for(let v=0;v<t;v++)for(let x=0;x<e.length-1;x++){const M=x+v*e.length,T=M,E=M+e.length,C=M+e.length+1,P=M+1;s.push(T,E,P),s.push(C,P,E)}this.setIndex(s),this.setAttribute("position",new Te(a,3)),this.setAttribute("uv",new Te(o,2)),this.setAttribute("normal",new Te(c,3))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new Zl(e.points,e.segments,e.phiStart,e.phiLength)}}class ya extends Ri{constructor(e=1,t=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,e,t),this.type="OctahedronGeometry",this.parameters={radius:e,detail:t}}static fromJSON(e){return new ya(e.radius,e.detail)}}class js extends qe{constructor(e=1,t=1,n=1,i=1){super(),this.type="PlaneGeometry",this.parameters={width:e,height:t,widthSegments:n,heightSegments:i};const s=e/2,a=t/2,o=Math.floor(n),l=Math.floor(i),c=o+1,h=l+1,u=e/o,d=t/l,f=[],m=[],_=[],g=[];for(let p=0;p<h;p++){const v=p*d-a;for(let x=0;x<c;x++){const M=x*u-s;m.push(M,-v,0),_.push(0,0,1),g.push(x/o),g.push(1-p/l)}}for(let p=0;p<l;p++)for(let v=0;v<o;v++){const x=v+c*p,M=v+c*(p+1),T=v+1+c*(p+1),E=v+1+c*p;f.push(x,M,E),f.push(M,T,E)}this.setIndex(f),this.setAttribute("position",new Te(m,3)),this.setAttribute("normal",new Te(_,3)),this.setAttribute("uv",new Te(g,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new js(e.width,e.height,e.widthSegments,e.heightSegments)}}class Jl extends qe{constructor(e=.5,t=1,n=32,i=1,s=0,a=Math.PI*2){super(),this.type="RingGeometry",this.parameters={innerRadius:e,outerRadius:t,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=e;const d=(t-e)/i,f=new R,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/t+1)/2,m.y=(f.y/t+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 v=p+g,x=v,M=v+n+1,T=v+n+2,E=v+1;o.push(x,M,E),o.push(M,T,E)}}this.setIndex(o),this.setAttribute("position",new Te(l,3)),this.setAttribute("normal",new Te(c,3)),this.setAttribute("uv",new Te(h,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new Jl(e.innerRadius,e.outerRadius,e.thetaSegments,e.phiSegments,e.thetaStart,e.thetaLength)}}class $l extends qe{constructor(e=new rs([new K(0,.5),new K(-.5,-.5),new K(.5,-.5)]),t=12){super(),this.type="ShapeGeometry",this.parameters={shapes:e,curveSegments:t};const n=[],i=[],s=[],a=[];let o=0,l=0;if(Array.isArray(e)===!1)c(e);else for(let h=0;h<e.length;h++)c(e[h]),this.addGroup(o,l,h),o+=l,l=0;this.setIndex(n),this.setAttribute("position",new Te(i,3)),this.setAttribute("normal",new Te(s,3)),this.setAttribute("uv",new Te(a,2));function c(h){const u=i.length/3,d=h.extractPoints(t);let f=d.shape;const m=d.holes;Mn.isClockWise(f)===!1&&(f=f.reverse());for(let g=0,p=m.length;g<p;g++){const v=m[g];Mn.isClockWise(v)===!0&&(m[g]=v.reverse())}const _=Mn.triangulateShape(f,m);for(let g=0,p=m.length;g<p;g++){const v=m[g];f=f.concat(v)}for(let g=0,p=f.length;g<p;g++){const v=f[g];i.push(v.x,v.y,0),s.push(0,0,1),a.push(v.x,v.y)}for(let g=0,p=_.length;g<p;g++){const v=_[g],x=v[0]+u,M=v[1]+u,T=v[2]+u;n.push(x,M,T),l+=3}}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}toJSON(){const e=super.toJSON(),t=this.parameters.shapes;return Pp(t,e)}static fromJSON(e,t){const n=[];for(let i=0,s=e.shapes.length;i<s;i++){const a=t[e.shapes[i]];n.push(a)}return new $l(n,e.curveSegments)}}function Pp(r,e){if(e.shapes=[],Array.isArray(r))for(let t=0,n=r.length;t<n;t++){const i=r[t];e.shapes.push(i.uuid)}else e.shapes.push(r.uuid);return e}class Ma extends qe{constructor(e=1,t=32,n=16,i=0,s=Math.PI*2,a=0,o=Math.PI){super(),this.type="SphereGeometry",this.parameters={radius:e,widthSegments:t,heightSegments:n,phiStart:i,phiLength:s,thetaStart:a,thetaLength:o},t=Math.max(3,Math.floor(t)),n=Math.max(2,Math.floor(n));const l=Math.min(a+o,Math.PI);let c=0;const h=[],u=new R,d=new R,f=[],m=[],_=[],g=[];for(let p=0;p<=n;p++){const v=[],x=p/n;let M=0;p===0&&a===0?M=.5/t:p===n&&l===Math.PI&&(M=-.5/t);for(let T=0;T<=t;T++){const E=T/t;u.x=-e*Math.cos(i+E*s)*Math.sin(a+x*o),u.y=e*Math.cos(a+x*o),u.z=e*Math.sin(i+E*s)*Math.sin(a+x*o),m.push(u.x,u.y,u.z),d.copy(u).normalize(),_.push(d.x,d.y,d.z),g.push(E+M,1-x),v.push(c++)}h.push(v)}for(let p=0;p<n;p++)for(let v=0;v<t;v++){const x=h[p][v+1],M=h[p][v],T=h[p+1][v],E=h[p+1][v+1];(p!==0||a>0)&&f.push(x,M,E),(p!==n-1||l<Math.PI)&&f.push(M,T,E)}this.setIndex(f),this.setAttribute("position",new Te(m,3)),this.setAttribute("normal",new Te(_,3)),this.setAttribute("uv",new Te(g,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new Ma(e.radius,e.widthSegments,e.heightSegments,e.phiStart,e.phiLength,e.thetaStart,e.thetaLength)}}class Kl extends Ri{constructor(e=1,t=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,e,t),this.type="TetrahedronGeometry",this.parameters={radius:e,detail:t}}static fromJSON(e){return new Kl(e.radius,e.detail)}}class Ql extends qe{constructor(e=1,t=.4,n=12,i=48,s=Math.PI*2){super(),this.type="TorusGeometry",this.parameters={radius:e,tube:t,radialSegments:n,tubularSegments:i,arc:s},n=Math.floor(n),i=Math.floor(i);const a=[],o=[],l=[],c=[],h=new R,u=new R,d=new R;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=(e+t*Math.cos(g))*Math.cos(_),u.y=(e+t*Math.cos(g))*Math.sin(_),u.z=t*Math.sin(g),o.push(u.x,u.y,u.z),h.x=e*Math.cos(_),h.y=e*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,v=(i+1)*f+m;a.push(_,g,v),a.push(g,p,v)}this.setIndex(a),this.setAttribute("position",new Te(o,3)),this.setAttribute("normal",new Te(l,3)),this.setAttribute("uv",new Te(c,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new Ql(e.radius,e.tube,e.radialSegments,e.tubularSegments,e.arc)}}class jl extends qe{constructor(e=1,t=.4,n=64,i=8,s=2,a=3){super(),this.type="TorusKnotGeometry",this.parameters={radius:e,tube:t,tubularSegments:n,radialSegments:i,p:s,q:a},n=Math.floor(n),i=Math.floor(i);const o=[],l=[],c=[],h=[],u=new R,d=new R,f=new R,m=new R,_=new R,g=new R,p=new R;for(let x=0;x<=n;++x){const M=x/n*s*Math.PI*2;v(M,s,a,e,f),v(M+.01,s,a,e,m),g.subVectors(m,f),p.addVectors(m,f),_.crossVectors(g,p),p.crossVectors(_,g),_.normalize(),p.normalize();for(let T=0;T<=i;++T){const E=T/i*Math.PI*2,C=-t*Math.cos(E),P=t*Math.sin(E);u.x=f.x+(C*p.x+P*_.x),u.y=f.y+(C*p.y+P*_.y),u.z=f.z+(C*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(x/n),h.push(T/i)}}for(let x=1;x<=n;x++)for(let M=1;M<=i;M++){const T=(i+1)*(x-1)+(M-1),E=(i+1)*x+(M-1),C=(i+1)*x+M,P=(i+1)*(x-1)+M;o.push(T,E,P),o.push(E,C,P)}this.setIndex(o),this.setAttribute("position",new Te(l,3)),this.setAttribute("normal",new Te(c,3)),this.setAttribute("uv",new Te(h,2));function v(x,M,T,E,C){const P=Math.cos(x),S=Math.sin(x),b=T/M*x,L=Math.cos(b);C.x=E*(2+L)*.5*P,C.y=E*(2+L)*S*.5,C.z=E*Math.sin(b)*.5}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new jl(e.radius,e.tube,e.tubularSegments,e.radialSegments,e.p,e.q)}}class ec extends qe{constructor(e=new Cu(new R(-1,-1,0),new R(-1,1,0),new R(1,1,0)),t=64,n=1,i=8,s=!1){super(),this.type="TubeGeometry",this.parameters={path:e,tubularSegments:t,radius:n,radialSegments:i,closed:s};const a=e.computeFrenetFrames(t,s);this.tangents=a.tangents,this.normals=a.normals,this.binormals=a.binormals;const o=new R,l=new R,c=new K;let h=new R;const u=[],d=[],f=[],m=[];_(),this.setIndex(m),this.setAttribute("position",new Te(u,3)),this.setAttribute("normal",new Te(d,3)),this.setAttribute("uv",new Te(f,2));function _(){for(let x=0;x<t;x++)g(x);g(s===!1?t:0),v(),p()}function g(x){h=e.getPointAt(x/t,h);const M=a.normals[x],T=a.binormals[x];for(let E=0;E<=i;E++){const C=E/i*Math.PI*2,P=Math.sin(C),S=-Math.cos(C);l.x=S*M.x+P*T.x,l.y=S*M.y+P*T.y,l.z=S*M.z+P*T.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 x=1;x<=t;x++)for(let M=1;M<=i;M++){const T=(i+1)*(x-1)+(M-1),E=(i+1)*x+(M-1),C=(i+1)*x+M,P=(i+1)*(x-1)+M;m.push(T,E,P),m.push(E,C,P)}}function v(){for(let x=0;x<=t;x++)for(let M=0;M<=i;M++)c.x=x/t,c.y=M/i,f.push(c.x,c.y)}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}toJSON(){const e=super.toJSON();return e.path=this.parameters.path.toJSON(),e}static fromJSON(e){return new ec(new ha[e.path.type]().fromJSON(e.path),e.tubularSegments,e.radius,e.radialSegments,e.closed)}}class Lp extends qe{constructor(e=null){if(super(),this.type="WireframeGeometry",this.parameters={geometry:e},e!==null){const t=[],n=new Set,i=new R,s=new R;if(e.index!==null){const a=e.attributes.position,o=e.index;let l=e.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),v=o.getX(m+(g+1)%3);i.fromBufferAttribute(a,p),s.fromBufferAttribute(a,v),lh(i,s,n)===!0&&(t.push(i.x,i.y,i.z),t.push(s.x,s.y,s.z))}}}else{const a=e.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),lh(i,s,n)===!0&&(t.push(i.x,i.y,i.z),t.push(s.x,s.y,s.z))}}this.setAttribute("position",new Te(t,3))}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}}function lh(r,e,t){const n=`${r.x},${r.y},${r.z}-${e.x},${e.y},${e.z}`,i=`${e.x},${e.y},${e.z}-${r.x},${r.y},${r.z}`;return t.has(n)===!0||t.has(i)===!0?!1:(t.add(n),t.add(i),!0)}var ch=Object.freeze({__proto__:null,BoxGeometry:fs,CapsuleGeometry:kl,CircleGeometry:Gl,ConeGeometry:va,CylinderGeometry:xa,DodecahedronGeometry:Hl,EdgesGeometry:Qf,ExtrudeGeometry:ql,IcosahedronGeometry:Yl,LatheGeometry:Zl,OctahedronGeometry:ya,PlaneGeometry:js,PolyhedronGeometry:Ri,RingGeometry:Jl,ShapeGeometry:$l,SphereGeometry:Ma,TetrahedronGeometry:Kl,TorusGeometry:Ql,TorusKnotGeometry:jl,TubeGeometry:ec,WireframeGeometry:Lp});class Dp extends Bt{constructor(e){super(),this.isShadowMaterial=!0,this.type="ShadowMaterial",this.color=new Me(0),this.transparent=!0,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.fog=e.fog,this}}class Uu extends pn{constructor(e){super(e),this.isRawShaderMaterial=!0,this.type="RawShaderMaterial"}}class Nu extends Bt{constructor(e){super(),this.isMeshStandardMaterial=!0,this.type="MeshStandardMaterial",this.defines={STANDARD:""},this.color=new Me(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 Me(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=wi,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 cn,this.envMapIntensity=1,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.flatShading=!1,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.defines={STANDARD:""},this.color.copy(e.color),this.roughness=e.roughness,this.metalness=e.metalness,this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.roughnessMap=e.roughnessMap,this.metalnessMap=e.metalnessMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.envMapRotation.copy(e.envMapRotation),this.envMapIntensity=e.envMapIntensity,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.flatShading=e.flatShading,this.fog=e.fog,this}}class Up extends Nu{constructor(e){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 ze(2.5*(this.ior-1)/(this.ior+1),0,1)},set:function(t){this.ior=(1+.4*t)/(1-.4*t)}}),this.iridescenceMap=null,this.iridescenceIOR=1.3,this.iridescenceThicknessRange=[100,400],this.iridescenceThicknessMap=null,this.sheenColor=new Me(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 Me(1,1,1),this.specularIntensity=1,this.specularIntensityMap=null,this.specularColor=new Me(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(e)}get anisotropy(){return this._anisotropy}set anisotropy(e){this._anisotropy>0!=e>0&&this.version++,this._anisotropy=e}get clearcoat(){return this._clearcoat}set clearcoat(e){this._clearcoat>0!=e>0&&this.version++,this._clearcoat=e}get iridescence(){return this._iridescence}set iridescence(e){this._iridescence>0!=e>0&&this.version++,this._iridescence=e}get dispersion(){return this._dispersion}set dispersion(e){this._dispersion>0!=e>0&&this.version++,this._dispersion=e}get sheen(){return this._sheen}set sheen(e){this._sheen>0!=e>0&&this.version++,this._sheen=e}get transmission(){return this._transmission}set transmission(e){this._transmission>0!=e>0&&this.version++,this._transmission=e}copy(e){return super.copy(e),this.defines={STANDARD:"",PHYSICAL:""},this.anisotropy=e.anisotropy,this.anisotropyRotation=e.anisotropyRotation,this.anisotropyMap=e.anisotropyMap,this.clearcoat=e.clearcoat,this.clearcoatMap=e.clearcoatMap,this.clearcoatRoughness=e.clearcoatRoughness,this.clearcoatRoughnessMap=e.clearcoatRoughnessMap,this.clearcoatNormalMap=e.clearcoatNormalMap,this.clearcoatNormalScale.copy(e.clearcoatNormalScale),this.dispersion=e.dispersion,this.ior=e.ior,this.iridescence=e.iridescence,this.iridescenceMap=e.iridescenceMap,this.iridescenceIOR=e.iridescenceIOR,this.iridescenceThicknessRange=[...e.iridescenceThicknessRange],this.iridescenceThicknessMap=e.iridescenceThicknessMap,this.sheen=e.sheen,this.sheenColor.copy(e.sheenColor),this.sheenColorMap=e.sheenColorMap,this.sheenRoughness=e.sheenRoughness,this.sheenRoughnessMap=e.sheenRoughnessMap,this.transmission=e.transmission,this.transmissionMap=e.transmissionMap,this.thickness=e.thickness,this.thicknessMap=e.thicknessMap,this.attenuationDistance=e.attenuationDistance,this.attenuationColor.copy(e.attenuationColor),this.specularIntensity=e.specularIntensity,this.specularIntensityMap=e.specularIntensityMap,this.specularColor.copy(e.specularColor),this.specularColorMap=e.specularColorMap,this}}class Np extends Bt{constructor(e){super(),this.isMeshPhongMaterial=!0,this.type="MeshPhongMaterial",this.color=new Me(16777215),this.specular=new Me(1118481),this.shininess=30,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new Me(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=wi,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 cn,this.combine=ma,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(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.specular.copy(e.specular),this.shininess=e.shininess,this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.envMapRotation.copy(e.envMapRotation),this.combine=e.combine,this.reflectivity=e.reflectivity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.flatShading=e.flatShading,this.fog=e.fog,this}}class Fp extends Bt{constructor(e){super(),this.isMeshToonMaterial=!0,this.defines={TOON:""},this.type="MeshToonMaterial",this.color=new Me(16777215),this.map=null,this.gradientMap=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new Me(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=wi,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(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.gradientMap=e.gradientMap,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.alphaMap=e.alphaMap,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.fog=e.fog,this}}class Op extends Bt{constructor(e){super(),this.isMeshNormalMaterial=!0,this.type="MeshNormalMaterial",this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=wi,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(e)}copy(e){return super.copy(e),this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.flatShading=e.flatShading,this}}class Bp extends Bt{constructor(e){super(),this.isMeshLambertMaterial=!0,this.type="MeshLambertMaterial",this.color=new Me(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new Me(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=wi,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 cn,this.combine=ma,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(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.envMapRotation.copy(e.envMapRotation),this.combine=e.combine,this.reflectivity=e.reflectivity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.flatShading=e.flatShading,this.fog=e.fog,this}}class Fu extends Bt{constructor(e){super(),this.isMeshDepthMaterial=!0,this.type="MeshDepthMaterial",this.depthPacking=Dd,this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.wireframe=!1,this.wireframeLinewidth=1,this.setValues(e)}copy(e){return super.copy(e),this.depthPacking=e.depthPacking,this.map=e.map,this.alphaMap=e.alphaMap,this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this}}class Ou extends Bt{constructor(e){super(),this.isMeshDistanceMaterial=!0,this.type="MeshDistanceMaterial",this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.setValues(e)}copy(e){return super.copy(e),this.map=e.map,this.alphaMap=e.alphaMap,this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this}}class zp extends Bt{constructor(e){super(),this.isMeshMatcapMaterial=!0,this.defines={MATCAP:""},this.type="MeshMatcapMaterial",this.color=new Me(16777215),this.matcap=null,this.map=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=wi,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.flatShading=!1,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.defines={MATCAP:""},this.color.copy(e.color),this.matcap=e.matcap,this.map=e.map,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.alphaMap=e.alphaMap,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.flatShading=e.flatShading,this.fog=e.fog,this}}class Vp extends qt{constructor(e){super(),this.isLineDashedMaterial=!0,this.type="LineDashedMaterial",this.scale=1,this.dashSize=3,this.gapSize=1,this.setValues(e)}copy(e){return super.copy(e),this.scale=e.scale,this.dashSize=e.dashSize,this.gapSize=e.gapSize,this}}function Si(r,e){return!r||r.constructor===e?r:typeof e.BYTES_PER_ELEMENT=="number"?new e(r):Array.prototype.slice.call(r)}function Bu(r){function e(i,s){return r[i]-r[s]}const t=r.length,n=new Array(t);for(let i=0;i!==t;++i)n[i]=i;return n.sort(e),n}function pl(r,e,t){const n=r.length,i=new r.constructor(n);for(let s=0,a=0;a!==n;++s){const o=t[s]*e;for(let l=0;l!==e;++l)i[a++]=r[o+l]}return i}function tc(r,e,t,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&&(e.push(s.time),t.push(...a)),s=r[i++];while(s!==void 0);else if(a.toArray!==void 0)do a=s[n],a!==void 0&&(e.push(s.time),a.toArray(t,t.length)),s=r[i++];while(s!==void 0);else do a=s[n],a!==void 0&&(e.push(s.time),t.push(a)),s=r[i++];while(s!==void 0)}function kp(r,e,t,n,i=30){const s=r.clone();s.name=e;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<t||m>=n)){u.push(c.times[f]);for(let _=0;_<h;++_)d.push(c.values[f*h+_])}}u.length!==0&&(c.times=Si(u,c.times.constructor),c.values=Si(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 Gp(r,e=0,t=r,n=30){n<=0&&(n=30);const i=t.tracks.length,s=e/n;for(let a=0;a<i;++a){const o=t.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,v=u-h;_=o.values.slice(p,v)}else if(s>=o.times[m]){const p=m*u+h,v=p+u-h;_=o.values.slice(p,v)}else{const p=o.createInterpolant(),v=h,x=u-h;p.evaluate(s),_=p.resultBuffer.slice(v,x)}l==="quaternion"&&new nn().fromArray(_).normalize().conjugate().toArray(_);const g=c.times.length;for(let p=0;p<g;++p){const v=p*f+d;if(l==="quaternion")nn.multiplyQuaternionsFlat(c.values,v,_,0,c.values,v);else{const x=f-d*2;for(let M=0;M<x;++M)c.values[v+M]-=_[M]}}}return r.blendMode=uu,r}class Fy{static convertArray(e,t){return Si(e,t)}static isTypedArray(e){return fu(e)}static getKeyframeOrder(e){return Bu(e)}static sortedArray(e,t,n){return pl(e,t,n)}static flattenJSON(e,t,n,i){tc(e,t,n,i)}static subclip(e,t,n,i,s=30){return kp(e,t,n,i,s)}static makeClipAdditive(e,t=0,n=e,i=30){return Gp(e,t,n,i)}}class Sa{constructor(e,t,n,i){this.parameterPositions=e,this._cachedIndex=0,this.resultBuffer=i!==void 0?i:new t.constructor(n),this.sampleValues=t,this.valueSize=n,this.settings=null,this.DefaultSettings_={}}evaluate(e){const t=this.parameterPositions;let n=this._cachedIndex,i=t[n],s=t[n-1];e:{t:{let a;n:{i:if(!(e<i)){for(let o=n+2;;){if(i===void 0){if(e<s)break i;return n=t.length,this._cachedIndex=n,this.copySampleValue_(n-1)}if(n===o)break;if(s=i,i=t[++n],e<i)break t}a=t.length;break n}if(!(e>=s)){const o=t[1];e<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=t[--n-1],e>=s)break t}a=n,n=0;break n}break e}for(;n<a;){const o=n+a>>>1;e<t[o]?a=o:n=o+1}if(i=t[n],s=t[n-1],s===void 0)return this._cachedIndex=0,this.copySampleValue_(0);if(i===void 0)return n=t.length,this._cachedIndex=n,this.copySampleValue_(n-1)}this._cachedIndex=n,this.intervalChanged_(n,s,i)}return this.interpolate_(n,s,e,i)}getSettings_(){return this.settings||this.DefaultSettings_}copySampleValue_(e){const t=this.resultBuffer,n=this.sampleValues,i=this.valueSize,s=e*i;for(let a=0;a!==i;++a)t[a]=n[s+a];return t}interpolate_(){throw new Error("call to abstract method")}intervalChanged_(){}}class Hp extends Sa{constructor(e,t,n,i){super(e,t,n,i),this._weightPrev=-0,this._offsetPrev=-0,this._weightNext=-0,this._offsetNext=-0,this.DefaultSettings_={endingStart:es,endingEnd:es}}intervalChanged_(e,t,n){const i=this.parameterPositions;let s=e-2,a=e+1,o=i[s],l=i[a];if(o===void 0)switch(this.getSettings_().endingStart){case ts:s=e,o=2*t-n;break;case sa:s=i.length-2,o=t+i[s]-i[s+1];break;default:s=e,o=n}if(l===void 0)switch(this.getSettings_().endingEnd){case ts:a=e,l=2*n-t;break;case sa:a=1,l=n+i[1]-i[0];break;default:a=e-1,l=t}const c=(n-t)*.5,h=this.valueSize;this._weightPrev=c/(t-o),this._weightNext=c/(l-n),this._offsetPrev=s*h,this._offsetNext=a*h}interpolate_(e,t,n,i){const s=this.resultBuffer,a=this.sampleValues,o=this.valueSize,l=e*o,c=l-o,h=this._offsetPrev,u=this._offsetNext,d=this._weightPrev,f=this._weightNext,m=(n-t)/(i-t),_=m*m,g=_*m,p=-d*g+2*d*_-d*m,v=(1+d)*g+(-1.5-2*d)*_+(-.5+d)*m+1,x=(-1-f)*g+(1.5+f)*_+.5*m,M=f*g-f*_;for(let T=0;T!==o;++T)s[T]=p*a[h+T]+v*a[c+T]+x*a[l+T]+M*a[u+T];return s}}class zu extends Sa{constructor(e,t,n,i){super(e,t,n,i)}interpolate_(e,t,n,i){const s=this.resultBuffer,a=this.sampleValues,o=this.valueSize,l=e*o,c=l-o,h=(n-t)/(i-t),u=1-h;for(let d=0;d!==o;++d)s[d]=a[c+d]*u+a[l+d]*h;return s}}class Wp extends Sa{constructor(e,t,n,i){super(e,t,n,i)}interpolate_(e){return this.copySampleValue_(e-1)}}class mn{constructor(e,t,n,i){if(e===void 0)throw new Error("THREE.KeyframeTrack: track name is undefined");if(t===void 0||t.length===0)throw new Error("THREE.KeyframeTrack: no keyframes in track named "+e);this.name=e,this.times=Si(t,this.TimeBufferType),this.values=Si(n,this.ValueBufferType),this.setInterpolation(i||this.DefaultInterpolation)}static toJSON(e){const t=e.constructor;let n;if(t.toJSON!==this.toJSON)n=t.toJSON(e);else{n={name:e.name,times:Si(e.times,Array),values:Si(e.values,Array)};const i=e.getInterpolation();i!==e.DefaultInterpolation&&(n.interpolation=i)}return n.type=e.ValueTypeName,n}InterpolantFactoryMethodDiscrete(e){return new Wp(this.times,this.values,this.getValueSize(),e)}InterpolantFactoryMethodLinear(e){return new zu(this.times,this.values,this.getValueSize(),e)}InterpolantFactoryMethodSmooth(e){return new Hp(this.times,this.values,this.getValueSize(),e)}setInterpolation(e){let t;switch(e){case ia:t=this.InterpolantFactoryMethodDiscrete;break;case cl:t=this.InterpolantFactoryMethodLinear;break;case Ia:t=this.InterpolantFactoryMethodSmooth;break}if(t===void 0){const n="unsupported interpolation for "+this.ValueTypeName+" keyframe track named "+this.name;if(this.createInterpolant===void 0)if(e!==this.DefaultInterpolation)this.setInterpolation(this.DefaultInterpolation);else throw new Error(n);return de("KeyframeTrack:",n),this}return this.createInterpolant=t,this}getInterpolation(){switch(this.createInterpolant){case this.InterpolantFactoryMethodDiscrete:return ia;case this.InterpolantFactoryMethodLinear:return cl;case this.InterpolantFactoryMethodSmooth:return Ia}}getValueSize(){return this.values.length/this.times.length}shift(e){if(e!==0){const t=this.times;for(let n=0,i=t.length;n!==i;++n)t[n]+=e}return this}scale(e){if(e!==1){const t=this.times;for(let n=0,i=t.length;n!==i;++n)t[n]*=e}return this}trim(e,t){const n=this.times,i=n.length;let s=0,a=i-1;for(;s!==i&&n[s]<e;)++s;for(;a!==-1&&n[a]>t;)--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 e=!0;const t=this.getValueSize();t-Math.floor(t)!==0&&(Le("KeyframeTrack: Invalid value size in track.",this),e=!1);const n=this.times,i=this.values,s=n.length;s===0&&(Le("KeyframeTrack: Track is empty.",this),e=!1);let a=null;for(let o=0;o!==s;o++){const l=n[o];if(typeof l=="number"&&isNaN(l)){Le("KeyframeTrack: Time is not a valid number.",this,o,l),e=!1;break}if(a!==null&&a>l){Le("KeyframeTrack: Out of order keys.",this,o,l,a),e=!1;break}a=l}if(i!==void 0&&fu(i))for(let o=0,l=i.length;o!==l;++o){const c=i[o];if(isNaN(c)){Le("KeyframeTrack: Value is not a valid number.",this,o,c),e=!1;break}}return e}optimize(){const e=this.times.slice(),t=this.values.slice(),n=this.getValueSize(),i=this.getInterpolation()===Ia,s=e.length-1;let a=1;for(let o=1;o<s;++o){let l=!1;const c=e[o],h=e[o+1];if(c!==h&&(o!==1||c!==e[0]))if(i)l=!0;else{const u=o*n,d=u-n,f=u+n;for(let m=0;m!==n;++m){const _=t[u+m];if(_!==t[d+m]||_!==t[f+m]){l=!0;break}}}if(l){if(o!==a){e[a]=e[o];const u=o*n,d=a*n;for(let f=0;f!==n;++f)t[d+f]=t[u+f]}++a}}if(s>0){e[a]=e[s];for(let o=s*n,l=a*n,c=0;c!==n;++c)t[l+c]=t[o+c];++a}return a!==e.length?(this.times=e.slice(0,a),this.values=t.slice(0,a*n)):(this.times=e,this.values=t),this}clone(){const e=this.times.slice(),t=this.values.slice(),n=this.constructor,i=new n(this.name,e,t);return i.createInterpolant=this.createInterpolant,i}}mn.prototype.ValueTypeName="";mn.prototype.TimeBufferType=Float32Array;mn.prototype.ValueBufferType=Float32Array;mn.prototype.DefaultInterpolation=cl;class ps extends mn{constructor(e,t,n){super(e,t,n)}}ps.prototype.ValueTypeName="bool";ps.prototype.ValueBufferType=Array;ps.prototype.DefaultInterpolation=ia;ps.prototype.InterpolantFactoryMethodLinear=void 0;ps.prototype.InterpolantFactoryMethodSmooth=void 0;class Vu extends mn{constructor(e,t,n,i){super(e,t,n,i)}}Vu.prototype.ValueTypeName="color";class ua extends mn{constructor(e,t,n,i){super(e,t,n,i)}}ua.prototype.ValueTypeName="number";class Xp extends Sa{constructor(e,t,n,i){super(e,t,n,i)}interpolate_(e,t,n,i){const s=this.resultBuffer,a=this.sampleValues,o=this.valueSize,l=(n-t)/(i-t);let c=e*o;for(let h=c+o;c!==h;
vendor: 4,617 bytes, line 44
44c+=4)nn.slerpFlat(s,0,a,c-o,a,c,l);return s}}class ba extends mn{constructor(e,t,n,i){super(e,t,n,i)}InterpolantFactoryMethodLinear(e){return new Xp(this.times,this.values,this.getValueSize(),e)}}ba.prototype.ValueTypeName="quaternion";ba.prototype.InterpolantFactoryMethodSmooth=void 0;class ms extends mn{constructor(e,t,n){super(e,t,n)}}ms.prototype.ValueTypeName="string";ms.prototype.ValueBufferType=Array;ms.prototype.DefaultInterpolation=ia;ms.prototype.InterpolantFactoryMethodLinear=void 0;ms.prototype.InterpolantFactoryMethodSmooth=void 0;class da extends mn{constructor(e,t,n,i){super(e,t,n,i)}}da.prototype.ValueTypeName="vector";class fa{constructor(e="",t=-1,n=[],i=wl){this.name=e,this.tracks=n,this.duration=t,this.blendMode=i,this.uuid=tn(),this.userData={},this.duration<0&&this.resetDuration()}static parse(e){const t=[],n=e.tracks,i=1/(e.fps||1);for(let a=0,o=n.length;a!==o;++a)t.push(Yp(n[a]).scale(i));const s=new this(e.name,e.duration,t,e.blendMode);return s.uuid=e.uuid,s.userData=JSON.parse(e.userData||"{}"),s}static toJSON(e){const t=[],n=e.tracks,i={name:e.name,duration:e.duration,tracks:t,uuid:e.uuid,blendMode:e.blendMode,userData:JSON.stringify(e.userData)};for(let s=0,a=n.length;s!==a;++s)t.push(mn.toJSON(n[s]));return i}static CreateFromMorphTargetSequence(e,t,n,i){const s=t.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=Bu(l);l=pl(l,1,h),c=pl(c,1,h),!i&&l[0]===0&&(l.push(s),c.push(c[0])),a.push(new ua(".morphTargetInfluences["+t[o].name+"]",l,c).scale(1/n))}return new this(e,-1,a)}static findByName(e,t){let n=e;if(!Array.isArray(e)){const i=e;n=i.geometry&&i.geometry.animations||i.animations}for(let i=0;i<n.length;i++)if(n[i].name===t)return n[i];return null}static CreateClipsFromMorphTargetSequences(e,t,n){const i={},s=/^([\w-]*?)([\d]+)$/;for(let o=0,l=e.length;o<l;o++){const c=e[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],t,n));return a}static parseAnimation(e,t){if(de("AnimationClip: parseAnimation() is deprecated and will be removed with r185"),!e)return Le("AnimationClip: No animation in JSONLoader data."),null;const n=function(u,d,f,m,_){if(f.length!==0){const g=[],p=[];tc(f,g,p,m),g.length!==0&&_.push(new u(d,g,p))}},i=[],s=e.name||"default",a=e.fps||30,o=e.blendMode;let l=e.length||-1;const c=e.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 v=0;v!==d[m].morphTargets.length;++v){const x=d[m];g.push(x.time),p.push(x.morphTarget===_?1:0)}i.push(new ua(".morphTargetInfluence["+_+"]",g,p))}l=f.length*a}else{const f=".bones["+t[u].name+"]";n(da,f+".position",d,"pos",i),n(ba,f+".quaternion",d,"rot",i),n(da,f+".scale",d,"scl",i)}}return i.length===0?null:new this(s,l,i,o)}resetDuration(){const e=this.tracks;let t=0;for(let n=0,i=e.length;n!==i;++n){const s=this.tracks[n];t=Math.max(t,s.times[s.times.length-1])}return this.duration=t,this}trim(){for(let e=0;e<this.tracks.length;e++)this.tracks[e].trim(0,this.duration);return this}validate(){let e=!0;for(let t=0;t<this.tracks.length;t++)e=e&&this.tracks[t].validate();return e}optimize(){for(let e=0;e<this.tracks.length;e++)this.tracks[e].optimize();return this}clone(){const e=[];for(let n=0;n<this.tracks.length;n++)e.push(this.tracks[n].clone());const t=new this.constructor(this.name,this.duration,e,this.blendMode);return t.userData=JSON.parse(JSON.stringify(this.userData)),t}toJSON(){return this.constructor.toJSON(this)}}function qp(r){switch(r.toLowerCase()){case"scalar":case"double":case"float":case"number":case"integer":return ua;case"vector":case"vector2":case"vector3":case"vector4":return da;case"color":return Vu;case"quaternion":return ba;case"bool":case"boolean":return ps;case"string":return ms}throw new Error("THREE.KeyframeTrack: Unsupported typeName: "+r)}function Yp(r){if(r.type===void 0)throw new Error("THREE.KeyframeTrack: track type undefined, can not parse");const e=qp(r.type);if(r.times===void 0){const t=[],n=[];tc(r.keys,t,n,"value"),r.times=t,r.values=n}return e.parse!==void 0?e.parse(r):new e(r.name,r.times,r.values,r.interpolation)}const Nn={enabled:!1,files:{},add:function(r,e){this.enabled!==!1&&(this.files[r]=e)},get:function(r){if(this.enabled!==!1)return this.files[r]},remove:function(r){delete this.files[r]},clear:function(){this.files={}}};
vendor: 6,677 bytes, line 44
44class ku{constructor(e,t,n){const i=this;let s=!1,a=0,o=0,l;const c=[];this.onStart=void 0,this.onLoad=e,this.onProgress=t,this.onError=n,this._abortController=null,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=null,this}}get abortController(){return this._abortController||(this._abortController=new AbortController),this._abortController}}const Zp=new ku;class sn{constructor(e){this.manager=e!==void 0?e:Zp,this.crossOrigin="anonymous",this.withCredentials=!1,this.path="",this.resourcePath="",this.requestHeader={}}load(){}loadAsync(e,t){const n=this;return new Promise(function(i,s){n.load(e,i,t,s)})}parse(){}setCrossOrigin(e){return this.crossOrigin=e,this}setWithCredentials(e){return this.withCredentials=e,this}setPath(e){return this.path=e,this}setResourcePath(e){return this.resourcePath=e,this}setRequestHeader(e){return this.requestHeader=e,this}abort(){return this}}sn.DEFAULT_MATERIAL_NAME="__DEFAULT";const Pn={};class Jp extends Error{constructor(e,t){super(e),this.response=t}}class ei extends sn{constructor(e){super(e),this.mimeType="",this.responseType="",this._abortController=new AbortController}load(e,t,n,i){e===void 0&&(e=""),this.path!==void 0&&(e=this.path+e),e=this.manager.resolveURL(e);const s=Nn.get(`file:${e}`);if(s!==void 0)return this.manager.itemStart(e),setTimeout(()=>{t&&t(s),this.manager.itemEnd(e)},0),s;if(Pn[e]!==void 0){Pn[e].push({onLoad:t,onProgress:n,onError:i});return}Pn[e]=[],Pn[e].push({onLoad:t,onProgress:n,onError:i});const a=new Request(e,{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&&de("FileLoader: HTTP Status 0 received."),typeof ReadableStream=="undefined"||c.body===void 0||c.body.getReader===void 0)return c;const h=Pn[e],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){v();function v(){u.read().then(({done:x,value:M})=>{if(x)p.close();else{_+=M.byteLength;const T=new ProgressEvent("progress",{lengthComputable:m,loaded:_,total:f});for(let E=0,C=h.length;E<C;E++){const P=h[E];P.onProgress&&P.onProgress(T)}p.enqueue(M),v()}},x=>{p.error(x)})}}});return new Response(g)}else throw new Jp(`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();{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=>{Nn.add(`file:${e}`,c);const h=Pn[e];delete Pn[e];for(let u=0,d=h.length;u<d;u++){const f=h[u];f.onLoad&&f.onLoad(c)}}).catch(c=>{const h=Pn[e];if(h===void 0)throw this.manager.itemError(e),c;delete Pn[e];for(let u=0,d=h.length;u<d;u++){const f=h[u];f.onError&&f.onError(c)}this.manager.itemError(e)}).finally(()=>{this.manager.itemEnd(e)}),this.manager.itemStart(e)}setResponseType(e){return this.responseType=e,this}setMimeType(e){return this.mimeType=e,this}abort(){return this._abortController.abort(),this._abortController=new AbortController,this}}class Oy extends sn{constructor(e){super(e)}load(e,t,n,i){const s=this,a=new ei(this.manager);a.setPath(this.path),a.setRequestHeader(this.requestHeader),a.setWithCredentials(this.withCredentials),a.load(e,function(o){try{t(s.parse(JSON.parse(o)))}catch(l){i?i(l):Le(l),s.manager.itemError(e)}},n,i)}parse(e){const t=[];for(let n=0;n<e.length;n++){const i=fa.parse(e[n]);t.push(i)}return t}}class By extends sn{constructor(e){super(e)}load(e,t,n,i){const s=this,a=[],o=new Vl,l=new ei(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(e[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=mt),o.image=a,o.format=f.format,o.needsUpdate=!0,t&&t(o))},n,i)}if(Array.isArray(e))for(let u=0,d=e.length;u<d;++u)h(u);else l.load(e,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=mt),o.format=d.format,o.needsUpdate=!0,t&&t(o)},n,i);return o}}const $i=new WeakMap;class pa extends sn{constructor(e){super(e)}load(e,t,n,i){this.path!==void 0&&(e=this.path+e),e=this.manager.resolveURL(e);const s=this,a=Nn.get(`image:${e}`);if(a!==void 0){if(a.complete===!0)s.manager.itemStart(e),setTimeout(function(){t&&t(a),s.manager.itemEnd(e)},0);else{let u=$i.get(a);u===void 0&&(u=[],$i.set(a,u)),u.push({onLoad:t,onError:i})}return a}const o=Hs("img");function l(){h(),t&&t(this);const u=$i.get(this)||[];for(let d=0;d<u.length;d++){const f=u[d];f.onLoad&&f.onLoad(this)}$i.delete(this),s.manager.itemEnd(e)}function c(u){h(),i&&i(u),Nn.remove(`image:${e}`);const d=$i.get(this)||[];for(let f=0;f<d.length;f++){const m=d[f];m.onError&&m.onError(u)}$i.delete(this),s.manager.itemError(e),s.manager.itemEnd(e)}function h(){o.removeEventListener("load",l,!1),o.removeEventListener("error",c,!1)}return o.addEventListener("load",l,!1),o.addEventListener("error",c,!1),e.slice(0,5)!=="data:"&&this.crossOrigin!==void 0&&(o.crossOrigin=this.crossOrigin),Nn.add(`image:${e}`,o),s.manager.itemStart(e),o.src=e,o}}class zy extends sn{constructor(e){super(e)}load(e,t,n,i){const s=new _a;
vendor: 27,943 bytes, line 44
44s.colorSpace=Kt;const a=new pa(this.manager);a.setCrossOrigin(this.crossOrigin),a.setPath(this.path);let o=0;function l(c){a.load(e[c],function(h){s.images[c]=h,o++,o===6&&(s.needsUpdate=!0,t&&t(s))},void 0,i)}for(let c=0;c<e.length;++c)l(c);return s}}class Vy extends sn{constructor(e){super(e)}load(e,t,n,i){const s=this,a=new bn,o=new ei(this.manager);return o.setResponseType("arraybuffer"),o.setRequestHeader(this.requestHeader),o.setPath(this.path),o.setWithCredentials(s.withCredentials),o.load(e,function(l){let c;try{c=s.parse(l)}catch(h){if(i!==void 0)i(h);else{h(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:en,a.wrapT=c.wrapT!==void 0?c.wrapT:en,a.magFilter=c.magFilter!==void 0?c.magFilter:mt,a.minFilter=c.minFilter!==void 0?c.minFilter:mt,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=Un),c.mipmapCount===1&&(a.minFilter=mt),c.generateMipmaps!==void 0&&(a.generateMipmaps=c.generateMipmaps),a.needsUpdate=!0,t&&t(a,c)},n,i),a}}class ky extends sn{constructor(e){super(e)}load(e,t,n,i){const s=new Mt,a=new pa(this.manager);return a.setCrossOrigin(this.crossOrigin),a.setPath(this.path),a.load(e,function(o){s.image=o,s.needsUpdate=!0,t!==void 0&&t(s)},n,i),s}}class Ii extends nt{constructor(e,t=1){super(),this.isLight=!0,this.type="Light",this.color=new Me(e),this.intensity=t}dispose(){this.dispatchEvent({type:"dispose"})}copy(e,t){return super.copy(e,t),this.color.copy(e.color),this.intensity=e.intensity,this}toJSON(e){const t=super.toJSON(e);return t.object.color=this.color.getHex(),t.object.intensity=this.intensity,t}}class $p extends Ii{constructor(e,t,n){super(e,n),this.isHemisphereLight=!0,this.type="HemisphereLight",this.position.copy(nt.DEFAULT_UP),this.updateMatrix(),this.groundColor=new Me(t)}copy(e,t){return super.copy(e,t),this.groundColor.copy(e.groundColor),this}toJSON(e){const t=super.toJSON(e);return t.object.groundColor=this.groundColor.getHex(),t}}const co=new Ge,hh=new R,uh=new R;class nc{constructor(e){this.camera=e,this.intensity=1,this.bias=0,this.normalBias=0,this.radius=1,this.blurSamples=8,this.mapSize=new K(512,512),this.mapType=Qt,this.map=null,this.mapPass=null,this.matrix=new Ge,this.autoUpdate=!0,this.needsUpdate=!1,this._frustum=new Qs,this._frameExtents=new K(1,1),this._viewportCount=1,this._viewports=[new pt(0,0,1,1)]}getViewportCount(){return this._viewportCount}getFrustum(){return this._frustum}updateMatrices(e){const t=this.camera,n=this.matrix;hh.setFromMatrixPosition(e.matrixWorld),t.position.copy(hh),uh.setFromMatrixPosition(e.target.matrixWorld),t.lookAt(uh),t.updateMatrixWorld(),co.multiplyMatrices(t.projectionMatrix,t.matrixWorldInverse),this._frustum.setFromProjectionMatrix(co,t.coordinateSystem,t.reversedDepth),t.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(co)}getViewport(e){return this._viewports[e]}getFrameExtents(){return this._frameExtents}dispose(){this.map&&this.map.dispose(),this.mapPass&&this.mapPass.dispose()}copy(e){return this.camera=e.camera.clone(),this.intensity=e.intensity,this.bias=e.bias,this.radius=e.radius,this.autoUpdate=e.autoUpdate,this.needsUpdate=e.needsUpdate,this.normalBias=e.normalBias,this.blurSamples=e.blurSamples,this.mapSize.copy(e.mapSize),this}clone(){return new this.constructor().copy(this)}toJSON(){const e={};return this.intensity!==1&&(e.intensity=this.intensity),this.bias!==0&&(e.bias=this.bias),this.normalBias!==0&&(e.normalBias=this.normalBias),this.radius!==1&&(e.radius=this.radius),(this.mapSize.x!==512||this.mapSize.y!==512)&&(e.mapSize=this.mapSize.toArray()),e.camera=this.camera.toJSON(!1).object,delete e.camera.matrix,e}}class Kp extends nc{constructor(){super(new Pt(50,1,.5,500)),this.isSpotLightShadow=!0,this.focus=1,this.aspect=1}updateMatrices(e){const t=this.camera,n=cs*2*e.angle*this.focus,i=this.mapSize.width/this.mapSize.height*this.aspect,s=e.distance||t.far;(n!==t.fov||i!==t.aspect||s!==t.far)&&(t.fov=n,t.aspect=i,t.far=s,t.updateProjectionMatrix()),super.updateMatrices(e)}copy(e){return super.copy(e),this.focus=e.focus,this}}class Qp extends Ii{constructor(e,t,n=0,i=Math.PI/3,s=0,a=2){super(e,t),this.isSpotLight=!0,this.type="SpotLight",this.position.copy(nt.DEFAULT_UP),this.updateMatrix(),this.target=new nt,this.distance=n,this.angle=i,this.penumbra=s,this.decay=a,this.map=null,this.shadow=new Kp}get power(){return this.intensity*Math.PI}set power(e){this.intensity=e/Math.PI}dispose(){super.dispose(),this.shadow.dispose()}copy(e,t){return super.copy(e,t),this.distance=e.distance,this.angle=e.angle,this.penumbra=e.penumbra,this.decay=e.decay,this.target=e.target.clone(),this.map=e.map,this.shadow=e.shadow.clone(),this}toJSON(e){const t=super.toJSON(e);return t.object.distance=this.distance,t.object.angle=this.angle,t.object.decay=this.decay,t.object.penumbra=this.penumbra,t.object.target=this.target.uuid,this.map&&this.map.isTexture&&(t.object.map=this.map.toJSON(e).uuid),t.object.shadow=this.shadow.toJSON(),t}}class jp extends nc{constructor(){super(new Pt(90,1,.5,500)),this.isPointLightShadow=!0}}class em extends Ii{constructor(e,t,n=0,i=2){super(e,t),this.isPointLight=!0,this.type="PointLight",this.distance=n,this.decay=i,this.shadow=new jp}get power(){return this.intensity*4*Math.PI}set power(e){this.intensity=e/(4*Math.PI)}dispose(){super.dispose(),this.shadow.dispose()}copy(e,t){return super.copy(e,t),this.distance=e.distance,this.decay=e.decay,this.shadow=e.shadow.clone(),this}toJSON(e){const t=super.toJSON(e);return t.object.distance=this.distance,t.object.decay=this.decay,t.object.shadow=this.shadow.toJSON(),t}}class Aa extends Ul{constructor(e=-1,t=1,n=1,i=-1,s=.1,a=2e3){super(),this.isOrthographicCamera=!0,this.type="OrthographicCamera",this.zoom=1,this.view=null,this.left=e,this.right=t,this.top=n,this.bottom=i,this.near=s,this.far=a,this.updateProjectionMatrix()}copy(e,t){return super.copy(e,t),this.left=e.left,this.right=e.right,this.top=e.top,this.bottom=e.bottom,this.near=e.near,this.far=e.far,this.zoom=e.zoom,this.view=e.view===null?null:Object.assign({},e.view),this}setViewOffset(e,t,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=e,this.view.fullHeight=t,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 e=(this.right-this.left)/(2*this.zoom),t=(this.top-this.bottom)/(2*this.zoom),n=(this.right+this.left)/2,i=(this.top+this.bottom)/2;let s=n-e,a=n+e,o=i+t,l=i-t;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(e){const t=super.toJSON(e);return t.object.zoom=this.zoom,t.object.left=this.left,t.object.right=this.right,t.object.top=this.top,t.object.bottom=this.bottom,t.object.near=this.near,t.object.far=this.far,this.view!==null&&(t.object.view=Object.assign({},this.view)),t}}class tm extends nc{constructor(){super(new Aa(-5,5,5,-5,.5,500)),this.isDirectionalLightShadow=!0}}class nm extends Ii{constructor(e,t){super(e,t),this.isDirectionalLight=!0,this.type="DirectionalLight",this.position.copy(nt.DEFAULT_UP),this.updateMatrix(),this.target=new nt,this.shadow=new tm}dispose(){super.dispose(),this.shadow.dispose()}copy(e){return super.copy(e),this.target=e.target.clone(),this.shadow=e.shadow.clone(),this}toJSON(e){const t=super.toJSON(e);return t.object.shadow=this.shadow.toJSON(),t.object.target=this.target.uuid,t}}class im extends Ii{constructor(e,t){super(e,t),this.isAmbientLight=!0,this.type="AmbientLight"}}class sm extends Ii{constructor(e,t,n=10,i=10){super(e,t),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(e){this.intensity=e/(this.width*this.height*Math.PI)}copy(e){return super.copy(e),this.width=e.width,this.height=e.height,this}toJSON(e){const t=super.toJSON(e);return t.object.width=this.width,t.object.height=this.height,t}}class Gu{constructor(){this.isSphericalHarmonics3=!0,this.coefficients=[];for(let e=0;e<9;e++)this.coefficients.push(new R)}set(e){for(let t=0;t<9;t++)this.coefficients[t].copy(e[t]);return this}zero(){for(let e=0;e<9;e++)this.coefficients[e].set(0,0,0);return this}getAt(e,t){const n=e.x,i=e.y,s=e.z,a=this.coefficients;return t.copy(a[0]).multiplyScalar(.282095),t.addScaledVector(a[1],.488603*i),t.addScaledVector(a[2],.488603*s),t.addScaledVector(a[3],.488603*n),t.addScaledVector(a[4],1.092548*(n*i)),t.addScaledVector(a[5],1.092548*(i*s)),t.addScaledVector(a[6],.315392*(3*s*s-1)),t.addScaledVector(a[7],1.092548*(n*s)),t.addScaledVector(a[8],.546274*(n*n-i*i)),t}getIrradianceAt(e,t){const n=e.x,i=e.y,s=e.z,a=this.coefficients;return t.copy(a[0]).multiplyScalar(.886227),t.addScaledVector(a[1],2*.511664*i),t.addScaledVector(a[2],2*.511664*s),t.addScaledVector(a[3],2*.511664*n),t.addScaledVector(a[4],2*.429043*n*i),t.addScaledVector(a[5],2*.429043*i*s),t.addScaledVector(a[6],.743125*s*s-.247708),t.addScaledVector(a[7],2*.429043*n*s),t.addScaledVector(a[8],.429043*(n*n-i*i)),t}add(e){for(let t=0;t<9;t++)this.coefficients[t].add(e.coefficients[t]);return this}addScaledSH(e,t){for(let n=0;n<9;n++)this.coefficients[n].addScaledVector(e.coefficients[n],t);return this}scale(e){for(let t=0;t<9;t++)this.coefficients[t].multiplyScalar(e);return this}lerp(e,t){for(let n=0;n<9;n++)this.coefficients[n].lerp(e.coefficients[n],t);return this}equals(e){for(let t=0;t<9;t++)if(!this.coefficients[t].equals(e.coefficients[t]))return!1;return!0}copy(e){return this.set(e.coefficients)}clone(){return new this.constructor().copy(this)}fromArray(e,t=0){const n=this.coefficients;for(let i=0;i<9;i++)n[i].fromArray(e,t+i*3);return this}toArray(e=[],t=0){const n=this.coefficients;for(let i=0;i<9;i++)n[i].toArray(e,t+i*3);return e}static getBasisAt(e,t){const n=e.x,i=e.y,s=e.z;t[0]=.282095,t[1]=.488603*i,t[2]=.488603*s,t[3]=.488603*n,t[4]=1.092548*n*i,t[5]=1.092548*i*s,t[6]=.315392*(3*s*s-1),t[7]=1.092548*n*s,t[8]=.546274*(n*n-i*i)}}class rm extends Ii{constructor(e=new Gu,t=1){super(void 0,t),this.isLightProbe=!0,this.sh=e}copy(e){return super.copy(e),this.sh.copy(e.sh),this}toJSON(e){const t=super.toJSON(e);return t.object.sh=this.sh.toArray(),t}}class ic extends sn{constructor(e){super(e),this.textures={}}load(e,t,n,i){const s=this,a=new ei(s.manager);a.setPath(s.path),a.setRequestHeader(s.requestHeader),a.setWithCredentials(s.withCredentials),a.load(e,function(o){try{t(s.parse(JSON.parse(o)))}catch(l){i?i(l):Le(l),s.manager.itemError(e)}},n,i)}parse(e){const t=this.textures;function n(s){return t[s]===void 0&&de("MaterialLoader: Undefined texture",s),t[s]}const i=this.createMaterialFromType(e.type);if(e.uuid!==void 0&&(i.uuid=e.uuid),e.name!==void 0&&(i.name=e.name),e.color!==void 0&&i.color!==void 0&&i.color.setHex(e.color),e.roughness!==void 0&&(i.roughness=e.roughness),e.metalness!==void 0&&(i.metalness=e.metalness),e.sheen!==void 0&&(i.sheen=e.sheen),e.sheenColor!==void 0&&(i.sheenColor=new Me().setHex(e.sheenColor)),e.sheenRoughness!==void 0&&(i.sheenRoughness=e.sheenRoughness),e.emissive!==void 0&&i.emissive!==void 0&&i.emissive.setHex(e.emissive),e.specular!==void 0&&i.specular!==void 0&&i.specular.setHex(e.specular),e.specularIntensity!==void 0&&(i.specularIntensity=e.specularIntensity),e.specularColor!==void 0&&i.specularColor!==void 0&&i.specularColor.setHex(e.specularColor),e.shininess!==void 0&&(i.shininess=e.shininess),e.clearcoat!==void 0&&(i.clearcoat=e.clearcoat),e.clearcoatRoughness!==void 0&&(i.clearcoatRoughness=e.clearcoatRoughness),e.dispersion!==void 0&&(i.dispersion=e.dispersion),e.iridescence!==void 0&&(i.iridescence=e.iridescence),e.iridescenceIOR!==void 0&&(i.iridescenceIOR=e.iridescenceIOR),e.iridescenceThicknessRange!==void 0&&(i.iridescenceThicknessRange=e.iridescenceThicknessRange),e.transmission!==void 0&&(i.transmission=e.transmission),e.thickness!==void 0&&(i.thickness=e.thickness),e.attenuationDistance!==void 0&&(i.attenuationDistance=e.attenuationDistance),e.attenuationColor!==void 0&&i.attenuationColor!==void 0&&i.attenuationColor.setHex(e.attenuationColor),e.anisotropy!==void 0&&(i.anisotropy=e.anisotropy),e.anisotropyRotation!==void 0&&(i.anisotropyRotation=e.anisotropyRotation),e.fog!==void 0&&(i.fog=e.fog),e.flatShading!==void 0&&(i.flatShading=e.flatShading),e.blending!==void 0&&(i.blending=e.blending),e.combine!==void 0&&(i.combine=e.combine),e.side!==void 0&&(i.side=e.side),e.shadowSide!==void 0&&(i.shadowSide=e.shadowSide),e.opacity!==void 0&&(i.opacity=e.opacity),e.transparent!==void 0&&(i.transparent=e.transparent),e.alphaTest!==void 0&&(i.alphaTest=e.alphaTest),e.alphaHash!==void 0&&(i.alphaHash=e.alphaHash),e.depthFunc!==void 0&&(i.depthFunc=e.depthFunc),e.depthTest!==void 0&&(i.depthTest=e.depthTest),e.depthWrite!==void 0&&(i.depthWrite=e.depthWrite),e.colorWrite!==void 0&&(i.colorWrite=e.colorWrite),e.blendSrc!==void 0&&(i.blendSrc=e.blendSrc),e.blendDst!==void 0&&(i.blendDst=e.blendDst),e.blendEquation!==void 0&&(i.blendEquation=e.blendEquation),e.blendSrcAlpha!==void 0&&(i.blendSrcAlpha=e.blendSrcAlpha),e.blendDstAlpha!==void 0&&(i.blendDstAlpha=e.blendDstAlpha),e.blendEquationAlpha!==void 0&&(i.blendEquationAlpha=e.blendEquationAlpha),e.blendColor!==void 0&&i.blendColor!==void 0&&i.blendColor.setHex(e.blendColor),e.blendAlpha!==void 0&&(i.blendAlpha=e.blendAlpha),e.stencilWriteMask!==void 0&&(i.stencilWriteMask=e.stencilWriteMask),e.stencilFunc!==void 0&&(i.stencilFunc=e.stencilFunc),e.stencilRef!==void 0&&(i.stencilRef=e.stencilRef),e.stencilFuncMask!==void 0&&(i.stencilFuncMask=e.stencilFuncMask),e.stencilFail!==void 0&&(i.stencilFail=e.stencilFail),e.stencilZFail!==void 0&&(i.stencilZFail=e.stencilZFail),e.stencilZPass!==void 0&&(i.stencilZPass=e.stencilZPass),e.stencilWrite!==void 0&&(i.stencilWrite=e.stencilWrite),e.wireframe!==void 0&&(i.wireframe=e.wireframe),e.wireframeLinewidth!==void 0&&(i.wireframeLinewidth=e.wireframeLinewidth),e.wireframeLinecap!==void 0&&(i.wireframeLinecap=e.wireframeLinecap),e.wireframeLinejoin!==void 0&&(i.wireframeLinejoin=e.wireframeLinejoin),e.rotation!==void 0&&(i.rotation=e.rotation),e.linewidth!==void 0&&(i.linewidth=e.linewidth),e.dashSize!==void 0&&(i.dashSize=e.dashSize),e.gapSize!==void 0&&(i.gapSize=e.gapSize),e.scale!==void 0&&(i.scale=e.scale),e.polygonOffset!==void 0&&(i.polygonOffset=e.polygonOffset),e.polygonOffsetFactor!==void 0&&(i.polygonOffsetFactor=e.polygonOffsetFactor),e.polygonOffsetUnits!==void 0&&(i.polygonOffsetUnits=e.polygonOffsetUnits),e.dithering!==void 0&&(i.dithering=e.dithering),e.alphaToCoverage!==void 0&&(i.alphaToCoverage=e.alphaToCoverage),e.premultipliedAlpha!==void 0&&(i.premultipliedAlpha=e.premultipliedAlpha),e.forceSinglePass!==void 0&&(i.forceSinglePass=e.forceSinglePass),e.allowOverride!==void 0&&(i.allowOverride=e.allowOverride),e.visible!==void 0&&(i.visible=e.visible),e.toneMapped!==void 0&&(i.toneMapped=e.toneMapped),e.userData!==void 0&&(i.userData=e.userData),e.vertexColors!==void 0&&(typeof e.vertexColors=="number"?i.vertexColors=e.vertexColors>0:i.vertexColors=e.vertexColors),e.uniforms!==void 0)for(const s in e.uniforms){const a=e.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 Me().setHex(a.value);break;case"v2":i.uniforms[s].value=new K().fromArray(a.value);break;case"v3":i.uniforms[s].value=new R().fromArray(a.value);break;case"v4":i.uniforms[s].value=new pt().fromArray(a.value);break;case"m3":i.uniforms[s].value=new Ye().fromArray(a.value);break;case"m4":i.uniforms[s].value=new Ge().fromArray(a.value);break;default:i.uniforms[s].value=a.value}}if(e.defines!==void 0&&(i.defines=e.defines),e.vertexShader!==void 0&&(i.vertexShader=e.vertexShader),e.fragmentShader!==void 0&&(i.fragmentShader=e.fragmentShader),e.glslVersion!==void 0&&(i.glslVersion=e.glslVersion),e.extensions!==void 0)for(const s in e.extensions)i.extensions[s]=e.extensions[s];if(e.lights!==void 0&&(i.lights=e.lights),e.clipping!==void 0&&(i.clipping=e.clipping),e.size!==void 0&&(i.size=e.size),e.sizeAttenuation!==void 0&&(i.sizeAttenuation=e.sizeAttenuation),e.map!==void 0&&(i.map=n(e.map)),e.matcap!==void 0&&(i.matcap=n(e.matcap)),e.alphaMap!==void 0&&(i.alphaMap=n(e.alphaMap)),e.bumpMap!==void 0&&(i.bumpMap=n(e.bumpMap)),e.bumpScale!==void 0&&(i.bumpScale=e.bumpScale),e.normalMap!==void 0&&(i.normalMap=n(e.normalMap)),e.normalMapType!==void 0&&(i.normalMapType=e.normalMapType),e.normalScale!==void 0){let s=e.normalScale;Array.isArray(s)===!1&&(s=[s,s]),i.normalScale=new K().fromArray(s)}return e.displacementMap!==void 0&&(i.displacementMap=n(e.displacementMap)),e.displacementScale!==void 0&&(i.displacementScale=e.displacementScale),e.displacementBias!==void 0&&(i.displacementBias=e.displacementBias),e.roughnessMap!==void 0&&(i.roughnessMap=n(e.roughnessMap)),e.metalnessMap!==void 0&&(i.metalnessMap=n(e.metalnessMap)),e.emissiveMap!==void 0&&(i.emissiveMap=n(e.emissiveMap)),e.emissiveIntensity!==void 0&&(i.emissiveIntensity=e.emissiveIntensity),e.specularMap!==void 0&&(i.specularMap=n(e.specularMap)),e.specularIntensityMap!==void 0&&(i.specularIntensityMap=n(e.specularIntensityMap)),e.specularColorMap!==void 0&&(i.specularColorMap=n(e.specularColorMap)),e.envMap!==void 0&&(i.envMap=n(e.envMap)),e.envMapRotation!==void 0&&i.envMapRotation.fromArray(e.envMapRotation),e.envMapIntensity!==void 0&&(i.envMapIntensity=e.envMapIntensity),e.reflectivity!==void 0&&(i.reflectivity=e.reflectivity),e.refractionRatio!==void 0&&(i.refractionRatio=e.refractionRatio),e.lightMap!==void 0&&(i.lightMap=n(e.lightMap)),e.lightMapIntensity!==void 0&&(i.lightMapIntensity=e.lightMapIntensity),e.aoMap!==void 0&&(i.aoMap=n(e.aoMap)),e.aoMapIntensity!==void 0&&(i.aoMapIntensity=e.aoMapIntensity),e.gradientMap!==void 0&&(i.gradientMap=n(e.gradientMap)),e.clearcoatMap!==void 0&&(i.clearcoatMap=n(e.clearcoatMap)),e.clearcoatRoughnessMap!==void 0&&(i.clearcoatRoughnessMap=n(e.clearcoatRoughnessMap)),e.clearcoatNormalMap!==void 0&&(i.clearcoatNormalMap=n(e.clearcoatNormalMap)),e.clearcoatNormalScale!==void 0&&(i.clearcoatNormalScale=new K().fromArray(e.clearcoatNormalScale)),e.iridescenceMap!==void 0&&(i.iridescenceMap=n(e.iridescenceMap)),e.iridescenceThicknessMap!==void 0&&(i.iridescenceThicknessMap=n(e.iridescenceThicknessMap)),e.transmissionMap!==void 0&&(i.transmissionMap=n(e.transmissionMap)),e.thicknessMap!==void 0&&(i.thicknessMap=n(e.thicknessMap)),e.anisotropyMap!==void 0&&(i.anisotropyMap=n(e.anisotropyMap)),e.sheenColorMap!==void 0&&(i.sheenColorMap=n(e.sheenColorMap)),e.sheenRoughnessMap!==void 0&&(i.sheenRoughnessMap=n(e.sheenRoughnessMap)),i}setTextures(e){return this.textures=e,this}createMaterialFromType(e){return ic.createMaterialFromType(e)}static createMaterialFromType(e){const t={ShadowMaterial:Dp,SpriteMaterial:yu,RawShaderMaterial:Uu,ShaderMaterial:pn,PointsMaterial:bu,MeshPhysicalMaterial:Up,MeshStandardMaterial:Nu,MeshPhongMaterial:Np,MeshToonMaterial:Fp,MeshNormalMaterial:Op,MeshLambertMaterial:Bp,MeshDepthMaterial:Fu,MeshDistanceMaterial:Ou,MeshBasicMaterial:Ci,MeshMatcapMaterial:zp,LineDashedMaterial:Vp,LineBasicMaterial:qt,Material:Bt};return new t[e]}}class dh{static extractUrlBase(e){const t=e.lastIndexOf("/");return t===-1?"./":e.slice(0,t+1)}static resolveURL(e,t){return typeof e!="string"||e===""?"":(/^https?:\/\//i.test(t)&&/^\//.test(e)&&(t=t.replace(/(^https?:\/\/[^\/]+).*/i,"$1")),/^(https?:)?\/\//i.test(e)||/^data:.*,.*$/i.test(e)||/^blob:.*$/i.test(e)?e:t+e)}}class am extends qe{constructor(){super(),this.isInstancedBufferGeometry=!0,this.type="InstancedBufferGeometry",this.instanceCount=1/0}copy(e){return super.copy(e),this.instanceCount=e.instanceCount,this}toJSON(){const e=super.toJSON();return e.instanceCount=this.instanceCount,e.isInstancedBufferGeometry=!0,e}}class om extends sn{constructor(e){super(e)}load(e,t,n,i){const s=this,a=new ei(s.manager);a.setPath(s.path),a.setRequestHeader(s.requestHeader),a.setWithCredentials(s.withCredentials),a.load(e,function(o){try{t(s.parse(JSON.parse(o)))}catch(l){i?i(l):Le(l),s.manager.itemError(e)}},n,i)}parse(e){const t={},n={};function i(f,m){if(t[m]!==void 0)return t[m];const g=f.interleavedBuffers[m],p=s(f,g.buffer),v=ns(g.type,p),x=new Ol(v,g.stride);return x.uuid=g.uuid,t[m]=x,x}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=e.isInstancedBufferGeometry?new am:new qe,o=e.data.index;if(o!==void 0){const f=ns(o.type,o.array);a.setIndex(new ut(f,1))}const l=e.data.attributes;for(const f in l){const m=l[f];let _;if(m.isInterleavedBufferAttribute){const g=i(e.data,m.data);_=new us(g,m.itemSize,m.offset,m.normalized)}else{const g=ns(m.type,m.array),p=m.isInstancedBufferAttribute?Xs:ut;_=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=e.data.morphAttributes;if(c)for(const f in c){const m=c[f],_=[];for(let g=0,p=m.length;g<p;g++){const v=m[g];let x;if(v.isInterleavedBufferAttribute){const M=i(e.data,v.data);x=new us(M,v.itemSize,v.offset,v.normalized)}else{const M=ns(v.type,v.array);x=new ut(M,v.itemSize,v.normalized)}v.name!==void 0&&(x.name=v.name),_.push(x)}a.morphAttributes[f]=_}e.data.morphTargetsRelative&&(a.morphTargetsRelative=!0);const u=e.data.groups||e.data.drawcalls||e.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=e.data.boundingSphere;return d!==void 0&&(a.boundingSphere=new Lt().fromJSON(d)),e.name&&(a.name=e.name),e.userData&&(a.userData=e.userData),a}}class Gy extends sn{constructor(e){super(e)}load(e,t,n,i){const s=this,a=this.path===""?dh.extractUrlBase(e):this.path;this.resourcePath=this.resourcePath||a;const o=new ei(this.manager);o.setPath(this.path),o.setRequestHeader(this.requestHeader),o.setWithCredentials(this.withCredentials),o.load(e,function(l){let c=null;try{c=JSON.parse(l)}catch(u){i!==void 0&&i(u),u("ObjectLoader: Can't parse "+e+".",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 "+e)),Le("ObjectLoader: Can't load "+e);return}s.parse(c,t)},n,i)}async loadAsync(e,t){const n=this,i=this.path===""?dh.extractUrlBase(e):this.path;this.resourcePath=this.resourcePath||i;const s=new ei(this.manager);s.setPath(this.path),s.setRequestHeader(this.requestHeader),s.setWithCredentials(this.withCredentials);const a=await s.loadAsync(e,t),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 "+e);return await n.parseAsync(o)}parse(e,t){const n=this.parseAnimations(e.animations),i=this.parseShapes(e.shapes),s=this.parseGeometries(e.geometries,i),a=this.parseImages(e.images,function(){t!==void 0&&t(c)}),o=this.parseTextures(e.textures,a),l=this.parseMaterials(e.materials,o),c=this.parseObject(e.object,s,l,o,n),h=this.parseSkeletons(e.skeletons,c);if(this.bindSkeletons(c,h),this.bindLightTargets(c),t!==void 0){let u=!1;for(const d in a)if(a[d].data instanceof HTMLImageElement){u=!0;break}u===!1&&t(c)}return c}async parseAsync(e){const t=this.parseAnimations(e.animations),n=this.parseShapes(e.shapes),i=this.parseGeometries(e.geometries,n),s=await this.parseImagesAsync(e.images),a=this.parseTextures(e.textures,s),o=this.parseMaterials(e.materials,a),l=this.parseObject(e.object,i,o,a,t),c=this.parseSkeletons(e.skeletons,l);return this.bindSkeletons(l,c),this.bindLightTargets(l),l}parseShapes(e){const t={};if(e!==void 0)for(let n=0,i=e.length;n<i;n++){const s=new rs().fromJSON(e[n]);t[s.uuid]=s}return t}parseSkeletons(e,t){const n={},i={};if(t.traverse(function(s){s.isBone&&(i[s.uuid]=s)}),e!==void 0)for(let s=0,a=e.length;s<a;s++){const o=new Bl().fromJSON(e[s],i);n[o.uuid]=o}return n}parseGeometries(e,t){const n={};if(e!==void 0){const i=new om;for(let s=0,a=e.length;s<a;s++){let o;const l=e[s];switch(l.type){case"BufferGeometry":case"InstancedBufferGeometry":o=i.parse(l);break;default:l.type in ch?o=ch[l.type].fromJSON(l,t):de(`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(e,t){const n={},i={};if(e!==void 0){const s=new ic;s.setTextures(t);for(let a=0,o=e.length;a<o;a++){const l=e[a];n[l.uuid]===void 0&&(n[l.uuid]=s.parse(l)),i[l.uuid]=n[l.uuid]}}return i}parseAnimations(e){const t={};if(e!==void 0)for(let n=0;n<e.length;n++){const i=e[n],s=fa.parse(i);t[s.uuid]=s}return t}parseImages(e,t){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:ns(l.type,l.data),width:l.width,height:l.height}:null}if(e!==void 0&&e.length>0){const l=new ku(t);s=new pa(l),s.setCrossOrigin(this.crossOrigin);for(let c=0,h=e.length;c<h;c++){const u=e[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 bn(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(e){const t=this,n={};let i;async function s(a){if(typeof a=="string"){const o=a,l=/^(\/\/)|([a-z]+:(\/\/)?)/i.test(o)?o:t.resourcePath+o;return await i.loadAsync(l)}else return a.data?{data:ns(a.type,a.data),width:a.width,height:a.height}:null}if(e!==void 0&&e.length>0){i=new pa(this.manager),i.setCrossOrigin(this.crossOrigin);for(let a=0,o=e.length;a<o;a++){const l=e[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 bn(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(e,t){function n(s,a){return typeof s=="number"?s:(de("ObjectLoader.parseTexture: Constant should be in numeric form.",s),a[s])}const i={};if(e!==void 0)for(let s=0,a=e.length;s<a;s++){const o=e[s];o.image===void 0&&de('ObjectLoader: No "image" specified for',o.uuid),t[o.image]===void 0&&de("ObjectLoader: Undefined image",o.image);const l=t[o.image],c=l.data;let h;Array.isArray(c)?(h=new _a,c.length===6&&(h.needsUpdate=!0)):(c&&c.data?h=new bn:h=new Mt,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,lm)),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],fh),h.wrapT=n(o.wrap[1],fh)),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
vendor: 6,209 bytes, line 44
44=o.colorSpace),o.minFilter!==void 0&&(h.minFilter=n(o.minFilter,ph)),o.magFilter!==void 0&&(h.magFilter=n(o.magFilter,ph)),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(e,t,n,i,s){let a;function o(d){return t[d]===void 0&&de("ObjectLoader: Undefined geometry",d),t[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&&de("ObjectLoader: Undefined material",g),f.push(n[g])}return f}return n[d]===void 0&&de("ObjectLoader: Undefined material",d),n[d]}}function c(d){return i[d]===void 0&&de("ObjectLoader: Undefined texture",d),i[d]}let h,u;switch(e.type){case"Scene":a=new Rf,e.background!==void 0&&(Number.isInteger(e.background)?a.background=new Me(e.background):a.background=c(e.background)),e.environment!==void 0&&(a.environment=c(e.environment)),e.fog!==void 0&&(e.fog.type==="Fog"?a.fog=new Fl(e.fog.color,e.fog.near,e.fog.far):e.fog.type==="FogExp2"&&(a.fog=new Nl(e.fog.color,e.fog.density)),e.fog.name!==""&&(a.fog.name=e.fog.name)),e.backgroundBlurriness!==void 0&&(a.backgroundBlurriness=e.backgroundBlurriness),e.backgroundIntensity!==void 0&&(a.backgroundIntensity=e.backgroundIntensity),e.backgroundRotation!==void 0&&a.backgroundRotation.fromArray(e.backgroundRotation),e.environmentIntensity!==void 0&&(a.environmentIntensity=e.environmentIntensity),e.environmentRotation!==void 0&&a.environmentRotation.fromArray(e.environmentRotation);break;case"PerspectiveCamera":a=new Pt(e.fov,e.aspect,e.near,e.far),e.focus!==void 0&&(a.focus=e.focus),e.zoom!==void 0&&(a.zoom=e.zoom),e.filmGauge!==void 0&&(a.filmGauge=e.filmGauge),e.filmOffset!==void 0&&(a.filmOffset=e.filmOffset),e.view!==void 0&&(a.view=Object.assign({},e.view));break;case"OrthographicCamera":a=new Aa(e.left,e.right,e.top,e.bottom,e.near,e.far),e.zoom!==void 0&&(a.zoom=e.zoom),e.view!==void 0&&(a.view=Object.assign({},e.view));break;case"AmbientLight":a=new im(e.color,e.intensity);break;case"DirectionalLight":a=new nm(e.color,e.intensity),a.target=e.target||"";break;case"PointLight":a=new em(e.color,e.intensity,e.distance,e.decay);break;case"RectAreaLight":a=new sm(e.color,e.intensity,e.width,e.height);break;case"SpotLight":a=new Qp(e.color,e.intensity,e.distance,e.angle,e.penumbra,e.decay),a.target=e.target||"";break;case"HemisphereLight":a=new $p(e.color,e.groundColor,e.intensity);break;case"LightProbe":const d=new Gu().fromArray(e.sh);a=new rm(d,e.intensity);break;case"SkinnedMesh":h=o(e.geometry),u=l(e.material),a=new Df(h,u),e.bindMode!==void 0&&(a.bindMode=e.bindMode),e.bindMatrix!==void 0&&a.bindMatrix.fromArray(e.bindMatrix),e.skeleton!==void 0&&(a.skeleton=e.skeleton);break;case"Mesh":h=o(e.geometry),u=l(e.material),a=new At(h,u);break;case"InstancedMesh":h=o(e.geometry),u=l(e.material);const f=e.count,m=e.instanceMatrix,_=e.instanceColor;a=new Ff(h,u,f),a.instanceMatrix=new Xs(new Float32Array(m.array),16),_!==void 0&&(a.instanceColor=new Xs(new Float32Array(_.array),_.itemSize));break;case"BatchedMesh":h=o(e.geometry),u=l(e.material),a=new Yf(e.maxInstanceCount,e.maxVertexCount,e.maxIndexCount,u),a.geometry=h,a.perObjectFrustumCulled=e.perObjectFrustumCulled,a.sortObjects=e.sortObjects,a._drawRanges=e.drawRanges,a._reservedRanges=e.reservedRanges,a._geometryInfo=e.geometryInfo.map(g=>{let p=null,v=null;return g.boundingBox!==void 0&&(p=new Ot().fromJSON(g.boundingBox)),g.boundingSphere!==void 0&&(v=new Lt().fromJSON(g.boundingSphere)),{...g,boundingBox:p,boundingSphere:v}}),a._instanceInfo=e.instanceInfo,a._availableInstanceIds=e._availableInstanceIds,a._availableGeometryIds=e._availableGeometryIds,a._nextIndexStart=e.nextIndexStart,a._nextVertexStart=e.nextVertexStart,a._geometryCount=e.geometryCount,a._maxInstanceCount=e.maxInstanceCount,a._maxVertexCount=e.maxVertexCount,a._maxIndexCount=e.maxIndexCount,a._geometryInitialized=e.geometryInitialized,a._matricesTexture=c(e.matricesTexture.uuid),a._indirectTexture=c(e.indirectTexture.uuid),e.colorsTexture!==void 0&&(a._colorsTexture=c(e.colorsTexture.uuid)),e.boundingSphere!==void 0&&(a.boundingSphere=new Lt().fromJSON(e.boundingSphere)),e.boundingBox!==void 0&&(a.boundingBox=new Ot().fromJSON(e.boundingBox));break;case"LOD":a=new Pf;break;case"Line":a=new Ti(o(e.geometry),l(e.material));break;case"LineLoop":a=new Zf(o(e.geometry),l(e.material));break;case"LineSegments":a=new Gn(o(e.geometry),l(e.material));break;case"PointCloud":case"Points":a=new Jf(o(e.geometry),l(e.material));break;case"Sprite":a=new If(l(e.material));break;case"Group":a=new Us;break;case"Bone":a=new Su;break;default:a=new nt}if(a.uuid=e.uuid,e.name!==void 0&&(a.name=e.name),e.matrix!==void 0?(a.matrix.fromArray(e.matrix),e.matrixAutoUpdate!==void 0&&(a.matrixAutoUpdate=e.matrixAutoUpdate),a.matrixAutoUpdate&&a.matrix.decompose(a.position,a.quaternion,a.scale)):(e.position!==void 0&&a.position.fromArray(e.position),e.rotation!==void 0&&a.rotation.fromArray(e.rotation),e.quaternion!==void 0&&a.quaternion.fromArray(e.quaternion),e.scale!==void 0&&a.scale.fromArray(e.scale)),e.up!==void 0&&a.up.fromArray(e.up),e.castShadow!==void 0&&(a.castShadow=e.castShadow),e.receiveShadow!==void 0&&(a.receiveShadow=e.receiveShadow),e.shadow&&(e.shadow.intensity!==void 0&&(a.shadow.intensity=e.shadow.intensity),e.shadow.bias!==void 0&&(a.shadow.bias=e.shadow.bias),e.shadow.normalBias!==void 0&&(a.shadow.normalBias=e.shadow.normalBias),e.shadow.radius!==void 0&&(a.shadow.radius=e.shadow.radius),e.shadow.mapSize!==void 0&&a.shadow.mapSize.fromArray(e.shadow.mapSize),e.shadow.camera!==void 0&&(a.shadow.camera=this.parseObject(e.shadow.camera))),e.visible!==void 0&&(a.visible=e.visible),e.frustumCulled!==void 0&&(a.frustumCulled=e.frustumCulled),e.renderOrder!==void 0&&(a.renderOrder=e.renderOrder),e.userData!==void 0&&(a.userData=e.userData),e.layers!==void 0&&(a.layers.mask=e.layers
vendor: 7,211 bytes, line 44
44),e.children!==void 0){const d=e.children;for(let f=0;f<d.length;f++)a.add(this.parseObject(d[f],t,n,i,s))}if(e.animations!==void 0){const d=e.animations;for(let f=0;f<d.length;f++){const m=d[f];a.animations.push(s[m])}}if(e.type==="LOD"){e.autoUpdate!==void 0&&(a.autoUpdate=e.autoUpdate);const d=e.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(e,t){Object.keys(t).length!==0&&e.traverse(function(n){if(n.isSkinnedMesh===!0&&n.skeleton!==void 0){const i=t[n.skeleton];i===void 0?de("ObjectLoader: No skeleton found with UUID:",n.skeleton):n.bind(i,n.bindMatrix)}})}bindLightTargets(e){e.traverse(function(t){if(t.isDirectionalLight||t.isSpotLight){const n=t.target,i=e.getObjectByProperty("uuid",n);i!==void 0?t.target=i:t.target=new nt}})}}const lm={UVMapping:yl,CubeReflectionMapping:Bn,CubeRefractionMapping:Ai,EquirectangularReflectionMapping:jr,EquirectangularRefractionMapping:ea,CubeUVReflectionMapping:$s},fh={RepeatWrapping:ta,ClampToEdgeWrapping:en,MirroredRepeatWrapping:na},ph={NearestFilter:bt,NearestMipmapNearestFilter:su,NearestMipmapLinearFilter:Ls,LinearFilter:mt,LinearMipmapNearestFilter:Yr,LinearMipmapLinearFilter:Un},ho=new WeakMap;class Hy extends sn{constructor(e){super(e),this.isImageBitmapLoader=!0,typeof createImageBitmap=="undefined"&&de("ImageBitmapLoader: createImageBitmap() not supported."),typeof fetch=="undefined"&&de("ImageBitmapLoader: fetch() not supported."),this.options={premultiplyAlpha:"none"},this._abortController=new AbortController}setOptions(e){return this.options=e,this}load(e,t,n,i){e===void 0&&(e=""),this.path!==void 0&&(e=this.path+e),e=this.manager.resolveURL(e);const s=this,a=Nn.get(`image-bitmap:${e}`);if(a!==void 0){if(s.manager.itemStart(e),a.then){a.then(c=>{if(ho.has(a)===!0)i&&i(ho.get(a)),s.manager.itemError(e),s.manager.itemEnd(e);else return t&&t(c),s.manager.itemEnd(e),c});return}return setTimeout(function(){t&&t(a),s.manager.itemEnd(e)},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(e,o).then(function(c){return c.blob()}).then(function(c){return createImageBitmap(c,Object.assign(s.options,{colorSpaceConversion:"none"}))}).then(function(c){return Nn.add(`image-bitmap:${e}`,c),t&&t(c),s.manager.itemEnd(e),c}).catch(function(c){i&&i(c),ho.set(l,c),Nn.remove(`image-bitmap:${e}`),s.manager.itemError(e),s.manager.itemEnd(e)});Nn.add(`image-bitmap:${e}`,l),s.manager.itemStart(e)}abort(){return this._abortController.abort(),this._abortController=new AbortController,this}}let Or;class Hu{static getContext(){return Or===void 0&&(Or=new(window.AudioContext||window.webkitAudioContext)),Or}static setContext(e){Or=e}}class Wy extends sn{constructor(e){super(e)}load(e,t,n,i){const s=this,a=new ei(this.manager);a.setResponseType("arraybuffer"),a.setPath(this.path),a.setRequestHeader(this.requestHeader),a.setWithCredentials(this.withCredentials),a.load(e,function(l){try{const c=l.slice(0);Hu.getContext().decodeAudioData(c,function(u){t(u)}).catch(o)}catch(c){o(c)}},n,i);function o(l){i?i(l):Le(l),s.manager.itemError(e)}}}const mh=new Ge,gh=new Ge,ci=new Ge;class Xy{constructor(){this.type="StereoCamera",this.aspect=1,this.eyeSep=.064,this.cameraL=new Pt,this.cameraL.layers.enable(1),this.cameraL.matrixAutoUpdate=!1,this.cameraR=new Pt,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(e){const t=this._cache;if(t.focus!==e.focus||t.fov!==e.fov||t.aspect!==e.aspect*this.aspect||t.near!==e.near||t.far!==e.far||t.zoom!==e.zoom||t.eyeSep!==this.eyeSep){t.focus=e.focus,t.fov=e.fov,t.aspect=e.aspect*this.aspect,t.near=e.near,t.far=e.far,t.zoom=e.zoom,t.eyeSep=this.eyeSep,ci.copy(e.projectionMatrix);const i=t.eyeSep/2,s=i*t.near/t.focus,a=t.near*Math.tan(bi*t.fov*.5)/t.zoom;let o,l;gh.elements[12]=-i,mh.elements[12]=i,o=-a*t.aspect+s,l=a*t.aspect+s,ci.elements[0]=2*t.near/(l-o),ci.elements[8]=(l+o)/(l-o),this.cameraL.projectionMatrix.copy(ci),o=-a*t.aspect-s,l=a*t.aspect-s,ci.elements[0]=2*t.near/(l-o),ci.elements[8]=(l+o)/(l-o),this.cameraR.projectionMatrix.copy(ci)}this.cameraL.matrixWorld.copy(e.matrixWorld).multiply(gh),this.cameraR.matrixWorld.copy(e.matrixWorld).multiply(mh)}}class cm extends Pt{constructor(e=[]){super(),this.isArrayCamera=!0,this.isMultiViewCamera=!1,this.cameras=e}}class hm{constructor(e=!0){this.autoStart=e,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 e=0;if(this.autoStart&&!this.running)return this.start(),0;if(this.running){const t=performance.now();e=(t-this.oldTime)/1e3,this.oldTime=t,this.elapsedTime+=e}return e}}const hi=new R,uo=new nn,um=new R,ui=new R,di=new R;class qy extends nt{constructor(){super(),this.type="AudioListener",this.context=Hu.getContext(),this.gain=this.context.createGain(),this.gain.connect(this.context.destination),this.filter=null,this.timeDelta=0,this._clock=new hm}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(e){return this.filter!==null?(this.gain.disconnect(this.filter),this.filter.disconnect(this.context.destination)):this.gain.disconnect(this.context.destination),this.filter=e,this.gain.connect(this.filter),this.filter.connect(this.context.destination),this}getMasterVolume(){return this.gain.gain.value}setMasterVolume(e){return this.gain.gain.setTargetAtTime(e,this.context.currentTime,.01),this}updateMatrixWorld(e){super.updateMatrixWorld(e);const t=this.context.listener;if(this.timeDelta=this._clock.getDelta(),this.matrixWorld.decompose(hi,uo,um),ui.set(0,0,-1).applyQuaternion(uo),di.set(0,1,0).applyQuaternion(uo),t.positionX){const n=this.context.currentTime+this.timeDelta;t.positionX.linearRampToValueAtTime(hi.x,n),t.positionY.linearRampToValueAtTime(hi.y,n),t.positionZ.linearRampToValueAtTime(hi.z,n),t.forwardX.linearRampToValueAtTime(ui.x,n),t.forwardY.linearRampToValueAtTime(ui.y,n),t.forwardZ.linearRampToValueAtTime(ui.z,n),t.upX.linearRampToValueAtTime(di.x,n),t.upY.linearRampToValueAtTime(di.y,n),t.upZ.linearRampToValueAtTime(di.z,n)}else t.setPosition(hi.x,hi.y,hi.z),t.setOrientation(ui.x,ui.y,ui.z,di.x,di.y,di.z)}}class dm extends nt{constructor(e){super(),this.type="Audio",this.listener=e,this.context=e.context,this.gain=this.context.createGain(),this.gain.connect(e.getInput()),this.autoplay=!1,this.buffer=null,this.detune=0,this.loop=!1,this.loopStart=0,this.loopEnd=0,this.offset=0,this.duration=void 0,this.playbackRate=1,this.isPlaying=!1,this.hasPlaybackControl
vendor: 4,110 bytes, line 44
44=!0,this.source=null,this.sourceType="empty",this._startedAt=0,this._progress=0,this._connected=!1,this.filters=[]}getOutput(){return this.gain}setNodeSource(e){return this.hasPlaybackControl=!1,this.sourceType="audioNode",this.source=e,this.connect(),this}setMediaElementSource(e){return this.hasPlaybackControl=!1,this.sourceType="mediaNode",this.source=this.context.createMediaElementSource(e),this.connect(),this}setMediaStreamSource(e){return this.hasPlaybackControl=!1,this.sourceType="mediaStreamNode",this.source=this.context.createMediaStreamSource(e),this.connect(),this}setBuffer(e){return this.buffer=e,this.sourceType="buffer",this.autoplay&&this.play(),this}play(e=0){if(this.isPlaying===!0){de("Audio: Audio is already playing.");return}if(this.hasPlaybackControl===!1){de("Audio: this Audio has no playback control.");return}this._startedAt=this.context.currentTime+e;const t=this.context.createBufferSource();return t.buffer=this.buffer,t.loop=this.loop,t.loopStart=this.loopStart,t.loopEnd=this.loopEnd,t.onended=this.onEnded.bind(this),t.start(this._startedAt,this._progress+this.offset,this.duration),this.isPlaying=!0,this.source=t,this.setDetune(this.detune),this.setPlaybackRate(this.playbackRate),this.connect()}pause(){if(this.hasPlaybackControl===!1){de("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(e=0){if(this.hasPlaybackControl===!1){de("Audio: this Audio has no playback control.");return}return this._progress=0,this.source!==null&&(this.source.stop(this.context.currentTime+e),this.source.onended=null),this.isPlaying=!1,this}connect(){if(this.filters.length>0){this.source.connect(this.filters[0]);for(let e=1,t=this.filters.length;e<t;e++)this.filters[e-1].connect(this.filters[e]);this.filters[this.filters.length-1].connect(this.getOutput())}else this.source.connect(this.getOutput());return this._connected=!0,this}disconnect(){if(this._connected!==!1){if(this.filters.length>0){this.source.disconnect(this.filters[0]);for(let e=1,t=this.filters.length;e<t;e++)this.filters[e-1].disconnect(this.filters[e]);this.filters[this.filters.length-1].disconnect(this.getOutput())}else this.source.disconnect(this.getOutput());return this._connected=!1,this}}getFilters(){return this.filters}setFilters(e){return e||(e=[]),this._connected===!0?(this.disconnect(),this.filters=e.slice(),this.connect()):this.filters=e.slice(),this}setDetune(e){return this.detune=e,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(e){return this.setFilters(e?[e]:[])}setPlaybackRate(e){if(this.hasPlaybackControl===!1){de("Audio: this Audio has no playback control.");return}return this.playbackRate=e,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?(de("Audio: this Audio has no playback control."),!1):this.loop}setLoop(e){if(this.hasPlaybackControl===!1){de("Audio: this Audio has no playback control.");return}return this.loop=e,this.isPlaying===!0&&(this.source.loop=this.loop),this}setLoopStart(e){return this.loopStart=e,this}setLoopEnd(e){return this.loopEnd=e,this}getVolume(){return this.gain.gain.value}setVolume(e){return this.gain.gain.setTargetAtTime(e,this.context.currentTime,.01),this}copy(e,t){return super.copy(e,t),e.sourceType!=="buffer"?(de("Audio: Audio source type cannot be copied."),this):(this.autoplay=e.autoplay,this.buffer=e.buffer,this.detune=e.detune,this.loop=e.loop,this.loopStart=e.loopStart,this.loopEnd=e.loopEnd,this.offset=e.offset,this.duration=e.duration,this.playbackRate=e.playbackRate,this.hasPlaybackControl
vendor: 28,609 bytes, line 44
44=e.hasPlaybackControl,this.sourceType=e.sourceType,this.filters=e.filters.slice(),this)}clone(e){return new this.constructor(this.listener).copy(this,e)}}const fi=new R,_h=new nn,fm=new R,pi=new R;class Yy extends dm{constructor(e){super(e),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(e){return this.panner.refDistance=e,this}getRolloffFactor(){return this.panner.rolloffFactor}setRolloffFactor(e){return this.panner.rolloffFactor=e,this}getDistanceModel(){return this.panner.distanceModel}setDistanceModel(e){return this.panner.distanceModel=e,this}getMaxDistance(){return this.panner.maxDistance}setMaxDistance(e){return this.panner.maxDistance=e,this}setDirectionalCone(e,t,n){return this.panner.coneInnerAngle=e,this.panner.coneOuterAngle=t,this.panner.coneOuterGain=n,this}updateMatrixWorld(e){if(super.updateMatrixWorld(e),this.hasPlaybackControl===!0&&this.isPlaying===!1)return;this.matrixWorld.decompose(fi,_h,fm),pi.set(0,0,1).applyQuaternion(_h);const t=this.panner;if(t.positionX){const n=this.context.currentTime+this.listener.timeDelta;t.positionX.linearRampToValueAtTime(fi.x,n),t.positionY.linearRampToValueAtTime(fi.y,n),t.positionZ.linearRampToValueAtTime(fi.z,n),t.orientationX.linearRampToValueAtTime(pi.x,n),t.orientationY.linearRampToValueAtTime(pi.y,n),t.orientationZ.linearRampToValueAtTime(pi.z,n)}else t.setPosition(fi.x,fi.y,fi.z),t.setOrientation(pi.x,pi.y,pi.z)}}class Zy{constructor(e,t=2048){this.analyser=e.context.createAnalyser(),this.analyser.fftSize=t,this.data=new Uint8Array(this.analyser.frequencyBinCount),e.getOutput().connect(this.analyser)}getFrequencyData(){return this.analyser.getByteFrequencyData(this.data),this.data}getAverageFrequency(){let e=0;const t=this.getFrequencyData();for(let n=0;n<t.length;n++)e+=t[n];return e/t.length}}class pm{constructor(e,t,n){this.binding=e,this.valueSize=n;let i,s,a;switch(t){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(e,t){const n=this.buffer,i=this.valueSize,s=e*i+i;let a=this.cumulativeWeight;if(a===0){for(let o=0;o!==i;++o)n[s+o]=n[o];a=t}else{a+=t;const o=t/a;this._mixBufferRegion(n,s,0,o,i)}this.cumulativeWeight=a}accumulateAdditive(e){const t=this.buffer,n=this.valueSize,i=n*this._addIndex;this.cumulativeWeightAdditive===0&&this._setIdentity(),this._mixBufferRegionAdditive(t,i,0,e,n),this.cumulativeWeightAdditive+=e}apply(e){const t=this.valueSize,n=this.buffer,i=e*t+t,s=this.cumulativeWeight,a=this.cumulativeWeightAdditive,o=this.binding;if(this.cumulativeWeight=0,this.cumulativeWeightAdditive=0,s<1){const l=t*this._origIndex;this._mixBufferRegion(n,i,l,1-s,t)}a>0&&this._mixBufferRegionAdditive(n,i,this._addIndex*t,1,t);for(let l=t,c=t+t;l!==c;++l)if(n[l]!==n[l+t]){o.setValue(n,i);break}}saveOriginalState(){const e=this.binding,t=this.buffer,n=this.valueSize,i=n*this._origIndex;e.getValue(t,i);for(let s=n,a=i;s!==a;++s)t[s]=t[i+s%n];this._setIdentity(),this.cumulativeWeight=0,this.cumulativeWeightAdditive=0}restoreOriginalState(){const e=this.valueSize*3;this.binding.setValue(this.buffer,e)}_setAdditiveIdentityNumeric(){const e=this._addIndex*this.valueSize,t=e+this.valueSize;for(let n=e;n<t;n++)this.buffer[n]=0}_setAdditiveIdentityQuaternion(){this._setAdditiveIdentityNumeric(),this.buffer[this._addIndex*this.valueSize+3]=1}_setAdditiveIdentityOther(){const e=this._origIndex*this.valueSize,t=this._addIndex*this.valueSize;for(let n=0;n<this.valueSize;n++)this.buffer[t+n]=this.buffer[e+n]}_select(e,t,n,i,s){if(i>=.5)for(let a=0;a!==s;++a)e[t+a]=e[n+a]}_slerp(e,t,n,i){nn.slerpFlat(e,t,e,t,e,n,i)}_slerpAdditive(e,t,n,i,s){const a=this._workIndex*s;nn.multiplyQuaternionsFlat(e,a,e,t,e,n),nn.slerpFlat(e,t,e,t,e,a,i)}_lerp(e,t,n,i,s){const a=1-i;for(let o=0;o!==s;++o){const l=t+o;e[l]=e[l]*a+e[n+o]*i}}_lerpAdditive(e,t,n,i,s){for(let a=0;a!==s;++a){const o=t+a;e[o]=e[o]+e[n+a]*i}}}const sc="\\[\\]\\.:\\/",mm=new RegExp("["+sc+"]","g"),rc="[^"+sc+"]",gm="[^"+sc.replace("\\.","")+"]",_m=/((?:WC+[\/:])*)/.source.replace("WC",rc),xm=/(WCOD+)?/.source.replace("WCOD",gm),vm=/(?:\.(WC+)(?:\[(.+)\])?)?/.source.replace("WC",rc),ym=/\.(WC+)(?:\[(.+)\])?/.source.replace("WC",rc),Mm=new RegExp("^"+_m+xm+vm+ym+"$"),Sm=["material","materials","bones","map"];class bm{constructor(e,t,n){const i=n||tt.parseTrackName(t);this._targetGroup=e,this._bindings=e.subscribe_(t,i)}getValue(e,t){this.bind();const n=this._targetGroup.nCachedObjects_,i=this._bindings[n];i!==void 0&&i.getValue(e,t)}setValue(e,t){const n=this._bindings;for(let i=this._targetGroup.nCachedObjects_,s=n.length;i!==s;++i)n[i].setValue(e,t)}bind(){const e=this._bindings;for(let t=this._targetGroup.nCachedObjects_,n=e.length;t!==n;++t)e[t].bind()}unbind(){const e=this._bindings;for(let t=this._targetGroup.nCachedObjects_,n=e.length;t!==n;++t)e[t].unbind()}}class tt{constructor(e,t,n){this.path=t,this.parsedPath=n||tt.parseTrackName(t),this.node=tt.findNode(e,this.parsedPath.nodeName),this.rootNode=e,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}static create(e,t,n){return e&&e.isAnimationObjectGroup?new tt.Composite(e,t,n):new tt(e,t,n)}static sanitizeNodeName(e){return e.replace(/\s/g,"_").replace(mm,"")}static parseTrackName(e){const t=Mm.exec(e);if(t===null)throw new Error("PropertyBinding: Cannot parse trackName: "+e);const n={nodeName:t[2],objectName:t[3],objectIndex:t[4],propertyName:t[5],propertyIndex:t[6]},i=n.nodeName&&n.nodeName.lastIndexOf(".");if(i!==void 0&&i!==-1){const s=n.nodeName.substring(i+1);Sm.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: "+e);return n}static findNode(e,t){if(t===void 0||t===""||t==="."||t===-1||t===e.name||t===e.uuid)return e;if(e.skeleton){const n=e.skeleton.getBoneByName(t);if(n!==void 0)return n}if(e.children){const n=function(s){for(let a=0;a<s.length;a++){const o=s[a];if(o.name===t||o.uuid===t)return o;const l=n(o.children);if(l)return l}return null},i=n(e.children);if(i)return i}return null}_getValue_unavailable(){}_setValue_unavailable(){}_getValue_direct(e,t){e[t]=this.targetObject[this.propertyName]}_getValue_array(e,t){const n=this.resolvedProperty;for(let i=0,s=n.length;i!==s;++i)e[t++]=n[i]}_getValue_arrayElement(e,t){e[t]=this.resolvedProperty[this.propertyIndex]}_getValue_toArray(e,t){this.resolvedProperty.toArray(e,t)}_setValue_direct(e,t){this.targetObject[this.propertyName]=e[t]}_setValue_direct_setNeedsUpdate(e,t){this.targetObject[this.propertyName]=e[t],this.targetObject.needsUpdate=!0}_setValue_direct_setMatrixWorldNeedsUpdate(e,t){this.targetObject[this.propertyName]=e[t],this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_array(e,t){const n=this.resolvedProperty;for(let i=0,s=n.length;i!==s;++i)n[i]=e[t++]}_setValue_array_setNeedsUpdate(e,t){const n=this.resolvedProperty;for(let i=0,s=n.length;i!==s;++i)n[i]=e[t++];this.targetObject.needsUpdate=!0}_setValue_array_setMatrixWorldNeedsUpdate(e,t){const n=this.resolvedProperty;for(let i=0,s=n.length;i!==s;++i)n[i]=e[t++];this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_arrayElement(e,t){this.resolvedProperty[this.propertyIndex]=e[t]}_setValue_arrayElement_setNeedsUpdate(e,t){this.resolvedProperty[this.propertyIndex]=e[t],this.targetObject.needsUpdate=!0}_setValue_arrayElement_setMatrixWorldNeedsUpdate(e,t){this.resolvedProperty[this.propertyIndex]=e[t],this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_fromArray(e,t){this.resolvedProperty.fromArray(e,t)}_setValue_fromArray_setNeedsUpdate(e,t){this.resolvedProperty.fromArray(e,t),this.targetObject.needsUpdate=!0}_setValue_fromArray_setMatrixWorldNeedsUpdate(e,t){this.resolvedProperty.fromArray(e,t),this.targetObject.matrixWorldNeedsUpdate=!0}_getValue_unbound(e,t){this.bind(),this.getValue(e,t)}_setValue_unbound(e,t){this.bind(),this.setValue(e,t)}bind(){let e=this.node;const t=this.parsedPath,n=t.objectName,i=t.propertyName;let s=t.propertyIndex;if(e||(e=tt.findNode(this.rootNode,t.nodeName),this.node=e),this.getValue=this._getValue_unavailable,this.setValue=this._setValue_unavailable,!e){de("PropertyBinding: No target node found for track: "+this.path+".");return}if(n){let c=t.objectIndex;switch(n){case"materials":if(!e.material){Le("PropertyBinding: Can not bind to material as node does not have a material.",this);return}if(!e.material.materials){Le("PropertyBinding: Can not bind to material.materials as node.material does not have a materials array.",this);return}e=e.material.materials;break;case"bones":if(!e.skeleton){Le("PropertyBinding: Can not bind to bones as node does not have a skeleton.",this);return}e=e.skeleton.bones;for(let h=0;h<e.length;h++)if(e[h].name===c){c=h;break}break;case"map":if("map"in e){e=e.map;break}if(!e.material){Le("PropertyBinding: Can not bind to material as node does not have a material.",this);return}if(!e.material.map){Le("PropertyBinding: Can not bind to material.map as node.material does not have a map.",this);return}e=e.material.map;break;default:if(e[n]===void 0){Le("PropertyBinding: Can not bind to objectName of node undefined.",this);return}e=e[n]}if(c!==void 0){if(e[c]===void 0){Le("PropertyBinding: Trying to bind to objectIndex of objectName, but is undefined.",this,e);return}e=e[c]}}const a=e[i];if(a===void 0){const c=t.nodeName;Le("PropertyBinding: Trying to update property for track: "+c+"."+i+" but it wasn't found.",e);return}let o=this.Versioning.None;this.targetObject=e,e.isMaterial===!0?o=this.Versioning.NeedsUpdate:e.isObject3D===!0&&(o=this.Versioning.MatrixWorldNeedsUpdate);let l=this.BindingType.Direct;if(s!==void 0){if(i==="morphTargetInfluences"){if(!e.geometry){Le("PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.",this);return}if(!e.geometry.morphAttributes){Le("PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.morphAttributes.",this);return}e.morphTargetDictionary[s]!==void 0&&(s=e.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}}tt.Composite=bm;tt.prototype.BindingType={Direct:0,EntireArray:1,ArrayElement:2,HasFromToArray:3};tt.prototype.Versioning={None:0,NeedsUpdate:1,MatrixWorldNeedsUpdate:2};tt.prototype.GetterByBindingType=[tt.prototype._getValue_direct,tt.prototype._getValue_array,tt.prototype._getValue_arrayElement,tt.prototype._getValue_toArray];tt.prototype.SetterByBindingTypeAndVersioning=[[tt.prototype._setValue_direct,tt.prototype._setValue_direct_setNeedsUpdate,tt.prototype._setValue_direct_setMatrixWorldNeedsUpdate],[tt.prototype._setValue_array,tt.prototype._setValue_array_setNeedsUpdate,tt.prototype._setValue_array_setMatrixWorldNeedsUpdate],[tt.prototype._setValue_arrayElement,tt.prototype._setValue_arrayElement_setNeedsUpdate,tt.prototype._setValue_arrayElement_setMatrixWorldNeedsUpdate],[tt.prototype._setValue_fromArray,tt.prototype._setValue_fromArray_setNeedsUpdate,tt.prototype._setValue_fromArray_setMatrixWorldNeedsUpdate]];class Jy{constructor(){this.isAnimationObjectGroup=!0,this.uuid=tn(),this._objects=Array.prototype.slice.call(arguments),this.nCachedObjects_=0;const e={};this._indicesByUUID=e;for(let n=0,i=arguments.length;n!==i;++n)e[arguments[n].uuid]=n;this._paths=[],this._parsedPaths=[],this._bindings=[],this._bindingsIndicesByPath={};const t=this;this.stats={objects:{get total(){return t._objects.length},get inUse(){return this.total-t.nCachedObjects_}},get bindingsPerObject(){return t._bindings.length}}}add(){const e=this._objects,t=this._indicesByUUID,n=this._paths,i=this._parsedPaths,s=this._bindings,a=s.length;let o,l=e.length,c=this.nCachedObjects_;for(let h=0,u=arguments.length;h!==u;++h){const d=arguments[h],f=d.uuid;let m=t[f];if(m===void 0){m=l++,t[f]=m,e.push(d);for(let _=0,g=a;_!==g;++_)s[_].push(new tt(d,n[_],i[_]))}else if(m<c){o=e[m];const _=--c,g=e[_];t[g.uuid]=m,e[m]=g,t[f]=_,e[_]=d;for(let p=0,v=a;p!==v;++p){const x=s[p],M=x[_];let T=x[m];x[m]=M,T===void 0&&(T=new tt(d,n[p],i[p])),x[_]=T}}else e[m]!==o&&Le("AnimationObjectGroup: Different objects with the same UUID detected. Clean the caches or recreate your infrastructure when reloading scenes.")}this.nCachedObjects_=c}remove(){const e=this._objects,t=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=t[c];if(h!==void 0&&h>=s){const u=s++,d=e[u];t[d.uuid]=h,e[h]=d,t[c]=u,e[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 e=this._objects,t=this._indicesByUUID,n=this._bindings,i=n.length;let s=this.nCachedObjects_,a=e.length;for(let o=0,l=arguments.length;o!==l;++o){const c=arguments[o],h=c.uuid,u=t[h];if(u!==void 0)if(delete t[h],u<s){const d=--s,f=e[d],m=--a,_=e[m];t[f.uuid]=u,e[u]=f,t[_.uuid]=d,e[d]=_,e.pop();for(let g=0,p=i;g!==p;++g){const v=n[g],x=v[d],M=v[m];v[u]=x,v[d]=M,v.pop()}}else{const d=--a,f=e[d];d>0&&(t[f.uuid]=u),e[u]=f,e.pop();for(let m=0,_=i;m!==_;++m){const g=n[m];g[u]=g[d],g.pop()}}}this.nCachedObjects_=s}subscribe_(e,t){const n=this._bindingsIndicesByPath;let i=n[e];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[e]=i,a.push(e),o.push(t),s.push(u);for(let d=h,f=l.length;d!==f;++d){const m=l[d];u[d]=new tt(m,e,t)}return u}unsubscribe_(e){const t=this._bindingsIndicesByPath,n=t[e];if(n!==void 0){const i=this._paths,s=this._parsedPaths,a=this._bindings,o=a.length-1,l=a[o],c=e[o];t[c]=n,a[n]=l,a.pop(),s[n]=s[o],s.pop(),i[n]=i[o],i.pop()}}}class Am{constructor(e,t,n=null,i=t.blendMode){this._mixer=e,this._clip=t,this._localRoot=n,this.blendMode=i;const s=t.tracks,a=s.length,o=new Array(a),l={endingStart:es,endingEnd:es};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(e){return this._startTime=e,this}setLoop(e,t){return this.loop=e,this.repetitions=t,this}setEffectiveWeight(e){return this.weight=e,this._effectiveWeight=this.enabled?e:0,this.stopFading()}getEffectiveWeight(){return this._effectiveWeight}fadeIn(e){return this._scheduleFading(e,0,1)}fadeOut(e){return this._scheduleFading(e,1,0)}crossFadeFrom(e,t,n=!1){if(e.fadeOut(t),this.fadeIn(t),n===!0){const i=this._clip.duration,s=e._clip.duration,a=s/i,o=i/s;e.warp(1,a,t),this.warp(o,1,t)}return this}crossFadeTo(e,t,n=!1){return e.crossFadeFrom(this,t,n)}stopFading(){const e=this._weightInterpolant;return e!==null&&(this._weightInterpolant=null,this._mixer._takeBackControlInterpolant(e)),this}setEffectiveTimeScale(e){return this.timeScale=e,this._effectiveTimeScale=this.paused?0:e,this.stopWarping()}getEffectiveTimeScale(){return this._effectiveTimeScale}setDuration(e){return this.timeScale=this._clip.duration/e,this.stopWarping()}syncWith(e){return this.time=e.time,this.timeScale=e.timeScale,this.stopWarping()}halt(e){return this.warp(this._effectiveTimeScale,0,e)}warp(e,t,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]=e/a,c[1]=t/a,this}stopWarping(){const e=this._timeScaleInterpolant;return e!==null&&(this._timeScaleInterpolant=null,this._mixer._takeBackControlInterpolant(e)),this}getMixer(){return this._mixer}getClip(){return this._clip}getRoot(){return this._localRoot||this._mixer._root}_update(e,t,n,i){if(!this.enabled){this._updateWeight(e);return}const s=this._startTime;if(s!==null){const l=(e-s)*n;l<0||n===0?t=0:(this._startTime=null,t=n*l)}t*=this._updateTimeScale(e);const a=this._updateTime(t),o=this._updateWeight(e);if(o>0){const l=this._interpolants,c=this._propertyBindings;switch(this.blendMode){case uu:for(let h=0,u=l.length;h!==u;++h)l[h].evaluate(a),c[h].accumulateAdditive(o);break;case wl:default:for(let h=0,u=l.length;h!==u;++h)l[h].evaluate(a),c[h].accumulate(i,o)}}}_updateWeight(e){let t=0;if(this.enabled){t=this.weight;const n=this._weightInterpolant;if(n!==null){const i=n.evaluate(e)[0];t*=i,e>n.parameterPositions[1]&&(this.stopFading(),i===0&&(this.enabled=!1))}}return this._effectiveWeight=t,t}_updateTimeScale(e){let t=0;if(!this.paused){t=this.timeScale;const n=this._timeScaleInterpolant;if(n!==null){const i=n.evaluate(e)[0];t*=i,e>n.parameterPositions[1]&&(this.stopWarping(),t===0?this.paused=!0:this.timeScale=t)}}return this._effectiveTimeScale=t,t}_updateTime(e){const t=this._clip.duration,n=this.loop;let i=this.time+e,s=this._loopCount;const a=n===Ld;if(e===0)return s===-1?i:a&&(s&1)===1?t-i:i;if(n===Id){s===-1&&(this._loopCount=0,this._setEndings(!0,!0,!1));e:{if(i>=t)i=t;else if(i<0)i=0;else{this.time=i;break e}this.clampWhenFinished?this.paused=!0:this.enabled=!1,this.time=i,this._mixer.dispatchEvent({type:"finished",action:this,direction:e<0?-1:1})}}else{if(s===-1&&(e>=0?(s=0,this._setEndings(!0,this.repetitions===0,a)):this._setEndings(this.repetitions===0,!0,a)),i>=t||i<0){const o=Math.floor(i/t);i-=t*o,s+=Math.abs(o);const l=this.repetitions-s;if(l<=0)this.clampWhenFinished?this.paused=!0:this.enabled=!1,i=e>0?t:0,this.time=i,this._mixer.dispatchEvent({type:"finished",action:this,direction:e>0?1:-1});else{if(l===1){const c=e<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 t-i}return i}_setEndings(e,t,n){const i=this._interpolantSettings;n?(i.endingStart=ts,i.endingEnd=ts):(e?i.endingStart=this.zeroSlopeAtStart?ts:es:i.endingStart=sa,t?i.endingEnd=this.zeroSlopeAtEnd?ts:es:i.endingEnd=sa)}_scheduleFading(e,t,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]=t,o[1]=s+e,l[1]=n,this}}const Tm=new Float32Array(1);class $y extends kn{constructor(e){super(),this._root=e,this._initMemoryManager(),this._accuIndex=0,this.time=0,this.timeScale=1}_bindAction(e,t){const n=e._localRoot||this._root,i=e._clip.tracks,s=i.length,a=e._propertyBindings,o=e._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 _=t&&t._propertyBindings[u].binding.parsedPath;m=new pm(tt.create(n,f,_),d.ValueTypeName,d.getValueSize()),++m.referenceCount,this._addInactiveBinding(m,l,f),a[u]=m}o[u].resultBuffer=m.buffer}}_activateAction(e){if(!this._isActiveAction(e)){if(e._cacheIndex===null){const n=(e._localRoot||this._root).uuid,i=e._clip.uuid,s=this._actionsByClip[i];this._bindAction(e,s&&s.knownActions[0]),this._addInactiveAction(e,i,n)}const t=e._propertyBindings;for(let n=0,i=t.length;n!==i;++n){const s=t[n];s.useCount++===0&&(this._lendBinding(s),s.saveOriginalState())}this._lendAction(e)}}_deactivateAction(e){if(this._isActiveAction(e)){const t=e._propertyBindings;for(let n=0,i=t.length;n!==i;++n){const s=t[n];--s.useCount===0&&(s.restoreOriginalState(),this._takeBackBinding(s))}this._takeBackAction(e)}}_initMemoryManager(){this._actions=[],this._nActiveActions=0,this._actionsByClip={},this._bindings=[],this._nActiveBindings=0,this._bindingsByRootAndName={},this._controlInterpolants=[],this._nActiveControlInterpolants=0;const e=this;this.stats={actions:{get total(){return e._actions.length},get inUse(){return e._nActiveActions}},bindings:{get total(){return e._bindings.length},get inUse(){return e._nActiveBindings}},controlInterpolants:{get total(){return e._controlInterpolants.length},get inUse(){return e._nActiveControlInterpolants}}}}_isActiveAction(e){const t=e._cacheIndex;return t!==null&&t<this._nActiveActions}_addInactiveAction(e,t,n){const i=this._actions,s=this._actionsByClip;let a=s[t];if(a===void 0)a={knownActions:[e],actionByRoot:{}},e._byClipCacheIndex=0,s[t]=a;else{const o=a.knownActions;e._byClipCacheIndex=o.length,o.push(e)}e._cacheIndex=i.length,i.push(e),a.actionByRoot[n]=e}_removeInactiveAction(e){const t=this._actions,n=t[t.length-1],i=e._cacheIndex;n._cacheIndex=i,t[i]=n,t.pop(),e._cacheIndex=null;const s=e._clip.uuid,a=this._actionsByClip,o=a[s],l=o.knownActions,c=l[l.length-1],h=e._byClipCacheIndex;c._byClipCacheIndex=h,l[h]=c,l.pop(),e._byClipCacheIndex=null;const u=o.actionByRoot,d=(e._localRoot||this._root).uuid;delete u[d],l.length===0&&delete a[s],this._removeInactiveBindingsForAction(e)}_removeInactiveBindingsForAction(e){const t=e._propertyBindings;for(let n=0,i=t.length;n!==i;++n){const s=t[n];--s.referenceCount===0&&this._removeInactiveBinding(s)}}_lendAction(e){const t=this._actions,n=e._cacheIndex,i=this._nActiveActions++,s=t[i];e._cacheIndex=i,t[i]=e,s._cacheIndex=n,t[n]=s}_takeBackAction(e){const t=this._actions,n=e._cacheIndex,i=--this._nActiveActions,s=t[i];e._cacheIndex=i,t[i]=e,s._cacheIndex=n,t[n]=s}_addInactiveBinding(e,t,n){const i=this._bindingsByRootAndName,s=this._bindings;let a=i[t];a===void 0&&(a={},i[t]=a),a[n]=e,e._cacheIndex=s.length,s.push(e)}_removeInactiveBinding(e){const t=this._bindings,n=e.binding,i=n.rootNode.uuid,s=n.path,a=this._bindingsByRootAndName,o=a[i],l=t[t.length-1],c=e._cacheIndex;l._cacheIndex=c,t[c]=l,t.pop(),delete o[s],Object.keys(o).length===0&&delete a[i]}_lendBinding(e){const t=this._bindings,n=e._cacheIndex,i=this._nActiveBindings++,s=t[i];e._cacheIndex=i,t[i]=e,s._cacheIndex=n,t[n]=s}_takeBackBinding(e){const t=this._bindings,n=e._cacheIndex,i=--this._nActiveBindings,s=t[i];e._cacheIndex=i,t[i]=e,s._cacheIndex=n,t[n]=s}_lendControlInterpolant(){const e=this._controlInterpolants,t=this._nActiveControlInterpolants++;let n=e[t];return n===void 0&&(n=new zu(new Float32Array(2),new Float32Array(2),1,Tm),n.__cacheIndex=t,e[t]=n),n}_takeBackControlInterpolant(e){const t=this._controlInterpolants,n=e.__cacheIndex,i=--this._nActiveControlInterpolants,s=t[i];e.__cacheIndex=i,t[i]=e,s.__cacheIndex=n,t[n]=s}clipAction(e,t,n){const i=t||this._root,s=i.uuid;let a=typeof e=="string"?fa.findByName(i,e):e;const o=a!==null?a.uuid:e,l=this._actionsByClip[o];let c=null;if(n===void 0&&(a!==null?n=a.blendMode:n=wl),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 Am(this,a,t,n);return this._bindAction(h,c),this._addInactiveAction(h,o,s),h}existingAction(e,t){const n=t||this._root,i=n.uuid,s=typeof e=="string"?fa.findByName(n,e):e,a=s?s.uuid:e,o=this._actionsByClip[a];return o!==void 0&&o.actionByRoot[i]||null}stopAllAction(){const e=this._actions,t=this._nActiveActions;for(let n=t-1;n>=0;--n)e[n].stop();return this}update(e){e*=this.timeScale;const t=this._actions,n=this._nActiveActions,i=this.time+=e,s=Math.sign(e),a=this._accuIndex^=1;for(let c=0;c!==n;++c)t[c]._update(i,e,s,a);const o=this._bindings,l=this._nActiveBindings;for(let c=0;c!==l;++c)o[c].apply(a);return this}setTime(e){this.time=0;for(let t=0;t<this._actions.length;t++)this._actions[t].time=0;return this.update(e)}getRoot(){return this._root}uncacheClip(e){const t=this._actions,n=e.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=t[t.length-1];c._cacheIndex=null,c._byClipCacheIndex=null,u._cacheIndex=h,t[h]=u,t.pop(),this._removeInactiveBindingsForAction(c)}delete i[n]}}uncacheRoot(e){const t=e.uuid,n=this._actionsByClip;for(const a in n){const o=n[a].actionByRoot,l=o[t];l!==void 0&&(this._deactivateAction(l),this._removeInactiveAction(l))}const i=this._bindingsByRootAndName,s=i[t];if(s!==void 0)for(const a in s){const o=s[a];o.restoreOriginalState(),this._removeInactiveBinding(o)}}uncacheAction(e,t){const n=this.existingAction(e,t);n!==null&&(this._deactivateAction(n),this._removeInactiveAction(n))}}class Ky extends pu{constructor(e=1,t=1,n=1,i={}){super(e,t,i),this.isRenderTarget3D=!0,this.depth=n,this.texture=new Ll(null,e,t,n),this._setTextureOptions(i),this.texture.isRenderTargetTexture=!0}}class Wu{constructor(e){this.value=e}clone(){return new Wu(this.value.clone===void 0?this.value:this.value.clone())}}let Em=0;class Qy extends kn{constructor(){super(),this.isUniformsGroup=!0,Object.defineProperty(this,"id",{value:Em++}),this.name="",this.usage=aa,this.uniforms=[]}add(e){return this.uniforms.push(e),this}remove(e){const t=this.uniforms.indexOf(e);return t!==-1&&this.uniforms.splice(t,1),this}setName(e){return this.name=e,this}setUsage(e){return this.usage=e,this}dispose(){this.dispatchEvent({type:"dispose"})}copy(e){this.name=e.name,this.usage=e.usage;const t=e.uniforms;this.uniforms.length=0;for(let n=0,i=t.length;n<i;n++){const s=Array.isArray(t[n])?t[n]:[t[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 jy extends Ol{constructor(e,t,n=1){super(e,t),this.isInstancedInterleavedBuffer=!0,this.meshPerAttribute=n}copy(e){return super.copy(e),this.meshPerAttribute=e.meshPerAttribute,this}clone(e){const t=super.clone(e);return t.meshPerAttribute=this.meshPerAttribute,t}toJSON(e){const t=super.toJSON(e);return t.isInstancedInterleavedBuffer=!0,t.meshPerAttribute=this.meshPerAttribute,t}}class eM{constructor(e,t,n,i,s,a=!1){this.isGLBufferAttribute=!0,this.name="",this.buffer=e,this.type=t,this.itemSize=n,this.elementSize=i,this.count=s,this.normalized=a,this.version=0}set needsUpdate(e){e===!0&&this.version++}setBuffer(e){return this.buffer=e,this}setType(e,t){return this.type=e,this.elementSize=t,this}setItemSize(e){return this.itemSize=e,this}setCount(e){return this.count=e,this}}const xh=new Ge;class tM{constructor(e,t,n=0,i=1/0){this.ray=new Ks(e,t),this.near=n,this.far=i,this.camera=null,this.layers=new Dl,this.params={Mesh:{},Line:{threshold:1},LOD:{},Points:{threshold:1},Sprite:{}}}set(e,t){this.ray.set(e,t)}setFromCamera(e,t){t.isPerspectiveCamera?(this.ray.origin.setFromMatrixPosition(t.matrixWorld),this.ray.direction.set(e.x,e.y,.5).unproject(t).sub(this.ray.origin).normalize(),this.camera=t):t.isOrthographicCamera?(this.ray.origin.set(e.x,e.y,(t.near+t.far)/(t.near-t.far)).unproject(t),this.ray.direction.set(0,0,-1).transformDirection(t.matrixWorld),this.camera=t):Le("Raycaster: 
44Unsupported camera type: "+t.type)}setFromXRController(e){return xh.identity().extractRotation(e.matrixWorld),this.ray.origin.setFromMatrixPosition(e.matrixWorld),this.ray.direction.set(0,0,-1).applyMatrix4(xh),this}intersectObject(e,t=!0,n=[]){return ml(e,this,n,t),n.sort(vh),n}intersectObjects(e,t=!0,n=[]){for(let i=0,s=e.length;i<s;i++)ml(e[i],this,n,t);return n.sort(vh),n}}function vh(r,e){return r.distance-e.distance}function ml(r,e,t,n){let i=!0;if(r.layers.test(e.layers)&&r.raycast(e,t)===!1&&(i=!1),i===!0&&n===!0){const s=r.children;for(let a=0,o=s.length;a<o;a++)ml(s[a],e,t,!0)}}class nM{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(e){this._document=e,e.hidden!==void 0&&(this._pageVisibilityHandler=wm.bind(this),e.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(e){return this._timescale=e,this}reset(){return this._currentTime=performance.now()-this._startTime,this}dispose(){this.disconnect()}update(e){return this._pageVisibilityHandler!==null&&this._document.hidden===!0?this._delta=0:(this._previousTime=this._currentTime,this._currentTime=(e!==void 0?e:performance.now())-this._startTime,this._delta=(this._currentTime-this._previousTime)*this._timescale,this._elapsed+=this._delta),this}}function wm(){this._document.hidden===!1&&this.reset()}class iM{constructor(e=1,t=0,n=0){this.radius=e,this.phi=t,this.theta=n}set(e,t,n){return this.radius=e,this.phi=t,this.theta=n,this}copy(e){return this.radius=e.radius,this.phi=e.phi,this.theta=e.theta,this}makeSafe(){return this.phi=ze(this.phi,1e-6,Math.PI-1e-6),this}setFromVector3(e){return this.setFromCartesianCoords(e.x,e.y,e.z)}setFromCartesianCoords(e,t,n){return this.radius=Math.sqrt(e*e+t*t+n*n),this.radius===0?(this.theta=0,this.phi=0):(this.theta=Math.atan2(e,n),this.phi=Math.acos(ze(t/this.radius,-1,1))),this}clone(){return new this.constructor().copy(this)}}class sM{constructor(e=1,t=0,n=0){this.radius=e,this.theta=t,this.y=n}set(e,t,n){return this.radius=e,this.theta=t,this.y=n,this}copy(e){return this.radius=e.radius,this.theta=e.theta,this.y=e.y,this}setFromVector3(e){return this.setFromCartesianCoords(e.x,e.y,e.z)}setFromCartesianCoords(e,t,n){return this.radius=Math.sqrt(e*e+n*n),this.theta=Math.atan2(e,n),this.y=t,this}clone(){return new this.constructor().copy(this)}}class Xu{constructor(e,t,n,i){Xu.prototype.isMatrix2=!0,this.elements=[1,0,0,1],e!==void 0&&this.set(e,t,n,i)}identity(){return this.set(1,0,0,1),this}fromArray(e,t=0){for(let n=0;n<4;n++)this.elements[n]=e[n+t];return this}set(e,t,n,i){const s=this.elements;return s[0]=e,s[2]=t,s[1]=n,s[3]=i,this}}const yh=new K;class rM{constructor(e=new K(1/0,1/0),t=new K(-1/0,-1/0)){this.isBox2=!0,this.min=e,this.max=t}set(e,t){return this.min.copy(e),this.max.copy(t),this}setFromPoints(e){this.makeEmpty();for(let t=0,n=e.length;t<n;t++)this.expandByPoint(e[t]);return this}setFromCenterAndSize(e,t){const n=yh.copy(t).multiplyScalar(.5);return this.min.copy(e).sub(n),this.max.copy(e).add(n),this}clone(){return new this.constructor().copy(this)}copy(e){return this.min.copy(e.min),this.max.copy(e.max),this}makeEmpty(){return this.min.x=this.min.y=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(e){return this.isEmpty()?e.set(0,0):e.addVectors(this.min,this.max).multiplyScalar(.5)}getSize(e){return this.isEmpty()?e.set(0,0):e.subVectors(this.max,this.min)}expandByPoint(e){return this.min.min(e),this.max.max(e),this}expandByVector(e){return this.min.sub(e),this.max.add(e),this}expandByScalar(e){return this.min.addScalar(-e),this.max.addScalar(e),this}containsPoint(e){return e.x>=this.min.x&&e.x<=this.max.x&&e.y>=this.min.y&&e.y<=this.max.y}containsBox(e){return this.min.x<=e.min.x&&e.max.x<=this.max.x&&this.min.y<=e.min.y&&e.max.y<=this.max.y}getParameter(e,t){return t.set((e.x-this.min.x)/(this.max.x-this.min.x),(e.y-this.min.y)/(this.max.y-this.min.y))}intersectsBox(e){return e.max.x>=this.min.x&&e.min.x<=this.max.x&&e.max.y>=this.min.y&&e.min.y<=this.max.y}clampPoint(e,t){return t.copy(e).clamp(this.min,this.max)}distanceToPoint(e){return this.clampPoint(e,yh).distanceTo(e)}intersect(e){return this.min.max(e.min),this.max.min(e.max),this.isEmpty()&&this.makeEmpty(),this}union(e){return this.min.min(e.min),this.max.max(e.max),this}translate(e){return this.min.add(e),this.max.add(e),this}equals(e){return e.min.equals(this.min)&&e.max.equals(this.max)}}const Mh=new R,Br=new R,Ki=new R,Qi=new R,fo=new R,Cm=new R,Rm=new R;class aM{constructor(e=new R,t=new R){this.start=e,this.end=t}set(e,t){return this.start.copy(e),this.end.copy(t),this}copy(e){return this.start.copy(e.start),this.end.copy(e.end),this}getCenter(e){return e.addVectors(this.start,this.end).multiplyScalar(.5)}delta(e){return e.subVectors(this.end,this.start)}distanceSq(){return this.start.distanceToSquared(this.end)}distance(){return this.start.distanceTo(this.end)}at(e,t){return this.delta(t).multiplyScalar(e).add(this.start)}
vendor: 5,702 bytes, line 44
44closestPointToPointParameter(e,t){Mh.subVectors(e,this.start),Br.subVectors(this.end,this.start);const n=Br.dot(Br);let s=Br.dot(Mh)/n;return t&&(s=ze(s,0,1)),s}closestPointToPoint(e,t,n){const i=this.closestPointToPointParameter(e,t);return this.delta(n).multiplyScalar(i).add(this.start)}distanceSqToLine3(e,t=Cm,n=Rm){const i=10000000000000001e-32;let s,a;const o=this.start,l=e.start,c=this.end,h=e.end;Ki.subVectors(c,o),Qi.subVectors(h,l),fo.subVectors(o,l);const u=Ki.dot(Ki),d=Qi.dot(Qi),f=Qi.dot(fo);if(u<=i&&d<=i)return t.copy(o),n.copy(l),t.sub(n),t.dot(t);if(u<=i)s=0,a=f/d,a=ze(a,0,1);else{const m=Ki.dot(fo);if(d<=i)a=0,s=ze(-m/u,0,1);else{const _=Ki.dot(Qi),g=u*d-_*_;g!==0?s=ze((_*f-m*d)/g,0,1):s=0,a=(_*s+f)/d,a<0?(a=0,s=ze(-m/u,0,1)):a>1&&(a=1,s=ze((_-m)/u,0,1))}}return t.copy(o).add(Ki.multiplyScalar(s)),n.copy(l).add(Qi.multiplyScalar(a)),t.sub(n),t.dot(t)}applyMatrix4(e){return this.start.applyMatrix4(e),this.end.applyMatrix4(e),this}equals(e){return e.start.equals(this.start)&&e.end.equals(this.end)}clone(){return new this.constructor().copy(this)}}const Sh=new R;class oM extends nt{constructor(e,t){super(),this.light=e,this.matrixAutoUpdate=!1,this.color=t,this.type="SpotLightHelper";const n=new qe,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 Te(i,3));const s=new qt({fog:!1,toneMapped:!1});this.cone=new Gn(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 e=this.light.distance?this.light.distance:1e3,t=e*Math.tan(this.light.angle);this.cone.scale.set(t,t,e),Sh.setFromMatrixPosition(this.light.target.matrixWorld),this.cone.lookAt(Sh),this.color!==void 0?this.cone.material.color.set(this.color):this.cone.material.color.copy(this.light.color)}}const Jn=new R,zr=new Ge,po=new Ge;class lM extends Gn{constructor(e){const t=qu(e),n=new qe,i=[],s=[];for(let c=0;c<t.length;c++){const h=t[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 Te(i,3)),n.setAttribute("color",new Te(s,3));const a=new qt({vertexColors:!0,depthTest:!1,depthWrite:!1,toneMapped:!1,transparent:!0});super(n,a),this.isSkeletonHelper=!0,this.type="SkeletonHelper",this.root=e,this.bones=t,this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1;const o=new Me(255),l=new Me(65280);this.setColors(o,l)}updateMatrixWorld(e){const t=this.bones,n=this.geometry,i=n.getAttribute("position");po.copy(this.root.matrixWorld).invert();for(let s=0,a=0;s<t.length;s++){const o=t[s];o.parent&&o.parent.isBone&&(zr.multiplyMatrices(po,o.matrixWorld),Jn.setFromMatrixPosition(zr),i.setXYZ(a,Jn.x,Jn.y,Jn.z),zr.multiplyMatrices(po,o.parent.matrixWorld),Jn.setFromMatrixPosition(zr),i.setXYZ(a+1,Jn.x,Jn.y,Jn.z),a+=2)}n.getAttribute("position").needsUpdate=!0,super.updateMatrixWorld(e)}setColors(e,t){const i=this.geometry.getAttribute("color");for(let s=0;s<i.count;s+=2)i.setXYZ(s,e.r,e.g,e.b),i.setXYZ(s+1,t.r,t.g,t.b);return i.needsUpdate=!0,this}dispose(){this.geometry.dispose(),this.material.dispose()}}function qu(r){const e=[];r.isBone===!0&&e.push(r);for(let t=0;t<r.children.length;t++)e.push(...qu(r.children[t]));return e}class cM extends At{constructor(e,t,n){const i=new Ma(t,4,2),s=new Ci({wireframe:!0,fog:!1,toneMapped:!1});super(i,s),this.light=e,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 Im=new R,bh=new Me,Ah=new Me;class hM extends nt{constructor(e,t,n){super(),this.light=e,this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1,this.color=n,this.type="HemisphereLightHelper";const i=new ya(t);i.rotateY(Math.PI*.5),this.material=new Ci({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 ut(a,3)),this.add(new At(i,this.material)),this.update()}dispose(){this.children[0].geometry.dispose(),this.children[0].material.dispose()}update(){const e=this.children[0];if(this.color!==void 0)this.material.color.set(this.color);else{const t=e.geometry.getAttribute("color");bh.copy(this.light.color),Ah.copy(this.light.groundColor);for(let n=0,i=t.count;n<i;n++){const s=n<i/2?bh:Ah;t.setXYZ(n,s.r,s.g,s.b)}t.needsUpdate=!0}this.light.updateWorldMatrix(!0,!1),e.lookAt(Im.setFromMatrixPosition(this.light.matrixWorld).negate())}}class uM extends Gn{constructor(e=10,t=10,n=4473924,i=8947848){n=new Me(n),i=new Me(i);const s=t/2,a=e/t,o=e/2,l=[],c=[];for(let d=0,f=0,m=-o;d<=t;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 qe;h.setAttribute("position",new Te(l,3)),h.setAttribute("color",new Te(c,3));const u=new qt({vertexColors:!0,toneMapped:!1});super(h,u),this.type="GridHelper"}dispose(){this.geometry.dispose(),this.material.dispose()}}class dM extends Gn{constructor(e=10,t=16,n=8,i=64,s=4473924,a=8947848){s=new Me(s),a=new Me(a);const o=[],l=[];
vendor: 8,015 bytes, line 44
44if(t>1)for(let u=0;u<t;u++){const d=u/t*(Math.PI*2),f=Math.sin(d)*e,m=Math.cos(d)*e;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=e-e/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 qe;c.setAttribute("position",new Te(o,3)),c.setAttribute("color",new Te(l,3));const h=new qt({vertexColors:!0,toneMapped:!1});super(c,h),this.type="PolarGridHelper"}dispose(){this.geometry.dispose(),this.material.dispose()}}const Th=new R,Vr=new R,Eh=new R;class fM extends nt{constructor(e,t,n){super(),this.light=e,this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1,this.color=n,this.type="DirectionalLightHelper",t===void 0&&(t=1);let i=new qe;i.setAttribute("position",new Te([-t,t,0,t,t,0,t,-t,0,-t,-t,0,-t,t,0],3));const s=new qt({fog:!1,toneMapped:!1});this.lightPlane=new Ti(i,s),this.add(this.lightPlane),i=new qe,i.setAttribute("position",new Te([0,0,0,0,0,1],3)),this.targetLine=new Ti(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),Th.setFromMatrixPosition(this.light.matrixWorld),Vr.setFromMatrixPosition(this.light.target.matrixWorld),Eh.subVectors(Vr,Th),this.lightPlane.lookAt(Vr),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(Vr),this.targetLine.scale.z=Eh.length()}}const kr=new R,vt=new Ul;class pM extends Gn{constructor(e){const t=new qe,n=new qt({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)}t.setAttribute("position",new Te(i,3)),t.setAttribute("color",new Te(s,3)),super(t,n),this.type="CameraHelper",this.camera=e,this.camera.updateProjectionMatrix&&this.camera.updateProjectionMatrix(),this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1,this.pointMap=a,this.update();const c=new Me(16755200),h=new Me(16711680),u=new Me(43775),d=new Me(16777215),f=new Me(3355443);this.setColors(c,h,u,d,f)}setColors(e,t,n,i,s){const o=this.geometry.getAttribute("color");return o.setXYZ(0,e.r,e.g,e.b),o.setXYZ(1,e.r,e.g,e.b),o.setXYZ(2,e.r,e.g,e.b),o.setXYZ(3,e.r,e.g,e.b),o.setXYZ(4,e.r,e.g,e.b),o.setXYZ(5,e.r,e.g,e.b),o.setXYZ(6,e.r,e.g,e.b),o.setXYZ(7,e.r,e.g,e.b),o.setXYZ(8,e.r,e.g,e.b),o.setXYZ(9,e.r,e.g,e.b),o.setXYZ(10,e.r,e.g,e.b),o.setXYZ(11,e.r,e.g,e.b),o.setXYZ(12,e.r,e.g,e.b),o.setXYZ(13,e.r,e.g,e.b),o.setXYZ(14,e.r,e.g,e.b),o.setXYZ(15,e.r,e.g,e.b),o.setXYZ(16,e.r,e.g,e.b),o.setXYZ(17,e.r,e.g,e.b),o.setXYZ(18,e.r,e.g,e.b),o.setXYZ(19,e.r,e.g,e.b),o.setXYZ(20,e.r,e.g,e.b),o.setXYZ(21,e.r,e.g,e.b),o.setXYZ(22,e.r,e.g,e.b),o.setXYZ(23,e.r,e.g,e.b),o.setXYZ(24,t.r,t.g,t.b),o.setXYZ(25,t.r,t.g,t.b),o.setXYZ(26,t.r,t.g,t.b),o.setXYZ(27,t.r,t.g,t.b),o.setXYZ(28,t.r,t.g,t.b),o.setXYZ(29,t.r,t.g,t.b),o.setXYZ(30,t.r,t.g,t.b),o.setXYZ(31,t.r,t.g,t.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 e=this.geometry,t=this.pointMap,n=1,i=1;let s,a;if(vt.projectionMatrixInverse.copy(this.camera.projectionMatrixInverse),this.camera.reversedDepth===!0)s=1,a=0;else if(this.camera.coordinateSystem===on)s=-1,a=1;else if(this.camera.coordinateSystem===Gs)s=0,a=1;else throw new Error("THREE.CameraHelper.update(): Invalid coordinate system: "+this.camera.coordinateSystem);yt("c",t,e,vt,0,0,s),yt("t",t,e,vt,0,0,a),yt("n1",t,e,vt,-n,-i,s),yt("n2",t,e,vt,n,-i,s),yt("n3",t,e,vt,-n,i,s),yt("n4",t,e,vt,n,i,s),yt("f1",t,e,vt,-n,-i,a),yt("f2",t,e,vt,n,-i,a),yt("f3",t,e,vt,-n,i,a),yt("f4",t,e,vt,n,i,a),yt("u1",t,e,vt,n*.7,i*1.1,s),yt("u2",t,e,vt,-n*.7,i*1.1,s),yt("u3",t,e,vt,0,i*2,s),yt("cf1",t,e,vt,-n,0,a),yt("cf2",t,e,vt,n,0,a),yt("cf3",t,e,vt,0,-i,a),yt("cf4",t,e,vt,0,i,a),yt("cn1",t,e,vt,-n,0,s),yt("cn2",t,e,vt,n,0,s),yt("cn3",t,e,vt,0,-i,s),yt("cn4",t,e,vt,0,i,s),e.getAttribute("position").needsUpdate=!0}dispose(){this.geometry.dispose(),this.material.dispose()}}function yt(r,e,t,n,i,s,a){kr.set(i,s,a).unproject(n);const o=e[r];if(o!==void 0){const l=t.getAttribute("position");for(let c=0,h=o.length;c<h;c++)l.setXYZ(o[c],kr.x,kr.y,kr.z)}}const Gr=new Ot;class mM extends Gn{constructor(e,t=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(8*3),s=new qe;s.setIndex(new ut(n,1)),s.setAttribute("position",new ut(i,3)),super(s,new qt({color:t,toneMapped:!1})),this.object=e,this.type="BoxHelper",this.matrixAutoUpdate=!1,this.update()}update(){if(this.object!==void 0&&Gr.setFromObject(this.object),Gr.isEmpty())return;const e=Gr.min,t=Gr.max,n=this.geometry.attributes.position,i=n.array;i[0]=t.x,i[1]=t.y,i[2]=t.z,i[3]=e.x,i[4]=t.y,i[5]=t.z,i[6]=e.x,i[7]=e.y,i[8]=t.z,i[9]=t.x,i[10]=e.y,i[11]=t.z,i[12]=t.x,i[13]=t.y,i[14]=e.z,i[15]=e.x,i[16]=t.y,i[17]=e.z,i[18]=e.x,i[19]=e.y,i[20]=e.z,i[21]=t.x,i[22]=e.y,i[23]=e.z,n.needsUpdate=!0,this.geometry.computeBoundingSphere()}setFromObject(e){return this.object=e,this.update(),this}copy(e,t){return super.copy(e,t),this.object=e.object,this}dispose(){this.geometry.dispose(),this.material.dispose()}}class gM extends Gn{constructor(e,t=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 qe;s.setIndex(new ut(n,1)),s.setAttribute("position",new Te(i,3)),super(s,new qt({color:t,toneMapped:!1})),this.box=e,this.type="Box3Helper",this.geometry.computeBoundingSphere()}updateMatrixWorld(e){const t=this.box;t.isEmpty()||(t.getCenter(this.position),t.getSize(this.scale),this.scale.multiplyScalar(.5),super.updateMatrixWorld(e))}dispose(){this.geometry.dispose(),this.material.dispose()}}class _M extends Ti{constructor(e,t=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 qe;a.setAttribute("position",new Te(s,3)),a.computeBoundingSphere(),super(a,new qt({color:i,toneMapped:!1})),this.type="PlaneHelper",this.plane=e,this.size=t;const o=[1,1,0,-1,1,0,-1,-1,0,1,1,0,-1,-1,0,1,-1,0],l=new qe;l.setAttribute("position",new Te(o,3)),l.computeBoundingSphere(),this.add(new At(l,new Ci({color:i,opacity:.2,transparent:!0,depthWrite:!1,toneMapped:!1})))}updateMatrixWorld(e){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(e)}dispose(){this.geometry.dispose(),this.material.dispose(),this.children[0].geometry.dispose(),this.children[0].material.dispose()}}const wh=new R;let Hr,mo;class xM extends nt{constructor(e=new R(0,0,1),t=new R(0,0,0),n=1,i=16776960,s=n*.2,a=s*.2){super(),this.type="ArrowHelper",Hr===void 0&&(Hr=new qe,Hr.setAttribute("position",new Te([0,0,0,0,1,0],3)),mo=new va(.5,1,5,1),mo.translate(0,-.5,0)),this.position.copy(t),this.line=new Ti(Hr,
vendor: 11,477 bytes, lines 44-107
44new qt({color:i,toneMapped:!1})),this.line.matrixAutoUpdate=!1,this.add(this.line),this.cone=new At(mo,new Ci({color:i,toneMapped:!1})),this.cone.matrixAutoUpdate=!1,this.add(this.cone),this.setDirection(e),this.setLength(n,s,a)}setDirection(e){if(e.y>.99999)this.quaternion.set(0,0,0,1);else if(e.y<-.99999)this.quaternion.set(1,0,0,0);else{wh.set(e.z,0,-e.x).normalize();const t=Math.acos(e.y);this.quaternion.setFromAxisAngle(wh,t)}}setLength(e,t=e*.2,n=t*.2){this.line.scale.set(1,Math.max(1e-4,e-t),1),this.line.updateMatrix(),this.cone.scale.set(n,t,n),this.cone.position.y=e,this.cone.updateMatrix()}setColor(e){this.line.material.color.set(e),this.cone.material.color.set(e)}copy(e){return super.copy(e,!1),this.line.copy(e.line),this.cone.copy(e.cone),this}dispose(){this.line.geometry.dispose(),this.line.material.dispose(),this.cone.geometry.dispose(),this.cone.material.dispose()}}class vM extends Gn{constructor(e=1){const t=[0,0,0,e,0,0,0,0,0,0,e,0,0,0,0,0,0,e],n=[1,0,0,1,.6,0,0,1,0,.6,1,0,0,0,1,0,.6,1],i=new qe;i.setAttribute("position",new Te(t,3)),i.setAttribute("color",new Te(n,3));const s=new qt({vertexColors:!0,toneMapped:!1});super(i,s),this.type="AxesHelper"}setColors(e,t,n){const i=new Me,s=this.geometry.attributes.color.array;return i.set(e),i.toArray(s,0),i.toArray(s,3),i.set(t),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 yM{constructor(){this.type="ShapePath",this.color=new Me,this.subPaths=[],this.currentPath=null}moveTo(e,t){return this.currentPath=new ul,this.subPaths.push(this.currentPath),this.currentPath.moveTo(e,t),this}lineTo(e,t){return this.currentPath.lineTo(e,t),this}quadraticCurveTo(e,t,n,i){return this.currentPath.quadraticCurveTo(e,t,n,i),this}bezierCurveTo(e,t,n,i,s,a){return this.currentPath.bezierCurveTo(e,t,n,i,s,a),this}splineThru(e){return this.currentPath.splineThru(e),this}toShapes(e){function t(p){const v=[];for(let x=0,M=p.length;x<M;x++){const T=p[x],E=new rs;E.curves=T.curves,v.push(E)}return v}function n(p,v){const x=v.length;let M=!1;for(let T=x-1,E=0;E<x;T=E++){let C=v[T],P=v[E],S=P.x-C.x,b=P.y-C.y;if(Math.abs(b)>Number.EPSILON){if(b<0&&(C=v[E],S=-S,P=v[T],b=-b),p.y<C.y||p.y>P.y)continue;if(p.y===C.y){if(p.x===C.x)return!0}else{const L=b*(p.x-C.x)-S*(p.y-C.y);if(L===0)return!0;if(L<0)continue;M=!M}}else{if(p.y!==C.y)continue;if(P.x<=p.x&&p.x<=C.x||C.x<=p.x&&p.x<=P.x)return!0}}return M}const i=Mn.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 rs,l.curves=o.curves,c.push(l),c;let h=!i(s[0].getPoints());h=e?!h:h;const u=[],d=[];let f=[],m=0,_;d[m]=void 0,f[m]=[];for(let p=0,v=s.length;p<v;p++)o=s[p],_=o.getPoints(),a=i(_),a=e?!a:a,a?(!h&&d[m]&&m++,d[m]={s:new rs,p:_},d[m].s.curves=o.curves,h&&m++,f[m]=[]):f[m].push({h:o,p:_[0]});if(!d[0])return t(s);if(d.length>1){let p=!1,v=0;for(let x=0,M=d.length;x<M;x++)u[x]=[];for(let x=0,M=d.length;x<M;x++){const T=f[x];for(let E=0;E<T.length;E++){const C=T[E];let P=!0;for(let S=0;S<d.length;S++)n(C.p,d[S].p)&&(x!==S&&v++,P?(P=!1,u[S].push(C)):p=!0);P&&u[x].push(C)}}v>0&&p===!1&&(f=u)}let g;for(let p=0,v=d.length;p<v;p++){l=d[p].s,c.push(l),g=f[p];for(let x=0,M=g.length;x<M;x++)l.holes.push(g[x].h)}return c}}class MM extends kn{constructor(e,t=null){super(),this.object=e,this.domElement=t,this.enabled=!0,this.state=-1,this.keys={},this.mouseButtons={LEFT:null,MIDDLE:null,RIGHT:null},this.touches={ONE:null,TWO:null}}connect(e){if(e===void 0){de("Controls: connect() now requires an element.");return}this.domElement!==null&&this.disconnect(),this.domElement=e}disconnect(){}dispose(){}update(){}}function Pm(r,e){const t=r.image&&r.image.width?r.image.width/r.image.height:1;return t>e?(r.repeat.x=1,r.repeat.y=t/e,r.offset.x=0,r.offset.y=(1-r.repeat.y)/2):(r.repeat.x=e/t,r.repeat.y=1,r.offset.x=(1-r.repeat.x)/2,r.offset.y=0),r}function Lm(r,e){const t=r.image&&r.image.width?r.image.width/r.image.height:1;return t>e?(r.repeat.x=e/t,r.repeat.y=1,r.offset.x=(1-r.repeat.x)/2,r.offset.y=0):(r.repeat.x=1,r.repeat.y=t/e,r.offset.x=0,r.offset.y=(1-r.repeat.y)/2),r}function Dm(r){return r.repeat.x=1,r.repeat.y=1,r.offset.x=0,r.offset.y=0,r}function gl(r,e,t,n){const i=Um(n);switch(t){case cu:return r*e;case Al:return r*e/i.components*i.byteLength;case ga:return r*e/i.components*i.byteLength;case os:return r*e*2/i.components*i.byteLength;case Tl:return r*e*2/i.components*i.byteLength;case hu:return r*e*3/i.components*i.byteLength;case Wt:return r*e*4/i.components*i.byteLength;case El:return r*e*4/i.components*i.byteLength;case Zr:case Jr:return Math.floor((r+3)/4)*Math.floor((e+3)/4)*8;case $r:case Kr:return Math.floor((r+3)/4)*Math.floor((e+3)/4)*16;case Lo:case Uo:return Math.max(r,16)*Math.max(e,8)/4;case Po:case Do:return Math.max(r,8)*Math.max(e,8)/2;case No:case Fo:case Bo:case zo:return Math.floor((r+3)/4)*Math.floor((e+3)/4)*8;case Oo:case Vo:case ko:return Math.floor((r+3)/4)*Math.floor((e+3)/4)*16;case Go:return Math.floor((r+3)/4)*Math.floor((e+3)/4)*16;case Ho:return Math.floor((r+4)/5)*Math.floor((e+3)/4)*16;case Wo:return Math.floor((r+4)/5)*Math.floor((e+4)/5)*16;case Xo:return Math.floor((r+5)/6)*Math.floor((e+4)/5)*16;case qo:return Math.floor((r+5)/6)*Math.floor((e+5)/6)*16;case Yo:return Math.floor((r+7)/8)*Math.floor((e+4)/5)*16;case Zo:return Math.floor((r+7)/8)*Math.floor((e+5)/6)*16;case Jo:return Math.floor((r+7)/8)*Math.floor((e+7)/8)*16;case $o:return Math.floor((r+9)/10)*Math.floor((e+4)/5)*16;case Ko:return Math.floor((r+9)/10)*Math.floor((e+5)/6)*16;case Qo:return Math.floor((r+9)/10)*Math.floor((e+7)/8)*16;case jo:return Math.floor((r+9)/10)*Math.floor((e+9)/10)*16;case el:return Math.floor((r+11)/12)*Math.floor((e+9)/10)*16;case tl:return Math.floor((r+11)/12)*Math.floor((e+11)/12)*16;case nl:case il:case sl:return Math.ceil(r/4)*Math.ceil(e/4)*16;case rl:case al:return Math.ceil(r/4)*Math.ceil(e/4)*8;case ol:case ll:return Math.ceil(r/4)*Math.ceil(e/4)*16}throw new Error(`Unable to determine texture byte length for ${t} format.`)}function Um(r){switch(r){case Qt:case ru:return{byteLength:1,components:1};case Vs:case au:case zn:return{byteLength:2,components:1};case Sl:case bl:return{byteLength:2,components:4};case fn:case Ml:case Ht:return{byteLength:4,components:1};case ou:case lu:return{byteLength:4,components:3}}throw new Error(`Unknown texture type ${r}.`)}class SM{static contain(e,t){return Pm(e,t)}static cover(e,t){return Lm(e,t)}static fill(e){return Dm(e)}static getByteLength(e,t,n,i){return gl(e,t,n,i)}}typeof __THREE_DEVTOOLS__!="undefined"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("register",{detail:{revision:vl}}));typeof window!="undefined"&&(window.__THREE__?de("WARNING: Multiple instances of Three.js being imported."):window.__THREE__=vl);/**
45 * @license
46 * Copyright 2010-2025 Three.js Authors
47 * SPDX-License-Identifier: MIT
48 */function Yu(){let r=null,e=!1,t=null,n=null;function i(s,a){t(s,a),n=r.requestAnimationFrame(i)}return{start:function(){e!==!0&&t!==null&&(n=r.requestAnimationFrame(i),e=!0)},stop:function(){r.cancelAnimationFrame(n),e=!1},setAnimationLoop:function(s){t=s},setContext:function(s){r=s}}}function Nm(r){const e=new WeakMap;function t(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!="undefined"&&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),e.get(o)}function s(o){o.isInterleavedBufferAttribute&&(o=o.data);const l=e.get(o);l&&(r.deleteBuffer(l.buffer),e.delete(o))}function a(o,l){if(o.isInterleavedBufferAttribute&&(o=o.data),o.isGLBufferAttribute){const h=e.get(o);(!h||h.version<o.version)&&e.set(o,{buffer:o.buffer,type:o.type,bytesPerElement:o.elementSize,version:o.version});return}const c=e.get(o);if(c===void 0)e.set(o,t(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 Fm=`#ifdef USE_ALPHAHASH
49	if ( diffuseColor.a < getAlphaHashThreshold( vPosition ) ) discard;
50#endif`,Om=`#ifdef USE_ALPHAHASH
51	const float ALPHA_HASH_SCALE = 0.05;
52	float hash2D( vec2 value ) {
53		return fract( 1.0e4 * sin( 17.0 * value.x + 0.1 * value.y ) * ( 0.1 + abs( sin( 13.0 * value.y + value.x ) ) ) );
54	}
55	float hash3D( vec3 value ) {
56		return hash2D( vec2( hash2D( value.xy ), value.z ) );
57	}
58	float getAlphaHashThreshold( vec3 position ) {
59		float maxDeriv = max(
60			length( dFdx( position.xyz ) ),
61			length( dFdy( position.xyz ) )
62		);
63		float pixScale = 1.0 / ( ALPHA_HASH_SCALE * maxDeriv );
64		vec2 pixScales = vec2(
65			exp2( floor( log2( pixScale ) ) ),
66			exp2( ceil( log2( pixScale ) ) )
67		);
68		vec2 alpha = vec2(
69			hash3D( floor( pixScales.x * position.xyz ) ),
70			hash3D( floor( pixScales.y * position.xyz ) )
71		);
72		float lerpFactor = fract( log2( pixScale ) );
73		float x = ( 1.0 - lerpFactor ) * alpha.x + lerpFactor * alpha.y;
74		float a = min( lerpFactor, 1.0 - lerpFactor );
75		vec3 cases = vec3(
76			x * x / ( 2.0 * a * ( 1.0 - a ) ),
77			( x - 0.5 * a ) / ( 1.0 - a ),
78			1.0 - ( ( 1.0 - x ) * ( 1.0 - x ) / ( 2.0 * a * ( 1.0 - a ) ) )
79		);
80		float threshold = ( x < ( 1.0 - a ) )
81			? ( ( x < a ) ? cases.x : cases.y )
82			: cases.z;
83		return clamp( threshold , 1.0e-6, 1.0 );
84	}
85#endif`,Bm=`#ifdef USE_ALPHAMAP
86	diffuseColor.a *= texture2D( alphaMap, vAlphaMapUv ).g;
87#endif`,zm=`#ifdef USE_ALPHAMAP
88	uniform sampler2D alphaMap;
89#endif`,Vm=`#ifdef USE_ALPHATEST
90	#ifdef ALPHA_TO_COVERAGE
91	diffuseColor.a = smoothstep( alphaTest, alphaTest + fwidth( diffuseColor.a ), diffuseColor.a );
92	if ( diffuseColor.a == 0.0 ) discard;
93	#else
94	if ( diffuseColor.a < alphaTest ) discard;
95	#endif
96#endif`,km=`#ifdef USE_ALPHATEST
97	uniform float alphaTest;
98#endif`,Gm=`#ifdef USE_AOMAP
99	float ambientOcclusion = ( texture2D( aoMap, vAoMapUv ).r - 1.0 ) * aoMapIntensity + 1.0;
100	reflectedLight.indirectDiffuse *= ambientOcclusion;
101	#if defined( USE_CLEARCOAT ) 
102		clearcoatSpecularIndirect *= ambientOcclusion;
103	#endif
104	#if defined( USE_SHEEN ) 
105		sheenSpecularIndirect *= ambientOcclusion;
106	#endif
107	#if defined( USE_ENVMAP ) && defined( STANDARD )
108		float dotNV = saturate( dot( geometryNormal, geometryViewDir ) );
109		reflectedLight.indirectSpecular *= computeSpecularOcclusion( dotNV, ambientOcclusion, material.roughness );
110	#endif
111#endif`,Hm=`#ifdef USE_AOMAP
112	uniform sampler2D aoMap;
113	uniform float aoMapIntensity;
114#endif`,Wm=`#ifdef USE_BATCHING
115	#if ! defined( GL_ANGLE_multi_draw )
116	#define gl_DrawID _gl_DrawID
117	uniform int _gl_DrawID;
118	#endif
119	uniform highp sampler2D batchingTexture;
120	uniform highp usampler2D batchingIdTexture;
121	mat4 getBatchingMatrix( const in float i ) {
122		int size = textureSize( batchingTexture, 0 ).x;
123		int j = int( i ) * 4;
124		int x = j % size;
125		int y = j / size;
126		vec4 v1 = texelFetch( batchingTexture, ivec2( x, y ), 0 );
127		vec4 v2 = texelFetch( batchingTexture, ivec2( x + 1, y ), 0 );
128		vec4 v3 = texelFetch( batchingTexture, ivec2( x + 2, y ), 0 );
129		vec4 v4 = texelFetch( batchingTexture, ivec2( x + 3, y ), 0 );
130		return mat4( v1, v2, v3, v4 );
131	}
132	float getIndirectIndex( const in int i ) {
133		int size = textureSize( batchingIdTexture, 0 ).x;
134		int x = i % size;
135		int y = i / size;
136		return float( texelFetch( batchingIdTexture, ivec2( x, y ), 0 ).r );
137	}
138#endif
139#ifdef USE_BATCHING_COLOR
140	uniform sampler2D batchingColorTexture;
141	vec3 getBatchingColor( const in float i ) {
142		int size = textureSize( batchingColorTexture, 0 ).x;
143		int j = int( i );
144		int x = j % size;
145		int y = j / size;
146		return texelFetch( batchingColorTexture, ivec2( x, y ), 0 ).rgb;
147	}
148#endif`,Xm=`#ifdef USE_BATCHING
149	mat4 batchingMatrix = getBatchingMatrix( getIndirectIndex( gl_DrawID ) );
150#endif`,qm=`vec3 transformed = vec3( position );
151#ifdef USE_ALPHAHASH
152	vPosition = vec3( position );
153#endif`,Ym=`vec3 objectNormal = vec3( normal );
154#ifdef USE_TANGENT
155	vec3 objectTangent = vec3( tangent.xyz );
156#endif`,Zm=`float G_BlinnPhong_Implicit( ) {
157	return 0.25;
158}
159float D_BlinnPhong( const in float shininess, const in float dotNH ) {
160	return RECIPROCAL_PI * ( shininess * 0.5 + 1.0 ) * pow( dotNH, shininess );
161}
162vec3 BRDF_BlinnPhong( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in vec3 specularColor, const in float shininess ) {
163	vec3 halfDir = normalize( lightDir + viewDir );
164	float dotNH = saturate( dot( normal, halfDir ) );
165	float dotVH = saturate( dot( viewDir, halfDir ) );
166	vec3 F = F_Schlick( specularColor, 1.0, dotVH );
167	float G = G_BlinnPhong_Implicit( );
168	float D = D_BlinnPhong( shininess, dotNH );
169	return F * ( G * D );
170} // validated`,Jm=`#ifdef USE_IRIDESCENCE
171	const mat3 XYZ_TO_REC709 = mat3(
172		 3.2404542, -0.9692660,  0.0556434,
173		-1.5371385,  1.8760108, -0.2040259,
174		-0.4985314,  0.0415560,  1.0572252
175	);
176	vec3 Fresnel0ToIor( vec3 fresnel0 ) {
177		vec3 sqrtF0 = sqrt( fresnel0 );
178		return ( vec3( 1.0 ) + sqrtF0 ) / ( vec3( 1.0 ) - sqrtF0 );
179	}
180	vec3 IorToFresnel0( vec3 transmittedIor, float incidentIor ) {
181		return pow2( ( transmittedIor - vec3( incidentIor ) ) / ( transmittedIor + vec3( incidentIor ) ) );
182	}
183	float IorToFresnel0( float transmittedIor, float incidentIor ) {
184		return pow2( ( transmittedIor - incidentIor ) / ( transmittedIor + incidentIor ));
185	}
186	vec3 evalSensitivity( float OPD, vec3 shift ) {
187		float phase = 2.0 * PI * OPD * 1.0e-9;
188		vec3 val = vec3( 5.4856e-13, 4.4201e-13, 5.2481e-13 );
189		vec3 pos = vec3( 1.6810e+06, 1.7953e+06, 2.2084e+06 );
190		vec3 var = vec3( 4.3278e+09, 9.3046e+09, 6.6121e+09 );
191		vec3 xyz = val * sqrt( 2.0 * PI * var ) * cos( pos * phase + shift ) * exp( - pow2( phase ) * var );
192		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 ) );
193		xyz /= 1.0685e-7;
194		vec3 rgb = XYZ_TO_REC709 * xyz;
195		return rgb;
196	}
197	vec3 evalIridescence( float outsideIOR, float eta2, float cosTheta1, float thinFilmThickness, vec3 baseF0 ) {
198		vec3 I;
199		float iridescenceIOR = mix( outsideIOR, eta2, smoothstep( 0.0, 0.03, thinFilmThickness ) );
200		float sinTheta2Sq = pow2( outsideIOR / iridescenceIOR ) * ( 1.0 - pow2( cosTheta1 ) );
201		float cosTheta2Sq = 1.0 - sinTheta2Sq;
202		if ( cosTheta2Sq < 0.0 ) {
203			return vec3( 1.0 );
204		}
205		float cosTheta2 = sqrt( cosTheta2Sq );
206		float R0 = IorToFresnel0( iridescenceIOR, outsideIOR );
207		float R12 = F_Schlick( R0, 1.0, cosTheta1 );
208		float T121 = 1.0 - R12;
209		float phi12 = 0.0;
210		if ( iridescenceIOR < outsideIOR ) phi12 = PI;
211		float phi21 = PI - phi12;
212		vec3 baseIOR = Fresnel0ToIor( clamp( baseF0, 0.0, 0.9999 ) );		vec3 R1 = IorToFresnel0( baseIOR, iridescenceIOR );
213		vec3 R23 = F_Schlick( R1, 1.0, cosTheta2 );
214		vec3 phi23 = vec3( 0.0 );
215		if ( baseIOR[ 0 ] < iridescenceIOR ) phi23[ 0 ] = PI;
216		if ( baseIOR[ 1 ] < iridescenceIOR ) phi23[ 1 ] = PI;
217		if ( baseIOR[ 2 ] < iridescenceIOR ) phi23[ 2 ] = PI;
218		float OPD = 2.0 * iridescenceIOR * thinFilmThickness * cosTheta2;
219		vec3 phi = vec3( phi21 ) + phi23;
220		vec3 R123 = clamp( R12 * R23, 1e-5, 0.9999 );
221		vec3 r123 = sqrt( R123 );
222		vec3 Rs = pow2( T121 ) * R23 / ( vec3( 1.0 ) - R123 );
223		vec3 C0 = R12 + Rs;
224		I = C0;
225		vec3 Cm = Rs - T121;
226		for ( int m = 1; m <= 2; ++ m ) {
227			Cm *= r123;
228			vec3 Sm = 2.0 * evalSensitivity( float( m ) * OPD, float( m ) * phi );
229			I += Cm * Sm;
230		}
231		return max( I, vec3( 0.0 ) );
232	}
233#endif`,$m=`#ifdef USE_BUMPMAP
234	uniform sampler2D bumpMap;
235	uniform float bumpScale;
236	vec2 dHdxy_fwd() {
237		vec2 dSTdx = dFdx( vBumpMapUv );
238		vec2 dSTdy = dFdy( vBumpMapUv );
239		float Hll = bumpScale * texture2D( bumpMap, vBumpMapUv ).x;
240		float dBx = bumpScale * texture2D( bumpMap, vBumpMapUv + dSTdx ).x - Hll;
241		float dBy = bumpScale * texture2D( bumpMap, vBumpMapUv + dSTdy ).x - Hll;
242		return vec2( dBx, dBy );
243	}
244	vec3 perturbNormalArb( vec3 surf_pos, vec3 surf_norm, vec2 dHdxy, float faceDirection ) {
245		vec3 vSigmaX = normalize( dFdx( surf_pos.xyz ) );
246		vec3 vSigmaY = normalize( dFdy( surf_pos.xyz ) );
247		vec3 vN = surf_norm;
248		vec3 R1 = cross( vSigmaY, vN );
249		vec3 R2 = cross( vN, vSigmaX );
250		float fDet = dot( vSigmaX, R1 ) * faceDirection;
251		vec3 vGrad = sign( fDet ) * ( dHdxy.x * R1 + dHdxy.y * R2 );
252		return normalize( abs( fDet ) * surf_norm - vGrad );
253	}
254#endif`,Km=`#if NUM_CLIPPING_PLANES > 0
255	vec4 plane;
256	#ifdef ALPHA_TO_COVERAGE
257		float distanceToPlane, distanceGradient;
258		float clipOpacity = 1.0;
259		#pragma unroll_loop_start
260		for ( int i = 0; i < UNION_CLIPPING_PLANES; i ++ ) {
261			plane = clippingPlanes[ i ];
262			distanceToPlane = - dot( vClipPosition, plane.xyz ) + plane.w;
263			distanceGradient = fwidth( distanceToPlane ) / 2.0;
264			clipOpacity *= smoothstep( - distanceGradient, distanceGradient, distanceToPlane );
265			if ( clipOpacity == 0.0 ) discard;
266		}
267		#pragma unroll_loop_end
268		#if UNION_CLIPPING_PLANES < NUM_CLIPPING_PLANES
269			float unionClipOpacity = 1.0;
270			#pragma unroll_loop_start
271			for ( int i = UNION_CLIPPING_PLANES; i < NUM_CLIPPING_PLANES; i ++ ) {
272				plane = clippingPlanes[ i ];
273				distanceToPlane = - dot( vClipPosition, plane.xyz ) + plane.w;
274				distanceGradient = fwidth( distanceToPlane ) / 2.0;
275				unionClipOpacity *= 1.0 - smoothstep( - distanceGradient, distanceGradient, distanceToPlane );
276			}
277			#pragma unroll_loop_end
278			clipOpacity *= 1.0 - unionClipOpacity;
279		#endif
280		diffuseColor.a *= clipOpacity;
281		if ( diffuseColor.a == 0.0 ) discard;
282	#else
283		#pragma unroll_loop_start
284		for ( int i = 0; i < UNION_CLIPPING_PLANES; i ++ ) {
285			plane = clippingPlanes[ i ];
286			if ( dot( vClipPosition, plane.xyz ) > plane.w ) discard;
287		}
288		#pragma unroll_loop_end
289		#if UNION_CLIPPING_PLANES < NUM_CLIPPING_PLANES
290			bool clipped = true;
291			#pragma unroll_loop_start
292			for ( int i = UNION_CLIPPING_PLANES; i < NUM_CLIPPING_PLANES; i ++ ) {
293				plane = clippingPlanes[ i ];
294				clipped = ( dot( vClipPosition, plane.xyz ) > plane.w ) && clipped;
295			}
296			#pragma unroll_loop_end
297			if ( clipped ) discard;
298		#endif
299	#endif
300#endif`,Qm=`#if NUM_CLIPPING_PLANES > 0
301	varying vec3 vClipPosition;
302	uniform vec4 clippingPlanes[ NUM_CLIPPING_PLANES ];
303#endif`,jm=`#if NUM_CLIPPING_PLANES > 0
304	varying vec3 vClipPosition;
305#endif`,eg=`#if NUM_CLIPPING_PLANES > 0
306	vClipPosition = - mvPosition.xyz;
307#endif`,tg=`#if defined( USE_COLOR_ALPHA )
308	diffuseColor *= vColor;
309#elif defined( USE_COLOR )
310	diffuseColor.rgb *= vColor;
311#endif`,ng=`#if defined( USE_COLOR_ALPHA )
312	varying vec4 vColor;
313#elif defined( USE_COLOR )
314	varying vec3 vColor;
315#endif`,ig=`#if defined( USE_COLOR_ALPHA )
316	varying vec4 vColor;
317#elif defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR ) || defined( USE_BATCHING_COLOR )
318	varying vec3 vColor;
319#endif`,sg=`#if defined( USE_COLOR_ALPHA )
320	vColor = vec4( 1.0 );
321#elif defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR ) || defined( USE_BATCHING_COLOR )
322	vColor = vec3( 1.0 );
323#endif
324#ifdef USE_COLOR
325	vColor *= color;
326#endif
327#ifdef USE_INSTANCING_COLOR
328	vColor.xyz *= instanceColor.xyz;
329#endif
330#ifdef USE_BATCHING_COLOR
331	vec3 batchingColor = getBatchingColor( getIndirectIndex( gl_DrawID ) );
332	vColor.xyz *= batchingColor.xyz;
333#endif`,rg=`#define PI 3.141592653589793
334#define PI2 6.283185307179586
335#define PI_HALF 1.5707963267948966
336#define RECIPROCAL_PI 0.3183098861837907
337#define RECIPROCAL_PI2 0.15915494309189535
338#define EPSILON 1e-6
339#ifndef saturate
340#define saturate( a ) clamp( a, 0.0, 1.0 )
341#endif
342#define whiteComplement( a ) ( 1.0 - saturate( a ) )
343float pow2( const in float x ) { return x*x; }
344vec3 pow2( const in vec3 x ) { return x*x; }
345float pow3( const in float x ) { return x*x*x; }
346float pow4( const in float x ) { float x2 = x*x; return x2*x2; }
347float max3( const in vec3 v ) { return max( max( v.x, v.y ), v.z ); }
348float average( const in vec3 v ) { return dot( v, vec3( 0.3333333 ) ); }
349highp float rand( const in vec2 uv ) {
350	const highp float a = 12.9898, b = 78.233, c = 43758.5453;
351	highp float dt = dot( uv.xy, vec2( a,b ) ), sn = mod( dt, PI );
352	return fract( sin( sn ) * c );
353}
354#ifdef HIGH_PRECISION
355	float precisionSafeLength( vec3 v ) { return length( v ); }
356#else
357	float precisionSafeLength( vec3 v ) {
358		float maxComponent = max3( abs( v ) );
359		return length( v / maxComponent ) * maxComponent;
360	}
361#endif
362struct IncidentLight {
363	vec3 color;
364	vec3 direction;
365	bool visible;
366};
367struct ReflectedLight {
368	vec3 directDiffuse;
369	vec3 directSpecular;
370	vec3 indirectDiffuse;
371	vec3 indirectSpecular;
372};
373#ifdef USE_ALPHAHASH
374	varying vec3 vPosition;
375#endif
376vec3 transformDirection( in vec3 dir, in mat4 matrix ) {
377	return normalize( ( matrix * vec4( dir, 0.0 ) ).xyz );
378}
379vec3 inverseTransformDirection( in vec3 dir, in mat4 matrix ) {
380	return normalize( ( vec4( dir, 0.0 ) * matrix ).xyz );
381}
382bool isPerspectiveMatrix( mat4 m ) {
383	return m[ 2 ][ 3 ] == - 1.0;
384}
385vec2 equirectUv( in vec3 dir ) {
386	float u = atan( dir.z, dir.x ) * RECIPROCAL_PI2 + 0.5;
387	float v = asin( clamp( dir.y, - 1.0, 1.0 ) ) * RECIPROCAL_PI + 0.5;
388	return vec2( u, v );
389}
390vec3 BRDF_Lambert( const in vec3 diffuseColor ) {
391	return RECIPROCAL_PI * diffuseColor;
392}
393vec3 F_Schlick( const in vec3 f0, const in float f90, const in float dotVH ) {
394	float fresnel = exp2( ( - 5.55473 * dotVH - 6.98316 ) * dotVH );
395	return f0 * ( 1.0 - fresnel ) + ( f90 * fresnel );
396}
397float F_Schlick( const in float f0, const in float f90, const in float dotVH ) {
398	float fresnel = exp2( ( - 5.55473 * dotVH - 6.98316 ) * dotVH );
399	return f0 * ( 1.0 - fresnel ) + ( f90 * fresnel );
400} // validated`,ag=`#ifdef ENVMAP_TYPE_CUBE_UV
401	#define cubeUV_minMipLevel 4.0
402	#define cubeUV_minTileSize 16.0
403	float getFace( vec3 direction ) {
404		vec3 absDirection = abs( direction );
405		float face = - 1.0;
406		if ( absDirection.x > absDirection.z ) {
407			if ( absDirection.x > absDirection.y )
408				face = direction.x > 0.0 ? 0.0 : 3.0;
409			else
410				face = direction.y > 0.0 ? 1.0 : 4.0;
411		} else {
412			if ( absDirection.z > absDirection.y )
413				face = direction.z > 0.0 ? 2.0 : 5.0;
414			else
415				face = direction.y > 0.0 ? 1.0 : 4.0;
416		}
417		return face;
418	}
419	vec2 getUV( vec3 direction, float face ) {
420		vec2 uv;
421		if ( face == 0.0 ) {
422			uv = vec2( direction.z, direction.y ) / abs( direction.x );
423		} else if ( face == 1.0 ) {
424			uv = vec2( - direction.x, - direction.z ) / abs( direction.y );
425		} else if ( face == 2.0 ) {
426			uv = vec2( - direction.x, direction.y ) / abs( direction.z );
427		} else if ( face == 3.0 ) {
428			uv = vec2( - direction.z, direction.y ) / abs( direction.x );
429		} else if ( face == 4.0 ) {
430			uv = vec2( - direction.x, direction.z ) / abs( direction.y );
431		} else {
432			uv = vec2( direction.x, direction.y ) / abs( direction.z );
433		}
434		return 0.5 * ( uv + 1.0 );
435	}
436	vec3 bilinearCubeUV( sampler2D envMap, vec3 direction, float mipInt ) {
437		float face = getFace( direction );
438		float filterInt = max( cubeUV_minMipLevel - mipInt, 0.0 );
439		mipInt = max( mipInt, cubeUV_minMipLevel );
440		float faceSize = exp2( mipInt );
441		highp vec2 uv = getUV( direction, face ) * ( faceSize - 2.0 ) + 1.0;
442		if ( face > 2.0 ) {
443			uv.y += faceSize;
444			face -= 3.0;
445		}
446		uv.x += face * faceSize;
447		uv.x += filterInt * 3.0 * cubeUV_minTileSize;
448		uv.y += 4.0 * ( exp2( CUBEUV_MAX_MIP ) - faceSize );
449		uv.x *= CUBEUV_TEXEL_WIDTH;
450		uv.y *= CUBEUV_TEXEL_HEIGHT;
451		#ifdef texture2DGradEXT
452			return texture2DGradEXT( envMap, uv, vec2( 0.0 ), vec2( 0.0 ) ).rgb;
453		#else
454			return texture2D( envMap, uv ).rgb;
455		#endif
456	}
457	#define cubeUV_r0 1.0
458	#define cubeUV_m0 - 2.0
459	#define cubeUV_r1 0.8
460	#define cubeUV_m1 - 1.0
461	#define cubeUV_r4 0.4
462	#define cubeUV_m4 2.0
463	#define cubeUV_r5 0.305
464	#define cubeUV_m5 3.0
465	#define cubeUV_r6 0.21
466	#define cubeUV_m6 4.0
467	float roughnessToMip( float roughness ) {
468		float mip = 0.0;
469		if ( roughness >= cubeUV_r1 ) {
470			mip = ( cubeUV_r0 - roughness ) * ( cubeUV_m1 - cubeUV_m0 ) / ( cubeUV_r0 - cubeUV_r1 ) + cubeUV_m0;
471		} else if ( roughness >= cubeUV_r4 ) {
472			mip = ( cubeUV_r1 - roughness ) * ( cubeUV_m4 - cubeUV_m1 ) / ( cubeUV_r1 - cubeUV_r4 ) + cubeUV_m1;
473		} else if ( roughness >= cubeUV_r5 ) {
474			mip = ( cubeUV_r4 - roughness ) * ( cubeUV_m5 - cubeUV_m4 ) / ( cubeUV_r4 - cubeUV_r5 ) + cubeUV_m4;
475		} else if ( roughness >= cubeUV_r6 ) {
476			mip = ( cubeUV_r5 - roughness ) * ( cubeUV_m6 - cubeUV_m5 ) / ( cubeUV_r5 - cubeUV_r6 ) + cubeUV_m5;
477		} else {
478			mip = - 2.0 * log2( 1.16 * roughness );		}
479		return mip;
480	}
481	vec4 textureCubeUV( sampler2D envMap, vec3 sampleDir, float roughness ) {
482		float mip = clamp( roughnessToMip( roughness ), cubeUV_m0, CUBEUV_MAX_MIP );
483		float mipF = fract( mip );
484		float mipInt = floor( mip );
485		vec3 color0 = bilinearCubeUV( envMap, sampleDir, mipInt );
486		if ( mipF == 0.0 ) {
487			return vec4( color0, 1.0 );
488		} else {
489			vec3 color1 = bilinearCubeUV( envMap, sampleDir, mipInt + 1.0 );
490			return vec4( mix( color0, color1, mipF ), 1.0 );
491		}
492	}
493#endif`,og=`vec3 transformedNormal = objectNormal;
494#ifdef USE_TANGENT
495	vec3 transformedTangent = objectTangent;
496#endif
497#ifdef USE_BATCHING
498	mat3 bm = mat3( batchingMatrix );
499	transformedNormal /= vec3( dot( bm[ 0 ], bm[ 0 ] ), dot( bm[ 1 ], bm[ 1 ] ), dot( bm[ 2 ], bm[ 2 ] ) );
500	transformedNormal = bm * transformedNormal;
501	#ifdef USE_TANGENT
502		transformedTangent = bm * transformedTangent;
503	#endif
504#endif
505#ifdef USE_INSTANCING
506	mat3 im = mat3( instanceMatrix );
507	transformedNormal /= vec3( dot( im[ 0 ], im[ 0 ] ), dot( im[ 1 ], im[ 1 ] ), dot( im[ 2 ], im[ 2 ] ) );
508	transformedNormal = im * transformedNormal;
509	#ifdef USE_TANGENT
510		transformedTangent = im * transformedTangent;
511	#endif
512#endif
513transformedNormal = normalMatrix * transformedNormal;
514#ifdef FLIP_SIDED
515	transformedNormal = - transformedNormal;
516#endif
517#ifdef USE_TANGENT
518	transformedTangent = ( modelViewMatrix * vec4( transformedTangent, 0.0 ) ).xyz;
519	#ifdef FLIP_SIDED
520		transformedTangent = - transformedTangent;
521	#endif
522#endif`,lg=`#ifdef USE_DISPLACEMENTMAP
523	uniform sampler2D displacementMap;
524	uniform float displacementScale;
525	uniform float displacementBias;
526#endif`,cg=`#ifdef USE_DISPLACEMENTMAP
527	transformed += normalize( objectNormal ) * ( texture2D( displacementMap, vDisplacementMapUv ).x * displacementScale + dis
527placementBias );
528#endif`,hg=`#ifdef USE_EMISSIVEMAP
529	vec4 emissiveColor = texture2D( emissiveMap, vEmissiveMapUv );
530	#ifdef DECODE_VIDEO_TEXTURE_EMISSIVE
531		emissiveColor = sRGBTransferEOTF( emissiveColor );
532	#endif
533	totalEmissiveRadiance *= emissiveColor.rgb;
534#endif`,ug=`#ifdef USE_EMISSIVEMAP
535	uniform sampler2D emissiveMap;
536#endif`,dg="gl_FragColor = linearToOutputTexel( gl_FragColor );",fg=`vec4 LinearTransferOETF( in vec4 value ) {
537	return value;
538}
539vec4 sRGBTransferEOTF( in vec4 value ) {
540	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 );
541}
542vec4 sRGBTransferOETF( in vec4 value ) {
543	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 );
544}`,pg=`#ifdef USE_ENVMAP
545	#ifdef ENV_WORLDPOS
546		vec3 cameraToFrag;
547		if ( isOrthographic ) {
548			cameraToFrag = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) );
549		} else {
550			cameraToFrag = normalize( vWorldPosition - cameraPosition );
551		}
552		vec3 worldNormal = inverseTransformDirection( normal, viewMatrix );
553		#ifdef ENVMAP_MODE_REFLECTION
554			vec3 reflectVec = reflect( cameraToFrag, worldNormal );
555		#else
556			vec3 reflectVec = refract( cameraToFrag, worldNormal, refractionRatio );
557		#endif
558	#else
559		vec3 reflectVec = vReflect;
560	#endif
561	#ifdef ENVMAP_TYPE_CUBE
562		vec4 envColor = textureCube( envMap, envMapRotation * vec3( flipEnvMap * reflectVec.x, reflectVec.yz ) );
563	#else
564		vec4 envColor = vec4( 0.0 );
565	#endif
566	#ifdef ENVMAP_BLENDING_MULTIPLY
567		outgoingLight = mix( outgoingLight, outgoingLight * envColor.xyz, specularStrength * reflectivity );
568	#elif defined( ENVMAP_BLENDING_MIX )
569		outgoingLight = mix( outgoingLight, envColor.xyz, specularStrength * reflectivity );
570	#elif defined( ENVMAP_BLENDING_ADD )
571		outgoingLight += envColor.xyz * specularStrength * reflectivity;
572	#endif
573#endif`,mg=`#ifdef USE_ENVMAP
574	uniform float envMapIntensity;
575	uniform float flipEnvMap;
576	uniform mat3 envMapRotation;
577	#ifdef ENVMAP_TYPE_CUBE
578		uniform samplerCube envMap;
579	#else
580		uniform sampler2D envMap;
581	#endif
582#endif`,gg=`#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`,_g=`#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`,xg=`#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`,vg=`#ifdef USE_FOG
622	vFogDepth = - mvPosition.z;
623#endif`,yg=`#ifdef USE_FOG
624	varying float vFogDepth;
625#endif`,Mg=`#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`,Sg=`#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`,bg=`#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}`,Ag=`#ifdef USE_LIGHTMAP
654	uniform sampler2D lightMap;
655	uniform float lightMapIntensity;
656#endif`,Tg=`LambertMaterial material;
657material.diffuseColor = diffuseColor.rgb;
658material.specularStrength = specularStrength;`,Eg=`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`,wg=`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`,Cg=`#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, pow4( 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`,Rg=`ToonMaterial material;
822material.diffuseColor = diffuseColor.rgb;`,Ig=`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`,Pg=`BlinnPhongMaterial material;
835material.diffuseColor = diffuseColor.rgb;
836material.specularColor = specular;
837material.specularShininess = shininess;
838material.specularStrength = specularStrength;`,Lg=`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`,Dg=`PhysicalMaterial material;
856material.diffuseColor = diffuseColor.rgb;
857material.diffuseContribution = diffuseColor.rgb * ( 1.0 - metalnessFactor );
858material.metalness = metalnessFactor;
859vec3 dxy = max( abs( dFdx( nonPerturbedNormal ) ), abs( dFdy( nonPerturbedNormal ) ) );
860float geometryRoughness = max( max( dxy.x, dxy.y ), dxy.z );
861material.roughness = max( roughnessFactor, 0.0525 );material.roughness += geometryRoughness;
862material.roughness = min( material.roughness, 1.0 );
863#ifdef IOR
864	material.ior = ior;
865	#ifdef USE_SPECULAR
866		float specularIntensityFactor = specularIntensity;
867		vec3 specularColorFactor = specularColor;
868		#ifdef USE_SPECULAR_COLORMAP
869			specularColorFactor *= texture2D( specularColorMap, vSpecularColorMapUv ).rgb;
870		#endif
871		#ifdef USE_SPECULAR_INTENSITYMAP
872			specularIntensityFactor *= texture2D( specularIntensityMap, vSpecularIntensityMapUv ).a;
873		#endif
874		material.specularF90 = mix( specularIntensityFactor, 1.0, metalnessFactor );
875	#else
876		float specularIntensityFactor = 1.0;
877		vec3 specularColorFactor = vec3( 1.0 );
878		material.specularF90 = 1.0;
879	#endif
880	material.specularColor = min( pow2( ( material.ior - 1.0 ) / ( material.ior + 1.0 ) ) * specularColorFactor, vec3( 1.0 ) ) * specularIntensityFactor;
881	material.specularColorBlended = mix( material.specularColor, diffuseColor.rgb, metalnessFactor );
882#else
883	material.specularColor = vec3( 0.04 );
884	material.specularColorBlended = mix( material.specularColor, diffuseColor.rgb, metalnessFactor );
885	material.specularF90 = 1.0;
886#endif
887#ifdef USE_CLEARCOAT
888	material.clearcoat = clearcoat;
889	material.clearcoatRoughness = clearcoatRoughness;
890	material.clearcoatF0 = vec3( 0.04 );
891	material.clearcoatF90 = 1.0;
892	#ifdef USE_CLEARCOATMAP
893		material.clearcoat *= texture2D( clearcoatMap, vClearcoatMapUv ).x;
894	#endif
895	#ifdef USE_CLEARCOAT_ROUGHNESSMAP
896		material.clearcoatRoughness *= texture2D( clearcoatRoughnessMap, vClearcoatRoughnessMapUv ).y;
897	#endif
898	material.clearcoat = saturate( material.clearcoat );	material.clearcoatRoughness = max( material.clearcoatRoughness, 0.0525 );
899	material.clearcoatRoughness += geometryRoughness;
900	material.clearcoatRoughness = min( material.clearcoatRoughness, 1.0 );
901#endif
902#ifdef USE_DISPERSION
903	material.dispersion = dispersion;
904#endif
905#ifdef USE_IRIDESCENCE
906	material.iridescence = iridescence;
907	material.iridescenceIOR = iridescenceIOR;
908	#ifdef USE_IRIDESCENCEMAP
909		material.iridescence *= texture2D( iridescenceMap, vIridescenceMapUv ).r;
910	#endif
911	#ifdef USE_IRIDESCENCE_THICKNESSMAP
912		material.iridescenceThickness = (iridescenceThicknessMaximum - iridescenceThicknessMinimum) * texture2D( iridescenceThicknessMap, vIridescenceThicknessMapUv ).g + iridescenceThicknessMinimum;
913	#else
914		material.iridescenceThickness = iridescenceThicknessMaximum;
915	#endif
916#endif
917#ifdef USE_SHEEN
918	material.sheenColor = sheenColor;
919	#ifdef USE_SHEEN_COLORMAP
920		material.sheenColor *= texture2D( sheenColorMap, vSheenColorMapUv ).rgb;
921	#endif
922	material.sheenRoughness = clamp( sheenRoughness, 0.0001, 1.0 );
923	#ifdef USE_SHEEN_ROUGHNESSMAP
924		material.sheenRoughness *= texture2D( sheenRoughnessMap, vSheenRoughnessMapUv ).a;
925	#endif
926#endif
927#ifdef USE_ANISOTROPY
928	#ifdef USE_ANISOTROPYMAP
929		mat2 anisotropyMat = mat2( anisotropyVector.x, anisotropyVector.y, - anisotropyVector.y, anisotropyVector.x );
930		vec3 anisotropyPolar = texture2D( anisotropyMap, vAnisotropyMapUv ).rgb;
931		vec2 anisotropyV = anisotropyMat * normalize( 2.0 * anisotropyPolar.rg - vec2( 1.0 ) ) * anisotropyPolar.b;
932	#else
933		vec2 anisotropyV = anisotropyVector;
934	#endif
935	material.anisotropy = length( anisotropyV );
936	if( material.anisotropy == 0.0 ) {
937		anisotropyV = vec2( 1.0, 0.0 );
938	} else {
939		anisotropyV /= material.anisotropy;
940		material.anisotropy = saturate( material.anisotropy );
941	}
942	material.alphaT = mix( pow2( material.roughness ), 1.0, pow2( material.anisotropy ) );
943	material.anisotropyT = tbn[ 0 ] * anisotropyV.x + tbn[ 1 ] * anisotropyV.y;
944	material.anisotropyB = tbn[ 1 ] * anisotropyV.x - tbn[ 0 ] * anisotropyV.y;
945#endif`,Ug
vendor: 17,312 bytes, lines 945-1293
945=`uniform sampler2D dfgLUT;
946struct PhysicalMaterial {
947	vec3 diffuseColor;
948	vec3 diffuseContribution;
949	vec3 specularColor;
950	vec3 specularColorBlended;
951	float roughness;
952	float metalness;
953	float specularF90;
954	float dispersion;
955	#ifdef USE_CLEARCOAT
956		float clearcoat;
957		float clearcoatRoughness;
958		vec3 clearcoatF0;
959		float clearcoatF90;
960	#endif
961	#ifdef USE_IRIDESCENCE
962		float iridescence;
963		float iridescenceIOR;
964		float iridescenceThickness;
965		vec3 iridescenceFresnel;
966		vec3 iridescenceF0;
967		vec3 iridescenceFresnelDielectric;
968		vec3 iridescenceFresnelMetallic;
969	#endif
970	#ifdef USE_SHEEN
971		vec3 sheenColor;
972		float sheenRoughness;
973	#endif
974	#ifdef IOR
975		float ior;
976	#endif
977	#ifdef USE_TRANSMISSION
978		float transmission;
979		float transmissionAlpha;
980		float thickness;
981		float attenuationDistance;
982		vec3 attenuationColor;
983	#endif
984	#ifdef USE_ANISOTROPY
985		float anisotropy;
986		float alphaT;
987		vec3 anisotropyT;
988		vec3 anisotropyB;
989	#endif
990};
991vec3 clearcoatSpecularDirect = vec3( 0.0 );
992vec3 clearcoatSpecularIndirect = vec3( 0.0 );
993vec3 sheenSpecularDirect = vec3( 0.0 );
994vec3 sheenSpecularIndirect = vec3(0.0 );
995vec3 Schlick_to_F0( const in vec3 f, const in float f90, const in float dotVH ) {
996    float x = clamp( 1.0 - dotVH, 0.0, 1.0 );
997    float x2 = x * x;
998    float x5 = clamp( x * x2 * x2, 0.0, 0.9999 );
999    return ( f - vec3( f90 ) * x5 ) / ( 1.0 - x5 );
1000}
1001float V_GGX_SmithCorrelated( const in float alpha, const in float dotNL, const in float dotNV ) {
1002	float a2 = pow2( alpha );
1003	float gv = dotNL * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNV ) );
1004	float gl = dotNV * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNL ) );
1005	return 0.5 / max( gv + gl, EPSILON );
1006}
1007float D_GGX( const in float alpha, const in float dotNH ) {
1008	float a2 = pow2( alpha );
1009	float denom = pow2( dotNH ) * ( a2 - 1.0 ) + 1.0;
1010	return RECIPROCAL_PI * a2 / pow2( denom );
1011}
1012#ifdef USE_ANISOTROPY
1013	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 ) {
1014		float gv = dotNL * length( vec3( alphaT * dotTV, alphaB * dotBV, dotNV ) );
1015		float gl = dotNV * length( vec3( alphaT * dotTL, alphaB * dotBL, dotNL ) );
1016		float v = 0.5 / ( gv + gl );
1017		return v;
1018	}
1019	float D_GGX_Anisotropic( const in float alphaT, const in float alphaB, const in float dotNH, const in float dotTH, const in float dotBH ) {
1020		float a2 = alphaT * alphaB;
1021		highp vec3 v = vec3( alphaB * dotTH, alphaT * dotBH, a2 * dotNH );
1022		highp float v2 = dot( v, v );
1023		float w2 = a2 / v2;
1024		return RECIPROCAL_PI * a2 * pow2 ( w2 );
1025	}
1026#endif
1027#ifdef USE_CLEARCOAT
1028	vec3 BRDF_GGX_Clearcoat( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in PhysicalMaterial material) {
1029		vec3 f0 = material.clearcoatF0;
1030		float f90 = material.clearcoatF90;
1031		float roughness = material.clearcoatRoughness;
1032		float alpha = pow2( roughness );
1033		vec3 halfDir = normalize( lightDir + viewDir );
1034		float dotNL = saturate( dot( normal, lightDir ) );
1035		float dotNV = saturate( dot( normal, viewDir ) );
1036		float dotNH = saturate( dot( normal, halfDir ) );
1037		float dotVH = saturate( dot( viewDir, halfDir ) );
1038		vec3 F = F_Schlick( f0, f90, dotVH );
1039		float V = V_GGX_SmithCorrelated( alpha, dotNL, dotNV );
1040		float D = D_GGX( alpha, dotNH );
1041		return F * ( V * D );
1042	}
1043#endif
1044vec3 BRDF_GGX( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in PhysicalMaterial material ) {
1045	vec3 f0 = material.specularColorBlended;
1046	float f90 = material.specularF90;
1047	float roughness = material.roughness;
1048	float alpha = pow2( roughness );
1049	vec3 halfDir = normalize( lightDir + viewDir );
1050	float dotNL = saturate( dot( normal, lightDir ) );
1051	float dotNV = saturate( dot( normal, viewDir ) );
1052	float dotNH = saturate( dot( normal, halfDir ) );
1053	float dotVH = saturate( dot( viewDir, halfDir ) );
1054	vec3 F = F_Schlick( f0, f90, dotVH );
1055	#ifdef USE_IRIDESCENCE
1056		F = mix( F, material.iridescenceFresnel, material.iridescence );
1057	#endif
1058	#ifdef USE_ANISOTROPY
1059		float dotTL = dot( material.anisotropyT, lightDir );
1060		float dotTV = dot( material.anisotropyT, viewDir );
1061		float dotTH = dot( material.anisotropyT, halfDir );
1062		float dotBL = dot( material.anisotropyB, lightDir );
1063		float dotBV = dot( material.anisotropyB, viewDir );
1064		float dotBH = dot( material.anisotropyB, halfDir );
1065		float V = V_GGX_SmithCorrelated_Anisotropic( material.alphaT, alpha, dotTV, dotBV, dotTL, dotBL, dotNV, dotNL );
1066		float D = D_GGX_Anisotropic( material.alphaT, alpha, dotNH, dotTH, dotBH );
1067	#else
1068		float V = V_GGX_SmithCorrelated( alpha, dotNL, dotNV );
1069		float D = D_GGX( alpha, dotNH );
1070	#endif
1071	return F * ( V * D );
1072}
1073vec2 LTC_Uv( const in vec3 N, const in vec3 V, const in float roughness ) {
1074	const float LUT_SIZE = 64.0;
1075	const float LUT_SCALE = ( LUT_SIZE - 1.0 ) / LUT_SIZE;
1076	const float LUT_BIAS = 0.5 / LUT_SIZE;
1077	float dotNV = saturate( dot( N, V ) );
1078	vec2 uv = vec2( roughness, sqrt( 1.0 - dotNV ) );
1079	uv = uv * LUT_SCALE + LUT_BIAS;
1080	return uv;
1081}
1082float LTC_ClippedSphereFormFactor( const in vec3 f ) {
1083	float l = length( f );
1084	return max( ( l * l + f.z ) / ( l + 1.0 ), 0.0 );
1085}
1086vec3 LTC_EdgeVectorFormFactor( const in vec3 v1, const in vec3 v2 ) {
1087	float x = dot( v1, v2 );
1088	float y = abs( x );
1089	float a = 0.8543985 + ( 0.4965155 + 0.0145206 * y ) * y;
1090	float b = 3.4175940 + ( 4.1616724 + y ) * y;
1091	float v = a / b;
1092	float theta_sintheta = ( x > 0.0 ) ? v : 0.5 * inversesqrt( max( 1.0 - x * x, 1e-7 ) ) - v;
1093	return cross( v1, v2 ) * theta_sintheta;
1094}
1095vec3 LTC_Evaluate( const in vec3 N, const in vec3 V, const in vec3 P, const in mat3 mInv, const in vec3 rectCoords[ 4 ] ) {
1096	vec3 v1 = rectCoords[ 1 ] - rectCoords[ 0 ];
1097	vec3 v2 = rectCoords[ 3 ] - rectCoords[ 0 ];
1098	vec3 lightNormal = cross( v1, v2 );
1099	if( dot( lightNormal, P - rectCoords[ 0 ] ) < 0.0 ) return vec3( 0.0 );
1100	vec3 T1, T2;
1101	T1 = normalize( V - N * dot( V, N ) );
1102	T2 = - cross( N, T1 );
1103	mat3 mat = mInv * transpose( mat3( T1, T2, N ) );
1104	vec3 coords[ 4 ];
1105	coords[ 0 ] = mat * ( rectCoords[ 0 ] - P );
1106	coords[ 1 ] = mat * ( rectCoords[ 1 ] - P );
1107	coords[ 2 ] = mat * ( rectCoords[ 2 ] - P );
1108	coords[ 3 ] = mat * ( rectCoords[ 3 ] - P );
1109	coords[ 0 ] = normalize( coords[ 0 ] );
1110	coords[ 1 ] = normalize( coords[ 1 ] );
1111	coords[ 2 ] = normalize( coords[ 2 ] );
1112	coords[ 3 ] = normalize( coords[ 3 ] );
1113	vec3 vectorFormFactor = vec3( 0.0 );
1114	vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 0 ], coords[ 1 ] );
1115	vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 1 ], coords[ 2 ] );
1116	vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 2 ], coords[ 3 ] );
1117	vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 3 ], coords[ 0 ] );
1118	float result = LTC_ClippedSphereFormFactor( vectorFormFactor );
1119	return vec3( result );
1120}
1121#if defined( USE_SHEEN )
1122float D_Charlie( float roughness, float dotNH ) {
1123	float alpha = pow2( roughness );
1124	float invAlpha = 1.0 / alpha;
1125	float cos2h = dotNH * dotNH;
1126	float sin2h = max( 1.0 - cos2h, 0.0078125 );
1127	return ( 2.0 + invAlpha ) * pow( sin2h, invAlpha * 0.5 ) / ( 2.0 * PI );
1128}
1129float V_Neubelt( float dotNV, float dotNL ) {
1130	return saturate( 1.0 / ( 4.0 * ( dotNL + dotNV - dotNL * dotNV ) ) );
1131}
1132vec3 BRDF_Sheen( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, vec3 sheenColor, const in float sheenRoughness ) {
1133	vec3 halfDir = normalize( lightDir + viewDir );
1134	float dotNL = saturate( dot( normal, lightDir ) );
1135	float dotNV = saturate( dot( normal, viewDir ) );
1136	float dotNH = saturate( dot( normal, halfDir ) );
1137	float D = D_Charlie( sheenRoughness, dotNH );
1138	float V = V_Neubelt( dotNV, dotNL );
1139	return sheenColor * ( D * V );
1140}
1141#endif
1142float IBLSheenBRDF( const in vec3 normal, const in vec3 viewDir, const in float roughness ) {
1143	float dotNV = saturate( dot( normal, viewDir ) );
1144	float r2 = roughness * roughness;
1145	float rInv = 1.0 / ( roughness + 0.1 );
1146	float a = -1.9362 + 1.0678 * roughness + 0.4573 * r2 - 0.8469 * rInv;
1147	float b = -0.6014 + 0.5538 * roughness - 0.4670 * r2 - 0.1255 * rInv;
1148	float DG = exp( a * dotNV + b );
1149	return saturate( DG );
1150}
1151vec3 EnvironmentBRDF( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float roughness ) {
1152	float dotNV = saturate( dot( normal, viewDir ) );
1153	vec2 fab = texture2D( dfgLUT, vec2( roughness, dotNV ) ).rg;
1154	return specularColor * fab.x + specularF90 * fab.y;
1155}
1156#ifdef USE_IRIDESCENCE
1157void 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 ) {
1158#else
1159void 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 ) {
1160#endif
1161	float dotNV = saturate( dot( normal, viewDir ) );
1162	vec2 fab = texture2D( dfgLUT, vec2( roughness, dotNV ) ).rg;
1163	#ifdef USE_IRIDESCENCE
1164		vec3 Fr = mix( specularColor, iridescenceF0, iridescence );
1165	#else
1166		vec3 Fr = specularColor;
1167	#endif
1168	vec3 FssEss = Fr * fab.x + specularF90 * fab.y;
1169	float Ess = fab.x + fab.y;
1170	float Ems = 1.0 - Ess;
1171	vec3 Favg = Fr + ( 1.0 - Fr ) * 0.047619;	vec3 Fms = FssEss * Favg / ( 1.0 - Ems * Favg );
1172	singleScatter += FssEss;
1173	multiScatter += Fms * Ems;
1174}
1175vec3 BRDF_GGX_Multiscatter( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in PhysicalMaterial material ) {
1176	vec3 singleScatter = BRDF_GGX( lightDir, viewDir, normal, material );
1177	float dotNL = saturate( dot( normal, lightDir ) );
1178	float dotNV = saturate( dot( normal, viewDir ) );
1179	vec2 dfgV = texture2D( dfgLUT, vec2( material.roughness, dotNV ) ).rg;
1180	vec2 dfgL = texture2D( dfgLUT, vec2( material.roughness, dotNL ) ).rg;
1181	vec3 FssEss_V = material.specularColorBlended * dfgV.x + material.specularF90 * dfgV.y;
1182	vec3 FssEss_L = material.specularColorBlended * dfgL.x + material.specularF90 * dfgL.y;
1183	float Ess_V = dfgV.x + dfgV.y;
1184	float Ess_L = dfgL.x + dfgL.y;
1185	float Ems_V = 1.0 - Ess_V;
1186	float Ems_L = 1.0 - Ess_L;
1187	vec3 Favg = material.specularColorBlended + ( 1.0 - material.specularColorBlended ) * 0.047619;
1188	vec3 Fms = FssEss_V * FssEss_L * Favg / ( 1.0 - Ems_V * Ems_L * Favg + EPSILON );
1189	float compensationFactor = Ems_V * Ems_L;
1190	vec3 multiScatter = Fms * compensationFactor;
1191	return singleScatter + multiScatter;
1192}
1193#if NUM_RECT_AREA_LIGHTS > 0
1194	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 ) {
1195		vec3 normal = geometryNormal;
1196		vec3 viewDir = geometryViewDir;
1197		vec3 position = geometryPosition;
1198		vec3 lightPos = rectAreaLight.position;
1199		vec3 halfWidth = rectAreaLight.halfWidth;
1200		vec3 halfHeight = rectAreaLight.halfHeight;
1201		vec3 lightColor = rectAreaLight.color;
1202		float roughness = material.roughness;
1203		vec3 rectCoords[ 4 ];
1204		rectCoords[ 0 ] = lightPos + halfWidth - halfHeight;		rectCoords[ 1 ] = lightPos - halfWidth - halfHeight;
1205		rectCoords[ 2 ] = lightPos - halfWidth + halfHeight;
1206		rectCoords[ 3 ] = lightPos + halfWidth + halfHeight;
1207		vec2 uv = LTC_Uv( normal, viewDir, roughness );
1208		vec4 t1 = texture2D( ltc_1, uv );
1209		vec4 t2 = texture2D( ltc_2, uv );
1210		mat3 mInv = mat3(
1211			vec3( t1.x, 0, t1.y ),
1212			vec3(    0, 1,    0 ),
1213			vec3( t1.z, 0, t1.w )
1214		);
1215		vec3 fresnel = ( material.specularColorBlended * t2.x + ( vec3( 1.0 ) - material.specularColorBlended ) * t2.y );
1216		reflectedLight.directSpecular += lightColor * fresnel * LTC_Evaluate( normal, viewDir, position, mInv, rectCoords );
1217		reflectedLight.directDiffuse += lightColor * material.diffuseContribution * LTC_Evaluate( normal, viewDir, position, mat3( 1.0 ), rectCoords );
1218	}
1219#endif
1220void 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 ) {
1221	float dotNL = saturate( dot( geometryNormal, directLight.direction ) );
1222	vec3 irradiance = dotNL * directLight.color;
1223	#ifdef USE_CLEARCOAT
1224		float dotNLcc = saturate( dot( geometryClearcoatNormal, directLight.direction ) );
1225		vec3 ccIrradiance = dotNLcc * directLight.color;
1226		clearcoatSpecularDirect += ccIrradiance * BRDF_GGX_Clearcoat( directLight.direction, geometryViewDir, geometryClearcoatNormal, material );
1227	#endif
1228	#ifdef USE_SHEEN
1229 
1230 		sheenSpecularDirect += irradiance * BRDF_Sheen( directLight.direction, geometryViewDir, geometryNormal, material.sheenColor, material.sheenRoughness );
1231 
1232 		float sheenAlbedoV = IBLSheenBRDF( geometryNormal, geometryViewDir, material.sheenRoughness );
1233 		float sheenAlbedoL = IBLSheenBRDF( geometryNormal, directLight.direction, material.sheenRoughness );
1234 
1235 		float sheenEnergyComp = 1.0 - max3( material.sheenColor ) * max( sheenAlbedoV, sheenAlbedoL );
1236 
1237 		irradiance *= sheenEnergyComp;
1238 
1239 	#endif
1240	reflectedLight.directSpecular += irradiance * BRDF_GGX_Multiscatter( directLight.direction, geometryViewDir, geometryNormal, material );
1241	reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseContribution );
1242}
1243void 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 ) {
1244	vec3 diffuse = irradiance * BRDF_Lambert( material.diffuseContribution );
1245	#ifdef USE_SHEEN
1246		float sheenAlbedo = IBLSheenBRDF( geometryNormal, geometryViewDir, material.sheenRoughness );
1247		float sheenEnergyComp = 1.0 - max3( material.sheenColor ) * sheenAlbedo;
1248		diffuse *= sheenEnergyComp;
1249	#endif
1250	reflectedLight.indirectDiffuse += diffuse;
1251}
1252void 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) {
1253	#ifdef USE_CLEARCOAT
1254		clearcoatSpecularIndirect += clearcoatRadiance * EnvironmentBRDF( geometryClearcoatNormal, geometryViewDir, material.clearcoatF0, material.clearcoatF90, material.clearcoatRoughness );
1255	#endif
1256	#ifdef USE_SHEEN
1257		sheenSpecularIndirect += irradiance * material.sheenColor * IBLSheenBRDF( geometryNormal, geometryViewDir, material.sheenRoughness ) * RECIPROCAL_PI;
1258 	#endif
1259	vec3 singleScatteringDielectric = vec3( 0.0 );
1260	vec3 multiScatteringDielectric = vec3( 0.0 );
1261	vec3 singleScatteringMetallic = vec3( 0.0 );
1262	vec3 multiScatteringMetallic = vec3( 0.0 );
1263	#ifdef USE_IRIDESCENCE
1264		computeMultiscatteringIridescence( geometryNormal, geometryViewDir, material.specularColor, material.specularF90, material.iridescence, material.iridescenceFresnelDielectric, material.roughness, singleScatteringDielectric, multiScatteringDielectric );
1265		computeMultiscatteringIridescence( geometryNormal, geometryViewDir, material.diffuseColor, material.specularF90, material.iridescence, material.iridescenceFresnelMetallic, material.roughness, singleScatteringMetallic, multiScatteringMetallic );
1266	#else
1267		computeMultiscattering( geometryNormal, geometryViewDir, material.specularColor, material.specularF90, material.roughness, singleScatteringDielectric, multiScatteringDielectric );
1268		computeMultiscattering( geometryNormal, geometryViewDir, material.diffuseColor, material.specularF90, material.roughness, singleScatteringMetallic, multiScatteringMetallic );
1269	#endif
1270	vec3 singleScattering = mix( singleScatteringDielectric, singleScatteringMetallic, material.metalness );
1271	vec3 multiScattering = mix( multiScatteringDielectric, multiScatteringMetallic, material.metalness );
1272	vec3 totalScatteringDielectric = singleScatteringDielectric + multiScatteringDielectric;
1273	vec3 diffuse = material.diffuseContribution * ( 1.0 - totalScatteringDielectric );
1274	vec3 cosineWeightedIrradiance = irradiance * RECIPROCAL_PI;
1275	vec3 indirectSpecular = radiance * singleScattering;
1276	indirectSpecular += multiScattering * cosineWeightedIrradiance;
1277	vec3 indirectDiffuse = diffuse * cosineWeightedIrradiance;
1278	#ifdef USE_SHEEN
1279		float sheenAlbedo = IBLSheenBRDF( geometryNormal, geometryViewDir, material.sheenRoughness );
1280		float sheenEnergyComp = 1.0 - max3( material.sheenColor ) * sheenAlbedo;
1281		indirectSpecular *= sheenEnergyComp;
1282		indirectDiffuse *= sheenEnergyComp;
1283	#endif
1284	reflectedLight.indirectSpecular += indirectSpecular;
1285	reflectedLight.indirectDiffuse += indirectDiffuse;
1286}
1287#define RE_Direct				RE_Direct_Physical
1288#define RE_Direct_RectArea		RE_Direct_RectArea_Physical
1289#define RE_IndirectDiffuse		RE_IndirectDiffuse_Physical
1290#define RE_IndirectSpecular		RE_IndirectSpecular_Physical
1291float computeSpecularOcclusion( const in float dotNV, const in float ambientOcclusion, const in float roughness ) {
1292	return saturate( pow( dotNV + ambientOcclusion, exp2( - 16.0 * roughness - 1.0 ) ) - 1.0 + ambientOcclusion );
1293}`,
1293Ng=`
1294vec3 geometryPosition = - vViewPosition;
1295vec3 geometryNormal = normal;
1296vec3 geometryViewDir = ( isOrthographic ) ? vec3( 0, 0, 1 ) : normalize( vViewPosition );
1297vec3 geometryClearcoatNormal = vec3( 0.0 );
1298#ifdef USE_CLEARCOAT
1299	geometryClearcoatNormal = clearcoatNormal;
1300#endif
1301#ifdef USE_IRIDESCENCE
1302	float dotNVi = saturate( dot( normal, geometryViewDir ) );
1303	if ( material.iridescenceThickness == 0.0 ) {
1304		material.iridescence = 0.0;
1305	} else {
1306		material.iridescence = saturate( material.iridescence );
1307	}
1308	if ( material.iridescence > 0.0 ) {
1309		material.iridescenceFresnelDielectric = evalIridescence( 1.0, material.iridescenceIOR, dotNVi, material.iridescenceThickness, material.specularColor );
1310		material.iridescenceFresnelMetallic = evalIridescence( 1.0, material.iridescenceIOR, dotNVi, material.iridescenceThickness, material.diffuseColor );
1311		material.iridescenceFresnel = mix( material.iridescenceFresnelDielectric, material.iridescenceFresnelMetallic, material.metalness );
1312		material.iridescenceF0 = Schlick_to_F0( material.iridescenceFresnel, 1.0, dotNVi );
1313	}
1314#endif
1315IncidentLight directLight;
1316#if ( NUM_POINT_LIGHTS > 0 ) && defined( RE_Direct )
1317	PointLight pointLight;
1318	#if defined( USE_SHADOWMAP ) && NUM_POINT_LIGHT_SHADOWS > 0
1319	PointLightShadow pointLightShadow;
1320	#endif
1321	#pragma unroll_loop_start
1322	for ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {
1323		pointLight = pointLights[ i ];
1324		getPointLightInfo( pointLight, geometryPosition, directLight );
1325		#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_POINT_LIGHT_SHADOWS ) && ( defined( SHADOWMAP_TYPE_PCF ) || defined( SHADOWMAP_TYPE_BASIC ) )
1326		pointLightShadow = pointLightShadows[ i ];
1327		directLight.color *= ( directLight.visible && receiveShadow ) ? getPointShadow( pointShadowMap[ i ], pointLightShadow.shadowMapSize, pointLightShadow.shadowIntensity, pointLightShadow.shadowBias, pointLightShadow.shadowRadius, vPointShadowCoord[ i ], pointLightShadow.shadowCameraNear, pointLightShadow.shadowCameraFar ) : 1.0;
1328		#endif
1329		RE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );
1330	}
1331	#pragma unroll_loop_end
1332#endif
1333#if ( NUM_SPOT_LIGHTS > 0 ) && defined( RE_Direct )
1334	SpotLight spotLight;
1335	vec4 spotColor;
1336	vec3 spotLightCoord;
1337	bool inSpotLightMap;
1338	#if defined( USE_SHADOWMAP ) && NUM_SPOT_LIGHT_SHADOWS > 0
1339	SpotLightShadow spotLightShadow;
1340	#endif
1341	#pragma unroll_loop_start
1342	for ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {
1343		spotLight = spotLights[ i ];
1344		getSpotLightInfo( spotLight, geometryPosition, directLight );
1345		#if ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS )
1346		#define SPOT_LIGHT_MAP_INDEX UNROLLED_LOOP_INDEX
1347		#elif ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )
1348		#define SPOT_LIGHT_MAP_INDEX NUM_SPOT_LIGHT_MAPS
1349		#else
1350		#define SPOT_LIGHT_MAP_INDEX ( UNROLLED_LOOP_INDEX - NUM_SPOT_LIGHT_SHADOWS + NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS )
1351		#endif
1352		#if ( SPOT_LIGHT_MAP_INDEX < NUM_SPOT_LIGHT_MAPS )
1353			spotLightCoord = vSpotLightCoord[ i ].xyz / vSpotLightCoord[ i ].w;
1354			inSpotLightMap = all( lessThan( abs( spotLightCoord * 2. - 1. ), vec3( 1.0 ) ) );
1355			spotColor = texture2D( spotLightMap[ SPOT_LIGHT_MAP_INDEX ], spotLightCoord.xy );
1356			directLight.color = inSpotLightMap ? directLight.color * spotColor.rgb : directLight.color;
1357		#endif
1358		#undef SPOT_LIGHT_MAP_INDEX
1359		#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )
1360		spotLightShadow = spotLightShadows[ i ];
1361		directLight.color *= ( directLight.visible && receiveShadow ) ? getShadow( spotShadowMap[ i ], spotLightShadow.shadowMapSize, spotLightShadow.shadowIntensity, spotLightShadow.shadowBias, spotLightShadow.shadowRadius, vSpotLightCoord[ i ] ) : 1.0;
1362		#endif
1363		RE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );
1364	}
1365	#pragma unroll_loop_end
1366#endif
1367#if ( NUM_DIR_LIGHTS > 0 ) && defined( RE_Direct )
1368	DirectionalLight directionalLight;
1369	#if defined( USE_SHADOWMAP ) && NUM_DIR_LIGHT_SHADOWS > 0
1370	DirectionalLightShadow directionalLightShadow;
1371	#endif
1372	#pragma unroll_loop_start
1373	for ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {
1374		directionalLight = directionalLights[ i ];
1375		getDirectionalLightInfo( directionalLight, directLight );
1376		#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_DIR_LIGHT_SHADOWS )
1377		directionalLightShadow = directionalLightShadows[ i ];
1378		directLight.color *= ( directLight.visible && receiveShadow ) ? getShadow( directionalShadowMap[ i ], directionalLightShadow.shadowMapSize, directionalLightShadow.shadowIntensity, directionalLightShadow.shadowBias, directionalLightShadow.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;
1379		#endif
1380		RE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );
1381	}
1382	#pragma unroll_loop_end
1383#endif
1384#if ( NUM_RECT_AREA_LIGHTS > 0 ) && defined( RE_Direct_RectArea )
1385	RectAreaLight rectAreaLight;
1386	#pragma unroll_loop_start
1387	for ( int i = 0; i < NUM_RECT_AREA_LIGHTS; i ++ ) {
1388		rectAreaLight = rectAreaLights[ i ];
1389		RE_Direct_RectArea( rectAreaLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );
1390	}
1391	#pragma unroll_loop_end
1392#endif
1393#if defined( RE_IndirectDiffuse )
1394	vec3 iblIrradiance = vec3( 0.0 );
1395	vec3 irradiance = getAmbientLightIrradiance( ambientLightColor );
1396	#if defined( USE_LIGHT_PROBES )
1397		irradiance += getLightProbeIrradiance( lightProbe, geometryNormal );
1398	#endif
1399	#if ( NUM_HEMI_LIGHTS > 0 )
1400		#pragma unroll_loop_start
1401		for ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) {
1402			irradiance += getHemisphereLightIrradiance( hemisphereLights[ i ], geometryNormal );
1403		}
1404		#pragma unroll_loop_end
1405	#endif
1406#endif
1407#if defined( RE_IndirectSpecular )
1408	vec3 radiance = vec3( 0.0 );
1409	vec3 clearcoatRadiance = vec3( 0.0 );
1410#endif`,Fg=`#if defined( RE_IndirectDiffuse )
1411	#ifdef USE_LIGHTMAP
1412		vec4 lightMapTexel = texture2D( lightMap, vLightMapUv );
1413		vec3 lightMapIrradiance = lightMapTexel.rgb * lightMapIntensity;
1414		irradiance += lightMapIrradiance;
1415	#endif
1416	#if defined( USE_ENVMAP ) && defined( STANDARD ) && defined( ENVMAP_TYPE_CUBE_UV )
1417		iblIrradiance += getIBLIrradiance( geometryNormal );
1418	#endif
1419#endif
1420#if defined( USE_ENVMAP ) && defined( RE_IndirectSpecular )
1421	#ifdef USE_ANISOTROPY
1422		radiance += getIBLAnisotropyRadiance( geometryViewDir, geometryNormal, material.roughness, material.anisotropyB, material.anisotropy );
1423	#else
1424		radiance += getIBLRadiance( geometryViewDir, geometryNormal, material.roughness );
1425	#endif
1426	#ifdef USE_CLEARCOAT
1427		clearcoatRadiance += getIBLRadiance( geometryViewDir, geometryClearcoatNormal, material.clearcoatRoughness );
1428	#endif
1429#endif`,Og=`#if defined( RE_IndirectDiffuse )
1430	RE_IndirectDiffuse( irradiance, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );
1431#endif
1432#if defined( RE_IndirectSpecular )
1433	RE_IndirectSpecular( radiance, iblIrradiance, clearcoatRadiance, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );
1434#endif`,Bg=`#if defined( USE_LOGARITHMIC_DEPTH_BUFFER )
1435	gl_FragDepth = vIsPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;
1436#endif`,zg=`#if defined( USE_LOGARITHMIC_DEPTH_BUFFER )
1437	uniform float logDepthBufFC;
1438	varying float vFragDepth;
1439	varying float vIsPerspective;
1440#endif`,Vg=`#ifdef USE_LOGARITHMIC_DEPTH_BUFFER
1441	varying float vFragDepth;
1442	varying float vIsPerspective;
1443#endif`,kg=`#ifdef USE_LOGARITHMIC_DEPTH_BUFFER
1444	vFragDepth = 1.0 + gl_Position.w;
1445	vIsPerspective = float( isPerspectiveMatrix( projectionMatrix ) );
1446#endif`,Gg=`#ifdef USE_MAP
1447	vec4 sampledDiffuseColor = texture2D( map, vMapUv );
1448	#ifdef DECODE_VIDEO_TEXTURE
1449		sampledDiffuseColor = sRGBTransferEOTF( sampledDiffuseColor );
1450	#endif
1451	diffuseColor *= sampledDiffuseColor;
1452#endif`,Hg=`#ifdef USE_MAP
1453	uniform sampler2D map;
1454#endif`,Wg=`#if defined( USE_MAP ) || defined( USE_ALPHAMAP )
1455	#if defined( USE_POINTS_UV )
1456		vec2 uv = vUv;
1457	#else
1458		vec2 uv = ( uvTransform * vec3( gl_PointCoord.x, 1.0 - gl_PointCoord.y, 1 ) ).xy;
1459	#endif
1460#endif
1461#ifdef USE_MAP
1462	diffuseColor *= texture2D( map, uv );
1463#endif
1464#ifdef USE_ALPHAMAP
1465	diffuseColor.a *= texture2D( alphaMap, uv ).g;
1466#endif`,Xg=`#if defined( USE_POINTS_UV )
1467	varying vec2 vUv;
1468#else
1469	#if defined( USE_MAP ) || defined( USE_ALPHAMAP )
1470		uniform mat3 uvTransform;
1471	#endif
1472#endif
1473#ifdef USE_MAP
1474	uniform sampler2D map;
1475#endif
1476#ifdef USE_ALPHAMAP
1477	uniform sampler2D alphaMap;
1478#endif`,qg=`float metalnessFactor = metalness;
1479#ifdef USE_METALNESSMAP
1480	vec4 texelMetalness = texture2D( metalnessMap, vMetalnessMapUv );
1481	metalnessFactor *= texelMetalness.b;
1482#endif`,Yg=`#ifdef USE_METALNESSMAP
1483	uniform sampler2D metalnessMap;
1484#endif`,Zg=`#ifdef USE_INSTANCING_MORPH
1485	float morphTargetInfluences[ MORPHTARGETS_COUNT ];
1486	float morphTargetBaseInfluence = texelFetch( morphTexture, ivec2( 0, gl_InstanceID ), 0 ).r;
1487	for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {
1488		morphTargetInfluences[i] =  texelFetch( morphTexture, ivec2( i + 1, gl_InstanceID ), 0 ).r;
1489	}
1490#endif`,Jg=`#if defined( USE_MORPHCOLORS )
1491	vColor *= morphTargetBaseInfluence;
1492	for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {
1493		#if defined( USE_COLOR_ALPHA )
1494			if ( morphTargetInfluences[ i ] != 0.0 ) vColor += getMorph( gl_VertexID, i, 2 ) * morphTargetInfluences[ i ];
1495		#elif defined( USE_COLOR )
1496			if ( morphTargetInfluences[ i ] != 0.0 ) vColor += getMorph( gl_VertexID, i, 2 ).rgb * morphTargetInfluences[ i ];
1497		#endif
1498	}
1499#endif`,$g=`#ifdef USE_MORPHNORMALS
1500	objectNormal *= morphTargetBaseInfluence;
1501	for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {
1502		if ( morphTargetInfluences[ i ] != 0.0 ) objectNormal += getMorph( gl_VertexID, i, 1 ).xyz * morphTargetInfluences[ i ];
1503	}
1504#endif`,Kg=`#ifdef USE_MORPHTARGETS
1505	#ifndef USE_INSTANCING_MORPH
1506		uniform float morphTargetBaseInfluence;
1507		uniform float morphTargetInfluences[ MORPHTARGETS_COUNT ];
1508	#endif
1509	uniform sampler2DArray morphTargetsTexture;
1510	uniform ivec2 morphTargetsTextureSize;
1511	vec4 getMorph( const in int vertexIndex, const in int morphTargetIndex, const in int offset ) {
1512		int texelIndex = vertexIndex * MORPHTARGETS_TEXTURE_STRIDE + offset;
1513		int y = texelIndex / morphTargetsTextureSize.x;
1514		int x = texelIndex - y * morphTargetsTextureSize.x;
1515		ivec3 morphUV = ivec3( x, y, morphTargetIndex );
1516		return texelFetch( morphTargetsTexture, morphUV, 0 );
1517	}
1518#endif`,Qg=`#ifdef USE_MORPHTARGETS
1519	transformed *= morphTargetBaseInfluence;
1520	for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {
1521		if ( morphTargetInfluences[ i ] != 0.0 ) transformed += getMorph( gl_VertexID, i, 0 ).xyz * morphTargetInfluences[ i ];
1522	}
1523#endif`,jg=`float faceDirection = gl_FrontFacing ? 1.0 : - 1.0;
1524#ifdef FLAT_SHADED
1525	vec3 fdx = dFdx( vViewPosition );
1526	vec3 fdy = dFdy( vViewPosition );
1527	vec3 normal = normalize( cross( fdx, fdy ) );
1528#else
1529	vec3 normal = normalize( vNormal );
1530	#ifdef DOUBLE_SIDED
1531		normal *= faceDirection;
1532	#endif
1533#endif
1534#if defined( USE_NORMALMAP_TANGENTSPACE ) || defined( USE_CLEARCOAT_NORMALMAP ) || defined( USE_ANISOTROPY )
1535	#ifdef USE_TANGENT
1536		mat3 tbn = mat3( normalize( vTangent ), normalize( vBitangent ), normal );
1537	#else
1538		mat3 tbn = getTangentFrame( - vViewPosition, normal,
1539		#if defined( USE_NORMALMAP )
1540			vNormalMapUv
1541		#elif defined( USE_CLEARCOAT_NORMALMAP )
1542			vClearcoatNormalMapUv
1543		#else
1544			vUv
1545		#endif
1546		);
1547	#endif
1548	#if defined( DOUBLE_SIDED ) && ! defined( FLAT_SHADED )
1549		tbn[0] *= faceDirection;
1550		tbn[1] *= faceDirection;
1551	#endif
1552#endif
1553#ifdef USE_CLEARCOAT_NORMALMAP
1554	#ifdef USE_TANGENT
1555		mat3 tbn2 = mat3( normalize( vTangent ), normalize( vBitangent ), normal );
1556	#else
1557		mat3 tbn2 = getTangentFrame( - vViewPosition, normal, vClearcoatNormalMapUv );
1558	#endif
1559	#if defined( DOUBLE_SIDED ) && ! defined( FLAT_SHADED )
1560		tbn2[0] *= faceDirection;
1561		tbn2[1] *= faceDirection;
1562	#endif
1563#endif
1564vec3 nonPerturbedNormal = normal;`,e0=`#ifdef USE_NORMALMAP_OBJECTSPACE
1565	normal = texture2D( normalMap, vNormalMapUv ).xyz * 2.0 - 1.0;
1566	#ifdef FLIP_SIDED
1567		normal = - normal;
1568	#endif
1569	#ifdef DOUBLE_SIDED
1570		normal = normal * faceDirection;
1571	#endif
1572	normal = normalize( normalMatrix * normal );
1573#elif defined( USE_NORMALMAP_TANGENTSPACE )
1574	vec3 mapN = texture2D( normalMap, vNormalMapUv ).xyz * 2.0 - 1.0;
1575	mapN.xy *= normalScale;
1576	normal = normalize( tbn * mapN );
1577#elif defined( USE_BUMPMAP )
1578	normal = perturbNormalArb( - vViewPosition, normal, dHdxy_fwd(), faceDirection );
1579#endif`,t0=`#ifndef FLAT_SHADED
1580	varying vec3 vNormal;
1581	#ifdef USE_TANGENT
1582		varying vec3 vTangent;
1583		varying vec3 vBitangent;
1584	#endif
1585#endif`,n0=`#ifndef FLAT_SHADED
1586	varying vec3 vNormal;
1587	#ifdef USE_TANGENT
1588		varying vec3 vTangent;
1589		varying vec3 vBitangent;
1590	#endif
1591#endif`,i0=`#ifndef FLAT_SHADED
1592	vNormal = normalize( transformedNormal );
1593	#ifdef USE_TANGENT
1594		vTangent = normalize( transformedTangent );
1595		vBitangent = normalize( cross( vNormal, vTangent ) * tangent.w );
1596	#endif
1597#endif`,s0=`#ifdef USE_NORMALMAP
1598	uniform sampler2D normalMap;
1599	uniform vec2 normalScale;
1600#endif
1601#ifdef USE_NORMALMAP_OBJECTSPACE
1602	uniform mat3 normalMatrix;
1603#endif
1604#if ! defined ( USE_TANGENT ) && ( defined ( USE_NORMALMAP_TANGENTSPACE ) || defined ( USE_CLEARCOAT_NORMALMAP ) || defined( USE_ANISOTROPY ) )
1605	mat3 getTangentFrame( vec3 eye_pos, vec3 surf_norm, vec2 uv ) {
1606		vec3 q0 = dFdx( eye_pos.xyz );
1607		vec3 q1 = dFdy( eye_pos.xyz );
1608		vec2 st0 = dFdx( uv.st );
1609		vec2 st1 = dFdy( uv.st );
1610		vec3 N = surf_norm;
1611		vec3 q1perp = cross( q1, N );
1612		vec3 q0perp = cross( N, q0 );
1613		vec3 T = q1perp * st0.x + q0perp * st1.x;
1614		vec3 B = q1perp * st0.y + q0perp * st1.y;
1615		float det = max( dot( T, T ), dot( B, B ) );
1616		float scale = ( det == 0.0 ) ? 0.0 : inversesqrt( det );
1617		return mat3( T * scale, B * scale, N );
1618	}
1619#endif`,r0=`#ifdef USE_CLEARCOAT
1620	vec3 clearcoatNormal = nonPerturbedNormal;
1621#endif`,a0=`#ifdef USE_CLEARCOAT_NORMALMAP
1622	vec3 clearcoatMapN = texture2D( clearcoatNormalMap, vClearcoatNormalMapUv ).xyz * 2.0 - 1.0;
1623	clearcoatMapN.xy *= clearcoatNormalScale;
1624	clearcoatNormal = normalize( tbn2 * clearcoatMapN );
1625#endif`,o0=`#ifdef USE_CLEARCOATMAP
1626	uniform sampler2D clearcoatMap;
1627#endif
1628#ifdef USE_CLEARCOAT_NORMALMAP
1629	uniform sampler2D clearcoatNormalMap;
1630	uniform vec2 clearcoatNormalScale;
1631#endif
1632#ifdef USE_CLEARCOAT_ROUGHNESSMAP
1633	uniform sampler2D clearcoatRoughnessMap;
1634#endif`,l0=`#ifdef USE_IRIDESCENCEMAP
1635	uniform sampler2D iridescenceMap;
1636#endif
1637#ifdef USE_IRIDESCENCE_THICKNESSMAP
1638	uniform sampler2D iridescenceThicknessMap;
1639#endif`,c0=`#ifdef OPAQUE
1640diffuseColor.a = 1.0;
1641#endif
1642#ifdef USE_TRANSMISSION
1643diffuseColor.a *= material.transmissionAlpha;
1644#endif
1645gl_FragColor = vec4( outgoingLight, diffuseColor.a );`,h0=`vec3 packNormalToRGB( const in vec3 normal ) {
1646	return normalize( normal ) * 0.5 + 0.5;
1647}
1648vec3 unpackRGBToNormal( const in vec3 rgb ) {
1649	return 2.0 * rgb.xyz - 1.0;
1650}
1651const float PackUpscale = 256. / 255.;const float UnpackDownscale = 255. / 256.;const float ShiftRight8 = 1. / 256.;
1652const float Inv255 = 1. / 255.;
1653const vec4 PackFactors = vec4( 1.0, 256.0, 256.0 * 256.0, 256.0 * 256.0 * 256.0 );
1654const vec2 UnpackFactors2 = vec2( UnpackDownscale, 1.0 / PackFactors.g );
1655const vec3 UnpackFactors3 = vec3( UnpackDownscale / PackFactors.rg, 1.0 / PackFactors.b );
1656const vec4 UnpackFactors4 = vec4( UnpackDownscale / PackFactors.rgb, 1.0 / PackFactors.a );
1657vec4 packDepthToRGBA( const in float v ) {
1658	if( v <= 0.0 )
1659		return vec4( 0., 0., 0., 0. );
1660	if( v >= 1.0 )
1661		return vec4( 1., 1., 1., 1. );
1662	float vuf;
1663	float af = modf( v * PackFactors.a, vuf );
1664	float bf = modf( vuf * ShiftRight8, vuf );
1665	float gf = modf( vuf * ShiftRight8, vuf );
1666	return vec4( vuf * Inv255, gf * PackUpscale, bf * PackUpscale, af );
1667}
1668vec3 packDepthToRGB( const in float v ) {
1669	if( v <= 0.0 )
1670		return vec3( 0., 0., 0. );
1671	if( v >= 1.0 )
1672		return vec3( 1., 1., 1. );
1673	float vuf;
1674	float bf = modf( v * PackFactors.b, vuf );
1675	float gf = modf( vuf * ShiftRight8, vuf );
1676	return vec3( vuf * Inv255, gf * PackUpscale, bf );
1677}
1678vec2 packDepthToRG( const in float v ) {
1679	if( v <= 0.0 )
1680		return vec2( 0., 0. );
1681	if( v >= 1.0 )
1682		return vec2( 1., 1. );
1683	float vuf;
1684	float gf = modf( v * 256., vuf );
1685	return vec2( vuf * Inv255, gf );
1686}
1687float unpackRGBAToDepth( const in vec4 v ) {
1688	return dot( v, UnpackFactors4 );
1689}
1690float unpackRGBToDepth( const in vec3 v ) {
1691	return dot( v, UnpackFactors3 );
1692}
1693float unpackRGToDepth( const in vec2 v ) {
1694	return v.r * UnpackFactors2.r + v.g * UnpackFactors2.g;
1695}
1696vec4 pack2HalfToRGBA( const in vec2 v ) {
1697	vec4 r = vec4( v.x, fract( v.x * 255.0 ), v.y, fract( v.y * 255.0 ) );
1698	return vec4( r.x - r.y / 255.0, r.y, r.z - r.w / 255.0, r.w );
1699}
1700vec2 unpackRGBATo2Half( const in vec4 v ) {
1701	return vec2( v.x + ( v.y / 255.0 ), v.z + ( v.w / 255.0 ) );
1702}
1703float viewZToOrthographicDepth( const in float viewZ, const in float near, const in float far ) {
1704	return ( viewZ + near ) / ( near - far );
1705}
1706float orthographicDepthToViewZ( const in float depth, const in float near, const in float far ) {
1707	return depth * ( near - far ) - near;
1708}
1709float viewZToPerspectiveDepth( const in float viewZ, const in float near, const in float far ) {
1710	return ( ( near + viewZ ) * far ) / ( ( far - near ) * viewZ );
1711}
1712float perspectiveDepthToViewZ( const in float depth, const in float near, const in float far ) {
1713	return ( near * far ) / ( ( far - near ) * depth - far );
1714}`,u0=`#ifdef PREMULTIPLIED_ALPHA
1715	gl_FragColor.rgb *= gl_FragColor.a;
1716#endif`,d0=`vec4 mvPosition = vec4( transformed, 1.0 );
1717#ifdef USE_BATCHING
1718	mvPosition = batchingMatrix * mvPosition;
1719#endif
1720#ifdef USE_INSTANCING
1721	mvPosition = instanceMatrix * mvPosition;
1722#endif
1723mvPosition = modelViewMatrix * mvPosition;
1724gl_Position = projectionMatrix * mvPosition;`,f0=`#ifdef DITHERING
1725	gl_FragColor.rgb = dithering( gl_FragColor.rgb );
1726#endif`,p0=`#ifdef DITHERING
1727	vec3 dithering( vec3 color ) {
1728		float grid_position = rand( gl_FragCoord.xy );
1729		vec3 dither_shift_RGB = vec3( 0.25 / 255.0, -0.25 / 255.0, 0.25 / 255.0 );
1730		dither_shift_RGB = mix( 2.0 * dither_shift_RGB, -2.0 * dither_shift_RGB, grid_position );
1731		return color + dither_shift_RGB;
1732	}
1733#endif`,m0=`float roughnessFactor = roughness;
1734#ifdef USE_ROUGHNESSMAP
1735	vec4 texelRoughness = texture2D( roughnessMap, vRoughnessMapUv );
1736	roughnessFactor *= texelRoughness.g;
1737#endif`,g0=`#ifdef USE_ROUGHNESSMAP
1738	uniform sampler2D roughnessMap;
1739#endif`,_0=`#if NUM_SPOT_LIGHT_COORDS > 0
1740	varying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ];
1741#endif
1742#if NUM_SPOT_LIGHT_MAPS > 0
1743	uniform sampler2D spotLightMap[ NUM_SPOT_LIGHT_MAPS ];
1744#endif
1745#ifdef USE_SHADOWMAP
1746	#if NUM_DIR_LIGHT_SHADOWS > 0
1747		#if defined( SHADOWMAP_TYPE_PCF )
1748			uniform sampler2DShadow directionalShadowMap[ NUM_DIR_LIGHT_SHADOWS ];
1749		#else
1750			uniform sampler2D directionalShadowMap[ NUM_DIR_LIGHT_SHADOWS ];
1751		#endif
1752		varying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ];
1753		struct DirectionalLightShadow {
1754			float shadowIntensity;
1755			float shadowBias;
1756			float shadowNormalBias;
1757			float shadowRadius;
1758			vec2 shadowMapSize;
1759		};
1760		uniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ];
1761	#endif
1762	#if NUM_SPOT_LIGHT_SHADOWS > 0
1763		#if defined( SHADOWMAP_TYPE_PCF )
1764			uniform sampler2DShadow spotShadowMap[ NUM_SPOT_LIGHT_SHADOWS ];
1765		#else
1766			uniform sampler2D spotShadowMap[ NUM_SPOT_LIGHT_SHADOWS ];
1767		#endif
1768		struct SpotLightShadow {
1769			float shadowIntensity;
1770			float shadowBias;
1771			float shadowNormalBias;
1772			float shadowRadius;
1773			vec2 shadowMapSize;
1774		};
1775		uniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ];
1776	#endif
1777	#if NUM_POINT_LIGHT_SHADOWS > 0
1778		#if defined( SHADOWMAP_TYPE_PCF )
1779			uniform samplerCubeShadow pointShadowMap[ NUM_POINT_LIGHT_SHADOWS ];
1780		#elif defined( SHADOWMAP_TYPE_BASIC )
1781			uniform samplerCube pointShadowMap[ NUM_POINT_LIGHT_SHADOWS ];
1782		#endif
1783		varying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ];
1784		struct PointLightShadow {
1785			float shadowIntensity;
1786			float shadowBias;
1787			float shadowNormalBias;
1788			float shadowRadius;
1789			vec2 shadowMapSize;
1790			float shadowCameraNear;
1791			float shadowCameraFar;
1792		};
1793		uniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ];
1794	#endif
1795	#if defined( SHADOWMAP_TYPE_PCF )
1796		float interleavedGradientNoise( vec2 position ) {
1797			return fract( 52.9829189 * fract( dot( position, vec2( 0.06711056, 0.00583715 ) ) ) );
1798		}
1799		vec2 vogelDiskSample( int sampleIndex, int samplesCount, float phi ) {
1800			const float goldenAngle = 2.399963229728653;
1801			float r = sqrt( ( float( sampleIndex ) + 0.5 ) / float( samplesCount ) );
1802			float theta = float( sampleIndex ) * goldenAngle + phi;
1803			return vec2( cos( theta ), sin( theta ) ) * r;
1804		}
1805	#endif
1806	#if defined( SHADOWMAP_TYPE_PCF )
1807		float getShadow( sampler2DShadow shadowMap, vec2 shadowMapSize, float shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord ) {
1808			float shadow = 1.0;
1809			shadowCoord.xyz /= shadowCoord.w;
1810			shadowCoord.z += shadowBias;
1811			bool inFrustum = shadowCoord.x >= 0.0 && shadowCoord.x <= 1.0 && shadowCoord.y >= 0.0 && shadowCoord.y <= 1.0;
1812			bool frustumTest = inFrustum && shadowCoord.z <= 1.0;
1813			if ( frustumTest ) {
1814				vec2 texelSize = vec2( 1.0 ) / shadowMapSize;
1815				float radius = shadowRadius * texelSize.x;
1816				float phi = interleavedGradientNoise( gl_FragCoord.xy ) * 6.28318530718;
1817				shadow = (
1818					texture( shadowMap, vec3( shadowCoord.xy + vogelDiskSample( 0, 5, phi ) * radius, shadowCoord.z ) ) +
1819					texture( shadowMap, vec3( shadowCoord.xy + vogelDiskSample( 1, 5, phi ) * radius, shadowCoord.z ) ) +
1820					texture( shadowMap, vec3( shadowCoord.xy + vogelDiskSample( 2, 5, phi ) * radius, shadowCoord.z ) ) +
1821					texture( shadowMap, vec3( shadowCoord.xy + vogelDiskSample( 3, 5, phi ) * radius, shadowCoord.z ) ) +
1822					texture( shadowMap, vec3( shadowCoord.xy + vogelDiskSample( 4, 5, phi ) * radius, shadowCoord.z ) )
1823				) * 0.2;
1824			}
1825			return mix( 1.0, shadow, shadowIntensity );
1826		}
1827	#elif defined( SHADOWMAP_TYPE_VSM )
1828		float getShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord ) {
1829			float shadow = 1.0;
1830			shadowCoord.xyz /= shadowCoord.w;
1831			shadowCoord.z += shadowBias;
1832			bool inFrustum = shadowCoord.x >= 0.0 && shadowCoord.x <= 1.0 && shadowCoord.y >= 0.0 && shadowCoord.y <= 1.0;
1833			bool frustumTest = inFrustum && shadowCoord.z <= 1.0;
1834			if ( frustumTest ) {
1835				vec2 distribution = texture2D( shadowMap, shadowCoord.xy ).rg;
1836				float mean = distribution.x;
1837				float variance = distribution.y * distribution.y;
1838				#ifdef USE_REVERSED_DEPTH_BUFFER
1839					float hard_shadow = step( mean, shadowCoord.z );
1840				#else
1841					float hard_shadow = step( shadowCoord.z, mean );
1842				#endif
1843				if ( hard_shadow == 1.0 ) {
1844					shadow = 1.0;
1845				} else {
1846					variance = max( variance, 0.0000001 );
1847					float d = shadowCoord.z - mean;
1848					float p_max = variance / ( variance + d * d );
1849					p_max = clamp( ( p_max - 0.3 ) / 0.65, 0.0, 1.0 );
1850					shadow = max( hard_shadow, p_max );
1851				}
1852			}
1853			return mix( 1.0, shadow, shadowIntensity );
1854		}
1855	#else
1856		float getShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord ) {
1857			float shadow = 1.0;
1858			shadowCoord.xyz /= shadowCoord.w;
1859			shadowCoord.z += shadowBias;
1860			bool inFrustum = shadowCoord.x >= 0.0 && shadowCoord.x <= 1.0 && shadowCoord.y >= 0.0 && shadowCoord.y <= 1.0;
1861			bool frustumTest = inFrustum && shadowCoord.z <= 1.0;
1862			if ( frustumTest ) {
1863				float depth = texture2D( shadowMap, shadowCoord.xy ).r;
1864				#ifdef USE_REVERSED_DEPTH_BUFFER
1865					shadow = step( depth, shadowCoord.z );
1866				#else
1867					shadow = step( shadowCoord.z, depth );
1868				#endif
1869			}
1870			return mix( 1.0, shadow, shadowIntensity );
1871		}
1872	#endif
1873	#if NUM_POINT_LIGHT_SHADOWS > 0
1874	#if defined( SHADOWMAP_TYPE_PCF )
1875	float getPointShadow( samplerCubeShadow shadowMap, vec2 shadowMapSize, float shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord, float shadowCameraNear, float shadowCameraFar ) {
1876		float shadow = 1.0;
1877		vec3 lightToPosition = shadowCoord.xyz;
1878		vec3 bd3D = normalize( lightToPosition );
1879		vec3 absVec = abs( lightToPosition );
1880		float viewSpaceZ = max( max( absVec.x, absVec.y ), absVec.z );
1881		if ( viewSpaceZ - shadowCameraFar <= 0.0 && viewSpaceZ - shadowCameraNear >= 0.0 ) {
1882			float dp = ( shadowCameraFar * ( viewSpaceZ - shadowCameraNear ) ) / ( viewSpaceZ * ( shadowCameraFar - shadowCameraNear ) );
1883			dp += shadowBias;
1884			float texelSize = shadowRadius / shadowMapSize.x;
1885			vec3 absDir = abs( bd3D );
1886			vec3 tangent = absDir.x > absDir.z ? vec3( 0.0, 1.0, 0.0 ) : vec3( 1.0, 0.0, 0.0 );
1887			tangent = normalize( cross( bd3D, tangent ) );
1888			vec3 bitangent = cross( bd3D, tangent );
1889			float phi = interleavedGradientNoise( gl_FragCoord.xy ) * 6.28318530718;
1890			shadow = (
1891				texture( shadowMap, vec4( bd3D + ( tangent * vogelDiskSample( 0, 5, phi ).x + bitangent * vogelDiskSample( 0, 5, phi ).y ) * texelSize, dp ) ) +
1892				texture( shadowMap, vec4( bd3D + ( tangent * vogelDiskSample( 1, 5, phi ).x + bitangent * vogelDiskSample( 1, 5, phi ).y ) * texelSize, dp ) ) +
1893				texture( shadowMap, vec4( bd3D + ( tangent * vogelDiskSample( 2, 5, phi ).x + bitangent * vogelDiskSample( 2, 5, phi ).y ) * texelSize, dp ) ) +
1894				texture( shadowMap, vec4( bd3D + ( tangent * vogelDiskSample( 3, 5, phi ).x + bitangent * vogelDiskSample( 3, 5, phi ).y ) * texelSize, dp ) ) +
1895				texture( shadowMap, vec4( bd3D + ( tangent * vogelDiskSample( 4, 5, phi ).x + bitangent * vogelDiskSample( 4, 5, phi ).y ) * texelSize, dp ) )
1896			) * 0.2;
1897		}
1898		return mix( 1.0, shadow, shadowIntensity );
1899	}
1900	#elif defined( SHADOWMAP_TYPE_BASIC )
1901	float getPointShadow( samplerCube shadowMap, vec2 shadowMapSize, float shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord, float shadowCameraNear, float shadowCameraFar ) {
1902		float shadow = 1.0;
1903		vec3 lightToPosition = shadowCoord.xyz;
1904		vec3 bd3D = normalize( lightToPosition );
1905		vec3 absVec = abs( lightToPosition );
1906		float viewSpaceZ = max( max( absVec.x, absVec.y ), absVec.z );
1907		if ( viewSpaceZ - shadowCameraFar <= 0.0 && viewSpaceZ - shadowCameraNear >= 0.0 ) {
1908			float dp = ( shadowCameraFar * ( viewSpaceZ - shadowCameraNear ) ) / ( viewSpaceZ * ( shadowCameraFar - shadowCameraNear ) );
1909			dp += shadowBias;
1910			float depth = textureCube( shadowMap, bd3D ).r;
1911			#ifdef USE_REVERSED_DEPTH_BUFFER
1912				shadow = step( depth, dp );
1913			#else
1914				shadow = step( dp, depth );
1915			#endif
1916		}
1917		return mix( 1.0, shadow, shadowIntensity );
1918	}
1919	#endif
1920	#endif
1921#endif`,x0=`#if NUM_SPOT_LIGHT_COORDS > 0
1922	uniform mat4 spotLightMatrix[ NUM_SPOT_LIGHT_COORDS ];
1923	varying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ];
1924#endif
1925#ifdef USE_SHADOWMAP
1926	#if NUM_DIR_LIGHT_SHADOWS > 0
1927		uniform mat4 directionalShadowMatrix[ NUM_DIR_LIGHT_SHADOWS ];
1928		varying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ];
1929		struct DirectionalLightShadow {
1930			float shadowIntensity;
1931			float shadowBias;
1932			float shadowNormalBias;
1933			float shadowRadius;
1934			vec2 shadowMapSize;
1935		};
1936		uniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ];
1937	#endif
1938	#if NUM_SPOT_LIGHT_SHADOWS > 0
1939		struct SpotLightShadow {
1940			float shadowIntensity;
1941			float shadowBias;
1942			float shadowNormalBias;
1943			float shadowRadius;
1944			vec2 shadowMapSize;
1945		};
1946		uniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ];
1947	#endif
1948	#if NUM_POINT_LIGHT_SHADOWS > 0
1949		uniform mat4 pointShadowMatrix[ NUM_POINT_LIGHT_SHADOWS ];
1950		varying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ];
1951		struct PointLightShadow {
1952			float shadowIntensity;
1953			float shadowBias;
1954			float shadowNormalBias;
1955			float shadowRadius;
1956			vec2 shadowMapSize;
1957			float shadowCameraNear;
1958			float shadowCameraFar;
1959		};
1960		uniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ];
1961	#endif
1962#endif`,v0=`#if ( defined( USE_SHADOWMAP ) && ( NUM_DIR_LIGHT_SHADOWS > 0 || NUM_POINT_LIGHT_SHADOWS > 0 ) ) || ( NUM_SPOT_LIGHT_COORDS > 0 )
1963	vec3 shadowWorldNormal = inverseTransformDirection( transformedNormal, viewMatrix );
1964	vec4 shadowWorldPosition;
1965#endif
1966#if defined( USE_SHADOWMAP )
1967	#if NUM_DIR_LIGHT_SHADOWS > 0
1968		#pragma unroll_loop_start
1969		for ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) {
1970			shadowWorldPosition = worldPosition + vec4( shadowWorldNormal * directionalLightShadows[ i ].shadowNormalBias, 0 );
1971			vDirectionalShadowCoord[ i ] = directionalShadowMatrix[ i ] * shadowWorldPosition;
1972		}
1973		#pragma unroll_loop_end
1974	#endif
1975	#if NUM_POINT_LIGHT_SHADOWS > 0
1976		#pragma unroll_loop_start
1977		for ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) {
1978			shadowWorldPosition = worldPosition + vec4( shadowWorldNormal * pointLightShadows[ i ].shadowNormalBias, 0 );
1979			vPointShadowCoord[ i ] = pointShadowMatrix[ i ] * shadowWorldPosition;
1980		}
1981		#pragma unroll_loop_end
1982	#endif
1983#endif
1984#if NUM_SPOT_LIGHT_COORDS > 0
1985	#pragma unroll_loop_start
1986	for ( int i = 0; i < NUM_SPOT_LIGHT_COORDS; i ++ ) {
1987		shadowWorldPosition = worldPosition;
1988		#if ( defined( USE_SHADOWMAP ) && UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )
1989			shadowWorldPosition.xyz += shadowWorldNormal * spotLightShadows[ i ].shadowNormalBias;
1990		#endif
1991		vSpotLightCoord[ i ] = spotLightMatrix[ i ] * shadowWorldPosition;
1992	}
1993	#pragma unroll_loop_end
1994#endif`,y0=`float getShadowMask() {
1995	float shadow = 1.0;
1996	#ifdef USE_SHADOWMAP
1997	#if NUM_DIR_LIGHT_SHADOWS > 0
1998	DirectionalLightShadow directionalLight;
1999	#pragma unroll_loop_start
2000	for ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) {
2001		directionalLight = directionalLightShadows[ i ];
2002		shadow *= receiveShadow ? getShadow( directionalShadowMap[ i ], directionalLight.shadowMapSize, directionalLight.shadowIntensity, directionalLight.shadowBias, directionalLight.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;
2003	}
2004	#pragma unroll_loop_end
2005	#endif
2006	#if NUM_SPOT_LIGHT_SHADOWS > 0
2007	SpotLightShadow spotLight;
2008	#pragma unroll_loop_start
2009	for ( int i = 0; i < NUM_SPOT_LIGHT_SHADOWS; i ++ ) {
2010		spotLight = spotLightShadows[ i ];
2011		shadow *= receiveShadow ? getShadow( spotShadowMap[ i ], spotLight.shadowMapSize, spotLight.shadowIntensity, spotLight.shadowBias, spotLight.shadowRadius, vSpotLightCoord[ i ] ) : 1.0;
2012	}
2013	#pragma unroll_loop_end
2014	#endif
2015	#if NUM_POINT_LIGHT_SHADOWS > 0 && ( defined( SHADOWMAP_TYPE_PCF ) || defined( SHADOWMAP_TYPE_BASIC ) )
2016	PointLightShadow pointLight;
2017	#pragma unroll_loop_start
2018	for ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) {
2019		pointLight = pointLightShadows[ i ];
2020		shadow *= receiveShadow ? getPointShadow( pointShadowMap[ i ], pointLight.shadowMapSize, pointLight.shadowIntensity, pointLight.shadowBias, pointLight.shadowRadius, vPointShadowCoord[ i ], pointLight.shadowCameraNear, pointLight.shadowCameraFar ) : 1.0;
2021	}
2022	#pragma unroll_loop_end
2023	#endif
2024	#endif
2025	return shadow;
2026}`,M0=`#ifdef USE_SKINNING
2027	mat4 boneMatX = getBoneMatrix( skinIndex.x );
2028	mat4 boneMatY = getBoneMatrix( skinIndex.y );
2029	mat4 boneMatZ = getBoneMatrix( skinIndex.z );
2030	mat4 boneMatW = getBoneMatrix( skinIndex.w );
2031#endif`,S0=`#ifdef USE_SKINNING
2032	uniform mat4 bindMatrix;
2033	uniform mat4 bindMatrixInverse;
2034	uniform highp sampler2D boneTexture;
2035	mat4 getBoneMatrix( const in float i ) {
2036		int size = textureSize( boneTexture, 0 ).x;
2037		int j = int( i ) * 4;
2038		int x = j % size;
2039		int y = j / size;
2040		vec4 v1 = texelFetch( boneTexture, ivec2( x, y ), 0 );
2041		vec4 v2 = texelFetch( boneTexture, ivec2( x + 1, y ), 0 );
2042		vec4 v3 = texelFetch( boneTexture, ivec2( x + 2, y ), 0 );
2043		vec4 v4 = texelFetch( boneTexture, ivec2( x + 3, y ), 0 );
2044		return mat4( v1, v2, v3, v4 );
2045	}
2046#endif`,b0=`#ifdef USE_SKINNING
2047	vec4 skinVertex = bindMatrix * vec4( transformed, 1.0 );
2048	vec4 skinned = vec4( 0.0 );
2049	skinned += boneMatX * skinVertex * skinWeight.x;
2050	skinned += boneMatY * skinVertex * skinWeight.y;
2051	skinned += boneMatZ * skinVertex * skinWeight.z;
2052	skinned += boneMatW * skinVertex * skinWeight.w;
2053	transformed = ( bindMatrixInverse * skinned ).xyz;
2054#endif`,A0=`#ifdef USE_SKINNING
2055	mat4 skinMatrix = mat4( 0.0 );
2056	skinMatrix += skinWeight.x * boneMatX;
2057	skinMatrix += skinWeight.y * boneMatY;
2058	skinMatrix += skinWeight.z * boneMatZ;
2059	skinMatrix += skinWeight.w * boneMatW;
2060	skinMatrix = bindMatrixInverse * skinMatrix * bindMatrix;
2061	objectNormal = vec4( skinMatrix * vec4( objectNormal, 0.0 ) ).xyz;
2062	#ifdef USE_TANGENT
2063		objectTangent = vec4( skinMatrix * vec4( objectTangent, 0.0 ) ).xyz;
2064	#endif
2065#endif`,T0=`float specularStrength;
2066#ifdef USE_SPECULARMAP
2067	vec4 texelSpecular = texture2D( specularMap, vSpecularMapUv );
2068	specularStrength = texelSpecular.r;
2069#else
2070	specularStrength = 1.0;
2071#endif`,E0=`#ifdef USE_SPECULARMAP
2072	uniform sampler2D specularMap;
2073#endif`,w0=`#if defined( TONE_MAPPING )
2074	gl_FragColor.rgb = toneMapping( gl_FragColor.rgb );
2075#endif`,C0=`#ifndef saturate
2076#define saturate( a ) clamp( a, 0.0, 1.0 )
2077#endif
2078uniform float toneMappingExposure;
2079vec3 LinearToneMapping( vec3 color ) {
2080	return saturate( toneMappingExposure * color );
2081}
2082vec3 ReinhardToneMapping( vec3 color ) {
2083	color *= toneMappingExposure;
2084	return saturate( color / ( vec3( 1.0 ) + color ) );
2085}
2086vec3 CineonToneMapping( vec3 color ) {
2087	color *= toneMappingExposure;
2088	color = max( vec3( 0.0 ), color - 0.004 );
2089	return pow( ( color * ( 6.2 * color + 0.5 ) ) / ( color * ( 6.2 * color + 1.7 ) + 0.06 ), vec3( 2.2 ) );
2090}
2091vec3 RRTAndODTFit( vec3 v ) {
2092	vec3 a = v * ( v + 0.0245786 ) - 0.000090537;
2093	vec3 b = v * ( 0.983729 * v + 0.4329510 ) + 0.238081;
2094	return a / b;
2095}
2096vec3 ACESFilmicToneMapping( vec3 color ) {
2097	const mat3 ACESInputMat = mat3(
2098		vec3( 0.59719, 0.07600, 0.02840 ),		vec3( 0.35458, 0.90834, 0.13383 ),
2099		vec3( 0.04823, 0.01566, 0.83777 )
2100	);
2101	const mat3 ACESOutputMat = mat3(
2102		vec3(  1.60475, -0.10208, -0.00327 ),		vec3( -0.53108,  1.10813, -0.07276 ),
2103		vec3( -0.07367, -0.00605,  1.07602 )
2104	);
2105	color *= toneMappingExposure / 0.6;
2106	color = ACESInputMat * color;
2107	color = RRTAndODTFit( color );
2108	color = ACESOutputMat * color;
2109	return saturate( color );
2110}
2111const mat3 LINEAR_REC2020_TO_LINEAR_SRGB = mat3(
2112	vec3( 1.6605, - 0.1246, - 0.0182 ),
2113	vec3( - 0.5876, 1.1329, - 0.1006 ),
2114	vec3( - 0.0728, - 0.0083, 1.1187 )
2115);
2116const mat3 LINEAR_SRGB_TO_LINEAR_REC2020 = mat3(
2117	vec3( 0.6274, 0.0691, 0.0164 ),
2118	vec3( 0.3293, 0.9195, 0.0880 ),
2119	vec3( 0.0433, 0.0113, 0.8956 )
2120);
2121vec3 agxDefaultContrastApprox( vec3 x ) {
2122	vec3 x2 = x * x;
2123	vec3 x4 = x2 * x2;
2124	return + 15.5 * x4 * x2
2125		- 40.14 * x4 * x
2126		+ 31.96 * x4
2127		- 6.868 * x2 * x
2128		+ 0.4298 * x2
2129		+ 0.1191 * x
2130		- 0.00232;
2131}
2132vec3 AgXToneMapping( vec3 color ) {
2133	const mat3 AgXInsetMatrix = mat3(
2134		vec3( 0.856627153315983, 0.137318972929847, 0.11189821299995 ),
2135		vec3( 0.0951212405381588, 0.761241990602591, 0.0767994186031903 ),
2136		vec3( 0.0482516061458583, 0.101439036467562, 0.811302368396859 )
2137	);
2138	const mat3 AgXOutsetMatrix = mat3(
2139		vec3( 1.1271005818144368, - 0.1413297634984383, - 0.14132976349843826 ),
2140		vec3( - 0.11060664309660323, 1.157823702216272, - 0.11060664309660294 ),
2141		vec3( - 0.016493938717834573, - 0.016493938717834257, 1.2519364065950405 )
2142	);
2143	const float AgxMinEv = - 12.47393;	const float AgxMaxEv = 4.026069;
2144	color *= toneMappingExposure;
2145	color = LINEAR_SRGB_TO_LINEAR_REC2020 * color;
2146	color = AgXInsetMatrix * color;
2147	color = max( color, 1e-10 );	color = log2( color );
2148	color = ( color - AgxMinEv ) / ( AgxMaxEv - AgxMinEv );
2149	color = clamp( color, 0.0, 1.0 );
2150	color = agxDefaultContrastApprox( color );
2151	color = AgXOutsetMatrix * color;
2152	color = pow( max( vec3( 0.0 ), color ), vec3( 2.2 ) );
2153	color = LINEAR_REC2020_TO_LINEAR_SRGB * color;
2154	color = clamp( color, 0.0, 1.0 );
2155	return color;
2156}
2157vec3 NeutralToneMapping( vec3 color ) {
2158	const float StartCompression = 0.8 - 0.04;
2159	const float Desaturation = 0.15;
2160	color *= toneMappingExposure;
2161	float x = min( color.r, min( color.g, color.b ) );
2162	float offset = x < 0.08 ? x - 6.25 * x * x : 0.04;
2163	color -= offset;
2164	float peak = max( color.r, max( color.g, color.b ) );
2165	if ( peak < StartCompression ) return color;
2166	float d = 1. - StartCompression;
2167	float newPeak = 1. - d * d / ( peak + d - StartCompression );
2168	color *= newPeak / peak;
2169	float g = 1. - 1. / ( Desaturation * ( peak - newPeak ) + 1. );
2170	return mix( color, vec3( newPeak ), g );
2171}
2172vec3 CustomToneMapping( vec3 color ) { return color; }`,R0=`#ifdef USE_TRANSMISSION
2173	material.transmission = transmission;
2174	material.transmissionAlpha = 1.0;
2175	material.thickness = thickness;
2176	material.attenuationDistance = attenuationDistance;
2177	material.attenuationColor = attenuationColor;
2178	#ifdef USE_TRANSMISSIONMAP
2179		material.transmission *= texture2D( transmissionMap, vTransmissionMapUv ).r;
2180	#endif
2181	#ifdef USE_THICKNESSMAP
2182		material.thickness *= texture2D( thicknessMap, vThicknessMapUv ).g;
2183	#endif
2184	vec3 pos = vWorldPosition;
2185	vec3 v = normalize( cameraPosition - pos );
2186	vec3 n = inverseTransformDirection( normal, viewMatrix );
2187	vec4 transmitted = getIBLVolumeRefraction(
2188		n, v, material.roughness, material.diffuseContribution, material.specularColorBlended, material.specularF90,
2189		pos, modelMatrix, viewMatrix, projectionMatrix, material.dispersion, material.ior, material.thickness,
2190		material.attenuationColor, material.attenuationDistance );
2191	material.transmissionAlpha = mix( material.transmissionAlpha, transmitted.a, material.transmission );
2192	totalDiffuse = mix( totalDiffuse, transmitted.rgb, material.transmission );
2193#endif`,I0=`#ifdef USE_TRANSMISSION
2194	uniform float transmission;
2195	uniform float thickness;
2196	uniform float attenuationDistance;
2197	uniform vec3 attenuationColor;
2198	#ifdef USE_TRANSMISSIONMAP
2199		uniform sampler2D transmissionMap;
2200	#endif
2201	#ifdef USE_THICKNESSMAP
2202		uniform sampler2D thicknessMap;
2203	#endif
2204	uniform vec2 transmissionSamplerSize;
2205	uniform sampler2D transmissionSamplerMap;
2206	uniform mat4 modelMatrix;
2207	uniform mat4 projectionMatrix;
2208	varying vec3 vWorldPosition;
2209	float w0( float a ) {
2210		return ( 1.0 / 6.0 ) * ( a * ( a * ( - a + 3.0 ) - 3.0 ) + 1.0 );
2211	}
2212	float w1( float a ) {
2213		return ( 1.0 / 6.0 ) * ( a *  a * ( 3.0 * a - 6.0 ) + 4.0 );
2214	}
2215	float w2( float a ){
2216		return ( 1.0 / 6.0 ) * ( a * ( a * ( - 3.0 * a + 3.0 ) + 3.0 ) + 1.0 );
2217	}
2218	float w3( float a ) {
2219		return ( 1.0 / 6.0 ) * ( a * a * a );
2220	}
2221	float g0( float a ) {
2222		return w0( a ) + w1( a );
2223	}
2224	float g1( float a ) {
2225		return w2( a ) + w3( a );
2226	}
2227	float h0( float a ) {
2228		return - 1.0 + w1( a ) / ( w0( a ) + w1( a ) );
2229	}
2230	float h1( float a ) {
2231		return 1.0 + w3( a ) / ( w2( a ) + w3( a ) );
2232	}
2233	vec4 bicubic( sampler2D tex, vec2 uv, vec4 texelSize, float lod ) {
2234		uv = uv * texelSize.zw + 0.5;
2235		vec2 iuv = floor( uv );
2236		vec2 fuv = fract( uv );
2237		float g0x = g0( fuv.x );
2238		float g1x = g1( fuv.x );
2239		float h0x = h0( fuv.x );
2240		float h1x = h1( fuv.x );
2241		float h0y = h0( fuv.y );
2242		float h1y = h1( fuv.y );
2243		vec2 p0 = ( vec2( iuv.x + h0x, iuv.y + h0y ) - 0.5 ) * texelSize.xy;
2244		vec2 p1 = ( vec2( iuv.x + h1x, iuv.y + h0y ) - 0.5 ) * texelSize.xy;
2245		vec2 p2 = ( vec2( iuv.x + h0x, iuv.y + h1y ) - 0.5 ) * texelSize.xy;
2246		vec2 p3 = ( vec2( iuv.x + h1x, iuv.y + h1y ) - 0.5 ) * texelSize.xy;
2247		return g0( fuv.y ) * ( g0x * textureLod( tex, p0, lod ) + g1x * textureLod( tex, p1, lod ) ) +
2248			g1( fuv.y ) * ( g0x * textureLod( tex, p2, lod ) + g1x * textureLod( tex, p3, lod ) );
2249	}
2250	vec4 textureBicubic( sampler2D sampler, vec2 uv, float lod ) {
2251		vec2 fLodSize = vec2( textureSize( sampler, int( lod ) ) );
2252		vec2 cLodSize = vec2( textureSize( sampler, int( lod + 1.0 ) ) );
2253		vec2 fLodSizeInv = 1.0 / fLodSize;
2254		vec2 cLodSizeInv = 1.0 / cLodSize;
2255		vec4 fSample = bicubic( sampler, uv, vec4( fLodSizeInv, fLodSize ), floor( lod ) );
2256		vec4 cSample = bicubic( sampler, uv, vec4( cLodSizeInv, cLodSize ), ceil( lod ) );
2257		return mix( fSample, cSample, fract( lod ) );
2258	}
2259	vec3 getVolumeTransmissionRay( const in vec3 n, const in vec3 v, const in float thickness, const in float ior, const in mat4 modelMatrix ) {
2260		vec3 refractionVector = refract( - v, normalize( n ), 1.0 / ior );
2261		vec3 modelScale;
2262		modelScale.x = length( vec3( modelMatrix[ 0 ].xyz ) );
2263		modelScale.y = length( vec3( modelMatrix[ 1 ].xyz ) );
2264		modelScale.z = length( vec3( modelMatrix[ 2 ].xyz ) );
2265		return normalize( refractionVector ) * thickness * modelScale;
2266	}
2267	float applyIorToRoughness( const in float roughness, const in float ior ) {
2268		return roughness * clamp( ior * 2.0 - 2.0, 0.0, 1.0 );
2269	}
2270	vec4 getTransmissionSample( const in vec2 fragCoord, const in float roughness, const in float ior ) {
2271		float lod = log2( transmissionSamplerSize.x ) * applyIorToRoughness( roughness, ior );
2272		return textureBicubic( transmissionSamplerMap, fragCoord.xy, lod );
2273	}
2274	vec3 volumeAttenuation( const in float transmissionDistance, const in vec3 attenuationColor, const in float attenuationDistance ) {
2275		if ( isinf( attenuationDistance ) ) {
2276			return vec3( 1.0 );
2277		} else {
2278			vec3 attenuationCoefficient = -log( attenuationColor ) / attenuationDistance;
2279			vec3 transmittance = exp( - attenuationCoefficient * transmissionDistance );			return transmittance;
2280		}
2281	}
2282	vec4 getIBLVolumeRefraction( const in vec3 n, const in vec3 v, const in float roughness, const in vec3 diffuseColor,
2283		const in vec3 specularColor, const in float specularF90, const in vec3 position, const in mat4 modelMatrix,
2284		const in mat4 viewMatrix, const in mat4 projMatrix, const in float dispersion, const in float ior, const in float thickness,
2285		const in vec3 attenuationColor, const in float attenuationDistance ) {
2286		vec4 transmittedLight;
2287		vec3 transmittance;
2288		#ifdef USE_DISPERSION
2289			float halfSpread = ( ior - 1.0 ) * 0.025 * dispersion;
2290			vec3 iors = vec3( ior - halfSpread, ior, ior + halfSpread );
2291			for ( int i = 0; i < 3; i ++ ) {
2292				vec3 transmissionRay = getVolumeTransmissionRay( n, v, thickness, iors[ i ], modelMatrix );
2293				vec3 refractedRayExit = position + transmissionRay;
2294				vec4 ndcPos = projMatrix * viewMatrix * vec4( refractedRayExit, 1.0 );
2295				vec2 refractionCoords = ndcPos.xy / ndcPos.w;
2296				refractionCoords += 1.0;
2297				refractionCoords /= 2.0;
2298				vec4 transmissionSample = getTransmissionSample( refractionCoords, roughness, iors[ i ] );
2299				transmittedLight[ i ] = transmissionSample[ i ];
2300				transmittedLight.a += transmissionSample.a;
2301				transmittance[ i ] = diffuseColor[ i ] * volumeAttenuation( length( transmissionRay ), attenuationColor, attenuationDistance )[ i ];
2302			}
2303			transmittedLight.a /= 3.0;
2304		#else
2305			vec3 transmissionRay = getVolumeTransmissionRay( n, v, thickness, ior, modelMatrix );
2306			vec3 refractedRayExit = position + transmissionRay;
2307			vec4 ndcPos = projMatrix * viewMatrix * vec4( refractedRayExit, 1.0 );
2308			vec2 refractionCoords = ndcPos.xy / ndcPos.w;
2309			refractionCoords += 1.0;
2310			refractionCoords /= 2.0;
2311			transmittedLight = getTransmissionSample( refractionCoords, roughness, ior );
2312			transmittance = diffuseColor * volumeAttenuation( length( transmissionRay ), attenuationColor, attenuationDistance );
2313		#endif
2314		vec3 attenuatedColor = transmittance * transmittedLight.rgb;
2315		vec3 F = EnvironmentBRDF( n, v, specularColor, specularF90, roughness );
2316		float transmittanceFactor = ( transmittance.r + transmittance.g + transmittance.b ) / 3.0;
2317		return vec4( ( 1.0 - F ) * attenuatedColor, 1.0 - ( 1.0 - transmittedLight.a ) * transmittanceFactor );
2318	}
2319#endif`,P0=`#if defined( USE_UV ) || defined( USE_ANISOTROPY )
2320	varying vec2 vUv;
2321#endif
2322#ifdef USE_MAP
2323	varying vec2 vMapUv;
2324#endif
2325#ifdef USE_ALPHAMAP
2326	varying vec2 vAlphaMapUv;
2327#endif
2328#ifdef USE_LIGHTMAP
2329	varying vec2 vLightMapUv;
2330#endif
2331#ifdef USE_AOMAP
2332	varying vec2 vAoMapUv;
2333#endif
2334#ifdef USE_BUMPMAP
2335	varying vec2 vBumpMapUv;
2336#endif
2337#ifdef USE_NORMALMAP
2338	varying vec2 vNormalMapUv;
2339#endif
2340#ifdef USE_EMISSIVEMAP
2341	varying vec2 vEmissiveMapUv;
2342#endif
2343#ifdef USE_METALNESSMAP
2344	varying vec2 vMetalnessMapUv;
2345#endif
2346#ifdef USE_ROUGHNESSMAP
2347	varying vec2 vRoughnessMapUv;
2348#endif
2349#ifdef USE_ANISOTROPYMAP
2350	varying vec2 vAnisotropyMapUv;
2351#endif
2352#ifdef USE_CLEARCOATMAP
2353	varying vec2 vClearcoatMapUv;
2354#endif
2355#ifdef USE_CLEARCOAT_NORMALMAP
2356	varying vec2 vClearcoatNormalMapUv;
2357#endif
2358#ifdef USE_CLEARCOAT_ROUGHNESSMAP
2359	varying vec2 vClearcoatRoughnessMapUv;
2360#endif
2361#ifdef USE_IRIDESCENCEMAP
2362	varying vec2 vIridescenceMapUv;
2363#endif
2364#ifdef USE_IRIDESCENCE_THICKNESSMAP
2365	varying vec2 vIridescenceThicknessMapUv;
2366#endif
2367#ifdef USE_SHEEN_COLORMAP
2368	varying vec2 vSheenColorMapUv;
2369#endif
2370#ifdef USE_SHEEN_ROUGHNESSMAP
2371	varying vec2 vSheenRoughnessMapUv;
2372#endif
2373#ifdef USE_SPECULARMAP
2374	varying vec2 vSpecularMapUv;
2375#endif
2376#ifdef USE_SPECULAR_COLORMAP
2377	varying vec2 vSpecularColorMapUv;
2378#endif
2379#ifdef USE_SPECULAR_INTENSITYMAP
2380	varying vec2 vSpecularIntensityMapUv;
2381#endif
2382#ifdef USE_TRANSMISSIONMAP
2383	uniform mat3 transmissionMapTransform;
2384	varying vec2 vTransmissionMapUv;
2385#endif
2386#ifdef USE_THICKNESSMAP
2387	uniform mat3 thicknessMapTransform;
2388	varying vec2 vThicknessMapUv;
2389#endif`,L0=`#if defined( USE_UV ) || defined( USE_ANISOTROPY )
2390	varying vec2 vUv;
2391#endif
2392#ifdef USE_MAP
2393	uniform mat3 mapTransform;
2394	varying vec2 vMapUv;
2395#endif
2396#ifdef USE_ALPHAMAP
2397	uniform mat3 alphaMapTransform;
2398	varying vec2 vAlphaMapUv;
2399#endif
2400#ifdef USE_LIGHTMAP
2401	uniform mat3 lightMapTransform;
2402	varying vec2 vLightMapUv;
2403#endif
2404#ifdef USE_AOMAP
2405	uniform mat3 aoMapTransform;
2406	varying vec2 vAoMapUv;
2407#endif
2408#ifdef USE_BUMPMAP
2409	uniform mat3 bumpMapTransform;
2410	varying vec2 vBumpMapUv;
2411#endif
2412#ifdef USE_NORMALMAP
2413	uniform mat3 normalMapTransform;
2414	varying vec2 vNormalMapUv;
2415#endif
2416#ifdef USE_DISPLACEMENTMAP
2417	uniform mat3 displacementMapTransform;
2418	varying vec2 vDisplacementMapUv;
2419#endif
2420#ifdef USE_EMISSIVEMAP
2421	uniform mat3 emissiveMapTransform;
2422	varying vec2 vEmissiveMapUv;
2423#endif
2424#ifdef USE_METALNESSMAP
2425	uniform mat3 metalnessMapTransform;
2426	varying vec2 vMetalnessMapUv;
2427#endif
2428#ifdef USE_ROUGHNESSMAP
2429	uniform mat3 roughnessMapTransform;
2430	varying vec2 vRoughnessMapUv;
2431#endif
2432#ifdef USE_ANISOTROPYMAP
2433	uniform mat3 anisotropyMapTransform;
2434	varying vec2 vAnisotropyMapUv;
2435#endif
2436#ifdef USE_CLEARCOATMAP
2437	uniform mat3 clearcoatMapTransform;
2438	varying vec2 vClearcoatMapUv;
2439#endif
2440#ifdef USE_CLEARCOAT_NORMALMAP
2441	uniform mat3 clearcoatNormalMapTransform;
2442	varying vec2 vClearcoatNormalMapUv;
2443#endif
2444#ifdef USE_CLEARCOAT_ROUGHNESSMAP
2445	uniform mat3 clearcoatRoughnessMapTransform;
2446	varying vec2 vClearcoatRoughnessMapUv;
2447#endif
2448#ifdef USE_SHEEN_COLORMAP
2449	uniform mat3 sheenColorMapTransform;
2450	varying vec2 vSheenColorMapUv;
2451#endif
2452#ifdef USE_SHEEN_ROUGHNESSMAP
2453	uniform mat3 sheenRoughnessMapTransform;
2454	varying vec2 vSheenRoughnessMapUv;
2455#endif
2456#ifdef USE_IRIDESCENCEMAP
2457	uniform mat3 iridescenceMapTransform;
2458	varying vec2 vIridescenceMapUv;
2459#endif
2460#ifdef USE_IRIDESCENCE_THICKNESSMAP
2461	uniform mat3 iridescenceThicknessMapTransform;
2462	varying vec2 vIridescenceThicknessMapUv;
2463#endif
2464#ifdef USE_SPECULARMAP
2465	uniform mat3 specularMapTransform;
2466	varying vec2 vSpecularMapUv;
2467#endif
2468#ifdef USE_SPECULAR_COLORMAP
2469	uniform mat3 specularColorMapTransform;
2470	varying vec2 vSpecularColorMapUv;
2471#endif
2472#ifdef USE_SPECULAR_INTENSITYMAP
2473	uniform mat3 specularIntensityMapTransform;
2474	varying vec2 vSpecularIntensityMapUv;
2475#endif
2476#ifdef USE_TRANSMISSIONMAP
2477	uniform mat3 transmissionMapTransform;
2478	varying vec2 vTransmissionMapUv;
2479#endif
2480#ifdef USE_THICKNESSMAP
2481	uniform mat3 thicknessMapTransform;
2482	varying vec2 vThicknessMapUv;
2483#endif`,D0=`#if defined( USE_UV ) || defined( USE_ANISOTROPY )
2484	vUv = vec3( uv, 1 ).xy;
2485#endif
2486#ifdef USE_MAP
2487	vMapUv = ( mapTransform * vec3( MAP_UV, 1 ) ).xy;
2488#endif
2489#ifdef USE_ALPHAMAP
2490	vAlphaMapUv = ( alphaMapTransform * vec3( ALPHAMAP_UV, 1 ) ).xy;
2491#endif
2492#ifdef USE_LIGHTMAP
2493	vLightMapUv = ( lightMapTransform * vec3( LIGHTMAP_UV, 1 ) ).xy;
2494#endif
2495#ifdef USE_AOMAP
2496	vAoMapUv = ( aoMapTransform * vec3( AOMAP_UV, 1 ) ).xy;
2497#endif
2498#ifdef USE_BUMPMAP
2499	vBumpMapUv = ( bumpMapTransform * vec3( BUMPMAP_UV, 1 ) ).xy;
2500#endif
2501#ifdef USE_NORMALMAP
2502	vNormalMapUv = ( normalMapTransform * vec3( NORMALMAP_UV, 1 ) ).xy;
2503#endif
2504#ifdef USE_DISPLACEMENTMAP
2505	vDisplacementMapUv = ( displacementMapTransform * vec3( DISPLACEMENTMAP_UV, 1 ) ).xy;
2506#endif
2507#ifdef USE_EMISSIVEMAP
2508	vEmissiveMapUv = ( emissiveMapTransform * vec3( EMISSIVEMAP_UV, 1 ) ).xy;
2509#endif
2510#ifdef USE_METALNESSMAP
2511	vMetalnessMapUv = ( metalnessMapTransform * vec3( METALNESSMAP_UV, 1 ) ).xy;
2512#endif
2513#ifdef USE_ROUGHNESSMAP
2514	vRoughnessMapUv = ( roughnessMapTransform * vec3( ROUGHNESSMAP_UV, 1 ) ).xy;
2515#endif
2516#ifdef USE_ANISOTROPYMAP
2517	vAnisotropyMapUv = ( anisotropyMapTransform * vec3( ANISOTROPYMAP_UV, 1 ) ).xy;
2518#endif
2519#ifdef USE_CLEARCOATMAP
2520	vClearcoatMapUv = ( clearcoatMapTransform * vec3( CLEARCOATMAP_UV, 1 ) ).xy;
2521#endif
2522#ifdef USE_CLEARCOAT_NORMALMAP
2523	vClearcoatNormalMapUv = ( clearcoatNormalMapTransform * vec3( CLEARCOAT_NORMALMAP_UV, 1 ) ).xy;
2524#endif
2525#ifdef USE_CLEARCOAT_ROUGHNESSMAP
2526	vClearcoatRoughnessMapUv = ( clearcoatRoughnessMapTransform * vec3( CLEARCOAT_ROUGHNESSMAP_UV, 1 ) ).xy;
2527#endif
2528#ifdef USE_IRIDESCENCEMAP
2529	vIridescenceMapUv = ( iridescenceMapTransform * vec3( IRIDESCENCEMAP_UV, 1 ) ).xy;
2530#endif
2531#ifdef USE_IRIDESCENCE_THICKNESSMAP
2532	vIridescenceThicknessMapUv = ( iridescenceThicknessMapTransform * vec3( IRIDESCENCE_THICKNESSMAP_UV, 1 ) ).xy;
2533#endif
2534#ifdef USE_SHEEN_COLORMAP
2535	vSheenColorMapUv = ( sheenColorMapTransform * vec3( SHEEN_COLORMAP_UV, 1 ) ).xy;
2536#endif
2537#ifdef USE_SHEEN_ROUGHNESSMAP
2538	vSheenRoughnessMapUv = ( sheenRoughnessMapTransform * vec3( SHEEN_ROUGHNESSMAP_UV, 1 ) ).xy;
2539#endif
2540#ifdef USE_SPECULARMAP
2541	vSpecularMapUv = ( specularMapTransform * vec3( SPECULARMAP_UV, 1 ) ).xy;
2542#endif
2543#ifdef USE_SPECULAR_COLORMAP
2544	vSpecularColorMapUv = ( specularColorMapTransform * vec3( SPECULAR_COLORMAP_UV, 1 ) ).xy;
2545#endif
2546#ifdef USE_SPECULAR_INTENSITYMAP
2547	vSpecularIntensityMapUv = ( specularIntensityMapTransform * vec3( SPECULAR_INTENSITYMAP_UV, 1 ) ).xy;
2548#endif
2549#ifdef USE_TRANSMISSIONMAP
2550	vTransmissionMapUv = ( transmissionMapTransform * vec3( TRANSMISSIONMAP_UV, 1 ) ).xy;
2551#endif
2552#ifdef USE_THICKNESSMAP
2553	vThicknessMapUv = ( thicknessMapTransform * vec3( THICKNESSMAP_UV, 1 ) ).xy;
2554#endif`,U0=`#if defined( USE_ENVMAP ) || defined( DISTANCE ) || defined ( USE_SHADOWMAP ) || defined ( USE_TRANSMISSION ) || NUM_SPOT_LIGHT_COORDS > 0
2555	vec4 worldPosition = vec4( transformed, 1.0 );
2556	#ifdef USE_BATCHING
2557		worldPosition = batchingMatrix * worldPosition;
2558	#endif
2559	#ifdef USE_INSTANCING
2560		worldPosition = instanceMatrix * worldPosition;
2561	#endif
2562	worldPosition = modelMatrix * worldPosition;
2563#endif`;const N0=`varying vec2 vUv;
2564uniform mat3 uvTransform;
2565void main() {
2566	vUv = ( uvTransform * vec3( uv, 1 ) ).xy;
2567	gl_Position = vec4( position.xy, 1.0, 1.0 );
2568}`,F0=`uniform sampler2D t2D;
2569uniform float backgroundIntensity;
2570varying vec2 vUv;
2571void main() {
2572	vec4 texColor = texture2D( t2D, vUv );
2573	#ifdef DECODE_VIDEO_TEXTURE
2574		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 );
2575	#endif
2576	texColor.rgb *= backgroundIntensity;
2577	gl_FragColor = texColor;
2578	#include <tonemapping_fragment>
2579	#include <colorspace_fragment>
2580}`,O0=`varying vec3 vWorldDirection;
2581#include <common>
2582void main() {
2583	vWorldDirection = transformDirection( position, modelMatrix );
2584	#include <begin_vertex>
2585	#include <project_vertex>
2586	gl_Position.z = gl_Position.w;
2587}`,B0=`#ifdef ENVMAP_TYPE_CUBE
2588	uniform samplerCube envMap;
2589#elif defined( ENVMAP_TYPE_CUBE_UV )
2590	uniform sampler2D envMap;
2591#endif
2592uniform float flipEnvMap;
2593uniform float backgroundBlurriness;
2594uniform float backgroundIntensity;
2595uniform mat3 backgroundRotation;
2596varying vec3 vWorldDirection;
2597#include <cube_uv_reflection_fragment>
2598void main() {
2599	#ifdef ENVMAP_TYPE_CUBE
2600		vec4 texColor = textureCube( envMap, backgroundRotation * vec3( flipEnvMap * vWorldDirection.x, vWorldDirection.yz ) );
2601	#elif defined( ENVMAP_TYPE_CUBE_UV )
2602		vec4 texColor = textureCubeUV( envMap, backgroundRotation * vWorldDirection, backgroundBlurriness );
2603	#else
2604		vec4 texColor = vec4( 0.0, 0.0, 0.0, 1.0 );
2605	#endif
2606	texColor.rgb *= backgroundIntensity;
2607	gl_FragColor = texColor;
2608	#include <tonemapping_fragment>
2609	#include <colorspace_fragment>
2610}`,z0=`varying vec3 vWorldDirection;
2611#include <common>
2612void main() {
2613	vWorldDirection = transformDirection( position, modelMatrix );
2614	#include <begin_vertex>
2615	#include <project_vertex>
2616	gl_Position.z = gl_Position.w;
2617}`,V0=`uniform samplerCube tCube;
2618uniform float tFlip;
2619uniform float opacity;
2620varying vec3 vWorldDirection;
2621void main() {
2622	vec4 texColor = textureCube( tCube, vec3( tFlip * vWorldDirection.x, vWorldDirection.yz ) );
2623	gl_FragColor = texColor;
2624	gl_FragColor.a *= opacity;
2625	#include <tonemapping_fragment>
2626	#include <colorspace_fragment>
2627}`,k0=`#include <common>
2628#include <batching_pars_vertex>
2629#include <uv_pars_vertex>
2630#include <displacementmap_pars_vertex>
2631#include <morphtarget_pars_vertex>
2632#include <skinning_pars_vertex>
2633#include <logdepthbuf_pars_vertex>
2634#include <clipping_planes_pars_vertex>
2635varying vec2 vHighPrecisionZW;
2636void main() {
2637	#include <uv_vertex>
2638	#include <batching_vertex>
2639	#include <skinbase_vertex>
2640	#include <morphinstance_vertex>
2641	#ifdef USE_DISPLACEMENTMAP
2642		#include <beginnormal_vertex>
2643		#include <morphnormal_vertex>
2644		#include <skinnormal_vertex>
2645	#endif
2646	#include <begin_vertex>
2647	#include <morphtarget_vertex>
2648	#include <skinning_vertex>
2649	#include <displacementmap_vertex>
2650	#include <project_vertex>
2651	#include <logdepthbuf_vertex>
2652	#include <clipping_planes_vertex>
2653	vHighPrecisionZW = gl_Position.zw;
2654}`,G0=`#if DEPTH_PACKING == 3200
2655	uniform float opacity;
2656#endif
2657#include <common>
2658#include <packing>
2659#include <uv_pars_fragment>
2660#include <map_pars_fragment>
2661#include <alphamap_pars_fragment>
2662#include <alphatest_pars_fragment>
2663#include <alphahash_pars_fragment>
2664#include <logdepthbuf_pars_fragment>
2665#include <clipping_planes_pars_fragment>
2666varying vec2 vHighPrecisionZW;
2667void main() {
2668	vec4 diffuseColor = vec4( 1.0 );
2669	#include <clipping_planes_fragment>
2670	#if DEPTH_PACKING == 3200
2671		diffuseColor.a = opacity;
2672	#endif
2673	#include <map_fragment>
2674	#include <alphamap_fragment>
2675	#include <alphatest_fragment>
2676	#include <alphahash_fragment>
2677	#include <logdepthbuf_fragment>
2678	#ifdef USE_REVERSED_DEPTH_BUFFER
2679		float fragCoordZ = vHighPrecisionZW[ 0 ] / vHighPrecisionZW[ 1 ];
2680	#else
2681		float fragCoordZ = 0.5 * vHighPrecisionZW[ 0 ] / vHighPrecisionZW[ 1 ] + 0.5;
2682	#endif
2683	#if DEPTH_PACKING == 3200
2684		gl_FragColor = vec4( vec3( 1.0 - fragCoordZ ), opacity );
2685	#elif DEPTH_PACKING == 3201
2686		gl_FragColor = packDepthToRGBA( fragCoordZ );
2687	#elif DEPTH_PACKING == 3202
2688		gl_FragColor = vec4( packDepthToRGB( fragCoordZ ), 1.0 );
2689	#elif DEPTH_PACKING == 3203
2690		gl_FragColor = vec4( packDepthToRG( fragCoordZ ), 0.0, 1.0 );
2691	#endif
2692}`,H0=`#define DISTANCE
2693varying vec3 vWorldPosition;
2694#include <common>
2695#include <batching_pars_vertex>
2696#include <uv_pars_vertex>
2697#include <displacementmap_pars_vertex>
2698#include <morphtarget_pars_vertex>
2699#include <skinning_pars_vertex>
2700#include <clipping_planes_pars_vertex>
2701void main() {
2702	#include <uv_vertex>
2703	#include <batching_vertex>
2704	#include <skinbase_vertex>
2705	#include <morphinstance_vertex>
2706	#ifdef USE_DISPLACEMENTMAP
2707		#include <beginnormal_vertex>
2708		#include <morphnormal_vertex>
2709		#include <skinnormal_vertex>
2710	#endif
2711	#include <begin_vertex>
2712	#include <morphtarget_vertex>
2713	#include <skinning_vertex>
2714	#include <displacementmap_vertex>
2715	#include <project_vertex>
2716	#include <worldpos_vertex>
2717	#include <clipping_planes_vertex>
2718	vWorldPosition = worldPosition.xyz;
2719}`,W0=`#define DISTANCE
2720uniform vec3 referencePosition;
2721uniform float nearDistance;
2722uniform float farDistance;
2723varying vec3 vWorldPosition;
2724#include <common>
2725#include <uv_pars_fragment>
2726#include <map_pars_fragment>
2727#include <alphamap_pars_fragment>
2728#include <alphatest_pars_fragment>
2729#include <alphahash_pars_fragment>
2730#include <clipping_planes_pars_fragment>
2731void main () {
2732	vec4 diffuseColor = vec4( 1.0 );
2733	#include <clipping_planes_fragment>
2734	#include <map_fragment>
2735	#include <alphamap_fragment>
2736	#include <alphatest_fragment>
2737	#include <alphahash_fragment>
2738	float dist = length( vWorldPosition - referencePosition );
2739	dist = ( dist - nearDistance ) / ( farDistance - nearDistance );
2740	dist = saturate( dist );
2741	gl_FragColor = vec4( dist, 0.0, 0.0, 1.0 );
2742}`,X0=`varying vec3 vWorldDirection;
2743#include <common>
2744void main() {
2745	vWorldDirection = transformDirection( position, modelMatrix );
2746	#include <begin_vertex>
2747	#include <project_vertex>
2748}`,q0=`uniform sampler2D tEquirect;
2749varying vec3 vWorldDirection;
2750#include <common>
2751void main() {
2752	vec3 direction = normalize( vWorldDirection );
2753	vec2 sampleUV = equirectUv( direction );
2754	gl_FragColor = texture2D( tEquirect, sampleUV );
2755	#include <tonemapping_fragment>
2756	#include <colorspace_fragment>
2757}`,Y0=`uniform float scale;
2758attribute float lineDistance;
2759varying float vLineDistance;
2760#include <common>
2761#include <uv_pars_vertex>
2762#include <color_pars_vertex>
2763#include <fog_pars_vertex>
2764#include <morphtarget_pars_vertex>
2765#include <logdepthbuf_pars_vertex>
2766#include <clipping_planes_pars_vertex>
2767void main() {
2768	vLineDistance = scale * lineDistance;
2769	#include <uv_vertex>
2770	#include <color_vertex>
2771	#include <morphinstance_vertex>
2772	#include <morphcolor_vertex>
2773	#include <begin_vertex>
2774	#include <morphtarget_vertex>
2775	#include <project_vertex>
2776	#include <logdepthbuf_vertex>
2777	#include <clipping_planes_vertex>
2778	#include <fog_vertex>
2779}`,Z0=`uniform vec3 diffuse;
2780uniform float opacity;
2781uniform float dashSize;
2782uniform float totalSize;
2783varying float vLineDistance;
2784#include <common>
2785#include <color_pars_fragment>
2786#include <uv_pars_fragment>
2787#include <map_pars_fragment>
2788#include <fog_pars_fragment>
2789#include <logdepthbuf_pars_fragment>
2790#include <clipping_planes_pars_fragment>
2791void main() {
2792	vec4 diffuseColor = vec4( diffuse, opacity );
2793	#include <clipping_planes_fragment>
2794	if ( mod( vLineDistance, totalSize ) > dashSize ) {
2795		discard;
2796	}
2797	vec3 outgoingLight = vec3( 0.0 );
2798	#include <logdepthbuf_fragment>
2799	#include <map_fragment>
2800	#include <color_fragment>
2801	outgoingLight = diffuseColor.rgb;
2802	#include <opaque_fragment>
2803	#include <tonemapping_fragment>
2804	#include <colorspace_fragment>
2805	#include <fog_fragment>
2806	#include <premultiplied_alpha_fragment>
2807}`,J0=`#include <common>
2808#include <batching_pars_vertex>
2809#include <uv_pars_vertex>
2810#include <envmap_pars_vertex>
2811#include <color_pars_vertex>
2812#include <fog_pars_vertex>
2813#include <morphtarget_pars_vertex>
2814#include <skinning_pars_vertex>
2815#include <logdepthbuf_pars_vertex>
2816#include <clipping_planes_pars_vertex>
2817void main() {
2818	#include <uv_vertex>
2819	#include <color_vertex>
2820	#include <morphinstance_vertex>
2821	#include <morphcolor_vertex>
2822	#include <batching_vertex>
2823	#if defined ( USE_ENVMAP ) || defined ( USE_SKINNING )
2824		#include <beginnormal_vertex>
2825		#include <morphnormal_vertex>
2826		#include <skinbase_vertex>
2827		#include <skinnormal_vertex>
2828		#include <defaultnormal_vertex>
2829	#endif
2830	#include <begin_vertex>
2831	#include <morphtarget_vertex>
2832	#include <skinning_vertex>
2833	#include <project_vertex>
2834	#include <logdepthbuf_vertex>
2835	#include <clipping_planes_vertex>
2836	#include <worldpos_vertex>
2837	#include <envmap_vertex>
2838	#include <fog_vertex>
2839}`,$0=`uniform vec3 diffuse;
2840uniform float opacity;
2841#ifndef FLAT_SHADED
2842	varying vec3 vNormal;
2843#endif
2844#include <common>
2845#include <dithering_pars_fragment>
2846#include <color_pars_fragment>
2847#include <uv_pars_fragment>
2848#include <map_pars_fragment>
2849#include <alphamap_pars_fragment>
2850#include <alphatest_pars_fragment>
2851#include <alphahash_pars_fragment>
2852#include <aomap_pars_fragment>
2853#include <lightmap_pars_fragment>
2854#include <envmap_common_pars_fragment>
2855#include <envmap_pars_fragment>
2856#include <fog_pars_fragment>
2857#include <specularmap_pars_fragment>
2858#include <logdepthbuf_pars_fragment>
2859#include <clipping_planes_pars_fragment>
2860void main() {
2861	vec4 diffuseColor = vec4( diffuse, opacity );
2862	#include <clipping_planes_fragment>
2863	#include <logdepthbuf_fragment>
2864	#include <map_fragment>
2865	#include <color_fragment>
2866	#include <alphamap_fragment>
2867	#include <alphatest_fragment>
2868	#include <alphahash_fragment>
2869	#include <specularmap_fragment>
2870	ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );
2871	#ifdef USE_LIGHTMAP
2872		vec4 lightMapTexel = texture2D( lightMap, vLightMapUv );
2873		reflectedLight.indirectDiffuse += lightMapTexel.rgb * lightMapIntensity * RECIPROCAL_PI;
2874	#else
2875		reflectedLight.indirectDiffuse += vec3( 1.0 );
2876	#endif
2877	#include <aomap_fragment>
2878	reflectedLight.indirectDiffuse *= diffuseColor.rgb;
2879	vec3 outgoingLight = reflectedLight.indirectDiffuse;
2880	#include <envmap_fragment>
2881	#include <opaque_fragment>
2882	#include <tonemapping_fragment>
2883	#include <colorspace_fragment>
2884	#include <fog_fragment>
2885	#include <premultiplied_alpha_fragment>
2886	#include <dithering_fragment>
2887}`,K0=`#define LAMBERT
2888varying vec3 vViewPosition;
2889#include <common>
2890#include <batching_pars_vertex>
2891#include <uv_pars_vertex>
2892#include <displacementmap_pars_vertex>
2893#include <envmap_pars_vertex>
2894#include <color_pars_vertex>
2895#include <fog_pars_vertex>
2896#include <normal_pars_vertex>
2897#include <morphtarget_pars_vertex>
2898#include <skinning_pars_vertex>
2899#include <shadowmap_pars_vertex>
2900#include <logdepthbuf_pars_vertex>
2901#include <clipping_planes_pars_vertex>
2902void main() {
2903	#include <uv_vertex>
2904	#include <color_vertex>
2905	#include <morphinstance_vertex>
2906	#include <morphcolor_vertex>
2907	#include <batching_vertex>
2908	#include <beginnormal_vertex>
2909	#include <morphnormal_vertex>
2910	#include <skinbase_vertex>
2911	#include <skinnormal_vertex>
2912	#include <defaultnormal_vertex>
2913	#include <normal_vertex>
2914	#include <begin_vertex>
2915	#include <morphtarget_vertex>
2916	#include <skinning_vertex>
2917	#include <displacementmap_vertex>
2918	#include <project_vertex>
2919	#include <logdepthbuf_vertex>
2920	#include <clipping_planes_vertex>
2921	vViewPosition = - mvPosition.xyz;
2922	#include <worldpos_vertex>
2923	#include <envmap_vertex>
2924	#include <shadowmap_vertex>
2925	#include <fog_vertex>
2926}`,Q0=`#define LAMBERT
2927uniform vec3 diffuse;
2928uniform vec3 emissive;
2929uniform float opacity;
2930#include <common>
2931#include <dithering_pars_fragment>
2932#include <color_pars_fragment>
2933#include <uv_pars_fragment>
2934#include <map_pars_fragment>
2935#include <alphamap_pars_fragment>
2936#include <alphatest_pars_fragment>
2937#include <alphahash_pars_fragment>
2938#include <aomap_pars_fragment>
2939#include <lightmap_pars_fragment>
2940#include <emissivemap_pars_fragment>
2941#include <envmap_common_pars_fragment>
2942#include <envmap_pars_fragment>
2943#include <fog_pars_fragment>
2944#include <bsdfs>
2945#include <lights_pars_begin>
2946#include <normal_pars_fragment>
2947#include <lights_lambert_pars_fragment>
2948#include <shadowmap_pars_fragment>
2949#include <bumpmap_pars_fragment>
2950#include <normalmap_pars_fragment>
2951#include <specularmap_pars_fragment>
2952#include <logdepthbuf_pars_fragment>
2953#include <clipping_planes_pars_fragment>
2954void main() {
2955	vec4 diffuseColor = vec4( diffuse, opacity );
2956	#include <clipping_planes_fragment>
2957	ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );
2958	vec3 totalEmissiveRadiance = emissive;
2959	#include <logdepthbuf_fragment>
2960	#include <map_fragment>
2961	#include <color_fragment>
2962	#include <alphamap_fragment>
2963	#include <alphatest_fragment>
2964	#include <alphahash_fragment>
2965	#include <specularmap_fragment>
2966	#include <normal_fragment_begin>
2967	#include <normal_fragment_maps>
2968	#include <emissivemap_fragment>
2969	#include <lights_lambert_fragment>
2970	#include <lights_fragment_begin>
2971	#include <lights_fragment_maps>
2972	#include <lights_fragment_end>
2973	#include <aomap_fragment>
2974	vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;
2975	#include <envmap_fragment>
2976	#include <opaque_fragment>
2977	#include <tonemapping_fragment>
2978	#include <colorspace_fragment>
2979	#include <fog_fragment>
2980	#include <premultiplied_alpha_fragment>
2981	#include <dithering_fragment>
2982}`,j0=`#define MATCAP
2983varying vec3 vViewPosition;
2984#include <common>
2985#include <batching_pars_vertex>
2986#include <uv_pars_vertex>
2987#include <color_pars_vertex>
2988#include <displacementmap_pars_vertex>
2989#include <fog_pars_vertex>
2990#include <normal_pars_vertex>
2991#include <morphtarget_pars_vertex>
2992#include <skinning_pars_vertex>
2993#include <logdepthbuf_pars_vertex>
2994#include <clipping_planes_pars_vertex>
2995void main() {
2996	#include <uv_vertex>
2997	#include <color_vertex>
2998	#include <morphinstance_vertex>
2999	#include <morphcolor_vertex>
3000	#include <batching_vertex>
3001	#include <beginnormal_vertex>
3002	#include <morphnormal_vertex>
3003	#include <skinbase_vertex>
3004	#include <skinnormal_vertex>
3005	#include <defaultnormal_vertex>
3006	#include <normal_vertex>
3007	#include <begin_vertex>
3008	#include <morphtarget_vertex>
3009	#include <skinning_vertex>
3010	#include <displacementmap_vertex>
3011	#include <project_vertex>
3012	#include <logdepthbuf_vertex>
3013	#include <clipping_planes_vertex>
3014	#include <fog_vertex>
3015	vViewPosition = - mvPosition.xyz;
3016}`,e_=`#define MATCAP
3017uniform vec3 diffuse;
3018uniform float opacity;
3019uniform sampler2D matcap;
3020varying vec3 vViewPosition;
3021#include <common>
3022#include <dithering_pars_fragment>
3023#include <color_pars_fragment>
3024#include <uv_pars_fragment>
3025#include <map_pars_fragment>
3026#include <alphamap_pars_fragment>
3027#include <alphatest_pars_fragment>
3028#include <alphahash_pars_fragment>
3029#include <fog_pars_fragment>
3030#include <normal_pars_fragment>
3031#include <bumpmap_pars_fragment>
3032#include <normalmap_pars_fragment>
3033#includ
3033e <logdepthbuf_pars_fragment>
3034#include <clipping_planes_pars_fragment>
3035void main() {
3036	vec4 diffuseColor = vec4( diffuse, opacity );
3037	#include <clipping_planes_fragment>
3038	#include <logdepthbuf_fragment>
3039	#include <map_fragment>
3040	#include <color_fragment>
3041	#include <alphamap_fragment>
3042	#include <alphatest_fragment>
3043	#include <alphahash_fragment>
3044	#include <normal_fragment_begin>
3045	#include <normal_fragment_maps>
3046	vec3 viewDir = normalize( vViewPosition );
3047	vec3 x = normalize( vec3( viewDir.z, 0.0, - viewDir.x ) );
3048	vec3 y = cross( viewDir, x );
3049	vec2 uv = vec2( dot( x, normal ), dot( y, normal ) ) * 0.495 + 0.5;
3050	#ifdef USE_MATCAP
3051		vec4 matcapColor = texture2D( matcap, uv );
3052	#else
3053		vec4 matcapColor = vec4( vec3( mix( 0.2, 0.8, uv.y ) ), 1.0 );
3054	#endif
3055	vec3 outgoingLight = diffuseColor.rgb * matcapColor.rgb;
3056	#include <opaque_fragment>
3057	#include <tonemapping_fragment>
3058	#include <colorspace_fragment>
3059	#include <fog_fragment>
3060	#include <premultiplied_alpha_fragment>
3061	#include <dithering_fragment>
3062}`,t_=`#define NORMAL
3063#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE )
3064	varying vec3 vViewPosition;
3065#endif
3066#include <common>
3067#include <batching_pars_vertex>
3068#include <uv_pars_vertex>
3069#include <displacementmap_pars_vertex>
3070#include <normal_pars_vertex>
3071#include <morphtarget_pars_vertex>
3072#include <skinning_pars_vertex>
3073#include <logdepthbuf_pars_vertex>
3074#include <clipping_planes_pars_vertex>
3075void main() {
3076	#include <uv_vertex>
3077	#include <batching_vertex>
3078	#include <beginnormal_vertex>
3079	#include <morphinstance_vertex>
3080	#include <morphnormal_vertex>
3081	#include <skinbase_vertex>
3082	#include <skinnormal_vertex>
3083	#include <defaultnormal_vertex>
3084	#include <normal_vertex>
3085	#include <begin_vertex>
3086	#include <morphtarget_vertex>
3087	#include <skinning_vertex>
3088	#include <displacementmap_vertex>
3089	#include <project_vertex>
3090	#include <logdepthbuf_vertex>
3091	#include <clipping_planes_vertex>
3092#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE )
3093	vViewPosition = - mvPosition.xyz;
3094#endif
3095}`,n_=`#define NORMAL
3096uniform float opacity;
3097#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE )
3098	varying vec3 vViewPosition;
3099#endif
3100#include <uv_pars_fragment>
3101#include <normal_pars_fragment>
3102#include <bumpmap_pars_fragment>
3103#include <normalmap_pars_fragment>
3104#include <logdepthbuf_pars_fragment>
3105#include <clipping_planes_pars_fragment>
3106void main() {
3107	vec4 diffuseColor = vec4( 0.0, 0.0, 0.0, opacity );
3108	#include <clipping_planes_fragment>
3109	#include <logdepthbuf_fragment>
3110	#include <normal_fragment_begin>
3111	#include <normal_fragment_maps>
3112	gl_FragColor = vec4( normalize( normal ) * 0.5 + 0.5, diffuseColor.a );
3113	#ifdef OPAQUE
3114		gl_FragColor.a = 1.0;
3115	#endif
3116}`,i_=`#define PHONG
3117varying vec3 vViewPosition;
3118#include <common>
3119#include <batching_pars_vertex>
3120#include <uv_pars_vertex>
3121#include <displacementmap_pars_vertex>
3122#include <envmap_pars_vertex>
3123#include <color_pars_vertex>
3124#include <fog_pars_vertex>
3125#include <normal_pars_vertex>
3126#include <morphtarget_pars_vertex>
3127#include <skinning_pars_vertex>
3128#include <shadowmap_pars_vertex>
3129#include <logdepthbuf_pars_vertex>
3130#include <clipping_planes_pars_vertex>
3131void main() {
3132	#include <uv_vertex>
3133	#include <color_vertex>
3134	#include <morphcolor_vertex>
3135	#include <batching_vertex>
3136	#include <beginnormal_vertex>
3137	#include <morphinstance_vertex>
3138	#include <morphnormal_vertex>
3139	#include <skinbase_vertex>
3140	#include <skinnormal_vertex>
3141	#include <defaultnormal_vertex>
3142	#include <normal_vertex>
3143	#include <begin_vertex>
3144	#include <morphtarget_vertex>
3145	#include <skinning_vertex>
3146	#include <displacementmap_vertex>
3147	#include <project_vertex>
3148	#include <logdepthbuf_vertex>
3149	#include <clipping_planes_vertex>
3150	vViewPosition = - mvPosition.xyz;
3151	#include <worldpos_vertex>
3152	#include <envmap_vertex>
3153	#include <shadowmap_vertex>
3154	#include <fog_vertex>
3155}`,s_=`#define PHONG
3156uniform vec3 diffuse;
3157uniform vec3 emissive;
3158uniform vec3 specular;
3159uniform float shininess;
3160uniform float opacity;
3161#include <common>
3162#include <dithering_pars_fragment>
3163#include <color_pars_fragment>
3164#include <uv_pars_fragment>
3165#include <map_pars_fragment>
3166#include <alphamap_pars_fragment>
3167#include <alphatest_pars_fragment>
3168#include <alphahash_pars_fragment>
3169#include <aomap_pars_fragment>
3170#include <lightmap_pars_fragment>
3171#include <emissivemap_pars_fragment>
3172#include <envmap_common_pars_fragment>
3173#include <envmap_pars_fragment>
3174#include <fog_pars_fragment>
3175#include <bsdfs>
3176#include <lights_pars_begin>
3177#include <normal_pars_fragment>
3178#include <lights_phong_pars_fragment>
3179#include <shadowmap_pars_fragment>
3180#include <bumpmap_pars_fragment>
3181#include <normalmap_pars_fragment>
3182#include <specularmap_pars_fragment>
3183#include <logdepthbuf_pars_fragment>
3184#include <clipping_planes_pars_fragment>
3185void main() {
3186	vec4 diffuseColor = vec4( diffuse, opacity );
3187	#include <clipping_planes_fragment>
3188	ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );
3189	vec3 totalEmissiveRadiance = emissive;
3190	#include <logdepthbuf_fragment>
3191	#include <map_fragment>
3192	#include <color_fragment>
3193	#include <alphamap_fragment>
3194	#include <alphatest_fragment>
3195	#include <alphahash_fragment>
3196	#include <specularmap_fragment>
3197	#include <normal_fragment_begin>
3198	#include <normal_fragment_maps>
3199	#include <emissivemap_fragment>
3200	#include <lights_phong_fragment>
3201	#include <lights_fragment_begin>
3202	#include <lights_fragment_maps>
3203	#include <lights_fragment_end>
3204	#include <aomap_fragment>
3205	vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveRadiance;
3206	#include <envmap_fragment>
3207	#include <opaque_fragment>
3208	#include <tonemapping_fragment>
3209	#include <colorspace_fragment>
3210	#include <fog_fragment>
3211	#include <premultiplied_alpha_fragment>
3212	#include <dithering_fragment>
3213}`,r_=`#define STANDARD
3214varying vec3 vViewPosition;
3215#ifdef USE_TRANSMISSION
3216	varying vec3 vWorldPosition;
3217#endif
3218#include <common>
3219#include <batching_pars_vertex>
3220#include <uv_pars_vertex>
3221#include <displacementmap_pars_vertex>
3222#include <color_pars_vertex>
3223#include <fog_pars_vertex>
3224#include <normal_pars_vertex>
3225#include <morphtarget_pars_vertex>
3226#include <skinning_pars_vertex>
3227#include <shadowmap_pars_vertex>
3228#include <logdepthbuf_pars_vertex>
3229#include <clipping_planes_pars_vertex>
3230void main() {
3231	#include <uv_vertex>
3232	#include <color_vertex>
3233	#include <morphinstance_vertex>
3234	#include <morphcolor_vertex>
3235	#include <batching_vertex>
3236	#include <beginnormal_vertex>
3237	#include <morphnormal_vertex>
3238	#include <skinbase_vertex>
3239	#include <skinnormal_vertex>
3240	#include <defaultnormal_vertex>
3241	#include <normal_vertex>
3242	#include <begin_vertex>
3243	#include <morphtarget_vertex>
3244	#include <skinning_vertex>
3245	#include <displacementmap_vertex>
3246	#include <project_vertex>
3247	#include <logdepthbuf_vertex>
3248	#include <clipping_planes_vertex>
3249	vViewPosition = - mvPosition.xyz;
3250	#include <worldpos_vertex>
3251	#include <shadowmap_vertex>
3252	#include <fog_vertex>
3253#ifdef USE_TRANSMISSION
3254	vWorldPosition = worldPosition.xyz;
3255#endif
3256}`,a_=`#define STANDARD
3257#ifdef PHYSICAL
3258	#define IOR
3259	#define USE_SPECULAR
3260#endif
3261uniform vec3 diffuse;
3262uniform vec3 emissive;
3263uniform float roughness;
3264uniform float metalness;
3265uniform float opacity;
3266#ifdef IOR
3267	uniform float ior;
3268#endif
3269#ifdef USE_SPECULAR
3270	uniform float specularIntensity;
3271	uniform vec3 specularColor;
3272	#ifdef USE_SPECULAR_COLORMAP
3273		uniform sampler2D specularColorMap;
3274	#endif
3275	#ifdef USE_SPECULAR_INTENSITYMAP
3276		uniform sampler2D specularIntensityMap;
3277	#endif
3278#endif
3279#ifdef USE_CLEARCOAT
3280	uniform float clearcoat;
3281	uniform float clearcoatRoughness;
3282#endif
3283#ifdef USE_DISPERSION
3284	uniform float dispersion;
3285#endif
3286#ifdef USE_IRIDESCENCE
3287	uniform float iridescence;
3288	uniform float iridescenceIOR;
3289	uniform float iridescenceThicknessMinimum;
3290	uniform float iridescenceThicknessMaximum;
3291#endif
3292#ifdef USE_SHEEN
3293	uniform vec3 sheenColor;
3294	uniform float sheenRoughness;
3295	#ifdef USE_SHEEN_COLORMAP
3296		uniform sampler2D sheenColorMap;
3297	#endif
3298	#ifdef USE_SHEEN_ROUGHNESSMAP
3299		uniform sampler2D sheenRoughnessMap;
3300	#endif
3301#endif
3302#ifdef USE_ANISOTROPY
3303	uniform vec2 anisotropyVector;
3304	#ifdef USE_ANISOTROPYMAP
3305		uniform sampler2D anisotropyMap;
3306	#endif
3307#endif
3308varying vec3 vViewPosition;
3309#include <common>
3310#include <dithering_pars_fragment>
3311#include <color_pars_fragment>
3312#include <uv_pars_fragment>
3313#include <map_pars_fragment>
3314#include <alphamap_pars_fragment>
3315#include <alphatest_pars_fragment>
3316#include <alphahash_pars_fragment>
3317#include <aomap_pars_fragment>
3318#include <lightmap_pars_fragment>
3319#include <emissivemap_pars_fragment>
3320#include <iridescence_fragment>
3321#include <cube_uv_reflection_fragment>
3322#include <envmap_common_pars_fragment>
3323#include <envmap_physical_pars_fragment>
3324#include <fog_pars_fragment>
3325#include <lights_pars_begin>
3326#include <normal_pars_fragment>
3327#include <lights_physical_pars_fragment>
3328#include <transmission_pars_fragment>
3329#include <shadowmap_pars_fragment>
3330#include <bumpmap_pars_fragment>
3331#include <normalmap_pars_fragment>
3332#include <clearcoat_pars_fragment>
3333#include <iridescence_pars_fragment>
3334#include <roughnessmap_pars_fragment>
3335#include <metalnessmap_pars_fragment>
3336#include <logdepthbuf_pars_fragment>
3337#include <clipping_planes_pars_fragment>
3338void main() {
3339	vec4 diffuseColor = vec4( diffuse, opacity );
3340	#include <clipping_planes_fragment>
3341	ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );
3342	vec3 totalEmissiveRadiance = emissive;
3343	#include <logdepthbuf_fragment>
3344	#include <map_fragment>
3345	#include <color_fragment>
3346	#include <alphamap_fragment>
3347	#include <alphatest_fragment>
3348	#include <alphahash_fragment>
3349	#include <roughnessmap_fragment>
3350	#include <metalnessmap_fragment>
3351	#include <normal_fragment_begin>
3352	#include <normal_fragment_maps>
3353	#include <clearcoat_normal_fragment_begin>
3354	#include <clearcoat_normal_fragment_maps>
3355	#include <emissivemap_fragment>
3356	#include <lights_physical_fragment>
3357	#include <lights_fragment_begin>
3358	#include <lights_fragment_maps>
3359	#include <lights_fragment_end>
3360	#include <aomap_fragment>
3361	vec3 totalDiffuse = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse;
3362	vec3 totalSpecular = reflectedLight.directSpecular + reflectedLight.indirectSpecular;
3363	#include <transmission_fragment>
3364	vec3 outgoingLight = totalDiffuse + totalSpecular + totalEmissiveRadiance;
3365	#ifdef USE_SHEEN
3366 
3367		outgoingLight = outgoingLight + sheenSpecularDirect + sheenSpecularIndirect;
3368 
3369 	#endif
3370	#ifdef USE_CLEARCOAT
3371		float dotNVcc = saturate( dot( geometryClearcoatNormal, geometryViewDir ) );
3372		vec3 Fcc = F_Schlick( material.clearcoatF0, material.clearcoatF90, dotNVcc );
3373		outgoingLight = outgoingLight * ( 1.0 - material.clearcoat * Fcc ) + ( clearcoatSpecularDirect + clearcoatSpecularIndirect ) * material.clearcoat;
3374	#endif
3375	#include <opaque_fragment>
3376	#include <tonemapping_fragment>
3377	#include <colorspace_fragment>
3378	#include <fog_fragment>
3379	#include <premultiplied_alpha_fragment>
3380	#include <dithering_fragment>
3381}`,o_=`#define TOON
3382varying vec3 vViewPosition;
3383#include <common>
3384#include <batching_pars_vertex>
3385#include <uv_pars_vertex>
3386#include <displacementmap_pars_vertex>
3387#include <color_pars_vertex>
3388#include <fog_pars_vertex>
3389#include <normal_pars_vertex>
3390#include <morphtarget_pars_vertex>
3391#include <skinning_pars_vertex>
3392#include <shadowmap_pars_vertex>
3393#include <logdepthbuf_pars_vertex>
3394#include <clipping_planes_pars_vertex>
3395void main() {
3396	#include <uv_vertex>
3397	#include <color_vertex>
3398	#include <morphinstance_vertex>
3399	#include <morphcolor_vertex>
3400	#include <batching_vertex>
3401	#include <beginnormal_vertex>
3402	#include <morphnormal_vertex>
3403	#include <skinbase_vertex>
3404	#include <skinnormal_vertex>
3405	#include <defaultnormal_vertex>
3406	#include <normal_vertex>
3407	#include <begin_vertex>
3408	#include <morphtarget_vertex>
3409	#include <skinning_vertex>
3410	#include <displacementmap_vertex>
3411	#include <project_vertex>
3412	#include <logdepthbuf_vertex>
3413	#include <clipping_planes_vertex>
3414	vViewPosition = - mvPosition.xyz;
3415	#include <worldpos_vertex>
3416	#include <shadowmap_vertex>
3417	#include <fog_vertex>
3418}`,l_=`#define TOON
3419uniform vec3 diffuse;
3420uniform vec3 emissive;
3421uniform float opacity;
3422#include <common>
3423#include <dithering_pars_fragment>
3424#include <color_pars_fragment>
3425#include <uv_pars_fragment>
3426#include <map_pars_fragment>
3427#include <alphamap_pars_fragment>
3428#include <alphatest_pars_fragment>
3429#include <alphahash_pars_fragment>
3430#include <aomap_pars_fragment>
3431#include <lightmap_pars_fragment>
3432#include <emissivemap_pars_fragment>
3433#include <gradientmap_pars_fragment>
3434#include <fog_pars_fragment>
3435#include <bsdfs>
3436#include <lights_pars_begin>
3437#include <normal_pars_fragment>
3438#include <lights_toon_pars_fragment>
3439#include <shadowmap_pars_fragment>
3440#include <bumpmap_pars_fragment>
3441#include <normalmap_pars_fragment>
3442#include <logdepthbuf_pars_fragment>
3443#include <clipping_planes_pars_fragment>
3444void main() {
3445	vec4 diffuseColor = vec4( diffuse, opacity );
3446	#include <clipping_planes_fragment>
3447	ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );
3448	vec3 totalEmissiveRadiance = emissive;
3449	#include <logdepthbuf_fragment>
3450	#include <map_fragment>
3451	#include <color_fragment>
3452	#include <alphamap_fragment>
3453	#include <alphatest_fragment>
3454	#include <alphahash_fragment>
3455	#include <normal_fragment_begin>
3456	#include <normal_fragment_maps>
3457	#include <emissivemap_fragment>
3458	#include <lights_toon_fragment>
3459	#include <lights_fragment_begin>
3460	#include <lights_fragment_maps>
3461	#include <lights_fragment_end>
3462	#include <aomap_fragment>
3463	vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;
3464	#include <opaque_fragment>
3465	#include <tonemapping_fragment>
3466	#include <colorspace_fragment>
3467	#include <fog_fragment>
3468	#include <premultiplied_alpha_fragment>
3469	#include <dithering_fragment>
3470}`,c_=`uniform float size;
3471uniform float scale;
3472#include <common>
3473#include <color_pars_vertex>
3474#include <fog_pars_vertex>
3475#include <morphtarget_pars_vertex>
3476#include <logdepthbuf_pars_vertex>
3477#include <clipping_planes_pars_vertex>
3478#ifdef USE_POINTS_UV
3479	varying vec2 vUv;
3480	uniform mat3 uvTransform;
3481#endif
3482void main() {
3483	#ifdef USE_POINTS_UV
3484		vUv = ( uvTransform * vec3( uv, 1 ) ).xy;
3485	#endif
3486	#include <color_vertex>
3487	#include <morphinstance_vertex>
3488	#include <morphcolor_vertex>
3489	#include <begin_vertex>
3490	#include <morphtarget_vertex>
3491	#include <project_vertex>
3492	gl_PointSize = size;
3493	#ifdef USE_SIZEATTENUATION
3494		bool isPerspective = isPerspectiveMatrix( projectionMatrix );
3495		if ( isPerspective ) gl_PointSize *= ( scale / - mvPosition.z );
3496	#endif
3497	#include <logdepthbuf_vertex>
3498	#include <clipping_planes_vertex>
3499	#include <worldpos_vertex>
3500	#include <fog_vertex>
3501}`,h_=`uniform vec3 diffuse;
3502uniform float opacity;
3503#include <common>
3504#include <color_pars_fragment>
3505#include <map_particle_pars_fragment>
3506#include <alphatest_pars_fragment>
3507#include <alphahash_pars_fragment>
3508#include <fog_pars_fragment>
3509#include <logdepthbuf_pars_fragment>
3510#include <clipping_planes_pars_fragment>
3511void main() {
3512	vec4 diffuseColor = vec4( diffuse, opacity );
3513	#include <clipping_planes_fragment>
3514	vec3 outgoingLight = vec3( 0.0 );
3515	#include <logdepthbuf_fragment>
3516	#include <map_particle_fragment>
3517	#include <color_fragment>
3518	#include <alphatest_fragment>
3519	#include <alphahash_fragment>
3520	outgoingLight = diffuseColor.rgb;
3521	#include <opaque_fragment>
3522	#include <tonemapping_fragment>
3523	#include <colorspace_fragment>
3524	#include <fog_fragment>
3525	#include <premultiplied_alpha_fragment>
3526}`,u_=`#include <common>
3527#include <batching_pars_vertex>
3528#include <fog_pars_vertex>
3529#include <morphtarget_pars_vertex>
3530#include <skinning_pars_vertex>
3531#include <logdepthbuf_pars_vertex>
3532#include <shadowmap_pars_vertex>
3533void main() {
3534	#include <batching_vertex>
3535	#include <beginnormal_vertex>
3536	#include <morphinstance_vertex>
3537	#include <morphnormal_vertex>
3538	#include <skinbase_vertex>
3539	#include <skinnormal_vertex>
3540	#include <defaultnormal_vertex>
3541	#include <begin_vertex>
3542	#include <morphtarget_vertex>
3543	#include <skinning_vertex>
3544	#include <project_vertex>
3545	#include <logdepthbuf_vertex>
3546	#include <worldpos_vertex>
3547	#include <shadowmap_vertex>
3548	#include <fog_vertex>
3549}`,d_=`uniform vec3 color;
3550uniform float opacity;
3551#include <common>
3552#include <fog_pars_fragment>
3553#include <bsdfs>
3554#include <lights_pars_begin>
3555#include <logdepthbuf_pars_fragment>
3556#include <shadowmap_pars_fragment>
3557#include <shadowmask_pars_fragment>
3558void main() {
3559	#include <logdepthbuf_fragment>
3560	gl_FragColor = vec4( color, opacity * ( 1.0 - getShadowMask() ) );
3561	#include <tonemapping_fragment>
3562	#include <colorspace_fragment>
3563	#include <fog_fragment>
3564}`,f_=`uniform float rotation;
3565uniform vec2 center;
3566#include <common>
3567#include <uv_pars_vertex>
3568#include <fog_pars_vertex>
3569#include <logdepthbuf_pars_vertex>
3570#include <clipping_planes_pars_vertex>
3571void main() {
3572	#include <uv_vertex>
3573	vec4 mvPosition = modelViewMatrix[ 3 ];
3574	vec2 scale = vec2( length( modelMatrix[ 0 ].xyz ), length( modelMatrix[ 1 ].xyz ) );
3575	#ifndef USE_SIZEATTENUATION
3576		bool isPerspective = isPerspectiveMatrix( projectionMatrix );
3577		if ( isPerspective ) scale *= - mvPosition.z;
3578	#endif
3579	vec2 alignedPosition = ( position.xy - ( center - vec2( 0.5 ) ) ) * scale;
3580	vec2 rotatedPosition;
3581	rotatedPosition.x = cos( rotation ) * alignedPosition.x - sin( rotation ) * alignedPosition.y;
3582	rotatedPosition.y = sin( rotation ) * alignedPosition.x + cos( rotation ) * alignedPosition.y;
3583	mvPosition.xy += rotatedPosition;
3584	gl_Position = projectionMatrix * mvPosition;
3585	#include <logdepthbuf_vertex>
3586	#include <clipping_planes_vertex>
3587	#include <fog_vertex>
3588}`,p_=`uniform vec3 diffuse;
3589uniform float opacity;
3590#include <common>
3591#include <uv_pars_fragment>
3592#include <map_pars_fragment>
3593#include <alphamap_pars_fragment>
3594#include <alphatest_pars_fragment>
3595#include <alphahash_pars_fragment>
3596#include <fog_pars_fragment>
3597#include <logdepthbuf_pars_fragment>
3598#include <clipping_planes_pars_fragment>
3599void main() {
3600	vec4 diffuseColor = vec4( diffuse, opacity );
3601	#include <clipping_planes_fragment>
3602	vec3 outgoingLight = vec3( 0.0 );
3603	#include <logdepthbuf_fragment>
3604	#include <map_fragment>
3605	#include <alphamap_fragment>
3606	#include <alphatest_fragment>
3607	#include <alphahash_fragment>
3608	outgoingLight = diffuseColor.rgb;
3609	#include <opaque_fragment>
3610	#include <tonemapping_fragment>
3611	#include <colorspace_fragment>
3612	#include <fog_fragment>
3613}`,Je={alphahash_fragment:Fm,alphahash_pars_fragment:Om,alphamap_fragment:Bm,alphamap_pars_fragment:zm,alphatest_fragment:Vm,alphatest_pars_fragment:km,aomap_fragment:Gm,aomap_pars_fragment:Hm,batching_pars_vertex:Wm,batching_vertex:Xm,begin_vertex:qm,beginnormal_vertex:Ym,bsdfs:Zm,iridescence_fragment:Jm,bumpmap_pars_fragment:$m,clipping_planes_fragment:Km,clipping_planes_pars_fragment:Qm,clipping_planes_pars_vertex:jm,clipping_planes_vertex:eg,color_fragment:tg,color_pars_fragment:ng,color_pars_vertex:ig,color_vertex:sg,common:rg,cube_uv_reflection_fragment:ag,defaultnormal_vertex:og,displacementmap_pars_vertex:lg,displacementmap_vertex:cg,emissivemap_fragment:hg,emissivemap_pars_fragment:ug,colorspace_fragment:dg,colorspace_pars_fragment:fg,envmap_fragment:pg,envmap_common_pars_fragment:mg,envmap_pars_fragment:gg,envmap_pars_vertex:_g,envmap_physical_pars_fragment:Cg,envmap_vertex:xg,fog_vertex:vg,fog_pars_vertex:yg,fog_fragment:Mg,fog_pars_fragment:Sg,gradientmap_pars_fragment:bg,lightmap_pars_fragment:Ag,lights_lambert_fragment:Tg,lights_lambert_pars_fragment:Eg,lights_pars_begin:wg,lights_toon_fragment:Rg,lights_toon_pars_fragment:Ig,lights_phong_fragment:Pg,lights_phong_pars_fragment:Lg,lights_physical_fragment:Dg,lights_physical_pars_fragment:Ug,lights_fragment_begin:Ng,lights_fragment_maps:Fg,lights_fragment_end:Og,logdepthbuf_fragment:Bg,logdepthbuf_pars_fragment:zg,logdepthbuf_pars_vertex:Vg,logdepthbuf_vertex:kg,map_fragment:Gg,map_pars_fragment:Hg,map_particle_fragment:Wg,map_particle_pars_fragment:Xg,metalnessmap_fragment:qg,metalnessmap_pars_fragment:Yg,morphinstance_vertex:Zg,morphcolor_vertex:Jg,morphnormal_vertex:$g,morphtarget_pars_vertex:Kg,morphtarget_vertex:Qg,normal_fragment_begin:jg,normal_fragment_maps:e0,normal_pars_fragment:t0,normal_pars_vertex:n0,normal_vertex:i0,normalmap_pars_fragment:s0,clearcoat_normal_fragment_begin:r0,clearcoat_normal_fragment_maps:a0,clearcoat_pars_fragment:o0,iridescence_pars_fragment:l0,opaque_fragment:c0,packing:h0,premultiplied_alpha_fragment:u0,project_vertex:d0,dithering_fragment:f0,dithering_pars_fragment:p0,roughnessmap_fragment:m0,roughnessmap_pars_fragment:g0,shadowmap_pars_fragment:_0,shadowmap_pars_vertex:x0,shadowmap_vertex:v0,shadowmask_pars_fragment:y0,skinbase_vertex:M0,skinning_pars_vertex:S0,skinning_vertex:b0,skinnormal_vertex:A0,specularmap_fragment:T0,specularmap_pars_fragment:E0,tonemapping_fragment:w0,tonemapping_pars_fragment:C0,transmission_fragment:R0,transmission_pars_fragment:I0,uv_pars_fragment:P0,uv_pars_vertex:L0,uv_vertex:D0,worldpos_vertex:U0,background_vert:N0,background_frag:F0,backgroundCube_vert:O0,backgroundCube_frag:B0,cube_vert:z0,cube_frag:V0,depth_vert:k0,depth_frag:G0,distance_vert:H0,distance_frag:W0,equirect_vert:X0,equirect_frag:q0,linedashed_vert:Y0,linedashed_frag:Z0,meshbasic_vert:J0,meshbasic_frag:$0,meshlambert_vert:K0,meshlambert_frag:Q0,meshmatcap_vert:j0,meshmatcap_frag:e_,meshnormal_vert:t_,meshnormal_frag:n_,meshphong_vert:i_,meshphong_frag:s_,meshphysical_vert:r_,meshphysical_frag:a_,meshtoon_vert:o_,meshtoon_frag:l_,points_vert:c_,points_frag:h_,shadow_vert:u_,shadow_frag:d_,sprite_vert:f_,sprite_frag:p_},me={common:{diffuse:{value:new Me(16777215)},opacity:{value:1},map:{value:null},mapTransform:{value:new Ye},alphaMap:{value:null},alphaMapTransform:{value:new Ye},alphaTest:{value:0}},specularmap:{specularMap:{value:null},specularMapTransform:{value:new Ye}},envmap:{envMap:{value:null},envMapRotation:{value:new Ye},flipEnvMap:{value:-1},reflectivity:{value:1},ior:{value:1.5},refractionRatio:{value:.98},dfgLUT:{value:null}},aomap:{aoMap:{value:null},aoMapIntensity:{value:1},aoMapTransform:{value:new Ye}},lightmap:{lightMap:{value:null},lightMapIntensity:{value:1},lightMapTransform:{value:new Ye}},bumpmap:{bumpMap:{value:null},bumpMapTransform:{value:new Ye},bumpScale:{value:1}},normalmap:{normalMap:{value:null},normalMapTransform:{value:new Ye},normalScale:{value:new K(1,1)}}
vendor: 7,484 bytes, line 3613
3613,displacementmap:{displacementMap:{value:null},displacementMapTransform:{value:new Ye},displacementScale:{value:1},displacementBias:{value:0}},emissivemap:{emissiveMap:{value:null},emissiveMapTransform:{value:new Ye}},metalnessmap:{metalnessMap:{value:null},metalnessMapTransform:{value:new Ye}},roughnessmap:{roughnessMap:{value:null},roughnessMapTransform:{value:new Ye}},gradientmap:{gradientMap:{value:null}},fog:{fogDensity:{value:25e-5},fogNear:{value:1},fogFar:{value:2e3},fogColor:{value:new Me(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 Me(16777215)},opacity:{value:1},size:{value:1},scale:{value:1},map:{value:null},alphaMap:{value:null},alphaMapTransform:{value:new Ye},alphaTest:{value:0},uvTransform:{value:new Ye}},sprite:{diffuse:{value:new Me(16777215)},opacity:{value:1},center:{value:new K(.5,.5)},rotation:{value:0},map:{value:null},mapTransform:{value:new Ye},alphaMap:{value:null},alphaMapTransform:{value:new Ye},alphaTest:{value:0}}},yn={basic:{uniforms:Nt([me.common,me.specularmap,me.envmap,me.aomap,me.lightmap,me.fog]),vertexShader:Je.meshbasic_vert,fragmentShader:Je.meshbasic_frag},lambert:{uniforms:Nt([me.common,me.specularmap,me.envmap,me.aomap,me.lightmap,me.emissivemap,me.bumpmap,me.normalmap,me.displacementmap,me.fog,me.lights,{emissive:{value:new Me(0)}}]),vertexShader:Je.meshlambert_vert,fragmentShader:Je.meshlambert_frag},phong:{uniforms:Nt([me.common,me.specularmap,me.envmap,me.aomap,me.lightmap,me.emissivemap,me.bumpmap,me.normalmap,me.displacementmap,me.fog,me.lights,{emissive:{value:new Me(0)},specular:{value:new Me(1118481)},shininess:{value:30}}]),vertexShader:Je.meshphong_vert,fragmentShader:Je.meshphong_frag},standard:{uniforms:Nt([me.common,me.envmap,me.aomap,me.lightmap,me.emissivemap,me.bumpmap,me.normalmap,me.displacementmap,me.roughnessmap,me.metalnessmap,me.fog,me.lights,{emissive:{value:new Me(0)},roughness:{value:1},metalness:{value:0},envMapIntensity:{value:1}}]),vertexShader:Je.meshphysical_vert,fragmentShader:Je.meshphysical_frag},toon:{uniforms:Nt([me.common,me.aomap,me.lightmap,me.emissivemap,me.bumpmap,me.normalmap,me.displacementmap,me.gradientmap,me.fog,me.lights,{emissive:{value:new Me(0)}}]),vertexShader:Je.meshtoon_vert,fragmentShader:Je.meshtoon_frag},matcap:{uniforms:Nt([me.common,me.bumpmap,me.normalmap,me.displacementmap,me.fog,{matcap:{value:null}}]),vertexShader:Je.meshmatcap_vert,fragmentShader:Je.meshmatcap_frag},points:{uniforms:Nt([me.points,me.fog]),vertexShader:Je.points_vert,fragmentShader:Je.points_frag},dashed:{uniforms:Nt([me.common,me.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:Je.linedashed_vert,fragmentShader:Je.linedashed_frag},depth:{uniforms:Nt([me.common,me.displacementmap]),vertexShader:Je.depth_vert,fragmentShader:Je.depth_frag},normal:{uniforms:Nt([me.common,me.bumpmap,me.normalmap,me.displacementmap,{opacity:{value:1}}]),vertexShader:Je.meshnormal_vert,fragmentShader:Je.meshnormal_frag},sprite:{uniforms:Nt([me.sprite,me.fog]),vertexShader:Je.sprite_vert,fragmentShader:Je.sprite_frag},background:{uniforms:{uvTransform:{value:new Ye},t2D:{value:null},backgroundIntensity:{value:1}},vertexShader:Je.background_vert,fragmentShader:Je.background_frag},backgroundCube:{uniforms:{envMap:{value:null},flipEnvMap:{value:-1},backgroundBlurriness:{value:0},backgroundIntensity:{value:1},backgroundRotation:{value:new Ye}},vertexShader:Je.backgroundCube_vert,fragmentShader:Je.backgroundCube_frag},cube:{uniforms:{tCube:{value:null},tFlip:{value:-1},opacity:{value:1}},vertexShader:Je.cube_vert,fragmentShader:Je.cube_frag},equirect:{uniforms:{tEquirect:{value:null}},vertexShader:Je.equirect_vert,fragmentShader:Je.equirect_frag},distance:{uniforms:Nt([me.common,me.displacementmap,{referencePosition:{value:new R},nearDistance:{value:1},farDistance:{value:1e3}}]),vertexShader:Je.distance_vert,fragmentShader:Je.distance_frag},shadow:{uniforms:Nt([me.lights,me.fog,{color:{value:new Me(0)},opacity:{value:1}}]),vertexShader:Je.shadow_vert,fragmentShader:Je.shadow_frag}};yn.physical={uniforms:Nt([yn.standard.uniforms,{clearcoat:{value:0},clearcoatMap:{value:null},clearcoatMapTransform:{value:new Ye},clearcoatNormalMap:{value:null},clearcoatNormalMapTransform:{value:new Ye},clearcoatNormalScale:{value:new K(1,1)},clearcoatRoughness:{value:0},clearcoatRoughnessMap:{value:null},clearcoatRoughnessMapTransform:{value:new Ye},dispersion:{value:0},iridescence:{value:0},iridescenceMap:{value:null},iridescenceMapTransform:{value:new Ye},iridescenceIOR:{value:1.3},iridescenceThicknessMinimum:{value:100},iridescenceThicknessMaximum:{value:400},iridescenceThicknessMap:{value:null},iridescenceThicknessMapTransform:{value:new Ye},sheen:{value:0},sheenColor:{value:new Me(0)},sheenColorMap:{value:null},sheenColorMapTransform:{value:new Ye},sheenRoughness:{value:1},sheenRoughnessMap:{value:null},sheenRoughnessMapTransform:{value:new Ye},transmission:{value:0},transmissionMap:{value:null},transmissionMapTransform:{value:new Ye},transmissionSamplerSize:{value:new K},transmissionSamplerMap:{value:null},thickness:{value:0},thicknessMap:{value:null},thicknessMapTransform:{value:new Ye},attenuationDistance:{value:0},attenuationColor:{value:new Me(0)},specularColor:{value:new Me(1,1,1)},specularColorMap:{value:null},specularColorMapTransform:{value:new Ye},specularIntensity:{value:1},specularIntensityMap:{value:null},specularIntensityMapTransform:{value:new Ye},anisotropyVector:{value:new K},anisotropyMap:{value:null},anisotropyMapTransform:{value:new Ye}}]),vertexShader:Je.meshphysical_vert,fragmentShader:Je.meshphysical_frag};const Wr={r:0,b:0,g:0},mi=new cn,m_=new Ge;function g_(r,e,t,n,i,s,a){const o=new Me(0);let l=s===!0?0:1,c,h,u=null,d=0,f=null;function m(x){let M=x.isScene===!0?x.background:null;return M&&M.isTexture&&(M=(x.backgroundBlurriness>0?t:e).get(M)),M}function _(x){let M=!1;const T=m(x);T===null?p(o,l):T&&T.isColor&&(p(T,1),M=!0);const E=r.xr.getEnvironmentBlendMode();E==="additive"?n.buffers.color.setClear(0,0,0,1,a):E==="alpha-blend"&&n.buffers.color.setClear(0,0,0,0,a),(r.autoClear||M)&&(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(x,M){const T=m(M);T&&(T.isCubeTexture||T.mapping===$s)?(h===void 0&&(h=new At(new fs(1,1,1),new pn({name:"Backgroun
3613dCubeMaterial",uniforms:hs(yn.backgroundCube.uniforms),vertexShader:yn.backgroundCube.vertexShader,fragmentShader:yn.backgroundCube.fragmentShader,side:Xt,depthTest:!1,depthWrite:!1,fog:!1,allowOverride:!1})),h.geometry.deleteAttribute("normal"),h.geometry.deleteAttribute("uv"),h.onBeforeRender=function(E,C,P){this.matrixWorld.copyPosition(P.matrixWorld)},Object.defineProperty(h.material,"envMap",{get:function(){return this.uniforms.envMap.value}}),i.update(h)),mi.copy(M.backgroundRotation),mi.x*=-1,mi.y*=-1,mi.z*=-1,T.isCubeTexture&&T.isRenderTargetTexture===!1&&(mi.y*=-1,mi.z*=-1),h.material.uniforms.envMap.value=T,h.material.uniforms.flipEnvMap.value=T.isCubeTexture&&T.isRenderTargetTexture===!1?-1:1,h.material.uniforms.backgroundBlurriness.value=M.backgroundBlurriness,h.material.uniforms.backgroundIntensity.value=M.backgroundIntensity,h.material.uniforms.backgroundRotation.value.setFromMatrix4(m_.makeRotationFromEuler(mi)),h.material.toneMapped=je.getTransfer(T.colorSpace)!==rt,(u!==T||d!==T.version||f!==r.toneMapping)&&(h.material.needsUpdate=!0,u=T,d=T.version,f=r.toneMapping),h.layers.enableAll(),x.unshift(h,h.geometry,h.material,0,0,null)):T&&T.isTexture&&(c===void 0&&(c=new At(new js(2,2),new pn({name:"BackgroundMaterial",uniforms:hs(yn.background.uniforms),vertexShader:yn.background.vertexShader,fragmentShader:yn.background.fragmentShader,side:Qn,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=T,c.material.uniforms.backgroundIntensity.value=M.backgroundIntensity,c.material.toneMapped=je.getTransfer(T.colorSpace)!==rt,T.matrixAutoUpdate===!0&&T.updateMatrix(),c.material.uniforms.uvTransform.value.copy(T.matrix),(u!==T||d!==T.version||f!==r.toneMapping)&&(c.material.needsUpdate=!0,u=T,d=T.version,f=r.toneMapping),c.layers.enableAll(),x.unshift(c,c.geometry,c.material,0,0,null))}function p(x,M){x.getRGB(Wr,xu(r)),n.buffers.color.setClear(Wr.r,Wr.g,Wr.b,M,a)}function v(){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(x,M=1){o.set(x),l=M,p(o,l)},getClearAlpha:function(){return l},setClearAlpha:function(x){l=x,p(o,l)},render:_,addToRenderList:g,dispose:v}}function __(r,e){const t=r.getParameter(r.MAX_VERTEX_ATTRIBS),n={},i=d(null);let s=i,a=!1;function o(b,L,F,B,G){let q=!1;const V=u(B,F,L);s!==V&&(s=V,c(s.object)),q=f(b,B,F,G),q&&m(b,B,F,G),G!==null&&e.update(G,r.ELEMENT_ARRAY_BUFFER),(q||a)&&(a=!1,M(b,L,F,B),G!==null&&r.bindBuffer(r.ELEMENT_ARRAY_BUFFER,e.get(G).buffer))}function l(){return r.createVertexArray()}function c(b){return r.bindVertexArray(b)}function h(b){return r.deleteVertexArray(b)}function u(b,L,F){const B=F.wireframe===!0;let G=n[b.id];G===void 0&&(G={},n[b.id]=G);let q=G[L.id];q===void 0&&(q={},G[L.id]=q);let V=q[B];return V===void 0&&(V=d(l()),q[B]=V),V}function d(b){const L=[],F=[],B=[];for(let G=0;G<t;G++)L[G]=0,F[G]=0,B[G]=0;return{geometry:null,program:null,wireframe:!1,newAttributes:L,enabledAttributes:F,attributeDivisors:B,object:b,attributes:{},index:null}}function f(b,L,F,B){const G=s.attributes,q=L.attributes;let V=0;const H=F.getAttributes();for(const j in H)if(H[j].location>=0){const oe=G[j];let he=q[j];if(he===void 0&&(j==="instanceMatrix"&&b.instanceMatrix&&(he=b.instanceMatrix),j==="instanceColor"&&b.instanceColor&&(he=b.instanceColor)),oe===void 0||oe.attribute!==he||he&&oe.data!==he.data)return!0;V++}return s.attributesNum!==V||s.index!==B}function m(b,L,F,B){const G={},q=L.attributes;let V=0;const H=F.getAttributes();for(const j in H)if(H[j].location>=0){let oe=q[j];oe===void 0&&(j==="instanceMatrix"&&b.instanceMatrix&&(oe=b.instanceMatrix),j==="instanceColor"&&b.instanceColor&&(oe=b.instanceColor));const he={};he.attribute=oe,oe&&oe.data&&(he.data=oe.data),G[j]=he,V++}s.attributes=G,s.attributesNum=V,s.index=B}function _(){const b=s.newAttributes;for(let L=0,F=b.length;L<F;L++)b[L]=0}function g(b){p(b,0)}function p(b,L){const F=s.newAttributes,B=s.enabledAttributes,G=s.attributeDivisors;F[b]=1,B[b]===0&&(r.enableVertexAttribArray(b),B[b]=1),G[b]!==L&&(r.vertexAttribDivisor(b,L),G[b]=L)}function v(){const b=s.newAttributes,L=s.enabledAttributes;for(let F=0,B=L.length;F<B;F++)L[F]!==b[F]&&(r.disableVertexAttribArray(F),L[F]=0)}function x(b,L,F,B,G,q,V){V===!0?r.vertexAttribIPointer(b,L,F,G,q):r.vertexAttribPointer(b,L,F,B,G,q)}function M(b,L,F,B){_();const G=B.attributes,q=F.getAttributes(),V=L.defaultAttributeValues;for(const H in q){const j=q[H];if(j.location>=0){let pe=G[H];if(pe===void 0&&(H==="instanceMatrix"&&b.instanceMatrix&&(pe=b.instanceMatrix),H==="instanceColor"&&b.instanceColor&&(pe=b.instanceColor)),pe!==void 0){const oe=pe.normalized,he=pe.itemSize,We=e.get(pe);if(We===void 0)continue;
vendor: 2,441 bytes, line 3613
3613const ke=We.buffer,at=We.type,ot=We.bytesPerElement,Y=at===r.INT||at===r.UNSIGNED_INT||pe.gpuType===Ml;if(pe.isInterleavedBufferAttribute){const ee=pe.data,Se=ee.stride,Fe=pe.offset;if(ee.isInstancedInterleavedBuffer){for(let Ae=0;Ae<j.locationSize;Ae++)p(j.location+Ae,ee.meshPerAttribute);b.isInstancedMesh!==!0&&B._maxInstanceCount===void 0&&(B._maxInstanceCount=ee.meshPerAttribute*ee.count)}else for(let Ae=0;Ae<j.locationSize;Ae++)g(j.location+Ae);r.bindBuffer(r.ARRAY_BUFFER,ke);for(let Ae=0;Ae<j.locationSize;Ae++)x(j.location+Ae,he/j.locationSize,at,oe,Se*ot,(Fe+he/j.locationSize*Ae)*ot,Y)}else{if(pe.isInstancedBufferAttribute){for(let ee=0;ee<j.locationSize;ee++)p(j.location+ee,pe.meshPerAttribute);b.isInstancedMesh!==!0&&B._maxInstanceCount===void 0&&(B._maxInstanceCount=pe.meshPerAttribute*pe.count)}else for(let ee=0;ee<j.locationSize;ee++)g(j.location+ee);r.bindBuffer(r.ARRAY_BUFFER,ke);for(let ee=0;ee<j.locationSize;ee++)x(j.location+ee,he/j.locationSize,at,oe,he*ot,he/j.locationSize*ee*ot,Y)}}else if(V!==void 0){const oe=V[H];if(oe!==void 0)switch(oe.length){case 2:r.vertexAttrib2fv(j.location,oe);break;case 3:r.vertexAttrib3fv(j.location,oe);break;case 4:r.vertexAttrib4fv(j.location,oe);break;default:r.vertexAttrib1fv(j.location,oe)}}}}v()}function T(){P();for(const b in n){const L=n[b];for(const F in L){const B=L[F];for(const G in B)h(B[G].object),delete B[G];delete L[F]}delete n[b]}}function E(b){if(n[b.id]===void 0)return;const L=n[b.id];for(const F in L){const B=L[F];for(const G in B)h(B[G].object),delete B[G];delete L[F]}delete n[b.id]}function C(b){for(const L in n){const F=n[L];if(F[b.id]===void 0)continue;const B=F[b.id];for(const G in B)h(B[G].object),delete B[G];delete F[b.id]}}function P(){S(),a=!0,s!==i&&(s=i,c(s.object))}function S(){i.geometry=null,i.program=null,i.wireframe=!1}return{setup:o,reset:P,resetDefaultState:S,dispose:T,releaseStatesOfGeometry:E,releaseStatesOfProgram:C,initAttributes:_,enableAttribute:g,disableUnusedAttributes:v}}function x_(r,e,t){let n;function i(c){n=c}function s(c,h){r.drawArrays(n,c,h),t.update(h,n,1)}function a(c,h,u){u!==0&&(r.drawArraysInstanced(n,c,h,u),t.update(h,n,u))}function o(c,h,u){if(u===0)return;e.get("WEBGL_multi_draw").multiDrawArraysWEBGL(n,c,0,h,0,u);let f=0;for(let m=0;m<u;m++)f+=h[m];t.update(f,n,1)}function l(c,h,u,d){if(u===0)return;const f=e.get("WEBGL_multi_draw");if(f===null)for(let m=0;m<c.length;m++)a(c[m],h[m],d[m]);
vendor: 7,249 bytes, line 3613
3613else{f.multiDrawArraysInstancedWEBGL(n,c,0,h,0,d,0,u);let m=0;for(let _=0;_<u;_++)m+=h[_]*d[_];t.update(m,n,1)}}this.setMode=i,this.render=s,this.renderInstances=a,this.renderMultiDraw=o,this.renderMultiDrawInstances=l}function v_(r,e,t,n){let i;function s(){if(i!==void 0)return i;if(e.has("EXT_texture_filter_anisotropic")===!0){const C=e.get("EXT_texture_filter_anisotropic");i=r.getParameter(C.MAX_TEXTURE_MAX_ANISOTROPY_EXT)}else i=0;return i}function a(C){return!(C!==Wt&&n.convert(C)!==r.getParameter(r.IMPLEMENTATION_COLOR_READ_FORMAT))}function o(C){const P=C===zn&&(e.has("EXT_color_buffer_half_float")||e.has("EXT_color_buffer_float"));return!(C!==Qt&&n.convert(C)!==r.getParameter(r.IMPLEMENTATION_COLOR_READ_TYPE)&&C!==Ht&&!P)}function l(C){if(C==="highp"){if(r.getShaderPrecisionFormat(r.VERTEX_SHADER,r.HIGH_FLOAT).precision>0&&r.getShaderPrecisionFormat(r.FRAGMENT_SHADER,r.HIGH_FLOAT).precision>0)return"highp";C="mediump"}return C==="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=t.precision!==void 0?t.precision:"highp";const h=l(c);h!==c&&(de("WebGLRenderer:",c,"not supported, using",h,"instead."),c=h);const u=t.logarithmicDepthBuffer===!0,d=t.reversedDepthBuffer===!0&&e.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),v=r.getParameter(r.MAX_VERTEX_UNIFORM_VECTORS),x=r.getParameter(r.MAX_VARYING_VECTORS),M=r.getParameter(r.MAX_FRAGMENT_UNIFORM_VECTORS),T=r.getParameter(r.MAX_SAMPLES),E=r.getParameter(r.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:v,maxVaryings:x,maxFragmentUniforms:M,maxSamples:T,samples:E}}function y_(r){const e=this;let t=null,n=0,i=!1,s=!1;const a=new _i,o=new Ye,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){t=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 v=s?0:n,x=v*4;let M=p.clippingState||null;l.value=M,M=h(m,d,x,f);for(let T=0;T!==x;++T)M[T]=t[T];p.clippingState=M,this.numIntersection=_?this.numPlanes:0,this.numPlanes+=v}};function c(){l.value!==t&&(l.value=t,l.needsUpdate=n>0),e.numPlanes=n,e.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,v=d.matrixWorldInverse;o.getNormalMatrix(v),(g===null||g.length<p)&&(g=new Float32Array(p));for(let x=0,M=f;x!==_;++x,M+=4)a.copy(u[x]).applyMatrix4(v,o),a.normal.toArray(g,M),g[M+3]=a.constant}l.value=g,l.needsUpdate=!0}return e.numPlanes=_,e.numIntersection=0,g}}function M_(r){let e=new WeakMap;function t(a,o){return o===jr?a.mapping=Bn:o===ea&&(a.mapping=Ai),a}function n(a){if(a&&a.isTexture){const o=a.mapping;if(o===jr||o===ea)if(e.has(a)){const l=e.get(a).texture;return t(l,a.mapping)}else{const l=a.image;if(l&&l.height>0){const c=new vu(l.height);return c.fromEquirectangularTexture(r,a),e.set(a,c),a.addEventListener("dispose",i),t(c.texture,a.mapping)}else return null}}return a}function i(a){const o=a.target;o.removeEventListener("dispose",i);const l=e.get(o);l!==void 0&&(e.delete(o),l.dispose())}function s(){e=new WeakMap}return{get:n,dispose:s}}const Kn=4,Ch=[.125,.215,.35,.446,.526,.582],vi=20,S_=256,Rs=new Aa,Rh=new Me;let go=null,_o=0,xo=0,vo=!1;const b_=new R;class Ih{constructor(e){this._renderer=e,this._pingPongRenderTarget=null,this._lodMax=0,this._cubeSize=0,this._sizeLods=[],this._sigmas=[],this._lodMeshes=[],this._backgroundBox=null,this._cubemapMaterial=null,this._equirectMaterial=null,this._blurMaterial=null,this._ggxMaterial=null}fromScene(e,t=0,n=.1,i=100,s={}){const{size:a=256,position:o=b_}=s;go=this._renderer.getRenderTarget(),_o=this._renderer.getActiveCubeFace(),xo=this._renderer.getActiveMipmapLevel(),vo=this._renderer.xr.enabled,this._renderer.xr.enabled=!1,this._setSize(a);const l=this._allocateTargets();return l.depthBuffer=!0,this._sceneToCubeUV(e,n,i,l,o),t>0&&this._blur(l,0,0,t),this._applyPMREM(l),this._cleanup(l),l}fromEquirectangular(e,t=null){return this._fromTexture(e,t)}fromCubemap(e,t=null){return this._fromTexture(e,t)}compileCubemapShader(){this._cubemapMaterial===null&&(this._cubemapMaterial=Dh(),this._compileMaterial(this._cubemapMaterial))}compileEquirectangularShader(){this._equirectMaterial===null&&(this._equirectMaterial=Lh(),this._compileMaterial(this._equirectMaterial))}dispose(){this._dispose(),this._cubemapMaterial!==null&&this._cubemapMaterial.dispose(),this._equirectMaterial!==null&&this._equirectMaterial.dispose(),this._backgroundBox!==null&&(this._backgroundBox.geometry.dispose(),this._backgroundBox.material.dispose())}_setSize(e){this._lodMax=Math.floor(Math.log2(e)),this._cubeSize=Math.pow(2,this._lodMax)}_dispose(){this._blurMaterial!==null&&this._blurMaterial.dispose(),this._ggxMaterial!==null&&this._ggxMaterial.dispose(),this._pingPongRenderTarget!==null&&this._pingPongRenderTarget.dispose();for(let e=0;e<this._lodMeshes.length;e++)this._lodMeshes[e].geometry.dispose()}_cleanup(e){this._renderer.setRenderTarget(go,_o,xo),this._renderer.xr.enabled=vo,e.scissorTest=!1,ji(e,0,0,e.width,e.height)}_fromTexture(e,t){e.mapping===Bn||e.mapping===Ai?this._setSize(e.image.length===0?16:e.image[0].width||e.image[0].image.width):this._setSize(e.image.width/4),go=this._renderer.getRenderTarget(),_o=this._renderer.getActiveCubeFace(),xo=this._renderer.getActiveMipmapLevel(),vo=this._renderer.xr.enabled,this._renderer.xr.enabled=!1;const n=t||this._allocateTargets();return this._textureToCubeUV(e,n),this._applyPMREM(n),this._cleanup(n),n}_allocateTargets(){const e=3*Math.max(this._cubeSize,112),t=4*this._cubeSize,n={magFilter:mt,minFilter:mt,generateMipmaps:!1,type:zn,format:Wt,colorSpace:ls,depthBuffer:!1},i=Ph(e,t,n);if(this._pingPongRenderTarget===null||this._pingPongRenderTarget.width!==e||this._pingPongRenderTarget.height!==t){this._pingPongRenderTarget!==null&&this._dispose(),this._pingPongRenderTarget=Ph(e,t,n);const{_lodMax:s}=this;({lodMeshes:this._lodMeshes,sizeLods:this._sizeLods,sigmas:this._sigmas}=A_(s)),this._blurMaterial=E_(s,e,t),this._ggxMaterial=T_(s,e,t)}return i}_compileMaterial(e){const t=new At(new qe,e);this._renderer.compile(t,Rs)}_sceneToCubeUV(e,t,n,i,s){const l=new Pt(90,1,t,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(Rh),u.toneMapping=Sn,u.autoClear=!1,u.state.buffers.depth.getReversed()&&(u.setRenderTarget(i),u.clearDepth(),u.setRenderTarget(null)),this._backgroundBox===null&&(this._backgroundBox=new At(new fs,new Ci({name:"PMREM.Backgroun
3613d",side:Xt,depthWrite:!1,depthTest:!1})));const _=this._backgroundBox,g=_.material;let p=!1;const v=e.background;v?v.isColor&&(g.color.copy(v),e.background=null,p=!0):(g.color.copy(Rh),p=!0);for(let x=0;x<6;x++){const M=x%3;M===0?(l.up.set(0,c[x],0),l.position.set(s.x,s.y,s.z),l.lookAt(s.x+h[x],s.y,s.z)):M===1?(l.up.set(0,0,c[x]),l.position.set(s.x,s.y,s.z),l.lookAt(s.x,s.y+h[x],s.z)):(l.up.set(0,c[x],0),l.position.set(s.x,s.y,s.z),l.lookAt(s.x,s.y,s.z+h[x]));const T=this._cubeSize;ji(i,M*T,x>2?T:0,T,T),u.setRenderTarget(i),p&&u.render(_,l),u.render(e,l)}u.toneMapping=f,u.autoClear=d,e.background=v}_textureToCubeUV(e,t){const n=this._renderer,i=e.mapping===Bn||e.mapping===Ai;i?(this._cubemapMaterial===null&&(this._cubemapMaterial=Dh()),this._cubemapMaterial.uniforms.flipEnvMap.value=e.isRenderTargetTexture===!1?-1:1):this._equirectMaterial===null&&(this._equirectMaterial=Lh());const s=i?this._cubemapMaterial:this._equirectMaterial,a=this._lodMeshes[0];a.material=s;const o=s.uniforms;o.envMap.value=e;const l=this._cubeSize;ji(t,0,0,3*l,2*l),n.setRenderTarget(t),n.render(a,Rs)}_applyPMREM(e){const t=this._renderer,n=t.autoClear;t.autoClear=!1;const i=this._lodMeshes.length;for(let s=1;s<i;s++)this._applyGGXFilter(e,s-1,s);t.autoClear=n}_applyGGXFilter(e,t,n){const i=this._renderer,s=this._pingPongRenderTarget,a=this._ggxMaterial,o=this._lodMeshes[n];o.material=a;const l=a.uniforms,c=n/(this._lodMeshes.length-1),h=t/(this._lodMeshes.length-1),u=Math.sqrt(c*c-h*h),d=0+c*1.25,f=u*d,{_lodMax:m}=this,_=this._sizeLods[n],g=3*_*(n>m-Kn?n-m+Kn:0),p=4*(this._cubeSize-_);l.envMap.value=e.texture,l.roughness.value=f,l.mipInt.value=m-t,ji(s,g,p,3*_,2*_),i.setRenderTarget(s),i.render(o,Rs),l.envMap.value=s.texture,l.roughness.value=0,l.mipInt.value=m-n,ji(e,g,p,3*_,2*_),i.setRenderTarget(e),i.render(o,Rs)}_blur(e,t,n,i,s){const a=this._pingPongRenderTarget;this._halfBlur(e,a,t,n,i,"latitudinal",s),this._halfBlur(a,e,n,n,i,"longitudinal",s)}_halfBlur(e,t,n,i,s,a,o){const l=this._renderer,c=this._blurMaterial;a!=="latitudinal"&&a!=="longitudinal"&&Le("blur direction must be either latitudinal or longitudinal!");const h=3,u=this._lodMeshes[i];u.material=c;const d=c.uniforms,f=this._sizeLods[n]-1,m=isFinite(s)?Math.PI/(2*f):2*Math.PI/(2*vi-1),_=s/m,g=isFinite(s)?1+Math.floor(h*_):vi;g>vi&&de(`sigmaRadians, ${s}, is too large and will clip, as it requested ${g} samples when the maximum is set to ${vi}`);const p=[];let v=0;for(let C=0;C<vi;++C){const P=C/_,S=Math.exp(-P*P/2);p.push(S),C===0?v+=S:C<g&&(v+=2*S)}for(let C=0;C<p.length;C++)p[C]=p[C]/v;d.envMap.value=e.texture,d.samples.value=g,d.weights.value=p,d.latitudinal.value=a==="latitudinal",o&&(d.poleAxis.value=o);const{_lodMax:x}=this;d.dTheta.value=m,d.mipInt.value=x-n;const M=this._sizeLods[i],T=3*M*(i>x-Kn?i-x+Kn:0),E=4*(this._cubeSize-M);ji(t,T,E,3*M,2*M),l.setRenderTarget(t),l.render(u,Rs)}}function A_(r){const e=[],t=[],n=[];let i=r;const s=r-Kn+1+Ch.length;for(let a=0;a<s;a++){const o=Math.pow(2,i);e.push(o);let l=1/o;a>r-Kn?l=Ch[a-r+Kn-1]:a===0&&(l=0),t.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,v=new Float32Array(_*m*f),x=new Float32Array(g*m*f),M=new Float32Array(p*m*f);for(let E=0;E<f;E++){const C=E%3*2/3-1,P=E>2?0:-1,S=[C,P,0,C+2/3,P,0,C+2/3,P+1,0,C,P,0,C+2/3,P+1,0,C,P+1,0];v.set(S,_*m*E),x.set(d,g*m*E);const b=[E,E,E,E,E,E];M.set(b,p*m*E)}const T=new qe;T.setAttribute("position",new ut(v,_)),T.setAttribute("uv",new ut(x,g)),T.setAttribute("faceIndex",new ut(M,p)),n.push(new At(T,null)),i>Kn&&i--}return{lodMeshes:n,sizeLods:e,sigmas:t}}function Ph(r,e,t){const n=new ln(r,e,t);return n.texture.mapping=$s,n.texture.name="PMREM.cubeUv",n.scissorTest=!0,n}function ji(r,e,t,n,i){r.viewport.set(e,t,n,i),r.scissor.set(e,t,n,i)}function T_(r,e,t){return new pn({name:"PMREMGGXConvolution",defines:{GGX_SAMPLES:S_,CUBEUV_TEXEL_WIDTH:1/e,CUBEUV_TEXEL_HEIGHT:1/t,CUBEUV_MAX_MIP:`${r}.0`},uniforms:{envMap:{value:null},roughness:{value:0},mipInt:{value:0}},vertexShader:Ta(),fragmentShader:`
3614
3615			precision highp float;
3616			precision highp int;
3617
3618			varying vec3 vOutputDirection;
3619
3620			uniform sampler2D envMap;
3621			uniform float roughness;
3622			uniform float mipInt;
3623
3624			#define ENVMAP_TYPE_CUBE_UV
3625			#include <cube_uv_reflection_fragment>
3626
3627			#define PI 3.14159265359
3628
3629			// Van der Corput radical inverse
3630			float radicalInverse_VdC(uint bits) {
3631				bits = (bits << 16u) | (bits >> 16u);
3632				bits = ((bits & 0x55555555u) << 1u) | ((bits & 0xAAAAAAAAu) >> 1u);
3633				bits = ((bits & 0x33333333u) << 2u) | ((bits & 0xCCCCCCCCu) >> 2u);
3634				bits = ((bits & 0x0F0F0F0Fu) << 4u) | ((bits & 0xF0F0F0F0u) >> 4u);
3635				bits = ((bits & 0x00FF00FFu) << 8u) | ((bits & 0xFF00FF00u) >> 8u);
3636				return float(bits) * 2.3283064365386963e-10; // / 0x100000000
3637			}
3638
3639			// Hammersley sequence
3640			vec2 hammersley(uint i, uint N) {
3641				return vec2(float(i) / float(N), radicalInverse_VdC(i));
3642			}
3643
3644			// GGX VNDF importance sampling (Eric Heitz 2018)
3645			// "Sampling the GGX Distribution of Visible Normals"
3646			// https://jcgt.org/published/0007/04/01/
3647			vec3 importanceSampleGGX_VNDF(vec2 Xi, vec3 V, float roughness) {
3648				float alpha = roughness * roughness;
3649
3650				// Section 3.2: Transform view direction to hemisphere configuration
3651				vec3 Vh = normalize(vec3(alpha * V.x, alpha * V.y, V.z));
3652
3653				// Section 4.1: Orthonormal basis
3654				float lensq = Vh.x * Vh.x + Vh.y * Vh.y;
3655				vec3 T1 = lensq > 0.0 ? vec3(-Vh.y, Vh.x, 0.0) / sqrt(lensq) : vec3(1.0, 0.0, 0.0);
3656				vec3 T2 = cross(Vh, T1);
3657
3658				// Section 4.2: Parameterization of projected area
3659				float r = sqrt(Xi.x);
3660				float phi = 2.0 * PI * Xi.y;
3661				float t1 = r * cos(phi);
3662				float t2 = r * sin(phi);
3663				float s = 0.5 * (1.0 + Vh.z);
3664				t2 = (1.0 - s) * sqrt(1.0 - t1 * t1) + s * t2;
3665
3666				// Section 4.3: Reprojection onto hemisphere
3667				vec3 Nh = t1 * T1 + t2 * T2 + sqrt(max(0.0, 1.0 - t1 * t1 - t2 * t2)) * Vh;
3668
3669				// Section 3.4: Transform back to ellipsoid configuration
3670				return normalize(vec3(alpha * Nh.x, alpha * Nh.y, max(0.0, Nh.z)));
3671			}
3672
3673			void main() {
3674				vec3 N = normalize(vOutputDirection);
3675				vec3 V = N; // Assume view direction equals normal for pre-filtering
3676
3677				vec3 prefilteredColor = vec3(0.0);
3678				float totalWeight = 0.0;
3679
3680				// For very low roughness, just sample the environment directly
3681				if (roughness < 0.001) {
3682					gl_FragColor = vec4(bilinearCubeUV(envMap, N, mipInt), 1.0);
3683					return;
3684				}
3685
3686				// Tangent space basis for VNDF sampling
3687				vec3 up = abs(N.z) < 0.999 ? vec3(0.0, 0.0, 1.0) : vec3(1.0, 0.0, 0.0);
3688				vec3 tangent = normalize(cross(up, N));
3689				vec3 bitangent = cross(N, tangent);
3690
3691				for(uint i = 0u; i < uint(GGX_SAMPLES); i++) {
3692					vec2 Xi = hammersley(i, uint(GGX_SAMPLES));
3693
3694					// For PMREM, V = N, so in tangent space V is always (0, 0, 1)
3695					vec3 H_tangent = importanceSampleGGX_VNDF(Xi, vec3(0.0, 0.0, 1.0), roughness);
3696
3697					// Transform H back to world space
3698					vec3 H = normalize(tangent * H_tangent.x + bitangent * H_tangent.y + N * H_tangent.z);
3699					vec3 L = normalize(2.0 * dot(V, H) * H - V);
3700
3701					float NdotL = max(dot(N, L), 0.0);
3702
3703					if(NdotL > 0.0) {
3704						// Sample environment at fixed mip level
3705						// VNDF importance sampling handles the distribution filtering
3706						vec3 sampleColor = bilinearCubeUV(envMap, L, mipInt);
3707
3708						// Weight by NdotL for the split-sum approximation
3709						// VNDF PDF naturally accounts for the visible microfacet distribution
3710						prefilteredColor += sampleColor * NdotL;
3711						totalWeight += NdotL;
3712					}
3713				}
3714
3715				if (totalWeight > 0.0) {
3716					prefilteredColor = prefilteredColor / totalWeight;
3717				}
3718
3719				gl_FragColor = vec4(prefilteredColor, 1.0);
3720			}
3721		`,blending:Fn,depthTest:!1,depthWrite:!1})}function E_(r,e,t){const n=new Float32Array(vi),i=new R(0,1,0);return new pn({name:"SphericalGaussianBlur",defines:{n:vi,CUBEUV_TEXEL_WIDTH:1/e,CUBEUV_TEXEL_HEIGHT:1/t,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:Ta(),fragmentShader:`
3722
3723			precision mediump float;
3724			precision mediump int;
3725
3726			varying vec3 vOutputDirection;
3727
3728			uniform sampler2D envMap;
3729			uniform int samples;
3730			uniform float weights[ n ];
3731			uniform bool latitudinal;
3732			uniform float dTheta;
3733			uniform float mipInt;
3734			uniform vec3 poleAxis;
3735
3736			#define ENVMAP_TYPE_CUBE_UV
3737			#include <cube_uv_reflection_fragment>
3738
3739			vec3 getSample( float theta, vec3 axis ) {
3740
3741				float cosTheta = cos( theta );
3742				// Rodrigues' axis-angle rotation
3743				vec3 sampleDirection = vOutputDirection * cosTheta
3744					+ cross( axis, vOutputDirection ) * sin( theta )
3745					+ axis * dot( axis, vOutputDirection ) * ( 1.0 - cosTheta );
3746
3747				return bilinearCubeUV( envMap, sampleDirection, mipInt );
3748
3749			}
3750
3751			void main() {
3752
3753				vec3 axis = latitudinal ? poleAxis : cross( poleAxis, vOutputDirection );
3754
3755				if ( all( equal( axis, vec3( 0.0 ) ) ) ) {
3756
3757					axis = vec3( vOutputDirection.z, 0.0, - vOutputDirection.x );
3758
3759				}
3760
3761				axis = normalize( axis );
3762
3763				gl_FragColor = vec4( 0.0, 0.0, 0.0, 1.0 );
3764				gl_FragColor.rgb += weights[ 0 ] * getSample( 0.0, axis );
3765
3766				for ( int i = 1; i < n; i++ ) {
3767
3768					if ( i >= samples ) {
3769
3770						break;
3771
3772					}
3773
3774					float theta = dTheta * float( i );
3775					gl_FragColor.rgb += weights[ i ] * getSample( -1.0 * theta, axis );
3776					gl_FragColor.rgb += weights[ i ] * getSample( theta, axis );
3777
3778				}
3779
3780			}
3781		`,blending:Fn,depthTest:!1,depthWrite:!1})}function Lh(){return new pn({name:"EquirectangularToCubeUV",uniforms:{envMap:{value:null}},vertexShader:Ta(),fragmentShader:`
3782
3783			precision mediump float;
3784			precision mediump int;
3785
3786			varying vec3 vOutputDirection;
3787
3788			uniform sampler2D envMap;
3789
3790			#include <common>
3791
3792			void main() {
3793
3794				vec3 outputDirection = normalize( vOutputDirection );
3795				vec2 uv = equirectUv( outputDirection );
3796
3797				gl_FragColor = vec4( texture2D ( envMap, uv ).rgb, 1.0 );
3798
3799			}
3800		`,blending:Fn,depthTest:!1,depthWrite:!1})}function Dh(){return new pn({name:"CubemapToCubeUV",uniforms:{envMap:{value:null},flipEnvMap:{value:-1}},vertexShader:Ta(),fragmentShader:`
3801
3802			precision mediump float;
3803			precision mediump int;
3804
3805			uniform float flipEnvMap;
3806
3807			varying vec3 vOutputDirection;
3808
3809			uniform samplerCube envMap;
3810
3811			void main() {
3812
3813				gl_FragColor = textureCube( envMap, vec3( flipEnvMap * vOutputDirection.x, vOutputDirection.yz ) );
3814
3815			}
3816		`,blending:Fn,depthTest:!1,depthWrite:!1})}function Ta(){return`
3817
3818		precision mediump float;
3819		precision mediump int;
3820
3821		attribute float faceIndex;
3822
3823		varying vec3 vOutputDirection;
3824
3825		// RH coordinate system; PMREM face-indexing convention
3826		vec3 getDirection( vec2 uv, float face ) {
3827
3828			uv = 2.0 * uv - 1.0;
3829
3830			vec3 direction = vec3( uv, 1.0 );
3831
3832			if ( face == 0.0 ) {
3833
3834				direction = direction.zyx; // ( 1, v, u ) pos x
3835
3836			} else if ( face == 1.0 ) {
3837
3838				direction = direction.xzy;
3839				direction.xz *= -1.0; // ( -u, 1, -v ) pos y
3840
3841			} else if ( face == 2.0 ) {
3842
3843				direction.x *= -1.0; // ( -u, v, 1 ) pos z
3844
3845			} else if ( face == 3.0 ) {
3846
3847				direction = direction.zyx;
3848				direction.xz *= -1.0; // ( -1, v, -u ) neg x
3849
3850			} else if ( face == 4.0 ) {
3851
3852				direction = direction.xzy;
3853				direction.xy *= -1.0; // ( -u, -1, v ) neg y
3854
3855			} else if ( face == 5.0 ) {
3856
3857				direction.z *= -1.0; // ( u, v, -1 ) neg z
3858
3859			}
3860
3861			return direction;
3862
3863		}
3864
3865		void main() {
3866
3867			vOutputDirection = getDirection( uv, faceIndex );
3868			gl_Position = vec4( position, 1.0 );
3869
3870		}
3871	`}function w_(r){let e=new WeakMap,t=null;function n(o){if(o&&o.isTexture){const l=o.mapping,c=l===jr||l===ea,h=l===Bn||l===Ai;if(c||h){let u=e.get(o);const d=u!==void 0?u.texture.pmremVersion:0;if(o.isRenderTargetTexture&&o.pmremVersion!==d)return t===null&&(t=new Ih(r)),u=c?t.fromEquirectangular(o,u):t.fromCubemap(o,u),u.texture.pmremVersion=o.pmremVersion,e.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)?(t===null&&(t=new Ih(r)),u=c?t.fromEquirectangular(o):t.fromCubemap(o),u.texture.pmremVersion=o.pmremVersion,e.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=e.get(l);c!==void 0&&(e.delete(l),c.dispose())}function a(){e=new WeakMap,t!==null&&(t.dispose(),t=null)}return{get:n,dispose:a}}function C_(r){const e={};function t(n){if(e[n]!==void 0)return e[n];const i=r.getExtension(n);return e[n]=i,i}return{has:function(n){return t(n)!==null},init:function(){t("EXT_color_buffer_float"),t("WEBGL_clip_cull_distance"),t("OES_texture_float_linear"),t("EXT_color_buffer_half_float"),t("WEBGL_multisampled_render_to_texture"),t("WEBGL_render_shared_exponent")},get:function(n){const i=t(n);return i===null&&Ws("WebGLRenderer: "+n+" extension not supported."),i}}}function R_(r,e,t,n){const i={},s=new WeakMap;function a(u){const d=u.target;d.index!==null&&e.remove(d.index);for(const m in d.attributes)e.remove(d.attributes[m]);d.removeEventListener("dispose",a),delete i[d.id];const f=s.get(d);
vendor: 23,218 bytes, lines 3871-3952
3871f&&(e.remove(f),s.delete(d)),n.releaseStatesOfGeometry(d),d.isInstancedBufferGeometry===!0&&delete d._maxInstanceCount,t.memory.geometries--}function o(u,d){return i[d.id]===!0||(d.addEventListener("dispose",a),i[d.id]=!0,t.memory.geometries++),d}function l(u){const d=u.attributes;for(const f in d)e.update(d[f],r.ARRAY_BUFFER)}function c(u){const d=[],f=u.index,m=u.attributes.position;let _=0;if(f!==null){const v=f.array;_=f.version;for(let x=0,M=v.length;x<M;x+=3){const T=v[x+0],E=v[x+1],C=v[x+2];d.push(T,E,E,C,C,T)}}else if(m!==void 0){const v=m.array;_=m.version;for(let x=0,M=v.length/3-1;x<M;x+=3){const T=x+0,E=x+1,C=x+2;d.push(T,E,E,C,C,T)}}else return;const g=new(du(d)?_u:gu)(d,1);g.version=_;const p=s.get(u);p&&e.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 I_(r,e,t){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),t.update(f,n,1)}function c(d,f,m){m!==0&&(r.drawElementsInstanced(n,f,s,d*a,m),t.update(f,n,m))}function h(d,f,m){if(m===0)return;e.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];t.update(g,n,1)}function u(d,f,m,_){if(m===0)return;const g=e.get("WEBGL_multi_draw");if(g===null)for(let p=0;p<d.length;p++)c(d[p]/a,f[p],_[p]);else{g.multiDrawElementsInstancedWEBGL(n,f,0,s,d,0,_,0,m);let p=0;for(let v=0;v<m;v++)p+=f[v]*_[v];t.update(p,n,1)}}this.setMode=i,this.setIndex=o,this.render=l,this.renderInstances=c,this.renderMultiDraw=h,this.renderMultiDrawInstances=u}function P_(r){const e={geometries:0,textures:0},t={frame:0,calls:0,triangles:0,points:0,lines:0};function n(s,a,o){switch(t.calls++,a){case r.TRIANGLES:t.triangles+=o*(s/3);break;case r.LINES:t.lines+=o*(s/2);break;case r.LINE_STRIP:t.lines+=o*(s-1);break;case r.LINE_LOOP:t.lines+=o*s;break;case r.POINTS:t.points+=o*s;break;default:Le("WebGLInfo: Unknown draw mode:",a);break}}function i(){t.calls=0,t.triangles=0,t.points=0,t.lines=0}return{memory:e,render:t,programs:null,autoReset:!0,reset:i,update:n}}function L_(r,e,t){const n=new WeakMap,i=new pt;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 S=function(){C.dispose(),n.delete(o),o.removeEventListener("dispose",S)};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||[],v=o.morphAttributes.color||[];let x=0;f===!0&&(x=1),m===!0&&(x=2),_===!0&&(x=3);let M=o.attributes.position.count*x,T=1;M>e.maxTextureSize&&(T=Math.ceil(M/e.maxTextureSize),M=e.maxTextureSize);const E=new Float32Array(M*T*4*u),C=new Pl(E,M,T,u);C.type=Ht,C.needsUpdate=!0;const P=x*4;for(let b=0;b<u;b++){const L=g[b],F=p[b],B=v[b],G=M*T*4*b;for(let q=0;q<L.count;q++){const V=q*P;f===!0&&(i.fromBufferAttribute(L,q),E[G+V+0]=i.x,E[G+V+1]=i.y,E[G+V+2]=i.z,E[G+V+3]=0),m===!0&&(i.fromBufferAttribute(F,q),E[G+V+4]=i.x,E[G+V+5]=i.y,E[G+V+6]=i.z,E[G+V+7]=0),_===!0&&(i.fromBufferAttribute(B,q),E[G+V+8]=i.x,E[G+V+9]=i.y,E[G+V+10]=i.z,E[G+V+11]=B.itemSize===4?i.w:1)}}d={count:u,texture:C,size:new K(M,T)},n.set(o,d),o.addEventListener("dispose",S)}if(a.isInstancedMesh===!0&&a.morphTexture!==null)l.getUniforms().setValue(r,"morphTexture",a.morphTexture,t);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,t),l.getUniforms().setValue(r,"morphTargetsTextureSize",d.size)}return{update:s}}function D_(r,e,t,n){let i=new WeakMap;function s(l){const c=n.render.frame,h=l.geometry,u=e.get(l,h);if(i.get(u)!==c&&(e.update(u),i.set(u,c)),l.isInstancedMesh&&(l.hasEventListener("dispose",o)===!1&&l.addEventListener("dispose",o),i.get(l)!==c&&(t.update(l.instanceMatrix,r.ARRAY_BUFFER),l.instanceColor!==null&&t.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),t.remove(c.instanceMatrix),c.instanceColor!==null&&t.remove(c.instanceColor)}return{update:s,dispose:a}}const U_={[Kh]:"LINEAR_TONE_MAPPING",[Qh]:"REINHARD_TONE_MAPPING",[jh]:"CINEON_TONE_MAPPING",[eu]:"ACES_FILMIC_TONE_MAPPING",[nu]:"AGX_TONE_MAPPING",[iu]:"NEUTRAL_TONE_MAPPING",[tu]:"CUSTOM_TONE_MAPPING"};function N_(r,e,t,n,i){const s=new ln(e,t,{type:r,depthBuffer:n,stencilBuffer:i}),a=new ln(e,t,{type:zn,depthBuffer:!1,stencilBuffer:!1}),o=new qe;o.setAttribute("position",new Te([-1,3,0,-1,-1,0,3,-1,0],3)),o.setAttribute("uv",new Te([0,2,0,0,2,0],2));const l=new Uu({uniforms:{tDiffuse:{value:null}},vertexShader:`
3872			precision highp float;
3873
3874			uniform mat4 modelViewMatrix;
3875			uniform mat4 projectionMatrix;
3876
3877			attribute vec3 position;
3878			attribute vec2 uv;
3879
3880			varying vec2 vUv;
3881
3882			void main() {
3883				vUv = uv;
3884				gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );
3885			}`,fragmentShader:`
3886			precision highp float;
3887
3888			uniform sampler2D tDiffuse;
3889
3890			varying vec2 vUv;
3891
3892			#include <tonemapping_pars_fragment>
3893			#include <colorspace_pars_fragment>
3894
3895			void main() {
3896				gl_FragColor = texture2D( tDiffuse, vUv );
3897
3898				#ifdef LINEAR_TONE_MAPPING
3899					gl_FragColor.rgb = LinearToneMapping( gl_FragColor.rgb );
3900				#elif defined( REINHARD_TONE_MAPPING )
3901					gl_FragColor.rgb = ReinhardToneMapping( gl_FragColor.rgb );
3902				#elif defined( CINEON_TONE_MAPPING )
3903					gl_FragColor.rgb = CineonToneMapping( gl_FragColor.rgb );
3904				#elif defined( ACES_FILMIC_TONE_MAPPING )
3905					gl_FragColor.rgb = ACESFilmicToneMapping( gl_FragColor.rgb );
3906				#elif defined( AGX_TONE_MAPPING )
3907					gl_FragColor.rgb = AgXToneMapping( gl_FragColor.rgb );
3908				#elif defined( NEUTRAL_TONE_MAPPING )
3909					gl_FragColor.rgb = NeutralToneMapping( gl_FragColor.rgb );
3910				#elif defined( CUSTOM_TONE_MAPPING )
3911					gl_FragColor.rgb = CustomToneMapping( gl_FragColor.rgb );
3912				#endif
3913
3914				#ifdef SRGB_TRANSFER
3915					gl_FragColor = sRGBTransferOETF( gl_FragColor );
3916				#endif
3917			}`,depthTest:!1,depthWrite:!1}),c=new At(o,l),h=new Aa(-1,1,1,-1,0,1);let u=null,d=null,f=!1,m,_=null,g=[],p=!1;this.setSize=function(v,x){s.setSize(v,x),a.setSize(v,x);for(let M=0;M<g.length;M++){const T=g[M];T.setSize&&T.setSize(v,x)}},this.setEffects=function(v){g=v,p=g.length>0&&g[0].isRenderPass===!0;const x=s.width,M=s.height;for(let T=0;T<g.length;T++){const E=g[T];E.setSize&&E.setSize(x,M)}},this.begin=function(v,x){if(f||v.toneMapping===Sn&&g.length===0)return!1;if(_=x,x!==null){const M=x.width,T=x.height;(s.width!==M||s.height!==T)&&this.setSize(M,T)}return p===!1&&v.setRenderTarget(s),m=v.toneMapping,v.toneMapping=Sn,!0},this.hasRenderPass=function(){return p},this.end=function(v,x){v.toneMapping=m,f=!0;let M=s,T=a;for(let E=0;E<g.length;E++){const C=g[E];if(C.enabled!==!1&&(C.render(v,T,M,x),C.needsSwap!==!1)){const P=M;M=T,T=P}}if(u!==v.outputColorSpace||d!==v.toneMapping){u=v.outputColorSpace,d=v.toneMapping,l.defines={},je.getTransfer(u)===rt&&(l.defines.SRGB_TRANSFER="");const E=U_[d];E&&(l.defines[E]=""),l.needsUpdate=!0}l.uniforms.tDiffuse.value=M.texture,v.setRenderTarget(_),v.render(c,h),_=null,f=!1},this.isCompositing=function(){return f},this.dispose=function(){s.dispose(),a.dispose(),o.dispose(),l.dispose()}}const Zu=new Mt,_l=new qs(1,1),Ju=new Pl,$u=new Ll,Ku=new _a,Uh=[],Nh=[],Fh=new Float32Array(16),Oh=new Float32Array(9),Bh=new Float32Array(4);function gs(r,e,t){const n=r[0];if(n<=0||n>0)return r;const i=e*t;let s=Uh[i];if(s===void 0&&(s=new Float32Array(i),Uh[i]=s),e!==0){n.toArray(s,0);for(let a=1,o=0;a!==e;++a)o+=t,r[a].toArray(s,o)}return s}function Tt(r,e){if(r.length!==e.length)return!1;for(let t=0,n=r.length;t<n;t++)if(r[t]!==e[t])return!1;return!0}function Et(r,e){for(let t=0,n=e.length;t<n;t++)r[t]=e[t]}function Ea(r,e){let t=Nh[e];t===void 0&&(t=new Int32Array(e),Nh[e]=t);for(let n=0;n!==e;++n)t[n]=r.allocateTextureUnit();return t}function F_(r,e){const t=this.cache;t[0]!==e&&(r.uniform1f(this.addr,e),t[0]=e)}function O_(r,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y)&&(r.uniform2f(this.addr,e.x,e.y),t[0]=e.x,t[1]=e.y);else{if(Tt(t,e))return;r.uniform2fv(this.addr,e),Et(t,e)}}function B_(r,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y||t[2]!==e.z)&&(r.uniform3f(this.addr,e.x,e.y,e.z),t[0]=e.x,t[1]=e.y,t[2]=e.z);else if(e.r!==void 0)(t[0]!==e.r||t[1]!==e.g||t[2]!==e.b)&&(r.uniform3f(this.addr,e.r,e.g,e.b),t[0]=e.r,t[1]=e.g,t[2]=e.b);else{if(Tt(t,e))return;r.uniform3fv(this.addr,e),Et(t,e)}}function z_(r,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y||t[2]!==e.z||t[3]!==e.w)&&(r.uniform4f(this.addr,e.x,e.y,e.z,e.w),t[0]=e.x,t[1]=e.y,t[2]=e.z,t[3]=e.w);else{if(Tt(t,e))return;r.uniform4fv(this.addr,e),Et(t,e)}}function V_(r,e){const t=this.cache,n=e.elements;if(n===void 0){if(Tt(t,e))return;r.uniformMatrix2fv(this.addr,!1,e),Et(t,e)}else{if(Tt(t,n))return;Bh.set(n),r.uniformMatrix2fv(this.addr,!1,Bh),Et(t,n)}}function k_(r,e){const t=this.cache,n=e.elements;if(n===void 0){if(Tt(t,e))return;r.uniformMatrix3fv(this.addr,!1,e),Et(t,e)}else{if(Tt(t,n))return;Oh.set(n),r.uniformMatrix3fv(this.addr,!1,Oh),Et(t,n)}}function G_(r,e){const t=this.cache,n=e.elements;if(n===void 0){if(Tt(t,e))return;r.uniformMatrix4fv(this.addr,!1,e),Et(t,e)}else{if(Tt(t,n))return;Fh.set(n),r.uniformMatrix4fv(this.addr,!1,Fh),Et(t,n)}}function H_(r,e){const t=this.cache;t[0]!==e&&(r.uniform1i(this.addr,e),t[0]=e)}function W_(r,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y)&&(r.uniform2i(this.addr,e.x,e.y),t[0]=e.x,t[1]=e.y);else{if(Tt(t,e))return;r.uniform2iv(this.addr,e),Et(t,e)}}function X_(r,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y||t[2]!==e.z)&&(r.uniform3i(this.addr,e.x,e.y,e.z),t[0]=e.x,t[1]=e.y,t[2]=e.z);else{if(Tt(t,e))return;r.uniform3iv(this.addr,e),Et(t,e)}}function q_(r,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y||t[2]!==e.z||t[3]!==e.w)&&(r.uniform4i(this.addr,e.x,e.y,e.z,e.w),t[0]=e.x,t[1]=e.y,t[2]=e.z,t[3]=e.w);else{if(Tt(t,e))return;r.uniform4iv(this.addr,e),Et(t,e)}}function Y_(r,e){const t=this.cache;t[0]!==e&&(r.uniform1ui(this.addr,e),t[0]=e)}function Z_(r,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y)&&(r.uniform2ui(this.addr,e.x,e.y),t[0]=e.x,t[1]=e.y);else{if(Tt(t,e))return;r.uniform2uiv(this.addr,e),Et(t,e)}}function J_(r,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y||t[2]!==e.z)&&(r.uniform3ui(this.addr,e.x,e.y,e.z),t[0]=e.x,t[1]=e.y,t[2]=e.z);else{if(Tt(t,e))return;r.uniform3uiv(this.addr,e),Et(t,e)}}function $_(r,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y||t[2]!==e.z||t[3]!==e.w)&&(r.uniform4ui(this.addr,e.x,e.y,e.z,e.w),t[0]=e.x,t[1]=e.y,t[2]=e.z,t[3]=e.w);else{if(Tt(t,e))return;r.uniform4uiv(this.addr,e),Et(t,e)}}function K_(r,e,t){const n=this.cache,i=t.allocateTextureUnit();n[0]!==i&&(r.uniform1i(this.addr,i),n[0]=i);let s;this.type===r.SAMPLER_2D_SHADOW?(_l.compareFunction=t.isReversedDepthBuffer()?Rl:Cl,s=_l):s=Zu,t.setTexture2D(e||s,i)}function Q_(r,e,t){const n=this.cache,i=t.allocateTextureUnit();n[0]!==i&&(r.uniform1i(this.addr,i),n[0]=i),t.setTexture3D(e||$u,i)}function j_(r,e,t){const n=this.cache,i=t.allocateTextureUnit();n[0]!==i&&(r.uniform1i(this.addr,i),n[0]=i),t.setTextureCube(e||Ku,i)}function ex(r,e,t){const n=this.cache,i=t.allocateTextureUnit();n[0]!==i&&(r.uniform1i(this.addr,i),n[0]=i),t.setTexture2DArray(e||Ju,i)}function tx(r){switch(r){case 5126:return F_;case 35664:return O_;case 35665:return B_;case 35666:return z_;case 35674:return V_;case 35675:return k_;case 35676:return G_;case 5124:case 35670:return H_;case 35667:case 35671:return W_;case 35668:case 35672:return X_;case 35669:case 35673:return q_;case 5125:return Y_;case 36294:return Z_;case 36295:return J_;case 36296:return $_;case 35678:case 36198:case 36298:case 36306:case 35682:return K_;case 35679:case 36299:case 36307:return Q_;case 35680:case 36300:case 36308:case 36293:return j_;case 36289:case 36303:case 36311:case 36292:return ex}}function nx(r,e){r.uniform1fv(this.addr,e)}function ix(r,e){const t=gs(e,this.size,2);r.uniform2fv(this.addr,t)}function sx(r,e){const t=gs(e,this.size,3);r.uniform3fv(this.addr,t)}function rx(r,e){const t=gs(e,this.size,4);r.uniform4fv(this.addr,t)}function ax(r,e){const t=gs(e,this.size,4);r.uniformMatrix2fv(this.addr,!1,t)}function ox(r,e){const t=gs(e,this.size,9);r.uniformMatrix3fv(this.addr,!1,t)}function lx(r,e){const t=gs(e,this.size,16);r.uniformMatrix4fv(this.addr,!1,t)}function cx(r,e){r.uniform1iv(this.addr,e)}function hx(r,e){r.uniform2iv(this.addr,e)}function ux(r,e){r.uniform3iv(this.addr,e)}function dx(r,e){r.uniform4iv(this.addr,e)}function fx(r,e){r.uniform1uiv(this.addr,e)}function px(r,e){r.uniform2uiv(this.addr,e)}function mx(r,e){r.uniform3uiv(this.addr,e)}function gx(r,e){r.uniform4uiv(this.addr,e)}function _x(r,e,t){const n=this.cache,i=e.length,s=Ea(t,i);Tt(n,s)||(r.uniform1iv(this.addr,s),Et(n,s));let a;this.type===r.SAMPLER_2D_SHADOW?a=_l:a=Zu;for(let o=0;o!==i;++o)t.setTexture2D(e[o]||a,s[o])}function xx(r,e,t){const n=this.cache,i=e.length,s=Ea(t,i);Tt(n,s)||(r.uniform1iv(this.addr,s),Et(n,s));for(let a=0;a!==i;++a)t.setTexture3D(e[a]||$u,s[a])}function vx(r,e,t){const n=this.cache,i=e.length,s=Ea(t,i);Tt(n,s)||(r.uniform1iv(this.addr,s),Et(n,s));for(let a=0;a!==i;++a)t.setTextureCube(e[a]||Ku,s[a])}function yx(r,e,t){const n=this.cache,i=e.length,s=Ea(t,i);Tt(n,s)||(r.uniform1iv(this.addr,s),Et(n,s));for(let a=0;a!==i;++a)t.setTexture2DArray(e[a]||Ju,s[a])}function Mx(r){switch(r){case 5126:return nx;case 35664:return ix;case 35665:return sx;case 35666:return rx;case 35674:return ax;case 35675:return ox;case 35676:return lx;case 5124:case 35670:return cx;case 35667:case 35671:return hx;case 35668:case 35672:return ux;case 35669:case 35673:return dx;case 5125:return fx;case 36294:return px;case 36295:return mx;case 36296:return gx;case 35678:case 36198:case 36298:case 36306:case 35682:return _x;case 35679:case 36299:case 36307:return xx;case 35680:case 36300:case 36308:case 36293:return vx;case 36289:case 36303:case 36311:case 36292:return yx}}class Sx{constructor(e,t,n){this.id=e,this.addr=n,this.cache=[],this.type=t.type,this.setValue=tx(t.type)}}class bx{constructor(e,t,n){this.id=e,this.addr=n,this.cache=[],this.type=t.type,this.size=t.size,this.setValue=Mx(t.type)}}class Ax{constructor(e){this.id=e,this.seq=[],this.map={}}setValue(e,t,n){const i=this.seq;for(let s=0,a=i.length;s!==a;++s){const o=i[s];o.setValue(e,t[o.id],n)}}}const yo=/(\w+)(\])?(\[|\.)?/g;function zh(r,e){r.seq.push(e),r.map[e.id]=e}function Tx(r,e,t){const n=r.name,i=n.length;for(yo.lastIndex=0;;){const s=yo.exec(n),a=yo.lastIndex;let o=s[1];const l=s[2]==="]",c=s[3];if(l&&(o=o|0),c===void 0||c==="["&&a+2===i){zh(t,c===void 0?new Sx(o,r,e):new bx(o,r,e));break}else{let u=t.map[o];u===void 0&&(u=new Ax(o),zh(t,u)),t=u}}}class Qr{constructor(e,t){this.seq=[],this.map={};const n=e.getProgramParameter(t,e.ACTIVE_UNIFORMS);for(let a=0;a<n;++a){const o=e.getActiveUniform(t,a),l=e.getUniformLocation(t,o.name);Tx(o,l,this)}const i=[],s=[];for(const a of this.seq)a.type===e.SAMPLER_2D_SHADOW||a.type===e.SAMPLER_CUBE_SHADOW||a.type===e.SAMPLER_2D_ARRAY_SHADOW?i.push(a):s.push(a);i.length>0&&(this.seq=i.concat(s))}setValue(e,t,n,i){const s=this.map[t];s!==void 0&&s.setValue(e,n,i)}setOptional(e,t,n){const i=t[n];i!==void 0&&this.setValue(e,n,i)}static upload(e,t,n,i){for(let s=0,a=t.length;s!==a;++s){const o=t[s],l=n[o.id];l.needsUpdate!==!1&&o.setValue(e,l.value,i)}}static seqWithValue(e,t){const n=[];for(let i=0,s=e.length;i!==s;++i){const a=e[i];a.id in t&&n.push(a)}return n}}function Vh(r,e,t){const n=r.createShader(e);return r.shaderSource(n,t),r.compileShader(n),n}const Ex=37297;let wx=0;function Cx(r,e){const t=r.split(`
3918`),n=[],i=Math.max(e-6,0),s=Math.min(e+6,t.length);for(let a=i;a<s;a++){const o=a+1;n.push(`${o===e?">":" "} ${o}: ${t[a]}`)}return n.join(`
3919`)}const kh=new Ye;function Rx(r){je._getMatrix(kh,je.workingColorSpace,r);const e=`mat3( ${kh.elements.map(t=>t.toFixed(4))} )`;switch(je.getTransfer(r)){case ra:return[e,"LinearTransferOETF"];case rt:return[e,"sRGBTransferOETF"];default:return de("WebGLProgram: Unsupported color space: ",r),[e,"LinearTransferOETF"]}}function Gh(r,e,t){const n=r.getShaderParameter(e,r.COMPILE_STATUS),s=(r.getShaderInfoLog(e)||"").trim();if(n&&s==="")return"";const a=/ERROR: 0:(\d+)/.exec(s);if(a){const o=parseInt(a[1]);return t.toUpperCase()+`
3920
3921`+s+`
3922
3923`+Cx(r.getShaderSource(e),o)}else return s}function Ix(r,e){const t=Rx(e);return[`vec4 ${r}( vec4 value ) {`,`	return ${t[1]}( vec4( value.rgb * ${t[0]}, value.a ) );`,"}"].join(`
3924`)}const Px={[Kh]:"Linear",[Qh]:"Reinhard",[jh]:"Cineon",[eu]:"ACESFilmic",[nu]:"AgX",[iu]:"Neutral",[tu]:"Custom"};function Lx(r,e){const t=Px[e];return t===void 0?(de("WebGLProgram: Unsupported toneMapping:",e),"vec3 "+r+"( vec3 color ) { return LinearToneMapping( color ); }"):"vec3 "+r+"( vec3 color ) { return "+t+"ToneMapping( color ); }"}const Xr=new R;function Dx(){je.getLuminanceCoefficients(Xr);const r=Xr.x.toFixed(4),e=Xr.y.toFixed(4),t=Xr.z.toFixed(4);return["float luminance( const in vec3 rgb ) {",`	const vec3 weights = vec3( ${r}, ${e}, ${t} );`,"	return dot( weights, rgb );","}"].join(`
3925`)}function Ux(r){return[r.extensionClipCullDistance?"#extension GL_ANGLE_clip_cull_distance : require":"",r.extensionMultiDraw?"#extension GL_ANGLE_multi_draw : require":""].filter(Fs).join(`
3926`)}function Nx(r){const e=[];for(const t in r){const n=r[t];n!==!1&&e.push("#define "+t+" "+n)}return e.join(`
3927`)}function Fx(r,e){const t={},n=r.getProgramParameter(e,r.ACTIVE_ATTRIBUTES);for(let i=0;i<n;i++){const s=r.getActiveAttrib(e,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),t[a]={type:s.type,location:r.getAttribLocation(e,a),locationSize:o}}return t}function Fs(r){return r!==""}function Hh(r,e){const t=e.numSpotLightShadows+e.numSpotLightMaps-e.numSpotLightShadowsWithMaps;return r.replace(/NUM_DIR_LIGHTS/g,e.numDirLights).replace(/NUM_SPOT_LIGHTS/g,e.numSpotLights).replace(/NUM_SPOT_LIGHT_MAPS/g,e.numSpotLightMaps).replace(/NUM_SPOT_LIGHT_COORDS/g,t).replace(/NUM_RECT_AREA_LIGHTS/g,e.numRectAreaLights).replace(/NUM_POINT_LIGHTS/g,e.numPointLights).replace(/NUM_HEMI_LIGHTS/g,e.numHemiLights).replace(/NUM_DIR_LIGHT_SHADOWS/g,e.numDirLightShadows).replace(/NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS/g,e.numSpotLightShadowsWithMaps).replace(/NUM_SPOT_LIGHT_SHADOWS/g,e.numSpotLightShadows).replace(/NUM_POINT_LIGHT_SHADOWS/g,e.numPointLightShadows)}function Wh(r,e){return r.replace(/NUM_CLIPPING_PLANES/g,e.numClippingPlanes).replace(/UNION_CLIPPING_PLANES/g,e.numClippingPlanes-e.numClipIntersection)}const Ox=/^[ \t]*#include +<([\w\d./]+)>/gm;function xl(r){return r.replace(Ox,zx)}const Bx=new Map;function zx(r,e){let t=Je[e];if(t===void 0){const n=Bx.get(e);if(n!==void 0)t=Je[n],de('WebGLRenderer: Shader chunk "%s" has been deprecated. Use "%s" instead.',e,n);else throw new Error("Can not resolve #include <"+e+">")}return xl(t)}const Vx=/#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 Xh(r){return r.replace(Vx,kx)}function kx(r,e,t,n){let i="";for(let s=parseInt(e);s<parseInt(t);s++)i+=n.replace(/\[\s*i\s*\]/g,"[ "+s+" ]").replace(/UNROLLED_LOOP_INDEX/g,s);return i}function qh(r){let e=`precision ${r.precision} float;
3928	precision ${r.precision} int;
3929	precision ${r.precision} sampler2D;
3930	precision ${r.precision} samplerCube;
3931	precision ${r.precision} sampler3D;
3932	precision ${r.precision} sampler2DArray;
3933	precision ${r.precision} sampler2DShadow;
3934	precision ${r.precision} samplerCubeShadow;
3935	precision ${r.precision} sampler2DArrayShadow;
3936	precision ${r.precision} isampler2D;
3937	precision ${r.precision} isampler3D;
3938	precision ${r.precision} isamplerCube;
3939	precision ${r.precision} isampler2DArray;
3940	precision ${r.precision} usampler2D;
3941	precision ${r.precision} usampler3D;
3942	precision ${r.precision} usamplerCube;
3943	precision ${r.precision} usampler2DArray;
3944	`;return r.precision==="highp"?e+=`
3945#define HIGH_PRECISION`:r.precision==="mediump"?e+=`
3946#define MEDIUM_PRECISION`:r.precision==="lowp"&&(e+=`
3947#define LOW_PRECISION`),e}const Gx={[qr]:"SHADOWMAP_TYPE_PCF",[Ps]:"SHADOWMAP_TYPE_VSM"};function Hx(r){return Gx[r.shadowMapType]||"SHADOWMAP_TYPE_BASIC"}const Wx={[Bn]:"ENVMAP_TYPE_CUBE",[Ai]:"ENVMAP_TYPE_CUBE",[$s]:"ENVMAP_TYPE_CUBE_UV"};function Xx(r){return r.envMap===!1?"ENVMAP_TYPE_CUBE":Wx[r.envMapMode]||"ENVMAP_TYPE_CUBE"}const qx={[Ai]:"ENVMAP_MODE_REFRACTION"};function Yx(r){return r.envMap===!1?"ENVMAP_MODE_REFLECTION":qx[r.envMapMode]||"ENVMAP_MODE_REFLECTION"}const Zx={[ma]:"ENVMAP_BLENDING_MULTIPLY",[wd]:"ENVMAP_BLENDING_MIX",[Cd]:"ENVMAP_BLENDING_ADD"};function Jx(r){return r.envMap===!1?"ENVMAP_BLENDING_NONE":Zx[r.combine]||"ENVMAP_BLENDING_NONE"}function $x(r){const e=r.envMapCubeUVHeight;if(e===null)return null;const t=Math.log2(e)-2,n=1/e;return{texelWidth:1/(3*Math.max(Math.pow(2,t),7*16)),texelHeight:n,maxMip:t}}function Kx(r,e,t,n){const i=r.getContext(),s=t.defines;let a=t.vertexShader,o=t.fragmentShader;const l=Hx(t),c=Xx(t),h=Yx(t),u=Jx(t),d=$x(t),f=Ux(t),m=Nx(s),_=i.createProgram();let g,p,v=t.glslVersion?"#version "+t.glslVersion+`
3948`:"";t.isRawShaderMaterial?(g=["#define SHADER_TYPE "+t.shaderType,"#define SHADER_NAME "+t.shaderName,m].filter(Fs).join(`
3949`),g.length>0&&(g+=`
3950`),p=["#define SHADER_TYPE "+t.shaderType,"#define SHADER_NAME "+t.shaderName,m].filter(Fs).join(`
3951`),p.length>0&&(p+=`
3952`)):(g=[qh(t),"#define SHADER_TYPE "+t.shaderType,"#define SHADER_NAME "+t.shaderName,m,t.extensionClipCullDistance?"#define USE_CLIP_DISTANCE":"",t.batching?"#define USE_BATCHING":"",t.batchingColor?"#define USE_BATCHING_COLOR":"",t.instancing?"#define USE_INSTANCING":"",t.instancingColor?"#define USE_INSTANCING_COLOR":"",t.instancingMorph?"#define USE_INSTANCING_MORPH":"",t.useFog&&t.fog?"#define USE_FOG":"",t.useFog&&t.fogExp2?"#define FOG_EXP2":"",t.map?"#define USE_MAP":"",t.envMap?"#define USE_ENVMAP":"",t.envMap?"#define "+h:"",t.lightMap?"#define USE_LIGHTMAP":"",t.aoMap?"#define USE_AOMAP":"",t.bumpMap?"#define USE_BUMPMAP":"",t.normalMap?"#define USE_NORMALMAP":"",t.normalMapObjectSpace?"#define USE_NORMALMAP_OBJECTSPACE":"",t.normalMapTangentSpace?"#define USE_NORMALMAP_TANGENTSPACE":"",t.displacementMap?"#define USE_DISPLACEMENTMAP":"",t.emissiveMap?"#define USE_EMISSIVEMAP":"",t.anisotropy?"#define USE_ANISOTROPY":"",t.anisotropyMap?"#define USE_ANISOTROPYMAP":"",t.clearcoatMap?"#define USE_CLEARCOATMAP":"",t.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",t.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",t.iridescenceMap?"#define USE_IR
3952IDESCENCEMAP":"",t.iridescenceThicknessMap?"#define USE_IRIDESCENCE_THICKNESSMAP":"",t.specularMap?"#define USE_SPECULARMAP":"",t.specularColorMap?"#define USE_SPECULAR_COLORMAP":"",t.specularIntensityMap?"#define USE_SPECULAR_INTENSITYMAP":"",t.roughnessMap?"#define USE_ROUGHNESSMAP":"",t.metalnessMap?"#define USE_METALNESSMAP":"",t.alphaMap?"#define USE_ALPHAMAP":"",t.alphaHash?"#define USE_ALPHAHASH":"",t.transmission?"#define USE_TRANSMISSION":"",t.transmissionMap?"#define USE_TRANSMISSIONMAP":"",t.thicknessMap?"#define USE_THICKNESSMAP":"",t.sheenColorMap?"#define USE_SHEEN_COLORMAP":"",t.sheenRoughnessMap?"#define USE_SHEEN_ROUGHNESSMAP":"",t.mapUv?"#define MAP_UV "+t.mapUv:"",t.alphaMapUv?"#define ALPHAMAP_UV "+t.alphaMapUv:"",t.lightMapUv?"#define LIGHTMAP_UV "+t.lightMapUv:"",t.aoMapUv?"#define AOMAP_UV "+t.aoMapUv:"",t.emissiveMapUv?"#define EMISSIVEMAP_UV "+t.emissiveMapUv:"",t.bumpMapUv?"#define BUMPMAP_UV "+t.bumpMapUv:"",t.normalMapUv?"#define NORMALMAP_UV "+t.normalMapUv:"",t.displacementMapUv?"#define DISPLACEMENTMAP_UV "+t.displacementMapUv:"",t.metalnessMapUv?"#define METALNESSMAP_UV "+t.metalnessMapUv:"",t.roughnessMapUv?"#define ROUGHNESSMAP_UV "+t.roughnessMapUv:"",t.anisotropyMapUv?"#define ANISOTROPYMAP_UV "+t.anisotropyMapUv:"",t.clearcoatMapUv?"#define CLEARCOATMAP_UV "+t.clearcoatMapUv:"",t.clearcoatNormalMapUv?"#define CLEARCOAT_NORMALMAP_UV "+t.clearcoatNormalMapUv:"",t.clearcoatRoughnessMapUv?"#define CLEARCOAT_ROUGHNESSMAP_UV "+t.clearcoatRoughnessMapUv:"",t.iridescenceMapUv?"#define IRIDESCENCEMAP_UV "+t.iridescenceMapUv:"",t.iridescenceThicknessMapUv?"#define IRIDESCENCE_THICKNESSMAP_UV "+t.iridescenceThicknessMapUv:"",t.sheenColorMapUv?"#define SHEEN_COLORMAP_UV "+t.sheenColorMapUv:"",t.sheenRoughnessMapUv?"#define SHEEN_ROUGHNESSMAP_UV "+t.sheenRoughnessMapUv:"",t.specularMapUv?"#define SPECULARMAP_UV "+t.specularMapUv:"",t.specularColorMapUv?"#define SPECULAR_COLORMAP_UV "+t.specularColorMapUv:"",t.specularIntensityMapUv?"#define SPECULAR_INTENSITYMAP_UV "+t.specularIntensityMapUv:"",t.transmissionMapUv?"#define TRANSMISSIONMAP_UV "+t.transmissionMapUv:"",t.thicknessMapUv?"#define THICKNESSMAP_UV "+t.thicknessMapUv:"",t.vertexTangents&&t.flatShading===!1?"#define USE_TANGENT":"",t.vertexColors?"#define USE_COLOR":"",t.vertexAlphas?"#define USE_COLOR_ALPHA":"",t.vertexUv1s?"#define USE_UV1":"",t.vertexUv2s?"#define USE_UV2":"",t.vertexUv3s?"#define USE_UV3":"",t.pointsUvs?"#define USE_POINTS_UV":"",t.flatShading?"#define FLAT_SHADED":"",t.skinning?"#define USE_SKINNING":"",t.morphTargets?"#define USE_MORPHTARGETS":"",t.morphNormals&&t.flatShading===!1?"#define USE_MORPHNORMALS":"",t.morphColors?"#define USE_MORPHCOLORS":"",t.morphTargetsCount>0?"#define MORPHTARGETS_TEXTURE_STRIDE "+t.morphTextureStride:"",t.morphTargetsCount>0?"#define MORPHTARGETS_COUNT "+t.morphTargetsCount:"",t.doubleSided?"#define DOUBLE_SIDED":"",t.flipSided?"#define FLIP_SIDED":"",t.shadowMapEnabled?"#define USE_SHADOWMAP":"",t.shadowMapEnabled?"#define "+l:"",t.sizeAttenuation?"#define USE_SIZEATTENUATION":"",t.numLightProbes>0?"#define USE_LIGHT_PROBES":"",t.logarithmicDepthBuffer?"#define USE_LOGARITHMIC_DEPTH_BUFFER":"",t.reversedDepthBuffer?"#define USE_REVERSED_DEPTH_BUFFER":"","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",`
3953`].filter(Fs).join(`
3954`),p=[qh(t),"#define SHADER_TYPE "+t.shaderType,"#define SHADER_NAME "+t.shaderName,m,t.useFog&&t.fog?"#define USE_FOG":"",t.useFog&&t.fogExp2?"#define FOG_EXP2":"",t.alphaToCoverage?"#define ALPHA_TO_COVERAGE":"",t.map?"#define USE_MAP":"",t.matcap?"#define USE_MATCAP":"",t.envMap?"#define USE_ENVMAP":"",t.envMap?"#define "+c:"",t.envMap?"#define "+h:"",t.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":"",t.lightMap?"#define USE_LIGHTMAP":"",t.aoMap?"#define USE_AOMAP":"",t.bumpMap?"#define USE_BUMPMAP":"",t.normalMap?"#define USE_NORMALMAP":"",t.normalMapObjectSpace?"#define USE_NORMALMAP_OBJECTSPACE":"",t.normalMapTangentSpace?"#define USE_NORMALMAP_TANGENTSPACE":"",t.emissiveMap?"#define USE_EMISSIVEMAP":"",t.anisotropy?"#define USE_ANISOTROPY":"",t.anisotropyMap?"#define USE_ANISOTROPYMAP":"",t.clearcoat?"#define USE_CLEARCOAT":"",t.clearcoatMap?"#define USE_CLEARCOATMAP":"",t.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",t.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",t.dispersion?"#define USE_DISPERSION":"",t.iridescence?"#define USE_IR
3954IDESCENCE":"",t.iridescenceMap?"#define USE_IRIDESCENCEMAP":"",t.iridescenceThicknessMap?"#define USE_IRIDESCENCE_THICKNESSMAP":"",t.specularMap?"#define USE_SPECULARMAP":"",t.specularColorMap?"#define USE_SPECULAR_COLORMAP":"",t.specularIntensityMap?"#define USE_SPECULAR_INTENSITYMAP":"",t.roughnessMap?"#define USE_ROUGHNESSMAP":"",t.metalnessMap?"#define USE_METALNESSMAP":"",t.alphaMap?"#define USE_ALPHAMAP":"",t.alphaTest?"#define USE_ALPHATEST":"",t.alphaHash?"#define USE_ALPHAHASH":"",t.sheen?"#define USE_SHEEN":"",t.sheenColorMap?"#define USE_SHEEN_COLORMAP":"",t.sheenRoughnessMap?"#define USE_SHEEN_ROUGHNESSMAP":"",t.transmission?"#define USE_TRANSMISSION":"",t.transmissionMap?"#define USE_TRANSMISSIONMAP":"",t.thicknessMap?"#define USE_THICKNESSMAP":"",t.vertexTangents&&t.flatShading===!1?"#define USE_TANGENT":"",t.vertexColors||t.instancingColor||t.batchingColor?"#define USE_COLOR":"",t.vertexAlphas?"#define USE_COLOR_ALPHA":"",t.vertexUv1s?"#define USE_UV1":"",t.vertexUv2s?"#define USE_UV2":"",t.vertexUv3s?"#define USE_UV3":"",t.pointsUvs?"#define USE_POINTS_UV":"",t.gradientMap?"#define USE_GRADIENTMAP":"",t.flatShading?"#define FLAT_SHADED":"",t.doubleSided?"#define DOUBLE_SIDED":"",t.flipSided?"#define FLIP_SIDED":"",t.shadowMapEnabled?"#define USE_SHADOWMAP":"",t.shadowMapEnabled?"#define "+l:"",t.premultipliedAlpha?"#define PREMULTIPLIED_ALPHA":"",t.numLightProbes>0?"#define USE_LIGHT_PROBES":"",t.decodeVideoTexture?"#define DECODE_VIDEO_TEXTURE":"",t.decodeVideoTextureEmissive?"#define DECODE_VIDEO_TEXTURE_EMISSIVE":"",t.logarithmicDepthBuffer?"#define USE_LOGARITHMIC_DEPTH_BUFFER":"",t.reversedDepthBuffer?"#define USE_REVERSED_DEPTH_BUFFER":"","uniform mat4 viewMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;",t.toneMapping!==Sn?"#define TONE_MAPPING":"",t.toneMapping!==Sn?Je.tonemapping_pars_fragment:"",t.toneMapping!==Sn?Lx("toneMapping",t.toneMapping):"",t.dithering?"#define DITHERING":"",t.opaque?"#define OPAQUE":"",Je.colorspace_pars_fragment,Ix("linearToOutputTexel",t.outputColorSpace),Dx(),t.useDepthPacking?"#define DEPTH_PACKING "+t.depthPacking:"",`
3955`].filter(Fs).join(`
3956`)),a=xl(a),a=Hh(a,t),a=Wh(a,t),o=xl(o),o=Hh(o,t),o=Wh(o,t),a=Xh(a),o=Xh(o),t.isRawShaderMaterial!==!0&&(v=`#version 300 es
3957`,g=[f,"#define attribute in","#define varying out","#define texture2D texture"].join(`
3958`)+`
3959`+g,p=["#define varying in",t.glslVersion===yc?"":"layout(location = 0) out highp vec4 pc_fragColor;",t.glslVersion===yc?"":"#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(`
3960`)+`
3961`+p);const x=v+g+a,M=v+p+o,T=Vh(i,i.VERTEX_SHADER,x),E=Vh(i,i.FRAGMENT_SHADER,M);i.attachShader(_,T),i.attachShader(_,E),t.index0AttributeName!==void 0?i.bindAttribLocation(_,0,t.index0AttributeName):t.morphTargets===!0&&i.bindAttribLocation(_,0,"position"),i.linkProgram(_);function C(L){if(r.debug.checkShaderErrors){const F=i.getProgramInfoLog(_)||"",B=i.getShaderInfoLog(T)||"",G=i.getShaderInfoLog(E)||"",q=F.trim(),V=B.trim(),H=G.trim();let j=!0,pe=!0;if(i.getProgramParameter(_,i.LINK_STATUS)===!1)if(j=!1,typeof r.debug.onShaderError=="function")r.debug.onShaderError(i,_,T,E);else{const oe=Gh(i,T,"vertex"),he=Gh(i,E,"fragment");Le("THREE.WebGLProgram: Shader Error "+i.getError()+" - VALIDATE_STATUS "+i.getProgramParameter(_,i.VALIDATE_STATUS)+`
3962
3963Material Name: `+L.name+`
3964Material Type: `+L.type+`
3965
3966Program Info Log: `+q+`
3967`+oe+`
3968`+he)}else q!==""?de("WebGLProgram: Program Info Log:",q):(V===""||H==="")&&(pe=!1);pe&&(L.diagnostics={runnable:j,programLog:q,vertexShader:{log:V,prefix:g},fragmentShader:{log:H,prefix:p}})}i.deleteShader(T),i.deleteShader(E),P=new Qr(i,_),S=Fx(i,_)}let P;this.getUniforms=function(){return P===void 0&&C(this),P};let S;this.getAttributes=function(){return S===void 0&&C(this),S};let b=t.rendererExtensionParallelShaderCompile===!1;return this.isReady=function(){return b===!1&&(b=i.getProgramParameter(_,Ex)),b},this.destroy=function(){n.releaseStatesOfProgram(this),i.deleteProgram(_),this.program=void 0},this.type=t.shaderType,this.name=t.shaderName,this.id=wx++,this.cacheKey=e,this.usedTimes=1,this.program=_,this.vertexShader=T,this.fragmentShader=E,this}let Qx=0;class jx{constructor(){this.shaderCache=new Map,this.materialCache=new Map}update(e){const t=e.vertexShader,n=e.fragmentShader,i=this._getShaderStage(t),s=this._getShaderStage(n),a=this._getShaderCacheForMaterial(e);return a.has(i)===!1&&(a.add(i),i.usedTimes++),a.has(s)===!1&&(a.add(s),s.usedTimes++),this}remove(e){const t=this.materialCache.get(e);for(const n of t)n.usedTimes--,n.usedTimes===0&&this.shaderCache.delete(n.code);return this.materialCache.delete(e),this}getVertexShaderID(e){return this._getShaderStage(e.vertexShader).id}getFragmentShaderID(e){return this._getShaderStage(e.fragmentShader).id}dispose(){this.shaderCache.clear(),this.materialCache.clear()}_getShaderCacheForMaterial(e){const t=this.materialCache;let n=t.get(e);return n===void 0&&(n=new Set,t.set(e,n)),n}_getShaderStage(e){const t=this.shaderCache;let n=t.get(e);return n===void 0&&(n=new ev(e),t.set(e,n)),n}}class ev{constructor(e){this.id=Qx++,this.code=e,this.usedTimes=0}}function tv(r,e,t,n,i,s,a){const o=new Dl,l=new jx,c=new Set,h=[],u=new Map,d=i.logarithmicDepthBuffer;let f=i.precision;const m={MeshDepthMaterial:"depth",MeshDistanceMaterial:"distance",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 _(S){return c.add(S),S===0?"uv":`uv${S}`}function g(S,b,L,F,B){const G=F.fog,q=B.geometry,V=S.isMeshStandardMaterial?F.environment:null,H=(S.isMeshStandardMaterial?t:e).get(S.envMap||V),j=H&&H.mapping===$s?H.image.height:null,pe=m[S.type];S.precision!==null&&(f=i.getMaxPrecision(S.precision),f!==S.precision&&de("WebGLProgram.getParameters:",S.precision,"not supported, using",f,"instead."));const oe=q.morphAttributes.position||q.morphAttributes.normal||q.morphAttributes.color,he=oe!==void 0?oe.length:0;let We=0;q.morphAttributes.position!==void 0&&(We=1),q.morphAttributes.normal!==void 0&&(We=2),q.morphAttributes.color!==void 0&&(We=3);let ke,at,ot,Y;if(pe){const it=yn[pe];ke=it.vertexShader,at=it.fragmentShader}else ke=S.vertexShader,at=S.fragmentShader,l.update(S),ot=l.getVertexShaderID(S),Y=l.getFragmentShaderID(S);const ee=r.getRenderTarget(),Se=r.state.buffers.depth.getReversed(),Fe=B.isInstancedMesh===!0,Ae=B.isBatchedMesh===!0,Qe=!!S.map,lt=!!S.matcap,Xe=!!H,$=!!S.aoMap,ne=!!S.lightMap,Q=!!S.bumpMap,ge=!!S.normalMap,I=!!S.displacementMap,De=!!S.emissiveMap,ve=!!S.metalnessMap,Oe=!!S.roughnessMap,re=S.anisotropy>0,w=S.clearcoat>0,y=S.dispersion>0,U=S.iridescence>0,W=S.sheen>0,Z=S.transmission>0,X=re&&!!S.anisotropyMap,Re=w&&!!S.clearcoatMap,ae=w&&!!S.clearcoatNormalMap,we=w&&!!S.clearcoatRoughnessMap,Be=U&&!!S.iridescenceMap,te=U&&!!S.iridescenceThicknessMap,ue=W&&!!S.sheenColorMap,Ce=W&&!!S.sheenRoughnessMap,Ie=!!S.specularMap,ce=!!S.specularColorMap,$e=!!S.specularIntensityMap,D=Z&&!!S.transmissionMap,xe=Z&&!!S.thicknessMap,se=!!S.gradientMap,ye=!!S.alphaMap,ie=S.alphaTest>0,J=!!S.alphaHash,le=!!S.extensions;let He=Sn;S.toneMapped&&(ee===null||ee.isXRRenderTarget===!0)&&(He=r.toneMapping);const dt={shaderID:pe,shaderType:S.type,shaderName:S.name,vertexShader:ke,fragmentShader:at,defines:S.defines,customVertexShaderID:ot,customFragmentShaderID:Y,isRawShaderMaterial:S.isRawShaderMaterial===!0,glslVersion:S.glslVersion,precision:f,batching:Ae,batchingColor:Ae&&B._colorsTexture!==null,instancing:Fe,instancingColor:Fe&&B.instanceColor!==null,instancingMorph:Fe&&B.morphTexture!==null,outputColorSpace:ee===null?r.outputColorSpace:ee.isXRRenderTarget===!0?ee.texture.colorSpace:ls,alphaToCoverage:!!S.alphaToCoverage,map:Qe,matcap:lt,envMap:Xe,envMapMode:Xe&&H.mapping,envMapCubeUVHeight:j,aoMap:$,lightMap:ne,bumpMap:Q,normalMap:ge,displacementMap:I,emissiveMap:De,normalMapObjectSpace:ge&&S.normalMapType===Ud,normalMapTangentSpace:ge&&S.normalMapType===wi,metalnessMap:ve,roughnessMap:Oe,anisotropy:re,anisotropyMap:X,clearcoat:w,clearcoatMap:Re,clearcoatNormalMap:ae,clearcoatRoughnessMap:we,dispersion:y,iridescence:U,iridescenceMap:Be,iridescenceThicknessMap:te,sheen:W,sheenColorMap:ue,sheenRoughnessMap:Ce,specularMap:Ie,specularColorMap:ce,specularIntensityMap:$e,transmission:Z,transmissionMap:D,thicknessMap:xe,gradientMap:se,opaque:S.transparent===!1&&S.blending===is&&S.alphaToCoverage===!1,alphaMap:ye,alphaTest:ie,alphaHash:J,combine:S.combine,mapUv:Qe&&_(S.map.channel),aoMapUv:$&&_(S.aoMap.channel),lightMapUv:ne&&_(S.lightMap.channel),bumpMapUv:Q&&_(S.bumpMap.channel),normalMapUv:ge&&_(S.normalMap.channel),displacementMapUv:I&&_(S.displacementMap.channel),emissiveMapUv:De&&_(S.emissiveMap.channel),metalnessMapUv:ve&&_(S.metalnessMap.channel),roughnessMapUv:Oe&&_(S.roughnessMap.channel),anisotropyMapUv:X&&_(S.anisotropyMap.channel),clearcoatMapUv:Re&&_(S.clearcoatMap.channel),clearcoatNormalMapUv:ae&&_(S.clearcoatNormalMap.channel),clearcoatRoughnessMapUv:we&&_(S.clearcoatRoughnessMap.channel),iridescenceMapUv:Be&&_(S.iridescenceMap.channel),iridescenceThicknessMapUv:te&&_(S.iridescenceThicknessMap.channel),sheenColorMapUv:ue&&_(S.sheenColorMap.channel),sheenRoughnessMapUv:Ce&&_(S.sheenRoughnessMap.channel),specularMapUv:Ie&&_(S.specularMap.channel),specularColorMapUv:ce&&_(S.specularColorMap.channel),specularIntensityMapUv:$e&&_(S.specularIntensityMap.channel),transmissionMapUv:D&&_(S.transmissionMap.channel),thicknessMapUv:xe&&_(S.thicknessMap.channel),alphaMapUv:ye&&_(S.alphaMap.channel),vertexTangents:!!q.attributes.tangent&&(ge||re),vertexColors:S.vertexColors,vertexAlphas:S.vertexColors===!0&&!!q.attributes.color&&q.attributes.color.itemSize===4,pointsUvs:B.isPoints===!0&&!!q.attributes.uv&&(Qe||ye),fog:!!G,useFog:S.fog===!0,fogExp2:!!G&&G.isFogExp2,flatShading:S.flatShading===!0&&S.wireframe===!1,sizeAttenuation:S.sizeAttenuation===!0,logarithmicDepthBuffer:d,reversedDepthBuffer:Se,skinning:B.isSkinnedMesh===!0,morphTargets:q.morphAttributes.position!==void 0,morphNormals:q.morphAttributes.normal!==void 0,morphColors:q.morphAttributes.color!==void 0,morphTargetsCount:he,morphTextureStride:We,numDirLights:b.directional.length,numPointLights:b.point.length,numSpotLights:b.spot.length,numSpotLightMaps:b.spotLightMap.length,numRectAreaLights:b.rectArea.length,numHemiLights:b.hemi.length,numDirLightShadows:b.directionalShadowMap.length,numPointLightShadows:b.pointShadowMap.length,numSpotLightShadows:b.spotShadowMap.length,numSpotLightShadowsWithMaps:b.numSpotLightShadowsWithMaps,numLightProbes:b.numLightProbes,numClippingPlanes:a.numPlanes,numClipIntersection:a.numIntersection,dithering:S.dithering,shadowMapEnabled:r.shadowMap.enabled&&L.length>0,shadowMapType:r.shadowMap.type,toneMapping:He,decodeVideoTexture:Qe&&S.map.isVideoTexture===!0&&je.getTransfer(S.map.colorSpace)===rt,decodeVideoTextureEmissive:De&&S.emissiveMap.isVideoTexture===!0&&je.getTransfer(S.emissiveMap.colorSpace)===rt,premultipliedAlpha:S.premultipliedAlpha,doubleSided:S.side===Ln,flipSided:S.side===Xt,useDepthPacking:S.depthPacking>=0,depthPacking:S.depthPacking||0,index0AttributeName:S.index0AttributeName,extensionCl
vendor: 123,005 bytes, lines 3968-4019
3968ipCullDistance:le&&S.extensions.clipCullDistance===!0&&n.has("WEBGL_clip_cull_distance"),extensionMultiDraw:(le&&S.extensions.multiDraw===!0||Ae)&&n.has("WEBGL_multi_draw"),rendererExtensionParallelShaderCompile:n.has("KHR_parallel_shader_compile"),customProgramCacheKey:S.customProgramCacheKey()};return dt.vertexUv1s=c.has(1),dt.vertexUv2s=c.has(2),dt.vertexUv3s=c.has(3),c.clear(),dt}function p(S){const b=[];if(S.shaderID?b.push(S.shaderID):(b.push(S.customVertexShaderID),b.push(S.customFragmentShaderID)),S.defines!==void 0)for(const L in S.defines)b.push(L),b.push(S.defines[L]);return S.isRawShaderMaterial===!1&&(v(b,S),x(b,S),b.push(r.outputColorSpace)),b.push(S.customProgramCacheKey),b.join()}function v(S,b){S.push(b.precision),S.push(b.outputColorSpace),S.push(b.envMapMode),S.push(b.envMapCubeUVHeight),S.push(b.mapUv),S.push(b.alphaMapUv),S.push(b.lightMapUv),S.push(b.aoMapUv),S.push(b.bumpMapUv),S.push(b.normalMapUv),S.push(b.displacementMapUv),S.push(b.emissiveMapUv),S.push(b.metalnessMapUv),S.push(b.roughnessMapUv),S.push(b.anisotropyMapUv),S.push(b.clearcoatMapUv),S.push(b.clearcoatNormalMapUv),S.push(b.clearcoatRoughnessMapUv),S.push(b.iridescenceMapUv),S.push(b.iridescenceThicknessMapUv),S.push(b.sheenColorMapUv),S.push(b.sheenRoughnessMapUv),S.push(b.specularMapUv),S.push(b.specularColorMapUv),S.push(b.specularIntensityMapUv),S.push(b.transmissionMapUv),S.push(b.thicknessMapUv),S.push(b.combine),S.push(b.fogExp2),S.push(b.sizeAttenuation),S.push(b.morphTargetsCount),S.push(b.morphAttributeCount),S.push(b.numDirLights),S.push(b.numPointLights),S.push(b.numSpotLights),S.push(b.numSpotLightMaps),S.push(b.numHemiLights),S.push(b.numRectAreaLights),S.push(b.numDirLightShadows),S.push(b.numPointLightShadows),S.push(b.numSpotLightShadows),S.push(b.numSpotLightShadowsWithMaps),S.push(b.numLightProbes),S.push(b.shadowMapType),S.push(b.toneMapping),S.push(b.numClippingPlanes),S.push(b.numClipIntersection),S.push(b.depthPacking)}function x(S,b){o.disableAll(),b.instancing&&o.enable(0),b.instancingColor&&o.enable(1),b.instancingMorph&&o.enable(2),b.matcap&&o.enable(3),b.envMap&&o.enable(4),b.normalMapObjectSpace&&o.enable(5),b.normalMapTangentSpace&&o.enable(6),b.clearcoat&&o.enable(7),b.iridescence&&o.enable(8),b.alphaTest&&o.enable(9),b.vertexColors&&o.enable(10),b.vertexAlphas&&o.enable(11),b.vertexUv1s&&o.enable(12),b.vertexUv2s&&o.enable(13),b.vertexUv3s&&o.enable(14),b.vertexTangents&&o.enable(15),b.anisotropy&&o.enable(16),b.alphaHash&&o.enable(17),b.batching&&o.enable(18),b.dispersion&&o.enable(19),b.batchingColor&&o.enable(20),b.gradientMap&&o.enable(21),S.push(o.mask),o.disableAll(),b.fog&&o.enable(0),b.useFog&&o.enable(1),b.flatShading&&o.enable(2),b.logarithmicDepthBuffer&&o.enable(3),b.reversedDepthBuffer&&o.enable(4),b.skinning&&o.enable(5),b.morphTargets&&o.enable(6),b.morphNormals&&o.enable(7),b.morphColors&&o.enable(8),b.premultipliedAlpha&&o.enable(9),b.shadowMapEnabled&&o.enable(10),b.doubleSided&&o.enable(11),b.flipSided&&o.enable(12),b.useDepthPacking&&o.enable(13),b.dithering&&o.enable(14),b.transmission&&o.enable(15),b.sheen&&o.enable(16),b.opaque&&o.enable(17),b.pointsUvs&&o.enable(18),b.decodeVideoTexture&&o.enable(19),b.decodeVideoTextureEmissive&&o.enable(20),b.alphaToCoverage&&o.enable(21),S.push(o.mask)}function M(S){const b=m[S.type];let L;if(b){const F=yn[b];L=Af.clone(F.uniforms)}else L=S.uniforms;return L}function T(S,b){let L=u.get(b);return L!==void 0?++L.usedTimes:(L=new Kx(r,b,S,s),h.push(L),u.set(b,L)),L}function E(S){if(--S.usedTimes===0){const b=h.indexOf(S);h[b]=h[h.length-1],h.pop(),u.delete(S.cacheKey),S.destroy()}}function C(S){l.remove(S)}function P(){l.dispose()}return{getParameters:g,getProgramCacheKey:p,getUniforms:M,acquireProgram:T,releaseProgram:E,releaseShaderCache:C,programs:h,dispose:P}}function nv(){let r=new WeakMap;function e(a){return r.has(a)}function t(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:e,get:t,remove:n,update:i,dispose:s}}function iv(r,e){return r.groupOrder!==e.groupOrder?r.groupOrder-e.groupOrder:r.renderOrder!==e.renderOrder?r.renderOrder-e.renderOrder:r.material.id!==e.material.id?r.material.id-e.material.id:r.z!==e.z?r.z-e.z:r.id-e.id}function Yh(r,e){return r.groupOrder!==e.groupOrder?r.groupOrder-e.groupOrder:r.renderOrder!==e.renderOrder?r.renderOrder-e.renderOrder:r.z!==e.z?e.z-r.z:r.id-e.id}function Zh(){const r=[];let e=0;const t=[],n=[],i=[];function s(){e=0,t.length=0,n.length=0,i.length=0}function a(u,d,f,m,_,g){let p=r[e];return p===void 0?(p={id:u.id,object:u,geometry:d,material:f,groupOrder:m,renderOrder:u.renderOrder,z:_,group:g},r[e]=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),e++,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):t.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):t.unshift(p)}function c(u,d){t.length>1&&t.sort(u||iv),n.length>1&&n.sort(d||Yh),i.length>1&&i.sort(d||Yh)}function h(){for(let u=e,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:t,transmissive:n,transparent:i,init:s,push:o,unshift:l,finish:h,sort:c}}function sv(){let r=new WeakMap;function e(n,i){const s=r.get(n);let a;return s===void 0?(a=new Zh,r.set(n,[a])):i>=s.length?(a=new Zh,s.push(a)):a=s[i],a}function t(){r=new WeakMap}return{get:e,dispose:t}}function rv(){const r={};return{get:function(e){if(r[e.id]!==void 0)return r[e.id];let t;switch(e.type){case"DirectionalLight":t={direction:new R,color:new Me};break;case"SpotLight":t={position:new R,direction:new R,color:new Me,distance:0,coneCos:0,penumbraCos:0,decay:0};break;case"PointLight":t={position:new R,color:new Me,distance:0,decay:0};break;case"HemisphereLight":t={direction:new R,skyColor:new Me,groundColor:new Me};break;case"RectAreaLight":t={color:new Me,position:new R,halfWidth:new R,halfHeight:new R};break}return r[e.id]=t,t}}}function av(){const r={};return{get:function(e){if(r[e.id]!==void 0)return r[e.id];let t;switch(e.type){case"DirectionalLight":t={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new K};break;case"SpotLight":t={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new K};break;case"PointLight":t={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new K,shadowCameraNear:1,shadowCameraFar:1e3};break}return r[e.id]=t,t}}}let ov=0;function lv(r,e){return(e.castShadow?2:0)-(r.castShadow?2:0)+(e.map?1:0)-(r.map?1:0)}function cv(r){const e=new rv,t=av(),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 R);const i=new R,s=new Ge,a=new Ge;function o(c){let h=0,u=0,d=0;for(let S=0;S<9;S++)n.probe[S].set(0,0,0);let f=0,m=0,_=0,g=0,p=0,v=0,x=0,M=0,T=0,E=0,C=0;c.sort(lv);for(let S=0,b=c.length;S<b;S++){const L=c[S],F=L.color,B=L.intensity,G=L.distance;let q=null;if(L.shadow&&L.shadow.map&&(L.shadow.map.texture.format===os?q=L.shadow.map.texture:q=L.shadow.map.depthTexture||L.shadow.map.texture),L.isAmbientLight)h+=F.r*B,u+=F.g*B,d+=F.b*B;else if(L.isLightProbe){for(let V=0;V<9;V++)n.probe[V].addScaledVector(L.sh.coefficients[V],B);C++}else if(L.isDirectionalLight){const V=e.get(L);if(V.color.copy(L.color).multiplyScalar(L.intensity),L.castShadow){const H=L.shadow,j=t.get(L);j.shadowIntensity=H.intensity,j.shadowBias=H.bias,j.shadowNormalBias=H.normalBias,j.shadowRadius=H.radius,j.shadowMapSize=H.mapSize,n.directionalShadow[f]=j,n.directionalShadowMap[f]=q,n.directionalShadowMatrix[f]=L.shadow.matrix,v++}n.directional[f]=V,f++}else if(L.isSpotLight){const V=e.get(L);V.position.setFromMatrixPosition(L.matrixWorld),V.color.copy(F).multiplyScalar(B),V.distance=G,V.coneCos=Math.cos(L.angle),V.penumbraCos=Math.cos(L.angle*(1-L.penumbra)),V.decay=L.decay,n.spot[_]=V;const H=L.shadow;if(L.map&&(n.spotLightMap[T]=L.map,T++,H.updateMatrices(L),L.castShadow&&E++),n.spotLightMatrix[_]=H.matrix,L.castShadow){const j=t.get(L);j.shadowIntensity=H.intensity,j.shadowBias=H.bias,j.shadowNormalBias=H.normalBias,j.shadowRadius=H.radius,j.shadowMapSize=H.mapSize,n.spotShadow[_]=j,n.spotShadowMap[_]=q,M++}_++}else if(L.isRectAreaLight){const V=e.get(L);V.color.copy(F).multiplyScalar(B),V.halfWidth.set(L.width*.5,0,0),V.halfHeight.set(0,L.height*.5,0),n.rectArea[g]=V,g++}else if(L.isPointLight){const V=e.get(L);if(V.color.copy(L.color).multiplyScalar(L.intensity),V.distance=L.distance,V.decay=L.decay,L.castShadow){const H=L.shadow,j=t.get(L);j.shadowIntensity=H.intensity,j.shadowBias=H.bias,j.shadowNormalBias=H.normalBias,j.shadowRadius=H.radius,j.shadowMapSize=H.mapSize,j.shadowCameraNear=H.camera.near,j.shadowCameraFar=H.camera.far,n.pointShadow[m]=j,n.pointShadowMap[m]=q,n.pointShadowMatrix[m]=L.shadow.matrix,x++}n.point[m]=V,m++}else if(L.isHemisphereLight){const V=e.get(L);V.skyColor.copy(L.color).multiplyScalar(B),V.groundColor.copy(L.groundColor).multiplyScalar(B),n.hemi[p]=V,p++}}g>0&&(r.has("OES_texture_float_linear")===!0?(n.rectAreaLTC1=me.LTC_FLOAT_1,n.rectAreaLTC2=me.LTC_FLOAT_2):(n.rectAreaLTC1=me.LTC_HALF_1,n.rectAreaLTC2=me.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!==v||P.numPointShadows!==x||P.numSpotShadows!==M||P.numSpotMaps!==T||P.numLightProbes!==C)&&(n.directional.length=f,n.spot.length=_,n.rectArea.length=g,n.point.length=m,n.hemi.length=p,n.directionalShadow.length=v,n.directionalShadowMap.length=v,n.pointShadow.length=x,n.pointShadowMap.length=x,n.spotShadow.length=M,n.spotShadowMap.length=M,n.directionalShadowMatrix.length=v,n.pointShadowMatrix.length=x,n.spotLightMatrix.length=M+T-E,n.spotLightMap.length=T,n.numSpotLightShadowsWithMaps=E,n.numLightProbes=C,P.directionalLength=f,P.pointLength=m,P.spotLength=_,P.rectAreaLength=g,P.hemiLength=p,P.numDirectionalShadows=v,P.numPointShadows=x,P.numSpotShadows=M,P.numSpotMaps=T,P.numLightProbes=C,n.version=ov++)}function l(c,h){let u=0,d=0,f=0,m=0,_=0;const g=h.matrixWorldInverse;for(let p=0,v=c.length;p<v;p++){const x=c[p];if(x.isDirectionalLight){const M=n.directional[u];M.direction.setFromMatrixPosition(x.matrixWorld),i.setFromMatrixPosition(x.target.matrixWorld),M.direction.sub(i),M.direction.transformDirection(g),u++}else if(x.isSpotLight){const M=n.spot[f];M.position.setFromMatrixPosition(x.matrixWorld),M.position.applyMatrix4(g),M.direction.setFromMatrixPosition(x.matrixWorld),i.setFromMatrixPosition(x.target.matrixWorld),M.direction.sub(i),M.direction.transformDirection(g),f++}else if(x.isRectAreaLight){const M=n.rectArea[m];M.position.setFromMatrixPosition(x.matrixWorld),M.position.applyMatrix4(g),a.identity(),s.copy(x.matrixWorld),s.premultiply(g),a.extractRotation(s),M.halfWidth.set(x.width*.5,0,0),M.halfHeight.set(0,x.height*.5,0),M.halfWidth.applyMatrix4(a),M.halfHeight.applyMatrix4(a),m++}else if(x.isPointLight){const M=n.point[d];M.position.setFromMatrixPosition(x.matrixWorld),M.position.applyMatrix4(g),d++}else if(x.isHemisphereLight){const M=n.hemi[_];M.direction.setFromMatrixPosition(x.matrixWorld),M.direction.transformDirection(g),_++}}}return{setup:o,setupView:l,state:n}}function Jh(r){const e=new cv(r),t=[],n=[];function i(h){c.camera=h,t.length=0,n.length=0}function s(h){t.push(h)}function a(h){n.push(h)}function o(){e.setup(t)}function l(h){e.setupView(t,h)}const c={lightsArray:t,shadowsArray:n,camera:null,lights:e,transmissionRenderTarget:{}};return{init:i,state:c,setupLights:o,setupLightsView:l,pushLight:s,pushShadow:a}}function hv(r){let e=new WeakMap;function t(i,s=0){const a=e.get(i);let o;return a===void 0?(o=new Jh(r),e.set(i,[o])):s>=a.length?(o=new Jh(r),a.push(o)):o=a[s],o}function n(){e=new WeakMap}return{get:t,dispose:n}}const uv=`void main() {
3969	gl_Position = vec4( position, 1.0 );
3970}`,dv=`uniform sampler2D shadow_pass;
3971uniform vec2 resolution;
3972uniform float radius;
3973void main() {
3974	const float samples = float( VSM_SAMPLES );
3975	float mean = 0.0;
3976	float squared_mean = 0.0;
3977	float uvStride = samples <= 1.0 ? 0.0 : 2.0 / ( samples - 1.0 );
3978	float uvStart = samples <= 1.0 ? 0.0 : - 1.0;
3979	for ( float i = 0.0; i < samples; i ++ ) {
3980		float uvOffset = uvStart + i * uvStride;
3981		#ifdef HORIZONTAL_PASS
3982			vec2 distribution = texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( uvOffset, 0.0 ) * radius ) / resolution ).rg;
3983			mean += distribution.x;
3984			squared_mean += distribution.y * distribution.y + distribution.x * distribution.x;
3985		#else
3986			float depth = texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( 0.0, uvOffset ) * radius ) / resolution ).r;
3987			mean += depth;
3988			squared_mean += depth * depth;
3989		#endif
3990	}
3991	mean = mean / samples;
3992	squared_mean = squared_mean / samples;
3993	float std_dev = sqrt( max( 0.0, squared_mean - mean * mean ) );
3994	gl_FragColor = vec4( mean, std_dev, 0.0, 1.0 );
3995}`,fv=[new R(1,0,0),new R(-1,0,0),new R(0,1,0),new R(0,-1,0),new R(0,0,1),new R(0,0,-1)],pv=[new R(0,-1,0),new R(0,-1,0),new R(0,0,1),new R(0,0,-1),new R(0,-1,0),new R(0,-1,0)],$h=new Ge,Is=new R,Mo=new R;function mv(r,e,t){let n=new Qs;const i=new K,s=new K,a=new pt,o=new Fu,l=new Ou,c={},h=t.maxTextureSize,u={[Qn]:Xt,[Xt]:Qn,[Ln]:Ln},d=new pn({defines:{VSM_SAMPLES:8},uniforms:{shadow_pass:{value:null},resolution:{value:new K},radius:{value:4}},vertexShader:uv,fragmentShader:dv}),f=d.clone();f.defines.HORIZONTAL_PASS=1;const m=new qe;m.setAttribute("position",new ut(new Float32Array([-1,-1,.5,3,-1,.5,-1,3,.5]),3));const _=new At(m,d),g=this;this.enabled=!1,this.autoUpdate=!0,this.needsUpdate=!1,this.type=qr;let p=this.type;this.render=function(E,C,P){if(g.enabled===!1||g.autoUpdate===!1&&g.needsUpdate===!1||E.length===0)return;E.type===ld&&(de("WebGLShadowMap: PCFSoftShadowMap has been deprecated. Using PCFShadowMap instead."),E.type=qr);const S=r.getRenderTarget(),b=r.getActiveCubeFace(),L=r.getActiveMipmapLevel(),F=r.state;F.setBlending(Fn),F.buffers.depth.getReversed()===!0?F.buffers.color.setClear(0,0,0,0):F.buffers.color.setClear(1,1,1,1),F.buffers.depth.setTest(!0),F.setScissorTest(!1);const B=p!==this.type;B&&C.traverse(function(G){G.material&&(Array.isArray(G.material)?G.material.forEach(q=>q.needsUpdate=!0):G.material.needsUpdate=!0)});for(let G=0,q=E.length;G<q;G++){const V=E[G],H=V.shadow;if(H===void 0){de("WebGLShadowMap:",V,"has no shadow.");continue}if(H.autoUpdate===!1&&H.needsUpdate===!1)continue;i.copy(H.mapSize);const j=H.getFrameExtents();if(i.multiply(j),s.copy(H.mapSize),(i.x>h||i.y>h)&&(i.x>h&&(s.x=Math.floor(h/j.x),i.x=s.x*j.x,H.mapSize.x=s.x),i.y>h&&(s.y=Math.floor(h/j.y),i.y=s.y*j.y,H.mapSize.y=s.y)),H.map===null||B===!0){if(H.map!==null&&(H.map.depthTexture!==null&&(H.map.depthTexture.dispose(),H.map.depthTexture=null),H.map.dispose()),this.type===Ps){if(V.isPointLight){de("WebGLShadowMap: VSM shadow maps are not supported for PointLights. Use PCF or BasicShadowMap instead.");continue}H.map=new ln(i.x,i.y,{format:os,type:zn,minFilter:mt,magFilter:mt,generateMipmaps:!1}),H.map.texture.name=V.name+".shadowMap",H.map.depthTexture=new qs(i.x,i.y,Ht),H.map.depthTexture.name=V.name+".shadowMapDepth",H.map.depthTexture.format=Vn,H.map.depthTexture.compareFunction=null,H.map.depthTexture.minFilter=bt,H.map.depthTexture.magFilter=bt}else{V.isPointLight?(H.map=new vu(i.x),H.map.depthTexture=new Kf(i.x,fn)):(H.map=new ln(i.x,i.y),H.map.depthTexture=new qs(i.x,i.y,fn)),H.map.depthTexture.name=V.name+".shadowMap",H.map.depthTexture.format=Vn;const oe=r.state.buffers.depth.getReversed();this.type===qr?(H.map.depthTexture.compareFunction=oe?Rl:Cl,H.map.depthTexture.minFilter=mt,H.map.depthTexture.magFilter=mt):(H.map.depthTexture.compareFunction=null,H.map.depthTexture.minFilter=bt,H.map.depthTexture.magFilter=bt)}H.camera.updateProjectionMatrix()}const pe=H.map.isWebGLCubeRenderTarget?6:1;for(let oe=0;oe<pe;oe++){if(H.map.isWebGLCubeRenderTarget)r.setRenderTarget(H.map,oe),r.clear();else{oe===0&&(r.setRenderTarget(H.map),r.clear());const he=H.getViewport(oe);a.set(s.x*he.x,s.y*he.y,s.x*he.z,s.y*he.w),F.viewport(a)}if(V.isPointLight){const he=H.camera,We=H.matrix,ke=V.distance||he.far;ke!==he.far&&(he.far=ke,he.updateProjectionMatrix()),Is.setFromMatrixPosition(V.matrixWorld),he.position.copy(Is),Mo.copy(he.position),Mo.add(fv[oe]),he.up.copy(pv[oe]),he.lookAt(Mo),he.updateMatrixWorld(),We.makeTranslation(-Is.x,-Is.y,-Is.z),$h.multiplyMatrices(he.projectionMatrix,he.matrixWorldInverse),H._frustum.setFromProjectionMatrix($h,he.coordinateSystem,he.reversedDepth)}else H.updateMatrices(V);n=H.getFrustum(),M(C,P,H.camera,V,this.type)}H.isPointLightShadow!==!0&&this.type===Ps&&v(H,P),H.needsUpdate=!1}p=this.type,g.needsUpdate=!1,r.setRenderTarget(S,b,L)};function v(E,C){const P=e.update(_);d.defines.VSM_SAMPLES!==E.blurSamples&&(d.defines.VSM_SAMPLES=E.blurSamples,f.defines.VSM_SAMPLES=E.blurSamples,d.needsUpdate=!0,f.needsUpdate=!0),E.mapPass===null&&(E.mapPass=new ln(i.x,i.y,{format:os,type:zn})),d.uniforms.shadow_pass.value=E.map.depthTexture,d.uniforms.resolution.value=E.mapSize,d.uniforms.radius.value=E.radius,r.setRenderTarget(E.mapPass),r.clear(),r.renderBufferDirect(C,null,P,d,_,null),f.uniforms.shadow_pass.value=E.mapPass.texture,f.uniforms.resolution.value=E.mapSize,f.uniforms.radius.value=E.radius,r.setRenderTarget(E.map),r.clear(),r.renderBufferDirect(C,null,P,f,_,null)}function x(E,C,P,S){let b=null;const L=P.isPointLight===!0?E.customDistanceMaterial:E.customDepthMaterial;if(L!==void 0)b=L;else if(b=P.isPointLight===!0?l:o,r.localClippingEnabled&&C.clipShadows===!0&&Array.isArray(C.clippingPlanes)&&C.clippingPlanes.length!==0||C.displacementMap&&C.displacementScale!==0||C.alphaMap&&C.alphaTest>0||C.map&&C.alphaTest>0||C.alphaToCoverage===!0){const F=b.uuid,B=C.uuid;let G=c[F];G===void 0&&(G={},c[F]=G);let q=G[B];q===void 0&&(q=b.clone(),G[B]=q,C.addEventListener("dispose",T)),b=q}if(b.visible=C.visible,b.wireframe=C.wireframe,S===Ps?b.side=C.shadowSide!==null?C.shadowSide:C.side:b.side=C.shadowSide!==null?C.shadowSide:u[C.side],b.alphaMap=C.alphaMap,b.alphaTest=C.alphaToCoverage===!0?.5:C.alphaTest,b.map=C.map,b.clipShadows=C.clipShadows,b.clippingPlanes=C.clippingPlanes,b.clipIntersection=C.clipIntersection,b.displacementMap=C.displacementMap,b.displacementScale=C.displacementScale,b.displacementBias=C.displacementBias,b.wireframeLinewidth=C.wireframeLinewidth,b.linewidth=C.linewidth,P.isPointLight===!0&&b.isMeshDistanceMaterial===!0){const F=r.properties.get(b);F.light=P}return b}function M(E,C,P,S,b){if(E.visible===!1)return;if(E.layers.test(C.layers)&&(E.isMesh||E.isLine||E.isPoints)&&(E.castShadow||E.receiveShadow&&b===Ps)&&(!E.frustumCulled||n.intersectsObject(E))){E.modelViewMatrix.multiplyMatrices(P.matrixWorldInverse,E.matrixWorld);const B=e.update(E),G=E.material;if(Array.isArray(G)){const q=B.groups;for(let V=0,H=q.length;V<H;V++){const j=q[V],pe=G[j.materialIndex];if(pe&&pe.visible){const oe=x(E,pe,S,b);E.onBeforeShadow(r,E,C,P,B,oe,j),r.renderBufferDirect(P,null,B,oe,E,j),E.onAfterShadow(r,E,C,P,B,oe,j)}}}else if(G.visible){const q=x(E,G,S,b);E.onBeforeShadow(r,E,C,P,B,q,null),r.renderBufferDirect(P,null,B,q,E,null),E.onAfterShadow(r,E,C,P,B,q,null)}}const F=E.children;for(let B=0,G=F.length;B<G;B++)M(F[B],C,P,S,b)}function T(E){E.target.removeEventListener("dispose",T);for(const P in c){const S=c[P],b=E.target.uuid;b in S&&(S[b].dispose(),delete S[b])}}}const gv={[Ao]:To,[Eo]:Ro,[wo]:Io,[as]:Co,[To]:Ao,[Ro]:Eo,[Io]:wo,[Co]:as};function _v(r,e){function t(){let D=!1;const xe=new pt;let se=null;const ye=new pt(0,0,0,0);return{setMask:function(ie){se!==ie&&!D&&(r.colorMask(ie,ie,ie,ie),se=ie)},setLocked:function(ie){D=ie},setClear:function(ie,J,le,He,dt){dt===!0&&(ie*=He,J*=He,le*=He),xe.set(ie,J,le,He),ye.equals(xe)===!1&&(r.clearColor(ie,J,le,He),ye.copy(xe))},reset:function(){D=!1,se=null,ye.set(-1,0,0,0)}}}function n(){let D=!1,xe=!1,se=null,ye=null,ie=null;return{setReversed:function(J){if(xe!==J){const le=e.get("EXT_clip_control");J?le.clipControlEXT(le.LOWER_LEFT_EXT,le.ZERO_TO_ONE_EXT):le.clipControlEXT(le.LOWER_LEFT_EXT,le.NEGATIVE_ONE_TO_ONE_EXT),xe=J;const He=ie;ie=null,this.setClear(He)}},getReversed:function(){return xe},setTest:function(J){J?ee(r.DEPTH_TEST):Se(r.DEPTH_TEST)},setMask:function(J){se!==J&&!D&&(r.depthMask(J),se=J)},setFunc:function(J){if(xe&&(J=gv[J]),ye!==J){switch(J){case Ao:r.depthFunc(r.NEVER);break;case To:r.depthFunc(r.ALWAYS);break;case Eo:r.depthFunc(r.LESS);break;case as:r.depthFunc(r.LEQUAL);break;case wo:r.depthFunc(r.EQUAL);break;case Co:r.depthFunc(r.GEQUAL);break;case Ro:r.depthFunc(r.GREATER);break;case Io:r.depthFunc(r.NOTEQUAL);break;default:r.depthFunc(r.LEQUAL)}ye=J}},setLocked:function(J){D=J},setClear:function(J){ie!==J&&(xe&&(J=1-J),r.clearDepth(J),ie=J)},reset:function(){D=!1,se=null,ye=null,ie=null,xe=!1}}}function i(){let D=!1,xe=null,se=null,ye=null,ie=null,J=null,le=null,He=null,dt=null;return{setTest:function(it){D||(it?ee(r.STENCIL_TEST):Se(r.STENCIL_TEST))},setMask:function(it){xe!==it&&!D&&(r.stencilMask(it),xe=it)},setFunc:function(it,gn,Tn){(se!==it||ye!==gn||ie!==Tn)&&(r.stencilFunc(it,gn,Tn),se=it,ye=gn,ie=Tn)},setOp:function(it,gn,Tn){(J!==it||le!==gn||He!==Tn)&&(r.stencilOp(it,gn,Tn),J=it,le=gn,He=Tn)},setLocked:function(it){D=it},setClear:function(it){dt!==it&&(r.clearStencil(it),dt=it)},reset:function(){D=!1,xe=null,se=null,ye=null,ie=null,J=null,le=null,He=null,dt=null}}}const s=new t,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,v=null,x=null,M=null,T=null,E=null,C=new Me(0,0,0),P=0,S=!1,b=null,L=null,F=null,B=null,G=null;const q=r.getParameter(r.MAX_COMBINED_TEXTURE_IMAGE_UNITS);let V=!1,H=0;const j=r.getParameter(r.VERSION);j.indexOf("WebGL")!==-1?(H=parseFloat(/^WebGL (\d)/.exec(j)[1]),V=H>=1):j.indexOf("OpenGL ES")!==-1&&(H=parseFloat(/^OpenGL ES (\d)/.exec(j)[1]),V=H>=2);let pe=null,oe={};const he=r.getParameter(r.SCISSOR_BOX),We=r.getParameter(r.VIEWPORT),ke=new pt().fromArray(he),at=new pt().fromArray(We);function ot(D,xe,se,ye){const ie=new Uint8Array(4),J=r.createTexture();r.bindTexture(D,J),r.texParameteri(D,r.TEXTURE_MIN_FILTER,r.NEAREST),r.texParameteri(D,r.TEXTURE_MAG_FILTER,r.NEAREST);for(let le=0;le<se;le++)D===r.TEXTURE_3D||D===r.TEXTURE_2D_ARRAY?r.texImage3D(xe,0,r.RGBA,1,1,ye,0,r.RGBA,r.UNSIGNED_BYTE,ie):r.texImage2D(xe+le,0,r.RGBA,1,1,0,r.RGBA,r.UNSIGNED_BYTE,ie);return J}const Y={};Y[r.TEXTURE_2D]=ot(r.TEXTURE_2D,r.TEXTURE_2D,1),Y[r.TEXTURE_CUBE_MAP]=ot(r.TEXTURE_CUBE_MAP,r.TEXTURE_CUBE_MAP_POSITIVE_X,6),Y[r.TEXTURE_2D_ARRAY]=ot(r.TEXTURE_2D_ARRAY,r.TEXTURE_2D_ARRAY,1,1),Y[r.TEXTURE_3D]=ot(r.TEXTURE_3D,r.TEXTURE_3D,1,1),s.setClear(0,0,0,1),a.setClear(1),o.setClear(0),ee(r.DEPTH_TEST),a.setFunc(as),Q(!1),ge(pc),ee(r.CULL_FACE),$(Fn);function ee(D){h[D]!==!0&&(r.enable(D),h[D]=!0)}function Se(D){h[D]!==!1&&(r.disable(D),h[D]=!1)}function Fe(D,xe){return u[D]!==xe?(r.bindFramebuffer(D,xe),u[D]=xe,D===r.DRAW_FRAMEBUFFER&&(u[r.FRAMEBUFFER]=xe),D===r.FRAMEBUFFER&&(u[r.DRAW_FRAMEBUFFER]=xe),!0):!1}function Ae(D,xe){let se=f,ye=!1;if(D){se=d.get(xe),se===void 0&&(se=[],d.set(xe,se));const ie=D.textures;if(se.length!==ie.length||se[0]!==r.COLOR_ATTACHMENT0){for(let J=0,le=ie.length;J<le;J++)se[J]=r.COLOR_ATTACHMENT0+J;se.length=ie.length,ye=!0}}else se[0]!==r.BACK&&(se[0]=r.BACK,ye=!0);ye&&r.drawBuffers(se)}function Qe(D){return m!==D?(r.useProgram(D),m=D,!0):!1}const lt={[xi]:r.FUNC_ADD,[hd]:r.FUNC_SUBTRACT,[ud]:r.FUNC_REVERSE_SUBTRACT};lt[dd]=r.MIN,lt[fd]=r.MAX;const Xe={[pd]:r.ZERO,[md]:r.ONE,[gd]:r.SRC_COLOR,[So]:r.SRC_ALPHA,[Sd]:r.SRC_ALPHA_SATURATE,[yd]:r.DST_COLOR,[xd]:r.DST_ALPHA,[_d]:r.ONE_MINUS_SRC_COLOR,[bo]:r.ONE_MINUS_SRC_ALPHA,[Md]:r.ONE_MINUS_DST_COLOR,[vd]:r.ONE_MINUS_DST_ALPHA,[bd]:r.CONSTANT_COLOR,[Ad]:r.ONE_MINUS_CONSTANT_COLOR,[Td]:r.CONSTANT_ALPHA,[Ed]:r.ONE_MINUS_CONSTANT_ALPHA};function $(D,xe,se,ye,ie,J,le,He,dt,it){if(D===Fn){_===!0&&(Se(r.BLEND),_=!1);return}if(_===!1&&(ee(r.BLEND),_=!0),D!==cd){if(D!==g||it!==S){if((p!==xi||M!==xi)&&(r.blendEquation(r.FUNC_ADD),p=xi,M=xi),it)switch(D){case is:r.blendFuncSeparate(r.ONE,r.ONE_MINUS_SRC_ALPHA,r.ONE,r.ONE_MINUS_SRC_ALPHA);break;case mc:r.blendFunc(r.ONE,r.ONE);break;case gc:r.blendFuncSeparate(r.ZERO,r.ONE_MINUS_SRC_COLOR,r.ZERO,r.ONE);break;case _c:r.blendFuncSeparate(r.DST_COLOR,r.ONE_MINUS_SRC_ALPHA,r.ZERO,r.ONE);break;default:Le("WebGLState: Invalid blending: ",D);break}else switch(D){case is:r.blendFuncSeparate(r.SRC_ALPHA,r.ONE_MINUS_SRC_ALPHA,r.ONE,r.ONE_MINUS_SRC_ALPHA);break;case mc:r.blendFuncSeparate(r.SRC_ALPHA,r.ONE,r.ONE,r.ONE);break;case gc:Le("WebGLState: SubtractiveBlending requires material.premultipliedAlpha = true");break;case _c:Le("WebGLState: MultiplyBlending requires material.premultipliedAlpha = true");break;default:Le("WebGLState: Invalid blending: ",D);break}v=null,x=null,T=null,E=null,C.set(0,0,0),P=0,g=D,S=it}return}ie=ie||xe,J=J||se,le=le||ye,(xe!==p||ie!==M)&&(r.blendEquationSeparate(lt[xe],lt[ie]),p=xe,M=ie),(se!==v||ye!==x||J!==T||le!==E)&&(r.blendFuncSeparate(Xe[se],Xe[ye],Xe[J],Xe[le]),v=se,x=ye,T=J,E=le),(He.equals(C)===!1||dt!==P)&&(r.blendColor(He.r,He.g,He.b,dt),C.copy(He),P=dt),g=D,S=!1}function ne(D,xe){D.side===Ln?Se(r.CULL_FACE):ee(r.CULL_FACE);let se=D.side===Xt;xe&&(se=!se),Q(se),D.blending===is&&D.transparent===!1?$(Fn):$(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 ye=D.stencilWrite;o.setTest(ye),ye&&(o.setMask(D.stencilWriteMask),o.setFunc(D.stencilFunc,D.stencilRef,D.stencilFuncMask),o.setOp(D.stencilFail,D.stencilZFail,D.stencilZPass)),De(D.polygonOffset,D.polygonOffsetFactor,D.polygonOffsetUnits),D.alphaToCoverage===!0?ee(r.SAMPLE_ALPHA_TO_COVERAGE):Se(r.SAMPLE_ALPHA_TO_COVERAGE)}function Q(D){b!==D&&(D?r.frontFace(r.CW):r.frontFace(r.CCW),b=D)}function ge(D){D!==ad?(ee(r.CULL_FACE),D!==L&&(D===pc?r.cullFace(r.BACK):D===od?r.cullFace(r.FRONT):r.cullFace(r.FRONT_AND_BACK))):Se(r.CULL_FACE),L=D}function I(D){D!==F&&(V&&r.lineWidth(D),F=D)}function De(D,xe,se){D?(ee(r.POLYGON_OFFSET_FILL),(B!==xe||G!==se)&&(r.polygonOffset(xe,se),B=xe,G=se)):Se(r.POLYGON_OFFSET_FILL)}function ve(D){D?ee(r.SCISSOR_TEST):Se(r.SCISSOR_TEST)}function Oe(D){D===void 0&&(D=r.TEXTURE0+q-1),pe!==D&&(r.activeTexture(D),pe=D)}function re(D,xe,se){se===void 0&&(pe===null?se=r.TEXTURE0+q-1:se=pe);let ye=oe[se];ye===void 0&&(ye={type:void 0,texture:void 0},oe[se]=ye),(ye.type!==D||ye.texture!==xe)&&(pe!==se&&(r.activeTexture(se),pe=se),r.bindTexture(D,xe||Y[D]),ye.type=D,ye.texture=xe)}function w(){const D=oe[pe];D!==void 0&&D.type!==void 0&&(r.bindTexture(D.type,null),D.type=void 0,D.texture=void 0)}function y(){try{r.compressedTexImage2D(...arguments)}catch(D){Le("WebGLState:",D)}}function U(){try{r.compressedTexImage3D(...arguments)}catch(D){Le("WebGLState:",D)}}function W(){try{r.texSubImage2D(...arguments)}catch(D){Le("WebGLState:",D)}}function Z(){try{r.texSubImage3D(...arguments)}catch(D){Le("WebGLState:",D)}}function X(){try{r.compressedTexSubImage2D(...arguments)}catch(D){Le("WebGLState:",D)}}function Re(){try{r.compressedTexSubImage3D(...arguments)}catch(D){Le("WebGLState:",D)}}function ae(){try{r.texStorage2D(...arguments)}catch(D){Le("WebGLState:",D)}}function we(){try{r.texStorage3D(...arguments)}catch(D){Le("WebGLState:",D)}}function Be(){try{r.texImage2D(...arguments)}catch(D){Le("WebGLState:",D)}}function te(){try{r.texImage3D(...arguments)}catch(D){Le("WebGLState:",D)}}function ue(D){ke.equals(D)===!1&&(r.scissor(D.x,D.y,D.z,D.w),ke.copy(D))}function Ce(D){at.equals(D)===!1&&(r.viewport(D.x,D.y,D.z,D.w),at.copy(D))}function Ie(D,xe){let se=c.get(xe);se===void 0&&(se=new WeakMap,c.set(xe,se));let ye=se.get(D);ye===void 0&&(ye=r.getUniformBlockIndex(xe,D.name),se.set(D,ye))}function ce(D,xe){const ye=c.get(xe).get(D);l.get(xe)!==ye&&(r.uniformBlockBinding(xe,ye,D.__bindingPointIndex),l.set(xe,ye))}function $e(){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={},pe=null,oe={},u={},d=new WeakMap,f=[],m=null,_=!1,g=null,p=null,v=null,x=null,M=null,T=null,E=null,C=new Me(0,0,0),P=0,S=!1,b=null,L=null,F=null,B=null,G=null,ke.set(0,0,r.canvas.width,r.canvas.height),at.set(0,0,r.canvas.width,r.canvas.height),s.reset(),a.reset(),o.reset()}return{buffers:{color:s,depth:a,stencil:o},enable:ee,disable:Se,bindFramebuffer:Fe,drawBuffers:Ae,useProgram:Qe,setBlending:$,setMaterial:ne,setFlipSided:Q,setCullFace:ge,setLineWidth:I,setPolygonOffset:De,setScissorTest:ve,activeTexture:Oe,bindTexture:re,unbindTexture:w,compressedTexImage2D:y,compressedTexImage3D:U,texImage2D:Be,texImage3D:te,updateUBOMapping:Ie,uniformBlockBinding:ce,texStorage2D:ae,texStorage3D:we,texSubImage2D:W,texSubImage3D:Z,compressedTexSubImage2D:X,compressedTexSubImage3D:Re,scissor:ue,viewport:Ce,reset:$e}}function xv(r,e,t,n,i,s,a){const o=e.has("WEBGL_multisampled_render_to_texture")?e.get("WEBGL_multisampled_render_to_texture"):null,l=typeof navigator=="undefined"?!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!="undefined"&&new OffscreenCanvas(1,1).getContext("2d")!==null}catch(w){}function m(w,y){return f?new OffscreenCanvas(w,y):Hs("canvas")}function _(w,y,U){let W=1;const Z=re(w);if((Z.width>U||Z.height>U)&&(W=U/Math.max(Z.width,Z.height)),W<1)if(typeof HTMLImageElement!="undefined"&&w instanceof HTMLImageElement||typeof HTMLCanvasElement!="undefined"&&w instanceof HTMLCanvasElement||typeof ImageBitmap!="undefined"&&w instanceof ImageBitmap||typeof VideoFrame!="undefined"&&w instanceof VideoFrame){const X=Math.floor(W*Z.width),Re=Math.floor(W*Z.height);u===void 0&&(u=m(X,Re));const ae=y?m(X,Re):u;return ae.width=X,ae.height=Re,ae.getContext("2d").drawImage(w,0,0,X,Re),de("WebGLRenderer: Texture has been resized from ("+Z.width+"x"+Z.height+") to ("+X+"x"+Re+")."),ae}else return"data"in w&&de("WebGLRenderer: Image in DataTexture is too big ("+Z.width+"x"+Z.height+")."),w;return w}function g(w){return w.generateMipmaps}function p(w){r.generateMipmap(w)}function v(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 x(w,y,U,W,Z=!1){if(w!==null){if(r[w]!==void 0)return r[w];de("WebGLRenderer: Attempt to use non-existing WebGL internal format '"+w+"'")}let X=y;if(y===r.RED&&(U===r.FLOAT&&(X=r.R32F),U===r.HALF_FLOAT&&(X=r.R16F),U===r.UNSIGNED_BYTE&&(X=r.R8)),y===r.RED_INTEGER&&(U===r.UNSIGNED_BYTE&&(X=r.R8UI),U===r.UNSIGNED_SHORT&&(X=r.R16UI),U===r.UNSIGNED_INT&&(X=r.R32UI),U===r.BYTE&&(X=r.R8I),U===r.SHORT&&(X=r.R16I),U===r.INT&&(X=r.R32I)),y===r.RG&&(U===r.FLOAT&&(X=r.RG32F),U===r.HALF_FLOAT&&(X=r.RG16F),U===r.UNSIGNED_BYTE&&(X=r.RG8)),y===r.RG_INTEGER&&(U===r.UNSIGNED_BYTE&&(X=r.RG8UI),U===r.UNSIGNED_SHORT&&(X=r.RG16UI),U===r.UNSIGNED_INT&&(X=r.RG32UI),U===r.BYTE&&(X=r.RG8I),U===r.SHORT&&(X=r.RG16I),U===r.INT&&(X=r.RG32I)),y===r.RGB_INTEGER&&(U===r.UNSIGNED_BYTE&&(X=r.RGB8UI),U===r.UNSIGNED_SHORT&&(X=r.RGB16UI),U===r.UNSIGNED_INT&&(X=r.RGB32UI),U===r.BYTE&&(X=r.RGB8I),U===r.SHORT&&(X=r.RGB16I),U===r.INT&&(X=r.RGB32I)),y===r.RGBA_INTEGER&&(U===r.UNSIGNED_BYTE&&(X=r.RGBA8UI),U===r.UNSIGNED_SHORT&&(X=r.RGBA16UI),U===r.UNSIGNED_INT&&(X=r.RGBA32UI),U===r.BYTE&&(X=r.RGBA8I),U===r.SHORT&&(X=r.RGBA16I),U===r.INT&&(X=r.RGBA32I)),y===r.RGB&&(U===r.UNSIGNED_INT_5_9_9_9_REV&&(X=r.RGB9_E5),U===r.UNSIGNED_INT_10F_11F_11F_REV&&(X=r.R11F_G11F_B10F)),y===r.RGBA){const Re=Z?ra:je.getTransfer(W);U===r.FLOAT&&(X=r.RGBA32F),U===r.HALF_FLOAT&&(X=r.RGBA16F),U===r.UNSIGNED_BYTE&&(X=Re===rt?r.SRGB8_ALPHA8:r.RGBA8),U===r.UNSIGNED_SHORT_4_4_4_4&&(X=r.RGBA4),U===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)&&e.get("EXT_color_buffer_float"),X}function M(w,y){let U;return w?y===null||y===fn||y===ks?U=r.DEPTH24_STENCIL8:y===Ht?U=r.DEPTH32F_STENCIL8:y===Vs&&(U=r.DEPTH24_STENCIL8,de("DepthTexture: 16 bit depth attachment is not supported with stencil. Using 24-bit attachment.")):y===null||y===fn||y===ks?U=r.DEPTH_COMPONENT24:y===Ht?U=r.DEPTH_COMPONENT32F:y===Vs&&(U=r.DEPTH_COMPONENT16),U}function T(w,y){return g(w)===!0||w.isFramebufferTexture&&w.minFilter!==bt&&w.minFilter!==mt?Math.log2(Math.max(y.width,y.height))+1:w.mipmaps!==void 0&&w.mipmaps.length>0?w.mipmaps.length:w.isCompressedTexture&&Array.isArray(w.image)?y.mipmaps.length:1}function E(w){const y=w.target;y.removeEventListener("dispose",E),P(y),y.isVideoTexture&&h.delete(y)}function C(w){const y=w.target;y.removeEventListener("dispose",C),b(y)}function P(w){const y=n.get(w);if(y.__webglInit===void 0)return;const U=w.source,W=d.get(U);if(W){const Z=W[y.__cacheKey];Z.usedTimes--,Z.usedTimes===0&&S(w),Object.keys(W).length===0&&d.delete(U)}n.remove(w)}function S(w){const y=n.get(w);r.deleteTexture(y.__webglTexture);const U=w.source,W=d.get(U);delete W[y.__cacheKey],a.memory.textures--}function b(w){const y=n.get(w);if(w.depthTexture&&(w.depthTexture.dispose(),n.remove(w.depthTexture)),w.isWebGLCubeRenderTarget)for(let W=0;W<6;W++){if(Array.isArray(y.__webglFramebuffer[W]))for(let Z=0;Z<y.__webglFramebuffer[W].length;Z++)r.deleteFramebuffer(y.__webglFramebuffer[W][Z]);else r.deleteFramebuffer(y.__webglFramebuffer[W]);y.__webglDepthbuffer&&r.deleteRenderbuffer(y.__webglDepthbuffer[W])}else{if(Array.isArray(y.__webglFramebuffer))for(let W=0;W<y.__webglFramebuffer.length;W++)r.deleteFramebuffer(y.__webglFramebuffer[W]);else r.deleteFramebuffer(y.__webglFramebuffer);if(y.__webglDepthbuffer&&r.deleteRenderbuffer(y.__webglDepthbuffer),y.__webglMultisampledFramebuffer&&r.deleteFramebuffer(y.__webglMultisampledFramebuffer),y.__webglColorRenderbuffer)for(let W=0;W<y.__webglColorRenderbuffer.length;W++)y.__webglColorRenderbuffer[W]&&r.deleteRenderbuffer(y.__webglColorRenderbuffer[W]);y.__webglDepthRenderbuffer&&r.deleteRenderbuffer(y.__webglDepthRenderbuffer)}const U=w.textures;for(let W=0,Z=U.length;W<Z;W++){const X=n.get(U[W]);X.__webglTexture&&(r.deleteTexture(X.__webglTexture),a.memory.textures--),n.remove(U[W])}n.remove(w)}let L=0;function F(){L=0}function B(){const w=L;return w>=i.maxTextures&&de("WebGLTextures: Trying to use "+w+" texture units while this GPU supports only "+i.maxTextures),L+=1,w}function G(w){const y=[];return y.push(w.wrapS),y.push(w.wrapT),y.push(w.wrapR||0),y.push(w.magFilter),y.push(w.minFilter),y.push(w.anisotropy),y.push(w.internalFormat),y.push(w.format),y.push(w.type),y.push(w.generateMipmaps),y.push(w.premultiplyAlpha),y.push(w.flipY),y.push(w.unpackAlignment),y.push(w.colorSpace),y.join()}function q(w,y){const U=n.get(w);if(w.isVideoTexture&&ve(w),w.isRenderTargetTexture===!1&&w.isExternalTexture!==!0&&w.version>0&&U.__version!==w.version){const W=w.image;if(W===null)de("WebGLRenderer: Texture marked for update but no image data found.");else if(W.complete===!1)de("WebGLRenderer: Texture marked for update but image is incomplete");else{Y(U,w,y);return}}else w.isExternalTexture&&(U.__webglTexture=w.sourceTexture?w.sourceTexture:null);t.bindTexture(r.TEXTURE_2D,U.__webglTexture,r.TEXTURE0+y)}function V(w,y){const U=n.get(w);if(w.isRenderTargetTexture===!1&&w.version>0&&U.__version!==w.version){Y(U,w,y);return}else w.isExternalTexture&&(U.__webglTexture=w.sourceTexture?w.sourceTexture:null);t.bindTexture(r.TEXTURE_2D_ARRAY,U.__webglTexture,r.TEXTURE0+y)}function H(w,y){const U=n.get(w);if(w.isRenderTargetTexture===!1&&w.version>0&&U.__version!==w.version){Y(U,w,y);return}t.bindTexture(r.TEXTURE_3D,U.__webglTexture,r.TEXTURE0+y)}function j(w,y){const U=n.get(w);if(w.isCubeDepthTexture!==!0&&w.version>0&&U.__version!==w.version){ee(U,w,y);return}t.bindTexture(r.TEXTURE_CUBE_MAP,U.__webglTexture,r.TEXTURE0+y)}const pe={[ta]:r.REPEAT,[en]:r.CLAMP_TO_EDGE,[na]:r.MIRRORED_REPEAT},oe={[bt]:r.NEAREST,[su]:r.NEAREST_MIPMAP_NEAREST,[Ls]:r.NEAREST_MIPMAP_LINEAR,[mt]:r.LINEAR,[Yr]:r.LINEAR_MIPMAP_NEAREST,[Un]:r.LINEAR_MIPMAP_LINEAR},he={[Nd]:r.NEVER,[Vd]:r.ALWAYS,[Fd]:r.LESS,[Cl]:r.LEQUAL,[Od]:r.EQUAL,[Rl]:r.GEQUAL,[Bd]:r.GREATER,[zd]:r.NOTEQUAL};function We(w,y){if(y.type===Ht&&e.has("OES_texture_float_linear")===!1&&(y.magFilter===mt||y.magFilter===Yr||y.magFilter===Ls||y.magFilter===Un||y.minFilter===mt||y.minFilter===Yr||y.minFilter===Ls||y.minFilter===Un)&&de("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,pe[y.wrapS]),r.texParameteri(w,r.TEXTURE_WRAP_T,pe[y.wrapT]),(w===r.TEXTURE_3D||w===r.TEXTURE_2D_ARRAY)&&r.texParameteri(w,r.TEXTURE_WRAP_R,pe[y.wrapR]),r.texParameteri(w,r.TEXTURE_MAG_FILTER,oe[y.magFilter]),r.texParameteri(w,r.TEXTURE_MIN_FILTER,oe[y.minFilter]),y.compareFunction&&(r.texParameteri(w,r.TEXTURE_COMPARE_MODE,r.COMPARE_REF_TO_TEXTURE),r.texParameteri(w,r.TEXTURE_COMPARE_FUNC,he[y.compareFunction])),e.has("EXT_texture_filter_anisotropic")===!0){if(y.magFilter===bt||y.minFilter!==Ls&&y.minFilter!==Un||y.type===Ht&&e.has("OES_texture_float_linear")===!1)return;if(y.anisotropy>1||n.get(y).__currentAnisotropy){const U=e.get("EXT_texture_filter_anisotropic");r.texParameterf(w,U.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(y.anisotropy,i.getMaxAnisotropy())),n.get(y).__currentAnisotropy=y.anisotropy}}}function ke(w,y){let U=!1;w.__webglInit===void 0&&(w.__webglInit=!0,y.addEventListener("dispose",E));const W=y.source;let Z=d.get(W);Z===void 0&&(Z={},d.set(W,Z));const X=G(y);if(X!==w.__cacheKey){Z[X]===void 0&&(Z[X]={texture:r.createTexture(),usedTimes:0},a.memory.textures++,U=!0),Z[X].usedTimes++;const Re=Z[w.__cacheKey];Re!==void 0&&(Z[w.__cacheKey].usedTimes--,Re.usedTimes===0&&S(y)),w.__cacheKey=X,w.__webglTexture=Z[X].texture}return U}function at(w,y,U){return Math.floor(Math.floor(w/U)/y)}function ot(w,y,U,W){const X=w.updateRanges;if(X.length===0)t.texSubImage2D(r.TEXTURE_2D,0,0,0,y.width,y.height,U,W,y.data);else{X.sort((te,ue)=>te.start-ue.start);let Re=0;for(let te=1;te<X.length;te++){const ue=X[Re],Ce=X[te],Ie=ue.start+ue.count,ce=at(Ce.start,y.width,4),$e=at(ue.start,y.width,4);Ce.start<=Ie+1&&ce===$e&&at(Ce.start+Ce.count-1,y.width,4)===ce?ue.count=Math.max(ue.count,Ce.start+Ce.count-ue.start):(++Re,X[Re]=Ce)}X.length=Re+1;const ae=r.getParameter(r.UNPACK_ROW_LENGTH),we=r.getParameter(r.UNPACK_SKIP_PIXELS),Be=r.getParameter(r.UNPACK_SKIP_ROWS);r.pixelStorei(r.UNPACK_ROW_LENGTH,y.width);for(let te=0,ue=X.length;te<ue;te++){const Ce=X[te],Ie=Math.floor(Ce.start/4),ce=Math.ceil(Ce.count/4),$e=Ie%y.width,D=Math.floor(Ie/y.width),xe=ce,se=1;r.pixelStorei(r.UNPACK_SKIP_PIXELS,$e),r.pixelStorei(r.UNPACK_SKIP_ROWS,D),t.texSubImage2D(r.TEXTURE_2D,0,$e,D,xe,se,U,W,y.data)}w.clearUpdateRanges(),r.pixelStorei(r.UNPACK_ROW_LENGTH,ae),r.pixelStorei(r.UNPACK_SKIP_PIXELS,we),r.pixelStorei(r.UNPACK_SKIP_ROWS,Be)}}function Y(w,y,U){let W=r.TEXTURE_2D;(y.isDataArrayTexture||y.isCompressedArrayTexture)&&(W=r.TEXTURE_2D_ARRAY),y.isData3DTexture&&(W=r.TEXTURE_3D);const Z=ke(w,y),X=y.source;t.bindTexture(W,w.__webglTexture,r.TEXTURE0+U);const Re=n.get(X);if(X.version!==Re.__version||Z===!0){t.activeTexture(r.TEXTURE0+U);const ae=je.getPrimaries(je.workingColorSpace),we=y.colorSpace===$n?null:je.getPrimaries(y.colorSpace),Be=y.colorSpace===$n||ae===we?r.NONE:r.BROWSER_DEFAULT_WEBGL;r.pixelStorei(r.UNPACK_FLIP_Y_WEBGL,y.flipY),r.pixelStorei(r.UNPACK_PREMULTIPLY_ALPHA_WEBGL,y.premultiplyAlpha),r.pixelStorei(r.UNPACK_ALIGNMENT,y.unpackAlignment),r.pixelStorei(r.UNPACK_COLORSPACE_CONVERSION_WEBGL,Be);let te=_(y.image,!1,i.maxTextureSize);te=Oe(y,te);const ue=s.convert(y.format,y.colorSpace),Ce=s.convert(y.type);let Ie=x(y.internalFormat,ue,Ce,y.colorSpace,y.isVideoTexture);We(W,y);let ce;const $e=y.mipmaps,D=y.isVideoTexture!==!0,xe=Re.__version===void 0||Z===!0,se=X.dataReady,ye=T(y,te);if(y.isDepthTexture)Ie=M(y.format===yi,y.type),xe&&(D?t.texStorage2D(r.TEXTURE_2D,1,Ie,te.width,te.height):t.texImage2D(r.TEXTURE_2D,0,Ie,te.width,te.height,0,ue,Ce,null));else if(y.isDataTexture)if($e.length>0){D&&xe&&t.texStorage2D(r.TEXTURE_2D,ye,Ie,$e[0].width,$e[0].height);for(let ie=0,J=$e.length;ie<J;ie++)ce=$e[ie],D?se&&t.texSubImage2D(r.TEXTURE_2D,ie,0,0,ce.width,ce.height,ue,Ce,ce.data):t.texImage2D(r.TEXTURE_2D,ie,Ie,ce.width,ce.height,0,ue,Ce,ce.data);y.generateMipmaps=!1}else D?(xe&&t.texStorage2D(r.TEXTURE_2D,ye,Ie,te.width,te.height),se&&ot(y,te,ue,Ce)):t.texImage2D(r.TEXTURE_2D,0,Ie,te.width,te.height,0,ue,Ce,te.data);else if(y.isCompressedTexture)if(y.isCompressedArrayTexture){D&&xe&&t.texStorage3D(r.TEXTURE_2D_ARRAY,ye,Ie,$e[0].width,$e[0].height,te.depth);for(let ie=0,J=$e.length;ie<J;ie++)if(ce=$e[ie],y.format!==Wt)if(ue!==null)if(D){if(se)if(y.layerUpdates.size>0){const le=gl(ce.width,ce.height,y.format,y.type);for(const He of y.layerUpdates){const dt=ce.data.subarray(He*le/ce.data.BYTES_PER_ELEMENT,(He+1)*le/ce.data.BYTES_PER_ELEMENT);t.compressedTexSubImage3D(r.TEXTURE_2D_ARRAY,ie,0,0,He,ce.width,ce.height,1,ue,dt)}y.clearLayerUpdates()}else t.compressedTexSubImage3D(r.TEXTURE_2D_ARRAY,ie,0,0,0,ce.width,ce.height,te.depth,ue,ce.data)}else t.compressedTexImage3D(r.TEXTURE_2D_ARRAY,ie,Ie,ce.width,ce.height,te.depth,0,ce.data,0,0);else de("WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()");else D?se&&t.texSubImage3D(r.TEXTURE_2D_ARRAY,ie,0,0,0,ce.width,ce.height,te.depth,ue,Ce,ce.data):t.texImage3D(r.TEXTURE_2D_ARRAY,ie,Ie,ce.width,ce.height,te.depth,0,ue,Ce,ce.data)}else{D&&xe&&t.texStorage2D(r.TEXTURE_2D,ye,Ie,$e[0].width,$e[0].height);for(let ie=0,J=$e.length;ie<J;ie++)ce=$e[ie],y.format!==Wt?ue!==null?D?se&&t.compressedTexSubImage2D(r.TEXTURE_2D,ie,0,0,ce.width,ce.height,ue,ce.data):t.compressedTexImage2D(r.TEXTURE_2D,ie,Ie,ce.width,ce.height,0,ce.data):de("WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()"):D?se&&t.texSubImage2D(r.TEXTURE_2D,ie,0,0,ce.width,ce.height,ue,Ce,ce.data):t.texImage2D(r.TEXTURE_2D,ie,Ie,ce.width,ce.height,0,ue,Ce,ce.data)}else if(y.isDataArrayTexture)if(D){if(xe&&t.texStorage3D(r.TEXTURE_2D_ARRAY,ye,Ie,te.width,te.height,te.depth),se)if(y.layerUpdates.size>0){const ie=gl(te.width,te.height,y.format,y.type);for(const J of y.layerUpdates){const le=te.data.subarray(J*ie/te.data.BYTES_PER_ELEMENT,(J+1)*ie/te.data.BYTES_PER_ELEMENT);t.texSubImage3D(r.TEXTURE_2D_ARRAY,0,0,0,J,te.width,te.height,1,ue,Ce,le)}y.clearLayerUpdates()}else t.texSubImage3D(r.TEXTURE_2D_ARRAY,0,0,0,0,te.width,te.height,te.depth,ue,Ce,te.data)}else t.texImage3D(r.TEXTURE_2D_ARRAY,0,Ie,te.width,te.height,te.depth,0,ue,Ce,te.data);else if(y.isData3DTexture)D?(xe&&t.texStorage3D(r.TEXTURE_3D,ye,Ie,te.width,te.height,te.depth),se&&t.texSubImage3D(r.TEXTURE_3D,0,0,0,0,te.width,te.height,te.depth,ue,Ce,te.data)):t.texImage3D(r.TEXTURE_3D,0,Ie,te.width,te.height,te.depth,0,ue,Ce,te.data);else if(y.isFramebufferTexture){if(xe)if(D)t.texStorage2D(r.TEXTURE_2D,ye,Ie,te.width,te.height);else{let ie=te.width,J=te.height;for(let le=0;le<ye;le++)t.texImage2D(r.TEXTURE_2D,le,Ie,ie,J,0,ue,Ce,null),ie>>=1,J>>=1}}else if($e.length>0){if(D&&xe){const ie=re($e[0]);t.texStorage2D(r.TEXTURE_2D,ye,Ie,ie.width,ie.height)}for(let ie=0,J=$e.length;ie<J;ie++)ce=$e[ie],D?se&&t.texSubImage2D(r.TEXTURE_2D,ie,0,0,ue,Ce,ce):t.texImage2D(r.TEXTURE_2D,ie,Ie,ue,Ce,ce);y.generateMipmaps=!1}else if(D){if(xe){const ie=re(te);t.texStorage2D(r.TEXTURE_2D,ye,Ie,ie.width,ie.height)}se&&t.texSubImage2D(r.TEXTURE_2D,0,0,0,ue,Ce,te)}else t.texImage2D(r.TEXTURE_2D,0,Ie,ue,Ce,te);g(y)&&p(W),Re.__version=X.version,y.onUpdate&&y.onUpdate(y)}w.__version=y.version}function ee(w,y,U){if(y.image.length!==6)return;const W=ke(w,y),Z=y.source;t.bindTexture(r.TEXTURE_CUBE_MAP,w.__webglTexture,r.TEXTURE0+U);const X=n.get(Z);if(Z.version!==X.__version||W===!0){t.activeTexture(r.TEXTURE0+U);const Re=je.getPrimaries(je.workingColorSpace),ae=y.colorSpace===$n?null:je.getPrimaries(y.colorSpace),we=y.colorSpace===$n||Re===ae?r.NONE:r.BROWSER_DEFAULT_WEBGL;r.pixelStorei(r.UNPACK_FLIP_Y_WEBGL,y.flipY),r.pixelStorei(r.UNPACK_PREMULTIPLY_ALPHA_WEBGL,y.premultiplyAlpha),r.pixelStorei(r.UNPACK_ALIGNMENT,y.unpackAlignment),r.pixelStorei(r.UNPACK_COLORSPACE_CONVERSION_WEBGL,we);const Be=y.isCompressedTexture||y.image[0].isCompressedTexture,te=y.image[0]&&y.image[0].isDataTexture,ue=[];for(let J=0;J<6;J++)!Be&&!te?ue[J]=_(y.image[J],!0,i.maxCubemapSize):ue[J]=te?y.image[J].image:y.image[J],ue[J]=Oe(y,ue[J]);const Ce=ue[0],Ie=s.convert(y.format,y.colorSpace),ce=s.convert(y.type),$e=x(y.internalFormat,Ie,ce,y.colorSpace),D=y.isVideoTexture!==!0,xe=X.__version===void 0||W===!0,se=Z.dataReady;let ye=T(y,Ce);We(r.TEXTURE_CUBE_MAP,y);let ie;if(Be){D&&xe&&t.texStorage2D(r.TEXTURE_CUBE_MAP,ye,$e,Ce.width,Ce.height);for(let J=0;J<6;J++){ie=ue[J].mipmaps;for(let le=0;le<ie.length;le++){const He=ie[le];y.format!==Wt?Ie!==null?D?se&&t.compressedTexSubImage2D(r.TEXTURE_CUBE_MAP_POSITIVE_X+J,le,0,0,He.width,He.height,Ie,He.data):t.compressedTexImage2D(r.TEXTURE_CUBE_MAP_POSITIVE_X+J,le,$e,He.width,He.height,0,He.data):de("WebGLRenderer: Attempt to load unsupported compressed texture format in .setTextureCube()"):D?se&&t.texSubImage2D(r.TEXTURE_CUBE_MAP_POSITIVE_X+J,le,0,0,He.width,He.height,Ie,ce,He.data):t.texImage2D(r.TEXTURE_CUBE_MAP_POSITIVE_X+J,le,$e,He.width,He.height,0,Ie,ce,He.data)}}}else{if(ie=y.mipmaps,D&&xe){ie.length>0&&ye++;const J=re(ue[0]);t.texStorage2D(r.TEXTURE_CUBE_MAP,ye,$e,J.width,J.height)}for(let J=0;J<6;J++)if(te){D?se&&t.texSubImage2D(r.TEXTURE_CUBE_MAP_POSITIVE_X+J,0,0,0,ue[J].width,ue[J].height,Ie,ce,ue[J].data):t.texImage2D(r.TEXTURE_CUBE_MAP_POSITIVE_X+J,0,$e,ue[J].width,ue[J].height,0,Ie,ce,ue[J].data);for(let le=0;le<ie.length;le++){const dt=ie[le].image[J].image;D?se&&t.texSubImage2D(r.TEXTURE_CUBE_MAP_POSITIVE_X+J,le+1,0,0,dt.width,dt.height,Ie,ce,dt.data):t.texImage2D(r.TEXTURE_CUBE_MAP_POSITIVE_X+J,le+1,$e,dt.width,dt.height,0,Ie,ce,dt.data)}}else{D?se&&t.texSubImage2D(r.TEXTURE_CUBE_MAP_POSITIVE_X+J,0,0,0,Ie,ce,ue[J]):t.texImage2D(r.TEXTURE_CUBE_MAP_POSITIVE_X+J,0,$e,Ie,ce,ue[J]);for(let le=0;le<ie.length;le++){const He=ie[le];D?se&&t.texSubImage2D(r.TEXTURE_CUBE_MAP_POSITIVE_X+J,le+1,0,0,Ie,ce,He.image[J]):t.texImage2D(r.TEXTURE_CUBE_MAP_POSITIVE_X+J,le+1,$e,Ie,ce,He.image[J])}}}g(y)&&p(r.TEXTURE_CUBE_MAP),X.__version=Z.version,y.onUpdate&&y.onUpdate(y)}w.__version=y.version}function Se(w,y,U,W,Z,X){const Re=s.convert(U.format,U.colorSpace),ae=s.convert(U.type),we=x(U.internalFormat,Re,ae,U.colorSpace),Be=n.get(y),te=n.get(U);if(te.__renderTarget=y,!Be.__hasExternalTextures){const ue=Math.max(1,y.width>>X),Ce=Math.max(1,y.height>>X);Z===r.TEXTURE_3D||Z===r.TEXTURE_2D_ARRAY?t.texImage3D(Z,X,we,ue,Ce,y.depth,0,Re,ae,null):t.texImage2D(Z,X,we,ue,Ce,0,Re,ae,null)}t.bindFramebuffer(r.FRAMEBUFFER,w),De(y)?o.framebufferTexture2DMultisampleEXT(r.FRAMEBUFFER,W,Z,te.__webglTexture,0,I(y)):(Z===r.TEXTURE_2D||Z>=r.TEXTURE_CUBE_MAP_POSITIVE_X&&Z<=r.TEXTURE_CUBE_MAP_NEGATIVE_Z)&&r.framebufferTexture2D(r.FRAMEBUFFER,W,Z,te.__webglTexture,X),t.bindFramebuffer(r.FRAMEBUFFER,null)}function Fe(w,y,U){if(r.bindRenderbuffer(r.RENDERBUFFER,w),y.depthBuffer){const W=y.depthTexture,Z=W&&W.isDepthTexture?W.type:null,X=M(y.stencilBuffer,Z),Re=y.stencilBuffer?r.DEPTH_STENCIL_ATTACHMENT:r.DEPTH_ATTACHMENT;De(y)?o.renderbufferStorageMultisampleEXT(r.RENDERBUFFER,I(y),X,y.width,y.height):U?r.renderbufferStorageMultisample(r.RENDERBUFFER,I(y),X,y.width,y.height):r.renderbufferStorage(r.RENDERBUFFER,X,y.width,y.height),r.framebufferRenderbuffer(r.FRAMEBUFFER,Re,r.RENDERBUFFER,w)}else{const W=y.textures;for(let Z=0;Z<W.length;Z++){const X=W[Z],Re=s.convert(X.format,X.colorSpace),ae=s.convert(X.type),we=x(X.internalFormat,Re,ae,X.colorSpace);De(y)?o.renderbufferStorageMultisampleEXT(r.RENDERBUFFER,I(y),we,y.width,y.height):U?r.renderbufferStorageMultisample(r.RENDERBUFFER,I(y),we,y.width,y.height):r.renderbufferStorage(r.RENDERBUFFER,we,y.width,y.height)}}r.bindRenderbuffer(r.RENDERBUFFER,null)}function Ae(w,y,U){const W=y.isWebGLCubeRenderTarget===!0;if(t.bindFramebuffer(r.FRAMEBUFFER,w),!(y.depthTexture&&y.depthTexture.isDepthTexture))throw new Error("renderTarget.depthTexture must be an instance of THREE.DepthTexture");const Z=n.get(y.depthTexture);if(Z.__renderTarget=y,(!Z.__webglTexture||y.depthTexture.image.width!==y.width||y.depthTexture.image.height!==y.height)&&(y.depthTexture.image.width=y.width,y.depthTexture.image.height=y.height,y.depthTexture.needsUpdate=!0),W){if(Z.__webglInit===void 0&&(Z.__webglInit=!0,y.depthTexture.addEventListener("dispose",E)),Z.__webglTexture===void 0){Z.__webglTexture=r.createTexture(),t.bindTexture(r.TEXTURE_CUBE_MAP,Z.__webglTexture),We(r.TEXTURE_CUBE_MAP,y.depthTexture);const Be=s.convert(y.depthTexture.format),te=s.convert(y.depthTexture.type);let ue;y.depthTexture.format===Vn?ue=r.DEPTH_COMPONENT24:y.depthTexture.format===yi&&(ue=r.DEPTH24_STENCIL8);for(let Ce=0;Ce<6;Ce++)r.texImage2D(r.TEXTURE_CUBE_MAP_POSITIVE_X+Ce,0,ue,y.width,y.height,0,Be,te,null)}}else q(y.depthTexture,0);const X=Z.__webglTexture,Re=I(y),ae=W?r.TEXTURE_CUBE_MAP_POSITIVE_X+U:r.TEXTURE_2D,we=y.depthTexture.format===yi?r.DEPTH_STENCIL_ATTACHMENT:r.DEPTH_ATTACHMENT;if(y.depthTexture.format===Vn)De(y)?o.framebufferTexture2DMultisampleEXT(r.FRAMEBUFFER,we,ae,X,0,Re):r.framebufferTexture2D(r.FRAMEBUFFER,we,ae,X,0);else if(y.depthTexture.format===yi)De(y)?o.framebufferTexture2DMultisampleEXT(r.FRAMEBUFFER,we,ae,X,0,Re):r.framebufferTexture2D(r.FRAMEBUFFER,we,ae,X,0);else throw new Error("Unknown depthTexture format")}function Qe(w){const y=n.get(w),U=w.isWebGLCubeRenderTarget===!0;if(y.__boundDepthTexture!==w.depthTexture){const W=w.depthTexture;if(y.__depthDisposeCallback&&y.__depthDisposeCallback(),W){const Z=()=>{delete y.__boundDepthTexture,delete y.__depthDisposeCallback,W.removeEventListener("dispose",Z)};W.addEventListener("dispose",Z),y.__depthDisposeCallback=Z}y.__boundDepthTexture=W}if(w.depthTexture&&!y.__autoAllocateDepthBuffer)if(U)for(let W=0;W<6;W++)Ae(y.__webglFramebuffer[W],w,W);else{const W=w.texture.mipmaps;W&&W.length>0?Ae(y.__webglFramebuffer[0],w,0):Ae(y.__webglFramebuffer,w,0)}else if(U){y.__webglDepthbuffer=[];for(let W=0;W<6;W++)if(t.bindFramebuffer(r.FRAMEBUFFER,y.__webglFramebuffer[W]),y.__webglDepthbuffer[W]===void 0)y.__webglDepthbuffer[W]=r.createRenderbuffer(),Fe(y.__webglDepthbuffer[W],w,!1);else{const Z=w.stencilBuffer?r.DEPTH_STENCIL_ATTACHMENT:r.DEPTH_ATTACHMENT,X=y.__webglDepthbuffer[W];r.bindRenderbuffer(r.RENDERBUFFER,X),r.framebufferRenderbuffer(r.FRAMEBUFFER,Z,r.RENDERBUFFER,X)}}else{const W=w.texture.mipmaps;if(W&&W.length>0?t.bindFramebuffer(r.FRAMEBUFFER,y.__webglFramebuffer[0]):t.bindFramebuffer(r.FRAMEBUFFER,y.__webglFramebuffer),y.__webglDepthbuffer===void 0)y.__webglDepthbuffer=r.createRenderbuffer(),Fe(y.__webglDepthbuffer,w,!1);else{const Z=w.stencilBuffer?r.DEPTH_STENCIL_ATTACHMENT:r.DEPTH_ATTACHMENT,X=y.__webglDepthbuffer;r.bindRenderbuffer(r.RENDERBUFFER,X),r.framebufferRenderbuffer(r.FRAMEBUFFER,Z,r.RENDERBUFFER,X)}}t.bindFramebuffer(r.FRAMEBUFFER,null)}function lt(w,y,U){const W=n.get(w);y!==void 0&&Se(W.__webglFramebuffer,w,w.texture,r.COLOR_ATTACHMENT0,r.TEXTURE_2D,0),U!==void 0&&Qe(w)}function Xe(w){const y=w.texture,U=n.get(w),W=n.get(y);w.addEventListener("dispose",C);const Z=w.textures,X=w.isWebGLCubeRenderTarget===!0,Re=Z.length>1;if(Re||(W.__webglTexture===void 0&&(W.__webglTexture=r.createTexture()),W.__version=y.version,a.memory.textures++),X){U.__webglFramebuffer=[];for(let ae=0;ae<6;ae++)if(y.mipmaps&&y.mipmaps.length>0){U.__webglFramebuffer[ae]=[];for(let we=0;we<y.mipmaps.length;we++)U.__webglFramebuffer[ae][we]=r.createFramebuffer()}else U.__webglFramebuffer[ae]=r.createFramebuffer()}else{if(y.mipmaps&&y.mipmaps.length>0){U.__webglFramebuffer=[];for(let ae=0;ae<y.mipmaps.length;ae++)U.__webglFramebuffer[ae]=r.createFramebuffer()}else U.__webglFramebuffer=r.createFramebuffer();if(Re)for(let ae=0,we=Z.length;ae<we;ae++){const Be=n.get(Z[ae]);Be.__webglTexture===void 0&&(Be.__webglTexture=r.createTexture(),a.memory.textures++)}if(w.samples>0&&De(w)===!1){U.__webglMultisampledFramebuffer=r.createFramebuffer(),U.__webglColorRenderbuffer=[],t.bindFramebuffer(r.FRAMEBUFFER,U.__webglMultisampledFramebuffer);for(let ae=0;ae<Z.length;ae++){const we=Z[ae];U.__webglColorRenderbuffer[ae]=r.createRenderbuffer(),r.bindRenderbuffer(r.RENDERBUFFER,U.__webglColorRenderbuffer[ae]);const Be=s.convert(we.format,we.colorSpace),te=s.convert(we.type),ue=x(we.internalFormat,Be,te,we.colorSpace,w.isXRRenderTarget===!0),Ce=I(w);r.renderbufferStorageMultisample(r.RENDERBUFFER,Ce,ue,w.width,w.height),r.framebufferRenderbuffer(r.FRAMEBUFFER,r.COLOR_ATTACHMENT0+ae,r.RENDERBUFFER,U.__webglColorRenderbuffer[ae])}r.bindRenderbuffer(r.RENDERBUFFER,null),w.depthBuffer&&(U.__webglDepthRenderbuffer=r.createRenderbuffer(),Fe(U.__webglDepthRenderbuffer,w,!0)),t.bindFramebuffer(r.FRAMEBUFFER,null)}}if(X){t.bindTexture(r.TEXTURE_CUBE_MAP,W.__webglTexture),We(r.TEXTURE_CUBE_MAP,y);for(let ae=0;ae<6;ae++)if(y.mipmaps&&y.mipmaps.length>0)for(let we=0;we<y.mipmaps.length;we++)Se(U.__webglFramebuffer[ae][we],w,y,r.COLOR_ATTACHMENT0,r.TEXTURE_CUBE_MAP_POSITIVE_X+ae,we);else Se(U.__webglFramebuffer[ae],w,y,r.COLOR_ATTACHMENT0,r.TEXTURE_CUBE_MAP_POSITIVE_X+ae,0);g(y)&&p(r.TEXTURE_CUBE_MAP),t.unbindTexture()}else if(Re){for(let ae=0,we=Z.length;ae<we;ae++){const Be=Z[ae],te=n.get(Be);let ue=r.TEXTURE_2D;(w.isWebGL3DRenderTarget||w.isWebGLArrayRenderTarget)&&(ue=w.isWebGL3DRenderTarget?r.TEXTURE_3D:r.TEXTURE_2D_ARRAY),t.bindTexture(ue,te.__webglTexture),We(ue,Be),Se(U.__webglFramebuffer,w,Be,r.COLOR_ATTACHMENT0+ae,ue,0),g(Be)&&p(ue)}t.unbindTexture()}else{let ae=r.TEXTURE_2D;if((w.isWebGL3DRenderTarget||w.isWebGLArrayRenderTarget)&&(ae=w.isWebGL3DRenderTarget?r.TEXTURE_3D:r.TEXTURE_2D_ARRAY),t.bindTexture(ae,W.__webglTexture),We(ae,y),y.mipmaps&&y.mipmaps.length>0)for(let we=0;we<y.mipmaps.length;we++)Se(U.__webglFramebuffer[we],w,y,r.COLOR_ATTACHMENT0,ae,we);else Se(U.__webglFramebuffer,w,y,r.COLOR_ATTACHMENT0,ae,0);g(y)&&p(ae),t.unbindTexture()}w.depthBuffer&&Qe(w)}function $(w){const y=w.textures;for(let U=0,W=y.length;U<W;U++){const Z=y[U];if(g(Z)){const X=v(w),Re=n.get(Z).__webglTexture;t.bindTexture(X,Re),p(X),t.unbindTexture()}}}const ne=[],Q=[];function ge(w){if(w.samples>0){if(De(w)===!1){const y=w.textures,U=w.width,W=w.height;let Z=r.COLOR_BUFFER_BIT;const X=w.stencilBuffer?r.DEPTH_STENCIL_ATTACHMENT:r.DEPTH_ATTACHMENT,Re=n.get(w),ae=y.length>1;if(ae)for(let Be=0;Be<y.length;Be++)t.bindFramebuffer(r.FRAMEBUFFER,Re.__webglMultisampledFramebuffer),r.framebufferRenderbuffer(r.FRAMEBUFFER,r.COLOR_ATTACHMENT0+Be,r.RENDERBUFFER,null),t.bindFramebuffer(r.FRAMEBUFFER,Re.__webglFramebuffer),r.framebufferTexture2D(r.DRAW_FRAMEBUFFER,r.COLOR_ATTACHMENT0+Be,r.TEXTURE_2D,null,0);t.bindFramebuffer(r.READ_FRAMEBUFFER,Re.__webglMultisampledFramebuffer);const we=w.texture.mipmaps;we&&we.length>0?t.bindFramebuffer(r.DRAW_FRAMEBUFFER,Re.__webglFramebuffer[0]):t.bindFramebuffer(r.DRAW_FRAMEBUFFER,Re.__webglFramebuffer);for(let Be=0;Be<y.length;Be++){if(w.resolveDepthBuffer&&(w.depthBuffer&&(Z|=r.DEPTH_BUFFER_BIT),w.stencilBuffer&&w.resolveStencilBuffer&&(Z|=r.STENCIL_BUFFER_BIT)),ae){r.framebufferRenderbuffer(r.READ_FRAMEBUFFER,r.COLOR_ATTACHMENT0,r.RENDERBUFFER,Re.__webglColorRenderbuffer[Be]);const te=n.get(y[Be]).__webglTexture;r.framebufferTexture2D(r.DRAW_FRAMEBUFFER,r.COLOR_ATTACHMENT0,r.TEXTURE_2D,te,0)}r.blitFramebuffer(0,0,U,W,0,0,U,W,Z,r.NEAREST),l===!0&&(ne.length=0,Q.length=0,ne.push(r.COLOR_ATTACHMENT0+Be),w.depthBuffer&&w.resolveDepthBuffer===!1&&(ne.push(X),Q.push(X),r.invalidateFramebuffer(r.DRAW_FRAMEBUFFER,Q)),r.invalidateFramebuffer(r.READ_FRAMEBUFFER,ne))}if(t.bindFramebuffer(r.READ_FRAMEBUFFER,null),t.bindFramebuffer(r.DRAW_FRAMEBUFFER,null),ae)for(let Be=0;Be<y.length;Be++){t.bindFramebuffer(r.FRAMEBUFFER,Re.__webglMultisampledFramebuffer),r.framebufferRenderbuffer(r.FRAMEBUFFER,r.COLOR_ATTACHMENT0+Be,r.RENDERBUFFER,Re.__webglColorRenderbuffer[Be]);const te=n.get(y[Be]).__webglTexture;t.bindFramebuffer(r.FRAMEBUFFER,Re.__webglFramebuffer),r.framebufferTexture2D(r.DRAW_FRAMEBUFFER,r.COLOR_ATTACHMENT0+Be,r.TEXTURE_2D,te,0)}t.bindFramebuffer(r.DRAW_FRAMEBUFFER,Re.__webglMultisampledFramebuffer)}else if(w.depthBuffer&&w.resolveDepthBuffer===!1&&l){const y=w.stencilBuffer?r.DEPTH_STENCIL_ATTACHMENT:r.DEPTH_ATTACHMENT;r.invalidateFramebuffer(r.DRAW_FRAMEBUFFER,[y])}}}function I(w){return Math.min(i.maxSamples,w.samples)}function De(w){const y=n.get(w);return w.samples>0&&e.has("WEBGL_multisampled_render_to_texture")===!0&&y.__useRenderToTexture!==!1}function ve(w){const y=a.render.frame;h.get(w)!==y&&(h.set(w,y),w.update())}function Oe(w,y){const U=w.colorSpace,W=w.format,Z=w.type;return w.isCompressedTexture===!0||w.isVideoTexture===!0||U!==ls&&U!==$n&&(je.getTransfer(U)===rt?(W!==Wt||Z!==Qt)&&de("WebGLTextures: sRGB encoded textures have to use RGBAFormat and UnsignedByteType."):Le("WebGLTextures: Unsupported texture color space:",U)),y}function re(w){return typeof HTMLImageElement!="undefined"&&w instanceof HTMLImageElement?(c.width=w.naturalWidth||w.width,c.height=w.naturalHeight||w.height):typeof VideoFrame!="undefined"&&w instanceof VideoFrame?(c.width=w.displayWidth,c.height=w.displayHeight):(c.width=w.width,c.height=w.height),c}this.allocateTextureUnit=B,this.resetTextureUnits=F,this.setTexture2D=q,this.setTexture2DArray=V,this.setTexture3D=H,this.setTextureCube=j,this.rebindTextures=lt,this.setupRenderTarget=Xe,this.updateRenderTargetMipmap=$,this.updateMultisampleRenderTarget=ge,this.setupDepthRenderbuffer=Qe,this.setupFrameBufferTexture=Se,this.useMultisampledRTT=De,this.isReversedDepthBuffer=function(){return t.buffers.depth.getReversed()}}function vv(r,e){function t(n,i=$n){let s;const a=je.getTransfer(i);if(n===Qt)return r.UNSIGNED_BYTE;if(n===Sl)return r.UNSIGNED_SHORT_4_4_4_4;if(n===bl)return r.UNSIGNED_SHORT_5_5_5_1;if(n===ou)return r.UNSIGNED_INT_5_9_9_9_REV;if(n===lu)return r.UNSIGNED_INT_10F_11F_11F_REV;if(n===ru)return r.BYTE;if(n===au)return r.SHORT;if(n===Vs)return r.UNSIGNED_SHORT;if(n===Ml)return r.INT;if(n===fn)return r.UNSIGNED_INT;if(n===Ht)return r.FLOAT;if(n===zn)return r.HALF_FLOAT;if(n===cu)return r.ALPHA;if(n===hu)return r.RGB;if(n===Wt)return r.RGBA;if(n===Vn)return r.DEPTH_COMPONENT;if(n===yi)return r.DEPTH_STENCIL;if(n===Al)return r.RED;if(n===ga)return r.RED_INTEGER;if(n===os)return r.RG;if(n===Tl)return r.RG_INTEGER;if(n===El)return r.RGBA_INTEGER;if(n===Zr||n===Jr||n===$r||n===Kr)if(a===rt)if(s=e.get("WEBGL_compressed_texture_s3tc_srgb"),s!==null){if(n===Zr)return s.COMPRESSED_SRGB_S3TC_DXT1_EXT;if(n===Jr)return s.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT;if(n===$r)return s.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT;if(n===Kr)return s.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT}else return null;else if(s=e.get("WEBGL_compressed_texture_s3tc"),s!==null){if(n===Zr)return s.COMPRESSED_RGB_S3TC_DXT1_EXT;if(n===Jr)return s.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(n===$r)return s.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(n===Kr)return s.COMPRESSED_RGBA_S3TC_DXT5_EXT}else return null;if(n===Po||n===Lo||n===Do||n===Uo)if(s=e.get("WEBGL_compressed_texture_pvrtc"),s!==null){if(n===Po)return s.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(n===Lo)return s.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(n===Do)return s.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(n===Uo)return s.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}else return null;if(n===No||n===Fo||n===Oo||n===Bo||n===zo||n===Vo||n===ko)if(s=e.get("WEBGL_compressed_texture_etc"),s!==null){if(n===No||n===Fo)return a===rt?s.COMPRESSED_SRGB8_ETC2:s.COMPRESSED_RGB8_ETC2;if(n===Oo)return a===rt?s.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC:s.COMPRESSED_RGBA8_ETC2_EAC;if(n===Bo)return s.COMPRESSED_R11_EAC;if(n===zo)return s.COMPRESSED_SIGNED_R11_EAC;if(n===Vo)return s.COMPRESSED_RG11_EAC;if(n===ko)return s.COMPRESSED_SIGNED_RG11_EAC}else return null;if(n===Go||n===Ho||n===Wo||n===Xo||n===qo||n===Yo||n===Zo||n===Jo||n===$o||n===Ko||n===Qo||n===jo||n===el||n===tl)if(s=e.get("WEBGL_compressed_texture_astc"),s!==null){if(n===Go)return a===rt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR:s.COMPRESSED_RGBA_ASTC_4x4_KHR;if(n===Ho)return a===rt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR:s.COMPRESSED_RGBA_ASTC_5x4_KHR;if(n===Wo)return a===rt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR:s.COMPRESSED_RGBA_ASTC_5x5_KHR;if(n===Xo)return a===rt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR:s.COMPRESSED_RGBA_ASTC_6x5_KHR;if(n===qo)return a===rt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR:s.COMPRESSED_RGBA_ASTC_6x6_KHR;if(n===Yo)return a===rt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR:s.COMPRESSED_RGBA_ASTC_8x5_KHR;if(n===Zo)return a===rt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR:s.COMPRESSED_RGBA_ASTC_8x6_KHR;if(n===Jo)return a===rt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR:s.COMPRESSED_RGBA_ASTC_8x8_KHR;if(n===$o)return a===rt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR:s.COMPRESSED_RGBA_ASTC_10x5_KHR;if(n===Ko)return a===rt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR:s.COMPRESSED_RGBA_ASTC_10x6_KHR;if(n===Qo)return a===rt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR:s.COMPRESSED_RGBA_ASTC_10x8_KHR;if(n===jo)return a===rt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR:s.COMPRESSED_RGBA_ASTC_10x10_KHR;if(n===el)return a===rt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR:s.COMPRESSED_RGBA_ASTC_12x10_KHR;if(n===tl)return a===rt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR:s.COMPRESSED_RGBA_ASTC_12x12_KHR}else return null;if(n===nl||n===il||n===sl)if(s=e.get("EXT_texture_compression_bptc"),s!==null){if(n===nl)return a===rt?s.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT:s.COMPRESSED_RGBA_BPTC_UNORM_EXT;if(n===il)return s.COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT;if(n===sl)return s.COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT}else return null;if(n===rl||n===al||n===ol||n===ll)if(s=e.get("EXT_texture_compression_rgtc"),s!==null){if(n===rl)return s.COMPRESSED_RED_RGTC1_EXT;if(n===al)return s.COMPRESSED_SIGNED_RED_RGTC1_EXT;if(n===ol)return s.COMPRESSED_RED_GREEN_RGTC2_EXT;if(n===ll)return s.COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT}else return null;return n===ks?r.UNSIGNED_INT_24_8:r[n]!==void 0?r[n]:null}return{convert:t}}const yv=`
3996void main() {
3997
3998	gl_Position = vec4( position, 1.0 );
3999
4000}`,Mv=`
4001uniform sampler2DArray depthColor;
4002uniform float depthWidth;
4003uniform float depthHeight;
4004
4005void main() {
4006
4007	vec2 coord = vec2( gl_FragCoord.x / depthWidth, gl_FragCoord.y / depthHeight );
4008
4009	if ( coord.x >= 1.0 ) {
4010
4011		gl_FragDepth = texture( depthColor, vec3( coord.x - 1.0, coord.y, 1 ) ).r;
4012
4013	} else {
4014
4015		gl_FragDepth = texture( depthColor, vec3( coord.x, coord.y, 0 ) ).r;
4016
4017	}
4018
4019}`;class Sv{constructor(){this.texture=null,this.mesh=null,this.depthNear=0,this.depthFar=0}init(e,t){if(this.texture===null){const n=new Au(e.texture);(e.depthNear!==t.depthNear||e.depthFar!==t.depthFar)&&(this.depthNear=e.depthNear,this.depthFar=e.depthFar),this.texture=n}}getMesh(e){if(this.texture!==null&&this.mesh===null){const t=e.cameras[0].viewport,n=new pn({vertexShader:yv,fragmentShader:Mv,uniforms:{depthColor:{value:this.texture},depthWidth:{value:t.z},depthHeight:{value:t.w}}});this.mesh=new At(new js(20,20),n)}return this.mesh}reset(){this.texture=null,this.mesh=null}getDepthTexture(){return this.texture}}class bv extends kn{constructor(e,t){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 _=typeof XRWebGLBinding!="undefined",g=new Sv,p={},v=t.getContextAttributes();let x=null,M=null;const T=[],E=[],C=new K;let P=null;const S=new Pt;S.viewport=new pt;const b=new Pt;b.viewport=new pt;const L=[S,b],F=new cm;let B=null,G=null;this.cameraAutoUpdate=!0,this.enabled=!1,this.isPresenting=!1,this.getController=function(Y){let ee=T[Y];return ee===void 0&&(ee=new Ka,T[Y]=ee),ee.getTargetRaySpace()},this.getControllerGrip=function(Y){let ee=T[Y];return ee===void 0&&(ee=new Ka,T[Y]=ee),ee.getGripSpace()},this.getHand=function(Y){let ee=T[Y];return ee===void 0&&(ee=new Ka,T[Y]=ee),ee.getHandSpace()};function q(Y){const ee=E.indexOf(Y.inputSource);if(ee===-1)return;const Se=T[ee];Se!==void 0&&(Se.update(Y.inputSource,Y.frame,c||a),Se.dispatchEvent({type:Y.type,data:Y.inputSource}))}function V(){i.removeEventListener("select",q),i.removeEventListener("selectstart",q),i.removeEventListener("selectend",q),i.removeEventListener("squeeze",q),i.removeEventListener("squeezestart",q),i.removeEventListener("squeezeend",q),i.removeEventListener("end",V),i.removeEventListener("inputsourceschange",H);for(let Y=0;Y<T.length;Y++){const ee=E[Y];ee!==null&&(E[Y]=null,T[Y].disconnect(ee))}B=null,G=null,g.reset();for(const Y in p)delete p[Y];e.setRenderTarget(x),f=null,d=null,u=null,i=null,M=null,ot.stop(),n.isPresenting=!1,e.setPixelRatio(P),e.setSize(C.width,C.height,!1),n.dispatchEvent({type:"sessionend"})}this.setFramebufferScaleFactor=function(Y){s=Y,n.isPresenting===!0&&de("WebXRManager: Cannot change framebuffer scale while presenting.")},this.setReferenceSpaceType=function(Y){o=Y,n.isPresenting===!0&&de("WebXRManager: Cannot change reference space type while presenting.")},this.getReferenceSpace=function(){return c||a},this.setReferenceSpace=function(Y){c=Y},this.getBaseLayer=function(){return d!==null?d:f},this.getBinding=function(){return u===null&&_&&(u=new XRWebGLBinding(i,t)),u},this.getFrame=function(){return m},this.getSession=function(){return i},this.setSession=async function(Y){if(i=Y,i!==null){if(x=e.getRenderTarget(),i.addEventListener("select",q),i.addEventListener("selectstart",q),i.addEventListener("selectend",q),i.addEventListener("squeeze",q),i.addEventListener("squeezestart",q),i.addEventListener("squeezeend",q),i.addEventListener("end",V),i.addEventListener("inputsourceschange",H),v.xrCompatible!==!0&&await t.makeXRCompatible(),P=e.getPixelRatio(),e.getSize(C),_&&"createProjectionLayer"in XRWebGLBinding.prototype){let Se=null,Fe=null,Ae=null;v.depth&&(Ae=v.stencil?t.DEPTH24_STENCIL8:t.DEPTH_COMPONENT24,Se=v.stencil?yi:Vn,Fe=v.stencil?ks:fn);const Qe={colorFormat:t.RGBA8,depthFormat:Ae,scaleFactor:s};u=this.getBinding(),d=u.createProjectionLayer(Qe),i.updateRenderState({layers:[d]}),e.setPixelRatio(1),e.setSize(d.textureWidth,d.textureHeight,!1),M=new ln(d.textureWidth,d.textureHeight,{format:Wt,type:Qt,depthTexture:new qs(d.textureWidth,d.textureHeight,Fe,void 0,void 0,void 0,void 0,void 0,void 0,Se),stencilBuffer:v.stencil,colorSpace:e.outputColorSpace,samples:v.antialias?4:0,resolveDepthBuffer:d.ignoreDepthValues===!1,resolveStencilBuffer:d.ignoreDepthValues===!1})}else{const Se={antialias:v.antialias,alpha:!0,depth:v.depth,stencil:v.stencil,framebufferScaleFactor:s};f=new XRWebGLLayer(i,t,Se),i.updateRenderState({baseLayer:f}),e.setPixelRatio(1),e.setSize(f.framebufferWidth,f.framebufferHeight,!1),M=new ln(f.framebufferWidth,f.framebufferHeight,{format:Wt,type:Qt,colorSpace:e.outputColorSpace,stencilBuffer:v.stencil,resolveDepthBuffer:f.ignoreDepthValues===!1,resolveStencilBuffer:f.ignoreDepthValues===!1})}M.isXRRenderTarget=!0,this.setFoveation(l),c=null,a=await i.requestReferenceSpace(o),ot.setContext(i),ot.start(),n.isPresenting=!0,n.dispatchEvent({type:"sessionstart"})}},this.getEnvironmentBlendMode=function(){if(i!==null)return i.environmentBlendMode},this.getDepthTexture=function(){return g.getDepthTexture()};function H(Y){for(let ee=0;ee<Y.removed.length;ee++){const Se=Y.removed[ee],Fe=E.indexOf(Se);Fe>=0&&(E[Fe]=null,T[Fe].disconnect(Se))}for(let ee=0;ee<Y.added.length;ee++){const Se=Y.added[ee];let Fe=E.indexOf(Se);if(Fe===-1){for(let Qe=0;Qe<T.length;Qe++)if(Qe>=E.length){E.push(Se),Fe=Qe;break}else if(E[Qe]===null){E[Qe]=Se,Fe=Qe;break}if(Fe===-1)break}const Ae=T[Fe];Ae&&Ae.connect(Se)}}const j=new R,pe=new R;function oe(Y,ee,Se){j.setFromMatrixPosition(ee.matrixWorld),pe.setFromMatrixPosition(Se.matrixWorld);const Fe=j.distanceTo(pe),Ae=ee.projectionMatrix.elements,Qe=Se.projectionMatrix.elements,lt=Ae[14]/(Ae[10]-1),Xe=Ae[14]/(Ae[10]+1),$=(Ae[9]+1)/Ae[5],ne=(Ae[9]-1)/Ae[5],Q=(Ae[8]-1)/Ae[0],ge=(Qe[8]+1)/Qe[0],I=lt*Q,De=lt*ge,ve=Fe/(-Q+ge),Oe=ve*-Q;if(ee.matrixWorld.decompose(Y.position,Y.quaternion,Y.scale),Y.translateX(Oe),Y.translateZ(ve),Y.matrixWorld.compose(Y.position,Y.quaternion,Y.scale),Y.matrixWorldInverse.copy(Y.matrixWorld).invert(),Ae[10]===-1)Y.projectionMatrix.copy(ee.projectionMatrix),Y.projectionMatrixInverse.copy(ee.projectionMatrixInverse);else{const re=lt+ve,w=Xe+ve,y=I-Oe,U=De+(Fe-Oe),W=$*Xe/w*re,Z=ne*Xe/w*re;Y.projectionMatrix.makePerspective(y,U,W,Z,re,w),Y.projectionMatrixInverse.copy(Y.projectionMatrix).invert()}}function he(Y,ee){ee===null?Y.matrixWorld.copy(Y.matrix):Y.matrixWorld.multiplyMatrices(ee.matrixWorld,Y.matrix),Y.matrixWorldInverse.copy(Y.matrixWorld).invert()}this.updateCamera=function(Y){if(i===null)return;let ee=Y.near,Se=Y.far;g.texture!==null&&(g.depthNear>0&&(ee=g.depthNear),g.depthFar>0&&(Se=g.depthFar)),F.near=b.near=S.near=ee,F.far=b.far=S.far=Se,(B!==F.near||G!==F.far)&&(i.updateRenderState({depthNear:F.near,depthFar:F.far}),B=F.near,G=F.far),F.layers.mask=Y.layers.mask|6,S.layers.mask=F.layers.mask&3,b.layers.mask=F.layers.mask&5;const Fe=Y.parent,Ae=F.cameras;he(F,Fe);for(let Qe=0;Qe<Ae.length;Qe++)he(Ae[Qe],Fe);Ae.length===2?oe(F,S,b):F.projectionMatrix.copy(S.projectionMatrix),We(Y,F,Fe)};function We(Y,ee,Se){Se===null?Y.matrix.copy(ee.matrixWorld):(Y.matrix.copy(Se.matrixWorld),Y.matrix.invert(),Y.matrix.multiply(ee.matrixWorld)),Y.matrix.decompose(Y.position,Y.quaternion,Y.scale),Y.updateMatrixWorld(!0),Y.projectionMatrix.copy(ee.projectionMatrix),Y.projectionMatrixInverse.copy(ee.projectionMatrixInverse),Y.isPerspectiveCamera&&(Y.fov=cs*2*Math.atan(1/Y.projectionMatrix.elements[5]),Y.zoom=1)}this.getCamera=function(){return F},this.getFoveation=function(){if(!(d===null&&f===null))return l},this.setFoveation=function(Y){l=Y,d!==null&&(d.fixedFoveation=Y),f!==null&&f.fixedFoveation!==void 0&&(f.fixedFoveation=Y)},this.hasDepthSensing=function(){return g.texture!==null},this.getDepthSensingMesh=function(){return g.getMesh(F)},this.getCameraTexture=function(Y){return p[Y]};let ke=null;function at(Y,ee){if(h=ee.getViewerPose(c||a),m=ee,h!==null){const Se=h.views;f!==null&&(e.setRenderTargetFramebuffer(M,f.framebuffer),e.setRenderTarget(M));let Fe=!1;Se.length!==F.cameras.length&&(F.cameras.length=0,Fe=!0);for(let Xe=0;Xe<Se.length;Xe++){const $=Se[Xe];let ne=null;if(f!==null)ne=f.getViewport($);else{const ge=u.getViewSubImage(d,$);ne=ge.viewport,Xe===0&&(e.setRenderTargetTextures(M,ge.colorTexture,ge.depthStencilTexture),e.setRenderTarget(M))}let Q=L[Xe];Q===void 0&&(Q=new Pt,Q.layers.enable(Xe),Q.viewport=new pt,L[Xe]=Q),Q.matrix.fromArray($.transform.matrix),Q.matrix.decompose(Q.position,Q.quaternion,Q.scale),Q.projectionMatrix.fromArray($.projectionMatrix),Q.projectionMatrixInverse.copy(Q.projectionMatrix).invert(),Q.viewport.set(ne.x,ne.y,ne.width,ne.height),Xe===0&&(F.matrix.copy(Q.matrix),F.matrix.decompose(F.position,F.quaternion,F.scale)),Fe===!0&&F.cameras.push(Q)}const Ae=i.enabledFeatures;if(Ae&&Ae.includes("depth-sensing")&&i.depthUsage=="gpu-optimized"&&_){u=n.getBinding();const Xe=u.getDepthInformation(Se[0]);Xe&&Xe.isValid&&Xe.texture&&g.init(Xe,i.renderState)}if(Ae&&Ae.includes("camera-access")&&_){e.state.unbindTexture(),u=n.getBinding();for(let Xe=0;Xe<Se.length;Xe++){const $=Se[Xe].camera;if($){let ne=p[$];ne||(ne=new Au,p[$]=ne);const Q=u.getCameraImage($);ne.sourceTexture=Q}}}}for(let Se=0;Se<T.length;Se++){const Fe=E[Se],Ae=T[Se];Fe!==null&&Ae!==void 0&&Ae.update(Fe,ee,c||a)}ke&&ke(Y,ee),ee.detectedPlanes&&n.dispatchEvent({type:"planesdetected",data:ee}),m=null}const ot=new Yu;ot.setAnimationLoop(at),this.setAnimationLoop=function(Y){ke=Y},this.dispose=function(){}}}const gi=new cn,Av=new Ge;function Tv(r,e){function t(g,p){g.matrixAutoUpdate===!0&&g.updateMatrix(),p.value.copy(g.matrix)}function n(g,p){p.color.getRGB(g.fogColor.value,xu(r)),p.isFog?(g.fogNear.value=p.near,g.fogFar.value=p.far):p.isFogExp2&&(g.fogDensity.value=p.density)}function i(g,p,v,x,M){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,M)):p.isMeshMatcapMaterial?(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,v,x):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,t(p.map,g.mapTransform)),p.alphaMap&&(g.alphaMap.value=p.alphaMap,t(p.alphaMap,g.alphaMapTransform)),p.bumpMap&&(g.bumpMap.value=p.bumpMap,t(p.bumpMap,g.bumpMapTransform),g.bumpScale.value=p.bumpScale,p.side===Xt&&(g.bumpScale.value*=-1)),p.normalMap&&(g.normalMap.value=p.normalMap,t(p.normalMap,g.normalMapTransform),g.normalScale.value.copy(p.normalScale),p.side===Xt&&g.normalScale.value.negate()),p.displacementMap&&(g.displacementMap.value=p.displacementMap,t(p.displacementMap,g.displacementMapTransform),g.displacementScale.value=p.displacementScale,g.displacementBias.value=p.displacementBias),p.emissiveMap&&(g.emissiveMap.value=p.emissiveMap,t(p.emissiveMap,g.emissiveMapTransform)),p.specularMap&&(g.specularMap.value=p.specularMap,t(p.specularMap,g.specularMapTransform)),p.alphaTest>0&&(g.alphaTest.value=p.alphaTest);const v=e.get(p),x=v.envMap,M=v.envMapRotation;x&&(g.envMap.value=x,gi.copy(M),gi.x*=-1,gi.y*=-1,gi.z*=-1,x.isCubeTexture&&x.isRenderTargetTexture===!1&&(gi.y*=-1,gi.z*=-1),g.envMapRotation.value.setFromMatrix4(Av.makeRotationFromEuler(gi)),g.flipEnvMap.value=x.isCubeTexture&&x.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,t(p.lightMap,g.lightMapTransform)),p.aoMap&&(g.aoMap.value=p.aoMap,g.aoMapIntensity.value=p.aoMapIntensity,t(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,t(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,v,x){g.diffuse.value.copy(p.color),g.opacity.value=p.opacity,g.size.value=p.size*v,g.scale.value=x*.5,p.map&&(g.map.value=p.map,t(p.map,g.uvTransform)),p.alphaMap&&(g.alphaMap.value=p.alphaMap,t(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,t(p.map,g.mapTransform)),p.alphaMap&&(g.alphaMap.value=p.alphaMap,t(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,t(p.metalnessMap,g.metalnessMapTransform)),g.roughness.value=p.roughness,p.roughnessMap&&(g.roughnessMap.value=p.roughnessMap,t(p.roughnessMap,g.roughnessMapTransform)),p.envMap&&(g.envMapIntensity.value=p.envMapIntensity)}function f(g,p,v){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,t(p.sheenColorMap,g.sheenColorMapTransform)),p.sheenRoughnessMap&&(g.sheenRoughnessMap.value=p.sheenRoughnessMap,t(p.sheenRoughnessMap,g.sheenRoughnessMapTransform))),p.clearcoat>0&&(g.clearcoat.value=p.clearcoat,g.clearcoatRoughness.value=p.clearcoatRoughness,p.clearcoatMap&&(g.clearcoatMap.value=p.clearcoatMap,t(p.clearcoatMap,g.clearcoatMapTransform)),p.clearcoatRoughnessMap&&(g.clearcoatRoughnessMap.value=p.clearcoatRoughnessMap,t(p.clearcoatRoughnessMap,g.clearcoatRoughnessMapTransform)),p.clearcoatNormalMap&&(g.clearcoatNormalMap.value=p.clearcoatNormalMap,t(p.clearcoatNormalMap,g.clearcoatNormalMapTransform),g.clearcoatNormalScale.value.copy(p.clearcoatNormalScale),p.side===Xt&&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,t(p.iridescenceMap,g.iridescenceMapTransform)),p.iridescenceThicknessMap&&(g.iridescenceThicknessMap.value=p.iridescenceThicknessMap,t(p.iridescenceThicknessMap,g.iridescenceThicknessMapTransform))),p.transmission>0&&(g.transmission.value=p.transmission,g.transmissionSamplerMap.value=v.texture,g.transmissionSamplerSize.value.set(v.width,v.height),p.transmissionMap&&(g.transmissionMap.value=p.transmissionMap,t(p.transmissionMap,g.transmissionMapTransform)),g.thickness.value=p.thickness,p.thicknessMap&&(g.thicknessMap.value=p.thicknessMap,t(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,t(p.anisotropyMap,g.anisotropyMapTransform))),g.specularIntensity.value=p.specularIntensity,g.specularColor.value.copy(p.specularColor),p.specularColorMap&&(g.specularColorMap.value=p.specularColorMap,t(p.specularColorMap,g.specularColorMapTransform)),p.specularIntensityMap&&(g.specularIntensityMap.value=p.specularIntensityMap,t(p.specularIntensityMap,g.specularIntensityMapTransform))}function m(g,p){p.matcap&&(g.matcap.value=p.matcap)}function _(g,p){const v=e.get(p).light;g.referencePosition.value.setFromMatrixPosition(v.matrixWorld),g.nearDistance.value=v.shadow.camera.near,g.farDistance.value=v.shadow.camera.far}return{refreshFogUniforms:n,refreshMaterialUniforms:i}}function Ev(r,e,t,n){let i={},s={},a=[];const o=r.getParameter(r.MAX_UNIFORM_BUFFER_BINDINGS);function l(v,x){const M=x.program;n.uniformBlockBinding(v,M)}function c(v,x){let M=i[v.id];M===void 0&&(m(v),M=h(v),i[v.id]=M,v.addEventListener("dispose",g));const T=x.program;n.updateUBOMapping(v,T);const E=e.render.frame;s[v.id]!==E&&(d(v),s[v.id]=E)}function h(v){const x=u();v.__bindingPointIndex=x;const M=r.createBuffer(),T=v.__size,E=v.usage;return r.bindBuffer(r.UNIFORM_BUFFER,M),r.bufferData(r.UNIFORM_BUFFER,T,E),r.bindBuffer(r.UNIFORM_BUFFER,null),r.bindBufferBase(r.UNIFORM_BUFFER,x,M),M}function u(){for(let v=0;v<o;v++)if(a.indexOf(v)===-1)return a.push(v),v;return Le("WebGLRenderer: Maximum number of simultaneously usable uniforms groups reached."),0}function d(v){const x=i[v.id],M=v.uniforms,T=v.__cache;r.bindBuffer(r.UNIFORM_BUFFER,x);for(let E=0,C=M.length;E<C;E++){const P=Array.isArray(M[E])?M[E]:[M[E]];for(let S=0,b=P.length;S<b;S++){const L=P[S];if(f(L,E,S,T)===!0){const F=L.__offset,B=Array.isArray(L.value)?L.value:[L.value];let G=0;for(let q=0;q<B.length;q++){const V=B[q],H=_(V);typeof V=="number"||typeof V=="boolean"?(L.__data[0]=V,r.bufferSubData(r.UNIFORM_BUFFER,F+G,L.__data)):V.isMatrix3?(L.__data[0]=V.elements[0],L.__data[1]=V.elements[1],L.__data[2]=V.elements[2],L.__data[3]=0,L.__data[4]=V.elements[3],L.__data[5]=V.elements[4],L.__data[6]=V.elements[5],L.__data[7]=0,L.__data[8]=V.elements[6],L.__data[9]=V.elements[7],L.__data[10]=V.elements[8],L.__data[11]=0):(V.toArray(L.__data,G),G+=H.storage/Float32Array.BYTES_PER_ELEMENT)}r.bufferSubData(r.UNIFORM_BUFFER,F,L.__data)}}}r.bindBuffer(r.UNIFORM_BUFFER,null)}function f(v,x,M,T){const E=v.value,C=x+"_"+M;if(T[C]===void 0)return typeof E=="number"||typeof E=="boolean"?T[C]=E:T[C]=E.clone(),!0;{const P=T[C];if(typeof E=="number"||typeof E=="boolean"){if(P!==E)return T[C]=E,!0}else if(P.equals(E)===!1)return P.copy(E),!0}return!1}function m(v){const x=v.uniforms;let M=0;const T=16;for(let C=0,P=x.length;C<P;C++){const S=Array.isArray(x[C])?x[C]:[x[C]];for(let b=0,L=S.length;b<L;b++){const F=S[b],B=Array.isArray(F.value)?F.value:[F.value];for(let G=0,q=B.length;G<q;G++){const V=B[G],H=_(V),j=M%T,pe=j%H.boundary,oe=j+pe;M+=pe,oe!==0&&T-oe<H.storage&&(M+=T-oe),F.__data=new Float32Array(H.storage/Float32Array.BYTES_PER_ELEMENT),F.__offset=M,M+=H.storage}}}const E=M%T;return E>0&&(M+=T-E),v.__size=M,v.__cache={},this}function _(v){const x={boundary:0,storage:0};return typeof v=="number"||typeof v=="boolean"?(x.boundary=4,x.storage=4):v.isVector2?(x.boundary=8,x.storage=8):v.isVector3||v.isColor?(x.boundary=16,x.storage=12):v.isVector4?(x.boundary=16,x.storage=16):v.isMatrix3?(x.boundary=48,x.storage=48):v.isMatrix4?(x.boundary=64,x.storage=64):v.isTexture?de("WebGLRenderer: Texture samplers can not be part of an uniforms group."):de("WebGLRenderer: Unsupported uniform value type.",v),x}function g(v){const x=v.target;x.removeEventListener("dispose",g);const M=a.indexOf(x.__bindingPointIndex);a.splice(M,1),r.deleteBuffer(i[x.id]),delete i[x.id],delete s[x.id]}function p(){for(const v in i)r.deleteBuffer(i[v]);a=[],i={},s={}}return{bind:l,update:c,dispose:p}}const wv=new Uint16Array([12469,15057,12620,14925,13266,14620,13807,14376,14323,13990,14545,13625,14713,13328,14840,12882,14931,12528,14996,12233,15039,11829,15066,11525,15080,11295,15085,10976,15082,10705,15073,10495,13880,14564,13898,14542,13977,14430,14158,14124,14393,13732,14556,13410,14702,12996,14814,12596,14891,12291,14937,11834,14957,11489,14958,11194,14943,10803,14921,10506,14893,10278,14858,9960,14484,14039,14487,14025,14499,13941,14524,13740,14574,13468,14654,13106,14743,12678,14818,12344,14867,11893,14889,11509,14893,11180,14881,10751,14852,10428,14812,10128,14765,9754,14712,9466,14764,13480,14764,13475,14766,13440,14766,13347,14769,13070,14786,12713,14816,12387,14844,11957,14860,11549,14868,11215,14855,10751,14825,10403,14782,10044,14729,9651,14666,9352,14599,9029,14967,12835,14966,12831,14963,12804,14954,12723,14936,12564,14917,12347,14900,11958,14886,11569,14878,11247,14859,10765,14828,10401,14784,10011,14727,9600,14660,9289,14586,8893,14508,8533,15111,12234,15110,12234,15104,12216,15092,12156,15067,12010,15028,11776,14981,11500,14942,11205,14902,10752,14861,10393,14812,9991,14752,9570,14682,9252,14603,8808,14519,8445,14431,8145,15209,11449,15208,11451,15202,11451,15190,11438,15163,11384,15117,11274,15055,10979,14994,10648,14932,10343,14871,9936,14803,9532,14729,9218,14645,8742,14556,8381,14461,8020,14365,7603,15273,10603,15272,10607,15267,10619,15256,10631,15231,10614,15182,10535,15118,10389,15042,10167,14963,9787,14883,9447,14800,9115,14710,8665,14615,8318,14514,7911,14411,7507,14279,7198,15314,9675,15313,9683,15309,9712,15298,9759,15277,9797,15229,9773,15166,9668,15084,9487,14995,9274,14898,8910,14800,8539,14697,8234,14590,7790,14479,7409,14367,7067,14178,6621,15337,8619,15337,8631,15333,8677,15325,8769,15305,8871,15264,8940,15202,8909,15119,8775,15022,8565,14916,8328,14804,8009,14688,7614,14569,7287,14448,6888,14321,6483,14088,6171,15350,7402,15350,7419,15347,7480,15340,7613,15322,7804,15287,7973,15229,8057,15148,8012,15046,7846,14933,7611,14810,7357,14682,7069,14552,6656,14421,6316,14251,5948,14007,5528,15356,5942,15356,5977,15353,6119,15348,6294,15332,6551,15302,6824,15249,7044,15171,7122,15070,7050,14949,6861,14818,6611,14679,6349,14538,6067,14398,5651,14189,5311,13935,4958,15359,4123,15359,4153,15356,4296,15353,4646,15338,5160,15311,5508,15263,5829,15188,6042,15088,6094,14966,6001,14826,5796,14678,5543,14527,5287,14377,4985,14133,4586,13869,4257,15360,1563,15360,1642,15358,2076,15354,2636,15341,3350,15317,4019,15273,4429,15203,4732,15105,4911,14981,4932,14836,4818,14679,4621,14517,4386,14359,4156,14083,3795,13808,3437,15360,122,15360,137,15358,285,15355,636,15344,1274,15322,2177,15281,2765,15215,3223,15120,3451,14995,3569,14846,3567,14681,3466,14511,3305,14344,3121,14037,2800,13753,2467,15360,0,15360,1,15359,21,15355,89,15346,253,15325,479,15287,796,15225,1148,15133,1492,15008,1749,14856,1882,14685,1886,14506,1783,14324,1608,13996,1398,13702,1183]);let vn=null;function Cv(){return vn===null&&(vn=new bn(wv,16,16,os,zn),vn.name="DFG_LUT",vn.minFilter=mt,vn.magFilter=mt,vn.wrapS=en,vn.wrapT=en,vn.generateMipmaps=!1,vn.needsUpdate=!0),vn}class bM{constructor(e={}){const{canvas:t=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,outputBufferType:f=Qt}=e;this.isWebGLRenderer=!0;let m;if(n!==null){if(typeof WebGLRenderingContext!="undefined"&&n instanceof WebGLRenderingContext)throw new Error("THREE.WebGLRenderer: WebGL 1 is not supported since r163.");m=n.getContextAttributes().alpha}else m=a;const _=f,g=new Set([El,Tl,ga]),p=new Set([Qt,fn,Vs,ks,Sl,bl]),v=new Uint32Array(4),x=new Int32Array(4);let M=null,T=null;const E=[],C=[];let P=null;this.domElement=t,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=Sn,this.toneMappingExposure=1,this.transmissionResolutionScale=1;const S=this;let b=!1;this._outputColorSpace=Kt;let L=0,F=0,B=null,G=-1,q=null;const V=new pt,H=new pt;let j=null;const pe=new Me(0);let oe=0,he=t.width,We=t.height,ke=1,at=null,ot=null;const Y=new pt(0,0,he,We),ee=new pt(0,0,he,We);let Se=!1;const Fe=new Qs;let Ae=!1,Qe=!1;const lt=new Ge,Xe=new R,$=new pt,ne={background:null,fog:null,environment:null,overrideMaterial:null,isScene:!0};let Q=!1;function ge(){return B===null?ke:1}let I=n;function De(A,N){return t.getContext(A,N)}try{const A={alpha:!0,depth:i,stencil:s,antialias:o,premultipliedAlpha:l,preserveDrawingBuffer:c,powerPreference:h,failIfMajorPerformanceCaveat:u};if("setAttribute"in t&&t.setAttribute("data-engine",`three.js r${vl}`),t.addEventListener("webglcontextlost",He,!1),t.addEventListener("webglcontextrestored",dt,!1),t.addEventListener("webglcontextcreationerror",it,!1),I===null){const N="webgl2";if(I=De(N,A),I===null)throw De(N)?new Error("Error creating WebGL context with your selected attributes."):new Error("Error creating WebGL context.")}}catch(A){throw Le("WebGLRenderer: "+A.message),A}let ve,Oe,re,w,y,U,W,Z,X,Re,ae,we,Be,te,ue,Ce,Ie,ce,$e,D,xe,se,ye,ie;function J(){ve=new C_(I),ve.init(),se=new vv(I,ve),Oe=new v_(I,ve,e,se),re=new _v(I,ve),Oe.reversedDepthBuffer&&d&&re.buffers.depth.setReversed(!0),w=new P_(I),y=new nv,U=new xv(I,ve,re,y,Oe,se,w),W=new M_(S),Z=new w_(S),X=new Nm(I),ye=new __(I,X),Re=new R_(I,X,w,ye),ae=new D_(I,Re,X,w),$e=new L_(I,Oe,U),Ce=new y_(y),we=new tv(S,W,Z,ve,Oe,ye,Ce),Be=new Tv(S,y),te=new sv,ue=new hv(ve),ce=new g_(S,W,Z,re,ae,m,l),Ie=new mv(S,ae,Oe),ie=new Ev(I,w,Oe,re),D=new x_(I,ve,w),xe=new I_(I,ve,w),w.programs=we.programs,S.capabilities=Oe,S.extensions=ve,S.properties=y,S.renderLists=te,S.shadowMap=Ie,S.state=re,S.info=w}J(),_!==Qt&&(P=new N_(_,t.width,t.height,i,s));const le=new bv(S,I);this.xr=le,this.getContext=function(){return I},this.getContextAttributes=function(){return I.getContextAttributes()},this.forceContextLoss=function(){const A=ve.get("WEBGL_lose_context");A&&A.loseContext()},this.forceContextRestore=function(){const A=ve.get("WEBGL_lose_context");A&&A.restoreContext()},this.getPixelRatio=function(){return ke},this.setPixelRatio=function(A){A!==void 0&&(ke=A,this.setSize(he,We,!1))},this.getSize=function(A){return A.set(he,We)},this.setSize=function(A,N,k=!0){if(le.isPresenting){de("WebGLRenderer: Can't change size while VR device is presenting.");return}he=A,We=N,t.width=Math.floor(A*ke),t.height=Math.floor(N*ke),k===!0&&(t.style.width=A+"px",t.style.height=N+"px"),P!==null&&P.setSize(t.width,t.height),this.setViewport(0,0,A,N)},this.getDrawingBufferSize=function(A){return A.set(he*ke,We*ke).floor()},this.setDrawingBufferSize=function(A,N,k){he=A,We=N,ke=k,t.width=Math.floor(A*k),t.height=Math.floor(N*k),this.setViewport(0,0,A,N)},this.setEffects=function(A){if(_===Qt){console.error("THREE.WebGLRenderer: setEffects() requires outputBufferType set to HalfFloatType or FloatType.");return}if(A){for(let N=0;N<A.length;N++)if(A[N].isOutputPass===!0){console.warn("THREE.WebGLRenderer: OutputPass is not needed in setEffects(). Tone mapping and color space conversion are applied automatically.");break}}P.setEffects(A||[])},this.getCurrentViewport=function(A){return A.copy(V)},this.getViewport=function(A){return A.copy(Y)},this.setViewport=function(A,N,k,z){A.isVector4?Y.set(A.x,A.y,A.z,A.w):Y.set(A,N,k,z),re.viewport(V.copy(Y).multiplyScalar(ke).round())},this.getScissor=function(A){return A.copy(ee)},this.setScissor=function(A,N,k,z){A.isVector4?ee.set(A.x,A.y,A.z,A.w):ee.set(A,N,k,z),re.scissor(H.copy(ee).multiplyScalar(ke).round())},this.getScissorTest=function(){return Se},this.setScissorTest=function(A){re.setScissorTest(Se=A)},this.setOpaqueSort=function(A){at=A},this.setTransparentSort=function(A){ot=A},this.getClearColor=function(A){return A.copy(ce.getClearColor())},this.setClearColor=function(){ce.setClearColor(...arguments)},this.getClearAlpha=function(){return ce.getClearAlpha()},this.setClearAlpha=function(){ce.setClearAlpha(...arguments)},this.clear=function(A=!0,N=!0,k=!0){let z=0;if(A){let O=!1;if(B!==null){const fe=B.texture.format;O=g.has(fe)}if(O){const fe=B.texture.type,be=p.has(fe),_e=ce.getClearColor(),Ee=ce.getClearAlpha(),Pe=_e.r,Ve=_e.g,Ue=_e.b;be?(v[0]=Pe,v[1]=Ve,v[2]=Ue,v[3]=Ee,I.clearBufferuiv(I.COLOR,0,v)):(x[0]=Pe,x[1]=Ve,x[2]=Ue,x[3]=Ee,I.clearBufferiv(I.COLOR,0,x))}else z|=I.COLOR_BUFFER_BIT}N&&(z|=I.DEPTH_BUFFER_BIT),k&&(z|=I.STENCIL_BUFFER_BIT,this.state.buffers.stencil.setMask(4294967295)),I.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(){t.removeEventListener("webglcontextlost",He,!1),t.removeEventListener("webglcontextrestored",dt,!1),t.removeEventListener("webglcontextcreationerror",it,!1),ce.dispose(),te.dispose(),ue.dispose(),y.dispose(),W.dispose(),Z.dispose(),ae.dispose(),ye.dispose(),ie.dispose(),we.dispose(),le.dispose(),le.removeEventListener("sessionstart",oc),le.removeEventListener("sessionend",lc),ti.stop()};function He(A){A.preventDefault(),oa("WebGLRenderer: Context Lost."),b=!0}function dt(){oa("WebGLRenderer: Context Restored."),b=!1;const A=w.autoReset,N=Ie.enabled,k=Ie.autoUpdate,z=Ie.needsUpdate,O=Ie.type;J(),w.autoReset=A,Ie.enabled=N,Ie.autoUpdate=k,Ie.needsUpdate=z,Ie.type=O}function it(A){Le("WebGLRenderer: A WebGL context could not be created. Reason: ",A.statusMessage)}function gn(A){const N=A.target;N.removeEventListener("dispose",gn),Tn(N)}function Tn(A){Qu(A),y.remove(A)}function Qu(A){const N=y.get(A).programs;N!==void 0&&(N.forEach(function(k){we.releaseProgram(k)}),A.isShaderMaterial&&we.releaseShaderCache(A))}this.renderBufferDirect=function(A,N,k,z,O,fe){N===null&&(N=ne);const be=O.isMesh&&O.matrixWorld.determinant()<0,_e=ed(A,N,k,z,O);re.setMaterial(z,be);let Ee=k.index,Pe=1;if(z.wireframe===!0){if(Ee=Re.getWireframeAttribute(k),Ee===void 0)return;Pe=2}const Ve=k.drawRange,Ue=k.attributes.position;let Ke=Ve.start*Pe,ct=(Ve.start+Ve.count)*Pe;fe!==null&&(Ke=Math.max(Ke,fe.start*Pe),ct=Math.min(ct,(fe.start+fe.count)*Pe)),Ee!==null?(Ke=Math.max(Ke,0),ct=Math.min(ct,Ee.count)):Ue!=null&&(Ke=Math.max(Ke,0),ct=Math.min(ct,Ue.count));const _t=ct-Ke;if(_t<0||_t===1/0)return;ye.setup(O,z,_e,k,Ee);let xt,ht=D;if(Ee!==null&&(xt=X.get(Ee),ht=xe,ht.setIndex(xt)),O.isMesh)z.wireframe===!0?(re.setLineWidth(z.wireframeLinewidth*ge()),ht.setMode(I.LINES)):ht.setMode(I.TRIANGLES);else if(O.isLine){let Ne=z.linewidth;Ne===void 0&&(Ne=1),re.setLineWidth(Ne*ge()),O.isLineSegments?ht.setMode(I.LINES):O.isLineLoop?ht.setMode(I.LINE_LOOP):ht.setMode(I.LINE_STRIP)}else O.isPoints?ht.setMode(I.POINTS):O.isSprite&&ht.setMode(I.TRIANGLES);if(O.isBatchedMesh)if(O._multiDrawInstances!==null)Ws("WebGLRenderer: renderMultiDrawInstances has been deprecated and will be removed in r184. Append to renderMultiDraw arguments and use indirection."),ht.renderMultiDrawInstances(O._multiDrawStarts,O._multiDrawCounts,O._multiDrawCount,O._multiDrawInstances);else if(ve.get("WEBGL_multi_draw"))ht.renderMultiDraw(O._multiDrawStarts,O._multiDrawCounts,O._multiDrawCount);else{const Ne=O._multiDrawStarts,st=O._multiDrawCounts,et=O._multiDrawCount,Yt=Ee?X.get(Ee).bytesPerElement:1,Pi=y.get(z).currentProgram.getUniforms();for(let Zt=0;Zt<et;Zt++)Pi.setValue(I,"_gl_DrawID",Zt),ht.render(Ne[Zt]/Yt,st[Zt])}else if(O.isInstancedMesh)ht.renderInstances(Ke,_t,O.count);else if(k.isInstancedBufferGeometry){const Ne=k._maxInstanceCount!==void 0?k._maxInstanceCount:1/0,st=Math.min(k.instanceCount,Ne);ht.renderInstances(Ke,_t,st)}else ht.render(Ke,_t)};function ac(A,N,k){A.transparent===!0&&A.side===Ln&&A.forceSinglePass===!1?(A.side=Xt,A.needsUpdate=!0,tr(A,N,k),A.side=Qn,A.needsUpdate=!0,tr(A,N,k),A.side=Ln):tr(A,N,k)}this.compile=function(A,N,k=null){k===null&&(k=A),T=ue.get(k),T.init(N),C.push(T),k.traverseVisible(function(O){O.isLight&&O.layers.test(N.layers)&&(T.pushLight(O),O.castShadow&&T.pushShadow(O))}),A!==k&&A.traverseVisible(function(O){O.isLight&&O.layers.test(N.layers)&&(T.pushLight(O),O.castShadow&&T.pushShadow(O))}),T.setupLights();const z=new Set;return A.traverse(function(O){if(!(O.isMesh||O.isPoints||O.isLine||O.isSprite))return;const fe=O.material;if(fe)if(Array.isArray(fe))for(let be=0;be<fe.length;be++){const _e=fe[be];ac(_e,k,O),z.add(_e)}else ac(fe,k,O),z.add(fe)}),T=C.pop(),z},this.compileAsync=function(A,N,k=null){const z=this.compile(A,N,k);return new Promise(O=>{function fe(){if(z.forEach(function(be){y.get(be).currentProgram.isReady()&&z.delete(be)}),z.size===0){O(A);return}setTimeout(fe,10)}ve.get("KHR_parallel_shader_compile")!==null?fe():setTimeout(fe,10)})};let wa=null;function ju(A){wa&&wa(A)}function oc(){ti.stop()}function lc(){ti.start()}const ti=new Yu;ti.setAnimationLoop(ju),typeof self!="undefined"&&ti.setContext(self),this.setAnimationLoop=function(A){wa=A,le.setAnimationLoop(A),A===null?ti.stop():ti.start()},le.addEventListener("sessionstart",oc),le.addEventListener("sessionend",lc),this.render=function(A,N){if(N!==void 0&&N.isCamera!==!0){Le("WebGLRenderer.render: camera is not an instance of THREE.Camera.");return}if(b===!0)return;const k=le.enabled===!0&&le.isPresenting===!0,z=P!==null&&(B===null||k)&&P.begin(S,B);if(A.matrixWorldAutoUpdate===!0&&A.updateMatrixWorld(),N.parent===null&&N.matrixWorldAutoUpdate===!0&&N.updateMatrixWorld(),le.enabled===!0&&le.isPresenting===!0&&(P===null||P.isCompositing()===!1)&&(le.cameraAutoUpdate===!0&&le.updateCamera(N),N=le.getCamera()),A.isScene===!0&&A.onBeforeRender(S,A,N,B),T=ue.get(A,C.length),T.init(N),C.push(T),lt.multiplyMatrices(N.projectionMatrix,N.matrixWorldInverse),Fe.setFromProjectionMatrix(lt,on,N.reversedDepth),Qe=this.localClippingEnabled,Ae=Ce.init(this.clippingPlanes,Qe),M=te.get(A,E.length),M.init(),E.push(M),le.enabled===!0&&le.isPresenting===!0){const be=S.xr.getDepthSensingMesh();be!==null&&Ca(be,N,-1/0,S.sortObjects)}Ca(A,N,0,S.sortObjects),M.finish(),S.sortObjects===!0&&M.sort(at,ot),Q=le.enabled===!1||le.isPresenting===!1||le.hasDepthSensing()===!1,Q&&ce.addToRenderList(M,A),this.info.render.frame++,Ae===!0&&Ce.beginShadows();const O=T.state.shadowsArray;if(Ie.render(O,A,N),Ae===!0&&Ce.endShadows(),this.info.autoReset===!0&&this.info.reset(),(z&&P.hasRenderPass())===!1){const be=M.opaque,_e=M.transmissive;if(T.setupLights(),N.isArrayCamera){const Ee=N.cameras;if(_e.length>0)for(let Pe=0,Ve=Ee.length;Pe<Ve;Pe++){const Ue=Ee[Pe];hc(be,_e,A,Ue)}Q&&ce.render(A);for(let Pe=0,Ve=Ee.length;Pe<Ve;Pe++){const Ue=Ee[Pe];cc(M,A,Ue,Ue.viewport)}}else _e.length>0&&hc(be,_e,A,N),Q&&ce.render(A),cc(M,A,N)}B!==null&&F===0&&(U.updateMultisampleRenderTarget(B),U.updateRenderTargetMipmap(B)),z&&P.end(S),A.isScene===!0&&A.onAfterRender(S,A,N),ye.resetDefaultState(),G=-1,q=null,C.pop(),C.length>0?(T=C[C.length-1],Ae===!0&&Ce.setGlobalState(S.clippingPlanes,T.state.camera)):T=null,E.pop(),E.length>0?M=E[E.length-1]:M=null};function Ca(A,N,k,z){if(A.visible===!1)return;if(A.layers.test(N.layers)){if(A.isGroup)k=A.renderOrder;else if(A.isLOD)A.autoUpdate===!0&&A.update(N);else if(A.isLight)T.pushLight(A),A.castShadow&&T.pushShadow(A);else if(A.isSprite){if(!A.frustumCulled||Fe.intersectsSprite(A)){z&&$.setFromMatrixPosition(A.matrixWorld).applyMatrix4(lt);const be=ae.update(A),_e=A.material;_e.visible&&M.push(A,be,_e,k,$.z,null)}}else if((A.isMesh||A.isLine||A.isPoints)&&(!A.frustumCulled||Fe.intersectsObject(A))){const be=ae.update(A),_e=A.material;if(z&&(A.boundingSphere!==void 0?(A.boundingSphere===null&&A.computeBoundingSphere(),$.copy(A.boundingSphere.center)):(be.boundingSphere===null&&be.computeBoundingSphere(),$.copy(be.boundingSphere.center)),$.applyMatrix4(A.matrixWorld).applyMatrix4(lt)),Array.isArray(_e)){const Ee=be.groups;for(let Pe=0,Ve=Ee.length;Pe<Ve;Pe++){const Ue=Ee[Pe],Ke=_e[Ue.materialIndex];Ke&&Ke.visible&&M.push(A,be,Ke,k,$.z,Ue)}}else _e.visible&&M.push(A,be,_e,k,$.z,null)}}const fe=A.children;for(let be=0,_e=fe.length;be<_e;be++)Ca(fe[be],N,k,z)}function cc(A,N,k,z){const{opaque:O,transmissive:fe,transparent:be}=A;T.setupLightsView(k),Ae===!0&&Ce.setGlobalState(S.clippingPlanes,k),z&&re.viewport(V.copy(z)),O.length>0&&er(O,N,k),fe.length>0&&er(fe,N,k),be.length>0&&er(be,N,k),re.buffers.depth.setTest(!0),re.buffers.depth.setMask(!0),re.buffers.color.setMask(!0),re.setPolygonOffset(!1)}function hc(A,N,k,z){if((k.isScene===!0?k.overrideMaterial:null)!==null)return;if(T.state.transmissionRenderTarget[z.id]===void 0){const Ke=ve.has("EXT_color_buffer_half_float")||ve.has("EXT_color_buffer_float");T.state.transmissionRenderTarget[z.id]=new ln(1,1,{generateMipmaps:!0,type:Ke?zn:Qt,minFilter:Un,samples:Oe.samples,stencilBuffer:s,resolveDepthBuffer:!1,resolveStencilBuffer:!1,colorSpace:je.workingColorSpace})}const fe=T.state.transmissionRenderTarget[z.id],be=z.viewport||V;fe.setSize(be.z*S.transmissionResolutionScale,be.w*S.transmissionResolutionScale);const _e=S.getRenderTarget(),Ee=S.getActiveCubeFace(),Pe=S.getActiveMipmapLevel();S.setRenderTarget(fe),S.getClearColor(pe),oe=S.getClearAlpha(),oe<1&&S.setClearColor(16777215,.5),S.clear(),Q&&ce.render(k);const Ve=S.toneMapping;S.toneMapping=Sn;const Ue=z.viewport;if(z.viewport!==void 0&&(z.viewport=void 0),T.setupLightsView(z),Ae===!0&&Ce.setGlobalState(S.clippingPlanes,z),er(A,k,z),U.updateMultisampleRenderTarget(fe),U.updateRenderTargetMipmap(fe),ve.has("WEBGL_multisampled_render_to_texture")===!1){let Ke=!1;for(let ct=0,_t=N.length;ct<_t;ct++){const xt=N[ct],{object:ht,geometry:Ne,material:st,group:et}=xt;if(st.side===Ln&&ht.layers.test(z.layers)){const Yt=st.side;st.side=Xt,st.needsUpdate=!0,uc(ht,k,z,Ne,st,et),st.side=Yt,st.needsUpdate=!0,Ke=!0}}Ke===!0&&(U.updateMultisampleRenderTarget(fe),U.updateRenderTargetMipmap(fe))}S.setRenderTarget(_e,Ee,Pe),S.setClearColor(pe,oe),Ue!==void 0&&(z.viewport=Ue),S.toneMapping=Ve}function er(A,N,k){const z=N.isScene===!0?N.overrideMaterial:null;for(let O=0,fe=A.length;O<fe;O++){const be=A[O],{object:_e,geometry:Ee,group:Pe}=be;let Ve=be.material;Ve.allowOverride===!0&&z!==null&&(Ve=z),_e.layers.test(k.layers)&&uc(_e,N,k,Ee,Ve,Pe)}}function uc(A,N,k,z,O,fe){A.onBeforeRender(S,N,k,z,O,fe),A.modelViewMatrix.multiplyMatrices(k.matrixWorldInverse,A.matrixWorld),A.normalMatrix.getNormalMatrix(A.modelViewMatrix),O.onBeforeRender(S,N,k,z,A,fe),O.transparent===!0&&O.side===Ln&&O.forceSinglePass===!1?(O.side=Xt,O.needsUpdate=!0,S.renderBufferDirect(k,N,z,O,A,fe),O.side=Qn,O.needsUpdate=!0,S.renderBufferDirect(k,N,z,O,A,fe),O.side=Ln):S.renderBufferDirect(k,N,z,O,A,fe),A.onAfterRender(S,N,k,z,O,fe)}function tr(A,N,k){N.isScene!==!0&&(N=ne);const z=y.get(A),O=T.state.lights,fe=T.state.shadowsArray,be=O.state.version,_e=we.getParameters(A,O.state,fe,N,k),Ee=we.getProgramCacheKey(_e);let Pe=z.programs;z.environment=A.isMeshStandardMaterial?N.environment:null,z.fog=N.fog,z.envMap=(A.isMeshStandardMaterial?Z:W).get(A.envMap||z.environment),z.envMapRotation=z.environment!==null&&A.envMap===null?N.environmentRotation:A.envMapRotation,Pe===void 0&&(A.addEventListener("dispose",gn),Pe=new Map,z.programs=Pe);let Ve=Pe.get(Ee);if(Ve!==void 0){if(z.currentProgram===Ve&&z.lightsStateVersion===be)return fc(A,_e),Ve}else _e.uniforms=we.getUniforms(A),A.onBeforeCompile(_e,S),Ve=we.acquireProgram(_e,Ee),Pe.set(Ee,Ve),z.uniforms=_e.uniforms;const Ue=z.uniforms;return(!A.isShaderMaterial&&!A.isRawShaderMaterial||A.clipping===!0)&&(Ue.clippingPlanes=Ce.uniform),fc(A,_e),z.needsLights=nd(A),z.lightsStateVersion=be,z.needsLights&&(Ue.ambientLightColor.value=O.state.ambient,Ue.lightProbe.value=O.state.probe,Ue.directionalLights.value=O.state.directional,Ue.directionalLightShadows.value=O.state.directionalShadow,Ue.spotLights.value=O.state.spot,Ue.spotLightShadows.value=O.state.spotShadow,Ue.rectAreaLights.value=O.state.rectArea,Ue.ltc_1.value=O.state.rectAreaLTC1,Ue.ltc_2.value=O.state.rectAreaLTC2,Ue.pointLights.value=O.state.point,Ue.pointLightShadows.value=O.state.pointShadow,Ue.hemisphereLights.value=O.state.hemi,Ue.directionalShadowMap.value=O.state.directionalShadowMap,Ue.directionalShadowMatrix.value=O.state.directionalShadowMatrix,Ue.spotShadowMap.value=O.state.spotShadowMap,Ue.spotLightMatrix.value=O.state.spotLightMatrix,Ue.spotLightMap.value=O.state.spotLightMap,Ue.pointShadowMap.value=O.state.pointShadowMap,Ue.pointShadowMatrix.value=O.state.pointShadowMatrix),z.currentProgram=Ve,z.uniformsList=null,Ve}function dc(A){if(A.uniformsList===null){const N=A.currentProgram.getUniforms();A.uniformsList=Qr.seqWithValue(N.seq,A.uniforms)}return A.uniformsList}function fc(A,N){const k=y.get(A);k.outputColorSpace=N.outputColorSpace,k.batching=N.batching,k.batchingColor=N.batchingColor,k.instancing=N.instancing,k.instancingColor=N.instancingColor,k.instancingMorph=N.instancingMorph,k.skinning=N.skinning,k.morphTargets=N.morphTargets,k.morphNormals=N.morphNormals,k.morphColors=N.morphColors,k.morphTargetsCount=N.morphTargetsCount,k.numClippingPlanes=N.numClippingPlanes,k.numIntersection=N.numClipIntersection,k.vertexAlphas=N.vertexAlphas,k.vertexTangents=N.vertexTangents,k.toneMapping=N.toneMapping}function ed(A,N,k,z,O){N.isScene!==!0&&(N=ne),U.resetTextureUnits();const fe=N.fog,be=z.isMeshStandardMaterial?N.environment:null,_e=B===null?S.outputColorSpace:B.isXRRenderTarget===!0?B.texture.colorSpace:ls,Ee=(z.isMeshStandardMaterial?Z:W).get(z.envMap||be),Pe=z.vertexColors===!0&&!!k.attributes.color&&k.attributes.color.itemSize===4,Ve=!!k.attributes.tangent&&(!!z.normalMap||z.anisotropy>0),Ue=!!k.morphAttributes.position,Ke=!!k.morphAttributes.normal,ct=!!k.morphAttributes.color;let _t=Sn;z.toneMapped&&(B===null||B.isXRRenderTarget===!0)&&(_t=S.toneMapping);const xt=k.morphAttributes.position||k.morphAttributes.normal||k.morphAttributes.color,ht=xt!==void 0?xt.length:0,Ne=y.get(z),st=T.state.lights;if(Ae===!0&&(Qe===!0||A!==q)){const Dt=A===q&&z.id===G;Ce.setState(z,A,Dt)}let et=!1;z.version===Ne.__version?(Ne.needsLights&&Ne.lightsStateVersion!==st.state.version||Ne.outputColorSpace!==_e||O.isBatchedMesh&&Ne.batching===!1||!O.isBatchedMesh&&Ne.batching===!0||O.isBatchedMesh&&Ne.batchingColor===!0&&O.colorTexture===null||O.isBatchedMesh&&Ne.batchingColor===!1&&O.colorTexture!==null||O.isInstancedMesh&&Ne.instancing===!1||!O.isInstancedMesh&&Ne.instancing===!0||O.isSkinnedMesh&&Ne.skinning===!1||!O.isSkinnedMesh&&Ne.skinning===!0||O.isInstancedMesh&&Ne.instancingColor===!0&&O.instanceColor===null||O.isInstancedMesh&&Ne.instancingColor===!1&&O.instanceColor!==null||O.isInstancedMesh&&Ne.instancingMorph===!0&&O.morphTexture===null||O.isInstancedMesh&&Ne.instancingMorph===!1&&O.morphTexture!==null||Ne.envMap!==Ee||z.fog===!0&&Ne.fog!==fe||Ne.numClippingPlanes!==void 0&&(Ne.numClippingPlanes!==Ce.numPlanes||Ne.numIntersection!==Ce.numIntersection)||Ne.vertexAlphas!==Pe||Ne.vertexTangents!==Ve||Ne.morphTargets!==Ue||Ne.morphNormals!==Ke||Ne.morphColors!==ct||Ne.toneMapping!==_t||Ne.morphTargetsCount!==ht)&&(et=!0):(et=!0,Ne.__version=z.version);let Yt=Ne.currentProgram;et===!0&&(Yt=tr(z,N,O));let Pi=!1,Zt=!1,_s=!1;const ft=Yt.getUniforms(),zt=Ne.uniforms;if(re.useProgram(Yt.program)&&(Pi=!0,Zt=!0,_s=!0),z.id!==G&&(G=z.id,Zt=!0),Pi||q!==A){re.buffers.depth.getReversed()&&A.reversedDepth!==!0&&(A._reversedDepth=!0,A.updateProjectionMatrix()),ft.setValue(I,"projectionMatrix",A.projectionMatrix),ft.setValue(I,"viewMatrix",A.matrixWorldInverse);const Vt=ft.map.cameraPosition;Vt!==void 0&&Vt.setValue(I,Xe.setFromMatrixPosition(A.matrixWorld)),Oe.logarithmicDepthBuffer&&ft.setValue(I,"logDepthBufFC",2/(Math.log(A.far+1)/Math.LN2)),(z.isMeshPhongMaterial||z.isMeshToonMaterial||z.isMeshLambertMaterial||z.isMeshBasicMaterial||z.isMeshStandardMaterial||z.isShaderMaterial)&&ft.setValue(I,"isOrthographic",A.isOrthographicCamera===!0),q!==A&&(q=A,Zt=!0,_s=!0)}if(Ne.needsLights&&(st.state.directionalShadowMap.length>0&&ft.setValue(I,"directionalShadowMap",st.state.directionalShadowMap,U),st.state.spotShadowMap.length>0&&ft.setValue(I,"spotShadowMap",st.state.spotShadowMap,U),st.state.pointShadowMap.length>0&&ft.setValue(I,"pointShadowMap",st.state.pointShadowMap,U)),O.isSkinnedMesh){ft.setOptional(I,O,"bindMatrix"),ft.setOptional(I,O,"bindMatrixInverse");const Dt=O.skeleton;Dt&&(Dt.boneTexture===null&&Dt.computeBoneTexture(),ft.setValue(I,"boneTexture",Dt.boneTexture,U))}O.isBatchedMesh&&(ft.setOptional(I,O,"batchingTexture"),ft.setValue(I,"batchingTexture",O._matricesTexture,U),ft.setOptional(I,O,"batchingIdTexture"),ft.setValue(I,"batchingIdTexture",O._indirectTexture,U),ft.setOptional(I,O,"batchingColorTexture"),O._colorsTexture!==null&&ft.setValue(I,"batchingColorTexture",O._colorsTexture,U));const rn=k.morphAttributes;if((rn.position!==void 0||rn.normal!==void 0||rn.color!==void 0)&&$e.update(O,k,Yt),(Zt||Ne.receiveShadow!==O.receiveShadow)&&(Ne.receiveShadow=O.receiveShadow,ft.setValue(I,"receiveShadow",O.receiveShadow)),z.isMeshGouraudMaterial&&z.envMap!==null&&(zt.envMap.value=Ee,zt.flipEnvMap.value=Ee.isCubeTexture&&Ee.isRenderTargetTexture===!1?-1:1),z.isMeshStandardMaterial&&z.envMap===null&&N.environment!==null&&(zt.envMapIntensity.value=N.environmentIntensity),zt.dfgLUT!==void 0&&(zt.dfgLUT.value=Cv()),Zt&&(ft.setValue(I,"toneMappingExposure",S.toneMappingExposure),Ne.needsLights&&td(zt,_s),fe&&z.fog===!0&&Be.refreshFogUniforms(zt,fe),Be.refreshMaterialUniforms(zt,z,ke,We,T.state.transmissionRenderTarget[A.id]),Qr.upload(I,dc(Ne),zt,U)),z.isShaderMaterial&&z.uniformsNeedUpdate===!0&&(Qr.upload(I,dc(Ne),zt,U),z.uniformsNeedUpdate=!1),z.isSpriteMaterial&&ft.setValue(I,"center",O.center),ft.setValue(I,"modelViewMatrix",O.modelViewMatrix),ft.setValue(I,"normalMatrix",O.normalMatrix),ft.setValue(I,"modelMatrix",O.matrixWorld),z.isShaderMaterial||z.isRawShaderMaterial){const Dt=z.uniformsGroups;for(let Vt=0,Ra=Dt.length;Vt<Ra;Vt++){const ni=Dt[Vt];ie.update(ni,Yt),ie.bind(ni,Yt)}}return Yt}function td(A,N){A.ambientLightColor.needsUpdate=N,A.lightProbe.needsUpdate=N,A.directionalLights.needsUpdate=N,A.directionalLightShadows.needsUpdate=N,A.pointLights.needsUpdate=N,A.pointLightShadows.needsUpdate=N,A.spotLights.needsUpdate=N,A.spotLightShadows.needsUpdate=N,A.rectAreaLights.needsUpdate=N,A.hemisphereLights.needsUpdate=N}function nd(A){return A.isMeshLambertMaterial||A.isMeshToonMaterial||A.isMeshPhongMaterial||A.isMeshStandardMaterial||A.isShadowMaterial||A.isShaderMaterial&&A.lights===!0}this.getActiveCubeFace=function(){return L},this.getActiveMipmapLevel=function(){return F},this.getRenderTarget=function(){return B},this.setRenderTargetTextures=function(A,N,k){const z=y.get(A);z.__autoAllocateDepthBuffer=A.resolveDepthBuffer===!1,z.__autoAllocateDepthBuffer===!1&&(z.__useRenderToTexture=!1),y.get(A.texture).__webglTexture=N,y.get(A.depthTexture).__webglTexture=z.__autoAllocateDepthBuffer?void 0:k,z.__hasExternalTextures=!0},this.setRenderTargetFramebuffer=function(A,N){const k=y.get(A);k.__webglFramebuffer=N,k.__useDefaultFramebuffer=N===void 0};const id=I.createFramebuffer();this.setRenderTarget=function(A,N=0,k=0){B=A,L=N,F=k;let z=null,O=!1,fe=!1;if(A){const _e=y.get(A);if(_e.__useDefaultFramebuffer!==void 0){re.bindFramebuffer(I.FRAMEBUFFER,_e.__webglFramebuffer),V.copy(A.viewport),H.copy(A.scissor),j=A.scissorTest,re.viewport(V),re.scissor(H),re.setScissorTest(j),G=-1;return}else if(_e.__webglFramebuffer===void 0)U.setupRenderTarget(A);else if(_e.__hasExternalTextures)U.rebindTextures(A,y.get(A.texture).__webglTexture,y.get(A.depthTexture).__webglTexture);else if(A.depthBuffer){const Ve=A.depthTexture;if(_e.__boundDepthTexture!==Ve){if(Ve!==null&&y.has(Ve)&&(A.width!==Ve.image.width||A.height!==Ve.image.height))throw new Error("WebGLRenderTarget: Attached DepthTexture is initialized to the incorrect size.");U.setupDepthRenderbuffer(A)}}const Ee=A.texture;(Ee.isData3DTexture||Ee.isDataArrayTexture||Ee.isCompressedArrayTexture)&&(fe=!0);const Pe=y.get(A).__webglFramebuffer;A.isWebGLCubeRenderTarget?(Array.isArray(Pe[N])?z=Pe[N][k]:z=Pe[N],O=!0):A.samples>0&&U.useMultisampledRTT(A)===!1?z=y.get(A).__webglMultisampledFramebuffer:Array.isArray(Pe)?z=Pe[k]:z=Pe,V.copy(A.viewport),H.copy(A.scissor),j=A.scissorTest}else V.copy(Y).multiplyScalar(ke).floor(),H.copy(ee).multiplyScalar(ke).floor(),j=Se;if(k!==0&&(z=id),re.bindFramebuffer(I.FRAMEBUFFER,z)&&re.drawBuffers(A,z),re.viewport(V),re.scissor(H),re.setScissorTest(j),O){const _e=y.get(A.texture);I.framebufferTexture2D(I.FRAMEBUFFER,I.COLOR_ATTACHMENT0,I.TEXTURE_CUBE_MAP_POSITIVE_X+N,_e.__webglTexture,k)}else if(fe){const _e=N;for(let Ee=0;Ee<A.textures.length;Ee++){const Pe=y.get(A.textures[Ee]);I.framebufferTextureLayer(I.FRAMEBUFFER,I.COLOR_ATTACHMENT0+Ee,Pe.__webglTexture,k,_e)}}else if(A!==null&&k!==0){const _e=y.get(A.texture);I.framebufferTexture2D(I.FRAMEBUFFER,I.COLOR_ATTACHMENT0,I.TEXTURE_2D,_e.__webglTexture,k)}G=-1},this.readRenderTargetPixels=function(A,N,k,z,O,fe,be,_e=0){if(!(A&&A.isWebGLRenderTarget)){Le("WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");return}let Ee=y.get(A).__webglFramebuffer;if(A.isWebGLCubeRenderTarget&&be!==void 0&&(Ee=Ee[be]),Ee){re.bindFramebuffer(I.FRAMEBUFFER,Ee);try{const Pe=A.textures[_e],Ve=Pe.format,Ue=Pe.type;if(!Oe.textureFormatReadable(Ve)){Le("WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.");return}if(!Oe.textureTypeReadable(Ue)){Le("WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.");return}N>=0&&N<=A.width-z&&k>=0&&k<=A.height-O&&(A.textures.length>1&&I.readBuffer(I.COLOR_ATTACHMENT0+_e),I.readPixels(N,k,z,O,se.convert(Ve),se.convert(Ue),fe))}finally{const Pe=B!==null?y.get(B).__webglFramebuffer:null;re.bindFramebuffer(I.FRAMEBUFFER,Pe)}}},this.readRenderTargetPixelsAsync=async function(A,N,k,z,O,fe,be,_e=0){if(!(A&&A.isWebGLRenderTarget))throw new Error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");let Ee=y.get(A).__webglFramebuffer;if(A.isWebGLCubeRenderTarget&&be!==void 0&&(Ee=Ee[be]),Ee)if(N>=0&&N<=A.width-z&&k>=0&&k<=A.height-O){re.bindFramebuffer(I.FRAMEBUFFER,Ee);const Pe=A.textures[_e],Ve=Pe.format,Ue=Pe.type;if(!Oe.textureFormatReadable(Ve))throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in RGBA or implementation defined format.");if(!Oe.textureTypeReadable(Ue))throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in UnsignedByteType or implementation defined type.");const Ke=I.createBuffer();I.bindBuffer(I.PIXEL_PACK_BUFFER,Ke),I.bufferData(I.PIXEL_PACK_BUFFER,fe.byteLength,I.STREAM_READ),A.textures.length>1&&I.readBuffer(I.COLOR_ATTACHMENT0+_e),I.readPixels(N,k,z,O,se.convert(Ve),se.convert(Ue),0);const ct=B!==null?y.get(B).__webglFramebuffer:null;re.bindFramebuffer(I.FRAMEBUFFER,ct);const _t=I.fenceSync(I.SYNC_GPU_COMMANDS_COMPLETE,0);return I.flush(),await Hd(I,_t,4),I.bindBuffer(I.PIXEL_PACK_BUFFER,Ke),I.getBufferSubData(I.PIXEL_PACK_BUFFER,0,fe),I.deleteBuffer(Ke),I.deleteSync(_t),fe}else throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: requested read bounds are out of range.")},this.copyFramebufferToTexture=function(A,N=null,k=0){const z=Math.pow(2,-k),O=Math.floor(A.image.width*z),fe=Math.floor(A.image.height*z),be=N!==null?N.x:0,_e=N!==null?N.y:0;U.setTexture2D(A,0),I.copyTexSubImage2D(I.TEXTURE_2D,k,0,0,be,_e,O,fe),re.unbindTexture()};const sd=I.createFramebuffer(),rd=I.createFramebuffer();this.copyTextureToTexture=function(A,N,k=null,z=null,O=0,fe=null){fe===null&&(O!==0?(Ws("WebGLRenderer: copyTextureToTexture function signature has changed to support src and dst mipmap levels."),fe=O,O=0):fe=0);let be,_e,Ee,Pe,Ve,Ue,Ke,ct,_t;const xt=A.isCompressedTexture?A.mipmaps[fe]:A.image;if(k!==null)be=k.max.x-k.min.x,_e=k.max.y-k.min.y,Ee=k.isBox3?k.max.z-k.min.z:1,Pe=k.min.x,Ve=k.min.y,Ue=k.isBox3?k.min.z:0;else{const rn=Math.pow(2,-O);be=Math.floor(xt.width*rn),_e=Math.floor(xt.height*rn),A.isDataArrayTexture?Ee=xt.depth:A.isData3DTexture?Ee=Math.floor(xt.depth*rn):Ee=1,Pe=0,Ve=0,Ue=0}z!==null?(Ke=z.x,ct=z.y,_t=z.z):(Ke=0,ct=0,_t=0);const ht=se.convert(N.format),Ne=se.convert(N.type);let st;N.isData3DTexture?(U.setTexture3D(N,0),st=I.TEXTURE_3D):N.isDataArrayTexture||N.isCompressedArrayTexture?(U.setTexture2DArray(N,0),st=I.TEXTURE_2D_ARRAY):(U.setTexture2D(N,0),st=I.TEXTURE_2D),I.pixelStorei(I.UNPACK_FLIP_Y_WEBGL,N.flipY),I.pixelStorei(I.UNPACK_PREMULTIPLY_ALPHA_WEBGL,N.premultiplyAlpha),I.pixelStorei(I.UNPACK_ALIGNMENT,N.unpackAlignment);const et=I.getParameter(I.UNPACK_ROW_LENGTH),Yt=I.getParameter(I.UNPACK_IMAGE_HEIGHT),Pi=I.getParameter(I.UNPACK_SKIP_PIXELS),Zt=I.getParameter(I.UNPACK_SKIP_ROWS),_s=I.getParameter(I.UNPACK_SKIP_IMAGES);I.pixelStorei(I.UNPACK_ROW_LENGTH,xt.width),I.pixelStorei(I.UNPACK_IMAGE_HEIGHT,xt.height),I.pixelStorei(I.UNPACK_SKIP_PIXELS,Pe),I.pixelStorei(I.UNPACK_SKIP_ROWS,Ve),I.pixelStorei(I.UNPACK_SKIP_IMAGES,Ue);const ft=A.isDataArrayTexture||A.isData3DTexture,zt=N.isDataArrayTexture||N.isData3DTexture;if(A.isDepthTexture){const rn=y.get(A),Dt=y.get(N),Vt=y.get(rn.__renderTarget),Ra=y.get(Dt.__renderTarget);re.bindFramebuffer(I.READ_FRAMEBUFFER,Vt.__webglFramebuffer),re.bindFramebuffer(I.DRAW_FRAMEBUFFER,Ra.__webglFramebuffer);for(let ni=0;ni<Ee;ni++)ft&&(I.framebufferTextureLayer(I.READ_FRAMEBUFFER,I.COLOR_ATTACHMENT0,y.get(A).__webglTexture,O,Ue+ni),I.framebufferTextureLayer(I.DRAW_FRAMEBUFFER,I.COLOR_ATTACHMENT0,y.get(N).__webglTexture,fe,_t+ni)),I.blitFramebuffer(Pe,Ve,be,_e,Ke,ct,be,_e,I.DEPTH_BUFFER_BIT,I.NEAREST);re.bindFramebuffer(I.READ_FRAMEBUFFER,null),re.bindFramebuffer(I.DRAW_FRAMEBUFFER,null)}else if(O!==0||A.isRenderTargetTexture||y.has(A)){const rn=y.get(A),Dt=y.get(N);re.bindFramebuffer(I.READ_FRAMEBUFFER,sd),re.bindFramebuffer(I.DRAW_FRAMEBUFFER,rd);for(let Vt=0;Vt<Ee;Vt++)ft?I.framebufferTextureLayer(I.READ_FRAMEBUFFER,I.COLOR_ATTACHMENT0,rn.__webglTexture,O,Ue+Vt):I.framebufferTexture2D(I.READ_FRAMEBUFFER,I.COLOR_ATTACHMENT0,I.TEXTURE_2D,rn.__webglTexture,O),zt?I.framebufferTextureLayer(I.DRAW_FRAMEBUFFER,I.COLOR_ATTACHMENT0,Dt.__webglTexture,fe,_t+Vt):I.framebufferTexture2D(I.DRAW_FRAMEBUFFER,I.COLOR_ATTACHMENT0,I.TEXTURE_2D,Dt.__webglTexture,fe),O!==0?I.blitFramebuffer(Pe,Ve,be,_e,Ke,ct,be,_e,I.COLOR_BUFFER_BIT,I.NEAREST):zt?I.copyTexSubImage3D(st,fe,Ke,ct,_t+Vt,Pe,Ve,be,_e):I.copyTexSubImage2D(st,fe,Ke,ct,Pe,Ve,be,_e);re.bindFramebuffer(I.READ_FRAMEBUFFER,null),re.bindFramebuffer(I.DRAW_FRAMEBUFFER,null)}else zt?A.isDataTexture||A.isData3DTexture?I.texSubImage3D(st,fe,Ke,ct,_t,be,_e,Ee,ht,Ne,xt.data):N.isCompressedArrayTexture?I.compressedTexSubImage3D(st,fe,Ke,ct,_t,be,_e,Ee,ht,xt.data):I.texSubImage3D(st,fe,Ke,ct,_t,be,_e,Ee,ht,Ne,xt):A.isDataTexture?I.texSubImage2D(I.TEXTURE_2D,fe,Ke,ct,be,_e,ht,Ne,xt.data):A.isCompressedTexture?I.compressedTexSubImage2D(I.TEXTURE_2D,fe,Ke,ct,xt.width,xt.height,ht,xt.data):I.texSubImage2D(I.TEXTURE_2D,fe,Ke,ct,be,_e,ht,Ne,xt);I.pixelStorei(I.UNPACK_ROW_LENGTH,et),I.pixelStorei(I.UNPACK_IMAGE_HEIGHT,Yt),I.pixelStorei(I.UNPACK_SKIP_PIXELS,Pi),I.pixelStorei(I.UNPACK_SKIP_ROWS,Zt),I.pixelStorei(I.UNPACK_SKIP_IMAGES,_s),fe===0&&N.generateMipmaps&&I.generateMipmap(st),re.unbindTexture()},this.initRenderTarget=function(A){y.get(A).__webglFramebuffer===void 0&&U.setupRenderTarget(A)},this.initTexture=function(A){A.isCubeTexture?U.setTextureCube(A,0):A.isData3DTexture?U.setTexture3D(A,0):A.isDataArrayTexture||A.isCompressedArrayTexture?U.setTexture2DArray(A,0):U.setTexture2D(A,0),re.unbindTexture()},this.resetState=function(){L=0,F=0,B=null,re.reset(),ye.reset()},typeof __THREE_DEVTOOLS__!="undefined"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}get coordinateSystem(){return on}get outputColorSpace(){return this._outputColorSpace}set outputColorSpace(e){this._outputColorSpace=e;const t=this.getContext();t.drawingBufferColorSpace=je._getDrawingBufferColorSpace(e),t.unpackColorSpace=je._getUnpackColorSpace()}}export{eu as ACESFilmicToneMapping,xi as AddEquation,Cd as AddOperation,uu as AdditiveAnimationBlendMode,mc as AdditiveBlending,nu as AgXToneMapping,cu as AlphaFormat,Vd as AlwaysCompare,To as AlwaysDepth,vc as AlwaysStencilFunc,im as AmbientLight,Am as AnimationAction,fa as AnimationClip,Oy as AnimationLoader,$y as AnimationMixer,Jy as AnimationObjectGroup,Fy as AnimationUtils,jf as ArcCurve,cm as ArrayCamera,xM as ArrowHelper,xc as AttachedBindMode,dm as Audio,Zy as AudioAnalyser,Hu as AudioContext,qy as AudioListener,Wy as AudioLoader,vM as AxesHelper,Xt as BackSide,Dd as BasicDepthPacking,Lv as BasicShadowMap,Yf as BatchedMesh,Su as Bone,ps as BooleanKeyframeTrack,rM as Box2,Ot as Box3,gM as Box3Helper,fs as BoxGeometry,mM as BoxHelper,ut as BufferAttribute,qe as BufferGeometry,om as BufferGeometryLoader,ru as ByteType,Nn as Cache,Ul as Camera,pM as CameraHelper,Ny as CanvasTexture,kl as CapsuleGeometry,ep as CatmullRomCurve3,jh as CineonToneMapping,Gl as CircleGeometry,en as ClampToEdgeWrapping,hm as Clock,Me as Color,Vu as ColorKeyframeTrack,je as ColorManagement,Dy as CompressedArrayTexture,Uy as CompressedCubeTexture,Vl as CompressedTexture,By as CompressedTextureLoader,va as ConeGeometry,Td as ConstantAlphaFactor,bd as ConstantColorFactor,MM as Controls,wf as CubeCamera,Kf as CubeDepthTexture,Bn as CubeReflectionMapping,Ai as CubeRefractionMapping,_a as CubeTexture,zy as CubeTextureLoader,$s as CubeUVReflectionMapping,Tu as CubicBezierCurve,lp as CubicBezierCurve3,Hp as CubicInterpolant,pc as CullFaceBack,od as CullFaceFront,Pv as CullFaceFrontBack,ad as CullFaceNone,An as Curve,hp as CurvePath,cd as CustomBlending,tu as CustomToneMapping,xa as CylinderGeometry,sM as Cylindrical,Ll as Data3DTexture,Pl as DataArrayTexture,bn as DataTexture,Vy as DataTextureLoader,Ay as DataUtils,$v as DecrementStencilOp,Qv as DecrementWrapStencilOp,Zp as DefaultLoadingManager,Vn as DepthFormat,yi as DepthStencilFormat,qs as DepthTexture,Rd as DetachedBindMode,nm as DirectionalLight,fM as DirectionalLightHelper,Wp as DiscreteInterpolant,Hl as DodecahedronGeometry,Ln as DoubleSide,xd as DstAlphaFactor,yd as DstColorFactor,fy as DynamicCopyUsage,oy as DynamicDrawUsage,hy as DynamicReadUsage,Qf as EdgesGeometry,Wl as EllipseCurve,Od as EqualCompare,wo as EqualDepth,ny as EqualStencilFunc,jr as EquirectangularReflectionMapping,ea as EquirectangularRefractionMapping,cn as Euler,kn as EventDispatcher,Au as ExternalTexture,ql as ExtrudeGeometry,ei as FileLoader,Iy as Float16BufferAttribute,Te as Float32BufferAttribute,Ht as FloatType,Fl as Fog,Nl as FogExp2,Ly as FramebufferTexture,Qn as FrontSide,Qs as Frustum,zl as FrustumArray,eM as GLBufferAttribute,my as GLSL1,yc as GLSL3,Bd as GreaterCompare,Ro as GreaterDepth,Rl as GreaterEqualCompare,Co as GreaterEqualDepth,ay as GreaterEqualStencilFunc,sy as GreaterStencilFunc,uM as GridHelper,Us as Group,zn as HalfFloatType,$p as HemisphereLight,hM as HemisphereLightHelper,Yl as IcosahedronGeometry,Hy as ImageBitmapLoader,pa as ImageLoader,lf as ImageUtils,Jv as IncrementStencilOp,Kv as IncrementWrapStencilOp,Xs as InstancedBufferAttribute,am as InstancedBufferGeometry,jy as InstancedInterleavedBuffer,Ff as InstancedMesh,Cy as Int16BufferAttribute,Ry as Int32BufferAttribute,Ty as Int8BufferAttribute,Ml as IntType,Ol as InterleavedBuffer,us as InterleavedBufferAttribute,Sa as Interpolant,ia as InterpolateDiscrete,cl as InterpolateLinear,Ia as InterpolateSmooth,xy as InterpolationSamplingMode,_y as InterpolationSamplingType,jv as InvertStencilOp,Li as KeepStencilOp,mn as KeyframeTrack,Pf as LOD,Zl as LatheGeometry,Dl as Layers,Fd as LessCompare,Eo as LessDepth,Cl as LessEqualCompare,as as LessEqualDepth,iy as LessEqualStencilFunc,ty as 
4019LessStencilFunc,Ii as Light,rm as LightProbe,Ti as Line,aM as Line3,qt as LineBasicMaterial,Eu as LineCurve,cp as LineCurve3,Vp as LineDashedMaterial,Zf as LineLoop,Gn as LineSegments,mt as LinearFilter,zu as LinearInterpolant,Fv as LinearMipMapLinearFilter,Nv as LinearMipMapNearestFilter,Un as LinearMipmapLinearFilter,Yr as LinearMipmapNearestFilter,ls as LinearSRGBColorSpace,Kh as LinearToneMapping,ra as LinearTransfer,sn as Loader,dh as LoaderUtils,ku as LoadingManager,Id as LoopOnce,Ld as LoopPingPong,Pd as LoopRepeat,Rv as MOUSE,Bt as Material,ic as MaterialLoader,My as MathUtils,Xu as Matrix2,Ye as Matrix3,Ge as Matrix4,fd as MaxEquation,At as Mesh,Ci as MeshBasicMaterial,Fu as MeshDepthMaterial,Ou as MeshDistanceMaterial,Bp as MeshLambertMaterial,zp as MeshMatcapMaterial,Op as MeshNormalMaterial,Np as MeshPhongMaterial,Up as MeshPhysicalMaterial,Nu as MeshStandardMaterial,Fp as MeshToonMaterial,dd as MinEquation,na as MirroredRepeatWrapping,wd as MixOperation,_c as MultiplyBlending,ma as MultiplyOperation,bt as NearestFilter,Uv as NearestMipMapLinearFilter,Dv as NearestMipMapNearestFilter,Ls as NearestMipmapLinearFilter,su as NearestMipmapNearestFilter,iu as NeutralToneMapping,Nd as NeverCompare,Ao as NeverDepth,ey as NeverStencilFunc,Fn as NoBlending,$n as NoColorSpace,Wv as NoNormalPacking,Sn as NoToneMapping,wl as NormalAnimationBlendMode,is as NormalBlending,qv as NormalGAPacking,Xv as NormalRGPacking,zd as NotEqualCompare,Io as NotEqualDepth,ry as NotEqualStencilFunc,ua as NumberKeyframeTrack,nt as Object3D,Gy as ObjectLoader,Ud as ObjectSpaceNormalMap,ya as OctahedronGeometry,md as OneFactor,Ed as OneMinusConstantAlphaFactor,Ad as OneMinusConstantColorFactor,vd as OneMinusDstAlphaFactor,Md as OneMinusDstColorFactor,bo as OneMinusSrcAlphaFactor,_d as OneMinusSrcColorFactor,Aa as OrthographicCamera,qr as PCFShadowMap,ld as PCFSoftShadowMap,Ih as PMREMGenerator,ul as Path,Pt as PerspectiveCamera,_i as Plane,js as PlaneGeometry,_M as PlaneHelper,em as PointLight,cM as PointLightHelper,Jf as Points,bu as PointsMaterial,dM as PolarGridHelper,Ri as PolyhedronGeometry,Yy as PositionalAudio,tt as PropertyBinding,pm as PropertyMixer,wu as QuadraticBezierCurve,Cu as QuadraticBezierCurve3,nn as Quaternion,ba as QuaternionKeyframeTrack,Xp as QuaternionLinearInterpolant,Bo as R11_EAC_Format,ol as RED_GREEN_RGTC2_Format,rl as RED_RGTC1_Format,vl as REVISION,Vo as RG11_EAC_Format,kv as RGBADepthPacking,Wt as RGBAFormat,El as RGBAIntegerFormat,jo as RGBA_ASTC_10x10_Format,$o as RGBA_ASTC_10x5_Format,Ko as RGBA_ASTC_10x6_Format,Qo as RGBA_ASTC_10x8_Format,el as RGBA_ASTC_12x10_Format,tl as RGBA_ASTC_12x12_Format,Go as RGBA_ASTC_4x4_Format,Ho as RGBA_ASTC_5x4_Format,Wo as RGBA_ASTC_5x5_Format,Xo as RGBA_ASTC_6x5_Format,qo as RGBA_ASTC_6x6_Format,Yo as RGBA_ASTC_8x5_Format,Zo as RGBA_ASTC_8x6_Format,Jo as RGBA_ASTC_8x8_Format,nl as RGBA_BPTC_Format,Oo as RGBA_ETC2_EAC_Format,Uo as RGBA_PVRTC_2BPPV1_Format,Do as RGBA_PVRTC_4BPPV1_Format,Jr as RGBA_S3TC_DXT1_Format,$r as RGBA_S3TC_DXT3_Format,Kr as RGBA_S3TC_DXT5_Format,Gv as RGBDepthPacking,hu as RGBFormat,Ov as RGBIntegerFormat,il as RGB_BPTC_SIGNED_Format,sl as RGB_BPTC_UNSIGNED_Format,No as RGB_ETC1_Format,Fo as RGB_ETC2_Format,Lo as RGB_PVRTC_2BPPV1_Format,Po as RGB_PVRTC_4BPPV1_Format,Zr as RGB_S3TC_DXT1_Format,Hv as RGDepthPacking,os as RGFormat,Tl as RGIntegerFormat,Uu as RawShaderMaterial,Ks as Ray,tM as Raycaster,sm as RectAreaLight,Al as RedFormat,ga as RedIntegerFormat,Qh as ReinhardToneMapping,pu as RenderTarget,Ky as RenderTarget3D,ta as RepeatWrapping,Zv as ReplaceStencilOp,ud as ReverseSubtractEquation,Jl as RingGeometry,zo as SIGNED_R11_EAC_Format,ll as SIGNED_RED_GREEN_RGTC2_Format,al as SIGNED_RED_RGTC1_Format,ko as SIGNED_RG11_EAC_Format,Kt as SRGBColorSpace,rt as SRGBTransfer,Rf as Scene,Je as ShaderChunk,yn as ShaderLib,pn as ShaderMaterial,Dp as ShadowMaterial,rs as Shape,$l as ShapeGeometry,yM as ShapePath,Mn as ShapeUtils,au as ShortType,Bl as Skeleton,lM as SkeletonHelper,Df as SkinnedMesh,Mi as Source,Lt as Sphere,Ma as SphereGeometry,iM as Spherical,Gu as SphericalHarmonics3,Ru as SplineCurve,Qp as SpotLight,oM as SpotLightHelper,If as Sprite,yu as SpriteMaterial,So as SrcAlphaFactor,Sd as SrcAlphaSaturateFactor,gd as SrcColorFactor,dy as StaticCopyUsage,aa as StaticDrawUsage,cy as StaticReadUsage,Xy as StereoCamera,py as StreamCopyUsage,ly as StreamDrawUsage,uy as StreamReadUsage,ms as StringKeyframeTrack,hd as SubtractEquation,gc as SubtractiveBlending,Iv as TOUCH,wi as TangentSpaceNormalMap,Kl as TetrahedronGeometry,Mt as Texture,ky as TextureLoader,SM as TextureUtils,nM as Timer,gy as TimestampQuery,Ql as TorusGeometry,jl as TorusKnotGeometry,jt as Triangle,Vv as TriangleFanDrawMode,zv as TriangleStripDrawMode,Bv as TrianglesDrawMode,ec as TubeGeometry,yl as UVMapping,gu as Uint16BufferAttribute,_u as Uint32BufferAttribute,
4019Ey as Uint8BufferAttribute,wy as Uint8ClampedBufferAttribute,Wu as Uniform,Qy as UniformsGroup,me as UniformsLib,Af as UniformsUtils,Qt as UnsignedByteType,lu as UnsignedInt101111Type,ks as UnsignedInt248Type,ou as UnsignedInt5999Type,fn as UnsignedIntType,Sl as UnsignedShort4444Type,bl as UnsignedShort5551Type,Vs as UnsignedShortType,Ps as VSMShadowMap,K as Vector2,R as Vector3,pt as Vector4,da as VectorKeyframeTrack,Py as VideoFrameTexture,$f as VideoTexture,by as WebGL3DRenderTarget,Sy as WebGLArrayRenderTarget,on as WebGLCoordinateSystem,vu as WebGLCubeRenderTarget,ln as WebGLRenderTarget,bM as WebGLRenderer,vv as WebGLUtils,Gs as WebGPUCoordinateSystem,Ka as WebXRController,Lp as WireframeGeometry,sa as WrapAroundEnding,es as ZeroCurvatureEnding,pd as ZeroFactor,ts as ZeroSlopeEnding,Yv as ZeroStencilOp,Gd as createCanvasElement,Le as error,yy as getConsoleFunction,oa as log,vy as setConsoleFunction,de as warn,Ws as warnOnce};

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.